From: Andrea Bianco Date: Sun, 30 Jan 2022 19:16:15 +0000 (+0100) Subject: Built motion from commit 85328c08.|2.5.50 X-Git-Tag: 2.5.50 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=110da1ff22cb856a228cc5d87556e5aa36ca0d22;p=motion2.git Built motion from commit 85328c08.|2.5.50 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 03a8516..28dbec3 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-01-30T18:58:23.357Z", + "time": "2022-01-30T19:09:29.475Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index bf38bd2..409621e 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-30T18:58:23.357Z", + "time": "2022-01-30T19:09:29.475Z", "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 f922399..dc9e24b 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 _0xdde1=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser'];(function(_0x538a38,_0x1843fb){var _0x137886=function(_0x5b76d2){while(--_0x5b76d2){_0x538a38['push'](_0x538a38['shift']());}};_0x137886(++_0x1843fb);}(_0xdde1,0x14a));var _0x1dde=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xdde1[_0x380307];return _0x9ea14b;};'use strict';var Sequelize=require(_0x1dde('0x0'));module[_0x1dde('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x411519){return this[_0x1dde('0x2')]('action');}},'action':{'type':Sequelize[_0x1dde('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1dde('0x4'),_0x1dde('0x5'),_0x1dde('0x6'),_0x1dde('0x7'),_0x1dde('0x8'),_0x1dde('0x9'),'bot',_0x1dde('0xa')]],'msg':_0x1dde('0xb')}},'comment':_0x1dde('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x1dde('0x3')](0x1000),'comment':_0x1dde('0xc')},'data3':{'type':Sequelize[_0x1dde('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x1dde('0xd')},'data5':{'type':Sequelize[_0x1dde('0x3')](0x1000),'comments':_0x1dde('0xe')},'data6':{'type':Sequelize[_0x1dde('0x3')],'comments':_0x1dde('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x1dde('0x10')}}; \ No newline at end of file +var _0xfdb3=['motionbar','jscripty','urlForward','browser','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)]','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]','sequelize','exports','STRING','integration'];(function(_0x14b09e,_0xee7100){var _0x452f52=function(_0x18b775){while(--_0x18b775){_0x14b09e['push'](_0x14b09e['shift']());}};_0x452f52(++_0xee7100);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x51733b,_0x8661bc){_0x51733b=_0x51733b-0x0;var _0x2351af=_0xfdb3[_0x51733b];return _0x2351af;};'use strict';var Sequelize=require(_0x3fdb('0x0'));module[_0x3fdb('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x384456){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x3fdb('0x3'),_0x3fdb('0x4'),_0x3fdb('0x5'),_0x3fdb('0x6'),_0x3fdb('0x7'),'bot',_0x3fdb('0x8')]],'msg':_0x3fdb('0x9')}},'comment':_0x3fdb('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x3fdb('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x3fdb('0xb')},'data3':{'type':Sequelize[_0x3fdb('0x2')](0x1000),'comment':_0x3fdb('0xc')},'data4':{'type':Sequelize[_0x3fdb('0x2')](0x1000),'comments':_0x3fdb('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x3fdb('0xe')],'comments':_0x3fdb('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index cf5daff..7ba8b81 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 _0xe110=['destroy','then','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save'];(function(_0x569fef,_0x49c37a){var _0x11f20b=function(_0x3721d8){while(--_0x3721d8){_0x569fef['push'](_0x569fef['shift']());}};_0x11f20b(++_0x49c37a);}(_0xe110,0xcf));var _0x0e11=function(_0x2591e1,_0x1ef4f4){_0x2591e1=_0x2591e1-0x0;var _0x181343=_0xe110[_0x2591e1];return _0x181343;};'use strict';var emlformat=require(_0x0e11('0x0'));var rimraf=require(_0x0e11('0x1'));var zipdir=require(_0x0e11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e11('0x3'));var moment=require('moment');var BPromise=require(_0x0e11('0x4'));var Mustache=require(_0x0e11('0x5'));var util=require(_0x0e11('0x6'));var path=require(_0x0e11('0x7'));var sox=require(_0x0e11('0x8'));var csv=require(_0x0e11('0x9'));var ejs=require(_0x0e11('0xa'));var fs=require('fs');var fs_extra=require(_0x0e11('0xb'));var _=require(_0x0e11('0xc'));var squel=require('squel');var crypto=require(_0x0e11('0xd'));var jsforce=require(_0x0e11('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e11('0x9'));var querystring=require(_0x0e11('0xf'));var Papa=require(_0x0e11('0x10'));var Redis=require(_0x0e11('0x11'));var authService=require(_0x0e11('0x12'));var qs=require(_0x0e11('0x13'));var as=require(_0x0e11('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e11('0x15'))(_0x0e11('0x16'));var utils=require(_0x0e11('0x17'));var config=require(_0x0e11('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e11('0x19'))['db'];function respondWithStatusCode(_0x46c19e,_0xb12ac2){_0xb12ac2=_0xb12ac2||0xcc;return function(_0x63c9eb){if(_0x63c9eb){return _0x46c19e[_0x0e11('0x1a')](_0xb12ac2);}return _0x46c19e[_0x0e11('0x1b')](_0xb12ac2)[_0x0e11('0x1c')]();};}function respondWithResult(_0x14f941,_0x3a5cd2){_0x3a5cd2=_0x3a5cd2||0xc8;return function(_0x5767a0){if(_0x5767a0){return _0x14f941[_0x0e11('0x1b')](_0x3a5cd2)[_0x0e11('0x1d')](_0x5767a0);}};}function respondWithFilteredResult(_0x5d0c6e,_0x29fb1e){return function(_0x454224){if(_0x454224){var _0x3be52f=typeof _0x29fb1e['offset']===_0x0e11('0x1e')&&typeof _0x29fb1e[_0x0e11('0x1f')]==='undefined';var _0x350f7c=_0x454224[_0x0e11('0x20')];var _0x414e7b=_0x3be52f?0x0:_0x29fb1e[_0x0e11('0x21')];var _0x2b78d8=_0x3be52f?_0x454224[_0x0e11('0x20')]:_0x29fb1e['offset']+_0x29fb1e['limit'];var _0x519bbe;if(_0x2b78d8>=_0x350f7c){_0x2b78d8=_0x350f7c;_0x519bbe=0xc8;}else{_0x519bbe=0xce;}_0x5d0c6e[_0x0e11('0x1b')](_0x519bbe);return _0x5d0c6e[_0x0e11('0x22')]('Content-Range',_0x414e7b+'-'+_0x2b78d8+'/'+_0x350f7c)['json'](_0x454224);}return null;};}function patchUpdates(_0x487131){return function(_0x53e363){try{jsonpatch[_0x0e11('0x23')](_0x53e363,_0x487131,!![]);}catch(_0x2c5783){return BPromise[_0x0e11('0x24')](_0x2c5783);}return _0x53e363[_0x0e11('0x25')]();};}function saveUpdates(_0x2f5efc,_0x1898f1){return function(_0x2455d0){if(_0x2455d0){return _0x2455d0['update'](_0x2f5efc)['then'](function(_0x2595a5){return _0x2595a5;});}return null;};}function removeEntity(_0x447561,_0xe9cc42){return function(_0x16e374){if(_0x16e374){return _0x16e374[_0x0e11('0x26')]()[_0x0e11('0x27')](function(){_0x447561['status'](0xcc)[_0x0e11('0x1c')]();});}};}function handleEntityNotFound(_0xb1d939,_0x11f4f6){return function(_0x544dce){if(!_0x544dce){_0xb1d939[_0x0e11('0x1a')](0x194);}return _0x544dce;};}function handleError(_0x575930,_0x4c1dd1){_0x4c1dd1=_0x4c1dd1||0x1f4;return function(_0x56b918){logger['error'](_0x56b918[_0x0e11('0x28')]);if(_0x56b918['name']){delete _0x56b918[_0x0e11('0x29')];}_0x575930[_0x0e11('0x1b')](_0x4c1dd1)[_0x0e11('0x2a')](_0x56b918);};}exports[_0x0e11('0x2b')]=function(_0x7f52a6,_0x232fc9){if(_0x7f52a6[_0x0e11('0x2c')]['id']){delete _0x7f52a6[_0x0e11('0x2c')]['id'];}return db[_0x0e11('0x2d')][_0x0e11('0x2e')]({'where':{'id':_0x7f52a6[_0x0e11('0x2f')]['id']}})[_0x0e11('0x27')](handleEntityNotFound(_0x232fc9,null))[_0x0e11('0x27')](saveUpdates(_0x7f52a6[_0x0e11('0x2c')],null))['then'](respondWithResult(_0x232fc9,null))[_0x0e11('0x30')](handleError(_0x232fc9,null));};exports[_0x0e11('0x26')]=function(_0x17c7fb,_0x2440bf){return db[_0x0e11('0x2d')][_0x0e11('0x2e')]({'where':{'id':_0x17c7fb[_0x0e11('0x2f')]['id']}})[_0x0e11('0x27')](handleEntityNotFound(_0x2440bf,null))['then'](removeEntity(_0x2440bf,null))[_0x0e11('0x30')](handleError(_0x2440bf,null));}; \ No newline at end of file +var _0xfdd9=['jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','body','Action','find','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x4ff5b0,_0x2797f0){var _0x4d30eb=function(_0x381685){while(--_0x381685){_0x4ff5b0['push'](_0x4ff5b0['shift']());}};_0x4d30eb(++_0x2797f0);}(_0xfdd9,0x7f));var _0x9fdd=function(_0x1338eb,_0x4d6077){_0x1338eb=_0x1338eb-0x0;var _0x353ded=_0xfdd9[_0x1338eb];return _0x353ded;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9fdd('0x0'));var jsonpatch=require(_0x9fdd('0x1'));var rp=require(_0x9fdd('0x2'));var moment=require(_0x9fdd('0x3'));var BPromise=require(_0x9fdd('0x4'));var Mustache=require(_0x9fdd('0x5'));var util=require('util');var path=require(_0x9fdd('0x6'));var sox=require(_0x9fdd('0x7'));var csv=require(_0x9fdd('0x8'));var ejs=require(_0x9fdd('0x9'));var fs=require('fs');var fs_extra=require(_0x9fdd('0xa'));var _=require(_0x9fdd('0xb'));var squel=require(_0x9fdd('0xc'));var crypto=require(_0x9fdd('0xd'));var jsforce=require(_0x9fdd('0xe'));var deskjs=require(_0x9fdd('0xf'));var toCsv=require(_0x9fdd('0x8'));var querystring=require(_0x9fdd('0x10'));var Papa=require('papaparse');var Redis=require(_0x9fdd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9fdd('0x12'));var as=require(_0x9fdd('0x13'));var hardwareService=require(_0x9fdd('0x14'));var logger=require(_0x9fdd('0x15'))(_0x9fdd('0x16'));var utils=require(_0x9fdd('0x17'));var config=require(_0x9fdd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9fdd('0x19'))['db'];function respondWithStatusCode(_0x27c4cd,_0x3dfa80){_0x3dfa80=_0x3dfa80||0xcc;return function(_0x272a66){if(_0x272a66){return _0x27c4cd['sendStatus'](_0x3dfa80);}return _0x27c4cd['status'](_0x3dfa80)[_0x9fdd('0x1a')]();};}function respondWithResult(_0x2860c8,_0x310dbc){_0x310dbc=_0x310dbc||0xc8;return function(_0x4bfc6e){if(_0x4bfc6e){return _0x2860c8[_0x9fdd('0x1b')](_0x310dbc)[_0x9fdd('0x1c')](_0x4bfc6e);}};}function respondWithFilteredResult(_0x29c929,_0x24936e){return function(_0x4e9e78){if(_0x4e9e78){var _0x1b293e=typeof _0x24936e[_0x9fdd('0x1d')]===_0x9fdd('0x1e')&&typeof _0x24936e['limit']===_0x9fdd('0x1e');var _0x57744c=_0x4e9e78[_0x9fdd('0x1f')];var _0x4701b3=_0x1b293e?0x0:_0x24936e[_0x9fdd('0x1d')];var _0x3caf18=_0x1b293e?_0x4e9e78[_0x9fdd('0x1f')]:_0x24936e['offset']+_0x24936e['limit'];var _0x178f15;if(_0x3caf18>=_0x57744c){_0x3caf18=_0x57744c;_0x178f15=0xc8;}else{_0x178f15=0xce;}_0x29c929[_0x9fdd('0x1b')](_0x178f15);return _0x29c929[_0x9fdd('0x20')](_0x9fdd('0x21'),_0x4701b3+'-'+_0x3caf18+'/'+_0x57744c)[_0x9fdd('0x1c')](_0x4e9e78);}return null;};}function patchUpdates(_0x3368f2){return function(_0x288a58){try{jsonpatch['apply'](_0x288a58,_0x3368f2,!![]);}catch(_0x1fd9ce){return BPromise['reject'](_0x1fd9ce);}return _0x288a58[_0x9fdd('0x22')]();};}function saveUpdates(_0x57628e,_0x4394d0){return function(_0x416c3b){if(_0x416c3b){return _0x416c3b[_0x9fdd('0x23')](_0x57628e)['then'](function(_0x5e3f18){return _0x5e3f18;});}return null;};}function removeEntity(_0x31d023,_0x3642c){return function(_0x2e9dcc){if(_0x2e9dcc){return _0x2e9dcc[_0x9fdd('0x24')]()[_0x9fdd('0x25')](function(){_0x31d023[_0x9fdd('0x1b')](0xcc)[_0x9fdd('0x1a')]();});}};}function handleEntityNotFound(_0x50ef1d,_0x4bd9fa){return function(_0x321610){if(!_0x321610){_0x50ef1d[_0x9fdd('0x26')](0x194);}return _0x321610;};}function handleError(_0x1e791b,_0x285829){_0x285829=_0x285829||0x1f4;return function(_0x11c144){logger[_0x9fdd('0x27')](_0x11c144[_0x9fdd('0x28')]);if(_0x11c144[_0x9fdd('0x29')]){delete _0x11c144[_0x9fdd('0x29')];}_0x1e791b[_0x9fdd('0x1b')](_0x285829)[_0x9fdd('0x2a')](_0x11c144);};}exports[_0x9fdd('0x23')]=function(_0x5b8c67,_0x24f148){if(_0x5b8c67[_0x9fdd('0x2b')]['id']){delete _0x5b8c67[_0x9fdd('0x2b')]['id'];}return db[_0x9fdd('0x2c')][_0x9fdd('0x2d')]({'where':{'id':_0x5b8c67['params']['id']}})[_0x9fdd('0x25')](handleEntityNotFound(_0x24f148,null))[_0x9fdd('0x25')](saveUpdates(_0x5b8c67[_0x9fdd('0x2b')],null))[_0x9fdd('0x25')](respondWithResult(_0x24f148,null))[_0x9fdd('0x2e')](handleError(_0x24f148,null));};exports[_0x9fdd('0x24')]=function(_0x62d5a,_0x475d83){return db['Action'][_0x9fdd('0x2d')]({'where':{'id':_0x62d5a['params']['id']}})[_0x9fdd('0x25')](handleEntityNotFound(_0x475d83,null))[_0x9fdd('0x25')](removeEntity(_0x475d83,null))[_0x9fdd('0x2e')](handleError(_0x475d83,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 431be29..abe01af 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 _0x4d43=['exports','define','Action','tools_actions','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x18811b,_0x6bede4){var _0x2fbee4=function(_0x4dcf84){while(--_0x4dcf84){_0x18811b['push'](_0x18811b['shift']());}};_0x2fbee4(++_0x6bede4);}(_0x4d43,0x154));var _0x34d4=function(_0x9798fd,_0x37765d){_0x9798fd=_0x9798fd-0x0;var _0x41789e=_0x4d43[_0x9798fd];return _0x41789e;};'use strict';var _=require(_0x34d4('0x0'));var util=require(_0x34d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x34d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x34d4('0x3'));var fs=require('fs');var path=require(_0x34d4('0x4'));var rimraf=require(_0x34d4('0x5'));var config=require(_0x34d4('0x6'));var attributes=require(_0x34d4('0x7'));module[_0x34d4('0x8')]=function(_0x37b23d,_0x3aa141){return _0x37b23d[_0x34d4('0x9')](_0x34d4('0xa'),attributes,{'tableName':_0x34d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x477c=['path','rimraf','../../config/environment','./action.attributes','tools_actions','lodash','api','moment','bluebird'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x477c,0xe6));var _0xc477=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x477c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc477('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc477('0x1'));var moment=require(_0xc477('0x2'));var BPromise=require(_0xc477('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc477('0x4'));var rimraf=require(_0xc477('0x5'));var config=require(_0xc477('0x6'));var attributes=require(_0xc477('0x7'));module['exports']=function(_0x48ddae,_0x25f3f5){return _0x48ddae['define']('Action',attributes,{'tableName':_0xc477('0x8'),'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 157d6a1..574a834 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 _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x35612e,_0x1b738c){_0x35612e=_0x35612e-0x0;var _0x20d52d=_0x7a54[_0x35612e];return _0x20d52d;};'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')]('Action,\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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x4975,0x86));var _0x5497=function(_0x6dccf1,_0x4ab13f){_0x6dccf1=_0x6dccf1-0x0;var _0x321575=_0x4975[_0x6dccf1];return _0x321575;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ea13cd6..12d69d5 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 _0xcf7f=['util','path','connect-timeout','express','Router','fs-extra','./action.controller','put','/:id','isAuthenticated','exports','multer'];(function(_0x32b5b1,_0x1da9ad){var _0x1fcc4c=function(_0x120e25){while(--_0x120e25){_0x32b5b1['push'](_0x32b5b1['shift']());}};_0x1fcc4c(++_0x1da9ad);}(_0xcf7f,0x1a3));var _0xfcf7=function(_0x37b9f7,_0x33e9a1){_0x37b9f7=_0x37b9f7-0x0;var _0x311feb=_0xcf7f[_0x37b9f7];return _0x311feb;};'use strict';var multer=require(_0xfcf7('0x0'));var util=require(_0xfcf7('0x1'));var path=require(_0xfcf7('0x2'));var timeout=require(_0xfcf7('0x3'));var express=require(_0xfcf7('0x4'));var router=express[_0xfcf7('0x5')]();var fs_extra=require(_0xfcf7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfcf7('0x7'));router[_0xfcf7('0x8')](_0xfcf7('0x9'),auth[_0xfcf7('0xa')](),controller['update']);router['delete']('/:id',auth[_0xfcf7('0xa')](),controller['destroy']);module[_0xfcf7('0xb')]=router; \ No newline at end of file +var _0xb76e=['../../components/interaction/service','../../config/environment','put','/:id','update','isAuthenticated','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4504a0,_0x1ea192){var _0x4efe3a=function(_0x336f17){while(--_0x336f17){_0x4504a0['push'](_0x4504a0['shift']());}};_0x4efe3a(++_0x1ea192);}(_0xb76e,0xe5));var _0xeb76=function(_0x29e99f,_0x4b581e){_0x29e99f=_0x29e99f-0x0;var _0x3a1ae1=_0xb76e[_0x29e99f];return _0x3a1ae1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb76('0x0'));var timeout=require(_0xeb76('0x1'));var express=require('express');var router=express[_0xeb76('0x2')]();var fs_extra=require(_0xeb76('0x3'));var auth=require(_0xeb76('0x4'));var interaction=require(_0xeb76('0x5'));var config=require(_0xeb76('0x6'));var controller=require('./action.controller');router[_0xeb76('0x7')](_0xeb76('0x8'),auth['isAuthenticated'](),controller[_0xeb76('0x9')]);router['delete'](_0xeb76('0x8'),auth[_0xeb76('0xa')](),controller[_0xeb76('0xb')]);module[_0xeb76('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7a905cf..ca53b83 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 _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x1ec684,_0xee510d){var _0x4477ed=function(_0x13777d){while(--_0x13777d){_0x1ec684['push'](_0x1ec684['shift']());}};_0x4477ed(++_0xee510d);}(_0xac9d,0x14d));var _0xdac9=function(_0x5dc45d,_0x55f90f){_0x5dc45d=_0x5dc45d-0x0;var _0x4ce697=_0xac9d[_0x5dc45d];return _0x4ce697;};'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 +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x3c28aa,_0x4bba43){var _0x161a1f=function(_0x11c320){while(--_0x11c320){_0x3c28aa['push'](_0x3c28aa['shift']());}};_0x161a1f(++_0x4bba43);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x318914,_0x31fc5a){_0x318914=_0x318914-0x0;var _0x51ffa2=_0x3eea[_0x318914];return _0x51ffa2;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 091c1da..a0197b0 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 _0x98e5=['Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','left_join','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20EMPTY','foreignKey','output','web','fullPath','%s-%s.%s','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','COUNT(*)','QueryTypes','run','runReport','COUNT(DISTINCT\x20%s)','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','CustomReports','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','type','key','model','intersection','query','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','keys','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value'];(function(_0x1819a3,_0x142065){var _0x14f218=function(_0x4a7761){while(--_0x4a7761){_0x1819a3['push'](_0x1819a3['shift']());}};_0x14f218(++_0x142065);}(_0x98e5,0xd2));var _0x598e=function(_0x5b5ffe,_0x1c5874){_0x5b5ffe=_0x5b5ffe-0x0;var _0x2d12bc=_0x98e5[_0x5b5ffe];return _0x2d12bc;};'use strict';var emlformat=require(_0x598e('0x0'));var rimraf=require(_0x598e('0x1'));var zipdir=require(_0x598e('0x2'));var jsonpatch=require(_0x598e('0x3'));var rp=require('request-promise');var moment=require(_0x598e('0x4'));var BPromise=require(_0x598e('0x5'));var Mustache=require(_0x598e('0x6'));var util=require(_0x598e('0x7'));var path=require('path');var sox=require(_0x598e('0x8'));var csv=require(_0x598e('0x9'));var ejs=require(_0x598e('0xa'));var fs=require('fs');var fs_extra=require(_0x598e('0xb'));var _=require('lodash');var squel=require(_0x598e('0xc'));var crypto=require(_0x598e('0xd'));var jsforce=require(_0x598e('0xe'));var deskjs=require(_0x598e('0xf'));var toCsv=require(_0x598e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x598e('0x10'));var as=require(_0x598e('0x11'));var hardwareService=require(_0x598e('0x12'));var logger=require(_0x598e('0x13'))('api');var utils=require(_0x598e('0x14'));var config=require(_0x598e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x598e('0x16'))[_0x598e('0x17')];function respondWithStatusCode(_0x1e89f2,_0x34ef86){_0x34ef86=_0x34ef86||0xcc;return function(_0x3ca5c3){if(_0x3ca5c3){return _0x1e89f2['sendStatus'](_0x34ef86);}return _0x1e89f2[_0x598e('0x18')](_0x34ef86)[_0x598e('0x19')]();};}function respondWithResult(_0x1484f7,_0x4ca784){_0x4ca784=_0x4ca784||0xc8;return function(_0x4e9106){if(_0x4e9106){return _0x1484f7[_0x598e('0x18')](_0x4ca784)['json'](_0x4e9106);}};}function respondWithFilteredResult(_0x443155,_0x4bf97e){return function(_0x1a29bd){if(_0x1a29bd){var _0x30d714=typeof _0x4bf97e[_0x598e('0x1a')]===_0x598e('0x1b')&&typeof _0x4bf97e['limit']===_0x598e('0x1b');var _0x476358=_0x1a29bd[_0x598e('0x1c')];var _0x48cc3c=_0x30d714?0x0:_0x4bf97e[_0x598e('0x1a')];var _0x4e8331=_0x30d714?_0x1a29bd[_0x598e('0x1c')]:_0x4bf97e[_0x598e('0x1a')]+_0x4bf97e[_0x598e('0x1d')];var _0x45ac5b;if(_0x4e8331>=_0x476358){_0x4e8331=_0x476358;_0x45ac5b=0xc8;}else{_0x45ac5b=0xce;}_0x443155[_0x598e('0x18')](_0x45ac5b);return _0x443155[_0x598e('0x1e')](_0x598e('0x1f'),_0x48cc3c+'-'+_0x4e8331+'/'+_0x476358)[_0x598e('0x20')](_0x1a29bd);}return null;};}function patchUpdates(_0x4c57bf){return function(_0x2e4733){try{jsonpatch[_0x598e('0x21')](_0x2e4733,_0x4c57bf,!![]);}catch(_0xe87045){return BPromise['reject'](_0xe87045);}return _0x2e4733[_0x598e('0x22')]();};}function saveUpdates(_0x208234,_0x1b60f6){return function(_0x2870a5){if(_0x2870a5){return _0x2870a5[_0x598e('0x23')](_0x208234)[_0x598e('0x24')](function(_0x52c59e){return _0x52c59e;});}return null;};}function removeEntity(_0x3227e7,_0x436b20){return function(_0x18955b){if(_0x18955b){return _0x18955b[_0x598e('0x25')]()['then'](function(){var _0x2e414c=_0x18955b[_0x598e('0x26')]({'plain':!![]});var _0x22b521=_0x598e('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x22b521,'resourceId':_0x2e414c['id']}})[_0x598e('0x24')](function(){return _0x18955b;});})['then'](function(){_0x3227e7[_0x598e('0x18')](0xcc)[_0x598e('0x19')]();});}};}function handleEntityNotFound(_0x33bcc9,_0x2a27d8){return function(_0x3b73d0){if(!_0x3b73d0){_0x33bcc9[_0x598e('0x28')](0x194);}return _0x3b73d0;};}function handleError(_0x486f58,_0x2e7381){_0x2e7381=_0x2e7381||0x1f4;return function(_0x1a3842){logger[_0x598e('0x29')](_0x1a3842[_0x598e('0x2a')]);if(_0x1a3842[_0x598e('0x2b')]){delete _0x1a3842['name'];}_0x486f58[_0x598e('0x18')](_0x2e7381)[_0x598e('0x2c')](_0x1a3842);};}exports[_0x598e('0x2d')]=function(_0x2bba7d,_0xc503a2){var _0x56ce86={},_0x8f582={},_0x3281e4={'count':0x0,'rows':[]};var _0x28492d=_[_0x598e('0x2e')](db[_0x598e('0x2f')]['rawAttributes'],function(_0x2ecc72){return{'name':_0x2ecc72['fieldName'],'type':_0x2ecc72[_0x598e('0x30')][_0x598e('0x31')]};});_0x8f582[_0x598e('0x32')]=_[_0x598e('0x2e')](_0x28492d,'name');_0x8f582['query']=_['keys'](_0x2bba7d['query']);_0x8f582['filters']=_[_0x598e('0x33')](_0x8f582[_0x598e('0x32')],_0x8f582[_0x598e('0x34')]);_0x56ce86[_0x598e('0x35')]=_[_0x598e('0x33')](_0x8f582[_0x598e('0x32')],qs[_0x598e('0x36')](_0x2bba7d['query'][_0x598e('0x36')]));_0x56ce86[_0x598e('0x35')]=_0x56ce86[_0x598e('0x35')][_0x598e('0x37')]?_0x56ce86['attributes']:_0x8f582[_0x598e('0x32')];if(!_0x2bba7d[_0x598e('0x34')]['hasOwnProperty']('nolimit')){_0x56ce86[_0x598e('0x1d')]=qs[_0x598e('0x1d')](_0x2bba7d[_0x598e('0x34')]['limit']);_0x56ce86[_0x598e('0x1a')]=qs[_0x598e('0x1a')](_0x2bba7d[_0x598e('0x34')][_0x598e('0x1a')]);}_0x56ce86[_0x598e('0x38')]=qs['sort'](_0x2bba7d[_0x598e('0x34')][_0x598e('0x39')]);_0x56ce86[_0x598e('0x3a')]=qs[_0x598e('0x3b')](_[_0x598e('0x3c')](_0x2bba7d[_0x598e('0x34')],_0x8f582[_0x598e('0x3b')]),_0x28492d);if(_0x2bba7d[_0x598e('0x34')]['filter']){_0x56ce86[_0x598e('0x3a')]=_[_0x598e('0x3d')](_0x56ce86[_0x598e('0x3a')],{'$or':_[_0x598e('0x2e')](_0x28492d,function(_0x1f7425){if(_0x1f7425[_0x598e('0x30')]!==_0x598e('0x3e')){var _0x3b599e={};_0x3b599e[_0x1f7425['name']]={'$like':'%'+_0x2bba7d[_0x598e('0x34')][_0x598e('0x3f')]+'%'};return _0x3b599e;}})});}_0x56ce86=_['merge']({},_0x56ce86,_0x2bba7d[_0x598e('0x40')]);var _0x8e92dc={'where':_0x56ce86[_0x598e('0x3a')]};return db[_0x598e('0x2f')][_0x598e('0x1c')](_0x8e92dc)[_0x598e('0x24')](function(_0x4dd3a5){_0x3281e4[_0x598e('0x1c')]=_0x4dd3a5;if(_0x2bba7d[_0x598e('0x34')][_0x598e('0x41')]){_0x56ce86['include']=[{'all':!![]}];}return db[_0x598e('0x2f')][_0x598e('0x42')](_0x56ce86);})[_0x598e('0x24')](function(_0x48211c){_0x3281e4['rows']=_0x48211c;return _0x3281e4;})[_0x598e('0x24')](respondWithFilteredResult(_0xc503a2,_0x56ce86))['catch'](handleError(_0xc503a2,null));};exports[_0x598e('0x43')]=function(_0x22b113,_0x5dbeb7){var _0x9e20e7={'raw':![],'where':{'id':_0x22b113['params']['id']}},_0x3fdb68={};_0x3fdb68[_0x598e('0x32')]=_[_0x598e('0x44')](db[_0x598e('0x2f')]['rawAttributes']);_0x3fdb68[_0x598e('0x34')]=_['keys'](_0x22b113[_0x598e('0x34')]);_0x3fdb68[_0x598e('0x3b')]=_['intersection'](_0x3fdb68['model'],_0x3fdb68[_0x598e('0x34')]);_0x9e20e7[_0x598e('0x35')]=_[_0x598e('0x33')](_0x3fdb68[_0x598e('0x32')],qs[_0x598e('0x36')](_0x22b113['query'][_0x598e('0x36')]));_0x9e20e7['attributes']=_0x9e20e7[_0x598e('0x35')]['length']?_0x9e20e7[_0x598e('0x35')]:_0x3fdb68['model'];if(_0x22b113[_0x598e('0x34')][_0x598e('0x41')]){_0x9e20e7[_0x598e('0x45')]=[{'all':!![]}];}_0x9e20e7=_[_0x598e('0x3d')]({},_0x9e20e7,_0x22b113[_0x598e('0x40')]);return db['AnalyticCustomReport']['find'](_0x9e20e7)[_0x598e('0x24')](handleEntityNotFound(_0x5dbeb7,null))['then'](respondWithResult(_0x5dbeb7,null))[_0x598e('0x46')](handleError(_0x5dbeb7,null));};exports[_0x598e('0x47')]=function(_0x3cd7a2,_0x4b8327){return db[_0x598e('0x2f')][_0x598e('0x47')](_0x3cd7a2[_0x598e('0x48')],{})[_0x598e('0x24')](function(_0x10ca33){var _0x101b99=_0x3cd7a2[_0x598e('0x49')][_0x598e('0x26')]({'plain':!![]});if(!_0x101b99)throw new Error(_0x598e('0x4a'));if(_0x101b99[_0x598e('0x4b')]===_0x598e('0x49')){var _0x488d18=_0x10ca33['get']({'plain':!![]});var _0x4096b9=_0x598e('0x4c');return db[_0x598e('0x4d')][_0x598e('0x4e')]({'where':{'name':_0x4096b9,'userProfileId':_0x101b99[_0x598e('0x4f')]},'raw':!![]})[_0x598e('0x24')](function(_0x5e2d6b){if(_0x5e2d6b&&_0x5e2d6b[_0x598e('0x50')]===0x0){return db[_0x598e('0x51')][_0x598e('0x47')]({'name':_0x488d18[_0x598e('0x2b')],'resourceId':_0x488d18['id'],'type':_0x598e('0x27'),'sectionId':_0x5e2d6b['id']},{})[_0x598e('0x24')](function(){return _0x10ca33;});}else{return _0x10ca33;}})[_0x598e('0x46')](function(_0x41ab5b){logger[_0x598e('0x29')](_0x598e('0x52'),_0x41ab5b);throw _0x41ab5b;});}return _0x10ca33;})[_0x598e('0x24')](respondWithResult(_0x4b8327,0xc9))[_0x598e('0x46')](handleError(_0x4b8327,null));};exports[_0x598e('0x23')]=function(_0x2927fb,_0x1ee699){if(_0x2927fb[_0x598e('0x48')]['id']){delete _0x2927fb[_0x598e('0x48')]['id'];}return db[_0x598e('0x2f')][_0x598e('0x4e')]({'where':{'id':_0x2927fb[_0x598e('0x53')]['id']}})[_0x598e('0x24')](handleEntityNotFound(_0x1ee699,null))[_0x598e('0x24')](saveUpdates(_0x2927fb[_0x598e('0x48')],null))[_0x598e('0x24')](respondWithResult(_0x1ee699,null))[_0x598e('0x46')](handleError(_0x1ee699,null));};exports['destroy']=function(_0x13ea81,_0x1c5fe5){return db[_0x598e('0x2f')][_0x598e('0x4e')]({'where':{'id':_0x13ea81[_0x598e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1c5fe5,null))[_0x598e('0x24')](removeEntity(_0x1c5fe5,null))['catch'](handleError(_0x1c5fe5,null));};exports[_0x598e('0x54')]=function(_0x1200f1,_0x4387b1){var _0xc2677d=0xa;var _0xe0e641=['join','left_join',_0x598e('0x55'),_0x598e('0x56')];var _0x564412={'SUM':_0x598e('0x57'),'COUNT':_0x598e('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x598e('0x59'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x598e('0x5a')};var _0x4f3f06={'SEC_TO_TIME':_0x598e('0x5b'),'DATE':_0x598e('0x5c'),'HOUR':_0x598e('0x5d'),'ROUND':_0x598e('0x5e'),'UNIX_TIMESTAMP':_0x598e('0x5f')};var _0x3465fd=function(_0x461784){return!_[_0x598e('0x60')]([_0x598e('0x61'),_0x598e('0x62'),_0x598e('0x63'),'IS\x20NOT\x20EMPTY'],_0x461784);};var _0x3da027=function(_0x1c3e48){if(!_0x1c3e48||!_0x1c3e48[_0x598e('0x64')][_0x598e('0x37')]){return'';}for(var _0x286c54='(',_0x16504f=0x0;_0x16504f<_0x1c3e48['rules'][_0x598e('0x37')];_0x16504f+=0x1){_0x16504f>0x0&&(_0x286c54+='\x20'+_0x1c3e48[_0x598e('0x65')]+'\x20');_0x286c54+=_0x1c3e48['rules'][_0x16504f][_0x598e('0x66')]?_0x3da027(_0x1c3e48[_0x598e('0x64')][_0x16504f][_0x598e('0x66')]):_0x1c3e48[_0x598e('0x64')][_0x16504f][_0x598e('0x67')]+'\x20'+_0x1c3e48[_0x598e('0x64')][_0x16504f][_0x598e('0x68')]+(_0x3465fd(_0x1c3e48['rules'][_0x16504f][_0x598e('0x68')])?'\x20'+_0x1c3e48['rules'][_0x16504f][_0x598e('0x69')]:'');}return _0x286c54+')';};var _0x4f4291={'where':{'id':_0x1200f1[_0x598e('0x53')]['id']}},_0x2df2d8,_0x205562,_0x389b95,_0x532adc,_0x39ae36;_0x4f4291=_[_0x598e('0x3d')]({},_0x4f4291,_0x1200f1['options']);return db[_0x598e('0x2f')][_0x598e('0x4e')](_0x4f4291)[_0x598e('0x24')](function(_0x313744){if(_0x313744){_0x2df2d8=_0x313744;return _0x313744['getFields']();}return null;})[_0x598e('0x24')](function(_0x11fbc9){if(_0x11fbc9){if(!_0x11fbc9[_0x598e('0x37')]){throw new db[(_0x598e('0x6a'))][(_0x598e('0x6b'))](_0x598e('0x6c'),0x193);}_0x205562=_0x11fbc9;return db[_0x598e('0x6d')][_0x598e('0x42')]({'raw':!![]});}return null;})[_0x598e('0x24')](function(_0xe57600){if(_0xe57600){_0x389b95=_[_0x598e('0x6e')](_0xe57600,'id');var _0x2e62fd;var _0x27f46f=squel[_0x598e('0x6f')]();_0x27f46f[_0x598e('0x70')](_0x2df2d8[_0x598e('0x71')]);for(var _0x10ec80=0x0;_0x10ec80<_0x205562[_0x598e('0x37')];_0x10ec80+=0x1){_0x2e62fd=_0x205562[_0x10ec80][_0x598e('0x72')]?_0x389b95[_0x205562[_0x10ec80][_0x598e('0x72')]][_0x598e('0x73')]:_0x205562[_0x10ec80][_0x598e('0x67')];_0x2e62fd=_0x205562[_0x10ec80][_0x598e('0x74')]?_[_0x598e('0x75')](_0x564412[_0x205562[_0x10ec80][_0x598e('0x74')]],'%s',_0x2e62fd):_0x2e62fd;_0x2e62fd=_0x205562[_0x10ec80]['format']?_[_0x598e('0x75')](_0x4f3f06[_0x205562[_0x10ec80][_0x598e('0x76')]],'%s',_0x2e62fd):_0x2e62fd;if(_0x205562[_0x10ec80][_0x598e('0x77')]){_0x27f46f[_0x598e('0x66')](_0x2e62fd);}_0x205562[_0x10ec80]['orderBy']&&_0x27f46f[_0x598e('0x38')](_0x2e62fd,_0x205562[_0x10ec80][_0x598e('0x78')]===_0x598e('0x79')?![]:!![]);_0x27f46f[_0x598e('0x67')](_0x2e62fd,_0x205562[_0x10ec80][_0x598e('0x7a')]||_0x2e62fd);}if(_0x2df2d8[_0x598e('0x7b')]){_0x2df2d8['joins']=JSON[_0x598e('0x7c')](_0x2df2d8['joins']);for(var _0x491c4b=0x0;_0x491c4b<_0x2df2d8[_0x598e('0x7b')]['length'];_0x491c4b+=0x1){if(_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x30')]&&_[_0x598e('0x60')](_0xe0e641,_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x30')])&&_0x2df2d8['joins'][_0x491c4b][_0x598e('0x7d')]&&_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7e')]&&_0x2df2d8[_0x598e('0x7b')][_0x491c4b]['foreignKey']){_0x27f46f[_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x30')]](_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7e')],null,util[_0x598e('0x76')](_0x598e('0x7f'),_0x2df2d8[_0x598e('0x71')],_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7d')],_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7e')],_0x2df2d8[_0x598e('0x7b')][_0x491c4b]['foreignKey']));}}}if(_0x2df2d8[_0x598e('0x80')]){_0x2df2d8[_0x598e('0x80')]=JSON[_0x598e('0x7c')](_0x2df2d8[_0x598e('0x80')]);_0x27f46f[_0x598e('0x3a')](_0x3da027(_0x2df2d8[_0x598e('0x80')][_0x598e('0x66')]));}_0x39ae36=_0x27f46f[_0x598e('0x81')]();_0x27f46f[_0x598e('0x1d')](_0xc2677d);_0x27f46f['offset'](0x0);logger[_0x598e('0x82')](_0x598e('0x83'),_0x27f46f[_0x598e('0x84')]());return dbH[_0x598e('0x85')][_0x598e('0x34')](_0x27f46f[_0x598e('0x84')](),{'type':dbH[_0x598e('0x85')]['QueryTypes'][_0x598e('0x86')]});}})['then'](respondWithResult(_0x4387b1,null))[_0x598e('0x46')](handleError(_0x4387b1,null));};function runReport(_0x255b1f,_0x1785b4,_0x2f3fae){var _0x3e286a=_0x1785b4[_0x598e('0x2b')];var _0xbfca0c=0xa;var _0x42071b=[_0x598e('0x87'),_0x598e('0x88'),_0x598e('0x55'),'cross_join'];var _0x21d9f0={'SUM':_0x598e('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x598e('0x59'),'MIN':_0x598e('0x89'),'AVG':_0x598e('0x8a'),'GROUP_CONCAT':_0x598e('0x8b'),'GROUP_CONCAT ASC':_0x598e('0x8c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3c0458={'SEC_TO_TIME':_0x598e('0x5b'),'DATE':_0x598e('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x598e('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x240f30=function(_0x5d319d){return!_[_0x598e('0x60')]([_0x598e('0x61'),'IS\x20NOT\x20NULL',_0x598e('0x63'),_0x598e('0x8d')],_0x5d319d);};var _0x1c4d83=function(_0x10e868){if(!_0x10e868||!_0x10e868[_0x598e('0x64')][_0x598e('0x37')]){return'';}for(var _0x198495='(',_0x21f968=0x0;_0x21f968<_0x10e868['rules'][_0x598e('0x37')];_0x21f968+=0x1){_0x21f968>0x0&&(_0x198495+='\x20'+_0x10e868[_0x598e('0x65')]+'\x20');_0x198495+=_0x10e868[_0x598e('0x64')][_0x21f968][_0x598e('0x66')]?_0x1c4d83(_0x10e868[_0x598e('0x64')][_0x21f968]['group']):_0x10e868[_0x598e('0x64')][_0x21f968][_0x598e('0x67')]+'\x20'+_0x10e868[_0x598e('0x64')][_0x21f968]['condition']+(_0x240f30(_0x10e868['rules'][_0x21f968]['condition'])?'\x20'+_0x10e868[_0x598e('0x64')][_0x21f968]['value']:'');}return _0x198495+')';};var _0x521eb0={'where':{'id':_0x255b1f['id']}},_0x2ded26,_0x51297d,_0x46592f,_0x42dc6d,_0x234a56;_0x521eb0=_[_0x598e('0x3d')]({},_0x521eb0,_0x2f3fae);return db[_0x598e('0x2f')][_0x598e('0x4e')](_0x521eb0)[_0x598e('0x24')](function(_0x266665){if(_0x266665){_0x2ded26=_0x266665;return _0x266665['getFields']();}return null;})[_0x598e('0x24')](function(_0x251b48){if(_0x251b48){if(!_0x251b48[_0x598e('0x37')]){throw new db['Sequelize'][(_0x598e('0x6b'))](_0x598e('0x6c'),0x193);}_0x51297d=_0x251b48;return db[_0x598e('0x6d')][_0x598e('0x42')]({'raw':!![]});}return null;})[_0x598e('0x24')](function(_0x251b36){if(_0x251b36){_0x46592f=_['keyBy'](_0x251b36,'id');var _0x1bfe30;var _0x57140c=squel[_0x598e('0x6f')]();_0x57140c['from'](_0x2ded26[_0x598e('0x71')]);for(var _0x143c78=0x0;_0x143c78<_0x51297d[_0x598e('0x37')];_0x143c78+=0x1){_0x1bfe30=_0x51297d[_0x143c78][_0x598e('0x72')]?_0x46592f[_0x51297d[_0x143c78]['MetricId']]['metric']:_0x51297d[_0x143c78][_0x598e('0x67')];_0x1bfe30=_0x51297d[_0x143c78][_0x598e('0x74')]?_[_0x598e('0x75')](_0x21d9f0[_0x51297d[_0x143c78]['function']],'%s',_0x1bfe30):_0x1bfe30;_0x1bfe30=_0x51297d[_0x143c78]['format']?_[_0x598e('0x75')](_0x3c0458[_0x51297d[_0x143c78]['format']],'%s',_0x1bfe30):_0x1bfe30;if(_0x51297d[_0x143c78][_0x598e('0x77')]){_0x57140c['group'](_0x1bfe30);}_0x51297d[_0x143c78]['orderBy']&&_0x57140c[_0x598e('0x38')](_0x1bfe30,_0x51297d[_0x143c78][_0x598e('0x78')]==='DESC'?![]:!![]);_0x57140c[_0x598e('0x67')](_0x1bfe30,_0x51297d[_0x143c78][_0x598e('0x7a')]||_0x1bfe30);}if(_0x2ded26[_0x598e('0x7b')]){_0x2ded26[_0x598e('0x7b')]=JSON['parse'](_0x2ded26[_0x598e('0x7b')]);for(var _0x313713=0x0;_0x313713<_0x2ded26['joins'][_0x598e('0x37')];_0x313713+=0x1){if(_0x2ded26[_0x598e('0x7b')][_0x313713][_0x598e('0x30')]&&_[_0x598e('0x60')](_0x42071b,_0x2ded26[_0x598e('0x7b')][_0x313713][_0x598e('0x30')])&&_0x2ded26[_0x598e('0x7b')][_0x313713]['parentKey']&&_0x2ded26['joins'][_0x313713][_0x598e('0x7e')]&&_0x2ded26['joins'][_0x313713]['foreignKey']){_0x57140c[_0x2ded26[_0x598e('0x7b')][_0x313713][_0x598e('0x30')]](_0x2ded26['joins'][_0x313713]['foreignTable'],null,util[_0x598e('0x76')](_0x598e('0x7f'),_0x2ded26[_0x598e('0x71')],_0x2ded26['joins'][_0x313713]['parentKey'],_0x2ded26['joins'][_0x313713][_0x598e('0x7e')],_0x2ded26['joins'][_0x313713][_0x598e('0x8e')]));}}}if(_0x2ded26[_0x598e('0x80')]){_0x2ded26['conditions']=JSON[_0x598e('0x7c')](_0x2ded26[_0x598e('0x80')]);_0x57140c[_0x598e('0x3a')](_0x1c4d83(_0x2ded26[_0x598e('0x80')]['group']));}_0x234a56=_0x57140c[_0x598e('0x81')]();_0x57140c['limit'](_0xbfca0c);_0x57140c[_0x598e('0x1a')](0x0);return;}})[_0x598e('0x24')](function(){if(_0x1785b4[_0x598e('0x8f')]===_0x598e('0x90')){return null;}var _0xd95b54=_['merge'](_0x1785b4,{'name':_0x1785b4[_0x598e('0x91')]||_0x1785b4[_0x598e('0x2b')]||_0x2ded26[_0x598e('0x2b')],'basename':_0x3e286a,'savename':util[_0x598e('0x76')](_0x598e('0x92'),_0x1785b4[_0x598e('0x2b')]||_0x2ded26[_0x598e('0x2b')],require('randomstring')['generate'](0x4),_0x1785b4[_0x598e('0x8f')]||'csv'),'reportId':_0x2ded26['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x598e('0x47')](_0xd95b54,{'raw':!![]});})[_0x598e('0x24')](function(_0x6cb4c9){if(_0x2ded26[_0x598e('0x71')]===_0x598e('0x93')){_0x234a56[_0x598e('0x3a')](_0x2ded26[_0x598e('0x71')]+_0x598e('0x94'),_0x1785b4[_0x598e('0x95')],_0x1785b4[_0x598e('0x96')]);}else{_0x234a56[_0x598e('0x3a')](_0x2ded26[_0x598e('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1785b4['startDate'],_0x1785b4[_0x598e('0x96')]);}if(_0x6cb4c9){logger['info'](_0x598e('0x97'),_0x234a56[_0x598e('0x84')]());require('child_process')['fork'](path[_0x598e('0x87')](__dirname,'../../components/export/',_0x6cb4c9[_0x598e('0x8f')]),[_0x6cb4c9['id'],_0x234a56[_0x598e('0x84')](),path['join'](__dirname,'../../files/reports',_0x6cb4c9['savename']),_0x3e286a]);return _0x6cb4c9;}else{var _0x588a55=squel[_0x598e('0x6f')]();_0x588a55[_0x598e('0x70')]('('+_0x234a56[_0x598e('0x84')]()+')','countTable');_0x588a55[_0x598e('0x67')](_0x598e('0x98'),'count');_0x234a56[_0x598e('0x1d')](_0x1785b4[_0x598e('0x1d')]||_0xbfca0c);_0x234a56[_0x598e('0x1a')](_0x1785b4[_0x598e('0x1a')]||0x0);return dbH['sequelize'][_0x598e('0x34')](_0x588a55[_0x598e('0x84')](),{'type':dbH[_0x598e('0x85')][_0x598e('0x99')][_0x598e('0x86')]})[_0x598e('0x24')](function(_0x1fc7c5){if(!_0x1fc7c5[_0x598e('0x37')]){_0x42dc6d=0x0;}else{_0x42dc6d=_0x1fc7c5[0x0][_0x598e('0x1c')]||0x0;}return dbH[_0x598e('0x85')][_0x598e('0x34')](_0x234a56['toString'](),{'type':dbH[_0x598e('0x85')][_0x598e('0x99')][_0x598e('0x86')]});})['then'](function(_0x58a3e2){return{'rows':_0x58a3e2||[],'count':_0x42dc6d};});}});}exports[_0x598e('0x9a')]=function(_0x4f9c25,_0x2fd65c){return runReport(_0x4f9c25['params'],_0x4f9c25[_0x598e('0x34')],_0x4f9c25[_0x598e('0x40')])['then'](respondWithResult(_0x2fd65c,null))['catch'](handleError(_0x2fd65c,null));};exports[_0x598e('0x9b')]=runReport;exports['query']=function(_0x381539,_0x74c91){var _0x5ad460=0xa;var _0x51968c=['join',_0x598e('0x88'),'right_join','cross_join'];var _0x312405={'SUM':_0x598e('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x598e('0x9c'),'MAX':_0x598e('0x59'),'MIN':_0x598e('0x89'),'AVG':_0x598e('0x8a'),'GROUP_CONCAT':_0x598e('0x8b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x598e('0x5a')};var _0x889936={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x598e('0x5c'),'HOUR':_0x598e('0x5d'),'ROUND':_0x598e('0x5e'),'UNIX_TIMESTAMP':_0x598e('0x5f')};var _0x311610=function(_0x24651b){return!_[_0x598e('0x60')]([_0x598e('0x61'),_0x598e('0x62'),'IS\x20EMPTY',_0x598e('0x8d')],_0x24651b);};var _0x3353eb=function(_0x53b068){if(!_0x53b068||!_0x53b068[_0x598e('0x64')]['length']){return'';}for(var _0x2faa88='(',_0x3b39ae=0x0;_0x3b39ae<_0x53b068[_0x598e('0x64')][_0x598e('0x37')];_0x3b39ae+=0x1){_0x3b39ae>0x0&&(_0x2faa88+='\x20'+_0x53b068['operator']+'\x20');_0x2faa88+=_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x66')]?_0x3353eb(_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x66')]):_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x67')]+'\x20'+_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x68')]+(_0x311610(_0x53b068[_0x598e('0x64')][_0x3b39ae]['condition'])?'\x20'+_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x69')]:'');}return _0x2faa88+')';};var _0xadc912={'where':{'id':_0x381539[_0x598e('0x53')]['id']}},_0x3e1abf,_0x12e23b,_0x3a80cc,_0x272352,_0x1ab3b3;_0xadc912=_['merge']({},_0xadc912,_0x381539[_0x598e('0x40')]);return db[_0x598e('0x2f')][_0x598e('0x4e')](_0xadc912)['then'](function(_0x268d91){if(_0x268d91){_0x3e1abf=_0x268d91;return _0x268d91[_0x598e('0x9d')]();}return null;})[_0x598e('0x24')](function(_0x3273f6){if(_0x3273f6){if(!_0x3273f6[_0x598e('0x37')]){throw new db[(_0x598e('0x6a'))][(_0x598e('0x6b'))](_0x598e('0x6c'),0x193);}_0x12e23b=_0x3273f6;return db[_0x598e('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x522217){if(_0x522217){_0x3a80cc=_[_0x598e('0x6e')](_0x522217,'id');var _0x2405fb;var _0x29ddc3=squel[_0x598e('0x6f')]();_0x29ddc3[_0x598e('0x70')](_0x3e1abf[_0x598e('0x71')]);for(var _0x3f156f=0x0;_0x3f156f<_0x12e23b[_0x598e('0x37')];_0x3f156f+=0x1){_0x2405fb=_0x12e23b[_0x3f156f][_0x598e('0x72')]?_0x3a80cc[_0x12e23b[_0x3f156f][_0x598e('0x72')]][_0x598e('0x73')]:_0x12e23b[_0x3f156f][_0x598e('0x67')];_0x2405fb=_0x12e23b[_0x3f156f]['function']?_[_0x598e('0x75')](_0x312405[_0x12e23b[_0x3f156f][_0x598e('0x74')]],'%s',_0x2405fb):_0x2405fb;_0x2405fb=_0x12e23b[_0x3f156f][_0x598e('0x76')]?_['replace'](_0x889936[_0x12e23b[_0x3f156f][_0x598e('0x76')]],'%s',_0x2405fb):_0x2405fb;if(_0x12e23b[_0x3f156f][_0x598e('0x77')]){_0x29ddc3[_0x598e('0x66')](_0x2405fb);}_0x12e23b[_0x3f156f]['orderBy']&&_0x29ddc3[_0x598e('0x38')](_0x2405fb,_0x12e23b[_0x3f156f][_0x598e('0x78')]==='DESC'?![]:!![]);_0x29ddc3[_0x598e('0x67')](_0x2405fb,_0x12e23b[_0x3f156f][_0x598e('0x7a')]||_0x2405fb);}if(_0x3e1abf[_0x598e('0x7b')]){_0x3e1abf[_0x598e('0x7b')]=JSON[_0x598e('0x7c')](_0x3e1abf[_0x598e('0x7b')]);for(var _0x5d081a=0x0;_0x5d081a<_0x3e1abf[_0x598e('0x7b')]['length'];_0x5d081a+=0x1){if(_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x30')]&&_[_0x598e('0x60')](_0x51968c,_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x30')])&&_0x3e1abf[_0x598e('0x7b')][_0x5d081a]['parentKey']&&_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x7e')]&&_0x3e1abf['joins'][_0x5d081a]['foreignKey']){_0x29ddc3[_0x3e1abf['joins'][_0x5d081a][_0x598e('0x30')]](_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x7e')],null,util[_0x598e('0x76')](_0x598e('0x7f'),_0x3e1abf['table'],_0x3e1abf[_0x598e('0x7b')][_0x5d081a]['parentKey'],_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x7e')],_0x3e1abf['joins'][_0x5d081a][_0x598e('0x8e')]));}}}if(_0x3e1abf['conditions']){_0x3e1abf['conditions']=JSON[_0x598e('0x7c')](_0x3e1abf['conditions']);_0x29ddc3[_0x598e('0x3a')](_0x3353eb(_0x3e1abf['conditions'][_0x598e('0x66')]));}_0x1ab3b3=_0x29ddc3['clone']();_0x29ddc3[_0x598e('0x1d')](_0x5ad460);_0x29ddc3[_0x598e('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x29ddc3[_0x598e('0x84')]());return dbH[_0x598e('0x85')][_0x598e('0x34')](_0x29ddc3[_0x598e('0x84')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x598e('0x24')](function(){return{'sql':_0x1ab3b3[_0x598e('0x84')]()};})['then'](respondWithResult(_0x74c91,null))[_0x598e('0x46')](handleError(_0x74c91,null));}; \ No newline at end of file +var _0xfa3d=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','params','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','field','function','replace','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','SUM(%s)','DATE(%s)','operator','ValidationErrorItem','metric','groupBy','DESC','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','info','Run\x20Query:','toString','child_process','fork','../../components/export/','output','../../files/reports','savename','countTable','run','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','eml-format','zip-dir','request-promise','moment','bluebird','util','sox'];(function(_0x443246,_0x199405){var _0xf91625=function(_0x6c01ff){while(--_0x6c01ff){_0x443246['push'](_0x443246['shift']());}};_0xf91625(++_0x199405);}(_0xfa3d,0x9d));var _0xdfa3=function(_0x427098,_0x64efac){_0x427098=_0x427098-0x0;var _0x140986=_0xfa3d[_0x427098];return _0x140986;};'use strict';var emlformat=require(_0xdfa3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdfa3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfa3('0x2'));var moment=require(_0xdfa3('0x3'));var BPromise=require(_0xdfa3('0x4'));var Mustache=require('mustache');var util=require(_0xdfa3('0x5'));var path=require('path');var sox=require(_0xdfa3('0x6'));var csv=require(_0xdfa3('0x7'));var ejs=require(_0xdfa3('0x8'));var fs=require('fs');var fs_extra=require(_0xdfa3('0x9'));var _=require(_0xdfa3('0xa'));var squel=require(_0xdfa3('0xb'));var crypto=require(_0xdfa3('0xc'));var jsforce=require(_0xdfa3('0xd'));var deskjs=require(_0xdfa3('0xe'));var toCsv=require(_0xdfa3('0x7'));var querystring=require(_0xdfa3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdfa3('0x10'));var qs=require(_0xdfa3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdfa3('0x12'));var config=require(_0xdfa3('0x13'));var licenseUtil=require(_0xdfa3('0x14'));var db=require(_0xdfa3('0x15'))['db'];var dbH=require(_0xdfa3('0x15'))['dbH'];function respondWithStatusCode(_0x1bb84c,_0x5c4afa){_0x5c4afa=_0x5c4afa||0xcc;return function(_0x5982d9){if(_0x5982d9){return _0x1bb84c[_0xdfa3('0x16')](_0x5c4afa);}return _0x1bb84c[_0xdfa3('0x17')](_0x5c4afa)[_0xdfa3('0x18')]();};}function respondWithResult(_0x12951e,_0x4cbe2b){_0x4cbe2b=_0x4cbe2b||0xc8;return function(_0x442882){if(_0x442882){return _0x12951e[_0xdfa3('0x17')](_0x4cbe2b)[_0xdfa3('0x19')](_0x442882);}};}function respondWithFilteredResult(_0x39ef56,_0x332055){return function(_0x113c9a){if(_0x113c9a){var _0x53141c=typeof _0x332055[_0xdfa3('0x1a')]===_0xdfa3('0x1b')&&typeof _0x332055[_0xdfa3('0x1c')]===_0xdfa3('0x1b');var _0x5b2023=_0x113c9a[_0xdfa3('0x1d')];var _0x127e31=_0x53141c?0x0:_0x332055[_0xdfa3('0x1a')];var _0x51ee97=_0x53141c?_0x113c9a[_0xdfa3('0x1d')]:_0x332055[_0xdfa3('0x1a')]+_0x332055['limit'];var _0x452077;if(_0x51ee97>=_0x5b2023){_0x51ee97=_0x5b2023;_0x452077=0xc8;}else{_0x452077=0xce;}_0x39ef56[_0xdfa3('0x17')](_0x452077);return _0x39ef56[_0xdfa3('0x1e')](_0xdfa3('0x1f'),_0x127e31+'-'+_0x51ee97+'/'+_0x5b2023)['json'](_0x113c9a);}return null;};}function patchUpdates(_0x1f99f9){return function(_0x4d0468){try{jsonpatch[_0xdfa3('0x20')](_0x4d0468,_0x1f99f9,!![]);}catch(_0x54e1d5){return BPromise[_0xdfa3('0x21')](_0x54e1d5);}return _0x4d0468[_0xdfa3('0x22')]();};}function saveUpdates(_0xfcbddb,_0x53b589){return function(_0x3518bf){if(_0x3518bf){return _0x3518bf[_0xdfa3('0x23')](_0xfcbddb)[_0xdfa3('0x24')](function(_0x4ee0d6){return _0x4ee0d6;});}return null;};}function removeEntity(_0x48e71d,_0x1aee78){return function(_0x432a8e){if(_0x432a8e){return _0x432a8e[_0xdfa3('0x25')]()['then'](function(){var _0x929ae4=_0x432a8e[_0xdfa3('0x26')]({'plain':!![]});var _0x4a0bc6=_0xdfa3('0x27');return db[_0xdfa3('0x28')][_0xdfa3('0x25')]({'where':{'type':_0x4a0bc6,'resourceId':_0x929ae4['id']}})['then'](function(){return _0x432a8e;});})[_0xdfa3('0x24')](function(){_0x48e71d['status'](0xcc)[_0xdfa3('0x18')]();});}};}function handleEntityNotFound(_0x5b0a2d,_0x296286){return function(_0x18099a){if(!_0x18099a){_0x5b0a2d['sendStatus'](0x194);}return _0x18099a;};}function handleError(_0x150cbb,_0x29f2c6){_0x29f2c6=_0x29f2c6||0x1f4;return function(_0x53c300){logger[_0xdfa3('0x29')](_0x53c300[_0xdfa3('0x2a')]);if(_0x53c300[_0xdfa3('0x2b')]){delete _0x53c300[_0xdfa3('0x2b')];}_0x150cbb[_0xdfa3('0x17')](_0x29f2c6)[_0xdfa3('0x2c')](_0x53c300);};}exports[_0xdfa3('0x2d')]=function(_0x5337f5,_0xa3c01b){var _0x4e36e3={},_0x5df748={},_0x4ae72b={'count':0x0,'rows':[]};var _0x50105e=_[_0xdfa3('0x2e')](db['AnalyticCustomReport'][_0xdfa3('0x2f')],function(_0x429608){return{'name':_0x429608[_0xdfa3('0x30')],'type':_0x429608[_0xdfa3('0x31')]['key']};});_0x5df748[_0xdfa3('0x32')]=_['map'](_0x50105e,'name');_0x5df748[_0xdfa3('0x33')]=_[_0xdfa3('0x34')](_0x5337f5[_0xdfa3('0x33')]);_0x5df748[_0xdfa3('0x35')]=_[_0xdfa3('0x36')](_0x5df748[_0xdfa3('0x32')],_0x5df748['query']);_0x4e36e3[_0xdfa3('0x37')]=_[_0xdfa3('0x36')](_0x5df748[_0xdfa3('0x32')],qs[_0xdfa3('0x38')](_0x5337f5[_0xdfa3('0x33')][_0xdfa3('0x38')]));_0x4e36e3[_0xdfa3('0x37')]=_0x4e36e3['attributes'][_0xdfa3('0x39')]?_0x4e36e3['attributes']:_0x5df748[_0xdfa3('0x32')];if(!_0x5337f5[_0xdfa3('0x33')]['hasOwnProperty'](_0xdfa3('0x3a'))){_0x4e36e3[_0xdfa3('0x1c')]=qs[_0xdfa3('0x1c')](_0x5337f5[_0xdfa3('0x33')][_0xdfa3('0x1c')]);_0x4e36e3['offset']=qs[_0xdfa3('0x1a')](_0x5337f5[_0xdfa3('0x33')][_0xdfa3('0x1a')]);}_0x4e36e3[_0xdfa3('0x3b')]=qs['sort'](_0x5337f5[_0xdfa3('0x33')][_0xdfa3('0x3c')]);_0x4e36e3[_0xdfa3('0x3d')]=qs[_0xdfa3('0x35')](_[_0xdfa3('0x3e')](_0x5337f5[_0xdfa3('0x33')],_0x5df748['filters']),_0x50105e);if(_0x5337f5[_0xdfa3('0x33')][_0xdfa3('0x3f')]){_0x4e36e3[_0xdfa3('0x3d')]=_[_0xdfa3('0x40')](_0x4e36e3[_0xdfa3('0x3d')],{'$or':_[_0xdfa3('0x2e')](_0x50105e,function(_0x3540ba){if(_0x3540ba['type']!==_0xdfa3('0x41')){var _0x93dd1a={};_0x93dd1a[_0x3540ba[_0xdfa3('0x2b')]]={'$like':'%'+_0x5337f5['query'][_0xdfa3('0x3f')]+'%'};return _0x93dd1a;}})});}_0x4e36e3=_['merge']({},_0x4e36e3,_0x5337f5[_0xdfa3('0x42')]);var _0x4d23f6={'where':_0x4e36e3['where']};return db[_0xdfa3('0x43')][_0xdfa3('0x1d')](_0x4d23f6)[_0xdfa3('0x24')](function(_0x49aad8){_0x4ae72b[_0xdfa3('0x1d')]=_0x49aad8;if(_0x5337f5[_0xdfa3('0x33')][_0xdfa3('0x44')]){_0x4e36e3[_0xdfa3('0x45')]=[{'all':!![]}];}return db[_0xdfa3('0x43')]['findAll'](_0x4e36e3);})['then'](function(_0x191792){_0x4ae72b[_0xdfa3('0x46')]=_0x191792;return _0x4ae72b;})[_0xdfa3('0x24')](respondWithFilteredResult(_0xa3c01b,_0x4e36e3))[_0xdfa3('0x47')](handleError(_0xa3c01b,null));};exports[_0xdfa3('0x48')]=function(_0x292378,_0x1f7449){var _0x17fd30={'raw':![],'where':{'id':_0x292378['params']['id']}},_0x17dca6={};_0x17dca6[_0xdfa3('0x32')]=_[_0xdfa3('0x34')](db[_0xdfa3('0x43')][_0xdfa3('0x2f')]);_0x17dca6[_0xdfa3('0x33')]=_['keys'](_0x292378['query']);_0x17dca6[_0xdfa3('0x35')]=_['intersection'](_0x17dca6['model'],_0x17dca6[_0xdfa3('0x33')]);_0x17fd30[_0xdfa3('0x37')]=_[_0xdfa3('0x36')](_0x17dca6[_0xdfa3('0x32')],qs[_0xdfa3('0x38')](_0x292378[_0xdfa3('0x33')][_0xdfa3('0x38')]));_0x17fd30[_0xdfa3('0x37')]=_0x17fd30[_0xdfa3('0x37')][_0xdfa3('0x39')]?_0x17fd30['attributes']:_0x17dca6[_0xdfa3('0x32')];if(_0x292378['query'][_0xdfa3('0x44')]){_0x17fd30[_0xdfa3('0x45')]=[{'all':!![]}];}_0x17fd30=_[_0xdfa3('0x40')]({},_0x17fd30,_0x292378[_0xdfa3('0x42')]);return db[_0xdfa3('0x43')][_0xdfa3('0x49')](_0x17fd30)[_0xdfa3('0x24')](handleEntityNotFound(_0x1f7449,null))['then'](respondWithResult(_0x1f7449,null))[_0xdfa3('0x47')](handleError(_0x1f7449,null));};exports[_0xdfa3('0x4a')]=function(_0x162d31,_0x5228f6){return db['AnalyticCustomReport']['create'](_0x162d31[_0xdfa3('0x4b')],{})[_0xdfa3('0x24')](function(_0x90c2b7){var _0x5d2f51=_0x162d31[_0xdfa3('0x4c')][_0xdfa3('0x26')]({'plain':!![]});if(!_0x5d2f51)throw new Error(_0xdfa3('0x4d'));if(_0x5d2f51[_0xdfa3('0x4e')]===_0xdfa3('0x4c')){var _0x3b6651=_0x90c2b7['get']({'plain':!![]});var _0x257986=_0xdfa3('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x257986,'userProfileId':_0x5d2f51[_0xdfa3('0x50')]},'raw':!![]})[_0xdfa3('0x24')](function(_0x2c7ae2){if(_0x2c7ae2&&_0x2c7ae2['autoAssociation']===0x0){return db[_0xdfa3('0x28')][_0xdfa3('0x4a')]({'name':_0x3b6651[_0xdfa3('0x2b')],'resourceId':_0x3b6651['id'],'type':_0xdfa3('0x27'),'sectionId':_0x2c7ae2['id']},{})[_0xdfa3('0x24')](function(){return _0x90c2b7;});}else{return _0x90c2b7;}})['catch'](function(_0x156875){logger[_0xdfa3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x156875);throw _0x156875;});}return _0x90c2b7;})[_0xdfa3('0x24')](respondWithResult(_0x5228f6,0xc9))[_0xdfa3('0x47')](handleError(_0x5228f6,null));};exports[_0xdfa3('0x23')]=function(_0x35530c,_0x264b19){if(_0x35530c[_0xdfa3('0x4b')]['id']){delete _0x35530c[_0xdfa3('0x4b')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x35530c['params']['id']}})[_0xdfa3('0x24')](handleEntityNotFound(_0x264b19,null))[_0xdfa3('0x24')](saveUpdates(_0x35530c[_0xdfa3('0x4b')],null))[_0xdfa3('0x24')](respondWithResult(_0x264b19,null))['catch'](handleError(_0x264b19,null));};exports[_0xdfa3('0x25')]=function(_0x551bf5,_0x29475e){return db[_0xdfa3('0x43')][_0xdfa3('0x49')]({'where':{'id':_0x551bf5['params']['id']}})['then'](handleEntityNotFound(_0x29475e,null))[_0xdfa3('0x24')](removeEntity(_0x29475e,null))['catch'](handleError(_0x29475e,null));};exports[_0xdfa3('0x51')]=function(_0x5e8e8a,_0x35789b){var _0x42e6a1=0xa;var _0x1f85da=[_0xdfa3('0x52'),_0xdfa3('0x53'),_0xdfa3('0x54'),_0xdfa3('0x55')];var _0x484060={'SUM':'SUM(%s)','COUNT':_0xdfa3('0x56'),'COUNT DISTINCT':_0xdfa3('0x57'),'MAX':_0xdfa3('0x58'),'MIN':_0xdfa3('0x59'),'AVG':_0xdfa3('0x5a'),'GROUP_CONCAT':_0xdfa3('0x5b'),'GROUP_CONCAT ASC':_0xdfa3('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5cdc3d={'SEC_TO_TIME':_0xdfa3('0x5d'),'DATE':'DATE(%s)','HOUR':_0xdfa3('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xdfa3('0x5f')};var _0x53b5b4=function(_0x5daac2){return!_[_0xdfa3('0x60')]([_0xdfa3('0x61'),_0xdfa3('0x62'),_0xdfa3('0x63'),_0xdfa3('0x64')],_0x5daac2);};var _0x551c90=function(_0x5e5843){if(!_0x5e5843||!_0x5e5843[_0xdfa3('0x65')]['length']){return'';}for(var _0x21ddeb='(',_0x5d2d98=0x0;_0x5d2d98<_0x5e5843[_0xdfa3('0x65')][_0xdfa3('0x39')];_0x5d2d98+=0x1){_0x5d2d98>0x0&&(_0x21ddeb+='\x20'+_0x5e5843['operator']+'\x20');_0x21ddeb+=_0x5e5843[_0xdfa3('0x65')][_0x5d2d98][_0xdfa3('0x66')]?_0x551c90(_0x5e5843[_0xdfa3('0x65')][_0x5d2d98][_0xdfa3('0x66')]):_0x5e5843[_0xdfa3('0x65')][_0x5d2d98]['field']+'\x20'+_0x5e5843[_0xdfa3('0x65')][_0x5d2d98][_0xdfa3('0x67')]+(_0x53b5b4(_0x5e5843[_0xdfa3('0x65')][_0x5d2d98][_0xdfa3('0x67')])?'\x20'+_0x5e5843['rules'][_0x5d2d98][_0xdfa3('0x68')]:'');}return _0x21ddeb+')';};var _0x3db12c={'where':{'id':_0x5e8e8a[_0xdfa3('0x69')]['id']}},_0x2879ce,_0x53f7d7,_0x2998a,_0x374b9c,_0x350ee5;_0x3db12c=_[_0xdfa3('0x40')]({},_0x3db12c,_0x5e8e8a[_0xdfa3('0x42')]);return db[_0xdfa3('0x43')][_0xdfa3('0x49')](_0x3db12c)[_0xdfa3('0x24')](function(_0x41b18d){if(_0x41b18d){_0x2879ce=_0x41b18d;return _0x41b18d[_0xdfa3('0x6a')]();}return null;})[_0xdfa3('0x24')](function(_0x324f2a){if(_0x324f2a){if(!_0x324f2a[_0xdfa3('0x39')]){throw new db[(_0xdfa3('0x6b'))]['ValidationErrorItem'](_0xdfa3('0x6c'),0x193);}_0x53f7d7=_0x324f2a;return db[_0xdfa3('0x6d')][_0xdfa3('0x6e')]({'raw':!![]});}return null;})[_0xdfa3('0x24')](function(_0x1f9061){if(_0x1f9061){_0x2998a=_[_0xdfa3('0x6f')](_0x1f9061,'id');var _0x24d5b1;var _0x18d2a4=squel[_0xdfa3('0x70')]();_0x18d2a4[_0xdfa3('0x71')](_0x2879ce[_0xdfa3('0x72')]);for(var _0x56f389=0x0;_0x56f389<_0x53f7d7[_0xdfa3('0x39')];_0x56f389+=0x1){_0x24d5b1=_0x53f7d7[_0x56f389][_0xdfa3('0x73')]?_0x2998a[_0x53f7d7[_0x56f389]['MetricId']]['metric']:_0x53f7d7[_0x56f389][_0xdfa3('0x74')];_0x24d5b1=_0x53f7d7[_0x56f389][_0xdfa3('0x75')]?_[_0xdfa3('0x76')](_0x484060[_0x53f7d7[_0x56f389]['function']],'%s',_0x24d5b1):_0x24d5b1;_0x24d5b1=_0x53f7d7[_0x56f389]['format']?_[_0xdfa3('0x76')](_0x5cdc3d[_0x53f7d7[_0x56f389]['format']],'%s',_0x24d5b1):_0x24d5b1;if(_0x53f7d7[_0x56f389]['groupBy']){_0x18d2a4[_0xdfa3('0x66')](_0x24d5b1);}_0x53f7d7[_0x56f389][_0xdfa3('0x77')]&&_0x18d2a4[_0xdfa3('0x3b')](_0x24d5b1,_0x53f7d7[_0x56f389][_0xdfa3('0x77')]==='DESC'?![]:!![]);_0x18d2a4[_0xdfa3('0x74')](_0x24d5b1,_0x53f7d7[_0x56f389][_0xdfa3('0x78')]||_0x24d5b1);}if(_0x2879ce[_0xdfa3('0x79')]){_0x2879ce[_0xdfa3('0x79')]=JSON[_0xdfa3('0x7a')](_0x2879ce[_0xdfa3('0x79')]);for(var _0x60cb52=0x0;_0x60cb52<_0x2879ce[_0xdfa3('0x79')][_0xdfa3('0x39')];_0x60cb52+=0x1){if(_0x2879ce[_0xdfa3('0x79')][_0x60cb52][_0xdfa3('0x31')]&&_['includes'](_0x1f85da,_0x2879ce['joins'][_0x60cb52][_0xdfa3('0x31')])&&_0x2879ce[_0xdfa3('0x79')][_0x60cb52][_0xdfa3('0x7b')]&&_0x2879ce[_0xdfa3('0x79')][_0x60cb52][_0xdfa3('0x7c')]&&_0x2879ce['joins'][_0x60cb52][_0xdfa3('0x7d')]){_0x18d2a4[_0x2879ce['joins'][_0x60cb52][_0xdfa3('0x31')]](_0x2879ce[_0xdfa3('0x79')][_0x60cb52][_0xdfa3('0x7c')],null,util[_0xdfa3('0x7e')](_0xdfa3('0x7f'),_0x2879ce['table'],_0x2879ce[_0xdfa3('0x79')][_0x60cb52]['parentKey'],_0x2879ce['joins'][_0x60cb52][_0xdfa3('0x7c')],_0x2879ce[_0xdfa3('0x79')][_0x60cb52][_0xdfa3('0x7d')]));}}}if(_0x2879ce['conditions']){_0x2879ce[_0xdfa3('0x80')]=JSON[_0xdfa3('0x7a')](_0x2879ce[_0xdfa3('0x80')]);_0x18d2a4[_0xdfa3('0x3d')](_0x551c90(_0x2879ce[_0xdfa3('0x80')][_0xdfa3('0x66')]));}_0x350ee5=_0x18d2a4[_0xdfa3('0x81')]();_0x18d2a4[_0xdfa3('0x1c')](_0x42e6a1);_0x18d2a4[_0xdfa3('0x1a')](0x0);logger[_0xdfa3('0x82')](_0xdfa3('0x83'),_0x18d2a4['toString']());return dbH[_0xdfa3('0x84')][_0xdfa3('0x33')](_0x18d2a4['toString'](),{'type':dbH[_0xdfa3('0x84')][_0xdfa3('0x85')][_0xdfa3('0x86')]});}})[_0xdfa3('0x24')](respondWithResult(_0x35789b,null))[_0xdfa3('0x47')](handleError(_0x35789b,null));};function runReport(_0x2a441f,_0xa286e5,_0x6884c4){var _0x4a88ee=_0xa286e5[_0xdfa3('0x2b')];var _0x25bc84=0xa;var _0x373928=[_0xdfa3('0x52'),'left_join',_0xdfa3('0x54'),_0xdfa3('0x55')];var _0x5cb017={'SUM':_0xdfa3('0x87'),'COUNT':_0xdfa3('0x56'),'COUNT DISTINCT':_0xdfa3('0x57'),'MAX':_0xdfa3('0x58'),'MIN':_0xdfa3('0x59'),'AVG':_0xdfa3('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xdfa3('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1cddeb={'SEC_TO_TIME':_0xdfa3('0x5d'),'DATE':_0xdfa3('0x88'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xdfa3('0x5f')};var _0x2fe500=function(_0xe8523f){return!_[_0xdfa3('0x60')]([_0xdfa3('0x61'),_0xdfa3('0x62'),_0xdfa3('0x63'),_0xdfa3('0x64')],_0xe8523f);};var _0x39e688=function(_0x59f9ae){if(!_0x59f9ae||!_0x59f9ae[_0xdfa3('0x65')][_0xdfa3('0x39')]){return'';}for(var _0x1eec95='(',_0x354fc4=0x0;_0x354fc4<_0x59f9ae[_0xdfa3('0x65')][_0xdfa3('0x39')];_0x354fc4+=0x1){_0x354fc4>0x0&&(_0x1eec95+='\x20'+_0x59f9ae[_0xdfa3('0x89')]+'\x20');_0x1eec95+=_0x59f9ae[_0xdfa3('0x65')][_0x354fc4]['group']?_0x39e688(_0x59f9ae[_0xdfa3('0x65')][_0x354fc4][_0xdfa3('0x66')]):_0x59f9ae['rules'][_0x354fc4][_0xdfa3('0x74')]+'\x20'+_0x59f9ae[_0xdfa3('0x65')][_0x354fc4][_0xdfa3('0x67')]+(_0x2fe500(_0x59f9ae[_0xdfa3('0x65')][_0x354fc4][_0xdfa3('0x67')])?'\x20'+_0x59f9ae[_0xdfa3('0x65')][_0x354fc4]['value']:'');}return _0x1eec95+')';};var _0x404ae7={'where':{'id':_0x2a441f['id']}},_0x4af565,_0x5281bc,_0x46a623,_0x19c34e,_0x288326;_0x404ae7=_['merge']({},_0x404ae7,_0x6884c4);return db['AnalyticCustomReport'][_0xdfa3('0x49')](_0x404ae7)[_0xdfa3('0x24')](function(_0xe3906d){if(_0xe3906d){_0x4af565=_0xe3906d;return _0xe3906d[_0xdfa3('0x6a')]();}return null;})[_0xdfa3('0x24')](function(_0x5ba177){if(_0x5ba177){if(!_0x5ba177[_0xdfa3('0x39')]){throw new db[(_0xdfa3('0x6b'))][(_0xdfa3('0x8a'))](_0xdfa3('0x6c'),0x193);}_0x5281bc=_0x5ba177;return db[_0xdfa3('0x6d')][_0xdfa3('0x6e')]({'raw':!![]});}return null;})[_0xdfa3('0x24')](function(_0x191a6c){if(_0x191a6c){_0x46a623=_[_0xdfa3('0x6f')](_0x191a6c,'id');var _0x5af3a8;var _0x35393b=squel['select']();_0x35393b[_0xdfa3('0x71')](_0x4af565[_0xdfa3('0x72')]);for(var _0xfb4cc1=0x0;_0xfb4cc1<_0x5281bc[_0xdfa3('0x39')];_0xfb4cc1+=0x1){_0x5af3a8=_0x5281bc[_0xfb4cc1][_0xdfa3('0x73')]?_0x46a623[_0x5281bc[_0xfb4cc1][_0xdfa3('0x73')]][_0xdfa3('0x8b')]:_0x5281bc[_0xfb4cc1][_0xdfa3('0x74')];_0x5af3a8=_0x5281bc[_0xfb4cc1][_0xdfa3('0x75')]?_[_0xdfa3('0x76')](_0x5cb017[_0x5281bc[_0xfb4cc1][_0xdfa3('0x75')]],'%s',_0x5af3a8):_0x5af3a8;_0x5af3a8=_0x5281bc[_0xfb4cc1]['format']?_['replace'](_0x1cddeb[_0x5281bc[_0xfb4cc1]['format']],'%s',_0x5af3a8):_0x5af3a8;if(_0x5281bc[_0xfb4cc1][_0xdfa3('0x8c')]){_0x35393b['group'](_0x5af3a8);}_0x5281bc[_0xfb4cc1]['orderBy']&&_0x35393b['order'](_0x5af3a8,_0x5281bc[_0xfb4cc1][_0xdfa3('0x77')]===_0xdfa3('0x8d')?![]:!![]);_0x35393b[_0xdfa3('0x74')](_0x5af3a8,_0x5281bc[_0xfb4cc1]['alias']||_0x5af3a8);}if(_0x4af565[_0xdfa3('0x79')]){_0x4af565['joins']=JSON[_0xdfa3('0x7a')](_0x4af565['joins']);for(var _0x44ae9c=0x0;_0x44ae9c<_0x4af565['joins'][_0xdfa3('0x39')];_0x44ae9c+=0x1){if(_0x4af565[_0xdfa3('0x79')][_0x44ae9c][_0xdfa3('0x31')]&&_[_0xdfa3('0x60')](_0x373928,_0x4af565[_0xdfa3('0x79')][_0x44ae9c][_0xdfa3('0x31')])&&_0x4af565['joins'][_0x44ae9c][_0xdfa3('0x7b')]&&_0x4af565[_0xdfa3('0x79')][_0x44ae9c][_0xdfa3('0x7c')]&&_0x4af565[_0xdfa3('0x79')][_0x44ae9c][_0xdfa3('0x7d')]){_0x35393b[_0x4af565['joins'][_0x44ae9c]['type']](_0x4af565[_0xdfa3('0x79')][_0x44ae9c][_0xdfa3('0x7c')],null,util[_0xdfa3('0x7e')](_0xdfa3('0x7f'),_0x4af565['table'],_0x4af565[_0xdfa3('0x79')][_0x44ae9c][_0xdfa3('0x7b')],_0x4af565[_0xdfa3('0x79')][_0x44ae9c][_0xdfa3('0x7c')],_0x4af565[_0xdfa3('0x79')][_0x44ae9c][_0xdfa3('0x7d')]));}}}if(_0x4af565[_0xdfa3('0x80')]){_0x4af565[_0xdfa3('0x80')]=JSON[_0xdfa3('0x7a')](_0x4af565[_0xdfa3('0x80')]);_0x35393b['where'](_0x39e688(_0x4af565['conditions'][_0xdfa3('0x66')]));}_0x288326=_0x35393b[_0xdfa3('0x81')]();_0x35393b[_0xdfa3('0x1c')](_0x25bc84);_0x35393b['offset'](0x0);return;}})[_0xdfa3('0x24')](function(){if(_0xa286e5['output']==='web'){return null;}var _0x147211=_[_0xdfa3('0x40')](_0xa286e5,{'name':_0xa286e5[_0xdfa3('0x8e')]||_0xa286e5[_0xdfa3('0x2b')]||_0x4af565[_0xdfa3('0x2b')],'basename':_0x4a88ee,'savename':util[_0xdfa3('0x7e')](_0xdfa3('0x8f'),_0xa286e5[_0xdfa3('0x2b')]||_0x4af565['name'],require(_0xdfa3('0x90'))[_0xdfa3('0x91')](0x4),_0xa286e5['output']||_0xdfa3('0x92')),'reportId':_0x4af565['id'],'reportType':_0xdfa3('0x93')});return db[_0xdfa3('0x94')][_0xdfa3('0x4a')](_0x147211,{'raw':!![]});})[_0xdfa3('0x24')](function(_0x3b8de6){if(_0x4af565[_0xdfa3('0x72')]===_0xdfa3('0x95')){_0x288326[_0xdfa3('0x3d')](_0x4af565[_0xdfa3('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xa286e5['startDate'],_0xa286e5['endDate']);}else{_0x288326[_0xdfa3('0x3d')](_0x4af565[_0xdfa3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xa286e5[_0xdfa3('0x96')],_0xa286e5['endDate']);}if(_0x3b8de6){logger[_0xdfa3('0x97')](_0xdfa3('0x98'),_0x288326[_0xdfa3('0x99')]());require(_0xdfa3('0x9a'))[_0xdfa3('0x9b')](path['join'](__dirname,_0xdfa3('0x9c'),_0x3b8de6[_0xdfa3('0x9d')]),[_0x3b8de6['id'],_0x288326[_0xdfa3('0x99')](),path[_0xdfa3('0x52')](__dirname,_0xdfa3('0x9e'),_0x3b8de6[_0xdfa3('0x9f')]),_0x4a88ee]);return _0x3b8de6;}else{var _0x1fc502=squel[_0xdfa3('0x70')]();_0x1fc502[_0xdfa3('0x71')]('('+_0x288326[_0xdfa3('0x99')]()+')',_0xdfa3('0xa0'));_0x1fc502[_0xdfa3('0x74')]('COUNT(*)','count');_0x288326[_0xdfa3('0x1c')](_0xa286e5[_0xdfa3('0x1c')]||_0x25bc84);_0x288326[_0xdfa3('0x1a')](_0xa286e5[_0xdfa3('0x1a')]||0x0);return dbH['sequelize'][_0xdfa3('0x33')](_0x1fc502['toString'](),{'type':dbH[_0xdfa3('0x84')][_0xdfa3('0x85')][_0xdfa3('0x86')]})[_0xdfa3('0x24')](function(_0x495c58){if(!_0x495c58[_0xdfa3('0x39')]){_0x19c34e=0x0;}else{_0x19c34e=_0x495c58[0x0][_0xdfa3('0x1d')]||0x0;}return dbH[_0xdfa3('0x84')][_0xdfa3('0x33')](_0x288326[_0xdfa3('0x99')](),{'type':dbH[_0xdfa3('0x84')][_0xdfa3('0x85')]['SELECT']});})[_0xdfa3('0x24')](function(_0x558f2d){return{'rows':_0x558f2d||[],'count':_0x19c34e};});}});}exports[_0xdfa3('0xa1')]=function(_0x1ea4bb,_0x4e4ad3){return runReport(_0x1ea4bb[_0xdfa3('0x69')],_0x1ea4bb[_0xdfa3('0x33')],_0x1ea4bb[_0xdfa3('0x42')])[_0xdfa3('0x24')](respondWithResult(_0x4e4ad3,null))[_0xdfa3('0x47')](handleError(_0x4e4ad3,null));};exports['runReport']=runReport;exports[_0xdfa3('0x33')]=function(_0x2843b7,_0x23d8d3){var _0x1e7f48=0xa;var _0x2a9b7f=[_0xdfa3('0x52'),_0xdfa3('0x53'),'right_join','cross_join'];var _0xddc83d={'SUM':'SUM(%s)','COUNT':_0xdfa3('0x56'),'COUNT DISTINCT':_0xdfa3('0x57'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xdfa3('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xdfa3('0xa2')};var _0x2f2e7e={'SEC_TO_TIME':_0xdfa3('0x5d'),'DATE':_0xdfa3('0x88'),'HOUR':_0xdfa3('0x5e'),'ROUND':_0xdfa3('0xa3'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2e1467=function(_0x15b62c){return!_[_0xdfa3('0x60')]([_0xdfa3('0x61'),_0xdfa3('0x62'),_0xdfa3('0x63'),'IS\x20NOT\x20EMPTY'],_0x15b62c);};var _0x256813=function(_0x7b800){if(!_0x7b800||!_0x7b800['rules'][_0xdfa3('0x39')]){return'';}for(var _0x46397b='(',_0x3dee98=0x0;_0x3dee98<_0x7b800[_0xdfa3('0x65')][_0xdfa3('0x39')];_0x3dee98+=0x1){_0x3dee98>0x0&&(_0x46397b+='\x20'+_0x7b800[_0xdfa3('0x89')]+'\x20');_0x46397b+=_0x7b800[_0xdfa3('0x65')][_0x3dee98][_0xdfa3('0x66')]?_0x256813(_0x7b800[_0xdfa3('0x65')][_0x3dee98]['group']):_0x7b800[_0xdfa3('0x65')][_0x3dee98][_0xdfa3('0x74')]+'\x20'+_0x7b800[_0xdfa3('0x65')][_0x3dee98][_0xdfa3('0x67')]+(_0x2e1467(_0x7b800[_0xdfa3('0x65')][_0x3dee98]['condition'])?'\x20'+_0x7b800[_0xdfa3('0x65')][_0x3dee98][_0xdfa3('0x68')]:'');}return _0x46397b+')';};var _0x2ffaf4={'where':{'id':_0x2843b7[_0xdfa3('0x69')]['id']}},_0x3e96ad,_0x57aca2,_0x2c2c74,_0xfa7791,_0x360055;_0x2ffaf4=_[_0xdfa3('0x40')]({},_0x2ffaf4,_0x2843b7['options']);return db[_0xdfa3('0x43')][_0xdfa3('0x49')](_0x2ffaf4)[_0xdfa3('0x24')](function(_0x246a5f){if(_0x246a5f){_0x3e96ad=_0x246a5f;return _0x246a5f[_0xdfa3('0x6a')]();}return null;})[_0xdfa3('0x24')](function(_0x54ee73){if(_0x54ee73){if(!_0x54ee73[_0xdfa3('0x39')]){throw new db[(_0xdfa3('0x6b'))][(_0xdfa3('0x8a'))](_0xdfa3('0x6c'),0x193);}_0x57aca2=_0x54ee73;return db[_0xdfa3('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xdfa3('0x24')](function(_0x1c2c3b){if(_0x1c2c3b){_0x2c2c74=_['keyBy'](_0x1c2c3b,'id');var _0x1cb5eb;var _0x33da85=squel[_0xdfa3('0x70')]();_0x33da85[_0xdfa3('0x71')](_0x3e96ad[_0xdfa3('0x72')]);for(var _0x3ea73c=0x0;_0x3ea73c<_0x57aca2[_0xdfa3('0x39')];_0x3ea73c+=0x1){_0x1cb5eb=_0x57aca2[_0x3ea73c][_0xdfa3('0x73')]?_0x2c2c74[_0x57aca2[_0x3ea73c]['MetricId']]['metric']:_0x57aca2[_0x3ea73c][_0xdfa3('0x74')];_0x1cb5eb=_0x57aca2[_0x3ea73c][_0xdfa3('0x75')]?_[_0xdfa3('0x76')](_0xddc83d[_0x57aca2[_0x3ea73c][_0xdfa3('0x75')]],'%s',_0x1cb5eb):_0x1cb5eb;_0x1cb5eb=_0x57aca2[_0x3ea73c]['format']?_[_0xdfa3('0x76')](_0x2f2e7e[_0x57aca2[_0x3ea73c][_0xdfa3('0x7e')]],'%s',_0x1cb5eb):_0x1cb5eb;if(_0x57aca2[_0x3ea73c][_0xdfa3('0x8c')]){_0x33da85[_0xdfa3('0x66')](_0x1cb5eb);}_0x57aca2[_0x3ea73c]['orderBy']&&_0x33da85[_0xdfa3('0x3b')](_0x1cb5eb,_0x57aca2[_0x3ea73c][_0xdfa3('0x77')]==='DESC'?![]:!![]);_0x33da85[_0xdfa3('0x74')](_0x1cb5eb,_0x57aca2[_0x3ea73c][_0xdfa3('0x78')]||_0x1cb5eb);}if(_0x3e96ad[_0xdfa3('0x79')]){_0x3e96ad[_0xdfa3('0x79')]=JSON[_0xdfa3('0x7a')](_0x3e96ad['joins']);for(var _0x168052=0x0;_0x168052<_0x3e96ad[_0xdfa3('0x79')]['length'];_0x168052+=0x1){if(_0x3e96ad[_0xdfa3('0x79')][_0x168052]['type']&&_[_0xdfa3('0x60')](_0x2a9b7f,_0x3e96ad[_0xdfa3('0x79')][_0x168052][_0xdfa3('0x31')])&&_0x3e96ad[_0xdfa3('0x79')][_0x168052][_0xdfa3('0x7b')]&&_0x3e96ad[_0xdfa3('0x79')][_0x168052][_0xdfa3('0x7c')]&&_0x3e96ad['joins'][_0x168052][_0xdfa3('0x7d')]){_0x33da85[_0x3e96ad[_0xdfa3('0x79')][_0x168052][_0xdfa3('0x31')]](_0x3e96ad[_0xdfa3('0x79')][_0x168052][_0xdfa3('0x7c')],null,util[_0xdfa3('0x7e')]('%s.%s\x20=\x20%s.%s',_0x3e96ad['table'],_0x3e96ad[_0xdfa3('0x79')][_0x168052][_0xdfa3('0x7b')],_0x3e96ad[_0xdfa3('0x79')][_0x168052][_0xdfa3('0x7c')],_0x3e96ad['joins'][_0x168052][_0xdfa3('0x7d')]));}}}if(_0x3e96ad[_0xdfa3('0x80')]){_0x3e96ad[_0xdfa3('0x80')]=JSON['parse'](_0x3e96ad['conditions']);_0x33da85[_0xdfa3('0x3d')](_0x256813(_0x3e96ad[_0xdfa3('0x80')][_0xdfa3('0x66')]));}_0x360055=_0x33da85[_0xdfa3('0x81')]();_0x33da85['limit'](_0x1e7f48);_0x33da85[_0xdfa3('0x1a')](0x0);logger[_0xdfa3('0x82')](_0xdfa3('0x83'),_0x33da85[_0xdfa3('0x99')]());return dbH[_0xdfa3('0x84')][_0xdfa3('0x33')](_0x33da85[_0xdfa3('0x99')](),{'type':dbH['sequelize'][_0xdfa3('0x85')]['SELECT']});}})['then'](function(){return{'sql':_0x360055[_0xdfa3('0x99')]()};})[_0xdfa3('0x24')](respondWithResult(_0x23d8d3,null))[_0xdfa3('0x47')](handleError(_0x23d8d3,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 78b1df0..1629f01 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 _0x44cd=['AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x21d94c,_0x564a82){var _0x4772dc=function(_0x4d8107){while(--_0x4d8107){_0x21d94c['push'](_0x21d94c['shift']());}};_0x4772dc(++_0x564a82);}(_0x44cd,0xde));var _0xd44c=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0x44cd[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0xd44c('0x0'));var util=require('util');var logger=require(_0xd44c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd44c('0x2'));var rp=require(_0xd44c('0x3'));var fs=require('fs');var path=require(_0xd44c('0x4'));var rimraf=require(_0xd44c('0x5'));var config=require(_0xd44c('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xd44c('0x7')]=function(_0x3478d8,_0x1c5caf){return _0x3478d8['define'](_0xd44c('0x8'),attributes,{'tableName':_0xd44c('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x588e=['util','api','moment','bluebird','request-promise','rimraf','exports','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x588e,0x95));var _0xe588=function(_0x32b9c9,_0x5881e6){_0x32b9c9=_0x32b9c9-0x0;var _0x1a837f=_0x588e[_0x32b9c9];return _0x1a837f;};'use strict';var _=require(_0xe588('0x0'));var util=require(_0xe588('0x1'));var logger=require('../../config/logger')(_0xe588('0x2'));var moment=require(_0xe588('0x3'));var BPromise=require(_0xe588('0x4'));var rp=require(_0xe588('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe588('0x6'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xe588('0x7')]=function(_0x40ef65,_0x1f8fcc){return _0x40ef65['define'](_0xe588('0x8'),attributes,{'tableName':_0xe588('0x9'),'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 3363988..01215da 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 _0x89f9=['jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x89f9,0x19f));var _0x989f=function(_0x37f9ae,_0x577eaa){_0x37f9ae=_0x37f9ae-0x0;var _0x53fbb4=_0x89f9[_0x37f9ae];return _0x53fbb4;};'use strict';var _=require(_0x989f('0x0'));var util=require(_0x989f('0x1'));var moment=require(_0x989f('0x2'));var BPromise=require(_0x989f('0x3'));var rs=require(_0x989f('0x4'));var fs=require('fs');var Redis=require(_0x989f('0x5'));var db=require(_0x989f('0x6'))['db'];var utils=require(_0x989f('0x7'));var logger=require(_0x989f('0x8'))('rpc');var config=require(_0x989f('0x9'));var jayson=require(_0x989f('0xa'));var client=jayson[_0x989f('0xb')][_0x989f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x307247,_0x47d120,_0x2838cc){return new BPromise(function(_0x1e71b6,_0xb66a36){return client[_0x989f('0xd')](_0x307247,_0x2838cc)[_0x989f('0xe')](function(_0x30bf90){logger[_0x989f('0xf')](_0x989f('0x10'),_0x47d120,_0x989f('0x11'));logger[_0x989f('0x12')](_0x989f('0x13'),_0x47d120,_0x989f('0x11'),JSON[_0x989f('0x14')](_0x30bf90));if(_0x30bf90[_0x989f('0x15')]){if(_0x30bf90['error'][_0x989f('0x16')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x47d120,_0x30bf90['error'][_0x989f('0x17')]);return _0xb66a36(_0x30bf90['error'][_0x989f('0x17')]);}logger[_0x989f('0x15')](_0x989f('0x10'),_0x47d120,_0x30bf90[_0x989f('0x15')][_0x989f('0x17')]);return _0x1e71b6(_0x30bf90['error']['message']);}else{logger[_0x989f('0xf')](_0x989f('0x10'),_0x47d120,_0x989f('0x11'));_0x1e71b6(_0x30bf90[_0x989f('0x18')][_0x989f('0x17')]);}})['catch'](function(_0x291e61){logger['error'](_0x989f('0x10'),_0x47d120,_0x291e61);_0xb66a36(_0x291e61);});});} \ No newline at end of file +var _0x42f4=['info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x9e95a9,_0x1686b0){var _0x580883=function(_0x310407){while(--_0x310407){_0x9e95a9['push'](_0x9e95a9['shift']());}};_0x580883(++_0x1686b0);}(_0x42f4,0x13e));var _0x442f=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0x42f4[_0x138836];return _0x322688;};'use strict';var _=require(_0x442f('0x0'));var util=require(_0x442f('0x1'));var moment=require(_0x442f('0x2'));var BPromise=require(_0x442f('0x3'));var rs=require(_0x442f('0x4'));var fs=require('fs');var Redis=require(_0x442f('0x5'));var db=require(_0x442f('0x6'))['db'];var utils=require(_0x442f('0x7'));var logger=require(_0x442f('0x8'))('rpc');var config=require(_0x442f('0x9'));var jayson=require(_0x442f('0xa'));var client=jayson['client'][_0x442f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a6c04,_0x173a42,_0x4a36dc){return new BPromise(function(_0x3a067b,_0x5a4516){return client['request'](_0x3a6c04,_0x4a36dc)['then'](function(_0xf10037){logger[_0x442f('0xc')](_0x442f('0xd'),_0x173a42,_0x442f('0xe'));logger[_0x442f('0xf')](_0x442f('0x10'),_0x173a42,_0x442f('0xe'),JSON[_0x442f('0x11')](_0xf10037));if(_0xf10037[_0x442f('0x12')]){if(_0xf10037[_0x442f('0x12')][_0x442f('0x13')]===0x1f4){logger[_0x442f('0x12')](_0x442f('0xd'),_0x173a42,_0xf10037[_0x442f('0x12')][_0x442f('0x14')]);return _0x5a4516(_0xf10037[_0x442f('0x12')][_0x442f('0x14')]);}logger[_0x442f('0x12')](_0x442f('0xd'),_0x173a42,_0xf10037[_0x442f('0x12')][_0x442f('0x14')]);return _0x3a067b(_0xf10037[_0x442f('0x12')][_0x442f('0x14')]);}else{logger[_0x442f('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x173a42,_0x442f('0xe'));_0x3a067b(_0xf10037['result'][_0x442f('0x14')]);}})[_0x442f('0x15')](function(_0x221ca3){logger[_0x442f('0x12')](_0x442f('0xd'),_0x173a42,_0x221ca3);_0x5a4516(_0x221ca3);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 702da56..4393437 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 _0x8a33=['isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id'];(function(_0x6c649c,_0x5a5c9e){var _0x28e9e8=function(_0x365f29){while(--_0x365f29){_0x6c649c['push'](_0x6c649c['shift']());}};_0x28e9e8(++_0x5a5c9e);}(_0x8a33,0xee));var _0x38a3=function(_0x443f79,_0x33e446){_0x443f79=_0x443f79-0x0;var _0x3847e4=_0x8a33[_0x443f79];return _0x3847e4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x38a3('0x0'));var timeout=require(_0x38a3('0x1'));var express=require(_0x38a3('0x2'));var router=express[_0x38a3('0x3')]();var fs_extra=require(_0x38a3('0x4'));var auth=require(_0x38a3('0x5'));var interaction=require(_0x38a3('0x6'));var config=require(_0x38a3('0x7'));var controller=require(_0x38a3('0x8'));router[_0x38a3('0x9')]('/',auth['isAuthenticated'](),controller[_0x38a3('0xa')]);router[_0x38a3('0x9')](_0x38a3('0xb'),auth[_0x38a3('0xc')](),controller[_0x38a3('0xd')]);router[_0x38a3('0x9')](_0x38a3('0xe'),auth['isAuthenticated'](),controller[_0x38a3('0xf')]);router[_0x38a3('0x9')](_0x38a3('0x10'),auth[_0x38a3('0xc')](),controller[_0x38a3('0x11')]);router[_0x38a3('0x9')](_0x38a3('0x12'),auth['isAuthenticated'](),controller[_0x38a3('0x13')]);router[_0x38a3('0x14')]('/',auth['isAuthenticated'](),controller[_0x38a3('0x15')]);router[_0x38a3('0x16')](_0x38a3('0xb'),auth[_0x38a3('0xc')](),controller[_0x38a3('0x17')]);router['delete']('/:id',auth[_0x38a3('0xc')](),controller['destroy']);module[_0x38a3('0x18')]=router; \ No newline at end of file +var _0x42a4=['index','/:id','preview','run','/:id/query','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated'];(function(_0x13ecf8,_0x3a9000){var _0x44d738=function(_0x403b9f){while(--_0x403b9f){_0x13ecf8['push'](_0x13ecf8['shift']());}};_0x44d738(++_0x3a9000);}(_0x42a4,0x1d9));var _0x442a=function(_0x3beea0,_0x416691){_0x3beea0=_0x3beea0-0x0;var _0x314eb1=_0x42a4[_0x3beea0];return _0x314eb1;};'use strict';var multer=require(_0x442a('0x0'));var util=require(_0x442a('0x1'));var path=require(_0x442a('0x2'));var timeout=require(_0x442a('0x3'));var express=require(_0x442a('0x4'));var router=express['Router']();var fs_extra=require(_0x442a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x442a('0x6'));var config=require(_0x442a('0x7'));var controller=require(_0x442a('0x8'));router[_0x442a('0x9')]('/',auth[_0x442a('0xa')](),controller[_0x442a('0xb')]);router[_0x442a('0x9')](_0x442a('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/preview',auth[_0x442a('0xa')](),controller[_0x442a('0xd')]);router[_0x442a('0x9')]('/:id/run',auth[_0x442a('0xa')](),controller[_0x442a('0xe')]);router[_0x442a('0x9')](_0x442a('0xf'),auth['isAuthenticated'](),controller['query']);router[_0x442a('0x10')]('/',auth['isAuthenticated'](),controller[_0x442a('0x11')]);router[_0x442a('0x12')](_0x442a('0xc'),auth[_0x442a('0xa')](),controller[_0x442a('0x13')]);router[_0x442a('0x14')](_0x442a('0xc'),auth[_0x442a('0xa')](),controller['destroy']);module[_0x442a('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6719bb3..c9403cb 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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x224ce8,_0x565691){var _0x5054a1=function(_0x5dde3f){while(--_0x5dde3f){_0x224ce8['push'](_0x224ce8['shift']());}};_0x5054a1(++_0x565691);}(_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 +var _0xda19=['exports','STRING','TEXT'];(function(_0xa7a5d7,_0x539cf5){var _0x4030fb=function(_0x260552){while(--_0x260552){_0xa7a5d7['push'](_0xa7a5d7['shift']());}};_0x4030fb(++_0x539cf5);}(_0xda19,0xd5));var _0x9da1=function(_0x25c3b6,_0x33406a){_0x25c3b6=_0x25c3b6-0x0;var _0x49032e=_0xda19[_0x25c3b6];return _0x49032e;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 7be16a5..741fada 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 _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x326f,0xd1));var _0xf326=function(_0x1e6f3b,_0x58993b){_0x1e6f3b=_0x1e6f3b-0x0;var _0x577290=_0x326f[_0x1e6f3b];return _0x577290;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file +var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xabce[_0x8de54f];return _0x14cba4;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index bcfb2da..64f7f07 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 _0x22a7=['../../config/logger','api','moment','bluebird','path','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x3a030a,_0x56f29a){var _0xcaf7b8=function(_0x3af88a){while(--_0x3af88a){_0x3a030a['push'](_0x3a030a['shift']());}};_0xcaf7b8(++_0x56f29a);}(_0x22a7,0x1ea));var _0x722a=function(_0x1dfb49,_0x3300db){_0x1dfb49=_0x1dfb49-0x0;var _0x7ea566=_0x22a7[_0x1dfb49];return _0x7ea566;};'use strict';var _=require(_0x722a('0x0'));var util=require(_0x722a('0x1'));var logger=require(_0x722a('0x2'))(_0x722a('0x3'));var moment=require(_0x722a('0x4'));var BPromise=require(_0x722a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x722a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x722a('0x7'));module[_0x722a('0x8')]=function(_0xb7d097,_0x57ad58){return _0xb7d097[_0x722a('0x9')](_0x722a('0xa'),attributes,{'tableName':_0x722a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6722=['analytics_default_reports','util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0x5b932f,_0x41bb78){var _0x39aa83=function(_0x465305){while(--_0x465305){_0x5b932f['push'](_0x5b932f['shift']());}};_0x39aa83(++_0x41bb78);}(_0x6722,0xab));var _0x2672=function(_0x41bdd9,_0x4a92f1){_0x41bdd9=_0x41bdd9-0x0;var _0x23894a=_0x6722[_0x41bdd9];return _0x23894a;};'use strict';var _=require('lodash');var util=require(_0x2672('0x0'));var logger=require(_0x2672('0x1'))(_0x2672('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2672('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2672('0x4'));var config=require(_0x2672('0x5'));var attributes=require('./analyticDefaultReport.attributes');module[_0x2672('0x6')]=function(_0x187aa4,_0x19d2b4){return _0x187aa4[_0x2672('0x7')](_0x2672('0x8'),attributes,{'tableName':_0x2672('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 54f8102..c7b8d17 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 _0xfe33=['message','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x232e7a,_0x19997){var _0x445ddd=function(_0x43628d){while(--_0x43628d){_0x232e7a['push'](_0x232e7a['shift']());}};_0x445ddd(++_0x19997);}(_0xfe33,0x87));var _0x3fe3=function(_0x39e15b,_0x555185){_0x39e15b=_0x39e15b-0x0;var _0x4e5766=_0xfe33[_0x39e15b];return _0x4e5766;};'use strict';var _=require('lodash');var util=require(_0x3fe3('0x0'));var moment=require(_0x3fe3('0x1'));var BPromise=require(_0x3fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fe3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fe3('0x4'))(_0x3fe3('0x5'));var config=require(_0x3fe3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3fe3('0x7')][_0x3fe3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f37ff,_0x21b040,_0x9b80a1){return new BPromise(function(_0x3ef4d9,_0x15bc0d){return client[_0x3fe3('0x9')](_0x2f37ff,_0x9b80a1)[_0x3fe3('0xa')](function(_0x28c716){logger[_0x3fe3('0xb')](_0x3fe3('0xc'),_0x21b040,_0x3fe3('0xd'));logger[_0x3fe3('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x21b040,'request\x20sent',JSON[_0x3fe3('0xf')](_0x28c716));if(_0x28c716['error']){if(_0x28c716[_0x3fe3('0x10')]['code']===0x1f4){logger['error'](_0x3fe3('0xc'),_0x21b040,_0x28c716[_0x3fe3('0x10')][_0x3fe3('0x11')]);return _0x15bc0d(_0x28c716['error'][_0x3fe3('0x11')]);}logger[_0x3fe3('0x10')](_0x3fe3('0xc'),_0x21b040,_0x28c716['error'][_0x3fe3('0x11')]);return _0x3ef4d9(_0x28c716[_0x3fe3('0x10')][_0x3fe3('0x11')]);}else{logger[_0x3fe3('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x21b040,_0x3fe3('0xd'));_0x3ef4d9(_0x28c716['result']['message']);}})[_0x3fe3('0x12')](function(_0x4a9ae3){logger['error'](_0x3fe3('0xc'),_0x21b040,_0x4a9ae3);_0x15bc0d(_0x4a9ae3);});});} \ No newline at end of file +var _0x5ab4=['jayson/promise','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xc90b11,_0x3b9b02){var _0x5ced27=function(_0x269e09){while(--_0x269e09){_0xc90b11['push'](_0xc90b11['shift']());}};_0x5ced27(++_0x3b9b02);}(_0x5ab4,0xbd));var _0x45ab=function(_0x5bb539,_0x2fd421){_0x5bb539=_0x5bb539-0x0;var _0x36b22f=_0x5ab4[_0x5bb539];return _0x36b22f;};'use strict';var _=require(_0x45ab('0x0'));var util=require('util');var moment=require(_0x45ab('0x1'));var BPromise=require(_0x45ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45ab('0x3'));var db=require(_0x45ab('0x4'))['db'];var utils=require(_0x45ab('0x5'));var logger=require(_0x45ab('0x6'))(_0x45ab('0x7'));var config=require(_0x45ab('0x8'));var jayson=require(_0x45ab('0x9'));var client=jayson[_0x45ab('0xa')][_0x45ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46e511,_0x11c83a,_0x530f27){return new BPromise(function(_0xe35d92,_0x2e2e52){return client['request'](_0x46e511,_0x530f27)['then'](function(_0xf60f25){logger[_0x45ab('0xc')](_0x45ab('0xd'),_0x11c83a,'request\x20sent');logger[_0x45ab('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x11c83a,_0x45ab('0xf'),JSON[_0x45ab('0x10')](_0xf60f25));if(_0xf60f25['error']){if(_0xf60f25['error'][_0x45ab('0x11')]===0x1f4){logger[_0x45ab('0x12')](_0x45ab('0xd'),_0x11c83a,_0xf60f25[_0x45ab('0x12')][_0x45ab('0x13')]);return _0x2e2e52(_0xf60f25['error'][_0x45ab('0x13')]);}logger[_0x45ab('0x12')](_0x45ab('0xd'),_0x11c83a,_0xf60f25[_0x45ab('0x12')][_0x45ab('0x13')]);return _0xe35d92(_0xf60f25[_0x45ab('0x12')][_0x45ab('0x13')]);}else{logger[_0x45ab('0xc')](_0x45ab('0xd'),_0x11c83a,'request\x20sent');_0xe35d92(_0xf60f25[_0x45ab('0x14')][_0x45ab('0x13')]);}})[_0x45ab('0x15')](function(_0x479751){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x11c83a,_0x479751);_0x2e2e52(_0x479751);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e8f1325..977168d 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 _0x2009=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x37dd5f,_0x104365){var _0x2fc2e7=function(_0x5b7d76){while(--_0x5b7d76){_0x37dd5f['push'](_0x37dd5f['shift']());}};_0x2fc2e7(++_0x104365);}(_0x2009,0xac));var _0x9200=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2009[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9200('0x0'));var util=require('util');var path=require(_0x9200('0x1'));var timeout=require(_0x9200('0x2'));var express=require(_0x9200('0x3'));var router=express[_0x9200('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9200('0x5'));var interaction=require(_0x9200('0x6'));var config=require(_0x9200('0x7'));var controller=require(_0x9200('0x8'));router[_0x9200('0x9')]('/',auth[_0x9200('0xa')](),controller[_0x9200('0xb')]);router[_0x9200('0x9')](_0x9200('0xc'),auth[_0x9200('0xa')](),controller[_0x9200('0xd')]);router[_0x9200('0x9')](_0x9200('0xe'),auth[_0x9200('0xa')](),controller[_0x9200('0xf')]);router[_0x9200('0x9')]('/:id/run',auth[_0x9200('0xa')](),controller[_0x9200('0x10')]);router['get'](_0x9200('0x11'),auth['isAuthenticated'](),controller[_0x9200('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x9200('0xa')](),controller[_0x9200('0x13')]);router[_0x9200('0x14')](_0x9200('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9200('0x15')]=router; \ No newline at end of file +var _0x56f9=['exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','put','update','delete','destroy'];(function(_0x316b3e,_0x47b154){var _0x45ba95=function(_0x5e68c4){while(--_0x5e68c4){_0x316b3e['push'](_0x316b3e['shift']());}};_0x45ba95(++_0x47b154);}(_0x56f9,0x97));var _0x956f=function(_0x5bb5de,_0x192c4c){_0x5bb5de=_0x5bb5de-0x0;var _0x15de2b=_0x56f9[_0x5bb5de];return _0x15de2b;};'use strict';var multer=require('multer');var util=require(_0x956f('0x0'));var path=require('path');var timeout=require(_0x956f('0x1'));var express=require(_0x956f('0x2'));var router=express['Router']();var fs_extra=require(_0x956f('0x3'));var auth=require(_0x956f('0x4'));var interaction=require(_0x956f('0x5'));var config=require(_0x956f('0x6'));var controller=require(_0x956f('0x7'));router[_0x956f('0x8')]('/',auth[_0x956f('0x9')](),controller[_0x956f('0xa')]);router[_0x956f('0x8')](_0x956f('0xb'),auth['isAuthenticated'](),controller[_0x956f('0xc')]);router[_0x956f('0x8')](_0x956f('0xd'),auth[_0x956f('0x9')](),controller[_0x956f('0xe')]);router[_0x956f('0x8')](_0x956f('0xf'),auth[_0x956f('0x9')](),controller[_0x956f('0x10')]);router[_0x956f('0x8')]('/:id/query',auth[_0x956f('0x9')](),controller[_0x956f('0x11')]);router[_0x956f('0x12')]('/',auth[_0x956f('0x9')](),controller[_0x956f('0x13')]);router[_0x956f('0x14')](_0x956f('0xb'),auth['isAuthenticated'](),controller[_0x956f('0x15')]);router[_0x956f('0x16')](_0x956f('0xb'),auth[_0x956f('0x9')](),controller[_0x956f('0x17')]);module[_0x956f('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f84e16f..8909b1e 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 _0xb341=['ENUM','pdf','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','STRING'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb341,0x18f));var _0x1b34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb341[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x1b34('0x0')],'allowNull':![]},'basename':{'type':Sequelize[_0x1b34('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0x1b34('0x1')]('csv',_0x1b34('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x1b34('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x1b34('0x4')]},'status':{'type':Sequelize[_0x1b34('0x0')],'defaultValue':_0x1b34('0x5')},'type':{'type':Sequelize[_0x1b34('0x1')](_0x1b34('0x6'),_0x1b34('0x7')),'allowNull':![],'defaultValue':_0x1b34('0x6')},'reportId':{'type':Sequelize[_0x1b34('0x8')](0xb)[_0x1b34('0x9')]},'reportType':{'type':Sequelize[_0x1b34('0x0')]}}; \ No newline at end of file +var _0xd9b3=['sequelize','exports','STRING','ENUM','csv','pdf','DATE','Loading','manual','INTEGER','UNSIGNED'];(function(_0x4af039,_0xd79dfd){var _0x41e12c=function(_0x3e240d){while(--_0x3e240d){_0x4af039['push'](_0x4af039['shift']());}};_0x41e12c(++_0xd79dfd);}(_0xd9b3,0xb0));var _0x3d9b=function(_0x325c50,_0x53b39e){_0x325c50=_0x325c50-0x0;var _0x4e2f74=_0xd9b3[_0x325c50];return _0x4e2f74;};'use strict';var Sequelize=require(_0x3d9b('0x0'));var moment=require('moment');module[_0x3d9b('0x1')]={'name':{'type':Sequelize[_0x3d9b('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x3d9b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x3d9b('0x3')](_0x3d9b('0x4'),_0x3d9b('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x3d9b('0x4')},'savename':{'type':Sequelize[_0x3d9b('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3d9b('0x6')]},'endDate':{'type':Sequelize[_0x3d9b('0x6')]},'status':{'type':Sequelize[_0x3d9b('0x2')],'defaultValue':_0x3d9b('0x7')},'type':{'type':Sequelize[_0x3d9b('0x3')](_0x3d9b('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x3d9b('0x8')},'reportId':{'type':Sequelize[_0x3d9b('0x9')](0xb)[_0x3d9b('0xa')]},'reportType':{'type':Sequelize[_0x3d9b('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2b55794..64ec2ec 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 _0x48af=['%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','then','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','user','role','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','download','format'];(function(_0x2ada28,_0x6125b8){var _0x5187c1=function(_0x26cb63){while(--_0x26cb63){_0x2ada28['push'](_0x2ada28['shift']());}};_0x5187c1(++_0x6125b8);}(_0x48af,0x129));var _0xf48a=function(_0x4d515d,_0x108c96){_0x4d515d=_0x4d515d-0x0;var _0x58fe07=_0x48af[_0x4d515d];return _0x58fe07;};'use strict';var emlformat=require(_0xf48a('0x0'));var rimraf=require(_0xf48a('0x1'));var zipdir=require(_0xf48a('0x2'));var jsonpatch=require(_0xf48a('0x3'));var rp=require('request-promise');var moment=require(_0xf48a('0x4'));var BPromise=require(_0xf48a('0x5'));var Mustache=require('mustache');var util=require(_0xf48a('0x6'));var path=require('path');var sox=require(_0xf48a('0x7'));var csv=require(_0xf48a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf48a('0x9'));var _=require(_0xf48a('0xa'));var squel=require(_0xf48a('0xb'));var crypto=require(_0xf48a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf48a('0xd'));var toCsv=require(_0xf48a('0x8'));var querystring=require(_0xf48a('0xe'));var Papa=require(_0xf48a('0xf'));var Redis=require('ioredis');var authService=require(_0xf48a('0x10'));var qs=require(_0xf48a('0x11'));var as=require(_0xf48a('0x12'));var hardwareService=require(_0xf48a('0x13'));var logger=require(_0xf48a('0x14'))(_0xf48a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf48a('0x16'));var db=require(_0xf48a('0x17'))['db'];function respondWithStatusCode(_0x3f3e1b,_0x3ba802){_0x3ba802=_0x3ba802||0xcc;return function(_0x488625){if(_0x488625){return _0x3f3e1b[_0xf48a('0x18')](_0x3ba802);}return _0x3f3e1b[_0xf48a('0x19')](_0x3ba802)[_0xf48a('0x1a')]();};}function respondWithResult(_0x32bf0d,_0x2ea357){_0x2ea357=_0x2ea357||0xc8;return function(_0x1fadbb){if(_0x1fadbb){return _0x32bf0d['status'](_0x2ea357)[_0xf48a('0x1b')](_0x1fadbb);}};}function respondWithFilteredResult(_0x1eddb1,_0x54fad1){return function(_0x129c94){if(_0x129c94){var _0x20b4d1=typeof _0x54fad1['offset']===_0xf48a('0x1c')&&typeof _0x54fad1[_0xf48a('0x1d')]===_0xf48a('0x1c');var _0x519d35=_0x129c94['count'];var _0xb53d2b=_0x20b4d1?0x0:_0x54fad1[_0xf48a('0x1e')];var _0x1b3716=_0x20b4d1?_0x129c94[_0xf48a('0x1f')]:_0x54fad1[_0xf48a('0x1e')]+_0x54fad1[_0xf48a('0x1d')];var _0x55d1fd;if(_0x1b3716>=_0x519d35){_0x1b3716=_0x519d35;_0x55d1fd=0xc8;}else{_0x55d1fd=0xce;}_0x1eddb1['status'](_0x55d1fd);return _0x1eddb1[_0xf48a('0x20')](_0xf48a('0x21'),_0xb53d2b+'-'+_0x1b3716+'/'+_0x519d35)[_0xf48a('0x1b')](_0x129c94);}return null;};}function patchUpdates(_0x13d44c){return function(_0x25846b){try{jsonpatch[_0xf48a('0x22')](_0x25846b,_0x13d44c,!![]);}catch(_0x2c402c){return BPromise['reject'](_0x2c402c);}return _0x25846b[_0xf48a('0x23')]();};}function saveUpdates(_0x2c7e3b,_0x4cc119){return function(_0x1b38f7){if(_0x1b38f7){return _0x1b38f7[_0xf48a('0x24')](_0x2c7e3b)['then'](function(_0x43346e){return _0x43346e;});}return null;};}function removeEntity(_0x4a97cb,_0x206485){return function(_0xd3fb2b){if(_0xd3fb2b){return _0xd3fb2b[_0xf48a('0x25')]()['then'](function(){var _0x11edd8=_0xd3fb2b[_0xf48a('0x26')]({'plain':!![]});var _0x778208='ExtractedReports';return db[_0xf48a('0x27')]['destroy']({'where':{'type':_0x778208,'resourceId':_0x11edd8['id']}})[_0xf48a('0x28')](function(){return _0xd3fb2b;});})[_0xf48a('0x28')](function(){_0x4a97cb[_0xf48a('0x19')](0xcc)[_0xf48a('0x1a')]();});}};}function handleEntityNotFound(_0x461235,_0x54e4a1){return function(_0x451105){if(!_0x451105){_0x461235[_0xf48a('0x18')](0x194);}return _0x451105;};}function handleError(_0x574345,_0x133252){_0x133252=_0x133252||0x1f4;return function(_0x23bc0b){logger[_0xf48a('0x29')](_0x23bc0b[_0xf48a('0x2a')]);if(_0x23bc0b[_0xf48a('0x2b')]){delete _0x23bc0b[_0xf48a('0x2b')];}_0x574345['status'](_0x133252)['send'](_0x23bc0b);};}exports[_0xf48a('0x2c')]=function(_0x49e260,_0x26f53c){var _0x3eb3ca={},_0x5a9e0d={},_0x5826c0={'count':0x0,'rows':[]};var _0x27255a=_[_0xf48a('0x2d')](db[_0xf48a('0x2e')][_0xf48a('0x2f')],function(_0x4ebc24){return{'name':_0x4ebc24[_0xf48a('0x30')],'type':_0x4ebc24[_0xf48a('0x31')][_0xf48a('0x32')]};});_0x5a9e0d[_0xf48a('0x33')]=_[_0xf48a('0x2d')](_0x27255a,'name');_0x5a9e0d[_0xf48a('0x34')]=_[_0xf48a('0x35')](_0x49e260[_0xf48a('0x34')]);_0x5a9e0d[_0xf48a('0x36')]=_[_0xf48a('0x37')](_0x5a9e0d[_0xf48a('0x33')],_0x5a9e0d[_0xf48a('0x34')]);_0x3eb3ca['attributes']=_['intersection'](_0x5a9e0d[_0xf48a('0x33')],qs[_0xf48a('0x38')](_0x49e260[_0xf48a('0x34')][_0xf48a('0x38')]));_0x3eb3ca[_0xf48a('0x39')]=_0x3eb3ca[_0xf48a('0x39')][_0xf48a('0x3a')]?_0x3eb3ca[_0xf48a('0x39')]:_0x5a9e0d[_0xf48a('0x33')];if(!_0x49e260[_0xf48a('0x34')]['hasOwnProperty'](_0xf48a('0x3b'))){_0x3eb3ca[_0xf48a('0x1d')]=qs[_0xf48a('0x1d')](_0x49e260[_0xf48a('0x34')]['limit']);_0x3eb3ca[_0xf48a('0x1e')]=qs[_0xf48a('0x1e')](_0x49e260['query'][_0xf48a('0x1e')]);}_0x3eb3ca[_0xf48a('0x3c')]=qs[_0xf48a('0x3d')](_0x49e260[_0xf48a('0x34')]['sort']);_0x3eb3ca[_0xf48a('0x3e')]=qs[_0xf48a('0x36')](_[_0xf48a('0x3f')](_0x49e260[_0xf48a('0x34')],_0x5a9e0d[_0xf48a('0x36')]),_0x27255a);if(_0x49e260[_0xf48a('0x34')][_0xf48a('0x40')]){_0x3eb3ca[_0xf48a('0x3e')]=_[_0xf48a('0x41')](_0x3eb3ca[_0xf48a('0x3e')],{'$or':_['map'](_0x27255a,function(_0x20cd0f){if(_0x20cd0f['type']!==_0xf48a('0x42')){var _0x177786={};_0x177786[_0x20cd0f['name']]={'$like':'%'+_0x49e260['query'][_0xf48a('0x40')]+'%'};return _0x177786;}})});}_0x3eb3ca=_[_0xf48a('0x41')]({},_0x3eb3ca,_0x49e260[_0xf48a('0x43')]);var _0x1f5c16={'where':_0x3eb3ca[_0xf48a('0x3e')]};return db['AnalyticExtractedReport'][_0xf48a('0x1f')](_0x1f5c16)['then'](function(_0x3da1ef){_0x5826c0[_0xf48a('0x1f')]=_0x3da1ef;if(_0x49e260[_0xf48a('0x34')][_0xf48a('0x44')]){_0x3eb3ca[_0xf48a('0x45')]=[{'all':!![]}];}return db[_0xf48a('0x2e')][_0xf48a('0x46')](_0x3eb3ca);})['then'](function(_0x4262a6){_0x5826c0['rows']=_0x4262a6;return _0x5826c0;})['then'](respondWithFilteredResult(_0x26f53c,_0x3eb3ca))['catch'](handleError(_0x26f53c,null));};exports[_0xf48a('0x47')]=function(_0x353310,_0x1460ae){var _0x5503ec={'raw':!![],'where':{'id':_0x353310[_0xf48a('0x48')]['id']}},_0x2da097={};_0x2da097[_0xf48a('0x33')]=_[_0xf48a('0x35')](db[_0xf48a('0x2e')][_0xf48a('0x2f')]);_0x2da097[_0xf48a('0x34')]=_[_0xf48a('0x35')](_0x353310[_0xf48a('0x34')]);_0x2da097[_0xf48a('0x36')]=_[_0xf48a('0x37')](_0x2da097[_0xf48a('0x33')],_0x2da097[_0xf48a('0x34')]);_0x5503ec['attributes']=_[_0xf48a('0x37')](_0x2da097[_0xf48a('0x33')],qs[_0xf48a('0x38')](_0x353310[_0xf48a('0x34')][_0xf48a('0x38')]));_0x5503ec['attributes']=_0x5503ec[_0xf48a('0x39')][_0xf48a('0x3a')]?_0x5503ec[_0xf48a('0x39')]:_0x2da097[_0xf48a('0x33')];if(_0x353310['query'][_0xf48a('0x44')]){_0x5503ec[_0xf48a('0x45')]=[{'all':!![]}];}_0x5503ec=_[_0xf48a('0x41')]({},_0x5503ec,_0x353310[_0xf48a('0x43')]);return db[_0xf48a('0x2e')]['find'](_0x5503ec)[_0xf48a('0x28')](handleEntityNotFound(_0x1460ae,null))['then'](respondWithResult(_0x1460ae,null))[_0xf48a('0x49')](handleError(_0x1460ae,null));};exports[_0xf48a('0x4a')]=function(_0x5f0d9a,_0x39b3c3){return db[_0xf48a('0x2e')][_0xf48a('0x4a')](_0x5f0d9a[_0xf48a('0x4b')],{})[_0xf48a('0x28')](function(_0x3d2f44){var _0x23a7b4=_0x5f0d9a[_0xf48a('0x4c')]['get']({'plain':!![]});if(!_0x23a7b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23a7b4[_0xf48a('0x4d')]===_0xf48a('0x4c')){var _0x308666=_0x3d2f44[_0xf48a('0x26')]({'plain':!![]});var _0x3a617e=_0xf48a('0x4e');return db[_0xf48a('0x4f')][_0xf48a('0x50')]({'where':{'name':_0x3a617e,'userProfileId':_0x23a7b4[_0xf48a('0x51')]},'raw':!![]})[_0xf48a('0x28')](function(_0x3a2124){if(_0x3a2124&&_0x3a2124[_0xf48a('0x52')]===0x0){return db[_0xf48a('0x27')][_0xf48a('0x4a')]({'name':_0x308666['name'],'resourceId':_0x308666['id'],'type':_0x3a2124[_0xf48a('0x2b')],'sectionId':_0x3a2124['id']},{})[_0xf48a('0x28')](function(){return _0x3d2f44;});}else{return _0x3d2f44;}})['catch'](function(_0x480c17){logger[_0xf48a('0x29')](_0xf48a('0x53'),_0x480c17);throw _0x480c17;});}return _0x3d2f44;})['then'](respondWithResult(_0x39b3c3,0xc9))['catch'](handleError(_0x39b3c3,null));};exports['update']=function(_0x5d858a,_0x3c47e0){if(_0x5d858a['body']['id']){delete _0x5d858a[_0xf48a('0x4b')]['id'];}return db[_0xf48a('0x2e')][_0xf48a('0x50')]({'where':{'id':_0x5d858a['params']['id']}})[_0xf48a('0x28')](handleEntityNotFound(_0x3c47e0,null))[_0xf48a('0x28')](saveUpdates(_0x5d858a['body'],null))[_0xf48a('0x28')](respondWithResult(_0x3c47e0,null))[_0xf48a('0x49')](handleError(_0x3c47e0,null));};exports[_0xf48a('0x25')]=function(_0x35bbaa,_0xb37a08){return db[_0xf48a('0x2e')][_0xf48a('0x50')]({'where':{'id':_0x35bbaa[_0xf48a('0x48')]['id']}})[_0xf48a('0x28')](handleEntityNotFound(_0xb37a08,null))[_0xf48a('0x28')](removeEntity(_0xb37a08,null))[_0xf48a('0x49')](handleError(_0xb37a08,null));};exports['download']=function(_0x855549,_0x4e0f68,_0xf35d85){return db[_0xf48a('0x2e')][_0xf48a('0x50')]({'where':{'id':_0x855549[_0xf48a('0x48')]['id']},'attributes':[_0xf48a('0x2b'),'basename',_0xf48a('0x54'),_0xf48a('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x4e0f68,null))['then'](function(_0x39a764){if(_0x39a764){if(!fs[_0xf48a('0x56')](path[_0xf48a('0x57')](config[_0xf48a('0x58')],_0xf48a('0x59'),_0x39a764[_0xf48a('0x54')]))){throw new db[(_0xf48a('0x5a'))][(_0xf48a('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x855549[_0xf48a('0x34')][_0xf48a('0x5c')]){return _0x4e0f68[_0xf48a('0x18')](0xc8);}return _0x4e0f68[_0xf48a('0x5d')](path[_0xf48a('0x57')](config['root'],'server/files/reports',_0x39a764[_0xf48a('0x54')]),util[_0xf48a('0x5e')](_0xf48a('0x5f'),_0x39a764[_0xf48a('0x60')]||_0x39a764['name'],_0x39a764[_0xf48a('0x55')][_0xf48a('0x61')]()));}})[_0xf48a('0x49')](handleError(_0x4e0f68,null));}; \ No newline at end of file +var _0xc4b2=['../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','findAll','rows','catch','show','keys','intersection','includeAll','include','find','create','body','user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','output','toLowerCase','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x41b796,_0x73452f){var _0x2f96bf=function(_0x5a9a67){while(--_0x5a9a67){_0x41b796['push'](_0x41b796['shift']());}};_0x2f96bf(++_0x73452f);}(_0xc4b2,0x1b2));var _0x2c4b=function(_0x1d5714,_0x2fa5f4){_0x1d5714=_0x1d5714-0x0;var _0x1b620e=_0xc4b2[_0x1d5714];return _0x1b620e;};'use strict';var emlformat=require(_0x2c4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c4b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c4b('0x2'));var moment=require(_0x2c4b('0x3'));var BPromise=require(_0x2c4b('0x4'));var Mustache=require(_0x2c4b('0x5'));var util=require('util');var path=require(_0x2c4b('0x6'));var sox=require(_0x2c4b('0x7'));var csv=require(_0x2c4b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c4b('0x9'));var squel=require(_0x2c4b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c4b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2c4b('0xc'));var Papa=require(_0x2c4b('0xd'));var Redis=require('ioredis');var authService=require(_0x2c4b('0xe'));var qs=require(_0x2c4b('0xf'));var as=require(_0x2c4b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2c4b('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2c4b('0x12'));var db=require(_0x2c4b('0x13'))['db'];function respondWithStatusCode(_0x4f58d8,_0x1d6f0a){_0x1d6f0a=_0x1d6f0a||0xcc;return function(_0x1492d8){if(_0x1492d8){return _0x4f58d8[_0x2c4b('0x14')](_0x1d6f0a);}return _0x4f58d8['status'](_0x1d6f0a)[_0x2c4b('0x15')]();};}function respondWithResult(_0xa72bb1,_0x2981c6){_0x2981c6=_0x2981c6||0xc8;return function(_0x186aa5){if(_0x186aa5){return _0xa72bb1[_0x2c4b('0x16')](_0x2981c6)[_0x2c4b('0x17')](_0x186aa5);}};}function respondWithFilteredResult(_0x59cfdb,_0x793c4){return function(_0x30b9cb){if(_0x30b9cb){var _0x50447e=typeof _0x793c4['offset']===_0x2c4b('0x18')&&typeof _0x793c4[_0x2c4b('0x19')]===_0x2c4b('0x18');var _0x28fe87=_0x30b9cb[_0x2c4b('0x1a')];var _0x1bb1d6=_0x50447e?0x0:_0x793c4[_0x2c4b('0x1b')];var _0x5bebde=_0x50447e?_0x30b9cb[_0x2c4b('0x1a')]:_0x793c4[_0x2c4b('0x1b')]+_0x793c4[_0x2c4b('0x19')];var _0x2f0d06;if(_0x5bebde>=_0x28fe87){_0x5bebde=_0x28fe87;_0x2f0d06=0xc8;}else{_0x2f0d06=0xce;}_0x59cfdb['status'](_0x2f0d06);return _0x59cfdb[_0x2c4b('0x1c')]('Content-Range',_0x1bb1d6+'-'+_0x5bebde+'/'+_0x28fe87)['json'](_0x30b9cb);}return null;};}function patchUpdates(_0x49e850){return function(_0x52a6a2){try{jsonpatch[_0x2c4b('0x1d')](_0x52a6a2,_0x49e850,!![]);}catch(_0x223dc3){return BPromise['reject'](_0x223dc3);}return _0x52a6a2[_0x2c4b('0x1e')]();};}function saveUpdates(_0x541bce,_0x16e128){return function(_0x1351c3){if(_0x1351c3){return _0x1351c3[_0x2c4b('0x1f')](_0x541bce)[_0x2c4b('0x20')](function(_0x1d5875){return _0x1d5875;});}return null;};}function removeEntity(_0x66da48,_0x5f798d){return function(_0x20a835){if(_0x20a835){return _0x20a835[_0x2c4b('0x21')]()[_0x2c4b('0x20')](function(){var _0xd72f80=_0x20a835['get']({'plain':!![]});var _0x499f88=_0x2c4b('0x22');return db[_0x2c4b('0x23')][_0x2c4b('0x21')]({'where':{'type':_0x499f88,'resourceId':_0xd72f80['id']}})[_0x2c4b('0x20')](function(){return _0x20a835;});})[_0x2c4b('0x20')](function(){_0x66da48[_0x2c4b('0x16')](0xcc)[_0x2c4b('0x15')]();});}};}function handleEntityNotFound(_0x39fb95,_0x42da41){return function(_0x1624a4){if(!_0x1624a4){_0x39fb95['sendStatus'](0x194);}return _0x1624a4;};}function handleError(_0x31f46e,_0xf79c43){_0xf79c43=_0xf79c43||0x1f4;return function(_0x3d4232){logger[_0x2c4b('0x24')](_0x3d4232[_0x2c4b('0x25')]);if(_0x3d4232[_0x2c4b('0x26')]){delete _0x3d4232[_0x2c4b('0x26')];}_0x31f46e[_0x2c4b('0x16')](_0xf79c43)[_0x2c4b('0x27')](_0x3d4232);};}exports['index']=function(_0x153cd3,_0x1f97d8){var _0x4273a8={},_0x25b024={},_0x51eea1={'count':0x0,'rows':[]};var _0x4d7448=_[_0x2c4b('0x28')](db[_0x2c4b('0x29')][_0x2c4b('0x2a')],function(_0x167e4b){return{'name':_0x167e4b['fieldName'],'type':_0x167e4b[_0x2c4b('0x2b')][_0x2c4b('0x2c')]};});_0x25b024[_0x2c4b('0x2d')]=_[_0x2c4b('0x28')](_0x4d7448,'name');_0x25b024[_0x2c4b('0x2e')]=_['keys'](_0x153cd3[_0x2c4b('0x2e')]);_0x25b024[_0x2c4b('0x2f')]=_['intersection'](_0x25b024[_0x2c4b('0x2d')],_0x25b024[_0x2c4b('0x2e')]);_0x4273a8[_0x2c4b('0x30')]=_['intersection'](_0x25b024[_0x2c4b('0x2d')],qs[_0x2c4b('0x31')](_0x153cd3[_0x2c4b('0x2e')][_0x2c4b('0x31')]));_0x4273a8[_0x2c4b('0x30')]=_0x4273a8[_0x2c4b('0x30')][_0x2c4b('0x32')]?_0x4273a8['attributes']:_0x25b024['model'];if(!_0x153cd3['query'][_0x2c4b('0x33')](_0x2c4b('0x34'))){_0x4273a8['limit']=qs['limit'](_0x153cd3[_0x2c4b('0x2e')]['limit']);_0x4273a8[_0x2c4b('0x1b')]=qs[_0x2c4b('0x1b')](_0x153cd3[_0x2c4b('0x2e')][_0x2c4b('0x1b')]);}_0x4273a8[_0x2c4b('0x35')]=qs[_0x2c4b('0x36')](_0x153cd3[_0x2c4b('0x2e')]['sort']);_0x4273a8['where']=qs[_0x2c4b('0x2f')](_[_0x2c4b('0x37')](_0x153cd3['query'],_0x25b024[_0x2c4b('0x2f')]),_0x4d7448);if(_0x153cd3[_0x2c4b('0x2e')]['filter']){_0x4273a8[_0x2c4b('0x38')]=_[_0x2c4b('0x39')](_0x4273a8['where'],{'$or':_[_0x2c4b('0x28')](_0x4d7448,function(_0x378fd7){if(_0x378fd7[_0x2c4b('0x2b')]!=='VIRTUAL'){var _0x4f0dc5={};_0x4f0dc5[_0x378fd7[_0x2c4b('0x26')]]={'$like':'%'+_0x153cd3[_0x2c4b('0x2e')][_0x2c4b('0x3a')]+'%'};return _0x4f0dc5;}})});}_0x4273a8=_['merge']({},_0x4273a8,_0x153cd3[_0x2c4b('0x3b')]);var _0x119d3a={'where':_0x4273a8[_0x2c4b('0x38')]};return db[_0x2c4b('0x29')]['count'](_0x119d3a)[_0x2c4b('0x20')](function(_0x23e964){_0x51eea1[_0x2c4b('0x1a')]=_0x23e964;if(_0x153cd3[_0x2c4b('0x2e')]['includeAll']){_0x4273a8['include']=[{'all':!![]}];}return db[_0x2c4b('0x29')][_0x2c4b('0x3c')](_0x4273a8);})[_0x2c4b('0x20')](function(_0x301b28){_0x51eea1[_0x2c4b('0x3d')]=_0x301b28;return _0x51eea1;})[_0x2c4b('0x20')](respondWithFilteredResult(_0x1f97d8,_0x4273a8))[_0x2c4b('0x3e')](handleError(_0x1f97d8,null));};exports[_0x2c4b('0x3f')]=function(_0x2ac3fb,_0x51190e){var _0x2af070={'raw':!![],'where':{'id':_0x2ac3fb['params']['id']}},_0x28e7a2={};_0x28e7a2[_0x2c4b('0x2d')]=_[_0x2c4b('0x40')](db['AnalyticExtractedReport'][_0x2c4b('0x2a')]);_0x28e7a2['query']=_['keys'](_0x2ac3fb[_0x2c4b('0x2e')]);_0x28e7a2[_0x2c4b('0x2f')]=_[_0x2c4b('0x41')](_0x28e7a2[_0x2c4b('0x2d')],_0x28e7a2[_0x2c4b('0x2e')]);_0x2af070['attributes']=_[_0x2c4b('0x41')](_0x28e7a2[_0x2c4b('0x2d')],qs[_0x2c4b('0x31')](_0x2ac3fb[_0x2c4b('0x2e')][_0x2c4b('0x31')]));_0x2af070['attributes']=_0x2af070[_0x2c4b('0x30')][_0x2c4b('0x32')]?_0x2af070[_0x2c4b('0x30')]:_0x28e7a2['model'];if(_0x2ac3fb[_0x2c4b('0x2e')][_0x2c4b('0x42')]){_0x2af070[_0x2c4b('0x43')]=[{'all':!![]}];}_0x2af070=_[_0x2c4b('0x39')]({},_0x2af070,_0x2ac3fb[_0x2c4b('0x3b')]);return db[_0x2c4b('0x29')][_0x2c4b('0x44')](_0x2af070)['then'](handleEntityNotFound(_0x51190e,null))[_0x2c4b('0x20')](respondWithResult(_0x51190e,null))['catch'](handleError(_0x51190e,null));};exports[_0x2c4b('0x45')]=function(_0x4f538b,_0x5f5588){return db[_0x2c4b('0x29')]['create'](_0x4f538b[_0x2c4b('0x46')],{})[_0x2c4b('0x20')](function(_0x23a00e){var _0x1fc5ca=_0x4f538b[_0x2c4b('0x47')][_0x2c4b('0x48')]({'plain':!![]});if(!_0x1fc5ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fc5ca['role']===_0x2c4b('0x47')){var _0x227e39=_0x23a00e['get']({'plain':!![]});var _0x1fc464=_0x2c4b('0x22');return db[_0x2c4b('0x49')][_0x2c4b('0x44')]({'where':{'name':_0x1fc464,'userProfileId':_0x1fc5ca['userProfileId']},'raw':!![]})['then'](function(_0x1588f2){if(_0x1588f2&&_0x1588f2['autoAssociation']===0x0){return db[_0x2c4b('0x23')][_0x2c4b('0x45')]({'name':_0x227e39['name'],'resourceId':_0x227e39['id'],'type':_0x1588f2['name'],'sectionId':_0x1588f2['id']},{})[_0x2c4b('0x20')](function(){return _0x23a00e;});}else{return _0x23a00e;}})['catch'](function(_0xcd2a09){logger[_0x2c4b('0x24')](_0x2c4b('0x4a'),_0xcd2a09);throw _0xcd2a09;});}return _0x23a00e;})[_0x2c4b('0x20')](respondWithResult(_0x5f5588,0xc9))[_0x2c4b('0x3e')](handleError(_0x5f5588,null));};exports[_0x2c4b('0x1f')]=function(_0x111673,_0x242873){if(_0x111673[_0x2c4b('0x46')]['id']){delete _0x111673['body']['id'];}return db[_0x2c4b('0x29')][_0x2c4b('0x44')]({'where':{'id':_0x111673[_0x2c4b('0x4b')]['id']}})[_0x2c4b('0x20')](handleEntityNotFound(_0x242873,null))['then'](saveUpdates(_0x111673[_0x2c4b('0x46')],null))['then'](respondWithResult(_0x242873,null))[_0x2c4b('0x3e')](handleError(_0x242873,null));};exports[_0x2c4b('0x21')]=function(_0x42f2de,_0x524236){return db['AnalyticExtractedReport'][_0x2c4b('0x44')]({'where':{'id':_0x42f2de[_0x2c4b('0x4b')]['id']}})[_0x2c4b('0x20')](handleEntityNotFound(_0x524236,null))['then'](removeEntity(_0x524236,null))[_0x2c4b('0x3e')](handleError(_0x524236,null));};exports[_0x2c4b('0x4c')]=function(_0x4d1b42,_0xbfb66f,_0x6b6f96){return db[_0x2c4b('0x29')]['find']({'where':{'id':_0x4d1b42[_0x2c4b('0x4b')]['id']},'attributes':['name',_0x2c4b('0x4d'),_0x2c4b('0x4e'),'output'],'raw':!![]})[_0x2c4b('0x20')](handleEntityNotFound(_0xbfb66f,null))[_0x2c4b('0x20')](function(_0x28a652){if(_0x28a652){if(!fs[_0x2c4b('0x4f')](path[_0x2c4b('0x50')](config[_0x2c4b('0x51')],_0x2c4b('0x52'),_0x28a652[_0x2c4b('0x4e')]))){throw new db[(_0x2c4b('0x53'))][(_0x2c4b('0x54'))](_0x2c4b('0x55'));}if(_0x4d1b42[_0x2c4b('0x2e')][_0x2c4b('0x56')]){return _0xbfb66f[_0x2c4b('0x14')](0xc8);}return _0xbfb66f[_0x2c4b('0x4c')](path[_0x2c4b('0x50')](config[_0x2c4b('0x51')],_0x2c4b('0x52'),_0x28a652[_0x2c4b('0x4e')]),util['format'](_0x2c4b('0x57'),_0x28a652['basename']||_0x28a652['name'],_0x28a652[_0x2c4b('0x58')][_0x2c4b('0x59')]()));}})['catch'](handleError(_0xbfb66f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 363dda8..41bb1f7 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 _0x5c09=['define','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x1ec3fa,_0x3e9940){var _0x349bee=function(_0x539e67){while(--_0x539e67){_0x1ec3fa['push'](_0x1ec3fa['shift']());}};_0x349bee(++_0x3e9940);}(_0x5c09,0x6a));var _0x95c0=function(_0x453c56,_0x14b10d){_0x453c56=_0x453c56-0x0;var _0x3a114d=_0x5c09[_0x453c56];return _0x3a114d;};'use strict';var _=require(_0x95c0('0x0'));var util=require(_0x95c0('0x1'));var logger=require(_0x95c0('0x2'))('api');var moment=require(_0x95c0('0x3'));var BPromise=require(_0x95c0('0x4'));var rp=require(_0x95c0('0x5'));var fs=require('fs');var path=require(_0x95c0('0x6'));var rimraf=require(_0x95c0('0x7'));var config=require(_0x95c0('0x8'));var attributes=require(_0x95c0('0x9'));module[_0x95c0('0xa')]=function(_0x22df75,_0x133672){return _0x22df75[_0x95c0('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0x95c0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5940=['./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5940,0x108));var _0x0594=function(_0x2e7165,_0x40cd42){_0x2e7165=_0x2e7165-0x0;var _0x44f8cd=_0x5940[_0x2e7165];return _0x44f8cd;};'use strict';var _=require('lodash');var util=require(_0x0594('0x0'));var logger=require('../../config/logger')(_0x0594('0x1'));var moment=require(_0x0594('0x2'));var BPromise=require(_0x0594('0x3'));var rp=require(_0x0594('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0594('0x5'));var attributes=require(_0x0594('0x6'));module[_0x0594('0x7')]=function(_0x3a17ba,_0x516eb2){return _0x3a17ba['define'](_0x0594('0x8'),attributes,{'tableName':_0x0594('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 34a173a..c8029e3 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 _0x90db=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1a5f54,_0x42b4fa){var _0x13f830=function(_0x17c2fb){while(--_0x17c2fb){_0x1a5f54['push'](_0x1a5f54['shift']());}};_0x13f830(++_0x42b4fa);}(_0x90db,0x179));var _0xb90d=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x90db[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xb90d('0x0'));var util=require(_0xb90d('0x1'));var moment=require(_0xb90d('0x2'));var BPromise=require(_0xb90d('0x3'));var rs=require(_0xb90d('0x4'));var fs=require('fs');var Redis=require(_0xb90d('0x5'));var db=require(_0xb90d('0x6'))['db'];var utils=require(_0xb90d('0x7'));var logger=require(_0xb90d('0x8'))('rpc');var config=require(_0xb90d('0x9'));var jayson=require(_0xb90d('0xa'));var client=jayson[_0xb90d('0xb')][_0xb90d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46fd49,_0x1b3e51,_0x4d3d15){return new BPromise(function(_0x41a338,_0x38e12c){return client[_0xb90d('0xd')](_0x46fd49,_0x4d3d15)['then'](function(_0x242743){logger[_0xb90d('0xe')](_0xb90d('0xf'),_0x1b3e51,_0xb90d('0x10'));logger['debug'](_0xb90d('0x11'),_0x1b3e51,_0xb90d('0x10'),JSON[_0xb90d('0x12')](_0x242743));if(_0x242743['error']){if(_0x242743[_0xb90d('0x13')][_0xb90d('0x14')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b3e51,_0x242743[_0xb90d('0x13')][_0xb90d('0x15')]);return _0x38e12c(_0x242743[_0xb90d('0x13')][_0xb90d('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b3e51,_0x242743[_0xb90d('0x13')][_0xb90d('0x15')]);return _0x41a338(_0x242743['error'][_0xb90d('0x15')]);}else{logger[_0xb90d('0xe')](_0xb90d('0xf'),_0x1b3e51,_0xb90d('0x10'));_0x41a338(_0x242743[_0xb90d('0x16')][_0xb90d('0x15')]);}})[_0xb90d('0x17')](function(_0x5c664d){logger[_0xb90d('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b3e51,_0x5c664d);_0x38e12c(_0x5c664d);});});} \ No newline at end of file +var _0xedb9=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xedb9,0x16e));var _0x9edb=function(_0x2913be,_0x3771dc){_0x2913be=_0x2913be-0x0;var _0x1ac74c=_0xedb9[_0x2913be];return _0x1ac74c;};'use strict';var _=require('lodash');var util=require(_0x9edb('0x0'));var moment=require('moment');var BPromise=require(_0x9edb('0x1'));var rs=require(_0x9edb('0x2'));var fs=require('fs');var Redis=require(_0x9edb('0x3'));var db=require(_0x9edb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9edb('0x5'));var config=require(_0x9edb('0x6'));var jayson=require(_0x9edb('0x7'));var client=jayson[_0x9edb('0x8')][_0x9edb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f86fb,_0x523d7f,_0x219b6a){return new BPromise(function(_0x4aa55f,_0x2a48de){return client[_0x9edb('0xa')](_0x1f86fb,_0x219b6a)[_0x9edb('0xb')](function(_0xd53e5d){logger[_0x9edb('0xc')](_0x9edb('0xd'),_0x523d7f,'request\x20sent');logger[_0x9edb('0xe')](_0x9edb('0xf'),_0x523d7f,_0x9edb('0x10'),JSON[_0x9edb('0x11')](_0xd53e5d));if(_0xd53e5d[_0x9edb('0x12')]){if(_0xd53e5d[_0x9edb('0x12')][_0x9edb('0x13')]===0x1f4){logger[_0x9edb('0x12')](_0x9edb('0xd'),_0x523d7f,_0xd53e5d[_0x9edb('0x12')][_0x9edb('0x14')]);return _0x2a48de(_0xd53e5d[_0x9edb('0x12')][_0x9edb('0x14')]);}logger[_0x9edb('0x12')](_0x9edb('0xd'),_0x523d7f,_0xd53e5d['error'][_0x9edb('0x14')]);return _0x4aa55f(_0xd53e5d['error'][_0x9edb('0x14')]);}else{logger[_0x9edb('0xc')](_0x9edb('0xd'),_0x523d7f,_0x9edb('0x10'));_0x4aa55f(_0xd53e5d[_0x9edb('0x15')][_0x9edb('0x14')]);}})[_0x9edb('0x16')](function(_0x23f11f){logger[_0x9edb('0x12')](_0x9edb('0xd'),_0x523d7f,_0x23f11f);_0x2a48de(_0x23f11f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 208ba0e..97454ca 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 _0x65ca=['../../components/auth/service','../../components/interaction/service','get','index','show','isAuthenticated','download','post','create','put','delete','/:id','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x41ffbb,_0x3ed4a9){var _0x2dc5fd=function(_0x35cf91){while(--_0x35cf91){_0x41ffbb['push'](_0x41ffbb['shift']());}};_0x2dc5fd(++_0x3ed4a9);}(_0x65ca,0xb9));var _0xa65c=function(_0x3ed26c,_0xab6b81){_0x3ed26c=_0x3ed26c-0x0;var _0x20074a=_0x65ca[_0x3ed26c];return _0x20074a;};'use strict';var multer=require(_0xa65c('0x0'));var util=require(_0xa65c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa65c('0x2'));var router=express[_0xa65c('0x3')]();var fs_extra=require(_0xa65c('0x4'));var auth=require(_0xa65c('0x5'));var interaction=require(_0xa65c('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xa65c('0x7')]('/',auth['isAuthenticated'](),controller[_0xa65c('0x8')]);router[_0xa65c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa65c('0x9')]);router[_0xa65c('0x7')]('/:id/download',auth[_0xa65c('0xa')](),controller[_0xa65c('0xb')]);router[_0xa65c('0xc')]('/',auth[_0xa65c('0xa')](),controller[_0xa65c('0xd')]);router[_0xa65c('0xe')]('/:id',auth[_0xa65c('0xa')](),controller['update']);router[_0xa65c('0xf')](_0xa65c('0x10'),auth[_0xa65c('0xa')](),controller[_0xa65c('0x11')]);module[_0xa65c('0x12')]=router; \ No newline at end of file +var _0x2336=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','show','/:id/download','download','post','create','update','destroy','exports'];(function(_0x3b9afb,_0x2133f4){var _0x136e05=function(_0x1fb7e2){while(--_0x1fb7e2){_0x3b9afb['push'](_0x3b9afb['shift']());}};_0x136e05(++_0x2133f4);}(_0x2336,0x10a));var _0x6233=function(_0x24b8ec,_0x3c8c5b){_0x24b8ec=_0x24b8ec-0x0;var _0x1d1b63=_0x2336[_0x24b8ec];return _0x1d1b63;};'use strict';var multer=require(_0x6233('0x0'));var util=require(_0x6233('0x1'));var path=require('path');var timeout=require(_0x6233('0x2'));var express=require(_0x6233('0x3'));var router=express['Router']();var fs_extra=require(_0x6233('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6233('0x5'));var config=require(_0x6233('0x6'));var controller=require(_0x6233('0x7'));router[_0x6233('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6233('0x8')](_0x6233('0x9'),auth[_0x6233('0xa')](),controller[_0x6233('0xb')]);router['get'](_0x6233('0xc'),auth[_0x6233('0xa')](),controller[_0x6233('0xd')]);router[_0x6233('0xe')]('/',auth[_0x6233('0xa')](),controller[_0x6233('0xf')]);router['put'](_0x6233('0x9'),auth[_0x6233('0xa')](),controller[_0x6233('0x10')]);router['delete'](_0x6233('0x9'),auth[_0x6233('0xa')](),controller[_0x6233('0x11')]);module[_0x6233('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e86381b..c6d8511 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 _0x3b74=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x2e2555,_0x3b1ad5){var _0x13dec4=function(_0x1f7f6c){while(--_0x1f7f6c){_0x2e2555['push'](_0x2e2555['shift']());}};_0x13dec4(++_0x3b1ad5);}(_0x3b74,0xd1));var _0x43b7=function(_0x1804e0,_0x3e69b7){_0x1804e0=_0x1804e0-0x0;var _0x29b36b=_0x3b74[_0x1804e0];return _0x29b36b;};'use strict';var Sequelize=require(_0x43b7('0x0'));module[_0x43b7('0x1')]={'field':{'type':Sequelize[_0x43b7('0x2')]},'alias':{'type':Sequelize[_0x43b7('0x3')]},'function':{'type':Sequelize[_0x43b7('0x3')]},'format':{'type':Sequelize[_0x43b7('0x3')]},'groupBy':{'type':Sequelize[_0x43b7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x43b7('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9330=['STRING','BOOLEAN','exports'];(function(_0x12e590,_0x75675b){var _0x4878f4=function(_0x4e2c12){while(--_0x4e2c12){_0x12e590['push'](_0x12e590['shift']());}};_0x4878f4(++_0x75675b);}(_0x9330,0x10d));var _0x0933=function(_0x4fe309,_0xd472cb){_0x4fe309=_0x4fe309-0x0;var _0x2b1f5c=_0x9330[_0x4fe309];return _0x2b1f5c;};'use strict';var Sequelize=require('sequelize');module[_0x0933('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x0933('0x1')]},'function':{'type':Sequelize[_0x0933('0x1')]},'format':{'type':Sequelize[_0x0933('0x1')]},'groupBy':{'type':Sequelize[_0x0933('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x0933('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 6e5fb7a..4b20480 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 _0xc485=['nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','create','body','bulkCreate','find','params','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','status','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0xc485,0x105));var _0x5c48=function(_0xdb628e,_0x103e9a){_0xdb628e=_0xdb628e-0x0;var _0x493aa5=_0xc485[_0xdb628e];return _0x493aa5;};'use strict';var emlformat=require(_0x5c48('0x0'));var rimraf=require(_0x5c48('0x1'));var zipdir=require(_0x5c48('0x2'));var jsonpatch=require(_0x5c48('0x3'));var rp=require(_0x5c48('0x4'));var moment=require(_0x5c48('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c48('0x6'));var util=require(_0x5c48('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c48('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5c48('0x9'));var jsforce=require(_0x5c48('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5c48('0xb'));var querystring=require(_0x5c48('0xc'));var Papa=require(_0x5c48('0xd'));var Redis=require('ioredis');var authService=require(_0x5c48('0xe'));var qs=require(_0x5c48('0xf'));var as=require(_0x5c48('0x10'));var hardwareService=require(_0x5c48('0x11'));var logger=require(_0x5c48('0x12'))(_0x5c48('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c48('0x14'));var db=require(_0x5c48('0x15'))['db'];function respondWithStatusCode(_0x427684,_0x37f8d9){_0x37f8d9=_0x37f8d9||0xcc;return function(_0x3df1d1){if(_0x3df1d1){return _0x427684[_0x5c48('0x16')](_0x37f8d9);}return _0x427684['status'](_0x37f8d9)['end']();};}function respondWithResult(_0x36cb51,_0x1c116e){_0x1c116e=_0x1c116e||0xc8;return function(_0x1e93bc){if(_0x1e93bc){return _0x36cb51['status'](_0x1c116e)[_0x5c48('0x17')](_0x1e93bc);}};}function respondWithFilteredResult(_0x3dda19,_0x36371b){return function(_0x19dc50){if(_0x19dc50){var _0x17a784=typeof _0x36371b[_0x5c48('0x18')]==='undefined'&&typeof _0x36371b[_0x5c48('0x19')]===_0x5c48('0x1a');var _0x12c781=_0x19dc50[_0x5c48('0x1b')];var _0x1b1877=_0x17a784?0x0:_0x36371b[_0x5c48('0x18')];var _0x4f57dc=_0x17a784?_0x19dc50['count']:_0x36371b[_0x5c48('0x18')]+_0x36371b['limit'];var _0x1f1c9a;if(_0x4f57dc>=_0x12c781){_0x4f57dc=_0x12c781;_0x1f1c9a=0xc8;}else{_0x1f1c9a=0xce;}_0x3dda19['status'](_0x1f1c9a);return _0x3dda19['set'](_0x5c48('0x1c'),_0x1b1877+'-'+_0x4f57dc+'/'+_0x12c781)['json'](_0x19dc50);}return null;};}function patchUpdates(_0x3a7975){return function(_0x2adb1d){try{jsonpatch[_0x5c48('0x1d')](_0x2adb1d,_0x3a7975,!![]);}catch(_0xc28b4c){return BPromise[_0x5c48('0x1e')](_0xc28b4c);}return _0x2adb1d[_0x5c48('0x1f')]();};}function saveUpdates(_0x5eb373,_0x175fa7){return function(_0x28c09b){if(_0x28c09b){return _0x28c09b[_0x5c48('0x20')](_0x5eb373)[_0x5c48('0x21')](function(_0x36bc86){return _0x36bc86;});}return null;};}function removeEntity(_0x63c5b1,_0x37c5eb){return function(_0x237380){if(_0x237380){return _0x237380[_0x5c48('0x22')]()[_0x5c48('0x21')](function(){_0x63c5b1[_0x5c48('0x23')](0xcc)[_0x5c48('0x24')]();});}};}function handleEntityNotFound(_0x1c2474,_0x18e2fe){return function(_0x468e49){if(!_0x468e49){_0x1c2474[_0x5c48('0x16')](0x194);}return _0x468e49;};}function handleError(_0x47b309,_0x72662c){_0x72662c=_0x72662c||0x1f4;return function(_0x1ad680){logger[_0x5c48('0x25')](_0x1ad680[_0x5c48('0x26')]);if(_0x1ad680[_0x5c48('0x27')]){delete _0x1ad680[_0x5c48('0x27')];}_0x47b309[_0x5c48('0x23')](_0x72662c)[_0x5c48('0x28')](_0x1ad680);};}exports[_0x5c48('0x29')]=function(_0x2391d8,_0x16f33b){var _0x7c1e9c={},_0x4d1623={},_0x5a5bf7={'count':0x0,'rows':[]};var _0x2c3131=_[_0x5c48('0x2a')](db[_0x5c48('0x2b')][_0x5c48('0x2c')],function(_0x4ec341){return{'name':_0x4ec341[_0x5c48('0x2d')],'type':_0x4ec341[_0x5c48('0x2e')][_0x5c48('0x2f')]};});_0x4d1623['model']=_[_0x5c48('0x2a')](_0x2c3131,_0x5c48('0x27'));_0x4d1623[_0x5c48('0x30')]=_[_0x5c48('0x31')](_0x2391d8[_0x5c48('0x30')]);_0x4d1623[_0x5c48('0x32')]=_[_0x5c48('0x33')](_0x4d1623[_0x5c48('0x34')],_0x4d1623[_0x5c48('0x30')]);_0x7c1e9c[_0x5c48('0x35')]=_[_0x5c48('0x33')](_0x4d1623[_0x5c48('0x34')],qs[_0x5c48('0x36')](_0x2391d8['query']['fields']));_0x7c1e9c[_0x5c48('0x35')]=_0x7c1e9c[_0x5c48('0x35')]['length']?_0x7c1e9c[_0x5c48('0x35')]:_0x4d1623[_0x5c48('0x34')];if(!_0x2391d8[_0x5c48('0x30')]['hasOwnProperty'](_0x5c48('0x37'))){_0x7c1e9c[_0x5c48('0x19')]=qs['limit'](_0x2391d8[_0x5c48('0x30')][_0x5c48('0x19')]);_0x7c1e9c['offset']=qs['offset'](_0x2391d8[_0x5c48('0x30')][_0x5c48('0x18')]);}_0x7c1e9c['order']=qs[_0x5c48('0x38')](_0x2391d8[_0x5c48('0x30')]['sort']);_0x7c1e9c['where']=qs[_0x5c48('0x32')](_[_0x5c48('0x39')](_0x2391d8[_0x5c48('0x30')],_0x4d1623['filters']),_0x2c3131);if(_0x2391d8[_0x5c48('0x30')][_0x5c48('0x3a')]){_0x7c1e9c[_0x5c48('0x3b')]=_['merge'](_0x7c1e9c['where'],{'$or':_[_0x5c48('0x2a')](_0x2c3131,function(_0x22faaa){if(_0x22faaa[_0x5c48('0x2e')]!=='VIRTUAL'){var _0x43bdac={};_0x43bdac[_0x22faaa['name']]={'$like':'%'+_0x2391d8[_0x5c48('0x30')][_0x5c48('0x3a')]+'%'};return _0x43bdac;}})});}_0x7c1e9c=_[_0x5c48('0x3c')]({},_0x7c1e9c,_0x2391d8[_0x5c48('0x3d')]);var _0xe36d2b={'where':_0x7c1e9c[_0x5c48('0x3b')]};return db[_0x5c48('0x2b')][_0x5c48('0x1b')](_0xe36d2b)[_0x5c48('0x21')](function(_0x18b3b1){_0x5a5bf7['count']=_0x18b3b1;if(_0x2391d8[_0x5c48('0x30')][_0x5c48('0x3e')]){_0x7c1e9c[_0x5c48('0x3f')]=[{'all':!![]}];}return db[_0x5c48('0x2b')][_0x5c48('0x40')](_0x7c1e9c);})[_0x5c48('0x21')](function(_0x35cf29){_0x5a5bf7[_0x5c48('0x41')]=_0x35cf29;return _0x5a5bf7;})[_0x5c48('0x21')](respondWithFilteredResult(_0x16f33b,_0x7c1e9c))[_0x5c48('0x42')](handleError(_0x16f33b,null));};exports['show']=function(_0x14036a,_0x5b8a6d){var _0x129860={'raw':![],'where':{'id':_0x14036a['params']['id']}},_0x20bc00={};_0x20bc00[_0x5c48('0x34')]=_[_0x5c48('0x31')](db['AnalyticFieldReport'][_0x5c48('0x2c')]);_0x20bc00[_0x5c48('0x30')]=_[_0x5c48('0x31')](_0x14036a[_0x5c48('0x30')]);_0x20bc00[_0x5c48('0x32')]=_[_0x5c48('0x33')](_0x20bc00[_0x5c48('0x34')],_0x20bc00[_0x5c48('0x30')]);_0x129860[_0x5c48('0x35')]=_[_0x5c48('0x33')](_0x20bc00[_0x5c48('0x34')],qs['fields'](_0x14036a[_0x5c48('0x30')][_0x5c48('0x36')]));_0x129860[_0x5c48('0x35')]=_0x129860[_0x5c48('0x35')]['length']?_0x129860[_0x5c48('0x35')]:_0x20bc00['model'];if(_0x14036a['query']['includeAll']){_0x129860[_0x5c48('0x3f')]=[{'all':!![]}];}_0x129860=_[_0x5c48('0x3c')]({},_0x129860,_0x14036a[_0x5c48('0x3d')]);return db[_0x5c48('0x2b')]['find'](_0x129860)[_0x5c48('0x21')](handleEntityNotFound(_0x5b8a6d,null))[_0x5c48('0x21')](respondWithResult(_0x5b8a6d,null))[_0x5c48('0x42')](handleError(_0x5b8a6d,null));};exports[_0x5c48('0x43')]=function(_0x4e0380,_0x5f1de4){return db[_0x5c48('0x2b')][_0x5c48('0x43')](_0x4e0380[_0x5c48('0x44')],{})[_0x5c48('0x21')](respondWithResult(_0x5f1de4,0xc9))[_0x5c48('0x42')](handleError(_0x5f1de4,null));};exports[_0x5c48('0x45')]=function(_0x16de15,_0x17f77c){return db['AnalyticFieldReport']['bulkCreate'](_0x16de15['body'],{'raw':![],'individualHooks':!![]})[_0x5c48('0x21')](respondWithResult(_0x17f77c,0xc9))[_0x5c48('0x42')](handleError(_0x17f77c,null));};exports[_0x5c48('0x20')]=function(_0x58c0f1,_0x396409){if(_0x58c0f1[_0x5c48('0x44')]['id']){delete _0x58c0f1[_0x5c48('0x44')]['id'];}return db[_0x5c48('0x2b')]['find']({'where':{'id':_0x58c0f1['params']['id']}})['then'](handleEntityNotFound(_0x396409,null))[_0x5c48('0x21')](saveUpdates(_0x58c0f1['body'],null))[_0x5c48('0x21')](respondWithResult(_0x396409,null))['catch'](handleError(_0x396409,null));};exports['destroy']=function(_0x44c605,_0x13895d){return db[_0x5c48('0x2b')][_0x5c48('0x46')]({'where':{'id':_0x44c605[_0x5c48('0x47')]['id']}})[_0x5c48('0x21')](handleEntityNotFound(_0x13895d,null))['then'](removeEntity(_0x13895d,null))['catch'](handleError(_0x13895d,null));};exports[_0x5c48('0x48')]=function(_0x422f26,_0x4a9b31){return db['AnalyticFieldReport'][_0x5c48('0x22')]({'where':{'id':_0x422f26[_0x5c48('0x30')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4a9b31,0xcc))[_0x5c48('0x42')](handleError(_0x4a9b31,null));};exports[_0x5c48('0x49')]=function(_0xc74a0a,_0x76aeae,_0x4e5fcf){return db[_0x5c48('0x4a')][_0x5c48('0x4b')]({'where':{'id':_0xc74a0a[_0x5c48('0x47')]['id']}})['then'](handleEntityNotFound(_0x76aeae,null))[_0x5c48('0x21')](function(_0x1d3c75){if(_0x1d3c75){return db[_0x5c48('0x4c')][_0x5c48('0x4d')](function(_0x2f9338){return db['AnalyticFieldReport'][_0x5c48('0x22')]({'where':{'CustomReportId':_0xc74a0a[_0x5c48('0x47')]['id']},'transaction':_0x2f9338})[_0x5c48('0x21')](function(_0xa102c4){var _0x3509f4=_[_0x5c48('0x2a')](_0xc74a0a[_0x5c48('0x44')],function(_0x254d43){delete _0x254d43['id'];_0x254d43[_0x5c48('0x4e')]=_0xc74a0a[_0x5c48('0x47')]['id'];return _0x254d43;});return db['AnalyticFieldReport'][_0x5c48('0x45')](_0x3509f4,{'transaction':_0x2f9338});});})['then'](function(){return db[_0x5c48('0x2b')][_0x5c48('0x40')]({'where':{'CustomReportId':_0xc74a0a[_0x5c48('0x47')]['id']}});});}})[_0x5c48('0x21')](respondWithResult(_0x76aeae,null))['catch'](handleError(_0x76aeae,null));}; \ No newline at end of file +var _0xaa90=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','body','bulkCreate','find','ids','addFields','AnalyticCustomReport','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0xaad329,_0x842897){var _0x3c7540=function(_0x82b87){while(--_0x82b87){_0xaad329['push'](_0xaad329['shift']());}};_0x3c7540(++_0x842897);}(_0xaa90,0x96));var _0x0aa9=function(_0x208cce,_0x31fe39){_0x208cce=_0x208cce-0x0;var _0x300943=_0xaa90[_0x208cce];return _0x300943;};'use strict';var emlformat=require(_0x0aa9('0x0'));var rimraf=require(_0x0aa9('0x1'));var zipdir=require(_0x0aa9('0x2'));var jsonpatch=require(_0x0aa9('0x3'));var rp=require(_0x0aa9('0x4'));var moment=require(_0x0aa9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0aa9('0x6'));var util=require(_0x0aa9('0x7'));var path=require(_0x0aa9('0x8'));var sox=require('sox');var csv=require(_0x0aa9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0aa9('0xa'));var _=require(_0x0aa9('0xb'));var squel=require('squel');var crypto=require(_0x0aa9('0xc'));var jsforce=require(_0x0aa9('0xd'));var deskjs=require(_0x0aa9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0aa9('0xf'));var Redis=require(_0x0aa9('0x10'));var authService=require(_0x0aa9('0x11'));var qs=require(_0x0aa9('0x12'));var as=require(_0x0aa9('0x13'));var hardwareService=require(_0x0aa9('0x14'));var logger=require(_0x0aa9('0x15'))(_0x0aa9('0x16'));var utils=require('../../config/utils');var config=require(_0x0aa9('0x17'));var licenseUtil=require(_0x0aa9('0x18'));var db=require(_0x0aa9('0x19'))['db'];function respondWithStatusCode(_0x180a9c,_0xc57710){_0xc57710=_0xc57710||0xcc;return function(_0x287c99){if(_0x287c99){return _0x180a9c[_0x0aa9('0x1a')](_0xc57710);}return _0x180a9c['status'](_0xc57710)[_0x0aa9('0x1b')]();};}function respondWithResult(_0x174519,_0x4cf59f){_0x4cf59f=_0x4cf59f||0xc8;return function(_0x292811){if(_0x292811){return _0x174519['status'](_0x4cf59f)[_0x0aa9('0x1c')](_0x292811);}};}function respondWithFilteredResult(_0x55b427,_0x4171f2){return function(_0x4e2d46){if(_0x4e2d46){var _0x150443=typeof _0x4171f2[_0x0aa9('0x1d')]==='undefined'&&typeof _0x4171f2[_0x0aa9('0x1e')]==='undefined';var _0x22eabd=_0x4e2d46['count'];var _0x17a140=_0x150443?0x0:_0x4171f2['offset'];var _0x1fc321=_0x150443?_0x4e2d46[_0x0aa9('0x1f')]:_0x4171f2[_0x0aa9('0x1d')]+_0x4171f2[_0x0aa9('0x1e')];var _0x2713fc;if(_0x1fc321>=_0x22eabd){_0x1fc321=_0x22eabd;_0x2713fc=0xc8;}else{_0x2713fc=0xce;}_0x55b427[_0x0aa9('0x20')](_0x2713fc);return _0x55b427[_0x0aa9('0x21')](_0x0aa9('0x22'),_0x17a140+'-'+_0x1fc321+'/'+_0x22eabd)[_0x0aa9('0x1c')](_0x4e2d46);}return null;};}function patchUpdates(_0x85a7){return function(_0x466da5){try{jsonpatch[_0x0aa9('0x23')](_0x466da5,_0x85a7,!![]);}catch(_0x111870){return BPromise[_0x0aa9('0x24')](_0x111870);}return _0x466da5[_0x0aa9('0x25')]();};}function saveUpdates(_0x1f456b,_0x2388e1){return function(_0x5c7ab5){if(_0x5c7ab5){return _0x5c7ab5[_0x0aa9('0x26')](_0x1f456b)['then'](function(_0x4f82f0){return _0x4f82f0;});}return null;};}function removeEntity(_0x5c3657,_0x3dab14){return function(_0x3cb25a){if(_0x3cb25a){return _0x3cb25a[_0x0aa9('0x27')]()[_0x0aa9('0x28')](function(){_0x5c3657[_0x0aa9('0x20')](0xcc)[_0x0aa9('0x1b')]();});}};}function handleEntityNotFound(_0x198950,_0x561fe5){return function(_0x684e7b){if(!_0x684e7b){_0x198950[_0x0aa9('0x1a')](0x194);}return _0x684e7b;};}function handleError(_0x4ab14c,_0x11d550){_0x11d550=_0x11d550||0x1f4;return function(_0x26b93d){logger[_0x0aa9('0x29')](_0x26b93d[_0x0aa9('0x2a')]);if(_0x26b93d['name']){delete _0x26b93d[_0x0aa9('0x2b')];}_0x4ab14c['status'](_0x11d550)['send'](_0x26b93d);};}exports[_0x0aa9('0x2c')]=function(_0x3afaab,_0x1a3bae){var _0x3e9596={},_0x287495={},_0x5bd214={'count':0x0,'rows':[]};var _0x3afddb=_[_0x0aa9('0x2d')](db[_0x0aa9('0x2e')][_0x0aa9('0x2f')],function(_0x3020bd){return{'name':_0x3020bd['fieldName'],'type':_0x3020bd[_0x0aa9('0x30')][_0x0aa9('0x31')]};});_0x287495[_0x0aa9('0x32')]=_[_0x0aa9('0x2d')](_0x3afddb,_0x0aa9('0x2b'));_0x287495[_0x0aa9('0x33')]=_[_0x0aa9('0x34')](_0x3afaab['query']);_0x287495['filters']=_['intersection'](_0x287495[_0x0aa9('0x32')],_0x287495[_0x0aa9('0x33')]);_0x3e9596[_0x0aa9('0x35')]=_[_0x0aa9('0x36')](_0x287495[_0x0aa9('0x32')],qs[_0x0aa9('0x37')](_0x3afaab[_0x0aa9('0x33')][_0x0aa9('0x37')]));_0x3e9596[_0x0aa9('0x35')]=_0x3e9596[_0x0aa9('0x35')][_0x0aa9('0x38')]?_0x3e9596['attributes']:_0x287495[_0x0aa9('0x32')];if(!_0x3afaab[_0x0aa9('0x33')][_0x0aa9('0x39')](_0x0aa9('0x3a'))){_0x3e9596[_0x0aa9('0x1e')]=qs[_0x0aa9('0x1e')](_0x3afaab['query'][_0x0aa9('0x1e')]);_0x3e9596[_0x0aa9('0x1d')]=qs['offset'](_0x3afaab[_0x0aa9('0x33')][_0x0aa9('0x1d')]);}_0x3e9596[_0x0aa9('0x3b')]=qs['sort'](_0x3afaab[_0x0aa9('0x33')][_0x0aa9('0x3c')]);_0x3e9596[_0x0aa9('0x3d')]=qs[_0x0aa9('0x3e')](_[_0x0aa9('0x3f')](_0x3afaab['query'],_0x287495['filters']),_0x3afddb);if(_0x3afaab['query'][_0x0aa9('0x40')]){_0x3e9596['where']=_[_0x0aa9('0x41')](_0x3e9596['where'],{'$or':_[_0x0aa9('0x2d')](_0x3afddb,function(_0x4329a0){if(_0x4329a0[_0x0aa9('0x30')]!==_0x0aa9('0x42')){var _0x2d6110={};_0x2d6110[_0x4329a0[_0x0aa9('0x2b')]]={'$like':'%'+_0x3afaab[_0x0aa9('0x33')][_0x0aa9('0x40')]+'%'};return _0x2d6110;}})});}_0x3e9596=_[_0x0aa9('0x41')]({},_0x3e9596,_0x3afaab[_0x0aa9('0x43')]);var _0x238d17={'where':_0x3e9596[_0x0aa9('0x3d')]};return db[_0x0aa9('0x2e')][_0x0aa9('0x1f')](_0x238d17)[_0x0aa9('0x28')](function(_0x2f4615){_0x5bd214['count']=_0x2f4615;if(_0x3afaab[_0x0aa9('0x33')][_0x0aa9('0x44')]){_0x3e9596['include']=[{'all':!![]}];}return db[_0x0aa9('0x2e')][_0x0aa9('0x45')](_0x3e9596);})[_0x0aa9('0x28')](function(_0x542b72){_0x5bd214[_0x0aa9('0x46')]=_0x542b72;return _0x5bd214;})[_0x0aa9('0x28')](respondWithFilteredResult(_0x1a3bae,_0x3e9596))[_0x0aa9('0x47')](handleError(_0x1a3bae,null));};exports[_0x0aa9('0x48')]=function(_0x54c3c0,_0x5477e0){var _0x13b573={'raw':![],'where':{'id':_0x54c3c0[_0x0aa9('0x49')]['id']}},_0x3eeb53={};_0x3eeb53[_0x0aa9('0x32')]=_[_0x0aa9('0x34')](db[_0x0aa9('0x2e')][_0x0aa9('0x2f')]);_0x3eeb53['query']=_[_0x0aa9('0x34')](_0x54c3c0[_0x0aa9('0x33')]);_0x3eeb53[_0x0aa9('0x3e')]=_[_0x0aa9('0x36')](_0x3eeb53[_0x0aa9('0x32')],_0x3eeb53[_0x0aa9('0x33')]);_0x13b573[_0x0aa9('0x35')]=_[_0x0aa9('0x36')](_0x3eeb53[_0x0aa9('0x32')],qs[_0x0aa9('0x37')](_0x54c3c0[_0x0aa9('0x33')][_0x0aa9('0x37')]));_0x13b573[_0x0aa9('0x35')]=_0x13b573['attributes'][_0x0aa9('0x38')]?_0x13b573['attributes']:_0x3eeb53['model'];if(_0x54c3c0[_0x0aa9('0x33')][_0x0aa9('0x44')]){_0x13b573['include']=[{'all':!![]}];}_0x13b573=_[_0x0aa9('0x41')]({},_0x13b573,_0x54c3c0[_0x0aa9('0x43')]);return db[_0x0aa9('0x2e')]['find'](_0x13b573)['then'](handleEntityNotFound(_0x5477e0,null))[_0x0aa9('0x28')](respondWithResult(_0x5477e0,null))[_0x0aa9('0x47')](handleError(_0x5477e0,null));};exports[_0x0aa9('0x4a')]=function(_0x3455ab,_0x503f9c){return db[_0x0aa9('0x2e')][_0x0aa9('0x4a')](_0x3455ab[_0x0aa9('0x4b')],{})[_0x0aa9('0x28')](respondWithResult(_0x503f9c,0xc9))[_0x0aa9('0x47')](handleError(_0x503f9c,null));};exports[_0x0aa9('0x4c')]=function(_0x418007,_0x4ab1fe){return db[_0x0aa9('0x2e')][_0x0aa9('0x4c')](_0x418007[_0x0aa9('0x4b')],{'raw':![],'individualHooks':!![]})[_0x0aa9('0x28')](respondWithResult(_0x4ab1fe,0xc9))[_0x0aa9('0x47')](handleError(_0x4ab1fe,null));};exports['update']=function(_0x2450a6,_0x5c029d){if(_0x2450a6['body']['id']){delete _0x2450a6[_0x0aa9('0x4b')]['id'];}return db['AnalyticFieldReport'][_0x0aa9('0x4d')]({'where':{'id':_0x2450a6[_0x0aa9('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c029d,null))['then'](saveUpdates(_0x2450a6[_0x0aa9('0x4b')],null))['then'](respondWithResult(_0x5c029d,null))[_0x0aa9('0x47')](handleError(_0x5c029d,null));};exports[_0x0aa9('0x27')]=function(_0x225616,_0x4e37de){return db[_0x0aa9('0x2e')][_0x0aa9('0x4d')]({'where':{'id':_0x225616[_0x0aa9('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e37de,null))[_0x0aa9('0x28')](removeEntity(_0x4e37de,null))[_0x0aa9('0x47')](handleError(_0x4e37de,null));};exports['bulkDestroy']=function(_0x316119,_0x13471a){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x316119[_0x0aa9('0x33')][_0x0aa9('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x0aa9('0x28')](respondWithResult(_0x13471a,0xcc))[_0x0aa9('0x47')](handleError(_0x13471a,null));};exports[_0x0aa9('0x4f')]=function(_0x30ad53,_0x290976,_0xb171bc){return db[_0x0aa9('0x50')]['findOne']({'where':{'id':_0x30ad53[_0x0aa9('0x49')]['id']}})[_0x0aa9('0x28')](handleEntityNotFound(_0x290976,null))[_0x0aa9('0x28')](function(_0x5864e0){if(_0x5864e0){return db[_0x0aa9('0x51')]['transaction'](function(_0x270d28){return db[_0x0aa9('0x2e')][_0x0aa9('0x27')]({'where':{'CustomReportId':_0x30ad53['params']['id']},'transaction':_0x270d28})['then'](function(_0x1c69c7){var _0x56a510=_['map'](_0x30ad53[_0x0aa9('0x4b')],function(_0x14a2c6){delete _0x14a2c6['id'];_0x14a2c6['CustomReportId']=_0x30ad53[_0x0aa9('0x49')]['id'];return _0x14a2c6;});return db[_0x0aa9('0x2e')][_0x0aa9('0x4c')](_0x56a510,{'transaction':_0x270d28});});})[_0x0aa9('0x28')](function(){return db[_0x0aa9('0x2e')]['findAll']({'where':{'CustomReportId':_0x30ad53[_0x0aa9('0x49')]['id']}});});}})[_0x0aa9('0x28')](respondWithResult(_0x290976,null))['catch'](handleError(_0x290976,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 0363054..9f43b5a 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 _0xc80e=['analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport'];(function(_0x204b09,_0x309f2a){var _0x38508d=function(_0x18d6f5){while(--_0x18d6f5){_0x204b09['push'](_0x204b09['shift']());}};_0x38508d(++_0x309f2a);}(_0xc80e,0x15d));var _0xec80=function(_0xb2320d,_0xe69d49){_0xb2320d=_0xb2320d-0x0;var _0x9db91a=_0xc80e[_0xb2320d];return _0x9db91a;};'use strict';var _=require(_0xec80('0x0'));var util=require(_0xec80('0x1'));var logger=require(_0xec80('0x2'))(_0xec80('0x3'));var moment=require('moment');var BPromise=require(_0xec80('0x4'));var rp=require(_0xec80('0x5'));var fs=require('fs');var path=require(_0xec80('0x6'));var rimraf=require('rimraf');var config=require(_0xec80('0x7'));var attributes=require(_0xec80('0x8'));module[_0xec80('0x9')]=function(_0x315a4f,_0x240161){return _0x315a4f['define'](_0xec80('0xa'),attributes,{'tableName':_0xec80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3476=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x543628,_0x2261d0){var _0x12f69a=function(_0x21ebca){while(--_0x21ebca){_0x543628['push'](_0x543628['shift']());}};_0x12f69a(++_0x2261d0);}(_0x3476,0x8d));var _0x6347=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x3476[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0x6347('0x0'));var util=require(_0x6347('0x1'));var logger=require(_0x6347('0x2'))(_0x6347('0x3'));var moment=require(_0x6347('0x4'));var BPromise=require(_0x6347('0x5'));var rp=require(_0x6347('0x6'));var fs=require('fs');var path=require(_0x6347('0x7'));var rimraf=require(_0x6347('0x8'));var config=require(_0x6347('0x9'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x448ace,_0x3bbd08){return _0x448ace[_0x6347('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x6347('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index fff1b72..7b8b8ae 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 _0x7a20=['request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xfa4dad,_0x1ae1c9){var _0x454a6d=function(_0x46629d){while(--_0x46629d){_0xfa4dad['push'](_0xfa4dad['shift']());}};_0x454a6d(++_0x1ae1c9);}(_0x7a20,0x64));var _0x07a2=function(_0x39a51b,_0x29a07e){_0x39a51b=_0x39a51b-0x0;var _0x2e882f=_0x7a20[_0x39a51b];return _0x2e882f;};'use strict';var _=require(_0x07a2('0x0'));var util=require(_0x07a2('0x1'));var moment=require(_0x07a2('0x2'));var BPromise=require(_0x07a2('0x3'));var rs=require(_0x07a2('0x4'));var fs=require('fs');var Redis=require(_0x07a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x07a2('0x6'));var logger=require(_0x07a2('0x7'))(_0x07a2('0x8'));var config=require(_0x07a2('0x9'));var jayson=require(_0x07a2('0xa'));var client=jayson[_0x07a2('0xb')][_0x07a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa24d82,_0x33fb70,_0x504732){return new BPromise(function(_0xc7d28a,_0x27b64f){return client[_0x07a2('0xd')](_0xa24d82,_0x504732)[_0x07a2('0xe')](function(_0x525a9c){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x33fb70,_0x07a2('0xf'));logger['debug'](_0x07a2('0x10'),_0x33fb70,_0x07a2('0xf'),JSON[_0x07a2('0x11')](_0x525a9c));if(_0x525a9c[_0x07a2('0x12')]){if(_0x525a9c[_0x07a2('0x12')]['code']===0x1f4){logger[_0x07a2('0x12')](_0x07a2('0x13'),_0x33fb70,_0x525a9c['error'][_0x07a2('0x14')]);return _0x27b64f(_0x525a9c['error'][_0x07a2('0x14')]);}logger[_0x07a2('0x12')](_0x07a2('0x13'),_0x33fb70,_0x525a9c[_0x07a2('0x12')][_0x07a2('0x14')]);return _0xc7d28a(_0x525a9c['error']['message']);}else{logger[_0x07a2('0x15')](_0x07a2('0x13'),_0x33fb70,_0x07a2('0xf'));_0xc7d28a(_0x525a9c[_0x07a2('0x16')]['message']);}})['catch'](function(_0x4fa504){logger[_0x07a2('0x12')](_0x07a2('0x13'),_0x33fb70,_0x4fa504);_0x27b64f(_0x4fa504);});});} \ No newline at end of file +var _0x4f7d=['message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x35e768,_0xbe0d60){var _0x58cc5f=function(_0x1b12fb){while(--_0x1b12fb){_0x35e768['push'](_0x35e768['shift']());}};_0x58cc5f(++_0xbe0d60);}(_0x4f7d,0x1f1));var _0xd4f7=function(_0x27b920,_0x2d5b4e){_0x27b920=_0x27b920-0x0;var _0x37c55e=_0x4f7d[_0x27b920];return _0x37c55e;};'use strict';var _=require(_0xd4f7('0x0'));var util=require('util');var moment=require(_0xd4f7('0x1'));var BPromise=require(_0xd4f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd4f7('0x4'))('rpc');var config=require(_0xd4f7('0x5'));var jayson=require(_0xd4f7('0x6'));var client=jayson[_0xd4f7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48d64a,_0x2aa853,_0x1f7413){return new BPromise(function(_0x4b9852,_0xc0a275){return client[_0xd4f7('0x8')](_0x48d64a,_0x1f7413)[_0xd4f7('0x9')](function(_0x55ad16){logger[_0xd4f7('0xa')](_0xd4f7('0xb'),_0x2aa853,'request\x20sent');logger[_0xd4f7('0xc')](_0xd4f7('0xd'),_0x2aa853,'request\x20sent',JSON['stringify'](_0x55ad16));if(_0x55ad16[_0xd4f7('0xe')]){if(_0x55ad16[_0xd4f7('0xe')][_0xd4f7('0xf')]===0x1f4){logger['error'](_0xd4f7('0xb'),_0x2aa853,_0x55ad16[_0xd4f7('0xe')][_0xd4f7('0x10')]);return _0xc0a275(_0x55ad16[_0xd4f7('0xe')][_0xd4f7('0x10')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2aa853,_0x55ad16['error'][_0xd4f7('0x10')]);return _0x4b9852(_0x55ad16[_0xd4f7('0xe')][_0xd4f7('0x10')]);}else{logger[_0xd4f7('0xa')](_0xd4f7('0xb'),_0x2aa853,'request\x20sent');_0x4b9852(_0x55ad16[_0xd4f7('0x11')]['message']);}})[_0xd4f7('0x12')](function(_0x46ecce){logger[_0xd4f7('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2aa853,_0x46ecce);_0xc0a275(_0x46ecce);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 31fd7a8..ec71130 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(_0x2381d5,_0x430612){var _0x4d4e0e=function(_0x553673){while(--_0x553673){_0x2381d5['push'](_0x2381d5['shift']());}};_0x4d4e0e(++_0x430612);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x1b7395,_0x332d3a){var _0x449767=function(_0x494886){while(--_0x494886){_0x1b7395['push'](_0x1b7395['shift']());}};_0x449767(++_0x332d3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 b54864d..89fdd33 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 _0xa75b=['sequelize','name','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa75b,0x170));var _0xba75=function(_0x203a21,_0x274fa9){_0x203a21=_0x203a21-0x0;var _0x3ce90a=_0xa75b[_0x203a21];return _0x3ce90a;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xba75('0x1')},'table':{'type':Sequelize[_0xba75('0x2')]},'metric':{'type':Sequelize[_0xba75('0x3')]},'description':{'type':Sequelize[_0xba75('0x2')]}}; \ No newline at end of file +var _0x315f=['sequelize','STRING','TEXT'];(function(_0x5a595f,_0x8a7e1f){var _0x39b1a8=function(_0x288676){while(--_0x288676){_0x5a595f['push'](_0x5a595f['shift']());}};_0x39b1a8(++_0x8a7e1f);}(_0x315f,0x174));var _0xf315=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0x315f[_0x7a112];return _0x136dc5;};'use strict';var Sequelize=require(_0xf315('0x0'));module['exports']={'name':{'type':Sequelize[_0xf315('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xf315('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7d38114..52a20eb 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(_0x16669a,_0x168e42){var _0x3db0b7=function(_0x4a5893){while(--_0x4a5893){_0x16669a['push'](_0x16669a['shift']());}};_0x3db0b7(++_0x168e42);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x26b1b8,_0x35bfd4){_0x26b1b8=_0x26b1b8-0x0;var _0x401762=_0x7fbe[_0x26b1b8];return _0x401762;};'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 _0x8d0e=['then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','send','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy'];(function(_0x220720,_0x10d6b4){var _0x20f9a7=function(_0xfd086c){while(--_0xfd086c){_0x220720['push'](_0x220720['shift']());}};_0x20f9a7(++_0x10d6b4);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2de683,_0x176de1){_0x2de683=_0x2de683-0x0;var _0x3b962c=_0x8d0e[_0x2de683];return _0x3b962c;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){var _0xd86c76=_0x106614[_0xe8d0('0x28')]({'plain':!![]});var _0x149dfd=_0xe8d0('0x29');return db[_0xe8d0('0x2a')][_0xe8d0('0x26')]({'where':{'type':_0x149dfd,'resourceId':_0xd86c76['id']}})[_0xe8d0('0x27')](function(){return _0x106614;});})[_0xe8d0('0x27')](function(){_0x9f747['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0x26dd52,_0x10dec2){return function(_0x486f49){if(!_0x486f49){_0x26dd52[_0xe8d0('0x2c')](0x194);}return _0x486f49;};}function handleError(_0x343b08,_0x526240){_0x526240=_0x526240||0x1f4;return function(_0x1519e2){logger[_0xe8d0('0x2d')](_0x1519e2[_0xe8d0('0x2e')]);if(_0x1519e2[_0xe8d0('0x2f')]){delete _0x1519e2[_0xe8d0('0x2f')];}_0x343b08['status'](_0x526240)[_0xe8d0('0x30')](_0x1519e2);};}exports['index']=function(_0x5d3276,_0x50ad3c){var _0x547a2b={},_0x13cd4c={},_0x36ccec={'count':0x0,'rows':[]};var _0x5151fa=_['map'](db[_0xe8d0('0x31')]['rawAttributes'],function(_0x3b5d31){return{'name':_0x3b5d31[_0xe8d0('0x32')],'type':_0x3b5d31[_0xe8d0('0x33')][_0xe8d0('0x34')]};});_0x13cd4c[_0xe8d0('0x35')]=_['map'](_0x5151fa,_0xe8d0('0x2f'));_0x13cd4c[_0xe8d0('0x36')]=_[_0xe8d0('0x37')](_0x5d3276[_0xe8d0('0x36')]);_0x13cd4c['filters']=_[_0xe8d0('0x38')](_0x13cd4c[_0xe8d0('0x35')],_0x13cd4c['query']);_0x547a2b[_0xe8d0('0x39')]=_['intersection'](_0x13cd4c[_0xe8d0('0x35')],qs['fields'](_0x5d3276[_0xe8d0('0x36')]['fields']));_0x547a2b[_0xe8d0('0x39')]=_0x547a2b[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x547a2b[_0xe8d0('0x39')]:_0x13cd4c['model'];if(!_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x547a2b['limit']=qs[_0xe8d0('0x1e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x1e')]);_0x547a2b[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x5d3276['query'][_0xe8d0('0x1f')]);}_0x547a2b[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3e')]);_0x547a2b[_0xe8d0('0x3f')]=qs[_0xe8d0('0x40')](_[_0xe8d0('0x41')](_0x5d3276['query'],_0x13cd4c['filters']),_0x5151fa);if(_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x42')]){_0x547a2b[_0xe8d0('0x3f')]=_[_0xe8d0('0x43')](_0x547a2b[_0xe8d0('0x3f')],{'$or':_['map'](_0x5151fa,function(_0x2e4362){if(_0x2e4362['type']!==_0xe8d0('0x44')){var _0x458294={};_0x458294[_0x2e4362[_0xe8d0('0x2f')]]={'$like':'%'+_0x5d3276['query'][_0xe8d0('0x42')]+'%'};return _0x458294;}})});}_0x547a2b=_[_0xe8d0('0x43')]({},_0x547a2b,_0x5d3276[_0xe8d0('0x45')]);var _0x230a90={'where':_0x547a2b[_0xe8d0('0x3f')]};return db['AnalyticMetric']['count'](_0x230a90)['then'](function(_0x4cf0da){_0x36ccec[_0xe8d0('0x20')]=_0x4cf0da;if(_0x5d3276['query'][_0xe8d0('0x46')]){_0x547a2b[_0xe8d0('0x47')]=[{'all':!![]}];}return db[_0xe8d0('0x31')][_0xe8d0('0x48')](_0x547a2b);})[_0xe8d0('0x27')](function(_0x1156da){_0x36ccec[_0xe8d0('0x49')]=_0x1156da;return _0x36ccec;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x50ad3c,_0x547a2b))['catch'](handleError(_0x50ad3c,null));};exports[_0xe8d0('0x4a')]=function(_0x1da8b2,_0x4a3740){var _0x4bcdff={'raw':!![],'where':{'id':_0x1da8b2[_0xe8d0('0x4b')]['id']}},_0x3825a1={};_0x3825a1[_0xe8d0('0x35')]=_['keys'](db[_0xe8d0('0x31')][_0xe8d0('0x4c')]);_0x3825a1['query']=_[_0xe8d0('0x37')](_0x1da8b2[_0xe8d0('0x36')]);_0x3825a1['filters']=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],_0x3825a1[_0xe8d0('0x36')]);_0x4bcdff[_0xe8d0('0x39')]=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],qs[_0xe8d0('0x4d')](_0x1da8b2[_0xe8d0('0x36')]['fields']));_0x4bcdff[_0xe8d0('0x39')]=_0x4bcdff[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x4bcdff[_0xe8d0('0x39')]:_0x3825a1[_0xe8d0('0x35')];if(_0x1da8b2[_0xe8d0('0x36')][_0xe8d0('0x46')]){_0x4bcdff[_0xe8d0('0x47')]=[{'all':!![]}];}_0x4bcdff=_[_0xe8d0('0x43')]({},_0x4bcdff,_0x1da8b2[_0xe8d0('0x45')]);return db[_0xe8d0('0x31')][_0xe8d0('0x4e')](_0x4bcdff)['then'](handleEntityNotFound(_0x4a3740,null))[_0xe8d0('0x27')](respondWithResult(_0x4a3740,null))[_0xe8d0('0x4f')](handleError(_0x4a3740,null));};exports[_0xe8d0('0x50')]=function(_0xad7d94,_0x34047c){return db[_0xe8d0('0x31')][_0xe8d0('0x50')](_0xad7d94['body'],{})[_0xe8d0('0x27')](function(_0x424764){var _0x151cf4=_0xad7d94[_0xe8d0('0x51')]['get']({'plain':!![]});if(!_0x151cf4)throw new Error(_0xe8d0('0x52'));if(_0x151cf4['role']===_0xe8d0('0x51')){var _0x382ae9=_0x424764[_0xe8d0('0x28')]({'plain':!![]});var _0x158d24=_0xe8d0('0x29');return db[_0xe8d0('0x53')][_0xe8d0('0x4e')]({'where':{'name':_0x158d24,'userProfileId':_0x151cf4['userProfileId']},'raw':!![]})[_0xe8d0('0x27')](function(_0x55f93d){if(_0x55f93d&&_0x55f93d['autoAssociation']===0x0){return db[_0xe8d0('0x2a')]['create']({'name':_0x382ae9[_0xe8d0('0x2f')],'resourceId':_0x382ae9['id'],'type':_0x55f93d['name'],'sectionId':_0x55f93d['id']},{})[_0xe8d0('0x27')](function(){return _0x424764;});}else{return _0x424764;}})[_0xe8d0('0x4f')](function(_0x13713c){logger[_0xe8d0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13713c);throw _0x13713c;});}return _0x424764;})[_0xe8d0('0x27')](respondWithResult(_0x34047c,0xc9))[_0xe8d0('0x4f')](handleError(_0x34047c,null));};exports[_0xe8d0('0x25')]=function(_0x2e3f1d,_0x18cc14){if(_0x2e3f1d['body']['id']){delete _0x2e3f1d[_0xe8d0('0x54')]['id'];}return db[_0xe8d0('0x31')][_0xe8d0('0x4e')]({'where':{'id':_0x2e3f1d['params']['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x18cc14,null))['then'](saveUpdates(_0x2e3f1d['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x18cc14,null))[_0xe8d0('0x4f')](handleError(_0x18cc14,null));};exports['destroy']=function(_0xcb6ce2,_0x3a8074){return db['AnalyticMetric'][_0xe8d0('0x4e')]({'where':{'id':_0xcb6ce2[_0xe8d0('0x4b')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x3a8074,null))[_0xe8d0('0x27')](removeEntity(_0x3a8074,null))['catch'](handleError(_0x3a8074,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 37d4756..16a3bd3 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 _0x302c=['moment','path','rimraf','../../config/environment','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0x302c,0x15c));var _0xc302=function(_0x1fb2c6,_0x4a5110){_0x1fb2c6=_0x1fb2c6-0x0;var _0x187e7f=_0x302c[_0x1fb2c6];return _0x187e7f;};'use strict';var _=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var logger=require(_0xc302('0x2'))(_0xc302('0x3'));var moment=require(_0xc302('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc302('0x5'));var rimraf=require(_0xc302('0x6'));var config=require(_0xc302('0x7'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x13139e,_0x59ba1e){return _0x13139e[_0xc302('0x8')](_0xc302('0x9'),attributes,{'tableName':_0xc302('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2c8=['exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x31df10,_0x312458){var _0x3ce6e8=function(_0x187ea0){while(--_0x187ea0){_0x31df10['push'](_0x31df10['shift']());}};_0x3ce6e8(++_0x312458);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var logger=require(_0x8a2c('0x2'))(_0x8a2c('0x3'));var moment=require(_0x8a2c('0x4'));var BPromise=require(_0x8a2c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a2c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x8a2c('0x7')]=function(_0x40fb26,_0x3f754a){return _0x40fb26[_0x8a2c('0x8')]('AnalyticMetric',attributes,{'tableName':_0x8a2c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 0c55aaa..a032ab6 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 _0x2aa9=['../../config/logger','rpc','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x2aa9,0x18a));var _0x92aa=function(_0x305753,_0x299ca1){_0x305753=_0x305753-0x0;var _0x3ad6ff=_0x2aa9[_0x305753];return _0x3ad6ff;};'use strict';var _=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var moment=require(_0x92aa('0x2'));var BPromise=require(_0x92aa('0x3'));var rs=require(_0x92aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x92aa('0x6'))(_0x92aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x92aa('0x8')][_0x92aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x486b33,_0x7655b7,_0x3a0ec5){return new BPromise(function(_0x60d396,_0x361f52){return client['request'](_0x486b33,_0x3a0ec5)[_0x92aa('0xa')](function(_0x27b665){logger[_0x92aa('0xb')](_0x92aa('0xc'),_0x7655b7,_0x92aa('0xd'));logger[_0x92aa('0xe')](_0x92aa('0xf'),_0x7655b7,_0x92aa('0xd'),JSON[_0x92aa('0x10')](_0x27b665));if(_0x27b665['error']){if(_0x27b665[_0x92aa('0x11')]['code']===0x1f4){logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x27b665['error'][_0x92aa('0x12')]);return _0x361f52(_0x27b665[_0x92aa('0x11')][_0x92aa('0x12')]);}logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x27b665['error'][_0x92aa('0x12')]);return _0x60d396(_0x27b665[_0x92aa('0x11')][_0x92aa('0x12')]);}else{logger[_0x92aa('0xb')](_0x92aa('0xc'),_0x7655b7,_0x92aa('0xd'));_0x60d396(_0x27b665['result']['message']);}})[_0x92aa('0x13')](function(_0x35e1aa){logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x35e1aa);_0x361f52(_0x35e1aa);});});} \ No newline at end of file +var _0xa99e=['message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s'];(function(_0x3302e4,_0x56c7c7){var _0x2a1a12=function(_0x1fb13b){while(--_0x1fb13b){_0x3302e4['push'](_0x3302e4['shift']());}};_0x2a1a12(++_0x56c7c7);}(_0xa99e,0x192));var _0xea99=function(_0x4db382,_0x148b4a){_0x4db382=_0x4db382-0x0;var _0x589490=_0xa99e[_0x4db382];return _0x589490;};'use strict';var _=require(_0xea99('0x0'));var util=require(_0xea99('0x1'));var moment=require(_0xea99('0x2'));var BPromise=require(_0xea99('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea99('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea99('0x5'));var logger=require('../../config/logger')(_0xea99('0x6'));var config=require('../../config/environment');var jayson=require(_0xea99('0x7'));var client=jayson[_0xea99('0x8')][_0xea99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c8381,_0x41c0d9,_0x4d5158){return new BPromise(function(_0x1bb6c0,_0x1d15ec){return client[_0xea99('0xa')](_0x4c8381,_0x4d5158)['then'](function(_0x3ed57d){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x41c0d9,_0xea99('0xb'));logger['debug'](_0xea99('0xc'),_0x41c0d9,'request\x20sent',JSON[_0xea99('0xd')](_0x3ed57d));if(_0x3ed57d['error']){if(_0x3ed57d['error']['code']===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x41c0d9,_0x3ed57d['error']['message']);return _0x1d15ec(_0x3ed57d[_0xea99('0xe')]['message']);}logger[_0xea99('0xe')](_0xea99('0xf'),_0x41c0d9,_0x3ed57d['error'][_0xea99('0x10')]);return _0x1bb6c0(_0x3ed57d['error']['message']);}else{logger[_0xea99('0x11')](_0xea99('0xf'),_0x41c0d9,'request\x20sent');_0x1bb6c0(_0x3ed57d[_0xea99('0x12')][_0xea99('0x10')]);}})['catch'](function(_0xdde944){logger[_0xea99('0xe')](_0xea99('0xf'),_0x41c0d9,_0xdde944);_0x1d15ec(_0xdde944);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 218b450..2f0bec9 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 _0x5fd1=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy'];(function(_0x568172,_0x173414){var _0xda2d46=function(_0x2f2a03){while(--_0x2f2a03){_0x568172['push'](_0x568172['shift']());}};_0xda2d46(++_0x173414);}(_0x5fd1,0x155));var _0x15fd=function(_0x2fa263,_0x38401e){_0x2fa263=_0x2fa263-0x0;var _0x13f4ea=_0x5fd1[_0x2fa263];return _0x13f4ea;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./analyticMetric.controller');router[_0x15fd('0x7')]('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0x9')]);router[_0x15fd('0x7')](_0x15fd('0xa'),auth['isAuthenticated'](),controller[_0x15fd('0xb')]);router[_0x15fd('0xc')]('/',auth[_0x15fd('0x8')](),controller['create']);router[_0x15fd('0xd')]('/:id',auth[_0x15fd('0x8')](),controller[_0x15fd('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xf')]);module[_0x15fd('0x10')]=router; \ No newline at end of file +var _0x423b=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','Router','../../config/environment','./analyticMetric.controller'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0x423b,0x12b));var _0xb423=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x423b[_0x44bcb0];return _0xfaf881;};'use strict';var multer=require('multer');var util=require(_0xb423('0x0'));var path=require('path');var timeout=require(_0xb423('0x1'));var express=require('express');var router=express[_0xb423('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb423('0x3'));var controller=require(_0xb423('0x4'));router['get']('/',auth[_0xb423('0x5')](),controller[_0xb423('0x6')]);router[_0xb423('0x7')](_0xb423('0x8'),auth['isAuthenticated'](),controller[_0xb423('0x9')]);router[_0xb423('0xa')]('/',auth[_0xb423('0x5')](),controller[_0xb423('0xb')]);router[_0xb423('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb423('0xd')]);router[_0xb423('0xe')](_0xb423('0x8'),auth[_0xb423('0x5')](),controller[_0xb423('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 4f392eb..d4b50a6 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 _0x16c1=['sequelize','exports','TEXT'];(function(_0x48f85a,_0x1efd94){var _0x1bd655=function(_0x1a800d){while(--_0x1a800d){_0x48f85a['push'](_0x48f85a['shift']());}};_0x1bd655(++_0x1efd94);}(_0x16c1,0x66));var _0x116c=function(_0x46b079,_0x55b2bb){_0x46b079=_0x46b079-0x0;var _0x5c2a9f=_0x16c1[_0x46b079];return _0x5c2a9f;};'use strict';var Sequelize=require(_0x116c('0x0'));module[_0x116c('0x1')]={'tree':{'type':Sequelize[_0x116c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xeda6=['sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeda6,0xa3));var _0x6eda=function(_0x45030a,_0x4d1f2e){_0x45030a=_0x45030a-0x0;var _0x5bba0c=_0xeda6[_0x45030a];return _0x5bba0c;};'use strict';var Sequelize=require(_0x6eda('0x0'));module['exports']={'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 e399166..143e5bf 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 _0xb10f=['sox','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','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','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb10f,0x160));var _0xfb10=function(_0x551e5,_0x107952){_0x551e5=_0x551e5-0x0;var _0x2b6288=_0xb10f[_0x551e5];return _0x2b6288;};'use strict';var emlformat=require(_0xfb10('0x0'));var rimraf=require(_0xfb10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb10('0x2'));var rp=require('request-promise');var moment=require(_0xfb10('0x3'));var BPromise=require(_0xfb10('0x4'));var Mustache=require(_0xfb10('0x5'));var util=require(_0xfb10('0x6'));var path=require(_0xfb10('0x7'));var sox=require(_0xfb10('0x8'));var csv=require(_0xfb10('0x9'));var ejs=require(_0xfb10('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfb10('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfb10('0xc'));var toCsv=require(_0xfb10('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb10('0xd'));var authService=require(_0xfb10('0xe'));var qs=require(_0xfb10('0xf'));var as=require(_0xfb10('0x10'));var hardwareService=require(_0xfb10('0x11'));var logger=require('../../config/logger')(_0xfb10('0x12'));var utils=require(_0xfb10('0x13'));var config=require(_0xfb10('0x14'));var licenseUtil=require(_0xfb10('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x517e1e,_0x3df9ac){_0x3df9ac=_0x3df9ac||0xcc;return function(_0x3fe5b8){if(_0x3fe5b8){return _0x517e1e[_0xfb10('0x16')](_0x3df9ac);}return _0x517e1e[_0xfb10('0x17')](_0x3df9ac)[_0xfb10('0x18')]();};}function respondWithResult(_0x187ab8,_0x5b70b3){_0x5b70b3=_0x5b70b3||0xc8;return function(_0x436cb5){if(_0x436cb5){return _0x187ab8[_0xfb10('0x17')](_0x5b70b3)['json'](_0x436cb5);}};}function respondWithFilteredResult(_0x59e321,_0x3852bf){return function(_0x4cdb94){if(_0x4cdb94){var _0x3eb1d2=typeof _0x3852bf[_0xfb10('0x19')]===_0xfb10('0x1a')&&typeof _0x3852bf[_0xfb10('0x1b')]===_0xfb10('0x1a');var _0x456849=_0x4cdb94[_0xfb10('0x1c')];var _0x43b19b=_0x3eb1d2?0x0:_0x3852bf[_0xfb10('0x19')];var _0x4cf7bc=_0x3eb1d2?_0x4cdb94[_0xfb10('0x1c')]:_0x3852bf[_0xfb10('0x19')]+_0x3852bf[_0xfb10('0x1b')];var _0x573725;if(_0x4cf7bc>=_0x456849){_0x4cf7bc=_0x456849;_0x573725=0xc8;}else{_0x573725=0xce;}_0x59e321[_0xfb10('0x17')](_0x573725);return _0x59e321[_0xfb10('0x1d')](_0xfb10('0x1e'),_0x43b19b+'-'+_0x4cf7bc+'/'+_0x456849)[_0xfb10('0x1f')](_0x4cdb94);}return null;};}function patchUpdates(_0x243dc9){return function(_0x583bbd){try{jsonpatch[_0xfb10('0x20')](_0x583bbd,_0x243dc9,!![]);}catch(_0x1566d3){return BPromise[_0xfb10('0x21')](_0x1566d3);}return _0x583bbd[_0xfb10('0x22')]();};}function saveUpdates(_0x50a4af,_0x2c2315){return function(_0x546372){if(_0x546372){return _0x546372[_0xfb10('0x23')](_0x50a4af)[_0xfb10('0x24')](function(_0x8e2d70){return _0x8e2d70;});}return null;};}function removeEntity(_0x5a1062,_0x5f1a90){return function(_0x5347f0){if(_0x5347f0){return _0x5347f0[_0xfb10('0x25')]()[_0xfb10('0x24')](function(){_0x5a1062[_0xfb10('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ddf2,_0x1ff69e){return function(_0x445fc6){if(!_0x445fc6){_0x30ddf2[_0xfb10('0x16')](0x194);}return _0x445fc6;};}function handleError(_0xdd1ee0,_0x1246bf){_0x1246bf=_0x1246bf||0x1f4;return function(_0x49ca50){logger[_0xfb10('0x26')](_0x49ca50[_0xfb10('0x27')]);if(_0x49ca50[_0xfb10('0x28')]){delete _0x49ca50[_0xfb10('0x28')];}_0xdd1ee0[_0xfb10('0x17')](_0x1246bf)[_0xfb10('0x29')](_0x49ca50);};}exports[_0xfb10('0x2a')]=function(_0x2d4caf,_0x36735e){var _0x2cb4c0={},_0x583a70={},_0x2c054d={'count':0x0,'rows':[]};var _0x495b58=_['map'](db[_0xfb10('0x2b')][_0xfb10('0x2c')],function(_0x145d98){return{'name':_0x145d98[_0xfb10('0x2d')],'type':_0x145d98[_0xfb10('0x2e')][_0xfb10('0x2f')]};});_0x583a70[_0xfb10('0x30')]=_[_0xfb10('0x31')](_0x495b58,_0xfb10('0x28'));_0x583a70[_0xfb10('0x32')]=_[_0xfb10('0x33')](_0x2d4caf[_0xfb10('0x32')]);_0x583a70[_0xfb10('0x34')]=_['intersection'](_0x583a70[_0xfb10('0x30')],_0x583a70[_0xfb10('0x32')]);_0x2cb4c0['attributes']=_[_0xfb10('0x35')](_0x583a70[_0xfb10('0x30')],qs['fields'](_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x36')]));_0x2cb4c0['attributes']=_0x2cb4c0[_0xfb10('0x37')][_0xfb10('0x38')]?_0x2cb4c0[_0xfb10('0x37')]:_0x583a70[_0xfb10('0x30')];if(!_0x2d4caf['query']['hasOwnProperty'](_0xfb10('0x39'))){_0x2cb4c0['limit']=qs[_0xfb10('0x1b')](_0x2d4caf['query']['limit']);_0x2cb4c0[_0xfb10('0x19')]=qs[_0xfb10('0x19')](_0x2d4caf['query'][_0xfb10('0x19')]);}_0x2cb4c0['order']=qs['sort'](_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x3a')]);_0x2cb4c0[_0xfb10('0x3b')]=qs[_0xfb10('0x34')](_['pick'](_0x2d4caf[_0xfb10('0x32')],_0x583a70[_0xfb10('0x34')]),_0x495b58);if(_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x3c')]){_0x2cb4c0[_0xfb10('0x3b')]=_[_0xfb10('0x3d')](_0x2cb4c0[_0xfb10('0x3b')],{'$or':_[_0xfb10('0x31')](_0x495b58,function(_0x54976e){if(_0x54976e[_0xfb10('0x2e')]!=='VIRTUAL'){var _0x38575d={};_0x38575d[_0x54976e[_0xfb10('0x28')]]={'$like':'%'+_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x3c')]+'%'};return _0x38575d;}})});}_0x2cb4c0=_[_0xfb10('0x3d')]({},_0x2cb4c0,_0x2d4caf[_0xfb10('0x3e')]);var _0x451d4f={'where':_0x2cb4c0['where']};return db[_0xfb10('0x2b')][_0xfb10('0x1c')](_0x451d4f)[_0xfb10('0x24')](function(_0x587e2e){_0x2c054d[_0xfb10('0x1c')]=_0x587e2e;if(_0x2d4caf['query'][_0xfb10('0x3f')]){_0x2cb4c0[_0xfb10('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xfb10('0x41')](_0x2cb4c0);})['then'](function(_0x531360){_0x2c054d[_0xfb10('0x42')]=_0x531360;return _0x2c054d;})[_0xfb10('0x24')](respondWithFilteredResult(_0x36735e,_0x2cb4c0))[_0xfb10('0x43')](handleError(_0x36735e,null));};exports['show']=function(_0x996047,_0x51804f){var _0x1f84bd={'raw':!![],'where':{'id':_0x996047[_0xfb10('0x44')]['id']}},_0xea909e={};_0xea909e['model']=_[_0xfb10('0x33')](db[_0xfb10('0x2b')]['rawAttributes']);_0xea909e[_0xfb10('0x32')]=_[_0xfb10('0x33')](_0x996047[_0xfb10('0x32')]);_0xea909e[_0xfb10('0x34')]=_[_0xfb10('0x35')](_0xea909e[_0xfb10('0x30')],_0xea909e[_0xfb10('0x32')]);_0x1f84bd[_0xfb10('0x37')]=_[_0xfb10('0x35')](_0xea909e[_0xfb10('0x30')],qs['fields'](_0x996047[_0xfb10('0x32')][_0xfb10('0x36')]));_0x1f84bd[_0xfb10('0x37')]=_0x1f84bd['attributes'][_0xfb10('0x38')]?_0x1f84bd[_0xfb10('0x37')]:_0xea909e[_0xfb10('0x30')];if(_0x996047[_0xfb10('0x32')][_0xfb10('0x3f')]){_0x1f84bd[_0xfb10('0x40')]=[{'all':!![]}];}_0x1f84bd=_['merge']({},_0x1f84bd,_0x996047[_0xfb10('0x3e')]);return db[_0xfb10('0x2b')][_0xfb10('0x45')](_0x1f84bd)['then'](handleEntityNotFound(_0x51804f,null))[_0xfb10('0x24')](respondWithResult(_0x51804f,null))['catch'](handleError(_0x51804f,null));};exports[_0xfb10('0x46')]=function(_0x52a15b,_0x46d854){return db[_0xfb10('0x2b')][_0xfb10('0x46')](_0x52a15b['body'],{})[_0xfb10('0x24')](respondWithResult(_0x46d854,0xc9))[_0xfb10('0x43')](handleError(_0x46d854,null));};exports[_0xfb10('0x23')]=function(_0x1fdbc7,_0x423d52){if(_0x1fdbc7[_0xfb10('0x47')]['id']){delete _0x1fdbc7[_0xfb10('0x47')]['id'];}return db[_0xfb10('0x2b')]['find']({'where':{'id':_0x1fdbc7[_0xfb10('0x44')]['id']}})[_0xfb10('0x24')](handleEntityNotFound(_0x423d52,null))[_0xfb10('0x24')](saveUpdates(_0x1fdbc7[_0xfb10('0x47')],null))[_0xfb10('0x24')](respondWithResult(_0x423d52,null))[_0xfb10('0x43')](handleError(_0x423d52,null));};exports['destroy']=function(_0x56c770,_0x502b62){return db[_0xfb10('0x2b')][_0xfb10('0x45')]({'where':{'id':_0x56c770[_0xfb10('0x44')]['id']}})[_0xfb10('0x24')](handleEntityNotFound(_0x502b62,null))['then'](removeEntity(_0x502b62,null))[_0xfb10('0x43')](handleError(_0x502b62,null));}; \ No newline at end of file +var _0x58ca=['count','set','apply','reject','save','update','then','end','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','AnalyticTreeReport','length','options','find','create','body','destroy','eml-format','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit'];(function(_0x22696a,_0x214fd1){var _0x48b6c4=function(_0x3653b0){while(--_0x3653b0){_0x22696a['push'](_0x22696a['shift']());}};_0x48b6c4(++_0x214fd1);}(_0x58ca,0xff));var _0xa58c=function(_0x1e855f,_0x326f9c){_0x1e855f=_0x1e855f-0x0;var _0x1069b9=_0x58ca[_0x1e855f];return _0x1069b9;};'use strict';var emlformat=require(_0xa58c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa58c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa58c('0x2'));var moment=require(_0xa58c('0x3'));var BPromise=require(_0xa58c('0x4'));var Mustache=require('mustache');var util=require(_0xa58c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa58c('0x6'));var ejs=require(_0xa58c('0x7'));var fs=require('fs');var fs_extra=require(_0xa58c('0x8'));var _=require(_0xa58c('0x9'));var squel=require(_0xa58c('0xa'));var crypto=require(_0xa58c('0xb'));var jsforce=require(_0xa58c('0xc'));var deskjs=require(_0xa58c('0xd'));var toCsv=require(_0xa58c('0x6'));var querystring=require(_0xa58c('0xe'));var Papa=require(_0xa58c('0xf'));var Redis=require(_0xa58c('0x10'));var authService=require(_0xa58c('0x11'));var qs=require(_0xa58c('0x12'));var as=require(_0xa58c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa58c('0x14'))(_0xa58c('0x15'));var utils=require(_0xa58c('0x16'));var config=require(_0xa58c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa58c('0x18'))['db'];function respondWithStatusCode(_0x5b8e01,_0x365484){_0x365484=_0x365484||0xcc;return function(_0x13919e){if(_0x13919e){return _0x5b8e01['sendStatus'](_0x365484);}return _0x5b8e01[_0xa58c('0x19')](_0x365484)['end']();};}function respondWithResult(_0x32ab5d,_0x3e381e){_0x3e381e=_0x3e381e||0xc8;return function(_0x51cf81){if(_0x51cf81){return _0x32ab5d['status'](_0x3e381e)[_0xa58c('0x1a')](_0x51cf81);}};}function respondWithFilteredResult(_0x306752,_0x5b7907){return function(_0x4cda22){if(_0x4cda22){var _0x128b98=typeof _0x5b7907[_0xa58c('0x1b')]==='undefined'&&typeof _0x5b7907[_0xa58c('0x1c')]==='undefined';var _0x485e38=_0x4cda22[_0xa58c('0x1d')];var _0x1f8ccd=_0x128b98?0x0:_0x5b7907[_0xa58c('0x1b')];var _0x375319=_0x128b98?_0x4cda22[_0xa58c('0x1d')]:_0x5b7907[_0xa58c('0x1b')]+_0x5b7907[_0xa58c('0x1c')];var _0x2e9490;if(_0x375319>=_0x485e38){_0x375319=_0x485e38;_0x2e9490=0xc8;}else{_0x2e9490=0xce;}_0x306752[_0xa58c('0x19')](_0x2e9490);return _0x306752[_0xa58c('0x1e')]('Content-Range',_0x1f8ccd+'-'+_0x375319+'/'+_0x485e38)[_0xa58c('0x1a')](_0x4cda22);}return null;};}function patchUpdates(_0x5a44b9){return function(_0x42733d){try{jsonpatch[_0xa58c('0x1f')](_0x42733d,_0x5a44b9,!![]);}catch(_0x4808c2){return BPromise[_0xa58c('0x20')](_0x4808c2);}return _0x42733d[_0xa58c('0x21')]();};}function saveUpdates(_0x2314be,_0x13c4a4){return function(_0x3bc1aa){if(_0x3bc1aa){return _0x3bc1aa[_0xa58c('0x22')](_0x2314be)[_0xa58c('0x23')](function(_0x42251d){return _0x42251d;});}return null;};}function removeEntity(_0x44126e,_0x6e61df){return function(_0x56c25d){if(_0x56c25d){return _0x56c25d['destroy']()[_0xa58c('0x23')](function(){_0x44126e[_0xa58c('0x19')](0xcc)[_0xa58c('0x24')]();});}};}function handleEntityNotFound(_0x56811f,_0x3f0495){return function(_0x1fac05){if(!_0x1fac05){_0x56811f['sendStatus'](0x194);}return _0x1fac05;};}function handleError(_0x9ebed2,_0x3b38bc){_0x3b38bc=_0x3b38bc||0x1f4;return function(_0x1c43c5){logger[_0xa58c('0x25')](_0x1c43c5[_0xa58c('0x26')]);if(_0x1c43c5[_0xa58c('0x27')]){delete _0x1c43c5[_0xa58c('0x27')];}_0x9ebed2['status'](_0x3b38bc)['send'](_0x1c43c5);};}exports[_0xa58c('0x28')]=function(_0x3f41c1,_0x552cd0){var _0x4f89f7={},_0x379cbb={},_0x52ea3a={'count':0x0,'rows':[]};var _0xe5714a=_[_0xa58c('0x29')](db['AnalyticTreeReport'][_0xa58c('0x2a')],function(_0x5100e2){return{'name':_0x5100e2['fieldName'],'type':_0x5100e2[_0xa58c('0x2b')][_0xa58c('0x2c')]};});_0x379cbb[_0xa58c('0x2d')]=_[_0xa58c('0x29')](_0xe5714a,'name');_0x379cbb[_0xa58c('0x2e')]=_[_0xa58c('0x2f')](_0x3f41c1['query']);_0x379cbb[_0xa58c('0x30')]=_[_0xa58c('0x31')](_0x379cbb[_0xa58c('0x2d')],_0x379cbb['query']);_0x4f89f7[_0xa58c('0x32')]=_['intersection'](_0x379cbb[_0xa58c('0x2d')],qs['fields'](_0x3f41c1[_0xa58c('0x2e')][_0xa58c('0x33')]));_0x4f89f7['attributes']=_0x4f89f7['attributes']['length']?_0x4f89f7[_0xa58c('0x32')]:_0x379cbb[_0xa58c('0x2d')];if(!_0x3f41c1[_0xa58c('0x2e')]['hasOwnProperty'](_0xa58c('0x34'))){_0x4f89f7[_0xa58c('0x1c')]=qs[_0xa58c('0x1c')](_0x3f41c1[_0xa58c('0x2e')][_0xa58c('0x1c')]);_0x4f89f7['offset']=qs[_0xa58c('0x1b')](_0x3f41c1['query']['offset']);}_0x4f89f7[_0xa58c('0x35')]=qs[_0xa58c('0x36')](_0x3f41c1['query'][_0xa58c('0x36')]);_0x4f89f7[_0xa58c('0x37')]=qs[_0xa58c('0x30')](_['pick'](_0x3f41c1[_0xa58c('0x2e')],_0x379cbb['filters']),_0xe5714a);if(_0x3f41c1[_0xa58c('0x2e')][_0xa58c('0x38')]){_0x4f89f7[_0xa58c('0x37')]=_[_0xa58c('0x39')](_0x4f89f7[_0xa58c('0x37')],{'$or':_['map'](_0xe5714a,function(_0x45e1e1){if(_0x45e1e1['type']!=='VIRTUAL'){var _0x3ddd86={};_0x3ddd86[_0x45e1e1[_0xa58c('0x27')]]={'$like':'%'+_0x3f41c1['query'][_0xa58c('0x38')]+'%'};return _0x3ddd86;}})});}_0x4f89f7=_['merge']({},_0x4f89f7,_0x3f41c1['options']);var _0x4a1544={'where':_0x4f89f7[_0xa58c('0x37')]};return db['AnalyticTreeReport'][_0xa58c('0x1d')](_0x4a1544)['then'](function(_0x3d25ef){_0x52ea3a[_0xa58c('0x1d')]=_0x3d25ef;if(_0x3f41c1['query'][_0xa58c('0x3a')]){_0x4f89f7[_0xa58c('0x3b')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xa58c('0x3c')](_0x4f89f7);})[_0xa58c('0x23')](function(_0x2e0e3c){_0x52ea3a[_0xa58c('0x3d')]=_0x2e0e3c;return _0x52ea3a;})[_0xa58c('0x23')](respondWithFilteredResult(_0x552cd0,_0x4f89f7))[_0xa58c('0x3e')](handleError(_0x552cd0,null));};exports['show']=function(_0x21fa6c,_0x5d119e){var _0x109a22={'raw':!![],'where':{'id':_0x21fa6c[_0xa58c('0x3f')]['id']}},_0x7570ce={};_0x7570ce[_0xa58c('0x2d')]=_[_0xa58c('0x2f')](db[_0xa58c('0x40')][_0xa58c('0x2a')]);_0x7570ce[_0xa58c('0x2e')]=_[_0xa58c('0x2f')](_0x21fa6c[_0xa58c('0x2e')]);_0x7570ce['filters']=_[_0xa58c('0x31')](_0x7570ce['model'],_0x7570ce['query']);_0x109a22['attributes']=_[_0xa58c('0x31')](_0x7570ce['model'],qs[_0xa58c('0x33')](_0x21fa6c[_0xa58c('0x2e')][_0xa58c('0x33')]));_0x109a22['attributes']=_0x109a22[_0xa58c('0x32')][_0xa58c('0x41')]?_0x109a22[_0xa58c('0x32')]:_0x7570ce[_0xa58c('0x2d')];if(_0x21fa6c[_0xa58c('0x2e')]['includeAll']){_0x109a22[_0xa58c('0x3b')]=[{'all':!![]}];}_0x109a22=_[_0xa58c('0x39')]({},_0x109a22,_0x21fa6c[_0xa58c('0x42')]);return db[_0xa58c('0x40')][_0xa58c('0x43')](_0x109a22)['then'](handleEntityNotFound(_0x5d119e,null))[_0xa58c('0x23')](respondWithResult(_0x5d119e,null))[_0xa58c('0x3e')](handleError(_0x5d119e,null));};exports[_0xa58c('0x44')]=function(_0x50eaab,_0x5f3c3f){return db[_0xa58c('0x40')][_0xa58c('0x44')](_0x50eaab['body'],{})[_0xa58c('0x23')](respondWithResult(_0x5f3c3f,0xc9))[_0xa58c('0x3e')](handleError(_0x5f3c3f,null));};exports[_0xa58c('0x22')]=function(_0x16ea4d,_0x56af32){if(_0x16ea4d['body']['id']){delete _0x16ea4d[_0xa58c('0x45')]['id'];}return db[_0xa58c('0x40')]['find']({'where':{'id':_0x16ea4d[_0xa58c('0x3f')]['id']}})[_0xa58c('0x23')](handleEntityNotFound(_0x56af32,null))[_0xa58c('0x23')](saveUpdates(_0x16ea4d[_0xa58c('0x45')],null))['then'](respondWithResult(_0x56af32,null))[_0xa58c('0x3e')](handleError(_0x56af32,null));};exports[_0xa58c('0x46')]=function(_0x5bb0c4,_0x14c3c6){return db['AnalyticTreeReport'][_0xa58c('0x43')]({'where':{'id':_0x5bb0c4[_0xa58c('0x3f')]['id']}})[_0xa58c('0x23')](handleEntityNotFound(_0x14c3c6,null))[_0xa58c('0x23')](removeEntity(_0x14c3c6,null))['catch'](handleError(_0x14c3c6,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a68f544..d6337ec 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 _0x5afe=['exports','define','AnalyticTreeReport','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0xc70293,_0x2cc6f4){var _0x29036b=function(_0x225d0c){while(--_0x225d0c){_0xc70293['push'](_0xc70293['shift']());}};_0x29036b(++_0x2cc6f4);}(_0x5afe,0x10b));var _0xe5af=function(_0x2128d3,_0x420dfa){_0x2128d3=_0x2128d3-0x0;var _0x49fa00=_0x5afe[_0x2128d3];return _0x49fa00;};'use strict';var _=require('lodash');var util=require(_0xe5af('0x0'));var logger=require(_0xe5af('0x1'))(_0xe5af('0x2'));var moment=require('moment');var BPromise=require(_0xe5af('0x3'));var rp=require(_0xe5af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5af('0x5'));var config=require(_0xe5af('0x6'));var attributes=require(_0xe5af('0x7'));module[_0xe5af('0x8')]=function(_0xffac45,_0x719722){return _0xffac45[_0xe5af('0x9')](_0xe5af('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c87=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x2c87,0x107));var _0x72c8=function(_0xf34a42,_0x5d8a51){_0xf34a42=_0xf34a42-0x0;var _0x159d63=_0x2c87[_0xf34a42];return _0x159d63;};'use strict';var _=require(_0x72c8('0x0'));var util=require(_0x72c8('0x1'));var logger=require(_0x72c8('0x2'))(_0x72c8('0x3'));var moment=require(_0x72c8('0x4'));var BPromise=require('bluebird');var rp=require(_0x72c8('0x5'));var fs=require('fs');var path=require(_0x72c8('0x6'));var rimraf=require(_0x72c8('0x7'));var config=require(_0x72c8('0x8'));var attributes=require(_0x72c8('0x9'));module[_0x72c8('0xa')]=function(_0x45e2a9,_0x384482){return _0x45e2a9[_0x72c8('0xb')](_0x72c8('0xc'),attributes,{'tableName':_0x72c8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 8c26b5b..c4ac533 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x238a1a,_0x3b01f2){var _0x5bbacc=function(_0x13d7cb){while(--_0x13d7cb){_0x238a1a['push'](_0x238a1a['shift']());}};_0x5bbacc(++_0x3b01f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21d47d,_0x46cab0){_0x21d47d=_0x21d47d-0x0;var _0x395148=_0x5f2f[_0x21d47d];return _0x395148;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x989a91,_0x3393a4){var _0x4f54e2=function(_0x1e6eed){while(--_0x1e6eed){_0x989a91['push'](_0x989a91['shift']());}};_0x4f54e2(++_0x3393a4);}(_0xdb28,0x106));var _0x8db2=function(_0x328e17,_0x1e84cf){_0x328e17=_0x328e17-0x0;var _0x1d7b86=_0xdb28[_0x328e17];return _0x1d7b86;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index db4ccb6..824aedb 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 _0x077b=['isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x665132,_0x5bbb19){var _0x312117=function(_0x152870){while(--_0x152870){_0x665132['push'](_0x665132['shift']());}};_0x312117(++_0x5bbb19);}(_0x077b,0xbd));var _0xb077=function(_0x4f41cf,_0xdf03fe){_0x4f41cf=_0x4f41cf-0x0;var _0x5e19d0=_0x077b[_0x4f41cf];return _0x5e19d0;};'use strict';var multer=require(_0xb077('0x0'));var util=require(_0xb077('0x1'));var path=require('path');var timeout=require(_0xb077('0x2'));var express=require(_0xb077('0x3'));var router=express[_0xb077('0x4')]();var fs_extra=require(_0xb077('0x5'));var auth=require(_0xb077('0x6'));var interaction=require(_0xb077('0x7'));var config=require(_0xb077('0x8'));var controller=require(_0xb077('0x9'));router[_0xb077('0xa')]('/',auth[_0xb077('0xb')](),controller['index']);router['get'](_0xb077('0xc'),auth[_0xb077('0xb')](),controller['show']);router[_0xb077('0xd')]('/',auth[_0xb077('0xb')](),controller[_0xb077('0xe')]);router[_0xb077('0xf')](_0xb077('0xc'),auth[_0xb077('0xb')](),controller[_0xb077('0x10')]);router[_0xb077('0x11')](_0xb077('0xc'),auth['isAuthenticated'](),controller[_0xb077('0x12')]);module[_0xb077('0x13')]=router; \ No newline at end of file +var _0x3d65=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0x3d65,0xc3));var _0x53d6=function(_0x166b14,_0x3ce1ce){_0x166b14=_0x166b14-0x0;var _0x5dc7c6=_0x3d65[_0x166b14];return _0x5dc7c6;};'use strict';var multer=require(_0x53d6('0x0'));var util=require(_0x53d6('0x1'));var path=require(_0x53d6('0x2'));var timeout=require(_0x53d6('0x3'));var express=require(_0x53d6('0x4'));var router=express[_0x53d6('0x5')]();var fs_extra=require(_0x53d6('0x6'));var auth=require(_0x53d6('0x7'));var interaction=require(_0x53d6('0x8'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x53d6('0x9')]);router['get'](_0x53d6('0xa'),auth[_0x53d6('0xb')](),controller[_0x53d6('0xc')]);router['post']('/',auth[_0x53d6('0xb')](),controller['create']);router[_0x53d6('0xd')]('/:id',auth[_0x53d6('0xb')](),controller[_0x53d6('0xe')]);router[_0x53d6('0xf')](_0x53d6('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 53b6197..aa816f8 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 _0xc718=['sequelize','STRING'];(function(_0x597b7a,_0x5660e8){var _0xc37f49=function(_0x15053b){while(--_0x15053b){_0x597b7a['push'](_0x597b7a['shift']());}};_0xc37f49(++_0x5660e8);}(_0xc718,0xb6));var _0x8c71=function(_0x195eb3,_0x59180c){_0x195eb3=_0x195eb3-0x0;var _0x36ea03=_0xc718[_0x195eb3];return _0x36ea03;};'use strict';var Sequelize=require(_0x8c71('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c71('0x1')]},'basename':{'type':Sequelize[_0x8c71('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd246=['exports','STRING','sequelize'];(function(_0x3ae073,_0x401e65){var _0x217cb4=function(_0x1596e6){while(--_0x1596e6){_0x3ae073['push'](_0x3ae073['shift']());}};_0x217cb4(++_0x401e65);}(_0xd246,0xf5));var _0x6d24=function(_0x531c55,_0x3f5d48){_0x531c55=_0x531c55-0x0;var _0x2968f9=_0xd246[_0x531c55];return _0x2968f9;};'use strict';var Sequelize=require(_0x6d24('0x0'));module[_0x6d24('0x1')]={'name':{'type':Sequelize[_0x6d24('0x2')]},'basename':{'type':Sequelize[_0x6d24('0x2')]},'type':{'type':Sequelize[_0x6d24('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5347cb4..8c86e84 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 _0x946e=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','clone','get','updatedAt','body','createdAt','create','file','originalname','filename','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','basename','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0xc90440,_0x4cf80b){var _0x46ef96=function(_0x428ee0){while(--_0x428ee0){_0xc90440['push'](_0xc90440['shift']());}};_0x46ef96(++_0x4cf80b);}(_0x946e,0xae));var _0xe946=function(_0x1f878b,_0x1f894d){_0x1f878b=_0x1f878b-0x0;var _0x3fa595=_0x946e[_0x1f878b];return _0x3fa595;};'use strict';var emlformat=require(_0xe946('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe946('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe946('0x2'));var BPromise=require(_0xe946('0x3'));var Mustache=require(_0xe946('0x4'));var util=require(_0xe946('0x5'));var path=require(_0xe946('0x6'));var sox=require(_0xe946('0x7'));var csv=require(_0xe946('0x8'));var ejs=require(_0xe946('0x9'));var fs=require('fs');var fs_extra=require(_0xe946('0xa'));var _=require(_0xe946('0xb'));var squel=require(_0xe946('0xc'));var crypto=require(_0xe946('0xd'));var jsforce=require(_0xe946('0xe'));var deskjs=require(_0xe946('0xf'));var toCsv=require(_0xe946('0x8'));var querystring=require(_0xe946('0x10'));var Papa=require(_0xe946('0x11'));var Redis=require(_0xe946('0x12'));var authService=require(_0xe946('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe946('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe946('0x15'))(_0xe946('0x16'));var utils=require(_0xe946('0x17'));var config=require(_0xe946('0x18'));var licenseUtil=require(_0xe946('0x19'));var db=require(_0xe946('0x1a'))['db'];function respondWithStatusCode(_0x3232b1,_0x1cc8e7){_0x1cc8e7=_0x1cc8e7||0xcc;return function(_0x15f5cc){if(_0x15f5cc){return _0x3232b1[_0xe946('0x1b')](_0x1cc8e7);}return _0x3232b1[_0xe946('0x1c')](_0x1cc8e7)['end']();};}function respondWithResult(_0x40e2f4,_0x292863){_0x292863=_0x292863||0xc8;return function(_0x44404d){if(_0x44404d){return _0x40e2f4['status'](_0x292863)[_0xe946('0x1d')](_0x44404d);}};}function respondWithFilteredResult(_0x5caeb2,_0x4da63a){return function(_0x457ffd){if(_0x457ffd){var _0x2afe31=typeof _0x4da63a['offset']===_0xe946('0x1e')&&typeof _0x4da63a[_0xe946('0x1f')]==='undefined';var _0x49b8d2=_0x457ffd['count'];var _0x5d5feb=_0x2afe31?0x0:_0x4da63a[_0xe946('0x20')];var _0x6e9c58=_0x2afe31?_0x457ffd[_0xe946('0x21')]:_0x4da63a[_0xe946('0x20')]+_0x4da63a[_0xe946('0x1f')];var _0x442cc6;if(_0x6e9c58>=_0x49b8d2){_0x6e9c58=_0x49b8d2;_0x442cc6=0xc8;}else{_0x442cc6=0xce;}_0x5caeb2[_0xe946('0x1c')](_0x442cc6);return _0x5caeb2[_0xe946('0x22')](_0xe946('0x23'),_0x5d5feb+'-'+_0x6e9c58+'/'+_0x49b8d2)[_0xe946('0x1d')](_0x457ffd);}return null;};}function patchUpdates(_0x570632){return function(_0x4ff80b){try{jsonpatch['apply'](_0x4ff80b,_0x570632,!![]);}catch(_0x143551){return BPromise[_0xe946('0x24')](_0x143551);}return _0x4ff80b[_0xe946('0x25')]();};}function saveUpdates(_0x118307,_0x139f7c){return function(_0x1b09e0){if(_0x1b09e0){return _0x1b09e0[_0xe946('0x26')](_0x118307)[_0xe946('0x27')](function(_0x1e0496){return _0x1e0496;});}return null;};}function removeEntity(_0x293197,_0x5c9dcf){return function(_0x583c20){if(_0x583c20){return _0x583c20[_0xe946('0x28')]()[_0xe946('0x27')](function(){_0x293197[_0xe946('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5395a8,_0x325b03){return function(_0x15f995){if(!_0x15f995){_0x5395a8[_0xe946('0x1b')](0x194);}return _0x15f995;};}function handleError(_0x54a7a3,_0x5a7b26){_0x5a7b26=_0x5a7b26||0x1f4;return function(_0x97c5ca){logger['error'](_0x97c5ca[_0xe946('0x29')]);if(_0x97c5ca[_0xe946('0x2a')]){delete _0x97c5ca[_0xe946('0x2a')];}_0x54a7a3['status'](_0x5a7b26)[_0xe946('0x2b')](_0x97c5ca);};}exports['index']=function(_0x5da043,_0x5cac72){var _0x4fb148={},_0x10ef26={},_0x50aee6={'count':0x0,'rows':[]};var _0x1bf6b1=_[_0xe946('0x2c')](db[_0xe946('0x2d')][_0xe946('0x2e')],function(_0x36603e){return{'name':_0x36603e[_0xe946('0x2f')],'type':_0x36603e[_0xe946('0x30')][_0xe946('0x31')]};});_0x10ef26['model']=_[_0xe946('0x2c')](_0x1bf6b1,_0xe946('0x2a'));_0x10ef26[_0xe946('0x32')]=_[_0xe946('0x33')](_0x5da043[_0xe946('0x32')]);_0x10ef26[_0xe946('0x34')]=_[_0xe946('0x35')](_0x10ef26[_0xe946('0x36')],_0x10ef26[_0xe946('0x32')]);_0x4fb148[_0xe946('0x37')]=_[_0xe946('0x35')](_0x10ef26[_0xe946('0x36')],qs['fields'](_0x5da043[_0xe946('0x32')][_0xe946('0x38')]));_0x4fb148[_0xe946('0x37')]=_0x4fb148[_0xe946('0x37')]['length']?_0x4fb148[_0xe946('0x37')]:_0x10ef26['model'];if(!_0x5da043[_0xe946('0x32')][_0xe946('0x39')](_0xe946('0x3a'))){_0x4fb148[_0xe946('0x1f')]=qs[_0xe946('0x1f')](_0x5da043[_0xe946('0x32')]['limit']);_0x4fb148[_0xe946('0x20')]=qs[_0xe946('0x20')](_0x5da043[_0xe946('0x32')][_0xe946('0x20')]);}_0x4fb148[_0xe946('0x3b')]=qs[_0xe946('0x3c')](_0x5da043[_0xe946('0x32')][_0xe946('0x3c')]);_0x4fb148[_0xe946('0x3d')]=qs['filters'](_[_0xe946('0x3e')](_0x5da043[_0xe946('0x32')],_0x10ef26['filters']),_0x1bf6b1);if(_0x5da043[_0xe946('0x32')][_0xe946('0x3f')]){_0x4fb148[_0xe946('0x3d')]=_[_0xe946('0x40')](_0x4fb148[_0xe946('0x3d')],{'$or':_[_0xe946('0x2c')](_0x1bf6b1,function(_0x3da745){if(_0x3da745[_0xe946('0x30')]!==_0xe946('0x41')){var _0x234df1={};_0x234df1[_0x3da745[_0xe946('0x2a')]]={'$like':'%'+_0x5da043[_0xe946('0x32')]['filter']+'%'};return _0x234df1;}})});}_0x4fb148=_[_0xe946('0x40')]({},_0x4fb148,_0x5da043[_0xe946('0x42')]);var _0x3e1d67={'where':_0x4fb148[_0xe946('0x3d')]};return db['Attachment']['count'](_0x3e1d67)['then'](function(_0x22aaba){_0x50aee6[_0xe946('0x21')]=_0x22aaba;if(_0x5da043[_0xe946('0x32')][_0xe946('0x43')]){_0x4fb148[_0xe946('0x44')]=[{'all':!![]}];}return db[_0xe946('0x2d')][_0xe946('0x45')](_0x4fb148);})[_0xe946('0x27')](function(_0x486665){_0x50aee6['rows']=_0x486665;return _0x50aee6;})[_0xe946('0x27')](respondWithFilteredResult(_0x5cac72,_0x4fb148))[_0xe946('0x46')](handleError(_0x5cac72,null));};exports[_0xe946('0x47')]=function(_0x2c23f8,_0x110ff9){var _0x3aa609={'raw':!![],'where':{'id':_0x2c23f8[_0xe946('0x48')]['id']}},_0x1ac248={};_0x1ac248[_0xe946('0x36')]=_[_0xe946('0x33')](db[_0xe946('0x2d')][_0xe946('0x2e')]);_0x1ac248[_0xe946('0x32')]=_[_0xe946('0x33')](_0x2c23f8[_0xe946('0x32')]);_0x1ac248[_0xe946('0x34')]=_[_0xe946('0x35')](_0x1ac248[_0xe946('0x36')],_0x1ac248['query']);_0x3aa609[_0xe946('0x37')]=_[_0xe946('0x35')](_0x1ac248[_0xe946('0x36')],qs[_0xe946('0x38')](_0x2c23f8['query'][_0xe946('0x38')]));_0x3aa609[_0xe946('0x37')]=_0x3aa609[_0xe946('0x37')][_0xe946('0x49')]?_0x3aa609[_0xe946('0x37')]:_0x1ac248[_0xe946('0x36')];if(_0x2c23f8['query'][_0xe946('0x43')]){_0x3aa609[_0xe946('0x44')]=[{'all':!![]}];}_0x3aa609=_['merge']({},_0x3aa609,_0x2c23f8[_0xe946('0x42')]);return db[_0xe946('0x2d')][_0xe946('0x4a')](_0x3aa609)[_0xe946('0x27')](handleEntityNotFound(_0x110ff9,null))[_0xe946('0x27')](respondWithResult(_0x110ff9,null))[_0xe946('0x46')](handleError(_0x110ff9,null));};exports[_0xe946('0x4b')]=function(_0x17dad0,_0x21844f){var _0x8b1615={'where':{'id':_0x17dad0[_0xe946('0x48')]['id']}},_0x5487bc={};_0x5487bc[_0xe946('0x36')]=_[_0xe946('0x33')](db['Attachment'][_0xe946('0x2e')]);_0x8b1615[_0xe946('0x37')]=_[_0xe946('0x35')](_0x5487bc['model'],qs[_0xe946('0x38')](_0x17dad0[_0xe946('0x32')][_0xe946('0x38')]));_0x8b1615['attributes']=_0x8b1615[_0xe946('0x37')][_0xe946('0x49')]?_0x8b1615['attributes']:_0x5487bc[_0xe946('0x36')];if(_0x17dad0[_0xe946('0x32')]['includeAll']){_0x8b1615[_0xe946('0x44')]=[{'all':!![]}];}_0x8b1615=_[_0xe946('0x40')]({},_0x8b1615,_0x17dad0[_0xe946('0x42')]);return db[_0xe946('0x2d')][_0xe946('0x4a')](_0x8b1615)[_0xe946('0x27')](handleEntityNotFound(_0x21844f,null))[_0xe946('0x27')](function(_0x324140){if(_0x324140){var _0x5a8f62=_0x324140[_0xe946('0x4c')]({'plain':!![]});_0x5a8f62=qs['omit'](_0x5a8f62,['id','createdAt',_0xe946('0x4d')]);_0x17dad0[_0xe946('0x4e')]=_['omit'](_0x17dad0['body'],['id',_0xe946('0x4f'),_0xe946('0x4d')]);return db['Attachment'][_0xe946('0x50')](_[_0xe946('0x40')](_0x5a8f62,_0x17dad0[_0xe946('0x4e')]),{'include':_0x17dad0[_0xe946('0x32')][_0xe946('0x43')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x21844f,0xc9))[_0xe946('0x46')](handleError(_0x21844f,null));};exports[_0xe946('0x26')]=function(_0x126fab,_0x339ab2){if(_0x126fab['body']['id']){delete _0x126fab[_0xe946('0x4e')]['id'];}return db[_0xe946('0x2d')][_0xe946('0x4a')]({'where':{'id':_0x126fab[_0xe946('0x48')]['id']}})[_0xe946('0x27')](handleEntityNotFound(_0x339ab2,null))[_0xe946('0x27')](saveUpdates(_0x126fab[_0xe946('0x4e')],null))[_0xe946('0x27')](respondWithResult(_0x339ab2,null))[_0xe946('0x46')](handleError(_0x339ab2,null));};exports[_0xe946('0x28')]=function(_0xbac5c0,_0x5c832c){return db[_0xe946('0x2d')]['find']({'where':{'id':_0xbac5c0[_0xe946('0x48')]['id']}})[_0xe946('0x27')](handleEntityNotFound(_0x5c832c,null))['then'](removeEntity(_0x5c832c,null))['catch'](handleError(_0x5c832c,null));};exports[_0xe946('0x50')]=function(_0x26c754,_0xeb89e1,_0x2279a4){_0x26c754['body'][_0xe946('0x2a')]=_0x26c754[_0xe946('0x51')][_0xe946('0x52')];_0x26c754['body']['basename']=_0x26c754[_0xe946('0x51')][_0xe946('0x53')];_0x26c754['body'][_0xe946('0x30')]=_0x26c754[_0xe946('0x51')]['mimetype'];return db[_0xe946('0x2d')]['create'](_0x26c754[_0xe946('0x4e')])[_0xe946('0x27')](respondWithResult(_0xeb89e1,0xc9))[_0xe946('0x46')](handleError(_0xeb89e1,null));};exports[_0xe946('0x54')]=function(_0x369e02,_0x32333d,_0x34570e){return db[_0xe946('0x2d')][_0xe946('0x55')]({'where':{'id':_0x369e02[_0xe946('0x48')]['id']},'raw':!![]})[_0xe946('0x27')](handleEntityNotFound(_0x32333d,null))[_0xe946('0x27')](function(_0x24d6e7){if(_0x24d6e7){var _0x4825fc=_0x24d6e7[_0xe946('0x56')]!==null;var _0x61c191=path['join'](config[_0xe946('0x57')],_0xe946('0x58'));if(_0x4825fc){_0x61c191=path[_0xe946('0x59')](_0x61c191,'offline-chat/');}var _0xd6bc11=path[_0xe946('0x59')](_0x61c191,_0x24d6e7[_0xe946('0x5a')]);return _0x32333d['download'](_0xd6bc11);}})[_0xe946('0x46')](handleError(_0x32333d,null));}; \ No newline at end of file +var _0xd18d=['params','options','find','clone','get','omit','createdAt','updatedAt','body','create','catch','file','originalname','basename','filename','type','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','includeAll','include','findAll','rows','show'];(function(_0x5cf40a,_0x21e31f){var _0x26216d=function(_0x82a779){while(--_0x82a779){_0x5cf40a['push'](_0x5cf40a['shift']());}};_0x26216d(++_0x21e31f);}(_0xd18d,0xc7));var _0xdd18=function(_0x487f22,_0x2cc035){_0x487f22=_0x487f22-0x0;var _0x5b8880=_0xd18d[_0x487f22];return _0x5b8880;};'use strict';var emlformat=require(_0xdd18('0x0'));var rimraf=require(_0xdd18('0x1'));var zipdir=require(_0xdd18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd18('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdd18('0x4'));var util=require(_0xdd18('0x5'));var path=require(_0xdd18('0x6'));var sox=require(_0xdd18('0x7'));var csv=require(_0xdd18('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd18('0x9'));var squel=require('squel');var crypto=require(_0xdd18('0xa'));var jsforce=require(_0xdd18('0xb'));var deskjs=require(_0xdd18('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdd18('0xd'));var Papa=require(_0xdd18('0xe'));var Redis=require('ioredis');var authService=require(_0xdd18('0xf'));var qs=require(_0xdd18('0x10'));var as=require(_0xdd18('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd18('0x12'))('api');var utils=require(_0xdd18('0x13'));var config=require(_0xdd18('0x14'));var licenseUtil=require(_0xdd18('0x15'));var db=require(_0xdd18('0x16'))['db'];function respondWithStatusCode(_0x124ada,_0x408010){_0x408010=_0x408010||0xcc;return function(_0x12ab1a){if(_0x12ab1a){return _0x124ada['sendStatus'](_0x408010);}return _0x124ada[_0xdd18('0x17')](_0x408010)['end']();};}function respondWithResult(_0x218761,_0x2a8bfa){_0x2a8bfa=_0x2a8bfa||0xc8;return function(_0x5bd222){if(_0x5bd222){return _0x218761[_0xdd18('0x17')](_0x2a8bfa)[_0xdd18('0x18')](_0x5bd222);}};}function respondWithFilteredResult(_0xe42468,_0x277826){return function(_0x1f6478){if(_0x1f6478){var _0x2e8a0c=typeof _0x277826[_0xdd18('0x19')]===_0xdd18('0x1a')&&typeof _0x277826[_0xdd18('0x1b')]==='undefined';var _0x23e11f=_0x1f6478[_0xdd18('0x1c')];var _0x10a362=_0x2e8a0c?0x0:_0x277826[_0xdd18('0x19')];var _0x37aa8f=_0x2e8a0c?_0x1f6478['count']:_0x277826['offset']+_0x277826[_0xdd18('0x1b')];var _0x215ba7;if(_0x37aa8f>=_0x23e11f){_0x37aa8f=_0x23e11f;_0x215ba7=0xc8;}else{_0x215ba7=0xce;}_0xe42468[_0xdd18('0x17')](_0x215ba7);return _0xe42468[_0xdd18('0x1d')]('Content-Range',_0x10a362+'-'+_0x37aa8f+'/'+_0x23e11f)['json'](_0x1f6478);}return null;};}function patchUpdates(_0x292e8b){return function(_0x427392){try{jsonpatch[_0xdd18('0x1e')](_0x427392,_0x292e8b,!![]);}catch(_0x29785f){return BPromise[_0xdd18('0x1f')](_0x29785f);}return _0x427392['save']();};}function saveUpdates(_0x12da67,_0x3c2928){return function(_0x343fbb){if(_0x343fbb){return _0x343fbb[_0xdd18('0x20')](_0x12da67)[_0xdd18('0x21')](function(_0x4cb722){return _0x4cb722;});}return null;};}function removeEntity(_0x325e4c,_0x577433){return function(_0x3ebcf7){if(_0x3ebcf7){return _0x3ebcf7[_0xdd18('0x22')]()[_0xdd18('0x21')](function(){_0x325e4c[_0xdd18('0x17')](0xcc)[_0xdd18('0x23')]();});}};}function handleEntityNotFound(_0x562275,_0x1d21d0){return function(_0x547bd1){if(!_0x547bd1){_0x562275[_0xdd18('0x24')](0x194);}return _0x547bd1;};}function handleError(_0x15ce6d,_0x1f5830){_0x1f5830=_0x1f5830||0x1f4;return function(_0x92599c){logger[_0xdd18('0x25')](_0x92599c[_0xdd18('0x26')]);if(_0x92599c[_0xdd18('0x27')]){delete _0x92599c['name'];}_0x15ce6d[_0xdd18('0x17')](_0x1f5830)[_0xdd18('0x28')](_0x92599c);};}exports[_0xdd18('0x29')]=function(_0x397b98,_0x3327fa){var _0x4b7e74={},_0x4dcf4b={},_0xba02e9={'count':0x0,'rows':[]};var _0x36408d=_[_0xdd18('0x2a')](db[_0xdd18('0x2b')][_0xdd18('0x2c')],function(_0x309a3a){return{'name':_0x309a3a[_0xdd18('0x2d')],'type':_0x309a3a['type'][_0xdd18('0x2e')]};});_0x4dcf4b[_0xdd18('0x2f')]=_[_0xdd18('0x2a')](_0x36408d,'name');_0x4dcf4b[_0xdd18('0x30')]=_[_0xdd18('0x31')](_0x397b98[_0xdd18('0x30')]);_0x4dcf4b[_0xdd18('0x32')]=_[_0xdd18('0x33')](_0x4dcf4b[_0xdd18('0x2f')],_0x4dcf4b[_0xdd18('0x30')]);_0x4b7e74[_0xdd18('0x34')]=_[_0xdd18('0x33')](_0x4dcf4b[_0xdd18('0x2f')],qs[_0xdd18('0x35')](_0x397b98['query'][_0xdd18('0x35')]));_0x4b7e74[_0xdd18('0x34')]=_0x4b7e74[_0xdd18('0x34')][_0xdd18('0x36')]?_0x4b7e74[_0xdd18('0x34')]:_0x4dcf4b[_0xdd18('0x2f')];if(!_0x397b98[_0xdd18('0x30')][_0xdd18('0x37')]('nolimit')){_0x4b7e74[_0xdd18('0x1b')]=qs[_0xdd18('0x1b')](_0x397b98[_0xdd18('0x30')][_0xdd18('0x1b')]);_0x4b7e74['offset']=qs[_0xdd18('0x19')](_0x397b98['query']['offset']);}_0x4b7e74['order']=qs['sort'](_0x397b98[_0xdd18('0x30')][_0xdd18('0x38')]);_0x4b7e74[_0xdd18('0x39')]=qs[_0xdd18('0x32')](_['pick'](_0x397b98[_0xdd18('0x30')],_0x4dcf4b[_0xdd18('0x32')]),_0x36408d);if(_0x397b98[_0xdd18('0x30')][_0xdd18('0x3a')]){_0x4b7e74[_0xdd18('0x39')]=_[_0xdd18('0x3b')](_0x4b7e74['where'],{'$or':_[_0xdd18('0x2a')](_0x36408d,function(_0x24d076){if(_0x24d076['type']!=='VIRTUAL'){var _0x229916={};_0x229916[_0x24d076[_0xdd18('0x27')]]={'$like':'%'+_0x397b98[_0xdd18('0x30')][_0xdd18('0x3a')]+'%'};return _0x229916;}})});}_0x4b7e74=_['merge']({},_0x4b7e74,_0x397b98['options']);var _0x49a25a={'where':_0x4b7e74['where']};return db[_0xdd18('0x2b')]['count'](_0x49a25a)[_0xdd18('0x21')](function(_0x3c0ce4){_0xba02e9[_0xdd18('0x1c')]=_0x3c0ce4;if(_0x397b98[_0xdd18('0x30')][_0xdd18('0x3c')]){_0x4b7e74[_0xdd18('0x3d')]=[{'all':!![]}];}return db[_0xdd18('0x2b')][_0xdd18('0x3e')](_0x4b7e74);})[_0xdd18('0x21')](function(_0x12d506){_0xba02e9[_0xdd18('0x3f')]=_0x12d506;return _0xba02e9;})[_0xdd18('0x21')](respondWithFilteredResult(_0x3327fa,_0x4b7e74))['catch'](handleError(_0x3327fa,null));};exports[_0xdd18('0x40')]=function(_0x5842f1,_0x5b9413){var _0xeb10b5={'raw':!![],'where':{'id':_0x5842f1[_0xdd18('0x41')]['id']}},_0x4277ba={};_0x4277ba[_0xdd18('0x2f')]=_[_0xdd18('0x31')](db[_0xdd18('0x2b')]['rawAttributes']);_0x4277ba[_0xdd18('0x30')]=_[_0xdd18('0x31')](_0x5842f1[_0xdd18('0x30')]);_0x4277ba['filters']=_[_0xdd18('0x33')](_0x4277ba[_0xdd18('0x2f')],_0x4277ba[_0xdd18('0x30')]);_0xeb10b5[_0xdd18('0x34')]=_[_0xdd18('0x33')](_0x4277ba[_0xdd18('0x2f')],qs['fields'](_0x5842f1[_0xdd18('0x30')]['fields']));_0xeb10b5['attributes']=_0xeb10b5[_0xdd18('0x34')][_0xdd18('0x36')]?_0xeb10b5[_0xdd18('0x34')]:_0x4277ba['model'];if(_0x5842f1[_0xdd18('0x30')][_0xdd18('0x3c')]){_0xeb10b5[_0xdd18('0x3d')]=[{'all':!![]}];}_0xeb10b5=_[_0xdd18('0x3b')]({},_0xeb10b5,_0x5842f1[_0xdd18('0x42')]);return db['Attachment'][_0xdd18('0x43')](_0xeb10b5)[_0xdd18('0x21')](handleEntityNotFound(_0x5b9413,null))[_0xdd18('0x21')](respondWithResult(_0x5b9413,null))['catch'](handleError(_0x5b9413,null));};exports[_0xdd18('0x44')]=function(_0x53f7c6,_0x5dda58){var _0x40768c={'where':{'id':_0x53f7c6['params']['id']}},_0x3cd678={};_0x3cd678[_0xdd18('0x2f')]=_[_0xdd18('0x31')](db[_0xdd18('0x2b')]['rawAttributes']);_0x40768c[_0xdd18('0x34')]=_[_0xdd18('0x33')](_0x3cd678[_0xdd18('0x2f')],qs[_0xdd18('0x35')](_0x53f7c6[_0xdd18('0x30')][_0xdd18('0x35')]));_0x40768c[_0xdd18('0x34')]=_0x40768c[_0xdd18('0x34')]['length']?_0x40768c[_0xdd18('0x34')]:_0x3cd678[_0xdd18('0x2f')];if(_0x53f7c6[_0xdd18('0x30')][_0xdd18('0x3c')]){_0x40768c[_0xdd18('0x3d')]=[{'all':!![]}];}_0x40768c=_['merge']({},_0x40768c,_0x53f7c6['options']);return db['Attachment'][_0xdd18('0x43')](_0x40768c)['then'](handleEntityNotFound(_0x5dda58,null))[_0xdd18('0x21')](function(_0x1fedc4){if(_0x1fedc4){var _0x18d1a7=_0x1fedc4[_0xdd18('0x45')]({'plain':!![]});_0x18d1a7=qs[_0xdd18('0x46')](_0x18d1a7,['id',_0xdd18('0x47'),_0xdd18('0x48')]);_0x53f7c6[_0xdd18('0x49')]=_[_0xdd18('0x46')](_0x53f7c6['body'],['id',_0xdd18('0x47'),_0xdd18('0x48')]);return db[_0xdd18('0x2b')][_0xdd18('0x4a')](_[_0xdd18('0x3b')](_0x18d1a7,_0x53f7c6[_0xdd18('0x49')]),{'include':_0x53f7c6[_0xdd18('0x30')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5dda58,0xc9))[_0xdd18('0x4b')](handleError(_0x5dda58,null));};exports['update']=function(_0x159a66,_0x44cc06){if(_0x159a66[_0xdd18('0x49')]['id']){delete _0x159a66[_0xdd18('0x49')]['id'];}return db[_0xdd18('0x2b')][_0xdd18('0x43')]({'where':{'id':_0x159a66[_0xdd18('0x41')]['id']}})[_0xdd18('0x21')](handleEntityNotFound(_0x44cc06,null))[_0xdd18('0x21')](saveUpdates(_0x159a66[_0xdd18('0x49')],null))[_0xdd18('0x21')](respondWithResult(_0x44cc06,null))[_0xdd18('0x4b')](handleError(_0x44cc06,null));};exports[_0xdd18('0x22')]=function(_0x39dc6b,_0xe8f98d){return db['Attachment']['find']({'where':{'id':_0x39dc6b[_0xdd18('0x41')]['id']}})['then'](handleEntityNotFound(_0xe8f98d,null))['then'](removeEntity(_0xe8f98d,null))[_0xdd18('0x4b')](handleError(_0xe8f98d,null));};exports[_0xdd18('0x4a')]=function(_0x13f3e6,_0x1bbdee,_0x4f19c9){_0x13f3e6[_0xdd18('0x49')][_0xdd18('0x27')]=_0x13f3e6[_0xdd18('0x4c')][_0xdd18('0x4d')];_0x13f3e6[_0xdd18('0x49')][_0xdd18('0x4e')]=_0x13f3e6[_0xdd18('0x4c')][_0xdd18('0x4f')];_0x13f3e6[_0xdd18('0x49')][_0xdd18('0x50')]=_0x13f3e6[_0xdd18('0x4c')][_0xdd18('0x51')];return db[_0xdd18('0x2b')][_0xdd18('0x4a')](_0x13f3e6[_0xdd18('0x49')])[_0xdd18('0x21')](respondWithResult(_0x1bbdee,0xc9))[_0xdd18('0x4b')](handleError(_0x1bbdee,null));};exports[_0xdd18('0x52')]=function(_0x47d64f,_0x114221,_0x24f61d){return db[_0xdd18('0x2b')][_0xdd18('0x53')]({'where':{'id':_0x47d64f[_0xdd18('0x41')]['id']},'raw':!![]})[_0xdd18('0x21')](handleEntityNotFound(_0x114221,null))[_0xdd18('0x21')](function(_0x9b232){if(_0x9b232){var _0x43424c=_0x9b232[_0xdd18('0x54')]!==null;var _0x17bcf2=path['join'](config[_0xdd18('0x55')],_0xdd18('0x56'));if(_0x43424c){_0x17bcf2=path[_0xdd18('0x57')](_0x17bcf2,'offline-chat/');}var _0x2cfd0e=path['join'](_0x17bcf2,_0x9b232[_0xdd18('0x4e')]);return _0x114221[_0xdd18('0x52')](_0x2cfd0e);}})['catch'](handleError(_0x114221,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 389b06f..c56eca3 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 _0x5248=['bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x232caf,_0x358822){var _0x4a5781=function(_0x33beeb){while(--_0x33beeb){_0x232caf['push'](_0x232caf['shift']());}};_0x4a5781(++_0x358822);}(_0x5248,0x1f4));var _0x8524=function(_0x1a31e5,_0x28b0da){_0x1a31e5=_0x1a31e5-0x0;var _0x14eff7=_0x5248[_0x1a31e5];return _0x14eff7;};'use strict';var _=require(_0x8524('0x0'));var util=require('util');var logger=require(_0x8524('0x1'))(_0x8524('0x2'));var moment=require(_0x8524('0x3'));var BPromise=require(_0x8524('0x4'));var rp=require(_0x8524('0x5'));var fs=require('fs');var path=require(_0x8524('0x6'));var rimraf=require(_0x8524('0x7'));var config=require(_0x8524('0x8'));var attributes=require(_0x8524('0x9'));module[_0x8524('0xa')]=function(_0x120e9d,_0x476c72){return _0x120e9d[_0x8524('0xb')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2cb=['../../config/environment','./attachment.attributes','exports','define','Attachment','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0xe2cb,0x171));var _0xbe2c=function(_0x535962,_0x52a05c){_0x535962=_0x535962-0x0;var _0x582ed9=_0xe2cb[_0x535962];return _0x582ed9;};'use strict';var _=require('lodash');var util=require(_0xbe2c('0x0'));var logger=require(_0xbe2c('0x1'))(_0xbe2c('0x2'));var moment=require(_0xbe2c('0x3'));var BPromise=require(_0xbe2c('0x4'));var rp=require(_0xbe2c('0x5'));var fs=require('fs');var path=require(_0xbe2c('0x6'));var rimraf=require(_0xbe2c('0x7'));var config=require(_0xbe2c('0x8'));var attributes=require(_0xbe2c('0x9'));module[_0xbe2c('0xa')]=function(_0x161326,_0x46fa4d){return _0x161326[_0xbe2c('0xb')](_0xbe2c('0xc'),attributes,{'tableName':'attachments','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 3ee86cb..4392e53 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 _0xf874=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','moment','bluebird','randomstring'];(function(_0x1c80bd,_0x356976){var _0x15b7fc=function(_0x1ad2a){while(--_0x1ad2a){_0x1c80bd['push'](_0x1c80bd['shift']());}};_0x15b7fc(++_0x356976);}(_0xf874,0xed));var _0x4f87=function(_0x5465c3,_0x9698c4){_0x5465c3=_0x5465c3-0x0;var _0x2ee395=_0xf874[_0x5465c3];return _0x2ee395;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f87('0x0'));var BPromise=require(_0x4f87('0x1'));var rs=require(_0x4f87('0x2'));var fs=require('fs');var Redis=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var utils=require(_0x4f87('0x5'));var logger=require('../../config/logger')(_0x4f87('0x6'));var config=require(_0x4f87('0x7'));var jayson=require(_0x4f87('0x8'));var client=jayson[_0x4f87('0x9')][_0x4f87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fea6,_0x4a0662,_0x3a89e3){return new BPromise(function(_0x194853,_0x592008){return client[_0x4f87('0xb')](_0x44fea6,_0x3a89e3)[_0x4f87('0xc')](function(_0x4d8354){logger[_0x4f87('0xd')](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4a0662,_0x4f87('0xf'),JSON[_0x4f87('0x12')](_0x4d8354));if(_0x4d8354['error']){if(_0x4d8354['error'][_0x4f87('0x13')]===0x1f4){logger[_0x4f87('0x14')](_0x4f87('0xe'),_0x4a0662,_0x4d8354['error']['message']);return _0x592008(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}logger[_0x4f87('0x14')]('Attachment,\x20%s,\x20%s',_0x4a0662,_0x4d8354[_0x4f87('0x14')]['message']);return _0x194853(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}else{logger['info'](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));_0x194853(_0x4d8354[_0x4f87('0x16')][_0x4f87('0x15')]);}})[_0x4f87('0x17')](function(_0x3bd90f){logger['error'](_0x4f87('0xe'),_0x4a0662,_0x3bd90f);_0x592008(_0x3bd90f);});});}exports['CreateAttachment']=function(_0x10551e){var _0x6a3017=this;return new Promise(function(_0x46492d,_0x42c399){return db[_0x4f87('0x18')][_0x4f87('0x19')](_0x10551e[_0x4f87('0x1a')],{'raw':_0x10551e[_0x4f87('0x1b')]?_0x10551e[_0x4f87('0x1b')][_0x4f87('0x1c')]===undefined?!![]:![]:!![]})[_0x4f87('0xc')](function(_0x2c13a0){logger[_0x4f87('0xd')]('CreateAttachment',_0x10551e);logger['debug'](_0x4f87('0x1d'),_0x10551e,JSON[_0x4f87('0x12')](_0x2c13a0));_0x46492d(_0x2c13a0);})['catch'](function(_0x592edd){logger[_0x4f87('0x14')]('CreateAttachment',_0x592edd['message'],_0x10551e);_0x42c399(_0x6a3017[_0x4f87('0x14')](0x1f4,_0x592edd[_0x4f87('0x15')]));});});}; \ No newline at end of file +var _0xb6b1=['raw','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','info','result','catch','CreateAttachment','Attachment','create','body','options'];(function(_0x3f0f2e,_0xf2b92d){var _0x49fc6f=function(_0x4a2274){while(--_0x4a2274){_0x3f0f2e['push'](_0x3f0f2e['shift']());}};_0x49fc6f(++_0xf2b92d);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xb6b1[_0x33155c];return _0x5becf7;};'use strict';var _=require(_0x1b6b('0x0'));var util=require('util');var moment=require(_0x1b6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6b('0x2'));var fs=require('fs');var Redis=require(_0x1b6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b6b('0x4'));var logger=require('../../config/logger')(_0x1b6b('0x5'));var config=require(_0x1b6b('0x6'));var jayson=require(_0x1b6b('0x7'));var client=jayson[_0x1b6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d09e,_0x51cfed,_0xae4115){return new BPromise(function(_0x5042f7,_0x21f403){return client[_0x1b6b('0x9')](_0x41d09e,_0xae4115)[_0x1b6b('0xa')](function(_0x29258a){logger['info']('Attachment,\x20%s,\x20%s',_0x51cfed,_0x1b6b('0xb'));logger[_0x1b6b('0xc')](_0x1b6b('0xd'),_0x51cfed,_0x1b6b('0xb'),JSON[_0x1b6b('0xe')](_0x29258a));if(_0x29258a[_0x1b6b('0xf')]){if(_0x29258a[_0x1b6b('0xf')]['code']===0x1f4){logger[_0x1b6b('0xf')](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')]['message']);return _0x21f403(_0x29258a[_0x1b6b('0xf')]['message']);}logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);return _0x5042f7(_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);}else{logger[_0x1b6b('0x12')](_0x1b6b('0x10'),_0x51cfed,'request\x20sent');_0x5042f7(_0x29258a[_0x1b6b('0x13')][_0x1b6b('0x11')]);}})[_0x1b6b('0x14')](function(_0x33dc7e){logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x33dc7e);_0x21f403(_0x33dc7e);});});}exports[_0x1b6b('0x15')]=function(_0x2e608b){var _0x59e671=this;return new Promise(function(_0x923711,_0x15d44b){return db[_0x1b6b('0x16')][_0x1b6b('0x17')](_0x2e608b[_0x1b6b('0x18')],{'raw':_0x2e608b[_0x1b6b('0x19')]?_0x2e608b[_0x1b6b('0x19')][_0x1b6b('0x1a')]===undefined?!![]:![]:!![]})[_0x1b6b('0xa')](function(_0x20a5a3){logger['info'](_0x1b6b('0x15'),_0x2e608b);logger[_0x1b6b('0xc')](_0x1b6b('0x15'),_0x2e608b,JSON[_0x1b6b('0xe')](_0x20a5a3));_0x923711(_0x20a5a3);})[_0x1b6b('0x14')](function(_0x276713){logger[_0x1b6b('0xf')](_0x1b6b('0x15'),_0x276713[_0x1b6b('0x11')],_0x2e608b);_0x15d44b(_0x59e671['error'](0x1f4,_0x276713[_0x1b6b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ce38a5c..96aba69 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x0b0e,0x187));var _0xe0b0=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x0b0e[_0x54d49e];return _0x4af0f1;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x492246,_0x36a6f7){var _0x21ead7=function(_0x162525){while(--_0x162525){_0x492246['push'](_0x492246['shift']());}};_0x21ead7(++_0x36a6f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b3da3,_0x7e6f6a){_0x4b3da3=_0x4b3da3-0x0;var _0x373c4f=_0xb10b[_0x4b3da3];return _0x373c4f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 4061a18..6f26e5a 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 _0x194c=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','agent','minutes','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','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'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x194c,0x19b));var _0xc194=function(_0x4e8452,_0xf5645a){_0x4e8452=_0x4e8452-0x0;var _0x2b97f4=_0x194c[_0x4e8452];return _0x2b97f4;};'use strict';var passport=require(_0xc194('0x0'));var LocalStrategy=require(_0xc194('0x1'))[_0xc194('0x2')];var moment=require(_0xc194('0x3'));var ActiveDirectory=require(_0xc194('0x4'));var BPromise=require(_0xc194('0x5'));var util=require(_0xc194('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xc194('0x7'));var utils=require(_0xc194('0x8'));var config=require(_0xc194('0x9'));var logger=require(_0xc194('0xa'))(_0xc194('0xb'));function isActiveDirectoryConfigured(_0x330147){var _0x17462b=![];if(typeof _0x330147[_0xc194('0xc')]!==_0xc194('0xd')){_0x17462b=_0x330147[_0xc194('0xc')]['baseDN']&&_0x330147[_0xc194('0xc')]['url']&&_0x330147[_0xc194('0xc')][_0xc194('0xe')];}return _0x17462b;}function adAuthenticate(_0x7a75b9,_0x5bdc73,_0x3f547c){return new BPromise(function(_0x5608d8,_0x52124e){try{var _0x35c2c2=new ActiveDirectory(_0x7a75b9);_0x35c2c2[_0xc194('0xf')](_0x5bdc73,_0x3f547c,function(_0xb8bcd2,_0x585768){if(_0xb8bcd2){logger[_0xc194('0x10')](_0xc194('0x11'),_0x5bdc73,util[_0xc194('0x12')](_0xb8bcd2,{'showHidden':![],'depth':null}));_0x52124e(_0xc194('0x13'));}else if(!_0x585768){logger['error'](_0xc194('0x14'),_0x5bdc73);_0x52124e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5608d8(_0x585768);}});}catch(_0x14920a){_0x52124e(_0x14920a);}});}function ActiveDirectoryAuthenticate(_0x3b832d,_0x4222bd,_0x4ad6c2,_0x46a877){var _0x34a170,_0x4abcc7;if(!isActiveDirectoryConfigured(config)){logger[_0xc194('0x10')](_0xc194('0x15'),_0x4222bd);return _0x46a877(null,![],{'message':_0xc194('0x13')});}return db['Setting'][_0xc194('0x16')]({'where':{'id':0x1},'attributes':[_0xc194('0x17'),_0xc194('0x18')],'raw':!![]})[_0xc194('0x19')](function(_0x16789f){_0x34a170=_0x16789f;if(!_0x34a170[_0xc194('0x17')]){logger['error'](_0xc194('0x1a'),_0x4222bd);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3b832d[_0xc194('0x16')]({'logging':!![],'attributes':['id',_0xc194('0x1b'),_0xc194('0x1c'),_0xc194('0x1d'),_0xc194('0x1e'),_0xc194('0x1f'),_0xc194('0x20'),_0xc194('0x21'),_0xc194('0x22')],'where':{'name':_0x4222bd,'role':{'$or':['admin',_0xc194('0x23'),_0xc194('0x24')]},'adSsoEnabled':!![]}});})['then'](function(_0xdeb133){if(!_0xdeb133||_0xdeb133&&_0xdeb133[_0xc194('0x1b')]!==_0x4222bd){throw new Error(_0xc194('0x13'));}_0x4abcc7=_0xdeb133;var _0x13e98a=_0x4abcc7['name']+'@'+config[_0xc194('0xc')][_0xc194('0xe')];return adAuthenticate(config[_0xc194('0xc')],_0x13e98a,_0x4ad6c2);})[_0xc194('0x19')](function(_0x279adb){if(_0x4abcc7['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x34a170[_0xc194('0x18')]>0x0){if(_0x4abcc7[_0xc194('0x20')]){if(moment(_0x4abcc7[_0xc194('0x21')])['add'](_0x34a170[_0xc194('0x18')],_0xc194('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x4abcc7,0x0,![],null)[_0xc194('0x19')](function(){return utils[_0xc194('0x26')](_0x4abcc7);})['then'](function(){return _0x46a877(null,_0x4abcc7);});}else{return utils[_0xc194('0x26')](_0x4abcc7)['then'](function(){return _0x46a877(null,_0x4abcc7);});}}else{return utils[_0xc194('0x26')](_0x4abcc7)[_0xc194('0x19')](function(){return _0x46a877(null,_0x4abcc7);});}})[_0xc194('0x27')](function(_0x370f90){return _0x46a877(null,![],_0x370f90);});}function handleError(_0x1e30a9,_0x284d89,_0x567d7f){return _0x1e30a9[_0xc194('0x28')](_0x284d89||0x1f4)[_0xc194('0x29')]({'message':_0x567d7f?_0x567d7f['message']||_0x567d7f:''});}exports[_0xc194('0x2a')]=function(_0x364641,_0x9e77a1,_0x2bbb47){passport['authenticate'](_0xc194('0x2b'),function(_0x88598c,_0x54b6e9,_0x19cbbb){var _0x6ebb26=_0x88598c||_0x19cbbb;if(_0x6ebb26){return handleError(_0x9e77a1,0x191,_0x6ebb26);}if(!_0x54b6e9){return handleError(_0x9e77a1,0x194,{'message':_0xc194('0x2c')});}else{var _0x4f335a={'payload':{'id':_0x54b6e9['id'],'role':_0x54b6e9[_0xc194('0x1e')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4f335a)[_0xc194('0x19')](function(_0x45b007){_0x9e77a1[_0xc194('0x2d')]({'id':_0x54b6e9['id'],'token':_0x45b007,'statusCall':'','isAlreadyLogged':_0x54b6e9[_0xc194('0x22')]});});}})(_0x364641,_0x9e77a1,_0x2bbb47);};passport[_0xc194('0x2e')]('ad-login',new LocalStrategy({'usernameField':_0xc194('0x1b'),'passwordField':_0xc194('0x1c')},function(_0x19b599,_0x4a003b,_0xc2cb8e){return ActiveDirectoryAuthenticate(db[_0xc194('0x2f')],_0x19b599,_0x4a003b,_0xc2cb8e);})); \ No newline at end of file +var _0x85bf=['Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','blocked','blockedAt','online','admin','user','agent','name','disabled','add','clearBlockUser','getLicense','catch','status','send','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x38a47d,_0x3ef533){var _0x42c7b1=function(_0x11844d){while(--_0x11844d){_0x38a47d['push'](_0x38a47d['shift']());}};_0x42c7b1(++_0x3ef533);}(_0x85bf,0x183));var _0xf85b=function(_0x358c56,_0x42b5c1){_0x358c56=_0x358c56-0x0;var _0x1eda1f=_0x85bf[_0x358c56];return _0x1eda1f;};'use strict';var passport=require(_0xf85b('0x0'));var LocalStrategy=require(_0xf85b('0x1'))[_0xf85b('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xf85b('0x3'));var db=require(_0xf85b('0x4'))['db'];var authService=require(_0xf85b('0x5'));var utils=require(_0xf85b('0x6'));var config=require(_0xf85b('0x7'));var logger=require('../../config/logger')(_0xf85b('0x8'));function isActiveDirectoryConfigured(_0x4fe13c){var _0x3402cc=![];if(typeof _0x4fe13c[_0xf85b('0x9')]!==_0xf85b('0xa')){_0x3402cc=_0x4fe13c[_0xf85b('0x9')][_0xf85b('0xb')]&&_0x4fe13c[_0xf85b('0x9')]['url']&&_0x4fe13c[_0xf85b('0x9')][_0xf85b('0xc')];}return _0x3402cc;}function adAuthenticate(_0x383124,_0x1d87ea,_0x4023b8){return new BPromise(function(_0x86296a,_0x4161da){try{var _0x143fb2=new ActiveDirectory(_0x383124);_0x143fb2[_0xf85b('0xd')](_0x1d87ea,_0x4023b8,function(_0x14b270,_0x56fff2){if(_0x14b270){logger[_0xf85b('0xe')](_0xf85b('0xf'),_0x1d87ea,util[_0xf85b('0x10')](_0x14b270,{'showHidden':![],'depth':null}));_0x4161da(_0xf85b('0x11'));}else if(!_0x56fff2){logger[_0xf85b('0xe')](_0xf85b('0x12'),_0x1d87ea);_0x4161da(_0xf85b('0x11'));}else{_0x86296a(_0x56fff2);}});}catch(_0x4933a8){_0x4161da(_0x4933a8);}});}function ActiveDirectoryAuthenticate(_0x4a03c0,_0xb7d6fd,_0x1e0c84,_0x4c3b8a){var _0x520753,_0x39c187;if(!isActiveDirectoryConfigured(config)){logger[_0xf85b('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0xb7d6fd);return _0x4c3b8a(null,![],{'message':_0xf85b('0x11')});}return db['Setting'][_0xf85b('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xf85b('0x14')],'raw':!![]})[_0xf85b('0x15')](function(_0xeca01a){_0x520753=_0xeca01a;if(!_0x520753[_0xf85b('0x16')]){logger[_0xf85b('0xe')](_0xf85b('0x17'),_0xb7d6fd);throw new Error(_0xf85b('0x11'));}return _0x4a03c0['findOne']({'logging':!![],'attributes':['id','name',_0xf85b('0x18'),_0xf85b('0x19'),'role','disabled',_0xf85b('0x1a'),_0xf85b('0x1b'),_0xf85b('0x1c')],'where':{'name':_0xb7d6fd,'role':{'$or':[_0xf85b('0x1d'),_0xf85b('0x1e'),_0xf85b('0x1f')]},'adSsoEnabled':!![]}});})['then'](function(_0x4da7a4){if(!_0x4da7a4||_0x4da7a4&&_0x4da7a4[_0xf85b('0x20')]!==_0xb7d6fd){throw new Error(_0xf85b('0x11'));}_0x39c187=_0x4da7a4;var _0x51b477=_0x39c187[_0xf85b('0x20')]+'@'+config[_0xf85b('0x9')]['domain'];return adAuthenticate(config[_0xf85b('0x9')],_0x51b477,_0x1e0c84);})[_0xf85b('0x15')](function(_0x425751){if(_0x39c187[_0xf85b('0x21')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x520753[_0xf85b('0x14')]>0x0){if(_0x39c187[_0xf85b('0x1a')]){if(moment(_0x39c187['blockedAt'])[_0xf85b('0x22')](_0x520753['blockDuration'],'minutes')>moment()){throw new Error(_0xf85b('0x11'));}return utils[_0xf85b('0x23')](_0x39c187,0x0,![],null)['then'](function(){return utils['getLicense'](_0x39c187);})['then'](function(){return _0x4c3b8a(null,_0x39c187);});}else{return utils[_0xf85b('0x24')](_0x39c187)[_0xf85b('0x15')](function(){return _0x4c3b8a(null,_0x39c187);});}}else{return utils[_0xf85b('0x24')](_0x39c187)['then'](function(){return _0x4c3b8a(null,_0x39c187);});}})[_0xf85b('0x25')](function(_0x598dc7){return _0x4c3b8a(null,![],_0x598dc7);});}function handleError(_0x4fc610,_0x27e2e8,_0x51368d){return _0x4fc610[_0xf85b('0x26')](_0x27e2e8||0x1f4)[_0xf85b('0x27')]({'message':_0x51368d?_0x51368d['message']||_0x51368d:''});}exports['login']=function(_0xf643cc,_0x276bd2,_0x5eb5bd){passport[_0xf85b('0xd')](_0xf85b('0x28'),function(_0x3082ce,_0x3a6b25,_0x5592a3){var _0x5962d3=_0x3082ce||_0x5592a3;if(_0x5962d3){return handleError(_0x276bd2,0x191,_0x5962d3);}if(!_0x3a6b25){return handleError(_0x276bd2,0x194,{'message':_0xf85b('0x29')});}else{var _0x124de1={'payload':{'id':_0x3a6b25['id'],'role':_0x3a6b25['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x124de1)['then'](function(_0x16f13b){_0x276bd2[_0xf85b('0x2a')]({'id':_0x3a6b25['id'],'token':_0x16f13b,'statusCall':'','isAlreadyLogged':_0x3a6b25[_0xf85b('0x1c')]});});}})(_0xf643cc,_0x276bd2,_0x5eb5bd);};passport[_0xf85b('0x2b')](_0xf85b('0x28'),new LocalStrategy({'usernameField':_0xf85b('0x20'),'passwordField':'password'},function(_0x42ae6c,_0x356c9c,_0xbdccef){return ActiveDirectoryAuthenticate(db[_0xf85b('0x2c')],_0x42ae6c,_0x356c9c,_0xbdccef);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index d2acb13..b80522d 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 _0xf6eb=['express','login','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf6eb,0xb4));var _0xbf6e=function(_0x290700,_0x22b692){_0x290700=_0x290700-0x0;var _0x1cd47d=_0xf6eb[_0x290700];return _0x1cd47d;};'use strict';var express=require(_0xbf6e('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0xbf6e('0x1')]);module[_0xbf6e('0x2')]=router; \ No newline at end of file +var _0x2fdd=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x597eb2,_0x165f5c){var _0x56875f=function(_0x5de36e){while(--_0x5de36e){_0x597eb2['push'](_0x597eb2['shift']());}};_0x56875f(++_0x165f5c);}(_0x2fdd,0x128));var _0xd2fd=function(_0x52b921,_0x6b550f){_0x52b921=_0x52b921-0x0;var _0x1cd63d=_0x2fdd[_0x52b921];return _0x1cd63d;};'use strict';var express=require(_0xd2fd('0x0'));var router=express[_0xd2fd('0x1')]();var controller=require(_0xd2fd('0x2'));router[_0xd2fd('0x3')]('/',controller[_0xd2fd('0x4')]);module[_0xd2fd('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 6f5d2b3..0170ce7 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(_0x4ff94f,_0x14c098){var _0x446781=function(_0x30372e){while(--_0x30372e){_0x4ff94f['push'](_0x4ff94f['shift']());}};_0x446781(++_0x14c098);}(_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(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x7a54,0x106));var _0x47a5=function(_0xd7a9c2,_0x26baaf){_0xd7a9c2=_0xd7a9c2-0x0;var _0x5852b3=_0x7a54[_0xd7a9c2];return _0x5852b3;};'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 5ebb8a5..638a657 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 _0xea1c=['callback','isMiddleware','setTokenCookie','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0xea1c,0xc1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var passport=require(_0xcea1('0x0'));var router=express[_0xcea1('0x1')]();var controller=require(_0xcea1('0x2'));var userController=require(_0xcea1('0x3'));var authService=require(_0xcea1('0x4'));router['get']('/',controller[_0xcea1('0x5')]);router[_0xcea1('0x6')]('/callback',controller[_0xcea1('0x7')],authService[_0xcea1('0x8')],userController[_0xcea1('0x5')],authService[_0xcea1('0x9')]);module['exports']=router; \ No newline at end of file +var _0xecea=['/callback','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login'];(function(_0x1e3719,_0x3056b3){var _0x56c560=function(_0x42e396){while(--_0x42e396){_0x1e3719['push'](_0x1e3719['shift']());}};_0x56c560(++_0x3056b3);}(_0xecea,0x7d));var _0xaece=function(_0x5af593,_0x2461f2){_0x5af593=_0x5af593-0x0;var _0x3422e0=_0xecea[_0x5af593];return _0x3422e0;};'use strict';var express=require(_0xaece('0x0'));var passport=require(_0xaece('0x1'));var router=express['Router']();var controller=require(_0xaece('0x2'));var userController=require(_0xaece('0x3'));var authService=require(_0xaece('0x4'));router[_0xaece('0x5')]('/',controller[_0xaece('0x6')]);router[_0xaece('0x5')](_0xaece('0x7'),controller['callback'],authService[_0xaece('0x8')],userController[_0xaece('0x6')],authService[_0xaece('0x9')]);module[_0xaece('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 43f6564..c8ebab2 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 _0x781e=['blocked','admin','user','agent','loginAttempts','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','catch','find','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','disabled'];(function(_0x3560de,_0x28b150){var _0x2d31c1=function(_0x1c13d9){while(--_0x1c13d9){_0x3560de['push'](_0x3560de['shift']());}};_0x2d31c1(++_0x28b150);}(_0x781e,0xda));var _0xe781=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x781e[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xe781('0x0'));var passport=require(_0xe781('0x1'));var LocalStrategy=require('passport-local')[_0xe781('0x2')];var jayson=require(_0xe781('0x3'));var _=require('lodash');var rs=require(_0xe781('0x4'));var moment=require(_0xe781('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0xe781('0x6'));var utils=require(_0xe781('0x7'));var client=jayson[_0xe781('0x8')][_0xe781('0x9')]({'port':0x232b});function localAuthenticate(_0x385920,_0x536217,_0x14b27e,_0x16e9bd){var _0x4ee18d,_0x12c128;return db[_0xe781('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xe781('0xb'),_0xe781('0xc')],'raw':!![]})[_0xe781('0xd')](function(_0x3bd40b){_0x4ee18d=_0x3bd40b;return _0x385920[_0xe781('0xe')]({'attributes':['id',_0xe781('0xf'),_0xe781('0x10'),_0xe781('0x11'),'role',_0xe781('0x12'),_0xe781('0x13'),'blockedAt','loginAttempts'],'where':{'name':_0x536217,'role':{'$or':[_0xe781('0x14'),_0xe781('0x15'),_0xe781('0x16')]}}});})[_0xe781('0xd')](function(_0x302319){if(!_0x302319||_0x302319&&_0x302319[_0xe781('0xf')]!==_0x536217){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x12c128=_0x302319;return _0x12c128;}})[_0xe781('0xd')](function(){_0x12c128['authenticate'](_0x14b27e,function(_0x58177d,_0x217032){var _0x37472e=_0x12c128[_0xe781('0x17')]+0x1;if(_0x58177d){return _0x16e9bd(_0x58177d);}else if(!_0x217032){if(_0x12c128['disabled']){return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ee18d[_0xe781('0xb')]>0x0){if(_0x12c128[_0xe781('0x13')]){if(_0x4ee18d[_0xe781('0xc')]>0x0){if(moment(_0x12c128[_0xe781('0x18')])[_0xe781('0x19')](_0x4ee18d[_0xe781('0xc')],_0xe781('0x1a'))>moment()){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}else{return utils[_0xe781('0x1c')](_0x12c128,_0x37472e,![],null)['then'](function(){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});});}}else{return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}}else{if(_0x37472e>=_0x4ee18d[_0xe781('0xb')]){return utils[_0xe781('0x1c')](_0x12c128,0x0,!![],moment())[_0xe781('0xd')](function(){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});});}else{return utils[_0xe781('0x1c')](_0x12c128,_0x37472e,![],null)[_0xe781('0xd')](function(){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});});}}}else{return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x12c128[_0xe781('0x12')]){return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ee18d['allowedLoginAttempts']>0x0){if(_0x12c128[_0xe781('0x13')]){if(_0x4ee18d[_0xe781('0xc')]>0x0){if(moment(_0x12c128[_0xe781('0x18')])[_0xe781('0x19')](_0x4ee18d[_0xe781('0xc')],_0xe781('0x1a'))>moment()){return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x12c128,0x0,![],null)[_0xe781('0xd')](function(){return utils[_0xe781('0x1d')](_0x12c128);})['then'](function(){return _0x16e9bd(null,_0x12c128);});}}else{return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}}else{return utils[_0xe781('0x1c')](_0x12c128,0x0,![],null)[_0xe781('0xd')](function(){return utils['getLicense'](_0x12c128);})[_0xe781('0xd')](function(){return _0x16e9bd(null,_0x12c128);})['catch'](function(_0x5ea9b8){return _0x16e9bd(null,![],_0x5ea9b8);});}}else{if(_0x12c128['blocked']){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}else{return utils['getLicense'](_0x12c128)[_0xe781('0xd')](function(){return _0x16e9bd(null,_0x12c128);});}}}});})['catch'](function(_0x188a44){return _0x16e9bd(null,![],_0x188a44);});}function sendServiceMail(_0x26e6ec){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id','name',_0xe781('0x1e')],'include':[{'model':db[_0xe781('0x1f')],'as':_0xe781('0x20'),'include':[{'model':db[_0xe781('0x21')],'as':'CloudProvider'}]}]})['then'](function(_0x366f6f){if(!_0x366f6f){throw new Error(_0xe781('0x22'));}var _0x3adf36=_0x366f6f['getSmtpOptions']();var _0xd58a56={'account':_0x3adf36,'message':_[_0xe781('0x23')]({'from':util[_0xe781('0x24')](_0xe781('0x25'),_0x366f6f[_0xe781('0xf')],_0x366f6f[_0xe781('0x1e')]||_0x366f6f['Smtp']['user'])},_0x26e6ec)};return client[_0xe781('0x26')](_0xe781('0x27'),_0xd58a56);})[_0xe781('0xd')](function(_0x29c834){if(_0x29c834[_0xe781('0x28')]){throw new Error(util['format'](_0xe781('0x29'),_0x29c834[_0xe781('0x28')][_0xe781('0x2a')]||JSON['stringify'](_0x29c834[_0xe781('0x28')])));}return!![];});}function handleError(_0x3bdc9e,_0x204b9a,_0x431292){return _0x3bdc9e[_0xe781('0x2b')](_0x204b9a||0x1f4)[_0xe781('0x2c')]({'message':_0x431292?_0x431292[_0xe781('0x2a')]||_0x431292:''});}exports[_0xe781('0x2d')]=function(_0x3eaa2c,_0x16dc43,_0x4ff6fa){passport[_0xe781('0x2e')](_0xe781('0x2f'),function(_0x2311b4,_0x7115f,_0x2b87fe){var _0x512581=_0x2311b4||_0x2b87fe;if(_0x512581){return handleError(_0x16dc43,0x191,_0x512581);}if(!_0x7115f){return handleError(_0x16dc43,0x194,{'message':_0xe781('0x30')});}else{var _0x8d7a26={'payload':{'id':_0x7115f['id'],'role':_0x7115f['role']},'options':{'expiresIn':0x15180}};return authService[_0xe781('0x31')](_0x8d7a26)[_0xe781('0xd')](function(_0x160b33){_0x16dc43[_0xe781('0x32')]({'id':_0x7115f['id'],'token':_0x160b33,'statusCall':'','isAlreadyLogged':_0x7115f['online']});});}})(_0x3eaa2c,_0x16dc43,_0x4ff6fa);};exports['forgot']=function(_0x4f9781,_0x5cc8e4){if(!_0x4f9781[_0xe781('0x33')][_0xe781('0x1e')]){return handleError(_0x5cc8e4,0x1f4,{'message':_0xe781('0x34')});}var _0x40b9d3=rs[_0xe781('0x35')]();_0x4f9781[_0xe781('0x33')][_0xe781('0x1e')]=_0x4f9781[_0xe781('0x33')][_0xe781('0x1e')][_0xe781('0x36')]()['toLowerCase']();var _0x55cdae;return db[_0xe781('0xa')][_0xe781('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe781('0xc')],'raw':!![]})[_0xe781('0xd')](function(_0x2c9560){_0x55cdae=_0x2c9560;return db[_0xe781('0x37')]['find']({'where':{'email':_0x4f9781['body'][_0xe781('0x1e')]}});})['then'](function(_0x519546){if(!_0x519546){throw new Error(_0xe781('0x38'));}if(_0x519546[_0xe781('0x12')]){throw new Error(_0xe781('0x39'));}if(_0x519546['blocked']){if(moment(_0x519546[_0xe781('0x18')])['add'](_0x55cdae['blockDuration'],'minutes')>moment()){throw new Error(_0xe781('0x3a'));}else{_0x519546[_0xe781('0x13')]=![];_0x519546[_0xe781('0x18')]=null;}}_0x519546[_0xe781('0x3b')]=_0x40b9d3;_0x519546['resetPasswordExpires']=Date[_0xe781('0x3c')]()+0x36ee80;return _0x519546[_0xe781('0x3d')]();})[_0xe781('0xd')](function(){return sendServiceMail({'to':_0x4f9781['body'][_0xe781('0x1e')],'subject':_0xe781('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xe781('0x3f')+_0xe781('0x40')+_0x4f9781['headers'][_0xe781('0x41')]+_0xe781('0x42')+_0x40b9d3+'\x0a\x0a'+_0xe781('0x43')});})[_0xe781('0xd')](function(){_0x5cc8e4[_0xe781('0x2b')](0xc8)[_0xe781('0x2c')]({'message':'Reset\x20Email\x20sent!'});})[_0xe781('0x44')](function(_0x3534f3){return handleError(_0x5cc8e4,0x1f4,_0x3534f3);});};exports['reset']=function(_0x23cb34,_0x21c9e7){return db['User'][_0xe781('0x45')]({'where':{'resetPasswordToken':_0x23cb34['params'][_0xe781('0x46')],'resetPasswordExpires':{'$gt':Date[_0xe781('0x3c')]()}}})[_0xe781('0xd')](function(_0x2689ff){if(!_0x2689ff){throw new Error(_0xe781('0x47'));}return db['Setting'][_0xe781('0xe')]({'attributes':['id',_0xe781('0x48'),_0xe781('0x49'),'passwordHistoryLimit']})[_0xe781('0xd')](function(_0xd397d4){if(_0xd397d4[_0xe781('0x48')])authService[_0xe781('0x4a')](_0x23cb34[_0xe781('0x33')][_0xe781('0x10')]);if(!_0xd397d4['enforcePasswordHistory']||!_0x2689ff[_0xe781('0x4b')])return _0x2689ff;authService['validatePasswordHistory'](_0x23cb34['body'][_0xe781('0x10')],_0x2689ff['previousPasswords'],_0xd397d4[_0xe781('0x4c')]);return _0x2689ff;})[_0xe781('0xd')](function(){_0x2689ff[_0xe781('0x10')]=_0x23cb34[_0xe781('0x33')][_0xe781('0x10')];_0x2689ff[_0xe781('0x3b')]=null;_0x2689ff['resetPasswordExpires']=null;return _0x2689ff[_0xe781('0x3d')]();});})[_0xe781('0xd')](function(){_0x21c9e7[_0xe781('0x2b')](0xc8)[_0xe781('0x2c')]({'message':_0xe781('0x4d')});})[_0xe781('0x44')](function(_0x822bcc){return handleError(_0x21c9e7,0x1f4,_0x822bcc);});};passport[_0xe781('0x4e')](_0xe781('0x2f'),new LocalStrategy({'usernameField':_0xe781('0xf'),'passwordField':_0xe781('0x10')},function(_0x52ad35,_0x1c538d,_0x81b56c){return localAuthenticate(db[_0xe781('0x37')],_0x52ad35,_0x1c538d,_0x81b56c);})); \ No newline at end of file +var _0xcc9e=['token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','http','Setting','allowedLoginAttempts','then','password','disabled','blocked','blockedAt','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockDuration','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','email','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','forgot','body','Email\x20parameter\x20is\x20missing','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','status','Reset\x20Email\x20sent!','reset','params'];(function(_0x15d913,_0x51cf7a){var _0x4ae65e=function(_0x2f39a1){while(--_0x2f39a1){_0x15d913['push'](_0x15d913['shift']());}};_0x4ae65e(++_0x51cf7a);}(_0xcc9e,0x13a));var _0xecc9=function(_0x12fbe1,_0x4b9cb6){_0x12fbe1=_0x12fbe1-0x0;var _0x5a6043=_0xcc9e[_0x12fbe1];return _0x5a6043;};'use strict';var util=require(_0xecc9('0x0'));var passport=require('passport');var LocalStrategy=require(_0xecc9('0x1'))[_0xecc9('0x2')];var jayson=require('jayson/promise');var _=require(_0xecc9('0x3'));var rs=require(_0xecc9('0x4'));var moment=require(_0xecc9('0x5'));var db=require(_0xecc9('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson['client'][_0xecc9('0x7')]({'port':0x232b});function localAuthenticate(_0xf467b6,_0x5cafc8,_0x5619ad,_0x3d6975){var _0x1bfc7a,_0x40fe70;return db[_0xecc9('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0xecc9('0x9'),'blockDuration'],'raw':!![]})[_0xecc9('0xa')](function(_0x21210d){_0x1bfc7a=_0x21210d;return _0xf467b6['findOne']({'attributes':['id','name',_0xecc9('0xb'),'salt','role',_0xecc9('0xc'),_0xecc9('0xd'),_0xecc9('0xe'),'loginAttempts'],'where':{'name':_0x5cafc8,'role':{'$or':['admin','user',_0xecc9('0xf')]}}});})['then'](function(_0x59ac94){if(!_0x59ac94||_0x59ac94&&_0x59ac94[_0xecc9('0x10')]!==_0x5cafc8){throw new Error(_0xecc9('0x11'));}else{_0x40fe70=_0x59ac94;return _0x40fe70;}})[_0xecc9('0xa')](function(){_0x40fe70[_0xecc9('0x12')](_0x5619ad,function(_0x585beb,_0x5b88dc){var _0x2a1d1a=_0x40fe70[_0xecc9('0x13')]+0x1;if(_0x585beb){return _0x3d6975(_0x585beb);}else if(!_0x5b88dc){if(_0x40fe70[_0xecc9('0xc')]){return _0x3d6975(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1bfc7a['allowedLoginAttempts']>0x0){if(_0x40fe70['blocked']){if(_0x1bfc7a[_0xecc9('0x14')]>0x0){if(moment(_0x40fe70[_0xecc9('0xe')])[_0xecc9('0x15')](_0x1bfc7a[_0xecc9('0x14')],_0xecc9('0x16'))>moment()){return _0x3d6975(null,![],{'message':_0xecc9('0x11')});}else{return utils[_0xecc9('0x17')](_0x40fe70,_0x2a1d1a,![],null)[_0xecc9('0xa')](function(){return _0x3d6975(null,![],{'message':_0xecc9('0x11')});});}}else{return _0x3d6975(null,![],{'message':_0xecc9('0x11')});}}else{if(_0x2a1d1a>=_0x1bfc7a[_0xecc9('0x9')]){return utils['clearBlockUser'](_0x40fe70,0x0,!![],moment())[_0xecc9('0xa')](function(){return _0x3d6975(null,![],{'message':_0xecc9('0x11')});});}else{return utils[_0xecc9('0x17')](_0x40fe70,_0x2a1d1a,![],null)[_0xecc9('0xa')](function(){return _0x3d6975(null,![],{'message':_0xecc9('0x11')});});}}}else{return _0x3d6975(null,![],{'message':_0xecc9('0x11')});}}else{if(_0x40fe70['disabled']){return _0x3d6975(null,![],{'message':_0xecc9('0x11')});}else if(_0x1bfc7a[_0xecc9('0x9')]>0x0){if(_0x40fe70['blocked']){if(_0x1bfc7a['blockDuration']>0x0){if(moment(_0x40fe70['blockedAt'])[_0xecc9('0x15')](_0x1bfc7a['blockDuration'],_0xecc9('0x16'))>moment()){return _0x3d6975(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xecc9('0x17')](_0x40fe70,0x0,![],null)['then'](function(){return utils[_0xecc9('0x18')](_0x40fe70);})[_0xecc9('0xa')](function(){return _0x3d6975(null,_0x40fe70);});}}else{return _0x3d6975(null,![],{'message':_0xecc9('0x11')});}}else{return utils[_0xecc9('0x17')](_0x40fe70,0x0,![],null)[_0xecc9('0xa')](function(){return utils['getLicense'](_0x40fe70);})[_0xecc9('0xa')](function(){return _0x3d6975(null,_0x40fe70);})[_0xecc9('0x19')](function(_0x4d51ea){return _0x3d6975(null,![],_0x4d51ea);});}}else{if(_0x40fe70[_0xecc9('0xd')]){return _0x3d6975(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xecc9('0x18')](_0x40fe70)[_0xecc9('0xa')](function(){return _0x3d6975(null,_0x40fe70);});}}}});})[_0xecc9('0x19')](function(_0x3ac5e6){return _0x3d6975(null,![],_0x3ac5e6);});}function sendServiceMail(_0x19a633){return db['MailAccount'][_0xecc9('0x1a')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xecc9('0x1b')],'as':'Smtp','include':[{'model':db[_0xecc9('0x1c')],'as':'CloudProvider'}]}]})[_0xecc9('0xa')](function(_0x5b1bff){if(!_0x5b1bff){throw new Error(_0xecc9('0x1d'));}var _0x4e64cf=_0x5b1bff['getSmtpOptions']();var _0x1904d7={'account':_0x4e64cf,'message':_[_0xecc9('0x1e')]({'from':util[_0xecc9('0x1f')]('\x22%s\x22\x20<%s>',_0x5b1bff[_0xecc9('0x10')],_0x5b1bff[_0xecc9('0x20')]||_0x5b1bff[_0xecc9('0x21')]['user'])},_0x19a633)};return client[_0xecc9('0x22')](_0xecc9('0x23'),_0x1904d7);})[_0xecc9('0xa')](function(_0x1d2731){if(_0x1d2731[_0xecc9('0x24')]){throw new Error(util[_0xecc9('0x1f')](_0xecc9('0x25'),_0x1d2731[_0xecc9('0x24')]['message']||JSON[_0xecc9('0x26')](_0x1d2731[_0xecc9('0x24')])));}return!![];});}function handleError(_0x10000a,_0x29a160,_0x128203){return _0x10000a['status'](_0x29a160||0x1f4)[_0xecc9('0x27')]({'message':_0x128203?_0x128203[_0xecc9('0x28')]||_0x128203:''});}exports[_0xecc9('0x29')]=function(_0x21c0b1,_0x3491b8,_0x4a211f){passport['authenticate'](_0xecc9('0x2a'),function(_0x10f68e,_0x4f553a,_0x9ed9c8){var _0x3dab2b=_0x10f68e||_0x9ed9c8;if(_0x3dab2b){return handleError(_0x3491b8,0x191,_0x3dab2b);}if(!_0x4f553a){return handleError(_0x3491b8,0x194,{'message':_0xecc9('0x2b')});}else{var _0x23da0d={'payload':{'id':_0x4f553a['id'],'role':_0x4f553a[_0xecc9('0x2c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x23da0d)[_0xecc9('0xa')](function(_0x1df114){_0x3491b8[_0xecc9('0x2d')]({'id':_0x4f553a['id'],'token':_0x1df114,'statusCall':'','isAlreadyLogged':_0x4f553a[_0xecc9('0x2e')]});});}})(_0x21c0b1,_0x3491b8,_0x4a211f);};exports[_0xecc9('0x2f')]=function(_0x4cc0e6,_0x553d52){if(!_0x4cc0e6[_0xecc9('0x30')][_0xecc9('0x20')]){return handleError(_0x553d52,0x1f4,{'message':_0xecc9('0x31')});}var _0x5270d6=rs['generate']();_0x4cc0e6[_0xecc9('0x30')][_0xecc9('0x20')]=_0x4cc0e6[_0xecc9('0x30')][_0xecc9('0x20')]['trim']()['toLowerCase']();var _0x8a6687;return db['Setting'][_0xecc9('0x32')]({'where':{'id':0x1},'attributes':[_0xecc9('0x9'),'blockDuration'],'raw':!![]})['then'](function(_0x2cd0db){_0x8a6687=_0x2cd0db;return db[_0xecc9('0x33')][_0xecc9('0x1a')]({'where':{'email':_0x4cc0e6['body'][_0xecc9('0x20')]}});})['then'](function(_0x5329de){if(!_0x5329de){throw new Error(_0xecc9('0x34'));}if(_0x5329de[_0xecc9('0xc')]){throw new Error(_0xecc9('0x35'));}if(_0x5329de[_0xecc9('0xd')]){if(moment(_0x5329de[_0xecc9('0xe')])[_0xecc9('0x15')](_0x8a6687[_0xecc9('0x14')],_0xecc9('0x16'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x5329de[_0xecc9('0xd')]=![];_0x5329de[_0xecc9('0xe')]=null;}}_0x5329de['resetPasswordToken']=_0x5270d6;_0x5329de[_0xecc9('0x36')]=Date['now']()+0x36ee80;return _0x5329de[_0xecc9('0x37')]();})[_0xecc9('0xa')](function(){return sendServiceMail({'to':_0x4cc0e6[_0xecc9('0x30')]['email'],'subject':_0xecc9('0x38'),'text':_0xecc9('0x39')+_0xecc9('0x3a')+_0xecc9('0x3b')+_0x4cc0e6[_0xecc9('0x3c')][_0xecc9('0x3d')]+'/reset/'+_0x5270d6+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xecc9('0xa')](function(){_0x553d52[_0xecc9('0x3e')](0xc8)[_0xecc9('0x27')]({'message':_0xecc9('0x3f')});})[_0xecc9('0x19')](function(_0x319568){return handleError(_0x553d52,0x1f4,_0x319568);});};exports[_0xecc9('0x40')]=function(_0x1c6f05,_0x2be612){return db[_0xecc9('0x33')][_0xecc9('0x1a')]({'where':{'resetPasswordToken':_0x1c6f05[_0xecc9('0x41')][_0xecc9('0x42')],'resetPasswordExpires':{'$gt':Date[_0xecc9('0x43')]()}}})['then'](function(_0xb2bac){if(!_0xb2bac){throw new Error(_0xecc9('0x44'));}return db[_0xecc9('0x8')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0xecc9('0x45')]})[_0xecc9('0xa')](function(_0x10ee73){if(_0x10ee73[_0xecc9('0x46')])authService[_0xecc9('0x47')](_0x1c6f05[_0xecc9('0x30')][_0xecc9('0xb')]);if(!_0x10ee73['enforcePasswordHistory']||!_0xb2bac[_0xecc9('0x48')])return _0xb2bac;authService[_0xecc9('0x49')](_0x1c6f05['body'][_0xecc9('0xb')],_0xb2bac[_0xecc9('0x48')],_0x10ee73[_0xecc9('0x45')]);return _0xb2bac;})['then'](function(){_0xb2bac['password']=_0x1c6f05[_0xecc9('0x30')][_0xecc9('0xb')];_0xb2bac['resetPasswordToken']=null;_0xb2bac[_0xecc9('0x36')]=null;return _0xb2bac[_0xecc9('0x37')]();});})['then'](function(){_0x2be612[_0xecc9('0x3e')](0xc8)[_0xecc9('0x27')]({'message':_0xecc9('0x4a')});})[_0xecc9('0x19')](function(_0x118414){return handleError(_0x2be612,0x1f4,_0x118414);});};passport[_0xecc9('0x4b')](_0xecc9('0x2a'),new LocalStrategy({'usernameField':_0xecc9('0x10'),'passwordField':_0xecc9('0xb')},function(_0xc2ec26,_0x4b3b94,_0x2505b8){return localAuthenticate(db[_0xecc9('0x33')],_0xc2ec26,_0x4b3b94,_0x2505b8);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 64dfe63..d57a185 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 _0x22e0=['/forgot','forgot','/reset/:token','reset','exports','express','Router','login'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x22e0,0xa5));var _0x022e=function(_0x1953e7,_0x20a3d9){_0x1953e7=_0x1953e7-0x0;var _0x3b3d49=_0x22e0[_0x1953e7];return _0x3b3d49;};'use strict';var express=require(_0x022e('0x0'));var router=express[_0x022e('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0x022e('0x2')]);router['post'](_0x022e('0x3'),controller[_0x022e('0x4')]);router['post'](_0x022e('0x5'),controller[_0x022e('0x6')]);module[_0x022e('0x7')]=router; \ No newline at end of file +var _0x4ccc=['express','post','login','/forgot','forgot','/reset/:token','reset','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ccc,0xc0));var _0xc4cc=function(_0x1ac2ab,_0x1f65a2){_0x1ac2ab=_0x1ac2ab-0x0;var _0x5c6291=_0x4ccc[_0x1ac2ab];return _0x5c6291;};'use strict';var express=require(_0xc4cc('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0xc4cc('0x1')]('/',controller[_0xc4cc('0x2')]);router[_0xc4cc('0x1')](_0xc4cc('0x3'),controller[_0xc4cc('0x4')]);router[_0xc4cc('0x1')](_0xc4cc('0x5'),controller[_0xc4cc('0x6')]);module[_0xc4cc('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 83580b3..f1c9c6c 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 _0xb2ed=['STRING','BOOLEAN','INTEGER'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xb2ed,0xc0));var _0xdb2e=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xb2ed[_0x5317b5];return _0x3b7ce2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdb2e('0x0')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb2e('0x0')]},'status':{'type':Sequelize[_0xdb2e('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xdb2e('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7d1d=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x1c13d7,_0x3932d9){var _0x185346=function(_0x39b5ff){while(--_0x39b5ff){_0x1c13d7['push'](_0x1c13d7['shift']());}};_0x185346(++_0x3932d9);}(_0x7d1d,0x66));var _0xd7d1=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x7d1d[_0x29df9a];return _0x3a8e96;};'use strict';var Sequelize=require(_0xd7d1('0x0'));module[_0xd7d1('0x1')]={'name':{'type':Sequelize[_0xd7d1('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xd7d1('0x2')]},'description':{'type':Sequelize[_0xd7d1('0x2')]},'status':{'type':Sequelize[_0xd7d1('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd7d1('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 0bb0aad..46616b7 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 _0x8068=['Condition','pick','getConditions','hasOwnProperty','addActions','Action','getActions','findOne','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','options','count','include','findAll','rows','catch','params','rawAttributes','includeAll','merge','create','body','destroy','find','addConditions','ids','omit'];(function(_0x54fb7a,_0x24dc21){var _0x981a80=function(_0x40324f){while(--_0x40324f){_0x54fb7a['push'](_0x54fb7a['shift']());}};_0x981a80(++_0x24dc21);}(_0x8068,0x15d));var _0x8806=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x8068[_0x333fc8];return _0x432439;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8806('0x0'));var zipdir=require(_0x8806('0x1'));var jsonpatch=require(_0x8806('0x2'));var rp=require(_0x8806('0x3'));var moment=require(_0x8806('0x4'));var BPromise=require(_0x8806('0x5'));var Mustache=require('mustache');var util=require(_0x8806('0x6'));var path=require('path');var sox=require(_0x8806('0x7'));var csv=require(_0x8806('0x8'));var ejs=require(_0x8806('0x9'));var fs=require('fs');var fs_extra=require(_0x8806('0xa'));var _=require(_0x8806('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8806('0xc'));var deskjs=require(_0x8806('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8806('0xe'));var Redis=require(_0x8806('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8806('0x10'));var as=require(_0x8806('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8806('0x12'))(_0x8806('0x13'));var utils=require(_0x8806('0x14'));var config=require(_0x8806('0x15'));var licenseUtil=require(_0x8806('0x16'));var db=require(_0x8806('0x17'))['db'];function respondWithStatusCode(_0x4858f0,_0x40453e){_0x40453e=_0x40453e||0xcc;return function(_0x1c9718){if(_0x1c9718){return _0x4858f0['sendStatus'](_0x40453e);}return _0x4858f0['status'](_0x40453e)[_0x8806('0x18')]();};}function respondWithResult(_0x1e56f2,_0x467360){_0x467360=_0x467360||0xc8;return function(_0x4171d1){if(_0x4171d1){return _0x1e56f2[_0x8806('0x19')](_0x467360)[_0x8806('0x1a')](_0x4171d1);}};}function respondWithFilteredResult(_0x1dbcc6,_0x53601e){return function(_0x139b81){if(_0x139b81){var _0x4ff617=typeof _0x53601e[_0x8806('0x1b')]===_0x8806('0x1c')&&typeof _0x53601e[_0x8806('0x1d')]===_0x8806('0x1c');var _0x47c869=_0x139b81['count'];var _0x5355ea=_0x4ff617?0x0:_0x53601e[_0x8806('0x1b')];var _0x50e741=_0x4ff617?_0x139b81['count']:_0x53601e[_0x8806('0x1b')]+_0x53601e['limit'];var _0x4f337d;if(_0x50e741>=_0x47c869){_0x50e741=_0x47c869;_0x4f337d=0xc8;}else{_0x4f337d=0xce;}_0x1dbcc6[_0x8806('0x19')](_0x4f337d);return _0x1dbcc6['set'](_0x8806('0x1e'),_0x5355ea+'-'+_0x50e741+'/'+_0x47c869)[_0x8806('0x1a')](_0x139b81);}return null;};}function patchUpdates(_0x4baca6){return function(_0x4db274){try{jsonpatch[_0x8806('0x1f')](_0x4db274,_0x4baca6,!![]);}catch(_0x3afeea){return BPromise[_0x8806('0x20')](_0x3afeea);}return _0x4db274[_0x8806('0x21')]();};}function saveUpdates(_0x3087c2,_0x734e44){return function(_0x19c3bd){if(_0x19c3bd){return _0x19c3bd[_0x8806('0x22')](_0x3087c2)[_0x8806('0x23')](function(_0x292534){return _0x292534;});}return null;};}function removeEntity(_0xe736dd,_0x38031b){return function(_0x5e7c72){if(_0x5e7c72){return _0x5e7c72['destroy']()[_0x8806('0x23')](function(){_0xe736dd[_0x8806('0x19')](0xcc)[_0x8806('0x18')]();});}};}function handleEntityNotFound(_0x13f220,_0x58709c){return function(_0x24abfa){if(!_0x24abfa){_0x13f220[_0x8806('0x24')](0x194);}return _0x24abfa;};}function handleError(_0x134eb6,_0x2dddfb){_0x2dddfb=_0x2dddfb||0x1f4;return function(_0x4b459c){logger['error'](_0x4b459c[_0x8806('0x25')]);if(_0x4b459c['name']){delete _0x4b459c[_0x8806('0x26')];}_0x134eb6[_0x8806('0x19')](_0x2dddfb)[_0x8806('0x27')](_0x4b459c);};}exports[_0x8806('0x28')]=function(_0x570f3b,_0x177268){var _0x4786c8={},_0x4e06b6={},_0x115cf4={'count':0x0,'rows':[]};var _0x8210c=_[_0x8806('0x29')](db[_0x8806('0x2a')]['rawAttributes'],function(_0x126f00){return{'name':_0x126f00[_0x8806('0x2b')],'type':_0x126f00[_0x8806('0x2c')][_0x8806('0x2d')]};});_0x4e06b6[_0x8806('0x2e')]=_[_0x8806('0x29')](_0x8210c,_0x8806('0x26'));_0x4e06b6[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x570f3b['query']);_0x4e06b6[_0x8806('0x31')]=_[_0x8806('0x32')](_0x4e06b6[_0x8806('0x2e')],_0x4e06b6['query']);_0x4786c8[_0x8806('0x33')]=_[_0x8806('0x32')](_0x4e06b6[_0x8806('0x2e')],qs[_0x8806('0x34')](_0x570f3b[_0x8806('0x2f')][_0x8806('0x34')]));_0x4786c8[_0x8806('0x33')]=_0x4786c8[_0x8806('0x33')][_0x8806('0x35')]?_0x4786c8[_0x8806('0x33')]:_0x4e06b6[_0x8806('0x2e')];if(!_0x570f3b['query']['hasOwnProperty'](_0x8806('0x36'))){_0x4786c8[_0x8806('0x1d')]=qs['limit'](_0x570f3b[_0x8806('0x2f')]['limit']);_0x4786c8[_0x8806('0x1b')]=qs[_0x8806('0x1b')](_0x570f3b['query']['offset']);}_0x4786c8['order']=qs[_0x8806('0x37')](_0x570f3b['query'][_0x8806('0x37')]);_0x4786c8[_0x8806('0x38')]=qs[_0x8806('0x31')](_['pick'](_0x570f3b[_0x8806('0x2f')],_0x4e06b6['filters']),_0x8210c);if(_0x570f3b['query'][_0x8806('0x39')]){_0x4786c8[_0x8806('0x38')]=_['merge'](_0x4786c8[_0x8806('0x38')],{'$or':_[_0x8806('0x29')](_0x8210c,function(_0x42acf8){if(_0x42acf8[_0x8806('0x2c')]!==_0x8806('0x3a')){var _0x4f0d33={};_0x4f0d33[_0x42acf8[_0x8806('0x26')]]={'$like':'%'+_0x570f3b[_0x8806('0x2f')][_0x8806('0x39')]+'%'};return _0x4f0d33;}})});}_0x4786c8=_['merge']({},_0x4786c8,_0x570f3b[_0x8806('0x3b')]);var _0x5d3ac7={'where':_0x4786c8['where']};return db['Automation'][_0x8806('0x3c')](_0x5d3ac7)[_0x8806('0x23')](function(_0x453419){_0x115cf4[_0x8806('0x3c')]=_0x453419;if(_0x570f3b[_0x8806('0x2f')]['includeAll']){_0x4786c8[_0x8806('0x3d')]=[{'all':!![]}];}return db[_0x8806('0x2a')][_0x8806('0x3e')](_0x4786c8);})[_0x8806('0x23')](function(_0x19f8a0){_0x115cf4[_0x8806('0x3f')]=_0x19f8a0;return _0x115cf4;})['then'](respondWithFilteredResult(_0x177268,_0x4786c8))[_0x8806('0x40')](handleError(_0x177268,null));};exports['show']=function(_0x188a37,_0x95b785){var _0x3eea2f={'raw':![],'where':{'id':_0x188a37[_0x8806('0x41')]['id']}},_0x160f95={};_0x160f95[_0x8806('0x2e')]=_[_0x8806('0x30')](db[_0x8806('0x2a')][_0x8806('0x42')]);_0x160f95[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x188a37[_0x8806('0x2f')]);_0x160f95['filters']=_[_0x8806('0x32')](_0x160f95[_0x8806('0x2e')],_0x160f95['query']);_0x3eea2f['attributes']=_[_0x8806('0x32')](_0x160f95[_0x8806('0x2e')],qs['fields'](_0x188a37['query'][_0x8806('0x34')]));_0x3eea2f[_0x8806('0x33')]=_0x3eea2f[_0x8806('0x33')]['length']?_0x3eea2f[_0x8806('0x33')]:_0x160f95[_0x8806('0x2e')];if(_0x188a37[_0x8806('0x2f')][_0x8806('0x43')]){_0x3eea2f[_0x8806('0x3d')]=[{'all':!![]}];}_0x3eea2f=_[_0x8806('0x44')]({},_0x3eea2f,_0x188a37[_0x8806('0x3b')]);return db[_0x8806('0x2a')]['find'](_0x3eea2f)[_0x8806('0x23')](handleEntityNotFound(_0x95b785,null))[_0x8806('0x23')](respondWithResult(_0x95b785,null))['catch'](handleError(_0x95b785,null));};exports[_0x8806('0x45')]=function(_0x2c27de,_0x3bf095){return db[_0x8806('0x2a')][_0x8806('0x45')](_0x2c27de[_0x8806('0x46')],{})[_0x8806('0x23')](respondWithResult(_0x3bf095,0xc9))[_0x8806('0x40')](handleError(_0x3bf095,null));};exports[_0x8806('0x22')]=function(_0x4237cb,_0x334fac){if(_0x4237cb[_0x8806('0x46')]['id']){delete _0x4237cb[_0x8806('0x46')]['id'];}return db[_0x8806('0x2a')]['find']({'where':{'id':_0x4237cb[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x334fac,null))[_0x8806('0x23')](saveUpdates(_0x4237cb[_0x8806('0x46')],null))[_0x8806('0x23')](respondWithResult(_0x334fac,null))[_0x8806('0x40')](handleError(_0x334fac,null));};exports[_0x8806('0x47')]=function(_0x571090,_0x423f67){return db['Automation'][_0x8806('0x48')]({'where':{'id':_0x571090[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x423f67,null))[_0x8806('0x23')](removeEntity(_0x423f67,null))['catch'](handleError(_0x423f67,null));};exports[_0x8806('0x49')]=function(_0x195074,_0x3ba4f4,_0x48705a){return db['Condition'][_0x8806('0x48')]({'where':{'id':_0x195074[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x3ba4f4,null))['then'](function(_0xe1b1f5){if(_0xe1b1f5){return _0xe1b1f5[_0x8806('0x49')](_0x195074['body'][_0x8806('0x4a')],_[_0x8806('0x4b')](_0x195074['body'],[_0x8806('0x4a'),'id'])||{});}})[_0x8806('0x23')](respondWithResult(_0x3ba4f4,null))[_0x8806('0x40')](handleError(_0x3ba4f4,null));};exports['getConditions']=function(_0x23b8dd,_0xdb21ac,_0x4148bf){var _0xe9eca2={};var _0x24fea2={};var _0x1cbf08;var _0x211220;return db[_0x8806('0x2a')]['findOne']({'where':{'id':_0x23b8dd[_0x8806('0x41')]['id']}})['then'](handleEntityNotFound(_0xdb21ac,null))[_0x8806('0x23')](function(_0x398836){if(_0x398836){_0x1cbf08=_0x398836;_0x24fea2[_0x8806('0x2e')]=_[_0x8806('0x30')](db[_0x8806('0x4c')][_0x8806('0x42')]);_0x24fea2[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x23b8dd[_0x8806('0x2f')]);_0x24fea2[_0x8806('0x31')]=_['intersection'](_0x24fea2[_0x8806('0x2e')],_0x24fea2[_0x8806('0x2f')]);_0xe9eca2[_0x8806('0x33')]=_[_0x8806('0x32')](_0x24fea2[_0x8806('0x2e')],qs[_0x8806('0x34')](_0x23b8dd['query'][_0x8806('0x34')]));_0xe9eca2[_0x8806('0x33')]=_0xe9eca2[_0x8806('0x33')]['length']?_0xe9eca2[_0x8806('0x33')]:_0x24fea2[_0x8806('0x2e')];_0xe9eca2['order']=qs['sort'](_0x23b8dd[_0x8806('0x2f')]['sort']);_0xe9eca2[_0x8806('0x38')]=qs[_0x8806('0x31')](_[_0x8806('0x4d')](_0x23b8dd[_0x8806('0x2f')],_0x24fea2[_0x8806('0x31')]));if(_0x23b8dd[_0x8806('0x2f')]['filter']){_0xe9eca2[_0x8806('0x38')]=_[_0x8806('0x44')](_0xe9eca2[_0x8806('0x38')],{'$or':_[_0x8806('0x29')](_0xe9eca2[_0x8806('0x33')],function(_0x3163e3){var _0x4435f6={};_0x4435f6[_0x3163e3]={'$like':'%'+_0x23b8dd[_0x8806('0x2f')][_0x8806('0x39')]+'%'};return _0x4435f6;})});}_0xe9eca2=_[_0x8806('0x44')]({},_0xe9eca2,_0x23b8dd[_0x8806('0x3b')]);return _0x1cbf08[_0x8806('0x4e')](_0xe9eca2);}})[_0x8806('0x23')](function(_0x157aba){if(_0x157aba){_0x211220=_0x157aba[_0x8806('0x35')];if(!_0x23b8dd[_0x8806('0x2f')][_0x8806('0x4f')](_0x8806('0x36'))){_0xe9eca2['limit']=qs[_0x8806('0x1d')](_0x23b8dd[_0x8806('0x2f')][_0x8806('0x1d')]);_0xe9eca2[_0x8806('0x1b')]=qs[_0x8806('0x1b')](_0x23b8dd[_0x8806('0x2f')][_0x8806('0x1b')]);}return _0x1cbf08[_0x8806('0x4e')](_0xe9eca2);}})[_0x8806('0x23')](function(_0x26254b){if(_0x26254b){return _0x26254b?{'count':_0x211220,'rows':_0x26254b}:null;}})[_0x8806('0x23')](respondWithResult(_0xdb21ac,null))[_0x8806('0x40')](handleError(_0xdb21ac,null));};exports[_0x8806('0x50')]=function(_0x51187a,_0x5e306,_0x1a8fc3){return db[_0x8806('0x51')]['find']({'where':{'id':_0x51187a[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x5e306,null))[_0x8806('0x23')](function(_0x5eba2f){if(_0x5eba2f){return _0x5eba2f['addActions'](_0x51187a[_0x8806('0x46')]['ids'],_[_0x8806('0x4b')](_0x51187a[_0x8806('0x46')],[_0x8806('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x5e306,null))[_0x8806('0x40')](handleError(_0x5e306,null));};exports[_0x8806('0x52')]=function(_0x443d2b,_0x5bf539,_0x430d72){var _0x144c9c={};var _0x505f6e={};var _0x11f13f;var _0x45a199;return db[_0x8806('0x2a')][_0x8806('0x53')]({'where':{'id':_0x443d2b[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x5bf539,null))[_0x8806('0x23')](function(_0x2a78ad){if(_0x2a78ad){_0x11f13f=_0x2a78ad;_0x505f6e['model']=_['keys'](db[_0x8806('0x51')][_0x8806('0x42')]);_0x505f6e[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x443d2b[_0x8806('0x2f')]);_0x505f6e[_0x8806('0x31')]=_[_0x8806('0x32')](_0x505f6e[_0x8806('0x2e')],_0x505f6e[_0x8806('0x2f')]);_0x144c9c[_0x8806('0x33')]=_[_0x8806('0x32')](_0x505f6e[_0x8806('0x2e')],qs[_0x8806('0x34')](_0x443d2b[_0x8806('0x2f')][_0x8806('0x34')]));_0x144c9c[_0x8806('0x33')]=_0x144c9c['attributes'][_0x8806('0x35')]?_0x144c9c['attributes']:_0x505f6e['model'];_0x144c9c[_0x8806('0x54')]=qs[_0x8806('0x37')](_0x443d2b['query'][_0x8806('0x37')]);_0x144c9c[_0x8806('0x38')]=qs['filters'](_['pick'](_0x443d2b['query'],_0x505f6e[_0x8806('0x31')]));if(_0x443d2b[_0x8806('0x2f')]['filter']){_0x144c9c[_0x8806('0x38')]=_['merge'](_0x144c9c['where'],{'$or':_[_0x8806('0x29')](_0x144c9c[_0x8806('0x33')],function(_0x465263){var _0x1963e4={};_0x1963e4[_0x465263]={'$like':'%'+_0x443d2b[_0x8806('0x2f')][_0x8806('0x39')]+'%'};return _0x1963e4;})});}_0x144c9c=_[_0x8806('0x44')]({},_0x144c9c,_0x443d2b[_0x8806('0x3b')]);return _0x11f13f['getActions'](_0x144c9c);}})[_0x8806('0x23')](function(_0x73d5dc){if(_0x73d5dc){_0x45a199=_0x73d5dc[_0x8806('0x35')];if(!_0x443d2b[_0x8806('0x2f')]['hasOwnProperty'](_0x8806('0x36'))){_0x144c9c[_0x8806('0x1d')]=qs[_0x8806('0x1d')](_0x443d2b[_0x8806('0x2f')][_0x8806('0x1d')]);_0x144c9c[_0x8806('0x1b')]=qs[_0x8806('0x1b')](_0x443d2b['query']['offset']);}return _0x11f13f['getActions'](_0x144c9c);}})[_0x8806('0x23')](function(_0x445fa1){if(_0x445fa1){return _0x445fa1?{'count':_0x45a199,'rows':_0x445fa1}:null;}})['then'](respondWithResult(_0x5bf539,null))['catch'](handleError(_0x5bf539,null));}; \ No newline at end of file +var _0x00b9=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','map','rawAttributes','type','key','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Automation','includeAll','include','findAll','catch','show','keys','length','find','create','body','params','addConditions','Condition','ids','omit','getConditions','findOne','pick','addActions','Action','getActions','eml-format'];(function(_0x54616d,_0x3d34c0){var _0x322202=function(_0x3027f5){while(--_0x3027f5){_0x54616d['push'](_0x54616d['shift']());}};_0x322202(++_0x3d34c0);}(_0x00b9,0xef));var _0x900b=function(_0x2691c1,_0x584a6e){_0x2691c1=_0x2691c1-0x0;var _0x11a3ad=_0x00b9[_0x2691c1];return _0x11a3ad;};'use strict';var emlformat=require(_0x900b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x900b('0x1'));var jsonpatch=require(_0x900b('0x2'));var rp=require(_0x900b('0x3'));var moment=require(_0x900b('0x4'));var BPromise=require(_0x900b('0x5'));var Mustache=require('mustache');var util=require(_0x900b('0x6'));var path=require(_0x900b('0x7'));var sox=require(_0x900b('0x8'));var csv=require('to-csv');var ejs=require(_0x900b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x900b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x900b('0xb'));var toCsv=require(_0x900b('0xc'));var querystring=require(_0x900b('0xd'));var Papa=require(_0x900b('0xe'));var Redis=require('ioredis');var authService=require(_0x900b('0xf'));var qs=require(_0x900b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x900b('0x11'));var logger=require(_0x900b('0x12'))(_0x900b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x900b('0x14'));var db=require(_0x900b('0x15'))['db'];function respondWithStatusCode(_0x351d1a,_0x190341){_0x190341=_0x190341||0xcc;return function(_0x5cc64b){if(_0x5cc64b){return _0x351d1a[_0x900b('0x16')](_0x190341);}return _0x351d1a[_0x900b('0x17')](_0x190341)[_0x900b('0x18')]();};}function respondWithResult(_0x1d3e07,_0x13d5f7){_0x13d5f7=_0x13d5f7||0xc8;return function(_0x233b92){if(_0x233b92){return _0x1d3e07[_0x900b('0x17')](_0x13d5f7)[_0x900b('0x19')](_0x233b92);}};}function respondWithFilteredResult(_0x41019a,_0x2d3d06){return function(_0x106107){if(_0x106107){var _0x187404=typeof _0x2d3d06[_0x900b('0x1a')]===_0x900b('0x1b')&&typeof _0x2d3d06['limit']==='undefined';var _0x4a329a=_0x106107[_0x900b('0x1c')];var _0xd9fd07=_0x187404?0x0:_0x2d3d06[_0x900b('0x1a')];var _0x50b287=_0x187404?_0x106107[_0x900b('0x1c')]:_0x2d3d06[_0x900b('0x1a')]+_0x2d3d06[_0x900b('0x1d')];var _0x29ab8c;if(_0x50b287>=_0x4a329a){_0x50b287=_0x4a329a;_0x29ab8c=0xc8;}else{_0x29ab8c=0xce;}_0x41019a[_0x900b('0x17')](_0x29ab8c);return _0x41019a[_0x900b('0x1e')](_0x900b('0x1f'),_0xd9fd07+'-'+_0x50b287+'/'+_0x4a329a)[_0x900b('0x19')](_0x106107);}return null;};}function patchUpdates(_0x52d137){return function(_0x6cce25){try{jsonpatch['apply'](_0x6cce25,_0x52d137,!![]);}catch(_0x319311){return BPromise['reject'](_0x319311);}return _0x6cce25[_0x900b('0x20')]();};}function saveUpdates(_0xa5bb3c,_0x37b2eb){return function(_0x2c54ac){if(_0x2c54ac){return _0x2c54ac[_0x900b('0x21')](_0xa5bb3c)[_0x900b('0x22')](function(_0x3d827b){return _0x3d827b;});}return null;};}function removeEntity(_0x8fc94c,_0x4e1c1d){return function(_0xe232ac){if(_0xe232ac){return _0xe232ac[_0x900b('0x23')]()['then'](function(){_0x8fc94c[_0x900b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2ad6,_0x3e9b5e){return function(_0x154877){if(!_0x154877){_0x5c2ad6[_0x900b('0x16')](0x194);}return _0x154877;};}function handleError(_0x4cb61c,_0x4ee598){_0x4ee598=_0x4ee598||0x1f4;return function(_0x5342a4){logger[_0x900b('0x24')](_0x5342a4[_0x900b('0x25')]);if(_0x5342a4['name']){delete _0x5342a4[_0x900b('0x26')];}_0x4cb61c[_0x900b('0x17')](_0x4ee598)['send'](_0x5342a4);};}exports['index']=function(_0x832120,_0x462a4f){var _0x4ea7ea={},_0x41135d={},_0x369116={'count':0x0,'rows':[]};var _0x3e17e6=_[_0x900b('0x27')](db['Automation'][_0x900b('0x28')],function(_0x1af2ca){return{'name':_0x1af2ca['fieldName'],'type':_0x1af2ca[_0x900b('0x29')][_0x900b('0x2a')]};});_0x41135d[_0x900b('0x2b')]=_[_0x900b('0x27')](_0x3e17e6,_0x900b('0x26'));_0x41135d['query']=_['keys'](_0x832120['query']);_0x41135d['filters']=_[_0x900b('0x2c')](_0x41135d[_0x900b('0x2b')],_0x41135d[_0x900b('0x2d')]);_0x4ea7ea[_0x900b('0x2e')]=_[_0x900b('0x2c')](_0x41135d[_0x900b('0x2b')],qs['fields'](_0x832120[_0x900b('0x2d')][_0x900b('0x2f')]));_0x4ea7ea[_0x900b('0x2e')]=_0x4ea7ea[_0x900b('0x2e')]['length']?_0x4ea7ea[_0x900b('0x2e')]:_0x41135d[_0x900b('0x2b')];if(!_0x832120['query'][_0x900b('0x30')](_0x900b('0x31'))){_0x4ea7ea[_0x900b('0x1d')]=qs['limit'](_0x832120[_0x900b('0x2d')][_0x900b('0x1d')]);_0x4ea7ea[_0x900b('0x1a')]=qs[_0x900b('0x1a')](_0x832120[_0x900b('0x2d')][_0x900b('0x1a')]);}_0x4ea7ea[_0x900b('0x32')]=qs[_0x900b('0x33')](_0x832120[_0x900b('0x2d')][_0x900b('0x33')]);_0x4ea7ea[_0x900b('0x34')]=qs[_0x900b('0x35')](_['pick'](_0x832120[_0x900b('0x2d')],_0x41135d[_0x900b('0x35')]),_0x3e17e6);if(_0x832120[_0x900b('0x2d')][_0x900b('0x36')]){_0x4ea7ea['where']=_[_0x900b('0x37')](_0x4ea7ea[_0x900b('0x34')],{'$or':_[_0x900b('0x27')](_0x3e17e6,function(_0x516293){if(_0x516293[_0x900b('0x29')]!==_0x900b('0x38')){var _0x565501={};_0x565501[_0x516293[_0x900b('0x26')]]={'$like':'%'+_0x832120[_0x900b('0x2d')][_0x900b('0x36')]+'%'};return _0x565501;}})});}_0x4ea7ea=_[_0x900b('0x37')]({},_0x4ea7ea,_0x832120[_0x900b('0x39')]);var _0x1718a1={'where':_0x4ea7ea[_0x900b('0x34')]};return db[_0x900b('0x3a')][_0x900b('0x1c')](_0x1718a1)[_0x900b('0x22')](function(_0x3d94b6){_0x369116[_0x900b('0x1c')]=_0x3d94b6;if(_0x832120[_0x900b('0x2d')][_0x900b('0x3b')]){_0x4ea7ea[_0x900b('0x3c')]=[{'all':!![]}];}return db[_0x900b('0x3a')][_0x900b('0x3d')](_0x4ea7ea);})[_0x900b('0x22')](function(_0x59ef39){_0x369116['rows']=_0x59ef39;return _0x369116;})[_0x900b('0x22')](respondWithFilteredResult(_0x462a4f,_0x4ea7ea))[_0x900b('0x3e')](handleError(_0x462a4f,null));};exports[_0x900b('0x3f')]=function(_0x3f1a23,_0x37299e){var _0x98b90e={'raw':![],'where':{'id':_0x3f1a23['params']['id']}},_0x4a0639={};_0x4a0639[_0x900b('0x2b')]=_['keys'](db['Automation'][_0x900b('0x28')]);_0x4a0639[_0x900b('0x2d')]=_[_0x900b('0x40')](_0x3f1a23['query']);_0x4a0639[_0x900b('0x35')]=_[_0x900b('0x2c')](_0x4a0639['model'],_0x4a0639[_0x900b('0x2d')]);_0x98b90e[_0x900b('0x2e')]=_['intersection'](_0x4a0639[_0x900b('0x2b')],qs[_0x900b('0x2f')](_0x3f1a23[_0x900b('0x2d')][_0x900b('0x2f')]));_0x98b90e[_0x900b('0x2e')]=_0x98b90e['attributes'][_0x900b('0x41')]?_0x98b90e[_0x900b('0x2e')]:_0x4a0639['model'];if(_0x3f1a23[_0x900b('0x2d')][_0x900b('0x3b')]){_0x98b90e['include']=[{'all':!![]}];}_0x98b90e=_[_0x900b('0x37')]({},_0x98b90e,_0x3f1a23[_0x900b('0x39')]);return db[_0x900b('0x3a')][_0x900b('0x42')](_0x98b90e)[_0x900b('0x22')](handleEntityNotFound(_0x37299e,null))[_0x900b('0x22')](respondWithResult(_0x37299e,null))[_0x900b('0x3e')](handleError(_0x37299e,null));};exports[_0x900b('0x43')]=function(_0xe2eb45,_0x3cc22a){return db[_0x900b('0x3a')][_0x900b('0x43')](_0xe2eb45[_0x900b('0x44')],{})[_0x900b('0x22')](respondWithResult(_0x3cc22a,0xc9))[_0x900b('0x3e')](handleError(_0x3cc22a,null));};exports['update']=function(_0x583e0e,_0x447e74){if(_0x583e0e[_0x900b('0x44')]['id']){delete _0x583e0e[_0x900b('0x44')]['id'];}return db[_0x900b('0x3a')][_0x900b('0x42')]({'where':{'id':_0x583e0e[_0x900b('0x45')]['id']}})[_0x900b('0x22')](handleEntityNotFound(_0x447e74,null))[_0x900b('0x22')](saveUpdates(_0x583e0e[_0x900b('0x44')],null))[_0x900b('0x22')](respondWithResult(_0x447e74,null))[_0x900b('0x3e')](handleError(_0x447e74,null));};exports[_0x900b('0x23')]=function(_0x4ba0e0,_0x33a87c){return db[_0x900b('0x3a')]['find']({'where':{'id':_0x4ba0e0[_0x900b('0x45')]['id']}})[_0x900b('0x22')](handleEntityNotFound(_0x33a87c,null))[_0x900b('0x22')](removeEntity(_0x33a87c,null))[_0x900b('0x3e')](handleError(_0x33a87c,null));};exports[_0x900b('0x46')]=function(_0x2fd348,_0x3b8b04,_0x358155){return db[_0x900b('0x47')][_0x900b('0x42')]({'where':{'id':_0x2fd348[_0x900b('0x45')]['id']}})[_0x900b('0x22')](handleEntityNotFound(_0x3b8b04,null))[_0x900b('0x22')](function(_0x22e91f){if(_0x22e91f){return _0x22e91f[_0x900b('0x46')](_0x2fd348[_0x900b('0x44')][_0x900b('0x48')],_[_0x900b('0x49')](_0x2fd348[_0x900b('0x44')],[_0x900b('0x48'),'id'])||{});}})['then'](respondWithResult(_0x3b8b04,null))[_0x900b('0x3e')](handleError(_0x3b8b04,null));};exports[_0x900b('0x4a')]=function(_0x2fc901,_0x43505f,_0x117bea){var _0x1748e0={};var _0x5a7955={};var _0x491a6d;var _0x570714;return db[_0x900b('0x3a')][_0x900b('0x4b')]({'where':{'id':_0x2fc901[_0x900b('0x45')]['id']}})[_0x900b('0x22')](handleEntityNotFound(_0x43505f,null))[_0x900b('0x22')](function(_0x186ab0){if(_0x186ab0){_0x491a6d=_0x186ab0;_0x5a7955[_0x900b('0x2b')]=_[_0x900b('0x40')](db[_0x900b('0x47')][_0x900b('0x28')]);_0x5a7955[_0x900b('0x2d')]=_[_0x900b('0x40')](_0x2fc901['query']);_0x5a7955[_0x900b('0x35')]=_[_0x900b('0x2c')](_0x5a7955[_0x900b('0x2b')],_0x5a7955[_0x900b('0x2d')]);_0x1748e0[_0x900b('0x2e')]=_[_0x900b('0x2c')](_0x5a7955[_0x900b('0x2b')],qs[_0x900b('0x2f')](_0x2fc901['query'][_0x900b('0x2f')]));_0x1748e0[_0x900b('0x2e')]=_0x1748e0['attributes'][_0x900b('0x41')]?_0x1748e0[_0x900b('0x2e')]:_0x5a7955['model'];_0x1748e0[_0x900b('0x32')]=qs[_0x900b('0x33')](_0x2fc901['query'][_0x900b('0x33')]);_0x1748e0['where']=qs[_0x900b('0x35')](_[_0x900b('0x4c')](_0x2fc901[_0x900b('0x2d')],_0x5a7955[_0x900b('0x35')]));if(_0x2fc901[_0x900b('0x2d')][_0x900b('0x36')]){_0x1748e0['where']=_['merge'](_0x1748e0[_0x900b('0x34')],{'$or':_[_0x900b('0x27')](_0x1748e0[_0x900b('0x2e')],function(_0x288c1d){var _0x5a50dc={};_0x5a50dc[_0x288c1d]={'$like':'%'+_0x2fc901[_0x900b('0x2d')][_0x900b('0x36')]+'%'};return _0x5a50dc;})});}_0x1748e0=_['merge']({},_0x1748e0,_0x2fc901['options']);return _0x491a6d[_0x900b('0x4a')](_0x1748e0);}})['then'](function(_0x514754){if(_0x514754){_0x570714=_0x514754[_0x900b('0x41')];if(!_0x2fc901[_0x900b('0x2d')][_0x900b('0x30')](_0x900b('0x31'))){_0x1748e0[_0x900b('0x1d')]=qs[_0x900b('0x1d')](_0x2fc901[_0x900b('0x2d')][_0x900b('0x1d')]);_0x1748e0['offset']=qs[_0x900b('0x1a')](_0x2fc901[_0x900b('0x2d')][_0x900b('0x1a')]);}return _0x491a6d[_0x900b('0x4a')](_0x1748e0);}})[_0x900b('0x22')](function(_0x4ac47c){if(_0x4ac47c){return _0x4ac47c?{'count':_0x570714,'rows':_0x4ac47c}:null;}})[_0x900b('0x22')](respondWithResult(_0x43505f,null))[_0x900b('0x3e')](handleError(_0x43505f,null));};exports[_0x900b('0x4d')]=function(_0x311355,_0x2776dd,_0x3aa6f5){return db[_0x900b('0x4e')]['find']({'where':{'id':_0x311355[_0x900b('0x45')]['id']}})[_0x900b('0x22')](handleEntityNotFound(_0x2776dd,null))[_0x900b('0x22')](function(_0x4c4381){if(_0x4c4381){return _0x4c4381[_0x900b('0x4d')](_0x311355[_0x900b('0x44')][_0x900b('0x48')],_[_0x900b('0x49')](_0x311355['body'],[_0x900b('0x48'),'id'])||{});}})[_0x900b('0x22')](respondWithResult(_0x2776dd,null))[_0x900b('0x3e')](handleError(_0x2776dd,null));};exports['getActions']=function(_0x2f4265,_0x134f80,_0x330482){var _0x1af942={};var _0x4ce172={};var _0x333a29;var _0x40e0f1;return db[_0x900b('0x3a')][_0x900b('0x4b')]({'where':{'id':_0x2f4265[_0x900b('0x45')]['id']}})['then'](handleEntityNotFound(_0x134f80,null))[_0x900b('0x22')](function(_0x531981){if(_0x531981){_0x333a29=_0x531981;_0x4ce172['model']=_[_0x900b('0x40')](db[_0x900b('0x4e')][_0x900b('0x28')]);_0x4ce172[_0x900b('0x2d')]=_[_0x900b('0x40')](_0x2f4265[_0x900b('0x2d')]);_0x4ce172[_0x900b('0x35')]=_[_0x900b('0x2c')](_0x4ce172[_0x900b('0x2b')],_0x4ce172[_0x900b('0x2d')]);_0x1af942[_0x900b('0x2e')]=_[_0x900b('0x2c')](_0x4ce172[_0x900b('0x2b')],qs['fields'](_0x2f4265[_0x900b('0x2d')][_0x900b('0x2f')]));_0x1af942[_0x900b('0x2e')]=_0x1af942[_0x900b('0x2e')][_0x900b('0x41')]?_0x1af942[_0x900b('0x2e')]:_0x4ce172[_0x900b('0x2b')];_0x1af942[_0x900b('0x32')]=qs[_0x900b('0x33')](_0x2f4265[_0x900b('0x2d')][_0x900b('0x33')]);_0x1af942[_0x900b('0x34')]=qs[_0x900b('0x35')](_[_0x900b('0x4c')](_0x2f4265[_0x900b('0x2d')],_0x4ce172[_0x900b('0x35')]));if(_0x2f4265['query'][_0x900b('0x36')]){_0x1af942['where']=_[_0x900b('0x37')](_0x1af942[_0x900b('0x34')],{'$or':_['map'](_0x1af942[_0x900b('0x2e')],function(_0x3f13a3){var _0x339cb0={};_0x339cb0[_0x3f13a3]={'$like':'%'+_0x2f4265[_0x900b('0x2d')]['filter']+'%'};return _0x339cb0;})});}_0x1af942=_['merge']({},_0x1af942,_0x2f4265['options']);return _0x333a29[_0x900b('0x4f')](_0x1af942);}})[_0x900b('0x22')](function(_0x161bdb){if(_0x161bdb){_0x40e0f1=_0x161bdb[_0x900b('0x41')];if(!_0x2f4265[_0x900b('0x2d')]['hasOwnProperty']('nolimit')){_0x1af942['limit']=qs[_0x900b('0x1d')](_0x2f4265[_0x900b('0x2d')][_0x900b('0x1d')]);_0x1af942[_0x900b('0x1a')]=qs['offset'](_0x2f4265[_0x900b('0x2d')][_0x900b('0x1a')]);}return _0x333a29[_0x900b('0x4f')](_0x1af942);}})[_0x900b('0x22')](function(_0x3bc8d9){if(_0x3bc8d9){return _0x3bc8d9?{'count':_0x40e0f1,'rows':_0x3bc8d9}:null;}})[_0x900b('0x22')](respondWithResult(_0x134f80,null))[_0x900b('0x3e')](handleError(_0x134f80,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8cbb004..3bb54cb 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 _0x2b6f=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','Automation','util','../../config/logger'];(function(_0x4a5010,_0x625447){var _0x44f3d5=function(_0xdb2f58){while(--_0xdb2f58){_0x4a5010['push'](_0x4a5010['shift']());}};_0x44f3d5(++_0x625447);}(_0x2b6f,0x94));var _0xf2b6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x2b6f[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0xf2b6('0x0'));var logger=require(_0xf2b6('0x1'))(_0xf2b6('0x2'));var moment=require('moment');var BPromise=require(_0xf2b6('0x3'));var rp=require(_0xf2b6('0x4'));var fs=require('fs');var path=require(_0xf2b6('0x5'));var rimraf=require(_0xf2b6('0x6'));var config=require(_0xf2b6('0x7'));var attributes=require('./automation.attributes');module['exports']=function(_0x5b7b71,_0x1f2372){return _0x5b7b71[_0xf2b6('0x8')](_0xf2b6('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd478=['util','bluebird','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash'];(function(_0x456e47,_0x1bfc8f){var _0x45cdc7=function(_0x105d06){while(--_0x105d06){_0x456e47['push'](_0x456e47['shift']());}};_0x45cdc7(++_0x1bfc8f);}(_0xd478,0x171));var _0x8d47=function(_0x1b7442,_0x392128){_0x1b7442=_0x1b7442-0x0;var _0x15ef34=_0xd478[_0x1b7442];return _0x15ef34;};'use strict';var _=require(_0x8d47('0x0'));var util=require(_0x8d47('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8d47('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d47('0x3'));var rimraf=require(_0x8d47('0x4'));var config=require(_0x8d47('0x5'));var attributes=require('./automation.attributes');module[_0x8d47('0x6')]=function(_0x17280e,_0x51e179){return _0x17280e[_0x8d47('0x7')](_0x8d47('0x8'),attributes,{'tableName':_0x8d47('0x9'),'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 5bd07e7..a68c445 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 _0x0570=['request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x0570,0x172));var _0x0057=function(_0x5472cc,_0x35ef9c){_0x5472cc=_0x5472cc-0x0;var _0x4255cf=_0x0570[_0x5472cc];return _0x4255cf;};'use strict';var _=require('lodash');var util=require(_0x0057('0x0'));var moment=require(_0x0057('0x1'));var BPromise=require(_0x0057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0057('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0057('0x4'));var logger=require('../../config/logger')(_0x0057('0x5'));var config=require(_0x0057('0x6'));var jayson=require(_0x0057('0x7'));var client=jayson[_0x0057('0x8')][_0x0057('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5096e2,_0xc86734,_0x529f55){return new BPromise(function(_0x15d424,_0x2f9d7f){return client[_0x0057('0xa')](_0x5096e2,_0x529f55)[_0x0057('0xb')](function(_0x29b7c6){logger['info'](_0x0057('0xc'),_0xc86734,_0x0057('0xd'));logger[_0x0057('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'),JSON[_0x0057('0xf')](_0x29b7c6));if(_0x29b7c6['error']){if(_0x29b7c6['error'][_0x0057('0x10')]===0x1f4){logger[_0x0057('0x11')](_0x0057('0xc'),_0xc86734,_0x29b7c6['error'][_0x0057('0x12')]);return _0x2f9d7f(_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);}logger[_0x0057('0x11')]('Automation,\x20%s,\x20%s',_0xc86734,_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);return _0x15d424(_0x29b7c6['error'][_0x0057('0x12')]);}else{logger[_0x0057('0x13')]('Automation,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'));_0x15d424(_0x29b7c6['result'][_0x0057('0x12')]);}})['catch'](function(_0x4be851){logger[_0x0057('0x11')]('Automation,\x20%s,\x20%s',_0xc86734,_0x4be851);_0x2f9d7f(_0x4be851);});});} \ No newline at end of file +var _0x6f18=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x246698,_0x24f600){var _0x34ab93=function(_0x49c5bf){while(--_0x49c5bf){_0x246698['push'](_0x246698['shift']());}};_0x34ab93(++_0x24f600);}(_0x6f18,0x1b4));var _0x86f1=function(_0x496e32,_0x3b3d8a){_0x496e32=_0x496e32-0x0;var _0x282961=_0x6f18[_0x496e32];return _0x282961;};'use strict';var _=require(_0x86f1('0x0'));var util=require('util');var moment=require(_0x86f1('0x1'));var BPromise=require('bluebird');var rs=require(_0x86f1('0x2'));var fs=require('fs');var Redis=require(_0x86f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86f1('0x4'));var logger=require(_0x86f1('0x5'))('rpc');var config=require(_0x86f1('0x6'));var jayson=require(_0x86f1('0x7'));var client=jayson[_0x86f1('0x8')][_0x86f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x403f48,_0x4c7943,_0x5b0f45){return new BPromise(function(_0x3cc3c5,_0x3223eb){return client[_0x86f1('0xa')](_0x403f48,_0x5b0f45)[_0x86f1('0xb')](function(_0x4f1f6e){logger[_0x86f1('0xc')](_0x86f1('0xd'),_0x4c7943,_0x86f1('0xe'));logger[_0x86f1('0xf')](_0x86f1('0x10'),_0x4c7943,_0x86f1('0xe'),JSON[_0x86f1('0x11')](_0x4f1f6e));if(_0x4f1f6e[_0x86f1('0x12')]){if(_0x4f1f6e['error'][_0x86f1('0x13')]===0x1f4){logger[_0x86f1('0x12')](_0x86f1('0xd'),_0x4c7943,_0x4f1f6e[_0x86f1('0x12')][_0x86f1('0x14')]);return _0x3223eb(_0x4f1f6e[_0x86f1('0x12')]['message']);}logger[_0x86f1('0x12')](_0x86f1('0xd'),_0x4c7943,_0x4f1f6e[_0x86f1('0x12')][_0x86f1('0x14')]);return _0x3cc3c5(_0x4f1f6e[_0x86f1('0x12')][_0x86f1('0x14')]);}else{logger[_0x86f1('0xc')](_0x86f1('0xd'),_0x4c7943,'request\x20sent');_0x3cc3c5(_0x4f1f6e[_0x86f1('0x15')][_0x86f1('0x14')]);}})[_0x86f1('0x16')](function(_0x4452c4){logger[_0x86f1('0x12')](_0x86f1('0xd'),_0x4c7943,_0x4452c4);_0x3223eb(_0x4452c4);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 583c419..a91d0fe 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 _0x16e4=['Router','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getActions','post','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x59190d,_0x1fe75c){var _0x3f28c3=function(_0x3069d1){while(--_0x3069d1){_0x59190d['push'](_0x59190d['shift']());}};_0x3f28c3(++_0x1fe75c);}(_0x16e4,0x97));var _0x416e=function(_0x576596,_0x1e85e3){_0x576596=_0x576596-0x0;var _0x5cd85a=_0x16e4[_0x576596];return _0x5cd85a;};'use strict';var multer=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var path=require(_0x416e('0x2'));var timeout=require(_0x416e('0x3'));var express=require(_0x416e('0x4'));var router=express[_0x416e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x416e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x416e('0x7'));var controller=require(_0x416e('0x8'));router['get']('/',auth[_0x416e('0x9')](),controller[_0x416e('0xa')]);router[_0x416e('0xb')](_0x416e('0xc'),auth[_0x416e('0x9')](),controller[_0x416e('0xd')]);router[_0x416e('0xb')](_0x416e('0xe'),auth[_0x416e('0x9')](),controller['getConditions']);router[_0x416e('0xb')]('/:id/actions',auth[_0x416e('0x9')](),controller[_0x416e('0xf')]);router[_0x416e('0x10')]('/',auth['isAuthenticated'](),controller[_0x416e('0x11')]);router[_0x416e('0x10')](_0x416e('0xe'),auth['isAuthenticated'](),controller[_0x416e('0x12')]);router['post'](_0x416e('0x13'),auth[_0x416e('0x9')](),controller[_0x416e('0x14')]);router[_0x416e('0x15')]('/:id',auth[_0x416e('0x9')](),controller[_0x416e('0x16')]);router[_0x416e('0x17')](_0x416e('0xc'),auth[_0x416e('0x9')](),controller[_0x416e('0x18')]);module[_0x416e('0x19')]=router; \ No newline at end of file +var _0x635c=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','update','delete','destroy','exports'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x635c,0xa1));var _0xc635=function(_0x1b8aaf,_0x894b62){_0x1b8aaf=_0x1b8aaf-0x0;var _0x5b4758=_0x635c[_0x1b8aaf];return _0x5b4758;};'use strict';var multer=require('multer');var util=require(_0xc635('0x0'));var path=require(_0xc635('0x1'));var timeout=require(_0xc635('0x2'));var express=require(_0xc635('0x3'));var router=express['Router']();var fs_extra=require(_0xc635('0x4'));var auth=require(_0xc635('0x5'));var interaction=require(_0xc635('0x6'));var config=require(_0xc635('0x7'));var controller=require(_0xc635('0x8'));router[_0xc635('0x9')]('/',auth[_0xc635('0xa')](),controller['index']);router[_0xc635('0x9')](_0xc635('0xb'),auth[_0xc635('0xa')](),controller['show']);router[_0xc635('0x9')](_0xc635('0xc'),auth[_0xc635('0xa')](),controller[_0xc635('0xd')]);router[_0xc635('0x9')](_0xc635('0xe'),auth[_0xc635('0xa')](),controller[_0xc635('0xf')]);router[_0xc635('0x10')]('/',auth[_0xc635('0xa')](),controller['create']);router[_0xc635('0x10')](_0xc635('0xc'),auth[_0xc635('0xa')](),controller[_0xc635('0x11')]);router['post'](_0xc635('0xe'),auth[_0xc635('0xa')](),controller[_0xc635('0x12')]);router['put']('/:id',auth[_0xc635('0xa')](),controller[_0xc635('0x13')]);router[_0xc635('0x14')](_0xc635('0xb'),auth[_0xc635('0xa')](),controller[_0xc635('0x15')]);module[_0xc635('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index f3f5c7f..22956aa 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 _0x99e7=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\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)'];(function(_0x534216,_0x3789b4){var _0x3731ce=function(_0x44c6d1){while(--_0x44c6d1){_0x534216['push'](_0x534216['shift']());}};_0x3731ce(++_0x3789b4);}(_0x99e7,0x1b5));var _0x799e=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0x99e7[_0x2bb3f6];return _0x62b339;};'use strict';var Sequelize=require(_0x799e('0x0'));module[_0x799e('0x1')]={'name':{'type':Sequelize[_0x799e('0x2')],'unique':_0x799e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x799e('0x4')](_0x799e('0x5')),'allowNull':![],'defaultValue':_0x799e('0x5')},'description':{'type':Sequelize[_0x799e('0x2')]},'active':{'type':Sequelize[_0x799e('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x799e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x799e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'comment':_0x799e('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x799e('0xf')},'dialTimezone':{'type':Sequelize[_0x799e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x799e('0x2')],'defaultValue':_0x799e('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x799e('0x4')](_0x799e('0x11'),'never','onlyIfOpen'),'defaultValue':_0x799e('0x11')},'dialAMDActive':{'type':Sequelize[_0x799e('0x6')],'defaultValue':0x0,'comment':_0x799e('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x799e('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x799e('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x799e('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x799e('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x799e('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x799e('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x799e('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x799e('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x799e('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x799e('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x799e('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x799e('0x1b'),_0x799e('0x1c')),'defaultValue':_0x799e('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x799e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x799e('0x1d')},'dialCutDigit':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x799e('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x28')}}; \ No newline at end of file +var _0xc9de=['Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xc9de,0x140));var _0xec9d=function(_0x32c9eb,_0x5596f4){_0x32c9eb=_0x32c9eb-0x0;var _0x5c87f4=_0xc9de[_0x32c9eb];return _0x5c87f4;};'use strict';var Sequelize=require(_0xec9d('0x0'));module[_0xec9d('0x1')]={'name':{'type':Sequelize[_0xec9d('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xec9d('0x3')](_0xec9d('0x4')),'allowNull':![],'defaultValue':_0xec9d('0x4')},'description':{'type':Sequelize[_0xec9d('0x2')]},'active':{'type':Sequelize[_0xec9d('0x5')],'defaultValue':0x0,'comment':_0xec9d('0x6')},'limitCalls':{'type':Sequelize[_0xec9d('0x7')](0x4)[_0xec9d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xec9d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xec9d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xec9d('0x7')](0x3)[_0xec9d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xec9d('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9d('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xec9d('0x7')](0x3)[_0xec9d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xec9d('0x7')](0x5)[_0xec9d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9d('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec9d('0x8')],'defaultValue':0x3,'comment':_0xec9d('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xec9d('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9d('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec9d('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xec9d('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xec9d('0x2')],'defaultValue':_0xec9d('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xec9d('0x3')](_0xec9d('0xf'),_0xec9d('0x10'),_0xec9d('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xec9d('0x5')],'defaultValue':0x0,'comment':_0xec9d('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xec9d('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xec9d('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xec9d('0x7')](0x9)[_0xec9d('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xec9d('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xec9d('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xec9d('0x7')](0x9)[_0xec9d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xec9d('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xec9d('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xec9d('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xec9d('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xec9d('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xec9d('0x7')](0x9)[_0xec9d('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xec9d('0x7')](0x5)[_0xec9d('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xec9d('0x7')](0x9)[_0xec9d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xec9d('0x3')](_0xec9d('0x18'),_0xec9d('0x19')),'defaultValue':_0xec9d('0x18')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xec9d('0x7')](0x3)[_0xec9d('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xec9d('0x1a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xec9d('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec9d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9d('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xec9d('0x7')](0x5)[_0xec9d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9d('0x1c')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec9d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xec9d('0x7')](0x5)[_0xec9d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9d('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xec9d('0x7')](0x3)[_0xec9d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xec9d('0x7')](0x5)[_0xec9d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xec9d('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9d('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0xec9d('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec9d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9d('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xec9d('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9d('0x20')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9c00954..dba078f 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 _0xa169=['CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','NOW()','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','push','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','sequelize','removeBlackLists','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','get','UserProfileResource','destroy','stack','name','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','Campaign','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','createdAt','error','getHoppers','findOne','CmHopper'];(function(_0x25cd2c,_0x57498e){var _0x1e364c=function(_0x35ac2e){while(--_0x35ac2e){_0x25cd2c['push'](_0x25cd2c['shift']());}};_0x1e364c(++_0x57498e);}(_0xa169,0x13b));var _0x9a16=function(_0x9c502c,_0x12f7d0){_0x9c502c=_0x9c502c-0x0;var _0x8a1834=_0xa169[_0x9c502c];return _0x8a1834;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a16('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9a16('0x1'));var BPromise=require(_0x9a16('0x2'));var Mustache=require('mustache');var util=require(_0x9a16('0x3'));var path=require(_0x9a16('0x4'));var sox=require(_0x9a16('0x5'));var csv=require(_0x9a16('0x6'));var ejs=require(_0x9a16('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a16('0x8'));var squel=require(_0x9a16('0x9'));var crypto=require(_0x9a16('0xa'));var jsforce=require(_0x9a16('0xb'));var deskjs=require(_0x9a16('0xc'));var toCsv=require(_0x9a16('0x6'));var querystring=require(_0x9a16('0xd'));var Papa=require(_0x9a16('0xe'));var Redis=require(_0x9a16('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9a16('0x10'));var as=require(_0x9a16('0x11'));var hardwareService=require(_0x9a16('0x12'));var logger=require(_0x9a16('0x13'))(_0x9a16('0x14'));var utils=require(_0x9a16('0x15'));var config=require(_0x9a16('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a16('0x17'))['db'];function respondWithStatusCode(_0x59bcd6,_0x4290c3){_0x4290c3=_0x4290c3||0xcc;return function(_0xab63fb){if(_0xab63fb){return _0x59bcd6[_0x9a16('0x18')](_0x4290c3);}return _0x59bcd6['status'](_0x4290c3)[_0x9a16('0x19')]();};}function respondWithResult(_0x3bfc04,_0x1e59d1){_0x1e59d1=_0x1e59d1||0xc8;return function(_0x2eb354){if(_0x2eb354){return _0x3bfc04['status'](_0x1e59d1)[_0x9a16('0x1a')](_0x2eb354);}};}function respondWithFilteredResult(_0x10253a,_0x27f834){return function(_0x293454){if(_0x293454){var _0x3e044b=typeof _0x27f834[_0x9a16('0x1b')]===_0x9a16('0x1c')&&typeof _0x27f834[_0x9a16('0x1d')]==='undefined';var _0x40bee0=_0x293454[_0x9a16('0x1e')];var _0x33e0bc=_0x3e044b?0x0:_0x27f834[_0x9a16('0x1b')];var _0x1b05e1=_0x3e044b?_0x293454[_0x9a16('0x1e')]:_0x27f834[_0x9a16('0x1b')]+_0x27f834[_0x9a16('0x1d')];var _0xb4d5d6;if(_0x1b05e1>=_0x40bee0){_0x1b05e1=_0x40bee0;_0xb4d5d6=0xc8;}else{_0xb4d5d6=0xce;}_0x10253a[_0x9a16('0x1f')](_0xb4d5d6);return _0x10253a[_0x9a16('0x20')](_0x9a16('0x21'),_0x33e0bc+'-'+_0x1b05e1+'/'+_0x40bee0)[_0x9a16('0x1a')](_0x293454);}return null;};}function patchUpdates(_0xffdcca){return function(_0x442665){try{jsonpatch['apply'](_0x442665,_0xffdcca,!![]);}catch(_0xaa94f4){return BPromise[_0x9a16('0x22')](_0xaa94f4);}return _0x442665['save']();};}function saveUpdates(_0xe7f027,_0x255756){return function(_0x4ef667){if(_0x4ef667){return _0x4ef667[_0x9a16('0x23')](_0xe7f027)[_0x9a16('0x24')](function(_0x43e018){return _0x43e018;});}return null;};}function removeEntity(_0x89c0bd,_0x3fa6e9){return function(_0x133952){if(_0x133952){return _0x133952['destroy']()[_0x9a16('0x24')](function(){var _0x424969=_0x133952[_0x9a16('0x25')]({'plain':!![]});var _0x20e276='IvrCampaigns';return db[_0x9a16('0x26')][_0x9a16('0x27')]({'where':{'type':_0x20e276,'resourceId':_0x424969['id']}})[_0x9a16('0x24')](function(){return _0x133952;});})[_0x9a16('0x24')](function(){_0x89c0bd[_0x9a16('0x1f')](0xcc)[_0x9a16('0x19')]();});}};}function handleEntityNotFound(_0x3424a2,_0x385ad1){return function(_0x3a550f){if(!_0x3a550f){_0x3424a2[_0x9a16('0x18')](0x194);}return _0x3a550f;};}function handleError(_0x16329b,_0x30fa0b){_0x30fa0b=_0x30fa0b||0x1f4;return function(_0x4c118a){logger['error'](_0x4c118a[_0x9a16('0x28')]);if(_0x4c118a[_0x9a16('0x29')]){delete _0x4c118a[_0x9a16('0x29')];}_0x16329b[_0x9a16('0x1f')](_0x30fa0b)['send'](_0x4c118a);};}exports[_0x9a16('0x2a')]=function(_0x483fc1,_0xb279af){var _0x13cc7f={},_0x167b25={},_0x233161={'count':0x0,'rows':[]};var _0x1ab751=_['map'](db['Campaign'][_0x9a16('0x2b')],function(_0x2b6a2e){return{'name':_0x2b6a2e['fieldName'],'type':_0x2b6a2e[_0x9a16('0x2c')]['key']};});_0x167b25[_0x9a16('0x2d')]=_[_0x9a16('0x2e')](_0x1ab751,'name');_0x167b25[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x483fc1[_0x9a16('0x2f')]);_0x167b25[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x167b25['model'],_0x167b25[_0x9a16('0x2f')]);_0x13cc7f[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x167b25[_0x9a16('0x2d')],qs['fields'](_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x13cc7f[_0x9a16('0x33')]=_0x13cc7f[_0x9a16('0x33')][_0x9a16('0x35')]?_0x13cc7f['attributes']:_0x167b25[_0x9a16('0x2d')];if(!_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x36')](_0x9a16('0x37'))){_0x13cc7f['limit']=qs[_0x9a16('0x1d')](_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0x13cc7f['offset']=qs[_0x9a16('0x1b')](_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0x13cc7f[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x483fc1['query'][_0x9a16('0x39')]);_0x13cc7f[_0x9a16('0x3a')]=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0x483fc1[_0x9a16('0x2f')],_0x167b25[_0x9a16('0x31')]),_0x1ab751);if(_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x13cc7f[_0x9a16('0x3a')]=_['merge'](_0x13cc7f[_0x9a16('0x3a')],{'$or':_['map'](_0x1ab751,function(_0x34e71d){if(_0x34e71d['type']!==_0x9a16('0x3d')){var _0x1da105={};_0x1da105[_0x34e71d[_0x9a16('0x29')]]={'$like':'%'+_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0x1da105;}})});}_0x13cc7f=_[_0x9a16('0x3e')]({},_0x13cc7f,_0x483fc1[_0x9a16('0x3f')]);var _0x25ce6c={'where':_0x13cc7f[_0x9a16('0x3a')]};return db['Campaign']['count'](_0x25ce6c)[_0x9a16('0x24')](function(_0x534bea){_0x233161['count']=_0x534bea;if(_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x13cc7f[_0x9a16('0x41')]=[{'all':!![]}];}return db[_0x9a16('0x42')][_0x9a16('0x43')](_0x13cc7f);})[_0x9a16('0x24')](function(_0x4bf1f2){_0x233161[_0x9a16('0x44')]=_0x4bf1f2;return _0x233161;})[_0x9a16('0x24')](respondWithFilteredResult(_0xb279af,_0x13cc7f))[_0x9a16('0x45')](handleError(_0xb279af,null));};exports[_0x9a16('0x46')]=function(_0x2759aa,_0x1b30b0){var _0x4afa39={'raw':![],'where':{'id':_0x2759aa[_0x9a16('0x47')]['id']}},_0x1b6497={};_0x1b6497['model']=_[_0x9a16('0x30')](db[_0x9a16('0x42')][_0x9a16('0x2b')]);_0x1b6497[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x2759aa[_0x9a16('0x2f')]);_0x1b6497['filters']=_[_0x9a16('0x32')](_0x1b6497[_0x9a16('0x2d')],_0x1b6497[_0x9a16('0x2f')]);_0x4afa39[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x1b6497[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x2759aa[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x4afa39['attributes']=_0x4afa39['attributes'][_0x9a16('0x35')]?_0x4afa39[_0x9a16('0x33')]:_0x1b6497[_0x9a16('0x2d')];if(_0x2759aa[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x4afa39[_0x9a16('0x41')]=[{'all':!![]}];}_0x4afa39=_[_0x9a16('0x3e')]({},_0x4afa39,_0x2759aa['options']);return db[_0x9a16('0x42')][_0x9a16('0x48')](_0x4afa39)['then'](handleEntityNotFound(_0x1b30b0,null))['then'](respondWithResult(_0x1b30b0,null))['catch'](handleError(_0x1b30b0,null));};exports['create']=function(_0xebb110,_0x26b126){return db[_0x9a16('0x42')][_0x9a16('0x49')](_0xebb110['body'],{})[_0x9a16('0x24')](function(_0x316665){var _0x1c1b92=_0xebb110['user'][_0x9a16('0x25')]({'plain':!![]});if(!_0x1c1b92)throw new Error(_0x9a16('0x4a'));if(_0x1c1b92[_0x9a16('0x4b')]===_0x9a16('0x4c')){var _0x1c4072=_0x316665[_0x9a16('0x25')]({'plain':!![]});var _0x46b0bf=_0x9a16('0x4d');return db[_0x9a16('0x4e')][_0x9a16('0x48')]({'where':{'name':_0x46b0bf,'userProfileId':_0x1c1b92[_0x9a16('0x4f')]},'raw':!![]})[_0x9a16('0x24')](function(_0x3156ab){if(_0x3156ab&&_0x3156ab['autoAssociation']===0x0){return db[_0x9a16('0x26')][_0x9a16('0x49')]({'name':_0x1c4072[_0x9a16('0x29')],'resourceId':_0x1c4072['id'],'type':_0x3156ab['name'],'sectionId':_0x3156ab['id']},{})[_0x9a16('0x24')](function(){return _0x316665;});}else{return _0x316665;}})[_0x9a16('0x45')](function(_0x2037f0){logger['error'](_0x9a16('0x50'),_0x2037f0);throw _0x2037f0;});}return _0x316665;})[_0x9a16('0x24')](respondWithResult(_0x26b126,0xc9))[_0x9a16('0x45')](handleError(_0x26b126,null));};exports[_0x9a16('0x51')]=function(_0x312895,_0x367ffa){var _0x4e18c1={'where':{'id':_0x312895[_0x9a16('0x47')]['id']}},_0x2dda7c={};_0x2dda7c[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x42')][_0x9a16('0x2b')]);_0x4e18c1['attributes']=_[_0x9a16('0x32')](_0x2dda7c[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x312895['query'][_0x9a16('0x34')]));_0x4e18c1[_0x9a16('0x33')]=_0x4e18c1[_0x9a16('0x33')]['length']?_0x4e18c1[_0x9a16('0x33')]:_0x2dda7c[_0x9a16('0x2d')];if(_0x312895[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x4e18c1['include']=[{'all':!![]}];}_0x4e18c1=_[_0x9a16('0x3e')]({},_0x4e18c1,_0x312895[_0x9a16('0x3f')]);return db['Campaign']['find'](_0x4e18c1)[_0x9a16('0x24')](handleEntityNotFound(_0x367ffa,null))[_0x9a16('0x24')](function(_0x3f339f){if(_0x3f339f){var _0x5b15eb=_0x3f339f[_0x9a16('0x25')]({'plain':!![]});_0x5b15eb=qs['omit'](_0x5b15eb,['id','createdAt',_0x9a16('0x52')]);_0x312895[_0x9a16('0x53')]=_[_0x9a16('0x54')](_0x312895[_0x9a16('0x53')],['id',_0x9a16('0x55'),_0x9a16('0x52')]);return db[_0x9a16('0x42')][_0x9a16('0x49')](_['merge'](_0x5b15eb,_0x312895[_0x9a16('0x53')]),{'include':_0x312895['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x50a3c7){var _0x4de5af=_0x312895['user'][_0x9a16('0x25')]({'plain':!![]});if(!_0x4de5af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4de5af[_0x9a16('0x4b')]===_0x9a16('0x4c')){var _0x3fa395=_0x50a3c7[_0x9a16('0x25')]({'plain':!![]});var _0x8eb4b7=_0x9a16('0x4d');return db[_0x9a16('0x4e')]['find']({'where':{'name':_0x8eb4b7,'userProfileId':_0x4de5af[_0x9a16('0x4f')]},'raw':!![]})[_0x9a16('0x24')](function(_0x1130c3){if(_0x1130c3&&_0x1130c3['autoAssociation']===0x0){return db[_0x9a16('0x26')][_0x9a16('0x49')]({'name':_0x3fa395[_0x9a16('0x29')],'resourceId':_0x3fa395['id'],'type':_0x1130c3['name'],'sectionId':_0x1130c3['id']},{})['then'](function(){return _0x50a3c7;});}else{return _0x50a3c7;}})[_0x9a16('0x45')](function(_0x8ee3c6){logger[_0x9a16('0x56')](_0x9a16('0x50'),_0x8ee3c6);throw _0x8ee3c6;});}return _0x50a3c7;});}})['then'](respondWithResult(_0x367ffa,0xc9))['catch'](handleError(_0x367ffa,null));};exports[_0x9a16('0x23')]=function(_0x5ec523,_0x21b422){if(_0x5ec523[_0x9a16('0x53')]['id']){delete _0x5ec523[_0x9a16('0x53')]['id'];}return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x5ec523['params']['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x21b422,null))['then'](saveUpdates(_0x5ec523[_0x9a16('0x53')],null))[_0x9a16('0x24')](respondWithResult(_0x21b422,null))['catch'](handleError(_0x21b422,null));};exports[_0x9a16('0x27')]=function(_0x2e78cd,_0x4a9b9e){return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x2e78cd[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x4a9b9e,null))['then'](removeEntity(_0x4a9b9e,null))[_0x9a16('0x45')](handleError(_0x4a9b9e,null));};exports[_0x9a16('0x57')]=function(_0x3f67a6,_0x3f3c35,_0x2ff8d4){var _0xc90f56={'raw':!![],'where':{}};var _0x3898b0={};var _0xdc6f8a={'count':0x0,'rows':[]};return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x3f67a6[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x3f3c35,null))[_0x9a16('0x24')](function(_0x556928){if(_0x556928){_0x3898b0[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x59')]['rawAttributes']);_0x3898b0['query']=_['keys'](_0x3f67a6['query']);_0x3898b0[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x3898b0[_0x9a16('0x2d')],_0x3898b0[_0x9a16('0x2f')]);_0xc90f56[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x3898b0[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x3f67a6['query'][_0x9a16('0x34')]));_0xc90f56[_0x9a16('0x33')]=_0xc90f56[_0x9a16('0x33')][_0x9a16('0x35')]?_0xc90f56[_0x9a16('0x33')]:_0x3898b0['model'];if(!_0x3f67a6['query'][_0x9a16('0x36')](_0x9a16('0x37'))){_0xc90f56[_0x9a16('0x1d')]=qs[_0x9a16('0x1d')](_0x3f67a6[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0xc90f56['offset']=qs[_0x9a16('0x1b')](_0x3f67a6[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0xc90f56[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x3f67a6[_0x9a16('0x2f')]['sort']);_0xc90f56[_0x9a16('0x3a')]=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0x3f67a6['query'],_0x3898b0[_0x9a16('0x31')]));_0xc90f56[_0x9a16('0x3a')][_0x9a16('0x5a')]=_0x556928['id'];if(_0x3f67a6[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0xc90f56[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0xc90f56[_0x9a16('0x3a')],{'$or':_['map'](_0xc90f56['attributes'],function(_0x1b91fc){var _0x5f088e={};_0x5f088e[_0x1b91fc]={'$like':'%'+_0x3f67a6['query'][_0x9a16('0x3c')]+'%'};return _0x5f088e;})});}_0xc90f56=_[_0x9a16('0x3e')]({},_0xc90f56,_0x3f67a6[_0x9a16('0x3f')]);return db[_0x9a16('0x59')][_0x9a16('0x1e')]({'where':_0xc90f56['where']})[_0x9a16('0x24')](function(_0x230f25){_0xdc6f8a[_0x9a16('0x1e')]=_0x230f25;if(_0x3f67a6[_0x9a16('0x2f')]['includeAll']){_0xc90f56[_0x9a16('0x41')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xc90f56);})['then'](function(_0x485a6c){_0xdc6f8a[_0x9a16('0x44')]=_0x485a6c;return _0xdc6f8a;});}})[_0x9a16('0x24')](respondWithFilteredResult(_0x3f3c35,_0xc90f56))[_0x9a16('0x45')](handleError(_0x3f3c35,null));};exports[_0x9a16('0x5b')]=function(_0x5b21e8,_0x5e58c7,_0x4c01df){var _0x35bb1e={'raw':!![],'where':{}};var _0x289262={};var _0x3cc496={'count':0x0,'rows':[]};return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x5b21e8[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x5e58c7,null))[_0x9a16('0x24')](function(_0x3d0de0){if(_0x3d0de0){_0x289262[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x5c')][_0x9a16('0x2b')]);_0x289262[_0x9a16('0x2f')]=_['keys'](_0x5b21e8['query']);_0x289262[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x289262[_0x9a16('0x2d')],_0x289262['query']);_0x35bb1e['attributes']=_[_0x9a16('0x32')](_0x289262['model'],qs[_0x9a16('0x34')](_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x35bb1e[_0x9a16('0x33')]=_0x35bb1e['attributes'][_0x9a16('0x35')]?_0x35bb1e[_0x9a16('0x33')]:_0x289262[_0x9a16('0x2d')];if(!_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x36')](_0x9a16('0x37'))){_0x35bb1e['limit']=qs[_0x9a16('0x1d')](_0x5b21e8['query'][_0x9a16('0x1d')]);_0x35bb1e['offset']=qs[_0x9a16('0x1b')](_0x5b21e8['query'][_0x9a16('0x1b')]);}_0x35bb1e[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x5b21e8[_0x9a16('0x2f')]['sort']);_0x35bb1e['where']=qs[_0x9a16('0x31')](_['pick'](_0x5b21e8['query'],_0x289262[_0x9a16('0x31')]));_0x35bb1e[_0x9a16('0x3a')][_0x9a16('0x5a')]=_0x3d0de0['id'];if(_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x35bb1e['where']=_[_0x9a16('0x3e')](_0x35bb1e[_0x9a16('0x3a')],{'$or':_[_0x9a16('0x2e')](_0x35bb1e[_0x9a16('0x33')],function(_0x3bb9bf){var _0xbaf780={};_0xbaf780[_0x3bb9bf]={'$like':'%'+_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0xbaf780;})});}_0x35bb1e=_['merge']({},_0x35bb1e,_0x5b21e8[_0x9a16('0x3f')]);return db[_0x9a16('0x5c')][_0x9a16('0x1e')]({'where':_0x35bb1e['where']})['then'](function(_0x15b936){_0x3cc496['count']=_0x15b936;if(_0x5b21e8[_0x9a16('0x2f')]['includeAll']){_0x35bb1e[_0x9a16('0x41')]=[{'all':!![]}];}return db[_0x9a16('0x5c')][_0x9a16('0x43')](_0x35bb1e);})['then'](function(_0x14ff36){_0x3cc496[_0x9a16('0x44')]=_0x14ff36;return _0x3cc496;});}})['then'](respondWithFilteredResult(_0x5e58c7,_0x35bb1e))[_0x9a16('0x45')](handleError(_0x5e58c7,null));};exports[_0x9a16('0x5d')]=function(_0x52442a,_0x4d8d8e,_0x173fe0){var _0xe6a16c={'raw':!![],'where':{}};var _0x493e66={};var _0x185cd8={'count':0x0,'rows':[]};return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x52442a[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x4d8d8e,null))[_0x9a16('0x24')](function(_0x44984a){if(_0x44984a){_0x493e66[_0x9a16('0x2d')]=_['keys'](db[_0x9a16('0x5e')]['rawAttributes']);_0x493e66[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x52442a['query']);_0x493e66[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x493e66[_0x9a16('0x2d')],_0x493e66[_0x9a16('0x2f')]);_0xe6a16c[_0x9a16('0x33')]=_['intersection'](_0x493e66['model'],qs['fields'](_0x52442a['query'][_0x9a16('0x34')]));_0xe6a16c[_0x9a16('0x33')]=_0xe6a16c[_0x9a16('0x33')][_0x9a16('0x35')]?_0xe6a16c[_0x9a16('0x33')]:_0x493e66[_0x9a16('0x2d')];if(!_0x52442a['query'][_0x9a16('0x36')]('nolimit')){_0xe6a16c[_0x9a16('0x1d')]=qs['limit'](_0x52442a[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0xe6a16c[_0x9a16('0x1b')]=qs[_0x9a16('0x1b')](_0x52442a[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0xe6a16c[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x52442a['query']['sort']);_0xe6a16c['where']=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0x52442a[_0x9a16('0x2f')],_0x493e66[_0x9a16('0x31')]));_0xe6a16c['where']['CampaignId']=_0x44984a['id'];if(_0x52442a[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0xe6a16c[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0xe6a16c[_0x9a16('0x3a')],{'$or':_[_0x9a16('0x2e')](_0xe6a16c[_0x9a16('0x33')],function(_0x1762a5){var _0x2edad0={};_0x2edad0[_0x1762a5]={'$like':'%'+_0x52442a[_0x9a16('0x2f')]['filter']+'%'};return _0x2edad0;})});}_0xe6a16c=_[_0x9a16('0x3e')]({},_0xe6a16c,_0x52442a[_0x9a16('0x3f')]);return db[_0x9a16('0x5e')]['count']({'where':_0xe6a16c['where']})[_0x9a16('0x24')](function(_0x32e50c){_0x185cd8[_0x9a16('0x1e')]=_0x32e50c;if(_0x52442a[_0x9a16('0x2f')][_0x9a16('0x40')]){_0xe6a16c['include']=[{'all':!![]}];}return db[_0x9a16('0x5e')][_0x9a16('0x43')](_0xe6a16c);})[_0x9a16('0x24')](function(_0x1d7d55){_0x185cd8[_0x9a16('0x44')]=_0x1d7d55;return _0x185cd8;});}})[_0x9a16('0x24')](respondWithFilteredResult(_0x4d8d8e,_0xe6a16c))[_0x9a16('0x45')](handleError(_0x4d8d8e,null));};exports[_0x9a16('0x5f')]=function(_0xeaddea,_0x3c59f9,_0x3e3dae){var _0x5d3899={'raw':!![],'where':{}};var _0x147753={};var _0x84a3c={'count':0x0,'rows':[]};return db['Campaign'][_0x9a16('0x58')]({'where':{'id':_0xeaddea[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x3c59f9,null))['then'](function(_0x46c526){if(_0x46c526){_0x147753[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x60')][_0x9a16('0x2b')]);_0x147753[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0xeaddea[_0x9a16('0x2f')]);_0x147753[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x147753[_0x9a16('0x2d')],_0x147753[_0x9a16('0x2f')]);_0x5d3899[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x147753[_0x9a16('0x2d')],qs['fields'](_0xeaddea[_0x9a16('0x2f')]['fields']));_0x5d3899[_0x9a16('0x33')]=_0x5d3899[_0x9a16('0x33')]['length']?_0x5d3899[_0x9a16('0x33')]:_0x147753[_0x9a16('0x2d')];if(!_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x36')](_0x9a16('0x37'))){_0x5d3899[_0x9a16('0x1d')]=qs[_0x9a16('0x1d')](_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0x5d3899['offset']=qs[_0x9a16('0x1b')](_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0x5d3899['order']=qs[_0x9a16('0x39')](_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x39')]);_0x5d3899[_0x9a16('0x3a')]=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0xeaddea['query'],_0x147753[_0x9a16('0x31')]));_0x5d3899[_0x9a16('0x3a')][_0x9a16('0x5a')]=_0x46c526['id'];if(_0xeaddea[_0x9a16('0x2f')]['filter']){_0x5d3899[_0x9a16('0x3a')]=_['merge'](_0x5d3899['where'],{'$or':_[_0x9a16('0x2e')](_0x5d3899[_0x9a16('0x33')],function(_0x4a6352){var _0x93a271={};_0x93a271[_0x4a6352]={'$like':'%'+_0xeaddea['query'][_0x9a16('0x3c')]+'%'};return _0x93a271;})});}_0x5d3899=_['merge']({},_0x5d3899,_0xeaddea['options']);return db[_0x9a16('0x60')][_0x9a16('0x1e')]({'where':_0x5d3899[_0x9a16('0x3a')]})[_0x9a16('0x24')](function(_0x402f7d){_0x84a3c[_0x9a16('0x1e')]=_0x402f7d;if(_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x5d3899['include']=[{'all':!![]}];}return db[_0x9a16('0x60')][_0x9a16('0x43')](_0x5d3899);})[_0x9a16('0x24')](function(_0x5100f2){_0x84a3c['rows']=_0x5100f2;return _0x84a3c;});}})[_0x9a16('0x24')](respondWithFilteredResult(_0x3c59f9,_0x5d3899))[_0x9a16('0x45')](handleError(_0x3c59f9,null));};exports[_0x9a16('0x61')]=function(_0x195a29,_0x49cebf,_0x141949){var _0x22e5d1={};var _0x159891={};var _0x592669;var _0xdaf8ad;return db[_0x9a16('0x42')]['findOne']({'where':{'id':_0x195a29['params']['id']}})['then'](handleEntityNotFound(_0x49cebf,null))[_0x9a16('0x24')](function(_0xf0eaa9){if(_0xf0eaa9){_0x592669=_0xf0eaa9;_0x159891[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db['CmList']['rawAttributes']);_0x159891[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x195a29[_0x9a16('0x2f')]);_0x159891[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x159891[_0x9a16('0x2d')],_0x159891['query']);_0x22e5d1['attributes']=_[_0x9a16('0x32')](_0x159891[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x195a29['query']['fields']));_0x22e5d1[_0x9a16('0x33')]=_0x22e5d1[_0x9a16('0x33')][_0x9a16('0x35')]?_0x22e5d1[_0x9a16('0x33')]:_0x159891['model'];_0x22e5d1[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x195a29[_0x9a16('0x2f')][_0x9a16('0x39')]);_0x22e5d1['where']=qs[_0x9a16('0x31')](_['pick'](_0x195a29[_0x9a16('0x2f')],_0x159891[_0x9a16('0x31')]));if(_0x195a29[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x22e5d1[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0x22e5d1['where'],{'$or':_[_0x9a16('0x2e')](_0x22e5d1[_0x9a16('0x33')],function(_0x260ba1){var _0x39127a={};_0x39127a[_0x260ba1]={'$like':'%'+_0x195a29[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0x39127a;})});}_0x22e5d1=_[_0x9a16('0x3e')]({},_0x22e5d1,_0x195a29[_0x9a16('0x3f')]);return _0x592669[_0x9a16('0x61')](_0x22e5d1);}})['then'](function(_0x284c15){if(_0x284c15){_0xdaf8ad=_0x284c15['length'];if(!_0x195a29[_0x9a16('0x2f')]['hasOwnProperty']('nolimit')){_0x22e5d1['limit']=qs[_0x9a16('0x1d')](_0x195a29[_0x9a16('0x2f')]['limit']);_0x22e5d1['offset']=qs[_0x9a16('0x1b')](_0x195a29[_0x9a16('0x2f')][_0x9a16('0x1b')]);}return _0x592669[_0x9a16('0x61')](_0x22e5d1);}})['then'](function(_0x2a8d2d){if(_0x2a8d2d){return _0x2a8d2d?{'count':_0xdaf8ad,'rows':_0x2a8d2d}:null;}})['then'](respondWithResult(_0x49cebf,null))['catch'](handleError(_0x49cebf,null));};exports[_0x9a16('0x62')]=function(_0x559581,_0x5b332b,_0x4be2e5){var _0x370523,_0x3af669;return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x559581[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x5b332b,null))[_0x9a16('0x24')](function(_0xba1c55){if(_0xba1c55){_0x3af669=_0xba1c55;return _0xba1c55[_0x9a16('0x62')](_0x559581[_0x9a16('0x53')]['ids'],_['omit'](_0x559581[_0x9a16('0x53')],[_0x9a16('0x63'),'id'])||{});}return null;})['spread'](function(_0x5eddb3){var _0x428a0e;_0x370523=_0x5eddb3||[];var _0x342278=[];if(_0x5eddb3){for(var _0x3fe33a=0x0;_0x3fe33a<_0x5eddb3[_0x9a16('0x35')];_0x3fe33a+=0x1){var _0xbfae=_0x5eddb3[_0x3fe33a][_0x9a16('0x25')]({'plain':!![]});_0x3af669['dialCheckDuplicateType']=_0x559581[_0x9a16('0x53')][_0x9a16('0x64')]?_0x559581[_0x9a16('0x53')][_0x9a16('0x64')]:_0x3af669[_0x9a16('0x64')];switch(_0x3af669[_0x9a16('0x64')]){case _0x9a16('0x65'):_0x428a0e=squel[_0x9a16('0x66')]()[_0x9a16('0x67')](_0x9a16('0x68'))[_0x9a16('0x69')]([_0x9a16('0x6a'),_0x9a16('0x6b'),_0x9a16('0x6c'),'ListId',_0x9a16('0x5a'),_0x9a16('0x55'),_0x9a16('0x52')],squel['select']()[_0x9a16('0x6d')]('phone','phone')[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x6b'))[_0x9a16('0x6d')]('id','ContactId')[_0x9a16('0x6d')](_0xbfae['CmListId'][_0x9a16('0x6f')](),_0x9a16('0x70'))[_0x9a16('0x6d')](_0x559581['params']['id']['toString'](),_0x9a16('0x5a'))['field'](_0x9a16('0x6e'),_0x9a16('0x55'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x52'))[_0x9a16('0x71')]('cm_contacts')[_0x9a16('0x3a')](_0x9a16('0x72'))[_0x9a16('0x3a')](_0x9a16('0x73'),_0xbfae[_0x9a16('0x74')]['toString']())['where'](_0x9a16('0x75'))[_0x9a16('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x77'))[_0x9a16('0x71')](_0x9a16('0x78'))[_0x9a16('0x3a')](_0x9a16('0x79'),_0x559581[_0x9a16('0x47')]['id'][_0x9a16('0x6f')]()))[_0x9a16('0x3a')](_0x9a16('0x7a'),squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x7b'))[_0x9a16('0x71')]('cm_hopper')['where'](_0x9a16('0x79'),_0x559581[_0x9a16('0x47')]['id'][_0x9a16('0x6f')]())))[_0x9a16('0x6f')]();break;case _0x9a16('0x7c'):_0x428a0e=squel[_0x9a16('0x66')]()['into']('cm_hopper')[_0x9a16('0x69')](['phone',_0x9a16('0x6b'),'ContactId',_0x9a16('0x70'),_0x9a16('0x5a'),_0x9a16('0x55'),_0x9a16('0x52')],squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x6a'),_0x9a16('0x6a'))['field'](_0x9a16('0x6e'),_0x9a16('0x6b'))[_0x9a16('0x6d')]('id',_0x9a16('0x6c'))[_0x9a16('0x6d')](_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')](),_0x9a16('0x70'))[_0x9a16('0x6d')](_0x559581['params']['id']['toString'](),'CampaignId')[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x55'))[_0x9a16('0x6d')]('NOW()',_0x9a16('0x52'))['from']('cm_contacts')['where'](_0x9a16('0x72'))[_0x9a16('0x3a')](_0x9a16('0x73'),_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')]())[_0x9a16('0x3a')](_0x9a16('0x75'))[_0x9a16('0x3a')](_0x9a16('0x7a'),squel['select']()[_0x9a16('0x6d')](_0x9a16('0x7b'))[_0x9a16('0x71')](_0x9a16('0x68'))[_0x9a16('0x3a')](_0x9a16('0x79'),_0x559581[_0x9a16('0x47')]['id'][_0x9a16('0x6f')]())))[_0x9a16('0x6f')]();break;default:_0x428a0e=squel[_0x9a16('0x66')]()[_0x9a16('0x67')](_0x9a16('0x68'))['fromQuery'](['phone',_0x9a16('0x6b'),_0x9a16('0x6c'),_0x9a16('0x70'),_0x9a16('0x5a'),'createdAt',_0x9a16('0x52')],squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x6a'),_0x9a16('0x6a'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x6b'))[_0x9a16('0x6d')]('id',_0x9a16('0x6c'))[_0x9a16('0x6d')](_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')](),'ListId')['field'](_0x559581['params']['id']['toString'](),'CampaignId')['field'](_0x9a16('0x6e'),_0x9a16('0x55'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x52'))[_0x9a16('0x71')](_0x9a16('0x7d'))[_0x9a16('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0x9a16('0x73'),_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')]())[_0x9a16('0x3a')](_0x9a16('0x75')))['toString']();}_0x342278[_0x9a16('0x7e')](db['sequelize'][_0x9a16('0x2f')](_0x428a0e));}return BPromise[_0x9a16('0x7f')](_0x342278);}})[_0x9a16('0x24')](function(){return _0x370523;})[_0x9a16('0x24')](respondWithResult(_0x5b332b,null))[_0x9a16('0x45')](handleError(_0x5b332b,null));};exports[_0x9a16('0x80')]=function(_0x40a0e2,_0x199255,_0xb8fc2d){return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x40a0e2[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x199255,null))[_0x9a16('0x24')](function(_0x21d101){if(_0x21d101){return _0x21d101['removeLists'](_0x40a0e2[_0x9a16('0x2f')][_0x9a16('0x63')]);}})['then'](function(_0x9a6a1a){if(_0x9a6a1a){return db[_0x9a16('0x59')]['destroy']({'where':{'ListId':_0x40a0e2[_0x9a16('0x2f')][_0x9a16('0x63')],'CampaignId':_0x40a0e2['params']['id']}})['then'](function(){return _0x9a6a1a;});}})[_0x9a16('0x24')](respondWithStatusCode(_0x199255,null))[_0x9a16('0x45')](handleError(_0x199255,null));};exports['getBlackLists']=function(_0x318553,_0x23e42f,_0xb5a6d3){var _0x29d474={};var _0x4db13e={};var _0x26c437;var _0x1a7e4c;return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x318553[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x23e42f,null))[_0x9a16('0x24')](function(_0x3e800a){if(_0x3e800a){_0x26c437=_0x3e800a;_0x4db13e[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db['CmList'][_0x9a16('0x2b')]);_0x4db13e[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x318553['query']);_0x4db13e[_0x9a16('0x31')]=_['intersection'](_0x4db13e[_0x9a16('0x2d')],_0x4db13e[_0x9a16('0x2f')]);_0x29d474[_0x9a16('0x33')]=_['intersection'](_0x4db13e[_0x9a16('0x2d')],qs['fields'](_0x318553[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x29d474[_0x9a16('0x33')]=_0x29d474['attributes'][_0x9a16('0x35')]?_0x29d474[_0x9a16('0x33')]:_0x4db13e[_0x9a16('0x2d')];_0x29d474[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x318553[_0x9a16('0x2f')][_0x9a16('0x39')]);_0x29d474[_0x9a16('0x3a')]=qs['filters'](_['pick'](_0x318553[_0x9a16('0x2f')],_0x4db13e[_0x9a16('0x31')]));if(_0x318553[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x29d474[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0x29d474[_0x9a16('0x3a')],{'$or':_[_0x9a16('0x2e')](_0x29d474[_0x9a16('0x33')],function(_0x3f77b2){var _0x2c23d2={};_0x2c23d2[_0x3f77b2]={'$like':'%'+_0x318553[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0x2c23d2;})});}_0x29d474=_[_0x9a16('0x3e')]({},_0x29d474,_0x318553['options']);return _0x26c437[_0x9a16('0x81')](_0x29d474);}})[_0x9a16('0x24')](function(_0x18d16d){if(_0x18d16d){_0x1a7e4c=_0x18d16d[_0x9a16('0x35')];if(!_0x318553[_0x9a16('0x2f')][_0x9a16('0x36')]('nolimit')){_0x29d474[_0x9a16('0x1d')]=qs[_0x9a16('0x1d')](_0x318553[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0x29d474[_0x9a16('0x1b')]=qs[_0x9a16('0x1b')](_0x318553['query'][_0x9a16('0x1b')]);}return _0x26c437[_0x9a16('0x81')](_0x29d474);}})[_0x9a16('0x24')](function(_0x4aa7a5){if(_0x4aa7a5){return _0x4aa7a5?{'count':_0x1a7e4c,'rows':_0x4aa7a5}:null;}})[_0x9a16('0x24')](respondWithResult(_0x23e42f,null))[_0x9a16('0x45')](handleError(_0x23e42f,null));};exports[_0x9a16('0x82')]=function(_0x442c2a,_0x577692,_0x3e8c12){var _0xcd787,_0x6a5bff;return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x442c2a['params']['id']}})['then'](handleEntityNotFound(_0x577692,null))['then'](function(_0xbb1d3b){if(_0xbb1d3b){_0x6a5bff=_0xbb1d3b;return _0xbb1d3b[_0x9a16('0x82')](_0x442c2a[_0x9a16('0x53')][_0x9a16('0x63')],_[_0x9a16('0x54')](_0x442c2a[_0x9a16('0x53')],[_0x9a16('0x63'),'id'])||{});}return null;})[_0x9a16('0x83')](function(_0x4817be){var _0x64f946;_0xcd787=_0x4817be||[];var _0x20777a=[];if(_0x4817be){for(var _0x5a553b=0x0;_0x5a553b<_0x4817be[_0x9a16('0x35')];_0x5a553b+=0x1){var _0xe45c1e=_0x4817be[_0x5a553b][_0x9a16('0x25')]({'plain':!![]});_0x64f946=squel[_0x9a16('0x66')]()[_0x9a16('0x67')](_0x9a16('0x84'))[_0x9a16('0x69')]([_0x9a16('0x6a'),_0x9a16('0x6c'),_0x9a16('0x70'),'CampaignId',_0x9a16('0x55'),'updatedAt'],squel['select']()[_0x9a16('0x6d')](_0x9a16('0x6a'),_0x9a16('0x6a'))[_0x9a16('0x6d')]('id',_0x9a16('0x6c'))['field'](_0xe45c1e['CmListId']['toString'](),_0x9a16('0x70'))['field'](_0x442c2a['params']['id'][_0x9a16('0x6f')](),_0x9a16('0x5a'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x55'))['field'](_0x9a16('0x6e'),'updatedAt')['from']('cm_contacts')[_0x9a16('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0x9a16('0x73'),_0xe45c1e[_0x9a16('0x74')]['toString']())[_0x9a16('0x3a')](_0x9a16('0x75')))[_0x9a16('0x6f')]();_0x20777a['push'](db[_0x9a16('0x85')]['query'](_0x64f946));}return BPromise['all'](_0x20777a);}})['then'](function(){return _0xcd787;})[_0x9a16('0x24')](respondWithResult(_0x577692,null))['catch'](handleError(_0x577692,null));};exports['removeBlackLists']=function(_0x171a01,_0x12b247,_0x30f28e){return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x171a01[_0x9a16('0x47')]['id']}})['then'](handleEntityNotFound(_0x12b247,null))[_0x9a16('0x24')](function(_0x3906d4){if(_0x3906d4){return _0x3906d4[_0x9a16('0x86')](_0x171a01[_0x9a16('0x2f')][_0x9a16('0x63')]);}})['then'](function(_0xaac4ab){if(_0xaac4ab){return db[_0x9a16('0x60')][_0x9a16('0x27')]({'where':{'ListId':_0x171a01['query'][_0x9a16('0x63')],'CampaignId':_0x171a01[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](function(){return _0xaac4ab;});}})[_0x9a16('0x24')](respondWithStatusCode(_0x12b247,null))[_0x9a16('0x45')](handleError(_0x12b247,null));}; \ No newline at end of file +var _0x9cdd=['filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','UserProfileSection','getHoppers','CmHopper','hasOwnProperty','findAll','getHopperHistories','CampaignId','CmHopperHistory','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ListId','select','field','NOW()','scheduledAt','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','sequelize','all','getBlackLists','addBlackLists','cm_hopper_black','push','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','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','offset','undefined','limit','count','status','set','json','reject','save','update','then','destroy','get','sendStatus','error','name','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0xc007c,_0x20f0f7){var _0x1942b6=function(_0x56c3a2){while(--_0x56c3a2){_0xc007c['push'](_0xc007c['shift']());}};_0x1942b6(++_0x20f0f7);}(_0x9cdd,0x167));var _0xd9cd=function(_0x327199,_0x1283db){_0x327199=_0x327199-0x0;var _0x5a7cf0=_0x9cdd[_0x327199];return _0x5a7cf0;};'use strict';var emlformat=require(_0xd9cd('0x0'));var rimraf=require(_0xd9cd('0x1'));var zipdir=require(_0xd9cd('0x2'));var jsonpatch=require(_0xd9cd('0x3'));var rp=require(_0xd9cd('0x4'));var moment=require(_0xd9cd('0x5'));var BPromise=require(_0xd9cd('0x6'));var Mustache=require(_0xd9cd('0x7'));var util=require(_0xd9cd('0x8'));var path=require('path');var sox=require(_0xd9cd('0x9'));var csv=require(_0xd9cd('0xa'));var ejs=require(_0xd9cd('0xb'));var fs=require('fs');var fs_extra=require(_0xd9cd('0xc'));var _=require(_0xd9cd('0xd'));var squel=require(_0xd9cd('0xe'));var crypto=require(_0xd9cd('0xf'));var jsforce=require(_0xd9cd('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd9cd('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd9cd('0x12'));var as=require(_0xd9cd('0x13'));var hardwareService=require(_0xd9cd('0x14'));var logger=require('../../config/logger')(_0xd9cd('0x15'));var utils=require(_0xd9cd('0x16'));var config=require(_0xd9cd('0x17'));var licenseUtil=require(_0xd9cd('0x18'));var db=require(_0xd9cd('0x19'))['db'];function respondWithStatusCode(_0x4f88a5,_0x3fbbb9){_0x3fbbb9=_0x3fbbb9||0xcc;return function(_0x283691){if(_0x283691){return _0x4f88a5['sendStatus'](_0x3fbbb9);}return _0x4f88a5['status'](_0x3fbbb9)['end']();};}function respondWithResult(_0x1204fe,_0x5e378f){_0x5e378f=_0x5e378f||0xc8;return function(_0x4934a5){if(_0x4934a5){return _0x1204fe['status'](_0x5e378f)['json'](_0x4934a5);}};}function respondWithFilteredResult(_0x55ae65,_0x591c9b){return function(_0x444172){if(_0x444172){var _0x3bc7f0=typeof _0x591c9b[_0xd9cd('0x1a')]===_0xd9cd('0x1b')&&typeof _0x591c9b[_0xd9cd('0x1c')]===_0xd9cd('0x1b');var _0x505309=_0x444172[_0xd9cd('0x1d')];var _0x455170=_0x3bc7f0?0x0:_0x591c9b[_0xd9cd('0x1a')];var _0x5f3d4e=_0x3bc7f0?_0x444172[_0xd9cd('0x1d')]:_0x591c9b['offset']+_0x591c9b[_0xd9cd('0x1c')];var _0x3c70ef;if(_0x5f3d4e>=_0x505309){_0x5f3d4e=_0x505309;_0x3c70ef=0xc8;}else{_0x3c70ef=0xce;}_0x55ae65[_0xd9cd('0x1e')](_0x3c70ef);return _0x55ae65[_0xd9cd('0x1f')]('Content-Range',_0x455170+'-'+_0x5f3d4e+'/'+_0x505309)[_0xd9cd('0x20')](_0x444172);}return null;};}function patchUpdates(_0x287bc9){return function(_0x120912){try{jsonpatch['apply'](_0x120912,_0x287bc9,!![]);}catch(_0x2f6942){return BPromise[_0xd9cd('0x21')](_0x2f6942);}return _0x120912[_0xd9cd('0x22')]();};}function saveUpdates(_0x3fa6b2,_0x4a4012){return function(_0x5506ad){if(_0x5506ad){return _0x5506ad[_0xd9cd('0x23')](_0x3fa6b2)[_0xd9cd('0x24')](function(_0x59a4df){return _0x59a4df;});}return null;};}function removeEntity(_0xe8c303,_0x3f5b0f){return function(_0x3459b6){if(_0x3459b6){return _0x3459b6[_0xd9cd('0x25')]()[_0xd9cd('0x24')](function(){var _0x269cd4=_0x3459b6[_0xd9cd('0x26')]({'plain':!![]});var _0x211359='IvrCampaigns';return db['UserProfileResource'][_0xd9cd('0x25')]({'where':{'type':_0x211359,'resourceId':_0x269cd4['id']}})[_0xd9cd('0x24')](function(){return _0x3459b6;});})[_0xd9cd('0x24')](function(){_0xe8c303[_0xd9cd('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d73d6,_0x2d7c08){return function(_0x520a72){if(!_0x520a72){_0x4d73d6[_0xd9cd('0x27')](0x194);}return _0x520a72;};}function handleError(_0x50107f,_0x1371e5){_0x1371e5=_0x1371e5||0x1f4;return function(_0x55d3f5){logger[_0xd9cd('0x28')](_0x55d3f5['stack']);if(_0x55d3f5[_0xd9cd('0x29')]){delete _0x55d3f5[_0xd9cd('0x29')];}_0x50107f[_0xd9cd('0x1e')](_0x1371e5)['send'](_0x55d3f5);};}exports[_0xd9cd('0x2a')]=function(_0x33a452,_0x599b68){var _0x5cb100={},_0x43bfe3={},_0x7f6535={'count':0x0,'rows':[]};var _0xceeabf=_['map'](db[_0xd9cd('0x2b')][_0xd9cd('0x2c')],function(_0x316f96){return{'name':_0x316f96[_0xd9cd('0x2d')],'type':_0x316f96[_0xd9cd('0x2e')][_0xd9cd('0x2f')]};});_0x43bfe3[_0xd9cd('0x30')]=_[_0xd9cd('0x31')](_0xceeabf,_0xd9cd('0x29'));_0x43bfe3[_0xd9cd('0x32')]=_[_0xd9cd('0x33')](_0x33a452[_0xd9cd('0x32')]);_0x43bfe3[_0xd9cd('0x34')]=_[_0xd9cd('0x35')](_0x43bfe3[_0xd9cd('0x30')],_0x43bfe3['query']);_0x5cb100[_0xd9cd('0x36')]=_[_0xd9cd('0x35')](_0x43bfe3[_0xd9cd('0x30')],qs[_0xd9cd('0x37')](_0x33a452['query'][_0xd9cd('0x37')]));_0x5cb100['attributes']=_0x5cb100['attributes'][_0xd9cd('0x38')]?_0x5cb100[_0xd9cd('0x36')]:_0x43bfe3[_0xd9cd('0x30')];if(!_0x33a452[_0xd9cd('0x32')]['hasOwnProperty'](_0xd9cd('0x39'))){_0x5cb100[_0xd9cd('0x1c')]=qs[_0xd9cd('0x1c')](_0x33a452[_0xd9cd('0x32')]['limit']);_0x5cb100['offset']=qs[_0xd9cd('0x1a')](_0x33a452['query'][_0xd9cd('0x1a')]);}_0x5cb100[_0xd9cd('0x3a')]=qs[_0xd9cd('0x3b')](_0x33a452[_0xd9cd('0x32')][_0xd9cd('0x3b')]);_0x5cb100[_0xd9cd('0x3c')]=qs[_0xd9cd('0x34')](_[_0xd9cd('0x3d')](_0x33a452['query'],_0x43bfe3[_0xd9cd('0x34')]),_0xceeabf);if(_0x33a452[_0xd9cd('0x32')]['filter']){_0x5cb100[_0xd9cd('0x3c')]=_[_0xd9cd('0x3e')](_0x5cb100[_0xd9cd('0x3c')],{'$or':_[_0xd9cd('0x31')](_0xceeabf,function(_0x316c4e){if(_0x316c4e[_0xd9cd('0x2e')]!==_0xd9cd('0x3f')){var _0x2ce6ad={};_0x2ce6ad[_0x316c4e['name']]={'$like':'%'+_0x33a452['query'][_0xd9cd('0x40')]+'%'};return _0x2ce6ad;}})});}_0x5cb100=_[_0xd9cd('0x3e')]({},_0x5cb100,_0x33a452[_0xd9cd('0x41')]);var _0x5f010d={'where':_0x5cb100['where']};return db[_0xd9cd('0x2b')]['count'](_0x5f010d)[_0xd9cd('0x24')](function(_0xc0b5a5){_0x7f6535[_0xd9cd('0x1d')]=_0xc0b5a5;if(_0x33a452[_0xd9cd('0x32')][_0xd9cd('0x42')]){_0x5cb100[_0xd9cd('0x43')]=[{'all':!![]}];}return db[_0xd9cd('0x2b')]['findAll'](_0x5cb100);})[_0xd9cd('0x24')](function(_0x316795){_0x7f6535[_0xd9cd('0x44')]=_0x316795;return _0x7f6535;})[_0xd9cd('0x24')](respondWithFilteredResult(_0x599b68,_0x5cb100))[_0xd9cd('0x45')](handleError(_0x599b68,null));};exports[_0xd9cd('0x46')]=function(_0x1123ff,_0xdb863c){var _0x429154={'raw':![],'where':{'id':_0x1123ff[_0xd9cd('0x47')]['id']}},_0x2ab754={};_0x2ab754[_0xd9cd('0x30')]=_[_0xd9cd('0x33')](db[_0xd9cd('0x2b')][_0xd9cd('0x2c')]);_0x2ab754['query']=_[_0xd9cd('0x33')](_0x1123ff[_0xd9cd('0x32')]);_0x2ab754[_0xd9cd('0x34')]=_[_0xd9cd('0x35')](_0x2ab754[_0xd9cd('0x30')],_0x2ab754['query']);_0x429154[_0xd9cd('0x36')]=_[_0xd9cd('0x35')](_0x2ab754[_0xd9cd('0x30')],qs['fields'](_0x1123ff['query'][_0xd9cd('0x37')]));_0x429154[_0xd9cd('0x36')]=_0x429154[_0xd9cd('0x36')][_0xd9cd('0x38')]?_0x429154[_0xd9cd('0x36')]:_0x2ab754[_0xd9cd('0x30')];if(_0x1123ff[_0xd9cd('0x32')][_0xd9cd('0x42')]){_0x429154[_0xd9cd('0x43')]=[{'all':!![]}];}_0x429154=_['merge']({},_0x429154,_0x1123ff[_0xd9cd('0x41')]);return db[_0xd9cd('0x2b')][_0xd9cd('0x48')](_0x429154)['then'](handleEntityNotFound(_0xdb863c,null))[_0xd9cd('0x24')](respondWithResult(_0xdb863c,null))[_0xd9cd('0x45')](handleError(_0xdb863c,null));};exports[_0xd9cd('0x49')]=function(_0x15470f,_0x4aac35){return db[_0xd9cd('0x2b')]['create'](_0x15470f[_0xd9cd('0x4a')],{})[_0xd9cd('0x24')](function(_0x467c44){var _0x31ab0e=_0x15470f[_0xd9cd('0x4b')][_0xd9cd('0x26')]({'plain':!![]});if(!_0x31ab0e)throw new Error(_0xd9cd('0x4c'));if(_0x31ab0e[_0xd9cd('0x4d')]===_0xd9cd('0x4b')){var _0x1e7354=_0x467c44[_0xd9cd('0x26')]({'plain':!![]});var _0x3aaae5=_0xd9cd('0x4e');return db['UserProfileSection'][_0xd9cd('0x48')]({'where':{'name':_0x3aaae5,'userProfileId':_0x31ab0e[_0xd9cd('0x4f')]},'raw':!![]})[_0xd9cd('0x24')](function(_0x2330fe){if(_0x2330fe&&_0x2330fe[_0xd9cd('0x50')]===0x0){return db[_0xd9cd('0x51')][_0xd9cd('0x49')]({'name':_0x1e7354['name'],'resourceId':_0x1e7354['id'],'type':_0x2330fe[_0xd9cd('0x29')],'sectionId':_0x2330fe['id']},{})['then'](function(){return _0x467c44;});}else{return _0x467c44;}})[_0xd9cd('0x45')](function(_0x2b56d7){logger[_0xd9cd('0x28')](_0xd9cd('0x52'),_0x2b56d7);throw _0x2b56d7;});}return _0x467c44;})[_0xd9cd('0x24')](respondWithResult(_0x4aac35,0xc9))[_0xd9cd('0x45')](handleError(_0x4aac35,null));};exports[_0xd9cd('0x53')]=function(_0x215fe9,_0xc1e37f){var _0x3835fa={'where':{'id':_0x215fe9['params']['id']}},_0x531746={};_0x531746[_0xd9cd('0x30')]=_[_0xd9cd('0x33')](db['Campaign']['rawAttributes']);_0x3835fa[_0xd9cd('0x36')]=_[_0xd9cd('0x35')](_0x531746[_0xd9cd('0x30')],qs[_0xd9cd('0x37')](_0x215fe9['query'][_0xd9cd('0x37')]));_0x3835fa[_0xd9cd('0x36')]=_0x3835fa[_0xd9cd('0x36')]['length']?_0x3835fa[_0xd9cd('0x36')]:_0x531746['model'];if(_0x215fe9['query'][_0xd9cd('0x42')]){_0x3835fa[_0xd9cd('0x43')]=[{'all':!![]}];}_0x3835fa=_[_0xd9cd('0x3e')]({},_0x3835fa,_0x215fe9[_0xd9cd('0x41')]);return db[_0xd9cd('0x2b')][_0xd9cd('0x48')](_0x3835fa)[_0xd9cd('0x24')](handleEntityNotFound(_0xc1e37f,null))[_0xd9cd('0x24')](function(_0x213c55){if(_0x213c55){var _0x225f95=_0x213c55[_0xd9cd('0x26')]({'plain':!![]});_0x225f95=qs['omit'](_0x225f95,['id',_0xd9cd('0x54'),_0xd9cd('0x55')]);_0x215fe9[_0xd9cd('0x4a')]=_[_0xd9cd('0x56')](_0x215fe9[_0xd9cd('0x4a')],['id',_0xd9cd('0x54'),'updatedAt']);return db[_0xd9cd('0x2b')][_0xd9cd('0x49')](_[_0xd9cd('0x3e')](_0x225f95,_0x215fe9[_0xd9cd('0x4a')]),{'include':_0x215fe9[_0xd9cd('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xd9cd('0x24')](function(_0x5bb55f){var _0xf25617=_0x215fe9['user']['get']({'plain':!![]});if(!_0xf25617)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf25617['role']===_0xd9cd('0x4b')){var _0xd73988=_0x5bb55f[_0xd9cd('0x26')]({'plain':!![]});var _0x5bb5de=_0xd9cd('0x4e');return db[_0xd9cd('0x57')][_0xd9cd('0x48')]({'where':{'name':_0x5bb5de,'userProfileId':_0xf25617[_0xd9cd('0x4f')]},'raw':!![]})[_0xd9cd('0x24')](function(_0x215ab3){if(_0x215ab3&&_0x215ab3['autoAssociation']===0x0){return db[_0xd9cd('0x51')]['create']({'name':_0xd73988['name'],'resourceId':_0xd73988['id'],'type':_0x215ab3['name'],'sectionId':_0x215ab3['id']},{})[_0xd9cd('0x24')](function(){return _0x5bb55f;});}else{return _0x5bb55f;}})['catch'](function(_0x25f17e){logger['error'](_0xd9cd('0x52'),_0x25f17e);throw _0x25f17e;});}return _0x5bb55f;});}})[_0xd9cd('0x24')](respondWithResult(_0xc1e37f,0xc9))[_0xd9cd('0x45')](handleError(_0xc1e37f,null));};exports[_0xd9cd('0x23')]=function(_0x5438ee,_0x300f56){if(_0x5438ee['body']['id']){delete _0x5438ee[_0xd9cd('0x4a')]['id'];}return db[_0xd9cd('0x2b')][_0xd9cd('0x48')]({'where':{'id':_0x5438ee[_0xd9cd('0x47')]['id']}})['then'](handleEntityNotFound(_0x300f56,null))[_0xd9cd('0x24')](saveUpdates(_0x5438ee[_0xd9cd('0x4a')],null))['then'](respondWithResult(_0x300f56,null))['catch'](handleError(_0x300f56,null));};exports[_0xd9cd('0x25')]=function(_0x5d335b,_0x4a0635){return db[_0xd9cd('0x2b')][_0xd9cd('0x48')]({'where':{'id':_0x5d335b['params']['id']}})[_0xd9cd('0x24')](handleEntityNotFound(_0x4a0635,null))[_0xd9cd('0x24')](removeEntity(_0x4a0635,null))['catch'](handleError(_0x4a0635,null));};exports[_0xd9cd('0x58')]=function(_0x1a338b,_0xe406b8,_0x2d2125){var _0x2ebf56={'raw':!![],'where':{}};var _0x4c036a={};var _0x395b64={'count':0x0,'rows':[]};return db[_0xd9cd('0x2b')]['findOne']({'where':{'id':_0x1a338b[_0xd9cd('0x47')]['id']}})[_0xd9cd('0x24')](handleEntityNotFound(_0xe406b8,null))[_0xd9cd('0x24')](function(_0x12bdd0){if(_0x12bdd0){_0x4c036a['model']=_[_0xd9cd('0x33')](db[_0xd9cd('0x59')]['rawAttributes']);_0x4c036a[_0xd9cd('0x32')]=_[_0xd9cd('0x33')](_0x1a338b['query']);_0x4c036a['filters']=_[_0xd9cd('0x35')](_0x4c036a[_0xd9cd('0x30')],_0x4c036a[_0xd9cd('0x32')]);_0x2ebf56[_0xd9cd('0x36')]=_[_0xd9cd('0x35')](_0x4c036a[_0xd9cd('0x30')],qs['fields'](_0x1a338b[_0xd9cd('0x32')][_0xd9cd('0x37')]));_0x2ebf56[_0xd9cd('0x36')]=_0x2ebf56['attributes'][_0xd9cd('0x38')]?_0x2ebf56[_0xd9cd('0x36')]:_0x4c036a[_0xd9cd('0x30')];if(!_0x1a338b['query'][_0xd9cd('0x5a')](_0xd9cd('0x39'))){_0x2ebf56[_0xd9cd('0x1c')]=qs['limit'](_0x1a338b[_0xd9cd('0x32')][_0xd9cd('0x1c')]);_0x2ebf56['offset']=qs[_0xd9cd('0x1a')](_0x1a338b[_0xd9cd('0x32')]['offset']);}_0x2ebf56[_0xd9cd('0x3a')]=qs['sort'](_0x1a338b[_0xd9cd('0x32')][_0xd9cd('0x3b')]);_0x2ebf56[_0xd9cd('0x3c')]=qs['filters'](_['pick'](_0x1a338b[_0xd9cd('0x32')],_0x4c036a[_0xd9cd('0x34')]));_0x2ebf56[_0xd9cd('0x3c')]['CampaignId']=_0x12bdd0['id'];if(_0x1a338b[_0xd9cd('0x32')]['filter']){_0x2ebf56[_0xd9cd('0x3c')]=_[_0xd9cd('0x3e')](_0x2ebf56[_0xd9cd('0x3c')],{'$or':_[_0xd9cd('0x31')](_0x2ebf56['attributes'],function(_0x399270){var _0x58bb8c={};_0x58bb8c[_0x399270]={'$like':'%'+_0x1a338b[_0xd9cd('0x32')][_0xd9cd('0x40')]+'%'};return _0x58bb8c;})});}_0x2ebf56=_[_0xd9cd('0x3e')]({},_0x2ebf56,_0x1a338b['options']);return db[_0xd9cd('0x59')][_0xd9cd('0x1d')]({'where':_0x2ebf56[_0xd9cd('0x3c')]})['then'](function(_0x370f04){_0x395b64['count']=_0x370f04;if(_0x1a338b[_0xd9cd('0x32')][_0xd9cd('0x42')]){_0x2ebf56[_0xd9cd('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0xd9cd('0x5b')](_0x2ebf56);})[_0xd9cd('0x24')](function(_0x2144cc){_0x395b64[_0xd9cd('0x44')]=_0x2144cc;return _0x395b64;});}})[_0xd9cd('0x24')](respondWithFilteredResult(_0xe406b8,_0x2ebf56))[_0xd9cd('0x45')](handleError(_0xe406b8,null));};exports[_0xd9cd('0x5c')]=function(_0xefaa1e,_0x6e586a,_0x35989c){var _0x18426b={'raw':!![],'where':{}};var _0x1d92c6={};var _0x1c3e0f={'count':0x0,'rows':[]};return db[_0xd9cd('0x2b')]['findOne']({'where':{'id':_0xefaa1e[_0xd9cd('0x47')]['id']}})[_0xd9cd('0x24')](handleEntityNotFound(_0x6e586a,null))[_0xd9cd('0x24')](function(_0x15b53f){if(_0x15b53f){_0x1d92c6[_0xd9cd('0x30')]=_['keys'](db['CmHopperHistory'][_0xd9cd('0x2c')]);_0x1d92c6[_0xd9cd('0x32')]=_[_0xd9cd('0x33')](_0xefaa1e[_0xd9cd('0x32')]);_0x1d92c6[_0xd9cd('0x34')]=_[_0xd9cd('0x35')](_0x1d92c6[_0xd9cd('0x30')],_0x1d92c6['query']);_0x18426b[_0xd9cd('0x36')]=_['intersection'](_0x1d92c6[_0xd9cd('0x30')],qs[_0xd9cd('0x37')](_0xefaa1e['query'][_0xd9cd('0x37')]));_0x18426b[_0xd9cd('0x36')]=_0x18426b[_0xd9cd('0x36')]['length']?_0x18426b[_0xd9cd('0x36')]:_0x1d92c6['model'];if(!_0xefaa1e[_0xd9cd('0x32')]['hasOwnProperty'](_0xd9cd('0x39'))){_0x18426b[_0xd9cd('0x1c')]=qs[_0xd9cd('0x1c')](_0xefaa1e[_0xd9cd('0x32')][_0xd9cd('0x1c')]);_0x18426b[_0xd9cd('0x1a')]=qs[_0xd9cd('0x1a')](_0xefaa1e['query']['offset']);}_0x18426b[_0xd9cd('0x3a')]=qs[_0xd9cd('0x3b')](_0xefaa1e[_0xd9cd('0x32')][_0xd9cd('0x3b')]);_0x18426b[_0xd9cd('0x3c')]=qs[_0xd9cd('0x34')](_[_0xd9cd('0x3d')](_0xefaa1e[_0xd9cd('0x32')],_0x1d92c6['filters']));_0x18426b['where'][_0xd9cd('0x5d')]=_0x15b53f['id'];if(_0xefaa1e[_0xd9cd('0x32')][_0xd9cd('0x40')]){_0x18426b[_0xd9cd('0x3c')]=_[_0xd9cd('0x3e')](_0x18426b['where'],{'$or':_[_0xd9cd('0x31')](_0x18426b[_0xd9cd('0x36')],function(_0x44414a){var _0xa7d7a9={};_0xa7d7a9[_0x44414a]={'$like':'%'+_0xefaa1e[_0xd9cd('0x32')]['filter']+'%'};return _0xa7d7a9;})});}_0x18426b=_[_0xd9cd('0x3e')]({},_0x18426b,_0xefaa1e[_0xd9cd('0x41')]);return db[_0xd9cd('0x5e')]['count']({'where':_0x18426b[_0xd9cd('0x3c')]})[_0xd9cd('0x24')](function(_0x420b57){_0x1c3e0f[_0xd9cd('0x1d')]=_0x420b57;if(_0xefaa1e[_0xd9cd('0x32')][_0xd9cd('0x42')]){_0x18426b[_0xd9cd('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd9cd('0x5b')](_0x18426b);})['then'](function(_0xcdff02){_0x1c3e0f['rows']=_0xcdff02;return _0x1c3e0f;});}})[_0xd9cd('0x24')](respondWithFilteredResult(_0x6e586a,_0x18426b))['catch'](handleError(_0x6e586a,null));};exports['getHopperFinals']=function(_0x1438ff,_0x5cbd2f,_0x2b203a){var _0x422aae={'raw':!![],'where':{}};var _0x189a7b={};var _0x25e4a9={'count':0x0,'rows':[]};return db[_0xd9cd('0x2b')][_0xd9cd('0x5f')]({'where':{'id':_0x1438ff[_0xd9cd('0x47')]['id']}})[_0xd9cd('0x24')](handleEntityNotFound(_0x5cbd2f,null))[_0xd9cd('0x24')](function(_0x3f6c2a){if(_0x3f6c2a){_0x189a7b[_0xd9cd('0x30')]=_[_0xd9cd('0x33')](db[_0xd9cd('0x60')][_0xd9cd('0x2c')]);_0x189a7b[_0xd9cd('0x32')]=_[_0xd9cd('0x33')](_0x1438ff[_0xd9cd('0x32')]);_0x189a7b['filters']=_['intersection'](_0x189a7b[_0xd9cd('0x30')],_0x189a7b['query']);_0x422aae[_0xd9cd('0x36')]=_[_0xd9cd('0x35')](_0x189a7b[_0xd9cd('0x30')],qs['fields'](_0x1438ff['query'][_0xd9cd('0x37')]));_0x422aae[_0xd9cd('0x36')]=_0x422aae[_0xd9cd('0x36')][_0xd9cd('0x38')]?_0x422aae['attributes']:_0x189a7b[_0xd9cd('0x30')];if(!_0x1438ff[_0xd9cd('0x32')][_0xd9cd('0x5a')]('nolimit')){_0x422aae[_0xd9cd('0x1c')]=qs[_0xd9cd('0x1c')](_0x1438ff[_0xd9cd('0x32')][_0xd9cd('0x1c')]);_0x422aae[_0xd9cd('0x1a')]=qs[_0xd9cd('0x1a')](_0x1438ff['query'][_0xd9cd('0x1a')]);}_0x422aae[_0xd9cd('0x3a')]=qs[_0xd9cd('0x3b')](_0x1438ff[_0xd9cd('0x32')]['sort']);_0x422aae[_0xd9cd('0x3c')]=qs[_0xd9cd('0x34')](_[_0xd9cd('0x3d')](_0x1438ff[_0xd9cd('0x32')],_0x189a7b[_0xd9cd('0x34')]));_0x422aae['where']['CampaignId']=_0x3f6c2a['id'];if(_0x1438ff[_0xd9cd('0x32')][_0xd9cd('0x40')]){_0x422aae[_0xd9cd('0x3c')]=_[_0xd9cd('0x3e')](_0x422aae[_0xd9cd('0x3c')],{'$or':_[_0xd9cd('0x31')](_0x422aae[_0xd9cd('0x36')],function(_0x2485ad){var _0x3ec385={};_0x3ec385[_0x2485ad]={'$like':'%'+_0x1438ff[_0xd9cd('0x32')][_0xd9cd('0x40')]+'%'};return _0x3ec385;})});}_0x422aae=_[_0xd9cd('0x3e')]({},_0x422aae,_0x1438ff['options']);return db['CmHopperFinal']['count']({'where':_0x422aae[_0xd9cd('0x3c')]})[_0xd9cd('0x24')](function(_0x43369c){_0x25e4a9[_0xd9cd('0x1d')]=_0x43369c;if(_0x1438ff[_0xd9cd('0x32')]['includeAll']){_0x422aae[_0xd9cd('0x43')]=[{'all':!![]}];}return db[_0xd9cd('0x60')][_0xd9cd('0x5b')](_0x422aae);})[_0xd9cd('0x24')](function(_0x59120e){_0x25e4a9[_0xd9cd('0x44')]=_0x59120e;return _0x25e4a9;});}})[_0xd9cd('0x24')](respondWithFilteredResult(_0x5cbd2f,_0x422aae))[_0xd9cd('0x45')](handleError(_0x5cbd2f,null));};exports[_0xd9cd('0x61')]=function(_0xee168e,_0x5553cc,_0x43a96b){var _0xde7ee1={'raw':!![],'where':{}};var _0x44e91f={};var _0x492655={'count':0x0,'rows':[]};return db[_0xd9cd('0x2b')][_0xd9cd('0x5f')]({'where':{'id':_0xee168e[_0xd9cd('0x47')]['id']}})[_0xd9cd('0x24')](handleEntityNotFound(_0x5553cc,null))[_0xd9cd('0x24')](function(_0x3eb5cf){if(_0x3eb5cf){_0x44e91f[_0xd9cd('0x30')]=_[_0xd9cd('0x33')](db[_0xd9cd('0x62')][_0xd9cd('0x2c')]);_0x44e91f[_0xd9cd('0x32')]=_[_0xd9cd('0x33')](_0xee168e['query']);_0x44e91f[_0xd9cd('0x34')]=_['intersection'](_0x44e91f['model'],_0x44e91f['query']);_0xde7ee1[_0xd9cd('0x36')]=_[_0xd9cd('0x35')](_0x44e91f[_0xd9cd('0x30')],qs[_0xd9cd('0x37')](_0xee168e[_0xd9cd('0x32')][_0xd9cd('0x37')]));_0xde7ee1[_0xd9cd('0x36')]=_0xde7ee1['attributes'][_0xd9cd('0x38')]?_0xde7ee1[_0xd9cd('0x36')]:_0x44e91f[_0xd9cd('0x30')];if(!_0xee168e[_0xd9cd('0x32')]['hasOwnProperty'](_0xd9cd('0x39'))){_0xde7ee1[_0xd9cd('0x1c')]=qs['limit'](_0xee168e['query']['limit']);_0xde7ee1[_0xd9cd('0x1a')]=qs[_0xd9cd('0x1a')](_0xee168e[_0xd9cd('0x32')][_0xd9cd('0x1a')]);}_0xde7ee1[_0xd9cd('0x3a')]=qs[_0xd9cd('0x3b')](_0xee168e['query'][_0xd9cd('0x3b')]);_0xde7ee1['where']=qs['filters'](_['pick'](_0xee168e[_0xd9cd('0x32')],_0x44e91f['filters']));_0xde7ee1[_0xd9cd('0x3c')][_0xd9cd('0x5d')]=_0x3eb5cf['id'];if(_0xee168e['query'][_0xd9cd('0x40')]){_0xde7ee1[_0xd9cd('0x3c')]=_[_0xd9cd('0x3e')](_0xde7ee1['where'],{'$or':_[_0xd9cd('0x31')](_0xde7ee1[_0xd9cd('0x36')],function(_0x5e4f3e){var _0x3b665c={};_0x3b665c[_0x5e4f3e]={'$like':'%'+_0xee168e['query']['filter']+'%'};return _0x3b665c;})});}_0xde7ee1=_['merge']({},_0xde7ee1,_0xee168e[_0xd9cd('0x41')]);return db[_0xd9cd('0x62')][_0xd9cd('0x1d')]({'where':_0xde7ee1[_0xd9cd('0x3c')]})[_0xd9cd('0x24')](function(_0x30a132){_0x492655[_0xd9cd('0x1d')]=_0x30a132;if(_0xee168e[_0xd9cd('0x32')][_0xd9cd('0x42')]){_0xde7ee1[_0xd9cd('0x43')]=[{'all':!![]}];}return db[_0xd9cd('0x62')][_0xd9cd('0x5b')](_0xde7ee1);})['then'](function(_0x52d317){_0x492655[_0xd9cd('0x44')]=_0x52d317;return _0x492655;});}})[_0xd9cd('0x24')](respondWithFilteredResult(_0x5553cc,_0xde7ee1))[_0xd9cd('0x45')](handleError(_0x5553cc,null));};exports[_0xd9cd('0x63')]=function(_0x2ccd27,_0x40a416,_0x6fecd8){var _0x2374c9={};var _0x5041ef={};var _0x14389b;var _0x5eebe3;return db[_0xd9cd('0x2b')][_0xd9cd('0x5f')]({'where':{'id':_0x2ccd27[_0xd9cd('0x47')]['id']}})['then'](handleEntityNotFound(_0x40a416,null))[_0xd9cd('0x24')](function(_0xa905ba){if(_0xa905ba){_0x14389b=_0xa905ba;_0x5041ef[_0xd9cd('0x30')]=_['keys'](db[_0xd9cd('0x64')][_0xd9cd('0x2c')]);_0x5041ef['query']=_[_0xd9cd('0x33')](_0x2ccd27[_0xd9cd('0x32')]);_0x5041ef[_0xd9cd('0x34')]=_[_0xd9cd('0x35')](_0x5041ef[_0xd9cd('0x30')],_0x5041ef[_0xd9cd('0x32')]);_0x2374c9[_0xd9cd('0x36')]=_[_0xd9cd('0x35')](_0x5041ef[_0xd9cd('0x30')],qs[_0xd9cd('0x37')](_0x2ccd27[_0xd9cd('0x32')]['fields']));_0x2374c9['attributes']=_0x2374c9[_0xd9cd('0x36')]['length']?_0x2374c9[_0xd9cd('0x36')]:_0x5041ef['model'];_0x2374c9[_0xd9cd('0x3a')]=qs[_0xd9cd('0x3b')](_0x2ccd27[_0xd9cd('0x32')][_0xd9cd('0x3b')]);_0x2374c9['where']=qs[_0xd9cd('0x34')](_[_0xd9cd('0x3d')](_0x2ccd27[_0xd9cd('0x32')],_0x5041ef[_0xd9cd('0x34')]));if(_0x2ccd27[_0xd9cd('0x32')][_0xd9cd('0x40')]){_0x2374c9[_0xd9cd('0x3c')]=_['merge'](_0x2374c9[_0xd9cd('0x3c')],{'$or':_[_0xd9cd('0x31')](_0x2374c9[_0xd9cd('0x36')],function(_0x4748d7){var _0x8ea80a={};_0x8ea80a[_0x4748d7]={'$like':'%'+_0x2ccd27[_0xd9cd('0x32')][_0xd9cd('0x40')]+'%'};return _0x8ea80a;})});}_0x2374c9=_[_0xd9cd('0x3e')]({},_0x2374c9,_0x2ccd27[_0xd9cd('0x41')]);return _0x14389b['getLists'](_0x2374c9);}})['then'](function(_0x28f312){if(_0x28f312){_0x5eebe3=_0x28f312[_0xd9cd('0x38')];if(!_0x2ccd27['query'][_0xd9cd('0x5a')](_0xd9cd('0x39'))){_0x2374c9[_0xd9cd('0x1c')]=qs['limit'](_0x2ccd27[_0xd9cd('0x32')][_0xd9cd('0x1c')]);_0x2374c9[_0xd9cd('0x1a')]=qs[_0xd9cd('0x1a')](_0x2ccd27['query']['offset']);}return _0x14389b[_0xd9cd('0x63')](_0x2374c9);}})[_0xd9cd('0x24')](function(_0x10f21d){if(_0x10f21d){return _0x10f21d?{'count':_0x5eebe3,'rows':_0x10f21d}:null;}})[_0xd9cd('0x24')](respondWithResult(_0x40a416,null))[_0xd9cd('0x45')](handleError(_0x40a416,null));};exports[_0xd9cd('0x65')]=function(_0x5b7522,_0x4797d1,_0x37a75c){var _0x48db75,_0x403681;return db[_0xd9cd('0x2b')][_0xd9cd('0x48')]({'where':{'id':_0x5b7522[_0xd9cd('0x47')]['id']}})[_0xd9cd('0x24')](handleEntityNotFound(_0x4797d1,null))[_0xd9cd('0x24')](function(_0x26b208){if(_0x26b208){_0x403681=_0x26b208;return _0x26b208['addLists'](_0x5b7522[_0xd9cd('0x4a')][_0xd9cd('0x66')],_[_0xd9cd('0x56')](_0x5b7522[_0xd9cd('0x4a')],['ids','id'])||{});}return null;})[_0xd9cd('0x67')](function(_0x391b6f){var _0x5ab86c;_0x48db75=_0x391b6f||[];var _0x24597a=[];if(_0x391b6f){for(var _0x1d0006=0x0;_0x1d0006<_0x391b6f[_0xd9cd('0x38')];_0x1d0006+=0x1){var _0x400ebe=_0x391b6f[_0x1d0006]['get']({'plain':!![]});_0x403681[_0xd9cd('0x68')]=_0x5b7522[_0xd9cd('0x4a')][_0xd9cd('0x68')]?_0x5b7522['body']['dialCheckDuplicateType']:_0x403681[_0xd9cd('0x68')];switch(_0x403681[_0xd9cd('0x68')]){case _0xd9cd('0x69'):_0x5ab86c=squel[_0xd9cd('0x6a')]()[_0xd9cd('0x6b')](_0xd9cd('0x6c'))[_0xd9cd('0x6d')]([_0xd9cd('0x6e'),'scheduledAt','ContactId',_0xd9cd('0x6f'),_0xd9cd('0x5d'),'createdAt',_0xd9cd('0x55')],squel[_0xd9cd('0x70')]()[_0xd9cd('0x71')](_0xd9cd('0x6e'),_0xd9cd('0x6e'))[_0xd9cd('0x71')](_0xd9cd('0x72'),_0xd9cd('0x73'))['field']('id',_0xd9cd('0x74'))[_0xd9cd('0x71')](_0x400ebe[_0xd9cd('0x75')][_0xd9cd('0x76')](),_0xd9cd('0x6f'))['field'](_0x5b7522[_0xd9cd('0x47')]['id'][_0xd9cd('0x76')](),'CampaignId')[_0xd9cd('0x71')](_0xd9cd('0x72'),_0xd9cd('0x54'))[_0xd9cd('0x71')](_0xd9cd('0x72'),_0xd9cd('0x55'))['from'](_0xd9cd('0x77'))[_0xd9cd('0x3c')](_0xd9cd('0x78'))[_0xd9cd('0x3c')](_0xd9cd('0x79'),_0x400ebe['CmListId']['toString']())[_0xd9cd('0x3c')](_0xd9cd('0x7a'))[_0xd9cd('0x3c')](_0xd9cd('0x7b'),squel[_0xd9cd('0x70')]()['field'](_0xd9cd('0x7c'))[_0xd9cd('0x7d')](_0xd9cd('0x7e'))[_0xd9cd('0x3c')](_0xd9cd('0x7f'),_0x5b7522[_0xd9cd('0x47')]['id'][_0xd9cd('0x76')]()))[_0xd9cd('0x3c')](_0xd9cd('0x7b'),squel[_0xd9cd('0x70')]()['field'](_0xd9cd('0x80'))['from'](_0xd9cd('0x6c'))[_0xd9cd('0x3c')](_0xd9cd('0x7f'),_0x5b7522[_0xd9cd('0x47')]['id'][_0xd9cd('0x76')]())))[_0xd9cd('0x76')]();break;case _0xd9cd('0x81'):_0x5ab86c=squel[_0xd9cd('0x6a')]()[_0xd9cd('0x6b')](_0xd9cd('0x6c'))[_0xd9cd('0x6d')](['phone',_0xd9cd('0x73'),_0xd9cd('0x74'),_0xd9cd('0x6f'),_0xd9cd('0x5d'),_0xd9cd('0x54'),'updatedAt'],squel[_0xd9cd('0x70')]()[_0xd9cd('0x71')](_0xd9cd('0x6e'),_0xd9cd('0x6e'))[_0xd9cd('0x71')](_0xd9cd('0x72'),_0xd9cd('0x73'))[_0xd9cd('0x71')]('id',_0xd9cd('0x74'))['field'](_0x400ebe['CmListId']['toString'](),'ListId')['field'](_0x5b7522[_0xd9cd('0x47')]['id'][_0xd9cd('0x76')](),_0xd9cd('0x5d'))[_0xd9cd('0x71')](_0xd9cd('0x72'),_0xd9cd('0x54'))[_0xd9cd('0x71')](_0xd9cd('0x72'),_0xd9cd('0x55'))['from'](_0xd9cd('0x77'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x400ebe[_0xd9cd('0x75')][_0xd9cd('0x76')]())[_0xd9cd('0x3c')](_0xd9cd('0x7a'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd9cd('0x70')]()['field'](_0xd9cd('0x80'))['from'](_0xd9cd('0x6c'))['where'](_0xd9cd('0x7f'),_0x5b7522[_0xd9cd('0x47')]['id'][_0xd9cd('0x76')]())))[_0xd9cd('0x76')]();break;default:_0x5ab86c=squel[_0xd9cd('0x6a')]()[_0xd9cd('0x6b')](_0xd9cd('0x6c'))[_0xd9cd('0x6d')](['phone',_0xd9cd('0x73'),_0xd9cd('0x74'),'ListId',_0xd9cd('0x5d'),_0xd9cd('0x54'),_0xd9cd('0x55')],squel[_0xd9cd('0x70')]()[_0xd9cd('0x71')](_0xd9cd('0x6e'),_0xd9cd('0x6e'))[_0xd9cd('0x71')](_0xd9cd('0x72'),_0xd9cd('0x73'))[_0xd9cd('0x71')]('id','ContactId')[_0xd9cd('0x71')](_0x400ebe[_0xd9cd('0x75')][_0xd9cd('0x76')](),_0xd9cd('0x6f'))[_0xd9cd('0x71')](_0x5b7522[_0xd9cd('0x47')]['id'][_0xd9cd('0x76')](),_0xd9cd('0x5d'))[_0xd9cd('0x71')](_0xd9cd('0x72'),_0xd9cd('0x54'))['field'](_0xd9cd('0x72'),_0xd9cd('0x55'))['from'](_0xd9cd('0x77'))[_0xd9cd('0x3c')](_0xd9cd('0x78'))[_0xd9cd('0x3c')](_0xd9cd('0x79'),_0x400ebe[_0xd9cd('0x75')]['toString']())[_0xd9cd('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xd9cd('0x76')]();}_0x24597a['push'](db[_0xd9cd('0x82')][_0xd9cd('0x32')](_0x5ab86c));}return BPromise[_0xd9cd('0x83')](_0x24597a);}})[_0xd9cd('0x24')](function(){return _0x48db75;})[_0xd9cd('0x24')](respondWithResult(_0x4797d1,null))[_0xd9cd('0x45')](handleError(_0x4797d1,null));};exports['removeLists']=function(_0x1bd6e8,_0x35c9e9,_0x2cc981){return db[_0xd9cd('0x2b')][_0xd9cd('0x48')]({'where':{'id':_0x1bd6e8[_0xd9cd('0x47')]['id']}})[_0xd9cd('0x24')](handleEntityNotFound(_0x35c9e9,null))[_0xd9cd('0x24')](function(_0x4ce4e3){if(_0x4ce4e3){return _0x4ce4e3['removeLists'](_0x1bd6e8[_0xd9cd('0x32')]['ids']);}})['then'](function(_0x342d72){if(_0x342d72){return db[_0xd9cd('0x59')]['destroy']({'where':{'ListId':_0x1bd6e8[_0xd9cd('0x32')][_0xd9cd('0x66')],'CampaignId':_0x1bd6e8[_0xd9cd('0x47')]['id']}})[_0xd9cd('0x24')](function(){return _0x342d72;});}})[_0xd9cd('0x24')](respondWithStatusCode(_0x35c9e9,null))[_0xd9cd('0x45')](handleError(_0x35c9e9,null));};exports[_0xd9cd('0x84')]=function(_0x1247de,_0x46784c,_0x27b4cc){var _0x403c31={};var _0x1a99b1={};var _0xf856c2;var _0x2f2628;return db[_0xd9cd('0x2b')][_0xd9cd('0x5f')]({'where':{'id':_0x1247de['params']['id']}})['then'](handleEntityNotFound(_0x46784c,null))[_0xd9cd('0x24')](function(_0x27bb49){if(_0x27bb49){_0xf856c2=_0x27bb49;_0x1a99b1[_0xd9cd('0x30')]=_['keys'](db[_0xd9cd('0x64')][_0xd9cd('0x2c')]);_0x1a99b1[_0xd9cd('0x32')]=_[_0xd9cd('0x33')](_0x1247de[_0xd9cd('0x32')]);_0x1a99b1[_0xd9cd('0x34')]=_[_0xd9cd('0x35')](_0x1a99b1[_0xd9cd('0x30')],_0x1a99b1[_0xd9cd('0x32')]);_0x403c31[_0xd9cd('0x36')]=_[_0xd9cd('0x35')](_0x1a99b1[_0xd9cd('0x30')],qs[_0xd9cd('0x37')](_0x1247de[_0xd9cd('0x32')][_0xd9cd('0x37')]));_0x403c31['attributes']=_0x403c31['attributes']['length']?_0x403c31[_0xd9cd('0x36')]:_0x1a99b1[_0xd9cd('0x30')];_0x403c31['order']=qs[_0xd9cd('0x3b')](_0x1247de[_0xd9cd('0x32')][_0xd9cd('0x3b')]);_0x403c31['where']=qs[_0xd9cd('0x34')](_['pick'](_0x1247de[_0xd9cd('0x32')],_0x1a99b1['filters']));if(_0x1247de[_0xd9cd('0x32')][_0xd9cd('0x40')]){_0x403c31[_0xd9cd('0x3c')]=_[_0xd9cd('0x3e')](_0x403c31['where'],{'$or':_['map'](_0x403c31[_0xd9cd('0x36')],function(_0x4e4c7c){var _0x31f637={};_0x31f637[_0x4e4c7c]={'$like':'%'+_0x1247de[_0xd9cd('0x32')][_0xd9cd('0x40')]+'%'};return _0x31f637;})});}_0x403c31=_[_0xd9cd('0x3e')]({},_0x403c31,_0x1247de[_0xd9cd('0x41')]);return _0xf856c2[_0xd9cd('0x84')](_0x403c31);}})['then'](function(_0x180248){if(_0x180248){_0x2f2628=_0x180248[_0xd9cd('0x38')];if(!_0x1247de[_0xd9cd('0x32')][_0xd9cd('0x5a')]('nolimit')){_0x403c31['limit']=qs[_0xd9cd('0x1c')](_0x1247de['query'][_0xd9cd('0x1c')]);_0x403c31['offset']=qs[_0xd9cd('0x1a')](_0x1247de['query'][_0xd9cd('0x1a')]);}return _0xf856c2[_0xd9cd('0x84')](_0x403c31);}})[_0xd9cd('0x24')](function(_0x5827b8){if(_0x5827b8){return _0x5827b8?{'count':_0x2f2628,'rows':_0x5827b8}:null;}})[_0xd9cd('0x24')](respondWithResult(_0x46784c,null))[_0xd9cd('0x45')](handleError(_0x46784c,null));};exports[_0xd9cd('0x85')]=function(_0x1ef614,_0x7fb6ea,_0x362f58){var _0x51f5fb,_0x2bfa6f;return db[_0xd9cd('0x2b')]['find']({'where':{'id':_0x1ef614['params']['id']}})[_0xd9cd('0x24')](handleEntityNotFound(_0x7fb6ea,null))['then'](function(_0x1a709b){if(_0x1a709b){_0x2bfa6f=_0x1a709b;return _0x1a709b[_0xd9cd('0x85')](_0x1ef614[_0xd9cd('0x4a')][_0xd9cd('0x66')],_[_0xd9cd('0x56')](_0x1ef614[_0xd9cd('0x4a')],['ids','id'])||{});}return null;})['spread'](function(_0x1f2526){var _0x104067;_0x51f5fb=_0x1f2526||[];var _0x1dd464=[];if(_0x1f2526){for(var _0x3c6f04=0x0;_0x3c6f04<_0x1f2526[_0xd9cd('0x38')];_0x3c6f04+=0x1){var _0x1acc31=_0x1f2526[_0x3c6f04]['get']({'plain':!![]});_0x104067=squel[_0xd9cd('0x6a')]()[_0xd9cd('0x6b')](_0xd9cd('0x86'))[_0xd9cd('0x6d')]([_0xd9cd('0x6e'),_0xd9cd('0x74'),_0xd9cd('0x6f'),_0xd9cd('0x5d'),_0xd9cd('0x54'),_0xd9cd('0x55')],squel['select']()['field'](_0xd9cd('0x6e'),_0xd9cd('0x6e'))[_0xd9cd('0x71')]('id',_0xd9cd('0x74'))[_0xd9cd('0x71')](_0x1acc31[_0xd9cd('0x75')][_0xd9cd('0x76')](),_0xd9cd('0x6f'))[_0xd9cd('0x71')](_0x1ef614[_0xd9cd('0x47')]['id'][_0xd9cd('0x76')](),_0xd9cd('0x5d'))['field'](_0xd9cd('0x72'),_0xd9cd('0x54'))[_0xd9cd('0x71')]('NOW()',_0xd9cd('0x55'))[_0xd9cd('0x7d')]('cm_contacts')[_0xd9cd('0x3c')](_0xd9cd('0x78'))[_0xd9cd('0x3c')](_0xd9cd('0x79'),_0x1acc31[_0xd9cd('0x75')][_0xd9cd('0x76')]())['where'](_0xd9cd('0x7a')))[_0xd9cd('0x76')]();_0x1dd464[_0xd9cd('0x87')](db['sequelize'][_0xd9cd('0x32')](_0x104067));}return BPromise[_0xd9cd('0x83')](_0x1dd464);}})[_0xd9cd('0x24')](function(){return _0x51f5fb;})[_0xd9cd('0x24')](respondWithResult(_0x7fb6ea,null))[_0xd9cd('0x45')](handleError(_0x7fb6ea,null));};exports[_0xd9cd('0x88')]=function(_0x26ae1c,_0x4ef409,_0x2ebea0){return db[_0xd9cd('0x2b')][_0xd9cd('0x48')]({'where':{'id':_0x26ae1c['params']['id']}})[_0xd9cd('0x24')](handleEntityNotFound(_0x4ef409,null))[_0xd9cd('0x24')](function(_0x3d514c){if(_0x3d514c){return _0x3d514c[_0xd9cd('0x88')](_0x26ae1c['query'][_0xd9cd('0x66')]);}})[_0xd9cd('0x24')](function(_0x3d9fa2){if(_0x3d9fa2){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x26ae1c[_0xd9cd('0x32')][_0xd9cd('0x66')],'CampaignId':_0x26ae1c['params']['id']}})['then'](function(){return _0x3d9fa2;});}})[_0xd9cd('0x24')](respondWithStatusCode(_0x4ef409,null))[_0xd9cd('0x45')](handleError(_0x4ef409,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 4d4ddaa..65ec0a9 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x14e589,_0x5d5c97){var _0x4ceb8c=function(_0x55f065){while(--_0x55f065){_0x14e589['push'](_0x14e589['shift']());}};_0x4ceb8c(++_0x5d5c97);}(_0x7a54,0x106));var _0x47a5=function(_0x522bef,_0x4b6cae){_0x522bef=_0x522bef-0x0;var _0x38c629=_0x7a54[_0x522bef];return _0x38c629;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1c9f7b,_0x2dc4b0){var _0x580a06=function(_0x2c858f){while(--_0x2c858f){_0x1c9f7b['push'](_0x1c9f7b['shift']());}};_0x580a06(++_0x2dc4b0);}(_0x7a54,0x106));var _0x47a5=function(_0xd4bfa5,_0x178d96){_0xd4bfa5=_0xd4bfa5-0x0;var _0x3418d2=_0x7a54[_0xd4bfa5];return _0x3418d2;};'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 ddc5ee1..41b2ba3 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 _0x4403=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCampaign','findAll','options','raw','where','attributes','include','model','map'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4403,0x179));var _0x3440=function(_0x136de0,_0xed928c){_0x136de0=_0x136de0-0x0;var _0x3a08df=_0x4403[_0x136de0];return _0x3a08df;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3440('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3440('0x1'));var db=require(_0x3440('0x2'))['db'];var utils=require(_0x3440('0x3'));var logger=require(_0x3440('0x4'))('rpc');var config=require(_0x3440('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3440('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3121bd,_0x338e48,_0x4abc5a){return new BPromise(function(_0x33a070,_0x59d581){return client[_0x3440('0x7')](_0x3121bd,_0x4abc5a)[_0x3440('0x8')](function(_0x4559cd){logger['info'](_0x3440('0x9'),_0x338e48,_0x3440('0xa'));logger[_0x3440('0xb')](_0x3440('0xc'),_0x338e48,_0x3440('0xa'),JSON[_0x3440('0xd')](_0x4559cd));if(_0x4559cd[_0x3440('0xe')]){if(_0x4559cd['error'][_0x3440('0xf')]===0x1f4){logger[_0x3440('0xe')](_0x3440('0x9'),_0x338e48,_0x4559cd['error'][_0x3440('0x10')]);return _0x59d581(_0x4559cd[_0x3440('0xe')][_0x3440('0x10')]);}logger[_0x3440('0xe')](_0x3440('0x9'),_0x338e48,_0x4559cd['error'][_0x3440('0x10')]);return _0x33a070(_0x4559cd['error'][_0x3440('0x10')]);}else{logger[_0x3440('0x11')](_0x3440('0x9'),_0x338e48,_0x3440('0xa'));_0x33a070(_0x4559cd[_0x3440('0x12')][_0x3440('0x10')]);}})[_0x3440('0x13')](function(_0xb66a69){logger['error'](_0x3440('0x9'),_0x338e48,_0xb66a69);_0x59d581(_0xb66a69);});});}exports[_0x3440('0x14')]=function(_0x43fd39){var _0x1c10fd=this;return new Promise(function(_0x31a8dd,_0x39ee81){return db['Campaign'][_0x3440('0x15')]({'raw':_0x43fd39[_0x3440('0x16')]?_0x43fd39[_0x3440('0x16')][_0x3440('0x17')]===undefined?!![]:![]:!![],'where':_0x43fd39[_0x3440('0x16')]?_0x43fd39[_0x3440('0x16')][_0x3440('0x18')]||null:null,'attributes':_0x43fd39[_0x3440('0x16')]?_0x43fd39[_0x3440('0x16')][_0x3440('0x19')]||null:null,'limit':_0x43fd39[_0x3440('0x16')]?_0x43fd39['options']['limit']||null:null,'include':_0x43fd39['options']?_0x43fd39[_0x3440('0x16')][_0x3440('0x1a')]?_['map'](_0x43fd39[_0x3440('0x16')][_0x3440('0x1a')],function(_0x33cfb5){return{'model':db[_0x33cfb5[_0x3440('0x1b')]],'as':_0x33cfb5['as'],'attributes':_0x33cfb5[_0x3440('0x19')],'include':_0x33cfb5['include']?_[_0x3440('0x1c')](_0x33cfb5[_0x3440('0x1a')],function(_0x3b9e75){return{'model':db[_0x3b9e75[_0x3440('0x1b')]],'as':_0x3b9e75['as'],'attributes':_0x3b9e75[_0x3440('0x19')],'include':_0x3b9e75['include']?_[_0x3440('0x1c')](_0x3b9e75[_0x3440('0x1a')],function(_0x1cfe3a){return{'model':db[_0x1cfe3a[_0x3440('0x1b')]],'as':_0x1cfe3a['as'],'attributes':_0x1cfe3a[_0x3440('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x391728){logger[_0x3440('0x11')](_0x3440('0x14'),_0x43fd39);logger[_0x3440('0xb')](_0x3440('0x14'),_0x43fd39,JSON[_0x3440('0xd')](_0x391728));_0x31a8dd(_0x391728);})[_0x3440('0x13')](function(_0x1f7fee){logger[_0x3440('0xe')](_0x3440('0x14'),_0x1f7fee[_0x3440('0x10')],_0x43fd39);_0x39ee81(_0x1c10fd['error'](0x1f4,_0x1f7fee['message']));});});}; \ No newline at end of file +var _0xf675=['../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc1edf4,_0x26b0db){var _0x11c9aa=function(_0x25ad6b){while(--_0x25ad6b){_0xc1edf4['push'](_0xc1edf4['shift']());}};_0x11c9aa(++_0x26b0db);}(_0xf675,0x199));var _0x5f67=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0xf675[_0xce93c];return _0x230720;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var moment=require(_0x5f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f67('0x4'))['db'];var utils=require(_0x5f67('0x5'));var logger=require(_0x5f67('0x6'))('rpc');var config=require(_0x5f67('0x7'));var jayson=require(_0x5f67('0x8'));var client=jayson[_0x5f67('0x9')][_0x5f67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b67eb,_0xc71a7,_0x121d19){return new BPromise(function(_0x55efcd,_0x5749f5){return client[_0x5f67('0xb')](_0x5b67eb,_0x121d19)[_0x5f67('0xc')](function(_0x530ef1){logger['info'](_0x5f67('0xd'),_0xc71a7,_0x5f67('0xe'));logger[_0x5f67('0xf')]('Campaign,\x20%s,\x20%s,\x20%s',_0xc71a7,'request\x20sent',JSON['stringify'](_0x530ef1));if(_0x530ef1[_0x5f67('0x10')]){if(_0x530ef1[_0x5f67('0x10')]['code']===0x1f4){logger[_0x5f67('0x10')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x5749f5(_0x530ef1[_0x5f67('0x10')][_0x5f67('0x11')]);}logger[_0x5f67('0x10')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x55efcd(_0x530ef1[_0x5f67('0x10')]['message']);}else{logger[_0x5f67('0x12')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x5f67('0xe'));_0x55efcd(_0x530ef1[_0x5f67('0x13')][_0x5f67('0x11')]);}})[_0x5f67('0x14')](function(_0x444ee5){logger[_0x5f67('0x10')](_0x5f67('0xd'),_0xc71a7,_0x444ee5);_0x5749f5(_0x444ee5);});});}exports[_0x5f67('0x15')]=function(_0xc539c6){var _0x8f3bd6=this;return new Promise(function(_0x5275d6,_0x5bc956){return db[_0x5f67('0x16')][_0x5f67('0x17')]({'raw':_0xc539c6['options']?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x19')]===undefined?!![]:![]:!![],'where':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1a')]||null:null,'attributes':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1b')]||null:null,'limit':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1c')]||null:null,'include':_0xc539c6[_0x5f67('0x18')]?_0xc539c6['options'][_0x5f67('0x1d')]?_[_0x5f67('0x1e')](_0xc539c6[_0x5f67('0x18')]['include'],function(_0x537b39){return{'model':db[_0x537b39[_0x5f67('0x1f')]],'as':_0x537b39['as'],'attributes':_0x537b39[_0x5f67('0x1b')],'include':_0x537b39['include']?_[_0x5f67('0x1e')](_0x537b39[_0x5f67('0x1d')],function(_0x241d17){return{'model':db[_0x241d17[_0x5f67('0x1f')]],'as':_0x241d17['as'],'attributes':_0x241d17['attributes'],'include':_0x241d17[_0x5f67('0x1d')]?_['map'](_0x241d17[_0x5f67('0x1d')],function(_0x167601){return{'model':db[_0x167601['model']],'as':_0x167601['as'],'attributes':_0x167601[_0x5f67('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5f67('0xc')](function(_0x57f373){logger['info'](_0x5f67('0x15'),_0xc539c6);logger[_0x5f67('0xf')](_0x5f67('0x15'),_0xc539c6,JSON['stringify'](_0x57f373));_0x5275d6(_0x57f373);})[_0x5f67('0x14')](function(_0xd36b79){logger['error'](_0x5f67('0x15'),_0xd36b79[_0x5f67('0x11')],_0xc539c6);_0x5bc956(_0x8f3bd6['error'](0x1f4,_0xd36b79[_0x5f67('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 83500fe..01e1f01 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 _0xa051=['./campaign.controller','isAuthenticated','index','/:id','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','put','update','destroy','delete','removeLists','removeBlackLists','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0xa051,0x156));var _0x1a05=function(_0x48d94e,_0xfbb342){_0x48d94e=_0x48d94e-0x0;var _0x1fd8e8=_0xa051[_0x48d94e];return _0x1fd8e8;};'use strict';var multer=require(_0x1a05('0x0'));var util=require('util');var path=require(_0x1a05('0x1'));var timeout=require('connect-timeout');var express=require(_0x1a05('0x2'));var router=express[_0x1a05('0x3')]();var fs_extra=require(_0x1a05('0x4'));var auth=require(_0x1a05('0x5'));var interaction=require(_0x1a05('0x6'));var config=require(_0x1a05('0x7'));var controller=require(_0x1a05('0x8'));router['get']('/',auth[_0x1a05('0x9')](),controller[_0x1a05('0xa')]);router['get'](_0x1a05('0xb'),auth[_0x1a05('0x9')](),controller[_0x1a05('0xc')]);router[_0x1a05('0xd')](_0x1a05('0xe'),auth[_0x1a05('0x9')](),controller[_0x1a05('0xf')]);router[_0x1a05('0xd')](_0x1a05('0x10'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x11')]);router[_0x1a05('0xd')](_0x1a05('0x12'),auth['isAuthenticated'](),controller[_0x1a05('0x13')]);router[_0x1a05('0xd')]('/:id/hopper_black',auth[_0x1a05('0x9')](),controller['getHopperBlacks']);router[_0x1a05('0xd')](_0x1a05('0x14'),auth['isAuthenticated'](),controller[_0x1a05('0x15')]);router[_0x1a05('0xd')](_0x1a05('0x16'),auth['isAuthenticated'](),controller[_0x1a05('0x17')]);router[_0x1a05('0x18')]('/',auth['isAuthenticated'](),controller[_0x1a05('0x19')]);router['post'](_0x1a05('0x1a'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x1b')]);router[_0x1a05('0x18')](_0x1a05('0x14'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0x1a05('0x16'),auth[_0x1a05('0x9')](),controller['addBlackLists']);router[_0x1a05('0x1c')](_0x1a05('0xb'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x1d')]);router['delete'](_0x1a05('0xb'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x1e')]);router[_0x1a05('0x1f')](_0x1a05('0x14'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x20')]);router[_0x1a05('0x1f')](_0x1a05('0x16'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x21')]);module[_0x1a05('0x22')]=router; \ No newline at end of file +var _0x2aec=['addLists','addBlackLists','put','/:id','delete','destroy','removeLists','removeBlackLists','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists'];(function(_0x438df9,_0x1746b7){var _0x296bef=function(_0x45b00e){while(--_0x45b00e){_0x438df9['push'](_0x438df9['shift']());}};_0x296bef(++_0x1746b7);}(_0x2aec,0x1dd));var _0xc2ae=function(_0x33d433,_0x410e4b){_0x33d433=_0x33d433-0x0;var _0x584876=_0x2aec[_0x33d433];return _0x584876;};'use strict';var multer=require(_0xc2ae('0x0'));var util=require('util');var path=require(_0xc2ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xc2ae('0x2'));var router=express[_0xc2ae('0x3')]();var fs_extra=require(_0xc2ae('0x4'));var auth=require(_0xc2ae('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc2ae('0x6'));router[_0xc2ae('0x7')]('/',auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x9')]);router[_0xc2ae('0x7')]('/:id',auth[_0xc2ae('0x8')](),controller[_0xc2ae('0xa')]);router[_0xc2ae('0x7')](_0xc2ae('0xb'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0xc')]);router[_0xc2ae('0x7')](_0xc2ae('0xd'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0xe')]);router['get'](_0xc2ae('0xf'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x10')]);router[_0xc2ae('0x7')](_0xc2ae('0x11'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x12')]);router[_0xc2ae('0x7')]('/:id/lists',auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x13')]);router[_0xc2ae('0x7')](_0xc2ae('0x14'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x15')]);router[_0xc2ae('0x16')]('/',auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x17')]);router[_0xc2ae('0x16')](_0xc2ae('0x18'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x19')]);router['post'](_0xc2ae('0x1a'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x1b')]);router[_0xc2ae('0x16')](_0xc2ae('0x14'),auth['isAuthenticated'](),controller[_0xc2ae('0x1c')]);router[_0xc2ae('0x1d')](_0xc2ae('0x1e'),auth[_0xc2ae('0x8')](),controller['update']);router[_0xc2ae('0x1f')]('/:id',auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x20')]);router[_0xc2ae('0x1f')](_0xc2ae('0x1a'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x21')]);router[_0xc2ae('0x1f')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xc2ae('0x22')]);module[_0xc2ae('0x23')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c6465cf..b88d43b 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 _0xf0f6=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x482404,_0x15fb83){var _0x3e8826=function(_0x188b5e){while(--_0x188b5e){_0x482404['push'](_0x482404['shift']());}};_0x3e8826(++_0x15fb83);}(_0xf0f6,0x159));var _0x6f0f=function(_0x1ea797,_0x158bed){_0x1ea797=_0x1ea797-0x0;var _0x420fba=_0xf0f6[_0x1ea797];return _0x420fba;};'use strict';var Sequelize=require(_0x6f0f('0x0'));module[_0x6f0f('0x1')]={'key':{'type':Sequelize[_0x6f0f('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x6f0f('0x2')]},'name':{'type':Sequelize[_0x6f0f('0x3')],'get':function(){return this[_0x6f0f('0x4')](_0x6f0f('0x5'));}}}; \ No newline at end of file +var _0x8af3=['VIRTUAL','getDataValue','key','exports','STRING','TEXT'];(function(_0x437e13,_0x3af614){var _0x1b5131=function(_0x4f5393){while(--_0x4f5393){_0x437e13['push'](_0x437e13['shift']());}};_0x1b5131(++_0x3af614);}(_0x8af3,0x153));var _0x38af=function(_0x484388,_0x58bb1d){_0x484388=_0x484388-0x0;var _0x508f72=_0x8af3[_0x484388];return _0x508f72;};'use strict';var Sequelize=require('sequelize');module[_0x38af('0x0')]={'key':{'type':Sequelize[_0x38af('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x38af('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x38af('0x1')]},'name':{'type':Sequelize[_0x38af('0x3')],'get':function(){return this[_0x38af('0x4')](_0x38af('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c426712..747bdcd 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 _0x78f0=['map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','include','CannedAnswer','findAll','show','options','find','catch','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','name','index','rawAttributes','type','key','model'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x78f0,0x75));var _0x078f=function(_0x170b3e,_0x46abbf){_0x170b3e=_0x170b3e-0x0;var _0xff2428=_0x78f0[_0x170b3e];return _0xff2428;};'use strict';var emlformat=require(_0x078f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x078f('0x1'));var rp=require(_0x078f('0x2'));var moment=require(_0x078f('0x3'));var BPromise=require(_0x078f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x078f('0x5'));var sox=require(_0x078f('0x6'));var csv=require(_0x078f('0x7'));var ejs=require(_0x078f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x078f('0x9'));var crypto=require(_0x078f('0xa'));var jsforce=require(_0x078f('0xb'));var deskjs=require(_0x078f('0xc'));var toCsv=require(_0x078f('0x7'));var querystring=require('querystring');var Papa=require(_0x078f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x078f('0xe'));var as=require(_0x078f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x078f('0x10'));var utils=require('../../config/utils');var config=require(_0x078f('0x11'));var licenseUtil=require(_0x078f('0x12'));var db=require(_0x078f('0x13'))['db'];function respondWithStatusCode(_0x34d250,_0x8c2cb5){_0x8c2cb5=_0x8c2cb5||0xcc;return function(_0x505cad){if(_0x505cad){return _0x34d250[_0x078f('0x14')](_0x8c2cb5);}return _0x34d250[_0x078f('0x15')](_0x8c2cb5)[_0x078f('0x16')]();};}function respondWithResult(_0x35e44d,_0x2dabf4){_0x2dabf4=_0x2dabf4||0xc8;return function(_0x2a5d84){if(_0x2a5d84){return _0x35e44d['status'](_0x2dabf4)[_0x078f('0x17')](_0x2a5d84);}};}function respondWithFilteredResult(_0x3b86d5,_0x4647b0){return function(_0x45ab09){if(_0x45ab09){var _0x1e8ecb=typeof _0x4647b0['offset']==='undefined'&&typeof _0x4647b0[_0x078f('0x18')]===_0x078f('0x19');var _0x4c44b8=_0x45ab09[_0x078f('0x1a')];var _0x4fca98=_0x1e8ecb?0x0:_0x4647b0[_0x078f('0x1b')];var _0xe0bb18=_0x1e8ecb?_0x45ab09['count']:_0x4647b0[_0x078f('0x1b')]+_0x4647b0['limit'];var _0x4f1eb0;if(_0xe0bb18>=_0x4c44b8){_0xe0bb18=_0x4c44b8;_0x4f1eb0=0xc8;}else{_0x4f1eb0=0xce;}_0x3b86d5[_0x078f('0x15')](_0x4f1eb0);return _0x3b86d5[_0x078f('0x1c')](_0x078f('0x1d'),_0x4fca98+'-'+_0xe0bb18+'/'+_0x4c44b8)[_0x078f('0x17')](_0x45ab09);}return null;};}function patchUpdates(_0xcbe3be){return function(_0x133047){try{jsonpatch[_0x078f('0x1e')](_0x133047,_0xcbe3be,!![]);}catch(_0x4f1452){return BPromise['reject'](_0x4f1452);}return _0x133047[_0x078f('0x1f')]();};}function saveUpdates(_0x2865e7,_0x3951d9){return function(_0x13c9b4){if(_0x13c9b4){return _0x13c9b4[_0x078f('0x20')](_0x2865e7)[_0x078f('0x21')](function(_0x1877d9){return _0x1877d9;});}return null;};}function removeEntity(_0x3af948,_0xfeefbb){return function(_0x10a87c){if(_0x10a87c){return _0x10a87c['destroy']()['then'](function(){var _0x51dea1=_0x10a87c[_0x078f('0x22')]({'plain':!![]});var _0x214dbd=_0x078f('0x23');return db[_0x078f('0x24')][_0x078f('0x25')]({'where':{'type':_0x214dbd,'resourceId':_0x51dea1['id']}})['then'](function(){return _0x10a87c;});})[_0x078f('0x21')](function(){_0x3af948[_0x078f('0x15')](0xcc)[_0x078f('0x16')]();});}};}function handleEntityNotFound(_0x162007,_0x4c4956){return function(_0x513f5f){if(!_0x513f5f){_0x162007[_0x078f('0x14')](0x194);}return _0x513f5f;};}function handleError(_0x3fa572,_0x564b92){_0x564b92=_0x564b92||0x1f4;return function(_0xa16216){logger[_0x078f('0x26')](_0xa16216['stack']);if(_0xa16216[_0x078f('0x27')]){delete _0xa16216[_0x078f('0x27')];}_0x3fa572['status'](_0x564b92)['send'](_0xa16216);};}exports[_0x078f('0x28')]=function(_0xe30a88,_0x5952ea){var _0x103f7f={},_0x292f60={},_0x40c028={'count':0x0,'rows':[]};var _0x5b4596=_['map'](db['CannedAnswer'][_0x078f('0x29')],function(_0x53b18e){return{'name':_0x53b18e['fieldName'],'type':_0x53b18e[_0x078f('0x2a')][_0x078f('0x2b')]};});_0x292f60[_0x078f('0x2c')]=_[_0x078f('0x2d')](_0x5b4596,_0x078f('0x27'));_0x292f60['query']=_[_0x078f('0x2e')](_0xe30a88[_0x078f('0x2f')]);_0x292f60[_0x078f('0x30')]=_[_0x078f('0x31')](_0x292f60[_0x078f('0x2c')],_0x292f60[_0x078f('0x2f')]);_0x103f7f[_0x078f('0x32')]=_[_0x078f('0x31')](_0x292f60[_0x078f('0x2c')],qs['fields'](_0xe30a88[_0x078f('0x2f')][_0x078f('0x33')]));_0x103f7f[_0x078f('0x32')]=_0x103f7f[_0x078f('0x32')][_0x078f('0x34')]?_0x103f7f[_0x078f('0x32')]:_0x292f60[_0x078f('0x2c')];if(!_0xe30a88['query']['hasOwnProperty'](_0x078f('0x35'))){_0x103f7f[_0x078f('0x18')]=qs['limit'](_0xe30a88[_0x078f('0x2f')][_0x078f('0x18')]);_0x103f7f[_0x078f('0x1b')]=qs[_0x078f('0x1b')](_0xe30a88['query']['offset']);}_0x103f7f[_0x078f('0x36')]=qs[_0x078f('0x37')](_0xe30a88[_0x078f('0x2f')][_0x078f('0x37')]);_0x103f7f[_0x078f('0x38')]=qs[_0x078f('0x30')](_[_0x078f('0x39')](_0xe30a88['query'],_0x292f60[_0x078f('0x30')]),_0x5b4596);if(_0xe30a88[_0x078f('0x2f')][_0x078f('0x3a')]){_0x103f7f[_0x078f('0x38')]=_[_0x078f('0x3b')](_0x103f7f[_0x078f('0x38')],{'$or':[{'key':{'$like':'%'+_0xe30a88[_0x078f('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0xe30a88['query'][_0x078f('0x3a')]+'%'}}]});}_0x103f7f=_[_0x078f('0x3b')]({},_0x103f7f,_0xe30a88['options']);var _0x2d154d={'where':_0x103f7f['where']};return db['CannedAnswer'][_0x078f('0x1a')](_0x2d154d)[_0x078f('0x21')](function(_0x4b8ff1){_0x40c028[_0x078f('0x1a')]=_0x4b8ff1;if(_0xe30a88[_0x078f('0x2f')]['includeAll']){_0x103f7f[_0x078f('0x3c')]=[{'all':!![]}];}return db[_0x078f('0x3d')][_0x078f('0x3e')](_0x103f7f);})[_0x078f('0x21')](function(_0x44973f){_0x40c028['rows']=_0x44973f;return _0x40c028;})[_0x078f('0x21')](respondWithFilteredResult(_0x5952ea,_0x103f7f))['catch'](handleError(_0x5952ea,null));};exports[_0x078f('0x3f')]=function(_0x5bc926,_0xd92888){var _0x26a1f8={'raw':!![],'where':{'id':_0x5bc926['params']['id']}},_0xf2b449={};_0xf2b449[_0x078f('0x2c')]=_[_0x078f('0x2e')](db[_0x078f('0x3d')][_0x078f('0x29')]);_0xf2b449['query']=_[_0x078f('0x2e')](_0x5bc926[_0x078f('0x2f')]);_0xf2b449[_0x078f('0x30')]=_[_0x078f('0x31')](_0xf2b449[_0x078f('0x2c')],_0xf2b449['query']);_0x26a1f8[_0x078f('0x32')]=_[_0x078f('0x31')](_0xf2b449[_0x078f('0x2c')],qs[_0x078f('0x33')](_0x5bc926['query'][_0x078f('0x33')]));_0x26a1f8[_0x078f('0x32')]=_0x26a1f8[_0x078f('0x32')]['length']?_0x26a1f8['attributes']:_0xf2b449['model'];if(_0x5bc926[_0x078f('0x2f')]['includeAll']){_0x26a1f8[_0x078f('0x3c')]=[{'all':!![]}];}_0x26a1f8=_[_0x078f('0x3b')]({},_0x26a1f8,_0x5bc926[_0x078f('0x40')]);return db[_0x078f('0x3d')][_0x078f('0x41')](_0x26a1f8)[_0x078f('0x21')](handleEntityNotFound(_0xd92888,null))['then'](respondWithResult(_0xd92888,null))[_0x078f('0x42')](handleError(_0xd92888,null));};exports[_0x078f('0x20')]=function(_0x38c205,_0x169434){if(_0x38c205[_0x078f('0x43')]['id']){delete _0x38c205[_0x078f('0x43')]['id'];}return db[_0x078f('0x3d')]['find']({'where':{'id':_0x38c205[_0x078f('0x44')]['id']}})[_0x078f('0x21')](handleEntityNotFound(_0x169434,null))[_0x078f('0x21')](saveUpdates(_0x38c205[_0x078f('0x43')],null))[_0x078f('0x21')](respondWithResult(_0x169434,null))[_0x078f('0x42')](handleError(_0x169434,null));};exports['destroy']=function(_0x53f2a8,_0xa159a2){return db[_0x078f('0x3d')][_0x078f('0x41')]({'where':{'id':_0x53f2a8[_0x078f('0x44')]['id']}})['then'](handleEntityNotFound(_0xa159a2,null))['then'](removeEntity(_0xa159a2,null))['catch'](handleError(_0xa159a2,null));};exports['create']=function(_0x247757,_0x1fa66a){var _0x364301={'key':_0x247757['body'][_0x078f('0x2b')]};if(_0x247757[_0x078f('0x43')]['MailAccountId']){_0x364301[_0x078f('0x45')]=_0x247757[_0x078f('0x43')]['MailAccountId'];}else if(_0x247757['body'][_0x078f('0x46')]){_0x364301[_0x078f('0x46')]=_0x247757[_0x078f('0x43')]['SmsAccountId'];}else if(_0x247757[_0x078f('0x43')][_0x078f('0x47')]){_0x364301['OpenchannelAccountId']=_0x247757[_0x078f('0x43')][_0x078f('0x47')];}else if(_0x247757[_0x078f('0x43')][_0x078f('0x48')]){_0x364301[_0x078f('0x48')]=_0x247757['body'][_0x078f('0x48')];}return db[_0x078f('0x3d')][_0x078f('0x41')]({'where':_0x364301})[_0x078f('0x21')](function(_0x23a14e){if(_0x23a14e){throw new db['Sequelize'][(_0x078f('0x49'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x078f('0x3d')][_0x078f('0x4a')](_0x247757[_0x078f('0x43')]);})[_0x078f('0x21')](function(_0x918295){var _0x4eb85a=_0x247757[_0x078f('0x4b')]['get']({'plain':!![]});if(!_0x4eb85a)throw new Error(_0x078f('0x4c'));if(_0x4eb85a[_0x078f('0x4d')]===_0x078f('0x4b')){var _0x3ad67c=_0x918295[_0x078f('0x22')]({'plain':!![]});return db[_0x078f('0x4e')][_0x078f('0x41')]({'where':{'name':_0x078f('0x23'),'userProfileId':_0x4eb85a[_0x078f('0x4f')]},'raw':!![]})[_0x078f('0x21')](function(_0x1b3605){if(_0x1b3605&&_0x1b3605[_0x078f('0x50')]===0x0){return db[_0x078f('0x24')][_0x078f('0x4a')]({'name':_0x3ad67c['name'],'resourceId':_0x3ad67c['id'],'type':_0x1b3605[_0x078f('0x27')],'sectionId':_0x1b3605['id']},{})[_0x078f('0x21')](function(){return _0x918295;});}else{return _0x918295;}})['catch'](function(_0xddf7d1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xddf7d1);throw _0xddf7d1;});}return _0x918295;})[_0x078f('0x21')](respondWithResult(_0x1fa66a,0xc9))[_0x078f('0x42')](handleError(_0x1fa66a,null));}; \ No newline at end of file +var _0x9396=['CannedAnswer','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','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','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','destroy','then','get','CannedAnswers','UserProfileResource','name','send','index','map'];(function(_0x435c43,_0x518e4b){var _0x44c67e=function(_0x2e0dbf){while(--_0x2e0dbf){_0x435c43['push'](_0x435c43['shift']());}};_0x44c67e(++_0x518e4b);}(_0x9396,0x144));var _0x6939=function(_0x49ad02,_0x1367dc){_0x49ad02=_0x49ad02-0x0;var _0x34506f=_0x9396[_0x49ad02];return _0x34506f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6939('0x0'));var zipdir=require(_0x6939('0x1'));var jsonpatch=require(_0x6939('0x2'));var rp=require(_0x6939('0x3'));var moment=require(_0x6939('0x4'));var BPromise=require(_0x6939('0x5'));var Mustache=require(_0x6939('0x6'));var util=require(_0x6939('0x7'));var path=require(_0x6939('0x8'));var sox=require(_0x6939('0x9'));var csv=require(_0x6939('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6939('0xb'));var _=require(_0x6939('0xc'));var squel=require('squel');var crypto=require(_0x6939('0xd'));var jsforce=require(_0x6939('0xe'));var deskjs=require(_0x6939('0xf'));var toCsv=require(_0x6939('0xa'));var querystring=require(_0x6939('0x10'));var Papa=require(_0x6939('0x11'));var Redis=require(_0x6939('0x12'));var authService=require(_0x6939('0x13'));var qs=require(_0x6939('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6939('0x15'));var logger=require(_0x6939('0x16'))(_0x6939('0x17'));var utils=require('../../config/utils');var config=require(_0x6939('0x18'));var licenseUtil=require(_0x6939('0x19'));var db=require(_0x6939('0x1a'))['db'];function respondWithStatusCode(_0x21b2db,_0xdd4cd0){_0xdd4cd0=_0xdd4cd0||0xcc;return function(_0x25e8c){if(_0x25e8c){return _0x21b2db[_0x6939('0x1b')](_0xdd4cd0);}return _0x21b2db[_0x6939('0x1c')](_0xdd4cd0)[_0x6939('0x1d')]();};}function respondWithResult(_0x1fdcb3,_0x3d2ef4){_0x3d2ef4=_0x3d2ef4||0xc8;return function(_0x2fad0b){if(_0x2fad0b){return _0x1fdcb3[_0x6939('0x1c')](_0x3d2ef4)['json'](_0x2fad0b);}};}function respondWithFilteredResult(_0x371af2,_0x3f9292){return function(_0x225905){if(_0x225905){var _0x47cac7=typeof _0x3f9292[_0x6939('0x1e')]===_0x6939('0x1f')&&typeof _0x3f9292['limit']===_0x6939('0x1f');var _0x327c6=_0x225905['count'];var _0x5832dc=_0x47cac7?0x0:_0x3f9292['offset'];var _0x6bbc4d=_0x47cac7?_0x225905[_0x6939('0x20')]:_0x3f9292[_0x6939('0x1e')]+_0x3f9292[_0x6939('0x21')];var _0x44b1f7;if(_0x6bbc4d>=_0x327c6){_0x6bbc4d=_0x327c6;_0x44b1f7=0xc8;}else{_0x44b1f7=0xce;}_0x371af2['status'](_0x44b1f7);return _0x371af2['set'](_0x6939('0x22'),_0x5832dc+'-'+_0x6bbc4d+'/'+_0x327c6)[_0x6939('0x23')](_0x225905);}return null;};}function patchUpdates(_0x4b2fcf){return function(_0x3fdc59){try{jsonpatch[_0x6939('0x24')](_0x3fdc59,_0x4b2fcf,!![]);}catch(_0x18e615){return BPromise[_0x6939('0x25')](_0x18e615);}return _0x3fdc59['save']();};}function saveUpdates(_0x3e7862,_0x45206d){return function(_0x4343a2){if(_0x4343a2){return _0x4343a2[_0x6939('0x26')](_0x3e7862)['then'](function(_0x3e99e6){return _0x3e99e6;});}return null;};}function removeEntity(_0x17c553,_0x213180){return function(_0x395133){if(_0x395133){return _0x395133[_0x6939('0x27')]()[_0x6939('0x28')](function(){var _0x27d5b3=_0x395133[_0x6939('0x29')]({'plain':!![]});var _0x2be33b=_0x6939('0x2a');return db[_0x6939('0x2b')][_0x6939('0x27')]({'where':{'type':_0x2be33b,'resourceId':_0x27d5b3['id']}})['then'](function(){return _0x395133;});})[_0x6939('0x28')](function(){_0x17c553[_0x6939('0x1c')](0xcc)[_0x6939('0x1d')]();});}};}function handleEntityNotFound(_0x3c9717,_0x385caf){return function(_0x17df41){if(!_0x17df41){_0x3c9717[_0x6939('0x1b')](0x194);}return _0x17df41;};}function handleError(_0x1b796d,_0xdb12cd){_0xdb12cd=_0xdb12cd||0x1f4;return function(_0x4fb1f7){logger['error'](_0x4fb1f7['stack']);if(_0x4fb1f7[_0x6939('0x2c')]){delete _0x4fb1f7[_0x6939('0x2c')];}_0x1b796d[_0x6939('0x1c')](_0xdb12cd)[_0x6939('0x2d')](_0x4fb1f7);};}exports[_0x6939('0x2e')]=function(_0x5750d8,_0x3f21eb){var _0x4eed6c={},_0x56a843={},_0x58234a={'count':0x0,'rows':[]};var _0x3ea729=_[_0x6939('0x2f')](db[_0x6939('0x30')][_0x6939('0x31')],function(_0x387ae8){return{'name':_0x387ae8['fieldName'],'type':_0x387ae8[_0x6939('0x32')][_0x6939('0x33')]};});_0x56a843[_0x6939('0x34')]=_['map'](_0x3ea729,_0x6939('0x2c'));_0x56a843['query']=_[_0x6939('0x35')](_0x5750d8[_0x6939('0x36')]);_0x56a843[_0x6939('0x37')]=_[_0x6939('0x38')](_0x56a843[_0x6939('0x34')],_0x56a843[_0x6939('0x36')]);_0x4eed6c['attributes']=_['intersection'](_0x56a843[_0x6939('0x34')],qs[_0x6939('0x39')](_0x5750d8[_0x6939('0x36')][_0x6939('0x39')]));_0x4eed6c[_0x6939('0x3a')]=_0x4eed6c[_0x6939('0x3a')][_0x6939('0x3b')]?_0x4eed6c[_0x6939('0x3a')]:_0x56a843[_0x6939('0x34')];if(!_0x5750d8[_0x6939('0x36')][_0x6939('0x3c')](_0x6939('0x3d'))){_0x4eed6c[_0x6939('0x21')]=qs[_0x6939('0x21')](_0x5750d8[_0x6939('0x36')][_0x6939('0x21')]);_0x4eed6c[_0x6939('0x1e')]=qs[_0x6939('0x1e')](_0x5750d8[_0x6939('0x36')][_0x6939('0x1e')]);}_0x4eed6c[_0x6939('0x3e')]=qs[_0x6939('0x3f')](_0x5750d8['query'][_0x6939('0x3f')]);_0x4eed6c['where']=qs[_0x6939('0x37')](_[_0x6939('0x40')](_0x5750d8[_0x6939('0x36')],_0x56a843[_0x6939('0x37')]),_0x3ea729);if(_0x5750d8[_0x6939('0x36')][_0x6939('0x41')]){_0x4eed6c[_0x6939('0x42')]=_['merge'](_0x4eed6c[_0x6939('0x42')],{'$or':[{'key':{'$like':'%'+_0x5750d8[_0x6939('0x36')][_0x6939('0x41')]+'%'}},{'value':{'$like':'%'+_0x5750d8[_0x6939('0x36')]['filter']+'%'}}]});}_0x4eed6c=_['merge']({},_0x4eed6c,_0x5750d8[_0x6939('0x43')]);var _0x1c6c01={'where':_0x4eed6c['where']};return db[_0x6939('0x30')][_0x6939('0x20')](_0x1c6c01)[_0x6939('0x28')](function(_0x532568){_0x58234a[_0x6939('0x20')]=_0x532568;if(_0x5750d8[_0x6939('0x36')][_0x6939('0x44')]){_0x4eed6c[_0x6939('0x45')]=[{'all':!![]}];}return db[_0x6939('0x30')][_0x6939('0x46')](_0x4eed6c);})['then'](function(_0x4254b2){_0x58234a[_0x6939('0x47')]=_0x4254b2;return _0x58234a;})['then'](respondWithFilteredResult(_0x3f21eb,_0x4eed6c))[_0x6939('0x48')](handleError(_0x3f21eb,null));};exports[_0x6939('0x49')]=function(_0x3ebb83,_0x2506a7){var _0xcfd7d2={'raw':!![],'where':{'id':_0x3ebb83[_0x6939('0x4a')]['id']}},_0x366ff3={};_0x366ff3[_0x6939('0x34')]=_[_0x6939('0x35')](db[_0x6939('0x30')][_0x6939('0x31')]);_0x366ff3['query']=_[_0x6939('0x35')](_0x3ebb83[_0x6939('0x36')]);_0x366ff3[_0x6939('0x37')]=_[_0x6939('0x38')](_0x366ff3[_0x6939('0x34')],_0x366ff3[_0x6939('0x36')]);_0xcfd7d2[_0x6939('0x3a')]=_[_0x6939('0x38')](_0x366ff3[_0x6939('0x34')],qs[_0x6939('0x39')](_0x3ebb83[_0x6939('0x36')][_0x6939('0x39')]));_0xcfd7d2[_0x6939('0x3a')]=_0xcfd7d2[_0x6939('0x3a')][_0x6939('0x3b')]?_0xcfd7d2[_0x6939('0x3a')]:_0x366ff3[_0x6939('0x34')];if(_0x3ebb83[_0x6939('0x36')]['includeAll']){_0xcfd7d2[_0x6939('0x45')]=[{'all':!![]}];}_0xcfd7d2=_[_0x6939('0x4b')]({},_0xcfd7d2,_0x3ebb83[_0x6939('0x43')]);return db[_0x6939('0x30')][_0x6939('0x4c')](_0xcfd7d2)['then'](handleEntityNotFound(_0x2506a7,null))['then'](respondWithResult(_0x2506a7,null))[_0x6939('0x48')](handleError(_0x2506a7,null));};exports[_0x6939('0x26')]=function(_0x19b107,_0x339c81){if(_0x19b107['body']['id']){delete _0x19b107[_0x6939('0x4d')]['id'];}return db['CannedAnswer'][_0x6939('0x4c')]({'where':{'id':_0x19b107['params']['id']}})[_0x6939('0x28')](handleEntityNotFound(_0x339c81,null))[_0x6939('0x28')](saveUpdates(_0x19b107[_0x6939('0x4d')],null))[_0x6939('0x28')](respondWithResult(_0x339c81,null))['catch'](handleError(_0x339c81,null));};exports[_0x6939('0x27')]=function(_0x419387,_0x368125){return db[_0x6939('0x30')][_0x6939('0x4c')]({'where':{'id':_0x419387[_0x6939('0x4a')]['id']}})[_0x6939('0x28')](handleEntityNotFound(_0x368125,null))[_0x6939('0x28')](removeEntity(_0x368125,null))['catch'](handleError(_0x368125,null));};exports[_0x6939('0x4e')]=function(_0x2ff079,_0x2c98b6){var _0x3b979d={'key':_0x2ff079[_0x6939('0x4d')][_0x6939('0x33')]};if(_0x2ff079['body'][_0x6939('0x4f')]){_0x3b979d[_0x6939('0x4f')]=_0x2ff079[_0x6939('0x4d')][_0x6939('0x4f')];}else if(_0x2ff079[_0x6939('0x4d')][_0x6939('0x50')]){_0x3b979d['SmsAccountId']=_0x2ff079[_0x6939('0x4d')]['SmsAccountId'];}else if(_0x2ff079[_0x6939('0x4d')][_0x6939('0x51')]){_0x3b979d[_0x6939('0x51')]=_0x2ff079['body'][_0x6939('0x51')];}else if(_0x2ff079[_0x6939('0x4d')][_0x6939('0x52')]){_0x3b979d['ChatWebsiteId']=_0x2ff079[_0x6939('0x4d')]['ChatWebsiteId'];}return db['CannedAnswer'][_0x6939('0x4c')]({'where':_0x3b979d})['then'](function(_0x3b0515){if(_0x3b0515){throw new db[(_0x6939('0x53'))][(_0x6939('0x54'))](_0x6939('0x55'));}return db[_0x6939('0x30')][_0x6939('0x4e')](_0x2ff079['body']);})['then'](function(_0x12f061){var _0x94876d=_0x2ff079[_0x6939('0x56')][_0x6939('0x29')]({'plain':!![]});if(!_0x94876d)throw new Error(_0x6939('0x57'));if(_0x94876d[_0x6939('0x58')]===_0x6939('0x56')){var _0x485228=_0x12f061['get']({'plain':!![]});return db[_0x6939('0x59')][_0x6939('0x4c')]({'where':{'name':_0x6939('0x2a'),'userProfileId':_0x94876d['userProfileId']},'raw':!![]})[_0x6939('0x28')](function(_0x5d27dc){if(_0x5d27dc&&_0x5d27dc[_0x6939('0x5a')]===0x0){return db[_0x6939('0x2b')][_0x6939('0x4e')]({'name':_0x485228[_0x6939('0x2c')],'resourceId':_0x485228['id'],'type':_0x5d27dc[_0x6939('0x2c')],'sectionId':_0x5d27dc['id']},{})[_0x6939('0x28')](function(){return _0x12f061;});}else{return _0x12f061;}})[_0x6939('0x48')](function(_0x3a0be0){logger[_0x6939('0x5b')](_0x6939('0x5c'),_0x3a0be0);throw _0x3a0be0;});}return _0x12f061;})[_0x6939('0x28')](respondWithResult(_0x2c98b6,0xc9))[_0x6939('0x48')](handleError(_0x2c98b6,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 782f257..46a1ab9 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 _0x6cb4=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x1f0448,_0xa2865f){var _0x16fe78=function(_0x43517b){while(--_0x43517b){_0x1f0448['push'](_0x1f0448['shift']());}};_0x16fe78(++_0xa2865f);}(_0x6cb4,0x9c));var _0x46cb=function(_0x391ebe,_0x596823){_0x391ebe=_0x391ebe-0x0;var _0x5aac03=_0x6cb4[_0x391ebe];return _0x5aac03;};'use strict';var _=require(_0x46cb('0x0'));var util=require('util');var logger=require(_0x46cb('0x1'))('api');var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46cb('0x4'));var rimraf=require(_0x46cb('0x5'));var config=require(_0x46cb('0x6'));var attributes=require(_0x46cb('0x7'));module[_0x46cb('0x8')]=function(_0x566d65,_0x372630){return _0x566d65[_0x46cb('0x9')](_0x46cb('0xa'),attributes,{'tableName':_0x46cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46cb('0xc'),'collate':_0x46cb('0xd')});}; \ No newline at end of file +var _0x6d1d=['define','tools_canned_answers','utf8mb4','util','../../config/logger','api','request-promise','path','rimraf','./cannedAnswer.attributes','exports'];(function(_0x2c4d46,_0x2bbf7f){var _0x2573dd=function(_0x570669){while(--_0x570669){_0x2c4d46['push'](_0x2c4d46['shift']());}};_0x2573dd(++_0x2bbf7f);}(_0x6d1d,0x19a));var _0xd6d1=function(_0x168ad0,_0x45e98b){_0x168ad0=_0x168ad0-0x0;var _0x3596fc=_0x6d1d[_0x168ad0];return _0x3596fc;};'use strict';var _=require('lodash');var util=require(_0xd6d1('0x0'));var logger=require(_0xd6d1('0x1'))(_0xd6d1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd6d1('0x3'));var fs=require('fs');var path=require(_0xd6d1('0x4'));var rimraf=require(_0xd6d1('0x5'));var config=require('../../config/environment');var attributes=require(_0xd6d1('0x6'));module[_0xd6d1('0x7')]=function(_0x56dd60,_0x338bd9){return _0x56dd60[_0xd6d1('0x8')]('CannedAnswer',attributes,{'tableName':_0xd6d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd6d1('0xa'),'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 240521a..48a4428 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(_0x4b7204,_0x1081df){var _0x1ea9b7=function(_0x153741){while(--_0x153741){_0x4b7204['push'](_0x4b7204['shift']());}};_0x1ea9b7(++_0x1081df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x29c139,_0x1510dd){var _0x57f226=function(_0x16d4c2){while(--_0x16d4c2){_0x29c139['push'](_0x29c139['shift']());}};_0x57f226(++_0x1510dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 a9cceb6..7db27cf 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 _0x3eac=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','put'];(function(_0x1e4713,_0x558735){var _0x5cddcb=function(_0x14a8c5){while(--_0x14a8c5){_0x1e4713['push'](_0x1e4713['shift']());}};_0x5cddcb(++_0x558735);}(_0x3eac,0xb4));var _0xc3ea=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x3eac[_0x4b6778];return _0x22dbb9;};'use strict';var multer=require(_0xc3ea('0x0'));var util=require('util');var path=require(_0xc3ea('0x1'));var timeout=require(_0xc3ea('0x2'));var express=require(_0xc3ea('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc3ea('0x4'));var config=require(_0xc3ea('0x5'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xc3ea('0x6')](),controller[_0xc3ea('0x7')]);router[_0xc3ea('0x8')](_0xc3ea('0x9'),auth[_0xc3ea('0x6')](),controller[_0xc3ea('0xa')]);router['post']('/',auth[_0xc3ea('0x6')](),controller['create']);router[_0xc3ea('0xb')](_0xc3ea('0x9'),auth[_0xc3ea('0x6')](),controller[_0xc3ea('0xc')]);router[_0xc3ea('0xd')](_0xc3ea('0x9'),auth[_0xc3ea('0x6')](),controller[_0xc3ea('0xe')]);module[_0xc3ea('0xf')]=router; \ No newline at end of file +var _0x61bc=['show','post','put','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','/:id'];(function(_0x8885cb,_0x3f000e){var _0x25ba05=function(_0xb10e25){while(--_0xb10e25){_0x8885cb['push'](_0x8885cb['shift']());}};_0x25ba05(++_0x3f000e);}(_0x61bc,0x67));var _0xc61b=function(_0x13a973,_0xacdf00){_0x13a973=_0x13a973-0x0;var _0x115e08=_0x61bc[_0x13a973];return _0x115e08;};'use strict';var multer=require(_0xc61b('0x0'));var util=require('util');var path=require(_0xc61b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc61b('0x2')]();var fs_extra=require(_0xc61b('0x3'));var auth=require(_0xc61b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc61b('0x5'));var controller=require(_0xc61b('0x6'));router['get']('/',auth[_0xc61b('0x7')](),controller['index']);router['get'](_0xc61b('0x8'),auth[_0xc61b('0x7')](),controller[_0xc61b('0x9')]);router[_0xc61b('0xa')]('/',auth[_0xc61b('0x7')](),controller['create']);router[_0xc61b('0xb')](_0xc61b('0x8'),auth[_0xc61b('0x7')](),controller[_0xc61b('0xc')]);router[_0xc61b('0xd')](_0xc61b('0x8'),auth[_0xc61b('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 04c5cf3..c314cd4 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 _0xa0bc=['STRING','INTEGER','exports','DATE'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xca0b('0x0')]={'calldate':{'type':Sequelize[_0xca0b('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xca0b('0x2')]},'src':{'type':Sequelize[_0xca0b('0x2')]},'dst':{'type':Sequelize[_0xca0b('0x2')]},'dcontext':{'type':Sequelize[_0xca0b('0x2')]},'channel':{'type':Sequelize[_0xca0b('0x2')]},'dstchannel':{'type':Sequelize[_0xca0b('0x2')]},'lastapp':{'type':Sequelize[_0xca0b('0x2')]},'lastdata':{'type':Sequelize[_0xca0b('0x2')]},'duration':{'type':Sequelize[_0xca0b('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xca0b('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xca0b('0x2')]},'amaflags':{'type':Sequelize[_0xca0b('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xca0b('0x2')]},'userfield':{'type':Sequelize[_0xca0b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xca0b('0x2')]},'sequence':{'type':Sequelize[_0xca0b('0x2')]},'peeraccount':{'type':Sequelize[_0xca0b('0x2')]},'type':{'type':Sequelize[_0xca0b('0x2')]},'tag':{'type':Sequelize[_0xca0b('0x2')]}}; \ No newline at end of file +var _0x4c48=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x35ffbd,_0x228fe3){var _0x4f9bf4=function(_0x57fc6a){while(--_0x57fc6a){_0x35ffbd['push'](_0x35ffbd['shift']());}};_0x4f9bf4(++_0x228fe3);}(_0x4c48,0x1e4));var _0x84c4=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x4c48[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x84c4('0x0')],'allowNull':![],'defaultValue':_0x84c4('0x1')},'clid':{'type':Sequelize[_0x84c4('0x2')]},'src':{'type':Sequelize[_0x84c4('0x2')]},'dst':{'type':Sequelize[_0x84c4('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x84c4('0x2')]},'lastapp':{'type':Sequelize[_0x84c4('0x2')]},'lastdata':{'type':Sequelize[_0x84c4('0x2')]},'duration':{'type':Sequelize[_0x84c4('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x84c4('0x2')]},'amaflags':{'type':Sequelize[_0x84c4('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x84c4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x84c4('0x2')]},'peeraccount':{'type':Sequelize[_0x84c4('0x2')]},'type':{'type':Sequelize[_0x84c4('0x2')]},'tag':{'type':Sequelize[_0x84c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 8db855d..ffc2f08 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 _0xd6d6=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type'];(function(_0x5800e9,_0xa9ef46){var _0x193060=function(_0x1ff026){while(--_0x1ff026){_0x5800e9['push'](_0x5800e9['shift']());}};_0x193060(++_0xa9ef46);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3878a0,_0x3a3d86){_0x3878a0=_0x3878a0-0x0;var _0x3cb4a4=_0xd6d6[_0x3878a0];return _0x3cb4a4;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x2d')](_0xde3272,'name');_0x8a9a84[_0x6d6d('0x34')]=_['keys'](_0x553645[_0x6d6d('0x34')]);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x553645['query'][_0x6d6d('0x38')]));_0x5273cd[_0x6d6d('0x37')]=_0x5273cd[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x5273cd[_0x6d6d('0x37')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x34')][_0x6d6d('0x3a')](_0x6d6d('0x3b'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1e')]);_0x5273cd[_0x6d6d('0x1f')]=qs['offset'](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1f')]);}_0x5273cd[_0x6d6d('0x3c')]=qs[_0x6d6d('0x3d')](_0x553645['query']['sort']);_0x5273cd[_0x6d6d('0x3e')]=qs[_0x6d6d('0x35')](_[_0x6d6d('0x3f')](_0x553645['query'],_0x8a9a84[_0x6d6d('0x35')]),_0xde3272);if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]){_0x5273cd[_0x6d6d('0x3e')]=_['merge'](_0x5273cd['where'],{'$or':_['map'](_0xde3272,function(_0x62620d){if(_0x62620d[_0x6d6d('0x31')]!==_0x6d6d('0x41')){var _0x22a49a={};_0x22a49a[_0x62620d['name']]={'$like':'%'+_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]+'%'};return _0x22a49a;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x3d632c={'where':_0x5273cd[_0x6d6d('0x3e')]};return db['Cdr'][_0x6d6d('0x20')](_0x3d632c)[_0x6d6d('0x27')](function(_0x42aff0){_0x57341f[_0x6d6d('0x20')]=_0x42aff0;if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x5273cd[_0x6d6d('0x45')]=[{'all':!![]}];}return db['Cdr'][_0x6d6d('0x46')](_0x5273cd);})[_0x6d6d('0x27')](function(_0x16e177){_0x57341f[_0x6d6d('0x47')]=_0x16e177;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))['catch'](handleError(_0x3edcce,null));};exports[_0x6d6d('0x48')]=function(_0x39f2a9,_0x55dba8){var _0x452de2={'raw':!![],'where':{'id':_0x39f2a9[_0x6d6d('0x49')]['id']}},_0x50dc17={};_0x50dc17[_0x6d6d('0x33')]=_['keys'](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x50dc17[_0x6d6d('0x34')]=_[_0x6d6d('0x4a')](_0x39f2a9[_0x6d6d('0x34')]);_0x50dc17['filters']=_['intersection'](_0x50dc17[_0x6d6d('0x33')],_0x50dc17['query']);_0x452de2['attributes']=_[_0x6d6d('0x36')](_0x50dc17[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x39f2a9['query'][_0x6d6d('0x38')]));_0x452de2['attributes']=_0x452de2[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x452de2[_0x6d6d('0x37')]:_0x50dc17[_0x6d6d('0x33')];if(_0x39f2a9[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x452de2[_0x6d6d('0x45')]=[{'all':!![]}];}_0x452de2=_['merge']({},_0x452de2,_0x39f2a9[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')](_0x452de2)[_0x6d6d('0x27')](handleEntityNotFound(_0x55dba8,null))[_0x6d6d('0x27')](respondWithResult(_0x55dba8,null))[_0x6d6d('0x4c')](handleError(_0x55dba8,null));};exports[_0x6d6d('0x4d')]=function(_0x1d2b20,_0x24cec2){return db['Cdr']['create'](_0x1d2b20[_0x6d6d('0x4e')],{})[_0x6d6d('0x27')](respondWithResult(_0x24cec2,0xc9))[_0x6d6d('0x4c')](handleError(_0x24cec2,null));};exports[_0x6d6d('0x26')]=function(_0xe2a20e,_0x492834){if(_0xe2a20e[_0x6d6d('0x4e')]['id']){delete _0xe2a20e[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0xe2a20e[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x492834,null))[_0x6d6d('0x27')](saveUpdates(_0xe2a20e[_0x6d6d('0x4e')],null))[_0x6d6d('0x27')](respondWithResult(_0x492834,null))[_0x6d6d('0x4c')](handleError(_0x492834,null));};exports[_0x6d6d('0x28')]=function(_0x175e26,_0x4d9811){return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0x175e26[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x4d9811,null))[_0x6d6d('0x27')](removeEntity(_0x4d9811,null))['catch'](handleError(_0x4d9811,null));};exports[_0x6d6d('0x4f')]=function(_0x36bc5a,_0x45340b){return db['Cdr']['describe']()[_0x6d6d('0x27')](respondWithResult(_0x45340b,null))['catch'](handleError(_0x45340b,null));}; \ No newline at end of file +var _0x6334=['ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','undefined','limit','count','offset','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','Cdr','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','include','findAll','catch','show','params','length','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x1291b3,_0x54cc6b){var _0x48645f=function(_0x16c9b6){while(--_0x16c9b6){_0x1291b3['push'](_0x1291b3['shift']());}};_0x48645f(++_0x54cc6b);}(_0x6334,0x119));var _0x4633=function(_0x31cb77,_0x348021){_0x31cb77=_0x31cb77-0x0;var _0x710374=_0x6334[_0x31cb77];return _0x710374;};'use strict';var emlformat=require(_0x4633('0x0'));var rimraf=require(_0x4633('0x1'));var zipdir=require(_0x4633('0x2'));var jsonpatch=require(_0x4633('0x3'));var rp=require(_0x4633('0x4'));var moment=require(_0x4633('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4633('0x6'));var util=require(_0x4633('0x7'));var path=require(_0x4633('0x8'));var sox=require(_0x4633('0x9'));var csv=require(_0x4633('0xa'));var ejs=require(_0x4633('0xb'));var fs=require('fs');var fs_extra=require(_0x4633('0xc'));var _=require('lodash');var squel=require(_0x4633('0xd'));var crypto=require('crypto');var jsforce=require(_0x4633('0xe'));var deskjs=require(_0x4633('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4633('0x10'));var Papa=require(_0x4633('0x11'));var Redis=require(_0x4633('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4633('0x13'));var as=require(_0x4633('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4633('0x15'))(_0x4633('0x16'));var utils=require(_0x4633('0x17'));var config=require(_0x4633('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4633('0x19'))['db'];function respondWithStatusCode(_0xad405,_0x438e87){_0x438e87=_0x438e87||0xcc;return function(_0x48e92c){if(_0x48e92c){return _0xad405['sendStatus'](_0x438e87);}return _0xad405['status'](_0x438e87)[_0x4633('0x1a')]();};}function respondWithResult(_0x1fd00c,_0x579229){_0x579229=_0x579229||0xc8;return function(_0x52955e){if(_0x52955e){return _0x1fd00c[_0x4633('0x1b')](_0x579229)['json'](_0x52955e);}};}function respondWithFilteredResult(_0xcdffcc,_0x33b6e7){return function(_0x2e2dc3){if(_0x2e2dc3){var _0x11fef9=typeof _0x33b6e7['offset']===_0x4633('0x1c')&&typeof _0x33b6e7[_0x4633('0x1d')]===_0x4633('0x1c');var _0x4ffad5=_0x2e2dc3[_0x4633('0x1e')];var _0x37e536=_0x11fef9?0x0:_0x33b6e7[_0x4633('0x1f')];var _0x2ad562=_0x11fef9?_0x2e2dc3[_0x4633('0x1e')]:_0x33b6e7['offset']+_0x33b6e7[_0x4633('0x1d')];var _0xfe3446;if(_0x2ad562>=_0x4ffad5){_0x2ad562=_0x4ffad5;_0xfe3446=0xc8;}else{_0xfe3446=0xce;}_0xcdffcc['status'](_0xfe3446);return _0xcdffcc['set'](_0x4633('0x20'),_0x37e536+'-'+_0x2ad562+'/'+_0x4ffad5)['json'](_0x2e2dc3);}return null;};}function patchUpdates(_0x35e2ad){return function(_0x5b5011){try{jsonpatch['apply'](_0x5b5011,_0x35e2ad,!![]);}catch(_0x109472){return BPromise[_0x4633('0x21')](_0x109472);}return _0x5b5011[_0x4633('0x22')]();};}function saveUpdates(_0x604f3d,_0xd1fcc6){return function(_0x2d46f7){if(_0x2d46f7){return _0x2d46f7['update'](_0x604f3d)[_0x4633('0x23')](function(_0x562e26){return _0x562e26;});}return null;};}function removeEntity(_0x22d9c1,_0xcfac3f){return function(_0xe77cfc){if(_0xe77cfc){return _0xe77cfc[_0x4633('0x24')]()[_0x4633('0x23')](function(){_0x22d9c1['status'](0xcc)[_0x4633('0x1a')]();});}};}function handleEntityNotFound(_0x399220,_0x37e3c4){return function(_0x13ec10){if(!_0x13ec10){_0x399220[_0x4633('0x25')](0x194);}return _0x13ec10;};}function handleError(_0x471d13,_0x1ba1ed){_0x1ba1ed=_0x1ba1ed||0x1f4;return function(_0x368582){logger[_0x4633('0x26')](_0x368582[_0x4633('0x27')]);if(_0x368582[_0x4633('0x28')]){delete _0x368582[_0x4633('0x28')];}_0x471d13[_0x4633('0x1b')](_0x1ba1ed)[_0x4633('0x29')](_0x368582);};}exports[_0x4633('0x2a')]=function(_0x3f03aa,_0x20ca8b){var _0x139e5e={},_0x5de12a={},_0x197aa6={'count':0x0,'rows':[]};var _0x101371=_[_0x4633('0x2b')](db[_0x4633('0x2c')][_0x4633('0x2d')],function(_0x182e12){return{'name':_0x182e12['fieldName'],'type':_0x182e12[_0x4633('0x2e')]['key']};});_0x5de12a[_0x4633('0x2f')]=_[_0x4633('0x2b')](_0x101371,_0x4633('0x28'));_0x5de12a[_0x4633('0x30')]=_[_0x4633('0x31')](_0x3f03aa[_0x4633('0x30')]);_0x5de12a[_0x4633('0x32')]=_[_0x4633('0x33')](_0x5de12a[_0x4633('0x2f')],_0x5de12a[_0x4633('0x30')]);_0x139e5e[_0x4633('0x34')]=_[_0x4633('0x33')](_0x5de12a[_0x4633('0x2f')],qs[_0x4633('0x35')](_0x3f03aa['query']['fields']));_0x139e5e[_0x4633('0x34')]=_0x139e5e[_0x4633('0x34')]['length']?_0x139e5e[_0x4633('0x34')]:_0x5de12a[_0x4633('0x2f')];if(!_0x3f03aa[_0x4633('0x30')][_0x4633('0x36')]('nolimit')){_0x139e5e[_0x4633('0x1d')]=qs['limit'](_0x3f03aa[_0x4633('0x30')][_0x4633('0x1d')]);_0x139e5e[_0x4633('0x1f')]=qs[_0x4633('0x1f')](_0x3f03aa[_0x4633('0x30')][_0x4633('0x1f')]);}_0x139e5e[_0x4633('0x37')]=qs[_0x4633('0x38')](_0x3f03aa['query'][_0x4633('0x38')]);_0x139e5e[_0x4633('0x39')]=qs['filters'](_[_0x4633('0x3a')](_0x3f03aa[_0x4633('0x30')],_0x5de12a[_0x4633('0x32')]),_0x101371);if(_0x3f03aa[_0x4633('0x30')]['filter']){_0x139e5e['where']=_[_0x4633('0x3b')](_0x139e5e['where'],{'$or':_['map'](_0x101371,function(_0x464533){if(_0x464533['type']!=='VIRTUAL'){var _0x1aaf65={};_0x1aaf65[_0x464533[_0x4633('0x28')]]={'$like':'%'+_0x3f03aa[_0x4633('0x30')][_0x4633('0x3c')]+'%'};return _0x1aaf65;}})});}_0x139e5e=_[_0x4633('0x3b')]({},_0x139e5e,_0x3f03aa['options']);var _0x6873d0={'where':_0x139e5e['where']};return db[_0x4633('0x2c')][_0x4633('0x1e')](_0x6873d0)[_0x4633('0x23')](function(_0x402708){_0x197aa6['count']=_0x402708;if(_0x3f03aa[_0x4633('0x30')]['includeAll']){_0x139e5e[_0x4633('0x3d')]=[{'all':!![]}];}return db[_0x4633('0x2c')][_0x4633('0x3e')](_0x139e5e);})[_0x4633('0x23')](function(_0x350e46){_0x197aa6['rows']=_0x350e46;return _0x197aa6;})['then'](respondWithFilteredResult(_0x20ca8b,_0x139e5e))[_0x4633('0x3f')](handleError(_0x20ca8b,null));};exports[_0x4633('0x40')]=function(_0x8b0d9,_0xf51de3){var _0x45fe39={'raw':!![],'where':{'id':_0x8b0d9[_0x4633('0x41')]['id']}},_0x53669c={};_0x53669c['model']=_[_0x4633('0x31')](db['Cdr'][_0x4633('0x2d')]);_0x53669c['query']=_[_0x4633('0x31')](_0x8b0d9[_0x4633('0x30')]);_0x53669c[_0x4633('0x32')]=_[_0x4633('0x33')](_0x53669c[_0x4633('0x2f')],_0x53669c[_0x4633('0x30')]);_0x45fe39[_0x4633('0x34')]=_[_0x4633('0x33')](_0x53669c[_0x4633('0x2f')],qs[_0x4633('0x35')](_0x8b0d9[_0x4633('0x30')][_0x4633('0x35')]));_0x45fe39[_0x4633('0x34')]=_0x45fe39[_0x4633('0x34')][_0x4633('0x42')]?_0x45fe39[_0x4633('0x34')]:_0x53669c[_0x4633('0x2f')];if(_0x8b0d9[_0x4633('0x30')][_0x4633('0x43')]){_0x45fe39[_0x4633('0x3d')]=[{'all':!![]}];}_0x45fe39=_[_0x4633('0x3b')]({},_0x45fe39,_0x8b0d9['options']);return db['Cdr'][_0x4633('0x44')](_0x45fe39)['then'](handleEntityNotFound(_0xf51de3,null))['then'](respondWithResult(_0xf51de3,null))['catch'](handleError(_0xf51de3,null));};exports[_0x4633('0x45')]=function(_0x5dec28,_0x5cb4cc){return db[_0x4633('0x2c')][_0x4633('0x45')](_0x5dec28[_0x4633('0x46')],{})[_0x4633('0x23')](respondWithResult(_0x5cb4cc,0xc9))[_0x4633('0x3f')](handleError(_0x5cb4cc,null));};exports[_0x4633('0x47')]=function(_0x4d3cf4,_0x4ca3d6){if(_0x4d3cf4['body']['id']){delete _0x4d3cf4[_0x4633('0x46')]['id'];}return db[_0x4633('0x2c')][_0x4633('0x44')]({'where':{'id':_0x4d3cf4['params']['id']}})[_0x4633('0x23')](handleEntityNotFound(_0x4ca3d6,null))[_0x4633('0x23')](saveUpdates(_0x4d3cf4['body'],null))[_0x4633('0x23')](respondWithResult(_0x4ca3d6,null))[_0x4633('0x3f')](handleError(_0x4ca3d6,null));};exports[_0x4633('0x24')]=function(_0x4c5367,_0x47e03a){return db[_0x4633('0x2c')][_0x4633('0x44')]({'where':{'id':_0x4c5367[_0x4633('0x41')]['id']}})[_0x4633('0x23')](handleEntityNotFound(_0x47e03a,null))[_0x4633('0x23')](removeEntity(_0x47e03a,null))['catch'](handleError(_0x47e03a,null));};exports[_0x4633('0x48')]=function(_0xf812ca,_0x2108b3){return db[_0x4633('0x2c')][_0x4633('0x48')]()[_0x4633('0x23')](respondWithResult(_0x2108b3,null))['catch'](handleError(_0x2108b3,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 7f4b328..1e8c125 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(_0x50fb4e,_0x39559b){var _0x3bf8ba=function(_0x25a45b){while(--_0x25a45b){_0x50fb4e['push'](_0x50fb4e['shift']());}};_0x3bf8ba(++_0x39559b);}(_0x7a54,0x106));var _0x47a5=function(_0x45149f,_0x2ee534){_0x45149f=_0x45149f-0x0;var _0x473c1b=_0x7a54[_0x45149f];return _0x473c1b;};'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(_0x164858,_0x12f17c){var _0x205462=function(_0x43cc9e){while(--_0x43cc9e){_0x164858['push'](_0x164858['shift']());}};_0x205462(++_0x12f17c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 5fbe3bf..6938f79 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 _0xc118=['code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42e3e1,_0x1d45af){var _0x211a2b=function(_0x3ea9b4){while(--_0x3ea9b4){_0x42e3e1['push'](_0x42e3e1['shift']());}};_0x211a2b(++_0x1d45af);}(_0xc118,0x18a));var _0x8c11=function(_0x4d00be,_0x1315c2){_0x4d00be=_0x4d00be-0x0;var _0x4f26fa=_0xc118[_0x4d00be];return _0x4f26fa;};'use strict';var _=require('lodash');var util=require(_0x8c11('0x0'));var moment=require(_0x8c11('0x1'));var BPromise=require(_0x8c11('0x2'));var rs=require(_0x8c11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c11('0x4'))['db'];var utils=require(_0x8c11('0x5'));var logger=require('../../config/logger')(_0x8c11('0x6'));var config=require(_0x8c11('0x7'));var jayson=require(_0x8c11('0x8'));var client=jayson[_0x8c11('0x9')][_0x8c11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11e4f7,_0x36289c,_0x9bc943){return new BPromise(function(_0x3e93ce,_0x59f01f){return client[_0x8c11('0xb')](_0x11e4f7,_0x9bc943)[_0x8c11('0xc')](function(_0x4cc773){logger[_0x8c11('0xd')](_0x8c11('0xe'),_0x36289c,_0x8c11('0xf'));logger[_0x8c11('0x10')](_0x8c11('0x11'),_0x36289c,_0x8c11('0xf'),JSON[_0x8c11('0x12')](_0x4cc773));if(_0x4cc773[_0x8c11('0x13')]){if(_0x4cc773['error'][_0x8c11('0x14')]===0x1f4){logger[_0x8c11('0x13')](_0x8c11('0xe'),_0x36289c,_0x4cc773['error'][_0x8c11('0x15')]);return _0x59f01f(_0x4cc773['error'][_0x8c11('0x15')]);}logger[_0x8c11('0x13')](_0x8c11('0xe'),_0x36289c,_0x4cc773['error'][_0x8c11('0x15')]);return _0x3e93ce(_0x4cc773[_0x8c11('0x13')][_0x8c11('0x15')]);}else{logger[_0x8c11('0xd')](_0x8c11('0xe'),_0x36289c,_0x8c11('0xf'));_0x3e93ce(_0x4cc773[_0x8c11('0x16')][_0x8c11('0x15')]);}})['catch'](function(_0x3ac5ad){logger[_0x8c11('0x13')](_0x8c11('0xe'),_0x36289c,_0x3ac5ad);_0x59f01f(_0x3ac5ad);});});} \ No newline at end of file +var _0x8c12=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c12,0xf6));var _0x28c1=function(_0x5798b3,_0x2ea26f){_0x5798b3=_0x5798b3-0x0;var _0x18e3c4=_0x8c12[_0x5798b3];return _0x18e3c4;};'use strict';var _=require(_0x28c1('0x0'));var util=require(_0x28c1('0x1'));var moment=require(_0x28c1('0x2'));var BPromise=require(_0x28c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28c1('0x4'));var db=require(_0x28c1('0x5'))['db'];var utils=require(_0x28c1('0x6'));var logger=require(_0x28c1('0x7'))(_0x28c1('0x8'));var config=require(_0x28c1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x28c1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf09566,_0x19074a,_0x226fc1){return new BPromise(function(_0xdb0dff,_0x333898){return client[_0x28c1('0xb')](_0xf09566,_0x226fc1)[_0x28c1('0xc')](function(_0x5a41a1){logger[_0x28c1('0xd')](_0x28c1('0xe'),_0x19074a,_0x28c1('0xf'));logger['debug'](_0x28c1('0x10'),_0x19074a,_0x28c1('0xf'),JSON[_0x28c1('0x11')](_0x5a41a1));if(_0x5a41a1[_0x28c1('0x12')]){if(_0x5a41a1['error']['code']===0x1f4){logger[_0x28c1('0x12')](_0x28c1('0xe'),_0x19074a,_0x5a41a1[_0x28c1('0x12')]['message']);return _0x333898(_0x5a41a1[_0x28c1('0x12')][_0x28c1('0x13')]);}logger['error'](_0x28c1('0xe'),_0x19074a,_0x5a41a1[_0x28c1('0x12')][_0x28c1('0x13')]);return _0xdb0dff(_0x5a41a1['error']['message']);}else{logger[_0x28c1('0xd')]('Cdr,\x20%s,\x20%s',_0x19074a,_0x28c1('0xf'));_0xdb0dff(_0x5a41a1[_0x28c1('0x14')]['message']);}})[_0x28c1('0x15')](function(_0x67f14d){logger[_0x28c1('0x12')](_0x28c1('0xe'),_0x19074a,_0x67f14d);_0x333898(_0x67f14d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 378eac7..9302ce9 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x413838,_0x405f52){var _0x4ec54a=function(_0x568563){while(--_0x568563){_0x413838['push'](_0x413838['shift']());}};_0x4ec54a(++_0x405f52);}(_0xb10b,0x12a));var _0xbb10=function(_0x25f39c,_0x4f231a){_0x25f39c=_0x25f39c-0x0;var _0x19bb4a=_0xb10b[_0x25f39c];return _0x19bb4a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _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(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index fd0ab06..dc50041 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 _0x2693=['exports','STRING','TEXT','sequelize'];(function(_0x33aefe,_0x371ccd){var _0x471d19=function(_0x566c26){while(--_0x566c26){_0x33aefe['push'](_0x33aefe['shift']());}};_0x471d19(++_0x371ccd);}(_0x2693,0x1ef));var _0x3269=function(_0x31571c,_0x1e9e35){_0x31571c=_0x31571c-0x0;var _0x410db2=_0x2693[_0x31571c];return _0x410db2;};'use strict';var Sequelize=require(_0x3269('0x0'));module[_0x3269('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3269('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3269('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3269('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x967b=['sequelize','exports','STRING','TEXT','*,*,*,*'];(function(_0xda193c,_0x146013){var _0x29b9fe=function(_0x499a95){while(--_0x499a95){_0xda193c['push'](_0xda193c['shift']());}};_0x29b9fe(++_0x146013);}(_0x967b,0x1ea));var _0xb967=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x967b[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0xb967('0x0'));module[_0xb967('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb967('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb967('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb967('0x2')],'defaultValue':_0xb967('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 8851295..0b8eb79 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 _0x0e0f=['error','stack','name','send','show','model','ChatApplication','query','keys','filters','attributes','intersection','fields','includeAll','include','options','catch','update','body','find','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','status','undefined','limit','offset','save','then','destroy','end'];(function(_0x4beb44,_0x45c192){var _0x150dc0=function(_0x2ed5f5){while(--_0x2ed5f5){_0x4beb44['push'](_0x4beb44['shift']());}};_0x150dc0(++_0x45c192);}(_0x0e0f,0xe5));var _0xf0e0=function(_0x446122,_0x2210aa){_0x446122=_0x446122-0x0;var _0x4410c3=_0x0e0f[_0x446122];return _0x4410c3;};'use strict';var emlformat=require(_0xf0e0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0e0('0x1'));var rp=require(_0xf0e0('0x2'));var moment=require(_0xf0e0('0x3'));var BPromise=require(_0xf0e0('0x4'));var Mustache=require(_0xf0e0('0x5'));var util=require('util');var path=require(_0xf0e0('0x6'));var sox=require(_0xf0e0('0x7'));var csv=require('to-csv');var ejs=require(_0xf0e0('0x8'));var fs=require('fs');var fs_extra=require(_0xf0e0('0x9'));var _=require(_0xf0e0('0xa'));var squel=require(_0xf0e0('0xb'));var crypto=require(_0xf0e0('0xc'));var jsforce=require(_0xf0e0('0xd'));var deskjs=require(_0xf0e0('0xe'));var toCsv=require(_0xf0e0('0xf'));var querystring=require(_0xf0e0('0x10'));var Papa=require('papaparse');var Redis=require(_0xf0e0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf0e0('0x12'));var as=require(_0xf0e0('0x13'));var hardwareService=require(_0xf0e0('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0e0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x501c86,_0x24d3a9){_0x24d3a9=_0x24d3a9||0xcc;return function(_0x5bd0ab){if(_0x5bd0ab){return _0x501c86[_0xf0e0('0x16')](_0x24d3a9);}return _0x501c86[_0xf0e0('0x17')](_0x24d3a9)['end']();};}function respondWithResult(_0x552683,_0x457bfc){_0x457bfc=_0x457bfc||0xc8;return function(_0x5b3719){if(_0x5b3719){return _0x552683[_0xf0e0('0x17')](_0x457bfc)['json'](_0x5b3719);}};}function respondWithFilteredResult(_0x3357f0,_0x55e350){return function(_0x40d87b){if(_0x40d87b){var _0x186e92=typeof _0x55e350['offset']===_0xf0e0('0x18')&&typeof _0x55e350[_0xf0e0('0x19')]===_0xf0e0('0x18');var _0x36206d=_0x40d87b['count'];var _0x3d725b=_0x186e92?0x0:_0x55e350[_0xf0e0('0x1a')];var _0x5e221e=_0x186e92?_0x40d87b['count']:_0x55e350[_0xf0e0('0x1a')]+_0x55e350[_0xf0e0('0x19')];var _0x51c8c8;if(_0x5e221e>=_0x36206d){_0x5e221e=_0x36206d;_0x51c8c8=0xc8;}else{_0x51c8c8=0xce;}_0x3357f0[_0xf0e0('0x17')](_0x51c8c8);return _0x3357f0['set']('Content-Range',_0x3d725b+'-'+_0x5e221e+'/'+_0x36206d)['json'](_0x40d87b);}return null;};}function patchUpdates(_0x350649){return function(_0x3ed3f8){try{jsonpatch['apply'](_0x3ed3f8,_0x350649,!![]);}catch(_0x54e139){return BPromise['reject'](_0x54e139);}return _0x3ed3f8[_0xf0e0('0x1b')]();};}function saveUpdates(_0x52e518,_0x586ef0){return function(_0x48b789){if(_0x48b789){return _0x48b789['update'](_0x52e518)[_0xf0e0('0x1c')](function(_0x357e3a){return _0x357e3a;});}return null;};}function removeEntity(_0x1a1cdb,_0x211d1c){return function(_0x507c66){if(_0x507c66){return _0x507c66[_0xf0e0('0x1d')]()[_0xf0e0('0x1c')](function(){_0x1a1cdb['status'](0xcc)[_0xf0e0('0x1e')]();});}};}function handleEntityNotFound(_0x50cb6e,_0x379256){return function(_0x364675){if(!_0x364675){_0x50cb6e['sendStatus'](0x194);}return _0x364675;};}function handleError(_0xce3161,_0x3e7e3a){_0x3e7e3a=_0x3e7e3a||0x1f4;return function(_0x51c3e2){logger[_0xf0e0('0x1f')](_0x51c3e2[_0xf0e0('0x20')]);if(_0x51c3e2[_0xf0e0('0x21')]){delete _0x51c3e2[_0xf0e0('0x21')];}_0xce3161[_0xf0e0('0x17')](_0x3e7e3a)[_0xf0e0('0x22')](_0x51c3e2);};}exports[_0xf0e0('0x23')]=function(_0x3b4a3b,_0xfe6ec){var _0xb08e13={'raw':!![],'where':{'id':_0x3b4a3b['params']['id']}},_0x251a8b={};_0x251a8b[_0xf0e0('0x24')]=_['keys'](db[_0xf0e0('0x25')]['rawAttributes']);_0x251a8b[_0xf0e0('0x26')]=_[_0xf0e0('0x27')](_0x3b4a3b[_0xf0e0('0x26')]);_0x251a8b[_0xf0e0('0x28')]=_['intersection'](_0x251a8b[_0xf0e0('0x24')],_0x251a8b[_0xf0e0('0x26')]);_0xb08e13[_0xf0e0('0x29')]=_[_0xf0e0('0x2a')](_0x251a8b['model'],qs[_0xf0e0('0x2b')](_0x3b4a3b[_0xf0e0('0x26')][_0xf0e0('0x2b')]));_0xb08e13[_0xf0e0('0x29')]=_0xb08e13[_0xf0e0('0x29')]['length']?_0xb08e13[_0xf0e0('0x29')]:_0x251a8b[_0xf0e0('0x24')];if(_0x3b4a3b[_0xf0e0('0x26')][_0xf0e0('0x2c')]){_0xb08e13[_0xf0e0('0x2d')]=[{'all':!![]}];}_0xb08e13=_['merge']({},_0xb08e13,_0x3b4a3b[_0xf0e0('0x2e')]);return db[_0xf0e0('0x25')]['find'](_0xb08e13)[_0xf0e0('0x1c')](handleEntityNotFound(_0xfe6ec,null))[_0xf0e0('0x1c')](respondWithResult(_0xfe6ec,null))[_0xf0e0('0x2f')](handleError(_0xfe6ec,null));};exports[_0xf0e0('0x30')]=function(_0x89dbf3,_0x1105d7){if(_0x89dbf3[_0xf0e0('0x31')]['id']){delete _0x89dbf3['body']['id'];}return db[_0xf0e0('0x25')][_0xf0e0('0x32')]({'where':{'id':_0x89dbf3[_0xf0e0('0x33')]['id']}})[_0xf0e0('0x1c')](handleEntityNotFound(_0x1105d7,null))[_0xf0e0('0x1c')](saveUpdates(_0x89dbf3[_0xf0e0('0x31')],null))['then'](respondWithResult(_0x1105d7,null))['catch'](handleError(_0x1105d7,null));};exports[_0xf0e0('0x1d')]=function(_0x5addaf,_0x11113c){return db[_0xf0e0('0x25')][_0xf0e0('0x32')]({'where':{'id':_0x5addaf[_0xf0e0('0x33')]['id']}})['then'](handleEntityNotFound(_0x11113c,null))['then'](removeEntity(_0x11113c,null))[_0xf0e0('0x2f')](handleError(_0x11113c,null));}; \ No newline at end of file +var _0x9e0d=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatApplication','find','catch','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x27371f,_0x94445f){var _0xa8587c=function(_0x490c25){while(--_0x490c25){_0x27371f['push'](_0x27371f['shift']());}};_0xa8587c(++_0x94445f);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x10c80d,_0x58e4bf){_0x10c80d=_0x10c80d-0x0;var _0x47659e=_0x9e0d[_0x10c80d];return _0x47659e;};'use strict';var emlformat=require(_0xd9e0('0x0'));var rimraf=require(_0xd9e0('0x1'));var zipdir=require(_0xd9e0('0x2'));var jsonpatch=require(_0xd9e0('0x3'));var rp=require('request-promise');var moment=require(_0xd9e0('0x4'));var BPromise=require(_0xd9e0('0x5'));var Mustache=require(_0xd9e0('0x6'));var util=require(_0xd9e0('0x7'));var path=require(_0xd9e0('0x8'));var sox=require(_0xd9e0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9e0('0xa'));var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require(_0xd9e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require(_0xd9e0('0x12'));var authService=require(_0xd9e0('0x13'));var qs=require(_0xd9e0('0x14'));var as=require(_0xd9e0('0x15'));var hardwareService=require(_0xd9e0('0x16'));var logger=require('../../config/logger')(_0xd9e0('0x17'));var utils=require(_0xd9e0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd9e0('0x19'));var db=require(_0xd9e0('0x1a'))['db'];function respondWithStatusCode(_0x418d84,_0x1fb454){_0x1fb454=_0x1fb454||0xcc;return function(_0x18fdf2){if(_0x18fdf2){return _0x418d84['sendStatus'](_0x1fb454);}return _0x418d84[_0xd9e0('0x1b')](_0x1fb454)['end']();};}function respondWithResult(_0x2f311c,_0x55c704){_0x55c704=_0x55c704||0xc8;return function(_0x24d361){if(_0x24d361){return _0x2f311c[_0xd9e0('0x1b')](_0x55c704)[_0xd9e0('0x1c')](_0x24d361);}};}function respondWithFilteredResult(_0x18301b,_0x3e4c5d){return function(_0x4da900){if(_0x4da900){var _0x58d44c=typeof _0x3e4c5d['offset']===_0xd9e0('0x1d')&&typeof _0x3e4c5d[_0xd9e0('0x1e')]===_0xd9e0('0x1d');var _0x1cdcb6=_0x4da900['count'];var _0x209c04=_0x58d44c?0x0:_0x3e4c5d['offset'];var _0x483b74=_0x58d44c?_0x4da900[_0xd9e0('0x1f')]:_0x3e4c5d[_0xd9e0('0x20')]+_0x3e4c5d['limit'];var _0x5ac8f5;if(_0x483b74>=_0x1cdcb6){_0x483b74=_0x1cdcb6;_0x5ac8f5=0xc8;}else{_0x5ac8f5=0xce;}_0x18301b[_0xd9e0('0x1b')](_0x5ac8f5);return _0x18301b[_0xd9e0('0x21')]('Content-Range',_0x209c04+'-'+_0x483b74+'/'+_0x1cdcb6)[_0xd9e0('0x1c')](_0x4da900);}return null;};}function patchUpdates(_0x4cc3c9){return function(_0xd3d455){try{jsonpatch[_0xd9e0('0x22')](_0xd3d455,_0x4cc3c9,!![]);}catch(_0x67f69f){return BPromise[_0xd9e0('0x23')](_0x67f69f);}return _0xd3d455[_0xd9e0('0x24')]();};}function saveUpdates(_0x5711a1,_0x19534a){return function(_0x333233){if(_0x333233){return _0x333233['update'](_0x5711a1)[_0xd9e0('0x25')](function(_0x124ca7){return _0x124ca7;});}return null;};}function removeEntity(_0x5d4549,_0x357bd9){return function(_0x5e17d4){if(_0x5e17d4){return _0x5e17d4[_0xd9e0('0x26')]()[_0xd9e0('0x25')](function(){_0x5d4549['status'](0xcc)[_0xd9e0('0x27')]();});}};}function handleEntityNotFound(_0x53cf67,_0x554aeb){return function(_0x50f57d){if(!_0x50f57d){_0x53cf67[_0xd9e0('0x28')](0x194);}return _0x50f57d;};}function handleError(_0x21c796,_0x7065c6){_0x7065c6=_0x7065c6||0x1f4;return function(_0x1c36df){logger[_0xd9e0('0x29')](_0x1c36df[_0xd9e0('0x2a')]);if(_0x1c36df[_0xd9e0('0x2b')]){delete _0x1c36df['name'];}_0x21c796[_0xd9e0('0x1b')](_0x7065c6)[_0xd9e0('0x2c')](_0x1c36df);};}exports[_0xd9e0('0x2d')]=function(_0x17a899,_0x2738e9){var _0x4f5367={'raw':!![],'where':{'id':_0x17a899['params']['id']}},_0x4b4f7d={};_0x4b4f7d[_0xd9e0('0x2e')]=_[_0xd9e0('0x2f')](db['ChatApplication'][_0xd9e0('0x30')]);_0x4b4f7d[_0xd9e0('0x31')]=_[_0xd9e0('0x2f')](_0x17a899[_0xd9e0('0x31')]);_0x4b4f7d[_0xd9e0('0x32')]=_[_0xd9e0('0x33')](_0x4b4f7d[_0xd9e0('0x2e')],_0x4b4f7d['query']);_0x4f5367[_0xd9e0('0x34')]=_[_0xd9e0('0x33')](_0x4b4f7d[_0xd9e0('0x2e')],qs[_0xd9e0('0x35')](_0x17a899[_0xd9e0('0x31')][_0xd9e0('0x35')]));_0x4f5367[_0xd9e0('0x34')]=_0x4f5367[_0xd9e0('0x34')][_0xd9e0('0x36')]?_0x4f5367[_0xd9e0('0x34')]:_0x4b4f7d[_0xd9e0('0x2e')];if(_0x17a899[_0xd9e0('0x31')]['includeAll']){_0x4f5367[_0xd9e0('0x37')]=[{'all':!![]}];}_0x4f5367=_[_0xd9e0('0x38')]({},_0x4f5367,_0x17a899[_0xd9e0('0x39')]);return db[_0xd9e0('0x3a')][_0xd9e0('0x3b')](_0x4f5367)['then'](handleEntityNotFound(_0x2738e9,null))[_0xd9e0('0x25')](respondWithResult(_0x2738e9,null))[_0xd9e0('0x3c')](handleError(_0x2738e9,null));};exports[_0xd9e0('0x3d')]=function(_0x23901a,_0x588f8c){if(_0x23901a[_0xd9e0('0x3e')]['id']){delete _0x23901a['body']['id'];}return db[_0xd9e0('0x3a')][_0xd9e0('0x3b')]({'where':{'id':_0x23901a[_0xd9e0('0x3f')]['id']}})[_0xd9e0('0x25')](handleEntityNotFound(_0x588f8c,null))[_0xd9e0('0x25')](saveUpdates(_0x23901a[_0xd9e0('0x3e')],null))[_0xd9e0('0x25')](respondWithResult(_0x588f8c,null))[_0xd9e0('0x3c')](handleError(_0x588f8c,null));};exports[_0xd9e0('0x26')]=function(_0x5065f7,_0x318679){return db[_0xd9e0('0x3a')][_0xd9e0('0x3b')]({'where':{'id':_0x5065f7[_0xd9e0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x318679,null))[_0xd9e0('0x25')](removeEntity(_0x318679,null))[_0xd9e0('0x3c')](handleError(_0x318679,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 8b563ee..39203df 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 _0x05cd=['api','moment','request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x205123,_0x240ebe){var _0x5b69fb=function(_0x488aaf){while(--_0x488aaf){_0x205123['push'](_0x205123['shift']());}};_0x5b69fb(++_0x240ebe);}(_0x05cd,0x1bd));var _0xd05c=function(_0x266ca7,_0x15005f){_0x266ca7=_0x266ca7-0x0;var _0x2969ca=_0x05cd[_0x266ca7];return _0x2969ca;};'use strict';var _=require(_0xd05c('0x0'));var util=require(_0xd05c('0x1'));var logger=require(_0xd05c('0x2'))(_0xd05c('0x3'));var moment=require(_0xd05c('0x4'));var BPromise=require('bluebird');var rp=require(_0xd05c('0x5'));var fs=require('fs');var path=require(_0xd05c('0x6'));var rimraf=require('rimraf');var config=require(_0xd05c('0x7'));var attributes=require(_0xd05c('0x8'));module[_0xd05c('0x9')]=function(_0x55ed53,_0x572586){return _0x55ed53[_0xd05c('0xa')](_0xd05c('0xb'),attributes,{'tableName':_0xd05c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd05c('0xd')});}; \ No newline at end of file +var _0xa952=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4'];(function(_0x49f82f,_0x54feda){var _0x55dfc2=function(_0xe92f19){while(--_0xe92f19){_0x49f82f['push'](_0x49f82f['shift']());}};_0x55dfc2(++_0x54feda);}(_0xa952,0x1b2));var _0x2a95=function(_0x48e77c,_0x1da50c){_0x48e77c=_0x48e77c-0x0;var _0x4a49b5=_0xa952[_0x48e77c];return _0x4a49b5;};'use strict';var _=require(_0x2a95('0x0'));var util=require(_0x2a95('0x1'));var logger=require(_0x2a95('0x2'))(_0x2a95('0x3'));var moment=require(_0x2a95('0x4'));var BPromise=require(_0x2a95('0x5'));var rp=require(_0x2a95('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a95('0x7'));var config=require(_0x2a95('0x8'));var attributes=require(_0x2a95('0x9'));module[_0x2a95('0xa')]=function(_0x53c54f,_0x153806){return _0x53c54f[_0x2a95('0xb')](_0x2a95('0xc'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a95('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 71839fd..4401130 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 _0xcbf8=['code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xcbf8,0x118));var _0x8cbf=function(_0x5b73ac,_0x4a1422){_0x5b73ac=_0x5b73ac-0x0;var _0x32bcdf=_0xcbf8[_0x5b73ac];return _0x32bcdf;};'use strict';var _=require(_0x8cbf('0x0'));var util=require(_0x8cbf('0x1'));var moment=require(_0x8cbf('0x2'));var BPromise=require(_0x8cbf('0x3'));var rs=require(_0x8cbf('0x4'));var fs=require('fs');var Redis=require(_0x8cbf('0x5'));var db=require(_0x8cbf('0x6'))['db'];var utils=require(_0x8cbf('0x7'));var logger=require(_0x8cbf('0x8'))(_0x8cbf('0x9'));var config=require(_0x8cbf('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8cbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4625cd,_0x3bbcfe,_0x2bb948){return new BPromise(function(_0x936320,_0x425ade){return client[_0x8cbf('0xc')](_0x4625cd,_0x2bb948)[_0x8cbf('0xd')](function(_0x5e1005){logger[_0x8cbf('0xe')]('ChatApplication,\x20%s,\x20%s',_0x3bbcfe,_0x8cbf('0xf'));logger[_0x8cbf('0x10')](_0x8cbf('0x11'),_0x3bbcfe,_0x8cbf('0xf'),JSON[_0x8cbf('0x12')](_0x5e1005));if(_0x5e1005[_0x8cbf('0x13')]){if(_0x5e1005[_0x8cbf('0x13')][_0x8cbf('0x14')]===0x1f4){logger[_0x8cbf('0x13')](_0x8cbf('0x15'),_0x3bbcfe,_0x5e1005[_0x8cbf('0x13')]['message']);return _0x425ade(_0x5e1005['error'][_0x8cbf('0x16')]);}logger[_0x8cbf('0x13')](_0x8cbf('0x15'),_0x3bbcfe,_0x5e1005[_0x8cbf('0x13')][_0x8cbf('0x16')]);return _0x936320(_0x5e1005['error'][_0x8cbf('0x16')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x3bbcfe,_0x8cbf('0xf'));_0x936320(_0x5e1005[_0x8cbf('0x17')][_0x8cbf('0x16')]);}})[_0x8cbf('0x18')](function(_0x25cc85){logger[_0x8cbf('0x13')](_0x8cbf('0x15'),_0x3bbcfe,_0x25cc85);_0x425ade(_0x25cc85);});});} \ No newline at end of file +var _0x2a90=['catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x70eff9,_0x28ed03){var _0x4befb9=function(_0x2e003b){while(--_0x2e003b){_0x70eff9['push'](_0x70eff9['shift']());}};_0x4befb9(++_0x28ed03);}(_0x2a90,0x1e5));var _0x02a9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2a90[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x02a9('0x0'));var BPromise=require(_0x02a9('0x1'));var rs=require(_0x02a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02a9('0x3'))['db'];var utils=require(_0x02a9('0x4'));var logger=require('../../config/logger')(_0x02a9('0x5'));var config=require(_0x02a9('0x6'));var jayson=require(_0x02a9('0x7'));var client=jayson[_0x02a9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d5421,_0x5ae427,_0x1cf327){return new BPromise(function(_0x1b2943,_0x3d7527){return client[_0x02a9('0x9')](_0x2d5421,_0x1cf327)[_0x02a9('0xa')](function(_0x455d4d){logger[_0x02a9('0xb')](_0x02a9('0xc'),_0x5ae427,'request\x20sent');logger[_0x02a9('0xd')](_0x02a9('0xe'),_0x5ae427,_0x02a9('0xf'),JSON[_0x02a9('0x10')](_0x455d4d));if(_0x455d4d[_0x02a9('0x11')]){if(_0x455d4d[_0x02a9('0x11')][_0x02a9('0x12')]===0x1f4){logger[_0x02a9('0x11')](_0x02a9('0xc'),_0x5ae427,_0x455d4d[_0x02a9('0x11')][_0x02a9('0x13')]);return _0x3d7527(_0x455d4d['error']['message']);}logger['error'](_0x02a9('0xc'),_0x5ae427,_0x455d4d[_0x02a9('0x11')]['message']);return _0x1b2943(_0x455d4d[_0x02a9('0x11')][_0x02a9('0x13')]);}else{logger[_0x02a9('0xb')]('ChatApplication,\x20%s,\x20%s',_0x5ae427,_0x02a9('0xf'));_0x1b2943(_0x455d4d[_0x02a9('0x14')][_0x02a9('0x13')]);}})[_0x02a9('0x15')](function(_0x35825f){logger['error'](_0x02a9('0xc'),_0x5ae427,_0x35825f);_0x3d7527(_0x35825f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 99f9c00..96af3a4 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 _0xf1a1=['exports','multer','util','Router','fs-extra','/:id','isAuthenticated','put','delete','destroy'];(function(_0x269825,_0x271c62){var _0x2d7a7a=function(_0x6ad778){while(--_0x6ad778){_0x269825['push'](_0x269825['shift']());}};_0x2d7a7a(++_0x271c62);}(_0xf1a1,0xdd));var _0x1f1a=function(_0x39a42e,_0x594f2c){_0x39a42e=_0x39a42e-0x0;var _0x462d94=_0xf1a1[_0x39a42e];return _0x462d94;};'use strict';var multer=require(_0x1f1a('0x0'));var util=require(_0x1f1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f1a('0x2')]();var fs_extra=require(_0x1f1a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x1f1a('0x4'),auth[_0x1f1a('0x5')](),controller['show']);router[_0x1f1a('0x6')](_0x1f1a('0x4'),auth[_0x1f1a('0x5')](),controller['update']);router[_0x1f1a('0x7')]('/:id',auth[_0x1f1a('0x5')](),controller[_0x1f1a('0x8')]);module[_0x1f1a('0x9')]=router; \ No newline at end of file +var _0xc445=['put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xc445,0x7c));var _0x5c44=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xc445[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0x5c44('0x0'));var util=require(_0x5c44('0x1'));var path=require(_0x5c44('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5c44('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5c44('0x4'));var interaction=require(_0x5c44('0x5'));var config=require(_0x5c44('0x6'));var controller=require(_0x5c44('0x7'));router[_0x5c44('0x8')](_0x5c44('0x9'),auth[_0x5c44('0xa')](),controller[_0x5c44('0xb')]);router[_0x5c44('0xc')](_0x5c44('0x9'),auth['isAuthenticated'](),controller[_0x5c44('0xd')]);router[_0x5c44('0xe')](_0x5c44('0x9'),auth[_0x5c44('0xa')](),controller[_0x5c44('0xf')]);module[_0x5c44('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index e99682f..5919f37 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 _0xfb67=['BOOLEAN','sequelize','exports','STRING'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0xfb67,0xdd));var _0x7fb6=function(_0x773a85,_0x11cd42){_0x773a85=_0x773a85-0x0;var _0x4dd465=_0xfb67[_0x773a85];return _0x4dd465;};'use strict';var Sequelize=require(_0x7fb6('0x0'));module[_0x7fb6('0x1')]={'name':{'type':Sequelize[_0x7fb6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7fb6('0x2')]},'write':{'type':Sequelize[_0x7fb6('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xeb5d=['sequelize','exports','STRING','BOOLEAN'];(function(_0x11d7a5,_0xed05b0){var _0x222fdb=function(_0xec709){while(--_0xec709){_0x11d7a5['push'](_0x11d7a5['shift']());}};_0x222fdb(++_0xed05b0);}(_0xeb5d,0x174));var _0xdeb5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xeb5d[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xdeb5('0x0'));module[_0xdeb5('0x1')]={'name':{'type':Sequelize[_0xdeb5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdeb5('0x2')]},'write':{'type':Sequelize[_0xdeb5('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b608454..32974b3 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 _0x3fe7=['fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','rows','catch','show','params','fields','length','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3fe7,0xc4));var _0x73fe=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x3fe7[_0x2bd1ec];return _0x2f7577;};'use strict';var emlformat=require(_0x73fe('0x0'));var rimraf=require(_0x73fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73fe('0x2'));var rp=require(_0x73fe('0x3'));var moment=require(_0x73fe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x73fe('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x73fe('0x6'));var ejs=require(_0x73fe('0x7'));var fs=require('fs');var fs_extra=require(_0x73fe('0x8'));var _=require(_0x73fe('0x9'));var squel=require(_0x73fe('0xa'));var crypto=require(_0x73fe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x73fe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x73fe('0xd'));var Papa=require(_0x73fe('0xe'));var Redis=require(_0x73fe('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x73fe('0x10'));var as=require(_0x73fe('0x11'));var hardwareService=require(_0x73fe('0x12'));var logger=require(_0x73fe('0x13'))(_0x73fe('0x14'));var utils=require(_0x73fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x73fe('0x16'));var db=require(_0x73fe('0x17'))['db'];config[_0x73fe('0x18')]=_[_0x73fe('0x19')](config[_0x73fe('0x18')],{'host':_0x73fe('0x1a'),'port':0x18eb});var socket=require(_0x73fe('0x1b'))(new Redis(config[_0x73fe('0x18')]));require(_0x73fe('0x1c'))[_0x73fe('0x1d')](socket);function respondWithStatusCode(_0x38ef91,_0x4c934f){_0x4c934f=_0x4c934f||0xcc;return function(_0x29150d){if(_0x29150d){return _0x38ef91['sendStatus'](_0x4c934f);}return _0x38ef91[_0x73fe('0x1e')](_0x4c934f)[_0x73fe('0x1f')]();};}function respondWithResult(_0x253579,_0x53fd08){_0x53fd08=_0x53fd08||0xc8;return function(_0xa7c45d){if(_0xa7c45d){return _0x253579[_0x73fe('0x1e')](_0x53fd08)[_0x73fe('0x20')](_0xa7c45d);}};}function respondWithFilteredResult(_0x3df4e4,_0x531c14){return function(_0x4fafc0){if(_0x4fafc0){var _0x361791=typeof _0x531c14[_0x73fe('0x21')]===_0x73fe('0x22')&&typeof _0x531c14[_0x73fe('0x23')]===_0x73fe('0x22');var _0x4eaa32=_0x4fafc0[_0x73fe('0x24')];var _0x388a3c=_0x361791?0x0:_0x531c14[_0x73fe('0x21')];var _0x2b437f=_0x361791?_0x4fafc0[_0x73fe('0x24')]:_0x531c14[_0x73fe('0x21')]+_0x531c14[_0x73fe('0x23')];var _0x3f6627;if(_0x2b437f>=_0x4eaa32){_0x2b437f=_0x4eaa32;_0x3f6627=0xc8;}else{_0x3f6627=0xce;}_0x3df4e4[_0x73fe('0x1e')](_0x3f6627);return _0x3df4e4[_0x73fe('0x25')](_0x73fe('0x26'),_0x388a3c+'-'+_0x2b437f+'/'+_0x4eaa32)[_0x73fe('0x20')](_0x4fafc0);}return null;};}function patchUpdates(_0x4cd3f9){return function(_0xce58be){try{jsonpatch[_0x73fe('0x27')](_0xce58be,_0x4cd3f9,!![]);}catch(_0x4ece5c){return BPromise['reject'](_0x4ece5c);}return _0xce58be[_0x73fe('0x28')]();};}function saveUpdates(_0x48d620,_0x17c200){return function(_0x5d7370){if(_0x5d7370){return _0x5d7370[_0x73fe('0x29')](_0x48d620)[_0x73fe('0x2a')](function(_0x5be41a){return _0x5be41a;});}return null;};}function removeEntity(_0x54c01a,_0x231f86){return function(_0x49f76c){if(_0x49f76c){return _0x49f76c[_0x73fe('0x2b')]()[_0x73fe('0x2a')](function(){_0x54c01a[_0x73fe('0x1e')](0xcc)[_0x73fe('0x1f')]();});}};}function handleEntityNotFound(_0xa0782d,_0x2261b3){return function(_0x51a176){if(!_0x51a176){_0xa0782d[_0x73fe('0x2c')](0x194);}return _0x51a176;};}function handleError(_0x4c4641,_0x13e46e){_0x13e46e=_0x13e46e||0x1f4;return function(_0x140f5a){logger['error'](_0x140f5a[_0x73fe('0x2d')]);if(_0x140f5a[_0x73fe('0x2e')]){delete _0x140f5a[_0x73fe('0x2e')];}_0x4c4641[_0x73fe('0x1e')](_0x13e46e)[_0x73fe('0x2f')](_0x140f5a);};}exports[_0x73fe('0x30')]=function(_0x1d4d3f,_0x132fca){var _0x589a1a={},_0x18b30c={},_0x52d85f={'count':0x0,'rows':[]};var _0x186103=_[_0x73fe('0x31')](db[_0x73fe('0x32')][_0x73fe('0x33')],function(_0x3bc81e){return{'name':_0x3bc81e[_0x73fe('0x34')],'type':_0x3bc81e[_0x73fe('0x35')][_0x73fe('0x36')]};});_0x18b30c[_0x73fe('0x37')]=_[_0x73fe('0x31')](_0x186103,_0x73fe('0x2e'));_0x18b30c[_0x73fe('0x38')]=_[_0x73fe('0x39')](_0x1d4d3f['query']);_0x18b30c['filters']=_[_0x73fe('0x3a')](_0x18b30c[_0x73fe('0x37')],_0x18b30c['query']);_0x589a1a[_0x73fe('0x3b')]=_[_0x73fe('0x3a')](_0x18b30c[_0x73fe('0x37')],qs['fields'](_0x1d4d3f[_0x73fe('0x38')]['fields']));_0x589a1a['attributes']=_0x589a1a[_0x73fe('0x3b')]['length']?_0x589a1a[_0x73fe('0x3b')]:_0x18b30c[_0x73fe('0x37')];if(!_0x1d4d3f['query'][_0x73fe('0x3c')]('nolimit')){_0x589a1a['limit']=qs[_0x73fe('0x23')](_0x1d4d3f['query'][_0x73fe('0x23')]);_0x589a1a[_0x73fe('0x21')]=qs[_0x73fe('0x21')](_0x1d4d3f[_0x73fe('0x38')][_0x73fe('0x21')]);}_0x589a1a[_0x73fe('0x3d')]=qs[_0x73fe('0x3e')](_0x1d4d3f['query'][_0x73fe('0x3e')]);_0x589a1a[_0x73fe('0x3f')]=qs[_0x73fe('0x40')](_['pick'](_0x1d4d3f['query'],_0x18b30c[_0x73fe('0x40')]),_0x186103);if(_0x1d4d3f['query'][_0x73fe('0x41')]){_0x589a1a[_0x73fe('0x3f')]=_[_0x73fe('0x42')](_0x589a1a[_0x73fe('0x3f')],{'$or':_[_0x73fe('0x31')](_0x186103,function(_0x1fa431){if(_0x1fa431['type']!==_0x73fe('0x43')){var _0x12980d={};_0x12980d[_0x1fa431[_0x73fe('0x2e')]]={'$like':'%'+_0x1d4d3f[_0x73fe('0x38')][_0x73fe('0x41')]+'%'};return _0x12980d;}})});}_0x589a1a=_[_0x73fe('0x42')]({},_0x589a1a,_0x1d4d3f[_0x73fe('0x44')]);var _0x5f05d1={'where':_0x589a1a[_0x73fe('0x3f')]};return db[_0x73fe('0x32')][_0x73fe('0x24')](_0x5f05d1)[_0x73fe('0x2a')](function(_0x42372a){_0x52d85f[_0x73fe('0x24')]=_0x42372a;if(_0x1d4d3f[_0x73fe('0x38')]['includeAll']){_0x589a1a['include']=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x589a1a);})[_0x73fe('0x2a')](function(_0x1c6764){_0x52d85f[_0x73fe('0x45')]=_0x1c6764;return _0x52d85f;})[_0x73fe('0x2a')](respondWithFilteredResult(_0x132fca,_0x589a1a))[_0x73fe('0x46')](handleError(_0x132fca,null));};exports[_0x73fe('0x47')]=function(_0x8cc8dc,_0x12d862){var _0x3eda7d={'raw':!![],'where':{'id':_0x8cc8dc[_0x73fe('0x48')]['id']}},_0x1ffb60={};_0x1ffb60[_0x73fe('0x37')]=_['keys'](db[_0x73fe('0x32')][_0x73fe('0x33')]);_0x1ffb60[_0x73fe('0x38')]=_['keys'](_0x8cc8dc[_0x73fe('0x38')]);_0x1ffb60[_0x73fe('0x40')]=_[_0x73fe('0x3a')](_0x1ffb60[_0x73fe('0x37')],_0x1ffb60[_0x73fe('0x38')]);_0x3eda7d[_0x73fe('0x3b')]=_[_0x73fe('0x3a')](_0x1ffb60[_0x73fe('0x37')],qs['fields'](_0x8cc8dc['query'][_0x73fe('0x49')]));_0x3eda7d[_0x73fe('0x3b')]=_0x3eda7d['attributes'][_0x73fe('0x4a')]?_0x3eda7d['attributes']:_0x1ffb60[_0x73fe('0x37')];if(_0x8cc8dc[_0x73fe('0x38')][_0x73fe('0x4b')]){_0x3eda7d[_0x73fe('0x4c')]=[{'all':!![]}];}_0x3eda7d=_[_0x73fe('0x42')]({},_0x3eda7d,_0x8cc8dc[_0x73fe('0x44')]);return db['ChatGroup'][_0x73fe('0x4d')](_0x3eda7d)['then'](handleEntityNotFound(_0x12d862,null))[_0x73fe('0x2a')](respondWithResult(_0x12d862,null))[_0x73fe('0x46')](handleError(_0x12d862,null));};exports[_0x73fe('0x4e')]=function(_0x444ed7,_0x4afb9e){return db[_0x73fe('0x32')][_0x73fe('0x4e')](_0x444ed7[_0x73fe('0x4f')],{})['then'](respondWithResult(_0x4afb9e,0xc9))['catch'](handleError(_0x4afb9e,null));};exports[_0x73fe('0x29')]=function(_0x1785cb,_0xd0246d){if(_0x1785cb['body']['id']){delete _0x1785cb['body']['id'];}return db[_0x73fe('0x32')]['find']({'where':{'id':_0x1785cb[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0xd0246d,null))[_0x73fe('0x2a')](saveUpdates(_0x1785cb[_0x73fe('0x4f')],null))[_0x73fe('0x2a')](respondWithResult(_0xd0246d,null))[_0x73fe('0x46')](handleError(_0xd0246d,null));};exports['destroy']=function(_0x4462d3,_0x258acf){return db[_0x73fe('0x32')][_0x73fe('0x4d')]({'where':{'id':_0x4462d3[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x258acf,null))['then'](removeEntity(_0x258acf,null))['catch'](handleError(_0x258acf,null));};exports[_0x73fe('0x50')]=function(_0x3bf0da,_0x5cda19){return db[_0x73fe('0x32')][_0x73fe('0x50')]()[_0x73fe('0x2a')](respondWithResult(_0x5cda19,null))['catch'](handleError(_0x5cda19,null));};exports[_0x73fe('0x51')]=function(_0x3bf973,_0x23e3c8,_0x2be132){return db[_0x73fe('0x52')][_0x73fe('0x24')]({'where':{'ChatGroupId':_0x3bf973['params']['id'],'ToId':_0x3bf973['user']['id'],'read':![]}})['then'](function(_0x44cf3b){return{'id':_[_0x73fe('0x53')](_0x3bf973[_0x73fe('0x48')]['id']),'count':_0x44cf3b};})[_0x73fe('0x2a')](respondWithResult(_0x23e3c8,null))[_0x73fe('0x46')](handleError(_0x23e3c8,null));};exports['addMembers']=function(_0xa63ad4,_0x5242f6,_0xcd18e9){return db[_0x73fe('0x32')][_0x73fe('0x4d')]({'where':{'id':_0xa63ad4[_0x73fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x5242f6,null))['then'](function(_0x12174a){if(_0x12174a){return _0x12174a[_0x73fe('0x54')](_0xa63ad4[_0x73fe('0x4f')][_0x73fe('0x55')],_[_0x73fe('0x56')](_0xa63ad4[_0x73fe('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x5242f6,null))[_0x73fe('0x46')](handleError(_0x5242f6,null));};exports[_0x73fe('0x57')]=function(_0x32117c,_0x186f96,_0x5c567f){var _0x88af41={};var _0x276c93={};var _0x44b5e9;var _0x384551;return db['ChatGroup'][_0x73fe('0x58')]({'where':{'id':_0x32117c['params']['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x186f96,null))['then'](function(_0x7973b9){if(_0x7973b9){_0x44b5e9=_0x7973b9;_0x276c93['model']=_[_0x73fe('0x39')](db[_0x73fe('0x59')][_0x73fe('0x33')]);_0x276c93[_0x73fe('0x38')]=_[_0x73fe('0x39')](_0x32117c['query']);_0x276c93[_0x73fe('0x40')]=_[_0x73fe('0x3a')](_0x276c93[_0x73fe('0x37')],_0x276c93[_0x73fe('0x38')]);_0x88af41['attributes']=_[_0x73fe('0x3a')](_0x276c93[_0x73fe('0x37')],qs[_0x73fe('0x49')](_0x32117c['query']['fields']));_0x88af41[_0x73fe('0x3b')]=_0x88af41[_0x73fe('0x3b')][_0x73fe('0x4a')]?_0x88af41['attributes']:_0x276c93[_0x73fe('0x37')];_0x88af41[_0x73fe('0x3d')]=qs[_0x73fe('0x3e')](_0x32117c['query'][_0x73fe('0x3e')]);_0x88af41[_0x73fe('0x3f')]=qs[_0x73fe('0x40')](_[_0x73fe('0x5a')](_0x32117c[_0x73fe('0x38')],_0x276c93['filters']));if(_0x32117c[_0x73fe('0x38')]['filter']){_0x88af41[_0x73fe('0x3f')]=_[_0x73fe('0x42')](_0x88af41['where'],{'$or':_[_0x73fe('0x31')](_0x88af41[_0x73fe('0x3b')],function(_0x1f879a){var _0x1207da={};_0x1207da[_0x1f879a]={'$like':'%'+_0x32117c[_0x73fe('0x38')][_0x73fe('0x41')]+'%'};return _0x1207da;})});}_0x88af41=_[_0x73fe('0x42')]({},_0x88af41,_0x32117c[_0x73fe('0x44')]);return _0x44b5e9['getMembers'](_0x88af41);}})[_0x73fe('0x2a')](function(_0x2efc61){if(_0x2efc61){_0x384551=_0x2efc61[_0x73fe('0x4a')];if(!_0x32117c['query'][_0x73fe('0x3c')]('nolimit')){_0x88af41[_0x73fe('0x23')]=qs[_0x73fe('0x23')](_0x32117c[_0x73fe('0x38')][_0x73fe('0x23')]);_0x88af41[_0x73fe('0x21')]=qs[_0x73fe('0x21')](_0x32117c[_0x73fe('0x38')][_0x73fe('0x21')]);}return _0x44b5e9['getMembers'](_0x88af41);}})[_0x73fe('0x2a')](function(_0x27c4ef){if(_0x27c4ef){return _0x27c4ef?{'count':_0x384551,'rows':_0x27c4ef}:null;}})['then'](respondWithResult(_0x186f96,null))[_0x73fe('0x46')](handleError(_0x186f96,null));};exports[_0x73fe('0x5b')]=function(_0x30ecf7,_0x4aa862,_0x5470de){return db[_0x73fe('0x32')]['find']({'where':{'id':_0x30ecf7[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x4aa862,null))[_0x73fe('0x2a')](function(_0x530e31){if(_0x530e31){return _0x530e31[_0x73fe('0x5b')](_0x30ecf7['query'][_0x73fe('0x55')]);}})['then'](respondWithStatusCode(_0x4aa862,null))[_0x73fe('0x46')](handleError(_0x4aa862,null));};exports['addMessage']=function(_0x3ae69c,_0x15597d,_0x1e8c59){if(_0x3ae69c['body']['id']){delete _0x3ae69c[_0x73fe('0x4f')]['id'];}return db[_0x73fe('0x32')][_0x73fe('0x4d')]({'where':{'id':_0x3ae69c[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x15597d,null))[_0x73fe('0x2a')](function(_0x1debc4){if(_0x1debc4){_0x3ae69c[_0x73fe('0x4f')][_0x73fe('0x5c')]=_0x1debc4['id'];return db[_0x73fe('0x52')][_0x73fe('0x4e')](_0x3ae69c[_0x73fe('0x4f')]);}})['then'](respondWithResult(_0x15597d,null))['catch'](handleError(_0x15597d,null));};exports[_0x73fe('0x5d')]=function(_0x287eef,_0x1af16f,_0x1e1861){var _0x503167={};var _0x4b58fb={};var _0x31ee52;var _0x53183b;return db[_0x73fe('0x32')]['findOne']({'where':{'id':_0x287eef[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x1af16f,null))[_0x73fe('0x2a')](function(_0x2c3f69){if(_0x2c3f69){_0x31ee52=_0x2c3f69;_0x4b58fb[_0x73fe('0x37')]=_[_0x73fe('0x39')](db[_0x73fe('0x52')][_0x73fe('0x33')]);_0x4b58fb[_0x73fe('0x38')]=_[_0x73fe('0x39')](_0x287eef['query']);_0x4b58fb[_0x73fe('0x40')]=_[_0x73fe('0x3a')](_0x4b58fb['model'],_0x4b58fb['query']);_0x503167[_0x73fe('0x3b')]=_[_0x73fe('0x3a')](_0x4b58fb['model'],qs['fields'](_0x287eef['query'][_0x73fe('0x49')]));_0x503167[_0x73fe('0x3b')]=_0x503167[_0x73fe('0x3b')][_0x73fe('0x4a')]?_0x503167[_0x73fe('0x3b')]:_0x4b58fb['model'];_0x503167[_0x73fe('0x3d')]=qs[_0x73fe('0x3e')](_0x287eef[_0x73fe('0x38')][_0x73fe('0x3e')]);_0x503167[_0x73fe('0x3f')]=qs[_0x73fe('0x40')](_[_0x73fe('0x5a')](_0x287eef['query'],_0x4b58fb[_0x73fe('0x40')]));if(_0x287eef[_0x73fe('0x38')][_0x73fe('0x41')]){_0x503167[_0x73fe('0x3f')]=_[_0x73fe('0x42')](_0x503167['where'],{'$or':_[_0x73fe('0x31')](_0x503167['attributes'],function(_0x460b64){var _0x37c5b8={};_0x37c5b8[_0x460b64]={'$like':'%'+_0x287eef['query'][_0x73fe('0x41')]+'%'};return _0x37c5b8;})});}if(_0x287eef[_0x73fe('0x38')][_0x73fe('0x5e')]){var _0x3c89eb=_0x287eef['query'][_0x73fe('0x5e')][_0x73fe('0x5f')](',');var _0x397a5b={};_0x397a5b[_0x3c89eb[0x0]]={'$gte':moment(_0x3c89eb[0x1])[_0x73fe('0x60')](_0x73fe('0x61'))};_0x503167['where']=_[_0x73fe('0x42')](_0x503167['where'],_0x397a5b);}_0x503167=_[_0x73fe('0x42')]({},_0x503167,_0x287eef['options']);return _0x31ee52[_0x73fe('0x5d')](_0x503167);}})[_0x73fe('0x2a')](function(_0x451c4f){if(_0x451c4f){_0x53183b=_0x451c4f[_0x73fe('0x4a')];if(!_0x287eef['query'][_0x73fe('0x3c')](_0x73fe('0x62'))){_0x503167[_0x73fe('0x23')]=qs[_0x73fe('0x23')](_0x287eef[_0x73fe('0x38')][_0x73fe('0x23')]);_0x503167[_0x73fe('0x21')]=qs[_0x73fe('0x21')](_0x287eef[_0x73fe('0x38')][_0x73fe('0x21')]);}return _0x31ee52[_0x73fe('0x5d')](_0x503167);}})['then'](function(_0x1146ff){if(_0x1146ff){return _0x1146ff?{'count':_0x53183b,'rows':_0x1146ff}:null;}})[_0x73fe('0x2a')](respondWithResult(_0x1af16f,null))['catch'](handleError(_0x1af16f,null));}; \ No newline at end of file +var _0x21ae=['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/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','update','then','end','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','rows','catch','params','keys','find','create','body','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','findOne','User','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','filter','$gte','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xab287a,_0x2db01f){var _0x16ac16=function(_0x3e08ec){while(--_0x3e08ec){_0xab287a['push'](_0xab287a['shift']());}};_0x16ac16(++_0x2db01f);}(_0x21ae,0x1d7));var _0xe21a=function(_0x535a20,_0x278ee4){_0x535a20=_0x535a20-0x0;var _0x13d870=_0x21ae[_0x535a20];return _0x13d870;};'use strict';var emlformat=require(_0xe21a('0x0'));var rimraf=require(_0xe21a('0x1'));var zipdir=require(_0xe21a('0x2'));var jsonpatch=require(_0xe21a('0x3'));var rp=require(_0xe21a('0x4'));var moment=require(_0xe21a('0x5'));var BPromise=require(_0xe21a('0x6'));var Mustache=require(_0xe21a('0x7'));var util=require(_0xe21a('0x8'));var path=require(_0xe21a('0x9'));var sox=require(_0xe21a('0xa'));var csv=require(_0xe21a('0xb'));var ejs=require(_0xe21a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe21a('0xd'));var squel=require(_0xe21a('0xe'));var crypto=require(_0xe21a('0xf'));var jsforce=require(_0xe21a('0x10'));var deskjs=require(_0xe21a('0x11'));var toCsv=require(_0xe21a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe21a('0x12'));var authService=require(_0xe21a('0x13'));var qs=require(_0xe21a('0x14'));var as=require(_0xe21a('0x15'));var hardwareService=require(_0xe21a('0x16'));var logger=require(_0xe21a('0x17'))('api');var utils=require(_0xe21a('0x18'));var config=require(_0xe21a('0x19'));var licenseUtil=require(_0xe21a('0x1a'));var db=require('../../mysqldb')['db'];config[_0xe21a('0x1b')]=_['defaults'](config[_0xe21a('0x1b')],{'host':_0xe21a('0x1c'),'port':0x18eb});var socket=require(_0xe21a('0x1d'))(new Redis(config[_0xe21a('0x1b')]));require(_0xe21a('0x1e'))[_0xe21a('0x1f')](socket);function respondWithStatusCode(_0x577c35,_0x4ab347){_0x4ab347=_0x4ab347||0xcc;return function(_0x4fdfce){if(_0x4fdfce){return _0x577c35[_0xe21a('0x20')](_0x4ab347);}return _0x577c35[_0xe21a('0x21')](_0x4ab347)['end']();};}function respondWithResult(_0x176302,_0x8b747d){_0x8b747d=_0x8b747d||0xc8;return function(_0x50f880){if(_0x50f880){return _0x176302['status'](_0x8b747d)[_0xe21a('0x22')](_0x50f880);}};}function respondWithFilteredResult(_0x518189,_0x8aa5ab){return function(_0x228c8){if(_0x228c8){var _0x34aa87=typeof _0x8aa5ab[_0xe21a('0x23')]==='undefined'&&typeof _0x8aa5ab[_0xe21a('0x24')]==='undefined';var _0xd02c99=_0x228c8['count'];var _0xfce545=_0x34aa87?0x0:_0x8aa5ab[_0xe21a('0x23')];var _0x4d1985=_0x34aa87?_0x228c8[_0xe21a('0x25')]:_0x8aa5ab[_0xe21a('0x23')]+_0x8aa5ab[_0xe21a('0x24')];var _0x3eb25e;if(_0x4d1985>=_0xd02c99){_0x4d1985=_0xd02c99;_0x3eb25e=0xc8;}else{_0x3eb25e=0xce;}_0x518189[_0xe21a('0x21')](_0x3eb25e);return _0x518189[_0xe21a('0x26')](_0xe21a('0x27'),_0xfce545+'-'+_0x4d1985+'/'+_0xd02c99)['json'](_0x228c8);}return null;};}function patchUpdates(_0x31a1ef){return function(_0x3e1c0e){try{jsonpatch['apply'](_0x3e1c0e,_0x31a1ef,!![]);}catch(_0x290856){return BPromise[_0xe21a('0x28')](_0x290856);}return _0x3e1c0e['save']();};}function saveUpdates(_0x1b076b,_0x4e059){return function(_0x135f59){if(_0x135f59){return _0x135f59[_0xe21a('0x29')](_0x1b076b)[_0xe21a('0x2a')](function(_0x2303dd){return _0x2303dd;});}return null;};}function removeEntity(_0x861f4e,_0xf265f7){return function(_0x532902){if(_0x532902){return _0x532902['destroy']()[_0xe21a('0x2a')](function(){_0x861f4e[_0xe21a('0x21')](0xcc)[_0xe21a('0x2b')]();});}};}function handleEntityNotFound(_0x11060b,_0x22e8e7){return function(_0x3db690){if(!_0x3db690){_0x11060b[_0xe21a('0x20')](0x194);}return _0x3db690;};}function handleError(_0x5e832d,_0x1089de){_0x1089de=_0x1089de||0x1f4;return function(_0x1282c5){logger[_0xe21a('0x2c')](_0x1282c5[_0xe21a('0x2d')]);if(_0x1282c5[_0xe21a('0x2e')]){delete _0x1282c5['name'];}_0x5e832d[_0xe21a('0x21')](_0x1089de)[_0xe21a('0x2f')](_0x1282c5);};}exports[_0xe21a('0x30')]=function(_0x277eaf,_0x113143){var _0x382f22={},_0x472845={},_0x1b8d18={'count':0x0,'rows':[]};var _0x55b1e3=_['map'](db[_0xe21a('0x31')][_0xe21a('0x32')],function(_0x2e9e0f){return{'name':_0x2e9e0f[_0xe21a('0x33')],'type':_0x2e9e0f[_0xe21a('0x34')]['key']};});_0x472845['model']=_[_0xe21a('0x35')](_0x55b1e3,_0xe21a('0x2e'));_0x472845['query']=_['keys'](_0x277eaf[_0xe21a('0x36')]);_0x472845[_0xe21a('0x37')]=_['intersection'](_0x472845[_0xe21a('0x38')],_0x472845[_0xe21a('0x36')]);_0x382f22[_0xe21a('0x39')]=_[_0xe21a('0x3a')](_0x472845[_0xe21a('0x38')],qs['fields'](_0x277eaf[_0xe21a('0x36')][_0xe21a('0x3b')]));_0x382f22['attributes']=_0x382f22[_0xe21a('0x39')][_0xe21a('0x3c')]?_0x382f22['attributes']:_0x472845['model'];if(!_0x277eaf[_0xe21a('0x36')][_0xe21a('0x3d')](_0xe21a('0x3e'))){_0x382f22[_0xe21a('0x24')]=qs[_0xe21a('0x24')](_0x277eaf[_0xe21a('0x36')][_0xe21a('0x24')]);_0x382f22[_0xe21a('0x23')]=qs[_0xe21a('0x23')](_0x277eaf[_0xe21a('0x36')][_0xe21a('0x23')]);}_0x382f22[_0xe21a('0x3f')]=qs[_0xe21a('0x40')](_0x277eaf[_0xe21a('0x36')]['sort']);_0x382f22[_0xe21a('0x41')]=qs[_0xe21a('0x37')](_[_0xe21a('0x42')](_0x277eaf[_0xe21a('0x36')],_0x472845[_0xe21a('0x37')]),_0x55b1e3);if(_0x277eaf[_0xe21a('0x36')]['filter']){_0x382f22['where']=_[_0xe21a('0x43')](_0x382f22[_0xe21a('0x41')],{'$or':_[_0xe21a('0x35')](_0x55b1e3,function(_0x571f3c){if(_0x571f3c[_0xe21a('0x34')]!=='VIRTUAL'){var _0x2e2167={};_0x2e2167[_0x571f3c['name']]={'$like':'%'+_0x277eaf[_0xe21a('0x36')]['filter']+'%'};return _0x2e2167;}})});}_0x382f22=_[_0xe21a('0x43')]({},_0x382f22,_0x277eaf[_0xe21a('0x44')]);var _0x263f39={'where':_0x382f22['where']};return db[_0xe21a('0x31')][_0xe21a('0x25')](_0x263f39)[_0xe21a('0x2a')](function(_0x4d61b4){_0x1b8d18[_0xe21a('0x25')]=_0x4d61b4;if(_0x277eaf[_0xe21a('0x36')][_0xe21a('0x45')]){_0x382f22['include']=[{'all':!![]}];}return db[_0xe21a('0x31')][_0xe21a('0x46')](_0x382f22);})[_0xe21a('0x2a')](function(_0x129203){_0x1b8d18[_0xe21a('0x47')]=_0x129203;return _0x1b8d18;})['then'](respondWithFilteredResult(_0x113143,_0x382f22))[_0xe21a('0x48')](handleError(_0x113143,null));};exports['show']=function(_0x3f6582,_0x362dfb){var _0xb2bf5b={'raw':!![],'where':{'id':_0x3f6582[_0xe21a('0x49')]['id']}},_0x106e14={};_0x106e14['model']=_[_0xe21a('0x4a')](db[_0xe21a('0x31')]['rawAttributes']);_0x106e14[_0xe21a('0x36')]=_['keys'](_0x3f6582[_0xe21a('0x36')]);_0x106e14['filters']=_[_0xe21a('0x3a')](_0x106e14[_0xe21a('0x38')],_0x106e14[_0xe21a('0x36')]);_0xb2bf5b[_0xe21a('0x39')]=_[_0xe21a('0x3a')](_0x106e14[_0xe21a('0x38')],qs['fields'](_0x3f6582[_0xe21a('0x36')][_0xe21a('0x3b')]));_0xb2bf5b[_0xe21a('0x39')]=_0xb2bf5b[_0xe21a('0x39')][_0xe21a('0x3c')]?_0xb2bf5b[_0xe21a('0x39')]:_0x106e14[_0xe21a('0x38')];if(_0x3f6582['query'][_0xe21a('0x45')]){_0xb2bf5b['include']=[{'all':!![]}];}_0xb2bf5b=_[_0xe21a('0x43')]({},_0xb2bf5b,_0x3f6582[_0xe21a('0x44')]);return db[_0xe21a('0x31')][_0xe21a('0x4b')](_0xb2bf5b)['then'](handleEntityNotFound(_0x362dfb,null))[_0xe21a('0x2a')](respondWithResult(_0x362dfb,null))[_0xe21a('0x48')](handleError(_0x362dfb,null));};exports[_0xe21a('0x4c')]=function(_0x20c5f1,_0x172168){return db[_0xe21a('0x31')]['create'](_0x20c5f1[_0xe21a('0x4d')],{})[_0xe21a('0x2a')](respondWithResult(_0x172168,0xc9))[_0xe21a('0x48')](handleError(_0x172168,null));};exports[_0xe21a('0x29')]=function(_0x49f427,_0xbfe4a1){if(_0x49f427[_0xe21a('0x4d')]['id']){delete _0x49f427[_0xe21a('0x4d')]['id'];}return db[_0xe21a('0x31')][_0xe21a('0x4b')]({'where':{'id':_0x49f427[_0xe21a('0x49')]['id']}})[_0xe21a('0x2a')](handleEntityNotFound(_0xbfe4a1,null))['then'](saveUpdates(_0x49f427[_0xe21a('0x4d')],null))[_0xe21a('0x2a')](respondWithResult(_0xbfe4a1,null))['catch'](handleError(_0xbfe4a1,null));};exports[_0xe21a('0x4e')]=function(_0x1054d2,_0x2678b1){return db[_0xe21a('0x31')]['find']({'where':{'id':_0x1054d2[_0xe21a('0x49')]['id']}})[_0xe21a('0x2a')](handleEntityNotFound(_0x2678b1,null))[_0xe21a('0x2a')](removeEntity(_0x2678b1,null))[_0xe21a('0x48')](handleError(_0x2678b1,null));};exports[_0xe21a('0x4f')]=function(_0x2e51f1,_0x4c0a96){return db[_0xe21a('0x31')]['describe']()[_0xe21a('0x2a')](respondWithResult(_0x4c0a96,null))[_0xe21a('0x48')](handleError(_0x4c0a96,null));};exports[_0xe21a('0x50')]=function(_0x312b6b,_0x475f4a,_0x595f1a){return db[_0xe21a('0x51')]['count']({'where':{'ChatGroupId':_0x312b6b[_0xe21a('0x49')]['id'],'ToId':_0x312b6b[_0xe21a('0x52')]['id'],'read':![]}})['then'](function(_0x1c91bb){return{'id':_[_0xe21a('0x53')](_0x312b6b[_0xe21a('0x49')]['id']),'count':_0x1c91bb};})[_0xe21a('0x2a')](respondWithResult(_0x475f4a,null))[_0xe21a('0x48')](handleError(_0x475f4a,null));};exports['addMembers']=function(_0x5ea347,_0x5b9444,_0x3f5516){return db[_0xe21a('0x31')][_0xe21a('0x4b')]({'where':{'id':_0x5ea347[_0xe21a('0x49')]['id']}})[_0xe21a('0x2a')](handleEntityNotFound(_0x5b9444,null))[_0xe21a('0x2a')](function(_0x5be32e){if(_0x5be32e){return _0x5be32e['addMembers'](_0x5ea347[_0xe21a('0x4d')][_0xe21a('0x54')],_[_0xe21a('0x55')](_0x5ea347[_0xe21a('0x4d')],['ids','id'])||{});}})[_0xe21a('0x2a')](respondWithResult(_0x5b9444,null))[_0xe21a('0x48')](handleError(_0x5b9444,null));};exports['getMembers']=function(_0x5bd832,_0x43399b,_0x5d1cc6){var _0x5cbfcb={};var _0x38c776={};var _0x502b22;var _0x2c7e01;return db[_0xe21a('0x31')][_0xe21a('0x56')]({'where':{'id':_0x5bd832[_0xe21a('0x49')]['id']}})[_0xe21a('0x2a')](handleEntityNotFound(_0x43399b,null))[_0xe21a('0x2a')](function(_0x256353){if(_0x256353){_0x502b22=_0x256353;_0x38c776[_0xe21a('0x38')]=_[_0xe21a('0x4a')](db[_0xe21a('0x57')]['rawAttributes']);_0x38c776['query']=_['keys'](_0x5bd832[_0xe21a('0x36')]);_0x38c776[_0xe21a('0x37')]=_[_0xe21a('0x3a')](_0x38c776[_0xe21a('0x38')],_0x38c776[_0xe21a('0x36')]);_0x5cbfcb['attributes']=_['intersection'](_0x38c776['model'],qs[_0xe21a('0x3b')](_0x5bd832['query'][_0xe21a('0x3b')]));_0x5cbfcb[_0xe21a('0x39')]=_0x5cbfcb[_0xe21a('0x39')]['length']?_0x5cbfcb['attributes']:_0x38c776[_0xe21a('0x38')];_0x5cbfcb[_0xe21a('0x3f')]=qs[_0xe21a('0x40')](_0x5bd832[_0xe21a('0x36')]['sort']);_0x5cbfcb[_0xe21a('0x41')]=qs[_0xe21a('0x37')](_[_0xe21a('0x42')](_0x5bd832[_0xe21a('0x36')],_0x38c776[_0xe21a('0x37')]));if(_0x5bd832['query']['filter']){_0x5cbfcb[_0xe21a('0x41')]=_[_0xe21a('0x43')](_0x5cbfcb[_0xe21a('0x41')],{'$or':_[_0xe21a('0x35')](_0x5cbfcb[_0xe21a('0x39')],function(_0x21c635){var _0x2366f0={};_0x2366f0[_0x21c635]={'$like':'%'+_0x5bd832[_0xe21a('0x36')]['filter']+'%'};return _0x2366f0;})});}_0x5cbfcb=_['merge']({},_0x5cbfcb,_0x5bd832[_0xe21a('0x44')]);return _0x502b22[_0xe21a('0x58')](_0x5cbfcb);}})[_0xe21a('0x2a')](function(_0x31b553){if(_0x31b553){_0x2c7e01=_0x31b553['length'];if(!_0x5bd832[_0xe21a('0x36')][_0xe21a('0x3d')](_0xe21a('0x3e'))){_0x5cbfcb['limit']=qs[_0xe21a('0x24')](_0x5bd832['query']['limit']);_0x5cbfcb[_0xe21a('0x23')]=qs[_0xe21a('0x23')](_0x5bd832[_0xe21a('0x36')][_0xe21a('0x23')]);}return _0x502b22[_0xe21a('0x58')](_0x5cbfcb);}})[_0xe21a('0x2a')](function(_0x500001){if(_0x500001){return _0x500001?{'count':_0x2c7e01,'rows':_0x500001}:null;}})[_0xe21a('0x2a')](respondWithResult(_0x43399b,null))['catch'](handleError(_0x43399b,null));};exports[_0xe21a('0x59')]=function(_0xeef15,_0x22bc77,_0xbf07f9){return db[_0xe21a('0x31')]['find']({'where':{'id':_0xeef15[_0xe21a('0x49')]['id']}})[_0xe21a('0x2a')](handleEntityNotFound(_0x22bc77,null))[_0xe21a('0x2a')](function(_0x231404){if(_0x231404){return _0x231404['removeMembers'](_0xeef15[_0xe21a('0x36')]['ids']);}})[_0xe21a('0x2a')](respondWithStatusCode(_0x22bc77,null))[_0xe21a('0x48')](handleError(_0x22bc77,null));};exports[_0xe21a('0x5a')]=function(_0xfb39e5,_0x3c34a7,_0x255bf3){if(_0xfb39e5[_0xe21a('0x4d')]['id']){delete _0xfb39e5[_0xe21a('0x4d')]['id'];}return db[_0xe21a('0x31')]['find']({'where':{'id':_0xfb39e5[_0xe21a('0x49')]['id']}})[_0xe21a('0x2a')](handleEntityNotFound(_0x3c34a7,null))[_0xe21a('0x2a')](function(_0x48deec){if(_0x48deec){_0xfb39e5[_0xe21a('0x4d')][_0xe21a('0x5b')]=_0x48deec['id'];return db['ChatInternalMessage'][_0xe21a('0x4c')](_0xfb39e5[_0xe21a('0x4d')]);}})[_0xe21a('0x2a')](respondWithResult(_0x3c34a7,null))[_0xe21a('0x48')](handleError(_0x3c34a7,null));};exports[_0xe21a('0x5c')]=function(_0x3cc21b,_0x1dec42,_0x19c80d){var _0x336497={};var _0x5f12ca={};var _0x430e63;var _0xcc6507;return db['ChatGroup'][_0xe21a('0x56')]({'where':{'id':_0x3cc21b['params']['id']}})['then'](handleEntityNotFound(_0x1dec42,null))['then'](function(_0x25decd){if(_0x25decd){_0x430e63=_0x25decd;_0x5f12ca['model']=_[_0xe21a('0x4a')](db[_0xe21a('0x51')][_0xe21a('0x32')]);_0x5f12ca['query']=_['keys'](_0x3cc21b['query']);_0x5f12ca['filters']=_[_0xe21a('0x3a')](_0x5f12ca[_0xe21a('0x38')],_0x5f12ca[_0xe21a('0x36')]);_0x336497[_0xe21a('0x39')]=_[_0xe21a('0x3a')](_0x5f12ca[_0xe21a('0x38')],qs[_0xe21a('0x3b')](_0x3cc21b[_0xe21a('0x36')][_0xe21a('0x3b')]));_0x336497[_0xe21a('0x39')]=_0x336497[_0xe21a('0x39')][_0xe21a('0x3c')]?_0x336497[_0xe21a('0x39')]:_0x5f12ca['model'];_0x336497[_0xe21a('0x3f')]=qs[_0xe21a('0x40')](_0x3cc21b['query'][_0xe21a('0x40')]);_0x336497['where']=qs[_0xe21a('0x37')](_[_0xe21a('0x42')](_0x3cc21b[_0xe21a('0x36')],_0x5f12ca[_0xe21a('0x37')]));if(_0x3cc21b[_0xe21a('0x36')][_0xe21a('0x5d')]){_0x336497['where']=_[_0xe21a('0x43')](_0x336497['where'],{'$or':_[_0xe21a('0x35')](_0x336497[_0xe21a('0x39')],function(_0x2daed6){var _0x402aff={};_0x402aff[_0x2daed6]={'$like':'%'+_0x3cc21b['query']['filter']+'%'};return _0x402aff;})});}if(_0x3cc21b['query'][_0xe21a('0x5e')]){var _0x36905a=_0x3cc21b[_0xe21a('0x36')][_0xe21a('0x5e')]['split'](',');var _0x3726af={};_0x3726af[_0x36905a[0x0]]={'$gte':moment(_0x36905a[0x1])[_0xe21a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x336497[_0xe21a('0x41')]=_[_0xe21a('0x43')](_0x336497[_0xe21a('0x41')],_0x3726af);}_0x336497=_[_0xe21a('0x43')]({},_0x336497,_0x3cc21b['options']);return _0x430e63[_0xe21a('0x5c')](_0x336497);}})[_0xe21a('0x2a')](function(_0x217d18){if(_0x217d18){_0xcc6507=_0x217d18[_0xe21a('0x3c')];if(!_0x3cc21b['query'][_0xe21a('0x3d')](_0xe21a('0x3e'))){_0x336497['limit']=qs[_0xe21a('0x24')](_0x3cc21b[_0xe21a('0x36')][_0xe21a('0x24')]);_0x336497['offset']=qs[_0xe21a('0x23')](_0x3cc21b[_0xe21a('0x36')][_0xe21a('0x23')]);}return _0x430e63[_0xe21a('0x5c')](_0x336497);}})[_0xe21a('0x2a')](function(_0x49c46e){if(_0x49c46e){return _0x49c46e?{'count':_0xcc6507,'rows':_0x49c46e}:null;}})[_0xe21a('0x2a')](respondWithResult(_0x1dec42,null))['catch'](handleError(_0x1dec42,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 15d71f2..25ff2ef 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 _0x8cad=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x3b8bde,_0x75252){var _0x17c714=function(_0x567c17){while(--_0x567c17){_0x3b8bde['push'](_0x3b8bde['shift']());}};_0x17c714(++_0x75252);}(_0x8cad,0xfe));var _0xd8ca=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x8cad[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require(_0xd8ca('0x0'));var ChatGroup=require(_0xd8ca('0x1'))['db'][_0xd8ca('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd8ca('0x3')](0x0);var events={'afterCreate':_0xd8ca('0x4'),'afterUpdate':_0xd8ca('0x5'),'afterDestroy':_0xd8ca('0x6')};function emitEvent(_0x10c3c8){return function(_0x1334ec,_0x1e29ce,_0x388aeb){ChatGroupEvents[_0xd8ca('0x7')](_0x10c3c8+':'+_0x1334ec['id'],_0x1334ec);ChatGroupEvents[_0xd8ca('0x7')](_0x10c3c8,_0x1334ec);_0x388aeb(null);};}for(var e in events){if(events[_0xd8ca('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xd8ca('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xd6f9=['remove','emit','hasOwnProperty','events','../../mysqldb','save','update'];(function(_0x4ba33d,_0x4c5912){var _0x3c2436=function(_0x2a0658){while(--_0x2a0658){_0x4ba33d['push'](_0x4ba33d['shift']());}};_0x3c2436(++_0x4c5912);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xd6f9[_0x26da89];return _0xc95b7b;};'use strict';var EventEmitter=require(_0x9d6f('0x0'));var ChatGroup=require(_0x9d6f('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9d6f('0x2'),'afterUpdate':_0x9d6f('0x3'),'afterDestroy':_0x9d6f('0x4')};function emitEvent(_0x1a8463){return function(_0x5d8c7f,_0x1c2057,_0x39810d){ChatGroupEvents[_0x9d6f('0x5')](_0x1a8463+':'+_0x5d8c7f['id'],_0x5d8c7f);ChatGroupEvents['emit'](_0x1a8463,_0x5d8c7f);_0x39810d(null);};}for(var e in events){if(events[_0x9d6f('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 256d125..eadbd3f 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 _0xf5bb=['../../config/logger','bluebird','request-promise','rimraf','exports','chat_groups','lodash','util'];(function(_0x3e15f4,_0x2d29a1){var _0x3bb93d=function(_0x396c8b){while(--_0x396c8b){_0x3e15f4['push'](_0x3e15f4['shift']());}};_0x3bb93d(++_0x2d29a1);}(_0xf5bb,0x6e));var _0xbf5b=function(_0x14d82f,_0x59df29){_0x14d82f=_0x14d82f-0x0;var _0x133722=_0xf5bb[_0x14d82f];return _0x133722;};'use strict';var _=require(_0xbf5b('0x0'));var util=require(_0xbf5b('0x1'));var logger=require(_0xbf5b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbf5b('0x3'));var rp=require(_0xbf5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf5b('0x5'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xbf5b('0x6')]=function(_0x4322e1,_0xd9e96a){return _0x4322e1['define']('ChatGroup',attributes,{'tableName':_0xbf5b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadbb=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash'];(function(_0x48d933,_0x4eaabe){var _0x4caf07=function(_0x403c1f){while(--_0x403c1f){_0x48d933['push'](_0x48d933['shift']());}};_0x4caf07(++_0x4eaabe);}(_0xadbb,0xc2));var _0xbadb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xadbb[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xbadb('0x0'));var util=require(_0xbadb('0x1'));var logger=require(_0xbadb('0x2'))(_0xbadb('0x3'));var moment=require('moment');var BPromise=require(_0xbadb('0x4'));var rp=require(_0xbadb('0x5'));var fs=require('fs');var path=require(_0xbadb('0x6'));var rimraf=require(_0xbadb('0x7'));var config=require(_0xbadb('0x8'));var attributes=require(_0xbadb('0x9'));module[_0xbadb('0xa')]=function(_0x2c00aa,_0x33c9b2){return _0x2c00aa[_0xbadb('0xb')](_0xbadb('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 07288c9..6e5d627 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 _0x57d4=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./chatGroup.socket','register','request','then','info'];(function(_0x34a717,_0x2c828c){var _0x4cf768=function(_0x4db333){while(--_0x4db333){_0x34a717['push'](_0x34a717['shift']());}};_0x4cf768(++_0x2c828c);}(_0x57d4,0x78));var _0x457d=function(_0x5204b2,_0x4a531a){_0x5204b2=_0x5204b2-0x0;var _0x8b129c=_0x57d4[_0x5204b2];return _0x8b129c;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var moment=require('moment');var BPromise=require(_0x457d('0x2'));var rs=require(_0x457d('0x3'));var fs=require('fs');var Redis=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];var utils=require(_0x457d('0x6'));var logger=require(_0x457d('0x7'))(_0x457d('0x8'));var config=require(_0x457d('0x9'));var jayson=require(_0x457d('0xa'));var client=jayson[_0x457d('0xb')][_0x457d('0xc')]({'port':0x232a});config['redis']=_[_0x457d('0xd')](config[_0x457d('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x457d('0xe')]));require(_0x457d('0xf'))[_0x457d('0x10')](socket);function respondWithRpcPromise(_0x559024,_0x5bc628,_0x568a59){return new BPromise(function(_0x2214e6,_0x38ec93){return client[_0x457d('0x11')](_0x559024,_0x568a59)[_0x457d('0x12')](function(_0x25ae31){logger[_0x457d('0x13')](_0x457d('0x14'),_0x5bc628,_0x457d('0x15'));logger[_0x457d('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5bc628,_0x457d('0x15'),JSON[_0x457d('0x17')](_0x25ae31));if(_0x25ae31['error']){if(_0x25ae31['error'][_0x457d('0x18')]===0x1f4){logger[_0x457d('0x19')](_0x457d('0x14'),_0x5bc628,_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);return _0x38ec93(_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);}logger[_0x457d('0x19')]('ChatGroup,\x20%s,\x20%s',_0x5bc628,_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);return _0x2214e6(_0x25ae31[_0x457d('0x19')]['message']);}else{logger['info'](_0x457d('0x14'),_0x5bc628,'request\x20sent');_0x2214e6(_0x25ae31[_0x457d('0x1b')][_0x457d('0x1a')]);}})['catch'](function(_0x2a22b6){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5bc628,_0x2a22b6);_0x38ec93(_0x2a22b6);});});} \ No newline at end of file +var _0xcdd0=['./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','info','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x3dc258,_0x4c1713){var _0x5a089d=function(_0x41f414){while(--_0x41f414){_0x3dc258['push'](_0x3dc258['shift']());}};_0x5a089d(++_0x4c1713);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xcdd0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var moment=require(_0x0cdd('0x2'));var BPromise=require(_0x0cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cdd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0cdd('0x5'))('rpc');var config=require(_0x0cdd('0x6'));var jayson=require(_0x0cdd('0x7'));var client=jayson[_0x0cdd('0x8')]['http']({'port':0x232a});config[_0x0cdd('0x9')]=_[_0x0cdd('0xa')](config[_0x0cdd('0x9')],{'host':_0x0cdd('0xb'),'port':0x18eb});var socket=require(_0x0cdd('0xc'))(new Redis(config[_0x0cdd('0x9')]));require(_0x0cdd('0xd'))[_0x0cdd('0xe')](socket);function respondWithRpcPromise(_0x1708e2,_0x25f1fb,_0x2e2187){return new BPromise(function(_0x246486,_0xe81d8c){return client['request'](_0x1708e2,_0x2e2187)[_0x0cdd('0xf')](function(_0x359813){logger['info'](_0x0cdd('0x10'),_0x25f1fb,_0x0cdd('0x11'));logger['debug'](_0x0cdd('0x12'),_0x25f1fb,'request\x20sent',JSON[_0x0cdd('0x13')](_0x359813));if(_0x359813[_0x0cdd('0x14')]){if(_0x359813['error']['code']===0x1f4){logger[_0x0cdd('0x14')]('ChatGroup,\x20%s,\x20%s',_0x25f1fb,_0x359813['error']['message']);return _0xe81d8c(_0x359813[_0x0cdd('0x14')]['message']);}logger[_0x0cdd('0x14')](_0x0cdd('0x10'),_0x25f1fb,_0x359813[_0x0cdd('0x14')]['message']);return _0x246486(_0x359813[_0x0cdd('0x14')]['message']);}else{logger[_0x0cdd('0x15')](_0x0cdd('0x10'),_0x25f1fb,_0x0cdd('0x11'));_0x246486(_0x359813['result']['message']);}})[_0x0cdd('0x16')](function(_0x534b8f){logger[_0x0cdd('0x14')](_0x0cdd('0x10'),_0x25f1fb,_0x534b8f);_0xe81d8c(_0x534b8f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1d03d43..4b0429f 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 _0x19dd=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x4ca4ba,_0x155385){var _0x1cf44d=function(_0x25f438){while(--_0x25f438){_0x4ca4ba['push'](_0x4ca4ba['shift']());}};_0x1cf44d(++_0x155385);}(_0x19dd,0xed));var _0xd19d=function(_0x4c108a,_0x446e7d){_0x4c108a=_0x4c108a-0x0;var _0x402892=_0x19dd[_0x4c108a];return _0x402892;};'use strict';var ChatGroupEvents=require(_0xd19d('0x0'));var events=[_0xd19d('0x1'),'remove',_0xd19d('0x2')];function createListener(_0xb4920c,_0x2c0c9f){return function(_0x1d6ecd){_0x2c0c9f[_0xd19d('0x3')](_0xb4920c,_0x1d6ecd);};}function removeListener(_0x255f24,_0x17767b){return function(){ChatGroupEvents[_0xd19d('0x4')](_0x255f24,_0x17767b);};}exports[_0xd19d('0x5')]=function(_0x49c6f1){for(var _0x528600=0x0,_0x16d31c=events[_0xd19d('0x6')];_0x528600<_0x16d31c;_0x528600++){var _0x4a8c63=events[_0x528600];var _0x47ad98=createListener(_0xd19d('0x7')+_0x4a8c63,_0x49c6f1);ChatGroupEvents['on'](_0x4a8c63,_0x47ad98);}}; \ No newline at end of file +var _0x9ebc=['emit','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x2cbc30,_0x225c44){var _0x118268=function(_0x21596f){while(--_0x21596f){_0x2cbc30['push'](_0x2cbc30['shift']());}};_0x118268(++_0x225c44);}(_0x9ebc,0x123));var _0xc9eb=function(_0x1b3d86,_0x4463fa){_0x1b3d86=_0x1b3d86-0x0;var _0x171257=_0x9ebc[_0x1b3d86];return _0x171257;};'use strict';var ChatGroupEvents=require(_0xc9eb('0x0'));var events=[_0xc9eb('0x1'),_0xc9eb('0x2'),'update'];function createListener(_0x310f95,_0x4357c9){return function(_0x58870e){_0x4357c9[_0xc9eb('0x3')](_0x310f95,_0x58870e);};}function removeListener(_0x384035,_0x5b58b5){return function(){ChatGroupEvents['removeListener'](_0x384035,_0x5b58b5);};}exports[_0xc9eb('0x4')]=function(_0xcf7236){for(var _0x2fb721=0x0,_0x48cb97=events[_0xc9eb('0x5')];_0x2fb721<_0x48cb97;_0x2fb721++){var _0x1f6ad0=events[_0x2fb721];var _0x5b3410=createListener(_0xc9eb('0x6')+_0x1f6ad0,_0xcf7236);ChatGroupEvents['on'](_0x1f6ad0,_0x5b3410);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 18a9199..991d0b2 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 _0x5a23=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','destroy','exports','multer'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5a23,0xdf));var _0x35a2=function(_0x1eb25d,_0x65835a){_0x1eb25d=_0x1eb25d-0x0;var _0x22348c=_0x5a23[_0x1eb25d];return _0x22348c;};'use strict';var multer=require(_0x35a2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x35a2('0x1'));var router=express[_0x35a2('0x2')]();var fs_extra=require(_0x35a2('0x3'));var auth=require(_0x35a2('0x4'));var interaction=require(_0x35a2('0x5'));var config=require('../../config/environment');var controller=require(_0x35a2('0x6'));router[_0x35a2('0x7')]('/',auth[_0x35a2('0x8')](),controller[_0x35a2('0x9')]);router[_0x35a2('0x7')](_0x35a2('0xa'),auth[_0x35a2('0x8')](),controller['describe']);router[_0x35a2('0x7')](_0x35a2('0xb'),auth['isAuthenticated'](),controller[_0x35a2('0xc')]);router[_0x35a2('0x7')](_0x35a2('0xd'),auth['isAuthenticated'](),controller[_0x35a2('0xe')]);router[_0x35a2('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x35a2('0xf')]);router[_0x35a2('0x7')](_0x35a2('0x10'),auth[_0x35a2('0x8')](),controller[_0x35a2('0x11')]);router[_0x35a2('0x12')]('/',auth['isAuthenticated'](),controller[_0x35a2('0x13')]);router[_0x35a2('0x12')](_0x35a2('0x14'),auth[_0x35a2('0x8')](),controller[_0x35a2('0x15')]);router[_0x35a2('0x12')](_0x35a2('0x10'),auth['isAuthenticated'](),controller[_0x35a2('0x16')]);router[_0x35a2('0x17')]('/:id',auth[_0x35a2('0x8')](),controller[_0x35a2('0x18')]);router[_0x35a2('0x19')](_0x35a2('0xb'),auth[_0x35a2('0x8')](),controller[_0x35a2('0x1a')]);router[_0x35a2('0x19')](_0x35a2('0x14'),auth[_0x35a2('0x8')](),controller['removeMembers']);module[_0x35a2('0x1b')]=router; \ No newline at end of file +var _0xc5d5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/messages','getMessages','post','create','addMembers','addMessage','put','delete','destroy','/:id/members','removeMembers','exports','multer','path','connect-timeout','express'];(function(_0x11c8a6,_0x42952e){var _0x4a1e3f=function(_0x264d01){while(--_0x264d01){_0x11c8a6['push'](_0x11c8a6['shift']());}};_0x4a1e3f(++_0x42952e);}(_0xc5d5,0x182));var _0x5c5d=function(_0x2a0d5a,_0x1f722e){_0x2a0d5a=_0x2a0d5a-0x0;var _0x752abb=_0xc5d5[_0x2a0d5a];return _0x752abb;};'use strict';var multer=require(_0x5c5d('0x0'));var util=require('util');var path=require(_0x5c5d('0x1'));var timeout=require(_0x5c5d('0x2'));var express=require(_0x5c5d('0x3'));var router=express['Router']();var fs_extra=require(_0x5c5d('0x4'));var auth=require(_0x5c5d('0x5'));var interaction=require(_0x5c5d('0x6'));var config=require(_0x5c5d('0x7'));var controller=require(_0x5c5d('0x8'));router['get']('/',auth[_0x5c5d('0x9')](),controller[_0x5c5d('0xa')]);router[_0x5c5d('0xb')](_0x5c5d('0xc'),auth[_0x5c5d('0x9')](),controller[_0x5c5d('0xd')]);router[_0x5c5d('0xb')](_0x5c5d('0xe'),auth['isAuthenticated'](),controller[_0x5c5d('0xf')]);router[_0x5c5d('0xb')](_0x5c5d('0x10'),auth[_0x5c5d('0x9')](),controller[_0x5c5d('0x11')]);router[_0x5c5d('0xb')]('/:id/members',auth[_0x5c5d('0x9')](),controller['getMembers']);router['get'](_0x5c5d('0x12'),auth[_0x5c5d('0x9')](),controller[_0x5c5d('0x13')]);router[_0x5c5d('0x14')]('/',auth['isAuthenticated'](),controller[_0x5c5d('0x15')]);router[_0x5c5d('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0x5c5d('0x16')]);router[_0x5c5d('0x14')](_0x5c5d('0x12'),auth[_0x5c5d('0x9')](),controller[_0x5c5d('0x17')]);router[_0x5c5d('0x18')](_0x5c5d('0xe'),auth[_0x5c5d('0x9')](),controller['update']);router[_0x5c5d('0x19')](_0x5c5d('0xe'),auth[_0x5c5d('0x9')](),controller[_0x5c5d('0x1a')]);router[_0x5c5d('0x19')](_0x5c5d('0x1b'),auth[_0x5c5d('0x9')](),controller[_0x5c5d('0x1c')]);module[_0x5c5d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index db3ad88..658d345 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 _0xe511=['DATE','long','ENUM','out','sequelize','exports','INTEGER','star','thumb','TEXT','STRING'];(function(_0x275c8f,_0x316886){var _0x47519b=function(_0x576942){while(--_0x576942){_0x275c8f['push'](_0x275c8f['shift']());}};_0x47519b(++_0x316886);}(_0xe511,0x16f));var _0x1e51=function(_0x2a99f1,_0x198fd7){_0x2a99f1=_0x2a99f1-0x0;var _0x6948e5=_0xe511[_0x2a99f1];return _0x6948e5;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1e51('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x1e51('0x3'),_0x1e51('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1e51('0x5')]},'pathTranscript':{'type':Sequelize[_0x1e51('0x5')]},'mailTranscript':{'type':Sequelize[_0x1e51('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1e51('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1e51('0x6')]},'thirdDisposition':{'type':Sequelize[_0x1e51('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x1e51('0x6')]},'osName':{'type':Sequelize[_0x1e51('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1e51('0x6')]},'deviceType':{'type':Sequelize[_0x1e51('0x6')]},'referer':{'type':Sequelize[_0x1e51('0x5')]},'customerIp':{'type':Sequelize[_0x1e51('0x6')]},'formData':{'type':Sequelize[_0x1e51('0x5')](_0x1e51('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x1e51('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1e51('0x9')]('in',_0x1e51('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1e51('0x6')]},'customerPort':{'type':Sequelize[_0x1e51('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x1e51('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x065e=['sequelize','ENUM','star','thumb','TEXT','STRING','long','DATE','BOOLEAN'];(function(_0x21c478,_0x5460f7){var _0x3a2e82=function(_0x1f8661){while(--_0x1f8661){_0x21c478['push'](_0x21c478['shift']());}};_0x3a2e82(++_0x5460f7);}(_0x065e,0x1a7));var _0xe065=function(_0x2ee935,_0x1f940c){_0x2ee935=_0x2ee935-0x0;var _0x3c960e=_0x065e[_0x2ee935];return _0x3c960e;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xe065('0x1')](_0xe065('0x2'),_0xe065('0x3')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xe065('0x4')]},'mailTranscript':{'type':Sequelize[_0xe065('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe065('0x5')]},'secondDisposition':{'type':Sequelize[_0xe065('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe065('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xe065('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xe065('0x5')]},'osVersion':{'type':Sequelize[_0xe065('0x5')]},'deviceModel':{'type':Sequelize[_0xe065('0x5')]},'deviceVendor':{'type':Sequelize[_0xe065('0x5')]},'deviceType':{'type':Sequelize[_0xe065('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xe065('0x5')]},'formData':{'type':Sequelize[_0xe065('0x4')](_0xe065('0x6'))},'read1stAt':{'type':Sequelize[_0xe065('0x7')]},'lastMsgAt':{'type':Sequelize[_0xe065('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xe065('0x1')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xe065('0x5')]},'vidaooSessionId':{'type':Sequelize[_0xe065('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xe065('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index fe09c43..a60bc37 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 _0x55e0=['nolimit','order','sort','where','select','field','color','tools_tags','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','from','chat_interactions','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','rows','catch','show','params','includeAll','include','options','create','describe','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','follow','isNull','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','ContactId','%s%d','System','customer','format','Visitor','agentIdentifier','agentAlias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','pick','secret','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','Account','Owner','mkdirSync','Chat','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','createWriteStream','out','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','util','path','ejs','lodash','squel','ioredis','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','name','render','merge','body','contact','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','index','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0x475516,_0x1a8b71){var _0x2732f2=function(_0x5ab274){while(--_0x5ab274){_0x475516['push'](_0x475516['shift']());}};_0x2732f2(++_0x1a8b71);}(_0x55e0,0xdc));var _0x055e=function(_0x3e29bf,_0xc3b103){_0x3e29bf=_0x3e29bf-0x0;var _0x2c1601=_0x55e0[_0x3e29bf];return _0x2c1601;};'use strict';var rimraf=require(_0x055e('0x0'));var zipdir=require(_0x055e('0x1'));var rp=require(_0x055e('0x2'));var moment=require(_0x055e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x055e('0x4'));var path=require(_0x055e('0x5'));var ejs=require(_0x055e('0x6'));var fs=require('fs');var _=require(_0x055e('0x7'));var squel=require(_0x055e('0x8'));var Redis=require(_0x055e('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x055e('0xa'));var logger=require('../../config/logger')(_0x055e('0xb'));var config=require(_0x055e('0xc'));var db=require(_0x055e('0xd'))['db'];config[_0x055e('0xe')]=_[_0x055e('0xf')](config['redis'],{'host':_0x055e('0x10'),'port':0x18eb});var socket=require(_0x055e('0x11'))(new Redis(config[_0x055e('0xe')]));require(_0x055e('0x12'))[_0x055e('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x055e('0x14')]({'port':0x232b});var client9004=jayson['client'][_0x055e('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x466da3,_0x72d424,_0x101bc3,_0xc98c6a){return new BPromise(function(_0x31c649,_0x236a2b){var _0x4bca5d=_0xc98c6a||client;return _0x4bca5d[_0x055e('0x15')](_0x466da3,_0x101bc3)[_0x055e('0x16')](function(_0x3cfd14){logger[_0x055e('0x17')](_0x055e('0x18'),_0x72d424,'request\x20sent');logger[_0x055e('0x19')](_0x055e('0x1a'),_0x72d424,_0x055e('0x1b'),JSON['stringify'](_0x3cfd14));if(_0x3cfd14[_0x055e('0x1c')]){if(_0x3cfd14[_0x055e('0x1c')][_0x055e('0x1d')]===0x1f4){logger[_0x055e('0x1c')](_0x055e('0x18'),_0x72d424,_0x3cfd14['error'][_0x055e('0x1e')]);return _0x236a2b(_0x3cfd14[_0x055e('0x1c')][_0x055e('0x1e')]);}logger[_0x055e('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x72d424,_0x3cfd14[_0x055e('0x1c')][_0x055e('0x1e')]);return _0x31c649(_0x3cfd14['error'][_0x055e('0x1e')]);}else{logger[_0x055e('0x17')](_0x055e('0x18'),_0x72d424,_0x055e('0x1b'));_0x31c649(_0x3cfd14[_0x055e('0x1f')][_0x055e('0x1e')]);}})['catch'](function(_0x31c355){logger[_0x055e('0x1c')](_0x055e('0x18'),_0x72d424,_0x31c355);_0x236a2b(_0x31c355);});});}function respondWithStatusCode(_0x5930ff,_0x3f444a){_0x3f444a=_0x3f444a||0xcc;return function(_0x2da6b){if(_0x2da6b){return _0x5930ff[_0x055e('0x20')](_0x3f444a);}return _0x5930ff[_0x055e('0x21')](_0x3f444a)['end']();};}function respondWithResult(_0x71a6e1,_0x56c372){_0x56c372=_0x56c372||0xc8;return function(_0x33ffdf){if(_0x33ffdf){return _0x71a6e1[_0x055e('0x21')](_0x56c372)[_0x055e('0x22')](_0x33ffdf);}};}function respondWithFilteredResult(_0x1a76c6,_0x40c62a){return function(_0x4c653c){if(_0x4c653c){var _0x58caf9=typeof _0x40c62a[_0x055e('0x23')]===_0x055e('0x24')&&typeof _0x40c62a[_0x055e('0x25')]==='undefined';var _0x408e38=_0x4c653c[_0x055e('0x26')];var _0x42f2df=_0x58caf9?0x0:_0x40c62a[_0x055e('0x23')];var _0x59539d=_0x58caf9?_0x4c653c[_0x055e('0x26')]:_0x40c62a['offset']+_0x40c62a[_0x055e('0x25')];var _0x35def0;if(_0x59539d>=_0x408e38){_0x59539d=_0x408e38;_0x35def0=0xc8;}else{_0x35def0=0xce;}_0x1a76c6[_0x055e('0x21')](_0x35def0);return _0x1a76c6[_0x055e('0x27')](_0x055e('0x28'),_0x42f2df+'-'+_0x59539d+'/'+_0x408e38)['json'](_0x4c653c);}return null;};}function saveUpdates(_0x99a372){return function(_0x453e5e){if(_0x453e5e){return _0x453e5e[_0x055e('0x29')](_0x99a372)[_0x055e('0x16')](function(_0x36abb2){return _0x36abb2;});}return null;};}function removeEntity(_0x225c88){return function(_0x59f8c4){if(_0x59f8c4){return _0x59f8c4[_0x055e('0x2a')]()['then'](function(){_0x225c88[_0x055e('0x21')](0xcc)[_0x055e('0x2b')]();});}};}function handleEntityNotFound(_0x5cfeea){return function(_0xd9298d){if(!_0xd9298d){_0x5cfeea[_0x055e('0x20')](0x194);}return _0xd9298d;};}function handleError(_0x524344,_0x20717b){_0x20717b=_0x20717b||0x1f4;return function(_0x23c611){logger[_0x055e('0x1c')](_0x23c611['stack']);if(_0x23c611['name']){delete _0x23c611[_0x055e('0x2c')];}_0x524344['status'](_0x20717b)['send'](_0x23c611);};}function getMustacheRender(_0x55a1ee,_0x31ee60){return Mustache[_0x055e('0x2d')](_0x55a1ee,_[_0x055e('0x2e')](_0x31ee60[_0x055e('0x2f')],{'contact':_0x31ee60[_0x055e('0x30')],'message':_0x31ee60[_0x055e('0x1e')],'agent':_0x31ee60[_0x055e('0x31')],'interaction':_0x31ee60[_0x055e('0x32')],'account':_0x31ee60[_0x055e('0x33')]}))||'';}function getInteractionUsers(_0x2f60fa,_0x2f839c){return new BPromise(function(_0x263a81,_0x54539e){try{if(_0x2f839c[_0x2f60fa['id']]){_0x2f60fa['Users']=_[_0x055e('0x34')](_0x2f839c[_0x2f60fa['id']],function(_0x47790a){return{'id':_0x47790a['id'],'fullname':_0x47790a[_0x055e('0x35')]};});}}catch(_0xf3abf6){_0x54539e(_0xf3abf6);}_0x263a81(_0x2f60fa);});}function getInteractionTags(_0x34d5f2,_0x21aaad){return new BPromise(function(_0xb08e29,_0x4f24f8){try{if(_0x34d5f2[_0x055e('0x36')]){_0x34d5f2[_0x055e('0x37')]=[];_0x34d5f2[_0x055e('0x36')][_0x055e('0x38')](',')[_0x055e('0x39')](function(_0x585b8a){_0x34d5f2[_0x055e('0x37')][_0x055e('0x3a')](_0x21aaad[_0x585b8a]);});}delete _0x34d5f2['TagIds'];}catch(_0x39ecd7){_0x4f24f8(_0x39ecd7);}_0xb08e29(_0x34d5f2);});}function updateChatInteraction(_0x1a109f,_0x4a97ab,_0x99688b){return new BPromise(function(_0x2d7815,_0x4e424b){return getInteractionUsers(_0x1a109f,_0x99688b)[_0x055e('0x16')](function(_0x233423){return getInteractionTags(_0x233423,_0x4a97ab);})['then'](function(_0x1012a4){return getStateInteraction(_0x1012a4);})[_0x055e('0x16')](function(_0x1478c2){_0x2d7815(_0x1478c2);})['catch'](function(_0x1715ed){_0x4e424b(_0x1715ed);});});}function getStateInteraction(_0x1dd07b){return new BPromise(function(_0x574ea0){_0x1dd07b[_0x055e('0x3b')]=0x0;_0x1dd07b[_0x055e('0x3c')]=0x0;_0x1dd07b[_0x055e('0x3d')]=0x0;_0x1dd07b['unmanaged']=0x0;_0x1dd07b[_0x055e('0x3e')]=0x0;_0x1dd07b[_0x055e('0x3f')]=0x0;if(!_0x1dd07b[_0x055e('0x40')]&&!_0x1dd07b['UserId']){_0x1dd07b['waiting']+=0x1;}if(!_0x1dd07b[_0x055e('0x40')]&&_0x1dd07b[_0x055e('0x41')]){_0x1dd07b['talking']+=0x1;if(_0x1dd07b[_0x055e('0x3b')]){_0x1dd07b['waiting']-=0x1;}}if(_0x1dd07b[_0x055e('0x40')]&&_0x1dd07b['disposition']===_0x055e('0x3e')){_0x1dd07b[_0x055e('0x3e')]+=0x1;if(_0x1dd07b[_0x055e('0x3b')]){_0x1dd07b['waiting']-=0x1;}}else if(_0x1dd07b['closed']&&!_0x1dd07b[_0x055e('0x41')]&&_0x1dd07b[_0x055e('0x42')]){_0x1dd07b[_0x055e('0x43')]+=0x1;if(_0x1dd07b[_0x055e('0x3b')]){_0x1dd07b['waiting']-=0x1;}}else if(_0x1dd07b['closed']&&_0x1dd07b[_0x055e('0x41')]){_0x1dd07b[_0x055e('0x3d')]+=0x1;if(_0x1dd07b['talking']){_0x1dd07b[_0x055e('0x3c')]-=0x1;}}_0x1dd07b[_0x055e('0x3f')]+=0x1;_0x574ea0(_0x1dd07b);});}exports[_0x055e('0x44')]=function(_0x20eb76,_0x19e29c){var _0x1f3c73={},_0x479f4e={},_0x297edd={'count':0x0,'rows':[]};var _0x118a0e=_['map'](db[_0x055e('0x45')][_0x055e('0x46')],function(_0x341c46){return{'name':_0x341c46[_0x055e('0x47')],'type':_0x341c46[_0x055e('0x48')][_0x055e('0x49')]};});_0x479f4e[_0x055e('0x4a')]=_['map'](_0x118a0e,_0x055e('0x2c'));_0x479f4e['query']=_[_0x055e('0x4b')](_0x20eb76[_0x055e('0x4c')]);_0x479f4e[_0x055e('0x4d')]=_['intersection'](_0x479f4e['model'],_0x479f4e[_0x055e('0x4c')]);_0x1f3c73[_0x055e('0x4e')]=_[_0x055e('0x4f')](_0x479f4e[_0x055e('0x4a')],qs[_0x055e('0x50')](_0x20eb76[_0x055e('0x4c')][_0x055e('0x50')]));_0x1f3c73[_0x055e('0x4e')]=_0x1f3c73[_0x055e('0x4e')]['length']?_0x1f3c73[_0x055e('0x4e')]:_0x479f4e[_0x055e('0x4a')];if(!_0x20eb76[_0x055e('0x4c')][_0x055e('0x51')](_0x055e('0x52'))){_0x1f3c73['limit']=qs[_0x055e('0x25')](_0x20eb76[_0x055e('0x4c')][_0x055e('0x25')]);_0x1f3c73['offset']=qs[_0x055e('0x23')](_0x20eb76['query'][_0x055e('0x23')]);}_0x1f3c73[_0x055e('0x53')]=qs['sort'](_0x20eb76[_0x055e('0x4c')][_0x055e('0x54')]);_0x1f3c73[_0x055e('0x55')]=qs['filters'](_['pick'](_0x20eb76[_0x055e('0x4c')],_0x479f4e[_0x055e('0x4d')]),_0x118a0e);var _0x393717=[];var _0x248e5f=squel[_0x055e('0x56')]()[_0x055e('0x57')]('id')[_0x055e('0x57')](_0x055e('0x2c'))[_0x055e('0x57')](_0x055e('0x58'))['from'](_0x055e('0x59'));var _0x7f03ed=squel[_0x055e('0x56')]()[_0x055e('0x57')]('u.id')[_0x055e('0x57')](_0x055e('0x5a'))[_0x055e('0x57')](_0x055e('0x5b'))['from']('user_has_chat_interactions','ui')[_0x055e('0x5c')](_0x055e('0x5d'),'u',_0x055e('0x5e'));var _0x2fbb1c=squel[_0x055e('0x56')]()[_0x055e('0x5f')](_0x055e('0x60'),'i')[_0x055e('0x5c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x055e('0x5c')](_0x055e('0x5d'),'o','o.id\x20=\x20i.UserId')[_0x055e('0x5c')](_0x055e('0x61'),'a',_0x055e('0x62'))[_0x055e('0x5c')]('chat_messages','me',_0x055e('0x63'))[_0x055e('0x5c')](_0x055e('0x64'),'it',_0x055e('0x65'))[_0x055e('0x5c')](_0x055e('0x59'),'t',_0x055e('0x66'));var _0x31935b=squel['expr']();var _0x3cb600=[];var _0x23794c=squel['expr']();var _0x29b754;if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x67')]){_0x29b754=as[_0x055e('0x68')](_0x20eb76['query'][_0x055e('0x67')]);var _0x18b7f7=_0x29b754[_0x055e('0x69')];for(var _0x4deec3=0x0;_0x4deec3<_0x29b754[_0x055e('0x6a')][_0x055e('0x6b')];_0x4deec3++){var _0xf2c62d=_0x29b754[_0x055e('0x6a')][_0x4deec3];var _0xcc4661='i';var _0x584e60=_[_0x055e('0x6c')](_0x118a0e,[_0x055e('0x2c'),_0xf2c62d[_0x055e('0x57')]]);if(!_0x584e60){switch(_0xf2c62d[_0x055e('0x57')]){case _0x055e('0x6d'):if(_0xf2c62d['value']==0x1){_0x2fbb1c[_0x055e('0x6e')]('`'+_0xf2c62d[_0x055e('0x57')]+_0x055e('0x6f'));}else{_0x2fbb1c['having']('`'+_0xf2c62d[_0x055e('0x57')]+_0x055e('0x70'));}break;case _0x055e('0x71'):if(_0xf2c62d[_0x055e('0x72')]===_0x055e('0x73')){if(_0xf2c62d['value'][_0x055e('0x38')]('\x20')['length']>0x1){_0x31935b[_0x18b7f7](_0x055e('0x74'),qs[_0x055e('0x75')](_0xf2c62d['value']),null);}else{var _0x3137bb='%'+_0xf2c62d[_0x055e('0x76')]+'%';_0x31935b[_0x18b7f7](_0x055e('0x77'),_0x3137bb,_0x3137bb,_0x3137bb);}}else{_0x584e60=_[_0x055e('0x6c')](_0x118a0e,['name','ContactId']);_0xf2c62d[_0x055e('0x57')]='ContactId';_0x200ed2=as[_0x055e('0x78')](_0xcc4661,_0x584e60[_0x055e('0x48')],_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')][_0x055e('0x7a')],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);}break;case _0x055e('0x7b'):var _0x3de5f1=_0xf2c62d[_0x055e('0x76')]['split'](',')['map'](function(_0xb8b2a0){return Number(_0xb8b2a0);});_0x3de5f1[_0x055e('0x39')](function(_0x52a6e9){_0x23794c['or'](_0x055e('0x7c'),'%,'+_0x52a6e9+',%');});_0x3cb600=_['union'](_0x3cb600,_0x3de5f1);break;case _0x055e('0x7d'):if(_0xf2c62d[_0x055e('0x72')]===_0x055e('0x73')){_0x31935b[_0x18b7f7](_0x055e('0x7e'),'%'+_0xf2c62d[_0x055e('0x76')]+'%',null);}else{_0x584e60=_[_0x055e('0x6c')](_0x118a0e,[_0x055e('0x2c'),_0x055e('0x41')]);_0xf2c62d['field']=_0x055e('0x41');_0x200ed2=as[_0x055e('0x78')](_0xcc4661,_0x584e60[_0x055e('0x48')],_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')][_0x055e('0x7a')],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);}break;case _0x055e('0x2f'):_0x200ed2=as['buildExpression']('me',null,_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')]['start'],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);break;}}else{var _0x200ed2=as[_0x055e('0x78')](_0xcc4661,_0x584e60['type'],_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')][_0x055e('0x7a')],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);}}}else{var _0x525d4f=_(_0x20eb76[_0x055e('0x4c')])[_0x055e('0x4b')]()[_0x055e('0x34')](function(_0xe21a0e){return _['some'](_0x118a0e,[_0x055e('0x2c'),_0xe21a0e])?_0xe21a0e:undefined;})[_0x055e('0x7f')]()[_0x055e('0x76')]();if(!_[_0x055e('0x80')](_0x525d4f)){_0x525d4f[_0x055e('0x39')](function(_0x59e669){if(_0x59e669===_0x055e('0x81')){_0x2fbb1c[_0x055e('0x55')](_0x055e('0x82'),[][_0x055e('0x83')](_0x20eb76['query'][_0x59e669]));}else if(_0x59e669===_0x055e('0x84')){var _0x94e3e=JSON[_0x055e('0x85')](_0x20eb76[_0x055e('0x4c')][_0x59e669])['$gte'];var _0x22f4db=JSON[_0x055e('0x85')](_0x20eb76[_0x055e('0x4c')][_0x59e669])[_0x055e('0x86')];_0x2fbb1c[_0x055e('0x55')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x94e3e,_0x22f4db);}else{if(_0x20eb76[_0x055e('0x4c')][_0x59e669]===_0x055e('0x87')){_0x2fbb1c[_0x055e('0x55')]('i.'+_0x59e669+'\x20IS\x20NULL');}else{_0x2fbb1c['where']('i.'+_0x59e669+_0x055e('0x88'),_0x20eb76['query'][_0x59e669]);}}});}if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x89')]){if(_0x20eb76['query'][_0x055e('0x89')]==0x1){_0x2fbb1c[_0x055e('0x6e')](_0x055e('0x8a'));}else{_0x2fbb1c[_0x055e('0x6e')](_0x055e('0x8b'));}}if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')]){_0x3cb600=_[_0x055e('0x8d')](_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')])?_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')]:new Array(_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')]);_0x3cb600[_0x055e('0x39')](function(_0xba91c3){_0x23794c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xba91c3+',%');});}if(_0x20eb76[_0x055e('0x4c')]['filter']){var _0x5d2993=_0x20eb76[_0x055e('0x4c')][_0x055e('0x8e')][_0x055e('0x8f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x055e('0x90')](_0x5d2993)){_0x31935b['or'](_0x055e('0x91'),_0x5d2993+'%');}else{_0x31935b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x055e('0x75')](_0x5d2993))['or'](_0x055e('0x92'),_0x5d2993+'%');}}}_0x2fbb1c['where'](_0x31935b);_0x2fbb1c[_0x055e('0x93')]('i.id');var _0xc825b0={'type':db[_0x055e('0x94')][_0x055e('0x95')][_0x055e('0x96')],'raw':!![]};var _0x49db81=_0x2fbb1c['clone']();_0x49db81['field'](_0x055e('0x97'));_0x49db81['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x055e('0x6d'));if(_0x1f3c73['order']){_0x1f3c73[_0x055e('0x53')][_0x055e('0x39')](function(_0x15a107){var _0x1c3a1a=_0x15a107[0x0]==='contactName'?_0x15a107[0x0]:'i.'+_0x15a107[0x0];_0x2fbb1c['order'](_0x1c3a1a,_0x15a107[0x1]===_0x055e('0x98')?![]:!![]);});}if(!_[_0x055e('0x80')](_0x3cb600)){_0x2fbb1c[_0x055e('0x6e')](_0x23794c);_0x49db81[_0x055e('0x55')](_0x055e('0x99'),_0x3cb600);}BPromise[_0x055e('0x9a')]()[_0x055e('0x16')](function(){if(!_0x29b754){if(_0x20eb76['query'][_0x055e('0x81')])return;_0x49db81['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x2fbb1c[_0x055e('0x55')](_0x055e('0x9b'));return;}if(_0x20eb76[_0x055e('0x9c')]['role']!==_0x055e('0x31'))return;return _0x20eb76[_0x055e('0x9c')][_0x055e('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x785c9c){if(_[_0x055e('0x80')](_0x785c9c)){_0x49db81[_0x055e('0x55')](_0x055e('0x9e'));_0x2fbb1c[_0x055e('0x55')](_0x055e('0x9e'));}else{_0x49db81[_0x055e('0x55')](_0x055e('0x82'),_[_0x055e('0x34')](_0x785c9c,'id'));_0x2fbb1c[_0x055e('0x55')](_0x055e('0x82'),_[_0x055e('0x34')](_0x785c9c,'id'));}});})[_0x055e('0x16')](function(){if(_0x20eb76[_0x055e('0x9c')][_0x055e('0x9f')]===_0x055e('0x31')&&!_0x29b754&&!_0x20eb76['query'][_0x055e('0x81')])return[];return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x49db81['toString'](),_0xc825b0);})['then'](function(_0x4fd7e2){_0x297edd[_0x055e('0x26')]=_0x4fd7e2[_0x055e('0x6b')];if(_0x297edd[_0x055e('0x26')]===0x0)return[];return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x248e5f[_0x055e('0xa1')](),_0xc825b0)[_0x055e('0x16')](function(_0x2f9a0f){_0x393717=_['keyBy'](_0x2f9a0f,'id');_0xc825b0=_[_0x055e('0x2e')](_0xc825b0,{'model':db[_0x055e('0x45')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x50')]){_0x1f3c73[_0x055e('0x4e')][_0x055e('0x39')](function(_0x46e8f4){_0x2fbb1c[_0x055e('0x57')]('i.'+_0x46e8f4);});}else{_0x2fbb1c[_0x055e('0x57')](_0x055e('0xa2'),_0x055e('0x6d'));_0x2fbb1c[_0x055e('0x57')]('a.key','Account.key');_0x2fbb1c[_0x055e('0x57')](_0x055e('0xa3'),_0x055e('0xa4'));_0x2fbb1c['field'](_0x055e('0xa5'),_0x055e('0xa6'));_0x2fbb1c[_0x055e('0x57')]('i.*');_0x2fbb1c[_0x055e('0x57')]('c.firstName',_0x055e('0xa7'));_0x2fbb1c['field'](_0x055e('0xa8'),_0x055e('0xa9'));_0x2fbb1c['field']('c.email',_0x055e('0xaa'));_0x2fbb1c['field']('c.phone',_0x055e('0xab'));_0x2fbb1c[_0x055e('0x57')](_0x055e('0xac'),_0x055e('0xad'));_0x2fbb1c[_0x055e('0x57')]('c.fax',_0x055e('0xae'));_0x2fbb1c[_0x055e('0x57')]('o.fullname',_0x055e('0xaf'));_0x2fbb1c[_0x055e('0x57')](_0x055e('0xb0'),_0x055e('0xb1'));_0x2fbb1c[_0x055e('0x57')](_0x055e('0xb2'),_0x055e('0x36'));}if(_0x1f3c73[_0x055e('0x25')])_0x2fbb1c['limit'](_0x1f3c73[_0x055e('0x25')]);if(_0x1f3c73[_0x055e('0x23')])_0x2fbb1c[_0x055e('0x23')](_0x1f3c73[_0x055e('0x23')]);return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x2fbb1c[_0x055e('0xa1')](),_0xc825b0);})[_0x055e('0x16')](function(_0x21ae7c){if(_0x21ae7c[_0x055e('0x6b')]>0x0)_0x7f03ed[_0x055e('0x55')]('ui.ChatInteractionId\x20IN\x20?',_[_0x055e('0x34')](_0x21ae7c,'id'));return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x7f03ed['toString'](),_0xc825b0)['then'](function(_0x35e203){var _0x27b463=_[_0x055e('0xb3')](_0x35e203,_0x055e('0xb4'));var _0xe63e29=[];_0x21ae7c[_0x055e('0x39')](function(_0x505cc4){_0xe63e29[_0x055e('0x3a')](updateChatInteraction(_0x505cc4,_0x393717,_0x27b463));});return BPromise[_0x055e('0xb5')](_0xe63e29);});});})[_0x055e('0x16')](function(_0x324a3d){_0x297edd[_0x055e('0xb6')]=_0x324a3d;return _0x297edd;})[_0x055e('0x16')](respondWithFilteredResult(_0x19e29c,_0x1f3c73))[_0x055e('0xb7')](handleError(_0x19e29c,null));};exports[_0x055e('0xb8')]=function(_0x207f31,_0x4abd2e){var _0x58bf27={'raw':![],'where':{'id':_0x207f31[_0x055e('0xb9')]['id']}},_0x478da3={};_0x478da3[_0x055e('0x4a')]=_[_0x055e('0x4b')](db['ChatInteraction'][_0x055e('0x46')]);_0x478da3[_0x055e('0x4c')]=_[_0x055e('0x4b')](_0x207f31[_0x055e('0x4c')]);_0x478da3[_0x055e('0x4d')]=_[_0x055e('0x4f')](_0x478da3[_0x055e('0x4a')],_0x478da3[_0x055e('0x4c')]);_0x58bf27['attributes']=_[_0x055e('0x4f')](_0x478da3[_0x055e('0x4a')],qs['fields'](_0x207f31['query'][_0x055e('0x50')]));_0x58bf27[_0x055e('0x4e')]=_0x58bf27[_0x055e('0x4e')][_0x055e('0x6b')]?_0x58bf27['attributes']:_0x478da3['model'];if(_0x207f31[_0x055e('0x4c')][_0x055e('0xba')]){_0x58bf27[_0x055e('0xbb')]=[{'all':!![]}];}_0x58bf27=_[_0x055e('0x2e')]({},_0x58bf27,_0x207f31[_0x055e('0xbc')]);return db['ChatInteraction'][_0x055e('0x6c')](_0x58bf27)[_0x055e('0x16')](handleEntityNotFound(_0x4abd2e,null))['then'](respondWithResult(_0x4abd2e,null))[_0x055e('0xb7')](handleError(_0x4abd2e,null));};exports['create']=function(_0x495d7d,_0x47f131){return db[_0x055e('0x45')][_0x055e('0xbd')](_0x495d7d['body'],{})[_0x055e('0x16')](respondWithResult(_0x47f131,0xc9))[_0x055e('0xb7')](handleError(_0x47f131,null));};exports['update']=function(_0xae5b5a,_0x5dffc3){if(_0xae5b5a[_0x055e('0x2f')]['id']){delete _0xae5b5a['body']['id'];}return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0xae5b5a[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x5dffc3,null))['then'](saveUpdates(_0xae5b5a[_0x055e('0x2f')],null))[_0x055e('0x16')](respondWithResult(_0x5dffc3,null))['catch'](handleError(_0x5dffc3,null));};exports[_0x055e('0x2a')]=function(_0x116f84,_0x174a30){return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x116f84[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x174a30,null))[_0x055e('0x16')](removeEntity(_0x174a30,null))[_0x055e('0xb7')](handleError(_0x174a30,null));};exports[_0x055e('0xbe')]=function(_0x1bd652,_0x32bf47){return db[_0x055e('0x45')][_0x055e('0xbe')]()[_0x055e('0x16')](respondWithResult(_0x32bf47,null))[_0x055e('0xb7')](handleError(_0x32bf47,null));};exports['createVidaooSession']=function(_0x2d5bf8,_0x484ee0){var _0x204fef=_0x2d5bf8[_0x055e('0xb9')]['id'];var _0x5ca835;var _0xfb3b6d;var _0x5ee76f;return db[_0x055e('0x45')]['findOne']({'where':{'id':_0x204fef}})[_0x055e('0x16')](function(_0x127c91){_0x5ca835=_0x127c91;return db['ChatWebsite'][_0x055e('0xbf')]({'where':{'id':_0x127c91[_0x055e('0x81')]},'attributes':['id',_0x055e('0xc0'),'vidaooEscalation',_0x055e('0xc1'),_0x055e('0xc2'),_0x055e('0xc3')],'raw':!![]});})[_0x055e('0x16')](function(_0x9d0c0f){if(_0x9d0c0f&&_0x9d0c0f[_0x055e('0xc0')]&&_0x9d0c0f['vidaooEscalation']){_0xfb3b6d=_0x9d0c0f;var _0x41b2af={'interaction':{'id':_0x204fef},'agent':{'id':_0x2d5bf8['user']['id'],'name':_0x2d5bf8[_0x055e('0x9c')][_0x055e('0x2c')],'fullname':_0x2d5bf8['user']['fullname'],'email':_0x2d5bf8[_0x055e('0x9c')]['email']},'contact':_0x2d5bf8['body'][_0x055e('0x30')],'account':_0x2d5bf8['body'][_0x055e('0x33')]};var _0x51c37b={'rejectUnauthorized':![],'method':_0x055e('0xc4'),'url':_0x055e('0xc5'),'headers':{'X-APIKEY':_0x9d0c0f[_0x055e('0xc0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2d5bf8[_0x055e('0x9c')][_0x055e('0xc6')]],'buttons':null,'topic':_0xfb3b6d['vidaooTopic'],'note':_['isNull'](_0xfb3b6d[_0x055e('0xc2')])?null:getMustacheRender(_0xfb3b6d[_0x055e('0xc2')],_0x41b2af),'metadata':null},'redirect':_0x055e('0xc7'),'json':!![]};try{if(!_[_0x055e('0xc8')](_0xfb3b6d['vidaooMetadata'])){var _0x2b4096=getMustacheRender(_0xfb3b6d[_0x055e('0xc3')],_0x41b2af);var _0x5ed6a5=JSON[_0x055e('0x85')](_0x2b4096);_0x51c37b[_0x055e('0x2f')][_0x055e('0xc9')]=_0x5ed6a5;}}catch(_0x45a14b){throw new db[(_0x055e('0x94'))][(_0x055e('0xca'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x51c37b);}else{throw new db[(_0x055e('0x94'))][(_0x055e('0xca'))](_0x055e('0xcb'));}})['then'](function(_0x38a846){_0x5ee76f=_0x38a846;if(_0x5ee76f['id']){var _0x7d100={'body':_0x5ee76f[_0x055e('0xcc')],'ChatWebsiteId':_0xfb3b6d['id'],'ChatInteractionId':_0x5ca835['id'],'direction':'out','UserId':_0x2d5bf8['user']['id']};return db[_0x055e('0xcd')][_0x055e('0xbd')](_0x7d100,{});}else{throw new db['Sequelize']['ValidationError'](_0x055e('0xce'));}})['then'](function(){return _0x5ca835[_0x055e('0xcf')]({'vidaooSessionId':_0x5ee76f['id']});})[_0x055e('0x16')](respondWithResult(_0x484ee0,null))[_0x055e('0xb7')](handleError(_0x484ee0,null));};exports['customUpdate']=function(_0x1423f4,_0x31db97){if(_0x1423f4[_0x055e('0x2f')]['id']){delete _0x1423f4['body']['id'];}return db[_0x055e('0x45')]['find']({'where':{'id':_0x1423f4[_0x055e('0xb9')]['id']},'include':[{'model':db[_0x055e('0xd0')],'as':_0x055e('0x71')}]})[_0x055e('0x16')](handleEntityNotFound(_0x31db97,null))[_0x055e('0x16')](saveUpdates(_0x1423f4[_0x055e('0x2f')],null))[_0x055e('0x16')](respondWithResult(_0x31db97,null))[_0x055e('0xb7')](handleError(_0x31db97,null));};exports[_0x055e('0xd1')]=function(_0x2b3b85,_0xb88a07){if(_0x2b3b85['body']['id']){delete _0x2b3b85['body']['id'];}return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x2b3b85[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](function(_0x2704a1){if(!_0x2704a1){logger[_0x055e('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x055e('0xd1'),0x194,_0x055e('0xd2'));_0xb88a07[_0x055e('0x20')](0x194);}else{if(_0x2704a1[_0x055e('0x41')]){throw new db[(_0x055e('0x94'))][(_0x055e('0xca'))](_0x055e('0xd3'));}}return _0x2704a1;})[_0x055e('0x16')](function(_0x4900bc){if(_0x4900bc){return _0x4900bc[_0x055e('0x29')]({'closed':_0x2b3b85[_0x055e('0x2f')]['closed'],'disposition':_0x2b3b85[_0x055e('0x2f')][_0x055e('0x42')]})['then'](function(_0x2a3726){return _0x2a3726;});}})[_0x055e('0x16')](function(){return respondWithRpcPromise(_0x055e('0xd4'),'abandon',_0x2b3b85[_0x055e('0x2f')],client9004);})['then'](respondWithResult(_0xb88a07,null))['catch'](handleError(_0xb88a07,null));};exports[_0x055e('0xd5')]=function(_0x400ab5,_0x324439){_0x400ab5[_0x055e('0x2f')][_0x055e('0x2c')]=_0x400ab5[_0x055e('0xd6')][_0x055e('0xd7')];_0x400ab5[_0x055e('0x2f')][_0x055e('0xd8')]=_0x400ab5[_0x055e('0xd6')][_0x055e('0xd9')];_0x400ab5[_0x055e('0x2f')]['type']=_0x400ab5[_0x055e('0xd6')][_0x055e('0xda')];return db[_0x055e('0xdb')][_0x055e('0xbd')](_0x400ab5[_0x055e('0x2f')])[_0x055e('0x16')](respondWithResult(_0x324439,0xc9))[_0x055e('0xb7')](handleError(_0x324439,null));};exports['attachmentDownload']=function(_0xfbb46b,_0x148aae){return db[_0x055e('0x45')][_0x055e('0xbf')]({'where':{'id':_0xfbb46b[_0x055e('0xb9')]['id']},'raw':!![]})[_0x055e('0x16')](handleEntityNotFound(_0x148aae,null))[_0x055e('0x16')](function(_0x36ae94){if(_0x36ae94){if(_0x36ae94[_0x055e('0x40')]){return _0x148aae[_0x055e('0x21')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x055e('0xdb')][_0x055e('0xbf')]({'where':{'id':_0xfbb46b[_0x055e('0x4c')][_0x055e('0xdc')]},'raw':!![]})[_0x055e('0x16')](handleEntityNotFound(_0x148aae,null));}})['then'](function(_0xa60f8e){if(_0xa60f8e){var _0x115d2b=_0xa60f8e[_0x055e('0xdd')]!==null;var _0x1d00ab=path[_0x055e('0xde')](config['root'],_0x055e('0xdf'));if(_0x115d2b){_0x1d00ab=path[_0x055e('0xde')](_0x1d00ab,_0x055e('0xe0'));}var _0x444324=path[_0x055e('0xde')](_0x1d00ab,_0xa60f8e[_0x055e('0xd8')]);return _0x148aae[_0x055e('0xe1')](_0x444324);}})[_0x055e('0xb7')](handleError(_0x148aae,null));};exports[_0x055e('0xe2')]=function(_0x42077b,_0x6aeb60){var _0x5b00e4=null;var _0x2fb64a=null;var _0x4d3029=null;if(_0x42077b[_0x055e('0x2f')]['id']){delete _0x42077b[_0x055e('0x2f')]['id'];}if(_0x42077b['body']['mailTranscript']){_0x4d3029=path['join'](config[_0x055e('0xe3')],_0x055e('0xe4'),util['format'](_0x055e('0xe5'),Date[_0x055e('0xe6')]()));_0x42077b[_0x055e('0x2f')][_0x055e('0xe7')]=_0x4d3029;}return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x42077b['params']['id']},'include':[{'model':db[_0x055e('0xcd')],'as':_0x055e('0xe8'),'include':[{'model':db['User'],'as':_0x055e('0x7d')}]}]})[_0x055e('0x16')](handleEntityNotFound(_0x6aeb60,null))['then'](saveUpdates(_0x42077b[_0x055e('0x2f')],null))[_0x055e('0x16')](function(_0x49db7a){if(_0x49db7a){_0x5b00e4=_0x49db7a;return db[_0x055e('0xe9')]['find']({'where':{'id':_0x5b00e4[_0x055e('0x81')]}});}})['then'](function(_0xb60055){if(_0xb60055){_0x2fb64a=_0xb60055;return db['CmContact'][_0x055e('0x6c')]({'where':{'id':_0x5b00e4[_0x055e('0xea')]}});}})[_0x055e('0x16')](function(_0x25011f){if(_0x25011f){if(_0x4d3029){var _0xe83c1f=null;for(var _0x3084c7=0x1;_0x3084c7<_0x5b00e4[_0x055e('0xe8')][_0x055e('0x6b')];++_0x3084c7){_0xe83c1f=_0x5b00e4['Messages'][_0x3084c7];var _0x1dc506=_0xe83c1f['UserId']?util['format'](_0x055e('0xeb'),_0x2fb64a['agentAlias'],_0xe83c1f[_0x055e('0x41')]):_0x055e('0xec');var _0x2c4cc6=_0x42077b[_0x055e('0x2f')][_0x055e('0xed')]||util[_0x055e('0xee')](_0x055e('0xeb'),_0x055e('0xef'),_0xe83c1f[_0x055e('0xea')]);switch(_0x2fb64a[_0x055e('0xf0')]){case'website_alias':_0x1dc506=_0xe83c1f[_0x055e('0x41')]?util[_0x055e('0xee')](_0x055e('0xeb'),_0x2fb64a[_0x055e('0xf1')],_0xe83c1f[_0x055e('0x41')]):_0x055e('0xec');break;case _0x055e('0xf2'):_0x1dc506=_0xe83c1f['UserId']?_0xe83c1f[_0x055e('0x7d')][_0x055e('0xf3')]||_0xe83c1f['User']['fullname']:_0x055e('0xec');break;case'agent_fullname':_0x1dc506=_0xe83c1f[_0x055e('0x41')]?_0xe83c1f['User'][_0x055e('0x35')]:'System';break;default:_0x1dc506=_0xe83c1f[_0x055e('0x41')]?util[_0x055e('0xee')](_0x055e('0xeb'),_0x2fb64a['agentAlias'],_0xe83c1f[_0x055e('0x41')]):_0x055e('0xec');}var _0x43038c=util[_0x055e('0xee')](_0x055e('0xf4'),moment(_0xe83c1f[_0x055e('0x84')])[_0x055e('0xee')](_0x055e('0xf5')),_0xe83c1f[_0x055e('0xf6')]==='in'?_0x2c4cc6:_0x1dc506,_0xe83c1f['body']);if(!_0xe83c1f['secret']){fs[_0x055e('0xf7')](_0x4d3029,_0x43038c);}}return db[_0x055e('0xf8')][_0x055e('0xbf')]({'where':{'service':!![]},'include':[{'model':db[_0x055e('0xf9')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x055e('0xfa')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x055e('0x16')](function(_0x133c5a){if(!_0x133c5a||!_0x133c5a[_0x055e('0xfb')]||!_0x42077b[_0x055e('0x2f')])return _0x5b00e4;var _0x5c9dfb=_0x133c5a[_0x055e('0xfc')]();return respondWithRpcPromise(_0x055e('0xfd'),_0x055e('0xfe'),{'account':_0x5c9dfb,'message':{'from':util[_0x055e('0xee')](_0x055e('0xff'),_0x133c5a[_0x055e('0x2c')],_0x133c5a['email']||_0x133c5a[_0x055e('0xfb')][_0x055e('0x9c')]),'to':_0x42077b[_0x055e('0x2f')][_0x055e('0x100')],'subject':'Mail\x20Transcript','text':util[_0x055e('0xee')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x42077b['body'][_0x055e('0x100')]),'attachments':[{'path':_0x4d3029}]}})['then'](function(){return _0x5b00e4;})['catch'](function(_0x11025e){logger[_0x055e('0x1c')](_0x11025e);});})['then'](respondWithStatusCode(_0x6aeb60,0xc8))['catch'](handleError(_0x6aeb60,null));};exports[_0x055e('0x101')]=function(_0x1458fc,_0x5be45a){return db[_0x055e('0xcd')][_0x055e('0x6c')]({'where':{'id':_0x1458fc['params']['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x5be45a,null))[_0x055e('0x16')](function(_0x1ac372){if(_0x1ac372){return _0x1ac372[_0x055e('0x101')](_0x1458fc[_0x055e('0x2f')][_0x055e('0x102')],_[_0x055e('0x103')](_0x1458fc['body'],[_0x055e('0x102'),'id'])||{});}})['then'](respondWithResult(_0x5be45a,null))['catch'](handleError(_0x5be45a,null));};exports[_0x055e('0x104')]=function(_0x3168db,_0x293731){var _0x3b58fa={'raw':![],'where':{}};var _0x47bc47={};var _0x5c9091={'count':0x0,'rows':[]};return db[_0x055e('0x45')][_0x055e('0xbf')]({'where':{'id':_0x3168db['params']['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x293731,null))[_0x055e('0x16')](function(_0x5b3e5f){if(_0x5b3e5f){_0x47bc47[_0x055e('0x4a')]=_[_0x055e('0x4b')](db[_0x055e('0xcd')]['rawAttributes']);_0x47bc47['query']=_[_0x055e('0x4b')](_0x3168db['query']);_0x47bc47[_0x055e('0x4d')]=_['intersection'](_0x47bc47['model'],_0x47bc47[_0x055e('0x4c')]);_0x3b58fa[_0x055e('0x4e')]=_[_0x055e('0x4f')](_0x47bc47[_0x055e('0x4a')],qs['fields'](_0x3168db[_0x055e('0x4c')]['fields']));_0x3b58fa['attributes']=_0x3b58fa[_0x055e('0x4e')][_0x055e('0x6b')]?_0x3b58fa[_0x055e('0x4e')]:_0x47bc47[_0x055e('0x4a')];if(!_0x3168db[_0x055e('0x4c')][_0x055e('0x51')]('nolimit')){_0x3b58fa[_0x055e('0x25')]=qs[_0x055e('0x25')](_0x3168db[_0x055e('0x4c')][_0x055e('0x25')]);_0x3b58fa[_0x055e('0x23')]=qs['offset'](_0x3168db[_0x055e('0x4c')]['offset']);}_0x3b58fa['order']=qs[_0x055e('0x54')](_0x3168db['query'][_0x055e('0x54')]);_0x3b58fa[_0x055e('0x55')]=qs[_0x055e('0x4d')](_['pick'](_0x3168db[_0x055e('0x4c')],_0x47bc47[_0x055e('0x4d')]));_0x3b58fa['where'][_0x055e('0xb4')]=_0x5b3e5f['id'];if(_0x3168db[_0x055e('0x4c')][_0x055e('0x8e')]){_0x3b58fa[_0x055e('0x55')]=_[_0x055e('0x2e')](_0x3b58fa[_0x055e('0x55')],{'$or':_[_0x055e('0x34')](_0x3b58fa[_0x055e('0x4e')],function(_0x2a9661){var _0x5e7e2e={};_0x5e7e2e[_0x2a9661]={'$like':'%'+_0x3168db['query']['filter']+'%'};return _0x5e7e2e;})});}if(_0x3168db['query'][_0x055e('0x105')]){var _0x496b08=_0x3168db[_0x055e('0x4c')]['$gte']['split'](',');var _0x366512={};_0x366512[_0x496b08[0x0]]={'$gte':moment(_0x496b08[0x1])[_0x055e('0xee')](_0x055e('0x106'))};_0x3b58fa[_0x055e('0x55')]=_[_0x055e('0x2e')](_0x3b58fa[_0x055e('0x55')],_0x366512);}_0x3b58fa=_['merge']({},_0x3b58fa,_0x3168db['options']);return db[_0x055e('0xcd')][_0x055e('0x26')]({'where':_0x3b58fa[_0x055e('0x55')]})[_0x055e('0x16')](function(_0x56456b){_0x5c9091[_0x055e('0x26')]=_0x56456b;if(_0x3168db[_0x055e('0x4c')][_0x055e('0xba')]){_0x3b58fa[_0x055e('0xbb')]=[{'all':!![]}];}return db[_0x055e('0xcd')][_0x055e('0x107')](_0x3b58fa);})[_0x055e('0x16')](function(_0x5ad564){_0x5c9091[_0x055e('0xb6')]=_0x5ad564;return _0x5c9091;});}})[_0x055e('0x16')](respondWithFilteredResult(_0x293731,_0x3b58fa))[_0x055e('0xb7')](handleError(_0x293731,null));};exports[_0x055e('0x108')]=function(_0x52414e,_0x1b69f8){var _0xdaddd0={'where':{}},_0x5b7239={},_0x456ce6={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x055e('0xbf')]({'where':{'id':_0x52414e[_0x055e('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1b69f8,null))['then'](function(_0x3f6e40){if(_0x3f6e40){_0x5b7239[_0x055e('0x4a')]=_[_0x055e('0x4b')](db[_0x055e('0xcd')]['rawAttributes']);_0x5b7239[_0x055e('0x4c')]=_[_0x055e('0x4b')](_0x52414e['query']);_0x5b7239[_0x055e('0x4d')]=_[_0x055e('0x4f')](_0x5b7239[_0x055e('0x4a')],_0x5b7239[_0x055e('0x4c')]);_0xdaddd0[_0x055e('0x4e')]=_[_0x055e('0x4f')](_0x5b7239[_0x055e('0x4a')],qs['fields'](_0x52414e[_0x055e('0x4c')][_0x055e('0x50')]));_0xdaddd0['attributes']=_0xdaddd0['attributes'][_0x055e('0x6b')]?_0xdaddd0[_0x055e('0x4e')]:_0x5b7239['model'];if(!_0x52414e['query']['hasOwnProperty'](_0x055e('0x52'))){_0xdaddd0[_0x055e('0x25')]=qs[_0x055e('0x25')](_0x52414e[_0x055e('0x4c')]['limit']);_0xdaddd0[_0x055e('0x23')]=qs[_0x055e('0x23')](_0x52414e[_0x055e('0x4c')][_0x055e('0x23')]);}_0xdaddd0[_0x055e('0x53')]=qs[_0x055e('0x54')](_0x52414e[_0x055e('0x4c')][_0x055e('0x54')]);_0xdaddd0[_0x055e('0x55')]=qs[_0x055e('0x4d')](_[_0x055e('0x109')](_0x52414e['query'],_0x5b7239[_0x055e('0x4d')]));_0xdaddd0[_0x055e('0x55')][_0x055e('0xb4')]=_0x3f6e40['id'];if(_0x52414e[_0x055e('0x4c')]['filter']){_0xdaddd0['where']=_['merge'](_0xdaddd0['where'],{'$or':_['map'](_0xdaddd0['attributes'],function(_0x348631){var _0x57d1a6={};_0x57d1a6[_0x348631]={'$like':'%'+_0x52414e['query']['filter']+'%'};return _0x57d1a6;})});}_0xdaddd0['where'][_0x055e('0x10a')]=![];if(_0x52414e['query']['id']){_0xdaddd0[_0x055e('0x55')]['id']={'$gt':_0x52414e['query']['id']};}_0xdaddd0=_[_0x055e('0x2e')]({},_0xdaddd0,_0x52414e['options']);return db[_0x055e('0xcd')]['count']({'where':_0xdaddd0[_0x055e('0x55')]})[_0x055e('0x16')](function(_0x411090){_0x456ce6['count']=_0x411090;_0xdaddd0[_0x055e('0xbb')]=[];if(_0x52414e['query'][_0x055e('0x10b')]){_0xdaddd0[_0x055e('0xbb')][_0x055e('0x3a')]({'model':db[_0x055e('0x7d')],'as':_0x055e('0x7d'),'attributes':['id','fullname',_0x055e('0xf3')]});}if(_0x52414e['query'][_0x055e('0xba')]){_0xdaddd0[_0x055e('0xbb')]=[{'all':!![]}];}return db[_0x055e('0xcd')][_0x055e('0x107')](_0xdaddd0);})['then'](function(_0x597e1d){_0x456ce6[_0x055e('0xb6')]=_0x597e1d;return _0x456ce6;});}})[_0x055e('0x16')](respondWithFilteredResult(_0x1b69f8,_0xdaddd0))[_0x055e('0xb7')](handleError(_0x1b69f8,null));};exports[_0x055e('0x10c')]=function(_0x5c7de1,_0x1f14d1){return db['ChatInteraction'][_0x055e('0x6c')]({'where':{'id':_0x5c7de1[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x1f14d1,null))[_0x055e('0x16')](function(_0x419b3d){if(_0x419b3d){return _0x419b3d[_0x055e('0x10d')](_0x5c7de1['body'][_0x055e('0x102')],_[_0x055e('0x103')](_0x5c7de1[_0x055e('0x2f')],['ids','id'])||{})[_0x055e('0x10e')](function(){return db[_0x055e('0x7b')][_0x055e('0x107')]({'attributes':['id',_0x055e('0x2c'),'color'],'where':{'id':_0x5c7de1[_0x055e('0x2f')]['ids']}});})[_0x055e('0x16')](function(_0x342b10){socket[_0x055e('0x10f')](_0x055e('0x110'),{'id':Number(_0x5c7de1[_0x055e('0xb9')]['id']),'tags':_0x342b10||[]});return{'id':Number(_0x5c7de1[_0x055e('0xb9')]['id']),'tags':_0x342b10||[]};});}})['then'](respondWithResult(_0x1f14d1,null))[_0x055e('0xb7')](handleError(_0x1f14d1,null));};exports[_0x055e('0x111')]=function(_0x2fdf9b,_0x27e111){return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x2fdf9b['params']['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x27e111,null))['then'](function(_0x1feb0f){if(_0x1feb0f){return _0x1feb0f[_0x055e('0x111')](_0x2fdf9b[_0x055e('0x4c')]['ids']);}})[_0x055e('0x16')](respondWithStatusCode(_0x27e111,null))[_0x055e('0xb7')](handleError(_0x27e111,null));};exports['download']=function(_0x199b86,_0x4c8dcf){var _0x433494=moment()[_0x055e('0x112')]()[_0x055e('0xa1')]();var _0x2c1052=path[_0x055e('0xde')](config[_0x055e('0xe3')],_0x055e('0x113'),_0x055e('0x114'),_0x055e('0x115'));var _0xebbb8c=path['join'](config[_0x055e('0xe3')],_0x055e('0x113'),_0x055e('0x114'),_0x055e('0x116'));var _0x43cf78=path[_0x055e('0xde')](_0x2c1052,_0x433494);var _0x3b27ba=util[_0x055e('0xee')](_0x055e('0x117'),_0x199b86[_0x055e('0xb9')]['id'],_0x433494);var _0x56cd75=path[_0x055e('0xde')](_0x2c1052,_0x3b27ba);var _0xc967a1=[];_0xc967a1[_0x055e('0x3a')]({'model':db[_0x055e('0x7d')],'as':_0x055e('0x7d'),'attributes':['id',_0x055e('0x35')],'raw':!![]});_0xc967a1[_0x055e('0x3a')]({'model':db['CmContact'],'as':_0x055e('0x71'),'attributes':['id',_0x055e('0x118'),'lastName'],'raw':!![]});if(_0x199b86[_0x055e('0x4c')][_0x055e('0x116')]){_0xc967a1['push']({'model':db[_0x055e('0xdb')],'as':_0x055e('0xdb'),'raw':!![]});}var _0x41313e=[{'model':db[_0x055e('0xcd')],'as':_0x055e('0xe8'),'attributes':['id',_0x055e('0x2f'),_0x055e('0x84'),'direction',_0x055e('0x10a'),_0x055e('0x89')],'include':_0xc967a1}];_0x41313e['push']({'model':db[_0x055e('0xe9')],'as':_0x055e('0x119'),'attributes':['id','name']});_0x41313e[_0x055e('0x3a')]({'model':db[_0x055e('0x7d')],'as':_0x055e('0x11a'),'attributes':['id',_0x055e('0x35')]});return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x199b86['params']['id']},'include':_0x41313e})['then'](handleEntityNotFound(_0x4c8dcf,null))['then'](function(_0x43b91c){if(_0x43b91c){var _0x26028f=_0x43b91c['get']({'plain':!![]});fs[_0x055e('0x11b')](_0x43cf78);var _0x1167e6={'channel':_0x055e('0x11c'),'account':_0x26028f[_0x055e('0x119')][_0x055e('0x2c')],'agent':_0x26028f[_0x055e('0x11a')]?_0x26028f[_0x055e('0x11a')]['fullname']:'N.A.','createdAt':moment(_0x26028f[_0x055e('0x84')])['format'](_0x055e('0x106'))[_0x055e('0xa1')](),'closedAt':_0x26028f['closed']?moment(_0x26028f['closedAt'])[_0x055e('0xee')](_0x055e('0x106'))['toString']():'','disposition':_0x26028f[_0x055e('0x42')],'chatInfo':{'browser':_0x26028f['browserName'],'os':_0x26028f['osName'],'referer':_0x26028f[_0x055e('0x11d')],'customerIp':_0x26028f[_0x055e('0x11e')],'customerPort':_0x26028f[_0x055e('0x11f')]?_0x26028f[_0x055e('0x11f')]:_0x055e('0x120')},'messages':_(_0x26028f[_0x055e('0xe8')])[_0x055e('0x121')]()[_0x055e('0x8e')]({'secret':![]})['map'](function(_0x45acae){if(_0x45acae[_0x055e('0xdb')]){var _0x1b3fc7=path[_0x055e('0xde')](_0xebbb8c,_0x45acae['Attachment'][_0x055e('0xd8')]);if(fs[_0x055e('0x122')](_0x1b3fc7)){fs[_0x055e('0x123')](_0x1b3fc7)['pipe'](fs[_0x055e('0x124')](path[_0x055e('0xde')](_0x43cf78,_0x45acae[_0x055e('0xdb')]['basename'])));}}return{'date':moment(_0x45acae['createdAt'])[_0x055e('0xee')](_0x055e('0x106'))[_0x055e('0xa1')](),'sender':_0x45acae['direction']===_0x055e('0x125')?_0x45acae[_0x055e('0x7d')]?_0x45acae['User'][_0x055e('0x35')]:_0x055e('0xec'):_0x45acae[_0x055e('0x71')][_0x055e('0x118')]+(_0x45acae[_0x055e('0x71')][_0x055e('0x126')]?'\x20'+_0x45acae[_0x055e('0x71')][_0x055e('0x126')]:''),'body':_0x45acae['Attachment']?_0x45acae[_0x055e('0xdb')][_0x055e('0xd8')]:_0x45acae[_0x055e('0x2f')],'direction':_0x45acae[_0x055e('0xf6')]===_0x055e('0x125')?'A':'C','secret':_0x45acae[_0x055e('0x10a')],'read':_0x45acae[_0x055e('0x89')],'attachment':_0x45acae[_0x055e('0xdb')]};})['value']()};return ejs[_0x055e('0x127')](path['join'](config[_0x055e('0xe3')],_0x055e('0x113'),_0x055e('0x128'),_0x055e('0x129')),{'interaction':_0x1167e6})[_0x055e('0x16')](function(_0x1990c8){var _0x45b0dd=path[_0x055e('0xde')](_0x43cf78,_0x055e('0x12a')+_0x26028f['id']+'-'+_0x433494+_0x055e('0x12b'));var _0x4fac37={'path':_0x45b0dd,'channel':_0x055e('0x11c'),'interactionId':_0x26028f['id']};return pdf['createPdfFromHTML'](_0x1990c8,_0x4fac37);})['then'](function(){return new Promise(function(_0x551a21,_0x365f1c){zipdir(_0x43cf78,{'saveTo':_0x56cd75},function(_0x2bd1a9,_0x2a888e){if(_0x2bd1a9)return _0x365f1c(_0x2bd1a9);return _0x551a21(_0x2a888e);});})[_0x055e('0x16')](function(){return new BPromise(function(_0x3420fc,_0x9b5222){rimraf(_0x43cf78,function(_0xce341b){if(_0xce341b)_0x9b5222(_0xce341b);return _0x3420fc();});});})['then'](function(){return _0x4c8dcf[_0x055e('0xe1')](_0x56cd75,_0x3b27ba,function(_0x8509c7){if(_0x8509c7){logger['error'](_0x055e('0x12c'),_0x8509c7);}else{fs[_0x055e('0x12d')](_0x56cd75);}});});});}else{return _0x4c8dcf[_0x055e('0x20')](0xc8);}})[_0x055e('0xb7')](handleError(_0x4c8dcf,null));}; \ No newline at end of file +var _0x0e85=['sequelize','groupBy','ChatInteractionId','all','show','params','rawAttributes','includeAll','include','options','create','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','disposition','AbandonInteraction','abandon','file','originalname','basename','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','root','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','CmContact','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','filter','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Account','Owner','mkdirSync','N.A.','closedAt','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','ejs','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','stack','name','send','render','merge','contact','interaction','account','Users','map','Tags','TagIds','split','forEach','push','catch','waiting','answered','unmanaged','abandoned','total','closed','UserId','talking','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','value','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','i.ChatWebsiteId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','user','ChatWebsiteId','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0x0e85,0x7c));var _0x50e8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0e85[_0x21a9d9];return _0x46adce;};'use strict';var rimraf=require(_0x50e8('0x0'));var zipdir=require(_0x50e8('0x1'));var rp=require('request-promise');var moment=require(_0x50e8('0x2'));var BPromise=require(_0x50e8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require(_0x50e8('0x4'));var fs=require('fs');var _=require('lodash');var squel=require(_0x50e8('0x5'));var Redis=require(_0x50e8('0x6'));var qs=require(_0x50e8('0x7'));var as=require(_0x50e8('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x50e8('0x9'))(_0x50e8('0xa'));var config=require(_0x50e8('0xb'));var db=require(_0x50e8('0xc'))['db'];config[_0x50e8('0xd')]=_[_0x50e8('0xe')](config['redis'],{'host':_0x50e8('0xf'),'port':0x18eb});var socket=require(_0x50e8('0x10'))(new Redis(config[_0x50e8('0xd')]));require(_0x50e8('0x11'))[_0x50e8('0x12')](socket);var jayson=require(_0x50e8('0x13'));var client=jayson[_0x50e8('0x14')][_0x50e8('0x15')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0xfc6bb9,_0x24d381,_0x508377,_0x49e02f){return new BPromise(function(_0x3cb45c,_0x2abda1){var _0x1a4c85=_0x49e02f||client;return _0x1a4c85[_0x50e8('0x16')](_0xfc6bb9,_0x508377)['then'](function(_0x18596f){logger[_0x50e8('0x17')](_0x50e8('0x18'),_0x24d381,'request\x20sent');logger['debug'](_0x50e8('0x19'),_0x24d381,_0x50e8('0x1a'),JSON[_0x50e8('0x1b')](_0x18596f));if(_0x18596f[_0x50e8('0x1c')]){if(_0x18596f[_0x50e8('0x1c')][_0x50e8('0x1d')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x24d381,_0x18596f[_0x50e8('0x1c')][_0x50e8('0x1e')]);return _0x2abda1(_0x18596f[_0x50e8('0x1c')][_0x50e8('0x1e')]);}logger[_0x50e8('0x1c')](_0x50e8('0x18'),_0x24d381,_0x18596f[_0x50e8('0x1c')]['message']);return _0x3cb45c(_0x18596f[_0x50e8('0x1c')]['message']);}else{logger[_0x50e8('0x17')](_0x50e8('0x18'),_0x24d381,_0x50e8('0x1a'));_0x3cb45c(_0x18596f[_0x50e8('0x1f')][_0x50e8('0x1e')]);}})['catch'](function(_0x2c7c25){logger[_0x50e8('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x24d381,_0x2c7c25);_0x2abda1(_0x2c7c25);});});}function respondWithStatusCode(_0x31d23c,_0x41500f){_0x41500f=_0x41500f||0xcc;return function(_0x5691b2){if(_0x5691b2){return _0x31d23c[_0x50e8('0x20')](_0x41500f);}return _0x31d23c[_0x50e8('0x21')](_0x41500f)['end']();};}function respondWithResult(_0x47a3d8,_0x59582d){_0x59582d=_0x59582d||0xc8;return function(_0x3e1234){if(_0x3e1234){return _0x47a3d8[_0x50e8('0x21')](_0x59582d)[_0x50e8('0x22')](_0x3e1234);}};}function respondWithFilteredResult(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(_0x13b6e9){var _0x53d848=typeof _0xc2f832[_0x50e8('0x23')]===_0x50e8('0x24')&&typeof _0xc2f832['limit']===_0x50e8('0x24');var _0x2bc8d8=_0x13b6e9[_0x50e8('0x25')];var _0x2af330=_0x53d848?0x0:_0xc2f832['offset'];var _0x1f5a6c=_0x53d848?_0x13b6e9['count']:_0xc2f832[_0x50e8('0x23')]+_0xc2f832[_0x50e8('0x26')];var _0x42bbef;if(_0x1f5a6c>=_0x2bc8d8){_0x1f5a6c=_0x2bc8d8;_0x42bbef=0xc8;}else{_0x42bbef=0xce;}_0x371a1f['status'](_0x42bbef);return _0x371a1f[_0x50e8('0x27')](_0x50e8('0x28'),_0x2af330+'-'+_0x1f5a6c+'/'+_0x2bc8d8)[_0x50e8('0x22')](_0x13b6e9);}return null;};}function saveUpdates(_0x8d68c8){return function(_0x1d77d0){if(_0x1d77d0){return _0x1d77d0[_0x50e8('0x29')](_0x8d68c8)[_0x50e8('0x2a')](function(_0x54d81d){return _0x54d81d;});}return null;};}function removeEntity(_0x290fd2){return function(_0x123be9){if(_0x123be9){return _0x123be9['destroy']()['then'](function(){_0x290fd2[_0x50e8('0x21')](0xcc)[_0x50e8('0x2b')]();});}};}function handleEntityNotFound(_0x32db93){return function(_0x47ace2){if(!_0x47ace2){_0x32db93['sendStatus'](0x194);}return _0x47ace2;};}function handleError(_0x3e58a9,_0x19e3cc){_0x19e3cc=_0x19e3cc||0x1f4;return function(_0x5c2e04){logger[_0x50e8('0x1c')](_0x5c2e04[_0x50e8('0x2c')]);if(_0x5c2e04[_0x50e8('0x2d')]){delete _0x5c2e04[_0x50e8('0x2d')];}_0x3e58a9['status'](_0x19e3cc)[_0x50e8('0x2e')](_0x5c2e04);};}function getMustacheRender(_0x4ec6ad,_0x3aec30){return Mustache[_0x50e8('0x2f')](_0x4ec6ad,_[_0x50e8('0x30')](_0x3aec30['body'],{'contact':_0x3aec30[_0x50e8('0x31')],'message':_0x3aec30[_0x50e8('0x1e')],'agent':_0x3aec30['agent'],'interaction':_0x3aec30[_0x50e8('0x32')],'account':_0x3aec30[_0x50e8('0x33')]}))||'';}function getInteractionUsers(_0x5db19b,_0x1a7ba4){return new BPromise(function(_0x5b827f,_0x1c513c){try{if(_0x1a7ba4[_0x5db19b['id']]){_0x5db19b[_0x50e8('0x34')]=_[_0x50e8('0x35')](_0x1a7ba4[_0x5db19b['id']],function(_0x4e2a37){return{'id':_0x4e2a37['id'],'fullname':_0x4e2a37['fullname']};});}}catch(_0x3c7778){_0x1c513c(_0x3c7778);}_0x5b827f(_0x5db19b);});}function getInteractionTags(_0x2d0ccf,_0x3f01ee){return new BPromise(function(_0x4d3454,_0x58ec1c){try{if(_0x2d0ccf['TagIds']){_0x2d0ccf[_0x50e8('0x36')]=[];_0x2d0ccf[_0x50e8('0x37')][_0x50e8('0x38')](',')[_0x50e8('0x39')](function(_0x35514b){_0x2d0ccf[_0x50e8('0x36')][_0x50e8('0x3a')](_0x3f01ee[_0x35514b]);});}delete _0x2d0ccf[_0x50e8('0x37')];}catch(_0x35f802){_0x58ec1c(_0x35f802);}_0x4d3454(_0x2d0ccf);});}function updateChatInteraction(_0x3a1b4d,_0x53066b,_0x3371a4){return new BPromise(function(_0x40214f,_0x2379cf){return getInteractionUsers(_0x3a1b4d,_0x3371a4)[_0x50e8('0x2a')](function(_0x5dbbe1){return getInteractionTags(_0x5dbbe1,_0x53066b);})[_0x50e8('0x2a')](function(_0x944e46){return getStateInteraction(_0x944e46);})[_0x50e8('0x2a')](function(_0x169b4f){_0x40214f(_0x169b4f);})[_0x50e8('0x3b')](function(_0x5c7bef){_0x2379cf(_0x5c7bef);});});}function getStateInteraction(_0x53b198){return new BPromise(function(_0x81e6f3){_0x53b198[_0x50e8('0x3c')]=0x0;_0x53b198['talking']=0x0;_0x53b198[_0x50e8('0x3d')]=0x0;_0x53b198[_0x50e8('0x3e')]=0x0;_0x53b198[_0x50e8('0x3f')]=0x0;_0x53b198[_0x50e8('0x40')]=0x0;if(!_0x53b198[_0x50e8('0x41')]&&!_0x53b198[_0x50e8('0x42')]){_0x53b198[_0x50e8('0x3c')]+=0x1;}if(!_0x53b198[_0x50e8('0x41')]&&_0x53b198['UserId']){_0x53b198[_0x50e8('0x43')]+=0x1;if(_0x53b198[_0x50e8('0x3c')]){_0x53b198[_0x50e8('0x3c')]-=0x1;}}if(_0x53b198[_0x50e8('0x41')]&&_0x53b198['disposition']===_0x50e8('0x3f')){_0x53b198[_0x50e8('0x3f')]+=0x1;if(_0x53b198[_0x50e8('0x3c')]){_0x53b198[_0x50e8('0x3c')]-=0x1;}}else if(_0x53b198['closed']&&!_0x53b198[_0x50e8('0x42')]&&_0x53b198['disposition']){_0x53b198['unmanaged']+=0x1;if(_0x53b198['waiting']){_0x53b198[_0x50e8('0x3c')]-=0x1;}}else if(_0x53b198[_0x50e8('0x41')]&&_0x53b198['UserId']){_0x53b198[_0x50e8('0x3d')]+=0x1;if(_0x53b198[_0x50e8('0x43')]){_0x53b198[_0x50e8('0x43')]-=0x1;}}_0x53b198[_0x50e8('0x40')]+=0x1;_0x81e6f3(_0x53b198);});}exports[_0x50e8('0x44')]=function(_0x22527f,_0x51d239){var _0x16fdf6={},_0x596f62={},_0x1cc4fe={'count':0x0,'rows':[]};var _0x504d97=_['map'](db[_0x50e8('0x45')]['rawAttributes'],function(_0x2cbcac){return{'name':_0x2cbcac[_0x50e8('0x46')],'type':_0x2cbcac[_0x50e8('0x47')][_0x50e8('0x48')]};});_0x596f62[_0x50e8('0x49')]=_[_0x50e8('0x35')](_0x504d97,_0x50e8('0x2d'));_0x596f62[_0x50e8('0x4a')]=_[_0x50e8('0x4b')](_0x22527f[_0x50e8('0x4a')]);_0x596f62[_0x50e8('0x4c')]=_['intersection'](_0x596f62[_0x50e8('0x49')],_0x596f62[_0x50e8('0x4a')]);_0x16fdf6['attributes']=_[_0x50e8('0x4d')](_0x596f62['model'],qs[_0x50e8('0x4e')](_0x22527f['query'][_0x50e8('0x4e')]));_0x16fdf6[_0x50e8('0x4f')]=_0x16fdf6[_0x50e8('0x4f')][_0x50e8('0x50')]?_0x16fdf6[_0x50e8('0x4f')]:_0x596f62[_0x50e8('0x49')];if(!_0x22527f[_0x50e8('0x4a')]['hasOwnProperty'](_0x50e8('0x51'))){_0x16fdf6[_0x50e8('0x26')]=qs[_0x50e8('0x26')](_0x22527f[_0x50e8('0x4a')][_0x50e8('0x26')]);_0x16fdf6[_0x50e8('0x23')]=qs['offset'](_0x22527f[_0x50e8('0x4a')][_0x50e8('0x23')]);}_0x16fdf6[_0x50e8('0x52')]=qs[_0x50e8('0x53')](_0x22527f['query'][_0x50e8('0x53')]);_0x16fdf6[_0x50e8('0x54')]=qs[_0x50e8('0x4c')](_[_0x50e8('0x55')](_0x22527f[_0x50e8('0x4a')],_0x596f62[_0x50e8('0x4c')]),_0x504d97);var _0x320b00=[];var _0x5f5220=squel['select']()['field']('id')[_0x50e8('0x56')](_0x50e8('0x2d'))[_0x50e8('0x56')](_0x50e8('0x57'))[_0x50e8('0x58')](_0x50e8('0x59'));var _0x566723=squel[_0x50e8('0x5a')]()[_0x50e8('0x56')](_0x50e8('0x5b'))[_0x50e8('0x56')]('u.fullname')[_0x50e8('0x56')](_0x50e8('0x5c'))[_0x50e8('0x58')](_0x50e8('0x5d'),'ui')[_0x50e8('0x5e')](_0x50e8('0x5f'),'u','u.id\x20=\x20ui.UserId');var _0x234f94=squel['select']()['from']('chat_interactions','i')[_0x50e8('0x5e')]('cm_contacts','c',_0x50e8('0x60'))[_0x50e8('0x5e')](_0x50e8('0x5f'),'o',_0x50e8('0x61'))[_0x50e8('0x5e')](_0x50e8('0x62'),'a',_0x50e8('0x63'))['left_join'](_0x50e8('0x64'),'me',_0x50e8('0x65'))[_0x50e8('0x5e')]('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x50e8('0x59'),'t',_0x50e8('0x66'));var _0x63ca8=squel[_0x50e8('0x67')]();var _0x3327d5=[];var _0x102181=squel['expr']();var _0x42c2d0;if(_0x22527f['query'][_0x50e8('0x68')]){_0x42c2d0=as[_0x50e8('0x69')](_0x22527f['query']['search']);var _0x51775a=_0x42c2d0[_0x50e8('0x6a')];for(var _0x3588f0=0x0;_0x3588f0<_0x42c2d0['conditions'][_0x50e8('0x50')];_0x3588f0++){var _0xb2d01a=_0x42c2d0[_0x50e8('0x6b')][_0x3588f0];var _0x3bbd6f='i';var _0x71bf27=_['find'](_0x504d97,[_0x50e8('0x2d'),_0xb2d01a[_0x50e8('0x56')]]);if(!_0x71bf27){switch(_0xb2d01a[_0x50e8('0x56')]){case'unreadMessages':if(_0xb2d01a['value']==0x1){_0x234f94[_0x50e8('0x6c')]('`'+_0xb2d01a[_0x50e8('0x56')]+_0x50e8('0x6d'));}else{_0x234f94[_0x50e8('0x6c')]('`'+_0xb2d01a[_0x50e8('0x56')]+_0x50e8('0x6e'));}break;case'Contact':if(_0xb2d01a['operator']===_0x50e8('0x6f')){if(_0xb2d01a['value'][_0x50e8('0x38')]('\x20')[_0x50e8('0x50')]>0x1){_0x63ca8[_0x51775a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x50e8('0x70')](_0xb2d01a['value']),null);}else{var _0x58657d='%'+_0xb2d01a['value']+'%';_0x63ca8[_0x51775a](_0x50e8('0x71'),_0x58657d,_0x58657d,_0x58657d);}}else{_0x71bf27=_[_0x50e8('0x72')](_0x504d97,[_0x50e8('0x2d'),_0x50e8('0x73')]);_0xb2d01a['field']='ContactId';_0x1637b2=as[_0x50e8('0x74')](_0x3bbd6f,_0x71bf27[_0x50e8('0x47')],_0xb2d01a);_0x63ca8[_0x51775a](_0x1637b2[_0x50e8('0x75')],_0x1637b2[_0x50e8('0x76')][_0x50e8('0x77')],_0x1637b2[_0x50e8('0x76')][_0x50e8('0x2b')]);}break;case _0x50e8('0x78'):var _0x2635f0=_0xb2d01a[_0x50e8('0x76')][_0x50e8('0x38')](',')[_0x50e8('0x35')](function(_0x1ad71a){return Number(_0x1ad71a);});_0x2635f0[_0x50e8('0x39')](function(_0x310091){_0x102181['or'](_0x50e8('0x79'),'%,'+_0x310091+',%');});_0x3327d5=_[_0x50e8('0x7a')](_0x3327d5,_0x2635f0);break;case _0x50e8('0x7b'):if(_0xb2d01a['operator']===_0x50e8('0x6f')){_0x63ca8[_0x51775a](_0x50e8('0x7c'),'%'+_0xb2d01a[_0x50e8('0x76')]+'%',null);}else{_0x71bf27=_[_0x50e8('0x72')](_0x504d97,['name',_0x50e8('0x42')]);_0xb2d01a[_0x50e8('0x56')]=_0x50e8('0x42');_0x1637b2=as[_0x50e8('0x74')](_0x3bbd6f,_0x71bf27[_0x50e8('0x47')],_0xb2d01a);_0x63ca8[_0x51775a](_0x1637b2[_0x50e8('0x75')],_0x1637b2['value'][_0x50e8('0x77')],_0x1637b2[_0x50e8('0x76')][_0x50e8('0x2b')]);}break;case _0x50e8('0x7d'):_0x1637b2=as['buildExpression']('me',null,_0xb2d01a);_0x63ca8[_0x51775a](_0x1637b2[_0x50e8('0x75')],_0x1637b2['value'][_0x50e8('0x77')],_0x1637b2[_0x50e8('0x76')][_0x50e8('0x2b')]);break;}}else{var _0x1637b2=as[_0x50e8('0x74')](_0x3bbd6f,_0x71bf27['type'],_0xb2d01a);_0x63ca8[_0x51775a](_0x1637b2[_0x50e8('0x75')],_0x1637b2[_0x50e8('0x76')][_0x50e8('0x77')],_0x1637b2[_0x50e8('0x76')][_0x50e8('0x2b')]);}}}else{var _0x1dc51d=_(_0x22527f['query'])[_0x50e8('0x4b')]()[_0x50e8('0x35')](function(_0x4fc73d){return _[_0x50e8('0x7e')](_0x504d97,[_0x50e8('0x2d'),_0x4fc73d])?_0x4fc73d:undefined;})['compact']()[_0x50e8('0x76')]();if(!_['isEmpty'](_0x1dc51d)){_0x1dc51d[_0x50e8('0x39')](function(_0x26f96d){if(_0x26f96d==='ChatWebsiteId'){_0x234f94[_0x50e8('0x54')](_0x50e8('0x7f'),[][_0x50e8('0x80')](_0x22527f[_0x50e8('0x4a')][_0x26f96d]));}else if(_0x26f96d==='createdAt'){var _0xf21b2f=JSON['parse'](_0x22527f[_0x50e8('0x4a')][_0x26f96d])[_0x50e8('0x81')];var _0x52cb34=JSON[_0x50e8('0x82')](_0x22527f[_0x50e8('0x4a')][_0x26f96d])[_0x50e8('0x83')];_0x234f94[_0x50e8('0x54')](_0x50e8('0x84'),_0xf21b2f,_0x52cb34);}else{if(_0x22527f[_0x50e8('0x4a')][_0x26f96d]===_0x50e8('0x85')){_0x234f94[_0x50e8('0x54')]('i.'+_0x26f96d+_0x50e8('0x86'));}else{_0x234f94['where']('i.'+_0x26f96d+_0x50e8('0x87'),_0x22527f[_0x50e8('0x4a')][_0x26f96d]);}}});}if(_0x22527f[_0x50e8('0x4a')]['read']){if(_0x22527f[_0x50e8('0x4a')][_0x50e8('0x88')]==0x1){_0x234f94[_0x50e8('0x6c')]('`unreadMessages`\x20=\x200');}else{_0x234f94['having'](_0x50e8('0x89'));}}if(_0x22527f[_0x50e8('0x4a')]['tag']){_0x3327d5=_[_0x50e8('0x8a')](_0x22527f['query'][_0x50e8('0x8b')])?_0x22527f[_0x50e8('0x4a')][_0x50e8('0x8b')]:new Array(_0x22527f[_0x50e8('0x4a')]['tag']);_0x3327d5[_0x50e8('0x39')](function(_0x4ac008){_0x102181['or'](_0x50e8('0x79'),'%,'+_0x4ac008+',%');});}if(_0x22527f['query']['filter']){var _0x368d17=_0x22527f[_0x50e8('0x4a')]['filter'][_0x50e8('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x50e8('0x8d')](_0x368d17)){_0x63ca8['or']('i.id\x20LIKE\x20?',_0x368d17+'%');}else{_0x63ca8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x50e8('0x70')](_0x368d17))['or'](_0x50e8('0x8e'),_0x368d17+'%');}}}_0x234f94[_0x50e8('0x54')](_0x63ca8);_0x234f94[_0x50e8('0x8f')]('i.id');var _0x2de6b4={'type':db['Sequelize']['QueryTypes'][_0x50e8('0x90')],'raw':!![]};var _0x805b93=_0x234f94[_0x50e8('0x91')]();_0x805b93['field']('i.id');_0x805b93['field'](_0x50e8('0x92'),_0x50e8('0x93'));if(_0x16fdf6[_0x50e8('0x52')]){_0x16fdf6[_0x50e8('0x52')][_0x50e8('0x39')](function(_0x1869e9){var _0x500cdd=_0x1869e9[0x0]==='contactName'?_0x1869e9[0x0]:'i.'+_0x1869e9[0x0];_0x234f94[_0x50e8('0x52')](_0x500cdd,_0x1869e9[0x1]===_0x50e8('0x94')?![]:!![]);});}if(!_[_0x50e8('0x95')](_0x3327d5)){_0x234f94[_0x50e8('0x6c')](_0x102181);_0x805b93[_0x50e8('0x54')]('t.id\x20IN\x20?',_0x3327d5);}BPromise[_0x50e8('0x96')]()[_0x50e8('0x2a')](function(){if(!_0x42c2d0){if(_0x22527f[_0x50e8('0x4a')]['ChatWebsiteId'])return;_0x805b93['where'](_0x50e8('0x97'));_0x234f94[_0x50e8('0x54')](_0x50e8('0x97'));return;}if(_0x22527f['user'][_0x50e8('0x98')]!==_0x50e8('0x99'))return;return _0x22527f['user'][_0x50e8('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x306fc0){if(_[_0x50e8('0x95')](_0x306fc0)){_0x805b93[_0x50e8('0x54')](_0x50e8('0x9b'));_0x234f94[_0x50e8('0x54')](_0x50e8('0x9b'));}else{_0x805b93[_0x50e8('0x54')](_0x50e8('0x7f'),_[_0x50e8('0x35')](_0x306fc0,'id'));_0x234f94['where'](_0x50e8('0x7f'),_['map'](_0x306fc0,'id'));}});})[_0x50e8('0x2a')](function(){if(_0x22527f[_0x50e8('0x9c')][_0x50e8('0x98')]===_0x50e8('0x99')&&!_0x42c2d0&&!_0x22527f[_0x50e8('0x4a')][_0x50e8('0x9d')])return[];return db['sequelize'][_0x50e8('0x4a')](_0x805b93[_0x50e8('0x9e')](),_0x2de6b4);})[_0x50e8('0x2a')](function(_0x10b0cd){_0x1cc4fe[_0x50e8('0x25')]=_0x10b0cd[_0x50e8('0x50')];if(_0x1cc4fe[_0x50e8('0x25')]===0x0)return[];return db['sequelize'][_0x50e8('0x4a')](_0x5f5220[_0x50e8('0x9e')](),_0x2de6b4)[_0x50e8('0x2a')](function(_0xc55fb5){_0x320b00=_[_0x50e8('0x9f')](_0xc55fb5,'id');_0x2de6b4=_[_0x50e8('0x30')](_0x2de6b4,{'model':db[_0x50e8('0x45')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x22527f[_0x50e8('0x4a')]['fields']){_0x16fdf6['attributes']['forEach'](function(_0x27c159){_0x234f94['field']('i.'+_0x27c159);});}else{_0x234f94[_0x50e8('0x56')](_0x50e8('0x92'),_0x50e8('0x93'));_0x234f94[_0x50e8('0x56')](_0x50e8('0xa0'),_0x50e8('0xa1'));_0x234f94[_0x50e8('0x56')](_0x50e8('0xa2'),_0x50e8('0xa3'));_0x234f94[_0x50e8('0x56')](_0x50e8('0xa4'),'contactName');_0x234f94[_0x50e8('0x56')](_0x50e8('0xa5'));_0x234f94['field'](_0x50e8('0xa6'),_0x50e8('0xa7'));_0x234f94[_0x50e8('0x56')](_0x50e8('0xa8'),'Contact.lastName');_0x234f94[_0x50e8('0x56')](_0x50e8('0xa9'),'Contact.email');_0x234f94[_0x50e8('0x56')]('c.phone',_0x50e8('0xaa'));_0x234f94[_0x50e8('0x56')](_0x50e8('0xab'),_0x50e8('0xac'));_0x234f94[_0x50e8('0x56')](_0x50e8('0xad'),_0x50e8('0xae'));_0x234f94[_0x50e8('0x56')](_0x50e8('0xaf'),'Owner.fullname');_0x234f94[_0x50e8('0x56')](_0x50e8('0xb0'),_0x50e8('0xb1'));_0x234f94['field'](_0x50e8('0xb2'),_0x50e8('0x37'));}if(_0x16fdf6[_0x50e8('0x26')])_0x234f94[_0x50e8('0x26')](_0x16fdf6['limit']);if(_0x16fdf6['offset'])_0x234f94[_0x50e8('0x23')](_0x16fdf6[_0x50e8('0x23')]);return db[_0x50e8('0xb3')][_0x50e8('0x4a')](_0x234f94[_0x50e8('0x9e')](),_0x2de6b4);})['then'](function(_0x3b85a9){if(_0x3b85a9[_0x50e8('0x50')]>0x0)_0x566723['where']('ui.ChatInteractionId\x20IN\x20?',_[_0x50e8('0x35')](_0x3b85a9,'id'));return db[_0x50e8('0xb3')]['query'](_0x566723[_0x50e8('0x9e')](),_0x2de6b4)['then'](function(_0x3620e3){var _0x353ab9=_[_0x50e8('0xb4')](_0x3620e3,_0x50e8('0xb5'));var _0x97c1e9=[];_0x3b85a9[_0x50e8('0x39')](function(_0x53f5ef){_0x97c1e9['push'](updateChatInteraction(_0x53f5ef,_0x320b00,_0x353ab9));});return BPromise[_0x50e8('0xb6')](_0x97c1e9);});});})[_0x50e8('0x2a')](function(_0x5d0198){_0x1cc4fe['rows']=_0x5d0198;return _0x1cc4fe;})[_0x50e8('0x2a')](respondWithFilteredResult(_0x51d239,_0x16fdf6))['catch'](handleError(_0x51d239,null));};exports[_0x50e8('0xb7')]=function(_0x384eef,_0x563dcc){var _0x1806ef={'raw':![],'where':{'id':_0x384eef[_0x50e8('0xb8')]['id']}},_0x5248d6={};_0x5248d6['model']=_[_0x50e8('0x4b')](db['ChatInteraction'][_0x50e8('0xb9')]);_0x5248d6[_0x50e8('0x4a')]=_[_0x50e8('0x4b')](_0x384eef[_0x50e8('0x4a')]);_0x5248d6['filters']=_[_0x50e8('0x4d')](_0x5248d6[_0x50e8('0x49')],_0x5248d6['query']);_0x1806ef[_0x50e8('0x4f')]=_[_0x50e8('0x4d')](_0x5248d6[_0x50e8('0x49')],qs[_0x50e8('0x4e')](_0x384eef[_0x50e8('0x4a')][_0x50e8('0x4e')]));_0x1806ef[_0x50e8('0x4f')]=_0x1806ef['attributes'][_0x50e8('0x50')]?_0x1806ef[_0x50e8('0x4f')]:_0x5248d6[_0x50e8('0x49')];if(_0x384eef[_0x50e8('0x4a')][_0x50e8('0xba')]){_0x1806ef[_0x50e8('0xbb')]=[{'all':!![]}];}_0x1806ef=_[_0x50e8('0x30')]({},_0x1806ef,_0x384eef[_0x50e8('0xbc')]);return db[_0x50e8('0x45')]['find'](_0x1806ef)[_0x50e8('0x2a')](handleEntityNotFound(_0x563dcc,null))[_0x50e8('0x2a')](respondWithResult(_0x563dcc,null))[_0x50e8('0x3b')](handleError(_0x563dcc,null));};exports[_0x50e8('0xbd')]=function(_0x2c8f31,_0x179022){return db[_0x50e8('0x45')][_0x50e8('0xbd')](_0x2c8f31[_0x50e8('0x7d')],{})['then'](respondWithResult(_0x179022,0xc9))[_0x50e8('0x3b')](handleError(_0x179022,null));};exports['update']=function(_0x5e15d7,_0x31b00e){if(_0x5e15d7['body']['id']){delete _0x5e15d7[_0x50e8('0x7d')]['id'];}return db[_0x50e8('0x45')]['find']({'where':{'id':_0x5e15d7['params']['id']}})[_0x50e8('0x2a')](handleEntityNotFound(_0x31b00e,null))[_0x50e8('0x2a')](saveUpdates(_0x5e15d7[_0x50e8('0x7d')],null))['then'](respondWithResult(_0x31b00e,null))[_0x50e8('0x3b')](handleError(_0x31b00e,null));};exports['destroy']=function(_0x2cf36f,_0x3cc7e5){return db[_0x50e8('0x45')][_0x50e8('0x72')]({'where':{'id':_0x2cf36f['params']['id']}})[_0x50e8('0x2a')](handleEntityNotFound(_0x3cc7e5,null))[_0x50e8('0x2a')](removeEntity(_0x3cc7e5,null))[_0x50e8('0x3b')](handleError(_0x3cc7e5,null));};exports[_0x50e8('0xbe')]=function(_0x54282e,_0x3e36ea){return db[_0x50e8('0x45')]['describe']()[_0x50e8('0x2a')](respondWithResult(_0x3e36ea,null))[_0x50e8('0x3b')](handleError(_0x3e36ea,null));};exports['createVidaooSession']=function(_0x511606,_0x57ebe1){var _0x2e5e22=_0x511606[_0x50e8('0xb8')]['id'];var _0x16e2fe;var _0x4eb523;var _0x230791;return db[_0x50e8('0x45')]['findOne']({'where':{'id':_0x2e5e22}})[_0x50e8('0x2a')](function(_0x39f412){_0x16e2fe=_0x39f412;return db[_0x50e8('0xbf')][_0x50e8('0xc0')]({'where':{'id':_0x39f412[_0x50e8('0x9d')]},'attributes':['id',_0x50e8('0xc1'),'vidaooEscalation',_0x50e8('0xc2'),'vidaooNote',_0x50e8('0xc3')],'raw':!![]});})['then'](function(_0x2ab4c5){if(_0x2ab4c5&&_0x2ab4c5[_0x50e8('0xc1')]&&_0x2ab4c5['vidaooEscalation']){_0x4eb523=_0x2ab4c5;var _0x2ef5d9={'interaction':{'id':_0x2e5e22},'agent':{'id':_0x511606[_0x50e8('0x9c')]['id'],'name':_0x511606[_0x50e8('0x9c')][_0x50e8('0x2d')],'fullname':_0x511606[_0x50e8('0x9c')][_0x50e8('0xc4')],'email':_0x511606[_0x50e8('0x9c')][_0x50e8('0xc5')]},'contact':_0x511606[_0x50e8('0x7d')][_0x50e8('0x31')],'account':_0x511606[_0x50e8('0x7d')][_0x50e8('0x33')]};var _0x4aa481={'rejectUnauthorized':![],'method':_0x50e8('0xc6'),'url':_0x50e8('0xc7'),'headers':{'X-APIKEY':_0x2ab4c5[_0x50e8('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x511606[_0x50e8('0x9c')][_0x50e8('0xc5')]],'buttons':null,'topic':_0x4eb523[_0x50e8('0xc2')],'note':_[_0x50e8('0xc8')](_0x4eb523['vidaooNote'])?null:getMustacheRender(_0x4eb523[_0x50e8('0xc9')],_0x2ef5d9),'metadata':null},'redirect':_0x50e8('0xca'),'json':!![]};try{if(!_[_0x50e8('0xc8')](_0x4eb523[_0x50e8('0xc3')])){var _0x27957b=getMustacheRender(_0x4eb523[_0x50e8('0xc3')],_0x2ef5d9);var _0x4a6e82=JSON['parse'](_0x27957b);_0x4aa481[_0x50e8('0x7d')][_0x50e8('0xcb')]=_0x4a6e82;}}catch(_0x546026){throw new db[(_0x50e8('0xcc'))][(_0x50e8('0xcd'))](_0x50e8('0xce'));}return rp(_0x4aa481);}else{throw new db['Sequelize'][(_0x50e8('0xcd'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x50e8('0x2a')](function(_0x224e44){_0x230791=_0x224e44;if(_0x230791['id']){var _0x4e33ff={'body':_0x230791['join_url'],'ChatWebsiteId':_0x4eb523['id'],'ChatInteractionId':_0x16e2fe['id'],'direction':_0x50e8('0xcf'),'UserId':_0x511606[_0x50e8('0x9c')]['id']};return db[_0x50e8('0xd0')]['create'](_0x4e33ff,{});}else{throw new db[(_0x50e8('0xcc'))]['ValidationError'](_0x50e8('0xd1'));}})[_0x50e8('0x2a')](function(){return _0x16e2fe[_0x50e8('0xd2')]({'vidaooSessionId':_0x230791['id']});})[_0x50e8('0x2a')](respondWithResult(_0x57ebe1,null))['catch'](handleError(_0x57ebe1,null));};exports[_0x50e8('0xd3')]=function(_0xe34b94,_0x3c07e0){if(_0xe34b94[_0x50e8('0x7d')]['id']){delete _0xe34b94['body']['id'];}return db[_0x50e8('0x45')]['find']({'where':{'id':_0xe34b94[_0x50e8('0xb8')]['id']},'include':[{'model':db['CmContact'],'as':_0x50e8('0xd4')}]})[_0x50e8('0x2a')](handleEntityNotFound(_0x3c07e0,null))[_0x50e8('0x2a')](saveUpdates(_0xe34b94[_0x50e8('0x7d')],null))[_0x50e8('0x2a')](respondWithResult(_0x3c07e0,null))[_0x50e8('0x3b')](handleError(_0x3c07e0,null));};exports['abandon']=function(_0x105640,_0x9f3ed5){if(_0x105640[_0x50e8('0x7d')]['id']){delete _0x105640[_0x50e8('0x7d')]['id'];}return db[_0x50e8('0x45')][_0x50e8('0x72')]({'where':{'id':_0x105640[_0x50e8('0xb8')]['id']}})[_0x50e8('0x2a')](function(_0x32f213){if(!_0x32f213){logger[_0x50e8('0x1c')](_0x50e8('0xd5'),'abandon',0x194,'entity\x20not\x20found');_0x9f3ed5[_0x50e8('0x20')](0x194);}else{if(_0x32f213[_0x50e8('0x42')]){throw new db[(_0x50e8('0xcc'))][(_0x50e8('0xcd'))]('Interaction\x20already\x20assigned');}}return _0x32f213;})[_0x50e8('0x2a')](function(_0x2b952b){if(_0x2b952b){return _0x2b952b['update']({'closed':_0x105640[_0x50e8('0x7d')][_0x50e8('0x41')],'disposition':_0x105640[_0x50e8('0x7d')][_0x50e8('0xd6')]})[_0x50e8('0x2a')](function(_0x41fff7){return _0x41fff7;});}})[_0x50e8('0x2a')](function(){return respondWithRpcPromise(_0x50e8('0xd7'),_0x50e8('0xd8'),_0x105640[_0x50e8('0x7d')],client9004);})[_0x50e8('0x2a')](respondWithResult(_0x9f3ed5,null))[_0x50e8('0x3b')](handleError(_0x9f3ed5,null));};exports['attachmentUpload']=function(_0x3a408d,_0x1cdea7){_0x3a408d[_0x50e8('0x7d')][_0x50e8('0x2d')]=_0x3a408d[_0x50e8('0xd9')][_0x50e8('0xda')];_0x3a408d[_0x50e8('0x7d')][_0x50e8('0xdb')]=_0x3a408d[_0x50e8('0xd9')]['filename'];_0x3a408d[_0x50e8('0x7d')][_0x50e8('0x47')]=_0x3a408d['file']['mimetype'];return db['Attachment'][_0x50e8('0xbd')](_0x3a408d[_0x50e8('0x7d')])['then'](respondWithResult(_0x1cdea7,0xc9))[_0x50e8('0x3b')](handleError(_0x1cdea7,null));};exports[_0x50e8('0xdc')]=function(_0x4eec14,_0x415022){return db[_0x50e8('0x45')]['findOne']({'where':{'id':_0x4eec14[_0x50e8('0xb8')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x415022,null))[_0x50e8('0x2a')](function(_0x358f4c){if(_0x358f4c){if(_0x358f4c['closed']){return _0x415022[_0x50e8('0x21')](0x193)[_0x50e8('0x22')]({'status':0x193,'message':_0x50e8('0xdd')});}return db['Attachment'][_0x50e8('0xc0')]({'where':{'id':_0x4eec14['query'][_0x50e8('0xde')]},'raw':!![]})['then'](handleEntityNotFound(_0x415022,null));}})['then'](function(_0x20f900){if(_0x20f900){var _0x3fba15=_0x20f900[_0x50e8('0xdf')]!==null;var _0x246bc3=path[_0x50e8('0xe0')](config['root'],_0x50e8('0xe1'));if(_0x3fba15){_0x246bc3=path[_0x50e8('0xe0')](_0x246bc3,_0x50e8('0xe2'));}var _0x5d976a=path['join'](_0x246bc3,_0x20f900[_0x50e8('0xdb')]);return _0x415022['download'](_0x5d976a);}})['catch'](handleError(_0x415022,null));};exports['close']=function(_0x96c8fe,_0x18eb34){var _0x4c5bfe=null;var _0x28886c=null;var _0xc62623=null;if(_0x96c8fe[_0x50e8('0x7d')]['id']){delete _0x96c8fe[_0x50e8('0x7d')]['id'];}if(_0x96c8fe[_0x50e8('0x7d')]['mailTranscript']){_0xc62623=path[_0x50e8('0xe0')](config[_0x50e8('0xe3')],_0x50e8('0xe4'),util[_0x50e8('0xe5')](_0x50e8('0xe6'),Date['now']()));_0x96c8fe[_0x50e8('0x7d')][_0x50e8('0xe7')]=_0xc62623;}return db[_0x50e8('0x45')][_0x50e8('0x72')]({'where':{'id':_0x96c8fe['params']['id']},'include':[{'model':db[_0x50e8('0xd0')],'as':_0x50e8('0xe8'),'include':[{'model':db[_0x50e8('0x7b')],'as':_0x50e8('0x7b')}]}]})['then'](handleEntityNotFound(_0x18eb34,null))[_0x50e8('0x2a')](saveUpdates(_0x96c8fe[_0x50e8('0x7d')],null))[_0x50e8('0x2a')](function(_0x4997d1){if(_0x4997d1){_0x4c5bfe=_0x4997d1;return db['ChatWebsite']['find']({'where':{'id':_0x4c5bfe['ChatWebsiteId']}});}})[_0x50e8('0x2a')](function(_0x1869f1){if(_0x1869f1){_0x28886c=_0x1869f1;return db[_0x50e8('0xe9')][_0x50e8('0x72')]({'where':{'id':_0x4c5bfe[_0x50e8('0x73')]}});}})[_0x50e8('0x2a')](function(_0x5c494d){if(_0x5c494d){if(_0xc62623){var _0x1f2e86=null;for(var _0x138cc2=0x1;_0x138cc2<_0x4c5bfe[_0x50e8('0xe8')]['length'];++_0x138cc2){_0x1f2e86=_0x4c5bfe[_0x50e8('0xe8')][_0x138cc2];var _0x2f6310=_0x1f2e86[_0x50e8('0x42')]?util['format'](_0x50e8('0xea'),_0x28886c['agentAlias'],_0x1f2e86[_0x50e8('0x42')]):'System';var _0x9cdbf6=_0x96c8fe[_0x50e8('0x7d')]['customer']||util[_0x50e8('0xe5')](_0x50e8('0xea'),_0x50e8('0xeb'),_0x1f2e86['ContactId']);switch(_0x28886c[_0x50e8('0xec')]){case _0x50e8('0xed'):_0x2f6310=_0x1f2e86['UserId']?util[_0x50e8('0xe5')](_0x50e8('0xea'),_0x28886c[_0x50e8('0xee')],_0x1f2e86[_0x50e8('0x42')]):_0x50e8('0xef');break;case _0x50e8('0xf0'):_0x2f6310=_0x1f2e86[_0x50e8('0x42')]?_0x1f2e86[_0x50e8('0x7b')][_0x50e8('0xf1')]||_0x1f2e86[_0x50e8('0x7b')][_0x50e8('0xc4')]:'System';break;case _0x50e8('0xf2'):_0x2f6310=_0x1f2e86[_0x50e8('0x42')]?_0x1f2e86[_0x50e8('0x7b')][_0x50e8('0xc4')]:'System';break;default:_0x2f6310=_0x1f2e86[_0x50e8('0x42')]?util[_0x50e8('0xe5')](_0x50e8('0xea'),_0x28886c['agentAlias'],_0x1f2e86[_0x50e8('0x42')]):_0x50e8('0xef');}var _0x229de0=util[_0x50e8('0xe5')](_0x50e8('0xf3'),moment(_0x1f2e86[_0x50e8('0xf4')])['format'](_0x50e8('0xf5')),_0x1f2e86[_0x50e8('0xf6')]==='in'?_0x9cdbf6:_0x2f6310,_0x1f2e86[_0x50e8('0x7d')]);if(!_0x1f2e86[_0x50e8('0xf7')]){fs[_0x50e8('0xf8')](_0xc62623,_0x229de0);}}return db['MailAccount'][_0x50e8('0xc0')]({'where':{'service':!![]},'include':[{'model':db[_0x50e8('0xf9')],'as':_0x50e8('0xfa'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x50e8('0x2a')](function(_0x336e22){if(!_0x336e22||!_0x336e22[_0x50e8('0xfa')]||!_0x96c8fe[_0x50e8('0x7d')])return _0x4c5bfe;var _0x1657bc=_0x336e22[_0x50e8('0xfb')]();return respondWithRpcPromise(_0x50e8('0xfc'),'sendMail',{'account':_0x1657bc,'message':{'from':util[_0x50e8('0xe5')](_0x50e8('0xfd'),_0x336e22[_0x50e8('0x2d')],_0x336e22[_0x50e8('0xc5')]||_0x336e22['Smtp'][_0x50e8('0x9c')]),'to':_0x96c8fe[_0x50e8('0x7d')][_0x50e8('0xfe')],'subject':_0x50e8('0xff'),'text':util[_0x50e8('0xe5')](_0x50e8('0x100'),_0x96c8fe[_0x50e8('0x7d')]['mailTranscript']),'attachments':[{'path':_0xc62623}]}})[_0x50e8('0x2a')](function(){return _0x4c5bfe;})['catch'](function(_0x34eb5d){logger[_0x50e8('0x1c')](_0x34eb5d);});})[_0x50e8('0x2a')](respondWithStatusCode(_0x18eb34,0xc8))[_0x50e8('0x3b')](handleError(_0x18eb34,null));};exports['addMessage']=function(_0x271d19,_0x45a8ff){return db['ChatMessage'][_0x50e8('0x72')]({'where':{'id':_0x271d19[_0x50e8('0xb8')]['id']}})[_0x50e8('0x2a')](handleEntityNotFound(_0x45a8ff,null))[_0x50e8('0x2a')](function(_0x2c4a90){if(_0x2c4a90){return _0x2c4a90[_0x50e8('0x101')](_0x271d19['body'][_0x50e8('0x102')],_[_0x50e8('0x103')](_0x271d19[_0x50e8('0x7d')],['ids','id'])||{});}})['then'](respondWithResult(_0x45a8ff,null))[_0x50e8('0x3b')](handleError(_0x45a8ff,null));};exports[_0x50e8('0x104')]=function(_0x2c8142,_0x1456aa){var _0x5f2cb3={'raw':![],'where':{}};var _0x1a77fb={};var _0xdcb7ce={'count':0x0,'rows':[]};return db[_0x50e8('0x45')]['findOne']({'where':{'id':_0x2c8142[_0x50e8('0xb8')]['id']}})[_0x50e8('0x2a')](handleEntityNotFound(_0x1456aa,null))[_0x50e8('0x2a')](function(_0x49c22c){if(_0x49c22c){_0x1a77fb[_0x50e8('0x49')]=_['keys'](db[_0x50e8('0xd0')][_0x50e8('0xb9')]);_0x1a77fb[_0x50e8('0x4a')]=_[_0x50e8('0x4b')](_0x2c8142['query']);_0x1a77fb['filters']=_[_0x50e8('0x4d')](_0x1a77fb[_0x50e8('0x49')],_0x1a77fb[_0x50e8('0x4a')]);_0x5f2cb3[_0x50e8('0x4f')]=_[_0x50e8('0x4d')](_0x1a77fb['model'],qs['fields'](_0x2c8142[_0x50e8('0x4a')]['fields']));_0x5f2cb3['attributes']=_0x5f2cb3[_0x50e8('0x4f')][_0x50e8('0x50')]?_0x5f2cb3[_0x50e8('0x4f')]:_0x1a77fb['model'];if(!_0x2c8142[_0x50e8('0x4a')][_0x50e8('0x105')](_0x50e8('0x51'))){_0x5f2cb3[_0x50e8('0x26')]=qs[_0x50e8('0x26')](_0x2c8142[_0x50e8('0x4a')]['limit']);_0x5f2cb3['offset']=qs[_0x50e8('0x23')](_0x2c8142[_0x50e8('0x4a')][_0x50e8('0x23')]);}_0x5f2cb3['order']=qs[_0x50e8('0x53')](_0x2c8142['query']['sort']);_0x5f2cb3[_0x50e8('0x54')]=qs[_0x50e8('0x4c')](_[_0x50e8('0x55')](_0x2c8142[_0x50e8('0x4a')],_0x1a77fb[_0x50e8('0x4c')]));_0x5f2cb3[_0x50e8('0x54')][_0x50e8('0xb5')]=_0x49c22c['id'];if(_0x2c8142[_0x50e8('0x4a')][_0x50e8('0x106')]){_0x5f2cb3['where']=_[_0x50e8('0x30')](_0x5f2cb3[_0x50e8('0x54')],{'$or':_[_0x50e8('0x35')](_0x5f2cb3[_0x50e8('0x4f')],function(_0x4952b4){var _0x3818cc={};_0x3818cc[_0x4952b4]={'$like':'%'+_0x2c8142['query']['filter']+'%'};return _0x3818cc;})});}if(_0x2c8142[_0x50e8('0x4a')][_0x50e8('0x81')]){var _0x51f73c=_0x2c8142[_0x50e8('0x4a')][_0x50e8('0x81')][_0x50e8('0x38')](',');var _0x1e4e44={};_0x1e4e44[_0x51f73c[0x0]]={'$gte':moment(_0x51f73c[0x1])['format'](_0x50e8('0x107'))};_0x5f2cb3[_0x50e8('0x54')]=_[_0x50e8('0x30')](_0x5f2cb3[_0x50e8('0x54')],_0x1e4e44);}_0x5f2cb3=_[_0x50e8('0x30')]({},_0x5f2cb3,_0x2c8142['options']);return db[_0x50e8('0xd0')][_0x50e8('0x25')]({'where':_0x5f2cb3[_0x50e8('0x54')]})[_0x50e8('0x2a')](function(_0x5c1ab2){_0xdcb7ce[_0x50e8('0x25')]=_0x5c1ab2;if(_0x2c8142['query'][_0x50e8('0xba')]){_0x5f2cb3[_0x50e8('0xbb')]=[{'all':!![]}];}return db[_0x50e8('0xd0')][_0x50e8('0x108')](_0x5f2cb3);})[_0x50e8('0x2a')](function(_0x329fff){_0xdcb7ce[_0x50e8('0x109')]=_0x329fff;return _0xdcb7ce;});}})[_0x50e8('0x2a')](respondWithFilteredResult(_0x1456aa,_0x5f2cb3))['catch'](handleError(_0x1456aa,null));};exports[_0x50e8('0x10a')]=function(_0x80fe2,_0x2a8b16){var _0x436ce2={'where':{}},_0x4942dd={},_0x812161={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x50e8('0xc0')]({'where':{'id':_0x80fe2[_0x50e8('0xb8')]['id']}})['then'](handleEntityNotFound(_0x2a8b16,null))['then'](function(_0x3e9cae){if(_0x3e9cae){_0x4942dd[_0x50e8('0x49')]=_[_0x50e8('0x4b')](db[_0x50e8('0xd0')][_0x50e8('0xb9')]);_0x4942dd['query']=_[_0x50e8('0x4b')](_0x80fe2[_0x50e8('0x4a')]);_0x4942dd[_0x50e8('0x4c')]=_['intersection'](_0x4942dd['model'],_0x4942dd['query']);_0x436ce2[_0x50e8('0x4f')]=_[_0x50e8('0x4d')](_0x4942dd[_0x50e8('0x49')],qs[_0x50e8('0x4e')](_0x80fe2[_0x50e8('0x4a')][_0x50e8('0x4e')]));_0x436ce2[_0x50e8('0x4f')]=_0x436ce2[_0x50e8('0x4f')]['length']?_0x436ce2[_0x50e8('0x4f')]:_0x4942dd['model'];if(!_0x80fe2[_0x50e8('0x4a')][_0x50e8('0x105')]('nolimit')){_0x436ce2[_0x50e8('0x26')]=qs['limit'](_0x80fe2[_0x50e8('0x4a')]['limit']);_0x436ce2[_0x50e8('0x23')]=qs['offset'](_0x80fe2[_0x50e8('0x4a')][_0x50e8('0x23')]);}_0x436ce2[_0x50e8('0x52')]=qs['sort'](_0x80fe2['query'][_0x50e8('0x53')]);_0x436ce2['where']=qs[_0x50e8('0x4c')](_['pick'](_0x80fe2['query'],_0x4942dd['filters']));_0x436ce2['where'][_0x50e8('0xb5')]=_0x3e9cae['id'];if(_0x80fe2[_0x50e8('0x4a')]['filter']){_0x436ce2[_0x50e8('0x54')]=_[_0x50e8('0x30')](_0x436ce2[_0x50e8('0x54')],{'$or':_['map'](_0x436ce2[_0x50e8('0x4f')],function(_0x2a3344){var _0x37a785={};_0x37a785[_0x2a3344]={'$like':'%'+_0x80fe2[_0x50e8('0x4a')][_0x50e8('0x106')]+'%'};return _0x37a785;})});}_0x436ce2['where']['secret']=![];if(_0x80fe2[_0x50e8('0x4a')]['id']){_0x436ce2[_0x50e8('0x54')]['id']={'$gt':_0x80fe2[_0x50e8('0x4a')]['id']};}_0x436ce2=_[_0x50e8('0x30')]({},_0x436ce2,_0x80fe2[_0x50e8('0xbc')]);return db[_0x50e8('0xd0')]['count']({'where':_0x436ce2[_0x50e8('0x54')]})[_0x50e8('0x2a')](function(_0x100d2d){_0x812161['count']=_0x100d2d;_0x436ce2[_0x50e8('0xbb')]=[];if(_0x80fe2[_0x50e8('0x4a')][_0x50e8('0x10b')]){_0x436ce2[_0x50e8('0xbb')]['push']({'model':db[_0x50e8('0x7b')],'as':_0x50e8('0x7b'),'attributes':['id',_0x50e8('0xc4'),_0x50e8('0xf1')]});}if(_0x80fe2[_0x50e8('0x4a')][_0x50e8('0xba')]){_0x436ce2[_0x50e8('0xbb')]=[{'all':!![]}];}return db[_0x50e8('0xd0')][_0x50e8('0x108')](_0x436ce2);})[_0x50e8('0x2a')](function(_0x26d4b4){_0x812161['rows']=_0x26d4b4;return _0x812161;});}})['then'](respondWithFilteredResult(_0x2a8b16,_0x436ce2))[_0x50e8('0x3b')](handleError(_0x2a8b16,null));};exports['addTags']=function(_0x5b564d,_0x45e5a0){return db[_0x50e8('0x45')][_0x50e8('0x72')]({'where':{'id':_0x5b564d[_0x50e8('0xb8')]['id']}})[_0x50e8('0x2a')](handleEntityNotFound(_0x45e5a0,null))[_0x50e8('0x2a')](function(_0xdda1e5){if(_0xdda1e5){return _0xdda1e5[_0x50e8('0x10c')](_0x5b564d[_0x50e8('0x7d')][_0x50e8('0x102')],_['omit'](_0x5b564d[_0x50e8('0x7d')],[_0x50e8('0x102'),'id'])||{})[_0x50e8('0x10d')](function(){return db['Tag'][_0x50e8('0x108')]({'attributes':['id','name',_0x50e8('0x57')],'where':{'id':_0x5b564d['body'][_0x50e8('0x102')]}});})[_0x50e8('0x2a')](function(_0x26fdc7){socket[_0x50e8('0x10e')](_0x50e8('0x10f'),{'id':Number(_0x5b564d[_0x50e8('0xb8')]['id']),'tags':_0x26fdc7||[]});return{'id':Number(_0x5b564d[_0x50e8('0xb8')]['id']),'tags':_0x26fdc7||[]};});}})[_0x50e8('0x2a')](respondWithResult(_0x45e5a0,null))[_0x50e8('0x3b')](handleError(_0x45e5a0,null));};exports['removeTags']=function(_0xba62b2,_0x2df2ce){return db[_0x50e8('0x45')][_0x50e8('0x72')]({'where':{'id':_0xba62b2[_0x50e8('0xb8')]['id']}})[_0x50e8('0x2a')](handleEntityNotFound(_0x2df2ce,null))[_0x50e8('0x2a')](function(_0x5d5537){if(_0x5d5537){return _0x5d5537[_0x50e8('0x110')](_0xba62b2[_0x50e8('0x4a')][_0x50e8('0x102')]);}})[_0x50e8('0x2a')](respondWithStatusCode(_0x2df2ce,null))[_0x50e8('0x3b')](handleError(_0x2df2ce,null));};exports[_0x50e8('0x111')]=function(_0x319b5a,_0x26fa2c){var _0x40ecf7=moment()[_0x50e8('0x112')]()['toString']();var _0x56d2e6=path[_0x50e8('0xe0')](config[_0x50e8('0xe3')],_0x50e8('0x113'),_0x50e8('0x114'),_0x50e8('0x115'));var _0x32c089=path[_0x50e8('0xe0')](config[_0x50e8('0xe3')],_0x50e8('0x113'),_0x50e8('0x114'),_0x50e8('0x116'));var _0x1c2fd5=path[_0x50e8('0xe0')](_0x56d2e6,_0x40ecf7);var _0x289024=util['format'](_0x50e8('0x117'),_0x319b5a['params']['id'],_0x40ecf7);var _0x1abc45=path[_0x50e8('0xe0')](_0x56d2e6,_0x289024);var _0x6c75c2=[];_0x6c75c2[_0x50e8('0x3a')]({'model':db[_0x50e8('0x7b')],'as':_0x50e8('0x7b'),'attributes':['id',_0x50e8('0xc4')],'raw':!![]});_0x6c75c2[_0x50e8('0x3a')]({'model':db['CmContact'],'as':_0x50e8('0xd4'),'attributes':['id',_0x50e8('0x118'),_0x50e8('0x119')],'raw':!![]});if(_0x319b5a['query'][_0x50e8('0x116')]){_0x6c75c2['push']({'model':db[_0x50e8('0x11a')],'as':_0x50e8('0x11a'),'raw':!![]});}var _0x8ca769=[{'model':db[_0x50e8('0xd0')],'as':_0x50e8('0xe8'),'attributes':['id',_0x50e8('0x7d'),_0x50e8('0xf4'),_0x50e8('0xf6'),_0x50e8('0xf7'),_0x50e8('0x88')],'include':_0x6c75c2}];_0x8ca769['push']({'model':db['ChatWebsite'],'as':_0x50e8('0x11b'),'attributes':['id',_0x50e8('0x2d')]});_0x8ca769[_0x50e8('0x3a')]({'model':db[_0x50e8('0x7b')],'as':_0x50e8('0x11c'),'attributes':['id',_0x50e8('0xc4')]});return db[_0x50e8('0x45')][_0x50e8('0x72')]({'where':{'id':_0x319b5a['params']['id']},'include':_0x8ca769})['then'](handleEntityNotFound(_0x26fa2c,null))[_0x50e8('0x2a')](function(_0x2a030f){if(_0x2a030f){var _0x57e649=_0x2a030f['get']({'plain':!![]});fs[_0x50e8('0x11d')](_0x1c2fd5);var _0x3f342b={'channel':'Chat','account':_0x57e649[_0x50e8('0x11b')][_0x50e8('0x2d')],'agent':_0x57e649[_0x50e8('0x11c')]?_0x57e649[_0x50e8('0x11c')]['fullname']:_0x50e8('0x11e'),'createdAt':moment(_0x57e649[_0x50e8('0xf4')])[_0x50e8('0xe5')](_0x50e8('0x107'))[_0x50e8('0x9e')](),'closedAt':_0x57e649[_0x50e8('0x41')]?moment(_0x57e649[_0x50e8('0x11f')])[_0x50e8('0xe5')](_0x50e8('0x107'))['toString']():'','disposition':_0x57e649['disposition'],'chatInfo':{'browser':_0x57e649['browserName'],'os':_0x57e649[_0x50e8('0x120')],'referer':_0x57e649[_0x50e8('0x121')],'customerIp':_0x57e649[_0x50e8('0x122')],'customerPort':_0x57e649[_0x50e8('0x123')]?_0x57e649[_0x50e8('0x123')]:'N.A.'},'messages':_(_0x57e649[_0x50e8('0xe8')])[_0x50e8('0x124')]()['filter']({'secret':![]})[_0x50e8('0x35')](function(_0x53bad8){if(_0x53bad8[_0x50e8('0x11a')]){var _0x30d372=path[_0x50e8('0xe0')](_0x32c089,_0x53bad8[_0x50e8('0x11a')][_0x50e8('0xdb')]);if(fs[_0x50e8('0x125')](_0x30d372)){fs[_0x50e8('0x126')](_0x30d372)[_0x50e8('0x127')](fs['createWriteStream'](path[_0x50e8('0xe0')](_0x1c2fd5,_0x53bad8[_0x50e8('0x11a')][_0x50e8('0xdb')])));}}return{'date':moment(_0x53bad8[_0x50e8('0xf4')])[_0x50e8('0xe5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x50e8('0x9e')](),'sender':_0x53bad8[_0x50e8('0xf6')]==='out'?_0x53bad8[_0x50e8('0x7b')]?_0x53bad8[_0x50e8('0x7b')]['fullname']:'System':_0x53bad8[_0x50e8('0xd4')]['firstName']+(_0x53bad8[_0x50e8('0xd4')][_0x50e8('0x119')]?'\x20'+_0x53bad8['Contact'][_0x50e8('0x119')]:''),'body':_0x53bad8['Attachment']?_0x53bad8[_0x50e8('0x11a')][_0x50e8('0xdb')]:_0x53bad8[_0x50e8('0x7d')],'direction':_0x53bad8['direction']==='out'?'A':'C','secret':_0x53bad8[_0x50e8('0xf7')],'read':_0x53bad8[_0x50e8('0x88')],'attachment':_0x53bad8['Attachment']};})[_0x50e8('0x76')]()};return ejs[_0x50e8('0x128')](path[_0x50e8('0xe0')](config[_0x50e8('0xe3')],_0x50e8('0x113'),'views',_0x50e8('0x129')),{'interaction':_0x3f342b})[_0x50e8('0x2a')](function(_0x1e3192){var _0x4c294b=path[_0x50e8('0xe0')](_0x1c2fd5,_0x50e8('0x12a')+_0x57e649['id']+'-'+_0x40ecf7+_0x50e8('0x12b'));var _0x3b0c3d={'path':_0x4c294b,'channel':'Chat','interactionId':_0x57e649['id']};return pdf[_0x50e8('0x12c')](_0x1e3192,_0x3b0c3d);})[_0x50e8('0x2a')](function(){return new Promise(function(_0x23eec2,_0x19cf56){zipdir(_0x1c2fd5,{'saveTo':_0x1abc45},function(_0x595588,_0x30f8c9){if(_0x595588)return _0x19cf56(_0x595588);return _0x23eec2(_0x30f8c9);});})[_0x50e8('0x2a')](function(){return new BPromise(function(_0x26fa23,_0x278f3d){rimraf(_0x1c2fd5,function(_0x441ad6){if(_0x441ad6)_0x278f3d(_0x441ad6);return _0x26fa23();});});})[_0x50e8('0x2a')](function(){return _0x26fa2c[_0x50e8('0x111')](_0x1abc45,_0x289024,function(_0x3281d8){if(_0x3281d8){logger[_0x50e8('0x1c')](_0x50e8('0x12d'),_0x3281d8);}else{fs[_0x50e8('0x12e')](_0x1abc45);}});});});}else{return _0x26fa2c[_0x50e8('0x20')](0xc8);}})[_0x50e8('0x3b')](handleError(_0x26fa2c,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 0ea600f..952731f 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 _0xb558=['ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','then','length','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction'];(function(_0x3a0019,_0x393997){var _0x135e81=function(_0x2ee99a){while(--_0x2ee99a){_0x3a0019['push'](_0x3a0019['shift']());}};_0x135e81(++_0x393997);}(_0xb558,0x11d));var _0x8b55=function(_0x3470bb,_0x34e3de){_0x3470bb=_0x3470bb-0x0;var _0x51fe56=_0xb558[_0x3470bb];return _0x51fe56;};'use strict';var EventEmitter=require(_0x8b55('0x0'));var ChatInteraction=require(_0x8b55('0x1'))['db'][_0x8b55('0x2')];var ChatMessage=require(_0x8b55('0x1'))['db'][_0x8b55('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8b55('0x4')](0x0);var events={'afterCreate':_0x8b55('0x5'),'afterUpdate':_0x8b55('0x6'),'afterDestroy':_0x8b55('0x7')};function emitEvent(_0x14f451){return function(_0x5cd075,_0x1186b0,_0x51f856){_0x5cd075[_0x8b55('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x72e5f5){_0x5cd075[_0x8b55('0x9')]('Users',_0x72e5f5[_0x8b55('0xa')](function(_0xca360f){return{'id':_0xca360f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x5cd075['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b55('0xb')](function(_0x2ee81d){_0x5cd075[_0x8b55('0x9')]('unreadMessages',_0x2ee81d[_0x8b55('0xc')]);ChatInteractionEvents[_0x8b55('0xd')](_0x14f451+':'+_0x5cd075['id'],_0x5cd075);ChatInteractionEvents[_0x8b55('0xd')](_0x14f451,_0x5cd075);_0x51f856(null);})['catch'](_0x51f856(null));};}for(var e in events){if(events[_0x8b55('0xe')](e)){var event=events[e];ChatInteraction[_0x8b55('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x0478=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x0478,0x1b8));var _0x8047=function(_0x2db45e,_0x3c3b37){_0x2db45e=_0x2db45e-0x0;var _0x200a5=_0x0478[_0x2db45e];return _0x200a5;};'use strict';var EventEmitter=require(_0x8047('0x0'));var ChatInteraction=require(_0x8047('0x1'))['db'][_0x8047('0x2')];var ChatMessage=require(_0x8047('0x1'))['db'][_0x8047('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8047('0x4')](0x0);var events={'afterCreate':_0x8047('0x5'),'afterUpdate':_0x8047('0x6'),'afterDestroy':_0x8047('0x7')};function emitEvent(_0x321114){return function(_0x420ad6,_0x16f0d6,_0x5da817){_0x420ad6[_0x8047('0x8')]({'attributes':['id'],'raw':!![]})[_0x8047('0x9')](function(_0x4e3c2a){_0x420ad6[_0x8047('0xa')](_0x8047('0xb'),_0x4e3c2a[_0x8047('0xc')](function(_0x158f57){return{'id':_0x158f57['id']};}));return ChatMessage[_0x8047('0xd')]({'where':{'ChatInteractionId':_0x420ad6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8047('0x9')](function(_0x393dd5){_0x420ad6[_0x8047('0xa')](_0x8047('0xe'),_0x393dd5[_0x8047('0xf')]);ChatInteractionEvents[_0x8047('0x10')](_0x321114+':'+_0x420ad6['id'],_0x420ad6);ChatInteractionEvents[_0x8047('0x10')](_0x321114,_0x420ad6);_0x5da817(null);})['catch'](_0x5da817(null));};}for(var e in events){if(events[_0x8047('0x11')](e)){var event=events[e];ChatInteraction[_0x8047('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 68e4908..997a12e 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 _0x5539=['chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define'];(function(_0x44eb28,_0x4c4308){var _0x4da0d9=function(_0x2e5c21){while(--_0x2e5c21){_0x44eb28['push'](_0x44eb28['shift']());}};_0x4da0d9(++_0x4c4308);}(_0x5539,0x97));var _0x9553=function(_0x7dd4f6,_0x25fd40){_0x7dd4f6=_0x7dd4f6-0x0;var _0x10809e=_0x5539[_0x7dd4f6];return _0x10809e;};'use strict';var _=require(_0x9553('0x0'));var util=require(_0x9553('0x1'));var logger=require(_0x9553('0x2'))(_0x9553('0x3'));var moment=require(_0x9553('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9553('0x5'));var rimraf=require(_0x9553('0x6'));var config=require(_0x9553('0x7'));var attributes=require(_0x9553('0x8'));module[_0x9553('0x9')]=function(_0x4ebf20,_0xa886ac){return _0x4ebf20[_0x9553('0xa')]('ChatInteraction',attributes,{'tableName':_0x9553('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41fb17,_0x1d5a47,_0x3412c0){if(_0x41fb17[_0x9553('0xc')](_0x9553('0xd'))){_0x41fb17[_0x9553('0xe')]=moment()[_0x9553('0xf')](_0x9553('0x10'));}_0x3412c0(null,_0x41fb17);}},'charset':'utf8mb4','collate':_0x9553('0x11')});}; \ No newline at end of file +var _0x6702=['changed','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','exports','chat_interactions'];(function(_0x4d2f79,_0x41ca68){var _0x2540c6=function(_0x199db0){while(--_0x199db0){_0x4d2f79['push'](_0x4d2f79['shift']());}};_0x2540c6(++_0x41ca68);}(_0x6702,0x18d));var _0x2670=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x6702[_0x39e84d];return _0x1991bc;};'use strict';var _=require('lodash');var util=require(_0x2670('0x0'));var logger=require('../../config/logger')(_0x2670('0x1'));var moment=require(_0x2670('0x2'));var BPromise=require(_0x2670('0x3'));var rp=require(_0x2670('0x4'));var fs=require('fs');var path=require(_0x2670('0x5'));var rimraf=require(_0x2670('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x2670('0x7')]=function(_0x12489e,_0x4ebd95){return _0x12489e['define']('ChatInteraction',attributes,{'tableName':_0x2670('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x276c99,_0x85a18c,_0x5a9957){if(_0x276c99[_0x2670('0x9')](_0x2670('0xa'))){_0x276c99['closedAt']=moment()['format'](_0x2670('0xb'));}_0x5a9957(null,_0x276c99);}},'charset':_0x2670('0xc'),'collate':_0x2670('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d2c2088..2a6c3e1 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 _0x2e38=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','then','AddTagsToChatInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring'];(function(_0x456f1c,_0x4453d5){var _0x51918c=function(_0x12ce55){while(--_0x12ce55){_0x456f1c['push'](_0x456f1c['shift']());}};_0x51918c(++_0x4453d5);}(_0x2e38,0x1be));var _0x82e3=function(_0x4c9ee6,_0x90caf9){_0x4c9ee6=_0x4c9ee6-0x0;var _0x130ee8=_0x2e38[_0x4c9ee6];return _0x130ee8;};'use strict';var _=require(_0x82e3('0x0'));var util=require(_0x82e3('0x1'));var moment=require('moment');var BPromise=require(_0x82e3('0x2'));var rs=require(_0x82e3('0x3'));var fs=require('fs');var Redis=require(_0x82e3('0x4'));var db=require(_0x82e3('0x5'))['db'];var utils=require(_0x82e3('0x6'));var logger=require(_0x82e3('0x7'))(_0x82e3('0x8'));var config=require(_0x82e3('0x9'));var jayson=require(_0x82e3('0xa'));var client=jayson[_0x82e3('0xb')][_0x82e3('0xc')]({'port':0x232a});config[_0x82e3('0xd')]=_['defaults'](config[_0x82e3('0xd')],{'host':_0x82e3('0xe'),'port':0x18eb});var socket=require(_0x82e3('0xf'))(new Redis(config[_0x82e3('0xd')]));require(_0x82e3('0x10'))[_0x82e3('0x11')](socket);function respondWithRpcPromise(_0xd16f14,_0x40bf12,_0x56e175){return new BPromise(function(_0x47290,_0x4e8cd4){return client[_0x82e3('0x12')](_0xd16f14,_0x56e175)['then'](function(_0x46dfc3){logger['info'](_0x82e3('0x13'),_0x40bf12,_0x82e3('0x14'));logger[_0x82e3('0x15')](_0x82e3('0x16'),_0x40bf12,_0x82e3('0x14'),JSON[_0x82e3('0x17')](_0x46dfc3));if(_0x46dfc3[_0x82e3('0x18')]){if(_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x19')]===0x1f4){logger['error'](_0x82e3('0x13'),_0x40bf12,_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x1a')]);return _0x4e8cd4(_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x1a')]);}logger[_0x82e3('0x18')](_0x82e3('0x13'),_0x40bf12,_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x1a')]);return _0x47290(_0x46dfc3[_0x82e3('0x18')]['message']);}else{logger[_0x82e3('0x1b')](_0x82e3('0x13'),_0x40bf12,'request\x20sent');_0x47290(_0x46dfc3[_0x82e3('0x1c')]['message']);}})[_0x82e3('0x1d')](function(_0x3781c5){logger[_0x82e3('0x18')](_0x82e3('0x13'),_0x40bf12,_0x3781c5);_0x4e8cd4(_0x3781c5);});});}exports[_0x82e3('0x1e')]=function(_0x707dc8){var _0x470711=this;return new Promise(function(_0x28bfba,_0x2bfc32){return db[_0x82e3('0x1f')][_0x82e3('0x20')](_0x707dc8['body'],{'raw':_0x707dc8[_0x82e3('0x21')]?_0x707dc8[_0x82e3('0x21')][_0x82e3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x707dc8[_0x82e3('0x21')]?_0x707dc8[_0x82e3('0x21')][_0x82e3('0x23')]||null:null,'attributes':_0x707dc8[_0x82e3('0x21')]?_0x707dc8[_0x82e3('0x21')][_0x82e3('0x24')]||null:null,'limit':_0x707dc8['options']?_0x707dc8[_0x82e3('0x21')]['limit']||null:null})[_0x82e3('0x25')](function(_0x45756c){logger[_0x82e3('0x1b')]('UpdateChatInteraction',_0x707dc8);logger[_0x82e3('0x15')](_0x82e3('0x1e'),_0x707dc8,JSON['stringify'](_0x45756c));_0x28bfba(_0x45756c);})['catch'](function(_0x12449b){logger[_0x82e3('0x18')](_0x82e3('0x1e'),_0x12449b['message'],_0x707dc8);_0x2bfc32(_0x470711['error'](0x1f4,_0x12449b[_0x82e3('0x1a')]));});});};exports[_0x82e3('0x26')]=function(_0x3efef6){return new Promise(function(_0x49da7a,_0x43918b){return db[_0x82e3('0x1f')]['find']({'where':_0x3efef6[_0x82e3('0x21')]?_0x3efef6['options'][_0x82e3('0x23')]||null:null})[_0x82e3('0x25')](function(_0x33b764){if(_0x33b764){return _0x33b764[_0x82e3('0x27')](_0x3efef6[_0x82e3('0x28')][_0x82e3('0x29')],_[_0x82e3('0x2a')](_0x3efef6[_0x82e3('0x28')],[_0x82e3('0x29'),'id'])||{});}})[_0x82e3('0x2b')](function(_0x37d4dc){logger['info'](_0x82e3('0x2c'),_0x3efef6);logger[_0x82e3('0x15')]('AddTags',_0x3efef6,JSON[_0x82e3('0x17')](_0x37d4dc));_0x49da7a(_0x37d4dc);})[_0x82e3('0x1d')](function(_0x435c29){logger[_0x82e3('0x18')](_0x82e3('0x2c'),_0x435c29['message'],_0x3efef6);_0x43918b(_this[_0x82e3('0x18')](0x1f4,_0x435c29['message']));});});}; \ No newline at end of file +var _0x60f6=['request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','debug','find','addTags','body','ids','omit','spread','AddTags','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatInteraction.socket','request','then','info'];(function(_0x4544a7,_0x4a889b){var _0x3d2c1c=function(_0x4b129e){while(--_0x4b129e){_0x4544a7['push'](_0x4544a7['shift']());}};_0x3d2c1c(++_0x4a889b);}(_0x60f6,0x66));var _0x660f=function(_0x6efecb,_0xa11209){_0x6efecb=_0x6efecb-0x0;var _0x289d48=_0x60f6[_0x6efecb];return _0x289d48;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x660f('0x0'));var BPromise=require(_0x660f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x660f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x660f('0x3'));var logger=require(_0x660f('0x4'))(_0x660f('0x5'));var config=require(_0x660f('0x6'));var jayson=require(_0x660f('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x660f('0x8')]=_[_0x660f('0x9')](config[_0x660f('0x8')],{'host':_0x660f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x660f('0x8')]));require(_0x660f('0xb'))['register'](socket);function respondWithRpcPromise(_0x31228d,_0x348fe3,_0x55a4e4){return new BPromise(function(_0xdc57d0,_0xd3962f){return client[_0x660f('0xc')](_0x31228d,_0x55a4e4)[_0x660f('0xd')](function(_0x2f670f){logger[_0x660f('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x348fe3,_0x660f('0xf'));logger['debug'](_0x660f('0x10'),_0x348fe3,_0x660f('0xf'),JSON[_0x660f('0x11')](_0x2f670f));if(_0x2f670f[_0x660f('0x12')]){if(_0x2f670f['error']['code']===0x1f4){logger[_0x660f('0x12')](_0x660f('0x13'),_0x348fe3,_0x2f670f[_0x660f('0x12')][_0x660f('0x14')]);return _0xd3962f(_0x2f670f[_0x660f('0x12')][_0x660f('0x14')]);}logger[_0x660f('0x12')](_0x660f('0x13'),_0x348fe3,_0x2f670f[_0x660f('0x12')][_0x660f('0x14')]);return _0xdc57d0(_0x2f670f[_0x660f('0x12')]['message']);}else{logger[_0x660f('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x348fe3,'request\x20sent');_0xdc57d0(_0x2f670f[_0x660f('0x15')]['message']);}})[_0x660f('0x16')](function(_0x2346d7){logger[_0x660f('0x12')](_0x660f('0x13'),_0x348fe3,_0x2346d7);_0xd3962f(_0x2346d7);});});}exports[_0x660f('0x17')]=function(_0x36c988){var _0x1dbc56=this;return new Promise(function(_0xbcba,_0x3161b5){return db[_0x660f('0x18')][_0x660f('0x19')](_0x36c988['body'],{'raw':_0x36c988[_0x660f('0x1a')]?_0x36c988[_0x660f('0x1a')][_0x660f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36c988['options']?_0x36c988['options'][_0x660f('0x1c')]||null:null,'attributes':_0x36c988[_0x660f('0x1a')]?_0x36c988['options'][_0x660f('0x1d')]||null:null,'limit':_0x36c988['options']?_0x36c988[_0x660f('0x1a')][_0x660f('0x1e')]||null:null})[_0x660f('0xd')](function(_0x293ba1){logger[_0x660f('0xe')](_0x660f('0x17'),_0x36c988);logger[_0x660f('0x1f')](_0x660f('0x17'),_0x36c988,JSON[_0x660f('0x11')](_0x293ba1));_0xbcba(_0x293ba1);})[_0x660f('0x16')](function(_0x1f7e1a){logger['error'](_0x660f('0x17'),_0x1f7e1a[_0x660f('0x14')],_0x36c988);_0x3161b5(_0x1dbc56['error'](0x1f4,_0x1f7e1a[_0x660f('0x14')]));});});};exports['AddTagsToChatInteraction']=function(_0x22d977){return new Promise(function(_0x22990a,_0x4e01c1){return db[_0x660f('0x18')][_0x660f('0x20')]({'where':_0x22d977['options']?_0x22d977[_0x660f('0x1a')][_0x660f('0x1c')]||null:null})[_0x660f('0xd')](function(_0x1a9570){if(_0x1a9570){return _0x1a9570[_0x660f('0x21')](_0x22d977[_0x660f('0x22')][_0x660f('0x23')],_[_0x660f('0x24')](_0x22d977['body'],[_0x660f('0x23'),'id'])||{});}})[_0x660f('0x25')](function(_0xa9f113){logger['info'](_0x660f('0x26'),_0x22d977);logger[_0x660f('0x1f')](_0x660f('0x26'),_0x22d977,JSON[_0x660f('0x11')](_0xa9f113));_0x22990a(_0xa9f113);})['catch'](function(_0x1576c1){logger[_0x660f('0x12')]('AddTags',_0x1576c1[_0x660f('0x14')],_0x22d977);_0x4e01c1(_this[_0x660f('0x12')](0x1f4,_0x1576c1[_0x660f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index eb753c4..c798742 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 _0x4349=['update','emit','length','chatInteraction:','save'];(function(_0x4ba1e7,_0x23b5ef){var _0xafdfb6=function(_0x1c6ca8){while(--_0x1c6ca8){_0x4ba1e7['push'](_0x4ba1e7['shift']());}};_0xafdfb6(++_0x23b5ef);}(_0x4349,0x1c6));var _0x9434=function(_0x4c6327,_0xcbdd4b){_0x4c6327=_0x4c6327-0x0;var _0x3c8bc1=_0x4349[_0x4c6327];return _0x3c8bc1;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x9434('0x0'),'remove',_0x9434('0x1')];function createListener(_0x428503,_0x2ef439){return function(_0x2c46cc){_0x2ef439[_0x9434('0x2')](_0x428503,_0x2c46cc);};}function removeListener(_0x15817c,_0x46c92d){return function(){ChatInteractionEvents['removeListener'](_0x15817c,_0x46c92d);};}exports['register']=function(_0xa89207){for(var _0x5b80b0=0x0,_0x29a394=events[_0x9434('0x3')];_0x5b80b0<_0x29a394;_0x5b80b0++){var _0x24af73=events[_0x5b80b0];var _0x4270b1=createListener(_0x9434('0x4')+_0x24af73,_0xa89207);ChatInteractionEvents['on'](_0x24af73,_0x4270b1);}}; \ No newline at end of file +var _0xaf65=['save','remove','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x42b2f4,_0x460144){var _0x1bb349=function(_0xfbda02){while(--_0xfbda02){_0x42b2f4['push'](_0x42b2f4['shift']());}};_0x1bb349(++_0x460144);}(_0xaf65,0x1c7));var _0x5af6=function(_0x50ab8f,_0x18237d){_0x50ab8f=_0x50ab8f-0x0;var _0x298d39=_0xaf65[_0x50ab8f];return _0x298d39;};'use strict';var ChatInteractionEvents=require(_0x5af6('0x0'));var events=[_0x5af6('0x1'),_0x5af6('0x2'),_0x5af6('0x3')];function createListener(_0x4f1e94,_0x1921cb){return function(_0x5889b8){_0x1921cb[_0x5af6('0x4')](_0x4f1e94,_0x5889b8);};}function removeListener(_0xd172c7,_0x401021){return function(){ChatInteractionEvents[_0x5af6('0x5')](_0xd172c7,_0x401021);};}exports[_0x5af6('0x6')]=function(_0x1744d3){for(var _0x2be59b=0x0,_0x45b67d=events['length'];_0x2be59b<_0x45b67d;_0x2be59b++){var _0x3f64df=events[_0x2be59b];var _0x5de271=createListener(_0x5af6('0x7')+_0x3f64df,_0x1744d3);ChatInteractionEvents['on'](_0x3f64df,_0x5de271);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index cbd981f..c94706d 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 _0x1a77=['isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','/:id/messages','addMessage','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','put','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0xa670ec,_0x14fc26){var _0x117e86=function(_0x46d765){while(--_0x46d765){_0xa670ec['push'](_0xa670ec['shift']());}};_0x117e86(++_0x14fc26);}(_0x1a77,0x12c));var _0x71a7=function(_0x31fac5,_0x48230e){_0x31fac5=_0x31fac5-0x0;var _0x1521db=_0x1a77[_0x31fac5];return _0x1521db;};'use strict';var multer=require(_0x71a7('0x0'));var util=require(_0x71a7('0x1'));var path=require(_0x71a7('0x2'));var timeout=require('connect-timeout');var express=require(_0x71a7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x71a7('0x4'));var interaction=require(_0x71a7('0x5'));var config=require(_0x71a7('0x6'));var controller=require(_0x71a7('0x7'));router[_0x71a7('0x8')]('/',auth[_0x71a7('0x9')](),controller[_0x71a7('0xa')]);router[_0x71a7('0x8')](_0x71a7('0xb'),auth[_0x71a7('0x9')](),controller['describe']);router[_0x71a7('0x8')]('/:id',auth[_0x71a7('0xc')](),controller[_0x71a7('0xd')]);router['get'](_0x71a7('0xe'),auth[_0x71a7('0xc')](),controller['attachmentDownload']);router[_0x71a7('0x8')]('/:id/messages',auth[_0x71a7('0x9')](),controller[_0x71a7('0xf')]);router[_0x71a7('0x8')](_0x71a7('0x10'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x71a7('0x8')](_0x71a7('0x11'),auth['isAuthenticated'](),controller[_0x71a7('0x12')]);router[_0x71a7('0x13')]('/',auth[_0x71a7('0x9')](),controller[_0x71a7('0x14')]);router[_0x71a7('0x13')](_0x71a7('0x15'),auth[_0x71a7('0x9')](),controller[_0x71a7('0x16')]);var upload=multer({'storage':multer[_0x71a7('0x17')]({'destination':function(_0x36a5be,_0x160b4d,_0x47a47e){_0x47a47e(null,path[_0x71a7('0x18')](config[_0x71a7('0x19')],_0x71a7('0x1a')));},'filename':function(_0x3f59f7,_0x2fe6d9,_0x2317ca){_0x2317ca(null,util[_0x71a7('0x1b')](_0x71a7('0x1c'),Date[_0x71a7('0x1d')](),_0x2fe6d9[_0x71a7('0x1e')][_0x71a7('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x71a7('0x13')]('/:id/attachment_upload',upload[_0x71a7('0x20')]('file'),controller['attachmentUpload']);router['post'](_0x71a7('0x21'),auth[_0x71a7('0xc')](),controller[_0x71a7('0x22')]);router[_0x71a7('0x13')]('/:id/tags',auth[_0x71a7('0x9')](),interaction['tracked'](_0x71a7('0x23'),_0x71a7('0x24')),controller[_0x71a7('0x25')]);router['put']('/:id',auth[_0x71a7('0x9')](),interaction['tracked'](_0x71a7('0x23'),_0x71a7('0x26')),controller[_0x71a7('0x27')]);router['put'](_0x71a7('0x28'),controller[_0x71a7('0x29')]);router['put'](_0x71a7('0x2a'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x71a7('0x2b')](_0x71a7('0x2c'),controller[_0x71a7('0x2d')]);router[_0x71a7('0x2e')](_0x71a7('0x2f'),auth[_0x71a7('0x9')](),interaction['tracked']('chat',_0x71a7('0x30')),controller[_0x71a7('0x31')]);router[_0x71a7('0x2e')](_0x71a7('0x32'),auth[_0x71a7('0x9')](),controller[_0x71a7('0x33')]);module['exports']=router; \ No newline at end of file +var _0x1f3f=['customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update'];(function(_0x218669,_0x44ac90){var _0x8606d9=function(_0x538da8){while(--_0x538da8){_0x218669['push'](_0x218669['shift']());}};_0x8606d9(++_0x44ac90);}(_0x1f3f,0xd5));var _0xf1f3=function(_0x363b89,_0x2f2e75){_0x363b89=_0x363b89-0x0;var _0x2ffc54=_0x1f3f[_0x363b89];return _0x2ffc54;};'use strict';var multer=require(_0xf1f3('0x0'));var util=require(_0xf1f3('0x1'));var path=require('path');var timeout=require(_0xf1f3('0x2'));var express=require(_0xf1f3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf1f3('0x4'));var interaction=require(_0xf1f3('0x5'));var config=require('../../config/environment');var controller=require(_0xf1f3('0x6'));router[_0xf1f3('0x7')]('/',auth[_0xf1f3('0x8')](),controller['index']);router['get'](_0xf1f3('0x9'),auth[_0xf1f3('0x8')](),controller['describe']);router['get'](_0xf1f3('0xa'),auth[_0xf1f3('0xb')](),controller['show']);router[_0xf1f3('0x7')](_0xf1f3('0xc'),auth[_0xf1f3('0xb')](),controller[_0xf1f3('0xd')]);router[_0xf1f3('0x7')]('/:id/messages',auth[_0xf1f3('0x8')](),controller['getMessages']);router[_0xf1f3('0x7')](_0xf1f3('0xe'),auth[_0xf1f3('0xb')](),controller[_0xf1f3('0xf')]);router[_0xf1f3('0x7')](_0xf1f3('0x10'),auth['isAuthenticated'](),controller[_0xf1f3('0x11')]);router[_0xf1f3('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf1f3('0x12')](_0xf1f3('0x13'),auth[_0xf1f3('0x8')](),controller[_0xf1f3('0x14')]);var upload=multer({'storage':multer[_0xf1f3('0x15')]({'destination':function(_0x3ce98b,_0xea0c6d,_0x1e5c8a){_0x1e5c8a(null,path[_0xf1f3('0x16')](config[_0xf1f3('0x17')],_0xf1f3('0x18')));},'filename':function(_0x57620a,_0x5830fe,_0x3c534d){_0x3c534d(null,util[_0xf1f3('0x19')](_0xf1f3('0x1a'),Date[_0xf1f3('0x1b')](),_0x5830fe[_0xf1f3('0x1c')][_0xf1f3('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf1f3('0x12')](_0xf1f3('0x1e'),upload[_0xf1f3('0x1f')](_0xf1f3('0x20')),controller[_0xf1f3('0x21')]);router[_0xf1f3('0x12')](_0xf1f3('0x22'),auth['isChatInteractionAuthorized'](),controller[_0xf1f3('0x23')]);router[_0xf1f3('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xf1f3('0x24')](_0xf1f3('0x25'),_0xf1f3('0x26')),controller[_0xf1f3('0x27')]);router[_0xf1f3('0x28')](_0xf1f3('0xa'),auth[_0xf1f3('0x8')](),interaction[_0xf1f3('0x24')](_0xf1f3('0x25'),_0xf1f3('0x29')),controller['update']);router[_0xf1f3('0x28')]('/:id/custom_update',controller[_0xf1f3('0x2a')]);router['put'](_0xf1f3('0x2b'),auth[_0xf1f3('0xb')](),controller[_0xf1f3('0x2c')]);router[_0xf1f3('0x28')](_0xf1f3('0x2d'),controller['close']);router[_0xf1f3('0x2e')](_0xf1f3('0xa'),auth[_0xf1f3('0x8')](),interaction[_0xf1f3('0x24')](_0xf1f3('0x25'),_0xf1f3('0x2f')),controller[_0xf1f3('0x30')]);router['delete']('/:id/tags',auth[_0xf1f3('0x8')](),controller[_0xf1f3('0x31')]);module[_0xf1f3('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4a49058..82f24c9 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 _0x6aeb=['medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x53955a,_0x1177fd){var _0x146e46=function(_0x5b1535){while(--_0x5b1535){_0x53955a['push'](_0x53955a['shift']());}};_0x146e46(++_0x1177fd);}(_0x6aeb,0x139));var _0xb6ae=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x6aeb[_0x2e6dbf];return _0x2680e5;};'use strict';var Sequelize=require(_0xb6ae('0x0'));module[_0xb6ae('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb6ae('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb6ae('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb6ae('0x4')]}}; \ No newline at end of file +var _0x1c39=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x587d9b,_0xaea738){var _0x232459=function(_0x2d7e2e){while(--_0x2d7e2e){_0x587d9b['push'](_0x587d9b['shift']());}};_0x232459(++_0xaea738);}(_0x1c39,0x1bd));var _0x91c3=function(_0x365b01,_0x4d1cb4){_0x365b01=_0x365b01-0x0;var _0x4235f5=_0x1c39[_0x365b01];return _0x4235f5;};'use strict';var Sequelize=require(_0x91c3('0x0'));module[_0x91c3('0x1')]={'body':{'type':Sequelize[_0x91c3('0x2')](_0x91c3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x91c3('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x91c3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index b32fdde..b4f0e33 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 _0x0783=['update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','messages','createdAt','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','internal','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x290fc9,_0x3069fe){var _0x31c8bd=function(_0x4bec21){while(--_0x4bec21){_0x290fc9['push'](_0x290fc9['shift']());}};_0x31c8bd(++_0x3069fe);}(_0x0783,0x126));var _0x3078=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0783[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3078('0x0'));var zipdir=require(_0x3078('0x1'));var jsonpatch=require(_0x3078('0x2'));var rp=require(_0x3078('0x3'));var moment=require('moment');var BPromise=require(_0x3078('0x4'));var Mustache=require(_0x3078('0x5'));var util=require(_0x3078('0x6'));var path=require(_0x3078('0x7'));var sox=require(_0x3078('0x8'));var csv=require(_0x3078('0x9'));var ejs=require(_0x3078('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3078('0xb'));var squel=require(_0x3078('0xc'));var crypto=require(_0x3078('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3078('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3078('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3078('0xf'));var as=require(_0x3078('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3078('0x11'))('api');var utils=require(_0x3078('0x12'));var config=require(_0x3078('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3078('0x14'))['db'];config[_0x3078('0x15')]=_[_0x3078('0x16')](config['redis'],{'host':_0x3078('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3078('0x15')]));require(_0x3078('0x18'))[_0x3078('0x19')](socket);function respondWithStatusCode(_0xf5b54b,_0x201d14){_0x201d14=_0x201d14||0xcc;return function(_0x43ae65){if(_0x43ae65){return _0xf5b54b[_0x3078('0x1a')](_0x201d14);}return _0xf5b54b[_0x3078('0x1b')](_0x201d14)[_0x3078('0x1c')]();};}function respondWithResult(_0x349a5e,_0x146f95){_0x146f95=_0x146f95||0xc8;return function(_0x5183ec){if(_0x5183ec){return _0x349a5e[_0x3078('0x1b')](_0x146f95)[_0x3078('0x1d')](_0x5183ec);}};}function respondWithFilteredResult(_0x269a33,_0x5a412f){return function(_0xd4f3b){if(_0xd4f3b){var _0x3330a3=typeof _0x5a412f['offset']===_0x3078('0x1e')&&typeof _0x5a412f[_0x3078('0x1f')]===_0x3078('0x1e');var _0x24bb34=_0xd4f3b[_0x3078('0x20')];var _0x16062c=_0x3330a3?0x0:_0x5a412f[_0x3078('0x21')];var _0x8f91e4=_0x3330a3?_0xd4f3b['count']:_0x5a412f[_0x3078('0x21')]+_0x5a412f[_0x3078('0x1f')];var _0x1a8b13;if(_0x8f91e4>=_0x24bb34){_0x8f91e4=_0x24bb34;_0x1a8b13=0xc8;}else{_0x1a8b13=0xce;}_0x269a33[_0x3078('0x1b')](_0x1a8b13);return _0x269a33[_0x3078('0x22')](_0x3078('0x23'),_0x16062c+'-'+_0x8f91e4+'/'+_0x24bb34)[_0x3078('0x1d')](_0xd4f3b);}return null;};}function patchUpdates(_0x47acdb){return function(_0x5e0993){try{jsonpatch[_0x3078('0x24')](_0x5e0993,_0x47acdb,!![]);}catch(_0x58c806){return BPromise[_0x3078('0x25')](_0x58c806);}return _0x5e0993[_0x3078('0x26')]();};}function saveUpdates(_0x44df8b,_0x165ffb){return function(_0x2b0789){if(_0x2b0789){return _0x2b0789[_0x3078('0x27')](_0x44df8b)[_0x3078('0x28')](function(_0x116ae6){return _0x116ae6;});}return null;};}function removeEntity(_0x37322f,_0x3199a8){return function(_0x4400a3){if(_0x4400a3){return _0x4400a3[_0x3078('0x29')]()[_0x3078('0x28')](function(){_0x37322f[_0x3078('0x1b')](0xcc)[_0x3078('0x1c')]();});}};}function handleEntityNotFound(_0x360d87,_0x3aa993){return function(_0x231b4f){if(!_0x231b4f){_0x360d87[_0x3078('0x1a')](0x194);}return _0x231b4f;};}function handleError(_0x590047,_0x4c7b4f){_0x4c7b4f=_0x4c7b4f||0x1f4;return function(_0x1fea41){logger[_0x3078('0x2a')](_0x1fea41[_0x3078('0x2b')]);if(_0x1fea41[_0x3078('0x2c')]){delete _0x1fea41[_0x3078('0x2c')];}_0x590047['status'](_0x4c7b4f)[_0x3078('0x2d')](_0x1fea41);};}exports[_0x3078('0x2e')]=function(_0x19943e,_0x3a04e9){var _0x52c6dd={},_0x1bcb8e={},_0x202a36={'count':0x0,'rows':[]};var _0x4442b2=_[_0x3078('0x2f')](db[_0x3078('0x30')][_0x3078('0x31')],function(_0x58d4fb){return{'name':_0x58d4fb[_0x3078('0x32')],'type':_0x58d4fb[_0x3078('0x33')]['key']};});_0x1bcb8e[_0x3078('0x34')]=_[_0x3078('0x2f')](_0x4442b2,_0x3078('0x2c'));_0x1bcb8e[_0x3078('0x35')]=_[_0x3078('0x36')](_0x19943e['query']);_0x1bcb8e['filters']=_['intersection'](_0x1bcb8e[_0x3078('0x34')],_0x1bcb8e[_0x3078('0x35')]);_0x52c6dd['attributes']=_[_0x3078('0x37')](_0x1bcb8e['model'],qs[_0x3078('0x38')](_0x19943e[_0x3078('0x35')][_0x3078('0x38')]));_0x52c6dd[_0x3078('0x39')]=_0x52c6dd[_0x3078('0x39')][_0x3078('0x3a')]?_0x52c6dd[_0x3078('0x39')]:_0x1bcb8e[_0x3078('0x34')];if(!_0x19943e[_0x3078('0x35')][_0x3078('0x3b')](_0x3078('0x3c'))){_0x52c6dd['limit']=qs[_0x3078('0x1f')](_0x19943e[_0x3078('0x35')][_0x3078('0x1f')]);_0x52c6dd[_0x3078('0x21')]=qs[_0x3078('0x21')](_0x19943e[_0x3078('0x35')][_0x3078('0x21')]);}_0x52c6dd[_0x3078('0x3d')]=qs[_0x3078('0x3e')](_0x19943e[_0x3078('0x35')][_0x3078('0x3e')]);_0x52c6dd[_0x3078('0x3f')]=qs[_0x3078('0x40')](_[_0x3078('0x41')](_0x19943e[_0x3078('0x35')],_0x1bcb8e[_0x3078('0x40')]),_0x4442b2);if(_0x19943e[_0x3078('0x35')][_0x3078('0x42')]){_0x52c6dd[_0x3078('0x3f')]=_[_0x3078('0x43')](_0x52c6dd[_0x3078('0x3f')],{'$or':_[_0x3078('0x2f')](_0x4442b2,function(_0x3428f5){if(_0x3428f5['type']!==_0x3078('0x44')){var _0xaa9fe2={};_0xaa9fe2[_0x3428f5[_0x3078('0x2c')]]={'$like':'%'+_0x19943e[_0x3078('0x35')]['filter']+'%'};return _0xaa9fe2;}})});}_0x52c6dd=_[_0x3078('0x43')]({},_0x52c6dd,_0x19943e[_0x3078('0x45')]);var _0x2a29a5={'where':_0x52c6dd[_0x3078('0x3f')]};return db['ChatInternalMessage'][_0x3078('0x20')](_0x2a29a5)[_0x3078('0x28')](function(_0x1c0897){_0x202a36[_0x3078('0x20')]=_0x1c0897;if(_0x19943e['query']['includeAll']){_0x52c6dd[_0x3078('0x46')]=[{'all':!![]}];}return db[_0x3078('0x30')][_0x3078('0x47')](_0x52c6dd);})[_0x3078('0x28')](function(_0x303a03){_0x202a36[_0x3078('0x48')]=_0x303a03;return _0x202a36;})['then'](respondWithFilteredResult(_0x3a04e9,_0x52c6dd))[_0x3078('0x49')](handleError(_0x3a04e9,null));};exports[_0x3078('0x4a')]=function(_0x25ac2b,_0x2eeb27){var _0x2b6a46={'raw':!![],'where':{'id':_0x25ac2b[_0x3078('0x4b')]['id']}},_0x138178={};_0x138178[_0x3078('0x34')]=_['keys'](db[_0x3078('0x30')][_0x3078('0x31')]);_0x138178[_0x3078('0x35')]=_[_0x3078('0x36')](_0x25ac2b[_0x3078('0x35')]);_0x138178[_0x3078('0x40')]=_[_0x3078('0x37')](_0x138178[_0x3078('0x34')],_0x138178[_0x3078('0x35')]);_0x2b6a46[_0x3078('0x39')]=_[_0x3078('0x37')](_0x138178['model'],qs[_0x3078('0x38')](_0x25ac2b['query'][_0x3078('0x38')]));_0x2b6a46['attributes']=_0x2b6a46[_0x3078('0x39')][_0x3078('0x3a')]?_0x2b6a46[_0x3078('0x39')]:_0x138178[_0x3078('0x34')];if(_0x25ac2b[_0x3078('0x35')][_0x3078('0x4c')]){_0x2b6a46[_0x3078('0x46')]=[{'all':!![]}];}_0x2b6a46=_[_0x3078('0x43')]({},_0x2b6a46,_0x25ac2b[_0x3078('0x45')]);return db[_0x3078('0x30')]['find'](_0x2b6a46)[_0x3078('0x28')](handleEntityNotFound(_0x2eeb27,null))[_0x3078('0x28')](respondWithResult(_0x2eeb27,null))[_0x3078('0x49')](handleError(_0x2eeb27,null));};exports[_0x3078('0x4d')]=function(_0x35636d,_0x65cf2a){return db[_0x3078('0x30')][_0x3078('0x4d')](_0x35636d[_0x3078('0x4e')],{})[_0x3078('0x28')](respondWithResult(_0x65cf2a,0xc9))[_0x3078('0x49')](handleError(_0x65cf2a,null));};exports[_0x3078('0x27')]=function(_0xb1d79,_0x2ff04c){if(_0xb1d79[_0x3078('0x4e')]['id']){delete _0xb1d79[_0x3078('0x4e')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0xb1d79['params']['id']}})[_0x3078('0x28')](handleEntityNotFound(_0x2ff04c,null))[_0x3078('0x28')](saveUpdates(_0xb1d79[_0x3078('0x4e')],null))['then'](respondWithResult(_0x2ff04c,null))[_0x3078('0x49')](handleError(_0x2ff04c,null));};exports[_0x3078('0x29')]=function(_0x2deb69,_0x47c7c4){return db[_0x3078('0x30')][_0x3078('0x4f')]({'where':{'id':_0x2deb69[_0x3078('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47c7c4,null))['then'](removeEntity(_0x47c7c4,null))[_0x3078('0x49')](handleError(_0x47c7c4,null));};exports[_0x3078('0x50')]=function(_0x3256c0,_0x2e483c){return db[_0x3078('0x30')][_0x3078('0x50')]()[_0x3078('0x28')](respondWithResult(_0x2e483c,null))['catch'](handleError(_0x2e483c,null));};function wrapUser(_0x12cfe1){return function(_0x2d5213){var _0x2e5205=_0x12cfe1['get']({'plain':!![]});_0x2e5205[_0x3078('0x51')]=[];if(_0x2d5213){_0x2e5205['lastMessageAt']=_0x2d5213[_0x3078('0x52')];_0x2e5205['lastMessage']=_0x2d5213;}else{_0x2e5205[_0x3078('0x53')]=moment(0x0)['format'](_0x3078('0x54'));_0x2e5205[_0x3078('0x55')]={};}return _0x2e5205;};}exports[_0x3078('0x56')]=function(_0x7f3bf,_0x46bec6,_0x37818a){var _0x12dc28=[];return db['User']['findAll']({'where':{'role':[_0x3078('0x57'),_0x3078('0x58'),_0x3078('0x59')]},'attributes':['id',_0x3078('0x5a'),_0x3078('0x2c'),_0x3078('0x5b'),'userpic',_0x3078('0x5c'),'online',_0x3078('0x5d'),'allowmessenger',_0x3078('0x5e')],'order':qs[_0x3078('0x3e')](_0x3078('0x5f')),'include':[{'model':db[_0x3078('0x60')],'as':_0x3078('0x61'),'attributes':['id',_0x3078('0x2c'),_0x3078('0x33')],'through':{'attributes':[]}}]})[_0x3078('0x28')](function(_0x1d8ce1){if(_0x1d8ce1){var _0x5c89f7=_0x7f3bf[_0x3078('0x59')][_0x3078('0x62')]({'plain':!![]});if(!_0x5c89f7)throw new Error(_0x3078('0x63'));if(_0x5c89f7['role']===_0x3078('0x59')){return db[_0x3078('0x64')][_0x3078('0x4f')]({'where':{'name':_0x3078('0x65'),'userProfileId':_0x5c89f7[_0x3078('0x66')]},'raw':!![]})[_0x3078('0x28')](function(_0x22e032){if(_0x22e032){if(_0x22e032[_0x3078('0x67')]===0x0){return db[_0x3078('0x68')][_0x3078('0x47')]({'where':{'sectionId':_0x22e032['id']},'raw':!![]})[_0x3078('0x28')](function(_0xbef07f){var _0x35734d=[];if(_['isEmpty'](_0xbef07f)){_0x35734d=_['filter'](_0x1d8ce1,function(_0x1682ad){if(_0x1682ad[_0x3078('0x5b')]!==_0x3078('0x57')){return _0x1682ad;}});return _0x35734d;}else{for(var _0x404c31=0x0;_0x404c31<_0x1d8ce1[_0x3078('0x3a')];_0x404c31++){var _0x3fe74c=_0x1d8ce1[_0x404c31];if(_0x3fe74c[_0x3078('0x5b')]===_0x3078('0x57')){var _0x554223=_[_0x3078('0x4f')](_0xbef07f,function(_0x4260ca){return _0x4260ca[_0x3078('0x69')]===_0x3fe74c['id'];});if(_0x554223)_0x35734d[_0x3078('0x6a')](_0x3fe74c);}else{_0x35734d[_0x3078('0x6a')](_0x3fe74c);}}return _0x35734d;}});}else{return _0x1d8ce1;}}else{var _0x5d7030=_[_0x3078('0x42')](_0x1d8ce1,function(_0x369476){if(_0x369476[_0x3078('0x5b')]!==_0x3078('0x57')){return _0x369476;}});return _0x5d7030;}});}else{return _0x1d8ce1;}}})[_0x3078('0x28')](function(_0x356ab9){var _0x59506e=[];if(_0x356ab9){_0x12dc28=_0x356ab9;for(var _0x3ea1e7=0x0;_0x3ea1e7<_0x356ab9[_0x3078('0x3a')];_0x3ea1e7+=0x1){_0x12dc28[_0x3ea1e7][_0x3078('0x51')]=[];_0x59506e[_0x3078('0x6a')](db[_0x3078('0x30')][_0x3078('0x4f')]({'where':{'FromId':[_0x7f3bf[_0x3078('0x59')]['id'],_0x356ab9[_0x3ea1e7]['id']],'ToId':[_0x7f3bf[_0x3078('0x59')]['id'],_0x356ab9[_0x3ea1e7]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x3078('0x6b'),_0x3078('0x6c'),_0x3078('0x4e')],'order':qs[_0x3078('0x3e')](_0x3078('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3078('0x28')](wrapUser(_0x356ab9[_0x3ea1e7])));}return BPromise[_0x3078('0x6e')](_0x59506e);}return[];})[_0x3078('0x28')](function(_0x315c9d){return{'rows':_0x315c9d,'count':_0x315c9d['length']};})['then'](respondWithResult(_0x46bec6,null))[_0x3078('0x49')](handleError(_0x46bec6,null));}; \ No newline at end of file +var _0x3dbe=['internal','online','lastLoginAt','showWebBar','-online','user','get','UserProfileSection','find','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','then','error','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','merge','catch','create','body','update','describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','role','userpic'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x3dbe,0xe6));var _0xe3db=function(_0xdc5c98,_0x4dc10d){_0xdc5c98=_0xdc5c98-0x0;var _0x18d7ee=_0x3dbe[_0xdc5c98];return _0x18d7ee;};'use strict';var emlformat=require(_0xe3db('0x0'));var rimraf=require(_0xe3db('0x1'));var zipdir=require(_0xe3db('0x2'));var jsonpatch=require(_0xe3db('0x3'));var rp=require(_0xe3db('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe3db('0x5'));var util=require(_0xe3db('0x6'));var path=require('path');var sox=require(_0xe3db('0x7'));var csv=require(_0xe3db('0x8'));var ejs=require(_0xe3db('0x9'));var fs=require('fs');var fs_extra=require(_0xe3db('0xa'));var _=require('lodash');var squel=require(_0xe3db('0xb'));var crypto=require(_0xe3db('0xc'));var jsforce=require(_0xe3db('0xd'));var deskjs=require(_0xe3db('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe3db('0xf'));var Papa=require('papaparse');var Redis=require(_0xe3db('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe3db('0x11'));var as=require(_0xe3db('0x12'));var hardwareService=require(_0xe3db('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe3db('0x14'));var config=require(_0xe3db('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3db('0x16'))['db'];config['redis']=_[_0xe3db('0x17')](config[_0xe3db('0x18')],{'host':_0xe3db('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3db('0x18')]));require('./chatInternalMessage.socket')[_0xe3db('0x1a')](socket);function respondWithStatusCode(_0x294776,_0x533761){_0x533761=_0x533761||0xcc;return function(_0x17ccb4){if(_0x17ccb4){return _0x294776[_0xe3db('0x1b')](_0x533761);}return _0x294776['status'](_0x533761)['end']();};}function respondWithResult(_0x264e1f,_0x138ce6){_0x138ce6=_0x138ce6||0xc8;return function(_0x51da12){if(_0x51da12){return _0x264e1f[_0xe3db('0x1c')](_0x138ce6)[_0xe3db('0x1d')](_0x51da12);}};}function respondWithFilteredResult(_0x2ed3db,_0xd9e182){return function(_0x4e0a7b){if(_0x4e0a7b){var _0x301903=typeof _0xd9e182[_0xe3db('0x1e')]===_0xe3db('0x1f')&&typeof _0xd9e182[_0xe3db('0x20')]==='undefined';var _0x489b5d=_0x4e0a7b[_0xe3db('0x21')];var _0x4c7b7e=_0x301903?0x0:_0xd9e182[_0xe3db('0x1e')];var _0x43f115=_0x301903?_0x4e0a7b[_0xe3db('0x21')]:_0xd9e182[_0xe3db('0x1e')]+_0xd9e182['limit'];var _0x4ae9c8;if(_0x43f115>=_0x489b5d){_0x43f115=_0x489b5d;_0x4ae9c8=0xc8;}else{_0x4ae9c8=0xce;}_0x2ed3db['status'](_0x4ae9c8);return _0x2ed3db[_0xe3db('0x22')](_0xe3db('0x23'),_0x4c7b7e+'-'+_0x43f115+'/'+_0x489b5d)[_0xe3db('0x1d')](_0x4e0a7b);}return null;};}function patchUpdates(_0x329452){return function(_0x35cd1e){try{jsonpatch[_0xe3db('0x24')](_0x35cd1e,_0x329452,!![]);}catch(_0x74fff8){return BPromise['reject'](_0x74fff8);}return _0x35cd1e['save']();};}function saveUpdates(_0x2c4969,_0x21ff67){return function(_0x581e10){if(_0x581e10){return _0x581e10['update'](_0x2c4969)['then'](function(_0x4e5fb8){return _0x4e5fb8;});}return null;};}function removeEntity(_0xb99584,_0xb88286){return function(_0x36af21){if(_0x36af21){return _0x36af21[_0xe3db('0x25')]()[_0xe3db('0x26')](function(){_0xb99584[_0xe3db('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4913ce,_0x3d4be9){return function(_0x1f0f38){if(!_0x1f0f38){_0x4913ce[_0xe3db('0x1b')](0x194);}return _0x1f0f38;};}function handleError(_0x22804a,_0x1b848c){_0x1b848c=_0x1b848c||0x1f4;return function(_0x32d6f1){logger[_0xe3db('0x27')](_0x32d6f1['stack']);if(_0x32d6f1[_0xe3db('0x28')]){delete _0x32d6f1[_0xe3db('0x28')];}_0x22804a[_0xe3db('0x1c')](_0x1b848c)['send'](_0x32d6f1);};}exports[_0xe3db('0x29')]=function(_0x154764,_0x2594a1){var _0x3616be={},_0x4fb884={},_0x13b032={'count':0x0,'rows':[]};var _0x4cca2b=_[_0xe3db('0x2a')](db[_0xe3db('0x2b')][_0xe3db('0x2c')],function(_0x1e6ec9){return{'name':_0x1e6ec9[_0xe3db('0x2d')],'type':_0x1e6ec9[_0xe3db('0x2e')][_0xe3db('0x2f')]};});_0x4fb884[_0xe3db('0x30')]=_['map'](_0x4cca2b,_0xe3db('0x28'));_0x4fb884[_0xe3db('0x31')]=_[_0xe3db('0x32')](_0x154764['query']);_0x4fb884['filters']=_[_0xe3db('0x33')](_0x4fb884['model'],_0x4fb884['query']);_0x3616be[_0xe3db('0x34')]=_[_0xe3db('0x33')](_0x4fb884[_0xe3db('0x30')],qs['fields'](_0x154764[_0xe3db('0x31')][_0xe3db('0x35')]));_0x3616be[_0xe3db('0x34')]=_0x3616be[_0xe3db('0x34')][_0xe3db('0x36')]?_0x3616be['attributes']:_0x4fb884['model'];if(!_0x154764['query']['hasOwnProperty'](_0xe3db('0x37'))){_0x3616be['limit']=qs['limit'](_0x154764['query'][_0xe3db('0x20')]);_0x3616be[_0xe3db('0x1e')]=qs['offset'](_0x154764[_0xe3db('0x31')][_0xe3db('0x1e')]);}_0x3616be[_0xe3db('0x38')]=qs[_0xe3db('0x39')](_0x154764['query'][_0xe3db('0x39')]);_0x3616be[_0xe3db('0x3a')]=qs[_0xe3db('0x3b')](_['pick'](_0x154764[_0xe3db('0x31')],_0x4fb884[_0xe3db('0x3b')]),_0x4cca2b);if(_0x154764[_0xe3db('0x31')][_0xe3db('0x3c')]){_0x3616be[_0xe3db('0x3a')]=_['merge'](_0x3616be['where'],{'$or':_[_0xe3db('0x2a')](_0x4cca2b,function(_0x316ef1){if(_0x316ef1['type']!==_0xe3db('0x3d')){var _0x5b0226={};_0x5b0226[_0x316ef1['name']]={'$like':'%'+_0x154764[_0xe3db('0x31')][_0xe3db('0x3c')]+'%'};return _0x5b0226;}})});}_0x3616be=_['merge']({},_0x3616be,_0x154764[_0xe3db('0x3e')]);var _0x5b0555={'where':_0x3616be[_0xe3db('0x3a')]};return db[_0xe3db('0x2b')]['count'](_0x5b0555)[_0xe3db('0x26')](function(_0x12c3e2){_0x13b032[_0xe3db('0x21')]=_0x12c3e2;if(_0x154764['query'][_0xe3db('0x3f')]){_0x3616be[_0xe3db('0x40')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xe3db('0x41')](_0x3616be);})[_0xe3db('0x26')](function(_0x4f9a78){_0x13b032[_0xe3db('0x42')]=_0x4f9a78;return _0x13b032;})[_0xe3db('0x26')](respondWithFilteredResult(_0x2594a1,_0x3616be))['catch'](handleError(_0x2594a1,null));};exports['show']=function(_0x449dbc,_0x20b206){var _0x157e2c={'raw':!![],'where':{'id':_0x449dbc[_0xe3db('0x43')]['id']}},_0x4c6558={};_0x4c6558[_0xe3db('0x30')]=_['keys'](db[_0xe3db('0x2b')][_0xe3db('0x2c')]);_0x4c6558[_0xe3db('0x31')]=_[_0xe3db('0x32')](_0x449dbc[_0xe3db('0x31')]);_0x4c6558['filters']=_[_0xe3db('0x33')](_0x4c6558[_0xe3db('0x30')],_0x4c6558['query']);_0x157e2c[_0xe3db('0x34')]=_['intersection'](_0x4c6558[_0xe3db('0x30')],qs['fields'](_0x449dbc[_0xe3db('0x31')][_0xe3db('0x35')]));_0x157e2c[_0xe3db('0x34')]=_0x157e2c[_0xe3db('0x34')][_0xe3db('0x36')]?_0x157e2c[_0xe3db('0x34')]:_0x4c6558[_0xe3db('0x30')];if(_0x449dbc[_0xe3db('0x31')][_0xe3db('0x3f')]){_0x157e2c[_0xe3db('0x40')]=[{'all':!![]}];}_0x157e2c=_[_0xe3db('0x44')]({},_0x157e2c,_0x449dbc['options']);return db[_0xe3db('0x2b')]['find'](_0x157e2c)[_0xe3db('0x26')](handleEntityNotFound(_0x20b206,null))[_0xe3db('0x26')](respondWithResult(_0x20b206,null))[_0xe3db('0x45')](handleError(_0x20b206,null));};exports[_0xe3db('0x46')]=function(_0x158fcf,_0xeabd5d){return db[_0xe3db('0x2b')][_0xe3db('0x46')](_0x158fcf[_0xe3db('0x47')],{})['then'](respondWithResult(_0xeabd5d,0xc9))['catch'](handleError(_0xeabd5d,null));};exports[_0xe3db('0x48')]=function(_0x25df99,_0x2e2401){if(_0x25df99[_0xe3db('0x47')]['id']){delete _0x25df99[_0xe3db('0x47')]['id'];}return db[_0xe3db('0x2b')]['find']({'where':{'id':_0x25df99[_0xe3db('0x43')]['id']}})[_0xe3db('0x26')](handleEntityNotFound(_0x2e2401,null))[_0xe3db('0x26')](saveUpdates(_0x25df99[_0xe3db('0x47')],null))[_0xe3db('0x26')](respondWithResult(_0x2e2401,null))[_0xe3db('0x45')](handleError(_0x2e2401,null));};exports['destroy']=function(_0x45c93c,_0x3d41e6){return db['ChatInternalMessage']['find']({'where':{'id':_0x45c93c['params']['id']}})[_0xe3db('0x26')](handleEntityNotFound(_0x3d41e6,null))['then'](removeEntity(_0x3d41e6,null))[_0xe3db('0x45')](handleError(_0x3d41e6,null));};exports['describe']=function(_0x535c44,_0x216f1f){return db[_0xe3db('0x2b')][_0xe3db('0x49')]()[_0xe3db('0x26')](respondWithResult(_0x216f1f,null))['catch'](handleError(_0x216f1f,null));};function wrapUser(_0x574f24){return function(_0x1a07e4){var _0x4f28ff=_0x574f24['get']({'plain':!![]});_0x4f28ff[_0xe3db('0x4a')]=[];if(_0x1a07e4){_0x4f28ff[_0xe3db('0x4b')]=_0x1a07e4['createdAt'];_0x4f28ff[_0xe3db('0x4c')]=_0x1a07e4;}else{_0x4f28ff['lastMessageAt']=moment(0x0)[_0xe3db('0x4d')](_0xe3db('0x4e'));_0x4f28ff[_0xe3db('0x4c')]={};}return _0x4f28ff;};}exports[_0xe3db('0x4f')]=function(_0x1a8a79,_0x24a53b,_0x49db42){var _0x1b8b01=[];return db[_0xe3db('0x50')]['findAll']({'where':{'role':[_0xe3db('0x51'),_0xe3db('0x52'),'user']},'attributes':['id','fullname','name',_0xe3db('0x53'),_0xe3db('0x54'),_0xe3db('0x55'),_0xe3db('0x56'),_0xe3db('0x57'),'allowmessenger',_0xe3db('0x58')],'order':qs['sort'](_0xe3db('0x59')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0xe3db('0x28'),_0xe3db('0x2e')],'through':{'attributes':[]}}]})['then'](function(_0x4d3aeb){if(_0x4d3aeb){var _0x242fb3=_0x1a8a79[_0xe3db('0x5a')][_0xe3db('0x5b')]({'plain':!![]});if(!_0x242fb3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x242fb3[_0xe3db('0x53')]===_0xe3db('0x5a')){return db[_0xe3db('0x5c')][_0xe3db('0x5d')]({'where':{'name':_0xe3db('0x5e'),'userProfileId':_0x242fb3[_0xe3db('0x5f')]},'raw':!![]})['then'](function(_0x449db6){if(_0x449db6){if(_0x449db6[_0xe3db('0x60')]===0x0){return db[_0xe3db('0x61')][_0xe3db('0x41')]({'where':{'sectionId':_0x449db6['id']},'raw':!![]})['then'](function(_0x27edb0){var _0x479006=[];if(_[_0xe3db('0x62')](_0x27edb0)){_0x479006=_[_0xe3db('0x3c')](_0x4d3aeb,function(_0x2a3596){if(_0x2a3596['role']!==_0xe3db('0x51')){return _0x2a3596;}});return _0x479006;}else{for(var _0x4755bd=0x0;_0x4755bd<_0x4d3aeb['length'];_0x4755bd++){var _0x318823=_0x4d3aeb[_0x4755bd];if(_0x318823['role']===_0xe3db('0x51')){var _0x2592e8=_[_0xe3db('0x5d')](_0x27edb0,function(_0x45f4c8){return _0x45f4c8[_0xe3db('0x63')]===_0x318823['id'];});if(_0x2592e8)_0x479006[_0xe3db('0x64')](_0x318823);}else{_0x479006[_0xe3db('0x64')](_0x318823);}}return _0x479006;}});}else{return _0x4d3aeb;}}else{var _0x4140cd=_[_0xe3db('0x3c')](_0x4d3aeb,function(_0x1b9222){if(_0x1b9222['role']!==_0xe3db('0x51')){return _0x1b9222;}});return _0x4140cd;}});}else{return _0x4d3aeb;}}})[_0xe3db('0x26')](function(_0xfcb9a4){var _0x2f2e78=[];if(_0xfcb9a4){_0x1b8b01=_0xfcb9a4;for(var _0x755a24=0x0;_0x755a24<_0xfcb9a4[_0xe3db('0x36')];_0x755a24+=0x1){_0x1b8b01[_0x755a24][_0xe3db('0x4a')]=[];_0x2f2e78[_0xe3db('0x64')](db[_0xe3db('0x2b')][_0xe3db('0x5d')]({'where':{'FromId':[_0x1a8a79[_0xe3db('0x5a')]['id'],_0xfcb9a4[_0x755a24]['id']],'ToId':[_0x1a8a79[_0xe3db('0x5a')]['id'],_0xfcb9a4[_0x755a24]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xe3db('0x65'),'ToId',_0xe3db('0x66'),_0xe3db('0x47')],'order':qs['sort'](_0xe3db('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xfcb9a4[_0x755a24])));}return BPromise[_0xe3db('0x68')](_0x2f2e78);}return[];})[_0xe3db('0x26')](function(_0x12be72){return{'rows':_0x12be72,'count':_0x12be72[_0xe3db('0x36')]};})[_0xe3db('0x26')](respondWithResult(_0x24a53b,null))['catch'](handleError(_0x24a53b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d3e994c..237336e 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 _0x076b=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','hook'];(function(_0x5902a0,_0x5bc8f6){var _0x3d3022=function(_0x4adcd0){while(--_0x4adcd0){_0x5902a0['push'](_0x5902a0['shift']());}};_0x3d3022(++_0x5bc8f6);}(_0x076b,0x1c1));var _0xb076=function(_0x5e207d,_0xe1b62a){_0x5e207d=_0x5e207d-0x0;var _0x263d1a=_0x076b[_0x5e207d];return _0x263d1a;};'use strict';var EventEmitter=require(_0xb076('0x0'));var ChatInternalMessage=require(_0xb076('0x1'))['db'][_0xb076('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb076('0x3')](0x0);var events={'afterCreate':_0xb076('0x4'),'afterUpdate':_0xb076('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5da5dd){return function(_0x1817f6,_0x3168a5,_0x3d872a){ChatInternalMessageEvents['emit'](_0x5da5dd+':'+_0x1817f6['id'],_0x1817f6);ChatInternalMessageEvents['emit'](_0x5da5dd,_0x1817f6);_0x3d872a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xb076('0x6')](e,emitEvent(event));}}module[_0xb076('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xeddc=['hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x336ca2,_0x1a813a){var _0xda59a6=function(_0x47caa6){while(--_0x47caa6){_0x336ca2['push'](_0x336ca2['shift']());}};_0xda59a6(++_0x1a813a);}(_0xeddc,0xfc));var _0xcedd=function(_0x34d46f,_0x3e5397){_0x34d46f=_0x34d46f-0x0;var _0x7eeb32=_0xeddc[_0x34d46f];return _0x7eeb32;};'use strict';var EventEmitter=require(_0xcedd('0x0'));var ChatInternalMessage=require(_0xcedd('0x1'))['db'][_0xcedd('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xcedd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcedd('0x4'),'afterDestroy':_0xcedd('0x5')};function emitEvent(_0x5dd882){return function(_0x26f983,_0x3862ab,_0x2d17f6){ChatInternalMessageEvents[_0xcedd('0x6')](_0x5dd882+':'+_0x26f983['id'],_0x26f983);ChatInternalMessageEvents[_0xcedd('0x6')](_0x5dd882,_0x26f983);_0x2d17f6(null);};}for(var e in events){if(events[_0xcedd('0x7')](e)){var event=events[e];ChatInternalMessage[_0xcedd('0x8')](e,emitEvent(event));}}module[_0xcedd('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 216fe19..04e6da8 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 _0x0984=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash'];(function(_0x6a91d0,_0x208f52){var _0x1abb82=function(_0x3bfb53){while(--_0x3bfb53){_0x6a91d0['push'](_0x6a91d0['shift']());}};_0x1abb82(++_0x208f52);}(_0x0984,0x6d));var _0x4098=function(_0xa22606,_0x497098){_0xa22606=_0xa22606-0x0;var _0x5252d2=_0x0984[_0xa22606];return _0x5252d2;};'use strict';var _=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var logger=require(_0x4098('0x2'))(_0x4098('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4098('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4098('0x5'));var config=require(_0x4098('0x6'));var attributes=require(_0x4098('0x7'));module['exports']=function(_0x58814f,_0x47aa57){return _0x58814f['define'](_0x4098('0x8'),attributes,{'tableName':_0x4098('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4098('0xa')});}; \ No newline at end of file +var _0x535a=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x23b3d1,_0x1ee128){var _0xd2c70=function(_0x329cf9){while(--_0x329cf9){_0x23b3d1['push'](_0x23b3d1['shift']());}};_0xd2c70(++_0x1ee128);}(_0x535a,0x6c));var _0xa535=function(_0x4f4bcc,_0x5e9485){_0x4f4bcc=_0x4f4bcc-0x0;var _0x2ce62c=_0x535a[_0x4f4bcc];return _0x2ce62c;};'use strict';var _=require('lodash');var util=require(_0xa535('0x0'));var logger=require(_0xa535('0x1'))('api');var moment=require(_0xa535('0x2'));var BPromise=require('bluebird');var rp=require(_0xa535('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa535('0x4'));var config=require(_0xa535('0x5'));var attributes=require(_0xa535('0x6'));module[_0xa535('0x7')]=function(_0x2dc28b,_0x2e009c){return _0x2dc28b[_0xa535('0x8')](_0xa535('0x9'),attributes,{'tableName':_0xa535('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa535('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 7113374..a337160 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 _0xf8b5=['info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x4441b1,_0x17bf98){var _0x3d510f=function(_0x2eed93){while(--_0x2eed93){_0x4441b1['push'](_0x4441b1['shift']());}};_0x3d510f(++_0x17bf98);}(_0xf8b5,0x1c4));var _0x5f8b=function(_0xf970f0,_0x3360b6){_0xf970f0=_0xf970f0-0x0;var _0xd1f8aa=_0xf8b5[_0xf970f0];return _0xd1f8aa;};'use strict';var _=require(_0x5f8b('0x0'));var util=require(_0x5f8b('0x1'));var moment=require('moment');var BPromise=require(_0x5f8b('0x2'));var rs=require(_0x5f8b('0x3'));var fs=require('fs');var Redis=require(_0x5f8b('0x4'));var db=require(_0x5f8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f8b('0x6'))(_0x5f8b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f8b('0x8'));var client=jayson[_0x5f8b('0x9')]['http']({'port':0x232a});config[_0x5f8b('0xa')]=_['defaults'](config[_0x5f8b('0xa')],{'host':_0x5f8b('0xb'),'port':0x18eb});var socket=require(_0x5f8b('0xc'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5f8b('0xd')](socket);function respondWithRpcPromise(_0x2460bf,_0x353d6e,_0x2aecbc){return new BPromise(function(_0x4e67ba,_0x50a623){return client[_0x5f8b('0xe')](_0x2460bf,_0x2aecbc)[_0x5f8b('0xf')](function(_0x558812){logger[_0x5f8b('0x10')](_0x5f8b('0x11'),_0x353d6e,'request\x20sent');logger['debug'](_0x5f8b('0x12'),_0x353d6e,_0x5f8b('0x13'),JSON[_0x5f8b('0x14')](_0x558812));if(_0x558812[_0x5f8b('0x15')]){if(_0x558812['error'][_0x5f8b('0x16')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x353d6e,_0x558812[_0x5f8b('0x15')][_0x5f8b('0x17')]);return _0x50a623(_0x558812[_0x5f8b('0x15')][_0x5f8b('0x17')]);}logger[_0x5f8b('0x15')](_0x5f8b('0x11'),_0x353d6e,_0x558812['error'][_0x5f8b('0x17')]);return _0x4e67ba(_0x558812[_0x5f8b('0x15')][_0x5f8b('0x17')]);}else{logger['info'](_0x5f8b('0x11'),_0x353d6e,_0x5f8b('0x13'));_0x4e67ba(_0x558812[_0x5f8b('0x18')][_0x5f8b('0x17')]);}})[_0x5f8b('0x19')](function(_0x11b58a){logger[_0x5f8b('0x15')](_0x5f8b('0x11'),_0x353d6e,_0x11b58a);_0x50a623(_0x11b58a);});});} \ No newline at end of file +var _0x1e4c=['error','code','message','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','defaults','localhost','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e7c60,_0x506a65){var _0x179e80=function(_0x51d655){while(--_0x51d655){_0x3e7c60['push'](_0x3e7c60['shift']());}};_0x179e80(++_0x506a65);}(_0x1e4c,0x1bb));var _0xc1e4=function(_0x1f5717,_0x3f9b8b){_0x1f5717=_0x1f5717-0x0;var _0x39162b=_0x1e4c[_0x1f5717];return _0x39162b;};'use strict';var _=require(_0xc1e4('0x0'));var util=require(_0xc1e4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc1e4('0x2'));var fs=require('fs');var Redis=require(_0xc1e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc1e4('0x4'))(_0xc1e4('0x5'));var config=require('../../config/environment');var jayson=require(_0xc1e4('0x6'));var client=jayson['client'][_0xc1e4('0x7')]({'port':0x232a});config['redis']=_[_0xc1e4('0x8')](config['redis'],{'host':_0xc1e4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc1e4('0xa'))[_0xc1e4('0xb')](socket);function respondWithRpcPromise(_0x5545f9,_0x5f0bfc,_0x10f52c){return new BPromise(function(_0x2f331f,_0x3142ab){return client['request'](_0x5545f9,_0x10f52c)[_0xc1e4('0xc')](function(_0x1fd73d){logger[_0xc1e4('0xd')](_0xc1e4('0xe'),_0x5f0bfc,_0xc1e4('0xf'));logger[_0xc1e4('0x10')](_0xc1e4('0x11'),_0x5f0bfc,_0xc1e4('0xf'),JSON[_0xc1e4('0x12')](_0x1fd73d));if(_0x1fd73d[_0xc1e4('0x13')]){if(_0x1fd73d[_0xc1e4('0x13')][_0xc1e4('0x14')]===0x1f4){logger[_0xc1e4('0x13')](_0xc1e4('0xe'),_0x5f0bfc,_0x1fd73d[_0xc1e4('0x13')][_0xc1e4('0x15')]);return _0x3142ab(_0x1fd73d[_0xc1e4('0x13')]['message']);}logger['error'](_0xc1e4('0xe'),_0x5f0bfc,_0x1fd73d[_0xc1e4('0x13')][_0xc1e4('0x15')]);return _0x2f331f(_0x1fd73d[_0xc1e4('0x13')][_0xc1e4('0x15')]);}else{logger[_0xc1e4('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f0bfc,_0xc1e4('0xf'));_0x2f331f(_0x1fd73d['result']['message']);}})['catch'](function(_0x1fa1b5){logger[_0xc1e4('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f0bfc,_0x1fa1b5);_0x3142ab(_0x1fa1b5);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0dda5b0..dcf7c31 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 _0x9707=['./chatInternalMessage.events','save','update','emit','removeListener','length','chatInternalMessage:'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9707,0xbd));var _0x7970=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9707[_0x122ef9];return _0x42fba0;};'use strict';var ChatInternalMessageEvents=require(_0x7970('0x0'));var events=[_0x7970('0x1'),'remove',_0x7970('0x2')];function createListener(_0x31b202,_0x1a1fd1){return function(_0x45953d){_0x1a1fd1[_0x7970('0x3')](_0x31b202,_0x45953d);};}function removeListener(_0x22e828,_0x357285){return function(){ChatInternalMessageEvents[_0x7970('0x4')](_0x22e828,_0x357285);};}exports['register']=function(_0xa33d8e){for(var _0x12c4d9=0x0,_0x2c6b6d=events[_0x7970('0x5')];_0x12c4d9<_0x2c6b6d;_0x12c4d9++){var _0x520375=events[_0x12c4d9];var _0x19e8da=createListener(_0x7970('0x6')+_0x520375,_0xa33d8e);ChatInternalMessageEvents['on'](_0x520375,_0x19e8da);}}; \ No newline at end of file +var _0xb149=['save','remove','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb149,0x93));var _0x9b14=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0xb149[_0x130209];return _0x155fb7;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x9b14('0x0'),_0x9b14('0x1'),'update'];function createListener(_0xd030e1,_0x33144d){return function(_0x8509ad){_0x33144d[_0x9b14('0x2')](_0xd030e1,_0x8509ad);};}function removeListener(_0x5bf451,_0x37e138){return function(){ChatInternalMessageEvents[_0x9b14('0x3')](_0x5bf451,_0x37e138);};}exports[_0x9b14('0x4')]=function(_0x3dd7c7){for(var _0x5b8c35=0x0,_0xcd8d7c=events[_0x9b14('0x5')];_0x5b8c35<_0xcd8d7c;_0x5b8c35++){var _0x504768=events[_0x5b8c35];var _0x58b05a=createListener(_0x9b14('0x6')+_0x504768,_0x3dd7c7);ChatInternalMessageEvents['on'](_0x504768,_0x58b05a);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 5654453..22c4366 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 _0xc0c2=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','/:id'];(function(_0x2065f7,_0x2f3111){var _0xdbb6fe=function(_0x53e4a9){while(--_0x53e4a9){_0x2065f7['push'](_0x2065f7['shift']());}};_0xdbb6fe(++_0x2f3111);}(_0xc0c2,0x74));var _0x2c0c=function(_0x2e3ebb,_0x5afc59){_0x2e3ebb=_0x2e3ebb-0x0;var _0x8f027f=_0xc0c2[_0x2e3ebb];return _0x8f027f;};'use strict';var multer=require('multer');var util=require(_0x2c0c('0x0'));var path=require(_0x2c0c('0x1'));var timeout=require(_0x2c0c('0x2'));var express=require(_0x2c0c('0x3'));var router=express[_0x2c0c('0x4')]();var fs_extra=require(_0x2c0c('0x5'));var auth=require(_0x2c0c('0x6'));var interaction=require(_0x2c0c('0x7'));var config=require(_0x2c0c('0x8'));var controller=require(_0x2c0c('0x9'));router[_0x2c0c('0xa')]('/',auth[_0x2c0c('0xb')](),controller['index']);router[_0x2c0c('0xa')](_0x2c0c('0xc'),auth[_0x2c0c('0xb')](),controller[_0x2c0c('0xd')]);router['get']('/users',auth[_0x2c0c('0xb')](),controller[_0x2c0c('0xe')]);router['get'](_0x2c0c('0xf'),auth[_0x2c0c('0xb')](),controller['show']);router['post']('/',auth[_0x2c0c('0xb')](),controller[_0x2c0c('0x10')]);router[_0x2c0c('0x11')](_0x2c0c('0xf'),controller[_0x2c0c('0x12')]);router[_0x2c0c('0x13')]('/:id',auth[_0x2c0c('0xb')](),controller[_0x2c0c('0x14')]);module[_0x2c0c('0x15')]=router; \ No newline at end of file +var _0xd0a1=['./chatInternalMessage.controller','get','isAuthenticated','describe','getUsers','/:id','put','update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xd0a1,0x135));var _0x1d0a=function(_0x16803d,_0x2d35fa){_0x16803d=_0x16803d-0x0;var _0x47bd54=_0xd0a1[_0x16803d];return _0x47bd54;};'use strict';var multer=require(_0x1d0a('0x0'));var util=require('util');var path=require(_0x1d0a('0x1'));var timeout=require('connect-timeout');var express=require(_0x1d0a('0x2'));var router=express[_0x1d0a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1d0a('0x4'));var interaction=require(_0x1d0a('0x5'));var config=require('../../config/environment');var controller=require(_0x1d0a('0x6'));router[_0x1d0a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1d0a('0x7')]('/describe',auth[_0x1d0a('0x8')](),controller[_0x1d0a('0x9')]);router['get']('/users',auth[_0x1d0a('0x8')](),controller[_0x1d0a('0xa')]);router[_0x1d0a('0x7')](_0x1d0a('0xb'),auth[_0x1d0a('0x8')](),controller['show']);router['post']('/',auth[_0x1d0a('0x8')](),controller['create']);router[_0x1d0a('0xc')](_0x1d0a('0xb'),controller[_0x1d0a('0xd')]);router['delete'](_0x1d0a('0xb'),auth[_0x1d0a('0x8')](),controller[_0x1d0a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b6e879e..6434d43 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 _0xdd6e=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xdd6e,0xa5));var _0xedd6=function(_0x85dc6e,_0x4c0f9b){_0x85dc6e=_0x85dc6e-0x0;var _0x160547=_0xdd6e[_0x85dc6e];return _0x160547;};'use strict';var Sequelize=require(_0xedd6('0x0'));module[_0xedd6('0x1')]={'body':{'type':Sequelize[_0xedd6('0x2')](_0xedd6('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xedd6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xedd6('0x5')]('in',_0xedd6('0x6')),'defaultValue':_0xedd6('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5eef=['TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5eef,0x9c));var _0xf5ee=function(_0x308849,_0x25b2c9){_0x308849=_0x308849-0x0;var _0x3f3cad=_0x5eef[_0x308849];return _0x3f3cad;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xf5ee('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf5ee('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf5ee('0x2')]('in',_0xf5ee('0x3')),'defaultValue':_0xf5ee('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf5ee('0x4')]},'providerName':{'type':Sequelize[_0xf5ee('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6076999..8992996 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 _0x009e=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ChatMessage','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','email','manual','interface','SIP/%s','channel','event','accept','acceptmessage','parse','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','internal','motionChannel','EventManager','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x009e,0x100));var _0xe009=function(_0x374c1c,_0x522606){_0x374c1c=_0x374c1c-0x0;var _0x1c1c33=_0x009e[_0x374c1c];return _0x1c1c33;};'use strict';var emlformat=require(_0xe009('0x0'));var rimraf=require(_0xe009('0x1'));var zipdir=require(_0xe009('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe009('0x3'));var moment=require(_0xe009('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe009('0x5'));var util=require(_0xe009('0x6'));var path=require('path');var sox=require(_0xe009('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe009('0x8'));var _=require(_0xe009('0x9'));var squel=require(_0xe009('0xa'));var crypto=require(_0xe009('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe009('0xc'));var querystring=require('querystring');var Papa=require(_0xe009('0xd'));var Redis=require(_0xe009('0xe'));var authService=require(_0xe009('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe009('0x10'));var hardwareService=require(_0xe009('0x11'));var logger=require(_0xe009('0x12'))('api');var utils=require(_0xe009('0x13'));var config=require(_0xe009('0x14'));var licenseUtil=require(_0xe009('0x15'));var db=require(_0xe009('0x16'))['db'];config[_0xe009('0x17')]=_[_0xe009('0x18')](config[_0xe009('0x17')],{'host':_0xe009('0x19'),'port':0x18eb});var socket=require(_0xe009('0x1a'))(new Redis(config[_0xe009('0x17')]));require('./chatMessage.socket')[_0xe009('0x1b')](socket);var jayson=require(_0xe009('0x1c'));var client=jayson[_0xe009('0x1d')][_0xe009('0x1e')]({'port':0x232c});var client9002=jayson[_0xe009('0x1d')][_0xe009('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xc196a1,_0x376b50,_0x2d6eef,_0x1bb718){return new BPromise(function(_0x5608e2,_0x5c6e16){var _0x1be21f=_0x1bb718||client;return _0x1be21f[_0xe009('0x1f')](_0xc196a1,_0x2d6eef)[_0xe009('0x20')](function(_0x17a24d){logger[_0xe009('0x21')]('ChatMessage,\x20%s,\x20%s',_0x376b50,_0xe009('0x22'));logger[_0xe009('0x23')](_0xe009('0x24'),_0x376b50,_0xe009('0x22'),JSON[_0xe009('0x25')](_0x17a24d));if(_0x17a24d['error']){if(_0x17a24d[_0xe009('0x26')][_0xe009('0x27')]===0x1f4){logger['error'](_0xe009('0x28'),_0x376b50,_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);return _0x5c6e16(_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);}logger[_0xe009('0x26')](_0xe009('0x28'),_0x376b50,_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);return _0x5608e2(_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);}else{logger[_0xe009('0x21')](_0xe009('0x28'),_0x376b50,_0xe009('0x22'));_0x5608e2(_0x17a24d[_0xe009('0x2a')][_0xe009('0x29')]);}})[_0xe009('0x2b')](function(_0x20cb17){logger[_0xe009('0x26')]('ChatMessage,\x20%s,\x20%s',_0x376b50,_0x20cb17);_0x5c6e16(_0x20cb17);});});}function respondWithStatusCode(_0x144ba6,_0x8d7c8a){_0x8d7c8a=_0x8d7c8a||0xcc;return function(_0x27645f){if(_0x27645f){return _0x144ba6[_0xe009('0x2c')](_0x8d7c8a);}return _0x144ba6[_0xe009('0x2d')](_0x8d7c8a)[_0xe009('0x2e')]();};}function respondWithResult(_0x20a0b3,_0x1b5057){_0x1b5057=_0x1b5057||0xc8;return function(_0x4aff80){if(_0x4aff80){return _0x20a0b3[_0xe009('0x2d')](_0x1b5057)[_0xe009('0x2f')](_0x4aff80);}};}function respondWithFilteredResult(_0x29af6d,_0x9e7158){return function(_0x226102){if(_0x226102){var _0x64f245=typeof _0x9e7158[_0xe009('0x30')]==='undefined'&&typeof _0x9e7158[_0xe009('0x31')]==='undefined';var _0x310c83=_0x226102[_0xe009('0x32')];var _0x36a4d2=_0x64f245?0x0:_0x9e7158[_0xe009('0x30')];var _0x47a759=_0x64f245?_0x226102[_0xe009('0x32')]:_0x9e7158['offset']+_0x9e7158[_0xe009('0x31')];var _0xa1619b;if(_0x47a759>=_0x310c83){_0x47a759=_0x310c83;_0xa1619b=0xc8;}else{_0xa1619b=0xce;}_0x29af6d['status'](_0xa1619b);return _0x29af6d[_0xe009('0x33')](_0xe009('0x34'),_0x36a4d2+'-'+_0x47a759+'/'+_0x310c83)[_0xe009('0x2f')](_0x226102);}return null;};}function patchUpdates(_0x107bc6){return function(_0x30860c){try{jsonpatch[_0xe009('0x35')](_0x30860c,_0x107bc6,!![]);}catch(_0x44cdd6){return BPromise[_0xe009('0x36')](_0x44cdd6);}return _0x30860c[_0xe009('0x37')]();};}function saveUpdates(_0xc1873e,_0x43265d){return function(_0x240912){if(_0x240912){return _0x240912[_0xe009('0x38')](_0xc1873e)[_0xe009('0x20')](function(_0x2a1030){return _0x2a1030;});}return null;};}function removeEntity(_0x2a40d5,_0x2d3af4){return function(_0x57cff8){if(_0x57cff8){return _0x57cff8[_0xe009('0x39')]()[_0xe009('0x20')](function(){_0x2a40d5['status'](0xcc)[_0xe009('0x2e')]();});}};}function handleEntityNotFound(_0x3836e6,_0x213ee9){return function(_0xdcea0e){if(!_0xdcea0e){_0x3836e6[_0xe009('0x2c')](0x194);}return _0xdcea0e;};}function handleError(_0x3bd0ed,_0x95f08c){_0x95f08c=_0x95f08c||0x1f4;return function(_0x49c1d4){logger['error'](_0x49c1d4['stack']);if(_0x49c1d4[_0xe009('0x3a')]){delete _0x49c1d4['name'];}_0x3bd0ed[_0xe009('0x2d')](_0x95f08c)[_0xe009('0x3b')](_0x49c1d4);};}exports[_0xe009('0x3c')]=function(_0x48d2af,_0x83152){var _0xa637a2={},_0x5d9ddb={},_0x513008={'count':0x0,'rows':[]};var _0x3a220b=_[_0xe009('0x3d')](db[_0xe009('0x3e')]['rawAttributes'],function(_0x108453){return{'name':_0x108453['fieldName'],'type':_0x108453[_0xe009('0x3f')][_0xe009('0x40')]};});_0x5d9ddb[_0xe009('0x41')]=_['map'](_0x3a220b,_0xe009('0x3a'));_0x5d9ddb['query']=_[_0xe009('0x42')](_0x48d2af['query']);_0x5d9ddb[_0xe009('0x43')]=_['intersection'](_0x5d9ddb[_0xe009('0x41')],_0x5d9ddb[_0xe009('0x44')]);_0xa637a2[_0xe009('0x45')]=_[_0xe009('0x46')](_0x5d9ddb[_0xe009('0x41')],qs[_0xe009('0x47')](_0x48d2af['query']['fields']));_0xa637a2[_0xe009('0x45')]=_0xa637a2[_0xe009('0x45')][_0xe009('0x48')]?_0xa637a2['attributes']:_0x5d9ddb['model'];if(!_0x48d2af['query'][_0xe009('0x49')](_0xe009('0x4a'))){_0xa637a2['limit']=qs[_0xe009('0x31')](_0x48d2af[_0xe009('0x44')]['limit']);_0xa637a2[_0xe009('0x30')]=qs[_0xe009('0x30')](_0x48d2af[_0xe009('0x44')][_0xe009('0x30')]);}_0xa637a2[_0xe009('0x4b')]=qs[_0xe009('0x4c')](_0x48d2af[_0xe009('0x44')]['sort']);_0xa637a2[_0xe009('0x4d')]=qs[_0xe009('0x43')](_[_0xe009('0x4e')](_0x48d2af[_0xe009('0x44')],_0x5d9ddb['filters']),_0x3a220b);if(_0x48d2af['query'][_0xe009('0x4f')]){_0xa637a2['where']=_[_0xe009('0x50')](_0xa637a2[_0xe009('0x4d')],{'$or':_['map'](_0x3a220b,function(_0x3e563d){if(_0x3e563d['type']!==_0xe009('0x51')){var _0x5babb8={};_0x5babb8[_0x3e563d[_0xe009('0x3a')]]={'$like':'%'+_0x48d2af[_0xe009('0x44')]['filter']+'%'};return _0x5babb8;}})});}_0xa637a2=_[_0xe009('0x50')]({},_0xa637a2,_0x48d2af[_0xe009('0x52')]);var _0x35737c={'where':_0xa637a2[_0xe009('0x4d')]};return db['ChatMessage']['count'](_0x35737c)[_0xe009('0x20')](function(_0x578aa3){_0x513008['count']=_0x578aa3;if(_0x48d2af[_0xe009('0x44')]['includeAll']){_0xa637a2[_0xe009('0x53')]=[{'all':!![]}];}return db[_0xe009('0x3e')][_0xe009('0x54')](_0xa637a2);})[_0xe009('0x20')](function(_0x4f153a){_0x513008[_0xe009('0x55')]=_0x4f153a;return _0x513008;})[_0xe009('0x20')](respondWithFilteredResult(_0x83152,_0xa637a2))[_0xe009('0x2b')](handleError(_0x83152,null));};exports[_0xe009('0x56')]=function(_0x25a9ca,_0x409340){var _0xba677d={'raw':!![],'where':{'id':_0x25a9ca[_0xe009('0x57')]['id']}},_0xc3ed02={};_0xc3ed02[_0xe009('0x41')]=_['keys'](db[_0xe009('0x3e')][_0xe009('0x58')]);_0xc3ed02[_0xe009('0x44')]=_['keys'](_0x25a9ca[_0xe009('0x44')]);_0xc3ed02['filters']=_[_0xe009('0x46')](_0xc3ed02[_0xe009('0x41')],_0xc3ed02['query']);_0xba677d[_0xe009('0x45')]=_[_0xe009('0x46')](_0xc3ed02[_0xe009('0x41')],qs[_0xe009('0x47')](_0x25a9ca['query']['fields']));_0xba677d[_0xe009('0x45')]=_0xba677d[_0xe009('0x45')][_0xe009('0x48')]?_0xba677d[_0xe009('0x45')]:_0xc3ed02[_0xe009('0x41')];if(_0x25a9ca[_0xe009('0x44')][_0xe009('0x59')]){_0xba677d['include']=[{'all':!![]}];}_0xba677d=_[_0xe009('0x50')]({},_0xba677d,_0x25a9ca[_0xe009('0x52')]);return db['ChatMessage'][_0xe009('0x5a')](_0xba677d)['then'](handleEntityNotFound(_0x409340,null))['then'](respondWithResult(_0x409340,null))[_0xe009('0x2b')](handleError(_0x409340,null));};exports[_0xe009('0x5b')]=function(_0x4228d5,_0x43555d){return db[_0xe009('0x3e')]['create'](_0x4228d5[_0xe009('0x5c')],{})[_0xe009('0x20')](respondWithResult(_0x43555d,0xc9))['catch'](handleError(_0x43555d,null));};exports[_0xe009('0x38')]=function(_0x396fa3,_0x52f454){if(_0x396fa3['body']['id']){delete _0x396fa3['body']['id'];}return db[_0xe009('0x3e')][_0xe009('0x5a')]({'where':{'id':_0x396fa3[_0xe009('0x57')]['id']}})[_0xe009('0x20')](handleEntityNotFound(_0x52f454,null))['then'](saveUpdates(_0x396fa3['body'],null))[_0xe009('0x20')](respondWithResult(_0x52f454,null))['catch'](handleError(_0x52f454,null));};exports[_0xe009('0x39')]=function(_0x4fe9ed,_0x2ed100){return db[_0xe009('0x3e')][_0xe009('0x5a')]({'where':{'id':_0x4fe9ed['params']['id']}})[_0xe009('0x20')](handleEntityNotFound(_0x2ed100,null))[_0xe009('0x20')](removeEntity(_0x2ed100,null))[_0xe009('0x2b')](handleError(_0x2ed100,null));};exports[_0xe009('0x5d')]=function(_0x2d1531,_0x50c29b){return db[_0xe009('0x3e')][_0xe009('0x5d')]()['then'](respondWithResult(_0x50c29b,null))['catch'](handleError(_0x50c29b,null));};var interaction_log=require('../../config/logger')(_0xe009('0x5e'));exports['accept']=function(_0x1ec3a0,_0x274353,_0x5ae96d){var _0x5eb828={'agent':{},'channel':_0xe009('0x5f')};if(_0x1ec3a0[_0xe009('0x5c')]['id']){delete _0x1ec3a0[_0xe009('0x5c')]['id'];}_0x1ec3a0['body'][_0xe009('0x60')]=!![];_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x61')]=moment()[_0xe009('0x62')](_0xe009('0x63'));_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')]=_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')]||_0x1ec3a0[_0xe009('0x65')]['id'];_0x5eb828[_0xe009('0x66')]['id']=_0x1ec3a0[_0xe009('0x5c')]['UserId'];return db[_0xe009('0x3e')]['find']({'where':{'id':_0x1ec3a0[_0xe009('0x57')]['id'],'UserId':null}})[_0xe009('0x20')](handleEntityNotFound(_0x274353,null))['then'](saveUpdates(_0x1ec3a0[_0xe009('0x5c')],null))['then'](function(_0x5e5d8a){if(_0x5e5d8a){_0x5eb828[_0xe009('0x29')]=_0x5e5d8a[_0xe009('0x67')]({'plain':!![]});return db[_0xe009('0x68')][_0xe009('0x5a')]({'where':{'id':_0x5e5d8a['ChatInteractionId']}});}return null;})[_0xe009('0x20')](handleEntityNotFound(_0x274353,null))[_0xe009('0x20')](function(_0x268a58){if(_0x268a58){return _0x268a58[_0xe009('0x38')]({'UserId':_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')],'read1stAt':_['isNil'](_0x268a58[_0xe009('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe009('0x20')](function(_0x2480d1){if(_0x2480d1){_0x5eb828['interaction']=_0x2480d1[_0xe009('0x67')]({'plain':!![]});interaction_log['info'](_0xe009('0x6a'),_0x1ec3a0[_0xe009('0x65')]['id'],_0x1ec3a0[_0xe009('0x65')][_0xe009('0x3a')],_0x1ec3a0[_0xe009('0x65')][_0xe009('0x6b')],_0x5eb828['interaction']['id'],_0x1ec3a0['body']?JSON['stringify'](_0x1ec3a0[_0xe009('0x5c')]):_0xe009('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5eb828);}return null;})[_0xe009('0x20')](function(_0x5008e6){var _0x320a3b=_0xe009('0x6d')+_0x5008e6[_0xe009('0x29')]['ContactId'];return db['sequelize'][_0xe009('0x44')](_0x320a3b,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xe009('0x20')](function(_0x19f8b8){return _0x19f8b8;});})[_0xe009('0x20')](function(_0x5194d9){if(_0x5194d9){_0x5eb828[_0xe009('0x29')][_0xe009('0x6e')]=_0x5194d9[0x0];if(!_0x1ec3a0[_0xe009('0x5c')]['UserId'])return;return db[_0xe009('0x6f')][_0xe009('0x5a')]({'where':{'id':_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')],'role':_0xe009('0x66')},'attributes':['id',_0xe009('0x3a'),'fullname',_0xe009('0x70'),'internal'],'raw':!![]});}return null;})[_0xe009('0x20')](function(_0x5b1cfd){if(!_0x5b1cfd)return null;_0x5eb828['message'][_0xe009('0x66')]=_0x5b1cfd;return _0x5eb828;})[_0xe009('0x20')](function(_0x393728){if(_0x393728){if(_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x71')]){_0x5eb828[_0xe009('0x29')][_0xe009('0x72')]=util[_0xe009('0x62')](_0xe009('0x73'),_0x1ec3a0[_0xe009('0x65')][_0xe009('0x3a')]);_0x5eb828[_0xe009('0x29')][_0xe009('0x74')]=_0x5eb828[_0xe009('0x74')];_0x5eb828[_0xe009('0x29')]['motionChannel']=_0x5eb828[_0xe009('0x74')];_0x5eb828[_0xe009('0x29')][_0xe009('0x75')]=_0xe009('0x76');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xe009('0x77'),'message':_[_0xe009('0x50')](_0x5eb828['message'],JSON[_0xe009('0x78')](_0x5eb828['interaction']['formData']))},client9002)['then'](function(){return _0x5eb828;});}return _0x5eb828;}return null;})[_0xe009('0x20')](respondWithResult(_0x274353,null))[_0xe009('0x2b')](handleError(_0x274353,null));};var interaction_log=require(_0xe009('0x12'))(_0xe009('0x5e'));exports[_0xe009('0x36')]=function(_0x485913,_0xbc1f52,_0x3f9980){var _0x1f3806={'agent':{},'channel':_0xe009('0x5f')};if(_0x485913[_0xe009('0x5c')]['id']){delete _0x485913[_0xe009('0x5c')]['id'];}_0x485913['body'][_0xe009('0x64')]=_0x485913['body'][_0xe009('0x64')]||_0x485913[_0xe009('0x65')]['id'];_0x1f3806[_0xe009('0x66')]['id']=_0x485913[_0xe009('0x5c')][_0xe009('0x64')];return db['ChatMessage']['find']({'where':{'id':_0x485913[_0xe009('0x57')]['id'],'UserId':null}})[_0xe009('0x20')](handleEntityNotFound(_0xbc1f52,null))[_0xe009('0x20')](function(_0x54c962){if(_0x54c962){_0x1f3806[_0xe009('0x29')]=_0x54c962['get']({'plain':!![]});return db[_0xe009('0x68')][_0xe009('0x5a')]({'where':{'id':_0x54c962[_0xe009('0x79')]}});}return null;})[_0xe009('0x20')](handleEntityNotFound(_0xbc1f52,null))['then'](function(_0x3b34f3){if(_0x3b34f3){_0x1f3806['interaction']=_0x3b34f3[_0xe009('0x67')]({'plain':!![]});interaction_log[_0xe009('0x21')](_0xe009('0x7a'),_0x485913[_0xe009('0x65')]['id'],_0x485913['user'][_0xe009('0x3a')],_0x485913[_0xe009('0x65')]['role'],_0x1f3806[_0xe009('0x7b')]['id'],_0x485913[_0xe009('0x5c')]?JSON[_0xe009('0x25')](_0x485913[_0xe009('0x5c')]):_0xe009('0x6c'));return respondWithRpcPromise(_0xe009('0x7c'),_0xe009('0x7d'),_0x1f3806);}return null;})[_0xe009('0x20')](function(_0x239596){var _0x73b9b0=_0xe009('0x6d')+_0x239596[_0xe009('0x29')]['ContactId'];return db['sequelize'][_0xe009('0x44')](_0x73b9b0,{'type':db[_0xe009('0x7e')][_0xe009('0x7f')][_0xe009('0x80')],'raw':!![]})['then'](function(_0xb27ecf){return _0xb27ecf;});})[_0xe009('0x20')](function(_0x164c01){if(_0x164c01){_0x1f3806[_0xe009('0x29')]['contact']=_0x164c01[0x0];if(!_0x485913[_0xe009('0x5c')][_0xe009('0x64')])return;return db[_0xe009('0x6f')][_0xe009('0x5a')]({'where':{'id':_0x485913['body'][_0xe009('0x64')],'role':_0xe009('0x66')},'attributes':['id','name',_0xe009('0x81'),_0xe009('0x70'),_0xe009('0x82')],'raw':!![]});}return null;})[_0xe009('0x20')](function(_0x3bbb7a){if(!_0x3bbb7a)return null;_0x1f3806[_0xe009('0x29')][_0xe009('0x66')]=_0x3bbb7a;return _0x1f3806;})['then'](function(_0x31cbfd){if(_0x31cbfd){_0x31cbfd[_0xe009('0x29')][_0xe009('0x72')]=util[_0xe009('0x62')](_0xe009('0x73'),_0x485913[_0xe009('0x65')][_0xe009('0x3a')]);_0x31cbfd[_0xe009('0x29')][_0xe009('0x74')]=_0x1f3806[_0xe009('0x74')];_0x31cbfd[_0xe009('0x29')][_0xe009('0x83')]=_0x1f3806[_0xe009('0x74')];_0x31cbfd[_0xe009('0x29')][_0xe009('0x75')]='reject';respondWithRpcPromise(_0xe009('0x84'),'EventManager',{'event':_0xe009('0x85'),'message':_[_0xe009('0x50')](_0x1f3806[_0xe009('0x29')],JSON[_0xe009('0x78')](_0x1f3806[_0xe009('0x7b')]['formData']))},client9002);return _0x1f3806;}return null;})[_0xe009('0x20')](respondWithResult(_0xbc1f52,null))[_0xe009('0x2b')](handleError(_0xbc1f52,null));}; \ No newline at end of file +var _0x99c8=['bluebird','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','findAll','rows','show','params','length','include','options','create','body','find','destroy','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','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','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','formData','RejectMessage','rejectMessage','sequelize','internal','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x99c8,0x18c));var _0x899c=function(_0x3be326,_0x5e0ea4){_0x3be326=_0x3be326-0x0;var _0x39a867=_0x99c8[_0x3be326];return _0x39a867;};'use strict';var emlformat=require(_0x899c('0x0'));var rimraf=require(_0x899c('0x1'));var zipdir=require(_0x899c('0x2'));var jsonpatch=require(_0x899c('0x3'));var rp=require(_0x899c('0x4'));var moment=require(_0x899c('0x5'));var BPromise=require(_0x899c('0x6'));var Mustache=require('mustache');var util=require(_0x899c('0x7'));var path=require('path');var sox=require(_0x899c('0x8'));var csv=require(_0x899c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x899c('0xa'));var squel=require(_0x899c('0xb'));var crypto=require('crypto');var jsforce=require(_0x899c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x899c('0x9'));var querystring=require(_0x899c('0xd'));var Papa=require(_0x899c('0xe'));var Redis=require(_0x899c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x899c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x899c('0x11'));var logger=require(_0x899c('0x12'))(_0x899c('0x13'));var utils=require('../../config/utils');var config=require(_0x899c('0x14'));var licenseUtil=require(_0x899c('0x15'));var db=require(_0x899c('0x16'))['db'];config[_0x899c('0x17')]=_['defaults'](config[_0x899c('0x17')],{'host':_0x899c('0x18'),'port':0x18eb});var socket=require(_0x899c('0x19'))(new Redis(config[_0x899c('0x17')]));require(_0x899c('0x1a'))[_0x899c('0x1b')](socket);var jayson=require(_0x899c('0x1c'));var client=jayson[_0x899c('0x1d')][_0x899c('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7572,_0x4320fe,_0x572788,_0x274b9b){return new BPromise(function(_0x54f4f2,_0x1d223d){var _0x3c54eb=_0x274b9b||client;return _0x3c54eb[_0x899c('0x1f')](_0x3c7572,_0x572788)[_0x899c('0x20')](function(_0x35a43e){logger[_0x899c('0x21')](_0x899c('0x22'),_0x4320fe,_0x899c('0x23'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4320fe,_0x899c('0x23'),JSON[_0x899c('0x24')](_0x35a43e));if(_0x35a43e[_0x899c('0x25')]){if(_0x35a43e[_0x899c('0x25')][_0x899c('0x26')]===0x1f4){logger[_0x899c('0x25')](_0x899c('0x22'),_0x4320fe,_0x35a43e[_0x899c('0x25')]['message']);return _0x1d223d(_0x35a43e['error'][_0x899c('0x27')]);}logger[_0x899c('0x25')](_0x899c('0x22'),_0x4320fe,_0x35a43e[_0x899c('0x25')]['message']);return _0x54f4f2(_0x35a43e[_0x899c('0x25')][_0x899c('0x27')]);}else{logger[_0x899c('0x21')](_0x899c('0x22'),_0x4320fe,'request\x20sent');_0x54f4f2(_0x35a43e[_0x899c('0x28')][_0x899c('0x27')]);}})[_0x899c('0x29')](function(_0x5e4a6e){logger[_0x899c('0x25')](_0x899c('0x22'),_0x4320fe,_0x5e4a6e);_0x1d223d(_0x5e4a6e);});});}function respondWithStatusCode(_0x54e63e,_0x1b3fa1){_0x1b3fa1=_0x1b3fa1||0xcc;return function(_0x295c39){if(_0x295c39){return _0x54e63e['sendStatus'](_0x1b3fa1);}return _0x54e63e[_0x899c('0x2a')](_0x1b3fa1)[_0x899c('0x2b')]();};}function respondWithResult(_0x5c2b7b,_0x3887c1){_0x3887c1=_0x3887c1||0xc8;return function(_0x220784){if(_0x220784){return _0x5c2b7b[_0x899c('0x2a')](_0x3887c1)[_0x899c('0x2c')](_0x220784);}};}function respondWithFilteredResult(_0x2862c4,_0x3df1cf){return function(_0x4b4e58){if(_0x4b4e58){var _0x4cf036=typeof _0x3df1cf[_0x899c('0x2d')]===_0x899c('0x2e')&&typeof _0x3df1cf[_0x899c('0x2f')]==='undefined';var _0x35e0d5=_0x4b4e58['count'];var _0x17ffde=_0x4cf036?0x0:_0x3df1cf[_0x899c('0x2d')];var _0x3f221f=_0x4cf036?_0x4b4e58[_0x899c('0x30')]:_0x3df1cf[_0x899c('0x2d')]+_0x3df1cf[_0x899c('0x2f')];var _0x28abc4;if(_0x3f221f>=_0x35e0d5){_0x3f221f=_0x35e0d5;_0x28abc4=0xc8;}else{_0x28abc4=0xce;}_0x2862c4[_0x899c('0x2a')](_0x28abc4);return _0x2862c4[_0x899c('0x31')](_0x899c('0x32'),_0x17ffde+'-'+_0x3f221f+'/'+_0x35e0d5)['json'](_0x4b4e58);}return null;};}function patchUpdates(_0x1703b3){return function(_0x1cd62b){try{jsonpatch['apply'](_0x1cd62b,_0x1703b3,!![]);}catch(_0x5b13cd){return BPromise[_0x899c('0x33')](_0x5b13cd);}return _0x1cd62b[_0x899c('0x34')]();};}function saveUpdates(_0x28142b,_0x48bc75){return function(_0x28cdd6){if(_0x28cdd6){return _0x28cdd6[_0x899c('0x35')](_0x28142b)['then'](function(_0x1375aa){return _0x1375aa;});}return null;};}function removeEntity(_0x28122e,_0x56f503){return function(_0x351c39){if(_0x351c39){return _0x351c39['destroy']()['then'](function(){_0x28122e[_0x899c('0x2a')](0xcc)[_0x899c('0x2b')]();});}};}function handleEntityNotFound(_0x2a6cd8,_0x1734f3){return function(_0x4d949c){if(!_0x4d949c){_0x2a6cd8[_0x899c('0x36')](0x194);}return _0x4d949c;};}function handleError(_0x14c63a,_0x5de737){_0x5de737=_0x5de737||0x1f4;return function(_0x6e380a){logger['error'](_0x6e380a[_0x899c('0x37')]);if(_0x6e380a[_0x899c('0x38')]){delete _0x6e380a[_0x899c('0x38')];}_0x14c63a['status'](_0x5de737)[_0x899c('0x39')](_0x6e380a);};}exports[_0x899c('0x3a')]=function(_0x5f2fa4,_0x32c32b){var _0x4cea41={},_0x41bcef={},_0xb95897={'count':0x0,'rows':[]};var _0x2510f6=_[_0x899c('0x3b')](db[_0x899c('0x3c')][_0x899c('0x3d')],function(_0x2e9fd5){return{'name':_0x2e9fd5[_0x899c('0x3e')],'type':_0x2e9fd5['type'][_0x899c('0x3f')]};});_0x41bcef[_0x899c('0x40')]=_[_0x899c('0x3b')](_0x2510f6,_0x899c('0x38'));_0x41bcef['query']=_[_0x899c('0x41')](_0x5f2fa4['query']);_0x41bcef['filters']=_['intersection'](_0x41bcef[_0x899c('0x40')],_0x41bcef[_0x899c('0x42')]);_0x4cea41[_0x899c('0x43')]=_[_0x899c('0x44')](_0x41bcef['model'],qs[_0x899c('0x45')](_0x5f2fa4['query'][_0x899c('0x45')]));_0x4cea41['attributes']=_0x4cea41[_0x899c('0x43')]['length']?_0x4cea41[_0x899c('0x43')]:_0x41bcef[_0x899c('0x40')];if(!_0x5f2fa4[_0x899c('0x42')][_0x899c('0x46')](_0x899c('0x47'))){_0x4cea41[_0x899c('0x2f')]=qs[_0x899c('0x2f')](_0x5f2fa4[_0x899c('0x42')][_0x899c('0x2f')]);_0x4cea41[_0x899c('0x2d')]=qs['offset'](_0x5f2fa4[_0x899c('0x42')][_0x899c('0x2d')]);}_0x4cea41['order']=qs[_0x899c('0x48')](_0x5f2fa4[_0x899c('0x42')][_0x899c('0x48')]);_0x4cea41[_0x899c('0x49')]=qs[_0x899c('0x4a')](_[_0x899c('0x4b')](_0x5f2fa4[_0x899c('0x42')],_0x41bcef[_0x899c('0x4a')]),_0x2510f6);if(_0x5f2fa4[_0x899c('0x42')][_0x899c('0x4c')]){_0x4cea41['where']=_[_0x899c('0x4d')](_0x4cea41[_0x899c('0x49')],{'$or':_[_0x899c('0x3b')](_0x2510f6,function(_0x22a72e){if(_0x22a72e[_0x899c('0x4e')]!==_0x899c('0x4f')){var _0x28b98d={};_0x28b98d[_0x22a72e['name']]={'$like':'%'+_0x5f2fa4[_0x899c('0x42')][_0x899c('0x4c')]+'%'};return _0x28b98d;}})});}_0x4cea41=_[_0x899c('0x4d')]({},_0x4cea41,_0x5f2fa4['options']);var _0x14838a={'where':_0x4cea41[_0x899c('0x49')]};return db[_0x899c('0x3c')]['count'](_0x14838a)[_0x899c('0x20')](function(_0x2e4687){_0xb95897[_0x899c('0x30')]=_0x2e4687;if(_0x5f2fa4[_0x899c('0x42')]['includeAll']){_0x4cea41['include']=[{'all':!![]}];}return db[_0x899c('0x3c')][_0x899c('0x50')](_0x4cea41);})['then'](function(_0x20e9a3){_0xb95897[_0x899c('0x51')]=_0x20e9a3;return _0xb95897;})[_0x899c('0x20')](respondWithFilteredResult(_0x32c32b,_0x4cea41))[_0x899c('0x29')](handleError(_0x32c32b,null));};exports[_0x899c('0x52')]=function(_0x58719c,_0x10f3d1){var _0xf636fc={'raw':!![],'where':{'id':_0x58719c[_0x899c('0x53')]['id']}},_0x450285={};_0x450285['model']=_[_0x899c('0x41')](db[_0x899c('0x3c')][_0x899c('0x3d')]);_0x450285[_0x899c('0x42')]=_[_0x899c('0x41')](_0x58719c[_0x899c('0x42')]);_0x450285['filters']=_['intersection'](_0x450285[_0x899c('0x40')],_0x450285[_0x899c('0x42')]);_0xf636fc[_0x899c('0x43')]=_['intersection'](_0x450285[_0x899c('0x40')],qs['fields'](_0x58719c['query']['fields']));_0xf636fc[_0x899c('0x43')]=_0xf636fc[_0x899c('0x43')][_0x899c('0x54')]?_0xf636fc['attributes']:_0x450285[_0x899c('0x40')];if(_0x58719c['query']['includeAll']){_0xf636fc[_0x899c('0x55')]=[{'all':!![]}];}_0xf636fc=_[_0x899c('0x4d')]({},_0xf636fc,_0x58719c[_0x899c('0x56')]);return db[_0x899c('0x3c')]['find'](_0xf636fc)[_0x899c('0x20')](handleEntityNotFound(_0x10f3d1,null))[_0x899c('0x20')](respondWithResult(_0x10f3d1,null))[_0x899c('0x29')](handleError(_0x10f3d1,null));};exports[_0x899c('0x57')]=function(_0x44fe3d,_0x2f3159){return db[_0x899c('0x3c')]['create'](_0x44fe3d['body'],{})['then'](respondWithResult(_0x2f3159,0xc9))['catch'](handleError(_0x2f3159,null));};exports[_0x899c('0x35')]=function(_0x156ff3,_0x900cfc){if(_0x156ff3['body']['id']){delete _0x156ff3[_0x899c('0x58')]['id'];}return db[_0x899c('0x3c')][_0x899c('0x59')]({'where':{'id':_0x156ff3[_0x899c('0x53')]['id']}})[_0x899c('0x20')](handleEntityNotFound(_0x900cfc,null))[_0x899c('0x20')](saveUpdates(_0x156ff3[_0x899c('0x58')],null))[_0x899c('0x20')](respondWithResult(_0x900cfc,null))[_0x899c('0x29')](handleError(_0x900cfc,null));};exports[_0x899c('0x5a')]=function(_0x38fc35,_0x1090ae){return db[_0x899c('0x3c')]['find']({'where':{'id':_0x38fc35[_0x899c('0x53')]['id']}})[_0x899c('0x20')](handleEntityNotFound(_0x1090ae,null))[_0x899c('0x20')](removeEntity(_0x1090ae,null))[_0x899c('0x29')](handleError(_0x1090ae,null));};exports[_0x899c('0x5b')]=function(_0x3ff94c,_0x3e9cd2){return db['ChatMessage'][_0x899c('0x5b')]()[_0x899c('0x20')](respondWithResult(_0x3e9cd2,null))['catch'](handleError(_0x3e9cd2,null));};var interaction_log=require(_0x899c('0x12'))(_0x899c('0x5c'));exports[_0x899c('0x5d')]=function(_0x106b4d,_0x34b360,_0x4c3fe3){var _0x5b0b23={'agent':{},'channel':_0x899c('0x5e')};if(_0x106b4d[_0x899c('0x58')]['id']){delete _0x106b4d[_0x899c('0x58')]['id'];}_0x106b4d[_0x899c('0x58')][_0x899c('0x5f')]=!![];_0x106b4d[_0x899c('0x58')]['readAt']=moment()[_0x899c('0x60')](_0x899c('0x61'));_0x106b4d[_0x899c('0x58')][_0x899c('0x62')]=_0x106b4d[_0x899c('0x58')][_0x899c('0x62')]||_0x106b4d[_0x899c('0x63')]['id'];_0x5b0b23[_0x899c('0x64')]['id']=_0x106b4d[_0x899c('0x58')][_0x899c('0x62')];return db[_0x899c('0x3c')][_0x899c('0x59')]({'where':{'id':_0x106b4d['params']['id'],'UserId':null}})[_0x899c('0x20')](handleEntityNotFound(_0x34b360,null))[_0x899c('0x20')](saveUpdates(_0x106b4d[_0x899c('0x58')],null))['then'](function(_0x9f913a){if(_0x9f913a){_0x5b0b23[_0x899c('0x27')]=_0x9f913a[_0x899c('0x65')]({'plain':!![]});return db[_0x899c('0x66')][_0x899c('0x59')]({'where':{'id':_0x9f913a[_0x899c('0x67')]}});}return null;})[_0x899c('0x20')](handleEntityNotFound(_0x34b360,null))[_0x899c('0x20')](function(_0x1f6ec9){if(_0x1f6ec9){return _0x1f6ec9[_0x899c('0x35')]({'UserId':_0x106b4d[_0x899c('0x58')][_0x899c('0x62')],'read1stAt':_[_0x899c('0x68')](_0x1f6ec9[_0x899c('0x69')])?moment()[_0x899c('0x60')](_0x899c('0x61')):undefined});}return null;})[_0x899c('0x20')](function(_0x34a72a){if(_0x34a72a){_0x5b0b23[_0x899c('0x6a')]=_0x34a72a['get']({'plain':!![]});interaction_log[_0x899c('0x21')](_0x899c('0x6b'),_0x106b4d[_0x899c('0x63')]['id'],_0x106b4d[_0x899c('0x63')][_0x899c('0x38')],_0x106b4d[_0x899c('0x63')][_0x899c('0x6c')],_0x5b0b23[_0x899c('0x6a')]['id'],_0x106b4d['body']?JSON[_0x899c('0x24')](_0x106b4d[_0x899c('0x58')]):_0x899c('0x6d'));return respondWithRpcPromise(_0x899c('0x6e'),_0x899c('0x6f'),_0x5b0b23);}return null;})['then'](function(_0x2641dd){var _0x4f14db=_0x899c('0x70')+_0x2641dd['message'][_0x899c('0x71')];return db['sequelize']['query'](_0x4f14db,{'type':db[_0x899c('0x72')][_0x899c('0x73')][_0x899c('0x74')],'raw':!![]})[_0x899c('0x20')](function(_0x3b9156){return _0x3b9156;});})['then'](function(_0x3a0fb7){if(_0x3a0fb7){_0x5b0b23['message'][_0x899c('0x75')]=_0x3a0fb7[0x0];if(!_0x106b4d['body'][_0x899c('0x62')])return;return db[_0x899c('0x76')]['find']({'where':{'id':_0x106b4d['body']['UserId'],'role':'agent'},'attributes':['id',_0x899c('0x38'),_0x899c('0x77'),_0x899c('0x78'),'internal'],'raw':!![]});}return null;})['then'](function(_0x24f7e7){if(!_0x24f7e7)return null;_0x5b0b23[_0x899c('0x27')][_0x899c('0x64')]=_0x24f7e7;return _0x5b0b23;})[_0x899c('0x20')](function(_0x4e0b58){if(_0x4e0b58){if(_0x106b4d[_0x899c('0x58')]['manual']){_0x5b0b23['message'][_0x899c('0x79')]=util[_0x899c('0x60')](_0x899c('0x7a'),_0x106b4d[_0x899c('0x63')][_0x899c('0x38')]);_0x5b0b23['message'][_0x899c('0x7b')]=_0x5b0b23[_0x899c('0x7b')];_0x5b0b23[_0x899c('0x27')][_0x899c('0x7c')]=_0x5b0b23[_0x899c('0x7b')];_0x5b0b23['message']['event']=_0x899c('0x5d');return respondWithRpcPromise(_0x899c('0x7d'),_0x899c('0x7d'),{'event':_0x899c('0x7e'),'message':_[_0x899c('0x4d')](_0x5b0b23[_0x899c('0x27')],JSON['parse'](_0x5b0b23[_0x899c('0x6a')][_0x899c('0x7f')]))},client9002)[_0x899c('0x20')](function(){return _0x5b0b23;});}return _0x5b0b23;}return null;})[_0x899c('0x20')](respondWithResult(_0x34b360,null))[_0x899c('0x29')](handleError(_0x34b360,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x899c('0x33')]=function(_0x3910b9,_0x359945,_0x35322a){var _0x5819e9={'agent':{},'channel':_0x899c('0x5e')};if(_0x3910b9['body']['id']){delete _0x3910b9[_0x899c('0x58')]['id'];}_0x3910b9[_0x899c('0x58')][_0x899c('0x62')]=_0x3910b9['body']['UserId']||_0x3910b9[_0x899c('0x63')]['id'];_0x5819e9[_0x899c('0x64')]['id']=_0x3910b9['body'][_0x899c('0x62')];return db['ChatMessage'][_0x899c('0x59')]({'where':{'id':_0x3910b9[_0x899c('0x53')]['id'],'UserId':null}})[_0x899c('0x20')](handleEntityNotFound(_0x359945,null))[_0x899c('0x20')](function(_0x2d915c){if(_0x2d915c){_0x5819e9[_0x899c('0x27')]=_0x2d915c[_0x899c('0x65')]({'plain':!![]});return db[_0x899c('0x66')]['find']({'where':{'id':_0x2d915c['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x359945,null))['then'](function(_0xa546b1){if(_0xa546b1){_0x5819e9[_0x899c('0x6a')]=_0xa546b1['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3910b9[_0x899c('0x63')]['id'],_0x3910b9[_0x899c('0x63')]['name'],_0x3910b9['user']['role'],_0x5819e9[_0x899c('0x6a')]['id'],_0x3910b9[_0x899c('0x58')]?JSON[_0x899c('0x24')](_0x3910b9[_0x899c('0x58')]):_0x899c('0x6d'));return respondWithRpcPromise(_0x899c('0x80'),_0x899c('0x81'),_0x5819e9);}return null;})['then'](function(_0x17a1cc){var _0x20627c=_0x899c('0x70')+_0x17a1cc[_0x899c('0x27')][_0x899c('0x71')];return db[_0x899c('0x82')][_0x899c('0x42')](_0x20627c,{'type':db['Sequelize'][_0x899c('0x73')][_0x899c('0x74')],'raw':!![]})[_0x899c('0x20')](function(_0xafa702){return _0xafa702;});})[_0x899c('0x20')](function(_0x4dcaf3){if(_0x4dcaf3){_0x5819e9['message'][_0x899c('0x75')]=_0x4dcaf3[0x0];if(!_0x3910b9[_0x899c('0x58')][_0x899c('0x62')])return;return db['User']['find']({'where':{'id':_0x3910b9[_0x899c('0x58')]['UserId'],'role':_0x899c('0x64')},'attributes':['id','name',_0x899c('0x77'),_0x899c('0x78'),_0x899c('0x83')],'raw':!![]});}return null;})[_0x899c('0x20')](function(_0x197c1d){if(!_0x197c1d)return null;_0x5819e9[_0x899c('0x27')][_0x899c('0x64')]=_0x197c1d;return _0x5819e9;})[_0x899c('0x20')](function(_0x89960b){if(_0x89960b){_0x89960b[_0x899c('0x27')]['interface']=util[_0x899c('0x60')](_0x899c('0x7a'),_0x3910b9[_0x899c('0x63')][_0x899c('0x38')]);_0x89960b[_0x899c('0x27')]['channel']=_0x5819e9[_0x899c('0x7b')];_0x89960b[_0x899c('0x27')][_0x899c('0x7c')]=_0x5819e9[_0x899c('0x7b')];_0x89960b[_0x899c('0x27')][_0x899c('0x84')]=_0x899c('0x33');respondWithRpcPromise(_0x899c('0x7d'),_0x899c('0x7d'),{'event':_0x899c('0x85'),'message':_['merge'](_0x5819e9[_0x899c('0x27')],JSON['parse'](_0x5819e9[_0x899c('0x6a')]['formData']))},client9002);return _0x5819e9;}return null;})[_0x899c('0x20')](respondWithResult(_0x359945,null))['catch'](handleError(_0x359945,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 0463c86..5cbd061 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 _0xb98a=['ChatMessage','setMaxListeners','update','remove','emit','events'];(function(_0x5e48ba,_0x5dd869){var _0x27076e=function(_0x5e6d75){while(--_0x5e6d75){_0x5e48ba['push'](_0x5e48ba['shift']());}};_0x27076e(++_0x5dd869);}(_0xb98a,0x1f1));var _0xab98=function(_0x1235a8,_0x2db48e){_0x1235a8=_0x1235a8-0x0;var _0x41a2cf=_0xb98a[_0x1235a8];return _0x41a2cf;};'use strict';var EventEmitter=require(_0xab98('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xab98('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xab98('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xab98('0x3'),'afterDestroy':_0xab98('0x4')};function emitEvent(_0x1ae6a0){return function(_0x4c4631,_0x2a2f1e,_0x4cfae4){ChatMessageEvents['emit'](_0x1ae6a0+':'+_0x4c4631['id'],_0x4c4631);ChatMessageEvents[_0xab98('0x5')](_0x1ae6a0,_0x4c4631);_0x4cfae4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x62a8=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatMessage'];(function(_0x24c38e,_0x512304){var _0x5070ed=function(_0x572f4a){while(--_0x572f4a){_0x24c38e['push'](_0x24c38e['shift']());}};_0x5070ed(++_0x512304);}(_0x62a8,0xa8));var _0x862a=function(_0x137062,_0x2306e3){_0x137062=_0x137062-0x0;var _0x2928a8=_0x62a8[_0x137062];return _0x2928a8;};'use strict';var EventEmitter=require(_0x862a('0x0'));var ChatMessage=require(_0x862a('0x1'))['db'][_0x862a('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x862a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x862a('0x4'),'afterDestroy':_0x862a('0x5')};function emitEvent(_0x3bc547){return function(_0xddc502,_0x1ca180,_0x5f29a1){ChatMessageEvents[_0x862a('0x6')](_0x3bc547+':'+_0xddc502['id'],_0xddc502);ChatMessageEvents['emit'](_0x3bc547,_0xddc502);_0x5f29a1(null);};}for(var e in events){if(events[_0x862a('0x7')](e)){var event=events[e];ChatMessage[_0x862a('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b7f515d..981f50a 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 _0x330c=['update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteractionId','then'];(function(_0x383875,_0x45b02b){var _0x128fc2=function(_0x247f99){while(--_0x247f99){_0x383875['push'](_0x383875['shift']());}};_0x128fc2(++_0x45b02b);}(_0x330c,0x186));var _0xc330=function(_0x56f0f8,_0x28d84a){_0x56f0f8=_0x56f0f8-0x0;var _0x29c23c=_0x330c[_0x56f0f8];return _0x29c23c;};'use strict';var _=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var logger=require(_0xc330('0x2'))(_0xc330('0x3'));var moment=require('moment');var BPromise=require(_0xc330('0x4'));var rp=require(_0xc330('0x5'));var fs=require('fs');var path=require(_0xc330('0x6'));var rimraf=require(_0xc330('0x7'));var config=require(_0xc330('0x8'));var attributes=require(_0xc330('0x9'));module['exports']=function(_0x4f49fb,_0x53d0ca){return _0x4f49fb[_0xc330('0xa')](_0xc330('0xb'),attributes,{'tableName':_0xc330('0xc'),'paranoid':![],'indexes':[{'name':_0xc330('0xd'),'fields':[_0xc330('0xe')],'type':_0xc330('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bebaa,_0x48480e,_0x150c7d){var _0x4c1a5f=_0x4f49fb[_0xc330('0x10')];var _0x49ad4c=_0x1bebaa[_0xc330('0x11')]({'plain':!![]});if(_0x49ad4c[_0xc330('0x12')][_0xc330('0x13')]()==='in'||_0x49ad4c[_0xc330('0x12')][_0xc330('0x13')]()===_0xc330('0x14')&&!_0x49ad4c[_0xc330('0x15')]&&!_[_0xc330('0x16')](_0x49ad4c[_0xc330('0x17')])){_0x4c1a5f['ChatInteraction']['findOne']({'where':{'id':_0x49ad4c[_0xc330('0x18')]}})[_0xc330('0x19')](function(_0x5066d8){if(_0x5066d8){_0x5066d8[_0xc330('0x1a')]({'lastMsgAt':_0x49ad4c[_0xc330('0x1b')],'lastMsgDirection':_0x49ad4c[_0xc330('0x12')][_0xc330('0x13')]()});}})[_0xc330('0x1c')](function(_0xdd6f7f){console[_0xc330('0x1d')](_0xdd6f7f);});}_0x150c7d();}},'charset':_0xc330('0x1e'),'collate':_0xc330('0x1f')});}; \ No newline at end of file +var _0x7566=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x7566,0x110));var _0x6756=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x7566[_0x574617];return _0x29de90;};'use strict';var _=require('lodash');var util=require(_0x6756('0x0'));var logger=require(_0x6756('0x1'))(_0x6756('0x2'));var moment=require(_0x6756('0x3'));var BPromise=require(_0x6756('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6756('0x5'));var rimraf=require('rimraf');var config=require(_0x6756('0x6'));var attributes=require('./chatMessage.attributes');module[_0x6756('0x7')]=function(_0x44abef,_0x3331d1){return _0x44abef['define']('ChatMessage',attributes,{'tableName':_0x6756('0x8'),'paranoid':![],'indexes':[{'name':_0x6756('0x9'),'fields':[_0x6756('0xa')],'type':_0x6756('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x30af91,_0xcbd79f,_0x1ba797){var _0x4be34d=_0x44abef[_0x6756('0xc')];var _0x590f0b=_0x30af91['get']({'plain':!![]});if(_0x590f0b[_0x6756('0xd')][_0x6756('0xe')]()==='in'||_0x590f0b[_0x6756('0xd')][_0x6756('0xe')]()===_0x6756('0xf')&&!_0x590f0b[_0x6756('0x10')]&&!_['isNil'](_0x590f0b[_0x6756('0x11')])){_0x4be34d[_0x6756('0x12')][_0x6756('0x13')]({'where':{'id':_0x590f0b[_0x6756('0x14')]}})[_0x6756('0x15')](function(_0x846006){if(_0x846006){_0x846006[_0x6756('0x16')]({'lastMsgAt':_0x590f0b[_0x6756('0x17')],'lastMsgDirection':_0x590f0b[_0x6756('0xd')][_0x6756('0xe')]()});}})['catch'](function(_0x2b996b){console[_0x6756('0x18')](_0x2b996b);});}_0x1ba797();}},'charset':_0x6756('0x19'),'collate':_0x6756('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 888ff0f..7bc13b3 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 _0x3cb7=['redis','defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','body','options','debug','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1f62c9,_0x57a575){var _0x150b84=function(_0x48d237){while(--_0x48d237){_0x1f62c9['push'](_0x1f62c9['shift']());}};_0x150b84(++_0x57a575);}(_0x3cb7,0xcf));var _0x73cb=function(_0x5d68a2,_0x4304cf){_0x5d68a2=_0x5d68a2-0x0;var _0x5b3088=_0x3cb7[_0x5d68a2];return _0x5b3088;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73cb('0x0'));var BPromise=require('bluebird');var rs=require(_0x73cb('0x1'));var fs=require('fs');var Redis=require(_0x73cb('0x2'));var db=require(_0x73cb('0x3'))['db'];var utils=require(_0x73cb('0x4'));var logger=require(_0x73cb('0x5'))(_0x73cb('0x6'));var config=require(_0x73cb('0x7'));var jayson=require(_0x73cb('0x8'));var client=jayson['client'][_0x73cb('0x9')]({'port':0x232a});config[_0x73cb('0xa')]=_[_0x73cb('0xb')](config[_0x73cb('0xa')],{'host':_0x73cb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73cb('0xa')]));require(_0x73cb('0xd'))[_0x73cb('0xe')](socket);function respondWithRpcPromise(_0x29deae,_0x1826dd,_0xc1a63e){return new BPromise(function(_0x43eab2,_0x501542){return client[_0x73cb('0xf')](_0x29deae,_0xc1a63e)[_0x73cb('0x10')](function(_0x35900e){logger[_0x73cb('0x11')](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));logger['debug'](_0x73cb('0x14'),_0x1826dd,_0x73cb('0x13'),JSON[_0x73cb('0x15')](_0x35900e));if(_0x35900e[_0x73cb('0x16')]){if(_0x35900e[_0x73cb('0x16')][_0x73cb('0x17')]===0x1f4){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x501542(_0x35900e['error']['message']);}logger['error'](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x43eab2(_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);}else{logger['info'](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));_0x43eab2(_0x35900e[_0x73cb('0x19')][_0x73cb('0x18')]);}})[_0x73cb('0x1a')](function(_0x28ee3b){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x28ee3b);_0x501542(_0x28ee3b);});});}exports[_0x73cb('0x1b')]=function(_0x31fb89){var _0x50a5c4=this;return new Promise(function(_0xe092aa,_0x18d19e){return db['ChatMessage']['create'](_0x31fb89[_0x73cb('0x1c')],{'raw':_0x31fb89[_0x73cb('0x1d')]?_0x31fb89[_0x73cb('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x73cb('0x10')](function(_0x4885e9){logger['info'](_0x73cb('0x1b'),_0x31fb89);logger[_0x73cb('0x1e')]('CreateChatMessage',_0x31fb89,JSON[_0x73cb('0x15')](_0x4885e9));_0xe092aa(_0x4885e9);})[_0x73cb('0x1a')](function(_0x24bae0){logger['error'](_0x73cb('0x1b'),_0x24bae0[_0x73cb('0x18')],_0x31fb89);_0x18d19e(_0x50a5c4[_0x73cb('0x16')](0x1f4,_0x24bae0[_0x73cb('0x18')]));});});}; \ No newline at end of file +var _0x7749=['create','body','options','raw','CreateChatMessage','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','defaults','redis','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x803730,_0x7426de){var _0xf3733c=function(_0x1f7d61){while(--_0x1f7d61){_0x803730['push'](_0x803730['shift']());}};_0xf3733c(++_0x7426de);}(_0x7749,0xf6));var _0x9774=function(_0xeccf0,_0x80aca8){_0xeccf0=_0xeccf0-0x0;var _0x45ea74=_0x7749[_0xeccf0];return _0x45ea74;};'use strict';var _=require(_0x9774('0x0'));var util=require(_0x9774('0x1'));var moment=require(_0x9774('0x2'));var BPromise=require('bluebird');var rs=require(_0x9774('0x3'));var fs=require('fs');var Redis=require(_0x9774('0x4'));var db=require(_0x9774('0x5'))['db'];var utils=require(_0x9774('0x6'));var logger=require('../../config/logger')(_0x9774('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9774('0x8')]['http']({'port':0x232a});config['redis']=_[_0x9774('0x9')](config[_0x9774('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9774('0xa')]));require(_0x9774('0xb'))[_0x9774('0xc')](socket);function respondWithRpcPromise(_0x27d363,_0xe1a87,_0x1f65bc){return new BPromise(function(_0xafe459,_0x3bdde5){return client[_0x9774('0xd')](_0x27d363,_0x1f65bc)[_0x9774('0xe')](function(_0xed35ea){logger[_0x9774('0xf')](_0x9774('0x10'),_0xe1a87,_0x9774('0x11'));logger[_0x9774('0x12')](_0x9774('0x13'),_0xe1a87,_0x9774('0x11'),JSON[_0x9774('0x14')](_0xed35ea));if(_0xed35ea['error']){if(_0xed35ea[_0x9774('0x15')][_0x9774('0x16')]===0x1f4){logger[_0x9774('0x15')](_0x9774('0x10'),_0xe1a87,_0xed35ea[_0x9774('0x15')][_0x9774('0x17')]);return _0x3bdde5(_0xed35ea[_0x9774('0x15')][_0x9774('0x17')]);}logger[_0x9774('0x15')]('ChatMessage,\x20%s,\x20%s',_0xe1a87,_0xed35ea[_0x9774('0x15')]['message']);return _0xafe459(_0xed35ea[_0x9774('0x15')][_0x9774('0x17')]);}else{logger['info'](_0x9774('0x10'),_0xe1a87,_0x9774('0x11'));_0xafe459(_0xed35ea['result'][_0x9774('0x17')]);}})['catch'](function(_0x34a615){logger[_0x9774('0x15')](_0x9774('0x10'),_0xe1a87,_0x34a615);_0x3bdde5(_0x34a615);});});}exports['CreateChatMessage']=function(_0x878283){var _0x4ee07e=this;return new Promise(function(_0x43d408,_0x271c5){return db['ChatMessage'][_0x9774('0x18')](_0x878283[_0x9774('0x19')],{'raw':_0x878283[_0x9774('0x1a')]?_0x878283[_0x9774('0x1a')][_0x9774('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4a18e5){logger[_0x9774('0xf')](_0x9774('0x1c'),_0x878283);logger[_0x9774('0x12')](_0x9774('0x1c'),_0x878283,JSON[_0x9774('0x14')](_0x4a18e5));_0x43d408(_0x4a18e5);})[_0x9774('0x1d')](function(_0x4b53c6){logger[_0x9774('0x15')]('CreateChatMessage',_0x4b53c6['message'],_0x878283);_0x271c5(_0x4ee07e[_0x9774('0x15')](0x1f4,_0x4b53c6[_0x9774('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7ef8b49..687a788 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 _0x19da=['update','register','length','save'];(function(_0x3771c8,_0x4f1814){var _0x54917f=function(_0x5287d3){while(--_0x5287d3){_0x3771c8['push'](_0x3771c8['shift']());}};_0x54917f(++_0x4f1814);}(_0x19da,0x9f));var _0xa19d=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x19da[_0x59bcb1];return _0x4a737f;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa19d('0x0'),'remove',_0xa19d('0x1')];function createListener(_0x5ba569,_0x3a48f4){return function(_0x17f1c6){_0x3a48f4['emit'](_0x5ba569,_0x17f1c6);};}function removeListener(_0x179db7,_0x28ec9a){return function(){ChatMessageEvents['removeListener'](_0x179db7,_0x28ec9a);};}exports[_0xa19d('0x2')]=function(_0x330adb){for(var _0x1f6e10=0x0,_0x14dc68=events[_0xa19d('0x3')];_0x1f6e10<_0x14dc68;_0x1f6e10++){var _0x4b4627=events[_0x1f6e10];var _0x197c4e=createListener('chatMessage:'+_0x4b4627,_0x330adb);ChatMessageEvents['on'](_0x4b4627,_0x197c4e);}}; \ No newline at end of file +var _0xa1a5=['register','chatMessage:','./chatMessage.events','remove','update','removeListener'];(function(_0x1a3051,_0x1eaac0){var _0x2e83d6=function(_0x46110c){while(--_0x46110c){_0x1a3051['push'](_0x1a3051['shift']());}};_0x2e83d6(++_0x1eaac0);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x18405f,_0x47a737){_0x18405f=_0x18405f-0x0;var _0x13a343=_0xa1a5[_0x18405f];return _0x13a343;};'use strict';var ChatMessageEvents=require(_0x5a1a('0x0'));var events=['save',_0x5a1a('0x1'),_0x5a1a('0x2')];function createListener(_0x1d0a04,_0x13223e){return function(_0x1eac2b){_0x13223e['emit'](_0x1d0a04,_0x1eac2b);};}function removeListener(_0x3d3652,_0x12138d){return function(){ChatMessageEvents[_0x5a1a('0x3')](_0x3d3652,_0x12138d);};}exports[_0x5a1a('0x4')]=function(_0x1b718f){for(var _0x27f71f=0x0,_0x1062b9=events['length'];_0x27f71f<_0x1062b9;_0x27f71f++){var _0x1ec37f=events[_0x27f71f];var _0x313212=createListener(_0x5a1a('0x5')+_0x1ec37f,_0x1b718f);ChatMessageEvents['on'](_0x1ec37f,_0x313212);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 7dc0c69..d0917ea 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 _0x87d1=['put','/:id/accept','accept','reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','describe','/:id','tracked','chat'];(function(_0x22e8a9,_0x148d2b){var _0x46f0b2=function(_0x3b3079){while(--_0x3b3079){_0x22e8a9['push'](_0x22e8a9['shift']());}};_0x46f0b2(++_0x148d2b);}(_0x87d1,0x1bf));var _0x187d=function(_0x1be453,_0x4328ae){_0x1be453=_0x1be453-0x0;var _0x569960=_0x87d1[_0x1be453];return _0x569960;};'use strict';var multer=require(_0x187d('0x0'));var util=require('util');var path=require(_0x187d('0x1'));var timeout=require(_0x187d('0x2'));var express=require('express');var router=express[_0x187d('0x3')]();var fs_extra=require(_0x187d('0x4'));var auth=require(_0x187d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x187d('0x6'));router[_0x187d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x187d('0x7')]('/describe',auth[_0x187d('0x8')](),controller[_0x187d('0x9')]);router['get'](_0x187d('0xa'),auth[_0x187d('0x8')](),controller['show']);router['post']('/',auth[_0x187d('0x8')](),interaction[_0x187d('0xb')](_0x187d('0xc'),'chatmessage:create'),controller['create']);router[_0x187d('0xd')]('/:id',controller['update']);router['put'](_0x187d('0xe'),auth[_0x187d('0x8')](),controller[_0x187d('0xf')]);router[_0x187d('0xd')]('/:id/reject',auth['isAuthenticated'](),controller[_0x187d('0x10')]);router[_0x187d('0x11')](_0x187d('0xa'),auth['isAuthenticated'](),controller[_0x187d('0x12')]);module[_0x187d('0x13')]=router; \ No newline at end of file +var _0x4c0b=['accept','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','/:id','show','tracked','chat','chatmessage:create','create','put','/:id/accept'];(function(_0x4fdd64,_0x379e15){var _0x1a1296=function(_0x2a8dd5){while(--_0x2a8dd5){_0x4fdd64['push'](_0x4fdd64['shift']());}};_0x1a1296(++_0x379e15);}(_0x4c0b,0xad));var _0xb4c0=function(_0xe4dc7,_0x3abcdc){_0xe4dc7=_0xe4dc7-0x0;var _0x5b3969=_0x4c0b[_0xe4dc7];return _0x5b3969;};'use strict';var multer=require(_0xb4c0('0x0'));var util=require(_0xb4c0('0x1'));var path=require(_0xb4c0('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4c0('0x3'));var router=express[_0xb4c0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb4c0('0x5'));var config=require(_0xb4c0('0x6'));var controller=require(_0xb4c0('0x7'));router[_0xb4c0('0x8')]('/',auth[_0xb4c0('0x9')](),controller['index']);router[_0xb4c0('0x8')](_0xb4c0('0xa'),auth[_0xb4c0('0x9')](),controller['describe']);router[_0xb4c0('0x8')](_0xb4c0('0xb'),auth['isAuthenticated'](),controller[_0xb4c0('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xb4c0('0xd')](_0xb4c0('0xe'),_0xb4c0('0xf')),controller[_0xb4c0('0x10')]);router[_0xb4c0('0x11')](_0xb4c0('0xb'),controller['update']);router[_0xb4c0('0x11')](_0xb4c0('0x12'),auth['isAuthenticated'](),controller[_0xb4c0('0x13')]);router[_0xb4c0('0x11')](_0xb4c0('0x14'),auth[_0xb4c0('0x9')](),controller[_0xb4c0('0x15')]);router['delete'](_0xb4c0('0xb'),auth[_0xb4c0('0x9')](),controller[_0xb4c0('0x16')]);module[_0xb4c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ba7609d..a7bb65b 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x23183c,_0x46de69){var _0x231ba2=function(_0x1c4eb5){while(--_0x1c4eb5){_0x23183c['push'](_0x23183c['shift']());}};_0x231ba2(++_0x46de69);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3dc688,_0x4c604b){_0x3dc688=_0x3dc688-0x0;var _0x26cea2=_0x5f2f[_0x3dc688];return _0x26cea2;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0b0e,0x187));var _0xe0b0=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x0b0e[_0x28edda];return _0x21f4a4;};'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 e2bc9ce..24e6339 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(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x7a54,0x106));var _0x47a5=function(_0x66f9f7,_0x4ee763){_0x66f9f7=_0x66f9f7-0x0;var _0x51948f=_0x7a54[_0x66f9f7];return _0x51948f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7a54,0x106));var _0x47a5=function(_0x1aeb14,_0x3115d3){_0x1aeb14=_0x1aeb14-0x0;var _0x497fb5=_0x7a54[_0x1aeb14];return _0x497fb5;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 5ae0e9d..c5ea32c 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 _0x9b09=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x9b09,0xfd));var _0x99b0=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x9b09[_0x1559a5];return _0x17a783;};'use strict';var EventEmitter=require(_0x99b0('0x0'));var ChatOfflineMessage=require(_0x99b0('0x1'))['db'][_0x99b0('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x99b0('0x3')};function emitEvent(_0x38c7be){return function(_0x163d3b,_0x30f596,_0x120ca5){ChatOfflineMessageEvents[_0x99b0('0x4')](_0x38c7be+':'+_0x163d3b['id'],_0x163d3b);ChatOfflineMessageEvents[_0x99b0('0x4')](_0x38c7be,_0x163d3b);_0x120ca5(null);};}for(var e in events){if(events[_0x99b0('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x99b0('0x6')](e,emitEvent(event));}}module[_0x99b0('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xcf98=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0xcf98,0x8d));var _0x8cf9=function(_0x5a68e5,_0x510207){_0x5a68e5=_0x5a68e5-0x0;var _0x18b9d2=_0xcf98[_0x5a68e5];return _0x18b9d2;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x8cf9('0x0'))['db'][_0x8cf9('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x8cf9('0x2')](0x0);var events={'afterCreate':_0x8cf9('0x3'),'afterUpdate':_0x8cf9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x479f6b){return function(_0x2ebf57,_0x28ae77,_0x1ce13f){ChatOfflineMessageEvents[_0x8cf9('0x5')](_0x479f6b+':'+_0x2ebf57['id'],_0x2ebf57);ChatOfflineMessageEvents[_0x8cf9('0x5')](_0x479f6b,_0x2ebf57);_0x1ce13f(null);};}for(var e in events){if(events[_0x8cf9('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x8cf9('0x7')](e,emitEvent(event));}}module[_0x8cf9('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index afb5525..590a6f9 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 _0x085c=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x42a3c0,_0x522753){var _0x1da011=function(_0x24cda7){while(--_0x24cda7){_0x42a3c0['push'](_0x42a3c0['shift']());}};_0x1da011(++_0x522753);}(_0x085c,0x13e));var _0xc085=function(_0x33ea9e,_0x2f0d10){_0x33ea9e=_0x33ea9e-0x0;var _0x3ac557=_0x085c[_0x33ea9e];return _0x3ac557;};'use strict';var attributes=require(_0xc085('0x0'));module[_0xc085('0x1')]=function(_0x4fe6bd){return _0x4fe6bd['define'](_0xc085('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc085('0x3'),'collate':_0xc085('0x4')});}; \ No newline at end of file +var _0x28d4=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports'];(function(_0x2666a0,_0x23fba6){var _0x56ec57=function(_0x35e94a){while(--_0x35e94a){_0x2666a0['push'](_0x2666a0['shift']());}};_0x56ec57(++_0x23fba6);}(_0x28d4,0x13f));var _0x428d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x28d4[_0x502c7d];return _0x30b7ed;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x428d('0x0')]=function(_0x2ed13b){return _0x2ed13b['define']('ChatOfflineMessage',attributes,{'tableName':_0x428d('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x428d('0x2'),'collate':_0x428d('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7996092..cc1e0a5 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 _0xb13b=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0xb13b,0x1de));var _0xbb13=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xb13b[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xbb13('0x0'));var util=require(_0xbb13('0x1'));var moment=require(_0xbb13('0x2'));var BPromise=require(_0xbb13('0x3'));var rs=require(_0xbb13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb13('0x5'))['db'];var utils=require(_0xbb13('0x6'));var logger=require('../../config/logger')(_0xbb13('0x7'));var config=require(_0xbb13('0x8'));var jayson=require(_0xbb13('0x9'));var client=jayson[_0xbb13('0xa')][_0xbb13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd4a4bd,_0x1067a5,_0x3be2d2){return new BPromise(function(_0x56dc8f,_0x58d7d0){return client[_0xbb13('0xc')](_0xd4a4bd,_0x3be2d2)[_0xbb13('0xd')](function(_0x1c71b9){logger[_0xbb13('0xe')](_0xbb13('0xf'),_0x1067a5,_0xbb13('0x10'));logger[_0xbb13('0x11')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1067a5,_0xbb13('0x10'),JSON[_0xbb13('0x12')](_0x1c71b9));if(_0x1c71b9[_0xbb13('0x13')]){if(_0x1c71b9['error'][_0xbb13('0x14')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1067a5,_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);return _0x58d7d0(_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);}logger['error'](_0xbb13('0xf'),_0x1067a5,_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);return _0x56dc8f(_0x1c71b9['error'][_0xbb13('0x15')]);}else{logger['info'](_0xbb13('0xf'),_0x1067a5,'request\x20sent');_0x56dc8f(_0x1c71b9[_0xbb13('0x16')][_0xbb13('0x15')]);}})[_0xbb13('0x17')](function(_0x53602a){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1067a5,_0x53602a);_0x58d7d0(_0x53602a);});});} \ No newline at end of file +var _0x50f0=['request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0x2f2004,_0x2ea89a){var _0x2ab262=function(_0x41fe41){while(--_0x41fe41){_0x2f2004['push'](_0x2f2004['shift']());}};_0x2ab262(++_0x2ea89a);}(_0x50f0,0x6b));var _0x050f=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x50f0[_0x30bd4d];return _0x306915;};'use strict';var _=require(_0x050f('0x0'));var util=require(_0x050f('0x1'));var moment=require(_0x050f('0x2'));var BPromise=require(_0x050f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x050f('0x4'));var db=require(_0x050f('0x5'))['db'];var utils=require(_0x050f('0x6'));var logger=require(_0x050f('0x7'))(_0x050f('0x8'));var config=require('../../config/environment');var jayson=require(_0x050f('0x9'));var client=jayson['client'][_0x050f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fb30d,_0x2fee32,_0x2944b8){return new BPromise(function(_0x9c050c,_0x5547f4){return client[_0x050f('0xb')](_0x2fb30d,_0x2944b8)['then'](function(_0x41289e){logger[_0x050f('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2fee32,_0x050f('0xd'));logger['debug'](_0x050f('0xe'),_0x2fee32,_0x050f('0xd'),JSON['stringify'](_0x41289e));if(_0x41289e[_0x050f('0xf')]){if(_0x41289e[_0x050f('0xf')][_0x050f('0x10')]===0x1f4){logger[_0x050f('0xf')](_0x050f('0x11'),_0x2fee32,_0x41289e[_0x050f('0xf')][_0x050f('0x12')]);return _0x5547f4(_0x41289e[_0x050f('0xf')][_0x050f('0x12')]);}logger[_0x050f('0xf')](_0x050f('0x11'),_0x2fee32,_0x41289e[_0x050f('0xf')][_0x050f('0x12')]);return _0x9c050c(_0x41289e[_0x050f('0xf')][_0x050f('0x12')]);}else{logger[_0x050f('0xc')](_0x050f('0x11'),_0x2fee32,'request\x20sent');_0x9c050c(_0x41289e[_0x050f('0x13')][_0x050f('0x12')]);}})['catch'](function(_0x12f1b9){logger[_0x050f('0xf')](_0x050f('0x11'),_0x2fee32,_0x12f1b9);_0x5547f4(_0x12f1b9);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 2ee7f38..b54b847 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 _0x0b93=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b93,0x15f));var _0x30b9=function(_0x49534b,_0x147009){_0x49534b=_0x49534b-0x0;var _0x22517e=_0x0b93[_0x49534b];return _0x22517e;};'use strict';var multer=require('multer');var util=require(_0x30b9('0x0'));var path=require('path');var timeout=require(_0x30b9('0x1'));var express=require(_0x30b9('0x2'));var router=express[_0x30b9('0x3')]();var fs_extra=require(_0x30b9('0x4'));var auth=require(_0x30b9('0x5'));var interaction=require(_0x30b9('0x6'));var config=require(_0x30b9('0x7'));var controller=require(_0x30b9('0x8'));router[_0x30b9('0x9')]('/',auth[_0x30b9('0xa')](),controller[_0x30b9('0xb')]);router[_0x30b9('0x9')](_0x30b9('0xc'),auth[_0x30b9('0xa')](),controller[_0x30b9('0xd')]);router[_0x30b9('0x9')](_0x30b9('0xe'),auth['isAuthenticated'](),controller[_0x30b9('0xf')]);router[_0x30b9('0x10')]('/',auth['isAuthenticated'](),controller[_0x30b9('0x11')]);router[_0x30b9('0x12')](_0x30b9('0xe'),auth[_0x30b9('0xa')](),controller['update']);router[_0x30b9('0x13')](_0x30b9('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x30b9('0x14')]=router; \ No newline at end of file +var _0xa185=['./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a459e,_0x48fa57){var _0x42697d=function(_0xcd4825){while(--_0xcd4825){_0x5a459e['push'](_0x5a459e['shift']());}};_0x42697d(++_0x48fa57);}(_0xa185,0x65));var _0x5a18=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa185[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x5a18('0x0'));var util=require(_0x5a18('0x1'));var path=require(_0x5a18('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a18('0x3'));var router=express[_0x5a18('0x4')]();var fs_extra=require(_0x5a18('0x5'));var auth=require(_0x5a18('0x6'));var interaction=require(_0x5a18('0x7'));var config=require(_0x5a18('0x8'));var controller=require(_0x5a18('0x9'));router[_0x5a18('0xa')]('/',auth[_0x5a18('0xb')](),controller[_0x5a18('0xc')]);router[_0x5a18('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5a18('0xd')]);router[_0x5a18('0xa')](_0x5a18('0xe'),auth[_0x5a18('0xb')](),controller[_0x5a18('0xf')]);router['post']('/',auth[_0x5a18('0xb')](),controller[_0x5a18('0x10')]);router[_0x5a18('0x11')](_0x5a18('0xe'),auth['isAuthenticated'](),controller[_0x5a18('0x12')]);router[_0x5a18('0x13')](_0x5a18('0xe'),auth[_0x5a18('0xb')](),controller[_0x5a18('0x14')]);module[_0x5a18('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c125392..98c5aeb 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 _0xe9a9=['exports','STRING','ENUM','mouseOver','timeout'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe9a9,0x1b3));var _0x9e9a=function(_0x5fb411,_0x5e0a38){_0x5fb411=_0x5fb411-0x0;var _0xb5443d=_0xe9a9[_0x5fb411];return _0xb5443d;};'use strict';var Sequelize=require('sequelize');module[_0x9e9a('0x0')]={'name':{'type':Sequelize[_0x9e9a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9e9a('0x2')](_0x9e9a('0x3'),_0x9e9a('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x9e9a('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe121=['STRING','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0xe121,0xa0));var _0x1e12=function(_0x5c1501,_0x17b28a){_0x5c1501=_0x5c1501-0x0;var _0x5c4197=_0xe121[_0x5c1501];return _0x5c4197;};'use strict';var Sequelize=require(_0x1e12('0x0'));module[_0x1e12('0x1')]={'name':{'type':Sequelize[_0x1e12('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1e12('0x3'),_0x1e12('0x4')),'defaultValue':_0x1e12('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1e12('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index bf7850e..d938558 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 _0x4016=['then','destroy','error','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','rimraf','zip-dir','bluebird','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x4016,0x131));var _0x6401=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4016[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6401('0x0'));var zipdir=require(_0x6401('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6401('0x2'));var Mustache=require('mustache');var util=require(_0x6401('0x3'));var path=require(_0x6401('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6401('0x5'));var fs=require('fs');var fs_extra=require(_0x6401('0x6'));var _=require('lodash');var squel=require(_0x6401('0x7'));var crypto=require('crypto');var jsforce=require(_0x6401('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6401('0x9'));var querystring=require(_0x6401('0xa'));var Papa=require(_0x6401('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6401('0xc'));var as=require(_0x6401('0xd'));var hardwareService=require(_0x6401('0xe'));var logger=require('../../config/logger')(_0x6401('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6401('0x10'));var db=require(_0x6401('0x11'))['db'];function respondWithStatusCode(_0x26ec93,_0x45e88a){_0x45e88a=_0x45e88a||0xcc;return function(_0xf7fc5){if(_0xf7fc5){return _0x26ec93[_0x6401('0x12')](_0x45e88a);}return _0x26ec93[_0x6401('0x13')](_0x45e88a)[_0x6401('0x14')]();};}function respondWithResult(_0x381c17,_0x1f6edf){_0x1f6edf=_0x1f6edf||0xc8;return function(_0x45fcea){if(_0x45fcea){return _0x381c17[_0x6401('0x13')](_0x1f6edf)[_0x6401('0x15')](_0x45fcea);}};}function respondWithFilteredResult(_0x29fedc,_0x4c740a){return function(_0x1b510e){if(_0x1b510e){var _0x1fd3b8=typeof _0x4c740a[_0x6401('0x16')]===_0x6401('0x17')&&typeof _0x4c740a[_0x6401('0x18')]===_0x6401('0x17');var _0x4521b6=_0x1b510e['count'];var _0x55ca87=_0x1fd3b8?0x0:_0x4c740a[_0x6401('0x16')];var _0x50eda7=_0x1fd3b8?_0x1b510e[_0x6401('0x19')]:_0x4c740a[_0x6401('0x16')]+_0x4c740a[_0x6401('0x18')];var _0x3c3a6c;if(_0x50eda7>=_0x4521b6){_0x50eda7=_0x4521b6;_0x3c3a6c=0xc8;}else{_0x3c3a6c=0xce;}_0x29fedc[_0x6401('0x13')](_0x3c3a6c);return _0x29fedc[_0x6401('0x1a')](_0x6401('0x1b'),_0x55ca87+'-'+_0x50eda7+'/'+_0x4521b6)['json'](_0x1b510e);}return null;};}function patchUpdates(_0x10fd3c){return function(_0x44525b){try{jsonpatch[_0x6401('0x1c')](_0x44525b,_0x10fd3c,!![]);}catch(_0x1757ab){return BPromise['reject'](_0x1757ab);}return _0x44525b[_0x6401('0x1d')]();};}function saveUpdates(_0x343d25,_0x4ed76d){return function(_0x20b445){if(_0x20b445){return _0x20b445[_0x6401('0x1e')](_0x343d25)[_0x6401('0x1f')](function(_0xdea921){return _0xdea921;});}return null;};}function removeEntity(_0x19d6a0,_0x39bca3){return function(_0xed5d29){if(_0xed5d29){return _0xed5d29[_0x6401('0x20')]()[_0x6401('0x1f')](function(){_0x19d6a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55818a,_0xee5737){return function(_0x12f19a){if(!_0x12f19a){_0x55818a[_0x6401('0x12')](0x194);}return _0x12f19a;};}function handleError(_0x4e6d9f,_0x3b1d99){_0x3b1d99=_0x3b1d99||0x1f4;return function(_0x102f69){logger[_0x6401('0x21')](_0x102f69[_0x6401('0x22')]);if(_0x102f69['name']){delete _0x102f69['name'];}_0x4e6d9f[_0x6401('0x13')](_0x3b1d99)[_0x6401('0x23')](_0x102f69);};}exports[_0x6401('0x24')]=function(_0x466a35,_0x549b8c){var _0x7f6e88={'raw':!![],'where':{'id':_0x466a35[_0x6401('0x25')]['id']}},_0x43e089={};_0x43e089[_0x6401('0x26')]=_[_0x6401('0x27')](db[_0x6401('0x28')][_0x6401('0x29')]);_0x43e089[_0x6401('0x2a')]=_['keys'](_0x466a35[_0x6401('0x2a')]);_0x43e089[_0x6401('0x2b')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],_0x43e089['query']);_0x7f6e88[_0x6401('0x2d')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],qs['fields'](_0x466a35['query'][_0x6401('0x2e')]));_0x7f6e88['attributes']=_0x7f6e88[_0x6401('0x2d')][_0x6401('0x2f')]?_0x7f6e88[_0x6401('0x2d')]:_0x43e089[_0x6401('0x26')];if(_0x466a35[_0x6401('0x2a')][_0x6401('0x30')]){_0x7f6e88[_0x6401('0x31')]=[{'all':!![]}];}_0x7f6e88=_[_0x6401('0x32')]({},_0x7f6e88,_0x466a35[_0x6401('0x33')]);return db['ChatProactiveAction'][_0x6401('0x34')](_0x7f6e88)[_0x6401('0x1f')](handleEntityNotFound(_0x549b8c,null))[_0x6401('0x1f')](respondWithResult(_0x549b8c,null))[_0x6401('0x35')](handleError(_0x549b8c,null));};exports[_0x6401('0x36')]=function(_0x556354,_0xd7a00f){return db[_0x6401('0x28')]['create'](_0x556354[_0x6401('0x37')],{})['then'](respondWithResult(_0xd7a00f,0xc9))[_0x6401('0x35')](handleError(_0xd7a00f,null));};exports[_0x6401('0x1e')]=function(_0x5317f8,_0x444339){if(_0x5317f8[_0x6401('0x37')]['id']){delete _0x5317f8[_0x6401('0x37')]['id'];}return db[_0x6401('0x28')]['find']({'where':{'id':_0x5317f8[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x444339,null))[_0x6401('0x1f')](saveUpdates(_0x5317f8['body'],null))[_0x6401('0x1f')](respondWithResult(_0x444339,null))[_0x6401('0x35')](handleError(_0x444339,null));};exports['destroy']=function(_0x79d73f,_0x337d1c){return db[_0x6401('0x28')][_0x6401('0x34')]({'where':{'id':_0x79d73f[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x337d1c,null))[_0x6401('0x1f')](removeEntity(_0x337d1c,null))[_0x6401('0x35')](handleError(_0x337d1c,null));}; \ No newline at end of file +var _0xd4d1=['fields','length','includeAll','include','ChatProactiveAction','catch','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','crypto','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','undefined','limit','offset','count','json','then','destroy','end','error','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes'];(function(_0x57b971,_0x1ea555){var _0x47d1d8=function(_0x12e4c7){while(--_0x12e4c7){_0x57b971['push'](_0x57b971['shift']());}};_0x47d1d8(++_0x1ea555);}(_0xd4d1,0x123));var _0x1d4d=function(_0x5842ba,_0x18b717){_0x5842ba=_0x5842ba-0x0;var _0x57705f=_0xd4d1[_0x5842ba];return _0x57705f;};'use strict';var emlformat=require(_0x1d4d('0x0'));var rimraf=require(_0x1d4d('0x1'));var zipdir=require(_0x1d4d('0x2'));var jsonpatch=require(_0x1d4d('0x3'));var rp=require(_0x1d4d('0x4'));var moment=require('moment');var BPromise=require(_0x1d4d('0x5'));var Mustache=require('mustache');var util=require(_0x1d4d('0x6'));var path=require('path');var sox=require(_0x1d4d('0x7'));var csv=require('to-csv');var ejs=require(_0x1d4d('0x8'));var fs=require('fs');var fs_extra=require(_0x1d4d('0x9'));var _=require(_0x1d4d('0xa'));var squel=require('squel');var crypto=require(_0x1d4d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1d4d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1d4d('0xd'));var Papa=require(_0x1d4d('0xe'));var Redis=require(_0x1d4d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1d4d('0x10'));var as=require(_0x1d4d('0x11'));var hardwareService=require(_0x1d4d('0x12'));var logger=require('../../config/logger')(_0x1d4d('0x13'));var utils=require(_0x1d4d('0x14'));var config=require(_0x1d4d('0x15'));var licenseUtil=require(_0x1d4d('0x16'));var db=require(_0x1d4d('0x17'))['db'];function respondWithStatusCode(_0x9f5623,_0x111424){_0x111424=_0x111424||0xcc;return function(_0x436699){if(_0x436699){return _0x9f5623[_0x1d4d('0x18')](_0x111424);}return _0x9f5623[_0x1d4d('0x19')](_0x111424)['end']();};}function respondWithResult(_0x2941e6,_0x4561e3){_0x4561e3=_0x4561e3||0xc8;return function(_0x505e7e){if(_0x505e7e){return _0x2941e6['status'](_0x4561e3)['json'](_0x505e7e);}};}function respondWithFilteredResult(_0x14a98c,_0x5d3434){return function(_0xcc78f9){if(_0xcc78f9){var _0x59de78=typeof _0x5d3434['offset']===_0x1d4d('0x1a')&&typeof _0x5d3434[_0x1d4d('0x1b')]==='undefined';var _0x1adf14=_0xcc78f9['count'];var _0x4254a6=_0x59de78?0x0:_0x5d3434[_0x1d4d('0x1c')];var _0x16fa99=_0x59de78?_0xcc78f9[_0x1d4d('0x1d')]:_0x5d3434[_0x1d4d('0x1c')]+_0x5d3434['limit'];var _0x2d1b01;if(_0x16fa99>=_0x1adf14){_0x16fa99=_0x1adf14;_0x2d1b01=0xc8;}else{_0x2d1b01=0xce;}_0x14a98c[_0x1d4d('0x19')](_0x2d1b01);return _0x14a98c['set']('Content-Range',_0x4254a6+'-'+_0x16fa99+'/'+_0x1adf14)[_0x1d4d('0x1e')](_0xcc78f9);}return null;};}function patchUpdates(_0x39f05d){return function(_0x3a2f35){try{jsonpatch['apply'](_0x3a2f35,_0x39f05d,!![]);}catch(_0x5a0f32){return BPromise['reject'](_0x5a0f32);}return _0x3a2f35['save']();};}function saveUpdates(_0x341046,_0x227278){return function(_0x321e00){if(_0x321e00){return _0x321e00['update'](_0x341046)[_0x1d4d('0x1f')](function(_0x5ce064){return _0x5ce064;});}return null;};}function removeEntity(_0x4b985b,_0x3ce3ba){return function(_0x15386b){if(_0x15386b){return _0x15386b[_0x1d4d('0x20')]()['then'](function(){_0x4b985b[_0x1d4d('0x19')](0xcc)[_0x1d4d('0x21')]();});}};}function handleEntityNotFound(_0x28f827,_0x31affb){return function(_0x50a238){if(!_0x50a238){_0x28f827[_0x1d4d('0x18')](0x194);}return _0x50a238;};}function handleError(_0x2b1b8b,_0x14b4e9){_0x14b4e9=_0x14b4e9||0x1f4;return function(_0x5ab0f3){logger[_0x1d4d('0x22')](_0x5ab0f3['stack']);if(_0x5ab0f3['name']){delete _0x5ab0f3[_0x1d4d('0x23')];}_0x2b1b8b[_0x1d4d('0x19')](_0x14b4e9)[_0x1d4d('0x24')](_0x5ab0f3);};}exports[_0x1d4d('0x25')]=function(_0x27daea,_0x575ff3){var _0xc9f05b={'raw':!![],'where':{'id':_0x27daea['params']['id']}},_0x435bcb={};_0x435bcb[_0x1d4d('0x26')]=_[_0x1d4d('0x27')](db['ChatProactiveAction'][_0x1d4d('0x28')]);_0x435bcb[_0x1d4d('0x29')]=_[_0x1d4d('0x27')](_0x27daea[_0x1d4d('0x29')]);_0x435bcb[_0x1d4d('0x2a')]=_[_0x1d4d('0x2b')](_0x435bcb[_0x1d4d('0x26')],_0x435bcb['query']);_0xc9f05b[_0x1d4d('0x2c')]=_[_0x1d4d('0x2b')](_0x435bcb['model'],qs[_0x1d4d('0x2d')](_0x27daea['query'][_0x1d4d('0x2d')]));_0xc9f05b[_0x1d4d('0x2c')]=_0xc9f05b[_0x1d4d('0x2c')][_0x1d4d('0x2e')]?_0xc9f05b[_0x1d4d('0x2c')]:_0x435bcb[_0x1d4d('0x26')];if(_0x27daea[_0x1d4d('0x29')][_0x1d4d('0x2f')]){_0xc9f05b[_0x1d4d('0x30')]=[{'all':!![]}];}_0xc9f05b=_['merge']({},_0xc9f05b,_0x27daea['options']);return db[_0x1d4d('0x31')]['find'](_0xc9f05b)[_0x1d4d('0x1f')](handleEntityNotFound(_0x575ff3,null))[_0x1d4d('0x1f')](respondWithResult(_0x575ff3,null))[_0x1d4d('0x32')](handleError(_0x575ff3,null));};exports[_0x1d4d('0x33')]=function(_0x25f375,_0x39af1f){return db[_0x1d4d('0x31')][_0x1d4d('0x33')](_0x25f375[_0x1d4d('0x34')],{})[_0x1d4d('0x1f')](respondWithResult(_0x39af1f,0xc9))[_0x1d4d('0x32')](handleError(_0x39af1f,null));};exports[_0x1d4d('0x35')]=function(_0x67598f,_0x4c1ec5){if(_0x67598f[_0x1d4d('0x34')]['id']){delete _0x67598f['body']['id'];}return db[_0x1d4d('0x31')][_0x1d4d('0x36')]({'where':{'id':_0x67598f['params']['id']}})[_0x1d4d('0x1f')](handleEntityNotFound(_0x4c1ec5,null))['then'](saveUpdates(_0x67598f[_0x1d4d('0x34')],null))[_0x1d4d('0x1f')](respondWithResult(_0x4c1ec5,null))[_0x1d4d('0x32')](handleError(_0x4c1ec5,null));};exports[_0x1d4d('0x20')]=function(_0x49fbb6,_0x24cc17){return db[_0x1d4d('0x31')]['find']({'where':{'id':_0x49fbb6[_0x1d4d('0x37')]['id']}})[_0x1d4d('0x1f')](handleEntityNotFound(_0x24cc17,null))[_0x1d4d('0x1f')](removeEntity(_0x24cc17,null))[_0x1d4d('0x32')](handleError(_0x24cc17,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index a831cfa..1c94c0a 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 _0x7be2=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x36858d,_0x4e1f31){var _0x59ea81=function(_0x2533ca){while(--_0x2533ca){_0x36858d['push'](_0x36858d['shift']());}};_0x59ea81(++_0x4e1f31);}(_0x7be2,0xdd));var _0x27be=function(_0x3e417d,_0xaf2086){_0x3e417d=_0x3e417d-0x0;var _0x5c2ede=_0x7be2[_0x3e417d];return _0x5c2ede;};'use strict';var _=require(_0x27be('0x0'));var util=require(_0x27be('0x1'));var logger=require(_0x27be('0x2'))('api');var moment=require(_0x27be('0x3'));var BPromise=require(_0x27be('0x4'));var rp=require(_0x27be('0x5'));var fs=require('fs');var path=require(_0x27be('0x6'));var rimraf=require(_0x27be('0x7'));var config=require('../../config/environment');var attributes=require(_0x27be('0x8'));module[_0x27be('0x9')]=function(_0x3da188,_0x31b74e){return _0x3da188[_0x27be('0xa')](_0x27be('0xb'),attributes,{'tableName':_0x27be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5094=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x38d1b4,_0x58378e){var _0xe7f2d3=function(_0x1e7f81){while(--_0x1e7f81){_0x38d1b4['push'](_0x38d1b4['shift']());}};_0xe7f2d3(++_0x58378e);}(_0x5094,0xb6));var _0x4509=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0x5094[_0xa3fadc];return _0x23ecb8;};'use strict';var _=require(_0x4509('0x0'));var util=require(_0x4509('0x1'));var logger=require(_0x4509('0x2'))('api');var moment=require(_0x4509('0x3'));var BPromise=require(_0x4509('0x4'));var rp=require(_0x4509('0x5'));var fs=require('fs');var path=require(_0x4509('0x6'));var rimraf=require(_0x4509('0x7'));var config=require(_0x4509('0x8'));var attributes=require(_0x4509('0x9'));module['exports']=function(_0x5e2e9a,_0x3d93cf){return _0x5e2e9a[_0x4509('0xa')](_0x4509('0xb'),attributes,{'tableName':_0x4509('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 5a67505..e05a4fd 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 _0x46ee=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x46ee,0x6b));var _0xe46e=function(_0x3545aa,_0x59c5a6){_0x3545aa=_0x3545aa-0x0;var _0x513534=_0x46ee[_0x3545aa];return _0x513534;};'use strict';var _=require(_0xe46e('0x0'));var util=require(_0xe46e('0x1'));var moment=require(_0xe46e('0x2'));var BPromise=require(_0xe46e('0x3'));var rs=require(_0xe46e('0x4'));var fs=require('fs');var Redis=require(_0xe46e('0x5'));var db=require(_0xe46e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe46e('0x7'));var client=jayson[_0xe46e('0x8')][_0xe46e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cbf01,_0x2bd6db,_0x503d16){return new BPromise(function(_0x417fa7,_0x209d13){return client[_0xe46e('0xa')](_0x5cbf01,_0x503d16)['then'](function(_0x317a04){logger[_0xe46e('0xb')](_0xe46e('0xc'),_0x2bd6db,'request\x20sent');logger['debug'](_0xe46e('0xd'),_0x2bd6db,_0xe46e('0xe'),JSON['stringify'](_0x317a04));if(_0x317a04[_0xe46e('0xf')]){if(_0x317a04[_0xe46e('0xf')][_0xe46e('0x10')]===0x1f4){logger[_0xe46e('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bd6db,_0x317a04[_0xe46e('0xf')][_0xe46e('0x11')]);return _0x209d13(_0x317a04[_0xe46e('0xf')][_0xe46e('0x11')]);}logger[_0xe46e('0xf')](_0xe46e('0xc'),_0x2bd6db,_0x317a04['error'][_0xe46e('0x11')]);return _0x417fa7(_0x317a04['error'][_0xe46e('0x11')]);}else{logger[_0xe46e('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bd6db,_0xe46e('0xe'));_0x417fa7(_0x317a04[_0xe46e('0x12')][_0xe46e('0x11')]);}})[_0xe46e('0x13')](function(_0x4d359a){logger[_0xe46e('0xf')](_0xe46e('0xc'),_0x2bd6db,_0x4d359a);_0x209d13(_0x4d359a);});});} \ No newline at end of file +var _0x636f=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4920e6,_0x398107){var _0x845c60=function(_0x9079c4){while(--_0x9079c4){_0x4920e6['push'](_0x4920e6['shift']());}};_0x845c60(++_0x398107);}(_0x636f,0xe3));var _0xf636=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x636f[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xf636('0x0'));var util=require(_0xf636('0x1'));var moment=require(_0xf636('0x2'));var BPromise=require('bluebird');var rs=require(_0xf636('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf636('0x4'))['db'];var utils=require(_0xf636('0x5'));var logger=require(_0xf636('0x6'))(_0xf636('0x7'));var config=require(_0xf636('0x8'));var jayson=require(_0xf636('0x9'));var client=jayson[_0xf636('0xa')][_0xf636('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1340b9,_0x8cfd12,_0x5e3497){return new BPromise(function(_0x2a2759,_0x4c3cfd){return client['request'](_0x1340b9,_0x5e3497)[_0xf636('0xc')](function(_0x1f6d5d){logger[_0xf636('0xd')](_0xf636('0xe'),_0x8cfd12,_0xf636('0xf'));logger[_0xf636('0x10')](_0xf636('0x11'),_0x8cfd12,_0xf636('0xf'),JSON[_0xf636('0x12')](_0x1f6d5d));if(_0x1f6d5d[_0xf636('0x13')]){if(_0x1f6d5d[_0xf636('0x13')][_0xf636('0x14')]===0x1f4){logger['error'](_0xf636('0xe'),_0x8cfd12,_0x1f6d5d['error'][_0xf636('0x15')]);return _0x4c3cfd(_0x1f6d5d[_0xf636('0x13')][_0xf636('0x15')]);}logger[_0xf636('0x13')](_0xf636('0xe'),_0x8cfd12,_0x1f6d5d['error'][_0xf636('0x15')]);return _0x2a2759(_0x1f6d5d['error'][_0xf636('0x15')]);}else{logger['info'](_0xf636('0xe'),_0x8cfd12,'request\x20sent');_0x2a2759(_0x1f6d5d['result']['message']);}})[_0xf636('0x16')](function(_0x44b351){logger[_0xf636('0x13')](_0xf636('0xe'),_0x8cfd12,_0x44b351);_0x4c3cfd(_0x44b351);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index e05a691..88dc151 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 _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x038b,0x114));var _0xb038=function(_0xb091a1,_0x310718){_0xb091a1=_0xb091a1-0x0;var _0x262451=_0x038b[_0xb091a1];return _0x262451;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file +var _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xeff8,0x186));var _0x8eff=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0xeff8[_0x2405bc];return _0x5272d4;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);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 28958eb..3fb5293 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 _0x09bc=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x09bc,0x1ba));var _0xc09b=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x09bc[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require(_0xc09b('0x0'));module[_0xc09b('0x1')]={'name':{'type':Sequelize[_0xc09b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc09b('0x2')]},'timeout':{'type':Sequelize[_0xc09b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc09b('0x4'),_0xc09b('0x5'),_0xc09b('0x6'))}}; \ No newline at end of file +var _0x6c23=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0xed0dd9,_0x298830){var _0x270a7c=function(_0x391180){while(--_0x391180){_0xed0dd9['push'](_0xed0dd9['shift']());}};_0x270a7c(++_0x298830);}(_0x6c23,0x64));var _0x36c2=function(_0x56ac40,_0x3eb56c){_0x56ac40=_0x56ac40-0x0;var _0x5e32c3=_0x6c23[_0x56ac40];return _0x5e32c3;};'use strict';var Sequelize=require(_0x36c2('0x0'));module[_0x36c2('0x1')]={'name':{'type':Sequelize[_0x36c2('0x2')],'unique':_0x36c2('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x36c2('0x2')]},'timeout':{'type':Sequelize[_0x36c2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x36c2('0x5')](_0x36c2('0x6'),'beepall',_0x36c2('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4d01f40..12a9b88 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 _0x50c2=['UserChatQueue','nolimit','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','chatPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userChatQueue:remove','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','end','status','json','offset','undefined','limit','count','set','apply','reject','then','ChatQueues','UserProfileResource','destroy','sendStatus','stack','name','send','map','ChatQueue','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','length','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne'];(function(_0xe8668f,_0x42446c){var _0xf3d4ff=function(_0x5447d6){while(--_0x5447d6){_0xe8668f['push'](_0xe8668f['shift']());}};_0xf3d4ff(++_0x42446c);}(_0x50c2,0x1e8));var _0x250c=function(_0x4a7244,_0x2eb6d3){_0x4a7244=_0x4a7244-0x0;var _0x551233=_0x50c2[_0x4a7244];return _0x551233;};'use strict';var emlformat=require(_0x250c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x250c('0x1'));var jsonpatch=require(_0x250c('0x2'));var rp=require('request-promise');var moment=require(_0x250c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x250c('0x4'));var util=require(_0x250c('0x5'));var path=require(_0x250c('0x6'));var sox=require(_0x250c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x250c('0x8'));var _=require(_0x250c('0x9'));var squel=require(_0x250c('0xa'));var crypto=require(_0x250c('0xb'));var jsforce=require(_0x250c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x250c('0xd'));var Redis=require('ioredis');var authService=require(_0x250c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x250c('0xf'));var hardwareService=require(_0x250c('0x10'));var logger=require(_0x250c('0x11'))('api');var utils=require(_0x250c('0x12'));var config=require(_0x250c('0x13'));var licenseUtil=require(_0x250c('0x14'));var db=require(_0x250c('0x15'))['db'];config[_0x250c('0x16')]=_[_0x250c('0x17')](config[_0x250c('0x16')],{'host':_0x250c('0x18'),'port':0x18eb});var socket=require(_0x250c('0x19'))(new Redis(config['redis']));require(_0x250c('0x1a'))[_0x250c('0x1b')](socket);var jayson=require(_0x250c('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb44357,_0x1d7263,_0x1a90db,_0x59f7fe){return new BPromise(function(_0x1c90b3,_0x2fdf70){var _0x3f36bb=_0x59f7fe||client;return _0x3f36bb['request'](_0xb44357,_0x1a90db)['then'](function(_0x2feecf){logger['info'](_0x250c('0x1d'),_0x1d7263,'request\x20sent');logger[_0x250c('0x1e')](_0x250c('0x1f'),_0x1d7263,'request\x20sent',JSON[_0x250c('0x20')](_0x2feecf));if(_0x2feecf[_0x250c('0x21')]){if(_0x2feecf['error'][_0x250c('0x22')]===0x1f4){logger[_0x250c('0x21')](_0x250c('0x1d'),_0x1d7263,_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);return _0x2fdf70(_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);}logger[_0x250c('0x21')](_0x250c('0x1d'),_0x1d7263,_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);return _0x1c90b3(_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);}else{logger[_0x250c('0x24')]('ChatQueue,\x20%s,\x20%s',_0x1d7263,_0x250c('0x25'));_0x1c90b3(_0x2feecf[_0x250c('0x26')][_0x250c('0x23')]);}})[_0x250c('0x27')](function(_0x24204a){logger['error'](_0x250c('0x1d'),_0x1d7263,_0x24204a);_0x2fdf70(_0x24204a);});});}function respondWithStatusCode(_0x40239c,_0x2b3fce){_0x2b3fce=_0x2b3fce||0xcc;return function(_0x4a5ab1){if(_0x4a5ab1){return _0x40239c['sendStatus'](_0x2b3fce);}return _0x40239c['status'](_0x2b3fce)[_0x250c('0x28')]();};}function respondWithResult(_0x595900,_0x2bb0f8){_0x2bb0f8=_0x2bb0f8||0xc8;return function(_0x38c2a5){if(_0x38c2a5){return _0x595900[_0x250c('0x29')](_0x2bb0f8)[_0x250c('0x2a')](_0x38c2a5);}};}function respondWithFilteredResult(_0xaca396,_0x4c388d){return function(_0x4a2ea1){if(_0x4a2ea1){var _0x24d97f=typeof _0x4c388d[_0x250c('0x2b')]===_0x250c('0x2c')&&typeof _0x4c388d[_0x250c('0x2d')]==='undefined';var _0x376af7=_0x4a2ea1[_0x250c('0x2e')];var _0x353ee5=_0x24d97f?0x0:_0x4c388d[_0x250c('0x2b')];var _0x53e3c0=_0x24d97f?_0x4a2ea1['count']:_0x4c388d['offset']+_0x4c388d['limit'];var _0x1d0685;if(_0x53e3c0>=_0x376af7){_0x53e3c0=_0x376af7;_0x1d0685=0xc8;}else{_0x1d0685=0xce;}_0xaca396['status'](_0x1d0685);return _0xaca396[_0x250c('0x2f')]('Content-Range',_0x353ee5+'-'+_0x53e3c0+'/'+_0x376af7)[_0x250c('0x2a')](_0x4a2ea1);}return null;};}function patchUpdates(_0x590bd8){return function(_0x2645a9){try{jsonpatch[_0x250c('0x30')](_0x2645a9,_0x590bd8,!![]);}catch(_0x176b6a){return BPromise[_0x250c('0x31')](_0x176b6a);}return _0x2645a9['save']();};}function saveUpdates(_0x1bebfb,_0x2a8691){return function(_0x276ddf){if(_0x276ddf){return _0x276ddf['update'](_0x1bebfb)[_0x250c('0x32')](function(_0x208c04){return _0x208c04;});}return null;};}function removeEntity(_0x387119,_0x40e18f){return function(_0xaad7e5){if(_0xaad7e5){return _0xaad7e5['destroy']()['then'](function(){var _0x549a53=_0xaad7e5['get']({'plain':!![]});var _0x38d75b=_0x250c('0x33');return db[_0x250c('0x34')][_0x250c('0x35')]({'where':{'type':_0x38d75b,'resourceId':_0x549a53['id']}})['then'](function(){return _0xaad7e5;});})[_0x250c('0x32')](function(){_0x387119[_0x250c('0x29')](0xcc)[_0x250c('0x28')]();});}};}function handleEntityNotFound(_0x19e43c,_0x50189c){return function(_0x3b3c2b){if(!_0x3b3c2b){_0x19e43c[_0x250c('0x36')](0x194);}return _0x3b3c2b;};}function handleError(_0x19cc86,_0x4d26d7){_0x4d26d7=_0x4d26d7||0x1f4;return function(_0x2b6e0e){logger[_0x250c('0x21')](_0x2b6e0e[_0x250c('0x37')]);if(_0x2b6e0e[_0x250c('0x38')]){delete _0x2b6e0e[_0x250c('0x38')];}_0x19cc86[_0x250c('0x29')](_0x4d26d7)[_0x250c('0x39')](_0x2b6e0e);};}exports['index']=function(_0x3744a4,_0x442de6){var _0x1501ff={},_0x3fe6db={},_0x38b6a4={'count':0x0,'rows':[]};var _0x408673=_[_0x250c('0x3a')](db[_0x250c('0x3b')][_0x250c('0x3c')],function(_0xda987d){return{'name':_0xda987d[_0x250c('0x3d')],'type':_0xda987d['type'][_0x250c('0x3e')]};});_0x3fe6db[_0x250c('0x3f')]=_[_0x250c('0x3a')](_0x408673,_0x250c('0x38'));_0x3fe6db[_0x250c('0x40')]=_['keys'](_0x3744a4['query']);_0x3fe6db[_0x250c('0x41')]=_[_0x250c('0x42')](_0x3fe6db['model'],_0x3fe6db['query']);_0x1501ff['attributes']=_[_0x250c('0x42')](_0x3fe6db[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x3744a4['query']['fields']));_0x1501ff[_0x250c('0x44')]=_0x1501ff[_0x250c('0x44')]['length']?_0x1501ff['attributes']:_0x3fe6db[_0x250c('0x3f')];if(!_0x3744a4[_0x250c('0x40')][_0x250c('0x45')]('nolimit')){_0x1501ff[_0x250c('0x2d')]=qs[_0x250c('0x2d')](_0x3744a4[_0x250c('0x40')]['limit']);_0x1501ff['offset']=qs[_0x250c('0x2b')](_0x3744a4[_0x250c('0x40')][_0x250c('0x2b')]);}_0x1501ff[_0x250c('0x46')]=qs[_0x250c('0x47')](_0x3744a4[_0x250c('0x40')][_0x250c('0x47')]);_0x1501ff[_0x250c('0x48')]=qs['filters'](_[_0x250c('0x49')](_0x3744a4[_0x250c('0x40')],_0x3fe6db['filters']),_0x408673);if(_0x3744a4[_0x250c('0x40')][_0x250c('0x4a')]){_0x1501ff['where']=_['merge'](_0x1501ff[_0x250c('0x48')],{'$or':_[_0x250c('0x3a')](_0x408673,function(_0x20440b){if(_0x20440b['type']!==_0x250c('0x4b')){var _0x4f8521={};_0x4f8521[_0x20440b[_0x250c('0x38')]]={'$like':'%'+_0x3744a4['query'][_0x250c('0x4a')]+'%'};return _0x4f8521;}})});}_0x1501ff=_['merge']({},_0x1501ff,_0x3744a4['options']);var _0x40a7aa={'where':_0x1501ff[_0x250c('0x48')]};return db[_0x250c('0x3b')][_0x250c('0x2e')](_0x40a7aa)['then'](function(_0xe0a317){_0x38b6a4['count']=_0xe0a317;if(_0x3744a4[_0x250c('0x40')][_0x250c('0x4c')]){_0x1501ff[_0x250c('0x4d')]=[{'all':!![]}];}return db['ChatQueue'][_0x250c('0x4e')](_0x1501ff);})[_0x250c('0x32')](function(_0x30c2a2){_0x38b6a4[_0x250c('0x4f')]=_0x30c2a2;return _0x38b6a4;})['then'](respondWithFilteredResult(_0x442de6,_0x1501ff))[_0x250c('0x27')](handleError(_0x442de6,null));};exports[_0x250c('0x50')]=function(_0x2d05d6,_0x1a56e8){var _0x512dd5={'raw':!![],'where':{'id':_0x2d05d6[_0x250c('0x51')]['id']}},_0x4b6886={};_0x4b6886[_0x250c('0x3f')]=_[_0x250c('0x52')](db[_0x250c('0x3b')][_0x250c('0x3c')]);_0x4b6886['query']=_['keys'](_0x2d05d6[_0x250c('0x40')]);_0x4b6886[_0x250c('0x41')]=_[_0x250c('0x42')](_0x4b6886[_0x250c('0x3f')],_0x4b6886[_0x250c('0x40')]);_0x512dd5[_0x250c('0x44')]=_[_0x250c('0x42')](_0x4b6886[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x2d05d6[_0x250c('0x40')]['fields']));_0x512dd5[_0x250c('0x44')]=_0x512dd5['attributes'][_0x250c('0x53')]?_0x512dd5[_0x250c('0x44')]:_0x4b6886[_0x250c('0x3f')];if(_0x2d05d6[_0x250c('0x40')][_0x250c('0x4c')]){_0x512dd5['include']=[{'all':!![]}];}_0x512dd5=_[_0x250c('0x54')]({},_0x512dd5,_0x2d05d6[_0x250c('0x55')]);return db[_0x250c('0x3b')][_0x250c('0x56')](_0x512dd5)[_0x250c('0x32')](handleEntityNotFound(_0x1a56e8,null))[_0x250c('0x32')](respondWithResult(_0x1a56e8,null))[_0x250c('0x27')](handleError(_0x1a56e8,null));};exports[_0x250c('0x57')]=function(_0x4bfd34,_0x5549e5){return db[_0x250c('0x3b')][_0x250c('0x57')](_0x4bfd34[_0x250c('0x58')],{})[_0x250c('0x32')](function(_0x39fb27){var _0x385365=_0x4bfd34[_0x250c('0x59')][_0x250c('0x5a')]({'plain':!![]});if(!_0x385365)throw new Error(_0x250c('0x5b'));if(_0x385365['role']===_0x250c('0x59')){var _0x3441a8=_0x39fb27[_0x250c('0x5a')]({'plain':!![]});var _0x376f00='ChatQueues';return db[_0x250c('0x5c')]['find']({'where':{'name':_0x376f00,'userProfileId':_0x385365[_0x250c('0x5d')]},'raw':!![]})[_0x250c('0x32')](function(_0x4c59e5){if(_0x4c59e5&&_0x4c59e5[_0x250c('0x5e')]===0x0){return db[_0x250c('0x34')]['create']({'name':_0x3441a8[_0x250c('0x38')],'resourceId':_0x3441a8['id'],'type':_0x4c59e5[_0x250c('0x38')],'sectionId':_0x4c59e5['id']},{})[_0x250c('0x32')](function(){return _0x39fb27;});}else{return _0x39fb27;}})['catch'](function(_0x412217){logger[_0x250c('0x21')](_0x250c('0x5f'),_0x412217);throw _0x412217;});}return _0x39fb27;})[_0x250c('0x32')](respondWithResult(_0x5549e5,0xc9))[_0x250c('0x27')](handleError(_0x5549e5,null));};exports[_0x250c('0x60')]=function(_0x2fd085,_0x43872b){if(_0x2fd085[_0x250c('0x58')]['id']){delete _0x2fd085['body']['id'];}return db[_0x250c('0x3b')]['find']({'where':{'id':_0x2fd085[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x43872b,null))[_0x250c('0x32')](saveUpdates(_0x2fd085[_0x250c('0x58')],null))['then'](respondWithResult(_0x43872b,null))[_0x250c('0x27')](handleError(_0x43872b,null));};exports[_0x250c('0x35')]=function(_0x3cddd2,_0x1d32ad){return db[_0x250c('0x3b')]['find']({'where':{'id':_0x3cddd2[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x1d32ad,null))[_0x250c('0x32')](removeEntity(_0x1d32ad,null))[_0x250c('0x27')](handleError(_0x1d32ad,null));};exports[_0x250c('0x61')]=function(_0x2596b8,_0x4bc91a){return db[_0x250c('0x3b')][_0x250c('0x61')]()[_0x250c('0x32')](respondWithResult(_0x4bc91a,null))[_0x250c('0x27')](handleError(_0x4bc91a,null));};exports[_0x250c('0x62')]=function(_0x1b2976,_0x1cb3ac,_0x26bcbd){var _0x3f1b7a={'raw':!![],'where':{}},_0xc6569={},_0x2d8ddd;return db[_0x250c('0x3b')][_0x250c('0x63')]({'where':{'id':_0x1b2976['params']['id']}})['then'](handleEntityNotFound(_0x1cb3ac,null))[_0x250c('0x32')](function(_0x247f75){if(_0x247f75){_0x2d8ddd=_0x247f75[_0x250c('0x5a')]({'plain':!![]});_0xc6569[_0x250c('0x3f')]=_['keys'](db[_0x250c('0x64')][_0x250c('0x3c')]);_0xc6569['query']=_[_0x250c('0x52')](_0x1b2976[_0x250c('0x40')]);_0xc6569[_0x250c('0x41')]=_['intersection'](_0xc6569[_0x250c('0x3f')],_0xc6569[_0x250c('0x40')]);_0x3f1b7a['attributes']=_['intersection'](_0xc6569['model'],qs[_0x250c('0x43')](_0x1b2976[_0x250c('0x40')][_0x250c('0x43')]));_0x3f1b7a[_0x250c('0x44')]=_0x3f1b7a[_0x250c('0x44')][_0x250c('0x53')]?_0x3f1b7a[_0x250c('0x44')]:_0xc6569[_0x250c('0x3f')];if(!_0x1b2976['query'][_0x250c('0x45')](_0x250c('0x65'))){_0x3f1b7a[_0x250c('0x2d')]=qs[_0x250c('0x2d')](_0x1b2976['query'][_0x250c('0x2d')]);_0x3f1b7a['offset']=qs['offset'](_0x1b2976[_0x250c('0x40')]['offset']);}_0x3f1b7a['order']=qs['sort'](_0x1b2976['query'][_0x250c('0x47')]);_0x3f1b7a['where']=qs[_0x250c('0x41')](_[_0x250c('0x49')](_0x1b2976[_0x250c('0x40')],_0xc6569[_0x250c('0x41')]));_0x3f1b7a[_0x250c('0x48')]['ChatQueueId']=_0x247f75['id'];if(_0x1b2976[_0x250c('0x40')][_0x250c('0x4a')]){_0x3f1b7a['where']=_[_0x250c('0x54')](_0x3f1b7a[_0x250c('0x48')],{'$or':_['map'](_0x3f1b7a[_0x250c('0x44')],function(_0x3e479f){var _0x22e983={};_0x22e983[_0x3e479f]={'$like':'%'+_0x1b2976['query'][_0x250c('0x4a')]+'%'};return _0x22e983;})});}_0x3f1b7a=_[_0x250c('0x54')]({},_0x3f1b7a,_0x1b2976['options']);return db[_0x250c('0x64')][_0x250c('0x4e')](_0x3f1b7a);}})[_0x250c('0x32')](function(_0x1e8698){if(_0x1e8698){return db[_0x250c('0x66')][_0x250c('0x67')]({'where':{'id':_[_0x250c('0x3a')](_0x1e8698,_0x250c('0x68')),'role':_0x250c('0x69')},'attributes':['id','name','chatPause',_0x250c('0x6a'),_0x250c('0x6b')]});}})[_0x250c('0x32')](function(_0x14b892){if(_0x14b892){return{'count':_0x14b892[_0x250c('0x2e')],'rows':_[_0x250c('0x3a')](_0x14b892[_0x250c('0x4f')],function(_0x3d2574){return{'membername':_0x3d2574[_0x250c('0x38')],'UserId':_0x3d2574['id'],'queue_name':_0x2d8ddd[_0x250c('0x38')],'ChatQueueId':_0x2d8ddd['id'],'interface':util[_0x250c('0x6c')]('%s/%s',_0x250c('0x6d'),_0x3d2574['name']),'penalty':0x0,'paused':_0x3d2574[_0x250c('0x6e')],'createdAt':_0x3d2574[_0x250c('0x6b')],'updatedAt':_0x3d2574[_0x250c('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x250c('0x32')](respondWithFilteredResult(_0x1cb3ac,_0x3f1b7a))['catch'](handleError(_0x1cb3ac,null));};exports[_0x250c('0x6f')]=function(_0x43160d,_0x99aeef,_0x28a684){var _0x61a35={};var _0xf28a3b={};var _0x7bc1a6;var _0x302996;return db[_0x250c('0x3b')]['findOne']({'where':{'id':_0x43160d[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x99aeef,null))['then'](function(_0x4b3687){if(_0x4b3687){_0x7bc1a6=_0x4b3687;_0xf28a3b[_0x250c('0x3f')]=_[_0x250c('0x52')](db[_0x250c('0x70')][_0x250c('0x3c')]);_0xf28a3b[_0x250c('0x40')]=_[_0x250c('0x52')](_0x43160d[_0x250c('0x40')]);_0xf28a3b['filters']=_[_0x250c('0x42')](_0xf28a3b['model'],_0xf28a3b[_0x250c('0x40')]);_0x61a35[_0x250c('0x44')]=_[_0x250c('0x42')](_0xf28a3b[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x43160d[_0x250c('0x40')]['fields']));_0x61a35[_0x250c('0x44')]=_0x61a35[_0x250c('0x44')][_0x250c('0x53')]?_0x61a35[_0x250c('0x44')]:_0xf28a3b[_0x250c('0x3f')];_0x61a35[_0x250c('0x46')]=qs[_0x250c('0x47')](_0x43160d[_0x250c('0x40')][_0x250c('0x47')]);_0x61a35[_0x250c('0x48')]=qs['filters'](_[_0x250c('0x49')](_0x43160d[_0x250c('0x40')],_0xf28a3b[_0x250c('0x41')]));if(_0x43160d[_0x250c('0x40')][_0x250c('0x4a')]){_0x61a35[_0x250c('0x48')]=_['merge'](_0x61a35[_0x250c('0x48')],{'$or':_[_0x250c('0x3a')](_0x61a35['attributes'],function(_0x50feda){var _0x73b10={};_0x73b10[_0x50feda]={'$like':'%'+_0x43160d[_0x250c('0x40')]['filter']+'%'};return _0x73b10;})});}_0x61a35=_[_0x250c('0x54')]({},_0x61a35,_0x43160d[_0x250c('0x55')]);return _0x7bc1a6[_0x250c('0x6f')](_0x61a35);}})[_0x250c('0x32')](function(_0x52effa){if(_0x52effa){_0x302996=_0x52effa[_0x250c('0x53')];if(!_0x43160d['query'][_0x250c('0x45')](_0x250c('0x65'))){_0x61a35[_0x250c('0x2d')]=qs['limit'](_0x43160d[_0x250c('0x40')]['limit']);_0x61a35[_0x250c('0x2b')]=qs[_0x250c('0x2b')](_0x43160d[_0x250c('0x40')][_0x250c('0x2b')]);}return _0x7bc1a6['getTeams'](_0x61a35);}})[_0x250c('0x32')](function(_0x5a4131){if(_0x5a4131){return _0x5a4131?{'count':_0x302996,'rows':_0x5a4131}:null;}})[_0x250c('0x32')](respondWithResult(_0x99aeef,null))[_0x250c('0x27')](handleError(_0x99aeef,null));};exports[_0x250c('0x71')]=function(_0xd31f5,_0x353b93,_0x25017e){var _0x1b2052=_0xd31f5[_0x250c('0x58')][_0x250c('0x72')];return db[_0x250c('0x70')]['findAll']({'where':{'id':_0x1b2052},'attributes':['id'],'include':[{'model':db['User'],'as':_0x250c('0x73'),'attributes':['id',_0x250c('0x38'),_0x250c('0x74'),_0x250c('0x75'),'interface'],'raw':!![]}]})[_0x250c('0x32')](function(_0x30130a){if(_0x30130a){var _0x7c3a0c=_[_0x250c('0x76')](_0x30130a,function(_0x4d7402){var _0x2fd7a5=_0x4d7402['get']({'plain':!![]});return _0x2fd7a5[_0x250c('0x73')];});return db['ChatQueue'][_0x250c('0x56')]({'where':{'id':_0xd31f5[_0x250c('0x51')]['id']}})['then'](function(_0x259adb){return db[_0x250c('0x77')][_0x250c('0x78')](function(_0x1befbe){return _0x259adb[_0x250c('0x71')](_0x1b2052,{'transaction':_0x1befbe})[_0x250c('0x32')](function(){return BPromise[_0x250c('0x79')](_0x7c3a0c,function(_0x4d9ae0){return db[_0x250c('0x64')][_0x250c('0x7a')]({'where':{'UserId':_0x4d9ae0['id'],'ChatQueueId':_0xd31f5['params']['id']},'transaction':_0x1befbe});});})[_0x250c('0x32')](function(){_0x7c3a0c[_0x250c('0x7b')](function(_0x5b46be){socket[_0x250c('0x7c')](_0x250c('0x7d'),{'UserId':_0x5b46be['id'],'ChatQueueId':_0x259adb['id']});});});});});}})[_0x250c('0x32')](respondWithStatusCode(_0x353b93,null))['catch'](handleError(_0x353b93,null));};exports[_0x250c('0x7e')]=function(_0x53d06d,_0x474be3,_0x1f517c){return db[_0x250c('0x70')][_0x250c('0x4e')]({'where':{'id':_0x53d06d[_0x250c('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0x250c('0x66')],'as':_0x250c('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x474be3,null))[_0x250c('0x32')](function(_0x3dcfb3){var _0x118712=_['map'](_0x3dcfb3,'id');var _0x5065f0=[];var _0x48d631=[];var _0x3cc2ae=squel['select']();_0x3cc2ae[_0x250c('0x7f')](_0x250c('0x80'))['from']('team_has_chat_queues','tq')[_0x250c('0x81')](_0x250c('0x82'),'ut',_0x250c('0x83'))[_0x250c('0x48')]('ChatQueueId\x20=\x20?',_0x53d06d[_0x250c('0x51')]['id']);for(var _0x1d974d=0x0;_0x1d974d<_0x3dcfb3[_0x250c('0x53')];_0x1d974d+=0x1){let _0x140fa1=_0x3dcfb3[_0x1d974d];for(var _0x35855d=0x0;_0x35855d<_0x140fa1[_0x250c('0x73')][_0x250c('0x53')];_0x35855d+=0x1){let _0x572408=_0x140fa1[_0x250c('0x73')][_0x35855d];var _0x2c9c10=_0x3cc2ae[_0x250c('0x84')]();_0x2c9c10[_0x250c('0x48')]('ut.UserId\x20=\x20?',_0x572408['id']);_0x48d631['push'](db['sequelize'][_0x250c('0x40')](_0x2c9c10[_0x250c('0x85')](),{'type':db['sequelize']['QueryTypes'][_0x250c('0x86')]})['then'](function(_0x2a30c9){if(_0x2a30c9[_0x250c('0x53')]===0x1){return _0x572408['id'];}else{var _0x5e7274=_[_0x250c('0x87')](_['map'](_0x2a30c9,_0x250c('0x88')),function(_0x53d14f){return _[_0x250c('0x89')](_0x118712,_0x53d14f);});if(_0x5e7274){return _0x572408['id'];}}}));}}return BPromise[_0x250c('0x8a')](_0x48d631)[_0x250c('0x32')](function(_0x25220f){_0x5065f0=_(_0x5065f0)[_0x250c('0x8b')](_0x25220f)['compact']()['value']();return db[_0x250c('0x3b')][_0x250c('0x56')]({'where':{'id':_0x53d06d['params']['id']}})[_0x250c('0x32')](function(_0x4b9e34){return db[_0x250c('0x77')][_0x250c('0x78')](function(_0xd9e69f){return _0x4b9e34[_0x250c('0x7e')](_0x53d06d[_0x250c('0x40')][_0x250c('0x72')],{'transaction':_0xd9e69f})[_0x250c('0x32')](function(){if(!_[_0x250c('0x8c')](_0x5065f0)){return _0x4b9e34[_0x250c('0x8d')](_0x5065f0,{'transaction':_0xd9e69f});}})['then'](function(){_0x5065f0[_0x250c('0x7b')](function(_0x37c10d){socket['emit'](_0x250c('0x8e'),{'UserId':_0x37c10d,'ChatQueueId':_0x4b9e34['id']});});});});});});})[_0x250c('0x32')](respondWithStatusCode(_0x474be3,null))[_0x250c('0x27')](handleError(_0x474be3,null));};exports['addAgents']=function(_0x4f8fcd,_0x4bcc6f,_0x42253f){return db['ChatQueue'][_0x250c('0x56')]({'where':{'id':_0x4f8fcd[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x4bcc6f,null))[_0x250c('0x32')](function(_0x2a1604){if(_0x2a1604){return _0x2a1604['addAgents'](_0x4f8fcd[_0x250c('0x58')]['ids'],_[_0x250c('0x8f')](_0x4f8fcd[_0x250c('0x58')],[_0x250c('0x72'),'id'])||{})[_0x250c('0x90')](function(_0x128f27){for(var _0x564e8f=0x0;_0x564e8f<_0x4f8fcd[_0x250c('0x58')][_0x250c('0x72')][_0x250c('0x53')];_0x564e8f+=0x1){socket[_0x250c('0x7c')]('userChatQueue:save',{'UserId':Number(_0x4f8fcd[_0x250c('0x58')][_0x250c('0x72')][_0x564e8f]),'ChatQueueId':Number(_0x4f8fcd[_0x250c('0x51')]['id'])});}return _0x128f27;});}})[_0x250c('0x32')](respondWithResult(_0x4bcc6f,null))[_0x250c('0x27')](handleError(_0x4bcc6f,null));};exports[_0x250c('0x8d')]=function(_0x1249a7,_0x27c807,_0x20f128){return db[_0x250c('0x3b')][_0x250c('0x56')]({'where':{'id':_0x1249a7[_0x250c('0x51')]['id']}})['then'](handleEntityNotFound(_0x27c807,null))['then'](function(_0x2632ae){if(_0x2632ae){return _0x2632ae[_0x250c('0x8d')](_0x1249a7['query'][_0x250c('0x72')])[_0x250c('0x32')](function(){if(_[_0x250c('0x91')](_0x1249a7[_0x250c('0x40')][_0x250c('0x72')])){for(var _0x1e3d0b=0x0;_0x1e3d0b<_0x1249a7[_0x250c('0x40')]['ids']['length'];_0x1e3d0b+=0x1){socket[_0x250c('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x1249a7[_0x250c('0x40')][_0x250c('0x72')][_0x1e3d0b]),'ChatQueueId':Number(_0x1249a7[_0x250c('0x51')]['id'])});}}else{socket[_0x250c('0x7c')](_0x250c('0x8e'),{'UserId':Number(_0x1249a7['query']['ids']),'ChatQueueId':Number(_0x1249a7[_0x250c('0x51')]['id'])});}});}})[_0x250c('0x32')](respondWithStatusCode(_0x27c807,null))[_0x250c('0x27')](handleError(_0x27c807,null));};exports['getAgents']=function(_0x115164,_0x27e479,_0x16ef29){var _0x20027f={};var _0x2c3470={};var _0x23d101;var _0x1299e4;return db[_0x250c('0x3b')][_0x250c('0x63')]({'where':{'id':_0x115164['params']['id']}})['then'](handleEntityNotFound(_0x27e479,null))[_0x250c('0x32')](function(_0x1ee55d){if(_0x1ee55d){_0x23d101=_0x1ee55d;_0x2c3470[_0x250c('0x3f')]=_[_0x250c('0x52')](db[_0x250c('0x66')][_0x250c('0x3c')]);_0x2c3470[_0x250c('0x40')]=_[_0x250c('0x52')](_0x115164[_0x250c('0x40')]);_0x2c3470[_0x250c('0x41')]=_[_0x250c('0x42')](_0x2c3470[_0x250c('0x3f')],_0x2c3470[_0x250c('0x40')]);_0x20027f[_0x250c('0x44')]=_['intersection'](_0x2c3470[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x115164[_0x250c('0x40')]['fields']));_0x20027f['attributes']=_0x20027f[_0x250c('0x44')][_0x250c('0x53')]?_0x20027f[_0x250c('0x44')]:_0x2c3470[_0x250c('0x3f')];_0x20027f[_0x250c('0x46')]=qs[_0x250c('0x47')](_0x115164[_0x250c('0x40')][_0x250c('0x47')]);_0x20027f[_0x250c('0x48')]=qs[_0x250c('0x41')](_['pick'](_0x115164['query'],_0x2c3470[_0x250c('0x41')]));if(_0x115164[_0x250c('0x40')]['filter']){_0x20027f[_0x250c('0x48')]=_['merge'](_0x20027f[_0x250c('0x48')],{'$or':_[_0x250c('0x3a')](_0x20027f[_0x250c('0x44')],function(_0x1bf9f0){var _0x49e578={};_0x49e578[_0x1bf9f0]={'$like':'%'+_0x115164[_0x250c('0x40')][_0x250c('0x4a')]+'%'};return _0x49e578;})});}_0x20027f=_[_0x250c('0x54')]({},_0x20027f,_0x115164[_0x250c('0x55')]);return _0x23d101['getAgents'](_0x20027f);}})['then'](function(_0x4c60b2){if(_0x4c60b2){_0x1299e4=_0x4c60b2[_0x250c('0x53')];if(!_0x115164[_0x250c('0x40')]['hasOwnProperty'](_0x250c('0x65'))){_0x20027f[_0x250c('0x2d')]=qs['limit'](_0x115164[_0x250c('0x40')][_0x250c('0x2d')]);_0x20027f[_0x250c('0x2b')]=qs[_0x250c('0x2b')](_0x115164[_0x250c('0x40')][_0x250c('0x2b')]);}return _0x23d101[_0x250c('0x92')](_0x20027f);}})['then'](function(_0xe39f25){if(_0xe39f25){return _0xe39f25?{'count':_0x1299e4,'rows':_0xe39f25}:null;}})['then'](respondWithResult(_0x27e479,null))[_0x250c('0x27')](handleError(_0x27e479,null));}; \ No newline at end of file +var _0x762e=['localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','update','describe','getMembers','order','pick','UserChatQueue','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','Team','User','Agents','voicePause','flatMap','sequelize','each','forEach','emit','removeTeams','ids','select','field','tq.TeamId','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','includes','all','union','compact','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','findOne','rimraf','zip-dir','fast-json-patch','moment','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x3a6a37,_0x136baf){var _0x17c7e1=function(_0x1afebe){while(--_0x1afebe){_0x3a6a37['push'](_0x3a6a37['shift']());}};_0x17c7e1(++_0x136baf);}(_0x762e,0x11a));var _0xe762=function(_0x28b5e9,_0x4b442f){_0x28b5e9=_0x28b5e9-0x0;var _0x23e6a4=_0x762e[_0x28b5e9];return _0x23e6a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe762('0x0'));var zipdir=require(_0xe762('0x1'));var jsonpatch=require(_0xe762('0x2'));var rp=require('request-promise');var moment=require(_0xe762('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe762('0x4'));var util=require(_0xe762('0x5'));var path=require('path');var sox=require(_0xe762('0x6'));var csv=require(_0xe762('0x7'));var ejs=require(_0xe762('0x8'));var fs=require('fs');var fs_extra=require(_0xe762('0x9'));var _=require(_0xe762('0xa'));var squel=require(_0xe762('0xb'));var crypto=require(_0xe762('0xc'));var jsforce=require(_0xe762('0xd'));var deskjs=require(_0xe762('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe762('0xf'));var Papa=require('papaparse');var Redis=require(_0xe762('0x10'));var authService=require(_0xe762('0x11'));var qs=require(_0xe762('0x12'));var as=require(_0xe762('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe762('0x14'))(_0xe762('0x15'));var utils=require(_0xe762('0x16'));var config=require(_0xe762('0x17'));var licenseUtil=require(_0xe762('0x18'));var db=require(_0xe762('0x19'))['db'];config[_0xe762('0x1a')]=_[_0xe762('0x1b')](config[_0xe762('0x1a')],{'host':_0xe762('0x1c'),'port':0x18eb});var socket=require(_0xe762('0x1d'))(new Redis(config[_0xe762('0x1a')]));require(_0xe762('0x1e'))[_0xe762('0x1f')](socket);var jayson=require(_0xe762('0x20'));var client=jayson[_0xe762('0x21')][_0xe762('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x575d40,_0x25c862,_0x459e28,_0x125239){return new BPromise(function(_0x65098,_0x274cdb){var _0x34f3bc=_0x125239||client;return _0x34f3bc[_0xe762('0x23')](_0x575d40,_0x459e28)[_0xe762('0x24')](function(_0x51ef17){logger['info']('ChatQueue,\x20%s,\x20%s',_0x25c862,_0xe762('0x25'));logger[_0xe762('0x26')](_0xe762('0x27'),_0x25c862,_0xe762('0x25'),JSON[_0xe762('0x28')](_0x51ef17));if(_0x51ef17['error']){if(_0x51ef17[_0xe762('0x29')][_0xe762('0x2a')]===0x1f4){logger[_0xe762('0x29')](_0xe762('0x2b'),_0x25c862,_0x51ef17['error'][_0xe762('0x2c')]);return _0x274cdb(_0x51ef17['error'][_0xe762('0x2c')]);}logger[_0xe762('0x29')](_0xe762('0x2b'),_0x25c862,_0x51ef17['error'][_0xe762('0x2c')]);return _0x65098(_0x51ef17['error']['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x25c862,_0xe762('0x25'));_0x65098(_0x51ef17[_0xe762('0x2d')][_0xe762('0x2c')]);}})[_0xe762('0x2e')](function(_0x4f44ae){logger[_0xe762('0x29')](_0xe762('0x2b'),_0x25c862,_0x4f44ae);_0x274cdb(_0x4f44ae);});});}function respondWithStatusCode(_0x4db0d9,_0x19b084){_0x19b084=_0x19b084||0xcc;return function(_0x5d8b6d){if(_0x5d8b6d){return _0x4db0d9[_0xe762('0x2f')](_0x19b084);}return _0x4db0d9[_0xe762('0x30')](_0x19b084)[_0xe762('0x31')]();};}function respondWithResult(_0x4cd4ad,_0x1f349f){_0x1f349f=_0x1f349f||0xc8;return function(_0x3b5f71){if(_0x3b5f71){return _0x4cd4ad[_0xe762('0x30')](_0x1f349f)[_0xe762('0x32')](_0x3b5f71);}};}function respondWithFilteredResult(_0x3397e0,_0xc1bc78){return function(_0x9238eb){if(_0x9238eb){var _0x45bb50=typeof _0xc1bc78[_0xe762('0x33')]===_0xe762('0x34')&&typeof _0xc1bc78[_0xe762('0x35')]===_0xe762('0x34');var _0x5bcaed=_0x9238eb[_0xe762('0x36')];var _0x1892c3=_0x45bb50?0x0:_0xc1bc78['offset'];var _0x45f607=_0x45bb50?_0x9238eb[_0xe762('0x36')]:_0xc1bc78['offset']+_0xc1bc78[_0xe762('0x35')];var _0x5cd2b8;if(_0x45f607>=_0x5bcaed){_0x45f607=_0x5bcaed;_0x5cd2b8=0xc8;}else{_0x5cd2b8=0xce;}_0x3397e0[_0xe762('0x30')](_0x5cd2b8);return _0x3397e0['set']('Content-Range',_0x1892c3+'-'+_0x45f607+'/'+_0x5bcaed)[_0xe762('0x32')](_0x9238eb);}return null;};}function patchUpdates(_0x153910){return function(_0xfabf63){try{jsonpatch[_0xe762('0x37')](_0xfabf63,_0x153910,!![]);}catch(_0x4e977f){return BPromise['reject'](_0x4e977f);}return _0xfabf63[_0xe762('0x38')]();};}function saveUpdates(_0x2809e5,_0x2a4481){return function(_0x223952){if(_0x223952){return _0x223952['update'](_0x2809e5)[_0xe762('0x24')](function(_0x3bbeee){return _0x3bbeee;});}return null;};}function removeEntity(_0x56312b,_0x66b31b){return function(_0x349acb){if(_0x349acb){return _0x349acb[_0xe762('0x39')]()[_0xe762('0x24')](function(){var _0x121720=_0x349acb[_0xe762('0x3a')]({'plain':!![]});var _0x5b86a1=_0xe762('0x3b');return db[_0xe762('0x3c')]['destroy']({'where':{'type':_0x5b86a1,'resourceId':_0x121720['id']}})['then'](function(){return _0x349acb;});})['then'](function(){_0x56312b[_0xe762('0x30')](0xcc)[_0xe762('0x31')]();});}};}function handleEntityNotFound(_0x46a6db,_0x527bc6){return function(_0x2bd6b5){if(!_0x2bd6b5){_0x46a6db[_0xe762('0x2f')](0x194);}return _0x2bd6b5;};}function handleError(_0x4bfd96,_0x3acd50){_0x3acd50=_0x3acd50||0x1f4;return function(_0x2c3922){logger[_0xe762('0x29')](_0x2c3922[_0xe762('0x3d')]);if(_0x2c3922[_0xe762('0x3e')]){delete _0x2c3922[_0xe762('0x3e')];}_0x4bfd96[_0xe762('0x30')](_0x3acd50)[_0xe762('0x3f')](_0x2c3922);};}exports[_0xe762('0x40')]=function(_0x436c88,_0x5e2a33){var _0x12138c={},_0x3362f4={},_0x4147f0={'count':0x0,'rows':[]};var _0x1220b1=_[_0xe762('0x41')](db[_0xe762('0x42')][_0xe762('0x43')],function(_0x69fed7){return{'name':_0x69fed7[_0xe762('0x44')],'type':_0x69fed7['type'][_0xe762('0x45')]};});_0x3362f4[_0xe762('0x46')]=_[_0xe762('0x41')](_0x1220b1,_0xe762('0x3e'));_0x3362f4[_0xe762('0x47')]=_[_0xe762('0x48')](_0x436c88[_0xe762('0x47')]);_0x3362f4['filters']=_[_0xe762('0x49')](_0x3362f4['model'],_0x3362f4[_0xe762('0x47')]);_0x12138c[_0xe762('0x4a')]=_['intersection'](_0x3362f4[_0xe762('0x46')],qs[_0xe762('0x4b')](_0x436c88['query'][_0xe762('0x4b')]));_0x12138c[_0xe762('0x4a')]=_0x12138c[_0xe762('0x4a')]['length']?_0x12138c[_0xe762('0x4a')]:_0x3362f4['model'];if(!_0x436c88[_0xe762('0x47')][_0xe762('0x4c')](_0xe762('0x4d'))){_0x12138c[_0xe762('0x35')]=qs[_0xe762('0x35')](_0x436c88[_0xe762('0x47')][_0xe762('0x35')]);_0x12138c[_0xe762('0x33')]=qs[_0xe762('0x33')](_0x436c88[_0xe762('0x47')]['offset']);}_0x12138c['order']=qs[_0xe762('0x4e')](_0x436c88[_0xe762('0x47')][_0xe762('0x4e')]);_0x12138c[_0xe762('0x4f')]=qs['filters'](_['pick'](_0x436c88['query'],_0x3362f4[_0xe762('0x50')]),_0x1220b1);if(_0x436c88[_0xe762('0x47')][_0xe762('0x51')]){_0x12138c[_0xe762('0x4f')]=_[_0xe762('0x52')](_0x12138c[_0xe762('0x4f')],{'$or':_[_0xe762('0x41')](_0x1220b1,function(_0x1859e5){if(_0x1859e5[_0xe762('0x53')]!==_0xe762('0x54')){var _0x3925e6={};_0x3925e6[_0x1859e5[_0xe762('0x3e')]]={'$like':'%'+_0x436c88[_0xe762('0x47')][_0xe762('0x51')]+'%'};return _0x3925e6;}})});}_0x12138c=_[_0xe762('0x52')]({},_0x12138c,_0x436c88['options']);var _0x26168b={'where':_0x12138c[_0xe762('0x4f')]};return db[_0xe762('0x42')][_0xe762('0x36')](_0x26168b)[_0xe762('0x24')](function(_0x5b9ee3){_0x4147f0[_0xe762('0x36')]=_0x5b9ee3;if(_0x436c88['query'][_0xe762('0x55')]){_0x12138c[_0xe762('0x56')]=[{'all':!![]}];}return db[_0xe762('0x42')][_0xe762('0x57')](_0x12138c);})[_0xe762('0x24')](function(_0x55c272){_0x4147f0['rows']=_0x55c272;return _0x4147f0;})['then'](respondWithFilteredResult(_0x5e2a33,_0x12138c))[_0xe762('0x2e')](handleError(_0x5e2a33,null));};exports[_0xe762('0x58')]=function(_0x4bfe03,_0x4f2dcf){var _0x1f5f18={'raw':!![],'where':{'id':_0x4bfe03[_0xe762('0x59')]['id']}},_0x2fa0f1={};_0x2fa0f1[_0xe762('0x46')]=_[_0xe762('0x48')](db[_0xe762('0x42')][_0xe762('0x43')]);_0x2fa0f1[_0xe762('0x47')]=_[_0xe762('0x48')](_0x4bfe03['query']);_0x2fa0f1[_0xe762('0x50')]=_[_0xe762('0x49')](_0x2fa0f1[_0xe762('0x46')],_0x2fa0f1[_0xe762('0x47')]);_0x1f5f18['attributes']=_['intersection'](_0x2fa0f1[_0xe762('0x46')],qs[_0xe762('0x4b')](_0x4bfe03[_0xe762('0x47')][_0xe762('0x4b')]));_0x1f5f18[_0xe762('0x4a')]=_0x1f5f18['attributes'][_0xe762('0x5a')]?_0x1f5f18[_0xe762('0x4a')]:_0x2fa0f1[_0xe762('0x46')];if(_0x4bfe03['query'][_0xe762('0x55')]){_0x1f5f18['include']=[{'all':!![]}];}_0x1f5f18=_[_0xe762('0x52')]({},_0x1f5f18,_0x4bfe03[_0xe762('0x5b')]);return db[_0xe762('0x42')]['find'](_0x1f5f18)['then'](handleEntityNotFound(_0x4f2dcf,null))[_0xe762('0x24')](respondWithResult(_0x4f2dcf,null))[_0xe762('0x2e')](handleError(_0x4f2dcf,null));};exports['create']=function(_0x385949,_0x25b422){return db[_0xe762('0x42')][_0xe762('0x5c')](_0x385949[_0xe762('0x5d')],{})[_0xe762('0x24')](function(_0x15fc52){var _0xb197e1=_0x385949[_0xe762('0x5e')][_0xe762('0x3a')]({'plain':!![]});if(!_0xb197e1)throw new Error(_0xe762('0x5f'));if(_0xb197e1['role']===_0xe762('0x5e')){var _0x9a4341=_0x15fc52['get']({'plain':!![]});var _0x41b963=_0xe762('0x3b');return db['UserProfileSection'][_0xe762('0x60')]({'where':{'name':_0x41b963,'userProfileId':_0xb197e1['userProfileId']},'raw':!![]})['then'](function(_0x12ad16){if(_0x12ad16&&_0x12ad16[_0xe762('0x61')]===0x0){return db[_0xe762('0x3c')][_0xe762('0x5c')]({'name':_0x9a4341[_0xe762('0x3e')],'resourceId':_0x9a4341['id'],'type':_0x12ad16['name'],'sectionId':_0x12ad16['id']},{})['then'](function(){return _0x15fc52;});}else{return _0x15fc52;}})['catch'](function(_0x106a67){logger[_0xe762('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x106a67);throw _0x106a67;});}return _0x15fc52;})[_0xe762('0x24')](respondWithResult(_0x25b422,0xc9))['catch'](handleError(_0x25b422,null));};exports[_0xe762('0x62')]=function(_0x2e7614,_0x579709){if(_0x2e7614[_0xe762('0x5d')]['id']){delete _0x2e7614[_0xe762('0x5d')]['id'];}return db[_0xe762('0x42')][_0xe762('0x60')]({'where':{'id':_0x2e7614[_0xe762('0x59')]['id']}})[_0xe762('0x24')](handleEntityNotFound(_0x579709,null))[_0xe762('0x24')](saveUpdates(_0x2e7614[_0xe762('0x5d')],null))[_0xe762('0x24')](respondWithResult(_0x579709,null))['catch'](handleError(_0x579709,null));};exports['destroy']=function(_0xfe1e74,_0x61f3ae){return db[_0xe762('0x42')][_0xe762('0x60')]({'where':{'id':_0xfe1e74[_0xe762('0x59')]['id']}})[_0xe762('0x24')](handleEntityNotFound(_0x61f3ae,null))['then'](removeEntity(_0x61f3ae,null))['catch'](handleError(_0x61f3ae,null));};exports[_0xe762('0x63')]=function(_0x3f7b3a,_0x1e4cf0){return db[_0xe762('0x42')][_0xe762('0x63')]()[_0xe762('0x24')](respondWithResult(_0x1e4cf0,null))['catch'](handleError(_0x1e4cf0,null));};exports[_0xe762('0x64')]=function(_0x34237f,_0x82a19f,_0x510cc1){var _0x10507c={'raw':!![],'where':{}},_0x48b39b={},_0x31d250;return db[_0xe762('0x42')]['findOne']({'where':{'id':_0x34237f[_0xe762('0x59')]['id']}})[_0xe762('0x24')](handleEntityNotFound(_0x82a19f,null))['then'](function(_0x56c92b){if(_0x56c92b){_0x31d250=_0x56c92b[_0xe762('0x3a')]({'plain':!![]});_0x48b39b['model']=_[_0xe762('0x48')](db['UserChatQueue'][_0xe762('0x43')]);_0x48b39b['query']=_[_0xe762('0x48')](_0x34237f[_0xe762('0x47')]);_0x48b39b[_0xe762('0x50')]=_[_0xe762('0x49')](_0x48b39b[_0xe762('0x46')],_0x48b39b[_0xe762('0x47')]);_0x10507c['attributes']=_[_0xe762('0x49')](_0x48b39b[_0xe762('0x46')],qs['fields'](_0x34237f['query']['fields']));_0x10507c['attributes']=_0x10507c[_0xe762('0x4a')][_0xe762('0x5a')]?_0x10507c['attributes']:_0x48b39b['model'];if(!_0x34237f[_0xe762('0x47')]['hasOwnProperty'](_0xe762('0x4d'))){_0x10507c[_0xe762('0x35')]=qs['limit'](_0x34237f[_0xe762('0x47')][_0xe762('0x35')]);_0x10507c['offset']=qs[_0xe762('0x33')](_0x34237f[_0xe762('0x47')][_0xe762('0x33')]);}_0x10507c[_0xe762('0x65')]=qs[_0xe762('0x4e')](_0x34237f[_0xe762('0x47')]['sort']);_0x10507c[_0xe762('0x4f')]=qs[_0xe762('0x50')](_[_0xe762('0x66')](_0x34237f[_0xe762('0x47')],_0x48b39b[_0xe762('0x50')]));_0x10507c[_0xe762('0x4f')]['ChatQueueId']=_0x56c92b['id'];if(_0x34237f['query'][_0xe762('0x51')]){_0x10507c['where']=_[_0xe762('0x52')](_0x10507c[_0xe762('0x4f')],{'$or':_[_0xe762('0x41')](_0x10507c[_0xe762('0x4a')],function(_0x528cc8){var _0xae3c55={};_0xae3c55[_0x528cc8]={'$like':'%'+_0x34237f['query'][_0xe762('0x51')]+'%'};return _0xae3c55;})});}_0x10507c=_[_0xe762('0x52')]({},_0x10507c,_0x34237f[_0xe762('0x5b')]);return db[_0xe762('0x67')][_0xe762('0x57')](_0x10507c);}})[_0xe762('0x24')](function(_0x386679){if(_0x386679){return db['User'][_0xe762('0x68')]({'where':{'id':_['map'](_0x386679,_0xe762('0x69')),'role':_0xe762('0x6a')},'attributes':['id',_0xe762('0x3e'),_0xe762('0x6b'),_0xe762('0x6c'),_0xe762('0x6d')]});}})['then'](function(_0x37cbcc){if(_0x37cbcc){return{'count':_0x37cbcc['count'],'rows':_[_0xe762('0x41')](_0x37cbcc[_0xe762('0x6e')],function(_0x4de74c){return{'membername':_0x4de74c[_0xe762('0x3e')],'UserId':_0x4de74c['id'],'queue_name':_0x31d250[_0xe762('0x3e')],'ChatQueueId':_0x31d250['id'],'interface':util[_0xe762('0x6f')](_0xe762('0x70'),_0xe762('0x71'),_0x4de74c[_0xe762('0x3e')]),'penalty':0x0,'paused':_0x4de74c[_0xe762('0x6b')],'createdAt':_0x4de74c[_0xe762('0x6d')],'updatedAt':_0x4de74c[_0xe762('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe762('0x24')](respondWithFilteredResult(_0x82a19f,_0x10507c))[_0xe762('0x2e')](handleError(_0x82a19f,null));};exports['getTeams']=function(_0x59d0b3,_0x7ccc31,_0x4457c9){var _0x2c8878={};var _0x6583f6={};var _0x288f9e;var _0x312e64;return db[_0xe762('0x42')]['findOne']({'where':{'id':_0x59d0b3[_0xe762('0x59')]['id']}})['then'](handleEntityNotFound(_0x7ccc31,null))['then'](function(_0x5a369c){if(_0x5a369c){_0x288f9e=_0x5a369c;_0x6583f6[_0xe762('0x46')]=_[_0xe762('0x48')](db['Team'][_0xe762('0x43')]);_0x6583f6[_0xe762('0x47')]=_[_0xe762('0x48')](_0x59d0b3['query']);_0x6583f6[_0xe762('0x50')]=_[_0xe762('0x49')](_0x6583f6[_0xe762('0x46')],_0x6583f6[_0xe762('0x47')]);_0x2c8878['attributes']=_[_0xe762('0x49')](_0x6583f6['model'],qs[_0xe762('0x4b')](_0x59d0b3[_0xe762('0x47')]['fields']));_0x2c8878['attributes']=_0x2c8878[_0xe762('0x4a')][_0xe762('0x5a')]?_0x2c8878[_0xe762('0x4a')]:_0x6583f6[_0xe762('0x46')];_0x2c8878[_0xe762('0x65')]=qs[_0xe762('0x4e')](_0x59d0b3['query'][_0xe762('0x4e')]);_0x2c8878[_0xe762('0x4f')]=qs[_0xe762('0x50')](_[_0xe762('0x66')](_0x59d0b3[_0xe762('0x47')],_0x6583f6[_0xe762('0x50')]));if(_0x59d0b3['query'][_0xe762('0x51')]){_0x2c8878[_0xe762('0x4f')]=_['merge'](_0x2c8878['where'],{'$or':_[_0xe762('0x41')](_0x2c8878['attributes'],function(_0x14c3fd){var _0x147c4f={};_0x147c4f[_0x14c3fd]={'$like':'%'+_0x59d0b3[_0xe762('0x47')][_0xe762('0x51')]+'%'};return _0x147c4f;})});}_0x2c8878=_[_0xe762('0x52')]({},_0x2c8878,_0x59d0b3['options']);return _0x288f9e[_0xe762('0x72')](_0x2c8878);}})['then'](function(_0x307d9f){if(_0x307d9f){_0x312e64=_0x307d9f[_0xe762('0x5a')];if(!_0x59d0b3['query']['hasOwnProperty'](_0xe762('0x4d'))){_0x2c8878[_0xe762('0x35')]=qs[_0xe762('0x35')](_0x59d0b3[_0xe762('0x47')][_0xe762('0x35')]);_0x2c8878[_0xe762('0x33')]=qs[_0xe762('0x33')](_0x59d0b3[_0xe762('0x47')][_0xe762('0x33')]);}return _0x288f9e['getTeams'](_0x2c8878);}})[_0xe762('0x24')](function(_0xf6790f){if(_0xf6790f){return _0xf6790f?{'count':_0x312e64,'rows':_0xf6790f}:null;}})['then'](respondWithResult(_0x7ccc31,null))[_0xe762('0x2e')](handleError(_0x7ccc31,null));};exports[_0xe762('0x73')]=function(_0x4a566e,_0x1a3e99,_0x1cfd6e){var _0x3ab5ed=_0x4a566e[_0xe762('0x5d')]['ids'];return db[_0xe762('0x74')][_0xe762('0x57')]({'where':{'id':_0x3ab5ed},'attributes':['id'],'include':[{'model':db[_0xe762('0x75')],'as':_0xe762('0x76'),'attributes':['id',_0xe762('0x3e'),'online',_0xe762('0x77'),'interface'],'raw':!![]}]})[_0xe762('0x24')](function(_0x4cd22f){if(_0x4cd22f){var _0x44a731=_[_0xe762('0x78')](_0x4cd22f,function(_0x159c47){var _0x28292d=_0x159c47[_0xe762('0x3a')]({'plain':!![]});return _0x28292d['Agents'];});return db[_0xe762('0x42')]['find']({'where':{'id':_0x4a566e[_0xe762('0x59')]['id']}})[_0xe762('0x24')](function(_0x30acf3){return db[_0xe762('0x79')]['transaction'](function(_0x323f76){return _0x30acf3[_0xe762('0x73')](_0x3ab5ed,{'transaction':_0x323f76})[_0xe762('0x24')](function(){return BPromise[_0xe762('0x7a')](_0x44a731,function(_0x1ff6b8){return db[_0xe762('0x67')]['findOrCreate']({'where':{'UserId':_0x1ff6b8['id'],'ChatQueueId':_0x4a566e['params']['id']},'transaction':_0x323f76});});})[_0xe762('0x24')](function(){_0x44a731[_0xe762('0x7b')](function(_0x2619e8){socket[_0xe762('0x7c')]('userChatQueue:save',{'UserId':_0x2619e8['id'],'ChatQueueId':_0x30acf3['id']});});});});});}})['then'](respondWithStatusCode(_0x1a3e99,null))[_0xe762('0x2e')](handleError(_0x1a3e99,null));};exports[_0xe762('0x7d')]=function(_0x147200,_0x4d4f7b,_0xbbf374){return db[_0xe762('0x74')]['findAll']({'where':{'id':_0x147200[_0xe762('0x47')][_0xe762('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xe762('0x75')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d4f7b,null))[_0xe762('0x24')](function(_0x5cf827){var _0x4f8be4=_[_0xe762('0x41')](_0x5cf827,'id');var _0x60207e=[];var _0x5dfed8=[];var _0x1f813e=squel[_0xe762('0x7f')]();_0x1f813e[_0xe762('0x80')](_0xe762('0x81'))['from'](_0xe762('0x82'),'tq')[_0xe762('0x83')](_0xe762('0x84'),'ut',_0xe762('0x85'))[_0xe762('0x4f')](_0xe762('0x86'),_0x147200[_0xe762('0x59')]['id']);for(var _0x37288a=0x0;_0x37288a<_0x5cf827[_0xe762('0x5a')];_0x37288a+=0x1){let _0x54c418=_0x5cf827[_0x37288a];for(var _0x3624ee=0x0;_0x3624ee<_0x54c418[_0xe762('0x76')][_0xe762('0x5a')];_0x3624ee+=0x1){let _0x1369f3=_0x54c418[_0xe762('0x76')][_0x3624ee];var _0x22cdf5=_0x1f813e[_0xe762('0x87')]();_0x22cdf5[_0xe762('0x4f')](_0xe762('0x88'),_0x1369f3['id']);_0x5dfed8[_0xe762('0x89')](db[_0xe762('0x79')][_0xe762('0x47')](_0x22cdf5[_0xe762('0x8a')](),{'type':db[_0xe762('0x79')]['QueryTypes'][_0xe762('0x8b')]})[_0xe762('0x24')](function(_0x2d7d72){if(_0x2d7d72[_0xe762('0x5a')]===0x1){return _0x1369f3['id'];}else{var _0x18d408=_[_0xe762('0x8c')](_[_0xe762('0x41')](_0x2d7d72,'TeamId'),function(_0x56eef8){return _[_0xe762('0x8d')](_0x4f8be4,_0x56eef8);});if(_0x18d408){return _0x1369f3['id'];}}}));}}return BPromise[_0xe762('0x8e')](_0x5dfed8)[_0xe762('0x24')](function(_0x4fc449){_0x60207e=_(_0x60207e)[_0xe762('0x8f')](_0x4fc449)[_0xe762('0x90')]()[_0xe762('0x91')]();return db['ChatQueue'][_0xe762('0x60')]({'where':{'id':_0x147200[_0xe762('0x59')]['id']}})[_0xe762('0x24')](function(_0x5eee8c){return db[_0xe762('0x79')]['transaction'](function(_0x13b176){return _0x5eee8c[_0xe762('0x7d')](_0x147200[_0xe762('0x47')]['ids'],{'transaction':_0x13b176})[_0xe762('0x24')](function(){if(!_['isEmpty'](_0x60207e)){return _0x5eee8c[_0xe762('0x92')](_0x60207e,{'transaction':_0x13b176});}})['then'](function(){_0x60207e[_0xe762('0x7b')](function(_0x2e39e6){socket[_0xe762('0x7c')](_0xe762('0x93'),{'UserId':_0x2e39e6,'ChatQueueId':_0x5eee8c['id']});});});});});});})['then'](respondWithStatusCode(_0x4d4f7b,null))[_0xe762('0x2e')](handleError(_0x4d4f7b,null));};exports[_0xe762('0x94')]=function(_0x4d235c,_0xf09a0a,_0x260c63){return db['ChatQueue'][_0xe762('0x60')]({'where':{'id':_0x4d235c[_0xe762('0x59')]['id']}})[_0xe762('0x24')](handleEntityNotFound(_0xf09a0a,null))['then'](function(_0x347c0e){if(_0x347c0e){return _0x347c0e['addAgents'](_0x4d235c[_0xe762('0x5d')][_0xe762('0x7e')],_[_0xe762('0x95')](_0x4d235c[_0xe762('0x5d')],[_0xe762('0x7e'),'id'])||{})[_0xe762('0x96')](function(_0x48b9a8){for(var _0x44fc86=0x0;_0x44fc86<_0x4d235c[_0xe762('0x5d')]['ids'][_0xe762('0x5a')];_0x44fc86+=0x1){socket[_0xe762('0x7c')](_0xe762('0x97'),{'UserId':Number(_0x4d235c['body'][_0xe762('0x7e')][_0x44fc86]),'ChatQueueId':Number(_0x4d235c[_0xe762('0x59')]['id'])});}return _0x48b9a8;});}})[_0xe762('0x24')](respondWithResult(_0xf09a0a,null))['catch'](handleError(_0xf09a0a,null));};exports[_0xe762('0x92')]=function(_0x960542,_0xa5b551,_0x4c00e1){return db[_0xe762('0x42')][_0xe762('0x60')]({'where':{'id':_0x960542[_0xe762('0x59')]['id']}})['then'](handleEntityNotFound(_0xa5b551,null))['then'](function(_0x4ae0f3){if(_0x4ae0f3){return _0x4ae0f3['removeAgents'](_0x960542[_0xe762('0x47')][_0xe762('0x7e')])[_0xe762('0x24')](function(){if(_[_0xe762('0x98')](_0x960542['query'][_0xe762('0x7e')])){for(var _0x2eccf7=0x0;_0x2eccf7<_0x960542[_0xe762('0x47')][_0xe762('0x7e')][_0xe762('0x5a')];_0x2eccf7+=0x1){socket[_0xe762('0x7c')](_0xe762('0x93'),{'UserId':Number(_0x960542[_0xe762('0x47')][_0xe762('0x7e')][_0x2eccf7]),'ChatQueueId':Number(_0x960542['params']['id'])});}}else{socket[_0xe762('0x7c')](_0xe762('0x93'),{'UserId':Number(_0x960542['query'][_0xe762('0x7e')]),'ChatQueueId':Number(_0x960542['params']['id'])});}});}})[_0xe762('0x24')](respondWithStatusCode(_0xa5b551,null))[_0xe762('0x2e')](handleError(_0xa5b551,null));};exports[_0xe762('0x99')]=function(_0x458448,_0x3f3140,_0xf8049){var _0x13c4b3={};var _0x5ea102={};var _0x54d0b7;var _0x1e4266;return db[_0xe762('0x42')][_0xe762('0x9a')]({'where':{'id':_0x458448[_0xe762('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f3140,null))[_0xe762('0x24')](function(_0xcb608d){if(_0xcb608d){_0x54d0b7=_0xcb608d;_0x5ea102[_0xe762('0x46')]=_[_0xe762('0x48')](db['User'][_0xe762('0x43')]);_0x5ea102[_0xe762('0x47')]=_['keys'](_0x458448[_0xe762('0x47')]);_0x5ea102['filters']=_[_0xe762('0x49')](_0x5ea102[_0xe762('0x46')],_0x5ea102[_0xe762('0x47')]);_0x13c4b3[_0xe762('0x4a')]=_['intersection'](_0x5ea102[_0xe762('0x46')],qs[_0xe762('0x4b')](_0x458448[_0xe762('0x47')][_0xe762('0x4b')]));_0x13c4b3[_0xe762('0x4a')]=_0x13c4b3[_0xe762('0x4a')][_0xe762('0x5a')]?_0x13c4b3[_0xe762('0x4a')]:_0x5ea102[_0xe762('0x46')];_0x13c4b3['order']=qs[_0xe762('0x4e')](_0x458448[_0xe762('0x47')]['sort']);_0x13c4b3[_0xe762('0x4f')]=qs[_0xe762('0x50')](_[_0xe762('0x66')](_0x458448[_0xe762('0x47')],_0x5ea102['filters']));if(_0x458448[_0xe762('0x47')]['filter']){_0x13c4b3[_0xe762('0x4f')]=_[_0xe762('0x52')](_0x13c4b3[_0xe762('0x4f')],{'$or':_[_0xe762('0x41')](_0x13c4b3[_0xe762('0x4a')],function(_0x3fd9bb){var _0x2ce560={};_0x2ce560[_0x3fd9bb]={'$like':'%'+_0x458448[_0xe762('0x47')]['filter']+'%'};return _0x2ce560;})});}_0x13c4b3=_[_0xe762('0x52')]({},_0x13c4b3,_0x458448[_0xe762('0x5b')]);return _0x54d0b7[_0xe762('0x99')](_0x13c4b3);}})[_0xe762('0x24')](function(_0x4bcdff){if(_0x4bcdff){_0x1e4266=_0x4bcdff[_0xe762('0x5a')];if(!_0x458448[_0xe762('0x47')]['hasOwnProperty']('nolimit')){_0x13c4b3[_0xe762('0x35')]=qs[_0xe762('0x35')](_0x458448[_0xe762('0x47')][_0xe762('0x35')]);_0x13c4b3[_0xe762('0x33')]=qs[_0xe762('0x33')](_0x458448['query']['offset']);}return _0x54d0b7[_0xe762('0x99')](_0x13c4b3);}})[_0xe762('0x24')](function(_0x404743){if(_0x404743){return _0x404743?{'count':_0x1e4266,'rows':_0x404743}:null;}})[_0xe762('0x24')](respondWithResult(_0x3f3140,null))['catch'](handleError(_0x3f3140,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e1795aa..bf8cabd 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 _0x5430=['exports','../../mysqldb','setMaxListeners','remove','emit','hook'];(function(_0x3f6d5a,_0x2a83c8){var _0x33b363=function(_0x2da4c2){while(--_0x2da4c2){_0x3f6d5a['push'](_0x3f6d5a['shift']());}};_0x33b363(++_0x2a83c8);}(_0x5430,0xc7));var _0x0543=function(_0x4a9874,_0x48f997){_0x4a9874=_0x4a9874-0x0;var _0x26b791=_0x5430[_0x4a9874];return _0x26b791;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0543('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0543('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0543('0x2')};function emitEvent(_0x50274e){return function(_0x5cce70,_0x3b4e30,_0x377152){ChatQueueEvents['emit'](_0x50274e+':'+_0x5cce70['id'],_0x5cce70);ChatQueueEvents[_0x0543('0x3')](_0x50274e,_0x5cce70);_0x377152(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x0543('0x4')](e,emitEvent(event));}}module[_0x0543('0x5')]=ChatQueueEvents; \ No newline at end of file +var _0x69dd=['ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x88ab90,_0x5155df){var _0x241cf0=function(_0x368641){while(--_0x368641){_0x88ab90['push'](_0x88ab90['shift']());}};_0x241cf0(++_0x5155df);}(_0x69dd,0x117));var _0xd69d=function(_0x15fe68,_0xddc145){_0x15fe68=_0x15fe68-0x0;var _0x1d144c=_0x69dd[_0x15fe68];return _0x1d144c;};'use strict';var EventEmitter=require(_0xd69d('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xd69d('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd69d('0x2')](0x0);var events={'afterCreate':_0xd69d('0x3'),'afterUpdate':_0xd69d('0x4'),'afterDestroy':_0xd69d('0x5')};function emitEvent(_0x23145a){return function(_0x12efd0,_0xab993a,_0xca2d44){ChatQueueEvents[_0xd69d('0x6')](_0x23145a+':'+_0x12efd0['id'],_0x12efd0);ChatQueueEvents['emit'](_0x23145a,_0x12efd0);_0xca2d44(null);};}for(var e in events){if(events[_0xd69d('0x7')](e)){var event=events[e];ChatQueue[_0xd69d('0x8')](e,emitEvent(event));}}module[_0xd69d('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 8506684..119291b 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 _0xd8ba=['exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x375c38,_0x1afa1d){var _0x37076c=function(_0x3a2d0f){while(--_0x3a2d0f){_0x375c38['push'](_0x375c38['shift']());}};_0x37076c(++_0x1afa1d);}(_0xd8ba,0xc7));var _0xad8b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd8ba[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xad8b('0x0'));var util=require(_0xad8b('0x1'));var logger=require(_0xad8b('0x2'))(_0xad8b('0x3'));var moment=require(_0xad8b('0x4'));var BPromise=require(_0xad8b('0x5'));var rp=require(_0xad8b('0x6'));var fs=require('fs');var path=require(_0xad8b('0x7'));var rimraf=require(_0xad8b('0x8'));var config=require(_0xad8b('0x9'));var attributes=require(_0xad8b('0xa'));module[_0xad8b('0xb')]=function(_0x5b8fe6,_0xe75eba){return _0x5b8fe6[_0xad8b('0xc')](_0xad8b('0xd'),attributes,{'tableName':_0xad8b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4995=['path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','request-promise'];(function(_0x4b3b4d,_0x80fb2e){var _0x2006f3=function(_0x2ceea8){while(--_0x2ceea8){_0x4b3b4d['push'](_0x4b3b4d['shift']());}};_0x2006f3(++_0x80fb2e);}(_0x4995,0x127));var _0x5499=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4995[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x5499('0x0'));var util=require(_0x5499('0x1'));var logger=require(_0x5499('0x2'))(_0x5499('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5499('0x4'));var fs=require('fs');var path=require(_0x5499('0x5'));var rimraf=require(_0x5499('0x6'));var config=require('../../config/environment');var attributes=require(_0x5499('0x7'));module[_0x5499('0x8')]=function(_0x536997,_0x1c21d0){return _0x536997[_0x5499('0x9')](_0x5499('0xa'),attributes,{'tableName':_0x5499('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 391a5b4..a98acad 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 _0xebc4=['./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','info','GetChatQueue','ChatQueue','then','ShowChatQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis','socket.io-emitter'];(function(_0x1b6f3d,_0x52bddf){var _0x2a3d6d=function(_0x348d0d){while(--_0x348d0d){_0x1b6f3d['push'](_0x1b6f3d['shift']());}};_0x2a3d6d(++_0x52bddf);}(_0xebc4,0xf9));var _0x4ebc=function(_0x34e106,_0x91d313){_0x34e106=_0x34e106-0x0;var _0x23a796=_0xebc4[_0x34e106];return _0x23a796;};'use strict';var _=require('lodash');var util=require(_0x4ebc('0x0'));var moment=require(_0x4ebc('0x1'));var BPromise=require(_0x4ebc('0x2'));var rs=require(_0x4ebc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ebc('0x4'))['db'];var utils=require(_0x4ebc('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ebc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4ebc('0x7')]['http']({'port':0x232a});config[_0x4ebc('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ebc('0x9'))(new Redis(config[_0x4ebc('0x8')]));require(_0x4ebc('0xa'))[_0x4ebc('0xb')](socket);function respondWithRpcPromise(_0x46e0dc,_0x5d6a99,_0x27a221){return new BPromise(function(_0x1b5dbc,_0x12e3c6){return client[_0x4ebc('0xc')](_0x46e0dc,_0x27a221)['then'](function(_0x1522b9){logger['info'](_0x4ebc('0xd'),_0x5d6a99,_0x4ebc('0xe'));logger[_0x4ebc('0xf')](_0x4ebc('0x10'),_0x5d6a99,'request\x20sent',JSON[_0x4ebc('0x11')](_0x1522b9));if(_0x1522b9['error']){if(_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x13')]===0x1f4){logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x14')]);return _0x12e3c6(_0x1522b9['error'][_0x4ebc('0x14')]);}logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x1522b9[_0x4ebc('0x12')]['message']);return _0x1b5dbc(_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x14')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x5d6a99,_0x4ebc('0xe'));_0x1b5dbc(_0x1522b9[_0x4ebc('0x15')]['message']);}})[_0x4ebc('0x16')](function(_0x28571e){logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x28571e);_0x12e3c6(_0x28571e);});});}exports['GetChatQueue']=function(_0x59251b){var _0x249dcf=this;return new Promise(function(_0x3e6195,_0x137ec9){return db['ChatQueue'][_0x4ebc('0x17')]({'raw':_0x59251b['options']?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x19')]===undefined?!![]:![]:!![],'where':_0x59251b['options']?_0x59251b['options'][_0x4ebc('0x1a')]||null:null,'attributes':_0x59251b['options']?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1b')]||null:null,'limit':_0x59251b[_0x4ebc('0x18')]?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1c')]||null:null,'include':_0x59251b[_0x4ebc('0x18')]?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x59251b[_0x4ebc('0x18')]['include'],function(_0x376a83){return{'model':db[_0x376a83[_0x4ebc('0x1f')]],'as':_0x376a83['as'],'attributes':_0x376a83[_0x4ebc('0x1b')],'include':_0x376a83[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x376a83[_0x4ebc('0x1d')],function(_0x165924){return{'model':db[_0x165924[_0x4ebc('0x1f')]],'as':_0x165924['as'],'attributes':_0x165924[_0x4ebc('0x1b')],'include':_0x165924[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x165924['include'],function(_0x10b09a){return{'model':db[_0x10b09a[_0x4ebc('0x1f')]],'as':_0x10b09a['as'],'attributes':_0x10b09a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42590d){logger[_0x4ebc('0x20')](_0x4ebc('0x21'),_0x59251b);logger[_0x4ebc('0xf')](_0x4ebc('0x21'),_0x59251b,JSON[_0x4ebc('0x11')](_0x42590d));_0x3e6195(_0x42590d);})[_0x4ebc('0x16')](function(_0x1d3d15){logger[_0x4ebc('0x12')]('GetChatQueue',_0x1d3d15[_0x4ebc('0x14')],_0x59251b);_0x137ec9(_0x249dcf[_0x4ebc('0x12')](0x1f4,_0x1d3d15[_0x4ebc('0x14')]));});});};exports['ShowChatQueue']=function(_0x3f9c40){var _0xbf2673=this;return new Promise(function(_0x141869,_0x3da50a){return db[_0x4ebc('0x22')]['find']({'raw':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1a')]||null:null,'attributes':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1b')]||null:null,'include':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1d')]?_['map'](_0x3f9c40['options'][_0x4ebc('0x1d')],function(_0x136d78){return{'model':db[_0x136d78[_0x4ebc('0x1f')]],'as':_0x136d78['as'],'attributes':_0x136d78[_0x4ebc('0x1b')],'include':_0x136d78[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x136d78[_0x4ebc('0x1d')],function(_0x4af0ec){return{'model':db[_0x4af0ec[_0x4ebc('0x1f')]],'as':_0x4af0ec['as'],'attributes':_0x4af0ec['attributes'],'include':_0x4af0ec['include']?_[_0x4ebc('0x1e')](_0x4af0ec[_0x4ebc('0x1d')],function(_0x34b276){return{'model':db[_0x34b276[_0x4ebc('0x1f')]],'as':_0x34b276['as'],'attributes':_0x34b276[_0x4ebc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4ebc('0x23')](function(_0x4fcfb6){logger[_0x4ebc('0x20')]('ShowChatQueue',_0x3f9c40);logger['debug'](_0x4ebc('0x24'),_0x3f9c40,JSON[_0x4ebc('0x11')](_0x4fcfb6));_0x141869(_0x4fcfb6);})[_0x4ebc('0x16')](function(_0x28ab22){logger[_0x4ebc('0x12')](_0x4ebc('0x24'),_0x28ab22[_0x4ebc('0x14')],_0x3f9c40);_0x3da50a(_0xbf2673['error'](0x1f4,_0x28ab22['message']));});});}; \ No newline at end of file +var _0x4b17=['request\x20sent','stringify','error','message','ChatQueue,\x20%s,\x20%s','result','GetChatQueue','ChatQueue','findAll','options','raw','attributes','include','map','model','debug','catch','ShowChatQueue','find','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4b17,0x10f));var _0x74b1=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0x4b17[_0xb875ee];return _0x4c7f3a;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});config[_0x74b1('0x9')]=_[_0x74b1('0xa')](config[_0x74b1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x74b1('0xb'))(new Redis(config[_0x74b1('0x9')]));require(_0x74b1('0xc'))[_0x74b1('0xd')](socket);function respondWithRpcPromise(_0xc1952,_0x4eab15,_0x33f4bf){return new BPromise(function(_0x20bd4c,_0x57f3ad){return client[_0x74b1('0xe')](_0xc1952,_0x33f4bf)[_0x74b1('0xf')](function(_0x6434fd){logger[_0x74b1('0x10')]('ChatQueue,\x20%s,\x20%s',_0x4eab15,_0x74b1('0x11'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4eab15,_0x74b1('0x11'),JSON[_0x74b1('0x12')](_0x6434fd));if(_0x6434fd['error']){if(_0x6434fd['error']['code']===0x1f4){logger[_0x74b1('0x13')]('ChatQueue,\x20%s,\x20%s',_0x4eab15,_0x6434fd['error'][_0x74b1('0x14')]);return _0x57f3ad(_0x6434fd[_0x74b1('0x13')][_0x74b1('0x14')]);}logger[_0x74b1('0x13')](_0x74b1('0x15'),_0x4eab15,_0x6434fd[_0x74b1('0x13')]['message']);return _0x20bd4c(_0x6434fd[_0x74b1('0x13')][_0x74b1('0x14')]);}else{logger[_0x74b1('0x10')](_0x74b1('0x15'),_0x4eab15,_0x74b1('0x11'));_0x20bd4c(_0x6434fd[_0x74b1('0x16')][_0x74b1('0x14')]);}})['catch'](function(_0xd50f0){logger[_0x74b1('0x13')]('ChatQueue,\x20%s,\x20%s',_0x4eab15,_0xd50f0);_0x57f3ad(_0xd50f0);});});}exports[_0x74b1('0x17')]=function(_0x38d932){var _0x39f261=this;return new Promise(function(_0x25704e,_0x13bb44){return db[_0x74b1('0x18')][_0x74b1('0x19')]({'raw':_0x38d932[_0x74b1('0x1a')]?_0x38d932['options'][_0x74b1('0x1b')]===undefined?!![]:![]:!![],'where':_0x38d932['options']?_0x38d932['options']['where']||null:null,'attributes':_0x38d932[_0x74b1('0x1a')]?_0x38d932[_0x74b1('0x1a')][_0x74b1('0x1c')]||null:null,'limit':_0x38d932[_0x74b1('0x1a')]?_0x38d932[_0x74b1('0x1a')]['limit']||null:null,'include':_0x38d932[_0x74b1('0x1a')]?_0x38d932['options'][_0x74b1('0x1d')]?_[_0x74b1('0x1e')](_0x38d932[_0x74b1('0x1a')][_0x74b1('0x1d')],function(_0x3239d8){return{'model':db[_0x3239d8[_0x74b1('0x1f')]],'as':_0x3239d8['as'],'attributes':_0x3239d8[_0x74b1('0x1c')],'include':_0x3239d8[_0x74b1('0x1d')]?_['map'](_0x3239d8[_0x74b1('0x1d')],function(_0x42b69d){return{'model':db[_0x42b69d[_0x74b1('0x1f')]],'as':_0x42b69d['as'],'attributes':_0x42b69d['attributes'],'include':_0x42b69d[_0x74b1('0x1d')]?_[_0x74b1('0x1e')](_0x42b69d[_0x74b1('0x1d')],function(_0x1b011a){return{'model':db[_0x1b011a[_0x74b1('0x1f')]],'as':_0x1b011a['as'],'attributes':_0x1b011a[_0x74b1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x74b1('0xf')](function(_0x3ce043){logger['info'](_0x74b1('0x17'),_0x38d932);logger[_0x74b1('0x20')]('GetChatQueue',_0x38d932,JSON[_0x74b1('0x12')](_0x3ce043));_0x25704e(_0x3ce043);})[_0x74b1('0x21')](function(_0x1ac433){logger['error'](_0x74b1('0x17'),_0x1ac433[_0x74b1('0x14')],_0x38d932);_0x13bb44(_0x39f261['error'](0x1f4,_0x1ac433[_0x74b1('0x14')]));});});};exports[_0x74b1('0x22')]=function(_0x2211b2){var _0x31c321=this;return new Promise(function(_0x68a3bd,_0x32a8d6){return db[_0x74b1('0x18')][_0x74b1('0x23')]({'raw':_0x2211b2['options']?_0x2211b2[_0x74b1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2211b2['options']?_0x2211b2[_0x74b1('0x1a')]['where']||null:null,'attributes':_0x2211b2['options']?_0x2211b2[_0x74b1('0x1a')][_0x74b1('0x1c')]||null:null,'include':_0x2211b2[_0x74b1('0x1a')]?_0x2211b2[_0x74b1('0x1a')][_0x74b1('0x1d')]?_[_0x74b1('0x1e')](_0x2211b2[_0x74b1('0x1a')][_0x74b1('0x1d')],function(_0x5607d2){return{'model':db[_0x5607d2['model']],'as':_0x5607d2['as'],'attributes':_0x5607d2['attributes'],'include':_0x5607d2[_0x74b1('0x1d')]?_['map'](_0x5607d2['include'],function(_0xee2bae){return{'model':db[_0xee2bae[_0x74b1('0x1f')]],'as':_0xee2bae['as'],'attributes':_0xee2bae[_0x74b1('0x1c')],'include':_0xee2bae['include']?_[_0x74b1('0x1e')](_0xee2bae['include'],function(_0x2fa859){return{'model':db[_0x2fa859[_0x74b1('0x1f')]],'as':_0x2fa859['as'],'attributes':_0x2fa859['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1be766){logger[_0x74b1('0x10')]('ShowChatQueue',_0x2211b2);logger['debug'](_0x74b1('0x22'),_0x2211b2,JSON['stringify'](_0x1be766));_0x68a3bd(_0x1be766);})[_0x74b1('0x21')](function(_0x39cc71){logger[_0x74b1('0x13')](_0x74b1('0x22'),_0x39cc71[_0x74b1('0x14')],_0x2211b2);_0x32a8d6(_0x31c321['error'](0x1f4,_0x39cc71[_0x74b1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c28b02f..60c4403 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 _0x5c12=['removeListener','chatQueue:','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c12,0x188));var _0x25c1=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x5c12[_0x81e39d];return _0x548fbb;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x25c1('0x0'),_0x25c1('0x1'),'update'];function createListener(_0x44bc2e,_0x1991e5){return function(_0x4042fe){_0x1991e5[_0x25c1('0x2')](_0x44bc2e,_0x4042fe);};}function removeListener(_0x2c5df0,_0x21ec20){return function(){ChatQueueEvents[_0x25c1('0x3')](_0x2c5df0,_0x21ec20);};}exports['register']=function(_0x204287){for(var _0x42ac16=0x0,_0x382922=events['length'];_0x42ac16<_0x382922;_0x42ac16++){var _0x5c69b1=events[_0x42ac16];var _0x24981c=createListener(_0x25c1('0x4')+_0x5c69b1,_0x204287);ChatQueueEvents['on'](_0x5c69b1,_0x24981c);}}; \ No newline at end of file +var _0xac9d=['update','emit','register','length','chatQueue:','./chatQueue.events','save','remove'];(function(_0x1d8f29,_0x205904){var _0x5c7854=function(_0xe36152){while(--_0xe36152){_0x1d8f29['push'](_0x1d8f29['shift']());}};_0x5c7854(++_0x205904);}(_0xac9d,0x14d));var _0xdac9=function(_0x47878f,_0x48d3bf){_0x47878f=_0x47878f-0x0;var _0x4b05b8=_0xac9d[_0x47878f];return _0x4b05b8;};'use strict';var ChatQueueEvents=require(_0xdac9('0x0'));var events=[_0xdac9('0x1'),_0xdac9('0x2'),_0xdac9('0x3')];function createListener(_0x12390c,_0x27eb7c){return function(_0x25d1b3){_0x27eb7c[_0xdac9('0x4')](_0x12390c,_0x25d1b3);};}function removeListener(_0x51a5d7,_0x1c17a6){return function(){ChatQueueEvents['removeListener'](_0x51a5d7,_0x1c17a6);};}exports[_0xdac9('0x5')]=function(_0x1f8ff3){for(var _0x1222bb=0x0,_0x776b6c=events[_0xdac9('0x6')];_0x1222bb<_0x776b6c;_0x1222bb++){var _0x39f560=events[_0x1222bb];var _0x5531af=createListener(_0xdac9('0x7')+_0x39f560,_0x1f8ff3);ChatQueueEvents['on'](_0x39f560,_0x5531af);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index cfcd139..497c1e2 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0x5fc3[_0x36feb2];return _0x292b43;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x5fc3[_0x49d19d];return _0x4ebef1;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f017f19..9e272f6 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 _0x5b2d=['moment','exports','STRING','DATE'];(function(_0x1a3c0e,_0x1dea68){var _0xdab41=function(_0x3be01a){while(--_0x3be01a){_0x1a3c0e['push'](_0x1a3c0e['shift']());}};_0xdab41(++_0x1dea68);}(_0x5b2d,0x140));var _0xd5b2=function(_0x11d7ac,_0x1aefb4){_0x11d7ac=_0x11d7ac-0x0;var _0xff1914=_0x5b2d[_0x11d7ac];return _0xff1914;};'use strict';var moment=require(_0xd5b2('0x0'));var Sequelize=require('sequelize');module[_0xd5b2('0x1')]={'uniqueid':{'type':Sequelize[_0xd5b2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd5b2('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd5b2('0x3')]},'acceptAt':{'type':Sequelize[_0xd5b2('0x3')]},'exitAt':{'type':Sequelize[_0xd5b2('0x3')]},'reason':{'type':Sequelize[_0xd5b2('0x2')]}}; \ No newline at end of file +var _0x1526=['DATE','moment','sequelize','exports','STRING'];(function(_0x4e2cd9,_0x478769){var _0x5edba3=function(_0x3f0b07){while(--_0x3f0b07){_0x4e2cd9['push'](_0x4e2cd9['shift']());}};_0x5edba3(++_0x478769);}(_0x1526,0x16e));var _0x6152=function(_0x431e48,_0xa09911){_0x431e48=_0x431e48-0x0;var _0x37112d=_0x1526[_0x431e48];return _0x37112d;};'use strict';var moment=require(_0x6152('0x0'));var Sequelize=require(_0x6152('0x1'));module[_0x6152('0x2')]={'uniqueid':{'type':Sequelize[_0x6152('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6152('0x4')]},'leaveAt':{'type':Sequelize[_0x6152('0x4')]},'acceptAt':{'type':Sequelize[_0x6152('0x4')]},'exitAt':{'type':Sequelize[_0x6152('0x4')]},'reason':{'type':Sequelize[_0x6152('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2e8a55e..ff4d48b 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 _0x084b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','keys','fields','include','create','body','find','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x4b9c74,_0x1b66bb){var _0x229a46=function(_0x2edf37){while(--_0x2edf37){_0x4b9c74['push'](_0x4b9c74['shift']());}};_0x229a46(++_0x1b66bb);}(_0x084b,0xd5));var _0xb084=function(_0x1234e5,_0x599458){_0x1234e5=_0x1234e5-0x0;var _0x1a351e=_0x084b[_0x1234e5];return _0x1a351e;};'use strict';var emlformat=require(_0xb084('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb084('0x1'));var moment=require(_0xb084('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb084('0x3'));var util=require(_0xb084('0x4'));var path=require(_0xb084('0x5'));var sox=require('sox');var csv=require(_0xb084('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb084('0x7'));var _=require(_0xb084('0x8'));var squel=require(_0xb084('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb084('0xa'));var toCsv=require(_0xb084('0x6'));var querystring=require(_0xb084('0xb'));var Papa=require(_0xb084('0xc'));var Redis=require(_0xb084('0xd'));var authService=require(_0xb084('0xe'));var qs=require(_0xb084('0xf'));var as=require(_0xb084('0x10'));var hardwareService=require(_0xb084('0x11'));var logger=require(_0xb084('0x12'))(_0xb084('0x13'));var utils=require(_0xb084('0x14'));var config=require(_0xb084('0x15'));var licenseUtil=require(_0xb084('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51aee2,_0x3582a0){_0x3582a0=_0x3582a0||0xcc;return function(_0x514829){if(_0x514829){return _0x51aee2['sendStatus'](_0x3582a0);}return _0x51aee2[_0xb084('0x17')](_0x3582a0)[_0xb084('0x18')]();};}function respondWithResult(_0x5bae3a,_0x4da0fb){_0x4da0fb=_0x4da0fb||0xc8;return function(_0x44be03){if(_0x44be03){return _0x5bae3a[_0xb084('0x17')](_0x4da0fb)[_0xb084('0x19')](_0x44be03);}};}function respondWithFilteredResult(_0x28ad2d,_0xc6df71){return function(_0x5a5d11){if(_0x5a5d11){var _0x240838=typeof _0xc6df71[_0xb084('0x1a')]===_0xb084('0x1b')&&typeof _0xc6df71[_0xb084('0x1c')]===_0xb084('0x1b');var _0x2cce88=_0x5a5d11[_0xb084('0x1d')];var _0x42657a=_0x240838?0x0:_0xc6df71[_0xb084('0x1a')];var _0x19d426=_0x240838?_0x5a5d11['count']:_0xc6df71['offset']+_0xc6df71['limit'];var _0x5b076b;if(_0x19d426>=_0x2cce88){_0x19d426=_0x2cce88;_0x5b076b=0xc8;}else{_0x5b076b=0xce;}_0x28ad2d[_0xb084('0x17')](_0x5b076b);return _0x28ad2d['set'](_0xb084('0x1e'),_0x42657a+'-'+_0x19d426+'/'+_0x2cce88)[_0xb084('0x19')](_0x5a5d11);}return null;};}function patchUpdates(_0x228ef1){return function(_0x2e8789){try{jsonpatch[_0xb084('0x1f')](_0x2e8789,_0x228ef1,!![]);}catch(_0x434690){return BPromise[_0xb084('0x20')](_0x434690);}return _0x2e8789[_0xb084('0x21')]();};}function saveUpdates(_0x517dc0,_0x5dfc7f){return function(_0x171dd5){if(_0x171dd5){return _0x171dd5[_0xb084('0x22')](_0x517dc0)[_0xb084('0x23')](function(_0x28d074){return _0x28d074;});}return null;};}function removeEntity(_0x5dced1,_0x4795d9){return function(_0x3ef50e){if(_0x3ef50e){return _0x3ef50e[_0xb084('0x24')]()['then'](function(){_0x5dced1[_0xb084('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4983,_0x22059f){return function(_0x5d9314){if(!_0x5d9314){_0x1f4983[_0xb084('0x25')](0x194);}return _0x5d9314;};}function handleError(_0x3d467e,_0x1ecb58){_0x1ecb58=_0x1ecb58||0x1f4;return function(_0x4ce54c){logger[_0xb084('0x26')](_0x4ce54c['stack']);if(_0x4ce54c[_0xb084('0x27')]){delete _0x4ce54c[_0xb084('0x27')];}_0x3d467e['status'](_0x1ecb58)[_0xb084('0x28')](_0x4ce54c);};}exports[_0xb084('0x29')]=function(_0x49cbd6,_0x4587e7){var _0x1a7726={},_0x57406f={},_0x1ad27b={'count':0x0,'rows':[]};var _0x2795cf=_['map'](db[_0xb084('0x2a')][_0xb084('0x2b')],function(_0x330a35){return{'name':_0x330a35[_0xb084('0x2c')],'type':_0x330a35[_0xb084('0x2d')]['key']};});_0x57406f[_0xb084('0x2e')]=_[_0xb084('0x2f')](_0x2795cf,_0xb084('0x27'));_0x57406f[_0xb084('0x30')]=_['keys'](_0x49cbd6[_0xb084('0x30')]);_0x57406f[_0xb084('0x31')]=_[_0xb084('0x32')](_0x57406f[_0xb084('0x2e')],_0x57406f[_0xb084('0x30')]);_0x1a7726['attributes']=_['intersection'](_0x57406f[_0xb084('0x2e')],qs['fields'](_0x49cbd6[_0xb084('0x30')]['fields']));_0x1a7726[_0xb084('0x33')]=_0x1a7726[_0xb084('0x33')][_0xb084('0x34')]?_0x1a7726[_0xb084('0x33')]:_0x57406f['model'];if(!_0x49cbd6[_0xb084('0x30')][_0xb084('0x35')](_0xb084('0x36'))){_0x1a7726[_0xb084('0x1c')]=qs[_0xb084('0x1c')](_0x49cbd6['query'][_0xb084('0x1c')]);_0x1a7726[_0xb084('0x1a')]=qs['offset'](_0x49cbd6['query'][_0xb084('0x1a')]);}_0x1a7726[_0xb084('0x37')]=qs[_0xb084('0x38')](_0x49cbd6[_0xb084('0x30')][_0xb084('0x38')]);_0x1a7726[_0xb084('0x39')]=qs[_0xb084('0x31')](_[_0xb084('0x3a')](_0x49cbd6['query'],_0x57406f[_0xb084('0x31')]),_0x2795cf);if(_0x49cbd6[_0xb084('0x30')]['filter']){_0x1a7726[_0xb084('0x39')]=_['merge'](_0x1a7726[_0xb084('0x39')],{'$or':_[_0xb084('0x2f')](_0x2795cf,function(_0xad9187){if(_0xad9187[_0xb084('0x2d')]!==_0xb084('0x3b')){var _0x2254a3={};_0x2254a3[_0xad9187[_0xb084('0x27')]]={'$like':'%'+_0x49cbd6[_0xb084('0x30')][_0xb084('0x3c')]+'%'};return _0x2254a3;}})});}_0x1a7726=_[_0xb084('0x3d')]({},_0x1a7726,_0x49cbd6[_0xb084('0x3e')]);var _0x77b2cc={'where':_0x1a7726[_0xb084('0x39')]};return db[_0xb084('0x2a')][_0xb084('0x1d')](_0x77b2cc)[_0xb084('0x23')](function(_0x584b34){_0x1ad27b['count']=_0x584b34;if(_0x49cbd6[_0xb084('0x30')][_0xb084('0x3f')]){_0x1a7726['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xb084('0x40')](_0x1a7726);})[_0xb084('0x23')](function(_0x1de365){_0x1ad27b['rows']=_0x1de365;return _0x1ad27b;})[_0xb084('0x23')](respondWithFilteredResult(_0x4587e7,_0x1a7726))[_0xb084('0x41')](handleError(_0x4587e7,null));};exports[_0xb084('0x42')]=function(_0x526c47,_0xc63ca9){var _0x13b059={'raw':!![],'where':{'id':_0x526c47[_0xb084('0x43')]['id']}},_0x3f38f9={};_0x3f38f9['model']=_[_0xb084('0x44')](db[_0xb084('0x2a')][_0xb084('0x2b')]);_0x3f38f9[_0xb084('0x30')]=_['keys'](_0x526c47[_0xb084('0x30')]);_0x3f38f9[_0xb084('0x31')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],_0x3f38f9[_0xb084('0x30')]);_0x13b059[_0xb084('0x33')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],qs[_0xb084('0x45')](_0x526c47[_0xb084('0x30')][_0xb084('0x45')]));_0x13b059[_0xb084('0x33')]=_0x13b059[_0xb084('0x33')][_0xb084('0x34')]?_0x13b059[_0xb084('0x33')]:_0x3f38f9['model'];if(_0x526c47[_0xb084('0x30')][_0xb084('0x3f')]){_0x13b059[_0xb084('0x46')]=[{'all':!![]}];}_0x13b059=_[_0xb084('0x3d')]({},_0x13b059,_0x526c47[_0xb084('0x3e')]);return db[_0xb084('0x2a')]['find'](_0x13b059)[_0xb084('0x23')](handleEntityNotFound(_0xc63ca9,null))[_0xb084('0x23')](respondWithResult(_0xc63ca9,null))[_0xb084('0x41')](handleError(_0xc63ca9,null));};exports[_0xb084('0x47')]=function(_0x1a95e4,_0x305f4a){return db[_0xb084('0x2a')]['create'](_0x1a95e4[_0xb084('0x48')],{})[_0xb084('0x23')](respondWithResult(_0x305f4a,0xc9))[_0xb084('0x41')](handleError(_0x305f4a,null));};exports[_0xb084('0x22')]=function(_0x32014e,_0xb1fdeb){if(_0x32014e[_0xb084('0x48')]['id']){delete _0x32014e[_0xb084('0x48')]['id'];}return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x32014e[_0xb084('0x43')]['id']}})['then'](handleEntityNotFound(_0xb1fdeb,null))[_0xb084('0x23')](saveUpdates(_0x32014e[_0xb084('0x48')],null))[_0xb084('0x23')](respondWithResult(_0xb1fdeb,null))[_0xb084('0x41')](handleError(_0xb1fdeb,null));};exports[_0xb084('0x24')]=function(_0x4bad1b,_0x2d5ebd){return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x4bad1b[_0xb084('0x43')]['id']}})[_0xb084('0x23')](handleEntityNotFound(_0x2d5ebd,null))[_0xb084('0x23')](removeEntity(_0x2d5ebd,null))[_0xb084('0x41')](handleError(_0x2d5ebd,null));};exports[_0xb084('0x4a')]=function(_0x2d9239,_0x557649){return db['ChatQueueReport']['describe']()[_0xb084('0x23')](respondWithResult(_0x557649,null))[_0xb084('0x41')](handleError(_0x557649,null));}; \ No newline at end of file +var _0x0760=['filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','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','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0x0760,0xa9));var _0x0076=function(_0xc7205a,_0x391d58){_0xc7205a=_0xc7205a-0x0;var _0x3d9c46=_0x0760[_0xc7205a];return _0x3d9c46;};'use strict';var emlformat=require(_0x0076('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0076('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0076('0x2'));var Mustache=require(_0x0076('0x3'));var util=require(_0x0076('0x4'));var path=require(_0x0076('0x5'));var sox=require(_0x0076('0x6'));var csv=require('to-csv');var ejs=require(_0x0076('0x7'));var fs=require('fs');var fs_extra=require(_0x0076('0x8'));var _=require(_0x0076('0x9'));var squel=require(_0x0076('0xa'));var crypto=require(_0x0076('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0076('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0076('0xd'));var Papa=require(_0x0076('0xe'));var Redis=require('ioredis');var authService=require(_0x0076('0xf'));var qs=require(_0x0076('0x10'));var as=require(_0x0076('0x11'));var hardwareService=require(_0x0076('0x12'));var logger=require(_0x0076('0x13'))(_0x0076('0x14'));var utils=require('../../config/utils');var config=require(_0x0076('0x15'));var licenseUtil=require(_0x0076('0x16'));var db=require(_0x0076('0x17'))['db'];function respondWithStatusCode(_0x328bbd,_0x3ecbde){_0x3ecbde=_0x3ecbde||0xcc;return function(_0x220e7d){if(_0x220e7d){return _0x328bbd[_0x0076('0x18')](_0x3ecbde);}return _0x328bbd[_0x0076('0x19')](_0x3ecbde)[_0x0076('0x1a')]();};}function respondWithResult(_0x3c790a,_0x379136){_0x379136=_0x379136||0xc8;return function(_0x5175c7){if(_0x5175c7){return _0x3c790a[_0x0076('0x19')](_0x379136)['json'](_0x5175c7);}};}function respondWithFilteredResult(_0x483ad0,_0x29915b){return function(_0x2a45c6){if(_0x2a45c6){var _0x4ce381=typeof _0x29915b[_0x0076('0x1b')]==='undefined'&&typeof _0x29915b[_0x0076('0x1c')]===_0x0076('0x1d');var _0x5a5623=_0x2a45c6['count'];var _0x5761a4=_0x4ce381?0x0:_0x29915b[_0x0076('0x1b')];var _0x30fb20=_0x4ce381?_0x2a45c6[_0x0076('0x1e')]:_0x29915b[_0x0076('0x1b')]+_0x29915b[_0x0076('0x1c')];var _0x371498;if(_0x30fb20>=_0x5a5623){_0x30fb20=_0x5a5623;_0x371498=0xc8;}else{_0x371498=0xce;}_0x483ad0[_0x0076('0x19')](_0x371498);return _0x483ad0[_0x0076('0x1f')](_0x0076('0x20'),_0x5761a4+'-'+_0x30fb20+'/'+_0x5a5623)[_0x0076('0x21')](_0x2a45c6);}return null;};}function patchUpdates(_0x274c52){return function(_0x1507d4){try{jsonpatch[_0x0076('0x22')](_0x1507d4,_0x274c52,!![]);}catch(_0x26b89c){return BPromise['reject'](_0x26b89c);}return _0x1507d4[_0x0076('0x23')]();};}function saveUpdates(_0x2a5619,_0x180391){return function(_0x58ee11){if(_0x58ee11){return _0x58ee11[_0x0076('0x24')](_0x2a5619)[_0x0076('0x25')](function(_0x2dd436){return _0x2dd436;});}return null;};}function removeEntity(_0x39bb13,_0x250f57){return function(_0x5b73ac){if(_0x5b73ac){return _0x5b73ac[_0x0076('0x26')]()[_0x0076('0x25')](function(){_0x39bb13[_0x0076('0x19')](0xcc)[_0x0076('0x1a')]();});}};}function handleEntityNotFound(_0x2c7def,_0x336661){return function(_0x59f20c){if(!_0x59f20c){_0x2c7def[_0x0076('0x18')](0x194);}return _0x59f20c;};}function handleError(_0x27c087,_0x1dbd77){_0x1dbd77=_0x1dbd77||0x1f4;return function(_0x187827){logger[_0x0076('0x27')](_0x187827['stack']);if(_0x187827[_0x0076('0x28')]){delete _0x187827[_0x0076('0x28')];}_0x27c087[_0x0076('0x19')](_0x1dbd77)[_0x0076('0x29')](_0x187827);};}exports[_0x0076('0x2a')]=function(_0xd4009d,_0x1635b7){var _0x332376={},_0x2bc8b7={},_0xca7c6c={'count':0x0,'rows':[]};var _0x4f6543=_[_0x0076('0x2b')](db[_0x0076('0x2c')][_0x0076('0x2d')],function(_0x1cfad4){return{'name':_0x1cfad4[_0x0076('0x2e')],'type':_0x1cfad4['type']['key']};});_0x2bc8b7[_0x0076('0x2f')]=_[_0x0076('0x2b')](_0x4f6543,_0x0076('0x28'));_0x2bc8b7[_0x0076('0x30')]=_['keys'](_0xd4009d['query']);_0x2bc8b7[_0x0076('0x31')]=_[_0x0076('0x32')](_0x2bc8b7[_0x0076('0x2f')],_0x2bc8b7['query']);_0x332376[_0x0076('0x33')]=_[_0x0076('0x32')](_0x2bc8b7[_0x0076('0x2f')],qs[_0x0076('0x34')](_0xd4009d[_0x0076('0x30')][_0x0076('0x34')]));_0x332376[_0x0076('0x33')]=_0x332376[_0x0076('0x33')][_0x0076('0x35')]?_0x332376[_0x0076('0x33')]:_0x2bc8b7[_0x0076('0x2f')];if(!_0xd4009d['query'][_0x0076('0x36')](_0x0076('0x37'))){_0x332376[_0x0076('0x1c')]=qs[_0x0076('0x1c')](_0xd4009d[_0x0076('0x30')][_0x0076('0x1c')]);_0x332376[_0x0076('0x1b')]=qs['offset'](_0xd4009d[_0x0076('0x30')][_0x0076('0x1b')]);}_0x332376[_0x0076('0x38')]=qs[_0x0076('0x39')](_0xd4009d['query'][_0x0076('0x39')]);_0x332376['where']=qs[_0x0076('0x31')](_[_0x0076('0x3a')](_0xd4009d[_0x0076('0x30')],_0x2bc8b7[_0x0076('0x31')]),_0x4f6543);if(_0xd4009d[_0x0076('0x30')][_0x0076('0x3b')]){_0x332376[_0x0076('0x3c')]=_[_0x0076('0x3d')](_0x332376[_0x0076('0x3c')],{'$or':_[_0x0076('0x2b')](_0x4f6543,function(_0x201366){if(_0x201366[_0x0076('0x3e')]!==_0x0076('0x3f')){var _0x5843e6={};_0x5843e6[_0x201366[_0x0076('0x28')]]={'$like':'%'+_0xd4009d[_0x0076('0x30')][_0x0076('0x3b')]+'%'};return _0x5843e6;}})});}_0x332376=_[_0x0076('0x3d')]({},_0x332376,_0xd4009d[_0x0076('0x40')]);var _0x3d2d82={'where':_0x332376['where']};return db[_0x0076('0x2c')]['count'](_0x3d2d82)[_0x0076('0x25')](function(_0x4f58d0){_0xca7c6c[_0x0076('0x1e')]=_0x4f58d0;if(_0xd4009d[_0x0076('0x30')][_0x0076('0x41')]){_0x332376['include']=[{'all':!![]}];}return db[_0x0076('0x2c')][_0x0076('0x42')](_0x332376);})['then'](function(_0x408b7b){_0xca7c6c[_0x0076('0x43')]=_0x408b7b;return _0xca7c6c;})[_0x0076('0x25')](respondWithFilteredResult(_0x1635b7,_0x332376))[_0x0076('0x44')](handleError(_0x1635b7,null));};exports[_0x0076('0x45')]=function(_0x382ae5,_0x1cefec){var _0xd40131={'raw':!![],'where':{'id':_0x382ae5[_0x0076('0x46')]['id']}},_0x157d6f={};_0x157d6f[_0x0076('0x2f')]=_[_0x0076('0x47')](db[_0x0076('0x2c')][_0x0076('0x2d')]);_0x157d6f[_0x0076('0x30')]=_['keys'](_0x382ae5[_0x0076('0x30')]);_0x157d6f[_0x0076('0x31')]=_[_0x0076('0x32')](_0x157d6f[_0x0076('0x2f')],_0x157d6f['query']);_0xd40131[_0x0076('0x33')]=_[_0x0076('0x32')](_0x157d6f[_0x0076('0x2f')],qs[_0x0076('0x34')](_0x382ae5['query']['fields']));_0xd40131[_0x0076('0x33')]=_0xd40131[_0x0076('0x33')]['length']?_0xd40131[_0x0076('0x33')]:_0x157d6f[_0x0076('0x2f')];if(_0x382ae5['query'][_0x0076('0x41')]){_0xd40131['include']=[{'all':!![]}];}_0xd40131=_[_0x0076('0x3d')]({},_0xd40131,_0x382ae5[_0x0076('0x40')]);return db[_0x0076('0x2c')][_0x0076('0x48')](_0xd40131)[_0x0076('0x25')](handleEntityNotFound(_0x1cefec,null))['then'](respondWithResult(_0x1cefec,null))[_0x0076('0x44')](handleError(_0x1cefec,null));};exports[_0x0076('0x49')]=function(_0x3087c7,_0x43b1dc){return db[_0x0076('0x2c')][_0x0076('0x49')](_0x3087c7['body'],{})[_0x0076('0x25')](respondWithResult(_0x43b1dc,0xc9))['catch'](handleError(_0x43b1dc,null));};exports[_0x0076('0x24')]=function(_0x5bfdf8,_0xb09053){if(_0x5bfdf8[_0x0076('0x4a')]['id']){delete _0x5bfdf8[_0x0076('0x4a')]['id'];}return db['ChatQueueReport'][_0x0076('0x48')]({'where':{'id':_0x5bfdf8[_0x0076('0x46')]['id']}})[_0x0076('0x25')](handleEntityNotFound(_0xb09053,null))['then'](saveUpdates(_0x5bfdf8[_0x0076('0x4a')],null))[_0x0076('0x25')](respondWithResult(_0xb09053,null))['catch'](handleError(_0xb09053,null));};exports[_0x0076('0x26')]=function(_0x129e5c,_0x3ad9c8){return db[_0x0076('0x2c')]['find']({'where':{'id':_0x129e5c[_0x0076('0x46')]['id']}})[_0x0076('0x25')](handleEntityNotFound(_0x3ad9c8,null))[_0x0076('0x25')](removeEntity(_0x3ad9c8,null))[_0x0076('0x44')](handleError(_0x3ad9c8,null));};exports[_0x0076('0x4b')]=function(_0x2163c6,_0x53a424){return db[_0x0076('0x2c')][_0x0076('0x4b')]()['then'](respondWithResult(_0x53a424,null))[_0x0076('0x44')](handleError(_0x53a424,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3240e58..3370d9d 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x421879,_0x4a00c2){var _0x3bec6f=function(_0x338e76){while(--_0x338e76){_0x421879['push'](_0x421879['shift']());}};_0x3bec6f(++_0x4a00c2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb7e7[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x29f258,_0x559572){var _0x1315c7=function(_0x140cde){while(--_0x140cde){_0x29f258['push'](_0x29f258['shift']());}};_0x1315c7(++_0x559572);}(_0xe706,0xa3));var _0x6e70=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xe706[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c2828a8..9fc03df 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 _0xc67c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x426854,_0xb8fb57){var _0x1f0aea=function(_0x124dba){while(--_0x124dba){_0x426854['push'](_0x426854['shift']());}};_0x1f0aea(++_0xb8fb57);}(_0xc67c,0x17b));var _0xcc67=function(_0x7b60c7,_0x50a43c){_0x7b60c7=_0x7b60c7-0x0;var _0x533781=_0xc67c[_0x7b60c7];return _0x533781;};'use strict';var _=require(_0xcc67('0x0'));var util=require(_0xcc67('0x1'));var moment=require(_0xcc67('0x2'));var BPromise=require(_0xcc67('0x3'));var rs=require(_0xcc67('0x4'));var fs=require('fs');var Redis=require(_0xcc67('0x5'));var db=require(_0xcc67('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc67('0x7'))(_0xcc67('0x8'));var config=require(_0xcc67('0x9'));var jayson=require(_0xcc67('0xa'));var client=jayson[_0xcc67('0xb')][_0xcc67('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xac838d,_0x2cb2da,_0x46b9a5){return new BPromise(function(_0x5d0c1d,_0x92d497){return client[_0xcc67('0xd')](_0xac838d,_0x46b9a5)['then'](function(_0x18282d){logger[_0xcc67('0xe')](_0xcc67('0xf'),_0x2cb2da,_0xcc67('0x10'));logger[_0xcc67('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x2cb2da,_0xcc67('0x10'),JSON[_0xcc67('0x12')](_0x18282d));if(_0x18282d[_0xcc67('0x13')]){if(_0x18282d[_0xcc67('0x13')]['code']===0x1f4){logger['error'](_0xcc67('0xf'),_0x2cb2da,_0x18282d[_0xcc67('0x13')][_0xcc67('0x14')]);return _0x92d497(_0x18282d['error'][_0xcc67('0x14')]);}logger[_0xcc67('0x13')](_0xcc67('0xf'),_0x2cb2da,_0x18282d['error'][_0xcc67('0x14')]);return _0x5d0c1d(_0x18282d[_0xcc67('0x13')][_0xcc67('0x14')]);}else{logger[_0xcc67('0xe')](_0xcc67('0xf'),_0x2cb2da,_0xcc67('0x10'));_0x5d0c1d(_0x18282d[_0xcc67('0x15')][_0xcc67('0x14')]);}})[_0xcc67('0x16')](function(_0x4c09dc){logger[_0xcc67('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x2cb2da,_0x4c09dc);_0x92d497(_0x4c09dc);});});}exports[_0xcc67('0x17')]=function(_0x57c1d6){var _0x153737=this;return new Promise(function(_0x26453c,_0x423bd8){return db['ChatQueueReport'][_0xcc67('0x18')](_0x57c1d6[_0xcc67('0x19')],{'raw':_0x57c1d6[_0xcc67('0x1a')]?_0x57c1d6[_0xcc67('0x1a')][_0xcc67('0x1b')]===undefined?!![]:![]:!![]})[_0xcc67('0x1c')](function(_0x617e7b){logger[_0xcc67('0xe')](_0xcc67('0x17'),_0x57c1d6);logger[_0xcc67('0x11')]('CreateChatQueueReport',_0x57c1d6,JSON[_0xcc67('0x12')](_0x617e7b));_0x26453c(_0x617e7b);})['catch'](function(_0x12b59a){logger[_0xcc67('0x13')]('CreateChatQueueReport',_0x12b59a[_0xcc67('0x14')],_0x57c1d6);_0x423bd8(_0x153737[_0xcc67('0x13')](0x1f4,_0x12b59a[_0xcc67('0x14')]));});});};exports[_0xcc67('0x1d')]=function(_0x1dfe93){var _0x91da96=this;return new Promise(function(_0x23bea2,_0x4c6b30){return db[_0xcc67('0x1e')][_0xcc67('0x1f')](_0x1dfe93[_0xcc67('0x19')],{'raw':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93['options'][_0xcc67('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93[_0xcc67('0x1a')][_0xcc67('0x20')]||null:null,'attributes':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93[_0xcc67('0x1a')][_0xcc67('0x21')]||null:null,'limit':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93['options'][_0xcc67('0x22')]||null:null})[_0xcc67('0x1c')](function(_0x274b84){logger[_0xcc67('0xe')](_0xcc67('0x1d'),_0x1dfe93);logger['debug'](_0xcc67('0x1d'),_0x1dfe93,JSON[_0xcc67('0x12')](_0x274b84));_0x23bea2(_0x274b84);})['catch'](function(_0x24dbde){logger[_0xcc67('0x13')](_0xcc67('0x1d'),_0x24dbde[_0xcc67('0x14')],_0x1dfe93);_0x4c6b30(_0x91da96[_0xcc67('0x13')](0x1f4,_0x24dbde[_0xcc67('0x14')]));});});}; \ No newline at end of file +var _0xcfe7=['catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4309a3,_0x3bd92e){var _0x177e17=function(_0x22d50c){while(--_0x22d50c){_0x4309a3['push'](_0x4309a3['shift']());}};_0x177e17(++_0x3bd92e);}(_0xcfe7,0xfb));var _0x7cfe=function(_0x434f59,_0x378741){_0x434f59=_0x434f59-0x0;var _0x278aae=_0xcfe7[_0x434f59];return _0x278aae;};'use strict';var _=require(_0x7cfe('0x0'));var util=require(_0x7cfe('0x1'));var moment=require('moment');var BPromise=require(_0x7cfe('0x2'));var rs=require(_0x7cfe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cfe('0x4'))['db'];var utils=require(_0x7cfe('0x5'));var logger=require(_0x7cfe('0x6'))('rpc');var config=require(_0x7cfe('0x7'));var jayson=require(_0x7cfe('0x8'));var client=jayson[_0x7cfe('0x9')][_0x7cfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c37ce,_0x597f0f,_0x1bed96){return new BPromise(function(_0x1ad64e,_0x25a247){return client[_0x7cfe('0xb')](_0x1c37ce,_0x1bed96)[_0x7cfe('0xc')](function(_0x389f8f){logger['info'](_0x7cfe('0xd'),_0x597f0f,_0x7cfe('0xe'));logger[_0x7cfe('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x597f0f,'request\x20sent',JSON[_0x7cfe('0x10')](_0x389f8f));if(_0x389f8f[_0x7cfe('0x11')]){if(_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x12')]===0x1f4){logger[_0x7cfe('0x11')](_0x7cfe('0xd'),_0x597f0f,_0x389f8f['error']['message']);return _0x25a247(_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x13')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x597f0f,_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x13')]);return _0x1ad64e(_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x13')]);}else{logger['info'](_0x7cfe('0xd'),_0x597f0f,_0x7cfe('0xe'));_0x1ad64e(_0x389f8f[_0x7cfe('0x14')][_0x7cfe('0x13')]);}})[_0x7cfe('0x15')](function(_0x1c82db){logger[_0x7cfe('0x11')](_0x7cfe('0xd'),_0x597f0f,_0x1c82db);_0x25a247(_0x1c82db);});});}exports[_0x7cfe('0x16')]=function(_0x3694e1){var _0x435b3d=this;return new Promise(function(_0x338e21,_0x2899fc){return db[_0x7cfe('0x17')][_0x7cfe('0x18')](_0x3694e1[_0x7cfe('0x19')],{'raw':_0x3694e1[_0x7cfe('0x1a')]?_0x3694e1['options'][_0x7cfe('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3568ed){logger['info'](_0x7cfe('0x16'),_0x3694e1);logger[_0x7cfe('0xf')](_0x7cfe('0x16'),_0x3694e1,JSON[_0x7cfe('0x10')](_0x3568ed));_0x338e21(_0x3568ed);})[_0x7cfe('0x15')](function(_0x4ac7a8){logger[_0x7cfe('0x11')](_0x7cfe('0x16'),_0x4ac7a8['message'],_0x3694e1);_0x2899fc(_0x435b3d['error'](0x1f4,_0x4ac7a8[_0x7cfe('0x13')]));});});};exports[_0x7cfe('0x1c')]=function(_0x31977d){var _0x4109f8=this;return new Promise(function(_0x3a1ee1,_0x18e600){return db[_0x7cfe('0x17')][_0x7cfe('0x1d')](_0x31977d['body'],{'raw':_0x31977d[_0x7cfe('0x1a')]?_0x31977d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31977d['options']?_0x31977d[_0x7cfe('0x1a')][_0x7cfe('0x1e')]||null:null,'attributes':_0x31977d['options']?_0x31977d['options'][_0x7cfe('0x1f')]||null:null,'limit':_0x31977d['options']?_0x31977d['options'][_0x7cfe('0x20')]||null:null})[_0x7cfe('0xc')](function(_0x4dd717){logger[_0x7cfe('0x21')](_0x7cfe('0x1c'),_0x31977d);logger[_0x7cfe('0xf')](_0x7cfe('0x1c'),_0x31977d,JSON['stringify'](_0x4dd717));_0x3a1ee1(_0x4dd717);})[_0x7cfe('0x15')](function(_0x2f801d){logger[_0x7cfe('0x11')](_0x7cfe('0x1c'),_0x2f801d['message'],_0x31977d);_0x18e600(_0x4109f8[_0x7cfe('0x11')](0x1f4,_0x2f801d[_0x7cfe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a751dd1..40a8abe 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 _0x0629=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x0629,0xee));var _0x9062=function(_0x5e70a6,_0x31169f){_0x5e70a6=_0x5e70a6-0x0;var _0xd1a237=_0x0629[_0x5e70a6];return _0xd1a237;};'use strict';var multer=require(_0x9062('0x0'));var util=require(_0x9062('0x1'));var path=require(_0x9062('0x2'));var timeout=require(_0x9062('0x3'));var express=require(_0x9062('0x4'));var router=express[_0x9062('0x5')]();var fs_extra=require(_0x9062('0x6'));var auth=require(_0x9062('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9062('0x8'));var controller=require(_0x9062('0x9'));router[_0x9062('0xa')]('/',auth[_0x9062('0xb')](),controller[_0x9062('0xc')]);router[_0x9062('0xa')](_0x9062('0xd'),auth[_0x9062('0xb')](),controller[_0x9062('0xe')]);router[_0x9062('0xa')]('/:id',auth[_0x9062('0xb')](),controller['show']);router[_0x9062('0xf')]('/',auth[_0x9062('0xb')](),controller[_0x9062('0x10')]);router[_0x9062('0x11')](_0x9062('0x12'),auth[_0x9062('0xb')](),controller[_0x9062('0x13')]);router[_0x9062('0x14')]('/:id',auth[_0x9062('0xb')](),controller[_0x9062('0x15')]);module[_0x9062('0x16')]=router; \ No newline at end of file +var _0x315b=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x315b,0x152));var _0xb315=function(_0x4f46a3,_0x1bf5a8){_0x4f46a3=_0x4f46a3-0x0;var _0x3d3d5a=_0x315b[_0x4f46a3];return _0x3d3d5a;};'use strict';var multer=require(_0xb315('0x0'));var util=require(_0xb315('0x1'));var path=require(_0xb315('0x2'));var timeout=require(_0xb315('0x3'));var express=require(_0xb315('0x4'));var router=express[_0xb315('0x5')]();var fs_extra=require(_0xb315('0x6'));var auth=require(_0xb315('0x7'));var interaction=require(_0xb315('0x8'));var config=require(_0xb315('0x9'));var controller=require(_0xb315('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xb315('0xb')]);router[_0xb315('0xc')](_0xb315('0xd'),auth[_0xb315('0xe')](),controller[_0xb315('0xf')]);router[_0xb315('0xc')](_0xb315('0x10'),auth[_0xb315('0xe')](),controller[_0xb315('0x11')]);router['post']('/',auth[_0xb315('0xe')](),controller[_0xb315('0x12')]);router[_0xb315('0x13')](_0xb315('0x10'),auth['isAuthenticated'](),controller[_0xb315('0x14')]);router[_0xb315('0x15')](_0xb315('0x10'),auth[_0xb315('0xe')](),controller[_0xb315('0x16')]);module[_0xb315('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 894e684..94102c0 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x385f81,_0x394333){var _0x390b9e=function(_0x5541b7){while(--_0x5541b7){_0x385f81['push'](_0x385f81['shift']());}};_0x390b9e(++_0x394333);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x55e830,_0x56fabd){var _0x488d1b=function(_0x57e02a){while(--_0x57e02a){_0x55e830['push'](_0x55e830['shift']());}};_0x488d1b(++_0x56fabd);}(_0xedd9,0xfc));var _0x9edd=function(_0x33e3f5,_0x18089b){_0x33e3f5=_0x33e3f5-0x0;var _0x216001=_0xedd9[_0x33e3f5];return _0x216001;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5227b9d..70045ad 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 _0x4e06=['offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','params','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','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'];(function(_0x3902b8,_0x4b013a){var _0x345127=function(_0x333616){while(--_0x333616){_0x3902b8['push'](_0x3902b8['shift']());}};_0x345127(++_0x4b013a);}(_0x4e06,0x76));var _0x64e0=function(_0x278f0e,_0x107e6e){_0x278f0e=_0x278f0e-0x0;var _0x5b8c27=_0x4e06[_0x278f0e];return _0x5b8c27;};'use strict';var emlformat=require(_0x64e0('0x0'));var rimraf=require(_0x64e0('0x1'));var zipdir=require(_0x64e0('0x2'));var jsonpatch=require(_0x64e0('0x3'));var rp=require('request-promise');var moment=require(_0x64e0('0x4'));var BPromise=require(_0x64e0('0x5'));var Mustache=require(_0x64e0('0x6'));var util=require(_0x64e0('0x7'));var path=require(_0x64e0('0x8'));var sox=require(_0x64e0('0x9'));var csv=require(_0x64e0('0xa'));var ejs=require(_0x64e0('0xb'));var fs=require('fs');var fs_extra=require(_0x64e0('0xc'));var _=require(_0x64e0('0xd'));var squel=require('squel');var crypto=require(_0x64e0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x64e0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x64e0('0x10'));var authService=require(_0x64e0('0x11'));var qs=require(_0x64e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64e0('0x13'));var logger=require(_0x64e0('0x14'))(_0x64e0('0x15'));var utils=require(_0x64e0('0x16'));var config=require(_0x64e0('0x17'));var licenseUtil=require(_0x64e0('0x18'));var db=require(_0x64e0('0x19'))['db'];function respondWithStatusCode(_0x1a943b,_0x417c95){_0x417c95=_0x417c95||0xcc;return function(_0x25bc9d){if(_0x25bc9d){return _0x1a943b[_0x64e0('0x1a')](_0x417c95);}return _0x1a943b[_0x64e0('0x1b')](_0x417c95)[_0x64e0('0x1c')]();};}function respondWithResult(_0x3d52bb,_0x698c25){_0x698c25=_0x698c25||0xc8;return function(_0x305f79){if(_0x305f79){return _0x3d52bb[_0x64e0('0x1b')](_0x698c25)[_0x64e0('0x1d')](_0x305f79);}};}function respondWithFilteredResult(_0x18c03d,_0x162dcf){return function(_0x1c2b95){if(_0x1c2b95){var _0x105908=typeof _0x162dcf[_0x64e0('0x1e')]===_0x64e0('0x1f')&&typeof _0x162dcf[_0x64e0('0x20')]===_0x64e0('0x1f');var _0x4c635c=_0x1c2b95['count'];var _0x4d3418=_0x105908?0x0:_0x162dcf[_0x64e0('0x1e')];var _0x30991f=_0x105908?_0x1c2b95[_0x64e0('0x21')]:_0x162dcf['offset']+_0x162dcf[_0x64e0('0x20')];var _0x35bdce;if(_0x30991f>=_0x4c635c){_0x30991f=_0x4c635c;_0x35bdce=0xc8;}else{_0x35bdce=0xce;}_0x18c03d['status'](_0x35bdce);return _0x18c03d[_0x64e0('0x22')](_0x64e0('0x23'),_0x4d3418+'-'+_0x30991f+'/'+_0x4c635c)['json'](_0x1c2b95);}return null;};}function patchUpdates(_0x218979){return function(_0x52a546){try{jsonpatch['apply'](_0x52a546,_0x218979,!![]);}catch(_0x54eb5b){return BPromise[_0x64e0('0x24')](_0x54eb5b);}return _0x52a546[_0x64e0('0x25')]();};}function saveUpdates(_0x4456d4,_0x908d24){return function(_0x587d42){if(_0x587d42){return _0x587d42['update'](_0x4456d4)[_0x64e0('0x26')](function(_0x3dac28){return _0x3dac28;});}return null;};}function removeEntity(_0xd71736,_0x228977){return function(_0x1ea4c6){if(_0x1ea4c6){return _0x1ea4c6[_0x64e0('0x27')]()[_0x64e0('0x26')](function(){_0xd71736['status'](0xcc)[_0x64e0('0x1c')]();});}};}function handleEntityNotFound(_0x5c0ecc,_0x4ba4bf){return function(_0x59981a){if(!_0x59981a){_0x5c0ecc[_0x64e0('0x1a')](0x194);}return _0x59981a;};}function handleError(_0x6f5c39,_0x4f7b0a){_0x4f7b0a=_0x4f7b0a||0x1f4;return function(_0x2e8ab4){logger[_0x64e0('0x28')](_0x2e8ab4['stack']);if(_0x2e8ab4[_0x64e0('0x29')]){delete _0x2e8ab4[_0x64e0('0x29')];}_0x6f5c39[_0x64e0('0x1b')](_0x4f7b0a)[_0x64e0('0x2a')](_0x2e8ab4);};}exports[_0x64e0('0x2b')]=function(_0x222a62,_0x1d2486){var _0x2e1406={},_0x5a06f5={},_0xcecffb={'count':0x0,'rows':[]};var _0x591459=_[_0x64e0('0x2c')](db[_0x64e0('0x2d')][_0x64e0('0x2e')],function(_0x24f30c){return{'name':_0x24f30c[_0x64e0('0x2f')],'type':_0x24f30c[_0x64e0('0x30')]['key']};});_0x5a06f5[_0x64e0('0x31')]=_[_0x64e0('0x2c')](_0x591459,_0x64e0('0x29'));_0x5a06f5[_0x64e0('0x32')]=_[_0x64e0('0x33')](_0x222a62[_0x64e0('0x32')]);_0x5a06f5['filters']=_[_0x64e0('0x34')](_0x5a06f5[_0x64e0('0x31')],_0x5a06f5[_0x64e0('0x32')]);_0x2e1406[_0x64e0('0x35')]=_[_0x64e0('0x34')](_0x5a06f5[_0x64e0('0x31')],qs[_0x64e0('0x36')](_0x222a62[_0x64e0('0x32')][_0x64e0('0x36')]));_0x2e1406[_0x64e0('0x35')]=_0x2e1406[_0x64e0('0x35')][_0x64e0('0x37')]?_0x2e1406[_0x64e0('0x35')]:_0x5a06f5[_0x64e0('0x31')];if(!_0x222a62[_0x64e0('0x32')]['hasOwnProperty']('nolimit')){_0x2e1406[_0x64e0('0x20')]=qs['limit'](_0x222a62[_0x64e0('0x32')][_0x64e0('0x20')]);_0x2e1406[_0x64e0('0x1e')]=qs[_0x64e0('0x1e')](_0x222a62[_0x64e0('0x32')][_0x64e0('0x1e')]);}_0x2e1406[_0x64e0('0x38')]=qs[_0x64e0('0x39')](_0x222a62[_0x64e0('0x32')][_0x64e0('0x39')]);_0x2e1406[_0x64e0('0x3a')]=qs[_0x64e0('0x3b')](_[_0x64e0('0x3c')](_0x222a62[_0x64e0('0x32')],_0x5a06f5['filters']),_0x591459);if(_0x222a62[_0x64e0('0x32')]['filter']){_0x2e1406['where']=_[_0x64e0('0x3d')](_0x2e1406['where'],{'$or':_[_0x64e0('0x2c')](_0x591459,function(_0x353d89){if(_0x353d89[_0x64e0('0x30')]!==_0x64e0('0x3e')){var _0x3d000a={};_0x3d000a[_0x353d89[_0x64e0('0x29')]]={'$like':'%'+_0x222a62[_0x64e0('0x32')][_0x64e0('0x3f')]+'%'};return _0x3d000a;}})});}_0x2e1406=_[_0x64e0('0x3d')]({},_0x2e1406,_0x222a62[_0x64e0('0x40')]);var _0x7684ae={'where':_0x2e1406[_0x64e0('0x3a')]};return db[_0x64e0('0x2d')][_0x64e0('0x21')](_0x7684ae)[_0x64e0('0x26')](function(_0x5da451){_0xcecffb[_0x64e0('0x21')]=_0x5da451;if(_0x222a62[_0x64e0('0x32')][_0x64e0('0x41')]){_0x2e1406[_0x64e0('0x42')]=[{'all':!![]}];}return db[_0x64e0('0x2d')]['findAll'](_0x2e1406);})['then'](function(_0x30b56d){_0xcecffb['rows']=_0x30b56d;return _0xcecffb;})[_0x64e0('0x26')](respondWithFilteredResult(_0x1d2486,_0x2e1406))['catch'](handleError(_0x1d2486,null));};exports['show']=function(_0x170d99,_0x155c7a){var _0x1a2f89={'raw':!![],'where':{'id':_0x170d99[_0x64e0('0x43')]['id']}},_0x52600d={};_0x52600d[_0x64e0('0x31')]=_['keys'](db[_0x64e0('0x2d')][_0x64e0('0x2e')]);_0x52600d[_0x64e0('0x32')]=_[_0x64e0('0x33')](_0x170d99[_0x64e0('0x32')]);_0x52600d['filters']=_[_0x64e0('0x34')](_0x52600d[_0x64e0('0x31')],_0x52600d['query']);_0x1a2f89[_0x64e0('0x35')]=_[_0x64e0('0x34')](_0x52600d['model'],qs[_0x64e0('0x36')](_0x170d99['query']['fields']));_0x1a2f89[_0x64e0('0x35')]=_0x1a2f89[_0x64e0('0x35')]['length']?_0x1a2f89['attributes']:_0x52600d[_0x64e0('0x31')];if(_0x170d99[_0x64e0('0x32')]['includeAll']){_0x1a2f89[_0x64e0('0x42')]=[{'all':!![]}];}_0x1a2f89=_[_0x64e0('0x3d')]({},_0x1a2f89,_0x170d99[_0x64e0('0x40')]);return db[_0x64e0('0x2d')]['find'](_0x1a2f89)[_0x64e0('0x26')](handleEntityNotFound(_0x155c7a,null))[_0x64e0('0x26')](respondWithResult(_0x155c7a,null))[_0x64e0('0x44')](handleError(_0x155c7a,null));};exports['create']=function(_0x2f3a04,_0x228197){return db[_0x64e0('0x2d')][_0x64e0('0x45')](_0x2f3a04[_0x64e0('0x46')],{})['then'](respondWithResult(_0x228197,0xc9))[_0x64e0('0x44')](handleError(_0x228197,null));};exports[_0x64e0('0x47')]=function(_0x1e4cd6,_0x5dbd6f){if(_0x1e4cd6[_0x64e0('0x46')]['id']){delete _0x1e4cd6[_0x64e0('0x46')]['id'];}return db['ChatTransferReport'][_0x64e0('0x48')]({'where':{'id':_0x1e4cd6[_0x64e0('0x43')]['id']}})[_0x64e0('0x26')](handleEntityNotFound(_0x5dbd6f,null))[_0x64e0('0x26')](saveUpdates(_0x1e4cd6[_0x64e0('0x46')],null))[_0x64e0('0x26')](respondWithResult(_0x5dbd6f,null))[_0x64e0('0x44')](handleError(_0x5dbd6f,null));};exports[_0x64e0('0x27')]=function(_0x473b70,_0x10fa8a){return db[_0x64e0('0x2d')][_0x64e0('0x48')]({'where':{'id':_0x473b70['params']['id']}})[_0x64e0('0x26')](handleEntityNotFound(_0x10fa8a,null))[_0x64e0('0x26')](removeEntity(_0x10fa8a,null))[_0x64e0('0x44')](handleError(_0x10fa8a,null));};exports[_0x64e0('0x49')]=function(_0x3447f1,_0x2cf2c5){return db[_0x64e0('0x2d')]['describe']()[_0x64e0('0x26')](respondWithResult(_0x2cf2c5,null))[_0x64e0('0x44')](handleError(_0x2cf2c5,null));}; \ No newline at end of file +var _0xd25d=['moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x67455f,_0x5930fb){var _0x1201b7=function(_0xe6bf5a){while(--_0xe6bf5a){_0x67455f['push'](_0x67455f['shift']());}};_0x1201b7(++_0x5930fb);}(_0xd25d,0x19f));var _0xdd25=function(_0xeb4ca4,_0x5736d5){_0xeb4ca4=_0xeb4ca4-0x0;var _0x495b68=_0xd25d[_0xeb4ca4];return _0x495b68;};'use strict';var emlformat=require(_0xdd25('0x0'));var rimraf=require(_0xdd25('0x1'));var zipdir=require(_0xdd25('0x2'));var jsonpatch=require(_0xdd25('0x3'));var rp=require(_0xdd25('0x4'));var moment=require(_0xdd25('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdd25('0x6'));var util=require(_0xdd25('0x7'));var path=require(_0xdd25('0x8'));var sox=require(_0xdd25('0x9'));var csv=require(_0xdd25('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd25('0xb'));var _=require(_0xdd25('0xc'));var squel=require('squel');var crypto=require(_0xdd25('0xd'));var jsforce=require(_0xdd25('0xe'));var deskjs=require(_0xdd25('0xf'));var toCsv=require(_0xdd25('0xa'));var querystring=require(_0xdd25('0x10'));var Papa=require(_0xdd25('0x11'));var Redis=require(_0xdd25('0x12'));var authService=require(_0xdd25('0x13'));var qs=require(_0xdd25('0x14'));var as=require(_0xdd25('0x15'));var hardwareService=require(_0xdd25('0x16'));var logger=require(_0xdd25('0x17'))(_0xdd25('0x18'));var utils=require(_0xdd25('0x19'));var config=require(_0xdd25('0x1a'));var licenseUtil=require(_0xdd25('0x1b'));var db=require(_0xdd25('0x1c'))['db'];function respondWithStatusCode(_0x288df4,_0x3512e3){_0x3512e3=_0x3512e3||0xcc;return function(_0x17893a){if(_0x17893a){return _0x288df4[_0xdd25('0x1d')](_0x3512e3);}return _0x288df4['status'](_0x3512e3)[_0xdd25('0x1e')]();};}function respondWithResult(_0x5bd45d,_0x1d05bf){_0x1d05bf=_0x1d05bf||0xc8;return function(_0x1a3575){if(_0x1a3575){return _0x5bd45d[_0xdd25('0x1f')](_0x1d05bf)[_0xdd25('0x20')](_0x1a3575);}};}function respondWithFilteredResult(_0x333627,_0x596bd5){return function(_0x1bf2b1){if(_0x1bf2b1){var _0x5d31e0=typeof _0x596bd5[_0xdd25('0x21')]===_0xdd25('0x22')&&typeof _0x596bd5[_0xdd25('0x23')]===_0xdd25('0x22');var _0x4c0036=_0x1bf2b1[_0xdd25('0x24')];var _0x4b4d8f=_0x5d31e0?0x0:_0x596bd5[_0xdd25('0x21')];var _0x50f9e9=_0x5d31e0?_0x1bf2b1[_0xdd25('0x24')]:_0x596bd5['offset']+_0x596bd5[_0xdd25('0x23')];var _0x181904;if(_0x50f9e9>=_0x4c0036){_0x50f9e9=_0x4c0036;_0x181904=0xc8;}else{_0x181904=0xce;}_0x333627['status'](_0x181904);return _0x333627[_0xdd25('0x25')](_0xdd25('0x26'),_0x4b4d8f+'-'+_0x50f9e9+'/'+_0x4c0036)[_0xdd25('0x20')](_0x1bf2b1);}return null;};}function patchUpdates(_0x190a45){return function(_0x2f0f06){try{jsonpatch[_0xdd25('0x27')](_0x2f0f06,_0x190a45,!![]);}catch(_0x5563c0){return BPromise[_0xdd25('0x28')](_0x5563c0);}return _0x2f0f06[_0xdd25('0x29')]();};}function saveUpdates(_0x3dab01,_0x5642b6){return function(_0x323df2){if(_0x323df2){return _0x323df2[_0xdd25('0x2a')](_0x3dab01)[_0xdd25('0x2b')](function(_0x599bdd){return _0x599bdd;});}return null;};}function removeEntity(_0x25835a,_0x2b3047){return function(_0x354bcf){if(_0x354bcf){return _0x354bcf[_0xdd25('0x2c')]()[_0xdd25('0x2b')](function(){_0x25835a[_0xdd25('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5af086,_0x3fd611){return function(_0x4a980c){if(!_0x4a980c){_0x5af086[_0xdd25('0x1d')](0x194);}return _0x4a980c;};}function handleError(_0x1f0fd8,_0x2557cc){_0x2557cc=_0x2557cc||0x1f4;return function(_0x1866cb){logger[_0xdd25('0x2d')](_0x1866cb[_0xdd25('0x2e')]);if(_0x1866cb[_0xdd25('0x2f')]){delete _0x1866cb['name'];}_0x1f0fd8[_0xdd25('0x1f')](_0x2557cc)[_0xdd25('0x30')](_0x1866cb);};}exports[_0xdd25('0x31')]=function(_0x4a3298,_0x3be342){var _0x28edcf={},_0x19dc18={},_0xb9a760={'count':0x0,'rows':[]};var _0xe15ac3=_[_0xdd25('0x32')](db[_0xdd25('0x33')]['rawAttributes'],function(_0x14cfa0){return{'name':_0x14cfa0[_0xdd25('0x34')],'type':_0x14cfa0['type'][_0xdd25('0x35')]};});_0x19dc18[_0xdd25('0x36')]=_[_0xdd25('0x32')](_0xe15ac3,_0xdd25('0x2f'));_0x19dc18[_0xdd25('0x37')]=_['keys'](_0x4a3298[_0xdd25('0x37')]);_0x19dc18['filters']=_[_0xdd25('0x38')](_0x19dc18[_0xdd25('0x36')],_0x19dc18['query']);_0x28edcf[_0xdd25('0x39')]=_[_0xdd25('0x38')](_0x19dc18[_0xdd25('0x36')],qs[_0xdd25('0x3a')](_0x4a3298['query'][_0xdd25('0x3a')]));_0x28edcf[_0xdd25('0x39')]=_0x28edcf[_0xdd25('0x39')][_0xdd25('0x3b')]?_0x28edcf[_0xdd25('0x39')]:_0x19dc18[_0xdd25('0x36')];if(!_0x4a3298[_0xdd25('0x37')][_0xdd25('0x3c')](_0xdd25('0x3d'))){_0x28edcf[_0xdd25('0x23')]=qs[_0xdd25('0x23')](_0x4a3298[_0xdd25('0x37')][_0xdd25('0x23')]);_0x28edcf[_0xdd25('0x21')]=qs[_0xdd25('0x21')](_0x4a3298['query'][_0xdd25('0x21')]);}_0x28edcf[_0xdd25('0x3e')]=qs[_0xdd25('0x3f')](_0x4a3298[_0xdd25('0x37')][_0xdd25('0x3f')]);_0x28edcf['where']=qs['filters'](_[_0xdd25('0x40')](_0x4a3298[_0xdd25('0x37')],_0x19dc18[_0xdd25('0x41')]),_0xe15ac3);if(_0x4a3298[_0xdd25('0x37')][_0xdd25('0x42')]){_0x28edcf[_0xdd25('0x43')]=_[_0xdd25('0x44')](_0x28edcf[_0xdd25('0x43')],{'$or':_[_0xdd25('0x32')](_0xe15ac3,function(_0x1e8a0c){if(_0x1e8a0c[_0xdd25('0x45')]!=='VIRTUAL'){var _0x300718={};_0x300718[_0x1e8a0c['name']]={'$like':'%'+_0x4a3298['query']['filter']+'%'};return _0x300718;}})});}_0x28edcf=_[_0xdd25('0x44')]({},_0x28edcf,_0x4a3298[_0xdd25('0x46')]);var _0x560272={'where':_0x28edcf[_0xdd25('0x43')]};return db[_0xdd25('0x33')][_0xdd25('0x24')](_0x560272)[_0xdd25('0x2b')](function(_0x5ce32e){_0xb9a760[_0xdd25('0x24')]=_0x5ce32e;if(_0x4a3298[_0xdd25('0x37')][_0xdd25('0x47')]){_0x28edcf[_0xdd25('0x48')]=[{'all':!![]}];}return db[_0xdd25('0x33')][_0xdd25('0x49')](_0x28edcf);})[_0xdd25('0x2b')](function(_0x2e0b2c){_0xb9a760[_0xdd25('0x4a')]=_0x2e0b2c;return _0xb9a760;})[_0xdd25('0x2b')](respondWithFilteredResult(_0x3be342,_0x28edcf))['catch'](handleError(_0x3be342,null));};exports[_0xdd25('0x4b')]=function(_0x3b7a1a,_0x2e0e26){var _0x628637={'raw':!![],'where':{'id':_0x3b7a1a[_0xdd25('0x4c')]['id']}},_0x5084ea={};_0x5084ea[_0xdd25('0x36')]=_[_0xdd25('0x4d')](db[_0xdd25('0x33')][_0xdd25('0x4e')]);_0x5084ea['query']=_['keys'](_0x3b7a1a[_0xdd25('0x37')]);_0x5084ea[_0xdd25('0x41')]=_[_0xdd25('0x38')](_0x5084ea[_0xdd25('0x36')],_0x5084ea['query']);_0x628637[_0xdd25('0x39')]=_[_0xdd25('0x38')](_0x5084ea[_0xdd25('0x36')],qs[_0xdd25('0x3a')](_0x3b7a1a[_0xdd25('0x37')]['fields']));_0x628637[_0xdd25('0x39')]=_0x628637[_0xdd25('0x39')][_0xdd25('0x3b')]?_0x628637[_0xdd25('0x39')]:_0x5084ea[_0xdd25('0x36')];if(_0x3b7a1a[_0xdd25('0x37')][_0xdd25('0x47')]){_0x628637[_0xdd25('0x48')]=[{'all':!![]}];}_0x628637=_[_0xdd25('0x44')]({},_0x628637,_0x3b7a1a[_0xdd25('0x46')]);return db[_0xdd25('0x33')][_0xdd25('0x4f')](_0x628637)[_0xdd25('0x2b')](handleEntityNotFound(_0x2e0e26,null))[_0xdd25('0x2b')](respondWithResult(_0x2e0e26,null))[_0xdd25('0x50')](handleError(_0x2e0e26,null));};exports[_0xdd25('0x51')]=function(_0x280b73,_0xcba1fb){return db[_0xdd25('0x33')][_0xdd25('0x51')](_0x280b73['body'],{})[_0xdd25('0x2b')](respondWithResult(_0xcba1fb,0xc9))['catch'](handleError(_0xcba1fb,null));};exports['update']=function(_0x359e20,_0x1aaa1c){if(_0x359e20[_0xdd25('0x52')]['id']){delete _0x359e20[_0xdd25('0x52')]['id'];}return db[_0xdd25('0x33')][_0xdd25('0x4f')]({'where':{'id':_0x359e20[_0xdd25('0x4c')]['id']}})[_0xdd25('0x2b')](handleEntityNotFound(_0x1aaa1c,null))['then'](saveUpdates(_0x359e20['body'],null))[_0xdd25('0x2b')](respondWithResult(_0x1aaa1c,null))[_0xdd25('0x50')](handleError(_0x1aaa1c,null));};exports['destroy']=function(_0x23bb79,_0x424a35){return db['ChatTransferReport']['find']({'where':{'id':_0x23bb79['params']['id']}})[_0xdd25('0x2b')](handleEntityNotFound(_0x424a35,null))[_0xdd25('0x2b')](removeEntity(_0x424a35,null))[_0xdd25('0x50')](handleError(_0x424a35,null));};exports[_0xdd25('0x53')]=function(_0xcb8ab3,_0x5ad339){return db['ChatTransferReport'][_0xdd25('0x53')]()[_0xdd25('0x2b')](respondWithResult(_0x5ad339,null))[_0xdd25('0x50')](handleError(_0x5ad339,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f9e5f40..39299f3 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 _0xe937=['./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38be62,_0xc0275f){var _0x2da447=function(_0x2f06f9){while(--_0x2f06f9){_0x38be62['push'](_0x38be62['shift']());}};_0x2da447(++_0xc0275f);}(_0xe937,0x15a));var _0x7e93=function(_0x51a4b1,_0x374955){_0x51a4b1=_0x51a4b1-0x0;var _0x305c71=_0xe937[_0x51a4b1];return _0x305c71;};'use strict';var _=require('lodash');var util=require(_0x7e93('0x0'));var logger=require(_0x7e93('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7e93('0x2'));var rp=require(_0x7e93('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e93('0x4'));var config=require(_0x7e93('0x5'));var attributes=require(_0x7e93('0x6'));module[_0x7e93('0x7')]=function(_0x1afaff,_0x34e382){return _0x1afaff[_0x7e93('0x8')]('ChatTransferReport',attributes,{'tableName':_0x7e93('0x9'),'paranoid':![],'indexes':[{'name':_0x7e93('0xa'),'fields':[_0x7e93('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7cc7=['uniqueid','lodash','util','api','moment','request-promise','path','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x17c69d,_0x4429ce){var _0xc0d69f=function(_0xec6c52){while(--_0xec6c52){_0x17c69d['push'](_0x17c69d['shift']());}};_0xc0d69f(++_0x4429ce);}(_0x7cc7,0x90));var _0x77cc=function(_0x2a2511,_0x30f1c4){_0x2a2511=_0x2a2511-0x0;var _0x3c8c28=_0x7cc7[_0x2a2511];return _0x3c8c28;};'use strict';var _=require(_0x77cc('0x0'));var util=require(_0x77cc('0x1'));var logger=require('../../config/logger')(_0x77cc('0x2'));var moment=require(_0x77cc('0x3'));var BPromise=require('bluebird');var rp=require(_0x77cc('0x4'));var fs=require('fs');var path=require(_0x77cc('0x5'));var rimraf=require(_0x77cc('0x6'));var config=require('../../config/environment');var attributes=require(_0x77cc('0x7'));module[_0x77cc('0x8')]=function(_0x520db5,_0x4192c8){return _0x520db5[_0x77cc('0x9')](_0x77cc('0xa'),attributes,{'tableName':_0x77cc('0xb'),'paranoid':![],'indexes':[{'name':_0x77cc('0xc'),'fields':[_0x77cc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index b8ff214..c32e6fc 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 _0xd01b=['stringify','error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd01b,0x112));var _0xbd01=function(_0xd3db80,_0x59dbd8){_0xd3db80=_0xd3db80-0x0;var _0x154baf=_0xd01b[_0xd3db80];return _0x154baf;};'use strict';var _=require('lodash');var util=require(_0xbd01('0x0'));var moment=require('moment');var BPromise=require(_0xbd01('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd01('0x2'));var db=require(_0xbd01('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd01('0x4'))(_0xbd01('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd01('0x6')][_0xbd01('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f9ce5,_0x27fce7,_0x4e9952){return new BPromise(function(_0x178399,_0x2e2f2b){return client[_0xbd01('0x8')](_0x4f9ce5,_0x4e9952)['then'](function(_0x2111bb){logger[_0xbd01('0x9')](_0xbd01('0xa'),_0x27fce7,_0xbd01('0xb'));logger[_0xbd01('0xc')](_0xbd01('0xd'),_0x27fce7,_0xbd01('0xb'),JSON[_0xbd01('0xe')](_0x2111bb));if(_0x2111bb[_0xbd01('0xf')]){if(_0x2111bb[_0xbd01('0xf')]['code']===0x1f4){logger[_0xbd01('0xf')](_0xbd01('0xa'),_0x27fce7,_0x2111bb[_0xbd01('0xf')][_0xbd01('0x10')]);return _0x2e2f2b(_0x2111bb['error']['message']);}logger[_0xbd01('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x27fce7,_0x2111bb[_0xbd01('0xf')][_0xbd01('0x10')]);return _0x178399(_0x2111bb[_0xbd01('0xf')][_0xbd01('0x10')]);}else{logger[_0xbd01('0x9')]('ChatTransferReport,\x20%s,\x20%s',_0x27fce7,_0xbd01('0xb'));_0x178399(_0x2111bb['result']['message']);}})[_0xbd01('0x11')](function(_0x11e1c3){logger['error'](_0xbd01('0xa'),_0x27fce7,_0x11e1c3);_0x2e2f2b(_0x11e1c3);});});} \ No newline at end of file +var _0x9793=['client','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0x9793,0x1f2));var _0x3979=function(_0x505f6e,_0x1d0c14){_0x505f6e=_0x505f6e-0x0;var _0x2b9c01=_0x9793[_0x505f6e];return _0x2b9c01;};'use strict';var _=require(_0x3979('0x0'));var util=require('util');var moment=require(_0x3979('0x1'));var BPromise=require(_0x3979('0x2'));var rs=require(_0x3979('0x3'));var fs=require('fs');var Redis=require(_0x3979('0x4'));var db=require(_0x3979('0x5'))['db'];var utils=require(_0x3979('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3979('0x7'));var client=jayson[_0x3979('0x8')][_0x3979('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x380d12,_0x741314,_0x2ffd19){return new BPromise(function(_0x18ee7b,_0x52a20e){return client[_0x3979('0xa')](_0x380d12,_0x2ffd19)[_0x3979('0xb')](function(_0x541bca){logger[_0x3979('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x741314,_0x3979('0xd'));logger[_0x3979('0xe')](_0x3979('0xf'),_0x741314,_0x3979('0xd'),JSON[_0x3979('0x10')](_0x541bca));if(_0x541bca[_0x3979('0x11')]){if(_0x541bca['error'][_0x3979('0x12')]===0x1f4){logger[_0x3979('0x11')](_0x3979('0x13'),_0x741314,_0x541bca[_0x3979('0x11')][_0x3979('0x14')]);return _0x52a20e(_0x541bca[_0x3979('0x11')][_0x3979('0x14')]);}logger[_0x3979('0x11')](_0x3979('0x13'),_0x741314,_0x541bca[_0x3979('0x11')][_0x3979('0x14')]);return _0x18ee7b(_0x541bca[_0x3979('0x11')][_0x3979('0x14')]);}else{logger[_0x3979('0xc')](_0x3979('0x13'),_0x741314,_0x3979('0xd'));_0x18ee7b(_0x541bca[_0x3979('0x15')]['message']);}})['catch'](function(_0xa8a301){logger[_0x3979('0x11')](_0x3979('0x13'),_0x741314,_0xa8a301);_0x52a20e(_0xa8a301);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c91b7c0..7fae4c2 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 _0x054d=['/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','isAuthenticated','show','create','update','delete'];(function(_0x312cb2,_0x45f3b2){var _0xe10bef=function(_0x5ab658){while(--_0x5ab658){_0x312cb2['push'](_0x312cb2['shift']());}};_0xe10bef(++_0x45f3b2);}(_0x054d,0x120));var _0xd054=function(_0x5a0213,_0x4ff666){_0x5a0213=_0x5a0213-0x0;var _0x10af77=_0x054d[_0x5a0213];return _0x10af77;};'use strict';var multer=require('multer');var util=require(_0xd054('0x0'));var path=require(_0xd054('0x1'));var timeout=require(_0xd054('0x2'));var express=require(_0xd054('0x3'));var router=express[_0xd054('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd054('0x5'));var interaction=require(_0xd054('0x6'));var config=require(_0xd054('0x7'));var controller=require('./chatTransferReport.controller');router[_0xd054('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd054('0x8')](_0xd054('0x9'),auth['isAuthenticated'](),controller[_0xd054('0xa')]);router[_0xd054('0x8')]('/:id',auth[_0xd054('0xb')](),controller[_0xd054('0xc')]);router['post']('/',auth[_0xd054('0xb')](),controller[_0xd054('0xd')]);router['put']('/:id',auth[_0xd054('0xb')](),controller[_0xd054('0xe')]);router[_0xd054('0xf')](_0xd054('0x10'),auth[_0xd054('0xb')](),controller[_0xd054('0x11')]);module[_0xd054('0x12')]=router; \ No newline at end of file +var _0x3d48=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x439083,_0x18f6e2){var _0x54c089=function(_0x40de42){while(--_0x40de42){_0x439083['push'](_0x439083['shift']());}};_0x54c089(++_0x18f6e2);}(_0x3d48,0xfd));var _0x83d4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3d48[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x83d4('0x0'));var util=require(_0x83d4('0x1'));var path=require(_0x83d4('0x2'));var timeout=require(_0x83d4('0x3'));var express=require(_0x83d4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x83d4('0x5'));var config=require(_0x83d4('0x6'));var controller=require('./chatTransferReport.controller');router[_0x83d4('0x7')]('/',auth[_0x83d4('0x8')](),controller['index']);router[_0x83d4('0x7')](_0x83d4('0x9'),auth[_0x83d4('0x8')](),controller['describe']);router[_0x83d4('0x7')](_0x83d4('0xa'),auth[_0x83d4('0x8')](),controller[_0x83d4('0xb')]);router[_0x83d4('0xc')]('/',auth[_0x83d4('0x8')](),controller[_0x83d4('0xd')]);router['put'](_0x83d4('0xa'),auth[_0x83d4('0x8')](),controller[_0x83d4('0xe')]);router[_0x83d4('0xf')]('/:id',auth[_0x83d4('0x8')](),controller['destroy']);module[_0x83d4('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4ed7b72..92d745b 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 _0xcb91=['INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Send','Skip','thumb','star','stringify','input','name','text','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xcb91[_0x33155c];return _0x5becf7;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1cb9('0x0')]={'name':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'unique':_0x1cb9('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x3')},'key':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x4')},'customerAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1cb9('0x1')]},'animation':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1cb9('0x9')]('rounded',_0x1cb9('0xa')),'defaultValue':_0x1cb9('0xb')},'header_online':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xc')},'start_chat_button':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xd')},'download_transcript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1cb9('0xf')]},'closingQuestion':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x11')},'noteTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x12')},'placeholderMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x13')},'closingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x14')},'skipMessageButton':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'conditionAgreement':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x1cb9('0x9')]('star',_0x1cb9('0x16')),'defaultValue':_0x1cb9('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'variable':null,'config':{'placeholder':_0x1cb9('0x1a'),'type':_0x1cb9('0x1b'),'required':!![]},'props':{'title':_0x1cb9('0x1a'),'helpText':''}},{'type':_0x1cb9('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1cb9('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x1cb9('0x1c'))?JSON[_0x1cb9('0x1d')](this[_0x1cb9('0x1e')](_0x1cb9('0x1c'))):{};},'set':function(_0x43a100){return this['setDataValue'](_0x1cb9('0x1c'),JSON[_0x1cb9('0x18')](_0x43a100));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'props':{'title':_0x1cb9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x1cb9('0x3'),'type':_0x1cb9('0x3')},'variable':null},{'type':_0x1cb9('0x1f'),'config':{'placeholder':_0x1cb9('0x20')},'props':{'title':_0x1cb9('0x20'),'helpText':_0x1cb9('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x1cb9('0x1e')]('offlineForm')?JSON[_0x1cb9('0x1d')](this['getDataValue'](_0x1cb9('0x22'))):{};},'set':function(_0x4efebc){return this[_0x1cb9('0x23')](_0x1cb9('0x22'),JSON[_0x1cb9('0x18')](_0x4efebc));}},'token':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1cb9('0x1')]},'forwardOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x24')},'offlineMessageBody':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x26')},'skipUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'sendUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1cb9('0x1')]},'notificationTemplate':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':function(){return _0x1cb9('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x29')},'verticalAlignment':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2a')},'defaultTitle':{'type':Sequelize[_0x1cb9('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2b')},'systemAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'comment':_0x1cb9('0x2c'),'set':function(_0x7a0d8b){if(!_0x7a0d8b)this[_0x1cb9('0x23')](_0x1cb9('0x2d'),null);this[_0x1cb9('0x23')](_0x1cb9('0x2e'),_0x7a0d8b);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x1cb9('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x1cb9('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1cb9('0xf')]}}; \ No newline at end of file +var _0xcb91=['INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Send','Skip','thumb','star','stringify','input','name','text','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xcb91[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1cb9('0x0')]={'name':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'unique':_0x1cb9('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x3')},'key':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x4')},'customerAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1cb9('0x1')]},'animation':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1cb9('0x9')]('rounded',_0x1cb9('0xa')),'defaultValue':_0x1cb9('0xb')},'header_online':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xc')},'start_chat_button':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xd')},'download_transcript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1cb9('0xf')]},'closingQuestion':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x11')},'noteTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x12')},'placeholderMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x13')},'closingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x14')},'skipMessageButton':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'conditionAgreement':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x1cb9('0x9')]('star',_0x1cb9('0x16')),'defaultValue':_0x1cb9('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'variable':null,'config':{'placeholder':_0x1cb9('0x1a'),'type':_0x1cb9('0x1b'),'required':!![]},'props':{'title':_0x1cb9('0x1a'),'helpText':''}},{'type':_0x1cb9('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1cb9('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x1cb9('0x1c'))?JSON[_0x1cb9('0x1d')](this[_0x1cb9('0x1e')](_0x1cb9('0x1c'))):{};},'set':function(_0x43a100){return this['setDataValue'](_0x1cb9('0x1c'),JSON[_0x1cb9('0x18')](_0x43a100));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'props':{'title':_0x1cb9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x1cb9('0x3'),'type':_0x1cb9('0x3')},'variable':null},{'type':_0x1cb9('0x1f'),'config':{'placeholder':_0x1cb9('0x20')},'props':{'title':_0x1cb9('0x20'),'helpText':_0x1cb9('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x1cb9('0x1e')]('offlineForm')?JSON[_0x1cb9('0x1d')](this['getDataValue'](_0x1cb9('0x22'))):{};},'set':function(_0x4efebc){return this[_0x1cb9('0x23')](_0x1cb9('0x22'),JSON[_0x1cb9('0x18')](_0x4efebc));}},'token':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1cb9('0x1')]},'forwardOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x24')},'offlineMessageBody':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x26')},'skipUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'sendUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1cb9('0x1')]},'notificationTemplate':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':function(){return _0x1cb9('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x29')},'verticalAlignment':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2a')},'defaultTitle':{'type':Sequelize[_0x1cb9('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2b')},'systemAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'comment':_0x1cb9('0x2c'),'set':function(_0x7a0d8b){if(!_0x7a0d8b)this[_0x1cb9('0x23')](_0x1cb9('0x2d'),null);this[_0x1cb9('0x23')](_0x1cb9('0x2e'),_0x7a0d8b);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x1cb9('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x1cb9('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1cb9('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 86a789a..4baf814 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 _0x49e3=['no\x20available\x20attributes','difference','CompanyId','ListId','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','List','Contacts','updatedAt','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','messageId','created','push','close','*,*,*,*','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','createdAt','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','NotifyMailAccount','notifyMail','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','remoteAddress','render','alignment','verticalAlignment','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','omit','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','count','limit','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','end','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','order','options','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','rawAttributes','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0x49e3,0x1ce));var _0x349e=function(_0xc9d31b,_0x1554a7){_0xc9d31b=_0xc9d31b-0x0;var _0x1bc442=_0x49e3[_0xc9d31b];return _0x1bc442;};'use strict';var BPromise=require(_0x349e('0x0'));var Mustache=require(_0x349e('0x1'));var util=require('util');var path=require(_0x349e('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require('querystring');var Redis=require(_0x349e('0x3'));var qs=require(_0x349e('0x4'));var logger=require(_0x349e('0x5'))(_0x349e('0x6'));var config=require(_0x349e('0x7'));var db=require(_0x349e('0x8'))['db'];config['redis']=_[_0x349e('0x9')](config[_0x349e('0xa')],{'host':_0x349e('0xb'),'port':0x18eb});var socket=require(_0x349e('0xc'))(new Redis(config[_0x349e('0xa')]));require(_0x349e('0xd'))[_0x349e('0xe')](socket);var htmlToText=require(_0x349e('0xf'));var jayson=require('jayson/promise');var client=jayson[_0x349e('0x10')]['http']({'port':0x232c});var client9002=jayson[_0x349e('0x10')][_0x349e('0x11')]({'port':0x232a});var client9003=jayson['client'][_0x349e('0x11')]({'port':0x232b});var client9001=jayson[_0x349e('0x10')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3211ea,_0x46c8e9,_0x209184,_0x1a7a9a){return new BPromise(function(_0x41b65a,_0x1de36d){var _0x1d9e82=_0x1a7a9a||client;return _0x1d9e82[_0x349e('0x12')](_0x3211ea,_0x209184)[_0x349e('0x13')](function(_0x1a56fd){logger[_0x349e('0x14')](_0x349e('0x15'),_0x46c8e9,_0x349e('0x16'));logger[_0x349e('0x17')](_0x349e('0x18'),_0x46c8e9,'request\x20sent',JSON[_0x349e('0x19')](_0x1a56fd));if(_0x1a56fd[_0x349e('0x1a')]){if(_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1b')]===0x1f4){logger[_0x349e('0x1a')](_0x349e('0x15'),_0x46c8e9,_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1c')]);return _0x1de36d(_0x1a56fd['error']['message']);}logger[_0x349e('0x1a')](_0x349e('0x15'),_0x46c8e9,_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1c')]);return _0x41b65a(_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1c')]);}else{logger[_0x349e('0x14')](_0x349e('0x15'),_0x46c8e9,_0x349e('0x16'));_0x41b65a(_0x1a56fd[_0x349e('0x1d')][_0x349e('0x1c')]);}})['catch'](function(_0x47ac78){logger[_0x349e('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x46c8e9,_0x47ac78);_0x1de36d(_0x47ac78);});});}function respondWithStatusCode(_0x3283bc,_0xdaca79){_0xdaca79=_0xdaca79||0xcc;return function(_0x208b8b){if(_0x208b8b){return _0x3283bc[_0x349e('0x1e')](_0xdaca79);}return _0x3283bc['status'](_0xdaca79)['end']();};}function respondWithResult(_0x54bce0,_0x188e18){_0x188e18=_0x188e18||0xc8;return function(_0x558bb7){if(_0x558bb7){return _0x54bce0[_0x349e('0x1f')](_0x188e18)[_0x349e('0x20')](_0x558bb7);}};}function respondWithFilteredResult(_0x2e1710,_0x43a218){return function(_0xd79a46){if(_0xd79a46){var _0x319d68=typeof _0x43a218[_0x349e('0x21')]==='undefined'&&typeof _0x43a218['limit']==='undefined';var _0x4610e0=_0xd79a46[_0x349e('0x22')];var _0x4c112a=_0x319d68?0x0:_0x43a218[_0x349e('0x21')];var _0x2fcd57=_0x319d68?_0xd79a46[_0x349e('0x22')]:_0x43a218[_0x349e('0x21')]+_0x43a218[_0x349e('0x23')];var _0x58b364;if(_0x2fcd57>=_0x4610e0){_0x2fcd57=_0x4610e0;_0x58b364=0xc8;}else{_0x58b364=0xce;}_0x2e1710[_0x349e('0x1f')](_0x58b364);return _0x2e1710[_0x349e('0x24')](_0x349e('0x25'),_0x4c112a+'-'+_0x2fcd57+'/'+_0x4610e0)[_0x349e('0x20')](_0xd79a46);}return null;};}function saveUpdates(_0x5ae29c){return function(_0xaf1b8){if(_0xaf1b8){return _0xaf1b8[_0x349e('0x26')](_0x5ae29c)['then'](function(_0x48aa70){return _0x48aa70;});}return null;};}function removeEntity(_0x1a4cf2){return function(_0x31944f){if(_0x31944f){return _0x31944f[_0x349e('0x27')]()['then'](function(){var _0xb56f9b=_0x31944f[_0x349e('0x28')]({'plain':!![]});var _0x4be34d=_0x349e('0x29');return db[_0x349e('0x2a')][_0x349e('0x27')]({'where':{'type':_0x4be34d,'resourceId':_0xb56f9b['id']}})['then'](function(){return _0x31944f;});})[_0x349e('0x13')](function(){_0x1a4cf2[_0x349e('0x1f')](0xcc)[_0x349e('0x2b')]();});}};}function handleEntityNotFound(_0x44c17b){return function(_0xae5811){if(!_0xae5811){_0x44c17b[_0x349e('0x1e')](0x194);}return _0xae5811;};}function handleError(_0x15823d,_0x1003a2){_0x1003a2=_0x1003a2||0x1f4;return function(_0x2db35f){logger[_0x349e('0x1a')](_0x2db35f['stack']);if(_0x2db35f[_0x349e('0x2c')]){delete _0x2db35f[_0x349e('0x2c')];}_0x15823d[_0x349e('0x1f')](_0x1003a2)[_0x349e('0x2d')](_0x2db35f);};}exports['index']=function(_0x2aeb27,_0x296619){var _0x36c2d7={'include':[{'model':db[_0x349e('0x2e')],'as':_0x349e('0x2f')}]},_0x4842a4={},_0x556d24={'count':0x0,'rows':[]};var _0xef7ba7=_[_0x349e('0x30')](db[_0x349e('0x31')]['rawAttributes'],function(_0x3f8c5c){return{'name':_0x3f8c5c[_0x349e('0x32')],'type':_0x3f8c5c[_0x349e('0x33')][_0x349e('0x34')]};});_0x4842a4['model']=_['map'](_0xef7ba7,'name');_0x4842a4[_0x349e('0x35')]=_[_0x349e('0x36')](_0x2aeb27[_0x349e('0x35')]);_0x4842a4[_0x349e('0x37')]=_[_0x349e('0x38')](_0x4842a4[_0x349e('0x39')],_0x4842a4[_0x349e('0x35')]);_0x36c2d7['attributes']=_[_0x349e('0x38')](_0x4842a4['model'],qs[_0x349e('0x3a')](_0x2aeb27[_0x349e('0x35')][_0x349e('0x3a')]));_0x36c2d7[_0x349e('0x3b')]=_0x36c2d7[_0x349e('0x3b')][_0x349e('0x3c')]?_0x36c2d7[_0x349e('0x3b')]:_0x4842a4['model'];if(!_0x2aeb27[_0x349e('0x35')]['hasOwnProperty'](_0x349e('0x3d'))){_0x36c2d7[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x2aeb27['query'][_0x349e('0x23')]);_0x36c2d7[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x2aeb27[_0x349e('0x35')][_0x349e('0x21')]);}_0x36c2d7['order']=qs[_0x349e('0x3e')](_0x2aeb27[_0x349e('0x35')][_0x349e('0x3e')]);_0x36c2d7[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x2aeb27[_0x349e('0x35')],_0x4842a4['filters']),_0xef7ba7);if(_0x2aeb27[_0x349e('0x35')][_0x349e('0x41')]){_0x36c2d7[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x36c2d7[_0x349e('0x3f')],{'$or':_['map'](_0xef7ba7,function(_0x5a43cd){if(_0x5a43cd['type']!==_0x349e('0x43')){var _0xc40996={};_0xc40996[_0x5a43cd[_0x349e('0x2c')]]={'$like':'%'+_0x2aeb27[_0x349e('0x35')]['filter']+'%'};return _0xc40996;}})});}_0x36c2d7=_[_0x349e('0x42')]({},_0x36c2d7,_0x2aeb27['options']);var _0x198385={'where':_0x36c2d7[_0x349e('0x3f')]};return db[_0x349e('0x31')][_0x349e('0x22')](_0x198385)[_0x349e('0x13')](function(_0x37882d){_0x556d24[_0x349e('0x22')]=_0x37882d;if(_0x2aeb27[_0x349e('0x35')]['includeAll']){_0x36c2d7[_0x349e('0x44')]=[{'all':!![]}];}return db[_0x349e('0x31')][_0x349e('0x45')](_0x36c2d7);})[_0x349e('0x13')](function(_0x51a691){_0x556d24[_0x349e('0x46')]=_0x51a691;return _0x556d24;})['then'](respondWithFilteredResult(_0x296619,_0x36c2d7))[_0x349e('0x47')](handleError(_0x296619,null));};exports[_0x349e('0x48')]=function(_0x47fc02,_0x499f6b){var _0x40fae6={'raw':![],'where':{'id':_0x47fc02[_0x349e('0x49')]['id']},'include':[{'model':db[_0x349e('0x2e')],'as':_0x349e('0x2f')}]},_0xd9bd7e={};_0xd9bd7e['model']=_[_0x349e('0x36')](db[_0x349e('0x31')]['rawAttributes']);_0xd9bd7e['query']=_[_0x349e('0x36')](_0x47fc02[_0x349e('0x35')]);_0xd9bd7e[_0x349e('0x37')]=_[_0x349e('0x38')](_0xd9bd7e[_0x349e('0x39')],_0xd9bd7e[_0x349e('0x35')]);_0x40fae6['attributes']=_['intersection'](_0xd9bd7e[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x47fc02[_0x349e('0x35')]['fields']));_0x40fae6[_0x349e('0x3b')]=_0x40fae6[_0x349e('0x3b')]['length']?_0x40fae6['attributes']:_0xd9bd7e[_0x349e('0x39')];if(_0x47fc02['query'][_0x349e('0x4a')]){_0x40fae6['include']=[{'all':!![]}];}_0x40fae6=_[_0x349e('0x42')]({},_0x40fae6,_0x47fc02['options']);return db[_0x349e('0x31')]['find'](_0x40fae6)[_0x349e('0x13')](handleEntityNotFound(_0x499f6b,null))[_0x349e('0x13')](respondWithResult(_0x499f6b,null))[_0x349e('0x47')](handleError(_0x499f6b,null));};exports['create']=function(_0x647d22,_0x12eb63){return db[_0x349e('0x31')]['create'](_0x647d22[_0x349e('0x4b')],{})['then'](function(_0x3e6a74){var _0x44d03d=_0x647d22[_0x349e('0x4c')]['get']({'plain':!![]});if(!_0x44d03d)throw new Error(_0x349e('0x4d'));if(_0x44d03d[_0x349e('0x4e')]==='user'){var _0x3ae0b9=_0x3e6a74['get']({'plain':!![]});var _0x7f9868=_0x349e('0x29');return db[_0x349e('0x4f')][_0x349e('0x50')]({'where':{'name':_0x7f9868,'userProfileId':_0x44d03d[_0x349e('0x51')]},'raw':!![]})['then'](function(_0x469931){if(_0x469931&&_0x469931['autoAssociation']===0x0){return db[_0x349e('0x2a')][_0x349e('0x52')]({'name':_0x3ae0b9[_0x349e('0x2c')],'resourceId':_0x3ae0b9['id'],'type':_0x469931[_0x349e('0x2c')],'sectionId':_0x469931['id']},{})[_0x349e('0x13')](function(){return _0x3e6a74;});}else{return _0x3e6a74;}})[_0x349e('0x47')](function(_0x1f709c){logger[_0x349e('0x1a')](_0x349e('0x53'),_0x1f709c);throw _0x1f709c;});}return _0x3e6a74;})[_0x349e('0x13')](respondWithResult(_0x12eb63,0xc9))[_0x349e('0x47')](handleError(_0x12eb63,null));};exports['update']=function(_0x112da8,_0x48b5e4){if(_0x112da8[_0x349e('0x4b')]['id']){delete _0x112da8[_0x349e('0x4b')]['id'];}return db[_0x349e('0x31')]['find']({'where':{'id':_0x112da8['params']['id']},'include':[{'model':db[_0x349e('0x2e')],'as':_0x349e('0x2f')}]})[_0x349e('0x13')](handleEntityNotFound(_0x48b5e4,null))[_0x349e('0x13')](saveUpdates(_0x112da8['body'],null))[_0x349e('0x13')](respondWithResult(_0x48b5e4,null))['catch'](handleError(_0x48b5e4,null));};exports[_0x349e('0x27')]=function(_0x3ed95a,_0x550e0a){return db['ChatWebsite']['find']({'where':{'id':_0x3ed95a[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x550e0a,null))[_0x349e('0x13')](removeEntity(_0x550e0a,null))[_0x349e('0x47')](handleError(_0x550e0a,null));};exports[_0x349e('0x54')]=function(_0x7e03b3,_0x3011ce){return db[_0x349e('0x31')][_0x349e('0x54')]()['then'](respondWithResult(_0x3011ce,null))[_0x349e('0x47')](handleError(_0x3011ce,null));};exports['addDisposition']=function(_0xe813e2,_0x4c5580){if(_0xe813e2[_0x349e('0x4b')]['id']){delete _0xe813e2[_0x349e('0x4b')]['id'];}return db['ChatWebsite'][_0x349e('0x50')]({'where':{'id':_0xe813e2[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c5580,null))[_0x349e('0x13')](function(_0x53d3d4){if(_0x53d3d4){_0xe813e2[_0x349e('0x4b')][_0x349e('0x55')]=_0x53d3d4['id'];return db[_0x349e('0x56')][_0x349e('0x52')](_0xe813e2[_0x349e('0x4b')]);}})['then'](respondWithResult(_0x4c5580,null))[_0x349e('0x47')](handleError(_0x4c5580,null));};exports[_0x349e('0x57')]=function(_0xe12d3,_0x49e064){var _0x5db83e={'raw':![],'where':{}};var _0x392560={};var _0xfd0be4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x349e('0x58')]({'where':{'id':_0xe12d3[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x49e064,null))[_0x349e('0x13')](function(_0x3b22e5){if(_0x3b22e5){_0x392560[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0x56')]['rawAttributes']);_0x392560[_0x349e('0x35')]=_[_0x349e('0x36')](_0xe12d3[_0x349e('0x35')]);_0x392560['filters']=_[_0x349e('0x38')](_0x392560['model'],_0x392560[_0x349e('0x35')]);_0x5db83e['attributes']=_['intersection'](_0x392560[_0x349e('0x39')],qs[_0x349e('0x3a')](_0xe12d3[_0x349e('0x35')][_0x349e('0x3a')]));_0x5db83e['attributes']=_0x5db83e['attributes'][_0x349e('0x3c')]?_0x5db83e['attributes']:_0x392560[_0x349e('0x39')];if(!_0xe12d3['query'][_0x349e('0x59')](_0x349e('0x3d'))){_0x5db83e[_0x349e('0x23')]=qs[_0x349e('0x23')](_0xe12d3[_0x349e('0x35')][_0x349e('0x23')]);_0x5db83e['offset']=qs[_0x349e('0x21')](_0xe12d3[_0x349e('0x35')][_0x349e('0x21')]);}_0x5db83e[_0x349e('0x5a')]=qs['sort'](_0xe12d3[_0x349e('0x35')][_0x349e('0x3e')]);_0x5db83e[_0x349e('0x3f')]=qs['filters'](_[_0x349e('0x40')](_0xe12d3[_0x349e('0x35')],_0x392560[_0x349e('0x37')]));_0x5db83e[_0x349e('0x3f')][_0x349e('0x55')]=_0x3b22e5['id'];if(_0xe12d3[_0x349e('0x35')][_0x349e('0x41')]){_0x5db83e[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x5db83e[_0x349e('0x3f')],{'$or':_['map'](_0x5db83e[_0x349e('0x3b')],function(_0x432bca){var _0x2f97bf={};_0x2f97bf[_0x432bca]={'$like':'%'+_0xe12d3[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x2f97bf;})});}_0x5db83e=_['merge']({},_0x5db83e,_0xe12d3[_0x349e('0x5b')]);return db[_0x349e('0x56')][_0x349e('0x22')]({'where':_0x5db83e[_0x349e('0x3f')]})[_0x349e('0x13')](function(_0x5284d1){_0xfd0be4[_0x349e('0x22')]=_0x5284d1;if(_0xe12d3[_0x349e('0x35')][_0x349e('0x4a')]){_0x5db83e[_0x349e('0x44')]=[{'all':!![]}];}return db[_0x349e('0x56')][_0x349e('0x45')](_0x5db83e);})[_0x349e('0x13')](function(_0x5e01e7){_0xfd0be4[_0x349e('0x46')]=_0x5e01e7;return _0xfd0be4;});}})['then'](respondWithFilteredResult(_0x49e064,_0x5db83e))[_0x349e('0x47')](handleError(_0x49e064,null));};exports['removeDispositions']=function(_0x24b5dd,_0x1afa3a){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x24b5dd[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x1afa3a,null))[_0x349e('0x13')](function(_0x5df967){if(_0x5df967){return _0x5df967[_0x349e('0x5c')](_0x24b5dd[_0x349e('0x35')][_0x349e('0x5d')]);}})[_0x349e('0x13')](respondWithStatusCode(_0x1afa3a,null))[_0x349e('0x47')](handleError(_0x1afa3a,null));};exports[_0x349e('0x5e')]=function(_0x35ea51,_0x2fc377){if(_0x35ea51[_0x349e('0x4b')]['id']){delete _0x35ea51[_0x349e('0x4b')]['id'];}return db[_0x349e('0x31')]['find']({'where':{'id':_0x35ea51[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x2fc377,null))[_0x349e('0x13')](function(_0x223cb6){if(_0x223cb6){_0x35ea51[_0x349e('0x4b')][_0x349e('0x55')]=_0x223cb6['id'];return db['CannedAnswer']['create'](_0x35ea51[_0x349e('0x4b')]);}})[_0x349e('0x13')](respondWithResult(_0x2fc377,null))['catch'](handleError(_0x2fc377,null));};exports[_0x349e('0x5f')]=function(_0x39afbe,_0x302b73){var _0x4c512e={'raw':![],'where':{}};var _0x2f7423={};var _0x17a023={'count':0x0,'rows':[]};return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x39afbe[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x302b73,null))[_0x349e('0x13')](function(_0x1927c7){if(_0x1927c7){_0x2f7423[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0x60')][_0x349e('0x61')]);_0x2f7423[_0x349e('0x35')]=_[_0x349e('0x36')](_0x39afbe[_0x349e('0x35')]);_0x2f7423[_0x349e('0x37')]=_['intersection'](_0x2f7423[_0x349e('0x39')],_0x2f7423[_0x349e('0x35')]);_0x4c512e[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x2f7423[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x39afbe[_0x349e('0x35')][_0x349e('0x3a')]));_0x4c512e['attributes']=_0x4c512e['attributes'][_0x349e('0x3c')]?_0x4c512e[_0x349e('0x3b')]:_0x2f7423['model'];if(!_0x39afbe['query']['hasOwnProperty'](_0x349e('0x3d'))){_0x4c512e[_0x349e('0x23')]=qs['limit'](_0x39afbe[_0x349e('0x35')][_0x349e('0x23')]);_0x4c512e[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x39afbe[_0x349e('0x35')]['offset']);}_0x4c512e[_0x349e('0x5a')]=qs['sort'](_0x39afbe[_0x349e('0x35')][_0x349e('0x3e')]);_0x4c512e[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x39afbe[_0x349e('0x35')],_0x2f7423['filters']));_0x4c512e[_0x349e('0x3f')][_0x349e('0x55')]=_0x1927c7['id'];if(_0x39afbe[_0x349e('0x35')][_0x349e('0x41')]){_0x4c512e[_0x349e('0x3f')]=_['merge'](_0x4c512e[_0x349e('0x3f')],{'$or':_[_0x349e('0x30')](_0x4c512e[_0x349e('0x3b')],function(_0x5248e8){var _0x153b7f={};_0x153b7f[_0x5248e8]={'$like':'%'+_0x39afbe[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x153b7f;})});}_0x4c512e=_['merge']({},_0x4c512e,_0x39afbe['options']);return db['CannedAnswer'][_0x349e('0x22')]({'where':_0x4c512e[_0x349e('0x3f')]})[_0x349e('0x13')](function(_0x3f2495){_0x17a023['count']=_0x3f2495;if(_0x39afbe[_0x349e('0x35')]['includeAll']){_0x4c512e['include']=[{'all':!![]}];}return db[_0x349e('0x60')][_0x349e('0x45')](_0x4c512e);})[_0x349e('0x13')](function(_0x2087f1){_0x17a023[_0x349e('0x46')]=_0x2087f1;return _0x17a023;});}})[_0x349e('0x13')](respondWithFilteredResult(_0x302b73,_0x4c512e))[_0x349e('0x47')](handleError(_0x302b73,null));};exports[_0x349e('0x62')]=function(_0x28cedf,_0x1006ea){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x28cedf[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x1006ea,null))[_0x349e('0x13')](function(_0x4ace29){if(_0x4ace29){return _0x4ace29['removeAnswers'](_0x28cedf[_0x349e('0x35')][_0x349e('0x5d')]);}})[_0x349e('0x13')](respondWithStatusCode(_0x1006ea,null))[_0x349e('0x47')](handleError(_0x1006ea,null));};exports[_0x349e('0x63')]=function(_0x50bb54,_0x576f0c){_0x50bb54[_0x349e('0x4b')][_0x349e('0x64')]=_0x50bb54['file'][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x50bb54[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x576f0c,null))[_0x349e('0x13')](saveUpdates(_0x50bb54[_0x349e('0x4b')],null))['then'](respondWithResult(_0x576f0c,null))[_0x349e('0x47')](handleError(_0x576f0c,null));};exports[_0x349e('0x66')]=function(_0x166842,_0xc7e7de){_0x166842[_0x349e('0x4b')][_0x349e('0x67')]=_0x166842[_0x349e('0x68')][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x166842['params']['id']}})[_0x349e('0x13')](handleEntityNotFound(_0xc7e7de,null))[_0x349e('0x13')](saveUpdates(_0x166842[_0x349e('0x4b')],null))[_0x349e('0x13')](respondWithResult(_0xc7e7de,null))['catch'](handleError(_0xc7e7de,null));};exports[_0x349e('0x69')]=function(_0x21f65d,_0x3a2e2a){_0x21f65d[_0x349e('0x4b')]['customerAvatar']=_0x21f65d[_0x349e('0x68')][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x21f65d[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x3a2e2a,null))[_0x349e('0x13')](saveUpdates(_0x21f65d[_0x349e('0x4b')],null))[_0x349e('0x13')](respondWithResult(_0x3a2e2a,null))['catch'](handleError(_0x3a2e2a,null));};exports[_0x349e('0x6a')]=function(_0x2e78cf,_0x10e628){_0x2e78cf[_0x349e('0x4b')][_0x349e('0x6b')]=_0x2e78cf[_0x349e('0x68')][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x2e78cf['params']['id']}})['then'](handleEntityNotFound(_0x10e628,null))[_0x349e('0x13')](saveUpdates(_0x2e78cf['body'],null))[_0x349e('0x13')](respondWithResult(_0x10e628,null))[_0x349e('0x47')](handleError(_0x10e628,null));};exports[_0x349e('0x6c')]=function(_0x141cfb,_0x586bd0){var _0x2d5945=path['join'](config[_0x349e('0x6d')],_0x349e('0x6e'));var _0x490a01={'where':{'id':_0x141cfb['params']['id']},'attributes':['id',_0x349e('0x64')],'raw':!![]};var _0x5d68e3=![];return require('../../config/license/util')[_0x349e('0x6f')]()[_0x349e('0x13')](function(_0x25dfbf){if(_0x25dfbf){_0x5d68e3=_0x25dfbf[_0x349e('0x70')];}})['then'](function(){return db[_0x349e('0x31')][_0x349e('0x50')](_0x490a01);})[_0x349e('0x13')](handleEntityNotFound(_0x586bd0,null))[_0x349e('0x13')](function(_0x29d583){if(_0x29d583){if(!_[_0x349e('0x71')](_0x29d583[_0x349e('0x64')])){if(fs[_0x349e('0x72')](path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x74'),_0x29d583[_0x349e('0x64')]))&&_0x5d68e3){_0x2d5945=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x74'),_0x29d583['sitepic']);}}return _0x586bd0[_0x349e('0x75')](_0x2d5945);}})[_0x349e('0x47')](handleError(_0x586bd0,null));};exports['getAvatar']=function(_0x5bf46d,_0x1f7cbc){var _0x23ffa7=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x76'));var _0x462ced={'where':{'id':_0x5bf46d[_0x349e('0x49')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x349e('0x31')][_0x349e('0x50')](_0x462ced)['then'](handleEntityNotFound(_0x1f7cbc,null))[_0x349e('0x13')](function(_0x4fc076){if(_0x4fc076){if(!_[_0x349e('0x71')](_0x4fc076['agentAvatar'])){if(fs[_0x349e('0x72')](path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x4fc076[_0x349e('0x67')]))){_0x23ffa7=path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x4fc076[_0x349e('0x67')]);}}return _0x1f7cbc[_0x349e('0x75')](_0x23ffa7);}})[_0x349e('0x47')](handleError(_0x1f7cbc,null));};exports[_0x349e('0x78')]=function(_0x5a6520,_0x30b69d){var _0x21b78c=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x79'));var _0x1293e9={'where':{'id':_0x5a6520[_0x349e('0x49')]['id']},'attributes':['id','customerAvatar',_0x349e('0x7a')],'raw':!![]};return db[_0x349e('0x31')][_0x349e('0x50')](_0x1293e9)[_0x349e('0x13')](handleEntityNotFound(_0x30b69d,null))[_0x349e('0x13')](function(_0x61075b){if(_0x61075b){if(!_['isNil'](_0x61075b['customerAvatar'])){if(fs[_0x349e('0x72')](path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x61075b[_0x349e('0x7b')]))&&_0x61075b[_0x349e('0x7a')]){_0x21b78c=path[_0x349e('0x73')](config['root'],_0x349e('0x77'),_0x61075b[_0x349e('0x7b')]);}}return _0x30b69d[_0x349e('0x75')](_0x21b78c);}})[_0x349e('0x47')](handleError(_0x30b69d,null));};exports[_0x349e('0x7c')]=function(_0x373003,_0x27fccb){var _0x3778d8=path['join'](config['root'],_0x349e('0x7d'));var _0x4d711e={'where':{'id':_0x373003[_0x349e('0x49')]['id']},'attributes':['id',_0x349e('0x6b')],'raw':!![]};return db['ChatWebsite'][_0x349e('0x50')](_0x4d711e)[_0x349e('0x13')](handleEntityNotFound(_0x27fccb,null))[_0x349e('0x13')](function(_0x150451){if(_0x150451){if(!_[_0x349e('0x71')](_0x150451[_0x349e('0x6b')])){if(fs[_0x349e('0x72')](path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x150451['systemAvatar']))){_0x3778d8=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x77'),_0x150451[_0x349e('0x6b')]);}}return _0x27fccb[_0x349e('0x75')](_0x3778d8);}})[_0x349e('0x47')](handleError(_0x27fccb,null));};exports[_0x349e('0x7e')]=function(_0x199844,_0x1739f8){var _0x3fa3ed=require(_0x349e('0x7f'));var _0x2c54b9=new _0x3fa3ed();var _0x2dd88c=_0x2c54b9[_0x349e('0x80')](_0x199844[_0x349e('0x81')][_0x349e('0x82')])[_0x349e('0x83')]();var _0x28ebd1={'body':_0x199844[_0x349e('0x4b')],'channel':_0x349e('0x84')};var _0x17a9be=[];var _0x1d59c6=[];var _0x12672f={};var _0x394c31=![];return db[_0x349e('0x85')][_0x349e('0x54')]()[_0x349e('0x13')](function(_0x5e7251){if(!_0x5e7251){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x88'));}_0x17a9be=_[_0x349e('0x89')](_['keys'](_0x5e7251),['createdAt','updatedAt']);_0x1d59c6=_['difference'](_['keys'](_0x5e7251),['createdAt','updatedAt',_0x349e('0x8a'),_0x349e('0x8b')]);if(_0x199844[_0x349e('0x4b')]['id']){delete _0x199844['body']['id'];}if(_[_0x349e('0x71')](_0x199844[_0x349e('0x4b')][_0x349e('0x8c')])){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x8d'));}if(_[_0x349e('0x71')](_0x199844[_0x349e('0x4b')][_0x349e('0x4b')])||_0x199844['body'][_0x349e('0x4b')]===''){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x8e'));}if(_[_0x349e('0x71')](_0x199844[_0x349e('0x4b')][_0x349e('0x8f')])){throw new db[(_0x349e('0x86'))]['ValidationError'](_0x349e('0x90')+_0x1d59c6);}if(!_[_0x349e('0x91')](_0x1d59c6,_0x199844[_0x349e('0x4b')][_0x349e('0x8f')])){throw new db['Sequelize'][(_0x349e('0x87'))](_0x349e('0x92')+_0x1d59c6);}_0x12672f[_0x199844[_0x349e('0x4b')][_0x349e('0x8f')]]=_0x199844[_0x349e('0x4b')][_0x349e('0x8c')];})['then'](function(){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x199844[_0x349e('0x49')]['id']},'include':[{'model':db['CmList'],'as':_0x349e('0x93'),'include':[{'model':db[_0x349e('0x85')],'as':_0x349e('0x94'),'where':_0x12672f,'limit':0x1,'order':[[_0x349e('0x95'),_0x349e('0x96')]]}]},{'model':db[_0x349e('0x97')],'as':_0x349e('0x98')}]});})[_0x349e('0x13')](handleEntityNotFound(_0x1739f8,null))[_0x349e('0x13')](function(_0x5cad2c){if(_0x5cad2c&&_0x5cad2c[_0x349e('0x93')]){_0x28ebd1[_0x349e('0x99')]=_0x5cad2c;_0x28ebd1[_0x349e('0x9a')]=_0x5cad2c['Applications'];_0x28ebd1[_0x349e('0x9b')]=_0x5cad2c[_0x349e('0x93')];_0x28ebd1['applications']=_[_0x349e('0x9c')](_0x28ebd1[_0x349e('0x9a')],[_0x349e('0x9d')],[_0x349e('0x9e')]);if(_0x28ebd1[_0x349e('0x99')][_0x349e('0x98')]){delete _0x28ebd1['account'][_0x349e('0x98')];}if(_0x28ebd1[_0x349e('0x99')][_0x349e('0x93')]&&_0x28ebd1[_0x349e('0x99')]['List']['Contacts'][_0x349e('0x3c')]){return _0x28ebd1[_0x349e('0x99')]['List'][_0x349e('0x94')][0x0];}var _0x13c863=_[_0x349e('0x9')](_0x199844[_0x349e('0x4b')],{'firstName':_0x199844[_0x349e('0x4b')][_0x349e('0x8c')],'ListId':_0x5cad2c[_0x349e('0x8b')]});_0x13c863[_0x199844['body']['mapKey']]=_0x199844[_0x349e('0x4b')][_0x349e('0x8c')];return db['CmContact'][_0x349e('0x52')](_0x13c863,{'fields':_0x17a9be,'raw':!![]});}})[_0x349e('0x13')](handleEntityNotFound(_0x1739f8,null))[_0x349e('0x13')](function(_0x28af59){_0x28ebd1[_0x349e('0x9f')]=_0x28af59;var _0x45b78a=_0x199844['body'][_0x349e('0xa0')];if(_0x199844['headers']['cf-connecting-ip']){_0x45b78a=_0x199844[_0x349e('0x81')][_0x349e('0xa1')];}else if(_0x199844[_0x349e('0x81')][_0x349e('0xa2')]){_0x45b78a=_['first'](_0x199844[_0x349e('0x81')][_0x349e('0xa2')][_0x349e('0xa3')](','));}if(_0x28af59){var _0x53ab06={'ContactId':_0x28af59['id'],'ChatWebsiteId':_0x199844[_0x349e('0x49')]['id'],'from':(_0x28af59[_0x349e('0xa4')]||'')+'\x20'+(_0x28af59[_0x349e('0xa5')]||''),'customerIp':_0x45b78a,'customerPort':_0x199844[_0x349e('0x81')][_0x349e('0xa6')]?_0x199844[_0x349e('0x81')]['x-real-port']:null,'referer':_0x199844['body'][_0x349e('0xa7')],'browserName':_0x2dd88c[_0x349e('0xa8')]['name']&&_0x2dd88c[_0x349e('0xa8')][_0x349e('0xa9')]?util[_0x349e('0xaa')](_0x349e('0xab'),_0x2dd88c['browser']['name'],_0x2dd88c[_0x349e('0xa8')][_0x349e('0xa9')]):_0x349e('0xac'),'browserVersion':_0x2dd88c[_0x349e('0xa8')]['version']||_0x349e('0xac'),'osName':util[_0x349e('0xaa')](_0x349e('0xab'),_0x2dd88c['os'][_0x349e('0x2c')],_0x2dd88c['os'][_0x349e('0xa9')]),'osVersion':_0x2dd88c['os'][_0x349e('0xa9')],'deviceModel':_0x2dd88c[_0x349e('0xad')][_0x349e('0x39')]&&_0x2dd88c[_0x349e('0xad')][_0x349e('0xae')]?util[_0x349e('0xaa')]('%s\x20%s\x20%s',_0x2dd88c[_0x349e('0xad')]['model'],_0x2dd88c['device'][_0x349e('0xae')],_0x2dd88c['device'][_0x349e('0x33')]):null,'deviceVendor':_0x2dd88c[_0x349e('0xad')][_0x349e('0xae')],'deviceType':_0x2dd88c['device'][_0x349e('0x33')],'formData':JSON['stringify'](_0x199844[_0x349e('0x4b')])};var _0x30a6fe={'ChatWebsiteId':_0x199844['params']['id'],'closed':![]};if(_0x199844['body'][_0x349e('0xaf')]){_0x30a6fe['threadId']=_0x199844[_0x349e('0x4b')]['threadId'];return db[_0x349e('0xb0')][_0x349e('0x50')]({'where':_0x30a6fe})[_0x349e('0x13')](function(_0x2f687e){if(_0x2f687e){return[_0x2f687e,![]];}_0x53ab06['threadId']=_0x199844[_0x349e('0x4b')]['threadId'];_0x53ab06[_0x349e('0xb1')]=_0x199844[_0x349e('0x4b')][_0x349e('0xb1')];return db['ChatInteraction']['create'](_0x53ab06)[_0x349e('0x13')](function(_0x379550){return[_0x379550,!![]];});});}_0x30a6fe['ContactId']=_0x28af59['id'];if(_0x199844[_0x349e('0x4b')][_0x349e('0xb2')]&&_0x199844[_0x349e('0x4b')][_0x349e('0xb2')]['id']){_0x30a6fe['id']=_0x199844['body'][_0x349e('0xb2')]['id'];return db['ChatInteraction']['find']({'where':_0x30a6fe})[_0x349e('0x13')](function(_0x5c89c1){if(_0x5c89c1){return[_0x5c89c1,![]];}return db[_0x349e('0xb0')][_0x349e('0x52')](_0x53ab06)[_0x349e('0x13')](function(_0x45c626){return[_0x45c626,!![]];});});}return db[_0x349e('0xb0')][_0x349e('0x52')](_0x53ab06)[_0x349e('0x13')](function(_0x3b0808){return[_0x3b0808,!![]];});}})['spread'](function(_0xa09a2e,_0x35e267){if(_0xa09a2e){_0x394c31=_0x35e267;if(!_0x35e267){var _0x285233={'from':(_0x28ebd1[_0x349e('0x9f')]['firstName']||'')+'\x20'+(_0x28ebd1[_0x349e('0x9f')][_0x349e('0xa5')]||'')};if(_0x199844[_0x349e('0x4b')][_0x349e('0xaf')]&&_0x199844[_0x349e('0x4b')][_0x349e('0xb3')]&&_0x199844[_0x349e('0x4b')][_0x349e('0xaf')]!=_0x199844['body'][_0x349e('0xb3')]){_0x285233[_0x349e('0xaf')]=_0x199844[_0x349e('0x4b')][_0x349e('0xb3')];}return _0xa09a2e['update'](_0x285233);}else{return _0xa09a2e;}}})[_0x349e('0x13')](function(_0x8a0f78){_0x28ebd1[_0x349e('0xb2')]=_0x8a0f78[_0x349e('0x28')]({'plain':!![]});_0x28ebd1[_0x349e('0xb2')][_0x349e('0xb4')]=_0x394c31;if(_0x28ebd1[_0x349e('0xb2')][_0x349e('0xb4')]){if(_0x28ebd1[_0x349e('0x99')]['autoclose']){_0x28ebd1[_0x349e('0x9a')][_0x349e('0xb5')]({'id':0x0,'priority':_0x28ebd1[_0x349e('0x9a')][_0x349e('0x3c')]+0x1,'app':_0x349e('0xb6'),'appdata':'unmanaged','interval':_0x349e('0xb7')});}}return db['ChatMessage'][_0x349e('0x52')]({'body':_0x199844[_0x349e('0x4b')][_0x349e('0x4b')],'ChatWebsiteId':_0x199844[_0x349e('0x49')]['id'],'ChatInteractionId':_0x8a0f78['id'],'direction':'in','ContactId':_0x28ebd1[_0x349e('0x9f')]['id'],'AttachmentId':_0x199844[_0x349e('0x4b')]['AttachmentId']});})['then'](function(_0x523506){_0x28ebd1[_0x349e('0x1c')]=_0x523506;if(_0x28ebd1['interaction'][_0x349e('0xb8')]){return db[_0x349e('0xb9')][_0x349e('0x50')]({'attributes':['id','name'],'where':{'id':_0x28ebd1['interaction'][_0x349e('0xb8')]}})[_0x349e('0x13')](function(_0x5f3ff4){if(_0x5f3ff4){_0x28ebd1[_0x349e('0x9a')][_0x349e('0xba')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5f3ff4[_0x349e('0x2c')]+','+(_0x28ebd1[_0x349e('0x99')][_0x349e('0xbb')]||0xa),'interval':_0x349e('0xb7')});_0x28ebd1[_0x349e('0xbc')]=!![];}return respondWithRpcPromise('Start',_0x349e('0xbd'),_0x28ebd1);});}return respondWithRpcPromise(_0x349e('0xbe'),_0x349e('0xbd'),_0x28ebd1);})[_0x349e('0x13')](function(_0x4aab49){respondWithRpcPromise(_0x349e('0xbf'),_0x349e('0xbf'),{'event':_0x349e('0x7e'),'message':_0x4aab49},client9002);return _0x4aab49;})['then'](respondWithResult(_0x1739f8,null))[_0x349e('0x47')](handleError(_0x1739f8,null));};exports[_0x349e('0xc0')]=function(_0x35ba6b,_0x2409cb){var _0xc97dc6,_0x4c5aff,_0xd08627;var _0x49e7a6=[];var _0x1c4013={};var _0x447660=_0x35ba6b[_0x349e('0xc1')]||[];var _0x550e36=[];var _0x110581;return db[_0x349e('0x85')][_0x349e('0x54')]()['then'](function(_0x5346bd){if(!_0x5346bd){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))]('no\x20available\x20attributes');}_0x49e7a6=_[_0x349e('0x89')](_[_0x349e('0x36')](_0x5346bd),[_0x349e('0xc2'),'updatedAt',_0x349e('0x8a'),_0x349e('0x8b')]);if(_0x35ba6b[_0x349e('0x4b')]['id']){delete _0x35ba6b[_0x349e('0x4b')]['id'];}if(_[_0x349e('0x71')](_0x35ba6b[_0x349e('0x4b')]['from'])){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x8d')));}if(_[_0x349e('0x71')](_0x35ba6b[_0x349e('0x4b')]['body'])||_0x35ba6b[_0x349e('0x4b')][_0x349e('0x4b')]===''){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))][(_0x349e('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x35ba6b[_0x349e('0x4b')][_0x349e('0xc3')])){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))]['ValidationError'](_0x349e('0xc4')+_0x49e7a6));}if(!_[_0x349e('0x91')](_0x49e7a6,_0x35ba6b[_0x349e('0x4b')][_0x349e('0xc3')])){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))]['ValidationError'](_0x349e('0xc5')+_0x49e7a6));}_0x1c4013[_0x35ba6b[_0x349e('0x4b')]['mapKeyOffline']]=_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')];})['then'](function(){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x35ba6b[_0x349e('0x49')]['id']},'include':[{'model':db[_0x349e('0xc6')],'as':_0x349e('0x93')},{'model':db[_0x349e('0xc7')],'as':_0x349e('0xc7')}]});})[_0x349e('0x13')](handleEntityNotFound(_0x2409cb,null))[_0x349e('0x13')](function(_0xb4a4a){if(_0xb4a4a&&_0xb4a4a[_0x349e('0x93')]){_0x4c5aff=_0xb4a4a;var _0x1d38b6=_[_0x349e('0x9')](_0x35ba6b[_0x349e('0x4b')],{'firstName':_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')],'phone':_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')],'ListId':_0xb4a4a[_0x349e('0x8b')]});_0x1d38b6[_0x35ba6b['body'][_0x349e('0xc3')]]=_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')];return db[_0x349e('0x85')][_0x349e('0xc8')]({'where':_0x1c4013,'defaults':_0x1d38b6});}})[_0x349e('0xc9')](function(_0x44c0ef){if(_0x44c0ef){_0xd08627=_0x44c0ef;var _0x22ce44=fs[_0x349e('0xca')](path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0xcb')),_0x349e('0xcc'));var _0x1425e5=ejs['render'](_0x22ce44,{'body':_[_0x349e('0xcd')](_0x35ba6b[_0x349e('0x4b')]['body']),'bodyTitle':_0x4c5aff[_0x349e('0xce')]});return db[_0x349e('0xcf')][_0x349e('0x52')]({'body':_0x1425e5,'plainBody':htmlToText[_0x349e('0xd0')](_0x1425e5),'ContactId':_0x44c0ef['id'],'ChatWebsiteId':_0x4c5aff['id']});}})['then'](function(_0xbb12e7){_0x110581=_0xbb12e7;if(_0x447660[_0x349e('0x3c')]){var _0x495cc6=_0x447660[_0x349e('0x30')](function(_0x36a9a9){return{'name':_0x36a9a9[_0x349e('0xd1')],'basename':_0x36a9a9[_0x349e('0x65')],'type':_0x36a9a9[_0x349e('0xd2')],'ChatOfflineMessageId':_0xbb12e7['id']};});_0x550e36=_0x495cc6[_0x349e('0x30')](_0x21ddc5=>{var _0x4a42fb={'filename':_0x21ddc5[_0x349e('0x2c')],'path':path[_0x349e('0x73')](config['root'],_0x349e('0xd3'),_0x349e('0xc1'),'attachments',_0x349e('0xd4'),_0x21ddc5[_0x349e('0xd5')])};return _0x4a42fb;});if(!_0x4c5aff[_0x349e('0xd6')]){return db[_0x349e('0xd7')][_0x349e('0xd8')](function(_0x490ff1){return db[_0x349e('0xd9')][_0x349e('0xda')](_0x495cc6,{'transaction':_0x490ff1});});}}})[_0x349e('0x13')](function(){if(_0x110581){_0xc97dc6=_0x110581;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x349e('0xdb')],'as':_0x349e('0xdc'),'raw':!![],'include':[{'model':db[_0x349e('0xdd')],'as':_0x349e('0xdd'),'raw':!![]}]}]});}})['then'](function(_0x5b0f17){if(_0x5b0f17&&_0x5b0f17[_0x349e('0xdc')]&&_0x4c5aff[_0x349e('0xde')]&&_0x4c5aff[_0x349e('0xdf')]){var _0x4109be=_0x5b0f17[_0x349e('0xe0')]();return respondWithRpcPromise(_0x349e('0xe1'),_0x349e('0xe2'),{'account':_0x4109be,'message':{'from':util[_0x349e('0xaa')](_0x349e('0xe3'),_0x5b0f17[_0x349e('0x2c')],_0x5b0f17[_0x349e('0xe4')]||_0x5b0f17[_0x349e('0xdc')][_0x349e('0x4c')]),'to':_0x4c5aff[_0x349e('0xdf')],'subject':_0x4c5aff[_0x349e('0xe5')],'html':_0xc97dc6[_0x349e('0x4b')],'attachments':_0x550e36}},client9003)[_0x349e('0x13')](function(){return _0xc97dc6;})['catch'](function(_0x1fc787){logger[_0x349e('0x1a')](_0x1fc787);});}})[_0x349e('0x13')](function(){if(_0x4c5aff&&_0x4c5aff[_0x349e('0xd6')]&&_0x4c5aff[_0x349e('0xe6')]){var _0x4c8081=[];if(_0x447660[_0x349e('0x3c')]){_0x4c8081=_0x447660['map'](function(_0x12d010){return{'name':_0x12d010['originalname'],'basename':_0x12d010[_0x349e('0x65')],'type':_0x12d010[_0x349e('0xd2')],'ChatOfflineMessageId':_0x110581['id']};});}var _0x26169d;if(!_[_0x349e('0x71')](_0x4c5aff[_0x349e('0xe7')])){var _0x12b819=_[_0x349e('0x30')](_0x35ba6b[_0x349e('0x4b')],function(_0x363ca0){return _0x363ca0;});var _0x1256cb=_['toPairsIn'](_0x12b819)[0x0];var _0x5c225f=_[_0x349e('0xe8')](_0x1256cb,function(_0x11532a){return _0x11532a;});_0x26169d=_0x5c225f[0x1][_0x4c5aff[_0x349e('0xe7')]];}var _0x530b28={'from':_0xd08627['email'],'firstName':_0xd08627[_0x349e('0xa4')],'lastName':_0xd08627['lastName'],'mapKey':'email','message':{'from':_0xd08627[_0x349e('0xe4')],'to':_0x4c5aff[_0x349e('0xc7')][_0x349e('0xe4')],'cc':'','subject':_[_0x349e('0x71')](_0x26169d)?_0x4c5aff[_0x349e('0xe5')]:_0x26169d,'messageId':'','sentAt':new Date(),'attach':_0x4c8081['length'],'attachments':_0x4c8081,'originChannel':'Chat','ChatWebsiteId':_0x4c5aff['id'],'ChatOfflineMessageId':_0xc97dc6['id'],'originTo':_0x4c5aff['MailAccount'][_0x349e('0xe4')]},'body':_0xc97dc6[_0x349e('0x4b')]};var _0x56e974={'account':{'id':_0x4c5aff[_0x349e('0xe6')]},'body':_0x530b28,'log':_0x349e('0xe9')};return respondWithRpcPromise(_0x349e('0xe9'),_0x349e('0xea'),_0x56e974,client9001)[_0x349e('0x13')](function(){return _0xc97dc6;})[_0x349e('0x47')](function(_0x1fa04e){logger[_0x349e('0x1a')](_0x1fa04e);});}return;})[_0x349e('0x13')](function(){if(_0xc97dc6){return _0xc97dc6;}})[_0x349e('0x13')](respondWithResult(_0x2409cb,null))[_0x349e('0x47')](function(_0x45283b){logger[_0x349e('0x1a')](_0x349e('0x47'),_0x45283b);for(var _0x4f67d6 of _0x447660){var _0x16af1a=path['join'](config[_0x349e('0x6d')],_0x349e('0xd3'),'files','attachments',_0x349e('0xd4'),_0x4f67d6[_0x349e('0x65')]);fs_extra['remove'](_0x16af1a)[_0x349e('0x47')](function(_0x237d5e){logger[_0x349e('0x1a')]('Could\x20not\x20remove\x20attachment\x20file',_0x16af1a,_0x237d5e);});}});};exports[_0x349e('0xeb')]=function(_0x116486,_0x83b849){return db[_0x349e('0xb0')][_0x349e('0x50')]({'where':{'id':_0x116486[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x83b849,null))[_0x349e('0x13')](function(_0x4a3a78){if(_0x4a3a78){return _0x4a3a78[_0x349e('0xeb')](_0x116486[_0x349e('0x4b')]['ids'],_['omit'](_0x116486[_0x349e('0x4b')],['ids','id'])||{});}})[_0x349e('0x13')](respondWithResult(_0x83b849,null))[_0x349e('0x47')](handleError(_0x83b849,null));};exports[_0x349e('0xec')]=function(_0x214c00,_0x57f90a){var _0x5ca8ee={'raw':![],'where':{}};var _0x2d6ac6={};var _0x31e7b0={'count':0x0,'rows':[]};return db[_0x349e('0x31')]['findOne']({'where':{'id':_0x214c00[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x57f90a,null))[_0x349e('0x13')](function(_0x30ebdc){if(_0x30ebdc){_0x2d6ac6[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0xb0')][_0x349e('0x61')]);_0x2d6ac6['query']=_[_0x349e('0x36')](_0x214c00['query']);_0x2d6ac6[_0x349e('0x37')]=_[_0x349e('0x38')](_0x2d6ac6[_0x349e('0x39')],_0x2d6ac6[_0x349e('0x35')]);_0x5ca8ee[_0x349e('0x3b')]=_['intersection'](_0x2d6ac6[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x214c00[_0x349e('0x35')][_0x349e('0x3a')]));_0x5ca8ee[_0x349e('0x3b')]=_0x5ca8ee['attributes'][_0x349e('0x3c')]?_0x5ca8ee[_0x349e('0x3b')]:_0x2d6ac6[_0x349e('0x39')];if(!_0x214c00[_0x349e('0x35')][_0x349e('0x59')]('nolimit')){_0x5ca8ee[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x214c00[_0x349e('0x35')][_0x349e('0x23')]);_0x5ca8ee['offset']=qs[_0x349e('0x21')](_0x214c00[_0x349e('0x35')][_0x349e('0x21')]);}_0x5ca8ee[_0x349e('0x5a')]=qs['sort'](_0x214c00[_0x349e('0x35')][_0x349e('0x3e')]);_0x5ca8ee['where']=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x214c00[_0x349e('0x35')],_0x2d6ac6[_0x349e('0x37')]));_0x5ca8ee[_0x349e('0x3f')][_0x349e('0x55')]=_0x30ebdc['id'];if(_0x214c00['query'][_0x349e('0x41')]){_0x5ca8ee['where']=_[_0x349e('0x42')](_0x5ca8ee[_0x349e('0x3f')],{'$or':_[_0x349e('0x30')](_0x5ca8ee['attributes'],function(_0x8f9dce){var _0x3a8c4c={};_0x3a8c4c[_0x8f9dce]={'$like':'%'+_0x214c00[_0x349e('0x35')]['filter']+'%'};return _0x3a8c4c;})});}_0x5ca8ee=_['merge']({},_0x5ca8ee,_0x214c00[_0x349e('0x5b')]);return db['ChatInteraction'][_0x349e('0x22')]({'where':_0x5ca8ee[_0x349e('0x3f')]})['then'](function(_0x46ba31){_0x31e7b0[_0x349e('0x22')]=_0x46ba31;if(_0x214c00[_0x349e('0x35')]['includeAll']){_0x5ca8ee[_0x349e('0x44')]=[{'model':db['CmContact'],'as':_0x349e('0xed'),'required':![]},{'model':db[_0x349e('0xb9')],'as':_0x349e('0xee'),'attributes':['name',_0x349e('0xef'),_0x349e('0xf0')],'required':![]},{'model':db['Tag'],'as':_0x349e('0xf1'),'attributes':['id',_0x349e('0x2c'),_0x349e('0xf2')],'where':_0x214c00['query'][_0x349e('0xf3')]?{'id':_0x214c00[_0x349e('0x35')][_0x349e('0xf3')]}:undefined,'required':_0x214c00[_0x349e('0x35')][_0x349e('0xf3')]?!![]:![]}];}return db[_0x349e('0xb0')][_0x349e('0x45')](_0x5ca8ee);})[_0x349e('0x13')](function(_0x13a125){_0x31e7b0[_0x349e('0x46')]=_0x13a125;return _0x31e7b0;});}})[_0x349e('0x13')](respondWithFilteredResult(_0x57f90a,_0x5ca8ee))[_0x349e('0x47')](handleError(_0x57f90a,null));};function iftimePromise(_0x44ff12,_0x41dc25){return respondWithRpcPromise(_0x349e('0xf4'),_0x349e('0xf5'),{'command':_0x41dc25[_0x349e('0xf6')]?util[_0x349e('0xaa')]('iftime\x20%s,%s',_0x44ff12[_0x349e('0xf7')],_0x41dc25[_0x349e('0xf6')]):util[_0x349e('0xaa')](_0x349e('0xf8'),_0x44ff12[_0x349e('0xf7')])},client9002)[_0x349e('0x13')](function(_0x4153a6){var _0x30f316=_0x4153a6&&_0x4153a6[_0x349e('0xf9')](_0x349e('0xfa'))>=0x0?!![]:![];logger['info'](_0x349e('0xfb'),_0x41dc25['id'],_0x44ff12['id'],_0x44ff12[_0x349e('0xf7')],_0x30f316?_0x349e('0xfc'):_0x349e('0xfd'),_0x41dc25[_0x349e('0xf6')]?_0x41dc25['timezone']:_0x349e('0xfe'));return _0x30f316;})['catch'](function(_0x4f6468){logger['error'](_0x349e('0xfb'),_0x41dc25['id'],_0x44ff12['id'],_0x44ff12[_0x349e('0xf7')],util[_0x349e('0xff')](_0x4f6468,{'showHidden':![],'depth':null}),_0x41dc25[_0x349e('0xf6')]?_0x41dc25[_0x349e('0xf6')]:_0x349e('0xfe'));return![];});}exports['getSnippet']=function(_0x20a007,_0x2faa4e){var _0xdcb99=0x0;var _0x1d8c8e=0x0;var _0x1485bd=![];var _0x2659b6;var _0x6e8323;return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x20a007[_0x349e('0x49')]['id']},'include':[{'model':db[_0x349e('0x100')],'as':_0x349e('0x100'),'include':[{'model':db[_0x349e('0x100')],'as':_0x349e('0x101'),'attributes':['id',_0x349e('0xf7')],'raw':!![]}]}]})[_0x349e('0x13')](handleEntityNotFound(_0x2faa4e,null))[_0x349e('0x13')](function(_0x2a48df){if(_0x2a48df){_0x2659b6=_0x2a48df;return _0x2a48df[_0x349e('0x102')]({'raw':!![]});}})[_0x349e('0x13')](function(_0x89e063){if(_0x2659b6){if(_0x89e063){_0x6e8323=_0x89e063;}}return require(_0x349e('0x103'))['getLicense']();})[_0x349e('0x13')](function(_0x3e4d9d){if(_0x3e4d9d){_0x1d8c8e=_0x3e4d9d[_0x349e('0x104')];_0x1485bd=_0x3e4d9d['custom'];}})[_0x349e('0x13')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x3911aa){_0xdcb99=_0x3911aa;if(_0x1d8c8e&&_0x3911aa>_0x1d8c8e){return db[_0x349e('0x105')][_0x349e('0x58')]({'where':{'id':0x1}})[_0x349e('0x13')](function(_0xba8e5a){if(_0xba8e5a){_0xba8e5a[_0x349e('0x106')](_0x349e('0x107'));}});}})[_0x349e('0x13')](function(){if(_0x2659b6[_0x349e('0x100')]&&_0x2659b6[_0x349e('0x100')][_0x349e('0x101')]){var _0x199b08=[];for(var _0x555c57=0x0;_0x555c57<_0x2659b6[_0x349e('0x100')]['Intervals'][_0x349e('0x3c')];_0x555c57++){var _0xcf4d2a=_0x2659b6[_0x349e('0x100')][_0x349e('0x101')][_0x555c57][_0x349e('0x28')]({'plain':!![]});_0x199b08[_0x349e('0xb5')](iftimePromise(_0xcf4d2a,_0x2659b6));}return BPromise[_0x349e('0x108')](_0x199b08)[_0x349e('0x13')](function(_0x362f2b){return _['some'](_0x362f2b);});}else{return!![];}})[_0x349e('0x13')](function(_0x5ef9a6){var _0x3c5d97=fs[_0x349e('0xca')](path['join'](config['root'],_0x349e('0x109')),_0x349e('0xcc'));var _0x572303={'remote':_0x2659b6[_0x349e('0x10a')],'query':querystring[_0x349e('0x19')](_[_0x349e('0x42')](_0x2659b6[_0x349e('0x28')]({'plain':!![]}),{'customerIp':_0x20a007[_0x349e('0x81')][_0x349e('0xa2')]||_0x20a007[_0x349e('0x81')]['x-real-ip']||_0x20a007['connection'][_0x349e('0x10b')]||_0x20a007['ip'],'referer':_0x20a007[_0x349e('0x81')][_0x349e('0xa7')],'openedInteractions':_0xdcb99,'maxInteractions':_0x1d8c8e,'virtual':_0x1485bd[_0x349e('0x104')],'online':_0x5ef9a6,'custom':_0x1485bd}))['replace'](/'/g,'\x5c\x27')};_0x2faa4e[_0x349e('0x2d')](ejs[_0x349e('0x10c')](Mustache[_0x349e('0x10c')](_0x3c5d97,_0x572303),{'proactiveActions':_0x6e8323,'alignment':_0x2659b6[_0x349e('0x10d')],'verticalAlignment':_0x2659b6[_0x349e('0x10e')],'div_color':_0x2659b6[_0x349e('0xf2')],'labelText':_0x2659b6['labelText'],'text_color':_0x2659b6['textColor'],'text_button_color':_0x2659b6[_0x349e('0x10f')],'button_color':_0x2659b6[_0x349e('0x110')],'background_color':_0x2659b6[_0x349e('0x111')],'hideWhenOffline':_0x2659b6[_0x349e('0x112')],'interval':_0x2659b6[_0x349e('0x113')]}));})[_0x349e('0x47')](handleError(_0x2faa4e,null));};exports['addApplications']=function(_0x8293d9,_0x59a823){var _0x26e8b5=_0x8293d9[_0x349e('0x49')]['id'];var _0x6bd0cd=_0x8293d9[_0x349e('0x4b')];var _0x4a95c4=0xc8;var _0x4a1f92=null;return db['sequelize'][_0x349e('0xd8')]({'isolationLevel':db['sequelize'][_0x349e('0x114')][_0x349e('0x115')][_0x349e('0x116')]},function(_0xdb1721){return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x26e8b5},'transaction':_0xdb1721})['then'](function(_0x13f59d){if(_0x13f59d){return db['ChatApplication'][_0x349e('0x27')]({'where':{'ChatWebsiteId':_0x26e8b5},'transaction':_0xdb1721})[_0x349e('0x13')](function(){var _0x77901c=_[_0x349e('0x30')](_0x6bd0cd,function(_0x52467b){_0x52467b[_0x349e('0x55')]=_0x26e8b5;return _0x52467b;});return db['ChatApplication'][_0x349e('0xda')](_0x77901c,{'transaction':_0xdb1721});});}else{_0x4a95c4=0x194;_0x4a1f92=[];}});})['then'](function(){if(_0x4a95c4!==0x194){return db[_0x349e('0x97')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x26e8b5},'order':_0x349e('0x9d')})['then'](function(_0x26fa8a){_0x4a1f92=_0x26fa8a;});}})[_0x349e('0x47')](function(_0x720286){_0x4a95c4=0x1f4;logger[_0x349e('0x1a')](_0x720286['stack']);if(_0x720286['name']){delete _0x720286[_0x349e('0x2c')];}_0x4a1f92=_0x720286;})[_0x349e('0x117')](function(){if(_0x4a1f92===null){_0x59a823['sendStatus'](_0x4a95c4);}else{if(_0x4a95c4===0x1f4){_0x59a823[_0x349e('0x1f')](_0x4a95c4)[_0x349e('0x2d')](_0x4a1f92);}else{_0x59a823['status'](_0x4a95c4)[_0x349e('0x20')](_0x4a1f92);}}});};exports[_0x349e('0x118')]=function(_0x4b90cd,_0x305e04){var _0x3c09e1={};var _0x5bf096={};var _0x241fd4;var _0x2a8933;return db['ChatWebsite']['findOne']({'where':{'id':_0x4b90cd[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x305e04,null))['then'](function(_0xe36937){if(_0xe36937){_0x241fd4=_0xe36937;_0x5bf096[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0x97')][_0x349e('0x61')]);_0x5bf096[_0x349e('0x35')]=_['keys'](_0x4b90cd[_0x349e('0x35')]);_0x5bf096[_0x349e('0x37')]=_[_0x349e('0x38')](_0x5bf096[_0x349e('0x39')],_0x5bf096[_0x349e('0x35')]);_0x3c09e1[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x5bf096['model'],qs[_0x349e('0x3a')](_0x4b90cd['query'][_0x349e('0x3a')]));_0x3c09e1[_0x349e('0x3b')]=_0x3c09e1[_0x349e('0x3b')]['length']?_0x3c09e1['attributes']:_0x5bf096[_0x349e('0x39')];_0x3c09e1[_0x349e('0x5a')]=qs[_0x349e('0x3e')](_0x4b90cd[_0x349e('0x35')][_0x349e('0x3e')]);_0x3c09e1[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x4b90cd[_0x349e('0x35')],_0x5bf096['filters']));if(_0x4b90cd[_0x349e('0x35')][_0x349e('0x41')]){_0x3c09e1['where']=_['merge'](_0x3c09e1[_0x349e('0x3f')],{'$or':_[_0x349e('0x30')](_0x3c09e1['attributes'],function(_0x4d4112){var _0x55a88f={};_0x55a88f[_0x4d4112]={'$like':'%'+_0x4b90cd[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x55a88f;})});}_0x3c09e1=_[_0x349e('0x42')]({},_0x3c09e1,_0x4b90cd[_0x349e('0x5b')]);return _0x241fd4[_0x349e('0x118')](_0x3c09e1);}})[_0x349e('0x13')](function(_0x4eb664){if(_0x4eb664){_0x2a8933=_0x4eb664[_0x349e('0x3c')];if(!_0x4b90cd[_0x349e('0x35')][_0x349e('0x59')](_0x349e('0x3d'))){_0x3c09e1[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x4b90cd['query'][_0x349e('0x23')]);_0x3c09e1[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x4b90cd[_0x349e('0x35')][_0x349e('0x21')]);}return _0x241fd4[_0x349e('0x118')](_0x3c09e1);}})[_0x349e('0x13')](function(_0x36c128){if(_0x36c128){return _0x36c128?{'count':_0x2a8933,'rows':_0x36c128}:null;}})[_0x349e('0x13')](respondWithResult(_0x305e04,null))[_0x349e('0x47')](handleError(_0x305e04,null));};exports[_0x349e('0x119')]=function(_0x30e64f,_0x4c0153){return db[_0x349e('0x11a')][_0x349e('0x50')]({'where':{'id':_0x30e64f[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c0153,null))[_0x349e('0x13')](function(_0x24b688){if(_0x24b688){return _0x24b688[_0x349e('0x119')](_0x30e64f['body']['ids'],_[_0x349e('0x11b')](_0x30e64f[_0x349e('0x4b')],[_0x349e('0x5d'),'id'])||{});}})[_0x349e('0x13')](respondWithResult(_0x4c0153,null))['catch'](handleError(_0x4c0153,null));};exports[_0x349e('0x102')]=function(_0x5c1d49,_0x4b2044){var _0x21e9c9={};var _0x49485b={};var _0x277e12;var _0xf852f8;return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x5c1d49[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x4b2044,null))[_0x349e('0x13')](function(_0x4b56bc){if(_0x4b56bc){_0x277e12=_0x4b56bc;_0x49485b[_0x349e('0x39')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x49485b[_0x349e('0x35')]=_[_0x349e('0x36')](_0x5c1d49[_0x349e('0x35')]);_0x49485b[_0x349e('0x37')]=_['intersection'](_0x49485b[_0x349e('0x39')],_0x49485b[_0x349e('0x35')]);_0x21e9c9[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x49485b[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x5c1d49[_0x349e('0x35')][_0x349e('0x3a')]));_0x21e9c9['attributes']=_0x21e9c9['attributes'][_0x349e('0x3c')]?_0x21e9c9[_0x349e('0x3b')]:_0x49485b[_0x349e('0x39')];_0x21e9c9['order']=qs[_0x349e('0x3e')](_0x5c1d49[_0x349e('0x35')][_0x349e('0x3e')]);_0x21e9c9[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x5c1d49[_0x349e('0x35')],_0x49485b[_0x349e('0x37')]));if(_0x5c1d49[_0x349e('0x35')][_0x349e('0x41')]){_0x21e9c9['where']=_[_0x349e('0x42')](_0x21e9c9['where'],{'$or':_['map'](_0x21e9c9[_0x349e('0x3b')],function(_0x43efb0){var _0x51cdda={};_0x51cdda[_0x43efb0]={'$like':'%'+_0x5c1d49[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x51cdda;})});}_0x21e9c9=_[_0x349e('0x42')]({},_0x21e9c9,_0x5c1d49['options']);return _0x277e12[_0x349e('0x102')](_0x21e9c9);}})[_0x349e('0x13')](function(_0x56198f){if(_0x56198f){_0xf852f8=_0x56198f[_0x349e('0x3c')];if(!_0x5c1d49['query'][_0x349e('0x59')](_0x349e('0x3d'))){_0x21e9c9[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x5c1d49[_0x349e('0x35')][_0x349e('0x23')]);_0x21e9c9[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x5c1d49[_0x349e('0x35')]['offset']);}return _0x277e12[_0x349e('0x102')](_0x21e9c9);}})[_0x349e('0x13')](function(_0x11dba5){if(_0x11dba5){return _0x11dba5?{'count':_0xf852f8,'rows':_0x11dba5}:null;}})['then'](respondWithResult(_0x4b2044,null))[_0x349e('0x47')](handleError(_0x4b2044,null));};exports[_0x349e('0x11c')]=function(_0x243937,_0xfd06d7){var _0x5c7b9d=_0x243937[_0x349e('0x35')][_0x349e('0x11d')]===_0x349e('0x11e')?_0x349e('0x11f'):_0x349e('0x120');return db[_0x349e('0x31')][_0x349e('0x50')]({'attributes':['id',_0x5c7b9d],'where':{'id':_0x243937[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0xfd06d7,null))[_0x349e('0x13')](function(_0x1a7d41){if(_0x1a7d41){var _0x78e426=_0x1a7d41[_0x5c7b9d];var _0x328a1c=_0x78e426&&_0x78e426[_0x349e('0x121')]?_0x78e426['items']:[];_0xfd06d7[_0x349e('0x2d')]({'fromKey':_['isNil'](_0x78e426[_0x349e('0x122')])?undefined:_0x78e426[_0x349e('0x122')],'count':_0x328a1c[_0x349e('0x3c')],'rows':_0x328a1c});}})['catch'](handleError(_0xfd06d7,null));};exports['getOfflineMessages']=function(_0xc17f3d,_0x47fdc1){var _0x4996c2={'raw':![],'where':{}};var _0x138fb7={};var _0xd8e0a6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x349e('0x58')]({'where':{'id':_0xc17f3d[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x47fdc1,null))[_0x349e('0x13')](function(_0x29aa4c){if(_0x29aa4c){_0x138fb7['model']=_[_0x349e('0x36')](db[_0x349e('0xcf')][_0x349e('0x61')]);_0x138fb7[_0x349e('0x35')]=_['keys'](_0xc17f3d[_0x349e('0x35')]);_0x138fb7[_0x349e('0x37')]=_['intersection'](_0x138fb7[_0x349e('0x39')],_0x138fb7['query']);_0x4996c2[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x138fb7['model'],qs['fields'](_0xc17f3d[_0x349e('0x35')][_0x349e('0x3a')]));_0x4996c2[_0x349e('0x3b')]=_0x4996c2[_0x349e('0x3b')]['length']?_0x4996c2[_0x349e('0x3b')]:_0x138fb7['model'];if(!_0xc17f3d[_0x349e('0x35')][_0x349e('0x59')]('nolimit')){_0x4996c2[_0x349e('0x23')]=qs[_0x349e('0x23')](_0xc17f3d[_0x349e('0x35')]['limit']);_0x4996c2['offset']=qs[_0x349e('0x21')](_0xc17f3d[_0x349e('0x35')][_0x349e('0x21')]);}_0x4996c2['order']=qs[_0x349e('0x3e')](_0xc17f3d[_0x349e('0x35')][_0x349e('0x3e')]);_0x4996c2[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0xc17f3d[_0x349e('0x35')],_0x138fb7['filters']));_0x4996c2[_0x349e('0x3f')][_0x349e('0x55')]=_0x29aa4c['id'];if(_0xc17f3d[_0x349e('0x35')][_0x349e('0x41')]){_0x4996c2[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x4996c2['where'],{'$or':_[_0x349e('0x30')](_0x4996c2[_0x349e('0x3b')],function(_0x2e83e2){var _0xf981e8={};_0xf981e8[_0x2e83e2]={'$like':'%'+_0xc17f3d[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0xf981e8;})});}_0x4996c2=_[_0x349e('0x42')]({},_0x4996c2,_0xc17f3d[_0x349e('0x5b')]);return db[_0x349e('0xcf')][_0x349e('0x22')]({'where':_0x4996c2[_0x349e('0x3f')]})[_0x349e('0x13')](function(_0x4f6832){_0xd8e0a6[_0x349e('0x22')]=_0x4f6832;if(_0xc17f3d[_0x349e('0x35')][_0x349e('0x4a')]){_0x4996c2[_0x349e('0x44')]=[{'all':!![]}];}else{_0x4996c2['include']=[{'model':db['CmContact'],'as':_0x349e('0xed'),'required':![]},{'model':db[_0x349e('0xd9')],'as':_0x349e('0x123'),'required':![]}];}return db['ChatOfflineMessage'][_0x349e('0x45')](_0x4996c2);})[_0x349e('0x13')](function(_0x4c592a){_0xd8e0a6[_0x349e('0x46')]=_0x4c592a;return _0xd8e0a6;});}})[_0x349e('0x13')](respondWithFilteredResult(_0x47fdc1,_0x4996c2))[_0x349e('0x47')](handleError(_0x47fdc1,null));};exports['addAgents']=function(_0x3ca516,_0x3394f5){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x3ca516[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x3394f5,null))[_0x349e('0x13')](function(_0x505f46){if(_0x505f46){return _0x505f46[_0x349e('0x124')](_0x3ca516[_0x349e('0x4b')][_0x349e('0x5d')],_[_0x349e('0x11b')](_0x3ca516['body'],[_0x349e('0x5d'),'id'])||{})['spread'](function(_0x11e32a){for(var _0x2366b4=0x0;_0x2366b4<_0x3ca516[_0x349e('0x4b')][_0x349e('0x5d')]['length'];_0x2366b4+=0x1){socket[_0x349e('0x125')](_0x349e('0x126'),{'UserId':Number(_0x3ca516[_0x349e('0x4b')][_0x349e('0x5d')][_0x2366b4]),'ChatWebsiteId':Number(_0x3ca516[_0x349e('0x49')]['id'])});}return _0x11e32a;});}})[_0x349e('0x13')](respondWithResult(_0x3394f5,null))[_0x349e('0x47')](handleError(_0x3394f5,null));};exports[_0x349e('0x127')]=function(_0x57e537,_0x2dce5f){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x57e537[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x2dce5f,null))[_0x349e('0x13')](function(_0x543aa7){if(_0x543aa7){return _0x543aa7[_0x349e('0x127')](_0x57e537[_0x349e('0x35')][_0x349e('0x5d')])[_0x349e('0x13')](function(){if(_[_0x349e('0x128')](_0x57e537[_0x349e('0x35')][_0x349e('0x5d')])){for(var _0xc0ecdb=0x0;_0xc0ecdb<_0x57e537['query'][_0x349e('0x5d')]['length'];_0xc0ecdb+=0x1){socket[_0x349e('0x125')](_0x349e('0x129'),{'UserId':Number(_0x57e537[_0x349e('0x35')][_0x349e('0x5d')][_0xc0ecdb]),'ChatWebsiteId':Number(_0x57e537['params']['id'])});}}else{socket[_0x349e('0x125')](_0x349e('0x129'),{'UserId':Number(_0x57e537[_0x349e('0x35')][_0x349e('0x5d')]),'ChatWebsiteId':Number(_0x57e537[_0x349e('0x49')]['id'])});}});}})[_0x349e('0x13')](respondWithStatusCode(_0x2dce5f,null))[_0x349e('0x47')](handleError(_0x2dce5f,null));};exports[_0x349e('0x12a')]=function(_0x29a87c,_0x45156f){var _0x3cb3be={};var _0x44bc51={};var _0x50c044;var _0x3bf043;return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x29a87c[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x45156f,null))[_0x349e('0x13')](function(_0x5324a6){if(_0x5324a6){_0x50c044=_0x5324a6;_0x44bc51[_0x349e('0x39')]=_['keys'](db[_0x349e('0xb9')]['rawAttributes']);_0x44bc51['query']=_[_0x349e('0x36')](_0x29a87c[_0x349e('0x35')]);_0x44bc51[_0x349e('0x37')]=_[_0x349e('0x38')](_0x44bc51[_0x349e('0x39')],_0x44bc51[_0x349e('0x35')]);_0x3cb3be[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x44bc51[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x29a87c['query'][_0x349e('0x3a')]));_0x3cb3be[_0x349e('0x3b')]=_0x3cb3be[_0x349e('0x3b')][_0x349e('0x3c')]?_0x3cb3be['attributes']:_0x44bc51[_0x349e('0x39')];_0x3cb3be[_0x349e('0x5a')]=qs[_0x349e('0x3e')](_0x29a87c['query'][_0x349e('0x3e')]);_0x3cb3be[_0x349e('0x3f')]=qs['filters'](_['pick'](_0x29a87c[_0x349e('0x35')],_0x44bc51[_0x349e('0x37')]));if(_0x29a87c[_0x349e('0x35')][_0x349e('0x41')]){_0x3cb3be[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x3cb3be[_0x349e('0x3f')],{'$or':_['map'](_0x3cb3be['attributes'],function(_0x5dbf6b){var _0x13479b={};_0x13479b[_0x5dbf6b]={'$like':'%'+_0x29a87c[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x13479b;})});}_0x3cb3be=_[_0x349e('0x42')]({},_0x3cb3be,_0x29a87c[_0x349e('0x5b')]);return _0x50c044[_0x349e('0x12a')](_0x3cb3be);}})['then'](function(_0x2ec315){if(_0x2ec315){_0x3bf043=_0x2ec315[_0x349e('0x3c')];if(!_0x29a87c['query']['hasOwnProperty'](_0x349e('0x3d'))){_0x3cb3be[_0x349e('0x23')]=qs['limit'](_0x29a87c['query'][_0x349e('0x23')]);_0x3cb3be[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x29a87c[_0x349e('0x35')]['offset']);}return _0x50c044[_0x349e('0x12a')](_0x3cb3be);}})[_0x349e('0x13')](function(_0x5259aa){if(_0x5259aa){return _0x5259aa?{'count':_0x3bf043,'rows':_0x5259aa}:null;}})['then'](respondWithResult(_0x45156f,null))[_0x349e('0x47')](handleError(_0x45156f,null));}; \ No newline at end of file +var _0xf41c=['difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','DESC','Applications','account','List','applications','priority','asc','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','describe','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','render','toPairs','fromString','originalname','mimetype','server','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','attachments','remove','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','iftime\x20%s,%s','interval','timezone','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','virtual','custom','License','chatLicenseExceeded','some','server/files/chat/iframe.ejs','utf8','remote','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','length','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','keys','pick','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','sitepic','existsSync','join','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','isNil','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','user-agent','getResult','ValidationError','no\x20available\x20attributes'];(function(_0x3fd414,_0x2185c7){var _0x1ee59d=function(_0x5d21a2){while(--_0x5d21a2){_0x3fd414['push'](_0x3fd414['shift']());}};_0x1ee59d(++_0x2185c7);}(_0xf41c,0xa8));var _0xcf41=function(_0x166fec,_0xf34ed8){_0x166fec=_0x166fec-0x0;var _0xff6f55=_0xf41c[_0x166fec];return _0xff6f55;};'use strict';var BPromise=require(_0xcf41('0x0'));var Mustache=require(_0xcf41('0x1'));var util=require(_0xcf41('0x2'));var path=require(_0xcf41('0x3'));var ejs=require(_0xcf41('0x4'));var fs=require('fs');var fs_extra=require(_0xcf41('0x5'));var _=require(_0xcf41('0x6'));var querystring=require(_0xcf41('0x7'));var Redis=require(_0xcf41('0x8'));var qs=require(_0xcf41('0x9'));var logger=require(_0xcf41('0xa'))('api');var config=require(_0xcf41('0xb'));var db=require(_0xcf41('0xc'))['db'];config['redis']=_[_0xcf41('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcf41('0xe'))(new Redis(config['redis']));require(_0xcf41('0xf'))[_0xcf41('0x10')](socket);var htmlToText=require(_0xcf41('0x11'));var jayson=require(_0xcf41('0x12'));var client=jayson[_0xcf41('0x13')][_0xcf41('0x14')]({'port':0x232c});var client9002=jayson[_0xcf41('0x13')][_0xcf41('0x14')]({'port':0x232a});var client9003=jayson[_0xcf41('0x13')][_0xcf41('0x14')]({'port':0x232b});var client9001=jayson[_0xcf41('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3243e5,_0x41a64a,_0x525b34,_0x492c39){return new BPromise(function(_0x16477f,_0x13c0b9){var _0x1e190c=_0x492c39||client;return _0x1e190c[_0xcf41('0x15')](_0x3243e5,_0x525b34)['then'](function(_0xebc0d6){logger[_0xcf41('0x16')](_0xcf41('0x17'),_0x41a64a,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x41a64a,_0xcf41('0x18'),JSON[_0xcf41('0x19')](_0xebc0d6));if(_0xebc0d6[_0xcf41('0x1a')]){if(_0xebc0d6[_0xcf41('0x1a')][_0xcf41('0x1b')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x41a64a,_0xebc0d6[_0xcf41('0x1a')][_0xcf41('0x1c')]);return _0x13c0b9(_0xebc0d6[_0xcf41('0x1a')]['message']);}logger[_0xcf41('0x1a')](_0xcf41('0x17'),_0x41a64a,_0xebc0d6[_0xcf41('0x1a')]['message']);return _0x16477f(_0xebc0d6[_0xcf41('0x1a')][_0xcf41('0x1c')]);}else{logger[_0xcf41('0x16')](_0xcf41('0x17'),_0x41a64a,_0xcf41('0x18'));_0x16477f(_0xebc0d6['result'][_0xcf41('0x1c')]);}})[_0xcf41('0x1d')](function(_0x2a3452){logger['error'](_0xcf41('0x17'),_0x41a64a,_0x2a3452);_0x13c0b9(_0x2a3452);});});}function respondWithStatusCode(_0x50c30c,_0x265966){_0x265966=_0x265966||0xcc;return function(_0x283053){if(_0x283053){return _0x50c30c[_0xcf41('0x1e')](_0x265966);}return _0x50c30c['status'](_0x265966)[_0xcf41('0x1f')]();};}function respondWithResult(_0x192bbb,_0x3e3734){_0x3e3734=_0x3e3734||0xc8;return function(_0x26078b){if(_0x26078b){return _0x192bbb[_0xcf41('0x20')](_0x3e3734)[_0xcf41('0x21')](_0x26078b);}};}function respondWithFilteredResult(_0x48d633,_0x349b7b){return function(_0x244c25){if(_0x244c25){var _0x593b61=typeof _0x349b7b[_0xcf41('0x22')]===_0xcf41('0x23')&&typeof _0x349b7b[_0xcf41('0x24')]==='undefined';var _0x1efdea=_0x244c25[_0xcf41('0x25')];var _0x182a36=_0x593b61?0x0:_0x349b7b[_0xcf41('0x22')];var _0x422921=_0x593b61?_0x244c25[_0xcf41('0x25')]:_0x349b7b['offset']+_0x349b7b[_0xcf41('0x24')];var _0x2d1a86;if(_0x422921>=_0x1efdea){_0x422921=_0x1efdea;_0x2d1a86=0xc8;}else{_0x2d1a86=0xce;}_0x48d633[_0xcf41('0x20')](_0x2d1a86);return _0x48d633['set'](_0xcf41('0x26'),_0x182a36+'-'+_0x422921+'/'+_0x1efdea)[_0xcf41('0x21')](_0x244c25);}return null;};}function saveUpdates(_0x31f077){return function(_0xb13b61){if(_0xb13b61){return _0xb13b61[_0xcf41('0x27')](_0x31f077)[_0xcf41('0x28')](function(_0x2a8d4e){return _0x2a8d4e;});}return null;};}function removeEntity(_0x1bf66a){return function(_0x59f531){if(_0x59f531){return _0x59f531[_0xcf41('0x29')]()[_0xcf41('0x28')](function(){var _0x763002=_0x59f531[_0xcf41('0x2a')]({'plain':!![]});var _0x59a2d8=_0xcf41('0x2b');return db[_0xcf41('0x2c')][_0xcf41('0x29')]({'where':{'type':_0x59a2d8,'resourceId':_0x763002['id']}})['then'](function(){return _0x59f531;});})[_0xcf41('0x28')](function(){_0x1bf66a[_0xcf41('0x20')](0xcc)[_0xcf41('0x1f')]();});}};}function handleEntityNotFound(_0x11a148){return function(_0x143e32){if(!_0x143e32){_0x11a148['sendStatus'](0x194);}return _0x143e32;};}function handleError(_0x159320,_0x4cdb02){_0x4cdb02=_0x4cdb02||0x1f4;return function(_0x47eb5a){logger[_0xcf41('0x1a')](_0x47eb5a[_0xcf41('0x2d')]);if(_0x47eb5a[_0xcf41('0x2e')]){delete _0x47eb5a['name'];}_0x159320[_0xcf41('0x20')](_0x4cdb02)[_0xcf41('0x2f')](_0x47eb5a);};}exports[_0xcf41('0x30')]=function(_0x51d41e,_0x307ff3){var _0x43d6c6={'include':[{'model':db[_0xcf41('0x31')],'as':_0xcf41('0x32')}]},_0x93ee03={},_0x3420bd={'count':0x0,'rows':[]};var _0x3d767c=_['map'](db[_0xcf41('0x33')][_0xcf41('0x34')],function(_0x16f02e){return{'name':_0x16f02e[_0xcf41('0x35')],'type':_0x16f02e[_0xcf41('0x36')][_0xcf41('0x37')]};});_0x93ee03[_0xcf41('0x38')]=_[_0xcf41('0x39')](_0x3d767c,'name');_0x93ee03['query']=_['keys'](_0x51d41e[_0xcf41('0x3a')]);_0x93ee03[_0xcf41('0x3b')]=_[_0xcf41('0x3c')](_0x93ee03['model'],_0x93ee03[_0xcf41('0x3a')]);_0x43d6c6[_0xcf41('0x3d')]=_['intersection'](_0x93ee03['model'],qs['fields'](_0x51d41e[_0xcf41('0x3a')][_0xcf41('0x3e')]));_0x43d6c6[_0xcf41('0x3d')]=_0x43d6c6[_0xcf41('0x3d')]['length']?_0x43d6c6[_0xcf41('0x3d')]:_0x93ee03[_0xcf41('0x38')];if(!_0x51d41e[_0xcf41('0x3a')][_0xcf41('0x3f')](_0xcf41('0x40'))){_0x43d6c6[_0xcf41('0x24')]=qs[_0xcf41('0x24')](_0x51d41e[_0xcf41('0x3a')][_0xcf41('0x24')]);_0x43d6c6['offset']=qs[_0xcf41('0x22')](_0x51d41e[_0xcf41('0x3a')][_0xcf41('0x22')]);}_0x43d6c6[_0xcf41('0x41')]=qs[_0xcf41('0x42')](_0x51d41e[_0xcf41('0x3a')][_0xcf41('0x42')]);_0x43d6c6[_0xcf41('0x43')]=qs[_0xcf41('0x3b')](_['pick'](_0x51d41e[_0xcf41('0x3a')],_0x93ee03['filters']),_0x3d767c);if(_0x51d41e[_0xcf41('0x3a')]['filter']){_0x43d6c6[_0xcf41('0x43')]=_[_0xcf41('0x44')](_0x43d6c6[_0xcf41('0x43')],{'$or':_['map'](_0x3d767c,function(_0x5ec098){if(_0x5ec098[_0xcf41('0x36')]!==_0xcf41('0x45')){var _0x485b14={};_0x485b14[_0x5ec098[_0xcf41('0x2e')]]={'$like':'%'+_0x51d41e[_0xcf41('0x3a')][_0xcf41('0x46')]+'%'};return _0x485b14;}})});}_0x43d6c6=_[_0xcf41('0x44')]({},_0x43d6c6,_0x51d41e[_0xcf41('0x47')]);var _0x5bd074={'where':_0x43d6c6['where']};return db[_0xcf41('0x33')]['count'](_0x5bd074)[_0xcf41('0x28')](function(_0x27b0b0){_0x3420bd[_0xcf41('0x25')]=_0x27b0b0;if(_0x51d41e[_0xcf41('0x3a')][_0xcf41('0x48')]){_0x43d6c6[_0xcf41('0x49')]=[{'all':!![]}];}return db[_0xcf41('0x33')][_0xcf41('0x4a')](_0x43d6c6);})[_0xcf41('0x28')](function(_0x4f896b){_0x3420bd[_0xcf41('0x4b')]=_0x4f896b;return _0x3420bd;})['then'](respondWithFilteredResult(_0x307ff3,_0x43d6c6))['catch'](handleError(_0x307ff3,null));};exports['show']=function(_0x561c9f,_0x120fda){var _0x219120={'raw':![],'where':{'id':_0x561c9f['params']['id']},'include':[{'model':db[_0xcf41('0x31')],'as':_0xcf41('0x32')}]},_0x5055a5={};_0x5055a5[_0xcf41('0x38')]=_['keys'](db[_0xcf41('0x33')][_0xcf41('0x34')]);_0x5055a5[_0xcf41('0x3a')]=_['keys'](_0x561c9f[_0xcf41('0x3a')]);_0x5055a5['filters']=_[_0xcf41('0x3c')](_0x5055a5[_0xcf41('0x38')],_0x5055a5[_0xcf41('0x3a')]);_0x219120[_0xcf41('0x3d')]=_['intersection'](_0x5055a5[_0xcf41('0x38')],qs[_0xcf41('0x3e')](_0x561c9f[_0xcf41('0x3a')][_0xcf41('0x3e')]));_0x219120[_0xcf41('0x3d')]=_0x219120['attributes'][_0xcf41('0x4c')]?_0x219120[_0xcf41('0x3d')]:_0x5055a5[_0xcf41('0x38')];if(_0x561c9f[_0xcf41('0x3a')][_0xcf41('0x48')]){_0x219120[_0xcf41('0x49')]=[{'all':!![]}];}_0x219120=_[_0xcf41('0x44')]({},_0x219120,_0x561c9f['options']);return db['ChatWebsite'][_0xcf41('0x4d')](_0x219120)[_0xcf41('0x28')](handleEntityNotFound(_0x120fda,null))[_0xcf41('0x28')](respondWithResult(_0x120fda,null))['catch'](handleError(_0x120fda,null));};exports['create']=function(_0x13f432,_0x5c26f5){return db[_0xcf41('0x33')][_0xcf41('0x4e')](_0x13f432[_0xcf41('0x4f')],{})[_0xcf41('0x28')](function(_0x599b64){var _0x35c4d8=_0x13f432[_0xcf41('0x50')][_0xcf41('0x2a')]({'plain':!![]});if(!_0x35c4d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35c4d8[_0xcf41('0x51')]===_0xcf41('0x50')){var _0x5e9524=_0x599b64['get']({'plain':!![]});var _0x226365='ChatWebsites';return db[_0xcf41('0x52')][_0xcf41('0x4d')]({'where':{'name':_0x226365,'userProfileId':_0x35c4d8[_0xcf41('0x53')]},'raw':!![]})[_0xcf41('0x28')](function(_0x5ddac8){if(_0x5ddac8&&_0x5ddac8['autoAssociation']===0x0){return db[_0xcf41('0x2c')][_0xcf41('0x4e')]({'name':_0x5e9524[_0xcf41('0x2e')],'resourceId':_0x5e9524['id'],'type':_0x5ddac8[_0xcf41('0x2e')],'sectionId':_0x5ddac8['id']},{})[_0xcf41('0x28')](function(){return _0x599b64;});}else{return _0x599b64;}})['catch'](function(_0x8782d2){logger[_0xcf41('0x1a')](_0xcf41('0x54'),_0x8782d2);throw _0x8782d2;});}return _0x599b64;})['then'](respondWithResult(_0x5c26f5,0xc9))[_0xcf41('0x1d')](handleError(_0x5c26f5,null));};exports['update']=function(_0x3b6de5,_0x33fb49){if(_0x3b6de5[_0xcf41('0x4f')]['id']){delete _0x3b6de5[_0xcf41('0x4f')]['id'];}return db[_0xcf41('0x33')][_0xcf41('0x4d')]({'where':{'id':_0x3b6de5['params']['id']},'include':[{'model':db[_0xcf41('0x31')],'as':_0xcf41('0x32')}]})[_0xcf41('0x28')](handleEntityNotFound(_0x33fb49,null))[_0xcf41('0x28')](saveUpdates(_0x3b6de5[_0xcf41('0x4f')],null))[_0xcf41('0x28')](respondWithResult(_0x33fb49,null))[_0xcf41('0x1d')](handleError(_0x33fb49,null));};exports['destroy']=function(_0x28932c,_0x330f69){return db[_0xcf41('0x33')]['find']({'where':{'id':_0x28932c[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x330f69,null))[_0xcf41('0x28')](removeEntity(_0x330f69,null))[_0xcf41('0x1d')](handleError(_0x330f69,null));};exports['describe']=function(_0x8ea1c2,_0xb97fd3){return db[_0xcf41('0x33')]['describe']()['then'](respondWithResult(_0xb97fd3,null))['catch'](handleError(_0xb97fd3,null));};exports[_0xcf41('0x56')]=function(_0x1032ad,_0x3cc33e){if(_0x1032ad[_0xcf41('0x4f')]['id']){delete _0x1032ad[_0xcf41('0x4f')]['id'];}return db[_0xcf41('0x33')][_0xcf41('0x4d')]({'where':{'id':_0x1032ad['params']['id']}})['then'](handleEntityNotFound(_0x3cc33e,null))[_0xcf41('0x28')](function(_0x270286){if(_0x270286){_0x1032ad[_0xcf41('0x4f')][_0xcf41('0x57')]=_0x270286['id'];return db[_0xcf41('0x58')]['create'](_0x1032ad[_0xcf41('0x4f')]);}})[_0xcf41('0x28')](respondWithResult(_0x3cc33e,null))[_0xcf41('0x1d')](handleError(_0x3cc33e,null));};exports[_0xcf41('0x59')]=function(_0x307091,_0x1704f6){var _0x2d70c1={'raw':![],'where':{}};var _0x5c7fd1={};var _0x11f816={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xcf41('0x5a')]({'where':{'id':_0x307091[_0xcf41('0x55')]['id']}})['then'](handleEntityNotFound(_0x1704f6,null))[_0xcf41('0x28')](function(_0x56dfd7){if(_0x56dfd7){_0x5c7fd1[_0xcf41('0x38')]=_['keys'](db[_0xcf41('0x58')]['rawAttributes']);_0x5c7fd1[_0xcf41('0x3a')]=_[_0xcf41('0x5b')](_0x307091['query']);_0x5c7fd1['filters']=_[_0xcf41('0x3c')](_0x5c7fd1[_0xcf41('0x38')],_0x5c7fd1[_0xcf41('0x3a')]);_0x2d70c1[_0xcf41('0x3d')]=_[_0xcf41('0x3c')](_0x5c7fd1['model'],qs[_0xcf41('0x3e')](_0x307091[_0xcf41('0x3a')][_0xcf41('0x3e')]));_0x2d70c1[_0xcf41('0x3d')]=_0x2d70c1[_0xcf41('0x3d')]['length']?_0x2d70c1[_0xcf41('0x3d')]:_0x5c7fd1[_0xcf41('0x38')];if(!_0x307091[_0xcf41('0x3a')]['hasOwnProperty'](_0xcf41('0x40'))){_0x2d70c1[_0xcf41('0x24')]=qs[_0xcf41('0x24')](_0x307091['query']['limit']);_0x2d70c1[_0xcf41('0x22')]=qs[_0xcf41('0x22')](_0x307091[_0xcf41('0x3a')][_0xcf41('0x22')]);}_0x2d70c1[_0xcf41('0x41')]=qs[_0xcf41('0x42')](_0x307091[_0xcf41('0x3a')][_0xcf41('0x42')]);_0x2d70c1[_0xcf41('0x43')]=qs[_0xcf41('0x3b')](_[_0xcf41('0x5c')](_0x307091[_0xcf41('0x3a')],_0x5c7fd1['filters']));_0x2d70c1['where'][_0xcf41('0x57')]=_0x56dfd7['id'];if(_0x307091[_0xcf41('0x3a')][_0xcf41('0x46')]){_0x2d70c1[_0xcf41('0x43')]=_[_0xcf41('0x44')](_0x2d70c1[_0xcf41('0x43')],{'$or':_[_0xcf41('0x39')](_0x2d70c1[_0xcf41('0x3d')],function(_0x49672d){var _0x6616e9={};_0x6616e9[_0x49672d]={'$like':'%'+_0x307091[_0xcf41('0x3a')][_0xcf41('0x46')]+'%'};return _0x6616e9;})});}_0x2d70c1=_[_0xcf41('0x44')]({},_0x2d70c1,_0x307091[_0xcf41('0x47')]);return db['Disposition'][_0xcf41('0x25')]({'where':_0x2d70c1[_0xcf41('0x43')]})[_0xcf41('0x28')](function(_0x2a0e87){_0x11f816['count']=_0x2a0e87;if(_0x307091[_0xcf41('0x3a')][_0xcf41('0x48')]){_0x2d70c1[_0xcf41('0x49')]=[{'all':!![]}];}return db[_0xcf41('0x58')]['findAll'](_0x2d70c1);})['then'](function(_0x2ba9f2){_0x11f816[_0xcf41('0x4b')]=_0x2ba9f2;return _0x11f816;});}})[_0xcf41('0x28')](respondWithFilteredResult(_0x1704f6,_0x2d70c1))['catch'](handleError(_0x1704f6,null));};exports[_0xcf41('0x5d')]=function(_0x3c051b,_0x342f5c){return db['ChatWebsite'][_0xcf41('0x4d')]({'where':{'id':_0x3c051b[_0xcf41('0x55')]['id']}})['then'](handleEntityNotFound(_0x342f5c,null))['then'](function(_0x5685e0){if(_0x5685e0){return _0x5685e0[_0xcf41('0x5d')](_0x3c051b[_0xcf41('0x3a')][_0xcf41('0x5e')]);}})[_0xcf41('0x28')](respondWithStatusCode(_0x342f5c,null))['catch'](handleError(_0x342f5c,null));};exports['addAnswer']=function(_0x876586,_0xebc397){if(_0x876586[_0xcf41('0x4f')]['id']){delete _0x876586[_0xcf41('0x4f')]['id'];}return db[_0xcf41('0x33')][_0xcf41('0x4d')]({'where':{'id':_0x876586[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0xebc397,null))[_0xcf41('0x28')](function(_0x3697b5){if(_0x3697b5){_0x876586[_0xcf41('0x4f')][_0xcf41('0x57')]=_0x3697b5['id'];return db[_0xcf41('0x5f')][_0xcf41('0x4e')](_0x876586[_0xcf41('0x4f')]);}})['then'](respondWithResult(_0xebc397,null))[_0xcf41('0x1d')](handleError(_0xebc397,null));};exports[_0xcf41('0x60')]=function(_0x383e28,_0x243b3f){var _0xe15e5e={'raw':![],'where':{}};var _0x2e3f0f={};var _0x50e346={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x383e28[_0xcf41('0x55')]['id']}})['then'](handleEntityNotFound(_0x243b3f,null))[_0xcf41('0x28')](function(_0x1c541e){if(_0x1c541e){_0x2e3f0f[_0xcf41('0x38')]=_[_0xcf41('0x5b')](db[_0xcf41('0x5f')][_0xcf41('0x34')]);_0x2e3f0f[_0xcf41('0x3a')]=_[_0xcf41('0x5b')](_0x383e28[_0xcf41('0x3a')]);_0x2e3f0f[_0xcf41('0x3b')]=_[_0xcf41('0x3c')](_0x2e3f0f[_0xcf41('0x38')],_0x2e3f0f['query']);_0xe15e5e[_0xcf41('0x3d')]=_[_0xcf41('0x3c')](_0x2e3f0f[_0xcf41('0x38')],qs[_0xcf41('0x3e')](_0x383e28[_0xcf41('0x3a')]['fields']));_0xe15e5e[_0xcf41('0x3d')]=_0xe15e5e['attributes'][_0xcf41('0x4c')]?_0xe15e5e[_0xcf41('0x3d')]:_0x2e3f0f[_0xcf41('0x38')];if(!_0x383e28[_0xcf41('0x3a')][_0xcf41('0x3f')]('nolimit')){_0xe15e5e['limit']=qs[_0xcf41('0x24')](_0x383e28[_0xcf41('0x3a')]['limit']);_0xe15e5e[_0xcf41('0x22')]=qs[_0xcf41('0x22')](_0x383e28[_0xcf41('0x3a')][_0xcf41('0x22')]);}_0xe15e5e[_0xcf41('0x41')]=qs['sort'](_0x383e28[_0xcf41('0x3a')]['sort']);_0xe15e5e[_0xcf41('0x43')]=qs[_0xcf41('0x3b')](_['pick'](_0x383e28[_0xcf41('0x3a')],_0x2e3f0f['filters']));_0xe15e5e[_0xcf41('0x43')][_0xcf41('0x57')]=_0x1c541e['id'];if(_0x383e28[_0xcf41('0x3a')][_0xcf41('0x46')]){_0xe15e5e[_0xcf41('0x43')]=_[_0xcf41('0x44')](_0xe15e5e[_0xcf41('0x43')],{'$or':_[_0xcf41('0x39')](_0xe15e5e[_0xcf41('0x3d')],function(_0x117704){var _0x2e1c6e={};_0x2e1c6e[_0x117704]={'$like':'%'+_0x383e28['query'][_0xcf41('0x46')]+'%'};return _0x2e1c6e;})});}_0xe15e5e=_[_0xcf41('0x44')]({},_0xe15e5e,_0x383e28[_0xcf41('0x47')]);return db[_0xcf41('0x5f')][_0xcf41('0x25')]({'where':_0xe15e5e[_0xcf41('0x43')]})[_0xcf41('0x28')](function(_0x34a239){_0x50e346[_0xcf41('0x25')]=_0x34a239;if(_0x383e28[_0xcf41('0x3a')][_0xcf41('0x48')]){_0xe15e5e[_0xcf41('0x49')]=[{'all':!![]}];}return db[_0xcf41('0x5f')][_0xcf41('0x4a')](_0xe15e5e);})['then'](function(_0xc7127b){_0x50e346['rows']=_0xc7127b;return _0x50e346;});}})['then'](respondWithFilteredResult(_0x243b3f,_0xe15e5e))[_0xcf41('0x1d')](handleError(_0x243b3f,null));};exports[_0xcf41('0x61')]=function(_0x52189a,_0x30e451){return db[_0xcf41('0x33')]['find']({'where':{'id':_0x52189a[_0xcf41('0x55')]['id']}})['then'](handleEntityNotFound(_0x30e451,null))['then'](function(_0x1c02f9){if(_0x1c02f9){return _0x1c02f9[_0xcf41('0x61')](_0x52189a[_0xcf41('0x3a')]['ids']);}})[_0xcf41('0x28')](respondWithStatusCode(_0x30e451,null))[_0xcf41('0x1d')](handleError(_0x30e451,null));};exports['addLogo']=function(_0x136dc6,_0x27381c){_0x136dc6[_0xcf41('0x4f')]['sitepic']=_0x136dc6['file'][_0xcf41('0x62')];return db[_0xcf41('0x33')]['find']({'where':{'id':_0x136dc6['params']['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x27381c,null))[_0xcf41('0x28')](saveUpdates(_0x136dc6['body'],null))['then'](respondWithResult(_0x27381c,null))[_0xcf41('0x1d')](handleError(_0x27381c,null));};exports[_0xcf41('0x63')]=function(_0x4a1a39,_0x15ba4d){_0x4a1a39[_0xcf41('0x4f')][_0xcf41('0x64')]=_0x4a1a39[_0xcf41('0x65')][_0xcf41('0x62')];return db['ChatWebsite'][_0xcf41('0x4d')]({'where':{'id':_0x4a1a39[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x15ba4d,null))[_0xcf41('0x28')](saveUpdates(_0x4a1a39[_0xcf41('0x4f')],null))[_0xcf41('0x28')](respondWithResult(_0x15ba4d,null))[_0xcf41('0x1d')](handleError(_0x15ba4d,null));};exports[_0xcf41('0x66')]=function(_0x49b924,_0x2f7da9){_0x49b924[_0xcf41('0x4f')][_0xcf41('0x67')]=_0x49b924[_0xcf41('0x65')][_0xcf41('0x62')];return db[_0xcf41('0x33')]['find']({'where':{'id':_0x49b924[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x2f7da9,null))[_0xcf41('0x28')](saveUpdates(_0x49b924[_0xcf41('0x4f')],null))[_0xcf41('0x28')](respondWithResult(_0x2f7da9,null))[_0xcf41('0x1d')](handleError(_0x2f7da9,null));};exports[_0xcf41('0x68')]=function(_0x2e12b0,_0x3a553a){_0x2e12b0[_0xcf41('0x4f')][_0xcf41('0x69')]=_0x2e12b0['file'][_0xcf41('0x62')];return db[_0xcf41('0x33')][_0xcf41('0x4d')]({'where':{'id':_0x2e12b0[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x3a553a,null))['then'](saveUpdates(_0x2e12b0[_0xcf41('0x4f')],null))['then'](respondWithResult(_0x3a553a,null))[_0xcf41('0x1d')](handleError(_0x3a553a,null));};exports[_0xcf41('0x6a')]=function(_0x3b52f1,_0x12ea7e){var _0x5d9913=path['join'](config[_0xcf41('0x6b')],_0xcf41('0x6c'));var _0x1d2d3c={'where':{'id':_0x3b52f1['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x59e482=![];return require(_0xcf41('0x6d'))[_0xcf41('0x6e')]()[_0xcf41('0x28')](function(_0x1c0459){if(_0x1c0459){_0x59e482=_0x1c0459['custom'];}})[_0xcf41('0x28')](function(){return db[_0xcf41('0x33')][_0xcf41('0x4d')](_0x1d2d3c);})[_0xcf41('0x28')](handleEntityNotFound(_0x12ea7e,null))[_0xcf41('0x28')](function(_0xa1c1a1){if(_0xa1c1a1){if(!_['isNil'](_0xa1c1a1[_0xcf41('0x6f')])){if(fs[_0xcf41('0x70')](path[_0xcf41('0x71')](config[_0xcf41('0x6b')],_0xcf41('0x72'),_0xa1c1a1[_0xcf41('0x6f')]))&&_0x59e482){_0x5d9913=path[_0xcf41('0x71')](config[_0xcf41('0x6b')],_0xcf41('0x72'),_0xa1c1a1['sitepic']);}}return _0x12ea7e['download'](_0x5d9913);}})[_0xcf41('0x1d')](handleError(_0x12ea7e,null));};exports[_0xcf41('0x73')]=function(_0x44f9e7,_0x1c6a8c){var _0x27d3d6=path[_0xcf41('0x71')](config[_0xcf41('0x6b')],'server/files/images/avatars/default_avatar.png');var _0x4ccc68={'where':{'id':_0x44f9e7[_0xcf41('0x55')]['id']},'attributes':['id',_0xcf41('0x64')],'raw':!![]};return db[_0xcf41('0x33')]['find'](_0x4ccc68)['then'](handleEntityNotFound(_0x1c6a8c,null))[_0xcf41('0x28')](function(_0x5c6d6b){if(_0x5c6d6b){if(!_['isNil'](_0x5c6d6b[_0xcf41('0x64')])){if(fs['existsSync'](path['join'](config[_0xcf41('0x6b')],_0xcf41('0x74'),_0x5c6d6b[_0xcf41('0x64')]))){_0x27d3d6=path[_0xcf41('0x71')](config[_0xcf41('0x6b')],_0xcf41('0x74'),_0x5c6d6b['agentAvatar']);}}return _0x1c6a8c[_0xcf41('0x75')](_0x27d3d6);}})['catch'](handleError(_0x1c6a8c,null));};exports[_0xcf41('0x76')]=function(_0xe85cd2,_0x1c98b3){var _0x57c854=path[_0xcf41('0x71')](config[_0xcf41('0x6b')],'server/files/images/avatars/customer_avatar.png');var _0x3cca0d={'where':{'id':_0xe85cd2[_0xcf41('0x55')]['id']},'attributes':['id',_0xcf41('0x67'),_0xcf41('0x77')],'raw':!![]};return db['ChatWebsite'][_0xcf41('0x4d')](_0x3cca0d)[_0xcf41('0x28')](handleEntityNotFound(_0x1c98b3,null))[_0xcf41('0x28')](function(_0x5903a4){if(_0x5903a4){if(!_[_0xcf41('0x78')](_0x5903a4['customerAvatar'])){if(fs['existsSync'](path[_0xcf41('0x71')](config[_0xcf41('0x6b')],_0xcf41('0x74'),_0x5903a4[_0xcf41('0x67')]))&&_0x5903a4[_0xcf41('0x77')]){_0x57c854=path[_0xcf41('0x71')](config[_0xcf41('0x6b')],_0xcf41('0x74'),_0x5903a4['customerAvatar']);}}return _0x1c98b3[_0xcf41('0x75')](_0x57c854);}})['catch'](handleError(_0x1c98b3,null));};exports[_0xcf41('0x79')]=function(_0x27bdef,_0x3ada52){var _0x57a46f=path[_0xcf41('0x71')](config[_0xcf41('0x6b')],_0xcf41('0x7a'));var _0xd4b4d0={'where':{'id':_0x27bdef[_0xcf41('0x55')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xcf41('0x33')][_0xcf41('0x4d')](_0xd4b4d0)[_0xcf41('0x28')](handleEntityNotFound(_0x3ada52,null))[_0xcf41('0x28')](function(_0x597eb6){if(_0x597eb6){if(!_['isNil'](_0x597eb6[_0xcf41('0x69')])){if(fs['existsSync'](path[_0xcf41('0x71')](config[_0xcf41('0x6b')],_0xcf41('0x74'),_0x597eb6[_0xcf41('0x69')]))){_0x57a46f=path['join'](config['root'],_0xcf41('0x74'),_0x597eb6[_0xcf41('0x69')]);}}return _0x3ada52['download'](_0x57a46f);}})[_0xcf41('0x1d')](handleError(_0x3ada52,null));};exports[_0xcf41('0x7b')]=function(_0x165ce0,_0x45c91b){var _0x4f36c7=require('user-agent-parser');var _0x3ec704=new _0x4f36c7();var _0x50aae4=_0x3ec704[_0xcf41('0x7c')](_0x165ce0['headers'][_0xcf41('0x7d')])[_0xcf41('0x7e')]();var _0x3a5a92={'body':_0x165ce0[_0xcf41('0x4f')],'channel':'chat'};var _0x3914d1=[];var _0x15b3ef=[];var _0x3954c6={};var _0x472ffd=![];return db['CmContact']['describe']()[_0xcf41('0x28')](function(_0x4fb738){if(!_0x4fb738){throw new db['Sequelize'][(_0xcf41('0x7f'))](_0xcf41('0x80'));}_0x3914d1=_[_0xcf41('0x81')](_[_0xcf41('0x5b')](_0x4fb738),[_0xcf41('0x82'),'updatedAt']);_0x15b3ef=_[_0xcf41('0x81')](_['keys'](_0x4fb738),[_0xcf41('0x82'),_0xcf41('0x83'),_0xcf41('0x84'),_0xcf41('0x85')]);if(_0x165ce0[_0xcf41('0x4f')]['id']){delete _0x165ce0[_0xcf41('0x4f')]['id'];}if(_[_0xcf41('0x78')](_0x165ce0['body'][_0xcf41('0x86')])){throw new db['Sequelize'][(_0xcf41('0x7f'))]('from\x20is\x20mandatory');}if(_[_0xcf41('0x78')](_0x165ce0[_0xcf41('0x4f')][_0xcf41('0x4f')])||_0x165ce0[_0xcf41('0x4f')]['body']===''){throw new db[(_0xcf41('0x87'))][(_0xcf41('0x7f'))](_0xcf41('0x88'));}if(_['isNil'](_0x165ce0['body'][_0xcf41('0x89')])){throw new db[(_0xcf41('0x87'))][(_0xcf41('0x7f'))](_0xcf41('0x8a')+_0x15b3ef);}if(!_[_0xcf41('0x8b')](_0x15b3ef,_0x165ce0[_0xcf41('0x4f')][_0xcf41('0x89')])){throw new db[(_0xcf41('0x87'))][(_0xcf41('0x7f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x15b3ef);}_0x3954c6[_0x165ce0['body'][_0xcf41('0x89')]]=_0x165ce0[_0xcf41('0x4f')][_0xcf41('0x86')];})[_0xcf41('0x28')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x165ce0['params']['id']},'include':[{'model':db[_0xcf41('0x8c')],'as':'List','include':[{'model':db[_0xcf41('0x8d')],'as':_0xcf41('0x8e'),'where':_0x3954c6,'limit':0x1,'order':[['updatedAt',_0xcf41('0x8f')]]}]},{'model':db['ChatApplication'],'as':_0xcf41('0x90')}]});})[_0xcf41('0x28')](handleEntityNotFound(_0x45c91b,null))['then'](function(_0x23a246){if(_0x23a246&&_0x23a246['List']){_0x3a5a92[_0xcf41('0x91')]=_0x23a246;_0x3a5a92['applications']=_0x23a246['Applications'];_0x3a5a92['list']=_0x23a246[_0xcf41('0x92')];_0x3a5a92[_0xcf41('0x93')]=_['orderBy'](_0x3a5a92[_0xcf41('0x93')],[_0xcf41('0x94')],[_0xcf41('0x95')]);if(_0x3a5a92[_0xcf41('0x91')][_0xcf41('0x90')]){delete _0x3a5a92[_0xcf41('0x91')][_0xcf41('0x90')];}if(_0x3a5a92[_0xcf41('0x91')]['List']&&_0x3a5a92['account'][_0xcf41('0x92')][_0xcf41('0x8e')][_0xcf41('0x4c')]){return _0x3a5a92[_0xcf41('0x91')][_0xcf41('0x92')][_0xcf41('0x8e')][0x0];}var _0x42a2b1=_['defaults'](_0x165ce0[_0xcf41('0x4f')],{'firstName':_0x165ce0[_0xcf41('0x4f')]['from'],'ListId':_0x23a246[_0xcf41('0x85')]});_0x42a2b1[_0x165ce0[_0xcf41('0x4f')][_0xcf41('0x89')]]=_0x165ce0[_0xcf41('0x4f')][_0xcf41('0x86')];return db['CmContact'][_0xcf41('0x4e')](_0x42a2b1,{'fields':_0x3914d1,'raw':!![]});}})[_0xcf41('0x28')](handleEntityNotFound(_0x45c91b,null))[_0xcf41('0x28')](function(_0x11ae71){_0x3a5a92[_0xcf41('0x96')]=_0x11ae71;var _0x14adca=_0x165ce0['body'][_0xcf41('0x97')];if(_0x165ce0[_0xcf41('0x98')][_0xcf41('0x99')]){_0x14adca=_0x165ce0[_0xcf41('0x98')][_0xcf41('0x99')];}else if(_0x165ce0['headers'][_0xcf41('0x9a')]){_0x14adca=_[_0xcf41('0x9b')](_0x165ce0[_0xcf41('0x98')]['x-forwarded-for'][_0xcf41('0x9c')](','));}if(_0x11ae71){var _0x50c279={'ContactId':_0x11ae71['id'],'ChatWebsiteId':_0x165ce0[_0xcf41('0x55')]['id'],'from':(_0x11ae71[_0xcf41('0x9d')]||'')+'\x20'+(_0x11ae71[_0xcf41('0x9e')]||''),'customerIp':_0x14adca,'customerPort':_0x165ce0[_0xcf41('0x98')][_0xcf41('0x9f')]?_0x165ce0['headers'][_0xcf41('0x9f')]:null,'referer':_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xa0')],'browserName':_0x50aae4[_0xcf41('0xa1')][_0xcf41('0x2e')]&&_0x50aae4[_0xcf41('0xa1')]['version']?util[_0xcf41('0xa2')](_0xcf41('0xa3'),_0x50aae4[_0xcf41('0xa1')][_0xcf41('0x2e')],_0x50aae4['browser'][_0xcf41('0xa4')]):_0xcf41('0xa5'),'browserVersion':_0x50aae4['browser'][_0xcf41('0xa4')]||'unknown','osName':util[_0xcf41('0xa2')](_0xcf41('0xa3'),_0x50aae4['os']['name'],_0x50aae4['os']['version']),'osVersion':_0x50aae4['os'][_0xcf41('0xa4')],'deviceModel':_0x50aae4[_0xcf41('0xa6')][_0xcf41('0x38')]&&_0x50aae4[_0xcf41('0xa6')][_0xcf41('0xa7')]?util[_0xcf41('0xa2')]('%s\x20%s\x20%s',_0x50aae4[_0xcf41('0xa6')][_0xcf41('0x38')],_0x50aae4['device'][_0xcf41('0xa7')],_0x50aae4[_0xcf41('0xa6')][_0xcf41('0x36')]):null,'deviceVendor':_0x50aae4[_0xcf41('0xa6')][_0xcf41('0xa7')],'deviceType':_0x50aae4[_0xcf41('0xa6')]['type'],'formData':JSON[_0xcf41('0x19')](_0x165ce0['body'])};var _0x1d03af={'ChatWebsiteId':_0x165ce0[_0xcf41('0x55')]['id'],'closed':![]};if(_0x165ce0[_0xcf41('0x4f')]['threadId']){_0x1d03af[_0xcf41('0xa8')]=_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xa8')];return db[_0xcf41('0xa9')]['find']({'where':_0x1d03af})[_0xcf41('0x28')](function(_0x28b018){if(_0x28b018){return[_0x28b018,![]];}_0x50c279[_0xcf41('0xa8')]=_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xa8')];_0x50c279[_0xcf41('0xaa')]=_0x165ce0['body'][_0xcf41('0xaa')];return db[_0xcf41('0xa9')][_0xcf41('0x4e')](_0x50c279)[_0xcf41('0x28')](function(_0x27b755){return[_0x27b755,!![]];});});}_0x1d03af['ContactId']=_0x11ae71['id'];if(_0x165ce0['body'][_0xcf41('0xab')]&&_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xab')]['id']){_0x1d03af['id']=_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xab')]['id'];return db['ChatInteraction'][_0xcf41('0x4d')]({'where':_0x1d03af})[_0xcf41('0x28')](function(_0x5d4948){if(_0x5d4948){return[_0x5d4948,![]];}return db[_0xcf41('0xa9')][_0xcf41('0x4e')](_0x50c279)[_0xcf41('0x28')](function(_0x22b6fb){return[_0x22b6fb,!![]];});});}return db[_0xcf41('0xa9')][_0xcf41('0x4e')](_0x50c279)[_0xcf41('0x28')](function(_0x5f3d93){return[_0x5f3d93,!![]];});}})['spread'](function(_0x23771b,_0x546632){if(_0x23771b){_0x472ffd=_0x546632;if(!_0x546632){var _0x28f072={'from':(_0x3a5a92['contact'][_0xcf41('0x9d')]||'')+'\x20'+(_0x3a5a92[_0xcf41('0x96')][_0xcf41('0x9e')]||'')};if(_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xa8')]&&_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xac')]&&_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xa8')]!=_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xac')]){_0x28f072['threadId']=_0x165ce0[_0xcf41('0x4f')]['messageId'];}return _0x23771b[_0xcf41('0x27')](_0x28f072);}else{return _0x23771b;}}})[_0xcf41('0x28')](function(_0x58a088){_0x3a5a92[_0xcf41('0xab')]=_0x58a088[_0xcf41('0x2a')]({'plain':!![]});_0x3a5a92[_0xcf41('0xab')][_0xcf41('0xad')]=_0x472ffd;if(_0x3a5a92[_0xcf41('0xab')]['created']){if(_0x3a5a92[_0xcf41('0x91')][_0xcf41('0xae')]){_0x3a5a92[_0xcf41('0x93')][_0xcf41('0xaf')]({'id':0x0,'priority':_0x3a5a92[_0xcf41('0x93')][_0xcf41('0x4c')]+0x1,'app':_0xcf41('0xb0'),'appdata':_0xcf41('0xb1'),'interval':_0xcf41('0xb2')});}}return db[_0xcf41('0xb3')][_0xcf41('0x4e')]({'body':_0x165ce0[_0xcf41('0x4f')][_0xcf41('0x4f')],'ChatWebsiteId':_0x165ce0['params']['id'],'ChatInteractionId':_0x58a088['id'],'direction':'in','ContactId':_0x3a5a92[_0xcf41('0x96')]['id'],'AttachmentId':_0x165ce0[_0xcf41('0x4f')][_0xcf41('0xb4')]});})[_0xcf41('0x28')](function(_0x4ee8a4){_0x3a5a92[_0xcf41('0x1c')]=_0x4ee8a4;if(_0x3a5a92[_0xcf41('0xab')][_0xcf41('0xb5')]){return db[_0xcf41('0xb6')][_0xcf41('0x4d')]({'attributes':['id',_0xcf41('0x2e')],'where':{'id':_0x3a5a92['interaction'][_0xcf41('0xb5')]}})[_0xcf41('0x28')](function(_0xbe5adf){if(_0xbe5adf){_0x3a5a92[_0xcf41('0x93')][_0xcf41('0xb7')]({'id':0x0,'priority':0x0,'app':_0xcf41('0xb8'),'appdata':_0xbe5adf[_0xcf41('0x2e')]+','+(_0x3a5a92[_0xcf41('0x91')][_0xcf41('0xb9')]||0xa),'interval':_0xcf41('0xb2')});_0x3a5a92[_0xcf41('0xba')]=!![];}return respondWithRpcPromise(_0xcf41('0xbb'),_0xcf41('0xbc'),_0x3a5a92);});}return respondWithRpcPromise(_0xcf41('0xbb'),_0xcf41('0xbc'),_0x3a5a92);})[_0xcf41('0x28')](function(_0x494153){respondWithRpcPromise(_0xcf41('0xbd'),_0xcf41('0xbd'),{'event':_0xcf41('0x7b'),'message':_0x494153},client9002);return _0x494153;})[_0xcf41('0x28')](respondWithResult(_0x45c91b,null))[_0xcf41('0x1d')](handleError(_0x45c91b,null));};exports[_0xcf41('0xbe')]=function(_0x3fe00f,_0x300c5f){var _0x744078,_0x32d725,_0x307c60;var _0x29ccfc=[];var _0x83d960={};var _0x19ae02=_0x3fe00f[_0xcf41('0xbf')]||[];var _0x294154=[];var _0x138afa;return db['CmContact'][_0xcf41('0xc0')]()[_0xcf41('0x28')](function(_0x213632){if(!_0x213632){throw new db[(_0xcf41('0x87'))]['ValidationError'](_0xcf41('0x80'));}_0x29ccfc=_['difference'](_[_0xcf41('0x5b')](_0x213632),[_0xcf41('0x82'),_0xcf41('0x83'),'CompanyId',_0xcf41('0x85')]);if(_0x3fe00f['body']['id']){delete _0x3fe00f['body']['id'];}if(_[_0xcf41('0x78')](_0x3fe00f[_0xcf41('0x4f')]['from'])){throw _0x300c5f[_0xcf41('0x20')](0x1f4)['send'](new db[(_0xcf41('0x87'))][(_0xcf41('0x7f'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x3fe00f[_0xcf41('0x4f')]['body'])||_0x3fe00f[_0xcf41('0x4f')][_0xcf41('0x4f')]===''){throw _0x300c5f[_0xcf41('0x20')](0x1f4)[_0xcf41('0x2f')](new db[(_0xcf41('0x87'))][(_0xcf41('0x7f'))](_0xcf41('0x88')));}if(_['isNil'](_0x3fe00f[_0xcf41('0x4f')][_0xcf41('0xc1')])){throw _0x300c5f['status'](0x1f4)[_0xcf41('0x2f')](new db[(_0xcf41('0x87'))][(_0xcf41('0x7f'))](_0xcf41('0xc2')+_0x29ccfc));}if(!_['includes'](_0x29ccfc,_0x3fe00f['body']['mapKeyOffline'])){throw _0x300c5f[_0xcf41('0x20')](0x1f4)[_0xcf41('0x2f')](new db[(_0xcf41('0x87'))]['ValidationError'](_0xcf41('0xc3')+_0x29ccfc));}_0x83d960[_0x3fe00f[_0xcf41('0x4f')][_0xcf41('0xc1')]]=_0x3fe00f[_0xcf41('0x4f')]['from'];})[_0xcf41('0x28')](function(){return db[_0xcf41('0x33')][_0xcf41('0x4d')]({'where':{'id':_0x3fe00f[_0xcf41('0x55')]['id']},'include':[{'model':db[_0xcf41('0x8c')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x300c5f,null))[_0xcf41('0x28')](function(_0x4f93d8){if(_0x4f93d8&&_0x4f93d8[_0xcf41('0x92')]){_0x32d725=_0x4f93d8;var _0x51ead8=_[_0xcf41('0xd')](_0x3fe00f[_0xcf41('0x4f')],{'firstName':_0x3fe00f['body'][_0xcf41('0x86')],'phone':_0x3fe00f['body'][_0xcf41('0x86')],'ListId':_0x4f93d8['ListId']});_0x51ead8[_0x3fe00f[_0xcf41('0x4f')][_0xcf41('0xc1')]]=_0x3fe00f[_0xcf41('0x4f')][_0xcf41('0x86')];return db[_0xcf41('0x8d')][_0xcf41('0xc4')]({'where':_0x83d960,'defaults':_0x51ead8});}})[_0xcf41('0xc5')](function(_0x1e1e4e){if(_0x1e1e4e){_0x307c60=_0x1e1e4e;var _0x386b07=fs['readFileSync'](path[_0xcf41('0x71')](config[_0xcf41('0x6b')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x5efcc1=ejs[_0xcf41('0xc6')](_0x386b07,{'body':_[_0xcf41('0xc7')](_0x3fe00f[_0xcf41('0x4f')]['body']),'bodyTitle':_0x32d725['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x5efcc1,'plainBody':htmlToText[_0xcf41('0xc8')](_0x5efcc1),'ContactId':_0x1e1e4e['id'],'ChatWebsiteId':_0x32d725['id']});}})[_0xcf41('0x28')](function(_0x22e6c5){_0x138afa=_0x22e6c5;if(_0x19ae02[_0xcf41('0x4c')]){var _0x47857c=_0x19ae02[_0xcf41('0x39')](function(_0x3b0f46){return{'name':_0x3b0f46[_0xcf41('0xc9')],'basename':_0x3b0f46['filename'],'type':_0x3b0f46[_0xcf41('0xca')],'ChatOfflineMessageId':_0x22e6c5['id']};});_0x294154=_0x47857c[_0xcf41('0x39')](_0x3c8441=>{var _0x5ca2b1={'filename':_0x3c8441[_0xcf41('0x2e')],'path':path[_0xcf41('0x71')](config['root'],_0xcf41('0xcb'),'files','attachments',_0xcf41('0xcc'),_0x3c8441[_0xcf41('0xcd')])};return _0x5ca2b1;});if(!_0x32d725['openNewInteraction']){return db[_0xcf41('0xce')][_0xcf41('0xcf')](function(_0x332cdb){return db[_0xcf41('0xd0')][_0xcf41('0xd1')](_0x47857c,{'transaction':_0x332cdb});});}}})[_0xcf41('0x28')](function(){if(_0x138afa){_0x744078=_0x138afa;return db[_0xcf41('0xd2')][_0xcf41('0x5a')]({'where':{'service':!![]},'include':[{'model':db[_0xcf41('0xd3')],'as':_0xcf41('0xd4'),'raw':!![],'include':[{'model':db[_0xcf41('0xd5')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x134113){if(_0x134113&&_0x134113[_0xcf41('0xd4')]&&_0x32d725['forwardOffline']&&_0x32d725[_0xcf41('0xd6')]){var _0x55b2e1=_0x134113[_0xcf41('0xd7')]();return respondWithRpcPromise(_0xcf41('0xd8'),'sendMail',{'account':_0x55b2e1,'message':{'from':util[_0xcf41('0xa2')](_0xcf41('0xd9'),_0x134113[_0xcf41('0x2e')],_0x134113[_0xcf41('0xda')]||_0x134113['Smtp'][_0xcf41('0x50')]),'to':_0x32d725[_0xcf41('0xd6')],'subject':_0x32d725[_0xcf41('0xdb')],'html':_0x744078[_0xcf41('0x4f')],'attachments':_0x294154}},client9003)[_0xcf41('0x28')](function(){return _0x744078;})[_0xcf41('0x1d')](function(_0x4963be){logger[_0xcf41('0x1a')](_0x4963be);});}})[_0xcf41('0x28')](function(){if(_0x32d725&&_0x32d725[_0xcf41('0xdc')]&&_0x32d725[_0xcf41('0xdd')]){var _0x383233=[];if(_0x19ae02['length']){_0x383233=_0x19ae02[_0xcf41('0x39')](function(_0x31143c){return{'name':_0x31143c[_0xcf41('0xc9')],'basename':_0x31143c['filename'],'type':_0x31143c[_0xcf41('0xca')],'ChatOfflineMessageId':_0x138afa['id']};});}var _0x4b49d1;if(!_[_0xcf41('0x78')](_0x32d725[_0xcf41('0xde')])){var _0x49e4be=_['map'](_0x3fe00f['body'],function(_0x5a39da){return _0x5a39da;});var _0x2bd208=_['toPairsIn'](_0x49e4be)[0x0];var _0x4003f6=_[_0xcf41('0xdf')](_0x2bd208,function(_0x527b4c){return _0x527b4c;});_0x4b49d1=_0x4003f6[0x1][_0x32d725[_0xcf41('0xde')]];}var _0x58ec78={'from':_0x307c60[_0xcf41('0xda')],'firstName':_0x307c60[_0xcf41('0x9d')],'lastName':_0x307c60['lastName'],'mapKey':_0xcf41('0xda'),'message':{'from':_0x307c60[_0xcf41('0xda')],'to':_0x32d725['MailAccount'][_0xcf41('0xda')],'cc':'','subject':_[_0xcf41('0x78')](_0x4b49d1)?_0x32d725[_0xcf41('0xdb')]:_0x4b49d1,'messageId':'','sentAt':new Date(),'attach':_0x383233[_0xcf41('0x4c')],'attachments':_0x383233,'originChannel':_0xcf41('0xe0'),'ChatWebsiteId':_0x32d725['id'],'ChatOfflineMessageId':_0x744078['id'],'originTo':_0x32d725[_0xcf41('0xd2')][_0xcf41('0xda')]},'body':_0x744078[_0xcf41('0x4f')]};var _0x5e3183={'account':{'id':_0x32d725['MailAccountId']},'body':_0x58ec78,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xcf41('0xe1'),'notifyMail',_0x5e3183,client9001)[_0xcf41('0x28')](function(){return _0x744078;})[_0xcf41('0x1d')](function(_0x4fdcc7){logger[_0xcf41('0x1a')](_0x4fdcc7);});}return;})[_0xcf41('0x28')](function(){if(_0x744078){return _0x744078;}})['then'](respondWithResult(_0x300c5f,null))[_0xcf41('0x1d')](function(_0x35d440){logger[_0xcf41('0x1a')](_0xcf41('0x1d'),_0x35d440);for(var _0x15102d of _0x19ae02){var _0xaa09a8=path[_0xcf41('0x71')](config[_0xcf41('0x6b')],_0xcf41('0xcb'),'files',_0xcf41('0xe2'),_0xcf41('0xcc'),_0x15102d[_0xcf41('0x62')]);fs_extra[_0xcf41('0xe3')](_0xaa09a8)[_0xcf41('0x1d')](function(_0x407cf8){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0xaa09a8,_0x407cf8);});}});};exports[_0xcf41('0xe4')]=function(_0x1ae828,_0x182eff){return db[_0xcf41('0xa9')][_0xcf41('0x4d')]({'where':{'id':_0x1ae828[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x182eff,null))['then'](function(_0x76f103){if(_0x76f103){return _0x76f103[_0xcf41('0xe4')](_0x1ae828[_0xcf41('0x4f')]['ids'],_['omit'](_0x1ae828[_0xcf41('0x4f')],[_0xcf41('0x5e'),'id'])||{});}})[_0xcf41('0x28')](respondWithResult(_0x182eff,null))[_0xcf41('0x1d')](handleError(_0x182eff,null));};exports[_0xcf41('0xe5')]=function(_0x4511da,_0x3e8b36){var _0x18eeb1={'raw':![],'where':{}};var _0x22077c={};var _0x145a9b={'count':0x0,'rows':[]};return db[_0xcf41('0x33')][_0xcf41('0x5a')]({'where':{'id':_0x4511da[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x3e8b36,null))[_0xcf41('0x28')](function(_0xd7ae61){if(_0xd7ae61){_0x22077c[_0xcf41('0x38')]=_[_0xcf41('0x5b')](db[_0xcf41('0xa9')][_0xcf41('0x34')]);_0x22077c[_0xcf41('0x3a')]=_[_0xcf41('0x5b')](_0x4511da[_0xcf41('0x3a')]);_0x22077c[_0xcf41('0x3b')]=_[_0xcf41('0x3c')](_0x22077c[_0xcf41('0x38')],_0x22077c[_0xcf41('0x3a')]);_0x18eeb1['attributes']=_[_0xcf41('0x3c')](_0x22077c['model'],qs[_0xcf41('0x3e')](_0x4511da[_0xcf41('0x3a')][_0xcf41('0x3e')]));_0x18eeb1[_0xcf41('0x3d')]=_0x18eeb1['attributes'][_0xcf41('0x4c')]?_0x18eeb1[_0xcf41('0x3d')]:_0x22077c['model'];if(!_0x4511da[_0xcf41('0x3a')][_0xcf41('0x3f')]('nolimit')){_0x18eeb1[_0xcf41('0x24')]=qs[_0xcf41('0x24')](_0x4511da[_0xcf41('0x3a')][_0xcf41('0x24')]);_0x18eeb1[_0xcf41('0x22')]=qs[_0xcf41('0x22')](_0x4511da[_0xcf41('0x3a')][_0xcf41('0x22')]);}_0x18eeb1[_0xcf41('0x41')]=qs[_0xcf41('0x42')](_0x4511da[_0xcf41('0x3a')][_0xcf41('0x42')]);_0x18eeb1[_0xcf41('0x43')]=qs[_0xcf41('0x3b')](_['pick'](_0x4511da[_0xcf41('0x3a')],_0x22077c[_0xcf41('0x3b')]));_0x18eeb1[_0xcf41('0x43')]['ChatWebsiteId']=_0xd7ae61['id'];if(_0x4511da['query'][_0xcf41('0x46')]){_0x18eeb1['where']=_[_0xcf41('0x44')](_0x18eeb1[_0xcf41('0x43')],{'$or':_['map'](_0x18eeb1[_0xcf41('0x3d')],function(_0x246cb8){var _0x45f50f={};_0x45f50f[_0x246cb8]={'$like':'%'+_0x4511da[_0xcf41('0x3a')][_0xcf41('0x46')]+'%'};return _0x45f50f;})});}_0x18eeb1=_[_0xcf41('0x44')]({},_0x18eeb1,_0x4511da['options']);return db[_0xcf41('0xa9')][_0xcf41('0x25')]({'where':_0x18eeb1[_0xcf41('0x43')]})[_0xcf41('0x28')](function(_0x1b863e){_0x145a9b[_0xcf41('0x25')]=_0x1b863e;if(_0x4511da[_0xcf41('0x3a')][_0xcf41('0x48')]){_0x18eeb1['include']=[{'model':db['CmContact'],'as':_0xcf41('0xe6'),'required':![]},{'model':db[_0xcf41('0xb6')],'as':_0xcf41('0xe7'),'attributes':[_0xcf41('0x2e'),_0xcf41('0xe8'),_0xcf41('0xe9')],'required':![]},{'model':db[_0xcf41('0xea')],'as':_0xcf41('0xeb'),'attributes':['id',_0xcf41('0x2e'),_0xcf41('0xec')],'where':_0x4511da['query'][_0xcf41('0xed')]?{'id':_0x4511da['query']['tag']}:undefined,'required':_0x4511da['query'][_0xcf41('0xed')]?!![]:![]}];}return db[_0xcf41('0xa9')][_0xcf41('0x4a')](_0x18eeb1);})[_0xcf41('0x28')](function(_0x45d338){_0x145a9b[_0xcf41('0x4b')]=_0x45d338;return _0x145a9b;});}})[_0xcf41('0x28')](respondWithFilteredResult(_0x3e8b36,_0x18eeb1))[_0xcf41('0x1d')](handleError(_0x3e8b36,null));};function iftimePromise(_0x380f54,_0x169739){return respondWithRpcPromise(_0xcf41('0xee'),'getSnippet',{'command':_0x169739['timezone']?util[_0xcf41('0xa2')](_0xcf41('0xef'),_0x380f54[_0xcf41('0xf0')],_0x169739[_0xcf41('0xf1')]):util[_0xcf41('0xa2')](_0xcf41('0xf2'),_0x380f54[_0xcf41('0xf0')])},client9002)[_0xcf41('0x28')](function(_0x225060){var _0x3483c5=_0x225060&&_0x225060['indexOf']('true')>=0x0?!![]:![];logger['info'](_0xcf41('0xf3'),_0x169739['id'],_0x380f54['id'],_0x380f54[_0xcf41('0xf0')],_0x3483c5?'ONLINE':_0xcf41('0xf4'),_0x169739[_0xcf41('0xf1')]?_0x169739[_0xcf41('0xf1')]:_0xcf41('0xf5'));return _0x3483c5;})[_0xcf41('0x1d')](function(_0x5cb921){logger[_0xcf41('0x1a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x169739['id'],_0x380f54['id'],_0x380f54[_0xcf41('0xf0')],util[_0xcf41('0xf6')](_0x5cb921,{'showHidden':![],'depth':null}),_0x169739['timezone']?_0x169739[_0xcf41('0xf1')]:_0xcf41('0xf5'));return![];});}exports[_0xcf41('0xf7')]=function(_0x193e91,_0x3ea285){var _0x5a701c=0x0;var _0x2dd2c6=0x0;var _0x291819=![];var _0x585c35;var _0x32af4d;return db['ChatWebsite'][_0xcf41('0x4d')]({'where':{'id':_0x193e91['params']['id']},'include':[{'model':db['Interval'],'as':_0xcf41('0xf8'),'include':[{'model':db['Interval'],'as':_0xcf41('0xf9'),'attributes':['id',_0xcf41('0xf0')],'raw':!![]}]}]})[_0xcf41('0x28')](handleEntityNotFound(_0x3ea285,null))[_0xcf41('0x28')](function(_0x5ae99a){if(_0x5ae99a){_0x585c35=_0x5ae99a;return _0x5ae99a[_0xcf41('0xfa')]({'raw':!![]});}})[_0xcf41('0x28')](function(_0x37b4b5){if(_0x585c35){if(_0x37b4b5){_0x32af4d=_0x37b4b5;}}return require(_0xcf41('0x6d'))[_0xcf41('0x6e')]();})[_0xcf41('0x28')](function(_0xc349d2){if(_0xc349d2){_0x2dd2c6=_0xc349d2[_0xcf41('0xfb')];_0x291819=_0xc349d2[_0xcf41('0xfc')];}})[_0xcf41('0x28')](function(){return db[_0xcf41('0xa9')][_0xcf41('0x25')]({'where':{'closed':![]}});})['then'](function(_0x3b19e0){_0x5a701c=_0x3b19e0;if(_0x2dd2c6&&_0x3b19e0>_0x2dd2c6){return db[_0xcf41('0xfd')][_0xcf41('0x5a')]({'where':{'id':0x1}})[_0xcf41('0x28')](function(_0x4cd059){if(_0x4cd059){_0x4cd059['increment'](_0xcf41('0xfe'));}});}})[_0xcf41('0x28')](function(){if(_0x585c35[_0xcf41('0xf8')]&&_0x585c35['Interval']['Intervals']){var _0xc1cfdc=[];for(var _0x470524=0x0;_0x470524<_0x585c35[_0xcf41('0xf8')][_0xcf41('0xf9')]['length'];_0x470524++){var _0x11da27=_0x585c35['Interval'][_0xcf41('0xf9')][_0x470524][_0xcf41('0x2a')]({'plain':!![]});_0xc1cfdc[_0xcf41('0xaf')](iftimePromise(_0x11da27,_0x585c35));}return BPromise['all'](_0xc1cfdc)['then'](function(_0x5324cb){return _[_0xcf41('0xff')](_0x5324cb);});}else{return!![];}})['then'](function(_0x5d1235){var _0x42f7ad=fs['readFileSync'](path['join'](config[_0xcf41('0x6b')],_0xcf41('0x100')),_0xcf41('0x101'));var _0x54998d={'remote':_0x585c35[_0xcf41('0x102')],'query':querystring[_0xcf41('0x19')](_[_0xcf41('0x44')](_0x585c35[_0xcf41('0x2a')]({'plain':!![]}),{'customerIp':_0x193e91['headers']['x-forwarded-for']||_0x193e91[_0xcf41('0x98')]['x-real-ip']||_0x193e91[_0xcf41('0x103')][_0xcf41('0x104')]||_0x193e91['ip'],'referer':_0x193e91[_0xcf41('0x98')][_0xcf41('0xa0')],'openedInteractions':_0x5a701c,'maxInteractions':_0x2dd2c6,'virtual':_0x291819[_0xcf41('0xfb')],'online':_0x5d1235,'custom':_0x291819}))[_0xcf41('0x105')](/'/g,'\x5c\x27')};_0x3ea285[_0xcf41('0x2f')](ejs[_0xcf41('0xc6')](Mustache[_0xcf41('0xc6')](_0x42f7ad,_0x54998d),{'proactiveActions':_0x32af4d,'alignment':_0x585c35[_0xcf41('0x106')],'verticalAlignment':_0x585c35[_0xcf41('0x107')],'div_color':_0x585c35[_0xcf41('0xec')],'labelText':_0x585c35[_0xcf41('0x108')],'text_color':_0x585c35[_0xcf41('0x109')],'text_button_color':_0x585c35[_0xcf41('0x10a')],'button_color':_0x585c35[_0xcf41('0x10b')],'background_color':_0x585c35[_0xcf41('0x10c')],'hideWhenOffline':_0x585c35[_0xcf41('0x10d')],'interval':_0x585c35[_0xcf41('0x10e')]}));})[_0xcf41('0x1d')](handleError(_0x3ea285,null));};exports[_0xcf41('0x10f')]=function(_0x484b90,_0x532f9d){var _0x372216=_0x484b90[_0xcf41('0x55')]['id'];var _0x4d37fc=_0x484b90[_0xcf41('0x4f')];var _0x59ca47=0xc8;var _0x4c91ec=null;return db[_0xcf41('0xce')][_0xcf41('0xcf')]({'isolationLevel':db[_0xcf41('0xce')][_0xcf41('0x110')][_0xcf41('0x111')]['READ_COMMITTED']},function(_0x186c51){return db[_0xcf41('0x33')][_0xcf41('0x5a')]({'where':{'id':_0x372216},'transaction':_0x186c51})['then'](function(_0x3e5485){if(_0x3e5485){return db['ChatApplication'][_0xcf41('0x29')]({'where':{'ChatWebsiteId':_0x372216},'transaction':_0x186c51})['then'](function(){var _0x3b0622=_[_0xcf41('0x39')](_0x4d37fc,function(_0x1816fc){_0x1816fc[_0xcf41('0x57')]=_0x372216;return _0x1816fc;});return db[_0xcf41('0x112')][_0xcf41('0xd1')](_0x3b0622,{'transaction':_0x186c51});});}else{_0x59ca47=0x194;_0x4c91ec=[];}});})['then'](function(){if(_0x59ca47!==0x194){return db[_0xcf41('0x112')][_0xcf41('0x113')]({'where':{'ChatWebsiteId':_0x372216},'order':_0xcf41('0x94')})[_0xcf41('0x28')](function(_0x22fecb){_0x4c91ec=_0x22fecb;});}})[_0xcf41('0x1d')](function(_0x5e3319){_0x59ca47=0x1f4;logger[_0xcf41('0x1a')](_0x5e3319[_0xcf41('0x2d')]);if(_0x5e3319[_0xcf41('0x2e')]){delete _0x5e3319[_0xcf41('0x2e')];}_0x4c91ec=_0x5e3319;})[_0xcf41('0x114')](function(){if(_0x4c91ec===null){_0x532f9d[_0xcf41('0x1e')](_0x59ca47);}else{if(_0x59ca47===0x1f4){_0x532f9d[_0xcf41('0x20')](_0x59ca47)['send'](_0x4c91ec);}else{_0x532f9d[_0xcf41('0x20')](_0x59ca47)[_0xcf41('0x21')](_0x4c91ec);}}});};exports[_0xcf41('0x115')]=function(_0x4060b7,_0x2cfa90){var _0x38ea32={};var _0x7f1572={};var _0x40247b;var _0x48b527;return db['ChatWebsite']['findOne']({'where':{'id':_0x4060b7[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x2cfa90,null))[_0xcf41('0x28')](function(_0x4dd53e){if(_0x4dd53e){_0x40247b=_0x4dd53e;_0x7f1572['model']=_[_0xcf41('0x5b')](db['ChatApplication'][_0xcf41('0x34')]);_0x7f1572[_0xcf41('0x3a')]=_[_0xcf41('0x5b')](_0x4060b7['query']);_0x7f1572[_0xcf41('0x3b')]=_['intersection'](_0x7f1572[_0xcf41('0x38')],_0x7f1572[_0xcf41('0x3a')]);_0x38ea32[_0xcf41('0x3d')]=_[_0xcf41('0x3c')](_0x7f1572['model'],qs[_0xcf41('0x3e')](_0x4060b7['query']['fields']));_0x38ea32['attributes']=_0x38ea32[_0xcf41('0x3d')][_0xcf41('0x4c')]?_0x38ea32[_0xcf41('0x3d')]:_0x7f1572[_0xcf41('0x38')];_0x38ea32[_0xcf41('0x41')]=qs[_0xcf41('0x42')](_0x4060b7[_0xcf41('0x3a')][_0xcf41('0x42')]);_0x38ea32[_0xcf41('0x43')]=qs[_0xcf41('0x3b')](_['pick'](_0x4060b7[_0xcf41('0x3a')],_0x7f1572[_0xcf41('0x3b')]));if(_0x4060b7[_0xcf41('0x3a')][_0xcf41('0x46')]){_0x38ea32[_0xcf41('0x43')]=_['merge'](_0x38ea32['where'],{'$or':_[_0xcf41('0x39')](_0x38ea32[_0xcf41('0x3d')],function(_0x46d382){var _0x49aaf8={};_0x49aaf8[_0x46d382]={'$like':'%'+_0x4060b7['query']['filter']+'%'};return _0x49aaf8;})});}_0x38ea32=_[_0xcf41('0x44')]({},_0x38ea32,_0x4060b7[_0xcf41('0x47')]);return _0x40247b['getApplications'](_0x38ea32);}})[_0xcf41('0x28')](function(_0x2d66dd){if(_0x2d66dd){_0x48b527=_0x2d66dd[_0xcf41('0x4c')];if(!_0x4060b7[_0xcf41('0x3a')]['hasOwnProperty'](_0xcf41('0x40'))){_0x38ea32[_0xcf41('0x24')]=qs[_0xcf41('0x24')](_0x4060b7['query'][_0xcf41('0x24')]);_0x38ea32[_0xcf41('0x22')]=qs['offset'](_0x4060b7[_0xcf41('0x3a')][_0xcf41('0x22')]);}return _0x40247b[_0xcf41('0x115')](_0x38ea32);}})[_0xcf41('0x28')](function(_0x1a596e){if(_0x1a596e){return _0x1a596e?{'count':_0x48b527,'rows':_0x1a596e}:null;}})[_0xcf41('0x28')](respondWithResult(_0x2cfa90,null))['catch'](handleError(_0x2cfa90,null));};exports[_0xcf41('0x116')]=function(_0x46ce53,_0x391a69){return db[_0xcf41('0x117')]['find']({'where':{'id':_0x46ce53['params']['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x391a69,null))[_0xcf41('0x28')](function(_0x355a3a){if(_0x355a3a){return _0x355a3a[_0xcf41('0x116')](_0x46ce53[_0xcf41('0x4f')][_0xcf41('0x5e')],_['omit'](_0x46ce53[_0xcf41('0x4f')],[_0xcf41('0x5e'),'id'])||{});}})[_0xcf41('0x28')](respondWithResult(_0x391a69,null))[_0xcf41('0x1d')](handleError(_0x391a69,null));};exports[_0xcf41('0xfa')]=function(_0x1ba7de,_0x5bb656){var _0x3ee280={};var _0x2c7405={};var _0x4cebd2;var _0x6e6536;return db[_0xcf41('0x33')][_0xcf41('0x5a')]({'where':{'id':_0x1ba7de[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x5bb656,null))['then'](function(_0x43a9ad){if(_0x43a9ad){_0x4cebd2=_0x43a9ad;_0x2c7405[_0xcf41('0x38')]=_[_0xcf41('0x5b')](db[_0xcf41('0x118')][_0xcf41('0x34')]);_0x2c7405[_0xcf41('0x3a')]=_[_0xcf41('0x5b')](_0x1ba7de['query']);_0x2c7405[_0xcf41('0x3b')]=_[_0xcf41('0x3c')](_0x2c7405[_0xcf41('0x38')],_0x2c7405[_0xcf41('0x3a')]);_0x3ee280[_0xcf41('0x3d')]=_[_0xcf41('0x3c')](_0x2c7405[_0xcf41('0x38')],qs[_0xcf41('0x3e')](_0x1ba7de[_0xcf41('0x3a')][_0xcf41('0x3e')]));_0x3ee280[_0xcf41('0x3d')]=_0x3ee280[_0xcf41('0x3d')][_0xcf41('0x4c')]?_0x3ee280['attributes']:_0x2c7405[_0xcf41('0x38')];_0x3ee280['order']=qs[_0xcf41('0x42')](_0x1ba7de[_0xcf41('0x3a')][_0xcf41('0x42')]);_0x3ee280[_0xcf41('0x43')]=qs['filters'](_[_0xcf41('0x5c')](_0x1ba7de[_0xcf41('0x3a')],_0x2c7405[_0xcf41('0x3b')]));if(_0x1ba7de['query'][_0xcf41('0x46')]){_0x3ee280[_0xcf41('0x43')]=_['merge'](_0x3ee280[_0xcf41('0x43')],{'$or':_[_0xcf41('0x39')](_0x3ee280[_0xcf41('0x3d')],function(_0x39d9fd){var _0x47a42b={};_0x47a42b[_0x39d9fd]={'$like':'%'+_0x1ba7de[_0xcf41('0x3a')][_0xcf41('0x46')]+'%'};return _0x47a42b;})});}_0x3ee280=_['merge']({},_0x3ee280,_0x1ba7de[_0xcf41('0x47')]);return _0x4cebd2[_0xcf41('0xfa')](_0x3ee280);}})['then'](function(_0x4ee4e4){if(_0x4ee4e4){_0x6e6536=_0x4ee4e4[_0xcf41('0x4c')];if(!_0x1ba7de[_0xcf41('0x3a')][_0xcf41('0x3f')]('nolimit')){_0x3ee280[_0xcf41('0x24')]=qs[_0xcf41('0x24')](_0x1ba7de[_0xcf41('0x3a')]['limit']);_0x3ee280[_0xcf41('0x22')]=qs[_0xcf41('0x22')](_0x1ba7de[_0xcf41('0x3a')][_0xcf41('0x22')]);}return _0x4cebd2['getProactiveActions'](_0x3ee280);}})[_0xcf41('0x28')](function(_0x16332e){if(_0x16332e){return _0x16332e?{'count':_0x6e6536,'rows':_0x16332e}:null;}})[_0xcf41('0x28')](respondWithResult(_0x5bb656,null))[_0xcf41('0x1d')](handleError(_0x5bb656,null));};exports[_0xcf41('0x119')]=function(_0x53cdd6,_0x1f2f98){var _0x1b7930=_0x53cdd6[_0xcf41('0x3a')][_0xcf41('0x11a')]===_0xcf41('0x11b')?_0xcf41('0x11c'):_0xcf41('0x11d');return db['ChatWebsite']['find']({'attributes':['id',_0x1b7930],'where':{'id':_0x53cdd6['params']['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x1f2f98,null))[_0xcf41('0x28')](function(_0x4485a1){if(_0x4485a1){var _0x18922a=_0x4485a1[_0x1b7930];var _0x2f9917=_0x18922a&&_0x18922a['items']?_0x18922a[_0xcf41('0x11e')]:[];_0x1f2f98['send']({'fromKey':_[_0xcf41('0x78')](_0x18922a[_0xcf41('0x11f')])?undefined:_0x18922a['fromKey'],'count':_0x2f9917['length'],'rows':_0x2f9917});}})[_0xcf41('0x1d')](handleError(_0x1f2f98,null));};exports[_0xcf41('0x120')]=function(_0x2de0de,_0x38fcde){var _0x120b1c={'raw':![],'where':{}};var _0x1e27c7={};var _0x3472b3={'count':0x0,'rows':[]};return db[_0xcf41('0x33')][_0xcf41('0x5a')]({'where':{'id':_0x2de0de[_0xcf41('0x55')]['id']}})['then'](handleEntityNotFound(_0x38fcde,null))['then'](function(_0x513588){if(_0x513588){_0x1e27c7[_0xcf41('0x38')]=_[_0xcf41('0x5b')](db['ChatOfflineMessage'][_0xcf41('0x34')]);_0x1e27c7[_0xcf41('0x3a')]=_['keys'](_0x2de0de[_0xcf41('0x3a')]);_0x1e27c7[_0xcf41('0x3b')]=_[_0xcf41('0x3c')](_0x1e27c7[_0xcf41('0x38')],_0x1e27c7[_0xcf41('0x3a')]);_0x120b1c[_0xcf41('0x3d')]=_['intersection'](_0x1e27c7[_0xcf41('0x38')],qs['fields'](_0x2de0de[_0xcf41('0x3a')][_0xcf41('0x3e')]));_0x120b1c[_0xcf41('0x3d')]=_0x120b1c[_0xcf41('0x3d')][_0xcf41('0x4c')]?_0x120b1c[_0xcf41('0x3d')]:_0x1e27c7[_0xcf41('0x38')];if(!_0x2de0de[_0xcf41('0x3a')][_0xcf41('0x3f')]('nolimit')){_0x120b1c[_0xcf41('0x24')]=qs[_0xcf41('0x24')](_0x2de0de[_0xcf41('0x3a')][_0xcf41('0x24')]);_0x120b1c[_0xcf41('0x22')]=qs[_0xcf41('0x22')](_0x2de0de[_0xcf41('0x3a')]['offset']);}_0x120b1c[_0xcf41('0x41')]=qs['sort'](_0x2de0de[_0xcf41('0x3a')][_0xcf41('0x42')]);_0x120b1c[_0xcf41('0x43')]=qs['filters'](_[_0xcf41('0x5c')](_0x2de0de[_0xcf41('0x3a')],_0x1e27c7[_0xcf41('0x3b')]));_0x120b1c[_0xcf41('0x43')][_0xcf41('0x57')]=_0x513588['id'];if(_0x2de0de[_0xcf41('0x3a')][_0xcf41('0x46')]){_0x120b1c[_0xcf41('0x43')]=_[_0xcf41('0x44')](_0x120b1c[_0xcf41('0x43')],{'$or':_[_0xcf41('0x39')](_0x120b1c[_0xcf41('0x3d')],function(_0x12d097){var _0x5d63d3={};_0x5d63d3[_0x12d097]={'$like':'%'+_0x2de0de['query']['filter']+'%'};return _0x5d63d3;})});}_0x120b1c=_[_0xcf41('0x44')]({},_0x120b1c,_0x2de0de[_0xcf41('0x47')]);return db[_0xcf41('0x121')][_0xcf41('0x25')]({'where':_0x120b1c[_0xcf41('0x43')]})[_0xcf41('0x28')](function(_0x52ecd0){_0x3472b3['count']=_0x52ecd0;if(_0x2de0de[_0xcf41('0x3a')][_0xcf41('0x48')]){_0x120b1c[_0xcf41('0x49')]=[{'all':!![]}];}else{_0x120b1c[_0xcf41('0x49')]=[{'model':db['CmContact'],'as':_0xcf41('0xe6'),'required':![]},{'model':db[_0xcf41('0xd0')],'as':'Attachments','required':![]}];}return db[_0xcf41('0x121')][_0xcf41('0x4a')](_0x120b1c);})[_0xcf41('0x28')](function(_0x429197){_0x3472b3[_0xcf41('0x4b')]=_0x429197;return _0x3472b3;});}})[_0xcf41('0x28')](respondWithFilteredResult(_0x38fcde,_0x120b1c))[_0xcf41('0x1d')](handleError(_0x38fcde,null));};exports[_0xcf41('0x122')]=function(_0x1a42d4,_0x43f2ae){return db['ChatWebsite'][_0xcf41('0x4d')]({'where':{'id':_0x1a42d4[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x43f2ae,null))[_0xcf41('0x28')](function(_0x1cf01c){if(_0x1cf01c){return _0x1cf01c['addAgents'](_0x1a42d4[_0xcf41('0x4f')][_0xcf41('0x5e')],_['omit'](_0x1a42d4['body'],[_0xcf41('0x5e'),'id'])||{})[_0xcf41('0xc5')](function(_0x1c52b0){for(var _0x36a3d7=0x0;_0x36a3d7<_0x1a42d4['body']['ids'][_0xcf41('0x4c')];_0x36a3d7+=0x1){socket[_0xcf41('0x123')](_0xcf41('0x124'),{'UserId':Number(_0x1a42d4[_0xcf41('0x4f')][_0xcf41('0x5e')][_0x36a3d7]),'ChatWebsiteId':Number(_0x1a42d4['params']['id'])});}return _0x1c52b0;});}})[_0xcf41('0x28')](respondWithResult(_0x43f2ae,null))['catch'](handleError(_0x43f2ae,null));};exports[_0xcf41('0x125')]=function(_0x53a48d,_0x45b3f2){return db['ChatWebsite']['find']({'where':{'id':_0x53a48d['params']['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x45b3f2,null))['then'](function(_0x4592ae){if(_0x4592ae){return _0x4592ae['removeAgents'](_0x53a48d['query'][_0xcf41('0x5e')])[_0xcf41('0x28')](function(){if(_[_0xcf41('0x126')](_0x53a48d['query']['ids'])){for(var _0x10ea2e=0x0;_0x10ea2e<_0x53a48d[_0xcf41('0x3a')][_0xcf41('0x5e')]['length'];_0x10ea2e+=0x1){socket[_0xcf41('0x123')](_0xcf41('0x127'),{'UserId':Number(_0x53a48d[_0xcf41('0x3a')][_0xcf41('0x5e')][_0x10ea2e]),'ChatWebsiteId':Number(_0x53a48d[_0xcf41('0x55')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x53a48d['query'][_0xcf41('0x5e')]),'ChatWebsiteId':Number(_0x53a48d['params']['id'])});}});}})[_0xcf41('0x28')](respondWithStatusCode(_0x45b3f2,null))[_0xcf41('0x1d')](handleError(_0x45b3f2,null));};exports[_0xcf41('0x128')]=function(_0x3e0875,_0x3a9a8d){var _0x39041b={};var _0x5a5aac={};var _0x4690ee;var _0x26f382;return db[_0xcf41('0x33')][_0xcf41('0x5a')]({'where':{'id':_0x3e0875[_0xcf41('0x55')]['id']}})[_0xcf41('0x28')](handleEntityNotFound(_0x3a9a8d,null))[_0xcf41('0x28')](function(_0x47c43d){if(_0x47c43d){_0x4690ee=_0x47c43d;_0x5a5aac[_0xcf41('0x38')]=_[_0xcf41('0x5b')](db['User'][_0xcf41('0x34')]);_0x5a5aac[_0xcf41('0x3a')]=_['keys'](_0x3e0875[_0xcf41('0x3a')]);_0x5a5aac['filters']=_[_0xcf41('0x3c')](_0x5a5aac[_0xcf41('0x38')],_0x5a5aac[_0xcf41('0x3a')]);_0x39041b[_0xcf41('0x3d')]=_[_0xcf41('0x3c')](_0x5a5aac['model'],qs['fields'](_0x3e0875[_0xcf41('0x3a')][_0xcf41('0x3e')]));_0x39041b[_0xcf41('0x3d')]=_0x39041b[_0xcf41('0x3d')][_0xcf41('0x4c')]?_0x39041b[_0xcf41('0x3d')]:_0x5a5aac[_0xcf41('0x38')];_0x39041b[_0xcf41('0x41')]=qs[_0xcf41('0x42')](_0x3e0875[_0xcf41('0x3a')]['sort']);_0x39041b[_0xcf41('0x43')]=qs[_0xcf41('0x3b')](_[_0xcf41('0x5c')](_0x3e0875[_0xcf41('0x3a')],_0x5a5aac[_0xcf41('0x3b')]));if(_0x3e0875[_0xcf41('0x3a')][_0xcf41('0x46')]){_0x39041b[_0xcf41('0x43')]=_[_0xcf41('0x44')](_0x39041b[_0xcf41('0x43')],{'$or':_['map'](_0x39041b[_0xcf41('0x3d')],function(_0x516583){var _0x96fb53={};_0x96fb53[_0x516583]={'$like':'%'+_0x3e0875[_0xcf41('0x3a')][_0xcf41('0x46')]+'%'};return _0x96fb53;})});}_0x39041b=_['merge']({},_0x39041b,_0x3e0875[_0xcf41('0x47')]);return _0x4690ee[_0xcf41('0x128')](_0x39041b);}})['then'](function(_0x544d63){if(_0x544d63){_0x26f382=_0x544d63['length'];if(!_0x3e0875[_0xcf41('0x3a')][_0xcf41('0x3f')](_0xcf41('0x40'))){_0x39041b['limit']=qs[_0xcf41('0x24')](_0x3e0875[_0xcf41('0x3a')][_0xcf41('0x24')]);_0x39041b['offset']=qs[_0xcf41('0x22')](_0x3e0875[_0xcf41('0x3a')][_0xcf41('0x22')]);}return _0x4690ee['getAgents'](_0x39041b);}})['then'](function(_0x22e914){if(_0x22e914){return _0x22e914?{'count':_0x26f382,'rows':_0x22e914}:null;}})[_0xcf41('0x28')](respondWithResult(_0x3a9a8d,null))[_0xcf41('0x1d')](handleError(_0x3a9a8d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 5874d65..f9226fd 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 _0x269f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','save','remove'];(function(_0x83420c,_0x50fd91){var _0x1057d7=function(_0x80befc){while(--_0x80befc){_0x83420c['push'](_0x83420c['shift']());}};_0x1057d7(++_0x50fd91);}(_0x269f,0xee));var _0xf269=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x269f[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xf269('0x0'));var ChatWebsite=require(_0xf269('0x1'))['db'][_0xf269('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf269('0x3'),'afterUpdate':'update','afterDestroy':_0xf269('0x4')};function emitEvent(_0x35e943){return function(_0x230d12,_0x22032a,_0x1f9a64){ChatWebsiteEvents['emit'](_0x35e943+':'+_0x230d12['id'],_0x230d12);ChatWebsiteEvents[_0xf269('0x5')](_0x35e943,_0x230d12);_0x1f9a64(null);};}for(var e in events){if(events[_0xf269('0x6')](e)){var event=events[e];ChatWebsite[_0xf269('0x7')](e,emitEvent(event));}}module[_0xf269('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xff96=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x33c941,_0x396663){var _0x1574bc=function(_0x5c7c75){while(--_0x5c7c75){_0x33c941['push'](_0x33c941['shift']());}};_0x1574bc(++_0x396663);}(_0xff96,0x179));var _0x6ff9=function(_0x5a8f34,_0x11c27b){_0x5a8f34=_0x5a8f34-0x0;var _0x497614=_0xff96[_0x5a8f34];return _0x497614;};'use strict';var EventEmitter=require(_0x6ff9('0x0'));var ChatWebsite=require(_0x6ff9('0x1'))['db'][_0x6ff9('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6ff9('0x3')](0x0);var events={'afterCreate':_0x6ff9('0x4'),'afterUpdate':_0x6ff9('0x5'),'afterDestroy':_0x6ff9('0x6')};function emitEvent(_0x1a81c5){return function(_0x3561d7,_0x207c06,_0x874737){ChatWebsiteEvents[_0x6ff9('0x7')](_0x1a81c5+':'+_0x3561d7['id'],_0x3561d7);ChatWebsiteEvents['emit'](_0x1a81c5,_0x3561d7);_0x874737(null);};}for(var e in events){if(events[_0x6ff9('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 717610a..45884a2 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 _0xbce6=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','ChatWebsite','chat_websites'];(function(_0x1012f0,_0xed36f7){var _0x5d0f7f=function(_0x3f16ec){while(--_0x3f16ec){_0x1012f0['push'](_0x1012f0['shift']());}};_0x5d0f7f(++_0xed36f7);}(_0xbce6,0x176));var _0x6bce=function(_0x1c24e9,_0x3a8e49){_0x1c24e9=_0x1c24e9-0x0;var _0xe4fdb2=_0xbce6[_0x1c24e9];return _0xe4fdb2;};'use strict';var _=require('lodash');var util=require(_0x6bce('0x0'));var logger=require(_0x6bce('0x1'))(_0x6bce('0x2'));var moment=require(_0x6bce('0x3'));var BPromise=require(_0x6bce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bce('0x5'));var rimraf=require('rimraf');var config=require(_0x6bce('0x6'));var attributes=require('./chatWebsite.attributes');module[_0x6bce('0x7')]=function(_0x1ef6a7,_0x2733d6){return _0x1ef6a7[_0x6bce('0x8')](_0x6bce('0x9'),attributes,{'tableName':_0x6bce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9c1=['bluebird','request-promise','rimraf','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment'];(function(_0x316469,_0x32a8d4){var _0x43d3ae=function(_0x1dee88){while(--_0x1dee88){_0x316469['push'](_0x316469['shift']());}};_0x43d3ae(++_0x32a8d4);}(_0xe9c1,0xf7));var _0x1e9c=function(_0x377c40,_0xf252cf){_0x377c40=_0x377c40-0x0;var _0x1f6e34=_0xe9c1[_0x377c40];return _0x1f6e34;};'use strict';var _=require(_0x1e9c('0x0'));var util=require(_0x1e9c('0x1'));var logger=require(_0x1e9c('0x2'))(_0x1e9c('0x3'));var moment=require(_0x1e9c('0x4'));var BPromise=require(_0x1e9c('0x5'));var rp=require(_0x1e9c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e9c('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e9c('0x8'));module[_0x1e9c('0x9')]=function(_0xa718fd,_0x58d123){return _0xa718fd['define'](_0x1e9c('0xa'),attributes,{'tableName':_0x1e9c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index c4f2ba5..786fae1 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 _0x3960=['defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client'];(function(_0x35ad5c,_0x58ccf7){var _0x2bd8aa=function(_0x426bdf){while(--_0x426bdf){_0x35ad5c['push'](_0x35ad5c['shift']());}};_0x2bd8aa(++_0x58ccf7);}(_0x3960,0xaf));var _0x0396=function(_0x3de8c5,_0x434f8f){_0x3de8c5=_0x3de8c5-0x0;var _0x48a800=_0x3960[_0x3de8c5];return _0x48a800;};'use strict';var _=require(_0x0396('0x0'));var util=require(_0x0396('0x1'));var moment=require(_0x0396('0x2'));var BPromise=require(_0x0396('0x3'));var rs=require(_0x0396('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0396('0x5'))(_0x0396('0x6'));var config=require(_0x0396('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0396('0x8')]['http']({'port':0x232a});config['redis']=_[_0x0396('0x9')](config[_0x0396('0xa')],{'host':_0x0396('0xb'),'port':0x18eb});var socket=require(_0x0396('0xc'))(new Redis(config['redis']));require(_0x0396('0xd'))['register'](socket);function respondWithRpcPromise(_0x19be2b,_0x5c1cce,_0x1510c1){return new BPromise(function(_0x2f8d51,_0xfeb61a){return client[_0x0396('0xe')](_0x19be2b,_0x1510c1)[_0x0396('0xf')](function(_0xf02a22){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5c1cce,_0x0396('0x10'));logger[_0x0396('0x11')](_0x0396('0x12'),_0x5c1cce,_0x0396('0x10'),JSON['stringify'](_0xf02a22));if(_0xf02a22[_0x0396('0x13')]){if(_0xf02a22['error'][_0x0396('0x14')]===0x1f4){logger[_0x0396('0x13')](_0x0396('0x15'),_0x5c1cce,_0xf02a22[_0x0396('0x13')][_0x0396('0x16')]);return _0xfeb61a(_0xf02a22[_0x0396('0x13')]['message']);}logger[_0x0396('0x13')](_0x0396('0x15'),_0x5c1cce,_0xf02a22[_0x0396('0x13')]['message']);return _0x2f8d51(_0xf02a22[_0x0396('0x13')][_0x0396('0x16')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5c1cce,_0x0396('0x10'));_0x2f8d51(_0xf02a22['result'][_0x0396('0x16')]);}})['catch'](function(_0x3f1e39){logger[_0x0396('0x13')](_0x0396('0x15'),_0x5c1cce,_0x3f1e39);_0xfeb61a(_0x3f1e39);});});} \ No newline at end of file +var _0xaf9e=['./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xaf9e,0x64));var _0xeaf9=function(_0x13699c,_0x1d1531){_0x13699c=_0x13699c-0x0;var _0x41831f=_0xaf9e[_0x13699c];return _0x41831f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeaf9('0x0'));var BPromise=require(_0xeaf9('0x1'));var rs=require(_0xeaf9('0x2'));var fs=require('fs');var Redis=require(_0xeaf9('0x3'));var db=require(_0xeaf9('0x4'))['db'];var utils=require(_0xeaf9('0x5'));var logger=require(_0xeaf9('0x6'))(_0xeaf9('0x7'));var config=require(_0xeaf9('0x8'));var jayson=require(_0xeaf9('0x9'));var client=jayson[_0xeaf9('0xa')][_0xeaf9('0xb')]({'port':0x232a});config[_0xeaf9('0xc')]=_[_0xeaf9('0xd')](config[_0xeaf9('0xc')],{'host':_0xeaf9('0xe'),'port':0x18eb});var socket=require(_0xeaf9('0xf'))(new Redis(config[_0xeaf9('0xc')]));require(_0xeaf9('0x10'))[_0xeaf9('0x11')](socket);function respondWithRpcPromise(_0x1370e0,_0x57efe9,_0x5941fa){return new BPromise(function(_0x2fbbbe,_0x59e83a){return client[_0xeaf9('0x12')](_0x1370e0,_0x5941fa)[_0xeaf9('0x13')](function(_0x29cdf1){logger['info'](_0xeaf9('0x14'),_0x57efe9,'request\x20sent');logger[_0xeaf9('0x15')](_0xeaf9('0x16'),_0x57efe9,'request\x20sent',JSON['stringify'](_0x29cdf1));if(_0x29cdf1[_0xeaf9('0x17')]){if(_0x29cdf1[_0xeaf9('0x17')][_0xeaf9('0x18')]===0x1f4){logger['error'](_0xeaf9('0x14'),_0x57efe9,_0x29cdf1[_0xeaf9('0x17')][_0xeaf9('0x19')]);return _0x59e83a(_0x29cdf1[_0xeaf9('0x17')][_0xeaf9('0x19')]);}logger[_0xeaf9('0x17')](_0xeaf9('0x14'),_0x57efe9,_0x29cdf1[_0xeaf9('0x17')]['message']);return _0x2fbbbe(_0x29cdf1[_0xeaf9('0x17')]['message']);}else{logger[_0xeaf9('0x1a')](_0xeaf9('0x14'),_0x57efe9,'request\x20sent');_0x2fbbbe(_0x29cdf1[_0xeaf9('0x1b')][_0xeaf9('0x19')]);}})[_0xeaf9('0x1c')](function(_0x3837f7){logger['error'](_0xeaf9('0x14'),_0x57efe9,_0x3837f7);_0x59e83a(_0x3837f7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 2b7ccf6..76aa766 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 _0x513f=['length','chatWebsite:','./chatWebsite.events','save','remove','update','removeListener','register'];(function(_0x4fb334,_0x4ca8c9){var _0x56dc84=function(_0x470d7b){while(--_0x470d7b){_0x4fb334['push'](_0x4fb334['shift']());}};_0x56dc84(++_0x4ca8c9);}(_0x513f,0x12a));var _0xf513=function(_0x214ec1,_0x5ace17){_0x214ec1=_0x214ec1-0x0;var _0x54e5f5=_0x513f[_0x214ec1];return _0x54e5f5;};'use strict';var ChatWebsiteEvents=require(_0xf513('0x0'));var events=[_0xf513('0x1'),_0xf513('0x2'),_0xf513('0x3')];function createListener(_0x40c4d7,_0x54cb8a){return function(_0x5a87f3){_0x54cb8a['emit'](_0x40c4d7,_0x5a87f3);};}function removeListener(_0x18639a,_0x2cc3fa){return function(){ChatWebsiteEvents[_0xf513('0x4')](_0x18639a,_0x2cc3fa);};}exports[_0xf513('0x5')]=function(_0x1e94de){for(var _0x15a461=0x0,_0x4202e0=events[_0xf513('0x6')];_0x15a461<_0x4202e0;_0x15a461++){var _0x3c1733=events[_0x15a461];var _0x888a12=createListener(_0xf513('0x7')+_0x3c1733,_0x1e94de);ChatWebsiteEvents['on'](_0x3c1733,_0x888a12);}}; \ No newline at end of file +var _0x2511=['removeListener','length','chatWebsite:','./chatWebsite.events','save','update'];(function(_0x1d8242,_0x47413c){var _0x1cbd9a=function(_0x28842c){while(--_0x28842c){_0x1d8242['push'](_0x1d8242['shift']());}};_0x1cbd9a(++_0x47413c);}(_0x2511,0x135));var _0x1251=function(_0x20c99d,_0x5ca65e){_0x20c99d=_0x20c99d-0x0;var _0x148af0=_0x2511[_0x20c99d];return _0x148af0;};'use strict';var ChatWebsiteEvents=require(_0x1251('0x0'));var events=[_0x1251('0x1'),'remove',_0x1251('0x2')];function createListener(_0x657f10,_0x25139a){return function(_0x2089ba){_0x25139a['emit'](_0x657f10,_0x2089ba);};}function removeListener(_0x40a8e6,_0x5bca2e){return function(){ChatWebsiteEvents[_0x1251('0x3')](_0x40a8e6,_0x5bca2e);};}exports['register']=function(_0x18e71c){for(var _0x18b8ae=0x0,_0xcd10a7=events[_0x1251('0x4')];_0x18b8ae<_0xcd10a7;_0x18b8ae++){var _0x2078d0=events[_0x18b8ae];var _0x5dacaa=createListener(_0x1251('0x5')+_0x2078d0,_0x18e71c);ChatWebsiteEvents['on'](_0x2078d0,_0x5dacaa);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c8b2580..d5b335f 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 _0x9f94=['offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','/describe','describe','/:id','show','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments'];(function(_0x53fb41,_0x500026){var _0x3f3cbd=function(_0x261510){while(--_0x261510){_0x53fb41['push'](_0x53fb41['shift']());}};_0x3f3cbd(++_0x500026);}(_0x9f94,0x1db));var _0x49f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9f94[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x49f9('0x0'));var util=require('util');var path=require(_0x49f9('0x1'));var timeout=require(_0x49f9('0x2'));var express=require(_0x49f9('0x3'));var router=express[_0x49f9('0x4')]();var fs_extra=require(_0x49f9('0x5'));var auth=require(_0x49f9('0x6'));var interaction=require(_0x49f9('0x7'));var config=require('../../config/environment');var controller=require(_0x49f9('0x8'));router['get']('/',auth[_0x49f9('0x9')](),controller['index']);router['get'](_0x49f9('0xa'),auth['isAuthenticated'](),controller[_0x49f9('0xb')]);router['get'](_0x49f9('0xc'),auth[_0x49f9('0x9')](),controller[_0x49f9('0xd')]);router[_0x49f9('0xe')](_0x49f9('0xf'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x10')]);router[_0x49f9('0xe')](_0x49f9('0x11'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x12')]);router['get'](_0x49f9('0x13'),controller[_0x49f9('0x14')]);router['get'](_0x49f9('0x15'),controller[_0x49f9('0x16')]);router[_0x49f9('0xe')](_0x49f9('0x17'),controller['getCustomerAvatar']);router[_0x49f9('0xe')]('/:id/system_avatar',controller[_0x49f9('0x18')]);router[_0x49f9('0xe')](_0x49f9('0x19'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x1a')]);router['get'](_0x49f9('0x1b'),controller['getSnippet']);router['get']('/:id/applications',auth[_0x49f9('0x9')](),controller[_0x49f9('0x1c')]);router[_0x49f9('0xe')]('/:id/proactive_actions',auth[_0x49f9('0x9')](),controller[_0x49f9('0x1d')]);router[_0x49f9('0xe')](_0x49f9('0x1e'),controller[_0x49f9('0x1f')]);router[_0x49f9('0xe')](_0x49f9('0x20'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x21')]);router[_0x49f9('0xe')](_0x49f9('0x22'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x23')]);router[_0x49f9('0x24')]('/',auth['isAuthenticated'](),controller[_0x49f9('0x25')]);router[_0x49f9('0x24')](_0x49f9('0xf'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x26')]);router['post'](_0x49f9('0x11'),auth[_0x49f9('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x4cde16,_0x2298c8,_0x42af43){_0x42af43(null,path[_0x49f9('0x28')](config[_0x49f9('0x29')],'server/files/images/logos/'));},'filename':function(_0x21f8d1,_0xcdfb65,_0xbf230a){_0xbf230a(null,util[_0x49f9('0x2a')](_0x49f9('0x2b'),Date[_0x49f9('0x2c')](),_0xcdfb65[_0x49f9('0x2d')]));}})});router[_0x49f9('0x24')]('/:id/logo',upload[_0x49f9('0x2e')](_0x49f9('0x2f')),controller[_0x49f9('0x30')]);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x147b0b,_0x1358e8,_0x119eff){_0x119eff(null,path[_0x49f9('0x28')](config['root'],_0x49f9('0x31')));},'filename':function(_0x387a85,_0x712830,_0x158738){_0x158738(null,util[_0x49f9('0x2a')](_0x49f9('0x2b'),Date[_0x49f9('0x2c')](),_0x712830[_0x49f9('0x2d')]));}})});router['post'](_0x49f9('0x15'),upload['single'](_0x49f9('0x2f')),controller[_0x49f9('0x32')]);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x194718,_0x13d5a3,_0x47ff42){_0x47ff42(null,path[_0x49f9('0x28')](config['root'],_0x49f9('0x31')));},'filename':function(_0x15501c,_0x2dd588,_0x5ba3fe){_0x5ba3fe(null,util[_0x49f9('0x2a')](_0x49f9('0x2b'),Date['now'](),_0x2dd588[_0x49f9('0x2d')]));}})});router[_0x49f9('0x24')](_0x49f9('0x17'),upload[_0x49f9('0x2e')](_0x49f9('0x2f')),controller[_0x49f9('0x33')]);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x6d2ed4,_0x383ca2,_0x3a1162){_0x3a1162(null,path['join'](config[_0x49f9('0x29')],_0x49f9('0x31')));},'filename':function(_0x5d32d7,_0x40f334,_0x1eeb1c){_0x1eeb1c(null,util['format'](_0x49f9('0x2b'),Date['now'](),_0x40f334[_0x49f9('0x2d')]));}})});router['post'](_0x49f9('0x34'),upload[_0x49f9('0x2e')](_0x49f9('0x2f')),controller[_0x49f9('0x35')]);router[_0x49f9('0x24')](_0x49f9('0x36'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x2a03de,_0x4ee4cd,_0x5642f8){const _0x50f107=path[_0x49f9('0x28')](config[_0x49f9('0x29')],_0x49f9('0x37'),_0x49f9('0x38'),_0x49f9('0x39'));fs_extra[_0x49f9('0x3a')](_0x50f107,function(){_0x5642f8(null,_0x50f107);});},'filename':function(_0x2c75d1,_0x33d1e0,_0x56a6d3){const _0x3ababf=_0x33d1e0['originalname'][_0x49f9('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x456995=path[_0x49f9('0x3c')](_0x3ababf);const _0x4cb9f6=Date[_0x49f9('0x2c')]()+'-'+_0x3ababf[_0x49f9('0x3b')](_0x456995,'')+_0x456995;_0x56a6d3(null,_0x4cb9f6);}})});router['post'](_0x49f9('0x3d'),offlineUploadMulter['any'](),controller[_0x49f9('0x3e')]);router[_0x49f9('0x24')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x49f9('0x3f')]);router[_0x49f9('0x24')](_0x49f9('0x40'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x41')]);router[_0x49f9('0x24')](_0x49f9('0x42'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x43')]);router[_0x49f9('0x24')]('/:id/users',auth[_0x49f9('0x9')](),controller[_0x49f9('0x44')]);router[_0x49f9('0x45')](_0x49f9('0xc'),auth['isAuthenticated'](),controller[_0x49f9('0x46')]);router[_0x49f9('0x47')]('/:id',auth[_0x49f9('0x9')](),controller[_0x49f9('0x48')]);router[_0x49f9('0x47')](_0x49f9('0xf'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x49')]);router[_0x49f9('0x47')](_0x49f9('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x49f9('0x22'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x4a')]);module[_0x49f9('0x4b')]=router; \ No newline at end of file +var _0x3b9d=['/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','post','addDisposition','addAnswer','root','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','diskStorage','join','server/files/images/avatars/','format','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar'];(function(_0x21001b,_0x3ff1a8){var _0x665a00=function(_0x98d912){while(--_0x98d912){_0x21001b['push'](_0x21001b['shift']());}};_0x665a00(++_0x3ff1a8);}(_0x3b9d,0xc4));var _0xd3b9=function(_0x3a60af,_0x4062a8){_0x3a60af=_0x3a60af-0x0;var _0x5be0ec=_0x3b9d[_0x3a60af];return _0x5be0ec;};'use strict';var multer=require(_0xd3b9('0x0'));var util=require('util');var path=require(_0xd3b9('0x1'));var timeout=require(_0xd3b9('0x2'));var express=require(_0xd3b9('0x3'));var router=express[_0xd3b9('0x4')]();var fs_extra=require(_0xd3b9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd3b9('0x6'));var controller=require('./chatWebsite.controller');router[_0xd3b9('0x7')]('/',auth['isAuthenticated'](),controller[_0xd3b9('0x8')]);router[_0xd3b9('0x7')](_0xd3b9('0x9'),auth[_0xd3b9('0xa')](),controller['describe']);router['get'](_0xd3b9('0xb'),auth['isAuthenticated'](),controller[_0xd3b9('0xc')]);router['get'](_0xd3b9('0xd'),auth[_0xd3b9('0xa')](),controller[_0xd3b9('0xe')]);router[_0xd3b9('0x7')](_0xd3b9('0xf'),auth[_0xd3b9('0xa')](),controller[_0xd3b9('0x10')]);router[_0xd3b9('0x7')](_0xd3b9('0x11'),controller[_0xd3b9('0x12')]);router[_0xd3b9('0x7')](_0xd3b9('0x13'),controller[_0xd3b9('0x14')]);router['get'](_0xd3b9('0x15'),controller[_0xd3b9('0x16')]);router[_0xd3b9('0x7')](_0xd3b9('0x17'),controller[_0xd3b9('0x18')]);router['get'](_0xd3b9('0x19'),auth['isAuthenticated'](),controller[_0xd3b9('0x1a')]);router[_0xd3b9('0x7')](_0xd3b9('0x1b'),controller['getSnippet']);router[_0xd3b9('0x7')]('/:id/applications',auth[_0xd3b9('0xa')](),controller['getApplications']);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xd3b9('0x7')](_0xd3b9('0x1c'),controller['getFields']);router['get'](_0xd3b9('0x1d'),auth['isAuthenticated'](),controller[_0xd3b9('0x1e')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xd3b9('0x1f')]);router[_0xd3b9('0x20')]('/',auth[_0xd3b9('0xa')](),controller['create']);router[_0xd3b9('0x20')]('/:id/dispositions',auth[_0xd3b9('0xa')](),controller[_0xd3b9('0x21')]);router[_0xd3b9('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd3b9('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x163ca8,_0x319226,_0x3e80a4){_0x3e80a4(null,path['join'](config[_0xd3b9('0x23')],_0xd3b9('0x24')));},'filename':function(_0x76863f,_0x43c4ff,_0x3d9a58){_0x3d9a58(null,util['format'](_0xd3b9('0x25'),Date[_0xd3b9('0x26')](),_0x43c4ff[_0xd3b9('0x27')]));}})});router[_0xd3b9('0x20')](_0xd3b9('0x11'),upload[_0xd3b9('0x28')](_0xd3b9('0x29')),controller[_0xd3b9('0x2a')]);var upload=multer({'storage':multer[_0xd3b9('0x2b')]({'destination':function(_0x12a959,_0x594fcc,_0x3e6872){_0x3e6872(null,path[_0xd3b9('0x2c')](config[_0xd3b9('0x23')],_0xd3b9('0x2d')));},'filename':function(_0x5bccfe,_0x48d34f,_0x14fec6){_0x14fec6(null,util[_0xd3b9('0x2e')](_0xd3b9('0x25'),Date[_0xd3b9('0x26')](),_0x48d34f[_0xd3b9('0x27')]));}})});router[_0xd3b9('0x20')]('/:id/avatar',upload['single']('file'),controller[_0xd3b9('0x2f')]);var upload=multer({'storage':multer[_0xd3b9('0x2b')]({'destination':function(_0x55765e,_0x101b3d,_0x591c9d){_0x591c9d(null,path['join'](config[_0xd3b9('0x23')],_0xd3b9('0x2d')));},'filename':function(_0x4b50ee,_0x2a6f64,_0x51bd86){_0x51bd86(null,util['format'](_0xd3b9('0x25'),Date[_0xd3b9('0x26')](),_0x2a6f64[_0xd3b9('0x27')]));}})});router['post'](_0xd3b9('0x15'),upload[_0xd3b9('0x28')](_0xd3b9('0x29')),controller[_0xd3b9('0x30')]);var upload=multer({'storage':multer[_0xd3b9('0x2b')]({'destination':function(_0x404b45,_0x3e1310,_0x156425){_0x156425(null,path['join'](config[_0xd3b9('0x23')],_0xd3b9('0x2d')));},'filename':function(_0x4e120a,_0x51cc5c,_0x3ca59b){_0x3ca59b(null,util['format']('%s-%s',Date[_0xd3b9('0x26')](),_0x51cc5c[_0xd3b9('0x27')]));}})});router['post'](_0xd3b9('0x17'),upload[_0xd3b9('0x28')]('file'),controller['addSystemAvatar']);router[_0xd3b9('0x20')](_0xd3b9('0x31'),controller[_0xd3b9('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xd3b9('0x2b')]({'destination':function(_0x265537,_0x5b9c2b,_0x3538d3){const _0x3032bc=path[_0xd3b9('0x2c')](config[_0xd3b9('0x23')],_0xd3b9('0x33'),_0xd3b9('0x34'),_0xd3b9('0x35'));fs_extra[_0xd3b9('0x36')](_0x3032bc,function(){_0x3538d3(null,_0x3032bc);});},'filename':function(_0x485b83,_0x590e5a,_0x2d24b2){const _0x53b1fd=_0x590e5a['originalname'][_0xd3b9('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x79dccf=path[_0xd3b9('0x38')](_0x53b1fd);const _0x2550e0=Date[_0xd3b9('0x26')]()+'-'+_0x53b1fd[_0xd3b9('0x37')](_0x79dccf,'')+_0x79dccf;_0x2d24b2(null,_0x2550e0);}})});router[_0xd3b9('0x20')]('/:id/offline',offlineUploadMulter[_0xd3b9('0x39')](),controller[_0xd3b9('0x3a')]);router['post'](_0xd3b9('0x19'),auth['isAuthenticated'](),controller[_0xd3b9('0x3b')]);router['post'](_0xd3b9('0x3c'),auth['isAuthenticated'](),controller[_0xd3b9('0x3d')]);router[_0xd3b9('0x20')](_0xd3b9('0x3e'),auth[_0xd3b9('0xa')](),controller['addProactiveActions']);router[_0xd3b9('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0xd3b9('0x3f')]);router[_0xd3b9('0x40')]('/:id',auth[_0xd3b9('0xa')](),controller[_0xd3b9('0x41')]);router[_0xd3b9('0x42')](_0xd3b9('0xb'),auth[_0xd3b9('0xa')](),controller[_0xd3b9('0x43')]);router[_0xd3b9('0x42')](_0xd3b9('0xd'),auth[_0xd3b9('0xa')](),controller[_0xd3b9('0x44')]);router[_0xd3b9('0x42')](_0xd3b9('0xf'),auth[_0xd3b9('0xa')](),controller[_0xd3b9('0x45')]);router[_0xd3b9('0x42')](_0xd3b9('0x46'),auth['isAuthenticated'](),controller[_0xd3b9('0x47')]);module[_0xd3b9('0x48')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c305c2d..dfc9e76 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 _0xff1b=['../components/auth/service','../config/environment','Router','env','production','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','express'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xff1b,0x143));var _0xbff1=function(_0x44b19b,_0x5d33cc){_0x44b19b=_0x44b19b-0x0;var _0x2d7858=_0xff1b[_0x44b19b];return _0x2d7858;};var beaverLogger=require(_0xbff1('0x0'));var express=require(_0xbff1('0x1'));var auth=require(_0xbff1('0x2'));var config=require(_0xbff1('0x3'));var router=express[_0xbff1('0x4')]();var isProduction=config[_0xbff1('0x5')]===_0xbff1('0x6')||![];function clientSideLogs(_0x2abac4,_0x2d2a09,_0x169a02){var _0x13b8f1=_0x2abac4['app'][_0xbff1('0x7')]('client-side-logger');if(!_0x13b8f1){throw new Error(_0xbff1('0x8'));}return beaverLogger[_0xbff1('0x9')]({'uri':'/client-logs','logger':_0x13b8f1,'enableCors':!isProduction})(_0x2abac4,_0x2d2a09,_0x169a02);}router[_0xbff1('0xa')](auth[_0xbff1('0xb')](),clientSideLogs);module[_0xbff1('0xc')]=router; \ No newline at end of file +var _0xa8be=['express','../components/auth/service','Router','env','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports'];(function(_0x1a9f06,_0x33a13e){var _0x4a7115=function(_0x49a285){while(--_0x49a285){_0x1a9f06['push'](_0x1a9f06['shift']());}};_0x4a7115(++_0x33a13e);}(_0xa8be,0x114));var _0xea8b=function(_0x323f2c,_0x38c0dd){_0x323f2c=_0x323f2c-0x0;var _0x909352=_0xa8be[_0x323f2c];return _0x909352;};var beaverLogger=require('beaver-logger/server');var express=require(_0xea8b('0x0'));var auth=require(_0xea8b('0x1'));var config=require('../config/environment');var router=express[_0xea8b('0x2')]();var isProduction=config[_0xea8b('0x3')]==='production'||![];function clientSideLogs(_0x3174ec,_0x15289a,_0x4dfb79){var _0x86ec8b=_0x3174ec['app'][_0xea8b('0x4')](_0xea8b('0x5'));if(!_0x86ec8b){throw new Error(_0xea8b('0x6'));}return beaverLogger[_0xea8b('0x7')]({'uri':_0xea8b('0x8'),'logger':_0x86ec8b,'enableCors':!isProduction})(_0x3174ec,_0x15289a,_0x4dfb79);}router[_0xea8b('0x9')](auth[_0xea8b('0xa')](),clientSideLogs);module[_0xea8b('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 3560a9c..623e432 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 _0xcbad=['Dynamics365','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','MicrosoftAzure','Outlook365'];(function(_0x168c0f,_0x579bd4){var _0xaa8902=function(_0x4ae39f){while(--_0x4ae39f){_0x168c0f['push'](_0x168c0f['shift']());}};_0xaa8902(++_0x579bd4);}(_0xcbad,0x110));var _0xdcba=function(_0x5993a5,_0x88f176){_0x5993a5=_0x5993a5-0x0;var _0x2d7a42=_0xcbad[_0x5993a5];return _0x2d7a42;};'use strict';var Sequelize=require(_0xdcba('0x0'));module[_0xdcba('0x1')]={'name':{'type':Sequelize[_0xdcba('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xdcba('0x3')](_0xdcba('0x4'),_0xdcba('0x5'),_0xdcba('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xdcba('0x3')](_0xdcba('0x7'),_0xdcba('0x8'))},'data1':{'type':Sequelize[_0xdcba('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xdcba('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xdcba('0x2')],'comment':_0xdcba('0x9')},'data5':{'type':Sequelize[_0xdcba('0xa')],'comment':_0xdcba('0xb')},'data6':{'type':Sequelize[_0xdcba('0xa')],'comment':_0xdcba('0xc')},'data7':{'type':Sequelize[_0xdcba('0xa')],'comment':_0xdcba('0xd')}}; \ No newline at end of file +var _0x14ac=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','Google','Dynamics365','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x105e4c,_0x1090c1){var _0x582984=function(_0x4ebbdd){while(--_0x4ebbdd){_0x105e4c['push'](_0x105e4c['shift']());}};_0x582984(++_0x1090c1);}(_0x14ac,0x176));var _0xc14a=function(_0x58736a,_0x5d0121){_0x58736a=_0x58736a-0x0;var _0x4518e2=_0x14ac[_0x58736a];return _0x4518e2;};'use strict';var Sequelize=require('sequelize');module[_0xc14a('0x0')]={'name':{'type':Sequelize[_0xc14a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc14a('0x2')]('AmazonAWS',_0xc14a('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc14a('0x2')]('Outlook365',_0xc14a('0x4'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xc14a('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xc14a('0x1')],'comment':_0xc14a('0x5')},'data4':{'type':Sequelize[_0xc14a('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xc14a('0x6')],'comment':_0xc14a('0x7')},'data6':{'type':Sequelize[_0xc14a('0x6')],'comment':_0xc14a('0x8')},'data7':{'type':Sequelize['TEXT'],'comment':_0xc14a('0x9')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ccc9993..192b9cd 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 _0xca8c=['fieldName','type','key','name','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','includeAll','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','localhost','socket.io-emitter','redis','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','send','padEnd','slice','map','CloudProvider','rawAttributes'];(function(_0x24ce5a,_0x25d7e9){var _0x595ae3=function(_0xf756e7){while(--_0xf756e7){_0x24ce5a['push'](_0x24ce5a['shift']());}};_0x595ae3(++_0x25d7e9);}(_0xca8c,0x102));var _0xcca8=function(_0x1558bc,_0x191ffb){_0x1558bc=_0x1558bc-0x0;var _0xfe234d=_0xca8c[_0x1558bc];return _0xfe234d;};'use strict';var _=require('lodash');var Redis=require(_0xcca8('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xcca8('0x1'));var config=require(_0xcca8('0x2'));var logger=require(_0xcca8('0x3'))(_0xcca8('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0xcca8('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0xcca8('0x6'),'port':0x18eb});var socket=require(_0xcca8('0x7'))(new Redis(config[_0xcca8('0x8')]));var redis=new Redis(config[_0xcca8('0x8')]);function respondWithStatusCode(_0x7a93d,_0x27c349){_0x27c349=_0x27c349||0xcc;return function(_0x3be8d6){if(_0x3be8d6){return _0x7a93d[_0xcca8('0x9')](_0x27c349);}return _0x7a93d[_0xcca8('0xa')](_0x27c349)[_0xcca8('0xb')]();};}function respondWithResult(_0x148c49,_0x4fc523){_0x4fc523=_0x4fc523||0xc8;return function(_0x4bcd31){if(_0x4bcd31){return _0x148c49['status'](_0x4fc523)[_0xcca8('0xc')](_0x4bcd31);}};}function respondWithFilteredResult(_0x50c614,_0x5ae436){return function(_0x4c38db){if(_0x4c38db){var _0x13e622=typeof _0x5ae436[_0xcca8('0xd')]===_0xcca8('0xe')&&typeof _0x5ae436['limit']===_0xcca8('0xe');var _0xe41aef=_0x4c38db['count'];var _0xb03554=_0x13e622?0x0:_0x5ae436[_0xcca8('0xd')];var _0x285bbe=_0x13e622?_0x4c38db[_0xcca8('0xf')]:_0x5ae436['offset']+_0x5ae436[_0xcca8('0x10')];var _0x128a59;if(_0x285bbe>=_0xe41aef){_0x285bbe=_0xe41aef;_0x128a59=0xc8;}else{_0x128a59=0xce;}_0x50c614[_0xcca8('0xa')](_0x128a59);return _0x50c614[_0xcca8('0x11')](_0xcca8('0x12'),_0xb03554+'-'+_0x285bbe+'/'+_0xe41aef)[_0xcca8('0xc')](_0x4c38db);}return null;};}function saveUpdates(_0x207245){return function(_0x34cd6e){if(_0x34cd6e){return _0x34cd6e[_0xcca8('0x13')](_0x207245)[_0xcca8('0x14')](function(_0x419d1f){return _0x419d1f;});}return null;};}function removeEntity(_0x4740b8){return function(_0x51cfea){if(_0x51cfea){return _0x51cfea[_0xcca8('0x15')]()[_0xcca8('0x14')](function(){_0x4740b8[_0xcca8('0xa')](0xcc)[_0xcca8('0xb')]();});}};}function handleEntityNotFound(_0x5a402a){return function(_0x56dcc1){if(!_0x56dcc1){_0x5a402a[_0xcca8('0x9')](0x194);}return _0x56dcc1;};}function handleError(_0x341bb1,_0x180a3b){_0x180a3b=_0x180a3b||0x1f4;return function(_0xe9d3b0){logger[_0xcca8('0x16')](_0xe9d3b0[_0xcca8('0x17')]);if(_0xe9d3b0['name']){delete _0xe9d3b0['name'];}_0x341bb1['status'](_0x180a3b)[_0xcca8('0x18')](_0xe9d3b0);};}function maskClientSecret(_0x210a6d){return _[_0xcca8('0x19')](_0x210a6d[_0xcca8('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x4b05cc,_0xa57c76){var _0x48249c={},_0x2b76ff={},_0x4dd515={'count':0x0,'rows':[]};var _0x1172cf=_[_0xcca8('0x1b')](db[_0xcca8('0x1c')][_0xcca8('0x1d')],function(_0x5c93bb){return{'name':_0x5c93bb[_0xcca8('0x1e')],'type':_0x5c93bb[_0xcca8('0x1f')][_0xcca8('0x20')]};});_0x2b76ff['model']=_[_0xcca8('0x1b')](_0x1172cf,_0xcca8('0x21'));_0x2b76ff[_0xcca8('0x22')]=_['keys'](_0x4b05cc['query']);_0x2b76ff['filters']=_[_0xcca8('0x23')](_0x2b76ff[_0xcca8('0x24')],_0x2b76ff[_0xcca8('0x22')]);_0x48249c[_0xcca8('0x25')]=_[_0xcca8('0x23')](_0x2b76ff[_0xcca8('0x24')],qs[_0xcca8('0x26')](_0x4b05cc['query'][_0xcca8('0x26')]));_0x48249c[_0xcca8('0x25')]=_0x48249c['attributes'][_0xcca8('0x27')]?_0x48249c[_0xcca8('0x25')]:_0x2b76ff[_0xcca8('0x24')];if(!_0x4b05cc[_0xcca8('0x22')][_0xcca8('0x28')](_0xcca8('0x29'))){_0x48249c[_0xcca8('0x10')]=qs[_0xcca8('0x10')](_0x4b05cc['query']['limit']);_0x48249c[_0xcca8('0xd')]=qs[_0xcca8('0xd')](_0x4b05cc[_0xcca8('0x22')][_0xcca8('0xd')]);}_0x48249c[_0xcca8('0x2a')]=qs['sort'](_0x4b05cc[_0xcca8('0x22')][_0xcca8('0x2b')]);_0x48249c['where']=qs[_0xcca8('0x2c')](_['pick'](_0x4b05cc['query'],_0x2b76ff[_0xcca8('0x2c')]),_0x1172cf);if(_0x4b05cc[_0xcca8('0x22')][_0xcca8('0x2d')]){_0x48249c[_0xcca8('0x2e')]=_[_0xcca8('0x2f')](_0x48249c['where'],{'$or':_[_0xcca8('0x1b')](_0x1172cf,function(_0x2206dc){if(_0x2206dc[_0xcca8('0x1f')]!==_0xcca8('0x30')){var _0x348421={};_0x348421[_0x2206dc[_0xcca8('0x21')]]={'$like':'%'+_0x4b05cc[_0xcca8('0x22')]['filter']+'%'};return _0x348421;}})});}_0x48249c=_[_0xcca8('0x2f')]({},_0x48249c,_0x4b05cc[_0xcca8('0x31')]);var _0x285edf={'where':_0x48249c[_0xcca8('0x2e')]};return db[_0xcca8('0x1c')][_0xcca8('0xf')](_0x285edf)[_0xcca8('0x14')](function(_0x5162fb){_0x4dd515[_0xcca8('0xf')]=_0x5162fb;if(_0x4b05cc['query']['includeAll']){_0x48249c['include']=[{'all':!![]}];}return db['CloudProvider'][_0xcca8('0x32')](_0x48249c);})[_0xcca8('0x14')](function(_0x34e769){_0x4dd515[_0xcca8('0x33')]=_[_0xcca8('0x1b')](_0x34e769,function(_0x5edb87){if(_0x5edb87[_0xcca8('0x34')]===_0xcca8('0x35')){var _0x4195a3=encryptor[_0xcca8('0x36')](_0x5edb87[_0xcca8('0x37')]);_0x5edb87[_0xcca8('0x37')]=maskClientSecret(_0x4195a3);}return _0x5edb87;});return _0x4dd515;})[_0xcca8('0x14')](respondWithFilteredResult(_0xa57c76,_0x48249c))[_0xcca8('0x38')](handleError(_0xa57c76,null));};exports[_0xcca8('0x39')]=function(_0x598e41,_0x1e182f){var _0x14bdec={'raw':!![],'where':{'id':_0x598e41[_0xcca8('0x3a')]['id']}},_0x33c369={};_0x33c369[_0xcca8('0x24')]=_[_0xcca8('0x3b')](db[_0xcca8('0x1c')][_0xcca8('0x1d')]);_0x33c369[_0xcca8('0x22')]=_[_0xcca8('0x3b')](_0x598e41['query']);_0x33c369[_0xcca8('0x2c')]=_[_0xcca8('0x23')](_0x33c369['model'],_0x33c369[_0xcca8('0x22')]);_0x14bdec[_0xcca8('0x25')]=_[_0xcca8('0x23')](_0x33c369[_0xcca8('0x24')],qs['fields'](_0x598e41[_0xcca8('0x22')]['fields']));_0x14bdec[_0xcca8('0x25')]=_0x14bdec[_0xcca8('0x25')][_0xcca8('0x27')]?_0x14bdec[_0xcca8('0x25')]:_0x33c369[_0xcca8('0x24')];if(_0x598e41[_0xcca8('0x22')][_0xcca8('0x3c')]){_0x14bdec['include']=[{'all':!![]}];}_0x14bdec=_[_0xcca8('0x2f')]({},_0x14bdec,_0x598e41['options']);return db[_0xcca8('0x1c')][_0xcca8('0x3d')](_0x14bdec)[_0xcca8('0x14')](handleEntityNotFound(_0x1e182f,null))['then'](function(_0x59fd63){if(_0x59fd63[_0xcca8('0x34')]==='MicrosoftAzure'){var _0x4f6fe2=encryptor['decryptString'](_0x59fd63[_0xcca8('0x37')]);_0x59fd63[_0xcca8('0x37')]=maskClientSecret(_0x4f6fe2);}return _0x59fd63;})[_0xcca8('0x14')](respondWithResult(_0x1e182f,null))[_0xcca8('0x38')](handleError(_0x1e182f,null));};exports[_0xcca8('0x3e')]=function(_0x255a2f,_0x5d7214){if(!_0x255a2f[_0xcca8('0x3f')]['name'])throw new Error(_0xcca8('0x40'));if(!_0x255a2f[_0xcca8('0x3f')]['service'])throw new Error(_0xcca8('0x41'));var _0x5b7718=db['CloudProvider'][_0xcca8('0x1d')][_0xcca8('0x34')]['values'];if(!_0x5b7718[_0xcca8('0x42')](_0x255a2f[_0xcca8('0x3f')][_0xcca8('0x34')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x5b7718[_0xcca8('0x43')](',\x20'));if(_0x255a2f[_0xcca8('0x3f')][_0xcca8('0x34')]==='MicrosoftAzure'&&_0x255a2f[_0xcca8('0x3f')][_0xcca8('0x37')]){_0x255a2f[_0xcca8('0x3f')]['data3']=encryptor[_0xcca8('0x44')](_0x255a2f[_0xcca8('0x3f')]['data3']);}return db['CloudProvider']['create'](_0x255a2f[_0xcca8('0x3f')],{})[_0xcca8('0x14')](respondWithResult(_0x5d7214,0xc9))[_0xcca8('0x38')](handleError(_0x5d7214,null));};exports[_0xcca8('0x13')]=function(_0xc903d2,_0x5e03e5){if(_0xc903d2['body']['id']){delete _0xc903d2[_0xcca8('0x3f')]['id'];}return db[_0xcca8('0x1c')][_0xcca8('0x3d')]({'where':{'id':_0xc903d2[_0xcca8('0x3a')]['id']}})[_0xcca8('0x14')](handleEntityNotFound(_0x5e03e5,null))[_0xcca8('0x14')](function(_0x9ad335){if(_0x9ad335[_0xcca8('0x34')]===_0xcca8('0x35')&&_0xc903d2[_0xcca8('0x3f')][_0xcca8('0x37')]){_0xc903d2[_0xcca8('0x3f')][_0xcca8('0x37')]=encryptor[_0xcca8('0x44')](_0xc903d2[_0xcca8('0x3f')][_0xcca8('0x37')]);}return _0x9ad335;})[_0xcca8('0x14')](saveUpdates(_0xc903d2[_0xcca8('0x3f')],null))[_0xcca8('0x14')](respondWithResult(_0x5e03e5,null))[_0xcca8('0x38')](handleError(_0x5e03e5,null));};exports[_0xcca8('0x15')]=function(_0x2a2312,_0x19b266){return db[_0xcca8('0x1c')][_0xcca8('0x3d')]({'where':{'id':_0x2a2312[_0xcca8('0x3a')]['id']}})[_0xcca8('0x14')](handleEntityNotFound(_0x19b266,null))['then'](removeEntity(_0x19b266,null))[_0xcca8('0x38')](handleError(_0x19b266,null));};exports[_0xcca8('0x45')]=function(_0x4aa6e1,_0x34a944){return db[_0xcca8('0x1c')][_0xcca8('0x46')]({'where':{'id':_0x4aa6e1[_0xcca8('0x3a')]['id']},'raw':!![]})['then'](function(_0x348125){if(!_0x348125)return _0x34a944[_0xcca8('0x9')](0x194);return{'url':oauth[_0xcca8('0x47')](_0x348125,_0x4aa6e1['user']['id'])};})[_0xcca8('0x14')](respondWithResult(_0x34a944,null))['catch'](handleError(_0x34a944,null));};exports[_0xcca8('0x48')]=function(_0x51b1fd,_0x2806d1){var _0x1abefa=_0x51b1fd[_0xcca8('0x3f')];var _0x232d53;var _0x5a4fcf;if(_0x1abefa[_0xcca8('0x16')])throw _0x1abefa;redis[_0xcca8('0x49')](_0x1abefa[_0xcca8('0x4a')])['then'](function(_0xba8b76){if(!_0xba8b76)throw new Error(_0xcca8('0x4b'));_0x232d53=JSON['parse'](_0xba8b76);var _0x470cc3=Buffer[_0xcca8('0x4c')](_0x1abefa[_0xcca8('0x4a')],'base64')['toString'](_0xcca8('0x4d'));_0x5a4fcf=JSON[_0xcca8('0x4e')](_0x470cc3);if(!oauth[_0xcca8('0x4f')](_0x1abefa[_0xcca8('0x50')],_0x232d53[_0xcca8('0x51')]))throw new Error(_0xcca8('0x52'));redis[_0xcca8('0x53')](_0x1abefa[_0xcca8('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1abefa[_0xcca8('0x54')],_0x232d53);})[_0xcca8('0x14')](function(_0x4dcca6){_0x232d53[_0xcca8('0x55')]=_0x4dcca6[_0xcca8('0x56')];_0x232d53[_0xcca8('0x57')]=_0x4dcca6[_0xcca8('0x58')];return db['CloudProvider'][_0xcca8('0x13')]({'data5':_0x232d53[_0xcca8('0x55')],'data6':_0x232d53[_0xcca8('0x57')]},{'where':{'id':_0x232d53['id']}});})[_0xcca8('0x14')](function(){oauth[_0xcca8('0x59')](_0x232d53);socket[_0xcca8('0x5a')](_0xcca8('0x5b'),{'id':_0x5a4fcf['id']});return;})[_0xcca8('0x14')](respondWithStatusCode(_0x2806d1,null))[_0xcca8('0x38')](function(_0xeb321d){if(_0x5a4fcf){socket[_0xcca8('0x5a')](_0xcca8('0x5c'),{'id':_0x5a4fcf['id']});}if(!_0x232d53){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0xeb321d);return _0x2806d1['status'](0x1f4)[_0xcca8('0x18')](_0xeb321d[_0xcca8('0x5d')]);}logger[_0xcca8('0x16')](_0xcca8('0x5e'),_0x232d53['id'],JSON[_0xcca8('0x5f')](_0xeb321d));});}; \ No newline at end of file +var _0xd510=['data5','access_token','data6','refresh_token','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','end','sendStatus','stack','name','send','padEnd','slice','index','map','fieldName','query','keys','filters','attributes','intersection','model','fields','length','order','sort','where','filter','merge','options','CloudProvider','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','params','find','catch','create','body','Name\x20parameter\x20not\x20specified','rawAttributes','values','includes','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','error','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','code'];(function(_0x52e765,_0xf4bd2e){var _0x53cf83=function(_0xc1fb68){while(--_0xc1fb68){_0x52e765['push'](_0x52e765['shift']());}};_0x53cf83(++_0xf4bd2e);}(_0xd510,0xbc));var _0x0d51=function(_0x45b4c3,_0xf3dc72){_0x45b4c3=_0x45b4c3-0x0;var _0x54e82c=_0xd510[_0x45b4c3];return _0x54e82c;};'use strict';var _=require(_0x0d51('0x0'));var Redis=require(_0x0d51('0x1'));var qs=require(_0x0d51('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x0d51('0x3'));var logger=require(_0x0d51('0x4'))(_0x0d51('0x5'));var db=require(_0x0d51('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x0d51('0x7')]=_[_0x0d51('0x8')](config[_0x0d51('0x7')],{'host':_0x0d51('0x9'),'port':0x18eb});var socket=require(_0x0d51('0xa'))(new Redis(config[_0x0d51('0x7')]));var redis=new Redis(config[_0x0d51('0x7')]);function respondWithStatusCode(_0x193441,_0x4d02ce){_0x4d02ce=_0x4d02ce||0xcc;return function(_0x197fe7){if(_0x197fe7){return _0x193441['sendStatus'](_0x4d02ce);}return _0x193441[_0x0d51('0xb')](_0x4d02ce)['end']();};}function respondWithResult(_0x426d1e,_0x34dd5f){_0x34dd5f=_0x34dd5f||0xc8;return function(_0x1792a3){if(_0x1792a3){return _0x426d1e[_0x0d51('0xb')](_0x34dd5f)['json'](_0x1792a3);}};}function respondWithFilteredResult(_0x4e5df1,_0x5c489d){return function(_0x217402){if(_0x217402){var _0x410390=typeof _0x5c489d[_0x0d51('0xc')]===_0x0d51('0xd')&&typeof _0x5c489d[_0x0d51('0xe')]==='undefined';var _0x5b9f83=_0x217402['count'];var _0x509aa6=_0x410390?0x0:_0x5c489d[_0x0d51('0xc')];var _0x16b3db=_0x410390?_0x217402[_0x0d51('0xf')]:_0x5c489d[_0x0d51('0xc')]+_0x5c489d[_0x0d51('0xe')];var _0x3331da;if(_0x16b3db>=_0x5b9f83){_0x16b3db=_0x5b9f83;_0x3331da=0xc8;}else{_0x3331da=0xce;}_0x4e5df1[_0x0d51('0xb')](_0x3331da);return _0x4e5df1[_0x0d51('0x10')](_0x0d51('0x11'),_0x509aa6+'-'+_0x16b3db+'/'+_0x5b9f83)[_0x0d51('0x12')](_0x217402);}return null;};}function saveUpdates(_0x423c56){return function(_0x241741){if(_0x241741){return _0x241741[_0x0d51('0x13')](_0x423c56)['then'](function(_0x2d1356){return _0x2d1356;});}return null;};}function removeEntity(_0x5463a5){return function(_0x1bd20f){if(_0x1bd20f){return _0x1bd20f[_0x0d51('0x14')]()[_0x0d51('0x15')](function(){_0x5463a5[_0x0d51('0xb')](0xcc)[_0x0d51('0x16')]();});}};}function handleEntityNotFound(_0x2f0a97){return function(_0x53ad76){if(!_0x53ad76){_0x2f0a97[_0x0d51('0x17')](0x194);}return _0x53ad76;};}function handleError(_0x32882c,_0x5e462d){_0x5e462d=_0x5e462d||0x1f4;return function(_0x5ef0cf){logger['error'](_0x5ef0cf[_0x0d51('0x18')]);if(_0x5ef0cf[_0x0d51('0x19')]){delete _0x5ef0cf[_0x0d51('0x19')];}_0x32882c[_0x0d51('0xb')](_0x5e462d)[_0x0d51('0x1a')](_0x5ef0cf);};}function maskClientSecret(_0x10b1d5){return _[_0x0d51('0x1b')](_0x10b1d5[_0x0d51('0x1c')](0x0,0x3),0x14,'*');}exports[_0x0d51('0x1d')]=function(_0x1916f2,_0x532e46){var _0x4f3666={},_0x1b8e55={},_0x4901ab={'count':0x0,'rows':[]};var _0x46fefb=_[_0x0d51('0x1e')](db['CloudProvider']['rawAttributes'],function(_0x523c29){return{'name':_0x523c29[_0x0d51('0x1f')],'type':_0x523c29['type']['key']};});_0x1b8e55['model']=_[_0x0d51('0x1e')](_0x46fefb,'name');_0x1b8e55[_0x0d51('0x20')]=_[_0x0d51('0x21')](_0x1916f2[_0x0d51('0x20')]);_0x1b8e55[_0x0d51('0x22')]=_['intersection'](_0x1b8e55['model'],_0x1b8e55[_0x0d51('0x20')]);_0x4f3666[_0x0d51('0x23')]=_[_0x0d51('0x24')](_0x1b8e55[_0x0d51('0x25')],qs[_0x0d51('0x26')](_0x1916f2[_0x0d51('0x20')][_0x0d51('0x26')]));_0x4f3666[_0x0d51('0x23')]=_0x4f3666[_0x0d51('0x23')][_0x0d51('0x27')]?_0x4f3666[_0x0d51('0x23')]:_0x1b8e55[_0x0d51('0x25')];if(!_0x1916f2[_0x0d51('0x20')]['hasOwnProperty']('nolimit')){_0x4f3666[_0x0d51('0xe')]=qs[_0x0d51('0xe')](_0x1916f2[_0x0d51('0x20')]['limit']);_0x4f3666[_0x0d51('0xc')]=qs[_0x0d51('0xc')](_0x1916f2[_0x0d51('0x20')][_0x0d51('0xc')]);}_0x4f3666[_0x0d51('0x28')]=qs['sort'](_0x1916f2[_0x0d51('0x20')][_0x0d51('0x29')]);_0x4f3666[_0x0d51('0x2a')]=qs['filters'](_['pick'](_0x1916f2[_0x0d51('0x20')],_0x1b8e55[_0x0d51('0x22')]),_0x46fefb);if(_0x1916f2[_0x0d51('0x20')][_0x0d51('0x2b')]){_0x4f3666[_0x0d51('0x2a')]=_[_0x0d51('0x2c')](_0x4f3666[_0x0d51('0x2a')],{'$or':_[_0x0d51('0x1e')](_0x46fefb,function(_0x308d08){if(_0x308d08['type']!=='VIRTUAL'){var _0x2cf09c={};_0x2cf09c[_0x308d08[_0x0d51('0x19')]]={'$like':'%'+_0x1916f2[_0x0d51('0x20')][_0x0d51('0x2b')]+'%'};return _0x2cf09c;}})});}_0x4f3666=_[_0x0d51('0x2c')]({},_0x4f3666,_0x1916f2[_0x0d51('0x2d')]);var _0x389b2b={'where':_0x4f3666[_0x0d51('0x2a')]};return db[_0x0d51('0x2e')][_0x0d51('0xf')](_0x389b2b)['then'](function(_0x5afd67){_0x4901ab[_0x0d51('0xf')]=_0x5afd67;if(_0x1916f2[_0x0d51('0x20')][_0x0d51('0x2f')]){_0x4f3666[_0x0d51('0x30')]=[{'all':!![]}];}return db[_0x0d51('0x2e')][_0x0d51('0x31')](_0x4f3666);})[_0x0d51('0x15')](function(_0x4d1b99){_0x4901ab[_0x0d51('0x32')]=_[_0x0d51('0x1e')](_0x4d1b99,function(_0x1fcbde){if(_0x1fcbde[_0x0d51('0x33')]===_0x0d51('0x34')){var _0x44ff71=encryptor[_0x0d51('0x35')](_0x1fcbde[_0x0d51('0x36')]);_0x1fcbde[_0x0d51('0x36')]=maskClientSecret(_0x44ff71);}return _0x1fcbde;});return _0x4901ab;})['then'](respondWithFilteredResult(_0x532e46,_0x4f3666))['catch'](handleError(_0x532e46,null));};exports[_0x0d51('0x37')]=function(_0x3d9474,_0x44f51b){var _0xea98e={'raw':!![],'where':{'id':_0x3d9474[_0x0d51('0x38')]['id']}},_0x3d4b82={};_0x3d4b82[_0x0d51('0x25')]=_['keys'](db[_0x0d51('0x2e')]['rawAttributes']);_0x3d4b82[_0x0d51('0x20')]=_[_0x0d51('0x21')](_0x3d9474[_0x0d51('0x20')]);_0x3d4b82[_0x0d51('0x22')]=_[_0x0d51('0x24')](_0x3d4b82[_0x0d51('0x25')],_0x3d4b82[_0x0d51('0x20')]);_0xea98e[_0x0d51('0x23')]=_[_0x0d51('0x24')](_0x3d4b82[_0x0d51('0x25')],qs[_0x0d51('0x26')](_0x3d9474[_0x0d51('0x20')][_0x0d51('0x26')]));_0xea98e[_0x0d51('0x23')]=_0xea98e['attributes'][_0x0d51('0x27')]?_0xea98e['attributes']:_0x3d4b82[_0x0d51('0x25')];if(_0x3d9474['query'][_0x0d51('0x2f')]){_0xea98e[_0x0d51('0x30')]=[{'all':!![]}];}_0xea98e=_['merge']({},_0xea98e,_0x3d9474[_0x0d51('0x2d')]);return db[_0x0d51('0x2e')][_0x0d51('0x39')](_0xea98e)[_0x0d51('0x15')](handleEntityNotFound(_0x44f51b,null))['then'](function(_0x528c16){if(_0x528c16[_0x0d51('0x33')]===_0x0d51('0x34')){var _0x54a4c9=encryptor['decryptString'](_0x528c16[_0x0d51('0x36')]);_0x528c16['data3']=maskClientSecret(_0x54a4c9);}return _0x528c16;})['then'](respondWithResult(_0x44f51b,null))[_0x0d51('0x3a')](handleError(_0x44f51b,null));};exports[_0x0d51('0x3b')]=function(_0x44cc99,_0x53ef04){if(!_0x44cc99[_0x0d51('0x3c')][_0x0d51('0x19')])throw new Error(_0x0d51('0x3d'));if(!_0x44cc99['body'][_0x0d51('0x33')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x3b892d=db[_0x0d51('0x2e')][_0x0d51('0x3e')][_0x0d51('0x33')][_0x0d51('0x3f')];if(!_0x3b892d[_0x0d51('0x40')](_0x44cc99[_0x0d51('0x3c')][_0x0d51('0x33')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x3b892d[_0x0d51('0x41')](',\x20'));if(_0x44cc99['body'][_0x0d51('0x33')]===_0x0d51('0x34')&&_0x44cc99[_0x0d51('0x3c')][_0x0d51('0x36')]){_0x44cc99[_0x0d51('0x3c')][_0x0d51('0x36')]=encryptor[_0x0d51('0x42')](_0x44cc99[_0x0d51('0x3c')][_0x0d51('0x36')]);}return db['CloudProvider'][_0x0d51('0x3b')](_0x44cc99[_0x0d51('0x3c')],{})[_0x0d51('0x15')](respondWithResult(_0x53ef04,0xc9))[_0x0d51('0x3a')](handleError(_0x53ef04,null));};exports[_0x0d51('0x13')]=function(_0x3d9334,_0x13ff80){if(_0x3d9334[_0x0d51('0x3c')]['id']){delete _0x3d9334[_0x0d51('0x3c')]['id'];}return db[_0x0d51('0x2e')][_0x0d51('0x39')]({'where':{'id':_0x3d9334[_0x0d51('0x38')]['id']}})[_0x0d51('0x15')](handleEntityNotFound(_0x13ff80,null))[_0x0d51('0x15')](function(_0x2b86e5){if(_0x2b86e5[_0x0d51('0x33')]===_0x0d51('0x34')&&_0x3d9334['body'][_0x0d51('0x36')]){_0x3d9334[_0x0d51('0x3c')]['data3']=encryptor[_0x0d51('0x42')](_0x3d9334['body'][_0x0d51('0x36')]);}return _0x2b86e5;})['then'](saveUpdates(_0x3d9334['body'],null))['then'](respondWithResult(_0x13ff80,null))[_0x0d51('0x3a')](handleError(_0x13ff80,null));};exports[_0x0d51('0x14')]=function(_0x37f0f2,_0x4b3fa9){return db[_0x0d51('0x2e')][_0x0d51('0x39')]({'where':{'id':_0x37f0f2[_0x0d51('0x38')]['id']}})[_0x0d51('0x15')](handleEntityNotFound(_0x4b3fa9,null))[_0x0d51('0x15')](removeEntity(_0x4b3fa9,null))[_0x0d51('0x3a')](handleError(_0x4b3fa9,null));};exports[_0x0d51('0x43')]=function(_0x345b84,_0x5fb260){return db[_0x0d51('0x2e')]['findOne']({'where':{'id':_0x345b84['params']['id']},'raw':!![]})[_0x0d51('0x15')](function(_0x21b1a9){if(!_0x21b1a9)return _0x5fb260['sendStatus'](0x194);return{'url':oauth[_0x0d51('0x44')](_0x21b1a9,_0x345b84[_0x0d51('0x45')]['id'])};})['then'](respondWithResult(_0x5fb260,null))['catch'](handleError(_0x5fb260,null));};exports['oauth2MicrosoftCallback']=function(_0x263bdc,_0x25952b){var _0x2ec994=_0x263bdc[_0x0d51('0x3c')];var _0x4d633f;var _0x4171d1;if(_0x2ec994[_0x0d51('0x46')])throw _0x2ec994;redis[_0x0d51('0x47')](_0x2ec994[_0x0d51('0x48')])['then'](function(_0x3c91b9){if(!_0x3c91b9)throw new Error(_0x0d51('0x49'));_0x4d633f=JSON[_0x0d51('0x4a')](_0x3c91b9);var _0x9905f4=Buffer['from'](_0x2ec994['state'],_0x0d51('0x4b'))[_0x0d51('0x4c')](_0x0d51('0x4d'));_0x4171d1=JSON[_0x0d51('0x4a')](_0x9905f4);if(!oauth[_0x0d51('0x4e')](_0x2ec994['id_token'],_0x4d633f[_0x0d51('0x4f')]))throw new Error(_0x0d51('0x50'));redis['del'](_0x2ec994[_0x0d51('0x48')]);return oauth['getOauth2MicrosoftAccessToken'](_0x2ec994[_0x0d51('0x51')],_0x4d633f);})[_0x0d51('0x15')](function(_0x281954){_0x4d633f[_0x0d51('0x52')]=_0x281954[_0x0d51('0x53')];_0x4d633f[_0x0d51('0x54')]=_0x281954[_0x0d51('0x55')];return db[_0x0d51('0x2e')][_0x0d51('0x13')]({'data5':_0x4d633f[_0x0d51('0x52')],'data6':_0x4d633f[_0x0d51('0x54')]},{'where':{'id':_0x4d633f['id']}});})[_0x0d51('0x15')](function(){oauth['startRefreshInterval'](_0x4d633f);socket['emit'](_0x0d51('0x56'),{'id':_0x4171d1['id']});return;})[_0x0d51('0x15')](respondWithStatusCode(_0x25952b,null))['catch'](function(_0x1556b6){if(_0x4171d1){socket['emit']('microsoftAuthorization:error',{'id':_0x4171d1['id']});}if(!_0x4d633f){logger[_0x0d51('0x46')](_0x0d51('0x57'),_0x1556b6);return _0x25952b['status'](0x1f4)[_0x0d51('0x1a')](_0x1556b6[_0x0d51('0x58')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x4d633f['id'],JSON[_0x0d51('0x59')](_0x1556b6));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4a107c8..9ae779a 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 _0xd867=['./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x467180,_0x44b5c6){var _0x573b61=function(_0x48df01){while(--_0x48df01){_0x467180['push'](_0x467180['shift']());}};_0x573b61(++_0x44b5c6);}(_0xd867,0x1bc));var _0x7d86=function(_0x24c63a,_0x3017dd){_0x24c63a=_0x24c63a-0x0;var _0x27e88e=_0xd867[_0x24c63a];return _0x27e88e;};'use strict';var _=require(_0x7d86('0x0'));var util=require(_0x7d86('0x1'));var logger=require(_0x7d86('0x2'))(_0x7d86('0x3'));var moment=require('moment');var BPromise=require(_0x7d86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d86('0x5'));var config=require(_0x7d86('0x6'));var attributes=require(_0x7d86('0x7'));module[_0x7d86('0x8')]=function(_0x23481a,_0x3db015){return _0x23481a[_0x7d86('0x9')](_0x7d86('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04b0=['./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4595d7,_0x1edd92){var _0x1762b3=function(_0x135c90){while(--_0x135c90){_0x4595d7['push'](_0x4595d7['shift']());}};_0x1762b3(++_0x1edd92);}(_0x04b0,0x1c7));var _0x004b=function(_0x26071e,_0x557941){_0x26071e=_0x26071e-0x0;var _0x2b9c70=_0x04b0[_0x26071e];return _0x2b9c70;};'use strict';var _=require(_0x004b('0x0'));var util=require('util');var logger=require(_0x004b('0x1'))(_0x004b('0x2'));var moment=require('moment');var BPromise=require(_0x004b('0x3'));var rp=require(_0x004b('0x4'));var fs=require('fs');var path=require(_0x004b('0x5'));var rimraf=require(_0x004b('0x6'));var config=require('../../config/environment');var attributes=require(_0x004b('0x7'));module['exports']=function(_0x2a93ed,_0x33b789){return _0x2a93ed[_0x004b('0x8')](_0x004b('0x9'),attributes,{'tableName':_0x004b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 79aaf15..616630f 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 _0x8143=['response_mode','form_post','scope','state','nonce','map','key','oauth2Claims','oauth2/','payload','iss','issuer','aud','audience','isAfter','exp','then','data3','CloudProvider','findOne','refresh_token','data6','data4','decryptString','replace','data5','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','catch','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','type','Dynamics365','push','/.default','Outlook365','data7','{TENANT_ID}','data2','code','id_token','from','stringify','base64','randomBytes','toString','hex','client_id','data1','join'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x8143,0x73));var _0x3814=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8143[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x3814('0x0'));var crypto=require('crypto');var jwt=require(_0x3814('0x1'));var moment=require('moment');var Redis=require(_0x3814('0x2'));var rp=require('request-promise');var util=require(_0x3814('0x3'));var encryptor=require(_0x3814('0x4'));var config=require(_0x3814('0x5'));var logger=require(_0x3814('0x6'))(_0x3814('0x7'));var schedule=require(_0x3814('0x8'));var db=require(_0x3814('0x9'))['db'];config[_0x3814('0xa')]=_[_0x3814('0xb')](config[_0x3814('0xa')],{'host':_0x3814('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x3814('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x3814('0xe'),_0x3814('0xf'),'email',_0x3814('0x10'),_0x3814('0x11'),_0x3814('0x12'),_0x3814('0x13')],'Dynamics365':[_0x3814('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4e93c6){var _0x29afce=_['map'](AZURE_AUTH_SCOPES[_0x4e93c6['type']]);if(_0x4e93c6[_0x3814('0x14')]===_0x3814('0x15'))_0x29afce[_0x3814('0x16')](_0x4e93c6['data7']+_0x3814('0x17'));return _0x29afce['join']('\x20');}function getAccessTokenScope(_0x126652){if(_0x126652['type']===_0x3814('0x18'))return _0x3814('0x11');if(_0x126652[_0x3814('0x14')]===_0x3814('0x15'))return _0x126652[_0x3814('0x19')]+_0x3814('0x17');}function generateMicrosoftAuthorizationUrl(_0x55bf86,_0x5cc6ef){var _0x4ed6bd=MICROSOFT_AUTH_URL['replace'](_0x3814('0x1a'),_0x55bf86[_0x3814('0x1b')]);var _0xfc2486=[_0x3814('0x1c'),_0x3814('0x1d')];var _0x4c2df5=Buffer[_0x3814('0x1e')](JSON[_0x3814('0x1f')]({'id':_0x5cc6ef}))['toString'](_0x3814('0x20'));var _0x58dd48=crypto[_0x3814('0x21')](0x10)[_0x3814('0x22')](_0x3814('0x23'));var _0x4aa74d=getAuthorizationScopes(_0x55bf86);var _0x120362=[{'key':_0x3814('0x24'),'value':_0x55bf86[_0x3814('0x25')]},{'key':'response_type','value':encodeURIComponent(_0xfc2486[_0x3814('0x26')]('\x20'))},{'key':'redirect_uri','value':_0x55bf86['data4']},{'key':_0x3814('0x27'),'value':_0x3814('0x28')},{'key':_0x3814('0x29'),'value':encodeURIComponent(_0x4aa74d)},{'key':_0x3814('0x2a'),'value':_0x4c2df5},{'key':_0x3814('0x2b'),'value':_0x58dd48},{'key':'prompt','value':'login'}];var _0x2700d0=_0x4ed6bd+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x3814('0x2c')](_0x120362,function(_0x4f6b54){return _0x4f6b54[_0x3814('0x2d')]+'='+_0x4f6b54['value'];})['join']('&');_0x55bf86[_0x3814('0x2e')]={'issuer':_0x4ed6bd['replace'](_0x3814('0x2f'),''),'audience':_0x55bf86[_0x3814('0x25')],'state':_0x4c2df5,'nonce':_0x58dd48};redis['set'](_0x4c2df5,JSON[_0x3814('0x1f')](_0x55bf86));return _0x2700d0;}function isValidIdToken(_0x29cca2,_0x1530d7){try{var _0x3d40c8=jwt['decode'](_0x29cca2,{'complete':!![]});var _0x4c864b=_0x3d40c8[_0x3814('0x30')];if(_0x4c864b[_0x3814('0x31')]!==_0x1530d7[_0x3814('0x32')])return![];if(_0x4c864b[_0x3814('0x33')]!==_0x1530d7[_0x3814('0x34')])return![];if(_0x4c864b[_0x3814('0x2b')]!==_0x1530d7[_0x3814('0x2b')])return![];if(moment()[_0x3814('0x35')](moment['unix'](_0x4c864b[_0x3814('0x36')])))return![];return!![];}catch(_0x54b461){throw _0x54b461;}}function refreshOauth2MicrosoftAccessToken(_0x53bf14){return Promise['resolve']()[_0x3814('0x37')](function(){if(_0x53bf14[_0x3814('0x38')])return _0x53bf14;return db[_0x3814('0x39')][_0x3814('0x3a')]({'where':{'id':_0x53bf14['id']},'raw':!![]});})[_0x3814('0x37')](function(_0x66e419){var _0x31e794={'grant_type':_0x3814('0x3b'),'refresh_token':_0x66e419[_0x3814('0x3c')],'scope':getAccessTokenScope(_0x66e419),'redirect_uri':_0x66e419[_0x3814('0x3d')],'client_id':_0x66e419[_0x3814('0x25')],'client_secret':encryptor[_0x3814('0x3e')](_0x66e419[_0x3814('0x38')])};var _0x27073f={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x3814('0x3f')]('{TENANT_ID}',_0x66e419['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x31e794,'json':!![]};return rp(_0x27073f);})['then'](function(_0x3f9d97){_0x53bf14[_0x3814('0x40')]=_0x3f9d97['access_token'];_0x53bf14[_0x3814('0x3c')]=_0x3f9d97[_0x3814('0x3b')];return db[_0x3814('0x39')][_0x3814('0x41')]({'data5':_0x53bf14[_0x3814('0x40')],'data6':_0x53bf14[_0x3814('0x3c')]},{'where':{'id':_0x53bf14['id']}});})[_0x3814('0x37')](function(){return _0x53bf14;})['catch'](function(_0x2239e1){logger['error'](_0x3814('0x42'),_0x53bf14['id'],_0x2239e1);});}function getOauth2MicrosoftAccessToken(_0x1e6e63,_0xe1d356){var _0x309c5a={'grant_type':_0x3814('0x43'),'code':_0x1e6e63,'scope':getAccessTokenScope(_0xe1d356),'redirect_uri':_0xe1d356[_0x3814('0x3d')],'client_id':_0xe1d356[_0x3814('0x25')],'client_secret':encryptor[_0x3814('0x3e')](_0xe1d356[_0x3814('0x38')])};var _0x468d8b={'method':_0x3814('0x44'),'uri':MICROSOFT_AUTH_URL[_0x3814('0x3f')](_0x3814('0x1a'),_0xe1d356[_0x3814('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x309c5a,'json':!![]};return rp(_0x468d8b);}function startRefreshInterval(_0x29423b){var _0x29ae83=schedule[_0x3814('0x45')];if(_0x29ae83[_0x29423b['id']])clearInterval(_0x29ae83[_0x29423b['id']]);_0x29ae83[_0x29423b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3814('0x46')](this,{'id':_0x29423b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3814('0x45')]=_0x29ae83;}function startAllRefreshIntervals(){return db[_0x3814('0x39')][_0x3814('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x3814('0x37')](function(_0x4325ac){var _0x5ac3ef=_0x4325ac[_0x3814('0x2c')](function(_0x43b7be){return refreshOauth2MicrosoftAccessToken(_0x43b7be)[_0x3814('0x37')](function(_0x2f91c7){startRefreshInterval(_0x2f91c7);});});return Promise[_0x3814('0x48')](_0x5ac3ef);})[_0x3814('0x49')](function(_0x16b8aa){var _0x480c8e=_0x16b8aa?util['inspect'](_0x16b8aa,{'showHidden':![],'depth':null}):'';logger[_0x3814('0x4a')](_0x3814('0x4b'),_0x480c8e);});}module[_0x3814('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x92c6=['oauth2/','data1','set','decode','payload','iss','aud','audience','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data2','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','POST','intervals','bind','findAll','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','openid','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','code','from','stringify','toString','base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','login','key','value','oauth2Claims'];(function(_0x4c8f99,_0x5511fa){var _0x14b98b=function(_0x258c33){while(--_0x258c33){_0x4c8f99['push'](_0x4c8f99['shift']());}};_0x14b98b(++_0x5511fa);}(_0x92c6,0x72));var _0x692c=function(_0x222659,_0x130f73){_0x222659=_0x222659-0x0;var _0x372310=_0x92c6[_0x222659];return _0x372310;};'use strict';var _=require(_0x692c('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require('ioredis');var rp=require(_0x692c('0x1'));var util=require(_0x692c('0x2'));var encryptor=require(_0x692c('0x3'));var config=require(_0x692c('0x4'));var logger=require('../../config/logger')(_0x692c('0x5'));var schedule=require(_0x692c('0x6'));var db=require(_0x692c('0x7'))['db'];config[_0x692c('0x8')]=_[_0x692c('0x9')](config[_0x692c('0x8')],{'host':_0x692c('0xa'),'port':0x18eb});var redis=new Redis(config[_0x692c('0x8')]);var MICROSOFT_AUTH_URL=_0x692c('0xb');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x692c('0xc'),_0x692c('0xd'),_0x692c('0xe'),_0x692c('0xf'),_0x692c('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x692c('0x11'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x692c('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x692c('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2b647b){var _0x3e1096=_[_0x692c('0x14')](AZURE_AUTH_SCOPES[_0x2b647b[_0x692c('0x15')]]);if(_0x2b647b[_0x692c('0x15')]===_0x692c('0x16'))_0x3e1096[_0x692c('0x17')](_0x2b647b[_0x692c('0x18')]+_0x692c('0x19'));return _0x3e1096[_0x692c('0x1a')]('\x20');}function getAccessTokenScope(_0x861e3c){if(_0x861e3c[_0x692c('0x15')]===_0x692c('0x1b'))return _0x692c('0xf');if(_0x861e3c[_0x692c('0x15')]===_0x692c('0x16'))return _0x861e3c[_0x692c('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x39e599,_0x38431b){var _0x155a31=MICROSOFT_AUTH_URL[_0x692c('0x1c')](_0x692c('0x1d'),_0x39e599['data2']);var _0x8c5d33=[_0x692c('0x1e'),'id_token'];var _0x3e10b6=Buffer[_0x692c('0x1f')](JSON[_0x692c('0x20')]({'id':_0x38431b}))[_0x692c('0x21')](_0x692c('0x22'));var _0x1e8373=crypto[_0x692c('0x23')](0x10)[_0x692c('0x21')](_0x692c('0x24'));var _0x139df2=getAuthorizationScopes(_0x39e599);var _0x8605dd=[{'key':_0x692c('0x25'),'value':_0x39e599['data1']},{'key':_0x692c('0x26'),'value':encodeURIComponent(_0x8c5d33['join']('\x20'))},{'key':_0x692c('0x27'),'value':_0x39e599[_0x692c('0x28')]},{'key':_0x692c('0x29'),'value':_0x692c('0x2a')},{'key':_0x692c('0x2b'),'value':encodeURIComponent(_0x139df2)},{'key':_0x692c('0x2c'),'value':_0x3e10b6},{'key':_0x692c('0x2d'),'value':_0x1e8373},{'key':'prompt','value':_0x692c('0x2e')}];var _0x48fade=_0x155a31+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x8605dd,function(_0x49e333){return _0x49e333[_0x692c('0x2f')]+'='+_0x49e333[_0x692c('0x30')];})[_0x692c('0x1a')]('&');_0x39e599[_0x692c('0x31')]={'issuer':_0x155a31['replace'](_0x692c('0x32'),''),'audience':_0x39e599[_0x692c('0x33')],'state':_0x3e10b6,'nonce':_0x1e8373};redis[_0x692c('0x34')](_0x3e10b6,JSON['stringify'](_0x39e599));return _0x48fade;}function isValidIdToken(_0x4e361d,_0x418912){try{var _0x56b4c7=jwt[_0x692c('0x35')](_0x4e361d,{'complete':!![]});var _0x81de91=_0x56b4c7[_0x692c('0x36')];if(_0x81de91[_0x692c('0x37')]!==_0x418912['issuer'])return![];if(_0x81de91[_0x692c('0x38')]!==_0x418912[_0x692c('0x39')])return![];if(_0x81de91[_0x692c('0x2d')]!==_0x418912[_0x692c('0x2d')])return![];if(moment()[_0x692c('0x3a')](moment[_0x692c('0x3b')](_0x81de91[_0x692c('0x3c')])))return![];return!![];}catch(_0x3c18b9){throw _0x3c18b9;}}function refreshOauth2MicrosoftAccessToken(_0x39ea88){return Promise[_0x692c('0x3d')]()[_0x692c('0x3e')](function(){if(_0x39ea88['data3'])return _0x39ea88;return db[_0x692c('0x3f')][_0x692c('0x40')]({'where':{'id':_0x39ea88['id']},'raw':!![]});})[_0x692c('0x3e')](function(_0x54ca04){var _0x283b96={'grant_type':_0x692c('0x41'),'refresh_token':_0x54ca04[_0x692c('0x42')],'scope':getAccessTokenScope(_0x54ca04),'redirect_uri':_0x54ca04[_0x692c('0x28')],'client_id':_0x54ca04[_0x692c('0x33')],'client_secret':encryptor[_0x692c('0x43')](_0x54ca04['data3'])};var _0x437133={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x692c('0x1c')](_0x692c('0x1d'),_0x54ca04[_0x692c('0x44')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x283b96,'json':!![]};return rp(_0x437133);})[_0x692c('0x3e')](function(_0x100eef){_0x39ea88['data5']=_0x100eef[_0x692c('0x45')];_0x39ea88[_0x692c('0x42')]=_0x100eef[_0x692c('0x41')];return db['CloudProvider'][_0x692c('0x46')]({'data5':_0x39ea88['data5'],'data6':_0x39ea88[_0x692c('0x42')]},{'where':{'id':_0x39ea88['id']}});})['then'](function(){return _0x39ea88;})[_0x692c('0x47')](function(_0x28a158){logger['error'](_0x692c('0x48'),_0x39ea88['id'],_0x28a158);});}function getOauth2MicrosoftAccessToken(_0xa198f8,_0x22eb20){var _0x101ffe={'grant_type':_0x692c('0x49'),'code':_0xa198f8,'scope':getAccessTokenScope(_0x22eb20),'redirect_uri':_0x22eb20[_0x692c('0x28')],'client_id':_0x22eb20[_0x692c('0x33')],'client_secret':encryptor[_0x692c('0x43')](_0x22eb20[_0x692c('0x4a')])};var _0x408f40={'method':_0x692c('0x4b'),'uri':MICROSOFT_AUTH_URL[_0x692c('0x1c')](_0x692c('0x1d'),_0x22eb20['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x101ffe,'json':!![]};return rp(_0x408f40);}function startRefreshInterval(_0x2cb1bc){var _0x1a4f04=schedule[_0x692c('0x4c')];if(_0x1a4f04[_0x2cb1bc['id']])clearInterval(_0x1a4f04[_0x2cb1bc['id']]);_0x1a4f04[_0x2cb1bc['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x692c('0x4d')](this,{'id':_0x2cb1bc['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x692c('0x4c')]=_0x1a4f04;}function startAllRefreshIntervals(){return db[_0x692c('0x3f')][_0x692c('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x4522cc){var _0xf3d1fa=_0x4522cc[_0x692c('0x14')](function(_0x3f56d0){return refreshOauth2MicrosoftAccessToken(_0x3f56d0)[_0x692c('0x3e')](function(_0xaab535){startRefreshInterval(_0xaab535);});});return Promise['all'](_0xf3d1fa);})[_0x692c('0x47')](function(_0x16d97e){var _0x54f354=_0x16d97e?util['inspect'](_0x16d97e,{'showHidden':![],'depth':null}):'';logger[_0x692c('0x4f')](_0x692c('0x50'),_0x54f354);});}module[_0x692c('0x51')]={'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 3588bd4..3d756ce 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 _0x896e=['CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2bcdf4,_0x1a2f20){var _0x4a0f7a=function(_0x1e924f){while(--_0x1e924f){_0x2bcdf4['push'](_0x2bcdf4['shift']());}};_0x4a0f7a(++_0x1a2f20);}(_0x896e,0x1e9));var _0xe896=function(_0x122818,_0x4fab10){_0x122818=_0x122818-0x0;var _0x3d7e15=_0x896e[_0x122818];return _0x3d7e15;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('CloudProvider,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file +var _0xe34f=['result','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0xe34f,0xbc));var _0xfe34=function(_0x564e2b,_0x329da5){_0x564e2b=_0x564e2b-0x0;var _0x19d84e=_0xe34f[_0x564e2b];return _0x19d84e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe34('0x0'));var fs=require('fs');var Redis=require(_0xfe34('0x1'));var db=require(_0xfe34('0x2'))['db'];var utils=require(_0xfe34('0x3'));var logger=require(_0xfe34('0x4'))(_0xfe34('0x5'));var config=require(_0xfe34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe34('0x7')][_0xfe34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x195bcd,_0x3fe816,_0x25f17a){return new BPromise(function(_0x4fa1cd,_0x5cdc7e){return client[_0xfe34('0x9')](_0x195bcd,_0x25f17a)[_0xfe34('0xa')](function(_0x252ec7){logger[_0xfe34('0xb')](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3fe816,'request\x20sent',JSON['stringify'](_0x252ec7));if(_0x252ec7[_0xfe34('0xe')]){if(_0x252ec7[_0xfe34('0xe')]['code']===0x1f4){logger[_0xfe34('0xe')](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x5cdc7e(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}logger['error'](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x4fa1cd(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}else{logger['info'](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));_0x4fa1cd(_0x252ec7[_0xfe34('0x10')][_0xfe34('0xf')]);}})['catch'](function(_0x53b469){logger['error'](_0xfe34('0xc'),_0x3fe816,_0x53b469);_0x5cdc7e(_0x53b469);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 97aae92..f3649ed 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x4e4b9c,_0x5874d7){var _0x438597=function(_0xdc17fb){while(--_0xdc17fb){_0x4e4b9c['push'](_0x4e4b9c['shift']());}};_0x438597(++_0x5874d7);}(_0xdb28,0x106));var _0x8db2=function(_0x2034f2,_0x3c62e8){_0x2034f2=_0x2034f2-0x0;var _0x34947d=_0xdb28[_0x2034f2];return _0x34947d;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x5bb733,_0x2276bc){var _0x4291a2=function(_0x326053){while(--_0x326053){_0x5bb733['push'](_0x5bb733['shift']());}};_0x4291a2(++_0x2276bc);}(_0xadb5,0xad));var _0x5adb=function(_0x46583e,_0x10ffa4){_0x46583e=_0x46583e-0x0;var _0x549150=_0xadb5[_0x46583e];return _0x549150;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index aec1a49..711c7c4 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 _0x4278=['name','exports','STRING'];(function(_0x2bbab0,_0x26d5b1){var _0x2a0573=function(_0x1a6a70){while(--_0x1a6a70){_0x2bbab0['push'](_0x2bbab0['shift']());}};_0x2a0573(++_0x26d5b1);}(_0x4278,0x18d));var _0x8427=function(_0x4a7ea8,_0x29cf44){_0x4a7ea8=_0x4a7ea8-0x0;var _0x37d438=_0x4278[_0x4a7ea8];return _0x37d438;};'use strict';var Sequelize=require('sequelize');module[_0x8427('0x0')]={'name':{'type':Sequelize[_0x8427('0x1')],'unique':_0x8427('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8427('0x1')]},'companyId':{'type':Sequelize[_0x8427('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8427('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8427('0x1')]},'postalCode':{'type':Sequelize[_0x8427('0x1')]},'city':{'type':Sequelize[_0x8427('0x1')]},'country':{'type':Sequelize[_0x8427('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8427('0x1')]},'sStreet':{'type':Sequelize[_0x8427('0x1')]},'sPostalCode':{'type':Sequelize[_0x8427('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x8427('0x1')]},'description':{'type':Sequelize[_0x8427('0x1')]}}; \ No newline at end of file +var _0xa421=['sequelize','exports','STRING','name'];(function(_0x8f9cf,_0x404bfe){var _0x2817e3=function(_0x3c2cf9){while(--_0x3c2cf9){_0x8f9cf['push'](_0x8f9cf['shift']());}};_0x2817e3(++_0x404bfe);}(_0xa421,0x1b8));var _0x1a42=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa421[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x1a42('0x0'));module[_0x1a42('0x1')]={'name':{'type':Sequelize[_0x1a42('0x2')],'unique':_0x1a42('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1a42('0x2')]},'companyId':{'type':Sequelize[_0x1a42('0x2')]},'website':{'type':Sequelize[_0x1a42('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x1a42('0x2')]},'type':{'type':Sequelize[_0x1a42('0x2')]},'street':{'type':Sequelize[_0x1a42('0x2')]},'postalCode':{'type':Sequelize[_0x1a42('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1a42('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x1a42('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x1a42('0x2')]},'sCountry':{'type':Sequelize[_0x1a42('0x2')]},'description':{'type':Sequelize[_0x1a42('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 0cb4a1c..f4392ac 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 _0x6c47=['fields','length','nolimit','sort','where','pick','filter','map','merge','includeAll','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','ids','getContacts','findOne','rawAttributes','order','hasOwnProperty','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','Companies','destroy','then','end','stack','send','CmCompany','describe','model','keys','filters','intersection','query','attributes'];(function(_0x5b72d5,_0xf47723){var _0x2e8fb4=function(_0x397eff){while(--_0x397eff){_0x5b72d5['push'](_0x5b72d5['shift']());}};_0x2e8fb4(++_0xf47723);}(_0x6c47,0x1cc));var _0x76c4=function(_0x58c7a9,_0x4ef324){_0x58c7a9=_0x58c7a9-0x0;var _0x46c842=_0x6c47[_0x58c7a9];return _0x46c842;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76c4('0x0'));var zipdir=require(_0x76c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76c4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x76c4('0x3'));var util=require(_0x76c4('0x4'));var path=require(_0x76c4('0x5'));var sox=require(_0x76c4('0x6'));var csv=require(_0x76c4('0x7'));var ejs=require(_0x76c4('0x8'));var fs=require('fs');var fs_extra=require(_0x76c4('0x9'));var _=require(_0x76c4('0xa'));var squel=require('squel');var crypto=require(_0x76c4('0xb'));var jsforce=require(_0x76c4('0xc'));var deskjs=require(_0x76c4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x76c4('0xe'));var Papa=require(_0x76c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x76c4('0x10'));var hardwareService=require(_0x76c4('0x11'));var logger=require(_0x76c4('0x12'))(_0x76c4('0x13'));var utils=require(_0x76c4('0x14'));var config=require(_0x76c4('0x15'));var licenseUtil=require(_0x76c4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bf600,_0x423a5e){_0x423a5e=_0x423a5e||0xcc;return function(_0x1ecbc7){if(_0x1ecbc7){return _0x4bf600[_0x76c4('0x17')](_0x423a5e);}return _0x4bf600[_0x76c4('0x18')](_0x423a5e)['end']();};}function respondWithResult(_0x194557,_0x39654f){_0x39654f=_0x39654f||0xc8;return function(_0x205bd7){if(_0x205bd7){return _0x194557[_0x76c4('0x18')](_0x39654f)[_0x76c4('0x19')](_0x205bd7);}};}function respondWithFilteredResult(_0x2964e5,_0x25bfe2){return function(_0x175e02){if(_0x175e02){var _0xbcec6b=typeof _0x25bfe2[_0x76c4('0x1a')]===_0x76c4('0x1b')&&typeof _0x25bfe2[_0x76c4('0x1c')]===_0x76c4('0x1b');var _0x44de0e=_0x175e02['count'];var _0x4c293c=_0xbcec6b?0x0:_0x25bfe2[_0x76c4('0x1a')];var _0x293378=_0xbcec6b?_0x175e02[_0x76c4('0x1d')]:_0x25bfe2['offset']+_0x25bfe2[_0x76c4('0x1c')];var _0x3cb3ae;if(_0x293378>=_0x44de0e){_0x293378=_0x44de0e;_0x3cb3ae=0xc8;}else{_0x3cb3ae=0xce;}_0x2964e5['status'](_0x3cb3ae);return _0x2964e5[_0x76c4('0x1e')](_0x76c4('0x1f'),_0x4c293c+'-'+_0x293378+'/'+_0x44de0e)[_0x76c4('0x19')](_0x175e02);}return null;};}function patchUpdates(_0x34b92c){return function(_0x461a09){try{jsonpatch[_0x76c4('0x20')](_0x461a09,_0x34b92c,!![]);}catch(_0x211175){return BPromise[_0x76c4('0x21')](_0x211175);}return _0x461a09['save']();};}function saveUpdates(_0x2e422d,_0x1c449b){return function(_0x1fdfb1){if(_0x1fdfb1){return _0x1fdfb1[_0x76c4('0x22')](_0x2e422d)['then'](function(_0x475c56){return _0x475c56;});}return null;};}function removeEntity(_0x4335e4,_0x52e928){return function(_0x4cf7eb){if(_0x4cf7eb){return _0x4cf7eb['destroy']()['then'](function(){var _0x15a2ed=_0x4cf7eb[_0x76c4('0x23')]({'plain':!![]});var _0x53ba7c=_0x76c4('0x24');return db['UserProfileResource'][_0x76c4('0x25')]({'where':{'type':_0x53ba7c,'resourceId':_0x15a2ed['id']}})[_0x76c4('0x26')](function(){return _0x4cf7eb;});})['then'](function(){_0x4335e4[_0x76c4('0x18')](0xcc)[_0x76c4('0x27')]();});}};}function handleEntityNotFound(_0x553246,_0x49cd2f){return function(_0xf0a816){if(!_0xf0a816){_0x553246[_0x76c4('0x17')](0x194);}return _0xf0a816;};}function handleError(_0x2f4cb6,_0x35e417){_0x35e417=_0x35e417||0x1f4;return function(_0x489952){logger['error'](_0x489952[_0x76c4('0x28')]);if(_0x489952['name']){delete _0x489952['name'];}_0x2f4cb6[_0x76c4('0x18')](_0x35e417)[_0x76c4('0x29')](_0x489952);};}exports['index']=function(_0x40ed2a,_0x4dbad7){var _0x39e33f={},_0x3eb8b2={},_0x2c2f42={'count':0x0,'rows':[]};return db[_0x76c4('0x2a')][_0x76c4('0x2b')]()['then'](function(_0x2eccbb){_0x3eb8b2[_0x76c4('0x2c')]=_[_0x76c4('0x2d')](_0x2eccbb);_0x3eb8b2['query']=_['keys'](_0x40ed2a['query']);_0x3eb8b2[_0x76c4('0x2e')]=_[_0x76c4('0x2f')](_0x3eb8b2[_0x76c4('0x2c')],_0x3eb8b2[_0x76c4('0x30')]);_0x39e33f[_0x76c4('0x31')]=_[_0x76c4('0x2f')](_0x3eb8b2[_0x76c4('0x2c')],qs[_0x76c4('0x32')](_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x32')]));_0x39e33f[_0x76c4('0x31')]=_0x39e33f[_0x76c4('0x31')][_0x76c4('0x33')]?_0x39e33f[_0x76c4('0x31')]:_0x3eb8b2['model'];if(!_0x40ed2a[_0x76c4('0x30')]['hasOwnProperty'](_0x76c4('0x34'))){_0x39e33f[_0x76c4('0x1c')]=qs['limit'](_0x40ed2a[_0x76c4('0x30')]['limit']);_0x39e33f[_0x76c4('0x1a')]=qs[_0x76c4('0x1a')](_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x1a')]);}_0x39e33f['order']=qs['sort'](_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x35')]);_0x39e33f[_0x76c4('0x36')]=qs[_0x76c4('0x2e')](_[_0x76c4('0x37')](_0x40ed2a[_0x76c4('0x30')],_0x3eb8b2[_0x76c4('0x2e')]),_0x2eccbb);if(_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x38')]){_0x39e33f[_0x76c4('0x36')]=_['merge'](_0x39e33f[_0x76c4('0x36')],{'$or':_[_0x76c4('0x39')](_0x39e33f[_0x76c4('0x31')],function(_0x31211f){var _0x5300ab={};_0x5300ab[_0x31211f]={'$like':'%'+_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x38')]+'%'};return _0x5300ab;})});}_0x39e33f=_[_0x76c4('0x3a')]({},_0x39e33f,_0x40ed2a['options']);var _0xee99d8={'where':_0x39e33f[_0x76c4('0x36')]};return db[_0x76c4('0x2a')][_0x76c4('0x1d')](_0xee99d8)[_0x76c4('0x26')](function(_0x81b05e){_0x2c2f42[_0x76c4('0x1d')]=_0x81b05e;if(_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x3b')]){_0x39e33f['include']=[{'all':!![]}];}return db[_0x76c4('0x2a')][_0x76c4('0x3c')](_0x39e33f);})[_0x76c4('0x26')](function(_0x3a0080){_0x2c2f42['rows']=_0x3a0080;return _0x2c2f42;})['then'](respondWithFilteredResult(_0x4dbad7,_0x39e33f))[_0x76c4('0x3d')](handleError(_0x4dbad7,null));})[_0x76c4('0x3d')](handleError(_0x4dbad7,null));};exports[_0x76c4('0x3e')]=function(_0x1f92ca,_0x2f4740){var _0x56d488={'raw':![],'where':{'id':_0x1f92ca[_0x76c4('0x3f')]['id']}},_0x513098={};_0x513098[_0x76c4('0x2c')]=_[_0x76c4('0x2d')](db[_0x76c4('0x2a')]['rawAttributes']);_0x513098['query']=_[_0x76c4('0x2d')](_0x1f92ca['query']);_0x513098[_0x76c4('0x2e')]=_[_0x76c4('0x2f')](_0x513098[_0x76c4('0x2c')],_0x513098[_0x76c4('0x30')]);_0x56d488['attributes']=_[_0x76c4('0x2f')](_0x513098[_0x76c4('0x2c')],qs['fields'](_0x1f92ca[_0x76c4('0x30')][_0x76c4('0x32')]));_0x56d488[_0x76c4('0x31')]=_0x56d488[_0x76c4('0x31')][_0x76c4('0x33')]?_0x56d488['attributes']:_0x513098[_0x76c4('0x2c')];if(_0x1f92ca[_0x76c4('0x30')][_0x76c4('0x3b')]){_0x56d488[_0x76c4('0x40')]=[{'all':!![]}];}_0x56d488=_['merge']({},_0x56d488,_0x1f92ca[_0x76c4('0x41')]);return db[_0x76c4('0x2a')][_0x76c4('0x42')](_0x56d488)[_0x76c4('0x26')](handleEntityNotFound(_0x2f4740,null))[_0x76c4('0x26')](respondWithResult(_0x2f4740,null))[_0x76c4('0x3d')](handleError(_0x2f4740,null));};exports[_0x76c4('0x43')]=function(_0x45fa98,_0x21e2bd){return db[_0x76c4('0x2a')][_0x76c4('0x43')](_0x45fa98[_0x76c4('0x44')],{})[_0x76c4('0x26')](function(_0x5c0cff){var _0x41cfe0=_0x45fa98[_0x76c4('0x45')][_0x76c4('0x23')]({'plain':!![]});if(!_0x41cfe0)throw new Error(_0x76c4('0x46'));if(_0x41cfe0[_0x76c4('0x47')]==='user'){var _0x300cea=_0x5c0cff[_0x76c4('0x23')]({'plain':!![]});var _0x1f9f62=_0x76c4('0x24');return db[_0x76c4('0x48')][_0x76c4('0x42')]({'where':{'name':_0x1f9f62,'userProfileId':_0x41cfe0[_0x76c4('0x49')]},'raw':!![]})[_0x76c4('0x26')](function(_0x6241be){if(_0x6241be&&_0x6241be['autoAssociation']===0x0){return db[_0x76c4('0x4a')][_0x76c4('0x43')]({'name':_0x300cea[_0x76c4('0x4b')],'resourceId':_0x300cea['id'],'type':_0x6241be['name'],'sectionId':_0x6241be['id']},{})[_0x76c4('0x26')](function(){return _0x5c0cff;});}else{return _0x5c0cff;}})['catch'](function(_0x15de53){logger[_0x76c4('0x4c')](_0x76c4('0x4d'),_0x15de53);throw _0x15de53;});}return _0x5c0cff;})[_0x76c4('0x26')](respondWithResult(_0x21e2bd,0xc9))['catch'](handleError(_0x21e2bd,null));};exports[_0x76c4('0x22')]=function(_0x555feb,_0x58e403){if(_0x555feb[_0x76c4('0x44')]['id']){delete _0x555feb[_0x76c4('0x44')]['id'];}return db['CmCompany'][_0x76c4('0x42')]({'where':{'id':_0x555feb['params']['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x58e403,null))['then'](saveUpdates(_0x555feb['body'],null))[_0x76c4('0x26')](respondWithResult(_0x58e403,null))[_0x76c4('0x3d')](handleError(_0x58e403,null));};exports['destroy']=function(_0x1e45f4,_0x4cd0df){return db[_0x76c4('0x2a')]['find']({'where':{'id':_0x1e45f4[_0x76c4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4cd0df,null))['then'](removeEntity(_0x4cd0df,null))['catch'](handleError(_0x4cd0df,null));};exports[_0x76c4('0x2b')]=function(_0x1cda07,_0x2a7a3c){return db['CmCompany'][_0x76c4('0x2b')]()['then'](respondWithResult(_0x2a7a3c,null))[_0x76c4('0x3d')](handleError(_0x2a7a3c,null));};exports['addContacts']=function(_0x210e96,_0x37c229,_0x1fd91b){return db[_0x76c4('0x4e')][_0x76c4('0x42')]({'where':{'id':_0x210e96[_0x76c4('0x3f')]['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x37c229,null))[_0x76c4('0x26')](function(_0x389c45){if(_0x389c45){return _0x389c45['addContacts'](_0x210e96[_0x76c4('0x44')][_0x76c4('0x4f')],_['omit'](_0x210e96[_0x76c4('0x44')],[_0x76c4('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x37c229,null))[_0x76c4('0x3d')](handleError(_0x37c229,null));};exports[_0x76c4('0x50')]=function(_0x2f6c7d,_0x230935,_0x3a111a){var _0xcae341={};var _0x3c3405={};var _0x558878;var _0x1468f6;return db[_0x76c4('0x2a')][_0x76c4('0x51')]({'where':{'id':_0x2f6c7d['params']['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x230935,null))['then'](function(_0x5ee59){if(_0x5ee59){_0x558878=_0x5ee59;_0x3c3405[_0x76c4('0x2c')]=_['keys'](db[_0x76c4('0x4e')][_0x76c4('0x52')]);_0x3c3405[_0x76c4('0x30')]=_[_0x76c4('0x2d')](_0x2f6c7d[_0x76c4('0x30')]);_0x3c3405[_0x76c4('0x2e')]=_[_0x76c4('0x2f')](_0x3c3405['model'],_0x3c3405[_0x76c4('0x30')]);_0xcae341[_0x76c4('0x31')]=_[_0x76c4('0x2f')](_0x3c3405[_0x76c4('0x2c')],qs[_0x76c4('0x32')](_0x2f6c7d[_0x76c4('0x30')]['fields']));_0xcae341[_0x76c4('0x31')]=_0xcae341['attributes'][_0x76c4('0x33')]?_0xcae341[_0x76c4('0x31')]:_0x3c3405[_0x76c4('0x2c')];_0xcae341[_0x76c4('0x53')]=qs[_0x76c4('0x35')](_0x2f6c7d['query'][_0x76c4('0x35')]);_0xcae341[_0x76c4('0x36')]=qs[_0x76c4('0x2e')](_['pick'](_0x2f6c7d[_0x76c4('0x30')],_0x3c3405[_0x76c4('0x2e')]));if(_0x2f6c7d[_0x76c4('0x30')][_0x76c4('0x38')]){_0xcae341[_0x76c4('0x36')]=_['merge'](_0xcae341[_0x76c4('0x36')],{'$or':_['map'](_0xcae341[_0x76c4('0x31')],function(_0x50f7e5){var _0x208922={};_0x208922[_0x50f7e5]={'$like':'%'+_0x2f6c7d['query'][_0x76c4('0x38')]+'%'};return _0x208922;})});}_0xcae341=_[_0x76c4('0x3a')]({},_0xcae341,_0x2f6c7d['options']);return _0x558878[_0x76c4('0x50')](_0xcae341);}})[_0x76c4('0x26')](function(_0x27c5b9){if(_0x27c5b9){_0x1468f6=_0x27c5b9['length'];if(!_0x2f6c7d[_0x76c4('0x30')][_0x76c4('0x54')](_0x76c4('0x34'))){_0xcae341['limit']=qs[_0x76c4('0x1c')](_0x2f6c7d[_0x76c4('0x30')]['limit']);_0xcae341[_0x76c4('0x1a')]=qs['offset'](_0x2f6c7d[_0x76c4('0x30')][_0x76c4('0x1a')]);}return _0x558878['getContacts'](_0xcae341);}})['then'](function(_0x4b8c66){if(_0x4b8c66){return _0x4b8c66?{'count':_0x1468f6,'rows':_0x4b8c66}:null;}})[_0x76c4('0x26')](respondWithResult(_0x230935,null))[_0x76c4('0x3d')](handleError(_0x230935,null));}; \ No newline at end of file +var _0x0c8e=['util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','Companies','then','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','merge','options','includeAll','rows','catch','rawAttributes','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','addContacts','ids','omit','getContacts','CmContact','nolimit','eml-format','rimraf','zip-dir','request-promise','mustache'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0x0c8e,0x14b));var _0xe0c8=function(_0x545b11,_0x81555d){_0x545b11=_0x545b11-0x0;var _0x23a986=_0x0c8e[_0x545b11];return _0x23a986;};'use strict';var emlformat=require(_0xe0c8('0x0'));var rimraf=require(_0xe0c8('0x1'));var zipdir=require(_0xe0c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe0c8('0x4'));var util=require(_0xe0c8('0x5'));var path=require('path');var sox=require(_0xe0c8('0x6'));var csv=require(_0xe0c8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0c8('0x8'));var _=require(_0xe0c8('0x9'));var squel=require(_0xe0c8('0xa'));var crypto=require(_0xe0c8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe0c8('0xc'));var toCsv=require(_0xe0c8('0x7'));var querystring=require(_0xe0c8('0xd'));var Papa=require(_0xe0c8('0xe'));var Redis=require(_0xe0c8('0xf'));var authService=require(_0xe0c8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe0c8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe0c8('0x12'));var config=require(_0xe0c8('0x13'));var licenseUtil=require(_0xe0c8('0x14'));var db=require(_0xe0c8('0x15'))['db'];function respondWithStatusCode(_0x4031db,_0x5eae74){_0x5eae74=_0x5eae74||0xcc;return function(_0x16988f){if(_0x16988f){return _0x4031db['sendStatus'](_0x5eae74);}return _0x4031db['status'](_0x5eae74)[_0xe0c8('0x16')]();};}function respondWithResult(_0x1b6026,_0x21d2cf){_0x21d2cf=_0x21d2cf||0xc8;return function(_0x217dc8){if(_0x217dc8){return _0x1b6026[_0xe0c8('0x17')](_0x21d2cf)[_0xe0c8('0x18')](_0x217dc8);}};}function respondWithFilteredResult(_0x324ee3,_0x5dd758){return function(_0x4a988c){if(_0x4a988c){var _0x3ade55=typeof _0x5dd758['offset']===_0xe0c8('0x19')&&typeof _0x5dd758[_0xe0c8('0x1a')]===_0xe0c8('0x19');var _0x3cc509=_0x4a988c[_0xe0c8('0x1b')];var _0x496034=_0x3ade55?0x0:_0x5dd758[_0xe0c8('0x1c')];var _0x11f9c0=_0x3ade55?_0x4a988c[_0xe0c8('0x1b')]:_0x5dd758[_0xe0c8('0x1c')]+_0x5dd758['limit'];var _0x14f36d;if(_0x11f9c0>=_0x3cc509){_0x11f9c0=_0x3cc509;_0x14f36d=0xc8;}else{_0x14f36d=0xce;}_0x324ee3[_0xe0c8('0x17')](_0x14f36d);return _0x324ee3['set'](_0xe0c8('0x1d'),_0x496034+'-'+_0x11f9c0+'/'+_0x3cc509)[_0xe0c8('0x18')](_0x4a988c);}return null;};}function patchUpdates(_0x4ffc32){return function(_0x124be5){try{jsonpatch[_0xe0c8('0x1e')](_0x124be5,_0x4ffc32,!![]);}catch(_0x1d127c){return BPromise[_0xe0c8('0x1f')](_0x1d127c);}return _0x124be5[_0xe0c8('0x20')]();};}function saveUpdates(_0x58914e,_0x42155f){return function(_0x3d7b08){if(_0x3d7b08){return _0x3d7b08[_0xe0c8('0x21')](_0x58914e)['then'](function(_0x37e0f3){return _0x37e0f3;});}return null;};}function removeEntity(_0x1ce32c,_0x3f5769){return function(_0x5c969e){if(_0x5c969e){return _0x5c969e[_0xe0c8('0x22')]()['then'](function(){var _0x3834a3=_0x5c969e[_0xe0c8('0x23')]({'plain':!![]});var _0x2c3fd8=_0xe0c8('0x24');return db['UserProfileResource'][_0xe0c8('0x22')]({'where':{'type':_0x2c3fd8,'resourceId':_0x3834a3['id']}})[_0xe0c8('0x25')](function(){return _0x5c969e;});})[_0xe0c8('0x25')](function(){_0x1ce32c[_0xe0c8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bbc3d,_0x30e99b){return function(_0x5017f1){if(!_0x5017f1){_0x4bbc3d[_0xe0c8('0x26')](0x194);}return _0x5017f1;};}function handleError(_0x2db75f,_0x5cd8bc){_0x5cd8bc=_0x5cd8bc||0x1f4;return function(_0x49e593){logger[_0xe0c8('0x27')](_0x49e593[_0xe0c8('0x28')]);if(_0x49e593[_0xe0c8('0x29')]){delete _0x49e593['name'];}_0x2db75f[_0xe0c8('0x17')](_0x5cd8bc)[_0xe0c8('0x2a')](_0x49e593);};}exports[_0xe0c8('0x2b')]=function(_0x4af9cb,_0x5b8821){var _0x2e59d8={},_0x2ebcbe={},_0x2de83e={'count':0x0,'rows':[]};return db[_0xe0c8('0x2c')][_0xe0c8('0x2d')]()['then'](function(_0x2daa7a){_0x2ebcbe[_0xe0c8('0x2e')]=_[_0xe0c8('0x2f')](_0x2daa7a);_0x2ebcbe[_0xe0c8('0x30')]=_[_0xe0c8('0x2f')](_0x4af9cb[_0xe0c8('0x30')]);_0x2ebcbe[_0xe0c8('0x31')]=_[_0xe0c8('0x32')](_0x2ebcbe[_0xe0c8('0x2e')],_0x2ebcbe['query']);_0x2e59d8[_0xe0c8('0x33')]=_[_0xe0c8('0x32')](_0x2ebcbe['model'],qs[_0xe0c8('0x34')](_0x4af9cb[_0xe0c8('0x30')][_0xe0c8('0x34')]));_0x2e59d8['attributes']=_0x2e59d8[_0xe0c8('0x33')][_0xe0c8('0x35')]?_0x2e59d8[_0xe0c8('0x33')]:_0x2ebcbe[_0xe0c8('0x2e')];if(!_0x4af9cb[_0xe0c8('0x30')][_0xe0c8('0x36')]('nolimit')){_0x2e59d8[_0xe0c8('0x1a')]=qs[_0xe0c8('0x1a')](_0x4af9cb['query'][_0xe0c8('0x1a')]);_0x2e59d8['offset']=qs[_0xe0c8('0x1c')](_0x4af9cb['query'][_0xe0c8('0x1c')]);}_0x2e59d8[_0xe0c8('0x37')]=qs[_0xe0c8('0x38')](_0x4af9cb[_0xe0c8('0x30')][_0xe0c8('0x38')]);_0x2e59d8[_0xe0c8('0x39')]=qs['filters'](_[_0xe0c8('0x3a')](_0x4af9cb[_0xe0c8('0x30')],_0x2ebcbe[_0xe0c8('0x31')]),_0x2daa7a);if(_0x4af9cb[_0xe0c8('0x30')][_0xe0c8('0x3b')]){_0x2e59d8[_0xe0c8('0x39')]=_['merge'](_0x2e59d8[_0xe0c8('0x39')],{'$or':_[_0xe0c8('0x3c')](_0x2e59d8[_0xe0c8('0x33')],function(_0x4086dd){var _0x4302e6={};_0x4302e6[_0x4086dd]={'$like':'%'+_0x4af9cb[_0xe0c8('0x30')][_0xe0c8('0x3b')]+'%'};return _0x4302e6;})});}_0x2e59d8=_[_0xe0c8('0x3d')]({},_0x2e59d8,_0x4af9cb[_0xe0c8('0x3e')]);var _0x3e87e9={'where':_0x2e59d8['where']};return db[_0xe0c8('0x2c')][_0xe0c8('0x1b')](_0x3e87e9)[_0xe0c8('0x25')](function(_0x2e5de8){_0x2de83e[_0xe0c8('0x1b')]=_0x2e5de8;if(_0x4af9cb[_0xe0c8('0x30')][_0xe0c8('0x3f')]){_0x2e59d8['include']=[{'all':!![]}];}return db[_0xe0c8('0x2c')]['findAll'](_0x2e59d8);})[_0xe0c8('0x25')](function(_0x26572a){_0x2de83e[_0xe0c8('0x40')]=_0x26572a;return _0x2de83e;})['then'](respondWithFilteredResult(_0x5b8821,_0x2e59d8))[_0xe0c8('0x41')](handleError(_0x5b8821,null));})[_0xe0c8('0x41')](handleError(_0x5b8821,null));};exports['show']=function(_0x19c430,_0x2743df){var _0x1d639e={'raw':![],'where':{'id':_0x19c430['params']['id']}},_0x1c5838={};_0x1c5838['model']=_[_0xe0c8('0x2f')](db['CmCompany'][_0xe0c8('0x42')]);_0x1c5838[_0xe0c8('0x30')]=_[_0xe0c8('0x2f')](_0x19c430['query']);_0x1c5838[_0xe0c8('0x31')]=_['intersection'](_0x1c5838[_0xe0c8('0x2e')],_0x1c5838[_0xe0c8('0x30')]);_0x1d639e[_0xe0c8('0x33')]=_['intersection'](_0x1c5838['model'],qs[_0xe0c8('0x34')](_0x19c430[_0xe0c8('0x30')][_0xe0c8('0x34')]));_0x1d639e[_0xe0c8('0x33')]=_0x1d639e[_0xe0c8('0x33')][_0xe0c8('0x35')]?_0x1d639e[_0xe0c8('0x33')]:_0x1c5838['model'];if(_0x19c430[_0xe0c8('0x30')][_0xe0c8('0x3f')]){_0x1d639e[_0xe0c8('0x43')]=[{'all':!![]}];}_0x1d639e=_[_0xe0c8('0x3d')]({},_0x1d639e,_0x19c430[_0xe0c8('0x3e')]);return db[_0xe0c8('0x2c')]['find'](_0x1d639e)[_0xe0c8('0x25')](handleEntityNotFound(_0x2743df,null))[_0xe0c8('0x25')](respondWithResult(_0x2743df,null))[_0xe0c8('0x41')](handleError(_0x2743df,null));};exports[_0xe0c8('0x44')]=function(_0x137c75,_0x31e2ec){return db[_0xe0c8('0x2c')][_0xe0c8('0x44')](_0x137c75['body'],{})[_0xe0c8('0x25')](function(_0x5a6373){var _0x1dac80=_0x137c75['user'][_0xe0c8('0x23')]({'plain':!![]});if(!_0x1dac80)throw new Error(_0xe0c8('0x45'));if(_0x1dac80['role']===_0xe0c8('0x46')){var _0x1a929d=_0x5a6373[_0xe0c8('0x23')]({'plain':!![]});var _0x59f113=_0xe0c8('0x24');return db[_0xe0c8('0x47')]['find']({'where':{'name':_0x59f113,'userProfileId':_0x1dac80[_0xe0c8('0x48')]},'raw':!![]})[_0xe0c8('0x25')](function(_0x1440fd){if(_0x1440fd&&_0x1440fd[_0xe0c8('0x49')]===0x0){return db['UserProfileResource'][_0xe0c8('0x44')]({'name':_0x1a929d[_0xe0c8('0x29')],'resourceId':_0x1a929d['id'],'type':_0x1440fd[_0xe0c8('0x29')],'sectionId':_0x1440fd['id']},{})['then'](function(){return _0x5a6373;});}else{return _0x5a6373;}})[_0xe0c8('0x41')](function(_0x4ecddc){logger[_0xe0c8('0x27')](_0xe0c8('0x4a'),_0x4ecddc);throw _0x4ecddc;});}return _0x5a6373;})[_0xe0c8('0x25')](respondWithResult(_0x31e2ec,0xc9))[_0xe0c8('0x41')](handleError(_0x31e2ec,null));};exports[_0xe0c8('0x21')]=function(_0xecdd2e,_0x5d2fbe){if(_0xecdd2e[_0xe0c8('0x4b')]['id']){delete _0xecdd2e[_0xe0c8('0x4b')]['id'];}return db[_0xe0c8('0x2c')]['find']({'where':{'id':_0xecdd2e['params']['id']}})[_0xe0c8('0x25')](handleEntityNotFound(_0x5d2fbe,null))[_0xe0c8('0x25')](saveUpdates(_0xecdd2e[_0xe0c8('0x4b')],null))[_0xe0c8('0x25')](respondWithResult(_0x5d2fbe,null))[_0xe0c8('0x41')](handleError(_0x5d2fbe,null));};exports[_0xe0c8('0x22')]=function(_0x4db68c,_0x30f49e){return db[_0xe0c8('0x2c')][_0xe0c8('0x4c')]({'where':{'id':_0x4db68c[_0xe0c8('0x4d')]['id']}})[_0xe0c8('0x25')](handleEntityNotFound(_0x30f49e,null))['then'](removeEntity(_0x30f49e,null))[_0xe0c8('0x41')](handleError(_0x30f49e,null));};exports['describe']=function(_0x1e5602,_0x3ee208){return db[_0xe0c8('0x2c')]['describe']()['then'](respondWithResult(_0x3ee208,null))['catch'](handleError(_0x3ee208,null));};exports[_0xe0c8('0x4e')]=function(_0xff675c,_0x39dacc,_0x3b3d02){return db['CmContact'][_0xe0c8('0x4c')]({'where':{'id':_0xff675c[_0xe0c8('0x4d')]['id']}})[_0xe0c8('0x25')](handleEntityNotFound(_0x39dacc,null))[_0xe0c8('0x25')](function(_0x567190){if(_0x567190){return _0x567190['addContacts'](_0xff675c[_0xe0c8('0x4b')][_0xe0c8('0x4f')],_[_0xe0c8('0x50')](_0xff675c[_0xe0c8('0x4b')],[_0xe0c8('0x4f'),'id'])||{});}})[_0xe0c8('0x25')](respondWithResult(_0x39dacc,null))[_0xe0c8('0x41')](handleError(_0x39dacc,null));};exports[_0xe0c8('0x51')]=function(_0x31f9d6,_0x242414,_0x4008c3){var _0x3c20e2={};var _0x5b8575={};var _0x3e2a9e;var _0x11208d;return db[_0xe0c8('0x2c')]['findOne']({'where':{'id':_0x31f9d6[_0xe0c8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x242414,null))[_0xe0c8('0x25')](function(_0x1fa759){if(_0x1fa759){_0x3e2a9e=_0x1fa759;_0x5b8575[_0xe0c8('0x2e')]=_['keys'](db[_0xe0c8('0x52')][_0xe0c8('0x42')]);_0x5b8575[_0xe0c8('0x30')]=_[_0xe0c8('0x2f')](_0x31f9d6[_0xe0c8('0x30')]);_0x5b8575[_0xe0c8('0x31')]=_['intersection'](_0x5b8575[_0xe0c8('0x2e')],_0x5b8575[_0xe0c8('0x30')]);_0x3c20e2[_0xe0c8('0x33')]=_[_0xe0c8('0x32')](_0x5b8575[_0xe0c8('0x2e')],qs[_0xe0c8('0x34')](_0x31f9d6[_0xe0c8('0x30')][_0xe0c8('0x34')]));_0x3c20e2[_0xe0c8('0x33')]=_0x3c20e2['attributes'][_0xe0c8('0x35')]?_0x3c20e2[_0xe0c8('0x33')]:_0x5b8575[_0xe0c8('0x2e')];_0x3c20e2[_0xe0c8('0x37')]=qs[_0xe0c8('0x38')](_0x31f9d6[_0xe0c8('0x30')][_0xe0c8('0x38')]);_0x3c20e2[_0xe0c8('0x39')]=qs[_0xe0c8('0x31')](_['pick'](_0x31f9d6[_0xe0c8('0x30')],_0x5b8575[_0xe0c8('0x31')]));if(_0x31f9d6['query'][_0xe0c8('0x3b')]){_0x3c20e2[_0xe0c8('0x39')]=_[_0xe0c8('0x3d')](_0x3c20e2[_0xe0c8('0x39')],{'$or':_[_0xe0c8('0x3c')](_0x3c20e2[_0xe0c8('0x33')],function(_0x292383){var _0x473529={};_0x473529[_0x292383]={'$like':'%'+_0x31f9d6[_0xe0c8('0x30')][_0xe0c8('0x3b')]+'%'};return _0x473529;})});}_0x3c20e2=_[_0xe0c8('0x3d')]({},_0x3c20e2,_0x31f9d6['options']);return _0x3e2a9e[_0xe0c8('0x51')](_0x3c20e2);}})[_0xe0c8('0x25')](function(_0x32d40a){if(_0x32d40a){_0x11208d=_0x32d40a[_0xe0c8('0x35')];if(!_0x31f9d6['query']['hasOwnProperty'](_0xe0c8('0x53'))){_0x3c20e2[_0xe0c8('0x1a')]=qs[_0xe0c8('0x1a')](_0x31f9d6['query']['limit']);_0x3c20e2[_0xe0c8('0x1c')]=qs[_0xe0c8('0x1c')](_0x31f9d6[_0xe0c8('0x30')]['offset']);}return _0x3e2a9e[_0xe0c8('0x51')](_0x3c20e2);}})[_0xe0c8('0x25')](function(_0x28ec1a){if(_0x28ec1a){return _0x28ec1a?{'count':_0x11208d,'rows':_0x28ec1a}:null;}})['then'](respondWithResult(_0x242414,null))[_0xe0c8('0x41')](handleError(_0x242414,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index e40f5d7..f2154b8 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 _0x763e=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util'];(function(_0x1be5ca,_0x4d5966){var _0x255754=function(_0xe270c2){while(--_0xe270c2){_0x1be5ca['push'](_0x1be5ca['shift']());}};_0x255754(++_0x4d5966);}(_0x763e,0x184));var _0xe763=function(_0x56072d,_0x187f3d){_0x56072d=_0x56072d-0x0;var _0x5ef918=_0x763e[_0x56072d];return _0x5ef918;};'use strict';var _=require(_0xe763('0x0'));var util=require(_0xe763('0x1'));var logger=require(_0xe763('0x2'))(_0xe763('0x3'));var moment=require(_0xe763('0x4'));var BPromise=require('bluebird');var rp=require(_0xe763('0x5'));var fs=require('fs');var path=require(_0xe763('0x6'));var rimraf=require(_0xe763('0x7'));var config=require(_0xe763('0x8'));var attributes=require(_0xe763('0x9'));module['exports']=function(_0x44bdd2,_0x5106a1){return _0x44bdd2[_0xe763('0xa')](_0xe763('0xb'),attributes,{'tableName':_0xe763('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61ab=['bluebird','request-promise','path','rimraf','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment'];(function(_0x5463c7,_0x2b85d2){var _0x489930=function(_0x3447cc){while(--_0x3447cc){_0x5463c7['push'](_0x5463c7['shift']());}};_0x489930(++_0x2b85d2);}(_0x61ab,0x10c));var _0xb61a=function(_0x163e51,_0x563767){_0x163e51=_0x163e51-0x0;var _0x5b9ce5=_0x61ab[_0x163e51];return _0x5b9ce5;};'use strict';var _=require(_0xb61a('0x0'));var util=require(_0xb61a('0x1'));var logger=require(_0xb61a('0x2'))(_0xb61a('0x3'));var moment=require(_0xb61a('0x4'));var BPromise=require(_0xb61a('0x5'));var rp=require(_0xb61a('0x6'));var fs=require('fs');var path=require(_0xb61a('0x7'));var rimraf=require(_0xb61a('0x8'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0xb61a('0x9')]=function(_0x140563,_0x14025b){return _0x140563[_0xb61a('0xa')](_0xb61a('0xb'),attributes,{'tableName':_0xb61a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 3cc1afe..caf6399 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 _0x7f11=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash'];(function(_0x3b516e,_0x565238){var _0x1a929c=function(_0xe2fab6){while(--_0xe2fab6){_0x3b516e['push'](_0x3b516e['shift']());}};_0x1a929c(++_0x565238);}(_0x7f11,0x175));var _0x17f1=function(_0x16495f,_0x5f2cac){_0x16495f=_0x16495f-0x0;var _0x957e3e=_0x7f11[_0x16495f];return _0x957e3e;};'use strict';var _=require(_0x17f1('0x0'));var util=require(_0x17f1('0x1'));var moment=require(_0x17f1('0x2'));var BPromise=require('bluebird');var rs=require(_0x17f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17f1('0x4'))['db'];var utils=require(_0x17f1('0x5'));var logger=require(_0x17f1('0x6'))(_0x17f1('0x7'));var config=require(_0x17f1('0x8'));var jayson=require(_0x17f1('0x9'));var client=jayson[_0x17f1('0xa')][_0x17f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ce48c,_0x1485a8,_0x1c7dff){return new BPromise(function(_0x5c4804,_0x32ad56){return client[_0x17f1('0xc')](_0x2ce48c,_0x1c7dff)[_0x17f1('0xd')](function(_0x7da095){logger[_0x17f1('0xe')](_0x17f1('0xf'),_0x1485a8,_0x17f1('0x10'));logger[_0x17f1('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1485a8,_0x17f1('0x10'),JSON[_0x17f1('0x12')](_0x7da095));if(_0x7da095['error']){if(_0x7da095[_0x17f1('0x13')]['code']===0x1f4){logger['error'](_0x17f1('0xf'),_0x1485a8,_0x7da095[_0x17f1('0x13')][_0x17f1('0x14')]);return _0x32ad56(_0x7da095[_0x17f1('0x13')][_0x17f1('0x14')]);}logger[_0x17f1('0x13')](_0x17f1('0xf'),_0x1485a8,_0x7da095[_0x17f1('0x13')][_0x17f1('0x14')]);return _0x5c4804(_0x7da095[_0x17f1('0x13')]['message']);}else{logger[_0x17f1('0xe')](_0x17f1('0xf'),_0x1485a8,_0x17f1('0x10'));_0x5c4804(_0x7da095['result'][_0x17f1('0x14')]);}})[_0x17f1('0x15')](function(_0x22c8eb){logger[_0x17f1('0x13')]('CmCompany,\x20%s,\x20%s',_0x1485a8,_0x22c8eb);_0x32ad56(_0x22c8eb);});});} \ No newline at end of file +var _0x3168=['util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3168,0x17b));var _0x8316=function(_0x594cc7,_0x1e625b){_0x594cc7=_0x594cc7-0x0;var _0x3c1cb5=_0x3168[_0x594cc7];return _0x3c1cb5;};'use strict';var _=require(_0x8316('0x0'));var util=require(_0x8316('0x1'));var moment=require(_0x8316('0x2'));var BPromise=require(_0x8316('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8316('0x4'));var logger=require(_0x8316('0x5'))(_0x8316('0x6'));var config=require(_0x8316('0x7'));var jayson=require(_0x8316('0x8'));var client=jayson[_0x8316('0x9')][_0x8316('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x443dde,_0x179c23,_0xbac269){return new BPromise(function(_0x520e71,_0x5a7fd5){return client['request'](_0x443dde,_0xbac269)['then'](function(_0x177e80){logger['info'](_0x8316('0xb'),_0x179c23,_0x8316('0xc'));logger[_0x8316('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x179c23,_0x8316('0xc'),JSON[_0x8316('0xe')](_0x177e80));if(_0x177e80['error']){if(_0x177e80[_0x8316('0xf')]['code']===0x1f4){logger[_0x8316('0xf')](_0x8316('0xb'),_0x179c23,_0x177e80['error'][_0x8316('0x10')]);return _0x5a7fd5(_0x177e80[_0x8316('0xf')][_0x8316('0x10')]);}logger[_0x8316('0xf')](_0x8316('0xb'),_0x179c23,_0x177e80[_0x8316('0xf')][_0x8316('0x10')]);return _0x520e71(_0x177e80['error']['message']);}else{logger[_0x8316('0x11')](_0x8316('0xb'),_0x179c23,_0x8316('0xc'));_0x520e71(_0x177e80[_0x8316('0x12')][_0x8316('0x10')]);}})['catch'](function(_0x103cfa){logger['error'](_0x8316('0xb'),_0x179c23,_0x103cfa);_0x5a7fd5(_0x103cfa);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index a39bb7f..2c66c4c 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 _0xaf38=['get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create','addContacts','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xaa24f8,_0x19e09f){var _0x39c565=function(_0xde1729){while(--_0xde1729){_0xaa24f8['push'](_0xaa24f8['shift']());}};_0x39c565(++_0x19e09f);}(_0xaf38,0x10b));var _0x8af3=function(_0x36a5df,_0x3711be){_0x36a5df=_0x36a5df-0x0;var _0x4e671f=_0xaf38[_0x36a5df];return _0x4e671f;};'use strict';var multer=require(_0x8af3('0x0'));var util=require(_0x8af3('0x1'));var path=require(_0x8af3('0x2'));var timeout=require(_0x8af3('0x3'));var express=require(_0x8af3('0x4'));var router=express[_0x8af3('0x5')]();var fs_extra=require(_0x8af3('0x6'));var auth=require(_0x8af3('0x7'));var interaction=require(_0x8af3('0x8'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x8af3('0x9')]('/',auth[_0x8af3('0xa')](),controller[_0x8af3('0xb')]);router[_0x8af3('0x9')](_0x8af3('0xc'),auth[_0x8af3('0xa')](),controller[_0x8af3('0xd')]);router['get'](_0x8af3('0xe'),auth[_0x8af3('0xa')](),controller[_0x8af3('0xf')]);router[_0x8af3('0x9')]('/:id/contacts',auth[_0x8af3('0xa')](),controller[_0x8af3('0x10')]);router[_0x8af3('0x11')]('/',auth[_0x8af3('0xa')](),controller[_0x8af3('0x12')]);router[_0x8af3('0x11')]('/:id/contacts',auth[_0x8af3('0xa')](),controller[_0x8af3('0x13')]);router[_0x8af3('0x14')]('/:id',auth[_0x8af3('0xa')](),controller['update']);router['delete'](_0x8af3('0xe'),auth[_0x8af3('0xa')](),controller[_0x8af3('0x15')]);module[_0x8af3('0x16')]=router; \ No newline at end of file +var _0x523c=['post','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','/:id/contacts','create'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x523c,0x156));var _0xc523=function(_0x5e3068,_0x1dde86){_0x5e3068=_0x5e3068-0x0;var _0x5c9abb=_0x523c[_0x5e3068];return _0x5c9abb;};'use strict';var multer=require(_0xc523('0x0'));var util=require(_0xc523('0x1'));var path=require(_0xc523('0x2'));var timeout=require(_0xc523('0x3'));var express=require('express');var router=express[_0xc523('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc523('0x5'));var config=require(_0xc523('0x6'));var controller=require(_0xc523('0x7'));router[_0xc523('0x8')]('/',auth[_0xc523('0x9')](),controller['index']);router[_0xc523('0x8')](_0xc523('0xa'),auth[_0xc523('0x9')](),controller[_0xc523('0xb')]);router[_0xc523('0x8')](_0xc523('0xc'),auth[_0xc523('0x9')](),controller['show']);router[_0xc523('0x8')](_0xc523('0xd'),auth[_0xc523('0x9')](),controller['getContacts']);router['post']('/',auth[_0xc523('0x9')](),controller[_0xc523('0xe')]);router[_0xc523('0xf')]('/:id/contacts',auth[_0xc523('0x9')](),controller[_0xc523('0x10')]);router[_0xc523('0x11')]('/:id',auth[_0xc523('0x9')](),controller[_0xc523('0x12')]);router['delete']('/:id',auth[_0xc523('0x9')](),controller[_0xc523('0x13')]);module[_0xc523('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c0dc139..c4e8ba6 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 _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x1050b5,_0x4e97c7){var _0x411620=function(_0x573cd0){while(--_0x573cd0){_0x1050b5['push'](_0x1050b5['shift']());}};_0x411620(++_0x4e97c7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x232cf2,_0x4ffb79){_0x232cf2=_0x232cf2-0x0;var _0x463cec=_0x0b0e[_0x232cf2];return _0x463cec;};'use strict';var _=require(_0xe0b0('0x0'));var Sequelize=require('sequelize');module[_0xe0b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b0('0x2')]},'street':{'type':Sequelize[_0xe0b0('0x2')]},'postalCode':{'type':Sequelize[_0xe0b0('0x2')]},'city':{'type':Sequelize[_0xe0b0('0x2')]},'country':{'type':Sequelize[_0xe0b0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe0b0('0x2')]},'description':{'type':Sequelize[_0xe0b0('0x3')]},'phone':{'type':Sequelize[_0xe0b0('0x2')]},'mobile':{'type':Sequelize[_0xe0b0('0x2')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'email':{'type':Sequelize[_0xe0b0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe0b0('0x2')]},'twitter':{'type':Sequelize[_0xe0b0('0x2')]},'skype':{'type':Sequelize[_0xe0b0('0x2')]},'teams':{'type':Sequelize[_0xe0b0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe0b0('0x2')]},'wechat':{'type':Sequelize[_0xe0b0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b0('0x4')]},'priority':{'type':Sequelize[_0xe0b0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':Sequelize[_0xe0b0('0x6')]},'dialTimezone':{'type':Sequelize[_0xe0b0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x757a=['STRING','TEXT','INTEGER','UNSIGNED','DATE','sequelize','exports'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x757a,0xde));var _0xa757=function(_0x5d796e,_0x3b1753){_0x5d796e=_0x5d796e-0x0;var _0x1b481a=_0x757a[_0x5d796e];return _0x1b481a;};'use strict';var _=require('lodash');var Sequelize=require(_0xa757('0x0'));module[_0xa757('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa757('0x2')]},'city':{'type':Sequelize[_0xa757('0x2')]},'country':{'type':Sequelize[_0xa757('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa757('0x2')]},'description':{'type':Sequelize[_0xa757('0x3')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa757('0x2')]},'email':{'type':Sequelize[_0xa757('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa757('0x2')]},'fb_data':{'type':Sequelize[_0xa757('0x2')]},'twitter':{'type':Sequelize[_0xa757('0x2')]},'skype':{'type':Sequelize[_0xa757('0x2')]},'teams':{'type':Sequelize[_0xa757('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xa757('0x2')]},'wechat':{'type':Sequelize[_0xa757('0x2')]},'telegram':{'type':Sequelize[_0xa757('0x2')]},'UserId':{'type':Sequelize[_0xa757('0x4')]},'priority':{'type':Sequelize[_0xa757('0x4')](0x2)[_0xa757('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa757('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index cdc606e..8eeeb4a 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 _0xb4f2=['c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','having','t.id\x20IN\x20?','resolve','role','agent','some','User','user','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','TagIds','Tags','rows','catch','params','columnName','displayName','analytics','CmCustomField','alias','custom','values','body','findAll','get','mergeWith','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','dialTimezone','timezones','utcOffset','bulkCreate','duplicates','$or','findOrCreate','spread','show','Tag','$and','omit','format','cf_%d','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','rawAttributes','pick','options','setTags','ids','getHoppers','ContactId','includeAll','include','CmHopper','getHopperHistories','getHopperFinals','getJscriptySessions','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','Incorrect\x20binding\x20parameters\x20passed!','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','send','createReadStream','parse','import','binding','firstName','../../components/import/cm/csv2','stringify','error\x20child\x20process','pid','getJourney','mail','sms','openchannel','whatsapp','voice','-createdAt','includes','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','createdAt','DESC','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','note','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','sortBy','reverse','moment','bluebird','util','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','CmContact','describe','keys','length','startsWith','push','trimStart','cf_','fieldType','model','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','search','parseSearch','sqlOperator','conditions','find','value','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','type','text','start','filter','isNil','Contact','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xb4f2,0x1eb));var _0x2b4f=function(_0x351e94,_0x1f95a8){_0x351e94=_0x351e94-0x0;var _0x3cb652=_0xb4f2[_0x351e94];return _0x3cb652;};'use strict';var moment=require(_0x2b4f('0x0'));var BPromise=require(_0x2b4f('0x1'));var util=require(_0x2b4f('0x2'));var path=require(_0x2b4f('0x3'));var fs=require('fs');var _=require(_0x2b4f('0x4'));var squel=require('squel');var Papa=require(_0x2b4f('0x5'));var Redis=require(_0x2b4f('0x6'));var qs=require(_0x2b4f('0x7'));var as=require(_0x2b4f('0x8'));var logger=require(_0x2b4f('0x9'))('api');var config=require(_0x2b4f('0xa'));var shared=require('../../config/environment/shared');var db=require(_0x2b4f('0xb'))['db'];config[_0x2b4f('0xc')]=_[_0x2b4f('0xd')](config[_0x2b4f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b4f('0xe'))(new Redis(config['redis']));require(_0x2b4f('0xf'))[_0x2b4f('0x10')](socket);function respondWithResult(_0x1fe8e8,_0x44af08){_0x44af08=_0x44af08||0xc8;return function(_0x4eacad){if(_0x4eacad){return _0x1fe8e8[_0x2b4f('0x11')](_0x44af08)['json'](_0x4eacad);}};}function respondWithFilteredResult(_0x98711f,_0x36ae92){return function(_0x2e5b83){if(_0x2e5b83){var _0x2c705f=typeof _0x36ae92[_0x2b4f('0x12')]===_0x2b4f('0x13')&&typeof _0x36ae92[_0x2b4f('0x14')]===_0x2b4f('0x13');var _0xf13cbf=_0x2e5b83[_0x2b4f('0x15')];var _0x2e537c=_0x2c705f?0x0:_0x36ae92[_0x2b4f('0x12')];var _0x43a530=_0x2c705f?_0x2e5b83[_0x2b4f('0x15')]:_0x36ae92[_0x2b4f('0x12')]+_0x36ae92[_0x2b4f('0x14')];var _0x1aae8b;if(_0x43a530>=_0xf13cbf){_0x43a530=_0xf13cbf;_0x1aae8b=0xc8;}else{_0x1aae8b=0xce;}_0x98711f[_0x2b4f('0x11')](_0x1aae8b);return _0x98711f[_0x2b4f('0x16')](_0x2b4f('0x17'),_0x2e537c+'-'+_0x43a530+'/'+_0xf13cbf)['json'](_0x2e5b83);}return null;};}function saveUpdates(_0x1362fb){return function(_0x10e536){if(_0x10e536){return _0x10e536[_0x2b4f('0x18')](_0x1362fb)[_0x2b4f('0x19')](function(_0x278b47){return _0x278b47;});}return null;};}function removeEntity(_0x20d97b){return function(_0x4edd21){if(_0x4edd21){return _0x4edd21[_0x2b4f('0x1a')]()[_0x2b4f('0x19')](function(){_0x20d97b[_0x2b4f('0x11')](0xcc)[_0x2b4f('0x1b')]();});}};}function handleEntityNotFound(_0xc5fb86){return function(_0x2d62cb){if(!_0x2d62cb){_0xc5fb86[_0x2b4f('0x1c')](0x194);}return _0x2d62cb;};}function handleError(_0x12751e,_0x449137){_0x449137=_0x449137||0x1f4;return function(_0x4ba2f1){logger[_0x2b4f('0x1d')](_0x4ba2f1[_0x2b4f('0x1e')]);if(_0x4ba2f1[_0x2b4f('0x1f')]){delete _0x4ba2f1['name'];}_0x12751e['status'](_0x449137)['send'](_0x4ba2f1);};}exports[_0x2b4f('0x20')]=function(_0x4858c8,_0x21f2a5){var _0x59b3c9={},_0x3ce3ee={},_0x3d5621={'count':0x0,'rows':[]};return db[_0x2b4f('0x21')][_0x2b4f('0x22')]()[_0x2b4f('0x19')](function(_0x2922dd){var _0x428b94=[];for(var _0x497004=0x0;_0x4970040x1){_0x4aaf95['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2b4f('0x5f')](_0x10f248),null);}else{if(qs[_0x2b4f('0x60')](_0x10f248)){_0x4aaf95['or'](_0x2b4f('0x61'),_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x62'),_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x63'),_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x64'),_0x10f248+'%');}else if(qs[_0x2b4f('0x65')](_0x10f248)){_0x4aaf95['or']('c.email\x20LIKE\x20?',_0x10f248+'%');}else{_0x4aaf95['or'](_0x2b4f('0x66'),'%'+_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x67'),'%'+_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x68'),'%'+_0x10f248+'%');}}}}_0x3446b9['where'](_0x4aaf95);_0x3446b9[_0x2b4f('0x69')](_0x2b4f('0x6a'));var _0x244673={'type':db[_0x2b4f('0x6b')][_0x2b4f('0x6c')]['SELECT'],'raw':!![]};var _0x56b26f=_0x3446b9[_0x2b4f('0x6d')]()[_0x2b4f('0x36')](_0x2b4f('0x6a'));if(_0x59b3c9['order']){_0x59b3c9['order'][_0x2b4f('0x57')](function(_0x5f5a90){_0x3446b9[_0x2b4f('0x32')]('c.'+_0x5f5a90[0x0],_0x5f5a90[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2b4f('0x56')](_0x5f16a6)){_0x3446b9[_0x2b4f('0x6e')](_0x2e9dac);_0x56b26f[_0x2b4f('0x34')](_0x2b4f('0x6f'),_0x5f16a6);}BPromise[_0x2b4f('0x70')]()[_0x2b4f('0x19')](function(){if(!_0x59f790)return;if(_0x4858c8['user'][_0x2b4f('0x71')]!==_0x2b4f('0x72'))return;if(!_[_0x2b4f('0x73')](_0x59f790[_0x2b4f('0x44')],['field',_0x2b4f('0x74')])){return _0x4858c8[_0x2b4f('0x75')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x17be21){if(_[_0x2b4f('0x56')](_0x17be21)){_0x56b26f[_0x2b4f('0x34')]('c.ListId\x20IS\x20NULL');_0x3446b9['where'](_0x2b4f('0x76'));}else{_0x56b26f[_0x2b4f('0x34')](_0x2b4f('0x59'),_[_0x2b4f('0x48')](_0x17be21,'id'));_0x3446b9[_0x2b4f('0x34')]('c.ListId\x20IN\x20?',_[_0x2b4f('0x48')](_0x17be21,'id'));}});}})['then'](function(){if(_0x4858c8[_0x2b4f('0x75')][_0x2b4f('0x71')]===_0x2b4f('0x72')&&!_0x59f790&&!_0x4858c8[_0x2b4f('0x2d')][_0x2b4f('0x58')])return[];return db[_0x2b4f('0x77')][_0x2b4f('0x2d')](_0x56b26f[_0x2b4f('0x78')](),_0x244673);})[_0x2b4f('0x19')](function(_0x5743de){_0x3d5621[_0x2b4f('0x15')]=_0x5743de[_0x2b4f('0x24')];if(_0x3d5621[_0x2b4f('0x15')]===0x0)return[];return db[_0x2b4f('0x77')][_0x2b4f('0x2d')](_0x24f1f8['toString'](),_0x244673)[_0x2b4f('0x19')](function(_0xc88381){_0x220a28=_[_0x2b4f('0x79')](_0xc88381,'id');_0x244673=_[_0x2b4f('0x7a')](_0x244673,{'model':db[_0x2b4f('0x21')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4858c8['query'][_0x2b4f('0x2e')]){_0x59b3c9[_0x2b4f('0x2f')][_0x2b4f('0x57')](function(_0x4360cf){_0x3446b9[_0x2b4f('0x36')]('c.'+_0x4360cf);});}else{_0x3446b9['field'](_0x2b4f('0x6a'));_0x3446b9['field']('c.firstName');_0x3446b9[_0x2b4f('0x36')]('c.lastName');_0x3446b9['field'](_0x2b4f('0x7b'));_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x7c'));_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x7d'));_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x7e'));_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x7f'));_0x3446b9['field'](_0x2b4f('0x80'));_0x3446b9['field']('c.deletedAt');_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x81'));_0x3446b9[_0x2b4f('0x36')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2b4f('0x82'));}if(_0x59b3c9['limit'])_0x3446b9[_0x2b4f('0x14')](_0x59b3c9[_0x2b4f('0x14')]);if(_0x59b3c9[_0x2b4f('0x12')])_0x3446b9[_0x2b4f('0x12')](_0x59b3c9[_0x2b4f('0x12')]);return db[_0x2b4f('0x77')][_0x2b4f('0x2d')](_0x3446b9[_0x2b4f('0x78')](),_0x244673);});})[_0x2b4f('0x19')](function(_0x5e4a5b){_0x5e4a5b[_0x2b4f('0x57')](function(_0x3e6e4b){if(_0x3e6e4b[_0x2b4f('0x82')]){_0x3e6e4b[_0x2b4f('0x83')]=[];_0x3e6e4b[_0x2b4f('0x82')]['split'](',')[_0x2b4f('0x57')](function(_0x132b7f){_0x3e6e4b[_0x2b4f('0x83')][_0x2b4f('0x26')](_0x220a28[_0x132b7f]);});}delete _0x3e6e4b['TagIds'];});_0x3d5621[_0x2b4f('0x84')]=_0x5e4a5b;return _0x3d5621;})[_0x2b4f('0x19')](respondWithFilteredResult(_0x21f2a5,_0x59b3c9));})[_0x2b4f('0x85')](handleError(_0x21f2a5,null));};exports[_0x2b4f('0x1a')]=function(_0x388495,_0x5615a2){return db['CmContact'][_0x2b4f('0x45')]({'where':{'id':_0x388495[_0x2b4f('0x86')]['id']}})[_0x2b4f('0x19')](handleEntityNotFound(_0x5615a2,null))[_0x2b4f('0x19')](removeEntity(_0x5615a2,null))[_0x2b4f('0x85')](handleError(_0x5615a2,null));};exports['describe']=function(_0x65c51d,_0xe6bf5b){return db[_0x2b4f('0x21')][_0x2b4f('0x22')]()[_0x2b4f('0x19')](function(_0x3dff73){delete _0x3dff73['tags'];for(var _0x42ed53=0x0;_0x42ed53=_0x44945a){_0x2f3f40=_0x44945a;_0x55b5f6=0xc8;}else{_0x55b5f6=0xce;}_0x4c5a23[_0x6ad2('0x12')](_0x55b5f6);return _0x4c5a23[_0x6ad2('0x18')](_0x6ad2('0x19'),_0x2c460a+'-'+_0x2f3f40+'/'+_0x44945a)[_0x6ad2('0x13')](_0x1f8cca);}return null;};}function saveUpdates(_0x15589a){return function(_0x5fe5f1){if(_0x5fe5f1){return _0x5fe5f1[_0x6ad2('0x1a')](_0x15589a)[_0x6ad2('0x1b')](function(_0x21b3e9){return _0x21b3e9;});}return null;};}function removeEntity(_0x4e60a6){return function(_0x111ccc){if(_0x111ccc){return _0x111ccc[_0x6ad2('0x1c')]()[_0x6ad2('0x1b')](function(){_0x4e60a6[_0x6ad2('0x12')](0xcc)[_0x6ad2('0x1d')]();});}};}function handleEntityNotFound(_0x4dee40){return function(_0x612b7f){if(!_0x612b7f){_0x4dee40['sendStatus'](0x194);}return _0x612b7f;};}function handleError(_0x2880a1,_0xb64b80){_0xb64b80=_0xb64b80||0x1f4;return function(_0x291583){logger[_0x6ad2('0x1e')](_0x291583[_0x6ad2('0x1f')]);if(_0x291583[_0x6ad2('0x20')]){delete _0x291583[_0x6ad2('0x20')];}_0x2880a1['status'](_0xb64b80)[_0x6ad2('0x21')](_0x291583);};}exports[_0x6ad2('0x22')]=function(_0x3f2b78,_0x5c36dc){var _0xa10ead={},_0x579670={},_0x3f385f={'count':0x0,'rows':[]};return db[_0x6ad2('0x23')][_0x6ad2('0x24')]()[_0x6ad2('0x1b')](function(_0x24782c){var _0x32c639=[];for(var _0x3afd3f=0x0;_0x3afd3f0x1){_0x34cf3b['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6ad2('0x5f')](_0x2c66c3),null);}else{if(qs[_0x6ad2('0x60')](_0x2c66c3)){_0x34cf3b['or'](_0x6ad2('0x61'),_0x2c66c3+'%');_0x34cf3b['or']('c.phone\x20LIKE\x20?',_0x2c66c3+'%');_0x34cf3b['or'](_0x6ad2('0x62'),_0x2c66c3+'%');_0x34cf3b['or']('c.fax\x20LIKE\x20?',_0x2c66c3+'%');}else if(qs['isEmail'](_0x2c66c3)){_0x34cf3b['or'](_0x6ad2('0x63'),_0x2c66c3+'%');}else{_0x34cf3b['or'](_0x6ad2('0x64'),'%'+_0x2c66c3+'%');_0x34cf3b['or'](_0x6ad2('0x65'),'%'+_0x2c66c3+'%');_0x34cf3b['or'](_0x6ad2('0x63'),'%'+_0x2c66c3+'%');}}}}_0x17e613[_0x6ad2('0x35')](_0x34cf3b);_0x17e613['group']('c.id');var _0x17fe51={'type':db[_0x6ad2('0x66')]['QueryTypes'][_0x6ad2('0x67')],'raw':!![]};var _0x550865=_0x17e613['clone']()[_0x6ad2('0x37')]('c.id');if(_0xa10ead[_0x6ad2('0x68')]){_0xa10ead[_0x6ad2('0x68')][_0x6ad2('0x4c')](function(_0x430c1f){_0x17e613['order']('c.'+_0x430c1f[0x0],_0x430c1f[0x1]===_0x6ad2('0x69')?![]:!![]);});}if(!_[_0x6ad2('0x6a')](_0x158b3b)){_0x17e613[_0x6ad2('0x6b')](_0x48a60a);_0x550865[_0x6ad2('0x35')](_0x6ad2('0x6c'),_0x158b3b);}BPromise[_0x6ad2('0x6d')]()['then'](function(){if(!_0x194b23)return;if(_0x3f2b78[_0x6ad2('0x6e')][_0x6ad2('0x6f')]!==_0x6ad2('0x70'))return;if(!_[_0x6ad2('0x71')](_0x194b23['conditions'],[_0x6ad2('0x37'),_0x6ad2('0x4e')])){return _0x3f2b78[_0x6ad2('0x6e')][_0x6ad2('0x72')]({'attributes':['id'],'raw':!![]})[_0x6ad2('0x1b')](function(_0x3bb0e3){if(_[_0x6ad2('0x6a')](_0x3bb0e3)){_0x550865[_0x6ad2('0x35')]('c.ListId\x20IS\x20NULL');_0x17e613[_0x6ad2('0x35')](_0x6ad2('0x73'));}else{_0x550865['where']('c.ListId\x20IN\x20?',_[_0x6ad2('0x4b')](_0x3bb0e3,'id'));_0x17e613[_0x6ad2('0x35')](_0x6ad2('0x74'),_[_0x6ad2('0x4b')](_0x3bb0e3,'id'));}});}})[_0x6ad2('0x1b')](function(){if(_0x3f2b78['user'][_0x6ad2('0x6f')]===_0x6ad2('0x70')&&!_0x194b23&&!_0x3f2b78[_0x6ad2('0x2d')][_0x6ad2('0x58')])return[];return db[_0x6ad2('0x75')]['query'](_0x550865[_0x6ad2('0x76')](),_0x17fe51);})[_0x6ad2('0x1b')](function(_0x56eb3b){_0x3f385f[_0x6ad2('0x17')]=_0x56eb3b['length'];if(_0x3f385f[_0x6ad2('0x17')]===0x0)return[];return db[_0x6ad2('0x75')][_0x6ad2('0x2d')](_0x2108f3['toString'](),_0x17fe51)[_0x6ad2('0x1b')](function(_0x10cabc){_0x5ec260=_['keyBy'](_0x10cabc,'id');_0x17fe51=_[_0x6ad2('0x77')](_0x17fe51,{'model':db[_0x6ad2('0x23')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f2b78[_0x6ad2('0x2d')][_0x6ad2('0x32')]){_0xa10ead[_0x6ad2('0x31')][_0x6ad2('0x4c')](function(_0x5e5383){_0x17e613[_0x6ad2('0x37')]('c.'+_0x5e5383);});}else{_0x17e613[_0x6ad2('0x37')](_0x6ad2('0x78'));_0x17e613[_0x6ad2('0x37')](_0x6ad2('0x79'));_0x17e613[_0x6ad2('0x37')](_0x6ad2('0x7a'));_0x17e613[_0x6ad2('0x37')]('c.phone');_0x17e613[_0x6ad2('0x37')](_0x6ad2('0x7b'));_0x17e613['field'](_0x6ad2('0x7c'));_0x17e613[_0x6ad2('0x37')](_0x6ad2('0x7d'));_0x17e613[_0x6ad2('0x37')](_0x6ad2('0x7e'));_0x17e613['field']('c.createdAt');_0x17e613[_0x6ad2('0x37')](_0x6ad2('0x7f'));_0x17e613[_0x6ad2('0x37')](_0x6ad2('0x80'));_0x17e613[_0x6ad2('0x37')](_0x6ad2('0x81'),_0x6ad2('0x82'));}if(_0xa10ead[_0x6ad2('0x15')])_0x17e613['limit'](_0xa10ead['limit']);if(_0xa10ead[_0x6ad2('0x14')])_0x17e613['offset'](_0xa10ead[_0x6ad2('0x14')]);return db['sequelize'][_0x6ad2('0x2d')](_0x17e613[_0x6ad2('0x76')](),_0x17fe51);});})[_0x6ad2('0x1b')](function(_0x1540cb){_0x1540cb[_0x6ad2('0x4c')](function(_0x402e99){if(_0x402e99[_0x6ad2('0x82')]){_0x402e99[_0x6ad2('0x83')]=[];_0x402e99[_0x6ad2('0x82')][_0x6ad2('0x4a')](',')[_0x6ad2('0x4c')](function(_0xa1455){_0x402e99[_0x6ad2('0x83')]['push'](_0x5ec260[_0xa1455]);});}delete _0x402e99[_0x6ad2('0x82')];});_0x3f385f['rows']=_0x1540cb;return _0x3f385f;})[_0x6ad2('0x1b')](respondWithFilteredResult(_0x5c36dc,_0xa10ead));})['catch'](handleError(_0x5c36dc,null));};exports[_0x6ad2('0x1c')]=function(_0x1ad8d2,_0xb636d3){return db[_0x6ad2('0x23')][_0x6ad2('0x47')]({'where':{'id':_0x1ad8d2['params']['id']}})['then'](handleEntityNotFound(_0xb636d3,null))[_0x6ad2('0x1b')](removeEntity(_0xb636d3,null))[_0x6ad2('0x84')](handleError(_0xb636d3,null));};exports['describe']=function(_0x391c2c,_0x2f1f13){return db[_0x6ad2('0x23')][_0x6ad2('0x24')]()[_0x6ad2('0x1b')](function(_0xa8b3ff){delete _0xa8b3ff[_0x6ad2('0x85')];for(var _0x1e0ad6=0x0;_0x1e0ad6{}\s\\|]/g,'-');_0x6254f2(null,util[_0x40c5('0x1f')](_0x40c5('0x20'),path[_0x40c5('0x21')](_0x20ded8['originalname'],path[_0x40c5('0x22')](_0x20ded8[_0x40c5('0x1d')])),Date[_0x40c5('0x23')](),path['extname'](_0x20ded8['originalname'])));}})});router[_0x40c5('0x14')](_0x40c5('0x24'),upload[_0x40c5('0x25')](_0x40c5('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x40c5('0x1b')]({'destination':function(_0x475c10,_0x28a6f5,_0x27ef0d){_0x27ef0d(null,path[_0x40c5('0x1c')](config['root'],_0x40c5('0x27')));},'filename':function(_0x1f421b,_0x33ca76,_0x36a9dc){_0x33ca76[_0x40c5('0x1d')]=_0x33ca76[_0x40c5('0x1d')][_0x40c5('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x36a9dc(null,util['format'](_0x40c5('0x20'),path['basename'](_0x33ca76[_0x40c5('0x1d')],path[_0x40c5('0x22')](_0x33ca76['originalname'])),Date[_0x40c5('0x23')](),path[_0x40c5('0x22')](_0x33ca76[_0x40c5('0x1d')])));}})});router[_0x40c5('0x14')]('/upload',upload[_0x40c5('0x25')](_0x40c5('0x26')),controller[_0x40c5('0x28')]);router[_0x40c5('0x14')](_0x40c5('0x29'),auth[_0x40c5('0xb')](),controller['import']);router[_0x40c5('0x2a')](_0x40c5('0xe'),auth[_0x40c5('0xb')](),controller[_0x40c5('0x2b')]);router[_0x40c5('0x2c')](_0x40c5('0xe'),auth[_0x40c5('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3c77=['diskStorage','root','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','file','uploadCsv','/upload','upload','/upload/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','/create_many','bulkCreate','setTags'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0x3c77,0x1bc));var _0x73c7=function(_0x562f6d,_0x1a82f3){_0x562f6d=_0x562f6d-0x0;var _0x4c486f=_0x3c77[_0x562f6d];return _0x4c486f;};'use strict';var multer=require(_0x73c7('0x0'));var util=require('util');var path=require(_0x73c7('0x1'));var timeout=require(_0x73c7('0x2'));var express=require(_0x73c7('0x3'));var router=express[_0x73c7('0x4')]();var fs_extra=require(_0x73c7('0x5'));var auth=require(_0x73c7('0x6'));var interaction=require(_0x73c7('0x7'));var config=require(_0x73c7('0x8'));var controller=require(_0x73c7('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x73c7('0xa')]);router['get'](_0x73c7('0xb'),auth[_0x73c7('0xc')](),controller[_0x73c7('0xd')]);router[_0x73c7('0xe')](_0x73c7('0xf'),auth['isAuthenticated'](),controller[_0x73c7('0x10')]);router[_0x73c7('0xe')](_0x73c7('0x11'),auth['isAuthenticated'](),controller[_0x73c7('0x12')]);router[_0x73c7('0xe')](_0x73c7('0x13'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x14')]);router[_0x73c7('0xe')](_0x73c7('0x15'),auth[_0x73c7('0xc')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0x73c7('0xc')](),controller[_0x73c7('0x16')]);router[_0x73c7('0xe')](_0x73c7('0x17'),auth['isAuthenticated'](),controller[_0x73c7('0x18')]);router['get'](_0x73c7('0x19'),auth['isAuthenticated'](),controller[_0x73c7('0x1a')]);router[_0x73c7('0x1b')](_0x73c7('0x1c'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x1d')]);router[_0x73c7('0x1b')]('/',auth[_0x73c7('0xc')](),controller['create']);router[_0x73c7('0x1b')](_0x73c7('0x1e'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x1f')]);router[_0x73c7('0x1b')]('/:id/tags',auth[_0x73c7('0xc')](),controller[_0x73c7('0x20')]);var upload=multer({'storage':multer[_0x73c7('0x21')]({'destination':function(_0x2d3dee,_0x4f3e2a,_0xb6a7a9){_0xb6a7a9(null,path['join'](config[_0x73c7('0x22')],'server/files/tmp'));},'filename':function(_0x1e456d,_0x5a724c,_0x441e94){_0x5a724c['originalname']=_0x5a724c[_0x73c7('0x23')][_0x73c7('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x441e94(null,util[_0x73c7('0x25')](_0x73c7('0x26'),path[_0x73c7('0x27')](_0x5a724c[_0x73c7('0x23')],path[_0x73c7('0x28')](_0x5a724c[_0x73c7('0x23')])),Date[_0x73c7('0x29')](),path[_0x73c7('0x28')](_0x5a724c[_0x73c7('0x23')])));}})});router['post'](_0x73c7('0x2a'),upload['single'](_0x73c7('0x2b')),controller[_0x73c7('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x397d7a,_0x40a61b,_0x3eaf14){_0x3eaf14(null,path['join'](config[_0x73c7('0x22')],'server/files/tmp'));},'filename':function(_0x4d0061,_0x5f3ac6,_0x453f0f){_0x5f3ac6[_0x73c7('0x23')]=_0x5f3ac6['originalname'][_0x73c7('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x453f0f(null,util[_0x73c7('0x25')](_0x73c7('0x26'),path[_0x73c7('0x27')](_0x5f3ac6[_0x73c7('0x23')],path[_0x73c7('0x28')](_0x5f3ac6[_0x73c7('0x23')])),Date[_0x73c7('0x29')](),path[_0x73c7('0x28')](_0x5f3ac6[_0x73c7('0x23')])));}})});router[_0x73c7('0x1b')](_0x73c7('0x2d'),upload['single'](_0x73c7('0x2b')),controller[_0x73c7('0x2e')]);router[_0x73c7('0x1b')](_0x73c7('0x2f'),auth[_0x73c7('0xc')](),controller['import']);router[_0x73c7('0x30')](_0x73c7('0xf'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x31')]);router[_0x73c7('0x32')](_0x73c7('0xf'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x33')]);module[_0x73c7('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index d2558f7..c177c2b 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 _0xcb63=['parse','stringify','values','BOOLEAN','sequelize','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','TEXT','type'];(function(_0x2a85df,_0x21230a){var _0x428275=function(_0x90c986){while(--_0x90c986){_0x2a85df['push'](_0x2a85df['shift']());}};_0x428275(++_0x21230a);}(_0xcb63,0x115));var _0x3cb6=function(_0x744ce5,_0x32c683){_0x744ce5=_0x744ce5-0x0;var _0x4ca6f8=_0xcb63[_0x744ce5];return _0x4ca6f8;};'use strict';var Sequelize=require(_0x3cb6('0x0'));var _=require('lodash');module[_0x3cb6('0x1')]={'name':{'type':Sequelize[_0x3cb6('0x2')],'get':function(_0x45acdb){return this[_0x3cb6('0x3')]('alias');}},'alias':{'type':Sequelize[_0x3cb6('0x4')],'allowNull':![],'set':function(_0x257f2b){this[_0x3cb6('0x5')](_0x3cb6('0x6'),_0x257f2b?_0x257f2b:this[_0x3cb6('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x3cb6('0x7')]('long'),'get':function(){if(this[_0x3cb6('0x3')](_0x3cb6('0x8'))==='select'){return JSON[_0x3cb6('0x9')](this[_0x3cb6('0x3')]('values'));}else{return this[_0x3cb6('0x3')]('values');}},'set':function(_0x56e725){if(Array['isArray'](_0x56e725)){this['setDataValue']('values',JSON[_0x3cb6('0xa')](_0x56e725));}else{this[_0x3cb6('0x5')](_0x3cb6('0xb'),_0x56e725);}}},'required':{'type':Sequelize[_0x3cb6('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3cb6('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x0188=['stringify','BOOLEAN','ENUM','voice','lodash','VIRTUAL','getDataValue','STRING','setDataValue','alias','TEXT','long','select','parse','values'];(function(_0x363540,_0x2536c5){var _0x3ec8ba=function(_0x18c498){while(--_0x18c498){_0x363540['push'](_0x363540['shift']());}};_0x3ec8ba(++_0x2536c5);}(_0x0188,0x1b7));var _0x8018=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0x0188[_0x102977];return _0x15c466;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8018('0x0'));module['exports']={'name':{'type':Sequelize[_0x8018('0x1')],'get':function(_0x553973){return this[_0x8018('0x2')]('alias');}},'alias':{'type':Sequelize[_0x8018('0x3')],'allowNull':![],'set':function(_0x1d9006){this[_0x8018('0x4')](_0x8018('0x5'),_0x1d9006?_0x1d9006:this[_0x8018('0x2')]('name'));}},'type':{'type':Sequelize[_0x8018('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x8018('0x6')](_0x8018('0x7')),'get':function(){if(this['getDataValue']('type')===_0x8018('0x8')){return JSON[_0x8018('0x9')](this[_0x8018('0x2')](_0x8018('0xa')));}else{return this[_0x8018('0x2')](_0x8018('0xa'));}},'set':function(_0x3c9b50){if(Array['isArray'](_0x3c9b50)){this[_0x8018('0x4')](_0x8018('0xa'),JSON[_0x8018('0xb')](_0x3c9b50));}else{this[_0x8018('0x4')](_0x8018('0xa'),_0x3c9b50);}}},'required':{'type':Sequelize[_0x8018('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8018('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8018('0xd')](_0x8018('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4e94ed6..4495f54 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 _0xe1e5=['find','body','sequelize','create','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','limit','offset','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include'];(function(_0x13f6bb,_0x1d625f){var _0x413673=function(_0x6dacf6){while(--_0x6dacf6){_0x13f6bb['push'](_0x13f6bb['shift']());}};_0x413673(++_0x1d625f);}(_0xe1e5,0x16f));var _0x5e1e=function(_0x4ce15c,_0x1bbcbd){_0x4ce15c=_0x4ce15c-0x0;var _0x5ee259=_0xe1e5[_0x4ce15c];return _0x5ee259;};'use strict';var emlformat=require(_0x5e1e('0x0'));var rimraf=require(_0x5e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e1e('0x2'));var rp=require('request-promise');var moment=require(_0x5e1e('0x3'));var BPromise=require(_0x5e1e('0x4'));var Mustache=require(_0x5e1e('0x5'));var util=require(_0x5e1e('0x6'));var path=require(_0x5e1e('0x7'));var sox=require(_0x5e1e('0x8'));var csv=require(_0x5e1e('0x9'));var ejs=require(_0x5e1e('0xa'));var fs=require('fs');var fs_extra=require(_0x5e1e('0xb'));var _=require(_0x5e1e('0xc'));var squel=require(_0x5e1e('0xd'));var crypto=require(_0x5e1e('0xe'));var jsforce=require(_0x5e1e('0xf'));var deskjs=require(_0x5e1e('0x10'));var toCsv=require(_0x5e1e('0x9'));var querystring=require(_0x5e1e('0x11'));var Papa=require(_0x5e1e('0x12'));var Redis=require('ioredis');var authService=require(_0x5e1e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5e1e('0x14'));var hardwareService=require(_0x5e1e('0x15'));var logger=require(_0x5e1e('0x16'))(_0x5e1e('0x17'));var utils=require(_0x5e1e('0x18'));var config=require(_0x5e1e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cf565,_0x42f996){_0x42f996=_0x42f996||0xcc;return function(_0x1f97d3){if(_0x1f97d3){return _0x1cf565['sendStatus'](_0x42f996);}return _0x1cf565[_0x5e1e('0x1a')](_0x42f996)[_0x5e1e('0x1b')]();};}function respondWithResult(_0x5c7ad8,_0x457693){_0x457693=_0x457693||0xc8;return function(_0x6976a1){if(_0x6976a1){return _0x5c7ad8[_0x5e1e('0x1a')](_0x457693)[_0x5e1e('0x1c')](_0x6976a1);}};}function respondWithFilteredResult(_0x7b7539,_0x4f2478){return function(_0x3277e9){if(_0x3277e9){var _0x4062ff=typeof _0x4f2478['offset']===_0x5e1e('0x1d')&&typeof _0x4f2478[_0x5e1e('0x1e')]===_0x5e1e('0x1d');var _0x207f1c=_0x3277e9['count'];var _0x9e596=_0x4062ff?0x0:_0x4f2478[_0x5e1e('0x1f')];var _0x4502ab=_0x4062ff?_0x3277e9['count']:_0x4f2478[_0x5e1e('0x1f')]+_0x4f2478[_0x5e1e('0x1e')];var _0x453256;if(_0x4502ab>=_0x207f1c){_0x4502ab=_0x207f1c;_0x453256=0xc8;}else{_0x453256=0xce;}_0x7b7539[_0x5e1e('0x1a')](_0x453256);return _0x7b7539['set']('Content-Range',_0x9e596+'-'+_0x4502ab+'/'+_0x207f1c)['json'](_0x3277e9);}return null;};}function patchUpdates(_0x17bd06){return function(_0x1fa80f){try{jsonpatch[_0x5e1e('0x20')](_0x1fa80f,_0x17bd06,!![]);}catch(_0x176cbd){return BPromise[_0x5e1e('0x21')](_0x176cbd);}return _0x1fa80f[_0x5e1e('0x22')]();};}function saveUpdates(_0x423c19,_0xffc52b){return function(_0x2def90){if(_0x2def90){return _0x2def90[_0x5e1e('0x23')](_0x423c19)[_0x5e1e('0x24')](function(_0x4bbe13){return _0x4bbe13;});}return null;};}function removeEntity(_0x5cdc07,_0x1b330d){return function(_0x1d49c1){if(_0x1d49c1){return _0x1d49c1[_0x5e1e('0x25')]()[_0x5e1e('0x24')](function(){_0x5cdc07[_0x5e1e('0x1a')](0xcc)[_0x5e1e('0x1b')]();});}};}function handleEntityNotFound(_0x404b84,_0x5b44f3){return function(_0x2d7f6d){if(!_0x2d7f6d){_0x404b84[_0x5e1e('0x26')](0x194);}return _0x2d7f6d;};}function handleError(_0x410d9c,_0x5cc69b){_0x5cc69b=_0x5cc69b||0x1f4;return function(_0x37d186){logger[_0x5e1e('0x27')](_0x37d186[_0x5e1e('0x28')]);if(_0x37d186[_0x5e1e('0x29')]){delete _0x37d186[_0x5e1e('0x29')];}_0x410d9c[_0x5e1e('0x1a')](_0x5cc69b)[_0x5e1e('0x2a')](_0x37d186);};}exports[_0x5e1e('0x2b')]=function(_0x45a96a,_0x5ee658){var _0xc6dd66={},_0x25259e={},_0x1ce4c9={'count':0x0,'rows':[]};var _0x42c960=_[_0x5e1e('0x2c')](db[_0x5e1e('0x2d')][_0x5e1e('0x2e')],function(_0x55d133){return{'name':_0x55d133['fieldName'],'type':_0x55d133[_0x5e1e('0x2f')]['key']};});_0x25259e['model']=_['differenceBy'](_[_0x5e1e('0x2c')](_0x42c960,_0x5e1e('0x29')),[_0x5e1e('0x29')]);_0x25259e[_0x5e1e('0x30')]=_[_0x5e1e('0x31')](_0x45a96a['query']);_0x25259e[_0x5e1e('0x32')]=_[_0x5e1e('0x33')](_0x25259e[_0x5e1e('0x34')],_0x25259e[_0x5e1e('0x30')]);_0xc6dd66[_0x5e1e('0x35')]=_[_0x5e1e('0x33')](_0x25259e[_0x5e1e('0x34')],qs[_0x5e1e('0x36')](_0x45a96a['query']['fields']));_0xc6dd66[_0x5e1e('0x35')]=_0xc6dd66['attributes'][_0x5e1e('0x37')]?_0xc6dd66[_0x5e1e('0x35')]:_0x25259e[_0x5e1e('0x34')];if(!_0x45a96a[_0x5e1e('0x30')]['hasOwnProperty'](_0x5e1e('0x38'))){_0xc6dd66['limit']=qs[_0x5e1e('0x1e')](_0x45a96a['query'][_0x5e1e('0x1e')]);_0xc6dd66[_0x5e1e('0x1f')]=qs['offset'](_0x45a96a[_0x5e1e('0x30')][_0x5e1e('0x1f')]);}_0xc6dd66[_0x5e1e('0x39')]=qs[_0x5e1e('0x3a')](_0x45a96a['query'][_0x5e1e('0x3a')]);_0xc6dd66[_0x5e1e('0x3b')]=qs[_0x5e1e('0x32')](_[_0x5e1e('0x3c')](_0x45a96a[_0x5e1e('0x30')],_0x25259e[_0x5e1e('0x32')]),_0x42c960);if(_0x45a96a[_0x5e1e('0x30')][_0x5e1e('0x3d')]){_0xc6dd66['where']=_[_0x5e1e('0x3e')](_0xc6dd66[_0x5e1e('0x3b')],{'$or':_[_0x5e1e('0x2c')](_0x42c960,function(_0x15554d){if(_0x15554d[_0x5e1e('0x2f')]!==_0x5e1e('0x3f')){var _0x484db3={};_0x484db3[_0x15554d[_0x5e1e('0x29')]]={'$like':'%'+_0x45a96a[_0x5e1e('0x30')][_0x5e1e('0x3d')]+'%'};return _0x484db3;}})});}_0xc6dd66=_[_0x5e1e('0x3e')]({},_0xc6dd66,_0x45a96a[_0x5e1e('0x40')]);var _0xfa8b63={'where':_0xc6dd66[_0x5e1e('0x3b')]};return db['CmCustomField'][_0x5e1e('0x41')](_0xfa8b63)['then'](function(_0x33ec30){_0x1ce4c9['count']=_0x33ec30;if(_0x45a96a[_0x5e1e('0x30')][_0x5e1e('0x42')]){_0xc6dd66['include']=[{'all':!![]}];}return db[_0x5e1e('0x2d')][_0x5e1e('0x43')](_0xc6dd66);})[_0x5e1e('0x24')](function(_0x16860d){_0x1ce4c9[_0x5e1e('0x44')]=_0x16860d;return _0x1ce4c9;})[_0x5e1e('0x24')](respondWithFilteredResult(_0x5ee658,_0xc6dd66))[_0x5e1e('0x45')](handleError(_0x5ee658,null));};exports[_0x5e1e('0x46')]=function(_0x10e2c8,_0x107285){var _0x15d453={'raw':!![],'where':{'id':_0x10e2c8[_0x5e1e('0x47')]['id']}},_0x400084={};_0x400084[_0x5e1e('0x34')]=_[_0x5e1e('0x31')](db[_0x5e1e('0x2d')]['rawAttributes']);_0x400084[_0x5e1e('0x30')]=_['keys'](_0x10e2c8[_0x5e1e('0x30')]);_0x400084[_0x5e1e('0x32')]=_[_0x5e1e('0x33')](_0x400084['model'],_0x400084[_0x5e1e('0x30')]);_0x15d453['attributes']=_[_0x5e1e('0x33')](_0x400084[_0x5e1e('0x34')],qs[_0x5e1e('0x36')](_0x10e2c8['query'][_0x5e1e('0x36')]));_0x15d453['attributes']=_0x15d453[_0x5e1e('0x35')]['length']?_0x15d453[_0x5e1e('0x35')]:_0x400084['model'];if(_0x10e2c8['query'][_0x5e1e('0x42')]){_0x15d453[_0x5e1e('0x48')]=[{'all':!![]}];}_0x15d453=_[_0x5e1e('0x3e')]({},_0x15d453,_0x10e2c8[_0x5e1e('0x40')]);return db[_0x5e1e('0x2d')][_0x5e1e('0x49')](_0x15d453)[_0x5e1e('0x24')](handleEntityNotFound(_0x107285,null))['then'](respondWithResult(_0x107285,null))[_0x5e1e('0x45')](handleError(_0x107285,null));};exports['update']=function(_0x478750,_0x250b54){if(_0x478750[_0x5e1e('0x4a')]['id']){delete _0x478750[_0x5e1e('0x4a')]['id'];}return db['CmCustomField'][_0x5e1e('0x49')]({'where':{'id':_0x478750[_0x5e1e('0x47')]['id']}})['then'](handleEntityNotFound(_0x250b54,null))[_0x5e1e('0x24')](saveUpdates(_0x478750[_0x5e1e('0x4a')],null))[_0x5e1e('0x24')](respondWithResult(_0x250b54,null))[_0x5e1e('0x45')](handleError(_0x250b54,null));};exports['destroy']=function(_0x335901,_0x3df82f){return db[_0x5e1e('0x2d')][_0x5e1e('0x49')]({'where':{'id':_0x335901[_0x5e1e('0x47')]['id']}})[_0x5e1e('0x24')](handleEntityNotFound(_0x3df82f,null))[_0x5e1e('0x24')](removeEntity(_0x3df82f,null))[_0x5e1e('0x45')](handleError(_0x3df82f,null));};exports['create']=function(_0x1dff92,_0x4f515e){var _0x3f40ad;return db[_0x5e1e('0x4b')]['transaction'](function(_0x33914b){return db[_0x5e1e('0x2d')][_0x5e1e('0x4c')](_0x1dff92[_0x5e1e('0x4a')],{'transaction':_0x33914b})['then'](function(_0x5b067d){_0x3f40ad=_0x5b067d;var _0x3c6e18={'type':db[_0x5e1e('0x4d')][_0x5e1e('0x4e')],'transaction':_0x33914b};switch(_0x1dff92[_0x5e1e('0x4a')]['type']){case _0x5e1e('0x4f'):_0x3c6e18[_0x5e1e('0x2f')]=db[_0x5e1e('0x4d')][_0x5e1e('0x4e')];break;case'number':_0x3c6e18[_0x5e1e('0x2f')]=db[_0x5e1e('0x4d')][_0x5e1e('0x50')];break;case _0x5e1e('0x51'):_0x3c6e18[_0x5e1e('0x2f')]=db[_0x5e1e('0x4d')][_0x5e1e('0x52')];_0x3c6e18[_0x5e1e('0x53')]=![];break;default:}return db[_0x5e1e('0x4b')][_0x5e1e('0x54')][_0x5e1e('0x55')]('cm_contacts',util[_0x5e1e('0x56')](_0x5e1e('0x57'),_0x3f40ad['id']),_0x3c6e18);})['then'](function(){return _0x3f40ad;});})[_0x5e1e('0x24')](respondWithResult(_0x4f515e,0xc9))['catch'](handleError(_0x4f515e,null));}; \ No newline at end of file +var _0x87b8=['options','include','findAll','rows','catch','params','length','includeAll','merge','find','body','destroy','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','CmCustomField','rawAttributes','fieldName','type','differenceBy','map','keys','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL'];(function(_0xb537b2,_0x4e5958){var _0x12608c=function(_0x1bc426){while(--_0x1bc426){_0xb537b2['push'](_0xb537b2['shift']());}};_0x12608c(++_0x4e5958);}(_0x87b8,0xc3));var _0x887b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x87b8[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x887b('0x0'));var rimraf=require(_0x887b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x887b('0x2'));var rp=require(_0x887b('0x3'));var moment=require('moment');var BPromise=require(_0x887b('0x4'));var Mustache=require(_0x887b('0x5'));var util=require(_0x887b('0x6'));var path=require('path');var sox=require(_0x887b('0x7'));var csv=require(_0x887b('0x8'));var ejs=require(_0x887b('0x9'));var fs=require('fs');var fs_extra=require(_0x887b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x887b('0xb'));var toCsv=require(_0x887b('0x8'));var querystring=require(_0x887b('0xc'));var Papa=require(_0x887b('0xd'));var Redis=require(_0x887b('0xe'));var authService=require(_0x887b('0xf'));var qs=require(_0x887b('0x10'));var as=require(_0x887b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x887b('0x12'))(_0x887b('0x13'));var utils=require(_0x887b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x887b('0x15'));var db=require(_0x887b('0x16'))['db'];function respondWithStatusCode(_0x51a0cf,_0x2bb868){_0x2bb868=_0x2bb868||0xcc;return function(_0x5e527f){if(_0x5e527f){return _0x51a0cf['sendStatus'](_0x2bb868);}return _0x51a0cf[_0x887b('0x17')](_0x2bb868)[_0x887b('0x18')]();};}function respondWithResult(_0x134e31,_0x2abe30){_0x2abe30=_0x2abe30||0xc8;return function(_0xf874e){if(_0xf874e){return _0x134e31[_0x887b('0x17')](_0x2abe30)['json'](_0xf874e);}};}function respondWithFilteredResult(_0x261b48,_0x473d47){return function(_0x187fc8){if(_0x187fc8){var _0x38bb1f=typeof _0x473d47[_0x887b('0x19')]===_0x887b('0x1a')&&typeof _0x473d47[_0x887b('0x1b')]===_0x887b('0x1a');var _0x311c6a=_0x187fc8[_0x887b('0x1c')];var _0x26d9b7=_0x38bb1f?0x0:_0x473d47[_0x887b('0x19')];var _0x1152a4=_0x38bb1f?_0x187fc8[_0x887b('0x1c')]:_0x473d47[_0x887b('0x19')]+_0x473d47[_0x887b('0x1b')];var _0x2a330d;if(_0x1152a4>=_0x311c6a){_0x1152a4=_0x311c6a;_0x2a330d=0xc8;}else{_0x2a330d=0xce;}_0x261b48[_0x887b('0x17')](_0x2a330d);return _0x261b48[_0x887b('0x1d')](_0x887b('0x1e'),_0x26d9b7+'-'+_0x1152a4+'/'+_0x311c6a)[_0x887b('0x1f')](_0x187fc8);}return null;};}function patchUpdates(_0x12fba2){return function(_0x3504f6){try{jsonpatch[_0x887b('0x20')](_0x3504f6,_0x12fba2,!![]);}catch(_0x1367fb){return BPromise[_0x887b('0x21')](_0x1367fb);}return _0x3504f6[_0x887b('0x22')]();};}function saveUpdates(_0x4ee4ca,_0x4d489c){return function(_0x5229af){if(_0x5229af){return _0x5229af[_0x887b('0x23')](_0x4ee4ca)[_0x887b('0x24')](function(_0x169f7f){return _0x169f7f;});}return null;};}function removeEntity(_0x922eea,_0x3100ba){return function(_0x2593d1){if(_0x2593d1){return _0x2593d1['destroy']()[_0x887b('0x24')](function(){_0x922eea['status'](0xcc)[_0x887b('0x18')]();});}};}function handleEntityNotFound(_0x59eb03,_0xa0e5cf){return function(_0x8823b4){if(!_0x8823b4){_0x59eb03[_0x887b('0x25')](0x194);}return _0x8823b4;};}function handleError(_0x57b61f,_0x3aed97){_0x3aed97=_0x3aed97||0x1f4;return function(_0x5b5ce1){logger[_0x887b('0x26')](_0x5b5ce1['stack']);if(_0x5b5ce1[_0x887b('0x27')]){delete _0x5b5ce1['name'];}_0x57b61f['status'](_0x3aed97)[_0x887b('0x28')](_0x5b5ce1);};}exports['index']=function(_0x188880,_0x2e18c6){var _0x2c2460={},_0x32e68a={},_0x26ef31={'count':0x0,'rows':[]};var _0x45e5f3=_['map'](db[_0x887b('0x29')][_0x887b('0x2a')],function(_0x168004){return{'name':_0x168004[_0x887b('0x2b')],'type':_0x168004[_0x887b('0x2c')]['key']};});_0x32e68a['model']=_[_0x887b('0x2d')](_[_0x887b('0x2e')](_0x45e5f3,_0x887b('0x27')),[_0x887b('0x27')]);_0x32e68a['query']=_[_0x887b('0x2f')](_0x188880['query']);_0x32e68a['filters']=_[_0x887b('0x30')](_0x32e68a[_0x887b('0x31')],_0x32e68a['query']);_0x2c2460[_0x887b('0x32')]=_['intersection'](_0x32e68a[_0x887b('0x31')],qs[_0x887b('0x33')](_0x188880[_0x887b('0x34')]['fields']));_0x2c2460[_0x887b('0x32')]=_0x2c2460['attributes']['length']?_0x2c2460[_0x887b('0x32')]:_0x32e68a[_0x887b('0x31')];if(!_0x188880[_0x887b('0x34')][_0x887b('0x35')](_0x887b('0x36'))){_0x2c2460[_0x887b('0x1b')]=qs[_0x887b('0x1b')](_0x188880['query']['limit']);_0x2c2460[_0x887b('0x19')]=qs[_0x887b('0x19')](_0x188880[_0x887b('0x34')]['offset']);}_0x2c2460['order']=qs[_0x887b('0x37')](_0x188880['query'][_0x887b('0x37')]);_0x2c2460[_0x887b('0x38')]=qs['filters'](_['pick'](_0x188880[_0x887b('0x34')],_0x32e68a[_0x887b('0x39')]),_0x45e5f3);if(_0x188880[_0x887b('0x34')][_0x887b('0x3a')]){_0x2c2460[_0x887b('0x38')]=_['merge'](_0x2c2460[_0x887b('0x38')],{'$or':_['map'](_0x45e5f3,function(_0xc0394b){if(_0xc0394b[_0x887b('0x2c')]!==_0x887b('0x3b')){var _0x455e70={};_0x455e70[_0xc0394b[_0x887b('0x27')]]={'$like':'%'+_0x188880['query']['filter']+'%'};return _0x455e70;}})});}_0x2c2460=_['merge']({},_0x2c2460,_0x188880[_0x887b('0x3c')]);var _0x37fa33={'where':_0x2c2460[_0x887b('0x38')]};return db['CmCustomField'][_0x887b('0x1c')](_0x37fa33)['then'](function(_0x22e7c2){_0x26ef31[_0x887b('0x1c')]=_0x22e7c2;if(_0x188880[_0x887b('0x34')]['includeAll']){_0x2c2460[_0x887b('0x3d')]=[{'all':!![]}];}return db[_0x887b('0x29')][_0x887b('0x3e')](_0x2c2460);})[_0x887b('0x24')](function(_0x453228){_0x26ef31[_0x887b('0x3f')]=_0x453228;return _0x26ef31;})['then'](respondWithFilteredResult(_0x2e18c6,_0x2c2460))[_0x887b('0x40')](handleError(_0x2e18c6,null));};exports['show']=function(_0x1e74e7,_0x1ae3bb){var _0x56d22a={'raw':!![],'where':{'id':_0x1e74e7[_0x887b('0x41')]['id']}},_0x4b61a8={};_0x4b61a8['model']=_['keys'](db[_0x887b('0x29')][_0x887b('0x2a')]);_0x4b61a8[_0x887b('0x34')]=_[_0x887b('0x2f')](_0x1e74e7['query']);_0x4b61a8[_0x887b('0x39')]=_[_0x887b('0x30')](_0x4b61a8[_0x887b('0x31')],_0x4b61a8['query']);_0x56d22a[_0x887b('0x32')]=_[_0x887b('0x30')](_0x4b61a8[_0x887b('0x31')],qs['fields'](_0x1e74e7[_0x887b('0x34')][_0x887b('0x33')]));_0x56d22a[_0x887b('0x32')]=_0x56d22a[_0x887b('0x32')][_0x887b('0x42')]?_0x56d22a['attributes']:_0x4b61a8['model'];if(_0x1e74e7['query'][_0x887b('0x43')]){_0x56d22a[_0x887b('0x3d')]=[{'all':!![]}];}_0x56d22a=_[_0x887b('0x44')]({},_0x56d22a,_0x1e74e7['options']);return db[_0x887b('0x29')][_0x887b('0x45')](_0x56d22a)[_0x887b('0x24')](handleEntityNotFound(_0x1ae3bb,null))[_0x887b('0x24')](respondWithResult(_0x1ae3bb,null))[_0x887b('0x40')](handleError(_0x1ae3bb,null));};exports[_0x887b('0x23')]=function(_0x2586d7,_0x93c659){if(_0x2586d7[_0x887b('0x46')]['id']){delete _0x2586d7[_0x887b('0x46')]['id'];}return db[_0x887b('0x29')]['find']({'where':{'id':_0x2586d7['params']['id']}})[_0x887b('0x24')](handleEntityNotFound(_0x93c659,null))[_0x887b('0x24')](saveUpdates(_0x2586d7['body'],null))[_0x887b('0x24')](respondWithResult(_0x93c659,null))[_0x887b('0x40')](handleError(_0x93c659,null));};exports[_0x887b('0x47')]=function(_0x1d9b44,_0x53cec9){return db[_0x887b('0x29')][_0x887b('0x45')]({'where':{'id':_0x1d9b44[_0x887b('0x41')]['id']}})[_0x887b('0x24')](handleEntityNotFound(_0x53cec9,null))[_0x887b('0x24')](removeEntity(_0x53cec9,null))[_0x887b('0x40')](handleError(_0x53cec9,null));};exports[_0x887b('0x48')]=function(_0x58f6a6,_0x59b3bb){var _0x4b3d4a;return db[_0x887b('0x49')][_0x887b('0x4a')](function(_0xfa8ff9){return db[_0x887b('0x29')][_0x887b('0x48')](_0x58f6a6[_0x887b('0x46')],{'transaction':_0xfa8ff9})[_0x887b('0x24')](function(_0x26fef8){_0x4b3d4a=_0x26fef8;var _0xe0c58d={'type':db[_0x887b('0x4b')]['TEXT'],'transaction':_0xfa8ff9};switch(_0x58f6a6['body'][_0x887b('0x2c')]){case _0x887b('0x4c'):_0xe0c58d[_0x887b('0x2c')]=db[_0x887b('0x4b')][_0x887b('0x4d')];break;case _0x887b('0x4e'):_0xe0c58d[_0x887b('0x2c')]=db[_0x887b('0x4b')][_0x887b('0x4f')];break;case _0x887b('0x50'):_0xe0c58d[_0x887b('0x2c')]=db[_0x887b('0x4b')]['BOOLEAN'];_0xe0c58d['defaultValue']=![];break;default:}return db[_0x887b('0x49')][_0x887b('0x51')]['addColumn'](_0x887b('0x52'),util[_0x887b('0x53')](_0x887b('0x54'),_0x4b3d4a['id']),_0xe0c58d);})[_0x887b('0x24')](function(){return _0x4b3d4a;});})[_0x887b('0x24')](respondWithResult(_0x59b3bb,0xc9))['catch'](handleError(_0x59b3bb,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 098e0bc..64ef2d4 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 _0x7a5e=['./cmCustomField.attributes','exports','cm_custom_fields','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4ebe54,_0xb8f8d0){var _0x164a0f=function(_0x10e064){while(--_0x10e064){_0x4ebe54['push'](_0x4ebe54['shift']());}};_0x164a0f(++_0xb8f8d0);}(_0x7a5e,0x12f));var _0xe7a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7a5('0x0'));var util=require(_0xe7a5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe7a5('0x2'));var BPromise=require(_0xe7a5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7a5('0x4'));var rimraf=require(_0xe7a5('0x5'));var config=require(_0xe7a5('0x6'));var attributes=require(_0xe7a5('0x7'));module[_0xe7a5('0x8')]=function(_0x217294,_0x2d46ca){return _0x217294['define']('CmCustomField',attributes,{'tableName':_0xe7a5('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa372=['cm_custom_fields','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x83d48e,_0x507328){var _0x26f1d1=function(_0x252172){while(--_0x252172){_0x83d48e['push'](_0x83d48e['shift']());}};_0x26f1d1(++_0x507328);}(_0xa372,0x105));var _0x2a37=function(_0x2a371a,_0x2f5ad0){_0x2a371a=_0x2a371a-0x0;var _0x40ef68=_0xa372[_0x2a371a];return _0x40ef68;};'use strict';var _=require('lodash');var util=require(_0x2a37('0x0'));var logger=require('../../config/logger')(_0x2a37('0x1'));var moment=require(_0x2a37('0x2'));var BPromise=require(_0x2a37('0x3'));var rp=require(_0x2a37('0x4'));var fs=require('fs');var path=require(_0x2a37('0x5'));var rimraf=require(_0x2a37('0x6'));var config=require(_0x2a37('0x7'));var attributes=require(_0x2a37('0x8'));module[_0x2a37('0x9')]=function(_0x2ddedf,_0x4a2c48){return _0x2ddedf[_0x2a37('0xa')](_0x2a37('0xb'),attributes,{'tableName':_0x2a37('0xc'),'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 54ee38d..62fc7ec 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 _0xa66f=['request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http'];(function(_0x9664b9,_0x51d10e){var _0x420c36=function(_0x131a18){while(--_0x131a18){_0x9664b9['push'](_0x9664b9['shift']());}};_0x420c36(++_0x51d10e);}(_0xa66f,0xde));var _0xfa66=function(_0x5eab85,_0xb5fed3){_0x5eab85=_0x5eab85-0x0;var _0x3f9bdd=_0xa66f[_0x5eab85];return _0x3f9bdd;};'use strict';var _=require('lodash');var util=require(_0xfa66('0x0'));var moment=require(_0xfa66('0x1'));var BPromise=require('bluebird');var rs=require(_0xfa66('0x2'));var fs=require('fs');var Redis=require(_0xfa66('0x3'));var db=require(_0xfa66('0x4'))['db'];var utils=require(_0xfa66('0x5'));var logger=require('../../config/logger')(_0xfa66('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa66('0x7'));var client=jayson['client'][_0xfa66('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ba9b3,_0x4ae66a,_0x53a514){return new BPromise(function(_0x339a52,_0x558ae7){return client[_0xfa66('0x9')](_0x3ba9b3,_0x53a514)[_0xfa66('0xa')](function(_0x280126){logger[_0xfa66('0xb')](_0xfa66('0xc'),_0x4ae66a,_0xfa66('0xd'));logger[_0xfa66('0xe')](_0xfa66('0xf'),_0x4ae66a,_0xfa66('0xd'),JSON[_0xfa66('0x10')](_0x280126));if(_0x280126['error']){if(_0x280126[_0xfa66('0x11')][_0xfa66('0x12')]===0x1f4){logger[_0xfa66('0x11')](_0xfa66('0xc'),_0x4ae66a,_0x280126['error'][_0xfa66('0x13')]);return _0x558ae7(_0x280126['error'][_0xfa66('0x13')]);}logger[_0xfa66('0x11')](_0xfa66('0xc'),_0x4ae66a,_0x280126[_0xfa66('0x11')][_0xfa66('0x13')]);return _0x339a52(_0x280126[_0xfa66('0x11')][_0xfa66('0x13')]);}else{logger[_0xfa66('0xb')]('CmCustomField,\x20%s,\x20%s',_0x4ae66a,_0xfa66('0xd'));_0x339a52(_0x280126[_0xfa66('0x14')][_0xfa66('0x13')]);}})['catch'](function(_0x406c50){logger[_0xfa66('0x11')](_0xfa66('0xc'),_0x4ae66a,_0x406c50);_0x558ae7(_0x406c50);});});} \ No newline at end of file +var _0xcbf6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','randomstring'];(function(_0x4168a7,_0x5433ff){var _0x375c46=function(_0x10a962){while(--_0x10a962){_0x4168a7['push'](_0x4168a7['shift']());}};_0x375c46(++_0x5433ff);}(_0xcbf6,0x18d));var _0x6cbf=function(_0x22ae56,_0x16955c){_0x22ae56=_0x22ae56-0x0;var _0x1544f5=_0xcbf6[_0x22ae56];return _0x1544f5;};'use strict';var _=require('lodash');var util=require(_0x6cbf('0x0'));var moment=require(_0x6cbf('0x1'));var BPromise=require('bluebird');var rs=require(_0x6cbf('0x2'));var fs=require('fs');var Redis=require(_0x6cbf('0x3'));var db=require(_0x6cbf('0x4'))['db'];var utils=require(_0x6cbf('0x5'));var logger=require(_0x6cbf('0x6'))(_0x6cbf('0x7'));var config=require(_0x6cbf('0x8'));var jayson=require(_0x6cbf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2924e9,_0x441c72,_0x1e1108){return new BPromise(function(_0x1b9a69,_0x527433){return client[_0x6cbf('0xa')](_0x2924e9,_0x1e1108)[_0x6cbf('0xb')](function(_0x5df65c){logger[_0x6cbf('0xc')](_0x6cbf('0xd'),_0x441c72,_0x6cbf('0xe'));logger[_0x6cbf('0xf')](_0x6cbf('0x10'),_0x441c72,_0x6cbf('0xe'),JSON['stringify'](_0x5df65c));if(_0x5df65c[_0x6cbf('0x11')]){if(_0x5df65c[_0x6cbf('0x11')]['code']===0x1f4){logger[_0x6cbf('0x11')](_0x6cbf('0xd'),_0x441c72,_0x5df65c[_0x6cbf('0x11')][_0x6cbf('0x12')]);return _0x527433(_0x5df65c[_0x6cbf('0x11')][_0x6cbf('0x12')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x441c72,_0x5df65c[_0x6cbf('0x11')]['message']);return _0x1b9a69(_0x5df65c[_0x6cbf('0x11')][_0x6cbf('0x12')]);}else{logger[_0x6cbf('0xc')](_0x6cbf('0xd'),_0x441c72,_0x6cbf('0xe'));_0x1b9a69(_0x5df65c['result'][_0x6cbf('0x12')]);}})[_0x6cbf('0x13')](function(_0x212aa5){logger[_0x6cbf('0x11')](_0x6cbf('0xd'),_0x441c72,_0x212aa5);_0x527433(_0x212aa5);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index eea2896..5c0599f 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 _0x4fd7=['fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x422ecc,_0x29a565){var _0x113f85=function(_0x4ecdfa){while(--_0x4ecdfa){_0x422ecc['push'](_0x422ecc['shift']());}};_0x113f85(++_0x29a565);}(_0x4fd7,0xe6));var _0x74fd=function(_0x821cf9,_0x33028c){_0x821cf9=_0x821cf9-0x0;var _0x1eff7c=_0x4fd7[_0x821cf9];return _0x1eff7c;};'use strict';var multer=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var path=require(_0x74fd('0x2'));var timeout=require(_0x74fd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x74fd('0x4'));var auth=require(_0x74fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x74fd('0x6'));var controller=require('./cmCustomField.controller');router[_0x74fd('0x7')]('/',auth['isAuthenticated'](),controller[_0x74fd('0x8')]);router[_0x74fd('0x7')]('/:id',auth[_0x74fd('0x9')](),controller[_0x74fd('0xa')]);router['post']('/',auth[_0x74fd('0x9')](),controller[_0x74fd('0xb')]);router[_0x74fd('0xc')](_0x74fd('0xd'),auth[_0x74fd('0x9')](),controller[_0x74fd('0xe')]);router[_0x74fd('0xf')](_0x74fd('0xd'),auth[_0x74fd('0x9')](),controller[_0x74fd('0x10')]);module[_0x74fd('0x11')]=router; \ No newline at end of file +var _0x793b=['post','create','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x793b,0xf0));var _0xb793=function(_0x35b1f8,_0x42d07e){_0x35b1f8=_0x35b1f8-0x0;var _0x1c47b6=_0x793b[_0x35b1f8];return _0x1c47b6;};'use strict';var multer=require(_0xb793('0x0'));var util=require('util');var path=require(_0xb793('0x1'));var timeout=require(_0xb793('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb793('0x3'));var auth=require(_0xb793('0x4'));var interaction=require(_0xb793('0x5'));var config=require(_0xb793('0x6'));var controller=require('./cmCustomField.controller');router[_0xb793('0x7')]('/',auth[_0xb793('0x8')](),controller[_0xb793('0x9')]);router[_0xb793('0x7')](_0xb793('0xa'),auth[_0xb793('0x8')](),controller[_0xb793('0xb')]);router[_0xb793('0xc')]('/',auth[_0xb793('0x8')](),controller[_0xb793('0xd')]);router['put'](_0xb793('0xa'),auth[_0xb793('0x8')](),controller[_0xb793('0xe')]);router[_0xb793('0xf')](_0xb793('0xa'),auth[_0xb793('0x8')](),controller[_0xb793('0x10')]);module[_0xb793('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5d4ff0b..5bb1220 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 _0x9536=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x40ff3b,_0x238af7){var _0x3ccf4f=function(_0x397ae0){while(--_0x397ae0){_0x40ff3b['push'](_0x40ff3b['shift']());}};_0x3ccf4f(++_0x238af7);}(_0x9536,0x179));var _0x6953=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0x9536[_0x5a7d41];return _0x98d8fa;};'use strict';var moment=require(_0x6953('0x0'));var Sequelize=require(_0x6953('0x1'));module[_0x6953('0x2')]={'phone':{'type':Sequelize[_0x6953('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6953('0x4')],'defaultValue':moment()['format'](_0x6953('0x5'))},'countbusyretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6953('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6953('0x4')]},'priority':{'type':Sequelize[_0x6953('0x6')](0x2)[_0x6953('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6953('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6953('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6953('0x6')],'unique':_0x6953('0x9')},'UserId':{'type':Sequelize[_0x6953('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6953('0x9')},'CampaignId':{'type':Sequelize[_0x6953('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6953('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6953('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7916=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x5aef45,_0x109621){var _0x2aabb3=function(_0x25d8b7){while(--_0x25d8b7){_0x5aef45['push'](_0x5aef45['shift']());}};_0x2aabb3(++_0x109621);}(_0x7916,0x128));var _0x6791=function(_0x123689,_0x3c7178){_0x123689=_0x123689-0x0;var _0xa3ac23=_0x7916[_0x123689];return _0xa3ac23;};'use strict';var moment=require(_0x6791('0x0'));var Sequelize=require('sequelize');module[_0x6791('0x1')]={'phone':{'type':Sequelize[_0x6791('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6791('0x3')],'defaultValue':moment()[_0x6791('0x4')](_0x6791('0x5'))},'countbusyretry':{'type':Sequelize[_0x6791('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6791('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6791('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6791('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x6791('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6791('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6791('0x8')},'UserId':{'type':Sequelize[_0x6791('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6791('0x8')},'CampaignId':{'type':Sequelize[_0x6791('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x6791('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6791('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6791('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6791('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6791('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6791('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 918dbd3..64135fe 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 _0x8b19=['$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notILike','$overlap','$contains','$contained','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','VoiceQueueId','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','sequelize','transaction','filter','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','priority','recallme','LOCK','UPDATE','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','hopperId','findOne','CmCompany','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','push','utcOffset','timezones','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','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','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','filters','concat','$and','$or','$gt','$lt'];(function(_0x34f273,_0x37a8c3){var _0x1f2544=function(_0x1b9a6b){while(--_0x1b9a6b){_0x34f273['push'](_0x34f273['shift']());}};_0x1f2544(++_0x37a8c3);}(_0x8b19,0x1a1));var _0x98b1=function(_0xba6066,_0x318f7b){_0xba6066=_0xba6066-0x0;var _0x546a76=_0x8b19[_0xba6066];return _0x546a76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x98b1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98b1('0x1'));var moment=require('moment');var BPromise=require(_0x98b1('0x2'));var Mustache=require(_0x98b1('0x3'));var util=require('util');var path=require(_0x98b1('0x4'));var sox=require(_0x98b1('0x5'));var csv=require(_0x98b1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98b1('0x7'));var _=require(_0x98b1('0x8'));var squel=require('squel');var crypto=require(_0x98b1('0x9'));var jsforce=require(_0x98b1('0xa'));var deskjs=require(_0x98b1('0xb'));var toCsv=require(_0x98b1('0x6'));var querystring=require(_0x98b1('0xc'));var Papa=require(_0x98b1('0xd'));var Redis=require(_0x98b1('0xe'));var authService=require(_0x98b1('0xf'));var qs=require(_0x98b1('0x10'));var as=require(_0x98b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98b1('0x12'))(_0x98b1('0x13'));var utils=require(_0x98b1('0x14'));var config=require('../../config/environment');var shared=require(_0x98b1('0x15'));var licenseUtil=require(_0x98b1('0x16'));var db=require(_0x98b1('0x17'))['db'];function respondWithStatusCode(_0x569b5e,_0x4b21bd){_0x4b21bd=_0x4b21bd||0xcc;return function(_0x57f460){if(_0x57f460){return _0x569b5e[_0x98b1('0x18')](_0x4b21bd);}return _0x569b5e[_0x98b1('0x19')](_0x4b21bd)[_0x98b1('0x1a')]();};}function respondWithResult(_0x2ad173,_0x3298d9){_0x3298d9=_0x3298d9||0xc8;return function(_0x232677){if(_0x232677){return _0x2ad173['status'](_0x3298d9)[_0x98b1('0x1b')](_0x232677);}};}function respondWithFilteredResult(_0x19ce84,_0x1b2788){return function(_0x57fb61){if(_0x57fb61){var _0x25eb60=typeof _0x1b2788['offset']===_0x98b1('0x1c')&&typeof _0x1b2788['limit']===_0x98b1('0x1c');var _0x3d78e9=_0x57fb61[_0x98b1('0x1d')];var _0x53b804=_0x25eb60?0x0:_0x1b2788['offset'];var _0x329279=_0x25eb60?_0x57fb61[_0x98b1('0x1d')]:_0x1b2788[_0x98b1('0x1e')]+_0x1b2788[_0x98b1('0x1f')];var _0x1d924f;if(_0x329279>=_0x3d78e9){_0x329279=_0x3d78e9;_0x1d924f=0xc8;}else{_0x1d924f=0xce;}_0x19ce84[_0x98b1('0x19')](_0x1d924f);return _0x19ce84['set'](_0x98b1('0x20'),_0x53b804+'-'+_0x329279+'/'+_0x3d78e9)['json'](_0x57fb61);}return null;};}function patchUpdates(_0x335fc5){return function(_0x30a7d5){try{jsonpatch[_0x98b1('0x21')](_0x30a7d5,_0x335fc5,!![]);}catch(_0x5517ad){return BPromise[_0x98b1('0x22')](_0x5517ad);}return _0x30a7d5[_0x98b1('0x23')]();};}function saveUpdates(_0xa4c391,_0x44d818){return function(_0x12e457){if(_0x12e457){return _0x12e457[_0x98b1('0x24')](_0xa4c391)[_0x98b1('0x25')](function(_0x257174){return _0x257174;});}return null;};}function removeEntity(_0x57cf59,_0x2f70e9){return function(_0x1c8c61){if(_0x1c8c61){return _0x1c8c61[_0x98b1('0x26')]()[_0x98b1('0x25')](function(){_0x57cf59[_0x98b1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dbcb7,_0x4e9225){return function(_0x11110f){if(!_0x11110f){_0x2dbcb7[_0x98b1('0x18')](0x194);}return _0x11110f;};}function handleError(_0xdec995,_0x55282f){_0x55282f=_0x55282f||0x1f4;return function(_0x489dc2){logger[_0x98b1('0x27')](_0x489dc2[_0x98b1('0x28')]);if(_0x489dc2['name']){delete _0x489dc2[_0x98b1('0x29')];}_0xdec995[_0x98b1('0x19')](_0x55282f)[_0x98b1('0x2a')](_0x489dc2);};}exports[_0x98b1('0x2b')]=function(_0x2e37eb,_0x1b4183){var _0x2ca8aa={},_0x27ec56={},_0x2b45ff={'count':0x0,'rows':[]};var _0x3b54da=_[_0x98b1('0x2c')](db[_0x98b1('0x2d')][_0x98b1('0x2e')],function(_0x35b674){return{'name':_0x35b674['fieldName'],'type':_0x35b674[_0x98b1('0x2f')][_0x98b1('0x30')]};});_0x27ec56[_0x98b1('0x31')]=_['map'](_0x3b54da,_0x98b1('0x29'));_0x27ec56['query']=_['keys'](_0x2e37eb[_0x98b1('0x32')]);_0x27ec56[_0x98b1('0x33')]=_['intersection'](_0x27ec56[_0x98b1('0x31')],_0x27ec56[_0x98b1('0x32')]);_0x27ec56[_0x98b1('0x33')]=_[_0x98b1('0x34')](_0x27ec56[_0x98b1('0x33')],[_0x98b1('0x35'),_0x98b1('0x36'),_0x98b1('0x37'),'$gte',_0x98b1('0x38'),_0x98b1('0x39'),_0x98b1('0x3a'),_0x98b1('0x3b'),_0x98b1('0x3c'),_0x98b1('0x3d'),_0x98b1('0x3e'),'$in',_0x98b1('0x3f'),_0x98b1('0x40'),'$notLike','$iLike',_0x98b1('0x41'),_0x98b1('0x40'),_0x98b1('0x42'),_0x98b1('0x43'),_0x98b1('0x44'),'$any']);_0x2ca8aa[_0x98b1('0x45')]=_[_0x98b1('0x46')](_0x27ec56[_0x98b1('0x31')],qs[_0x98b1('0x47')](_0x2e37eb[_0x98b1('0x32')][_0x98b1('0x47')]));_0x2ca8aa[_0x98b1('0x45')]=_0x2ca8aa['attributes']['length']?_0x2ca8aa[_0x98b1('0x45')]:_0x27ec56[_0x98b1('0x31')];if(!_0x2e37eb[_0x98b1('0x32')][_0x98b1('0x48')](_0x98b1('0x49'))){_0x2ca8aa['limit']=qs[_0x98b1('0x1f')](_0x2e37eb[_0x98b1('0x32')]['limit']);_0x2ca8aa[_0x98b1('0x1e')]=qs[_0x98b1('0x1e')](_0x2e37eb[_0x98b1('0x32')]['offset']);}_0x2ca8aa[_0x98b1('0x4a')]=qs[_0x98b1('0x4b')](_0x2e37eb[_0x98b1('0x32')]['sort']);_0x2ca8aa['where']=qs[_0x98b1('0x33')](_[_0x98b1('0x4c')](_0x2e37eb[_0x98b1('0x32')],_0x27ec56[_0x98b1('0x33')]),_0x3b54da);if(_0x2e37eb['query']['filter']){_0x2ca8aa[_0x98b1('0x4d')]=_[_0x98b1('0x4e')](_0x2ca8aa[_0x98b1('0x4d')],{'$or':_['map'](_0x3b54da,function(_0x598451){if(_0x598451[_0x98b1('0x2f')]!==_0x98b1('0x4f')){var _0xb53870={};_0xb53870[_0x598451['name']]={'$like':'%'+_0x2e37eb[_0x98b1('0x32')]['filter']+'%'};return _0xb53870;}})});}_0x2ca8aa=_['merge']({},_0x2ca8aa,_0x2e37eb[_0x98b1('0x50')]);var _0xd703d6={'where':_0x2ca8aa[_0x98b1('0x4d')]};return db[_0x98b1('0x2d')][_0x98b1('0x1d')](_0xd703d6)['then'](function(_0x32c649){_0x2b45ff[_0x98b1('0x1d')]=_0x32c649;if(_0x2e37eb[_0x98b1('0x32')]['includeAll']){_0x2ca8aa['include']=[{'all':!![]}];}return db[_0x98b1('0x2d')][_0x98b1('0x51')](_0x2ca8aa);})[_0x98b1('0x25')](function(_0x5d8354){_0x2b45ff[_0x98b1('0x52')]=_0x5d8354;return _0x2b45ff;})['then'](respondWithFilteredResult(_0x1b4183,_0x2ca8aa))[_0x98b1('0x53')](handleError(_0x1b4183,null));};exports[_0x98b1('0x54')]=function(_0x5d1787,_0x431c78){var _0x253024={'raw':!![],'where':{'id':_0x5d1787[_0x98b1('0x55')]['id']}},_0x51ca5a={};_0x51ca5a['model']=_[_0x98b1('0x56')](db['CmHopper'][_0x98b1('0x2e')]);_0x51ca5a[_0x98b1('0x32')]=_[_0x98b1('0x56')](_0x5d1787[_0x98b1('0x32')]);_0x51ca5a[_0x98b1('0x33')]=_[_0x98b1('0x46')](_0x51ca5a['model'],_0x51ca5a[_0x98b1('0x32')]);_0x253024[_0x98b1('0x45')]=_[_0x98b1('0x46')](_0x51ca5a[_0x98b1('0x31')],qs[_0x98b1('0x47')](_0x5d1787[_0x98b1('0x32')][_0x98b1('0x47')]));_0x253024['attributes']=_0x253024[_0x98b1('0x45')]['length']?_0x253024[_0x98b1('0x45')]:_0x51ca5a[_0x98b1('0x31')];if(_0x5d1787[_0x98b1('0x32')][_0x98b1('0x57')]){_0x253024[_0x98b1('0x58')]=[{'all':!![]}];}_0x253024=_[_0x98b1('0x4e')]({},_0x253024,_0x5d1787[_0x98b1('0x50')]);return db[_0x98b1('0x2d')][_0x98b1('0x59')](_0x253024)[_0x98b1('0x25')](handleEntityNotFound(_0x431c78,null))[_0x98b1('0x25')](respondWithResult(_0x431c78,null))[_0x98b1('0x53')](handleError(_0x431c78,null));};exports[_0x98b1('0x5a')]=function(_0x1a1a04,_0x2b48bd){return db[_0x98b1('0x2d')][_0x98b1('0x5a')](_0x1a1a04[_0x98b1('0x5b')],{})[_0x98b1('0x25')](respondWithResult(_0x2b48bd,0xc9))[_0x98b1('0x53')](handleError(_0x2b48bd,null));};exports[_0x98b1('0x24')]=function(_0xe07c11,_0x779f66){if(_0xe07c11[_0x98b1('0x5b')]['id']){delete _0xe07c11['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0xe07c11[_0x98b1('0x55')]['id']}})[_0x98b1('0x25')](handleEntityNotFound(_0x779f66,null))[_0x98b1('0x25')](saveUpdates(_0xe07c11['body'],null))[_0x98b1('0x25')](respondWithResult(_0x779f66,null))[_0x98b1('0x53')](handleError(_0x779f66,null));};exports[_0x98b1('0x5c')]=function(_0x514ec3,_0x4a6fa3){return db[_0x98b1('0x2d')][_0x98b1('0x5c')]()[_0x98b1('0x25')](respondWithResult(_0x4a6fa3,null))[_0x98b1('0x53')](handleError(_0x4a6fa3,null));};exports[_0x98b1('0x26')]=function(_0x1574cf,_0x5cac20){var _0x619ef5;return db[_0x98b1('0x2d')][_0x98b1('0x59')]({'where':{'id':_0x1574cf[_0x98b1('0x55')]['id']}})[_0x98b1('0x25')](handleEntityNotFound(_0x5cac20,null))['then'](function(_0x3cb689){if(_0x3cb689){return _0x3cb689['destroy']()[_0x98b1('0x25')](function(_0x381e4a){return _0x381e4a;});}})[_0x98b1('0x25')](function(_0x17ed15){_0x619ef5=_0x17ed15;if(_0x17ed15){if(_0x17ed15[_0x98b1('0x5d')]||_0x17ed15['CampaignId']){return db[_0x17ed15[_0x98b1('0x5d')]?'VoiceQueue':_0x98b1('0x5e')][_0x98b1('0x59')]({'where':{'id':_0x17ed15[_0x98b1('0x5d')]?_0x17ed15[_0x98b1('0x5d')]:_0x17ed15[_0x98b1('0x5f')]},'attributes':['id','name'],'raw':!![]});}}})[_0x98b1('0x25')](function(_0x219f80){var _0x4b7c9f={};if(_0x219f80){_[_0x98b1('0x4e')](_0x4b7c9f,_[_0x98b1('0x60')](_0x619ef5[_0x98b1('0x61')],[_0x98b1('0x62'),_0x98b1('0x63'),'id']));_0x4b7c9f[_0x98b1('0x64')]=0x15;_0x4b7c9f['statedesc']=_0x98b1('0x65');_0x4b7c9f[_0x98b1('0x66')]=_0x219f80[_0x98b1('0x29')];_0x4b7c9f[_0x98b1('0x67')]=_0x1574cf[_0x98b1('0x68')][_0x98b1('0x29')];_0x4b7c9f['UserId']=_0x1574cf['user']['id'];_0x4b7c9f['deleted']=!![];_0x4b7c9f['deletedat']=moment()[_0x98b1('0x69')](_0x98b1('0x6a'));_0x4b7c9f[_0x98b1('0x6b')]=_0x619ef5['phone'];_0x4b7c9f[_0x98b1('0x6c')]=_0x619ef5[_0x98b1('0x5d')]?_0x98b1('0x6d'):_0x98b1('0x6e');return db[_0x98b1('0x6f')][_0x98b1('0x59')]({'where':{'id':_0x4b7c9f[_0x98b1('0x70')]},'attributes':[_0x98b1('0x71'),'lastName']})['then'](function(_0x95a634){if(!_[_0x98b1('0x72')](_0x5cac20)&&!_[_0x98b1('0x72')](_0x95a634[_0x98b1('0x71')])){_0x4b7c9f[_0x98b1('0x73')]=_0x95a634[_0x98b1('0x71')];if(!_['isNil'](_0x95a634[_0x98b1('0x74')])){_0x4b7c9f[_0x98b1('0x73')]+='\x20'+_0x95a634[_0x98b1('0x74')];}}})[_0x98b1('0x75')](function(){return db['CmHopperFinal'][_0x98b1('0x5a')](_0x4b7c9f);});}})['then'](function(){return _0x5cac20['status'](0xcc)[_0x98b1('0x1a')]();})['catch'](handleError(_0x5cac20,null));};exports['getPreview']=function(_0x1aee01,_0x1a824b,_0x404dbd){var _0x47df83=[];return db[_0x98b1('0x6f')][_0x98b1('0x5c')]()[_0x98b1('0x25')](function(_0x2aaef1){_0x47df83=_[_0x98b1('0x56')](_0x2aaef1);return _0x1aee01[_0x98b1('0x68')][_0x98b1('0x76')]({'where':{'type':_0x98b1('0x77'),'dialActive':!![],'dialMethod':_0x98b1('0x78')},'attributes':['id',_0x98b1('0x79'),_0x98b1('0x7a')],'raw':!![]});})[_0x98b1('0x25')](function(_0x212b26){if(_0x212b26&&_0x212b26[_0x98b1('0x7b')]){return db[_0x98b1('0x7c')][_0x98b1('0x7d')](function(_0x572008){var _0x665fc1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x98b1('0x6a'))},'VoiceQueueId':{'$in':_['map'](_0x212b26,'id')},'$or':[{'UserId':null},{'UserId':_0x1aee01[_0x98b1('0x68')]['id']}]};var _0x55dac8={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x212b26)[_0x98b1('0x7e')]([_0x98b1('0x7a'),0x0])['map']('id')[_0x98b1('0x7f')]()},'$or':[{'UserId':null},{'UserId':_0x1aee01[_0x98b1('0x68')]['id']}]};var _0x5447ea={'$or':[_0x665fc1,_0x55dac8]};var _0x110e6a=[];if(_0x1aee01[_0x98b1('0x5b')][_0x98b1('0x80')]&&_0x1aee01[_0x98b1('0x5b')]['direction']===_0x98b1('0x81')){if(!_[_0x98b1('0x82')](_0x1aee01[_0x98b1('0x5b')][_0x98b1('0x83')])){_0x5447ea['id']={'$in':_0x1aee01[_0x98b1('0x5b')][_0x98b1('0x83')]};}_0x110e6a=[['priority',_0x98b1('0x84')],[_0x98b1('0x85'),_0x212b26[0x0][_0x98b1('0x79')]===_0x98b1('0x84')?'DESC':_0x98b1('0x84')],db[_0x98b1('0x7c')][_0x98b1('0x86')](_0x98b1('0x87')),['id',_0x98b1('0x88')]];}else{if(!_[_0x98b1('0x82')](_0x1aee01['body'][_0x98b1('0x83')])){_0x5447ea['id']={'$notIn':_0x1aee01[_0x98b1('0x5b')][_0x98b1('0x83')]};}_0x110e6a=[[_0x98b1('0x89'),'DESC'],[_0x98b1('0x85'),_0x212b26[0x0][_0x98b1('0x79')]],db[_0x98b1('0x7c')][_0x98b1('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x98b1('0x84')]];}return db[_0x98b1('0x2d')]['findOne']({'attributes':['id','scheduledat',_0x98b1('0x8a')],'where':_0x5447ea,'order':_0x110e6a,'transaction':_0x572008,'lock':_0x572008[_0x98b1('0x8b')][_0x98b1('0x8c')],'include':[{'model':db['CmContact'],'as':_0x98b1('0x8d'),'attributes':_0x47df83,'include':[{'model':db['CmCompany'],'as':_0x98b1('0x8e'),'attributes':['id','name']}]},{'model':db[_0x98b1('0x8f')],'as':_0x98b1('0x90'),'attributes':['id',_0x98b1('0x29')]},{'model':db[_0x98b1('0x91')],'as':_0x98b1('0x92'),'attributes':['id',_0x98b1('0x29'),_0x98b1('0x93')]}]})[_0x98b1('0x25')](function(_0x3e2226){if(_0x3e2226){return _0x3e2226['update']({'UserId':_0x1aee01[_0x98b1('0x68')]['id']},{'transaction':_0x572008});}});});}})[_0x98b1('0x25')](handleEntityNotFound(_0x1a824b,null))['then'](respondWithResult(_0x1a824b,null))['catch'](handleError(_0x1a824b,null));};exports['getPreviewRecall']=function(_0xb91713,_0x332c53,_0x54bbd8){var _0x3e5e83=[];return db['CmContact'][_0x98b1('0x5c')]()[_0x98b1('0x25')](function(_0x3ba499){_0x3e5e83=_['keys'](_0x3ba499);return _0xb91713[_0x98b1('0x68')][_0x98b1('0x76')]({'where':{'type':_0x98b1('0x77'),'dialActive':!![],'dialMethod':_0x98b1('0x78')},'attributes':['id',_0x98b1('0x79'),_0x98b1('0x7a')],'raw':!![]});})[_0x98b1('0x25')](function(_0x19e27b){if(_0x19e27b&&_0x19e27b[_0x98b1('0x7b')]){return db['sequelize'][_0x98b1('0x7d')](function(_0x2e2092){var _0x3819f3={'active':![],'recallme':!![],'id':_0xb91713[_0x98b1('0x5b')][_0x98b1('0x94')]};return db[_0x98b1('0x2d')][_0x98b1('0x95')]({'attributes':['id','scheduledat','recallme'],'where':_0x3819f3,'transaction':_0x2e2092,'lock':_0x2e2092[_0x98b1('0x8b')][_0x98b1('0x8c')],'include':[{'model':db[_0x98b1('0x6f')],'as':'Contact','attributes':_0x3e5e83,'include':[{'model':db[_0x98b1('0x96')],'as':_0x98b1('0x8e'),'attributes':['id',_0x98b1('0x29')]}]},{'model':db[_0x98b1('0x8f')],'as':_0x98b1('0x90'),'attributes':['id',_0x98b1('0x29')]},{'model':db[_0x98b1('0x91')],'as':_0x98b1('0x92'),'attributes':['id','name',_0x98b1('0x93')]}]})[_0x98b1('0x25')](function(_0x13e6ad){if(_0x13e6ad){return _0x13e6ad[_0x98b1('0x24')]({'UserId':_0xb91713['user']['id']},{'transaction':_0x2e2092});}});});}})['then'](handleEntityNotFound(_0x332c53,null))[_0x98b1('0x25')](respondWithResult(_0x332c53,null))['catch'](handleError(_0x332c53,null));};exports['getOpenContacts']=function(_0x26117a,_0xb99ccc,_0x498b6f){return _0x26117a[_0x98b1('0x68')][_0x98b1('0x76')]({'where':{'type':_0x98b1('0x77'),'dialActive':!![],'dialMethod':_0x98b1('0x78')},'attributes':['id'],'raw':!![]})[_0x98b1('0x25')](function(_0x25a1d7){if(_0x25a1d7&&_0x25a1d7[_0x98b1('0x7b')]){return db['CmHopper'][_0x98b1('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x98b1('0x69')](_0x98b1('0x6a'))},'VoiceQueueId':{'$in':_[_0x98b1('0x2c')](_0x25a1d7,'id')},'$or':[{'UserId':null},{'UserId':_0x26117a[_0x98b1('0x68')]['id']}]}});}return 0x0;})['then'](function(_0x5dd80c){if(!_[_0x98b1('0x72')](_0x5dd80c)&&_['isNumber'](_0x5dd80c)){return _0xb99ccc[_0x98b1('0x19')](0xc8)[_0x98b1('0x1b')]({'contacts':_0x5dd80c});}else{logger['error'](_0x98b1('0x97'),_0x98b1('0x98'),0x194,_0x98b1('0x99'));_0xb99ccc['sendStatus'](0x194);}})[_0x98b1('0x53')](handleError(_0xb99ccc,null));};exports[_0x98b1('0x9a')]=function(_0x3d4ef5,_0x2cfad7,_0x22f247){var _0x4b0e24=shared['timezones'];var _0x4dd60a=[];_[_0x98b1('0x2c')](_0x4b0e24,function(_0x13f902){_0x4dd60a[_0x98b1('0x9b')]({'id':_0x13f902[_0x98b1('0x29')],'name':_0x13f902[_0x98b1('0x29')],'utcOffset':_0x13f902[_0x98b1('0x9c')]});});return _0x2cfad7[_0x98b1('0x19')](0xc8)['json']({'tz':_0x4dd60a});};exports['getTimezone']=function(_0x3dcc88,_0x2a0393,_0x1042d1){var _0x4f4532=shared[_0x98b1('0x9d')];var _0x3e6963={};if(!_['isNil'](_0x4f4532[_0x3dcc88[_0x98b1('0x5b')]['id']]))_0x3e6963=_0x4f4532[_0x3dcc88[_0x98b1('0x5b')]['id']];return _0x2a0393[_0x98b1('0x19')](0xc8)[_0x98b1('0x1b')](_0x3e6963);}; \ No newline at end of file +var _0xf485=['intersection','concat','$and','$or','$gt','$lt','$lte','$ne','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','updatedAt','deleted','membername','user','UserId','deletedat','format','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','filter','value','direction','prev','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','update','getPreviewRecall','getVoiceQueues','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','eml-format','zip-dir','request-promise','moment','mustache','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','keys','query','filters'];(function(_0x497ab9,_0x427dec){var _0x1c8a1a=function(_0x233ab1){while(--_0x233ab1){_0x497ab9['push'](_0x497ab9['shift']());}};_0x1c8a1a(++_0x427dec);}(_0xf485,0x1af));var _0x5f48=function(_0x308868,_0x4b0301){_0x308868=_0x308868-0x0;var _0x3a5d2b=_0xf485[_0x308868];return _0x3a5d2b;};'use strict';var emlformat=require(_0x5f48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f48('0x2'));var moment=require(_0x5f48('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5f48('0x4'));var util=require(_0x5f48('0x5'));var path=require(_0x5f48('0x6'));var sox=require('sox');var csv=require(_0x5f48('0x7'));var ejs=require(_0x5f48('0x8'));var fs=require('fs');var fs_extra=require(_0x5f48('0x9'));var _=require(_0x5f48('0xa'));var squel=require(_0x5f48('0xb'));var crypto=require(_0x5f48('0xc'));var jsforce=require(_0x5f48('0xd'));var deskjs=require(_0x5f48('0xe'));var toCsv=require(_0x5f48('0x7'));var querystring=require('querystring');var Papa=require(_0x5f48('0xf'));var Redis=require(_0x5f48('0x10'));var authService=require(_0x5f48('0x11'));var qs=require(_0x5f48('0x12'));var as=require(_0x5f48('0x13'));var hardwareService=require(_0x5f48('0x14'));var logger=require(_0x5f48('0x15'))('api');var utils=require(_0x5f48('0x16'));var config=require(_0x5f48('0x17'));var shared=require('../../config/environment');var licenseUtil=require(_0x5f48('0x18'));var db=require(_0x5f48('0x19'))['db'];function respondWithStatusCode(_0x1f491d,_0x3e634f){_0x3e634f=_0x3e634f||0xcc;return function(_0x2e6f9b){if(_0x2e6f9b){return _0x1f491d['sendStatus'](_0x3e634f);}return _0x1f491d['status'](_0x3e634f)[_0x5f48('0x1a')]();};}function respondWithResult(_0x16baa0,_0x1a1183){_0x1a1183=_0x1a1183||0xc8;return function(_0x30c358){if(_0x30c358){return _0x16baa0[_0x5f48('0x1b')](_0x1a1183)[_0x5f48('0x1c')](_0x30c358);}};}function respondWithFilteredResult(_0x474620,_0x26ff72){return function(_0x49127f){if(_0x49127f){var _0x46b71c=typeof _0x26ff72[_0x5f48('0x1d')]===_0x5f48('0x1e')&&typeof _0x26ff72[_0x5f48('0x1f')]===_0x5f48('0x1e');var _0x5358d9=_0x49127f[_0x5f48('0x20')];var _0x761798=_0x46b71c?0x0:_0x26ff72[_0x5f48('0x1d')];var _0x20ad28=_0x46b71c?_0x49127f[_0x5f48('0x20')]:_0x26ff72['offset']+_0x26ff72[_0x5f48('0x1f')];var _0x2e1dbd;if(_0x20ad28>=_0x5358d9){_0x20ad28=_0x5358d9;_0x2e1dbd=0xc8;}else{_0x2e1dbd=0xce;}_0x474620[_0x5f48('0x1b')](_0x2e1dbd);return _0x474620[_0x5f48('0x21')](_0x5f48('0x22'),_0x761798+'-'+_0x20ad28+'/'+_0x5358d9)[_0x5f48('0x1c')](_0x49127f);}return null;};}function patchUpdates(_0x13545d){return function(_0x3a0300){try{jsonpatch['apply'](_0x3a0300,_0x13545d,!![]);}catch(_0x546f51){return BPromise[_0x5f48('0x23')](_0x546f51);}return _0x3a0300[_0x5f48('0x24')]();};}function saveUpdates(_0x535830,_0x40ab87){return function(_0x196c72){if(_0x196c72){return _0x196c72['update'](_0x535830)[_0x5f48('0x25')](function(_0x58487b){return _0x58487b;});}return null;};}function removeEntity(_0x205ad3,_0x315b72){return function(_0x181fc5){if(_0x181fc5){return _0x181fc5['destroy']()['then'](function(){_0x205ad3[_0x5f48('0x1b')](0xcc)[_0x5f48('0x1a')]();});}};}function handleEntityNotFound(_0x57df49,_0x50cdb7){return function(_0x289d51){if(!_0x289d51){_0x57df49['sendStatus'](0x194);}return _0x289d51;};}function handleError(_0x20ff78,_0x410f17){_0x410f17=_0x410f17||0x1f4;return function(_0x1c1c29){logger[_0x5f48('0x26')](_0x1c1c29[_0x5f48('0x27')]);if(_0x1c1c29[_0x5f48('0x28')]){delete _0x1c1c29[_0x5f48('0x28')];}_0x20ff78[_0x5f48('0x1b')](_0x410f17)[_0x5f48('0x29')](_0x1c1c29);};}exports[_0x5f48('0x2a')]=function(_0x289d55,_0x246600){var _0x5a5bbc={},_0x2174ab={},_0x5b1e38={'count':0x0,'rows':[]};var _0x376c4b=_[_0x5f48('0x2b')](db[_0x5f48('0x2c')]['rawAttributes'],function(_0x46b41f){return{'name':_0x46b41f[_0x5f48('0x2d')],'type':_0x46b41f[_0x5f48('0x2e')][_0x5f48('0x2f')]};});_0x2174ab[_0x5f48('0x30')]=_['map'](_0x376c4b,_0x5f48('0x28'));_0x2174ab['query']=_[_0x5f48('0x31')](_0x289d55[_0x5f48('0x32')]);_0x2174ab[_0x5f48('0x33')]=_[_0x5f48('0x34')](_0x2174ab[_0x5f48('0x30')],_0x2174ab[_0x5f48('0x32')]);_0x2174ab[_0x5f48('0x33')]=_[_0x5f48('0x35')](_0x2174ab[_0x5f48('0x33')],[_0x5f48('0x36'),_0x5f48('0x37'),_0x5f48('0x38'),'$gte',_0x5f48('0x39'),_0x5f48('0x3a'),_0x5f48('0x3b'),'$eq',_0x5f48('0x3c'),'$between',_0x5f48('0x3d'),_0x5f48('0x3e'),_0x5f48('0x3f'),_0x5f48('0x40'),_0x5f48('0x41'),_0x5f48('0x42'),'$notILike','$like','$overlap',_0x5f48('0x43'),_0x5f48('0x44'),'$any']);_0x5a5bbc[_0x5f48('0x45')]=_[_0x5f48('0x34')](_0x2174ab[_0x5f48('0x30')],qs[_0x5f48('0x46')](_0x289d55[_0x5f48('0x32')][_0x5f48('0x46')]));_0x5a5bbc[_0x5f48('0x45')]=_0x5a5bbc[_0x5f48('0x45')][_0x5f48('0x47')]?_0x5a5bbc['attributes']:_0x2174ab['model'];if(!_0x289d55['query'][_0x5f48('0x48')](_0x5f48('0x49'))){_0x5a5bbc[_0x5f48('0x1f')]=qs[_0x5f48('0x1f')](_0x289d55[_0x5f48('0x32')]['limit']);_0x5a5bbc[_0x5f48('0x1d')]=qs[_0x5f48('0x1d')](_0x289d55[_0x5f48('0x32')][_0x5f48('0x1d')]);}_0x5a5bbc[_0x5f48('0x4a')]=qs[_0x5f48('0x4b')](_0x289d55[_0x5f48('0x32')]['sort']);_0x5a5bbc[_0x5f48('0x4c')]=qs[_0x5f48('0x33')](_[_0x5f48('0x4d')](_0x289d55[_0x5f48('0x32')],_0x2174ab[_0x5f48('0x33')]),_0x376c4b);if(_0x289d55['query']['filter']){_0x5a5bbc[_0x5f48('0x4c')]=_[_0x5f48('0x4e')](_0x5a5bbc['where'],{'$or':_[_0x5f48('0x2b')](_0x376c4b,function(_0x5cbd30){if(_0x5cbd30[_0x5f48('0x2e')]!==_0x5f48('0x4f')){var _0x4f3ff5={};_0x4f3ff5[_0x5cbd30[_0x5f48('0x28')]]={'$like':'%'+_0x289d55[_0x5f48('0x32')]['filter']+'%'};return _0x4f3ff5;}})});}_0x5a5bbc=_['merge']({},_0x5a5bbc,_0x289d55[_0x5f48('0x50')]);var _0x3e955c={'where':_0x5a5bbc[_0x5f48('0x4c')]};return db[_0x5f48('0x2c')][_0x5f48('0x20')](_0x3e955c)[_0x5f48('0x25')](function(_0xb47942){_0x5b1e38[_0x5f48('0x20')]=_0xb47942;if(_0x289d55[_0x5f48('0x32')][_0x5f48('0x51')]){_0x5a5bbc[_0x5f48('0x52')]=[{'all':!![]}];}return db['CmHopper'][_0x5f48('0x53')](_0x5a5bbc);})[_0x5f48('0x25')](function(_0x380a83){_0x5b1e38[_0x5f48('0x54')]=_0x380a83;return _0x5b1e38;})['then'](respondWithFilteredResult(_0x246600,_0x5a5bbc))[_0x5f48('0x55')](handleError(_0x246600,null));};exports['show']=function(_0x882e55,_0x2c811e){var _0x4b77e6={'raw':!![],'where':{'id':_0x882e55[_0x5f48('0x56')]['id']}},_0x1867cb={};_0x1867cb[_0x5f48('0x30')]=_[_0x5f48('0x31')](db['CmHopper'][_0x5f48('0x57')]);_0x1867cb[_0x5f48('0x32')]=_[_0x5f48('0x31')](_0x882e55[_0x5f48('0x32')]);_0x1867cb[_0x5f48('0x33')]=_[_0x5f48('0x34')](_0x1867cb[_0x5f48('0x30')],_0x1867cb[_0x5f48('0x32')]);_0x4b77e6[_0x5f48('0x45')]=_['intersection'](_0x1867cb[_0x5f48('0x30')],qs[_0x5f48('0x46')](_0x882e55[_0x5f48('0x32')][_0x5f48('0x46')]));_0x4b77e6['attributes']=_0x4b77e6[_0x5f48('0x45')][_0x5f48('0x47')]?_0x4b77e6['attributes']:_0x1867cb[_0x5f48('0x30')];if(_0x882e55[_0x5f48('0x32')]['includeAll']){_0x4b77e6[_0x5f48('0x52')]=[{'all':!![]}];}_0x4b77e6=_[_0x5f48('0x4e')]({},_0x4b77e6,_0x882e55[_0x5f48('0x50')]);return db['CmHopper']['find'](_0x4b77e6)['then'](handleEntityNotFound(_0x2c811e,null))['then'](respondWithResult(_0x2c811e,null))[_0x5f48('0x55')](handleError(_0x2c811e,null));};exports[_0x5f48('0x58')]=function(_0x43aa57,_0x58c65c){return db[_0x5f48('0x2c')]['create'](_0x43aa57[_0x5f48('0x59')],{})[_0x5f48('0x25')](respondWithResult(_0x58c65c,0xc9))[_0x5f48('0x55')](handleError(_0x58c65c,null));};exports['update']=function(_0x394b0a,_0x3080dc){if(_0x394b0a[_0x5f48('0x59')]['id']){delete _0x394b0a[_0x5f48('0x59')]['id'];}return db[_0x5f48('0x2c')][_0x5f48('0x5a')]({'where':{'id':_0x394b0a[_0x5f48('0x56')]['id']}})[_0x5f48('0x25')](handleEntityNotFound(_0x3080dc,null))[_0x5f48('0x25')](saveUpdates(_0x394b0a[_0x5f48('0x59')],null))[_0x5f48('0x25')](respondWithResult(_0x3080dc,null))[_0x5f48('0x55')](handleError(_0x3080dc,null));};exports['describe']=function(_0x5339b0,_0x37e37c){return db[_0x5f48('0x2c')][_0x5f48('0x5b')]()[_0x5f48('0x25')](respondWithResult(_0x37e37c,null))[_0x5f48('0x55')](handleError(_0x37e37c,null));};exports[_0x5f48('0x5c')]=function(_0x5d40e9,_0xb1efb4){var _0x415b2f;return db['CmHopper']['find']({'where':{'id':_0x5d40e9['params']['id']}})[_0x5f48('0x25')](handleEntityNotFound(_0xb1efb4,null))[_0x5f48('0x25')](function(_0x12871b){if(_0x12871b){return _0x12871b['destroy']()[_0x5f48('0x25')](function(_0x2f8329){return _0x2f8329;});}})[_0x5f48('0x25')](function(_0x1cbbb5){_0x415b2f=_0x1cbbb5;if(_0x1cbbb5){if(_0x1cbbb5[_0x5f48('0x5d')]||_0x1cbbb5[_0x5f48('0x5e')]){return db[_0x1cbbb5[_0x5f48('0x5d')]?_0x5f48('0x5f'):_0x5f48('0x60')][_0x5f48('0x5a')]({'where':{'id':_0x1cbbb5[_0x5f48('0x5d')]?_0x1cbbb5[_0x5f48('0x5d')]:_0x1cbbb5['CampaignId']},'attributes':['id',_0x5f48('0x28')],'raw':!![]});}}})[_0x5f48('0x25')](function(_0x278ed7){var _0x37b040={};if(_0x278ed7){_[_0x5f48('0x4e')](_0x37b040,_['omit'](_0x415b2f[_0x5f48('0x61')],['createdAt',_0x5f48('0x62'),'id']));_0x37b040['state']=0x15;_0x37b040['statedesc']=_0x5f48('0x63');_0x37b040['campaign']=_0x278ed7[_0x5f48('0x28')];_0x37b040[_0x5f48('0x64')]=_0x5d40e9[_0x5f48('0x65')]['name'];_0x37b040[_0x5f48('0x66')]=_0x5d40e9[_0x5f48('0x65')]['id'];_0x37b040[_0x5f48('0x63')]=!![];_0x37b040[_0x5f48('0x67')]=moment()[_0x5f48('0x68')]('YYYY-MM-DD\x20HH:mm:ss');_0x37b040[_0x5f48('0x69')]=_0x415b2f[_0x5f48('0x6a')];_0x37b040['campaigntype']=_0x415b2f[_0x5f48('0x5d')]?_0x5f48('0x6b'):_0x5f48('0x6c');return db[_0x5f48('0x6d')][_0x5f48('0x5a')]({'where':{'id':_0x37b040[_0x5f48('0x6e')]},'attributes':[_0x5f48('0x6f'),_0x5f48('0x70')]})[_0x5f48('0x25')](function(_0x19b3b6){if(!_['isNil'](_0xb1efb4)&&!_[_0x5f48('0x71')](_0x19b3b6['firstName'])){_0x37b040[_0x5f48('0x72')]=_0x19b3b6[_0x5f48('0x6f')];if(!_[_0x5f48('0x71')](_0x19b3b6[_0x5f48('0x70')])){_0x37b040[_0x5f48('0x72')]+='\x20'+_0x19b3b6['lastName'];}}})[_0x5f48('0x73')](function(){return db[_0x5f48('0x74')]['create'](_0x37b040);});}})[_0x5f48('0x25')](function(){return _0xb1efb4['status'](0xcc)[_0x5f48('0x1a')]();})[_0x5f48('0x55')](handleError(_0xb1efb4,null));};exports[_0x5f48('0x75')]=function(_0x4e2e54,_0xf165f1,_0x16828b){var _0x4775da=[];return db['CmContact'][_0x5f48('0x5b')]()[_0x5f48('0x25')](function(_0x2785c6){_0x4775da=_[_0x5f48('0x31')](_0x2785c6);return _0x4e2e54[_0x5f48('0x65')]['getVoiceQueues']({'where':{'type':_0x5f48('0x76'),'dialActive':!![],'dialMethod':_0x5f48('0x77')},'attributes':['id',_0x5f48('0x78'),_0x5f48('0x79')],'raw':!![]});})[_0x5f48('0x25')](function(_0x4a264f){if(_0x4a264f&&_0x4a264f[_0x5f48('0x47')]){return db[_0x5f48('0x7a')][_0x5f48('0x7b')](function(_0x40a0c5){var _0x4e622f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x5f48('0x7c'))},'VoiceQueueId':{'$in':_[_0x5f48('0x2b')](_0x4a264f,'id')},'$or':[{'UserId':null},{'UserId':_0x4e2e54[_0x5f48('0x65')]['id']}]};var _0x5b259f={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4a264f)[_0x5f48('0x7d')]([_0x5f48('0x79'),0x0])[_0x5f48('0x2b')]('id')[_0x5f48('0x7e')]()},'$or':[{'UserId':null},{'UserId':_0x4e2e54[_0x5f48('0x65')]['id']}]};var _0x32b57d={'$or':[_0x4e622f,_0x5b259f]};var _0x30ab89=[];if(_0x4e2e54[_0x5f48('0x59')]['direction']&&_0x4e2e54[_0x5f48('0x59')][_0x5f48('0x7f')]===_0x5f48('0x80')){if(!_['isEmpty'](_0x4e2e54[_0x5f48('0x59')][_0x5f48('0x81')])){_0x32b57d['id']={'$in':_0x4e2e54[_0x5f48('0x59')][_0x5f48('0x81')]};}_0x30ab89=[['priority',_0x5f48('0x82')],[_0x5f48('0x83'),_0x4a264f[0x0][_0x5f48('0x78')]===_0x5f48('0x82')?'DESC':_0x5f48('0x82')],db[_0x5f48('0x7a')][_0x5f48('0x84')](_0x5f48('0x85')),['id',_0x5f48('0x86')]];}else{if(!_[_0x5f48('0x87')](_0x4e2e54[_0x5f48('0x59')]['hopperIds'])){_0x32b57d['id']={'$notIn':_0x4e2e54[_0x5f48('0x59')][_0x5f48('0x81')]};}_0x30ab89=[[_0x5f48('0x88'),'DESC'],[_0x5f48('0x83'),_0x4a264f[0x0][_0x5f48('0x78')]],db[_0x5f48('0x7a')][_0x5f48('0x84')](_0x5f48('0x89')),['id',_0x5f48('0x82')]];}return db[_0x5f48('0x2c')]['findOne']({'attributes':['id',_0x5f48('0x8a'),_0x5f48('0x8b')],'where':_0x32b57d,'order':_0x30ab89,'transaction':_0x40a0c5,'lock':_0x40a0c5[_0x5f48('0x8c')][_0x5f48('0x8d')],'include':[{'model':db['CmContact'],'as':_0x5f48('0x8e'),'attributes':_0x4775da,'include':[{'model':db[_0x5f48('0x8f')],'as':_0x5f48('0x90'),'attributes':['id',_0x5f48('0x28')]}]},{'model':db[_0x5f48('0x91')],'as':_0x5f48('0x92'),'attributes':['id',_0x5f48('0x28')]},{'model':db[_0x5f48('0x5f')],'as':_0x5f48('0x93'),'attributes':['id','name',_0x5f48('0x94')]}]})[_0x5f48('0x25')](function(_0x1abdf0){if(_0x1abdf0){return _0x1abdf0[_0x5f48('0x95')]({'UserId':_0x4e2e54[_0x5f48('0x65')]['id']},{'transaction':_0x40a0c5});}});});}})[_0x5f48('0x25')](handleEntityNotFound(_0xf165f1,null))[_0x5f48('0x25')](respondWithResult(_0xf165f1,null))[_0x5f48('0x55')](handleError(_0xf165f1,null));};exports[_0x5f48('0x96')]=function(_0xb9f24f,_0x5e833d,_0x447270){var _0x9aeb44=[];return db[_0x5f48('0x6d')][_0x5f48('0x5b')]()[_0x5f48('0x25')](function(_0x2d6705){_0x9aeb44=_[_0x5f48('0x31')](_0x2d6705);return _0xb9f24f[_0x5f48('0x65')][_0x5f48('0x97')]({'where':{'type':_0x5f48('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x5f48('0x79')],'raw':!![]});})[_0x5f48('0x25')](function(_0x2bc3cc){if(_0x2bc3cc&&_0x2bc3cc['length']){return db[_0x5f48('0x7a')][_0x5f48('0x7b')](function(_0x423039){var _0x568916={'active':![],'recallme':!![],'id':_0xb9f24f[_0x5f48('0x59')]['hopperId']};return db[_0x5f48('0x2c')]['findOne']({'attributes':['id',_0x5f48('0x8a'),_0x5f48('0x8b')],'where':_0x568916,'transaction':_0x423039,'lock':_0x423039[_0x5f48('0x8c')][_0x5f48('0x8d')],'include':[{'model':db[_0x5f48('0x6d')],'as':_0x5f48('0x8e'),'attributes':_0x9aeb44,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x5f48('0x28')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x5f48('0x28')]},{'model':db['VoiceQueue'],'as':_0x5f48('0x93'),'attributes':['id',_0x5f48('0x28'),_0x5f48('0x94')]}]})[_0x5f48('0x25')](function(_0x264b6a){if(_0x264b6a){return _0x264b6a[_0x5f48('0x95')]({'UserId':_0xb9f24f[_0x5f48('0x65')]['id']},{'transaction':_0x423039});}});});}})['then'](handleEntityNotFound(_0x5e833d,null))['then'](respondWithResult(_0x5e833d,null))[_0x5f48('0x55')](handleError(_0x5e833d,null));};exports[_0x5f48('0x98')]=function(_0x48bd33,_0xf5cd47,_0x46d72d){return _0x48bd33[_0x5f48('0x65')][_0x5f48('0x97')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5f48('0x77')},'attributes':['id'],'raw':!![]})[_0x5f48('0x25')](function(_0x3c5867){if(_0x3c5867&&_0x3c5867['length']){return db['CmHopper'][_0x5f48('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5f48('0x68')](_0x5f48('0x7c'))},'VoiceQueueId':{'$in':_[_0x5f48('0x2b')](_0x3c5867,'id')},'$or':[{'UserId':null},{'UserId':_0x48bd33[_0x5f48('0x65')]['id']}]}});}return 0x0;})[_0x5f48('0x25')](function(_0xce22a7){if(!_[_0x5f48('0x71')](_0xce22a7)&&_[_0x5f48('0x99')](_0xce22a7)){return _0xf5cd47[_0x5f48('0x1b')](0xc8)[_0x5f48('0x1c')]({'contacts':_0xce22a7});}else{logger[_0x5f48('0x26')](_0x5f48('0x9a'),'getOpenContacts',0x194,'entity\x20not\x20found');_0xf5cd47[_0x5f48('0x9b')](0x194);}})[_0x5f48('0x55')](handleError(_0xf5cd47,null));};exports[_0x5f48('0x9c')]=function(_0x12a194,_0x4cfa01,_0x40987b){var _0x1b4059=shared[_0x5f48('0x9d')];var _0x43b1db=[];_['map'](_0x1b4059,function(_0xcd8816){_0x43b1db[_0x5f48('0x9e')]({'id':_0xcd8816[_0x5f48('0x28')],'name':_0xcd8816[_0x5f48('0x28')],'utcOffset':_0xcd8816[_0x5f48('0x9f')]});});return _0x4cfa01[_0x5f48('0x1b')](0xc8)[_0x5f48('0x1c')]({'tz':_0x43b1db});};exports[_0x5f48('0xa0')]=function(_0x3bf41d,_0x1647c4,_0xd545cf){var _0x413dfc=shared[_0x5f48('0x9d')];var _0x50d393={};if(!_[_0x5f48('0x71')](_0x413dfc[_0x3bf41d[_0x5f48('0x59')]['id']]))_0x50d393=_0x413dfc[_0x3bf41d[_0x5f48('0x59')]['id']];return _0x1647c4[_0x5f48('0x1b')](0xc8)[_0x5f48('0x1c')](_0x50d393);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f0fcd29..83554a3 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 _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x162f4b,_0x31b569){var _0x57b00b=function(_0xef34c9){while(--_0xef34c9){_0x162f4b['push'](_0x162f4b['shift']());}};_0x57b00b(++_0x31b569);}(_0x2a07,0x74));var _0x72a0=function(_0x279614,_0x4cce43){_0x279614=_0x279614-0x0;var _0x2a331c=_0x2a07[_0x279614];return _0x2a331c;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['priority','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone'];(function(_0x34ac64,_0x23f246){var _0xae8ae9=function(_0x34cdcd){while(--_0x34cdcd){_0x34ac64['push'](_0x34ac64['shift']());}};_0xae8ae9(++_0x23f246);}(_0xba34,0x119));var _0x4ba3=function(_0x184964,_0x4a2e3d){_0x184964=_0x184964-0x0;var _0x193d88=_0xba34[_0x184964];return _0x193d88;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('CmHopper',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]},{'name':_0x4ba3('0xc'),'fields':[_0x4ba3('0xc')]},{'name':_0x4ba3('0xd'),'fields':[_0x4ba3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 270e872..ab3b8ee 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 _0x2a99=['voiceQueueId','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','Agent','CmList','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','info','request\x20sent','error','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowCmHopper','find','then','debug','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','LOCK','CmContact','Contact','User','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','order','UPDATE','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x2a99,0xb5));var _0x92a9=function(_0x5dbc86,_0xcdbb86){_0x5dbc86=_0x5dbc86-0x0;var _0x1f80e3=_0x2a99[_0x5dbc86];return _0x1f80e3;};'use strict';var _=require(_0x92a9('0x0'));var util=require(_0x92a9('0x1'));var moment=require(_0x92a9('0x2'));var BPromise=require(_0x92a9('0x3'));var rs=require(_0x92a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x92a9('0x5'))(_0x92a9('0x6'));var config=require(_0x92a9('0x7'));var jayson=require(_0x92a9('0x8'));const {validateExpressRequest}=require(_0x92a9('0x9'));var client=jayson[_0x92a9('0xa')][_0x92a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xde139e,_0x2e649c,_0x3d1173){return new BPromise(function(_0x51d2e5,_0x4db777){return client[_0x92a9('0xc')](_0xde139e,_0x3d1173)['then'](function(_0x4921b1){logger[_0x92a9('0xd')]('CmHopper,\x20%s,\x20%s',_0x2e649c,_0x92a9('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x2e649c,_0x92a9('0xe'),JSON['stringify'](_0x4921b1));if(_0x4921b1[_0x92a9('0xf')]){if(_0x4921b1[_0x92a9('0xf')]['code']===0x1f4){logger['error'](_0x92a9('0x10'),_0x2e649c,_0x4921b1['error']['message']);return _0x4db777(_0x4921b1['error']['message']);}logger[_0x92a9('0xf')](_0x92a9('0x10'),_0x2e649c,_0x4921b1[_0x92a9('0xf')][_0x92a9('0x11')]);return _0x51d2e5(_0x4921b1[_0x92a9('0xf')][_0x92a9('0x11')]);}else{logger['info'](_0x92a9('0x10'),_0x2e649c,_0x92a9('0xe'));_0x51d2e5(_0x4921b1[_0x92a9('0x12')]['message']);}})[_0x92a9('0x13')](function(_0x4f7826){logger[_0x92a9('0xf')](_0x92a9('0x10'),_0x2e649c,_0x4f7826);_0x4db777(_0x4f7826);});});}exports[_0x92a9('0x14')]=function(_0x54565c){var _0x747c62=this;return new Promise(function(_0x2f3c29,_0x568513){return db[_0x92a9('0x15')][_0x92a9('0x16')]({'raw':_0x54565c[_0x92a9('0x17')]?_0x54565c[_0x92a9('0x17')][_0x92a9('0x18')]===undefined?!![]:![]:!![],'where':_0x54565c[_0x92a9('0x17')]?_0x54565c['options'][_0x92a9('0x19')]||null:null,'attributes':_0x54565c[_0x92a9('0x17')]?_0x54565c[_0x92a9('0x17')][_0x92a9('0x1a')]||null:null,'limit':_0x54565c['options']?_0x54565c[_0x92a9('0x17')][_0x92a9('0x1b')]||null:null,'include':_0x54565c['options']?_0x54565c[_0x92a9('0x17')][_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x54565c[_0x92a9('0x17')][_0x92a9('0x1c')],function(_0x3ce9b7){return{'model':db[_0x3ce9b7['model']],'as':_0x3ce9b7['as'],'attributes':_0x3ce9b7[_0x92a9('0x1a')],'include':_0x3ce9b7[_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x3ce9b7['include'],function(_0x1b5e51){return{'model':db[_0x1b5e51[_0x92a9('0x1e')]],'as':_0x1b5e51['as'],'attributes':_0x1b5e51['attributes'],'include':_0x1b5e51[_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x1b5e51[_0x92a9('0x1c')],function(_0x547a95){return{'model':db[_0x547a95[_0x92a9('0x1e')]],'as':_0x547a95['as'],'attributes':_0x547a95[_0x92a9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x175f6d){logger['info']('GetCmHopper',_0x54565c);logger['debug'](_0x92a9('0x14'),_0x54565c,JSON[_0x92a9('0x1f')](_0x175f6d));_0x2f3c29(_0x175f6d);})[_0x92a9('0x13')](function(_0x1ce10f){logger[_0x92a9('0xf')](_0x92a9('0x14'),_0x1ce10f[_0x92a9('0x11')],_0x54565c);_0x568513(_0x747c62[_0x92a9('0xf')](0x1f4,_0x1ce10f[_0x92a9('0x11')]));});});};exports[_0x92a9('0x20')]=function(_0x289f4d){var _0x23007d=this;return new Promise(function(_0x19ef51,_0x47c1ff){return db[_0x92a9('0x15')][_0x92a9('0x21')]({'raw':_0x289f4d[_0x92a9('0x17')]?_0x289f4d[_0x92a9('0x17')][_0x92a9('0x18')]===undefined?!![]:![]:!![],'where':_0x289f4d[_0x92a9('0x17')]?_0x289f4d['options']['where']||null:null,'attributes':_0x289f4d[_0x92a9('0x17')]?_0x289f4d[_0x92a9('0x17')]['attributes']||null:null,'include':_0x289f4d[_0x92a9('0x17')]?_0x289f4d['options'][_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x289f4d[_0x92a9('0x17')]['include'],function(_0x44152a){return{'model':db[_0x44152a[_0x92a9('0x1e')]],'as':_0x44152a['as'],'attributes':_0x44152a[_0x92a9('0x1a')],'include':_0x44152a[_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x44152a[_0x92a9('0x1c')],function(_0x5a173f){return{'model':db[_0x5a173f[_0x92a9('0x1e')]],'as':_0x5a173f['as'],'attributes':_0x5a173f['attributes'],'include':_0x5a173f[_0x92a9('0x1c')]?_['map'](_0x5a173f['include'],function(_0x5ba59a){return{'model':db[_0x5ba59a[_0x92a9('0x1e')]],'as':_0x5ba59a['as'],'attributes':_0x5ba59a[_0x92a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x92a9('0x22')](function(_0x370756){logger['info'](_0x92a9('0x20'),_0x289f4d);logger[_0x92a9('0x23')](_0x92a9('0x20'),_0x289f4d,JSON[_0x92a9('0x1f')](_0x370756));_0x19ef51(_0x370756);})[_0x92a9('0x13')](function(_0x199ef8){logger[_0x92a9('0xf')](_0x92a9('0x20'),_0x199ef8[_0x92a9('0x11')],_0x289f4d);_0x47c1ff(_0x23007d[_0x92a9('0xf')](0x1f4,_0x199ef8[_0x92a9('0x11')]));});});};exports[_0x92a9('0x24')]=function(_0x121bad){var _0x26d3d6=this;return new Promise(function(_0x1cfae3,_0x4d9e1d){return db['CmHopper']['create'](_0x121bad[_0x92a9('0x25')],{'raw':_0x121bad['options']?_0x121bad[_0x92a9('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x92a9('0x22')](function(_0x436a86){logger[_0x92a9('0xd')](_0x92a9('0x24'),_0x121bad);logger[_0x92a9('0x23')](_0x92a9('0x24'),_0x121bad,JSON[_0x92a9('0x1f')](_0x436a86));_0x1cfae3(_0x436a86);})['catch'](function(_0x3f48a3){logger[_0x92a9('0xf')]('CreateCmHopper',_0x3f48a3[_0x92a9('0x11')],_0x121bad);_0x4d9e1d(_0x26d3d6[_0x92a9('0xf')](0x1f4,_0x3f48a3['message']));});});};exports[_0x92a9('0x26')]=function(_0x3c5bac){var _0x337d9a=this;return new Promise(function(_0x3eb1b1,_0x53f284){return db['CmHopper'][_0x92a9('0x27')](_0x3c5bac[_0x92a9('0x25')],{'raw':_0x3c5bac[_0x92a9('0x17')]?_0x3c5bac['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c5bac[_0x92a9('0x17')]?_0x3c5bac['options']['where']||null:null,'attributes':_0x3c5bac[_0x92a9('0x17')]?_0x3c5bac[_0x92a9('0x17')]['attributes']||null:null,'limit':_0x3c5bac['options']?_0x3c5bac[_0x92a9('0x17')]['limit']||null:null})[_0x92a9('0x22')](function(_0x3df4e7){logger[_0x92a9('0xd')]('UpdateCmHopper',_0x3c5bac);logger[_0x92a9('0xd')](_0x92a9('0x28'),JSON[_0x92a9('0x1f')](_0x3c5bac[_0x92a9('0x17')][_0x92a9('0x19')]),_0x3c5bac[_0x92a9('0x25')][_0x92a9('0x29')]);logger[_0x92a9('0x23')](_0x92a9('0x26'),_0x3c5bac,JSON['stringify'](_0x3df4e7));_0x3eb1b1(_0x3df4e7);})[_0x92a9('0x13')](function(_0xb61f69){logger[_0x92a9('0xf')](_0x92a9('0x26'),_0xb61f69['message'],_0x3c5bac);_0x53f284(_0x337d9a[_0x92a9('0xf')](0x1f4,_0xb61f69[_0x92a9('0x11')]));});});};exports[_0x92a9('0x2a')]=function(_0x1f6d8d){var _0x4c45de=this;return new Promise(function(_0x2a8f38,_0xdfd0fe){return db['CmHopper'][_0x92a9('0x2b')]({'where':_0x1f6d8d[_0x92a9('0x17')]?_0x1f6d8d[_0x92a9('0x17')][_0x92a9('0x19')]||null:null})[_0x92a9('0x22')](function(_0xe5f5f8){logger[_0x92a9('0xd')](_0x92a9('0x2a'),_0x1f6d8d);logger[_0x92a9('0x23')](_0x92a9('0x2a'),_0x1f6d8d,JSON[_0x92a9('0x1f')](_0xe5f5f8));_0x2a8f38(_0xe5f5f8);})[_0x92a9('0x13')](function(_0x58274a){logger[_0x92a9('0xf')]('DestroyCmHopper',_0x58274a['message'],_0x1f6d8d);_0xdfd0fe(_0x4c45de['error'](0x1f4,_0x58274a[_0x92a9('0x11')]));});});};exports[_0x92a9('0x2c')]=function(_0x14d955){var _0x202519=this;return new Promise(function(_0x31670e,_0x3295d5){return db['CmContact'][_0x92a9('0x2d')]()[_0x92a9('0x22')](function(_0x26acd7){return db['sequelize'][_0x92a9('0x2e')](function(_0x232bb2){return db[_0x92a9('0x15')]['findAll']({'where':_0x14d955[_0x92a9('0x17')]?_0x14d955[_0x92a9('0x17')][_0x92a9('0x19')]||null:null,'attributes':_0x14d955[_0x92a9('0x17')]?_0x14d955['options'][_0x92a9('0x1a')]||null:null,'limit':_0x14d955[_0x92a9('0x17')]?_0x14d955[_0x92a9('0x17')][_0x92a9('0x1b')]||null:null,'order':_0x14d955[_0x92a9('0x17')]?_0x14d955[_0x92a9('0x17')]['order']||null:null,'transaction':_0x232bb2,'lock':_0x232bb2[_0x92a9('0x2f')]['UPDATE'],'include':[{'model':db[_0x92a9('0x30')],'as':_0x92a9('0x31'),'attributes':_['keys'](_0x26acd7)},{'model':db[_0x92a9('0x32')],'as':'Agent','attributes':['id',_0x92a9('0x33'),_0x92a9('0x34')]}]})[_0x92a9('0x22')](function(_0x130a7a){var _0x2ca35b=[];var _0x794d3d=[];for(var _0x28932b=0x0;_0x28932b<_0x130a7a[_0x92a9('0x35')];_0x28932b+=0x1){var _0xa94b85=_0x130a7a[_0x28932b][_0x92a9('0x36')];if(_0xa94b85===null){_0x2ca35b[_0x92a9('0x37')](_0x130a7a[_0x28932b][_0x92a9('0x27')](_0x14d955[_0x92a9('0x25')],{'transaction':_0x232bb2}));}else if(!_0x794d3d[_0x92a9('0x38')](_0xa94b85)){_0x794d3d[_0x92a9('0x37')](_0xa94b85);_0x2ca35b[_0x92a9('0x37')](_0x130a7a[_0x28932b]['update'](_0x14d955[_0x92a9('0x25')],{'transaction':_0x232bb2}));}}return BPromise[_0x92a9('0x39')](_0x2ca35b);});})['then'](function(_0x1e3b08){logger[_0x92a9('0xd')]('GetContactDialer',_0x14d955);if(_0x1e3b08[_0x92a9('0x35')]>0x0){logger[_0x92a9('0xd')](_0x92a9('0x3a'),_0x1e3b08[0x0][_0x92a9('0x3b')]['id'],_0x1e3b08[0x0][_0x92a9('0x3b')][_0x92a9('0x3c')],_0x1e3b08[0x0][_0x92a9('0x3b')][_0x92a9('0x29')]);}logger['debug']('GetContactDialer',_0x14d955,JSON['stringify'](_0x1e3b08));_0x31670e(_0x1e3b08);})[_0x92a9('0x13')](function(_0x3ec1d2){logger[_0x92a9('0xf')](_0x92a9('0x2c'),_0x3ec1d2['message'],_0x14d955);_0x3295d5(_0x202519[_0x92a9('0xf')](0x1f4,_0x3ec1d2[_0x92a9('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x1c7600){var _0x584402=this;return new Promise(function(_0x3fac2d,_0x55aeca){return db[_0x92a9('0x3d')][_0x92a9('0x2e')](function(_0x4ba61c){return db[_0x92a9('0x3e')][_0x92a9('0x3f')](_0x1c7600[_0x92a9('0x25')],{'raw':_0x1c7600[_0x92a9('0x17')]?_0x1c7600[_0x92a9('0x17')][_0x92a9('0x18')]===undefined?!![]:![]:!![],'transaction':_0x4ba61c})['then'](function(){logger[_0x92a9('0xd')](_0x92a9('0x40'),JSON['stringify'](_0x1c7600[_0x92a9('0x17')]['where']),_0x1c7600[_0x92a9('0x17')][_0x92a9('0x19')][_0x92a9('0x29')]);return db[_0x92a9('0x15')]['destroy']({'where':_0x1c7600['options']?_0x1c7600['options'][_0x92a9('0x19')]||null:null,'transaction':_0x4ba61c});});})[_0x92a9('0x22')](function(_0x25f3f6){logger['info'](_0x92a9('0x41'),_0x1c7600);logger[_0x92a9('0x23')](_0x92a9('0x41'),_0x1c7600,JSON[_0x92a9('0x1f')](_0x25f3f6));_0x3fac2d(_0x25f3f6);})[_0x92a9('0x13')](function(_0x5c0851){logger[_0x92a9('0xf')](_0x92a9('0x41'),_0x5c0851[_0x92a9('0x11')],_0x1c7600);_0x55aeca(_0x584402['error'](0x1f4,_0x5c0851[_0x92a9('0x11')]));});});};exports[_0x92a9('0x42')]=function(_0x46847c){var _0x4704b0=this;return new Promise(function(_0x1c8804,_0x20962b){return db[_0x92a9('0x15')][_0x92a9('0x16')]({'raw':_0x46847c['options']?_0x46847c['options'][_0x92a9('0x18')]===undefined?!![]:![]:!![],'where':_0x46847c['options']?_0x46847c[_0x92a9('0x17')][_0x92a9('0x19')]||null:null,'attributes':[[db[_0x92a9('0x3d')]['fn'](_0x92a9('0x43'),db[_0x92a9('0x3d')]['fn']('IF',db[_0x92a9('0x3d')][_0x92a9('0x44')](_0x92a9('0x45')+util[_0x92a9('0x46')](_0x92a9('0x47'),moment()[_0x92a9('0x46')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x92a9('0x48')]]})[_0x92a9('0x22')](function(_0x4f05c1){logger[_0x92a9('0xd')](_0x92a9('0x42'),_0x46847c);logger[_0x92a9('0x23')]('CountReScheduled',_0x46847c,JSON[_0x92a9('0x1f')](_0x4f05c1));_0x1c8804(_0x4f05c1);})[_0x92a9('0x13')](function(_0x249375){logger[_0x92a9('0xf')]('CountReScheduled',_0x249375[_0x92a9('0x11')],_0x46847c);_0x20962b(_0x4704b0[_0x92a9('0xf')](0x1f4,_0x249375[_0x92a9('0x11')]));});});};exports[_0x92a9('0x49')]=function(_0x3e0238){var _0x341712=this;return new Promise(function(_0x167a98,_0x498ec0){return db[_0x92a9('0x30')][_0x92a9('0x2d')]()[_0x92a9('0x22')](function(_0x583fd4){return db[_0x92a9('0x3d')][_0x92a9('0x2e')](function(_0x4ddf93){return db['CmHopper'][_0x92a9('0x16')]({'where':_0x3e0238[_0x92a9('0x17')]?_0x3e0238['options'][_0x92a9('0x19')]||null:null,'attributes':_0x3e0238[_0x92a9('0x17')]?_0x3e0238[_0x92a9('0x17')][_0x92a9('0x1a')]||null:null,'limit':0x1,'order':_0x3e0238[_0x92a9('0x17')]?_0x3e0238[_0x92a9('0x17')][_0x92a9('0x4a')]||null:null,'group':db[_0x92a9('0x15')][_0x92a9('0x36')],'transaction':_0x4ddf93,'lock':_0x4ddf93[_0x92a9('0x2f')][_0x92a9('0x4b')],'include':_0x3e0238[_0x92a9('0x17')]?_0x3e0238['options'][_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x3e0238[_0x92a9('0x17')][_0x92a9('0x1c')],function(_0x518a44){return{'model':db[_0x518a44['model']],'as':_0x518a44['as'],'attributes':_0x518a44['attributes'],'include':_0x518a44[_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x518a44[_0x92a9('0x1c')],function(_0x31a9ac){return{'model':db[_0x31a9ac['model']],'as':_0x31a9ac['as'],'attributes':_0x31a9ac[_0x92a9('0x1a')],'include':_0x31a9ac['include']?_[_0x92a9('0x1d')](_0x31a9ac['include'],function(_0x5c739e){return{'model':db[_0x5c739e['model']],'as':_0x5c739e['as'],'attributes':_0x5c739e[_0x92a9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a00d5){var _0x3f13b3=[];for(var _0x4da890=0x0;_0x4da890<_0x5a00d5['length'];_0x4da890+=0x1){_0x3f13b3['push'](_0x5a00d5[_0x4da890][_0x92a9('0x27')](_0x3e0238[_0x92a9('0x25')],{'transaction':_0x4ddf93}));}return BPromise[_0x92a9('0x39')](_0x3f13b3);});})[_0x92a9('0x22')](function(_0x1551e3){logger[_0x92a9('0xd')](_0x92a9('0x49'),_0x3e0238);logger[_0x92a9('0x23')]('GetContactRecallMe',_0x3e0238,JSON[_0x92a9('0x1f')](_0x1551e3));_0x167a98(_0x1551e3);})[_0x92a9('0x13')](function(_0xb9e570){logger[_0x92a9('0xf')](_0x92a9('0x49'),_0xb9e570['message'],_0x3e0238);_0x498ec0(_0x341712[_0x92a9('0xf')](0x1f4,_0xb9e570[_0x92a9('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x4c10fc){var _0x36ea04=this;return new Promise(function(_0x36e8fd,_0xc21038){db[_0x92a9('0x30')][_0x92a9('0x2d')]()[_0x92a9('0x22')](function(_0x3a94a4){return db[_0x92a9('0x15')]['findAll']({'raw':_0x4c10fc['options']?_0x4c10fc[_0x92a9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4c10fc['options']?_0x4c10fc[_0x92a9('0x17')][_0x92a9('0x19')]||null:null,'attributes':_0x4c10fc['options']?_0x4c10fc[_0x92a9('0x17')]['attributes']||null:null,'limit':_0x4c10fc[_0x92a9('0x17')]?_0x4c10fc[_0x92a9('0x17')]['limit']||null:null,'include':_0x4c10fc['options']?_0x4c10fc['options']['include']?_['map'](_0x4c10fc[_0x92a9('0x17')]['include'],function(_0xc39526){return{'model':db[_0xc39526[_0x92a9('0x1e')]],'as':_0xc39526['as'],'attributes':_0xc39526['as']===_0x92a9('0x31')?_['keys'](_0x3a94a4):_0xc39526[_0x92a9('0x1a')],'include':_0xc39526['include']?_['map'](_0xc39526[_0x92a9('0x1c')],function(_0x1a2954){return{'model':db[_0x1a2954[_0x92a9('0x1e')]],'as':_0x1a2954['as'],'attributes':_0x1a2954[_0x92a9('0x1a')],'include':_0x1a2954[_0x92a9('0x1c')]?_['map'](_0x1a2954[_0x92a9('0x1c')],function(_0x3b8129){return{'model':db[_0x3b8129[_0x92a9('0x1e')]],'as':_0x3b8129['as'],'attributes':_0x3b8129[_0x92a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x92a9('0x22')](function(_0x31db03){logger[_0x92a9('0xd')]('GetCmHopper',_0x4c10fc);logger['debug'](_0x92a9('0x14'),_0x4c10fc,JSON[_0x92a9('0x1f')](_0x31db03));_0x36e8fd(_0x31db03);})[_0x92a9('0x13')](function(_0x5d1547){logger['error'](_0x92a9('0x14'),_0x5d1547['message'],_0x4c10fc);_0xc21038(_0x36ea04[_0x92a9('0xf')](0x1f4,_0x5d1547[_0x92a9('0x11')]));});});});};exports['GetContactByPhone']=function(_0x27dcb4){var _0x59156a=this;return new Promise(function(_0x3fa2a9,_0x1e48e7){return db['CmContact'][_0x92a9('0x4c')]({'raw':!![],'where':{'phone':_0x27dcb4[_0x92a9('0x17')][_0x92a9('0x19')][_0x92a9('0x4d')]},'attributes':['id',_0x92a9('0x4e')],'order':[['id',_0x92a9('0x4f')]]})[_0x92a9('0x22')](function(_0x46a59a){logger['info']('getContactByPhone',_0x27dcb4);logger['debug'](_0x92a9('0x50'),_0x27dcb4,JSON['stringify'](_0x46a59a));_0x3fa2a9(_0x46a59a);})[_0x92a9('0x13')](function(_0x286144){logger[_0x92a9('0xf')](_0x92a9('0x50'),_0x286144['message'],_0x27dcb4);_0x1e48e7(_0x59156a[_0x92a9('0xf')](0x1f4,_0x286144[_0x92a9('0x11')]));});});};exports[_0x92a9('0x51')]=function(_0x30e850){var _0x2350c4=this;return new Promise(function(_0x340970,_0x1ed895){return db[_0x92a9('0x3d')][_0x92a9('0x2e')](function(_0x3a4ccf){return db[_0x92a9('0x15')][_0x92a9('0x27')]({'active':![]},{'where':{},'transaction':_0x3a4ccf})[_0x92a9('0x22')](function(_0x3bb7ec){logger['info']('ResetActiveCalls',_0x30e850);logger[_0x92a9('0x23')](_0x92a9('0x51'),_0x30e850,JSON['stringify'](_0x3bb7ec));_0x340970(_0x3bb7ec);})[_0x92a9('0x13')](function(_0x55f4d5){logger[_0x92a9('0xf')](_0x92a9('0x51'),_0x55f4d5['message'],_0x30e850);_0x1ed895(_0x2350c4[_0x92a9('0xf')](0x1f4,_0x55f4d5[_0x92a9('0x11')]));});});});};exports[_0x92a9('0x52')]=function(_0x408d0d){var _0x14fab9=this;var _0x2b9357=_0x408d0d[_0x92a9('0x25')][_0x92a9('0x19')][_0x92a9('0x53')];var _0x322c0a=_0x408d0d[_0x92a9('0x25')][_0x92a9('0x19')]['interval'];return new Promise(function(_0x6082f3,_0x495478){return db[_0x92a9('0x15')]['findAll']({'where':{'voiceQueueId':_0x2b9357,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x92a9('0x3d')][_0x92a9('0x44')](_0x92a9('0x54')+_0x322c0a+_0x92a9('0x55'))}},'include':[{'model':db[_0x92a9('0x30')],'as':'Contact'},{'model':db[_0x92a9('0x32')],'as':_0x92a9('0x56'),'attributes':['id',_0x92a9('0x33'),_0x92a9('0x34')]},{'model':db[_0x92a9('0x57')],'as':'List'}]})[_0x92a9('0x22')](function(_0x42a761){return db[_0x92a9('0x3d')][_0x92a9('0x2e')](function(_0x5b208c){return db[_0x92a9('0x15')][_0x92a9('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x2b9357,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x92a9('0x3d')][_0x92a9('0x44')]('NOW()\x20+\x20INTERVAL\x20'+_0x322c0a+'\x20MINUTE')}},'transaction':_0x5b208c})[_0x92a9('0x22')](function(_0xe8231d){_0x6082f3(_0x42a761);})[_0x92a9('0x13')](function(_0x23e883){logger[_0x92a9('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x23e883[_0x92a9('0x11')],_0x408d0d);_0x495478(validateExpressRequest);});});})[_0x92a9('0x13')](function(_0x52325e){logger[_0x92a9('0xf')](_0x92a9('0x52'),_0x52325e[_0x92a9('0x11')],_0x408d0d);_0x495478(_0x14fab9[_0x92a9('0xf')](0x1f4,_0x52325e[_0x92a9('0x11')]));});});}; \ No newline at end of file +var _0x32e0=['body','CreateCmHopper','catch','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','Agent','name','voicePause','UserId','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','length','GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','interval','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','CmList','List','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','message','result','GetCmHopper','options','where','attributes','limit','include','map','model','info','stringify','ShowCmHopper','CmHopper','raw','create'];(function(_0x1c7113,_0x1fe6a8){var _0x28a5bf=function(_0x414967){while(--_0x414967){_0x1c7113['push'](_0x1c7113['shift']());}};_0x28a5bf(++_0x1fe6a8);}(_0x32e0,0x8a));var _0x032e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x32e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x032e('0x0'));var util=require(_0x032e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x032e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x032e('0x3'))['db'];var utils=require(_0x032e('0x4'));var logger=require(_0x032e('0x5'))(_0x032e('0x6'));var config=require('../../config/environment');var jayson=require(_0x032e('0x7'));const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0x032e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28a247,_0x528827,_0x20dbfc){return new BPromise(function(_0x58f627,_0x17ef03){return client[_0x032e('0x9')](_0x28a247,_0x20dbfc)[_0x032e('0xa')](function(_0x4a1faf){logger['info'](_0x032e('0xb'),_0x528827,_0x032e('0xc'));logger[_0x032e('0xd')](_0x032e('0xe'),_0x528827,_0x032e('0xc'),JSON['stringify'](_0x4a1faf));if(_0x4a1faf[_0x032e('0xf')]){if(_0x4a1faf[_0x032e('0xf')]['code']===0x1f4){logger['error'](_0x032e('0xb'),_0x528827,_0x4a1faf['error'][_0x032e('0x10')]);return _0x17ef03(_0x4a1faf[_0x032e('0xf')]['message']);}logger[_0x032e('0xf')](_0x032e('0xb'),_0x528827,_0x4a1faf[_0x032e('0xf')][_0x032e('0x10')]);return _0x58f627(_0x4a1faf[_0x032e('0xf')][_0x032e('0x10')]);}else{logger['info'](_0x032e('0xb'),_0x528827,_0x032e('0xc'));_0x58f627(_0x4a1faf[_0x032e('0x11')][_0x032e('0x10')]);}})['catch'](function(_0x2a7e27){logger['error'](_0x032e('0xb'),_0x528827,_0x2a7e27);_0x17ef03(_0x2a7e27);});});}exports[_0x032e('0x12')]=function(_0x172f6d){var _0x380e97=this;return new Promise(function(_0x3f06c3,_0x1b71d1){return db['CmHopper']['findAll']({'raw':_0x172f6d[_0x032e('0x13')]?_0x172f6d[_0x032e('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x172f6d[_0x032e('0x13')]?_0x172f6d['options'][_0x032e('0x14')]||null:null,'attributes':_0x172f6d[_0x032e('0x13')]?_0x172f6d[_0x032e('0x13')][_0x032e('0x15')]||null:null,'limit':_0x172f6d[_0x032e('0x13')]?_0x172f6d[_0x032e('0x13')][_0x032e('0x16')]||null:null,'include':_0x172f6d[_0x032e('0x13')]?_0x172f6d[_0x032e('0x13')][_0x032e('0x17')]?_[_0x032e('0x18')](_0x172f6d[_0x032e('0x13')][_0x032e('0x17')],function(_0x4ec9aa){return{'model':db[_0x4ec9aa['model']],'as':_0x4ec9aa['as'],'attributes':_0x4ec9aa[_0x032e('0x15')],'include':_0x4ec9aa[_0x032e('0x17')]?_[_0x032e('0x18')](_0x4ec9aa[_0x032e('0x17')],function(_0x3331b4){return{'model':db[_0x3331b4[_0x032e('0x19')]],'as':_0x3331b4['as'],'attributes':_0x3331b4[_0x032e('0x15')],'include':_0x3331b4['include']?_['map'](_0x3331b4[_0x032e('0x17')],function(_0xd9d9ec){return{'model':db[_0xd9d9ec['model']],'as':_0xd9d9ec['as'],'attributes':_0xd9d9ec[_0x032e('0x15')]};}):[]};}):[]};}):[]:[]})[_0x032e('0xa')](function(_0x40b317){logger[_0x032e('0x1a')]('GetCmHopper',_0x172f6d);logger[_0x032e('0xd')]('GetCmHopper',_0x172f6d,JSON[_0x032e('0x1b')](_0x40b317));_0x3f06c3(_0x40b317);})['catch'](function(_0xa5c88c){logger[_0x032e('0xf')](_0x032e('0x12'),_0xa5c88c['message'],_0x172f6d);_0x1b71d1(_0x380e97[_0x032e('0xf')](0x1f4,_0xa5c88c[_0x032e('0x10')]));});});};exports[_0x032e('0x1c')]=function(_0x111404){var _0x3b191b=this;return new Promise(function(_0x2a3830,_0x13cef6){return db[_0x032e('0x1d')]['find']({'raw':_0x111404['options']?_0x111404[_0x032e('0x13')][_0x032e('0x1e')]===undefined?!![]:![]:!![],'where':_0x111404['options']?_0x111404['options'][_0x032e('0x14')]||null:null,'attributes':_0x111404['options']?_0x111404[_0x032e('0x13')][_0x032e('0x15')]||null:null,'include':_0x111404[_0x032e('0x13')]?_0x111404[_0x032e('0x13')]['include']?_[_0x032e('0x18')](_0x111404[_0x032e('0x13')][_0x032e('0x17')],function(_0x529917){return{'model':db[_0x529917[_0x032e('0x19')]],'as':_0x529917['as'],'attributes':_0x529917[_0x032e('0x15')],'include':_0x529917[_0x032e('0x17')]?_['map'](_0x529917[_0x032e('0x17')],function(_0x4c11e4){return{'model':db[_0x4c11e4['model']],'as':_0x4c11e4['as'],'attributes':_0x4c11e4[_0x032e('0x15')],'include':_0x4c11e4[_0x032e('0x17')]?_['map'](_0x4c11e4[_0x032e('0x17')],function(_0x425ed7){return{'model':db[_0x425ed7[_0x032e('0x19')]],'as':_0x425ed7['as'],'attributes':_0x425ed7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27fa1c){logger[_0x032e('0x1a')](_0x032e('0x1c'),_0x111404);logger[_0x032e('0xd')](_0x032e('0x1c'),_0x111404,JSON[_0x032e('0x1b')](_0x27fa1c));_0x2a3830(_0x27fa1c);})['catch'](function(_0x13fda4){logger[_0x032e('0xf')](_0x032e('0x1c'),_0x13fda4[_0x032e('0x10')],_0x111404);_0x13cef6(_0x3b191b[_0x032e('0xf')](0x1f4,_0x13fda4[_0x032e('0x10')]));});});};exports['CreateCmHopper']=function(_0x2cfc61){var _0x1ad65e=this;return new Promise(function(_0x1bd74d,_0x113bb5){return db[_0x032e('0x1d')][_0x032e('0x1f')](_0x2cfc61[_0x032e('0x20')],{'raw':_0x2cfc61[_0x032e('0x13')]?_0x2cfc61[_0x032e('0x13')][_0x032e('0x1e')]===undefined?!![]:![]:!![]})[_0x032e('0xa')](function(_0x283159){logger[_0x032e('0x1a')]('CreateCmHopper',_0x2cfc61);logger[_0x032e('0xd')](_0x032e('0x21'),_0x2cfc61,JSON[_0x032e('0x1b')](_0x283159));_0x1bd74d(_0x283159);})[_0x032e('0x22')](function(_0x1ae2f5){logger[_0x032e('0xf')](_0x032e('0x21'),_0x1ae2f5[_0x032e('0x10')],_0x2cfc61);_0x113bb5(_0x1ad65e['error'](0x1f4,_0x1ae2f5[_0x032e('0x10')]));});});};exports[_0x032e('0x23')]=function(_0x17ccbd){var _0x1431ee=this;return new Promise(function(_0x729748,_0x216c4c){return db[_0x032e('0x1d')][_0x032e('0x24')](_0x17ccbd[_0x032e('0x20')],{'raw':_0x17ccbd[_0x032e('0x13')]?_0x17ccbd['options'][_0x032e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17ccbd[_0x032e('0x13')]?_0x17ccbd[_0x032e('0x13')][_0x032e('0x14')]||null:null,'attributes':_0x17ccbd['options']?_0x17ccbd[_0x032e('0x13')][_0x032e('0x15')]||null:null,'limit':_0x17ccbd[_0x032e('0x13')]?_0x17ccbd[_0x032e('0x13')][_0x032e('0x16')]||null:null})[_0x032e('0xa')](function(_0x1c114a){logger[_0x032e('0x1a')]('UpdateCmHopper',_0x17ccbd);logger['info'](_0x032e('0x25'),JSON['stringify'](_0x17ccbd[_0x032e('0x13')][_0x032e('0x14')]),_0x17ccbd['body']['active']);logger[_0x032e('0xd')](_0x032e('0x23'),_0x17ccbd,JSON['stringify'](_0x1c114a));_0x729748(_0x1c114a);})['catch'](function(_0x5e0b25){logger[_0x032e('0xf')]('UpdateCmHopper',_0x5e0b25[_0x032e('0x10')],_0x17ccbd);_0x216c4c(_0x1431ee[_0x032e('0xf')](0x1f4,_0x5e0b25[_0x032e('0x10')]));});});};exports[_0x032e('0x26')]=function(_0x10356a){var _0x14ab5c=this;return new Promise(function(_0x408a92,_0x43fc86){return db[_0x032e('0x1d')][_0x032e('0x27')]({'where':_0x10356a[_0x032e('0x13')]?_0x10356a[_0x032e('0x13')][_0x032e('0x14')]||null:null})[_0x032e('0xa')](function(_0x56b867){logger[_0x032e('0x1a')]('DestroyCmHopper',_0x10356a);logger[_0x032e('0xd')](_0x032e('0x26'),_0x10356a,JSON[_0x032e('0x1b')](_0x56b867));_0x408a92(_0x56b867);})[_0x032e('0x22')](function(_0x2df15){logger[_0x032e('0xf')](_0x032e('0x26'),_0x2df15[_0x032e('0x10')],_0x10356a);_0x43fc86(_0x14ab5c[_0x032e('0xf')](0x1f4,_0x2df15['message']));});});};exports[_0x032e('0x28')]=function(_0x383603){var _0x3883ed=this;return new Promise(function(_0x2cd2fd,_0x40f0ea){return db[_0x032e('0x29')][_0x032e('0x2a')]()[_0x032e('0xa')](function(_0x34e0fe){return db[_0x032e('0x2b')][_0x032e('0x2c')](function(_0x5bf4d1){return db[_0x032e('0x1d')][_0x032e('0x2d')]({'where':_0x383603[_0x032e('0x13')]?_0x383603[_0x032e('0x13')]['where']||null:null,'attributes':_0x383603[_0x032e('0x13')]?_0x383603[_0x032e('0x13')][_0x032e('0x15')]||null:null,'limit':_0x383603[_0x032e('0x13')]?_0x383603[_0x032e('0x13')][_0x032e('0x16')]||null:null,'order':_0x383603[_0x032e('0x13')]?_0x383603[_0x032e('0x13')][_0x032e('0x2e')]||null:null,'transaction':_0x5bf4d1,'lock':_0x5bf4d1[_0x032e('0x2f')][_0x032e('0x30')],'include':[{'model':db[_0x032e('0x29')],'as':_0x032e('0x31'),'attributes':_[_0x032e('0x32')](_0x34e0fe)},{'model':db['User'],'as':_0x032e('0x33'),'attributes':['id',_0x032e('0x34'),_0x032e('0x35')]}]})[_0x032e('0xa')](function(_0x25d3c){var _0x30871f=[];var _0x5e6b30=[];for(var _0xd727f=0x0;_0xd727f<_0x25d3c['length'];_0xd727f+=0x1){var _0x1468fa=_0x25d3c[_0xd727f][_0x032e('0x36')];if(_0x1468fa===null){_0x30871f['push'](_0x25d3c[_0xd727f][_0x032e('0x24')](_0x383603[_0x032e('0x20')],{'transaction':_0x5bf4d1}));}else if(!_0x5e6b30[_0x032e('0x37')](_0x1468fa)){_0x5e6b30[_0x032e('0x38')](_0x1468fa);_0x30871f['push'](_0x25d3c[_0xd727f]['update'](_0x383603[_0x032e('0x20')],{'transaction':_0x5bf4d1}));}}return BPromise[_0x032e('0x39')](_0x30871f);});})['then'](function(_0x3df052){logger['info']('GetContactDialer',_0x383603);if(_0x3df052['length']>0x0){logger['info'](_0x032e('0x3a'),_0x3df052[0x0][_0x032e('0x3b')]['id'],_0x3df052[0x0]['dataValues']['ContactId'],_0x3df052[0x0][_0x032e('0x3b')][_0x032e('0x3c')]);}logger[_0x032e('0xd')](_0x032e('0x28'),_0x383603,JSON[_0x032e('0x1b')](_0x3df052));_0x2cd2fd(_0x3df052);})[_0x032e('0x22')](function(_0x385668){logger[_0x032e('0xf')](_0x032e('0x28'),_0x385668[_0x032e('0x10')],_0x383603);_0x40f0ea(_0x3883ed[_0x032e('0xf')](0x1f4,_0x385668[_0x032e('0x10')]));});});});};exports[_0x032e('0x3d')]=function(_0x16de71){var _0x21c272=this;return new Promise(function(_0x129a77,_0x2617e1){return db[_0x032e('0x2b')][_0x032e('0x2c')](function(_0x42771a){return db['CmHopperFinal'][_0x032e('0x1f')](_0x16de71[_0x032e('0x20')],{'raw':_0x16de71['options']?_0x16de71['options'][_0x032e('0x1e')]===undefined?!![]:![]:!![],'transaction':_0x42771a})[_0x032e('0xa')](function(){logger[_0x032e('0x1a')](_0x032e('0x3e'),JSON['stringify'](_0x16de71['options'][_0x032e('0x14')]),_0x16de71[_0x032e('0x13')][_0x032e('0x14')][_0x032e('0x3c')]);return db[_0x032e('0x1d')][_0x032e('0x27')]({'where':_0x16de71[_0x032e('0x13')]?_0x16de71['options'][_0x032e('0x14')]||null:null,'transaction':_0x42771a});});})[_0x032e('0xa')](function(_0x2d46e4){logger[_0x032e('0x1a')](_0x032e('0x3d'),_0x16de71);logger[_0x032e('0xd')](_0x032e('0x3d'),_0x16de71,JSON[_0x032e('0x1b')](_0x2d46e4));_0x129a77(_0x2d46e4);})['catch'](function(_0x4689ea){logger['error'](_0x032e('0x3d'),_0x4689ea[_0x032e('0x10')],_0x16de71);_0x2617e1(_0x21c272['error'](0x1f4,_0x4689ea[_0x032e('0x10')]));});});};exports[_0x032e('0x3f')]=function(_0x552aae){var _0x573050=this;return new Promise(function(_0x1c67c6,_0x593e48){return db[_0x032e('0x1d')][_0x032e('0x2d')]({'raw':_0x552aae['options']?_0x552aae[_0x032e('0x13')][_0x032e('0x1e')]===undefined?!![]:![]:!![],'where':_0x552aae[_0x032e('0x13')]?_0x552aae[_0x032e('0x13')][_0x032e('0x14')]||null:null,'attributes':[[db[_0x032e('0x2b')]['fn']('COUNT',db[_0x032e('0x2b')]['fn']('IF',db['sequelize']['literal'](_0x032e('0x40')+util['format'](_0x032e('0x41'),moment()[_0x032e('0x42')](_0x032e('0x43')))+'\x20,\x201,\x20null'))),_0x032e('0x44')]]})[_0x032e('0xa')](function(_0x2164d1){logger[_0x032e('0x1a')](_0x032e('0x3f'),_0x552aae);logger[_0x032e('0xd')](_0x032e('0x3f'),_0x552aae,JSON[_0x032e('0x1b')](_0x2164d1));_0x1c67c6(_0x2164d1);})['catch'](function(_0x3e59a5){logger[_0x032e('0xf')](_0x032e('0x3f'),_0x3e59a5['message'],_0x552aae);_0x593e48(_0x573050[_0x032e('0xf')](0x1f4,_0x3e59a5['message']));});});};exports[_0x032e('0x45')]=function(_0xdba213){var _0x361a64=this;return new Promise(function(_0x715428,_0xbdc30){return db[_0x032e('0x29')][_0x032e('0x2a')]()[_0x032e('0xa')](function(_0x543f97){return db[_0x032e('0x2b')][_0x032e('0x2c')](function(_0x560b65){return db[_0x032e('0x1d')][_0x032e('0x2d')]({'where':_0xdba213[_0x032e('0x13')]?_0xdba213[_0x032e('0x13')][_0x032e('0x14')]||null:null,'attributes':_0xdba213[_0x032e('0x13')]?_0xdba213[_0x032e('0x13')][_0x032e('0x15')]||null:null,'limit':0x1,'order':_0xdba213[_0x032e('0x13')]?_0xdba213[_0x032e('0x13')][_0x032e('0x2e')]||null:null,'group':db[_0x032e('0x1d')]['UserId'],'transaction':_0x560b65,'lock':_0x560b65['LOCK'][_0x032e('0x30')],'include':_0xdba213[_0x032e('0x13')]?_0xdba213['options'][_0x032e('0x17')]?_[_0x032e('0x18')](_0xdba213[_0x032e('0x13')][_0x032e('0x17')],function(_0x4f2b8f){return{'model':db[_0x4f2b8f[_0x032e('0x19')]],'as':_0x4f2b8f['as'],'attributes':_0x4f2b8f[_0x032e('0x15')],'include':_0x4f2b8f[_0x032e('0x17')]?_[_0x032e('0x18')](_0x4f2b8f[_0x032e('0x17')],function(_0x3ff6c9){return{'model':db[_0x3ff6c9[_0x032e('0x19')]],'as':_0x3ff6c9['as'],'attributes':_0x3ff6c9['attributes'],'include':_0x3ff6c9[_0x032e('0x17')]?_[_0x032e('0x18')](_0x3ff6c9[_0x032e('0x17')],function(_0xe74dd4){return{'model':db[_0xe74dd4[_0x032e('0x19')]],'as':_0xe74dd4['as'],'attributes':_0xe74dd4['attributes']};}):[]};}):[]};}):[]:[]})[_0x032e('0xa')](function(_0x149507){var _0x7c78b7=[];for(var _0x2d8c7d=0x0;_0x2d8c7d<_0x149507[_0x032e('0x46')];_0x2d8c7d+=0x1){_0x7c78b7[_0x032e('0x38')](_0x149507[_0x2d8c7d][_0x032e('0x24')](_0xdba213[_0x032e('0x20')],{'transaction':_0x560b65}));}return BPromise[_0x032e('0x39')](_0x7c78b7);});})[_0x032e('0xa')](function(_0x39151){logger[_0x032e('0x1a')](_0x032e('0x45'),_0xdba213);logger[_0x032e('0xd')]('GetContactRecallMe',_0xdba213,JSON[_0x032e('0x1b')](_0x39151));_0x715428(_0x39151);})[_0x032e('0x22')](function(_0x3b3eaf){logger['error']('GetContactRecallMe',_0x3b3eaf['message'],_0xdba213);_0xbdc30(_0x361a64[_0x032e('0xf')](0x1f4,_0x3b3eaf[_0x032e('0x10')]));});});});};exports[_0x032e('0x47')]=function(_0x519a34){var _0x40b47b=this;return new Promise(function(_0x9c4db6,_0x1c4f4c){db['CmContact']['describe']()[_0x032e('0xa')](function(_0x43041f){return db[_0x032e('0x1d')][_0x032e('0x2d')]({'raw':_0x519a34['options']?_0x519a34['options'][_0x032e('0x1e')]===undefined?!![]:![]:!![],'where':_0x519a34['options']?_0x519a34[_0x032e('0x13')]['where']||null:null,'attributes':_0x519a34[_0x032e('0x13')]?_0x519a34['options'][_0x032e('0x15')]||null:null,'limit':_0x519a34[_0x032e('0x13')]?_0x519a34[_0x032e('0x13')][_0x032e('0x16')]||null:null,'include':_0x519a34[_0x032e('0x13')]?_0x519a34['options'][_0x032e('0x17')]?_[_0x032e('0x18')](_0x519a34[_0x032e('0x13')]['include'],function(_0x5523c6){return{'model':db[_0x5523c6[_0x032e('0x19')]],'as':_0x5523c6['as'],'attributes':_0x5523c6['as']===_0x032e('0x31')?_[_0x032e('0x32')](_0x43041f):_0x5523c6['attributes'],'include':_0x5523c6['include']?_[_0x032e('0x18')](_0x5523c6['include'],function(_0x1e0877){return{'model':db[_0x1e0877[_0x032e('0x19')]],'as':_0x1e0877['as'],'attributes':_0x1e0877[_0x032e('0x15')],'include':_0x1e0877[_0x032e('0x17')]?_[_0x032e('0x18')](_0x1e0877[_0x032e('0x17')],function(_0x39138f){return{'model':db[_0x39138f[_0x032e('0x19')]],'as':_0x39138f['as'],'attributes':_0x39138f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c2b40){logger[_0x032e('0x1a')](_0x032e('0x12'),_0x519a34);logger['debug'](_0x032e('0x12'),_0x519a34,JSON[_0x032e('0x1b')](_0x5c2b40));_0x9c4db6(_0x5c2b40);})[_0x032e('0x22')](function(_0x34c180){logger[_0x032e('0xf')](_0x032e('0x12'),_0x34c180[_0x032e('0x10')],_0x519a34);_0x1c4f4c(_0x40b47b[_0x032e('0xf')](0x1f4,_0x34c180[_0x032e('0x10')]));});});});};exports['GetContactByPhone']=function(_0x2ff272){var _0x8ab42c=this;return new Promise(function(_0x3a7f29,_0xb43a3){return db[_0x032e('0x29')][_0x032e('0x48')]({'raw':!![],'where':{'phone':_0x2ff272['options'][_0x032e('0x14')][_0x032e('0x49')]},'attributes':['id',_0x032e('0x4a')],'order':[['id',_0x032e('0x4b')]]})[_0x032e('0xa')](function(_0x555a65){logger['info'](_0x032e('0x4c'),_0x2ff272);logger[_0x032e('0xd')](_0x032e('0x4c'),_0x2ff272,JSON['stringify'](_0x555a65));_0x3a7f29(_0x555a65);})[_0x032e('0x22')](function(_0x193cdd){logger[_0x032e('0xf')]('getContactByPhone',_0x193cdd[_0x032e('0x10')],_0x2ff272);_0xb43a3(_0x8ab42c[_0x032e('0xf')](0x1f4,_0x193cdd[_0x032e('0x10')]));});});};exports['ResetActiveCalls']=function(_0xef7f19){var _0x3ab0f8=this;return new Promise(function(_0x21688c,_0x598e6e){return db[_0x032e('0x2b')][_0x032e('0x2c')](function(_0x51795d){return db['CmHopper'][_0x032e('0x24')]({'active':![]},{'where':{},'transaction':_0x51795d})[_0x032e('0xa')](function(_0x4da794){logger[_0x032e('0x1a')](_0x032e('0x4d'),_0xef7f19);logger['debug'](_0x032e('0x4d'),_0xef7f19,JSON[_0x032e('0x1b')](_0x4da794));_0x21688c(_0x4da794);})['catch'](function(_0x3e5db4){logger[_0x032e('0xf')](_0x032e('0x4d'),_0x3e5db4[_0x032e('0x10')],_0xef7f19);_0x598e6e(_0x3ab0f8[_0x032e('0xf')](0x1f4,_0x3e5db4['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x596470){var _0x2d379b=this;var _0x2fde9f=_0x596470[_0x032e('0x20')][_0x032e('0x14')]['voiceQueueId'];var _0x512210=_0x596470[_0x032e('0x20')][_0x032e('0x14')][_0x032e('0x4e')];return new Promise(function(_0x1e82f9,_0x49034f){return db[_0x032e('0x1d')]['findAll']({'where':{'voiceQueueId':_0x2fde9f,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x032e('0x2b')][_0x032e('0x4f')](_0x032e('0x50')+_0x512210+_0x032e('0x51'))}},'include':[{'model':db[_0x032e('0x29')],'as':_0x032e('0x31')},{'model':db[_0x032e('0x52')],'as':_0x032e('0x33'),'attributes':['id',_0x032e('0x34'),_0x032e('0x35')]},{'model':db[_0x032e('0x53')],'as':_0x032e('0x54')}]})['then'](function(_0x2a50dc){return db['sequelize']['transaction'](function(_0x10f70f){return db[_0x032e('0x1d')]['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x2fde9f,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x032e('0x2b')][_0x032e('0x4f')]('NOW()\x20+\x20INTERVAL\x20'+_0x512210+_0x032e('0x51'))}},'transaction':_0x10f70f})[_0x032e('0xa')](function(_0x312626){_0x1e82f9(_0x2a50dc);})[_0x032e('0x22')](function(_0x276ffa){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x276ffa[_0x032e('0x10')],_0x596470);_0x49034f(validateExpressRequest);});});})[_0x032e('0x22')](function(_0x146bdb){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x146bdb[_0x032e('0x10')],_0x596470);_0x49034f(_0x2d379b['error'](0x1f4,_0x146bdb[_0x032e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index dcd4bb9..e8421bd 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 _0xdc50=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','get','/timezones','getTimezones','/:id','create','post','getPreview','/timezone','getTimezone','getPreviewRecall','put','update','destroy'];(function(_0x5d19f8,_0x56a7bb){var _0x42e896=function(_0x15d7c6){while(--_0x15d7c6){_0x5d19f8['push'](_0x5d19f8['shift']());}};_0x42e896(++_0x56a7bb);}(_0xdc50,0xb5));var _0x0dc5=function(_0x3fdea2,_0x5499bf){_0x3fdea2=_0x3fdea2-0x0;var _0x596ae3=_0xdc50[_0x3fdea2];return _0x596ae3;};'use strict';var multer=require(_0x0dc5('0x0'));var util=require(_0x0dc5('0x1'));var path=require(_0x0dc5('0x2'));var timeout=require(_0x0dc5('0x3'));var express=require(_0x0dc5('0x4'));var router=express[_0x0dc5('0x5')]();var fs_extra=require(_0x0dc5('0x6'));var auth=require(_0x0dc5('0x7'));var interaction=require(_0x0dc5('0x8'));var config=require('../../config/environment');var controller=require(_0x0dc5('0x9'));router['get']('/',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0xb')]);router['get'](_0x0dc5('0xc'),auth['isAuthenticated'](),controller[_0x0dc5('0xd')]);router['get'](_0x0dc5('0xe'),auth['isAuthenticated'](),controller[_0x0dc5('0xf')]);router[_0x0dc5('0x10')](_0x0dc5('0x11'),auth['isAuthenticated'](),controller[_0x0dc5('0x12')]);router[_0x0dc5('0x10')](_0x0dc5('0x13'),auth[_0x0dc5('0xa')](),controller['show']);router['post']('/',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x14')]);router[_0x0dc5('0x15')]('/preview',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x16')]);router['post'](_0x0dc5('0x17'),auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x18')]);router[_0x0dc5('0x15')]('/previewrecall',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x19')]);router[_0x0dc5('0x1a')]('/:id',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x1b')]);router['delete']('/:id',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x1c')]);module[_0x0dc5('0x1d')]=router; \ No newline at end of file +var _0x1120=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','isAuthenticated','/opencontacts','/timezones','getTimezones','/:id','show','create','post','/preview','getPreview','/timezone','/previewrecall','getPreviewRecall','put','update','delete','destroy','exports','multer'];(function(_0x1a87c7,_0x213db9){var _0x256d85=function(_0x20fc1f){while(--_0x20fc1f){_0x1a87c7['push'](_0x1a87c7['shift']());}};_0x256d85(++_0x213db9);}(_0x1120,0x90));var _0x0112=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x1120[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0112('0x0'));var util=require('util');var path=require(_0x0112('0x1'));var timeout=require(_0x0112('0x2'));var express=require(_0x0112('0x3'));var router=express[_0x0112('0x4')]();var fs_extra=require(_0x0112('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0112('0x6'));var config=require(_0x0112('0x7'));var controller=require(_0x0112('0x8'));router[_0x0112('0x9')]('/',auth['isAuthenticated'](),controller[_0x0112('0xa')]);router[_0x0112('0x9')]('/describe',auth[_0x0112('0xb')](),controller['describe']);router[_0x0112('0x9')](_0x0112('0xc'),auth[_0x0112('0xb')](),controller['getOpenContacts']);router[_0x0112('0x9')](_0x0112('0xd'),auth[_0x0112('0xb')](),controller[_0x0112('0xe')]);router['get'](_0x0112('0xf'),auth['isAuthenticated'](),controller[_0x0112('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0112('0x11')]);router[_0x0112('0x12')](_0x0112('0x13'),auth['isAuthenticated'](),controller[_0x0112('0x14')]);router['post'](_0x0112('0x15'),auth['isAuthenticated'](),controller['getTimezone']);router[_0x0112('0x12')](_0x0112('0x16'),auth[_0x0112('0xb')](),controller[_0x0112('0x17')]);router[_0x0112('0x18')](_0x0112('0xf'),auth[_0x0112('0xb')](),controller[_0x0112('0x19')]);router[_0x0112('0x1a')](_0x0112('0xf'),auth['isAuthenticated'](),controller[_0x0112('0x1b')]);module[_0x0112('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 7e6cb07..36a2d50 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 _0x723e=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x44d146,_0x942e69){var _0x12c747=function(_0x2927a2){while(--_0x2927a2){_0x44d146['push'](_0x44d146['shift']());}};_0x12c747(++_0x942e69);}(_0x723e,0x179));var _0xe723=function(_0x1e7634,_0x37d8e2){_0x1e7634=_0x1e7634-0x0;var _0x50a829=_0x723e[_0x1e7634];return _0x50a829;};'use strict';var moment=require('moment');var Sequelize=require(_0xe723('0x0'));module[_0xe723('0x1')]={'phone':{'type':Sequelize[_0xe723('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe723('0x3')],'unique':_0xe723('0x4')},'ListId':{'type':Sequelize[_0xe723('0x3')],'unique':_0xe723('0x4')},'VoiceQueueId':{'type':Sequelize[_0xe723('0x3')],'unique':_0xe723('0x4')}}; \ No newline at end of file +var _0xfcbe=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x32de8c,_0x2bfb6d){var _0x3f8c0d=function(_0x2b218d){while(--_0x2b218d){_0x32de8c['push'](_0x32de8c['shift']());}};_0x3f8c0d(++_0x2bfb6d);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x2a3a52,_0x3a2415){_0x2a3a52=_0x2a3a52-0x0;var _0x2a3d53=_0xfcbe[_0x2a3a52];return _0x2a3d53;};'use strict';var moment=require('moment');var Sequelize=require(_0xefcb('0x0'));module[_0xefcb('0x1')]={'phone':{'type':Sequelize[_0xefcb('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xefcb('0x3')],'unique':_0xefcb('0x4')},'ListId':{'type':Sequelize[_0xefcb('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xefcb('0x3')],'unique':_0xefcb('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7b1fcea..fa81c7f 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 _0x689f=['squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','CmHopperBlack','include','findAll','catch','show','fields','find','update','body','params','describe','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra'];(function(_0x32edf6,_0x699bf0){var _0x3d6297=function(_0x4ea160){while(--_0x4ea160){_0x32edf6['push'](_0x32edf6['shift']());}};_0x3d6297(++_0x699bf0);}(_0x689f,0x81));var _0xf689=function(_0x56dbe5,_0x57fa97){_0x56dbe5=_0x56dbe5-0x0;var _0x47009d=_0x689f[_0x56dbe5];return _0x47009d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf689('0x0'));var rp=require(_0xf689('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf689('0x2'));var util=require('util');var path=require(_0xf689('0x3'));var sox=require('sox');var csv=require(_0xf689('0x4'));var ejs=require(_0xf689('0x5'));var fs=require('fs');var fs_extra=require(_0xf689('0x6'));var _=require('lodash');var squel=require(_0xf689('0x7'));var crypto=require(_0xf689('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xf689('0x9'));var toCsv=require(_0xf689('0x4'));var querystring=require('querystring');var Papa=require(_0xf689('0xa'));var Redis=require(_0xf689('0xb'));var authService=require(_0xf689('0xc'));var qs=require(_0xf689('0xd'));var as=require(_0xf689('0xe'));var hardwareService=require(_0xf689('0xf'));var logger=require(_0xf689('0x10'))('api');var utils=require(_0xf689('0x11'));var config=require(_0xf689('0x12'));var licenseUtil=require(_0xf689('0x13'));var db=require(_0xf689('0x14'))['db'];function respondWithStatusCode(_0x2c7e72,_0x462bf7){_0x462bf7=_0x462bf7||0xcc;return function(_0x1f1a54){if(_0x1f1a54){return _0x2c7e72[_0xf689('0x15')](_0x462bf7);}return _0x2c7e72[_0xf689('0x16')](_0x462bf7)['end']();};}function respondWithResult(_0x1ea3f2,_0x25f0aa){_0x25f0aa=_0x25f0aa||0xc8;return function(_0x3cd379){if(_0x3cd379){return _0x1ea3f2[_0xf689('0x16')](_0x25f0aa)['json'](_0x3cd379);}};}function respondWithFilteredResult(_0x27e485,_0x125b5e){return function(_0xd01a52){if(_0xd01a52){var _0x2f0c9f=typeof _0x125b5e['offset']===_0xf689('0x17')&&typeof _0x125b5e['limit']===_0xf689('0x17');var _0x2960c7=_0xd01a52['count'];var _0x4f730d=_0x2f0c9f?0x0:_0x125b5e[_0xf689('0x18')];var _0x195d50=_0x2f0c9f?_0xd01a52[_0xf689('0x19')]:_0x125b5e[_0xf689('0x18')]+_0x125b5e['limit'];var _0x678a5a;if(_0x195d50>=_0x2960c7){_0x195d50=_0x2960c7;_0x678a5a=0xc8;}else{_0x678a5a=0xce;}_0x27e485[_0xf689('0x16')](_0x678a5a);return _0x27e485[_0xf689('0x1a')](_0xf689('0x1b'),_0x4f730d+'-'+_0x195d50+'/'+_0x2960c7)[_0xf689('0x1c')](_0xd01a52);}return null;};}function patchUpdates(_0x33464a){return function(_0x5503ed){try{jsonpatch[_0xf689('0x1d')](_0x5503ed,_0x33464a,!![]);}catch(_0x1fbdbf){return BPromise[_0xf689('0x1e')](_0x1fbdbf);}return _0x5503ed[_0xf689('0x1f')]();};}function saveUpdates(_0x3f2f1f,_0xec4872){return function(_0x208914){if(_0x208914){return _0x208914['update'](_0x3f2f1f)[_0xf689('0x20')](function(_0x5a3058){return _0x5a3058;});}return null;};}function removeEntity(_0x4a1758,_0x578c4c){return function(_0x59b436){if(_0x59b436){return _0x59b436[_0xf689('0x21')]()[_0xf689('0x20')](function(){_0x4a1758['status'](0xcc)[_0xf689('0x22')]();});}};}function handleEntityNotFound(_0xdf14ca,_0x266960){return function(_0x59d563){if(!_0x59d563){_0xdf14ca[_0xf689('0x15')](0x194);}return _0x59d563;};}function handleError(_0x399fd6,_0x604c8e){_0x604c8e=_0x604c8e||0x1f4;return function(_0x413ea8){logger[_0xf689('0x23')](_0x413ea8[_0xf689('0x24')]);if(_0x413ea8[_0xf689('0x25')]){delete _0x413ea8[_0xf689('0x25')];}_0x399fd6[_0xf689('0x16')](_0x604c8e)[_0xf689('0x26')](_0x413ea8);};}exports['index']=function(_0x43a1f4,_0x4d68d8){var _0x4e60ed={},_0x5a3e8f={},_0xebc372={'count':0x0,'rows':[]};var _0x75f007=_[_0xf689('0x27')](db['CmHopperBlack'][_0xf689('0x28')],function(_0x539a86){return{'name':_0x539a86['fieldName'],'type':_0x539a86['type'][_0xf689('0x29')]};});_0x5a3e8f['model']=_[_0xf689('0x27')](_0x75f007,_0xf689('0x25'));_0x5a3e8f[_0xf689('0x2a')]=_[_0xf689('0x2b')](_0x43a1f4[_0xf689('0x2a')]);_0x5a3e8f[_0xf689('0x2c')]=_[_0xf689('0x2d')](_0x5a3e8f[_0xf689('0x2e')],_0x5a3e8f['query']);_0x4e60ed['attributes']=_[_0xf689('0x2d')](_0x5a3e8f['model'],qs['fields'](_0x43a1f4[_0xf689('0x2a')]['fields']));_0x4e60ed[_0xf689('0x2f')]=_0x4e60ed['attributes'][_0xf689('0x30')]?_0x4e60ed['attributes']:_0x5a3e8f['model'];if(!_0x43a1f4[_0xf689('0x2a')][_0xf689('0x31')](_0xf689('0x32'))){_0x4e60ed[_0xf689('0x33')]=qs['limit'](_0x43a1f4[_0xf689('0x2a')][_0xf689('0x33')]);_0x4e60ed['offset']=qs[_0xf689('0x18')](_0x43a1f4[_0xf689('0x2a')][_0xf689('0x18')]);}_0x4e60ed['order']=qs[_0xf689('0x34')](_0x43a1f4[_0xf689('0x2a')][_0xf689('0x34')]);_0x4e60ed[_0xf689('0x35')]=qs['filters'](_['pick'](_0x43a1f4[_0xf689('0x2a')],_0x5a3e8f['filters']),_0x75f007);if(_0x43a1f4[_0xf689('0x2a')][_0xf689('0x36')]){_0x4e60ed[_0xf689('0x35')]=_[_0xf689('0x37')](_0x4e60ed[_0xf689('0x35')],{'$or':_[_0xf689('0x27')](_0x75f007,function(_0x49575a){if(_0x49575a['type']!=='VIRTUAL'){var _0x50014f={};_0x50014f[_0x49575a['name']]={'$like':'%'+_0x43a1f4[_0xf689('0x2a')][_0xf689('0x36')]+'%'};return _0x50014f;}})});}_0x4e60ed=_['merge']({},_0x4e60ed,_0x43a1f4[_0xf689('0x38')]);var _0x2b8eb4={'where':_0x4e60ed[_0xf689('0x35')]};return db[_0xf689('0x39')][_0xf689('0x19')](_0x2b8eb4)[_0xf689('0x20')](function(_0x160a5c){_0xebc372[_0xf689('0x19')]=_0x160a5c;if(_0x43a1f4[_0xf689('0x2a')]['includeAll']){_0x4e60ed[_0xf689('0x3a')]=[{'all':!![]}];}return db[_0xf689('0x39')][_0xf689('0x3b')](_0x4e60ed);})['then'](function(_0x179849){_0xebc372['rows']=_0x179849;return _0xebc372;})['then'](respondWithFilteredResult(_0x4d68d8,_0x4e60ed))[_0xf689('0x3c')](handleError(_0x4d68d8,null));};exports[_0xf689('0x3d')]=function(_0x54bfa6,_0xfe048c){var _0x1d76c0={'raw':!![],'where':{'id':_0x54bfa6['params']['id']}},_0x448155={};_0x448155['model']=_['keys'](db[_0xf689('0x39')][_0xf689('0x28')]);_0x448155[_0xf689('0x2a')]=_[_0xf689('0x2b')](_0x54bfa6['query']);_0x448155['filters']=_['intersection'](_0x448155['model'],_0x448155['query']);_0x1d76c0[_0xf689('0x2f')]=_[_0xf689('0x2d')](_0x448155[_0xf689('0x2e')],qs[_0xf689('0x3e')](_0x54bfa6['query'][_0xf689('0x3e')]));_0x1d76c0[_0xf689('0x2f')]=_0x1d76c0[_0xf689('0x2f')][_0xf689('0x30')]?_0x1d76c0[_0xf689('0x2f')]:_0x448155['model'];if(_0x54bfa6[_0xf689('0x2a')]['includeAll']){_0x1d76c0['include']=[{'all':!![]}];}_0x1d76c0=_[_0xf689('0x37')]({},_0x1d76c0,_0x54bfa6[_0xf689('0x38')]);return db[_0xf689('0x39')][_0xf689('0x3f')](_0x1d76c0)['then'](handleEntityNotFound(_0xfe048c,null))[_0xf689('0x20')](respondWithResult(_0xfe048c,null))[_0xf689('0x3c')](handleError(_0xfe048c,null));};exports[_0xf689('0x40')]=function(_0x39f512,_0x49a0ac){if(_0x39f512[_0xf689('0x41')]['id']){delete _0x39f512[_0xf689('0x41')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x39f512['params']['id']}})[_0xf689('0x20')](handleEntityNotFound(_0x49a0ac,null))['then'](saveUpdates(_0x39f512[_0xf689('0x41')],null))['then'](respondWithResult(_0x49a0ac,null))[_0xf689('0x3c')](handleError(_0x49a0ac,null));};exports[_0xf689('0x21')]=function(_0x4ba793,_0x3d3240){return db[_0xf689('0x39')][_0xf689('0x3f')]({'where':{'id':_0x4ba793[_0xf689('0x42')]['id']}})[_0xf689('0x20')](handleEntityNotFound(_0x3d3240,null))[_0xf689('0x20')](removeEntity(_0x3d3240,null))[_0xf689('0x3c')](handleError(_0x3d3240,null));};exports[_0xf689('0x43')]=function(_0x24dc9f,_0x4f4719){return db[_0xf689('0x39')][_0xf689('0x43')]()[_0xf689('0x20')](respondWithResult(_0x4f4719,null))['catch'](handleError(_0x4f4719,null));}; \ No newline at end of file +var _0xdc96=['options','find','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','keys','includeAll'];(function(_0x2681ab,_0x1eccb4){var _0x1e7084=function(_0x4f82b1){while(--_0x4f82b1){_0x2681ab['push'](_0x2681ab['shift']());}};_0x1e7084(++_0x1eccb4);}(_0xdc96,0xe8));var _0x6dc9=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xdc96[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0x6dc9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6dc9('0x1'));var jsonpatch=require(_0x6dc9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6dc9('0x3'));var Mustache=require('mustache');var util=require(_0x6dc9('0x4'));var path=require('path');var sox=require(_0x6dc9('0x5'));var csv=require('to-csv');var ejs=require(_0x6dc9('0x6'));var fs=require('fs');var fs_extra=require(_0x6dc9('0x7'));var _=require(_0x6dc9('0x8'));var squel=require(_0x6dc9('0x9'));var crypto=require(_0x6dc9('0xa'));var jsforce=require(_0x6dc9('0xb'));var deskjs=require(_0x6dc9('0xc'));var toCsv=require(_0x6dc9('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6dc9('0xe'));var authService=require(_0x6dc9('0xf'));var qs=require(_0x6dc9('0x10'));var as=require(_0x6dc9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dc9('0x12'))('api');var utils=require(_0x6dc9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6dc9('0x14'));var db=require(_0x6dc9('0x15'))['db'];function respondWithStatusCode(_0x118388,_0x5eefc4){_0x5eefc4=_0x5eefc4||0xcc;return function(_0x3838a2){if(_0x3838a2){return _0x118388[_0x6dc9('0x16')](_0x5eefc4);}return _0x118388[_0x6dc9('0x17')](_0x5eefc4)[_0x6dc9('0x18')]();};}function respondWithResult(_0x419f78,_0x1b1407){_0x1b1407=_0x1b1407||0xc8;return function(_0x2d70df){if(_0x2d70df){return _0x419f78[_0x6dc9('0x17')](_0x1b1407)[_0x6dc9('0x19')](_0x2d70df);}};}function respondWithFilteredResult(_0x4d776b,_0xeb65a7){return function(_0x5e706d){if(_0x5e706d){var _0x51b4f4=typeof _0xeb65a7[_0x6dc9('0x1a')]===_0x6dc9('0x1b')&&typeof _0xeb65a7[_0x6dc9('0x1c')]==='undefined';var _0x4006e5=_0x5e706d[_0x6dc9('0x1d')];var _0x5caa59=_0x51b4f4?0x0:_0xeb65a7[_0x6dc9('0x1a')];var _0xcaece=_0x51b4f4?_0x5e706d[_0x6dc9('0x1d')]:_0xeb65a7[_0x6dc9('0x1a')]+_0xeb65a7[_0x6dc9('0x1c')];var _0x28f019;if(_0xcaece>=_0x4006e5){_0xcaece=_0x4006e5;_0x28f019=0xc8;}else{_0x28f019=0xce;}_0x4d776b[_0x6dc9('0x17')](_0x28f019);return _0x4d776b[_0x6dc9('0x1e')](_0x6dc9('0x1f'),_0x5caa59+'-'+_0xcaece+'/'+_0x4006e5)[_0x6dc9('0x19')](_0x5e706d);}return null;};}function patchUpdates(_0x4eaff2){return function(_0x3d713e){try{jsonpatch[_0x6dc9('0x20')](_0x3d713e,_0x4eaff2,!![]);}catch(_0x1dd0cc){return BPromise[_0x6dc9('0x21')](_0x1dd0cc);}return _0x3d713e[_0x6dc9('0x22')]();};}function saveUpdates(_0x174a5d,_0x397c47){return function(_0x2c1a04){if(_0x2c1a04){return _0x2c1a04[_0x6dc9('0x23')](_0x174a5d)[_0x6dc9('0x24')](function(_0x1bfb3e){return _0x1bfb3e;});}return null;};}function removeEntity(_0x9992f7,_0x1b4570){return function(_0x1f6e52){if(_0x1f6e52){return _0x1f6e52[_0x6dc9('0x25')]()[_0x6dc9('0x24')](function(){_0x9992f7[_0x6dc9('0x17')](0xcc)[_0x6dc9('0x18')]();});}};}function handleEntityNotFound(_0x133fda,_0x1a8fb1){return function(_0x2f9f24){if(!_0x2f9f24){_0x133fda[_0x6dc9('0x16')](0x194);}return _0x2f9f24;};}function handleError(_0x58e823,_0x2b0c81){_0x2b0c81=_0x2b0c81||0x1f4;return function(_0x5d679e){logger[_0x6dc9('0x26')](_0x5d679e[_0x6dc9('0x27')]);if(_0x5d679e['name']){delete _0x5d679e[_0x6dc9('0x28')];}_0x58e823[_0x6dc9('0x17')](_0x2b0c81)[_0x6dc9('0x29')](_0x5d679e);};}exports[_0x6dc9('0x2a')]=function(_0x555e7e,_0x1b791c){var _0x471060={},_0x2b049e={},_0x1c6d03={'count':0x0,'rows':[]};var _0x165baf=_[_0x6dc9('0x2b')](db[_0x6dc9('0x2c')][_0x6dc9('0x2d')],function(_0x1ca112){return{'name':_0x1ca112[_0x6dc9('0x2e')],'type':_0x1ca112[_0x6dc9('0x2f')][_0x6dc9('0x30')]};});_0x2b049e['model']=_[_0x6dc9('0x2b')](_0x165baf,_0x6dc9('0x28'));_0x2b049e[_0x6dc9('0x31')]=_['keys'](_0x555e7e[_0x6dc9('0x31')]);_0x2b049e['filters']=_[_0x6dc9('0x32')](_0x2b049e[_0x6dc9('0x33')],_0x2b049e[_0x6dc9('0x31')]);_0x471060[_0x6dc9('0x34')]=_[_0x6dc9('0x32')](_0x2b049e[_0x6dc9('0x33')],qs['fields'](_0x555e7e[_0x6dc9('0x31')][_0x6dc9('0x35')]));_0x471060[_0x6dc9('0x34')]=_0x471060[_0x6dc9('0x34')][_0x6dc9('0x36')]?_0x471060[_0x6dc9('0x34')]:_0x2b049e['model'];if(!_0x555e7e[_0x6dc9('0x31')]['hasOwnProperty'](_0x6dc9('0x37'))){_0x471060[_0x6dc9('0x1c')]=qs[_0x6dc9('0x1c')](_0x555e7e[_0x6dc9('0x31')][_0x6dc9('0x1c')]);_0x471060['offset']=qs[_0x6dc9('0x1a')](_0x555e7e['query'][_0x6dc9('0x1a')]);}_0x471060[_0x6dc9('0x38')]=qs['sort'](_0x555e7e['query'][_0x6dc9('0x39')]);_0x471060[_0x6dc9('0x3a')]=qs[_0x6dc9('0x3b')](_[_0x6dc9('0x3c')](_0x555e7e[_0x6dc9('0x31')],_0x2b049e[_0x6dc9('0x3b')]),_0x165baf);if(_0x555e7e[_0x6dc9('0x31')]['filter']){_0x471060[_0x6dc9('0x3a')]=_[_0x6dc9('0x3d')](_0x471060[_0x6dc9('0x3a')],{'$or':_[_0x6dc9('0x2b')](_0x165baf,function(_0x379b49){if(_0x379b49[_0x6dc9('0x2f')]!==_0x6dc9('0x3e')){var _0x13cc9c={};_0x13cc9c[_0x379b49[_0x6dc9('0x28')]]={'$like':'%'+_0x555e7e[_0x6dc9('0x31')][_0x6dc9('0x3f')]+'%'};return _0x13cc9c;}})});}_0x471060=_[_0x6dc9('0x3d')]({},_0x471060,_0x555e7e['options']);var _0xe88da0={'where':_0x471060[_0x6dc9('0x3a')]};return db[_0x6dc9('0x2c')][_0x6dc9('0x1d')](_0xe88da0)['then'](function(_0x543b91){_0x1c6d03[_0x6dc9('0x1d')]=_0x543b91;if(_0x555e7e[_0x6dc9('0x31')]['includeAll']){_0x471060[_0x6dc9('0x40')]=[{'all':!![]}];}return db[_0x6dc9('0x2c')][_0x6dc9('0x41')](_0x471060);})[_0x6dc9('0x24')](function(_0x125a2b){_0x1c6d03[_0x6dc9('0x42')]=_0x125a2b;return _0x1c6d03;})[_0x6dc9('0x24')](respondWithFilteredResult(_0x1b791c,_0x471060))[_0x6dc9('0x43')](handleError(_0x1b791c,null));};exports[_0x6dc9('0x44')]=function(_0x57dbbc,_0x5415d7){var _0x155b20={'raw':!![],'where':{'id':_0x57dbbc[_0x6dc9('0x45')]['id']}},_0x61963={};_0x61963[_0x6dc9('0x33')]=_[_0x6dc9('0x46')](db['CmHopperBlack'][_0x6dc9('0x2d')]);_0x61963[_0x6dc9('0x31')]=_['keys'](_0x57dbbc[_0x6dc9('0x31')]);_0x61963[_0x6dc9('0x3b')]=_[_0x6dc9('0x32')](_0x61963[_0x6dc9('0x33')],_0x61963[_0x6dc9('0x31')]);_0x155b20[_0x6dc9('0x34')]=_[_0x6dc9('0x32')](_0x61963['model'],qs[_0x6dc9('0x35')](_0x57dbbc[_0x6dc9('0x31')][_0x6dc9('0x35')]));_0x155b20[_0x6dc9('0x34')]=_0x155b20[_0x6dc9('0x34')][_0x6dc9('0x36')]?_0x155b20['attributes']:_0x61963['model'];if(_0x57dbbc[_0x6dc9('0x31')][_0x6dc9('0x47')]){_0x155b20[_0x6dc9('0x40')]=[{'all':!![]}];}_0x155b20=_[_0x6dc9('0x3d')]({},_0x155b20,_0x57dbbc[_0x6dc9('0x48')]);return db[_0x6dc9('0x2c')][_0x6dc9('0x49')](_0x155b20)[_0x6dc9('0x24')](handleEntityNotFound(_0x5415d7,null))[_0x6dc9('0x24')](respondWithResult(_0x5415d7,null))['catch'](handleError(_0x5415d7,null));};exports[_0x6dc9('0x23')]=function(_0x5d5515,_0x46b70a){if(_0x5d5515[_0x6dc9('0x4a')]['id']){delete _0x5d5515[_0x6dc9('0x4a')]['id'];}return db[_0x6dc9('0x2c')][_0x6dc9('0x49')]({'where':{'id':_0x5d5515[_0x6dc9('0x45')]['id']}})[_0x6dc9('0x24')](handleEntityNotFound(_0x46b70a,null))[_0x6dc9('0x24')](saveUpdates(_0x5d5515[_0x6dc9('0x4a')],null))[_0x6dc9('0x24')](respondWithResult(_0x46b70a,null))[_0x6dc9('0x43')](handleError(_0x46b70a,null));};exports['destroy']=function(_0x4b8746,_0x53e19c){return db[_0x6dc9('0x2c')][_0x6dc9('0x49')]({'where':{'id':_0x4b8746['params']['id']}})[_0x6dc9('0x24')](handleEntityNotFound(_0x53e19c,null))['then'](removeEntity(_0x53e19c,null))['catch'](handleError(_0x53e19c,null));};exports[_0x6dc9('0x4b')]=function(_0x45bf84,_0x19bf88){return db['CmHopperBlack'][_0x6dc9('0x4b')]()['then'](respondWithResult(_0x19bf88,null))['catch'](handleError(_0x19bf88,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2853462..f7041d2 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 _0x9203=['api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','lodash','../../config/logger'];(function(_0x1353bc,_0x432b07){var _0x3097a6=function(_0x1ab3c2){while(--_0x1ab3c2){_0x1353bc['push'](_0x1353bc['shift']());}};_0x3097a6(++_0x432b07);}(_0x9203,0x115));var _0x3920=function(_0x54b2b0,_0x55f332){_0x54b2b0=_0x54b2b0-0x0;var _0x1a0d6b=_0x9203[_0x54b2b0];return _0x1a0d6b;};'use strict';var _=require(_0x3920('0x0'));var util=require('util');var logger=require(_0x3920('0x1'))(_0x3920('0x2'));var moment=require('moment');var BPromise=require(_0x3920('0x3'));var rp=require(_0x3920('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3920('0x5'));var config=require(_0x3920('0x6'));var attributes=require(_0x3920('0x7'));module['exports']=function(_0x144fa3,_0x565d72){return _0x144fa3['define'](_0x3920('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e0d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e0d,0xed));var _0xd1e0=function(_0x21830d,_0x3c73a6){_0x21830d=_0x21830d-0x0;var _0x15ece5=_0x1e0d[_0x21830d];return _0x15ece5;};'use strict';var _=require(_0xd1e0('0x0'));var util=require(_0xd1e0('0x1'));var logger=require(_0xd1e0('0x2'))(_0xd1e0('0x3'));var moment=require(_0xd1e0('0x4'));var BPromise=require(_0xd1e0('0x5'));var rp=require(_0xd1e0('0x6'));var fs=require('fs');var path=require(_0xd1e0('0x7'));var rimraf=require(_0xd1e0('0x8'));var config=require(_0xd1e0('0x9'));var attributes=require(_0xd1e0('0xa'));module['exports']=function(_0x2c3d86,_0x2af5a2){return _0x2c3d86[_0xd1e0('0xb')](_0xd1e0('0xc'),attributes,{'tableName':_0xd1e0('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 d924dd8..2a32159 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 _0x0c48=['GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','then','CmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x9d930d,_0x1fa969){var _0x3993e9=function(_0x300a11){while(--_0x300a11){_0x9d930d['push'](_0x9d930d['shift']());}};_0x3993e9(++_0x1fa969);}(_0x0c48,0x1d9));var _0x80c4=function(_0x41ea56,_0x56e108){_0x41ea56=_0x41ea56-0x0;var _0x184e8d=_0x0c48[_0x41ea56];return _0x184e8d;};'use strict';var _=require('lodash');var util=require(_0x80c4('0x0'));var moment=require('moment');var BPromise=require(_0x80c4('0x1'));var rs=require(_0x80c4('0x2'));var fs=require('fs');var Redis=require(_0x80c4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x80c4('0x4'));var logger=require(_0x80c4('0x5'))(_0x80c4('0x6'));var config=require(_0x80c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x80c4('0x8')][_0x80c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7979c1,_0x2882ae,_0x1888af){return new BPromise(function(_0x3e1ea9,_0x2220cb){return client['request'](_0x7979c1,_0x1888af)['then'](function(_0x5b531a){logger[_0x80c4('0xa')](_0x80c4('0xb'),_0x2882ae,_0x80c4('0xc'));logger[_0x80c4('0xd')](_0x80c4('0xe'),_0x2882ae,'request\x20sent',JSON[_0x80c4('0xf')](_0x5b531a));if(_0x5b531a[_0x80c4('0x10')]){if(_0x5b531a[_0x80c4('0x10')][_0x80c4('0x11')]===0x1f4){logger[_0x80c4('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2882ae,_0x5b531a[_0x80c4('0x10')][_0x80c4('0x12')]);return _0x2220cb(_0x5b531a['error'][_0x80c4('0x12')]);}logger[_0x80c4('0x10')](_0x80c4('0xb'),_0x2882ae,_0x5b531a[_0x80c4('0x10')][_0x80c4('0x12')]);return _0x3e1ea9(_0x5b531a['error']['message']);}else{logger[_0x80c4('0xa')](_0x80c4('0xb'),_0x2882ae,'request\x20sent');_0x3e1ea9(_0x5b531a[_0x80c4('0x13')][_0x80c4('0x12')]);}})[_0x80c4('0x14')](function(_0x54bfd7){logger[_0x80c4('0x10')](_0x80c4('0xb'),_0x2882ae,_0x54bfd7);_0x2220cb(_0x54bfd7);});});}exports[_0x80c4('0x15')]=function(_0x3f189c){var _0x21b945=this;return new Promise(function(_0x2aaf54,_0x369b58){return db['CmHopperBlack'][_0x80c4('0x16')]({'raw':_0x3f189c[_0x80c4('0x17')]?_0x3f189c['options'][_0x80c4('0x18')]===undefined?!![]:![]:!![],'where':_0x3f189c['options']?_0x3f189c[_0x80c4('0x17')][_0x80c4('0x19')]||null:null,'attributes':_0x3f189c[_0x80c4('0x17')]?_0x3f189c[_0x80c4('0x17')][_0x80c4('0x1a')]||null:null,'limit':_0x3f189c[_0x80c4('0x17')]?_0x3f189c[_0x80c4('0x17')][_0x80c4('0x1b')]||null:null,'include':_0x3f189c[_0x80c4('0x17')]?_0x3f189c['options'][_0x80c4('0x1c')]?_['map'](_0x3f189c[_0x80c4('0x17')]['include'],function(_0x53870f){return{'model':db[_0x53870f[_0x80c4('0x1d')]],'as':_0x53870f['as'],'attributes':_0x53870f['attributes'],'include':_0x53870f[_0x80c4('0x1c')]?_['map'](_0x53870f['include'],function(_0x483dbf){return{'model':db[_0x483dbf[_0x80c4('0x1d')]],'as':_0x483dbf['as'],'attributes':_0x483dbf[_0x80c4('0x1a')],'include':_0x483dbf[_0x80c4('0x1c')]?_[_0x80c4('0x1e')](_0x483dbf[_0x80c4('0x1c')],function(_0x5e152c){return{'model':db[_0x5e152c['model']],'as':_0x5e152c['as'],'attributes':_0x5e152c['attributes']};}):[]};}):[]};}):[]:[]})[_0x80c4('0x1f')](function(_0x2a2b7b){logger[_0x80c4('0xa')](_0x80c4('0x15'),_0x3f189c);logger[_0x80c4('0xd')](_0x80c4('0x15'),_0x3f189c,JSON[_0x80c4('0xf')](_0x2a2b7b));_0x2aaf54(_0x2a2b7b);})[_0x80c4('0x14')](function(_0x881945){logger[_0x80c4('0x10')](_0x80c4('0x15'),_0x881945['message'],_0x3f189c);_0x369b58(_0x21b945['error'](0x1f4,_0x881945['message']));});});};exports['UpdateCmHopperBlack']=function(_0x4a5cf4){var _0x3599b4=this;return new Promise(function(_0x5a36dc,_0x380ba3){return db[_0x80c4('0x20')][_0x80c4('0x21')](_0x4a5cf4[_0x80c4('0x22')],{'raw':_0x4a5cf4['options']?_0x4a5cf4[_0x80c4('0x17')][_0x80c4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a5cf4[_0x80c4('0x17')]?_0x4a5cf4[_0x80c4('0x17')]['where']||null:null,'attributes':_0x4a5cf4[_0x80c4('0x17')]?_0x4a5cf4[_0x80c4('0x17')][_0x80c4('0x1a')]||null:null,'limit':_0x4a5cf4['options']?_0x4a5cf4[_0x80c4('0x17')][_0x80c4('0x1b')]||null:null})[_0x80c4('0x1f')](function(_0x3a66ea){logger['info'](_0x80c4('0x23'),_0x4a5cf4);logger[_0x80c4('0xd')](_0x80c4('0x23'),_0x4a5cf4,JSON['stringify'](_0x3a66ea));_0x5a36dc(_0x3a66ea);})[_0x80c4('0x14')](function(_0x57b226){logger[_0x80c4('0x10')](_0x80c4('0x23'),_0x57b226[_0x80c4('0x12')],_0x4a5cf4);_0x380ba3(_0x3599b4[_0x80c4('0x10')](0x1f4,_0x57b226[_0x80c4('0x12')]));});});};exports[_0x80c4('0x24')]=function(_0x1113f1){var _0x13bef4=this;return new Promise(function(_0x9611be,_0x30eadb){return db[_0x80c4('0x20')][_0x80c4('0x25')]({'where':_0x1113f1['options']?_0x1113f1[_0x80c4('0x17')][_0x80c4('0x19')]||null:null})[_0x80c4('0x1f')](function(_0x3d196e){logger['info'](_0x80c4('0x24'),_0x1113f1);logger[_0x80c4('0xd')]('DestroyCmHopperBlack',_0x1113f1,JSON['stringify'](_0x3d196e));_0x9611be(_0x3d196e);})[_0x80c4('0x14')](function(_0x12c398){logger[_0x80c4('0x10')](_0x80c4('0x24'),_0x12c398[_0x80c4('0x12')],_0x1113f1);_0x30eadb(_0x13bef4[_0x80c4('0x10')](0x1f4,_0x12c398[_0x80c4('0x12')]));});});}; \ No newline at end of file +var _0xbb3a=['UpdateCmHopperBlack','update','limit','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','include','map','model','attributes','then','stringify'];(function(_0xb83d6b,_0x157d0b){var _0x5932cf=function(_0x359a25){while(--_0x359a25){_0xb83d6b['push'](_0xb83d6b['shift']());}};_0x5932cf(++_0x157d0b);}(_0xbb3a,0x116));var _0xabb3=function(_0x360ad4,_0x5d681d){_0x360ad4=_0x360ad4-0x0;var _0x186d15=_0xbb3a[_0x360ad4];return _0x186d15;};'use strict';var _=require(_0xabb3('0x0'));var util=require(_0xabb3('0x1'));var moment=require(_0xabb3('0x2'));var BPromise=require(_0xabb3('0x3'));var rs=require(_0xabb3('0x4'));var fs=require('fs');var Redis=require(_0xabb3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xabb3('0x6'));var logger=require(_0xabb3('0x7'))(_0xabb3('0x8'));var config=require(_0xabb3('0x9'));var jayson=require(_0xabb3('0xa'));var client=jayson['client'][_0xabb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24d2e9,_0x519889,_0x4cee1b){return new BPromise(function(_0x5829b9,_0x5e9fb2){return client[_0xabb3('0xc')](_0x24d2e9,_0x4cee1b)['then'](function(_0x5e404e){logger[_0xabb3('0xd')](_0xabb3('0xe'),_0x519889,_0xabb3('0xf'));logger[_0xabb3('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x519889,_0xabb3('0xf'),JSON['stringify'](_0x5e404e));if(_0x5e404e[_0xabb3('0x11')]){if(_0x5e404e['error'][_0xabb3('0x12')]===0x1f4){logger['error'](_0xabb3('0xe'),_0x519889,_0x5e404e[_0xabb3('0x11')][_0xabb3('0x13')]);return _0x5e9fb2(_0x5e404e[_0xabb3('0x11')][_0xabb3('0x13')]);}logger['error'](_0xabb3('0xe'),_0x519889,_0x5e404e['error'][_0xabb3('0x13')]);return _0x5829b9(_0x5e404e['error'][_0xabb3('0x13')]);}else{logger[_0xabb3('0xd')](_0xabb3('0xe'),_0x519889,_0xabb3('0xf'));_0x5829b9(_0x5e404e[_0xabb3('0x14')][_0xabb3('0x13')]);}})[_0xabb3('0x15')](function(_0x1177b2){logger[_0xabb3('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x519889,_0x1177b2);_0x5e9fb2(_0x1177b2);});});}exports[_0xabb3('0x16')]=function(_0x5577b7){var _0x3efc3f=this;return new Promise(function(_0x1c9ad8,_0x5f250b){return db[_0xabb3('0x17')][_0xabb3('0x18')]({'raw':_0x5577b7['options']?_0x5577b7[_0xabb3('0x19')][_0xabb3('0x1a')]===undefined?!![]:![]:!![],'where':_0x5577b7['options']?_0x5577b7['options'][_0xabb3('0x1b')]||null:null,'attributes':_0x5577b7[_0xabb3('0x19')]?_0x5577b7[_0xabb3('0x19')]['attributes']||null:null,'limit':_0x5577b7[_0xabb3('0x19')]?_0x5577b7[_0xabb3('0x19')]['limit']||null:null,'include':_0x5577b7[_0xabb3('0x19')]?_0x5577b7[_0xabb3('0x19')][_0xabb3('0x1c')]?_[_0xabb3('0x1d')](_0x5577b7[_0xabb3('0x19')][_0xabb3('0x1c')],function(_0x1a33c9){return{'model':db[_0x1a33c9[_0xabb3('0x1e')]],'as':_0x1a33c9['as'],'attributes':_0x1a33c9[_0xabb3('0x1f')],'include':_0x1a33c9['include']?_[_0xabb3('0x1d')](_0x1a33c9[_0xabb3('0x1c')],function(_0x22b1dc){return{'model':db[_0x22b1dc['model']],'as':_0x22b1dc['as'],'attributes':_0x22b1dc[_0xabb3('0x1f')],'include':_0x22b1dc['include']?_[_0xabb3('0x1d')](_0x22b1dc['include'],function(_0x112ffe){return{'model':db[_0x112ffe[_0xabb3('0x1e')]],'as':_0x112ffe['as'],'attributes':_0x112ffe[_0xabb3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xabb3('0x20')](function(_0x122a89){logger[_0xabb3('0xd')](_0xabb3('0x16'),_0x5577b7);logger[_0xabb3('0x10')](_0xabb3('0x16'),_0x5577b7,JSON[_0xabb3('0x21')](_0x122a89));_0x1c9ad8(_0x122a89);})['catch'](function(_0x54d746){logger['error'](_0xabb3('0x16'),_0x54d746['message'],_0x5577b7);_0x5f250b(_0x3efc3f[_0xabb3('0x11')](0x1f4,_0x54d746[_0xabb3('0x13')]));});});};exports[_0xabb3('0x22')]=function(_0x47d2d7){var _0x1707ff=this;return new Promise(function(_0x3673d8,_0xf90a28){return db[_0xabb3('0x17')][_0xabb3('0x23')](_0x47d2d7['body'],{'raw':_0x47d2d7[_0xabb3('0x19')]?_0x47d2d7[_0xabb3('0x19')][_0xabb3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d2d7[_0xabb3('0x19')]?_0x47d2d7[_0xabb3('0x19')][_0xabb3('0x1b')]||null:null,'attributes':_0x47d2d7[_0xabb3('0x19')]?_0x47d2d7[_0xabb3('0x19')]['attributes']||null:null,'limit':_0x47d2d7[_0xabb3('0x19')]?_0x47d2d7[_0xabb3('0x19')][_0xabb3('0x24')]||null:null})[_0xabb3('0x20')](function(_0x45e0f0){logger[_0xabb3('0xd')](_0xabb3('0x22'),_0x47d2d7);logger['debug'](_0xabb3('0x22'),_0x47d2d7,JSON[_0xabb3('0x21')](_0x45e0f0));_0x3673d8(_0x45e0f0);})[_0xabb3('0x15')](function(_0x4a9958){logger[_0xabb3('0x11')]('UpdateCmHopperBlack',_0x4a9958[_0xabb3('0x13')],_0x47d2d7);_0xf90a28(_0x1707ff[_0xabb3('0x11')](0x1f4,_0x4a9958[_0xabb3('0x13')]));});});};exports[_0xabb3('0x25')]=function(_0x2c97cd){var _0x395d74=this;return new Promise(function(_0x374637,_0x46a377){return db['CmHopperBlack'][_0xabb3('0x26')]({'where':_0x2c97cd[_0xabb3('0x19')]?_0x2c97cd['options']['where']||null:null})['then'](function(_0x239033){logger[_0xabb3('0xd')]('DestroyCmHopperBlack',_0x2c97cd);logger['debug'](_0xabb3('0x25'),_0x2c97cd,JSON[_0xabb3('0x21')](_0x239033));_0x374637(_0x239033);})[_0xabb3('0x15')](function(_0x37a3bd){logger[_0xabb3('0x11')](_0xabb3('0x25'),_0x37a3bd['message'],_0x2c97cd);_0x46a377(_0x395d74[_0xabb3('0x11')](0x1f4,_0x37a3bd[_0xabb3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 849521d..a5bb661 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 _0xeda8=['get','isAuthenticated','index','describe','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller'];(function(_0x302099,_0xe61dca){var _0x24a042=function(_0x50b7fb){while(--_0x50b7fb){_0x302099['push'](_0x302099['shift']());}};_0x24a042(++_0xe61dca);}(_0xeda8,0x104));var _0x8eda=function(_0x2d1be0,_0x5ef4e4){_0x2d1be0=_0x2d1be0-0x0;var _0x15492d=_0xeda8[_0x2d1be0];return _0x15492d;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/describe',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['show']);router['put']('/:id',auth[_0x8eda('0xb')](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')]('/:id',auth[_0x8eda('0xb')](),controller['destroy']);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0x5d17=['index','/describe','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x5d17,0x114));var _0x75d1=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x5d17[_0x5d72da];return _0x43ebe7;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')]('/:id',auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);module[_0x75d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index af67f0f..f3fcb43 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 _0x4200=['BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x4200,0x199));var _0x0420=function(_0x3d8dcd,_0x32a653){_0x3d8dcd=_0x3d8dcd-0x0;var _0x3891f8=_0x4200[_0x3d8dcd];return _0x3891f8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0420('0x0'));module[_0x0420('0x1')]={'state':{'type':Sequelize[_0x0420('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0420('0x3')]},'scheduledat':{'type':Sequelize[_0x0420('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0420('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0420('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0420('0x3')]},'calleridname':{'type':Sequelize[_0x0420('0x3')]},'starttime':{'type':Sequelize[_0x0420('0x4')]},'responsetime':{'type':Sequelize[_0x0420('0x4')]},'answertime':{'type':Sequelize[_0x0420('0x4')]},'droptime':{'type':Sequelize[_0x0420('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0420('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0420('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0420('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0420('0x3')]},'membername':{'type':Sequelize[_0x0420('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0420('0x3')]},'secondDisposition':{'type':Sequelize[_0x0420('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0420('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4832c1){var _0x53b7bc=this[_0x0420('0x5')](_0x0420('0x6'));if(_0x53b7bc&&_0x4832c1){this[_0x0420('0x7')](_0x0420('0x8'),moment(_0x4832c1)[_0x0420('0x9')](moment(_0x53b7bc),'seconds'));}return this[_0x0420('0x7')](_0x0420('0xa'),_0x4832c1);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0420('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0420('0x4')]},'recallme':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x0420('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0420('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xee15=['setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','STRING','DATE','INTEGER','getDataValue','endtime'];(function(_0x56926a,_0x215e56){var _0x101ebd=function(_0x51d289){while(--_0x51d289){_0x56926a['push'](_0x56926a['shift']());}};_0x101ebd(++_0x215e56);}(_0xee15,0x7e));var _0x5ee1=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xee15[_0x48e1ec];return _0x3b33eb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5ee1('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5ee1('0x1')]},'scheduledat':{'type':Sequelize[_0x5ee1('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5ee1('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5ee1('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5ee1('0x1')]},'originatecalleridname':{'type':Sequelize[_0x5ee1('0x1')]},'calleridnum':{'type':Sequelize[_0x5ee1('0x1')]},'calleridname':{'type':Sequelize[_0x5ee1('0x1')]},'starttime':{'type':Sequelize[_0x5ee1('0x2')]},'responsetime':{'type':Sequelize[_0x5ee1('0x2')]},'answertime':{'type':Sequelize[_0x5ee1('0x2')]},'droptime':{'type':Sequelize[_0x5ee1('0x2')]},'endtime':{'type':Sequelize[_0x5ee1('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5ee1('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5ee1('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5ee1('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5ee1('0x1')]},'campaign':{'type':Sequelize[_0x5ee1('0x1')]},'campaigntype':{'type':Sequelize[_0x5ee1('0x1')]},'membername':{'type':Sequelize[_0x5ee1('0x1')]},'reason':{'type':Sequelize[_0x5ee1('0x1')]},'disposition':{'type':Sequelize[_0x5ee1('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5ee1('0x1')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5257ad){var _0x4c5ee8=this[_0x5ee1('0x4')](_0x5ee1('0x5'));if(_0x4c5ee8&&_0x5257ad){this[_0x5ee1('0x6')](_0x5ee1('0x7'),moment(_0x5257ad)[_0x5ee1('0x8')](moment(_0x4c5ee8),_0x5ee1('0x9')));}return this['setDataValue'](_0x5ee1('0xa'),_0x5257ad);}},'amd':{'type':Sequelize[_0x5ee1('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5ee1('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5ee1('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5ee1('0x2')]},'callback':{'type':Sequelize[_0x5ee1('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5ee1('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5ee1('0x2')]},'deleted':{'type':Sequelize[_0x5ee1('0x1')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5ee1('0x2')]},'recallme':{'type':Sequelize[_0x5ee1('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x5ee1('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5ee1('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5ee1('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5ee1('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 9f0e292..401cc34 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 _0xc1c6=['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','CmHopperFinal','rawAttributes','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','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','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','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','field','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5df788,_0xe4aa00){_0x5df788=_0x5df788-0x0;var _0x30139c=_0xc1c6[_0x5df788];return _0x30139c;};'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['CmHopperFinal']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_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['CmHopperFinal'][_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['describe']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')]()[_0x6c1c('0x25')](respondWithResult(_0x58d075,null))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x26cf7f,_0x52c14d){if(_0x26cf7f[_0x6c1c('0x48')][_0x6c1c('0x49')]){delete _0x26cf7f['body'][_0x6c1c('0x49')];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'uniqueid':_0x26cf7f[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x52c14d,null))[_0x6c1c('0x25')](saveUpdates(_0x26cf7f[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0x52c14d,null))['catch'](handleError(_0x52c14d,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x56b367,_0x5714a6,_0x5008b7){return db[_0x6c1c('0x2b')][_0x6c1c('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x56b367['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x53')))),'congestionContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x55')))),_0x6c1c('0x56')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize'][_0x6c1c('0x4e')](_0x6c1c('0x57')))),_0x6c1c('0x58')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),'answeringMachine']]})[_0x6c1c('0x25')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x25')](respondWithResult(_0x5714a6,null))[_0x6c1c('0x41')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x5a')]=function(_0x14f3b5,_0x3229e6,_0xed095f){return db['CmHopperFinal'][_0x6c1c('0x3f')]({'raw':![],'where':{'CampaignId':_0x14f3b5['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x53')))),_0x6c1c('0x5b')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x5c')))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x6c1c('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),_0x6c1c('0x5d')]]})[_0x6c1c('0x25')](handleEntityNotFound(_0x3229e6,null))[_0x6c1c('0x25')](respondWithResult(_0x3229e6,null))['catch'](handleError(_0x3229e6,null));};exports[_0x6c1c('0x5e')]=function(_0x16b741,_0x204e78,_0x5a919a){return db['VoiceQueue']['find']({'where':{'id':_0x16b741[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x204e78,null))['then'](function(_0x10e499){var _0x579ca3;if(_0x10e499){_0x579ca3=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))[_0x6c1c('0x62')](['phone',_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId','VoiceQueueId',_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))['field']('NOW()','scheduledAt')['field'](_0x6c1c('0x6a'),'ContactId')[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))['field'](_0x6c1c('0x6e'),_0x6c1c('0x6f'))[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x65'))['field'](_0x6c1c('0x70'),'updatedAt')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x16b741['body'][_0x6c1c('0x76')]['toString']())['where'](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x69'))['from'](_0x6c1c('0x61'))['where'](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]()))['where'](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')]('calleridnum')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))['toString']();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x579ca3);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x204e78,null))[_0x6c1c('0x41')](handleError(_0x204e78,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1ad9e2,_0x44d8c4,_0x33a141){return db['Campaign'][_0x6c1c('0x46')]({'where':{'id':_0x1ad9e2[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44d8c4,null))[_0x6c1c('0x25')](function(_0x50b56b){var _0x1a493a;if(_0x50b56b){_0x1a493a=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))['fromQuery']([_0x6c1c('0x69'),_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId',_0x6c1c('0x7b'),_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))[_0x6c1c('0x6b')]('NOW()',_0x6c1c('0x63'))['field'](_0x6c1c('0x6a'),_0x6c1c('0x64'))[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))[_0x6c1c('0x6b')](_0x6c1c('0x7c'),_0x6c1c('0x7b'))['field'](_0x6c1c('0x70'),'createdAt')[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x66'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2[_0x6c1c('0x43')]['id']['toString']())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x1ad9e2['body']['state'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x69'))[_0x6c1c('0x71')](_0x6c1c('0x61'))[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2['params']['id'][_0x6c1c('0x74')]()))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x7e'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')]('CampaignId\x20=\x20?',_0x1ad9e2['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))[_0x6c1c('0x74')]();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x1a493a);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x44d8c4,null))[_0x6c1c('0x41')](handleError(_0x44d8c4,null));};exports['checkContactHopper']=function(_0x3e40b6,_0x654041,_0x1a0da8){return db[_0x6c1c('0x7f')][_0x6c1c('0x80')]({'where':{'VoiceQueueId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x6f')],'CampaignId':_0x3e40b6[_0x6c1c('0x48')]['CampaignId'],'ContactId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x64')]}})[_0x6c1c('0x25')](handleEntityNotFound(_0x654041,null))[_0x6c1c('0x25')](function(_0x385629){if(_0x385629){return _0x385629;}return null;})[_0x6c1c('0x25')](respondWithResult(_0x654041,null))[_0x6c1c('0x41')](handleError(_0x654041,null));}; \ No newline at end of file +var _0x7096=['group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','CmHopperFinal','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','state\x20=\x204'];(function(_0x34f456,_0x271849){var _0x589f55=function(_0x32e03d){while(--_0x32e03d){_0x34f456['push'](_0x34f456['shift']());}};_0x589f55(++_0x271849);}(_0x7096,0x10c));var _0x6709=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7096[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['CmHopperFinal'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['CmHopperFinal'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['CmHopperFinal'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['CmHopperFinal']['describe']()[_0x6709('0x25')](respondWithResult(_0xfbb810,null))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0xe8dd1,_0x22363b){if(_0xe8dd1[_0x6709('0x49')][_0x6709('0x4a')]){delete _0xe8dd1[_0x6709('0x49')]['uniqueid'];}return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'uniqueid':_0xe8dd1[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x22363b,null))['then'](saveUpdates(_0xe8dd1[_0x6709('0x49')],null))['then'](respondWithResult(_0x22363b,null))[_0x6709('0x47')](handleError(_0x22363b,null));};exports[_0x6709('0x4b')]=function(_0x2a563b,_0xb257b5,_0x35c9cd){return db['CmHopperFinal'][_0x6709('0x4c')]({'raw':![],'where':{'VoiceQueueId':_0x2a563b[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x6709('0x4f')))),'noSuchContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x59')))),'reCallContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})[_0x6709('0x25')](handleEntityNotFound(_0xb257b5,null))['then'](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x5b')]=function(_0x511bae,_0x124199,_0x5cf7c0){return db[_0x6709('0x45')][_0x6709('0x4c')]({'raw':![],'where':{'CampaignId':_0x511bae[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x4f')))),_0x6709('0x5c')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')]['literal'](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5d')))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6709('0x5e')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x124199,null))[_0x6709('0x25')](respondWithResult(_0x124199,null))['catch'](handleError(_0x124199,null));};exports[_0x6709('0x5f')]=function(_0x47b7d9,_0x123183,_0x2f1faf){return db['VoiceQueue']['find']({'where':{'id':_0x47b7d9['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x123183,null))[_0x6709('0x25')](function(_0x24c584){var _0xbbfc50;if(_0x24c584){_0xbbfc50=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),_0x6709('0x66'),_0x6709('0x67'),_0x6709('0x68'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x6c'),'phone')['field'](_0x6709('0x6d'),'scheduledAt')['field'](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x70'),_0x6709('0x68'))['field']('NOW()',_0x6709('0x71'))[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))['where'](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')]('state\x20=\x20?',_0x47b7d9['body'][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id']['toString']()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()['field'](_0x6709('0x78'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')]('VoiceQueueId\x20=\x20?',_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))['toString']();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0xbbfc50);}return[];})[_0x6709('0x25')](respondWithResult(_0x123183,null))['catch'](handleError(_0x123183,null));};exports[_0x6709('0x7b')]=function(_0x124270,_0x57f14e,_0x4388a1){return db[_0x6709('0x7c')][_0x6709('0x46')]({'where':{'id':_0x124270['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x57f14e,null))[_0x6709('0x25')](function(_0x409723){var _0x5c8564;if(_0x409723){_0x5c8564=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),'ContactId',_0x6709('0x67'),_0x6709('0x7d'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('ANY_VALUE(calleridnum)',_0x6709('0x64'))[_0x6709('0x6b')](_0x6709('0x6d'),_0x6709('0x65'))[_0x6709('0x6b')](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x7e'),_0x6709('0x7d'))[_0x6709('0x6b')](_0x6709('0x6d'),'createdAt')[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x80'),_0x124270[_0x6709('0x49')][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x78'))[_0x6709('0x72')]('cm_hopper_final')['where'](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))[_0x6709('0x75')]();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0x5c8564);}return[];})[_0x6709('0x25')](respondWithResult(_0x57f14e,null))[_0x6709('0x47')](handleError(_0x57f14e,null));};exports['checkContactHopper']=function(_0x4767b7,_0x5f7adc,_0x393934){return db['CmHopper'][_0x6709('0x81')]({'where':{'VoiceQueueId':_0x4767b7[_0x6709('0x49')]['VoiceQueueId'],'CampaignId':_0x4767b7[_0x6709('0x49')]['CampaignId'],'ContactId':_0x4767b7[_0x6709('0x49')][_0x6709('0x66')]}})[_0x6709('0x25')](handleEntityNotFound(_0x5f7adc,null))[_0x6709('0x25')](function(_0x45cd4e){if(_0x45cd4e){return _0x45cd4e;}return null;})[_0x6709('0x25')](respondWithResult(_0x5f7adc,null))[_0x6709('0x47')](handleError(_0x5f7adc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 4e6dbba..00b3789 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 _0x5010=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal','uniqueid'];(function(_0x3763a7,_0x416e51){var _0xd30ec4=function(_0x56b9ff){while(--_0x56b9ff){_0x3763a7['push'](_0x3763a7['shift']());}};_0xd30ec4(++_0x416e51);}(_0x5010,0x64));var _0x0501=function(_0x179af7,_0x4bca78){_0x179af7=_0x179af7-0x0;var _0x4f16e1=_0x5010[_0x179af7];return _0x4f16e1;};'use strict';var _=require(_0x0501('0x0'));var util=require('util');var logger=require(_0x0501('0x1'))('api');var moment=require(_0x0501('0x2'));var BPromise=require(_0x0501('0x3'));var rp=require(_0x0501('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0501('0x5'));var config=require('../../config/environment');var attributes=require(_0x0501('0x6'));module['exports']=function(_0x36249b,_0x5366ca){return _0x36249b[_0x0501('0x7')](_0x0501('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':'uniqueid','fields':[_0x0501('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc689=['rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3a14ac,_0x55403f){var _0x5e3bc3=function(_0x11f956){while(--_0x11f956){_0x3a14ac['push'](_0x3a14ac['shift']());}};_0x5e3bc3(++_0x55403f);}(_0xc689,0x18d));var _0x9c68=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xc689[_0x47c5bf];return _0x11b779;};'use strict';var _=require(_0x9c68('0x0'));var util=require(_0x9c68('0x1'));var logger=require(_0x9c68('0x2'))(_0x9c68('0x3'));var moment=require(_0x9c68('0x4'));var BPromise=require(_0x9c68('0x5'));var rp=require(_0x9c68('0x6'));var fs=require('fs');var path=require(_0x9c68('0x7'));var rimraf=require(_0x9c68('0x8'));var config=require('../../config/environment');var attributes=require(_0x9c68('0x9'));module[_0x9c68('0xa')]=function(_0x32de5d,_0x3350ac){return _0x32de5d['define'](_0x9c68('0xb'),attributes,{'tableName':_0x9c68('0xc'),'paranoid':![],'indexes':[{'name':_0x9c68('0xd'),'fields':[_0x9c68('0xd')]},{'name':_0x9c68('0xe'),'fields':[_0x9c68('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3b7f05b..fb2103f 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(_0x284723,_0x3e1083){var _0x5a2ad3=function(_0x1a4381){while(--_0x1a4381){_0x284723['push'](_0x284723['shift']());}};_0x5a2ad3(++_0x3e1083);}(_0x7a54,0x106));var _0x47a5=function(_0x1e5d01,_0x10d7f7){_0x1e5d01=_0x1e5d01-0x0;var _0x5596a6=_0x7a54[_0x1e5d01];return _0x5596a6;};'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 _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(_0x1fb1c7,_0x288363){var _0xcf00cd=function(_0x2e4669){while(--_0x2e4669){_0x1fb1c7['push'](_0x1fb1c7['shift']());}};_0xcf00cd(++_0x288363);}(_0x7a54,0x106));var _0x47a5=function(_0x478f94,_0x3664e7){_0x478f94=_0x478f94-0x0;var _0x5e01ef=_0x7a54[_0x478f94];return _0x5e01ef;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 4e58952..44da7da 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 _0x79a3=['/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','multer','path','connect-timeout','Router','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x44b8ba,_0x44d3ba){var _0x13e22b=function(_0x3d7b07){while(--_0x3d7b07){_0x44b8ba['push'](_0x44b8ba['shift']());}};_0x13e22b(++_0x44d3ba);}(_0x79a3,0x80));var _0x379a=function(_0xdc188e,_0x587e20){_0xdc188e=_0xdc188e-0x0;var _0x3ac2f6=_0x79a3[_0xdc188e];return _0x3ac2f6;};'use strict';var multer=require(_0x379a('0x0'));var util=require('util');var path=require(_0x379a('0x1'));var timeout=require(_0x379a('0x2'));var express=require('express');var router=express[_0x379a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x379a('0x4'));var controller=require(_0x379a('0x5'));router[_0x379a('0x6')]('/',auth[_0x379a('0x7')](),controller[_0x379a('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x379a('0x9')]);router[_0x379a('0x6')](_0x379a('0xa'),auth[_0x379a('0x7')](),controller[_0x379a('0xb')]);router[_0x379a('0x6')](_0x379a('0xc'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x379a('0x6')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x379a('0xd')]);router[_0x379a('0xe')](_0x379a('0xf'),auth[_0x379a('0x7')](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth[_0x379a('0x7')](),controller[_0x379a('0x10')]);router[_0x379a('0xe')](_0x379a('0x11'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x379a('0x12')](_0x379a('0xa'),auth[_0x379a('0x7')](),controller[_0x379a('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe0f9=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe0f9,0x16c));var _0x9e0f=function(_0x5c47e6,_0x5b78a5){_0x5c47e6=_0x5c47e6-0x0;var _0x2aca2d=_0xe0f9[_0x5c47e6];return _0x2aca2d;};'use strict';var multer=require(_0x9e0f('0x0'));var util=require(_0x9e0f('0x1'));var path=require(_0x9e0f('0x2'));var timeout=require(_0x9e0f('0x3'));var express=require(_0x9e0f('0x4'));var router=express[_0x9e0f('0x5')]();var fs_extra=require(_0x9e0f('0x6'));var auth=require(_0x9e0f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e0f('0x8'));router['get']('/',auth[_0x9e0f('0x9')](),controller[_0x9e0f('0xa')]);router[_0x9e0f('0xb')](_0x9e0f('0xc'),auth[_0x9e0f('0x9')](),controller[_0x9e0f('0xd')]);router['get'](_0x9e0f('0xe'),auth[_0x9e0f('0x9')](),controller[_0x9e0f('0xf')]);router[_0x9e0f('0xb')](_0x9e0f('0x10'),auth[_0x9e0f('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x9e0f('0xb')](_0x9e0f('0x11'),auth[_0x9e0f('0x9')](),controller[_0x9e0f('0x12')]);router[_0x9e0f('0x13')](_0x9e0f('0x14'),auth[_0x9e0f('0x9')](),controller[_0x9e0f('0x15')]);router[_0x9e0f('0x13')](_0x9e0f('0x16'),auth[_0x9e0f('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x9e0f('0x13')](_0x9e0f('0x17'),auth[_0x9e0f('0x9')](),controller[_0x9e0f('0x18')]);router[_0x9e0f('0x19')]('/:id',auth[_0x9e0f('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 1bb47fc..a7da2fa 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 _0xd6bc=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd6bc,0x1a0));var _0xcd6b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xd6bc[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0xcd6b('0x0'));module[_0xcd6b('0x1')]={'state':{'type':Sequelize[_0xcd6b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xcd6b('0x3')]},'scheduledat':{'type':Sequelize[_0xcd6b('0x4')]},'countbusyretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xcd6b('0x3')]},'calleridnum':{'type':Sequelize[_0xcd6b('0x3')]},'calleridname':{'type':Sequelize[_0xcd6b('0x3')]},'starttime':{'type':Sequelize[_0xcd6b('0x4')]},'responsetime':{'type':Sequelize[_0xcd6b('0x4')]},'answertime':{'type':Sequelize[_0xcd6b('0x4')]},'droptime':{'type':Sequelize[_0xcd6b('0x4')]},'endtime':{'type':Sequelize[_0xcd6b('0x4')]},'ringtime':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcd6b('0x3')]},'campaign':{'type':Sequelize[_0xcd6b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xcd6b('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xcd6b('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xcd6b('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcd6b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcd6b('0x4')]},'recallme':{'type':Sequelize[_0xcd6b('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaaf5=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5b1053,_0x14c6e3){var _0xec3b3c=function(_0x333c79){while(--_0x333c79){_0x5b1053['push'](_0x5b1053['shift']());}};_0xec3b3c(++_0x14c6e3);}(_0xaaf5,0x14d));var _0x5aaf=function(_0x2aa0cc,_0x58f8d2){_0x2aa0cc=_0x2aa0cc-0x0;var _0x123602=_0xaaf5[_0x2aa0cc];return _0x123602;};'use strict';var Sequelize=require(_0x5aaf('0x0'));module[_0x5aaf('0x1')]={'state':{'type':Sequelize[_0x5aaf('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5aaf('0x3')]},'scheduledat':{'type':Sequelize[_0x5aaf('0x4')]},'countbusyretry':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5aaf('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5aaf('0x3')]},'calleridnum':{'type':Sequelize[_0x5aaf('0x3')]},'calleridname':{'type':Sequelize[_0x5aaf('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5aaf('0x4')]},'droptime':{'type':Sequelize[_0x5aaf('0x4')]},'endtime':{'type':Sequelize[_0x5aaf('0x4')]},'ringtime':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5aaf('0x3')]},'campaign':{'type':Sequelize[_0x5aaf('0x3')]},'campaigntype':{'type':Sequelize[_0x5aaf('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x5aaf('0x3')]},'amd':{'type':Sequelize[_0x5aaf('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x5aaf('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5aaf('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5aaf('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5aaf('0x4')]},'edited':{'type':Sequelize[_0x5aaf('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5aaf('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5aaf('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 0583aed..ae8b906 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 _0x49c8=['index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','CmHopperHistory','findAll','rows','catch','show','params','length','include','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name'];(function(_0x200660,_0x5bdc1d){var _0x1d412c=function(_0x21db72){while(--_0x21db72){_0x200660['push'](_0x200660['shift']());}};_0x1d412c(++_0x5bdc1d);}(_0x49c8,0x14f));var _0x849c=function(_0x5592ab,_0xe01026){_0x5592ab=_0x5592ab-0x0;var _0x524d1f=_0x49c8[_0x5592ab];return _0x524d1f;};'use strict';var emlformat=require(_0x849c('0x0'));var rimraf=require(_0x849c('0x1'));var zipdir=require(_0x849c('0x2'));var jsonpatch=require(_0x849c('0x3'));var rp=require(_0x849c('0x4'));var moment=require('moment');var BPromise=require(_0x849c('0x5'));var Mustache=require('mustache');var util=require(_0x849c('0x6'));var path=require('path');var sox=require(_0x849c('0x7'));var csv=require('to-csv');var ejs=require(_0x849c('0x8'));var fs=require('fs');var fs_extra=require(_0x849c('0x9'));var _=require(_0x849c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x849c('0xb'));var querystring=require('querystring');var Papa=require(_0x849c('0xc'));var Redis=require(_0x849c('0xd'));var authService=require(_0x849c('0xe'));var qs=require(_0x849c('0xf'));var as=require(_0x849c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x849c('0x11'))('api');var utils=require(_0x849c('0x12'));var config=require(_0x849c('0x13'));var licenseUtil=require(_0x849c('0x14'));var db=require(_0x849c('0x15'))['db'];function respondWithStatusCode(_0x40557b,_0x56fa82){_0x56fa82=_0x56fa82||0xcc;return function(_0xc31bbc){if(_0xc31bbc){return _0x40557b[_0x849c('0x16')](_0x56fa82);}return _0x40557b['status'](_0x56fa82)[_0x849c('0x17')]();};}function respondWithResult(_0xa58593,_0x22b511){_0x22b511=_0x22b511||0xc8;return function(_0x22b8df){if(_0x22b8df){return _0xa58593[_0x849c('0x18')](_0x22b511)['json'](_0x22b8df);}};}function respondWithFilteredResult(_0xc4ab15,_0x353825){return function(_0x38f7c5){if(_0x38f7c5){var _0xf33147=typeof _0x353825[_0x849c('0x19')]==='undefined'&&typeof _0x353825[_0x849c('0x1a')]===_0x849c('0x1b');var _0x412f3a=_0x38f7c5[_0x849c('0x1c')];var _0x5df3ef=_0xf33147?0x0:_0x353825['offset'];var _0x4ffa6c=_0xf33147?_0x38f7c5[_0x849c('0x1c')]:_0x353825['offset']+_0x353825[_0x849c('0x1a')];var _0x48ff34;if(_0x4ffa6c>=_0x412f3a){_0x4ffa6c=_0x412f3a;_0x48ff34=0xc8;}else{_0x48ff34=0xce;}_0xc4ab15[_0x849c('0x18')](_0x48ff34);return _0xc4ab15[_0x849c('0x1d')](_0x849c('0x1e'),_0x5df3ef+'-'+_0x4ffa6c+'/'+_0x412f3a)[_0x849c('0x1f')](_0x38f7c5);}return null;};}function patchUpdates(_0x1a3dbd){return function(_0x85b91){try{jsonpatch[_0x849c('0x20')](_0x85b91,_0x1a3dbd,!![]);}catch(_0x4d99db){return BPromise[_0x849c('0x21')](_0x4d99db);}return _0x85b91['save']();};}function saveUpdates(_0x284854,_0xd8ce28){return function(_0x5b4d8e){if(_0x5b4d8e){return _0x5b4d8e[_0x849c('0x22')](_0x284854)[_0x849c('0x23')](function(_0x1de1f2){return _0x1de1f2;});}return null;};}function removeEntity(_0x52fd9a,_0x3030a1){return function(_0x50f162){if(_0x50f162){return _0x50f162[_0x849c('0x24')]()[_0x849c('0x23')](function(){_0x52fd9a[_0x849c('0x18')](0xcc)[_0x849c('0x17')]();});}};}function handleEntityNotFound(_0x40d8ae,_0x1829fc){return function(_0x5258e6){if(!_0x5258e6){_0x40d8ae[_0x849c('0x16')](0x194);}return _0x5258e6;};}function handleError(_0xeb40d0,_0x3e8753){_0x3e8753=_0x3e8753||0x1f4;return function(_0x4bf160){logger[_0x849c('0x25')](_0x4bf160[_0x849c('0x26')]);if(_0x4bf160[_0x849c('0x27')]){delete _0x4bf160[_0x849c('0x27')];}_0xeb40d0[_0x849c('0x18')](_0x3e8753)['send'](_0x4bf160);};}exports[_0x849c('0x28')]=function(_0x4b6588,_0x5bdc00){var _0x580717={},_0x1a4f66={},_0x3dde35={'count':0x0,'rows':[]};var _0x1f6f32=_[_0x849c('0x29')](db['CmHopperHistory'][_0x849c('0x2a')],function(_0x537b74){return{'name':_0x537b74[_0x849c('0x2b')],'type':_0x537b74[_0x849c('0x2c')][_0x849c('0x2d')]};});_0x1a4f66['model']=_['map'](_0x1f6f32,_0x849c('0x27'));_0x1a4f66[_0x849c('0x2e')]=_[_0x849c('0x2f')](_0x4b6588[_0x849c('0x2e')]);_0x1a4f66['filters']=_[_0x849c('0x30')](_0x1a4f66[_0x849c('0x31')],_0x1a4f66[_0x849c('0x2e')]);_0x580717[_0x849c('0x32')]=_[_0x849c('0x30')](_0x1a4f66['model'],qs[_0x849c('0x33')](_0x4b6588[_0x849c('0x2e')][_0x849c('0x33')]));_0x580717[_0x849c('0x32')]=_0x580717[_0x849c('0x32')]['length']?_0x580717['attributes']:_0x1a4f66['model'];if(!_0x4b6588[_0x849c('0x2e')][_0x849c('0x34')](_0x849c('0x35'))){_0x580717['limit']=qs[_0x849c('0x1a')](_0x4b6588[_0x849c('0x2e')][_0x849c('0x1a')]);_0x580717[_0x849c('0x19')]=qs['offset'](_0x4b6588[_0x849c('0x2e')]['offset']);}_0x580717[_0x849c('0x36')]=qs[_0x849c('0x37')](_0x4b6588[_0x849c('0x2e')][_0x849c('0x37')]);_0x580717[_0x849c('0x38')]=qs['filters'](_[_0x849c('0x39')](_0x4b6588[_0x849c('0x2e')],_0x1a4f66[_0x849c('0x3a')]),_0x1f6f32);if(_0x4b6588[_0x849c('0x2e')][_0x849c('0x3b')]){_0x580717[_0x849c('0x38')]=_['merge'](_0x580717[_0x849c('0x38')],{'$or':_[_0x849c('0x29')](_0x1f6f32,function(_0x2431ff){if(_0x2431ff[_0x849c('0x2c')]!==_0x849c('0x3c')){var _0x882b4c={};_0x882b4c[_0x2431ff[_0x849c('0x27')]]={'$like':'%'+_0x4b6588[_0x849c('0x2e')]['filter']+'%'};return _0x882b4c;}})});}_0x580717=_[_0x849c('0x3d')]({},_0x580717,_0x4b6588[_0x849c('0x3e')]);var _0x504b8d={'where':_0x580717[_0x849c('0x38')]};return db['CmHopperHistory']['count'](_0x504b8d)[_0x849c('0x23')](function(_0x1b3e35){_0x3dde35['count']=_0x1b3e35;if(_0x4b6588[_0x849c('0x2e')]['includeAll']){_0x580717['include']=[{'all':!![]}];}return db[_0x849c('0x3f')][_0x849c('0x40')](_0x580717);})[_0x849c('0x23')](function(_0x110237){_0x3dde35[_0x849c('0x41')]=_0x110237;return _0x3dde35;})[_0x849c('0x23')](respondWithFilteredResult(_0x5bdc00,_0x580717))[_0x849c('0x42')](handleError(_0x5bdc00,null));};exports[_0x849c('0x43')]=function(_0x8cbaf9,_0x32cc56){var _0x26cb9b={'raw':!![],'where':{'id':_0x8cbaf9[_0x849c('0x44')]['id']}},_0x1a005b={};_0x1a005b[_0x849c('0x31')]=_[_0x849c('0x2f')](db[_0x849c('0x3f')][_0x849c('0x2a')]);_0x1a005b['query']=_[_0x849c('0x2f')](_0x8cbaf9['query']);_0x1a005b[_0x849c('0x3a')]=_[_0x849c('0x30')](_0x1a005b[_0x849c('0x31')],_0x1a005b[_0x849c('0x2e')]);_0x26cb9b[_0x849c('0x32')]=_[_0x849c('0x30')](_0x1a005b[_0x849c('0x31')],qs[_0x849c('0x33')](_0x8cbaf9[_0x849c('0x2e')][_0x849c('0x33')]));_0x26cb9b[_0x849c('0x32')]=_0x26cb9b[_0x849c('0x32')][_0x849c('0x45')]?_0x26cb9b[_0x849c('0x32')]:_0x1a005b[_0x849c('0x31')];if(_0x8cbaf9[_0x849c('0x2e')]['includeAll']){_0x26cb9b[_0x849c('0x46')]=[{'all':!![]}];}_0x26cb9b=_[_0x849c('0x3d')]({},_0x26cb9b,_0x8cbaf9[_0x849c('0x3e')]);return db['CmHopperHistory']['find'](_0x26cb9b)[_0x849c('0x23')](handleEntityNotFound(_0x32cc56,null))[_0x849c('0x23')](respondWithResult(_0x32cc56,null))[_0x849c('0x42')](handleError(_0x32cc56,null));};exports['create']=function(_0x4de9ae,_0x2a60f6){return db['CmHopperHistory'][_0x849c('0x47')](_0x4de9ae[_0x849c('0x48')],{})['then'](respondWithResult(_0x2a60f6,0xc9))[_0x849c('0x42')](handleError(_0x2a60f6,null));};exports['describe']=function(_0x483678,_0x14d3ed){return db[_0x849c('0x3f')][_0x849c('0x49')]()[_0x849c('0x23')](respondWithResult(_0x14d3ed,null))[_0x849c('0x42')](handleError(_0x14d3ed,null));};exports[_0x849c('0x22')]=function(_0x5f1c66,_0x1d71c3){if(_0x5f1c66[_0x849c('0x48')]['uniqueid']){delete _0x5f1c66[_0x849c('0x48')][_0x849c('0x4a')];}return db[_0x849c('0x3f')]['find']({'where':{'uniqueid':_0x5f1c66[_0x849c('0x44')]['id']}})[_0x849c('0x23')](handleEntityNotFound(_0x1d71c3,null))['then'](saveUpdates(_0x5f1c66[_0x849c('0x48')],null))[_0x849c('0x23')](respondWithResult(_0x1d71c3,null))[_0x849c('0x42')](handleError(_0x1d71c3,null));}; \ No newline at end of file +var _0xc278=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','include','catch','show','params','includeAll','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','end','sendStatus','name','send','index','fieldName','key','model','map','query','keys','filters'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xc278,0xf0));var _0x8c27=function(_0x546fd1,_0x39d926){_0x546fd1=_0x546fd1-0x0;var _0x329794=_0xc278[_0x546fd1];return _0x329794;};'use strict';var emlformat=require(_0x8c27('0x0'));var rimraf=require(_0x8c27('0x1'));var zipdir=require(_0x8c27('0x2'));var jsonpatch=require(_0x8c27('0x3'));var rp=require('request-promise');var moment=require(_0x8c27('0x4'));var BPromise=require(_0x8c27('0x5'));var Mustache=require(_0x8c27('0x6'));var util=require(_0x8c27('0x7'));var path=require('path');var sox=require(_0x8c27('0x8'));var csv=require(_0x8c27('0x9'));var ejs=require(_0x8c27('0xa'));var fs=require('fs');var fs_extra=require(_0x8c27('0xb'));var _=require(_0x8c27('0xc'));var squel=require(_0x8c27('0xd'));var crypto=require(_0x8c27('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8c27('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c27('0x10'));var Redis=require(_0x8c27('0x11'));var authService=require(_0x8c27('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c27('0x13'));var logger=require(_0x8c27('0x14'))(_0x8c27('0x15'));var utils=require(_0x8c27('0x16'));var config=require(_0x8c27('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ac561,_0x5b79d0){_0x5b79d0=_0x5b79d0||0xcc;return function(_0x2fc5a7){if(_0x2fc5a7){return _0x1ac561['sendStatus'](_0x5b79d0);}return _0x1ac561[_0x8c27('0x18')](_0x5b79d0)['end']();};}function respondWithResult(_0x4bc91f,_0x6b2e0){_0x6b2e0=_0x6b2e0||0xc8;return function(_0x3b0617){if(_0x3b0617){return _0x4bc91f['status'](_0x6b2e0)[_0x8c27('0x19')](_0x3b0617);}};}function respondWithFilteredResult(_0x2d685c,_0x3e4590){return function(_0x379472){if(_0x379472){var _0x4e7ecf=typeof _0x3e4590[_0x8c27('0x1a')]==='undefined'&&typeof _0x3e4590[_0x8c27('0x1b')]===_0x8c27('0x1c');var _0x4ce01c=_0x379472[_0x8c27('0x1d')];var _0x5d44ae=_0x4e7ecf?0x0:_0x3e4590['offset'];var _0x586503=_0x4e7ecf?_0x379472[_0x8c27('0x1d')]:_0x3e4590[_0x8c27('0x1a')]+_0x3e4590[_0x8c27('0x1b')];var _0x3a516c;if(_0x586503>=_0x4ce01c){_0x586503=_0x4ce01c;_0x3a516c=0xc8;}else{_0x3a516c=0xce;}_0x2d685c[_0x8c27('0x18')](_0x3a516c);return _0x2d685c[_0x8c27('0x1e')](_0x8c27('0x1f'),_0x5d44ae+'-'+_0x586503+'/'+_0x4ce01c)['json'](_0x379472);}return null;};}function patchUpdates(_0x1d7da2){return function(_0x1cf3f1){try{jsonpatch[_0x8c27('0x20')](_0x1cf3f1,_0x1d7da2,!![]);}catch(_0x40525f){return BPromise['reject'](_0x40525f);}return _0x1cf3f1['save']();};}function saveUpdates(_0xe2e90c,_0x43dc53){return function(_0xbe69b7){if(_0xbe69b7){return _0xbe69b7[_0x8c27('0x21')](_0xe2e90c)[_0x8c27('0x22')](function(_0x34739d){return _0x34739d;});}return null;};}function removeEntity(_0x176590,_0x59877b){return function(_0x452a4a){if(_0x452a4a){return _0x452a4a[_0x8c27('0x23')]()[_0x8c27('0x22')](function(){_0x176590[_0x8c27('0x18')](0xcc)[_0x8c27('0x24')]();});}};}function handleEntityNotFound(_0x5e6c93,_0xe0cde4){return function(_0x7c0360){if(!_0x7c0360){_0x5e6c93[_0x8c27('0x25')](0x194);}return _0x7c0360;};}function handleError(_0x25004c,_0xc2c9f){_0xc2c9f=_0xc2c9f||0x1f4;return function(_0x4a378a){logger['error'](_0x4a378a['stack']);if(_0x4a378a[_0x8c27('0x26')]){delete _0x4a378a['name'];}_0x25004c[_0x8c27('0x18')](_0xc2c9f)[_0x8c27('0x27')](_0x4a378a);};}exports[_0x8c27('0x28')]=function(_0x4fa8f0,_0x381ebd){var _0x244789={},_0xc68e00={},_0x49d074={'count':0x0,'rows':[]};var _0x49a4f4=_['map'](db['CmHopperHistory']['rawAttributes'],function(_0x4b3bba){return{'name':_0x4b3bba[_0x8c27('0x29')],'type':_0x4b3bba['type'][_0x8c27('0x2a')]};});_0xc68e00[_0x8c27('0x2b')]=_[_0x8c27('0x2c')](_0x49a4f4,_0x8c27('0x26'));_0xc68e00[_0x8c27('0x2d')]=_[_0x8c27('0x2e')](_0x4fa8f0['query']);_0xc68e00[_0x8c27('0x2f')]=_[_0x8c27('0x30')](_0xc68e00[_0x8c27('0x2b')],_0xc68e00[_0x8c27('0x2d')]);_0x244789[_0x8c27('0x31')]=_[_0x8c27('0x30')](_0xc68e00[_0x8c27('0x2b')],qs['fields'](_0x4fa8f0[_0x8c27('0x2d')][_0x8c27('0x32')]));_0x244789[_0x8c27('0x31')]=_0x244789[_0x8c27('0x31')][_0x8c27('0x33')]?_0x244789['attributes']:_0xc68e00[_0x8c27('0x2b')];if(!_0x4fa8f0[_0x8c27('0x2d')][_0x8c27('0x34')](_0x8c27('0x35'))){_0x244789['limit']=qs[_0x8c27('0x1b')](_0x4fa8f0[_0x8c27('0x2d')][_0x8c27('0x1b')]);_0x244789[_0x8c27('0x1a')]=qs[_0x8c27('0x1a')](_0x4fa8f0['query'][_0x8c27('0x1a')]);}_0x244789['order']=qs[_0x8c27('0x36')](_0x4fa8f0[_0x8c27('0x2d')]['sort']);_0x244789[_0x8c27('0x37')]=qs['filters'](_[_0x8c27('0x38')](_0x4fa8f0[_0x8c27('0x2d')],_0xc68e00[_0x8c27('0x2f')]),_0x49a4f4);if(_0x4fa8f0['query'][_0x8c27('0x39')]){_0x244789[_0x8c27('0x37')]=_[_0x8c27('0x3a')](_0x244789['where'],{'$or':_[_0x8c27('0x2c')](_0x49a4f4,function(_0x38f8f0){if(_0x38f8f0['type']!==_0x8c27('0x3b')){var _0x571398={};_0x571398[_0x38f8f0[_0x8c27('0x26')]]={'$like':'%'+_0x4fa8f0[_0x8c27('0x2d')][_0x8c27('0x39')]+'%'};return _0x571398;}})});}_0x244789=_['merge']({},_0x244789,_0x4fa8f0[_0x8c27('0x3c')]);var _0x41a90e={'where':_0x244789[_0x8c27('0x37')]};return db[_0x8c27('0x3d')][_0x8c27('0x1d')](_0x41a90e)[_0x8c27('0x22')](function(_0x14945d){_0x49d074[_0x8c27('0x1d')]=_0x14945d;if(_0x4fa8f0[_0x8c27('0x2d')]['includeAll']){_0x244789[_0x8c27('0x3e')]=[{'all':!![]}];}return db[_0x8c27('0x3d')]['findAll'](_0x244789);})[_0x8c27('0x22')](function(_0xdb60c1){_0x49d074['rows']=_0xdb60c1;return _0x49d074;})[_0x8c27('0x22')](respondWithFilteredResult(_0x381ebd,_0x244789))[_0x8c27('0x3f')](handleError(_0x381ebd,null));};exports[_0x8c27('0x40')]=function(_0x1992dd,_0x176bf6){var _0x5243c9={'raw':!![],'where':{'id':_0x1992dd[_0x8c27('0x41')]['id']}},_0x5d8cb4={};_0x5d8cb4['model']=_[_0x8c27('0x2e')](db[_0x8c27('0x3d')]['rawAttributes']);_0x5d8cb4[_0x8c27('0x2d')]=_['keys'](_0x1992dd['query']);_0x5d8cb4[_0x8c27('0x2f')]=_[_0x8c27('0x30')](_0x5d8cb4[_0x8c27('0x2b')],_0x5d8cb4[_0x8c27('0x2d')]);_0x5243c9['attributes']=_['intersection'](_0x5d8cb4[_0x8c27('0x2b')],qs['fields'](_0x1992dd[_0x8c27('0x2d')][_0x8c27('0x32')]));_0x5243c9[_0x8c27('0x31')]=_0x5243c9[_0x8c27('0x31')][_0x8c27('0x33')]?_0x5243c9[_0x8c27('0x31')]:_0x5d8cb4[_0x8c27('0x2b')];if(_0x1992dd[_0x8c27('0x2d')][_0x8c27('0x42')]){_0x5243c9[_0x8c27('0x3e')]=[{'all':!![]}];}_0x5243c9=_['merge']({},_0x5243c9,_0x1992dd[_0x8c27('0x3c')]);return db[_0x8c27('0x3d')][_0x8c27('0x43')](_0x5243c9)[_0x8c27('0x22')](handleEntityNotFound(_0x176bf6,null))[_0x8c27('0x22')](respondWithResult(_0x176bf6,null))[_0x8c27('0x3f')](handleError(_0x176bf6,null));};exports[_0x8c27('0x44')]=function(_0x238faf,_0x362823){return db[_0x8c27('0x3d')][_0x8c27('0x44')](_0x238faf[_0x8c27('0x45')],{})[_0x8c27('0x22')](respondWithResult(_0x362823,0xc9))['catch'](handleError(_0x362823,null));};exports[_0x8c27('0x46')]=function(_0x5d89d1,_0x528158){return db['CmHopperHistory'][_0x8c27('0x46')]()['then'](respondWithResult(_0x528158,null))[_0x8c27('0x3f')](handleError(_0x528158,null));};exports['update']=function(_0x2b6f15,_0xfafc7d){if(_0x2b6f15['body'][_0x8c27('0x47')]){delete _0x2b6f15[_0x8c27('0x45')][_0x8c27('0x47')];}return db[_0x8c27('0x3d')]['find']({'where':{'uniqueid':_0x2b6f15['params']['id']}})[_0x8c27('0x22')](handleEntityNotFound(_0xfafc7d,null))[_0x8c27('0x22')](saveUpdates(_0x2b6f15[_0x8c27('0x45')],null))[_0x8c27('0x22')](respondWithResult(_0xfafc7d,null))[_0x8c27('0x3f')](handleError(_0xfafc7d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 246e719..2b509ab 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 _0xa32b=['./cmHopperHistory.attributes','exports','CmHopperHistory','endtime','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xa32b,0x68));var _0xba32=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0xa32b[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require(_0xba32('0x0'));var util=require('util');var logger=require(_0xba32('0x1'))('api');var moment=require('moment');var BPromise=require(_0xba32('0x2'));var rp=require(_0xba32('0x3'));var fs=require('fs');var path=require(_0xba32('0x4'));var rimraf=require('rimraf');var config=require(_0xba32('0x5'));var attributes=require(_0xba32('0x6'));module[_0xba32('0x7')]=function(_0x312fe7,_0x31dc74){return _0x312fe7['define'](_0xba32('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xba32('0x9'),'fields':[_0xba32('0x9')]},{'name':_0xba32('0xa'),'fields':[_0xba32('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf767=['bluebird','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','../../config/logger','api','moment'];(function(_0x5733b9,_0x35951d){var _0x557e17=function(_0x3ebe97){while(--_0x3ebe97){_0x5733b9['push'](_0x5733b9['shift']());}};_0x557e17(++_0x35951d);}(_0xf767,0x183));var _0x7f76=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0xf767[_0x43b08];return _0x5e05f4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f76('0x0'))(_0x7f76('0x1'));var moment=require(_0x7f76('0x2'));var BPromise=require(_0x7f76('0x3'));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(_0x7f76('0x4'));module[_0x7f76('0x5')]=function(_0x5e8527,_0x509376){return _0x5e8527[_0x7f76('0x6')](_0x7f76('0x7'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x7f76('0x8'),'fields':[_0x7f76('0x8')]},{'name':'uniqueid','fields':[_0x7f76('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 5250818..952f481 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 _0x634d=['AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`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','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit'];(function(_0x547646,_0x32c386){var _0x25f8b2=function(_0x2f2ff9){while(--_0x2f2ff9){_0x547646['push'](_0x547646['shift']());}};_0x25f8b2(++_0x32c386);}(_0x634d,0x120));var _0xd634=function(_0x1e5e14,_0x4010e3){_0x1e5e14=_0x1e5e14-0x0;var _0x442cd4=_0x634d[_0x1e5e14];return _0x442cd4;};'use strict';var _=require(_0xd634('0x0'));var util=require(_0xd634('0x1'));var moment=require(_0xd634('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd634('0x3'))['db'];var utils=require(_0xd634('0x4'));var logger=require(_0xd634('0x5'))('rpc');var config=require(_0xd634('0x6'));var jayson=require(_0xd634('0x7'));var client=jayson['client'][_0xd634('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c930f,_0x121b88,_0x10c5d2){return new BPromise(function(_0x11b091,_0x14bfc7){return client['request'](_0x5c930f,_0x10c5d2)[_0xd634('0x9')](function(_0x38bb9e){logger['info'](_0xd634('0xa'),_0x121b88,_0xd634('0xb'));logger['debug'](_0xd634('0xc'),_0x121b88,'request\x20sent',JSON['stringify'](_0x38bb9e));if(_0x38bb9e['error']){if(_0x38bb9e[_0xd634('0xd')][_0xd634('0xe')]===0x1f4){logger[_0xd634('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x121b88,_0x38bb9e['error'][_0xd634('0xf')]);return _0x14bfc7(_0x38bb9e[_0xd634('0xd')][_0xd634('0xf')]);}logger['error'](_0xd634('0xa'),_0x121b88,_0x38bb9e[_0xd634('0xd')][_0xd634('0xf')]);return _0x11b091(_0x38bb9e[_0xd634('0xd')][_0xd634('0xf')]);}else{logger[_0xd634('0x10')](_0xd634('0xa'),_0x121b88,_0xd634('0xb'));_0x11b091(_0x38bb9e[_0xd634('0x11')]['message']);}})[_0xd634('0x12')](function(_0x123c26){logger[_0xd634('0xd')](_0xd634('0xa'),_0x121b88,_0x123c26);_0x14bfc7(_0x123c26);});});}exports[_0xd634('0x13')]=function(_0x271fa2){var _0x1a9696=this;return new Promise(function(_0x16ee0a,_0x17c604){return db[_0xd634('0x14')]['create'](_0x271fa2[_0xd634('0x15')],{'raw':_0x271fa2[_0xd634('0x16')]?_0x271fa2[_0xd634('0x16')][_0xd634('0x17')]===undefined?!![]:![]:!![]})[_0xd634('0x9')](function(_0x1f904d){logger[_0xd634('0x10')](_0xd634('0x13'),_0x271fa2);logger[_0xd634('0x18')](_0xd634('0x13'),_0x271fa2,JSON['stringify'](_0x1f904d));_0x16ee0a(_0x1f904d);})['catch'](function(_0x2c1bf2){logger[_0xd634('0xd')](_0xd634('0x13'),_0x2c1bf2['message'],_0x271fa2);_0x17c604(_0x1a9696[_0xd634('0xd')](0x1f4,_0x2c1bf2[_0xd634('0xf')]));});});};exports['AvgHandleTime']=function(_0x51509c){var _0x34fdae=this;return new Promise(function(_0x560111,_0x4e2b8c){return db[_0xd634('0x14')][_0xd634('0x19')]({'raw':_0x51509c[_0xd634('0x16')]?_0x51509c['options']['raw']===undefined?!![]:![]:!![],'where':_0x51509c[_0xd634('0x16')]?_0x51509c['options'][_0xd634('0x1a')]||null:null,'attributes':[[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')][_0xd634('0x1d')]('id')),_0xd634('0x1e')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x20')))),_0xd634('0x21')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x22')))),_0xd634('0x23')],[db[_0xd634('0x1b')]['fn']('COUNT',db[_0xd634('0x1b')]['fn']('IF',db['sequelize'][_0xd634('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0xd634('0x24')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x25'),db['sequelize']['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x26')))),_0xd634('0x27')],[db['sequelize']['fn'](_0xd634('0x25'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x28')))),_0xd634('0x29')]]})[_0xd634('0x9')](function(_0x13cc54){logger['info'](_0xd634('0x2a'),_0x51509c);logger[_0xd634('0x18')]('AvgHandleTime',_0x51509c,JSON['stringify'](_0x13cc54));_0x560111(_0x13cc54);})['catch'](function(_0x2a55ba){logger[_0xd634('0xd')](_0xd634('0x2a'),_0x2a55ba[_0xd634('0xf')],_0x51509c);_0x4e2b8c(_0x34fdae[_0xd634('0xd')](0x1f4,_0x2a55ba[_0xd634('0xf')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2fa9c6){var _0xff6d26=this;return new Promise(function(_0x3278d2,_0x1c7a21){return db[_0xd634('0x14')][_0xd634('0x19')]({'raw':_0x2fa9c6[_0xd634('0x16')]?_0x2fa9c6[_0xd634('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2fa9c6[_0xd634('0x16')]?_0x2fa9c6['options'][_0xd634('0x1a')]||null:null,'attributes':[[_0xd634('0x2b'),_0xd634('0x2c')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')]['literal'](_0xd634('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x20')))),'outboundAnswerCallsDay'],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x2f')))),_0xd634('0x30')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')]['literal'](_0xd634('0x31')))),_0xd634('0x32')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x33')))),_0xd634('0x34')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x35')))),_0xd634('0x36')],[db['sequelize']['fn'](_0xd634('0x1c'),db['sequelize']['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x37')))),_0xd634('0x38')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x39')))),_0xd634('0x3a')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x3b')))),_0xd634('0x3c')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0xd634('0x3c')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xd634('0x3e')]],'group':[_0xd634('0x2b')]})[_0xd634('0x9')](function(_0x4ccd58){logger[_0xd634('0x10')](_0xd634('0x3f'),_0x2fa9c6);logger[_0xd634('0x18')](_0xd634('0x3f'),_0x2fa9c6,JSON['stringify'](_0x4ccd58));_0x3278d2(_0x4ccd58);})['catch'](function(_0x604290){logger[_0xd634('0xd')](_0xd634('0x3f'),_0x604290[_0xd634('0xf')],_0x2fa9c6);_0x1c7a21(_0xff6d26[_0xd634('0xd')](0x1f4,_0x604290['message']));});});};exports[_0xd634('0x40')]=function(_0x28459b){var _0xc503e6=this;return new Promise(function(_0x50a387,_0x3a7338){return db[_0xd634('0x14')][_0xd634('0x19')]({'raw':_0x28459b['options']?_0x28459b['options'][_0xd634('0x17')]===undefined?!![]:![]:!![],'where':_0x28459b[_0xd634('0x16')]?_0x28459b[_0xd634('0x16')][_0xd634('0x1a')]||null:null,'attributes':[[_0xd634('0x2b'),_0xd634('0x2c')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')][_0xd634('0x1d')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':['campaign']})[_0xd634('0x9')](function(_0x2f9117){logger['info'](_0xd634('0x40'),_0x28459b);logger['debug'](_0xd634('0x40'),_0x28459b,JSON['stringify'](_0x2f9117));_0x50a387(_0x2f9117);})[_0xd634('0x12')](function(_0x5a9f8f){logger[_0xd634('0xd')](_0xd634('0x40'),_0x5a9f8f[_0xd634('0xf')],_0x28459b);_0x3a7338(_0xc503e6[_0xd634('0xd')](0x1f4,_0x5a9f8f[_0xd634('0xf')]));});});}; \ No newline at end of file +var _0x0855=['outboundNoSuchCallsDay','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','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','findAll','name','col','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','CreateCmHopperHistory','create','options','catch','raw','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','CmHopperHistory','where','campaign'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0855,0x1de));var _0x5085=function(_0x1ce1f9,_0x32ec3f){_0x1ce1f9=_0x1ce1f9-0x0;var _0x49fa18=_0x0855[_0x1ce1f9];return _0x49fa18;};'use strict';var _=require(_0x5085('0x0'));var util=require(_0x5085('0x1'));var moment=require('moment');var BPromise=require(_0x5085('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5085('0x3'))['db'];var utils=require(_0x5085('0x4'));var logger=require('../../config/logger')(_0x5085('0x5'));var config=require('../../config/environment');var jayson=require(_0x5085('0x6'));var client=jayson[_0x5085('0x7')][_0x5085('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1891c4,_0x56cf10,_0x1c67ea){return new BPromise(function(_0x27680a,_0x348d47){return client[_0x5085('0x9')](_0x1891c4,_0x1c67ea)[_0x5085('0xa')](function(_0xf54cca){logger[_0x5085('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x56cf10,_0x5085('0xc'));logger[_0x5085('0xd')](_0x5085('0xe'),_0x56cf10,_0x5085('0xc'),JSON[_0x5085('0xf')](_0xf54cca));if(_0xf54cca[_0x5085('0x10')]){if(_0xf54cca['error'][_0x5085('0x11')]===0x1f4){logger[_0x5085('0x10')](_0x5085('0x12'),_0x56cf10,_0xf54cca[_0x5085('0x10')][_0x5085('0x13')]);return _0x348d47(_0xf54cca['error']['message']);}logger[_0x5085('0x10')](_0x5085('0x12'),_0x56cf10,_0xf54cca[_0x5085('0x10')][_0x5085('0x13')]);return _0x27680a(_0xf54cca[_0x5085('0x10')][_0x5085('0x13')]);}else{logger['info'](_0x5085('0x12'),_0x56cf10,'request\x20sent');_0x27680a(_0xf54cca[_0x5085('0x14')][_0x5085('0x13')]);}})['catch'](function(_0x447db9){logger[_0x5085('0x10')](_0x5085('0x12'),_0x56cf10,_0x447db9);_0x348d47(_0x447db9);});});}exports[_0x5085('0x15')]=function(_0x9bc1d6){var _0x3671fb=this;return new Promise(function(_0x72457c,_0x2df9e6){return db['CmHopperHistory'][_0x5085('0x16')](_0x9bc1d6['body'],{'raw':_0x9bc1d6[_0x5085('0x17')]?_0x9bc1d6['options']['raw']===undefined?!![]:![]:!![]})[_0x5085('0xa')](function(_0x2f365a){logger[_0x5085('0xb')](_0x5085('0x15'),_0x9bc1d6);logger['debug'](_0x5085('0x15'),_0x9bc1d6,JSON['stringify'](_0x2f365a));_0x72457c(_0x2f365a);})[_0x5085('0x18')](function(_0x34ec8d){logger[_0x5085('0x10')](_0x5085('0x15'),_0x34ec8d[_0x5085('0x13')],_0x9bc1d6);_0x2df9e6(_0x3671fb['error'](0x1f4,_0x34ec8d[_0x5085('0x13')]));});});};exports['AvgHandleTime']=function(_0x7c611){var _0x5051b1=this;return new Promise(function(_0x3f46ed,_0x1acce6){return db['CmHopperHistory']['findAll']({'raw':_0x7c611['options']?_0x7c611[_0x5085('0x17')][_0x5085('0x19')]===undefined?!![]:![]:!![],'where':_0x7c611[_0x5085('0x17')]?_0x7c611[_0x5085('0x17')]['where']||null:null,'attributes':[[db[_0x5085('0x1a')]['fn']('COUNT',db[_0x5085('0x1a')]['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')](_0x5085('0x1c')))),_0x5085('0x1d')],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db['sequelize']['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')](_0x5085('0x1f')))),_0x5085('0x20')],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')](_0x5085('0x21')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x5085('0x1a')]['fn'](_0x5085('0x22'),db[_0x5085('0x1a')]['fn']('IF',db['sequelize'][_0x5085('0x1b')](_0x5085('0x23')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x5085('0x22'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')](_0x5085('0x24')))),'predictiveIntervalAvgTalktime']]})[_0x5085('0xa')](function(_0x51ced9){logger['info'](_0x5085('0x25'),_0x7c611);logger[_0x5085('0xd')](_0x5085('0x25'),_0x7c611,JSON[_0x5085('0xf')](_0x51ced9));_0x3f46ed(_0x51ced9);})[_0x5085('0x18')](function(_0x1be6f8){logger['error']('AvgHandleTime',_0x1be6f8['message'],_0x7c611);_0x1acce6(_0x5051b1[_0x5085('0x10')](0x1f4,_0x1be6f8[_0x5085('0x13')]));});});};exports[_0x5085('0x26')]=function(_0x56ee93){var _0x1192cb=this;return new Promise(function(_0x354777,_0x907c6c){return db[_0x5085('0x27')]['findAll']({'raw':_0x56ee93[_0x5085('0x17')]?_0x56ee93[_0x5085('0x17')][_0x5085('0x19')]===undefined?!![]:![]:!![],'where':_0x56ee93[_0x5085('0x17')]?_0x56ee93[_0x5085('0x17')][_0x5085('0x28')]||null:null,'attributes':[[_0x5085('0x29'),'name'],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db['sequelize']['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')]('`state`\x20=\x200,\x201,\x20null'))),_0x5085('0x2a')],[db['sequelize']['fn']('COUNT',db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5085('0x2b')],[db['sequelize']['fn'](_0x5085('0x1e'),db['sequelize']['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x5085('0x1a')]['fn']('COUNT',db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')](_0x5085('0x2c')))),_0x5085('0x2d')],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db['sequelize']['fn']('IF',db[_0x5085('0x1a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x5085('0x2e')],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')](_0x5085('0x2f')))),_0x5085('0x30')],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')]['literal'](_0x5085('0x31')))),_0x5085('0x32')],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')]['literal'](_0x5085('0x33')))),'outboundUnknownCallsDay'],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')](_0x5085('0x34')))),'outboundBlacklistCallsDay'],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')](_0x5085('0x35')))),'outboundOriginateFailureCallsDay'],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db['sequelize'][_0x5085('0x1b')](_0x5085('0x36')))),_0x5085('0x37')],[db['sequelize']['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')]['literal'](_0x5085('0x38')))),_0x5085('0x39')],[db[_0x5085('0x1a')]['fn']('COUNT',db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')]('`state`\x20=\x2020,\x201,\x20null'))),_0x5085('0x37')],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')]['literal'](_0x5085('0x3a')))),_0x5085('0x3b')]],'group':[_0x5085('0x29')]})[_0x5085('0xa')](function(_0x5333a5){logger[_0x5085('0xb')](_0x5085('0x26'),_0x56ee93);logger['debug'](_0x5085('0x26'),_0x56ee93,JSON[_0x5085('0xf')](_0x5333a5));_0x354777(_0x5333a5);})[_0x5085('0x18')](function(_0x229f25){logger[_0x5085('0x10')](_0x5085('0x26'),_0x229f25[_0x5085('0x13')],_0x56ee93);_0x907c6c(_0x1192cb[_0x5085('0x10')](0x1f4,_0x229f25[_0x5085('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x48e639){var _0x2626b1=this;return new Promise(function(_0x536bd5,_0x2dc9d4){return db[_0x5085('0x27')][_0x5085('0x3c')]({'raw':_0x48e639[_0x5085('0x17')]?_0x48e639[_0x5085('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x48e639[_0x5085('0x17')]?_0x48e639['options'][_0x5085('0x28')]||null:null,'attributes':[[_0x5085('0x29'),_0x5085('0x3d')],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')][_0x5085('0x3e')]('id')),_0x5085('0x3f')],[db[_0x5085('0x1a')]['fn'](_0x5085('0x1e'),db[_0x5085('0x1a')]['fn']('IF',db[_0x5085('0x1a')][_0x5085('0x1b')](_0x5085('0x1c')))),'ivrAnswerCallsDay']],'group':[_0x5085('0x29')]})[_0x5085('0xa')](function(_0x1df3b4){logger[_0x5085('0xb')](_0x5085('0x40'),_0x48e639);logger[_0x5085('0xd')](_0x5085('0x40'),_0x48e639,JSON[_0x5085('0xf')](_0x1df3b4));_0x536bd5(_0x1df3b4);})[_0x5085('0x18')](function(_0x16d8f3){logger[_0x5085('0x10')](_0x5085('0x40'),_0x16d8f3['message'],_0x48e639);_0x2dc9d4(_0x2626b1[_0x5085('0x10')](0x1f4,_0x16d8f3[_0x5085('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index d83ce9d..948de29 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 _0x804c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','exports','multer','util','path'];(function(_0x2e1416,_0x1c1fb4){var _0x134b42=function(_0x259591){while(--_0x259591){_0x2e1416['push'](_0x2e1416['shift']());}};_0x134b42(++_0x1c1fb4);}(_0x804c,0x115));var _0xc804=function(_0x58a3f6,_0x279eca){_0x58a3f6=_0x58a3f6-0x0;var _0x2ba99b=_0x804c[_0x58a3f6];return _0x2ba99b;};'use strict';var multer=require(_0xc804('0x0'));var util=require(_0xc804('0x1'));var path=require(_0xc804('0x2'));var timeout=require(_0xc804('0x3'));var express=require(_0xc804('0x4'));var router=express[_0xc804('0x5')]();var fs_extra=require(_0xc804('0x6'));var auth=require(_0xc804('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc804('0x8'));var controller=require(_0xc804('0x9'));router[_0xc804('0xa')]('/',auth[_0xc804('0xb')](),controller['index']);router[_0xc804('0xa')](_0xc804('0xc'),auth[_0xc804('0xb')](),controller[_0xc804('0xd')]);router[_0xc804('0xa')](_0xc804('0xe'),auth['isAuthenticated'](),controller[_0xc804('0xf')]);router[_0xc804('0x10')]('/',auth['isAuthenticated'](),controller[_0xc804('0x11')]);router[_0xc804('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xc804('0x13')]=router; \ No newline at end of file +var _0x9aaa=['put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0xed7a9f,_0x5ce9a9){var _0x21c76b=function(_0x30f628){while(--_0x30f628){_0xed7a9f['push'](_0xed7a9f['shift']());}};_0x21c76b(++_0x5ce9a9);}(_0x9aaa,0x10d));var _0xa9aa=function(_0x1ab06d,_0x2e2300){_0x1ab06d=_0x1ab06d-0x0;var _0x3645cf=_0x9aaa[_0x1ab06d];return _0x3645cf;};'use strict';var multer=require('multer');var util=require(_0xa9aa('0x0'));var path=require(_0xa9aa('0x1'));var timeout=require(_0xa9aa('0x2'));var express=require(_0xa9aa('0x3'));var router=express[_0xa9aa('0x4')]();var fs_extra=require(_0xa9aa('0x5'));var auth=require(_0xa9aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9aa('0x7'));var controller=require('./cmHopperHistory.controller');router[_0xa9aa('0x8')]('/',auth[_0xa9aa('0x9')](),controller[_0xa9aa('0xa')]);router[_0xa9aa('0x8')](_0xa9aa('0xb'),auth[_0xa9aa('0x9')](),controller[_0xa9aa('0xc')]);router[_0xa9aa('0x8')](_0xa9aa('0xd'),auth[_0xa9aa('0x9')](),controller[_0xa9aa('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa9aa('0xf')]);router[_0xa9aa('0x10')](_0xa9aa('0xd'),auth[_0xa9aa('0x9')](),controller[_0xa9aa('0x11')]);module[_0xa9aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 3428027..38df216 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 _0x6737=['exports','STRING'];(function(_0x54ab28,_0x16bc07){var _0x251a4f=function(_0x573910){while(--_0x573910){_0x54ab28['push'](_0x54ab28['shift']());}};_0x251a4f(++_0x16bc07);}(_0x6737,0xe2));var _0x7673=function(_0x1ebe91,_0x2ed5ec){_0x1ebe91=_0x1ebe91-0x0;var _0x4e87f2=_0x6737[_0x1ebe91];return _0x4e87f2;};'use strict';var Sequelize=require('sequelize');module[_0x7673('0x0')]={'name':{'type':Sequelize[_0x7673('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7673('0x1')]},'dialPrefix':{'type':Sequelize[_0x7673('0x1')]}}; \ No newline at end of file +var _0xaa48=['STRING','name','sequelize','exports'];(function(_0x4c5a98,_0x5e4e90){var _0x4e9945=function(_0xacd4a1){while(--_0xacd4a1){_0x4c5a98['push'](_0x4c5a98['shift']());}};_0x4e9945(++_0x5e4e90);}(_0xaa48,0x15a));var _0x8aa4=function(_0x49b23a,_0x30f232){_0x49b23a=_0x49b23a-0x0;var _0x3def50=_0xaa48[_0x49b23a];return _0x3def50;};'use strict';var Sequelize=require(_0x8aa4('0x0'));module[_0x8aa4('0x1')]={'name':{'type':Sequelize[_0x8aa4('0x2')],'unique':_0x8aa4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8aa4('0x2')]},'dialPrefix':{'type':Sequelize[_0x8aa4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ca4a07d..e1a3cee 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 _0x73b7=['User','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','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','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','findAll','rows','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','length','filter','include','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','cf_%d','getContactsCsv','isEmpty','now','writeFileSync','setHeader','Content-disposition','format','list_%d_%s.csv','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents'];(function(_0xdc2882,_0x3169b7){var _0x1ed287=function(_0xad592a){while(--_0xad592a){_0xdc2882['push'](_0xdc2882['shift']());}};_0x1ed287(++_0x3169b7);}(_0x73b7,0x1bd));var _0x773b=function(_0x4f354a,_0x109a73){_0x4f354a=_0x4f354a-0x0;var _0x4c99a0=_0x73b7[_0x4f354a];return _0x4c99a0;};'use strict';var emlformat=require(_0x773b('0x0'));var rimraf=require(_0x773b('0x1'));var zipdir=require(_0x773b('0x2'));var jsonpatch=require(_0x773b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x773b('0x4'));var Mustache=require(_0x773b('0x5'));var util=require(_0x773b('0x6'));var path=require('path');var sox=require(_0x773b('0x7'));var csv=require(_0x773b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x773b('0x9'));var squel=require(_0x773b('0xa'));var crypto=require(_0x773b('0xb'));var jsforce=require(_0x773b('0xc'));var deskjs=require(_0x773b('0xd'));var toCsv=require(_0x773b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x773b('0xe'));var authService=require(_0x773b('0xf'));var qs=require(_0x773b('0x10'));var as=require(_0x773b('0x11'));var hardwareService=require(_0x773b('0x12'));var logger=require(_0x773b('0x13'))(_0x773b('0x14'));var utils=require(_0x773b('0x15'));var config=require(_0x773b('0x16'));var licenseUtil=require(_0x773b('0x17'));var db=require(_0x773b('0x18'))['db'];config[_0x773b('0x19')]=_[_0x773b('0x1a')](config[_0x773b('0x19')],{'host':_0x773b('0x1b'),'port':0x18eb});var socket=require(_0x773b('0x1c'))(new Redis(config[_0x773b('0x19')]));require(_0x773b('0x1d'))[_0x773b('0x1e')](socket);function respondWithStatusCode(_0x515e60,_0x124e54){_0x124e54=_0x124e54||0xcc;return function(_0x4de2bd){if(_0x4de2bd){return _0x515e60[_0x773b('0x1f')](_0x124e54);}return _0x515e60[_0x773b('0x20')](_0x124e54)[_0x773b('0x21')]();};}function respondWithResult(_0x134240,_0x2befe3){_0x2befe3=_0x2befe3||0xc8;return function(_0x21947b){if(_0x21947b){return _0x134240[_0x773b('0x20')](_0x2befe3)[_0x773b('0x22')](_0x21947b);}};}function respondWithFilteredResult(_0x4e0601,_0x463ffd){return function(_0x27d6f5){if(_0x27d6f5){var _0x159173=typeof _0x463ffd[_0x773b('0x23')]===_0x773b('0x24')&&typeof _0x463ffd[_0x773b('0x25')]==='undefined';var _0x4eeb07=_0x27d6f5[_0x773b('0x26')];var _0x4229a6=_0x159173?0x0:_0x463ffd[_0x773b('0x23')];var _0x4b608f=_0x159173?_0x27d6f5['count']:_0x463ffd['offset']+_0x463ffd[_0x773b('0x25')];var _0x1222f6;if(_0x4b608f>=_0x4eeb07){_0x4b608f=_0x4eeb07;_0x1222f6=0xc8;}else{_0x1222f6=0xce;}_0x4e0601['status'](_0x1222f6);return _0x4e0601['set'](_0x773b('0x27'),_0x4229a6+'-'+_0x4b608f+'/'+_0x4eeb07)['json'](_0x27d6f5);}return null;};}function patchUpdates(_0x3d7e36){return function(_0x32a83b){try{jsonpatch[_0x773b('0x28')](_0x32a83b,_0x3d7e36,!![]);}catch(_0x14b89b){return BPromise[_0x773b('0x29')](_0x14b89b);}return _0x32a83b[_0x773b('0x2a')]();};}function saveUpdates(_0x312509,_0x8f443d){return function(_0x4079d9){if(_0x4079d9){return _0x4079d9[_0x773b('0x2b')](_0x312509)[_0x773b('0x2c')](function(_0x5f190f){return _0x5f190f;});}return null;};}function removeEntity(_0x73f994,_0x331016){return function(_0x3b57e5){if(_0x3b57e5){return _0x3b57e5[_0x773b('0x2d')]()[_0x773b('0x2c')](function(){var _0x58d283=_0x3b57e5[_0x773b('0x2e')]({'plain':!![]});var _0x36f046=_0x773b('0x2f');return db[_0x773b('0x30')]['destroy']({'where':{'type':_0x36f046,'resourceId':_0x58d283['id']}})[_0x773b('0x2c')](function(){return _0x3b57e5;});})['then'](function(){_0x73f994[_0x773b('0x20')](0xcc)[_0x773b('0x21')]();});}};}function handleEntityNotFound(_0xe7180d,_0x552f13){return function(_0x29794f){if(!_0x29794f){_0xe7180d[_0x773b('0x1f')](0x194);}return _0x29794f;};}function handleError(_0x585797,_0x1fbb1f){_0x1fbb1f=_0x1fbb1f||0x1f4;return function(_0x1e6861){logger[_0x773b('0x31')](_0x1e6861[_0x773b('0x32')]);if(_0x1e6861[_0x773b('0x33')]){delete _0x1e6861['name'];}_0x585797['status'](_0x1fbb1f)[_0x773b('0x34')](_0x1e6861);};}exports[_0x773b('0x35')]=function(_0x2d30e6,_0x1de3af){var _0x5a0c1c={},_0x1328e5={},_0x44a770={'count':0x0,'rows':[]};var _0x3cd8e4=_[_0x773b('0x36')](db[_0x773b('0x37')][_0x773b('0x38')],function(_0x3b96de){return{'name':_0x3b96de['fieldName'],'type':_0x3b96de[_0x773b('0x39')][_0x773b('0x3a')]};});_0x1328e5[_0x773b('0x3b')]=_[_0x773b('0x36')](_0x3cd8e4,_0x773b('0x33'));_0x1328e5['query']=_[_0x773b('0x3c')](_0x2d30e6[_0x773b('0x3d')]);_0x1328e5[_0x773b('0x3e')]=_[_0x773b('0x3f')](_0x1328e5['model'],_0x1328e5['query']);_0x5a0c1c[_0x773b('0x40')]=_[_0x773b('0x3f')](_0x1328e5[_0x773b('0x3b')],qs['fields'](_0x2d30e6[_0x773b('0x3d')][_0x773b('0x41')]));_0x5a0c1c[_0x773b('0x40')]=_0x5a0c1c[_0x773b('0x40')]['length']?_0x5a0c1c[_0x773b('0x40')]:_0x1328e5[_0x773b('0x3b')];if(!_0x2d30e6[_0x773b('0x3d')][_0x773b('0x42')](_0x773b('0x43'))){_0x5a0c1c[_0x773b('0x25')]=qs[_0x773b('0x25')](_0x2d30e6['query'][_0x773b('0x25')]);_0x5a0c1c[_0x773b('0x23')]=qs[_0x773b('0x23')](_0x2d30e6[_0x773b('0x3d')][_0x773b('0x23')]);}_0x5a0c1c[_0x773b('0x44')]=qs[_0x773b('0x45')](_0x2d30e6[_0x773b('0x3d')][_0x773b('0x45')]);_0x5a0c1c['where']=qs['filters'](_[_0x773b('0x46')](_0x2d30e6[_0x773b('0x3d')],_0x1328e5[_0x773b('0x3e')]),_0x3cd8e4);if(_0x2d30e6['query']['filter']){_0x5a0c1c['where']=_[_0x773b('0x47')](_0x5a0c1c[_0x773b('0x48')],{'$or':_[_0x773b('0x36')](_0x3cd8e4,function(_0x413fc2){if(_0x413fc2[_0x773b('0x39')]!==_0x773b('0x49')){var _0x4f7f41={};_0x4f7f41[_0x413fc2[_0x773b('0x33')]]={'$like':'%'+_0x2d30e6['query']['filter']+'%'};return _0x4f7f41;}})});}_0x5a0c1c=_[_0x773b('0x47')]({},_0x5a0c1c,_0x2d30e6[_0x773b('0x4a')]);var _0x55c7e1={'where':_0x5a0c1c[_0x773b('0x48')]};return db[_0x773b('0x37')][_0x773b('0x26')](_0x55c7e1)['then'](function(_0x24d705){_0x44a770[_0x773b('0x26')]=_0x24d705;if(_0x2d30e6[_0x773b('0x3d')]['includeAll']){_0x5a0c1c['include']=[{'all':!![]}];}return db[_0x773b('0x37')][_0x773b('0x4b')](_0x5a0c1c);})[_0x773b('0x2c')](function(_0x42d619){_0x44a770[_0x773b('0x4c')]=_0x42d619;return _0x44a770;})[_0x773b('0x2c')](respondWithFilteredResult(_0x1de3af,_0x5a0c1c))['catch'](handleError(_0x1de3af,null));};exports['show']=function(_0x2407a4,_0x491390){var _0x41ffc8={'raw':![],'where':{'id':_0x2407a4[_0x773b('0x4d')]['id']}},_0x3770a4={};_0x3770a4[_0x773b('0x3b')]=_['keys'](db['CmList'][_0x773b('0x38')]);_0x3770a4['query']=_[_0x773b('0x3c')](_0x2407a4[_0x773b('0x3d')]);_0x3770a4[_0x773b('0x3e')]=_[_0x773b('0x3f')](_0x3770a4['model'],_0x3770a4[_0x773b('0x3d')]);_0x41ffc8[_0x773b('0x40')]=_[_0x773b('0x3f')](_0x3770a4['model'],qs['fields'](_0x2407a4[_0x773b('0x3d')][_0x773b('0x41')]));_0x41ffc8['attributes']=_0x41ffc8[_0x773b('0x40')]['length']?_0x41ffc8[_0x773b('0x40')]:_0x3770a4['model'];if(_0x2407a4['query'][_0x773b('0x4e')]){_0x41ffc8['include']=[{'all':!![]}];}_0x41ffc8=_[_0x773b('0x47')]({},_0x41ffc8,_0x2407a4[_0x773b('0x4a')]);return db['CmList'][_0x773b('0x4f')](_0x41ffc8)['then'](handleEntityNotFound(_0x491390,null))[_0x773b('0x2c')](respondWithResult(_0x491390,null))[_0x773b('0x50')](handleError(_0x491390,null));};exports['create']=function(_0x4d5050,_0xbcaa13){return db[_0x773b('0x37')][_0x773b('0x51')](_0x4d5050[_0x773b('0x52')],{})[_0x773b('0x2c')](function(_0x35b4fa){var _0x1b1ed9=_0x4d5050[_0x773b('0x53')]['get']({'plain':!![]});if(!_0x1b1ed9)throw new Error(_0x773b('0x54'));if(_0x1b1ed9['role']===_0x773b('0x53')){var _0xdb6f29=_0x35b4fa['get']({'plain':!![]});var _0x21acae=_0x773b('0x2f');return db['UserProfileSection'][_0x773b('0x4f')]({'where':{'name':_0x21acae,'userProfileId':_0x1b1ed9[_0x773b('0x55')]},'raw':!![]})[_0x773b('0x2c')](function(_0x1949aa){if(_0x1949aa&&_0x1949aa[_0x773b('0x56')]===0x0){return db[_0x773b('0x30')][_0x773b('0x51')]({'name':_0xdb6f29[_0x773b('0x33')],'resourceId':_0xdb6f29['id'],'type':_0x1949aa['name'],'sectionId':_0x1949aa['id']},{})[_0x773b('0x2c')](function(){return _0x35b4fa;});}else{return _0x35b4fa;}})[_0x773b('0x50')](function(_0x512b6e){logger[_0x773b('0x31')](_0x773b('0x57'),_0x512b6e);throw _0x512b6e;});}return _0x35b4fa;})[_0x773b('0x2c')](respondWithResult(_0xbcaa13,0xc9))[_0x773b('0x50')](handleError(_0xbcaa13,null));};exports[_0x773b('0x2b')]=function(_0x45c33a,_0x2639fa){if(_0x45c33a[_0x773b('0x52')]['id']){delete _0x45c33a['body']['id'];}return db[_0x773b('0x37')]['find']({'where':{'id':_0x45c33a['params']['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x2639fa,null))[_0x773b('0x2c')](saveUpdates(_0x45c33a[_0x773b('0x52')],null))[_0x773b('0x2c')](respondWithResult(_0x2639fa,null))['catch'](handleError(_0x2639fa,null));};exports[_0x773b('0x2d')]=function(_0x267ea0,_0x4e2be5){return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x267ea0[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x4e2be5,null))['then'](removeEntity(_0x4e2be5,null))['catch'](handleError(_0x4e2be5,null));};exports['describe']=function(_0x1a3028,_0x551aa1){return db[_0x773b('0x37')][_0x773b('0x58')]()[_0x773b('0x2c')](respondWithResult(_0x551aa1,null))[_0x773b('0x50')](handleError(_0x551aa1,null));};exports[_0x773b('0x59')]=function(_0x58c067,_0x74fe3a,_0x2d7481){if(_0x58c067[_0x773b('0x52')]['id']){delete _0x58c067[_0x773b('0x52')]['id'];}return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x58c067[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x74fe3a,null))[_0x773b('0x2c')](function(_0x5ada0a){if(_0x5ada0a){_0x58c067['body'][_0x773b('0x5a')]=_0x5ada0a['id'];return db[_0x773b('0x5b')][_0x773b('0x51')](_0x58c067[_0x773b('0x52')]);}})[_0x773b('0x2c')](respondWithResult(_0x74fe3a,null))[_0x773b('0x50')](handleError(_0x74fe3a,null));};exports['getDispositions']=function(_0xebf5b8,_0x29c017,_0xa98619){var _0x21ba0e={'raw':![],'where':{}};var _0x2eddc3={};var _0x401b69={'count':0x0,'rows':[]};return db[_0x773b('0x37')][_0x773b('0x5c')]({'where':{'id':_0xebf5b8[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x29c017,null))['then'](function(_0x4fb5f6){if(_0x4fb5f6){_0x2eddc3['model']=_[_0x773b('0x3c')](db['Disposition'][_0x773b('0x38')]);_0x2eddc3['query']=_[_0x773b('0x3c')](_0xebf5b8[_0x773b('0x3d')]);_0x2eddc3[_0x773b('0x3e')]=_['intersection'](_0x2eddc3[_0x773b('0x3b')],_0x2eddc3[_0x773b('0x3d')]);_0x21ba0e[_0x773b('0x40')]=_['intersection'](_0x2eddc3[_0x773b('0x3b')],qs[_0x773b('0x41')](_0xebf5b8[_0x773b('0x3d')][_0x773b('0x41')]));_0x21ba0e[_0x773b('0x40')]=_0x21ba0e[_0x773b('0x40')][_0x773b('0x5d')]?_0x21ba0e[_0x773b('0x40')]:_0x2eddc3[_0x773b('0x3b')];if(!_0xebf5b8[_0x773b('0x3d')]['hasOwnProperty'](_0x773b('0x43'))){_0x21ba0e['limit']=qs[_0x773b('0x25')](_0xebf5b8[_0x773b('0x3d')][_0x773b('0x25')]);_0x21ba0e[_0x773b('0x23')]=qs[_0x773b('0x23')](_0xebf5b8[_0x773b('0x3d')][_0x773b('0x23')]);}_0x21ba0e[_0x773b('0x44')]=qs[_0x773b('0x45')](_0xebf5b8[_0x773b('0x3d')][_0x773b('0x45')]);_0x21ba0e[_0x773b('0x48')]=qs['filters'](_[_0x773b('0x46')](_0xebf5b8[_0x773b('0x3d')],_0x2eddc3[_0x773b('0x3e')]));_0x21ba0e[_0x773b('0x48')][_0x773b('0x5a')]=_0x4fb5f6['id'];if(_0xebf5b8[_0x773b('0x3d')][_0x773b('0x5e')]){_0x21ba0e[_0x773b('0x48')]=_['merge'](_0x21ba0e[_0x773b('0x48')],{'$or':_['map'](_0x21ba0e['attributes'],function(_0x4ddff6){var _0x2e9137={};_0x2e9137[_0x4ddff6]={'$like':'%'+_0xebf5b8[_0x773b('0x3d')][_0x773b('0x5e')]+'%'};return _0x2e9137;})});}_0x21ba0e=_[_0x773b('0x47')]({},_0x21ba0e,_0xebf5b8[_0x773b('0x4a')]);return db[_0x773b('0x5b')][_0x773b('0x26')]({'where':_0x21ba0e['where']})[_0x773b('0x2c')](function(_0x628797){_0x401b69[_0x773b('0x26')]=_0x628797;if(_0xebf5b8[_0x773b('0x3d')]['includeAll']){_0x21ba0e[_0x773b('0x5f')]=[{'all':!![]}];}return db[_0x773b('0x5b')][_0x773b('0x4b')](_0x21ba0e);})[_0x773b('0x2c')](function(_0x10ecf0){_0x401b69[_0x773b('0x4c')]=_0x10ecf0;return _0x401b69;});}})[_0x773b('0x2c')](respondWithFilteredResult(_0x29c017,_0x21ba0e))[_0x773b('0x50')](handleError(_0x29c017,null));};exports[_0x773b('0x60')]=function(_0x3fdb51,_0x5d7449,_0x595fe8){return db['CmList'][_0x773b('0x4f')]({'where':{'id':_0x3fdb51[_0x773b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d7449,null))[_0x773b('0x2c')](function(_0x5208fc){if(_0x5208fc){return _0x5208fc['removeDispositions'](_0x3fdb51[_0x773b('0x3d')][_0x773b('0x61')]);}})[_0x773b('0x2c')](respondWithStatusCode(_0x5d7449,null))[_0x773b('0x50')](handleError(_0x5d7449,null));};exports[_0x773b('0x62')]=function(_0x4529cc,_0x4fbaa9,_0xa71d51){return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x4529cc[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x4fbaa9,null))[_0x773b('0x2c')](function(_0x1035e5){if(_0x1035e5){var _0x1fa535=[];var _0x1cc743={'success':[],'errors':[]};return db[_0x773b('0x63')]['describe']()['then'](function(_0x25d33f){if(_0x4529cc[_0x773b('0x52')]['tags']&&_['isArray'](_0x4529cc[_0x773b('0x52')][_0x773b('0x64')])){if(_0x4529cc[_0x773b('0x52')][_0x773b('0x64')][_0x773b('0x5d')]){_0x4529cc['body'][_0x773b('0x64')]=_0x4529cc['body'][_0x773b('0x64')][_0x773b('0x65')](';')+';';}else{_0x4529cc['body'][_0x773b('0x64')]=null;}}else{_0x4529cc[_0x773b('0x52')][_0x773b('0x64')]=null;}if(_0x4529cc[_0x773b('0x52')]&&_[_0x773b('0x66')](_0x4529cc[_0x773b('0x52')])){for(var _0x231552=0x0;_0x231552<_0x4529cc[_0x773b('0x52')]['length'];_0x231552+=0x1){_0x4529cc[_0x773b('0x52')][_0x231552][_0x773b('0x5a')]=_0x4529cc['params']['id'];_0x1fa535[_0x773b('0x67')](_0x4529cc[_0x773b('0x52')][_0x231552]);}return BPromise['each'](_0x1fa535,function(_0x160f15){return db['CmContact'][_0x773b('0x51')](_[_0x773b('0x68')](_0x160f15,[_0x773b('0x61'),'id'])||{},{'fields':_[_0x773b('0x3c')](_0x25d33f),'raw':!![]})[_0x773b('0x2c')](function(_0xbcb5f2){_0x1cc743[_0x773b('0x69')][_0x773b('0x67')](_0xbcb5f2[_0x773b('0x6a')]);})['catch'](function(_0x3ebe30){_0x1cc743[_0x773b('0x6b')][_0x773b('0x67')]({'data':_0x160f15,'error':_0x3ebe30[_0x773b('0x6c')]});});})[_0x773b('0x2c')](function(_0x2b36d0){return _0x1cc743;})[_0x773b('0x50')](function(_0x2b8275){return _0x2b8275;});}else{_0x4fbaa9[_0x773b('0x20')](0x190)[_0x773b('0x22')]({'message':_0x773b('0x6d')});}});}})[_0x773b('0x2c')](respondWithResult(_0x4fbaa9,null))[_0x773b('0x50')](handleError(_0x4fbaa9,null));};exports[_0x773b('0x6e')]=function(_0x924c16,_0x28730c,_0x1698b2){var _0x33b5c4;return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x924c16[_0x773b('0x4d')]['id']},'include':[{'model':db[_0x773b('0x6f')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x28730c,null))['then'](function(_0x2c21d4){if(_0x2c21d4){_0x33b5c4=_0x2c21d4;return db[_0x773b('0x63')][_0x773b('0x38')];}})['then'](function(_0x5425cd){if(_0x5425cd){var _0x4efd2f={};var _0x10ad12={};_0x10ad12[_0x773b('0x3b')]=_[_0x773b('0x70')](_['keys'](_0x5425cd),_[_0x773b('0x36')](_0x33b5c4[_0x773b('0x71')],function(_0x2d68d6){return util['format'](_0x773b('0x72'),_0x2d68d6['id']);}));_0x10ad12['query']=_[_0x773b('0x3c')](_0x924c16['query']);_0x10ad12[_0x773b('0x3e')]=_[_0x773b('0x3f')](_0x10ad12[_0x773b('0x3b')],_0x10ad12[_0x773b('0x3d')]);_0x4efd2f[_0x773b('0x40')]=_[_0x773b('0x3f')](_0x10ad12[_0x773b('0x3b')],qs[_0x773b('0x41')](_0x924c16[_0x773b('0x3d')][_0x773b('0x41')]));_0x4efd2f['attributes']=_0x4efd2f[_0x773b('0x40')][_0x773b('0x5d')]?_0x4efd2f[_0x773b('0x40')]:_0x10ad12[_0x773b('0x3b')];if(!_0x924c16[_0x773b('0x3d')][_0x773b('0x42')]('nolimit')){_0x4efd2f['limit']=qs[_0x773b('0x25')](_0x924c16[_0x773b('0x3d')][_0x773b('0x25')]);_0x4efd2f[_0x773b('0x23')]=qs[_0x773b('0x23')](_0x924c16[_0x773b('0x3d')][_0x773b('0x23')]);}_0x4efd2f[_0x773b('0x44')]=qs['sort'](_0x924c16[_0x773b('0x3d')][_0x773b('0x45')]);_0x4efd2f[_0x773b('0x48')]=qs['filters'](_[_0x773b('0x46')](_0x924c16[_0x773b('0x3d')],_0x10ad12[_0x773b('0x3e')]));_0x4efd2f['raw']=!![];if(_0x924c16[_0x773b('0x3d')][_0x773b('0x5e')]){_0x4efd2f[_0x773b('0x48')]=_[_0x773b('0x47')](_0x4efd2f['where'],{'$or':_[_0x773b('0x36')](_0x4efd2f['attributes'],function(_0x1e1153){var _0x328006={};_0x328006[_0x1e1153]={'$like':'%'+_0x924c16[_0x773b('0x3d')][_0x773b('0x5e')]+'%'};return _0x328006;})});}_0x4efd2f=_[_0x773b('0x47')]({},_0x4efd2f,_0x924c16[_0x773b('0x4a')]);return _0x33b5c4[_0x773b('0x6e')](_0x4efd2f);}})[_0x773b('0x2c')](respondWithResult(_0x28730c,null))[_0x773b('0x50')](handleError(_0x28730c,null));};exports[_0x773b('0x73')]=function(_0x49f28c,_0x4e8ef1,_0xb7687e){var _0x2ee76c;return db[_0x773b('0x37')]['find']({'where':{'id':_0x49f28c[_0x773b('0x4d')]['id']},'include':[{'model':db[_0x773b('0x6f')],'as':_0x773b('0x71')}]})[_0x773b('0x2c')](handleEntityNotFound(_0x4e8ef1,null))['then'](function(_0x55eeaf){if(_0x55eeaf){_0x2ee76c=_0x55eeaf;return db['CmContact'][_0x773b('0x38')];}})['then'](function(_0x595e16){if(_0x595e16){var _0x2bc4fd={};var _0x218d03={};_0x218d03[_0x773b('0x3b')]=_['concat'](_[_0x773b('0x3c')](_0x595e16),_[_0x773b('0x36')](_0x2ee76c[_0x773b('0x71')],function(_0x411d2a){return util['format'](_0x773b('0x72'),_0x411d2a['id']);}));_0x218d03['query']=_[_0x773b('0x3c')](_0x49f28c[_0x773b('0x3d')]);_0x218d03[_0x773b('0x3e')]=_[_0x773b('0x3f')](_0x218d03[_0x773b('0x3b')],_0x218d03[_0x773b('0x3d')]);_0x2bc4fd[_0x773b('0x40')]=_[_0x773b('0x3f')](_0x218d03[_0x773b('0x3b')],qs[_0x773b('0x41')](_0x49f28c['query'][_0x773b('0x41')]));_0x2bc4fd[_0x773b('0x40')]=_0x2bc4fd[_0x773b('0x40')][_0x773b('0x5d')]?_0x2bc4fd[_0x773b('0x40')]:_0x218d03[_0x773b('0x3b')];if(!_0x49f28c[_0x773b('0x3d')][_0x773b('0x42')](_0x773b('0x43'))){_0x2bc4fd[_0x773b('0x25')]=qs[_0x773b('0x25')](_0x49f28c['query'][_0x773b('0x25')]);_0x2bc4fd[_0x773b('0x23')]=qs[_0x773b('0x23')](_0x49f28c[_0x773b('0x3d')][_0x773b('0x23')]);}_0x2bc4fd[_0x773b('0x44')]=qs[_0x773b('0x45')](_0x49f28c[_0x773b('0x3d')][_0x773b('0x45')]);_0x2bc4fd[_0x773b('0x48')]=qs[_0x773b('0x3e')](_['pick'](_0x49f28c[_0x773b('0x3d')],_0x218d03['filters']));_0x2bc4fd['raw']=!![];if(_0x49f28c[_0x773b('0x3d')][_0x773b('0x5e')]){_0x2bc4fd[_0x773b('0x48')]=_['merge'](_0x2bc4fd[_0x773b('0x48')],{'$or':_[_0x773b('0x36')](_0x2bc4fd[_0x773b('0x40')],function(_0x3f2557){var _0x3c3816={};_0x3c3816[_0x3f2557]={'$like':'%'+_0x49f28c[_0x773b('0x3d')][_0x773b('0x5e')]+'%'};return _0x3c3816;})});}_0x2bc4fd=_[_0x773b('0x47')]({},_0x2bc4fd,_0x49f28c[_0x773b('0x4a')]);return _0x2ee76c[_0x773b('0x6e')](_0x2bc4fd);}})[_0x773b('0x2c')](function(_0x2400f0){if(!_[_0x773b('0x74')](_0x2400f0)){var _0x25fb72=toCsv(_0x2400f0);var _0x212da9=Date[_0x773b('0x75')]();fs[_0x773b('0x76')](util['format']('/tmp/list_%d_%s.csv',_0x2ee76c['id'],_0x212da9),_0x25fb72);_0x4e8ef1[_0x773b('0x77')](_0x773b('0x78'),'attachment;\x20filename='+util[_0x773b('0x79')](_0x773b('0x7a'),_0x2ee76c['id'],_0x212da9));_0x4e8ef1[_0x773b('0x77')]('Content-type',_0x773b('0x7b'));return _0x4e8ef1[_0x773b('0x7c')](util[_0x773b('0x79')](_0x773b('0x7d'),_0x2ee76c['id'],_0x212da9));}else{return _0x4e8ef1['sendStatus'](0xcc);}})[_0x773b('0x50')](handleError(_0x4e8ef1,null));};exports[_0x773b('0x7e')]=function(_0x579aab,_0x3f6ee5,_0x2b6f8b){var _0x3f718b;delete _0x579aab[_0x773b('0x52')]['id'];return db[_0x773b('0x37')][_0x773b('0x5c')]({'where':{'id':_0x579aab[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x3f6ee5,null))[_0x773b('0x2c')](function(_0x144091){if(_0x144091){return db[_0x773b('0x7f')][_0x773b('0x80')](function(_0x5a74df){return db[_0x773b('0x6f')][_0x773b('0x51')](_0x579aab['body'],{'transaction':_0x5a74df})['then'](function(_0x41ab5c){_0x3f718b=_0x41ab5c;return _0x144091[_0x773b('0x81')](_0x41ab5c,{'transaction':_0x5a74df});})[_0x773b('0x2c')](function(){var _0x50ed39={'type':db[_0x773b('0x82')]['TEXT'],'transaction':_0x5a74df};switch(_0x579aab[_0x773b('0x52')][_0x773b('0x39')]){case _0x773b('0x83'):_0x50ed39['type']=db[_0x773b('0x82')]['TEXT'];break;case _0x773b('0x84'):_0x50ed39['type']=db[_0x773b('0x82')][_0x773b('0x85')];break;case'switch':_0x50ed39[_0x773b('0x39')]=db[_0x773b('0x82')][_0x773b('0x86')];_0x50ed39[_0x773b('0x87')]=![];break;default:}return db[_0x773b('0x7f')][_0x773b('0x88')][_0x773b('0x89')]('cm_contacts',util[_0x773b('0x79')]('cf_%s',_0x3f718b['id']),_0x50ed39);})['then'](function(){return _0x3f718b;});});}})[_0x773b('0x2c')](respondWithResult(_0x3f6ee5,null))[_0x773b('0x50')](handleError(_0x3f6ee5,null));};exports[_0x773b('0x8a')]=function(_0xb6a9de,_0x993567,_0x34ce46){var _0x29ad0c={};var _0x2bcb84={};var _0x4fc3e8;var _0x218edd;return db[_0x773b('0x37')]['findOne']({'where':{'id':_0xb6a9de['params']['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x993567,null))[_0x773b('0x2c')](function(_0x4f57f2){if(_0x4f57f2){_0x4fc3e8=_0x4f57f2;_0x2bcb84[_0x773b('0x3b')]=_[_0x773b('0x3c')](db[_0x773b('0x6f')]['rawAttributes']);_0x2bcb84['query']=_['keys'](_0xb6a9de[_0x773b('0x3d')]);_0x2bcb84[_0x773b('0x3e')]=_['intersection'](_0x2bcb84[_0x773b('0x3b')],_0x2bcb84[_0x773b('0x3d')]);_0x29ad0c[_0x773b('0x40')]=_['intersection'](_0x2bcb84['model'],qs[_0x773b('0x41')](_0xb6a9de[_0x773b('0x3d')][_0x773b('0x41')]));_0x29ad0c[_0x773b('0x40')]=_0x29ad0c[_0x773b('0x40')]['length']?_0x29ad0c['attributes']:_0x2bcb84[_0x773b('0x3b')];_0x29ad0c['order']=qs['sort'](_0xb6a9de[_0x773b('0x3d')]['sort']);_0x29ad0c[_0x773b('0x48')]=qs['filters'](_[_0x773b('0x46')](_0xb6a9de[_0x773b('0x3d')],_0x2bcb84[_0x773b('0x3e')]));_0x29ad0c[_0x773b('0x48')]=_[_0x773b('0x47')](_0x29ad0c[_0x773b('0x48')],{'$or':[{'ListId':_0x4f57f2['id']},{'ListId':null}]});if(_0xb6a9de[_0x773b('0x3d')][_0x773b('0x5e')]){_0x29ad0c[_0x773b('0x48')]=_[_0x773b('0x47')](_0x29ad0c[_0x773b('0x48')],{'$or':_[_0x773b('0x36')](_0x29ad0c[_0x773b('0x40')],function(_0x4c17ed){var _0x492947={};_0x492947[_0x4c17ed]={'$like':'%'+_0xb6a9de['query'][_0x773b('0x5e')]+'%'};return _0x492947;})});}_0x29ad0c=_[_0x773b('0x47')]({},_0x29ad0c,_0xb6a9de[_0x773b('0x4a')]);return db[_0x773b('0x6f')][_0x773b('0x8b')](_0x29ad0c);}})['then'](respondWithResult(_0x993567,null))[_0x773b('0x50')](handleError(_0x993567,null));};exports[_0x773b('0x8c')]=function(_0x4f3856,_0x463d86,_0x44aee){return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x4f3856[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x463d86,null))[_0x773b('0x2c')](function(_0x1412c4){if(_0x1412c4){return _0x1412c4['addAgents'](_0x4f3856[_0x773b('0x52')]['ids'],_[_0x773b('0x68')](_0x4f3856['body'],['ids','id'])||{})[_0x773b('0x8d')](function(_0x37fe5e){for(var _0x1d3e4a=0x0;_0x1d3e4a<_0x4f3856[_0x773b('0x52')][_0x773b('0x61')][_0x773b('0x5d')];_0x1d3e4a+=0x1){socket['emit'](_0x773b('0x8e'),{'UserId':Number(_0x4f3856[_0x773b('0x52')][_0x773b('0x61')][_0x1d3e4a]),'CmListId':Number(_0x4f3856['params']['id'])});}return _0x37fe5e;});}})[_0x773b('0x2c')](respondWithResult(_0x463d86,null))[_0x773b('0x50')](handleError(_0x463d86,null));};exports['removeAgents']=function(_0x11b48c,_0xc57766,_0x3cb377){return db['CmList']['find']({'where':{'id':_0x11b48c[_0x773b('0x4d')]['id']}})['then'](handleEntityNotFound(_0xc57766,null))[_0x773b('0x2c')](function(_0x381d98){if(_0x381d98){return _0x381d98[_0x773b('0x8f')](_0x11b48c['query'][_0x773b('0x61')])['then'](function(){if(_['isArray'](_0x11b48c['query'][_0x773b('0x61')])){for(var _0x562531=0x0;_0x562531<_0x11b48c[_0x773b('0x3d')][_0x773b('0x61')][_0x773b('0x5d')];_0x562531+=0x1){socket[_0x773b('0x90')]('userCmList:remove',{'UserId':Number(_0x11b48c[_0x773b('0x3d')]['ids'][_0x562531]),'CmListId':Number(_0x11b48c[_0x773b('0x4d')]['id'])});}}else{socket['emit'](_0x773b('0x91'),{'UserId':Number(_0x11b48c[_0x773b('0x3d')][_0x773b('0x61')]),'CmListId':Number(_0x11b48c[_0x773b('0x4d')]['id'])});}});}})[_0x773b('0x2c')](respondWithStatusCode(_0xc57766,null))['catch'](handleError(_0xc57766,null));};exports[_0x773b('0x92')]=function(_0x3131e0,_0x2a8b0f,_0x310057){var _0x37d218={};var _0x24a7b0={};var _0x116f0f;var _0x56f388;return db[_0x773b('0x37')][_0x773b('0x5c')]({'where':{'id':_0x3131e0['params']['id']}})['then'](handleEntityNotFound(_0x2a8b0f,null))[_0x773b('0x2c')](function(_0x3c3422){if(_0x3c3422){_0x116f0f=_0x3c3422;_0x24a7b0[_0x773b('0x3b')]=_[_0x773b('0x3c')](db[_0x773b('0x93')][_0x773b('0x38')]);_0x24a7b0[_0x773b('0x3d')]=_[_0x773b('0x3c')](_0x3131e0['query']);_0x24a7b0['filters']=_[_0x773b('0x3f')](_0x24a7b0[_0x773b('0x3b')],_0x24a7b0[_0x773b('0x3d')]);_0x37d218['attributes']=_[_0x773b('0x3f')](_0x24a7b0[_0x773b('0x3b')],qs['fields'](_0x3131e0[_0x773b('0x3d')][_0x773b('0x41')]));_0x37d218[_0x773b('0x40')]=_0x37d218[_0x773b('0x40')][_0x773b('0x5d')]?_0x37d218['attributes']:_0x24a7b0[_0x773b('0x3b')];_0x37d218[_0x773b('0x44')]=qs['sort'](_0x3131e0[_0x773b('0x3d')][_0x773b('0x45')]);_0x37d218[_0x773b('0x48')]=qs[_0x773b('0x3e')](_[_0x773b('0x46')](_0x3131e0[_0x773b('0x3d')],_0x24a7b0['filters']));if(_0x3131e0[_0x773b('0x3d')][_0x773b('0x5e')]){_0x37d218[_0x773b('0x48')]=_['merge'](_0x37d218[_0x773b('0x48')],{'$or':_[_0x773b('0x36')](_0x37d218['attributes'],function(_0x23dcaa){var _0x2b9782={};_0x2b9782[_0x23dcaa]={'$like':'%'+_0x3131e0[_0x773b('0x3d')][_0x773b('0x5e')]+'%'};return _0x2b9782;})});}_0x37d218=_[_0x773b('0x47')]({},_0x37d218,_0x3131e0[_0x773b('0x4a')]);return _0x116f0f[_0x773b('0x92')](_0x37d218);}})[_0x773b('0x2c')](function(_0x6a16fc){if(_0x6a16fc){_0x56f388=_0x6a16fc[_0x773b('0x5d')];if(!_0x3131e0[_0x773b('0x3d')][_0x773b('0x42')](_0x773b('0x43'))){_0x37d218['limit']=qs[_0x773b('0x25')](_0x3131e0[_0x773b('0x3d')][_0x773b('0x25')]);_0x37d218[_0x773b('0x23')]=qs['offset'](_0x3131e0['query'][_0x773b('0x23')]);}return _0x116f0f['getAgents'](_0x37d218);}})['then'](function(_0x4356fe){if(_0x4356fe){return _0x4356fe?{'count':_0x56f388,'rows':_0x4356fe}:null;}})[_0x773b('0x2c')](respondWithResult(_0x2a8b0f,null))['catch'](handleError(_0x2a8b0f,null));}; \ No newline at end of file +var _0xb947=['register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','stack','name','send','map','CmList','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','params','describe','addDisposition','ListId','Disposition','create','getDispositions','findOne','removeDispositions','addContacts','CmContact','tags','isArray','push','each','omit','ids','success','message','CmCustomField','CustomFields','concat','cf_%d','raw','getContacts','getContactsCsv','format','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','sequelize','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb947,0x73));var _0x7b94=function(_0x27e916,_0x490784){_0x27e916=_0x27e916-0x0;var _0x582985=_0xb947[_0x27e916];return _0x582985;};'use strict';var emlformat=require(_0x7b94('0x0'));var rimraf=require(_0x7b94('0x1'));var zipdir=require(_0x7b94('0x2'));var jsonpatch=require(_0x7b94('0x3'));var rp=require(_0x7b94('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b94('0x5'));var path=require(_0x7b94('0x6'));var sox=require(_0x7b94('0x7'));var csv=require(_0x7b94('0x8'));var ejs=require(_0x7b94('0x9'));var fs=require('fs');var fs_extra=require(_0x7b94('0xa'));var _=require(_0x7b94('0xb'));var squel=require(_0x7b94('0xc'));var crypto=require('crypto');var jsforce=require(_0x7b94('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7b94('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b94('0xe'));var authService=require(_0x7b94('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7b94('0x10'));var hardwareService=require(_0x7b94('0x11'));var logger=require(_0x7b94('0x12'))(_0x7b94('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b94('0x14'));var db=require(_0x7b94('0x15'))['db'];config[_0x7b94('0x16')]=_[_0x7b94('0x17')](config[_0x7b94('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b94('0x18'))(new Redis(config[_0x7b94('0x16')]));require(_0x7b94('0x19'))[_0x7b94('0x1a')](socket);function respondWithStatusCode(_0x15fbe3,_0x4e7721){_0x4e7721=_0x4e7721||0xcc;return function(_0x4e84a7){if(_0x4e84a7){return _0x15fbe3[_0x7b94('0x1b')](_0x4e7721);}return _0x15fbe3['status'](_0x4e7721)[_0x7b94('0x1c')]();};}function respondWithResult(_0x1cc454,_0x3d8fbd){_0x3d8fbd=_0x3d8fbd||0xc8;return function(_0x15f70c){if(_0x15f70c){return _0x1cc454[_0x7b94('0x1d')](_0x3d8fbd)[_0x7b94('0x1e')](_0x15f70c);}};}function respondWithFilteredResult(_0xe8dc4b,_0x420638){return function(_0x267017){if(_0x267017){var _0x44756c=typeof _0x420638['offset']===_0x7b94('0x1f')&&typeof _0x420638[_0x7b94('0x20')]===_0x7b94('0x1f');var _0x22cb71=_0x267017[_0x7b94('0x21')];var _0x5c1de1=_0x44756c?0x0:_0x420638[_0x7b94('0x22')];var _0x2bd6a6=_0x44756c?_0x267017[_0x7b94('0x21')]:_0x420638[_0x7b94('0x22')]+_0x420638[_0x7b94('0x20')];var _0x51f8ae;if(_0x2bd6a6>=_0x22cb71){_0x2bd6a6=_0x22cb71;_0x51f8ae=0xc8;}else{_0x51f8ae=0xce;}_0xe8dc4b[_0x7b94('0x1d')](_0x51f8ae);return _0xe8dc4b[_0x7b94('0x23')](_0x7b94('0x24'),_0x5c1de1+'-'+_0x2bd6a6+'/'+_0x22cb71)[_0x7b94('0x1e')](_0x267017);}return null;};}function patchUpdates(_0x146943){return function(_0x3c068f){try{jsonpatch[_0x7b94('0x25')](_0x3c068f,_0x146943,!![]);}catch(_0x17a144){return BPromise[_0x7b94('0x26')](_0x17a144);}return _0x3c068f[_0x7b94('0x27')]();};}function saveUpdates(_0x8ed905,_0x209c7e){return function(_0x1798d8){if(_0x1798d8){return _0x1798d8[_0x7b94('0x28')](_0x8ed905)['then'](function(_0x23ebd0){return _0x23ebd0;});}return null;};}function removeEntity(_0x50ae8e,_0xfd9353){return function(_0x355ab1){if(_0x355ab1){return _0x355ab1[_0x7b94('0x29')]()[_0x7b94('0x2a')](function(){var _0xe865ad=_0x355ab1[_0x7b94('0x2b')]({'plain':!![]});var _0x4791da=_0x7b94('0x2c');return db[_0x7b94('0x2d')][_0x7b94('0x29')]({'where':{'type':_0x4791da,'resourceId':_0xe865ad['id']}})['then'](function(){return _0x355ab1;});})[_0x7b94('0x2a')](function(){_0x50ae8e[_0x7b94('0x1d')](0xcc)[_0x7b94('0x1c')]();});}};}function handleEntityNotFound(_0x157b23,_0x4f7ca7){return function(_0x574e86){if(!_0x574e86){_0x157b23[_0x7b94('0x1b')](0x194);}return _0x574e86;};}function handleError(_0x36803f,_0x1453e1){_0x1453e1=_0x1453e1||0x1f4;return function(_0x9a078c){logger['error'](_0x9a078c[_0x7b94('0x2e')]);if(_0x9a078c[_0x7b94('0x2f')]){delete _0x9a078c[_0x7b94('0x2f')];}_0x36803f[_0x7b94('0x1d')](_0x1453e1)[_0x7b94('0x30')](_0x9a078c);};}exports['index']=function(_0x1b98d6,_0xaff53b){var _0xe90588={},_0xf5db8a={},_0x3ca474={'count':0x0,'rows':[]};var _0x15cd6a=_[_0x7b94('0x31')](db[_0x7b94('0x32')][_0x7b94('0x33')],function(_0x534b9e){return{'name':_0x534b9e['fieldName'],'type':_0x534b9e[_0x7b94('0x34')][_0x7b94('0x35')]};});_0xf5db8a['model']=_[_0x7b94('0x31')](_0x15cd6a,'name');_0xf5db8a[_0x7b94('0x36')]=_[_0x7b94('0x37')](_0x1b98d6[_0x7b94('0x36')]);_0xf5db8a['filters']=_[_0x7b94('0x38')](_0xf5db8a[_0x7b94('0x39')],_0xf5db8a[_0x7b94('0x36')]);_0xe90588[_0x7b94('0x3a')]=_['intersection'](_0xf5db8a['model'],qs[_0x7b94('0x3b')](_0x1b98d6['query'][_0x7b94('0x3b')]));_0xe90588[_0x7b94('0x3a')]=_0xe90588[_0x7b94('0x3a')][_0x7b94('0x3c')]?_0xe90588[_0x7b94('0x3a')]:_0xf5db8a[_0x7b94('0x39')];if(!_0x1b98d6['query'][_0x7b94('0x3d')](_0x7b94('0x3e'))){_0xe90588['limit']=qs[_0x7b94('0x20')](_0x1b98d6[_0x7b94('0x36')][_0x7b94('0x20')]);_0xe90588[_0x7b94('0x22')]=qs[_0x7b94('0x22')](_0x1b98d6[_0x7b94('0x36')][_0x7b94('0x22')]);}_0xe90588[_0x7b94('0x3f')]=qs[_0x7b94('0x40')](_0x1b98d6[_0x7b94('0x36')][_0x7b94('0x40')]);_0xe90588[_0x7b94('0x41')]=qs[_0x7b94('0x42')](_[_0x7b94('0x43')](_0x1b98d6[_0x7b94('0x36')],_0xf5db8a[_0x7b94('0x42')]),_0x15cd6a);if(_0x1b98d6['query']['filter']){_0xe90588[_0x7b94('0x41')]=_[_0x7b94('0x44')](_0xe90588[_0x7b94('0x41')],{'$or':_[_0x7b94('0x31')](_0x15cd6a,function(_0x14fca2){if(_0x14fca2['type']!==_0x7b94('0x45')){var _0x49b18d={};_0x49b18d[_0x14fca2[_0x7b94('0x2f')]]={'$like':'%'+_0x1b98d6[_0x7b94('0x36')][_0x7b94('0x46')]+'%'};return _0x49b18d;}})});}_0xe90588=_[_0x7b94('0x44')]({},_0xe90588,_0x1b98d6[_0x7b94('0x47')]);var _0x655352={'where':_0xe90588[_0x7b94('0x41')]};return db[_0x7b94('0x32')][_0x7b94('0x21')](_0x655352)['then'](function(_0x192425){_0x3ca474['count']=_0x192425;if(_0x1b98d6[_0x7b94('0x36')][_0x7b94('0x48')]){_0xe90588[_0x7b94('0x49')]=[{'all':!![]}];}return db['CmList'][_0x7b94('0x4a')](_0xe90588);})[_0x7b94('0x2a')](function(_0x41af44){_0x3ca474[_0x7b94('0x4b')]=_0x41af44;return _0x3ca474;})[_0x7b94('0x2a')](respondWithFilteredResult(_0xaff53b,_0xe90588))[_0x7b94('0x4c')](handleError(_0xaff53b,null));};exports[_0x7b94('0x4d')]=function(_0x3fee07,_0x46e4c7){var _0x29982f={'raw':![],'where':{'id':_0x3fee07['params']['id']}},_0x1bcefe={};_0x1bcefe['model']=_['keys'](db[_0x7b94('0x32')][_0x7b94('0x33')]);_0x1bcefe[_0x7b94('0x36')]=_['keys'](_0x3fee07[_0x7b94('0x36')]);_0x1bcefe[_0x7b94('0x42')]=_['intersection'](_0x1bcefe[_0x7b94('0x39')],_0x1bcefe[_0x7b94('0x36')]);_0x29982f[_0x7b94('0x3a')]=_[_0x7b94('0x38')](_0x1bcefe[_0x7b94('0x39')],qs[_0x7b94('0x3b')](_0x3fee07[_0x7b94('0x36')][_0x7b94('0x3b')]));_0x29982f[_0x7b94('0x3a')]=_0x29982f['attributes']['length']?_0x29982f['attributes']:_0x1bcefe[_0x7b94('0x39')];if(_0x3fee07[_0x7b94('0x36')][_0x7b94('0x48')]){_0x29982f['include']=[{'all':!![]}];}_0x29982f=_[_0x7b94('0x44')]({},_0x29982f,_0x3fee07[_0x7b94('0x47')]);return db[_0x7b94('0x32')][_0x7b94('0x4e')](_0x29982f)['then'](handleEntityNotFound(_0x46e4c7,null))[_0x7b94('0x2a')](respondWithResult(_0x46e4c7,null))[_0x7b94('0x4c')](handleError(_0x46e4c7,null));};exports['create']=function(_0x162014,_0x306de1){return db['CmList']['create'](_0x162014[_0x7b94('0x4f')],{})[_0x7b94('0x2a')](function(_0xff3491){var _0x382a9f=_0x162014['user'][_0x7b94('0x2b')]({'plain':!![]});if(!_0x382a9f)throw new Error(_0x7b94('0x50'));if(_0x382a9f['role']===_0x7b94('0x51')){var _0x1045cf=_0xff3491[_0x7b94('0x2b')]({'plain':!![]});var _0x15f6c6='Lists';return db[_0x7b94('0x52')][_0x7b94('0x4e')]({'where':{'name':_0x15f6c6,'userProfileId':_0x382a9f['userProfileId']},'raw':!![]})[_0x7b94('0x2a')](function(_0x3cf218){if(_0x3cf218&&_0x3cf218[_0x7b94('0x53')]===0x0){return db[_0x7b94('0x2d')]['create']({'name':_0x1045cf['name'],'resourceId':_0x1045cf['id'],'type':_0x3cf218['name'],'sectionId':_0x3cf218['id']},{})['then'](function(){return _0xff3491;});}else{return _0xff3491;}})[_0x7b94('0x4c')](function(_0x513464){logger[_0x7b94('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x513464);throw _0x513464;});}return _0xff3491;})[_0x7b94('0x2a')](respondWithResult(_0x306de1,0xc9))[_0x7b94('0x4c')](handleError(_0x306de1,null));};exports[_0x7b94('0x28')]=function(_0x51a888,_0x2f0ba3){if(_0x51a888['body']['id']){delete _0x51a888[_0x7b94('0x4f')]['id'];}return db[_0x7b94('0x32')][_0x7b94('0x4e')]({'where':{'id':_0x51a888['params']['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x2f0ba3,null))[_0x7b94('0x2a')](saveUpdates(_0x51a888[_0x7b94('0x4f')],null))[_0x7b94('0x2a')](respondWithResult(_0x2f0ba3,null))[_0x7b94('0x4c')](handleError(_0x2f0ba3,null));};exports[_0x7b94('0x29')]=function(_0x334bfd,_0x118b2b){return db[_0x7b94('0x32')]['find']({'where':{'id':_0x334bfd[_0x7b94('0x55')]['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x118b2b,null))['then'](removeEntity(_0x118b2b,null))[_0x7b94('0x4c')](handleError(_0x118b2b,null));};exports[_0x7b94('0x56')]=function(_0x395792,_0x5099dd){return db[_0x7b94('0x32')][_0x7b94('0x56')]()[_0x7b94('0x2a')](respondWithResult(_0x5099dd,null))[_0x7b94('0x4c')](handleError(_0x5099dd,null));};exports[_0x7b94('0x57')]=function(_0x45934d,_0x486150,_0x24a98a){if(_0x45934d[_0x7b94('0x4f')]['id']){delete _0x45934d[_0x7b94('0x4f')]['id'];}return db[_0x7b94('0x32')][_0x7b94('0x4e')]({'where':{'id':_0x45934d['params']['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x486150,null))[_0x7b94('0x2a')](function(_0x1f6a7a){if(_0x1f6a7a){_0x45934d[_0x7b94('0x4f')][_0x7b94('0x58')]=_0x1f6a7a['id'];return db[_0x7b94('0x59')][_0x7b94('0x5a')](_0x45934d['body']);}})['then'](respondWithResult(_0x486150,null))[_0x7b94('0x4c')](handleError(_0x486150,null));};exports[_0x7b94('0x5b')]=function(_0x13c526,_0x21fc1b,_0x6be383){var _0x4d8deb={'raw':![],'where':{}};var _0x4f4b78={};var _0x4d3432={'count':0x0,'rows':[]};return db[_0x7b94('0x32')][_0x7b94('0x5c')]({'where':{'id':_0x13c526[_0x7b94('0x55')]['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x21fc1b,null))[_0x7b94('0x2a')](function(_0x5ef85a){if(_0x5ef85a){_0x4f4b78[_0x7b94('0x39')]=_[_0x7b94('0x37')](db[_0x7b94('0x59')][_0x7b94('0x33')]);_0x4f4b78[_0x7b94('0x36')]=_[_0x7b94('0x37')](_0x13c526[_0x7b94('0x36')]);_0x4f4b78['filters']=_[_0x7b94('0x38')](_0x4f4b78[_0x7b94('0x39')],_0x4f4b78['query']);_0x4d8deb[_0x7b94('0x3a')]=_[_0x7b94('0x38')](_0x4f4b78[_0x7b94('0x39')],qs[_0x7b94('0x3b')](_0x13c526[_0x7b94('0x36')][_0x7b94('0x3b')]));_0x4d8deb[_0x7b94('0x3a')]=_0x4d8deb[_0x7b94('0x3a')][_0x7b94('0x3c')]?_0x4d8deb[_0x7b94('0x3a')]:_0x4f4b78['model'];if(!_0x13c526[_0x7b94('0x36')]['hasOwnProperty']('nolimit')){_0x4d8deb[_0x7b94('0x20')]=qs[_0x7b94('0x20')](_0x13c526[_0x7b94('0x36')][_0x7b94('0x20')]);_0x4d8deb[_0x7b94('0x22')]=qs[_0x7b94('0x22')](_0x13c526[_0x7b94('0x36')][_0x7b94('0x22')]);}_0x4d8deb['order']=qs['sort'](_0x13c526[_0x7b94('0x36')][_0x7b94('0x40')]);_0x4d8deb['where']=qs[_0x7b94('0x42')](_[_0x7b94('0x43')](_0x13c526[_0x7b94('0x36')],_0x4f4b78[_0x7b94('0x42')]));_0x4d8deb[_0x7b94('0x41')]['ListId']=_0x5ef85a['id'];if(_0x13c526[_0x7b94('0x36')][_0x7b94('0x46')]){_0x4d8deb[_0x7b94('0x41')]=_[_0x7b94('0x44')](_0x4d8deb[_0x7b94('0x41')],{'$or':_['map'](_0x4d8deb['attributes'],function(_0x1dd40d){var _0x2e186b={};_0x2e186b[_0x1dd40d]={'$like':'%'+_0x13c526[_0x7b94('0x36')]['filter']+'%'};return _0x2e186b;})});}_0x4d8deb=_[_0x7b94('0x44')]({},_0x4d8deb,_0x13c526[_0x7b94('0x47')]);return db[_0x7b94('0x59')][_0x7b94('0x21')]({'where':_0x4d8deb['where']})[_0x7b94('0x2a')](function(_0x26b9e8){_0x4d3432[_0x7b94('0x21')]=_0x26b9e8;if(_0x13c526['query'][_0x7b94('0x48')]){_0x4d8deb[_0x7b94('0x49')]=[{'all':!![]}];}return db[_0x7b94('0x59')][_0x7b94('0x4a')](_0x4d8deb);})[_0x7b94('0x2a')](function(_0x2f0830){_0x4d3432[_0x7b94('0x4b')]=_0x2f0830;return _0x4d3432;});}})[_0x7b94('0x2a')](respondWithFilteredResult(_0x21fc1b,_0x4d8deb))[_0x7b94('0x4c')](handleError(_0x21fc1b,null));};exports[_0x7b94('0x5d')]=function(_0x5918c5,_0x4d9445,_0x219f44){return db[_0x7b94('0x32')]['find']({'where':{'id':_0x5918c5['params']['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x4d9445,null))[_0x7b94('0x2a')](function(_0x35f824){if(_0x35f824){return _0x35f824['removeDispositions'](_0x5918c5[_0x7b94('0x36')]['ids']);}})['then'](respondWithStatusCode(_0x4d9445,null))[_0x7b94('0x4c')](handleError(_0x4d9445,null));};exports[_0x7b94('0x5e')]=function(_0x50d725,_0x3c09b0,_0x25af94){return db[_0x7b94('0x32')][_0x7b94('0x4e')]({'where':{'id':_0x50d725[_0x7b94('0x55')]['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x3c09b0,null))['then'](function(_0xdf19fa){if(_0xdf19fa){var _0x31e128=[];var _0x4bccb1={'success':[],'errors':[]};return db[_0x7b94('0x5f')][_0x7b94('0x56')]()[_0x7b94('0x2a')](function(_0x4559fe){if(_0x50d725['body'][_0x7b94('0x60')]&&_[_0x7b94('0x61')](_0x50d725['body'][_0x7b94('0x60')])){if(_0x50d725['body']['tags'][_0x7b94('0x3c')]){_0x50d725[_0x7b94('0x4f')]['tags']=_0x50d725[_0x7b94('0x4f')][_0x7b94('0x60')]['join'](';')+';';}else{_0x50d725['body'][_0x7b94('0x60')]=null;}}else{_0x50d725['body']['tags']=null;}if(_0x50d725[_0x7b94('0x4f')]&&_[_0x7b94('0x61')](_0x50d725['body'])){for(var _0x4d8bb3=0x0;_0x4d8bb3<_0x50d725[_0x7b94('0x4f')]['length'];_0x4d8bb3+=0x1){_0x50d725[_0x7b94('0x4f')][_0x4d8bb3][_0x7b94('0x58')]=_0x50d725[_0x7b94('0x55')]['id'];_0x31e128[_0x7b94('0x62')](_0x50d725['body'][_0x4d8bb3]);}return BPromise[_0x7b94('0x63')](_0x31e128,function(_0x1bf3cd){return db[_0x7b94('0x5f')][_0x7b94('0x5a')](_[_0x7b94('0x64')](_0x1bf3cd,[_0x7b94('0x65'),'id'])||{},{'fields':_['keys'](_0x4559fe),'raw':!![]})[_0x7b94('0x2a')](function(_0xd15639){_0x4bccb1[_0x7b94('0x66')]['push'](_0xd15639['dataValues']);})[_0x7b94('0x4c')](function(_0x36c297){_0x4bccb1['errors'][_0x7b94('0x62')]({'data':_0x1bf3cd,'error':_0x36c297[_0x7b94('0x67')]});});})[_0x7b94('0x2a')](function(_0x162627){return _0x4bccb1;})[_0x7b94('0x4c')](function(_0x1b5c28){return _0x1b5c28;});}else{_0x3c09b0[_0x7b94('0x1d')](0x190)[_0x7b94('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x7b94('0x2a')](respondWithResult(_0x3c09b0,null))['catch'](handleError(_0x3c09b0,null));};exports['getContacts']=function(_0x30d038,_0x2fcf5b,_0x5f7ac6){var _0x5f299f;return db[_0x7b94('0x32')][_0x7b94('0x4e')]({'where':{'id':_0x30d038[_0x7b94('0x55')]['id']},'include':[{'model':db[_0x7b94('0x68')],'as':_0x7b94('0x69')}]})[_0x7b94('0x2a')](handleEntityNotFound(_0x2fcf5b,null))[_0x7b94('0x2a')](function(_0x2f3bcc){if(_0x2f3bcc){_0x5f299f=_0x2f3bcc;return db['CmContact']['rawAttributes'];}})[_0x7b94('0x2a')](function(_0x5900e9){if(_0x5900e9){var _0x2f9eb6={};var _0x579ee8={};_0x579ee8['model']=_[_0x7b94('0x6a')](_[_0x7b94('0x37')](_0x5900e9),_['map'](_0x5f299f[_0x7b94('0x69')],function(_0xff3a39){return util['format'](_0x7b94('0x6b'),_0xff3a39['id']);}));_0x579ee8[_0x7b94('0x36')]=_[_0x7b94('0x37')](_0x30d038[_0x7b94('0x36')]);_0x579ee8['filters']=_[_0x7b94('0x38')](_0x579ee8['model'],_0x579ee8[_0x7b94('0x36')]);_0x2f9eb6['attributes']=_[_0x7b94('0x38')](_0x579ee8[_0x7b94('0x39')],qs[_0x7b94('0x3b')](_0x30d038[_0x7b94('0x36')][_0x7b94('0x3b')]));_0x2f9eb6[_0x7b94('0x3a')]=_0x2f9eb6['attributes'][_0x7b94('0x3c')]?_0x2f9eb6[_0x7b94('0x3a')]:_0x579ee8[_0x7b94('0x39')];if(!_0x30d038[_0x7b94('0x36')][_0x7b94('0x3d')]('nolimit')){_0x2f9eb6[_0x7b94('0x20')]=qs[_0x7b94('0x20')](_0x30d038[_0x7b94('0x36')][_0x7b94('0x20')]);_0x2f9eb6[_0x7b94('0x22')]=qs[_0x7b94('0x22')](_0x30d038['query'][_0x7b94('0x22')]);}_0x2f9eb6['order']=qs[_0x7b94('0x40')](_0x30d038[_0x7b94('0x36')][_0x7b94('0x40')]);_0x2f9eb6[_0x7b94('0x41')]=qs[_0x7b94('0x42')](_[_0x7b94('0x43')](_0x30d038[_0x7b94('0x36')],_0x579ee8['filters']));_0x2f9eb6[_0x7b94('0x6c')]=!![];if(_0x30d038[_0x7b94('0x36')]['filter']){_0x2f9eb6[_0x7b94('0x41')]=_[_0x7b94('0x44')](_0x2f9eb6[_0x7b94('0x41')],{'$or':_[_0x7b94('0x31')](_0x2f9eb6[_0x7b94('0x3a')],function(_0x5f5826){var _0x20d6a8={};_0x20d6a8[_0x5f5826]={'$like':'%'+_0x30d038[_0x7b94('0x36')][_0x7b94('0x46')]+'%'};return _0x20d6a8;})});}_0x2f9eb6=_['merge']({},_0x2f9eb6,_0x30d038[_0x7b94('0x47')]);return _0x5f299f[_0x7b94('0x6d')](_0x2f9eb6);}})[_0x7b94('0x2a')](respondWithResult(_0x2fcf5b,null))['catch'](handleError(_0x2fcf5b,null));};exports[_0x7b94('0x6e')]=function(_0x3f4c36,_0x14cc7b,_0x1ca066){var _0x155b7b;return db['CmList'][_0x7b94('0x4e')]({'where':{'id':_0x3f4c36[_0x7b94('0x55')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x7b94('0x69')}]})[_0x7b94('0x2a')](handleEntityNotFound(_0x14cc7b,null))[_0x7b94('0x2a')](function(_0x3e35ff){if(_0x3e35ff){_0x155b7b=_0x3e35ff;return db[_0x7b94('0x5f')][_0x7b94('0x33')];}})[_0x7b94('0x2a')](function(_0x439501){if(_0x439501){var _0x442e2e={};var _0x18427f={};_0x18427f['model']=_[_0x7b94('0x6a')](_[_0x7b94('0x37')](_0x439501),_[_0x7b94('0x31')](_0x155b7b['CustomFields'],function(_0x46e161){return util[_0x7b94('0x6f')]('cf_%d',_0x46e161['id']);}));_0x18427f['query']=_['keys'](_0x3f4c36[_0x7b94('0x36')]);_0x18427f[_0x7b94('0x42')]=_[_0x7b94('0x38')](_0x18427f[_0x7b94('0x39')],_0x18427f[_0x7b94('0x36')]);_0x442e2e['attributes']=_['intersection'](_0x18427f[_0x7b94('0x39')],qs[_0x7b94('0x3b')](_0x3f4c36[_0x7b94('0x36')][_0x7b94('0x3b')]));_0x442e2e[_0x7b94('0x3a')]=_0x442e2e[_0x7b94('0x3a')]['length']?_0x442e2e[_0x7b94('0x3a')]:_0x18427f[_0x7b94('0x39')];if(!_0x3f4c36['query']['hasOwnProperty'](_0x7b94('0x3e'))){_0x442e2e['limit']=qs[_0x7b94('0x20')](_0x3f4c36[_0x7b94('0x36')]['limit']);_0x442e2e[_0x7b94('0x22')]=qs[_0x7b94('0x22')](_0x3f4c36['query'][_0x7b94('0x22')]);}_0x442e2e[_0x7b94('0x3f')]=qs[_0x7b94('0x40')](_0x3f4c36[_0x7b94('0x36')]['sort']);_0x442e2e[_0x7b94('0x41')]=qs['filters'](_[_0x7b94('0x43')](_0x3f4c36[_0x7b94('0x36')],_0x18427f['filters']));_0x442e2e[_0x7b94('0x6c')]=!![];if(_0x3f4c36[_0x7b94('0x36')]['filter']){_0x442e2e[_0x7b94('0x41')]=_[_0x7b94('0x44')](_0x442e2e[_0x7b94('0x41')],{'$or':_[_0x7b94('0x31')](_0x442e2e['attributes'],function(_0x34bfc4){var _0x4e8ad9={};_0x4e8ad9[_0x34bfc4]={'$like':'%'+_0x3f4c36['query'][_0x7b94('0x46')]+'%'};return _0x4e8ad9;})});}_0x442e2e=_[_0x7b94('0x44')]({},_0x442e2e,_0x3f4c36[_0x7b94('0x47')]);return _0x155b7b[_0x7b94('0x6d')](_0x442e2e);}})[_0x7b94('0x2a')](function(_0x110054){if(!_[_0x7b94('0x70')](_0x110054)){var _0x4fe5fd=toCsv(_0x110054);var _0x59985c=Date[_0x7b94('0x71')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x155b7b['id'],_0x59985c),_0x4fe5fd);_0x14cc7b[_0x7b94('0x72')](_0x7b94('0x73'),_0x7b94('0x74')+util[_0x7b94('0x6f')](_0x7b94('0x75'),_0x155b7b['id'],_0x59985c));_0x14cc7b['setHeader'](_0x7b94('0x76'),'text/csv');return _0x14cc7b['download'](util[_0x7b94('0x6f')]('/tmp/list_%d_%s.csv',_0x155b7b['id'],_0x59985c));}else{return _0x14cc7b[_0x7b94('0x1b')](0xcc);}})[_0x7b94('0x4c')](handleError(_0x14cc7b,null));};exports[_0x7b94('0x77')]=function(_0x31a15c,_0x256be1,_0x132172){var _0x54bc45;delete _0x31a15c[_0x7b94('0x4f')]['id'];return db[_0x7b94('0x32')][_0x7b94('0x5c')]({'where':{'id':_0x31a15c[_0x7b94('0x55')]['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x256be1,null))[_0x7b94('0x2a')](function(_0x4664c9){if(_0x4664c9){return db['sequelize'][_0x7b94('0x78')](function(_0x30ad0b){return db[_0x7b94('0x68')]['create'](_0x31a15c['body'],{'transaction':_0x30ad0b})[_0x7b94('0x2a')](function(_0x3350bb){_0x54bc45=_0x3350bb;return _0x4664c9['addCustomFields'](_0x3350bb,{'transaction':_0x30ad0b});})[_0x7b94('0x2a')](function(){var _0xe846a4={'type':db[_0x7b94('0x79')][_0x7b94('0x7a')],'transaction':_0x30ad0b};switch(_0x31a15c[_0x7b94('0x4f')]['type']){case _0x7b94('0x7b'):_0xe846a4[_0x7b94('0x34')]=db[_0x7b94('0x79')][_0x7b94('0x7a')];break;case _0x7b94('0x7c'):_0xe846a4[_0x7b94('0x34')]=db[_0x7b94('0x79')][_0x7b94('0x7d')];break;case _0x7b94('0x7e'):_0xe846a4[_0x7b94('0x34')]=db[_0x7b94('0x79')][_0x7b94('0x7f')];_0xe846a4['defaultValue']=![];break;default:}return db[_0x7b94('0x80')]['queryInterface'][_0x7b94('0x81')](_0x7b94('0x82'),util[_0x7b94('0x6f')](_0x7b94('0x83'),_0x54bc45['id']),_0xe846a4);})[_0x7b94('0x2a')](function(){return _0x54bc45;});});}})[_0x7b94('0x2a')](respondWithResult(_0x256be1,null))[_0x7b94('0x4c')](handleError(_0x256be1,null));};exports[_0x7b94('0x84')]=function(_0xb94085,_0x1e9378,_0x2bc411){var _0x2a7a20={};var _0x230e1b={};var _0x5b8172;var _0xa10940;return db[_0x7b94('0x32')][_0x7b94('0x5c')]({'where':{'id':_0xb94085[_0x7b94('0x55')]['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x1e9378,null))['then'](function(_0x5cd72d){if(_0x5cd72d){_0x5b8172=_0x5cd72d;_0x230e1b[_0x7b94('0x39')]=_['keys'](db[_0x7b94('0x68')][_0x7b94('0x33')]);_0x230e1b[_0x7b94('0x36')]=_[_0x7b94('0x37')](_0xb94085[_0x7b94('0x36')]);_0x230e1b[_0x7b94('0x42')]=_[_0x7b94('0x38')](_0x230e1b[_0x7b94('0x39')],_0x230e1b['query']);_0x2a7a20[_0x7b94('0x3a')]=_[_0x7b94('0x38')](_0x230e1b['model'],qs[_0x7b94('0x3b')](_0xb94085[_0x7b94('0x36')]['fields']));_0x2a7a20[_0x7b94('0x3a')]=_0x2a7a20['attributes'][_0x7b94('0x3c')]?_0x2a7a20[_0x7b94('0x3a')]:_0x230e1b[_0x7b94('0x39')];_0x2a7a20[_0x7b94('0x3f')]=qs[_0x7b94('0x40')](_0xb94085[_0x7b94('0x36')][_0x7b94('0x40')]);_0x2a7a20[_0x7b94('0x41')]=qs[_0x7b94('0x42')](_[_0x7b94('0x43')](_0xb94085['query'],_0x230e1b[_0x7b94('0x42')]));_0x2a7a20['where']=_['merge'](_0x2a7a20['where'],{'$or':[{'ListId':_0x5cd72d['id']},{'ListId':null}]});if(_0xb94085[_0x7b94('0x36')][_0x7b94('0x46')]){_0x2a7a20[_0x7b94('0x41')]=_[_0x7b94('0x44')](_0x2a7a20['where'],{'$or':_[_0x7b94('0x31')](_0x2a7a20[_0x7b94('0x3a')],function(_0x435680){var _0x421134={};_0x421134[_0x435680]={'$like':'%'+_0xb94085[_0x7b94('0x36')][_0x7b94('0x46')]+'%'};return _0x421134;})});}_0x2a7a20=_[_0x7b94('0x44')]({},_0x2a7a20,_0xb94085[_0x7b94('0x47')]);return db[_0x7b94('0x68')][_0x7b94('0x85')](_0x2a7a20);}})[_0x7b94('0x2a')](respondWithResult(_0x1e9378,null))[_0x7b94('0x4c')](handleError(_0x1e9378,null));};exports[_0x7b94('0x86')]=function(_0x3fce78,_0x4924eb,_0x3cbabc){return db[_0x7b94('0x32')][_0x7b94('0x4e')]({'where':{'id':_0x3fce78[_0x7b94('0x55')]['id']}})['then'](handleEntityNotFound(_0x4924eb,null))[_0x7b94('0x2a')](function(_0x97d3ae){if(_0x97d3ae){return _0x97d3ae['addAgents'](_0x3fce78[_0x7b94('0x4f')][_0x7b94('0x65')],_[_0x7b94('0x64')](_0x3fce78[_0x7b94('0x4f')],[_0x7b94('0x65'),'id'])||{})[_0x7b94('0x87')](function(_0x32e2be){for(var _0xbafcf8=0x0;_0xbafcf8<_0x3fce78['body']['ids'][_0x7b94('0x3c')];_0xbafcf8+=0x1){socket[_0x7b94('0x88')]('userCmList:save',{'UserId':Number(_0x3fce78[_0x7b94('0x4f')]['ids'][_0xbafcf8]),'CmListId':Number(_0x3fce78[_0x7b94('0x55')]['id'])});}return _0x32e2be;});}})[_0x7b94('0x2a')](respondWithResult(_0x4924eb,null))['catch'](handleError(_0x4924eb,null));};exports[_0x7b94('0x89')]=function(_0x59c15b,_0x3f2214,_0x21981f){return db[_0x7b94('0x32')][_0x7b94('0x4e')]({'where':{'id':_0x59c15b[_0x7b94('0x55')]['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x3f2214,null))[_0x7b94('0x2a')](function(_0x5dc8dd){if(_0x5dc8dd){return _0x5dc8dd[_0x7b94('0x89')](_0x59c15b[_0x7b94('0x36')][_0x7b94('0x65')])[_0x7b94('0x2a')](function(){if(_[_0x7b94('0x61')](_0x59c15b[_0x7b94('0x36')][_0x7b94('0x65')])){for(var _0x3e5c65=0x0;_0x3e5c65<_0x59c15b[_0x7b94('0x36')][_0x7b94('0x65')][_0x7b94('0x3c')];_0x3e5c65+=0x1){socket['emit'](_0x7b94('0x8a'),{'UserId':Number(_0x59c15b[_0x7b94('0x36')][_0x7b94('0x65')][_0x3e5c65]),'CmListId':Number(_0x59c15b[_0x7b94('0x55')]['id'])});}}else{socket[_0x7b94('0x88')](_0x7b94('0x8a'),{'UserId':Number(_0x59c15b['query'][_0x7b94('0x65')]),'CmListId':Number(_0x59c15b[_0x7b94('0x55')]['id'])});}});}})[_0x7b94('0x2a')](respondWithStatusCode(_0x3f2214,null))[_0x7b94('0x4c')](handleError(_0x3f2214,null));};exports[_0x7b94('0x8b')]=function(_0xf88017,_0x4afbe8,_0x29f114){var _0x5b97c6={};var _0x5d1870={};var _0x205e21;var _0x38a5a0;return db[_0x7b94('0x32')][_0x7b94('0x5c')]({'where':{'id':_0xf88017[_0x7b94('0x55')]['id']}})[_0x7b94('0x2a')](handleEntityNotFound(_0x4afbe8,null))['then'](function(_0x5da05a){if(_0x5da05a){_0x205e21=_0x5da05a;_0x5d1870[_0x7b94('0x39')]=_[_0x7b94('0x37')](db[_0x7b94('0x8c')][_0x7b94('0x33')]);_0x5d1870[_0x7b94('0x36')]=_[_0x7b94('0x37')](_0xf88017[_0x7b94('0x36')]);_0x5d1870[_0x7b94('0x42')]=_[_0x7b94('0x38')](_0x5d1870['model'],_0x5d1870[_0x7b94('0x36')]);_0x5b97c6['attributes']=_[_0x7b94('0x38')](_0x5d1870[_0x7b94('0x39')],qs[_0x7b94('0x3b')](_0xf88017[_0x7b94('0x36')][_0x7b94('0x3b')]));_0x5b97c6[_0x7b94('0x3a')]=_0x5b97c6[_0x7b94('0x3a')][_0x7b94('0x3c')]?_0x5b97c6['attributes']:_0x5d1870[_0x7b94('0x39')];_0x5b97c6[_0x7b94('0x3f')]=qs[_0x7b94('0x40')](_0xf88017['query']['sort']);_0x5b97c6[_0x7b94('0x41')]=qs[_0x7b94('0x42')](_[_0x7b94('0x43')](_0xf88017[_0x7b94('0x36')],_0x5d1870[_0x7b94('0x42')]));if(_0xf88017['query'][_0x7b94('0x46')]){_0x5b97c6[_0x7b94('0x41')]=_['merge'](_0x5b97c6[_0x7b94('0x41')],{'$or':_[_0x7b94('0x31')](_0x5b97c6[_0x7b94('0x3a')],function(_0x26b66c){var _0x1923ae={};_0x1923ae[_0x26b66c]={'$like':'%'+_0xf88017['query'][_0x7b94('0x46')]+'%'};return _0x1923ae;})});}_0x5b97c6=_['merge']({},_0x5b97c6,_0xf88017[_0x7b94('0x47')]);return _0x205e21[_0x7b94('0x8b')](_0x5b97c6);}})[_0x7b94('0x2a')](function(_0x560d46){if(_0x560d46){_0x38a5a0=_0x560d46[_0x7b94('0x3c')];if(!_0xf88017[_0x7b94('0x36')][_0x7b94('0x3d')](_0x7b94('0x3e'))){_0x5b97c6[_0x7b94('0x20')]=qs[_0x7b94('0x20')](_0xf88017[_0x7b94('0x36')][_0x7b94('0x20')]);_0x5b97c6[_0x7b94('0x22')]=qs['offset'](_0xf88017[_0x7b94('0x36')][_0x7b94('0x22')]);}return _0x205e21[_0x7b94('0x8b')](_0x5b97c6);}})[_0x7b94('0x2a')](function(_0x162ffa){if(_0x162ffa){return _0x162ffa?{'count':_0x38a5a0,'rows':_0x162ffa}:null;}})[_0x7b94('0x2a')](respondWithResult(_0x4afbe8,null))[_0x7b94('0x4c')](handleError(_0x4afbe8,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 19bffa6..f5df2c3 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe14b,0x93));var _0xbe14=function(_0x494207,_0xa9e87e){_0x494207=_0x494207-0x0;var _0x3ed6c7=_0xe14b[_0x494207];return _0x3ed6c7;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +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(_0x5f1568,_0x344122){_0x5f1568=_0x5f1568-0x0;var _0x1c2042=_0x3e74[_0x5f1568];return _0x1c2042;};'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 e6983c9..d7b89f7 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 _0x750a=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','moment','bluebird','request-promise'];(function(_0x54e698,_0x4c6d5c){var _0x1eb4a6=function(_0x210a7d){while(--_0x210a7d){_0x54e698['push'](_0x54e698['shift']());}};_0x1eb4a6(++_0x4c6d5c);}(_0x750a,0x140));var _0xa750=function(_0x3aa0f4,_0x49fa72){_0x3aa0f4=_0x3aa0f4-0x0;var _0x3ce03e=_0x750a[_0x3aa0f4];return _0x3ce03e;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6324=['define','cm_lists','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x1c4c80,_0x3d7e67){var _0x33f0f5=function(_0x5d8fe4){while(--_0x5d8fe4){_0x1c4c80['push'](_0x1c4c80['shift']());}};_0x33f0f5(++_0x3d7e67);}(_0x6324,0x142));var _0x4632=function(_0x470a01,_0x1ef188){_0x470a01=_0x470a01-0x0;var _0x5df181=_0x6324[_0x470a01];return _0x5df181;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./cmList.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('CmList',attributes,{'tableName':_0x4632('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 13d24be..1e9696e 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 _0xf459=['http','redis','defaults','localhost','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\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','jayson/promise','client'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xf459,0xd3));var _0x9f45=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xf459[_0x2300c7];return _0x23f720;};'use strict';var _=require(_0x9f45('0x0'));var util=require(_0x9f45('0x1'));var moment=require(_0x9f45('0x2'));var BPromise=require(_0x9f45('0x3'));var rs=require(_0x9f45('0x4'));var fs=require('fs');var Redis=require(_0x9f45('0x5'));var db=require(_0x9f45('0x6'))['db'];var utils=require(_0x9f45('0x7'));var logger=require(_0x9f45('0x8'))(_0x9f45('0x9'));var config=require(_0x9f45('0xa'));var jayson=require(_0x9f45('0xb'));var client=jayson[_0x9f45('0xc')][_0x9f45('0xd')]({'port':0x232a});config[_0x9f45('0xe')]=_[_0x9f45('0xf')](config[_0x9f45('0xe')],{'host':_0x9f45('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f45('0xe')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x287402,_0x4a681b,_0xc16e7a){return new BPromise(function(_0x1c5413,_0x537169){return client['request'](_0x287402,_0xc16e7a)[_0x9f45('0x11')](function(_0x5b819b){logger[_0x9f45('0x12')](_0x9f45('0x13'),_0x4a681b,_0x9f45('0x14'));logger[_0x9f45('0x15')](_0x9f45('0x16'),_0x4a681b,_0x9f45('0x14'),JSON['stringify'](_0x5b819b));if(_0x5b819b[_0x9f45('0x17')]){if(_0x5b819b['error'][_0x9f45('0x18')]===0x1f4){logger[_0x9f45('0x17')](_0x9f45('0x13'),_0x4a681b,_0x5b819b[_0x9f45('0x17')][_0x9f45('0x19')]);return _0x537169(_0x5b819b[_0x9f45('0x17')]['message']);}logger[_0x9f45('0x17')](_0x9f45('0x13'),_0x4a681b,_0x5b819b[_0x9f45('0x17')][_0x9f45('0x19')]);return _0x1c5413(_0x5b819b[_0x9f45('0x17')][_0x9f45('0x19')]);}else{logger['info'](_0x9f45('0x13'),_0x4a681b,_0x9f45('0x14'));_0x1c5413(_0x5b819b[_0x9f45('0x1a')][_0x9f45('0x19')]);}})[_0x9f45('0x1b')](function(_0x44def6){logger[_0x9f45('0x17')]('CmList,\x20%s,\x20%s',_0x4a681b,_0x44def6);_0x537169(_0x44def6);});});} \ No newline at end of file +var _0x4b18=['error','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','redis','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0xa68a50,_0xbb743e){var _0x3cc130=function(_0x4a3818){while(--_0x4a3818){_0xa68a50['push'](_0xa68a50['shift']());}};_0x3cc130(++_0xbb743e);}(_0x4b18,0x162));var _0x84b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b18[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x84b1('0x0'));var BPromise=require(_0x84b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84b1('0x2'));var db=require(_0x84b1('0x3'))['db'];var utils=require(_0x84b1('0x4'));var logger=require(_0x84b1('0x5'))(_0x84b1('0x6'));var config=require(_0x84b1('0x7'));var jayson=require(_0x84b1('0x8'));var client=jayson[_0x84b1('0x9')]['http']({'port':0x232a});config['redis']=_[_0x84b1('0xa')](config['redis'],{'host':_0x84b1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84b1('0xc')]));require(_0x84b1('0xd'))[_0x84b1('0xe')](socket);function respondWithRpcPromise(_0x35a0e1,_0x5a94cc,_0x4822fe){return new BPromise(function(_0x11f85b,_0x45a66d){return client[_0x84b1('0xf')](_0x35a0e1,_0x4822fe)[_0x84b1('0x10')](function(_0x2292e2){logger[_0x84b1('0x11')](_0x84b1('0x12'),_0x5a94cc,_0x84b1('0x13'));logger[_0x84b1('0x14')](_0x84b1('0x15'),_0x5a94cc,_0x84b1('0x13'),JSON[_0x84b1('0x16')](_0x2292e2));if(_0x2292e2['error']){if(_0x2292e2['error'][_0x84b1('0x17')]===0x1f4){logger[_0x84b1('0x18')](_0x84b1('0x12'),_0x5a94cc,_0x2292e2[_0x84b1('0x18')][_0x84b1('0x19')]);return _0x45a66d(_0x2292e2['error'][_0x84b1('0x19')]);}logger['error'](_0x84b1('0x12'),_0x5a94cc,_0x2292e2[_0x84b1('0x18')][_0x84b1('0x19')]);return _0x11f85b(_0x2292e2[_0x84b1('0x18')]['message']);}else{logger[_0x84b1('0x11')]('CmList,\x20%s,\x20%s',_0x5a94cc,'request\x20sent');_0x11f85b(_0x2292e2[_0x84b1('0x1a')][_0x84b1('0x19')]);}})['catch'](function(_0x4ac212){logger[_0x84b1('0x18')]('CmList,\x20%s,\x20%s',_0x5a94cc,_0x4ac212);_0x45a66d(_0x4ac212);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c85fc59..d530aaf 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 _0x80bc=['emit','register','length','cmList:','./cmList.events','save','remove','update'];(function(_0x393500,_0x1037af){var _0x120d3b=function(_0x17234e){while(--_0x17234e){_0x393500['push'](_0x393500['shift']());}};_0x120d3b(++_0x1037af);}(_0x80bc,0x18c));var _0xc80b=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x80bc[_0xa4f636];return _0x37e02a;};'use strict';var CmListEvents=require(_0xc80b('0x0'));var events=[_0xc80b('0x1'),_0xc80b('0x2'),_0xc80b('0x3')];function createListener(_0x1178c8,_0x2385e0){return function(_0x10f7ab){_0x2385e0[_0xc80b('0x4')](_0x1178c8,_0x10f7ab);};}function removeListener(_0x3fd8cb,_0x6602dd){return function(){CmListEvents['removeListener'](_0x3fd8cb,_0x6602dd);};}exports[_0xc80b('0x5')]=function(_0x11beb8){for(var _0x5252d0=0x0,_0xfa0f37=events[_0xc80b('0x6')];_0x5252d0<_0xfa0f37;_0x5252d0++){var _0x2ad157=events[_0x5252d0];var _0x49dd03=createListener(_0xc80b('0x7')+_0x2ad157,_0x11beb8);CmListEvents['on'](_0x2ad157,_0x49dd03);}}; \ No newline at end of file +var _0x2327=['./cmList.events','save','remove','update','emit','length','cmList:'];(function(_0x459f23,_0x3298f7){var _0x3d5b16=function(_0x412778){while(--_0x412778){_0x459f23['push'](_0x459f23['shift']());}};_0x3d5b16(++_0x3298f7);}(_0x2327,0x12d));var _0x7232=function(_0x29ba06,_0x33f931){_0x29ba06=_0x29ba06-0x0;var _0x496d18=_0x2327[_0x29ba06];return _0x496d18;};'use strict';var CmListEvents=require(_0x7232('0x0'));var events=[_0x7232('0x1'),_0x7232('0x2'),_0x7232('0x3')];function createListener(_0x9fe583,_0x366903){return function(_0x3863d8){_0x366903[_0x7232('0x4')](_0x9fe583,_0x3863d8);};}function removeListener(_0x7f95d1,_0x38c88d){return function(){CmListEvents['removeListener'](_0x7f95d1,_0x38c88d);};}exports['register']=function(_0x4329ec){for(var _0x491878=0x0,_0x1fa230=events[_0x7232('0x5')];_0x491878<_0x1fa230;_0x491878++){var _0x55b690=events[_0x491878];var _0xc642bc=createListener(_0x7232('0x6')+_0x55b690,_0x4329ec);CmListEvents['on'](_0x55b690,_0xc642bc);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9697d96..8a209f6 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 _0xcfb7=['../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','/:id/contacts','addContacts','addCustomField','put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5213b3,_0x36ed06){var _0x3ae17d=function(_0x44e14c){while(--_0x44e14c){_0x5213b3['push'](_0x5213b3['shift']());}};_0x3ae17d(++_0x36ed06);}(_0xcfb7,0xd4));var _0x7cfb=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xcfb7[_0xfcbcb8];return _0x1b1f97;};'use strict';var multer=require(_0x7cfb('0x0'));var util=require('util');var path=require(_0x7cfb('0x1'));var timeout=require(_0x7cfb('0x2'));var express=require('express');var router=express[_0x7cfb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7cfb('0x4'));var interaction=require(_0x7cfb('0x5'));var config=require(_0x7cfb('0x6'));var controller=require(_0x7cfb('0x7'));router[_0x7cfb('0x8')]('/',auth[_0x7cfb('0x9')](),controller[_0x7cfb('0xa')]);router[_0x7cfb('0x8')](_0x7cfb('0xb'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0xc')]);router[_0x7cfb('0x8')](_0x7cfb('0xd'),auth['isAuthenticated'](),controller[_0x7cfb('0xe')]);router[_0x7cfb('0x8')](_0x7cfb('0xf'),auth[_0x7cfb('0x9')](),controller['getDispositions']);router[_0x7cfb('0x8')]('/:id/contacts',auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x10')]);router[_0x7cfb('0x8')]('/:id/contacts/csv',auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x11')]);router[_0x7cfb('0x8')](_0x7cfb('0x12'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x13')]);router['get'](_0x7cfb('0x14'),auth[_0x7cfb('0x9')](),controller['getAgents']);router[_0x7cfb('0x15')]('/',auth[_0x7cfb('0x9')](),controller['create']);router[_0x7cfb('0x15')]('/:id/dispositions',auth[_0x7cfb('0x9')](),controller['addDisposition']);router[_0x7cfb('0x15')](_0x7cfb('0x16'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x17')]);router[_0x7cfb('0x15')](_0x7cfb('0x12'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x18')]);router[_0x7cfb('0x15')]('/:id/users',auth[_0x7cfb('0x9')](),controller['addAgents']);router[_0x7cfb('0x19')]('/:id',auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x1a')]);router[_0x7cfb('0x1b')](_0x7cfb('0xd'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x1c')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x7cfb('0x14'),auth['isAuthenticated'](),controller[_0x7cfb('0x1d')]);module[_0x7cfb('0x1e')]=router; \ No newline at end of file +var _0xae50=['/:id','update','delete','removeDispositions','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addAgents','put'];(function(_0x439b2c,_0x1136c7){var _0x1b1e84=function(_0x3636f7){while(--_0x3636f7){_0x439b2c['push'](_0x439b2c['shift']());}};_0x1b1e84(++_0x1136c7);}(_0xae50,0x65));var _0x0ae5=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0xae50[_0xdd827a];return _0x2f46f1;};'use strict';var multer=require(_0x0ae5('0x0'));var util=require('util');var path=require(_0x0ae5('0x1'));var timeout=require(_0x0ae5('0x2'));var express=require(_0x0ae5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0ae5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0ae5('0x5'));var controller=require(_0x0ae5('0x6'));router['get']('/',auth[_0x0ae5('0x7')](),controller[_0x0ae5('0x8')]);router[_0x0ae5('0x9')](_0x0ae5('0xa'),auth[_0x0ae5('0x7')](),controller['describe']);router[_0x0ae5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x0ae5('0xb'),auth[_0x0ae5('0x7')](),controller[_0x0ae5('0xc')]);router['get'](_0x0ae5('0xd'),auth[_0x0ae5('0x7')](),controller[_0x0ae5('0xe')]);router['get'](_0x0ae5('0xf'),auth['isAuthenticated'](),controller[_0x0ae5('0x10')]);router[_0x0ae5('0x9')](_0x0ae5('0x11'),auth['isAuthenticated'](),controller[_0x0ae5('0x12')]);router[_0x0ae5('0x9')](_0x0ae5('0x13'),auth[_0x0ae5('0x7')](),controller[_0x0ae5('0x14')]);router[_0x0ae5('0x15')]('/',auth[_0x0ae5('0x7')](),controller[_0x0ae5('0x16')]);router['post'](_0x0ae5('0xb'),auth[_0x0ae5('0x7')](),controller[_0x0ae5('0x17')]);router[_0x0ae5('0x15')]('/:id/contacts',auth[_0x0ae5('0x7')](),controller[_0x0ae5('0x18')]);router[_0x0ae5('0x15')]('/:id/fields',auth[_0x0ae5('0x7')](),controller['addCustomField']);router[_0x0ae5('0x15')](_0x0ae5('0x13'),auth['isAuthenticated'](),controller[_0x0ae5('0x19')]);router[_0x0ae5('0x1a')](_0x0ae5('0x1b'),auth[_0x0ae5('0x7')](),controller[_0x0ae5('0x1c')]);router[_0x0ae5('0x1d')]('/:id',auth[_0x0ae5('0x7')](),controller['destroy']);router[_0x0ae5('0x1d')](_0x0ae5('0xb'),auth[_0x0ae5('0x7')](),controller[_0x0ae5('0x1e')]);router[_0x0ae5('0x1d')](_0x0ae5('0x13'),auth[_0x0ae5('0x7')](),controller[_0x0ae5('0x1f')]);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 d445a5e..3099e36 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 _0x3102=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0x3102,0x1a8));var _0x2310=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x3102[_0x5cc8b9];return _0x58892e;};'use strict';var Sequelize=require(_0x2310('0x0'));module[_0x2310('0x1')]={'name':{'type':Sequelize[_0x2310('0x2')],'get':function(_0x1d7f8a){return this['getDataValue'](_0x2310('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x2310('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x2310('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xd414=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0xdb9089,_0x11ec02){var _0x316f82=function(_0xc493ab){while(--_0xc493ab){_0xdb9089['push'](_0xdb9089['shift']());}};_0x316f82(++_0x11ec02);}(_0xd414,0x1b6));var _0x4d41=function(_0x12a633,_0x233a48){_0x12a633=_0x12a633-0x0;var _0x51867c=_0xd414[_0x12a633];return _0x51867c;};'use strict';var Sequelize=require(_0x4d41('0x0'));module[_0x4d41('0x1')]={'name':{'type':Sequelize[_0x4d41('0x2')],'get':function(_0xef5016){return this[_0x4d41('0x3')]('field');}},'field':{'type':Sequelize[_0x4d41('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 6738181..99843c1 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(_0x4625db,_0x12f635){var _0x26803c=function(_0x1d9b3f){while(--_0x1d9b3f){_0x4625db['push'](_0x4625db['shift']());}};_0x26803c(++_0x12f635);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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(_0x3bc407,_0x52938c){var _0x3e2b6f=function(_0x35ae2e){while(--_0x35ae2e){_0x3bc407['push'](_0x3bc407['shift']());}};_0x3e2b6f(++_0x52938c);}(_0x7a54,0x106));var _0x47a5=function(_0x43ee27,_0x2f02db){_0x43ee27=_0x43ee27-0x0;var _0x329a08=_0x7a54[_0x43ee27];return _0x329a08;};'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 c6ce4cf..e50425d 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 _0x82c3=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','api','bluebird','request-promise','path'];(function(_0x4bb7b2,_0x509bbb){var _0x80d2ca=function(_0x596297){while(--_0x596297){_0x4bb7b2['push'](_0x4bb7b2['shift']());}};_0x80d2ca(++_0x509bbb);}(_0x82c3,0x132));var _0x382c=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x82c3[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x382c('0x0'));var util=require(_0x382c('0x1'));var logger=require('../../config/logger')(_0x382c('0x2'));var moment=require('moment');var BPromise=require(_0x382c('0x3'));var rp=require(_0x382c('0x4'));var fs=require('fs');var path=require(_0x382c('0x5'));var rimraf=require(_0x382c('0x6'));var config=require(_0x382c('0x7'));var attributes=require(_0x382c('0x8'));module[_0x382c('0x9')]=function(_0x34f566,_0x90b8c0){return _0x34f566[_0x382c('0xa')](_0x382c('0xb'),attributes,{'tableName':_0x382c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a86=['exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x39b2d9,_0x1229c0){var _0x29940e=function(_0x1ce221){while(--_0x1ce221){_0x39b2d9['push'](_0x39b2d9['shift']());}};_0x29940e(++_0x1229c0);}(_0x0a86,0x1b4));var _0x60a8=function(_0x550151,_0x49d953){_0x550151=_0x550151-0x0;var _0x1ba3cb=_0x0a86[_0x550151];return _0x1ba3cb;};'use strict';var _=require(_0x60a8('0x0'));var util=require(_0x60a8('0x1'));var logger=require(_0x60a8('0x2'))(_0x60a8('0x3'));var moment=require(_0x60a8('0x4'));var BPromise=require(_0x60a8('0x5'));var rp=require(_0x60a8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x60a8('0x7'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0x60a8('0x8')]=function(_0x351d72,_0x596bf){return _0x351d72[_0x60a8('0x9')](_0x60a8('0xa'),attributes,{'tableName':_0x60a8('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 633576e..1c60f5f 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 _0x7034=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','message','lodash','bluebird','ioredis','../../config/utils'];(function(_0x1a3de9,_0x25aff8){var _0x56e0fc=function(_0x5380c5){while(--_0x5380c5){_0x1a3de9['push'](_0x1a3de9['shift']());}};_0x56e0fc(++_0x25aff8);}(_0x7034,0x164));var _0x4703=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x7034[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x4703('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4703('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4703('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4703('0x3'));var logger=require(_0x4703('0x4'))(_0x4703('0x5'));var config=require(_0x4703('0x6'));var jayson=require(_0x4703('0x7'));var client=jayson['client'][_0x4703('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d5e91,_0x44b49b,_0x44639a){return new BPromise(function(_0x31cd4d,_0x3b2a44){return client[_0x4703('0x9')](_0x3d5e91,_0x44639a)[_0x4703('0xa')](function(_0x2864ba){logger[_0x4703('0xb')](_0x4703('0xc'),_0x44b49b,_0x4703('0xd'));logger[_0x4703('0xe')](_0x4703('0xf'),_0x44b49b,_0x4703('0xd'),JSON['stringify'](_0x2864ba));if(_0x2864ba[_0x4703('0x10')]){if(_0x2864ba[_0x4703('0x10')]['code']===0x1f4){logger['error'](_0x4703('0xc'),_0x44b49b,_0x2864ba[_0x4703('0x10')][_0x4703('0x11')]);return _0x3b2a44(_0x2864ba[_0x4703('0x10')]['message']);}logger[_0x4703('0x10')](_0x4703('0xc'),_0x44b49b,_0x2864ba[_0x4703('0x10')][_0x4703('0x11')]);return _0x31cd4d(_0x2864ba['error'][_0x4703('0x11')]);}else{logger[_0x4703('0xb')](_0x4703('0xc'),_0x44b49b,_0x4703('0xd'));_0x31cd4d(_0x2864ba['result'][_0x4703('0x11')]);}})['catch'](function(_0x4983d1){logger[_0x4703('0x10')](_0x4703('0xc'),_0x44b49b,_0x4983d1);_0x3b2a44(_0x4983d1);});});} \ No newline at end of file +var _0xf4a1=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf4a1,0xc2));var _0x1f4a=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xf4a1[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x1f4a('0x0'));var util=require(_0x1f4a('0x1'));var moment=require(_0x1f4a('0x2'));var BPromise=require(_0x1f4a('0x3'));var rs=require(_0x1f4a('0x4'));var fs=require('fs');var Redis=require(_0x1f4a('0x5'));var db=require(_0x1f4a('0x6'))['db'];var utils=require(_0x1f4a('0x7'));var logger=require(_0x1f4a('0x8'))(_0x1f4a('0x9'));var config=require(_0x1f4a('0xa'));var jayson=require(_0x1f4a('0xb'));var client=jayson[_0x1f4a('0xc')][_0x1f4a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x20c13e,_0x2bd2be,_0x19e53f){return new BPromise(function(_0x988642,_0x141955){return client[_0x1f4a('0xe')](_0x20c13e,_0x19e53f)[_0x1f4a('0xf')](function(_0x58300a){logger['info'](_0x1f4a('0x10'),_0x2bd2be,'request\x20sent');logger[_0x1f4a('0x11')](_0x1f4a('0x12'),_0x2bd2be,_0x1f4a('0x13'),JSON[_0x1f4a('0x14')](_0x58300a));if(_0x58300a[_0x1f4a('0x15')]){if(_0x58300a['error'][_0x1f4a('0x16')]===0x1f4){logger['error'](_0x1f4a('0x10'),_0x2bd2be,_0x58300a[_0x1f4a('0x15')][_0x1f4a('0x17')]);return _0x141955(_0x58300a[_0x1f4a('0x15')][_0x1f4a('0x17')]);}logger['error'](_0x1f4a('0x10'),_0x2bd2be,_0x58300a[_0x1f4a('0x15')][_0x1f4a('0x17')]);return _0x988642(_0x58300a[_0x1f4a('0x15')][_0x1f4a('0x17')]);}else{logger[_0x1f4a('0x18')](_0x1f4a('0x10'),_0x2bd2be,_0x1f4a('0x13'));_0x988642(_0x58300a[_0x1f4a('0x19')][_0x1f4a('0x17')]);}})[_0x1f4a('0x1a')](function(_0xce8acf){logger[_0x1f4a('0x15')]('Condition,\x20%s,\x20%s',_0x2bd2be,_0xce8acf);_0x141955(_0xce8acf);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 47b8fd0..88e75ab 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 _0x93ba=['put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x307d88,_0x3f8bba){var _0x38d74b=function(_0x4ea955){while(--_0x4ea955){_0x307d88['push'](_0x307d88['shift']());}};_0x38d74b(++_0x3f8bba);}(_0x93ba,0x117));var _0xa93b=function(_0x2eb794,_0x27550f){_0x2eb794=_0x2eb794-0x0;var _0x64e283=_0x93ba[_0x2eb794];return _0x64e283;};'use strict';var multer=require(_0xa93b('0x0'));var util=require(_0xa93b('0x1'));var path=require(_0xa93b('0x2'));var timeout=require(_0xa93b('0x3'));var express=require('express');var router=express[_0xa93b('0x4')]();var fs_extra=require(_0xa93b('0x5'));var auth=require(_0xa93b('0x6'));var interaction=require(_0xa93b('0x7'));var config=require(_0xa93b('0x8'));var controller=require('./condition.controller');router[_0xa93b('0x9')]('/:id',auth[_0xa93b('0xa')](),controller[_0xa93b('0xb')]);router[_0xa93b('0xc')](_0xa93b('0xd'),auth['isAuthenticated'](),controller[_0xa93b('0xe')]);module[_0xa93b('0xf')]=router; \ No newline at end of file +var _0xc140=['update','delete','isAuthenticated','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc140,0x1e4));var _0x0c14=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0xc140[_0x1e4a8e];return _0x5408f9;};'use strict';var multer=require(_0x0c14('0x0'));var util=require('util');var path=require(_0x0c14('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c14('0x2'));var router=express[_0x0c14('0x3')]();var fs_extra=require(_0x0c14('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0c14('0x5'));var config=require(_0x0c14('0x6'));var controller=require(_0x0c14('0x7'));router[_0x0c14('0x8')](_0x0c14('0x9'),auth['isAuthenticated'](),controller[_0x0c14('0xa')]);router[_0x0c14('0xb')]('/:id',auth[_0x0c14('0xc')](),controller['destroy']);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 c03bc0f..035d635 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 _0x2032=['name','exports','STRING'];(function(_0xa306bb,_0x262db8){var _0x483f9c=function(_0x3a7fc9){while(--_0x3a7fc9){_0xa306bb['push'](_0xa306bb['shift']());}};_0x483f9c(++_0x262db8);}(_0x2032,0xd9));var _0x2203=function(_0x273da5,_0x33d909){_0x273da5=_0x273da5-0x0;var _0xe841d4=_0x2032[_0x273da5];return _0xe841d4;};'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 +var _0xe706=['STRING','sequelize','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xe706,0xa3));var _0x6e70=function(_0x2c6fd3,_0x4ad940){_0x2c6fd3=_0x2c6fd3-0x0;var _0x57d735=_0xe706[_0x2c6fd3];return _0x57d735;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index a2c7017..5d028e9 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 _0x3490=['map','Dashboard','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','catch','show','params','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','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','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','CustomDashboards','end','stack','name','index'];(function(_0x380213,_0x4ce407){var _0x5c640d=function(_0x2f71ad){while(--_0x2f71ad){_0x380213['push'](_0x380213['shift']());}};_0x5c640d(++_0x4ce407);}(_0x3490,0xd1));var _0x0349=function(_0x144b19,_0x459235){_0x144b19=_0x144b19-0x0;var _0x35b0dd=_0x3490[_0x144b19];return _0x35b0dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0349('0x0'));var zipdir=require(_0x0349('0x1'));var jsonpatch=require(_0x0349('0x2'));var rp=require('request-promise');var moment=require(_0x0349('0x3'));var BPromise=require(_0x0349('0x4'));var Mustache=require(_0x0349('0x5'));var util=require(_0x0349('0x6'));var path=require('path');var sox=require(_0x0349('0x7'));var csv=require(_0x0349('0x8'));var ejs=require(_0x0349('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0349('0xa'));var squel=require(_0x0349('0xb'));var crypto=require(_0x0349('0xc'));var jsforce=require(_0x0349('0xd'));var deskjs=require(_0x0349('0xe'));var toCsv=require(_0x0349('0x8'));var querystring=require(_0x0349('0xf'));var Papa=require(_0x0349('0x10'));var Redis=require(_0x0349('0x11'));var authService=require(_0x0349('0x12'));var qs=require(_0x0349('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0349('0x14'));var logger=require(_0x0349('0x15'))('api');var utils=require(_0x0349('0x16'));var config=require(_0x0349('0x17'));var licenseUtil=require(_0x0349('0x18'));var db=require(_0x0349('0x19'))['db'];config[_0x0349('0x1a')]=_[_0x0349('0x1b')](config[_0x0349('0x1a')],{'host':_0x0349('0x1c'),'port':0x18eb});var socket=require(_0x0349('0x1d'))(new Redis(config[_0x0349('0x1a')]));require(_0x0349('0x1e'))[_0x0349('0x1f')](socket);function respondWithStatusCode(_0x222154,_0x5e8e92){_0x5e8e92=_0x5e8e92||0xcc;return function(_0x389102){if(_0x389102){return _0x222154[_0x0349('0x20')](_0x5e8e92);}return _0x222154[_0x0349('0x21')](_0x5e8e92)['end']();};}function respondWithResult(_0x2ae420,_0x59b856){_0x59b856=_0x59b856||0xc8;return function(_0x5e2160){if(_0x5e2160){return _0x2ae420[_0x0349('0x21')](_0x59b856)['json'](_0x5e2160);}};}function respondWithFilteredResult(_0xec8e5a,_0x4d6c45){return function(_0x92e41d){if(_0x92e41d){var _0x2c96aa=typeof _0x4d6c45['offset']==='undefined'&&typeof _0x4d6c45[_0x0349('0x22')]==='undefined';var _0x8500f=_0x92e41d[_0x0349('0x23')];var _0x5d08d9=_0x2c96aa?0x0:_0x4d6c45[_0x0349('0x24')];var _0x963475=_0x2c96aa?_0x92e41d[_0x0349('0x23')]:_0x4d6c45[_0x0349('0x24')]+_0x4d6c45[_0x0349('0x22')];var _0x28bb81;if(_0x963475>=_0x8500f){_0x963475=_0x8500f;_0x28bb81=0xc8;}else{_0x28bb81=0xce;}_0xec8e5a[_0x0349('0x21')](_0x28bb81);return _0xec8e5a[_0x0349('0x25')](_0x0349('0x26'),_0x5d08d9+'-'+_0x963475+'/'+_0x8500f)[_0x0349('0x27')](_0x92e41d);}return null;};}function patchUpdates(_0x18105d){return function(_0x1b511f){try{jsonpatch['apply'](_0x1b511f,_0x18105d,!![]);}catch(_0x382629){return BPromise[_0x0349('0x28')](_0x382629);}return _0x1b511f[_0x0349('0x29')]();};}function saveUpdates(_0x4b3290,_0x55fb97){return function(_0x948f6a){if(_0x948f6a){return _0x948f6a[_0x0349('0x2a')](_0x4b3290)[_0x0349('0x2b')](function(_0x429544){return _0x429544;});}return null;};}function removeEntity(_0x9eae4b,_0x4c4ebc){return function(_0x11e9cd){if(_0x11e9cd){return _0x11e9cd[_0x0349('0x2c')]()['then'](function(){var _0x201e5d=_0x11e9cd[_0x0349('0x2d')]({'plain':!![]});var _0x388a7d=_0x0349('0x2e');return db['UserProfileResource'][_0x0349('0x2c')]({'where':{'type':_0x388a7d,'resourceId':_0x201e5d['id']}})[_0x0349('0x2b')](function(){return _0x11e9cd;});})['then'](function(){_0x9eae4b[_0x0349('0x21')](0xcc)[_0x0349('0x2f')]();});}};}function handleEntityNotFound(_0x4a3ed7,_0x50728b){return function(_0x2feb05){if(!_0x2feb05){_0x4a3ed7[_0x0349('0x20')](0x194);}return _0x2feb05;};}function handleError(_0xc2b731,_0x18b29b){_0x18b29b=_0x18b29b||0x1f4;return function(_0x1f333b){logger['error'](_0x1f333b[_0x0349('0x30')]);if(_0x1f333b[_0x0349('0x31')]){delete _0x1f333b[_0x0349('0x31')];}_0xc2b731[_0x0349('0x21')](_0x18b29b)['send'](_0x1f333b);};}exports[_0x0349('0x32')]=function(_0x2ce75f,_0x3843ed){var _0x2ddc47={},_0x3223a6={},_0x23f1c4={'count':0x0,'rows':[]};var _0x110ffa=_[_0x0349('0x33')](db[_0x0349('0x34')][_0x0349('0x35')],function(_0x2ab877){return{'name':_0x2ab877[_0x0349('0x36')],'type':_0x2ab877[_0x0349('0x37')][_0x0349('0x38')]};});_0x3223a6['model']=_[_0x0349('0x33')](_0x110ffa,_0x0349('0x31'));_0x3223a6['query']=_[_0x0349('0x39')](_0x2ce75f[_0x0349('0x3a')]);_0x3223a6[_0x0349('0x3b')]=_[_0x0349('0x3c')](_0x3223a6[_0x0349('0x3d')],_0x3223a6['query']);_0x2ddc47[_0x0349('0x3e')]=_[_0x0349('0x3c')](_0x3223a6[_0x0349('0x3d')],qs[_0x0349('0x3f')](_0x2ce75f[_0x0349('0x3a')]['fields']));_0x2ddc47[_0x0349('0x3e')]=_0x2ddc47[_0x0349('0x3e')]['length']?_0x2ddc47[_0x0349('0x3e')]:_0x3223a6[_0x0349('0x3d')];if(!_0x2ce75f[_0x0349('0x3a')][_0x0349('0x40')](_0x0349('0x41'))){_0x2ddc47['limit']=qs[_0x0349('0x22')](_0x2ce75f[_0x0349('0x3a')][_0x0349('0x22')]);_0x2ddc47[_0x0349('0x24')]=qs[_0x0349('0x24')](_0x2ce75f['query'][_0x0349('0x24')]);}_0x2ddc47[_0x0349('0x42')]=qs['sort'](_0x2ce75f['query'][_0x0349('0x43')]);_0x2ddc47[_0x0349('0x44')]=qs[_0x0349('0x3b')](_['pick'](_0x2ce75f[_0x0349('0x3a')],_0x3223a6[_0x0349('0x3b')]),_0x110ffa);if(_0x2ce75f[_0x0349('0x3a')][_0x0349('0x45')]){_0x2ddc47[_0x0349('0x44')]=_[_0x0349('0x46')](_0x2ddc47['where'],{'$or':_[_0x0349('0x33')](_0x110ffa,function(_0x4f36f1){if(_0x4f36f1['type']!=='VIRTUAL'){var _0x4402ca={};_0x4402ca[_0x4f36f1[_0x0349('0x31')]]={'$like':'%'+_0x2ce75f[_0x0349('0x3a')][_0x0349('0x45')]+'%'};return _0x4402ca;}})});}_0x2ddc47=_[_0x0349('0x46')]({},_0x2ddc47,_0x2ce75f['options']);var _0x2b050d={'where':_0x2ddc47['where']};return db[_0x0349('0x34')][_0x0349('0x23')](_0x2b050d)['then'](function(_0x172703){_0x23f1c4[_0x0349('0x23')]=_0x172703;if(_0x2ce75f[_0x0349('0x3a')]['includeAll']){_0x2ddc47[_0x0349('0x47')]=[{'all':!![]}];}return db[_0x0349('0x34')][_0x0349('0x48')](_0x2ddc47);})[_0x0349('0x2b')](function(_0x110d80){_0x23f1c4['rows']=_0x110d80;return _0x23f1c4;})['then'](respondWithFilteredResult(_0x3843ed,_0x2ddc47))[_0x0349('0x49')](handleError(_0x3843ed,null));};exports[_0x0349('0x4a')]=function(_0x1cc8eb,_0x24fd6d){var _0x5b7a52={'raw':![],'where':{'id':_0x1cc8eb[_0x0349('0x4b')]['id']}},_0x2978f5={};_0x2978f5[_0x0349('0x3d')]=_['keys'](db['Dashboard'][_0x0349('0x35')]);_0x2978f5['query']=_[_0x0349('0x39')](_0x1cc8eb['query']);_0x2978f5[_0x0349('0x3b')]=_[_0x0349('0x3c')](_0x2978f5[_0x0349('0x3d')],_0x2978f5[_0x0349('0x3a')]);_0x5b7a52[_0x0349('0x3e')]=_[_0x0349('0x3c')](_0x2978f5['model'],qs[_0x0349('0x3f')](_0x1cc8eb[_0x0349('0x3a')][_0x0349('0x3f')]));_0x5b7a52['attributes']=_0x5b7a52[_0x0349('0x3e')][_0x0349('0x4c')]?_0x5b7a52[_0x0349('0x3e')]:_0x2978f5[_0x0349('0x3d')];if(_0x1cc8eb[_0x0349('0x3a')][_0x0349('0x4d')]){_0x5b7a52[_0x0349('0x47')]=[{'all':!![]}];}_0x5b7a52=_[_0x0349('0x46')]({},_0x5b7a52,_0x1cc8eb[_0x0349('0x4e')]);return db['Dashboard'][_0x0349('0x4f')](_0x5b7a52)[_0x0349('0x2b')](handleEntityNotFound(_0x24fd6d,null))[_0x0349('0x2b')](respondWithResult(_0x24fd6d,null))[_0x0349('0x49')](handleError(_0x24fd6d,null));};exports[_0x0349('0x50')]=function(_0x5a1ab2,_0x4b850d){return db[_0x0349('0x34')][_0x0349('0x50')](_0x5a1ab2[_0x0349('0x51')],{})[_0x0349('0x2b')](function(_0x49e0d1){var _0x283a40=_0x5a1ab2[_0x0349('0x52')][_0x0349('0x2d')]({'plain':!![]});if(!_0x283a40)throw new Error(_0x0349('0x53'));if(_0x283a40[_0x0349('0x54')]===_0x0349('0x52')){var _0x2290bb=_0x49e0d1[_0x0349('0x2d')]({'plain':!![]});var _0x483dac=_0x0349('0x2e');return db[_0x0349('0x55')][_0x0349('0x4f')]({'where':{'name':_0x483dac,'userProfileId':_0x283a40[_0x0349('0x56')]},'raw':!![]})[_0x0349('0x2b')](function(_0x59c965){if(_0x59c965&&_0x59c965[_0x0349('0x57')]===0x0){return db['UserProfileResource'][_0x0349('0x50')]({'name':_0x2290bb[_0x0349('0x31')],'resourceId':_0x2290bb['id'],'type':_0x59c965[_0x0349('0x31')],'sectionId':_0x59c965['id']},{})[_0x0349('0x2b')](function(){return _0x49e0d1;});}else{return _0x49e0d1;}})[_0x0349('0x49')](function(_0x2da907){logger[_0x0349('0x58')](_0x0349('0x59'),_0x2da907);throw _0x2da907;});}return _0x49e0d1;})[_0x0349('0x2b')](respondWithResult(_0x4b850d,0xc9))['catch'](handleError(_0x4b850d,null));};exports[_0x0349('0x5a')]=function(_0x3536e,_0x220fd2){var _0x42a137={'where':{'id':_0x3536e[_0x0349('0x4b')]['id']}},_0x122ce7={};_0x122ce7[_0x0349('0x3d')]=_[_0x0349('0x39')](db['Dashboard'][_0x0349('0x35')]);_0x42a137['attributes']=_[_0x0349('0x3c')](_0x122ce7[_0x0349('0x3d')],qs[_0x0349('0x3f')](_0x3536e[_0x0349('0x3a')][_0x0349('0x3f')]));_0x42a137[_0x0349('0x3e')]=_0x42a137[_0x0349('0x3e')][_0x0349('0x4c')]?_0x42a137[_0x0349('0x3e')]:_0x122ce7['model'];if(_0x3536e[_0x0349('0x3a')][_0x0349('0x4d')]){_0x42a137[_0x0349('0x47')]=[{'all':!![]}];}_0x42a137=_['merge']({},_0x42a137,_0x3536e[_0x0349('0x4e')]);return db[_0x0349('0x34')]['find'](_0x42a137)['then'](handleEntityNotFound(_0x220fd2,null))[_0x0349('0x2b')](function(_0x56c424){if(_0x56c424){var _0x51fe1b=_0x56c424[_0x0349('0x2d')]({'plain':!![]});_0x51fe1b=qs[_0x0349('0x5b')](_0x51fe1b,['id','createdAt',_0x0349('0x5c')]);_0x3536e[_0x0349('0x51')]=_[_0x0349('0x5b')](_0x3536e[_0x0349('0x51')],['id',_0x0349('0x5d'),'updatedAt']);return db[_0x0349('0x34')]['create'](_['merge'](_0x51fe1b,_0x3536e[_0x0349('0x51')]),{'include':_0x3536e[_0x0349('0x3a')][_0x0349('0x4d')]?[{'all':!![]}]:undefined})[_0x0349('0x2b')](function(_0x4f0050){var _0x2e403e=_0x3536e[_0x0349('0x52')][_0x0349('0x2d')]({'plain':!![]});if(!_0x2e403e)throw new Error(_0x0349('0x53'));if(_0x2e403e[_0x0349('0x54')]===_0x0349('0x52')){var _0x2ee72b=_0x4f0050[_0x0349('0x2d')]({'plain':!![]});var _0x1c16d3='CustomDashboards';return db[_0x0349('0x55')][_0x0349('0x4f')]({'where':{'name':_0x1c16d3,'userProfileId':_0x2e403e[_0x0349('0x56')]},'raw':!![]})[_0x0349('0x2b')](function(_0x5b5944){if(_0x5b5944&&_0x5b5944[_0x0349('0x57')]===0x0){return db['UserProfileResource'][_0x0349('0x50')]({'name':_0x2ee72b[_0x0349('0x31')],'resourceId':_0x2ee72b['id'],'type':_0x5b5944[_0x0349('0x31')],'sectionId':_0x5b5944['id']},{})[_0x0349('0x2b')](function(){return _0x4f0050;});}else{return _0x4f0050;}})[_0x0349('0x49')](function(_0x106299){logger[_0x0349('0x58')](_0x0349('0x59'),_0x106299);throw _0x106299;});}return _0x4f0050;});}})['then'](respondWithResult(_0x220fd2,0xc9))[_0x0349('0x49')](handleError(_0x220fd2,null));};exports['update']=function(_0x33b131,_0x4f2e75){if(_0x33b131[_0x0349('0x51')]['id']){delete _0x33b131['body']['id'];}return db['Dashboard'][_0x0349('0x4f')]({'where':{'id':_0x33b131[_0x0349('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f2e75,null))[_0x0349('0x2b')](saveUpdates(_0x33b131[_0x0349('0x51')],null))['then'](respondWithResult(_0x4f2e75,null))[_0x0349('0x49')](handleError(_0x4f2e75,null));};exports[_0x0349('0x2c')]=function(_0x165453,_0x15572a){return db['Dashboard'][_0x0349('0x4f')]({'where':{'id':_0x165453['params']['id']}})['then'](handleEntityNotFound(_0x15572a,null))[_0x0349('0x2b')](removeEntity(_0x15572a,null))[_0x0349('0x49')](handleError(_0x15572a,null));};function widgetAttributes(_0x5ef109){try{switch(_0x5ef109[_0x0349('0x37')]){case _0x0349('0x5e'):return[{'name':_0x0349('0x5f'),'value':_0x5ef109[_0x0349('0x5f')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109['attrs'][0x0][_0x0349('0x61')]:undefined)||_0x0349('0x62')}];case _0x0349('0x63'):return[{'name':_0x0349('0x64'),'value':_0x5ef109[_0x0349('0x64')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109[_0x0349('0x60')][0x0][_0x0349('0x61')]:undefined)||''}];case _0x0349('0x65'):return[{'name':_0x0349('0x66'),'value':_0x5ef109[_0x0349('0x66')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x0]?_0x5ef109[_0x0349('0x60')][0x0][_0x0349('0x61')]:undefined)||_0x0349('0x67')},{'name':_0x0349('0x68'),'value':_0x5ef109[_0x0349('0x68')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x1]?_0x5ef109[_0x0349('0x60')][0x1][_0x0349('0x61')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5ef109[_0x0349('0x69')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x2]?_0x5ef109[_0x0349('0x60')][0x2]['value']:undefined)||0xc}];case _0x0349('0x6a'):return[{'name':_0x0349('0x6b'),'value':_0x5ef109[_0x0349('0x6b')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x0]?_0x5ef109['attrs'][0x0][_0x0349('0x61')]:undefined)||_0x0349('0x6c')},{'name':_0x0349('0x6d'),'value':_0x5ef109[_0x0349('0x6d')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x1]?_0x5ef109[_0x0349('0x60')][0x1]['value']:undefined)||[]},{'name':_0x0349('0x69'),'value':_0x5ef109['attrFontSize']||(_0x5ef109['attrs']&&_0x5ef109['attrs'][0x2]?_0x5ef109[_0x0349('0x60')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x5ef109[_0x0349('0x6e')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x3]?_0x5ef109[_0x0349('0x60')][0x3][_0x0349('0x61')]:undefined)||_0x0349('0x6f')},{'name':_0x0349('0x70'),'value':_0x5ef109[_0x0349('0x70')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x4]?_0x5ef109[_0x0349('0x60')][0x4][_0x0349('0x61')]:undefined)||''},{'name':_0x0349('0x71'),'value':_0x5ef109[_0x0349('0x71')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x5]?_0x5ef109[_0x0349('0x60')][0x5]['value']:undefined)||''},{'name':_0x0349('0x72'),'value':_0x5ef109[_0x0349('0x72')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x6]?_0x5ef109[_0x0349('0x60')][0x6]['value']:undefined)||''},{'name':_0x0349('0x73'),'value':_0x5ef109[_0x0349('0x73')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x7]?_0x5ef109[_0x0349('0x60')][0x7]['value']:undefined)||''},{'name':_0x0349('0x74'),'value':_0x5ef109['attrWhatsappAccounts']||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x8]?_0x5ef109[_0x0349('0x60')][0x8][_0x0349('0x61')]:undefined)||''},{'name':_0x0349('0x75'),'value':_0x5ef109[_0x0349('0x75')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x9]?_0x5ef109['attrs'][0x9]['value']:undefined)||''}];case _0x0349('0x76'):case'pie-chart':return[{'name':_0x0349('0x77'),'value':_0x5ef109[_0x0349('0x77')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109['attrs'][0x0][_0x0349('0x61')]:undefined)||'total'},{'name':_0x0349('0x78'),'value':_0x5ef109[_0x0349('0x78')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x1]?_0x5ef109['attrs'][0x1]['value']:undefined)||null},{'name':_0x0349('0x79'),'value':_0x5ef109[_0x0349('0x79')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x2]?_0x5ef109['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5ef109[_0x0349('0x6d')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x3]?_0x5ef109['attrs'][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x5ef109[_0x0349('0x6e')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x4]?_0x5ef109['attrs'][0x4][_0x0349('0x61')]:undefined)||'voice'},{'name':_0x0349('0x70'),'value':_0x5ef109[_0x0349('0x70')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x5]?_0x5ef109['attrs'][0x5][_0x0349('0x61')]:undefined)||''},{'name':_0x0349('0x71'),'value':_0x5ef109[_0x0349('0x71')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x6]?_0x5ef109[_0x0349('0x60')][0x6][_0x0349('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5ef109[_0x0349('0x72')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x7]?_0x5ef109[_0x0349('0x60')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5ef109[_0x0349('0x73')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x8]?_0x5ef109[_0x0349('0x60')][0x8]['value']:undefined)||''},{'name':_0x0349('0x74'),'value':_0x5ef109[_0x0349('0x74')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x9]?_0x5ef109[_0x0349('0x60')][0x9][_0x0349('0x61')]:undefined)||''},{'name':_0x0349('0x75'),'value':_0x5ef109[_0x0349('0x75')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0xa]?_0x5ef109[_0x0349('0x60')][0xa][_0x0349('0x61')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x5ef109['reportType']||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109[_0x0349('0x60')][0x0][_0x0349('0x37')]:undefined)||null,'value':_0x5ef109[_0x0349('0x7a')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109['attrs'][0x0][_0x0349('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x5ef109[_0x0349('0x7b')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x1]?_0x5ef109[_0x0349('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x363a11){logger['error'](_0x0349('0x7c'),JSON[_0x0349('0x7d')](_0x363a11));return[];}}exports[_0x0349('0x7e')]=function(_0x4ae153,_0x1087d3,_0x524851){if(_0x4ae153[_0x0349('0x51')]['id']){delete _0x4ae153[_0x0349('0x51')]['id'];}return db['Dashboard'][_0x0349('0x4f')]({'where':{'id':_0x4ae153[_0x0349('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1087d3,null))['then'](function(_0x1376c6){if(_0x1376c6){_0x4ae153['body']['DashboardId']=_0x1376c6['id'];_0x4ae153[_0x0349('0x51')][_0x0349('0x60')]=widgetAttributes(_0x4ae153['body']);return db[_0x0349('0x7f')]['create'](_0x4ae153['body']);}})[_0x0349('0x2b')](respondWithResult(_0x1087d3,null))[_0x0349('0x49')](handleError(_0x1087d3,null));};exports['getItems']=function(_0x5d27ac,_0xc9cb3b,_0x184109){var _0x270701={};var _0x59a801={};var _0x1809d8;var _0x31b5c1;return db['Dashboard'][_0x0349('0x80')]({'where':{'id':_0x5d27ac[_0x0349('0x4b')]['id']}})[_0x0349('0x2b')](handleEntityNotFound(_0xc9cb3b,null))['then'](function(_0x53c693){if(_0x53c693){_0x1809d8=_0x53c693;_0x59a801[_0x0349('0x3d')]=_[_0x0349('0x39')](db[_0x0349('0x7f')][_0x0349('0x35')]);_0x59a801[_0x0349('0x3a')]=_[_0x0349('0x39')](_0x5d27ac[_0x0349('0x3a')]);_0x59a801[_0x0349('0x3b')]=_[_0x0349('0x3c')](_0x59a801[_0x0349('0x3d')],_0x59a801[_0x0349('0x3a')]);_0x270701['attributes']=_[_0x0349('0x3c')](_0x59a801[_0x0349('0x3d')],qs[_0x0349('0x3f')](_0x5d27ac[_0x0349('0x3a')][_0x0349('0x3f')]));_0x270701['attributes']=_0x270701['attributes'][_0x0349('0x4c')]?_0x270701['attributes']:_0x59a801['model'];_0x270701[_0x0349('0x42')]=qs['sort'](_0x5d27ac['query'][_0x0349('0x43')]);_0x270701[_0x0349('0x44')]=qs[_0x0349('0x3b')](_['pick'](_0x5d27ac['query'],_0x59a801[_0x0349('0x3b')]));if(_0x5d27ac[_0x0349('0x3a')][_0x0349('0x45')]){_0x270701[_0x0349('0x44')]=_['merge'](_0x270701[_0x0349('0x44')],{'$or':_[_0x0349('0x33')](_0x270701[_0x0349('0x3e')],function(_0x3bf102){var _0x3e5589={};_0x3e5589[_0x3bf102]={'$like':'%'+_0x5d27ac[_0x0349('0x3a')][_0x0349('0x45')]+'%'};return _0x3e5589;})});}_0x270701=_[_0x0349('0x46')]({},_0x270701,_0x5d27ac['options']);return _0x1809d8[_0x0349('0x81')](_0x270701);}})[_0x0349('0x2b')](function(_0x2f186e){if(_0x2f186e){_0x31b5c1=_0x2f186e[_0x0349('0x4c')];if(!_0x5d27ac['query']['hasOwnProperty']('nolimit')){_0x270701[_0x0349('0x22')]=qs[_0x0349('0x22')](_0x5d27ac[_0x0349('0x3a')][_0x0349('0x22')]);_0x270701['offset']=qs[_0x0349('0x24')](_0x5d27ac[_0x0349('0x3a')][_0x0349('0x24')]);}return _0x1809d8['getItems'](_0x270701);}})[_0x0349('0x2b')](function(_0x47b4d2){if(_0x47b4d2){return _0x47b4d2?{'count':_0x31b5c1,'rows':_0x47b4d2}:null;}})[_0x0349('0x2b')](respondWithResult(_0xc9cb3b,null))[_0x0349('0x49')](handleError(_0xc9cb3b,null));}; \ No newline at end of file +var _0x2cf2=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','get','CustomDashboards','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','Dashboard','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','request-promise'];(function(_0x5e17e7,_0x551ed9){var _0x19a417=function(_0x10c981){while(--_0x10c981){_0x5e17e7['push'](_0x5e17e7['shift']());}};_0x19a417(++_0x551ed9);}(_0x2cf2,0x102));var _0x22cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2cf2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x22cf('0x0'));var rimraf=require(_0x22cf('0x1'));var zipdir=require(_0x22cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22cf('0x3'));var moment=require(_0x22cf('0x4'));var BPromise=require(_0x22cf('0x5'));var Mustache=require(_0x22cf('0x6'));var util=require(_0x22cf('0x7'));var path=require(_0x22cf('0x8'));var sox=require(_0x22cf('0x9'));var csv=require(_0x22cf('0xa'));var ejs=require(_0x22cf('0xb'));var fs=require('fs');var fs_extra=require(_0x22cf('0xc'));var _=require(_0x22cf('0xd'));var squel=require('squel');var crypto=require(_0x22cf('0xe'));var jsforce=require(_0x22cf('0xf'));var deskjs=require(_0x22cf('0x10'));var toCsv=require('to-csv');var querystring=require(_0x22cf('0x11'));var Papa=require(_0x22cf('0x12'));var Redis=require('ioredis');var authService=require(_0x22cf('0x13'));var qs=require(_0x22cf('0x14'));var as=require(_0x22cf('0x15'));var hardwareService=require(_0x22cf('0x16'));var logger=require(_0x22cf('0x17'))('api');var utils=require(_0x22cf('0x18'));var config=require(_0x22cf('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x22cf('0x1a'))['db'];config[_0x22cf('0x1b')]=_[_0x22cf('0x1c')](config['redis'],{'host':_0x22cf('0x1d'),'port':0x18eb});var socket=require(_0x22cf('0x1e'))(new Redis(config[_0x22cf('0x1b')]));require('./dashboard.socket')[_0x22cf('0x1f')](socket);function respondWithStatusCode(_0x228146,_0x8cc58d){_0x8cc58d=_0x8cc58d||0xcc;return function(_0x12c29a){if(_0x12c29a){return _0x228146['sendStatus'](_0x8cc58d);}return _0x228146['status'](_0x8cc58d)[_0x22cf('0x20')]();};}function respondWithResult(_0x531159,_0x4d0aae){_0x4d0aae=_0x4d0aae||0xc8;return function(_0x53dc03){if(_0x53dc03){return _0x531159[_0x22cf('0x21')](_0x4d0aae)[_0x22cf('0x22')](_0x53dc03);}};}function respondWithFilteredResult(_0x57f6dd,_0x2707da){return function(_0x355275){if(_0x355275){var _0x314aad=typeof _0x2707da[_0x22cf('0x23')]===_0x22cf('0x24')&&typeof _0x2707da[_0x22cf('0x25')]===_0x22cf('0x24');var _0x2268eb=_0x355275[_0x22cf('0x26')];var _0x2fee6b=_0x314aad?0x0:_0x2707da['offset'];var _0x2bf1de=_0x314aad?_0x355275['count']:_0x2707da['offset']+_0x2707da['limit'];var _0x4857e7;if(_0x2bf1de>=_0x2268eb){_0x2bf1de=_0x2268eb;_0x4857e7=0xc8;}else{_0x4857e7=0xce;}_0x57f6dd[_0x22cf('0x21')](_0x4857e7);return _0x57f6dd['set'](_0x22cf('0x27'),_0x2fee6b+'-'+_0x2bf1de+'/'+_0x2268eb)['json'](_0x355275);}return null;};}function patchUpdates(_0x1d4fb3){return function(_0x596b8c){try{jsonpatch['apply'](_0x596b8c,_0x1d4fb3,!![]);}catch(_0x380bb5){return BPromise[_0x22cf('0x28')](_0x380bb5);}return _0x596b8c['save']();};}function saveUpdates(_0x1fcaca,_0x4dec09){return function(_0xea9d20){if(_0xea9d20){return _0xea9d20[_0x22cf('0x29')](_0x1fcaca)[_0x22cf('0x2a')](function(_0x4a9844){return _0x4a9844;});}return null;};}function removeEntity(_0x2787f7,_0x54392e){return function(_0x11790e){if(_0x11790e){return _0x11790e['destroy']()[_0x22cf('0x2a')](function(){var _0x314a51=_0x11790e[_0x22cf('0x2b')]({'plain':!![]});var _0x18750d=_0x22cf('0x2c');return db['UserProfileResource'][_0x22cf('0x2d')]({'where':{'type':_0x18750d,'resourceId':_0x314a51['id']}})[_0x22cf('0x2a')](function(){return _0x11790e;});})[_0x22cf('0x2a')](function(){_0x2787f7[_0x22cf('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1247,_0x490389){return function(_0x558d75){if(!_0x558d75){_0x2e1247[_0x22cf('0x2e')](0x194);}return _0x558d75;};}function handleError(_0x5734bb,_0x6caeca){_0x6caeca=_0x6caeca||0x1f4;return function(_0x2b4cce){logger[_0x22cf('0x2f')](_0x2b4cce[_0x22cf('0x30')]);if(_0x2b4cce[_0x22cf('0x31')]){delete _0x2b4cce['name'];}_0x5734bb['status'](_0x6caeca)[_0x22cf('0x32')](_0x2b4cce);};}exports[_0x22cf('0x33')]=function(_0x318ee6,_0x326655){var _0x3e7d9b={},_0x40498e={},_0x15265b={'count':0x0,'rows':[]};var _0x467e95=_['map'](db['Dashboard'][_0x22cf('0x34')],function(_0x4530e5){return{'name':_0x4530e5['fieldName'],'type':_0x4530e5[_0x22cf('0x35')][_0x22cf('0x36')]};});_0x40498e[_0x22cf('0x37')]=_[_0x22cf('0x38')](_0x467e95,_0x22cf('0x31'));_0x40498e[_0x22cf('0x39')]=_[_0x22cf('0x3a')](_0x318ee6[_0x22cf('0x39')]);_0x40498e[_0x22cf('0x3b')]=_[_0x22cf('0x3c')](_0x40498e[_0x22cf('0x37')],_0x40498e['query']);_0x3e7d9b[_0x22cf('0x3d')]=_[_0x22cf('0x3c')](_0x40498e[_0x22cf('0x37')],qs[_0x22cf('0x3e')](_0x318ee6[_0x22cf('0x39')][_0x22cf('0x3e')]));_0x3e7d9b[_0x22cf('0x3d')]=_0x3e7d9b[_0x22cf('0x3d')][_0x22cf('0x3f')]?_0x3e7d9b[_0x22cf('0x3d')]:_0x40498e['model'];if(!_0x318ee6[_0x22cf('0x39')][_0x22cf('0x40')]('nolimit')){_0x3e7d9b[_0x22cf('0x25')]=qs['limit'](_0x318ee6['query'][_0x22cf('0x25')]);_0x3e7d9b[_0x22cf('0x23')]=qs[_0x22cf('0x23')](_0x318ee6[_0x22cf('0x39')][_0x22cf('0x23')]);}_0x3e7d9b[_0x22cf('0x41')]=qs[_0x22cf('0x42')](_0x318ee6[_0x22cf('0x39')][_0x22cf('0x42')]);_0x3e7d9b[_0x22cf('0x43')]=qs[_0x22cf('0x3b')](_[_0x22cf('0x44')](_0x318ee6[_0x22cf('0x39')],_0x40498e[_0x22cf('0x3b')]),_0x467e95);if(_0x318ee6[_0x22cf('0x39')]['filter']){_0x3e7d9b[_0x22cf('0x43')]=_[_0x22cf('0x45')](_0x3e7d9b['where'],{'$or':_['map'](_0x467e95,function(_0x5cf9a2){if(_0x5cf9a2[_0x22cf('0x35')]!==_0x22cf('0x46')){var _0x17eeb0={};_0x17eeb0[_0x5cf9a2[_0x22cf('0x31')]]={'$like':'%'+_0x318ee6[_0x22cf('0x39')][_0x22cf('0x47')]+'%'};return _0x17eeb0;}})});}_0x3e7d9b=_[_0x22cf('0x45')]({},_0x3e7d9b,_0x318ee6[_0x22cf('0x48')]);var _0x27a672={'where':_0x3e7d9b['where']};return db['Dashboard']['count'](_0x27a672)[_0x22cf('0x2a')](function(_0x3ce04d){_0x15265b[_0x22cf('0x26')]=_0x3ce04d;if(_0x318ee6[_0x22cf('0x39')][_0x22cf('0x49')]){_0x3e7d9b[_0x22cf('0x4a')]=[{'all':!![]}];}return db[_0x22cf('0x4b')][_0x22cf('0x4c')](_0x3e7d9b);})[_0x22cf('0x2a')](function(_0xa7e36f){_0x15265b[_0x22cf('0x4d')]=_0xa7e36f;return _0x15265b;})[_0x22cf('0x2a')](respondWithFilteredResult(_0x326655,_0x3e7d9b))[_0x22cf('0x4e')](handleError(_0x326655,null));};exports[_0x22cf('0x4f')]=function(_0x9997c8,_0x2c60f0){var _0x49964f={'raw':![],'where':{'id':_0x9997c8[_0x22cf('0x50')]['id']}},_0x5516c7={};_0x5516c7['model']=_[_0x22cf('0x3a')](db[_0x22cf('0x4b')]['rawAttributes']);_0x5516c7['query']=_[_0x22cf('0x3a')](_0x9997c8[_0x22cf('0x39')]);_0x5516c7[_0x22cf('0x3b')]=_[_0x22cf('0x3c')](_0x5516c7[_0x22cf('0x37')],_0x5516c7[_0x22cf('0x39')]);_0x49964f[_0x22cf('0x3d')]=_[_0x22cf('0x3c')](_0x5516c7['model'],qs[_0x22cf('0x3e')](_0x9997c8['query'][_0x22cf('0x3e')]));_0x49964f[_0x22cf('0x3d')]=_0x49964f['attributes'][_0x22cf('0x3f')]?_0x49964f[_0x22cf('0x3d')]:_0x5516c7['model'];if(_0x9997c8[_0x22cf('0x39')][_0x22cf('0x49')]){_0x49964f[_0x22cf('0x4a')]=[{'all':!![]}];}_0x49964f=_[_0x22cf('0x45')]({},_0x49964f,_0x9997c8[_0x22cf('0x48')]);return db['Dashboard'][_0x22cf('0x51')](_0x49964f)[_0x22cf('0x2a')](handleEntityNotFound(_0x2c60f0,null))[_0x22cf('0x2a')](respondWithResult(_0x2c60f0,null))['catch'](handleError(_0x2c60f0,null));};exports[_0x22cf('0x52')]=function(_0x325a5e,_0x273df9){return db[_0x22cf('0x4b')][_0x22cf('0x52')](_0x325a5e[_0x22cf('0x53')],{})[_0x22cf('0x2a')](function(_0x2487c1){var _0x4f4374=_0x325a5e[_0x22cf('0x54')][_0x22cf('0x2b')]({'plain':!![]});if(!_0x4f4374)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f4374[_0x22cf('0x55')]===_0x22cf('0x54')){var _0x39efce=_0x2487c1[_0x22cf('0x2b')]({'plain':!![]});var _0x29b3b6=_0x22cf('0x2c');return db[_0x22cf('0x56')][_0x22cf('0x51')]({'where':{'name':_0x29b3b6,'userProfileId':_0x4f4374[_0x22cf('0x57')]},'raw':!![]})['then'](function(_0x4e510){if(_0x4e510&&_0x4e510[_0x22cf('0x58')]===0x0){return db[_0x22cf('0x59')]['create']({'name':_0x39efce['name'],'resourceId':_0x39efce['id'],'type':_0x4e510[_0x22cf('0x31')],'sectionId':_0x4e510['id']},{})[_0x22cf('0x2a')](function(){return _0x2487c1;});}else{return _0x2487c1;}})[_0x22cf('0x4e')](function(_0x510f50){logger[_0x22cf('0x2f')](_0x22cf('0x5a'),_0x510f50);throw _0x510f50;});}return _0x2487c1;})[_0x22cf('0x2a')](respondWithResult(_0x273df9,0xc9))[_0x22cf('0x4e')](handleError(_0x273df9,null));};exports[_0x22cf('0x5b')]=function(_0x64da9d,_0x55df79){var _0x5306de={'where':{'id':_0x64da9d[_0x22cf('0x50')]['id']}},_0x32599d={};_0x32599d['model']=_['keys'](db[_0x22cf('0x4b')][_0x22cf('0x34')]);_0x5306de['attributes']=_[_0x22cf('0x3c')](_0x32599d[_0x22cf('0x37')],qs[_0x22cf('0x3e')](_0x64da9d[_0x22cf('0x39')][_0x22cf('0x3e')]));_0x5306de['attributes']=_0x5306de['attributes'][_0x22cf('0x3f')]?_0x5306de['attributes']:_0x32599d['model'];if(_0x64da9d[_0x22cf('0x39')][_0x22cf('0x49')]){_0x5306de['include']=[{'all':!![]}];}_0x5306de=_['merge']({},_0x5306de,_0x64da9d['options']);return db[_0x22cf('0x4b')][_0x22cf('0x51')](_0x5306de)[_0x22cf('0x2a')](handleEntityNotFound(_0x55df79,null))[_0x22cf('0x2a')](function(_0xc8e42c){if(_0xc8e42c){var _0x58dc22=_0xc8e42c[_0x22cf('0x2b')]({'plain':!![]});_0x58dc22=qs[_0x22cf('0x5c')](_0x58dc22,['id',_0x22cf('0x5d'),'updatedAt']);_0x64da9d[_0x22cf('0x53')]=_[_0x22cf('0x5c')](_0x64da9d[_0x22cf('0x53')],['id',_0x22cf('0x5d'),_0x22cf('0x5e')]);return db[_0x22cf('0x4b')][_0x22cf('0x52')](_['merge'](_0x58dc22,_0x64da9d['body']),{'include':_0x64da9d[_0x22cf('0x39')][_0x22cf('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x36cbeb){var _0x9b6db3=_0x64da9d[_0x22cf('0x54')][_0x22cf('0x2b')]({'plain':!![]});if(!_0x9b6db3)throw new Error(_0x22cf('0x5f'));if(_0x9b6db3['role']===_0x22cf('0x54')){var _0x2788ff=_0x36cbeb[_0x22cf('0x2b')]({'plain':!![]});var _0x22ef22=_0x22cf('0x2c');return db['UserProfileSection'][_0x22cf('0x51')]({'where':{'name':_0x22ef22,'userProfileId':_0x9b6db3[_0x22cf('0x57')]},'raw':!![]})[_0x22cf('0x2a')](function(_0x5592f0){if(_0x5592f0&&_0x5592f0[_0x22cf('0x58')]===0x0){return db[_0x22cf('0x59')][_0x22cf('0x52')]({'name':_0x2788ff[_0x22cf('0x31')],'resourceId':_0x2788ff['id'],'type':_0x5592f0['name'],'sectionId':_0x5592f0['id']},{})[_0x22cf('0x2a')](function(){return _0x36cbeb;});}else{return _0x36cbeb;}})[_0x22cf('0x4e')](function(_0x248518){logger[_0x22cf('0x2f')](_0x22cf('0x5a'),_0x248518);throw _0x248518;});}return _0x36cbeb;});}})[_0x22cf('0x2a')](respondWithResult(_0x55df79,0xc9))['catch'](handleError(_0x55df79,null));};exports[_0x22cf('0x29')]=function(_0x2c9168,_0x33bfe2){if(_0x2c9168[_0x22cf('0x53')]['id']){delete _0x2c9168[_0x22cf('0x53')]['id'];}return db[_0x22cf('0x4b')][_0x22cf('0x51')]({'where':{'id':_0x2c9168[_0x22cf('0x50')]['id']}})[_0x22cf('0x2a')](handleEntityNotFound(_0x33bfe2,null))[_0x22cf('0x2a')](saveUpdates(_0x2c9168[_0x22cf('0x53')],null))[_0x22cf('0x2a')](respondWithResult(_0x33bfe2,null))[_0x22cf('0x4e')](handleError(_0x33bfe2,null));};exports[_0x22cf('0x2d')]=function(_0x149be4,_0x379995){return db[_0x22cf('0x4b')][_0x22cf('0x51')]({'where':{'id':_0x149be4[_0x22cf('0x50')]['id']}})[_0x22cf('0x2a')](handleEntityNotFound(_0x379995,null))[_0x22cf('0x2a')](removeEntity(_0x379995,null))['catch'](handleError(_0x379995,null));};function widgetAttributes(_0xe3f29b){try{switch(_0xe3f29b[_0x22cf('0x35')]){case'iframe':return[{'name':_0x22cf('0x60'),'value':_0xe3f29b['attrUrl']||(_0xe3f29b['attrs']&&_0xe3f29b[_0x22cf('0x61')][0x0]?_0xe3f29b['attrs'][0x0][_0x22cf('0x62')]:undefined)||_0x22cf('0x63')}];case _0x22cf('0x64'):return[{'name':_0x22cf('0x65'),'value':_0xe3f29b[_0x22cf('0x65')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x0]?_0xe3f29b[_0x22cf('0x61')][0x0][_0x22cf('0x62')]:undefined)||''}];case'clock':return[{'name':_0x22cf('0x66'),'value':_0xe3f29b[_0x22cf('0x66')]||(_0xe3f29b['attrs']&&_0xe3f29b['attrs'][0x0]?_0xe3f29b[_0x22cf('0x61')][0x0][_0x22cf('0x62')]:undefined)||_0x22cf('0x67')},{'name':'attrTimezone','value':_0xe3f29b[_0x22cf('0x68')]||(_0xe3f29b['attrs']&&_0xe3f29b[_0x22cf('0x61')][0x1]?_0xe3f29b[_0x22cf('0x61')][0x1][_0x22cf('0x62')]:undefined)||_0x22cf('0x69')},{'name':'attrFontSize','value':_0xe3f29b[_0x22cf('0x6a')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x2]?_0xe3f29b['attrs'][0x2][_0x22cf('0x62')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0xe3f29b['attrMetric']||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b['attrs'][0x0]?_0xe3f29b[_0x22cf('0x61')][0x0][_0x22cf('0x62')]:undefined)||'total'},{'name':_0x22cf('0x6b'),'value':_0xe3f29b[_0x22cf('0x6b')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x1]?_0xe3f29b[_0x22cf('0x61')][0x1][_0x22cf('0x62')]:undefined)||[]},{'name':_0x22cf('0x6a'),'value':_0xe3f29b[_0x22cf('0x6a')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b['attrs'][0x2]?_0xe3f29b[_0x22cf('0x61')][0x2][_0x22cf('0x62')]:undefined)||0x14},{'name':'attrChannel','value':_0xe3f29b[_0x22cf('0x6c')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x3]?_0xe3f29b[_0x22cf('0x61')][0x3][_0x22cf('0x62')]:undefined)||_0x22cf('0x6d')},{'name':_0x22cf('0x6e'),'value':_0xe3f29b[_0x22cf('0x6e')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x4]?_0xe3f29b[_0x22cf('0x61')][0x4][_0x22cf('0x62')]:undefined)||''},{'name':_0x22cf('0x6f'),'value':_0xe3f29b[_0x22cf('0x6f')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x5]?_0xe3f29b[_0x22cf('0x61')][0x5][_0x22cf('0x62')]:undefined)||''},{'name':_0x22cf('0x70'),'value':_0xe3f29b['attrSmsAccounts']||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b['attrs'][0x6]?_0xe3f29b[_0x22cf('0x61')][0x6][_0x22cf('0x62')]:undefined)||''},{'name':_0x22cf('0x71'),'value':_0xe3f29b[_0x22cf('0x71')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x7]?_0xe3f29b['attrs'][0x7]['value']:undefined)||''},{'name':_0x22cf('0x72'),'value':_0xe3f29b['attrWhatsappAccounts']||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x8]?_0xe3f29b[_0x22cf('0x61')][0x8][_0x22cf('0x62')]:undefined)||''},{'name':_0x22cf('0x73'),'value':_0xe3f29b['attrChatWebsites']||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b['attrs'][0x9]?_0xe3f29b[_0x22cf('0x61')][0x9]['value']:undefined)||''}];case _0x22cf('0x74'):case _0x22cf('0x75'):return[{'name':_0x22cf('0x76'),'value':_0xe3f29b['attrSerie1']||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b['attrs'][0x0]?_0xe3f29b[_0x22cf('0x61')][0x0][_0x22cf('0x62')]:undefined)||_0x22cf('0x77')},{'name':_0x22cf('0x78'),'value':_0xe3f29b[_0x22cf('0x78')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b['attrs'][0x1]?_0xe3f29b['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0xe3f29b['attrSerie3']||(_0xe3f29b['attrs']&&_0xe3f29b[_0x22cf('0x61')][0x2]?_0xe3f29b[_0x22cf('0x61')][0x2][_0x22cf('0x62')]:undefined)||null},{'name':_0x22cf('0x6b'),'value':_0xe3f29b[_0x22cf('0x6b')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x3]?_0xe3f29b['attrs'][0x3][_0x22cf('0x62')]:undefined)||[]},{'name':_0x22cf('0x6c'),'value':_0xe3f29b[_0x22cf('0x6c')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b['attrs'][0x4]?_0xe3f29b['attrs'][0x4][_0x22cf('0x62')]:undefined)||_0x22cf('0x6d')},{'name':_0x22cf('0x6e'),'value':_0xe3f29b['attrEmailAccounts']||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b['attrs'][0x5]?_0xe3f29b[_0x22cf('0x61')][0x5][_0x22cf('0x62')]:undefined)||''},{'name':_0x22cf('0x6f'),'value':_0xe3f29b['attrFaxAccounts']||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x6]?_0xe3f29b[_0x22cf('0x61')][0x6][_0x22cf('0x62')]:undefined)||''},{'name':_0x22cf('0x70'),'value':_0xe3f29b[_0x22cf('0x70')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x7]?_0xe3f29b[_0x22cf('0x61')][0x7][_0x22cf('0x62')]:undefined)||''},{'name':_0x22cf('0x71'),'value':_0xe3f29b[_0x22cf('0x71')]||(_0xe3f29b['attrs']&&_0xe3f29b[_0x22cf('0x61')][0x8]?_0xe3f29b['attrs'][0x8]['value']:undefined)||''},{'name':_0x22cf('0x72'),'value':_0xe3f29b[_0x22cf('0x72')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0x9]?_0xe3f29b['attrs'][0x9][_0x22cf('0x62')]:undefined)||''},{'name':_0x22cf('0x73'),'value':_0xe3f29b[_0x22cf('0x73')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b[_0x22cf('0x61')][0xa]?_0xe3f29b['attrs'][0xa][_0x22cf('0x62')]:undefined)||''}];case _0x22cf('0x79'):return[{'name':_0x22cf('0x7a'),'type':_0xe3f29b['reportType']||(_0xe3f29b['attrs']&&_0xe3f29b[_0x22cf('0x61')][0x0]?_0xe3f29b[_0x22cf('0x61')][0x0][_0x22cf('0x35')]:undefined)||null,'value':_0xe3f29b[_0x22cf('0x7a')]||(_0xe3f29b['attrs']&&_0xe3f29b[_0x22cf('0x61')][0x0]?_0xe3f29b[_0x22cf('0x61')][0x0][_0x22cf('0x62')]:undefined)||null},{'name':_0x22cf('0x7b'),'value':_0xe3f29b[_0x22cf('0x7b')]||(_0xe3f29b[_0x22cf('0x61')]&&_0xe3f29b['attrs'][0x1]?_0xe3f29b['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x980153){logger[_0x22cf('0x2f')](_0x22cf('0x7c'),JSON[_0x22cf('0x7d')](_0x980153));return[];}}exports[_0x22cf('0x7e')]=function(_0x5a4174,_0x3d4ae2,_0x74dca1){if(_0x5a4174[_0x22cf('0x53')]['id']){delete _0x5a4174[_0x22cf('0x53')]['id'];}return db[_0x22cf('0x4b')][_0x22cf('0x51')]({'where':{'id':_0x5a4174[_0x22cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d4ae2,null))[_0x22cf('0x2a')](function(_0x8fdf62){if(_0x8fdf62){_0x5a4174[_0x22cf('0x53')][_0x22cf('0x7f')]=_0x8fdf62['id'];_0x5a4174[_0x22cf('0x53')][_0x22cf('0x61')]=widgetAttributes(_0x5a4174[_0x22cf('0x53')]);return db[_0x22cf('0x80')][_0x22cf('0x52')](_0x5a4174[_0x22cf('0x53')]);}})[_0x22cf('0x2a')](respondWithResult(_0x3d4ae2,null))[_0x22cf('0x4e')](handleError(_0x3d4ae2,null));};exports[_0x22cf('0x81')]=function(_0x48e629,_0x3fcb39,_0x2cd54b){var _0x30a94d={};var _0xcf8394={};var _0x5b626d;var _0x1f04cb;return db[_0x22cf('0x4b')][_0x22cf('0x82')]({'where':{'id':_0x48e629[_0x22cf('0x50')]['id']}})[_0x22cf('0x2a')](handleEntityNotFound(_0x3fcb39,null))[_0x22cf('0x2a')](function(_0x434b30){if(_0x434b30){_0x5b626d=_0x434b30;_0xcf8394['model']=_[_0x22cf('0x3a')](db['DashboardItem']['rawAttributes']);_0xcf8394['query']=_[_0x22cf('0x3a')](_0x48e629[_0x22cf('0x39')]);_0xcf8394['filters']=_[_0x22cf('0x3c')](_0xcf8394[_0x22cf('0x37')],_0xcf8394[_0x22cf('0x39')]);_0x30a94d['attributes']=_[_0x22cf('0x3c')](_0xcf8394[_0x22cf('0x37')],qs[_0x22cf('0x3e')](_0x48e629[_0x22cf('0x39')][_0x22cf('0x3e')]));_0x30a94d[_0x22cf('0x3d')]=_0x30a94d[_0x22cf('0x3d')][_0x22cf('0x3f')]?_0x30a94d[_0x22cf('0x3d')]:_0xcf8394['model'];_0x30a94d[_0x22cf('0x41')]=qs[_0x22cf('0x42')](_0x48e629['query'][_0x22cf('0x42')]);_0x30a94d[_0x22cf('0x43')]=qs[_0x22cf('0x3b')](_[_0x22cf('0x44')](_0x48e629['query'],_0xcf8394[_0x22cf('0x3b')]));if(_0x48e629['query'][_0x22cf('0x47')]){_0x30a94d['where']=_[_0x22cf('0x45')](_0x30a94d[_0x22cf('0x43')],{'$or':_[_0x22cf('0x38')](_0x30a94d['attributes'],function(_0x3914e2){var _0x2e3b41={};_0x2e3b41[_0x3914e2]={'$like':'%'+_0x48e629[_0x22cf('0x39')][_0x22cf('0x47')]+'%'};return _0x2e3b41;})});}_0x30a94d=_[_0x22cf('0x45')]({},_0x30a94d,_0x48e629[_0x22cf('0x48')]);return _0x5b626d[_0x22cf('0x81')](_0x30a94d);}})[_0x22cf('0x2a')](function(_0x140b6c){if(_0x140b6c){_0x1f04cb=_0x140b6c[_0x22cf('0x3f')];if(!_0x48e629['query'][_0x22cf('0x40')]('nolimit')){_0x30a94d['limit']=qs[_0x22cf('0x25')](_0x48e629[_0x22cf('0x39')][_0x22cf('0x25')]);_0x30a94d['offset']=qs[_0x22cf('0x23')](_0x48e629[_0x22cf('0x39')][_0x22cf('0x23')]);}return _0x5b626d[_0x22cf('0x81')](_0x30a94d);}})['then'](function(_0x5c101e){if(_0x5c101e){return _0x5c101e?{'count':_0x1f04cb,'rows':_0x5c101e}:null;}})[_0x22cf('0x2a')](respondWithResult(_0x3fcb39,null))[_0x22cf('0x4e')](handleError(_0x3fcb39,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index f820be6..22c7529 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 _0xfe33=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x31980d,_0x3615f6){var _0x372a55=function(_0x282df7){while(--_0x282df7){_0x31980d['push'](_0x31980d['shift']());}};_0x372a55(++_0x3615f6);}(_0xfe33,0x13e));var _0x3fe3=function(_0x508986,_0x43d040){_0x508986=_0x508986-0x0;var _0x25d13a=_0xfe33[_0x508986];return _0x25d13a;};'use strict';var EventEmitter=require(_0x3fe3('0x0'));var Dashboard=require(_0x3fe3('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3fe3('0x2')](0x0);var events={'afterCreate':_0x3fe3('0x3'),'afterUpdate':_0x3fe3('0x4'),'afterDestroy':_0x3fe3('0x5')};function emitEvent(_0x2cef79){return function(_0x201cb7,_0xcceeeb,_0x239b97){DashboardEvents[_0x3fe3('0x6')](_0x2cef79+':'+_0x201cb7['id'],_0x201cb7);DashboardEvents['emit'](_0x2cef79,_0x201cb7);_0x239b97(null);};}for(var e in events){if(events[_0x3fe3('0x7')](e)){var event=events[e];Dashboard[_0x3fe3('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xcbb1=['remove','hasOwnProperty','hook','exports','../../mysqldb','save','update'];(function(_0x182893,_0x527205){var _0x3bf9e1=function(_0x591d7b){while(--_0x591d7b){_0x182893['push'](_0x182893['shift']());}};_0x3bf9e1(++_0x527205);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x516118,_0x26acb7){_0x516118=_0x516118-0x0;var _0x4922a8=_0xcbb1[_0x516118];return _0x4922a8;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x1cbb('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cbb('0x1'),'afterUpdate':_0x1cbb('0x2'),'afterDestroy':_0x1cbb('0x3')};function emitEvent(_0x12f581){return function(_0x5f4112,_0x751433,_0x308313){DashboardEvents['emit'](_0x12f581+':'+_0x5f4112['id'],_0x5f4112);DashboardEvents['emit'](_0x12f581,_0x5f4112);_0x308313(null);};}for(var e in events){if(events[_0x1cbb('0x4')](e)){var event=events[e];Dashboard[_0x1cbb('0x5')](e,emitEvent(event));}}module[_0x1cbb('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index fbb65be..eea6924 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 _0xcfa3=['./dashboard.attributes','exports','Dashboard','dashboards','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2d8d65,_0x4db2c0){var _0x434585=function(_0x4de1e2){while(--_0x4de1e2){_0x2d8d65['push'](_0x2d8d65['shift']());}};_0x434585(++_0x4db2c0);}(_0xcfa3,0x88));var _0x3cfa=function(_0x561db7,_0x4ba8ea){_0x561db7=_0x561db7-0x0;var _0x5b2845=_0xcfa3[_0x561db7];return _0x5b2845;};'use strict';var _=require('lodash');var util=require(_0x3cfa('0x0'));var logger=require('../../config/logger')(_0x3cfa('0x1'));var moment=require(_0x3cfa('0x2'));var BPromise=require('bluebird');var rp=require(_0x3cfa('0x3'));var fs=require('fs');var path=require(_0x3cfa('0x4'));var rimraf=require(_0x3cfa('0x5'));var config=require(_0x3cfa('0x6'));var attributes=require(_0x3cfa('0x7'));module[_0x3cfa('0x8')]=function(_0x3adb1e,_0x454773){return _0x3adb1e['define'](_0x3cfa('0x9'),attributes,{'tableName':_0x3cfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf5c=['bluebird','path','../../config/environment','exports','define','Dashboard','dashboards','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf5c,0x197));var _0xcaf5=function(_0x229e99,_0x5090fd){_0x229e99=_0x229e99-0x0;var _0x1d217e=_0xaf5c[_0x229e99];return _0x1d217e;};'use strict';var _=require('lodash');var util=require(_0xcaf5('0x0'));var logger=require(_0xcaf5('0x1'))(_0xcaf5('0x2'));var moment=require('moment');var BPromise=require(_0xcaf5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcaf5('0x4'));var rimraf=require('rimraf');var config=require(_0xcaf5('0x5'));var attributes=require('./dashboard.attributes');module[_0xcaf5('0x6')]=function(_0x46720c,_0x1d1f3e){return _0x46720c[_0xcaf5('0x7')](_0xcaf5('0x8'),attributes,{'tableName':_0xcaf5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index c436012..4dadae3 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 _0x889a=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xfb299e,_0x2ca984){var _0x564de9=function(_0x39e05f){while(--_0x39e05f){_0xfb299e['push'](_0xfb299e['shift']());}};_0x564de9(++_0x2ca984);}(_0x889a,0x109));var _0xa889=function(_0x161622,_0x5012f3){_0x161622=_0x161622-0x0;var _0x296b15=_0x889a[_0x161622];return _0x296b15;};'use strict';var _=require(_0xa889('0x0'));var util=require(_0xa889('0x1'));var moment=require(_0xa889('0x2'));var BPromise=require(_0xa889('0x3'));var rs=require(_0xa889('0x4'));var fs=require('fs');var Redis=require(_0xa889('0x5'));var db=require(_0xa889('0x6'))['db'];var utils=require(_0xa889('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa889('0x8'));var jayson=require(_0xa889('0x9'));var client=jayson[_0xa889('0xa')][_0xa889('0xb')]({'port':0x232a});config[_0xa889('0xc')]=_[_0xa889('0xd')](config[_0xa889('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa889('0xe'))(new Redis(config[_0xa889('0xc')]));require(_0xa889('0xf'))[_0xa889('0x10')](socket);function respondWithRpcPromise(_0x5c9455,_0x186b36,_0x277744){return new BPromise(function(_0x418d25,_0x4eb598){return client['request'](_0x5c9455,_0x277744)[_0xa889('0x11')](function(_0x260cf5){logger[_0xa889('0x12')]('Dashboard,\x20%s,\x20%s',_0x186b36,_0xa889('0x13'));logger[_0xa889('0x14')](_0xa889('0x15'),_0x186b36,_0xa889('0x13'),JSON['stringify'](_0x260cf5));if(_0x260cf5['error']){if(_0x260cf5[_0xa889('0x16')][_0xa889('0x17')]===0x1f4){logger[_0xa889('0x16')]('Dashboard,\x20%s,\x20%s',_0x186b36,_0x260cf5[_0xa889('0x16')]['message']);return _0x4eb598(_0x260cf5[_0xa889('0x16')][_0xa889('0x18')]);}logger[_0xa889('0x16')]('Dashboard,\x20%s,\x20%s',_0x186b36,_0x260cf5[_0xa889('0x16')][_0xa889('0x18')]);return _0x418d25(_0x260cf5[_0xa889('0x16')][_0xa889('0x18')]);}else{logger[_0xa889('0x12')](_0xa889('0x19'),_0x186b36,_0xa889('0x13'));_0x418d25(_0x260cf5['result'][_0xa889('0x18')]);}})[_0xa889('0x1a')](function(_0x597b49){logger[_0xa889('0x16')](_0xa889('0x19'),_0x186b36,_0x597b49);_0x4eb598(_0x597b49);});});} \ No newline at end of file +var _0x1cbf=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','then','request\x20sent','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2cbb7a,_0x166f22){var _0xa2f3fb=function(_0x54a82c){while(--_0x54a82c){_0x2cbb7a['push'](_0x2cbb7a['shift']());}};_0xa2f3fb(++_0x166f22);}(_0x1cbf,0x115));var _0xf1cb=function(_0x2681bb,_0x19e9aa){_0x2681bb=_0x2681bb-0x0;var _0x268684=_0x1cbf[_0x2681bb];return _0x268684;};'use strict';var _=require(_0xf1cb('0x0'));var util=require(_0xf1cb('0x1'));var moment=require(_0xf1cb('0x2'));var BPromise=require(_0xf1cb('0x3'));var rs=require(_0xf1cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1cb('0x5'))['db'];var utils=require(_0xf1cb('0x6'));var logger=require('../../config/logger')(_0xf1cb('0x7'));var config=require(_0xf1cb('0x8'));var jayson=require(_0xf1cb('0x9'));var client=jayson[_0xf1cb('0xa')][_0xf1cb('0xb')]({'port':0x232a});config[_0xf1cb('0xc')]=_[_0xf1cb('0xd')](config[_0xf1cb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1cb('0xe'))(new Redis(config[_0xf1cb('0xc')]));require(_0xf1cb('0xf'))[_0xf1cb('0x10')](socket);function respondWithRpcPromise(_0x3719fd,_0x19a584,_0x4bc5bf){return new BPromise(function(_0xcf7cca,_0x53690f){return client['request'](_0x3719fd,_0x4bc5bf)[_0xf1cb('0x11')](function(_0x1d2cab){logger['info']('Dashboard,\x20%s,\x20%s',_0x19a584,_0xf1cb('0x12'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x19a584,_0xf1cb('0x12'),JSON['stringify'](_0x1d2cab));if(_0x1d2cab[_0xf1cb('0x13')]){if(_0x1d2cab[_0xf1cb('0x13')][_0xf1cb('0x14')]===0x1f4){logger[_0xf1cb('0x13')](_0xf1cb('0x15'),_0x19a584,_0x1d2cab[_0xf1cb('0x13')][_0xf1cb('0x16')]);return _0x53690f(_0x1d2cab['error'][_0xf1cb('0x16')]);}logger[_0xf1cb('0x13')](_0xf1cb('0x15'),_0x19a584,_0x1d2cab[_0xf1cb('0x13')]['message']);return _0xcf7cca(_0x1d2cab[_0xf1cb('0x13')][_0xf1cb('0x16')]);}else{logger[_0xf1cb('0x17')](_0xf1cb('0x15'),_0x19a584,_0xf1cb('0x12'));_0xcf7cca(_0x1d2cab[_0xf1cb('0x18')][_0xf1cb('0x16')]);}})[_0xf1cb('0x19')](function(_0x4d0083){logger['error']('Dashboard,\x20%s,\x20%s',_0x19a584,_0x4d0083);_0x53690f(_0x4d0083);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index b352e21..d92c599 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 _0x0f0d=['save','remove','update','removeListener','register','dashboard:','./dashboard.events'];(function(_0x5c883f,_0x38f092){var _0x4210cc=function(_0x51be71){while(--_0x51be71){_0x5c883f['push'](_0x5c883f['shift']());}};_0x4210cc(++_0x38f092);}(_0x0f0d,0xf4));var _0xd0f0=function(_0x44124b,_0x2b2b32){_0x44124b=_0x44124b-0x0;var _0xafe8bf=_0x0f0d[_0x44124b];return _0xafe8bf;};'use strict';var DashboardEvents=require(_0xd0f0('0x0'));var events=[_0xd0f0('0x1'),_0xd0f0('0x2'),_0xd0f0('0x3')];function createListener(_0x2f33cc,_0x21b88e){return function(_0x3cac25){_0x21b88e['emit'](_0x2f33cc,_0x3cac25);};}function removeListener(_0x58cb91,_0x3276e4){return function(){DashboardEvents[_0xd0f0('0x4')](_0x58cb91,_0x3276e4);};}exports[_0xd0f0('0x5')]=function(_0x2bb695){for(var _0x44fee8=0x0,_0x462ed4=events['length'];_0x44fee8<_0x462ed4;_0x44fee8++){var _0x122623=events[_0x44fee8];var _0x36a2d2=createListener(_0xd0f0('0x6')+_0x122623,_0x2bb695);DashboardEvents['on'](_0x122623,_0x36a2d2);}}; \ No newline at end of file +var _0xa55c=['update','emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0x47ac5a,_0xce4c88){var _0x2ac0c6=function(_0x7d5f88){while(--_0x7d5f88){_0x47ac5a['push'](_0x47ac5a['shift']());}};_0x2ac0c6(++_0xce4c88);}(_0xa55c,0x69));var _0xca55=function(_0x12c3a9,_0x1b5b05){_0x12c3a9=_0x12c3a9-0x0;var _0x1e3f98=_0xa55c[_0x12c3a9];return _0x1e3f98;};'use strict';var DashboardEvents=require(_0xca55('0x0'));var events=[_0xca55('0x1'),_0xca55('0x2'),_0xca55('0x3')];function createListener(_0x5b05ee,_0x4c4c03){return function(_0x234f91){_0x4c4c03[_0xca55('0x4')](_0x5b05ee,_0x234f91);};}function removeListener(_0x28afd0,_0x4e22a6){return function(){DashboardEvents[_0xca55('0x5')](_0x28afd0,_0x4e22a6);};}exports[_0xca55('0x6')]=function(_0x20701f){for(var _0x1ff8e9=0x0,_0x3a8e96=events[_0xca55('0x7')];_0x1ff8e9<_0x3a8e96;_0x1ff8e9++){var _0x14649e=events[_0x1ff8e9];var _0x4937c9=createListener(_0xca55('0x8')+_0x14649e,_0x20701f);DashboardEvents['on'](_0x14649e,_0x4937c9);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 9afdb7b..fe77758 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 _0x2703=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','show','getItems','create','post','update','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x2703,0x1b2));var _0x3270=function(_0x41b14f,_0x5d2cba){_0x41b14f=_0x41b14f-0x0;var _0x72f0d6=_0x2703[_0x41b14f];return _0x72f0d6;};'use strict';var multer=require(_0x3270('0x0'));var util=require('util');var path=require(_0x3270('0x1'));var timeout=require(_0x3270('0x2'));var express=require(_0x3270('0x3'));var router=express[_0x3270('0x4')]();var fs_extra=require(_0x3270('0x5'));var auth=require(_0x3270('0x6'));var interaction=require(_0x3270('0x7'));var config=require('../../config/environment');var controller=require(_0x3270('0x8'));router[_0x3270('0x9')]('/',auth[_0x3270('0xa')](),controller['index']);router[_0x3270('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3270('0xb')]);router[_0x3270('0x9')]('/:id/items',auth['isAuthenticated'](),controller[_0x3270('0xc')]);router['post']('/',auth[_0x3270('0xa')](),controller[_0x3270('0xd')]);router[_0x3270('0xe')]('/:id/clone',auth[_0x3270('0xa')](),controller['clone']);router['post']('/:id/items',auth[_0x3270('0xa')](),controller['addItem']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3270('0xf')]);router['delete'](_0x3270('0x10'),auth['isAuthenticated'](),controller[_0x3270('0x11')]);module[_0x3270('0x12')]=router; \ No newline at end of file +var _0x4ebe=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','index','/:id','show','isAuthenticated','post','create','/:id/clone','clone','/:id/items','addItem','put','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4ebe,0x1c3));var _0xe4eb=function(_0x1f0a27,_0x104fdd){_0x1f0a27=_0x1f0a27-0x0;var _0x324328=_0x4ebe[_0x1f0a27];return _0x324328;};'use strict';var multer=require(_0xe4eb('0x0'));var util=require(_0xe4eb('0x1'));var path=require(_0xe4eb('0x2'));var timeout=require(_0xe4eb('0x3'));var express=require(_0xe4eb('0x4'));var router=express[_0xe4eb('0x5')]();var fs_extra=require(_0xe4eb('0x6'));var auth=require(_0xe4eb('0x7'));var interaction=require(_0xe4eb('0x8'));var config=require('../../config/environment');var controller=require(_0xe4eb('0x9'));router[_0xe4eb('0xa')]('/',auth['isAuthenticated'](),controller[_0xe4eb('0xb')]);router[_0xe4eb('0xa')](_0xe4eb('0xc'),auth['isAuthenticated'](),controller[_0xe4eb('0xd')]);router[_0xe4eb('0xa')]('/:id/items',auth[_0xe4eb('0xe')](),controller['getItems']);router[_0xe4eb('0xf')]('/',auth[_0xe4eb('0xe')](),controller[_0xe4eb('0x10')]);router['post'](_0xe4eb('0x11'),auth[_0xe4eb('0xe')](),controller[_0xe4eb('0x12')]);router[_0xe4eb('0xf')](_0xe4eb('0x13'),auth[_0xe4eb('0xe')](),controller[_0xe4eb('0x14')]);router[_0xe4eb('0x15')](_0xe4eb('0xc'),auth[_0xe4eb('0xe')](),controller['update']);router[_0xe4eb('0x16')]('/:id',auth[_0xe4eb('0xe')](),controller[_0xe4eb('0x17')]);module[_0xe4eb('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b4d09ef..2ad7d42 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 _0x524e=['exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','lodash'];(function(_0x42195a,_0x163a3e){var _0x2e1403=function(_0x52ee92){while(--_0x52ee92){_0x42195a['push'](_0x42195a['shift']());}};_0x2e1403(++_0x163a3e);}(_0x524e,0x15e));var _0xe524=function(_0x2d839b,_0x12459c){_0x2d839b=_0x2d839b-0x0;var _0x1b9a58=_0x524e[_0x2d839b];return _0x1b9a58;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0xe524('0x0'));module[_0xe524('0x1')]={'title':{'type':Sequelize[_0xe524('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4')),'get':function(){try{return JSON[_0xe524('0x5')](this[_0xe524('0x6')](_0xe524('0x7')));}catch(_0x110cff){return[];}},'set':function(_0x4f75d6){try{this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')](_0x4f75d6));}catch(_0x533c14){this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe524('0xa')]},'col':{'type':Sequelize[_0xe524('0xa')]},'background':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe524('0x2')]},'titleFontSize':{'type':Sequelize[_0xe524('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2a07=['setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x122fe6,_0x4ac758){var _0x36b7d2=function(_0x12fca2){while(--_0x12fca2){_0x122fe6['push'](_0x122fe6['shift']());}};_0x36b7d2(++_0x4ac758);}(_0x2a07,0x74));var _0x72a0=function(_0x2ae2bc,_0x177514){_0x2ae2bc=_0x2ae2bc-0x0;var _0x53c290=_0x2a07[_0x2ae2bc];return _0x53c290;};'use strict';var Sequelize=require(_0x72a0('0x0'));var squel=require(_0x72a0('0x1'));var _=require(_0x72a0('0x2'));module[_0x72a0('0x3')]={'title':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x72a0('0x5')](_0x72a0('0x6')),'get':function(){try{return JSON[_0x72a0('0x7')](this[_0x72a0('0x8')](_0x72a0('0x9')));}catch(_0xce74c){return[];}},'set':function(_0x3ccf6d){try{this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')](_0x3ccf6d));}catch(_0x21c819){this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x72a0('0xc')]},'background':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':_0x72a0('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x72a0('0x4')]},'titleFontSize':{'type':Sequelize[_0x72a0('0xc')],'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 a4bd5db..2e1ab7d 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 _0x307e=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','stack','name','send','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','DashboardItem','find','catch','type','iframe','attrUrl','attrs','https://','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','body','create','update','eml-format'];(function(_0x508953,_0x5b6946){var _0x5a7758=function(_0x45b127){while(--_0x45b127){_0x508953['push'](_0x508953['shift']());}};_0x5a7758(++_0x5b6946);}(_0x307e,0xc9));var _0xe307=function(_0x289c59,_0x486558){_0x289c59=_0x289c59-0x0;var _0x218b52=_0x307e[_0x289c59];return _0x218b52;};'use strict';var emlformat=require(_0xe307('0x0'));var rimraf=require(_0xe307('0x1'));var zipdir=require(_0xe307('0x2'));var jsonpatch=require(_0xe307('0x3'));var rp=require(_0xe307('0x4'));var moment=require('moment');var BPromise=require(_0xe307('0x5'));var Mustache=require(_0xe307('0x6'));var util=require('util');var path=require(_0xe307('0x7'));var sox=require('sox');var csv=require(_0xe307('0x8'));var ejs=require(_0xe307('0x9'));var fs=require('fs');var fs_extra=require(_0xe307('0xa'));var _=require('lodash');var squel=require(_0xe307('0xb'));var crypto=require(_0xe307('0xc'));var jsforce=require(_0xe307('0xd'));var deskjs=require(_0xe307('0xe'));var toCsv=require(_0xe307('0x8'));var querystring=require(_0xe307('0xf'));var Papa=require(_0xe307('0x10'));var Redis=require(_0xe307('0x11'));var authService=require(_0xe307('0x12'));var qs=require(_0xe307('0x13'));var as=require(_0xe307('0x14'));var hardwareService=require(_0xe307('0x15'));var logger=require(_0xe307('0x16'))(_0xe307('0x17'));var utils=require(_0xe307('0x18'));var config=require(_0xe307('0x19'));var licenseUtil=require(_0xe307('0x1a'));var db=require(_0xe307('0x1b'))['db'];config[_0xe307('0x1c')]=_[_0xe307('0x1d')](config['redis'],{'host':_0xe307('0x1e'),'port':0x18eb});var socket=require(_0xe307('0x1f'))(new Redis(config['redis']));require(_0xe307('0x20'))[_0xe307('0x21')](socket);function respondWithStatusCode(_0x2d3a73,_0x1e38f2){_0x1e38f2=_0x1e38f2||0xcc;return function(_0x23b5b8){if(_0x23b5b8){return _0x2d3a73[_0xe307('0x22')](_0x1e38f2);}return _0x2d3a73[_0xe307('0x23')](_0x1e38f2)['end']();};}function respondWithResult(_0x2abf63,_0x15631c){_0x15631c=_0x15631c||0xc8;return function(_0x46f63a){if(_0x46f63a){return _0x2abf63[_0xe307('0x23')](_0x15631c)[_0xe307('0x24')](_0x46f63a);}};}function respondWithFilteredResult(_0x52f83b,_0x4e4dfe){return function(_0xbc07f){if(_0xbc07f){var _0x52ef79=typeof _0x4e4dfe[_0xe307('0x25')]===_0xe307('0x26')&&typeof _0x4e4dfe[_0xe307('0x27')]===_0xe307('0x26');var _0x40e290=_0xbc07f[_0xe307('0x28')];var _0x11adc1=_0x52ef79?0x0:_0x4e4dfe[_0xe307('0x25')];var _0x1f3cf3=_0x52ef79?_0xbc07f[_0xe307('0x28')]:_0x4e4dfe[_0xe307('0x25')]+_0x4e4dfe[_0xe307('0x27')];var _0x394bde;if(_0x1f3cf3>=_0x40e290){_0x1f3cf3=_0x40e290;_0x394bde=0xc8;}else{_0x394bde=0xce;}_0x52f83b[_0xe307('0x23')](_0x394bde);return _0x52f83b[_0xe307('0x29')]('Content-Range',_0x11adc1+'-'+_0x1f3cf3+'/'+_0x40e290)[_0xe307('0x24')](_0xbc07f);}return null;};}function patchUpdates(_0x1ec000){return function(_0x85410d){try{jsonpatch[_0xe307('0x2a')](_0x85410d,_0x1ec000,!![]);}catch(_0x4fdf45){return BPromise[_0xe307('0x2b')](_0x4fdf45);}return _0x85410d[_0xe307('0x2c')]();};}function saveUpdates(_0x9c9503,_0x39c839){return function(_0x2f1b9c){if(_0x2f1b9c){return _0x2f1b9c['update'](_0x9c9503)['then'](function(_0x405ef6){return _0x405ef6;});}return null;};}function removeEntity(_0x11fe69,_0x3b169f){return function(_0x188f14){if(_0x188f14){return _0x188f14[_0xe307('0x2d')]()[_0xe307('0x2e')](function(){_0x11fe69[_0xe307('0x23')](0xcc)[_0xe307('0x2f')]();});}};}function handleEntityNotFound(_0x1fc65c,_0x47b075){return function(_0x6b9643){if(!_0x6b9643){_0x1fc65c[_0xe307('0x22')](0x194);}return _0x6b9643;};}function handleError(_0x5aa461,_0x122c71){_0x122c71=_0x122c71||0x1f4;return function(_0x51769d){logger['error'](_0x51769d[_0xe307('0x30')]);if(_0x51769d[_0xe307('0x31')]){delete _0x51769d[_0xe307('0x31')];}_0x5aa461['status'](_0x122c71)[_0xe307('0x32')](_0x51769d);};}exports['show']=function(_0x3fa6e5,_0x4b17ce){var _0x59e18b={'raw':![],'where':{'id':_0x3fa6e5['params']['id']}},_0x4b3bd7={};_0x4b3bd7[_0xe307('0x33')]=_[_0xe307('0x34')](db['DashboardItem'][_0xe307('0x35')]);_0x4b3bd7[_0xe307('0x36')]=_[_0xe307('0x34')](_0x3fa6e5[_0xe307('0x36')]);_0x4b3bd7['filters']=_[_0xe307('0x37')](_0x4b3bd7['model'],_0x4b3bd7['query']);_0x59e18b[_0xe307('0x38')]=_[_0xe307('0x37')](_0x4b3bd7[_0xe307('0x33')],qs[_0xe307('0x39')](_0x3fa6e5['query'][_0xe307('0x39')]));_0x59e18b['attributes']=_0x59e18b[_0xe307('0x38')][_0xe307('0x3a')]?_0x59e18b['attributes']:_0x4b3bd7[_0xe307('0x33')];if(_0x3fa6e5[_0xe307('0x36')][_0xe307('0x3b')]){_0x59e18b[_0xe307('0x3c')]=[{'all':!![]}];}_0x59e18b=_['merge']({},_0x59e18b,_0x3fa6e5['options']);return db[_0xe307('0x3d')][_0xe307('0x3e')](_0x59e18b)['then'](handleEntityNotFound(_0x4b17ce,null))[_0xe307('0x2e')](respondWithResult(_0x4b17ce,null))[_0xe307('0x3f')](handleError(_0x4b17ce,null));};exports[_0xe307('0x2d')]=function(_0x53ef30,_0x5b758f){return db[_0xe307('0x3d')]['find']({'where':{'id':_0x53ef30['params']['id']}})['then'](handleEntityNotFound(_0x5b758f,null))[_0xe307('0x2e')](removeEntity(_0x5b758f,null))['catch'](handleError(_0x5b758f,null));};function widgetAttributes(_0x20f8a0){try{switch(_0x20f8a0[_0xe307('0x40')]){case _0xe307('0x41'):return[{'name':_0xe307('0x42'),'value':_0x20f8a0['attrUrl']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0['attrs'][0x0]['value']:undefined)||_0xe307('0x44')}];case'custom':return[{'name':'attrPath','value':_0x20f8a0[_0xe307('0x45')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0[_0xe307('0x43')][0x0][_0xe307('0x46')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x20f8a0[_0xe307('0x47')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0['attrs'][0x0][_0xe307('0x46')]:undefined)||_0xe307('0x48')},{'name':'attrTimezone','value':_0x20f8a0[_0xe307('0x49')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x1]?_0x20f8a0['attrs'][0x1]['value']:undefined)||_0xe307('0x4a')},{'name':'attrFontSize','value':_0x20f8a0[_0xe307('0x4b')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x2]?_0x20f8a0[_0xe307('0x43')][0x2][_0xe307('0x46')]:undefined)||0xc}];case _0xe307('0x4c'):return[{'name':_0xe307('0x4d'),'value':_0x20f8a0[_0xe307('0x4d')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0[_0xe307('0x43')][0x0][_0xe307('0x46')]:undefined)||_0xe307('0x4e')},{'name':_0xe307('0x4f'),'value':_0x20f8a0[_0xe307('0x4f')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x1]?_0x20f8a0[_0xe307('0x43')][0x1]['value']:undefined)||[]},{'name':_0xe307('0x4b'),'value':_0x20f8a0[_0xe307('0x4b')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x2]?_0x20f8a0[_0xe307('0x43')][0x2][_0xe307('0x46')]:undefined)||0x14},{'name':_0xe307('0x50'),'value':_0x20f8a0['attrChannel']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0['attrs'][0x3]?_0x20f8a0[_0xe307('0x43')][0x3][_0xe307('0x46')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x20f8a0[_0xe307('0x51')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x4]?_0x20f8a0[_0xe307('0x43')][0x4]['value']:undefined)||''},{'name':_0xe307('0x52'),'value':_0x20f8a0[_0xe307('0x52')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x5]?_0x20f8a0[_0xe307('0x43')][0x5][_0xe307('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x20f8a0[_0xe307('0x53')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x6]?_0x20f8a0[_0xe307('0x43')][0x6][_0xe307('0x46')]:undefined)||''},{'name':_0xe307('0x54'),'value':_0x20f8a0[_0xe307('0x54')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x7]?_0x20f8a0[_0xe307('0x43')][0x7]['value']:undefined)||''},{'name':_0xe307('0x55'),'value':_0x20f8a0['attrWhatsappAccounts']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x8]?_0x20f8a0[_0xe307('0x43')][0x8][_0xe307('0x46')]:undefined)||''},{'name':_0xe307('0x56'),'value':_0x20f8a0[_0xe307('0x56')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x9]?_0x20f8a0['attrs'][0x9][_0xe307('0x46')]:undefined)||''}];case _0xe307('0x57'):case _0xe307('0x58'):return[{'name':'attrSerie1','value':_0x20f8a0['attrSerie1']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0[_0xe307('0x43')][0x0][_0xe307('0x46')]:undefined)||'total'},{'name':_0xe307('0x59'),'value':_0x20f8a0['attrSerie2']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x1]?_0x20f8a0[_0xe307('0x43')][0x1]['value']:undefined)||null},{'name':_0xe307('0x5a'),'value':_0x20f8a0[_0xe307('0x5a')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x2]?_0x20f8a0['attrs'][0x2][_0xe307('0x46')]:undefined)||null},{'name':_0xe307('0x4f'),'value':_0x20f8a0[_0xe307('0x4f')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0['attrs'][0x3]?_0x20f8a0[_0xe307('0x43')][0x3][_0xe307('0x46')]:undefined)||[]},{'name':_0xe307('0x50'),'value':_0x20f8a0[_0xe307('0x50')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x4]?_0x20f8a0[_0xe307('0x43')][0x4][_0xe307('0x46')]:undefined)||_0xe307('0x5b')},{'name':_0xe307('0x51'),'value':_0x20f8a0['attrEmailAccounts']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0['attrs'][0x5]?_0x20f8a0[_0xe307('0x43')][0x5][_0xe307('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x20f8a0[_0xe307('0x52')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x6]?_0x20f8a0[_0xe307('0x43')][0x6][_0xe307('0x46')]:undefined)||''},{'name':_0xe307('0x53'),'value':_0x20f8a0[_0xe307('0x53')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x7]?_0x20f8a0[_0xe307('0x43')][0x7][_0xe307('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x20f8a0[_0xe307('0x54')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x8]?_0x20f8a0['attrs'][0x8]['value']:undefined)||''},{'name':_0xe307('0x55'),'value':_0x20f8a0[_0xe307('0x55')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0['attrs'][0x9]?_0x20f8a0[_0xe307('0x43')][0x9][_0xe307('0x46')]:undefined)||''},{'name':_0xe307('0x56'),'value':_0x20f8a0[_0xe307('0x56')]||(_0x20f8a0['attrs']&&_0x20f8a0['attrs'][0xa]?_0x20f8a0[_0xe307('0x43')][0xa][_0xe307('0x46')]:undefined)||''}];case _0xe307('0x5c'):return[{'name':_0xe307('0x5d'),'type':_0x20f8a0[_0xe307('0x5e')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0[_0xe307('0x43')][0x0][_0xe307('0x40')]:undefined)||null,'value':_0x20f8a0[_0xe307('0x5d')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0['attrs'][0x0][_0xe307('0x46')]:undefined)||null},{'name':_0xe307('0x5f'),'value':_0x20f8a0['attrRefresh']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x1]?_0x20f8a0[_0xe307('0x43')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x7824ac){logger[_0xe307('0x60')](_0xe307('0x61'),JSON['stringify'](_0x7824ac));return[];}}exports['create']=function(_0x350ff2,_0x1172aa){if(_0x350ff2[_0xe307('0x62')]){_0x350ff2[_0xe307('0x62')][_0xe307('0x43')]=widgetAttributes(_0x350ff2['body']);}return db[_0xe307('0x3d')][_0xe307('0x63')](_0x350ff2[_0xe307('0x62')],{})[_0xe307('0x2e')](respondWithResult(_0x1172aa,0xc9))[_0xe307('0x3f')](handleError(_0x1172aa,null));};exports[_0xe307('0x64')]=function(_0x1b5bbe,_0x45bbb6){if(_0x1b5bbe['body']['id']){delete _0x1b5bbe[_0xe307('0x62')]['id'];}_0x1b5bbe[_0xe307('0x62')]['attrs']=widgetAttributes(_0x1b5bbe[_0xe307('0x62')]);return db[_0xe307('0x3d')]['find']({'where':{'id':_0x1b5bbe['params']['id']}})[_0xe307('0x2e')](handleEntityNotFound(_0x45bbb6,null))[_0xe307('0x2e')](saveUpdates(_0x1b5bbe[_0xe307('0x62')],null))[_0xe307('0x2e')](respondWithResult(_0x45bbb6,null))[_0xe307('0x3f')](handleError(_0x45bbb6,null));}; \ No newline at end of file +var _0x5a5a=['json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','model','DashboardItem','rawAttributes','keys','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrChatWebsites','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x48084f,_0x2d1e50){_0x48084f=_0x48084f-0x0;var _0x215480=_0x5a5a[_0x48084f];return _0x215480;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5a5('0x0'));var zipdir=require(_0xa5a5('0x1'));var jsonpatch=require(_0xa5a5('0x2'));var rp=require(_0xa5a5('0x3'));var moment=require(_0xa5a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5a5('0x5'));var util=require(_0xa5a5('0x6'));var path=require(_0xa5a5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa5a5('0x8'));var fs=require('fs');var fs_extra=require(_0xa5a5('0x9'));var _=require('lodash');var squel=require(_0xa5a5('0xa'));var crypto=require(_0xa5a5('0xb'));var jsforce=require(_0xa5a5('0xc'));var deskjs=require(_0xa5a5('0xd'));var toCsv=require(_0xa5a5('0xe'));var querystring=require('querystring');var Papa=require(_0xa5a5('0xf'));var Redis=require(_0xa5a5('0x10'));var authService=require(_0xa5a5('0x11'));var qs=require(_0xa5a5('0x12'));var as=require(_0xa5a5('0x13'));var hardwareService=require(_0xa5a5('0x14'));var logger=require(_0xa5a5('0x15'))(_0xa5a5('0x16'));var utils=require(_0xa5a5('0x17'));var config=require(_0xa5a5('0x18'));var licenseUtil=require(_0xa5a5('0x19'));var db=require(_0xa5a5('0x1a'))['db'];config['redis']=_[_0xa5a5('0x1b')](config[_0xa5a5('0x1c')],{'host':_0xa5a5('0x1d'),'port':0x18eb});var socket=require(_0xa5a5('0x1e'))(new Redis(config[_0xa5a5('0x1c')]));require(_0xa5a5('0x1f'))['register'](socket);function respondWithStatusCode(_0x3382c6,_0x2f5900){_0x2f5900=_0x2f5900||0xcc;return function(_0x14b6da){if(_0x14b6da){return _0x3382c6[_0xa5a5('0x20')](_0x2f5900);}return _0x3382c6[_0xa5a5('0x21')](_0x2f5900)[_0xa5a5('0x22')]();};}function respondWithResult(_0x1464d9,_0x62aa04){_0x62aa04=_0x62aa04||0xc8;return function(_0x48d369){if(_0x48d369){return _0x1464d9[_0xa5a5('0x21')](_0x62aa04)[_0xa5a5('0x23')](_0x48d369);}};}function respondWithFilteredResult(_0x4571f5,_0x184652){return function(_0x3c4cae){if(_0x3c4cae){var _0x12e2f2=typeof _0x184652[_0xa5a5('0x24')]==='undefined'&&typeof _0x184652[_0xa5a5('0x25')]===_0xa5a5('0x26');var _0x21488a=_0x3c4cae[_0xa5a5('0x27')];var _0x5e3412=_0x12e2f2?0x0:_0x184652[_0xa5a5('0x24')];var _0x553c93=_0x12e2f2?_0x3c4cae[_0xa5a5('0x27')]:_0x184652[_0xa5a5('0x24')]+_0x184652[_0xa5a5('0x25')];var _0x379f0d;if(_0x553c93>=_0x21488a){_0x553c93=_0x21488a;_0x379f0d=0xc8;}else{_0x379f0d=0xce;}_0x4571f5['status'](_0x379f0d);return _0x4571f5['set'](_0xa5a5('0x28'),_0x5e3412+'-'+_0x553c93+'/'+_0x21488a)[_0xa5a5('0x23')](_0x3c4cae);}return null;};}function patchUpdates(_0x417df3){return function(_0x4bfbd8){try{jsonpatch[_0xa5a5('0x29')](_0x4bfbd8,_0x417df3,!![]);}catch(_0x4b4613){return BPromise[_0xa5a5('0x2a')](_0x4b4613);}return _0x4bfbd8['save']();};}function saveUpdates(_0x4c0ff2,_0x29c914){return function(_0x210293){if(_0x210293){return _0x210293[_0xa5a5('0x2b')](_0x4c0ff2)[_0xa5a5('0x2c')](function(_0x55ed28){return _0x55ed28;});}return null;};}function removeEntity(_0x3583b1,_0x54dfdc){return function(_0x1c2bc6){if(_0x1c2bc6){return _0x1c2bc6[_0xa5a5('0x2d')]()['then'](function(){_0x3583b1['status'](0xcc)[_0xa5a5('0x22')]();});}};}function handleEntityNotFound(_0xdfa813,_0x47992c){return function(_0x5e50ae){if(!_0x5e50ae){_0xdfa813[_0xa5a5('0x20')](0x194);}return _0x5e50ae;};}function handleError(_0x20b3a5,_0x1133d3){_0x1133d3=_0x1133d3||0x1f4;return function(_0x4d1201){logger[_0xa5a5('0x2e')](_0x4d1201[_0xa5a5('0x2f')]);if(_0x4d1201['name']){delete _0x4d1201[_0xa5a5('0x30')];}_0x20b3a5['status'](_0x1133d3)[_0xa5a5('0x31')](_0x4d1201);};}exports['show']=function(_0xa4639c,_0x190a33){var _0x593279={'raw':![],'where':{'id':_0xa4639c['params']['id']}},_0x47ed1d={};_0x47ed1d[_0xa5a5('0x32')]=_['keys'](db[_0xa5a5('0x33')][_0xa5a5('0x34')]);_0x47ed1d['query']=_[_0xa5a5('0x35')](_0xa4639c[_0xa5a5('0x36')]);_0x47ed1d['filters']=_[_0xa5a5('0x37')](_0x47ed1d[_0xa5a5('0x32')],_0x47ed1d[_0xa5a5('0x36')]);_0x593279[_0xa5a5('0x38')]=_[_0xa5a5('0x37')](_0x47ed1d[_0xa5a5('0x32')],qs[_0xa5a5('0x39')](_0xa4639c['query'][_0xa5a5('0x39')]));_0x593279[_0xa5a5('0x38')]=_0x593279[_0xa5a5('0x38')][_0xa5a5('0x3a')]?_0x593279[_0xa5a5('0x38')]:_0x47ed1d[_0xa5a5('0x32')];if(_0xa4639c[_0xa5a5('0x36')][_0xa5a5('0x3b')]){_0x593279[_0xa5a5('0x3c')]=[{'all':!![]}];}_0x593279=_[_0xa5a5('0x3d')]({},_0x593279,_0xa4639c[_0xa5a5('0x3e')]);return db[_0xa5a5('0x33')][_0xa5a5('0x3f')](_0x593279)[_0xa5a5('0x2c')](handleEntityNotFound(_0x190a33,null))[_0xa5a5('0x2c')](respondWithResult(_0x190a33,null))[_0xa5a5('0x40')](handleError(_0x190a33,null));};exports[_0xa5a5('0x2d')]=function(_0x4b538c,_0x4577cc){return db['DashboardItem']['find']({'where':{'id':_0x4b538c['params']['id']}})[_0xa5a5('0x2c')](handleEntityNotFound(_0x4577cc,null))['then'](removeEntity(_0x4577cc,null))[_0xa5a5('0x40')](handleError(_0x4577cc,null));};function widgetAttributes(_0x353d32){try{switch(_0x353d32[_0xa5a5('0x41')]){case'iframe':return[{'name':_0xa5a5('0x42'),'value':_0x353d32['attrUrl']||(_0x353d32['attrs']&&_0x353d32[_0xa5a5('0x43')][0x0]?_0x353d32[_0xa5a5('0x43')][0x0]['value']:undefined)||_0xa5a5('0x44')}];case'custom':return[{'name':'attrPath','value':_0x353d32[_0xa5a5('0x45')]||(_0x353d32['attrs']&&_0x353d32[_0xa5a5('0x43')][0x0]?_0x353d32['attrs'][0x0][_0xa5a5('0x46')]:undefined)||''}];case _0xa5a5('0x47'):return[{'name':_0xa5a5('0x48'),'value':_0x353d32[_0xa5a5('0x48')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x0]?_0x353d32[_0xa5a5('0x43')][0x0][_0xa5a5('0x46')]:undefined)||_0xa5a5('0x49')},{'name':_0xa5a5('0x4a'),'value':_0x353d32['attrTimezone']||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32['attrs'][0x1]?_0x353d32[_0xa5a5('0x43')][0x1][_0xa5a5('0x46')]:undefined)||'0.00'},{'name':_0xa5a5('0x4b'),'value':_0x353d32[_0xa5a5('0x4b')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x2]?_0x353d32[_0xa5a5('0x43')][0x2]['value']:undefined)||0xc}];case _0xa5a5('0x4c'):return[{'name':_0xa5a5('0x4d'),'value':_0x353d32['attrMetric']||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x0]?_0x353d32[_0xa5a5('0x43')][0x0][_0xa5a5('0x46')]:undefined)||_0xa5a5('0x4e')},{'name':_0xa5a5('0x4f'),'value':_0x353d32[_0xa5a5('0x4f')]||(_0x353d32['attrs']&&_0x353d32[_0xa5a5('0x43')][0x1]?_0x353d32['attrs'][0x1][_0xa5a5('0x46')]:undefined)||[]},{'name':'attrFontSize','value':_0x353d32['attrFontSize']||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x2]?_0x353d32[_0xa5a5('0x43')][0x2]['value']:undefined)||0x14},{'name':_0xa5a5('0x50'),'value':_0x353d32['attrChannel']||(_0x353d32['attrs']&&_0x353d32[_0xa5a5('0x43')][0x3]?_0x353d32[_0xa5a5('0x43')][0x3][_0xa5a5('0x46')]:undefined)||'voice'},{'name':_0xa5a5('0x51'),'value':_0x353d32['attrEmailAccounts']||(_0x353d32['attrs']&&_0x353d32[_0xa5a5('0x43')][0x4]?_0x353d32[_0xa5a5('0x43')][0x4][_0xa5a5('0x46')]:undefined)||''},{'name':_0xa5a5('0x52'),'value':_0x353d32[_0xa5a5('0x52')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x5]?_0x353d32[_0xa5a5('0x43')][0x5]['value']:undefined)||''},{'name':_0xa5a5('0x53'),'value':_0x353d32[_0xa5a5('0x53')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x6]?_0x353d32[_0xa5a5('0x43')][0x6][_0xa5a5('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x353d32[_0xa5a5('0x54')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32['attrs'][0x7]?_0x353d32[_0xa5a5('0x43')][0x7][_0xa5a5('0x46')]:undefined)||''},{'name':_0xa5a5('0x55'),'value':_0x353d32['attrWhatsappAccounts']||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x8]?_0x353d32[_0xa5a5('0x43')][0x8][_0xa5a5('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x353d32['attrChatWebsites']||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x9]?_0x353d32[_0xa5a5('0x43')][0x9]['value']:undefined)||''}];case _0xa5a5('0x56'):case _0xa5a5('0x57'):return[{'name':_0xa5a5('0x58'),'value':_0x353d32[_0xa5a5('0x58')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x0]?_0x353d32[_0xa5a5('0x43')][0x0]['value']:undefined)||_0xa5a5('0x4e')},{'name':_0xa5a5('0x59'),'value':_0x353d32[_0xa5a5('0x59')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x1]?_0x353d32[_0xa5a5('0x43')][0x1]['value']:undefined)||null},{'name':_0xa5a5('0x5a'),'value':_0x353d32[_0xa5a5('0x5a')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32['attrs'][0x2]?_0x353d32[_0xa5a5('0x43')][0x2][_0xa5a5('0x46')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x353d32[_0xa5a5('0x4f')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x3]?_0x353d32[_0xa5a5('0x43')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x353d32[_0xa5a5('0x50')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x4]?_0x353d32[_0xa5a5('0x43')][0x4][_0xa5a5('0x46')]:undefined)||_0xa5a5('0x5b')},{'name':'attrEmailAccounts','value':_0x353d32['attrEmailAccounts']||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x5]?_0x353d32[_0xa5a5('0x43')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x353d32['attrFaxAccounts']||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x6]?_0x353d32[_0xa5a5('0x43')][0x6][_0xa5a5('0x46')]:undefined)||''},{'name':_0xa5a5('0x53'),'value':_0x353d32[_0xa5a5('0x53')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x7]?_0x353d32[_0xa5a5('0x43')][0x7][_0xa5a5('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x353d32[_0xa5a5('0x54')]||(_0x353d32['attrs']&&_0x353d32[_0xa5a5('0x43')][0x8]?_0x353d32[_0xa5a5('0x43')][0x8][_0xa5a5('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x353d32[_0xa5a5('0x55')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32['attrs'][0x9]?_0x353d32[_0xa5a5('0x43')][0x9][_0xa5a5('0x46')]:undefined)||''},{'name':_0xa5a5('0x5c'),'value':_0x353d32[_0xa5a5('0x5c')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0xa]?_0x353d32[_0xa5a5('0x43')][0xa][_0xa5a5('0x46')]:undefined)||''}];case _0xa5a5('0x5d'):return[{'name':_0xa5a5('0x5e'),'type':_0x353d32['reportType']||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x0]?_0x353d32[_0xa5a5('0x43')][0x0]['type']:undefined)||null,'value':_0x353d32[_0xa5a5('0x5e')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x0]?_0x353d32[_0xa5a5('0x43')][0x0][_0xa5a5('0x46')]:undefined)||null},{'name':_0xa5a5('0x5f'),'value':_0x353d32[_0xa5a5('0x5f')]||(_0x353d32[_0xa5a5('0x43')]&&_0x353d32[_0xa5a5('0x43')][0x1]?_0x353d32['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3f0523){logger[_0xa5a5('0x2e')](_0xa5a5('0x60'),JSON['stringify'](_0x3f0523));return[];}}exports[_0xa5a5('0x61')]=function(_0x5bb712,_0x3dfee1){if(_0x5bb712[_0xa5a5('0x62')]){_0x5bb712[_0xa5a5('0x62')][_0xa5a5('0x43')]=widgetAttributes(_0x5bb712['body']);}return db['DashboardItem'][_0xa5a5('0x61')](_0x5bb712[_0xa5a5('0x62')],{})['then'](respondWithResult(_0x3dfee1,0xc9))[_0xa5a5('0x40')](handleError(_0x3dfee1,null));};exports[_0xa5a5('0x2b')]=function(_0xfb357b,_0x284888){if(_0xfb357b['body']['id']){delete _0xfb357b['body']['id'];}_0xfb357b[_0xa5a5('0x62')]['attrs']=widgetAttributes(_0xfb357b[_0xa5a5('0x62')]);return db[_0xa5a5('0x33')][_0xa5a5('0x3f')]({'where':{'id':_0xfb357b[_0xa5a5('0x63')]['id']}})['then'](handleEntityNotFound(_0x284888,null))[_0xa5a5('0x2c')](saveUpdates(_0xfb357b['body'],null))[_0xa5a5('0x2c')](respondWithResult(_0x284888,null))[_0xa5a5('0x40')](handleError(_0x284888,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 4e9a0c5..5607cce 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 _0xce41=['events','DashboardItem','save','update','emit','hook','exports'];(function(_0x5e4844,_0x46883d){var _0xa0e771=function(_0x1a72ae){while(--_0x1a72ae){_0x5e4844['push'](_0x5e4844['shift']());}};_0xa0e771(++_0x46883d);}(_0xce41,0x1c0));var _0x1ce4=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0xce41[_0x313df3];return _0x241d59;};'use strict';var EventEmitter=require(_0x1ce4('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x1ce4('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ce4('0x2'),'afterUpdate':_0x1ce4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x413318){return function(_0x41617d,_0x4d3937,_0x54a8a1){DashboardItemEvents[_0x1ce4('0x4')](_0x413318+':'+_0x41617d['id'],_0x41617d);DashboardItemEvents[_0x1ce4('0x4')](_0x413318,_0x41617d);_0x54a8a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x1ce4('0x5')](e,emitEvent(event));}}module[_0x1ce4('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x693f=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x31e308,_0x23d733){var _0x660df5=function(_0xaeaf31){while(--_0xaeaf31){_0x31e308['push'](_0x31e308['shift']());}};_0x660df5(++_0x23d733);}(_0x693f,0x15c));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xf693('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf693('0x1')](0x0);var events={'afterCreate':_0xf693('0x2'),'afterUpdate':_0xf693('0x3'),'afterDestroy':'remove'};function emitEvent(_0x69a916){return function(_0x48b867,_0x29f10a,_0x794ab4){DashboardItemEvents[_0xf693('0x4')](_0x69a916+':'+_0x48b867['id'],_0x48b867);DashboardItemEvents[_0xf693('0x4')](_0x69a916,_0x48b867);_0x794ab4(null);};}for(var e in events){if(events[_0xf693('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 2abddfb..9eb9345 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 _0x4829=['dashboard_items','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','DashboardItem'];(function(_0x40c4e0,_0x9fdbfa){var _0x588be5=function(_0x1c5758){while(--_0x1c5758){_0x40c4e0['push'](_0x40c4e0['shift']());}};_0x588be5(++_0x9fdbfa);}(_0x4829,0xcd));var _0x9482=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x4829[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require(_0x9482('0x0'));var logger=require(_0x9482('0x1'))(_0x9482('0x2'));var moment=require(_0x9482('0x3'));var BPromise=require(_0x9482('0x4'));var rp=require(_0x9482('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9482('0x6'));var config=require(_0x9482('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x9482('0x8')]=function(_0x5e734f,_0x244e22){return _0x5e734f[_0x9482('0x9')](_0x9482('0xa'),attributes,{'tableName':_0x9482('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x724f=['bluebird','request-promise','path','../../config/environment','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x724f,0x1ea));var _0xf724=function(_0x395c5c,_0x356449){_0x395c5c=_0x395c5c-0x0;var _0x12cf5b=_0x724f[_0x395c5c];return _0x12cf5b;};'use strict';var _=require(_0xf724('0x0'));var util=require(_0xf724('0x1'));var logger=require(_0xf724('0x2'))(_0xf724('0x3'));var moment=require(_0xf724('0x4'));var BPromise=require(_0xf724('0x5'));var rp=require(_0xf724('0x6'));var fs=require('fs');var path=require(_0xf724('0x7'));var rimraf=require('rimraf');var config=require(_0xf724('0x8'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x48bcb6,_0x285835){return _0x48bcb6['define'](_0xf724('0x9'),attributes,{'tableName':_0xf724('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index b3f047d..02c835a 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 _0x3515=['defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x37dbe8,_0x10e968){var _0x2416b6=function(_0xd39957){while(--_0xd39957){_0x37dbe8['push'](_0x37dbe8['shift']());}};_0x2416b6(++_0x10e968);}(_0x3515,0x1e2));var _0x5351=function(_0x1c1bee,_0x27451f){_0x1c1bee=_0x1c1bee-0x0;var _0x3ed968=_0x3515[_0x1c1bee];return _0x3ed968;};'use strict';var _=require(_0x5351('0x0'));var util=require(_0x5351('0x1'));var moment=require(_0x5351('0x2'));var BPromise=require(_0x5351('0x3'));var rs=require(_0x5351('0x4'));var fs=require('fs');var Redis=require(_0x5351('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5351('0x6'));var logger=require(_0x5351('0x7'))(_0x5351('0x8'));var config=require(_0x5351('0x9'));var jayson=require(_0x5351('0xa'));var client=jayson[_0x5351('0xb')][_0x5351('0xc')]({'port':0x232a});config[_0x5351('0xd')]=_[_0x5351('0xe')](config[_0x5351('0xd')],{'host':_0x5351('0xf'),'port':0x18eb});var socket=require(_0x5351('0x10'))(new Redis(config[_0x5351('0xd')]));require(_0x5351('0x11'))[_0x5351('0x12')](socket);function respondWithRpcPromise(_0x48c4a1,_0x4b13e1,_0x380735){return new BPromise(function(_0x34904d,_0x2c657f){return client[_0x5351('0x13')](_0x48c4a1,_0x380735)[_0x5351('0x14')](function(_0xec7377){logger[_0x5351('0x15')]('DashboardItem,\x20%s,\x20%s',_0x4b13e1,_0x5351('0x16'));logger[_0x5351('0x17')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4b13e1,'request\x20sent',JSON[_0x5351('0x18')](_0xec7377));if(_0xec7377[_0x5351('0x19')]){if(_0xec7377['error'][_0x5351('0x1a')]===0x1f4){logger[_0x5351('0x19')](_0x5351('0x1b'),_0x4b13e1,_0xec7377['error'][_0x5351('0x1c')]);return _0x2c657f(_0xec7377['error'][_0x5351('0x1c')]);}logger[_0x5351('0x19')](_0x5351('0x1b'),_0x4b13e1,_0xec7377[_0x5351('0x19')][_0x5351('0x1c')]);return _0x34904d(_0xec7377[_0x5351('0x19')]['message']);}else{logger[_0x5351('0x15')](_0x5351('0x1b'),_0x4b13e1,_0x5351('0x16'));_0x34904d(_0xec7377[_0x5351('0x1d')][_0x5351('0x1c')]);}})[_0x5351('0x1e')](function(_0x64fdb8){logger[_0x5351('0x19')](_0x5351('0x1b'),_0x4b13e1,_0x64fdb8);_0x2c657f(_0x64fdb8);});});} \ No newline at end of file +var _0x70a9=['DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then'];(function(_0x55434c,_0x59d490){var _0x57cb63=function(_0x405a15){while(--_0x405a15){_0x55434c['push'](_0x55434c['shift']());}};_0x57cb63(++_0x59d490);}(_0x70a9,0x1cb));var _0x970a=function(_0x6cde5d,_0x10877b){_0x6cde5d=_0x6cde5d-0x0;var _0x9b2f68=_0x70a9[_0x6cde5d];return _0x9b2f68;};'use strict';var _=require(_0x970a('0x0'));var util=require(_0x970a('0x1'));var moment=require(_0x970a('0x2'));var BPromise=require(_0x970a('0x3'));var rs=require(_0x970a('0x4'));var fs=require('fs');var Redis=require(_0x970a('0x5'));var db=require(_0x970a('0x6'))['db'];var utils=require(_0x970a('0x7'));var logger=require('../../config/logger')(_0x970a('0x8'));var config=require(_0x970a('0x9'));var jayson=require(_0x970a('0xa'));var client=jayson[_0x970a('0xb')][_0x970a('0xc')]({'port':0x232a});config['redis']=_[_0x970a('0xd')](config[_0x970a('0xe')],{'host':_0x970a('0xf'),'port':0x18eb});var socket=require(_0x970a('0x10'))(new Redis(config['redis']));require(_0x970a('0x11'))[_0x970a('0x12')](socket);function respondWithRpcPromise(_0x450c6f,_0x40755d,_0x2526e1){return new BPromise(function(_0x2c5a41,_0x452308){return client[_0x970a('0x13')](_0x450c6f,_0x2526e1)[_0x970a('0x14')](function(_0x5d54b2){logger['info'](_0x970a('0x15'),_0x40755d,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x40755d,_0x970a('0x16'),JSON[_0x970a('0x17')](_0x5d54b2));if(_0x5d54b2[_0x970a('0x18')]){if(_0x5d54b2[_0x970a('0x18')][_0x970a('0x19')]===0x1f4){logger[_0x970a('0x18')](_0x970a('0x15'),_0x40755d,_0x5d54b2[_0x970a('0x18')][_0x970a('0x1a')]);return _0x452308(_0x5d54b2[_0x970a('0x18')][_0x970a('0x1a')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x40755d,_0x5d54b2[_0x970a('0x18')]['message']);return _0x2c5a41(_0x5d54b2[_0x970a('0x18')]['message']);}else{logger[_0x970a('0x1b')](_0x970a('0x15'),_0x40755d,'request\x20sent');_0x2c5a41(_0x5d54b2[_0x970a('0x1c')]['message']);}})[_0x970a('0x1d')](function(_0x4a5ebf){logger[_0x970a('0x18')]('DashboardItem,\x20%s,\x20%s',_0x40755d,_0x4a5ebf);_0x452308(_0x4a5ebf);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6ca0697..22f7851 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 _0x3db9=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x450a7c,_0xc09cd4){var _0x2b9149=function(_0x1f35ca){while(--_0x1f35ca){_0x450a7c['push'](_0x450a7c['shift']());}};_0x2b9149(++_0xc09cd4);}(_0x3db9,0x1bd));var _0x93db=function(_0x22dd0a,_0x26da6b){_0x22dd0a=_0x22dd0a-0x0;var _0x398287=_0x3db9[_0x22dd0a];return _0x398287;};'use strict';var DashboardItemEvents=require(_0x93db('0x0'));var events=['save',_0x93db('0x1'),_0x93db('0x2')];function createListener(_0x4830a1,_0x2a94f4){return function(_0x20737d){_0x2a94f4[_0x93db('0x3')](_0x4830a1,_0x20737d);};}function removeListener(_0x38c187,_0x134432){return function(){DashboardItemEvents[_0x93db('0x4')](_0x38c187,_0x134432);};}exports[_0x93db('0x5')]=function(_0x2788b2){for(var _0x21a698=0x0,_0x3e062d=events[_0x93db('0x6')];_0x21a698<_0x3e062d;_0x21a698++){var _0x52edcf=events[_0x21a698];var _0x303395=createListener(_0x93db('0x7')+_0x52edcf,_0x2788b2);DashboardItemEvents['on'](_0x52edcf,_0x303395);}}; \ No newline at end of file +var _0x247f=['remove','update','removeListener','register','dashboardItem:','./dashboardItem.events','save'];(function(_0x272c47,_0x18ce00){var _0x2d9c4d=function(_0x4e20fd){while(--_0x4e20fd){_0x272c47['push'](_0x272c47['shift']());}};_0x2d9c4d(++_0x18ce00);}(_0x247f,0x8a));var _0xf247=function(_0x313eec,_0x193e7e){_0x313eec=_0x313eec-0x0;var _0x4fc5b3=_0x247f[_0x313eec];return _0x4fc5b3;};'use strict';var DashboardItemEvents=require(_0xf247('0x0'));var events=[_0xf247('0x1'),_0xf247('0x2'),_0xf247('0x3')];function createListener(_0x9b6abe,_0x4f2f48){return function(_0x3435da){_0x4f2f48['emit'](_0x9b6abe,_0x3435da);};}function removeListener(_0xe38c9a,_0xc4da3b){return function(){DashboardItemEvents[_0xf247('0x4')](_0xe38c9a,_0xc4da3b);};}exports[_0xf247('0x5')]=function(_0x3b6a5c){for(var _0x5362f1=0x0,_0x2f22a0=events['length'];_0x5362f1<_0x2f22a0;_0x5362f1++){var _0x4992bd=events[_0x5362f1];var _0x28d39b=createListener(_0xf247('0x6')+_0x4992bd,_0x3b6a5c);DashboardItemEvents['on'](_0x4992bd,_0x28d39b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5655d69..cad012b 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 _0x9402=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x4edbdb,_0x4eb680){var _0x4e880b=function(_0x495f1c){while(--_0x495f1c){_0x4edbdb['push'](_0x4edbdb['shift']());}};_0x4e880b(++_0x4eb680);}(_0x9402,0x1d0));var _0x2940=function(_0xde2040,_0x41b1a4){_0xde2040=_0xde2040-0x0;var _0x5ae21f=_0x9402[_0xde2040];return _0x5ae21f;};'use strict';var multer=require(_0x2940('0x0'));var util=require('util');var path=require(_0x2940('0x1'));var timeout=require('connect-timeout');var express=require(_0x2940('0x2'));var router=express[_0x2940('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2940('0x4'));var interaction=require(_0x2940('0x5'));var config=require(_0x2940('0x6'));var controller=require(_0x2940('0x7'));router[_0x2940('0x8')](_0x2940('0x9'),auth[_0x2940('0xa')](),controller[_0x2940('0xb')]);router[_0x2940('0xc')]('/',auth['isAuthenticated'](),controller[_0x2940('0xd')]);router['put']('/:id',auth[_0x2940('0xa')](),controller[_0x2940('0xe')]);router[_0x2940('0xf')]('/:id',auth[_0x2940('0xa')](),controller[_0x2940('0x10')]);module[_0x2940('0x11')]=router; \ No newline at end of file +var _0x5242=['put','update','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5242,0x103));var _0x2524=function(_0x5dfd2b,_0x3c5bc9){_0x5dfd2b=_0x5dfd2b-0x0;var _0x503657=_0x5242[_0x5dfd2b];return _0x503657;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2524('0x0'));var timeout=require(_0x2524('0x1'));var express=require('express');var router=express[_0x2524('0x2')]();var fs_extra=require(_0x2524('0x3'));var auth=require(_0x2524('0x4'));var interaction=require(_0x2524('0x5'));var config=require('../../config/environment');var controller=require(_0x2524('0x6'));router[_0x2524('0x7')](_0x2524('0x8'),auth[_0x2524('0x9')](),controller[_0x2524('0xa')]);router[_0x2524('0xb')]('/',auth[_0x2524('0x9')](),controller[_0x2524('0xc')]);router[_0x2524('0xd')](_0x2524('0x8'),auth['isAuthenticated'](),controller[_0x2524('0xe')]);router['delete'](_0x2524('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x2524('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f2765a6..ca4a61a 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 _0x40c7=['first','sequelize','exports','STRING','ENUM','second'];(function(_0xf35bd4,_0x51ff64){var _0x47912b=function(_0x269818){while(--_0x269818){_0xf35bd4['push'](_0xf35bd4['shift']());}};_0x47912b(++_0x51ff64);}(_0x40c7,0x121));var _0x740c=function(_0x5e2862,_0x4760eb){_0x5e2862=_0x5e2862-0x0;var _0x8dcad4=_0x40c7[_0x5e2862];return _0x8dcad4;};'use strict';var Sequelize=require(_0x740c('0x0'));module[_0x740c('0x1')]={'name':{'type':Sequelize[_0x740c('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x740c('0x3')]('first',_0x740c('0x4'),'third'),'allowNull':![],'defaultValue':_0x740c('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf4a1=['exports','ENUM','first','third','STRING','sequelize'];(function(_0x7874c1,_0x30e521){var _0x2d5ff8=function(_0x3f42b3){while(--_0x3f42b3){_0x7874c1['push'](_0x7874c1['shift']());}};_0x2d5ff8(++_0x30e521);}(_0xf4a1,0x167));var _0x1f4a=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0xf4a1[_0x11946c];return _0x383935;};'use strict';var Sequelize=require(_0x1f4a('0x0'));module[_0x1f4a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x1f4a('0x2')](_0x1f4a('0x3'),'second',_0x1f4a('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x1f4a('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index df37960..9adea2e 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 _0x2159=['status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','options','Disposition','includeAll','include','findAll','catch','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x300806,_0x510f9b){var _0x101011=function(_0x29486b){while(--_0x29486b){_0x300806['push'](_0x300806['shift']());}};_0x101011(++_0x510f9b);}(_0x2159,0x17f));var _0x9215=function(_0x560924,_0x258a47){_0x560924=_0x560924-0x0;var _0x5c694d=_0x2159[_0x560924];return _0x5c694d;};'use strict';var emlformat=require(_0x9215('0x0'));var rimraf=require(_0x9215('0x1'));var zipdir=require(_0x9215('0x2'));var jsonpatch=require(_0x9215('0x3'));var rp=require('request-promise');var moment=require(_0x9215('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9215('0x5'));var util=require(_0x9215('0x6'));var path=require(_0x9215('0x7'));var sox=require(_0x9215('0x8'));var csv=require(_0x9215('0x9'));var ejs=require(_0x9215('0xa'));var fs=require('fs');var fs_extra=require(_0x9215('0xb'));var _=require(_0x9215('0xc'));var squel=require('squel');var crypto=require(_0x9215('0xd'));var jsforce=require(_0x9215('0xe'));var deskjs=require(_0x9215('0xf'));var toCsv=require(_0x9215('0x9'));var querystring=require(_0x9215('0x10'));var Papa=require('papaparse');var Redis=require(_0x9215('0x11'));var authService=require(_0x9215('0x12'));var qs=require(_0x9215('0x13'));var as=require(_0x9215('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9215('0x15'))(_0x9215('0x16'));var utils=require('../../config/utils');var config=require(_0x9215('0x17'));var licenseUtil=require(_0x9215('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43b660,_0x10b08f){_0x10b08f=_0x10b08f||0xcc;return function(_0x56c546){if(_0x56c546){return _0x43b660[_0x9215('0x19')](_0x10b08f);}return _0x43b660['status'](_0x10b08f)[_0x9215('0x1a')]();};}function respondWithResult(_0x5124b9,_0x1d65f4){_0x1d65f4=_0x1d65f4||0xc8;return function(_0x2d62dd){if(_0x2d62dd){return _0x5124b9[_0x9215('0x1b')](_0x1d65f4)[_0x9215('0x1c')](_0x2d62dd);}};}function respondWithFilteredResult(_0x4826bb,_0x3f44d3){return function(_0x40b41f){if(_0x40b41f){var _0x4c5ab5=typeof _0x3f44d3[_0x9215('0x1d')]===_0x9215('0x1e')&&typeof _0x3f44d3[_0x9215('0x1f')]===_0x9215('0x1e');var _0x229c46=_0x40b41f[_0x9215('0x20')];var _0x36ffb5=_0x4c5ab5?0x0:_0x3f44d3['offset'];var _0x197a47=_0x4c5ab5?_0x40b41f[_0x9215('0x20')]:_0x3f44d3[_0x9215('0x1d')]+_0x3f44d3[_0x9215('0x1f')];var _0x1aee05;if(_0x197a47>=_0x229c46){_0x197a47=_0x229c46;_0x1aee05=0xc8;}else{_0x1aee05=0xce;}_0x4826bb[_0x9215('0x1b')](_0x1aee05);return _0x4826bb[_0x9215('0x21')]('Content-Range',_0x36ffb5+'-'+_0x197a47+'/'+_0x229c46)['json'](_0x40b41f);}return null;};}function patchUpdates(_0x5bc65b){return function(_0x2fd6dd){try{jsonpatch[_0x9215('0x22')](_0x2fd6dd,_0x5bc65b,!![]);}catch(_0x54d9d7){return BPromise[_0x9215('0x23')](_0x54d9d7);}return _0x2fd6dd[_0x9215('0x24')]();};}function saveUpdates(_0xa58f48,_0x311cfb){return function(_0x518c52){if(_0x518c52){return _0x518c52[_0x9215('0x25')](_0xa58f48)[_0x9215('0x26')](function(_0x163a4a){return _0x163a4a;});}return null;};}function removeEntity(_0x240d25,_0x355cfe){return function(_0x19c276){if(_0x19c276){return _0x19c276[_0x9215('0x27')]()[_0x9215('0x26')](function(){var _0x10f51c=_0x19c276[_0x9215('0x28')]({'plain':!![]});var _0x2725d4='Dispositions';return db[_0x9215('0x29')][_0x9215('0x27')]({'where':{'type':_0x2725d4,'resourceId':_0x10f51c['id']}})[_0x9215('0x26')](function(){return _0x19c276;});})['then'](function(){_0x240d25[_0x9215('0x1b')](0xcc)[_0x9215('0x1a')]();});}};}function handleEntityNotFound(_0x4159a3,_0x896e9){return function(_0x10fa42){if(!_0x10fa42){_0x4159a3[_0x9215('0x19')](0x194);}return _0x10fa42;};}function handleError(_0x57a761,_0xc51dcf){_0xc51dcf=_0xc51dcf||0x1f4;return function(_0x83774f){logger[_0x9215('0x2a')](_0x83774f[_0x9215('0x2b')]);if(_0x83774f['name']){delete _0x83774f[_0x9215('0x2c')];}_0x57a761['status'](_0xc51dcf)[_0x9215('0x2d')](_0x83774f);};}exports['index']=function(_0x44c5ac,_0x4ac99f){var _0x38046d={},_0x4ff78a={},_0x4d0bc2={'count':0x0,'rows':[]};var _0x8af2e5=_[_0x9215('0x2e')](db['Disposition']['rawAttributes'],function(_0x33dc2d){return{'name':_0x33dc2d[_0x9215('0x2f')],'type':_0x33dc2d[_0x9215('0x30')][_0x9215('0x31')]};});_0x4ff78a['model']=_['map'](_0x8af2e5,_0x9215('0x2c'));_0x4ff78a[_0x9215('0x32')]=_[_0x9215('0x33')](_0x44c5ac[_0x9215('0x32')]);_0x4ff78a[_0x9215('0x34')]=_[_0x9215('0x35')](_0x4ff78a[_0x9215('0x36')],_0x4ff78a['query']);_0x38046d['attributes']=_[_0x9215('0x35')](_0x4ff78a[_0x9215('0x36')],qs[_0x9215('0x37')](_0x44c5ac['query'][_0x9215('0x37')]));_0x38046d[_0x9215('0x38')]=_0x38046d['attributes'][_0x9215('0x39')]?_0x38046d[_0x9215('0x38')]:_0x4ff78a[_0x9215('0x36')];if(!_0x44c5ac[_0x9215('0x32')]['hasOwnProperty']('nolimit')){_0x38046d[_0x9215('0x1f')]=qs[_0x9215('0x1f')](_0x44c5ac['query']['limit']);_0x38046d[_0x9215('0x1d')]=qs['offset'](_0x44c5ac['query'][_0x9215('0x1d')]);}_0x38046d[_0x9215('0x3a')]=qs[_0x9215('0x3b')](_0x44c5ac[_0x9215('0x32')][_0x9215('0x3b')]);_0x38046d[_0x9215('0x3c')]=qs[_0x9215('0x34')](_[_0x9215('0x3d')](_0x44c5ac[_0x9215('0x32')],_0x4ff78a['filters']),_0x8af2e5);if(_0x44c5ac[_0x9215('0x32')]['filter']){_0x38046d[_0x9215('0x3c')]=_[_0x9215('0x3e')](_0x38046d['where'],{'$or':_[_0x9215('0x2e')](_0x8af2e5,function(_0x5bc497){if(_0x5bc497[_0x9215('0x30')]!==_0x9215('0x3f')){var _0x438b79={};_0x438b79[_0x5bc497[_0x9215('0x2c')]]={'$like':'%'+_0x44c5ac['query']['filter']+'%'};return _0x438b79;}})});}_0x38046d=_['merge']({},_0x38046d,_0x44c5ac[_0x9215('0x40')]);var _0x19b112={'where':_0x38046d[_0x9215('0x3c')]};return db[_0x9215('0x41')][_0x9215('0x20')](_0x19b112)[_0x9215('0x26')](function(_0x159804){_0x4d0bc2[_0x9215('0x20')]=_0x159804;if(_0x44c5ac[_0x9215('0x32')][_0x9215('0x42')]){_0x38046d[_0x9215('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x9215('0x44')](_0x38046d);})[_0x9215('0x26')](function(_0x1e6a6){_0x4d0bc2['rows']=_0x1e6a6;return _0x4d0bc2;})[_0x9215('0x26')](respondWithFilteredResult(_0x4ac99f,_0x38046d))[_0x9215('0x45')](handleError(_0x4ac99f,null));};exports['show']=function(_0x5bd54b,_0x2069f2){var _0x4e1aad={'raw':!![],'where':{'id':_0x5bd54b[_0x9215('0x46')]['id']}},_0x38af40={};_0x38af40[_0x9215('0x36')]=_[_0x9215('0x33')](db['Disposition'][_0x9215('0x47')]);_0x38af40['query']=_['keys'](_0x5bd54b[_0x9215('0x32')]);_0x38af40[_0x9215('0x34')]=_[_0x9215('0x35')](_0x38af40['model'],_0x38af40[_0x9215('0x32')]);_0x4e1aad[_0x9215('0x38')]=_['intersection'](_0x38af40[_0x9215('0x36')],qs['fields'](_0x5bd54b[_0x9215('0x32')][_0x9215('0x37')]));_0x4e1aad['attributes']=_0x4e1aad['attributes'][_0x9215('0x39')]?_0x4e1aad['attributes']:_0x38af40[_0x9215('0x36')];if(_0x5bd54b[_0x9215('0x32')][_0x9215('0x42')]){_0x4e1aad['include']=[{'all':!![]}];}_0x4e1aad=_[_0x9215('0x3e')]({},_0x4e1aad,_0x5bd54b[_0x9215('0x40')]);return db[_0x9215('0x41')][_0x9215('0x48')](_0x4e1aad)[_0x9215('0x26')](handleEntityNotFound(_0x2069f2,null))[_0x9215('0x26')](respondWithResult(_0x2069f2,null))['catch'](handleError(_0x2069f2,null));};exports['create']=function(_0x3e7d2c,_0x2861b6){return db['Disposition'][_0x9215('0x49')](_0x3e7d2c['body'],{})[_0x9215('0x26')](function(_0x56c7fe){var _0x34b852=_0x3e7d2c[_0x9215('0x4a')]['get']({'plain':!![]});if(!_0x34b852)throw new Error(_0x9215('0x4b'));if(_0x34b852[_0x9215('0x4c')]===_0x9215('0x4a')){var _0x1a2f5a=_0x56c7fe[_0x9215('0x28')]({'plain':!![]});var _0x40d4f0=_0x9215('0x4d');return db[_0x9215('0x4e')][_0x9215('0x48')]({'where':{'name':_0x40d4f0,'userProfileId':_0x34b852[_0x9215('0x4f')]},'raw':!![]})[_0x9215('0x26')](function(_0x1f0982){if(_0x1f0982&&_0x1f0982[_0x9215('0x50')]===0x0){return db[_0x9215('0x29')][_0x9215('0x49')]({'name':_0x1a2f5a[_0x9215('0x2c')],'resourceId':_0x1a2f5a['id'],'type':_0x1f0982[_0x9215('0x2c')],'sectionId':_0x1f0982['id']},{})[_0x9215('0x26')](function(){return _0x56c7fe;});}else{return _0x56c7fe;}})[_0x9215('0x45')](function(_0x523b30){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x523b30);throw _0x523b30;});}return _0x56c7fe;})[_0x9215('0x26')](respondWithResult(_0x2861b6,0xc9))[_0x9215('0x45')](handleError(_0x2861b6,null));};exports[_0x9215('0x25')]=function(_0x5c7129,_0x2dacf9){if(_0x5c7129[_0x9215('0x51')]['id']){delete _0x5c7129[_0x9215('0x51')]['id'];}return db[_0x9215('0x41')][_0x9215('0x48')]({'where':{'id':_0x5c7129[_0x9215('0x46')]['id']}})[_0x9215('0x26')](handleEntityNotFound(_0x2dacf9,null))[_0x9215('0x26')](saveUpdates(_0x5c7129[_0x9215('0x51')],null))[_0x9215('0x26')](respondWithResult(_0x2dacf9,null))[_0x9215('0x45')](handleError(_0x2dacf9,null));};exports[_0x9215('0x27')]=function(_0xe3bc0d,_0x411457){return db[_0x9215('0x41')][_0x9215('0x48')]({'where':{'id':_0xe3bc0d['params']['id']}})[_0x9215('0x26')](handleEntityNotFound(_0x411457,null))['then'](removeEntity(_0x411457,null))['catch'](handleError(_0x411457,null));}; \ No newline at end of file +var _0x2899=['undefined','count','offset','reject','update','then','destroy','get','Dispositions','UserProfileResource','end','error','stack','name','index','map','Disposition','type','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','catch','params','intersection','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit'];(function(_0x4b19a5,_0x1d6119){var _0x2e663d=function(_0x5e665d){while(--_0x5e665d){_0x4b19a5['push'](_0x4b19a5['shift']());}};_0x2e663d(++_0x1d6119);}(_0x2899,0xfe));var _0x9289=function(_0x5b1936,_0x428dd7){_0x5b1936=_0x5b1936-0x0;var _0x4f004b=_0x2899[_0x5b1936];return _0x4f004b;};'use strict';var emlformat=require(_0x9289('0x0'));var rimraf=require(_0x9289('0x1'));var zipdir=require(_0x9289('0x2'));var jsonpatch=require(_0x9289('0x3'));var rp=require(_0x9289('0x4'));var moment=require(_0x9289('0x5'));var BPromise=require(_0x9289('0x6'));var Mustache=require(_0x9289('0x7'));var util=require(_0x9289('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x9289('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9289('0xa'));var _=require('lodash');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(_0x9289('0xb'));var Redis=require(_0x9289('0xc'));var authService=require(_0x9289('0xd'));var qs=require(_0x9289('0xe'));var as=require(_0x9289('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9289('0x10'))(_0x9289('0x11'));var utils=require(_0x9289('0x12'));var config=require(_0x9289('0x13'));var licenseUtil=require(_0x9289('0x14'));var db=require(_0x9289('0x15'))['db'];function respondWithStatusCode(_0x18a097,_0x47485b){_0x47485b=_0x47485b||0xcc;return function(_0x1d3b4){if(_0x1d3b4){return _0x18a097[_0x9289('0x16')](_0x47485b);}return _0x18a097[_0x9289('0x17')](_0x47485b)['end']();};}function respondWithResult(_0x3fa3e2,_0x4ba8e0){_0x4ba8e0=_0x4ba8e0||0xc8;return function(_0x3ec5b6){if(_0x3ec5b6){return _0x3fa3e2[_0x9289('0x17')](_0x4ba8e0)[_0x9289('0x18')](_0x3ec5b6);}};}function respondWithFilteredResult(_0x113a61,_0x1235ce){return function(_0x1b5fca){if(_0x1b5fca){var _0x4f2a13=typeof _0x1235ce['offset']==='undefined'&&typeof _0x1235ce[_0x9289('0x19')]===_0x9289('0x1a');var _0x4467c1=_0x1b5fca[_0x9289('0x1b')];var _0x1adc5a=_0x4f2a13?0x0:_0x1235ce[_0x9289('0x1c')];var _0xb3e309=_0x4f2a13?_0x1b5fca[_0x9289('0x1b')]:_0x1235ce[_0x9289('0x1c')]+_0x1235ce[_0x9289('0x19')];var _0x40ab40;if(_0xb3e309>=_0x4467c1){_0xb3e309=_0x4467c1;_0x40ab40=0xc8;}else{_0x40ab40=0xce;}_0x113a61[_0x9289('0x17')](_0x40ab40);return _0x113a61['set']('Content-Range',_0x1adc5a+'-'+_0xb3e309+'/'+_0x4467c1)[_0x9289('0x18')](_0x1b5fca);}return null;};}function patchUpdates(_0x168c6f){return function(_0x1cdd83){try{jsonpatch['apply'](_0x1cdd83,_0x168c6f,!![]);}catch(_0x32b2ad){return BPromise[_0x9289('0x1d')](_0x32b2ad);}return _0x1cdd83['save']();};}function saveUpdates(_0x5ef062,_0x29c422){return function(_0x36893b){if(_0x36893b){return _0x36893b[_0x9289('0x1e')](_0x5ef062)[_0x9289('0x1f')](function(_0x232f7f){return _0x232f7f;});}return null;};}function removeEntity(_0x419287,_0x2c12bc){return function(_0x128983){if(_0x128983){return _0x128983[_0x9289('0x20')]()['then'](function(){var _0x1f26f6=_0x128983[_0x9289('0x21')]({'plain':!![]});var _0x5795c6=_0x9289('0x22');return db[_0x9289('0x23')][_0x9289('0x20')]({'where':{'type':_0x5795c6,'resourceId':_0x1f26f6['id']}})[_0x9289('0x1f')](function(){return _0x128983;});})[_0x9289('0x1f')](function(){_0x419287[_0x9289('0x17')](0xcc)[_0x9289('0x24')]();});}};}function handleEntityNotFound(_0x15d5fa,_0x3fae00){return function(_0x231bb6){if(!_0x231bb6){_0x15d5fa[_0x9289('0x16')](0x194);}return _0x231bb6;};}function handleError(_0x1a255c,_0x40dcbe){_0x40dcbe=_0x40dcbe||0x1f4;return function(_0x2c9dc2){logger[_0x9289('0x25')](_0x2c9dc2[_0x9289('0x26')]);if(_0x2c9dc2[_0x9289('0x27')]){delete _0x2c9dc2[_0x9289('0x27')];}_0x1a255c['status'](_0x40dcbe)['send'](_0x2c9dc2);};}exports[_0x9289('0x28')]=function(_0x331dad,_0x31be4e){var _0x3c5561={},_0xb37b25={},_0x243c28={'count':0x0,'rows':[]};var _0x2a3735=_[_0x9289('0x29')](db[_0x9289('0x2a')]['rawAttributes'],function(_0x3fd922){return{'name':_0x3fd922['fieldName'],'type':_0x3fd922[_0x9289('0x2b')]['key']};});_0xb37b25[_0x9289('0x2c')]=_[_0x9289('0x29')](_0x2a3735,_0x9289('0x27'));_0xb37b25[_0x9289('0x2d')]=_[_0x9289('0x2e')](_0x331dad[_0x9289('0x2d')]);_0xb37b25[_0x9289('0x2f')]=_['intersection'](_0xb37b25['model'],_0xb37b25[_0x9289('0x2d')]);_0x3c5561[_0x9289('0x30')]=_['intersection'](_0xb37b25[_0x9289('0x2c')],qs[_0x9289('0x31')](_0x331dad[_0x9289('0x2d')]['fields']));_0x3c5561[_0x9289('0x30')]=_0x3c5561[_0x9289('0x30')]['length']?_0x3c5561[_0x9289('0x30')]:_0xb37b25[_0x9289('0x2c')];if(!_0x331dad['query'][_0x9289('0x32')]('nolimit')){_0x3c5561['limit']=qs['limit'](_0x331dad['query']['limit']);_0x3c5561[_0x9289('0x1c')]=qs[_0x9289('0x1c')](_0x331dad[_0x9289('0x2d')][_0x9289('0x1c')]);}_0x3c5561[_0x9289('0x33')]=qs[_0x9289('0x34')](_0x331dad['query'][_0x9289('0x34')]);_0x3c5561['where']=qs['filters'](_['pick'](_0x331dad[_0x9289('0x2d')],_0xb37b25[_0x9289('0x2f')]),_0x2a3735);if(_0x331dad['query'][_0x9289('0x35')]){_0x3c5561[_0x9289('0x36')]=_['merge'](_0x3c5561[_0x9289('0x36')],{'$or':_[_0x9289('0x29')](_0x2a3735,function(_0x4eccea){if(_0x4eccea[_0x9289('0x2b')]!==_0x9289('0x37')){var _0x21db2e={};_0x21db2e[_0x4eccea[_0x9289('0x27')]]={'$like':'%'+_0x331dad['query'][_0x9289('0x35')]+'%'};return _0x21db2e;}})});}_0x3c5561=_[_0x9289('0x38')]({},_0x3c5561,_0x331dad[_0x9289('0x39')]);var _0x204d58={'where':_0x3c5561[_0x9289('0x36')]};return db[_0x9289('0x2a')][_0x9289('0x1b')](_0x204d58)['then'](function(_0x5e8af9){_0x243c28['count']=_0x5e8af9;if(_0x331dad[_0x9289('0x2d')]['includeAll']){_0x3c5561[_0x9289('0x3a')]=[{'all':!![]}];}return db[_0x9289('0x2a')][_0x9289('0x3b')](_0x3c5561);})[_0x9289('0x1f')](function(_0x2ee5a4){_0x243c28['rows']=_0x2ee5a4;return _0x243c28;})[_0x9289('0x1f')](respondWithFilteredResult(_0x31be4e,_0x3c5561))[_0x9289('0x3c')](handleError(_0x31be4e,null));};exports['show']=function(_0xfbe34a,_0x1e2059){var _0x384457={'raw':!![],'where':{'id':_0xfbe34a[_0x9289('0x3d')]['id']}},_0x4ed25e={};_0x4ed25e[_0x9289('0x2c')]=_['keys'](db[_0x9289('0x2a')]['rawAttributes']);_0x4ed25e['query']=_['keys'](_0xfbe34a[_0x9289('0x2d')]);_0x4ed25e[_0x9289('0x2f')]=_['intersection'](_0x4ed25e[_0x9289('0x2c')],_0x4ed25e[_0x9289('0x2d')]);_0x384457[_0x9289('0x30')]=_[_0x9289('0x3e')](_0x4ed25e[_0x9289('0x2c')],qs[_0x9289('0x31')](_0xfbe34a[_0x9289('0x2d')][_0x9289('0x31')]));_0x384457[_0x9289('0x30')]=_0x384457[_0x9289('0x30')]['length']?_0x384457[_0x9289('0x30')]:_0x4ed25e[_0x9289('0x2c')];if(_0xfbe34a[_0x9289('0x2d')][_0x9289('0x3f')]){_0x384457[_0x9289('0x3a')]=[{'all':!![]}];}_0x384457=_['merge']({},_0x384457,_0xfbe34a[_0x9289('0x39')]);return db['Disposition'][_0x9289('0x40')](_0x384457)['then'](handleEntityNotFound(_0x1e2059,null))[_0x9289('0x1f')](respondWithResult(_0x1e2059,null))['catch'](handleError(_0x1e2059,null));};exports[_0x9289('0x41')]=function(_0x38a012,_0x372b9d){return db[_0x9289('0x2a')][_0x9289('0x41')](_0x38a012['body'],{})[_0x9289('0x1f')](function(_0x5606e6){var _0x359696=_0x38a012['user'][_0x9289('0x21')]({'plain':!![]});if(!_0x359696)throw new Error(_0x9289('0x42'));if(_0x359696[_0x9289('0x43')]==='user'){var _0x32f1be=_0x5606e6[_0x9289('0x21')]({'plain':!![]});var _0x4822bf=_0x9289('0x22');return db['UserProfileSection'][_0x9289('0x40')]({'where':{'name':_0x4822bf,'userProfileId':_0x359696[_0x9289('0x44')]},'raw':!![]})[_0x9289('0x1f')](function(_0x70fcae){if(_0x70fcae&&_0x70fcae['autoAssociation']===0x0){return db[_0x9289('0x23')][_0x9289('0x41')]({'name':_0x32f1be['name'],'resourceId':_0x32f1be['id'],'type':_0x70fcae[_0x9289('0x27')],'sectionId':_0x70fcae['id']},{})[_0x9289('0x1f')](function(){return _0x5606e6;});}else{return _0x5606e6;}})['catch'](function(_0x34e8a8){logger[_0x9289('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34e8a8);throw _0x34e8a8;});}return _0x5606e6;})[_0x9289('0x1f')](respondWithResult(_0x372b9d,0xc9))[_0x9289('0x3c')](handleError(_0x372b9d,null));};exports[_0x9289('0x1e')]=function(_0x4e9f6c,_0x12a07c){if(_0x4e9f6c[_0x9289('0x45')]['id']){delete _0x4e9f6c[_0x9289('0x45')]['id'];}return db['Disposition'][_0x9289('0x40')]({'where':{'id':_0x4e9f6c[_0x9289('0x3d')]['id']}})['then'](handleEntityNotFound(_0x12a07c,null))['then'](saveUpdates(_0x4e9f6c['body'],null))[_0x9289('0x1f')](respondWithResult(_0x12a07c,null))['catch'](handleError(_0x12a07c,null));};exports[_0x9289('0x20')]=function(_0x2b60cd,_0x11c7dc){return db[_0x9289('0x2a')][_0x9289('0x40')]({'where':{'id':_0x2b60cd[_0x9289('0x3d')]['id']}})['then'](handleEntityNotFound(_0x11c7dc,null))[_0x9289('0x1f')](removeEntity(_0x11c7dc,null))[_0x9289('0x3c')](handleError(_0x11c7dc,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1434859..d0dbaf1 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 _0x8453=['name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','Disposition','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x8453,0x100));var _0x3845=function(_0xa30ce7,_0x2de321){_0xa30ce7=_0xa30ce7-0x0;var _0xa33fda=_0x8453[_0xa30ce7];return _0xa33fda;};'use strict';var _=require(_0x3845('0x0'));var util=require(_0x3845('0x1'));var logger=require(_0x3845('0x2'))(_0x3845('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3845('0x4'));var fs=require('fs');var path=require(_0x3845('0x5'));var rimraf=require(_0x3845('0x6'));var config=require(_0x3845('0x7'));var attributes=require('./disposition.attributes');module[_0x3845('0x8')]=function(_0x1bd83c,_0x40b565){return _0x1bd83c[_0x3845('0x9')](_0x3845('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x3845('0xb'),'fields':[_0x3845('0xc'),'ListId']},{'unique':!![],'name':_0x3845('0xd'),'fields':[_0x3845('0xc'),_0x3845('0xe')]},{'unique':!![],'name':_0x3845('0xf'),'fields':[_0x3845('0xc'),_0x3845('0x10')]},{'unique':!![],'name':_0x3845('0x11'),'fields':['name',_0x3845('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x3845('0xc'),_0x3845('0x13')]},{'unique':!![],'name':_0x3845('0x14'),'fields':[_0x3845('0xc'),_0x3845('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x3845('0xc'),_0x3845('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38d9=['util','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x38d9,0xdc));var _0x938d=function(_0x1b93f6,_0x2c7bc6){_0x1b93f6=_0x1b93f6-0x0;var _0x3bc15b=_0x38d9[_0x1b93f6];return _0x3bc15b;};'use strict';var _=require('lodash');var util=require(_0x938d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x938d('0x1'));var rp=require(_0x938d('0x2'));var fs=require('fs');var path=require(_0x938d('0x3'));var rimraf=require(_0x938d('0x4'));var config=require(_0x938d('0x5'));var attributes=require(_0x938d('0x6'));module[_0x938d('0x7')]=function(_0x4792ec,_0x49fd85){return _0x4792ec[_0x938d('0x8')]('Disposition',attributes,{'tableName':_0x938d('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0x938d('0xa'),'fields':[_0x938d('0xb'),_0x938d('0xc')]},{'unique':!![],'name':_0x938d('0xd'),'fields':['name',_0x938d('0xe')]},{'unique':!![],'name':_0x938d('0xf'),'fields':[_0x938d('0xb'),_0x938d('0x10')]},{'unique':!![],'name':_0x938d('0x11'),'fields':[_0x938d('0xb'),_0x938d('0x12')]},{'unique':!![],'name':_0x938d('0x13'),'fields':[_0x938d('0xb'),_0x938d('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x938d('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 196d43b..5f66c82 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(_0x46e357,_0x447893){var _0x29a703=function(_0x2da9d7){while(--_0x2da9d7){_0x46e357['push'](_0x46e357['shift']());}};_0x29a703(++_0x447893);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x267177,_0x3b8a66){var _0x488eeb=function(_0x197f74){while(--_0x197f74){_0x267177['push'](_0x267177['shift']());}};_0x488eeb(++_0x3b8a66);}(_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 diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 74f0c64..80e27b0 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 _0xcfba=['update','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x18540f,_0x59a771){var _0x1f290b=function(_0x3f88c8){while(--_0x3f88c8){_0x18540f['push'](_0x18540f['shift']());}};_0x1f290b(++_0x59a771);}(_0xcfba,0xc5));var _0xacfb=function(_0x3cc3a9,_0x133800){_0x3cc3a9=_0x3cc3a9-0x0;var _0x157d18=_0xcfba[_0x3cc3a9];return _0x157d18;};'use strict';var multer=require('multer');var util=require(_0xacfb('0x0'));var path=require(_0xacfb('0x1'));var timeout=require(_0xacfb('0x2'));var express=require('express');var router=express[_0xacfb('0x3')]();var fs_extra=require(_0xacfb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacfb('0x5'));var config=require(_0xacfb('0x6'));var controller=require('./disposition.controller');router[_0xacfb('0x7')]('/',auth[_0xacfb('0x8')](),controller[_0xacfb('0x9')]);router[_0xacfb('0x7')](_0xacfb('0xa'),auth[_0xacfb('0x8')](),controller['show']);router[_0xacfb('0xb')]('/',auth[_0xacfb('0x8')](),controller[_0xacfb('0xc')]);router['put'](_0xacfb('0xa'),auth['isAuthenticated'](),controller[_0xacfb('0xd')]);router['delete']('/:id',auth[_0xacfb('0x8')](),controller['destroy']);module[_0xacfb('0xe')]=router; \ No newline at end of file +var _0xb7ae=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','create','put','/:id','update','delete','multer'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0xb7ae,0x131));var _0xeb7a=function(_0xcd8b0f,_0x4ae8fc){_0xcd8b0f=_0xcd8b0f-0x0;var _0x4fbc8d=_0xb7ae[_0xcd8b0f];return _0x4fbc8d;};'use strict';var multer=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var path=require(_0xeb7a('0x2'));var timeout=require(_0xeb7a('0x3'));var express=require('express');var router=express[_0xeb7a('0x4')]();var fs_extra=require(_0xeb7a('0x5'));var auth=require(_0xeb7a('0x6'));var interaction=require(_0xeb7a('0x7'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xeb7a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeb7a('0x8')]('/:id',auth[_0xeb7a('0x9')](),controller[_0xeb7a('0xa')]);router[_0xeb7a('0xb')]('/',auth[_0xeb7a('0x9')](),controller[_0xeb7a('0xc')]);router[_0xeb7a('0xd')](_0xeb7a('0xe'),auth[_0xeb7a('0x9')](),controller[_0xeb7a('0xf')]);router[_0xeb7a('0x10')](_0xeb7a('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 6560fb6..f911846 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 _0x7868=['7200','9600','12000','14400','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0x7868,0x1c0));var _0x8786=function(_0x171358,_0x5b80b6){_0x171358=_0x171358-0x0;var _0xf7fc3c=_0x7868[_0x171358];return _0xf7fc3c;};'use strict';var Sequelize=require(_0x8786('0x0'));module['exports']={'name':{'type':Sequelize[_0x8786('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8786('0x1')]},'ecm':{'type':Sequelize[_0x8786('0x2')](_0x8786('0x3'),'no'),'defaultValue':_0x8786('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x8786('0x4')},'localstationid':{'type':Sequelize[_0x8786('0x1')],'unique':_0x8786('0x5')},'minrate':{'type':Sequelize[_0x8786('0x2')](_0x8786('0x6'),_0x8786('0x7'),_0x8786('0x8'),_0x8786('0x9'),_0x8786('0xa'),_0x8786('0xb')),'defaultValue':_0x8786('0x7')},'maxrate':{'type':Sequelize[_0x8786('0x2')]('2400','4800',_0x8786('0x8'),_0x8786('0x9'),_0x8786('0xa'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x8786('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x8786('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8786('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8786('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8786('0x2')](_0x8786('0xd'),_0x8786('0xe'),'DADHI',_0x8786('0xf')),'defaultValue':_0x8786('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8786('0x10')],'defaultValue':function(){return _0x8786('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8786('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8786('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8786('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8786('0xc')],'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['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8786('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x8786('0x12')],'defaultValue':![],'comment':_0x8786('0x14'),'set':function(_0x280979){if(!_0x280979)this['setDataValue'](_0x8786('0x15'),null);this[_0x8786('0x16')](_0x8786('0x17'),_0x280979);}}}; \ No newline at end of file +var _0x8275=['ENUM','yes','2400','4800','9600','14400','7200','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING'];(function(_0x1936d4,_0x3f1f58){var _0x5b0d7f=function(_0x4ca9b1){while(--_0x4ca9b1){_0x1936d4['push'](_0x1936d4['shift']());}};_0x5b0d7f(++_0x3f1f58);}(_0x8275,0x87));var _0x5827=function(_0x1a2d37,_0x19cd85){_0x1a2d37=_0x1a2d37-0x0;var _0x4d5e76=_0x8275[_0x1a2d37];return _0x4d5e76;};'use strict';var Sequelize=require(_0x5827('0x0'));module[_0x5827('0x1')]={'name':{'type':Sequelize[_0x5827('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5827('0x2')]},'ecm':{'type':Sequelize[_0x5827('0x3')](_0x5827('0x4'),'no'),'defaultValue':_0x5827('0x4')},'headerinfo':{'type':Sequelize[_0x5827('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x5827('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5827('0x3')](_0x5827('0x5'),_0x5827('0x6'),'7200',_0x5827('0x7'),'12000',_0x5827('0x8')),'defaultValue':_0x5827('0x6')},'maxrate':{'type':Sequelize[_0x5827('0x3')]('2400',_0x5827('0x6'),_0x5827('0x9'),'9600',_0x5827('0xa'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x5827('0x2')],'defaultValue':_0x5827('0xb')},'gateway':{'type':Sequelize[_0x5827('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5827('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5827('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5827('0x3')](_0x5827('0xd'),_0x5827('0xe'),_0x5827('0xf'),_0x5827('0x10')),'defaultValue':_0x5827('0xd')},'key':{'type':Sequelize[_0x5827('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5827('0x11');}},'notificationSound':{'type':Sequelize[_0x5827('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5827('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5827('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5827('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5827('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5827('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5827('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5827('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x5827('0x12')],'defaultValue':![],'comment':_0x5827('0x14'),'set':function(_0x19e552){if(!_0x19e552)this[_0x5827('0x15')](_0x5827('0x16'),null);this[_0x5827('0x15')]('mandatoryDisposition',_0x19e552);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7bd6bf8..297663b 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 _0xcb9b=['CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','findOne','nolimit','order','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','transaction','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename'];(function(_0x5d8048,_0x445203){var _0x3affba=function(_0x5e65c4){while(--_0x5e65c4){_0x5d8048['push'](_0x5d8048['shift']());}};_0x3affba(++_0x445203);}(_0xcb9b,0xd9));var _0xbcb9=function(_0x376226,_0x430f59){_0x376226=_0x376226-0x0;var _0x51fa58=_0xcb9b[_0x376226];return _0x51fa58;};'use strict';var emlformat=require(_0xbcb9('0x0'));var rimraf=require(_0xbcb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcb9('0x2'));var rp=require('request-promise');var moment=require(_0xbcb9('0x3'));var BPromise=require(_0xbcb9('0x4'));var Mustache=require(_0xbcb9('0x5'));var util=require(_0xbcb9('0x6'));var path=require(_0xbcb9('0x7'));var sox=require(_0xbcb9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbcb9('0x9'));var _=require(_0xbcb9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbcb9('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbcb9('0xc'));var Papa=require(_0xbcb9('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbcb9('0xe'));var hardwareService=require(_0xbcb9('0xf'));var logger=require(_0xbcb9('0x10'))(_0xbcb9('0x11'));var utils=require(_0xbcb9('0x12'));var config=require(_0xbcb9('0x13'));var licenseUtil=require(_0xbcb9('0x14'));var db=require(_0xbcb9('0x15'))['db'];config['redis']=_[_0xbcb9('0x16')](config[_0xbcb9('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcb9('0x18'))(new Redis(config[_0xbcb9('0x17')]));require(_0xbcb9('0x19'))[_0xbcb9('0x1a')](socket);var jayson=require(_0xbcb9('0x1b'));var client=jayson[_0xbcb9('0x1c')][_0xbcb9('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xbcb9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x21cfbc,_0x2e57f5,_0x455e1a,_0x3a74b1){return new BPromise(function(_0x50d758,_0xeb330f){var _0x3006ac=_0x3a74b1||client;return _0x3006ac[_0xbcb9('0x1e')](_0x21cfbc,_0x455e1a)['then'](function(_0x1d7c90){logger[_0xbcb9('0x1f')](_0xbcb9('0x20'),_0x2e57f5,_0xbcb9('0x21'));logger['debug'](_0xbcb9('0x22'),_0x2e57f5,_0xbcb9('0x21'),JSON[_0xbcb9('0x23')](_0x1d7c90));if(_0x1d7c90[_0xbcb9('0x24')]){if(_0x1d7c90['error'][_0xbcb9('0x25')]===0x1f4){logger[_0xbcb9('0x24')](_0xbcb9('0x20'),_0x2e57f5,_0x1d7c90[_0xbcb9('0x24')][_0xbcb9('0x26')]);return _0xeb330f(_0x1d7c90['error'][_0xbcb9('0x26')]);}logger['error'](_0xbcb9('0x20'),_0x2e57f5,_0x1d7c90[_0xbcb9('0x24')][_0xbcb9('0x26')]);return _0x50d758(_0x1d7c90[_0xbcb9('0x24')][_0xbcb9('0x26')]);}else{logger[_0xbcb9('0x1f')](_0xbcb9('0x20'),_0x2e57f5,'request\x20sent');_0x50d758(_0x1d7c90[_0xbcb9('0x27')][_0xbcb9('0x26')]);}})[_0xbcb9('0x28')](function(_0x114135){logger[_0xbcb9('0x24')]('FaxAccount,\x20%s,\x20%s',_0x2e57f5,_0x114135);_0xeb330f(_0x114135);});});}function respondWithStatusCode(_0x242acd,_0x3bdf4b){_0x3bdf4b=_0x3bdf4b||0xcc;return function(_0x1408e9){if(_0x1408e9){return _0x242acd[_0xbcb9('0x29')](_0x3bdf4b);}return _0x242acd[_0xbcb9('0x2a')](_0x3bdf4b)[_0xbcb9('0x2b')]();};}function respondWithResult(_0x449f14,_0x27a01f){_0x27a01f=_0x27a01f||0xc8;return function(_0x14c4e5){if(_0x14c4e5){return _0x449f14[_0xbcb9('0x2a')](_0x27a01f)[_0xbcb9('0x2c')](_0x14c4e5);}};}function respondWithFilteredResult(_0x9da09d,_0x39033e){return function(_0x3b2fb7){if(_0x3b2fb7){var _0xe33497=typeof _0x39033e['offset']===_0xbcb9('0x2d')&&typeof _0x39033e[_0xbcb9('0x2e')]===_0xbcb9('0x2d');var _0x449c0a=_0x3b2fb7[_0xbcb9('0x2f')];var _0x2e99d4=_0xe33497?0x0:_0x39033e[_0xbcb9('0x30')];var _0x9b0e0d=_0xe33497?_0x3b2fb7['count']:_0x39033e[_0xbcb9('0x30')]+_0x39033e[_0xbcb9('0x2e')];var _0x176beb;if(_0x9b0e0d>=_0x449c0a){_0x9b0e0d=_0x449c0a;_0x176beb=0xc8;}else{_0x176beb=0xce;}_0x9da09d['status'](_0x176beb);return _0x9da09d['set'](_0xbcb9('0x31'),_0x2e99d4+'-'+_0x9b0e0d+'/'+_0x449c0a)[_0xbcb9('0x2c')](_0x3b2fb7);}return null;};}function patchUpdates(_0x1e576e){return function(_0x3df55a){try{jsonpatch[_0xbcb9('0x32')](_0x3df55a,_0x1e576e,!![]);}catch(_0xfd5283){return BPromise[_0xbcb9('0x33')](_0xfd5283);}return _0x3df55a[_0xbcb9('0x34')]();};}function saveUpdates(_0x37cca3,_0x14caf9){return function(_0x9e0f7c){if(_0x9e0f7c){return _0x9e0f7c['update'](_0x37cca3)[_0xbcb9('0x35')](function(_0x401161){return _0x401161;});}return null;};}function removeEntity(_0x2ceef6,_0x2948f1){return function(_0x12eea3){if(_0x12eea3){return _0x12eea3[_0xbcb9('0x36')]()[_0xbcb9('0x35')](function(){var _0x1bfada=_0x12eea3[_0xbcb9('0x37')]({'plain':!![]});var _0x2c36d5='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x2c36d5,'resourceId':_0x1bfada['id']}})[_0xbcb9('0x35')](function(){return _0x12eea3;});})[_0xbcb9('0x35')](function(){_0x2ceef6[_0xbcb9('0x2a')](0xcc)[_0xbcb9('0x2b')]();});}};}function handleEntityNotFound(_0x123f54,_0x10b13d){return function(_0x5eaf58){if(!_0x5eaf58){_0x123f54[_0xbcb9('0x29')](0x194);}return _0x5eaf58;};}function handleError(_0x573046,_0x15bf62){_0x15bf62=_0x15bf62||0x1f4;return function(_0x290dd8){logger[_0xbcb9('0x24')](_0x290dd8[_0xbcb9('0x38')]);if(_0x290dd8[_0xbcb9('0x39')]){delete _0x290dd8[_0xbcb9('0x39')];}_0x573046[_0xbcb9('0x2a')](_0x15bf62)[_0xbcb9('0x3a')](_0x290dd8);};}exports['index']=function(_0x310411,_0xea60b6){var _0x2bf4bc={'include':[{'model':db[_0xbcb9('0x3b')],'as':_0xbcb9('0x3c')}]},_0x36759a={},_0x979b16={'count':0x0,'rows':[]};var _0x16584c=_[_0xbcb9('0x3d')](db['FaxAccount'][_0xbcb9('0x3e')],function(_0x1127c5){return{'name':_0x1127c5[_0xbcb9('0x3f')],'type':_0x1127c5[_0xbcb9('0x40')][_0xbcb9('0x41')]};});_0x36759a[_0xbcb9('0x42')]=_['map'](_0x16584c,_0xbcb9('0x39'));_0x36759a[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x310411[_0xbcb9('0x43')]);_0x36759a[_0xbcb9('0x45')]=_[_0xbcb9('0x46')](_0x36759a['model'],_0x36759a[_0xbcb9('0x43')]);_0x2bf4bc[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0x36759a[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x310411[_0xbcb9('0x43')][_0xbcb9('0x48')]));_0x2bf4bc[_0xbcb9('0x47')]=_0x2bf4bc[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x2bf4bc[_0xbcb9('0x47')]:_0x36759a[_0xbcb9('0x42')];if(!_0x310411[_0xbcb9('0x43')]['hasOwnProperty']('nolimit')){_0x2bf4bc[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x310411['query'][_0xbcb9('0x2e')]);_0x2bf4bc['offset']=qs[_0xbcb9('0x30')](_0x310411['query'][_0xbcb9('0x30')]);}_0x2bf4bc['order']=qs[_0xbcb9('0x4a')](_0x310411[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x2bf4bc[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x310411['query'],_0x36759a[_0xbcb9('0x45')]),_0x16584c);if(_0x310411[_0xbcb9('0x43')][_0xbcb9('0x4d')]){_0x2bf4bc[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x2bf4bc['where'],{'$or':_[_0xbcb9('0x3d')](_0x16584c,function(_0x12656d){if(_0x12656d['type']!==_0xbcb9('0x4f')){var _0x176f55={};_0x176f55[_0x12656d[_0xbcb9('0x39')]]={'$like':'%'+_0x310411[_0xbcb9('0x43')][_0xbcb9('0x4d')]+'%'};return _0x176f55;}})});}_0x2bf4bc=_[_0xbcb9('0x4e')]({},_0x2bf4bc,_0x310411[_0xbcb9('0x50')]);var _0x2d5a78={'where':_0x2bf4bc['where']};return db[_0xbcb9('0x51')][_0xbcb9('0x2f')](_0x2d5a78)[_0xbcb9('0x35')](function(_0x38312c){_0x979b16['count']=_0x38312c;if(_0x310411['query'][_0xbcb9('0x52')]){_0x2bf4bc[_0xbcb9('0x53')]=[{'all':!![]}];}return db[_0xbcb9('0x51')][_0xbcb9('0x54')](_0x2bf4bc);})[_0xbcb9('0x35')](function(_0x145888){_0x979b16[_0xbcb9('0x55')]=_0x145888;return _0x979b16;})[_0xbcb9('0x35')](respondWithFilteredResult(_0xea60b6,_0x2bf4bc))[_0xbcb9('0x28')](handleError(_0xea60b6,null));};exports[_0xbcb9('0x56')]=function(_0x343244,_0x14b28d){var _0x578a3a={'raw':![],'where':{'id':_0x343244[_0xbcb9('0x57')]['id']},'include':[{'model':db[_0xbcb9('0x3b')],'as':'mandatoryDispositionPause'}]},_0x2a0535={};_0x2a0535[_0xbcb9('0x42')]=_[_0xbcb9('0x44')](db[_0xbcb9('0x51')]['rawAttributes']);_0x2a0535[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x343244[_0xbcb9('0x43')]);_0x2a0535[_0xbcb9('0x45')]=_[_0xbcb9('0x46')](_0x2a0535[_0xbcb9('0x42')],_0x2a0535['query']);_0x578a3a['attributes']=_[_0xbcb9('0x46')](_0x2a0535[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x343244[_0xbcb9('0x43')][_0xbcb9('0x48')]));_0x578a3a[_0xbcb9('0x47')]=_0x578a3a[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x578a3a[_0xbcb9('0x47')]:_0x2a0535[_0xbcb9('0x42')];if(_0x343244[_0xbcb9('0x43')][_0xbcb9('0x52')]){_0x578a3a[_0xbcb9('0x53')]=[{'all':!![]}];}_0x578a3a=_[_0xbcb9('0x4e')]({},_0x578a3a,_0x343244['options']);return db['FaxAccount'][_0xbcb9('0x58')](_0x578a3a)[_0xbcb9('0x35')](handleEntityNotFound(_0x14b28d,null))[_0xbcb9('0x35')](respondWithResult(_0x14b28d,null))[_0xbcb9('0x28')](handleError(_0x14b28d,null));};exports[_0xbcb9('0x59')]=function(_0x57d449,_0x341258){return db[_0xbcb9('0x51')][_0xbcb9('0x59')](_0x57d449[_0xbcb9('0x5a')],{})['then'](function(_0x319bb5){var _0xfba0fa=_0x57d449['user']['get']({'plain':!![]});if(!_0xfba0fa)throw new Error(_0xbcb9('0x5b'));if(_0xfba0fa['role']===_0xbcb9('0x5c')){var _0x389019=_0x319bb5[_0xbcb9('0x37')]({'plain':!![]});var _0x516d6e='FaxAccounts';return db[_0xbcb9('0x5d')][_0xbcb9('0x58')]({'where':{'name':_0x516d6e,'userProfileId':_0xfba0fa['userProfileId']},'raw':!![]})[_0xbcb9('0x35')](function(_0x195cc3){if(_0x195cc3&&_0x195cc3[_0xbcb9('0x5e')]===0x0){return db['UserProfileResource'][_0xbcb9('0x59')]({'name':_0x389019['name'],'resourceId':_0x389019['id'],'type':_0x195cc3[_0xbcb9('0x39')],'sectionId':_0x195cc3['id']},{})[_0xbcb9('0x35')](function(){return _0x319bb5;});}else{return _0x319bb5;}})[_0xbcb9('0x28')](function(_0x5503fd){logger[_0xbcb9('0x24')](_0xbcb9('0x5f'),_0x5503fd);throw _0x5503fd;});}return _0x319bb5;})[_0xbcb9('0x35')](respondWithResult(_0x341258,0xc9))[_0xbcb9('0x28')](handleError(_0x341258,null));};exports[_0xbcb9('0x60')]=function(_0x669408,_0x19a8a1){if(_0x669408[_0xbcb9('0x5a')]['id']){delete _0x669408[_0xbcb9('0x5a')]['id'];}return db[_0xbcb9('0x51')][_0xbcb9('0x58')]({'where':{'id':_0x669408[_0xbcb9('0x57')]['id']},'include':[{'model':db[_0xbcb9('0x3b')],'as':_0xbcb9('0x3c')}]})['then'](handleEntityNotFound(_0x19a8a1,null))['then'](saveUpdates(_0x669408[_0xbcb9('0x5a')],null))['then'](respondWithResult(_0x19a8a1,null))['catch'](handleError(_0x19a8a1,null));};exports[_0xbcb9('0x36')]=function(_0x36b9fa,_0x19c69a){return db[_0xbcb9('0x51')]['find']({'where':{'id':_0x36b9fa[_0xbcb9('0x57')]['id']}})['then'](handleEntityNotFound(_0x19c69a,null))[_0xbcb9('0x35')](removeEntity(_0x19c69a,null))[_0xbcb9('0x28')](handleError(_0x19c69a,null));};exports[_0xbcb9('0x61')]=function(_0xa39ae7,_0x5b05f4){return db[_0xbcb9('0x51')][_0xbcb9('0x61')]()['then'](respondWithResult(_0x5b05f4,null))[_0xbcb9('0x28')](handleError(_0x5b05f4,null));};exports[_0xbcb9('0x62')]=function(_0x1768e4,_0x222ec9,_0x4be4ce){if(_0x1768e4[_0xbcb9('0x5a')]['id']){delete _0x1768e4[_0xbcb9('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x1768e4['params']['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x222ec9,null))[_0xbcb9('0x35')](function(_0x23983d){if(_0x23983d){_0x1768e4[_0xbcb9('0x5a')][_0xbcb9('0x63')]=_0x23983d['id'];return db[_0xbcb9('0x64')][_0xbcb9('0x59')](_0x1768e4['body']);}})['then'](respondWithResult(_0x222ec9,null))[_0xbcb9('0x28')](handleError(_0x222ec9,null));};exports['getDispositions']=function(_0x266498,_0xffd3a0,_0x20c4d9){var _0x28b8b3={'raw':![],'where':{}};var _0x5d8ada={};var _0x1935c1={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbcb9('0x65')]({'where':{'id':_0x266498[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0xffd3a0,null))[_0xbcb9('0x35')](function(_0x30b105){if(_0x30b105){_0x5d8ada[_0xbcb9('0x42')]=_['keys'](db[_0xbcb9('0x64')]['rawAttributes']);_0x5d8ada['query']=_[_0xbcb9('0x44')](_0x266498[_0xbcb9('0x43')]);_0x5d8ada[_0xbcb9('0x45')]=_['intersection'](_0x5d8ada[_0xbcb9('0x42')],_0x5d8ada[_0xbcb9('0x43')]);_0x28b8b3[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0x5d8ada[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x266498[_0xbcb9('0x43')][_0xbcb9('0x48')]));_0x28b8b3[_0xbcb9('0x47')]=_0x28b8b3[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x28b8b3[_0xbcb9('0x47')]:_0x5d8ada['model'];if(!_0x266498[_0xbcb9('0x43')]['hasOwnProperty'](_0xbcb9('0x66'))){_0x28b8b3[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x266498[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0x28b8b3[_0xbcb9('0x30')]=qs[_0xbcb9('0x30')](_0x266498['query']['offset']);}_0x28b8b3[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x266498[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x28b8b3[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x266498['query'],_0x5d8ada[_0xbcb9('0x45')]));_0x28b8b3[_0xbcb9('0x4b')]['FaxAccountId']=_0x30b105['id'];if(_0x266498[_0xbcb9('0x43')][_0xbcb9('0x4d')]){_0x28b8b3[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x28b8b3[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0x28b8b3['attributes'],function(_0x568a92){var _0x278223={};_0x278223[_0x568a92]={'$like':'%'+_0x266498[_0xbcb9('0x43')]['filter']+'%'};return _0x278223;})});}_0x28b8b3=_['merge']({},_0x28b8b3,_0x266498[_0xbcb9('0x50')]);return db[_0xbcb9('0x64')][_0xbcb9('0x2f')]({'where':_0x28b8b3['where']})[_0xbcb9('0x35')](function(_0x4928fc){_0x1935c1[_0xbcb9('0x2f')]=_0x4928fc;if(_0x266498['query'][_0xbcb9('0x52')]){_0x28b8b3[_0xbcb9('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xbcb9('0x54')](_0x28b8b3);})[_0xbcb9('0x35')](function(_0x595db7){_0x1935c1['rows']=_0x595db7;return _0x1935c1;});}})['then'](respondWithFilteredResult(_0xffd3a0,_0x28b8b3))[_0xbcb9('0x28')](handleError(_0xffd3a0,null));};exports[_0xbcb9('0x68')]=function(_0x2d102e,_0x2b6951,_0x425e34){return db[_0xbcb9('0x51')][_0xbcb9('0x58')]({'where':{'id':_0x2d102e[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x2b6951,null))[_0xbcb9('0x35')](function(_0x437746){if(_0x437746){return _0x437746['removeDispositions'](_0x2d102e[_0xbcb9('0x43')][_0xbcb9('0x69')]);}})['then'](respondWithStatusCode(_0x2b6951,null))[_0xbcb9('0x28')](handleError(_0x2b6951,null));};exports[_0xbcb9('0x6a')]=function(_0x560d69,_0x444f89,_0x69ec69){if(_0x560d69['body']['id']){delete _0x560d69[_0xbcb9('0x5a')]['id'];}return db[_0xbcb9('0x51')]['find']({'where':{'id':_0x560d69[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x444f89,null))[_0xbcb9('0x35')](function(_0x4616b5){if(_0x4616b5){_0x560d69[_0xbcb9('0x5a')][_0xbcb9('0x63')]=_0x4616b5['id'];return db[_0xbcb9('0x6b')][_0xbcb9('0x59')](_0x560d69['body']);}})[_0xbcb9('0x35')](respondWithResult(_0x444f89,null))[_0xbcb9('0x28')](handleError(_0x444f89,null));};exports['getAnswers']=function(_0x4f1bc0,_0x35ec07,_0x4926c7){var _0x306eaf={'raw':![],'where':{}};var _0x1a0c04={};var _0x29b415={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbcb9('0x65')]({'where':{'id':_0x4f1bc0[_0xbcb9('0x57')]['id']}})['then'](handleEntityNotFound(_0x35ec07,null))[_0xbcb9('0x35')](function(_0x424c15){if(_0x424c15){_0x1a0c04['model']=_['keys'](db[_0xbcb9('0x6b')][_0xbcb9('0x3e')]);_0x1a0c04[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x4f1bc0[_0xbcb9('0x43')]);_0x1a0c04[_0xbcb9('0x45')]=_[_0xbcb9('0x46')](_0x1a0c04[_0xbcb9('0x42')],_0x1a0c04[_0xbcb9('0x43')]);_0x306eaf[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0x1a0c04[_0xbcb9('0x42')],qs['fields'](_0x4f1bc0[_0xbcb9('0x43')]['fields']));_0x306eaf[_0xbcb9('0x47')]=_0x306eaf['attributes'][_0xbcb9('0x49')]?_0x306eaf['attributes']:_0x1a0c04[_0xbcb9('0x42')];if(!_0x4f1bc0['query'][_0xbcb9('0x6c')](_0xbcb9('0x66'))){_0x306eaf[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0x306eaf[_0xbcb9('0x30')]=qs[_0xbcb9('0x30')](_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x30')]);}_0x306eaf['order']=qs[_0xbcb9('0x4a')](_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x306eaf[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x4f1bc0['query'],_0x1a0c04[_0xbcb9('0x45')]));_0x306eaf[_0xbcb9('0x4b')]['FaxAccountId']=_0x424c15['id'];if(_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x4d')]){_0x306eaf['where']=_[_0xbcb9('0x4e')](_0x306eaf[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0x306eaf[_0xbcb9('0x47')],function(_0x264e10){var _0x189f15={};_0x189f15[_0x264e10]={'$like':'%'+_0x4f1bc0[_0xbcb9('0x43')]['filter']+'%'};return _0x189f15;})});}_0x306eaf=_[_0xbcb9('0x4e')]({},_0x306eaf,_0x4f1bc0[_0xbcb9('0x50')]);return db[_0xbcb9('0x6b')][_0xbcb9('0x2f')]({'where':_0x306eaf[_0xbcb9('0x4b')]})[_0xbcb9('0x35')](function(_0x665383){_0x29b415[_0xbcb9('0x2f')]=_0x665383;if(_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x52')]){_0x306eaf[_0xbcb9('0x53')]=[{'all':!![]}];}return db[_0xbcb9('0x6b')][_0xbcb9('0x54')](_0x306eaf);})['then'](function(_0x6d3432){_0x29b415[_0xbcb9('0x55')]=_0x6d3432;return _0x29b415;});}})[_0xbcb9('0x35')](respondWithFilteredResult(_0x35ec07,_0x306eaf))[_0xbcb9('0x28')](handleError(_0x35ec07,null));};exports['removeAnswers']=function(_0x3f5017,_0x5248a3,_0x2912a9){return db[_0xbcb9('0x51')][_0xbcb9('0x58')]({'where':{'id':_0x3f5017[_0xbcb9('0x57')]['id']}})['then'](handleEntityNotFound(_0x5248a3,null))[_0xbcb9('0x35')](function(_0x1faacc){if(_0x1faacc){return _0x1faacc['removeAnswers'](_0x3f5017[_0xbcb9('0x43')][_0xbcb9('0x69')]);}})[_0xbcb9('0x35')](respondWithStatusCode(_0x5248a3,null))[_0xbcb9('0x28')](handleError(_0x5248a3,null));};exports[_0xbcb9('0x6d')]=function(_0xe4c3c0,_0x2d5fa0,_0x5b0b52){return db[_0xbcb9('0x6e')]['find']({'where':{'id':_0xe4c3c0[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x2d5fa0,null))[_0xbcb9('0x35')](function(_0x549f96){if(_0x549f96){return _0x549f96[_0xbcb9('0x6d')](_0xe4c3c0[_0xbcb9('0x5a')][_0xbcb9('0x69')],_[_0xbcb9('0x6f')](_0xe4c3c0[_0xbcb9('0x5a')],[_0xbcb9('0x69'),'id'])||{});}})[_0xbcb9('0x35')](respondWithResult(_0x2d5fa0,null))[_0xbcb9('0x28')](handleError(_0x2d5fa0,null));};exports[_0xbcb9('0x70')]=function(_0x1ad2ad,_0x2f2ba6,_0x1f50c4){var _0x2b54e2={'raw':![],'where':{}};var _0x30599f={};var _0x22f6c0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbcb9('0x65')]({'where':{'id':_0x1ad2ad[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x2f2ba6,null))[_0xbcb9('0x35')](function(_0x37f428){if(_0x37f428){_0x30599f[_0xbcb9('0x42')]=_['keys'](db[_0xbcb9('0x6e')][_0xbcb9('0x3e')]);_0x30599f['query']=_[_0xbcb9('0x44')](_0x1ad2ad['query']);_0x30599f[_0xbcb9('0x45')]=_['intersection'](_0x30599f['model'],_0x30599f[_0xbcb9('0x43')]);_0x2b54e2[_0xbcb9('0x47')]=_['intersection'](_0x30599f[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x48')]));_0x2b54e2[_0xbcb9('0x47')]=_0x2b54e2[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x2b54e2[_0xbcb9('0x47')]:_0x30599f['model'];if(!_0x1ad2ad[_0xbcb9('0x43')]['hasOwnProperty'](_0xbcb9('0x66'))){_0x2b54e2[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0x2b54e2[_0xbcb9('0x30')]=qs[_0xbcb9('0x30')](_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x30')]);}_0x2b54e2[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x2b54e2[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x1ad2ad[_0xbcb9('0x43')],_0x30599f[_0xbcb9('0x45')]));_0x2b54e2[_0xbcb9('0x4b')]['FaxAccountId']=_0x37f428['id'];if(_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x4d')]){_0x2b54e2[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x2b54e2[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0x2b54e2[_0xbcb9('0x47')],function(_0x2a7aff){var _0x19efd8={};_0x19efd8[_0x2a7aff]={'$like':'%'+_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x4d')]+'%'};return _0x19efd8;})});}_0x2b54e2=_[_0xbcb9('0x4e')]({},_0x2b54e2,_0x1ad2ad[_0xbcb9('0x50')]);return db[_0xbcb9('0x6e')]['count']({'where':_0x2b54e2[_0xbcb9('0x4b')]})['then'](function(_0x20b70b){_0x22f6c0[_0xbcb9('0x2f')]=_0x20b70b;if(_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x52')]){_0x2b54e2[_0xbcb9('0x53')]=[{'model':db[_0xbcb9('0x71')],'as':_0xbcb9('0x72'),'required':![]},{'model':db['User'],'as':_0xbcb9('0x73'),'attributes':[_0xbcb9('0x39'),_0xbcb9('0x74'),_0xbcb9('0x75')],'required':![]},{'model':db[_0xbcb9('0x76')],'as':_0xbcb9('0x77'),'attributes':['id',_0xbcb9('0x39'),_0xbcb9('0x78')],'where':_0x1ad2ad[_0xbcb9('0x43')]['tag']?{'id':_0x1ad2ad['query'][_0xbcb9('0x79')]}:undefined,'required':_0x1ad2ad[_0xbcb9('0x43')]['tag']?!![]:![]}];}return db[_0xbcb9('0x6e')][_0xbcb9('0x54')](_0x2b54e2);})[_0xbcb9('0x35')](function(_0x409d13){_0x22f6c0[_0xbcb9('0x55')]=_0x409d13;return _0x22f6c0;});}})[_0xbcb9('0x35')](respondWithFilteredResult(_0x2f2ba6,_0x2b54e2))[_0xbcb9('0x28')](handleError(_0x2f2ba6,null));};exports['addApplications']=function(_0x4a508e,_0x198d17){var _0x5f0610=_0x4a508e[_0xbcb9('0x57')]['id'];var _0x33c913=_0x4a508e[_0xbcb9('0x5a')];var _0x3c154b=0xc8;var _0x1f6bec=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xbcb9('0x7a')][_0xbcb9('0x7b')][_0xbcb9('0x7c')][_0xbcb9('0x7d')]},function(_0x35d579){return db[_0xbcb9('0x51')]['findOne']({'where':{'id':_0x5f0610},'transaction':_0x35d579})[_0xbcb9('0x35')](function(_0x14c044){if(_0x14c044){return db['FaxApplication'][_0xbcb9('0x36')]({'where':{'FaxAccountId':_0x5f0610},'transaction':_0x35d579})['then'](function(){var _0xf61196=_[_0xbcb9('0x3d')](_0x33c913,function(_0x541445){_0x541445[_0xbcb9('0x63')]=_0x5f0610;return _0x541445;});return db[_0xbcb9('0x7e')][_0xbcb9('0x7f')](_0xf61196,{'transaction':_0x35d579});});}else{_0x3c154b=0x194;_0x1f6bec=[];}});})[_0xbcb9('0x35')](function(){if(_0x3c154b!==0x194){return db['FaxApplication'][_0xbcb9('0x80')]({'where':{'FaxAccountId':_0x5f0610},'order':'priority'})[_0xbcb9('0x35')](function(_0x29b557){_0x1f6bec=_0x29b557;});}})[_0xbcb9('0x28')](function(_0x429433){_0x3c154b=0x1f4;logger[_0xbcb9('0x24')](_0x429433[_0xbcb9('0x38')]);if(_0x429433[_0xbcb9('0x39')]){delete _0x429433[_0xbcb9('0x39')];}_0x1f6bec=_0x429433;})[_0xbcb9('0x81')](function(){if(_0x1f6bec===null){_0x198d17[_0xbcb9('0x29')](_0x3c154b);}else{if(_0x3c154b===0x1f4){_0x198d17[_0xbcb9('0x2a')](_0x3c154b)[_0xbcb9('0x3a')](_0x1f6bec);}else{_0x198d17['status'](_0x3c154b)[_0xbcb9('0x2c')](_0x1f6bec);}}});};exports[_0xbcb9('0x82')]=function(_0x5f4ff6,_0x39974b,_0x5a7c74){var _0x1f2647={};var _0x4aa7f1={};var _0x4a4af4;var _0x1c97fd;return db[_0xbcb9('0x51')][_0xbcb9('0x65')]({'where':{'id':_0x5f4ff6[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x39974b,null))['then'](function(_0x413cca){if(_0x413cca){_0x4a4af4=_0x413cca;_0x4aa7f1[_0xbcb9('0x42')]=_[_0xbcb9('0x44')](db['FaxApplication'][_0xbcb9('0x3e')]);_0x4aa7f1['query']=_['keys'](_0x5f4ff6['query']);_0x4aa7f1['filters']=_[_0xbcb9('0x46')](_0x4aa7f1[_0xbcb9('0x42')],_0x4aa7f1[_0xbcb9('0x43')]);_0x1f2647['attributes']=_[_0xbcb9('0x46')](_0x4aa7f1['model'],qs[_0xbcb9('0x48')](_0x5f4ff6['query']['fields']));_0x1f2647[_0xbcb9('0x47')]=_0x1f2647[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x1f2647[_0xbcb9('0x47')]:_0x4aa7f1[_0xbcb9('0x42')];_0x1f2647[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x5f4ff6['query'][_0xbcb9('0x4a')]);_0x1f2647[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_['pick'](_0x5f4ff6[_0xbcb9('0x43')],_0x4aa7f1[_0xbcb9('0x45')]));if(_0x5f4ff6['query'][_0xbcb9('0x4d')]){_0x1f2647[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x1f2647['where'],{'$or':_['map'](_0x1f2647[_0xbcb9('0x47')],function(_0x5f16af){var _0xee9ee9={};_0xee9ee9[_0x5f16af]={'$like':'%'+_0x5f4ff6[_0xbcb9('0x43')][_0xbcb9('0x4d')]+'%'};return _0xee9ee9;})});}_0x1f2647=_['merge']({},_0x1f2647,_0x5f4ff6[_0xbcb9('0x50')]);return _0x4a4af4[_0xbcb9('0x82')](_0x1f2647);}})['then'](function(_0x305c00){if(_0x305c00){_0x1c97fd=_0x305c00['length'];if(!_0x5f4ff6['query'][_0xbcb9('0x6c')]('nolimit')){_0x1f2647[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x5f4ff6['query'][_0xbcb9('0x2e')]);_0x1f2647['offset']=qs[_0xbcb9('0x30')](_0x5f4ff6[_0xbcb9('0x43')][_0xbcb9('0x30')]);}return _0x4a4af4[_0xbcb9('0x82')](_0x1f2647);}})[_0xbcb9('0x35')](function(_0x5ee5f0){if(_0x5ee5f0){return _0x5ee5f0?{'count':_0x1c97fd,'rows':_0x5ee5f0}:null;}})[_0xbcb9('0x35')](respondWithResult(_0x39974b,null))[_0xbcb9('0x28')](handleError(_0x39974b,null));};function Extension(_0x1690ce,_0x5d66d4,_0x19bdde,_0x308fb1){this[_0xbcb9('0x83')]=_0xbcb9('0x84');this[_0xbcb9('0x85')]=_0x1690ce[_0xbcb9('0x86')];this[_0xbcb9('0x87')]=_0x308fb1;this[_0xbcb9('0x40')]=_0xbcb9('0x88');this[_0xbcb9('0x89')]=_0xbcb9('0x8a');this[_0xbcb9('0x63')]=_0x1690ce['id'];this[_0xbcb9('0x8b')]=_0x5d66d4;this[_0xbcb9('0x8c')]=_0x19bdde;}function createExtensionsReciveFax(_0x41e528){var _0x49a93a=0x1;var _0xe3aca1=[];_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,'','Answer'));_0x49a93a+=0x1;_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,_0xbcb9('0x8e'),_0xbcb9('0x8f')));_0x49a93a+=0x1;for(var _0x3320e7 in _0x41e528){if(_0x41e528[_0xbcb9('0x6c')](_0x3320e7)&&(_0x3320e7===_0xbcb9('0x90')||_0x3320e7===_0xbcb9('0x86')||_0x3320e7===_0xbcb9('0x91')||_0x3320e7===_0xbcb9('0x92')||_0x3320e7===_0xbcb9('0x93')||_0x3320e7===_0xbcb9('0x94')||_0x3320e7===_0xbcb9('0x95')||_0x3320e7===_0xbcb9('0x96')||_0x3320e7==='t38timeout')){_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,_0xbcb9('0x97')+_0x3320e7+')='+_0x41e528[_0x3320e7],_0xbcb9('0x8f')));_0x49a93a+=0x1;}}_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,'6',_0xbcb9('0x98')));_0x49a93a+=0x1;_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,_0xbcb9('0x99'),_0xbcb9('0x9a')));_0x49a93a=0x0;return _0xe3aca1;}exports['addAccountApplications']=function(_0x57cf0a,_0x4ee125,_0x7ade03){var _0x88bc75;return db[_0xbcb9('0x7a')][_0xbcb9('0x9b')](function(_0x39b488){return db['FaxAccount'][_0xbcb9('0x59')](_0x57cf0a[_0xbcb9('0x5a')],{'transaction':_0x39b488})[_0xbcb9('0x35')](function(_0x269d6f){_0x88bc75=_0x269d6f[_0xbcb9('0x37')]({'plain':!![]});return db[_0xbcb9('0x9c')]['bulkCreate'](createExtensionsReciveFax(_0x88bc75),{'transaction':_0x39b488});});})[_0xbcb9('0x35')](function(){return _0x88bc75;})[_0xbcb9('0x35')](respondWithResult(_0x4ee125,null))[_0xbcb9('0x28')](handleError(_0x4ee125,null));};exports[_0xbcb9('0x9d')]=function(_0x25da2f,_0x14b9c6,_0x413350){var _0x4f7405;return db[_0xbcb9('0x7a')][_0xbcb9('0x9b')](function(_0x32beae){return db[_0xbcb9('0x51')][_0xbcb9('0x60')](_0x25da2f[_0xbcb9('0x5a')],{'where':{'id':_0x25da2f[_0xbcb9('0x5a')]['id']},'transaction':_0x32beae})[_0xbcb9('0x35')](function(_0x2a6414){return db[_0xbcb9('0x9c')][_0xbcb9('0x36')]({'where':{'FaxAccountId':_0x25da2f['body']['id']},'transaction':_0x32beae})[_0xbcb9('0x35')](function(_0x12c6a0){return db[_0xbcb9('0x9c')]['bulkCreate'](createExtensionsReciveFax(_[_0xbcb9('0x6f')](_0x25da2f[_0xbcb9('0x5a')],['tech','key',_0xbcb9('0x9e'),_0xbcb9('0x9f'),_0xbcb9('0xa0'),'ListId'])),{'transaction':_0x32beae});});});})[_0xbcb9('0x35')](function(){return db[_0xbcb9('0x51')]['findById'](_0x25da2f[_0xbcb9('0x5a')]['id']);})[_0xbcb9('0x35')](respondWithResult(_0x14b9c6,null))[_0xbcb9('0x28')](handleError(_0x14b9c6,null));};exports[_0xbcb9('0xa1')]=function(_0x5887b8,_0x373c2b,_0x15b280){var _0x58e123={'raw':!![],'where':{}};var _0xcb754f={};var _0x1ad7bb={'count':0x0,'rows':[]};return db[_0xbcb9('0x51')][_0xbcb9('0x65')]({'where':{'id':_0x5887b8[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x373c2b,null))['then'](function(_0x2b0a80){if(_0x2b0a80){_0xcb754f[_0xbcb9('0x42')]=_[_0xbcb9('0x44')](db[_0xbcb9('0xa2')]['rawAttributes']);_0xcb754f[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x5887b8['query']);_0xcb754f[_0xbcb9('0x45')]=_[_0xbcb9('0x46')](_0xcb754f[_0xbcb9('0x42')],_0xcb754f[_0xbcb9('0x43')]);_0x58e123[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0xcb754f[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x5887b8[_0xbcb9('0x43')]['fields']));_0x58e123[_0xbcb9('0x47')]=_0x58e123['attributes']['length']?_0x58e123[_0xbcb9('0x47')]:_0xcb754f[_0xbcb9('0x42')];if(!_0x5887b8[_0xbcb9('0x43')][_0xbcb9('0x6c')](_0xbcb9('0x66'))){_0x58e123[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x5887b8[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0x58e123['offset']=qs[_0xbcb9('0x30')](_0x5887b8['query'][_0xbcb9('0x30')]);}_0x58e123[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x5887b8[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x58e123[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x5887b8[_0xbcb9('0x43')],_0xcb754f[_0xbcb9('0x45')]));_0x58e123[_0xbcb9('0x4b')][_0xbcb9('0x63')]=_0x2b0a80['id'];if(_0x5887b8['query'][_0xbcb9('0x4d')]){_0x58e123[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x58e123[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0x58e123['attributes'],function(_0xf24309){var _0x591550={};_0x591550[_0xf24309]={'$like':'%'+_0x5887b8[_0xbcb9('0x43')]['filter']+'%'};return _0x591550;})});}if(_0x5887b8[_0xbcb9('0x43')]['$gte']){var _0x351d3c=_0x5887b8[_0xbcb9('0x43')][_0xbcb9('0xa3')]['split'](',');var _0x564e69={};_0x564e69[_0x351d3c[0x0]]={'$gte':moment(_0x351d3c[0x1])['format'](_0xbcb9('0xa4'))};_0x58e123['where']=_[_0xbcb9('0x4e')](_0x58e123[_0xbcb9('0x4b')],_0x564e69);}_0x58e123=_[_0xbcb9('0x4e')]({},_0x58e123,_0x5887b8['options']);return db[_0xbcb9('0xa2')][_0xbcb9('0x2f')]({'where':_0x58e123[_0xbcb9('0x4b')]})[_0xbcb9('0x35')](function(_0x46f0d0){_0x1ad7bb['count']=_0x46f0d0;if(_0x5887b8[_0xbcb9('0x43')]['includeAll']){_0x58e123[_0xbcb9('0x53')]=[{'all':!![]}];}return db[_0xbcb9('0xa2')][_0xbcb9('0x54')](_0x58e123);})[_0xbcb9('0x35')](function(_0x16e3bc){_0x1ad7bb[_0xbcb9('0x55')]=_0x16e3bc;return _0x1ad7bb;});}})['then'](respondWithFilteredResult(_0x373c2b,_0x58e123))[_0xbcb9('0x28')](handleError(_0x373c2b,null));};exports['send']=function(_0x501fec,_0x26976b,_0x1d53fa){var _0x5d81c0,_0x1cfee5={},_0x532d00;if(_0x501fec['body']['to']){_0x532d00=_0x501fec[_0xbcb9('0x5a')]['to'][0x0];}return db[_0xbcb9('0x51')][_0xbcb9('0x58')]({'where':{'id':_0x501fec[_0xbcb9('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xbcb9('0xa5'),'include':[{'model':db[_0xbcb9('0x71')],'as':_0xbcb9('0xa6'),'where':{'fax':_0x532d00},'limit':0x1,'order':[[_0xbcb9('0x9f'),_0xbcb9('0xa7')]]}]}]})[_0xbcb9('0x35')](handleEntityNotFound(_0x26976b,null))[_0xbcb9('0x35')](function(_0x51177a){_0x5d81c0=_0x51177a;if(_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')]&&_0x501fec['body'][_0xbcb9('0xa8')][_0xbcb9('0x49')]){for(var _0x464323=0x0;_0x464323<_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][_0xbcb9('0x49')];_0x464323+=0x1){_0x501fec['body'][_0xbcb9('0xa8')][_0x464323]={'filename':_0x501fec['body'][_0xbcb9('0xa8')][_0x464323][_0xbcb9('0x39')],'id':_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][_0x464323]['id'],'path':path[_0xbcb9('0xa9')](config[_0xbcb9('0xaa')],_0xbcb9('0xab'),_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][_0x464323][_0xbcb9('0xac')])};}}return respondWithRpcPromise(_0xbcb9('0xad'),_0xbcb9('0xad'),{'FaxAccountId':_['isNil'](_0x501fec[_0xbcb9('0x57')]['id'])?undefined:_0x501fec['params']['id'],'path':_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0][_0xbcb9('0x7')])?undefined:_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0][_0xbcb9('0x7')],'fax':_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x5a')]['to'][0x0])?undefined:_0x501fec['body']['to'][0x0]},client9002);})['then'](function(){if(_0x5d81c0){if(_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xaf')])){_0x501fec['body']['from']=util[_0xbcb9('0xb0')](_0xbcb9('0xb1'),_0x5d81c0[_0xbcb9('0x39')],_0x5d81c0[_0xbcb9('0xb2')]);}if(_0x5d81c0['List']){if(_0x5d81c0[_0xbcb9('0xa5')][_0xbcb9('0xa6')][_0xbcb9('0x49')]){return _0x5d81c0[_0xbcb9('0xa5')][_0xbcb9('0xa6')][0x0];}else{return db['CmContact'][_0xbcb9('0x59')](_[_0xbcb9('0x16')](_0x501fec[_0xbcb9('0x5a')],{'firstName':_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'phone':_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'fax':_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'ListId':_0x5d81c0[_0xbcb9('0xb3')]}));}}else{throw new Error(_0xbcb9('0xb4'));}}else{throw new Error(_0xbcb9('0xb5'));}})['then'](function(_0x4553c7){if(_0x4553c7){return db['FaxInteraction'][_0xbcb9('0x58')]({'where':{'ContactId':_0x4553c7['id'],'closed':![],'FaxAccountId':_0x5d81c0['id']}})[_0xbcb9('0x35')](function(_0x3c2f67){if(_0x3c2f67){return[_0x3c2f67,![]];}return db[_0xbcb9('0x6e')][_0xbcb9('0x59')]({'UserId':_0x501fec[_0xbcb9('0x5c')]['id'],'ContactId':_0x4553c7['id'],'FaxAccountId':_0x5d81c0['id'],'fax':_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'firstMsgDirection':_0xbcb9('0xb6'),'Messages':[_[_0xbcb9('0x4e')](_0x501fec[_0xbcb9('0x5a')],{'read':![],'body':_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0]['filename'],'FaxAccountId':_0x5d81c0['id'],'UserId':_0x501fec[_0xbcb9('0x5c')]['id'],'ContactId':_0x4553c7['id'],'AttachmentId':_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xbcb9('0xb7')}]})[_0xbcb9('0x35')](function(_0x520a91){return[_0x520a91,!![]];});});}else{throw new Error(_0xbcb9('0xb8'));}})[_0xbcb9('0xb9')](function(_0xb62fd0,_0x5bb3d5){if(_0x5bb3d5){return _0xb62fd0;}return db[_0xbcb9('0xa2')][_0xbcb9('0x59')]({'direction':'out','read':![],'body':_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0]['filename'],'FaxAccountId':_0x5d81c0['id'],'FaxInteractionId':_0xb62fd0['id'],'UserId':_0x501fec[_0xbcb9('0x5c')]['id'],'ContactId':_0xb62fd0['ContactId'],'AttachmentId':_0x501fec['body'][_0xbcb9('0xa8')][0x0]['id']})['then'](function(_0x24a0c6){_0xb62fd0[_0xbcb9('0xba')]['Messages']=[];_0xb62fd0[_0xbcb9('0xba')][_0xbcb9('0xb7')][_0xbcb9('0x8d')](_0x24a0c6['dataValues']);return _0xb62fd0;});})[_0xbcb9('0x35')](function(_0x14503c){respondWithRpcPromise(_0xbcb9('0xbb'),_0xbcb9('0xbb'),{'FaxAccountId':_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x57')]['id'])?undefined:_0x501fec[_0xbcb9('0x57')]['id'],'path':_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0][_0xbcb9('0x7')])?undefined:_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0]['path'],'fax':_['isNil'](_0x501fec[_0xbcb9('0x5a')]['to'][0x0])?undefined:_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'AttachmentId':_0x501fec[_0xbcb9('0x5a')]['attachments'][0x0]['id']},client9002)[_0xbcb9('0x35')](function(_0x9f649c){logger[_0xbcb9('0x1f')](_0xbcb9('0xbc'),_0x9f649c);})[_0xbcb9('0x28')](function(_0x16ca24){logger['info'](_0xbcb9('0xbc'),_0x16ca24);});return _0x14503c;})[_0xbcb9('0x35')](respondWithResult(_0x26976b,null))['catch'](handleError(_0x26976b,null));};exports[_0xbcb9('0xbd')]=function(_0x599ee3,_0x46cf7a,_0x19944f){return db['FaxAccount'][_0xbcb9('0x58')]({'where':{'id':_0x599ee3[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x46cf7a,null))['then'](function(_0x4ccb5b){if(_0x4ccb5b){return _0x4ccb5b[_0xbcb9('0xbd')](_0x599ee3[_0xbcb9('0x5a')][_0xbcb9('0x69')],_[_0xbcb9('0x6f')](_0x599ee3[_0xbcb9('0x5a')],[_0xbcb9('0x69'),'id'])||{})[_0xbcb9('0xb9')](function(_0x4eea71){for(var _0x3bc21b=0x0;_0x3bc21b<_0x599ee3['body'][_0xbcb9('0x69')][_0xbcb9('0x49')];_0x3bc21b+=0x1){socket[_0xbcb9('0xbe')](_0xbcb9('0xbf'),{'UserId':Number(_0x599ee3[_0xbcb9('0x5a')]['ids'][_0x3bc21b]),'FaxAccountId':Number(_0x599ee3[_0xbcb9('0x57')]['id'])});}return _0x4eea71;});}})[_0xbcb9('0x35')](respondWithResult(_0x46cf7a,null))[_0xbcb9('0x28')](handleError(_0x46cf7a,null));};exports[_0xbcb9('0xc0')]=function(_0x12cb19,_0x50160a,_0x3d98e7){return db['FaxAccount'][_0xbcb9('0x58')]({'where':{'id':_0x12cb19[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x50160a,null))[_0xbcb9('0x35')](function(_0x10c14b){if(_0x10c14b){return _0x10c14b['removeAgents'](_0x12cb19[_0xbcb9('0x43')]['ids'])[_0xbcb9('0x35')](function(){if(_[_0xbcb9('0xc1')](_0x12cb19['query']['ids'])){for(var _0x3d37d8=0x0;_0x3d37d8<_0x12cb19[_0xbcb9('0x43')][_0xbcb9('0x69')]['length'];_0x3d37d8+=0x1){socket[_0xbcb9('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x12cb19['query'][_0xbcb9('0x69')][_0x3d37d8]),'FaxAccountId':Number(_0x12cb19[_0xbcb9('0x57')]['id'])});}}else{socket[_0xbcb9('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x12cb19[_0xbcb9('0x43')]['ids']),'FaxAccountId':Number(_0x12cb19['params']['id'])});}});}})['then'](respondWithStatusCode(_0x50160a,null))[_0xbcb9('0x28')](handleError(_0x50160a,null));};exports[_0xbcb9('0xc2')]=function(_0x21dc75,_0x189e5d,_0x48c281){var _0xebeb79={};var _0x8f469d={};var _0x5b55ec;var _0x61ccbc;return db[_0xbcb9('0x51')][_0xbcb9('0x65')]({'where':{'id':_0x21dc75[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x189e5d,null))[_0xbcb9('0x35')](function(_0x4fb67f){if(_0x4fb67f){_0x5b55ec=_0x4fb67f;_0x8f469d[_0xbcb9('0x42')]=_['keys'](db['User']['rawAttributes']);_0x8f469d[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x21dc75[_0xbcb9('0x43')]);_0x8f469d[_0xbcb9('0x45')]=_['intersection'](_0x8f469d['model'],_0x8f469d['query']);_0xebeb79[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0x8f469d[_0xbcb9('0x42')],qs['fields'](_0x21dc75['query'][_0xbcb9('0x48')]));_0xebeb79[_0xbcb9('0x47')]=_0xebeb79[_0xbcb9('0x47')]['length']?_0xebeb79[_0xbcb9('0x47')]:_0x8f469d['model'];_0xebeb79[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x21dc75[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0xebeb79['where']=qs[_0xbcb9('0x45')](_['pick'](_0x21dc75['query'],_0x8f469d[_0xbcb9('0x45')]));if(_0x21dc75['query']['filter']){_0xebeb79[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0xebeb79[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0xebeb79[_0xbcb9('0x47')],function(_0x544f70){var _0x412f10={};_0x412f10[_0x544f70]={'$like':'%'+_0x21dc75['query'][_0xbcb9('0x4d')]+'%'};return _0x412f10;})});}_0xebeb79=_[_0xbcb9('0x4e')]({},_0xebeb79,_0x21dc75[_0xbcb9('0x50')]);return _0x5b55ec[_0xbcb9('0xc2')](_0xebeb79);}})[_0xbcb9('0x35')](function(_0xbd53c4){if(_0xbd53c4){_0x61ccbc=_0xbd53c4[_0xbcb9('0x49')];if(!_0x21dc75['query'][_0xbcb9('0x6c')](_0xbcb9('0x66'))){_0xebeb79['limit']=qs['limit'](_0x21dc75[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0xebeb79[_0xbcb9('0x30')]=qs['offset'](_0x21dc75[_0xbcb9('0x43')]['offset']);}return _0x5b55ec[_0xbcb9('0xc2')](_0xebeb79);}})['then'](function(_0x1f3855){if(_0x1f3855){return _0x1f3855?{'count':_0x61ccbc,'rows':_0x1f3855}:null;}})[_0xbcb9('0x35')](respondWithResult(_0x189e5d,null))[_0xbcb9('0x28')](handleError(_0x189e5d,null));}; \ No newline at end of file +var _0x9386=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','findAll','rows','show','params','keys','include','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','CmContact','Contact','User','Tags','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','omit','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','out','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','filters'];(function(_0x537a2d,_0x179d7a){var _0x246a27=function(_0x10a8bf){while(--_0x10a8bf){_0x537a2d['push'](_0x537a2d['shift']());}};_0x246a27(++_0x179d7a);}(_0x9386,0x77));var _0x6938=function(_0x647b6,_0x2a0c0e){_0x647b6=_0x647b6-0x0;var _0x146400=_0x9386[_0x647b6];return _0x146400;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6938('0x0'));var zipdir=require(_0x6938('0x1'));var jsonpatch=require(_0x6938('0x2'));var rp=require(_0x6938('0x3'));var moment=require(_0x6938('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6938('0x5'));var path=require(_0x6938('0x6'));var sox=require(_0x6938('0x7'));var csv=require(_0x6938('0x8'));var ejs=require(_0x6938('0x9'));var fs=require('fs');var fs_extra=require(_0x6938('0xa'));var _=require(_0x6938('0xb'));var squel=require(_0x6938('0xc'));var crypto=require(_0x6938('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6938('0x8'));var querystring=require(_0x6938('0xe'));var Papa=require(_0x6938('0xf'));var Redis=require('ioredis');var authService=require(_0x6938('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6938('0x11'));var hardwareService=require(_0x6938('0x12'));var logger=require('../../config/logger')(_0x6938('0x13'));var utils=require(_0x6938('0x14'));var config=require(_0x6938('0x15'));var licenseUtil=require(_0x6938('0x16'));var db=require(_0x6938('0x17'))['db'];config[_0x6938('0x18')]=_['defaults'](config[_0x6938('0x18')],{'host':_0x6938('0x19'),'port':0x18eb});var socket=require(_0x6938('0x1a'))(new Redis(config[_0x6938('0x18')]));require(_0x6938('0x1b'))['register'](socket);var jayson=require(_0x6938('0x1c'));var client=jayson[_0x6938('0x1d')][_0x6938('0x1e')]({'port':0x232c});var client9002=jayson[_0x6938('0x1d')][_0x6938('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x42063d,_0x55c7a5,_0x596527,_0x430039){return new BPromise(function(_0x2cd83e,_0x498a26){var _0x46c15a=_0x430039||client;return _0x46c15a['request'](_0x42063d,_0x596527)[_0x6938('0x1f')](function(_0x1446da){logger[_0x6938('0x20')]('FaxAccount,\x20%s,\x20%s',_0x55c7a5,'request\x20sent');logger[_0x6938('0x21')](_0x6938('0x22'),_0x55c7a5,_0x6938('0x23'),JSON[_0x6938('0x24')](_0x1446da));if(_0x1446da[_0x6938('0x25')]){if(_0x1446da[_0x6938('0x25')][_0x6938('0x26')]===0x1f4){logger[_0x6938('0x25')](_0x6938('0x27'),_0x55c7a5,_0x1446da[_0x6938('0x25')][_0x6938('0x28')]);return _0x498a26(_0x1446da[_0x6938('0x25')][_0x6938('0x28')]);}logger[_0x6938('0x25')](_0x6938('0x27'),_0x55c7a5,_0x1446da[_0x6938('0x25')][_0x6938('0x28')]);return _0x2cd83e(_0x1446da['error']['message']);}else{logger[_0x6938('0x20')](_0x6938('0x27'),_0x55c7a5,_0x6938('0x23'));_0x2cd83e(_0x1446da[_0x6938('0x29')][_0x6938('0x28')]);}})['catch'](function(_0x15c215){logger[_0x6938('0x25')]('FaxAccount,\x20%s,\x20%s',_0x55c7a5,_0x15c215);_0x498a26(_0x15c215);});});}function respondWithStatusCode(_0x2c0387,_0x427df3){_0x427df3=_0x427df3||0xcc;return function(_0x286464){if(_0x286464){return _0x2c0387[_0x6938('0x2a')](_0x427df3);}return _0x2c0387[_0x6938('0x2b')](_0x427df3)[_0x6938('0x2c')]();};}function respondWithResult(_0x3ec900,_0x4897d6){_0x4897d6=_0x4897d6||0xc8;return function(_0x978a99){if(_0x978a99){return _0x3ec900['status'](_0x4897d6)[_0x6938('0x2d')](_0x978a99);}};}function respondWithFilteredResult(_0x20c68c,_0x37dd41){return function(_0x35f41c){if(_0x35f41c){var _0xad8965=typeof _0x37dd41[_0x6938('0x2e')]==='undefined'&&typeof _0x37dd41[_0x6938('0x2f')]===_0x6938('0x30');var _0xa9cf3a=_0x35f41c[_0x6938('0x31')];var _0x18c0c4=_0xad8965?0x0:_0x37dd41['offset'];var _0x32b8ee=_0xad8965?_0x35f41c[_0x6938('0x31')]:_0x37dd41[_0x6938('0x2e')]+_0x37dd41['limit'];var _0x1d692c;if(_0x32b8ee>=_0xa9cf3a){_0x32b8ee=_0xa9cf3a;_0x1d692c=0xc8;}else{_0x1d692c=0xce;}_0x20c68c['status'](_0x1d692c);return _0x20c68c[_0x6938('0x32')](_0x6938('0x33'),_0x18c0c4+'-'+_0x32b8ee+'/'+_0xa9cf3a)['json'](_0x35f41c);}return null;};}function patchUpdates(_0x24ee44){return function(_0x3c89ef){try{jsonpatch[_0x6938('0x34')](_0x3c89ef,_0x24ee44,!![]);}catch(_0x110cad){return BPromise[_0x6938('0x35')](_0x110cad);}return _0x3c89ef[_0x6938('0x36')]();};}function saveUpdates(_0x35a418,_0x10dd59){return function(_0x564ff9){if(_0x564ff9){return _0x564ff9[_0x6938('0x37')](_0x35a418)['then'](function(_0x34f4b1){return _0x34f4b1;});}return null;};}function removeEntity(_0x195599,_0x2511a5){return function(_0x4d310e){if(_0x4d310e){return _0x4d310e[_0x6938('0x38')]()['then'](function(){var _0x1e77a1=_0x4d310e['get']({'plain':!![]});var _0x392c9e=_0x6938('0x39');return db[_0x6938('0x3a')][_0x6938('0x38')]({'where':{'type':_0x392c9e,'resourceId':_0x1e77a1['id']}})['then'](function(){return _0x4d310e;});})[_0x6938('0x1f')](function(){_0x195599[_0x6938('0x2b')](0xcc)[_0x6938('0x2c')]();});}};}function handleEntityNotFound(_0x11f24c,_0x5aebaf){return function(_0x222128){if(!_0x222128){_0x11f24c[_0x6938('0x2a')](0x194);}return _0x222128;};}function handleError(_0xeb7f8c,_0x2001e8){_0x2001e8=_0x2001e8||0x1f4;return function(_0x3acf66){logger['error'](_0x3acf66[_0x6938('0x3b')]);if(_0x3acf66['name']){delete _0x3acf66[_0x6938('0x3c')];}_0xeb7f8c[_0x6938('0x2b')](_0x2001e8)[_0x6938('0x3d')](_0x3acf66);};}exports['index']=function(_0x16d199,_0x6d52a3){var _0x3205c3={'include':[{'model':db[_0x6938('0x3e')],'as':_0x6938('0x3f')}]},_0x1e50de={},_0x23935d={'count':0x0,'rows':[]};var _0xfb4298=_['map'](db[_0x6938('0x40')][_0x6938('0x41')],function(_0x5cf7fe){return{'name':_0x5cf7fe[_0x6938('0x42')],'type':_0x5cf7fe[_0x6938('0x43')][_0x6938('0x44')]};});_0x1e50de[_0x6938('0x45')]=_[_0x6938('0x46')](_0xfb4298,_0x6938('0x3c'));_0x1e50de[_0x6938('0x47')]=_['keys'](_0x16d199['query']);_0x1e50de[_0x6938('0x48')]=_[_0x6938('0x49')](_0x1e50de[_0x6938('0x45')],_0x1e50de[_0x6938('0x47')]);_0x3205c3[_0x6938('0x4a')]=_[_0x6938('0x49')](_0x1e50de[_0x6938('0x45')],qs[_0x6938('0x4b')](_0x16d199[_0x6938('0x47')]['fields']));_0x3205c3[_0x6938('0x4a')]=_0x3205c3['attributes'][_0x6938('0x4c')]?_0x3205c3[_0x6938('0x4a')]:_0x1e50de[_0x6938('0x45')];if(!_0x16d199['query'][_0x6938('0x4d')](_0x6938('0x4e'))){_0x3205c3[_0x6938('0x2f')]=qs[_0x6938('0x2f')](_0x16d199[_0x6938('0x47')][_0x6938('0x2f')]);_0x3205c3[_0x6938('0x2e')]=qs['offset'](_0x16d199['query'][_0x6938('0x2e')]);}_0x3205c3[_0x6938('0x4f')]=qs[_0x6938('0x50')](_0x16d199[_0x6938('0x47')][_0x6938('0x50')]);_0x3205c3['where']=qs['filters'](_[_0x6938('0x51')](_0x16d199[_0x6938('0x47')],_0x1e50de[_0x6938('0x48')]),_0xfb4298);if(_0x16d199[_0x6938('0x47')][_0x6938('0x52')]){_0x3205c3[_0x6938('0x53')]=_['merge'](_0x3205c3[_0x6938('0x53')],{'$or':_['map'](_0xfb4298,function(_0x19cc76){if(_0x19cc76[_0x6938('0x43')]!=='VIRTUAL'){var _0x1a7ac9={};_0x1a7ac9[_0x19cc76['name']]={'$like':'%'+_0x16d199[_0x6938('0x47')][_0x6938('0x52')]+'%'};return _0x1a7ac9;}})});}_0x3205c3=_['merge']({},_0x3205c3,_0x16d199[_0x6938('0x54')]);var _0x467918={'where':_0x3205c3[_0x6938('0x53')]};return db[_0x6938('0x40')][_0x6938('0x31')](_0x467918)[_0x6938('0x1f')](function(_0x24af9d){_0x23935d[_0x6938('0x31')]=_0x24af9d;if(_0x16d199['query'][_0x6938('0x55')]){_0x3205c3['include']=[{'all':!![]}];}return db[_0x6938('0x40')][_0x6938('0x56')](_0x3205c3);})[_0x6938('0x1f')](function(_0x1b154e){_0x23935d[_0x6938('0x57')]=_0x1b154e;return _0x23935d;})[_0x6938('0x1f')](respondWithFilteredResult(_0x6d52a3,_0x3205c3))['catch'](handleError(_0x6d52a3,null));};exports[_0x6938('0x58')]=function(_0x2e8ef8,_0x36b179){var _0x2f3fb5={'raw':![],'where':{'id':_0x2e8ef8[_0x6938('0x59')]['id']},'include':[{'model':db[_0x6938('0x3e')],'as':_0x6938('0x3f')}]},_0xad2d2f={};_0xad2d2f[_0x6938('0x45')]=_[_0x6938('0x5a')](db[_0x6938('0x40')][_0x6938('0x41')]);_0xad2d2f[_0x6938('0x47')]=_[_0x6938('0x5a')](_0x2e8ef8[_0x6938('0x47')]);_0xad2d2f['filters']=_['intersection'](_0xad2d2f['model'],_0xad2d2f[_0x6938('0x47')]);_0x2f3fb5[_0x6938('0x4a')]=_[_0x6938('0x49')](_0xad2d2f['model'],qs[_0x6938('0x4b')](_0x2e8ef8[_0x6938('0x47')][_0x6938('0x4b')]));_0x2f3fb5[_0x6938('0x4a')]=_0x2f3fb5['attributes'][_0x6938('0x4c')]?_0x2f3fb5[_0x6938('0x4a')]:_0xad2d2f[_0x6938('0x45')];if(_0x2e8ef8[_0x6938('0x47')][_0x6938('0x55')]){_0x2f3fb5[_0x6938('0x5b')]=[{'all':!![]}];}_0x2f3fb5=_[_0x6938('0x5c')]({},_0x2f3fb5,_0x2e8ef8[_0x6938('0x54')]);return db['FaxAccount'][_0x6938('0x5d')](_0x2f3fb5)[_0x6938('0x1f')](handleEntityNotFound(_0x36b179,null))['then'](respondWithResult(_0x36b179,null))['catch'](handleError(_0x36b179,null));};exports['create']=function(_0x4d4d6d,_0x2a0951){return db['FaxAccount'][_0x6938('0x5e')](_0x4d4d6d['body'],{})['then'](function(_0xc86fcb){var _0x505a6a=_0x4d4d6d[_0x6938('0x5f')][_0x6938('0x60')]({'plain':!![]});if(!_0x505a6a)throw new Error(_0x6938('0x61'));if(_0x505a6a['role']===_0x6938('0x5f')){var _0xd513cb=_0xc86fcb[_0x6938('0x60')]({'plain':!![]});var _0x582448=_0x6938('0x39');return db['UserProfileSection'][_0x6938('0x5d')]({'where':{'name':_0x582448,'userProfileId':_0x505a6a[_0x6938('0x62')]},'raw':!![]})['then'](function(_0x4c1828){if(_0x4c1828&&_0x4c1828[_0x6938('0x63')]===0x0){return db[_0x6938('0x3a')][_0x6938('0x5e')]({'name':_0xd513cb[_0x6938('0x3c')],'resourceId':_0xd513cb['id'],'type':_0x4c1828['name'],'sectionId':_0x4c1828['id']},{})[_0x6938('0x1f')](function(){return _0xc86fcb;});}else{return _0xc86fcb;}})[_0x6938('0x64')](function(_0x596070){logger['error'](_0x6938('0x65'),_0x596070);throw _0x596070;});}return _0xc86fcb;})[_0x6938('0x1f')](respondWithResult(_0x2a0951,0xc9))[_0x6938('0x64')](handleError(_0x2a0951,null));};exports['update']=function(_0x2e5a3a,_0x27cad2){if(_0x2e5a3a[_0x6938('0x66')]['id']){delete _0x2e5a3a['body']['id'];}return db['FaxAccount'][_0x6938('0x5d')]({'where':{'id':_0x2e5a3a[_0x6938('0x59')]['id']},'include':[{'model':db[_0x6938('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x6938('0x1f')](handleEntityNotFound(_0x27cad2,null))[_0x6938('0x1f')](saveUpdates(_0x2e5a3a[_0x6938('0x66')],null))['then'](respondWithResult(_0x27cad2,null))[_0x6938('0x64')](handleError(_0x27cad2,null));};exports[_0x6938('0x38')]=function(_0x3ab810,_0x49b521){return db[_0x6938('0x40')][_0x6938('0x5d')]({'where':{'id':_0x3ab810[_0x6938('0x59')]['id']}})['then'](handleEntityNotFound(_0x49b521,null))[_0x6938('0x1f')](removeEntity(_0x49b521,null))[_0x6938('0x64')](handleError(_0x49b521,null));};exports[_0x6938('0x67')]=function(_0x496000,_0x2d362d){return db[_0x6938('0x40')][_0x6938('0x67')]()['then'](respondWithResult(_0x2d362d,null))[_0x6938('0x64')](handleError(_0x2d362d,null));};exports[_0x6938('0x68')]=function(_0x4250b5,_0xe1320,_0x2e7cab){if(_0x4250b5['body']['id']){delete _0x4250b5[_0x6938('0x66')]['id'];}return db[_0x6938('0x40')][_0x6938('0x5d')]({'where':{'id':_0x4250b5[_0x6938('0x59')]['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0xe1320,null))[_0x6938('0x1f')](function(_0x29b569){if(_0x29b569){_0x4250b5[_0x6938('0x66')][_0x6938('0x69')]=_0x29b569['id'];return db['Disposition'][_0x6938('0x5e')](_0x4250b5[_0x6938('0x66')]);}})['then'](respondWithResult(_0xe1320,null))[_0x6938('0x64')](handleError(_0xe1320,null));};exports[_0x6938('0x6a')]=function(_0x26683a,_0x1c1713,_0x358c49){var _0x442da8={'raw':![],'where':{}};var _0x1fe9fa={};var _0x5c95c5={'count':0x0,'rows':[]};return db[_0x6938('0x40')][_0x6938('0x6b')]({'where':{'id':_0x26683a['params']['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0x1c1713,null))[_0x6938('0x1f')](function(_0x114e81){if(_0x114e81){_0x1fe9fa[_0x6938('0x45')]=_[_0x6938('0x5a')](db[_0x6938('0x6c')][_0x6938('0x41')]);_0x1fe9fa[_0x6938('0x47')]=_[_0x6938('0x5a')](_0x26683a[_0x6938('0x47')]);_0x1fe9fa[_0x6938('0x48')]=_['intersection'](_0x1fe9fa[_0x6938('0x45')],_0x1fe9fa['query']);_0x442da8['attributes']=_['intersection'](_0x1fe9fa['model'],qs[_0x6938('0x4b')](_0x26683a[_0x6938('0x47')][_0x6938('0x4b')]));_0x442da8[_0x6938('0x4a')]=_0x442da8[_0x6938('0x4a')]['length']?_0x442da8[_0x6938('0x4a')]:_0x1fe9fa['model'];if(!_0x26683a[_0x6938('0x47')][_0x6938('0x4d')](_0x6938('0x4e'))){_0x442da8[_0x6938('0x2f')]=qs[_0x6938('0x2f')](_0x26683a['query'][_0x6938('0x2f')]);_0x442da8[_0x6938('0x2e')]=qs[_0x6938('0x2e')](_0x26683a[_0x6938('0x47')][_0x6938('0x2e')]);}_0x442da8[_0x6938('0x4f')]=qs[_0x6938('0x50')](_0x26683a['query']['sort']);_0x442da8[_0x6938('0x53')]=qs[_0x6938('0x48')](_[_0x6938('0x51')](_0x26683a[_0x6938('0x47')],_0x1fe9fa[_0x6938('0x48')]));_0x442da8['where']['FaxAccountId']=_0x114e81['id'];if(_0x26683a[_0x6938('0x47')]['filter']){_0x442da8['where']=_[_0x6938('0x5c')](_0x442da8[_0x6938('0x53')],{'$or':_['map'](_0x442da8[_0x6938('0x4a')],function(_0x565ff9){var _0x67f7d1={};_0x67f7d1[_0x565ff9]={'$like':'%'+_0x26683a['query'][_0x6938('0x52')]+'%'};return _0x67f7d1;})});}_0x442da8=_['merge']({},_0x442da8,_0x26683a[_0x6938('0x54')]);return db[_0x6938('0x6c')][_0x6938('0x31')]({'where':_0x442da8[_0x6938('0x53')]})[_0x6938('0x1f')](function(_0x348770){_0x5c95c5[_0x6938('0x31')]=_0x348770;if(_0x26683a[_0x6938('0x47')]['includeAll']){_0x442da8[_0x6938('0x5b')]=[{'all':!![]}];}return db[_0x6938('0x6c')][_0x6938('0x56')](_0x442da8);})['then'](function(_0x3dded1){_0x5c95c5[_0x6938('0x57')]=_0x3dded1;return _0x5c95c5;});}})[_0x6938('0x1f')](respondWithFilteredResult(_0x1c1713,_0x442da8))[_0x6938('0x64')](handleError(_0x1c1713,null));};exports[_0x6938('0x6d')]=function(_0x2423a1,_0x397ea3,_0x360d5e){return db[_0x6938('0x40')][_0x6938('0x5d')]({'where':{'id':_0x2423a1[_0x6938('0x59')]['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0x397ea3,null))['then'](function(_0x275d32){if(_0x275d32){return _0x275d32[_0x6938('0x6d')](_0x2423a1[_0x6938('0x47')][_0x6938('0x6e')]);}})['then'](respondWithStatusCode(_0x397ea3,null))[_0x6938('0x64')](handleError(_0x397ea3,null));};exports['addAnswer']=function(_0xac5bad,_0x3af842,_0xe69c09){if(_0xac5bad[_0x6938('0x66')]['id']){delete _0xac5bad[_0x6938('0x66')]['id'];}return db[_0x6938('0x40')][_0x6938('0x5d')]({'where':{'id':_0xac5bad['params']['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0x3af842,null))[_0x6938('0x1f')](function(_0x3f897b){if(_0x3f897b){_0xac5bad[_0x6938('0x66')][_0x6938('0x69')]=_0x3f897b['id'];return db['CannedAnswer'][_0x6938('0x5e')](_0xac5bad[_0x6938('0x66')]);}})['then'](respondWithResult(_0x3af842,null))[_0x6938('0x64')](handleError(_0x3af842,null));};exports['getAnswers']=function(_0x12f20e,_0x16429c,_0x4abe90){var _0x5c0e07={'raw':![],'where':{}};var _0x7608c9={};var _0x5ed3a4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x12f20e[_0x6938('0x59')]['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0x16429c,null))[_0x6938('0x1f')](function(_0x2bbf9a){if(_0x2bbf9a){_0x7608c9[_0x6938('0x45')]=_[_0x6938('0x5a')](db[_0x6938('0x6f')][_0x6938('0x41')]);_0x7608c9[_0x6938('0x47')]=_[_0x6938('0x5a')](_0x12f20e[_0x6938('0x47')]);_0x7608c9[_0x6938('0x48')]=_['intersection'](_0x7608c9['model'],_0x7608c9[_0x6938('0x47')]);_0x5c0e07[_0x6938('0x4a')]=_[_0x6938('0x49')](_0x7608c9[_0x6938('0x45')],qs['fields'](_0x12f20e[_0x6938('0x47')][_0x6938('0x4b')]));_0x5c0e07[_0x6938('0x4a')]=_0x5c0e07[_0x6938('0x4a')]['length']?_0x5c0e07[_0x6938('0x4a')]:_0x7608c9[_0x6938('0x45')];if(!_0x12f20e[_0x6938('0x47')][_0x6938('0x4d')]('nolimit')){_0x5c0e07[_0x6938('0x2f')]=qs[_0x6938('0x2f')](_0x12f20e['query'][_0x6938('0x2f')]);_0x5c0e07['offset']=qs[_0x6938('0x2e')](_0x12f20e[_0x6938('0x47')][_0x6938('0x2e')]);}_0x5c0e07[_0x6938('0x4f')]=qs[_0x6938('0x50')](_0x12f20e['query'][_0x6938('0x50')]);_0x5c0e07[_0x6938('0x53')]=qs[_0x6938('0x48')](_['pick'](_0x12f20e[_0x6938('0x47')],_0x7608c9[_0x6938('0x48')]));_0x5c0e07[_0x6938('0x53')][_0x6938('0x69')]=_0x2bbf9a['id'];if(_0x12f20e[_0x6938('0x47')][_0x6938('0x52')]){_0x5c0e07[_0x6938('0x53')]=_[_0x6938('0x5c')](_0x5c0e07[_0x6938('0x53')],{'$or':_[_0x6938('0x46')](_0x5c0e07[_0x6938('0x4a')],function(_0x55e2c5){var _0x5c5bb3={};_0x5c5bb3[_0x55e2c5]={'$like':'%'+_0x12f20e[_0x6938('0x47')][_0x6938('0x52')]+'%'};return _0x5c5bb3;})});}_0x5c0e07=_[_0x6938('0x5c')]({},_0x5c0e07,_0x12f20e[_0x6938('0x54')]);return db[_0x6938('0x6f')][_0x6938('0x31')]({'where':_0x5c0e07[_0x6938('0x53')]})[_0x6938('0x1f')](function(_0x32552d){_0x5ed3a4[_0x6938('0x31')]=_0x32552d;if(_0x12f20e[_0x6938('0x47')]['includeAll']){_0x5c0e07[_0x6938('0x5b')]=[{'all':!![]}];}return db[_0x6938('0x6f')]['findAll'](_0x5c0e07);})[_0x6938('0x1f')](function(_0x11b4ff){_0x5ed3a4[_0x6938('0x57')]=_0x11b4ff;return _0x5ed3a4;});}})[_0x6938('0x1f')](respondWithFilteredResult(_0x16429c,_0x5c0e07))[_0x6938('0x64')](handleError(_0x16429c,null));};exports[_0x6938('0x70')]=function(_0x337e25,_0x5a2c3c,_0x598859){return db[_0x6938('0x40')][_0x6938('0x5d')]({'where':{'id':_0x337e25[_0x6938('0x59')]['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0x5a2c3c,null))[_0x6938('0x1f')](function(_0xc1ed1f){if(_0xc1ed1f){return _0xc1ed1f[_0x6938('0x70')](_0x337e25[_0x6938('0x47')]['ids']);}})[_0x6938('0x1f')](respondWithStatusCode(_0x5a2c3c,null))[_0x6938('0x64')](handleError(_0x5a2c3c,null));};exports[_0x6938('0x71')]=function(_0x523265,_0xec4bed,_0x49d446){return db['FaxInteraction'][_0x6938('0x5d')]({'where':{'id':_0x523265[_0x6938('0x59')]['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0xec4bed,null))[_0x6938('0x1f')](function(_0x2ab02b){if(_0x2ab02b){return _0x2ab02b[_0x6938('0x71')](_0x523265['body'][_0x6938('0x6e')],_['omit'](_0x523265[_0x6938('0x66')],[_0x6938('0x6e'),'id'])||{});}})[_0x6938('0x1f')](respondWithResult(_0xec4bed,null))[_0x6938('0x64')](handleError(_0xec4bed,null));};exports['getInteractions']=function(_0x1b82ca,_0x4ed224,_0x48fd66){var _0x1f589d={'raw':![],'where':{}};var _0x1d34d6={};var _0x48dadb={'count':0x0,'rows':[]};return db[_0x6938('0x40')][_0x6938('0x6b')]({'where':{'id':_0x1b82ca['params']['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0x4ed224,null))[_0x6938('0x1f')](function(_0x3539ce){if(_0x3539ce){_0x1d34d6['model']=_[_0x6938('0x5a')](db[_0x6938('0x72')][_0x6938('0x41')]);_0x1d34d6[_0x6938('0x47')]=_[_0x6938('0x5a')](_0x1b82ca['query']);_0x1d34d6[_0x6938('0x48')]=_['intersection'](_0x1d34d6[_0x6938('0x45')],_0x1d34d6[_0x6938('0x47')]);_0x1f589d[_0x6938('0x4a')]=_[_0x6938('0x49')](_0x1d34d6['model'],qs['fields'](_0x1b82ca['query'][_0x6938('0x4b')]));_0x1f589d[_0x6938('0x4a')]=_0x1f589d[_0x6938('0x4a')]['length']?_0x1f589d['attributes']:_0x1d34d6[_0x6938('0x45')];if(!_0x1b82ca[_0x6938('0x47')][_0x6938('0x4d')](_0x6938('0x4e'))){_0x1f589d[_0x6938('0x2f')]=qs[_0x6938('0x2f')](_0x1b82ca[_0x6938('0x47')][_0x6938('0x2f')]);_0x1f589d[_0x6938('0x2e')]=qs[_0x6938('0x2e')](_0x1b82ca[_0x6938('0x47')][_0x6938('0x2e')]);}_0x1f589d[_0x6938('0x4f')]=qs[_0x6938('0x50')](_0x1b82ca[_0x6938('0x47')]['sort']);_0x1f589d[_0x6938('0x53')]=qs['filters'](_[_0x6938('0x51')](_0x1b82ca[_0x6938('0x47')],_0x1d34d6[_0x6938('0x48')]));_0x1f589d[_0x6938('0x53')][_0x6938('0x69')]=_0x3539ce['id'];if(_0x1b82ca[_0x6938('0x47')]['filter']){_0x1f589d['where']=_[_0x6938('0x5c')](_0x1f589d[_0x6938('0x53')],{'$or':_[_0x6938('0x46')](_0x1f589d[_0x6938('0x4a')],function(_0x3fae81){var _0x5c2b03={};_0x5c2b03[_0x3fae81]={'$like':'%'+_0x1b82ca[_0x6938('0x47')][_0x6938('0x52')]+'%'};return _0x5c2b03;})});}_0x1f589d=_[_0x6938('0x5c')]({},_0x1f589d,_0x1b82ca[_0x6938('0x54')]);return db['FaxInteraction'][_0x6938('0x31')]({'where':_0x1f589d[_0x6938('0x53')]})['then'](function(_0x57b1d6){_0x48dadb[_0x6938('0x31')]=_0x57b1d6;if(_0x1b82ca[_0x6938('0x47')]['includeAll']){_0x1f589d['include']=[{'model':db[_0x6938('0x73')],'as':_0x6938('0x74'),'required':![]},{'model':db[_0x6938('0x75')],'as':'Owner','attributes':[_0x6938('0x3c'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x6938('0x76'),'attributes':['id','name','color'],'where':_0x1b82ca[_0x6938('0x47')][_0x6938('0x77')]?{'id':_0x1b82ca[_0x6938('0x47')][_0x6938('0x77')]}:undefined,'required':_0x1b82ca[_0x6938('0x47')][_0x6938('0x77')]?!![]:![]}];}return db[_0x6938('0x72')][_0x6938('0x56')](_0x1f589d);})[_0x6938('0x1f')](function(_0x21b29a){_0x48dadb[_0x6938('0x57')]=_0x21b29a;return _0x48dadb;});}})[_0x6938('0x1f')](respondWithFilteredResult(_0x4ed224,_0x1f589d))['catch'](handleError(_0x4ed224,null));};exports[_0x6938('0x78')]=function(_0x1864fd,_0xce505a){var _0x451b93=_0x1864fd[_0x6938('0x59')]['id'];var _0x1ba944=_0x1864fd[_0x6938('0x66')];var _0xeb7e77=0xc8;var _0x3c3c4b=null;return db['sequelize'][_0x6938('0x79')]({'isolationLevel':db[_0x6938('0x7a')]['Transaction'][_0x6938('0x7b')]['READ_COMMITTED']},function(_0xa61c1e){return db[_0x6938('0x40')]['findOne']({'where':{'id':_0x451b93},'transaction':_0xa61c1e})[_0x6938('0x1f')](function(_0x1e45f5){if(_0x1e45f5){return db[_0x6938('0x7c')][_0x6938('0x38')]({'where':{'FaxAccountId':_0x451b93},'transaction':_0xa61c1e})[_0x6938('0x1f')](function(){var _0x3aa5f6=_[_0x6938('0x46')](_0x1ba944,function(_0x579635){_0x579635[_0x6938('0x69')]=_0x451b93;return _0x579635;});return db[_0x6938('0x7c')][_0x6938('0x7d')](_0x3aa5f6,{'transaction':_0xa61c1e});});}else{_0xeb7e77=0x194;_0x3c3c4b=[];}});})[_0x6938('0x1f')](function(){if(_0xeb7e77!==0x194){return db[_0x6938('0x7c')][_0x6938('0x7e')]({'where':{'FaxAccountId':_0x451b93},'order':_0x6938('0x7f')})['then'](function(_0x5a8028){_0x3c3c4b=_0x5a8028;});}})[_0x6938('0x64')](function(_0x59a9ed){_0xeb7e77=0x1f4;logger[_0x6938('0x25')](_0x59a9ed[_0x6938('0x3b')]);if(_0x59a9ed[_0x6938('0x3c')]){delete _0x59a9ed[_0x6938('0x3c')];}_0x3c3c4b=_0x59a9ed;})[_0x6938('0x80')](function(){if(_0x3c3c4b===null){_0xce505a[_0x6938('0x2a')](_0xeb7e77);}else{if(_0xeb7e77===0x1f4){_0xce505a[_0x6938('0x2b')](_0xeb7e77)[_0x6938('0x3d')](_0x3c3c4b);}else{_0xce505a[_0x6938('0x2b')](_0xeb7e77)[_0x6938('0x2d')](_0x3c3c4b);}}});};exports[_0x6938('0x81')]=function(_0x39f816,_0x2d90b2,_0xdfa88){var _0x2cb6b5={};var _0x3664d0={};var _0x13ff4e;var _0x217b9c;return db['FaxAccount'][_0x6938('0x6b')]({'where':{'id':_0x39f816[_0x6938('0x59')]['id']}})['then'](handleEntityNotFound(_0x2d90b2,null))[_0x6938('0x1f')](function(_0x50196c){if(_0x50196c){_0x13ff4e=_0x50196c;_0x3664d0['model']=_[_0x6938('0x5a')](db[_0x6938('0x7c')][_0x6938('0x41')]);_0x3664d0[_0x6938('0x47')]=_[_0x6938('0x5a')](_0x39f816[_0x6938('0x47')]);_0x3664d0[_0x6938('0x48')]=_[_0x6938('0x49')](_0x3664d0['model'],_0x3664d0['query']);_0x2cb6b5['attributes']=_['intersection'](_0x3664d0['model'],qs[_0x6938('0x4b')](_0x39f816[_0x6938('0x47')][_0x6938('0x4b')]));_0x2cb6b5[_0x6938('0x4a')]=_0x2cb6b5[_0x6938('0x4a')][_0x6938('0x4c')]?_0x2cb6b5[_0x6938('0x4a')]:_0x3664d0['model'];_0x2cb6b5['order']=qs[_0x6938('0x50')](_0x39f816[_0x6938('0x47')]['sort']);_0x2cb6b5[_0x6938('0x53')]=qs[_0x6938('0x48')](_[_0x6938('0x51')](_0x39f816[_0x6938('0x47')],_0x3664d0[_0x6938('0x48')]));if(_0x39f816['query'][_0x6938('0x52')]){_0x2cb6b5[_0x6938('0x53')]=_[_0x6938('0x5c')](_0x2cb6b5['where'],{'$or':_[_0x6938('0x46')](_0x2cb6b5[_0x6938('0x4a')],function(_0x635562){var _0x185ead={};_0x185ead[_0x635562]={'$like':'%'+_0x39f816[_0x6938('0x47')][_0x6938('0x52')]+'%'};return _0x185ead;})});}_0x2cb6b5=_['merge']({},_0x2cb6b5,_0x39f816[_0x6938('0x54')]);return _0x13ff4e['getApplications'](_0x2cb6b5);}})['then'](function(_0x319de7){if(_0x319de7){_0x217b9c=_0x319de7[_0x6938('0x4c')];if(!_0x39f816[_0x6938('0x47')][_0x6938('0x4d')]('nolimit')){_0x2cb6b5[_0x6938('0x2f')]=qs['limit'](_0x39f816[_0x6938('0x47')][_0x6938('0x2f')]);_0x2cb6b5[_0x6938('0x2e')]=qs[_0x6938('0x2e')](_0x39f816['query'][_0x6938('0x2e')]);}return _0x13ff4e[_0x6938('0x81')](_0x2cb6b5);}})[_0x6938('0x1f')](function(_0x1714fc){if(_0x1714fc){return _0x1714fc?{'count':_0x217b9c,'rows':_0x1714fc}:null;}})[_0x6938('0x1f')](respondWithResult(_0x2d90b2,null))[_0x6938('0x64')](handleError(_0x2d90b2,null));};function Extension(_0xdf2ae0,_0x2cbfa5,_0x356642,_0x3a5627){this[_0x6938('0x82')]=_0x6938('0x83');this[_0x6938('0x84')]=_0xdf2ae0[_0x6938('0x85')];this[_0x6938('0x86')]=_0x3a5627;this[_0x6938('0x43')]=_0x6938('0x87');this['description']=_0x6938('0x88');this[_0x6938('0x69')]=_0xdf2ae0['id'];this[_0x6938('0x7f')]=_0x2cbfa5;this[_0x6938('0x89')]=_0x356642;}function createExtensionsReciveFax(_0x1bbad0){var _0x5a47ad=0x1;var _0x8cd00b=[];_0x8cd00b[_0x6938('0x8a')](new Extension(_0x1bbad0,_0x5a47ad,'',_0x6938('0x8b')));_0x5a47ad+=0x1;_0x8cd00b[_0x6938('0x8a')](new Extension(_0x1bbad0,_0x5a47ad,_0x6938('0x8c'),_0x6938('0x8d')));_0x5a47ad+=0x1;for(var _0x324ae in _0x1bbad0){if(_0x1bbad0['hasOwnProperty'](_0x324ae)&&(_0x324ae===_0x6938('0x8e')||_0x324ae===_0x6938('0x85')||_0x324ae==='gateway'||_0x324ae===_0x6938('0x8f')||_0x324ae===_0x6938('0x90')||_0x324ae===_0x6938('0x91')||_0x324ae===_0x6938('0x92')||_0x324ae===_0x6938('0x93')||_0x324ae===_0x6938('0x94'))){_0x8cd00b[_0x6938('0x8a')](new Extension(_0x1bbad0,_0x5a47ad,_0x6938('0x95')+_0x324ae+')='+_0x1bbad0[_0x324ae],_0x6938('0x8d')));_0x5a47ad+=0x1;}}_0x8cd00b[_0x6938('0x8a')](new Extension(_0x1bbad0,_0x5a47ad,'6',_0x6938('0x96')));_0x5a47ad+=0x1;_0x8cd00b[_0x6938('0x8a')](new Extension(_0x1bbad0,_0x5a47ad,_0x6938('0x97'),_0x6938('0x98')));_0x5a47ad=0x0;return _0x8cd00b;}exports['addAccountApplications']=function(_0x3363c0,_0x5b77ec,_0x3e8d7d){var _0x206b5d;return db[_0x6938('0x7a')]['transaction'](function(_0x34e822){return db[_0x6938('0x40')][_0x6938('0x5e')](_0x3363c0['body'],{'transaction':_0x34e822})[_0x6938('0x1f')](function(_0x1e89d9){_0x206b5d=_0x1e89d9[_0x6938('0x60')]({'plain':!![]});return db[_0x6938('0x99')]['bulkCreate'](createExtensionsReciveFax(_0x206b5d),{'transaction':_0x34e822});});})[_0x6938('0x1f')](function(){return _0x206b5d;})[_0x6938('0x1f')](respondWithResult(_0x5b77ec,null))['catch'](handleError(_0x5b77ec,null));};exports[_0x6938('0x9a')]=function(_0x5723d6,_0x5cc277,_0x18dd57){var _0x220f8e;return db[_0x6938('0x7a')][_0x6938('0x79')](function(_0x3c8d8c){return db['FaxAccount'][_0x6938('0x37')](_0x5723d6[_0x6938('0x66')],{'where':{'id':_0x5723d6[_0x6938('0x66')]['id']},'transaction':_0x3c8d8c})[_0x6938('0x1f')](function(_0x3421a3){return db[_0x6938('0x99')]['destroy']({'where':{'FaxAccountId':_0x5723d6['body']['id']},'transaction':_0x3c8d8c})['then'](function(_0x1ee601){return db[_0x6938('0x99')][_0x6938('0x7d')](createExtensionsReciveFax(_[_0x6938('0x9b')](_0x5723d6[_0x6938('0x66')],[_0x6938('0x9c'),_0x6938('0x44'),'createdAt',_0x6938('0x9d'),_0x6938('0x9e'),_0x6938('0x9f')])),{'transaction':_0x3c8d8c});});});})[_0x6938('0x1f')](function(){return db[_0x6938('0x40')][_0x6938('0xa0')](_0x5723d6[_0x6938('0x66')]['id']);})['then'](respondWithResult(_0x5cc277,null))[_0x6938('0x64')](handleError(_0x5cc277,null));};exports[_0x6938('0xa1')]=function(_0x97688,_0x402e5d,_0x2f4ab3){var _0x58050b={'raw':!![],'where':{}};var _0xfb0881={};var _0x30eeec={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6938('0x6b')]({'where':{'id':_0x97688['params']['id']}})['then'](handleEntityNotFound(_0x402e5d,null))['then'](function(_0x5ba6b9){if(_0x5ba6b9){_0xfb0881[_0x6938('0x45')]=_['keys'](db[_0x6938('0xa2')][_0x6938('0x41')]);_0xfb0881[_0x6938('0x47')]=_[_0x6938('0x5a')](_0x97688[_0x6938('0x47')]);_0xfb0881[_0x6938('0x48')]=_[_0x6938('0x49')](_0xfb0881[_0x6938('0x45')],_0xfb0881['query']);_0x58050b[_0x6938('0x4a')]=_['intersection'](_0xfb0881[_0x6938('0x45')],qs['fields'](_0x97688[_0x6938('0x47')][_0x6938('0x4b')]));_0x58050b[_0x6938('0x4a')]=_0x58050b[_0x6938('0x4a')][_0x6938('0x4c')]?_0x58050b[_0x6938('0x4a')]:_0xfb0881[_0x6938('0x45')];if(!_0x97688[_0x6938('0x47')][_0x6938('0x4d')](_0x6938('0x4e'))){_0x58050b[_0x6938('0x2f')]=qs[_0x6938('0x2f')](_0x97688[_0x6938('0x47')]['limit']);_0x58050b[_0x6938('0x2e')]=qs[_0x6938('0x2e')](_0x97688[_0x6938('0x47')][_0x6938('0x2e')]);}_0x58050b['order']=qs[_0x6938('0x50')](_0x97688[_0x6938('0x47')][_0x6938('0x50')]);_0x58050b['where']=qs[_0x6938('0x48')](_[_0x6938('0x51')](_0x97688[_0x6938('0x47')],_0xfb0881[_0x6938('0x48')]));_0x58050b[_0x6938('0x53')]['FaxAccountId']=_0x5ba6b9['id'];if(_0x97688[_0x6938('0x47')][_0x6938('0x52')]){_0x58050b['where']=_['merge'](_0x58050b[_0x6938('0x53')],{'$or':_[_0x6938('0x46')](_0x58050b[_0x6938('0x4a')],function(_0x12f6cd){var _0x2fa6fe={};_0x2fa6fe[_0x12f6cd]={'$like':'%'+_0x97688[_0x6938('0x47')][_0x6938('0x52')]+'%'};return _0x2fa6fe;})});}if(_0x97688[_0x6938('0x47')][_0x6938('0xa3')]){var _0xdd9648=_0x97688[_0x6938('0x47')][_0x6938('0xa3')][_0x6938('0xa4')](',');var _0x13dfb3={};_0x13dfb3[_0xdd9648[0x0]]={'$gte':moment(_0xdd9648[0x1])[_0x6938('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x58050b[_0x6938('0x53')]=_['merge'](_0x58050b[_0x6938('0x53')],_0x13dfb3);}_0x58050b=_['merge']({},_0x58050b,_0x97688[_0x6938('0x54')]);return db['FaxMessage'][_0x6938('0x31')]({'where':_0x58050b['where']})['then'](function(_0x186e07){_0x30eeec['count']=_0x186e07;if(_0x97688[_0x6938('0x47')][_0x6938('0x55')]){_0x58050b[_0x6938('0x5b')]=[{'all':!![]}];}return db[_0x6938('0xa2')][_0x6938('0x56')](_0x58050b);})['then'](function(_0x174d02){_0x30eeec['rows']=_0x174d02;return _0x30eeec;});}})[_0x6938('0x1f')](respondWithFilteredResult(_0x402e5d,_0x58050b))['catch'](handleError(_0x402e5d,null));};exports['send']=function(_0x41d8e8,_0x1f6022,_0x2b56dd){var _0x4d39de,_0x3450ae={},_0xd150ac;if(_0x41d8e8[_0x6938('0x66')]['to']){_0xd150ac=_0x41d8e8['body']['to'][0x0];}return db[_0x6938('0x40')][_0x6938('0x5d')]({'where':{'id':_0x41d8e8['params']['id']},'include':[{'model':db[_0x6938('0xa6')],'as':_0x6938('0xa7'),'include':[{'model':db[_0x6938('0x73')],'as':_0x6938('0xa8'),'where':{'fax':_0xd150ac},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x1f6022,null))[_0x6938('0x1f')](function(_0x595c3a){_0x4d39de=_0x595c3a;if(_0x41d8e8[_0x6938('0x66')]['attachments']&&_0x41d8e8[_0x6938('0x66')][_0x6938('0xa9')][_0x6938('0x4c')]){for(var _0x5c0fe5=0x0;_0x5c0fe5<_0x41d8e8[_0x6938('0x66')]['attachments'][_0x6938('0x4c')];_0x5c0fe5+=0x1){_0x41d8e8[_0x6938('0x66')]['attachments'][_0x5c0fe5]={'filename':_0x41d8e8[_0x6938('0x66')][_0x6938('0xa9')][_0x5c0fe5]['name'],'id':_0x41d8e8[_0x6938('0x66')]['attachments'][_0x5c0fe5]['id'],'path':path[_0x6938('0xaa')](config['root'],_0x6938('0xab'),_0x41d8e8[_0x6938('0x66')][_0x6938('0xa9')][_0x5c0fe5][_0x6938('0xac')])};}}return respondWithRpcPromise(_0x6938('0xad'),_0x6938('0xad'),{'FaxAccountId':_['isNil'](_0x41d8e8[_0x6938('0x59')]['id'])?undefined:_0x41d8e8[_0x6938('0x59')]['id'],'path':_[_0x6938('0xae')](_0x41d8e8['body']['attachments'][0x0][_0x6938('0x6')])?undefined:_0x41d8e8[_0x6938('0x66')]['attachments'][0x0][_0x6938('0x6')],'fax':_['isNil'](_0x41d8e8[_0x6938('0x66')]['to'][0x0])?undefined:_0x41d8e8['body']['to'][0x0]},client9002);})[_0x6938('0x1f')](function(){if(_0x4d39de){if(_[_0x6938('0xae')](_0x41d8e8[_0x6938('0x66')]['from'])){_0x41d8e8['body'][_0x6938('0xaf')]=util[_0x6938('0xa5')]('\x22%s\x22\x20<%s>',_0x4d39de['name'],_0x4d39de['fax']);}if(_0x4d39de[_0x6938('0xa7')]){if(_0x4d39de[_0x6938('0xa7')]['Contacts'][_0x6938('0x4c')]){return _0x4d39de[_0x6938('0xa7')][_0x6938('0xa8')][0x0];}else{return db[_0x6938('0x73')][_0x6938('0x5e')](_['defaults'](_0x41d8e8['body'],{'firstName':_0x41d8e8[_0x6938('0x66')]['to'][0x0],'phone':_0x41d8e8[_0x6938('0x66')]['to'][0x0],'fax':_0x41d8e8['body']['to'][0x0],'ListId':_0x4d39de[_0x6938('0x9f')]}));}}else{throw new Error(_0x6938('0xb0'));}}else{throw new Error(_0x6938('0xb1'));}})['then'](function(_0x184534){if(_0x184534){return db['FaxInteraction'][_0x6938('0x5d')]({'where':{'ContactId':_0x184534['id'],'closed':![],'FaxAccountId':_0x4d39de['id']}})[_0x6938('0x1f')](function(_0x4d8018){if(_0x4d8018){return[_0x4d8018,![]];}return db[_0x6938('0x72')][_0x6938('0x5e')]({'UserId':_0x41d8e8[_0x6938('0x5f')]['id'],'ContactId':_0x184534['id'],'FaxAccountId':_0x4d39de['id'],'fax':_0x41d8e8['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x6938('0x5c')](_0x41d8e8[_0x6938('0x66')],{'read':![],'body':_0x41d8e8['body'][_0x6938('0xa9')][0x0][_0x6938('0xb2')],'FaxAccountId':_0x4d39de['id'],'UserId':_0x41d8e8[_0x6938('0x5f')]['id'],'ContactId':_0x184534['id'],'AttachmentId':_0x41d8e8[_0x6938('0x66')][_0x6938('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x6938('0xa2')],'as':'Messages'}]})[_0x6938('0x1f')](function(_0x166bf1){return[_0x166bf1,!![]];});});}else{throw new Error(_0x6938('0xb3'));}})['spread'](function(_0x68ae37,_0x386225){if(_0x386225){return _0x68ae37;}return db[_0x6938('0xa2')][_0x6938('0x5e')]({'direction':_0x6938('0xb4'),'read':![],'body':_0x41d8e8[_0x6938('0x66')][_0x6938('0xa9')][0x0][_0x6938('0xb2')],'FaxAccountId':_0x4d39de['id'],'FaxInteractionId':_0x68ae37['id'],'UserId':_0x41d8e8[_0x6938('0x5f')]['id'],'ContactId':_0x68ae37[_0x6938('0xb5')],'AttachmentId':_0x41d8e8['body'][_0x6938('0xa9')][0x0]['id']})[_0x6938('0x1f')](function(_0x3cb94c){_0x68ae37[_0x6938('0xb6')]['Messages']=[];_0x68ae37[_0x6938('0xb6')]['Messages'][_0x6938('0x8a')](_0x3cb94c['dataValues']);return _0x68ae37;});})[_0x6938('0x1f')](function(_0x4925e7){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x6938('0xae')](_0x41d8e8[_0x6938('0x59')]['id'])?undefined:_0x41d8e8[_0x6938('0x59')]['id'],'path':_[_0x6938('0xae')](_0x41d8e8[_0x6938('0x66')][_0x6938('0xa9')][0x0][_0x6938('0x6')])?undefined:_0x41d8e8['body']['attachments'][0x0][_0x6938('0x6')],'fax':_[_0x6938('0xae')](_0x41d8e8[_0x6938('0x66')]['to'][0x0])?undefined:_0x41d8e8[_0x6938('0x66')]['to'][0x0],'AttachmentId':_0x41d8e8[_0x6938('0x66')][_0x6938('0xa9')][0x0]['id']},client9002)['then'](function(_0x3930f2){logger[_0x6938('0x20')](_0x6938('0xb7'),_0x3930f2);})[_0x6938('0x64')](function(_0x24feff){logger[_0x6938('0x20')]('SendFaxRpc,\x20%s',_0x24feff);});return _0x4925e7;})[_0x6938('0x1f')](respondWithResult(_0x1f6022,null))['catch'](handleError(_0x1f6022,null));};exports[_0x6938('0xb8')]=function(_0x591201,_0x274689,_0x3d0f4c){return db[_0x6938('0x40')][_0x6938('0x5d')]({'where':{'id':_0x591201['params']['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0x274689,null))[_0x6938('0x1f')](function(_0x3700ba){if(_0x3700ba){return _0x3700ba[_0x6938('0xb8')](_0x591201[_0x6938('0x66')][_0x6938('0x6e')],_['omit'](_0x591201[_0x6938('0x66')],[_0x6938('0x6e'),'id'])||{})[_0x6938('0xb9')](function(_0x1fbe3b){for(var _0x79f489=0x0;_0x79f489<_0x591201[_0x6938('0x66')][_0x6938('0x6e')][_0x6938('0x4c')];_0x79f489+=0x1){socket[_0x6938('0xba')](_0x6938('0xbb'),{'UserId':Number(_0x591201[_0x6938('0x66')]['ids'][_0x79f489]),'FaxAccountId':Number(_0x591201[_0x6938('0x59')]['id'])});}return _0x1fbe3b;});}})[_0x6938('0x1f')](respondWithResult(_0x274689,null))[_0x6938('0x64')](handleError(_0x274689,null));};exports[_0x6938('0xbc')]=function(_0x3d7988,_0x52cb26,_0x2b167e){return db[_0x6938('0x40')][_0x6938('0x5d')]({'where':{'id':_0x3d7988[_0x6938('0x59')]['id']}})[_0x6938('0x1f')](handleEntityNotFound(_0x52cb26,null))['then'](function(_0x558113){if(_0x558113){return _0x558113[_0x6938('0xbc')](_0x3d7988[_0x6938('0x47')][_0x6938('0x6e')])['then'](function(){if(_[_0x6938('0xbd')](_0x3d7988[_0x6938('0x47')][_0x6938('0x6e')])){for(var _0x2048a5=0x0;_0x2048a5<_0x3d7988['query'][_0x6938('0x6e')][_0x6938('0x4c')];_0x2048a5+=0x1){socket['emit'](_0x6938('0xbe'),{'UserId':Number(_0x3d7988['query'][_0x6938('0x6e')][_0x2048a5]),'FaxAccountId':Number(_0x3d7988[_0x6938('0x59')]['id'])});}}else{socket['emit'](_0x6938('0xbe'),{'UserId':Number(_0x3d7988[_0x6938('0x47')][_0x6938('0x6e')]),'FaxAccountId':Number(_0x3d7988[_0x6938('0x59')]['id'])});}});}})[_0x6938('0x1f')](respondWithStatusCode(_0x52cb26,null))[_0x6938('0x64')](handleError(_0x52cb26,null));};exports[_0x6938('0xbf')]=function(_0x4a5640,_0x2fa90f,_0xd515c3){var _0x161262={};var _0x5b397={};var _0x27fdc9;var _0x4b6e72;return db[_0x6938('0x40')][_0x6938('0x6b')]({'where':{'id':_0x4a5640['params']['id']}})['then'](handleEntityNotFound(_0x2fa90f,null))[_0x6938('0x1f')](function(_0x4fc9dd){if(_0x4fc9dd){_0x27fdc9=_0x4fc9dd;_0x5b397[_0x6938('0x45')]=_['keys'](db[_0x6938('0x75')]['rawAttributes']);_0x5b397['query']=_[_0x6938('0x5a')](_0x4a5640['query']);_0x5b397['filters']=_[_0x6938('0x49')](_0x5b397[_0x6938('0x45')],_0x5b397['query']);_0x161262[_0x6938('0x4a')]=_['intersection'](_0x5b397[_0x6938('0x45')],qs[_0x6938('0x4b')](_0x4a5640[_0x6938('0x47')]['fields']));_0x161262[_0x6938('0x4a')]=_0x161262[_0x6938('0x4a')][_0x6938('0x4c')]?_0x161262['attributes']:_0x5b397[_0x6938('0x45')];_0x161262[_0x6938('0x4f')]=qs['sort'](_0x4a5640[_0x6938('0x47')]['sort']);_0x161262[_0x6938('0x53')]=qs['filters'](_[_0x6938('0x51')](_0x4a5640[_0x6938('0x47')],_0x5b397['filters']));if(_0x4a5640[_0x6938('0x47')][_0x6938('0x52')]){_0x161262[_0x6938('0x53')]=_[_0x6938('0x5c')](_0x161262[_0x6938('0x53')],{'$or':_[_0x6938('0x46')](_0x161262['attributes'],function(_0x4a95e9){var _0x40f535={};_0x40f535[_0x4a95e9]={'$like':'%'+_0x4a5640[_0x6938('0x47')][_0x6938('0x52')]+'%'};return _0x40f535;})});}_0x161262=_[_0x6938('0x5c')]({},_0x161262,_0x4a5640[_0x6938('0x54')]);return _0x27fdc9[_0x6938('0xbf')](_0x161262);}})[_0x6938('0x1f')](function(_0x5bfcd9){if(_0x5bfcd9){_0x4b6e72=_0x5bfcd9[_0x6938('0x4c')];if(!_0x4a5640[_0x6938('0x47')][_0x6938('0x4d')](_0x6938('0x4e'))){_0x161262[_0x6938('0x2f')]=qs[_0x6938('0x2f')](_0x4a5640[_0x6938('0x47')][_0x6938('0x2f')]);_0x161262[_0x6938('0x2e')]=qs[_0x6938('0x2e')](_0x4a5640[_0x6938('0x47')][_0x6938('0x2e')]);}return _0x27fdc9[_0x6938('0xbf')](_0x161262);}})[_0x6938('0x1f')](function(_0x534a12){if(_0x534a12){return _0x534a12?{'count':_0x4b6e72,'rows':_0x534a12}:null;}})[_0x6938('0x1f')](respondWithResult(_0x2fa90f,null))[_0x6938('0x64')](handleError(_0x2fa90f,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index dda65d7..bff0247 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 _0xb6f3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','FaxAccount'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb6f3,0x12a));var _0x3b6f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb6f3[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x3b6f('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x3b6f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3b6f('0x2')](0x0);var events={'afterCreate':_0x3b6f('0x3'),'afterUpdate':_0x3b6f('0x4'),'afterDestroy':_0x3b6f('0x5')};function emitEvent(_0x10488f){return function(_0x3d7fd6,_0xfd524e,_0x492f95){FaxAccountEvents[_0x3b6f('0x6')](_0x10488f+':'+_0x3d7fd6['id'],_0x3d7fd6);FaxAccountEvents[_0x3b6f('0x6')](_0x10488f,_0x3d7fd6);_0x492f95(null);};}for(var e in events){if(events[_0x3b6f('0x7')](e)){var event=events[e];FaxAccount[_0x3b6f('0x8')](e,emitEvent(event));}}module[_0x3b6f('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x1ff8=['events','../../mysqldb','FaxAccount','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2dc663,_0x516d5c){var _0x37bc1e=function(_0x19929b){while(--_0x19929b){_0x2dc663['push'](_0x2dc663['shift']());}};_0x37bc1e(++_0x516d5c);}(_0x1ff8,0xab));var _0x81ff=function(_0x3ec023,_0xc91590){_0x3ec023=_0x3ec023-0x0;var _0x38db02=_0x1ff8[_0x3ec023];return _0x38db02;};'use strict';var EventEmitter=require(_0x81ff('0x0'));var FaxAccount=require(_0x81ff('0x1'))['db'][_0x81ff('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x81ff('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x81ff('0x4')};function emitEvent(_0x1608c0){return function(_0x2a4618,_0x33276c,_0x3c0f24){FaxAccountEvents[_0x81ff('0x5')](_0x1608c0+':'+_0x2a4618['id'],_0x2a4618);FaxAccountEvents[_0x81ff('0x5')](_0x1608c0,_0x2a4618);_0x3c0f24(null);};}for(var e in events){if(events[_0x81ff('0x6')](e)){var event=events[e];FaxAccount[_0x81ff('0x7')](e,emitEvent(event));}}module[_0x81ff('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 896faec..94ef288 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 _0xb163=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','api','moment'];(function(_0x295270,_0x205409){var _0x3d65c7=function(_0x56d6c2){while(--_0x56d6c2){_0x295270['push'](_0x295270['shift']());}};_0x3d65c7(++_0x205409);}(_0xb163,0x127));var _0x3b16=function(_0x3eb1c6,_0x49cdf8){_0x3eb1c6=_0x3eb1c6-0x0;var _0x4fbb63=_0xb163[_0x3eb1c6];return _0x4fbb63;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3b16('0x0'));var moment=require(_0x3b16('0x1'));var BPromise=require('bluebird');var rp=require(_0x3b16('0x2'));var fs=require('fs');var path=require(_0x3b16('0x3'));var rimraf=require(_0x3b16('0x4'));var config=require(_0x3b16('0x5'));var attributes=require(_0x3b16('0x6'));module[_0x3b16('0x7')]=function(_0x30ca0d,_0x35c583){return _0x30ca0d[_0x3b16('0x8')](_0x3b16('0x9'),attributes,{'tableName':_0x3b16('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5276=['bluebird','request-promise','path','./faxAccount.attributes','exports','define','fax_accounts','lodash','../../config/logger','api'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5276,0x9d));var _0x6527=function(_0x295c7d,_0xd99306){_0x295c7d=_0x295c7d-0x0;var _0x1f2e17=_0x5276[_0x295c7d];return _0x1f2e17;};'use strict';var _=require(_0x6527('0x0'));var util=require('util');var logger=require(_0x6527('0x1'))(_0x6527('0x2'));var moment=require('moment');var BPromise=require(_0x6527('0x3'));var rp=require(_0x6527('0x4'));var fs=require('fs');var path=require(_0x6527('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6527('0x6'));module[_0x6527('0x7')]=function(_0x3e7d72,_0x726765){return _0x3e7d72[_0x6527('0x8')]('FaxAccount',attributes,{'tableName':_0x6527('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index b31ba20..99126d6 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 _0xccc0=['createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','orderBy','priority','asc','ListId','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxAccount','findAll','options','where','limit','include','map','model','attributes','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys'];(function(_0x5445c7,_0x588725){var _0x244494=function(_0x4ebd3d){while(--_0x4ebd3d){_0x5445c7['push'](_0x5445c7['shift']());}};_0x244494(++_0x588725);}(_0xccc0,0x1ec));var _0x0ccc=function(_0x2fe5ff,_0x44310c){_0x2fe5ff=_0x2fe5ff-0x0;var _0x3b1cb7=_0xccc0[_0x2fe5ff];return _0x3b1cb7;};'use strict';var _=require(_0x0ccc('0x0'));var util=require(_0x0ccc('0x1'));var moment=require(_0x0ccc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ccc('0x3'));var db=require(_0x0ccc('0x4'))['db'];var utils=require(_0x0ccc('0x5'));var logger=require(_0x0ccc('0x6'))(_0x0ccc('0x7'));var config=require(_0x0ccc('0x8'));var jayson=require(_0x0ccc('0x9'));var client=jayson[_0x0ccc('0xa')][_0x0ccc('0xb')]({'port':0x232c});config['redis']=_[_0x0ccc('0xc')](config[_0x0ccc('0xd')],{'host':_0x0ccc('0xe'),'port':0x18eb});var socket=require(_0x0ccc('0xf'))(new Redis(config[_0x0ccc('0xd')]));require(_0x0ccc('0x10'))[_0x0ccc('0x11')](socket);function respondWithRpcPromise(_0x1379e1,_0x59e6ba,_0x115c51){return new BPromise(function(_0x59d8e3,_0x176e29){return client['request'](_0x1379e1,_0x115c51)[_0x0ccc('0x12')](function(_0x735be9){logger['info'](_0x0ccc('0x13'),_0x59e6ba,_0x0ccc('0x14'));logger[_0x0ccc('0x15')](_0x0ccc('0x16'),_0x59e6ba,_0x0ccc('0x14'),JSON[_0x0ccc('0x17')](_0x735be9));if(_0x735be9[_0x0ccc('0x18')]){if(_0x735be9[_0x0ccc('0x18')][_0x0ccc('0x19')]===0x1f4){logger['error'](_0x0ccc('0x13'),_0x59e6ba,_0x735be9[_0x0ccc('0x18')][_0x0ccc('0x1a')]);return _0x176e29(_0x735be9[_0x0ccc('0x18')][_0x0ccc('0x1a')]);}logger[_0x0ccc('0x18')](_0x0ccc('0x13'),_0x59e6ba,_0x735be9[_0x0ccc('0x18')]['message']);return _0x59d8e3(_0x735be9[_0x0ccc('0x18')][_0x0ccc('0x1a')]);}else{logger['info'](_0x0ccc('0x13'),_0x59e6ba,'request\x20sent');_0x59d8e3(_0x735be9[_0x0ccc('0x1b')]['message']);}})[_0x0ccc('0x1c')](function(_0x113d29){logger[_0x0ccc('0x18')](_0x0ccc('0x13'),_0x59e6ba,_0x113d29);_0x176e29(_0x113d29);});});}exports['GetFaxAccount']=function(_0x5c9832){var _0x58376d=this;return new Promise(function(_0x19adc0,_0x2fce43){return db[_0x0ccc('0x1d')][_0x0ccc('0x1e')]({'raw':_0x5c9832[_0x0ccc('0x1f')]?_0x5c9832[_0x0ccc('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5c9832['options']?_0x5c9832[_0x0ccc('0x1f')][_0x0ccc('0x20')]||null:null,'attributes':_0x5c9832[_0x0ccc('0x1f')]?_0x5c9832[_0x0ccc('0x1f')]['attributes']||null:null,'limit':_0x5c9832['options']?_0x5c9832[_0x0ccc('0x1f')][_0x0ccc('0x21')]||null:null,'include':_0x5c9832[_0x0ccc('0x1f')]?_0x5c9832['options'][_0x0ccc('0x22')]?_[_0x0ccc('0x23')](_0x5c9832[_0x0ccc('0x1f')][_0x0ccc('0x22')],function(_0xfda225){return{'model':db[_0xfda225[_0x0ccc('0x24')]],'as':_0xfda225['as'],'attributes':_0xfda225[_0x0ccc('0x25')],'include':_0xfda225[_0x0ccc('0x22')]?_[_0x0ccc('0x23')](_0xfda225['include'],function(_0x1df8b5){return{'model':db[_0x1df8b5[_0x0ccc('0x24')]],'as':_0x1df8b5['as'],'attributes':_0x1df8b5['attributes'],'include':_0x1df8b5['include']?_[_0x0ccc('0x23')](_0x1df8b5[_0x0ccc('0x22')],function(_0x18674e){return{'model':db[_0x18674e[_0x0ccc('0x24')]],'as':_0x18674e['as'],'attributes':_0x18674e[_0x0ccc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x0ccc('0x12')](function(_0x218081){logger['info'](_0x0ccc('0x26'),_0x5c9832);logger[_0x0ccc('0x15')](_0x0ccc('0x26'),_0x5c9832,JSON[_0x0ccc('0x17')](_0x218081));_0x19adc0(_0x218081);})[_0x0ccc('0x1c')](function(_0x56ab56){logger[_0x0ccc('0x18')](_0x0ccc('0x26'),_0x56ab56[_0x0ccc('0x1a')],_0x5c9832);_0x2fce43(_0x58376d[_0x0ccc('0x18')](0x1f4,_0x56ab56['message']));});});};exports[_0x0ccc('0x27')]=function(_0x46ab97,_0x3f219f,_0x3034e9){var _0x1b2730=this;return new Promise(function(_0x4b103c,_0x31ae85){var _0x104df3={'body':_0x46ab97[_0x0ccc('0x28')],'channel':_0x0ccc('0x29')};var _0x2c5ec0=[];var _0x2ff4f3=[];var _0x24edd5={};return db[_0x0ccc('0x2a')][_0x0ccc('0x2b')]()[_0x0ccc('0x12')](function(_0x4940dc){if(!_0x4940dc){throw new db[(_0x0ccc('0x2c'))][(_0x0ccc('0x2d'))]('no\x20available\x20attributes');}_0x2c5ec0=_[_0x0ccc('0x2e')](_[_0x0ccc('0x2f')](_0x4940dc),[_0x0ccc('0x30'),_0x0ccc('0x31')]);_0x2ff4f3=_[_0x0ccc('0x2e')](_[_0x0ccc('0x2f')](_0x4940dc),[_0x0ccc('0x30'),_0x0ccc('0x31'),_0x0ccc('0x32'),'ListId']);if(_0x46ab97[_0x0ccc('0x28')]['id']){delete _0x46ab97['body']['id'];}if(_[_0x0ccc('0x33')](_0x46ab97[_0x0ccc('0x28')]['from'])){throw new db[(_0x0ccc('0x2c'))][(_0x0ccc('0x2d'))](_0x0ccc('0x34'));}if(_['isNil'](_0x46ab97['body'][_0x0ccc('0x28')])||_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x28')]===''){throw new db[(_0x0ccc('0x2c'))][(_0x0ccc('0x2d'))](_0x0ccc('0x35'));}if(_[_0x0ccc('0x33')](_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x36')])){throw new db[(_0x0ccc('0x2c'))][(_0x0ccc('0x2d'))](_0x0ccc('0x37')+_0x2ff4f3);}if(!_['includes'](_0x2ff4f3,_0x46ab97[_0x0ccc('0x28')]['mapKey'])){throw new db[(_0x0ccc('0x2c'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ff4f3);}_0x24edd5[_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x36')]]=_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x38')];})[_0x0ccc('0x12')](function(){return db[_0x0ccc('0x1d')][_0x0ccc('0x39')]({'where':{'id':_0x46ab97[_0x0ccc('0x3a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x0ccc('0x3b'),'where':_0x24edd5,'limit':0x1,'order':[[_0x0ccc('0x31'),_0x0ccc('0x3c')]]}]},{'model':db[_0x0ccc('0x3d')],'as':_0x0ccc('0x3e')}]});})['then'](function(_0x14851f){if(_0x14851f&&_0x14851f[_0x0ccc('0x3f')]){var _0x3fa69e=_0x14851f[_0x0ccc('0x40')]({'plain':!![]});_0x104df3[_0x0ccc('0x3a')]=_0x3fa69e;_0x104df3[_0x0ccc('0x41')]=_0x3fa69e[_0x0ccc('0x3e')];_0x104df3[_0x0ccc('0x42')]=_0x3fa69e[_0x0ccc('0x3f')];_0x104df3['applications']=_[_0x0ccc('0x43')](_0x104df3[_0x0ccc('0x41')],[_0x0ccc('0x44')],[_0x0ccc('0x45')]);if(_0x104df3[_0x0ccc('0x3a')][_0x0ccc('0x3e')]){delete _0x104df3['account'][_0x0ccc('0x3e')];}if(_0x104df3['account'][_0x0ccc('0x3f')]&&_0x104df3['account'][_0x0ccc('0x3f')]['Contacts']['length']){return _0x104df3[_0x0ccc('0x3a')][_0x0ccc('0x3f')][_0x0ccc('0x3b')][0x0];}var _0x4ac6e4=_['defaults'](_0x46ab97[_0x0ccc('0x28')],{'firstName':_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x38')],'ListId':_0x3fa69e[_0x0ccc('0x46')]});_0x4ac6e4[_0x46ab97[_0x0ccc('0x28')]['mapKey']]=_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x38')];return db[_0x0ccc('0x2a')][_0x0ccc('0x47')](_0x4ac6e4,{'fields':_0x2c5ec0,'raw':!![]});}})[_0x0ccc('0x12')](function(_0x56d510){_0x104df3['contact']=_0x56d510;if(_0x56d510){var _0x40d583={'ContactId':_0x56d510['id'],'FaxAccountId':_0x46ab97[_0x0ccc('0x3a')]['id'],'fax':_0x56d510[_0x0ccc('0x29')]};return db[_0x0ccc('0x48')][_0x0ccc('0x39')]({'where':{'ContactId':_0x56d510['id'],'closed':![],'FaxAccountId':_0x46ab97['account']['id']}})[_0x0ccc('0x12')](function(_0x472ce7){if(_0x472ce7){return[_0x472ce7,![]];}return db[_0x0ccc('0x48')]['create'](_0x40d583)['then'](function(_0xd6f129){return[_0xd6f129,!![]];});});}else{throw new Error(_0x0ccc('0x49'));}})[_0x0ccc('0x4a')](function(_0xa58e24,_0x4eaf09){var _0x2a7b30=_0xa58e24[_0x0ccc('0x40')]({'plain':!![]});if(_0x4eaf09){if(_0x104df3['account'][_0x0ccc('0x4b')]){_0x104df3[_0x0ccc('0x41')][_0x0ccc('0x4c')]({'id':0x0,'priority':_0x104df3[_0x0ccc('0x41')]['length']+0x1,'app':_0x0ccc('0x4d'),'appdata':_0x0ccc('0x4e'),'interval':_0x0ccc('0x4f')});}_0x2a7b30[_0x0ccc('0x50')]=!![];}else{_0x2a7b30['created']=![];}_0x104df3['interaction']=_0x2a7b30;return db['FaxMessage'][_0x0ccc('0x47')]({'body':_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x28')],'FaxAccountId':_0x46ab97[_0x0ccc('0x3a')]['id'],'FaxInteractionId':_0xa58e24['id'],'direction':'in','ContactId':_0xa58e24[_0x0ccc('0x51')],'AttachmentId':_0x46ab97['body'][_0x0ccc('0x52')]});})['then'](function(_0x244ac7){_0x104df3[_0x0ccc('0x1a')]=_0x244ac7;if(_0x104df3['interaction']['UserId']){return db[_0x0ccc('0x53')][_0x0ccc('0x39')]({'attributes':['id',_0x0ccc('0x54')],'where':{'id':_0x104df3['interaction']['UserId']}})[_0x0ccc('0x12')](function(_0x3ac8e5){if(_0x3ac8e5){_0x104df3[_0x0ccc('0x41')][_0x0ccc('0x55')]({'id':0x0,'priority':0x0,'app':_0x0ccc('0x56'),'appdata':_0x3ac8e5[_0x0ccc('0x54')]+','+(_0x104df3['account'][_0x0ccc('0x57')]||0xa),'interval':_0x0ccc('0x4f')});}return respondWithRpcPromise('Start',_0x0ccc('0x58'),_0x104df3);});}return respondWithRpcPromise(_0x0ccc('0x59'),_0x0ccc('0x58'),_0x104df3);})['then'](function(_0x3a7160){_0x4b103c(_0x3a7160);})['catch'](function(_0x255292){_0x31ae85(_0x1b2730[_0x0ccc('0x18')](0x1f4,_0x255292['message']));});});}; \ No newline at end of file +var _0x8962=['interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','raw','options','where','attributes','limit','include','model','map','debug','NotifyFaxAccount','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmContact','DESC','FaxApplication','Applications','List','get','applications','list','priority','Contacts','length','create','fax','FaxInteraction','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created'];(function(_0x4fdddb,_0x4ba901){var _0xc863d=function(_0x231a16){while(--_0x231a16){_0x4fdddb['push'](_0x4fdddb['shift']());}};_0xc863d(++_0x4ba901);}(_0x8962,0xbf));var _0x2896=function(_0x1e0c09,_0xf65c8e){_0x1e0c09=_0x1e0c09-0x0;var _0x266bb2=_0x8962[_0x1e0c09];return _0x266bb2;};'use strict';var _=require('lodash');var util=require(_0x2896('0x0'));var moment=require('moment');var BPromise=require(_0x2896('0x1'));var rs=require(_0x2896('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2896('0x3'))['db'];var utils=require(_0x2896('0x4'));var logger=require(_0x2896('0x5'))('rpc');var config=require(_0x2896('0x6'));var jayson=require(_0x2896('0x7'));var client=jayson[_0x2896('0x8')][_0x2896('0x9')]({'port':0x232c});config[_0x2896('0xa')]=_[_0x2896('0xb')](config[_0x2896('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2896('0xc'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x2896('0xd')](socket);function respondWithRpcPromise(_0x257ba9,_0x1affb4,_0x59a035){return new BPromise(function(_0x254950,_0x40cba9){return client[_0x2896('0xe')](_0x257ba9,_0x59a035)[_0x2896('0xf')](function(_0xd2eb90){logger[_0x2896('0x10')](_0x2896('0x11'),_0x1affb4,_0x2896('0x12'));logger['debug'](_0x2896('0x13'),_0x1affb4,_0x2896('0x12'),JSON[_0x2896('0x14')](_0xd2eb90));if(_0xd2eb90['error']){if(_0xd2eb90[_0x2896('0x15')][_0x2896('0x16')]===0x1f4){logger[_0x2896('0x15')](_0x2896('0x11'),_0x1affb4,_0xd2eb90[_0x2896('0x15')][_0x2896('0x17')]);return _0x40cba9(_0xd2eb90['error']['message']);}logger[_0x2896('0x15')](_0x2896('0x11'),_0x1affb4,_0xd2eb90[_0x2896('0x15')]['message']);return _0x254950(_0xd2eb90[_0x2896('0x15')][_0x2896('0x17')]);}else{logger[_0x2896('0x10')](_0x2896('0x11'),_0x1affb4,_0x2896('0x12'));_0x254950(_0xd2eb90[_0x2896('0x18')][_0x2896('0x17')]);}})[_0x2896('0x19')](function(_0x500d83){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1affb4,_0x500d83);_0x40cba9(_0x500d83);});});}exports[_0x2896('0x1a')]=function(_0x3d6b1e){var _0x2f226b=this;return new Promise(function(_0x131d73,_0x29447d){return db[_0x2896('0x1b')][_0x2896('0x1c')]({'raw':_0x3d6b1e['options']?_0x3d6b1e['options'][_0x2896('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d6b1e[_0x2896('0x1e')]?_0x3d6b1e[_0x2896('0x1e')][_0x2896('0x1f')]||null:null,'attributes':_0x3d6b1e[_0x2896('0x1e')]?_0x3d6b1e[_0x2896('0x1e')][_0x2896('0x20')]||null:null,'limit':_0x3d6b1e[_0x2896('0x1e')]?_0x3d6b1e[_0x2896('0x1e')][_0x2896('0x21')]||null:null,'include':_0x3d6b1e[_0x2896('0x1e')]?_0x3d6b1e['options']['include']?_['map'](_0x3d6b1e[_0x2896('0x1e')][_0x2896('0x22')],function(_0x5b68e8){return{'model':db[_0x5b68e8[_0x2896('0x23')]],'as':_0x5b68e8['as'],'attributes':_0x5b68e8[_0x2896('0x20')],'include':_0x5b68e8['include']?_[_0x2896('0x24')](_0x5b68e8['include'],function(_0x19994d){return{'model':db[_0x19994d['model']],'as':_0x19994d['as'],'attributes':_0x19994d[_0x2896('0x20')],'include':_0x19994d[_0x2896('0x22')]?_[_0x2896('0x24')](_0x19994d[_0x2896('0x22')],function(_0x19d3fd){return{'model':db[_0x19d3fd['model']],'as':_0x19d3fd['as'],'attributes':_0x19d3fd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b7992){logger[_0x2896('0x10')](_0x2896('0x1a'),_0x3d6b1e);logger[_0x2896('0x25')](_0x2896('0x1a'),_0x3d6b1e,JSON['stringify'](_0x1b7992));_0x131d73(_0x1b7992);})[_0x2896('0x19')](function(_0xe71777){logger['error'](_0x2896('0x1a'),_0xe71777['message'],_0x3d6b1e);_0x29447d(_0x2f226b[_0x2896('0x15')](0x1f4,_0xe71777['message']));});});};exports[_0x2896('0x26')]=function(_0x553948,_0x1e9a3b,_0x5c9507){var _0x2b825e=this;return new Promise(function(_0xf64e76,_0x150925){var _0x1a9c61={'body':_0x553948['body'],'channel':'fax'};var _0x1f11f6=[];var _0x516f84=[];var _0x5a2ccd={};return db['CmContact'][_0x2896('0x27')]()[_0x2896('0xf')](function(_0x525b2c){if(!_0x525b2c){throw new db[(_0x2896('0x28'))][(_0x2896('0x29'))](_0x2896('0x2a'));}_0x1f11f6=_[_0x2896('0x2b')](_[_0x2896('0x2c')](_0x525b2c),[_0x2896('0x2d'),'updatedAt']);_0x516f84=_[_0x2896('0x2b')](_['keys'](_0x525b2c),['createdAt',_0x2896('0x2e'),'CompanyId',_0x2896('0x2f')]);if(_0x553948[_0x2896('0x30')]['id']){delete _0x553948[_0x2896('0x30')]['id'];}if(_['isNil'](_0x553948['body'][_0x2896('0x31')])){throw new db[(_0x2896('0x28'))][(_0x2896('0x29'))](_0x2896('0x32'));}if(_[_0x2896('0x33')](_0x553948[_0x2896('0x30')]['body'])||_0x553948['body'][_0x2896('0x30')]===''){throw new db['Sequelize'][(_0x2896('0x29'))](_0x2896('0x34'));}if(_[_0x2896('0x33')](_0x553948[_0x2896('0x30')][_0x2896('0x35')])){throw new db[(_0x2896('0x28'))][(_0x2896('0x29'))](_0x2896('0x36')+_0x516f84);}if(!_[_0x2896('0x37')](_0x516f84,_0x553948[_0x2896('0x30')][_0x2896('0x35')])){throw new db[(_0x2896('0x28'))]['ValidationError'](_0x2896('0x38')+_0x516f84);}_0x5a2ccd[_0x553948[_0x2896('0x30')][_0x2896('0x35')]]=_0x553948[_0x2896('0x30')][_0x2896('0x31')];})[_0x2896('0xf')](function(){return db['FaxAccount'][_0x2896('0x39')]({'where':{'id':_0x553948[_0x2896('0x3a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2896('0x3b')],'as':'Contacts','where':_0x5a2ccd,'limit':0x1,'order':[[_0x2896('0x2e'),_0x2896('0x3c')]]}]},{'model':db[_0x2896('0x3d')],'as':_0x2896('0x3e')}]});})[_0x2896('0xf')](function(_0x2e58f9){if(_0x2e58f9&&_0x2e58f9[_0x2896('0x3f')]){var _0x70b88e=_0x2e58f9[_0x2896('0x40')]({'plain':!![]});_0x1a9c61['account']=_0x70b88e;_0x1a9c61[_0x2896('0x41')]=_0x70b88e[_0x2896('0x3e')];_0x1a9c61[_0x2896('0x42')]=_0x70b88e[_0x2896('0x3f')];_0x1a9c61[_0x2896('0x41')]=_['orderBy'](_0x1a9c61[_0x2896('0x41')],[_0x2896('0x43')],['asc']);if(_0x1a9c61[_0x2896('0x3a')][_0x2896('0x3e')]){delete _0x1a9c61[_0x2896('0x3a')][_0x2896('0x3e')];}if(_0x1a9c61[_0x2896('0x3a')][_0x2896('0x3f')]&&_0x1a9c61['account'][_0x2896('0x3f')][_0x2896('0x44')][_0x2896('0x45')]){return _0x1a9c61['account'][_0x2896('0x3f')][_0x2896('0x44')][0x0];}var _0x4c5a99=_[_0x2896('0xb')](_0x553948[_0x2896('0x30')],{'firstName':_0x553948['body'][_0x2896('0x31')],'ListId':_0x70b88e[_0x2896('0x2f')]});_0x4c5a99[_0x553948[_0x2896('0x30')][_0x2896('0x35')]]=_0x553948['body'][_0x2896('0x31')];return db['CmContact'][_0x2896('0x46')](_0x4c5a99,{'fields':_0x1f11f6,'raw':!![]});}})[_0x2896('0xf')](function(_0x180f69){_0x1a9c61['contact']=_0x180f69;if(_0x180f69){var _0x1d7b59={'ContactId':_0x180f69['id'],'FaxAccountId':_0x553948['account']['id'],'fax':_0x180f69[_0x2896('0x47')]};return db['FaxInteraction'][_0x2896('0x39')]({'where':{'ContactId':_0x180f69['id'],'closed':![],'FaxAccountId':_0x553948[_0x2896('0x3a')]['id']}})['then'](function(_0x2815df){if(_0x2815df){return[_0x2815df,![]];}return db[_0x2896('0x48')]['create'](_0x1d7b59)[_0x2896('0xf')](function(_0x59d294){return[_0x59d294,!![]];});});}else{throw new Error(_0x2896('0x49'));}})['spread'](function(_0x93c56a,_0x156820){var _0x4d0025=_0x93c56a[_0x2896('0x40')]({'plain':!![]});if(_0x156820){if(_0x1a9c61[_0x2896('0x3a')]['autoclose']){_0x1a9c61[_0x2896('0x41')][_0x2896('0x4a')]({'id':0x0,'priority':_0x1a9c61[_0x2896('0x41')]['length']+0x1,'app':_0x2896('0x4b'),'appdata':_0x2896('0x4c'),'interval':_0x2896('0x4d')});}_0x4d0025[_0x2896('0x4e')]=!![];}else{_0x4d0025['created']=![];}_0x1a9c61[_0x2896('0x4f')]=_0x4d0025;return db[_0x2896('0x50')][_0x2896('0x46')]({'body':_0x553948['body'][_0x2896('0x30')],'FaxAccountId':_0x553948[_0x2896('0x3a')]['id'],'FaxInteractionId':_0x93c56a['id'],'direction':'in','ContactId':_0x93c56a['ContactId'],'AttachmentId':_0x553948[_0x2896('0x30')][_0x2896('0x51')]});})[_0x2896('0xf')](function(_0x3b97d8){_0x1a9c61[_0x2896('0x17')]=_0x3b97d8;if(_0x1a9c61[_0x2896('0x4f')][_0x2896('0x52')]){return db[_0x2896('0x53')]['find']({'attributes':['id',_0x2896('0x54')],'where':{'id':_0x1a9c61[_0x2896('0x4f')][_0x2896('0x52')]}})[_0x2896('0xf')](function(_0x5e773a){if(_0x5e773a){_0x1a9c61[_0x2896('0x41')][_0x2896('0x55')]({'id':0x0,'priority':0x0,'app':_0x2896('0x56'),'appdata':_0x5e773a[_0x2896('0x54')]+','+(_0x1a9c61[_0x2896('0x3a')][_0x2896('0x57')]||0xa),'interval':_0x2896('0x4d')});}return respondWithRpcPromise('Start',_0x2896('0x58'),_0x1a9c61);});}return respondWithRpcPromise(_0x2896('0x59'),_0x2896('0x58'),_0x1a9c61);})[_0x2896('0xf')](function(_0x930bcc){_0xf64e76(_0x930bcc);})[_0x2896('0x19')](function(_0x52a4b5){_0x150925(_0x2b825e[_0x2896('0x15')](0x1f4,_0x52a4b5[_0x2896('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f9c0541..c439f03 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 _0x0679=['update','emit','removeListener','register','faxAccount:','save','remove'];(function(_0x4630ff,_0x496879){var _0x39d052=function(_0x29099e){while(--_0x29099e){_0x4630ff['push'](_0x4630ff['shift']());}};_0x39d052(++_0x496879);}(_0x0679,0xbb));var _0x9067=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x0679[_0x166742];return _0xb7814a;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x9067('0x0'),_0x9067('0x1'),_0x9067('0x2')];function createListener(_0xf892df,_0x33a922){return function(_0x3d480d){_0x33a922[_0x9067('0x3')](_0xf892df,_0x3d480d);};}function removeListener(_0x2cce73,_0x2fff61){return function(){FaxAccountEvents[_0x9067('0x4')](_0x2cce73,_0x2fff61);};}exports[_0x9067('0x5')]=function(_0x27c372){for(var _0xc03e99=0x0,_0x22f5c1=events['length'];_0xc03e99<_0x22f5c1;_0xc03e99++){var _0xb86bb1=events[_0xc03e99];var _0x4da69f=createListener(_0x9067('0x6')+_0xb86bb1,_0x27c372);FaxAccountEvents['on'](_0xb86bb1,_0x4da69f);}}; \ No newline at end of file +var _0x5d40=['register','faxAccount:','save','emit'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x5d40,0x76));var _0x05d4=function(_0x2a3343,_0x26d99f){_0x2a3343=_0x2a3343-0x0;var _0x3610a2=_0x5d40[_0x2a3343];return _0x3610a2;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x05d4('0x0'),'remove','update'];function createListener(_0x821851,_0xd8e5e4){return function(_0x244e42){_0xd8e5e4[_0x05d4('0x1')](_0x821851,_0x244e42);};}function removeListener(_0x599a69,_0x16c3fc){return function(){FaxAccountEvents['removeListener'](_0x599a69,_0x16c3fc);};}exports[_0x05d4('0x2')]=function(_0x5acfcd){for(var _0x4318d4=0x0,_0x310a96=events['length'];_0x4318d4<_0x310a96;_0x4318d4++){var _0xc4f450=events[_0x4318d4];var _0x1d13a5=createListener(_0x05d4('0x3')+_0xc4f450,_0x5acfcd);FaxAccountEvents['on'](_0xc4f450,_0x1d13a5);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 964ce29..4a6e8e7 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(_0x1f21f7,_0x34eda3){var _0x276ed6=function(_0x1e7737){while(--_0x1e7737){_0x1f21f7['push'](_0x1f21f7['shift']());}};_0x276ed6(++_0x34eda3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x30abe0,_0x4fac13){var _0x4759f7=function(_0x5f4fc6){while(--_0x5f4fc6){_0x30abe0['push'](_0x30abe0['shift']());}};_0x4759f7(++_0x4fac13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 a20bae0..ad7eacd 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 _0x6656=['noop','*,*,*,*','STRING'];(function(_0x22c178,_0x3eedf0){var _0x4c4f43=function(_0x1044bc){while(--_0x1044bc){_0x22c178['push'](_0x22c178['shift']());}};_0x4c4f43(++_0x3eedf0);}(_0x6656,0x16a));var _0x6665=function(_0x221808,_0x4e6ee5){_0x221808=_0x221808-0x0;var _0x26c697=_0x6656[_0x221808];return _0x26c697;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6665('0x0')],'allowNull':![],'defaultValue':_0x6665('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6665('0x0')],'defaultValue':_0x6665('0x2')}}; \ No newline at end of file +var _0x1126=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1126,0x192));var _0x6112=function(_0x1d94b7,_0x5988e5){_0x1d94b7=_0x1d94b7-0x0;var _0x40a258=_0x1126[_0x1d94b7];return _0x40a258;};'use strict';var Sequelize=require(_0x6112('0x0'));module[_0x6112('0x1')]={'priority':{'type':Sequelize[_0x6112('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6112('0x3')],'allowNull':![],'defaultValue':_0x6112('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6112('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6112('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c2c64fb..1bf6356 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 _0x7cae=['destroy','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','keys','query','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','count','include','findAll','rows','catch','params','intersection','length','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x7cae,0x151));var _0xe7ca=function(_0x3de8a7,_0x57b636){_0x3de8a7=_0x3de8a7-0x0;var _0x370464=_0x7cae[_0x3de8a7];return _0x370464;};'use strict';var emlformat=require(_0xe7ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7ca('0x1'));var jsonpatch=require(_0xe7ca('0x2'));var rp=require(_0xe7ca('0x3'));var moment=require(_0xe7ca('0x4'));var BPromise=require(_0xe7ca('0x5'));var Mustache=require(_0xe7ca('0x6'));var util=require('util');var path=require(_0xe7ca('0x7'));var sox=require(_0xe7ca('0x8'));var csv=require('to-csv');var ejs=require(_0xe7ca('0x9'));var fs=require('fs');var fs_extra=require(_0xe7ca('0xa'));var _=require(_0xe7ca('0xb'));var squel=require(_0xe7ca('0xc'));var crypto=require(_0xe7ca('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe7ca('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe7ca('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7ca('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe7ca('0x11'));var hardwareService=require(_0xe7ca('0x12'));var logger=require(_0xe7ca('0x13'))(_0xe7ca('0x14'));var utils=require(_0xe7ca('0x15'));var config=require(_0xe7ca('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ca('0x17'))['db'];function respondWithStatusCode(_0x1d162b,_0x527720){_0x527720=_0x527720||0xcc;return function(_0xed4820){if(_0xed4820){return _0x1d162b[_0xe7ca('0x18')](_0x527720);}return _0x1d162b['status'](_0x527720)[_0xe7ca('0x19')]();};}function respondWithResult(_0x55c1bf,_0x33b7c8){_0x33b7c8=_0x33b7c8||0xc8;return function(_0x4a8173){if(_0x4a8173){return _0x55c1bf['status'](_0x33b7c8)[_0xe7ca('0x1a')](_0x4a8173);}};}function respondWithFilteredResult(_0x289e14,_0x335f54){return function(_0x1c952c){if(_0x1c952c){var _0x1c4f20=typeof _0x335f54[_0xe7ca('0x1b')]===_0xe7ca('0x1c')&&typeof _0x335f54[_0xe7ca('0x1d')]==='undefined';var _0x3b67d8=_0x1c952c['count'];var _0xe49a0a=_0x1c4f20?0x0:_0x335f54['offset'];var _0x5a3d3c=_0x1c4f20?_0x1c952c['count']:_0x335f54[_0xe7ca('0x1b')]+_0x335f54[_0xe7ca('0x1d')];var _0x2512a1;if(_0x5a3d3c>=_0x3b67d8){_0x5a3d3c=_0x3b67d8;_0x2512a1=0xc8;}else{_0x2512a1=0xce;}_0x289e14[_0xe7ca('0x1e')](_0x2512a1);return _0x289e14[_0xe7ca('0x1f')](_0xe7ca('0x20'),_0xe49a0a+'-'+_0x5a3d3c+'/'+_0x3b67d8)[_0xe7ca('0x1a')](_0x1c952c);}return null;};}function patchUpdates(_0x4f91a1){return function(_0x143033){try{jsonpatch[_0xe7ca('0x21')](_0x143033,_0x4f91a1,!![]);}catch(_0x41aa3c){return BPromise[_0xe7ca('0x22')](_0x41aa3c);}return _0x143033[_0xe7ca('0x23')]();};}function saveUpdates(_0xdd4fb8,_0x5c9c9b){return function(_0x4c55b5){if(_0x4c55b5){return _0x4c55b5[_0xe7ca('0x24')](_0xdd4fb8)[_0xe7ca('0x25')](function(_0x3b1118){return _0x3b1118;});}return null;};}function removeEntity(_0x374865,_0x32435a){return function(_0x466628){if(_0x466628){return _0x466628[_0xe7ca('0x26')]()[_0xe7ca('0x25')](function(){_0x374865[_0xe7ca('0x1e')](0xcc)[_0xe7ca('0x19')]();});}};}function handleEntityNotFound(_0x588f5e,_0x2c2c9a){return function(_0x42117a){if(!_0x42117a){_0x588f5e[_0xe7ca('0x18')](0x194);}return _0x42117a;};}function handleError(_0x1a7be8,_0x4ca6ed){_0x4ca6ed=_0x4ca6ed||0x1f4;return function(_0x39e5e5){logger[_0xe7ca('0x27')](_0x39e5e5[_0xe7ca('0x28')]);if(_0x39e5e5['name']){delete _0x39e5e5[_0xe7ca('0x29')];}_0x1a7be8['status'](_0x4ca6ed)[_0xe7ca('0x2a')](_0x39e5e5);};}exports['index']=function(_0x50942b,_0x571c3){var _0x45b3bf={},_0x4e6b23={},_0x3ac989={'count':0x0,'rows':[]};var _0x5eac65=_[_0xe7ca('0x2b')](db[_0xe7ca('0x2c')][_0xe7ca('0x2d')],function(_0x37c900){return{'name':_0x37c900[_0xe7ca('0x2e')],'type':_0x37c900['type'][_0xe7ca('0x2f')]};});_0x4e6b23[_0xe7ca('0x30')]=_[_0xe7ca('0x2b')](_0x5eac65,_0xe7ca('0x29'));_0x4e6b23['query']=_[_0xe7ca('0x31')](_0x50942b[_0xe7ca('0x32')]);_0x4e6b23[_0xe7ca('0x33')]=_['intersection'](_0x4e6b23[_0xe7ca('0x30')],_0x4e6b23[_0xe7ca('0x32')]);_0x45b3bf['attributes']=_['intersection'](_0x4e6b23[_0xe7ca('0x30')],qs['fields'](_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x34')]));_0x45b3bf[_0xe7ca('0x35')]=_0x45b3bf[_0xe7ca('0x35')]['length']?_0x45b3bf[_0xe7ca('0x35')]:_0x4e6b23[_0xe7ca('0x30')];if(!_0x50942b['query'][_0xe7ca('0x36')]('nolimit')){_0x45b3bf[_0xe7ca('0x1d')]=qs[_0xe7ca('0x1d')](_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x1d')]);_0x45b3bf['offset']=qs[_0xe7ca('0x1b')](_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x1b')]);}_0x45b3bf[_0xe7ca('0x37')]=qs[_0xe7ca('0x38')](_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x38')]);_0x45b3bf[_0xe7ca('0x39')]=qs[_0xe7ca('0x33')](_[_0xe7ca('0x3a')](_0x50942b[_0xe7ca('0x32')],_0x4e6b23[_0xe7ca('0x33')]),_0x5eac65);if(_0x50942b['query'][_0xe7ca('0x3b')]){_0x45b3bf[_0xe7ca('0x39')]=_[_0xe7ca('0x3c')](_0x45b3bf[_0xe7ca('0x39')],{'$or':_[_0xe7ca('0x2b')](_0x5eac65,function(_0x5066df){if(_0x5066df[_0xe7ca('0x3d')]!=='VIRTUAL'){var _0x45a661={};_0x45a661[_0x5066df[_0xe7ca('0x29')]]={'$like':'%'+_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x3b')]+'%'};return _0x45a661;}})});}_0x45b3bf=_['merge']({},_0x45b3bf,_0x50942b[_0xe7ca('0x3e')]);var _0x3f9dd4={'where':_0x45b3bf[_0xe7ca('0x39')]};return db['FaxApplication'][_0xe7ca('0x3f')](_0x3f9dd4)[_0xe7ca('0x25')](function(_0x5ef401){_0x3ac989[_0xe7ca('0x3f')]=_0x5ef401;if(_0x50942b['query']['includeAll']){_0x45b3bf[_0xe7ca('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0xe7ca('0x41')](_0x45b3bf);})['then'](function(_0x362b50){_0x3ac989[_0xe7ca('0x42')]=_0x362b50;return _0x3ac989;})[_0xe7ca('0x25')](respondWithFilteredResult(_0x571c3,_0x45b3bf))[_0xe7ca('0x43')](handleError(_0x571c3,null));};exports['show']=function(_0x46c481,_0x43c9c3){var _0x1ae8b6={'raw':!![],'where':{'id':_0x46c481[_0xe7ca('0x44')]['id']}},_0x5b3a13={};_0x5b3a13[_0xe7ca('0x30')]=_[_0xe7ca('0x31')](db[_0xe7ca('0x2c')]['rawAttributes']);_0x5b3a13[_0xe7ca('0x32')]=_[_0xe7ca('0x31')](_0x46c481[_0xe7ca('0x32')]);_0x5b3a13[_0xe7ca('0x33')]=_['intersection'](_0x5b3a13[_0xe7ca('0x30')],_0x5b3a13[_0xe7ca('0x32')]);_0x1ae8b6[_0xe7ca('0x35')]=_[_0xe7ca('0x45')](_0x5b3a13['model'],qs[_0xe7ca('0x34')](_0x46c481[_0xe7ca('0x32')][_0xe7ca('0x34')]));_0x1ae8b6[_0xe7ca('0x35')]=_0x1ae8b6[_0xe7ca('0x35')][_0xe7ca('0x46')]?_0x1ae8b6[_0xe7ca('0x35')]:_0x5b3a13[_0xe7ca('0x30')];if(_0x46c481['query'][_0xe7ca('0x47')]){_0x1ae8b6[_0xe7ca('0x40')]=[{'all':!![]}];}_0x1ae8b6=_[_0xe7ca('0x3c')]({},_0x1ae8b6,_0x46c481[_0xe7ca('0x3e')]);return db[_0xe7ca('0x2c')][_0xe7ca('0x48')](_0x1ae8b6)[_0xe7ca('0x25')](handleEntityNotFound(_0x43c9c3,null))[_0xe7ca('0x25')](respondWithResult(_0x43c9c3,null))[_0xe7ca('0x43')](handleError(_0x43c9c3,null));};exports[_0xe7ca('0x49')]=function(_0x472f64,_0x25eeff){return db[_0xe7ca('0x2c')]['create'](_0x472f64['body'],{})['then'](respondWithResult(_0x25eeff,0xc9))[_0xe7ca('0x43')](handleError(_0x25eeff,null));};exports[_0xe7ca('0x24')]=function(_0x404d65,_0x11fade){if(_0x404d65[_0xe7ca('0x4a')]['id']){delete _0x404d65[_0xe7ca('0x4a')]['id'];}return db[_0xe7ca('0x2c')]['find']({'where':{'id':_0x404d65[_0xe7ca('0x44')]['id']}})['then'](handleEntityNotFound(_0x11fade,null))[_0xe7ca('0x25')](saveUpdates(_0x404d65[_0xe7ca('0x4a')],null))[_0xe7ca('0x25')](respondWithResult(_0x11fade,null))[_0xe7ca('0x43')](handleError(_0x11fade,null));};exports['destroy']=function(_0x170004,_0x150d3e){return db['FaxApplication'][_0xe7ca('0x48')]({'where':{'id':_0x170004[_0xe7ca('0x44')]['id']}})[_0xe7ca('0x25')](handleEntityNotFound(_0x150d3e,null))[_0xe7ca('0x25')](removeEntity(_0x150d3e,null))[_0xe7ca('0x43')](handleError(_0x150d3e,null));}; \ No newline at end of file +var _0xa336=['count','Content-Range','reject','save','update','then','destroy','end','error','stack','send','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','includeAll','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa336,0x71));var _0x6a33=function(_0x3a1f91,_0x15fe8b){_0x3a1f91=_0x3a1f91-0x0;var _0x451178=_0xa336[_0x3a1f91];return _0x451178;};'use strict';var emlformat=require(_0x6a33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a33('0x1'));var jsonpatch=require(_0x6a33('0x2'));var rp=require(_0x6a33('0x3'));var moment=require('moment');var BPromise=require(_0x6a33('0x4'));var Mustache=require(_0x6a33('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6a33('0x6'));var csv=require(_0x6a33('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a33('0x8'));var _=require(_0x6a33('0x9'));var squel=require('squel');var crypto=require(_0x6a33('0xa'));var jsforce=require(_0x6a33('0xb'));var deskjs=require(_0x6a33('0xc'));var toCsv=require(_0x6a33('0x7'));var querystring=require(_0x6a33('0xd'));var Papa=require(_0x6a33('0xe'));var Redis=require(_0x6a33('0xf'));var authService=require(_0x6a33('0x10'));var qs=require(_0x6a33('0x11'));var as=require(_0x6a33('0x12'));var hardwareService=require(_0x6a33('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6a33('0x14'));var config=require(_0x6a33('0x15'));var licenseUtil=require(_0x6a33('0x16'));var db=require(_0x6a33('0x17'))['db'];function respondWithStatusCode(_0x82ddb1,_0x16434c){_0x16434c=_0x16434c||0xcc;return function(_0x125a76){if(_0x125a76){return _0x82ddb1[_0x6a33('0x18')](_0x16434c);}return _0x82ddb1[_0x6a33('0x19')](_0x16434c)['end']();};}function respondWithResult(_0x24ebc7,_0x32f4fd){_0x32f4fd=_0x32f4fd||0xc8;return function(_0x3d901d){if(_0x3d901d){return _0x24ebc7[_0x6a33('0x19')](_0x32f4fd)['json'](_0x3d901d);}};}function respondWithFilteredResult(_0x1c63fa,_0x5c379a){return function(_0x51a9b9){if(_0x51a9b9){var _0x4305ca=typeof _0x5c379a[_0x6a33('0x1a')]===_0x6a33('0x1b')&&typeof _0x5c379a[_0x6a33('0x1c')]===_0x6a33('0x1b');var _0x1f7ec0=_0x51a9b9[_0x6a33('0x1d')];var _0x26a6b3=_0x4305ca?0x0:_0x5c379a[_0x6a33('0x1a')];var _0x455c9=_0x4305ca?_0x51a9b9[_0x6a33('0x1d')]:_0x5c379a[_0x6a33('0x1a')]+_0x5c379a[_0x6a33('0x1c')];var _0x26a187;if(_0x455c9>=_0x1f7ec0){_0x455c9=_0x1f7ec0;_0x26a187=0xc8;}else{_0x26a187=0xce;}_0x1c63fa['status'](_0x26a187);return _0x1c63fa['set'](_0x6a33('0x1e'),_0x26a6b3+'-'+_0x455c9+'/'+_0x1f7ec0)['json'](_0x51a9b9);}return null;};}function patchUpdates(_0x147c46){return function(_0x33390f){try{jsonpatch['apply'](_0x33390f,_0x147c46,!![]);}catch(_0x5834ee){return BPromise[_0x6a33('0x1f')](_0x5834ee);}return _0x33390f[_0x6a33('0x20')]();};}function saveUpdates(_0x497000,_0x1b926f){return function(_0x39481f){if(_0x39481f){return _0x39481f[_0x6a33('0x21')](_0x497000)[_0x6a33('0x22')](function(_0x4a13b8){return _0x4a13b8;});}return null;};}function removeEntity(_0x1d8950,_0x2c63e8){return function(_0xc297b8){if(_0xc297b8){return _0xc297b8[_0x6a33('0x23')]()['then'](function(){_0x1d8950[_0x6a33('0x19')](0xcc)[_0x6a33('0x24')]();});}};}function handleEntityNotFound(_0x647c84,_0x1fea69){return function(_0x4496f6){if(!_0x4496f6){_0x647c84[_0x6a33('0x18')](0x194);}return _0x4496f6;};}function handleError(_0x42ba1e,_0x4f4fb6){_0x4f4fb6=_0x4f4fb6||0x1f4;return function(_0x419a3b){logger[_0x6a33('0x25')](_0x419a3b[_0x6a33('0x26')]);if(_0x419a3b['name']){delete _0x419a3b['name'];}_0x42ba1e[_0x6a33('0x19')](_0x4f4fb6)[_0x6a33('0x27')](_0x419a3b);};}exports[_0x6a33('0x28')]=function(_0x4ab395,_0x46994d){var _0x3d5a72={},_0x247a7f={},_0x3c55e4={'count':0x0,'rows':[]};var _0x5609ca=_['map'](db[_0x6a33('0x29')][_0x6a33('0x2a')],function(_0x474095){return{'name':_0x474095[_0x6a33('0x2b')],'type':_0x474095[_0x6a33('0x2c')][_0x6a33('0x2d')]};});_0x247a7f[_0x6a33('0x2e')]=_[_0x6a33('0x2f')](_0x5609ca,_0x6a33('0x30'));_0x247a7f[_0x6a33('0x31')]=_[_0x6a33('0x32')](_0x4ab395['query']);_0x247a7f[_0x6a33('0x33')]=_[_0x6a33('0x34')](_0x247a7f[_0x6a33('0x2e')],_0x247a7f[_0x6a33('0x31')]);_0x3d5a72['attributes']=_['intersection'](_0x247a7f['model'],qs[_0x6a33('0x35')](_0x4ab395[_0x6a33('0x31')][_0x6a33('0x35')]));_0x3d5a72[_0x6a33('0x36')]=_0x3d5a72[_0x6a33('0x36')][_0x6a33('0x37')]?_0x3d5a72[_0x6a33('0x36')]:_0x247a7f[_0x6a33('0x2e')];if(!_0x4ab395[_0x6a33('0x31')][_0x6a33('0x38')](_0x6a33('0x39'))){_0x3d5a72[_0x6a33('0x1c')]=qs[_0x6a33('0x1c')](_0x4ab395[_0x6a33('0x31')]['limit']);_0x3d5a72[_0x6a33('0x1a')]=qs[_0x6a33('0x1a')](_0x4ab395[_0x6a33('0x31')][_0x6a33('0x1a')]);}_0x3d5a72['order']=qs[_0x6a33('0x3a')](_0x4ab395[_0x6a33('0x31')]['sort']);_0x3d5a72['where']=qs[_0x6a33('0x33')](_[_0x6a33('0x3b')](_0x4ab395[_0x6a33('0x31')],_0x247a7f[_0x6a33('0x33')]),_0x5609ca);if(_0x4ab395[_0x6a33('0x31')][_0x6a33('0x3c')]){_0x3d5a72[_0x6a33('0x3d')]=_[_0x6a33('0x3e')](_0x3d5a72['where'],{'$or':_[_0x6a33('0x2f')](_0x5609ca,function(_0x2b9eb9){if(_0x2b9eb9[_0x6a33('0x2c')]!=='VIRTUAL'){var _0x140fe4={};_0x140fe4[_0x2b9eb9['name']]={'$like':'%'+_0x4ab395[_0x6a33('0x31')][_0x6a33('0x3c')]+'%'};return _0x140fe4;}})});}_0x3d5a72=_[_0x6a33('0x3e')]({},_0x3d5a72,_0x4ab395[_0x6a33('0x3f')]);var _0x379cc0={'where':_0x3d5a72[_0x6a33('0x3d')]};return db[_0x6a33('0x29')]['count'](_0x379cc0)[_0x6a33('0x22')](function(_0x44aae9){_0x3c55e4['count']=_0x44aae9;if(_0x4ab395[_0x6a33('0x31')]['includeAll']){_0x3d5a72[_0x6a33('0x40')]=[{'all':!![]}];}return db[_0x6a33('0x29')]['findAll'](_0x3d5a72);})[_0x6a33('0x22')](function(_0x374f03){_0x3c55e4['rows']=_0x374f03;return _0x3c55e4;})[_0x6a33('0x22')](respondWithFilteredResult(_0x46994d,_0x3d5a72))['catch'](handleError(_0x46994d,null));};exports['show']=function(_0x15eb07,_0x2c8219){var _0x20c3ff={'raw':!![],'where':{'id':_0x15eb07['params']['id']}},_0x56543f={};_0x56543f[_0x6a33('0x2e')]=_[_0x6a33('0x32')](db[_0x6a33('0x29')][_0x6a33('0x2a')]);_0x56543f['query']=_[_0x6a33('0x32')](_0x15eb07['query']);_0x56543f[_0x6a33('0x33')]=_[_0x6a33('0x34')](_0x56543f[_0x6a33('0x2e')],_0x56543f['query']);_0x20c3ff[_0x6a33('0x36')]=_[_0x6a33('0x34')](_0x56543f[_0x6a33('0x2e')],qs[_0x6a33('0x35')](_0x15eb07['query']['fields']));_0x20c3ff[_0x6a33('0x36')]=_0x20c3ff[_0x6a33('0x36')]['length']?_0x20c3ff[_0x6a33('0x36')]:_0x56543f[_0x6a33('0x2e')];if(_0x15eb07[_0x6a33('0x31')][_0x6a33('0x41')]){_0x20c3ff[_0x6a33('0x40')]=[{'all':!![]}];}_0x20c3ff=_[_0x6a33('0x3e')]({},_0x20c3ff,_0x15eb07[_0x6a33('0x3f')]);return db[_0x6a33('0x29')][_0x6a33('0x42')](_0x20c3ff)[_0x6a33('0x22')](handleEntityNotFound(_0x2c8219,null))[_0x6a33('0x22')](respondWithResult(_0x2c8219,null))[_0x6a33('0x43')](handleError(_0x2c8219,null));};exports['create']=function(_0x2263a4,_0x525ad7){return db[_0x6a33('0x29')][_0x6a33('0x44')](_0x2263a4['body'],{})[_0x6a33('0x22')](respondWithResult(_0x525ad7,0xc9))['catch'](handleError(_0x525ad7,null));};exports[_0x6a33('0x21')]=function(_0x4f2fe9,_0x1dd792){if(_0x4f2fe9['body']['id']){delete _0x4f2fe9[_0x6a33('0x45')]['id'];}return db['FaxApplication'][_0x6a33('0x42')]({'where':{'id':_0x4f2fe9[_0x6a33('0x46')]['id']}})[_0x6a33('0x22')](handleEntityNotFound(_0x1dd792,null))[_0x6a33('0x22')](saveUpdates(_0x4f2fe9[_0x6a33('0x45')],null))[_0x6a33('0x22')](respondWithResult(_0x1dd792,null))['catch'](handleError(_0x1dd792,null));};exports['destroy']=function(_0xf0cfda,_0x52e2e5){return db[_0x6a33('0x29')][_0x6a33('0x42')]({'where':{'id':_0xf0cfda[_0x6a33('0x46')]['id']}})[_0x6a33('0x22')](handleEntityNotFound(_0x52e2e5,null))['then'](removeEntity(_0x52e2e5,null))[_0x6a33('0x43')](handleError(_0x52e2e5,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index d20f779..2219a33 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 _0x581f=['request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x1185f0,_0x2e0dae){var _0x11358f=function(_0x319d80){while(--_0x319d80){_0x1185f0['push'](_0x1185f0['shift']());}};_0x11358f(++_0x2e0dae);}(_0x581f,0x11a));var _0xf581=function(_0x53eac2,_0x20c938){_0x53eac2=_0x53eac2-0x0;var _0x5f28e0=_0x581f[_0x53eac2];return _0x5f28e0;};'use strict';var _=require('lodash');var util=require(_0xf581('0x0'));var logger=require(_0xf581('0x1'))(_0xf581('0x2'));var moment=require(_0xf581('0x3'));var BPromise=require('bluebird');var rp=require(_0xf581('0x4'));var fs=require('fs');var path=require(_0xf581('0x5'));var rimraf=require(_0xf581('0x6'));var config=require(_0xf581('0x7'));var attributes=require('./faxApplication.attributes');module[_0xf581('0x8')]=function(_0x34592c,_0x416e31){return _0x34592c[_0xf581('0x9')](_0xf581('0xa'),attributes,{'tableName':_0xf581('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf581('0xc')});}; \ No newline at end of file +var _0x8a62=['rimraf','../../config/environment','exports','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','path'];(function(_0x53775d,_0x589e2d){var _0x213ecd=function(_0x49f0bb){while(--_0x49f0bb){_0x53775d['push'](_0x53775d['shift']());}};_0x213ecd(++_0x589e2d);}(_0x8a62,0xaf));var _0x28a6=function(_0x5d759a,_0x2741b2){_0x5d759a=_0x5d759a-0x0;var _0x207235=_0x8a62[_0x5d759a];return _0x207235;};'use strict';var _=require(_0x28a6('0x0'));var util=require(_0x28a6('0x1'));var logger=require('../../config/logger')(_0x28a6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x28a6('0x3'));var fs=require('fs');var path=require(_0x28a6('0x4'));var rimraf=require(_0x28a6('0x5'));var config=require(_0x28a6('0x6'));var attributes=require('./faxApplication.attributes');module[_0x28a6('0x7')]=function(_0x4476d2,_0x5c7f48){return _0x4476d2['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28a6('0x8'),'collate':_0x28a6('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index aad9450..10cbfe1 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 _0xc7d3=['request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','body','options','raw','where','attributes','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x6cfdd2,_0x65105a){var _0x57d752=function(_0x565e29){while(--_0x565e29){_0x6cfdd2['push'](_0x6cfdd2['shift']());}};_0x57d752(++_0x65105a);}(_0xc7d3,0x8f));var _0x3c7d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc7d3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3c7d('0x0'));var util=require('util');var moment=require(_0x3c7d('0x1'));var BPromise=require(_0x3c7d('0x2'));var rs=require(_0x3c7d('0x3'));var fs=require('fs');var Redis=require(_0x3c7d('0x4'));var db=require(_0x3c7d('0x5'))['db'];var utils=require(_0x3c7d('0x6'));var logger=require(_0x3c7d('0x7'))('rpc');var config=require(_0x3c7d('0x8'));var jayson=require(_0x3c7d('0x9'));var client=jayson[_0x3c7d('0xa')][_0x3c7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36d022,_0x59653c,_0x2ca037){return new BPromise(function(_0x5e9370,_0x374cb8){return client[_0x3c7d('0xc')](_0x36d022,_0x2ca037)['then'](function(_0x3a9fa3){logger[_0x3c7d('0xd')](_0x3c7d('0xe'),_0x59653c,_0x3c7d('0xf'));logger[_0x3c7d('0x10')](_0x3c7d('0x11'),_0x59653c,_0x3c7d('0xf'),JSON[_0x3c7d('0x12')](_0x3a9fa3));if(_0x3a9fa3[_0x3c7d('0x13')]){if(_0x3a9fa3['error']['code']===0x1f4){logger[_0x3c7d('0x13')](_0x3c7d('0xe'),_0x59653c,_0x3a9fa3['error'][_0x3c7d('0x14')]);return _0x374cb8(_0x3a9fa3['error'][_0x3c7d('0x14')]);}logger[_0x3c7d('0x13')](_0x3c7d('0xe'),_0x59653c,_0x3a9fa3[_0x3c7d('0x13')][_0x3c7d('0x14')]);return _0x5e9370(_0x3a9fa3[_0x3c7d('0x13')]['message']);}else{logger['info'](_0x3c7d('0xe'),_0x59653c,_0x3c7d('0xf'));_0x5e9370(_0x3a9fa3[_0x3c7d('0x15')][_0x3c7d('0x14')]);}})[_0x3c7d('0x16')](function(_0x26a40c){logger[_0x3c7d('0x13')](_0x3c7d('0xe'),_0x59653c,_0x26a40c);_0x374cb8(_0x26a40c);});});}exports[_0x3c7d('0x17')]=function(_0xbabbbb){var _0x302a4d=this;return new Promise(function(_0xd618b,_0x5032c0){return db['FaxApplication']['update'](_0xbabbbb[_0x3c7d('0x18')],{'raw':_0xbabbbb[_0x3c7d('0x19')]?_0xbabbbb['options'][_0x3c7d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbabbbb[_0x3c7d('0x19')]?_0xbabbbb['options'][_0x3c7d('0x1b')]||null:null,'attributes':_0xbabbbb[_0x3c7d('0x19')]?_0xbabbbb[_0x3c7d('0x19')][_0x3c7d('0x1c')]||null:null,'limit':_0xbabbbb[_0x3c7d('0x19')]?_0xbabbbb[_0x3c7d('0x19')][_0x3c7d('0x1d')]||null:null})[_0x3c7d('0x1e')](function(_0x1c0d3f){logger[_0x3c7d('0xd')](_0x3c7d('0x17'),_0xbabbbb);logger['debug'](_0x3c7d('0x17'),_0xbabbbb,JSON[_0x3c7d('0x12')](_0x1c0d3f));_0xd618b(_0x1c0d3f);})[_0x3c7d('0x16')](function(_0x1d8878){logger['error'](_0x3c7d('0x17'),_0x1d8878[_0x3c7d('0x14')],_0xbabbbb);_0x5032c0(_0x302a4d['error'](0x1f4,_0x1d8878['message']));});});}; \ No newline at end of file +var _0x8afb=['UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x57d671,_0x1a101c){var _0x450dfe=function(_0x53c457){while(--_0x53c457){_0x57d671['push'](_0x57d671['shift']());}};_0x450dfe(++_0x1a101c);}(_0x8afb,0x172));var _0xb8af=function(_0x5e4f1c,_0x848bf9){_0x5e4f1c=_0x5e4f1c-0x0;var _0x3b8fde=_0x8afb[_0x5e4f1c];return _0x3b8fde;};'use strict';var _=require('lodash');var util=require(_0xb8af('0x0'));var moment=require(_0xb8af('0x1'));var BPromise=require(_0xb8af('0x2'));var rs=require(_0xb8af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8af('0x4'))['db'];var utils=require(_0xb8af('0x5'));var logger=require(_0xb8af('0x6'))('rpc');var config=require(_0xb8af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb8af('0x8')][_0xb8af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1eb081,_0x1c45ad,_0xa77c0e){return new BPromise(function(_0x58b8bf,_0x1747a4){return client[_0xb8af('0xa')](_0x1eb081,_0xa77c0e)[_0xb8af('0xb')](function(_0x7c956f){logger['info'](_0xb8af('0xc'),_0x1c45ad,_0xb8af('0xd'));logger['debug'](_0xb8af('0xe'),_0x1c45ad,_0xb8af('0xd'),JSON[_0xb8af('0xf')](_0x7c956f));if(_0x7c956f[_0xb8af('0x10')]){if(_0x7c956f[_0xb8af('0x10')][_0xb8af('0x11')]===0x1f4){logger['error'](_0xb8af('0xc'),_0x1c45ad,_0x7c956f[_0xb8af('0x10')][_0xb8af('0x12')]);return _0x1747a4(_0x7c956f[_0xb8af('0x10')]['message']);}logger[_0xb8af('0x10')](_0xb8af('0xc'),_0x1c45ad,_0x7c956f[_0xb8af('0x10')][_0xb8af('0x12')]);return _0x58b8bf(_0x7c956f[_0xb8af('0x10')][_0xb8af('0x12')]);}else{logger['info'](_0xb8af('0xc'),_0x1c45ad,_0xb8af('0xd'));_0x58b8bf(_0x7c956f['result'][_0xb8af('0x12')]);}})[_0xb8af('0x13')](function(_0x4c9732){logger[_0xb8af('0x10')](_0xb8af('0xc'),_0x1c45ad,_0x4c9732);_0x1747a4(_0x4c9732);});});}exports[_0xb8af('0x14')]=function(_0x8eabb3){var _0x355eec=this;return new Promise(function(_0x2b1b8b,_0x560fed){return db[_0xb8af('0x15')][_0xb8af('0x16')](_0x8eabb3[_0xb8af('0x17')],{'raw':_0x8eabb3[_0xb8af('0x18')]?_0x8eabb3[_0xb8af('0x18')][_0xb8af('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8eabb3['options']?_0x8eabb3[_0xb8af('0x18')][_0xb8af('0x1a')]||null:null,'attributes':_0x8eabb3[_0xb8af('0x18')]?_0x8eabb3[_0xb8af('0x18')][_0xb8af('0x1b')]||null:null,'limit':_0x8eabb3['options']?_0x8eabb3[_0xb8af('0x18')][_0xb8af('0x1c')]||null:null})['then'](function(_0x250af5){logger[_0xb8af('0x1d')](_0xb8af('0x14'),_0x8eabb3);logger['debug'](_0xb8af('0x14'),_0x8eabb3,JSON['stringify'](_0x250af5));_0x2b1b8b(_0x250af5);})[_0xb8af('0x13')](function(_0x3f6322){logger[_0xb8af('0x10')](_0xb8af('0x14'),_0x3f6322[_0xb8af('0x12')],_0x8eabb3);_0x560fed(_0x355eec['error'](0x1f4,_0x3f6322[_0xb8af('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index a868ffd..22840ad 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./faxApplication.controller','get'];(function(_0x1830ce,_0x305798){var _0x2bce9f=function(_0x9ea7dc){while(--_0x9ea7dc){_0x1830ce['push'](_0x1830ce['shift']());}};_0x2bce9f(++_0x305798);}(_0xda2d,0x102));var _0xdda2=function(_0x290dd4,_0x22ed03){_0x290dd4=_0x290dd4-0x0;var _0x2e8619=_0xda2d[_0x290dd4];return _0x2e8619;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0xb10b=['./faxApplication.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2cdaf4,_0x5186ff){var _0x80bc5c=function(_0x480b44){while(--_0x480b44){_0x2cdaf4['push'](_0x2cdaf4['shift']());}};_0x80bc5c(++_0x5186ff);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e9817,_0xa29439){_0x5e9817=_0x5e9817-0x0;var _0x25b437=_0xb10b[_0x5e9817];return _0x25b437;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index fd7cf4b..fde85ee 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 _0x110d=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x110d,0x17d));var _0xd110=function(_0xb247e3,_0x1319d1){_0xb247e3=_0xb247e3-0x0;var _0x57fb7b=_0x110d[_0xb247e3];return _0x57fb7b;};'use strict';var Sequelize=require(_0xd110('0x0'));module[_0xd110('0x1')]={'closed':{'type':Sequelize[_0xd110('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd110('0x3')]},'disposition':{'type':Sequelize[_0xd110('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd110('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd110('0x3')]},'fax':{'type':Sequelize[_0xd110('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd110('0x5')]('in',_0xd110('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd110('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd110('0x5')]('in',_0xd110('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xcc6e=['STRING','ENUM','out','DATE'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xcc6e,0x1db));var _0xecc6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc6e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xecc6('0x0')]},'disposition':{'type':Sequelize[_0xecc6('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xecc6('0x1')]},'note':{'type':Sequelize[_0xecc6('0x1')]},'read1stAt':{'type':Sequelize[_0xecc6('0x0')]},'fax':{'type':Sequelize[_0xecc6('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xecc6('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xecc6('0x0')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xecc6('0x3')),'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 4e96588..f55d740 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 _0x7764=['Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','show','params','FaxInteraction','include','options','create','describe','FaxMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','findAll','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxInteraction.socket','register','status','end','json','offset','undefined','count','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','waiting','talking','answered','total','closed','UserId','unmanaged','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','o.id\x20=\x20i.UserId','fax_accounts','me.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','split','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','buildExpression','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','user','sequelize','toString','merge','Account.key','a.mandatoryDisposition'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7764,0x120));var _0x4776=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x7764[_0x54b062];return _0x255e41;};'use strict';var emlformat=require(_0x4776('0x0'));var rimraf=require(_0x4776('0x1'));var zipdir=require(_0x4776('0x2'));var jsonpatch=require(_0x4776('0x3'));var rp=require(_0x4776('0x4'));var moment=require(_0x4776('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4776('0x6'));var util=require('util');var path=require(_0x4776('0x7'));var sox=require(_0x4776('0x8'));var csv=require(_0x4776('0x9'));var ejs=require(_0x4776('0xa'));var fs=require('fs');var fs_extra=require(_0x4776('0xb'));var _=require(_0x4776('0xc'));var squel=require('squel');var crypto=require(_0x4776('0xd'));var jsforce=require(_0x4776('0xe'));var deskjs=require(_0x4776('0xf'));var toCsv=require(_0x4776('0x9'));var querystring=require(_0x4776('0x10'));var Papa=require(_0x4776('0x11'));var Redis=require(_0x4776('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4776('0x13'));var as=require(_0x4776('0x14'));var hardwareService=require(_0x4776('0x15'));var logger=require(_0x4776('0x16'))(_0x4776('0x17'));var utils=require(_0x4776('0x18'));var config=require(_0x4776('0x19'));var licenseUtil=require(_0x4776('0x1a'));var db=require(_0x4776('0x1b'))['db'];config[_0x4776('0x1c')]=_['defaults'](config[_0x4776('0x1c')],{'host':_0x4776('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4776('0x1c')]));require(_0x4776('0x1e'))[_0x4776('0x1f')](socket);function respondWithStatusCode(_0x1403b0,_0x512c8c){_0x512c8c=_0x512c8c||0xcc;return function(_0x79ed1a){if(_0x79ed1a){return _0x1403b0['sendStatus'](_0x512c8c);}return _0x1403b0[_0x4776('0x20')](_0x512c8c)[_0x4776('0x21')]();};}function respondWithResult(_0x1c314c,_0x1784e7){_0x1784e7=_0x1784e7||0xc8;return function(_0x38cea2){if(_0x38cea2){return _0x1c314c['status'](_0x1784e7)[_0x4776('0x22')](_0x38cea2);}};}function respondWithFilteredResult(_0x14b382,_0x4855c8){return function(_0x3583a3){if(_0x3583a3){var _0x27b347=typeof _0x4855c8[_0x4776('0x23')]===_0x4776('0x24')&&typeof _0x4855c8['limit']===_0x4776('0x24');var _0x49d68e=_0x3583a3['count'];var _0x4136c1=_0x27b347?0x0:_0x4855c8[_0x4776('0x23')];var _0x206a78=_0x27b347?_0x3583a3[_0x4776('0x25')]:_0x4855c8['offset']+_0x4855c8['limit'];var _0x1beccd;if(_0x206a78>=_0x49d68e){_0x206a78=_0x49d68e;_0x1beccd=0xc8;}else{_0x1beccd=0xce;}_0x14b382[_0x4776('0x20')](_0x1beccd);return _0x14b382['set'](_0x4776('0x26'),_0x4136c1+'-'+_0x206a78+'/'+_0x49d68e)['json'](_0x3583a3);}return null;};}function patchUpdates(_0x22e884){return function(_0x547ea3){try{jsonpatch['apply'](_0x547ea3,_0x22e884,!![]);}catch(_0x57b322){return BPromise['reject'](_0x57b322);}return _0x547ea3[_0x4776('0x27')]();};}function saveUpdates(_0x3316ee,_0x2a7a67){return function(_0x2dfc0c){if(_0x2dfc0c){return _0x2dfc0c[_0x4776('0x28')](_0x3316ee)[_0x4776('0x29')](function(_0x1bce63){return _0x1bce63;});}return null;};}function removeEntity(_0x27b39f,_0x3e40b4){return function(_0x57bd86){if(_0x57bd86){return _0x57bd86[_0x4776('0x2a')]()[_0x4776('0x29')](function(){_0x27b39f['status'](0xcc)[_0x4776('0x21')]();});}};}function handleEntityNotFound(_0x1da0a,_0x1489f9){return function(_0x559d1b){if(!_0x559d1b){_0x1da0a[_0x4776('0x2b')](0x194);}return _0x559d1b;};}function handleError(_0x4b4931,_0x1fd561){_0x1fd561=_0x1fd561||0x1f4;return function(_0x20eb1c){logger['error'](_0x20eb1c[_0x4776('0x2c')]);if(_0x20eb1c['name']){delete _0x20eb1c[_0x4776('0x2d')];}_0x4b4931[_0x4776('0x20')](_0x1fd561)[_0x4776('0x2e')](_0x20eb1c);};}function getInteractionUsers(_0x179a22,_0x4c59b9){return new BPromise(function(_0x171578,_0x1bd8b2){try{if(_0x4c59b9[_0x179a22['id']]){_0x179a22[_0x4776('0x2f')]=_[_0x4776('0x30')](_0x4c59b9[_0x179a22['id']],function(_0x1f7f38){return{'id':_0x1f7f38['id'],'fullname':_0x1f7f38[_0x4776('0x31')]};});}}catch(_0x50b6d8){_0x1bd8b2(_0x50b6d8);}_0x171578(_0x179a22);});}function getInteractionTags(_0xfacf3f,_0x554338){return new BPromise(function(_0x5762e5,_0x2e385a){try{if(_0xfacf3f[_0x4776('0x32')]){_0xfacf3f[_0x4776('0x33')]=[];_0xfacf3f['TagIds']['split'](',')[_0x4776('0x34')](function(_0x50c313){_0xfacf3f[_0x4776('0x33')][_0x4776('0x35')](_0x554338[_0x50c313]);});}delete _0xfacf3f[_0x4776('0x32')];}catch(_0x2ffd5e){_0x2e385a(_0x2ffd5e);}_0x5762e5(_0xfacf3f);});}function updateFaxInteraction(_0x2289d8,_0x1a6078,_0xb301a0){return new BPromise(function(_0x2a9484,_0x5c2d34){return getInteractionUsers(_0x2289d8,_0xb301a0)[_0x4776('0x29')](function(_0xee76b5){return getInteractionTags(_0xee76b5,_0x1a6078);})[_0x4776('0x29')](function(_0x1ed76d){return getStateInteraction(_0x1ed76d);})[_0x4776('0x29')](function(_0x4da301){_0x2a9484(_0x4da301);})['catch'](function(_0x903afb){_0x5c2d34(_0x903afb);});});}function getStateInteraction(_0x3142f6){return new BPromise(function(_0x207f64){_0x3142f6[_0x4776('0x36')]=0x0;_0x3142f6[_0x4776('0x37')]=0x0;_0x3142f6[_0x4776('0x38')]=0x0;_0x3142f6['unmanaged']=0x0;_0x3142f6[_0x4776('0x39')]=0x0;if(!_0x3142f6[_0x4776('0x3a')]&&!_0x3142f6[_0x4776('0x3b')]){_0x3142f6[_0x4776('0x36')]+=0x1;}if(!_0x3142f6[_0x4776('0x3a')]&&_0x3142f6[_0x4776('0x3b')]){_0x3142f6[_0x4776('0x37')]+=0x1;if(_0x3142f6['waiting']){_0x3142f6['waiting']-=0x1;}}if(_0x3142f6[_0x4776('0x3a')]&&_0x3142f6['UserId']){_0x3142f6[_0x4776('0x38')]+=0x1;if(_0x3142f6['talking']){_0x3142f6[_0x4776('0x37')]-=0x1;}}if(_0x3142f6['closed']&&!_0x3142f6[_0x4776('0x3b')]){_0x3142f6[_0x4776('0x3c')]+=0x1;if(_0x3142f6['waiting']){_0x3142f6[_0x4776('0x36')]-=0x1;}}_0x3142f6[_0x4776('0x39')]+=0x1;_0x207f64(_0x3142f6);});}exports['index']=function(_0x2625da,_0x4dd97d){var _0x1637d9={},_0x13c1a2={},_0x220daf={'count':0x0,'rows':[]};var _0x1179c4=_['map'](db['FaxInteraction'][_0x4776('0x3d')],function(_0x10b10b){return{'name':_0x10b10b[_0x4776('0x3e')],'type':_0x10b10b[_0x4776('0x3f')][_0x4776('0x40')]};});_0x13c1a2[_0x4776('0x41')]=_[_0x4776('0x30')](_0x1179c4,_0x4776('0x2d'));_0x13c1a2[_0x4776('0x42')]=_[_0x4776('0x43')](_0x2625da['query']);_0x13c1a2[_0x4776('0x44')]=_[_0x4776('0x45')](_0x13c1a2[_0x4776('0x41')],_0x13c1a2['query']);_0x1637d9[_0x4776('0x46')]=_[_0x4776('0x45')](_0x13c1a2[_0x4776('0x41')],qs['fields'](_0x2625da[_0x4776('0x42')][_0x4776('0x47')]));_0x1637d9[_0x4776('0x46')]=_0x1637d9[_0x4776('0x46')][_0x4776('0x48')]?_0x1637d9[_0x4776('0x46')]:_0x13c1a2[_0x4776('0x41')];if(!_0x2625da['query'][_0x4776('0x49')]('nolimit')){_0x1637d9[_0x4776('0x4a')]=qs[_0x4776('0x4a')](_0x2625da['query'][_0x4776('0x4a')]);_0x1637d9['offset']=qs[_0x4776('0x23')](_0x2625da[_0x4776('0x42')][_0x4776('0x23')]);}_0x1637d9['order']=qs['sort'](_0x2625da['query'][_0x4776('0x4b')]);_0x1637d9[_0x4776('0x4c')]=qs[_0x4776('0x44')](_[_0x4776('0x4d')](_0x2625da[_0x4776('0x42')],_0x13c1a2[_0x4776('0x44')]),_0x1179c4);var _0x83257d=[];var _0xa6a618=squel[_0x4776('0x4e')]()[_0x4776('0x4f')]('id')['field']('name')[_0x4776('0x4f')](_0x4776('0x50'))[_0x4776('0x51')]('tools_tags');var _0x17e18b=squel[_0x4776('0x4e')]()[_0x4776('0x4f')](_0x4776('0x52'))[_0x4776('0x4f')](_0x4776('0x53'))[_0x4776('0x4f')](_0x4776('0x54'))[_0x4776('0x51')](_0x4776('0x55'),'ui')[_0x4776('0x56')](_0x4776('0x57'),'u',_0x4776('0x58'));var _0x26d07f=squel[_0x4776('0x4e')]()[_0x4776('0x51')](_0x4776('0x59'),'i')[_0x4776('0x56')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4776('0x56')](_0x4776('0x57'),'o',_0x4776('0x5a'))[_0x4776('0x56')](_0x4776('0x5b'),'a','a.id\x20=\x20i.FaxAccountId')[_0x4776('0x56')]('fax_messages','me',_0x4776('0x5c'))['left_join']('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x4776('0x5d'),'t',_0x4776('0x5e'));var _0x34a2a5=squel[_0x4776('0x5f')]();var _0xd31b5e=[];var _0x4cecf8=squel[_0x4776('0x5f')]();var _0x50cb2d;if(_0x2625da[_0x4776('0x42')][_0x4776('0x60')]){_0x50cb2d=as['parseSearch'](_0x2625da[_0x4776('0x42')][_0x4776('0x60')]);var _0x549ee7=_0x50cb2d[_0x4776('0x61')];for(var _0x26c72d=0x0;_0x26c72d<_0x50cb2d['conditions'][_0x4776('0x48')];_0x26c72d++){var _0x4537cc=_0x50cb2d[_0x4776('0x62')][_0x26c72d];var _0x1ea373='i';var _0x49c7b0=_[_0x4776('0x63')](_0x1179c4,[_0x4776('0x2d'),_0x4537cc['field']]);if(!_0x49c7b0){switch(_0x4537cc[_0x4776('0x4f')]){case _0x4776('0x64'):if(_0x4537cc[_0x4776('0x65')]==0x1){_0x26d07f['having']('`'+_0x4537cc['field']+_0x4776('0x66'));}else{_0x26d07f[_0x4776('0x67')]('`'+_0x4537cc['field']+_0x4776('0x68'));}break;case _0x4776('0x69'):if(_0x4537cc[_0x4776('0x6a')]==='$substring'){if(_0x4537cc['value'][_0x4776('0x6b')]('\x20')[_0x4776('0x48')]>0x1){_0x34a2a5[_0x549ee7](_0x4776('0x6c'),qs['getFullTextValue'](_0x4537cc[_0x4776('0x65')]),null);}else{var _0x1e82f1='%'+_0x4537cc[_0x4776('0x65')]+'%';_0x34a2a5[_0x549ee7](_0x4776('0x6d'),_0x1e82f1,_0x1e82f1,_0x1e82f1);}}else{_0x49c7b0=_['find'](_0x1179c4,['name',_0x4776('0x6e')]);_0x4537cc[_0x4776('0x4f')]=_0x4776('0x6e');_0x338da7=as[_0x4776('0x6f')](_0x1ea373,_0x49c7b0[_0x4776('0x3f')],_0x4537cc);_0x34a2a5[_0x549ee7](_0x338da7['text'],_0x338da7[_0x4776('0x65')][_0x4776('0x70')],_0x338da7['value']['end']);}break;case _0x4776('0x71'):var _0x429069=_0x4537cc[_0x4776('0x65')][_0x4776('0x6b')](',')[_0x4776('0x30')](function(_0x48f00d){return Number(_0x48f00d);});_0x429069[_0x4776('0x34')](function(_0x13eb11){_0x4cecf8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13eb11+',%');});_0xd31b5e=_[_0x4776('0x72')](_0xd31b5e,_0x429069);break;case'User':if(_0x4537cc[_0x4776('0x6a')]===_0x4776('0x73')){_0x34a2a5[_0x549ee7](_0x4776('0x74'),'%'+_0x4537cc[_0x4776('0x65')]+'%',null);}else{_0x49c7b0=_[_0x4776('0x63')](_0x1179c4,['name','UserId']);_0x4537cc[_0x4776('0x4f')]='UserId';_0x338da7=as[_0x4776('0x6f')](_0x1ea373,_0x49c7b0[_0x4776('0x3f')],_0x4537cc);_0x34a2a5[_0x549ee7](_0x338da7[_0x4776('0x75')],_0x338da7[_0x4776('0x65')]['start'],_0x338da7[_0x4776('0x65')][_0x4776('0x21')]);}break;case _0x4776('0x76'):_0x338da7=as[_0x4776('0x6f')]('me',null,_0x4537cc);_0x34a2a5[_0x549ee7](_0x338da7[_0x4776('0x75')],_0x338da7[_0x4776('0x65')][_0x4776('0x70')],_0x338da7['value'][_0x4776('0x21')]);break;}}else{var _0x338da7=as[_0x4776('0x6f')](_0x1ea373,_0x49c7b0[_0x4776('0x3f')],_0x4537cc);_0x34a2a5[_0x549ee7](_0x338da7[_0x4776('0x75')],_0x338da7[_0x4776('0x65')][_0x4776('0x70')],_0x338da7['value'][_0x4776('0x21')]);}}}else{var _0x1ecb17=_(_0x2625da[_0x4776('0x42')])[_0x4776('0x43')]()['map'](function(_0x5ee2fd){return _[_0x4776('0x77')](_0x1179c4,[_0x4776('0x2d'),_0x5ee2fd])?_0x5ee2fd:undefined;})[_0x4776('0x78')]()['value']();if(!_[_0x4776('0x79')](_0x1ecb17)){_0x1ecb17[_0x4776('0x34')](function(_0x34bffa){if(_0x34bffa===_0x4776('0x7a')){_0x26d07f[_0x4776('0x4c')](_0x4776('0x7b'),[][_0x4776('0x7c')](_0x2625da[_0x4776('0x42')][_0x34bffa]));}else if(_0x34bffa==='createdAt'){var _0x129930=JSON[_0x4776('0x7d')](_0x2625da['query'][_0x34bffa])[_0x4776('0x7e')];var _0x52e4d3=JSON[_0x4776('0x7d')](_0x2625da[_0x4776('0x42')][_0x34bffa])[_0x4776('0x7f')];_0x26d07f[_0x4776('0x4c')](_0x4776('0x80'),_0x129930,_0x52e4d3);}else{if(_0x2625da[_0x4776('0x42')][_0x34bffa]==='null'){_0x26d07f[_0x4776('0x4c')]('i.'+_0x34bffa+_0x4776('0x81'));}else{_0x26d07f[_0x4776('0x4c')]('i.'+_0x34bffa+_0x4776('0x82'),_0x2625da['query'][_0x34bffa]);}}});}if(_0x2625da['query']['read']){if(_0x2625da['query'][_0x4776('0x83')]==0x1){_0x26d07f[_0x4776('0x67')](_0x4776('0x84'));}else{_0x26d07f[_0x4776('0x67')](_0x4776('0x85'));}}if(_0x2625da['query'][_0x4776('0x86')]){_0xd31b5e=_[_0x4776('0x87')](_0x2625da[_0x4776('0x42')][_0x4776('0x86')])?_0x2625da[_0x4776('0x42')][_0x4776('0x86')]:new Array(_0x2625da[_0x4776('0x42')][_0x4776('0x86')]);_0xd31b5e['forEach'](function(_0x4de351){_0x4cecf8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4de351+',%');});}if(_0x2625da[_0x4776('0x42')][_0x4776('0x88')]){var _0x513f0c=_0x2625da['query'][_0x4776('0x88')][_0x4776('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x513f0c)){_0x34a2a5['or'](_0x4776('0x8a'),_0x513f0c+'%')['or'](_0x4776('0x8b'),_0x513f0c+'%');}_0x34a2a5['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x513f0c+'%');}}_0x26d07f[_0x4776('0x4c')](_0x34a2a5);_0x26d07f[_0x4776('0x8c')]('i.id');var _0x3f6332={'type':db['Sequelize'][_0x4776('0x8d')]['SELECT'],'raw':!![]};var _0x324e4b=_0x26d07f['clone']();_0x324e4b[_0x4776('0x4f')]('i.id');_0x324e4b['field'](_0x4776('0x8e'),'unreadMessages');if(_0x1637d9[_0x4776('0x8f')]){_0x1637d9[_0x4776('0x8f')][_0x4776('0x34')](function(_0xc451bf){var _0x34e18a=_0xc451bf[0x0]==='contactName'?_0xc451bf[0x0]:'i.'+_0xc451bf[0x0];_0x26d07f['order'](_0x34e18a,_0xc451bf[0x1]===_0x4776('0x90')?![]:!![]);});}if(!_[_0x4776('0x79')](_0xd31b5e)){_0x26d07f[_0x4776('0x67')](_0x4cecf8);_0x324e4b[_0x4776('0x4c')](_0x4776('0x91'),_0xd31b5e);}BPromise[_0x4776('0x92')]()[_0x4776('0x29')](function(){if(!_0x50cb2d){if(_0x2625da[_0x4776('0x42')]['FaxAccountId'])return;_0x324e4b[_0x4776('0x4c')](_0x4776('0x93'));_0x26d07f[_0x4776('0x4c')](_0x4776('0x93'));return;}if(_0x2625da['user'][_0x4776('0x94')]!==_0x4776('0x95'))return;return _0x2625da['user'][_0x4776('0x96')]({'attributes':['id'],'raw':!![]})[_0x4776('0x29')](function(_0x4de273){if(_['isEmpty'](_0x4de273)){_0x324e4b[_0x4776('0x4c')]('i.FaxAccountId\x20IS\x20NULL');_0x26d07f[_0x4776('0x4c')](_0x4776('0x97'));}else{_0x324e4b[_0x4776('0x4c')](_0x4776('0x7b'),_[_0x4776('0x30')](_0x4de273,'id'));_0x26d07f[_0x4776('0x4c')](_0x4776('0x7b'),_[_0x4776('0x30')](_0x4de273,'id'));}});})[_0x4776('0x29')](function(){if(_0x2625da[_0x4776('0x98')][_0x4776('0x94')]===_0x4776('0x95')&&!_0x50cb2d&&!_0x2625da[_0x4776('0x42')][_0x4776('0x7a')])return[];return db[_0x4776('0x99')]['query'](_0x324e4b[_0x4776('0x9a')](),_0x3f6332);})[_0x4776('0x29')](function(_0x3e41b7){_0x220daf[_0x4776('0x25')]=_0x3e41b7['length'];if(_0x220daf[_0x4776('0x25')]===0x0)return[];return db['sequelize'][_0x4776('0x42')](_0xa6a618[_0x4776('0x9a')](),_0x3f6332)['then'](function(_0x2170ea){_0x83257d=_['keyBy'](_0x2170ea,'id');_0x3f6332=_[_0x4776('0x9b')](_0x3f6332,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2625da[_0x4776('0x42')][_0x4776('0x47')]){_0x1637d9[_0x4776('0x46')]['forEach'](function(_0x557b63){_0x26d07f['field']('i.'+_0x557b63);});}else{_0x26d07f[_0x4776('0x4f')](_0x4776('0x8e'),'unreadMessages');_0x26d07f[_0x4776('0x4f')]('a.key',_0x4776('0x9c'));_0x26d07f[_0x4776('0x4f')](_0x4776('0x9d'),_0x4776('0x9e'));_0x26d07f[_0x4776('0x4f')](_0x4776('0x9f'),_0x4776('0xa0'));_0x26d07f[_0x4776('0x4f')]('i.*');_0x26d07f['field']('c.firstName','Contact.firstName');_0x26d07f[_0x4776('0x4f')](_0x4776('0xa1'),_0x4776('0xa2'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xa3'),_0x4776('0xa4'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xa5'),_0x4776('0xa6'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xa7'),_0x4776('0xa8'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xa9'),_0x4776('0xaa'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xab'),_0x4776('0xac'));_0x26d07f['field'](_0x4776('0xad'),_0x4776('0xae'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xaf'),_0x4776('0x32'));}if(_0x1637d9[_0x4776('0x4a')])_0x26d07f['limit'](_0x1637d9[_0x4776('0x4a')]);if(_0x1637d9[_0x4776('0x23')])_0x26d07f[_0x4776('0x23')](_0x1637d9['offset']);return db[_0x4776('0x99')][_0x4776('0x42')](_0x26d07f[_0x4776('0x9a')](),_0x3f6332);})[_0x4776('0x29')](function(_0x85d7db){if(_0x85d7db[_0x4776('0x48')]>0x0)_0x17e18b['where'](_0x4776('0xb0'),_[_0x4776('0x30')](_0x85d7db,'id'));return db[_0x4776('0x99')][_0x4776('0x42')](_0x17e18b[_0x4776('0x9a')](),_0x3f6332)[_0x4776('0x29')](function(_0x3ac706){var _0x52aa1c=_[_0x4776('0xb1')](_0x3ac706,_0x4776('0xb2'));var _0x1b1f2b=[];_0x85d7db[_0x4776('0x34')](function(_0x8fec5e){_0x1b1f2b[_0x4776('0x35')](updateFaxInteraction(_0x8fec5e,_0x83257d,_0x52aa1c));});return BPromise[_0x4776('0xb3')](_0x1b1f2b);});});})['then'](function(_0x539e9c){_0x220daf[_0x4776('0xb4')]=_0x539e9c;return _0x220daf;})[_0x4776('0x29')](respondWithFilteredResult(_0x4dd97d,_0x1637d9))[_0x4776('0xb5')](handleError(_0x4dd97d,null));};exports[_0x4776('0xb6')]=function(_0x4c00ad,_0x3145d0){var _0x1661e1={'raw':![],'where':{'id':_0x4c00ad[_0x4776('0xb7')]['id']}},_0x1266d6={};_0x1266d6[_0x4776('0x41')]=_[_0x4776('0x43')](db[_0x4776('0xb8')][_0x4776('0x3d')]);_0x1266d6[_0x4776('0x42')]=_[_0x4776('0x43')](_0x4c00ad[_0x4776('0x42')]);_0x1266d6['filters']=_[_0x4776('0x45')](_0x1266d6[_0x4776('0x41')],_0x1266d6[_0x4776('0x42')]);_0x1661e1['attributes']=_[_0x4776('0x45')](_0x1266d6['model'],qs['fields'](_0x4c00ad['query'][_0x4776('0x47')]));_0x1661e1[_0x4776('0x46')]=_0x1661e1[_0x4776('0x46')][_0x4776('0x48')]?_0x1661e1[_0x4776('0x46')]:_0x1266d6[_0x4776('0x41')];if(_0x4c00ad[_0x4776('0x42')]['includeAll']){_0x1661e1[_0x4776('0xb9')]=[{'all':!![]}];}_0x1661e1=_['merge']({},_0x1661e1,_0x4c00ad[_0x4776('0xba')]);return db[_0x4776('0xb8')][_0x4776('0x63')](_0x1661e1)[_0x4776('0x29')](handleEntityNotFound(_0x3145d0,null))[_0x4776('0x29')](respondWithResult(_0x3145d0,null))[_0x4776('0xb5')](handleError(_0x3145d0,null));};exports[_0x4776('0xbb')]=function(_0x59d21f,_0x290db2){return db['FaxInteraction'][_0x4776('0xbb')](_0x59d21f[_0x4776('0x76')],{})[_0x4776('0x29')](respondWithResult(_0x290db2,0xc9))[_0x4776('0xb5')](handleError(_0x290db2,null));};exports['update']=function(_0xdb37a7,_0x1849d7){if(_0xdb37a7[_0x4776('0x76')]['id']){delete _0xdb37a7[_0x4776('0x76')]['id'];}return db[_0x4776('0xb8')][_0x4776('0x63')]({'where':{'id':_0xdb37a7[_0x4776('0xb7')]['id']}})[_0x4776('0x29')](handleEntityNotFound(_0x1849d7,null))[_0x4776('0x29')](saveUpdates(_0xdb37a7[_0x4776('0x76')],null))[_0x4776('0x29')](respondWithResult(_0x1849d7,null))[_0x4776('0xb5')](handleError(_0x1849d7,null));};exports[_0x4776('0x2a')]=function(_0x542150,_0x262f9a){return db[_0x4776('0xb8')][_0x4776('0x63')]({'where':{'id':_0x542150[_0x4776('0xb7')]['id']}})['then'](handleEntityNotFound(_0x262f9a,null))[_0x4776('0x29')](removeEntity(_0x262f9a,null))[_0x4776('0xb5')](handleError(_0x262f9a,null));};exports[_0x4776('0xbc')]=function(_0x475fd3,_0x2e8de1){return db[_0x4776('0xb8')][_0x4776('0xbc')]()[_0x4776('0x29')](respondWithResult(_0x2e8de1,null))[_0x4776('0xb5')](handleError(_0x2e8de1,null));};exports['addMessage']=function(_0x40957b,_0x5b02b1,_0x157190){return db[_0x4776('0xbd')][_0x4776('0x63')]({'where':{'id':_0x40957b['params']['id']}})['then'](handleEntityNotFound(_0x5b02b1,null))[_0x4776('0x29')](function(_0x13f28e){if(_0x13f28e){return _0x13f28e['addMessage'](_0x40957b['body'][_0x4776('0xbe')],_[_0x4776('0xbf')](_0x40957b[_0x4776('0x76')],[_0x4776('0xbe'),'id'])||{});}})[_0x4776('0x29')](respondWithResult(_0x5b02b1,null))[_0x4776('0xb5')](handleError(_0x5b02b1,null));};exports[_0x4776('0xc0')]=function(_0x2e6427,_0x7dd36e,_0x4905b2){var _0xb00640={'raw':![],'where':{}};var _0x37fe90={};var _0x314987={'count':0x0,'rows':[]};return db[_0x4776('0xb8')][_0x4776('0xc1')]({'where':{'id':_0x2e6427[_0x4776('0xb7')]['id']}})[_0x4776('0x29')](handleEntityNotFound(_0x7dd36e,null))[_0x4776('0x29')](function(_0x599076){if(_0x599076){_0x37fe90[_0x4776('0x41')]=_['keys'](db[_0x4776('0xbd')][_0x4776('0x3d')]);_0x37fe90[_0x4776('0x42')]=_['keys'](_0x2e6427[_0x4776('0x42')]);_0x37fe90['filters']=_[_0x4776('0x45')](_0x37fe90[_0x4776('0x41')],_0x37fe90[_0x4776('0x42')]);_0xb00640[_0x4776('0x46')]=_[_0x4776('0x45')](_0x37fe90[_0x4776('0x41')],qs['fields'](_0x2e6427['query']['fields']));_0xb00640[_0x4776('0x46')]=_0xb00640[_0x4776('0x46')][_0x4776('0x48')]?_0xb00640[_0x4776('0x46')]:_0x37fe90[_0x4776('0x41')];if(!_0x2e6427[_0x4776('0x42')]['hasOwnProperty'](_0x4776('0xc2'))){_0xb00640[_0x4776('0x4a')]=qs[_0x4776('0x4a')](_0x2e6427[_0x4776('0x42')][_0x4776('0x4a')]);_0xb00640['offset']=qs['offset'](_0x2e6427[_0x4776('0x42')][_0x4776('0x23')]);}_0xb00640[_0x4776('0x8f')]=qs[_0x4776('0x4b')](_0x2e6427[_0x4776('0x42')][_0x4776('0x4b')]);_0xb00640[_0x4776('0x4c')]=qs[_0x4776('0x44')](_[_0x4776('0x4d')](_0x2e6427[_0x4776('0x42')],_0x37fe90[_0x4776('0x44')]));_0xb00640[_0x4776('0x4c')][_0x4776('0xb2')]=_0x599076['id'];if(_0x2e6427[_0x4776('0x42')]['filter']){_0xb00640[_0x4776('0x4c')]=_[_0x4776('0x9b')](_0xb00640[_0x4776('0x4c')],{'$or':_[_0x4776('0x30')](_0xb00640[_0x4776('0x46')],function(_0x210d60){var _0x3c52f9={};_0x3c52f9[_0x210d60]={'$like':'%'+_0x2e6427[_0x4776('0x42')][_0x4776('0x88')]+'%'};return _0x3c52f9;})});}if(_0x2e6427[_0x4776('0x42')]['$gte']){var _0x48c400=_0x2e6427[_0x4776('0x42')][_0x4776('0x7e')][_0x4776('0x6b')](',');var _0x43b923={};_0x43b923[_0x48c400[0x0]]={'$gte':moment(_0x48c400[0x1])[_0x4776('0xc3')](_0x4776('0xc4'))};_0xb00640['where']=_[_0x4776('0x9b')](_0xb00640[_0x4776('0x4c')],_0x43b923);}_0xb00640=_[_0x4776('0x9b')]({},_0xb00640,_0x2e6427[_0x4776('0xba')]);return db[_0x4776('0xbd')][_0x4776('0x25')]({'where':_0xb00640['where']})[_0x4776('0x29')](function(_0x240142){_0x314987[_0x4776('0x25')]=_0x240142;if(_0x2e6427[_0x4776('0x42')][_0x4776('0xc5')]){_0xb00640[_0x4776('0xb9')]=[{'all':!![]}];}return db[_0x4776('0xbd')]['findAll'](_0xb00640);})[_0x4776('0x29')](function(_0x2990a9){_0x314987[_0x4776('0xb4')]=_0x2990a9;return _0x314987;});}})[_0x4776('0x29')](respondWithFilteredResult(_0x7dd36e,_0xb00640))['catch'](handleError(_0x7dd36e,null));};exports[_0x4776('0xc6')]=function(_0x315e69,_0x5b02b0,_0x3ab1a2){return db[_0x4776('0xb8')]['find']({'where':{'id':_0x315e69[_0x4776('0xb7')]['id']}})[_0x4776('0x29')](handleEntityNotFound(_0x5b02b0,null))['then'](function(_0x3d30ad){if(_0x3d30ad){return _0x3d30ad['setTags'](_0x315e69[_0x4776('0x76')]['ids'],_['omit'](_0x315e69['body'],[_0x4776('0xbe'),'id'])||{})['spread'](function(){return db[_0x4776('0x71')][_0x4776('0xc7')]({'attributes':['id',_0x4776('0x2d'),_0x4776('0x50')],'where':{'id':_0x315e69[_0x4776('0x76')][_0x4776('0xbe')]}});})[_0x4776('0x29')](function(_0x55c049){socket[_0x4776('0xc8')](_0x4776('0xc9'),{'id':Number(_0x315e69[_0x4776('0xb7')]['id']),'tags':_0x55c049||[]});return{'id':Number(_0x315e69[_0x4776('0xb7')]['id']),'tags':_0x55c049||[]};});}})[_0x4776('0x29')](respondWithResult(_0x5b02b0,null))[_0x4776('0xb5')](handleError(_0x5b02b0,null));};exports[_0x4776('0xca')]=function(_0x1269dc,_0x23a21b,_0x151973){return db[_0x4776('0xb8')][_0x4776('0x63')]({'where':{'id':_0x1269dc[_0x4776('0xb7')]['id']}})[_0x4776('0x29')](handleEntityNotFound(_0x23a21b,null))[_0x4776('0x29')](function(_0x5a27ba){if(_0x5a27ba){return _0x5a27ba[_0x4776('0xca')](_0x1269dc[_0x4776('0x42')]['ids']);}})[_0x4776('0x29')](respondWithStatusCode(_0x23a21b,null))[_0x4776('0xb5')](handleError(_0x23a21b,null));};exports[_0x4776('0xcb')]=function(_0x197432,_0x3c9ee0){var _0x283ef0=moment()[_0x4776('0xcc')]()['toString']();var _0xf555a0=path[_0x4776('0xcd')](config[_0x4776('0xce')],_0x4776('0xcf'),'files',_0x4776('0xd0'));var _0x36afe1=path[_0x4776('0xcd')](config[_0x4776('0xce')],'server','files',_0x4776('0xd1'));var _0x40cf9a=path[_0x4776('0xcd')](_0xf555a0,_0x283ef0);var _0x4f741d=util['format'](_0x4776('0xd2'),_0x197432['params']['id'],_0x283ef0);var _0x168fda=path[_0x4776('0xcd')](_0xf555a0,_0x4f741d);var _0x1fcbeb=[];_0x1fcbeb[_0x4776('0x35')]({'model':db[_0x4776('0xd3')],'as':'Attachment','raw':!![]});var _0x35b767=[{'model':db[_0x4776('0xbd')],'as':_0x4776('0xd4'),'attributes':['id',_0x4776('0x76'),_0x4776('0xd5')],'include':_0x1fcbeb}];return db[_0x4776('0xb8')][_0x4776('0x63')]({'where':{'id':_0x197432[_0x4776('0xb7')]['id']},'include':_0x35b767})[_0x4776('0x29')](handleEntityNotFound(_0x3c9ee0,null))[_0x4776('0x29')](function(_0x58ddcd){if(_0x58ddcd&&_0x58ddcd[_0x4776('0xd4')]){var _0xba7a75=_0x58ddcd[_0x4776('0xd6')]({'plain':!![]});fs[_0x4776('0xd7')](_0x40cf9a);for(var _0x2a2619=0x0;_0x2a2619<_0xba7a75[_0x4776('0xd4')]['length'];_0x2a2619++){var _0x404c76=_0xba7a75[_0x4776('0xd4')][_0x2a2619]['Attachment'];if(_0x404c76){var _0x442f7a=path[_0x4776('0xcd')](_0x36afe1,_0x404c76[_0x4776('0xd8')]);if(fs[_0x4776('0xd9')](_0x442f7a)){fs[_0x4776('0xda')](_0x442f7a)['pipe'](fs[_0x4776('0xdb')](path[_0x4776('0xcd')](_0x40cf9a,_0x404c76[_0x4776('0xd8')])));}}}return BPromise[_0x4776('0x92')]()['then'](function(){return new BPromise(function(_0x3e29b,_0x1eb298){zipdir(_0x40cf9a,{'saveTo':_0x168fda},function(_0x403552,_0xb4106){if(_0x403552)return _0x1eb298(_0x403552);return _0x3e29b(_0xb4106);});})[_0x4776('0x29')](function(){return new BPromise(function(_0x2733bf,_0xfc57fa){rimraf(_0x40cf9a,function(_0x38cbbc){if(_0x38cbbc)_0xfc57fa(_0x38cbbc);return _0x2733bf();});});})[_0x4776('0x29')](function(){return _0x3c9ee0[_0x4776('0xcb')](_0x168fda,_0x4f741d,function(_0x4d9bec){if(_0x4d9bec){console[_0x4776('0xdc')](_0x4776('0xdd'),_0x4d9bec);}else{fs[_0x4776('0xde')](_0x168fda);}});});});}else{return _0x3c9ee0[_0x4776('0x2b')](0xc8);}})[_0x4776('0xb5')](handleError(_0x3c9ee0,null));}; \ No newline at end of file +var _0xc2c1=['c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','groupBy','all','show','params','includeAll','include','merge','options','create','update','destroy','describe','addMessage','omit','ids','getMessages','FaxMessage','nolimit','FaxInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','faxInteractionTags:save','removeTags','unix','files','join','root','server','attachments','transcript-%d-%s.zip','Attachment','Messages','basename','existsSync','createReadStream','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','undefined','count','offset','json','reject','then','sendStatus','stack','name','Users','fullname','TagIds','split','forEach','Tags','push','catch','waiting','answered','total','closed','UserId','talking','unmanaged','map','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','operator','$substring','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','buildExpression','start','end','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','isEmpty','FaxAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName'];(function(_0xe1a964,_0x5ec09d){var _0x3de37b=function(_0x406ffc){while(--_0x406ffc){_0xe1a964['push'](_0xe1a964['shift']());}};_0x3de37b(++_0x5ec09d);}(_0xc2c1,0x1ed));var _0x1c2c=function(_0x24f022,_0x138a49){_0x24f022=_0x24f022-0x0;var _0x5a19f5=_0xc2c1[_0x24f022];return _0x5a19f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c2c('0x0'));var zipdir=require(_0x1c2c('0x1'));var jsonpatch=require(_0x1c2c('0x2'));var rp=require(_0x1c2c('0x3'));var moment=require(_0x1c2c('0x4'));var BPromise=require(_0x1c2c('0x5'));var Mustache=require('mustache');var util=require(_0x1c2c('0x6'));var path=require(_0x1c2c('0x7'));var sox=require(_0x1c2c('0x8'));var csv=require('to-csv');var ejs=require(_0x1c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x1c2c('0xa'));var _=require(_0x1c2c('0xb'));var squel=require(_0x1c2c('0xc'));var crypto=require(_0x1c2c('0xd'));var jsforce=require(_0x1c2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1c2c('0xf'));var querystring=require(_0x1c2c('0x10'));var Papa=require(_0x1c2c('0x11'));var Redis=require(_0x1c2c('0x12'));var authService=require(_0x1c2c('0x13'));var qs=require(_0x1c2c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c2c('0x15'));var logger=require(_0x1c2c('0x16'))(_0x1c2c('0x17'));var utils=require(_0x1c2c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1c2c('0x19'));var db=require(_0x1c2c('0x1a'))['db'];config[_0x1c2c('0x1b')]=_[_0x1c2c('0x1c')](config[_0x1c2c('0x1b')],{'host':_0x1c2c('0x1d'),'port':0x18eb});var socket=require(_0x1c2c('0x1e'))(new Redis(config[_0x1c2c('0x1b')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5b19f8,_0x3b67cb){_0x3b67cb=_0x3b67cb||0xcc;return function(_0x48d62a){if(_0x48d62a){return _0x5b19f8['sendStatus'](_0x3b67cb);}return _0x5b19f8[_0x1c2c('0x1f')](_0x3b67cb)['end']();};}function respondWithResult(_0x39f87,_0x3fe214){_0x3fe214=_0x3fe214||0xc8;return function(_0x589ffc){if(_0x589ffc){return _0x39f87[_0x1c2c('0x1f')](_0x3fe214)['json'](_0x589ffc);}};}function respondWithFilteredResult(_0x410e7b,_0x525beb){return function(_0x134235){if(_0x134235){var _0x4a979c=typeof _0x525beb['offset']===_0x1c2c('0x20')&&typeof _0x525beb['limit']==='undefined';var _0x551885=_0x134235[_0x1c2c('0x21')];var _0x31b226=_0x4a979c?0x0:_0x525beb['offset'];var _0x573415=_0x4a979c?_0x134235[_0x1c2c('0x21')]:_0x525beb[_0x1c2c('0x22')]+_0x525beb['limit'];var _0x1c28d6;if(_0x573415>=_0x551885){_0x573415=_0x551885;_0x1c28d6=0xc8;}else{_0x1c28d6=0xce;}_0x410e7b['status'](_0x1c28d6);return _0x410e7b['set']('Content-Range',_0x31b226+'-'+_0x573415+'/'+_0x551885)[_0x1c2c('0x23')](_0x134235);}return null;};}function patchUpdates(_0x17580c){return function(_0x26aa1b){try{jsonpatch['apply'](_0x26aa1b,_0x17580c,!![]);}catch(_0x1e28a5){return BPromise[_0x1c2c('0x24')](_0x1e28a5);}return _0x26aa1b['save']();};}function saveUpdates(_0x3d1a7d,_0x2a3c0f){return function(_0x244fe6){if(_0x244fe6){return _0x244fe6['update'](_0x3d1a7d)[_0x1c2c('0x25')](function(_0x32ffca){return _0x32ffca;});}return null;};}function removeEntity(_0x319c0b,_0x2829bb){return function(_0x3ae0a9){if(_0x3ae0a9){return _0x3ae0a9['destroy']()[_0x1c2c('0x25')](function(){_0x319c0b[_0x1c2c('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f16e5,_0x5893be){return function(_0x19e466){if(!_0x19e466){_0x1f16e5[_0x1c2c('0x26')](0x194);}return _0x19e466;};}function handleError(_0x348fbc,_0x4846d4){_0x4846d4=_0x4846d4||0x1f4;return function(_0x419ad5){logger['error'](_0x419ad5[_0x1c2c('0x27')]);if(_0x419ad5[_0x1c2c('0x28')]){delete _0x419ad5[_0x1c2c('0x28')];}_0x348fbc['status'](_0x4846d4)['send'](_0x419ad5);};}function getInteractionUsers(_0x56bdb8,_0x57f940){return new BPromise(function(_0x2c536a,_0x28bca1){try{if(_0x57f940[_0x56bdb8['id']]){_0x56bdb8[_0x1c2c('0x29')]=_['map'](_0x57f940[_0x56bdb8['id']],function(_0x160a80){return{'id':_0x160a80['id'],'fullname':_0x160a80[_0x1c2c('0x2a')]};});}}catch(_0x257327){_0x28bca1(_0x257327);}_0x2c536a(_0x56bdb8);});}function getInteractionTags(_0x4dbae5,_0x4b2998){return new BPromise(function(_0x4b9fad,_0x19d729){try{if(_0x4dbae5['TagIds']){_0x4dbae5['Tags']=[];_0x4dbae5[_0x1c2c('0x2b')][_0x1c2c('0x2c')](',')[_0x1c2c('0x2d')](function(_0x48b8fd){_0x4dbae5[_0x1c2c('0x2e')][_0x1c2c('0x2f')](_0x4b2998[_0x48b8fd]);});}delete _0x4dbae5[_0x1c2c('0x2b')];}catch(_0x5a9b0b){_0x19d729(_0x5a9b0b);}_0x4b9fad(_0x4dbae5);});}function updateFaxInteraction(_0x20de2e,_0xcbda94,_0x3f6b5d){return new BPromise(function(_0x598141,_0x3c3fa5){return getInteractionUsers(_0x20de2e,_0x3f6b5d)[_0x1c2c('0x25')](function(_0x443c4e){return getInteractionTags(_0x443c4e,_0xcbda94);})[_0x1c2c('0x25')](function(_0x8b5fc8){return getStateInteraction(_0x8b5fc8);})[_0x1c2c('0x25')](function(_0x317979){_0x598141(_0x317979);})[_0x1c2c('0x30')](function(_0x21e5a){_0x3c3fa5(_0x21e5a);});});}function getStateInteraction(_0x2a53f1){return new BPromise(function(_0x8e144e){_0x2a53f1[_0x1c2c('0x31')]=0x0;_0x2a53f1['talking']=0x0;_0x2a53f1[_0x1c2c('0x32')]=0x0;_0x2a53f1['unmanaged']=0x0;_0x2a53f1[_0x1c2c('0x33')]=0x0;if(!_0x2a53f1[_0x1c2c('0x34')]&&!_0x2a53f1['UserId']){_0x2a53f1[_0x1c2c('0x31')]+=0x1;}if(!_0x2a53f1['closed']&&_0x2a53f1[_0x1c2c('0x35')]){_0x2a53f1[_0x1c2c('0x36')]+=0x1;if(_0x2a53f1[_0x1c2c('0x31')]){_0x2a53f1[_0x1c2c('0x31')]-=0x1;}}if(_0x2a53f1['closed']&&_0x2a53f1[_0x1c2c('0x35')]){_0x2a53f1[_0x1c2c('0x32')]+=0x1;if(_0x2a53f1[_0x1c2c('0x36')]){_0x2a53f1[_0x1c2c('0x36')]-=0x1;}}if(_0x2a53f1['closed']&&!_0x2a53f1['UserId']){_0x2a53f1[_0x1c2c('0x37')]+=0x1;if(_0x2a53f1['waiting']){_0x2a53f1[_0x1c2c('0x31')]-=0x1;}}_0x2a53f1[_0x1c2c('0x33')]+=0x1;_0x8e144e(_0x2a53f1);});}exports['index']=function(_0x4272ad,_0x4797b4){var _0x3044d7={},_0xa80ec1={},_0x251071={'count':0x0,'rows':[]};var _0x200367=_[_0x1c2c('0x38')](db[_0x1c2c('0x39')][_0x1c2c('0x3a')],function(_0x1e132b){return{'name':_0x1e132b[_0x1c2c('0x3b')],'type':_0x1e132b[_0x1c2c('0x3c')][_0x1c2c('0x3d')]};});_0xa80ec1[_0x1c2c('0x3e')]=_[_0x1c2c('0x38')](_0x200367,_0x1c2c('0x28'));_0xa80ec1[_0x1c2c('0x3f')]=_[_0x1c2c('0x40')](_0x4272ad[_0x1c2c('0x3f')]);_0xa80ec1[_0x1c2c('0x41')]=_[_0x1c2c('0x42')](_0xa80ec1[_0x1c2c('0x3e')],_0xa80ec1[_0x1c2c('0x3f')]);_0x3044d7[_0x1c2c('0x43')]=_[_0x1c2c('0x42')](_0xa80ec1[_0x1c2c('0x3e')],qs['fields'](_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x44')]));_0x3044d7['attributes']=_0x3044d7[_0x1c2c('0x43')][_0x1c2c('0x45')]?_0x3044d7[_0x1c2c('0x43')]:_0xa80ec1[_0x1c2c('0x3e')];if(!_0x4272ad['query'][_0x1c2c('0x46')]('nolimit')){_0x3044d7['limit']=qs[_0x1c2c('0x47')](_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x47')]);_0x3044d7[_0x1c2c('0x22')]=qs['offset'](_0x4272ad[_0x1c2c('0x3f')]['offset']);}_0x3044d7[_0x1c2c('0x48')]=qs[_0x1c2c('0x49')](_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x49')]);_0x3044d7[_0x1c2c('0x4a')]=qs[_0x1c2c('0x41')](_[_0x1c2c('0x4b')](_0x4272ad[_0x1c2c('0x3f')],_0xa80ec1[_0x1c2c('0x41')]),_0x200367);var _0x4eefae=[];var _0x51e104=squel[_0x1c2c('0x4c')]()[_0x1c2c('0x4d')]('id')[_0x1c2c('0x4d')](_0x1c2c('0x28'))['field'](_0x1c2c('0x4e'))[_0x1c2c('0x4f')](_0x1c2c('0x50'));var _0x4057fc=squel['select']()[_0x1c2c('0x4d')](_0x1c2c('0x51'))[_0x1c2c('0x4d')](_0x1c2c('0x52'))[_0x1c2c('0x4d')]('ui.FaxInteractionId')[_0x1c2c('0x4f')]('user_has_fax_interactions','ui')[_0x1c2c('0x53')](_0x1c2c('0x54'),'u',_0x1c2c('0x55'));var _0x58826f=squel[_0x1c2c('0x4c')]()[_0x1c2c('0x4f')](_0x1c2c('0x56'),'i')[_0x1c2c('0x53')](_0x1c2c('0x57'),'c',_0x1c2c('0x58'))[_0x1c2c('0x53')](_0x1c2c('0x54'),'o','o.id\x20=\x20i.UserId')[_0x1c2c('0x53')]('fax_accounts','a',_0x1c2c('0x59'))['left_join'](_0x1c2c('0x5a'),'me',_0x1c2c('0x5b'))['left_join'](_0x1c2c('0x5c'),'it',_0x1c2c('0x5d'))['left_join']('tools_tags','t',_0x1c2c('0x5e'));var _0x47c9d5=squel['expr']();var _0x2bee86=[];var _0x673d7f=squel[_0x1c2c('0x5f')]();var _0x345406;if(_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x60')]){_0x345406=as[_0x1c2c('0x61')](_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x60')]);var _0x16a207=_0x345406[_0x1c2c('0x62')];for(var _0x40f9da=0x0;_0x40f9da<_0x345406[_0x1c2c('0x63')][_0x1c2c('0x45')];_0x40f9da++){var _0x1aac27=_0x345406[_0x1c2c('0x63')][_0x40f9da];var _0x43605c='i';var _0x36e71b=_[_0x1c2c('0x64')](_0x200367,[_0x1c2c('0x28'),_0x1aac27[_0x1c2c('0x4d')]]);if(!_0x36e71b){switch(_0x1aac27[_0x1c2c('0x4d')]){case'unreadMessages':if(_0x1aac27[_0x1c2c('0x65')]==0x1){_0x58826f[_0x1c2c('0x66')]('`'+_0x1aac27[_0x1c2c('0x4d')]+'`\x20=\x200');}else{_0x58826f['having']('`'+_0x1aac27['field']+_0x1c2c('0x67'));}break;case'Contact':if(_0x1aac27[_0x1c2c('0x68')]===_0x1c2c('0x69')){if(_0x1aac27[_0x1c2c('0x65')][_0x1c2c('0x2c')]('\x20')[_0x1c2c('0x45')]>0x1){_0x47c9d5[_0x16a207](_0x1c2c('0x6a'),qs['getFullTextValue'](_0x1aac27[_0x1c2c('0x65')]),null);}else{var _0x5a1075='%'+_0x1aac27[_0x1c2c('0x65')]+'%';_0x47c9d5[_0x16a207](_0x1c2c('0x6b'),_0x5a1075,_0x5a1075,_0x5a1075);}}else{_0x36e71b=_['find'](_0x200367,[_0x1c2c('0x28'),_0x1c2c('0x6c')]);_0x1aac27[_0x1c2c('0x4d')]=_0x1c2c('0x6c');_0x599a2b=as[_0x1c2c('0x6d')](_0x43605c,_0x36e71b['type'],_0x1aac27);_0x47c9d5[_0x16a207](_0x599a2b['text'],_0x599a2b[_0x1c2c('0x65')][_0x1c2c('0x6e')],_0x599a2b[_0x1c2c('0x65')][_0x1c2c('0x6f')]);}break;case _0x1c2c('0x70'):var _0x2121d1=_0x1aac27[_0x1c2c('0x65')]['split'](',')[_0x1c2c('0x38')](function(_0x690816){return Number(_0x690816);});_0x2121d1[_0x1c2c('0x2d')](function(_0x476060){_0x673d7f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x476060+',%');});_0x2bee86=_[_0x1c2c('0x71')](_0x2bee86,_0x2121d1);break;case _0x1c2c('0x72'):if(_0x1aac27['operator']===_0x1c2c('0x69')){_0x47c9d5[_0x16a207](_0x1c2c('0x73'),'%'+_0x1aac27[_0x1c2c('0x65')]+'%',null);}else{_0x36e71b=_[_0x1c2c('0x64')](_0x200367,[_0x1c2c('0x28'),_0x1c2c('0x35')]);_0x1aac27[_0x1c2c('0x4d')]=_0x1c2c('0x35');_0x599a2b=as[_0x1c2c('0x6d')](_0x43605c,_0x36e71b['type'],_0x1aac27);_0x47c9d5[_0x16a207](_0x599a2b[_0x1c2c('0x74')],_0x599a2b['value'][_0x1c2c('0x6e')],_0x599a2b[_0x1c2c('0x65')][_0x1c2c('0x6f')]);}break;case _0x1c2c('0x75'):_0x599a2b=as['buildExpression']('me',null,_0x1aac27);_0x47c9d5[_0x16a207](_0x599a2b[_0x1c2c('0x74')],_0x599a2b[_0x1c2c('0x65')]['start'],_0x599a2b['value'][_0x1c2c('0x6f')]);break;}}else{var _0x599a2b=as['buildExpression'](_0x43605c,_0x36e71b[_0x1c2c('0x3c')],_0x1aac27);_0x47c9d5[_0x16a207](_0x599a2b['text'],_0x599a2b[_0x1c2c('0x65')]['start'],_0x599a2b[_0x1c2c('0x65')]['end']);}}}else{var _0x5e4808=_(_0x4272ad['query'])[_0x1c2c('0x40')]()['map'](function(_0x44c638){return _['some'](_0x200367,[_0x1c2c('0x28'),_0x44c638])?_0x44c638:undefined;})['compact']()[_0x1c2c('0x65')]();if(!_[_0x1c2c('0x76')](_0x5e4808)){_0x5e4808[_0x1c2c('0x2d')](function(_0x81a585){if(_0x81a585===_0x1c2c('0x77')){_0x58826f[_0x1c2c('0x4a')]('i.FaxAccountId\x20IN\x20?',[][_0x1c2c('0x78')](_0x4272ad[_0x1c2c('0x3f')][_0x81a585]));}else if(_0x81a585===_0x1c2c('0x79')){var _0x5bf5ce=JSON[_0x1c2c('0x7a')](_0x4272ad[_0x1c2c('0x3f')][_0x81a585])[_0x1c2c('0x7b')];var _0x34f03b=JSON[_0x1c2c('0x7a')](_0x4272ad[_0x1c2c('0x3f')][_0x81a585])['$lte'];_0x58826f[_0x1c2c('0x4a')](_0x1c2c('0x7c'),_0x5bf5ce,_0x34f03b);}else{if(_0x4272ad[_0x1c2c('0x3f')][_0x81a585]==='null'){_0x58826f[_0x1c2c('0x4a')]('i.'+_0x81a585+_0x1c2c('0x7d'));}else{_0x58826f[_0x1c2c('0x4a')]('i.'+_0x81a585+_0x1c2c('0x7e'),_0x4272ad[_0x1c2c('0x3f')][_0x81a585]);}}});}if(_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x7f')]){if(_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x7f')]==0x1){_0x58826f[_0x1c2c('0x66')](_0x1c2c('0x80'));}else{_0x58826f[_0x1c2c('0x66')](_0x1c2c('0x81'));}}if(_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x82')]){_0x2bee86=_['isArray'](_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x82')])?_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x82')]:new Array(_0x4272ad['query'][_0x1c2c('0x82')]);_0x2bee86[_0x1c2c('0x2d')](function(_0xed1bb5){_0x673d7f['or'](_0x1c2c('0x83'),'%,'+_0xed1bb5+',%');});}if(_0x4272ad[_0x1c2c('0x3f')]['filter']){var _0x2f059e=_0x4272ad[_0x1c2c('0x3f')]['filter'][_0x1c2c('0x84')]('\x5c','\x5c\x5c')[_0x1c2c('0x84')](/'/g,'\x27\x27');if(qs[_0x1c2c('0x85')](_0x2f059e)){_0x47c9d5['or'](_0x1c2c('0x86'),_0x2f059e+'%')['or'](_0x1c2c('0x87'),_0x2f059e+'%');}_0x47c9d5['or'](_0x1c2c('0x88'),_0x2f059e+'%');}}_0x58826f[_0x1c2c('0x4a')](_0x47c9d5);_0x58826f['group'](_0x1c2c('0x89'));var _0x37b5d1={'type':db[_0x1c2c('0x8a')][_0x1c2c('0x8b')]['SELECT'],'raw':!![]};var _0x4077e5=_0x58826f[_0x1c2c('0x8c')]();_0x4077e5[_0x1c2c('0x4d')](_0x1c2c('0x89'));_0x4077e5[_0x1c2c('0x4d')](_0x1c2c('0x8d'),_0x1c2c('0x8e'));if(_0x3044d7[_0x1c2c('0x48')]){_0x3044d7[_0x1c2c('0x48')]['forEach'](function(_0x2657fa){var _0x108f0e=_0x2657fa[0x0]===_0x1c2c('0x8f')?_0x2657fa[0x0]:'i.'+_0x2657fa[0x0];_0x58826f[_0x1c2c('0x48')](_0x108f0e,_0x2657fa[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x2bee86)){_0x58826f['having'](_0x673d7f);_0x4077e5[_0x1c2c('0x4a')](_0x1c2c('0x90'),_0x2bee86);}BPromise[_0x1c2c('0x91')]()[_0x1c2c('0x25')](function(){if(!_0x345406){if(_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x77')])return;_0x4077e5[_0x1c2c('0x4a')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x58826f[_0x1c2c('0x4a')](_0x1c2c('0x92'));return;}if(_0x4272ad[_0x1c2c('0x93')][_0x1c2c('0x94')]!==_0x1c2c('0x95'))return;return _0x4272ad[_0x1c2c('0x93')][_0x1c2c('0x96')]({'attributes':['id'],'raw':!![]})[_0x1c2c('0x25')](function(_0xa420d9){if(_[_0x1c2c('0x76')](_0xa420d9)){_0x4077e5['where']('i.FaxAccountId\x20IS\x20NULL');_0x58826f['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x4077e5[_0x1c2c('0x4a')](_0x1c2c('0x97'),_[_0x1c2c('0x38')](_0xa420d9,'id'));_0x58826f[_0x1c2c('0x4a')](_0x1c2c('0x97'),_[_0x1c2c('0x38')](_0xa420d9,'id'));}});})[_0x1c2c('0x25')](function(){if(_0x4272ad[_0x1c2c('0x93')][_0x1c2c('0x94')]==='agent'&&!_0x345406&&!_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x77')])return[];return db[_0x1c2c('0x98')][_0x1c2c('0x3f')](_0x4077e5[_0x1c2c('0x99')](),_0x37b5d1);})[_0x1c2c('0x25')](function(_0x1c3367){_0x251071[_0x1c2c('0x21')]=_0x1c3367[_0x1c2c('0x45')];if(_0x251071[_0x1c2c('0x21')]===0x0)return[];return db['sequelize'][_0x1c2c('0x3f')](_0x51e104[_0x1c2c('0x99')](),_0x37b5d1)[_0x1c2c('0x25')](function(_0x2f0bcc){_0x4eefae=_[_0x1c2c('0x9a')](_0x2f0bcc,'id');_0x37b5d1=_['merge'](_0x37b5d1,{'model':db[_0x1c2c('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4272ad[_0x1c2c('0x3f')][_0x1c2c('0x44')]){_0x3044d7[_0x1c2c('0x43')][_0x1c2c('0x2d')](function(_0x1d49df){_0x58826f['field']('i.'+_0x1d49df);});}else{_0x58826f['field'](_0x1c2c('0x8d'),_0x1c2c('0x8e'));_0x58826f[_0x1c2c('0x4d')](_0x1c2c('0x9b'),'Account.key');_0x58826f[_0x1c2c('0x4d')](_0x1c2c('0x9c'),'Account.mandatoryDisposition');_0x58826f[_0x1c2c('0x4d')](_0x1c2c('0x9d'),'contactName');_0x58826f[_0x1c2c('0x4d')](_0x1c2c('0x9e'));_0x58826f['field'](_0x1c2c('0x9f'),_0x1c2c('0xa0'));_0x58826f['field'](_0x1c2c('0xa1'),_0x1c2c('0xa2'));_0x58826f[_0x1c2c('0x4d')](_0x1c2c('0xa3'),_0x1c2c('0xa4'));_0x58826f[_0x1c2c('0x4d')](_0x1c2c('0xa5'),_0x1c2c('0xa6'));_0x58826f[_0x1c2c('0x4d')](_0x1c2c('0xa7'),_0x1c2c('0xa8'));_0x58826f[_0x1c2c('0x4d')](_0x1c2c('0xa9'),_0x1c2c('0xaa'));_0x58826f[_0x1c2c('0x4d')](_0x1c2c('0xab'),_0x1c2c('0xac'));_0x58826f[_0x1c2c('0x4d')]('o.internal',_0x1c2c('0xad'));_0x58826f[_0x1c2c('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3044d7[_0x1c2c('0x47')])_0x58826f[_0x1c2c('0x47')](_0x3044d7[_0x1c2c('0x47')]);if(_0x3044d7['offset'])_0x58826f[_0x1c2c('0x22')](_0x3044d7['offset']);return db[_0x1c2c('0x98')]['query'](_0x58826f[_0x1c2c('0x99')](),_0x37b5d1);})[_0x1c2c('0x25')](function(_0x215804){if(_0x215804[_0x1c2c('0x45')]>0x0)_0x4057fc[_0x1c2c('0x4a')]('ui.FaxInteractionId\x20IN\x20?',_[_0x1c2c('0x38')](_0x215804,'id'));return db['sequelize'][_0x1c2c('0x3f')](_0x4057fc[_0x1c2c('0x99')](),_0x37b5d1)[_0x1c2c('0x25')](function(_0x4252da){var _0xff38ba=_[_0x1c2c('0xae')](_0x4252da,'FaxInteractionId');var _0x49d767=[];_0x215804[_0x1c2c('0x2d')](function(_0x447cd6){_0x49d767[_0x1c2c('0x2f')](updateFaxInteraction(_0x447cd6,_0x4eefae,_0xff38ba));});return BPromise[_0x1c2c('0xaf')](_0x49d767);});});})['then'](function(_0x438251){_0x251071['rows']=_0x438251;return _0x251071;})[_0x1c2c('0x25')](respondWithFilteredResult(_0x4797b4,_0x3044d7))[_0x1c2c('0x30')](handleError(_0x4797b4,null));};exports[_0x1c2c('0xb0')]=function(_0x2556a7,_0x451f62){var _0xe9009e={'raw':![],'where':{'id':_0x2556a7[_0x1c2c('0xb1')]['id']}},_0x1d08ce={};_0x1d08ce[_0x1c2c('0x3e')]=_['keys'](db[_0x1c2c('0x39')][_0x1c2c('0x3a')]);_0x1d08ce['query']=_['keys'](_0x2556a7['query']);_0x1d08ce[_0x1c2c('0x41')]=_[_0x1c2c('0x42')](_0x1d08ce['model'],_0x1d08ce['query']);_0xe9009e[_0x1c2c('0x43')]=_[_0x1c2c('0x42')](_0x1d08ce[_0x1c2c('0x3e')],qs[_0x1c2c('0x44')](_0x2556a7['query'][_0x1c2c('0x44')]));_0xe9009e[_0x1c2c('0x43')]=_0xe9009e[_0x1c2c('0x43')][_0x1c2c('0x45')]?_0xe9009e[_0x1c2c('0x43')]:_0x1d08ce[_0x1c2c('0x3e')];if(_0x2556a7[_0x1c2c('0x3f')][_0x1c2c('0xb2')]){_0xe9009e[_0x1c2c('0xb3')]=[{'all':!![]}];}_0xe9009e=_[_0x1c2c('0xb4')]({},_0xe9009e,_0x2556a7[_0x1c2c('0xb5')]);return db['FaxInteraction'][_0x1c2c('0x64')](_0xe9009e)[_0x1c2c('0x25')](handleEntityNotFound(_0x451f62,null))[_0x1c2c('0x25')](respondWithResult(_0x451f62,null))['catch'](handleError(_0x451f62,null));};exports[_0x1c2c('0xb6')]=function(_0x7de7c3,_0x627a32){return db['FaxInteraction'][_0x1c2c('0xb6')](_0x7de7c3[_0x1c2c('0x75')],{})[_0x1c2c('0x25')](respondWithResult(_0x627a32,0xc9))[_0x1c2c('0x30')](handleError(_0x627a32,null));};exports[_0x1c2c('0xb7')]=function(_0x3b7bd5,_0xb6a7b0){if(_0x3b7bd5[_0x1c2c('0x75')]['id']){delete _0x3b7bd5[_0x1c2c('0x75')]['id'];}return db[_0x1c2c('0x39')]['find']({'where':{'id':_0x3b7bd5[_0x1c2c('0xb1')]['id']}})[_0x1c2c('0x25')](handleEntityNotFound(_0xb6a7b0,null))['then'](saveUpdates(_0x3b7bd5['body'],null))['then'](respondWithResult(_0xb6a7b0,null))['catch'](handleError(_0xb6a7b0,null));};exports[_0x1c2c('0xb8')]=function(_0x6a0257,_0x5f5661){return db[_0x1c2c('0x39')]['find']({'where':{'id':_0x6a0257[_0x1c2c('0xb1')]['id']}})[_0x1c2c('0x25')](handleEntityNotFound(_0x5f5661,null))[_0x1c2c('0x25')](removeEntity(_0x5f5661,null))[_0x1c2c('0x30')](handleError(_0x5f5661,null));};exports[_0x1c2c('0xb9')]=function(_0x2ec06b,_0x301e48){return db[_0x1c2c('0x39')][_0x1c2c('0xb9')]()['then'](respondWithResult(_0x301e48,null))['catch'](handleError(_0x301e48,null));};exports[_0x1c2c('0xba')]=function(_0x48eac8,_0x473262,_0x1326ac){return db['FaxMessage'][_0x1c2c('0x64')]({'where':{'id':_0x48eac8[_0x1c2c('0xb1')]['id']}})[_0x1c2c('0x25')](handleEntityNotFound(_0x473262,null))['then'](function(_0x2c2bf7){if(_0x2c2bf7){return _0x2c2bf7[_0x1c2c('0xba')](_0x48eac8[_0x1c2c('0x75')]['ids'],_[_0x1c2c('0xbb')](_0x48eac8[_0x1c2c('0x75')],[_0x1c2c('0xbc'),'id'])||{});}})[_0x1c2c('0x25')](respondWithResult(_0x473262,null))[_0x1c2c('0x30')](handleError(_0x473262,null));};exports[_0x1c2c('0xbd')]=function(_0x497c70,_0x40c8f1,_0x29dded){var _0x4ed1e9={'raw':![],'where':{}};var _0x78a98c={};var _0x46fbe5={'count':0x0,'rows':[]};return db[_0x1c2c('0x39')]['findOne']({'where':{'id':_0x497c70[_0x1c2c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x40c8f1,null))['then'](function(_0x55c21d){if(_0x55c21d){_0x78a98c[_0x1c2c('0x3e')]=_[_0x1c2c('0x40')](db[_0x1c2c('0xbe')][_0x1c2c('0x3a')]);_0x78a98c[_0x1c2c('0x3f')]=_[_0x1c2c('0x40')](_0x497c70[_0x1c2c('0x3f')]);_0x78a98c[_0x1c2c('0x41')]=_[_0x1c2c('0x42')](_0x78a98c[_0x1c2c('0x3e')],_0x78a98c[_0x1c2c('0x3f')]);_0x4ed1e9['attributes']=_['intersection'](_0x78a98c[_0x1c2c('0x3e')],qs[_0x1c2c('0x44')](_0x497c70[_0x1c2c('0x3f')][_0x1c2c('0x44')]));_0x4ed1e9[_0x1c2c('0x43')]=_0x4ed1e9[_0x1c2c('0x43')][_0x1c2c('0x45')]?_0x4ed1e9['attributes']:_0x78a98c['model'];if(!_0x497c70[_0x1c2c('0x3f')][_0x1c2c('0x46')](_0x1c2c('0xbf'))){_0x4ed1e9[_0x1c2c('0x47')]=qs['limit'](_0x497c70[_0x1c2c('0x3f')][_0x1c2c('0x47')]);_0x4ed1e9[_0x1c2c('0x22')]=qs['offset'](_0x497c70[_0x1c2c('0x3f')][_0x1c2c('0x22')]);}_0x4ed1e9[_0x1c2c('0x48')]=qs['sort'](_0x497c70['query'][_0x1c2c('0x49')]);_0x4ed1e9[_0x1c2c('0x4a')]=qs[_0x1c2c('0x41')](_[_0x1c2c('0x4b')](_0x497c70['query'],_0x78a98c[_0x1c2c('0x41')]));_0x4ed1e9['where'][_0x1c2c('0xc0')]=_0x55c21d['id'];if(_0x497c70[_0x1c2c('0x3f')][_0x1c2c('0xc1')]){_0x4ed1e9[_0x1c2c('0x4a')]=_['merge'](_0x4ed1e9[_0x1c2c('0x4a')],{'$or':_[_0x1c2c('0x38')](_0x4ed1e9['attributes'],function(_0x1a74b2){var _0x2bd2aa={};_0x2bd2aa[_0x1a74b2]={'$like':'%'+_0x497c70[_0x1c2c('0x3f')]['filter']+'%'};return _0x2bd2aa;})});}if(_0x497c70[_0x1c2c('0x3f')]['$gte']){var _0x287cac=_0x497c70[_0x1c2c('0x3f')]['$gte'][_0x1c2c('0x2c')](',');var _0x2b3721={};_0x2b3721[_0x287cac[0x0]]={'$gte':moment(_0x287cac[0x1])[_0x1c2c('0xc2')](_0x1c2c('0xc3'))};_0x4ed1e9[_0x1c2c('0x4a')]=_['merge'](_0x4ed1e9[_0x1c2c('0x4a')],_0x2b3721);}_0x4ed1e9=_['merge']({},_0x4ed1e9,_0x497c70['options']);return db[_0x1c2c('0xbe')][_0x1c2c('0x21')]({'where':_0x4ed1e9[_0x1c2c('0x4a')]})[_0x1c2c('0x25')](function(_0x29541b){_0x46fbe5[_0x1c2c('0x21')]=_0x29541b;if(_0x497c70[_0x1c2c('0x3f')][_0x1c2c('0xb2')]){_0x4ed1e9['include']=[{'all':!![]}];}return db[_0x1c2c('0xbe')][_0x1c2c('0xc4')](_0x4ed1e9);})[_0x1c2c('0x25')](function(_0x58b9fc){_0x46fbe5[_0x1c2c('0xc5')]=_0x58b9fc;return _0x46fbe5;});}})[_0x1c2c('0x25')](respondWithFilteredResult(_0x40c8f1,_0x4ed1e9))[_0x1c2c('0x30')](handleError(_0x40c8f1,null));};exports[_0x1c2c('0xc6')]=function(_0x213bad,_0x2be4c1,_0xe44055){return db['FaxInteraction'][_0x1c2c('0x64')]({'where':{'id':_0x213bad[_0x1c2c('0xb1')]['id']}})[_0x1c2c('0x25')](handleEntityNotFound(_0x2be4c1,null))[_0x1c2c('0x25')](function(_0xcf7edf){if(_0xcf7edf){return _0xcf7edf[_0x1c2c('0xc7')](_0x213bad[_0x1c2c('0x75')][_0x1c2c('0xbc')],_[_0x1c2c('0xbb')](_0x213bad[_0x1c2c('0x75')],[_0x1c2c('0xbc'),'id'])||{})[_0x1c2c('0xc8')](function(){return db['Tag'][_0x1c2c('0xc4')]({'attributes':['id','name',_0x1c2c('0x4e')],'where':{'id':_0x213bad['body'][_0x1c2c('0xbc')]}});})[_0x1c2c('0x25')](function(_0x137320){socket['emit'](_0x1c2c('0xc9'),{'id':Number(_0x213bad['params']['id']),'tags':_0x137320||[]});return{'id':Number(_0x213bad[_0x1c2c('0xb1')]['id']),'tags':_0x137320||[]};});}})['then'](respondWithResult(_0x2be4c1,null))['catch'](handleError(_0x2be4c1,null));};exports[_0x1c2c('0xca')]=function(_0x2a5717,_0x355a52,_0x48a810){return db[_0x1c2c('0x39')]['find']({'where':{'id':_0x2a5717[_0x1c2c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x355a52,null))['then'](function(_0x293674){if(_0x293674){return _0x293674['removeTags'](_0x2a5717[_0x1c2c('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x355a52,null))[_0x1c2c('0x30')](handleError(_0x355a52,null));};exports['download']=function(_0x326dc0,_0x21b066){var _0x928cf7=moment()[_0x1c2c('0xcb')]()[_0x1c2c('0x99')]();var _0x3030ca=path['join'](config['root'],'server',_0x1c2c('0xcc'),'tmp');var _0x1cd09c=path[_0x1c2c('0xcd')](config[_0x1c2c('0xce')],_0x1c2c('0xcf'),_0x1c2c('0xcc'),_0x1c2c('0xd0'));var _0x4663a6=path['join'](_0x3030ca,_0x928cf7);var _0x555412=util[_0x1c2c('0xc2')](_0x1c2c('0xd1'),_0x326dc0['params']['id'],_0x928cf7);var _0x3f40b0=path['join'](_0x3030ca,_0x555412);var _0x3c110f=[];_0x3c110f[_0x1c2c('0x2f')]({'model':db['Attachment'],'as':_0x1c2c('0xd2'),'raw':!![]});var _0x2a7c37=[{'model':db['FaxMessage'],'as':_0x1c2c('0xd3'),'attributes':['id',_0x1c2c('0x75'),_0x1c2c('0x79')],'include':_0x3c110f}];return db['FaxInteraction'][_0x1c2c('0x64')]({'where':{'id':_0x326dc0[_0x1c2c('0xb1')]['id']},'include':_0x2a7c37})[_0x1c2c('0x25')](handleEntityNotFound(_0x21b066,null))['then'](function(_0x564427){if(_0x564427&&_0x564427[_0x1c2c('0xd3')]){var _0x3458cb=_0x564427['get']({'plain':!![]});fs['mkdirSync'](_0x4663a6);for(var _0x2f4461=0x0;_0x2f4461<_0x3458cb[_0x1c2c('0xd3')][_0x1c2c('0x45')];_0x2f4461++){var _0x113f7d=_0x3458cb[_0x1c2c('0xd3')][_0x2f4461]['Attachment'];if(_0x113f7d){var _0x523785=path['join'](_0x1cd09c,_0x113f7d[_0x1c2c('0xd4')]);if(fs[_0x1c2c('0xd5')](_0x523785)){fs[_0x1c2c('0xd6')](_0x523785)['pipe'](fs['createWriteStream'](path['join'](_0x4663a6,_0x113f7d[_0x1c2c('0xd4')])));}}}return BPromise[_0x1c2c('0x91')]()[_0x1c2c('0x25')](function(){return new BPromise(function(_0x1e7d82,_0x177fb8){zipdir(_0x4663a6,{'saveTo':_0x3f40b0},function(_0x349599,_0x53487b){if(_0x349599)return _0x177fb8(_0x349599);return _0x1e7d82(_0x53487b);});})[_0x1c2c('0x25')](function(){return new BPromise(function(_0x278064,_0x76299){rimraf(_0x4663a6,function(_0x1fdbe3){if(_0x1fdbe3)_0x76299(_0x1fdbe3);return _0x278064();});});})[_0x1c2c('0x25')](function(){return _0x21b066['download'](_0x3f40b0,_0x555412,function(_0x203ede){if(_0x203ede){console[_0x1c2c('0xd7')](_0x1c2c('0xd8'),_0x203ede);}else{fs[_0x1c2c('0xd9')](_0x3f40b0);}});});});}else{return _0x21b066[_0x1c2c('0x26')](0xc8);}})[_0x1c2c('0x30')](handleError(_0x21b066,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index ccfbd21..8bcc95e 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 _0x436f=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','save','getUsers','then','Users','map','findAll','setDataValue'];(function(_0xcf8bba,_0x421bdc){var _0x106607=function(_0x221b96){while(--_0x221b96){_0xcf8bba['push'](_0xcf8bba['shift']());}};_0x106607(++_0x421bdc);}(_0x436f,0x1d3));var _0xf436=function(_0x497d07,_0x22aed3){_0x497d07=_0x497d07-0x0;var _0x1f89cd=_0x436f[_0x497d07];return _0x1f89cd;};'use strict';var EventEmitter=require(_0xf436('0x0'));var FaxInteraction=require(_0xf436('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xf436('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf436('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cbab5){return function(_0x5cdbca,_0x2781f5,_0xaa4c53){_0x5cdbca[_0xf436('0x3')]({'attributes':['id'],'raw':!![]})[_0xf436('0x4')](function(_0x31d999){_0x5cdbca['setDataValue'](_0xf436('0x5'),_0x31d999[_0xf436('0x6')](function(_0xfeaf90){return{'id':_0xfeaf90['id']};}));return FaxMessage[_0xf436('0x7')]({'where':{'FaxInteractionId':_0x5cdbca['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf436('0x4')](function(_0x30a274){_0x5cdbca[_0xf436('0x8')](_0xf436('0x9'),_0x30a274[_0xf436('0xa')]);FaxInteractionEvents['emit'](_0x4cbab5+':'+_0x5cdbca['id'],_0x5cdbca);FaxInteractionEvents[_0xf436('0xb')](_0x4cbab5,_0x5cdbca);_0xaa4c53(null);})['catch'](_0xaa4c53(null));};}for(var e in events){if(events[_0xf436('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf436('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0xcab1=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xcab1,0xdd));var _0x1cab=function(_0x28a9d3,_0x2384ee){_0x28a9d3=_0x28a9d3-0x0;var _0xff757d=_0xcab1[_0x28a9d3];return _0xff757d;};'use strict';var EventEmitter=require(_0x1cab('0x0'));var FaxInteraction=require(_0x1cab('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x1cab('0x1'))['db'][_0x1cab('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1cab('0x3')](0x0);var events={'afterCreate':_0x1cab('0x4'),'afterUpdate':_0x1cab('0x5'),'afterDestroy':_0x1cab('0x6')};function emitEvent(_0x148e72){return function(_0x316ce4,_0x11a62c,_0x18e3be){_0x316ce4[_0x1cab('0x7')]({'attributes':['id'],'raw':!![]})[_0x1cab('0x8')](function(_0x2abaf3){_0x316ce4[_0x1cab('0x9')]('Users',_0x2abaf3[_0x1cab('0xa')](function(_0x1e3a18){return{'id':_0x1e3a18['id']};}));return FaxMessage[_0x1cab('0xb')]({'where':{'FaxInteractionId':_0x316ce4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1cab('0x8')](function(_0x5a009c){_0x316ce4[_0x1cab('0x9')](_0x1cab('0xc'),_0x5a009c['length']);FaxInteractionEvents[_0x1cab('0xd')](_0x148e72+':'+_0x316ce4['id'],_0x316ce4);FaxInteractionEvents['emit'](_0x148e72,_0x316ce4);_0x18e3be(null);})['catch'](_0x18e3be(null));};}for(var e in events){if(events[_0x1cab('0xe')](e)){var event=events[e];FaxInteraction[_0x1cab('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 2a87fc5..4dcf348 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 _0x1735=['api','moment','request-promise','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x471cc1,_0x490ed3){var _0x34aa3e=function(_0x18fa1c){while(--_0x18fa1c){_0x471cc1['push'](_0x471cc1['shift']());}};_0x34aa3e(++_0x490ed3);}(_0x1735,0xb1));var _0x5173=function(_0x132388,_0x380af0){_0x132388=_0x132388-0x0;var _0x24c044=_0x1735[_0x132388];return _0x24c044;};'use strict';var _=require(_0x5173('0x0'));var util=require(_0x5173('0x1'));var logger=require(_0x5173('0x2'))(_0x5173('0x3'));var moment=require(_0x5173('0x4'));var BPromise=require('bluebird');var rp=require(_0x5173('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5173('0x6'));var config=require('../../config/environment');var attributes=require(_0x5173('0x7'));module['exports']=function(_0x42d5c2,_0x276a71){return _0x42d5c2[_0x5173('0x8')](_0x5173('0x9'),attributes,{'tableName':_0x5173('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38452d,_0x2677db,_0x92373f){if(_0x38452d[_0x5173('0xb')](_0x5173('0xc'))){_0x38452d[_0x5173('0xd')]=moment()[_0x5173('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x92373f(null,_0x38452d);}}});}; \ No newline at end of file +var _0x97dd=['util','api','moment','bluebird','request-promise','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x97dd,0xef));var _0xd97d=function(_0x508c6f,_0x40a0b9){_0x508c6f=_0x508c6f-0x0;var _0x432a3e=_0x97dd[_0x508c6f];return _0x432a3e;};'use strict';var _=require(_0xd97d('0x0'));var util=require(_0xd97d('0x1'));var logger=require('../../config/logger')(_0xd97d('0x2'));var moment=require(_0xd97d('0x3'));var BPromise=require(_0xd97d('0x4'));var rp=require(_0xd97d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd97d('0x6'));var config=require('../../config/environment');var attributes=require(_0xd97d('0x7'));module[_0xd97d('0x8')]=function(_0x572c87,_0x2f1347){return _0x572c87[_0xd97d('0x9')](_0xd97d('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1775b0,_0xb5a65c,_0x385860){if(_0x1775b0['changed'](_0xd97d('0xb'))){_0x1775b0[_0xd97d('0xc')]=moment()[_0xd97d('0xd')](_0xd97d('0xe'));}_0x385860(null,_0x1775b0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 0f79a6d..0c896b1 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 _0x6ecd=['stringify','AddTagsToFaxInteraction','FaxInteraction','find','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','body','options','raw','where','attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6ecd,0x18e));var _0xd6ec=function(_0x10ffb9,_0x2246eb){_0x10ffb9=_0x10ffb9-0x0;var _0x57d6d7=_0x6ecd[_0x10ffb9];return _0x57d6d7;};'use strict';var _=require(_0xd6ec('0x0'));var util=require(_0xd6ec('0x1'));var moment=require('moment');var BPromise=require(_0xd6ec('0x2'));var rs=require(_0xd6ec('0x3'));var fs=require('fs');var Redis=require(_0xd6ec('0x4'));var db=require(_0xd6ec('0x5'))['db'];var utils=require(_0xd6ec('0x6'));var logger=require('../../config/logger')(_0xd6ec('0x7'));var config=require('../../config/environment');var jayson=require(_0xd6ec('0x8'));var client=jayson[_0xd6ec('0x9')][_0xd6ec('0xa')]({'port':0x232a});config[_0xd6ec('0xb')]=_['defaults'](config[_0xd6ec('0xb')],{'host':_0xd6ec('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6ec('0xb')]));require(_0xd6ec('0xd'))[_0xd6ec('0xe')](socket);function respondWithRpcPromise(_0x59fc19,_0x48c45a,_0x3e07ab){return new BPromise(function(_0x5f4ae7,_0x5ed60d){return client['request'](_0x59fc19,_0x3e07ab)[_0xd6ec('0xf')](function(_0x58fb30){logger[_0xd6ec('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x48c45a,_0xd6ec('0x11'));logger[_0xd6ec('0x12')](_0xd6ec('0x13'),_0x48c45a,'request\x20sent',JSON['stringify'](_0x58fb30));if(_0x58fb30[_0xd6ec('0x14')]){if(_0x58fb30['error']['code']===0x1f4){logger[_0xd6ec('0x14')](_0xd6ec('0x15'),_0x48c45a,_0x58fb30[_0xd6ec('0x14')][_0xd6ec('0x16')]);return _0x5ed60d(_0x58fb30[_0xd6ec('0x14')][_0xd6ec('0x16')]);}logger[_0xd6ec('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x48c45a,_0x58fb30[_0xd6ec('0x14')][_0xd6ec('0x16')]);return _0x5f4ae7(_0x58fb30[_0xd6ec('0x14')]['message']);}else{logger[_0xd6ec('0x10')](_0xd6ec('0x15'),_0x48c45a,'request\x20sent');_0x5f4ae7(_0x58fb30[_0xd6ec('0x17')][_0xd6ec('0x16')]);}})[_0xd6ec('0x18')](function(_0x157f95){logger[_0xd6ec('0x14')](_0xd6ec('0x15'),_0x48c45a,_0x157f95);_0x5ed60d(_0x157f95);});});}exports[_0xd6ec('0x19')]=function(_0x1f05cf){var _0x2defda=this;return new Promise(function(_0x583e24,_0x496924){return db['FaxInteraction']['update'](_0x1f05cf[_0xd6ec('0x1a')],{'raw':_0x1f05cf[_0xd6ec('0x1b')]?_0x1f05cf['options'][_0xd6ec('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f05cf['options']?_0x1f05cf[_0xd6ec('0x1b')][_0xd6ec('0x1d')]||null:null,'attributes':_0x1f05cf[_0xd6ec('0x1b')]?_0x1f05cf[_0xd6ec('0x1b')][_0xd6ec('0x1e')]||null:null,'limit':_0x1f05cf['options']?_0x1f05cf[_0xd6ec('0x1b')]['limit']||null:null})[_0xd6ec('0xf')](function(_0x48ad33){logger['info']('UpdateFaxInteraction',_0x1f05cf);logger[_0xd6ec('0x12')]('UpdateFaxInteraction',_0x1f05cf,JSON[_0xd6ec('0x1f')](_0x48ad33));_0x583e24(_0x48ad33);})['catch'](function(_0xbfdfa6){logger[_0xd6ec('0x14')](_0xd6ec('0x19'),_0xbfdfa6[_0xd6ec('0x16')],_0x1f05cf);_0x496924(_0x2defda['error'](0x1f4,_0xbfdfa6[_0xd6ec('0x16')]));});});};exports[_0xd6ec('0x20')]=function(_0x5d70ec){return new Promise(function(_0x56e2bd,_0x5ee5f8){return db[_0xd6ec('0x21')][_0xd6ec('0x22')]({'where':_0x5d70ec[_0xd6ec('0x1b')]?_0x5d70ec[_0xd6ec('0x1b')][_0xd6ec('0x1d')]||null:null})[_0xd6ec('0xf')](function(_0x1b61b1){if(_0x1b61b1){return _0x1b61b1['addTags'](_0x5d70ec[_0xd6ec('0x1a')][_0xd6ec('0x23')],_[_0xd6ec('0x24')](_0x5d70ec[_0xd6ec('0x1a')],['ids','id'])||{});}})[_0xd6ec('0x25')](function(_0x4cd636){logger['info'](_0xd6ec('0x26'),_0x5d70ec);logger[_0xd6ec('0x12')](_0xd6ec('0x26'),_0x5d70ec,JSON[_0xd6ec('0x1f')](_0x4cd636));_0x56e2bd(_0x4cd636);})[_0xd6ec('0x18')](function(_0x459833){logger[_0xd6ec('0x14')](_0xd6ec('0x26'),_0x459833['message'],_0x5d70ec);_0x5ee5f8(_this[_0xd6ec('0x14')](0x1f4,_0x459833[_0xd6ec('0x16')]));});});}; \ No newline at end of file +var _0xbb01=['FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UpdateFaxInteraction','FaxInteraction','update','options','where','attributes','limit','debug','AddTagsToFaxInteraction','find','omit','body','spread','AddTags','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then'];(function(_0x8d01db,_0x63eca8){var _0x32d1d7=function(_0x4f4b0b){while(--_0x4f4b0b){_0x8d01db['push'](_0x8d01db['shift']());}};_0x32d1d7(++_0x63eca8);}(_0xbb01,0xdf));var _0x1bb0=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0xbb01[_0x11ec6c];return _0xb59506;};'use strict';var _=require(_0x1bb0('0x0'));var util=require('util');var moment=require(_0x1bb0('0x1'));var BPromise=require(_0x1bb0('0x2'));var rs=require(_0x1bb0('0x3'));var fs=require('fs');var Redis=require(_0x1bb0('0x4'));var db=require(_0x1bb0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bb0('0x6'));var jayson=require(_0x1bb0('0x7'));var client=jayson[_0x1bb0('0x8')][_0x1bb0('0x9')]({'port':0x232a});config[_0x1bb0('0xa')]=_['defaults'](config[_0x1bb0('0xa')],{'host':_0x1bb0('0xb'),'port':0x18eb});var socket=require(_0x1bb0('0xc'))(new Redis(config[_0x1bb0('0xa')]));require(_0x1bb0('0xd'))[_0x1bb0('0xe')](socket);function respondWithRpcPromise(_0x4ceafb,_0x38aa10,_0x46559b){return new BPromise(function(_0x2a18f1,_0x3b202f){return client[_0x1bb0('0xf')](_0x4ceafb,_0x46559b)[_0x1bb0('0x10')](function(_0x12abc7){logger['info'](_0x1bb0('0x11'),_0x38aa10,_0x1bb0('0x12'));logger['debug'](_0x1bb0('0x13'),_0x38aa10,_0x1bb0('0x12'),JSON['stringify'](_0x12abc7));if(_0x12abc7[_0x1bb0('0x14')]){if(_0x12abc7[_0x1bb0('0x14')][_0x1bb0('0x15')]===0x1f4){logger[_0x1bb0('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x38aa10,_0x12abc7['error'][_0x1bb0('0x16')]);return _0x3b202f(_0x12abc7[_0x1bb0('0x14')]['message']);}logger[_0x1bb0('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x38aa10,_0x12abc7[_0x1bb0('0x14')][_0x1bb0('0x16')]);return _0x2a18f1(_0x12abc7[_0x1bb0('0x14')][_0x1bb0('0x16')]);}else{logger[_0x1bb0('0x17')](_0x1bb0('0x11'),_0x38aa10,_0x1bb0('0x12'));_0x2a18f1(_0x12abc7['result'][_0x1bb0('0x16')]);}})[_0x1bb0('0x18')](function(_0x3e1fc8){logger[_0x1bb0('0x14')](_0x1bb0('0x11'),_0x38aa10,_0x3e1fc8);_0x3b202f(_0x3e1fc8);});});}exports[_0x1bb0('0x19')]=function(_0x549a1e){var _0x4e47ec=this;return new Promise(function(_0x1b9153,_0x328b73){return db[_0x1bb0('0x1a')][_0x1bb0('0x1b')](_0x549a1e['body'],{'raw':_0x549a1e[_0x1bb0('0x1c')]?_0x549a1e[_0x1bb0('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x549a1e[_0x1bb0('0x1c')]?_0x549a1e[_0x1bb0('0x1c')][_0x1bb0('0x1d')]||null:null,'attributes':_0x549a1e['options']?_0x549a1e[_0x1bb0('0x1c')][_0x1bb0('0x1e')]||null:null,'limit':_0x549a1e[_0x1bb0('0x1c')]?_0x549a1e[_0x1bb0('0x1c')][_0x1bb0('0x1f')]||null:null})[_0x1bb0('0x10')](function(_0x3853a4){logger[_0x1bb0('0x17')](_0x1bb0('0x19'),_0x549a1e);logger[_0x1bb0('0x20')]('UpdateFaxInteraction',_0x549a1e,JSON['stringify'](_0x3853a4));_0x1b9153(_0x3853a4);})[_0x1bb0('0x18')](function(_0xca2fe4){logger[_0x1bb0('0x14')](_0x1bb0('0x19'),_0xca2fe4[_0x1bb0('0x16')],_0x549a1e);_0x328b73(_0x4e47ec['error'](0x1f4,_0xca2fe4[_0x1bb0('0x16')]));});});};exports[_0x1bb0('0x21')]=function(_0x18880d){return new Promise(function(_0x3ce2ee,_0xc83763){return db[_0x1bb0('0x1a')][_0x1bb0('0x22')]({'where':_0x18880d['options']?_0x18880d[_0x1bb0('0x1c')]['where']||null:null})[_0x1bb0('0x10')](function(_0x2d00d1){if(_0x2d00d1){return _0x2d00d1['addTags'](_0x18880d['body']['ids'],_[_0x1bb0('0x23')](_0x18880d[_0x1bb0('0x24')],['ids','id'])||{});}})[_0x1bb0('0x25')](function(_0x67858b){logger[_0x1bb0('0x17')]('AddTags',_0x18880d);logger[_0x1bb0('0x20')](_0x1bb0('0x26'),_0x18880d,JSON[_0x1bb0('0x27')](_0x67858b));_0x3ce2ee(_0x67858b);})[_0x1bb0('0x18')](function(_0x173de9){logger[_0x1bb0('0x14')](_0x1bb0('0x26'),_0x173de9['message'],_0x18880d);_0xc83763(_this['error'](0x1f4,_0x173de9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 33dc3b7..70d9191 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 _0x7b87=['update','emit','removeListener','register','faxInteraction:','save','remove'];(function(_0x67421e,_0x5231af){var _0x1f90a1=function(_0x538e47){while(--_0x538e47){_0x67421e['push'](_0x67421e['shift']());}};_0x1f90a1(++_0x5231af);}(_0x7b87,0x163));var _0x77b8=function(_0x4b03d3,_0x32f1d2){_0x4b03d3=_0x4b03d3-0x0;var _0x58a968=_0x7b87[_0x4b03d3];return _0x58a968;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x77b8('0x0'),_0x77b8('0x1'),_0x77b8('0x2')];function createListener(_0x112904,_0x245747){return function(_0x44899c){_0x245747[_0x77b8('0x3')](_0x112904,_0x44899c);};}function removeListener(_0x4454fc,_0x1cd765){return function(){FaxInteractionEvents[_0x77b8('0x4')](_0x4454fc,_0x1cd765);};}exports[_0x77b8('0x5')]=function(_0x43aaee){for(var _0x1519e9=0x0,_0x15843f=events['length'];_0x1519e9<_0x15843f;_0x1519e9++){var _0x561b19=events[_0x1519e9];var _0x81dd64=createListener(_0x77b8('0x6')+_0x561b19,_0x43aaee);FaxInteractionEvents['on'](_0x561b19,_0x81dd64);}}; \ No newline at end of file +var _0x1380=['remove','update','emit','length','save'];(function(_0x48c634,_0x1d4718){var _0x5976d9=function(_0x286ec6){while(--_0x286ec6){_0x48c634['push'](_0x48c634['shift']());}};_0x5976d9(++_0x1d4718);}(_0x1380,0xd1));var _0x0138=function(_0x2a1fb5,_0x3cddb6){_0x2a1fb5=_0x2a1fb5-0x0;var _0x964078=_0x1380[_0x2a1fb5];return _0x964078;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x0138('0x0'),_0x0138('0x1'),_0x0138('0x2')];function createListener(_0x1deb6f,_0xfb0ea3){return function(_0x579563){_0xfb0ea3[_0x0138('0x3')](_0x1deb6f,_0x579563);};}function removeListener(_0x504297,_0x174fd6){return function(){FaxInteractionEvents['removeListener'](_0x504297,_0x174fd6);};}exports['register']=function(_0x58b34f){for(var _0x5ae22a=0x0,_0x5e0b08=events[_0x0138('0x4')];_0x5ae22a<_0x5e0b08;_0x5ae22a++){var _0x27e401=events[_0x5ae22a];var _0x12eab8=createListener('faxInteraction:'+_0x27e401,_0x58b34f);FaxInteractionEvents['on'](_0x27e401,_0x12eab8);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 24ebba5..e685f44 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 _0x96b8=['isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','faxinteraction:addtags','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x3aa9cb,_0x127520){var _0x4a087e=function(_0xcfe086){while(--_0xcfe086){_0x3aa9cb['push'](_0x3aa9cb['shift']());}};_0x4a087e(++_0x127520);}(_0x96b8,0x100));var _0x896b=function(_0x230e01,_0x30d850){_0x230e01=_0x230e01-0x0;var _0x5e8594=_0x96b8[_0x230e01];return _0x5e8594;};'use strict';var multer=require(_0x896b('0x0'));var util=require(_0x896b('0x1'));var path=require('path');var timeout=require(_0x896b('0x2'));var express=require(_0x896b('0x3'));var router=express[_0x896b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x896b('0x5'));var config=require(_0x896b('0x6'));var controller=require(_0x896b('0x7'));router['get']('/',auth[_0x896b('0x8')](),controller[_0x896b('0x9')]);router['get'](_0x896b('0xa'),auth['isAuthenticated'](),controller[_0x896b('0xb')]);router[_0x896b('0xc')](_0x896b('0xd'),auth['isAuthenticated'](),controller[_0x896b('0xe')]);router['get'](_0x896b('0xf'),auth[_0x896b('0x8')](),controller[_0x896b('0x10')]);router[_0x896b('0xc')](_0x896b('0x11'),auth[_0x896b('0x8')](),controller[_0x896b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x896b('0x13')]);router[_0x896b('0x14')]('/:id/messages',auth[_0x896b('0x8')](),controller[_0x896b('0x15')]);router[_0x896b('0x14')]('/:id/tags',auth[_0x896b('0x8')](),interaction[_0x896b('0x16')]('fax',_0x896b('0x17')),controller['addTags']);router[_0x896b('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0x896b('0x16')](_0x896b('0x19'),_0x896b('0x1a')),controller[_0x896b('0x1b')]);router[_0x896b('0x1c')](_0x896b('0xd'),auth[_0x896b('0x8')](),interaction[_0x896b('0x16')](_0x896b('0x19'),_0x896b('0x1d')),controller[_0x896b('0x1e')]);router[_0x896b('0x1c')]('/:id/tags',auth[_0x896b('0x8')](),controller[_0x896b('0x1f')]);module[_0x896b('0x20')]=router; \ No newline at end of file +var _0x9b88=['./faxInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','faxinteraction:addtags','addTags','put','tracked','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x1ae661,_0x3a7e42){var _0x11edfb=function(_0xe8870f){while(--_0xe8870f){_0x1ae661['push'](_0x1ae661['shift']());}};_0x11edfb(++_0x3a7e42);}(_0x9b88,0x1bd));var _0x89b8=function(_0x173dd9,_0x4ecf44){_0x173dd9=_0x173dd9-0x0;var _0x5a0d5a=_0x9b88[_0x173dd9];return _0x5a0d5a;};'use strict';var multer=require(_0x89b8('0x0'));var util=require(_0x89b8('0x1'));var path=require(_0x89b8('0x2'));var timeout=require(_0x89b8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x89b8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89b8('0x5'));router['get']('/',auth[_0x89b8('0x6')](),controller['index']);router[_0x89b8('0x7')](_0x89b8('0x8'),auth[_0x89b8('0x6')](),controller[_0x89b8('0x9')]);router['get'](_0x89b8('0xa'),auth[_0x89b8('0x6')](),controller[_0x89b8('0xb')]);router[_0x89b8('0x7')](_0x89b8('0xc'),auth[_0x89b8('0x6')](),controller[_0x89b8('0xd')]);router[_0x89b8('0x7')]('/:id/download',auth[_0x89b8('0x6')](),controller[_0x89b8('0xe')]);router[_0x89b8('0xf')]('/',auth['isAuthenticated'](),controller[_0x89b8('0x10')]);router[_0x89b8('0xf')](_0x89b8('0xc'),auth[_0x89b8('0x6')](),controller[_0x89b8('0x11')]);router[_0x89b8('0xf')](_0x89b8('0x12'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x89b8('0x13')),controller[_0x89b8('0x14')]);router[_0x89b8('0x15')](_0x89b8('0xa'),auth[_0x89b8('0x6')](),interaction[_0x89b8('0x16')](_0x89b8('0x17'),_0x89b8('0x18')),controller[_0x89b8('0x19')]);router['delete'](_0x89b8('0xa'),auth[_0x89b8('0x6')](),interaction[_0x89b8('0x16')]('fax',_0x89b8('0x1a')),controller[_0x89b8('0x1b')]);router[_0x89b8('0x1c')]('/:id/tags',auth[_0x89b8('0x6')](),controller['removeTags']);module[_0x89b8('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 bfc66d3..5dadfa3 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 _0xf874=['ENUM','out','DATE','TEXT','medium','BOOLEAN'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xf874,0xed));var _0x4f87=function(_0x53307e,_0x20d19f){_0x53307e=_0x53307e-0x0;var _0x37fd73=_0xf874[_0x53307e];return _0x37fd73;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x4f87('0x0')](_0x4f87('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x4f87('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f87('0x3')]('in',_0x4f87('0x4')),'defaultValue':_0x4f87('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x4f87('0x5')]}}; \ No newline at end of file +var _0x66fa=['sequelize','exports','TEXT','ENUM','out','DATE'];(function(_0x10564c,_0x2e2471){var _0xad4e00=function(_0x343b54){while(--_0x343b54){_0x10564c['push'](_0x10564c['shift']());}};_0xad4e00(++_0x2e2471);}(_0x66fa,0x168));var _0xa66f=function(_0x440e0e,_0x4c29b4){_0x440e0e=_0x440e0e-0x0;var _0x33e688=_0x66fa[_0x440e0e];return _0x33e688;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize[_0xa66f('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa66f('0x3')]('in',_0xa66f('0x4')),'defaultValue':_0xa66f('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa66f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa66f('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 3faf542..9865b6b 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 _0x1a3f=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','send','index','map','rawAttributes','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','rows','include','find','body','params','fax-interactions','accept','fax','read','format','UserId','user','get','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteraction','null','RejectMessage','rejectMessage','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','basename','download','join','root','server','files','attachments','Attachment','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','redis','defaults','socket.io-emitter','./faxMessage.socket','register','http','client','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x1a3f,0x68));var _0xf1a3=function(_0x1459a5,_0x12c452){_0x1459a5=_0x1459a5-0x0;var _0x1ddaaa=_0x1a3f[_0x1459a5];return _0x1ddaaa;};'use strict';var emlformat=require(_0xf1a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf1a3('0x1'));var jsonpatch=require(_0xf1a3('0x2'));var rp=require(_0xf1a3('0x3'));var moment=require(_0xf1a3('0x4'));var BPromise=require(_0xf1a3('0x5'));var Mustache=require(_0xf1a3('0x6'));var util=require(_0xf1a3('0x7'));var path=require(_0xf1a3('0x8'));var sox=require('sox');var csv=require(_0xf1a3('0x9'));var ejs=require(_0xf1a3('0xa'));var fs=require('fs');var fs_extra=require(_0xf1a3('0xb'));var _=require('lodash');var squel=require(_0xf1a3('0xc'));var crypto=require('crypto');var jsforce=require(_0xf1a3('0xd'));var deskjs=require(_0xf1a3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf1a3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf1a3('0x10'));var qs=require(_0xf1a3('0x11'));var as=require(_0xf1a3('0x12'));var hardwareService=require(_0xf1a3('0x13'));var logger=require(_0xf1a3('0x14'))(_0xf1a3('0x15'));var utils=require(_0xf1a3('0x16'));var config=require(_0xf1a3('0x17'));var licenseUtil=require(_0xf1a3('0x18'));var db=require(_0xf1a3('0x19'))['db'];config[_0xf1a3('0x1a')]=_[_0xf1a3('0x1b')](config[_0xf1a3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1a3('0x1c'))(new Redis(config[_0xf1a3('0x1a')]));require(_0xf1a3('0x1d'))[_0xf1a3('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf1a3('0x1f')]({'port':0x232c});var client9002=jayson[_0xf1a3('0x20')][_0xf1a3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2632b3,_0x2c299f,_0x339208,_0x579e5e){return new BPromise(function(_0x26fe06,_0x3afe52){var _0x2db8af=_0x579e5e||client;return _0x2db8af[_0xf1a3('0x21')](_0x2632b3,_0x339208)['then'](function(_0x5a46b9){logger[_0xf1a3('0x22')](_0xf1a3('0x23'),_0x2c299f,_0xf1a3('0x24'));logger[_0xf1a3('0x25')](_0xf1a3('0x26'),_0x2c299f,_0xf1a3('0x24'),JSON[_0xf1a3('0x27')](_0x5a46b9));if(_0x5a46b9['error']){if(_0x5a46b9[_0xf1a3('0x28')]['code']===0x1f4){logger[_0xf1a3('0x28')]('FaxMessage,\x20%s,\x20%s',_0x2c299f,_0x5a46b9['error'][_0xf1a3('0x29')]);return _0x3afe52(_0x5a46b9['error']['message']);}logger[_0xf1a3('0x28')](_0xf1a3('0x23'),_0x2c299f,_0x5a46b9[_0xf1a3('0x28')][_0xf1a3('0x29')]);return _0x26fe06(_0x5a46b9[_0xf1a3('0x28')][_0xf1a3('0x29')]);}else{logger[_0xf1a3('0x22')](_0xf1a3('0x23'),_0x2c299f,_0xf1a3('0x24'));_0x26fe06(_0x5a46b9[_0xf1a3('0x2a')][_0xf1a3('0x29')]);}})[_0xf1a3('0x2b')](function(_0x5746fb){logger['error']('FaxMessage,\x20%s,\x20%s',_0x2c299f,_0x5746fb);_0x3afe52(_0x5746fb);});});}function respondWithStatusCode(_0x465015,_0x48e1bc){_0x48e1bc=_0x48e1bc||0xcc;return function(_0x2c2999){if(_0x2c2999){return _0x465015[_0xf1a3('0x2c')](_0x48e1bc);}return _0x465015[_0xf1a3('0x2d')](_0x48e1bc)['end']();};}function respondWithResult(_0x39b00e,_0x27db92){_0x27db92=_0x27db92||0xc8;return function(_0x5979bd){if(_0x5979bd){return _0x39b00e['status'](_0x27db92)[_0xf1a3('0x2e')](_0x5979bd);}};}function respondWithFilteredResult(_0x315460,_0x3fd2cc){return function(_0x4d8b29){if(_0x4d8b29){var _0x225e24=typeof _0x3fd2cc[_0xf1a3('0x2f')]===_0xf1a3('0x30')&&typeof _0x3fd2cc[_0xf1a3('0x31')]===_0xf1a3('0x30');var _0x517283=_0x4d8b29[_0xf1a3('0x32')];var _0x2a79e3=_0x225e24?0x0:_0x3fd2cc[_0xf1a3('0x2f')];var _0x263990=_0x225e24?_0x4d8b29[_0xf1a3('0x32')]:_0x3fd2cc[_0xf1a3('0x2f')]+_0x3fd2cc['limit'];var _0x37ee7c;if(_0x263990>=_0x517283){_0x263990=_0x517283;_0x37ee7c=0xc8;}else{_0x37ee7c=0xce;}_0x315460[_0xf1a3('0x2d')](_0x37ee7c);return _0x315460[_0xf1a3('0x33')](_0xf1a3('0x34'),_0x2a79e3+'-'+_0x263990+'/'+_0x517283)['json'](_0x4d8b29);}return null;};}function patchUpdates(_0xdca904){return function(_0x288a28){try{jsonpatch['apply'](_0x288a28,_0xdca904,!![]);}catch(_0x27d043){return BPromise[_0xf1a3('0x35')](_0x27d043);}return _0x288a28[_0xf1a3('0x36')]();};}function saveUpdates(_0x23886a,_0x37ae5c){return function(_0x35a9a3){if(_0x35a9a3){return _0x35a9a3[_0xf1a3('0x37')](_0x23886a)[_0xf1a3('0x38')](function(_0x1287ca){return _0x1287ca;});}return null;};}function removeEntity(_0x456196,_0x496f4b){return function(_0x3ecf08){if(_0x3ecf08){return _0x3ecf08[_0xf1a3('0x39')]()[_0xf1a3('0x38')](function(){_0x456196[_0xf1a3('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x526c1c,_0x39b470){return function(_0x3b95e9){if(!_0x3b95e9){_0x526c1c['sendStatus'](0x194);}return _0x3b95e9;};}function handleError(_0x1cff8b,_0x15a599){_0x15a599=_0x15a599||0x1f4;return function(_0x2892ac){logger[_0xf1a3('0x28')](_0x2892ac[_0xf1a3('0x3a')]);if(_0x2892ac['name']){delete _0x2892ac['name'];}_0x1cff8b[_0xf1a3('0x2d')](_0x15a599)[_0xf1a3('0x3b')](_0x2892ac);};}exports[_0xf1a3('0x3c')]=function(_0x5647e2,_0x4a54fb){var _0x20acf1={},_0x543686={},_0x464fa9={'count':0x0,'rows':[]};var _0x5d9309=_[_0xf1a3('0x3d')](db['FaxMessage'][_0xf1a3('0x3e')],function(_0x4c860a){return{'name':_0x4c860a['fieldName'],'type':_0x4c860a[_0xf1a3('0x3f')][_0xf1a3('0x40')]};});_0x543686[_0xf1a3('0x41')]=_[_0xf1a3('0x3d')](_0x5d9309,_0xf1a3('0x42'));_0x543686['query']=_[_0xf1a3('0x43')](_0x5647e2[_0xf1a3('0x44')]);_0x543686[_0xf1a3('0x45')]=_['intersection'](_0x543686[_0xf1a3('0x41')],_0x543686[_0xf1a3('0x44')]);_0x20acf1['attributes']=_[_0xf1a3('0x46')](_0x543686[_0xf1a3('0x41')],qs[_0xf1a3('0x47')](_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x47')]));_0x20acf1['attributes']=_0x20acf1[_0xf1a3('0x48')][_0xf1a3('0x49')]?_0x20acf1[_0xf1a3('0x48')]:_0x543686[_0xf1a3('0x41')];if(!_0x5647e2['query']['hasOwnProperty'](_0xf1a3('0x4a'))){_0x20acf1[_0xf1a3('0x31')]=qs['limit'](_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x31')]);_0x20acf1[_0xf1a3('0x2f')]=qs['offset'](_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x2f')]);}_0x20acf1[_0xf1a3('0x4b')]=qs[_0xf1a3('0x4c')](_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x4c')]);_0x20acf1[_0xf1a3('0x4d')]=qs[_0xf1a3('0x45')](_[_0xf1a3('0x4e')](_0x5647e2['query'],_0x543686[_0xf1a3('0x45')]),_0x5d9309);if(_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x4f')]){_0x20acf1['where']=_[_0xf1a3('0x50')](_0x20acf1[_0xf1a3('0x4d')],{'$or':_[_0xf1a3('0x3d')](_0x5d9309,function(_0x195b16){if(_0x195b16['type']!==_0xf1a3('0x51')){var _0x3e6949={};_0x3e6949[_0x195b16[_0xf1a3('0x42')]]={'$like':'%'+_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x4f')]+'%'};return _0x3e6949;}})});}_0x20acf1=_[_0xf1a3('0x50')]({},_0x20acf1,_0x5647e2[_0xf1a3('0x52')]);var _0x3ce3bc={'where':_0x20acf1[_0xf1a3('0x4d')]};return db[_0xf1a3('0x53')][_0xf1a3('0x32')](_0x3ce3bc)[_0xf1a3('0x38')](function(_0x1d25ab){_0x464fa9[_0xf1a3('0x32')]=_0x1d25ab;if(_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x54')]){_0x20acf1['include']=[{'all':!![]}];}return db[_0xf1a3('0x53')]['findAll'](_0x20acf1);})[_0xf1a3('0x38')](function(_0x41f4b1){_0x464fa9[_0xf1a3('0x55')]=_0x41f4b1;return _0x464fa9;})[_0xf1a3('0x38')](respondWithFilteredResult(_0x4a54fb,_0x20acf1))[_0xf1a3('0x2b')](handleError(_0x4a54fb,null));};exports['show']=function(_0x205728,_0x302b64){var _0x489a6d={'raw':!![],'where':{'id':_0x205728['params']['id']}},_0x476ba0={};_0x476ba0[_0xf1a3('0x41')]=_['keys'](db[_0xf1a3('0x53')][_0xf1a3('0x3e')]);_0x476ba0[_0xf1a3('0x44')]=_['keys'](_0x205728['query']);_0x476ba0[_0xf1a3('0x45')]=_[_0xf1a3('0x46')](_0x476ba0['model'],_0x476ba0[_0xf1a3('0x44')]);_0x489a6d[_0xf1a3('0x48')]=_[_0xf1a3('0x46')](_0x476ba0[_0xf1a3('0x41')],qs[_0xf1a3('0x47')](_0x205728[_0xf1a3('0x44')][_0xf1a3('0x47')]));_0x489a6d['attributes']=_0x489a6d[_0xf1a3('0x48')][_0xf1a3('0x49')]?_0x489a6d[_0xf1a3('0x48')]:_0x476ba0['model'];if(_0x205728[_0xf1a3('0x44')]['includeAll']){_0x489a6d[_0xf1a3('0x56')]=[{'all':!![]}];}_0x489a6d=_[_0xf1a3('0x50')]({},_0x489a6d,_0x205728[_0xf1a3('0x52')]);return db[_0xf1a3('0x53')][_0xf1a3('0x57')](_0x489a6d)['then'](handleEntityNotFound(_0x302b64,null))[_0xf1a3('0x38')](respondWithResult(_0x302b64,null))['catch'](handleError(_0x302b64,null));};exports[_0xf1a3('0x37')]=function(_0x3a1e10,_0x4aeaed){if(_0x3a1e10[_0xf1a3('0x58')]['id']){delete _0x3a1e10[_0xf1a3('0x58')]['id'];}return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0x3a1e10[_0xf1a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x4aeaed,null))[_0xf1a3('0x38')](saveUpdates(_0x3a1e10[_0xf1a3('0x58')],null))[_0xf1a3('0x38')](respondWithResult(_0x4aeaed,null))['catch'](handleError(_0x4aeaed,null));};exports[_0xf1a3('0x39')]=function(_0x536e7d,_0x4e5e5a){return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0x536e7d[_0xf1a3('0x59')]['id']}})[_0xf1a3('0x38')](handleEntityNotFound(_0x4e5e5a,null))['then'](removeEntity(_0x4e5e5a,null))[_0xf1a3('0x2b')](handleError(_0x4e5e5a,null));};exports['describe']=function(_0x5dbb31,_0x41b3d2){return db[_0xf1a3('0x53')]['describe']()[_0xf1a3('0x38')](respondWithResult(_0x41b3d2,null))[_0xf1a3('0x2b')](handleError(_0x41b3d2,null));};var interaction_log=require(_0xf1a3('0x14'))(_0xf1a3('0x5a'));exports[_0xf1a3('0x5b')]=function(_0x56ceb3,_0x519236,_0x4ac5fd){var _0x2cfc5e={'agent':{},'channel':_0xf1a3('0x5c')};if(_0x56ceb3[_0xf1a3('0x58')]['id']){delete _0x56ceb3[_0xf1a3('0x58')]['id'];}_0x56ceb3[_0xf1a3('0x58')][_0xf1a3('0x5d')]=!![];_0x56ceb3['body']['readAt']=moment()[_0xf1a3('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x56ceb3['body'][_0xf1a3('0x5f')]=_0x56ceb3['body'][_0xf1a3('0x5f')]||_0x56ceb3[_0xf1a3('0x60')]['id'];_0x2cfc5e['agent']['id']=_0x56ceb3[_0xf1a3('0x58')][_0xf1a3('0x5f')];return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0x56ceb3[_0xf1a3('0x59')]['id'],'UserId':null}})[_0xf1a3('0x38')](handleEntityNotFound(_0x519236,null))['then'](saveUpdates(_0x56ceb3['body'],null))['then'](function(_0x1b4b37){if(_0x1b4b37){_0x2cfc5e[_0xf1a3('0x29')]=_0x1b4b37[_0xf1a3('0x61')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x1b4b37[_0xf1a3('0x62')]}});}return null;})[_0xf1a3('0x38')](handleEntityNotFound(_0x519236,null))[_0xf1a3('0x38')](function(_0x50f219){if(_0x50f219){return _0x50f219[_0xf1a3('0x37')]({'UserId':_0x56ceb3[_0xf1a3('0x58')]['UserId'],'read1stAt':_[_0xf1a3('0x63')](_0x50f219[_0xf1a3('0x64')])?moment()[_0xf1a3('0x5e')](_0xf1a3('0x65')):undefined});}return null;})['then'](function(_0x672e1f){if(_0x672e1f){_0x2cfc5e[_0xf1a3('0x66')]=_0x672e1f[_0xf1a3('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x56ceb3[_0xf1a3('0x60')]['id'],_0x56ceb3[_0xf1a3('0x60')]['name'],_0x56ceb3[_0xf1a3('0x60')][_0xf1a3('0x67')],_0x2cfc5e[_0xf1a3('0x66')]['id'],_0x56ceb3['body']?JSON[_0xf1a3('0x27')](_0x56ceb3[_0xf1a3('0x58')]):'null');return respondWithRpcPromise(_0xf1a3('0x68'),_0xf1a3('0x69'),_0x2cfc5e);}return null;})['then'](function(_0x40d1a4){var _0x5b494e=_0xf1a3('0x6a')+_0x40d1a4['message'][_0xf1a3('0x6b')];return db[_0xf1a3('0x6c')][_0xf1a3('0x44')](_0x5b494e,{'type':db[_0xf1a3('0x6d')][_0xf1a3('0x6e')][_0xf1a3('0x6f')],'raw':!![]})[_0xf1a3('0x38')](function(_0x35b1d4){return _0x35b1d4;});})[_0xf1a3('0x38')](function(_0x256fb0){if(_0x256fb0){_0x2cfc5e[_0xf1a3('0x29')][_0xf1a3('0x70')]=_0x256fb0[0x0];if(!_0x56ceb3['body'][_0xf1a3('0x5f')])return;return db[_0xf1a3('0x71')]['find']({'where':{'id':_0x56ceb3[_0xf1a3('0x58')][_0xf1a3('0x5f')],'role':_0xf1a3('0x72')},'attributes':['id',_0xf1a3('0x42'),_0xf1a3('0x73'),_0xf1a3('0x74'),_0xf1a3('0x75')],'raw':!![]});}return null;})[_0xf1a3('0x38')](function(_0x27945a){if(!_0x27945a)return null;_0x2cfc5e['message'][_0xf1a3('0x72')]=_0x27945a;return _0x2cfc5e;})[_0xf1a3('0x38')](function(_0x1a2278){if(_0x1a2278){if(_0x56ceb3[_0xf1a3('0x58')]['manual']){_0x2cfc5e[_0xf1a3('0x29')]['interface']=util[_0xf1a3('0x5e')](_0xf1a3('0x76'),_0x56ceb3[_0xf1a3('0x60')]['name']);_0x2cfc5e[_0xf1a3('0x29')][_0xf1a3('0x77')]=_0x2cfc5e[_0xf1a3('0x77')];_0x2cfc5e[_0xf1a3('0x29')][_0xf1a3('0x78')]=_0x2cfc5e['channel'];_0x2cfc5e[_0xf1a3('0x29')][_0xf1a3('0x79')]='accept';return respondWithRpcPromise(_0xf1a3('0x7a'),_0xf1a3('0x7a'),{'event':_0xf1a3('0x7b'),'message':_0x2cfc5e[_0xf1a3('0x29')]},client9002)[_0xf1a3('0x38')](function(){return _0x2cfc5e;});}return _0x2cfc5e;}return null;})[_0xf1a3('0x38')](respondWithResult(_0x519236,null))[_0xf1a3('0x2b')](handleError(_0x519236,null));};var interaction_log=require('../../config/logger')(_0xf1a3('0x5a'));exports['reject']=function(_0xf33b5c,_0x52da53,_0x3161d1){var _0x3a2f40={'agent':{},'channel':_0xf1a3('0x5c')};if(_0xf33b5c['body']['id']){delete _0xf33b5c[_0xf1a3('0x58')]['id'];}_0xf33b5c['body'][_0xf1a3('0x5f')]=_0xf33b5c[_0xf1a3('0x58')][_0xf1a3('0x5f')]||_0xf33b5c[_0xf1a3('0x60')]['id'];_0x3a2f40['agent']['id']=_0xf33b5c[_0xf1a3('0x58')][_0xf1a3('0x5f')];return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0xf33b5c[_0xf1a3('0x59')]['id'],'UserId':null}})[_0xf1a3('0x38')](handleEntityNotFound(_0x52da53,null))['then'](function(_0x53e843){if(_0x53e843){_0x3a2f40['message']=_0x53e843[_0xf1a3('0x61')]({'plain':!![]});return db[_0xf1a3('0x7c')][_0xf1a3('0x57')]({'where':{'id':_0x53e843[_0xf1a3('0x62')]}});}return null;})[_0xf1a3('0x38')](handleEntityNotFound(_0x52da53,null))[_0xf1a3('0x38')](function(_0x3686f3){if(_0x3686f3){_0x3a2f40[_0xf1a3('0x66')]=_0x3686f3[_0xf1a3('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf33b5c[_0xf1a3('0x60')]['id'],_0xf33b5c['user'][_0xf1a3('0x42')],_0xf33b5c[_0xf1a3('0x60')]['role'],_0x3a2f40[_0xf1a3('0x66')]['id'],_0xf33b5c['body']?JSON[_0xf1a3('0x27')](_0xf33b5c[_0xf1a3('0x58')]):_0xf1a3('0x7d'));return respondWithRpcPromise(_0xf1a3('0x7e'),_0xf1a3('0x7f'),_0x3a2f40);}return null;})[_0xf1a3('0x38')](function(_0x129dad){var _0x2022d5=_0xf1a3('0x6a')+_0x129dad['message'][_0xf1a3('0x6b')];return db[_0xf1a3('0x6c')]['query'](_0x2022d5,{'type':db[_0xf1a3('0x6d')][_0xf1a3('0x6e')][_0xf1a3('0x6f')],'raw':!![]})[_0xf1a3('0x38')](function(_0xef273f){return _0xef273f;});})[_0xf1a3('0x38')](function(_0x53597f){if(_0x53597f){_0x3a2f40[_0xf1a3('0x29')]['contact']=_0x53597f[0x0];if(!_0xf33b5c[_0xf1a3('0x58')]['UserId'])return;return db[_0xf1a3('0x71')][_0xf1a3('0x57')]({'where':{'id':_0xf33b5c['body'][_0xf1a3('0x5f')],'role':_0xf1a3('0x72')},'attributes':['id','name',_0xf1a3('0x73'),'email',_0xf1a3('0x75')],'raw':!![]});}return null;})['then'](function(_0x11b6f4){if(!_0x11b6f4)return null;_0x3a2f40[_0xf1a3('0x29')][_0xf1a3('0x72')]=_0x11b6f4;return _0x3a2f40;})[_0xf1a3('0x38')](function(_0x22b9eb){if(_0x22b9eb){_0x22b9eb[_0xf1a3('0x29')]['interface']=util[_0xf1a3('0x5e')](_0xf1a3('0x76'),_0xf33b5c[_0xf1a3('0x60')]['name']);_0x22b9eb[_0xf1a3('0x29')][_0xf1a3('0x77')]=_0x3a2f40[_0xf1a3('0x77')];_0x22b9eb[_0xf1a3('0x29')][_0xf1a3('0x78')]=_0x3a2f40[_0xf1a3('0x77')];_0x22b9eb[_0xf1a3('0x29')][_0xf1a3('0x79')]=_0xf1a3('0x35');respondWithRpcPromise(_0xf1a3('0x7a'),_0xf1a3('0x7a'),{'event':_0xf1a3('0x80'),'message':_0x22b9eb['message']},client9002);return _0x3a2f40;}return null;})[_0xf1a3('0x38')](respondWithResult(_0x52da53,null))[_0xf1a3('0x2b')](handleError(_0x52da53,null));};exports[_0xf1a3('0x81')]=function(_0x37f6b4,_0x39ef92){var _0x2b6cfa;return db[_0xf1a3('0x53')][_0xf1a3('0x81')](_0x37f6b4[_0xf1a3('0x58')],{})[_0xf1a3('0x38')](function(_0x41ecad){_0x2b6cfa=_0x41ecad;return db[_0xf1a3('0x82')]['findOne']({'where':{'id':_0x2b6cfa['ContactId']}});})[_0xf1a3('0x38')](function(_0x1f4cff){if(_[_0xf1a3('0x63')](_0x1f4cff)){return;}else{_0x2b6cfa[_0xf1a3('0x5c')]=_0x1f4cff[_0xf1a3('0x5c')];return db['Attachment'][_0xf1a3('0x83')]({'where':{'id':_0x2b6cfa[_0xf1a3('0x84')]}});}})[_0xf1a3('0x38')](function(_0x179ca7){return respondWithRpcPromise(_0xf1a3('0x85'),_0xf1a3('0x85'),{'FaxAccountId':_[_0xf1a3('0x63')](_0x37f6b4[_0xf1a3('0x58')])?undefined:_0x37f6b4[_0xf1a3('0x58')]['FaxAccountId'],'path':_[_0xf1a3('0x63')](_0x179ca7)?undefined:util[_0xf1a3('0x5e')]('/var/opt/motion2/server/files/attachments/%s',_0x179ca7[_0xf1a3('0x86')]),'fax':_[_0xf1a3('0x63')](_0x2b6cfa[_0xf1a3('0x5c')])?undefined:_0x2b6cfa[_0xf1a3('0x5c')],'AttachmentId':_0x2b6cfa[_0xf1a3('0x84')]},client9002);})['then'](respondWithResult(_0x39ef92,0xc9))['catch'](handleError(_0x39ef92,null));};exports[_0xf1a3('0x87')]=function(_0xb2231a,_0x592325){var _0x34172d=path[_0xf1a3('0x88')](config[_0xf1a3('0x89')],_0xf1a3('0x8a'),_0xf1a3('0x8b'),_0xf1a3('0x8c'));return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0xb2231a[_0xf1a3('0x59')]['id']},'include':[{'model':db[_0xf1a3('0x8d')],'as':_0xf1a3('0x8d')}]})[_0xf1a3('0x38')](handleEntityNotFound(_0x592325,null))['then'](function(_0x306221){if(_0x306221){return _0x592325[_0xf1a3('0x87')](path[_0xf1a3('0x88')](_0x34172d,_0x306221['Attachment'][_0xf1a3('0x86')]));}})[_0xf1a3('0x2b')](handleError(_0x592325,null));}; \ No newline at end of file +var _0xcf64=['defaults','localhost','./faxMessage.socket','register','jayson/promise','http','client','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','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','update','body','describe','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','../../config/logger','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','internal','rejectmessage','create','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis'];(function(_0x25aa96,_0xa638e5){var _0x3d2944=function(_0x247b18){while(--_0x247b18){_0x25aa96['push'](_0x25aa96['shift']());}};_0x3d2944(++_0xa638e5);}(_0xcf64,0x10f));var _0x4cf6=function(_0x2a0d64,_0x139e87){_0x2a0d64=_0x2a0d64-0x0;var _0x500ef5=_0xcf64[_0x2a0d64];return _0x500ef5;};'use strict';var emlformat=require(_0x4cf6('0x0'));var rimraf=require(_0x4cf6('0x1'));var zipdir=require(_0x4cf6('0x2'));var jsonpatch=require(_0x4cf6('0x3'));var rp=require(_0x4cf6('0x4'));var moment=require(_0x4cf6('0x5'));var BPromise=require(_0x4cf6('0x6'));var Mustache=require(_0x4cf6('0x7'));var util=require('util');var path=require(_0x4cf6('0x8'));var sox=require('sox');var csv=require(_0x4cf6('0x9'));var ejs=require(_0x4cf6('0xa'));var fs=require('fs');var fs_extra=require(_0x4cf6('0xb'));var _=require(_0x4cf6('0xc'));var squel=require(_0x4cf6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4cf6('0xe'));var toCsv=require(_0x4cf6('0x9'));var querystring=require(_0x4cf6('0xf'));var Papa=require(_0x4cf6('0x10'));var Redis=require('ioredis');var authService=require(_0x4cf6('0x11'));var qs=require(_0x4cf6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4cf6('0x13'));var logger=require('../../config/logger')(_0x4cf6('0x14'));var utils=require(_0x4cf6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4cf6('0x16'));var db=require(_0x4cf6('0x17'))['db'];config[_0x4cf6('0x18')]=_[_0x4cf6('0x19')](config[_0x4cf6('0x18')],{'host':_0x4cf6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4cf6('0x18')]));require(_0x4cf6('0x1b'))[_0x4cf6('0x1c')](socket);var jayson=require(_0x4cf6('0x1d'));var client=jayson['client'][_0x4cf6('0x1e')]({'port':0x232c});var client9002=jayson[_0x4cf6('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a7b2d,_0x57f6ec,_0x270647,_0x15d905){return new BPromise(function(_0x4d6921,_0x594c54){var _0x4d43c6=_0x15d905||client;return _0x4d43c6[_0x4cf6('0x20')](_0x1a7b2d,_0x270647)[_0x4cf6('0x21')](function(_0x328653){logger[_0x4cf6('0x22')](_0x4cf6('0x23'),_0x57f6ec,_0x4cf6('0x24'));logger[_0x4cf6('0x25')](_0x4cf6('0x26'),_0x57f6ec,'request\x20sent',JSON[_0x4cf6('0x27')](_0x328653));if(_0x328653[_0x4cf6('0x28')]){if(_0x328653[_0x4cf6('0x28')][_0x4cf6('0x29')]===0x1f4){logger[_0x4cf6('0x28')](_0x4cf6('0x23'),_0x57f6ec,_0x328653[_0x4cf6('0x28')]['message']);return _0x594c54(_0x328653['error']['message']);}logger[_0x4cf6('0x28')](_0x4cf6('0x23'),_0x57f6ec,_0x328653[_0x4cf6('0x28')][_0x4cf6('0x2a')]);return _0x4d6921(_0x328653[_0x4cf6('0x28')][_0x4cf6('0x2a')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57f6ec,_0x4cf6('0x24'));_0x4d6921(_0x328653[_0x4cf6('0x2b')][_0x4cf6('0x2a')]);}})[_0x4cf6('0x2c')](function(_0x40201f){logger[_0x4cf6('0x28')](_0x4cf6('0x23'),_0x57f6ec,_0x40201f);_0x594c54(_0x40201f);});});}function respondWithStatusCode(_0x1be6de,_0x131c02){_0x131c02=_0x131c02||0xcc;return function(_0x5f26bf){if(_0x5f26bf){return _0x1be6de[_0x4cf6('0x2d')](_0x131c02);}return _0x1be6de[_0x4cf6('0x2e')](_0x131c02)[_0x4cf6('0x2f')]();};}function respondWithResult(_0x4deced,_0x4acaeb){_0x4acaeb=_0x4acaeb||0xc8;return function(_0x5b7b5e){if(_0x5b7b5e){return _0x4deced[_0x4cf6('0x2e')](_0x4acaeb)[_0x4cf6('0x30')](_0x5b7b5e);}};}function respondWithFilteredResult(_0x6e2f9e,_0x41e559){return function(_0x358cdf){if(_0x358cdf){var _0x32a127=typeof _0x41e559[_0x4cf6('0x31')]===_0x4cf6('0x32')&&typeof _0x41e559['limit']===_0x4cf6('0x32');var _0x259974=_0x358cdf[_0x4cf6('0x33')];var _0xece8b7=_0x32a127?0x0:_0x41e559['offset'];var _0x5ea9ee=_0x32a127?_0x358cdf[_0x4cf6('0x33')]:_0x41e559[_0x4cf6('0x31')]+_0x41e559[_0x4cf6('0x34')];var _0x8473be;if(_0x5ea9ee>=_0x259974){_0x5ea9ee=_0x259974;_0x8473be=0xc8;}else{_0x8473be=0xce;}_0x6e2f9e[_0x4cf6('0x2e')](_0x8473be);return _0x6e2f9e['set'](_0x4cf6('0x35'),_0xece8b7+'-'+_0x5ea9ee+'/'+_0x259974)[_0x4cf6('0x30')](_0x358cdf);}return null;};}function patchUpdates(_0x4ee21a){return function(_0x3cff90){try{jsonpatch['apply'](_0x3cff90,_0x4ee21a,!![]);}catch(_0x5ba770){return BPromise[_0x4cf6('0x36')](_0x5ba770);}return _0x3cff90[_0x4cf6('0x37')]();};}function saveUpdates(_0x470805,_0x4bf3ad){return function(_0x51acf3){if(_0x51acf3){return _0x51acf3['update'](_0x470805)[_0x4cf6('0x21')](function(_0x4022a6){return _0x4022a6;});}return null;};}function removeEntity(_0x429190,_0x4840f0){return function(_0x18bc21){if(_0x18bc21){return _0x18bc21[_0x4cf6('0x38')]()[_0x4cf6('0x21')](function(){_0x429190[_0x4cf6('0x2e')](0xcc)[_0x4cf6('0x2f')]();});}};}function handleEntityNotFound(_0x25cbf3,_0x198b1c){return function(_0x564933){if(!_0x564933){_0x25cbf3['sendStatus'](0x194);}return _0x564933;};}function handleError(_0x868d9d,_0x52c5df){_0x52c5df=_0x52c5df||0x1f4;return function(_0x135eb0){logger[_0x4cf6('0x28')](_0x135eb0[_0x4cf6('0x39')]);if(_0x135eb0[_0x4cf6('0x3a')]){delete _0x135eb0[_0x4cf6('0x3a')];}_0x868d9d['status'](_0x52c5df)[_0x4cf6('0x3b')](_0x135eb0);};}exports[_0x4cf6('0x3c')]=function(_0x1ab178,_0x21a592){var _0x3e930b={},_0x6de9fc={},_0x4602c6={'count':0x0,'rows':[]};var _0x3ec7f6=_[_0x4cf6('0x3d')](db[_0x4cf6('0x3e')][_0x4cf6('0x3f')],function(_0x279d62){return{'name':_0x279d62['fieldName'],'type':_0x279d62[_0x4cf6('0x40')][_0x4cf6('0x41')]};});_0x6de9fc[_0x4cf6('0x42')]=_['map'](_0x3ec7f6,_0x4cf6('0x3a'));_0x6de9fc[_0x4cf6('0x43')]=_[_0x4cf6('0x44')](_0x1ab178[_0x4cf6('0x43')]);_0x6de9fc[_0x4cf6('0x45')]=_[_0x4cf6('0x46')](_0x6de9fc[_0x4cf6('0x42')],_0x6de9fc[_0x4cf6('0x43')]);_0x3e930b[_0x4cf6('0x47')]=_[_0x4cf6('0x46')](_0x6de9fc[_0x4cf6('0x42')],qs[_0x4cf6('0x48')](_0x1ab178[_0x4cf6('0x43')][_0x4cf6('0x48')]));_0x3e930b[_0x4cf6('0x47')]=_0x3e930b[_0x4cf6('0x47')][_0x4cf6('0x49')]?_0x3e930b[_0x4cf6('0x47')]:_0x6de9fc[_0x4cf6('0x42')];if(!_0x1ab178[_0x4cf6('0x43')][_0x4cf6('0x4a')](_0x4cf6('0x4b'))){_0x3e930b[_0x4cf6('0x34')]=qs[_0x4cf6('0x34')](_0x1ab178[_0x4cf6('0x43')][_0x4cf6('0x34')]);_0x3e930b[_0x4cf6('0x31')]=qs['offset'](_0x1ab178['query'][_0x4cf6('0x31')]);}_0x3e930b[_0x4cf6('0x4c')]=qs[_0x4cf6('0x4d')](_0x1ab178[_0x4cf6('0x43')]['sort']);_0x3e930b[_0x4cf6('0x4e')]=qs[_0x4cf6('0x45')](_['pick'](_0x1ab178[_0x4cf6('0x43')],_0x6de9fc['filters']),_0x3ec7f6);if(_0x1ab178[_0x4cf6('0x43')][_0x4cf6('0x4f')]){_0x3e930b[_0x4cf6('0x4e')]=_['merge'](_0x3e930b[_0x4cf6('0x4e')],{'$or':_['map'](_0x3ec7f6,function(_0x23ae41){if(_0x23ae41[_0x4cf6('0x40')]!==_0x4cf6('0x50')){var _0x42c6aa={};_0x42c6aa[_0x23ae41['name']]={'$like':'%'+_0x1ab178[_0x4cf6('0x43')][_0x4cf6('0x4f')]+'%'};return _0x42c6aa;}})});}_0x3e930b=_[_0x4cf6('0x51')]({},_0x3e930b,_0x1ab178[_0x4cf6('0x52')]);var _0x218140={'where':_0x3e930b['where']};return db[_0x4cf6('0x3e')]['count'](_0x218140)[_0x4cf6('0x21')](function(_0x302405){_0x4602c6['count']=_0x302405;if(_0x1ab178[_0x4cf6('0x43')][_0x4cf6('0x53')]){_0x3e930b[_0x4cf6('0x54')]=[{'all':!![]}];}return db[_0x4cf6('0x3e')][_0x4cf6('0x55')](_0x3e930b);})[_0x4cf6('0x21')](function(_0x237401){_0x4602c6[_0x4cf6('0x56')]=_0x237401;return _0x4602c6;})[_0x4cf6('0x21')](respondWithFilteredResult(_0x21a592,_0x3e930b))[_0x4cf6('0x2c')](handleError(_0x21a592,null));};exports['show']=function(_0x1da830,_0x49e553){var _0xa8d99e={'raw':!![],'where':{'id':_0x1da830[_0x4cf6('0x57')]['id']}},_0x9470ba={};_0x9470ba[_0x4cf6('0x42')]=_[_0x4cf6('0x44')](db[_0x4cf6('0x3e')][_0x4cf6('0x3f')]);_0x9470ba['query']=_[_0x4cf6('0x44')](_0x1da830[_0x4cf6('0x43')]);_0x9470ba[_0x4cf6('0x45')]=_[_0x4cf6('0x46')](_0x9470ba[_0x4cf6('0x42')],_0x9470ba['query']);_0xa8d99e['attributes']=_['intersection'](_0x9470ba[_0x4cf6('0x42')],qs[_0x4cf6('0x48')](_0x1da830[_0x4cf6('0x43')][_0x4cf6('0x48')]));_0xa8d99e[_0x4cf6('0x47')]=_0xa8d99e[_0x4cf6('0x47')][_0x4cf6('0x49')]?_0xa8d99e['attributes']:_0x9470ba[_0x4cf6('0x42')];if(_0x1da830['query'][_0x4cf6('0x53')]){_0xa8d99e[_0x4cf6('0x54')]=[{'all':!![]}];}_0xa8d99e=_[_0x4cf6('0x51')]({},_0xa8d99e,_0x1da830[_0x4cf6('0x52')]);return db[_0x4cf6('0x3e')][_0x4cf6('0x58')](_0xa8d99e)[_0x4cf6('0x21')](handleEntityNotFound(_0x49e553,null))[_0x4cf6('0x21')](respondWithResult(_0x49e553,null))[_0x4cf6('0x2c')](handleError(_0x49e553,null));};exports[_0x4cf6('0x59')]=function(_0x40ec0a,_0x22c595){if(_0x40ec0a['body']['id']){delete _0x40ec0a[_0x4cf6('0x5a')]['id'];}return db[_0x4cf6('0x3e')][_0x4cf6('0x58')]({'where':{'id':_0x40ec0a[_0x4cf6('0x57')]['id']}})[_0x4cf6('0x21')](handleEntityNotFound(_0x22c595,null))['then'](saveUpdates(_0x40ec0a[_0x4cf6('0x5a')],null))[_0x4cf6('0x21')](respondWithResult(_0x22c595,null))[_0x4cf6('0x2c')](handleError(_0x22c595,null));};exports['destroy']=function(_0xceca18,_0x310739){return db['FaxMessage'][_0x4cf6('0x58')]({'where':{'id':_0xceca18[_0x4cf6('0x57')]['id']}})[_0x4cf6('0x21')](handleEntityNotFound(_0x310739,null))[_0x4cf6('0x21')](removeEntity(_0x310739,null))['catch'](handleError(_0x310739,null));};exports[_0x4cf6('0x5b')]=function(_0x27076f,_0x2d1ed8){return db[_0x4cf6('0x3e')][_0x4cf6('0x5b')]()[_0x4cf6('0x21')](respondWithResult(_0x2d1ed8,null))['catch'](handleError(_0x2d1ed8,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['accept']=function(_0xed359e,_0x5a3950,_0x1c73e0){var _0x10d8cc={'agent':{},'channel':_0x4cf6('0x5c')};if(_0xed359e[_0x4cf6('0x5a')]['id']){delete _0xed359e[_0x4cf6('0x5a')]['id'];}_0xed359e[_0x4cf6('0x5a')][_0x4cf6('0x5d')]=!![];_0xed359e[_0x4cf6('0x5a')][_0x4cf6('0x5e')]=moment()[_0x4cf6('0x5f')](_0x4cf6('0x60'));_0xed359e['body'][_0x4cf6('0x61')]=_0xed359e[_0x4cf6('0x5a')][_0x4cf6('0x61')]||_0xed359e[_0x4cf6('0x62')]['id'];_0x10d8cc[_0x4cf6('0x63')]['id']=_0xed359e[_0x4cf6('0x5a')]['UserId'];return db[_0x4cf6('0x3e')][_0x4cf6('0x58')]({'where':{'id':_0xed359e[_0x4cf6('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a3950,null))[_0x4cf6('0x21')](saveUpdates(_0xed359e[_0x4cf6('0x5a')],null))[_0x4cf6('0x21')](function(_0x82e7c7){if(_0x82e7c7){_0x10d8cc[_0x4cf6('0x2a')]=_0x82e7c7[_0x4cf6('0x64')]({'plain':!![]});return db['FaxInteraction'][_0x4cf6('0x58')]({'where':{'id':_0x82e7c7[_0x4cf6('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x5a3950,null))[_0x4cf6('0x21')](function(_0x1d9902){if(_0x1d9902){return _0x1d9902['update']({'UserId':_0xed359e['body']['UserId'],'read1stAt':_[_0x4cf6('0x66')](_0x1d9902[_0x4cf6('0x67')])?moment()['format'](_0x4cf6('0x60')):undefined});}return null;})[_0x4cf6('0x21')](function(_0x23e5cd){if(_0x23e5cd){_0x10d8cc['interaction']=_0x23e5cd[_0x4cf6('0x64')]({'plain':!![]});interaction_log['info'](_0x4cf6('0x68'),_0xed359e[_0x4cf6('0x62')]['id'],_0xed359e[_0x4cf6('0x62')][_0x4cf6('0x3a')],_0xed359e[_0x4cf6('0x62')][_0x4cf6('0x69')],_0x10d8cc[_0x4cf6('0x6a')]['id'],_0xed359e[_0x4cf6('0x5a')]?JSON[_0x4cf6('0x27')](_0xed359e[_0x4cf6('0x5a')]):_0x4cf6('0x6b'));return respondWithRpcPromise(_0x4cf6('0x6c'),_0x4cf6('0x6d'),_0x10d8cc);}return null;})['then'](function(_0xab9f63){var _0x5c9f88='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xab9f63['message'][_0x4cf6('0x6e')];return db[_0x4cf6('0x6f')][_0x4cf6('0x43')](_0x5c9f88,{'type':db['Sequelize'][_0x4cf6('0x70')][_0x4cf6('0x71')],'raw':!![]})[_0x4cf6('0x21')](function(_0x1630b6){return _0x1630b6;});})['then'](function(_0x7a223b){if(_0x7a223b){_0x10d8cc[_0x4cf6('0x2a')][_0x4cf6('0x72')]=_0x7a223b[0x0];if(!_0xed359e[_0x4cf6('0x5a')]['UserId'])return;return db[_0x4cf6('0x73')][_0x4cf6('0x58')]({'where':{'id':_0xed359e[_0x4cf6('0x5a')][_0x4cf6('0x61')],'role':_0x4cf6('0x63')},'attributes':['id',_0x4cf6('0x3a'),_0x4cf6('0x74'),_0x4cf6('0x75'),'internal'],'raw':!![]});}return null;})[_0x4cf6('0x21')](function(_0x3f6a11){if(!_0x3f6a11)return null;_0x10d8cc[_0x4cf6('0x2a')][_0x4cf6('0x63')]=_0x3f6a11;return _0x10d8cc;})[_0x4cf6('0x21')](function(_0x9231c6){if(_0x9231c6){if(_0xed359e['body'][_0x4cf6('0x76')]){_0x10d8cc[_0x4cf6('0x2a')][_0x4cf6('0x77')]=util[_0x4cf6('0x5f')](_0x4cf6('0x78'),_0xed359e[_0x4cf6('0x62')][_0x4cf6('0x3a')]);_0x10d8cc[_0x4cf6('0x2a')][_0x4cf6('0x79')]=_0x10d8cc[_0x4cf6('0x79')];_0x10d8cc[_0x4cf6('0x2a')][_0x4cf6('0x7a')]=_0x10d8cc[_0x4cf6('0x79')];_0x10d8cc[_0x4cf6('0x2a')][_0x4cf6('0x7b')]=_0x4cf6('0x7c');return respondWithRpcPromise(_0x4cf6('0x7d'),'EventManager',{'event':_0x4cf6('0x7e'),'message':_0x10d8cc['message']},client9002)['then'](function(){return _0x10d8cc;});}return _0x10d8cc;}return null;})[_0x4cf6('0x21')](respondWithResult(_0x5a3950,null))[_0x4cf6('0x2c')](handleError(_0x5a3950,null));};var interaction_log=require(_0x4cf6('0x7f'))('fax-interactions');exports[_0x4cf6('0x36')]=function(_0x205767,_0x3823b5,_0x691f2b){var _0x39f56c={'agent':{},'channel':_0x4cf6('0x5c')};if(_0x205767[_0x4cf6('0x5a')]['id']){delete _0x205767[_0x4cf6('0x5a')]['id'];}_0x205767[_0x4cf6('0x5a')][_0x4cf6('0x61')]=_0x205767['body'][_0x4cf6('0x61')]||_0x205767['user']['id'];_0x39f56c[_0x4cf6('0x63')]['id']=_0x205767[_0x4cf6('0x5a')]['UserId'];return db[_0x4cf6('0x3e')][_0x4cf6('0x58')]({'where':{'id':_0x205767[_0x4cf6('0x57')]['id'],'UserId':null}})[_0x4cf6('0x21')](handleEntityNotFound(_0x3823b5,null))['then'](function(_0x547e45){if(_0x547e45){_0x39f56c[_0x4cf6('0x2a')]=_0x547e45[_0x4cf6('0x64')]({'plain':!![]});return db['FaxInteraction'][_0x4cf6('0x58')]({'where':{'id':_0x547e45[_0x4cf6('0x65')]}});}return null;})[_0x4cf6('0x21')](handleEntityNotFound(_0x3823b5,null))['then'](function(_0x80473e){if(_0x80473e){_0x39f56c[_0x4cf6('0x6a')]=_0x80473e[_0x4cf6('0x64')]({'plain':!![]});interaction_log[_0x4cf6('0x22')](_0x4cf6('0x80'),_0x205767[_0x4cf6('0x62')]['id'],_0x205767[_0x4cf6('0x62')][_0x4cf6('0x3a')],_0x205767[_0x4cf6('0x62')][_0x4cf6('0x69')],_0x39f56c[_0x4cf6('0x6a')]['id'],_0x205767[_0x4cf6('0x5a')]?JSON[_0x4cf6('0x27')](_0x205767[_0x4cf6('0x5a')]):_0x4cf6('0x6b'));return respondWithRpcPromise(_0x4cf6('0x81'),_0x4cf6('0x82'),_0x39f56c);}return null;})[_0x4cf6('0x21')](function(_0x127e99){var _0x158349='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x127e99[_0x4cf6('0x2a')][_0x4cf6('0x6e')];return db[_0x4cf6('0x6f')][_0x4cf6('0x43')](_0x158349,{'type':db[_0x4cf6('0x83')][_0x4cf6('0x70')]['SELECT'],'raw':!![]})[_0x4cf6('0x21')](function(_0x1bc8d4){return _0x1bc8d4;});})[_0x4cf6('0x21')](function(_0x5c6942){if(_0x5c6942){_0x39f56c[_0x4cf6('0x2a')][_0x4cf6('0x72')]=_0x5c6942[0x0];if(!_0x205767[_0x4cf6('0x5a')][_0x4cf6('0x61')])return;return db[_0x4cf6('0x73')]['find']({'where':{'id':_0x205767['body'][_0x4cf6('0x61')],'role':'agent'},'attributes':['id',_0x4cf6('0x3a'),_0x4cf6('0x74'),_0x4cf6('0x75'),_0x4cf6('0x84')],'raw':!![]});}return null;})[_0x4cf6('0x21')](function(_0x195f32){if(!_0x195f32)return null;_0x39f56c[_0x4cf6('0x2a')][_0x4cf6('0x63')]=_0x195f32;return _0x39f56c;})[_0x4cf6('0x21')](function(_0x440828){if(_0x440828){_0x440828['message'][_0x4cf6('0x77')]=util['format']('SIP/%s',_0x205767[_0x4cf6('0x62')][_0x4cf6('0x3a')]);_0x440828[_0x4cf6('0x2a')][_0x4cf6('0x79')]=_0x39f56c[_0x4cf6('0x79')];_0x440828['message'][_0x4cf6('0x7a')]=_0x39f56c[_0x4cf6('0x79')];_0x440828[_0x4cf6('0x2a')][_0x4cf6('0x7b')]=_0x4cf6('0x36');respondWithRpcPromise('EventManager',_0x4cf6('0x7d'),{'event':_0x4cf6('0x85'),'message':_0x440828[_0x4cf6('0x2a')]},client9002);return _0x39f56c;}return null;})['then'](respondWithResult(_0x3823b5,null))[_0x4cf6('0x2c')](handleError(_0x3823b5,null));};exports[_0x4cf6('0x86')]=function(_0x391353,_0x2ffad8){var _0x45b097;return db['FaxMessage'][_0x4cf6('0x86')](_0x391353[_0x4cf6('0x5a')],{})[_0x4cf6('0x21')](function(_0xd9e32){_0x45b097=_0xd9e32;return db['CmContact'][_0x4cf6('0x87')]({'where':{'id':_0x45b097[_0x4cf6('0x6e')]}});})['then'](function(_0x5d7717){if(_[_0x4cf6('0x66')](_0x5d7717)){return;}else{_0x45b097[_0x4cf6('0x5c')]=_0x5d7717[_0x4cf6('0x5c')];return db['Attachment'][_0x4cf6('0x87')]({'where':{'id':_0x45b097[_0x4cf6('0x88')]}});}})['then'](function(_0x1ca1fb){return respondWithRpcPromise(_0x4cf6('0x89'),_0x4cf6('0x89'),{'FaxAccountId':_[_0x4cf6('0x66')](_0x391353[_0x4cf6('0x5a')])?undefined:_0x391353[_0x4cf6('0x5a')][_0x4cf6('0x8a')],'path':_[_0x4cf6('0x66')](_0x1ca1fb)?undefined:util[_0x4cf6('0x5f')](_0x4cf6('0x8b'),_0x1ca1fb[_0x4cf6('0x8c')]),'fax':_[_0x4cf6('0x66')](_0x45b097['fax'])?undefined:_0x45b097[_0x4cf6('0x5c')],'AttachmentId':_0x45b097[_0x4cf6('0x88')]},client9002);})['then'](respondWithResult(_0x2ffad8,0xc9))[_0x4cf6('0x2c')](handleError(_0x2ffad8,null));};exports[_0x4cf6('0x8d')]=function(_0x303da3,_0x17ea53){var _0x9fa058=path[_0x4cf6('0x8e')](config[_0x4cf6('0x8f')],_0x4cf6('0x90'),_0x4cf6('0x91'),_0x4cf6('0x92'));return db[_0x4cf6('0x3e')][_0x4cf6('0x58')]({'where':{'id':_0x303da3['params']['id']},'include':[{'model':db[_0x4cf6('0x93')],'as':_0x4cf6('0x93')}]})[_0x4cf6('0x21')](handleEntityNotFound(_0x17ea53,null))[_0x4cf6('0x21')](function(_0x1fb53b){if(_0x1fb53b){return _0x17ea53[_0x4cf6('0x8d')](path[_0x4cf6('0x8e')](_0x9fa058,_0x1fb53b[_0x4cf6('0x93')][_0x4cf6('0x8c')]));}})[_0x4cf6('0x2c')](handleError(_0x17ea53,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 1da3d07..56e6e7d 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 _0x573a=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1fc75f,_0x456d7c){var _0x40b5ab=function(_0x584934){while(--_0x584934){_0x1fc75f['push'](_0x1fc75f['shift']());}};_0x40b5ab(++_0x456d7c);}(_0x573a,0x124));var _0xa573=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x573a[_0x2932cf];return _0x1711dd;};'use strict';var EventEmitter=require(_0xa573('0x0'));var FaxMessage=require(_0xa573('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa573('0x2')](0x0);var events={'afterCreate':_0xa573('0x3'),'afterUpdate':_0xa573('0x4'),'afterDestroy':_0xa573('0x5')};function emitEvent(_0x19bca6){return function(_0x59a1d5,_0x41fbd3,_0x4b7f7c){FaxMessageEvents[_0xa573('0x6')](_0x19bca6+':'+_0x59a1d5['id'],_0x59a1d5);FaxMessageEvents[_0xa573('0x6')](_0x19bca6,_0x59a1d5);_0x4b7f7c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xa573('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x68fd=['exports','events','FaxMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x68fd,0x1e9));var _0xd68f=function(_0x311599,_0x4ee4d3){_0x311599=_0x311599-0x0;var _0x5b4cda=_0x68fd[_0x311599];return _0x5b4cda;};'use strict';var EventEmitter=require(_0xd68f('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xd68f('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd68f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd68f('0x3'),'afterDestroy':_0xd68f('0x4')};function emitEvent(_0x96d959){return function(_0x3e5e78,_0x37c481,_0x9814cb){FaxMessageEvents[_0xd68f('0x5')](_0x96d959+':'+_0x3e5e78['id'],_0x3e5e78);FaxMessageEvents[_0xd68f('0x5')](_0x96d959,_0x3e5e78);_0x9814cb(null);};}for(var e in events){if(events[_0xd68f('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xd68f('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 80cc844..f5a5c58 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 _0x0260=['then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','toLowerCase','direction','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId'];(function(_0x3cdfdb,_0x40545d){var _0x57d4d8=function(_0x3e7f86){while(--_0x3e7f86){_0x3cdfdb['push'](_0x3cdfdb['shift']());}};_0x57d4d8(++_0x40545d);}(_0x0260,0x7f));var _0x0026=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x0260[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x0026('0x0'));var util=require(_0x0026('0x1'));var logger=require(_0x0026('0x2'))(_0x0026('0x3'));var moment=require('moment');var BPromise=require(_0x0026('0x4'));var rp=require(_0x0026('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0026('0x6'));var config=require('../../config/environment');var attributes=require(_0x0026('0x7'));module['exports']=function(_0x365338,_0x141e20){return _0x365338[_0x0026('0x8')](_0x0026('0x9'),attributes,{'tableName':_0x0026('0xa'),'paranoid':![],'indexes':[{'name':_0x0026('0xb'),'fields':[_0x0026('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa26fae,_0x51f6cc,_0x321ac6){var _0x149e97=_0x365338[_0x0026('0xd')];var _0x2588f8=_0xa26fae[_0x0026('0xe')]({'plain':!![]});if(_0x2588f8['direction'][_0x0026('0xf')]()==='in'||_0x2588f8[_0x0026('0x10')][_0x0026('0xf')]()===_0x0026('0x11')&&!_0x2588f8[_0x0026('0x12')]&&!_[_0x0026('0x13')](_0x2588f8['UserId'])){_0x149e97[_0x0026('0x14')][_0x0026('0x15')]({'where':{'id':_0x2588f8[_0x0026('0x16')]}})[_0x0026('0x17')](function(_0xf05b07){if(_0xf05b07){_0xf05b07[_0x0026('0x18')]({'lastMsgAt':_0x2588f8[_0x0026('0x19')],'lastMsgDirection':_0x2588f8[_0x0026('0x10')]['toLowerCase']()});}})[_0x0026('0x1a')](function(_0x5ed932){console[_0x0026('0x1b')](_0x5ed932);});}_0x321ac6();}},'charset':_0x0026('0x1c'),'collate':_0x0026('0x1d')});}; \ No newline at end of file +var _0xa1d5=['fax_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage'];(function(_0xb7d0de,_0x405f33){var _0x57096b=function(_0x317c97){while(--_0x317c97){_0xb7d0de['push'](_0xb7d0de['shift']());}};_0x57096b(++_0x405f33);}(_0xa1d5,0x1b5));var _0x5a1d=function(_0x111bcd,_0x3526d1){_0x111bcd=_0x111bcd-0x0;var _0x289d86=_0xa1d5[_0x111bcd];return _0x289d86;};'use strict';var _=require(_0x5a1d('0x0'));var util=require(_0x5a1d('0x1'));var logger=require(_0x5a1d('0x2'))(_0x5a1d('0x3'));var moment=require(_0x5a1d('0x4'));var BPromise=require(_0x5a1d('0x5'));var rp=require(_0x5a1d('0x6'));var fs=require('fs');var path=require(_0x5a1d('0x7'));var rimraf=require('rimraf');var config=require(_0x5a1d('0x8'));var attributes=require(_0x5a1d('0x9'));module[_0x5a1d('0xa')]=function(_0x56120d,_0x227e26){return _0x56120d[_0x5a1d('0xb')](_0x5a1d('0xc'),attributes,{'tableName':_0x5a1d('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x5a1d('0xe')],'type':_0x5a1d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x240296,_0x106fa4,_0x3d5a3a){var _0x45d236=_0x56120d['models'];var _0x121b25=_0x240296['get']({'plain':!![]});if(_0x121b25[_0x5a1d('0x10')][_0x5a1d('0x11')]()==='in'||_0x121b25[_0x5a1d('0x10')][_0x5a1d('0x11')]()===_0x5a1d('0x12')&&!_0x121b25[_0x5a1d('0x13')]&&!_[_0x5a1d('0x14')](_0x121b25[_0x5a1d('0x15')])){_0x45d236[_0x5a1d('0x16')][_0x5a1d('0x17')]({'where':{'id':_0x121b25[_0x5a1d('0x18')]}})[_0x5a1d('0x19')](function(_0x41d876){if(_0x41d876){_0x41d876[_0x5a1d('0x1a')]({'lastMsgAt':_0x121b25['createdAt'],'lastMsgDirection':_0x121b25[_0x5a1d('0x10')][_0x5a1d('0x11')]()});}})['catch'](function(_0x3efe7a){console[_0x5a1d('0x1b')](_0x3efe7a);});}_0x3d5a3a();}},'charset':_0x5a1d('0x1c'),'collate':_0x5a1d('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 42be8c4..a213d54 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 _0x0a9a=['error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','CreateFaxMessage','debug','UpdateFaxMessage','update','raw','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a96b5,_0x2adaad){var _0x3458cd=function(_0x211615){while(--_0x211615){_0x2a96b5['push'](_0x2a96b5['shift']());}};_0x3458cd(++_0x2adaad);}(_0x0a9a,0x183));var _0xa0a9=function(_0x14853f,_0xcc9d04){_0x14853f=_0x14853f-0x0;var _0x2aa60a=_0x0a9a[_0x14853f];return _0x2aa60a;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});config[_0xa0a9('0xa')]=_['defaults'](config[_0xa0a9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0a9('0xb'))(new Redis(config[_0xa0a9('0xa')]));require(_0xa0a9('0xc'))[_0xa0a9('0xd')](socket);function respondWithRpcPromise(_0x4b9b93,_0x2ba0ac,_0x1b5bfb){return new BPromise(function(_0x5ce7e9,_0x5909cf){return client[_0xa0a9('0xe')](_0x4b9b93,_0x1b5bfb)[_0xa0a9('0xf')](function(_0x51d5a5){logger[_0xa0a9('0x10')]('FaxMessage,\x20%s,\x20%s',_0x2ba0ac,_0xa0a9('0x11'));logger['debug'](_0xa0a9('0x12'),_0x2ba0ac,_0xa0a9('0x11'),JSON[_0xa0a9('0x13')](_0x51d5a5));if(_0x51d5a5[_0xa0a9('0x14')]){if(_0x51d5a5[_0xa0a9('0x14')]['code']===0x1f4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);return _0x5909cf(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}logger['error'](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5['error']['message']);return _0x5ce7e9(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}else{logger[_0xa0a9('0x10')](_0xa0a9('0x15'),_0x2ba0ac,'request\x20sent');_0x5ce7e9(_0x51d5a5[_0xa0a9('0x17')][_0xa0a9('0x16')]);}})[_0xa0a9('0x18')](function(_0x27f8d4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x27f8d4);_0x5909cf(_0x27f8d4);});});}exports['CreateFaxMessage']=function(_0x3cdd8c){var _0x3107ce=this;return new Promise(function(_0x4a8e80,_0x53b99d){return db[_0xa0a9('0x19')][_0xa0a9('0x1a')](_0x3cdd8c[_0xa0a9('0x1b')],{'raw':_0x3cdd8c['options']?_0x3cdd8c[_0xa0a9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa0a9('0xf')](function(_0x5e6148){logger[_0xa0a9('0x10')](_0xa0a9('0x1d'),_0x3cdd8c);logger[_0xa0a9('0x1e')](_0xa0a9('0x1d'),_0x3cdd8c,JSON['stringify'](_0x5e6148));_0x4a8e80(_0x5e6148);})[_0xa0a9('0x18')](function(_0x4fb909){logger[_0xa0a9('0x14')](_0xa0a9('0x1d'),_0x4fb909[_0xa0a9('0x16')],_0x3cdd8c);_0x53b99d(_0x3107ce[_0xa0a9('0x14')](0x1f4,_0x4fb909['message']));});});};exports[_0xa0a9('0x1f')]=function(_0xe49d3b){var _0x384cd5=this;return new Promise(function(_0x3f4bea,_0x526dd1){return db[_0xa0a9('0x19')][_0xa0a9('0x20')](_0xe49d3b[_0xa0a9('0x1b')],{'raw':_0xe49d3b['options']?_0xe49d3b['options'][_0xa0a9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x22')]||null:null,'attributes':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x23')]||null:null,'limit':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x24')]||null:null})[_0xa0a9('0xf')](function(_0x554191){logger[_0xa0a9('0x10')](_0xa0a9('0x1f'),_0xe49d3b);logger['debug'](_0xa0a9('0x1f'),_0xe49d3b,JSON[_0xa0a9('0x13')](_0x554191));_0x3f4bea(_0x554191);})['catch'](function(_0x47c19b){logger[_0xa0a9('0x14')]('UpdateFaxMessage',_0x47c19b['message'],_0xe49d3b);_0x526dd1(_0x384cd5[_0xa0a9('0x14')](0x1f4,_0x47c19b[_0xa0a9('0x16')]));});});}; \ No newline at end of file +var _0x6f0d=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1ff826,_0x280b83){_0x1ff826=_0x1ff826-0x0;var _0x41abca=_0x6f0d[_0x1ff826];return _0x41abca;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});config[_0xd6f0('0xa')]=_[_0xd6f0('0xb')](config[_0xd6f0('0xa')],{'host':_0xd6f0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd6f0('0xd'))[_0xd6f0('0xe')](socket);function respondWithRpcPromise(_0x2854cd,_0x382a2e,_0x225dcf){return new BPromise(function(_0x4db64a,_0x136eee){return client[_0xd6f0('0xf')](_0x2854cd,_0x225dcf)[_0xd6f0('0x10')](function(_0x44bba6){logger['info'](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));logger[_0xd6f0('0x13')](_0xd6f0('0x14'),_0x382a2e,_0xd6f0('0x12'),JSON[_0xd6f0('0x15')](_0x44bba6));if(_0x44bba6[_0xd6f0('0x16')]){if(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x17')]===0x1f4){logger['error'](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')]['message']);return _0x136eee(_0x44bba6[_0xd6f0('0x16')]['message']);}logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);return _0x4db64a(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);}else{logger[_0xd6f0('0x19')](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));_0x4db64a(_0x44bba6[_0xd6f0('0x1a')][_0xd6f0('0x18')]);}})[_0xd6f0('0x1b')](function(_0x327231){logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x327231);_0x136eee(_0x327231);});});}exports[_0xd6f0('0x1c')]=function(_0x5cd367){var _0x48ac38=this;return new Promise(function(_0x3939aa,_0x264104){return db[_0xd6f0('0x1d')]['create'](_0x5cd367[_0xd6f0('0x1e')],{'raw':_0x5cd367[_0xd6f0('0x1f')]?_0x5cd367['options'][_0xd6f0('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1ee584){logger[_0xd6f0('0x19')]('CreateFaxMessage',_0x5cd367);logger[_0xd6f0('0x13')](_0xd6f0('0x1c'),_0x5cd367,JSON['stringify'](_0x1ee584));_0x3939aa(_0x1ee584);})[_0xd6f0('0x1b')](function(_0x402070){logger[_0xd6f0('0x16')]('CreateFaxMessage',_0x402070[_0xd6f0('0x18')],_0x5cd367);_0x264104(_0x48ac38[_0xd6f0('0x16')](0x1f4,_0x402070['message']));});});};exports[_0xd6f0('0x21')]=function(_0x551be8){var _0x2042d5=this;return new Promise(function(_0x3fb5c3,_0x1630dc){return db[_0xd6f0('0x1d')][_0xd6f0('0x22')](_0x551be8[_0xd6f0('0x1e')],{'raw':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['where']||null:null,'attributes':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x23')]||null:null,'limit':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x24')]||null:null})[_0xd6f0('0x10')](function(_0x3151f8){logger[_0xd6f0('0x19')](_0xd6f0('0x21'),_0x551be8);logger[_0xd6f0('0x13')](_0xd6f0('0x21'),_0x551be8,JSON[_0xd6f0('0x15')](_0x3151f8));_0x3fb5c3(_0x3151f8);})[_0xd6f0('0x1b')](function(_0xbdd223){logger[_0xd6f0('0x16')](_0xd6f0('0x21'),_0xbdd223[_0xd6f0('0x18')],_0x551be8);_0x1630dc(_0x2042d5[_0xd6f0('0x16')](0x1f4,_0xbdd223[_0xd6f0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 64cd174..b9063be 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 _0x7702=['length','faxMessage:','remove','register'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x7702,0xd2));var _0x2770=function(_0x2337ba,_0x2e6c43){_0x2337ba=_0x2337ba-0x0;var _0x3be12b=_0x7702[_0x2337ba];return _0x3be12b;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x2770('0x0'),'update'];function createListener(_0x2846d4,_0x1ee908){return function(_0x252282){_0x1ee908['emit'](_0x2846d4,_0x252282);};}function removeListener(_0x49e589,_0x12783d){return function(){FaxMessageEvents['removeListener'](_0x49e589,_0x12783d);};}exports[_0x2770('0x1')]=function(_0xc708a2){for(var _0x91b186=0x0,_0x50420=events[_0x2770('0x2')];_0x91b186<_0x50420;_0x91b186++){var _0x3ca55d=events[_0x91b186];var _0x51b8c4=createListener(_0x2770('0x3')+_0x3ca55d,_0xc708a2);FaxMessageEvents['on'](_0x3ca55d,_0x51b8c4);}}; \ No newline at end of file +var _0x11a2=['emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x246d5e,_0x1db42f){var _0x47fe0a=function(_0x140f63){while(--_0x140f63){_0x246d5e['push'](_0x246d5e['shift']());}};_0x47fe0a(++_0x1db42f);}(_0x11a2,0x17f));var _0x211a=function(_0x162214,_0x20622a){_0x162214=_0x162214-0x0;var _0x4476de=_0x11a2[_0x162214];return _0x4476de;};'use strict';var FaxMessageEvents=require(_0x211a('0x0'));var events=[_0x211a('0x1'),_0x211a('0x2'),_0x211a('0x3')];function createListener(_0x25d1c6,_0x286e08){return function(_0xaa2bb2){_0x286e08[_0x211a('0x4')](_0x25d1c6,_0xaa2bb2);};}function removeListener(_0x144860,_0x130f90){return function(){FaxMessageEvents[_0x211a('0x5')](_0x144860,_0x130f90);};}exports[_0x211a('0x6')]=function(_0x575984){for(var _0x3adbfb=0x0,_0x427f61=events[_0x211a('0x7')];_0x3adbfb<_0x427f61;_0x3adbfb++){var _0x33695e=events[_0x3adbfb];var _0x2f74dc=createListener(_0x211a('0x8')+_0x33695e,_0x575984);FaxMessageEvents['on'](_0x33695e,_0x2f74dc);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f2aa1cb..e944b39 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 _0xcea2=['create','put','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked'];(function(_0x5a6a1c,_0xb802eb){var _0x132a0e=function(_0x4c3280){while(--_0x4c3280){_0x5a6a1c['push'](_0x5a6a1c['shift']());}};_0x132a0e(++_0xb802eb);}(_0xcea2,0x15a));var _0x2cea=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xcea2[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0xd')]);router[_0x2cea('0x9')](_0x2cea('0xe'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xf')]);router[_0x2cea('0x10')]('/',auth[_0x2cea('0x8')](),interaction[_0x2cea('0x11')]('fax','faxmessage:create'),controller[_0x2cea('0x12')]);router[_0x2cea('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2cea('0x14')]);router['put'](_0x2cea('0x15'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x2cea('0x17')]);router['delete'](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x18')]);module[_0x2cea('0x19')]=router; \ No newline at end of file +var _0x76dc=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','show','post','tracked','fax','faxmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util'];(function(_0x14c3f2,_0xce04b2){var _0x32e760=function(_0x4a55e2){while(--_0x4a55e2){_0x14c3f2['push'](_0x14c3f2['shift']());}};_0x32e760(++_0xce04b2);}(_0x76dc,0x1f2));var _0xc76d=function(_0x3a2382,_0x65be0d){_0x3a2382=_0x3a2382-0x0;var _0x5f0297=_0x76dc[_0x3a2382];return _0x5f0297;};'use strict';var multer=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var path=require(_0xc76d('0x2'));var timeout=require(_0xc76d('0x3'));var express=require('express');var router=express[_0xc76d('0x4')]();var fs_extra=require(_0xc76d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc76d('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xc76d('0x7')]('/',auth[_0xc76d('0x8')](),controller[_0xc76d('0x9')]);router['get']('/describe',auth[_0xc76d('0x8')](),controller[_0xc76d('0xa')]);router[_0xc76d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc76d('0xb')]);router[_0xc76d('0x7')]('/:id/download',auth[_0xc76d('0x8')](),controller['download']);router[_0xc76d('0xc')]('/',auth[_0xc76d('0x8')](),interaction[_0xc76d('0xd')](_0xc76d('0xe'),_0xc76d('0xf')),controller[_0xc76d('0x10')]);router[_0xc76d('0x11')](_0xc76d('0x12'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x13')]);router[_0xc76d('0x11')](_0xc76d('0x14'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x15')]);router['put'](_0xc76d('0x16'),auth[_0xc76d('0x8')](),controller['reject']);router[_0xc76d('0x17')](_0xc76d('0x12'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x18')]);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 2b935ad..ded814d 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 _0x74a2=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x45a23e,_0x1b32a5){var _0xc5cd5e=function(_0x3eb5b3){while(--_0x3eb5b3){_0x45a23e['push'](_0x45a23e['shift']());}};_0xc5cd5e(++_0x1b32a5);}(_0x74a2,0x1bf));var _0x274a=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x74a2[_0x2261ce];return _0x524640;};'use strict';var Sequelize=require('sequelize');module[_0x274a('0x0')]={'name':{'type':Sequelize[_0x274a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x274a('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x274a('0x3')](_0x274a('0x4'),_0x274a('0x5'),_0x274a('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x274a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcded=['beepall','roundrobin','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x267bf0,_0x5230a9){var _0x3b3681=function(_0x268993){while(--_0x268993){_0x267bf0['push'](_0x267bf0['shift']());}};_0x3b3681(++_0x5230a9);}(_0xcded,0x64));var _0xdcde=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0xcded[_0x19ac6e];return _0x1cdcf3;};'use strict';var Sequelize=require('sequelize');module[_0xdcde('0x0')]={'name':{'type':Sequelize[_0xdcde('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdcde('0x1')]},'timeout':{'type':Sequelize[_0xdcde('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdcde('0x3')](_0xdcde('0x4'),_0xdcde('0x5'),_0xdcde('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xdcde('0x2')],'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 065482d..3540daf 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 _0x9cef=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','end','name','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','Agents','online','voicePause','interface','sequelize','each','forEach','emit','userFaxQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','offset','undefined'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9cef,0x184));var _0xf9ce=function(_0x36c55d,_0x1c8efa){_0x36c55d=_0x36c55d-0x0;var _0xa16625=_0x9cef[_0x36c55d];return _0xa16625;};'use strict';var emlformat=require(_0xf9ce('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf9ce('0x1'));var moment=require(_0xf9ce('0x2'));var BPromise=require(_0xf9ce('0x3'));var Mustache=require(_0xf9ce('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf9ce('0x5'));var csv=require(_0xf9ce('0x6'));var ejs=require(_0xf9ce('0x7'));var fs=require('fs');var fs_extra=require(_0xf9ce('0x8'));var _=require(_0xf9ce('0x9'));var squel=require(_0xf9ce('0xa'));var crypto=require(_0xf9ce('0xb'));var jsforce=require(_0xf9ce('0xc'));var deskjs=require(_0xf9ce('0xd'));var toCsv=require(_0xf9ce('0x6'));var querystring=require(_0xf9ce('0xe'));var Papa=require(_0xf9ce('0xf'));var Redis=require(_0xf9ce('0x10'));var authService=require(_0xf9ce('0x11'));var qs=require(_0xf9ce('0x12'));var as=require(_0xf9ce('0x13'));var hardwareService=require(_0xf9ce('0x14'));var logger=require(_0xf9ce('0x15'))(_0xf9ce('0x16'));var utils=require(_0xf9ce('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf9ce('0x18'));var db=require('../../mysqldb')['db'];config[_0xf9ce('0x19')]=_[_0xf9ce('0x1a')](config[_0xf9ce('0x19')],{'host':_0xf9ce('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9ce('0x19')]));require(_0xf9ce('0x1c'))[_0xf9ce('0x1d')](socket);function respondWithStatusCode(_0x9352bc,_0xf06ba0){_0xf06ba0=_0xf06ba0||0xcc;return function(_0x3a8777){if(_0x3a8777){return _0x9352bc[_0xf9ce('0x1e')](_0xf06ba0);}return _0x9352bc[_0xf9ce('0x1f')](_0xf06ba0)['end']();};}function respondWithResult(_0x3fda05,_0x203e90){_0x203e90=_0x203e90||0xc8;return function(_0xfc87f1){if(_0xfc87f1){return _0x3fda05[_0xf9ce('0x1f')](_0x203e90)[_0xf9ce('0x20')](_0xfc87f1);}};}function respondWithFilteredResult(_0x5e4fb2,_0x4e02d8){return function(_0x54fe01){if(_0x54fe01){var _0x4dda82=typeof _0x4e02d8[_0xf9ce('0x21')]===_0xf9ce('0x22')&&typeof _0x4e02d8[_0xf9ce('0x23')]===_0xf9ce('0x22');var _0x5366d4=_0x54fe01[_0xf9ce('0x24')];var _0x176457=_0x4dda82?0x0:_0x4e02d8[_0xf9ce('0x21')];var _0x23c8be=_0x4dda82?_0x54fe01[_0xf9ce('0x24')]:_0x4e02d8[_0xf9ce('0x21')]+_0x4e02d8[_0xf9ce('0x23')];var _0x1c06dc;if(_0x23c8be>=_0x5366d4){_0x23c8be=_0x5366d4;_0x1c06dc=0xc8;}else{_0x1c06dc=0xce;}_0x5e4fb2[_0xf9ce('0x1f')](_0x1c06dc);return _0x5e4fb2[_0xf9ce('0x25')](_0xf9ce('0x26'),_0x176457+'-'+_0x23c8be+'/'+_0x5366d4)['json'](_0x54fe01);}return null;};}function patchUpdates(_0x466108){return function(_0x45b2bb){try{jsonpatch[_0xf9ce('0x27')](_0x45b2bb,_0x466108,!![]);}catch(_0x54f7d1){return BPromise[_0xf9ce('0x28')](_0x54f7d1);}return _0x45b2bb[_0xf9ce('0x29')]();};}function saveUpdates(_0x6aa708,_0x5893e7){return function(_0xee2a69){if(_0xee2a69){return _0xee2a69[_0xf9ce('0x2a')](_0x6aa708)[_0xf9ce('0x2b')](function(_0x5723b5){return _0x5723b5;});}return null;};}function removeEntity(_0xb6dacf,_0x36dc99){return function(_0x30e90a){if(_0x30e90a){return _0x30e90a[_0xf9ce('0x2c')]()[_0xf9ce('0x2b')](function(){var _0x5dde91=_0x30e90a['get']({'plain':!![]});var _0x4fa297=_0xf9ce('0x2d');return db[_0xf9ce('0x2e')][_0xf9ce('0x2c')]({'where':{'type':_0x4fa297,'resourceId':_0x5dde91['id']}})['then'](function(){return _0x30e90a;});})['then'](function(){_0xb6dacf['status'](0xcc)[_0xf9ce('0x2f')]();});}};}function handleEntityNotFound(_0x2707bc,_0x506d4e){return function(_0x1629ac){if(!_0x1629ac){_0x2707bc[_0xf9ce('0x1e')](0x194);}return _0x1629ac;};}function handleError(_0x14cde1,_0x208b24){_0x208b24=_0x208b24||0x1f4;return function(_0x373cda){logger['error'](_0x373cda['stack']);if(_0x373cda[_0xf9ce('0x30')]){delete _0x373cda[_0xf9ce('0x30')];}_0x14cde1['status'](_0x208b24)['send'](_0x373cda);};}exports[_0xf9ce('0x31')]=function(_0x2e55dd,_0x40c3c7){var _0x555eac={},_0xe08770={},_0x210a8a={'count':0x0,'rows':[]};var _0x51e871=_[_0xf9ce('0x32')](db[_0xf9ce('0x33')][_0xf9ce('0x34')],function(_0x4ee1a4){return{'name':_0x4ee1a4[_0xf9ce('0x35')],'type':_0x4ee1a4[_0xf9ce('0x36')][_0xf9ce('0x37')]};});_0xe08770[_0xf9ce('0x38')]=_[_0xf9ce('0x32')](_0x51e871,_0xf9ce('0x30'));_0xe08770[_0xf9ce('0x39')]=_[_0xf9ce('0x3a')](_0x2e55dd['query']);_0xe08770[_0xf9ce('0x3b')]=_[_0xf9ce('0x3c')](_0xe08770[_0xf9ce('0x38')],_0xe08770[_0xf9ce('0x39')]);_0x555eac[_0xf9ce('0x3d')]=_['intersection'](_0xe08770[_0xf9ce('0x38')],qs[_0xf9ce('0x3e')](_0x2e55dd['query'][_0xf9ce('0x3e')]));_0x555eac[_0xf9ce('0x3d')]=_0x555eac['attributes'][_0xf9ce('0x3f')]?_0x555eac[_0xf9ce('0x3d')]:_0xe08770[_0xf9ce('0x38')];if(!_0x2e55dd[_0xf9ce('0x39')][_0xf9ce('0x40')](_0xf9ce('0x41'))){_0x555eac[_0xf9ce('0x23')]=qs[_0xf9ce('0x23')](_0x2e55dd[_0xf9ce('0x39')][_0xf9ce('0x23')]);_0x555eac['offset']=qs[_0xf9ce('0x21')](_0x2e55dd[_0xf9ce('0x39')][_0xf9ce('0x21')]);}_0x555eac[_0xf9ce('0x42')]=qs[_0xf9ce('0x43')](_0x2e55dd['query'][_0xf9ce('0x43')]);_0x555eac[_0xf9ce('0x44')]=qs['filters'](_[_0xf9ce('0x45')](_0x2e55dd[_0xf9ce('0x39')],_0xe08770['filters']),_0x51e871);if(_0x2e55dd['query'][_0xf9ce('0x46')]){_0x555eac[_0xf9ce('0x44')]=_['merge'](_0x555eac[_0xf9ce('0x44')],{'$or':_[_0xf9ce('0x32')](_0x51e871,function(_0x23603d){if(_0x23603d[_0xf9ce('0x36')]!==_0xf9ce('0x47')){var _0x5e3a50={};_0x5e3a50[_0x23603d[_0xf9ce('0x30')]]={'$like':'%'+_0x2e55dd[_0xf9ce('0x39')]['filter']+'%'};return _0x5e3a50;}})});}_0x555eac=_[_0xf9ce('0x48')]({},_0x555eac,_0x2e55dd[_0xf9ce('0x49')]);var _0xe54498={'where':_0x555eac[_0xf9ce('0x44')]};return db[_0xf9ce('0x33')]['count'](_0xe54498)['then'](function(_0x895bd5){_0x210a8a[_0xf9ce('0x24')]=_0x895bd5;if(_0x2e55dd['query']['includeAll']){_0x555eac['include']=[{'all':!![]}];}return db[_0xf9ce('0x33')][_0xf9ce('0x4a')](_0x555eac);})[_0xf9ce('0x2b')](function(_0x2a76a4){_0x210a8a[_0xf9ce('0x4b')]=_0x2a76a4;return _0x210a8a;})[_0xf9ce('0x2b')](respondWithFilteredResult(_0x40c3c7,_0x555eac))[_0xf9ce('0x4c')](handleError(_0x40c3c7,null));};exports[_0xf9ce('0x4d')]=function(_0x1e13af,_0x5c2a0c){var _0xee2a11={'raw':!![],'where':{'id':_0x1e13af['params']['id']}},_0x5de8d9={};_0x5de8d9[_0xf9ce('0x38')]=_[_0xf9ce('0x3a')](db[_0xf9ce('0x33')][_0xf9ce('0x34')]);_0x5de8d9[_0xf9ce('0x39')]=_[_0xf9ce('0x3a')](_0x1e13af[_0xf9ce('0x39')]);_0x5de8d9[_0xf9ce('0x3b')]=_['intersection'](_0x5de8d9[_0xf9ce('0x38')],_0x5de8d9[_0xf9ce('0x39')]);_0xee2a11['attributes']=_[_0xf9ce('0x3c')](_0x5de8d9[_0xf9ce('0x38')],qs['fields'](_0x1e13af[_0xf9ce('0x39')]['fields']));_0xee2a11[_0xf9ce('0x3d')]=_0xee2a11[_0xf9ce('0x3d')][_0xf9ce('0x3f')]?_0xee2a11[_0xf9ce('0x3d')]:_0x5de8d9[_0xf9ce('0x38')];if(_0x1e13af[_0xf9ce('0x39')]['includeAll']){_0xee2a11['include']=[{'all':!![]}];}_0xee2a11=_[_0xf9ce('0x48')]({},_0xee2a11,_0x1e13af[_0xf9ce('0x49')]);return db['FaxQueue'][_0xf9ce('0x4e')](_0xee2a11)[_0xf9ce('0x2b')](handleEntityNotFound(_0x5c2a0c,null))['then'](respondWithResult(_0x5c2a0c,null))['catch'](handleError(_0x5c2a0c,null));};exports[_0xf9ce('0x4f')]=function(_0x3253b9,_0x34c29c){return db[_0xf9ce('0x33')]['create'](_0x3253b9[_0xf9ce('0x50')],{})[_0xf9ce('0x2b')](function(_0x42bddb){var _0x199dd1=_0x3253b9[_0xf9ce('0x51')][_0xf9ce('0x52')]({'plain':!![]});if(!_0x199dd1)throw new Error(_0xf9ce('0x53'));if(_0x199dd1[_0xf9ce('0x54')]===_0xf9ce('0x51')){var _0x2664c2=_0x42bddb[_0xf9ce('0x52')]({'plain':!![]});var _0x901f98=_0xf9ce('0x2d');return db['UserProfileSection'][_0xf9ce('0x4e')]({'where':{'name':_0x901f98,'userProfileId':_0x199dd1[_0xf9ce('0x55')]},'raw':!![]})['then'](function(_0x4eb8ff){if(_0x4eb8ff&&_0x4eb8ff[_0xf9ce('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x2664c2[_0xf9ce('0x30')],'resourceId':_0x2664c2['id'],'type':_0x4eb8ff[_0xf9ce('0x30')],'sectionId':_0x4eb8ff['id']},{})['then'](function(){return _0x42bddb;});}else{return _0x42bddb;}})[_0xf9ce('0x4c')](function(_0x2ef6eb){logger[_0xf9ce('0x57')](_0xf9ce('0x58'),_0x2ef6eb);throw _0x2ef6eb;});}return _0x42bddb;})['then'](respondWithResult(_0x34c29c,0xc9))[_0xf9ce('0x4c')](handleError(_0x34c29c,null));};exports['update']=function(_0x3ad57a,_0xcac946){if(_0x3ad57a[_0xf9ce('0x50')]['id']){delete _0x3ad57a['body']['id'];}return db[_0xf9ce('0x33')][_0xf9ce('0x4e')]({'where':{'id':_0x3ad57a[_0xf9ce('0x59')]['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0xcac946,null))['then'](saveUpdates(_0x3ad57a['body'],null))[_0xf9ce('0x2b')](respondWithResult(_0xcac946,null))[_0xf9ce('0x4c')](handleError(_0xcac946,null));};exports[_0xf9ce('0x2c')]=function(_0x2d14ef,_0x262aab){return db['FaxQueue']['find']({'where':{'id':_0x2d14ef[_0xf9ce('0x59')]['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x262aab,null))[_0xf9ce('0x2b')](removeEntity(_0x262aab,null))[_0xf9ce('0x4c')](handleError(_0x262aab,null));};exports[_0xf9ce('0x5a')]=function(_0x1fa785,_0x2a71ce){return db[_0xf9ce('0x33')][_0xf9ce('0x5a')]()[_0xf9ce('0x2b')](respondWithResult(_0x2a71ce,null))[_0xf9ce('0x4c')](handleError(_0x2a71ce,null));};exports[_0xf9ce('0x5b')]=function(_0x22707f,_0x5509be,_0xeb45db){var _0x351867={'raw':!![],'where':{}},_0x1662f7={},_0x3c786c;return db['FaxQueue'][_0xf9ce('0x5c')]({'where':{'id':_0x22707f[_0xf9ce('0x59')]['id']}})['then'](handleEntityNotFound(_0x5509be,null))[_0xf9ce('0x2b')](function(_0x52f1d4){if(_0x52f1d4){_0x3c786c=_0x52f1d4[_0xf9ce('0x52')]({'plain':!![]});_0x1662f7[_0xf9ce('0x38')]=_[_0xf9ce('0x3a')](db['UserFaxQueue'][_0xf9ce('0x34')]);_0x1662f7[_0xf9ce('0x39')]=_[_0xf9ce('0x3a')](_0x22707f[_0xf9ce('0x39')]);_0x1662f7[_0xf9ce('0x3b')]=_[_0xf9ce('0x3c')](_0x1662f7[_0xf9ce('0x38')],_0x1662f7[_0xf9ce('0x39')]);_0x351867[_0xf9ce('0x3d')]=_['intersection'](_0x1662f7[_0xf9ce('0x38')],qs[_0xf9ce('0x3e')](_0x22707f[_0xf9ce('0x39')]['fields']));_0x351867[_0xf9ce('0x3d')]=_0x351867['attributes'][_0xf9ce('0x3f')]?_0x351867['attributes']:_0x1662f7[_0xf9ce('0x38')];if(!_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x40')](_0xf9ce('0x41'))){_0x351867[_0xf9ce('0x23')]=qs['limit'](_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x23')]);_0x351867[_0xf9ce('0x21')]=qs['offset'](_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x21')]);}_0x351867[_0xf9ce('0x42')]=qs[_0xf9ce('0x43')](_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x43')]);_0x351867[_0xf9ce('0x44')]=qs[_0xf9ce('0x3b')](_[_0xf9ce('0x45')](_0x22707f['query'],_0x1662f7['filters']));_0x351867[_0xf9ce('0x44')][_0xf9ce('0x5d')]=_0x52f1d4['id'];if(_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x46')]){_0x351867[_0xf9ce('0x44')]=_['merge'](_0x351867['where'],{'$or':_[_0xf9ce('0x32')](_0x351867[_0xf9ce('0x3d')],function(_0x266334){var _0x26a9a6={};_0x26a9a6[_0x266334]={'$like':'%'+_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x46')]+'%'};return _0x26a9a6;})});}_0x351867=_[_0xf9ce('0x48')]({},_0x351867,_0x22707f[_0xf9ce('0x49')]);return db[_0xf9ce('0x5e')][_0xf9ce('0x4a')](_0x351867);}})[_0xf9ce('0x2b')](function(_0x1fe9f){if(_0x1fe9f){return db[_0xf9ce('0x5f')][_0xf9ce('0x60')]({'where':{'id':_[_0xf9ce('0x32')](_0x1fe9f,_0xf9ce('0x61')),'role':_0xf9ce('0x62')},'attributes':['id',_0xf9ce('0x30'),_0xf9ce('0x63'),_0xf9ce('0x64'),_0xf9ce('0x65')]});}})[_0xf9ce('0x2b')](function(_0x2bcd99){if(_0x2bcd99){return{'count':_0x2bcd99['count'],'rows':_[_0xf9ce('0x32')](_0x2bcd99[_0xf9ce('0x4b')],function(_0x2f66ed){return{'membername':_0x2f66ed[_0xf9ce('0x30')],'UserId':_0x2f66ed['id'],'queue_name':_0x3c786c[_0xf9ce('0x30')],'FaxQueueId':_0x3c786c['id'],'interface':util[_0xf9ce('0x66')]('%s/%s',_0xf9ce('0x67'),_0x2f66ed[_0xf9ce('0x30')]),'penalty':0x0,'paused':_0x2f66ed[_0xf9ce('0x63')],'createdAt':_0x2f66ed[_0xf9ce('0x65')],'updatedAt':_0x2f66ed['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5509be,_0x351867))[_0xf9ce('0x4c')](handleError(_0x5509be,null));};exports['getTeams']=function(_0x4f798b,_0x1a3ef9,_0x2e884d){var _0x10f318={};var _0x4fe54d={};var _0x58300f;var _0x1074a1;return db[_0xf9ce('0x33')]['findOne']({'where':{'id':_0x4f798b[_0xf9ce('0x59')]['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x1a3ef9,null))[_0xf9ce('0x2b')](function(_0x16359d){if(_0x16359d){_0x58300f=_0x16359d;_0x4fe54d[_0xf9ce('0x38')]=_[_0xf9ce('0x3a')](db[_0xf9ce('0x68')][_0xf9ce('0x34')]);_0x4fe54d[_0xf9ce('0x39')]=_[_0xf9ce('0x3a')](_0x4f798b[_0xf9ce('0x39')]);_0x4fe54d[_0xf9ce('0x3b')]=_[_0xf9ce('0x3c')](_0x4fe54d['model'],_0x4fe54d[_0xf9ce('0x39')]);_0x10f318[_0xf9ce('0x3d')]=_[_0xf9ce('0x3c')](_0x4fe54d[_0xf9ce('0x38')],qs[_0xf9ce('0x3e')](_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x3e')]));_0x10f318[_0xf9ce('0x3d')]=_0x10f318[_0xf9ce('0x3d')][_0xf9ce('0x3f')]?_0x10f318[_0xf9ce('0x3d')]:_0x4fe54d[_0xf9ce('0x38')];_0x10f318[_0xf9ce('0x42')]=qs['sort'](_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x43')]);_0x10f318[_0xf9ce('0x44')]=qs[_0xf9ce('0x3b')](_[_0xf9ce('0x45')](_0x4f798b[_0xf9ce('0x39')],_0x4fe54d[_0xf9ce('0x3b')]));if(_0x4f798b[_0xf9ce('0x39')]['filter']){_0x10f318[_0xf9ce('0x44')]=_[_0xf9ce('0x48')](_0x10f318[_0xf9ce('0x44')],{'$or':_[_0xf9ce('0x32')](_0x10f318[_0xf9ce('0x3d')],function(_0x1864b5){var _0x3749ad={};_0x3749ad[_0x1864b5]={'$like':'%'+_0x4f798b[_0xf9ce('0x39')]['filter']+'%'};return _0x3749ad;})});}_0x10f318=_[_0xf9ce('0x48')]({},_0x10f318,_0x4f798b[_0xf9ce('0x49')]);return _0x58300f[_0xf9ce('0x69')](_0x10f318);}})[_0xf9ce('0x2b')](function(_0x5541d1){if(_0x5541d1){_0x1074a1=_0x5541d1['length'];if(!_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x40')](_0xf9ce('0x41'))){_0x10f318[_0xf9ce('0x23')]=qs[_0xf9ce('0x23')](_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x23')]);_0x10f318[_0xf9ce('0x21')]=qs[_0xf9ce('0x21')](_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x21')]);}return _0x58300f['getTeams'](_0x10f318);}})[_0xf9ce('0x2b')](function(_0x7459b2){if(_0x7459b2){return _0x7459b2?{'count':_0x1074a1,'rows':_0x7459b2}:null;}})[_0xf9ce('0x2b')](respondWithResult(_0x1a3ef9,null))['catch'](handleError(_0x1a3ef9,null));};exports[_0xf9ce('0x6a')]=function(_0x390603,_0x1e3505,_0x471a36){var _0x35b38d=_0x390603[_0xf9ce('0x50')]['ids'];return db[_0xf9ce('0x68')][_0xf9ce('0x4a')]({'where':{'id':_0x35b38d},'attributes':['id'],'include':[{'model':db[_0xf9ce('0x5f')],'as':_0xf9ce('0x6b'),'attributes':['id','name',_0xf9ce('0x6c'),_0xf9ce('0x6d'),_0xf9ce('0x6e')],'raw':!![]}]})[_0xf9ce('0x2b')](function(_0x18e35d){if(_0x18e35d){var _0x4ecae0=_['flatMap'](_0x18e35d,function(_0x24e087){var _0x32c21c=_0x24e087[_0xf9ce('0x52')]({'plain':!![]});return _0x32c21c['Agents'];});return db['FaxQueue']['find']({'where':{'id':_0x390603[_0xf9ce('0x59')]['id']}})['then'](function(_0x53f549){return db[_0xf9ce('0x6f')]['transaction'](function(_0x36c1b1){return _0x53f549[_0xf9ce('0x6a')](_0x35b38d,{'transaction':_0x36c1b1})[_0xf9ce('0x2b')](function(){return BPromise[_0xf9ce('0x70')](_0x4ecae0,function(_0x17300a){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x17300a['id'],'FaxQueueId':_0x390603[_0xf9ce('0x59')]['id']},'transaction':_0x36c1b1});});})[_0xf9ce('0x2b')](function(){_0x4ecae0[_0xf9ce('0x71')](function(_0x4a53e3){socket[_0xf9ce('0x72')](_0xf9ce('0x73'),{'UserId':_0x4a53e3['id'],'FaxQueueId':_0x53f549['id']});});});});});}})['then'](respondWithStatusCode(_0x1e3505,null))[_0xf9ce('0x4c')](handleError(_0x1e3505,null));};exports[_0xf9ce('0x74')]=function(_0x507a88,_0x295efd,_0x35df38){return db[_0xf9ce('0x68')][_0xf9ce('0x4a')]({'where':{'id':_0x507a88[_0xf9ce('0x39')][_0xf9ce('0x75')]},'attributes':['id'],'include':[{'model':db[_0xf9ce('0x5f')],'as':_0xf9ce('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xf9ce('0x2b')](handleEntityNotFound(_0x295efd,null))[_0xf9ce('0x2b')](function(_0x4c662d){var _0x548c3d=_[_0xf9ce('0x32')](_0x4c662d,'id');var _0x56e771=[];var _0x289419=[];var _0x4d26d4=squel['select']();_0x4d26d4[_0xf9ce('0x76')](_0xf9ce('0x77'))[_0xf9ce('0x78')](_0xf9ce('0x79'),'tq')[_0xf9ce('0x7a')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf9ce('0x44')](_0xf9ce('0x7b'),_0x507a88['params']['id']);for(var _0x595781=0x0;_0x595781<_0x4c662d[_0xf9ce('0x3f')];_0x595781+=0x1){let _0x2e3826=_0x4c662d[_0x595781];for(var _0x4d3132=0x0;_0x4d3132<_0x2e3826[_0xf9ce('0x6b')][_0xf9ce('0x3f')];_0x4d3132+=0x1){let _0x2edaaf=_0x2e3826[_0xf9ce('0x6b')][_0x4d3132];var _0x404035=_0x4d26d4[_0xf9ce('0x7c')]();_0x404035['where'](_0xf9ce('0x7d'),_0x2edaaf['id']);_0x289419['push'](db['sequelize'][_0xf9ce('0x39')](_0x404035[_0xf9ce('0x7e')](),{'type':db['sequelize'][_0xf9ce('0x7f')]['SELECT']})[_0xf9ce('0x2b')](function(_0x30079f){if(_0x30079f[_0xf9ce('0x3f')]===0x1){return _0x2edaaf['id'];}else{var _0x2849b=_[_0xf9ce('0x80')](_['map'](_0x30079f,_0xf9ce('0x81')),function(_0x1303b5){return _[_0xf9ce('0x82')](_0x548c3d,_0x1303b5);});if(_0x2849b){return _0x2edaaf['id'];}}}));}}return BPromise['all'](_0x289419)[_0xf9ce('0x2b')](function(_0x41d759){_0x56e771=_(_0x56e771)[_0xf9ce('0x83')](_0x41d759)[_0xf9ce('0x84')]()['value']();return db['FaxQueue']['find']({'where':{'id':_0x507a88['params']['id']}})[_0xf9ce('0x2b')](function(_0x55ef96){return db['sequelize'][_0xf9ce('0x85')](function(_0x331bb1){return _0x55ef96[_0xf9ce('0x74')](_0x507a88[_0xf9ce('0x39')][_0xf9ce('0x75')],{'transaction':_0x331bb1})[_0xf9ce('0x2b')](function(){if(!_[_0xf9ce('0x86')](_0x56e771)){return _0x55ef96[_0xf9ce('0x87')](_0x56e771,{'transaction':_0x331bb1});}})['then'](function(){_0x56e771[_0xf9ce('0x71')](function(_0x4d5a80){socket['emit'](_0xf9ce('0x88'),{'UserId':_0x4d5a80,'FaxQueueId':_0x55ef96['id']});});});});});});})[_0xf9ce('0x2b')](respondWithStatusCode(_0x295efd,null))[_0xf9ce('0x4c')](handleError(_0x295efd,null));};exports[_0xf9ce('0x89')]=function(_0x427a7d,_0x2d593b,_0x4d7cb1){return db[_0xf9ce('0x33')][_0xf9ce('0x4e')]({'where':{'id':_0x427a7d['params']['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x2d593b,null))[_0xf9ce('0x2b')](function(_0x1edc16){if(_0x1edc16){return _0x1edc16[_0xf9ce('0x89')](_0x427a7d[_0xf9ce('0x50')][_0xf9ce('0x75')],_['omit'](_0x427a7d['body'],[_0xf9ce('0x75'),'id'])||{})[_0xf9ce('0x8a')](function(_0x3afa8e){for(var _0xf1af90=0x0;_0xf1af90<_0x427a7d[_0xf9ce('0x50')]['ids'][_0xf9ce('0x3f')];_0xf1af90+=0x1){socket[_0xf9ce('0x72')](_0xf9ce('0x73'),{'UserId':Number(_0x427a7d[_0xf9ce('0x50')][_0xf9ce('0x75')][_0xf1af90]),'FaxQueueId':Number(_0x427a7d[_0xf9ce('0x59')]['id'])});}return _0x3afa8e;});}})[_0xf9ce('0x2b')](respondWithResult(_0x2d593b,null))['catch'](handleError(_0x2d593b,null));};exports[_0xf9ce('0x87')]=function(_0x43d417,_0x5e4f53,_0x1db5da){return db[_0xf9ce('0x33')]['find']({'where':{'id':_0x43d417['params']['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x5e4f53,null))['then'](function(_0x4bc5bd){if(_0x4bc5bd){return _0x4bc5bd[_0xf9ce('0x87')](_0x43d417['query'][_0xf9ce('0x75')])[_0xf9ce('0x2b')](function(){if(_[_0xf9ce('0x8b')](_0x43d417['query']['ids'])){for(var _0x4fb685=0x0;_0x4fb685<_0x43d417[_0xf9ce('0x39')][_0xf9ce('0x75')]['length'];_0x4fb685+=0x1){socket[_0xf9ce('0x72')](_0xf9ce('0x88'),{'UserId':Number(_0x43d417['query'][_0xf9ce('0x75')][_0x4fb685]),'FaxQueueId':Number(_0x43d417[_0xf9ce('0x59')]['id'])});}}else{socket[_0xf9ce('0x72')](_0xf9ce('0x88'),{'UserId':Number(_0x43d417[_0xf9ce('0x39')][_0xf9ce('0x75')]),'FaxQueueId':Number(_0x43d417[_0xf9ce('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e4f53,null))[_0xf9ce('0x4c')](handleError(_0x5e4f53,null));};exports['getAgents']=function(_0x52d38f,_0x56f404,_0x1200c2){var _0x4484bd={};var _0x4e09a2={};var _0x359615;var _0x94bc4f;return db['FaxQueue']['findOne']({'where':{'id':_0x52d38f[_0xf9ce('0x59')]['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x56f404,null))[_0xf9ce('0x2b')](function(_0x263566){if(_0x263566){_0x359615=_0x263566;_0x4e09a2[_0xf9ce('0x38')]=_[_0xf9ce('0x3a')](db['User'][_0xf9ce('0x34')]);_0x4e09a2[_0xf9ce('0x39')]=_['keys'](_0x52d38f[_0xf9ce('0x39')]);_0x4e09a2['filters']=_[_0xf9ce('0x3c')](_0x4e09a2[_0xf9ce('0x38')],_0x4e09a2[_0xf9ce('0x39')]);_0x4484bd[_0xf9ce('0x3d')]=_['intersection'](_0x4e09a2['model'],qs[_0xf9ce('0x3e')](_0x52d38f['query'][_0xf9ce('0x3e')]));_0x4484bd[_0xf9ce('0x3d')]=_0x4484bd['attributes'][_0xf9ce('0x3f')]?_0x4484bd[_0xf9ce('0x3d')]:_0x4e09a2[_0xf9ce('0x38')];_0x4484bd[_0xf9ce('0x42')]=qs[_0xf9ce('0x43')](_0x52d38f[_0xf9ce('0x39')][_0xf9ce('0x43')]);_0x4484bd[_0xf9ce('0x44')]=qs['filters'](_['pick'](_0x52d38f[_0xf9ce('0x39')],_0x4e09a2['filters']));if(_0x52d38f['query'][_0xf9ce('0x46')]){_0x4484bd[_0xf9ce('0x44')]=_[_0xf9ce('0x48')](_0x4484bd[_0xf9ce('0x44')],{'$or':_[_0xf9ce('0x32')](_0x4484bd[_0xf9ce('0x3d')],function(_0x532c35){var _0x47a3dc={};_0x47a3dc[_0x532c35]={'$like':'%'+_0x52d38f[_0xf9ce('0x39')][_0xf9ce('0x46')]+'%'};return _0x47a3dc;})});}_0x4484bd=_[_0xf9ce('0x48')]({},_0x4484bd,_0x52d38f[_0xf9ce('0x49')]);return _0x359615['getAgents'](_0x4484bd);}})['then'](function(_0x15097a){if(_0x15097a){_0x94bc4f=_0x15097a['length'];if(!_0x52d38f[_0xf9ce('0x39')][_0xf9ce('0x40')](_0xf9ce('0x41'))){_0x4484bd[_0xf9ce('0x23')]=qs[_0xf9ce('0x23')](_0x52d38f['query'][_0xf9ce('0x23')]);_0x4484bd[_0xf9ce('0x21')]=qs[_0xf9ce('0x21')](_0x52d38f['query']['offset']);}return _0x359615[_0xf9ce('0x8c')](_0x4484bd);}})['then'](function(_0x5d4c1e){if(_0x5d4c1e){return _0x5d4c1e?{'count':_0x94bc4f,'rows':_0x5d4c1e}:null;}})[_0xf9ce('0x2b')](respondWithResult(_0x56f404,null))['catch'](handleError(_0x56f404,null));}; \ No newline at end of file +var _0x6e39=['count','Content-Range','apply','reject','update','then','get','FaxQueues','UserProfileResource','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','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','getMembers','where','FaxQueueId','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','Team','hasOwnProperty','ids','voicePause','interface','Agents','transaction','addTeams','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','emit','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit'];(function(_0x3a4729,_0x2e78cd){var _0x23f9a9=function(_0x225b8f){while(--_0x225b8f){_0x3a4729['push'](_0x3a4729['shift']());}};_0x23f9a9(++_0x2e78cd);}(_0x6e39,0x67));var _0x96e3=function(_0x407138,_0x4e617d){_0x407138=_0x407138-0x0;var _0x51b291=_0x6e39[_0x407138];return _0x51b291;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x96e3('0x0'));var zipdir=require(_0x96e3('0x1'));var jsonpatch=require(_0x96e3('0x2'));var rp=require(_0x96e3('0x3'));var moment=require(_0x96e3('0x4'));var BPromise=require(_0x96e3('0x5'));var Mustache=require('mustache');var util=require(_0x96e3('0x6'));var path=require(_0x96e3('0x7'));var sox=require(_0x96e3('0x8'));var csv=require(_0x96e3('0x9'));var ejs=require(_0x96e3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96e3('0xb'));var squel=require(_0x96e3('0xc'));var crypto=require(_0x96e3('0xd'));var jsforce=require(_0x96e3('0xe'));var deskjs=require(_0x96e3('0xf'));var toCsv=require(_0x96e3('0x9'));var querystring=require(_0x96e3('0x10'));var Papa=require(_0x96e3('0x11'));var Redis=require(_0x96e3('0x12'));var authService=require(_0x96e3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x96e3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96e3('0x15'))(_0x96e3('0x16'));var utils=require('../../config/utils');var config=require(_0x96e3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x96e3('0x18')]=_[_0x96e3('0x19')](config['redis'],{'host':_0x96e3('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96e3('0x18')]));require(_0x96e3('0x1b'))[_0x96e3('0x1c')](socket);function respondWithStatusCode(_0xcb1ac8,_0x422068){_0x422068=_0x422068||0xcc;return function(_0x1df761){if(_0x1df761){return _0xcb1ac8[_0x96e3('0x1d')](_0x422068);}return _0xcb1ac8['status'](_0x422068)['end']();};}function respondWithResult(_0x599914,_0x2ae815){_0x2ae815=_0x2ae815||0xc8;return function(_0x155d5b){if(_0x155d5b){return _0x599914[_0x96e3('0x1e')](_0x2ae815)[_0x96e3('0x1f')](_0x155d5b);}};}function respondWithFilteredResult(_0x7316bf,_0x596ba2){return function(_0x3dd090){if(_0x3dd090){var _0x4ee7dc=typeof _0x596ba2[_0x96e3('0x20')]===_0x96e3('0x21')&&typeof _0x596ba2[_0x96e3('0x22')]==='undefined';var _0x1b6a9f=_0x3dd090[_0x96e3('0x23')];var _0x2e3a7c=_0x4ee7dc?0x0:_0x596ba2['offset'];var _0xef1dd=_0x4ee7dc?_0x3dd090['count']:_0x596ba2[_0x96e3('0x20')]+_0x596ba2[_0x96e3('0x22')];var _0x3bca07;if(_0xef1dd>=_0x1b6a9f){_0xef1dd=_0x1b6a9f;_0x3bca07=0xc8;}else{_0x3bca07=0xce;}_0x7316bf[_0x96e3('0x1e')](_0x3bca07);return _0x7316bf['set'](_0x96e3('0x24'),_0x2e3a7c+'-'+_0xef1dd+'/'+_0x1b6a9f)[_0x96e3('0x1f')](_0x3dd090);}return null;};}function patchUpdates(_0x30a83d){return function(_0xe36aea){try{jsonpatch[_0x96e3('0x25')](_0xe36aea,_0x30a83d,!![]);}catch(_0x552cf9){return BPromise[_0x96e3('0x26')](_0x552cf9);}return _0xe36aea['save']();};}function saveUpdates(_0x334b24,_0x1011b2){return function(_0x1580ce){if(_0x1580ce){return _0x1580ce[_0x96e3('0x27')](_0x334b24)[_0x96e3('0x28')](function(_0x18d02f){return _0x18d02f;});}return null;};}function removeEntity(_0x23db3c,_0x230e0b){return function(_0x47faea){if(_0x47faea){return _0x47faea['destroy']()['then'](function(){var _0xd5772f=_0x47faea[_0x96e3('0x29')]({'plain':!![]});var _0x6bb589=_0x96e3('0x2a');return db[_0x96e3('0x2b')]['destroy']({'where':{'type':_0x6bb589,'resourceId':_0xd5772f['id']}})[_0x96e3('0x28')](function(){return _0x47faea;});})['then'](function(){_0x23db3c[_0x96e3('0x1e')](0xcc)[_0x96e3('0x2c')]();});}};}function handleEntityNotFound(_0x59f1cd,_0x57ec76){return function(_0x45a4bd){if(!_0x45a4bd){_0x59f1cd[_0x96e3('0x1d')](0x194);}return _0x45a4bd;};}function handleError(_0x551ce0,_0x4bed0b){_0x4bed0b=_0x4bed0b||0x1f4;return function(_0x1c8ac7){logger[_0x96e3('0x2d')](_0x1c8ac7[_0x96e3('0x2e')]);if(_0x1c8ac7['name']){delete _0x1c8ac7[_0x96e3('0x2f')];}_0x551ce0[_0x96e3('0x1e')](_0x4bed0b)[_0x96e3('0x30')](_0x1c8ac7);};}exports[_0x96e3('0x31')]=function(_0x319291,_0x522705){var _0x361c76={},_0x10c1c6={},_0x10250a={'count':0x0,'rows':[]};var _0x4a152a=_[_0x96e3('0x32')](db[_0x96e3('0x33')][_0x96e3('0x34')],function(_0x464917){return{'name':_0x464917[_0x96e3('0x35')],'type':_0x464917[_0x96e3('0x36')]['key']};});_0x10c1c6[_0x96e3('0x37')]=_[_0x96e3('0x32')](_0x4a152a,_0x96e3('0x2f'));_0x10c1c6[_0x96e3('0x38')]=_[_0x96e3('0x39')](_0x319291['query']);_0x10c1c6[_0x96e3('0x3a')]=_[_0x96e3('0x3b')](_0x10c1c6[_0x96e3('0x37')],_0x10c1c6[_0x96e3('0x38')]);_0x361c76[_0x96e3('0x3c')]=_['intersection'](_0x10c1c6[_0x96e3('0x37')],qs[_0x96e3('0x3d')](_0x319291['query']['fields']));_0x361c76['attributes']=_0x361c76[_0x96e3('0x3c')][_0x96e3('0x3e')]?_0x361c76['attributes']:_0x10c1c6[_0x96e3('0x37')];if(!_0x319291['query']['hasOwnProperty'](_0x96e3('0x3f'))){_0x361c76[_0x96e3('0x22')]=qs[_0x96e3('0x22')](_0x319291['query'][_0x96e3('0x22')]);_0x361c76[_0x96e3('0x20')]=qs[_0x96e3('0x20')](_0x319291['query'][_0x96e3('0x20')]);}_0x361c76[_0x96e3('0x40')]=qs[_0x96e3('0x41')](_0x319291[_0x96e3('0x38')][_0x96e3('0x41')]);_0x361c76['where']=qs[_0x96e3('0x3a')](_[_0x96e3('0x42')](_0x319291[_0x96e3('0x38')],_0x10c1c6['filters']),_0x4a152a);if(_0x319291[_0x96e3('0x38')]['filter']){_0x361c76['where']=_[_0x96e3('0x43')](_0x361c76['where'],{'$or':_[_0x96e3('0x32')](_0x4a152a,function(_0x5e9981){if(_0x5e9981[_0x96e3('0x36')]!=='VIRTUAL'){var _0x24c01f={};_0x24c01f[_0x5e9981[_0x96e3('0x2f')]]={'$like':'%'+_0x319291[_0x96e3('0x38')][_0x96e3('0x44')]+'%'};return _0x24c01f;}})});}_0x361c76=_['merge']({},_0x361c76,_0x319291[_0x96e3('0x45')]);var _0x3b6e12={'where':_0x361c76['where']};return db[_0x96e3('0x33')][_0x96e3('0x23')](_0x3b6e12)[_0x96e3('0x28')](function(_0x44afe8){_0x10250a[_0x96e3('0x23')]=_0x44afe8;if(_0x319291[_0x96e3('0x38')][_0x96e3('0x46')]){_0x361c76[_0x96e3('0x47')]=[{'all':!![]}];}return db[_0x96e3('0x33')][_0x96e3('0x48')](_0x361c76);})[_0x96e3('0x28')](function(_0x202157){_0x10250a[_0x96e3('0x49')]=_0x202157;return _0x10250a;})[_0x96e3('0x28')](respondWithFilteredResult(_0x522705,_0x361c76))[_0x96e3('0x4a')](handleError(_0x522705,null));};exports['show']=function(_0x385899,_0x2f0fd8){var _0x20cbbd={'raw':!![],'where':{'id':_0x385899[_0x96e3('0x4b')]['id']}},_0x118d90={};_0x118d90[_0x96e3('0x37')]=_[_0x96e3('0x39')](db[_0x96e3('0x33')][_0x96e3('0x34')]);_0x118d90[_0x96e3('0x38')]=_[_0x96e3('0x39')](_0x385899['query']);_0x118d90[_0x96e3('0x3a')]=_[_0x96e3('0x3b')](_0x118d90['model'],_0x118d90[_0x96e3('0x38')]);_0x20cbbd[_0x96e3('0x3c')]=_[_0x96e3('0x3b')](_0x118d90[_0x96e3('0x37')],qs['fields'](_0x385899[_0x96e3('0x38')][_0x96e3('0x3d')]));_0x20cbbd[_0x96e3('0x3c')]=_0x20cbbd['attributes'][_0x96e3('0x3e')]?_0x20cbbd[_0x96e3('0x3c')]:_0x118d90[_0x96e3('0x37')];if(_0x385899[_0x96e3('0x38')][_0x96e3('0x46')]){_0x20cbbd[_0x96e3('0x47')]=[{'all':!![]}];}_0x20cbbd=_[_0x96e3('0x43')]({},_0x20cbbd,_0x385899[_0x96e3('0x45')]);return db[_0x96e3('0x33')][_0x96e3('0x4c')](_0x20cbbd)['then'](handleEntityNotFound(_0x2f0fd8,null))[_0x96e3('0x28')](respondWithResult(_0x2f0fd8,null))[_0x96e3('0x4a')](handleError(_0x2f0fd8,null));};exports[_0x96e3('0x4d')]=function(_0x184659,_0x5f115d){return db['FaxQueue'][_0x96e3('0x4d')](_0x184659['body'],{})['then'](function(_0x9ae82d){var _0x6ff65f=_0x184659[_0x96e3('0x4e')][_0x96e3('0x29')]({'plain':!![]});if(!_0x6ff65f)throw new Error(_0x96e3('0x4f'));if(_0x6ff65f[_0x96e3('0x50')]===_0x96e3('0x4e')){var _0xf89225=_0x9ae82d['get']({'plain':!![]});var _0x63e715=_0x96e3('0x2a');return db[_0x96e3('0x51')][_0x96e3('0x4c')]({'where':{'name':_0x63e715,'userProfileId':_0x6ff65f[_0x96e3('0x52')]},'raw':!![]})['then'](function(_0x1553b6){if(_0x1553b6&&_0x1553b6['autoAssociation']===0x0){return db[_0x96e3('0x2b')][_0x96e3('0x4d')]({'name':_0xf89225[_0x96e3('0x2f')],'resourceId':_0xf89225['id'],'type':_0x1553b6[_0x96e3('0x2f')],'sectionId':_0x1553b6['id']},{})[_0x96e3('0x28')](function(){return _0x9ae82d;});}else{return _0x9ae82d;}})[_0x96e3('0x4a')](function(_0x3a18fb){logger[_0x96e3('0x2d')](_0x96e3('0x53'),_0x3a18fb);throw _0x3a18fb;});}return _0x9ae82d;})['then'](respondWithResult(_0x5f115d,0xc9))[_0x96e3('0x4a')](handleError(_0x5f115d,null));};exports[_0x96e3('0x27')]=function(_0x24c6fa,_0x82eec5){if(_0x24c6fa[_0x96e3('0x54')]['id']){delete _0x24c6fa[_0x96e3('0x54')]['id'];}return db[_0x96e3('0x33')][_0x96e3('0x4c')]({'where':{'id':_0x24c6fa[_0x96e3('0x4b')]['id']}})[_0x96e3('0x28')](handleEntityNotFound(_0x82eec5,null))[_0x96e3('0x28')](saveUpdates(_0x24c6fa[_0x96e3('0x54')],null))[_0x96e3('0x28')](respondWithResult(_0x82eec5,null))[_0x96e3('0x4a')](handleError(_0x82eec5,null));};exports[_0x96e3('0x55')]=function(_0x4ce55b,_0x26d9eb){return db[_0x96e3('0x33')][_0x96e3('0x4c')]({'where':{'id':_0x4ce55b[_0x96e3('0x4b')]['id']}})[_0x96e3('0x28')](handleEntityNotFound(_0x26d9eb,null))[_0x96e3('0x28')](removeEntity(_0x26d9eb,null))[_0x96e3('0x4a')](handleError(_0x26d9eb,null));};exports[_0x96e3('0x56')]=function(_0x532640,_0x20825e){return db[_0x96e3('0x33')]['describe']()['then'](respondWithResult(_0x20825e,null))['catch'](handleError(_0x20825e,null));};exports[_0x96e3('0x57')]=function(_0x178434,_0x2fb3fd,_0x39cbcb){var _0x4a2f33={'raw':!![],'where':{}},_0x5334b6={},_0x568cf1;return db[_0x96e3('0x33')]['findOne']({'where':{'id':_0x178434['params']['id']}})[_0x96e3('0x28')](handleEntityNotFound(_0x2fb3fd,null))[_0x96e3('0x28')](function(_0x311f77){if(_0x311f77){_0x568cf1=_0x311f77[_0x96e3('0x29')]({'plain':!![]});_0x5334b6[_0x96e3('0x37')]=_['keys'](db['UserFaxQueue'][_0x96e3('0x34')]);_0x5334b6[_0x96e3('0x38')]=_[_0x96e3('0x39')](_0x178434[_0x96e3('0x38')]);_0x5334b6[_0x96e3('0x3a')]=_[_0x96e3('0x3b')](_0x5334b6['model'],_0x5334b6['query']);_0x4a2f33['attributes']=_[_0x96e3('0x3b')](_0x5334b6[_0x96e3('0x37')],qs['fields'](_0x178434[_0x96e3('0x38')][_0x96e3('0x3d')]));_0x4a2f33[_0x96e3('0x3c')]=_0x4a2f33[_0x96e3('0x3c')][_0x96e3('0x3e')]?_0x4a2f33['attributes']:_0x5334b6[_0x96e3('0x37')];if(!_0x178434['query']['hasOwnProperty'](_0x96e3('0x3f'))){_0x4a2f33['limit']=qs['limit'](_0x178434[_0x96e3('0x38')][_0x96e3('0x22')]);_0x4a2f33[_0x96e3('0x20')]=qs['offset'](_0x178434['query']['offset']);}_0x4a2f33[_0x96e3('0x40')]=qs[_0x96e3('0x41')](_0x178434['query']['sort']);_0x4a2f33[_0x96e3('0x58')]=qs[_0x96e3('0x3a')](_[_0x96e3('0x42')](_0x178434[_0x96e3('0x38')],_0x5334b6[_0x96e3('0x3a')]));_0x4a2f33[_0x96e3('0x58')][_0x96e3('0x59')]=_0x311f77['id'];if(_0x178434[_0x96e3('0x38')][_0x96e3('0x44')]){_0x4a2f33[_0x96e3('0x58')]=_[_0x96e3('0x43')](_0x4a2f33['where'],{'$or':_[_0x96e3('0x32')](_0x4a2f33[_0x96e3('0x3c')],function(_0x263785){var _0x53ae65={};_0x53ae65[_0x263785]={'$like':'%'+_0x178434[_0x96e3('0x38')][_0x96e3('0x44')]+'%'};return _0x53ae65;})});}_0x4a2f33=_[_0x96e3('0x43')]({},_0x4a2f33,_0x178434[_0x96e3('0x45')]);return db['UserFaxQueue'][_0x96e3('0x48')](_0x4a2f33);}})[_0x96e3('0x28')](function(_0xf6c44b){if(_0xf6c44b){return db[_0x96e3('0x5a')]['findAndCountAll']({'where':{'id':_[_0x96e3('0x32')](_0xf6c44b,_0x96e3('0x5b')),'role':_0x96e3('0x5c')},'attributes':['id','name','faxPause',_0x96e3('0x5d'),_0x96e3('0x5e')]});}})['then'](function(_0x345324){if(_0x345324){return{'count':_0x345324[_0x96e3('0x23')],'rows':_[_0x96e3('0x32')](_0x345324[_0x96e3('0x49')],function(_0x43d82a){return{'membername':_0x43d82a[_0x96e3('0x2f')],'UserId':_0x43d82a['id'],'queue_name':_0x568cf1['name'],'FaxQueueId':_0x568cf1['id'],'interface':util[_0x96e3('0x5f')](_0x96e3('0x60'),_0x96e3('0x61'),_0x43d82a['name']),'penalty':0x0,'paused':_0x43d82a[_0x96e3('0x62')],'createdAt':_0x43d82a['createdAt'],'updatedAt':_0x43d82a[_0x96e3('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2fb3fd,_0x4a2f33))['catch'](handleError(_0x2fb3fd,null));};exports[_0x96e3('0x63')]=function(_0x55795a,_0x12c388,_0x514d75){var _0x207778={};var _0x4f9685={};var _0x34fa4c;var _0x18f495;return db['FaxQueue']['findOne']({'where':{'id':_0x55795a[_0x96e3('0x4b')]['id']}})[_0x96e3('0x28')](handleEntityNotFound(_0x12c388,null))[_0x96e3('0x28')](function(_0x416a42){if(_0x416a42){_0x34fa4c=_0x416a42;_0x4f9685[_0x96e3('0x37')]=_[_0x96e3('0x39')](db[_0x96e3('0x64')][_0x96e3('0x34')]);_0x4f9685[_0x96e3('0x38')]=_['keys'](_0x55795a[_0x96e3('0x38')]);_0x4f9685['filters']=_['intersection'](_0x4f9685[_0x96e3('0x37')],_0x4f9685[_0x96e3('0x38')]);_0x207778[_0x96e3('0x3c')]=_[_0x96e3('0x3b')](_0x4f9685['model'],qs[_0x96e3('0x3d')](_0x55795a[_0x96e3('0x38')][_0x96e3('0x3d')]));_0x207778[_0x96e3('0x3c')]=_0x207778[_0x96e3('0x3c')][_0x96e3('0x3e')]?_0x207778[_0x96e3('0x3c')]:_0x4f9685[_0x96e3('0x37')];_0x207778[_0x96e3('0x40')]=qs[_0x96e3('0x41')](_0x55795a['query'][_0x96e3('0x41')]);_0x207778[_0x96e3('0x58')]=qs[_0x96e3('0x3a')](_[_0x96e3('0x42')](_0x55795a[_0x96e3('0x38')],_0x4f9685[_0x96e3('0x3a')]));if(_0x55795a[_0x96e3('0x38')]['filter']){_0x207778['where']=_[_0x96e3('0x43')](_0x207778[_0x96e3('0x58')],{'$or':_['map'](_0x207778['attributes'],function(_0x20987e){var _0x2a87b6={};_0x2a87b6[_0x20987e]={'$like':'%'+_0x55795a[_0x96e3('0x38')]['filter']+'%'};return _0x2a87b6;})});}_0x207778=_[_0x96e3('0x43')]({},_0x207778,_0x55795a[_0x96e3('0x45')]);return _0x34fa4c[_0x96e3('0x63')](_0x207778);}})[_0x96e3('0x28')](function(_0x733327){if(_0x733327){_0x18f495=_0x733327[_0x96e3('0x3e')];if(!_0x55795a[_0x96e3('0x38')][_0x96e3('0x65')](_0x96e3('0x3f'))){_0x207778[_0x96e3('0x22')]=qs['limit'](_0x55795a['query']['limit']);_0x207778['offset']=qs[_0x96e3('0x20')](_0x55795a[_0x96e3('0x38')][_0x96e3('0x20')]);}return _0x34fa4c[_0x96e3('0x63')](_0x207778);}})[_0x96e3('0x28')](function(_0x1e2aaf){if(_0x1e2aaf){return _0x1e2aaf?{'count':_0x18f495,'rows':_0x1e2aaf}:null;}})['then'](respondWithResult(_0x12c388,null))[_0x96e3('0x4a')](handleError(_0x12c388,null));};exports['addTeams']=function(_0x170bc0,_0x4dc727,_0x435620){var _0x88b1ea=_0x170bc0[_0x96e3('0x54')][_0x96e3('0x66')];return db[_0x96e3('0x64')][_0x96e3('0x48')]({'where':{'id':_0x88b1ea},'attributes':['id'],'include':[{'model':db[_0x96e3('0x5a')],'as':'Agents','attributes':['id',_0x96e3('0x2f'),'online',_0x96e3('0x67'),_0x96e3('0x68')],'raw':!![]}]})[_0x96e3('0x28')](function(_0x14db9c){if(_0x14db9c){var _0x18d195=_['flatMap'](_0x14db9c,function(_0x5170b9){var _0x11ec10=_0x5170b9['get']({'plain':!![]});return _0x11ec10[_0x96e3('0x69')];});return db[_0x96e3('0x33')]['find']({'where':{'id':_0x170bc0[_0x96e3('0x4b')]['id']}})['then'](function(_0x3842c2){return db['sequelize'][_0x96e3('0x6a')](function(_0x417260){return _0x3842c2[_0x96e3('0x6b')](_0x88b1ea,{'transaction':_0x417260})['then'](function(){return BPromise[_0x96e3('0x6c')](_0x18d195,function(_0x3a79a4){return db['UserFaxQueue'][_0x96e3('0x6d')]({'where':{'UserId':_0x3a79a4['id'],'FaxQueueId':_0x170bc0[_0x96e3('0x4b')]['id']},'transaction':_0x417260});});})[_0x96e3('0x28')](function(){_0x18d195[_0x96e3('0x6e')](function(_0x1112b1){socket['emit'](_0x96e3('0x6f'),{'UserId':_0x1112b1['id'],'FaxQueueId':_0x3842c2['id']});});});});});}})[_0x96e3('0x28')](respondWithStatusCode(_0x4dc727,null))[_0x96e3('0x4a')](handleError(_0x4dc727,null));};exports[_0x96e3('0x70')]=function(_0x547e81,_0xe514ac,_0x74f4){return db[_0x96e3('0x64')][_0x96e3('0x48')]({'where':{'id':_0x547e81[_0x96e3('0x38')][_0x96e3('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x96e3('0x69'),'attributes':['id'],'raw':!![]}]})[_0x96e3('0x28')](handleEntityNotFound(_0xe514ac,null))[_0x96e3('0x28')](function(_0x36b6ea){var _0x56dcf0=_[_0x96e3('0x32')](_0x36b6ea,'id');var _0x27f5de=[];var _0x368a04=[];var _0x10182b=squel['select']();_0x10182b['field'](_0x96e3('0x71'))[_0x96e3('0x72')](_0x96e3('0x73'),'tq')[_0x96e3('0x74')](_0x96e3('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x96e3('0x58')](_0x96e3('0x76'),_0x547e81[_0x96e3('0x4b')]['id']);for(var _0x53ccaa=0x0;_0x53ccaa<_0x36b6ea[_0x96e3('0x3e')];_0x53ccaa+=0x1){let _0x1a11f1=_0x36b6ea[_0x53ccaa];for(var _0x17983f=0x0;_0x17983f<_0x1a11f1[_0x96e3('0x69')]['length'];_0x17983f+=0x1){let _0x21fbbd=_0x1a11f1[_0x96e3('0x69')][_0x17983f];var _0x30d3d8=_0x10182b[_0x96e3('0x77')]();_0x30d3d8[_0x96e3('0x58')](_0x96e3('0x78'),_0x21fbbd['id']);_0x368a04['push'](db[_0x96e3('0x79')][_0x96e3('0x38')](_0x30d3d8['toString'](),{'type':db[_0x96e3('0x79')][_0x96e3('0x7a')][_0x96e3('0x7b')]})['then'](function(_0x45fb8a){if(_0x45fb8a[_0x96e3('0x3e')]===0x1){return _0x21fbbd['id'];}else{var _0x2e4b79=_[_0x96e3('0x7c')](_[_0x96e3('0x32')](_0x45fb8a,_0x96e3('0x7d')),function(_0x39cac6){return _[_0x96e3('0x7e')](_0x56dcf0,_0x39cac6);});if(_0x2e4b79){return _0x21fbbd['id'];}}}));}}return BPromise[_0x96e3('0x7f')](_0x368a04)['then'](function(_0x290d54){_0x27f5de=_(_0x27f5de)[_0x96e3('0x80')](_0x290d54)['compact']()[_0x96e3('0x81')]();return db[_0x96e3('0x33')][_0x96e3('0x4c')]({'where':{'id':_0x547e81['params']['id']}})[_0x96e3('0x28')](function(_0x5d8163){return db[_0x96e3('0x79')]['transaction'](function(_0x252467){return _0x5d8163[_0x96e3('0x70')](_0x547e81[_0x96e3('0x38')]['ids'],{'transaction':_0x252467})[_0x96e3('0x28')](function(){if(!_[_0x96e3('0x82')](_0x27f5de)){return _0x5d8163['removeAgents'](_0x27f5de,{'transaction':_0x252467});}})[_0x96e3('0x28')](function(){_0x27f5de[_0x96e3('0x6e')](function(_0x135616){socket[_0x96e3('0x83')]('userFaxQueue:remove',{'UserId':_0x135616,'FaxQueueId':_0x5d8163['id']});});});});});});})['then'](respondWithStatusCode(_0xe514ac,null))[_0x96e3('0x4a')](handleError(_0xe514ac,null));};exports['addAgents']=function(_0x5798b0,_0x284cd4,_0x439397){return db[_0x96e3('0x33')][_0x96e3('0x4c')]({'where':{'id':_0x5798b0[_0x96e3('0x4b')]['id']}})[_0x96e3('0x28')](handleEntityNotFound(_0x284cd4,null))[_0x96e3('0x28')](function(_0x5812e9){if(_0x5812e9){return _0x5812e9[_0x96e3('0x84')](_0x5798b0[_0x96e3('0x54')][_0x96e3('0x66')],_[_0x96e3('0x85')](_0x5798b0[_0x96e3('0x54')],[_0x96e3('0x66'),'id'])||{})[_0x96e3('0x86')](function(_0x409199){for(var _0x3459ff=0x0;_0x3459ff<_0x5798b0[_0x96e3('0x54')][_0x96e3('0x66')]['length'];_0x3459ff+=0x1){socket[_0x96e3('0x83')]('userFaxQueue:save',{'UserId':Number(_0x5798b0['body'][_0x96e3('0x66')][_0x3459ff]),'FaxQueueId':Number(_0x5798b0[_0x96e3('0x4b')]['id'])});}return _0x409199;});}})[_0x96e3('0x28')](respondWithResult(_0x284cd4,null))['catch'](handleError(_0x284cd4,null));};exports['removeAgents']=function(_0x3c8022,_0x24a877,_0x1b3b53){return db[_0x96e3('0x33')][_0x96e3('0x4c')]({'where':{'id':_0x3c8022[_0x96e3('0x4b')]['id']}})[_0x96e3('0x28')](handleEntityNotFound(_0x24a877,null))['then'](function(_0x49e9c4){if(_0x49e9c4){return _0x49e9c4['removeAgents'](_0x3c8022[_0x96e3('0x38')][_0x96e3('0x66')])[_0x96e3('0x28')](function(){if(_[_0x96e3('0x87')](_0x3c8022[_0x96e3('0x38')][_0x96e3('0x66')])){for(var _0x5327c2=0x0;_0x5327c2<_0x3c8022[_0x96e3('0x38')][_0x96e3('0x66')][_0x96e3('0x3e')];_0x5327c2+=0x1){socket[_0x96e3('0x83')](_0x96e3('0x88'),{'UserId':Number(_0x3c8022[_0x96e3('0x38')]['ids'][_0x5327c2]),'FaxQueueId':Number(_0x3c8022['params']['id'])});}}else{socket[_0x96e3('0x83')]('userFaxQueue:remove',{'UserId':Number(_0x3c8022[_0x96e3('0x38')][_0x96e3('0x66')]),'FaxQueueId':Number(_0x3c8022[_0x96e3('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x24a877,null))['catch'](handleError(_0x24a877,null));};exports[_0x96e3('0x89')]=function(_0x52a8cc,_0x2a4e39,_0x33dcdd){var _0x81bf48={};var _0x5184c0={};var _0x551e11;var _0x40904f;return db[_0x96e3('0x33')]['findOne']({'where':{'id':_0x52a8cc[_0x96e3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2a4e39,null))['then'](function(_0x40ce95){if(_0x40ce95){_0x551e11=_0x40ce95;_0x5184c0[_0x96e3('0x37')]=_[_0x96e3('0x39')](db[_0x96e3('0x5a')][_0x96e3('0x34')]);_0x5184c0['query']=_[_0x96e3('0x39')](_0x52a8cc[_0x96e3('0x38')]);_0x5184c0[_0x96e3('0x3a')]=_[_0x96e3('0x3b')](_0x5184c0[_0x96e3('0x37')],_0x5184c0['query']);_0x81bf48[_0x96e3('0x3c')]=_['intersection'](_0x5184c0[_0x96e3('0x37')],qs['fields'](_0x52a8cc[_0x96e3('0x38')][_0x96e3('0x3d')]));_0x81bf48['attributes']=_0x81bf48[_0x96e3('0x3c')]['length']?_0x81bf48[_0x96e3('0x3c')]:_0x5184c0[_0x96e3('0x37')];_0x81bf48[_0x96e3('0x40')]=qs[_0x96e3('0x41')](_0x52a8cc[_0x96e3('0x38')]['sort']);_0x81bf48[_0x96e3('0x58')]=qs[_0x96e3('0x3a')](_['pick'](_0x52a8cc[_0x96e3('0x38')],_0x5184c0['filters']));if(_0x52a8cc[_0x96e3('0x38')]['filter']){_0x81bf48[_0x96e3('0x58')]=_[_0x96e3('0x43')](_0x81bf48[_0x96e3('0x58')],{'$or':_['map'](_0x81bf48[_0x96e3('0x3c')],function(_0x43804c){var _0x174752={};_0x174752[_0x43804c]={'$like':'%'+_0x52a8cc[_0x96e3('0x38')][_0x96e3('0x44')]+'%'};return _0x174752;})});}_0x81bf48=_[_0x96e3('0x43')]({},_0x81bf48,_0x52a8cc[_0x96e3('0x45')]);return _0x551e11[_0x96e3('0x89')](_0x81bf48);}})[_0x96e3('0x28')](function(_0x1fe73b){if(_0x1fe73b){_0x40904f=_0x1fe73b[_0x96e3('0x3e')];if(!_0x52a8cc[_0x96e3('0x38')][_0x96e3('0x65')](_0x96e3('0x3f'))){_0x81bf48[_0x96e3('0x22')]=qs[_0x96e3('0x22')](_0x52a8cc[_0x96e3('0x38')][_0x96e3('0x22')]);_0x81bf48[_0x96e3('0x20')]=qs[_0x96e3('0x20')](_0x52a8cc['query'][_0x96e3('0x20')]);}return _0x551e11[_0x96e3('0x89')](_0x81bf48);}})['then'](function(_0x5c20cd){if(_0x5c20cd){return _0x5c20cd?{'count':_0x40904f,'rows':_0x5c20cd}:null;}})[_0x96e3('0x28')](respondWithResult(_0x2a4e39,null))[_0x96e3('0x4a')](handleError(_0x2a4e39,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index b475dbb..aacdd3c 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 _0x6220=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0xaf62c7,_0x5b8b14){var _0x477c6c=function(_0x50dbab){while(--_0x50dbab){_0xaf62c7['push'](_0xaf62c7['shift']());}};_0x477c6c(++_0x5b8b14);}(_0x6220,0xdb));var _0x0622=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6220[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x0622('0x0'));var FaxQueue=require(_0x0622('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0622('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0622('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2ab31a){return function(_0x4d80b3,_0x4e1837,_0x32d89f){FaxQueueEvents[_0x0622('0x4')](_0x2ab31a+':'+_0x4d80b3['id'],_0x4d80b3);FaxQueueEvents[_0x0622('0x4')](_0x2ab31a,_0x4d80b3);_0x32d89f(null);};}for(var e in events){if(events[_0x0622('0x5')](e)){var event=events[e];FaxQueue[_0x0622('0x6')](e,emitEvent(event));}}module[_0x0622('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xacf5=['emit','hasOwnProperty','hook','exports','../../mysqldb','update','remove'];(function(_0x1b9c07,_0x3ca2ba){var _0x5a438a=function(_0x4a501f){while(--_0x4a501f){_0x1b9c07['push'](_0x1b9c07['shift']());}};_0x5a438a(++_0x3ca2ba);}(_0xacf5,0x12a));var _0x5acf=function(_0xa223ad,_0x5a574b){_0xa223ad=_0xa223ad-0x0;var _0x306d47=_0xacf5[_0xa223ad];return _0x306d47;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x5acf('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5acf('0x1'),'afterDestroy':_0x5acf('0x2')};function emitEvent(_0x1ebdc2){return function(_0x23ebb7,_0x88e9b7,_0x1779e6){FaxQueueEvents[_0x5acf('0x3')](_0x1ebdc2+':'+_0x23ebb7['id'],_0x23ebb7);FaxQueueEvents[_0x5acf('0x3')](_0x1ebdc2,_0x23ebb7);_0x1779e6(null);};}for(var e in events){if(events[_0x5acf('0x4')](e)){var event=events[e];FaxQueue[_0x5acf('0x5')](e,emitEvent(event));}}module[_0x5acf('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 219eaf7..a9f88b7 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 _0x7b7b=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x7b7b,0x19f));var _0xb7b7=function(_0xff5df6,_0x514e73){_0xff5df6=_0xff5df6-0x0;var _0x2634bb=_0x7b7b[_0xff5df6];return _0x2634bb;};'use strict';var _=require(_0xb7b7('0x0'));var util=require(_0xb7b7('0x1'));var logger=require(_0xb7b7('0x2'))(_0xb7b7('0x3'));var moment=require(_0xb7b7('0x4'));var BPromise=require(_0xb7b7('0x5'));var rp=require(_0xb7b7('0x6'));var fs=require('fs');var path=require(_0xb7b7('0x7'));var rimraf=require(_0xb7b7('0x8'));var config=require(_0xb7b7('0x9'));var attributes=require(_0xb7b7('0xa'));module[_0xb7b7('0xb')]=function(_0x38f7a1,_0x2a3f44){return _0x38f7a1[_0xb7b7('0xc')](_0xb7b7('0xd'),attributes,{'tableName':_0xb7b7('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fe6=['fax_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x94c7ba,_0x40ae0d){var _0x3e1c67=function(_0x50a5b5){while(--_0x50a5b5){_0x94c7ba['push'](_0x94c7ba['shift']());}};_0x3e1c67(++_0x40ae0d);}(_0x0fe6,0x16d));var _0x60fe=function(_0x35a19f,_0x47842a){_0x35a19f=_0x35a19f-0x0;var _0x8c12cb=_0x0fe6[_0x35a19f];return _0x8c12cb;};'use strict';var _=require(_0x60fe('0x0'));var util=require(_0x60fe('0x1'));var logger=require('../../config/logger')(_0x60fe('0x2'));var moment=require(_0x60fe('0x3'));var BPromise=require(_0x60fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60fe('0x5'));var rimraf=require(_0x60fe('0x6'));var config=require(_0x60fe('0x7'));var attributes=require(_0x60fe('0x8'));module[_0x60fe('0x9')]=function(_0x27b49e,_0x24a051){return _0x27b49e[_0x60fe('0xa')](_0x60fe('0xb'),attributes,{'tableName':_0x60fe('0xc'),'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 5fd38b2..6672a32 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 _0x04e2=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','lodash'];(function(_0x21b413,_0x1ecb1b){var _0x309602=function(_0x35fdd7){while(--_0x35fdd7){_0x21b413['push'](_0x21b413['shift']());}};_0x309602(++_0x1ecb1b);}(_0x04e2,0xbd));var _0x204e=function(_0x2b5691,_0x5215c6){_0x2b5691=_0x2b5691-0x0;var _0x5c01d9=_0x04e2[_0x2b5691];return _0x5c01d9;};'use strict';var _=require(_0x204e('0x0'));var util=require(_0x204e('0x1'));var moment=require(_0x204e('0x2'));var BPromise=require('bluebird');var rs=require(_0x204e('0x3'));var fs=require('fs');var Redis=require(_0x204e('0x4'));var db=require(_0x204e('0x5'))['db'];var utils=require(_0x204e('0x6'));var logger=require(_0x204e('0x7'))(_0x204e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x204e('0x9')][_0x204e('0xa')]({'port':0x232a});config[_0x204e('0xb')]=_['defaults'](config[_0x204e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x204e('0xb')]));require(_0x204e('0xc'))[_0x204e('0xd')](socket);function respondWithRpcPromise(_0x2a6e10,_0x365b5d,_0x24e1c3){return new BPromise(function(_0x3d9937,_0x483150){return client[_0x204e('0xe')](_0x2a6e10,_0x24e1c3)[_0x204e('0xf')](function(_0x312681){logger[_0x204e('0x10')](_0x204e('0x11'),_0x365b5d,'request\x20sent');logger[_0x204e('0x12')](_0x204e('0x13'),_0x365b5d,_0x204e('0x14'),JSON[_0x204e('0x15')](_0x312681));if(_0x312681[_0x204e('0x16')]){if(_0x312681[_0x204e('0x16')][_0x204e('0x17')]===0x1f4){logger[_0x204e('0x16')](_0x204e('0x11'),_0x365b5d,_0x312681[_0x204e('0x16')][_0x204e('0x18')]);return _0x483150(_0x312681['error'][_0x204e('0x18')]);}logger[_0x204e('0x16')](_0x204e('0x11'),_0x365b5d,_0x312681[_0x204e('0x16')][_0x204e('0x18')]);return _0x3d9937(_0x312681[_0x204e('0x16')][_0x204e('0x18')]);}else{logger[_0x204e('0x10')](_0x204e('0x11'),_0x365b5d,'request\x20sent');_0x3d9937(_0x312681[_0x204e('0x19')]['message']);}})[_0x204e('0x1a')](function(_0x90a8ab){logger['error'](_0x204e('0x11'),_0x365b5d,_0x90a8ab);_0x483150(_0x90a8ab);});});}exports['GetFaxQueue']=function(_0xf50b54){var _0x30677c=this;return new Promise(function(_0x4093f3,_0x3e2311){return db[_0x204e('0x1b')][_0x204e('0x1c')]({'raw':_0xf50b54['options']?_0xf50b54[_0x204e('0x1d')][_0x204e('0x1e')]===undefined?!![]:![]:!![],'where':_0xf50b54[_0x204e('0x1d')]?_0xf50b54[_0x204e('0x1d')][_0x204e('0x1f')]||null:null,'attributes':_0xf50b54[_0x204e('0x1d')]?_0xf50b54[_0x204e('0x1d')][_0x204e('0x20')]||null:null,'limit':_0xf50b54['options']?_0xf50b54['options']['limit']||null:null,'include':_0xf50b54[_0x204e('0x1d')]?_0xf50b54[_0x204e('0x1d')][_0x204e('0x21')]?_[_0x204e('0x22')](_0xf50b54[_0x204e('0x1d')][_0x204e('0x21')],function(_0x2f5c16){return{'model':db[_0x2f5c16[_0x204e('0x23')]],'as':_0x2f5c16['as'],'attributes':_0x2f5c16[_0x204e('0x20')],'include':_0x2f5c16['include']?_[_0x204e('0x22')](_0x2f5c16[_0x204e('0x21')],function(_0x242317){return{'model':db[_0x242317[_0x204e('0x23')]],'as':_0x242317['as'],'attributes':_0x242317[_0x204e('0x20')],'include':_0x242317[_0x204e('0x21')]?_[_0x204e('0x22')](_0x242317[_0x204e('0x21')],function(_0x3bad86){return{'model':db[_0x3bad86['model']],'as':_0x3bad86['as'],'attributes':_0x3bad86['attributes']};}):[]};}):[]};}):[]:[]})[_0x204e('0xf')](function(_0x29f1f1){logger[_0x204e('0x10')](_0x204e('0x24'),_0xf50b54);logger[_0x204e('0x12')](_0x204e('0x24'),_0xf50b54,JSON[_0x204e('0x15')](_0x29f1f1));_0x4093f3(_0x29f1f1);})[_0x204e('0x1a')](function(_0x28906f){logger[_0x204e('0x16')](_0x204e('0x24'),_0x28906f[_0x204e('0x18')],_0xf50b54);_0x3e2311(_0x30677c['error'](0x1f4,_0x28906f[_0x204e('0x18')]));});});};exports[_0x204e('0x25')]=function(_0x5a7776){var _0x1986e7=this;return new Promise(function(_0x259e83,_0x1cf139){return db['FaxQueue']['find']({'raw':_0x5a7776['options']?_0x5a7776[_0x204e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5a7776[_0x204e('0x1d')]?_0x5a7776[_0x204e('0x1d')]['where']||null:null,'attributes':_0x5a7776['options']?_0x5a7776['options'][_0x204e('0x20')]||null:null,'include':_0x5a7776[_0x204e('0x1d')]?_0x5a7776[_0x204e('0x1d')][_0x204e('0x21')]?_['map'](_0x5a7776[_0x204e('0x1d')][_0x204e('0x21')],function(_0x291d7f){return{'model':db[_0x291d7f[_0x204e('0x23')]],'as':_0x291d7f['as'],'attributes':_0x291d7f[_0x204e('0x20')],'include':_0x291d7f[_0x204e('0x21')]?_[_0x204e('0x22')](_0x291d7f['include'],function(_0x20e86b){return{'model':db[_0x20e86b['model']],'as':_0x20e86b['as'],'attributes':_0x20e86b['attributes'],'include':_0x20e86b[_0x204e('0x21')]?_['map'](_0x20e86b['include'],function(_0x27b5f1){return{'model':db[_0x27b5f1[_0x204e('0x23')]],'as':_0x27b5f1['as'],'attributes':_0x27b5f1[_0x204e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x204e('0xf')](function(_0x2184f7){logger[_0x204e('0x10')]('ShowFaxQueue',_0x5a7776);logger['debug'](_0x204e('0x25'),_0x5a7776,JSON['stringify'](_0x2184f7));_0x259e83(_0x2184f7);})[_0x204e('0x1a')](function(_0x5e88c9){logger[_0x204e('0x16')]('ShowFaxQueue',_0x5e88c9[_0x204e('0x18')],_0x5a7776);_0x1cf139(_0x1986e7[_0x204e('0x16')](0x1f4,_0x5e88c9[_0x204e('0x18')]));});});}; \ No newline at end of file +var _0x991f=['GetFaxQueue','find','raw','where','map','ShowFaxQueue','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','FaxQueue','options','attributes','include','model'];(function(_0x54ef43,_0x308497){var _0x4e3816=function(_0x5147c6){while(--_0x5147c6){_0x54ef43['push'](_0x54ef43['shift']());}};_0x4e3816(++_0x308497);}(_0x991f,0x1c2));var _0xf991=function(_0xb5fa35,_0xa6aaea){_0xb5fa35=_0xb5fa35-0x0;var _0x5b8668=_0x991f[_0xb5fa35];return _0x5b8668;};'use strict';var _=require(_0xf991('0x0'));var util=require(_0xf991('0x1'));var moment=require(_0xf991('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf991('0x3'))['db'];var utils=require(_0xf991('0x4'));var logger=require(_0xf991('0x5'))(_0xf991('0x6'));var config=require('../../config/environment');var jayson=require(_0xf991('0x7'));var client=jayson[_0xf991('0x8')][_0xf991('0x9')]({'port':0x232a});config[_0xf991('0xa')]=_[_0xf991('0xb')](config[_0xf991('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf991('0xc'))(new Redis(config[_0xf991('0xa')]));require(_0xf991('0xd'))['register'](socket);function respondWithRpcPromise(_0x54deb0,_0xad01d,_0x4d7434){return new BPromise(function(_0x26e04d,_0x22e542){return client[_0xf991('0xe')](_0x54deb0,_0x4d7434)[_0xf991('0xf')](function(_0x4e5595){logger[_0xf991('0x10')]('FaxQueue,\x20%s,\x20%s',_0xad01d,_0xf991('0x11'));logger[_0xf991('0x12')](_0xf991('0x13'),_0xad01d,_0xf991('0x11'),JSON[_0xf991('0x14')](_0x4e5595));if(_0x4e5595[_0xf991('0x15')]){if(_0x4e5595[_0xf991('0x15')][_0xf991('0x16')]===0x1f4){logger[_0xf991('0x15')](_0xf991('0x17'),_0xad01d,_0x4e5595[_0xf991('0x15')]['message']);return _0x22e542(_0x4e5595[_0xf991('0x15')][_0xf991('0x18')]);}logger[_0xf991('0x15')](_0xf991('0x17'),_0xad01d,_0x4e5595[_0xf991('0x15')]['message']);return _0x26e04d(_0x4e5595[_0xf991('0x15')][_0xf991('0x18')]);}else{logger[_0xf991('0x10')](_0xf991('0x17'),_0xad01d,_0xf991('0x11'));_0x26e04d(_0x4e5595[_0xf991('0x19')]['message']);}})['catch'](function(_0x596d8f){logger[_0xf991('0x15')]('FaxQueue,\x20%s,\x20%s',_0xad01d,_0x596d8f);_0x22e542(_0x596d8f);});});}exports['GetFaxQueue']=function(_0x4252f8){var _0x5ef70d=this;return new Promise(function(_0x4481f3,_0x5a2a62){return db[_0xf991('0x1a')]['findAll']({'raw':_0x4252f8[_0xf991('0x1b')]?_0x4252f8[_0xf991('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4252f8[_0xf991('0x1b')]?_0x4252f8['options']['where']||null:null,'attributes':_0x4252f8[_0xf991('0x1b')]?_0x4252f8[_0xf991('0x1b')][_0xf991('0x1c')]||null:null,'limit':_0x4252f8[_0xf991('0x1b')]?_0x4252f8[_0xf991('0x1b')]['limit']||null:null,'include':_0x4252f8['options']?_0x4252f8[_0xf991('0x1b')][_0xf991('0x1d')]?_['map'](_0x4252f8[_0xf991('0x1b')][_0xf991('0x1d')],function(_0x5456b0){return{'model':db[_0x5456b0['model']],'as':_0x5456b0['as'],'attributes':_0x5456b0['attributes'],'include':_0x5456b0[_0xf991('0x1d')]?_['map'](_0x5456b0[_0xf991('0x1d')],function(_0x3df8b3){return{'model':db[_0x3df8b3[_0xf991('0x1e')]],'as':_0x3df8b3['as'],'attributes':_0x3df8b3[_0xf991('0x1c')],'include':_0x3df8b3[_0xf991('0x1d')]?_['map'](_0x3df8b3[_0xf991('0x1d')],function(_0x26d03c){return{'model':db[_0x26d03c[_0xf991('0x1e')]],'as':_0x26d03c['as'],'attributes':_0x26d03c[_0xf991('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf991('0xf')](function(_0x434b53){logger[_0xf991('0x10')]('GetFaxQueue',_0x4252f8);logger['debug']('GetFaxQueue',_0x4252f8,JSON['stringify'](_0x434b53));_0x4481f3(_0x434b53);})['catch'](function(_0x516c33){logger[_0xf991('0x15')](_0xf991('0x1f'),_0x516c33[_0xf991('0x18')],_0x4252f8);_0x5a2a62(_0x5ef70d[_0xf991('0x15')](0x1f4,_0x516c33[_0xf991('0x18')]));});});};exports['ShowFaxQueue']=function(_0x3fc804){var _0x25bbc2=this;return new Promise(function(_0x5bb8b7,_0x444c24){return db['FaxQueue'][_0xf991('0x20')]({'raw':_0x3fc804[_0xf991('0x1b')]?_0x3fc804[_0xf991('0x1b')][_0xf991('0x21')]===undefined?!![]:![]:!![],'where':_0x3fc804['options']?_0x3fc804[_0xf991('0x1b')][_0xf991('0x22')]||null:null,'attributes':_0x3fc804[_0xf991('0x1b')]?_0x3fc804[_0xf991('0x1b')][_0xf991('0x1c')]||null:null,'include':_0x3fc804[_0xf991('0x1b')]?_0x3fc804[_0xf991('0x1b')]['include']?_[_0xf991('0x23')](_0x3fc804[_0xf991('0x1b')][_0xf991('0x1d')],function(_0x1f079f){return{'model':db[_0x1f079f[_0xf991('0x1e')]],'as':_0x1f079f['as'],'attributes':_0x1f079f[_0xf991('0x1c')],'include':_0x1f079f[_0xf991('0x1d')]?_[_0xf991('0x23')](_0x1f079f[_0xf991('0x1d')],function(_0x40a37a){return{'model':db[_0x40a37a['model']],'as':_0x40a37a['as'],'attributes':_0x40a37a[_0xf991('0x1c')],'include':_0x40a37a['include']?_[_0xf991('0x23')](_0x40a37a[_0xf991('0x1d')],function(_0x818503){return{'model':db[_0x818503['model']],'as':_0x818503['as'],'attributes':_0x818503[_0xf991('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf991('0xf')](function(_0x784cf0){logger[_0xf991('0x10')](_0xf991('0x24'),_0x3fc804);logger[_0xf991('0x12')](_0xf991('0x24'),_0x3fc804,JSON[_0xf991('0x14')](_0x784cf0));_0x5bb8b7(_0x784cf0);})['catch'](function(_0x550f8d){logger['error'](_0xf991('0x24'),_0x550f8d[_0xf991('0x18')],_0x3fc804);_0x444c24(_0x25bbc2[_0xf991('0x15')](0x1f4,_0x550f8d[_0xf991('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 17ca25f..ac30f17 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 _0x4cd7=['length','faxQueue:','save','remove','update','removeListener','register'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x4cd7,0x1de));var _0x74cd=function(_0x111915,_0x341c81){_0x111915=_0x111915-0x0;var _0x85022c=_0x4cd7[_0x111915];return _0x85022c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x74cd('0x0'),_0x74cd('0x1'),_0x74cd('0x2')];function createListener(_0x3f1734,_0x63a4d7){return function(_0x20ae34){_0x63a4d7['emit'](_0x3f1734,_0x20ae34);};}function removeListener(_0x19fc70,_0x587b38){return function(){FaxQueueEvents[_0x74cd('0x3')](_0x19fc70,_0x587b38);};}exports[_0x74cd('0x4')]=function(_0x181907){for(var _0x26685a=0x0,_0x5c5f59=events[_0x74cd('0x5')];_0x26685a<_0x5c5f59;_0x26685a++){var _0x268134=events[_0x26685a];var _0x37edc4=createListener(_0x74cd('0x6')+_0x268134,_0x181907);FaxQueueEvents['on'](_0x268134,_0x37edc4);}}; \ No newline at end of file +var _0xc519=['register','remove'];(function(_0x5b876b,_0x347c4e){var _0x4c877f=function(_0x423ddc){while(--_0x423ddc){_0x5b876b['push'](_0x5b876b['shift']());}};_0x4c877f(++_0x347c4e);}(_0xc519,0x11b));var _0x9c51=function(_0x42c8dd,_0x3b00ed){_0x42c8dd=_0x42c8dd-0x0;var _0x488884=_0xc519[_0x42c8dd];return _0x488884;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x9c51('0x0'),'update'];function createListener(_0xf80980,_0x535fdb){return function(_0x479a21){_0x535fdb['emit'](_0xf80980,_0x479a21);};}function removeListener(_0x207fcb,_0x21ae78){return function(){FaxQueueEvents['removeListener'](_0x207fcb,_0x21ae78);};}exports[_0x9c51('0x1')]=function(_0x5805e5){for(var _0x2b7d07=0x0,_0x46a370=events['length'];_0x2b7d07<_0x46a370;_0x2b7d07++){var _0x2a1834=events[_0x2b7d07];var _0x1813aa=createListener('faxQueue:'+_0x2a1834,_0x5805e5);FaxQueueEvents['on'](_0x2a1834,_0x1813aa);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 763b387..c887f7b 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 _0xee3c=['./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xee3c,0x14a));var _0xcee3=function(_0x162964,_0x3e4b00){_0x162964=_0x162964-0x0;var _0x1758f1=_0xee3c[_0x162964];return _0x1758f1;};'use strict';var multer=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var path=require(_0xcee3('0x2'));var timeout=require(_0xcee3('0x3'));var express=require(_0xcee3('0x4'));var router=express[_0xcee3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var controller=require(_0xcee3('0x8'));router[_0xcee3('0x9')]('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0xb')]);router[_0xcee3('0x9')](_0xcee3('0xc'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xd')]);router[_0xcee3('0x9')](_0xcee3('0xe'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xf')]);router[_0xcee3('0x9')]('/:id/members',auth[_0xcee3('0xa')](),controller[_0xcee3('0x10')]);router[_0xcee3('0x9')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x12')]);router['get'](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x14')]);router[_0xcee3('0x15')]('/',auth[_0xcee3('0xa')](),controller['create']);router[_0xcee3('0x15')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xcee3('0x15')](_0xcee3('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xcee3('0x16')]('/:id',auth[_0xcee3('0xa')](),controller['update']);router[_0xcee3('0x17')](_0xcee3('0xe'),auth['isAuthenticated'](),controller[_0xcee3('0x18')]);router[_0xcee3('0x17')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller['removeTeams']);router[_0xcee3('0x17')](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x19')]);module['exports']=router; \ No newline at end of file +var _0x7278=['../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5995e3,_0x55c51a){var _0x3c76dd=function(_0x7f0479){while(--_0x7f0479){_0x5995e3['push'](_0x5995e3['shift']());}};_0x3c76dd(++_0x55c51a);}(_0x7278,0x161));var _0x8727=function(_0x381c87,_0x547edf){_0x381c87=_0x381c87-0x0;var _0xdd5e0b=_0x7278[_0x381c87];return _0xdd5e0b;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8727('0xa')](_0x8727('0xe'),auth[_0x8727('0xb')](),controller[_0x8727('0xf')]);router[_0x8727('0xa')](_0x8727('0x10'),auth[_0x8727('0xb')](),controller[_0x8727('0x11')]);router['get'](_0x8727('0x12'),auth[_0x8727('0xb')](),controller[_0x8727('0x13')]);router['post']('/',auth[_0x8727('0xb')](),controller[_0x8727('0x14')]);router['post'](_0x8727('0x10'),auth[_0x8727('0xb')](),controller[_0x8727('0x15')]);router[_0x8727('0x16')](_0x8727('0x12'),auth[_0x8727('0xb')](),controller[_0x8727('0x17')]);router[_0x8727('0x18')](_0x8727('0x19'),auth[_0x8727('0xb')](),controller['update']);router[_0x8727('0x1a')](_0x8727('0x19'),auth[_0x8727('0xb')](),controller[_0x8727('0x1b')]);router[_0x8727('0x1a')](_0x8727('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x8727('0x1a')]('/:id/users',auth[_0x8727('0xb')](),controller[_0x8727('0x1c')]);module[_0x8727('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 4665c30..4dd506b 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 _0x3b8e=['exports','STRING','DATE'];(function(_0x57076c,_0x1c75f1){var _0xde25df=function(_0x260773){while(--_0x260773){_0x57076c['push'](_0x57076c['shift']());}};_0xde25df(++_0x1c75f1);}(_0x3b8e,0x10b));var _0xe3b8=function(_0x6ec3c3,_0x5135e6){_0x6ec3c3=_0x6ec3c3-0x0;var _0x2416ce=_0x3b8e[_0x6ec3c3];return _0x2416ce;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe3b8('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe3b8('0x1')]},'joinAt':{'type':Sequelize[_0xe3b8('0x2')]},'leaveAt':{'type':Sequelize[_0xe3b8('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe3b8('0x1')]}}; \ No newline at end of file +var _0x7c74=['sequelize','STRING','DATE','moment'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0x7c74,0x11f));var _0x47c7=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7c74[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0x47c7('0x0'));var Sequelize=require(_0x47c7('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x47c7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x47c7('0x2')]},'joinAt':{'type':Sequelize[_0x47c7('0x3')]},'leaveAt':{'type':Sequelize[_0x47c7('0x3')]},'acceptAt':{'type':Sequelize[_0x47c7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 58628f9..57a3d9d 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 _0xbc8b=['api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x34c03b,_0x3a85c9){var _0x2e5517=function(_0x19f947){while(--_0x19f947){_0x34c03b['push'](_0x34c03b['shift']());}};_0x2e5517(++_0x3a85c9);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xbc8b[_0x2307fa];return _0x496486;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbc8('0x1'));var rp=require(_0xbbc8('0x2'));var moment=require(_0xbbc8('0x3'));var BPromise=require(_0xbbc8('0x4'));var Mustache=require(_0xbbc8('0x5'));var util=require(_0xbbc8('0x6'));var path=require('path');var sox=require(_0xbbc8('0x7'));var csv=require(_0xbbc8('0x8'));var ejs=require(_0xbbc8('0x9'));var fs=require('fs');var fs_extra=require(_0xbbc8('0xa'));var _=require(_0xbbc8('0xb'));var squel=require('squel');var crypto=require(_0xbbc8('0xc'));var jsforce=require(_0xbbc8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbbc8('0x8'));var querystring=require(_0xbbc8('0xe'));var Papa=require(_0xbbc8('0xf'));var Redis=require(_0xbbc8('0x10'));var authService=require(_0xbbc8('0x11'));var qs=require(_0xbbc8('0x12'));var as=require(_0xbbc8('0x13'));var hardwareService=require(_0xbbc8('0x14'));var logger=require(_0xbbc8('0x15'))(_0xbbc8('0x16'));var utils=require(_0xbbc8('0x17'));var config=require(_0xbbc8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbc8('0x19'))['db'];function respondWithStatusCode(_0xc702ca,_0x1c4b00){_0x1c4b00=_0x1c4b00||0xcc;return function(_0x55b386){if(_0x55b386){return _0xc702ca['sendStatus'](_0x1c4b00);}return _0xc702ca[_0xbbc8('0x1a')](_0x1c4b00)['end']();};}function respondWithResult(_0x290045,_0x2add43){_0x2add43=_0x2add43||0xc8;return function(_0x1c76df){if(_0x1c76df){return _0x290045[_0xbbc8('0x1a')](_0x2add43)[_0xbbc8('0x1b')](_0x1c76df);}};}function respondWithFilteredResult(_0x1e9c27,_0x292cc2){return function(_0x1cd58e){if(_0x1cd58e){var _0x38bf2f=typeof _0x292cc2[_0xbbc8('0x1c')]===_0xbbc8('0x1d')&&typeof _0x292cc2[_0xbbc8('0x1e')]===_0xbbc8('0x1d');var _0x21a44b=_0x1cd58e['count'];var _0xc9a328=_0x38bf2f?0x0:_0x292cc2[_0xbbc8('0x1c')];var _0x38e642=_0x38bf2f?_0x1cd58e[_0xbbc8('0x1f')]:_0x292cc2['offset']+_0x292cc2[_0xbbc8('0x1e')];var _0x4f754f;if(_0x38e642>=_0x21a44b){_0x38e642=_0x21a44b;_0x4f754f=0xc8;}else{_0x4f754f=0xce;}_0x1e9c27[_0xbbc8('0x1a')](_0x4f754f);return _0x1e9c27[_0xbbc8('0x20')]('Content-Range',_0xc9a328+'-'+_0x38e642+'/'+_0x21a44b)[_0xbbc8('0x1b')](_0x1cd58e);}return null;};}function patchUpdates(_0x1f7576){return function(_0x14b069){try{jsonpatch[_0xbbc8('0x21')](_0x14b069,_0x1f7576,!![]);}catch(_0x1ec180){return BPromise[_0xbbc8('0x22')](_0x1ec180);}return _0x14b069[_0xbbc8('0x23')]();};}function saveUpdates(_0x58d198,_0x14af5b){return function(_0x5a1e00){if(_0x5a1e00){return _0x5a1e00[_0xbbc8('0x24')](_0x58d198)[_0xbbc8('0x25')](function(_0x3f22f2){return _0x3f22f2;});}return null;};}function removeEntity(_0x37acb1,_0x354312){return function(_0x521c11){if(_0x521c11){return _0x521c11[_0xbbc8('0x26')]()[_0xbbc8('0x25')](function(){_0x37acb1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fba6e,_0x2ee2dd){return function(_0x31fc9b){if(!_0x31fc9b){_0x4fba6e[_0xbbc8('0x27')](0x194);}return _0x31fc9b;};}function handleError(_0x11bdd5,_0x1a0129){_0x1a0129=_0x1a0129||0x1f4;return function(_0x15fd05){logger[_0xbbc8('0x28')](_0x15fd05[_0xbbc8('0x29')]);if(_0x15fd05['name']){delete _0x15fd05[_0xbbc8('0x2a')];}_0x11bdd5[_0xbbc8('0x1a')](_0x1a0129)[_0xbbc8('0x2b')](_0x15fd05);};}exports['index']=function(_0x186572,_0x239e64){var _0x4b0e0c={},_0x130758={},_0x56ce6b={'count':0x0,'rows':[]};var _0x57cc7e=_[_0xbbc8('0x2c')](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')],function(_0x4308eb){return{'name':_0x4308eb[_0xbbc8('0x2f')],'type':_0x4308eb[_0xbbc8('0x30')]['key']};});_0x130758['model']=_[_0xbbc8('0x2c')](_0x57cc7e,_0xbbc8('0x2a'));_0x130758[_0xbbc8('0x31')]=_['keys'](_0x186572[_0xbbc8('0x31')]);_0x130758[_0xbbc8('0x32')]=_[_0xbbc8('0x33')](_0x130758[_0xbbc8('0x34')],_0x130758[_0xbbc8('0x31')]);_0x4b0e0c[_0xbbc8('0x35')]=_[_0xbbc8('0x33')](_0x130758[_0xbbc8('0x34')],qs[_0xbbc8('0x36')](_0x186572[_0xbbc8('0x31')][_0xbbc8('0x36')]));_0x4b0e0c['attributes']=_0x4b0e0c[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x4b0e0c[_0xbbc8('0x35')]:_0x130758[_0xbbc8('0x34')];if(!_0x186572[_0xbbc8('0x31')][_0xbbc8('0x38')](_0xbbc8('0x39'))){_0x4b0e0c[_0xbbc8('0x1e')]=qs[_0xbbc8('0x1e')](_0x186572[_0xbbc8('0x31')]['limit']);_0x4b0e0c[_0xbbc8('0x1c')]=qs[_0xbbc8('0x1c')](_0x186572[_0xbbc8('0x31')][_0xbbc8('0x1c')]);}_0x4b0e0c[_0xbbc8('0x3a')]=qs[_0xbbc8('0x3b')](_0x186572['query'][_0xbbc8('0x3b')]);_0x4b0e0c[_0xbbc8('0x3c')]=qs[_0xbbc8('0x32')](_[_0xbbc8('0x3d')](_0x186572['query'],_0x130758[_0xbbc8('0x32')]),_0x57cc7e);if(_0x186572[_0xbbc8('0x31')][_0xbbc8('0x3e')]){_0x4b0e0c[_0xbbc8('0x3c')]=_[_0xbbc8('0x3f')](_0x4b0e0c['where'],{'$or':_[_0xbbc8('0x2c')](_0x57cc7e,function(_0x39babd){if(_0x39babd[_0xbbc8('0x30')]!==_0xbbc8('0x40')){var _0x479e73={};_0x479e73[_0x39babd['name']]={'$like':'%'+_0x186572[_0xbbc8('0x31')]['filter']+'%'};return _0x479e73;}})});}_0x4b0e0c=_[_0xbbc8('0x3f')]({},_0x4b0e0c,_0x186572[_0xbbc8('0x41')]);var _0x14b16c={'where':_0x4b0e0c['where']};return db[_0xbbc8('0x2d')]['count'](_0x14b16c)['then'](function(_0xec130){_0x56ce6b[_0xbbc8('0x1f')]=_0xec130;if(_0x186572['query'][_0xbbc8('0x42')]){_0x4b0e0c[_0xbbc8('0x43')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xbbc8('0x44')](_0x4b0e0c);})[_0xbbc8('0x25')](function(_0x10114e){_0x56ce6b['rows']=_0x10114e;return _0x56ce6b;})[_0xbbc8('0x25')](respondWithFilteredResult(_0x239e64,_0x4b0e0c))[_0xbbc8('0x45')](handleError(_0x239e64,null));};exports[_0xbbc8('0x46')]=function(_0x4852a4,_0x3e7e54){var _0x1dfbce={'raw':!![],'where':{'id':_0x4852a4[_0xbbc8('0x47')]['id']}},_0x3dd5f6={};_0x3dd5f6[_0xbbc8('0x34')]=_[_0xbbc8('0x48')](db['FaxQueueReport'][_0xbbc8('0x2e')]);_0x3dd5f6[_0xbbc8('0x31')]=_['keys'](_0x4852a4[_0xbbc8('0x31')]);_0x3dd5f6[_0xbbc8('0x32')]=_[_0xbbc8('0x33')](_0x3dd5f6['model'],_0x3dd5f6[_0xbbc8('0x31')]);_0x1dfbce[_0xbbc8('0x35')]=_[_0xbbc8('0x33')](_0x3dd5f6['model'],qs[_0xbbc8('0x36')](_0x4852a4['query'][_0xbbc8('0x36')]));_0x1dfbce[_0xbbc8('0x35')]=_0x1dfbce[_0xbbc8('0x35')]['length']?_0x1dfbce[_0xbbc8('0x35')]:_0x3dd5f6[_0xbbc8('0x34')];if(_0x4852a4[_0xbbc8('0x31')]['includeAll']){_0x1dfbce[_0xbbc8('0x43')]=[{'all':!![]}];}_0x1dfbce=_[_0xbbc8('0x3f')]({},_0x1dfbce,_0x4852a4[_0xbbc8('0x41')]);return db[_0xbbc8('0x2d')][_0xbbc8('0x49')](_0x1dfbce)['then'](handleEntityNotFound(_0x3e7e54,null))[_0xbbc8('0x25')](respondWithResult(_0x3e7e54,null))['catch'](handleError(_0x3e7e54,null));};exports[_0xbbc8('0x4a')]=function(_0x2a961f,_0x528b53){return db['FaxQueueReport'][_0xbbc8('0x4a')](_0x2a961f['body'],{})[_0xbbc8('0x25')](respondWithResult(_0x528b53,0xc9))[_0xbbc8('0x45')](handleError(_0x528b53,null));};exports[_0xbbc8('0x24')]=function(_0x36ad4c,_0x387dbf){if(_0x36ad4c[_0xbbc8('0x4b')]['id']){delete _0x36ad4c[_0xbbc8('0x4b')]['id'];}return db['FaxQueueReport'][_0xbbc8('0x49')]({'where':{'id':_0x36ad4c[_0xbbc8('0x47')]['id']}})['then'](handleEntityNotFound(_0x387dbf,null))['then'](saveUpdates(_0x36ad4c[_0xbbc8('0x4b')],null))['then'](respondWithResult(_0x387dbf,null))[_0xbbc8('0x45')](handleError(_0x387dbf,null));};exports[_0xbbc8('0x26')]=function(_0xe3f94f,_0x45262e){return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0xe3f94f[_0xbbc8('0x47')]['id']}})[_0xbbc8('0x25')](handleEntityNotFound(_0x45262e,null))[_0xbbc8('0x25')](removeEntity(_0x45262e,null))[_0xbbc8('0x45')](handleError(_0x45262e,null));};exports[_0xbbc8('0x4c')]=function(_0x4a52da,_0x44510b){return db[_0xbbc8('0x2d')][_0xbbc8('0x4c')]()[_0xbbc8('0x25')](respondWithResult(_0x44510b,null))[_0xbbc8('0x45')](handleError(_0x44510b,null));}; \ No newline at end of file +var _0x2392=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','error','stack','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2392,0xd0));var _0x2239=function(_0x4eecbd,_0x353e93){_0x4eecbd=_0x4eecbd-0x0;var _0x3806d3=_0x2392[_0x4eecbd];return _0x3806d3;};'use strict';var emlformat=require(_0x2239('0x0'));var rimraf=require(_0x2239('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2239('0x2'));var rp=require(_0x2239('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2239('0x4'));var util=require(_0x2239('0x5'));var path=require(_0x2239('0x6'));var sox=require(_0x2239('0x7'));var csv=require(_0x2239('0x8'));var ejs=require(_0x2239('0x9'));var fs=require('fs');var fs_extra=require(_0x2239('0xa'));var _=require(_0x2239('0xb'));var squel=require(_0x2239('0xc'));var crypto=require(_0x2239('0xd'));var jsforce=require(_0x2239('0xe'));var deskjs=require(_0x2239('0xf'));var toCsv=require(_0x2239('0x8'));var querystring=require('querystring');var Papa=require(_0x2239('0x10'));var Redis=require(_0x2239('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2239('0x12'));var hardwareService=require(_0x2239('0x13'));var logger=require(_0x2239('0x14'))(_0x2239('0x15'));var utils=require(_0x2239('0x16'));var config=require(_0x2239('0x17'));var licenseUtil=require(_0x2239('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4702dd,_0x3cee95){_0x3cee95=_0x3cee95||0xcc;return function(_0x4af7b7){if(_0x4af7b7){return _0x4702dd[_0x2239('0x19')](_0x3cee95);}return _0x4702dd[_0x2239('0x1a')](_0x3cee95)[_0x2239('0x1b')]();};}function respondWithResult(_0x3338b0,_0x5165dc){_0x5165dc=_0x5165dc||0xc8;return function(_0x367c82){if(_0x367c82){return _0x3338b0['status'](_0x5165dc)[_0x2239('0x1c')](_0x367c82);}};}function respondWithFilteredResult(_0x163e09,_0x4236da){return function(_0x472ce2){if(_0x472ce2){var _0x4f23ce=typeof _0x4236da[_0x2239('0x1d')]===_0x2239('0x1e')&&typeof _0x4236da['limit']===_0x2239('0x1e');var _0x4f218a=_0x472ce2[_0x2239('0x1f')];var _0x558138=_0x4f23ce?0x0:_0x4236da[_0x2239('0x1d')];var _0x594f20=_0x4f23ce?_0x472ce2[_0x2239('0x1f')]:_0x4236da[_0x2239('0x1d')]+_0x4236da[_0x2239('0x20')];var _0x3d8fd9;if(_0x594f20>=_0x4f218a){_0x594f20=_0x4f218a;_0x3d8fd9=0xc8;}else{_0x3d8fd9=0xce;}_0x163e09['status'](_0x3d8fd9);return _0x163e09[_0x2239('0x21')]('Content-Range',_0x558138+'-'+_0x594f20+'/'+_0x4f218a)[_0x2239('0x1c')](_0x472ce2);}return null;};}function patchUpdates(_0x4917cb){return function(_0x174bf7){try{jsonpatch[_0x2239('0x22')](_0x174bf7,_0x4917cb,!![]);}catch(_0x2c2d74){return BPromise['reject'](_0x2c2d74);}return _0x174bf7['save']();};}function saveUpdates(_0x2b2000,_0x521079){return function(_0x2f625d){if(_0x2f625d){return _0x2f625d[_0x2239('0x23')](_0x2b2000)[_0x2239('0x24')](function(_0x407581){return _0x407581;});}return null;};}function removeEntity(_0x54af84,_0x1f1f49){return function(_0x12133e){if(_0x12133e){return _0x12133e[_0x2239('0x25')]()[_0x2239('0x24')](function(){_0x54af84['status'](0xcc)[_0x2239('0x1b')]();});}};}function handleEntityNotFound(_0x44e671,_0x18ae1b){return function(_0x48b8dd){if(!_0x48b8dd){_0x44e671[_0x2239('0x19')](0x194);}return _0x48b8dd;};}function handleError(_0x3c809e,_0x5bd318){_0x5bd318=_0x5bd318||0x1f4;return function(_0x1c179e){logger[_0x2239('0x26')](_0x1c179e[_0x2239('0x27')]);if(_0x1c179e[_0x2239('0x28')]){delete _0x1c179e['name'];}_0x3c809e['status'](_0x5bd318)['send'](_0x1c179e);};}exports['index']=function(_0x576ac9,_0x3b94e6){var _0x1ba5ad={},_0x2a60b1={},_0x454645={'count':0x0,'rows':[]};var _0x56fc3f=_[_0x2239('0x29')](db[_0x2239('0x2a')][_0x2239('0x2b')],function(_0x23fab8){return{'name':_0x23fab8[_0x2239('0x2c')],'type':_0x23fab8[_0x2239('0x2d')][_0x2239('0x2e')]};});_0x2a60b1['model']=_[_0x2239('0x29')](_0x56fc3f,_0x2239('0x28'));_0x2a60b1[_0x2239('0x2f')]=_[_0x2239('0x30')](_0x576ac9[_0x2239('0x2f')]);_0x2a60b1['filters']=_[_0x2239('0x31')](_0x2a60b1[_0x2239('0x32')],_0x2a60b1['query']);_0x1ba5ad['attributes']=_['intersection'](_0x2a60b1['model'],qs['fields'](_0x576ac9[_0x2239('0x2f')][_0x2239('0x33')]));_0x1ba5ad[_0x2239('0x34')]=_0x1ba5ad[_0x2239('0x34')][_0x2239('0x35')]?_0x1ba5ad['attributes']:_0x2a60b1[_0x2239('0x32')];if(!_0x576ac9[_0x2239('0x2f')][_0x2239('0x36')]('nolimit')){_0x1ba5ad[_0x2239('0x20')]=qs[_0x2239('0x20')](_0x576ac9[_0x2239('0x2f')]['limit']);_0x1ba5ad['offset']=qs['offset'](_0x576ac9[_0x2239('0x2f')][_0x2239('0x1d')]);}_0x1ba5ad[_0x2239('0x37')]=qs['sort'](_0x576ac9['query'][_0x2239('0x38')]);_0x1ba5ad['where']=qs[_0x2239('0x39')](_[_0x2239('0x3a')](_0x576ac9[_0x2239('0x2f')],_0x2a60b1[_0x2239('0x39')]),_0x56fc3f);if(_0x576ac9['query'][_0x2239('0x3b')]){_0x1ba5ad[_0x2239('0x3c')]=_[_0x2239('0x3d')](_0x1ba5ad[_0x2239('0x3c')],{'$or':_[_0x2239('0x29')](_0x56fc3f,function(_0x4169d6){if(_0x4169d6[_0x2239('0x2d')]!==_0x2239('0x3e')){var _0x5d8a2f={};_0x5d8a2f[_0x4169d6[_0x2239('0x28')]]={'$like':'%'+_0x576ac9[_0x2239('0x2f')][_0x2239('0x3b')]+'%'};return _0x5d8a2f;}})});}_0x1ba5ad=_[_0x2239('0x3d')]({},_0x1ba5ad,_0x576ac9[_0x2239('0x3f')]);var _0x1c112d={'where':_0x1ba5ad[_0x2239('0x3c')]};return db[_0x2239('0x2a')][_0x2239('0x1f')](_0x1c112d)[_0x2239('0x24')](function(_0x5b59ac){_0x454645[_0x2239('0x1f')]=_0x5b59ac;if(_0x576ac9[_0x2239('0x2f')][_0x2239('0x40')]){_0x1ba5ad[_0x2239('0x41')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x1ba5ad);})[_0x2239('0x24')](function(_0x546862){_0x454645[_0x2239('0x42')]=_0x546862;return _0x454645;})['then'](respondWithFilteredResult(_0x3b94e6,_0x1ba5ad))[_0x2239('0x43')](handleError(_0x3b94e6,null));};exports[_0x2239('0x44')]=function(_0x5f4dee,_0x5b0021){var _0x51729d={'raw':!![],'where':{'id':_0x5f4dee['params']['id']}},_0x4242c2={};_0x4242c2[_0x2239('0x32')]=_[_0x2239('0x30')](db['FaxQueueReport'][_0x2239('0x2b')]);_0x4242c2[_0x2239('0x2f')]=_[_0x2239('0x30')](_0x5f4dee[_0x2239('0x2f')]);_0x4242c2[_0x2239('0x39')]=_[_0x2239('0x31')](_0x4242c2[_0x2239('0x32')],_0x4242c2[_0x2239('0x2f')]);_0x51729d[_0x2239('0x34')]=_['intersection'](_0x4242c2[_0x2239('0x32')],qs['fields'](_0x5f4dee[_0x2239('0x2f')]['fields']));_0x51729d[_0x2239('0x34')]=_0x51729d[_0x2239('0x34')]['length']?_0x51729d[_0x2239('0x34')]:_0x4242c2['model'];if(_0x5f4dee[_0x2239('0x2f')][_0x2239('0x40')]){_0x51729d[_0x2239('0x41')]=[{'all':!![]}];}_0x51729d=_['merge']({},_0x51729d,_0x5f4dee['options']);return db['FaxQueueReport'][_0x2239('0x45')](_0x51729d)[_0x2239('0x24')](handleEntityNotFound(_0x5b0021,null))[_0x2239('0x24')](respondWithResult(_0x5b0021,null))[_0x2239('0x43')](handleError(_0x5b0021,null));};exports[_0x2239('0x46')]=function(_0x1d6d11,_0x4f6beb){return db[_0x2239('0x2a')][_0x2239('0x46')](_0x1d6d11[_0x2239('0x47')],{})['then'](respondWithResult(_0x4f6beb,0xc9))[_0x2239('0x43')](handleError(_0x4f6beb,null));};exports['update']=function(_0x4a9c3c,_0x410bc6){if(_0x4a9c3c[_0x2239('0x47')]['id']){delete _0x4a9c3c[_0x2239('0x47')]['id'];}return db[_0x2239('0x2a')][_0x2239('0x45')]({'where':{'id':_0x4a9c3c['params']['id']}})[_0x2239('0x24')](handleEntityNotFound(_0x410bc6,null))[_0x2239('0x24')](saveUpdates(_0x4a9c3c['body'],null))['then'](respondWithResult(_0x410bc6,null))['catch'](handleError(_0x410bc6,null));};exports[_0x2239('0x25')]=function(_0x51f5d3,_0x2b5bbb){return db['FaxQueueReport'][_0x2239('0x45')]({'where':{'id':_0x51f5d3[_0x2239('0x48')]['id']}})[_0x2239('0x24')](handleEntityNotFound(_0x2b5bbb,null))[_0x2239('0x24')](removeEntity(_0x2b5bbb,null))['catch'](handleError(_0x2b5bbb,null));};exports['describe']=function(_0x911e3c,_0x287aac){return db[_0x2239('0x2a')][_0x2239('0x49')]()[_0x2239('0x24')](respondWithResult(_0x287aac,null))['catch'](handleError(_0x287aac,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d721a5a..7cae1bb 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x4507c2,_0x5d394b){var _0xc37251=function(_0x4af3bf){while(--_0x4af3bf){_0x4507c2['push'](_0x4507c2['shift']());}};_0xc37251(++_0x5d394b);}(_0x326f,0xd1));var _0xf326=function(_0x56d476,_0x1b33f8){_0x56d476=_0x56d476-0x0;var _0x59ce94=_0x326f[_0x56d476];return _0x59ce94;};'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 +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x3729f9,_0x2a9e81){var _0x52dcde=function(_0xfc4aa3){while(--_0xfc4aa3){_0x3729f9['push'](_0x3729f9['shift']());}};_0x52dcde(++_0x2a9e81);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8174f0e..a9bdec5 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 _0x1d92=['UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','CreateFaxQueueReport','create','body','options','raw'];(function(_0x34f4ee,_0x48ceec){var _0x4bd432=function(_0x451f09){while(--_0x451f09){_0x34f4ee['push'](_0x34f4ee['shift']());}};_0x4bd432(++_0x48ceec);}(_0x1d92,0x10e));var _0x21d9=function(_0x5c918d,_0x1ca4a7){_0x5c918d=_0x5c918d-0x0;var _0x3c4d98=_0x1d92[_0x5c918d];return _0x3c4d98;};'use strict';var _=require(_0x21d9('0x0'));var util=require('util');var moment=require(_0x21d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x21d9('0x2'));var fs=require('fs');var Redis=require(_0x21d9('0x3'));var db=require(_0x21d9('0x4'))['db'];var utils=require(_0x21d9('0x5'));var logger=require(_0x21d9('0x6'))(_0x21d9('0x7'));var config=require(_0x21d9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21d9('0x9')][_0x21d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f028,_0x324eca,_0x486347){return new BPromise(function(_0x517942,_0x422c72){return client[_0x21d9('0xb')](_0x24f028,_0x486347)[_0x21d9('0xc')](function(_0x2b834f){logger[_0x21d9('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x324eca,_0x21d9('0xe'));logger[_0x21d9('0xf')](_0x21d9('0x10'),_0x324eca,'request\x20sent',JSON[_0x21d9('0x11')](_0x2b834f));if(_0x2b834f[_0x21d9('0x12')]){if(_0x2b834f[_0x21d9('0x12')][_0x21d9('0x13')]===0x1f4){logger[_0x21d9('0x12')](_0x21d9('0x14'),_0x324eca,_0x2b834f[_0x21d9('0x12')][_0x21d9('0x15')]);return _0x422c72(_0x2b834f[_0x21d9('0x12')][_0x21d9('0x15')]);}logger[_0x21d9('0x12')](_0x21d9('0x14'),_0x324eca,_0x2b834f[_0x21d9('0x12')][_0x21d9('0x15')]);return _0x517942(_0x2b834f[_0x21d9('0x12')][_0x21d9('0x15')]);}else{logger[_0x21d9('0xd')](_0x21d9('0x14'),_0x324eca,_0x21d9('0xe'));_0x517942(_0x2b834f['result']['message']);}})['catch'](function(_0x19522a){logger['error'](_0x21d9('0x14'),_0x324eca,_0x19522a);_0x422c72(_0x19522a);});});}exports[_0x21d9('0x16')]=function(_0x257ba7){var _0x5a39f5=this;return new Promise(function(_0x42bfb8,_0x1cd0d7){return db['FaxQueueReport'][_0x21d9('0x17')](_0x257ba7[_0x21d9('0x18')],{'raw':_0x257ba7['options']?_0x257ba7[_0x21d9('0x19')][_0x21d9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2cb143){logger[_0x21d9('0xd')]('CreateFaxQueueReport',_0x257ba7);logger['debug'](_0x21d9('0x16'),_0x257ba7,JSON['stringify'](_0x2cb143));_0x42bfb8(_0x2cb143);})['catch'](function(_0x346ffa){logger[_0x21d9('0x12')](_0x21d9('0x16'),_0x346ffa[_0x21d9('0x15')],_0x257ba7);_0x1cd0d7(_0x5a39f5[_0x21d9('0x12')](0x1f4,_0x346ffa[_0x21d9('0x15')]));});});};exports[_0x21d9('0x1b')]=function(_0x3f2963){var _0x361ac7=this;return new Promise(function(_0x3c57e5,_0x12629a){return db[_0x21d9('0x1c')][_0x21d9('0x1d')](_0x3f2963['body'],{'raw':_0x3f2963[_0x21d9('0x19')]?_0x3f2963[_0x21d9('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f2963[_0x21d9('0x19')]?_0x3f2963['options'][_0x21d9('0x1e')]||null:null,'attributes':_0x3f2963['options']?_0x3f2963[_0x21d9('0x19')][_0x21d9('0x1f')]||null:null,'limit':_0x3f2963[_0x21d9('0x19')]?_0x3f2963[_0x21d9('0x19')]['limit']||null:null})[_0x21d9('0xc')](function(_0x2defaa){logger[_0x21d9('0xd')](_0x21d9('0x1b'),_0x3f2963);logger[_0x21d9('0xf')](_0x21d9('0x1b'),_0x3f2963,JSON[_0x21d9('0x11')](_0x2defaa));_0x3c57e5(_0x2defaa);})[_0x21d9('0x20')](function(_0x11d133){logger[_0x21d9('0x12')]('UpdateFaxQueueReport',_0x11d133[_0x21d9('0x15')],_0x3f2963);_0x12629a(_0x361ac7[_0x21d9('0x12')](0x1f4,_0x11d133[_0x21d9('0x15')]));});});}; \ No newline at end of file +var _0xce42=['stringify','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','debug','UpdateFaxQueueReport','update','where','attributes','limit'];(function(_0x322652,_0x5a85c0){var _0x5d5e88=function(_0x5ce853){while(--_0x5ce853){_0x322652['push'](_0x322652['shift']());}};_0x5d5e88(++_0x5a85c0);}(_0xce42,0x12a));var _0x2ce4=function(_0x449b81,_0x4b2a6f){_0x449b81=_0x449b81-0x0;var _0xb9b60c=_0xce42[_0x449b81];return _0xb9b60c;};'use strict';var _=require(_0x2ce4('0x0'));var util=require(_0x2ce4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2ce4('0x2'));var fs=require('fs');var Redis=require(_0x2ce4('0x3'));var db=require(_0x2ce4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2ce4('0x5'));var config=require(_0x2ce4('0x6'));var jayson=require(_0x2ce4('0x7'));var client=jayson[_0x2ce4('0x8')][_0x2ce4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aa602,_0x3a47a3,_0x1f8958){return new BPromise(function(_0x3b8b5f,_0x35bbed){return client[_0x2ce4('0xa')](_0x2aa602,_0x1f8958)[_0x2ce4('0xb')](function(_0x12e391){logger[_0x2ce4('0xc')](_0x2ce4('0xd'),_0x3a47a3,_0x2ce4('0xe'));logger['debug'](_0x2ce4('0xf'),_0x3a47a3,'request\x20sent',JSON['stringify'](_0x12e391));if(_0x12e391[_0x2ce4('0x10')]){if(_0x12e391[_0x2ce4('0x10')]['code']===0x1f4){logger['error'](_0x2ce4('0xd'),_0x3a47a3,_0x12e391[_0x2ce4('0x10')][_0x2ce4('0x11')]);return _0x35bbed(_0x12e391['error'][_0x2ce4('0x11')]);}logger[_0x2ce4('0x10')](_0x2ce4('0xd'),_0x3a47a3,_0x12e391['error'][_0x2ce4('0x11')]);return _0x3b8b5f(_0x12e391[_0x2ce4('0x10')][_0x2ce4('0x11')]);}else{logger[_0x2ce4('0xc')](_0x2ce4('0xd'),_0x3a47a3,'request\x20sent');_0x3b8b5f(_0x12e391[_0x2ce4('0x12')][_0x2ce4('0x11')]);}})[_0x2ce4('0x13')](function(_0x34bd46){logger[_0x2ce4('0x10')](_0x2ce4('0xd'),_0x3a47a3,_0x34bd46);_0x35bbed(_0x34bd46);});});}exports['CreateFaxQueueReport']=function(_0x3140ca){var _0xdd04ad=this;return new Promise(function(_0x4f238e,_0x561384){return db[_0x2ce4('0x14')][_0x2ce4('0x15')](_0x3140ca[_0x2ce4('0x16')],{'raw':_0x3140ca[_0x2ce4('0x17')]?_0x3140ca[_0x2ce4('0x17')][_0x2ce4('0x18')]===undefined?!![]:![]:!![]})[_0x2ce4('0xb')](function(_0xe61288){logger[_0x2ce4('0xc')](_0x2ce4('0x19'),_0x3140ca);logger[_0x2ce4('0x1a')](_0x2ce4('0x19'),_0x3140ca,JSON['stringify'](_0xe61288));_0x4f238e(_0xe61288);})[_0x2ce4('0x13')](function(_0x496609){logger[_0x2ce4('0x10')](_0x2ce4('0x19'),_0x496609[_0x2ce4('0x11')],_0x3140ca);_0x561384(_0xdd04ad['error'](0x1f4,_0x496609['message']));});});};exports[_0x2ce4('0x1b')]=function(_0x13e527){var _0x26f86e=this;return new Promise(function(_0x2edce1,_0x9df085){return db[_0x2ce4('0x14')][_0x2ce4('0x1c')](_0x13e527['body'],{'raw':_0x13e527[_0x2ce4('0x17')]?_0x13e527[_0x2ce4('0x17')][_0x2ce4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13e527[_0x2ce4('0x17')]?_0x13e527[_0x2ce4('0x17')][_0x2ce4('0x1d')]||null:null,'attributes':_0x13e527[_0x2ce4('0x17')]?_0x13e527[_0x2ce4('0x17')][_0x2ce4('0x1e')]||null:null,'limit':_0x13e527[_0x2ce4('0x17')]?_0x13e527['options'][_0x2ce4('0x1f')]||null:null})['then'](function(_0x32ec9d){logger[_0x2ce4('0xc')]('UpdateFaxQueueReport',_0x13e527);logger[_0x2ce4('0x1a')](_0x2ce4('0x1b'),_0x13e527,JSON[_0x2ce4('0x20')](_0x32ec9d));_0x2edce1(_0x32ec9d);})[_0x2ce4('0x13')](function(_0x4ae497){logger[_0x2ce4('0x10')](_0x2ce4('0x1b'),_0x4ae497[_0x2ce4('0x11')],_0x13e527);_0x9df085(_0x26f86e['error'](0x1f4,_0x4ae497['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 872b5e9..fc04b89 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 _0x4683=['update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put'];(function(_0x19f670,_0x36d23f){var _0x3ffd49=function(_0x5d9e05){while(--_0x5d9e05){_0x19f670['push'](_0x19f670['shift']());}};_0x3ffd49(++_0x36d23f);}(_0x4683,0x11f));var _0x3468=function(_0x16d754,_0x3dae14){_0x16d754=_0x16d754-0x0;var _0x3dca6b=_0x4683[_0x16d754];return _0x3dca6b;};'use strict';var multer=require('multer');var util=require(_0x3468('0x0'));var path=require(_0x3468('0x1'));var timeout=require(_0x3468('0x2'));var express=require(_0x3468('0x3'));var router=express[_0x3468('0x4')]();var fs_extra=require(_0x3468('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3468('0x6'));var config=require(_0x3468('0x7'));var controller=require(_0x3468('0x8'));router[_0x3468('0x9')]('/',auth[_0x3468('0xa')](),controller[_0x3468('0xb')]);router[_0x3468('0x9')](_0x3468('0xc'),auth[_0x3468('0xa')](),controller[_0x3468('0xd')]);router['get']('/:id',auth[_0x3468('0xa')](),controller['show']);router[_0x3468('0xe')]('/',auth[_0x3468('0xa')](),controller[_0x3468('0xf')]);router[_0x3468('0x10')]('/:id',auth[_0x3468('0xa')](),controller[_0x3468('0x11')]);router['delete']('/:id',auth[_0x3468('0xa')](),controller[_0x3468('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe00e=['/describe','describe','/:id','post','isAuthenticated','create','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3aa81b,_0x8babd5){var _0x3e1abc=function(_0x564972){while(--_0x564972){_0x3aa81b['push'](_0x3aa81b['shift']());}};_0x3e1abc(++_0x8babd5);}(_0xe00e,0xce));var _0xee00=function(_0x2f5367,_0x54c11f){_0x2f5367=_0x2f5367-0x0;var _0x42058d=_0xe00e[_0x2f5367];return _0x42058d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee00('0x0'));var timeout=require(_0xee00('0x1'));var express=require(_0xee00('0x2'));var router=express[_0xee00('0x3')]();var fs_extra=require(_0xee00('0x4'));var auth=require(_0xee00('0x5'));var interaction=require(_0xee00('0x6'));var config=require(_0xee00('0x7'));var controller=require('./faxQueueReport.controller');router[_0xee00('0x8')]('/',auth['isAuthenticated'](),controller[_0xee00('0x9')]);router[_0xee00('0x8')](_0xee00('0xa'),auth['isAuthenticated'](),controller[_0xee00('0xb')]);router[_0xee00('0x8')](_0xee00('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xee00('0xd')]('/',auth[_0xee00('0xe')](),controller[_0xee00('0xf')]);router['put'](_0xee00('0xc'),auth[_0xee00('0xe')](),controller['update']);router['delete']('/:id',auth[_0xee00('0xe')](),controller[_0xee00('0x10')]);module[_0xee00('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 30be79d..015ac91 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x1cd402,_0x4e9e47){var _0x1ba43c=function(_0x2a124f){while(--_0x2a124f){_0x1cd402['push'](_0x1cd402['shift']());}};_0x1ba43c(++_0x4e9e47);}(_0xf4eb,0xec));var _0xbf4e=function(_0x9f6ba9,_0x1f5e61){_0x9f6ba9=_0x9f6ba9-0x0;var _0x1b2b4c=_0xf4eb[_0x9f6ba9];return _0x1b2b4c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xe16aad,_0x3656b4){var _0xb6e953=function(_0x51c7f7){while(--_0x51c7f7){_0xe16aad['push'](_0xe16aad['shift']());}};_0xb6e953(++_0x3656b4);}(_0x008c,0x188));var _0xc008=function(_0x53199f,_0x1dac3a){_0x53199f=_0x53199f-0x0;var _0x1f9609=_0x008c[_0x53199f];return _0x1f9609;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 92c38ca..ff73772 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 _0xa5e5=['hasOwnProperty','sort','pick','filter','where','name','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','destroy','then','stack','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xa5e5,0xeb));var _0x5a5e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa5e5[_0x1b349a];return _0x5d1f7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a5e('0x0'));var zipdir=require(_0x5a5e('0x1'));var jsonpatch=require(_0x5a5e('0x2'));var rp=require('request-promise');var moment=require(_0x5a5e('0x3'));var BPromise=require(_0x5a5e('0x4'));var Mustache=require(_0x5a5e('0x5'));var util=require(_0x5a5e('0x6'));var path=require('path');var sox=require(_0x5a5e('0x7'));var csv=require(_0x5a5e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a5e('0x9'));var _=require(_0x5a5e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a5e('0xb'));var deskjs=require(_0x5a5e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5a5e('0xd'));var Papa=require(_0x5a5e('0xe'));var Redis=require(_0x5a5e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a5e('0x10'));var logger=require('../../config/logger')(_0x5a5e('0x11'));var utils=require(_0x5a5e('0x12'));var config=require(_0x5a5e('0x13'));var licenseUtil=require(_0x5a5e('0x14'));var db=require(_0x5a5e('0x15'))['db'];function respondWithStatusCode(_0x222445,_0x5440d8){_0x5440d8=_0x5440d8||0xcc;return function(_0x2d2aa9){if(_0x2d2aa9){return _0x222445[_0x5a5e('0x16')](_0x5440d8);}return _0x222445['status'](_0x5440d8)[_0x5a5e('0x17')]();};}function respondWithResult(_0x4ca7a6,_0x5ecfe8){_0x5ecfe8=_0x5ecfe8||0xc8;return function(_0x356c83){if(_0x356c83){return _0x4ca7a6['status'](_0x5ecfe8)['json'](_0x356c83);}};}function respondWithFilteredResult(_0x41517a,_0x155b3b){return function(_0x2bcdf3){if(_0x2bcdf3){var _0x58201a=typeof _0x155b3b[_0x5a5e('0x18')]===_0x5a5e('0x19')&&typeof _0x155b3b[_0x5a5e('0x1a')]==='undefined';var _0x21c62d=_0x2bcdf3[_0x5a5e('0x1b')];var _0x4b3f6d=_0x58201a?0x0:_0x155b3b[_0x5a5e('0x18')];var _0x599f6f=_0x58201a?_0x2bcdf3[_0x5a5e('0x1b')]:_0x155b3b[_0x5a5e('0x18')]+_0x155b3b['limit'];var _0x9cd67f;if(_0x599f6f>=_0x21c62d){_0x599f6f=_0x21c62d;_0x9cd67f=0xc8;}else{_0x9cd67f=0xce;}_0x41517a[_0x5a5e('0x1c')](_0x9cd67f);return _0x41517a['set'](_0x5a5e('0x1d'),_0x4b3f6d+'-'+_0x599f6f+'/'+_0x21c62d)[_0x5a5e('0x1e')](_0x2bcdf3);}return null;};}function patchUpdates(_0x33f895){return function(_0x22e5bf){try{jsonpatch[_0x5a5e('0x1f')](_0x22e5bf,_0x33f895,!![]);}catch(_0xf1e631){return BPromise[_0x5a5e('0x20')](_0xf1e631);}return _0x22e5bf[_0x5a5e('0x21')]();};}function saveUpdates(_0x20c6b1,_0x2fcff4){return function(_0x3558c9){if(_0x3558c9){return _0x3558c9[_0x5a5e('0x22')](_0x20c6b1)['then'](function(_0x1b9e92){return _0x1b9e92;});}return null;};}function removeEntity(_0x554b71,_0x3759fe){return function(_0x42f97d){if(_0x42f97d){return _0x42f97d[_0x5a5e('0x23')]()[_0x5a5e('0x24')](function(){_0x554b71['status'](0xcc)[_0x5a5e('0x17')]();});}};}function handleEntityNotFound(_0x48fa83,_0x58667d){return function(_0x4162d4){if(!_0x4162d4){_0x48fa83[_0x5a5e('0x16')](0x194);}return _0x4162d4;};}function handleError(_0x187e4c,_0x1b5f93){_0x1b5f93=_0x1b5f93||0x1f4;return function(_0x489410){logger['error'](_0x489410[_0x5a5e('0x25')]);if(_0x489410['name']){delete _0x489410['name'];}_0x187e4c['status'](_0x1b5f93)[_0x5a5e('0x26')](_0x489410);};}exports[_0x5a5e('0x27')]=function(_0x1e649c,_0x5a3854){var _0x5004c5={},_0x58e26c={},_0x13e688={'count':0x0,'rows':[]};var _0x449d75=_[_0x5a5e('0x28')](db[_0x5a5e('0x29')][_0x5a5e('0x2a')],function(_0x359d04){return{'name':_0x359d04[_0x5a5e('0x2b')],'type':_0x359d04[_0x5a5e('0x2c')][_0x5a5e('0x2d')]};});_0x58e26c[_0x5a5e('0x2e')]=_[_0x5a5e('0x28')](_0x449d75,'name');_0x58e26c[_0x5a5e('0x2f')]=_[_0x5a5e('0x30')](_0x1e649c['query']);_0x58e26c[_0x5a5e('0x31')]=_[_0x5a5e('0x32')](_0x58e26c['model'],_0x58e26c[_0x5a5e('0x2f')]);_0x5004c5[_0x5a5e('0x33')]=_[_0x5a5e('0x32')](_0x58e26c[_0x5a5e('0x2e')],qs[_0x5a5e('0x34')](_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x34')]));_0x5004c5[_0x5a5e('0x33')]=_0x5004c5['attributes']['length']?_0x5004c5[_0x5a5e('0x33')]:_0x58e26c[_0x5a5e('0x2e')];if(!_0x1e649c['query'][_0x5a5e('0x35')]('nolimit')){_0x5004c5[_0x5a5e('0x1a')]=qs[_0x5a5e('0x1a')](_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x1a')]);_0x5004c5[_0x5a5e('0x18')]=qs['offset'](_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x18')]);}_0x5004c5['order']=qs['sort'](_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x36')]);_0x5004c5['where']=qs['filters'](_[_0x5a5e('0x37')](_0x1e649c['query'],_0x58e26c[_0x5a5e('0x31')]),_0x449d75);if(_0x1e649c['query'][_0x5a5e('0x38')]){_0x5004c5[_0x5a5e('0x39')]=_['merge'](_0x5004c5['where'],{'$or':_[_0x5a5e('0x28')](_0x449d75,function(_0x395a38){if(_0x395a38[_0x5a5e('0x2c')]!=='VIRTUAL'){var _0x340256={};_0x340256[_0x395a38[_0x5a5e('0x3a')]]={'$like':'%'+_0x1e649c['query'][_0x5a5e('0x38')]+'%'};return _0x340256;}})});}_0x5004c5=_['merge']({},_0x5004c5,_0x1e649c[_0x5a5e('0x3b')]);var _0x527773={'where':_0x5004c5[_0x5a5e('0x39')]};return db['FaxTransferReport'][_0x5a5e('0x1b')](_0x527773)[_0x5a5e('0x24')](function(_0x13a2ff){_0x13e688[_0x5a5e('0x1b')]=_0x13a2ff;if(_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x3c')]){_0x5004c5[_0x5a5e('0x3d')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x5a5e('0x3e')](_0x5004c5);})[_0x5a5e('0x24')](function(_0x3ae94e){_0x13e688[_0x5a5e('0x3f')]=_0x3ae94e;return _0x13e688;})[_0x5a5e('0x24')](respondWithFilteredResult(_0x5a3854,_0x5004c5))[_0x5a5e('0x40')](handleError(_0x5a3854,null));};exports[_0x5a5e('0x41')]=function(_0xd671e4,_0xef6808){var _0x32c2ec={'raw':!![],'where':{'id':_0xd671e4[_0x5a5e('0x42')]['id']}},_0xa95117={};_0xa95117['model']=_['keys'](db[_0x5a5e('0x29')][_0x5a5e('0x2a')]);_0xa95117['query']=_[_0x5a5e('0x30')](_0xd671e4['query']);_0xa95117[_0x5a5e('0x31')]=_[_0x5a5e('0x32')](_0xa95117[_0x5a5e('0x2e')],_0xa95117[_0x5a5e('0x2f')]);_0x32c2ec['attributes']=_['intersection'](_0xa95117[_0x5a5e('0x2e')],qs[_0x5a5e('0x34')](_0xd671e4[_0x5a5e('0x2f')]['fields']));_0x32c2ec[_0x5a5e('0x33')]=_0x32c2ec[_0x5a5e('0x33')]['length']?_0x32c2ec[_0x5a5e('0x33')]:_0xa95117[_0x5a5e('0x2e')];if(_0xd671e4[_0x5a5e('0x2f')][_0x5a5e('0x3c')]){_0x32c2ec[_0x5a5e('0x3d')]=[{'all':!![]}];}_0x32c2ec=_[_0x5a5e('0x43')]({},_0x32c2ec,_0xd671e4[_0x5a5e('0x3b')]);return db['FaxTransferReport']['find'](_0x32c2ec)[_0x5a5e('0x24')](handleEntityNotFound(_0xef6808,null))[_0x5a5e('0x24')](respondWithResult(_0xef6808,null))[_0x5a5e('0x40')](handleError(_0xef6808,null));};exports['create']=function(_0x3507b3,_0x185d04){return db['FaxTransferReport'][_0x5a5e('0x44')](_0x3507b3['body'],{})[_0x5a5e('0x24')](respondWithResult(_0x185d04,0xc9))['catch'](handleError(_0x185d04,null));};exports['update']=function(_0x8f72b,_0x3514bd){if(_0x8f72b[_0x5a5e('0x45')]['id']){delete _0x8f72b[_0x5a5e('0x45')]['id'];}return db[_0x5a5e('0x29')]['find']({'where':{'id':_0x8f72b[_0x5a5e('0x42')]['id']}})['then'](handleEntityNotFound(_0x3514bd,null))[_0x5a5e('0x24')](saveUpdates(_0x8f72b['body'],null))[_0x5a5e('0x24')](respondWithResult(_0x3514bd,null))[_0x5a5e('0x40')](handleError(_0x3514bd,null));};exports[_0x5a5e('0x23')]=function(_0x4db8f7,_0x309479){return db[_0x5a5e('0x29')][_0x5a5e('0x46')]({'where':{'id':_0x4db8f7[_0x5a5e('0x42')]['id']}})[_0x5a5e('0x24')](handleEntityNotFound(_0x309479,null))[_0x5a5e('0x24')](removeEntity(_0x309479,null))[_0x5a5e('0x40')](handleError(_0x309479,null));};exports['describe']=function(_0x4c8f81,_0x42384d){return db[_0x5a5e('0x29')][_0x5a5e('0x47')]()['then'](respondWithResult(_0x42384d,null))[_0x5a5e('0x40')](handleError(_0x42384d,null));}; \ No newline at end of file +var _0xbc5a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','FaxTransferReport','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbc5a,0xce));var _0xabc5=function(_0x374305,_0x3bf2b1){_0x374305=_0x374305-0x0;var _0x48f9c6=_0xbc5a[_0x374305];return _0x48f9c6;};'use strict';var emlformat=require(_0xabc5('0x0'));var rimraf=require(_0xabc5('0x1'));var zipdir=require(_0xabc5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xabc5('0x3'));var BPromise=require(_0xabc5('0x4'));var Mustache=require(_0xabc5('0x5'));var util=require('util');var path=require(_0xabc5('0x6'));var sox=require('sox');var csv=require(_0xabc5('0x7'));var ejs=require(_0xabc5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabc5('0x9'));var squel=require('squel');var crypto=require(_0xabc5('0xa'));var jsforce=require(_0xabc5('0xb'));var deskjs=require(_0xabc5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xabc5('0xd'));var Papa=require(_0xabc5('0xe'));var Redis=require(_0xabc5('0xf'));var authService=require(_0xabc5('0x10'));var qs=require(_0xabc5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabc5('0x12'));var logger=require('../../config/logger')(_0xabc5('0x13'));var utils=require(_0xabc5('0x14'));var config=require(_0xabc5('0x15'));var licenseUtil=require(_0xabc5('0x16'));var db=require(_0xabc5('0x17'))['db'];function respondWithStatusCode(_0x195b99,_0x53446e){_0x53446e=_0x53446e||0xcc;return function(_0x3a9e7d){if(_0x3a9e7d){return _0x195b99['sendStatus'](_0x53446e);}return _0x195b99[_0xabc5('0x18')](_0x53446e)[_0xabc5('0x19')]();};}function respondWithResult(_0x2b46f0,_0x923468){_0x923468=_0x923468||0xc8;return function(_0x4d38ac){if(_0x4d38ac){return _0x2b46f0['status'](_0x923468)[_0xabc5('0x1a')](_0x4d38ac);}};}function respondWithFilteredResult(_0x1d7ccd,_0x3d678b){return function(_0x114abb){if(_0x114abb){var _0x567b44=typeof _0x3d678b[_0xabc5('0x1b')]===_0xabc5('0x1c')&&typeof _0x3d678b[_0xabc5('0x1d')]===_0xabc5('0x1c');var _0x32f119=_0x114abb[_0xabc5('0x1e')];var _0x24e60d=_0x567b44?0x0:_0x3d678b[_0xabc5('0x1b')];var _0x11617e=_0x567b44?_0x114abb[_0xabc5('0x1e')]:_0x3d678b[_0xabc5('0x1b')]+_0x3d678b[_0xabc5('0x1d')];var _0x3f852c;if(_0x11617e>=_0x32f119){_0x11617e=_0x32f119;_0x3f852c=0xc8;}else{_0x3f852c=0xce;}_0x1d7ccd[_0xabc5('0x18')](_0x3f852c);return _0x1d7ccd[_0xabc5('0x1f')](_0xabc5('0x20'),_0x24e60d+'-'+_0x11617e+'/'+_0x32f119)['json'](_0x114abb);}return null;};}function patchUpdates(_0x132e11){return function(_0x5d06b8){try{jsonpatch[_0xabc5('0x21')](_0x5d06b8,_0x132e11,!![]);}catch(_0x3854e8){return BPromise[_0xabc5('0x22')](_0x3854e8);}return _0x5d06b8[_0xabc5('0x23')]();};}function saveUpdates(_0x3c5a4e,_0x338dad){return function(_0x2598e6){if(_0x2598e6){return _0x2598e6[_0xabc5('0x24')](_0x3c5a4e)[_0xabc5('0x25')](function(_0x1f12ee){return _0x1f12ee;});}return null;};}function removeEntity(_0x43272e,_0x2bfa51){return function(_0xf64c30){if(_0xf64c30){return _0xf64c30[_0xabc5('0x26')]()['then'](function(){_0x43272e[_0xabc5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a64ab,_0x274730){return function(_0x23c0e6){if(!_0x23c0e6){_0x3a64ab[_0xabc5('0x27')](0x194);}return _0x23c0e6;};}function handleError(_0x12bd6e,_0x1455c7){_0x1455c7=_0x1455c7||0x1f4;return function(_0x4ad08d){logger[_0xabc5('0x28')](_0x4ad08d['stack']);if(_0x4ad08d[_0xabc5('0x29')]){delete _0x4ad08d[_0xabc5('0x29')];}_0x12bd6e[_0xabc5('0x18')](_0x1455c7)[_0xabc5('0x2a')](_0x4ad08d);};}exports[_0xabc5('0x2b')]=function(_0xdee288,_0x1d93c9){var _0x4acd50={},_0x121bfa={},_0x5c5630={'count':0x0,'rows':[]};var _0x26b56f=_[_0xabc5('0x2c')](db['FaxTransferReport'][_0xabc5('0x2d')],function(_0x37cee4){return{'name':_0x37cee4['fieldName'],'type':_0x37cee4['type']['key']};});_0x121bfa['model']=_[_0xabc5('0x2c')](_0x26b56f,_0xabc5('0x29'));_0x121bfa[_0xabc5('0x2e')]=_[_0xabc5('0x2f')](_0xdee288['query']);_0x121bfa[_0xabc5('0x30')]=_[_0xabc5('0x31')](_0x121bfa[_0xabc5('0x32')],_0x121bfa['query']);_0x4acd50['attributes']=_['intersection'](_0x121bfa[_0xabc5('0x32')],qs[_0xabc5('0x33')](_0xdee288['query'][_0xabc5('0x33')]));_0x4acd50[_0xabc5('0x34')]=_0x4acd50[_0xabc5('0x34')][_0xabc5('0x35')]?_0x4acd50[_0xabc5('0x34')]:_0x121bfa[_0xabc5('0x32')];if(!_0xdee288[_0xabc5('0x2e')][_0xabc5('0x36')](_0xabc5('0x37'))){_0x4acd50[_0xabc5('0x1d')]=qs[_0xabc5('0x1d')](_0xdee288[_0xabc5('0x2e')][_0xabc5('0x1d')]);_0x4acd50[_0xabc5('0x1b')]=qs[_0xabc5('0x1b')](_0xdee288[_0xabc5('0x2e')][_0xabc5('0x1b')]);}_0x4acd50['order']=qs[_0xabc5('0x38')](_0xdee288[_0xabc5('0x2e')]['sort']);_0x4acd50[_0xabc5('0x39')]=qs[_0xabc5('0x30')](_['pick'](_0xdee288[_0xabc5('0x2e')],_0x121bfa[_0xabc5('0x30')]),_0x26b56f);if(_0xdee288[_0xabc5('0x2e')]['filter']){_0x4acd50[_0xabc5('0x39')]=_[_0xabc5('0x3a')](_0x4acd50['where'],{'$or':_[_0xabc5('0x2c')](_0x26b56f,function(_0x385ad1){if(_0x385ad1['type']!==_0xabc5('0x3b')){var _0x296c89={};_0x296c89[_0x385ad1[_0xabc5('0x29')]]={'$like':'%'+_0xdee288['query']['filter']+'%'};return _0x296c89;}})});}_0x4acd50=_[_0xabc5('0x3a')]({},_0x4acd50,_0xdee288[_0xabc5('0x3c')]);var _0x3702b6={'where':_0x4acd50[_0xabc5('0x39')]};return db[_0xabc5('0x3d')][_0xabc5('0x1e')](_0x3702b6)[_0xabc5('0x25')](function(_0x110c85){_0x5c5630[_0xabc5('0x1e')]=_0x110c85;if(_0xdee288['query'][_0xabc5('0x3e')]){_0x4acd50['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xabc5('0x3f')](_0x4acd50);})[_0xabc5('0x25')](function(_0x41d9f6){_0x5c5630[_0xabc5('0x40')]=_0x41d9f6;return _0x5c5630;})[_0xabc5('0x25')](respondWithFilteredResult(_0x1d93c9,_0x4acd50))['catch'](handleError(_0x1d93c9,null));};exports[_0xabc5('0x41')]=function(_0xeb3b20,_0x195506){var _0x4daaf0={'raw':!![],'where':{'id':_0xeb3b20[_0xabc5('0x42')]['id']}},_0x4ca231={};_0x4ca231['model']=_[_0xabc5('0x2f')](db[_0xabc5('0x3d')][_0xabc5('0x2d')]);_0x4ca231['query']=_['keys'](_0xeb3b20['query']);_0x4ca231['filters']=_[_0xabc5('0x31')](_0x4ca231[_0xabc5('0x32')],_0x4ca231[_0xabc5('0x2e')]);_0x4daaf0[_0xabc5('0x34')]=_[_0xabc5('0x31')](_0x4ca231['model'],qs['fields'](_0xeb3b20[_0xabc5('0x2e')]['fields']));_0x4daaf0['attributes']=_0x4daaf0[_0xabc5('0x34')]['length']?_0x4daaf0[_0xabc5('0x34')]:_0x4ca231[_0xabc5('0x32')];if(_0xeb3b20[_0xabc5('0x2e')]['includeAll']){_0x4daaf0[_0xabc5('0x43')]=[{'all':!![]}];}_0x4daaf0=_[_0xabc5('0x3a')]({},_0x4daaf0,_0xeb3b20[_0xabc5('0x3c')]);return db[_0xabc5('0x3d')][_0xabc5('0x44')](_0x4daaf0)[_0xabc5('0x25')](handleEntityNotFound(_0x195506,null))['then'](respondWithResult(_0x195506,null))[_0xabc5('0x45')](handleError(_0x195506,null));};exports[_0xabc5('0x46')]=function(_0x4b7a62,_0x400b5b){return db[_0xabc5('0x3d')][_0xabc5('0x46')](_0x4b7a62[_0xabc5('0x47')],{})[_0xabc5('0x25')](respondWithResult(_0x400b5b,0xc9))[_0xabc5('0x45')](handleError(_0x400b5b,null));};exports['update']=function(_0x4aa7a0,_0x46950f){if(_0x4aa7a0[_0xabc5('0x47')]['id']){delete _0x4aa7a0[_0xabc5('0x47')]['id'];}return db[_0xabc5('0x3d')][_0xabc5('0x44')]({'where':{'id':_0x4aa7a0[_0xabc5('0x42')]['id']}})[_0xabc5('0x25')](handleEntityNotFound(_0x46950f,null))[_0xabc5('0x25')](saveUpdates(_0x4aa7a0['body'],null))['then'](respondWithResult(_0x46950f,null))[_0xabc5('0x45')](handleError(_0x46950f,null));};exports[_0xabc5('0x26')]=function(_0x4f2029,_0xbfd711){return db['FaxTransferReport'][_0xabc5('0x44')]({'where':{'id':_0x4f2029['params']['id']}})[_0xabc5('0x25')](handleEntityNotFound(_0xbfd711,null))[_0xabc5('0x25')](removeEntity(_0xbfd711,null))[_0xabc5('0x45')](handleError(_0xbfd711,null));};exports[_0xabc5('0x48')]=function(_0x4a5798,_0x530411){return db[_0xabc5('0x3d')]['describe']()[_0xabc5('0x25')](respondWithResult(_0x530411,null))[_0xabc5('0x45')](handleError(_0x530411,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 3eafae3..8efbad1 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 _0xa5fd=['uniqueid','../../config/logger','api','moment','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xa5fd,0x173));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xda5f('0x0'))(_0xda5f('0x1'));var moment=require(_0xda5f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda5f('0x3'));var config=require(_0xda5f('0x4'));var attributes=require(_0xda5f('0x5'));module[_0xda5f('0x6')]=function(_0x5eea48,_0x1bca8a){return _0x5eea48['define'](_0xda5f('0x7'),attributes,{'tableName':_0xda5f('0x8'),'paranoid':![],'indexes':[{'name':_0xda5f('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc953=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x3e438f,_0x4439e7){var _0x35f7ff=function(_0x5c643a){while(--_0x5c643a){_0x3e438f['push'](_0x3e438f['shift']());}};_0x35f7ff(++_0x4439e7);}(_0xc953,0x84));var _0x3c95=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0xc953[_0x1f8053];return _0x174fd8;};'use strict';var _=require(_0x3c95('0x0'));var util=require(_0x3c95('0x1'));var logger=require(_0x3c95('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3c95('0x3'));var rp=require(_0x3c95('0x4'));var fs=require('fs');var path=require(_0x3c95('0x5'));var rimraf=require(_0x3c95('0x6'));var config=require(_0x3c95('0x7'));var attributes=require(_0x3c95('0x8'));module[_0x3c95('0x9')]=function(_0x2dba7c,_0x5dc307){return _0x2dba7c['define'](_0x3c95('0xa'),attributes,{'tableName':_0x3c95('0xb'),'paranoid':![],'indexes':[{'name':_0x3c95('0xc'),'fields':[_0x3c95('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1f1efbe..86922fd 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 _0xfb34=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x41d748,_0x14b588){var _0x4e22bd=function(_0x81fe3b){while(--_0x81fe3b){_0x41d748['push'](_0x41d748['shift']());}};_0x4e22bd(++_0x14b588);}(_0xfb34,0x1cc));var _0x4fb3=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xfb34[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x4fb3('0x0'));var util=require(_0x4fb3('0x1'));var moment=require(_0x4fb3('0x2'));var BPromise=require(_0x4fb3('0x3'));var rs=require(_0x4fb3('0x4'));var fs=require('fs');var Redis=require(_0x4fb3('0x5'));var db=require(_0x4fb3('0x6'))['db'];var utils=require(_0x4fb3('0x7'));var logger=require(_0x4fb3('0x8'))('rpc');var config=require(_0x4fb3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4fb3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x124f84,_0x1d81e1,_0x1bb2bd){return new BPromise(function(_0x1dd463,_0x1117ea){return client[_0x4fb3('0xb')](_0x124f84,_0x1bb2bd)['then'](function(_0x3df587){logger[_0x4fb3('0xc')](_0x4fb3('0xd'),_0x1d81e1,'request\x20sent');logger[_0x4fb3('0xe')](_0x4fb3('0xf'),_0x1d81e1,_0x4fb3('0x10'),JSON[_0x4fb3('0x11')](_0x3df587));if(_0x3df587[_0x4fb3('0x12')]){if(_0x3df587[_0x4fb3('0x12')]['code']===0x1f4){logger[_0x4fb3('0x12')](_0x4fb3('0xd'),_0x1d81e1,_0x3df587[_0x4fb3('0x12')][_0x4fb3('0x13')]);return _0x1117ea(_0x3df587[_0x4fb3('0x12')][_0x4fb3('0x13')]);}logger[_0x4fb3('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x1d81e1,_0x3df587[_0x4fb3('0x12')][_0x4fb3('0x13')]);return _0x1dd463(_0x3df587[_0x4fb3('0x12')]['message']);}else{logger[_0x4fb3('0xc')](_0x4fb3('0xd'),_0x1d81e1,_0x4fb3('0x10'));_0x1dd463(_0x3df587[_0x4fb3('0x14')]['message']);}})[_0x4fb3('0x15')](function(_0x48879d){logger[_0x4fb3('0x12')](_0x4fb3('0xd'),_0x1d81e1,_0x48879d);_0x1117ea(_0x48879d);});});} \ No newline at end of file +var _0x034e=['code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x10c7da,_0x462b67){var _0x418d36=function(_0x54d242){while(--_0x54d242){_0x10c7da['push'](_0x10c7da['shift']());}};_0x418d36(++_0x462b67);}(_0x034e,0x1e4));var _0xe034=function(_0x1131ac,_0x3e329a){_0x1131ac=_0x1131ac-0x0;var _0x2f5c39=_0x034e[_0x1131ac];return _0x2f5c39;};'use strict';var _=require(_0xe034('0x0'));var util=require('util');var moment=require(_0xe034('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe034('0x2'));var db=require(_0xe034('0x3'))['db'];var utils=require(_0xe034('0x4'));var logger=require('../../config/logger')(_0xe034('0x5'));var config=require(_0xe034('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe034('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40e2c5,_0xe7c329,_0x2c46e0){return new BPromise(function(_0x170e5c,_0x45e8c2){return client['request'](_0x40e2c5,_0x2c46e0)[_0xe034('0x8')](function(_0x440e09){logger[_0xe034('0x9')](_0xe034('0xa'),_0xe7c329,'request\x20sent');logger[_0xe034('0xb')](_0xe034('0xc'),_0xe7c329,_0xe034('0xd'),JSON[_0xe034('0xe')](_0x440e09));if(_0x440e09[_0xe034('0xf')]){if(_0x440e09['error'][_0xe034('0x10')]===0x1f4){logger['error'](_0xe034('0xa'),_0xe7c329,_0x440e09[_0xe034('0xf')][_0xe034('0x11')]);return _0x45e8c2(_0x440e09[_0xe034('0xf')][_0xe034('0x11')]);}logger[_0xe034('0xf')](_0xe034('0xa'),_0xe7c329,_0x440e09['error'][_0xe034('0x11')]);return _0x170e5c(_0x440e09['error'][_0xe034('0x11')]);}else{logger['info'](_0xe034('0xa'),_0xe7c329,_0xe034('0xd'));_0x170e5c(_0x440e09[_0xe034('0x12')][_0xe034('0x11')]);}})[_0xe034('0x13')](function(_0x2ad4ba){logger[_0xe034('0xf')](_0xe034('0xa'),_0xe7c329,_0x2ad4ba);_0x45e8c2(_0x2ad4ba);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 366c0f8..a4db5ca 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 _0x93b8=['./faxTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x93b8,0x118));var _0x893b=function(_0x267ad4,_0x1d1b88){_0x267ad4=_0x267ad4-0x0;var _0x2f3a7b=_0x93b8[_0x267ad4];return _0x2f3a7b;};'use strict';var multer=require(_0x893b('0x0'));var util=require(_0x893b('0x1'));var path=require(_0x893b('0x2'));var timeout=require(_0x893b('0x3'));var express=require(_0x893b('0x4'));var router=express[_0x893b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x893b('0x6'));var interaction=require(_0x893b('0x7'));var config=require('../../config/environment');var controller=require(_0x893b('0x8'));router[_0x893b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x893b('0x9')](_0x893b('0xa'),auth[_0x893b('0xb')](),controller[_0x893b('0xc')]);router[_0x893b('0x9')](_0x893b('0xd'),auth[_0x893b('0xb')](),controller['show']);router[_0x893b('0xe')]('/',auth[_0x893b('0xb')](),controller[_0x893b('0xf')]);router['put'](_0x893b('0xd'),auth[_0x893b('0xb')](),controller[_0x893b('0x10')]);router[_0x893b('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3ca5=['/describe','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3ca5,0x8e));var _0x53ca=function(_0x4a01c5,_0x142f7a){_0x4a01c5=_0x4a01c5-0x0;var _0x5d0ef7=_0x3ca5[_0x4a01c5];return _0x5d0ef7;};'use strict';var multer=require('multer');var util=require(_0x53ca('0x0'));var path=require('path');var timeout=require(_0x53ca('0x1'));var express=require(_0x53ca('0x2'));var router=express[_0x53ca('0x3')]();var fs_extra=require(_0x53ca('0x4'));var auth=require(_0x53ca('0x5'));var interaction=require(_0x53ca('0x6'));var config=require('../../config/environment');var controller=require(_0x53ca('0x7'));router[_0x53ca('0x8')]('/',auth[_0x53ca('0x9')](),controller['index']);router[_0x53ca('0x8')](_0x53ca('0xa'),auth[_0x53ca('0x9')](),controller['describe']);router[_0x53ca('0x8')](_0x53ca('0xb'),auth[_0x53ca('0x9')](),controller[_0x53ca('0xc')]);router[_0x53ca('0xd')]('/',auth[_0x53ca('0x9')](),controller[_0x53ca('0xe')]);router[_0x53ca('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x53ca('0x10')]);router[_0x53ca('0x11')](_0x53ca('0xb'),auth[_0x53ca('0x9')](),controller['destroy']);module[_0x53ca('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7260d7f..13b7517 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 _0x3508=['../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2c8972,_0x1aff63){var _0x5d1e22=function(_0x56428c){while(--_0x56428c){_0x2c8972['push'](_0x2c8972['shift']());}};_0x5d1e22(++_0x1aff63);}(_0x3508,0x1c0));var _0x8350=function(_0x154272,_0x224448){_0x154272=_0x154272-0x0;var _0x28555a=_0x3508[_0x154272];return _0x28555a;};'use strict';var multer=require(_0x8350('0x0'));var util=require(_0x8350('0x1'));var path=require(_0x8350('0x2'));var timeout=require(_0x8350('0x3'));var express=require(_0x8350('0x4'));var router=express[_0x8350('0x5')]();var fs_extra=require(_0x8350('0x6'));var auth=require(_0x8350('0x7'));var interaction=require(_0x8350('0x8'));var config=require('../../config/environment');var controller=require(_0x8350('0x9'));router[_0x8350('0xa')]('/',auth[_0x8350('0xb')](),controller['index']);router[_0x8350('0xa')](_0x8350('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8350('0xa')](_0x8350('0xd'),auth[_0x8350('0xb')](),controller['getConfigurations']);router[_0x8350('0xa')](_0x8350('0xe'),auth[_0x8350('0xb')](),controller[_0x8350('0xf')]);router[_0x8350('0x10')]('/',auth[_0x8350('0xb')](),controller[_0x8350('0x11')]);router[_0x8350('0x10')](_0x8350('0xd'),auth[_0x8350('0xb')](),controller[_0x8350('0x12')]);router[_0x8350('0x13')]('/:id',auth[_0x8350('0xb')](),controller[_0x8350('0x14')]);router[_0x8350('0x15')]('/:id',auth[_0x8350('0xb')](),controller[_0x8350('0x16')]);module[_0x8350('0x17')]=router; \ No newline at end of file +var _0xfed1=['get','isAuthenticated','/:id','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','./intDeskAccount.controller'];(function(_0x4e6aa2,_0x25f55c){var _0x3e7c35=function(_0x337cf9){while(--_0x337cf9){_0x4e6aa2['push'](_0x4e6aa2['shift']());}};_0x3e7c35(++_0x25f55c);}(_0xfed1,0x125));var _0x1fed=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xfed1[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require(_0x1fed('0x0'));var path=require(_0x1fed('0x1'));var timeout=require(_0x1fed('0x2'));var express=require(_0x1fed('0x3'));var router=express[_0x1fed('0x4')]();var fs_extra=require(_0x1fed('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1fed('0x6'));router[_0x1fed('0x7')]('/',auth[_0x1fed('0x8')](),controller['index']);router[_0x1fed('0x7')](_0x1fed('0x9'),auth[_0x1fed('0x8')](),controller[_0x1fed('0xa')]);router[_0x1fed('0x7')]('/:id/configurations',auth[_0x1fed('0x8')](),controller[_0x1fed('0xb')]);router[_0x1fed('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x1fed('0xc')]('/',auth[_0x1fed('0x8')](),controller[_0x1fed('0xd')]);router[_0x1fed('0xc')](_0x1fed('0xe'),auth[_0x1fed('0x8')](),controller[_0x1fed('0xf')]);router[_0x1fed('0x10')](_0x1fed('0x9'),auth[_0x1fed('0x8')](),controller[_0x1fed('0x11')]);router[_0x1fed('0x12')](_0x1fed('0x9'),auth['isAuthenticated'](),controller[_0x1fed('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index e851ec7..7166684 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 _0x0687=['integrationTab','sequelize','STRING','basic','ENUM','newTab'];(function(_0x306f18,_0x57eb29){var _0x5d470c=function(_0xef0378){while(--_0xef0378){_0x306f18['push'](_0x306f18['shift']());}};_0x5d470c(++_0x57eb29);}(_0x0687,0xfd));var _0x7068=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0687[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7068('0x0'));module['exports']={'name':{'type':Sequelize[_0x7068('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7068('0x1')]},'remoteUri':{'type':Sequelize[_0x7068('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x7068('0x2')),'defaultValue':_0x7068('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x7068('0x1')]},'consumerSecret':{'type':Sequelize[_0x7068('0x1')]},'token':{'type':Sequelize[_0x7068('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7068('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7068('0x3')]('integrationTab',_0x7068('0x4')),'defaultValue':_0x7068('0x5')}}; \ No newline at end of file +var _0x41c8=['ENUM','basic','integrationTab','newTab','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x41c8,0x112));var _0x841c=function(_0x4058cd,_0x21a327){_0x4058cd=_0x4058cd-0x0;var _0x46f58f=_0x41c8[_0x4058cd];return _0x46f58f;};'use strict';var Sequelize=require('sequelize');module[_0x841c('0x0')]={'name':{'type':Sequelize[_0x841c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x841c('0x1')]},'remoteUri':{'type':Sequelize[_0x841c('0x1')]},'authType':{'type':Sequelize[_0x841c('0x2')](_0x841c('0x3')),'defaultValue':_0x841c('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x841c('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x841c('0x1')]},'tokenSecret':{'type':Sequelize[_0x841c('0x1')]},'serverUrl':{'type':Sequelize[_0x841c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x841c('0x2')](_0x841c('0x4'),_0x841c('0x5')),'defaultValue':_0x841c('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 118da84..3c38181 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 _0x8f8a=['intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','type','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','order','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','tokenSecret','remoteUri','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','active','label','test','statusCode','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','key','model','map','keys','query'];(function(_0x90ff37,_0x1db10c){var _0x3598b7=function(_0x38b536){while(--_0x38b536){_0x90ff37['push'](_0x90ff37['shift']());}};_0x3598b7(++_0x1db10c);}(_0x8f8a,0x11a));var _0xa8f8=function(_0x3d8b4c,_0x4e4a7c){_0x3d8b4c=_0x3d8b4c-0x0;var _0xddaeac=_0x8f8a[_0x3d8b4c];return _0xddaeac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8f8('0x0'));var jsonpatch=require(_0xa8f8('0x1'));var rp=require(_0xa8f8('0x2'));var moment=require('moment');var BPromise=require(_0xa8f8('0x3'));var Mustache=require(_0xa8f8('0x4'));var util=require(_0xa8f8('0x5'));var path=require(_0xa8f8('0x6'));var sox=require(_0xa8f8('0x7'));var csv=require(_0xa8f8('0x8'));var ejs=require(_0xa8f8('0x9'));var fs=require('fs');var fs_extra=require(_0xa8f8('0xa'));var _=require(_0xa8f8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa8f8('0xc'));var deskjs=require(_0xa8f8('0xd'));var toCsv=require(_0xa8f8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa8f8('0xe'));var authService=require(_0xa8f8('0xf'));var qs=require(_0xa8f8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8f8('0x11'));var logger=require('../../config/logger')(_0xa8f8('0x12'));var utils=require(_0xa8f8('0x13'));var config=require(_0xa8f8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xc57f2d,_0x54e023){_0x54e023=_0x54e023||0xcc;return function(_0x3d6d9e){if(_0x3d6d9e){return _0xc57f2d[_0xa8f8('0x15')](_0x54e023);}return _0xc57f2d[_0xa8f8('0x16')](_0x54e023)['end']();};}function respondWithResult(_0x3b4510,_0xb4caa4){_0xb4caa4=_0xb4caa4||0xc8;return function(_0x2d3168){if(_0x2d3168){return _0x3b4510[_0xa8f8('0x16')](_0xb4caa4)['json'](_0x2d3168);}};}function respondWithFilteredResult(_0x3a31f2,_0x5c8ad9){return function(_0x34e6f6){if(_0x34e6f6){var _0xfe1040=typeof _0x5c8ad9[_0xa8f8('0x17')]===_0xa8f8('0x18')&&typeof _0x5c8ad9[_0xa8f8('0x19')]==='undefined';var _0x3bd068=_0x34e6f6[_0xa8f8('0x1a')];var _0x459e07=_0xfe1040?0x0:_0x5c8ad9['offset'];var _0xc16158=_0xfe1040?_0x34e6f6[_0xa8f8('0x1a')]:_0x5c8ad9['offset']+_0x5c8ad9[_0xa8f8('0x19')];var _0x58ca7c;if(_0xc16158>=_0x3bd068){_0xc16158=_0x3bd068;_0x58ca7c=0xc8;}else{_0x58ca7c=0xce;}_0x3a31f2[_0xa8f8('0x16')](_0x58ca7c);return _0x3a31f2[_0xa8f8('0x1b')]('Content-Range',_0x459e07+'-'+_0xc16158+'/'+_0x3bd068)[_0xa8f8('0x1c')](_0x34e6f6);}return null;};}function patchUpdates(_0x17e519){return function(_0x25598f){try{jsonpatch[_0xa8f8('0x1d')](_0x25598f,_0x17e519,!![]);}catch(_0x491fcb){return BPromise[_0xa8f8('0x1e')](_0x491fcb);}return _0x25598f['save']();};}function saveUpdates(_0x16aa3,_0x53f3cc){return function(_0x1ce48b){if(_0x1ce48b){return _0x1ce48b[_0xa8f8('0x1f')](_0x16aa3)[_0xa8f8('0x20')](function(_0x3b52d8){return _0x3b52d8;});}return null;};}function removeEntity(_0x682f20,_0xd44b3f){return function(_0x22bf8d){if(_0x22bf8d){return _0x22bf8d[_0xa8f8('0x21')]()[_0xa8f8('0x20')](function(){_0x682f20[_0xa8f8('0x16')](0xcc)[_0xa8f8('0x22')]();});}};}function handleEntityNotFound(_0x3d544b,_0x36b645){return function(_0x383e85){if(!_0x383e85){_0x3d544b['sendStatus'](0x194);}return _0x383e85;};}function handleError(_0xa1f150,_0x55a636){_0x55a636=_0x55a636||0x1f4;return function(_0x2b84e2){logger[_0xa8f8('0x23')](_0x2b84e2[_0xa8f8('0x24')]);if(_0x2b84e2['name']){delete _0x2b84e2[_0xa8f8('0x25')];}_0xa1f150[_0xa8f8('0x16')](_0x55a636)[_0xa8f8('0x26')](_0x2b84e2);};}exports[_0xa8f8('0x27')]=function(_0x2f139b,_0x2c5134){var _0x45cee9={},_0x1560b2={},_0x3a6bcb={'count':0x0,'rows':[]};var _0x157e22=_['map'](db[_0xa8f8('0x28')][_0xa8f8('0x29')],function(_0x155c25){return{'name':_0x155c25[_0xa8f8('0x2a')],'type':_0x155c25['type'][_0xa8f8('0x2b')]};});_0x1560b2[_0xa8f8('0x2c')]=_[_0xa8f8('0x2d')](_0x157e22,_0xa8f8('0x25'));_0x1560b2['query']=_[_0xa8f8('0x2e')](_0x2f139b[_0xa8f8('0x2f')]);_0x1560b2['filters']=_[_0xa8f8('0x30')](_0x1560b2[_0xa8f8('0x2c')],_0x1560b2[_0xa8f8('0x2f')]);_0x45cee9[_0xa8f8('0x31')]=_['intersection'](_0x1560b2[_0xa8f8('0x2c')],qs[_0xa8f8('0x32')](_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x32')]));_0x45cee9[_0xa8f8('0x31')]=_0x45cee9[_0xa8f8('0x31')][_0xa8f8('0x33')]?_0x45cee9[_0xa8f8('0x31')]:_0x1560b2['model'];if(!_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x34')]('nolimit')){_0x45cee9[_0xa8f8('0x19')]=qs[_0xa8f8('0x19')](_0x2f139b[_0xa8f8('0x2f')]['limit']);_0x45cee9[_0xa8f8('0x17')]=qs['offset'](_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x17')]);}_0x45cee9['order']=qs[_0xa8f8('0x35')](_0x2f139b[_0xa8f8('0x2f')]['sort']);_0x45cee9[_0xa8f8('0x36')]=qs['filters'](_[_0xa8f8('0x37')](_0x2f139b[_0xa8f8('0x2f')],_0x1560b2[_0xa8f8('0x38')]),_0x157e22);if(_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x39')]){_0x45cee9[_0xa8f8('0x36')]=_[_0xa8f8('0x3a')](_0x45cee9['where'],{'$or':_[_0xa8f8('0x2d')](_0x157e22,function(_0x322647){if(_0x322647[_0xa8f8('0x3b')]!=='VIRTUAL'){var _0x32dc39={};_0x32dc39[_0x322647[_0xa8f8('0x25')]]={'$like':'%'+_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x39')]+'%'};return _0x32dc39;}})});}_0x45cee9=_[_0xa8f8('0x3a')]({},_0x45cee9,_0x2f139b['options']);var _0xbc054c={'where':_0x45cee9['where']};return db[_0xa8f8('0x28')][_0xa8f8('0x1a')](_0xbc054c)[_0xa8f8('0x20')](function(_0x443281){_0x3a6bcb[_0xa8f8('0x1a')]=_0x443281;if(_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x3c')]){_0x45cee9[_0xa8f8('0x3d')]=[{'all':!![]}];}return db['DeskAccount'][_0xa8f8('0x3e')](_0x45cee9);})[_0xa8f8('0x20')](function(_0x1e1f61){_0x3a6bcb[_0xa8f8('0x3f')]=_0x1e1f61;return _0x3a6bcb;})['then'](respondWithFilteredResult(_0x2c5134,_0x45cee9))['catch'](handleError(_0x2c5134,null));};exports[_0xa8f8('0x40')]=function(_0x23a7f5,_0x576e2f){var _0x38ed12={'raw':![],'where':{'id':_0x23a7f5[_0xa8f8('0x41')]['id']}},_0x164ff9={};_0x164ff9[_0xa8f8('0x2c')]=_[_0xa8f8('0x2e')](db['DeskAccount']['rawAttributes']);_0x164ff9[_0xa8f8('0x2f')]=_[_0xa8f8('0x2e')](_0x23a7f5[_0xa8f8('0x2f')]);_0x164ff9[_0xa8f8('0x38')]=_[_0xa8f8('0x30')](_0x164ff9[_0xa8f8('0x2c')],_0x164ff9['query']);_0x38ed12[_0xa8f8('0x31')]=_[_0xa8f8('0x30')](_0x164ff9[_0xa8f8('0x2c')],qs[_0xa8f8('0x32')](_0x23a7f5[_0xa8f8('0x2f')][_0xa8f8('0x32')]));_0x38ed12['attributes']=_0x38ed12[_0xa8f8('0x31')][_0xa8f8('0x33')]?_0x38ed12[_0xa8f8('0x31')]:_0x164ff9[_0xa8f8('0x2c')];if(_0x23a7f5['query'][_0xa8f8('0x3c')]){_0x38ed12['include']=[{'all':!![]}];}_0x38ed12=_['merge']({},_0x38ed12,_0x23a7f5[_0xa8f8('0x42')]);return db['DeskAccount'][_0xa8f8('0x43')](_0x38ed12)['then'](handleEntityNotFound(_0x576e2f,null))[_0xa8f8('0x20')](respondWithResult(_0x576e2f,null))[_0xa8f8('0x44')](handleError(_0x576e2f,null));};exports[_0xa8f8('0x45')]=function(_0x52c2ca,_0x33eaf9){return db[_0xa8f8('0x28')][_0xa8f8('0x45')](_0x52c2ca[_0xa8f8('0x46')],{})[_0xa8f8('0x20')](respondWithResult(_0x33eaf9,0xc9))[_0xa8f8('0x44')](handleError(_0x33eaf9,null));};exports['update']=function(_0x33405c,_0x1aba1c){if(_0x33405c[_0xa8f8('0x46')]['id']){delete _0x33405c['body']['id'];}return db[_0xa8f8('0x28')][_0xa8f8('0x43')]({'where':{'id':_0x33405c['params']['id']}})[_0xa8f8('0x20')](handleEntityNotFound(_0x1aba1c,null))[_0xa8f8('0x20')](saveUpdates(_0x33405c[_0xa8f8('0x46')],null))[_0xa8f8('0x20')](respondWithResult(_0x1aba1c,null))[_0xa8f8('0x44')](handleError(_0x1aba1c,null));};exports[_0xa8f8('0x21')]=function(_0x34a3d6,_0x17a25d){return db[_0xa8f8('0x28')][_0xa8f8('0x43')]({'where':{'id':_0x34a3d6[_0xa8f8('0x41')]['id']}})['then'](handleEntityNotFound(_0x17a25d,null))[_0xa8f8('0x20')](removeEntity(_0x17a25d,null))['catch'](handleError(_0x17a25d,null));};exports[_0xa8f8('0x47')]=function(_0xc73754,_0xa47cc4,_0x261717){var _0x3fb36d={};var _0x3dd2f1={};var _0x1f7517;var _0x22bc11;return db[_0xa8f8('0x28')][_0xa8f8('0x48')]({'where':{'id':_0xc73754[_0xa8f8('0x41')]['id']}})[_0xa8f8('0x20')](handleEntityNotFound(_0xa47cc4,null))[_0xa8f8('0x20')](function(_0x5dd302){if(_0x5dd302){_0x1f7517=_0x5dd302;_0x3dd2f1[_0xa8f8('0x2c')]=_[_0xa8f8('0x2e')](db[_0xa8f8('0x49')]['rawAttributes']);_0x3dd2f1[_0xa8f8('0x2f')]=_[_0xa8f8('0x2e')](_0xc73754['query']);_0x3dd2f1['filters']=_[_0xa8f8('0x30')](_0x3dd2f1[_0xa8f8('0x2c')],_0x3dd2f1['query']);_0x3fb36d[_0xa8f8('0x31')]=_[_0xa8f8('0x30')](_0x3dd2f1[_0xa8f8('0x2c')],qs[_0xa8f8('0x32')](_0xc73754['query'][_0xa8f8('0x32')]));_0x3fb36d[_0xa8f8('0x31')]=_0x3fb36d[_0xa8f8('0x31')]['length']?_0x3fb36d[_0xa8f8('0x31')]:_0x3dd2f1['model'];_0x3fb36d[_0xa8f8('0x4a')]=qs[_0xa8f8('0x35')](_0xc73754[_0xa8f8('0x2f')]['sort']);_0x3fb36d[_0xa8f8('0x36')]=qs[_0xa8f8('0x38')](_[_0xa8f8('0x37')](_0xc73754[_0xa8f8('0x2f')],_0x3dd2f1['filters']));if(_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x39')]){_0x3fb36d[_0xa8f8('0x36')]=_[_0xa8f8('0x3a')](_0x3fb36d['where'],{'$or':_[_0xa8f8('0x2d')](_0x3fb36d[_0xa8f8('0x31')],function(_0x209861){var _0x286a5c={};_0x286a5c[_0x209861]={'$like':'%'+_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x39')]+'%'};return _0x286a5c;})});}_0x3fb36d=_['merge']({},_0x3fb36d,_0xc73754[_0xa8f8('0x42')]);return _0x1f7517[_0xa8f8('0x47')](_0x3fb36d);}})[_0xa8f8('0x20')](function(_0x525e44){if(_0x525e44){_0x22bc11=_0x525e44['length'];if(!_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x34')](_0xa8f8('0x4b'))){_0x3fb36d[_0xa8f8('0x19')]=qs[_0xa8f8('0x19')](_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x19')]);_0x3fb36d['offset']=qs[_0xa8f8('0x17')](_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x17')]);}return _0x1f7517[_0xa8f8('0x47')](_0x3fb36d);}})[_0xa8f8('0x20')](function(_0x934978){if(_0x934978){return _0x934978?{'count':_0x22bc11,'rows':_0x934978}:null;}})[_0xa8f8('0x20')](respondWithResult(_0xa47cc4,null))[_0xa8f8('0x44')](handleError(_0xa47cc4,null));};exports[_0xa8f8('0x4c')]=function(_0x26d75e,_0x248f76,_0x20b73f){if(_0x26d75e['body']['id']){delete _0x26d75e[_0xa8f8('0x46')]['id'];}return db[_0xa8f8('0x28')][_0xa8f8('0x48')]({'where':{'id':_0x26d75e[_0xa8f8('0x41')]['id']}})[_0xa8f8('0x20')](handleEntityNotFound(_0x248f76,null))[_0xa8f8('0x20')](function(_0x5741f9){if(_0x5741f9){_0x26d75e[_0xa8f8('0x46')]['AccountId']=_0x5741f9['id'];_0x26d75e[_0xa8f8('0x46')][_0xa8f8('0x4d')]=integrations[_0xa8f8('0x4e')](_0x26d75e['body'][_0xa8f8('0x4f')],_0x26d75e[_0xa8f8('0x46')]['type']);_0x26d75e[_0xa8f8('0x46')][_0xa8f8('0x50')]=integrations[_0xa8f8('0x51')](_0x26d75e[_0xa8f8('0x46')]['channel'],_0x26d75e[_0xa8f8('0x46')][_0xa8f8('0x3b')]);return db[_0xa8f8('0x49')][_0xa8f8('0x45')](_0x26d75e['body'],{'include':[{'model':db[_0xa8f8('0x52')],'as':_0xa8f8('0x4d')},{'model':db[_0xa8f8('0x52')],'as':_0xa8f8('0x50')}]});}return null;})[_0xa8f8('0x20')](respondWithResult(_0x248f76,null))['catch'](handleError(_0x248f76,null));};exports[_0xa8f8('0x53')]=function(_0x4b54c2,_0x170f57,_0x5280d0){var _0x2d59c2=[{'name':_0xa8f8('0x54'),'label':_0xa8f8('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 _0x33df22='';return db[_0xa8f8('0x28')][_0xa8f8('0x48')]({'where':{'id':_0x4b54c2['params']['id']},'attributes':['id','remoteUri',_0xa8f8('0x55'),_0xa8f8('0x56'),'password','consumerKey','consumerSecret','token',_0xa8f8('0x57')]})['then'](handleEntityNotFound(_0x170f57,null))[_0xa8f8('0x20')](function(_0x34e588){if(_0x34e588){_0x33df22=_0x34e588[_0xa8f8('0x58')];var _0x30b134=_0x33df22['slice'](-0x1);if(_0x30b134==='/'){_0x33df22=_0x33df22[_0xa8f8('0x59')](0x0,_0x33df22['lastIndexOf'](_0x30b134));}var _0x4d36a9={'method':_0xa8f8('0x5a'),'uri':util[_0xa8f8('0x5b')](_0xa8f8('0x5c'),_0x33df22),'headers':{'Content-Type':_0xa8f8('0x5d'),'Accept':_0xa8f8('0x5d')},'json':!![]};if(_0x34e588[_0xa8f8('0x55')]===_0xa8f8('0x5e')){_0x4d36a9[_0xa8f8('0x5f')][_0xa8f8('0x60')]=util[_0xa8f8('0x5b')](_0xa8f8('0x61'),new Buffer(util[_0xa8f8('0x5b')](_0xa8f8('0x62'),_0x34e588[_0xa8f8('0x56')],_0x34e588[_0xa8f8('0x63')]))[_0xa8f8('0x64')](_0xa8f8('0x65')));}return rp(_0x4d36a9)[_0xa8f8('0x20')](function(_0x520c24){return _0x2d59c2[_0xa8f8('0x66')](_[_0xa8f8('0x2d')](_0x520c24[_0xa8f8('0x67')]['entries'],function(_0x26df30){return{'id':_0x26df30['name'],'name':_0x26df30[_0xa8f8('0x25')],'type':_0x26df30['type'],'active':_0x26df30[_0xa8f8('0x68')],'label':_0x26df30[_0xa8f8('0x69')],'custom':!![]};}));});}})[_0xa8f8('0x20')](function(_0x12df9a){return{'count':_0x12df9a['length'],'rows':_0x12df9a};})['then'](respondWithResult(_0x170f57,null))['catch'](function(_0x1717e4){var _0x3c6d19=_0x4b54c2[_0xa8f8('0x2f')][_0xa8f8('0x6a')]?0x1f4:_0x1717e4[_0xa8f8('0x6b')]||0x1f4;logger[_0xa8f8('0x23')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3c6d19,JSON[_0xa8f8('0x6c')](_0x1717e4));delete _0x1717e4[_0xa8f8('0x25')];if(_0x3c6d19===0x191){_0x3c6d19=0x190;}_0x170f57[_0xa8f8('0x16')](_0x3c6d19)[_0xa8f8('0x26')](_0x4b54c2['query'][_0xa8f8('0x6a')]?{'message':_0xa8f8('0x6d'),'statusCode':_0x1717e4[_0xa8f8('0x6b')]}:_0x1717e4);});}; \ No newline at end of file +var _0x2a39=['bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','DeskAccount','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','catch','show','params','keys','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','password','consumerSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','base64','_embedded','entries','label','test','statusCode','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise'];(function(_0x344683,_0x2ddbd3){var _0x1df8da=function(_0x472fbe){while(--_0x472fbe){_0x344683['push'](_0x344683['shift']());}};_0x1df8da(++_0x2ddbd3);}(_0x2a39,0x1bc));var _0x92a3=function(_0x96b9f1,_0x100578){_0x96b9f1=_0x96b9f1-0x0;var _0x1943fe=_0x2a39[_0x96b9f1];return _0x1943fe;};'use strict';var emlformat=require(_0x92a3('0x0'));var rimraf=require(_0x92a3('0x1'));var zipdir=require(_0x92a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92a3('0x3'));var moment=require('moment');var BPromise=require(_0x92a3('0x4'));var Mustache=require(_0x92a3('0x5'));var util=require(_0x92a3('0x6'));var path=require(_0x92a3('0x7'));var sox=require(_0x92a3('0x8'));var csv=require(_0x92a3('0x9'));var ejs=require(_0x92a3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x92a3('0xb'));var crypto=require(_0x92a3('0xc'));var jsforce=require(_0x92a3('0xd'));var deskjs=require(_0x92a3('0xe'));var toCsv=require(_0x92a3('0x9'));var querystring=require(_0x92a3('0xf'));var Papa=require(_0x92a3('0x10'));var Redis=require('ioredis');var authService=require(_0x92a3('0x11'));var qs=require(_0x92a3('0x12'));var as=require(_0x92a3('0x13'));var hardwareService=require(_0x92a3('0x14'));var logger=require(_0x92a3('0x15'))(_0x92a3('0x16'));var utils=require(_0x92a3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x92a3('0x18'));var db=require(_0x92a3('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1afd6c,_0x1b7be5){_0x1b7be5=_0x1b7be5||0xcc;return function(_0x32201f){if(_0x32201f){return _0x1afd6c['sendStatus'](_0x1b7be5);}return _0x1afd6c['status'](_0x1b7be5)['end']();};}function respondWithResult(_0x2d3feb,_0x26400a){_0x26400a=_0x26400a||0xc8;return function(_0x1ae939){if(_0x1ae939){return _0x2d3feb[_0x92a3('0x1a')](_0x26400a)[_0x92a3('0x1b')](_0x1ae939);}};}function respondWithFilteredResult(_0x4d6c06,_0x2cb8cf){return function(_0xe6d9d3){if(_0xe6d9d3){var _0x5b6f19=typeof _0x2cb8cf[_0x92a3('0x1c')]===_0x92a3('0x1d')&&typeof _0x2cb8cf[_0x92a3('0x1e')]===_0x92a3('0x1d');var _0x3a8f28=_0xe6d9d3[_0x92a3('0x1f')];var _0x2650c3=_0x5b6f19?0x0:_0x2cb8cf[_0x92a3('0x1c')];var _0x3325a6=_0x5b6f19?_0xe6d9d3[_0x92a3('0x1f')]:_0x2cb8cf['offset']+_0x2cb8cf['limit'];var _0x12db98;if(_0x3325a6>=_0x3a8f28){_0x3325a6=_0x3a8f28;_0x12db98=0xc8;}else{_0x12db98=0xce;}_0x4d6c06[_0x92a3('0x1a')](_0x12db98);return _0x4d6c06['set'](_0x92a3('0x20'),_0x2650c3+'-'+_0x3325a6+'/'+_0x3a8f28)[_0x92a3('0x1b')](_0xe6d9d3);}return null;};}function patchUpdates(_0x352ba3){return function(_0x5efc9b){try{jsonpatch[_0x92a3('0x21')](_0x5efc9b,_0x352ba3,!![]);}catch(_0x2f48d4){return BPromise[_0x92a3('0x22')](_0x2f48d4);}return _0x5efc9b[_0x92a3('0x23')]();};}function saveUpdates(_0x4a43c1,_0xe14f25){return function(_0x2baa08){if(_0x2baa08){return _0x2baa08[_0x92a3('0x24')](_0x4a43c1)[_0x92a3('0x25')](function(_0x21e51d){return _0x21e51d;});}return null;};}function removeEntity(_0x27549f,_0x6587b6){return function(_0x5cb647){if(_0x5cb647){return _0x5cb647[_0x92a3('0x26')]()[_0x92a3('0x25')](function(){_0x27549f['status'](0xcc)[_0x92a3('0x27')]();});}};}function handleEntityNotFound(_0x206a83,_0x55acfe){return function(_0x241ab5){if(!_0x241ab5){_0x206a83[_0x92a3('0x28')](0x194);}return _0x241ab5;};}function handleError(_0x36ed8a,_0x111172){_0x111172=_0x111172||0x1f4;return function(_0x18b512){logger[_0x92a3('0x29')](_0x18b512[_0x92a3('0x2a')]);if(_0x18b512[_0x92a3('0x2b')]){delete _0x18b512[_0x92a3('0x2b')];}_0x36ed8a['status'](_0x111172)['send'](_0x18b512);};}exports['index']=function(_0x1fc0be,_0x21c120){var _0xbbd149={},_0x2acfcc={},_0x5deaf7={'count':0x0,'rows':[]};var _0x4373c1=_['map'](db[_0x92a3('0x2c')][_0x92a3('0x2d')],function(_0x33c864){return{'name':_0x33c864[_0x92a3('0x2e')],'type':_0x33c864['type'][_0x92a3('0x2f')]};});_0x2acfcc[_0x92a3('0x30')]=_[_0x92a3('0x31')](_0x4373c1,'name');_0x2acfcc[_0x92a3('0x32')]=_['keys'](_0x1fc0be['query']);_0x2acfcc['filters']=_[_0x92a3('0x33')](_0x2acfcc[_0x92a3('0x30')],_0x2acfcc[_0x92a3('0x32')]);_0xbbd149[_0x92a3('0x34')]=_['intersection'](_0x2acfcc[_0x92a3('0x30')],qs[_0x92a3('0x35')](_0x1fc0be[_0x92a3('0x32')][_0x92a3('0x35')]));_0xbbd149[_0x92a3('0x34')]=_0xbbd149[_0x92a3('0x34')][_0x92a3('0x36')]?_0xbbd149[_0x92a3('0x34')]:_0x2acfcc[_0x92a3('0x30')];if(!_0x1fc0be[_0x92a3('0x32')][_0x92a3('0x37')](_0x92a3('0x38'))){_0xbbd149[_0x92a3('0x1e')]=qs['limit'](_0x1fc0be[_0x92a3('0x32')][_0x92a3('0x1e')]);_0xbbd149[_0x92a3('0x1c')]=qs[_0x92a3('0x1c')](_0x1fc0be[_0x92a3('0x32')]['offset']);}_0xbbd149[_0x92a3('0x39')]=qs[_0x92a3('0x3a')](_0x1fc0be[_0x92a3('0x32')]['sort']);_0xbbd149['where']=qs[_0x92a3('0x3b')](_[_0x92a3('0x3c')](_0x1fc0be[_0x92a3('0x32')],_0x2acfcc[_0x92a3('0x3b')]),_0x4373c1);if(_0x1fc0be[_0x92a3('0x32')][_0x92a3('0x3d')]){_0xbbd149[_0x92a3('0x3e')]=_[_0x92a3('0x3f')](_0xbbd149[_0x92a3('0x3e')],{'$or':_[_0x92a3('0x31')](_0x4373c1,function(_0xf8bd16){if(_0xf8bd16[_0x92a3('0x40')]!==_0x92a3('0x41')){var _0x3f1ad4={};_0x3f1ad4[_0xf8bd16['name']]={'$like':'%'+_0x1fc0be['query'][_0x92a3('0x3d')]+'%'};return _0x3f1ad4;}})});}_0xbbd149=_[_0x92a3('0x3f')]({},_0xbbd149,_0x1fc0be[_0x92a3('0x42')]);var _0xba7e51={'where':_0xbbd149[_0x92a3('0x3e')]};return db[_0x92a3('0x2c')][_0x92a3('0x1f')](_0xba7e51)[_0x92a3('0x25')](function(_0x51379f){_0x5deaf7[_0x92a3('0x1f')]=_0x51379f;if(_0x1fc0be[_0x92a3('0x32')]['includeAll']){_0xbbd149[_0x92a3('0x43')]=[{'all':!![]}];}return db[_0x92a3('0x2c')][_0x92a3('0x44')](_0xbbd149);})[_0x92a3('0x25')](function(_0x1b7d8c){_0x5deaf7['rows']=_0x1b7d8c;return _0x5deaf7;})[_0x92a3('0x25')](respondWithFilteredResult(_0x21c120,_0xbbd149))[_0x92a3('0x45')](handleError(_0x21c120,null));};exports[_0x92a3('0x46')]=function(_0x53ae69,_0x55e8ba){var _0x493987={'raw':![],'where':{'id':_0x53ae69[_0x92a3('0x47')]['id']}},_0x25ccba={};_0x25ccba['model']=_[_0x92a3('0x48')](db[_0x92a3('0x2c')][_0x92a3('0x2d')]);_0x25ccba['query']=_[_0x92a3('0x48')](_0x53ae69[_0x92a3('0x32')]);_0x25ccba[_0x92a3('0x3b')]=_[_0x92a3('0x33')](_0x25ccba[_0x92a3('0x30')],_0x25ccba[_0x92a3('0x32')]);_0x493987[_0x92a3('0x34')]=_[_0x92a3('0x33')](_0x25ccba[_0x92a3('0x30')],qs[_0x92a3('0x35')](_0x53ae69['query'][_0x92a3('0x35')]));_0x493987[_0x92a3('0x34')]=_0x493987[_0x92a3('0x34')][_0x92a3('0x36')]?_0x493987['attributes']:_0x25ccba[_0x92a3('0x30')];if(_0x53ae69[_0x92a3('0x32')]['includeAll']){_0x493987[_0x92a3('0x43')]=[{'all':!![]}];}_0x493987=_[_0x92a3('0x3f')]({},_0x493987,_0x53ae69[_0x92a3('0x42')]);return db[_0x92a3('0x2c')]['find'](_0x493987)[_0x92a3('0x25')](handleEntityNotFound(_0x55e8ba,null))[_0x92a3('0x25')](respondWithResult(_0x55e8ba,null))[_0x92a3('0x45')](handleError(_0x55e8ba,null));};exports['create']=function(_0x39e8dc,_0x1052e6){return db['DeskAccount'][_0x92a3('0x49')](_0x39e8dc[_0x92a3('0x4a')],{})[_0x92a3('0x25')](respondWithResult(_0x1052e6,0xc9))['catch'](handleError(_0x1052e6,null));};exports[_0x92a3('0x24')]=function(_0x493710,_0x4365d9){if(_0x493710[_0x92a3('0x4a')]['id']){delete _0x493710[_0x92a3('0x4a')]['id'];}return db[_0x92a3('0x2c')]['find']({'where':{'id':_0x493710['params']['id']}})[_0x92a3('0x25')](handleEntityNotFound(_0x4365d9,null))[_0x92a3('0x25')](saveUpdates(_0x493710[_0x92a3('0x4a')],null))['then'](respondWithResult(_0x4365d9,null))[_0x92a3('0x45')](handleError(_0x4365d9,null));};exports['destroy']=function(_0x344437,_0x350ae6){return db[_0x92a3('0x2c')]['find']({'where':{'id':_0x344437[_0x92a3('0x47')]['id']}})[_0x92a3('0x25')](handleEntityNotFound(_0x350ae6,null))[_0x92a3('0x25')](removeEntity(_0x350ae6,null))[_0x92a3('0x45')](handleError(_0x350ae6,null));};exports[_0x92a3('0x4b')]=function(_0x48ad7a,_0x4d823b,_0x882511){var _0x150a51={};var _0x212a9b={};var _0x1ef755;var _0x54c92b;return db[_0x92a3('0x2c')][_0x92a3('0x4c')]({'where':{'id':_0x48ad7a[_0x92a3('0x47')]['id']}})[_0x92a3('0x25')](handleEntityNotFound(_0x4d823b,null))[_0x92a3('0x25')](function(_0x24f506){if(_0x24f506){_0x1ef755=_0x24f506;_0x212a9b[_0x92a3('0x30')]=_[_0x92a3('0x48')](db['DeskConfiguration'][_0x92a3('0x2d')]);_0x212a9b[_0x92a3('0x32')]=_['keys'](_0x48ad7a[_0x92a3('0x32')]);_0x212a9b[_0x92a3('0x3b')]=_[_0x92a3('0x33')](_0x212a9b['model'],_0x212a9b[_0x92a3('0x32')]);_0x150a51[_0x92a3('0x34')]=_[_0x92a3('0x33')](_0x212a9b[_0x92a3('0x30')],qs[_0x92a3('0x35')](_0x48ad7a['query'][_0x92a3('0x35')]));_0x150a51[_0x92a3('0x34')]=_0x150a51[_0x92a3('0x34')][_0x92a3('0x36')]?_0x150a51[_0x92a3('0x34')]:_0x212a9b[_0x92a3('0x30')];_0x150a51[_0x92a3('0x39')]=qs[_0x92a3('0x3a')](_0x48ad7a[_0x92a3('0x32')][_0x92a3('0x3a')]);_0x150a51[_0x92a3('0x3e')]=qs[_0x92a3('0x3b')](_['pick'](_0x48ad7a[_0x92a3('0x32')],_0x212a9b[_0x92a3('0x3b')]));if(_0x48ad7a[_0x92a3('0x32')][_0x92a3('0x3d')]){_0x150a51[_0x92a3('0x3e')]=_['merge'](_0x150a51[_0x92a3('0x3e')],{'$or':_['map'](_0x150a51[_0x92a3('0x34')],function(_0x224832){var _0x51f7aa={};_0x51f7aa[_0x224832]={'$like':'%'+_0x48ad7a['query']['filter']+'%'};return _0x51f7aa;})});}_0x150a51=_[_0x92a3('0x3f')]({},_0x150a51,_0x48ad7a[_0x92a3('0x42')]);return _0x1ef755['getConfigurations'](_0x150a51);}})[_0x92a3('0x25')](function(_0x35997a){if(_0x35997a){_0x54c92b=_0x35997a['length'];if(!_0x48ad7a[_0x92a3('0x32')][_0x92a3('0x37')](_0x92a3('0x38'))){_0x150a51[_0x92a3('0x1e')]=qs[_0x92a3('0x1e')](_0x48ad7a[_0x92a3('0x32')]['limit']);_0x150a51[_0x92a3('0x1c')]=qs[_0x92a3('0x1c')](_0x48ad7a[_0x92a3('0x32')][_0x92a3('0x1c')]);}return _0x1ef755[_0x92a3('0x4b')](_0x150a51);}})['then'](function(_0x5d9a8c){if(_0x5d9a8c){return _0x5d9a8c?{'count':_0x54c92b,'rows':_0x5d9a8c}:null;}})[_0x92a3('0x25')](respondWithResult(_0x4d823b,null))[_0x92a3('0x45')](handleError(_0x4d823b,null));};exports[_0x92a3('0x4d')]=function(_0x5db27f,_0x455e52,_0x157620){if(_0x5db27f['body']['id']){delete _0x5db27f[_0x92a3('0x4a')]['id'];}return db[_0x92a3('0x2c')][_0x92a3('0x4c')]({'where':{'id':_0x5db27f['params']['id']}})['then'](handleEntityNotFound(_0x455e52,null))[_0x92a3('0x25')](function(_0x4aebd7){if(_0x4aebd7){_0x5db27f['body'][_0x92a3('0x4e')]=_0x4aebd7['id'];_0x5db27f['body'][_0x92a3('0x4f')]=integrations[_0x92a3('0x50')](_0x5db27f[_0x92a3('0x4a')][_0x92a3('0x51')],_0x5db27f[_0x92a3('0x4a')]['type']);_0x5db27f[_0x92a3('0x4a')][_0x92a3('0x52')]=integrations[_0x92a3('0x53')](_0x5db27f['body'][_0x92a3('0x51')],_0x5db27f['body'][_0x92a3('0x40')]);return db[_0x92a3('0x54')][_0x92a3('0x49')](_0x5db27f['body'],{'include':[{'model':db[_0x92a3('0x55')],'as':_0x92a3('0x4f')},{'model':db[_0x92a3('0x55')],'as':_0x92a3('0x52')}]});}return null;})['then'](respondWithResult(_0x455e52,null))[_0x92a3('0x45')](handleError(_0x455e52,null));};exports[_0x92a3('0x56')]=function(_0x222ae5,_0x4877a0,_0x47d55d){var _0x1e0169=[{'name':_0x92a3('0x57'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4a5fa2='';return db[_0x92a3('0x2c')]['findOne']({'where':{'id':_0x222ae5[_0x92a3('0x47')]['id']},'attributes':['id',_0x92a3('0x58'),_0x92a3('0x59'),_0x92a3('0x5a'),_0x92a3('0x5b'),'consumerKey',_0x92a3('0x5c'),'token','tokenSecret']})[_0x92a3('0x25')](handleEntityNotFound(_0x4877a0,null))[_0x92a3('0x25')](function(_0x284732){if(_0x284732){_0x4a5fa2=_0x284732['remoteUri'];var _0x335447=_0x4a5fa2[_0x92a3('0x5d')](-0x1);if(_0x335447==='/'){_0x4a5fa2=_0x4a5fa2[_0x92a3('0x5e')](0x0,_0x4a5fa2[_0x92a3('0x5f')](_0x335447));}var _0x37b784={'method':_0x92a3('0x60'),'uri':util[_0x92a3('0x61')](_0x92a3('0x62'),_0x4a5fa2),'headers':{'Content-Type':_0x92a3('0x63'),'Accept':_0x92a3('0x63')},'json':!![]};if(_0x284732[_0x92a3('0x59')]===_0x92a3('0x64')){_0x37b784[_0x92a3('0x65')]['Authorization']=util[_0x92a3('0x61')](_0x92a3('0x66'),new Buffer(util['format'](_0x92a3('0x67'),_0x284732[_0x92a3('0x5a')],_0x284732['password']))['toString'](_0x92a3('0x68')));}return rp(_0x37b784)[_0x92a3('0x25')](function(_0xd69aee){return _0x1e0169['concat'](_[_0x92a3('0x31')](_0xd69aee[_0x92a3('0x69')][_0x92a3('0x6a')],function(_0x453f5e){return{'id':_0x453f5e[_0x92a3('0x2b')],'name':_0x453f5e[_0x92a3('0x2b')],'type':_0x453f5e[_0x92a3('0x40')],'active':_0x453f5e['active'],'label':_0x453f5e[_0x92a3('0x6b')],'custom':!![]};}));});}})[_0x92a3('0x25')](function(_0x8d09f7){return{'count':_0x8d09f7[_0x92a3('0x36')],'rows':_0x8d09f7};})[_0x92a3('0x25')](respondWithResult(_0x4877a0,null))[_0x92a3('0x45')](function(_0x4b655c){var _0xb03f3e=_0x222ae5[_0x92a3('0x32')][_0x92a3('0x6c')]?0x1f4:_0x4b655c[_0x92a3('0x6d')]||0x1f4;logger[_0x92a3('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x92a3('0x56'),_0xb03f3e,JSON['stringify'](_0x4b655c));delete _0x4b655c[_0x92a3('0x2b')];if(_0xb03f3e===0x191){_0xb03f3e=0x190;}_0x4877a0[_0x92a3('0x1a')](_0xb03f3e)[_0x92a3('0x6e')](_0x222ae5[_0x92a3('0x32')][_0x92a3('0x6c')]?{'message':_0x92a3('0x6f'),'statusCode':_0x4b655c[_0x92a3('0x6d')]}:_0x4b655c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 566eb8b..9dffa9f 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 _0x1f78=['util','api','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts'];(function(_0x53e14b,_0x163e2a){var _0x12dc1d=function(_0x44a785){while(--_0x44a785){_0x53e14b['push'](_0x53e14b['shift']());}};_0x12dc1d(++_0x163e2a);}(_0x1f78,0xbb));var _0x81f7=function(_0x2e0d95,_0x46ddd5){_0x2e0d95=_0x2e0d95-0x0;var _0x180302=_0x1f78[_0x2e0d95];return _0x180302;};'use strict';var _=require('lodash');var util=require(_0x81f7('0x0'));var logger=require('../../config/logger')(_0x81f7('0x1'));var moment=require('moment');var BPromise=require(_0x81f7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81f7('0x3'));var rimraf=require(_0x81f7('0x4'));var config=require(_0x81f7('0x5'));var attributes=require(_0x81f7('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x81f7('0x7')]=function(_0x11d1f8,_0x1dac3b){return _0x11d1f8[_0x81f7('0x8')](_0x81f7('0x9'),attributes,{'tableName':_0x81f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90e7=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','util'];(function(_0x419981,_0xfbc0be){var _0x15e4f9=function(_0x5d1b56){while(--_0x5d1b56){_0x419981['push'](_0x419981['shift']());}};_0x15e4f9(++_0xfbc0be);}(_0x90e7,0x77));var _0x790e=function(_0x2f4a33,_0x4bda55){_0x2f4a33=_0x2f4a33-0x0;var _0x8abd11=_0x90e7[_0x2f4a33];return _0x8abd11;};'use strict';var _=require('lodash');var util=require(_0x790e('0x0'));var logger=require(_0x790e('0x1'))(_0x790e('0x2'));var moment=require(_0x790e('0x3'));var BPromise=require(_0x790e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x790e('0x5'));var config=require(_0x790e('0x6'));var attributes=require(_0x790e('0x7'));var integrations=require(_0x790e('0x8'));module['exports']=function(_0x249cde,_0x31028b){return _0x249cde[_0x790e('0x9')](_0x790e('0xa'),attributes,{'tableName':_0x790e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 6637c6b..f5c9d51 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 _0x6fe0=['client','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowDeskAccount','find','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4fb972,_0x54287a){var _0x42fae6=function(_0x3aa2ed){while(--_0x3aa2ed){_0x4fb972['push'](_0x4fb972['shift']());}};_0x42fae6(++_0x54287a);}(_0x6fe0,0x1be));var _0x06fe=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x6fe0[_0x71e493];return _0x3d40ab;};'use strict';var _=require(_0x06fe('0x0'));var util=require(_0x06fe('0x1'));var moment=require(_0x06fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x06fe('0x4'));var logger=require(_0x06fe('0x5'))(_0x06fe('0x6'));var config=require(_0x06fe('0x7'));var jayson=require(_0x06fe('0x8'));var client=jayson[_0x06fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f7f36,_0x262dfa,_0x2b3f69){return new BPromise(function(_0x37c599,_0x3dc4cd){return client['request'](_0x3f7f36,_0x2b3f69)[_0x06fe('0xa')](function(_0x3ed740){logger[_0x06fe('0xb')](_0x06fe('0xc'),_0x262dfa,_0x06fe('0xd'));logger[_0x06fe('0xe')](_0x06fe('0xf'),_0x262dfa,_0x06fe('0xd'),JSON[_0x06fe('0x10')](_0x3ed740));if(_0x3ed740[_0x06fe('0x11')]){if(_0x3ed740[_0x06fe('0x11')][_0x06fe('0x12')]===0x1f4){logger[_0x06fe('0x11')](_0x06fe('0xc'),_0x262dfa,_0x3ed740[_0x06fe('0x11')][_0x06fe('0x13')]);return _0x3dc4cd(_0x3ed740[_0x06fe('0x11')][_0x06fe('0x13')]);}logger[_0x06fe('0x11')](_0x06fe('0xc'),_0x262dfa,_0x3ed740[_0x06fe('0x11')][_0x06fe('0x13')]);return _0x37c599(_0x3ed740[_0x06fe('0x11')]['message']);}else{logger[_0x06fe('0xb')](_0x06fe('0xc'),_0x262dfa,_0x06fe('0xd'));_0x37c599(_0x3ed740[_0x06fe('0x14')][_0x06fe('0x13')]);}})['catch'](function(_0x3474fe){logger[_0x06fe('0x11')](_0x06fe('0xc'),_0x262dfa,_0x3474fe);_0x3dc4cd(_0x3474fe);});});}exports[_0x06fe('0x15')]=function(_0x511f6b){var _0xfe034b=this;return new Promise(function(_0x7892c1,_0x4988c7){return db[_0x06fe('0x16')][_0x06fe('0x17')]({'raw':_0x511f6b[_0x06fe('0x18')]?_0x511f6b[_0x06fe('0x18')][_0x06fe('0x19')]===undefined?!![]:![]:!![],'where':_0x511f6b['options']?_0x511f6b[_0x06fe('0x18')][_0x06fe('0x1a')]||null:null,'attributes':_0x511f6b[_0x06fe('0x18')]?_0x511f6b[_0x06fe('0x18')][_0x06fe('0x1b')]||null:null,'limit':_0x511f6b['options']?_0x511f6b[_0x06fe('0x18')][_0x06fe('0x1c')]||null:null,'include':_0x511f6b['options']?_0x511f6b[_0x06fe('0x18')]['include']?_[_0x06fe('0x1d')](_0x511f6b[_0x06fe('0x18')][_0x06fe('0x1e')],function(_0x507440){return{'model':db[_0x507440[_0x06fe('0x1f')]],'as':_0x507440['as'],'attributes':_0x507440[_0x06fe('0x1b')],'include':_0x507440[_0x06fe('0x1e')]?_['map'](_0x507440[_0x06fe('0x1e')],function(_0xd1cd46){return{'model':db[_0xd1cd46[_0x06fe('0x1f')]],'as':_0xd1cd46['as'],'attributes':_0xd1cd46['attributes'],'include':_0xd1cd46[_0x06fe('0x1e')]?_[_0x06fe('0x1d')](_0xd1cd46['include'],function(_0x1fa7e8){return{'model':db[_0x1fa7e8[_0x06fe('0x1f')]],'as':_0x1fa7e8['as'],'attributes':_0x1fa7e8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x489c34){logger[_0x06fe('0xb')]('GetDeskAccount',_0x511f6b);logger['debug'](_0x06fe('0x15'),_0x511f6b,JSON['stringify'](_0x489c34));_0x7892c1(_0x489c34);})[_0x06fe('0x20')](function(_0x30c758){logger[_0x06fe('0x11')](_0x06fe('0x15'),_0x30c758[_0x06fe('0x13')],_0x511f6b);_0x4988c7(_0xfe034b['error'](0x1f4,_0x30c758[_0x06fe('0x13')]));});});};exports[_0x06fe('0x21')]=function(_0x236a6d){var _0x55136a=this;return new Promise(function(_0x3031ca,_0x3d5f00){return db[_0x06fe('0x16')][_0x06fe('0x22')]({'raw':_0x236a6d['options']?_0x236a6d[_0x06fe('0x18')][_0x06fe('0x19')]===undefined?!![]:![]:!![],'where':_0x236a6d[_0x06fe('0x18')]?_0x236a6d[_0x06fe('0x18')]['where']||null:null,'attributes':_0x236a6d['options']?_0x236a6d['options'][_0x06fe('0x1b')]||null:null,'include':_0x236a6d[_0x06fe('0x18')]?_0x236a6d[_0x06fe('0x18')][_0x06fe('0x1e')]?_[_0x06fe('0x1d')](_0x236a6d[_0x06fe('0x18')][_0x06fe('0x1e')],function(_0x59e548){return{'model':db[_0x59e548[_0x06fe('0x1f')]],'as':_0x59e548['as'],'attributes':_0x59e548[_0x06fe('0x1b')],'include':_0x59e548[_0x06fe('0x1e')]?_[_0x06fe('0x1d')](_0x59e548[_0x06fe('0x1e')],function(_0x5bc978){return{'model':db[_0x5bc978[_0x06fe('0x1f')]],'as':_0x5bc978['as'],'attributes':_0x5bc978[_0x06fe('0x1b')],'include':_0x5bc978[_0x06fe('0x1e')]?_[_0x06fe('0x1d')](_0x5bc978[_0x06fe('0x1e')],function(_0x240fe5){return{'model':db[_0x240fe5[_0x06fe('0x1f')]],'as':_0x240fe5['as'],'attributes':_0x240fe5[_0x06fe('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x06fe('0xa')](function(_0xff8115){logger['info'](_0x06fe('0x21'),_0x236a6d);logger[_0x06fe('0xe')](_0x06fe('0x21'),_0x236a6d,JSON[_0x06fe('0x10')](_0xff8115));_0x3031ca(_0xff8115);})['catch'](function(_0x39ded6){logger[_0x06fe('0x11')](_0x06fe('0x21'),_0x39ded6[_0x06fe('0x13')],_0x236a6d);_0x3d5f00(_0x55136a[_0x06fe('0x11')](0x1f4,_0x39ded6[_0x06fe('0x13')]));});});}; \ No newline at end of file +var _0xb98a=['client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','findAll','options','attributes','limit','include','map','model','ShowDeskAccount','DeskAccount','find','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x318837,_0x5f2ae1){var _0x258c33=function(_0x105806){while(--_0x105806){_0x318837['push'](_0x318837['shift']());}};_0x258c33(++_0x5f2ae1);}(_0xb98a,0x67));var _0xab98=function(_0x411bd1,_0x416106){_0x411bd1=_0x411bd1-0x0;var _0x320464=_0xb98a[_0x411bd1];return _0x320464;};'use strict';var _=require(_0xab98('0x0'));var util=require(_0xab98('0x1'));var moment=require(_0xab98('0x2'));var BPromise=require(_0xab98('0x3'));var rs=require(_0xab98('0x4'));var fs=require('fs');var Redis=require(_0xab98('0x5'));var db=require(_0xab98('0x6'))['db'];var utils=require(_0xab98('0x7'));var logger=require(_0xab98('0x8'))(_0xab98('0x9'));var config=require('../../config/environment');var jayson=require(_0xab98('0xa'));var client=jayson[_0xab98('0xb')][_0xab98('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b5db0,_0x2313db,_0x499fde){return new BPromise(function(_0x3d44f3,_0x13b72b){return client[_0xab98('0xd')](_0x1b5db0,_0x499fde)[_0xab98('0xe')](function(_0x33fdf1){logger[_0xab98('0xf')](_0xab98('0x10'),_0x2313db,_0xab98('0x11'));logger[_0xab98('0x12')](_0xab98('0x13'),_0x2313db,_0xab98('0x11'),JSON['stringify'](_0x33fdf1));if(_0x33fdf1[_0xab98('0x14')]){if(_0x33fdf1[_0xab98('0x14')][_0xab98('0x15')]===0x1f4){logger[_0xab98('0x14')](_0xab98('0x10'),_0x2313db,_0x33fdf1[_0xab98('0x14')][_0xab98('0x16')]);return _0x13b72b(_0x33fdf1['error']['message']);}logger['error'](_0xab98('0x10'),_0x2313db,_0x33fdf1[_0xab98('0x14')]['message']);return _0x3d44f3(_0x33fdf1[_0xab98('0x14')]['message']);}else{logger[_0xab98('0xf')]('DeskAccount,\x20%s,\x20%s',_0x2313db,'request\x20sent');_0x3d44f3(_0x33fdf1[_0xab98('0x17')]['message']);}})[_0xab98('0x18')](function(_0x84a8a4){logger['error'](_0xab98('0x10'),_0x2313db,_0x84a8a4);_0x13b72b(_0x84a8a4);});});}exports[_0xab98('0x19')]=function(_0x12d408){var _0x5ed720=this;return new Promise(function(_0x455fc3,_0x38a5b7){return db['DeskAccount'][_0xab98('0x1a')]({'raw':_0x12d408[_0xab98('0x1b')]?_0x12d408['options']['raw']===undefined?!![]:![]:!![],'where':_0x12d408[_0xab98('0x1b')]?_0x12d408[_0xab98('0x1b')]['where']||null:null,'attributes':_0x12d408[_0xab98('0x1b')]?_0x12d408[_0xab98('0x1b')][_0xab98('0x1c')]||null:null,'limit':_0x12d408[_0xab98('0x1b')]?_0x12d408[_0xab98('0x1b')][_0xab98('0x1d')]||null:null,'include':_0x12d408['options']?_0x12d408[_0xab98('0x1b')][_0xab98('0x1e')]?_[_0xab98('0x1f')](_0x12d408[_0xab98('0x1b')][_0xab98('0x1e')],function(_0x2442b6){return{'model':db[_0x2442b6[_0xab98('0x20')]],'as':_0x2442b6['as'],'attributes':_0x2442b6[_0xab98('0x1c')],'include':_0x2442b6[_0xab98('0x1e')]?_[_0xab98('0x1f')](_0x2442b6[_0xab98('0x1e')],function(_0x5472e8){return{'model':db[_0x5472e8[_0xab98('0x20')]],'as':_0x5472e8['as'],'attributes':_0x5472e8[_0xab98('0x1c')],'include':_0x5472e8[_0xab98('0x1e')]?_[_0xab98('0x1f')](_0x5472e8[_0xab98('0x1e')],function(_0x5350b3){return{'model':db[_0x5350b3['model']],'as':_0x5350b3['as'],'attributes':_0x5350b3[_0xab98('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12ab89){logger[_0xab98('0xf')]('GetDeskAccount',_0x12d408);logger['debug'](_0xab98('0x19'),_0x12d408,JSON['stringify'](_0x12ab89));_0x455fc3(_0x12ab89);})['catch'](function(_0x1e2100){logger[_0xab98('0x14')](_0xab98('0x19'),_0x1e2100['message'],_0x12d408);_0x38a5b7(_0x5ed720['error'](0x1f4,_0x1e2100[_0xab98('0x16')]));});});};exports[_0xab98('0x21')]=function(_0x7047d4){var _0x2d1508=this;return new Promise(function(_0x299053,_0x3b7a0f){return db[_0xab98('0x22')][_0xab98('0x23')]({'raw':_0x7047d4[_0xab98('0x1b')]?_0x7047d4[_0xab98('0x1b')][_0xab98('0x24')]===undefined?!![]:![]:!![],'where':_0x7047d4[_0xab98('0x1b')]?_0x7047d4[_0xab98('0x1b')]['where']||null:null,'attributes':_0x7047d4['options']?_0x7047d4['options'][_0xab98('0x1c')]||null:null,'include':_0x7047d4[_0xab98('0x1b')]?_0x7047d4[_0xab98('0x1b')][_0xab98('0x1e')]?_['map'](_0x7047d4[_0xab98('0x1b')]['include'],function(_0x110092){return{'model':db[_0x110092[_0xab98('0x20')]],'as':_0x110092['as'],'attributes':_0x110092['attributes'],'include':_0x110092['include']?_[_0xab98('0x1f')](_0x110092['include'],function(_0x2d6882){return{'model':db[_0x2d6882['model']],'as':_0x2d6882['as'],'attributes':_0x2d6882[_0xab98('0x1c')],'include':_0x2d6882[_0xab98('0x1e')]?_[_0xab98('0x1f')](_0x2d6882[_0xab98('0x1e')],function(_0x3724a4){return{'model':db[_0x3724a4[_0xab98('0x20')]],'as':_0x3724a4['as'],'attributes':_0x3724a4[_0xab98('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xab98('0xe')](function(_0x5ec9cd){logger[_0xab98('0xf')](_0xab98('0x21'),_0x7047d4);logger[_0xab98('0x12')]('ShowDeskAccount',_0x7047d4,JSON[_0xab98('0x25')](_0x5ec9cd));_0x299053(_0x5ec9cd);})[_0xab98('0x18')](function(_0x1c803c){logger[_0xab98('0x14')](_0xab98('0x21'),_0x1c803c['message'],_0x7047d4);_0x3b7a0f(_0x2d1508[_0xab98('0x14')](0x1f4,_0x1c803c[_0xab98('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index bb2acdc..ea025c6 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x4e9a14,_0x20b63a){var _0x2b7f53=function(_0x225b38){while(--_0x225b38){_0x4e9a14['push'](_0x4e9a14['shift']());}};_0x2b7f53(++_0x20b63a);}(_0x7217,0x19e));var _0x7721=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7217[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x4ab128,_0x5b85dd){var _0x34bb14=function(_0x1b299d){while(--_0x1b299d){_0x4ab128['push'](_0x4ab128['shift']());}};_0x34bb14(++_0x5b85dd);}(_0xedd9,0xfc));var _0x9edd=function(_0x19a24d,_0x929ffc){_0x19a24d=_0x19a24d-0x0;var _0x3e0ae7=_0xedd9[_0x19a24d];return _0x3e0ae7;};'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['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 1301243..e9d2d42 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 _0xb42a=['sequelize','exports','STRING'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0xb42a,0x183));var _0xab42=function(_0x4306ae,_0x5e21f6){_0x4306ae=_0x4306ae-0x0;var _0x297d39=_0xb42a[_0x4306ae];return _0x297d39;};'use strict';var Sequelize=require(_0xab42('0x0'));module[_0xab42('0x1')]={'name':{'type':Sequelize[_0xab42('0x2')]},'description':{'type':Sequelize[_0xab42('0x2')]}}; \ No newline at end of file +var _0xd4b9=['sequelize','STRING'];(function(_0x36a41a,_0x3a2ce1){var _0x3215f4=function(_0x32fdd8){while(--_0x32fdd8){_0x36a41a['push'](_0x36a41a['shift']());}};_0x3215f4(++_0x3a2ce1);}(_0xd4b9,0x1e2));var _0x9d4b=function(_0x2f42fb,_0xd76e2d){_0x2f42fb=_0x2f42fb-0x0;var _0x5b615e=_0xd4b9[_0x2f42fb];return _0x5b615e;};'use strict';var Sequelize=require(_0x9d4b('0x0'));module['exports']={'name':{'type':Sequelize[_0x9d4b('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 5b22b1d..2ea7e98 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 _0xba87=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','reject','save','update','then','destroy','stack','name','send','index','fieldName','type','map','keys','filters','intersection','query','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','DeskConfiguration','create','catch','body','find','getFields','findOne','DeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0xba87,0x1ee));var _0x7ba8=function(_0x5519c4,_0x270f91){_0x5519c4=_0x5519c4-0x0;var _0x2c1c3=_0xba87[_0x5519c4];return _0x2c1c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ba8('0x0'));var zipdir=require(_0x7ba8('0x1'));var jsonpatch=require(_0x7ba8('0x2'));var rp=require(_0x7ba8('0x3'));var moment=require(_0x7ba8('0x4'));var BPromise=require(_0x7ba8('0x5'));var Mustache=require(_0x7ba8('0x6'));var util=require(_0x7ba8('0x7'));var path=require(_0x7ba8('0x8'));var sox=require(_0x7ba8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ba8('0xa'));var _=require('lodash');var squel=require(_0x7ba8('0xb'));var crypto=require(_0x7ba8('0xc'));var jsforce=require(_0x7ba8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7ba8('0xe'));var querystring=require(_0x7ba8('0xf'));var Papa=require(_0x7ba8('0x10'));var Redis=require(_0x7ba8('0x11'));var authService=require(_0x7ba8('0x12'));var qs=require(_0x7ba8('0x13'));var as=require(_0x7ba8('0x14'));var hardwareService=require(_0x7ba8('0x15'));var logger=require(_0x7ba8('0x16'))(_0x7ba8('0x17'));var utils=require(_0x7ba8('0x18'));var config=require(_0x7ba8('0x19'));var licenseUtil=require(_0x7ba8('0x1a'));var db=require(_0x7ba8('0x1b'))['db'];function respondWithStatusCode(_0x2064f6,_0x24b99a){_0x24b99a=_0x24b99a||0xcc;return function(_0x48fcfa){if(_0x48fcfa){return _0x2064f6[_0x7ba8('0x1c')](_0x24b99a);}return _0x2064f6['status'](_0x24b99a)[_0x7ba8('0x1d')]();};}function respondWithResult(_0x18219b,_0x428122){_0x428122=_0x428122||0xc8;return function(_0x403526){if(_0x403526){return _0x18219b[_0x7ba8('0x1e')](_0x428122)[_0x7ba8('0x1f')](_0x403526);}};}function respondWithFilteredResult(_0x5b46be,_0x18ac92){return function(_0x562076){if(_0x562076){var _0xdd85ef=typeof _0x18ac92['offset']===_0x7ba8('0x20')&&typeof _0x18ac92[_0x7ba8('0x21')]===_0x7ba8('0x20');var _0x5d45c1=_0x562076[_0x7ba8('0x22')];var _0x3d625c=_0xdd85ef?0x0:_0x18ac92[_0x7ba8('0x23')];var _0x46c735=_0xdd85ef?_0x562076['count']:_0x18ac92[_0x7ba8('0x23')]+_0x18ac92[_0x7ba8('0x21')];var _0x2879ee;if(_0x46c735>=_0x5d45c1){_0x46c735=_0x5d45c1;_0x2879ee=0xc8;}else{_0x2879ee=0xce;}_0x5b46be[_0x7ba8('0x1e')](_0x2879ee);return _0x5b46be['set']('Content-Range',_0x3d625c+'-'+_0x46c735+'/'+_0x5d45c1)[_0x7ba8('0x1f')](_0x562076);}return null;};}function patchUpdates(_0x2383f0){return function(_0x184e6c){try{jsonpatch['apply'](_0x184e6c,_0x2383f0,!![]);}catch(_0x5c5e55){return BPromise[_0x7ba8('0x24')](_0x5c5e55);}return _0x184e6c[_0x7ba8('0x25')]();};}function saveUpdates(_0x5e6668,_0x350fc1){return function(_0x5b63e4){if(_0x5b63e4){return _0x5b63e4[_0x7ba8('0x26')](_0x5e6668)[_0x7ba8('0x27')](function(_0x1ecf56){return _0x1ecf56;});}return null;};}function removeEntity(_0x3e58d4,_0x320e73){return function(_0x245f80){if(_0x245f80){return _0x245f80[_0x7ba8('0x28')]()[_0x7ba8('0x27')](function(){_0x3e58d4['status'](0xcc)[_0x7ba8('0x1d')]();});}};}function handleEntityNotFound(_0x289e54,_0xc4e00c){return function(_0x23616b){if(!_0x23616b){_0x289e54[_0x7ba8('0x1c')](0x194);}return _0x23616b;};}function handleError(_0x1fb167,_0x579dad){_0x579dad=_0x579dad||0x1f4;return function(_0x42f5d2){logger['error'](_0x42f5d2[_0x7ba8('0x29')]);if(_0x42f5d2[_0x7ba8('0x2a')]){delete _0x42f5d2[_0x7ba8('0x2a')];}_0x1fb167[_0x7ba8('0x1e')](_0x579dad)[_0x7ba8('0x2b')](_0x42f5d2);};}exports[_0x7ba8('0x2c')]=function(_0x48c397,_0x431b41){var _0xa26b60={},_0x4150ea={},_0x35fe5e={'count':0x0,'rows':[]};var _0x51b0c8=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x359b04){return{'name':_0x359b04[_0x7ba8('0x2d')],'type':_0x359b04[_0x7ba8('0x2e')]['key']};});_0x4150ea['model']=_[_0x7ba8('0x2f')](_0x51b0c8,_0x7ba8('0x2a'));_0x4150ea['query']=_[_0x7ba8('0x30')](_0x48c397['query']);_0x4150ea[_0x7ba8('0x31')]=_[_0x7ba8('0x32')](_0x4150ea['model'],_0x4150ea[_0x7ba8('0x33')]);_0xa26b60[_0x7ba8('0x34')]=_[_0x7ba8('0x32')](_0x4150ea[_0x7ba8('0x35')],qs[_0x7ba8('0x36')](_0x48c397['query']['fields']));_0xa26b60[_0x7ba8('0x34')]=_0xa26b60['attributes'][_0x7ba8('0x37')]?_0xa26b60['attributes']:_0x4150ea['model'];if(!_0x48c397[_0x7ba8('0x33')]['hasOwnProperty'](_0x7ba8('0x38'))){_0xa26b60[_0x7ba8('0x21')]=qs['limit'](_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x21')]);_0xa26b60[_0x7ba8('0x23')]=qs['offset'](_0x48c397['query']['offset']);}_0xa26b60[_0x7ba8('0x39')]=qs[_0x7ba8('0x3a')](_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x3a')]);_0xa26b60[_0x7ba8('0x3b')]=qs['filters'](_[_0x7ba8('0x3c')](_0x48c397[_0x7ba8('0x33')],_0x4150ea['filters']),_0x51b0c8);if(_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x3d')]){_0xa26b60['where']=_[_0x7ba8('0x3e')](_0xa26b60[_0x7ba8('0x3b')],{'$or':_['map'](_0x51b0c8,function(_0x9a12b1){if(_0x9a12b1[_0x7ba8('0x2e')]!==_0x7ba8('0x3f')){var _0x4d213e={};_0x4d213e[_0x9a12b1[_0x7ba8('0x2a')]]={'$like':'%'+_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x3d')]+'%'};return _0x4d213e;}})});}_0xa26b60=_[_0x7ba8('0x3e')]({},_0xa26b60,_0x48c397[_0x7ba8('0x40')]);var _0x3e1cbb={'where':_0xa26b60[_0x7ba8('0x3b')]};return db['DeskConfiguration'][_0x7ba8('0x22')](_0x3e1cbb)[_0x7ba8('0x27')](function(_0x154790){_0x35fe5e[_0x7ba8('0x22')]=_0x154790;if(_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x41')]){_0xa26b60[_0x7ba8('0x42')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x7ba8('0x43')](_0xa26b60);})[_0x7ba8('0x27')](function(_0x37ad85){_0x35fe5e['rows']=_0x37ad85;return _0x35fe5e;})['then'](respondWithFilteredResult(_0x431b41,_0xa26b60))['catch'](handleError(_0x431b41,null));};exports[_0x7ba8('0x44')]=function(_0x406c74,_0x302c7e){var _0x164550={'raw':![],'where':{'id':_0x406c74[_0x7ba8('0x45')]['id']}},_0x2414a6={};_0x2414a6['model']=_[_0x7ba8('0x30')](db['DeskConfiguration'][_0x7ba8('0x46')]);_0x2414a6[_0x7ba8('0x33')]=_[_0x7ba8('0x30')](_0x406c74['query']);_0x2414a6[_0x7ba8('0x31')]=_['intersection'](_0x2414a6['model'],_0x2414a6['query']);_0x164550['attributes']=_[_0x7ba8('0x32')](_0x2414a6[_0x7ba8('0x35')],qs[_0x7ba8('0x36')](_0x406c74[_0x7ba8('0x33')]['fields']));_0x164550['attributes']=_0x164550[_0x7ba8('0x34')][_0x7ba8('0x37')]?_0x164550[_0x7ba8('0x34')]:_0x2414a6[_0x7ba8('0x35')];if(_0x406c74[_0x7ba8('0x33')][_0x7ba8('0x41')]){_0x164550['include']=[{'all':!![]}];}_0x164550=_[_0x7ba8('0x3e')]({},_0x164550,_0x406c74[_0x7ba8('0x40')]);return db[_0x7ba8('0x47')]['find'](_0x164550)['then'](handleEntityNotFound(_0x302c7e,null))[_0x7ba8('0x27')](respondWithResult(_0x302c7e,null))['catch'](handleError(_0x302c7e,null));};exports[_0x7ba8('0x48')]=function(_0x59150c,_0x3b498d){return db[_0x7ba8('0x47')][_0x7ba8('0x48')](_0x59150c['body'],{})[_0x7ba8('0x27')](respondWithResult(_0x3b498d,0xc9))[_0x7ba8('0x49')](handleError(_0x3b498d,null));};exports[_0x7ba8('0x26')]=function(_0x1e3188,_0x5cd197){if(_0x1e3188[_0x7ba8('0x4a')]['id']){delete _0x1e3188[_0x7ba8('0x4a')]['id'];}return db[_0x7ba8('0x47')][_0x7ba8('0x4b')]({'where':{'id':_0x1e3188[_0x7ba8('0x45')]['id']}})[_0x7ba8('0x27')](handleEntityNotFound(_0x5cd197,null))['then'](saveUpdates(_0x1e3188[_0x7ba8('0x4a')],null))[_0x7ba8('0x27')](respondWithResult(_0x5cd197,null))[_0x7ba8('0x49')](handleError(_0x5cd197,null));};exports[_0x7ba8('0x28')]=function(_0x2536b3,_0xc64e75){return db[_0x7ba8('0x47')][_0x7ba8('0x4b')]({'where':{'id':_0x2536b3[_0x7ba8('0x45')]['id']}})[_0x7ba8('0x27')](handleEntityNotFound(_0xc64e75,null))[_0x7ba8('0x27')](removeEntity(_0xc64e75,null))[_0x7ba8('0x49')](handleError(_0xc64e75,null));};exports[_0x7ba8('0x4c')]=function(_0x40ea5e,_0x35b01e,_0x1aba3d){var _0x5baf1d={};var _0x36b7e7={};var _0x41c38a;var _0x5db2c1;return db[_0x7ba8('0x47')][_0x7ba8('0x4d')]({'where':{'id':_0x40ea5e[_0x7ba8('0x45')]['id']}})['then'](handleEntityNotFound(_0x35b01e,null))[_0x7ba8('0x27')](function(_0x2c576b){if(_0x2c576b){_0x41c38a=_0x2c576b;_0x36b7e7[_0x7ba8('0x35')]=_[_0x7ba8('0x30')](db[_0x7ba8('0x4e')][_0x7ba8('0x46')]);_0x36b7e7['query']=_[_0x7ba8('0x30')](_0x40ea5e[_0x7ba8('0x33')]);_0x36b7e7[_0x7ba8('0x31')]=_[_0x7ba8('0x32')](_0x36b7e7[_0x7ba8('0x35')],_0x36b7e7[_0x7ba8('0x33')]);_0x5baf1d['attributes']=_[_0x7ba8('0x32')](_0x36b7e7[_0x7ba8('0x35')],qs[_0x7ba8('0x36')](_0x40ea5e[_0x7ba8('0x33')][_0x7ba8('0x36')]));_0x5baf1d[_0x7ba8('0x34')]=_0x5baf1d[_0x7ba8('0x34')][_0x7ba8('0x37')]?_0x5baf1d['attributes']:_0x36b7e7[_0x7ba8('0x35')];_0x5baf1d['order']=qs['sort'](_0x40ea5e['query']['sort']);_0x5baf1d[_0x7ba8('0x3b')]=qs[_0x7ba8('0x31')](_[_0x7ba8('0x3c')](_0x40ea5e[_0x7ba8('0x33')],_0x36b7e7[_0x7ba8('0x31')]));if(_0x40ea5e[_0x7ba8('0x33')][_0x7ba8('0x3d')]){_0x5baf1d[_0x7ba8('0x3b')]=_[_0x7ba8('0x3e')](_0x5baf1d[_0x7ba8('0x3b')],{'$or':_[_0x7ba8('0x2f')](_0x5baf1d[_0x7ba8('0x34')],function(_0x662487){var _0x476566={};_0x476566[_0x662487]={'$like':'%'+_0x40ea5e['query'][_0x7ba8('0x3d')]+'%'};return _0x476566;})});}_0x5baf1d=_[_0x7ba8('0x3e')]({},_0x5baf1d,_0x40ea5e[_0x7ba8('0x40')]);return _0x41c38a['getFields'](_0x5baf1d);}})[_0x7ba8('0x27')](function(_0x3052b5){if(_0x3052b5){_0x5db2c1=_0x3052b5['length'];if(!_0x40ea5e[_0x7ba8('0x33')]['hasOwnProperty'](_0x7ba8('0x38'))){_0x5baf1d['limit']=qs[_0x7ba8('0x21')](_0x40ea5e[_0x7ba8('0x33')][_0x7ba8('0x21')]);_0x5baf1d['offset']=qs['offset'](_0x40ea5e[_0x7ba8('0x33')]['offset']);}return _0x41c38a['getFields'](_0x5baf1d);}})['then'](function(_0x2735fa){if(_0x2735fa){return _0x2735fa?{'count':_0x5db2c1,'rows':_0x2735fa}:null;}})[_0x7ba8('0x27')](respondWithResult(_0x35b01e,null))[_0x7ba8('0x49')](handleError(_0x35b01e,null));};exports[_0x7ba8('0x4f')]=function(_0x37b78a,_0x277bce,_0x5dd9aa){var _0x519457={};var _0x31305c={};var _0x1e0c16;var _0x40c93a;return db[_0x7ba8('0x47')][_0x7ba8('0x4d')]({'where':{'id':_0x37b78a[_0x7ba8('0x45')]['id']}})['then'](handleEntityNotFound(_0x277bce,null))[_0x7ba8('0x27')](function(_0x4fcc49){if(_0x4fcc49){_0x1e0c16=_0x4fcc49;_0x31305c[_0x7ba8('0x35')]=_[_0x7ba8('0x30')](db[_0x7ba8('0x4e')]['rawAttributes']);_0x31305c[_0x7ba8('0x33')]=_[_0x7ba8('0x30')](_0x37b78a[_0x7ba8('0x33')]);_0x31305c[_0x7ba8('0x31')]=_['intersection'](_0x31305c['model'],_0x31305c['query']);_0x519457[_0x7ba8('0x34')]=_[_0x7ba8('0x32')](_0x31305c['model'],qs[_0x7ba8('0x36')](_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x36')]));_0x519457[_0x7ba8('0x34')]=_0x519457[_0x7ba8('0x34')]['length']?_0x519457[_0x7ba8('0x34')]:_0x31305c[_0x7ba8('0x35')];_0x519457[_0x7ba8('0x39')]=qs[_0x7ba8('0x3a')](_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x3a')]);_0x519457[_0x7ba8('0x3b')]=qs[_0x7ba8('0x31')](_[_0x7ba8('0x3c')](_0x37b78a['query'],_0x31305c[_0x7ba8('0x31')]));if(_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x3d')]){_0x519457[_0x7ba8('0x3b')]=_[_0x7ba8('0x3e')](_0x519457[_0x7ba8('0x3b')],{'$or':_[_0x7ba8('0x2f')](_0x519457[_0x7ba8('0x34')],function(_0x34e84a){var _0x1b0d7f={};_0x1b0d7f[_0x34e84a]={'$like':'%'+_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x3d')]+'%'};return _0x1b0d7f;})});}_0x519457=_[_0x7ba8('0x3e')]({},_0x519457,_0x37b78a[_0x7ba8('0x40')]);return _0x1e0c16[_0x7ba8('0x4f')](_0x519457);}})[_0x7ba8('0x27')](function(_0x59dbb0){if(_0x59dbb0){_0x40c93a=_0x59dbb0['length'];if(!_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x50')](_0x7ba8('0x38'))){_0x519457[_0x7ba8('0x21')]=qs[_0x7ba8('0x21')](_0x37b78a['query']['limit']);_0x519457['offset']=qs[_0x7ba8('0x23')](_0x37b78a['query'][_0x7ba8('0x23')]);}return _0x1e0c16['getSubjects'](_0x519457);}})[_0x7ba8('0x27')](function(_0x26ebc8){if(_0x26ebc8){return _0x26ebc8?{'count':_0x40c93a,'rows':_0x26ebc8}:null;}})[_0x7ba8('0x27')](respondWithResult(_0x277bce,null))[_0x7ba8('0x49')](handleError(_0x277bce,null));};exports['getDescriptions']=function(_0x4d8701,_0x4f3453,_0x46a0bb){var _0x4ef306={};var _0x4598={};var _0x33f1dc;var _0x205d03;return db[_0x7ba8('0x47')]['findOne']({'where':{'id':_0x4d8701[_0x7ba8('0x45')]['id']}})[_0x7ba8('0x27')](handleEntityNotFound(_0x4f3453,null))['then'](function(_0x5127e4){if(_0x5127e4){_0x33f1dc=_0x5127e4;_0x4598[_0x7ba8('0x35')]=_[_0x7ba8('0x30')](db[_0x7ba8('0x4e')][_0x7ba8('0x46')]);_0x4598[_0x7ba8('0x33')]=_[_0x7ba8('0x30')](_0x4d8701['query']);_0x4598[_0x7ba8('0x31')]=_[_0x7ba8('0x32')](_0x4598['model'],_0x4598[_0x7ba8('0x33')]);_0x4ef306[_0x7ba8('0x34')]=_[_0x7ba8('0x32')](_0x4598[_0x7ba8('0x35')],qs['fields'](_0x4d8701[_0x7ba8('0x33')]['fields']));_0x4ef306['attributes']=_0x4ef306[_0x7ba8('0x34')]['length']?_0x4ef306[_0x7ba8('0x34')]:_0x4598[_0x7ba8('0x35')];_0x4ef306[_0x7ba8('0x39')]=qs[_0x7ba8('0x3a')](_0x4d8701[_0x7ba8('0x33')]['sort']);_0x4ef306[_0x7ba8('0x3b')]=qs[_0x7ba8('0x31')](_[_0x7ba8('0x3c')](_0x4d8701[_0x7ba8('0x33')],_0x4598['filters']));if(_0x4d8701[_0x7ba8('0x33')][_0x7ba8('0x3d')]){_0x4ef306[_0x7ba8('0x3b')]=_[_0x7ba8('0x3e')](_0x4ef306[_0x7ba8('0x3b')],{'$or':_[_0x7ba8('0x2f')](_0x4ef306[_0x7ba8('0x34')],function(_0x17c330){var _0x57c8bb={};_0x57c8bb[_0x17c330]={'$like':'%'+_0x4d8701[_0x7ba8('0x33')][_0x7ba8('0x3d')]+'%'};return _0x57c8bb;})});}_0x4ef306=_['merge']({},_0x4ef306,_0x4d8701[_0x7ba8('0x40')]);return _0x33f1dc['getDescriptions'](_0x4ef306);}})[_0x7ba8('0x27')](function(_0x11d1d2){if(_0x11d1d2){_0x205d03=_0x11d1d2[_0x7ba8('0x37')];if(!_0x4d8701[_0x7ba8('0x33')][_0x7ba8('0x50')](_0x7ba8('0x38'))){_0x4ef306[_0x7ba8('0x21')]=qs[_0x7ba8('0x21')](_0x4d8701[_0x7ba8('0x33')]['limit']);_0x4ef306[_0x7ba8('0x23')]=qs[_0x7ba8('0x23')](_0x4d8701[_0x7ba8('0x33')]['offset']);}return _0x33f1dc[_0x7ba8('0x51')](_0x4ef306);}})[_0x7ba8('0x27')](function(_0x3c1268){if(_0x3c1268){return _0x3c1268?{'count':_0x205d03,'rows':_0x3c1268}:null;}})[_0x7ba8('0x27')](respondWithResult(_0x4f3453,null))[_0x7ba8('0x49')](handleError(_0x4f3453,null));};exports[_0x7ba8('0x52')]=function(_0x38c295,_0x44b36d,_0x437708){var _0x906583={};var _0x5eea84={};var _0x3c9421;var _0x560936;return db[_0x7ba8('0x47')][_0x7ba8('0x4d')]({'where':{'id':_0x38c295[_0x7ba8('0x45')]['id']}})['then'](handleEntityNotFound(_0x44b36d,null))['then'](function(_0x1123f7){if(_0x1123f7){_0x3c9421=_0x1123f7;_0x5eea84[_0x7ba8('0x35')]=_['keys'](db[_0x7ba8('0x53')][_0x7ba8('0x46')]);_0x5eea84['query']=_[_0x7ba8('0x30')](_0x38c295['query']);_0x5eea84['filters']=_[_0x7ba8('0x32')](_0x5eea84[_0x7ba8('0x35')],_0x5eea84['query']);_0x906583[_0x7ba8('0x34')]=_['intersection'](_0x5eea84['model'],qs[_0x7ba8('0x36')](_0x38c295[_0x7ba8('0x33')]['fields']));_0x906583[_0x7ba8('0x34')]=_0x906583[_0x7ba8('0x34')]['length']?_0x906583[_0x7ba8('0x34')]:_0x5eea84[_0x7ba8('0x35')];_0x906583[_0x7ba8('0x39')]=qs[_0x7ba8('0x3a')](_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x3a')]);_0x906583['where']=qs[_0x7ba8('0x31')](_[_0x7ba8('0x3c')](_0x38c295[_0x7ba8('0x33')],_0x5eea84['filters']));if(_0x38c295['query'][_0x7ba8('0x3d')]){_0x906583[_0x7ba8('0x3b')]=_[_0x7ba8('0x3e')](_0x906583[_0x7ba8('0x3b')],{'$or':_[_0x7ba8('0x2f')](_0x906583['attributes'],function(_0x33c195){var _0x1c63fd={};_0x1c63fd[_0x33c195]={'$like':'%'+_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x3d')]+'%'};return _0x1c63fd;})});}_0x906583=_['merge']({},_0x906583,_0x38c295['options']);return _0x3c9421[_0x7ba8('0x52')](_0x906583);}})[_0x7ba8('0x27')](function(_0x4a1838){if(_0x4a1838){_0x560936=_0x4a1838[_0x7ba8('0x37')];if(!_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x50')](_0x7ba8('0x38'))){_0x906583['limit']=qs['limit'](_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x21')]);_0x906583[_0x7ba8('0x23')]=qs[_0x7ba8('0x23')](_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x23')]);}return _0x3c9421[_0x7ba8('0x52')](_0x906583);}})['then'](function(_0x2688df){if(_0x2688df){return _0x2688df?{'count':_0x560936,'rows':_0x2688df}:null;}})['then'](respondWithResult(_0x44b36d,null))[_0x7ba8('0x49')](handleError(_0x44b36d,null));};exports['setTags']=function(_0x3fd105,_0x4b23ab,_0x2a238f){if(_0x3fd105['body']['id']){delete _0x3fd105[_0x7ba8('0x4a')]['id'];}return db[_0x7ba8('0x47')][_0x7ba8('0x4d')]({'where':{'id':_0x3fd105[_0x7ba8('0x45')]['id']}})[_0x7ba8('0x27')](handleEntityNotFound(_0x4b23ab,null))[_0x7ba8('0x27')](function(_0x4175cf){if(_0x4175cf){return _0x4175cf[_0x7ba8('0x54')](_0x3fd105['body'][_0x7ba8('0x55')]||[]);}return null;})['then'](respondWithResult(_0x4b23ab,null))[_0x7ba8('0x49')](handleError(_0x4b23ab,null));}; \ No newline at end of file +var _0xf6d9=['error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','catch','show','params','find','create','body','update','getFields','hasOwnProperty','findOne','pick','getSubjects','getDescriptions','DeskField','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xf6d9,0x13a));var _0x9f6d=function(_0x5c5c87,_0xfeceb3){_0x5c5c87=_0x5c5c87-0x0;var _0xd83eee=_0xf6d9[_0x5c5c87];return _0xd83eee;};'use strict';var emlformat=require(_0x9f6d('0x0'));var rimraf=require(_0x9f6d('0x1'));var zipdir=require(_0x9f6d('0x2'));var jsonpatch=require(_0x9f6d('0x3'));var rp=require(_0x9f6d('0x4'));var moment=require('moment');var BPromise=require(_0x9f6d('0x5'));var Mustache=require('mustache');var util=require(_0x9f6d('0x6'));var path=require(_0x9f6d('0x7'));var sox=require(_0x9f6d('0x8'));var csv=require(_0x9f6d('0x9'));var ejs=require(_0x9f6d('0xa'));var fs=require('fs');var fs_extra=require(_0x9f6d('0xb'));var _=require(_0x9f6d('0xc'));var squel=require(_0x9f6d('0xd'));var crypto=require(_0x9f6d('0xe'));var jsforce=require(_0x9f6d('0xf'));var deskjs=require(_0x9f6d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9f6d('0x11'));var Papa=require(_0x9f6d('0x12'));var Redis=require('ioredis');var authService=require(_0x9f6d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9f6d('0x14'));var hardwareService=require(_0x9f6d('0x15'));var logger=require(_0x9f6d('0x16'))(_0x9f6d('0x17'));var utils=require(_0x9f6d('0x18'));var config=require(_0x9f6d('0x19'));var licenseUtil=require(_0x9f6d('0x1a'));var db=require(_0x9f6d('0x1b'))['db'];function respondWithStatusCode(_0x8de2af,_0x50acc6){_0x50acc6=_0x50acc6||0xcc;return function(_0x15ad04){if(_0x15ad04){return _0x8de2af[_0x9f6d('0x1c')](_0x50acc6);}return _0x8de2af['status'](_0x50acc6)[_0x9f6d('0x1d')]();};}function respondWithResult(_0x1a5357,_0x45334d){_0x45334d=_0x45334d||0xc8;return function(_0x3a4517){if(_0x3a4517){return _0x1a5357['status'](_0x45334d)[_0x9f6d('0x1e')](_0x3a4517);}};}function respondWithFilteredResult(_0x25634c,_0x3a6282){return function(_0x108719){if(_0x108719){var _0x2a8299=typeof _0x3a6282[_0x9f6d('0x1f')]===_0x9f6d('0x20')&&typeof _0x3a6282['limit']===_0x9f6d('0x20');var _0x1c36fa=_0x108719['count'];var _0x135fa2=_0x2a8299?0x0:_0x3a6282[_0x9f6d('0x1f')];var _0x2a3167=_0x2a8299?_0x108719[_0x9f6d('0x21')]:_0x3a6282[_0x9f6d('0x1f')]+_0x3a6282[_0x9f6d('0x22')];var _0x5e953c;if(_0x2a3167>=_0x1c36fa){_0x2a3167=_0x1c36fa;_0x5e953c=0xc8;}else{_0x5e953c=0xce;}_0x25634c[_0x9f6d('0x23')](_0x5e953c);return _0x25634c[_0x9f6d('0x24')](_0x9f6d('0x25'),_0x135fa2+'-'+_0x2a3167+'/'+_0x1c36fa)[_0x9f6d('0x1e')](_0x108719);}return null;};}function patchUpdates(_0x19c030){return function(_0x4b062b){try{jsonpatch[_0x9f6d('0x26')](_0x4b062b,_0x19c030,!![]);}catch(_0x34f76f){return BPromise[_0x9f6d('0x27')](_0x34f76f);}return _0x4b062b[_0x9f6d('0x28')]();};}function saveUpdates(_0x39ed3b,_0x19b61b){return function(_0x281687){if(_0x281687){return _0x281687['update'](_0x39ed3b)[_0x9f6d('0x29')](function(_0x1baa1a){return _0x1baa1a;});}return null;};}function removeEntity(_0x51858e,_0x51148f){return function(_0x21705e){if(_0x21705e){return _0x21705e['destroy']()[_0x9f6d('0x29')](function(){_0x51858e[_0x9f6d('0x23')](0xcc)[_0x9f6d('0x1d')]();});}};}function handleEntityNotFound(_0x2e062,_0xac076c){return function(_0x49ea83){if(!_0x49ea83){_0x2e062[_0x9f6d('0x1c')](0x194);}return _0x49ea83;};}function handleError(_0x1d62ce,_0x39dc8b){_0x39dc8b=_0x39dc8b||0x1f4;return function(_0x11909b){logger[_0x9f6d('0x2a')](_0x11909b[_0x9f6d('0x2b')]);if(_0x11909b[_0x9f6d('0x2c')]){delete _0x11909b[_0x9f6d('0x2c')];}_0x1d62ce[_0x9f6d('0x23')](_0x39dc8b)[_0x9f6d('0x2d')](_0x11909b);};}exports[_0x9f6d('0x2e')]=function(_0x3f884c,_0x102bc2){var _0x2ad2a2={},_0x5506ba={},_0x2ca80e={'count':0x0,'rows':[]};var _0x3caf07=_['map'](db['DeskConfiguration'][_0x9f6d('0x2f')],function(_0x522e8f){return{'name':_0x522e8f[_0x9f6d('0x30')],'type':_0x522e8f[_0x9f6d('0x31')][_0x9f6d('0x32')]};});_0x5506ba['model']=_[_0x9f6d('0x33')](_0x3caf07,_0x9f6d('0x2c'));_0x5506ba[_0x9f6d('0x34')]=_[_0x9f6d('0x35')](_0x3f884c[_0x9f6d('0x34')]);_0x5506ba['filters']=_[_0x9f6d('0x36')](_0x5506ba[_0x9f6d('0x37')],_0x5506ba[_0x9f6d('0x34')]);_0x2ad2a2[_0x9f6d('0x38')]=_[_0x9f6d('0x36')](_0x5506ba[_0x9f6d('0x37')],qs[_0x9f6d('0x39')](_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x2ad2a2[_0x9f6d('0x38')]=_0x2ad2a2[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x2ad2a2[_0x9f6d('0x38')]:_0x5506ba[_0x9f6d('0x37')];if(!_0x3f884c['query']['hasOwnProperty'](_0x9f6d('0x3b'))){_0x2ad2a2[_0x9f6d('0x22')]=qs['limit'](_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x22')]);_0x2ad2a2[_0x9f6d('0x1f')]=qs[_0x9f6d('0x1f')](_0x3f884c['query'][_0x9f6d('0x1f')]);}_0x2ad2a2[_0x9f6d('0x3c')]=qs['sort'](_0x3f884c['query'][_0x9f6d('0x3d')]);_0x2ad2a2[_0x9f6d('0x3e')]=qs['filters'](_['pick'](_0x3f884c['query'],_0x5506ba[_0x9f6d('0x3f')]),_0x3caf07);if(_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x40')]){_0x2ad2a2['where']=_[_0x9f6d('0x41')](_0x2ad2a2['where'],{'$or':_[_0x9f6d('0x33')](_0x3caf07,function(_0x3e9ca0){if(_0x3e9ca0[_0x9f6d('0x31')]!==_0x9f6d('0x42')){var _0x531378={};_0x531378[_0x3e9ca0['name']]={'$like':'%'+_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x531378;}})});}_0x2ad2a2=_['merge']({},_0x2ad2a2,_0x3f884c[_0x9f6d('0x43')]);var _0x527370={'where':_0x2ad2a2['where']};return db[_0x9f6d('0x44')][_0x9f6d('0x21')](_0x527370)[_0x9f6d('0x29')](function(_0x139402){_0x2ca80e[_0x9f6d('0x21')]=_0x139402;if(_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x45')]){_0x2ad2a2[_0x9f6d('0x46')]=[{'all':!![]}];}return db[_0x9f6d('0x44')][_0x9f6d('0x47')](_0x2ad2a2);})[_0x9f6d('0x29')](function(_0x1987fa){_0x2ca80e['rows']=_0x1987fa;return _0x2ca80e;})['then'](respondWithFilteredResult(_0x102bc2,_0x2ad2a2))[_0x9f6d('0x48')](handleError(_0x102bc2,null));};exports[_0x9f6d('0x49')]=function(_0x45dad7,_0x56c004){var _0x405fcf={'raw':![],'where':{'id':_0x45dad7[_0x9f6d('0x4a')]['id']}},_0x3a4972={};_0x3a4972[_0x9f6d('0x37')]=_[_0x9f6d('0x35')](db['DeskConfiguration'][_0x9f6d('0x2f')]);_0x3a4972['query']=_[_0x9f6d('0x35')](_0x45dad7[_0x9f6d('0x34')]);_0x3a4972[_0x9f6d('0x3f')]=_[_0x9f6d('0x36')](_0x3a4972[_0x9f6d('0x37')],_0x3a4972['query']);_0x405fcf[_0x9f6d('0x38')]=_[_0x9f6d('0x36')](_0x3a4972['model'],qs['fields'](_0x45dad7[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x405fcf['attributes']=_0x405fcf[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x405fcf[_0x9f6d('0x38')]:_0x3a4972['model'];if(_0x45dad7['query'][_0x9f6d('0x45')]){_0x405fcf[_0x9f6d('0x46')]=[{'all':!![]}];}_0x405fcf=_[_0x9f6d('0x41')]({},_0x405fcf,_0x45dad7['options']);return db[_0x9f6d('0x44')][_0x9f6d('0x4b')](_0x405fcf)[_0x9f6d('0x29')](handleEntityNotFound(_0x56c004,null))['then'](respondWithResult(_0x56c004,null))[_0x9f6d('0x48')](handleError(_0x56c004,null));};exports[_0x9f6d('0x4c')]=function(_0x9c9da2,_0x284214){return db[_0x9f6d('0x44')][_0x9f6d('0x4c')](_0x9c9da2[_0x9f6d('0x4d')],{})['then'](respondWithResult(_0x284214,0xc9))[_0x9f6d('0x48')](handleError(_0x284214,null));};exports[_0x9f6d('0x4e')]=function(_0x5c8dd4,_0x1b62e7){if(_0x5c8dd4[_0x9f6d('0x4d')]['id']){delete _0x5c8dd4['body']['id'];}return db['DeskConfiguration'][_0x9f6d('0x4b')]({'where':{'id':_0x5c8dd4[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x1b62e7,null))[_0x9f6d('0x29')](saveUpdates(_0x5c8dd4[_0x9f6d('0x4d')],null))[_0x9f6d('0x29')](respondWithResult(_0x1b62e7,null))[_0x9f6d('0x48')](handleError(_0x1b62e7,null));};exports['destroy']=function(_0x26e8ab,_0x3521d3){return db[_0x9f6d('0x44')][_0x9f6d('0x4b')]({'where':{'id':_0x26e8ab[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x3521d3,null))[_0x9f6d('0x29')](removeEntity(_0x3521d3,null))[_0x9f6d('0x48')](handleError(_0x3521d3,null));};exports[_0x9f6d('0x4f')]=function(_0x5ac316,_0xd1f4bb,_0x4a334c){var _0x3f22f9={};var _0x1284fc={};var _0x7fccfe;var _0x42b23f;return db[_0x9f6d('0x44')]['findOne']({'where':{'id':_0x5ac316[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0xd1f4bb,null))[_0x9f6d('0x29')](function(_0x2c6780){if(_0x2c6780){_0x7fccfe=_0x2c6780;_0x1284fc[_0x9f6d('0x37')]=_['keys'](db['DeskField'][_0x9f6d('0x2f')]);_0x1284fc[_0x9f6d('0x34')]=_[_0x9f6d('0x35')](_0x5ac316[_0x9f6d('0x34')]);_0x1284fc['filters']=_['intersection'](_0x1284fc[_0x9f6d('0x37')],_0x1284fc[_0x9f6d('0x34')]);_0x3f22f9[_0x9f6d('0x38')]=_['intersection'](_0x1284fc['model'],qs[_0x9f6d('0x39')](_0x5ac316['query']['fields']));_0x3f22f9[_0x9f6d('0x38')]=_0x3f22f9[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x3f22f9[_0x9f6d('0x38')]:_0x1284fc[_0x9f6d('0x37')];_0x3f22f9[_0x9f6d('0x3c')]=qs[_0x9f6d('0x3d')](_0x5ac316[_0x9f6d('0x34')][_0x9f6d('0x3d')]);_0x3f22f9[_0x9f6d('0x3e')]=qs[_0x9f6d('0x3f')](_['pick'](_0x5ac316[_0x9f6d('0x34')],_0x1284fc[_0x9f6d('0x3f')]));if(_0x5ac316['query'][_0x9f6d('0x40')]){_0x3f22f9[_0x9f6d('0x3e')]=_[_0x9f6d('0x41')](_0x3f22f9[_0x9f6d('0x3e')],{'$or':_[_0x9f6d('0x33')](_0x3f22f9[_0x9f6d('0x38')],function(_0x20b62b){var _0x36e566={};_0x36e566[_0x20b62b]={'$like':'%'+_0x5ac316[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x36e566;})});}_0x3f22f9=_[_0x9f6d('0x41')]({},_0x3f22f9,_0x5ac316['options']);return _0x7fccfe[_0x9f6d('0x4f')](_0x3f22f9);}})[_0x9f6d('0x29')](function(_0x42208b){if(_0x42208b){_0x42b23f=_0x42208b['length'];if(!_0x5ac316[_0x9f6d('0x34')][_0x9f6d('0x50')](_0x9f6d('0x3b'))){_0x3f22f9[_0x9f6d('0x22')]=qs[_0x9f6d('0x22')](_0x5ac316[_0x9f6d('0x34')]['limit']);_0x3f22f9[_0x9f6d('0x1f')]=qs['offset'](_0x5ac316[_0x9f6d('0x34')][_0x9f6d('0x1f')]);}return _0x7fccfe[_0x9f6d('0x4f')](_0x3f22f9);}})[_0x9f6d('0x29')](function(_0x229829){if(_0x229829){return _0x229829?{'count':_0x42b23f,'rows':_0x229829}:null;}})[_0x9f6d('0x29')](respondWithResult(_0xd1f4bb,null))[_0x9f6d('0x48')](handleError(_0xd1f4bb,null));};exports['getSubjects']=function(_0x1cffb1,_0x25e896,_0x5bb8b7){var _0x5d8a4d={};var _0x1dddf2={};var _0x5b4141;var _0x53b343;return db['DeskConfiguration'][_0x9f6d('0x51')]({'where':{'id':_0x1cffb1['params']['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x25e896,null))[_0x9f6d('0x29')](function(_0x5d23f6){if(_0x5d23f6){_0x5b4141=_0x5d23f6;_0x1dddf2[_0x9f6d('0x37')]=_[_0x9f6d('0x35')](db['DeskField'][_0x9f6d('0x2f')]);_0x1dddf2['query']=_[_0x9f6d('0x35')](_0x1cffb1[_0x9f6d('0x34')]);_0x1dddf2[_0x9f6d('0x3f')]=_[_0x9f6d('0x36')](_0x1dddf2['model'],_0x1dddf2[_0x9f6d('0x34')]);_0x5d8a4d[_0x9f6d('0x38')]=_[_0x9f6d('0x36')](_0x1dddf2[_0x9f6d('0x37')],qs['fields'](_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x5d8a4d[_0x9f6d('0x38')]=_0x5d8a4d[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x5d8a4d[_0x9f6d('0x38')]:_0x1dddf2['model'];_0x5d8a4d[_0x9f6d('0x3c')]=qs[_0x9f6d('0x3d')](_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x3d')]);_0x5d8a4d[_0x9f6d('0x3e')]=qs[_0x9f6d('0x3f')](_[_0x9f6d('0x52')](_0x1cffb1[_0x9f6d('0x34')],_0x1dddf2[_0x9f6d('0x3f')]));if(_0x1cffb1[_0x9f6d('0x34')]['filter']){_0x5d8a4d['where']=_[_0x9f6d('0x41')](_0x5d8a4d[_0x9f6d('0x3e')],{'$or':_[_0x9f6d('0x33')](_0x5d8a4d['attributes'],function(_0x4b1334){var _0x3e0c87={};_0x3e0c87[_0x4b1334]={'$like':'%'+_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x3e0c87;})});}_0x5d8a4d=_[_0x9f6d('0x41')]({},_0x5d8a4d,_0x1cffb1[_0x9f6d('0x43')]);return _0x5b4141['getSubjects'](_0x5d8a4d);}})[_0x9f6d('0x29')](function(_0xf0969c){if(_0xf0969c){_0x53b343=_0xf0969c['length'];if(!_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x50')]('nolimit')){_0x5d8a4d['limit']=qs[_0x9f6d('0x22')](_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x22')]);_0x5d8a4d[_0x9f6d('0x1f')]=qs['offset'](_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x1f')]);}return _0x5b4141[_0x9f6d('0x53')](_0x5d8a4d);}})['then'](function(_0x42c4de){if(_0x42c4de){return _0x42c4de?{'count':_0x53b343,'rows':_0x42c4de}:null;}})['then'](respondWithResult(_0x25e896,null))[_0x9f6d('0x48')](handleError(_0x25e896,null));};exports[_0x9f6d('0x54')]=function(_0x1b1fd9,_0x5361f2,_0x4d7eea){var _0x2d7356={};var _0x520567={};var _0x4ee590;var _0x4f3da2;return db[_0x9f6d('0x44')][_0x9f6d('0x51')]({'where':{'id':_0x1b1fd9[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x5361f2,null))[_0x9f6d('0x29')](function(_0x214f84){if(_0x214f84){_0x4ee590=_0x214f84;_0x520567['model']=_[_0x9f6d('0x35')](db[_0x9f6d('0x55')][_0x9f6d('0x2f')]);_0x520567[_0x9f6d('0x34')]=_['keys'](_0x1b1fd9['query']);_0x520567[_0x9f6d('0x3f')]=_[_0x9f6d('0x36')](_0x520567[_0x9f6d('0x37')],_0x520567[_0x9f6d('0x34')]);_0x2d7356['attributes']=_['intersection'](_0x520567[_0x9f6d('0x37')],qs[_0x9f6d('0x39')](_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x2d7356['attributes']=_0x2d7356[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x2d7356['attributes']:_0x520567['model'];_0x2d7356[_0x9f6d('0x3c')]=qs['sort'](_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x3d')]);_0x2d7356[_0x9f6d('0x3e')]=qs[_0x9f6d('0x3f')](_[_0x9f6d('0x52')](_0x1b1fd9[_0x9f6d('0x34')],_0x520567[_0x9f6d('0x3f')]));if(_0x1b1fd9[_0x9f6d('0x34')]['filter']){_0x2d7356[_0x9f6d('0x3e')]=_[_0x9f6d('0x41')](_0x2d7356[_0x9f6d('0x3e')],{'$or':_[_0x9f6d('0x33')](_0x2d7356[_0x9f6d('0x38')],function(_0x46e290){var _0x545b2d={};_0x545b2d[_0x46e290]={'$like':'%'+_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x545b2d;})});}_0x2d7356=_[_0x9f6d('0x41')]({},_0x2d7356,_0x1b1fd9[_0x9f6d('0x43')]);return _0x4ee590[_0x9f6d('0x54')](_0x2d7356);}})[_0x9f6d('0x29')](function(_0x3c8009){if(_0x3c8009){_0x4f3da2=_0x3c8009['length'];if(!_0x1b1fd9[_0x9f6d('0x34')]['hasOwnProperty'](_0x9f6d('0x3b'))){_0x2d7356[_0x9f6d('0x22')]=qs['limit'](_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x22')]);_0x2d7356[_0x9f6d('0x1f')]=qs[_0x9f6d('0x1f')](_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x1f')]);}return _0x4ee590['getDescriptions'](_0x2d7356);}})[_0x9f6d('0x29')](function(_0x45c048){if(_0x45c048){return _0x45c048?{'count':_0x4f3da2,'rows':_0x45c048}:null;}})[_0x9f6d('0x29')](respondWithResult(_0x5361f2,null))[_0x9f6d('0x48')](handleError(_0x5361f2,null));};exports[_0x9f6d('0x56')]=function(_0x52b8d7,_0x4f6933,_0x291f14){var _0x460f06={};var _0x52ba5c={};var _0x4f0f87;var _0x4aa6ad;return db[_0x9f6d('0x44')][_0x9f6d('0x51')]({'where':{'id':_0x52b8d7[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x4f6933,null))[_0x9f6d('0x29')](function(_0x18e367){if(_0x18e367){_0x4f0f87=_0x18e367;_0x52ba5c[_0x9f6d('0x37')]=_['keys'](db['Tag'][_0x9f6d('0x2f')]);_0x52ba5c['query']=_[_0x9f6d('0x35')](_0x52b8d7[_0x9f6d('0x34')]);_0x52ba5c[_0x9f6d('0x3f')]=_['intersection'](_0x52ba5c[_0x9f6d('0x37')],_0x52ba5c['query']);_0x460f06[_0x9f6d('0x38')]=_[_0x9f6d('0x36')](_0x52ba5c['model'],qs[_0x9f6d('0x39')](_0x52b8d7[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x460f06[_0x9f6d('0x38')]=_0x460f06['attributes'][_0x9f6d('0x3a')]?_0x460f06[_0x9f6d('0x38')]:_0x52ba5c[_0x9f6d('0x37')];_0x460f06['order']=qs['sort'](_0x52b8d7['query'][_0x9f6d('0x3d')]);_0x460f06['where']=qs[_0x9f6d('0x3f')](_[_0x9f6d('0x52')](_0x52b8d7['query'],_0x52ba5c[_0x9f6d('0x3f')]));if(_0x52b8d7[_0x9f6d('0x34')][_0x9f6d('0x40')]){_0x460f06[_0x9f6d('0x3e')]=_[_0x9f6d('0x41')](_0x460f06[_0x9f6d('0x3e')],{'$or':_[_0x9f6d('0x33')](_0x460f06['attributes'],function(_0x72a260){var _0x66d599={};_0x66d599[_0x72a260]={'$like':'%'+_0x52b8d7[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x66d599;})});}_0x460f06=_[_0x9f6d('0x41')]({},_0x460f06,_0x52b8d7[_0x9f6d('0x43')]);return _0x4f0f87[_0x9f6d('0x56')](_0x460f06);}})[_0x9f6d('0x29')](function(_0x2926f1){if(_0x2926f1){_0x4aa6ad=_0x2926f1[_0x9f6d('0x3a')];if(!_0x52b8d7['query'][_0x9f6d('0x50')](_0x9f6d('0x3b'))){_0x460f06['limit']=qs[_0x9f6d('0x22')](_0x52b8d7[_0x9f6d('0x34')][_0x9f6d('0x22')]);_0x460f06[_0x9f6d('0x1f')]=qs[_0x9f6d('0x1f')](_0x52b8d7['query'][_0x9f6d('0x1f')]);}return _0x4f0f87[_0x9f6d('0x56')](_0x460f06);}})[_0x9f6d('0x29')](function(_0x282e7f){if(_0x282e7f){return _0x282e7f?{'count':_0x4aa6ad,'rows':_0x282e7f}:null;}})[_0x9f6d('0x29')](respondWithResult(_0x4f6933,null))[_0x9f6d('0x48')](handleError(_0x4f6933,null));};exports[_0x9f6d('0x57')]=function(_0x409d6f,_0x6acc1c,_0x5c8650){if(_0x409d6f[_0x9f6d('0x4d')]['id']){delete _0x409d6f[_0x9f6d('0x4d')]['id'];}return db[_0x9f6d('0x44')]['findOne']({'where':{'id':_0x409d6f[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x6acc1c,null))['then'](function(_0x3d8578){if(_0x3d8578){return _0x3d8578[_0x9f6d('0x57')](_0x409d6f[_0x9f6d('0x4d')][_0x9f6d('0x58')]||[]);}return null;})[_0x9f6d('0x29')](respondWithResult(_0x6acc1c,null))['catch'](handleError(_0x6acc1c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 17ce981..8eb522c 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 _0x3c4c=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x16f55c,_0xe368a){var _0x19af68=function(_0x56a224){while(--_0x56a224){_0x16f55c['push'](_0x16f55c['shift']());}};_0x19af68(++_0xe368a);}(_0x3c4c,0x16c));var _0xc3c4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3c4c[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xc3c4('0x0'));var util=require('util');var logger=require(_0xc3c4('0x1'))(_0xc3c4('0x2'));var moment=require(_0xc3c4('0x3'));var BPromise=require(_0xc3c4('0x4'));var rp=require(_0xc3c4('0x5'));var fs=require('fs');var path=require(_0xc3c4('0x6'));var rimraf=require(_0xc3c4('0x7'));var config=require('../../config/environment');var attributes=require(_0xc3c4('0x8'));module[_0xc3c4('0x9')]=function(_0x5ae28f,_0x118d39){return _0x5ae28f[_0xc3c4('0xa')](_0xc3c4('0xb'),attributes,{'tableName':_0xc3c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf58=['exports','define','DeskConfiguration','lodash','util','moment','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x19de27,_0x412a80){var _0x28a0aa=function(_0x53fc52){while(--_0x53fc52){_0x19de27['push'](_0x19de27['shift']());}};_0x28a0aa(++_0x412a80);}(_0xaf58,0x1b1));var _0x8af5=function(_0x199582,_0x3e60ed){_0x199582=_0x199582-0x0;var _0xb27b3a=_0xaf58[_0x199582];return _0xb27b3a;};'use strict';var _=require(_0x8af5('0x0'));var util=require(_0x8af5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8af5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8af5('0x3'));var rimraf=require(_0x8af5('0x4'));var config=require(_0x8af5('0x5'));var attributes=require(_0x8af5('0x6'));module[_0x8af5('0x7')]=function(_0x5d4ee2,_0x4d8f30){return _0x5d4ee2[_0x8af5('0x8')](_0x8af5('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 04505c9..7e94325 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 _0x1d63=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x1d63,0xa4));var _0x31d6=function(_0x2b3ede,_0x1f0b82){_0x2b3ede=_0x2b3ede-0x0;var _0x55c914=_0x1d63[_0x2b3ede];return _0x55c914;};'use strict';var _=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var moment=require(_0x31d6('0x2'));var BPromise=require(_0x31d6('0x3'));var rs=require(_0x31d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31d6('0x5'))['db'];var utils=require(_0x31d6('0x6'));var logger=require(_0x31d6('0x7'))(_0x31d6('0x8'));var config=require(_0x31d6('0x9'));var jayson=require(_0x31d6('0xa'));var client=jayson[_0x31d6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b549,_0x6cc83b,_0x4fee16){return new BPromise(function(_0x34a5e3,_0x2c1b36){return client['request'](_0x36b549,_0x4fee16)['then'](function(_0x4b32f8){logger[_0x31d6('0xc')](_0x31d6('0xd'),_0x6cc83b,_0x31d6('0xe'));logger['debug'](_0x31d6('0xf'),_0x6cc83b,_0x31d6('0xe'),JSON[_0x31d6('0x10')](_0x4b32f8));if(_0x4b32f8[_0x31d6('0x11')]){if(_0x4b32f8[_0x31d6('0x11')]['code']===0x1f4){logger[_0x31d6('0x11')](_0x31d6('0xd'),_0x6cc83b,_0x4b32f8[_0x31d6('0x11')][_0x31d6('0x12')]);return _0x2c1b36(_0x4b32f8[_0x31d6('0x11')][_0x31d6('0x12')]);}logger['error'](_0x31d6('0xd'),_0x6cc83b,_0x4b32f8[_0x31d6('0x11')][_0x31d6('0x12')]);return _0x34a5e3(_0x4b32f8[_0x31d6('0x11')]['message']);}else{logger[_0x31d6('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x6cc83b,_0x31d6('0xe'));_0x34a5e3(_0x4b32f8[_0x31d6('0x13')][_0x31d6('0x12')]);}})[_0x31d6('0x14')](function(_0x189784){logger[_0x31d6('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x6cc83b,_0x189784);_0x2c1b36(_0x189784);});});} \ No newline at end of file +var _0xab00=['error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','stringify'];(function(_0x47933e,_0x454d00){var _0x3f5e20=function(_0x2202dc){while(--_0x2202dc){_0x47933e['push'](_0x47933e['shift']());}};_0x3f5e20(++_0x454d00);}(_0xab00,0x1b9));var _0x0ab0=function(_0x3e88f3,_0x4c7928){_0x3e88f3=_0x3e88f3-0x0;var _0x43b42d=_0xab00[_0x3e88f3];return _0x43b42d;};'use strict';var _=require(_0x0ab0('0x0'));var util=require(_0x0ab0('0x1'));var moment=require(_0x0ab0('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ab0('0x3'));var fs=require('fs');var Redis=require(_0x0ab0('0x4'));var db=require(_0x0ab0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ab0('0x6'))('rpc');var config=require(_0x0ab0('0x7'));var jayson=require(_0x0ab0('0x8'));var client=jayson[_0x0ab0('0x9')][_0x0ab0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x363359,_0x25742b,_0x59fb03){return new BPromise(function(_0x3e934d,_0x2cbb53){return client['request'](_0x363359,_0x59fb03)[_0x0ab0('0xb')](function(_0x4f4a28){logger[_0x0ab0('0xc')](_0x0ab0('0xd'),_0x25742b,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x25742b,'request\x20sent',JSON[_0x0ab0('0xe')](_0x4f4a28));if(_0x4f4a28['error']){if(_0x4f4a28[_0x0ab0('0xf')][_0x0ab0('0x10')]===0x1f4){logger['error'](_0x0ab0('0xd'),_0x25742b,_0x4f4a28[_0x0ab0('0xf')][_0x0ab0('0x11')]);return _0x2cbb53(_0x4f4a28[_0x0ab0('0xf')][_0x0ab0('0x11')]);}logger[_0x0ab0('0xf')](_0x0ab0('0xd'),_0x25742b,_0x4f4a28[_0x0ab0('0xf')][_0x0ab0('0x11')]);return _0x3e934d(_0x4f4a28[_0x0ab0('0xf')][_0x0ab0('0x11')]);}else{logger[_0x0ab0('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x25742b,'request\x20sent');_0x3e934d(_0x4f4a28['result'][_0x0ab0('0x11')]);}})[_0x0ab0('0x12')](function(_0x2f594b){logger['error'](_0x0ab0('0xd'),_0x25742b,_0x2f594b);_0x2cbb53(_0x2f594b);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6452c8b..8d35e9e 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 _0x5a3c=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x18f84c,_0x5a0ab8){var _0x1c234f=function(_0x2b7737){while(--_0x2b7737){_0x18f84c['push'](_0x18f84c['shift']());}};_0x1c234f(++_0x5a0ab8);}(_0x5a3c,0x176));var _0xc5a3=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x5a3c[_0x13b8f3];return _0x1a6d06;};'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 _0x11ec=['../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x24d8db,_0x2392c6){var _0x13d20d=function(_0x568f80){while(--_0x568f80){_0x24d8db['push'](_0x24d8db['shift']());}};_0x13d20d(++_0x2392c6);}(_0x11ec,0xda));var _0xc11e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x11ec[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0xc11e('0x0'));var util=require(_0xc11e('0x1'));var path=require(_0xc11e('0x2'));var timeout=require(_0xc11e('0x3'));var express=require(_0xc11e('0x4'));var router=express[_0xc11e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc11e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc11e('0x7'));var controller=require(_0xc11e('0x8'));router[_0xc11e('0x9')]('/',auth[_0xc11e('0xa')](),controller['index']);router[_0xc11e('0x9')](_0xc11e('0xb'),auth['isAuthenticated'](),controller[_0xc11e('0xc')]);router['post']('/',auth[_0xc11e('0xa')](),controller['create']);router['put'](_0xc11e('0xb'),auth[_0xc11e('0xa')](),controller['update']);router['delete'](_0xc11e('0xb'),auth[_0xc11e('0xa')](),controller[_0xc11e('0xd')]);module[_0xc11e('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 32721e8..77702af 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 _0x1522=['string','variable','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x2c0005,_0x3dcfe7){var _0x409ffd=function(_0x38e14d){while(--_0x38e14d){_0x2c0005['push'](_0x2c0005['shift']());}};_0x409ffd(++_0x3dcfe7);}(_0x1522,0xec));var _0x2152=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1522[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2152('0x0'));module['exports']={'type':{'type':Sequelize[_0x2152('0x1')](_0x2152('0x2'),_0x2152('0x3'),_0x2152('0x4'),_0x2152('0x5'),'picklist'),'defaultValue':_0x2152('0x2')},'content':{'type':Sequelize[_0x2152('0x6')]},'key':{'type':Sequelize[_0x2152('0x6')]},'keyType':{'type':Sequelize[_0x2152('0x1')]('string',_0x2152('0x3'),_0x2152('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2152('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2152('0x6')]}}; \ No newline at end of file +var _0x3396=['keyValue','picklist','customVariable','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x31b2d3,_0x2a787){var _0x583cfc=function(_0x12a86d){while(--_0x12a86d){_0x31b2d3['push'](_0x31b2d3['shift']());}};_0x583cfc(++_0x2a787);}(_0x3396,0x95));var _0x6339=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3396[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6339('0x0'));module['exports']={'type':{'type':Sequelize[_0x6339('0x1')](_0x6339('0x2'),_0x6339('0x3'),'customVariable',_0x6339('0x4'),_0x6339('0x5')),'defaultValue':_0x6339('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6339('0x1')]('string',_0x6339('0x3'),_0x6339('0x6'))},'keyContent':{'type':Sequelize[_0x6339('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6339('0x7')]},'customField':{'type':Sequelize[_0x6339('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6339('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1a764b9..732d2a5 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 _0xb9e3=['rows','catch','show','params','keys','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','reject','save','then','destroy','error','stack','name','send','DeskField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include'];(function(_0x3b8a32,_0x3c41dc){var _0xec0503=function(_0xde8fda){while(--_0xde8fda){_0x3b8a32['push'](_0x3b8a32['shift']());}};_0xec0503(++_0x3c41dc);}(_0xb9e3,0xdc));var _0x3b9e=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0xb9e3[_0x36bf88];return _0x332914;};'use strict';var emlformat=require(_0x3b9e('0x0'));var rimraf=require(_0x3b9e('0x1'));var zipdir=require(_0x3b9e('0x2'));var jsonpatch=require(_0x3b9e('0x3'));var rp=require(_0x3b9e('0x4'));var moment=require('moment');var BPromise=require(_0x3b9e('0x5'));var Mustache=require(_0x3b9e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b9e('0x7'));var fs=require('fs');var fs_extra=require(_0x3b9e('0x8'));var _=require('lodash');var squel=require(_0x3b9e('0x9'));var crypto=require(_0x3b9e('0xa'));var jsforce=require(_0x3b9e('0xb'));var deskjs=require(_0x3b9e('0xc'));var toCsv=require(_0x3b9e('0xd'));var querystring=require(_0x3b9e('0xe'));var Papa=require('papaparse');var Redis=require(_0x3b9e('0xf'));var authService=require(_0x3b9e('0x10'));var qs=require(_0x3b9e('0x11'));var as=require(_0x3b9e('0x12'));var hardwareService=require(_0x3b9e('0x13'));var logger=require('../../config/logger')(_0x3b9e('0x14'));var utils=require(_0x3b9e('0x15'));var config=require(_0x3b9e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b9e('0x17'))['db'];function respondWithStatusCode(_0x1cd6bc,_0x31cbf3){_0x31cbf3=_0x31cbf3||0xcc;return function(_0x32aa24){if(_0x32aa24){return _0x1cd6bc[_0x3b9e('0x18')](_0x31cbf3);}return _0x1cd6bc[_0x3b9e('0x19')](_0x31cbf3)['end']();};}function respondWithResult(_0x1c5c69,_0x3188b4){_0x3188b4=_0x3188b4||0xc8;return function(_0xf4afac){if(_0xf4afac){return _0x1c5c69[_0x3b9e('0x19')](_0x3188b4)[_0x3b9e('0x1a')](_0xf4afac);}};}function respondWithFilteredResult(_0x2c4d75,_0x366f9a){return function(_0x1336f0){if(_0x1336f0){var _0x5f50d1=typeof _0x366f9a['offset']===_0x3b9e('0x1b')&&typeof _0x366f9a[_0x3b9e('0x1c')]===_0x3b9e('0x1b');var _0x1ec65e=_0x1336f0['count'];var _0x24984b=_0x5f50d1?0x0:_0x366f9a['offset'];var _0x21fb05=_0x5f50d1?_0x1336f0['count']:_0x366f9a[_0x3b9e('0x1d')]+_0x366f9a[_0x3b9e('0x1c')];var _0x30f9cc;if(_0x21fb05>=_0x1ec65e){_0x21fb05=_0x1ec65e;_0x30f9cc=0xc8;}else{_0x30f9cc=0xce;}_0x2c4d75['status'](_0x30f9cc);return _0x2c4d75[_0x3b9e('0x1e')]('Content-Range',_0x24984b+'-'+_0x21fb05+'/'+_0x1ec65e)[_0x3b9e('0x1a')](_0x1336f0);}return null;};}function patchUpdates(_0x29b958){return function(_0xf12d62){try{jsonpatch[_0x3b9e('0x1f')](_0xf12d62,_0x29b958,!![]);}catch(_0x183ab9){return BPromise[_0x3b9e('0x20')](_0x183ab9);}return _0xf12d62[_0x3b9e('0x21')]();};}function saveUpdates(_0xe9b77e,_0x43baa7){return function(_0xc10506){if(_0xc10506){return _0xc10506['update'](_0xe9b77e)[_0x3b9e('0x22')](function(_0x49b1f1){return _0x49b1f1;});}return null;};}function removeEntity(_0x3f935b,_0x18720e){return function(_0x53707c){if(_0x53707c){return _0x53707c[_0x3b9e('0x23')]()[_0x3b9e('0x22')](function(){_0x3f935b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc078cc,_0x6b3d25){return function(_0x49e15e){if(!_0x49e15e){_0xc078cc['sendStatus'](0x194);}return _0x49e15e;};}function handleError(_0x368ff7,_0x500e8d){_0x500e8d=_0x500e8d||0x1f4;return function(_0x38d238){logger[_0x3b9e('0x24')](_0x38d238[_0x3b9e('0x25')]);if(_0x38d238[_0x3b9e('0x26')]){delete _0x38d238[_0x3b9e('0x26')];}_0x368ff7['status'](_0x500e8d)[_0x3b9e('0x27')](_0x38d238);};}exports['index']=function(_0x555f15,_0x131181){var _0x313be6={},_0x18c9dc={},_0x4552ba={'count':0x0,'rows':[]};var _0x358c55=_['map'](db[_0x3b9e('0x28')][_0x3b9e('0x29')],function(_0x443afd){return{'name':_0x443afd[_0x3b9e('0x2a')],'type':_0x443afd[_0x3b9e('0x2b')][_0x3b9e('0x2c')]};});_0x18c9dc[_0x3b9e('0x2d')]=_[_0x3b9e('0x2e')](_0x358c55,_0x3b9e('0x26'));_0x18c9dc[_0x3b9e('0x2f')]=_['keys'](_0x555f15[_0x3b9e('0x2f')]);_0x18c9dc[_0x3b9e('0x30')]=_['intersection'](_0x18c9dc[_0x3b9e('0x2d')],_0x18c9dc[_0x3b9e('0x2f')]);_0x313be6[_0x3b9e('0x31')]=_['intersection'](_0x18c9dc[_0x3b9e('0x2d')],qs['fields'](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x32')]));_0x313be6[_0x3b9e('0x31')]=_0x313be6[_0x3b9e('0x31')][_0x3b9e('0x33')]?_0x313be6[_0x3b9e('0x31')]:_0x18c9dc[_0x3b9e('0x2d')];if(!_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x34')](_0x3b9e('0x35'))){_0x313be6['limit']=qs[_0x3b9e('0x1c')](_0x555f15['query'][_0x3b9e('0x1c')]);_0x313be6['offset']=qs[_0x3b9e('0x1d')](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x1d')]);}_0x313be6[_0x3b9e('0x36')]=qs[_0x3b9e('0x37')](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x37')]);_0x313be6[_0x3b9e('0x38')]=qs['filters'](_['pick'](_0x555f15[_0x3b9e('0x2f')],_0x18c9dc[_0x3b9e('0x30')]),_0x358c55);if(_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x39')]){_0x313be6['where']=_[_0x3b9e('0x3a')](_0x313be6[_0x3b9e('0x38')],{'$or':_[_0x3b9e('0x2e')](_0x358c55,function(_0x170e7c){if(_0x170e7c[_0x3b9e('0x2b')]!==_0x3b9e('0x3b')){var _0x2c4823={};_0x2c4823[_0x170e7c['name']]={'$like':'%'+_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x39')]+'%'};return _0x2c4823;}})});}_0x313be6=_[_0x3b9e('0x3a')]({},_0x313be6,_0x555f15[_0x3b9e('0x3c')]);var _0x17fae2={'where':_0x313be6[_0x3b9e('0x38')]};return db[_0x3b9e('0x28')][_0x3b9e('0x3d')](_0x17fae2)['then'](function(_0x2a9c73){_0x4552ba[_0x3b9e('0x3d')]=_0x2a9c73;if(_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x3e')]){_0x313be6[_0x3b9e('0x3f')]=[{'all':!![]}];}return db[_0x3b9e('0x28')]['findAll'](_0x313be6);})[_0x3b9e('0x22')](function(_0x596c86){_0x4552ba[_0x3b9e('0x40')]=_0x596c86;return _0x4552ba;})['then'](respondWithFilteredResult(_0x131181,_0x313be6))[_0x3b9e('0x41')](handleError(_0x131181,null));};exports[_0x3b9e('0x42')]=function(_0xcd8ca7,_0x2a93ef){var _0x3ca523={'raw':!![],'where':{'id':_0xcd8ca7[_0x3b9e('0x43')]['id']}},_0x2a33d6={};_0x2a33d6[_0x3b9e('0x2d')]=_[_0x3b9e('0x44')](db[_0x3b9e('0x28')][_0x3b9e('0x29')]);_0x2a33d6[_0x3b9e('0x2f')]=_[_0x3b9e('0x44')](_0xcd8ca7[_0x3b9e('0x2f')]);_0x2a33d6[_0x3b9e('0x30')]=_['intersection'](_0x2a33d6[_0x3b9e('0x2d')],_0x2a33d6[_0x3b9e('0x2f')]);_0x3ca523[_0x3b9e('0x31')]=_['intersection'](_0x2a33d6[_0x3b9e('0x2d')],qs[_0x3b9e('0x32')](_0xcd8ca7[_0x3b9e('0x2f')][_0x3b9e('0x32')]));_0x3ca523[_0x3b9e('0x31')]=_0x3ca523['attributes'][_0x3b9e('0x33')]?_0x3ca523[_0x3b9e('0x31')]:_0x2a33d6[_0x3b9e('0x2d')];if(_0xcd8ca7['query']['includeAll']){_0x3ca523[_0x3b9e('0x3f')]=[{'all':!![]}];}_0x3ca523=_[_0x3b9e('0x3a')]({},_0x3ca523,_0xcd8ca7[_0x3b9e('0x3c')]);return db[_0x3b9e('0x28')]['find'](_0x3ca523)[_0x3b9e('0x22')](handleEntityNotFound(_0x2a93ef,null))[_0x3b9e('0x22')](respondWithResult(_0x2a93ef,null))[_0x3b9e('0x41')](handleError(_0x2a93ef,null));};exports[_0x3b9e('0x45')]=function(_0x2fd720,_0x10a52d){return db[_0x3b9e('0x28')][_0x3b9e('0x45')](_0x2fd720[_0x3b9e('0x46')],{})[_0x3b9e('0x22')](respondWithResult(_0x10a52d,0xc9))['catch'](handleError(_0x10a52d,null));};exports['update']=function(_0x2159c1,_0x5f1920){if(_0x2159c1[_0x3b9e('0x46')]['id']){delete _0x2159c1['body']['id'];}return db[_0x3b9e('0x28')]['find']({'where':{'id':_0x2159c1[_0x3b9e('0x43')]['id']}})[_0x3b9e('0x22')](handleEntityNotFound(_0x5f1920,null))[_0x3b9e('0x22')](saveUpdates(_0x2159c1['body'],null))['then'](respondWithResult(_0x5f1920,null))['catch'](handleError(_0x5f1920,null));};exports[_0x3b9e('0x23')]=function(_0x377b45,_0x582d2){return db[_0x3b9e('0x28')]['find']({'where':{'id':_0x377b45[_0x3b9e('0x43')]['id']}})[_0x3b9e('0x22')](handleEntityNotFound(_0x582d2,null))[_0x3b9e('0x22')](removeEntity(_0x582d2,null))[_0x3b9e('0x41')](handleError(_0x582d2,null));}; \ No newline at end of file +var _0xf198=['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','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','DeskField','key','keys','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','includeAll','catch','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0xf198,0xd1));var _0x8f19=function(_0x522974,_0x4245f3){_0x522974=_0x522974-0x0;var _0x332fb4=_0xf198[_0x522974];return _0x332fb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f19('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f19('0x1'));var rp=require(_0x8f19('0x2'));var moment=require(_0x8f19('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8f19('0x4'));var util=require(_0x8f19('0x5'));var path=require(_0x8f19('0x6'));var sox=require(_0x8f19('0x7'));var csv=require(_0x8f19('0x8'));var ejs=require(_0x8f19('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f19('0xa'));var squel=require(_0x8f19('0xb'));var crypto=require(_0x8f19('0xc'));var jsforce=require(_0x8f19('0xd'));var deskjs=require(_0x8f19('0xe'));var toCsv=require(_0x8f19('0x8'));var querystring=require('querystring');var Papa=require(_0x8f19('0xf'));var Redis=require(_0x8f19('0x10'));var authService=require(_0x8f19('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8f19('0x12'));var hardwareService=require(_0x8f19('0x13'));var logger=require(_0x8f19('0x14'))(_0x8f19('0x15'));var utils=require('../../config/utils');var config=require(_0x8f19('0x16'));var licenseUtil=require(_0x8f19('0x17'));var db=require(_0x8f19('0x18'))['db'];function respondWithStatusCode(_0x1afe2f,_0x18cb33){_0x18cb33=_0x18cb33||0xcc;return function(_0xd01cf6){if(_0xd01cf6){return _0x1afe2f[_0x8f19('0x19')](_0x18cb33);}return _0x1afe2f[_0x8f19('0x1a')](_0x18cb33)['end']();};}function respondWithResult(_0x19a6f2,_0x3d4e76){_0x3d4e76=_0x3d4e76||0xc8;return function(_0x3df500){if(_0x3df500){return _0x19a6f2[_0x8f19('0x1a')](_0x3d4e76)[_0x8f19('0x1b')](_0x3df500);}};}function respondWithFilteredResult(_0x47bae1,_0x81f091){return function(_0x31d441){if(_0x31d441){var _0x43e309=typeof _0x81f091[_0x8f19('0x1c')]===_0x8f19('0x1d')&&typeof _0x81f091[_0x8f19('0x1e')]==='undefined';var _0x5ab156=_0x31d441[_0x8f19('0x1f')];var _0x578607=_0x43e309?0x0:_0x81f091['offset'];var _0x5c3b69=_0x43e309?_0x31d441[_0x8f19('0x1f')]:_0x81f091[_0x8f19('0x1c')]+_0x81f091[_0x8f19('0x1e')];var _0x15df5b;if(_0x5c3b69>=_0x5ab156){_0x5c3b69=_0x5ab156;_0x15df5b=0xc8;}else{_0x15df5b=0xce;}_0x47bae1['status'](_0x15df5b);return _0x47bae1[_0x8f19('0x20')]('Content-Range',_0x578607+'-'+_0x5c3b69+'/'+_0x5ab156)[_0x8f19('0x1b')](_0x31d441);}return null;};}function patchUpdates(_0x16d351){return function(_0x151ad7){try{jsonpatch[_0x8f19('0x21')](_0x151ad7,_0x16d351,!![]);}catch(_0x5348cf){return BPromise[_0x8f19('0x22')](_0x5348cf);}return _0x151ad7[_0x8f19('0x23')]();};}function saveUpdates(_0x5d99a0,_0x2a0ab0){return function(_0x2b5852){if(_0x2b5852){return _0x2b5852['update'](_0x5d99a0)[_0x8f19('0x24')](function(_0x5b00fe){return _0x5b00fe;});}return null;};}function removeEntity(_0xe66f7c,_0x4d340d){return function(_0x409449){if(_0x409449){return _0x409449[_0x8f19('0x25')]()[_0x8f19('0x24')](function(){_0xe66f7c[_0x8f19('0x1a')](0xcc)[_0x8f19('0x26')]();});}};}function handleEntityNotFound(_0x2a8395,_0x5854ac){return function(_0x4c2e19){if(!_0x4c2e19){_0x2a8395[_0x8f19('0x19')](0x194);}return _0x4c2e19;};}function handleError(_0x11d990,_0x41b5d5){_0x41b5d5=_0x41b5d5||0x1f4;return function(_0x59a812){logger[_0x8f19('0x27')](_0x59a812[_0x8f19('0x28')]);if(_0x59a812[_0x8f19('0x29')]){delete _0x59a812[_0x8f19('0x29')];}_0x11d990['status'](_0x41b5d5)[_0x8f19('0x2a')](_0x59a812);};}exports[_0x8f19('0x2b')]=function(_0x282980,_0x365210){var _0x4ab178={},_0x101d71={},_0x2b150e={'count':0x0,'rows':[]};var _0x38ee66=_[_0x8f19('0x2c')](db[_0x8f19('0x2d')]['rawAttributes'],function(_0x251171){return{'name':_0x251171['fieldName'],'type':_0x251171['type'][_0x8f19('0x2e')]};});_0x101d71['model']=_[_0x8f19('0x2c')](_0x38ee66,_0x8f19('0x29'));_0x101d71['query']=_[_0x8f19('0x2f')](_0x282980[_0x8f19('0x30')]);_0x101d71[_0x8f19('0x31')]=_['intersection'](_0x101d71['model'],_0x101d71[_0x8f19('0x30')]);_0x4ab178[_0x8f19('0x32')]=_[_0x8f19('0x33')](_0x101d71[_0x8f19('0x34')],qs[_0x8f19('0x35')](_0x282980[_0x8f19('0x30')][_0x8f19('0x35')]));_0x4ab178[_0x8f19('0x32')]=_0x4ab178[_0x8f19('0x32')][_0x8f19('0x36')]?_0x4ab178['attributes']:_0x101d71['model'];if(!_0x282980['query']['hasOwnProperty'](_0x8f19('0x37'))){_0x4ab178[_0x8f19('0x1e')]=qs[_0x8f19('0x1e')](_0x282980[_0x8f19('0x30')][_0x8f19('0x1e')]);_0x4ab178[_0x8f19('0x1c')]=qs['offset'](_0x282980['query'][_0x8f19('0x1c')]);}_0x4ab178[_0x8f19('0x38')]=qs['sort'](_0x282980[_0x8f19('0x30')][_0x8f19('0x39')]);_0x4ab178['where']=qs[_0x8f19('0x31')](_['pick'](_0x282980['query'],_0x101d71[_0x8f19('0x31')]),_0x38ee66);if(_0x282980[_0x8f19('0x30')]['filter']){_0x4ab178[_0x8f19('0x3a')]=_[_0x8f19('0x3b')](_0x4ab178[_0x8f19('0x3a')],{'$or':_[_0x8f19('0x2c')](_0x38ee66,function(_0x52811f){if(_0x52811f[_0x8f19('0x3c')]!==_0x8f19('0x3d')){var _0x3d9e26={};_0x3d9e26[_0x52811f[_0x8f19('0x29')]]={'$like':'%'+_0x282980[_0x8f19('0x30')][_0x8f19('0x3e')]+'%'};return _0x3d9e26;}})});}_0x4ab178=_[_0x8f19('0x3b')]({},_0x4ab178,_0x282980[_0x8f19('0x3f')]);var _0x13c77a={'where':_0x4ab178['where']};return db[_0x8f19('0x2d')][_0x8f19('0x1f')](_0x13c77a)[_0x8f19('0x24')](function(_0x53a79d){_0x2b150e[_0x8f19('0x1f')]=_0x53a79d;if(_0x282980[_0x8f19('0x30')]['includeAll']){_0x4ab178[_0x8f19('0x40')]=[{'all':!![]}];}return db[_0x8f19('0x2d')]['findAll'](_0x4ab178);})[_0x8f19('0x24')](function(_0x3377b1){_0x2b150e[_0x8f19('0x41')]=_0x3377b1;return _0x2b150e;})[_0x8f19('0x24')](respondWithFilteredResult(_0x365210,_0x4ab178))['catch'](handleError(_0x365210,null));};exports[_0x8f19('0x42')]=function(_0x4750b5,_0x49200c){var _0x53aa13={'raw':!![],'where':{'id':_0x4750b5[_0x8f19('0x43')]['id']}},_0x37d8bd={};_0x37d8bd[_0x8f19('0x34')]=_[_0x8f19('0x2f')](db['DeskField'][_0x8f19('0x44')]);_0x37d8bd[_0x8f19('0x30')]=_['keys'](_0x4750b5['query']);_0x37d8bd[_0x8f19('0x31')]=_[_0x8f19('0x33')](_0x37d8bd[_0x8f19('0x34')],_0x37d8bd[_0x8f19('0x30')]);_0x53aa13[_0x8f19('0x32')]=_[_0x8f19('0x33')](_0x37d8bd[_0x8f19('0x34')],qs[_0x8f19('0x35')](_0x4750b5[_0x8f19('0x30')][_0x8f19('0x35')]));_0x53aa13['attributes']=_0x53aa13[_0x8f19('0x32')][_0x8f19('0x36')]?_0x53aa13[_0x8f19('0x32')]:_0x37d8bd[_0x8f19('0x34')];if(_0x4750b5[_0x8f19('0x30')][_0x8f19('0x45')]){_0x53aa13['include']=[{'all':!![]}];}_0x53aa13=_['merge']({},_0x53aa13,_0x4750b5['options']);return db['DeskField']['find'](_0x53aa13)[_0x8f19('0x24')](handleEntityNotFound(_0x49200c,null))[_0x8f19('0x24')](respondWithResult(_0x49200c,null))[_0x8f19('0x46')](handleError(_0x49200c,null));};exports[_0x8f19('0x47')]=function(_0x383890,_0x57c5d6){return db['DeskField'][_0x8f19('0x47')](_0x383890['body'],{})[_0x8f19('0x24')](respondWithResult(_0x57c5d6,0xc9))[_0x8f19('0x46')](handleError(_0x57c5d6,null));};exports['update']=function(_0x3e664f,_0x3f4df5){if(_0x3e664f['body']['id']){delete _0x3e664f[_0x8f19('0x48')]['id'];}return db['DeskField'][_0x8f19('0x49')]({'where':{'id':_0x3e664f[_0x8f19('0x43')]['id']}})[_0x8f19('0x24')](handleEntityNotFound(_0x3f4df5,null))[_0x8f19('0x24')](saveUpdates(_0x3e664f[_0x8f19('0x48')],null))[_0x8f19('0x24')](respondWithResult(_0x3f4df5,null))['catch'](handleError(_0x3f4df5,null));};exports[_0x8f19('0x25')]=function(_0x36dae5,_0xe179ee){return db[_0x8f19('0x2d')][_0x8f19('0x49')]({'where':{'id':_0x36dae5[_0x8f19('0x43')]['id']}})[_0x8f19('0x24')](handleEntityNotFound(_0xe179ee,null))[_0x8f19('0x24')](removeEntity(_0xe179ee,null))[_0x8f19('0x46')](handleError(_0xe179ee,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e6fc157..d613c82 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 _0xefa8=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x1df26b,_0x3e5093){var _0x1a508e=function(_0x4c5dad){while(--_0x4c5dad){_0x1df26b['push'](_0x1df26b['shift']());}};_0x1a508e(++_0x3e5093);}(_0xefa8,0x112));var _0x8efa=function(_0x32a7a3,_0x2f11ed){_0x32a7a3=_0x32a7a3-0x0;var _0x4201bf=_0xefa8[_0x32a7a3];return _0x4201bf;};'use strict';var _=require(_0x8efa('0x0'));var util=require(_0x8efa('0x1'));var logger=require(_0x8efa('0x2'))(_0x8efa('0x3'));var moment=require(_0x8efa('0x4'));var BPromise=require(_0x8efa('0x5'));var rp=require(_0x8efa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8efa('0x7'));var config=require('../../config/environment');var attributes=require(_0x8efa('0x8'));module[_0x8efa('0x9')]=function(_0x541842,_0x2cf4ab){return _0x541842[_0x8efa('0xa')](_0x8efa('0xb'),attributes,{'tableName':_0x8efa('0xc'),'paranoid':![],'indexes':[{'name':_0x8efa('0xd'),'fields':[_0x8efa('0xe'),_0x8efa('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44d1=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields'];(function(_0x89b526,_0x4904a3){var _0x585f23=function(_0x3b6d55){while(--_0x3b6d55){_0x89b526['push'](_0x89b526['shift']());}};_0x585f23(++_0x4904a3);}(_0x44d1,0x1a2));var _0x144d=function(_0x32eafc,_0x250586){_0x32eafc=_0x32eafc-0x0;var _0x48ffa2=_0x44d1[_0x32eafc];return _0x48ffa2;};'use strict';var _=require(_0x144d('0x0'));var util=require(_0x144d('0x1'));var logger=require(_0x144d('0x2'))(_0x144d('0x3'));var moment=require(_0x144d('0x4'));var BPromise=require(_0x144d('0x5'));var rp=require(_0x144d('0x6'));var fs=require('fs');var path=require(_0x144d('0x7'));var rimraf=require(_0x144d('0x8'));var config=require(_0x144d('0x9'));var attributes=require(_0x144d('0xa'));module[_0x144d('0xb')]=function(_0x436c5e,_0x33352b){return _0x436c5e['define'](_0x144d('0xc'),attributes,{'tableName':_0x144d('0xd'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x144d('0xe'),_0x144d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 21cce52..2c9a1b4 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 _0x9fe6=['code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x9fe6,0x1bc));var _0x69fe=function(_0x3ad850,_0x4d8004){_0x3ad850=_0x3ad850-0x0;var _0x5326ab=_0x9fe6[_0x3ad850];return _0x5326ab;};'use strict';var _=require('lodash');var util=require(_0x69fe('0x0'));var moment=require(_0x69fe('0x1'));var BPromise=require(_0x69fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69fe('0x3'));var db=require(_0x69fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x69fe('0x5'))(_0x69fe('0x6'));var config=require('../../config/environment');var jayson=require(_0x69fe('0x7'));var client=jayson[_0x69fe('0x8')][_0x69fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd2e696,_0x1c1f2f,_0xf22e83){return new BPromise(function(_0xb7312c,_0x1e90af){return client[_0x69fe('0xa')](_0xd2e696,_0xf22e83)[_0x69fe('0xb')](function(_0x3a83de){logger[_0x69fe('0xc')](_0x69fe('0xd'),_0x1c1f2f,'request\x20sent');logger['debug'](_0x69fe('0xe'),_0x1c1f2f,_0x69fe('0xf'),JSON[_0x69fe('0x10')](_0x3a83de));if(_0x3a83de[_0x69fe('0x11')]){if(_0x3a83de[_0x69fe('0x11')][_0x69fe('0x12')]===0x1f4){logger[_0x69fe('0x11')](_0x69fe('0xd'),_0x1c1f2f,_0x3a83de['error']['message']);return _0x1e90af(_0x3a83de[_0x69fe('0x11')][_0x69fe('0x13')]);}logger[_0x69fe('0x11')](_0x69fe('0xd'),_0x1c1f2f,_0x3a83de['error'][_0x69fe('0x13')]);return _0xb7312c(_0x3a83de[_0x69fe('0x11')]['message']);}else{logger['info'](_0x69fe('0xd'),_0x1c1f2f,_0x69fe('0xf'));_0xb7312c(_0x3a83de[_0x69fe('0x14')][_0x69fe('0x13')]);}})[_0x69fe('0x15')](function(_0x3440c7){logger['error'](_0x69fe('0xd'),_0x1c1f2f,_0x3440c7);_0x1e90af(_0x3440c7);});});} \ No newline at end of file +var _0xc385=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x56ba84,_0x260dff){var _0x51e991=function(_0x35e115){while(--_0x35e115){_0x56ba84['push'](_0x56ba84['shift']());}};_0x51e991(++_0x260dff);}(_0xc385,0x99));var _0x5c38=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc385[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x5c38('0x0'));var util=require('util');var moment=require(_0x5c38('0x1'));var BPromise=require(_0x5c38('0x2'));var rs=require(_0x5c38('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c38('0x4'));var logger=require('../../config/logger')(_0x5c38('0x5'));var config=require(_0x5c38('0x6'));var jayson=require(_0x5c38('0x7'));var client=jayson[_0x5c38('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d329b,_0x40e510,_0x44865e){return new BPromise(function(_0x354829,_0x373ebf){return client[_0x5c38('0x9')](_0x1d329b,_0x44865e)[_0x5c38('0xa')](function(_0x432d77){logger[_0x5c38('0xb')](_0x5c38('0xc'),_0x40e510,_0x5c38('0xd'));logger[_0x5c38('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x40e510,_0x5c38('0xd'),JSON[_0x5c38('0xf')](_0x432d77));if(_0x432d77[_0x5c38('0x10')]){if(_0x432d77[_0x5c38('0x10')][_0x5c38('0x11')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x40e510,_0x432d77[_0x5c38('0x10')][_0x5c38('0x12')]);return _0x373ebf(_0x432d77['error'][_0x5c38('0x12')]);}logger['error'](_0x5c38('0xc'),_0x40e510,_0x432d77[_0x5c38('0x10')][_0x5c38('0x12')]);return _0x354829(_0x432d77[_0x5c38('0x10')][_0x5c38('0x12')]);}else{logger[_0x5c38('0xb')]('DeskField,\x20%s,\x20%s',_0x40e510,'request\x20sent');_0x354829(_0x432d77[_0x5c38('0x13')][_0x5c38('0x12')]);}})[_0x5c38('0x14')](function(_0x57ba63){logger['error'](_0x5c38('0xc'),_0x40e510,_0x57ba63);_0x373ebf(_0x57ba63);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 27cf12e..2b681da 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 _0x7c8f=['create','/:id/configurations','addConfiguration','put','delete','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post'];(function(_0x132a19,_0x26fae6){var _0x33bf22=function(_0xf80837){while(--_0xf80837){_0x132a19['push'](_0x132a19['shift']());}};_0x33bf22(++_0x26fae6);}(_0x7c8f,0x1bf));var _0xf7c8=function(_0x232bfe,_0x20b341){_0x232bfe=_0x232bfe-0x0;var _0x2944dc=_0x7c8f[_0x232bfe];return _0x2944dc;};'use strict';var multer=require('multer');var util=require(_0xf7c8('0x0'));var path=require(_0xf7c8('0x1'));var timeout=require(_0xf7c8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf7c8('0x3'));var auth=require(_0xf7c8('0x4'));var interaction=require(_0xf7c8('0x5'));var config=require(_0xf7c8('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xf7c8('0x7')]('/',auth[_0xf7c8('0x8')](),controller[_0xf7c8('0x9')]);router['get'](_0xf7c8('0xa'),auth[_0xf7c8('0x8')](),controller[_0xf7c8('0xb')]);router[_0xf7c8('0x7')]('/:id/configurations',auth[_0xf7c8('0x8')](),controller[_0xf7c8('0xc')]);router['get'](_0xf7c8('0xd'),auth[_0xf7c8('0x8')](),controller['getFields']);router[_0xf7c8('0xe')]('/',auth[_0xf7c8('0x8')](),controller[_0xf7c8('0xf')]);router[_0xf7c8('0xe')](_0xf7c8('0x10'),auth[_0xf7c8('0x8')](),controller[_0xf7c8('0x11')]);router[_0xf7c8('0x12')](_0xf7c8('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xf7c8('0x13')]('/:id',auth[_0xf7c8('0x8')](),controller['destroy']);module[_0xf7c8('0x14')]=router; \ No newline at end of file +var _0x0c94=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xa07844,_0x575425){var _0x112cb2=function(_0x413648){while(--_0x413648){_0xa07844['push'](_0xa07844['shift']());}};_0x112cb2(++_0x575425);}(_0x0c94,0xeb));var _0x40c9=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x0c94[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0x40c9('0x0'));var util=require(_0x40c9('0x1'));var path=require('path');var timeout=require(_0x40c9('0x2'));var express=require(_0x40c9('0x3'));var router=express[_0x40c9('0x4')]();var fs_extra=require(_0x40c9('0x5'));var auth=require(_0x40c9('0x6'));var interaction=require(_0x40c9('0x7'));var config=require(_0x40c9('0x8'));var controller=require(_0x40c9('0x9'));router[_0x40c9('0xa')]('/',auth[_0x40c9('0xb')](),controller['index']);router[_0x40c9('0xa')](_0x40c9('0xc'),auth[_0x40c9('0xb')](),controller[_0x40c9('0xd')]);router['get'](_0x40c9('0xe'),auth['isAuthenticated'](),controller[_0x40c9('0xf')]);router[_0x40c9('0xa')](_0x40c9('0x10'),auth[_0x40c9('0xb')](),controller[_0x40c9('0x11')]);router['post']('/',auth[_0x40c9('0xb')](),controller[_0x40c9('0x12')]);router['post'](_0x40c9('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x40c9('0xb')](),controller[_0x40c9('0x13')]);router[_0x40c9('0x14')](_0x40c9('0xc'),auth[_0x40c9('0xb')](),controller['destroy']);module[_0x40c9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a200f0a..89e9363 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 _0x5e0e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x5e0e,0x89));var _0xe5e0=function(_0x470e3f,_0x3b513d){_0x470e3f=_0x470e3f-0x0;var _0x4fd22b=_0x5e0e[_0x470e3f];return _0x4fd22b;};'use strict';var Sequelize=require(_0xe5e0('0x0'));module[_0xe5e0('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe5e0('0x2')]},'password':{'type':Sequelize[_0xe5e0('0x2')]},'remoteUri':{'type':Sequelize[_0xe5e0('0x2')]},'tenantId':{'type':Sequelize[_0xe5e0('0x2')]},'clientId':{'type':Sequelize[_0xe5e0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe5e0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xe5e0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb3d8=['BOOLEAN','exports','STRING'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x4ce59e,_0x17e3b7){_0x4ce59e=_0x4ce59e-0x0;var _0x31a6a9=_0xb3d8[_0x4ce59e];return _0x31a6a9;};'use strict';var Sequelize=require('sequelize');module[_0x8b3d('0x0')]={'name':{'type':Sequelize[_0x8b3d('0x1')]},'username':{'type':Sequelize[_0x8b3d('0x1')]},'password':{'type':Sequelize[_0x8b3d('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8b3d('0x1')]},'clientSecret':{'type':Sequelize[_0x8b3d('0x1')]},'serverUrl':{'type':Sequelize[_0x8b3d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8b3d('0x1')]},'modernAuthentication':{'type':Sequelize[_0x8b3d('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 5f0f5ba..3f12ca1 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 _0xce33=['channel','Descriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidyominame','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','/oauth2/token','GET','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','undefined','offset','count','limit','set','Content-Range','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','keys','filters','model','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','rawAttributes','includeAll','find','body','update','getConfigurations','findOne','Dynamics365Configuration','options','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0x1fffd5,_0x511356){var _0x2da2dd=function(_0x493bb3){while(--_0x493bb3){_0x1fffd5['push'](_0x1fffd5['shift']());}};_0x2da2dd(++_0x511356);}(_0xce33,0x1f3));var _0x3ce3=function(_0x14ad92,_0x3b4315){_0x14ad92=_0x14ad92-0x0;var _0x41ceae=_0xce33[_0x14ad92];return _0x41ceae;};'use strict';var rp=require('request-promise');var util=require(_0x3ce3('0x0'));var _=require(_0x3ce3('0x1'));var qs=require(_0x3ce3('0x2'));var logger=require(_0x3ce3('0x3'))(_0x3ce3('0x4'));var db=require(_0x3ce3('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x77fbbf,_0x1b5019){_0x1b5019=_0x1b5019||0xc8;return function(_0x425aa8){if(_0x425aa8){return _0x77fbbf[_0x3ce3('0x6')](_0x1b5019)[_0x3ce3('0x7')](_0x425aa8);}};}function respondWithFilteredResult(_0x53bb8e,_0x205ba){return function(_0x289739){if(_0x289739){var _0x923bc3=typeof _0x205ba['offset']===_0x3ce3('0x8')&&typeof _0x205ba['limit']==='undefined';var _0x15b20b=_0x289739['count'];var _0x20c760=_0x923bc3?0x0:_0x205ba[_0x3ce3('0x9')];var _0x160be5=_0x923bc3?_0x289739[_0x3ce3('0xa')]:_0x205ba[_0x3ce3('0x9')]+_0x205ba[_0x3ce3('0xb')];var _0x12eb31;if(_0x160be5>=_0x15b20b){_0x160be5=_0x15b20b;_0x12eb31=0xc8;}else{_0x12eb31=0xce;}_0x53bb8e[_0x3ce3('0x6')](_0x12eb31);return _0x53bb8e[_0x3ce3('0xc')](_0x3ce3('0xd'),_0x20c760+'-'+_0x160be5+'/'+_0x15b20b)['json'](_0x289739);}return null;};}function saveUpdates(_0x1f9e1d){return function(_0x40c9c6){if(_0x40c9c6){return _0x40c9c6['update'](_0x1f9e1d)[_0x3ce3('0xe')](function(_0x17af64){return _0x17af64;});}return null;};}function removeEntity(_0x59e7a6){return function(_0x30f696){if(_0x30f696){return _0x30f696[_0x3ce3('0xf')]()['then'](function(){_0x59e7a6[_0x3ce3('0x6')](0xcc)[_0x3ce3('0x10')]();});}};}function handleEntityNotFound(_0x30db61){return function(_0x35e6d0){if(!_0x35e6d0){_0x30db61['sendStatus'](0x194);}return _0x35e6d0;};}function handleError(_0x5b1214,_0x351965){_0x351965=_0x351965||0x1f4;return function(_0x56e8b3){logger[_0x3ce3('0x11')](_0x56e8b3[_0x3ce3('0x12')]);if(_0x56e8b3[_0x3ce3('0x13')]){delete _0x56e8b3[_0x3ce3('0x13')];}_0x5b1214['status'](_0x351965)[_0x3ce3('0x14')](_0x56e8b3);};}exports[_0x3ce3('0x15')]=function(_0x248a91,_0x7d1ced){var _0x1b77d5={},_0x499676={},_0x397dbc={'count':0x0,'rows':[]};var _0x20a7bd=_[_0x3ce3('0x16')](db[_0x3ce3('0x17')]['rawAttributes'],function(_0x37fc0f){return{'name':_0x37fc0f[_0x3ce3('0x18')],'type':_0x37fc0f[_0x3ce3('0x19')][_0x3ce3('0x1a')]};});_0x499676['model']=_[_0x3ce3('0x16')](_0x20a7bd,_0x3ce3('0x13'));_0x499676['query']=_[_0x3ce3('0x1b')](_0x248a91['query']);_0x499676[_0x3ce3('0x1c')]=_['intersection'](_0x499676[_0x3ce3('0x1d')],_0x499676['query']);_0x1b77d5['attributes']=_[_0x3ce3('0x1e')](_0x499676[_0x3ce3('0x1d')],qs[_0x3ce3('0x1f')](_0x248a91[_0x3ce3('0x20')][_0x3ce3('0x1f')]));_0x1b77d5[_0x3ce3('0x21')]=_0x1b77d5[_0x3ce3('0x21')][_0x3ce3('0x22')]?_0x1b77d5[_0x3ce3('0x21')]:_0x499676[_0x3ce3('0x1d')];if(!_0x248a91['query'][_0x3ce3('0x23')](_0x3ce3('0x24'))){_0x1b77d5['limit']=qs[_0x3ce3('0xb')](_0x248a91[_0x3ce3('0x20')]['limit']);_0x1b77d5['offset']=qs[_0x3ce3('0x9')](_0x248a91[_0x3ce3('0x20')][_0x3ce3('0x9')]);}_0x1b77d5[_0x3ce3('0x25')]=qs[_0x3ce3('0x26')](_0x248a91[_0x3ce3('0x20')]['sort']);_0x1b77d5[_0x3ce3('0x27')]=qs[_0x3ce3('0x1c')](_[_0x3ce3('0x28')](_0x248a91['query'],_0x499676['filters']),_0x20a7bd);if(_0x248a91[_0x3ce3('0x20')][_0x3ce3('0x29')]){_0x1b77d5[_0x3ce3('0x27')]=_[_0x3ce3('0x2a')](_0x1b77d5[_0x3ce3('0x27')],{'$or':_[_0x3ce3('0x16')](_0x20a7bd,function(_0x27d92e){if(_0x27d92e[_0x3ce3('0x19')]!==_0x3ce3('0x2b')){var _0x502e6b={};_0x502e6b[_0x27d92e[_0x3ce3('0x13')]]={'$like':'%'+_0x248a91[_0x3ce3('0x20')][_0x3ce3('0x29')]+'%'};return _0x502e6b;}})});}_0x1b77d5=_['merge']({},_0x1b77d5,_0x248a91['options']);var _0x26f778={'where':_0x1b77d5[_0x3ce3('0x27')]};return db[_0x3ce3('0x17')][_0x3ce3('0xa')](_0x26f778)[_0x3ce3('0xe')](function(_0x4e6d50){_0x397dbc[_0x3ce3('0xa')]=_0x4e6d50;if(_0x248a91[_0x3ce3('0x20')]['includeAll']){_0x1b77d5[_0x3ce3('0x2c')]=[{'all':!![]}];}return db[_0x3ce3('0x17')][_0x3ce3('0x2d')](_0x1b77d5);})[_0x3ce3('0xe')](function(_0x45e9ad){_0x397dbc['rows']=_0x45e9ad;return _0x397dbc;})[_0x3ce3('0xe')](respondWithFilteredResult(_0x7d1ced,_0x1b77d5))[_0x3ce3('0x2e')](handleError(_0x7d1ced,null));};exports[_0x3ce3('0x2f')]=function(_0x3eda57,_0x7bcdd){var _0x3ff336={'raw':![],'where':{'id':_0x3eda57[_0x3ce3('0x30')]['id']}},_0x266942={};_0x266942[_0x3ce3('0x1d')]=_[_0x3ce3('0x1b')](db[_0x3ce3('0x17')][_0x3ce3('0x31')]);_0x266942['query']=_[_0x3ce3('0x1b')](_0x3eda57[_0x3ce3('0x20')]);_0x266942[_0x3ce3('0x1c')]=_[_0x3ce3('0x1e')](_0x266942[_0x3ce3('0x1d')],_0x266942[_0x3ce3('0x20')]);_0x3ff336[_0x3ce3('0x21')]=_[_0x3ce3('0x1e')](_0x266942[_0x3ce3('0x1d')],qs[_0x3ce3('0x1f')](_0x3eda57[_0x3ce3('0x20')][_0x3ce3('0x1f')]));_0x3ff336[_0x3ce3('0x21')]=_0x3ff336[_0x3ce3('0x21')][_0x3ce3('0x22')]?_0x3ff336['attributes']:_0x266942[_0x3ce3('0x1d')];if(_0x3eda57['query'][_0x3ce3('0x32')]){_0x3ff336['include']=[{'all':!![]}];}_0x3ff336=_[_0x3ce3('0x2a')]({},_0x3ff336,_0x3eda57['options']);return db[_0x3ce3('0x17')][_0x3ce3('0x33')](_0x3ff336)[_0x3ce3('0xe')](handleEntityNotFound(_0x7bcdd,null))[_0x3ce3('0xe')](respondWithResult(_0x7bcdd,null))[_0x3ce3('0x2e')](handleError(_0x7bcdd,null));};exports['create']=function(_0x4ec3c7,_0x357285){return db[_0x3ce3('0x17')]['create'](_0x4ec3c7[_0x3ce3('0x34')],{})['then'](respondWithResult(_0x357285,0xc9))[_0x3ce3('0x2e')](handleError(_0x357285,null));};exports[_0x3ce3('0x35')]=function(_0x4a308f,_0x4767b3){if(_0x4a308f[_0x3ce3('0x34')]['id']){delete _0x4a308f[_0x3ce3('0x34')]['id'];}return db[_0x3ce3('0x17')]['find']({'where':{'id':_0x4a308f[_0x3ce3('0x30')]['id']}})[_0x3ce3('0xe')](handleEntityNotFound(_0x4767b3,null))[_0x3ce3('0xe')](saveUpdates(_0x4a308f[_0x3ce3('0x34')],null))['then'](respondWithResult(_0x4767b3,null))['catch'](handleError(_0x4767b3,null));};exports[_0x3ce3('0xf')]=function(_0x218855,_0x1373b7){return db['Dynamics365Account']['find']({'where':{'id':_0x218855[_0x3ce3('0x30')]['id']}})[_0x3ce3('0xe')](handleEntityNotFound(_0x1373b7,null))[_0x3ce3('0xe')](removeEntity(_0x1373b7,null))[_0x3ce3('0x2e')](handleError(_0x1373b7,null));};exports[_0x3ce3('0x36')]=function(_0x168350,_0x27f957){var _0x10bf57={};var _0x50f58d={};var _0x18adc5;var _0x5136be;return db['Dynamics365Account'][_0x3ce3('0x37')]({'where':{'id':_0x168350[_0x3ce3('0x30')]['id']}})[_0x3ce3('0xe')](handleEntityNotFound(_0x27f957,null))['then'](function(_0x3a275a){if(_0x3a275a){_0x18adc5=_0x3a275a;_0x50f58d[_0x3ce3('0x1d')]=_[_0x3ce3('0x1b')](db[_0x3ce3('0x38')][_0x3ce3('0x31')]);_0x50f58d[_0x3ce3('0x20')]=_['keys'](_0x168350[_0x3ce3('0x20')]);_0x50f58d[_0x3ce3('0x1c')]=_['intersection'](_0x50f58d[_0x3ce3('0x1d')],_0x50f58d[_0x3ce3('0x20')]);_0x10bf57[_0x3ce3('0x21')]=_['intersection'](_0x50f58d[_0x3ce3('0x1d')],qs[_0x3ce3('0x1f')](_0x168350[_0x3ce3('0x20')][_0x3ce3('0x1f')]));_0x10bf57[_0x3ce3('0x21')]=_0x10bf57[_0x3ce3('0x21')][_0x3ce3('0x22')]?_0x10bf57[_0x3ce3('0x21')]:_0x50f58d[_0x3ce3('0x1d')];_0x10bf57[_0x3ce3('0x25')]=qs['sort'](_0x168350[_0x3ce3('0x20')][_0x3ce3('0x26')]);_0x10bf57['where']=qs['filters'](_[_0x3ce3('0x28')](_0x168350[_0x3ce3('0x20')],_0x50f58d['filters']));if(_0x168350[_0x3ce3('0x20')]['filter']){_0x10bf57[_0x3ce3('0x27')]=_[_0x3ce3('0x2a')](_0x10bf57[_0x3ce3('0x27')],{'$or':_[_0x3ce3('0x16')](_0x10bf57[_0x3ce3('0x21')],function(_0x58f878){var _0x45b6aa={};_0x45b6aa[_0x58f878]={'$like':'%'+_0x168350['query']['filter']+'%'};return _0x45b6aa;})});}_0x10bf57=_[_0x3ce3('0x2a')]({},_0x10bf57,_0x168350[_0x3ce3('0x39')]);return _0x18adc5[_0x3ce3('0x36')](_0x10bf57);}})[_0x3ce3('0xe')](function(_0x8945cb){if(_0x8945cb){_0x5136be=_0x8945cb[_0x3ce3('0x22')];if(!_0x168350[_0x3ce3('0x20')]['hasOwnProperty']('nolimit')){_0x10bf57['limit']=qs[_0x3ce3('0xb')](_0x168350[_0x3ce3('0x20')][_0x3ce3('0xb')]);_0x10bf57[_0x3ce3('0x9')]=qs[_0x3ce3('0x9')](_0x168350['query'][_0x3ce3('0x9')]);}return _0x18adc5[_0x3ce3('0x36')](_0x10bf57);}})[_0x3ce3('0xe')](function(_0x1e9081){if(_0x1e9081){return _0x1e9081?{'count':_0x5136be,'rows':_0x1e9081}:null;}})[_0x3ce3('0xe')](respondWithResult(_0x27f957,null))['catch'](handleError(_0x27f957,null));};exports[_0x3ce3('0x3a')]=function(_0xdc71b7,_0x576675){if(_0xdc71b7[_0x3ce3('0x34')]['id']){delete _0xdc71b7[_0x3ce3('0x34')]['id'];}return db[_0x3ce3('0x17')][_0x3ce3('0x37')]({'where':{'id':_0xdc71b7[_0x3ce3('0x30')]['id']}})[_0x3ce3('0xe')](handleEntityNotFound(_0x576675,null))[_0x3ce3('0xe')](function(_0x43cd49){if(_0x43cd49){_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x3b')]=_0x43cd49['id'];_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x3c')]=integrations[_0x3ce3('0x3d')](_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x3e')],_0xdc71b7[_0x3ce3('0x34')]['type']);_0xdc71b7['body'][_0x3ce3('0x3f')]=integrations['getDescriptions'](_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x3e')],_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x19')]);return db['Dynamics365Configuration']['create'](_0xdc71b7['body'],{'include':[{'model':db[_0x3ce3('0x40')],'as':_0x3ce3('0x3c')},{'model':db[_0x3ce3('0x40')],'as':_0x3ce3('0x3f')}]});}return null;})['then'](respondWithResult(_0x576675,null))['catch'](handleError(_0x576675,null));};function sanitizeRemoteUri(_0xb81257){var _0x345a73=_0xb81257['slice'](-0x1);if(_0x345a73==='/')return _0xb81257[_0x3ce3('0x41')](0x0,_0xb81257[_0x3ce3('0x42')](_0x345a73));return _0xb81257;}function getWebApiUrl(_0x535e5b){return util[_0x3ce3('0x43')](_0x3ce3('0x44'),_0x535e5b);}exports[_0x3ce3('0x45')]=function(_0x329a81,_0x2af946){var _0x2e55b1=_0x329a81[_0x3ce3('0x20')][_0x3ce3('0x46')];var _0x727875=_0x2e55b1===_0x3ce3('0x47')?_0x3ce3('0x48'):_0x3ce3('0x49');var _0x2d8154='';var _0x2644cf='';var _0x3c4d70='';var _0x98ef0d='';var _0x327843='';var _0x2a2775='';var _0xc4e342='';var _0x3a62dc='';var _0xda5587=[_0x3ce3('0x4a'),'description','customerid','ownerid',_0x3ce3('0x4b'),_0x3ce3('0x4c'),_0x3ce3('0x4d'),_0x3ce3('0x4e'),_0x3ce3('0x4f'),_0x3ce3('0x50')];var _0x457b64=[_0x3ce3('0x51'),_0x3ce3('0x52'),_0x3ce3('0x53'),_0x3ce3('0x54'),_0x3ce3('0x55'),_0x3ce3('0x56'),_0x3ce3('0x57'),_0x3ce3('0x58'),'createdbyexternalpartyname',_0x3ce3('0x59'),_0x3ce3('0x5a'),_0x3ce3('0x5b'),_0x3ce3('0x5c'),_0x3ce3('0x5d'),_0x3ce3('0x5e'),_0x3ce3('0x5f'),'customeridtype',_0x3ce3('0x60'),_0x3ce3('0x61'),_0x3ce3('0x62'),_0x3ce3('0x63'),_0x3ce3('0x64'),_0x3ce3('0x65'),_0x3ce3('0x66'),_0x3ce3('0x67'),'followupby',_0x3ce3('0x68'),'influencescore',_0x3ce3('0x69'),_0x3ce3('0x6a'),_0x3ce3('0x6b'),_0x3ce3('0x6c'),'modifiedbyexternalpartyyominame',_0x3ce3('0x6d'),_0x3ce3('0x6e'),_0x3ce3('0x6f'),'modifiedonbehalfbyname',_0x3ce3('0x70'),_0x3ce3('0x71'),'msdyn_iotalertname',_0x3ce3('0x72'),_0x3ce3('0x73'),_0x3ce3('0x74'),'owneridname','owneridtype',_0x3ce3('0x75'),_0x3ce3('0x76'),'primarycontactidname',_0x3ce3('0x77'),'prioritycodename','productidname',_0x3ce3('0x78'),_0x3ce3('0x79'),'resolvebykpiidname',_0x3ce3('0x7a'),_0x3ce3('0x7b'),_0x3ce3('0x7c'),_0x3ce3('0x7d'),'slainvokedidname',_0x3ce3('0x7e'),'socialprofileidname',_0x3ce3('0x7f'),_0x3ce3('0x80'),'subjectidname','ticketnumber',_0x3ce3('0x81'),_0x3ce3('0x82'),'traversedpath','utcconversiontimezonecode','versionnumber'];var _0x34b200=_0xda5587[_0x3ce3('0x83')](_0x457b64);return db[_0x3ce3('0x17')]['findOne']({'where':{'id':_0x329a81[_0x3ce3('0x30')]['id']},'attributes':['id',_0x3ce3('0x84'),_0x3ce3('0x85'),_0x3ce3('0x86'),_0x3ce3('0x87'),'clientId',_0x3ce3('0x88'),_0x3ce3('0x89')],'include':[{'model':db[_0x3ce3('0x8a')],'as':'CloudProvider','attributes':['id','data5',_0x3ce3('0x8b')]}]})[_0x3ce3('0xe')](handleEntityNotFound(_0x2af946,null))[_0x3ce3('0xe')](function(_0x1452d1){if(_0x1452d1){if(_0x1452d1['modernAuthentication']){_0x1452d1[_0x3ce3('0x8c')]=_0x1452d1[_0x3ce3('0x8a')][_0x3ce3('0x8d')];_0x3a62dc=sanitizeRemoteUri(_0x1452d1['CloudProvider'][_0x3ce3('0x8b')]);_0xc4e342=getWebApiUrl(_0x3a62dc);return _0x1452d1;}_0x3a62dc=sanitizeRemoteUri(_0x1452d1[_0x3ce3('0x86')]);_0xc4e342=getWebApiUrl(_0x3a62dc);var _0x500ec5={'method':_0x3ce3('0x8e'),'uri':'https://login.microsoftonline.com/'+_0x1452d1[_0x3ce3('0x87')]+_0x3ce3('0x8f'),'form':{'client_id':_0x1452d1['clientId'],'resource':_0x3a62dc,'username':_0x1452d1['username'],'password':_0x1452d1['password'],'grant_type':_0x3ce3('0x85'),'client_secret':_0x1452d1[_0x3ce3('0x88')]},'json':!![]};return rp(_0x500ec5);}})[_0x3ce3('0xe')](function(_0x286160){_0x2a2775=_0x286160[_0x3ce3('0x8c')];var _0x4366cc={'method':_0x3ce3('0x90'),'uri':encodeURI(_0xc4e342+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x727875+'\x27'),'headers':{'Authorization':_0x3ce3('0x91')+_0x2a2775,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4366cc);})[_0x3ce3('0xe')](function(_0x2f6e7e){var _0x3ef66d=_0x2f6e7e[_0x3ce3('0x92')][0x0];var _0x167d33=_0x3ef66d[_0x3ce3('0x93')];var _0x56cfbe={'method':_0x3ce3('0x90'),'uri':_0xc4e342+_0x3ce3('0x94')+_0x167d33+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x2a2775,'If-None-Match':null,'OData-Version':_0x3ce3('0x95')},'json':!![]};return rp(_0x56cfbe);})[_0x3ce3('0xe')](function(_0x2e6438){_0x2d8154=_0x2e6438;_0x2644cf=_0x2d8154[_0x3ce3('0x96')];_0x2644cf=_[_0x3ce3('0x97')](_0x2644cf,function(_0x3ab2e5){return!_0x34b200[_0x3ce3('0x98')](_0x3ab2e5['LogicalName']);});var _0x10fe18=[];var _0x531095=[];_0x2644cf[_0x3ce3('0x99')](function(_0x2be0ec){if(_0x2be0ec[_0x3ce3('0x9a')]){var _0x20dc4f=_0x2be0ec[_0x3ce3('0x9a')]['substring'](_0x2be0ec[_0x3ce3('0x9a')]['lastIndexOf']('.')+0x1);if(_0x20dc4f===_0x3ce3('0x9b')){_0x10fe18[_0x3ce3('0x9c')](getSelectList(_0xc4e342,_0x2e55b1,_0x531095,_0x2d8154[_0x3ce3('0x93')],_0x2be0ec['MetadataId'],_0x2a2775));}}});return Promise[_0x3ce3('0x9d')](_0x10fe18);})[_0x3ce3('0xe')](function(_0x3d47bc){_0x3c4d70=_0x3d47bc[0x0];var _0x211e4c=[];var _0x4eddb7=[];_0x2644cf['forEach'](function(_0x251485){if(!_[_0x3ce3('0x9e')](_0x251485['@odata.type'])){var _0x45f9bf=_0x251485['@odata.type'][_0x3ce3('0x41')](_0x251485[_0x3ce3('0x9a')][_0x3ce3('0x42')]('.')+0x1);if(_0x45f9bf===_0x3ce3('0x9f')){_0x211e4c[_0x3ce3('0x9c')](getBooleanList(_0xc4e342,_0x2e55b1,_0x4eddb7,_0x2d8154[_0x3ce3('0x93')],_0x251485[_0x3ce3('0x93')],_0x2a2775));}}});return Promise['all'](_0x211e4c);})['then'](function(_0x5be97a){_0x98ef0d=_0x5be97a[0x0];var _0x1860f0=[];var _0x2f6116=[];_0x2644cf[_0x3ce3('0x99')](function(_0x3caec3){if(_0x3caec3['@odata.type']){var _0x1c4d21=_0x3caec3[_0x3ce3('0x9a')][_0x3ce3('0x41')](_0x3caec3[_0x3ce3('0x9a')][_0x3ce3('0x42')]('.')+0x1);if(_0x1c4d21===_0x3ce3('0xa0')||_0x1c4d21===_0x3ce3('0xa1')||_0x1c4d21===_0x3ce3('0xa2')||_0x1c4d21===_0x3ce3('0xa3')||_0x1c4d21===_0x3ce3('0xa4')||_0x1c4d21===_0x3ce3('0xa5')||_0x1c4d21===_0x3ce3('0xa6')||_0x1c4d21===_0x3ce3('0xa7')||_0x1c4d21==='StateAttributeMetadata'||_0x1c4d21===_0x3ce3('0xa8')){_0x1860f0['push'](getInputList(_0xc4e342,_0x2e55b1,_0x1c4d21,_0x2f6116,_0x2d8154[_0x3ce3('0x93')],_0x3caec3[_0x3ce3('0x93')],_0x2a2775));}}});return Promise[_0x3ce3('0x9d')](_0x1860f0);})['then'](function(_0x24a5a7){_0x327843=_0x24a5a7[0x0];var _0x3cbd2e=_0x3c4d70[_0x3ce3('0x83')](_0x98ef0d)[_0x3ce3('0x83')](_0x327843);var _0x1eecf5={'count':_0x3cbd2e[_0x3ce3('0x22')],'rows':_0x3cbd2e};return _0x1eecf5;})[_0x3ce3('0xe')](respondWithResult(_0x2af946,null))[_0x3ce3('0x2e')](function(_0x30a5fe){var _0x54b66e=_0x329a81[_0x3ce3('0x20')][_0x3ce3('0xa9')]?0x1f4:_0x30a5fe['statusCode']||0x1f4;logger[_0x3ce3('0x11')](_0x30a5fe['stack']);delete _0x30a5fe[_0x3ce3('0x13')];if(_0x54b66e===0x191){_0x54b66e=0x190;}_0x2af946['status'](_0x54b66e)[_0x3ce3('0x14')](_0x329a81[_0x3ce3('0x20')][_0x3ce3('0xa9')]?{'message':_0x3ce3('0xaa'),'statusCode':_0x30a5fe[_0x3ce3('0xab')]}:_0x30a5fe);});};function getSelectList(_0x1baffb,_0xece9a5,_0x40783b,_0x4606eb,_0x31562f,_0x2a4743){var _0x5667e9={'method':'GET','uri':_0x1baffb+'EntityDefinitions('+_0x4606eb+')/Attributes('+_0x31562f+_0x3ce3('0xac')+_0x3ce3('0xad'),'headers':{'Authorization':_0x3ce3('0x91')+_0x2a4743,'If-None-Match':null,'OData-Version':_0x3ce3('0x95')},'json':!![]};return rp(_0x5667e9)['then'](function(_0x3cabe7){var _0x1c20e8=[];var _0x467e71=_0x3cabe7[_0x3ce3('0xae')][_0x3ce3('0xaf')];_0x467e71[_0x3ce3('0x99')](function(_0x166e93){_0x1c20e8['push']({'name':_0x166e93[_0x3ce3('0xb0')][_0x3ce3('0xb1')][_0x3ce3('0xb0')],'value':String(_0x166e93[_0x3ce3('0xb2')])});});var _0x18f461={'id':_0xece9a5+'_'+_0x3cabe7[_0x3ce3('0xb3')],'name':_0x3cabe7[_0x3ce3('0xb4')]['UserLocalizedLabel'][_0x3ce3('0xb0')],'custom':![],'options':_0x1c20e8};_0x40783b['push'](_0x18f461);return _0x40783b;});}function getBooleanList(_0x28b69f,_0x3eb052,_0x228cb8,_0x2571fd,_0x227e86,_0x497dab){var _0x496af5={'method':'GET','uri':_0x28b69f+_0x3ce3('0x94')+_0x2571fd+_0x3ce3('0xb5')+_0x227e86+_0x3ce3('0xb6'),'headers':{'Authorization':_0x3ce3('0x91')+_0x497dab,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x496af5)[_0x3ce3('0xe')](function(_0x54f702){var _0x426e83=[];_0x426e83['push']({'name':_0x54f702[_0x3ce3('0xae')]['TrueOption'][_0x3ce3('0xb0')][_0x3ce3('0xb1')][_0x3ce3('0xb0')],'value':_0x3ce3('0xb7')},{'name':_0x54f702[_0x3ce3('0xae')][_0x3ce3('0xb8')]['Label'][_0x3ce3('0xb1')][_0x3ce3('0xb0')],'value':_0x3ce3('0xb9')});var _0x290788={'id':_0x3eb052+'_'+_0x54f702['LogicalName'],'name':_0x54f702[_0x3ce3('0xb4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x426e83};_0x228cb8[_0x3ce3('0x9c')](_0x290788);return _0x228cb8;});}function getInputList(_0x206d29,_0x40d541,_0x1998b4,_0x487429,_0x6e0617,_0x3b119d,_0x1118a9){var _0x158b36={'method':_0x3ce3('0x90'),'uri':_0x206d29+'EntityDefinitions('+_0x6e0617+_0x3ce3('0xb5')+_0x3b119d+_0x3ce3('0xba')+_0x1998b4+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x3ce3('0x91')+_0x1118a9,'If-None-Match':null,'OData-Version':_0x3ce3('0x95')},'json':!![]};return rp(_0x158b36)[_0x3ce3('0xe')](function(_0x56d2ba){var _0xd1208d={'id':_0x40d541+'_'+_0x56d2ba[_0x3ce3('0xb3')],'name':_0x56d2ba[_0x3ce3('0xb4')]['UserLocalizedLabel']?_0x56d2ba[_0x3ce3('0xb4')]['UserLocalizedLabel'][_0x3ce3('0xb0')]:_0x56d2ba[_0x3ce3('0xb3')],'custom':![],'options':[]};_0x487429[_0x3ce3('0x9c')](_0xd1208d);return _0x487429;});} \ No newline at end of file +var _0xf482=['remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','push','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','UserLocalizedLabel','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','Content-Range','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','VIRTUAL','merge','options','Dynamics365Account','count','includeAll','include','findAll','catch','show','params','fields','find','create','body','destroy','pick','filter','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','description','ownerid','caseorigincode','subject','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','username','password'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xf482,0xe4));var _0x2f48=function(_0x3f0228,_0x102e3f){_0x3f0228=_0x3f0228-0x0;var _0x848b65=_0xf482[_0x3f0228];return _0x848b65;};'use strict';var rp=require(_0x2f48('0x0'));var util=require(_0x2f48('0x1'));var _=require(_0x2f48('0x2'));var qs=require(_0x2f48('0x3'));var logger=require(_0x2f48('0x4'))(_0x2f48('0x5'));var db=require(_0x2f48('0x6'))['db'];var integrations=require(_0x2f48('0x7'));function respondWithResult(_0x975618,_0x52973f){_0x52973f=_0x52973f||0xc8;return function(_0xdcbbdb){if(_0xdcbbdb){return _0x975618[_0x2f48('0x8')](_0x52973f)[_0x2f48('0x9')](_0xdcbbdb);}};}function respondWithFilteredResult(_0x4dd869,_0x44bd3b){return function(_0x4f72ce){if(_0x4f72ce){var _0x34cb0a=typeof _0x44bd3b[_0x2f48('0xa')]===_0x2f48('0xb')&&typeof _0x44bd3b[_0x2f48('0xc')]===_0x2f48('0xb');var _0x1dce31=_0x4f72ce['count'];var _0x2c725a=_0x34cb0a?0x0:_0x44bd3b[_0x2f48('0xa')];var _0x154c78=_0x34cb0a?_0x4f72ce['count']:_0x44bd3b[_0x2f48('0xa')]+_0x44bd3b['limit'];var _0x396078;if(_0x154c78>=_0x1dce31){_0x154c78=_0x1dce31;_0x396078=0xc8;}else{_0x396078=0xce;}_0x4dd869[_0x2f48('0x8')](_0x396078);return _0x4dd869['set'](_0x2f48('0xd'),_0x2c725a+'-'+_0x154c78+'/'+_0x1dce31)[_0x2f48('0x9')](_0x4f72ce);}return null;};}function saveUpdates(_0x51b141){return function(_0x155482){if(_0x155482){return _0x155482[_0x2f48('0xe')](_0x51b141)[_0x2f48('0xf')](function(_0x160fb8){return _0x160fb8;});}return null;};}function removeEntity(_0x3c2ba9){return function(_0x40649b){if(_0x40649b){return _0x40649b['destroy']()[_0x2f48('0xf')](function(){_0x3c2ba9[_0x2f48('0x8')](0xcc)[_0x2f48('0x10')]();});}};}function handleEntityNotFound(_0x4c2f15){return function(_0x4b11cf){if(!_0x4b11cf){_0x4c2f15['sendStatus'](0x194);}return _0x4b11cf;};}function handleError(_0x13a511,_0x3adca1){_0x3adca1=_0x3adca1||0x1f4;return function(_0x42b69b){logger[_0x2f48('0x11')](_0x42b69b[_0x2f48('0x12')]);if(_0x42b69b[_0x2f48('0x13')]){delete _0x42b69b[_0x2f48('0x13')];}_0x13a511['status'](_0x3adca1)[_0x2f48('0x14')](_0x42b69b);};}exports['index']=function(_0x3386ae,_0x2f424c){var _0x48b068={},_0x1601be={},_0x40f4c7={'count':0x0,'rows':[]};var _0x52b1e0=_[_0x2f48('0x15')](db['Dynamics365Account'][_0x2f48('0x16')],function(_0x331a40){return{'name':_0x331a40[_0x2f48('0x17')],'type':_0x331a40[_0x2f48('0x18')][_0x2f48('0x19')]};});_0x1601be[_0x2f48('0x1a')]=_[_0x2f48('0x15')](_0x52b1e0,_0x2f48('0x13'));_0x1601be[_0x2f48('0x1b')]=_[_0x2f48('0x1c')](_0x3386ae[_0x2f48('0x1b')]);_0x1601be[_0x2f48('0x1d')]=_[_0x2f48('0x1e')](_0x1601be[_0x2f48('0x1a')],_0x1601be[_0x2f48('0x1b')]);_0x48b068[_0x2f48('0x1f')]=_[_0x2f48('0x1e')](_0x1601be[_0x2f48('0x1a')],qs['fields'](_0x3386ae[_0x2f48('0x1b')]['fields']));_0x48b068['attributes']=_0x48b068['attributes'][_0x2f48('0x20')]?_0x48b068[_0x2f48('0x1f')]:_0x1601be[_0x2f48('0x1a')];if(!_0x3386ae[_0x2f48('0x1b')]['hasOwnProperty'](_0x2f48('0x21'))){_0x48b068['limit']=qs[_0x2f48('0xc')](_0x3386ae['query'][_0x2f48('0xc')]);_0x48b068[_0x2f48('0xa')]=qs[_0x2f48('0xa')](_0x3386ae[_0x2f48('0x1b')][_0x2f48('0xa')]);}_0x48b068[_0x2f48('0x22')]=qs[_0x2f48('0x23')](_0x3386ae[_0x2f48('0x1b')][_0x2f48('0x23')]);_0x48b068[_0x2f48('0x24')]=qs[_0x2f48('0x1d')](_['pick'](_0x3386ae[_0x2f48('0x1b')],_0x1601be[_0x2f48('0x1d')]),_0x52b1e0);if(_0x3386ae['query']['filter']){_0x48b068[_0x2f48('0x24')]=_['merge'](_0x48b068[_0x2f48('0x24')],{'$or':_['map'](_0x52b1e0,function(_0x2071cb){if(_0x2071cb[_0x2f48('0x18')]!==_0x2f48('0x25')){var _0x53c7da={};_0x53c7da[_0x2071cb[_0x2f48('0x13')]]={'$like':'%'+_0x3386ae[_0x2f48('0x1b')]['filter']+'%'};return _0x53c7da;}})});}_0x48b068=_[_0x2f48('0x26')]({},_0x48b068,_0x3386ae[_0x2f48('0x27')]);var _0x3cd7e8={'where':_0x48b068[_0x2f48('0x24')]};return db[_0x2f48('0x28')][_0x2f48('0x29')](_0x3cd7e8)[_0x2f48('0xf')](function(_0x32d299){_0x40f4c7[_0x2f48('0x29')]=_0x32d299;if(_0x3386ae[_0x2f48('0x1b')][_0x2f48('0x2a')]){_0x48b068[_0x2f48('0x2b')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x2f48('0x2c')](_0x48b068);})[_0x2f48('0xf')](function(_0x257818){_0x40f4c7['rows']=_0x257818;return _0x40f4c7;})[_0x2f48('0xf')](respondWithFilteredResult(_0x2f424c,_0x48b068))[_0x2f48('0x2d')](handleError(_0x2f424c,null));};exports[_0x2f48('0x2e')]=function(_0x84818c,_0x5b98c9){var _0x35cadd={'raw':![],'where':{'id':_0x84818c[_0x2f48('0x2f')]['id']}},_0x52669b={};_0x52669b[_0x2f48('0x1a')]=_[_0x2f48('0x1c')](db['Dynamics365Account'][_0x2f48('0x16')]);_0x52669b['query']=_[_0x2f48('0x1c')](_0x84818c[_0x2f48('0x1b')]);_0x52669b[_0x2f48('0x1d')]=_[_0x2f48('0x1e')](_0x52669b[_0x2f48('0x1a')],_0x52669b[_0x2f48('0x1b')]);_0x35cadd[_0x2f48('0x1f')]=_[_0x2f48('0x1e')](_0x52669b[_0x2f48('0x1a')],qs[_0x2f48('0x30')](_0x84818c[_0x2f48('0x1b')][_0x2f48('0x30')]));_0x35cadd[_0x2f48('0x1f')]=_0x35cadd[_0x2f48('0x1f')]['length']?_0x35cadd[_0x2f48('0x1f')]:_0x52669b[_0x2f48('0x1a')];if(_0x84818c['query']['includeAll']){_0x35cadd[_0x2f48('0x2b')]=[{'all':!![]}];}_0x35cadd=_[_0x2f48('0x26')]({},_0x35cadd,_0x84818c[_0x2f48('0x27')]);return db[_0x2f48('0x28')][_0x2f48('0x31')](_0x35cadd)[_0x2f48('0xf')](handleEntityNotFound(_0x5b98c9,null))[_0x2f48('0xf')](respondWithResult(_0x5b98c9,null))['catch'](handleError(_0x5b98c9,null));};exports[_0x2f48('0x32')]=function(_0x151421,_0x10c7b8){return db[_0x2f48('0x28')][_0x2f48('0x32')](_0x151421['body'],{})[_0x2f48('0xf')](respondWithResult(_0x10c7b8,0xc9))[_0x2f48('0x2d')](handleError(_0x10c7b8,null));};exports[_0x2f48('0xe')]=function(_0x24becd,_0x3bca45){if(_0x24becd[_0x2f48('0x33')]['id']){delete _0x24becd[_0x2f48('0x33')]['id'];}return db[_0x2f48('0x28')][_0x2f48('0x31')]({'where':{'id':_0x24becd['params']['id']}})[_0x2f48('0xf')](handleEntityNotFound(_0x3bca45,null))[_0x2f48('0xf')](saveUpdates(_0x24becd[_0x2f48('0x33')],null))[_0x2f48('0xf')](respondWithResult(_0x3bca45,null))[_0x2f48('0x2d')](handleError(_0x3bca45,null));};exports[_0x2f48('0x34')]=function(_0x2aed38,_0x12d49a){return db[_0x2f48('0x28')][_0x2f48('0x31')]({'where':{'id':_0x2aed38[_0x2f48('0x2f')]['id']}})[_0x2f48('0xf')](handleEntityNotFound(_0x12d49a,null))[_0x2f48('0xf')](removeEntity(_0x12d49a,null))[_0x2f48('0x2d')](handleError(_0x12d49a,null));};exports['getConfigurations']=function(_0x5571aa,_0x1df93c){var _0x23b4ab={};var _0x4fe8e0={};var _0xcac0eb;var _0x32d0ab;return db['Dynamics365Account']['findOne']({'where':{'id':_0x5571aa['params']['id']}})['then'](handleEntityNotFound(_0x1df93c,null))[_0x2f48('0xf')](function(_0x442013){if(_0x442013){_0xcac0eb=_0x442013;_0x4fe8e0[_0x2f48('0x1a')]=_[_0x2f48('0x1c')](db['Dynamics365Configuration'][_0x2f48('0x16')]);_0x4fe8e0[_0x2f48('0x1b')]=_[_0x2f48('0x1c')](_0x5571aa['query']);_0x4fe8e0[_0x2f48('0x1d')]=_[_0x2f48('0x1e')](_0x4fe8e0[_0x2f48('0x1a')],_0x4fe8e0[_0x2f48('0x1b')]);_0x23b4ab['attributes']=_[_0x2f48('0x1e')](_0x4fe8e0[_0x2f48('0x1a')],qs[_0x2f48('0x30')](_0x5571aa[_0x2f48('0x1b')][_0x2f48('0x30')]));_0x23b4ab[_0x2f48('0x1f')]=_0x23b4ab['attributes']['length']?_0x23b4ab[_0x2f48('0x1f')]:_0x4fe8e0[_0x2f48('0x1a')];_0x23b4ab[_0x2f48('0x22')]=qs[_0x2f48('0x23')](_0x5571aa[_0x2f48('0x1b')][_0x2f48('0x23')]);_0x23b4ab[_0x2f48('0x24')]=qs[_0x2f48('0x1d')](_[_0x2f48('0x35')](_0x5571aa[_0x2f48('0x1b')],_0x4fe8e0[_0x2f48('0x1d')]));if(_0x5571aa[_0x2f48('0x1b')][_0x2f48('0x36')]){_0x23b4ab['where']=_[_0x2f48('0x26')](_0x23b4ab['where'],{'$or':_[_0x2f48('0x15')](_0x23b4ab['attributes'],function(_0x10412){var _0x1ad537={};_0x1ad537[_0x10412]={'$like':'%'+_0x5571aa['query'][_0x2f48('0x36')]+'%'};return _0x1ad537;})});}_0x23b4ab=_[_0x2f48('0x26')]({},_0x23b4ab,_0x5571aa['options']);return _0xcac0eb[_0x2f48('0x37')](_0x23b4ab);}})['then'](function(_0x25c4d1){if(_0x25c4d1){_0x32d0ab=_0x25c4d1['length'];if(!_0x5571aa['query'][_0x2f48('0x38')](_0x2f48('0x21'))){_0x23b4ab[_0x2f48('0xc')]=qs[_0x2f48('0xc')](_0x5571aa[_0x2f48('0x1b')][_0x2f48('0xc')]);_0x23b4ab[_0x2f48('0xa')]=qs['offset'](_0x5571aa[_0x2f48('0x1b')][_0x2f48('0xa')]);}return _0xcac0eb[_0x2f48('0x37')](_0x23b4ab);}})['then'](function(_0x15606e){if(_0x15606e){return _0x15606e?{'count':_0x32d0ab,'rows':_0x15606e}:null;}})[_0x2f48('0xf')](respondWithResult(_0x1df93c,null))[_0x2f48('0x2d')](handleError(_0x1df93c,null));};exports[_0x2f48('0x39')]=function(_0x509a66,_0x1eb32e){if(_0x509a66['body']['id']){delete _0x509a66['body']['id'];}return db[_0x2f48('0x28')]['findOne']({'where':{'id':_0x509a66['params']['id']}})['then'](handleEntityNotFound(_0x1eb32e,null))[_0x2f48('0xf')](function(_0x39fcd8){if(_0x39fcd8){_0x509a66[_0x2f48('0x33')][_0x2f48('0x3a')]=_0x39fcd8['id'];_0x509a66[_0x2f48('0x33')][_0x2f48('0x3b')]=integrations[_0x2f48('0x3c')](_0x509a66[_0x2f48('0x33')][_0x2f48('0x3d')],_0x509a66['body'][_0x2f48('0x18')]);_0x509a66[_0x2f48('0x33')]['Descriptions']=integrations[_0x2f48('0x3e')](_0x509a66[_0x2f48('0x33')][_0x2f48('0x3d')],_0x509a66[_0x2f48('0x33')][_0x2f48('0x18')]);return db['Dynamics365Configuration'][_0x2f48('0x32')](_0x509a66['body'],{'include':[{'model':db[_0x2f48('0x3f')],'as':_0x2f48('0x3b')},{'model':db[_0x2f48('0x3f')],'as':_0x2f48('0x40')}]});}return null;})[_0x2f48('0xf')](respondWithResult(_0x1eb32e,null))[_0x2f48('0x2d')](handleError(_0x1eb32e,null));};function sanitizeRemoteUri(_0x4c924a){var _0x350e1f=_0x4c924a[_0x2f48('0x41')](-0x1);if(_0x350e1f==='/')return _0x4c924a[_0x2f48('0x42')](0x0,_0x4c924a[_0x2f48('0x43')](_0x350e1f));return _0x4c924a;}function getWebApiUrl(_0x207dbd){return util[_0x2f48('0x44')](_0x2f48('0x45'),_0x207dbd);}exports[_0x2f48('0x46')]=function(_0x11d1d2,_0x4bb1ec){var _0x480b4f=_0x11d1d2['query'][_0x2f48('0x47')];var _0x47628e=_0x480b4f==='incident'?_0x2f48('0x48'):_0x2f48('0x49');var _0x557d26='';var _0x55ca59='';var _0x5629d6='';var _0x1abdf2='';var _0xcba5b6='';var _0x251dfa='';var _0x31b255='';var _0x51bc32='';var _0x457cd4=['title',_0x2f48('0x4a'),'customerid',_0x2f48('0x4b'),_0x2f48('0x4c'),_0x2f48('0x4d'),'phonenumber','regardingobjectid','directioncode',_0x2f48('0x4e')];var _0x3880bc=[_0x2f48('0x4f'),_0x2f48('0x50'),'actualserviceunits',_0x2f48('0x51'),_0x2f48('0x52'),'contactidyominame',_0x2f48('0x53'),_0x2f48('0x54'),_0x2f48('0x55'),_0x2f48('0x56'),'createdbyname',_0x2f48('0x57'),_0x2f48('0x58'),_0x2f48('0x59'),'createdonbehalfbyyominame','customeridname','customeridtype',_0x2f48('0x5a'),_0x2f48('0x5b'),_0x2f48('0x5c'),_0x2f48('0x5d'),_0x2f48('0x5e'),'escalatedon','exchangerate',_0x2f48('0x5f'),'followupby',_0x2f48('0x60'),'influencescore','kbarticleidname',_0x2f48('0x61'),_0x2f48('0x62'),_0x2f48('0x63'),_0x2f48('0x64'),_0x2f48('0x65'),_0x2f48('0x66'),'modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x2f48('0x67'),_0x2f48('0x68'),_0x2f48('0x69'),_0x2f48('0x6a'),'overriddencreatedon',_0x2f48('0x6b'),_0x2f48('0x6c'),_0x2f48('0x6d'),'parentcaseidname','primarycontactidname',_0x2f48('0x6e'),'prioritycodename',_0x2f48('0x6f'),_0x2f48('0x70'),_0x2f48('0x71'),'resolvebykpiidname',_0x2f48('0x72'),'responsiblecontactidname',_0x2f48('0x73'),_0x2f48('0x74'),_0x2f48('0x75'),_0x2f48('0x76'),_0x2f48('0x77'),_0x2f48('0x78'),_0x2f48('0x79'),'subjectidname',_0x2f48('0x7a'),_0x2f48('0x7b'),_0x2f48('0x7c'),_0x2f48('0x7d'),_0x2f48('0x7e'),_0x2f48('0x7f')];var _0x154e45=_0x457cd4[_0x2f48('0x80')](_0x3880bc);return db[_0x2f48('0x28')][_0x2f48('0x81')]({'where':{'id':_0x11d1d2[_0x2f48('0x2f')]['id']},'attributes':['id',_0x2f48('0x82'),_0x2f48('0x83'),_0x2f48('0x84'),_0x2f48('0x85'),_0x2f48('0x86'),_0x2f48('0x87'),_0x2f48('0x88')],'include':[{'model':db[_0x2f48('0x89')],'as':_0x2f48('0x89'),'attributes':['id',_0x2f48('0x8a'),_0x2f48('0x8b')]}]})[_0x2f48('0xf')](handleEntityNotFound(_0x4bb1ec,null))[_0x2f48('0xf')](function(_0x36b781){if(_0x36b781){if(_0x36b781[_0x2f48('0x88')]){_0x36b781['access_token']=_0x36b781[_0x2f48('0x89')][_0x2f48('0x8a')];_0x51bc32=sanitizeRemoteUri(_0x36b781[_0x2f48('0x89')][_0x2f48('0x8b')]);_0x31b255=getWebApiUrl(_0x51bc32);return _0x36b781;}_0x51bc32=sanitizeRemoteUri(_0x36b781['remoteUri']);_0x31b255=getWebApiUrl(_0x51bc32);var _0x357957={'method':_0x2f48('0x8c'),'uri':_0x2f48('0x8d')+_0x36b781[_0x2f48('0x85')]+_0x2f48('0x8e'),'form':{'client_id':_0x36b781['clientId'],'resource':_0x51bc32,'username':_0x36b781[_0x2f48('0x82')],'password':_0x36b781[_0x2f48('0x83')],'grant_type':_0x2f48('0x83'),'client_secret':_0x36b781[_0x2f48('0x87')]},'json':!![]};return rp(_0x357957);}})[_0x2f48('0xf')](function(_0x183698){_0x251dfa=_0x183698[_0x2f48('0x8f')];var _0x42def7={'method':_0x2f48('0x90'),'uri':encodeURI(_0x31b255+_0x2f48('0x91')+_0x47628e+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x251dfa,'If-None-Match':null,'OData-Version':_0x2f48('0x92')},'json':!![]};return rp(_0x42def7);})[_0x2f48('0xf')](function(_0x411294){var _0x4b90a8=_0x411294[_0x2f48('0x93')][0x0];var _0x4f2fce=_0x4b90a8['MetadataId'];var _0xdde592={'method':_0x2f48('0x90'),'uri':_0x31b255+_0x2f48('0x94')+_0x4f2fce+_0x2f48('0x95'),'headers':{'Authorization':_0x2f48('0x96')+_0x251dfa,'If-None-Match':null,'OData-Version':_0x2f48('0x92')},'json':!![]};return rp(_0xdde592);})[_0x2f48('0xf')](function(_0x20dd57){_0x557d26=_0x20dd57;_0x55ca59=_0x557d26[_0x2f48('0x97')];_0x55ca59=_[_0x2f48('0x98')](_0x55ca59,function(_0x3a23d9){return!_0x154e45['includes'](_0x3a23d9[_0x2f48('0x99')]);});var _0x1e3272=[];var _0x439c12=[];_0x55ca59[_0x2f48('0x9a')](function(_0x3a49f2){if(_0x3a49f2['@odata.type']){var _0x58f239=_0x3a49f2[_0x2f48('0x9b')][_0x2f48('0x42')](_0x3a49f2['@odata.type'][_0x2f48('0x43')]('.')+0x1);if(_0x58f239===_0x2f48('0x9c')){_0x1e3272['push'](getSelectList(_0x31b255,_0x480b4f,_0x439c12,_0x557d26[_0x2f48('0x9d')],_0x3a49f2['MetadataId'],_0x251dfa));}}});return Promise[_0x2f48('0x9e')](_0x1e3272);})[_0x2f48('0xf')](function(_0x5b1c11){_0x5629d6=_0x5b1c11[0x0];var _0x1d2b7c=[];var _0x55079a=[];_0x55ca59['forEach'](function(_0x35ab5e){if(!_[_0x2f48('0x9f')](_0x35ab5e['@odata.type'])){var _0x1f6ff3=_0x35ab5e['@odata.type']['substring'](_0x35ab5e['@odata.type'][_0x2f48('0x43')]('.')+0x1);if(_0x1f6ff3==='BooleanAttributeMetadata'){_0x1d2b7c[_0x2f48('0xa0')](getBooleanList(_0x31b255,_0x480b4f,_0x55079a,_0x557d26[_0x2f48('0x9d')],_0x35ab5e[_0x2f48('0x9d')],_0x251dfa));}}});return Promise['all'](_0x1d2b7c);})['then'](function(_0x574b1c){_0x1abdf2=_0x574b1c[0x0];var _0x58f517=[];var _0x58726a=[];_0x55ca59[_0x2f48('0x9a')](function(_0x1b02e4){if(_0x1b02e4[_0x2f48('0x9b')]){var _0x84c0a2=_0x1b02e4['@odata.type'][_0x2f48('0x42')](_0x1b02e4[_0x2f48('0x9b')]['lastIndexOf']('.')+0x1);if(_0x84c0a2===_0x2f48('0xa1')||_0x84c0a2==='DoubleAttributeMetadata'||_0x84c0a2===_0x2f48('0xa2')||_0x84c0a2===_0x2f48('0xa3')||_0x84c0a2===_0x2f48('0xa4')||_0x84c0a2==='DateTimeAttributeMetadata'||_0x84c0a2==='StatusAttributeMetadata'||_0x84c0a2===_0x2f48('0xa5')||_0x84c0a2===_0x2f48('0xa6')||_0x84c0a2===_0x2f48('0xa7')){_0x58f517['push'](getInputList(_0x31b255,_0x480b4f,_0x84c0a2,_0x58726a,_0x557d26[_0x2f48('0x9d')],_0x1b02e4[_0x2f48('0x9d')],_0x251dfa));}}});return Promise[_0x2f48('0x9e')](_0x58f517);})[_0x2f48('0xf')](function(_0x397d05){_0xcba5b6=_0x397d05[0x0];var _0x31d275=_0x5629d6[_0x2f48('0x80')](_0x1abdf2)[_0x2f48('0x80')](_0xcba5b6);var _0x73491a={'count':_0x31d275['length'],'rows':_0x31d275};return _0x73491a;})[_0x2f48('0xf')](respondWithResult(_0x4bb1ec,null))[_0x2f48('0x2d')](function(_0x248d46){var _0x58eb88=_0x11d1d2[_0x2f48('0x1b')][_0x2f48('0xa8')]?0x1f4:_0x248d46['statusCode']||0x1f4;logger[_0x2f48('0x11')](_0x248d46['stack']);delete _0x248d46['name'];if(_0x58eb88===0x191){_0x58eb88=0x190;}_0x4bb1ec[_0x2f48('0x8')](_0x58eb88)[_0x2f48('0x14')](_0x11d1d2['query'][_0x2f48('0xa8')]?{'message':'Wrong\x20credentials','statusCode':_0x248d46['statusCode']}:_0x248d46);});};function getSelectList(_0x5cf04a,_0x21adf9,_0x16c71b,_0x3ea445,_0x5bc483,_0x4dfbb6){var _0x5a1c54={'method':_0x2f48('0x90'),'uri':_0x5cf04a+_0x2f48('0x94')+_0x3ea445+_0x2f48('0xa9')+_0x5bc483+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x2f48('0xaa'),'headers':{'Authorization':'Bearer\x20'+_0x4dfbb6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5a1c54)[_0x2f48('0xf')](function(_0x35bc4c){var _0x152491=[];var _0x53c9fc=_0x35bc4c[_0x2f48('0xab')][_0x2f48('0xac')];_0x53c9fc['forEach'](function(_0x21b6b3){_0x152491[_0x2f48('0xa0')]({'name':_0x21b6b3[_0x2f48('0xad')]['UserLocalizedLabel']['Label'],'value':String(_0x21b6b3['Value'])});});var _0x3f817e={'id':_0x21adf9+'_'+_0x35bc4c[_0x2f48('0x99')],'name':_0x35bc4c['DisplayName']['UserLocalizedLabel'][_0x2f48('0xad')],'custom':![],'options':_0x152491};_0x16c71b[_0x2f48('0xa0')](_0x3f817e);return _0x16c71b;});}function getBooleanList(_0x52a33a,_0x30ff0d,_0x1b4c15,_0x3cf15f,_0x488a8b,_0x4497b2){var _0x4371dd={'method':'GET','uri':_0x52a33a+_0x2f48('0x94')+_0x3cf15f+_0x2f48('0xa9')+_0x488a8b+_0x2f48('0xae'),'headers':{'Authorization':_0x2f48('0x96')+_0x4497b2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4371dd)[_0x2f48('0xf')](function(_0x216b05){var _0x7456ab=[];_0x7456ab[_0x2f48('0xa0')]({'name':_0x216b05[_0x2f48('0xab')]['TrueOption'][_0x2f48('0xad')][_0x2f48('0xaf')][_0x2f48('0xad')],'value':'true'},{'name':_0x216b05[_0x2f48('0xab')][_0x2f48('0xb0')][_0x2f48('0xad')][_0x2f48('0xaf')][_0x2f48('0xad')],'value':_0x2f48('0xb1')});var _0xa3860b={'id':_0x30ff0d+'_'+_0x216b05[_0x2f48('0x99')],'name':_0x216b05[_0x2f48('0xb2')][_0x2f48('0xaf')][_0x2f48('0xad')],'custom':![],'options':_0x7456ab};_0x1b4c15[_0x2f48('0xa0')](_0xa3860b);return _0x1b4c15;});}function getInputList(_0x12a84c,_0x2dc675,_0x48b8b4,_0x107209,_0x580466,_0x4d1f92,_0x537685){var _0x284b46={'method':_0x2f48('0x90'),'uri':_0x12a84c+_0x2f48('0x94')+_0x580466+_0x2f48('0xa9')+_0x4d1f92+')/Microsoft.Dynamics.CRM.'+_0x48b8b4+_0x2f48('0xb3'),'headers':{'Authorization':_0x2f48('0x96')+_0x537685,'If-None-Match':null,'OData-Version':_0x2f48('0x92')},'json':!![]};return rp(_0x284b46)[_0x2f48('0xf')](function(_0xa7d8da){var _0x4fa45={'id':_0x2dc675+'_'+_0xa7d8da[_0x2f48('0x99')],'name':_0xa7d8da['DisplayName'][_0x2f48('0xaf')]?_0xa7d8da[_0x2f48('0xb2')][_0x2f48('0xaf')][_0x2f48('0xad')]:_0xa7d8da[_0x2f48('0x99')],'custom':![],'options':[]};_0x107209['push'](_0x4fa45);return _0x107209;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 3c4f780..6092973 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x164770,_0x1e5ebf){var _0x5ec509=function(_0x561cfa){while(--_0x561cfa){_0x164770['push'](_0x164770['shift']());}};_0x5ec509(++_0x1e5ebf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'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 8d99ab3..f824636 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 _0x80f2=['request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','result','findAll','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','Dynamics365Account','find','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x523a8b,_0x5a7f8d){var _0x45c38c=function(_0x53c3fb){while(--_0x53c3fb){_0x523a8b['push'](_0x523a8b['shift']());}};_0x45c38c(++_0x5a7f8d);}(_0x80f2,0x7e));var _0x280f=function(_0x42565a,_0x441e1b){_0x42565a=_0x42565a-0x0;var _0x4a8397=_0x80f2[_0x42565a];return _0x4a8397;};'use strict';var _=require(_0x280f('0x0'));var util=require(_0x280f('0x1'));var moment=require('moment');var BPromise=require(_0x280f('0x2'));var rs=require(_0x280f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x280f('0x4'))['db'];var utils=require(_0x280f('0x5'));var logger=require(_0x280f('0x6'))(_0x280f('0x7'));var config=require('../../config/environment');var jayson=require(_0x280f('0x8'));var client=jayson[_0x280f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x115f90,_0x57538f,_0x5d088f){return new BPromise(function(_0x109e4c,_0xee888e){return client[_0x280f('0xa')](_0x115f90,_0x5d088f)[_0x280f('0xb')](function(_0x481d09){logger['info'](_0x280f('0xc'),_0x57538f,_0x280f('0xd'));logger[_0x280f('0xe')](_0x280f('0xf'),_0x57538f,_0x280f('0xd'),JSON['stringify'](_0x481d09));if(_0x481d09[_0x280f('0x10')]){if(_0x481d09['error'][_0x280f('0x11')]===0x1f4){logger[_0x280f('0x10')](_0x280f('0xc'),_0x57538f,_0x481d09[_0x280f('0x10')][_0x280f('0x12')]);return _0xee888e(_0x481d09[_0x280f('0x10')]['message']);}logger[_0x280f('0x10')](_0x280f('0xc'),_0x57538f,_0x481d09[_0x280f('0x10')][_0x280f('0x12')]);return _0x109e4c(_0x481d09[_0x280f('0x10')][_0x280f('0x12')]);}else{logger[_0x280f('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x57538f,_0x280f('0xd'));_0x109e4c(_0x481d09[_0x280f('0x14')]['message']);}})['catch'](function(_0x52499){logger[_0x280f('0x10')](_0x280f('0xc'),_0x57538f,_0x52499);_0xee888e(_0x52499);});});}exports['GetDynamics365Account']=function(_0x32e958){var _0x7d7d4d=this;return new Promise(function(_0x392cda,_0x1f9501){return db['Dynamics365Account'][_0x280f('0x15')]({'raw':_0x32e958['options']?_0x32e958['options']['raw']===undefined?!![]:![]:!![],'where':_0x32e958[_0x280f('0x16')]?_0x32e958[_0x280f('0x16')][_0x280f('0x17')]||null:null,'attributes':_0x32e958['options']?_0x32e958[_0x280f('0x16')][_0x280f('0x18')]||null:null,'limit':_0x32e958[_0x280f('0x16')]?_0x32e958[_0x280f('0x16')][_0x280f('0x19')]||null:null,'include':_0x32e958[_0x280f('0x16')]?_0x32e958[_0x280f('0x16')][_0x280f('0x1a')]?_[_0x280f('0x1b')](_0x32e958[_0x280f('0x16')][_0x280f('0x1a')],function(_0x52373f){return{'model':db[_0x52373f[_0x280f('0x1c')]],'as':_0x52373f['as'],'attributes':_0x52373f['attributes'],'include':_0x52373f['include']?_['map'](_0x52373f['include'],function(_0x1592d2){return{'model':db[_0x1592d2['model']],'as':_0x1592d2['as'],'attributes':_0x1592d2['attributes'],'include':_0x1592d2[_0x280f('0x1a')]?_[_0x280f('0x1b')](_0x1592d2[_0x280f('0x1a')],function(_0x138bad){return{'model':db[_0x138bad[_0x280f('0x1c')]],'as':_0x138bad['as'],'attributes':_0x138bad['attributes']};}):[]};}):[]};}):[]:[]})[_0x280f('0xb')](function(_0xe0299a){logger['info'](_0x280f('0x1d'),_0x32e958);logger['debug'](_0x280f('0x1d'),_0x32e958,JSON['stringify'](_0xe0299a));_0x392cda(_0xe0299a);})['catch'](function(_0x1c8866){logger[_0x280f('0x10')](_0x280f('0x1d'),_0x1c8866[_0x280f('0x12')],_0x32e958);_0x1f9501(_0x7d7d4d[_0x280f('0x10')](0x1f4,_0x1c8866['message']));});});};exports[_0x280f('0x1e')]=function(_0x30af8b){var _0x345c01=this;return new Promise(function(_0x1cb80d,_0xb1eeba){return db[_0x280f('0x1f')][_0x280f('0x20')]({'raw':_0x30af8b[_0x280f('0x16')]?_0x30af8b[_0x280f('0x16')][_0x280f('0x21')]===undefined?!![]:![]:!![],'where':_0x30af8b[_0x280f('0x16')]?_0x30af8b[_0x280f('0x16')][_0x280f('0x17')]||null:null,'attributes':_0x30af8b[_0x280f('0x16')]?_0x30af8b[_0x280f('0x16')][_0x280f('0x18')]||null:null,'include':_0x30af8b[_0x280f('0x16')]?_0x30af8b[_0x280f('0x16')][_0x280f('0x1a')]?_['map'](_0x30af8b['options'][_0x280f('0x1a')],function(_0x593023){return{'model':db[_0x593023[_0x280f('0x1c')]],'as':_0x593023['as'],'attributes':_0x593023[_0x280f('0x18')],'include':_0x593023['include']?_[_0x280f('0x1b')](_0x593023[_0x280f('0x1a')],function(_0x201e2b){return{'model':db[_0x201e2b[_0x280f('0x1c')]],'as':_0x201e2b['as'],'attributes':_0x201e2b[_0x280f('0x18')],'include':_0x201e2b['include']?_[_0x280f('0x1b')](_0x201e2b[_0x280f('0x1a')],function(_0x172c7e){return{'model':db[_0x172c7e[_0x280f('0x1c')]],'as':_0x172c7e['as'],'attributes':_0x172c7e[_0x280f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59f74e){logger['info'](_0x280f('0x1e'),_0x30af8b);logger[_0x280f('0xe')]('ShowDynamics365Account',_0x30af8b,JSON['stringify'](_0x59f74e));_0x1cb80d(_0x59f74e);})['catch'](function(_0x36771a){logger[_0x280f('0x10')]('ShowDynamics365Account',_0x36771a[_0x280f('0x12')],_0x30af8b);_0xb1eeba(_0x345c01['error'](0x1f4,_0x36771a['message']));});});}; \ No newline at end of file +var _0x0085=['rpc','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','ShowDynamics365Account','find','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0085,0xad));var _0x5008=function(_0x3e8455,_0x401fa1){_0x3e8455=_0x3e8455-0x0;var _0x5537bf=_0x0085[_0x3e8455];return _0x5537bf;};'use strict';var _=require(_0x5008('0x0'));var util=require('util');var moment=require(_0x5008('0x1'));var BPromise=require('bluebird');var rs=require(_0x5008('0x2'));var fs=require('fs');var Redis=require(_0x5008('0x3'));var db=require(_0x5008('0x4'))['db'];var utils=require(_0x5008('0x5'));var logger=require(_0x5008('0x6'))(_0x5008('0x7'));var config=require('../../config/environment');var jayson=require(_0x5008('0x8'));var client=jayson[_0x5008('0x9')][_0x5008('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4404a8,_0x3faa76,_0x4b8ec1){return new BPromise(function(_0x428def,_0x20453b){return client['request'](_0x4404a8,_0x4b8ec1)[_0x5008('0xb')](function(_0x50c83b){logger[_0x5008('0xc')](_0x5008('0xd'),_0x3faa76,_0x5008('0xe'));logger[_0x5008('0xf')](_0x5008('0x10'),_0x3faa76,_0x5008('0xe'),JSON[_0x5008('0x11')](_0x50c83b));if(_0x50c83b[_0x5008('0x12')]){if(_0x50c83b[_0x5008('0x12')][_0x5008('0x13')]===0x1f4){logger[_0x5008('0x12')](_0x5008('0xd'),_0x3faa76,_0x50c83b[_0x5008('0x12')]['message']);return _0x20453b(_0x50c83b[_0x5008('0x12')]['message']);}logger[_0x5008('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x3faa76,_0x50c83b[_0x5008('0x12')]['message']);return _0x428def(_0x50c83b[_0x5008('0x12')][_0x5008('0x14')]);}else{logger[_0x5008('0xc')](_0x5008('0xd'),_0x3faa76,_0x5008('0xe'));_0x428def(_0x50c83b[_0x5008('0x15')][_0x5008('0x14')]);}})[_0x5008('0x16')](function(_0x300ebe){logger[_0x5008('0x12')](_0x5008('0xd'),_0x3faa76,_0x300ebe);_0x20453b(_0x300ebe);});});}exports[_0x5008('0x17')]=function(_0x136e3b){var _0x635b1c=this;return new Promise(function(_0x1de9e5,_0x521aac){return db[_0x5008('0x18')][_0x5008('0x19')]({'raw':_0x136e3b[_0x5008('0x1a')]?_0x136e3b['options']['raw']===undefined?!![]:![]:!![],'where':_0x136e3b['options']?_0x136e3b['options'][_0x5008('0x1b')]||null:null,'attributes':_0x136e3b[_0x5008('0x1a')]?_0x136e3b['options'][_0x5008('0x1c')]||null:null,'limit':_0x136e3b[_0x5008('0x1a')]?_0x136e3b[_0x5008('0x1a')][_0x5008('0x1d')]||null:null,'include':_0x136e3b[_0x5008('0x1a')]?_0x136e3b[_0x5008('0x1a')][_0x5008('0x1e')]?_[_0x5008('0x1f')](_0x136e3b[_0x5008('0x1a')][_0x5008('0x1e')],function(_0x330f76){return{'model':db[_0x330f76[_0x5008('0x20')]],'as':_0x330f76['as'],'attributes':_0x330f76[_0x5008('0x1c')],'include':_0x330f76[_0x5008('0x1e')]?_[_0x5008('0x1f')](_0x330f76[_0x5008('0x1e')],function(_0xa0dd49){return{'model':db[_0xa0dd49[_0x5008('0x20')]],'as':_0xa0dd49['as'],'attributes':_0xa0dd49['attributes'],'include':_0xa0dd49['include']?_[_0x5008('0x1f')](_0xa0dd49[_0x5008('0x1e')],function(_0x36eccb){return{'model':db[_0x36eccb['model']],'as':_0x36eccb['as'],'attributes':_0x36eccb['attributes']};}):[]};}):[]};}):[]:[]})[_0x5008('0xb')](function(_0x2138dd){logger['info'](_0x5008('0x17'),_0x136e3b);logger[_0x5008('0xf')](_0x5008('0x17'),_0x136e3b,JSON[_0x5008('0x11')](_0x2138dd));_0x1de9e5(_0x2138dd);})[_0x5008('0x16')](function(_0x4d594e){logger[_0x5008('0x12')](_0x5008('0x17'),_0x4d594e['message'],_0x136e3b);_0x521aac(_0x635b1c[_0x5008('0x12')](0x1f4,_0x4d594e[_0x5008('0x14')]));});});};exports[_0x5008('0x21')]=function(_0x42959d){var _0x17028d=this;return new Promise(function(_0x556682,_0x21d615){return db[_0x5008('0x18')][_0x5008('0x22')]({'raw':_0x42959d[_0x5008('0x1a')]?_0x42959d[_0x5008('0x1a')][_0x5008('0x23')]===undefined?!![]:![]:!![],'where':_0x42959d[_0x5008('0x1a')]?_0x42959d[_0x5008('0x1a')]['where']||null:null,'attributes':_0x42959d['options']?_0x42959d[_0x5008('0x1a')][_0x5008('0x1c')]||null:null,'include':_0x42959d[_0x5008('0x1a')]?_0x42959d[_0x5008('0x1a')]['include']?_['map'](_0x42959d[_0x5008('0x1a')][_0x5008('0x1e')],function(_0x3f48e9){return{'model':db[_0x3f48e9['model']],'as':_0x3f48e9['as'],'attributes':_0x3f48e9['attributes'],'include':_0x3f48e9['include']?_[_0x5008('0x1f')](_0x3f48e9['include'],function(_0x42e4c1){return{'model':db[_0x42e4c1[_0x5008('0x20')]],'as':_0x42e4c1['as'],'attributes':_0x42e4c1[_0x5008('0x1c')],'include':_0x42e4c1[_0x5008('0x1e')]?_[_0x5008('0x1f')](_0x42e4c1[_0x5008('0x1e')],function(_0x16d8d3){return{'model':db[_0x16d8d3['model']],'as':_0x16d8d3['as'],'attributes':_0x16d8d3[_0x5008('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5008('0xb')](function(_0xdb535f){logger[_0x5008('0xc')](_0x5008('0x21'),_0x42959d);logger[_0x5008('0xf')](_0x5008('0x21'),_0x42959d,JSON[_0x5008('0x11')](_0xdb535f));_0x556682(_0xdb535f);})[_0x5008('0x16')](function(_0x2ca4d5){logger['error'](_0x5008('0x21'),_0x2ca4d5[_0x5008('0x14')],_0x42959d);_0x21d615(_0x17028d[_0x5008('0x12')](0x1f4,_0x2ca4d5['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 3c75f43..18e4689 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 _0x7f48=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','put','delete'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x7f48,0xac));var _0x87f4=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7f48[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x87f4('0x0'));var util=require(_0x87f4('0x1'));var path=require('path');var timeout=require(_0x87f4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x87f4('0x3'));var auth=require(_0x87f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x87f4('0x5'));var controller=require(_0x87f4('0x6'));router[_0x87f4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x87f4('0x7')](_0x87f4('0x8'),auth['isAuthenticated'](),controller[_0x87f4('0x9')]);router[_0x87f4('0x7')](_0x87f4('0xa'),auth[_0x87f4('0xb')](),controller[_0x87f4('0xc')]);router[_0x87f4('0x7')](_0x87f4('0xd'),auth[_0x87f4('0xb')](),controller[_0x87f4('0xe')]);router[_0x87f4('0x7')]('/:id/descriptions',auth[_0x87f4('0xb')](),controller[_0x87f4('0xf')]);router['post']('/',auth[_0x87f4('0xb')](),controller['create']);router[_0x87f4('0x10')](_0x87f4('0x8'),auth[_0x87f4('0xb')](),controller['update']);router[_0x87f4('0x11')](_0x87f4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x87f4('0x12')]=router; \ No newline at end of file +var _0x4fc2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','exports','multer','util','path'];(function(_0x55c53e,_0x259148){var _0x1e56d5=function(_0x1e4933){while(--_0x1e4933){_0x55c53e['push'](_0x55c53e['shift']());}};_0x1e56d5(++_0x259148);}(_0x4fc2,0x111));var _0x24fc=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0x4fc2[_0x26721d];return _0x1035c5;};'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['getFields']);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['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller['destroy']);module[_0x24fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e06bdb0..bc76020 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 _0xce57=['incident','phonecall','contact','nothing','sequelize','exports','STRING','ENUM'];(function(_0x315514,_0x2c6b54){var _0x5835cb=function(_0x4f33a1){while(--_0x4f33a1){_0x315514['push'](_0x315514['shift']());}};_0x5835cb(++_0x2c6b54);}(_0xce57,0x1d4));var _0x7ce5=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0xce57[_0x55ff79];return _0x579067;};'use strict';var Sequelize=require(_0x7ce5('0x0'));module[_0x7ce5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7ce5('0x2')]},'ticketType':{'type':Sequelize[_0x7ce5('0x3')](_0x7ce5('0x4'),_0x7ce5('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x7ce5('0x6'),_0x7ce5('0x7')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file +var _0x3316=['STRING','incident','phonecall','ENUM','contact','nothing','sequelize','exports'];(function(_0x1b6f5c,_0x764a11){var _0x3fe86f=function(_0x55c138){while(--_0x55c138){_0x1b6f5c['push'](_0x1b6f5c['shift']());}};_0x3fe86f(++_0x764a11);}(_0x3316,0x156));var _0x6331=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x3316[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require(_0x6331('0x0'));module[_0x6331('0x1')]={'name':{'type':Sequelize[_0x6331('0x2')]},'description':{'type':Sequelize[_0x6331('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x6331('0x3'),_0x6331('0x4')),'defaultValue':_0x6331('0x3')},'moduleCreate':{'type':Sequelize[_0x6331('0x5')](_0x6331('0x6'),_0x6331('0x7')),'defaultValue':_0x6331('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index f09cae9..160346f 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 _0x2d12=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getFields','findOne','length','pick','nolimit','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters'];(function(_0x319af4,_0x19cce9){var _0x187817=function(_0x28a263){while(--_0x28a263){_0x319af4['push'](_0x319af4['shift']());}};_0x187817(++_0x19cce9);}(_0x2d12,0x1e3));var _0x22d1=function(_0x5f20a8,_0x1581c6){_0x5f20a8=_0x5f20a8-0x0;var _0x482266=_0x2d12[_0x5f20a8];return _0x482266;};'use strict';var emlformat=require(_0x22d1('0x0'));var rimraf=require(_0x22d1('0x1'));var zipdir=require(_0x22d1('0x2'));var jsonpatch=require(_0x22d1('0x3'));var rp=require('request-promise');var moment=require(_0x22d1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x22d1('0x5'));var ejs=require(_0x22d1('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22d1('0x7'));var squel=require(_0x22d1('0x8'));var crypto=require(_0x22d1('0x9'));var jsforce=require(_0x22d1('0xa'));var deskjs=require(_0x22d1('0xb'));var toCsv=require(_0x22d1('0x5'));var querystring=require(_0x22d1('0xc'));var Papa=require(_0x22d1('0xd'));var Redis=require('ioredis');var authService=require(_0x22d1('0xe'));var qs=require(_0x22d1('0xf'));var as=require(_0x22d1('0x10'));var hardwareService=require(_0x22d1('0x11'));var logger=require(_0x22d1('0x12'))(_0x22d1('0x13'));var utils=require(_0x22d1('0x14'));var config=require(_0x22d1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x22d1('0x16'))['db'];function respondWithStatusCode(_0x350c66,_0x30da3f){_0x30da3f=_0x30da3f||0xcc;return function(_0x5b52a2){if(_0x5b52a2){return _0x350c66['sendStatus'](_0x30da3f);}return _0x350c66[_0x22d1('0x17')](_0x30da3f)[_0x22d1('0x18')]();};}function respondWithResult(_0x362bd5,_0x16be8c){_0x16be8c=_0x16be8c||0xc8;return function(_0x110dba){if(_0x110dba){return _0x362bd5[_0x22d1('0x17')](_0x16be8c)[_0x22d1('0x19')](_0x110dba);}};}function respondWithFilteredResult(_0x566bda,_0x1f26ea){return function(_0x134417){if(_0x134417){var _0x350bd9=typeof _0x1f26ea['offset']===_0x22d1('0x1a')&&typeof _0x1f26ea[_0x22d1('0x1b')]==='undefined';var _0x260b7b=_0x134417[_0x22d1('0x1c')];var _0x17d3a2=_0x350bd9?0x0:_0x1f26ea[_0x22d1('0x1d')];var _0x1bde18=_0x350bd9?_0x134417[_0x22d1('0x1c')]:_0x1f26ea[_0x22d1('0x1d')]+_0x1f26ea['limit'];var _0x37cade;if(_0x1bde18>=_0x260b7b){_0x1bde18=_0x260b7b;_0x37cade=0xc8;}else{_0x37cade=0xce;}_0x566bda['status'](_0x37cade);return _0x566bda[_0x22d1('0x1e')](_0x22d1('0x1f'),_0x17d3a2+'-'+_0x1bde18+'/'+_0x260b7b)[_0x22d1('0x19')](_0x134417);}return null;};}function patchUpdates(_0x5b748d){return function(_0x3c0c34){try{jsonpatch[_0x22d1('0x20')](_0x3c0c34,_0x5b748d,!![]);}catch(_0x4bb801){return BPromise[_0x22d1('0x21')](_0x4bb801);}return _0x3c0c34['save']();};}function saveUpdates(_0x2d4a15,_0x37e773){return function(_0x25c860){if(_0x25c860){return _0x25c860[_0x22d1('0x22')](_0x2d4a15)[_0x22d1('0x23')](function(_0x43aea5){return _0x43aea5;});}return null;};}function removeEntity(_0xfc1fc,_0x591a58){return function(_0x58732d){if(_0x58732d){return _0x58732d[_0x22d1('0x24')]()['then'](function(){_0xfc1fc[_0x22d1('0x17')](0xcc)[_0x22d1('0x18')]();});}};}function handleEntityNotFound(_0x56d47f,_0x5795aa){return function(_0x532180){if(!_0x532180){_0x56d47f['sendStatus'](0x194);}return _0x532180;};}function handleError(_0x53e36b,_0x1d4330){_0x1d4330=_0x1d4330||0x1f4;return function(_0x9d1e04){logger[_0x22d1('0x25')](_0x9d1e04['stack']);if(_0x9d1e04[_0x22d1('0x26')]){delete _0x9d1e04[_0x22d1('0x26')];}_0x53e36b['status'](_0x1d4330)[_0x22d1('0x27')](_0x9d1e04);};}exports['index']=function(_0x2c1f44,_0x13d3b6){var _0x4b2d81={},_0x55719b={},_0x25ad10={'count':0x0,'rows':[]};var _0x1576dc=_[_0x22d1('0x28')](db[_0x22d1('0x29')][_0x22d1('0x2a')],function(_0x364542){return{'name':_0x364542['fieldName'],'type':_0x364542[_0x22d1('0x2b')][_0x22d1('0x2c')]};});_0x55719b[_0x22d1('0x2d')]=_[_0x22d1('0x28')](_0x1576dc,_0x22d1('0x26'));_0x55719b['query']=_[_0x22d1('0x2e')](_0x2c1f44[_0x22d1('0x2f')]);_0x55719b['filters']=_['intersection'](_0x55719b[_0x22d1('0x2d')],_0x55719b[_0x22d1('0x2f')]);_0x4b2d81['attributes']=_[_0x22d1('0x30')](_0x55719b[_0x22d1('0x2d')],qs[_0x22d1('0x31')](_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x31')]));_0x4b2d81['attributes']=_0x4b2d81[_0x22d1('0x32')]['length']?_0x4b2d81[_0x22d1('0x32')]:_0x55719b[_0x22d1('0x2d')];if(!_0x2c1f44['query'][_0x22d1('0x33')]('nolimit')){_0x4b2d81[_0x22d1('0x1b')]=qs['limit'](_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x1b')]);_0x4b2d81['offset']=qs[_0x22d1('0x1d')](_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x1d')]);}_0x4b2d81[_0x22d1('0x34')]=qs[_0x22d1('0x35')](_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x35')]);_0x4b2d81[_0x22d1('0x36')]=qs[_0x22d1('0x37')](_['pick'](_0x2c1f44[_0x22d1('0x2f')],_0x55719b[_0x22d1('0x37')]),_0x1576dc);if(_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x38')]){_0x4b2d81[_0x22d1('0x36')]=_[_0x22d1('0x39')](_0x4b2d81[_0x22d1('0x36')],{'$or':_['map'](_0x1576dc,function(_0x2db7a2){if(_0x2db7a2[_0x22d1('0x2b')]!==_0x22d1('0x3a')){var _0x4183bf={};_0x4183bf[_0x2db7a2[_0x22d1('0x26')]]={'$like':'%'+_0x2c1f44['query']['filter']+'%'};return _0x4183bf;}})});}_0x4b2d81=_[_0x22d1('0x39')]({},_0x4b2d81,_0x2c1f44[_0x22d1('0x3b')]);var _0x34c7f0={'where':_0x4b2d81['where']};return db[_0x22d1('0x29')][_0x22d1('0x1c')](_0x34c7f0)[_0x22d1('0x23')](function(_0x430fe6){_0x25ad10['count']=_0x430fe6;if(_0x2c1f44['query'][_0x22d1('0x3c')]){_0x4b2d81[_0x22d1('0x3d')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x22d1('0x3e')](_0x4b2d81);})[_0x22d1('0x23')](function(_0xf42feb){_0x25ad10['rows']=_0xf42feb;return _0x25ad10;})[_0x22d1('0x23')](respondWithFilteredResult(_0x13d3b6,_0x4b2d81))[_0x22d1('0x3f')](handleError(_0x13d3b6,null));};exports[_0x22d1('0x40')]=function(_0x34c8ed,_0x2e35b4){var _0x5d312f={'raw':![],'where':{'id':_0x34c8ed[_0x22d1('0x41')]['id']}},_0x2a491a={};_0x2a491a[_0x22d1('0x2d')]=_[_0x22d1('0x2e')](db[_0x22d1('0x29')]['rawAttributes']);_0x2a491a[_0x22d1('0x2f')]=_['keys'](_0x34c8ed[_0x22d1('0x2f')]);_0x2a491a[_0x22d1('0x37')]=_[_0x22d1('0x30')](_0x2a491a[_0x22d1('0x2d')],_0x2a491a[_0x22d1('0x2f')]);_0x5d312f[_0x22d1('0x32')]=_[_0x22d1('0x30')](_0x2a491a[_0x22d1('0x2d')],qs[_0x22d1('0x31')](_0x34c8ed[_0x22d1('0x2f')][_0x22d1('0x31')]));_0x5d312f[_0x22d1('0x32')]=_0x5d312f['attributes']['length']?_0x5d312f['attributes']:_0x2a491a[_0x22d1('0x2d')];if(_0x34c8ed[_0x22d1('0x2f')][_0x22d1('0x3c')]){_0x5d312f[_0x22d1('0x3d')]=[{'all':!![]}];}_0x5d312f=_[_0x22d1('0x39')]({},_0x5d312f,_0x34c8ed[_0x22d1('0x3b')]);return db[_0x22d1('0x29')][_0x22d1('0x42')](_0x5d312f)[_0x22d1('0x23')](handleEntityNotFound(_0x2e35b4,null))[_0x22d1('0x23')](respondWithResult(_0x2e35b4,null))['catch'](handleError(_0x2e35b4,null));};exports[_0x22d1('0x43')]=function(_0x4a0b2d,_0x55af90){return db[_0x22d1('0x29')][_0x22d1('0x43')](_0x4a0b2d['body'],{})[_0x22d1('0x23')](respondWithResult(_0x55af90,0xc9))[_0x22d1('0x3f')](handleError(_0x55af90,null));};exports[_0x22d1('0x22')]=function(_0x49d56a,_0x4e66e2){if(_0x49d56a['body']['id']){delete _0x49d56a[_0x22d1('0x44')]['id'];}return db[_0x22d1('0x29')][_0x22d1('0x42')]({'where':{'id':_0x49d56a[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x4e66e2,null))['then'](saveUpdates(_0x49d56a[_0x22d1('0x44')],null))[_0x22d1('0x23')](respondWithResult(_0x4e66e2,null))['catch'](handleError(_0x4e66e2,null));};exports[_0x22d1('0x24')]=function(_0x5595bb,_0x353679){return db[_0x22d1('0x29')]['find']({'where':{'id':_0x5595bb[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x353679,null))[_0x22d1('0x23')](removeEntity(_0x353679,null))[_0x22d1('0x3f')](handleError(_0x353679,null));};exports[_0x22d1('0x45')]=function(_0x15065e,_0x1ddf3b,_0x5765a1){var _0x7f0347={};var _0x27548a={};var _0x3e91ac;var _0x444e81;return db[_0x22d1('0x29')][_0x22d1('0x46')]({'where':{'id':_0x15065e[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x1ddf3b,null))[_0x22d1('0x23')](function(_0x548847){if(_0x548847){_0x3e91ac=_0x548847;_0x27548a['model']=_[_0x22d1('0x2e')](db['Dynamics365Field'][_0x22d1('0x2a')]);_0x27548a['query']=_[_0x22d1('0x2e')](_0x15065e['query']);_0x27548a['filters']=_[_0x22d1('0x30')](_0x27548a[_0x22d1('0x2d')],_0x27548a[_0x22d1('0x2f')]);_0x7f0347[_0x22d1('0x32')]=_[_0x22d1('0x30')](_0x27548a[_0x22d1('0x2d')],qs[_0x22d1('0x31')](_0x15065e[_0x22d1('0x2f')]['fields']));_0x7f0347['attributes']=_0x7f0347[_0x22d1('0x32')][_0x22d1('0x47')]?_0x7f0347[_0x22d1('0x32')]:_0x27548a[_0x22d1('0x2d')];_0x7f0347[_0x22d1('0x34')]=qs['sort'](_0x15065e['query'][_0x22d1('0x35')]);_0x7f0347['where']=qs[_0x22d1('0x37')](_[_0x22d1('0x48')](_0x15065e[_0x22d1('0x2f')],_0x27548a[_0x22d1('0x37')]));if(_0x15065e[_0x22d1('0x2f')][_0x22d1('0x38')]){_0x7f0347[_0x22d1('0x36')]=_[_0x22d1('0x39')](_0x7f0347[_0x22d1('0x36')],{'$or':_[_0x22d1('0x28')](_0x7f0347[_0x22d1('0x32')],function(_0x4c69be){var _0x418182={};_0x418182[_0x4c69be]={'$like':'%'+_0x15065e[_0x22d1('0x2f')]['filter']+'%'};return _0x418182;})});}_0x7f0347=_[_0x22d1('0x39')]({},_0x7f0347,_0x15065e[_0x22d1('0x3b')]);return _0x3e91ac['getFields'](_0x7f0347);}})[_0x22d1('0x23')](function(_0x57712d){if(_0x57712d){_0x444e81=_0x57712d[_0x22d1('0x47')];if(!_0x15065e[_0x22d1('0x2f')][_0x22d1('0x33')](_0x22d1('0x49'))){_0x7f0347['limit']=qs[_0x22d1('0x1b')](_0x15065e[_0x22d1('0x2f')][_0x22d1('0x1b')]);_0x7f0347[_0x22d1('0x1d')]=qs[_0x22d1('0x1d')](_0x15065e['query'][_0x22d1('0x1d')]);}return _0x3e91ac[_0x22d1('0x45')](_0x7f0347);}})[_0x22d1('0x23')](function(_0x2e3777){if(_0x2e3777){return _0x2e3777?{'count':_0x444e81,'rows':_0x2e3777}:null;}})[_0x22d1('0x23')](respondWithResult(_0x1ddf3b,null))[_0x22d1('0x3f')](handleError(_0x1ddf3b,null));};exports[_0x22d1('0x4a')]=function(_0x2f78f6,_0x534e79,_0x4e0162){var _0x5823f1={};var _0xcc67a4={};var _0x58c7ac;var _0x36c0f5;return db['Dynamics365Configuration'][_0x22d1('0x46')]({'where':{'id':_0x2f78f6[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x534e79,null))[_0x22d1('0x23')](function(_0x1c6690){if(_0x1c6690){_0x58c7ac=_0x1c6690;_0xcc67a4[_0x22d1('0x2d')]=_[_0x22d1('0x2e')](db[_0x22d1('0x4b')]['rawAttributes']);_0xcc67a4['query']=_[_0x22d1('0x2e')](_0x2f78f6[_0x22d1('0x2f')]);_0xcc67a4[_0x22d1('0x37')]=_['intersection'](_0xcc67a4[_0x22d1('0x2d')],_0xcc67a4['query']);_0x5823f1['attributes']=_[_0x22d1('0x30')](_0xcc67a4['model'],qs[_0x22d1('0x31')](_0x2f78f6['query']['fields']));_0x5823f1[_0x22d1('0x32')]=_0x5823f1[_0x22d1('0x32')][_0x22d1('0x47')]?_0x5823f1[_0x22d1('0x32')]:_0xcc67a4[_0x22d1('0x2d')];_0x5823f1[_0x22d1('0x34')]=qs[_0x22d1('0x35')](_0x2f78f6[_0x22d1('0x2f')]['sort']);_0x5823f1['where']=qs[_0x22d1('0x37')](_[_0x22d1('0x48')](_0x2f78f6[_0x22d1('0x2f')],_0xcc67a4[_0x22d1('0x37')]));if(_0x2f78f6['query']['filter']){_0x5823f1[_0x22d1('0x36')]=_[_0x22d1('0x39')](_0x5823f1['where'],{'$or':_[_0x22d1('0x28')](_0x5823f1[_0x22d1('0x32')],function(_0x41c0a1){var _0xf1348={};_0xf1348[_0x41c0a1]={'$like':'%'+_0x2f78f6[_0x22d1('0x2f')][_0x22d1('0x38')]+'%'};return _0xf1348;})});}_0x5823f1=_['merge']({},_0x5823f1,_0x2f78f6['options']);return _0x58c7ac['getSubjects'](_0x5823f1);}})['then'](function(_0x48d356){if(_0x48d356){_0x36c0f5=_0x48d356[_0x22d1('0x47')];if(!_0x2f78f6[_0x22d1('0x2f')][_0x22d1('0x33')]('nolimit')){_0x5823f1[_0x22d1('0x1b')]=qs[_0x22d1('0x1b')](_0x2f78f6[_0x22d1('0x2f')][_0x22d1('0x1b')]);_0x5823f1[_0x22d1('0x1d')]=qs['offset'](_0x2f78f6[_0x22d1('0x2f')][_0x22d1('0x1d')]);}return _0x58c7ac[_0x22d1('0x4a')](_0x5823f1);}})[_0x22d1('0x23')](function(_0xa8463c){if(_0xa8463c){return _0xa8463c?{'count':_0x36c0f5,'rows':_0xa8463c}:null;}})[_0x22d1('0x23')](respondWithResult(_0x534e79,null))[_0x22d1('0x3f')](handleError(_0x534e79,null));};exports[_0x22d1('0x4c')]=function(_0x342744,_0x1973b1,_0x5e8c39){var _0x500068={};var _0x34c6da={};var _0x3ca95c;var _0x17b0ca;return db[_0x22d1('0x29')][_0x22d1('0x46')]({'where':{'id':_0x342744[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x1973b1,null))[_0x22d1('0x23')](function(_0x5535dd){if(_0x5535dd){_0x3ca95c=_0x5535dd;_0x34c6da[_0x22d1('0x2d')]=_[_0x22d1('0x2e')](db[_0x22d1('0x4b')][_0x22d1('0x2a')]);_0x34c6da['query']=_[_0x22d1('0x2e')](_0x342744[_0x22d1('0x2f')]);_0x34c6da[_0x22d1('0x37')]=_[_0x22d1('0x30')](_0x34c6da[_0x22d1('0x2d')],_0x34c6da[_0x22d1('0x2f')]);_0x500068[_0x22d1('0x32')]=_[_0x22d1('0x30')](_0x34c6da[_0x22d1('0x2d')],qs['fields'](_0x342744[_0x22d1('0x2f')]['fields']));_0x500068['attributes']=_0x500068[_0x22d1('0x32')][_0x22d1('0x47')]?_0x500068[_0x22d1('0x32')]:_0x34c6da[_0x22d1('0x2d')];_0x500068[_0x22d1('0x34')]=qs[_0x22d1('0x35')](_0x342744[_0x22d1('0x2f')][_0x22d1('0x35')]);_0x500068[_0x22d1('0x36')]=qs[_0x22d1('0x37')](_[_0x22d1('0x48')](_0x342744[_0x22d1('0x2f')],_0x34c6da[_0x22d1('0x37')]));if(_0x342744['query'][_0x22d1('0x38')]){_0x500068[_0x22d1('0x36')]=_[_0x22d1('0x39')](_0x500068['where'],{'$or':_[_0x22d1('0x28')](_0x500068[_0x22d1('0x32')],function(_0x9a22a5){var _0x483ef4={};_0x483ef4[_0x9a22a5]={'$like':'%'+_0x342744[_0x22d1('0x2f')][_0x22d1('0x38')]+'%'};return _0x483ef4;})});}_0x500068=_[_0x22d1('0x39')]({},_0x500068,_0x342744[_0x22d1('0x3b')]);return _0x3ca95c[_0x22d1('0x4c')](_0x500068);}})[_0x22d1('0x23')](function(_0x5cce2a){if(_0x5cce2a){_0x17b0ca=_0x5cce2a[_0x22d1('0x47')];if(!_0x342744[_0x22d1('0x2f')][_0x22d1('0x33')](_0x22d1('0x49'))){_0x500068['limit']=qs[_0x22d1('0x1b')](_0x342744['query'][_0x22d1('0x1b')]);_0x500068[_0x22d1('0x1d')]=qs['offset'](_0x342744[_0x22d1('0x2f')][_0x22d1('0x1d')]);}return _0x3ca95c[_0x22d1('0x4c')](_0x500068);}})[_0x22d1('0x23')](function(_0x5d1190){if(_0x5d1190){return _0x5d1190?{'count':_0x17b0ca,'rows':_0x5d1190}:null;}})[_0x22d1('0x23')](respondWithResult(_0x1973b1,null))[_0x22d1('0x3f')](handleError(_0x1973b1,null));}; \ No newline at end of file +var _0x49fe=['sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','index','map','Dynamics365Configuration','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x102cba,_0x254fa7){var _0x232493=function(_0x468dbd){while(--_0x468dbd){_0x102cba['push'](_0x102cba['shift']());}};_0x232493(++_0x254fa7);}(_0x49fe,0x1e7));var _0xe49f=function(_0x480ee3,_0x32910c){_0x480ee3=_0x480ee3-0x0;var _0x4a6af4=_0x49fe[_0x480ee3];return _0x4a6af4;};'use strict';var emlformat=require(_0xe49f('0x0'));var rimraf=require(_0xe49f('0x1'));var zipdir=require(_0xe49f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe49f('0x3'));var moment=require(_0xe49f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe49f('0x5'));var path=require('path');var sox=require(_0xe49f('0x6'));var csv=require('to-csv');var ejs=require(_0xe49f('0x7'));var fs=require('fs');var fs_extra=require(_0xe49f('0x8'));var _=require(_0xe49f('0x9'));var squel=require(_0xe49f('0xa'));var crypto=require('crypto');var jsforce=require(_0xe49f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe49f('0xc'));var querystring=require(_0xe49f('0xd'));var Papa=require(_0xe49f('0xe'));var Redis=require(_0xe49f('0xf'));var authService=require(_0xe49f('0x10'));var qs=require(_0xe49f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe49f('0x12'))(_0xe49f('0x13'));var utils=require(_0xe49f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe49f('0x15'))['db'];function respondWithStatusCode(_0x31c855,_0x2bde6a){_0x2bde6a=_0x2bde6a||0xcc;return function(_0x4eec4f){if(_0x4eec4f){return _0x31c855['sendStatus'](_0x2bde6a);}return _0x31c855[_0xe49f('0x16')](_0x2bde6a)[_0xe49f('0x17')]();};}function respondWithResult(_0x4c3d84,_0x23eede){_0x23eede=_0x23eede||0xc8;return function(_0x268c74){if(_0x268c74){return _0x4c3d84[_0xe49f('0x16')](_0x23eede)[_0xe49f('0x18')](_0x268c74);}};}function respondWithFilteredResult(_0x23c6ec,_0x3af6c4){return function(_0xb24f79){if(_0xb24f79){var _0x275a11=typeof _0x3af6c4[_0xe49f('0x19')]===_0xe49f('0x1a')&&typeof _0x3af6c4[_0xe49f('0x1b')]===_0xe49f('0x1a');var _0x3e3ed6=_0xb24f79[_0xe49f('0x1c')];var _0xd1872=_0x275a11?0x0:_0x3af6c4[_0xe49f('0x19')];var _0x4e02b3=_0x275a11?_0xb24f79['count']:_0x3af6c4[_0xe49f('0x19')]+_0x3af6c4[_0xe49f('0x1b')];var _0x489f93;if(_0x4e02b3>=_0x3e3ed6){_0x4e02b3=_0x3e3ed6;_0x489f93=0xc8;}else{_0x489f93=0xce;}_0x23c6ec[_0xe49f('0x16')](_0x489f93);return _0x23c6ec['set'](_0xe49f('0x1d'),_0xd1872+'-'+_0x4e02b3+'/'+_0x3e3ed6)[_0xe49f('0x18')](_0xb24f79);}return null;};}function patchUpdates(_0x1e06ae){return function(_0x210b69){try{jsonpatch['apply'](_0x210b69,_0x1e06ae,!![]);}catch(_0x26d1af){return BPromise[_0xe49f('0x1e')](_0x26d1af);}return _0x210b69[_0xe49f('0x1f')]();};}function saveUpdates(_0xcba653,_0xf5fb75){return function(_0x12eadb){if(_0x12eadb){return _0x12eadb['update'](_0xcba653)[_0xe49f('0x20')](function(_0x45282a){return _0x45282a;});}return null;};}function removeEntity(_0x14cc9f,_0x245e4d){return function(_0x3ab6b8){if(_0x3ab6b8){return _0x3ab6b8[_0xe49f('0x21')]()['then'](function(){_0x14cc9f[_0xe49f('0x16')](0xcc)[_0xe49f('0x17')]();});}};}function handleEntityNotFound(_0x1b87bf,_0x514ab9){return function(_0x2d2772){if(!_0x2d2772){_0x1b87bf[_0xe49f('0x22')](0x194);}return _0x2d2772;};}function handleError(_0x14ae60,_0x50173d){_0x50173d=_0x50173d||0x1f4;return function(_0x566f40){logger[_0xe49f('0x23')](_0x566f40[_0xe49f('0x24')]);if(_0x566f40[_0xe49f('0x25')]){delete _0x566f40[_0xe49f('0x25')];}_0x14ae60[_0xe49f('0x16')](_0x50173d)['send'](_0x566f40);};}exports[_0xe49f('0x26')]=function(_0x566da0,_0x23b169){var _0x469172={},_0x37d309={},_0x3ae67f={'count':0x0,'rows':[]};var _0x406230=_[_0xe49f('0x27')](db[_0xe49f('0x28')][_0xe49f('0x29')],function(_0x14ec2d){return{'name':_0x14ec2d['fieldName'],'type':_0x14ec2d['type'][_0xe49f('0x2a')]};});_0x37d309[_0xe49f('0x2b')]=_['map'](_0x406230,_0xe49f('0x25'));_0x37d309[_0xe49f('0x2c')]=_['keys'](_0x566da0[_0xe49f('0x2c')]);_0x37d309[_0xe49f('0x2d')]=_[_0xe49f('0x2e')](_0x37d309[_0xe49f('0x2b')],_0x37d309['query']);_0x469172[_0xe49f('0x2f')]=_[_0xe49f('0x2e')](_0x37d309[_0xe49f('0x2b')],qs[_0xe49f('0x30')](_0x566da0[_0xe49f('0x2c')]['fields']));_0x469172[_0xe49f('0x2f')]=_0x469172[_0xe49f('0x2f')][_0xe49f('0x31')]?_0x469172[_0xe49f('0x2f')]:_0x37d309[_0xe49f('0x2b')];if(!_0x566da0[_0xe49f('0x2c')]['hasOwnProperty'](_0xe49f('0x32'))){_0x469172[_0xe49f('0x1b')]=qs['limit'](_0x566da0[_0xe49f('0x2c')]['limit']);_0x469172[_0xe49f('0x19')]=qs['offset'](_0x566da0['query'][_0xe49f('0x19')]);}_0x469172[_0xe49f('0x33')]=qs[_0xe49f('0x34')](_0x566da0[_0xe49f('0x2c')][_0xe49f('0x34')]);_0x469172[_0xe49f('0x35')]=qs['filters'](_[_0xe49f('0x36')](_0x566da0[_0xe49f('0x2c')],_0x37d309['filters']),_0x406230);if(_0x566da0[_0xe49f('0x2c')][_0xe49f('0x37')]){_0x469172[_0xe49f('0x35')]=_['merge'](_0x469172[_0xe49f('0x35')],{'$or':_['map'](_0x406230,function(_0x3a86b5){if(_0x3a86b5[_0xe49f('0x38')]!==_0xe49f('0x39')){var _0x22f06e={};_0x22f06e[_0x3a86b5[_0xe49f('0x25')]]={'$like':'%'+_0x566da0[_0xe49f('0x2c')][_0xe49f('0x37')]+'%'};return _0x22f06e;}})});}_0x469172=_[_0xe49f('0x3a')]({},_0x469172,_0x566da0[_0xe49f('0x3b')]);var _0x34eb4d={'where':_0x469172[_0xe49f('0x35')]};return db['Dynamics365Configuration'][_0xe49f('0x1c')](_0x34eb4d)[_0xe49f('0x20')](function(_0x2fe67e){_0x3ae67f[_0xe49f('0x1c')]=_0x2fe67e;if(_0x566da0[_0xe49f('0x2c')][_0xe49f('0x3c')]){_0x469172[_0xe49f('0x3d')]=[{'all':!![]}];}return db[_0xe49f('0x28')][_0xe49f('0x3e')](_0x469172);})[_0xe49f('0x20')](function(_0x29c3fb){_0x3ae67f[_0xe49f('0x3f')]=_0x29c3fb;return _0x3ae67f;})[_0xe49f('0x20')](respondWithFilteredResult(_0x23b169,_0x469172))[_0xe49f('0x40')](handleError(_0x23b169,null));};exports['show']=function(_0x2749c5,_0x1e5768){var _0x97743f={'raw':![],'where':{'id':_0x2749c5[_0xe49f('0x41')]['id']}},_0x235a0a={};_0x235a0a[_0xe49f('0x2b')]=_[_0xe49f('0x42')](db[_0xe49f('0x28')]['rawAttributes']);_0x235a0a['query']=_['keys'](_0x2749c5[_0xe49f('0x2c')]);_0x235a0a[_0xe49f('0x2d')]=_[_0xe49f('0x2e')](_0x235a0a[_0xe49f('0x2b')],_0x235a0a[_0xe49f('0x2c')]);_0x97743f[_0xe49f('0x2f')]=_[_0xe49f('0x2e')](_0x235a0a[_0xe49f('0x2b')],qs['fields'](_0x2749c5['query'][_0xe49f('0x30')]));_0x97743f[_0xe49f('0x2f')]=_0x97743f[_0xe49f('0x2f')][_0xe49f('0x31')]?_0x97743f[_0xe49f('0x2f')]:_0x235a0a[_0xe49f('0x2b')];if(_0x2749c5['query'][_0xe49f('0x3c')]){_0x97743f['include']=[{'all':!![]}];}_0x97743f=_['merge']({},_0x97743f,_0x2749c5[_0xe49f('0x3b')]);return db['Dynamics365Configuration'][_0xe49f('0x43')](_0x97743f)['then'](handleEntityNotFound(_0x1e5768,null))[_0xe49f('0x20')](respondWithResult(_0x1e5768,null))[_0xe49f('0x40')](handleError(_0x1e5768,null));};exports[_0xe49f('0x44')]=function(_0x3f1e44,_0x21f210){return db[_0xe49f('0x28')][_0xe49f('0x44')](_0x3f1e44['body'],{})[_0xe49f('0x20')](respondWithResult(_0x21f210,0xc9))['catch'](handleError(_0x21f210,null));};exports[_0xe49f('0x45')]=function(_0x33c0b3,_0xb8ecda){if(_0x33c0b3[_0xe49f('0x46')]['id']){delete _0x33c0b3[_0xe49f('0x46')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x33c0b3[_0xe49f('0x41')]['id']}})[_0xe49f('0x20')](handleEntityNotFound(_0xb8ecda,null))[_0xe49f('0x20')](saveUpdates(_0x33c0b3[_0xe49f('0x46')],null))[_0xe49f('0x20')](respondWithResult(_0xb8ecda,null))[_0xe49f('0x40')](handleError(_0xb8ecda,null));};exports[_0xe49f('0x21')]=function(_0x2e5d19,_0xdee285){return db[_0xe49f('0x28')][_0xe49f('0x43')]({'where':{'id':_0x2e5d19[_0xe49f('0x41')]['id']}})[_0xe49f('0x20')](handleEntityNotFound(_0xdee285,null))['then'](removeEntity(_0xdee285,null))[_0xe49f('0x40')](handleError(_0xdee285,null));};exports[_0xe49f('0x47')]=function(_0x3d4d11,_0xd3fcec,_0xeead32){var _0x2784fc={};var _0xa08509={};var _0x1d6906;var _0x13f885;return db['Dynamics365Configuration'][_0xe49f('0x48')]({'where':{'id':_0x3d4d11['params']['id']}})[_0xe49f('0x20')](handleEntityNotFound(_0xd3fcec,null))[_0xe49f('0x20')](function(_0x3dad60){if(_0x3dad60){_0x1d6906=_0x3dad60;_0xa08509['model']=_[_0xe49f('0x42')](db[_0xe49f('0x49')][_0xe49f('0x29')]);_0xa08509[_0xe49f('0x2c')]=_[_0xe49f('0x42')](_0x3d4d11[_0xe49f('0x2c')]);_0xa08509[_0xe49f('0x2d')]=_[_0xe49f('0x2e')](_0xa08509[_0xe49f('0x2b')],_0xa08509[_0xe49f('0x2c')]);_0x2784fc[_0xe49f('0x2f')]=_['intersection'](_0xa08509[_0xe49f('0x2b')],qs[_0xe49f('0x30')](_0x3d4d11['query'][_0xe49f('0x30')]));_0x2784fc[_0xe49f('0x2f')]=_0x2784fc['attributes'][_0xe49f('0x31')]?_0x2784fc['attributes']:_0xa08509['model'];_0x2784fc['order']=qs[_0xe49f('0x34')](_0x3d4d11[_0xe49f('0x2c')][_0xe49f('0x34')]);_0x2784fc['where']=qs[_0xe49f('0x2d')](_['pick'](_0x3d4d11['query'],_0xa08509[_0xe49f('0x2d')]));if(_0x3d4d11[_0xe49f('0x2c')]['filter']){_0x2784fc['where']=_['merge'](_0x2784fc[_0xe49f('0x35')],{'$or':_[_0xe49f('0x27')](_0x2784fc[_0xe49f('0x2f')],function(_0x489c78){var _0x19faf4={};_0x19faf4[_0x489c78]={'$like':'%'+_0x3d4d11[_0xe49f('0x2c')][_0xe49f('0x37')]+'%'};return _0x19faf4;})});}_0x2784fc=_['merge']({},_0x2784fc,_0x3d4d11[_0xe49f('0x3b')]);return _0x1d6906['getFields'](_0x2784fc);}})['then'](function(_0x3fc6a7){if(_0x3fc6a7){_0x13f885=_0x3fc6a7[_0xe49f('0x31')];if(!_0x3d4d11[_0xe49f('0x2c')][_0xe49f('0x4a')]('nolimit')){_0x2784fc[_0xe49f('0x1b')]=qs['limit'](_0x3d4d11[_0xe49f('0x2c')][_0xe49f('0x1b')]);_0x2784fc[_0xe49f('0x19')]=qs['offset'](_0x3d4d11[_0xe49f('0x2c')][_0xe49f('0x19')]);}return _0x1d6906[_0xe49f('0x47')](_0x2784fc);}})['then'](function(_0x2197bf){if(_0x2197bf){return _0x2197bf?{'count':_0x13f885,'rows':_0x2197bf}:null;}})[_0xe49f('0x20')](respondWithResult(_0xd3fcec,null))[_0xe49f('0x40')](handleError(_0xd3fcec,null));};exports[_0xe49f('0x4b')]=function(_0x51fdc5,_0x35f911,_0x429613){var _0x2a22cc={};var _0xd4d925={};var _0x27db61;var _0x2a0721;return db[_0xe49f('0x28')][_0xe49f('0x48')]({'where':{'id':_0x51fdc5[_0xe49f('0x41')]['id']}})['then'](handleEntityNotFound(_0x35f911,null))[_0xe49f('0x20')](function(_0x4ae810){if(_0x4ae810){_0x27db61=_0x4ae810;_0xd4d925['model']=_[_0xe49f('0x42')](db[_0xe49f('0x49')][_0xe49f('0x29')]);_0xd4d925['query']=_[_0xe49f('0x42')](_0x51fdc5['query']);_0xd4d925[_0xe49f('0x2d')]=_[_0xe49f('0x2e')](_0xd4d925[_0xe49f('0x2b')],_0xd4d925[_0xe49f('0x2c')]);_0x2a22cc[_0xe49f('0x2f')]=_[_0xe49f('0x2e')](_0xd4d925[_0xe49f('0x2b')],qs['fields'](_0x51fdc5['query'][_0xe49f('0x30')]));_0x2a22cc[_0xe49f('0x2f')]=_0x2a22cc[_0xe49f('0x2f')][_0xe49f('0x31')]?_0x2a22cc[_0xe49f('0x2f')]:_0xd4d925[_0xe49f('0x2b')];_0x2a22cc[_0xe49f('0x33')]=qs['sort'](_0x51fdc5['query'][_0xe49f('0x34')]);_0x2a22cc[_0xe49f('0x35')]=qs[_0xe49f('0x2d')](_[_0xe49f('0x36')](_0x51fdc5[_0xe49f('0x2c')],_0xd4d925[_0xe49f('0x2d')]));if(_0x51fdc5['query'][_0xe49f('0x37')]){_0x2a22cc[_0xe49f('0x35')]=_[_0xe49f('0x3a')](_0x2a22cc[_0xe49f('0x35')],{'$or':_[_0xe49f('0x27')](_0x2a22cc['attributes'],function(_0x235cbc){var _0x3f70b0={};_0x3f70b0[_0x235cbc]={'$like':'%'+_0x51fdc5[_0xe49f('0x2c')][_0xe49f('0x37')]+'%'};return _0x3f70b0;})});}_0x2a22cc=_[_0xe49f('0x3a')]({},_0x2a22cc,_0x51fdc5['options']);return _0x27db61['getSubjects'](_0x2a22cc);}})[_0xe49f('0x20')](function(_0x8ac901){if(_0x8ac901){_0x2a0721=_0x8ac901[_0xe49f('0x31')];if(!_0x51fdc5['query'][_0xe49f('0x4a')](_0xe49f('0x32'))){_0x2a22cc['limit']=qs[_0xe49f('0x1b')](_0x51fdc5[_0xe49f('0x2c')][_0xe49f('0x1b')]);_0x2a22cc[_0xe49f('0x19')]=qs['offset'](_0x51fdc5[_0xe49f('0x2c')][_0xe49f('0x19')]);}return _0x27db61['getSubjects'](_0x2a22cc);}})[_0xe49f('0x20')](function(_0xe995de){if(_0xe995de){return _0xe995de?{'count':_0x2a0721,'rows':_0xe995de}:null;}})[_0xe49f('0x20')](respondWithResult(_0x35f911,null))[_0xe49f('0x40')](handleError(_0x35f911,null));};exports[_0xe49f('0x4c')]=function(_0x3c911a,_0x4db483,_0x47ed73){var _0xc82651={};var _0x366c8c={};var _0x4987c5;var _0x460ffe;return db[_0xe49f('0x28')][_0xe49f('0x48')]({'where':{'id':_0x3c911a[_0xe49f('0x41')]['id']}})['then'](handleEntityNotFound(_0x4db483,null))[_0xe49f('0x20')](function(_0x25c8d1){if(_0x25c8d1){_0x4987c5=_0x25c8d1;_0x366c8c['model']=_[_0xe49f('0x42')](db[_0xe49f('0x49')]['rawAttributes']);_0x366c8c[_0xe49f('0x2c')]=_[_0xe49f('0x42')](_0x3c911a[_0xe49f('0x2c')]);_0x366c8c[_0xe49f('0x2d')]=_[_0xe49f('0x2e')](_0x366c8c[_0xe49f('0x2b')],_0x366c8c[_0xe49f('0x2c')]);_0xc82651[_0xe49f('0x2f')]=_[_0xe49f('0x2e')](_0x366c8c[_0xe49f('0x2b')],qs[_0xe49f('0x30')](_0x3c911a[_0xe49f('0x2c')][_0xe49f('0x30')]));_0xc82651[_0xe49f('0x2f')]=_0xc82651[_0xe49f('0x2f')]['length']?_0xc82651[_0xe49f('0x2f')]:_0x366c8c['model'];_0xc82651[_0xe49f('0x33')]=qs[_0xe49f('0x34')](_0x3c911a[_0xe49f('0x2c')][_0xe49f('0x34')]);_0xc82651[_0xe49f('0x35')]=qs['filters'](_['pick'](_0x3c911a[_0xe49f('0x2c')],_0x366c8c[_0xe49f('0x2d')]));if(_0x3c911a[_0xe49f('0x2c')]['filter']){_0xc82651[_0xe49f('0x35')]=_[_0xe49f('0x3a')](_0xc82651['where'],{'$or':_[_0xe49f('0x27')](_0xc82651['attributes'],function(_0x3fb821){var _0x27b82c={};_0x27b82c[_0x3fb821]={'$like':'%'+_0x3c911a[_0xe49f('0x2c')][_0xe49f('0x37')]+'%'};return _0x27b82c;})});}_0xc82651=_[_0xe49f('0x3a')]({},_0xc82651,_0x3c911a[_0xe49f('0x3b')]);return _0x4987c5[_0xe49f('0x4c')](_0xc82651);}})[_0xe49f('0x20')](function(_0xd5d292){if(_0xd5d292){_0x460ffe=_0xd5d292[_0xe49f('0x31')];if(!_0x3c911a[_0xe49f('0x2c')][_0xe49f('0x4a')]('nolimit')){_0xc82651[_0xe49f('0x1b')]=qs[_0xe49f('0x1b')](_0x3c911a[_0xe49f('0x2c')][_0xe49f('0x1b')]);_0xc82651[_0xe49f('0x19')]=qs[_0xe49f('0x19')](_0x3c911a[_0xe49f('0x2c')][_0xe49f('0x19')]);}return _0x4987c5['getDescriptions'](_0xc82651);}})[_0xe49f('0x20')](function(_0x298374){if(_0x298374){return _0x298374?{'count':_0x460ffe,'rows':_0x298374}:null;}})['then'](respondWithResult(_0x4db483,null))[_0xe49f('0x40')](handleError(_0x4db483,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4501b09..c533f24 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 _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x283cb6,_0x2fe492){var _0x2ad9c9=function(_0x5195f0){while(--_0x5195f0){_0x283cb6['push'](_0x283cb6['shift']());}};_0x2ad9c9(++_0x2fe492);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x49ad17,_0x127d26){_0x49ad17=_0x49ad17-0x0;var _0x1ec05f=_0x8d0e[_0x49ad17];return _0x1ec05f;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x9387e4,_0x553b9a){var _0x425780=function(_0x5975ab){while(--_0x5975ab){_0x9387e4['push'](_0x9387e4['shift']());}};_0x425780(++_0x553b9a);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x174122,_0x430138){_0x174122=_0x174122-0x0;var _0x524fb4=_0xd6d6[_0x174122];return _0x524fb4;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index eb1df75..b749e66 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 _0xd885=['http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3f176b,_0x43309e){var _0x1c7a95=function(_0x1cc3a0){while(--_0x1cc3a0){_0x3f176b['push'](_0x3f176b['shift']());}};_0x1c7a95(++_0x43309e);}(_0xd885,0x74));var _0x5d88=function(_0x324498,_0x3c66e5){_0x324498=_0x324498-0x0;var _0xd5685=_0xd885[_0x324498];return _0xd5685;};'use strict';var _=require(_0x5d88('0x0'));var util=require('util');var moment=require(_0x5d88('0x1'));var BPromise=require(_0x5d88('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d88('0x3'))['db'];var utils=require(_0x5d88('0x4'));var logger=require(_0x5d88('0x5'))(_0x5d88('0x6'));var config=require(_0x5d88('0x7'));var jayson=require(_0x5d88('0x8'));var client=jayson[_0x5d88('0x9')][_0x5d88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a798e,_0x2fa3db,_0x31d79b){return new BPromise(function(_0x1bac17,_0xc3fdf3){return client[_0x5d88('0xb')](_0x2a798e,_0x31d79b)[_0x5d88('0xc')](function(_0x1c1ffa){logger[_0x5d88('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2fa3db,'request\x20sent');logger['debug'](_0x5d88('0xe'),_0x2fa3db,_0x5d88('0xf'),JSON['stringify'](_0x1c1ffa));if(_0x1c1ffa[_0x5d88('0x10')]){if(_0x1c1ffa[_0x5d88('0x10')][_0x5d88('0x11')]===0x1f4){logger[_0x5d88('0x10')](_0x5d88('0x12'),_0x2fa3db,_0x1c1ffa[_0x5d88('0x10')][_0x5d88('0x13')]);return _0xc3fdf3(_0x1c1ffa[_0x5d88('0x10')][_0x5d88('0x13')]);}logger['error'](_0x5d88('0x12'),_0x2fa3db,_0x1c1ffa['error'][_0x5d88('0x13')]);return _0x1bac17(_0x1c1ffa[_0x5d88('0x10')][_0x5d88('0x13')]);}else{logger[_0x5d88('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2fa3db,_0x5d88('0xf'));_0x1bac17(_0x1c1ffa['result'][_0x5d88('0x13')]);}})[_0x5d88('0x14')](function(_0xa0e44d){logger[_0x5d88('0x10')](_0x5d88('0x12'),_0x2fa3db,_0xa0e44d);_0xc3fdf3(_0xa0e44d);});});} \ No newline at end of file +var _0xddc9=['rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xddc9,0x83));var _0x9ddc=function(_0x1c26e2,_0x3160d9){_0x1c26e2=_0x1c26e2-0x0;var _0x126217=_0xddc9[_0x1c26e2];return _0x126217;};'use strict';var _=require(_0x9ddc('0x0'));var util=require(_0x9ddc('0x1'));var moment=require(_0x9ddc('0x2'));var BPromise=require(_0x9ddc('0x3'));var rs=require(_0x9ddc('0x4'));var fs=require('fs');var Redis=require(_0x9ddc('0x5'));var db=require(_0x9ddc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ddc('0x7'));var config=require('../../config/environment');var jayson=require(_0x9ddc('0x8'));var client=jayson[_0x9ddc('0x9')][_0x9ddc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4777cd,_0x250cfb,_0x3106df){return new BPromise(function(_0x44d815,_0x1311fe){return client[_0x9ddc('0xb')](_0x4777cd,_0x3106df)[_0x9ddc('0xc')](function(_0x9b8e16){logger[_0x9ddc('0xd')](_0x9ddc('0xe'),_0x250cfb,_0x9ddc('0xf'));logger['debug'](_0x9ddc('0x10'),_0x250cfb,_0x9ddc('0xf'),JSON[_0x9ddc('0x11')](_0x9b8e16));if(_0x9b8e16[_0x9ddc('0x12')]){if(_0x9b8e16[_0x9ddc('0x12')][_0x9ddc('0x13')]===0x1f4){logger[_0x9ddc('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x250cfb,_0x9b8e16[_0x9ddc('0x12')][_0x9ddc('0x14')]);return _0x1311fe(_0x9b8e16[_0x9ddc('0x12')][_0x9ddc('0x14')]);}logger[_0x9ddc('0x12')](_0x9ddc('0xe'),_0x250cfb,_0x9b8e16['error'][_0x9ddc('0x14')]);return _0x44d815(_0x9b8e16[_0x9ddc('0x12')][_0x9ddc('0x14')]);}else{logger['info'](_0x9ddc('0xe'),_0x250cfb,_0x9ddc('0xf'));_0x44d815(_0x9b8e16[_0x9ddc('0x15')][_0x9ddc('0x14')]);}})[_0x9ddc('0x16')](function(_0x3494b6){logger[_0x9ddc('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x250cfb,_0x3494b6);_0x1311fe(_0x3494b6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index d0d765f..2b9ffcd 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 _0xb6c6=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','put','update'];(function(_0x238950,_0xac79d7){var _0x505840=function(_0x3b5bbb){while(--_0x3b5bbb){_0x238950['push'](_0x238950['shift']());}};_0x505840(++_0xac79d7);}(_0xb6c6,0x1e9));var _0x6b6c=function(_0x188658,_0x12b855){_0x188658=_0x188658-0x0;var _0x3b05d3=_0xb6c6[_0x188658];return _0x3b05d3;};'use strict';var multer=require(_0x6b6c('0x0'));var util=require(_0x6b6c('0x1'));var path=require('path');var timeout=require(_0x6b6c('0x2'));var express=require('express');var router=express[_0x6b6c('0x3')]();var fs_extra=require(_0x6b6c('0x4'));var auth=require(_0x6b6c('0x5'));var interaction=require(_0x6b6c('0x6'));var config=require(_0x6b6c('0x7'));var controller=require(_0x6b6c('0x8'));router[_0x6b6c('0x9')]('/',auth[_0x6b6c('0xa')](),controller['index']);router[_0x6b6c('0x9')](_0x6b6c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6b6c('0xc')]('/',auth[_0x6b6c('0xa')](),controller['create']);router[_0x6b6c('0xd')](_0x6b6c('0xb'),auth['isAuthenticated'](),controller[_0x6b6c('0xe')]);router[_0x6b6c('0xf')](_0x6b6c('0xb'),auth[_0x6b6c('0xa')](),controller[_0x6b6c('0x10')]);module[_0x6b6c('0x11')]=router; \ No newline at end of file +var _0x893b=['fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4fb32b,_0x4b1417){var _0x15fed7=function(_0x3cd0c2){while(--_0x3cd0c2){_0x4fb32b['push'](_0x4fb32b['shift']());}};_0x15fed7(++_0x4b1417);}(_0x893b,0x1ac));var _0xb893=function(_0x122b05,_0x338ad2){_0x122b05=_0x122b05-0x0;var _0x1ff6aa=_0x893b[_0x122b05];return _0x1ff6aa;};'use strict';var multer=require(_0xb893('0x0'));var util=require('util');var path=require(_0xb893('0x1'));var timeout=require(_0xb893('0x2'));var express=require(_0xb893('0x3'));var router=express['Router']();var fs_extra=require(_0xb893('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb893('0x5'));var config=require(_0xb893('0x6'));var controller=require(_0xb893('0x7'));router[_0xb893('0x8')]('/',auth[_0xb893('0x9')](),controller['index']);router['get'](_0xb893('0xa'),auth['isAuthenticated'](),controller[_0xb893('0xb')]);router[_0xb893('0xc')]('/',auth[_0xb893('0x9')](),controller[_0xb893('0xd')]);router[_0xb893('0xe')](_0xb893('0xa'),auth[_0xb893('0x9')](),controller['update']);router[_0xb893('0xf')]('/:id',auth[_0xb893('0x9')](),controller[_0xb893('0x10')]);module[_0xb893('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index dc32917..e06efe6 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 _0xbf4c=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x7700d,_0x2b83b6){var _0x19cf1e=function(_0x18f13e){while(--_0x18f13e){_0x7700d['push'](_0x7700d['shift']());}};_0x19cf1e(++_0x2b83b6);}(_0xbf4c,0x169));var _0xcbf4=function(_0x5f4b44,_0x5463d7){_0x5f4b44=_0x5f4b44-0x0;var _0xe86de0=_0xbf4c[_0x5f4b44];return _0xe86de0;};'use strict';var Sequelize=require(_0xcbf4('0x0'));module[_0xcbf4('0x1')]={'type':{'type':Sequelize[_0xcbf4('0x2')](_0xcbf4('0x3'),_0xcbf4('0x4'),_0xcbf4('0x5'),_0xcbf4('0x6'),'picklist'),'defaultValue':_0xcbf4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcbf4('0x7')]},'keyType':{'type':Sequelize[_0xcbf4('0x2')](_0xcbf4('0x3'),_0xcbf4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xcbf4('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcbf4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcbf4('0x7')]}}; \ No newline at end of file +var _0xce50=['keyValue','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable'];(function(_0x59a219,_0x4573bf){var _0x19e28a=function(_0x1ad995){while(--_0x1ad995){_0x59a219['push'](_0x59a219['shift']());}};_0x19e28a(++_0x4573bf);}(_0xce50,0xb4));var _0x0ce5=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xce50[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require('sequelize');module[_0x0ce5('0x0')]={'type':{'type':Sequelize[_0x0ce5('0x1')](_0x0ce5('0x2'),'variable',_0x0ce5('0x3'),_0x0ce5('0x4'),'picklist'),'defaultValue':_0x0ce5('0x2')},'content':{'type':Sequelize[_0x0ce5('0x5')]},'key':{'type':Sequelize[_0x0ce5('0x5')]},'keyType':{'type':Sequelize[_0x0ce5('0x1')](_0x0ce5('0x2'),_0x0ce5('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x0ce5('0x5')]},'idField':{'type':Sequelize[_0x0ce5('0x5')]},'nameField':{'type':Sequelize[_0x0ce5('0x5')]},'customField':{'type':Sequelize[_0x0ce5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0ce5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 3b0c56a..21ecade 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 _0x9cdc=['includeAll','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','name','index','map','Dynamics365Field','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','keys'];(function(_0x52f36c,_0x971a36){var _0x54073f=function(_0x34f1d1){while(--_0x34f1d1){_0x52f36c['push'](_0x52f36c['shift']());}};_0x54073f(++_0x971a36);}(_0x9cdc,0x8c));var _0xc9cd=function(_0x179da4,_0x2d414b){_0x179da4=_0x179da4-0x0;var _0xf1d8cc=_0x9cdc[_0x179da4];return _0xf1d8cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9cd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9cd('0x1'));var rp=require(_0xc9cd('0x2'));var moment=require(_0xc9cd('0x3'));var BPromise=require(_0xc9cd('0x4'));var Mustache=require(_0xc9cd('0x5'));var util=require('util');var path=require(_0xc9cd('0x6'));var sox=require(_0xc9cd('0x7'));var csv=require('to-csv');var ejs=require(_0xc9cd('0x8'));var fs=require('fs');var fs_extra=require(_0xc9cd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc9cd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc9cd('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc9cd('0xc'));var Papa=require(_0xc9cd('0xd'));var Redis=require(_0xc9cd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc9cd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9cd('0x10'));var logger=require('../../config/logger')(_0xc9cd('0x11'));var utils=require('../../config/utils');var config=require(_0xc9cd('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9cd('0x13'))['db'];function respondWithStatusCode(_0x13e31e,_0x2178fd){_0x2178fd=_0x2178fd||0xcc;return function(_0x2628c4){if(_0x2628c4){return _0x13e31e[_0xc9cd('0x14')](_0x2178fd);}return _0x13e31e[_0xc9cd('0x15')](_0x2178fd)[_0xc9cd('0x16')]();};}function respondWithResult(_0x426e9a,_0x58961e){_0x58961e=_0x58961e||0xc8;return function(_0x181885){if(_0x181885){return _0x426e9a[_0xc9cd('0x15')](_0x58961e)[_0xc9cd('0x17')](_0x181885);}};}function respondWithFilteredResult(_0xf05825,_0x294581){return function(_0x408ec2){if(_0x408ec2){var _0x57a8d6=typeof _0x294581[_0xc9cd('0x18')]===_0xc9cd('0x19')&&typeof _0x294581[_0xc9cd('0x1a')]===_0xc9cd('0x19');var _0x5edfae=_0x408ec2[_0xc9cd('0x1b')];var _0x57161d=_0x57a8d6?0x0:_0x294581['offset'];var _0x55f38e=_0x57a8d6?_0x408ec2['count']:_0x294581[_0xc9cd('0x18')]+_0x294581[_0xc9cd('0x1a')];var _0x183f29;if(_0x55f38e>=_0x5edfae){_0x55f38e=_0x5edfae;_0x183f29=0xc8;}else{_0x183f29=0xce;}_0xf05825[_0xc9cd('0x15')](_0x183f29);return _0xf05825[_0xc9cd('0x1c')]('Content-Range',_0x57161d+'-'+_0x55f38e+'/'+_0x5edfae)[_0xc9cd('0x17')](_0x408ec2);}return null;};}function patchUpdates(_0x583ba4){return function(_0x1c52b0){try{jsonpatch[_0xc9cd('0x1d')](_0x1c52b0,_0x583ba4,!![]);}catch(_0x35c081){return BPromise[_0xc9cd('0x1e')](_0x35c081);}return _0x1c52b0['save']();};}function saveUpdates(_0x310da1,_0x31ca27){return function(_0x2f3bb0){if(_0x2f3bb0){return _0x2f3bb0[_0xc9cd('0x1f')](_0x310da1)[_0xc9cd('0x20')](function(_0x3d68a1){return _0x3d68a1;});}return null;};}function removeEntity(_0x15617d,_0x32aed8){return function(_0x13cca4){if(_0x13cca4){return _0x13cca4['destroy']()[_0xc9cd('0x20')](function(){_0x15617d[_0xc9cd('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb726,_0x2dcfde){return function(_0x4472be){if(!_0x4472be){_0x2bb726[_0xc9cd('0x14')](0x194);}return _0x4472be;};}function handleError(_0x24ef59,_0x352c42){_0x352c42=_0x352c42||0x1f4;return function(_0x3cbff4){logger[_0xc9cd('0x21')](_0x3cbff4['stack']);if(_0x3cbff4[_0xc9cd('0x22')]){delete _0x3cbff4[_0xc9cd('0x22')];}_0x24ef59['status'](_0x352c42)['send'](_0x3cbff4);};}exports[_0xc9cd('0x23')]=function(_0x453a81,_0x3798a7){var _0x103bd3={},_0x16b6a3={},_0x493afa={'count':0x0,'rows':[]};var _0x395c08=_[_0xc9cd('0x24')](db[_0xc9cd('0x25')][_0xc9cd('0x26')],function(_0x5a3a15){return{'name':_0x5a3a15[_0xc9cd('0x27')],'type':_0x5a3a15['type']['key']};});_0x16b6a3[_0xc9cd('0x28')]=_[_0xc9cd('0x24')](_0x395c08,_0xc9cd('0x22'));_0x16b6a3[_0xc9cd('0x29')]=_['keys'](_0x453a81['query']);_0x16b6a3[_0xc9cd('0x2a')]=_[_0xc9cd('0x2b')](_0x16b6a3[_0xc9cd('0x28')],_0x16b6a3[_0xc9cd('0x29')]);_0x103bd3[_0xc9cd('0x2c')]=_[_0xc9cd('0x2b')](_0x16b6a3['model'],qs[_0xc9cd('0x2d')](_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x2d')]));_0x103bd3[_0xc9cd('0x2c')]=_0x103bd3[_0xc9cd('0x2c')][_0xc9cd('0x2e')]?_0x103bd3['attributes']:_0x16b6a3[_0xc9cd('0x28')];if(!_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x2f')](_0xc9cd('0x30'))){_0x103bd3[_0xc9cd('0x1a')]=qs['limit'](_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x1a')]);_0x103bd3[_0xc9cd('0x18')]=qs[_0xc9cd('0x18')](_0x453a81['query'][_0xc9cd('0x18')]);}_0x103bd3[_0xc9cd('0x31')]=qs[_0xc9cd('0x32')](_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x32')]);_0x103bd3[_0xc9cd('0x33')]=qs[_0xc9cd('0x2a')](_[_0xc9cd('0x34')](_0x453a81['query'],_0x16b6a3[_0xc9cd('0x2a')]),_0x395c08);if(_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x35')]){_0x103bd3[_0xc9cd('0x33')]=_[_0xc9cd('0x36')](_0x103bd3['where'],{'$or':_[_0xc9cd('0x24')](_0x395c08,function(_0x13ee0a){if(_0x13ee0a[_0xc9cd('0x37')]!=='VIRTUAL'){var _0x1c9e2b={};_0x1c9e2b[_0x13ee0a[_0xc9cd('0x22')]]={'$like':'%'+_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x35')]+'%'};return _0x1c9e2b;}})});}_0x103bd3=_[_0xc9cd('0x36')]({},_0x103bd3,_0x453a81[_0xc9cd('0x38')]);var _0x4b3582={'where':_0x103bd3[_0xc9cd('0x33')]};return db[_0xc9cd('0x25')]['count'](_0x4b3582)[_0xc9cd('0x20')](function(_0x16f929){_0x493afa[_0xc9cd('0x1b')]=_0x16f929;if(_0x453a81[_0xc9cd('0x29')]['includeAll']){_0x103bd3[_0xc9cd('0x39')]=[{'all':!![]}];}return db[_0xc9cd('0x25')][_0xc9cd('0x3a')](_0x103bd3);})['then'](function(_0x5d306e){_0x493afa[_0xc9cd('0x3b')]=_0x5d306e;return _0x493afa;})[_0xc9cd('0x20')](respondWithFilteredResult(_0x3798a7,_0x103bd3))[_0xc9cd('0x3c')](handleError(_0x3798a7,null));};exports[_0xc9cd('0x3d')]=function(_0x162a58,_0x4b1ceb){var _0x54c879={'raw':!![],'where':{'id':_0x162a58[_0xc9cd('0x3e')]['id']}},_0x55714e={};_0x55714e['model']=_[_0xc9cd('0x3f')](db[_0xc9cd('0x25')][_0xc9cd('0x26')]);_0x55714e['query']=_[_0xc9cd('0x3f')](_0x162a58[_0xc9cd('0x29')]);_0x55714e[_0xc9cd('0x2a')]=_['intersection'](_0x55714e[_0xc9cd('0x28')],_0x55714e[_0xc9cd('0x29')]);_0x54c879[_0xc9cd('0x2c')]=_[_0xc9cd('0x2b')](_0x55714e[_0xc9cd('0x28')],qs[_0xc9cd('0x2d')](_0x162a58[_0xc9cd('0x29')][_0xc9cd('0x2d')]));_0x54c879[_0xc9cd('0x2c')]=_0x54c879[_0xc9cd('0x2c')]['length']?_0x54c879[_0xc9cd('0x2c')]:_0x55714e[_0xc9cd('0x28')];if(_0x162a58[_0xc9cd('0x29')][_0xc9cd('0x40')]){_0x54c879[_0xc9cd('0x39')]=[{'all':!![]}];}_0x54c879=_[_0xc9cd('0x36')]({},_0x54c879,_0x162a58[_0xc9cd('0x38')]);return db['Dynamics365Field'][_0xc9cd('0x41')](_0x54c879)[_0xc9cd('0x20')](handleEntityNotFound(_0x4b1ceb,null))[_0xc9cd('0x20')](respondWithResult(_0x4b1ceb,null))['catch'](handleError(_0x4b1ceb,null));};exports[_0xc9cd('0x42')]=function(_0x138406,_0x12ae00){return db[_0xc9cd('0x25')]['create'](_0x138406[_0xc9cd('0x43')],{})[_0xc9cd('0x20')](respondWithResult(_0x12ae00,0xc9))[_0xc9cd('0x3c')](handleError(_0x12ae00,null));};exports['update']=function(_0x1d32a5,_0xbb3118){if(_0x1d32a5[_0xc9cd('0x43')]['id']){delete _0x1d32a5['body']['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x1d32a5[_0xc9cd('0x3e')]['id']}})[_0xc9cd('0x20')](handleEntityNotFound(_0xbb3118,null))[_0xc9cd('0x20')](saveUpdates(_0x1d32a5[_0xc9cd('0x43')],null))['then'](respondWithResult(_0xbb3118,null))[_0xc9cd('0x3c')](handleError(_0xbb3118,null));};exports['destroy']=function(_0x2b507f,_0x4cbae8){return db[_0xc9cd('0x25')]['find']({'where':{'id':_0x2b507f['params']['id']}})['then'](handleEntityNotFound(_0x4cbae8,null))[_0xc9cd('0x20')](removeEntity(_0x4cbae8,null))[_0xc9cd('0x3c')](handleError(_0x4cbae8,null));}; \ No newline at end of file +var _0xa677=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','Dynamics365Field','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x7f2fd0,_0x324043){var _0x561227=function(_0xa958ca){while(--_0xa958ca){_0x7f2fd0['push'](_0x7f2fd0['shift']());}};_0x561227(++_0x324043);}(_0xa677,0xf9));var _0x7a67=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0xa677[_0xbc4560];return _0x298cfb;};'use strict';var emlformat=require(_0x7a67('0x0'));var rimraf=require(_0x7a67('0x1'));var zipdir=require(_0x7a67('0x2'));var jsonpatch=require(_0x7a67('0x3'));var rp=require(_0x7a67('0x4'));var moment=require(_0x7a67('0x5'));var BPromise=require(_0x7a67('0x6'));var Mustache=require('mustache');var util=require(_0x7a67('0x7'));var path=require(_0x7a67('0x8'));var sox=require(_0x7a67('0x9'));var csv=require(_0x7a67('0xa'));var ejs=require(_0x7a67('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7a67('0xc'));var crypto=require(_0x7a67('0xd'));var jsforce=require(_0x7a67('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7a67('0xf'));var Papa=require(_0x7a67('0x10'));var Redis=require('ioredis');var authService=require(_0x7a67('0x11'));var qs=require(_0x7a67('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a67('0x13'));var logger=require(_0x7a67('0x14'))(_0x7a67('0x15'));var utils=require(_0x7a67('0x16'));var config=require(_0x7a67('0x17'));var licenseUtil=require(_0x7a67('0x18'));var db=require(_0x7a67('0x19'))['db'];function respondWithStatusCode(_0x2ab969,_0x56c2f4){_0x56c2f4=_0x56c2f4||0xcc;return function(_0x8c08e){if(_0x8c08e){return _0x2ab969['sendStatus'](_0x56c2f4);}return _0x2ab969[_0x7a67('0x1a')](_0x56c2f4)['end']();};}function respondWithResult(_0x24b0d5,_0x3d55a7){_0x3d55a7=_0x3d55a7||0xc8;return function(_0x410a89){if(_0x410a89){return _0x24b0d5['status'](_0x3d55a7)[_0x7a67('0x1b')](_0x410a89);}};}function respondWithFilteredResult(_0x48a66f,_0x524cf3){return function(_0x1118bc){if(_0x1118bc){var _0x511d39=typeof _0x524cf3['offset']===_0x7a67('0x1c')&&typeof _0x524cf3[_0x7a67('0x1d')]==='undefined';var _0x4c5efb=_0x1118bc[_0x7a67('0x1e')];var _0x5340c5=_0x511d39?0x0:_0x524cf3[_0x7a67('0x1f')];var _0x29e67f=_0x511d39?_0x1118bc[_0x7a67('0x1e')]:_0x524cf3['offset']+_0x524cf3[_0x7a67('0x1d')];var _0x21e425;if(_0x29e67f>=_0x4c5efb){_0x29e67f=_0x4c5efb;_0x21e425=0xc8;}else{_0x21e425=0xce;}_0x48a66f[_0x7a67('0x1a')](_0x21e425);return _0x48a66f[_0x7a67('0x20')]('Content-Range',_0x5340c5+'-'+_0x29e67f+'/'+_0x4c5efb)[_0x7a67('0x1b')](_0x1118bc);}return null;};}function patchUpdates(_0x18a0eb){return function(_0x17d0ee){try{jsonpatch[_0x7a67('0x21')](_0x17d0ee,_0x18a0eb,!![]);}catch(_0x4b60d4){return BPromise[_0x7a67('0x22')](_0x4b60d4);}return _0x17d0ee[_0x7a67('0x23')]();};}function saveUpdates(_0x7fb54f,_0x288429){return function(_0x57ef38){if(_0x57ef38){return _0x57ef38[_0x7a67('0x24')](_0x7fb54f)[_0x7a67('0x25')](function(_0x5ef4c4){return _0x5ef4c4;});}return null;};}function removeEntity(_0x24eef7,_0x10116f){return function(_0x501aad){if(_0x501aad){return _0x501aad[_0x7a67('0x26')]()[_0x7a67('0x25')](function(){_0x24eef7[_0x7a67('0x1a')](0xcc)[_0x7a67('0x27')]();});}};}function handleEntityNotFound(_0x30f9de,_0x4e1474){return function(_0x1f49d5){if(!_0x1f49d5){_0x30f9de[_0x7a67('0x28')](0x194);}return _0x1f49d5;};}function handleError(_0x5540fa,_0x470782){_0x470782=_0x470782||0x1f4;return function(_0x57e8fb){logger[_0x7a67('0x29')](_0x57e8fb[_0x7a67('0x2a')]);if(_0x57e8fb[_0x7a67('0x2b')]){delete _0x57e8fb[_0x7a67('0x2b')];}_0x5540fa[_0x7a67('0x1a')](_0x470782)[_0x7a67('0x2c')](_0x57e8fb);};}exports['index']=function(_0xc040a8,_0x14df49){var _0x226810={},_0x14c706={},_0x1ace8d={'count':0x0,'rows':[]};var _0x6adad1=_['map'](db[_0x7a67('0x2d')]['rawAttributes'],function(_0x38a6ad){return{'name':_0x38a6ad[_0x7a67('0x2e')],'type':_0x38a6ad['type'][_0x7a67('0x2f')]};});_0x14c706[_0x7a67('0x30')]=_[_0x7a67('0x31')](_0x6adad1,_0x7a67('0x2b'));_0x14c706[_0x7a67('0x32')]=_[_0x7a67('0x33')](_0xc040a8[_0x7a67('0x32')]);_0x14c706[_0x7a67('0x34')]=_[_0x7a67('0x35')](_0x14c706[_0x7a67('0x30')],_0x14c706[_0x7a67('0x32')]);_0x226810['attributes']=_[_0x7a67('0x35')](_0x14c706[_0x7a67('0x30')],qs[_0x7a67('0x36')](_0xc040a8[_0x7a67('0x32')][_0x7a67('0x36')]));_0x226810[_0x7a67('0x37')]=_0x226810[_0x7a67('0x37')][_0x7a67('0x38')]?_0x226810['attributes']:_0x14c706[_0x7a67('0x30')];if(!_0xc040a8[_0x7a67('0x32')][_0x7a67('0x39')](_0x7a67('0x3a'))){_0x226810[_0x7a67('0x1d')]=qs['limit'](_0xc040a8['query']['limit']);_0x226810[_0x7a67('0x1f')]=qs[_0x7a67('0x1f')](_0xc040a8[_0x7a67('0x32')][_0x7a67('0x1f')]);}_0x226810[_0x7a67('0x3b')]=qs[_0x7a67('0x3c')](_0xc040a8[_0x7a67('0x32')][_0x7a67('0x3c')]);_0x226810[_0x7a67('0x3d')]=qs[_0x7a67('0x34')](_[_0x7a67('0x3e')](_0xc040a8[_0x7a67('0x32')],_0x14c706['filters']),_0x6adad1);if(_0xc040a8[_0x7a67('0x32')][_0x7a67('0x3f')]){_0x226810[_0x7a67('0x3d')]=_[_0x7a67('0x40')](_0x226810[_0x7a67('0x3d')],{'$or':_['map'](_0x6adad1,function(_0x1d8f32){if(_0x1d8f32['type']!==_0x7a67('0x41')){var _0x1e6016={};_0x1e6016[_0x1d8f32['name']]={'$like':'%'+_0xc040a8[_0x7a67('0x32')][_0x7a67('0x3f')]+'%'};return _0x1e6016;}})});}_0x226810=_[_0x7a67('0x40')]({},_0x226810,_0xc040a8[_0x7a67('0x42')]);var _0x4d4161={'where':_0x226810[_0x7a67('0x3d')]};return db[_0x7a67('0x2d')]['count'](_0x4d4161)[_0x7a67('0x25')](function(_0x373851){_0x1ace8d['count']=_0x373851;if(_0xc040a8[_0x7a67('0x32')][_0x7a67('0x43')]){_0x226810[_0x7a67('0x44')]=[{'all':!![]}];}return db[_0x7a67('0x2d')][_0x7a67('0x45')](_0x226810);})[_0x7a67('0x25')](function(_0x4431fb){_0x1ace8d[_0x7a67('0x46')]=_0x4431fb;return _0x1ace8d;})[_0x7a67('0x25')](respondWithFilteredResult(_0x14df49,_0x226810))[_0x7a67('0x47')](handleError(_0x14df49,null));};exports[_0x7a67('0x48')]=function(_0x4d1503,_0x3857bb){var _0x12fdf6={'raw':!![],'where':{'id':_0x4d1503[_0x7a67('0x49')]['id']}},_0x290917={};_0x290917[_0x7a67('0x30')]=_[_0x7a67('0x33')](db[_0x7a67('0x2d')][_0x7a67('0x4a')]);_0x290917[_0x7a67('0x32')]=_[_0x7a67('0x33')](_0x4d1503[_0x7a67('0x32')]);_0x290917[_0x7a67('0x34')]=_[_0x7a67('0x35')](_0x290917[_0x7a67('0x30')],_0x290917[_0x7a67('0x32')]);_0x12fdf6[_0x7a67('0x37')]=_[_0x7a67('0x35')](_0x290917[_0x7a67('0x30')],qs[_0x7a67('0x36')](_0x4d1503[_0x7a67('0x32')][_0x7a67('0x36')]));_0x12fdf6[_0x7a67('0x37')]=_0x12fdf6[_0x7a67('0x37')]['length']?_0x12fdf6[_0x7a67('0x37')]:_0x290917[_0x7a67('0x30')];if(_0x4d1503[_0x7a67('0x32')][_0x7a67('0x43')]){_0x12fdf6['include']=[{'all':!![]}];}_0x12fdf6=_[_0x7a67('0x40')]({},_0x12fdf6,_0x4d1503['options']);return db[_0x7a67('0x2d')][_0x7a67('0x4b')](_0x12fdf6)[_0x7a67('0x25')](handleEntityNotFound(_0x3857bb,null))[_0x7a67('0x25')](respondWithResult(_0x3857bb,null))['catch'](handleError(_0x3857bb,null));};exports['create']=function(_0x49e48a,_0x177fa8){return db['Dynamics365Field']['create'](_0x49e48a[_0x7a67('0x4c')],{})[_0x7a67('0x25')](respondWithResult(_0x177fa8,0xc9))[_0x7a67('0x47')](handleError(_0x177fa8,null));};exports[_0x7a67('0x24')]=function(_0x5c28b9,_0x450b75){if(_0x5c28b9[_0x7a67('0x4c')]['id']){delete _0x5c28b9['body']['id'];}return db[_0x7a67('0x2d')]['find']({'where':{'id':_0x5c28b9[_0x7a67('0x49')]['id']}})[_0x7a67('0x25')](handleEntityNotFound(_0x450b75,null))['then'](saveUpdates(_0x5c28b9[_0x7a67('0x4c')],null))[_0x7a67('0x25')](respondWithResult(_0x450b75,null))[_0x7a67('0x47')](handleError(_0x450b75,null));};exports['destroy']=function(_0x1fe95f,_0x2d6cb4){return db[_0x7a67('0x2d')][_0x7a67('0x4b')]({'where':{'id':_0x1fe95f[_0x7a67('0x49')]['id']}})[_0x7a67('0x25')](handleEntityNotFound(_0x2d6cb4,null))[_0x7a67('0x25')](removeEntity(_0x2d6cb4,null))[_0x7a67('0x47')](handleError(_0x2d6cb4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1701434..46ec68f 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 _0x3610=['./intDynamics365Field.attributes','define','int_dynamics365_fields','FieldId','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x11aac0,_0x207202){var _0x5cc03c=function(_0x1a198e){while(--_0x1a198e){_0x11aac0['push'](_0x11aac0['shift']());}};_0x5cc03c(++_0x207202);}(_0x3610,0x1ea));var _0x0361=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x3610[_0xac151d];return _0x111dba;};'use strict';var _=require('lodash');var util=require(_0x0361('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0361('0x1'));var rp=require(_0x0361('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0361('0x3'));var config=require(_0x0361('0x4'));var attributes=require(_0x0361('0x5'));module['exports']=function(_0x17df07,_0x199b0a){return _0x17df07[_0x0361('0x6')]('Dynamics365Field',attributes,{'tableName':_0x0361('0x7'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x0361('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b08=['api','bluebird','rimraf','./intDynamics365Field.attributes','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x45eb9b,_0x5cf63d){var _0x3060e0=function(_0x2db5c6){while(--_0x2db5c6){_0x45eb9b['push'](_0x45eb9b['shift']());}};_0x3060e0(++_0x5cf63d);}(_0x9b08,0x132));var _0x89b0=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x9b08[_0x18abd2];return _0x1dcad6;};'use strict';var _=require('lodash');var util=require(_0x89b0('0x0'));var logger=require(_0x89b0('0x1'))(_0x89b0('0x2'));var moment=require('moment');var BPromise=require(_0x89b0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x89b0('0x4'));var config=require('../../config/environment');var attributes=require(_0x89b0('0x5'));module['exports']=function(_0x2fa400,_0x33db1d){return _0x2fa400[_0x89b0('0x6')](_0x89b0('0x7'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x89b0('0x8'),'fields':[_0x89b0('0x9'),_0x89b0('0xa')],'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 d552f8d..5bcef1d 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 _0xfaec=['http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x428935,_0x547e65){var _0x580266=function(_0x16055b){while(--_0x16055b){_0x428935['push'](_0x428935['shift']());}};_0x580266(++_0x547e65);}(_0xfaec,0x19c));var _0xcfae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfaec[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcfae('0x0'));var util=require(_0xcfae('0x1'));var moment=require(_0xcfae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfae('0x3'));var db=require(_0xcfae('0x4'))['db'];var utils=require(_0xcfae('0x5'));var logger=require(_0xcfae('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcfae('0x7'));var client=jayson['client'][_0xcfae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46459f,_0x40dd24,_0x1853b0){return new BPromise(function(_0x2c1f23,_0x53a0e9){return client[_0xcfae('0x9')](_0x46459f,_0x1853b0)[_0xcfae('0xa')](function(_0x97a426){logger[_0xcfae('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x40dd24,_0xcfae('0xc'));logger['debug'](_0xcfae('0xd'),_0x40dd24,_0xcfae('0xc'),JSON[_0xcfae('0xe')](_0x97a426));if(_0x97a426[_0xcfae('0xf')]){if(_0x97a426[_0xcfae('0xf')][_0xcfae('0x10')]===0x1f4){logger[_0xcfae('0xf')](_0xcfae('0x11'),_0x40dd24,_0x97a426[_0xcfae('0xf')]['message']);return _0x53a0e9(_0x97a426[_0xcfae('0xf')]['message']);}logger[_0xcfae('0xf')](_0xcfae('0x11'),_0x40dd24,_0x97a426[_0xcfae('0xf')][_0xcfae('0x12')]);return _0x2c1f23(_0x97a426[_0xcfae('0xf')][_0xcfae('0x12')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x40dd24,_0xcfae('0xc'));_0x2c1f23(_0x97a426[_0xcfae('0x13')][_0xcfae('0x12')]);}})['catch'](function(_0x1d7057){logger[_0xcfae('0xf')](_0xcfae('0x11'),_0x40dd24,_0x1d7057);_0x53a0e9(_0x1d7057);});});} \ No newline at end of file +var _0xe961=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe961,0x19b));var _0x1e96=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xe961[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x1e96('0x0'));var util=require(_0x1e96('0x1'));var moment=require(_0x1e96('0x2'));var BPromise=require(_0x1e96('0x3'));var rs=require(_0x1e96('0x4'));var fs=require('fs');var Redis=require(_0x1e96('0x5'));var db=require(_0x1e96('0x6'))['db'];var utils=require(_0x1e96('0x7'));var logger=require('../../config/logger')(_0x1e96('0x8'));var config=require(_0x1e96('0x9'));var jayson=require(_0x1e96('0xa'));var client=jayson[_0x1e96('0xb')][_0x1e96('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x299f84,_0x2fc8d0,_0x3013fc){return new BPromise(function(_0x21e4f1,_0x56db3e){return client[_0x1e96('0xd')](_0x299f84,_0x3013fc)[_0x1e96('0xe')](function(_0x53a736){logger[_0x1e96('0xf')](_0x1e96('0x10'),_0x2fc8d0,_0x1e96('0x11'));logger[_0x1e96('0x12')](_0x1e96('0x13'),_0x2fc8d0,_0x1e96('0x11'),JSON['stringify'](_0x53a736));if(_0x53a736[_0x1e96('0x14')]){if(_0x53a736['error']['code']===0x1f4){logger[_0x1e96('0x14')](_0x1e96('0x10'),_0x2fc8d0,_0x53a736[_0x1e96('0x14')][_0x1e96('0x15')]);return _0x56db3e(_0x53a736[_0x1e96('0x14')]['message']);}logger['error'](_0x1e96('0x10'),_0x2fc8d0,_0x53a736[_0x1e96('0x14')]['message']);return _0x21e4f1(_0x53a736['error'][_0x1e96('0x15')]);}else{logger[_0x1e96('0xf')](_0x1e96('0x10'),_0x2fc8d0,_0x1e96('0x11'));_0x21e4f1(_0x53a736[_0x1e96('0x16')][_0x1e96('0x15')]);}})['catch'](function(_0x39b9df){logger[_0x1e96('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x2fc8d0,_0x39b9df);_0x56db3e(_0x39b9df);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7344367..09885a0 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 _0xcc78=['../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1450c7,_0x464adb){var _0x216e6c=function(_0x4f4eec){while(--_0x4f4eec){_0x1450c7['push'](_0x1450c7['shift']());}};_0x216e6c(++_0x464adb);}(_0xcc78,0xf6));var _0x8cc7=function(_0x11066a,_0x347efe){_0x11066a=_0x11066a-0x0;var _0x58d875=_0xcc78[_0x11066a];return _0x58d875;};'use strict';var multer=require('multer');var util=require(_0x8cc7('0x0'));var path=require(_0x8cc7('0x1'));var timeout=require(_0x8cc7('0x2'));var express=require(_0x8cc7('0x3'));var router=express[_0x8cc7('0x4')]();var fs_extra=require(_0x8cc7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8cc7('0x6'));var controller=require(_0x8cc7('0x7'));router['get']('/',auth[_0x8cc7('0x8')](),controller[_0x8cc7('0x9')]);router['get']('/:id',auth[_0x8cc7('0x8')](),controller['show']);router[_0x8cc7('0xa')]('/:id/configurations',auth[_0x8cc7('0x8')](),controller[_0x8cc7('0xb')]);router[_0x8cc7('0xa')](_0x8cc7('0xc'),auth[_0x8cc7('0x8')](),controller[_0x8cc7('0xd')]);router[_0x8cc7('0xe')]('/',auth[_0x8cc7('0x8')](),controller[_0x8cc7('0xf')]);router[_0x8cc7('0xe')](_0x8cc7('0x10'),auth[_0x8cc7('0x8')](),controller['addConfiguration']);router[_0x8cc7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8cc7('0x12')]);router['delete']('/:id',auth[_0x8cc7('0x8')](),controller[_0x8cc7('0x13')]);module[_0x8cc7('0x14')]=router; \ No newline at end of file +var _0x2b33=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations'];(function(_0x1a3d17,_0x95a7be){var _0x539d97=function(_0x1ce73f){while(--_0x1ce73f){_0x1a3d17['push'](_0x1a3d17['shift']());}};_0x539d97(++_0x95a7be);}(_0x2b33,0x171));var _0x32b3=function(_0x2344d7,_0x1fe3c6){_0x2344d7=_0x2344d7-0x0;var _0x3e738c=_0x2b33[_0x2344d7];return _0x3e738c;};'use strict';var multer=require(_0x32b3('0x0'));var util=require(_0x32b3('0x1'));var path=require(_0x32b3('0x2'));var timeout=require(_0x32b3('0x3'));var express=require(_0x32b3('0x4'));var router=express[_0x32b3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32b3('0x6'));var interaction=require(_0x32b3('0x7'));var config=require(_0x32b3('0x8'));var controller=require(_0x32b3('0x9'));router[_0x32b3('0xa')]('/',auth[_0x32b3('0xb')](),controller['index']);router['get'](_0x32b3('0xc'),auth[_0x32b3('0xb')](),controller[_0x32b3('0xd')]);router[_0x32b3('0xa')]('/:id/configurations',auth[_0x32b3('0xb')](),controller[_0x32b3('0xe')]);router['get'](_0x32b3('0xf'),auth[_0x32b3('0xb')](),controller[_0x32b3('0x10')]);router[_0x32b3('0x11')]('/',auth[_0x32b3('0xb')](),controller[_0x32b3('0x12')]);router[_0x32b3('0x11')](_0x32b3('0x13'),auth[_0x32b3('0xb')](),controller[_0x32b3('0x14')]);router['put'](_0x32b3('0xc'),auth[_0x32b3('0xb')](),controller[_0x32b3('0x15')]);router[_0x32b3('0x16')](_0x32b3('0xc'),auth[_0x32b3('0xb')](),controller['destroy']);module[_0x32b3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 99208b9..9601d4e 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 _0x9f0e=['STRING','remoteUri','sequelize','exports'];(function(_0x37fe05,_0x10956a){var _0x2a2e53=function(_0x381952){while(--_0x381952){_0x37fe05['push'](_0x37fe05['shift']());}};_0x2a2e53(++_0x10956a);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1d022e,_0x10355e){_0x1d022e=_0x1d022e-0x0;var _0x5d7c13=_0x9f0e[_0x1d022e];return _0x5d7c13;};'use strict';var Sequelize=require(_0xe9f0('0x0'));module[_0xe9f0('0x1')]={'name':{'type':Sequelize[_0xe9f0('0x2')]},'description':{'type':Sequelize[_0xe9f0('0x2')]},'username':{'type':Sequelize[_0xe9f0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe9f0('0x2')],'unique':_0xe9f0('0x3')},'serverUrl':{'type':Sequelize[_0xe9f0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x4944dd,_0x5a8677){var _0x58ebba=function(_0x450258){while(--_0x450258){_0x4944dd['push'](_0x4944dd['shift']());}};_0x58ebba(++_0x5a8677);}(_0x4bd3,0x174));var _0x34bd=function(_0x5d2fd8,_0x5ddbf2){_0x5d2fd8=_0x5d2fd8-0x0;var _0xa0f408=_0x4bd3[_0x5d2fd8];return _0xa0f408;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x34bd('0x1')],'unique':_0x34bd('0x2')},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 383a6c8..588f888 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 _0x4e34=['status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','findAll','catch','show','length','includeAll','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','filter','addConfiguration','AccountId','channel','Descriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s/%s','%s:X','toString','subject','agent','description','ticket_type','group','company','remove','includes','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','zip-dir','fast-json-patch','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e34,0x19e));var _0x44e3=function(_0x6c413,_0xeda0e6){_0x6c413=_0x6c413-0x0;var _0x821cbc=_0x4e34[_0x6c413];return _0x821cbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x44e3('0x0'));var jsonpatch=require(_0x44e3('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44e3('0x2'));var Mustache=require('mustache');var util=require(_0x44e3('0x3'));var path=require(_0x44e3('0x4'));var sox=require(_0x44e3('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44e3('0x6'));var _=require(_0x44e3('0x7'));var squel=require(_0x44e3('0x8'));var crypto=require(_0x44e3('0x9'));var jsforce=require(_0x44e3('0xa'));var deskjs=require(_0x44e3('0xb'));var toCsv=require(_0x44e3('0xc'));var querystring=require('querystring');var Papa=require(_0x44e3('0xd'));var Redis=require(_0x44e3('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x44e3('0xf'));var hardwareService=require(_0x44e3('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x44e3('0x11'));var config=require(_0x44e3('0x12'));var licenseUtil=require(_0x44e3('0x13'));var db=require(_0x44e3('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x473429,_0xecdc78){_0xecdc78=_0xecdc78||0xcc;return function(_0x11eafa){if(_0x11eafa){return _0x473429[_0x44e3('0x15')](_0xecdc78);}return _0x473429[_0x44e3('0x16')](_0xecdc78)[_0x44e3('0x17')]();};}function respondWithResult(_0xf72585,_0x5f1dc){_0x5f1dc=_0x5f1dc||0xc8;return function(_0x493e4c){if(_0x493e4c){return _0xf72585[_0x44e3('0x16')](_0x5f1dc)['json'](_0x493e4c);}};}function respondWithFilteredResult(_0x15bd84,_0x393172){return function(_0x5a140d){if(_0x5a140d){var _0x28fc7a=typeof _0x393172[_0x44e3('0x18')]===_0x44e3('0x19')&&typeof _0x393172[_0x44e3('0x1a')]===_0x44e3('0x19');var _0x111a30=_0x5a140d[_0x44e3('0x1b')];var _0xe495c5=_0x28fc7a?0x0:_0x393172[_0x44e3('0x18')];var _0x5cc0ca=_0x28fc7a?_0x5a140d[_0x44e3('0x1b')]:_0x393172['offset']+_0x393172[_0x44e3('0x1a')];var _0x5cb4cc;if(_0x5cc0ca>=_0x111a30){_0x5cc0ca=_0x111a30;_0x5cb4cc=0xc8;}else{_0x5cb4cc=0xce;}_0x15bd84[_0x44e3('0x16')](_0x5cb4cc);return _0x15bd84[_0x44e3('0x1c')](_0x44e3('0x1d'),_0xe495c5+'-'+_0x5cc0ca+'/'+_0x111a30)[_0x44e3('0x1e')](_0x5a140d);}return null;};}function patchUpdates(_0x3f7c87){return function(_0x38bf24){try{jsonpatch[_0x44e3('0x1f')](_0x38bf24,_0x3f7c87,!![]);}catch(_0x275d7d){return BPromise[_0x44e3('0x20')](_0x275d7d);}return _0x38bf24[_0x44e3('0x21')]();};}function saveUpdates(_0x25e2e1,_0x482de1){return function(_0x5baa32){if(_0x5baa32){return _0x5baa32[_0x44e3('0x22')](_0x25e2e1)['then'](function(_0x1a101f){return _0x1a101f;});}return null;};}function removeEntity(_0x3ca86e,_0x579877){return function(_0x61a5cd){if(_0x61a5cd){return _0x61a5cd[_0x44e3('0x23')]()[_0x44e3('0x24')](function(){_0x3ca86e[_0x44e3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3787c8,_0x3d65c4){return function(_0x574e04){if(!_0x574e04){_0x3787c8[_0x44e3('0x15')](0x194);}return _0x574e04;};}function handleError(_0x22b788,_0x31eddb){_0x31eddb=_0x31eddb||0x1f4;return function(_0x102f2b){logger['error'](_0x102f2b['stack']);if(_0x102f2b[_0x44e3('0x25')]){delete _0x102f2b[_0x44e3('0x25')];}_0x22b788[_0x44e3('0x16')](_0x31eddb)['send'](_0x102f2b);};}exports[_0x44e3('0x26')]=function(_0x4f93d6,_0x119d03){var _0x3659af={},_0x23cb65={},_0x36ed4d={'count':0x0,'rows':[]};var _0x412b39=_[_0x44e3('0x27')](db[_0x44e3('0x28')][_0x44e3('0x29')],function(_0x4b1bd8){return{'name':_0x4b1bd8[_0x44e3('0x2a')],'type':_0x4b1bd8[_0x44e3('0x2b')][_0x44e3('0x2c')]};});_0x23cb65[_0x44e3('0x2d')]=_[_0x44e3('0x27')](_0x412b39,_0x44e3('0x25'));_0x23cb65['query']=_[_0x44e3('0x2e')](_0x4f93d6[_0x44e3('0x2f')]);_0x23cb65['filters']=_[_0x44e3('0x30')](_0x23cb65[_0x44e3('0x2d')],_0x23cb65['query']);_0x3659af[_0x44e3('0x31')]=_[_0x44e3('0x30')](_0x23cb65[_0x44e3('0x2d')],qs['fields'](_0x4f93d6[_0x44e3('0x2f')][_0x44e3('0x32')]));_0x3659af[_0x44e3('0x31')]=_0x3659af[_0x44e3('0x31')]['length']?_0x3659af[_0x44e3('0x31')]:_0x23cb65['model'];if(!_0x4f93d6[_0x44e3('0x2f')][_0x44e3('0x33')](_0x44e3('0x34'))){_0x3659af[_0x44e3('0x1a')]=qs[_0x44e3('0x1a')](_0x4f93d6['query'][_0x44e3('0x1a')]);_0x3659af[_0x44e3('0x18')]=qs[_0x44e3('0x18')](_0x4f93d6[_0x44e3('0x2f')][_0x44e3('0x18')]);}_0x3659af[_0x44e3('0x35')]=qs[_0x44e3('0x36')](_0x4f93d6[_0x44e3('0x2f')]['sort']);_0x3659af[_0x44e3('0x37')]=qs['filters'](_[_0x44e3('0x38')](_0x4f93d6[_0x44e3('0x2f')],_0x23cb65[_0x44e3('0x39')]),_0x412b39);if(_0x4f93d6[_0x44e3('0x2f')]['filter']){_0x3659af[_0x44e3('0x37')]=_[_0x44e3('0x3a')](_0x3659af['where'],{'$or':_[_0x44e3('0x27')](_0x412b39,function(_0x18aff5){if(_0x18aff5['type']!==_0x44e3('0x3b')){var _0x5be86d={};_0x5be86d[_0x18aff5[_0x44e3('0x25')]]={'$like':'%'+_0x4f93d6[_0x44e3('0x2f')]['filter']+'%'};return _0x5be86d;}})});}_0x3659af=_[_0x44e3('0x3a')]({},_0x3659af,_0x4f93d6[_0x44e3('0x3c')]);var _0x383e8f={'where':_0x3659af['where']};return db[_0x44e3('0x28')][_0x44e3('0x1b')](_0x383e8f)[_0x44e3('0x24')](function(_0x4f69fb){_0x36ed4d[_0x44e3('0x1b')]=_0x4f69fb;if(_0x4f93d6['query']['includeAll']){_0x3659af['include']=[{'all':!![]}];}return db[_0x44e3('0x28')][_0x44e3('0x3d')](_0x3659af);})[_0x44e3('0x24')](function(_0x3baaf6){_0x36ed4d['rows']=_0x3baaf6;return _0x36ed4d;})[_0x44e3('0x24')](respondWithFilteredResult(_0x119d03,_0x3659af))[_0x44e3('0x3e')](handleError(_0x119d03,null));};exports[_0x44e3('0x3f')]=function(_0x4df091,_0x1fac49){var _0x41f5f0={'raw':![],'where':{'id':_0x4df091['params']['id']}},_0x553539={};_0x553539[_0x44e3('0x2d')]=_['keys'](db['FreshdeskAccount'][_0x44e3('0x29')]);_0x553539[_0x44e3('0x2f')]=_[_0x44e3('0x2e')](_0x4df091[_0x44e3('0x2f')]);_0x553539['filters']=_['intersection'](_0x553539['model'],_0x553539[_0x44e3('0x2f')]);_0x41f5f0[_0x44e3('0x31')]=_[_0x44e3('0x30')](_0x553539[_0x44e3('0x2d')],qs[_0x44e3('0x32')](_0x4df091[_0x44e3('0x2f')][_0x44e3('0x32')]));_0x41f5f0[_0x44e3('0x31')]=_0x41f5f0[_0x44e3('0x31')][_0x44e3('0x40')]?_0x41f5f0[_0x44e3('0x31')]:_0x553539['model'];if(_0x4df091[_0x44e3('0x2f')][_0x44e3('0x41')]){_0x41f5f0['include']=[{'all':!![]}];}_0x41f5f0=_['merge']({},_0x41f5f0,_0x4df091[_0x44e3('0x3c')]);return db[_0x44e3('0x28')][_0x44e3('0x42')](_0x41f5f0)['then'](handleEntityNotFound(_0x1fac49,null))[_0x44e3('0x24')](respondWithResult(_0x1fac49,null))[_0x44e3('0x3e')](handleError(_0x1fac49,null));};exports[_0x44e3('0x43')]=function(_0x2590f5,_0x42f4d5){return db[_0x44e3('0x28')][_0x44e3('0x43')](_0x2590f5['body'],{})[_0x44e3('0x24')](respondWithResult(_0x42f4d5,0xc9))[_0x44e3('0x3e')](handleError(_0x42f4d5,null));};exports['update']=function(_0x5d20bd,_0x2b5b87){if(_0x5d20bd[_0x44e3('0x44')]['id']){delete _0x5d20bd['body']['id'];}return db[_0x44e3('0x28')][_0x44e3('0x42')]({'where':{'id':_0x5d20bd[_0x44e3('0x45')]['id']}})[_0x44e3('0x24')](handleEntityNotFound(_0x2b5b87,null))[_0x44e3('0x24')](saveUpdates(_0x5d20bd[_0x44e3('0x44')],null))['then'](respondWithResult(_0x2b5b87,null))[_0x44e3('0x3e')](handleError(_0x2b5b87,null));};exports[_0x44e3('0x23')]=function(_0x1d07cd,_0x369f04){return db[_0x44e3('0x28')][_0x44e3('0x42')]({'where':{'id':_0x1d07cd[_0x44e3('0x45')]['id']}})['then'](handleEntityNotFound(_0x369f04,null))[_0x44e3('0x24')](removeEntity(_0x369f04,null))['catch'](handleError(_0x369f04,null));};exports[_0x44e3('0x46')]=function(_0x2ac352,_0x114b95,_0x38c6d5){var _0x3cecd5={};var _0x3ae05a={};var _0x42ef05;var _0x54a29e;return db[_0x44e3('0x28')][_0x44e3('0x47')]({'where':{'id':_0x2ac352[_0x44e3('0x45')]['id']}})[_0x44e3('0x24')](handleEntityNotFound(_0x114b95,null))[_0x44e3('0x24')](function(_0x541877){if(_0x541877){_0x42ef05=_0x541877;_0x3ae05a['model']=_[_0x44e3('0x2e')](db[_0x44e3('0x48')][_0x44e3('0x29')]);_0x3ae05a[_0x44e3('0x2f')]=_['keys'](_0x2ac352[_0x44e3('0x2f')]);_0x3ae05a['filters']=_[_0x44e3('0x30')](_0x3ae05a[_0x44e3('0x2d')],_0x3ae05a[_0x44e3('0x2f')]);_0x3cecd5[_0x44e3('0x31')]=_[_0x44e3('0x30')](_0x3ae05a['model'],qs[_0x44e3('0x32')](_0x2ac352[_0x44e3('0x2f')][_0x44e3('0x32')]));_0x3cecd5[_0x44e3('0x31')]=_0x3cecd5[_0x44e3('0x31')][_0x44e3('0x40')]?_0x3cecd5[_0x44e3('0x31')]:_0x3ae05a['model'];_0x3cecd5[_0x44e3('0x35')]=qs[_0x44e3('0x36')](_0x2ac352[_0x44e3('0x2f')]['sort']);_0x3cecd5['where']=qs['filters'](_['pick'](_0x2ac352[_0x44e3('0x2f')],_0x3ae05a['filters']));if(_0x2ac352['query'][_0x44e3('0x49')]){_0x3cecd5[_0x44e3('0x37')]=_[_0x44e3('0x3a')](_0x3cecd5['where'],{'$or':_[_0x44e3('0x27')](_0x3cecd5[_0x44e3('0x31')],function(_0x18269d){var _0x2733b8={};_0x2733b8[_0x18269d]={'$like':'%'+_0x2ac352['query'][_0x44e3('0x49')]+'%'};return _0x2733b8;})});}_0x3cecd5=_[_0x44e3('0x3a')]({},_0x3cecd5,_0x2ac352[_0x44e3('0x3c')]);return _0x42ef05['getConfigurations'](_0x3cecd5);}})[_0x44e3('0x24')](function(_0x3529dc){if(_0x3529dc){_0x54a29e=_0x3529dc[_0x44e3('0x40')];if(!_0x2ac352[_0x44e3('0x2f')][_0x44e3('0x33')]('nolimit')){_0x3cecd5[_0x44e3('0x1a')]=qs[_0x44e3('0x1a')](_0x2ac352['query']['limit']);_0x3cecd5[_0x44e3('0x18')]=qs['offset'](_0x2ac352[_0x44e3('0x2f')][_0x44e3('0x18')]);}return _0x42ef05[_0x44e3('0x46')](_0x3cecd5);}})[_0x44e3('0x24')](function(_0x169f0f){if(_0x169f0f){return _0x169f0f?{'count':_0x54a29e,'rows':_0x169f0f}:null;}})[_0x44e3('0x24')](respondWithResult(_0x114b95,null))[_0x44e3('0x3e')](handleError(_0x114b95,null));};exports[_0x44e3('0x4a')]=function(_0x4318d0,_0x812a6f,_0x23ac9d){if(_0x4318d0[_0x44e3('0x44')]['id']){delete _0x4318d0['body']['id'];}return db[_0x44e3('0x28')]['findOne']({'where':{'id':_0x4318d0[_0x44e3('0x45')]['id']}})[_0x44e3('0x24')](handleEntityNotFound(_0x812a6f,null))[_0x44e3('0x24')](function(_0x1157c7){if(_0x1157c7){_0x4318d0[_0x44e3('0x44')][_0x44e3('0x4b')]=_0x1157c7['id'];_0x4318d0[_0x44e3('0x44')]['Subjects']=integrations['getSubjects'](_0x4318d0[_0x44e3('0x44')][_0x44e3('0x4c')],_0x4318d0[_0x44e3('0x44')][_0x44e3('0x2b')]);_0x4318d0['body'][_0x44e3('0x4d')]=integrations['getDescriptions'](_0x4318d0[_0x44e3('0x44')][_0x44e3('0x4c')],_0x4318d0['body']['type']);return db[_0x44e3('0x48')][_0x44e3('0x43')](_0x4318d0[_0x44e3('0x44')],{'include':[{'model':db[_0x44e3('0x4e')],'as':_0x44e3('0x4f')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x44e3('0x24')](respondWithResult(_0x812a6f,null))[_0x44e3('0x3e')](handleError(_0x812a6f,null));};exports[_0x44e3('0x50')]=function(_0xaa5060,_0xc1d3fe,_0x57813f){var _0xf8ccbe='';return db[_0x44e3('0x28')][_0x44e3('0x47')]({'where':{'id':_0xaa5060[_0x44e3('0x45')]['id']},'attributes':['id',_0x44e3('0x51'),_0x44e3('0x52')]})['then'](handleEntityNotFound(_0xc1d3fe,null))[_0x44e3('0x24')](function(_0x12ebf7){if(_0x12ebf7){_0xf8ccbe=_0x12ebf7[_0x44e3('0x51')];var _0x2185ae=_0xf8ccbe['slice'](-0x1);if(_0x2185ae==='/'){_0xf8ccbe=_0xf8ccbe[_0x44e3('0x53')](0x0,_0xf8ccbe[_0x44e3('0x54')](_0x2185ae));}return rp({'method':_0x44e3('0x55'),'uri':util[_0x44e3('0x56')](_0x44e3('0x57'),_0xf8ccbe,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x44e3('0x56')]('Basic\x20%s',new Buffer(util[_0x44e3('0x56')](_0x44e3('0x58'),_0x12ebf7[_0x44e3('0x52')]))[_0x44e3('0x59')]('base64'))},'json':!![]});}})[_0x44e3('0x24')](function(_0x2ab5e0){if(_0x2ab5e0){var _0x39af65=['requester',_0x44e3('0x5a'),_0x44e3('0x5b'),_0x44e3('0x5c'),_0x44e3('0x16'),'priority','group','source',_0x44e3('0x5d'),_0x44e3('0x5e'),_0x44e3('0x5f')];_[_0x44e3('0x60')](_0x2ab5e0,function(_0x4eae39){return _0x39af65[_0x44e3('0x61')](_0x4eae39[_0x44e3('0x25')])||!_0x4eae39['default']&&_0x4eae39[_0x44e3('0x2b')]!=='custom_text'&&_0x4eae39[_0x44e3('0x2b')]!==_0x44e3('0x62');});return{'count':_0x2ab5e0[_0x44e3('0x40')],'rows':_[_0x44e3('0x27')](_0x2ab5e0,function(_0x282df1){return{'id':_0x282df1[_0x44e3('0x25')],'name':_0x282df1[_0x44e3('0x63')],'custom':!_0x282df1['default'],'options':_0x282df1[_0x44e3('0x64')]?_['map'](_0x282df1[_0x44e3('0x64')],function(_0x1033d3){return{'name':_[_0x44e3('0x65')](_0x1033d3),'value':_0x1033d3};}):[]};})};}})[_0x44e3('0x24')](respondWithResult(_0xc1d3fe,null))['catch'](function(_0x321904){var _0x489f14=_0xaa5060['query'][_0x44e3('0x66')]?0x1f4:_0x321904[_0x44e3('0x67')]||0x1f4;logger[_0x44e3('0x68')](_0x44e3('0x69'),_0x44e3('0x50'),_0x489f14,JSON[_0x44e3('0x6a')](_0x321904));delete _0x321904['name'];if(_0x489f14===0x191){_0x489f14=0x190;}_0xc1d3fe[_0x44e3('0x16')](_0x489f14)[_0x44e3('0x6b')](_0xaa5060[_0x44e3('0x2f')][_0x44e3('0x66')]?{'message':_0x44e3('0x6c'),'statusCode':_0x321904[_0x44e3('0x67')]}:_0x321904);});}; \ No newline at end of file +var _0xd240=['description','priority','group','source','ticket_type','company','remove','default','custom_text','label','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','map','FreshdeskAccount','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','merge','find','catch','create','body','params','destroy','findOne','FreshdeskConfiguration','filters','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','toString','subject','agent'];(function(_0xe01d60,_0x340301){var _0x46d858=function(_0x25e8ba){while(--_0x25e8ba){_0xe01d60['push'](_0xe01d60['shift']());}};_0x46d858(++_0x340301);}(_0xd240,0x1c7));var _0x0d24=function(_0x24235c,_0xe0c1b1){_0x24235c=_0x24235c-0x0;var _0x2b8961=_0xd240[_0x24235c];return _0x2b8961;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d24('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d24('0x1'));var moment=require(_0x0d24('0x2'));var BPromise=require(_0x0d24('0x3'));var Mustache=require(_0x0d24('0x4'));var util=require(_0x0d24('0x5'));var path=require(_0x0d24('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d24('0x7'));var fs=require('fs');var fs_extra=require(_0x0d24('0x8'));var _=require(_0x0d24('0x9'));var squel=require(_0x0d24('0xa'));var crypto=require('crypto');var jsforce=require(_0x0d24('0xb'));var deskjs=require(_0x0d24('0xc'));var toCsv=require(_0x0d24('0xd'));var querystring=require(_0x0d24('0xe'));var Papa=require(_0x0d24('0xf'));var Redis=require(_0x0d24('0x10'));var authService=require(_0x0d24('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0d24('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d24('0x13'))('api');var utils=require(_0x0d24('0x14'));var config=require(_0x0d24('0x15'));var licenseUtil=require(_0x0d24('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x29f892,_0x1b6f50){_0x1b6f50=_0x1b6f50||0xcc;return function(_0x41838d){if(_0x41838d){return _0x29f892['sendStatus'](_0x1b6f50);}return _0x29f892[_0x0d24('0x17')](_0x1b6f50)[_0x0d24('0x18')]();};}function respondWithResult(_0x58ac0d,_0x4d24b5){_0x4d24b5=_0x4d24b5||0xc8;return function(_0x13c2ce){if(_0x13c2ce){return _0x58ac0d[_0x0d24('0x17')](_0x4d24b5)[_0x0d24('0x19')](_0x13c2ce);}};}function respondWithFilteredResult(_0x175841,_0xd9a534){return function(_0x6ec239){if(_0x6ec239){var _0xf188c9=typeof _0xd9a534[_0x0d24('0x1a')]==='undefined'&&typeof _0xd9a534[_0x0d24('0x1b')]===_0x0d24('0x1c');var _0x591d04=_0x6ec239[_0x0d24('0x1d')];var _0x1c5899=_0xf188c9?0x0:_0xd9a534[_0x0d24('0x1a')];var _0x151030=_0xf188c9?_0x6ec239['count']:_0xd9a534[_0x0d24('0x1a')]+_0xd9a534[_0x0d24('0x1b')];var _0x527f6b;if(_0x151030>=_0x591d04){_0x151030=_0x591d04;_0x527f6b=0xc8;}else{_0x527f6b=0xce;}_0x175841['status'](_0x527f6b);return _0x175841[_0x0d24('0x1e')](_0x0d24('0x1f'),_0x1c5899+'-'+_0x151030+'/'+_0x591d04)[_0x0d24('0x19')](_0x6ec239);}return null;};}function patchUpdates(_0x2f611b){return function(_0x30e520){try{jsonpatch[_0x0d24('0x20')](_0x30e520,_0x2f611b,!![]);}catch(_0x120625){return BPromise[_0x0d24('0x21')](_0x120625);}return _0x30e520[_0x0d24('0x22')]();};}function saveUpdates(_0x5df68d,_0x2499e1){return function(_0x14108f){if(_0x14108f){return _0x14108f[_0x0d24('0x23')](_0x5df68d)[_0x0d24('0x24')](function(_0x4e6ded){return _0x4e6ded;});}return null;};}function removeEntity(_0x23440c,_0x3cd88f){return function(_0x367028){if(_0x367028){return _0x367028['destroy']()[_0x0d24('0x24')](function(){_0x23440c[_0x0d24('0x17')](0xcc)[_0x0d24('0x18')]();});}};}function handleEntityNotFound(_0x5905c3,_0x26db95){return function(_0xa5d22d){if(!_0xa5d22d){_0x5905c3[_0x0d24('0x25')](0x194);}return _0xa5d22d;};}function handleError(_0x582169,_0x2226d6){_0x2226d6=_0x2226d6||0x1f4;return function(_0x1a5feb){logger[_0x0d24('0x26')](_0x1a5feb[_0x0d24('0x27')]);if(_0x1a5feb[_0x0d24('0x28')]){delete _0x1a5feb[_0x0d24('0x28')];}_0x582169['status'](_0x2226d6)['send'](_0x1a5feb);};}exports['index']=function(_0x1057c3,_0x2064e3){var _0x1a1ef7={},_0xa1bccb={},_0x31ea4b={'count':0x0,'rows':[]};var _0x8f3446=_[_0x0d24('0x29')](db[_0x0d24('0x2a')][_0x0d24('0x2b')],function(_0x45c4bc){return{'name':_0x45c4bc[_0x0d24('0x2c')],'type':_0x45c4bc['type']['key']};});_0xa1bccb[_0x0d24('0x2d')]=_['map'](_0x8f3446,'name');_0xa1bccb[_0x0d24('0x2e')]=_[_0x0d24('0x2f')](_0x1057c3[_0x0d24('0x2e')]);_0xa1bccb['filters']=_[_0x0d24('0x30')](_0xa1bccb['model'],_0xa1bccb[_0x0d24('0x2e')]);_0x1a1ef7[_0x0d24('0x31')]=_[_0x0d24('0x30')](_0xa1bccb[_0x0d24('0x2d')],qs[_0x0d24('0x32')](_0x1057c3['query']['fields']));_0x1a1ef7[_0x0d24('0x31')]=_0x1a1ef7[_0x0d24('0x31')][_0x0d24('0x33')]?_0x1a1ef7[_0x0d24('0x31')]:_0xa1bccb[_0x0d24('0x2d')];if(!_0x1057c3[_0x0d24('0x2e')]['hasOwnProperty'](_0x0d24('0x34'))){_0x1a1ef7[_0x0d24('0x1b')]=qs['limit'](_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x1b')]);_0x1a1ef7['offset']=qs[_0x0d24('0x1a')](_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x1a')]);}_0x1a1ef7['order']=qs[_0x0d24('0x35')](_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x35')]);_0x1a1ef7[_0x0d24('0x36')]=qs['filters'](_['pick'](_0x1057c3[_0x0d24('0x2e')],_0xa1bccb['filters']),_0x8f3446);if(_0x1057c3['query']['filter']){_0x1a1ef7[_0x0d24('0x36')]=_['merge'](_0x1a1ef7[_0x0d24('0x36')],{'$or':_[_0x0d24('0x29')](_0x8f3446,function(_0x37302d){if(_0x37302d[_0x0d24('0x37')]!==_0x0d24('0x38')){var _0x274cf5={};_0x274cf5[_0x37302d[_0x0d24('0x28')]]={'$like':'%'+_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x39')]+'%'};return _0x274cf5;}})});}_0x1a1ef7=_['merge']({},_0x1a1ef7,_0x1057c3[_0x0d24('0x3a')]);var _0x554917={'where':_0x1a1ef7['where']};return db[_0x0d24('0x2a')][_0x0d24('0x1d')](_0x554917)[_0x0d24('0x24')](function(_0x1396cf){_0x31ea4b[_0x0d24('0x1d')]=_0x1396cf;if(_0x1057c3[_0x0d24('0x2e')][_0x0d24('0x3b')]){_0x1a1ef7[_0x0d24('0x3c')]=[{'all':!![]}];}return db[_0x0d24('0x2a')][_0x0d24('0x3d')](_0x1a1ef7);})[_0x0d24('0x24')](function(_0x548fee){_0x31ea4b[_0x0d24('0x3e')]=_0x548fee;return _0x31ea4b;})[_0x0d24('0x24')](respondWithFilteredResult(_0x2064e3,_0x1a1ef7))['catch'](handleError(_0x2064e3,null));};exports[_0x0d24('0x3f')]=function(_0x9dd427,_0x119152){var _0x1fbff7={'raw':![],'where':{'id':_0x9dd427['params']['id']}},_0x4004d7={};_0x4004d7[_0x0d24('0x2d')]=_['keys'](db[_0x0d24('0x2a')][_0x0d24('0x2b')]);_0x4004d7['query']=_[_0x0d24('0x2f')](_0x9dd427[_0x0d24('0x2e')]);_0x4004d7['filters']=_['intersection'](_0x4004d7['model'],_0x4004d7[_0x0d24('0x2e')]);_0x1fbff7[_0x0d24('0x31')]=_[_0x0d24('0x30')](_0x4004d7[_0x0d24('0x2d')],qs[_0x0d24('0x32')](_0x9dd427['query'][_0x0d24('0x32')]));_0x1fbff7[_0x0d24('0x31')]=_0x1fbff7['attributes'][_0x0d24('0x33')]?_0x1fbff7['attributes']:_0x4004d7[_0x0d24('0x2d')];if(_0x9dd427[_0x0d24('0x2e')]['includeAll']){_0x1fbff7[_0x0d24('0x3c')]=[{'all':!![]}];}_0x1fbff7=_[_0x0d24('0x40')]({},_0x1fbff7,_0x9dd427[_0x0d24('0x3a')]);return db[_0x0d24('0x2a')][_0x0d24('0x41')](_0x1fbff7)[_0x0d24('0x24')](handleEntityNotFound(_0x119152,null))[_0x0d24('0x24')](respondWithResult(_0x119152,null))[_0x0d24('0x42')](handleError(_0x119152,null));};exports[_0x0d24('0x43')]=function(_0x211bea,_0x149ea2){return db[_0x0d24('0x2a')]['create'](_0x211bea[_0x0d24('0x44')],{})[_0x0d24('0x24')](respondWithResult(_0x149ea2,0xc9))[_0x0d24('0x42')](handleError(_0x149ea2,null));};exports[_0x0d24('0x23')]=function(_0x39e695,_0xfc9d42){if(_0x39e695[_0x0d24('0x44')]['id']){delete _0x39e695['body']['id'];}return db['FreshdeskAccount'][_0x0d24('0x41')]({'where':{'id':_0x39e695[_0x0d24('0x45')]['id']}})[_0x0d24('0x24')](handleEntityNotFound(_0xfc9d42,null))[_0x0d24('0x24')](saveUpdates(_0x39e695['body'],null))[_0x0d24('0x24')](respondWithResult(_0xfc9d42,null))[_0x0d24('0x42')](handleError(_0xfc9d42,null));};exports[_0x0d24('0x46')]=function(_0x5544ff,_0x1c52f2){return db[_0x0d24('0x2a')][_0x0d24('0x41')]({'where':{'id':_0x5544ff[_0x0d24('0x45')]['id']}})[_0x0d24('0x24')](handleEntityNotFound(_0x1c52f2,null))[_0x0d24('0x24')](removeEntity(_0x1c52f2,null))[_0x0d24('0x42')](handleError(_0x1c52f2,null));};exports['getConfigurations']=function(_0x574242,_0x141c37,_0x3bc338){var _0xbf0dc0={};var _0x5e1df1={};var _0x3d7e8e;var _0x306897;return db[_0x0d24('0x2a')][_0x0d24('0x47')]({'where':{'id':_0x574242[_0x0d24('0x45')]['id']}})[_0x0d24('0x24')](handleEntityNotFound(_0x141c37,null))[_0x0d24('0x24')](function(_0x4e2969){if(_0x4e2969){_0x3d7e8e=_0x4e2969;_0x5e1df1[_0x0d24('0x2d')]=_[_0x0d24('0x2f')](db[_0x0d24('0x48')][_0x0d24('0x2b')]);_0x5e1df1[_0x0d24('0x2e')]=_['keys'](_0x574242[_0x0d24('0x2e')]);_0x5e1df1[_0x0d24('0x49')]=_[_0x0d24('0x30')](_0x5e1df1[_0x0d24('0x2d')],_0x5e1df1[_0x0d24('0x2e')]);_0xbf0dc0['attributes']=_[_0x0d24('0x30')](_0x5e1df1['model'],qs[_0x0d24('0x32')](_0x574242[_0x0d24('0x2e')]['fields']));_0xbf0dc0[_0x0d24('0x31')]=_0xbf0dc0[_0x0d24('0x31')][_0x0d24('0x33')]?_0xbf0dc0[_0x0d24('0x31')]:_0x5e1df1[_0x0d24('0x2d')];_0xbf0dc0[_0x0d24('0x4a')]=qs[_0x0d24('0x35')](_0x574242[_0x0d24('0x2e')][_0x0d24('0x35')]);_0xbf0dc0[_0x0d24('0x36')]=qs[_0x0d24('0x49')](_[_0x0d24('0x4b')](_0x574242[_0x0d24('0x2e')],_0x5e1df1[_0x0d24('0x49')]));if(_0x574242[_0x0d24('0x2e')]['filter']){_0xbf0dc0[_0x0d24('0x36')]=_[_0x0d24('0x40')](_0xbf0dc0[_0x0d24('0x36')],{'$or':_[_0x0d24('0x29')](_0xbf0dc0[_0x0d24('0x31')],function(_0x3a347e){var _0x147461={};_0x147461[_0x3a347e]={'$like':'%'+_0x574242[_0x0d24('0x2e')][_0x0d24('0x39')]+'%'};return _0x147461;})});}_0xbf0dc0=_['merge']({},_0xbf0dc0,_0x574242[_0x0d24('0x3a')]);return _0x3d7e8e['getConfigurations'](_0xbf0dc0);}})[_0x0d24('0x24')](function(_0x24ce98){if(_0x24ce98){_0x306897=_0x24ce98[_0x0d24('0x33')];if(!_0x574242[_0x0d24('0x2e')]['hasOwnProperty'](_0x0d24('0x34'))){_0xbf0dc0[_0x0d24('0x1b')]=qs[_0x0d24('0x1b')](_0x574242[_0x0d24('0x2e')]['limit']);_0xbf0dc0[_0x0d24('0x1a')]=qs[_0x0d24('0x1a')](_0x574242[_0x0d24('0x2e')]['offset']);}return _0x3d7e8e['getConfigurations'](_0xbf0dc0);}})[_0x0d24('0x24')](function(_0x476c62){if(_0x476c62){return _0x476c62?{'count':_0x306897,'rows':_0x476c62}:null;}})[_0x0d24('0x24')](respondWithResult(_0x141c37,null))['catch'](handleError(_0x141c37,null));};exports[_0x0d24('0x4c')]=function(_0x5a91db,_0x4794cf,_0x3f711d){if(_0x5a91db['body']['id']){delete _0x5a91db[_0x0d24('0x44')]['id'];}return db['FreshdeskAccount'][_0x0d24('0x47')]({'where':{'id':_0x5a91db[_0x0d24('0x45')]['id']}})[_0x0d24('0x24')](handleEntityNotFound(_0x4794cf,null))[_0x0d24('0x24')](function(_0x957841){if(_0x957841){_0x5a91db['body'][_0x0d24('0x4d')]=_0x957841['id'];_0x5a91db[_0x0d24('0x44')][_0x0d24('0x4e')]=integrations[_0x0d24('0x4f')](_0x5a91db[_0x0d24('0x44')][_0x0d24('0x50')],_0x5a91db[_0x0d24('0x44')][_0x0d24('0x37')]);_0x5a91db[_0x0d24('0x44')][_0x0d24('0x51')]=integrations[_0x0d24('0x52')](_0x5a91db[_0x0d24('0x44')][_0x0d24('0x50')],_0x5a91db[_0x0d24('0x44')][_0x0d24('0x37')]);return db['FreshdeskConfiguration'][_0x0d24('0x43')](_0x5a91db[_0x0d24('0x44')],{'include':[{'model':db['FreshdeskField'],'as':_0x0d24('0x4e')},{'model':db[_0x0d24('0x53')],'as':_0x0d24('0x51')}]});}return null;})[_0x0d24('0x24')](respondWithResult(_0x4794cf,null))['catch'](handleError(_0x4794cf,null));};exports[_0x0d24('0x54')]=function(_0x3ba9b6,_0x2248bf,_0x24639d){var _0x515309='';return db[_0x0d24('0x2a')][_0x0d24('0x47')]({'where':{'id':_0x3ba9b6[_0x0d24('0x45')]['id']},'attributes':['id',_0x0d24('0x55'),_0x0d24('0x56')]})[_0x0d24('0x24')](handleEntityNotFound(_0x2248bf,null))[_0x0d24('0x24')](function(_0xbe28b9){if(_0xbe28b9){_0x515309=_0xbe28b9[_0x0d24('0x55')];var _0x187cc1=_0x515309[_0x0d24('0x57')](-0x1);if(_0x187cc1==='/'){_0x515309=_0x515309[_0x0d24('0x58')](0x0,_0x515309[_0x0d24('0x59')](_0x187cc1));}return rp({'method':'GET','uri':util[_0x0d24('0x5a')](_0x0d24('0x5b'),_0x515309,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x0d24('0x5a')]('Basic\x20%s',new Buffer(util[_0x0d24('0x5a')]('%s:X',_0xbe28b9['apiKey']))[_0x0d24('0x5c')]('base64'))},'json':!![]});}})[_0x0d24('0x24')](function(_0xd836d4){if(_0xd836d4){var _0x134063=['requester',_0x0d24('0x5d'),_0x0d24('0x5e'),_0x0d24('0x5f'),'status',_0x0d24('0x60'),_0x0d24('0x61'),_0x0d24('0x62'),_0x0d24('0x63'),_0x0d24('0x61'),_0x0d24('0x64')];_[_0x0d24('0x65')](_0xd836d4,function(_0x31e6c7){return _0x134063['includes'](_0x31e6c7[_0x0d24('0x28')])||!_0x31e6c7[_0x0d24('0x66')]&&_0x31e6c7[_0x0d24('0x37')]!==_0x0d24('0x67')&&_0x31e6c7[_0x0d24('0x37')]!=='custom_dropdown';});return{'count':_0xd836d4[_0x0d24('0x33')],'rows':_[_0x0d24('0x29')](_0xd836d4,function(_0x29a08a){return{'id':_0x29a08a[_0x0d24('0x28')],'name':_0x29a08a[_0x0d24('0x68')],'custom':!_0x29a08a[_0x0d24('0x66')],'options':_0x29a08a['choices']?_[_0x0d24('0x29')](_0x29a08a['choices'],function(_0x4d0314){return{'name':_[_0x0d24('0x69')](_0x4d0314),'value':_0x4d0314};}):[]};})};}})[_0x0d24('0x24')](respondWithResult(_0x2248bf,null))[_0x0d24('0x42')](function(_0x116066){var _0x43bb46=_0x3ba9b6['query'][_0x0d24('0x6a')]?0x1f4:_0x116066[_0x0d24('0x6b')]||0x1f4;logger[_0x0d24('0x26')](_0x0d24('0x6c'),_0x0d24('0x54'),_0x43bb46,JSON[_0x0d24('0x6d')](_0x116066));delete _0x116066[_0x0d24('0x28')];if(_0x43bb46===0x191){_0x43bb46=0x190;}_0x2248bf[_0x0d24('0x17')](_0x43bb46)['send'](_0x3ba9b6['query'][_0x0d24('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x116066[_0x0d24('0x6b')]}:_0x116066);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 96a2a2c..2cd7ae8 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 _0x7fd3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x421c11,_0xcf7560){var _0x317709=function(_0x5c8c71){while(--_0x5c8c71){_0x421c11['push'](_0x421c11['shift']());}};_0x317709(++_0xcf7560);}(_0x7fd3,0xdf));var _0x37fd=function(_0x5c9237,_0x44aa40){_0x5c9237=_0x5c9237-0x0;var _0x377761=_0x7fd3[_0x5c9237];return _0x377761;};'use strict';var _=require(_0x37fd('0x0'));var util=require('util');var logger=require(_0x37fd('0x1'))(_0x37fd('0x2'));var moment=require(_0x37fd('0x3'));var BPromise=require(_0x37fd('0x4'));var rp=require(_0x37fd('0x5'));var fs=require('fs');var path=require(_0x37fd('0x6'));var rimraf=require(_0x37fd('0x7'));var config=require('../../config/environment');var attributes=require(_0x37fd('0x8'));var integrations=require(_0x37fd('0x9'));module[_0x37fd('0xa')]=function(_0x3dee92,_0x5ab7a4){return _0x3dee92[_0x37fd('0xb')](_0x37fd('0xc'),attributes,{'tableName':_0x37fd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc036=['../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x12b71a,_0x5a0f68){var _0xfa09c6=function(_0x4c4434){while(--_0x4c4434){_0x12b71a['push'](_0x12b71a['shift']());}};_0xfa09c6(++_0x5a0f68);}(_0xc036,0x1bf));var _0x6c03=function(_0x3cb41d,_0x2d7f6d){_0x3cb41d=_0x3cb41d-0x0;var _0x4dc372=_0xc036[_0x3cb41d];return _0x4dc372;};'use strict';var _=require(_0x6c03('0x0'));var util=require(_0x6c03('0x1'));var logger=require(_0x6c03('0x2'))(_0x6c03('0x3'));var moment=require(_0x6c03('0x4'));var BPromise=require(_0x6c03('0x5'));var rp=require(_0x6c03('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6c03('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x6c03('0x8'));module[_0x6c03('0x9')]=function(_0x17470e,_0x539388){return _0x17470e[_0x6c03('0xa')](_0x6c03('0xb'),attributes,{'tableName':_0x6c03('0xc'),'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 625cd28..8a913c6 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 _0xd156=['rpc','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','map','model','include','attributes','find','ShowFreshdeskAccount','moment','bluebird','randomstring','../../config/utils'];(function(_0x5957d0,_0x2048b3){var _0x357aad=function(_0x5c9c01){while(--_0x5c9c01){_0x5957d0['push'](_0x5957d0['shift']());}};_0x357aad(++_0x2048b3);}(_0xd156,0x151));var _0x6d15=function(_0x571a60,_0x5cce60){_0x571a60=_0x571a60-0x0;var _0x27fab9=_0xd156[_0x571a60];return _0x27fab9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d15('0x0'));var BPromise=require(_0x6d15('0x1'));var rs=require(_0x6d15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6d15('0x3'));var logger=require('../../config/logger')(_0x6d15('0x4'));var config=require('../../config/environment');var jayson=require(_0x6d15('0x5'));var client=jayson[_0x6d15('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51b481,_0xd4d4a8,_0x3d4d65){return new BPromise(function(_0x562874,_0x4e7952){return client[_0x6d15('0x7')](_0x51b481,_0x3d4d65)[_0x6d15('0x8')](function(_0x1e50e3){logger[_0x6d15('0x9')](_0x6d15('0xa'),_0xd4d4a8,_0x6d15('0xb'));logger[_0x6d15('0xc')](_0x6d15('0xd'),_0xd4d4a8,'request\x20sent',JSON[_0x6d15('0xe')](_0x1e50e3));if(_0x1e50e3[_0x6d15('0xf')]){if(_0x1e50e3['error'][_0x6d15('0x10')]===0x1f4){logger['error'](_0x6d15('0xa'),_0xd4d4a8,_0x1e50e3['error'][_0x6d15('0x11')]);return _0x4e7952(_0x1e50e3[_0x6d15('0xf')][_0x6d15('0x11')]);}logger[_0x6d15('0xf')](_0x6d15('0xa'),_0xd4d4a8,_0x1e50e3[_0x6d15('0xf')][_0x6d15('0x11')]);return _0x562874(_0x1e50e3[_0x6d15('0xf')]['message']);}else{logger[_0x6d15('0x9')](_0x6d15('0xa'),_0xd4d4a8,'request\x20sent');_0x562874(_0x1e50e3['result'][_0x6d15('0x11')]);}})[_0x6d15('0x12')](function(_0x3c6afd){logger[_0x6d15('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0xd4d4a8,_0x3c6afd);_0x4e7952(_0x3c6afd);});});}exports[_0x6d15('0x13')]=function(_0xc8ae50){var _0x54be65=this;return new Promise(function(_0x5dfb34,_0x30259b){return db[_0x6d15('0x14')][_0x6d15('0x15')]({'raw':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50[_0x6d15('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50['options'][_0x6d15('0x17')]||null:null,'attributes':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50[_0x6d15('0x16')]['attributes']||null:null,'limit':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50[_0x6d15('0x16')][_0x6d15('0x18')]||null:null,'include':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50[_0x6d15('0x16')]['include']?_[_0x6d15('0x19')](_0xc8ae50[_0x6d15('0x16')]['include'],function(_0x284422){return{'model':db[_0x284422[_0x6d15('0x1a')]],'as':_0x284422['as'],'attributes':_0x284422['attributes'],'include':_0x284422[_0x6d15('0x1b')]?_['map'](_0x284422['include'],function(_0xd4411b){return{'model':db[_0xd4411b[_0x6d15('0x1a')]],'as':_0xd4411b['as'],'attributes':_0xd4411b[_0x6d15('0x1c')],'include':_0xd4411b[_0x6d15('0x1b')]?_['map'](_0xd4411b['include'],function(_0x455519){return{'model':db[_0x455519[_0x6d15('0x1a')]],'as':_0x455519['as'],'attributes':_0x455519['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d15('0x8')](function(_0x546a29){logger[_0x6d15('0x9')](_0x6d15('0x13'),_0xc8ae50);logger['debug'](_0x6d15('0x13'),_0xc8ae50,JSON[_0x6d15('0xe')](_0x546a29));_0x5dfb34(_0x546a29);})[_0x6d15('0x12')](function(_0x5d52ae){logger['error']('GetFreshdeskAccount',_0x5d52ae['message'],_0xc8ae50);_0x30259b(_0x54be65[_0x6d15('0xf')](0x1f4,_0x5d52ae[_0x6d15('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x3de6b6){var _0x380241=this;return new Promise(function(_0x5850d0,_0x2460ea){return db[_0x6d15('0x14')][_0x6d15('0x1d')]({'raw':_0x3de6b6['options']?_0x3de6b6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3de6b6[_0x6d15('0x16')]?_0x3de6b6[_0x6d15('0x16')][_0x6d15('0x17')]||null:null,'attributes':_0x3de6b6[_0x6d15('0x16')]?_0x3de6b6[_0x6d15('0x16')][_0x6d15('0x1c')]||null:null,'include':_0x3de6b6['options']?_0x3de6b6['options']['include']?_[_0x6d15('0x19')](_0x3de6b6['options']['include'],function(_0x10a775){return{'model':db[_0x10a775['model']],'as':_0x10a775['as'],'attributes':_0x10a775[_0x6d15('0x1c')],'include':_0x10a775['include']?_[_0x6d15('0x19')](_0x10a775[_0x6d15('0x1b')],function(_0xec55c0){return{'model':db[_0xec55c0[_0x6d15('0x1a')]],'as':_0xec55c0['as'],'attributes':_0xec55c0['attributes'],'include':_0xec55c0['include']?_[_0x6d15('0x19')](_0xec55c0['include'],function(_0x51f439){return{'model':db[_0x51f439['model']],'as':_0x51f439['as'],'attributes':_0x51f439[_0x6d15('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6d15('0x8')](function(_0xfd1240){logger[_0x6d15('0x9')]('ShowFreshdeskAccount',_0x3de6b6);logger[_0x6d15('0xc')](_0x6d15('0x1e'),_0x3de6b6,JSON[_0x6d15('0xe')](_0xfd1240));_0x5850d0(_0xfd1240);})[_0x6d15('0x12')](function(_0x27fa19){logger[_0x6d15('0xf')](_0x6d15('0x1e'),_0x27fa19[_0x6d15('0x11')],_0x3de6b6);_0x2460ea(_0x380241['error'](0x1f4,_0x27fa19[_0x6d15('0x11')]));});});}; \ No newline at end of file +var _0x4e03=['then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshdeskAccount','findAll','options','raw','where','include','map','attributes','ShowFreshdeskAccount','FreshdeskAccount','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x1533a1,_0x24ba89){var _0x2093b8=function(_0x3a56ac){while(--_0x3a56ac){_0x1533a1['push'](_0x1533a1['shift']());}};_0x2093b8(++_0x24ba89);}(_0x4e03,0x1e5));var _0x34e0=function(_0x2c705f,_0x39a80f){_0x2c705f=_0x2c705f-0x0;var _0x22795b=_0x4e03[_0x2c705f];return _0x22795b;};'use strict';var _=require(_0x34e0('0x0'));var util=require('util');var moment=require(_0x34e0('0x1'));var BPromise=require('bluebird');var rs=require(_0x34e0('0x2'));var fs=require('fs');var Redis=require(_0x34e0('0x3'));var db=require(_0x34e0('0x4'))['db'];var utils=require(_0x34e0('0x5'));var logger=require(_0x34e0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x34e0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x243e68,_0x185d0c,_0x29b28c){return new BPromise(function(_0x3e80ac,_0x522047){return client['request'](_0x243e68,_0x29b28c)[_0x34e0('0x8')](function(_0x15d7d3){logger[_0x34e0('0x9')](_0x34e0('0xa'),_0x185d0c,_0x34e0('0xb'));logger[_0x34e0('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x185d0c,_0x34e0('0xb'),JSON[_0x34e0('0xd')](_0x15d7d3));if(_0x15d7d3[_0x34e0('0xe')]){if(_0x15d7d3[_0x34e0('0xe')][_0x34e0('0xf')]===0x1f4){logger[_0x34e0('0xe')](_0x34e0('0xa'),_0x185d0c,_0x15d7d3[_0x34e0('0xe')][_0x34e0('0x10')]);return _0x522047(_0x15d7d3['error']['message']);}logger[_0x34e0('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x185d0c,_0x15d7d3[_0x34e0('0xe')][_0x34e0('0x10')]);return _0x3e80ac(_0x15d7d3['error'][_0x34e0('0x10')]);}else{logger[_0x34e0('0x9')](_0x34e0('0xa'),_0x185d0c,_0x34e0('0xb'));_0x3e80ac(_0x15d7d3['result'][_0x34e0('0x10')]);}})[_0x34e0('0x11')](function(_0x17674c){logger[_0x34e0('0xe')](_0x34e0('0xa'),_0x185d0c,_0x17674c);_0x522047(_0x17674c);});});}exports[_0x34e0('0x12')]=function(_0x2da208){var _0x18e396=this;return new Promise(function(_0x360031,_0x170652){return db['FreshdeskAccount'][_0x34e0('0x13')]({'raw':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')][_0x34e0('0x15')]===undefined?!![]:![]:!![],'where':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')][_0x34e0('0x16')]||null:null,'attributes':_0x2da208['options']?_0x2da208['options']['attributes']||null:null,'limit':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')]['limit']||null:null,'include':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')][_0x34e0('0x17')]?_[_0x34e0('0x18')](_0x2da208['options']['include'],function(_0x2d4854){return{'model':db[_0x2d4854['model']],'as':_0x2d4854['as'],'attributes':_0x2d4854[_0x34e0('0x19')],'include':_0x2d4854['include']?_[_0x34e0('0x18')](_0x2d4854[_0x34e0('0x17')],function(_0x5d75c5){return{'model':db[_0x5d75c5['model']],'as':_0x5d75c5['as'],'attributes':_0x5d75c5[_0x34e0('0x19')],'include':_0x5d75c5[_0x34e0('0x17')]?_['map'](_0x5d75c5[_0x34e0('0x17')],function(_0x53790b){return{'model':db[_0x53790b['model']],'as':_0x53790b['as'],'attributes':_0x53790b[_0x34e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34e0('0x8')](function(_0x27743f){logger['info'](_0x34e0('0x12'),_0x2da208);logger[_0x34e0('0xc')](_0x34e0('0x12'),_0x2da208,JSON[_0x34e0('0xd')](_0x27743f));_0x360031(_0x27743f);})['catch'](function(_0x577ffd){logger[_0x34e0('0xe')]('GetFreshdeskAccount',_0x577ffd[_0x34e0('0x10')],_0x2da208);_0x170652(_0x18e396[_0x34e0('0xe')](0x1f4,_0x577ffd[_0x34e0('0x10')]));});});};exports[_0x34e0('0x1a')]=function(_0x53ea2){var _0x40f332=this;return new Promise(function(_0x2fa97,_0x4c7bc5){return db[_0x34e0('0x1b')]['find']({'raw':_0x53ea2[_0x34e0('0x14')]?_0x53ea2[_0x34e0('0x14')][_0x34e0('0x15')]===undefined?!![]:![]:!![],'where':_0x53ea2['options']?_0x53ea2[_0x34e0('0x14')]['where']||null:null,'attributes':_0x53ea2[_0x34e0('0x14')]?_0x53ea2[_0x34e0('0x14')][_0x34e0('0x19')]||null:null,'include':_0x53ea2[_0x34e0('0x14')]?_0x53ea2[_0x34e0('0x14')][_0x34e0('0x17')]?_[_0x34e0('0x18')](_0x53ea2[_0x34e0('0x14')][_0x34e0('0x17')],function(_0x2d119f){return{'model':db[_0x2d119f[_0x34e0('0x1c')]],'as':_0x2d119f['as'],'attributes':_0x2d119f[_0x34e0('0x19')],'include':_0x2d119f[_0x34e0('0x17')]?_['map'](_0x2d119f[_0x34e0('0x17')],function(_0x54d75a){return{'model':db[_0x54d75a[_0x34e0('0x1c')]],'as':_0x54d75a['as'],'attributes':_0x54d75a[_0x34e0('0x19')],'include':_0x54d75a[_0x34e0('0x17')]?_['map'](_0x54d75a[_0x34e0('0x17')],function(_0x2c9bdb){return{'model':db[_0x2c9bdb[_0x34e0('0x1c')]],'as':_0x2c9bdb['as'],'attributes':_0x2c9bdb[_0x34e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34e0('0x8')](function(_0x5a2331){logger['info'](_0x34e0('0x1a'),_0x53ea2);logger[_0x34e0('0xc')](_0x34e0('0x1a'),_0x53ea2,JSON[_0x34e0('0xd')](_0x5a2331));_0x2fa97(_0x5a2331);})[_0x34e0('0x11')](function(_0x5c5343){logger[_0x34e0('0xe')](_0x34e0('0x1a'),_0x5c5343[_0x34e0('0x10')],_0x53ea2);_0x4c7bc5(_0x40f332[_0x34e0('0xe')](0x1f4,_0x5c5343[_0x34e0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 1885d65..c18c0dd 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 _0xcbe4=['destroy','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcbe4,0x182));var _0x4cbe=function(_0x38d5f4,_0x113004){_0x38d5f4=_0x38d5f4-0x0;var _0x481490=_0xcbe4[_0x38d5f4];return _0x481490;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4cbe('0x0'));var express=require(_0x4cbe('0x1'));var router=express[_0x4cbe('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4cbe('0x3'));var config=require(_0x4cbe('0x4'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x4cbe('0x5')]('/',auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x7')]);router['get'](_0x4cbe('0x8'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x9')]);router[_0x4cbe('0x5')](_0x4cbe('0xa'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0xb')]);router[_0x4cbe('0x5')](_0x4cbe('0xc'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0xd')]);router[_0x4cbe('0x5')]('/:id/descriptions',auth[_0x4cbe('0x6')](),controller[_0x4cbe('0xe')]);router['get'](_0x4cbe('0xf'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x10')]);router[_0x4cbe('0x11')]('/',auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x12')]);router[_0x4cbe('0x11')](_0x4cbe('0xf'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x13')]);router['put'](_0x4cbe('0x8'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x14')]);router[_0x4cbe('0x15')](_0x4cbe('0x8'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x16')]);module[_0x4cbe('0x17')]=router; \ No newline at end of file +var _0xd1a3=['index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x2a8255,_0x2ab6cb){var _0x20d7a5=function(_0x19f120){while(--_0x19f120){_0x2a8255['push'](_0x2a8255['shift']());}};_0x20d7a5(++_0x2ab6cb);}(_0xd1a3,0x170));var _0x3d1a=function(_0x1ab302,_0x3fe36c){_0x1ab302=_0x1ab302-0x0;var _0x152fae=_0xd1a3[_0x1ab302];return _0x152fae;};'use strict';var multer=require(_0x3d1a('0x0'));var util=require(_0x3d1a('0x1'));var path=require(_0x3d1a('0x2'));var timeout=require(_0x3d1a('0x3'));var express=require('express');var router=express[_0x3d1a('0x4')]();var fs_extra=require(_0x3d1a('0x5'));var auth=require(_0x3d1a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d1a('0x7'));router[_0x3d1a('0x8')]('/',auth[_0x3d1a('0x9')](),controller[_0x3d1a('0xa')]);router['get']('/:id',auth[_0x3d1a('0x9')](),controller['show']);router['get'](_0x3d1a('0xb'),auth[_0x3d1a('0x9')](),controller[_0x3d1a('0xc')]);router['get'](_0x3d1a('0xd'),auth[_0x3d1a('0x9')](),controller[_0x3d1a('0xe')]);router[_0x3d1a('0x8')](_0x3d1a('0xf'),auth[_0x3d1a('0x9')](),controller[_0x3d1a('0x10')]);router['get'](_0x3d1a('0x11'),auth[_0x3d1a('0x9')](),controller[_0x3d1a('0x12')]);router[_0x3d1a('0x13')]('/',auth[_0x3d1a('0x9')](),controller[_0x3d1a('0x14')]);router[_0x3d1a('0x13')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3d1a('0x15')]);router[_0x3d1a('0x16')](_0x3d1a('0x17'),auth[_0x3d1a('0x9')](),controller[_0x3d1a('0x18')]);router[_0x3d1a('0x19')](_0x3d1a('0x17'),auth[_0x3d1a('0x9')](),controller['destroy']);module[_0x3d1a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 893a4de..1ced13a 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 _0x4995=['sequelize','exports','STRING'];(function(_0x2a61a9,_0x132d0d){var _0x52c670=function(_0x2813c4){while(--_0x2813c4){_0x2a61a9['push'](_0x2a61a9['shift']());}};_0x52c670(++_0x132d0d);}(_0x4995,0x84));var _0x5499=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4995[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x5499('0x0'));module[_0x5499('0x1')]={'name':{'type':Sequelize[_0x5499('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5f88=['sequelize','exports','STRING'];(function(_0x217a2f,_0x220a6b){var _0x56795d=function(_0x5d7925){while(--_0x5d7925){_0x217a2f['push'](_0x217a2f['shift']());}};_0x56795d(++_0x220a6b);}(_0x5f88,0x1e6));var _0x85f8=function(_0x3e7c0a,_0x5df036){_0x3e7c0a=_0x3e7c0a-0x0;var _0x484559=_0x5f88[_0x3e7c0a];return _0x484559;};'use strict';var Sequelize=require(_0x85f8('0x0'));module[_0x85f8('0x1')]={'name':{'type':Sequelize[_0x85f8('0x2')]},'description':{'type':Sequelize[_0x85f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 012283f..645198f 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 _0x3879=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskConfiguration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','rows','catch','params','rawAttributes','includeAll','include','find','create','body','getFields','FreshdeskField','pick','findOne','keys','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x291f14,_0x32ddbc){var _0x399cb1=function(_0x3c4ace){while(--_0x3c4ace){_0x291f14['push'](_0x291f14['shift']());}};_0x399cb1(++_0x32ddbc);}(_0x3879,0x1ab));var _0x9387=function(_0x36443f,_0x42cfdb){_0x36443f=_0x36443f-0x0;var _0x37bbf9=_0x3879[_0x36443f];return _0x37bbf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9387('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9387('0x1'));var rp=require(_0x9387('0x2'));var moment=require('moment');var BPromise=require(_0x9387('0x3'));var Mustache=require(_0x9387('0x4'));var util=require(_0x9387('0x5'));var path=require(_0x9387('0x6'));var sox=require(_0x9387('0x7'));var csv=require(_0x9387('0x8'));var ejs=require(_0x9387('0x9'));var fs=require('fs');var fs_extra=require(_0x9387('0xa'));var _=require(_0x9387('0xb'));var squel=require('squel');var crypto=require(_0x9387('0xc'));var jsforce=require(_0x9387('0xd'));var deskjs=require(_0x9387('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9387('0xf'));var Papa=require(_0x9387('0x10'));var Redis=require(_0x9387('0x11'));var authService=require(_0x9387('0x12'));var qs=require(_0x9387('0x13'));var as=require(_0x9387('0x14'));var hardwareService=require(_0x9387('0x15'));var logger=require(_0x9387('0x16'))(_0x9387('0x17'));var utils=require(_0x9387('0x18'));var config=require(_0x9387('0x19'));var licenseUtil=require(_0x9387('0x1a'));var db=require(_0x9387('0x1b'))['db'];function respondWithStatusCode(_0x580b1f,_0x55d5e8){_0x55d5e8=_0x55d5e8||0xcc;return function(_0x59374d){if(_0x59374d){return _0x580b1f[_0x9387('0x1c')](_0x55d5e8);}return _0x580b1f[_0x9387('0x1d')](_0x55d5e8)[_0x9387('0x1e')]();};}function respondWithResult(_0x5123f9,_0x556ab8){_0x556ab8=_0x556ab8||0xc8;return function(_0x1930ef){if(_0x1930ef){return _0x5123f9[_0x9387('0x1d')](_0x556ab8)[_0x9387('0x1f')](_0x1930ef);}};}function respondWithFilteredResult(_0x1904a1,_0x17de98){return function(_0x3b7aa7){if(_0x3b7aa7){var _0x5dc252=typeof _0x17de98[_0x9387('0x20')]==='undefined'&&typeof _0x17de98['limit']===_0x9387('0x21');var _0x343d0b=_0x3b7aa7[_0x9387('0x22')];var _0x5a6dab=_0x5dc252?0x0:_0x17de98[_0x9387('0x20')];var _0xc5205e=_0x5dc252?_0x3b7aa7[_0x9387('0x22')]:_0x17de98[_0x9387('0x20')]+_0x17de98[_0x9387('0x23')];var _0x5a3e35;if(_0xc5205e>=_0x343d0b){_0xc5205e=_0x343d0b;_0x5a3e35=0xc8;}else{_0x5a3e35=0xce;}_0x1904a1['status'](_0x5a3e35);return _0x1904a1[_0x9387('0x24')]('Content-Range',_0x5a6dab+'-'+_0xc5205e+'/'+_0x343d0b)['json'](_0x3b7aa7);}return null;};}function patchUpdates(_0x4f41c6){return function(_0x15ef64){try{jsonpatch[_0x9387('0x25')](_0x15ef64,_0x4f41c6,!![]);}catch(_0x1464d1){return BPromise[_0x9387('0x26')](_0x1464d1);}return _0x15ef64[_0x9387('0x27')]();};}function saveUpdates(_0x25858c,_0xa9db64){return function(_0x11d5dd){if(_0x11d5dd){return _0x11d5dd[_0x9387('0x28')](_0x25858c)[_0x9387('0x29')](function(_0x30f5e4){return _0x30f5e4;});}return null;};}function removeEntity(_0x5edf13,_0x19f3a5){return function(_0x198b91){if(_0x198b91){return _0x198b91[_0x9387('0x2a')]()[_0x9387('0x29')](function(){_0x5edf13[_0x9387('0x1d')](0xcc)[_0x9387('0x1e')]();});}};}function handleEntityNotFound(_0x461f6b,_0x34cbb4){return function(_0x2bf730){if(!_0x2bf730){_0x461f6b['sendStatus'](0x194);}return _0x2bf730;};}function handleError(_0x53c67f,_0x50db5f){_0x50db5f=_0x50db5f||0x1f4;return function(_0x1be2e9){logger['error'](_0x1be2e9[_0x9387('0x2b')]);if(_0x1be2e9[_0x9387('0x2c')]){delete _0x1be2e9[_0x9387('0x2c')];}_0x53c67f[_0x9387('0x1d')](_0x50db5f)[_0x9387('0x2d')](_0x1be2e9);};}exports['index']=function(_0x447159,_0x5c9717){var _0x246e79={},_0x520ad6={},_0x4d0773={'count':0x0,'rows':[]};var _0x38b387=_[_0x9387('0x2e')](db[_0x9387('0x2f')]['rawAttributes'],function(_0x312025){return{'name':_0x312025[_0x9387('0x30')],'type':_0x312025['type'][_0x9387('0x31')]};});_0x520ad6[_0x9387('0x32')]=_[_0x9387('0x2e')](_0x38b387,_0x9387('0x2c'));_0x520ad6['query']=_['keys'](_0x447159[_0x9387('0x33')]);_0x520ad6[_0x9387('0x34')]=_[_0x9387('0x35')](_0x520ad6[_0x9387('0x32')],_0x520ad6[_0x9387('0x33')]);_0x246e79[_0x9387('0x36')]=_[_0x9387('0x35')](_0x520ad6[_0x9387('0x32')],qs['fields'](_0x447159['query'][_0x9387('0x37')]));_0x246e79['attributes']=_0x246e79['attributes'][_0x9387('0x38')]?_0x246e79[_0x9387('0x36')]:_0x520ad6[_0x9387('0x32')];if(!_0x447159[_0x9387('0x33')][_0x9387('0x39')](_0x9387('0x3a'))){_0x246e79[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x447159[_0x9387('0x33')][_0x9387('0x23')]);_0x246e79[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x447159['query'][_0x9387('0x20')]);}_0x246e79[_0x9387('0x3b')]=qs[_0x9387('0x3c')](_0x447159[_0x9387('0x33')][_0x9387('0x3c')]);_0x246e79[_0x9387('0x3d')]=qs[_0x9387('0x34')](_['pick'](_0x447159[_0x9387('0x33')],_0x520ad6['filters']),_0x38b387);if(_0x447159[_0x9387('0x33')][_0x9387('0x3e')]){_0x246e79[_0x9387('0x3d')]=_[_0x9387('0x3f')](_0x246e79[_0x9387('0x3d')],{'$or':_[_0x9387('0x2e')](_0x38b387,function(_0x4911cd){if(_0x4911cd[_0x9387('0x40')]!==_0x9387('0x41')){var _0x22465b={};_0x22465b[_0x4911cd[_0x9387('0x2c')]]={'$like':'%'+_0x447159[_0x9387('0x33')][_0x9387('0x3e')]+'%'};return _0x22465b;}})});}_0x246e79=_['merge']({},_0x246e79,_0x447159[_0x9387('0x42')]);var _0x15d3ce={'where':_0x246e79[_0x9387('0x3d')]};return db[_0x9387('0x2f')][_0x9387('0x22')](_0x15d3ce)[_0x9387('0x29')](function(_0x162f0e){_0x4d0773['count']=_0x162f0e;if(_0x447159[_0x9387('0x33')]['includeAll']){_0x246e79['include']=[{'all':!![]}];}return db[_0x9387('0x2f')]['findAll'](_0x246e79);})[_0x9387('0x29')](function(_0x5e8e26){_0x4d0773[_0x9387('0x43')]=_0x5e8e26;return _0x4d0773;})[_0x9387('0x29')](respondWithFilteredResult(_0x5c9717,_0x246e79))[_0x9387('0x44')](handleError(_0x5c9717,null));};exports['show']=function(_0x1dee1e,_0x51df89){var _0x518375={'raw':![],'where':{'id':_0x1dee1e[_0x9387('0x45')]['id']}},_0x3ee003={};_0x3ee003[_0x9387('0x32')]=_['keys'](db[_0x9387('0x2f')][_0x9387('0x46')]);_0x3ee003[_0x9387('0x33')]=_['keys'](_0x1dee1e[_0x9387('0x33')]);_0x3ee003['filters']=_[_0x9387('0x35')](_0x3ee003[_0x9387('0x32')],_0x3ee003['query']);_0x518375[_0x9387('0x36')]=_['intersection'](_0x3ee003[_0x9387('0x32')],qs[_0x9387('0x37')](_0x1dee1e['query'][_0x9387('0x37')]));_0x518375['attributes']=_0x518375['attributes'][_0x9387('0x38')]?_0x518375[_0x9387('0x36')]:_0x3ee003[_0x9387('0x32')];if(_0x1dee1e['query'][_0x9387('0x47')]){_0x518375[_0x9387('0x48')]=[{'all':!![]}];}_0x518375=_['merge']({},_0x518375,_0x1dee1e['options']);return db[_0x9387('0x2f')][_0x9387('0x49')](_0x518375)['then'](handleEntityNotFound(_0x51df89,null))[_0x9387('0x29')](respondWithResult(_0x51df89,null))[_0x9387('0x44')](handleError(_0x51df89,null));};exports[_0x9387('0x4a')]=function(_0x1b2884,_0x5d6143){return db['FreshdeskConfiguration'][_0x9387('0x4a')](_0x1b2884[_0x9387('0x4b')],{})['then'](respondWithResult(_0x5d6143,0xc9))[_0x9387('0x44')](handleError(_0x5d6143,null));};exports[_0x9387('0x28')]=function(_0x1e88dd,_0xb8bb8e){if(_0x1e88dd['body']['id']){delete _0x1e88dd[_0x9387('0x4b')]['id'];}return db[_0x9387('0x2f')]['find']({'where':{'id':_0x1e88dd[_0x9387('0x45')]['id']}})['then'](handleEntityNotFound(_0xb8bb8e,null))['then'](saveUpdates(_0x1e88dd[_0x9387('0x4b')],null))[_0x9387('0x29')](respondWithResult(_0xb8bb8e,null))[_0x9387('0x44')](handleError(_0xb8bb8e,null));};exports[_0x9387('0x2a')]=function(_0x1d588f,_0x1a8e15){return db[_0x9387('0x2f')][_0x9387('0x49')]({'where':{'id':_0x1d588f[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x1a8e15,null))['then'](removeEntity(_0x1a8e15,null))[_0x9387('0x44')](handleError(_0x1a8e15,null));};exports[_0x9387('0x4c')]=function(_0x692c9a,_0x25cca9,_0x3a7702){var _0x421908={};var _0x2af97f={};var _0x3d22eb;var _0x1989ad;return db[_0x9387('0x2f')]['findOne']({'where':{'id':_0x692c9a[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x25cca9,null))['then'](function(_0x192664){if(_0x192664){_0x3d22eb=_0x192664;_0x2af97f['model']=_['keys'](db[_0x9387('0x4d')]['rawAttributes']);_0x2af97f['query']=_['keys'](_0x692c9a[_0x9387('0x33')]);_0x2af97f[_0x9387('0x34')]=_[_0x9387('0x35')](_0x2af97f['model'],_0x2af97f[_0x9387('0x33')]);_0x421908[_0x9387('0x36')]=_[_0x9387('0x35')](_0x2af97f[_0x9387('0x32')],qs[_0x9387('0x37')](_0x692c9a['query'][_0x9387('0x37')]));_0x421908[_0x9387('0x36')]=_0x421908[_0x9387('0x36')][_0x9387('0x38')]?_0x421908[_0x9387('0x36')]:_0x2af97f[_0x9387('0x32')];_0x421908[_0x9387('0x3b')]=qs[_0x9387('0x3c')](_0x692c9a[_0x9387('0x33')][_0x9387('0x3c')]);_0x421908[_0x9387('0x3d')]=qs[_0x9387('0x34')](_[_0x9387('0x4e')](_0x692c9a[_0x9387('0x33')],_0x2af97f['filters']));if(_0x692c9a[_0x9387('0x33')][_0x9387('0x3e')]){_0x421908[_0x9387('0x3d')]=_['merge'](_0x421908[_0x9387('0x3d')],{'$or':_['map'](_0x421908['attributes'],function(_0x56e581){var _0x1b2449={};_0x1b2449[_0x56e581]={'$like':'%'+_0x692c9a['query'][_0x9387('0x3e')]+'%'};return _0x1b2449;})});}_0x421908=_[_0x9387('0x3f')]({},_0x421908,_0x692c9a[_0x9387('0x42')]);return _0x3d22eb['getFields'](_0x421908);}})['then'](function(_0x5e35a2){if(_0x5e35a2){_0x1989ad=_0x5e35a2[_0x9387('0x38')];if(!_0x692c9a['query']['hasOwnProperty'](_0x9387('0x3a'))){_0x421908[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x692c9a[_0x9387('0x33')][_0x9387('0x23')]);_0x421908[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x692c9a[_0x9387('0x33')]['offset']);}return _0x3d22eb['getFields'](_0x421908);}})[_0x9387('0x29')](function(_0x3c28a2){if(_0x3c28a2){return _0x3c28a2?{'count':_0x1989ad,'rows':_0x3c28a2}:null;}})['then'](respondWithResult(_0x25cca9,null))[_0x9387('0x44')](handleError(_0x25cca9,null));};exports['getSubjects']=function(_0x5133e8,_0x24857d,_0x26461d){var _0x5e39bd={};var _0x4fde33={};var _0xf939f5;var _0x4cacc9;return db[_0x9387('0x2f')][_0x9387('0x4f')]({'where':{'id':_0x5133e8['params']['id']}})['then'](handleEntityNotFound(_0x24857d,null))['then'](function(_0x5a372d){if(_0x5a372d){_0xf939f5=_0x5a372d;_0x4fde33['model']=_['keys'](db[_0x9387('0x4d')]['rawAttributes']);_0x4fde33[_0x9387('0x33')]=_[_0x9387('0x50')](_0x5133e8['query']);_0x4fde33[_0x9387('0x34')]=_['intersection'](_0x4fde33[_0x9387('0x32')],_0x4fde33[_0x9387('0x33')]);_0x5e39bd[_0x9387('0x36')]=_[_0x9387('0x35')](_0x4fde33['model'],qs[_0x9387('0x37')](_0x5133e8[_0x9387('0x33')][_0x9387('0x37')]));_0x5e39bd[_0x9387('0x36')]=_0x5e39bd[_0x9387('0x36')][_0x9387('0x38')]?_0x5e39bd[_0x9387('0x36')]:_0x4fde33[_0x9387('0x32')];_0x5e39bd[_0x9387('0x3b')]=qs['sort'](_0x5133e8[_0x9387('0x33')][_0x9387('0x3c')]);_0x5e39bd[_0x9387('0x3d')]=qs[_0x9387('0x34')](_[_0x9387('0x4e')](_0x5133e8[_0x9387('0x33')],_0x4fde33[_0x9387('0x34')]));if(_0x5133e8[_0x9387('0x33')][_0x9387('0x3e')]){_0x5e39bd[_0x9387('0x3d')]=_[_0x9387('0x3f')](_0x5e39bd[_0x9387('0x3d')],{'$or':_[_0x9387('0x2e')](_0x5e39bd['attributes'],function(_0xee9c33){var _0x1c4ab0={};_0x1c4ab0[_0xee9c33]={'$like':'%'+_0x5133e8[_0x9387('0x33')]['filter']+'%'};return _0x1c4ab0;})});}_0x5e39bd=_[_0x9387('0x3f')]({},_0x5e39bd,_0x5133e8[_0x9387('0x42')]);return _0xf939f5[_0x9387('0x51')](_0x5e39bd);}})['then'](function(_0x3f6714){if(_0x3f6714){_0x4cacc9=_0x3f6714['length'];if(!_0x5133e8[_0x9387('0x33')][_0x9387('0x39')](_0x9387('0x3a'))){_0x5e39bd[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x5133e8[_0x9387('0x33')][_0x9387('0x23')]);_0x5e39bd[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x5133e8[_0x9387('0x33')][_0x9387('0x20')]);}return _0xf939f5[_0x9387('0x51')](_0x5e39bd);}})[_0x9387('0x29')](function(_0x4be591){if(_0x4be591){return _0x4be591?{'count':_0x4cacc9,'rows':_0x4be591}:null;}})['then'](respondWithResult(_0x24857d,null))[_0x9387('0x44')](handleError(_0x24857d,null));};exports[_0x9387('0x52')]=function(_0x36a140,_0x5b8034,_0x524ccd){var _0x554af6={};var _0x7d960c={};var _0x1c4b75;var _0x18e054;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x36a140[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x5b8034,null))[_0x9387('0x29')](function(_0x1d0862){if(_0x1d0862){_0x1c4b75=_0x1d0862;_0x7d960c['model']=_[_0x9387('0x50')](db[_0x9387('0x4d')]['rawAttributes']);_0x7d960c['query']=_[_0x9387('0x50')](_0x36a140['query']);_0x7d960c[_0x9387('0x34')]=_[_0x9387('0x35')](_0x7d960c[_0x9387('0x32')],_0x7d960c[_0x9387('0x33')]);_0x554af6[_0x9387('0x36')]=_['intersection'](_0x7d960c['model'],qs[_0x9387('0x37')](_0x36a140['query'][_0x9387('0x37')]));_0x554af6[_0x9387('0x36')]=_0x554af6[_0x9387('0x36')][_0x9387('0x38')]?_0x554af6[_0x9387('0x36')]:_0x7d960c[_0x9387('0x32')];_0x554af6['order']=qs[_0x9387('0x3c')](_0x36a140[_0x9387('0x33')][_0x9387('0x3c')]);_0x554af6[_0x9387('0x3d')]=qs[_0x9387('0x34')](_[_0x9387('0x4e')](_0x36a140[_0x9387('0x33')],_0x7d960c[_0x9387('0x34')]));if(_0x36a140[_0x9387('0x33')][_0x9387('0x3e')]){_0x554af6['where']=_[_0x9387('0x3f')](_0x554af6['where'],{'$or':_[_0x9387('0x2e')](_0x554af6[_0x9387('0x36')],function(_0x143d05){var _0x492493={};_0x492493[_0x143d05]={'$like':'%'+_0x36a140['query'][_0x9387('0x3e')]+'%'};return _0x492493;})});}_0x554af6=_[_0x9387('0x3f')]({},_0x554af6,_0x36a140[_0x9387('0x42')]);return _0x1c4b75[_0x9387('0x52')](_0x554af6);}})['then'](function(_0x3f84ae){if(_0x3f84ae){_0x18e054=_0x3f84ae['length'];if(!_0x36a140['query']['hasOwnProperty'](_0x9387('0x3a'))){_0x554af6['limit']=qs[_0x9387('0x23')](_0x36a140[_0x9387('0x33')][_0x9387('0x23')]);_0x554af6['offset']=qs['offset'](_0x36a140[_0x9387('0x33')][_0x9387('0x20')]);}return _0x1c4b75['getDescriptions'](_0x554af6);}})[_0x9387('0x29')](function(_0x46d6fa){if(_0x46d6fa){return _0x46d6fa?{'count':_0x18e054,'rows':_0x46d6fa}:null;}})[_0x9387('0x29')](respondWithResult(_0x5b8034,null))[_0x9387('0x44')](handleError(_0x5b8034,null));};exports[_0x9387('0x53')]=function(_0x1ad604,_0x2c4a08,_0x37c0b4){var _0x2ec217={};var _0x44f9fb={};var _0x444411;var _0x1ad963;return db['FreshdeskConfiguration'][_0x9387('0x4f')]({'where':{'id':_0x1ad604[_0x9387('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c4a08,null))[_0x9387('0x29')](function(_0x5ed394){if(_0x5ed394){_0x444411=_0x5ed394;_0x44f9fb[_0x9387('0x32')]=_['keys'](db[_0x9387('0x54')][_0x9387('0x46')]);_0x44f9fb[_0x9387('0x33')]=_['keys'](_0x1ad604[_0x9387('0x33')]);_0x44f9fb[_0x9387('0x34')]=_[_0x9387('0x35')](_0x44f9fb[_0x9387('0x32')],_0x44f9fb[_0x9387('0x33')]);_0x2ec217[_0x9387('0x36')]=_[_0x9387('0x35')](_0x44f9fb[_0x9387('0x32')],qs[_0x9387('0x37')](_0x1ad604['query'][_0x9387('0x37')]));_0x2ec217[_0x9387('0x36')]=_0x2ec217[_0x9387('0x36')][_0x9387('0x38')]?_0x2ec217[_0x9387('0x36')]:_0x44f9fb[_0x9387('0x32')];_0x2ec217['order']=qs[_0x9387('0x3c')](_0x1ad604[_0x9387('0x33')]['sort']);_0x2ec217[_0x9387('0x3d')]=qs['filters'](_[_0x9387('0x4e')](_0x1ad604['query'],_0x44f9fb['filters']));if(_0x1ad604['query'][_0x9387('0x3e')]){_0x2ec217['where']=_[_0x9387('0x3f')](_0x2ec217[_0x9387('0x3d')],{'$or':_['map'](_0x2ec217[_0x9387('0x36')],function(_0x3222eb){var _0x5298df={};_0x5298df[_0x3222eb]={'$like':'%'+_0x1ad604[_0x9387('0x33')]['filter']+'%'};return _0x5298df;})});}_0x2ec217=_[_0x9387('0x3f')]({},_0x2ec217,_0x1ad604[_0x9387('0x42')]);return _0x444411[_0x9387('0x53')](_0x2ec217);}})[_0x9387('0x29')](function(_0x4727e7){if(_0x4727e7){_0x1ad963=_0x4727e7[_0x9387('0x38')];if(!_0x1ad604['query'][_0x9387('0x39')](_0x9387('0x3a'))){_0x2ec217[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x1ad604[_0x9387('0x33')][_0x9387('0x23')]);_0x2ec217[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x1ad604[_0x9387('0x33')][_0x9387('0x20')]);}return _0x444411[_0x9387('0x53')](_0x2ec217);}})[_0x9387('0x29')](function(_0x47cf30){if(_0x47cf30){return _0x47cf30?{'count':_0x1ad963,'rows':_0x47cf30}:null;}})[_0x9387('0x29')](respondWithResult(_0x2c4a08,null))[_0x9387('0x44')](handleError(_0x2c4a08,null));};exports[_0x9387('0x55')]=function(_0x554786,_0x209f69,_0x1eaaf3){if(_0x554786['body']['id']){delete _0x554786[_0x9387('0x4b')]['id'];}return db[_0x9387('0x2f')][_0x9387('0x4f')]({'where':{'id':_0x554786[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x209f69,null))[_0x9387('0x29')](function(_0xe7ecea){if(_0xe7ecea){return _0xe7ecea[_0x9387('0x55')](_0x554786[_0x9387('0x4b')][_0x9387('0x56')]||[]);}return null;})[_0x9387('0x29')](respondWithResult(_0x209f69,null))[_0x9387('0x44')](handleError(_0x209f69,null));}; \ No newline at end of file +var _0x1897=['include','FreshdeskConfiguration','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','map','fieldName','type','key','model','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0xc6ab6a,_0x5daab6){var _0x1c1a52=function(_0x581c6e){while(--_0x581c6e){_0xc6ab6a['push'](_0xc6ab6a['shift']());}};_0x1c1a52(++_0x5daab6);}(_0x1897,0x162));var _0x7189=function(_0x2abb22,_0x29bcd0){_0x2abb22=_0x2abb22-0x0;var _0x569662=_0x1897[_0x2abb22];return _0x569662;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7189('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7189('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7189('0x2'));var Mustache=require(_0x7189('0x3'));var util=require(_0x7189('0x4'));var path=require(_0x7189('0x5'));var sox=require(_0x7189('0x6'));var csv=require('to-csv');var ejs=require(_0x7189('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7189('0x8'));var squel=require(_0x7189('0x9'));var crypto=require(_0x7189('0xa'));var jsforce=require(_0x7189('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7189('0xc'));var querystring=require(_0x7189('0xd'));var Papa=require(_0x7189('0xe'));var Redis=require(_0x7189('0xf'));var authService=require(_0x7189('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7189('0x11'));var logger=require(_0x7189('0x12'))(_0x7189('0x13'));var utils=require(_0x7189('0x14'));var config=require(_0x7189('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7189('0x16'))['db'];function respondWithStatusCode(_0x397a76,_0x325cbb){_0x325cbb=_0x325cbb||0xcc;return function(_0x573f8f){if(_0x573f8f){return _0x397a76[_0x7189('0x17')](_0x325cbb);}return _0x397a76['status'](_0x325cbb)[_0x7189('0x18')]();};}function respondWithResult(_0x26617e,_0x2cb6f2){_0x2cb6f2=_0x2cb6f2||0xc8;return function(_0x1027f1){if(_0x1027f1){return _0x26617e[_0x7189('0x19')](_0x2cb6f2)[_0x7189('0x1a')](_0x1027f1);}};}function respondWithFilteredResult(_0x39168d,_0x874adf){return function(_0x734f41){if(_0x734f41){var _0x292ad5=typeof _0x874adf[_0x7189('0x1b')]===_0x7189('0x1c')&&typeof _0x874adf[_0x7189('0x1d')]==='undefined';var _0x306643=_0x734f41[_0x7189('0x1e')];var _0x5f357e=_0x292ad5?0x0:_0x874adf[_0x7189('0x1b')];var _0x3caaf7=_0x292ad5?_0x734f41[_0x7189('0x1e')]:_0x874adf[_0x7189('0x1b')]+_0x874adf[_0x7189('0x1d')];var _0xddc9af;if(_0x3caaf7>=_0x306643){_0x3caaf7=_0x306643;_0xddc9af=0xc8;}else{_0xddc9af=0xce;}_0x39168d[_0x7189('0x19')](_0xddc9af);return _0x39168d[_0x7189('0x1f')](_0x7189('0x20'),_0x5f357e+'-'+_0x3caaf7+'/'+_0x306643)[_0x7189('0x1a')](_0x734f41);}return null;};}function patchUpdates(_0x54c6f7){return function(_0x4c38b3){try{jsonpatch[_0x7189('0x21')](_0x4c38b3,_0x54c6f7,!![]);}catch(_0x359345){return BPromise['reject'](_0x359345);}return _0x4c38b3[_0x7189('0x22')]();};}function saveUpdates(_0x16b485,_0x5f9447){return function(_0x2d52ec){if(_0x2d52ec){return _0x2d52ec['update'](_0x16b485)['then'](function(_0x2ac264){return _0x2ac264;});}return null;};}function removeEntity(_0x371e64,_0xe9fbde){return function(_0x25fb4c){if(_0x25fb4c){return _0x25fb4c['destroy']()[_0x7189('0x23')](function(){_0x371e64[_0x7189('0x19')](0xcc)[_0x7189('0x18')]();});}};}function handleEntityNotFound(_0x5135ae,_0x152413){return function(_0x3d388f){if(!_0x3d388f){_0x5135ae[_0x7189('0x17')](0x194);}return _0x3d388f;};}function handleError(_0x42afa9,_0x453720){_0x453720=_0x453720||0x1f4;return function(_0x56fec4){logger[_0x7189('0x24')](_0x56fec4[_0x7189('0x25')]);if(_0x56fec4[_0x7189('0x26')]){delete _0x56fec4['name'];}_0x42afa9[_0x7189('0x19')](_0x453720)['send'](_0x56fec4);};}exports['index']=function(_0x483bb6,_0x2c7867){var _0x3c43b5={},_0x710c64={},_0x54eecb={'count':0x0,'rows':[]};var _0x1e75a4=_[_0x7189('0x27')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x540591){return{'name':_0x540591[_0x7189('0x28')],'type':_0x540591[_0x7189('0x29')][_0x7189('0x2a')]};});_0x710c64[_0x7189('0x2b')]=_['map'](_0x1e75a4,_0x7189('0x26'));_0x710c64['query']=_['keys'](_0x483bb6['query']);_0x710c64[_0x7189('0x2c')]=_[_0x7189('0x2d')](_0x710c64[_0x7189('0x2b')],_0x710c64['query']);_0x3c43b5[_0x7189('0x2e')]=_[_0x7189('0x2d')](_0x710c64['model'],qs['fields'](_0x483bb6[_0x7189('0x2f')][_0x7189('0x30')]));_0x3c43b5[_0x7189('0x2e')]=_0x3c43b5['attributes'][_0x7189('0x31')]?_0x3c43b5[_0x7189('0x2e')]:_0x710c64[_0x7189('0x2b')];if(!_0x483bb6[_0x7189('0x2f')][_0x7189('0x32')](_0x7189('0x33'))){_0x3c43b5[_0x7189('0x1d')]=qs['limit'](_0x483bb6[_0x7189('0x2f')][_0x7189('0x1d')]);_0x3c43b5[_0x7189('0x1b')]=qs[_0x7189('0x1b')](_0x483bb6[_0x7189('0x2f')][_0x7189('0x1b')]);}_0x3c43b5[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x483bb6[_0x7189('0x2f')][_0x7189('0x35')]);_0x3c43b5[_0x7189('0x36')]=qs[_0x7189('0x2c')](_[_0x7189('0x37')](_0x483bb6[_0x7189('0x2f')],_0x710c64[_0x7189('0x2c')]),_0x1e75a4);if(_0x483bb6[_0x7189('0x2f')][_0x7189('0x38')]){_0x3c43b5[_0x7189('0x36')]=_[_0x7189('0x39')](_0x3c43b5[_0x7189('0x36')],{'$or':_[_0x7189('0x27')](_0x1e75a4,function(_0x12a5b6){if(_0x12a5b6[_0x7189('0x29')]!==_0x7189('0x3a')){var _0x2489e3={};_0x2489e3[_0x12a5b6[_0x7189('0x26')]]={'$like':'%'+_0x483bb6[_0x7189('0x2f')][_0x7189('0x38')]+'%'};return _0x2489e3;}})});}_0x3c43b5=_['merge']({},_0x3c43b5,_0x483bb6[_0x7189('0x3b')]);var _0x38c437={'where':_0x3c43b5[_0x7189('0x36')]};return db['FreshdeskConfiguration']['count'](_0x38c437)['then'](function(_0x387b51){_0x54eecb[_0x7189('0x1e')]=_0x387b51;if(_0x483bb6[_0x7189('0x2f')][_0x7189('0x3c')]){_0x3c43b5[_0x7189('0x3d')]=[{'all':!![]}];}return db[_0x7189('0x3e')][_0x7189('0x3f')](_0x3c43b5);})[_0x7189('0x23')](function(_0x1c0feb){_0x54eecb[_0x7189('0x40')]=_0x1c0feb;return _0x54eecb;})[_0x7189('0x23')](respondWithFilteredResult(_0x2c7867,_0x3c43b5))[_0x7189('0x41')](handleError(_0x2c7867,null));};exports[_0x7189('0x42')]=function(_0x341949,_0x58a5fc){var _0x45991e={'raw':![],'where':{'id':_0x341949[_0x7189('0x43')]['id']}},_0x9de06e={};_0x9de06e['model']=_[_0x7189('0x44')](db[_0x7189('0x3e')][_0x7189('0x45')]);_0x9de06e[_0x7189('0x2f')]=_[_0x7189('0x44')](_0x341949[_0x7189('0x2f')]);_0x9de06e[_0x7189('0x2c')]=_['intersection'](_0x9de06e[_0x7189('0x2b')],_0x9de06e[_0x7189('0x2f')]);_0x45991e['attributes']=_['intersection'](_0x9de06e[_0x7189('0x2b')],qs['fields'](_0x341949[_0x7189('0x2f')][_0x7189('0x30')]));_0x45991e[_0x7189('0x2e')]=_0x45991e[_0x7189('0x2e')][_0x7189('0x31')]?_0x45991e[_0x7189('0x2e')]:_0x9de06e[_0x7189('0x2b')];if(_0x341949['query'][_0x7189('0x3c')]){_0x45991e[_0x7189('0x3d')]=[{'all':!![]}];}_0x45991e=_[_0x7189('0x39')]({},_0x45991e,_0x341949['options']);return db[_0x7189('0x3e')][_0x7189('0x46')](_0x45991e)[_0x7189('0x23')](handleEntityNotFound(_0x58a5fc,null))[_0x7189('0x23')](respondWithResult(_0x58a5fc,null))[_0x7189('0x41')](handleError(_0x58a5fc,null));};exports[_0x7189('0x47')]=function(_0x31ac23,_0x5ab907){return db[_0x7189('0x3e')][_0x7189('0x47')](_0x31ac23[_0x7189('0x48')],{})[_0x7189('0x23')](respondWithResult(_0x5ab907,0xc9))[_0x7189('0x41')](handleError(_0x5ab907,null));};exports[_0x7189('0x49')]=function(_0x124a63,_0x2bbd9b){if(_0x124a63[_0x7189('0x48')]['id']){delete _0x124a63[_0x7189('0x48')]['id'];}return db[_0x7189('0x3e')][_0x7189('0x46')]({'where':{'id':_0x124a63[_0x7189('0x43')]['id']}})['then'](handleEntityNotFound(_0x2bbd9b,null))['then'](saveUpdates(_0x124a63['body'],null))[_0x7189('0x23')](respondWithResult(_0x2bbd9b,null))['catch'](handleError(_0x2bbd9b,null));};exports[_0x7189('0x4a')]=function(_0x3caee0,_0x5c2375){return db['FreshdeskConfiguration'][_0x7189('0x46')]({'where':{'id':_0x3caee0[_0x7189('0x43')]['id']}})[_0x7189('0x23')](handleEntityNotFound(_0x5c2375,null))[_0x7189('0x23')](removeEntity(_0x5c2375,null))[_0x7189('0x41')](handleError(_0x5c2375,null));};exports[_0x7189('0x4b')]=function(_0x5529ba,_0x34ab44,_0x3fe4af){var _0xffc43b={};var _0x3ecee5={};var _0x4f9b20;var _0x570b0e;return db['FreshdeskConfiguration'][_0x7189('0x4c')]({'where':{'id':_0x5529ba['params']['id']}})['then'](handleEntityNotFound(_0x34ab44,null))['then'](function(_0x4300d3){if(_0x4300d3){_0x4f9b20=_0x4300d3;_0x3ecee5[_0x7189('0x2b')]=_['keys'](db[_0x7189('0x4d')][_0x7189('0x45')]);_0x3ecee5[_0x7189('0x2f')]=_[_0x7189('0x44')](_0x5529ba[_0x7189('0x2f')]);_0x3ecee5[_0x7189('0x2c')]=_['intersection'](_0x3ecee5['model'],_0x3ecee5[_0x7189('0x2f')]);_0xffc43b[_0x7189('0x2e')]=_[_0x7189('0x2d')](_0x3ecee5['model'],qs[_0x7189('0x30')](_0x5529ba[_0x7189('0x2f')]['fields']));_0xffc43b['attributes']=_0xffc43b['attributes']['length']?_0xffc43b[_0x7189('0x2e')]:_0x3ecee5['model'];_0xffc43b[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x5529ba[_0x7189('0x2f')][_0x7189('0x35')]);_0xffc43b[_0x7189('0x36')]=qs[_0x7189('0x2c')](_['pick'](_0x5529ba[_0x7189('0x2f')],_0x3ecee5[_0x7189('0x2c')]));if(_0x5529ba[_0x7189('0x2f')][_0x7189('0x38')]){_0xffc43b['where']=_['merge'](_0xffc43b[_0x7189('0x36')],{'$or':_[_0x7189('0x27')](_0xffc43b[_0x7189('0x2e')],function(_0x58056c){var _0x1bed82={};_0x1bed82[_0x58056c]={'$like':'%'+_0x5529ba['query'][_0x7189('0x38')]+'%'};return _0x1bed82;})});}_0xffc43b=_[_0x7189('0x39')]({},_0xffc43b,_0x5529ba[_0x7189('0x3b')]);return _0x4f9b20[_0x7189('0x4b')](_0xffc43b);}})[_0x7189('0x23')](function(_0x226cea){if(_0x226cea){_0x570b0e=_0x226cea[_0x7189('0x31')];if(!_0x5529ba[_0x7189('0x2f')]['hasOwnProperty'](_0x7189('0x33'))){_0xffc43b[_0x7189('0x1d')]=qs[_0x7189('0x1d')](_0x5529ba[_0x7189('0x2f')]['limit']);_0xffc43b[_0x7189('0x1b')]=qs[_0x7189('0x1b')](_0x5529ba[_0x7189('0x2f')][_0x7189('0x1b')]);}return _0x4f9b20[_0x7189('0x4b')](_0xffc43b);}})[_0x7189('0x23')](function(_0x1d00c1){if(_0x1d00c1){return _0x1d00c1?{'count':_0x570b0e,'rows':_0x1d00c1}:null;}})[_0x7189('0x23')](respondWithResult(_0x34ab44,null))[_0x7189('0x41')](handleError(_0x34ab44,null));};exports[_0x7189('0x4e')]=function(_0x246384,_0x44e255,_0x45b1f0){var _0x4d0a9d={};var _0x1b1c73={};var _0x2cc217;var _0x14d3b4;return db[_0x7189('0x3e')][_0x7189('0x4c')]({'where':{'id':_0x246384[_0x7189('0x43')]['id']}})[_0x7189('0x23')](handleEntityNotFound(_0x44e255,null))[_0x7189('0x23')](function(_0x45a467){if(_0x45a467){_0x2cc217=_0x45a467;_0x1b1c73[_0x7189('0x2b')]=_['keys'](db[_0x7189('0x4d')][_0x7189('0x45')]);_0x1b1c73['query']=_[_0x7189('0x44')](_0x246384[_0x7189('0x2f')]);_0x1b1c73[_0x7189('0x2c')]=_[_0x7189('0x2d')](_0x1b1c73[_0x7189('0x2b')],_0x1b1c73['query']);_0x4d0a9d[_0x7189('0x2e')]=_[_0x7189('0x2d')](_0x1b1c73[_0x7189('0x2b')],qs[_0x7189('0x30')](_0x246384['query'][_0x7189('0x30')]));_0x4d0a9d['attributes']=_0x4d0a9d['attributes'][_0x7189('0x31')]?_0x4d0a9d[_0x7189('0x2e')]:_0x1b1c73[_0x7189('0x2b')];_0x4d0a9d[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x246384[_0x7189('0x2f')]['sort']);_0x4d0a9d[_0x7189('0x36')]=qs[_0x7189('0x2c')](_[_0x7189('0x37')](_0x246384[_0x7189('0x2f')],_0x1b1c73[_0x7189('0x2c')]));if(_0x246384[_0x7189('0x2f')]['filter']){_0x4d0a9d[_0x7189('0x36')]=_['merge'](_0x4d0a9d['where'],{'$or':_['map'](_0x4d0a9d[_0x7189('0x2e')],function(_0x59aab9){var _0x53b8ca={};_0x53b8ca[_0x59aab9]={'$like':'%'+_0x246384[_0x7189('0x2f')][_0x7189('0x38')]+'%'};return _0x53b8ca;})});}_0x4d0a9d=_[_0x7189('0x39')]({},_0x4d0a9d,_0x246384[_0x7189('0x3b')]);return _0x2cc217[_0x7189('0x4e')](_0x4d0a9d);}})[_0x7189('0x23')](function(_0x29a80b){if(_0x29a80b){_0x14d3b4=_0x29a80b[_0x7189('0x31')];if(!_0x246384[_0x7189('0x2f')][_0x7189('0x32')](_0x7189('0x33'))){_0x4d0a9d[_0x7189('0x1d')]=qs[_0x7189('0x1d')](_0x246384[_0x7189('0x2f')][_0x7189('0x1d')]);_0x4d0a9d[_0x7189('0x1b')]=qs['offset'](_0x246384[_0x7189('0x2f')]['offset']);}return _0x2cc217[_0x7189('0x4e')](_0x4d0a9d);}})[_0x7189('0x23')](function(_0x1e2781){if(_0x1e2781){return _0x1e2781?{'count':_0x14d3b4,'rows':_0x1e2781}:null;}})[_0x7189('0x23')](respondWithResult(_0x44e255,null))['catch'](handleError(_0x44e255,null));};exports[_0x7189('0x4f')]=function(_0x27ba31,_0x209e30,_0x4811fe){var _0x3fff12={};var _0x24f819={};var _0x4fb23e;var _0x1cd7fe;return db[_0x7189('0x3e')][_0x7189('0x4c')]({'where':{'id':_0x27ba31[_0x7189('0x43')]['id']}})['then'](handleEntityNotFound(_0x209e30,null))['then'](function(_0x378f8a){if(_0x378f8a){_0x4fb23e=_0x378f8a;_0x24f819['model']=_[_0x7189('0x44')](db['FreshdeskField'][_0x7189('0x45')]);_0x24f819[_0x7189('0x2f')]=_['keys'](_0x27ba31[_0x7189('0x2f')]);_0x24f819[_0x7189('0x2c')]=_[_0x7189('0x2d')](_0x24f819[_0x7189('0x2b')],_0x24f819[_0x7189('0x2f')]);_0x3fff12['attributes']=_[_0x7189('0x2d')](_0x24f819[_0x7189('0x2b')],qs[_0x7189('0x30')](_0x27ba31[_0x7189('0x2f')]['fields']));_0x3fff12[_0x7189('0x2e')]=_0x3fff12[_0x7189('0x2e')][_0x7189('0x31')]?_0x3fff12[_0x7189('0x2e')]:_0x24f819[_0x7189('0x2b')];_0x3fff12[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x27ba31[_0x7189('0x2f')][_0x7189('0x35')]);_0x3fff12[_0x7189('0x36')]=qs['filters'](_['pick'](_0x27ba31[_0x7189('0x2f')],_0x24f819[_0x7189('0x2c')]));if(_0x27ba31[_0x7189('0x2f')]['filter']){_0x3fff12[_0x7189('0x36')]=_['merge'](_0x3fff12[_0x7189('0x36')],{'$or':_[_0x7189('0x27')](_0x3fff12[_0x7189('0x2e')],function(_0x11f01f){var _0x535539={};_0x535539[_0x11f01f]={'$like':'%'+_0x27ba31[_0x7189('0x2f')][_0x7189('0x38')]+'%'};return _0x535539;})});}_0x3fff12=_[_0x7189('0x39')]({},_0x3fff12,_0x27ba31['options']);return _0x4fb23e[_0x7189('0x4f')](_0x3fff12);}})[_0x7189('0x23')](function(_0x328308){if(_0x328308){_0x1cd7fe=_0x328308[_0x7189('0x31')];if(!_0x27ba31[_0x7189('0x2f')][_0x7189('0x32')](_0x7189('0x33'))){_0x3fff12[_0x7189('0x1d')]=qs[_0x7189('0x1d')](_0x27ba31[_0x7189('0x2f')][_0x7189('0x1d')]);_0x3fff12[_0x7189('0x1b')]=qs[_0x7189('0x1b')](_0x27ba31[_0x7189('0x2f')][_0x7189('0x1b')]);}return _0x4fb23e[_0x7189('0x4f')](_0x3fff12);}})[_0x7189('0x23')](function(_0x1c9df4){if(_0x1c9df4){return _0x1c9df4?{'count':_0x1cd7fe,'rows':_0x1c9df4}:null;}})['then'](respondWithResult(_0x209e30,null))[_0x7189('0x41')](handleError(_0x209e30,null));};exports[_0x7189('0x50')]=function(_0x4cbff5,_0x352749,_0x41f499){var _0x320003={};var _0x3099ec={};var _0x1dde9d;var _0xfab59b;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4cbff5[_0x7189('0x43')]['id']}})['then'](handleEntityNotFound(_0x352749,null))[_0x7189('0x23')](function(_0x3d87b6){if(_0x3d87b6){_0x1dde9d=_0x3d87b6;_0x3099ec[_0x7189('0x2b')]=_[_0x7189('0x44')](db['Tag'][_0x7189('0x45')]);_0x3099ec[_0x7189('0x2f')]=_['keys'](_0x4cbff5[_0x7189('0x2f')]);_0x3099ec[_0x7189('0x2c')]=_[_0x7189('0x2d')](_0x3099ec['model'],_0x3099ec[_0x7189('0x2f')]);_0x320003['attributes']=_[_0x7189('0x2d')](_0x3099ec[_0x7189('0x2b')],qs[_0x7189('0x30')](_0x4cbff5[_0x7189('0x2f')][_0x7189('0x30')]));_0x320003[_0x7189('0x2e')]=_0x320003['attributes']['length']?_0x320003[_0x7189('0x2e')]:_0x3099ec[_0x7189('0x2b')];_0x320003[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x4cbff5['query']['sort']);_0x320003[_0x7189('0x36')]=qs['filters'](_[_0x7189('0x37')](_0x4cbff5[_0x7189('0x2f')],_0x3099ec[_0x7189('0x2c')]));if(_0x4cbff5[_0x7189('0x2f')][_0x7189('0x38')]){_0x320003[_0x7189('0x36')]=_[_0x7189('0x39')](_0x320003['where'],{'$or':_[_0x7189('0x27')](_0x320003[_0x7189('0x2e')],function(_0x4603cf){var _0x3834de={};_0x3834de[_0x4603cf]={'$like':'%'+_0x4cbff5[_0x7189('0x2f')][_0x7189('0x38')]+'%'};return _0x3834de;})});}_0x320003=_[_0x7189('0x39')]({},_0x320003,_0x4cbff5['options']);return _0x1dde9d[_0x7189('0x50')](_0x320003);}})['then'](function(_0x38ec9c){if(_0x38ec9c){_0xfab59b=_0x38ec9c[_0x7189('0x31')];if(!_0x4cbff5[_0x7189('0x2f')]['hasOwnProperty'](_0x7189('0x33'))){_0x320003[_0x7189('0x1d')]=qs[_0x7189('0x1d')](_0x4cbff5[_0x7189('0x2f')][_0x7189('0x1d')]);_0x320003[_0x7189('0x1b')]=qs['offset'](_0x4cbff5[_0x7189('0x2f')][_0x7189('0x1b')]);}return _0x1dde9d[_0x7189('0x50')](_0x320003);}})[_0x7189('0x23')](function(_0x3be4e9){if(_0x3be4e9){return _0x3be4e9?{'count':_0xfab59b,'rows':_0x3be4e9}:null;}})[_0x7189('0x23')](respondWithResult(_0x352749,null))[_0x7189('0x41')](handleError(_0x352749,null));};exports[_0x7189('0x51')]=function(_0x1826c1,_0x3138f3,_0x18ad08){if(_0x1826c1['body']['id']){delete _0x1826c1[_0x7189('0x48')]['id'];}return db[_0x7189('0x3e')][_0x7189('0x4c')]({'where':{'id':_0x1826c1['params']['id']}})[_0x7189('0x23')](handleEntityNotFound(_0x3138f3,null))[_0x7189('0x23')](function(_0x431934){if(_0x431934){return _0x431934[_0x7189('0x51')](_0x1826c1[_0x7189('0x48')][_0x7189('0x52')]||[]);}return null;})[_0x7189('0x23')](respondWithResult(_0x3138f3,null))[_0x7189('0x41')](handleError(_0x3138f3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f0f0238..1166a1e 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 _0xfb4b=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x358769,_0x400363){var _0x20dce3=function(_0x25f238){while(--_0x25f238){_0x358769['push'](_0x358769['shift']());}};_0x20dce3(++_0x400363);}(_0xfb4b,0x1ac));var _0xbfb4=function(_0xab10a1,_0x2e5f39){_0xab10a1=_0xab10a1-0x0;var _0xf410d6=_0xfb4b[_0xab10a1];return _0xf410d6;};'use strict';var _=require(_0xbfb4('0x0'));var util=require(_0xbfb4('0x1'));var logger=require(_0xbfb4('0x2'))(_0xbfb4('0x3'));var moment=require(_0xbfb4('0x4'));var BPromise=require(_0xbfb4('0x5'));var rp=require(_0xbfb4('0x6'));var fs=require('fs');var path=require(_0xbfb4('0x7'));var rimraf=require('rimraf');var config=require(_0xbfb4('0x8'));var attributes=require(_0xbfb4('0x9'));module[_0xbfb4('0xa')]=function(_0xdcc1ad,_0x10ecb4){return _0xdcc1ad['define'](_0xbfb4('0xb'),attributes,{'tableName':_0xbfb4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7a3=['request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','bluebird'];(function(_0x1a568e,_0x2ad34b){var _0xd0dc04=function(_0x59e021){while(--_0x59e021){_0x1a568e['push'](_0x1a568e['shift']());}};_0xd0dc04(++_0x2ad34b);}(_0xb7a3,0x1dc));var _0x3b7a=function(_0x23da1a,_0x141ec1){_0x23da1a=_0x23da1a-0x0;var _0x2d0a7c=_0xb7a3[_0x23da1a];return _0x2d0a7c;};'use strict';var _=require(_0x3b7a('0x0'));var util=require(_0x3b7a('0x1'));var logger=require('../../config/logger')(_0x3b7a('0x2'));var moment=require('moment');var BPromise=require(_0x3b7a('0x3'));var rp=require(_0x3b7a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b7a('0x5'));var config=require(_0x3b7a('0x6'));var attributes=require(_0x3b7a('0x7'));module[_0x3b7a('0x8')]=function(_0x48f492,_0x5af3d1){return _0x48f492[_0x3b7a('0x9')](_0x3b7a('0xa'),attributes,{'tableName':_0x3b7a('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 a5877b2..fce1182 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 _0x5d96=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util'];(function(_0x38cbbf,_0x5da053){var _0x208b6a=function(_0x1cb977){while(--_0x1cb977){_0x38cbbf['push'](_0x38cbbf['shift']());}};_0x208b6a(++_0x5da053);}(_0x5d96,0xa6));var _0x65d9=function(_0x421752,_0x20f492){_0x421752=_0x421752-0x0;var _0x23ed3e=_0x5d96[_0x421752];return _0x23ed3e;};'use strict';var _=require(_0x65d9('0x0'));var util=require(_0x65d9('0x1'));var moment=require(_0x65d9('0x2'));var BPromise=require(_0x65d9('0x3'));var rs=require(_0x65d9('0x4'));var fs=require('fs');var Redis=require(_0x65d9('0x5'));var db=require(_0x65d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x65d9('0x7'))(_0x65d9('0x8'));var config=require(_0x65d9('0x9'));var jayson=require(_0x65d9('0xa'));var client=jayson[_0x65d9('0xb')][_0x65d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40ebe1,_0x3c6aab,_0x335736){return new BPromise(function(_0x39d32d,_0x315af5){return client[_0x65d9('0xd')](_0x40ebe1,_0x335736)[_0x65d9('0xe')](function(_0x182e42){logger[_0x65d9('0xf')](_0x65d9('0x10'),_0x3c6aab,'request\x20sent');logger[_0x65d9('0x11')](_0x65d9('0x12'),_0x3c6aab,_0x65d9('0x13'),JSON[_0x65d9('0x14')](_0x182e42));if(_0x182e42[_0x65d9('0x15')]){if(_0x182e42[_0x65d9('0x15')]['code']===0x1f4){logger[_0x65d9('0x15')](_0x65d9('0x10'),_0x3c6aab,_0x182e42[_0x65d9('0x15')][_0x65d9('0x16')]);return _0x315af5(_0x182e42['error']['message']);}logger[_0x65d9('0x15')](_0x65d9('0x10'),_0x3c6aab,_0x182e42['error'][_0x65d9('0x16')]);return _0x39d32d(_0x182e42[_0x65d9('0x15')][_0x65d9('0x16')]);}else{logger[_0x65d9('0xf')](_0x65d9('0x10'),_0x3c6aab,_0x65d9('0x13'));_0x39d32d(_0x182e42[_0x65d9('0x17')]['message']);}})['catch'](function(_0x265b7d){logger[_0x65d9('0x15')](_0x65d9('0x10'),_0x3c6aab,_0x265b7d);_0x315af5(_0x265b7d);});});} \ No newline at end of file +var _0x2c22=['info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','client','request'];(function(_0x1bf36c,_0x43826c){var _0x2039fd=function(_0x413835){while(--_0x413835){_0x1bf36c['push'](_0x1bf36c['shift']());}};_0x2039fd(++_0x43826c);}(_0x2c22,0xd0));var _0x22c2=function(_0x16246f,_0x3ccb03){_0x16246f=_0x16246f-0x0;var _0x2660e9=_0x2c22[_0x16246f];return _0x2660e9;};'use strict';var _=require(_0x22c2('0x0'));var util=require(_0x22c2('0x1'));var moment=require(_0x22c2('0x2'));var BPromise=require(_0x22c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22c2('0x4'));var db=require(_0x22c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x22c2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x466fb0,_0x5cd218,_0x46fdb0){return new BPromise(function(_0x4f50ba,_0x2bf5e8){return client[_0x22c2('0x7')](_0x466fb0,_0x46fdb0)['then'](function(_0x3cf895){logger[_0x22c2('0x8')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5cd218,_0x22c2('0x9'));logger[_0x22c2('0xa')](_0x22c2('0xb'),_0x5cd218,_0x22c2('0x9'),JSON['stringify'](_0x3cf895));if(_0x3cf895[_0x22c2('0xc')]){if(_0x3cf895[_0x22c2('0xc')][_0x22c2('0xd')]===0x1f4){logger[_0x22c2('0xc')](_0x22c2('0xe'),_0x5cd218,_0x3cf895[_0x22c2('0xc')][_0x22c2('0xf')]);return _0x2bf5e8(_0x3cf895[_0x22c2('0xc')][_0x22c2('0xf')]);}logger[_0x22c2('0xc')](_0x22c2('0xe'),_0x5cd218,_0x3cf895[_0x22c2('0xc')][_0x22c2('0xf')]);return _0x4f50ba(_0x3cf895[_0x22c2('0xc')]['message']);}else{logger[_0x22c2('0x8')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5cd218,_0x22c2('0x9'));_0x4f50ba(_0x3cf895[_0x22c2('0x10')][_0x22c2('0xf')]);}})[_0x22c2('0x11')](function(_0x1074ea){logger['error'](_0x22c2('0xe'),_0x5cd218,_0x1074ea);_0x2bf5e8(_0x1074ea);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8097575..41c3517 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 _0x9c4f=['/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x54691e,_0x28b041){var _0x5520b2=function(_0x501a05){while(--_0x501a05){_0x54691e['push'](_0x54691e['shift']());}};_0x5520b2(++_0x28b041);}(_0x9c4f,0x168));var _0xf9c4=function(_0x1e2057,_0x5076ec){_0x1e2057=_0x1e2057-0x0;var _0x2ec031=_0x9c4f[_0x1e2057];return _0x2ec031;};'use strict';var multer=require(_0xf9c4('0x0'));var util=require(_0xf9c4('0x1'));var path=require('path');var timeout=require(_0xf9c4('0x2'));var express=require(_0xf9c4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf9c4('0x4'));var interaction=require(_0xf9c4('0x5'));var config=require(_0xf9c4('0x6'));var controller=require(_0xf9c4('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf9c4('0x8'),auth['isAuthenticated'](),controller[_0xf9c4('0x9')]);router[_0xf9c4('0xa')]('/',auth[_0xf9c4('0xb')](),controller[_0xf9c4('0xc')]);router['put'](_0xf9c4('0x8'),auth['isAuthenticated'](),controller[_0xf9c4('0xd')]);router[_0xf9c4('0xe')](_0xf9c4('0x8'),auth[_0xf9c4('0xb')](),controller[_0xf9c4('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9fef=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','show','create','update','delete','destroy','exports','multer','util'];(function(_0x3692a3,_0x1d59ad){var _0x299bd1=function(_0x3b043e){while(--_0x3b043e){_0x3692a3['push'](_0x3692a3['shift']());}};_0x299bd1(++_0x1d59ad);}(_0x9fef,0xe2));var _0xf9fe=function(_0x2a2b9d,_0x29ad81){_0x2a2b9d=_0x2a2b9d-0x0;var _0x314b2d=_0x9fef[_0x2a2b9d];return _0x314b2d;};'use strict';var multer=require(_0xf9fe('0x0'));var util=require(_0xf9fe('0x1'));var path=require(_0xf9fe('0x2'));var timeout=require(_0xf9fe('0x3'));var express=require(_0xf9fe('0x4'));var router=express[_0xf9fe('0x5')]();var fs_extra=require(_0xf9fe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf9fe('0x7'));var config=require(_0xf9fe('0x8'));var controller=require(_0xf9fe('0x9'));router['get']('/',auth[_0xf9fe('0xa')](),controller[_0xf9fe('0xb')]);router[_0xf9fe('0xc')]('/:id',auth[_0xf9fe('0xa')](),controller[_0xf9fe('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf9fe('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf9fe('0xf')]);router[_0xf9fe('0x10')]('/:id',auth[_0xf9fe('0xa')](),controller[_0xf9fe('0x11')]);module[_0xf9fe('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 30ba17e..b3b073e 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 _0x62d5=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x62d5,0x123));var _0x562d=function(_0xd6f5eb,_0x15ac61){_0xd6f5eb=_0xd6f5eb-0x0;var _0x572c12=_0x62d5[_0xd6f5eb];return _0x572c12;};'use strict';var Sequelize=require(_0x562d('0x0'));module[_0x562d('0x1')]={'type':{'type':Sequelize[_0x562d('0x2')](_0x562d('0x3'),'variable',_0x562d('0x4'),_0x562d('0x5'),'picklist'),'defaultValue':_0x562d('0x3')},'content':{'type':Sequelize[_0x562d('0x6')]},'key':{'type':Sequelize[_0x562d('0x6')]},'keyType':{'type':Sequelize[_0x562d('0x2')](_0x562d('0x3'),_0x562d('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x562d('0x6')]},'idField':{'type':Sequelize[_0x562d('0x6')]},'nameField':{'type':Sequelize[_0x562d('0x6')]},'customField':{'type':Sequelize[_0x562d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x562d('0x6')]}}; \ No newline at end of file +var _0x2b94=['ENUM','string','variable','customVariable','STRING','BOOLEAN','exports'];(function(_0x230797,_0x2db929){var _0x39fe26=function(_0x44cc5e){while(--_0x44cc5e){_0x230797['push'](_0x230797['shift']());}};_0x39fe26(++_0x2db929);}(_0x2b94,0xdf));var _0x42b9=function(_0x2d104f,_0x18801f){_0x2d104f=_0x2d104f-0x0;var _0x26f829=_0x2b94[_0x2d104f];return _0x26f829;};'use strict';var Sequelize=require('sequelize');module[_0x42b9('0x0')]={'type':{'type':Sequelize[_0x42b9('0x1')](_0x42b9('0x2'),_0x42b9('0x3'),_0x42b9('0x4'),'keyValue','picklist'),'defaultValue':_0x42b9('0x2')},'content':{'type':Sequelize[_0x42b9('0x5')]},'key':{'type':Sequelize[_0x42b9('0x5')]},'keyType':{'type':Sequelize[_0x42b9('0x1')](_0x42b9('0x2'),_0x42b9('0x3'),_0x42b9('0x4'))},'keyContent':{'type':Sequelize[_0x42b9('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x42b9('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x42b9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index efaeacd..23460d1 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 _0x777d=['send','index','map','FreshdeskField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','limit','sort','pick','merge','where','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','update','then','destroy','error','name'];(function(_0x58dec1,_0x548ada){var _0x141df6=function(_0x5072e1){while(--_0x5072e1){_0x58dec1['push'](_0x58dec1['shift']());}};_0x141df6(++_0x548ada);}(_0x777d,0xe9));var _0xd777=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x777d[_0x1d1963];return _0x3f58bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd777('0x0'));var zipdir=require(_0xd777('0x1'));var jsonpatch=require(_0xd777('0x2'));var rp=require('request-promise');var moment=require(_0xd777('0x3'));var BPromise=require(_0xd777('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd777('0x5'));var csv=require('to-csv');var ejs=require(_0xd777('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd777('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd777('0x8'));var toCsv=require(_0xd777('0x9'));var querystring=require(_0xd777('0xa'));var Papa=require(_0xd777('0xb'));var Redis=require(_0xd777('0xc'));var authService=require(_0xd777('0xd'));var qs=require(_0xd777('0xe'));var as=require(_0xd777('0xf'));var hardwareService=require(_0xd777('0x10'));var logger=require(_0xd777('0x11'))(_0xd777('0x12'));var utils=require(_0xd777('0x13'));var config=require(_0xd777('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25f574,_0x560778){_0x560778=_0x560778||0xcc;return function(_0x2cc3e7){if(_0x2cc3e7){return _0x25f574[_0xd777('0x15')](_0x560778);}return _0x25f574[_0xd777('0x16')](_0x560778)[_0xd777('0x17')]();};}function respondWithResult(_0x2ac82f,_0x5d0ded){_0x5d0ded=_0x5d0ded||0xc8;return function(_0x84141c){if(_0x84141c){return _0x2ac82f['status'](_0x5d0ded)[_0xd777('0x18')](_0x84141c);}};}function respondWithFilteredResult(_0x2cd014,_0x1e5ecb){return function(_0x1ef016){if(_0x1ef016){var _0x25e3f2=typeof _0x1e5ecb['offset']===_0xd777('0x19')&&typeof _0x1e5ecb['limit']===_0xd777('0x19');var _0x4dcaed=_0x1ef016[_0xd777('0x1a')];var _0x386f1a=_0x25e3f2?0x0:_0x1e5ecb[_0xd777('0x1b')];var _0x13b63b=_0x25e3f2?_0x1ef016[_0xd777('0x1a')]:_0x1e5ecb[_0xd777('0x1b')]+_0x1e5ecb['limit'];var _0x4d6100;if(_0x13b63b>=_0x4dcaed){_0x13b63b=_0x4dcaed;_0x4d6100=0xc8;}else{_0x4d6100=0xce;}_0x2cd014[_0xd777('0x16')](_0x4d6100);return _0x2cd014['set'](_0xd777('0x1c'),_0x386f1a+'-'+_0x13b63b+'/'+_0x4dcaed)['json'](_0x1ef016);}return null;};}function patchUpdates(_0x58a079){return function(_0x5b2204){try{jsonpatch[_0xd777('0x1d')](_0x5b2204,_0x58a079,!![]);}catch(_0x4e53ed){return BPromise['reject'](_0x4e53ed);}return _0x5b2204['save']();};}function saveUpdates(_0x48d18c,_0x55b975){return function(_0x8cfb5a){if(_0x8cfb5a){return _0x8cfb5a[_0xd777('0x1e')](_0x48d18c)[_0xd777('0x1f')](function(_0x343405){return _0x343405;});}return null;};}function removeEntity(_0xfebc2f,_0x33c3d4){return function(_0x2ff8d3){if(_0x2ff8d3){return _0x2ff8d3[_0xd777('0x20')]()[_0xd777('0x1f')](function(){_0xfebc2f[_0xd777('0x16')](0xcc)[_0xd777('0x17')]();});}};}function handleEntityNotFound(_0x56af61,_0x373646){return function(_0x63e5c1){if(!_0x63e5c1){_0x56af61[_0xd777('0x15')](0x194);}return _0x63e5c1;};}function handleError(_0x15f1fd,_0x184ff6){_0x184ff6=_0x184ff6||0x1f4;return function(_0x5e32de){logger[_0xd777('0x21')](_0x5e32de['stack']);if(_0x5e32de['name']){delete _0x5e32de[_0xd777('0x22')];}_0x15f1fd[_0xd777('0x16')](_0x184ff6)[_0xd777('0x23')](_0x5e32de);};}exports[_0xd777('0x24')]=function(_0x4c941c,_0x453b45){var _0x141baa={},_0x4f93eb={},_0x1975e2={'count':0x0,'rows':[]};var _0xb63cf7=_[_0xd777('0x25')](db[_0xd777('0x26')][_0xd777('0x27')],function(_0x508587){return{'name':_0x508587[_0xd777('0x28')],'type':_0x508587['type']['key']};});_0x4f93eb[_0xd777('0x29')]=_[_0xd777('0x25')](_0xb63cf7,_0xd777('0x22'));_0x4f93eb[_0xd777('0x2a')]=_['keys'](_0x4c941c['query']);_0x4f93eb[_0xd777('0x2b')]=_[_0xd777('0x2c')](_0x4f93eb[_0xd777('0x29')],_0x4f93eb[_0xd777('0x2a')]);_0x141baa[_0xd777('0x2d')]=_[_0xd777('0x2c')](_0x4f93eb['model'],qs['fields'](_0x4c941c[_0xd777('0x2a')][_0xd777('0x2e')]));_0x141baa[_0xd777('0x2d')]=_0x141baa[_0xd777('0x2d')][_0xd777('0x2f')]?_0x141baa[_0xd777('0x2d')]:_0x4f93eb[_0xd777('0x29')];if(!_0x4c941c[_0xd777('0x2a')]['hasOwnProperty']('nolimit')){_0x141baa[_0xd777('0x30')]=qs['limit'](_0x4c941c[_0xd777('0x2a')][_0xd777('0x30')]);_0x141baa[_0xd777('0x1b')]=qs[_0xd777('0x1b')](_0x4c941c['query'][_0xd777('0x1b')]);}_0x141baa['order']=qs[_0xd777('0x31')](_0x4c941c['query']['sort']);_0x141baa['where']=qs['filters'](_[_0xd777('0x32')](_0x4c941c[_0xd777('0x2a')],_0x4f93eb[_0xd777('0x2b')]),_0xb63cf7);if(_0x4c941c['query']['filter']){_0x141baa['where']=_[_0xd777('0x33')](_0x141baa[_0xd777('0x34')],{'$or':_[_0xd777('0x25')](_0xb63cf7,function(_0x471bfd){if(_0x471bfd[_0xd777('0x35')]!==_0xd777('0x36')){var _0xf496bb={};_0xf496bb[_0x471bfd[_0xd777('0x22')]]={'$like':'%'+_0x4c941c[_0xd777('0x2a')][_0xd777('0x37')]+'%'};return _0xf496bb;}})});}_0x141baa=_['merge']({},_0x141baa,_0x4c941c[_0xd777('0x38')]);var _0x11a5f7={'where':_0x141baa[_0xd777('0x34')]};return db[_0xd777('0x26')][_0xd777('0x1a')](_0x11a5f7)[_0xd777('0x1f')](function(_0x3356c2){_0x1975e2[_0xd777('0x1a')]=_0x3356c2;if(_0x4c941c[_0xd777('0x2a')][_0xd777('0x39')]){_0x141baa[_0xd777('0x3a')]=[{'all':!![]}];}return db[_0xd777('0x26')]['findAll'](_0x141baa);})[_0xd777('0x1f')](function(_0x52b3d0){_0x1975e2[_0xd777('0x3b')]=_0x52b3d0;return _0x1975e2;})[_0xd777('0x1f')](respondWithFilteredResult(_0x453b45,_0x141baa))[_0xd777('0x3c')](handleError(_0x453b45,null));};exports[_0xd777('0x3d')]=function(_0x149329,_0x11d654){var _0x4af057={'raw':!![],'where':{'id':_0x149329[_0xd777('0x3e')]['id']}},_0x3dd8af={};_0x3dd8af[_0xd777('0x29')]=_['keys'](db[_0xd777('0x26')][_0xd777('0x27')]);_0x3dd8af[_0xd777('0x2a')]=_[_0xd777('0x3f')](_0x149329[_0xd777('0x2a')]);_0x3dd8af[_0xd777('0x2b')]=_[_0xd777('0x2c')](_0x3dd8af['model'],_0x3dd8af[_0xd777('0x2a')]);_0x4af057[_0xd777('0x2d')]=_['intersection'](_0x3dd8af['model'],qs[_0xd777('0x2e')](_0x149329[_0xd777('0x2a')][_0xd777('0x2e')]));_0x4af057[_0xd777('0x2d')]=_0x4af057[_0xd777('0x2d')][_0xd777('0x2f')]?_0x4af057[_0xd777('0x2d')]:_0x3dd8af[_0xd777('0x29')];if(_0x149329[_0xd777('0x2a')][_0xd777('0x39')]){_0x4af057[_0xd777('0x3a')]=[{'all':!![]}];}_0x4af057=_['merge']({},_0x4af057,_0x149329[_0xd777('0x38')]);return db[_0xd777('0x26')][_0xd777('0x40')](_0x4af057)['then'](handleEntityNotFound(_0x11d654,null))['then'](respondWithResult(_0x11d654,null))[_0xd777('0x3c')](handleError(_0x11d654,null));};exports[_0xd777('0x41')]=function(_0x26d5d7,_0x281d1d){return db[_0xd777('0x26')][_0xd777('0x41')](_0x26d5d7[_0xd777('0x42')],{})[_0xd777('0x1f')](respondWithResult(_0x281d1d,0xc9))['catch'](handleError(_0x281d1d,null));};exports[_0xd777('0x1e')]=function(_0x559232,_0x4c059d){if(_0x559232[_0xd777('0x42')]['id']){delete _0x559232[_0xd777('0x42')]['id'];}return db['FreshdeskField'][_0xd777('0x40')]({'where':{'id':_0x559232[_0xd777('0x3e')]['id']}})[_0xd777('0x1f')](handleEntityNotFound(_0x4c059d,null))[_0xd777('0x1f')](saveUpdates(_0x559232['body'],null))['then'](respondWithResult(_0x4c059d,null))[_0xd777('0x3c')](handleError(_0x4c059d,null));};exports['destroy']=function(_0x45b806,_0x24779c){return db[_0xd777('0x26')][_0xd777('0x40')]({'where':{'id':_0x45b806[_0xd777('0x3e')]['id']}})['then'](handleEntityNotFound(_0x24779c,null))[_0xd777('0x1f')](removeEntity(_0x24779c,null))[_0xd777('0x3c')](handleError(_0x24779c,null));}; \ No newline at end of file +var _0x222f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x222f,0x1a4));var _0xf222=function(_0x342ca3,_0x31db47){_0x342ca3=_0x342ca3-0x0;var _0x580f2d=_0x222f[_0x342ca3];return _0x580f2d;};'use strict';var emlformat=require(_0xf222('0x0'));var rimraf=require(_0xf222('0x1'));var zipdir=require(_0xf222('0x2'));var jsonpatch=require(_0xf222('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf222('0x4'));var Mustache=require(_0xf222('0x5'));var util=require(_0xf222('0x6'));var path=require(_0xf222('0x7'));var sox=require('sox');var csv=require(_0xf222('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf222('0x9'));var _=require(_0xf222('0xa'));var squel=require('squel');var crypto=require(_0xf222('0xb'));var jsforce=require(_0xf222('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf222('0x8'));var querystring=require(_0xf222('0xd'));var Papa=require(_0xf222('0xe'));var Redis=require(_0xf222('0xf'));var authService=require(_0xf222('0x10'));var qs=require(_0xf222('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf222('0x12'));var logger=require(_0xf222('0x13'))(_0xf222('0x14'));var utils=require(_0xf222('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf222('0x16'));var db=require(_0xf222('0x17'))['db'];function respondWithStatusCode(_0x2a6965,_0x3d3d29){_0x3d3d29=_0x3d3d29||0xcc;return function(_0x12f968){if(_0x12f968){return _0x2a6965[_0xf222('0x18')](_0x3d3d29);}return _0x2a6965[_0xf222('0x19')](_0x3d3d29)[_0xf222('0x1a')]();};}function respondWithResult(_0x52a003,_0x5b8f97){_0x5b8f97=_0x5b8f97||0xc8;return function(_0x1feb86){if(_0x1feb86){return _0x52a003[_0xf222('0x19')](_0x5b8f97)['json'](_0x1feb86);}};}function respondWithFilteredResult(_0x39be58,_0x43d35b){return function(_0x464f3e){if(_0x464f3e){var _0x4392a0=typeof _0x43d35b[_0xf222('0x1b')]===_0xf222('0x1c')&&typeof _0x43d35b[_0xf222('0x1d')]==='undefined';var _0x1efa9f=_0x464f3e[_0xf222('0x1e')];var _0x8783ab=_0x4392a0?0x0:_0x43d35b[_0xf222('0x1b')];var _0x12a2e4=_0x4392a0?_0x464f3e[_0xf222('0x1e')]:_0x43d35b[_0xf222('0x1b')]+_0x43d35b['limit'];var _0xf26a16;if(_0x12a2e4>=_0x1efa9f){_0x12a2e4=_0x1efa9f;_0xf26a16=0xc8;}else{_0xf26a16=0xce;}_0x39be58[_0xf222('0x19')](_0xf26a16);return _0x39be58[_0xf222('0x1f')](_0xf222('0x20'),_0x8783ab+'-'+_0x12a2e4+'/'+_0x1efa9f)['json'](_0x464f3e);}return null;};}function patchUpdates(_0x5cd899){return function(_0x398ff4){try{jsonpatch[_0xf222('0x21')](_0x398ff4,_0x5cd899,!![]);}catch(_0x201cf0){return BPromise[_0xf222('0x22')](_0x201cf0);}return _0x398ff4[_0xf222('0x23')]();};}function saveUpdates(_0x151a89,_0x51b872){return function(_0x176b20){if(_0x176b20){return _0x176b20[_0xf222('0x24')](_0x151a89)[_0xf222('0x25')](function(_0x12d443){return _0x12d443;});}return null;};}function removeEntity(_0x2c48ce,_0x2d18ab){return function(_0x4616de){if(_0x4616de){return _0x4616de[_0xf222('0x26')]()['then'](function(){_0x2c48ce[_0xf222('0x19')](0xcc)[_0xf222('0x1a')]();});}};}function handleEntityNotFound(_0x1883c1,_0x3fce26){return function(_0x4305e0){if(!_0x4305e0){_0x1883c1[_0xf222('0x18')](0x194);}return _0x4305e0;};}function handleError(_0x42616e,_0x263dc2){_0x263dc2=_0x263dc2||0x1f4;return function(_0x15bf4e){logger[_0xf222('0x27')](_0x15bf4e[_0xf222('0x28')]);if(_0x15bf4e['name']){delete _0x15bf4e[_0xf222('0x29')];}_0x42616e[_0xf222('0x19')](_0x263dc2)[_0xf222('0x2a')](_0x15bf4e);};}exports[_0xf222('0x2b')]=function(_0xe41039,_0x40a715){var _0x3789e0={},_0x1b928b={},_0x1e87ec={'count':0x0,'rows':[]};var _0x59721a=_[_0xf222('0x2c')](db[_0xf222('0x2d')][_0xf222('0x2e')],function(_0x53a382){return{'name':_0x53a382[_0xf222('0x2f')],'type':_0x53a382['type'][_0xf222('0x30')]};});_0x1b928b[_0xf222('0x31')]=_[_0xf222('0x2c')](_0x59721a,_0xf222('0x29'));_0x1b928b[_0xf222('0x32')]=_[_0xf222('0x33')](_0xe41039[_0xf222('0x32')]);_0x1b928b['filters']=_['intersection'](_0x1b928b[_0xf222('0x31')],_0x1b928b[_0xf222('0x32')]);_0x3789e0[_0xf222('0x34')]=_[_0xf222('0x35')](_0x1b928b[_0xf222('0x31')],qs[_0xf222('0x36')](_0xe41039['query'][_0xf222('0x36')]));_0x3789e0[_0xf222('0x34')]=_0x3789e0[_0xf222('0x34')]['length']?_0x3789e0[_0xf222('0x34')]:_0x1b928b[_0xf222('0x31')];if(!_0xe41039[_0xf222('0x32')]['hasOwnProperty'](_0xf222('0x37'))){_0x3789e0[_0xf222('0x1d')]=qs[_0xf222('0x1d')](_0xe41039['query'][_0xf222('0x1d')]);_0x3789e0[_0xf222('0x1b')]=qs[_0xf222('0x1b')](_0xe41039[_0xf222('0x32')][_0xf222('0x1b')]);}_0x3789e0['order']=qs[_0xf222('0x38')](_0xe41039['query'][_0xf222('0x38')]);_0x3789e0[_0xf222('0x39')]=qs[_0xf222('0x3a')](_['pick'](_0xe41039[_0xf222('0x32')],_0x1b928b[_0xf222('0x3a')]),_0x59721a);if(_0xe41039['query'][_0xf222('0x3b')]){_0x3789e0['where']=_[_0xf222('0x3c')](_0x3789e0[_0xf222('0x39')],{'$or':_[_0xf222('0x2c')](_0x59721a,function(_0x5c8b04){if(_0x5c8b04[_0xf222('0x3d')]!==_0xf222('0x3e')){var _0x2c1e49={};_0x2c1e49[_0x5c8b04[_0xf222('0x29')]]={'$like':'%'+_0xe41039[_0xf222('0x32')][_0xf222('0x3b')]+'%'};return _0x2c1e49;}})});}_0x3789e0=_['merge']({},_0x3789e0,_0xe41039[_0xf222('0x3f')]);var _0x24e8a5={'where':_0x3789e0['where']};return db['FreshdeskField'][_0xf222('0x1e')](_0x24e8a5)['then'](function(_0x2b20d3){_0x1e87ec[_0xf222('0x1e')]=_0x2b20d3;if(_0xe41039[_0xf222('0x32')][_0xf222('0x40')]){_0x3789e0['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xf222('0x41')](_0x3789e0);})['then'](function(_0x522a9e){_0x1e87ec[_0xf222('0x42')]=_0x522a9e;return _0x1e87ec;})[_0xf222('0x25')](respondWithFilteredResult(_0x40a715,_0x3789e0))[_0xf222('0x43')](handleError(_0x40a715,null));};exports[_0xf222('0x44')]=function(_0x10f065,_0x2af478){var _0x5c60e6={'raw':!![],'where':{'id':_0x10f065[_0xf222('0x45')]['id']}},_0xf829ae={};_0xf829ae['model']=_[_0xf222('0x33')](db[_0xf222('0x2d')]['rawAttributes']);_0xf829ae[_0xf222('0x32')]=_['keys'](_0x10f065[_0xf222('0x32')]);_0xf829ae[_0xf222('0x3a')]=_[_0xf222('0x35')](_0xf829ae[_0xf222('0x31')],_0xf829ae[_0xf222('0x32')]);_0x5c60e6[_0xf222('0x34')]=_[_0xf222('0x35')](_0xf829ae[_0xf222('0x31')],qs[_0xf222('0x36')](_0x10f065[_0xf222('0x32')][_0xf222('0x36')]));_0x5c60e6['attributes']=_0x5c60e6['attributes']['length']?_0x5c60e6[_0xf222('0x34')]:_0xf829ae[_0xf222('0x31')];if(_0x10f065[_0xf222('0x32')][_0xf222('0x40')]){_0x5c60e6['include']=[{'all':!![]}];}_0x5c60e6=_[_0xf222('0x3c')]({},_0x5c60e6,_0x10f065[_0xf222('0x3f')]);return db[_0xf222('0x2d')][_0xf222('0x46')](_0x5c60e6)['then'](handleEntityNotFound(_0x2af478,null))[_0xf222('0x25')](respondWithResult(_0x2af478,null))[_0xf222('0x43')](handleError(_0x2af478,null));};exports[_0xf222('0x47')]=function(_0x37b393,_0x1d60e5){return db[_0xf222('0x2d')][_0xf222('0x47')](_0x37b393[_0xf222('0x48')],{})[_0xf222('0x25')](respondWithResult(_0x1d60e5,0xc9))[_0xf222('0x43')](handleError(_0x1d60e5,null));};exports['update']=function(_0x5d0d70,_0x193762){if(_0x5d0d70['body']['id']){delete _0x5d0d70[_0xf222('0x48')]['id'];}return db['FreshdeskField'][_0xf222('0x46')]({'where':{'id':_0x5d0d70['params']['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x193762,null))[_0xf222('0x25')](saveUpdates(_0x5d0d70[_0xf222('0x48')],null))[_0xf222('0x25')](respondWithResult(_0x193762,null))['catch'](handleError(_0x193762,null));};exports[_0xf222('0x26')]=function(_0x34fd50,_0x380642){return db[_0xf222('0x2d')][_0xf222('0x46')]({'where':{'id':_0x34fd50[_0xf222('0x45')]['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x380642,null))[_0xf222('0x25')](removeEntity(_0x380642,null))[_0xf222('0x43')](handleError(_0x380642,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 7260443..a39b72a 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 _0x0e94=['freshdesk_unique_index','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x533a41,_0x53afd0){var _0xfec6b9=function(_0x427352){while(--_0x427352){_0x533a41['push'](_0x533a41['shift']());}};_0xfec6b9(++_0x53afd0);}(_0x0e94,0x8e));var _0x40e9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0e94[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x40e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x40e9('0x1'));var moment=require(_0x40e9('0x2'));var BPromise=require(_0x40e9('0x3'));var rp=require(_0x40e9('0x4'));var fs=require('fs');var path=require(_0x40e9('0x5'));var rimraf=require(_0x40e9('0x6'));var config=require('../../config/environment');var attributes=require(_0x40e9('0x7'));module[_0x40e9('0x8')]=function(_0xea3cdb,_0x41b6be){return _0xea3cdb[_0x40e9('0x9')](_0x40e9('0xa'),attributes,{'tableName':_0x40e9('0xb'),'paranoid':![],'indexes':[{'name':_0x40e9('0xc'),'fields':['idField',_0x40e9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc063=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0xc063,0xb6));var _0x3c06=function(_0x186295,_0x9f2aa1){_0x186295=_0x186295-0x0;var _0x211029=_0xc063[_0x186295];return _0x211029;};'use strict';var _=require(_0x3c06('0x0'));var util=require(_0x3c06('0x1'));var logger=require(_0x3c06('0x2'))(_0x3c06('0x3'));var moment=require('moment');var BPromise=require(_0x3c06('0x4'));var rp=require(_0x3c06('0x5'));var fs=require('fs');var path=require(_0x3c06('0x6'));var rimraf=require(_0x3c06('0x7'));var config=require(_0x3c06('0x8'));var attributes=require(_0x3c06('0x9'));module[_0x3c06('0xa')]=function(_0x1df708,_0x1027b1){return _0x1df708['define'](_0x3c06('0xb'),attributes,{'tableName':_0x3c06('0xc'),'paranoid':![],'indexes':[{'name':_0x3c06('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index fdde426..c954d2e 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 _0x5dbc=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x5dbc,0x162));var _0xc5db=function(_0xcc487c,_0x2fda61){_0xcc487c=_0xcc487c-0x0;var _0x4f36d0=_0x5dbc[_0xcc487c];return _0x4f36d0;};'use strict';var _=require(_0xc5db('0x0'));var util=require(_0xc5db('0x1'));var moment=require(_0xc5db('0x2'));var BPromise=require(_0xc5db('0x3'));var rs=require(_0xc5db('0x4'));var fs=require('fs');var Redis=require(_0xc5db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5db('0x6'));var logger=require(_0xc5db('0x7'))('rpc');var config=require(_0xc5db('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52ef1d,_0x161126,_0x3cb177){return new BPromise(function(_0x52ebec,_0x33012f){return client[_0xc5db('0x9')](_0x52ef1d,_0x3cb177)[_0xc5db('0xa')](function(_0x435061){logger[_0xc5db('0xb')](_0xc5db('0xc'),_0x161126,_0xc5db('0xd'));logger[_0xc5db('0xe')](_0xc5db('0xf'),_0x161126,_0xc5db('0xd'),JSON[_0xc5db('0x10')](_0x435061));if(_0x435061['error']){if(_0x435061[_0xc5db('0x11')][_0xc5db('0x12')]===0x1f4){logger[_0xc5db('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x161126,_0x435061[_0xc5db('0x11')][_0xc5db('0x13')]);return _0x33012f(_0x435061[_0xc5db('0x11')][_0xc5db('0x13')]);}logger[_0xc5db('0x11')](_0xc5db('0xc'),_0x161126,_0x435061['error']['message']);return _0x52ebec(_0x435061[_0xc5db('0x11')][_0xc5db('0x13')]);}else{logger[_0xc5db('0xb')](_0xc5db('0xc'),_0x161126,_0xc5db('0xd'));_0x52ebec(_0x435061[_0xc5db('0x14')][_0xc5db('0x13')]);}})['catch'](function(_0x1419c3){logger[_0xc5db('0x11')](_0xc5db('0xc'),_0x161126,_0x1419c3);_0x33012f(_0x1419c3);});});} \ No newline at end of file +var _0xfe8b=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x207d3a,_0x44d239){var _0x51a26b=function(_0x5d795a){while(--_0x5d795a){_0x207d3a['push'](_0x207d3a['shift']());}};_0x51a26b(++_0x44d239);}(_0xfe8b,0x1e4));var _0xbfe8=function(_0x920ae3,_0x4652ef){_0x920ae3=_0x920ae3-0x0;var _0x19ea79=_0xfe8b[_0x920ae3];return _0x19ea79;};'use strict';var _=require(_0xbfe8('0x0'));var util=require('util');var moment=require(_0xbfe8('0x1'));var BPromise=require(_0xbfe8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfe8('0x3'));var db=require(_0xbfe8('0x4'))['db'];var utils=require(_0xbfe8('0x5'));var logger=require(_0xbfe8('0x6'))(_0xbfe8('0x7'));var config=require(_0xbfe8('0x8'));var jayson=require(_0xbfe8('0x9'));var client=jayson[_0xbfe8('0xa')][_0xbfe8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ce15f,_0x45340b,_0x332910){return new BPromise(function(_0x4a7786,_0x1fd0c9){return client[_0xbfe8('0xc')](_0x1ce15f,_0x332910)[_0xbfe8('0xd')](function(_0x2fc7c6){logger['info'](_0xbfe8('0xe'),_0x45340b,_0xbfe8('0xf'));logger[_0xbfe8('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x45340b,_0xbfe8('0xf'),JSON['stringify'](_0x2fc7c6));if(_0x2fc7c6[_0xbfe8('0x11')]){if(_0x2fc7c6['error'][_0xbfe8('0x12')]===0x1f4){logger['error'](_0xbfe8('0xe'),_0x45340b,_0x2fc7c6['error'][_0xbfe8('0x13')]);return _0x1fd0c9(_0x2fc7c6[_0xbfe8('0x11')][_0xbfe8('0x13')]);}logger[_0xbfe8('0x11')](_0xbfe8('0xe'),_0x45340b,_0x2fc7c6['error']['message']);return _0x4a7786(_0x2fc7c6['error'][_0xbfe8('0x13')]);}else{logger[_0xbfe8('0x14')](_0xbfe8('0xe'),_0x45340b,_0xbfe8('0xf'));_0x4a7786(_0x2fc7c6[_0xbfe8('0x15')][_0xbfe8('0x13')]);}})[_0xbfe8('0x16')](function(_0x100b9c){logger[_0xbfe8('0x11')](_0xbfe8('0xe'),_0x45340b,_0x100b9c);_0x1fd0c9(_0x100b9c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 67da622..dd21961 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 _0x0713=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','delete'];(function(_0x26f512,_0x6335e){var _0x4187c6=function(_0x3d73c0){while(--_0x3d73c0){_0x26f512['push'](_0x26f512['shift']());}};_0x4187c6(++_0x6335e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getConfigurations']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x10')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['put']('/:id',auth[_0x3071('0x9')](),controller['update']);router[_0x3071('0x13')](_0x3071('0xb'),auth['isAuthenticated'](),controller[_0x3071('0x14')]);module['exports']=router; \ No newline at end of file +var _0x087b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5be1fe,_0x2ded67){var _0x1e9e88=function(_0x43b3d8){while(--_0x43b3d8){_0x5be1fe['push'](_0x5be1fe['shift']());}};_0x1e9e88(++_0x2ded67);}(_0x087b,0x11a));var _0xb087=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x087b[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/fields',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x10')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x10')](_0xb087('0xd'),auth['isAuthenticated'](),controller[_0xb087('0x12')]);router[_0xb087('0x13')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x15')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);module[_0xb087('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 172766d..6e4973b 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 _0x4888=['exports','STRING','username'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x4888,0x198));var _0x8488=function(_0x536076,_0x4c5460){_0x536076=_0x536076-0x0;var _0x246902=_0x4888[_0x536076];return _0x246902;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x896e=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5cdae6,_0x50e1fc){var _0x18e71d=function(_0x31948e){while(--_0x31948e){_0x5cdae6['push'](_0x5cdae6['shift']());}};_0x18e71d(++_0x50e1fc);}(_0x896e,0x1e9));var _0xe896=function(_0x40e5ec,_0x444529){_0x40e5ec=_0x40e5ec-0x0;var _0xfe73f7=_0x896e[_0x40e5ec];return _0xfe73f7;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'name':{'type':Sequelize[_0xe896('0x2')]},'description':{'type':Sequelize[_0xe896('0x2')]},'username':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x3')},'apiKey':{'type':Sequelize[_0xe896('0x2')]},'remoteUri':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x4')},'serverUrl':{'type':Sequelize[_0xe896('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 4c99f04..e737668 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 _0x0fe5=['sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','rawAttributes','options','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x0fe5,0xf7));var _0x50fe=function(_0x25a675,_0x5811ce){_0x25a675=_0x25a675-0x0;var _0x5d6366=_0x0fe5[_0x25a675];return _0x5d6366;};'use strict';var emlformat=require(_0x50fe('0x0'));var rimraf=require(_0x50fe('0x1'));var zipdir=require(_0x50fe('0x2'));var jsonpatch=require(_0x50fe('0x3'));var rp=require(_0x50fe('0x4'));var moment=require(_0x50fe('0x5'));var BPromise=require(_0x50fe('0x6'));var Mustache=require(_0x50fe('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x50fe('0x8'));var ejs=require(_0x50fe('0x9'));var fs=require('fs');var fs_extra=require(_0x50fe('0xa'));var _=require('lodash');var squel=require(_0x50fe('0xb'));var crypto=require('crypto');var jsforce=require(_0x50fe('0xc'));var deskjs=require(_0x50fe('0xd'));var toCsv=require(_0x50fe('0x8'));var querystring=require(_0x50fe('0xe'));var Papa=require(_0x50fe('0xf'));var Redis=require(_0x50fe('0x10'));var authService=require(_0x50fe('0x11'));var qs=require(_0x50fe('0x12'));var as=require(_0x50fe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50fe('0x14'))(_0x50fe('0x15'));var utils=require(_0x50fe('0x16'));var config=require(_0x50fe('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x50fe('0x18'))['db'];var integrations=require(_0x50fe('0x19'));function respondWithStatusCode(_0x31c1d3,_0x313d4c){_0x313d4c=_0x313d4c||0xcc;return function(_0x494d1b){if(_0x494d1b){return _0x31c1d3[_0x50fe('0x1a')](_0x313d4c);}return _0x31c1d3[_0x50fe('0x1b')](_0x313d4c)[_0x50fe('0x1c')]();};}function respondWithResult(_0x9d1126,_0x3b1634){_0x3b1634=_0x3b1634||0xc8;return function(_0x531428){if(_0x531428){return _0x9d1126[_0x50fe('0x1b')](_0x3b1634)['json'](_0x531428);}};}function respondWithFilteredResult(_0x4619ba,_0x588ae5){return function(_0x195a5e){if(_0x195a5e){var _0x205fd4=typeof _0x588ae5[_0x50fe('0x1d')]===_0x50fe('0x1e')&&typeof _0x588ae5[_0x50fe('0x1f')]===_0x50fe('0x1e');var _0x227111=_0x195a5e[_0x50fe('0x20')];var _0x2edeae=_0x205fd4?0x0:_0x588ae5[_0x50fe('0x1d')];var _0x108857=_0x205fd4?_0x195a5e[_0x50fe('0x20')]:_0x588ae5['offset']+_0x588ae5['limit'];var _0x57fe3c;if(_0x108857>=_0x227111){_0x108857=_0x227111;_0x57fe3c=0xc8;}else{_0x57fe3c=0xce;}_0x4619ba['status'](_0x57fe3c);return _0x4619ba[_0x50fe('0x21')](_0x50fe('0x22'),_0x2edeae+'-'+_0x108857+'/'+_0x227111)['json'](_0x195a5e);}return null;};}function patchUpdates(_0x59c316){return function(_0x261921){try{jsonpatch[_0x50fe('0x23')](_0x261921,_0x59c316,!![]);}catch(_0x35a438){return BPromise[_0x50fe('0x24')](_0x35a438);}return _0x261921['save']();};}function saveUpdates(_0x19ba8a,_0x22de29){return function(_0x52631a){if(_0x52631a){return _0x52631a[_0x50fe('0x25')](_0x19ba8a)[_0x50fe('0x26')](function(_0x5cf5e0){return _0x5cf5e0;});}return null;};}function removeEntity(_0x3f352f,_0x228aa8){return function(_0x1e44bf){if(_0x1e44bf){return _0x1e44bf[_0x50fe('0x27')]()['then'](function(){_0x3f352f[_0x50fe('0x1b')](0xcc)[_0x50fe('0x1c')]();});}};}function handleEntityNotFound(_0x345ddf,_0xcda070){return function(_0x14f592){if(!_0x14f592){_0x345ddf[_0x50fe('0x1a')](0x194);}return _0x14f592;};}function handleError(_0x439feb,_0x5dcac1){_0x5dcac1=_0x5dcac1||0x1f4;return function(_0xaac70){logger[_0x50fe('0x28')](_0xaac70[_0x50fe('0x29')]);if(_0xaac70['name']){delete _0xaac70[_0x50fe('0x2a')];}_0x439feb['status'](_0x5dcac1)['send'](_0xaac70);};}exports[_0x50fe('0x2b')]=function(_0x4769d7,_0x1528ec){var _0x5434de={},_0x3d0ded={},_0x3a38c1={'count':0x0,'rows':[]};var _0x1b569e=_[_0x50fe('0x2c')](db[_0x50fe('0x2d')]['rawAttributes'],function(_0x2cc093){return{'name':_0x2cc093[_0x50fe('0x2e')],'type':_0x2cc093[_0x50fe('0x2f')][_0x50fe('0x30')]};});_0x3d0ded[_0x50fe('0x31')]=_[_0x50fe('0x2c')](_0x1b569e,_0x50fe('0x2a'));_0x3d0ded[_0x50fe('0x32')]=_[_0x50fe('0x33')](_0x4769d7[_0x50fe('0x32')]);_0x3d0ded['filters']=_[_0x50fe('0x34')](_0x3d0ded[_0x50fe('0x31')],_0x3d0ded[_0x50fe('0x32')]);_0x5434de[_0x50fe('0x35')]=_[_0x50fe('0x34')](_0x3d0ded['model'],qs[_0x50fe('0x36')](_0x4769d7[_0x50fe('0x32')]['fields']));_0x5434de[_0x50fe('0x35')]=_0x5434de[_0x50fe('0x35')][_0x50fe('0x37')]?_0x5434de[_0x50fe('0x35')]:_0x3d0ded[_0x50fe('0x31')];if(!_0x4769d7[_0x50fe('0x32')][_0x50fe('0x38')](_0x50fe('0x39'))){_0x5434de[_0x50fe('0x1f')]=qs['limit'](_0x4769d7[_0x50fe('0x32')][_0x50fe('0x1f')]);_0x5434de['offset']=qs['offset'](_0x4769d7['query']['offset']);}_0x5434de[_0x50fe('0x3a')]=qs[_0x50fe('0x3b')](_0x4769d7[_0x50fe('0x32')][_0x50fe('0x3b')]);_0x5434de[_0x50fe('0x3c')]=qs['filters'](_[_0x50fe('0x3d')](_0x4769d7[_0x50fe('0x32')],_0x3d0ded[_0x50fe('0x3e')]),_0x1b569e);if(_0x4769d7[_0x50fe('0x32')]['filter']){_0x5434de[_0x50fe('0x3c')]=_[_0x50fe('0x3f')](_0x5434de[_0x50fe('0x3c')],{'$or':_[_0x50fe('0x2c')](_0x1b569e,function(_0x2906a6){if(_0x2906a6[_0x50fe('0x2f')]!==_0x50fe('0x40')){var _0x58fe05={};_0x58fe05[_0x2906a6[_0x50fe('0x2a')]]={'$like':'%'+_0x4769d7[_0x50fe('0x32')][_0x50fe('0x41')]+'%'};return _0x58fe05;}})});}_0x5434de=_[_0x50fe('0x3f')]({},_0x5434de,_0x4769d7['options']);var _0x197dc5={'where':_0x5434de[_0x50fe('0x3c')]};return db[_0x50fe('0x2d')][_0x50fe('0x20')](_0x197dc5)[_0x50fe('0x26')](function(_0x5cf731){_0x3a38c1[_0x50fe('0x20')]=_0x5cf731;if(_0x4769d7[_0x50fe('0x32')][_0x50fe('0x42')]){_0x5434de[_0x50fe('0x43')]=[{'all':!![]}];}return db[_0x50fe('0x2d')]['findAll'](_0x5434de);})['then'](function(_0x4927e3){_0x3a38c1[_0x50fe('0x44')]=_0x4927e3;return _0x3a38c1;})['then'](respondWithFilteredResult(_0x1528ec,_0x5434de))[_0x50fe('0x45')](handleError(_0x1528ec,null));};exports[_0x50fe('0x46')]=function(_0x4fbfc9,_0x34b3c6){var _0x2bfb0e={'raw':![],'where':{'id':_0x4fbfc9[_0x50fe('0x47')]['id']}},_0xabeea={};_0xabeea['model']=_[_0x50fe('0x33')](db[_0x50fe('0x2d')][_0x50fe('0x48')]);_0xabeea[_0x50fe('0x32')]=_[_0x50fe('0x33')](_0x4fbfc9[_0x50fe('0x32')]);_0xabeea[_0x50fe('0x3e')]=_['intersection'](_0xabeea[_0x50fe('0x31')],_0xabeea[_0x50fe('0x32')]);_0x2bfb0e['attributes']=_[_0x50fe('0x34')](_0xabeea['model'],qs['fields'](_0x4fbfc9['query'][_0x50fe('0x36')]));_0x2bfb0e[_0x50fe('0x35')]=_0x2bfb0e[_0x50fe('0x35')][_0x50fe('0x37')]?_0x2bfb0e[_0x50fe('0x35')]:_0xabeea[_0x50fe('0x31')];if(_0x4fbfc9[_0x50fe('0x32')]['includeAll']){_0x2bfb0e['include']=[{'all':!![]}];}_0x2bfb0e=_[_0x50fe('0x3f')]({},_0x2bfb0e,_0x4fbfc9[_0x50fe('0x49')]);return db['FreshsalesAccount']['find'](_0x2bfb0e)[_0x50fe('0x26')](handleEntityNotFound(_0x34b3c6,null))[_0x50fe('0x26')](respondWithResult(_0x34b3c6,null))['catch'](handleError(_0x34b3c6,null));};exports['create']=function(_0x415775,_0x114707){return db[_0x50fe('0x2d')]['create'](_0x415775[_0x50fe('0x4a')],{})[_0x50fe('0x26')](respondWithResult(_0x114707,0xc9))[_0x50fe('0x45')](handleError(_0x114707,null));};exports[_0x50fe('0x25')]=function(_0x17f920,_0x32fe87){if(_0x17f920[_0x50fe('0x4a')]['id']){delete _0x17f920['body']['id'];}return db[_0x50fe('0x2d')][_0x50fe('0x4b')]({'where':{'id':_0x17f920[_0x50fe('0x47')]['id']}})[_0x50fe('0x26')](handleEntityNotFound(_0x32fe87,null))[_0x50fe('0x26')](saveUpdates(_0x17f920['body'],null))[_0x50fe('0x26')](respondWithResult(_0x32fe87,null))[_0x50fe('0x45')](handleError(_0x32fe87,null));};exports[_0x50fe('0x27')]=function(_0x51716e,_0x1fe7dd){return db[_0x50fe('0x2d')][_0x50fe('0x4b')]({'where':{'id':_0x51716e[_0x50fe('0x47')]['id']}})[_0x50fe('0x26')](handleEntityNotFound(_0x1fe7dd,null))[_0x50fe('0x26')](removeEntity(_0x1fe7dd,null))['catch'](handleError(_0x1fe7dd,null));};exports[_0x50fe('0x4c')]=function(_0x351b3d,_0x33b4cb,_0x2ebc23){var _0x5035f8={};var _0xd4dfc8={};var _0x1b501d;var _0x556f2b;return db['FreshsalesAccount'][_0x50fe('0x4d')]({'where':{'id':_0x351b3d[_0x50fe('0x47')]['id']}})['then'](handleEntityNotFound(_0x33b4cb,null))['then'](function(_0x5261b0){if(_0x5261b0){_0x1b501d=_0x5261b0;_0xd4dfc8['model']=_[_0x50fe('0x33')](db[_0x50fe('0x4e')][_0x50fe('0x48')]);_0xd4dfc8[_0x50fe('0x32')]=_[_0x50fe('0x33')](_0x351b3d[_0x50fe('0x32')]);_0xd4dfc8['filters']=_[_0x50fe('0x34')](_0xd4dfc8[_0x50fe('0x31')],_0xd4dfc8[_0x50fe('0x32')]);_0x5035f8[_0x50fe('0x35')]=_[_0x50fe('0x34')](_0xd4dfc8[_0x50fe('0x31')],qs[_0x50fe('0x36')](_0x351b3d[_0x50fe('0x32')][_0x50fe('0x36')]));_0x5035f8[_0x50fe('0x35')]=_0x5035f8[_0x50fe('0x35')][_0x50fe('0x37')]?_0x5035f8[_0x50fe('0x35')]:_0xd4dfc8[_0x50fe('0x31')];_0x5035f8[_0x50fe('0x3a')]=qs[_0x50fe('0x3b')](_0x351b3d[_0x50fe('0x32')]['sort']);_0x5035f8[_0x50fe('0x3c')]=qs[_0x50fe('0x3e')](_['pick'](_0x351b3d[_0x50fe('0x32')],_0xd4dfc8['filters']));if(_0x351b3d[_0x50fe('0x32')][_0x50fe('0x41')]){_0x5035f8[_0x50fe('0x3c')]=_[_0x50fe('0x3f')](_0x5035f8[_0x50fe('0x3c')],{'$or':_[_0x50fe('0x2c')](_0x5035f8[_0x50fe('0x35')],function(_0x46df31){var _0x368f69={};_0x368f69[_0x46df31]={'$like':'%'+_0x351b3d[_0x50fe('0x32')][_0x50fe('0x41')]+'%'};return _0x368f69;})});}_0x5035f8=_[_0x50fe('0x3f')]({},_0x5035f8,_0x351b3d['options']);return _0x1b501d[_0x50fe('0x4c')](_0x5035f8);}})[_0x50fe('0x26')](function(_0x323f31){if(_0x323f31){_0x556f2b=_0x323f31[_0x50fe('0x37')];if(!_0x351b3d[_0x50fe('0x32')][_0x50fe('0x38')](_0x50fe('0x39'))){_0x5035f8[_0x50fe('0x1f')]=qs[_0x50fe('0x1f')](_0x351b3d[_0x50fe('0x32')][_0x50fe('0x1f')]);_0x5035f8['offset']=qs[_0x50fe('0x1d')](_0x351b3d[_0x50fe('0x32')][_0x50fe('0x1d')]);}return _0x1b501d[_0x50fe('0x4c')](_0x5035f8);}})[_0x50fe('0x26')](function(_0x491e63){if(_0x491e63){return _0x491e63?{'count':_0x556f2b,'rows':_0x491e63}:null;}})[_0x50fe('0x26')](respondWithResult(_0x33b4cb,null))[_0x50fe('0x45')](handleError(_0x33b4cb,null));};exports[_0x50fe('0x4f')]=function(_0x1c39ea,_0x3373fb,_0x6a63cb){if(_0x1c39ea[_0x50fe('0x4a')]['id']){delete _0x1c39ea['body']['id'];}return db[_0x50fe('0x2d')]['findOne']({'where':{'id':_0x1c39ea['params']['id']}})[_0x50fe('0x26')](handleEntityNotFound(_0x3373fb,null))[_0x50fe('0x26')](function(_0x212bd0){if(_0x212bd0){_0x1c39ea['body'][_0x50fe('0x50')]=_0x212bd0['id'];_0x1c39ea[_0x50fe('0x4a')][_0x50fe('0x51')]=integrations[_0x50fe('0x52')](_0x1c39ea[_0x50fe('0x4a')][_0x50fe('0x53')],_0x1c39ea['body'][_0x50fe('0x2f')]);_0x1c39ea[_0x50fe('0x4a')][_0x50fe('0x54')]=integrations['getDescriptions'](_0x1c39ea['body'][_0x50fe('0x53')],_0x1c39ea['body']['type']);return db[_0x50fe('0x4e')]['create'](_0x1c39ea[_0x50fe('0x4a')],{'include':[{'model':db[_0x50fe('0x55')],'as':_0x50fe('0x51')},{'model':db[_0x50fe('0x55')],'as':_0x50fe('0x54')}]});}return null;})[_0x50fe('0x26')](respondWithResult(_0x3373fb,null))[_0x50fe('0x45')](handleError(_0x3373fb,null));};exports[_0x50fe('0x56')]=function(_0x23b3c8,_0x22625a,_0x558887){var _0x4cb6ec='';var _0x4e9152='';return db['FreshsalesAccount'][_0x50fe('0x4d')]({'where':{'id':_0x23b3c8[_0x50fe('0x47')]['id']},'attributes':['id',_0x50fe('0x57'),'remoteUri',_0x50fe('0x58')]})['then'](handleEntityNotFound(_0x22625a,null))[_0x50fe('0x26')](function(_0x24f92f){if(_0x24f92f){_0x4e9152=_0x24f92f['username'];_0x4cb6ec=_0x24f92f[_0x50fe('0x59')];var _0x6eca4e=_0x24f92f['remoteUri'][_0x50fe('0x5a')](-0x1);if(_0x6eca4e==='/'){_0x4cb6ec=_0x4cb6ec[_0x50fe('0x5b')](0x0,_0x4cb6ec['lastIndexOf'](_0x6eca4e));}return rp({'method':'GET','uri':util[_0x50fe('0x5c')]('%s%s',_0x4cb6ec,_0x50fe('0x5d')),'headers':{'Authorization':_0x50fe('0x5e')+_0x24f92f['apiKey']},'json':!![]});}})[_0x50fe('0x26')](function(_0xd0ace7){if(_0xd0ace7){var _0x3f99fa=_0xd0ace7[_0x50fe('0x5f')];var _0x55cd69=![];var _0x2aefa0=null;for(_0x2aefa0=0x0;_0x2aefa0<_0x3f99fa[_0x50fe('0x37')];_0x2aefa0++){if(_0x3f99fa[_0x2aefa0][_0x50fe('0x60')]===_0x4e9152){_0x55cd69=!![];}}if(_0x55cd69){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x50fe('0x61')});}}})[_0x50fe('0x26')](respondWithResult(_0x22625a,null))[_0x50fe('0x45')](function(_0x430955){var _0x1f4a0f=_0x23b3c8['query'][_0x50fe('0x62')]?0x1f4:_0x430955[_0x50fe('0x63')]||0x1f4;logger[_0x50fe('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x50fe('0x56'),_0x1f4a0f,JSON[_0x50fe('0x64')](_0x430955));delete _0x430955[_0x50fe('0x2a')];if(_0x1f4a0f===0x191){_0x1f4a0f=0x190;}_0x22625a[_0x50fe('0x1b')](_0x1f4a0f)['send'](_0x23b3c8[_0x50fe('0x32')]['test']?{'message':_0x50fe('0x65'),'statusCode':_0x430955['statusCode']}:_0x430955);});}; \ No newline at end of file +var _0x48b5=['substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','count','offset','set','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','catch','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','FreshsalesField','getFields','remoteUri','username','slice'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x48b5,0xdb));var _0x548b=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x48b5[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x548b('0x0'));var rimraf=require(_0x548b('0x1'));var zipdir=require(_0x548b('0x2'));var jsonpatch=require(_0x548b('0x3'));var rp=require('request-promise');var moment=require(_0x548b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x548b('0x5'));var util=require('util');var path=require(_0x548b('0x6'));var sox=require(_0x548b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x548b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x548b('0x9'));var deskjs=require(_0x548b('0xa'));var toCsv=require(_0x548b('0xb'));var querystring=require(_0x548b('0xc'));var Papa=require(_0x548b('0xd'));var Redis=require(_0x548b('0xe'));var authService=require(_0x548b('0xf'));var qs=require(_0x548b('0x10'));var as=require(_0x548b('0x11'));var hardwareService=require(_0x548b('0x12'));var logger=require(_0x548b('0x13'))(_0x548b('0x14'));var utils=require('../../config/utils');var config=require(_0x548b('0x15'));var licenseUtil=require(_0x548b('0x16'));var db=require(_0x548b('0x17'))['db'];var integrations=require(_0x548b('0x18'));function respondWithStatusCode(_0x2ef534,_0x10d50d){_0x10d50d=_0x10d50d||0xcc;return function(_0x6d192a){if(_0x6d192a){return _0x2ef534['sendStatus'](_0x10d50d);}return _0x2ef534[_0x548b('0x19')](_0x10d50d)[_0x548b('0x1a')]();};}function respondWithResult(_0x2a189b,_0x1e57d5){_0x1e57d5=_0x1e57d5||0xc8;return function(_0x4cd25d){if(_0x4cd25d){return _0x2a189b[_0x548b('0x19')](_0x1e57d5)[_0x548b('0x1b')](_0x4cd25d);}};}function respondWithFilteredResult(_0x2ae370,_0x478ca2){return function(_0x15f5f8){if(_0x15f5f8){var _0x3e0416=typeof _0x478ca2['offset']===_0x548b('0x1c')&&typeof _0x478ca2['limit']===_0x548b('0x1c');var _0xb0417f=_0x15f5f8[_0x548b('0x1d')];var _0x43a6ae=_0x3e0416?0x0:_0x478ca2[_0x548b('0x1e')];var _0x21b998=_0x3e0416?_0x15f5f8['count']:_0x478ca2['offset']+_0x478ca2['limit'];var _0x3f61f1;if(_0x21b998>=_0xb0417f){_0x21b998=_0xb0417f;_0x3f61f1=0xc8;}else{_0x3f61f1=0xce;}_0x2ae370[_0x548b('0x19')](_0x3f61f1);return _0x2ae370[_0x548b('0x1f')]('Content-Range',_0x43a6ae+'-'+_0x21b998+'/'+_0xb0417f)[_0x548b('0x1b')](_0x15f5f8);}return null;};}function patchUpdates(_0x2be0e0){return function(_0x12be36){try{jsonpatch[_0x548b('0x20')](_0x12be36,_0x2be0e0,!![]);}catch(_0x207982){return BPromise[_0x548b('0x21')](_0x207982);}return _0x12be36['save']();};}function saveUpdates(_0x57092c,_0x43497b){return function(_0x5eb8b7){if(_0x5eb8b7){return _0x5eb8b7[_0x548b('0x22')](_0x57092c)[_0x548b('0x23')](function(_0x2eb5c1){return _0x2eb5c1;});}return null;};}function removeEntity(_0x453f56,_0x1c1fbf){return function(_0x47bc1e){if(_0x47bc1e){return _0x47bc1e[_0x548b('0x24')]()[_0x548b('0x23')](function(){_0x453f56[_0x548b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x186ef4,_0x49789a){return function(_0x14ee89){if(!_0x14ee89){_0x186ef4[_0x548b('0x25')](0x194);}return _0x14ee89;};}function handleError(_0x51c9e1,_0x54f43b){_0x54f43b=_0x54f43b||0x1f4;return function(_0x16737c){logger[_0x548b('0x26')](_0x16737c['stack']);if(_0x16737c['name']){delete _0x16737c[_0x548b('0x27')];}_0x51c9e1['status'](_0x54f43b)[_0x548b('0x28')](_0x16737c);};}exports[_0x548b('0x29')]=function(_0x574494,_0x335528){var _0x118812={},_0x40bf54={},_0x2533c6={'count':0x0,'rows':[]};var _0x1ce141=_[_0x548b('0x2a')](db['FreshsalesAccount'][_0x548b('0x2b')],function(_0x56ab55){return{'name':_0x56ab55[_0x548b('0x2c')],'type':_0x56ab55['type'][_0x548b('0x2d')]};});_0x40bf54[_0x548b('0x2e')]=_[_0x548b('0x2a')](_0x1ce141,_0x548b('0x27'));_0x40bf54[_0x548b('0x2f')]=_[_0x548b('0x30')](_0x574494['query']);_0x40bf54['filters']=_[_0x548b('0x31')](_0x40bf54[_0x548b('0x2e')],_0x40bf54[_0x548b('0x2f')]);_0x118812[_0x548b('0x32')]=_['intersection'](_0x40bf54[_0x548b('0x2e')],qs[_0x548b('0x33')](_0x574494[_0x548b('0x2f')][_0x548b('0x33')]));_0x118812['attributes']=_0x118812[_0x548b('0x32')][_0x548b('0x34')]?_0x118812[_0x548b('0x32')]:_0x40bf54[_0x548b('0x2e')];if(!_0x574494[_0x548b('0x2f')]['hasOwnProperty'](_0x548b('0x35'))){_0x118812[_0x548b('0x36')]=qs[_0x548b('0x36')](_0x574494[_0x548b('0x2f')]['limit']);_0x118812[_0x548b('0x1e')]=qs[_0x548b('0x1e')](_0x574494['query']['offset']);}_0x118812[_0x548b('0x37')]=qs[_0x548b('0x38')](_0x574494[_0x548b('0x2f')][_0x548b('0x38')]);_0x118812[_0x548b('0x39')]=qs[_0x548b('0x3a')](_['pick'](_0x574494[_0x548b('0x2f')],_0x40bf54[_0x548b('0x3a')]),_0x1ce141);if(_0x574494['query'][_0x548b('0x3b')]){_0x118812[_0x548b('0x39')]=_[_0x548b('0x3c')](_0x118812['where'],{'$or':_[_0x548b('0x2a')](_0x1ce141,function(_0x55ce16){if(_0x55ce16['type']!==_0x548b('0x3d')){var _0x1792ab={};_0x1792ab[_0x55ce16[_0x548b('0x27')]]={'$like':'%'+_0x574494[_0x548b('0x2f')][_0x548b('0x3b')]+'%'};return _0x1792ab;}})});}_0x118812=_[_0x548b('0x3c')]({},_0x118812,_0x574494[_0x548b('0x3e')]);var _0xa16a01={'where':_0x118812[_0x548b('0x39')]};return db[_0x548b('0x3f')][_0x548b('0x1d')](_0xa16a01)[_0x548b('0x23')](function(_0x22541a){_0x2533c6[_0x548b('0x1d')]=_0x22541a;if(_0x574494[_0x548b('0x2f')][_0x548b('0x40')]){_0x118812[_0x548b('0x41')]=[{'all':!![]}];}return db[_0x548b('0x3f')][_0x548b('0x42')](_0x118812);})[_0x548b('0x23')](function(_0x5d4a5f){_0x2533c6['rows']=_0x5d4a5f;return _0x2533c6;})[_0x548b('0x23')](respondWithFilteredResult(_0x335528,_0x118812))[_0x548b('0x43')](handleError(_0x335528,null));};exports['show']=function(_0x11651d,_0xfb5ce0){var _0x47fd1f={'raw':![],'where':{'id':_0x11651d[_0x548b('0x44')]['id']}},_0x18cca9={};_0x18cca9[_0x548b('0x2e')]=_[_0x548b('0x30')](db[_0x548b('0x3f')][_0x548b('0x2b')]);_0x18cca9[_0x548b('0x2f')]=_[_0x548b('0x30')](_0x11651d[_0x548b('0x2f')]);_0x18cca9[_0x548b('0x3a')]=_['intersection'](_0x18cca9['model'],_0x18cca9[_0x548b('0x2f')]);_0x47fd1f['attributes']=_['intersection'](_0x18cca9[_0x548b('0x2e')],qs[_0x548b('0x33')](_0x11651d[_0x548b('0x2f')][_0x548b('0x33')]));_0x47fd1f[_0x548b('0x32')]=_0x47fd1f[_0x548b('0x32')][_0x548b('0x34')]?_0x47fd1f[_0x548b('0x32')]:_0x18cca9[_0x548b('0x2e')];if(_0x11651d[_0x548b('0x2f')][_0x548b('0x40')]){_0x47fd1f['include']=[{'all':!![]}];}_0x47fd1f=_[_0x548b('0x3c')]({},_0x47fd1f,_0x11651d[_0x548b('0x3e')]);return db['FreshsalesAccount'][_0x548b('0x45')](_0x47fd1f)[_0x548b('0x23')](handleEntityNotFound(_0xfb5ce0,null))[_0x548b('0x23')](respondWithResult(_0xfb5ce0,null))[_0x548b('0x43')](handleError(_0xfb5ce0,null));};exports[_0x548b('0x46')]=function(_0xfd9d93,_0x43b44d){return db['FreshsalesAccount'][_0x548b('0x46')](_0xfd9d93[_0x548b('0x47')],{})[_0x548b('0x23')](respondWithResult(_0x43b44d,0xc9))[_0x548b('0x43')](handleError(_0x43b44d,null));};exports['update']=function(_0x39a359,_0xe68e02){if(_0x39a359[_0x548b('0x47')]['id']){delete _0x39a359['body']['id'];}return db[_0x548b('0x3f')][_0x548b('0x45')]({'where':{'id':_0x39a359['params']['id']}})['then'](handleEntityNotFound(_0xe68e02,null))[_0x548b('0x23')](saveUpdates(_0x39a359[_0x548b('0x47')],null))[_0x548b('0x23')](respondWithResult(_0xe68e02,null))['catch'](handleError(_0xe68e02,null));};exports[_0x548b('0x24')]=function(_0x567365,_0x534abf){return db['FreshsalesAccount'][_0x548b('0x45')]({'where':{'id':_0x567365[_0x548b('0x44')]['id']}})[_0x548b('0x23')](handleEntityNotFound(_0x534abf,null))[_0x548b('0x23')](removeEntity(_0x534abf,null))[_0x548b('0x43')](handleError(_0x534abf,null));};exports[_0x548b('0x48')]=function(_0x58d9e0,_0x2c7511,_0x16fced){var _0x3d375c={};var _0x3ae2ff={};var _0x187d7a;var _0x1fe098;return db[_0x548b('0x3f')][_0x548b('0x49')]({'where':{'id':_0x58d9e0[_0x548b('0x44')]['id']}})[_0x548b('0x23')](handleEntityNotFound(_0x2c7511,null))[_0x548b('0x23')](function(_0x8de99f){if(_0x8de99f){_0x187d7a=_0x8de99f;_0x3ae2ff[_0x548b('0x2e')]=_[_0x548b('0x30')](db[_0x548b('0x4a')][_0x548b('0x2b')]);_0x3ae2ff['query']=_['keys'](_0x58d9e0[_0x548b('0x2f')]);_0x3ae2ff[_0x548b('0x3a')]=_[_0x548b('0x31')](_0x3ae2ff[_0x548b('0x2e')],_0x3ae2ff[_0x548b('0x2f')]);_0x3d375c[_0x548b('0x32')]=_[_0x548b('0x31')](_0x3ae2ff['model'],qs[_0x548b('0x33')](_0x58d9e0['query'][_0x548b('0x33')]));_0x3d375c[_0x548b('0x32')]=_0x3d375c['attributes'][_0x548b('0x34')]?_0x3d375c[_0x548b('0x32')]:_0x3ae2ff[_0x548b('0x2e')];_0x3d375c[_0x548b('0x37')]=qs[_0x548b('0x38')](_0x58d9e0['query']['sort']);_0x3d375c[_0x548b('0x39')]=qs['filters'](_[_0x548b('0x4b')](_0x58d9e0[_0x548b('0x2f')],_0x3ae2ff[_0x548b('0x3a')]));if(_0x58d9e0[_0x548b('0x2f')]['filter']){_0x3d375c[_0x548b('0x39')]=_[_0x548b('0x3c')](_0x3d375c[_0x548b('0x39')],{'$or':_[_0x548b('0x2a')](_0x3d375c[_0x548b('0x32')],function(_0x17edd7){var _0x87bee1={};_0x87bee1[_0x17edd7]={'$like':'%'+_0x58d9e0['query']['filter']+'%'};return _0x87bee1;})});}_0x3d375c=_['merge']({},_0x3d375c,_0x58d9e0[_0x548b('0x3e')]);return _0x187d7a[_0x548b('0x48')](_0x3d375c);}})[_0x548b('0x23')](function(_0x232acb){if(_0x232acb){_0x1fe098=_0x232acb['length'];if(!_0x58d9e0['query'][_0x548b('0x4c')](_0x548b('0x35'))){_0x3d375c[_0x548b('0x36')]=qs[_0x548b('0x36')](_0x58d9e0['query'][_0x548b('0x36')]);_0x3d375c[_0x548b('0x1e')]=qs[_0x548b('0x1e')](_0x58d9e0[_0x548b('0x2f')]['offset']);}return _0x187d7a[_0x548b('0x48')](_0x3d375c);}})[_0x548b('0x23')](function(_0x3b2896){if(_0x3b2896){return _0x3b2896?{'count':_0x1fe098,'rows':_0x3b2896}:null;}})['then'](respondWithResult(_0x2c7511,null))['catch'](handleError(_0x2c7511,null));};exports[_0x548b('0x4d')]=function(_0x1035f9,_0x43999b,_0x164428){if(_0x1035f9['body']['id']){delete _0x1035f9[_0x548b('0x47')]['id'];}return db['FreshsalesAccount'][_0x548b('0x49')]({'where':{'id':_0x1035f9['params']['id']}})[_0x548b('0x23')](handleEntityNotFound(_0x43999b,null))[_0x548b('0x23')](function(_0x42a95e){if(_0x42a95e){_0x1035f9[_0x548b('0x47')][_0x548b('0x4e')]=_0x42a95e['id'];_0x1035f9[_0x548b('0x47')][_0x548b('0x4f')]=integrations[_0x548b('0x50')](_0x1035f9['body']['channel'],_0x1035f9[_0x548b('0x47')][_0x548b('0x51')]);_0x1035f9[_0x548b('0x47')][_0x548b('0x52')]=integrations[_0x548b('0x53')](_0x1035f9[_0x548b('0x47')][_0x548b('0x54')],_0x1035f9[_0x548b('0x47')][_0x548b('0x51')]);return db[_0x548b('0x4a')]['create'](_0x1035f9['body'],{'include':[{'model':db[_0x548b('0x55')],'as':_0x548b('0x4f')},{'model':db[_0x548b('0x55')],'as':_0x548b('0x52')}]});}return null;})[_0x548b('0x23')](respondWithResult(_0x43999b,null))[_0x548b('0x43')](handleError(_0x43999b,null));};exports[_0x548b('0x56')]=function(_0x362e73,_0x5ad32e,_0xd4d7c0){var _0x449b67='';var _0x191080='';return db[_0x548b('0x3f')][_0x548b('0x49')]({'where':{'id':_0x362e73[_0x548b('0x44')]['id']},'attributes':['id','username',_0x548b('0x57'),'apiKey']})['then'](handleEntityNotFound(_0x5ad32e,null))[_0x548b('0x23')](function(_0x478233){if(_0x478233){_0x191080=_0x478233[_0x548b('0x58')];_0x449b67=_0x478233['remoteUri'];var _0x70396=_0x478233[_0x548b('0x57')][_0x548b('0x59')](-0x1);if(_0x70396==='/'){_0x449b67=_0x449b67[_0x548b('0x5a')](0x0,_0x449b67[_0x548b('0x5b')](_0x70396));}return rp({'method':_0x548b('0x5c'),'uri':util[_0x548b('0x5d')](_0x548b('0x5e'),_0x449b67,_0x548b('0x5f')),'headers':{'Authorization':'Token\x20token='+_0x478233[_0x548b('0x60')]},'json':!![]});}})[_0x548b('0x23')](function(_0xb9172c){if(_0xb9172c){var _0xf46bb8=_0xb9172c['users'];var _0x2a76f1=![];var _0x1e288a=null;for(_0x1e288a=0x0;_0x1e288a<_0xf46bb8[_0x548b('0x34')];_0x1e288a++){if(_0xf46bb8[_0x1e288a][_0x548b('0x61')]===_0x191080){_0x2a76f1=!![];}}if(_0x2a76f1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x548b('0x62')});}}})[_0x548b('0x23')](respondWithResult(_0x5ad32e,null))[_0x548b('0x43')](function(_0x59f8cb){var _0x1c09e1=_0x362e73[_0x548b('0x2f')][_0x548b('0x63')]?0x1f4:_0x59f8cb[_0x548b('0x64')]||0x1f4;logger[_0x548b('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1c09e1,JSON[_0x548b('0x65')](_0x59f8cb));delete _0x59f8cb['name'];if(_0x1c09e1===0x191){_0x1c09e1=0x190;}_0x5ad32e['status'](_0x1c09e1)[_0x548b('0x28')](_0x362e73['query'][_0x548b('0x63')]?{'message':_0x548b('0x66'),'statusCode':_0x59f8cb['statusCode']}:_0x59f8cb);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 51878e5..e81c7fd 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 _0x82c4=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','exports'];(function(_0x2fb4aa,_0x3df6c8){var _0x53f4a5=function(_0x17a47d){while(--_0x17a47d){_0x2fb4aa['push'](_0x2fb4aa['shift']());}};_0x53f4a5(++_0x3df6c8);}(_0x82c4,0x1ca));var _0x482c=function(_0x289c9d,_0x55993d){_0x289c9d=_0x289c9d-0x0;var _0x3b749c=_0x82c4[_0x289c9d];return _0x3b749c;};'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'));var integrations=require('../../components/integrations/configuration');module[_0x482c('0x9')]=function(_0x5d7c76,_0xfdb92){return _0x5d7c76[_0x482c('0xa')](_0x482c('0xb'),attributes,{'tableName':_0x482c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x152884,_0x293d90){var _0x11cb9c=function(_0x4012ec){while(--_0x4012ec){_0x152884['push'](_0x152884['shift']());}};_0x11cb9c(++_0x293d90);}(_0x9536,0x179));var _0x6953=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x9536[_0x256d6a];return _0x460058;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));var integrations=require(_0x6953('0x9'));module['exports']=function(_0x2b273e,_0x2bb026){return _0x2b273e[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 50337bd..d945bb5 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 _0x7b84=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','where','attributes','limit','map','model','include','GetFreshsalesAccount','ShowFreshsalesAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7b84,0x17c));var _0x47b8=function(_0xf3fbe5,_0x2843d5){_0xf3fbe5=_0xf3fbe5-0x0;var _0x58d4f7=_0x7b84[_0xf3fbe5];return _0x58d4f7;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('FreshsalesAccount,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['GetFreshsalesAccount']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['FreshsalesAccount']['findAll']({'raw':_0x4f7317['options']?_0x4f7317[_0x47b8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1b')]||null:null,'attributes':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1c')]||null:null,'limit':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1d')]||null:null,'include':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')]['include']?_[_0x47b8('0x1e')](_0x4f7317[_0x47b8('0x1a')]['include'],function(_0x22e7dd){return{'model':db[_0x22e7dd[_0x47b8('0x1f')]],'as':_0x22e7dd['as'],'attributes':_0x22e7dd[_0x47b8('0x1c')],'include':_0x22e7dd[_0x47b8('0x20')]?_['map'](_0x22e7dd[_0x47b8('0x20')],function(_0x332c23){return{'model':db[_0x332c23[_0x47b8('0x1f')]],'as':_0x332c23['as'],'attributes':_0x332c23[_0x47b8('0x1c')],'include':_0x332c23[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x332c23[_0x47b8('0x20')],function(_0x568c1e){return{'model':db[_0x568c1e[_0x47b8('0x1f')]],'as':_0x568c1e['as'],'attributes':_0x568c1e[_0x47b8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x195a66){logger[_0x47b8('0xf')](_0x47b8('0x21'),_0x4f7317);logger[_0x47b8('0x12')]('GetFreshsalesAccount',_0x4f7317,JSON[_0x47b8('0x14')](_0x195a66));_0x36faf1(_0x195a66);})['catch'](function(_0x2c89fc){logger[_0x47b8('0x15')](_0x47b8('0x21'),_0x2c89fc[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195['error'](0x1f4,_0x2c89fc[_0x47b8('0x17')]));});});};exports[_0x47b8('0x22')]=function(_0x402e7c){var _0x1b6c0a=this;return new Promise(function(_0x132f37,_0x197cb5){return db['FreshsalesAccount']['find']({'raw':_0x402e7c['options']?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x23')]===undefined?!![]:![]:!![],'where':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c['options']['where']||null:null,'attributes':_0x402e7c['options']?_0x402e7c['options'][_0x47b8('0x1c')]||null:null,'include':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')],function(_0x460dcc){return{'model':db[_0x460dcc[_0x47b8('0x1f')]],'as':_0x460dcc['as'],'attributes':_0x460dcc['attributes'],'include':_0x460dcc['include']?_[_0x47b8('0x1e')](_0x460dcc[_0x47b8('0x20')],function(_0x531dd2){return{'model':db[_0x531dd2['model']],'as':_0x531dd2['as'],'attributes':_0x531dd2[_0x47b8('0x1c')],'include':_0x531dd2[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x531dd2['include'],function(_0x240ab6){return{'model':db[_0x240ab6[_0x47b8('0x1f')]],'as':_0x240ab6['as'],'attributes':_0x240ab6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f1892){logger['info'](_0x47b8('0x22'),_0x402e7c);logger[_0x47b8('0x12')](_0x47b8('0x22'),_0x402e7c,JSON[_0x47b8('0x14')](_0x4f1892));_0x132f37(_0x4f1892);})[_0x47b8('0x19')](function(_0x3c24c1){logger['error']('ShowFreshsalesAccount',_0x3c24c1[_0x47b8('0x17')],_0x402e7c);_0x197cb5(_0x1b6c0a[_0x47b8('0x15')](0x1f4,_0x3c24c1[_0x47b8('0x17')]));});});}; \ No newline at end of file +var _0x0424=['info','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','model','map','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4f6111,_0x15ee70){var _0xa5ab97=function(_0xafc8f8){while(--_0xafc8f8){_0x4f6111['push'](_0x4f6111['shift']());}};_0xa5ab97(++_0x15ee70);}(_0x0424,0x159));var _0x4042=function(_0x461c18,_0x5605b9){_0x461c18=_0x461c18-0x0;var _0x35501c=_0x0424[_0x461c18];return _0x35501c;};'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')]('FreshsalesAccount,\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')]['findAll']({'raw':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x466077[_0x4042('0x17')]?_0x466077['options'][_0x4042('0x19')]||null:null,'attributes':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1a')]||null:null,'limit':_0x466077['options']?_0x466077[_0x4042('0x17')][_0x4042('0x1b')]||null:null,'include':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1c')]?_['map'](_0x466077[_0x4042('0x17')][_0x4042('0x1c')],function(_0x519f2c){return{'model':db[_0x519f2c[_0x4042('0x1d')]],'as':_0x519f2c['as'],'attributes':_0x519f2c['attributes'],'include':_0x519f2c[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x519f2c[_0x4042('0x1c')],function(_0x5d5c6d){return{'model':db[_0x5d5c6d[_0x4042('0x1d')]],'as':_0x5d5c6d['as'],'attributes':_0x5d5c6d[_0x4042('0x1a')],'include':_0x5d5c6d[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x5d5c6d[_0x4042('0x1c')],function(_0x52e575){return{'model':db[_0x52e575['model']],'as':_0x52e575['as'],'attributes':_0x52e575[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26542c){logger[_0x4042('0x12')](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('GetFreshsalesAccount',_0x466077,JSON[_0x4042('0xf')](_0x26542c));_0xe5c1ec(_0x26542c);})[_0x4042('0x14')](function(_0x4a6a6e){logger[_0x4042('0x10')](_0x4042('0x15'),_0x4a6a6e[_0x4042('0x11')],_0x466077);_0x4fe024(_0x4b02d4['error'](0x1f4,_0x4a6a6e['message']));});});};exports[_0x4042('0x1f')]=function(_0x43bd1c){var _0x59773f=this;return new Promise(function(_0x3e9304,_0xc42d70){return db[_0x4042('0x16')][_0x4042('0x20')]({'raw':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['where']||null:null,'attributes':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['attributes']||null:null,'include':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['include']?_[_0x4042('0x1e')](_0x43bd1c[_0x4042('0x17')][_0x4042('0x1c')],function(_0xaa7c99){return{'model':db[_0xaa7c99[_0x4042('0x1d')]],'as':_0xaa7c99['as'],'attributes':_0xaa7c99[_0x4042('0x1a')],'include':_0xaa7c99[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0xaa7c99[_0x4042('0x1c')],function(_0x37195b){return{'model':db[_0x37195b[_0x4042('0x1d')]],'as':_0x37195b['as'],'attributes':_0x37195b[_0x4042('0x1a')],'include':_0x37195b[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x37195b[_0x4042('0x1c')],function(_0x2b5f5e){return{'model':db[_0x2b5f5e[_0x4042('0x1d')]],'as':_0x2b5f5e['as'],'attributes':_0x2b5f5e[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26b7b0){logger[_0x4042('0x12')]('ShowFreshsalesAccount',_0x43bd1c);logger[_0x4042('0xd')](_0x4042('0x1f'),_0x43bd1c,JSON[_0x4042('0xf')](_0x26b7b0));_0x3e9304(_0x26b7b0);})[_0x4042('0x14')](function(_0x588932){logger[_0x4042('0x10')](_0x4042('0x1f'),_0x588932[_0x4042('0x11')],_0x43bd1c);_0xc42d70(_0x59773f[_0x4042('0x10')](0x1f4,_0x588932[_0x4042('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 0032b7e..c2182d3 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 _0x5919=['getDescriptions','/:id/fields','post','create','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3ec6e4,_0x3075bf){var _0x575e09=function(_0x312a51){while(--_0x312a51){_0x3ec6e4['push'](_0x3ec6e4['shift']());}};_0x575e09(++_0x3075bf);}(_0x5919,0xe8));var _0x9591=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x5919[_0x4fa291];return _0x506d9b;};'use strict';var multer=require(_0x9591('0x0'));var util=require(_0x9591('0x1'));var path=require(_0x9591('0x2'));var timeout=require('connect-timeout');var express=require(_0x9591('0x3'));var router=express[_0x9591('0x4')]();var fs_extra=require(_0x9591('0x5'));var auth=require(_0x9591('0x6'));var interaction=require(_0x9591('0x7'));var config=require(_0x9591('0x8'));var controller=require(_0x9591('0x9'));router[_0x9591('0xa')]('/',auth['isAuthenticated'](),controller[_0x9591('0xb')]);router['get'](_0x9591('0xc'),auth[_0x9591('0xd')](),controller[_0x9591('0xe')]);router['get'](_0x9591('0xf'),auth[_0x9591('0xd')](),controller[_0x9591('0x10')]);router[_0x9591('0xa')](_0x9591('0x11'),auth[_0x9591('0xd')](),controller[_0x9591('0x12')]);router[_0x9591('0xa')](_0x9591('0x13'),auth[_0x9591('0xd')](),controller['getFields']);router[_0x9591('0x14')]('/',auth[_0x9591('0xd')](),controller[_0x9591('0x15')]);router[_0x9591('0x16')](_0x9591('0xc'),auth[_0x9591('0xd')](),controller['update']);router[_0x9591('0x17')](_0x9591('0xc'),auth[_0x9591('0xd')](),controller['destroy']);module[_0x9591('0x18')]=router; \ No newline at end of file +var _0x9de5=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9de5,0x12a));var _0x59de=function(_0x4ccda3,_0x45bcdc){_0x4ccda3=_0x4ccda3-0x0;var _0x23bc6c=_0x9de5[_0x4ccda3];return _0x23bc6c;};'use strict';var multer=require(_0x59de('0x0'));var util=require(_0x59de('0x1'));var path=require(_0x59de('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x59de('0x3'));var auth=require(_0x59de('0x4'));var interaction=require(_0x59de('0x5'));var config=require('../../config/environment');var controller=require(_0x59de('0x6'));router[_0x59de('0x7')]('/',auth[_0x59de('0x8')](),controller[_0x59de('0x9')]);router['get'](_0x59de('0xa'),auth[_0x59de('0x8')](),controller[_0x59de('0xb')]);router[_0x59de('0x7')](_0x59de('0xc'),auth[_0x59de('0x8')](),controller[_0x59de('0xd')]);router[_0x59de('0x7')]('/:id/descriptions',auth[_0x59de('0x8')](),controller[_0x59de('0xe')]);router[_0x59de('0x7')](_0x59de('0xf'),auth['isAuthenticated'](),controller[_0x59de('0x10')]);router[_0x59de('0x11')]('/',auth[_0x59de('0x8')](),controller[_0x59de('0x12')]);router[_0x59de('0x13')](_0x59de('0xa'),auth[_0x59de('0x8')](),controller[_0x59de('0x14')]);router[_0x59de('0x15')](_0x59de('0xa'),auth['isAuthenticated'](),controller[_0x59de('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index e7f9451..8b8912c 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 _0xee27=['exports'];(function(_0x5bbc6d,_0x12fe93){var _0x5c9a99=function(_0x5d2d68){while(--_0x5d2d68){_0x5bbc6d['push'](_0x5bbc6d['shift']());}};_0x5c9a99(++_0x12fe93);}(_0xee27,0x13b));var _0x7ee2=function(_0x2fb5c6,_0x4680d3){_0x2fb5c6=_0x2fb5c6-0x0;var _0x12c174=_0xee27[_0x2fb5c6];return _0x12c174;};'use strict';var Sequelize=require('sequelize');module[_0x7ee2('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x77ee=['exports','STRING','sequelize'];(function(_0x53704d,_0xff1d89){var _0xf2c0f8=function(_0x5c3af3){while(--_0x5c3af3){_0x53704d['push'](_0x53704d['shift']());}};_0xf2c0f8(++_0xff1d89);}(_0x77ee,0xe9));var _0xe77e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x77ee[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xe77e('0x0'));module[_0xe77e('0x1')]={'name':{'type':Sequelize[_0xe77e('0x2')]},'description':{'type':Sequelize[_0xe77e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 69ca9fb..edc1749 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 _0x3531=['includeAll','include','show','params','find','create','body','catch','getSubjects','findOne','options','getDescriptions','getFields','FreshsalesField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL'];(function(_0x44e7b9,_0xf7f5cc){var _0x1de7ac=function(_0x307551){while(--_0x307551){_0x44e7b9['push'](_0x44e7b9['shift']());}};_0x1de7ac(++_0xf7f5cc);}(_0x3531,0xfe));var _0x1353=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3531[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x1353('0x0'));var rimraf=require(_0x1353('0x1'));var zipdir=require(_0x1353('0x2'));var jsonpatch=require(_0x1353('0x3'));var rp=require(_0x1353('0x4'));var moment=require(_0x1353('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1353('0x6'));var util=require(_0x1353('0x7'));var path=require(_0x1353('0x8'));var sox=require(_0x1353('0x9'));var csv=require(_0x1353('0xa'));var ejs=require(_0x1353('0xb'));var fs=require('fs');var fs_extra=require(_0x1353('0xc'));var _=require(_0x1353('0xd'));var squel=require(_0x1353('0xe'));var crypto=require('crypto');var jsforce=require(_0x1353('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1353('0x10'));var Papa=require(_0x1353('0x11'));var Redis=require(_0x1353('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1353('0x13'));var hardwareService=require(_0x1353('0x14'));var logger=require(_0x1353('0x15'))('api');var utils=require(_0x1353('0x16'));var config=require(_0x1353('0x17'));var licenseUtil=require(_0x1353('0x18'));var db=require(_0x1353('0x19'))['db'];function respondWithStatusCode(_0xbf561c,_0x109ce8){_0x109ce8=_0x109ce8||0xcc;return function(_0x3eae5e){if(_0x3eae5e){return _0xbf561c[_0x1353('0x1a')](_0x109ce8);}return _0xbf561c[_0x1353('0x1b')](_0x109ce8)[_0x1353('0x1c')]();};}function respondWithResult(_0x105fb8,_0x21f980){_0x21f980=_0x21f980||0xc8;return function(_0xe60037){if(_0xe60037){return _0x105fb8['status'](_0x21f980)[_0x1353('0x1d')](_0xe60037);}};}function respondWithFilteredResult(_0xd90128,_0x479428){return function(_0x52b7ef){if(_0x52b7ef){var _0x1d599f=typeof _0x479428['offset']==='undefined'&&typeof _0x479428[_0x1353('0x1e')]==='undefined';var _0x22b472=_0x52b7ef['count'];var _0x4d4dbc=_0x1d599f?0x0:_0x479428[_0x1353('0x1f')];var _0x157b38=_0x1d599f?_0x52b7ef[_0x1353('0x20')]:_0x479428['offset']+_0x479428[_0x1353('0x1e')];var _0x5b1f95;if(_0x157b38>=_0x22b472){_0x157b38=_0x22b472;_0x5b1f95=0xc8;}else{_0x5b1f95=0xce;}_0xd90128['status'](_0x5b1f95);return _0xd90128[_0x1353('0x21')]('Content-Range',_0x4d4dbc+'-'+_0x157b38+'/'+_0x22b472)[_0x1353('0x1d')](_0x52b7ef);}return null;};}function patchUpdates(_0x4c0b10){return function(_0x1328fb){try{jsonpatch[_0x1353('0x22')](_0x1328fb,_0x4c0b10,!![]);}catch(_0x51508b){return BPromise[_0x1353('0x23')](_0x51508b);}return _0x1328fb[_0x1353('0x24')]();};}function saveUpdates(_0xfdd52f,_0x12047f){return function(_0x5bf960){if(_0x5bf960){return _0x5bf960[_0x1353('0x25')](_0xfdd52f)[_0x1353('0x26')](function(_0x70325){return _0x70325;});}return null;};}function removeEntity(_0x4feccf,_0x41e5a3){return function(_0x3538ab){if(_0x3538ab){return _0x3538ab[_0x1353('0x27')]()[_0x1353('0x26')](function(){_0x4feccf[_0x1353('0x1b')](0xcc)[_0x1353('0x1c')]();});}};}function handleEntityNotFound(_0x118ea0,_0x330369){return function(_0x38b8b6){if(!_0x38b8b6){_0x118ea0[_0x1353('0x1a')](0x194);}return _0x38b8b6;};}function handleError(_0xb7d8ab,_0x549ae9){_0x549ae9=_0x549ae9||0x1f4;return function(_0x125e90){logger[_0x1353('0x28')](_0x125e90[_0x1353('0x29')]);if(_0x125e90[_0x1353('0x2a')]){delete _0x125e90[_0x1353('0x2a')];}_0xb7d8ab[_0x1353('0x1b')](_0x549ae9)['send'](_0x125e90);};}exports[_0x1353('0x2b')]=function(_0x18625f,_0x52643d){var _0x5437c6={},_0x4abbe7={},_0x2b7ab7={'count':0x0,'rows':[]};var _0x3ec948=_['map'](db[_0x1353('0x2c')][_0x1353('0x2d')],function(_0x5ea183){return{'name':_0x5ea183[_0x1353('0x2e')],'type':_0x5ea183[_0x1353('0x2f')]['key']};});_0x4abbe7[_0x1353('0x30')]=_['map'](_0x3ec948,_0x1353('0x2a'));_0x4abbe7[_0x1353('0x31')]=_[_0x1353('0x32')](_0x18625f['query']);_0x4abbe7['filters']=_[_0x1353('0x33')](_0x4abbe7['model'],_0x4abbe7['query']);_0x5437c6['attributes']=_[_0x1353('0x33')](_0x4abbe7['model'],qs['fields'](_0x18625f[_0x1353('0x31')][_0x1353('0x34')]));_0x5437c6[_0x1353('0x35')]=_0x5437c6['attributes'][_0x1353('0x36')]?_0x5437c6[_0x1353('0x35')]:_0x4abbe7['model'];if(!_0x18625f[_0x1353('0x31')][_0x1353('0x37')](_0x1353('0x38'))){_0x5437c6[_0x1353('0x1e')]=qs['limit'](_0x18625f[_0x1353('0x31')][_0x1353('0x1e')]);_0x5437c6[_0x1353('0x1f')]=qs[_0x1353('0x1f')](_0x18625f[_0x1353('0x31')][_0x1353('0x1f')]);}_0x5437c6[_0x1353('0x39')]=qs[_0x1353('0x3a')](_0x18625f['query'][_0x1353('0x3a')]);_0x5437c6[_0x1353('0x3b')]=qs[_0x1353('0x3c')](_[_0x1353('0x3d')](_0x18625f[_0x1353('0x31')],_0x4abbe7[_0x1353('0x3c')]),_0x3ec948);if(_0x18625f[_0x1353('0x31')][_0x1353('0x3e')]){_0x5437c6[_0x1353('0x3b')]=_[_0x1353('0x3f')](_0x5437c6['where'],{'$or':_[_0x1353('0x40')](_0x3ec948,function(_0x696971){if(_0x696971[_0x1353('0x2f')]!==_0x1353('0x41')){var _0x4fb9de={};_0x4fb9de[_0x696971['name']]={'$like':'%'+_0x18625f['query'][_0x1353('0x3e')]+'%'};return _0x4fb9de;}})});}_0x5437c6=_[_0x1353('0x3f')]({},_0x5437c6,_0x18625f['options']);var _0x46b9d9={'where':_0x5437c6[_0x1353('0x3b')]};return db['FreshsalesConfiguration'][_0x1353('0x20')](_0x46b9d9)[_0x1353('0x26')](function(_0x24fef9){_0x2b7ab7[_0x1353('0x20')]=_0x24fef9;if(_0x18625f[_0x1353('0x31')][_0x1353('0x42')]){_0x5437c6[_0x1353('0x43')]=[{'all':!![]}];}return db[_0x1353('0x2c')]['findAll'](_0x5437c6);})[_0x1353('0x26')](function(_0x12df64){_0x2b7ab7['rows']=_0x12df64;return _0x2b7ab7;})[_0x1353('0x26')](respondWithFilteredResult(_0x52643d,_0x5437c6))['catch'](handleError(_0x52643d,null));};exports[_0x1353('0x44')]=function(_0x5881b7,_0x521051){var _0x462565={'raw':![],'where':{'id':_0x5881b7[_0x1353('0x45')]['id']}},_0x42daf8={};_0x42daf8[_0x1353('0x30')]=_['keys'](db['FreshsalesConfiguration'][_0x1353('0x2d')]);_0x42daf8['query']=_[_0x1353('0x32')](_0x5881b7[_0x1353('0x31')]);_0x42daf8['filters']=_['intersection'](_0x42daf8['model'],_0x42daf8[_0x1353('0x31')]);_0x462565[_0x1353('0x35')]=_[_0x1353('0x33')](_0x42daf8[_0x1353('0x30')],qs[_0x1353('0x34')](_0x5881b7[_0x1353('0x31')][_0x1353('0x34')]));_0x462565[_0x1353('0x35')]=_0x462565[_0x1353('0x35')][_0x1353('0x36')]?_0x462565['attributes']:_0x42daf8[_0x1353('0x30')];if(_0x5881b7[_0x1353('0x31')][_0x1353('0x42')]){_0x462565[_0x1353('0x43')]=[{'all':!![]}];}_0x462565=_[_0x1353('0x3f')]({},_0x462565,_0x5881b7['options']);return db[_0x1353('0x2c')][_0x1353('0x46')](_0x462565)[_0x1353('0x26')](handleEntityNotFound(_0x521051,null))['then'](respondWithResult(_0x521051,null))['catch'](handleError(_0x521051,null));};exports[_0x1353('0x47')]=function(_0x4224f6,_0x5ac302){return db[_0x1353('0x2c')][_0x1353('0x47')](_0x4224f6[_0x1353('0x48')],{})[_0x1353('0x26')](respondWithResult(_0x5ac302,0xc9))['catch'](handleError(_0x5ac302,null));};exports[_0x1353('0x25')]=function(_0x54e3e6,_0x1f36ca){if(_0x54e3e6[_0x1353('0x48')]['id']){delete _0x54e3e6[_0x1353('0x48')]['id'];}return db[_0x1353('0x2c')][_0x1353('0x46')]({'where':{'id':_0x54e3e6[_0x1353('0x45')]['id']}})[_0x1353('0x26')](handleEntityNotFound(_0x1f36ca,null))[_0x1353('0x26')](saveUpdates(_0x54e3e6[_0x1353('0x48')],null))['then'](respondWithResult(_0x1f36ca,null))[_0x1353('0x49')](handleError(_0x1f36ca,null));};exports['destroy']=function(_0x100afd,_0x4bce7f){return db[_0x1353('0x2c')][_0x1353('0x46')]({'where':{'id':_0x100afd[_0x1353('0x45')]['id']}})[_0x1353('0x26')](handleEntityNotFound(_0x4bce7f,null))['then'](removeEntity(_0x4bce7f,null))['catch'](handleError(_0x4bce7f,null));};exports[_0x1353('0x4a')]=function(_0x3dd0da,_0x4b1864,_0x2baeaa){var _0x3b55c1={};var _0x560bc4={};var _0x3091aa;var _0x24e31e;return db[_0x1353('0x2c')][_0x1353('0x4b')]({'where':{'id':_0x3dd0da[_0x1353('0x45')]['id']}})[_0x1353('0x26')](handleEntityNotFound(_0x4b1864,null))[_0x1353('0x26')](function(_0x1b9979){if(_0x1b9979){_0x3091aa=_0x1b9979;_0x560bc4[_0x1353('0x30')]=_['keys'](db['FreshsalesField'][_0x1353('0x2d')]);_0x560bc4[_0x1353('0x31')]=_[_0x1353('0x32')](_0x3dd0da[_0x1353('0x31')]);_0x560bc4['filters']=_[_0x1353('0x33')](_0x560bc4[_0x1353('0x30')],_0x560bc4[_0x1353('0x31')]);_0x3b55c1[_0x1353('0x35')]=_[_0x1353('0x33')](_0x560bc4[_0x1353('0x30')],qs['fields'](_0x3dd0da[_0x1353('0x31')]['fields']));_0x3b55c1[_0x1353('0x35')]=_0x3b55c1['attributes'][_0x1353('0x36')]?_0x3b55c1[_0x1353('0x35')]:_0x560bc4[_0x1353('0x30')];_0x3b55c1['order']=qs['sort'](_0x3dd0da[_0x1353('0x31')][_0x1353('0x3a')]);_0x3b55c1[_0x1353('0x3b')]=qs[_0x1353('0x3c')](_[_0x1353('0x3d')](_0x3dd0da[_0x1353('0x31')],_0x560bc4[_0x1353('0x3c')]));if(_0x3dd0da[_0x1353('0x31')]['filter']){_0x3b55c1[_0x1353('0x3b')]=_[_0x1353('0x3f')](_0x3b55c1['where'],{'$or':_[_0x1353('0x40')](_0x3b55c1[_0x1353('0x35')],function(_0x2a6e32){var _0xcbecef={};_0xcbecef[_0x2a6e32]={'$like':'%'+_0x3dd0da[_0x1353('0x31')][_0x1353('0x3e')]+'%'};return _0xcbecef;})});}_0x3b55c1=_[_0x1353('0x3f')]({},_0x3b55c1,_0x3dd0da[_0x1353('0x4c')]);return _0x3091aa['getSubjects'](_0x3b55c1);}})[_0x1353('0x26')](function(_0x473379){if(_0x473379){_0x24e31e=_0x473379[_0x1353('0x36')];if(!_0x3dd0da['query']['hasOwnProperty'](_0x1353('0x38'))){_0x3b55c1[_0x1353('0x1e')]=qs['limit'](_0x3dd0da[_0x1353('0x31')][_0x1353('0x1e')]);_0x3b55c1[_0x1353('0x1f')]=qs['offset'](_0x3dd0da[_0x1353('0x31')][_0x1353('0x1f')]);}return _0x3091aa[_0x1353('0x4a')](_0x3b55c1);}})[_0x1353('0x26')](function(_0x54d48f){if(_0x54d48f){return _0x54d48f?{'count':_0x24e31e,'rows':_0x54d48f}:null;}})[_0x1353('0x26')](respondWithResult(_0x4b1864,null))['catch'](handleError(_0x4b1864,null));};exports['getDescriptions']=function(_0x1ae4fd,_0x3af36b,_0x36a35f){var _0x229114={};var _0x186121={};var _0xf7c29c;var _0x515735;return db[_0x1353('0x2c')][_0x1353('0x4b')]({'where':{'id':_0x1ae4fd['params']['id']}})[_0x1353('0x26')](handleEntityNotFound(_0x3af36b,null))[_0x1353('0x26')](function(_0x9dd215){if(_0x9dd215){_0xf7c29c=_0x9dd215;_0x186121[_0x1353('0x30')]=_[_0x1353('0x32')](db['FreshsalesField'][_0x1353('0x2d')]);_0x186121[_0x1353('0x31')]=_[_0x1353('0x32')](_0x1ae4fd[_0x1353('0x31')]);_0x186121[_0x1353('0x3c')]=_[_0x1353('0x33')](_0x186121['model'],_0x186121[_0x1353('0x31')]);_0x229114[_0x1353('0x35')]=_['intersection'](_0x186121['model'],qs['fields'](_0x1ae4fd[_0x1353('0x31')][_0x1353('0x34')]));_0x229114[_0x1353('0x35')]=_0x229114[_0x1353('0x35')][_0x1353('0x36')]?_0x229114[_0x1353('0x35')]:_0x186121[_0x1353('0x30')];_0x229114['order']=qs['sort'](_0x1ae4fd['query'][_0x1353('0x3a')]);_0x229114['where']=qs[_0x1353('0x3c')](_[_0x1353('0x3d')](_0x1ae4fd[_0x1353('0x31')],_0x186121[_0x1353('0x3c')]));if(_0x1ae4fd[_0x1353('0x31')][_0x1353('0x3e')]){_0x229114[_0x1353('0x3b')]=_[_0x1353('0x3f')](_0x229114[_0x1353('0x3b')],{'$or':_['map'](_0x229114[_0x1353('0x35')],function(_0x5b7c78){var _0x11dfbd={};_0x11dfbd[_0x5b7c78]={'$like':'%'+_0x1ae4fd[_0x1353('0x31')][_0x1353('0x3e')]+'%'};return _0x11dfbd;})});}_0x229114=_[_0x1353('0x3f')]({},_0x229114,_0x1ae4fd[_0x1353('0x4c')]);return _0xf7c29c[_0x1353('0x4d')](_0x229114);}})['then'](function(_0x3792d3){if(_0x3792d3){_0x515735=_0x3792d3[_0x1353('0x36')];if(!_0x1ae4fd['query'][_0x1353('0x37')](_0x1353('0x38'))){_0x229114[_0x1353('0x1e')]=qs['limit'](_0x1ae4fd[_0x1353('0x31')][_0x1353('0x1e')]);_0x229114[_0x1353('0x1f')]=qs[_0x1353('0x1f')](_0x1ae4fd[_0x1353('0x31')][_0x1353('0x1f')]);}return _0xf7c29c[_0x1353('0x4d')](_0x229114);}})[_0x1353('0x26')](function(_0x29ea5d){if(_0x29ea5d){return _0x29ea5d?{'count':_0x515735,'rows':_0x29ea5d}:null;}})['then'](respondWithResult(_0x3af36b,null))[_0x1353('0x49')](handleError(_0x3af36b,null));};exports[_0x1353('0x4e')]=function(_0x4a1df1,_0xf6801f,_0x3e71be){var _0x4d0455={};var _0x5a5409={};var _0x54dfe9;var _0x459c7a;return db[_0x1353('0x2c')]['findOne']({'where':{'id':_0x4a1df1[_0x1353('0x45')]['id']}})[_0x1353('0x26')](handleEntityNotFound(_0xf6801f,null))[_0x1353('0x26')](function(_0x4404e4){if(_0x4404e4){_0x54dfe9=_0x4404e4;_0x5a5409[_0x1353('0x30')]=_[_0x1353('0x32')](db[_0x1353('0x4f')][_0x1353('0x2d')]);_0x5a5409[_0x1353('0x31')]=_[_0x1353('0x32')](_0x4a1df1[_0x1353('0x31')]);_0x5a5409[_0x1353('0x3c')]=_[_0x1353('0x33')](_0x5a5409[_0x1353('0x30')],_0x5a5409[_0x1353('0x31')]);_0x4d0455['attributes']=_[_0x1353('0x33')](_0x5a5409[_0x1353('0x30')],qs[_0x1353('0x34')](_0x4a1df1[_0x1353('0x31')][_0x1353('0x34')]));_0x4d0455[_0x1353('0x35')]=_0x4d0455[_0x1353('0x35')]['length']?_0x4d0455[_0x1353('0x35')]:_0x5a5409['model'];_0x4d0455[_0x1353('0x39')]=qs['sort'](_0x4a1df1['query'][_0x1353('0x3a')]);_0x4d0455[_0x1353('0x3b')]=qs[_0x1353('0x3c')](_['pick'](_0x4a1df1[_0x1353('0x31')],_0x5a5409[_0x1353('0x3c')]));if(_0x4a1df1[_0x1353('0x31')][_0x1353('0x3e')]){_0x4d0455[_0x1353('0x3b')]=_['merge'](_0x4d0455[_0x1353('0x3b')],{'$or':_[_0x1353('0x40')](_0x4d0455[_0x1353('0x35')],function(_0x2a8105){var _0x340770={};_0x340770[_0x2a8105]={'$like':'%'+_0x4a1df1[_0x1353('0x31')][_0x1353('0x3e')]+'%'};return _0x340770;})});}_0x4d0455=_[_0x1353('0x3f')]({},_0x4d0455,_0x4a1df1[_0x1353('0x4c')]);return _0x54dfe9['getFields'](_0x4d0455);}})['then'](function(_0xb9d2bf){if(_0xb9d2bf){_0x459c7a=_0xb9d2bf[_0x1353('0x36')];if(!_0x4a1df1[_0x1353('0x31')][_0x1353('0x37')](_0x1353('0x38'))){_0x4d0455['limit']=qs[_0x1353('0x1e')](_0x4a1df1[_0x1353('0x31')][_0x1353('0x1e')]);_0x4d0455[_0x1353('0x1f')]=qs[_0x1353('0x1f')](_0x4a1df1[_0x1353('0x31')][_0x1353('0x1f')]);}return _0x54dfe9[_0x1353('0x4e')](_0x4d0455);}})[_0x1353('0x26')](function(_0x5e9829){if(_0x5e9829){return _0x5e9829?{'count':_0x459c7a,'rows':_0x5e9829}:null;}})[_0x1353('0x26')](respondWithResult(_0xf6801f,null))[_0x1353('0x49')](handleError(_0xf6801f,null));}; \ No newline at end of file +var _0x0217=['intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','body','getSubjects','FreshsalesField','options','getDescriptions','findOne','getFields','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','name','index','FreshsalesConfiguration','type','map','filters','model','query','attributes'];(function(_0x4e9e17,_0x213114){var _0x113231=function(_0x21c9dd){while(--_0x21c9dd){_0x4e9e17['push'](_0x4e9e17['shift']());}};_0x113231(++_0x213114);}(_0x0217,0xba));var _0x7021=function(_0x5613f8,_0xf4b746){_0x5613f8=_0x5613f8-0x0;var _0x3a9f63=_0x0217[_0x5613f8];return _0x3a9f63;};'use strict';var emlformat=require(_0x7021('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7021('0x1'));var moment=require(_0x7021('0x2'));var BPromise=require(_0x7021('0x3'));var Mustache=require(_0x7021('0x4'));var util=require(_0x7021('0x5'));var path=require(_0x7021('0x6'));var sox=require(_0x7021('0x7'));var csv=require(_0x7021('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7021('0x9'));var _=require(_0x7021('0xa'));var squel=require(_0x7021('0xb'));var crypto=require(_0x7021('0xc'));var jsforce=require(_0x7021('0xd'));var deskjs=require(_0x7021('0xe'));var toCsv=require(_0x7021('0x8'));var querystring=require(_0x7021('0xf'));var Papa=require(_0x7021('0x10'));var Redis=require(_0x7021('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7021('0x12'));var as=require(_0x7021('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7021('0x14'))(_0x7021('0x15'));var utils=require(_0x7021('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7021('0x17'));var db=require(_0x7021('0x18'))['db'];function respondWithStatusCode(_0x139eb9,_0x32033b){_0x32033b=_0x32033b||0xcc;return function(_0x34b00c){if(_0x34b00c){return _0x139eb9[_0x7021('0x19')](_0x32033b);}return _0x139eb9[_0x7021('0x1a')](_0x32033b)['end']();};}function respondWithResult(_0x429c4f,_0x45e3b0){_0x45e3b0=_0x45e3b0||0xc8;return function(_0x1a60b2){if(_0x1a60b2){return _0x429c4f[_0x7021('0x1a')](_0x45e3b0)[_0x7021('0x1b')](_0x1a60b2);}};}function respondWithFilteredResult(_0x3fb7b9,_0x44e72c){return function(_0x577290){if(_0x577290){var _0x4b403=typeof _0x44e72c[_0x7021('0x1c')]===_0x7021('0x1d')&&typeof _0x44e72c['limit']===_0x7021('0x1d');var _0x405af7=_0x577290[_0x7021('0x1e')];var _0x5a1669=_0x4b403?0x0:_0x44e72c['offset'];var _0x596932=_0x4b403?_0x577290[_0x7021('0x1e')]:_0x44e72c[_0x7021('0x1c')]+_0x44e72c[_0x7021('0x1f')];var _0x169846;if(_0x596932>=_0x405af7){_0x596932=_0x405af7;_0x169846=0xc8;}else{_0x169846=0xce;}_0x3fb7b9['status'](_0x169846);return _0x3fb7b9[_0x7021('0x20')]('Content-Range',_0x5a1669+'-'+_0x596932+'/'+_0x405af7)['json'](_0x577290);}return null;};}function patchUpdates(_0x35a896){return function(_0x5da989){try{jsonpatch[_0x7021('0x21')](_0x5da989,_0x35a896,!![]);}catch(_0x55f9f2){return BPromise[_0x7021('0x22')](_0x55f9f2);}return _0x5da989[_0x7021('0x23')]();};}function saveUpdates(_0x115335,_0x3eef8b){return function(_0x33882f){if(_0x33882f){return _0x33882f[_0x7021('0x24')](_0x115335)[_0x7021('0x25')](function(_0x14092e){return _0x14092e;});}return null;};}function removeEntity(_0xfa6b2,_0xa6d75a){return function(_0xd17b6d){if(_0xd17b6d){return _0xd17b6d[_0x7021('0x26')]()[_0x7021('0x25')](function(){_0xfa6b2[_0x7021('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e611d,_0x8f8422){return function(_0x85d052){if(!_0x85d052){_0x4e611d[_0x7021('0x19')](0x194);}return _0x85d052;};}function handleError(_0x5cc72e,_0x520ffa){_0x520ffa=_0x520ffa||0x1f4;return function(_0x4cd921){logger['error'](_0x4cd921['stack']);if(_0x4cd921[_0x7021('0x27')]){delete _0x4cd921[_0x7021('0x27')];}_0x5cc72e['status'](_0x520ffa)['send'](_0x4cd921);};}exports[_0x7021('0x28')]=function(_0x2717ff,_0x21b243){var _0x594d33={},_0x52eaa1={},_0x47c48f={'count':0x0,'rows':[]};var _0xeade73=_['map'](db[_0x7021('0x29')]['rawAttributes'],function(_0x18eceb){return{'name':_0x18eceb['fieldName'],'type':_0x18eceb[_0x7021('0x2a')]['key']};});_0x52eaa1['model']=_[_0x7021('0x2b')](_0xeade73,_0x7021('0x27'));_0x52eaa1['query']=_['keys'](_0x2717ff['query']);_0x52eaa1[_0x7021('0x2c')]=_['intersection'](_0x52eaa1[_0x7021('0x2d')],_0x52eaa1[_0x7021('0x2e')]);_0x594d33[_0x7021('0x2f')]=_[_0x7021('0x30')](_0x52eaa1[_0x7021('0x2d')],qs['fields'](_0x2717ff[_0x7021('0x2e')]['fields']));_0x594d33['attributes']=_0x594d33['attributes'][_0x7021('0x31')]?_0x594d33[_0x7021('0x2f')]:_0x52eaa1[_0x7021('0x2d')];if(!_0x2717ff['query'][_0x7021('0x32')](_0x7021('0x33'))){_0x594d33['limit']=qs['limit'](_0x2717ff[_0x7021('0x2e')]['limit']);_0x594d33[_0x7021('0x1c')]=qs['offset'](_0x2717ff[_0x7021('0x2e')][_0x7021('0x1c')]);}_0x594d33[_0x7021('0x34')]=qs[_0x7021('0x35')](_0x2717ff[_0x7021('0x2e')]['sort']);_0x594d33[_0x7021('0x36')]=qs[_0x7021('0x2c')](_[_0x7021('0x37')](_0x2717ff[_0x7021('0x2e')],_0x52eaa1['filters']),_0xeade73);if(_0x2717ff[_0x7021('0x2e')][_0x7021('0x38')]){_0x594d33[_0x7021('0x36')]=_[_0x7021('0x39')](_0x594d33[_0x7021('0x36')],{'$or':_['map'](_0xeade73,function(_0x47741b){if(_0x47741b[_0x7021('0x2a')]!==_0x7021('0x3a')){var _0x2108f4={};_0x2108f4[_0x47741b[_0x7021('0x27')]]={'$like':'%'+_0x2717ff[_0x7021('0x2e')]['filter']+'%'};return _0x2108f4;}})});}_0x594d33=_[_0x7021('0x39')]({},_0x594d33,_0x2717ff['options']);var _0x3c44d3={'where':_0x594d33[_0x7021('0x36')]};return db[_0x7021('0x29')][_0x7021('0x1e')](_0x3c44d3)['then'](function(_0x2568dc){_0x47c48f['count']=_0x2568dc;if(_0x2717ff[_0x7021('0x2e')][_0x7021('0x3b')]){_0x594d33[_0x7021('0x3c')]=[{'all':!![]}];}return db[_0x7021('0x29')][_0x7021('0x3d')](_0x594d33);})[_0x7021('0x25')](function(_0x562ce9){_0x47c48f[_0x7021('0x3e')]=_0x562ce9;return _0x47c48f;})[_0x7021('0x25')](respondWithFilteredResult(_0x21b243,_0x594d33))[_0x7021('0x3f')](handleError(_0x21b243,null));};exports[_0x7021('0x40')]=function(_0x2f5569,_0x2d2a92){var _0x37f86d={'raw':![],'where':{'id':_0x2f5569[_0x7021('0x41')]['id']}},_0x116ba4={};_0x116ba4[_0x7021('0x2d')]=_[_0x7021('0x42')](db[_0x7021('0x29')][_0x7021('0x43')]);_0x116ba4['query']=_['keys'](_0x2f5569['query']);_0x116ba4['filters']=_[_0x7021('0x30')](_0x116ba4['model'],_0x116ba4[_0x7021('0x2e')]);_0x37f86d[_0x7021('0x2f')]=_['intersection'](_0x116ba4[_0x7021('0x2d')],qs[_0x7021('0x44')](_0x2f5569[_0x7021('0x2e')]['fields']));_0x37f86d[_0x7021('0x2f')]=_0x37f86d[_0x7021('0x2f')][_0x7021('0x31')]?_0x37f86d[_0x7021('0x2f')]:_0x116ba4[_0x7021('0x2d')];if(_0x2f5569[_0x7021('0x2e')][_0x7021('0x3b')]){_0x37f86d[_0x7021('0x3c')]=[{'all':!![]}];}_0x37f86d=_[_0x7021('0x39')]({},_0x37f86d,_0x2f5569['options']);return db['FreshsalesConfiguration'][_0x7021('0x45')](_0x37f86d)[_0x7021('0x25')](handleEntityNotFound(_0x2d2a92,null))[_0x7021('0x25')](respondWithResult(_0x2d2a92,null))[_0x7021('0x3f')](handleError(_0x2d2a92,null));};exports['create']=function(_0xacdc86,_0x48bbf5){return db[_0x7021('0x29')][_0x7021('0x46')](_0xacdc86[_0x7021('0x47')],{})[_0x7021('0x25')](respondWithResult(_0x48bbf5,0xc9))['catch'](handleError(_0x48bbf5,null));};exports[_0x7021('0x24')]=function(_0x50c92f,_0x2d8ceb){if(_0x50c92f['body']['id']){delete _0x50c92f['body']['id'];}return db[_0x7021('0x29')][_0x7021('0x45')]({'where':{'id':_0x50c92f[_0x7021('0x41')]['id']}})[_0x7021('0x25')](handleEntityNotFound(_0x2d8ceb,null))[_0x7021('0x25')](saveUpdates(_0x50c92f[_0x7021('0x47')],null))[_0x7021('0x25')](respondWithResult(_0x2d8ceb,null))[_0x7021('0x3f')](handleError(_0x2d8ceb,null));};exports[_0x7021('0x26')]=function(_0x31693e,_0x3747a2){return db[_0x7021('0x29')][_0x7021('0x45')]({'where':{'id':_0x31693e['params']['id']}})[_0x7021('0x25')](handleEntityNotFound(_0x3747a2,null))[_0x7021('0x25')](removeEntity(_0x3747a2,null))[_0x7021('0x3f')](handleError(_0x3747a2,null));};exports[_0x7021('0x48')]=function(_0x5aeef3,_0x6103a4,_0x442a1c){var _0x5c216d={};var _0xd38caa={};var _0x97b628;var _0x102421;return db[_0x7021('0x29')]['findOne']({'where':{'id':_0x5aeef3['params']['id']}})['then'](handleEntityNotFound(_0x6103a4,null))['then'](function(_0x1db89b){if(_0x1db89b){_0x97b628=_0x1db89b;_0xd38caa[_0x7021('0x2d')]=_['keys'](db[_0x7021('0x49')][_0x7021('0x43')]);_0xd38caa['query']=_[_0x7021('0x42')](_0x5aeef3[_0x7021('0x2e')]);_0xd38caa[_0x7021('0x2c')]=_['intersection'](_0xd38caa[_0x7021('0x2d')],_0xd38caa['query']);_0x5c216d[_0x7021('0x2f')]=_['intersection'](_0xd38caa['model'],qs[_0x7021('0x44')](_0x5aeef3['query']['fields']));_0x5c216d['attributes']=_0x5c216d[_0x7021('0x2f')]['length']?_0x5c216d['attributes']:_0xd38caa['model'];_0x5c216d[_0x7021('0x34')]=qs['sort'](_0x5aeef3[_0x7021('0x2e')][_0x7021('0x35')]);_0x5c216d[_0x7021('0x36')]=qs['filters'](_[_0x7021('0x37')](_0x5aeef3[_0x7021('0x2e')],_0xd38caa[_0x7021('0x2c')]));if(_0x5aeef3[_0x7021('0x2e')][_0x7021('0x38')]){_0x5c216d[_0x7021('0x36')]=_[_0x7021('0x39')](_0x5c216d[_0x7021('0x36')],{'$or':_[_0x7021('0x2b')](_0x5c216d[_0x7021('0x2f')],function(_0x2beff9){var _0x4daf78={};_0x4daf78[_0x2beff9]={'$like':'%'+_0x5aeef3[_0x7021('0x2e')][_0x7021('0x38')]+'%'};return _0x4daf78;})});}_0x5c216d=_[_0x7021('0x39')]({},_0x5c216d,_0x5aeef3[_0x7021('0x4a')]);return _0x97b628[_0x7021('0x48')](_0x5c216d);}})['then'](function(_0x180f64){if(_0x180f64){_0x102421=_0x180f64['length'];if(!_0x5aeef3['query'][_0x7021('0x32')](_0x7021('0x33'))){_0x5c216d[_0x7021('0x1f')]=qs['limit'](_0x5aeef3[_0x7021('0x2e')][_0x7021('0x1f')]);_0x5c216d[_0x7021('0x1c')]=qs[_0x7021('0x1c')](_0x5aeef3[_0x7021('0x2e')][_0x7021('0x1c')]);}return _0x97b628[_0x7021('0x48')](_0x5c216d);}})['then'](function(_0x3762c5){if(_0x3762c5){return _0x3762c5?{'count':_0x102421,'rows':_0x3762c5}:null;}})[_0x7021('0x25')](respondWithResult(_0x6103a4,null))['catch'](handleError(_0x6103a4,null));};exports[_0x7021('0x4b')]=function(_0x1449ee,_0x306b6a,_0x55e7d6){var _0x175bae={};var _0x53fb0a={};var _0x57167f;var _0x13f745;return db['FreshsalesConfiguration'][_0x7021('0x4c')]({'where':{'id':_0x1449ee[_0x7021('0x41')]['id']}})[_0x7021('0x25')](handleEntityNotFound(_0x306b6a,null))['then'](function(_0x415f5e){if(_0x415f5e){_0x57167f=_0x415f5e;_0x53fb0a['model']=_[_0x7021('0x42')](db['FreshsalesField'][_0x7021('0x43')]);_0x53fb0a['query']=_[_0x7021('0x42')](_0x1449ee[_0x7021('0x2e')]);_0x53fb0a[_0x7021('0x2c')]=_[_0x7021('0x30')](_0x53fb0a[_0x7021('0x2d')],_0x53fb0a[_0x7021('0x2e')]);_0x175bae[_0x7021('0x2f')]=_[_0x7021('0x30')](_0x53fb0a[_0x7021('0x2d')],qs[_0x7021('0x44')](_0x1449ee[_0x7021('0x2e')]['fields']));_0x175bae[_0x7021('0x2f')]=_0x175bae['attributes'][_0x7021('0x31')]?_0x175bae[_0x7021('0x2f')]:_0x53fb0a[_0x7021('0x2d')];_0x175bae[_0x7021('0x34')]=qs[_0x7021('0x35')](_0x1449ee['query'][_0x7021('0x35')]);_0x175bae[_0x7021('0x36')]=qs[_0x7021('0x2c')](_[_0x7021('0x37')](_0x1449ee['query'],_0x53fb0a[_0x7021('0x2c')]));if(_0x1449ee[_0x7021('0x2e')][_0x7021('0x38')]){_0x175bae[_0x7021('0x36')]=_[_0x7021('0x39')](_0x175bae[_0x7021('0x36')],{'$or':_[_0x7021('0x2b')](_0x175bae[_0x7021('0x2f')],function(_0x1b2cbc){var _0x151907={};_0x151907[_0x1b2cbc]={'$like':'%'+_0x1449ee[_0x7021('0x2e')][_0x7021('0x38')]+'%'};return _0x151907;})});}_0x175bae=_[_0x7021('0x39')]({},_0x175bae,_0x1449ee[_0x7021('0x4a')]);return _0x57167f[_0x7021('0x4b')](_0x175bae);}})[_0x7021('0x25')](function(_0x1b7739){if(_0x1b7739){_0x13f745=_0x1b7739[_0x7021('0x31')];if(!_0x1449ee['query'][_0x7021('0x32')](_0x7021('0x33'))){_0x175bae[_0x7021('0x1f')]=qs[_0x7021('0x1f')](_0x1449ee[_0x7021('0x2e')][_0x7021('0x1f')]);_0x175bae['offset']=qs[_0x7021('0x1c')](_0x1449ee[_0x7021('0x2e')][_0x7021('0x1c')]);}return _0x57167f[_0x7021('0x4b')](_0x175bae);}})[_0x7021('0x25')](function(_0x59c769){if(_0x59c769){return _0x59c769?{'count':_0x13f745,'rows':_0x59c769}:null;}})['then'](respondWithResult(_0x306b6a,null))[_0x7021('0x3f')](handleError(_0x306b6a,null));};exports['getFields']=function(_0x4cf4e8,_0x2dcdfd,_0x5aab60){var _0x293440={};var _0x27df39={};var _0x5bd7ea;var _0x59e714;return db['FreshsalesConfiguration'][_0x7021('0x4c')]({'where':{'id':_0x4cf4e8[_0x7021('0x41')]['id']}})[_0x7021('0x25')](handleEntityNotFound(_0x2dcdfd,null))['then'](function(_0x3e81df){if(_0x3e81df){_0x5bd7ea=_0x3e81df;_0x27df39[_0x7021('0x2d')]=_[_0x7021('0x42')](db[_0x7021('0x49')][_0x7021('0x43')]);_0x27df39[_0x7021('0x2e')]=_[_0x7021('0x42')](_0x4cf4e8['query']);_0x27df39[_0x7021('0x2c')]=_[_0x7021('0x30')](_0x27df39['model'],_0x27df39[_0x7021('0x2e')]);_0x293440[_0x7021('0x2f')]=_[_0x7021('0x30')](_0x27df39[_0x7021('0x2d')],qs['fields'](_0x4cf4e8[_0x7021('0x2e')][_0x7021('0x44')]));_0x293440['attributes']=_0x293440[_0x7021('0x2f')][_0x7021('0x31')]?_0x293440[_0x7021('0x2f')]:_0x27df39[_0x7021('0x2d')];_0x293440[_0x7021('0x34')]=qs[_0x7021('0x35')](_0x4cf4e8[_0x7021('0x2e')][_0x7021('0x35')]);_0x293440['where']=qs['filters'](_[_0x7021('0x37')](_0x4cf4e8[_0x7021('0x2e')],_0x27df39[_0x7021('0x2c')]));if(_0x4cf4e8[_0x7021('0x2e')][_0x7021('0x38')]){_0x293440[_0x7021('0x36')]=_[_0x7021('0x39')](_0x293440[_0x7021('0x36')],{'$or':_['map'](_0x293440[_0x7021('0x2f')],function(_0x389afd){var _0x3f30f3={};_0x3f30f3[_0x389afd]={'$like':'%'+_0x4cf4e8['query'][_0x7021('0x38')]+'%'};return _0x3f30f3;})});}_0x293440=_['merge']({},_0x293440,_0x4cf4e8[_0x7021('0x4a')]);return _0x5bd7ea[_0x7021('0x4d')](_0x293440);}})[_0x7021('0x25')](function(_0x101346){if(_0x101346){_0x59e714=_0x101346[_0x7021('0x31')];if(!_0x4cf4e8[_0x7021('0x2e')][_0x7021('0x32')]('nolimit')){_0x293440[_0x7021('0x1f')]=qs[_0x7021('0x1f')](_0x4cf4e8['query'][_0x7021('0x1f')]);_0x293440[_0x7021('0x1c')]=qs[_0x7021('0x1c')](_0x4cf4e8[_0x7021('0x2e')]['offset']);}return _0x5bd7ea[_0x7021('0x4d')](_0x293440);}})['then'](function(_0x4a513e){if(_0x4a513e){return _0x4a513e?{'count':_0x59e714,'rows':_0x4a513e}:null;}})[_0x7021('0x25')](respondWithResult(_0x2dcdfd,null))[_0x7021('0x3f')](handleError(_0x2dcdfd,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 10054a6..39a5a0a 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 _0xf68e=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3c3bf5,_0x3ef83d){var _0x2ffb6b=function(_0x3de22f){while(--_0x3de22f){_0x3c3bf5['push'](_0x3c3bf5['shift']());}};_0x2ffb6b(++_0x3ef83d);}(_0xf68e,0x72));var _0xef68=function(_0x392021,_0x107d7c){_0x392021=_0x392021-0x0;var _0x274878=_0xf68e[_0x392021];return _0x274878;};'use strict';var _=require('lodash');var util=require(_0xef68('0x0'));var logger=require(_0xef68('0x1'))(_0xef68('0x2'));var moment=require('moment');var BPromise=require(_0xef68('0x3'));var rp=require(_0xef68('0x4'));var fs=require('fs');var path=require(_0xef68('0x5'));var rimraf=require(_0xef68('0x6'));var config=require(_0xef68('0x7'));var attributes=require(_0xef68('0x8'));module[_0xef68('0x9')]=function(_0x516843,_0x2885f0){return _0x516843[_0xef68('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0xef68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74e8=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports'];(function(_0xa9026a,_0x552cc8){var _0x1700a4=function(_0x2a8a76){while(--_0x2a8a76){_0xa9026a['push'](_0xa9026a['shift']());}};_0x1700a4(++_0x552cc8);}(_0x74e8,0x66));var _0x874e=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0x74e8[_0x31e5cb];return _0x4170df;};'use strict';var _=require(_0x874e('0x0'));var util=require('util');var logger=require(_0x874e('0x1'))(_0x874e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x874e('0x3'));var fs=require('fs');var path=require(_0x874e('0x4'));var rimraf=require(_0x874e('0x5'));var config=require('../../config/environment');var attributes=require(_0x874e('0x6'));module[_0x874e('0x7')]=function(_0x34ad4f,_0xa06c49){return _0x34ad4f[_0x874e('0x8')](_0x874e('0x9'),attributes,{'tableName':_0x874e('0xa'),'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 7784131..ca7a6ed 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 _0xf97b=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x4268c4,_0x244f25){var _0x1e01f8=function(_0x1b3091){while(--_0x1b3091){_0x4268c4['push'](_0x4268c4['shift']());}};_0x1e01f8(++_0x244f25);}(_0xf97b,0x1b2));var _0xbf97=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf97b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xbf97('0x0'));var util=require(_0xbf97('0x1'));var moment=require(_0xbf97('0x2'));var BPromise=require(_0xbf97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf97('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf97('0x5'))(_0xbf97('0x6'));var config=require(_0xbf97('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x562dff,_0x4f0ee6,_0x59ecaa){return new BPromise(function(_0xff2327,_0x55211a){return client[_0xbf97('0x9')](_0x562dff,_0x59ecaa)['then'](function(_0x20e183){logger[_0xbf97('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f0ee6,_0xbf97('0xb'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x4f0ee6,'request\x20sent',JSON[_0xbf97('0xc')](_0x20e183));if(_0x20e183[_0xbf97('0xd')]){if(_0x20e183[_0xbf97('0xd')][_0xbf97('0xe')]===0x1f4){logger[_0xbf97('0xd')](_0xbf97('0xf'),_0x4f0ee6,_0x20e183[_0xbf97('0xd')][_0xbf97('0x10')]);return _0x55211a(_0x20e183['error'][_0xbf97('0x10')]);}logger[_0xbf97('0xd')](_0xbf97('0xf'),_0x4f0ee6,_0x20e183[_0xbf97('0xd')][_0xbf97('0x10')]);return _0xff2327(_0x20e183[_0xbf97('0xd')][_0xbf97('0x10')]);}else{logger[_0xbf97('0xa')](_0xbf97('0xf'),_0x4f0ee6,_0xbf97('0xb'));_0xff2327(_0x20e183[_0xbf97('0x11')][_0xbf97('0x10')]);}})['catch'](function(_0x12dbc0){logger[_0xbf97('0xd')](_0xbf97('0xf'),_0x4f0ee6,_0x12dbc0);_0x55211a(_0x12dbc0);});});} \ No newline at end of file +var _0xa321=['../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3514da,_0x332bb6){var _0x5348e7=function(_0x2fb52b){while(--_0x2fb52b){_0x3514da['push'](_0x3514da['shift']());}};_0x5348e7(++_0x332bb6);}(_0xa321,0x68));var _0x1a32=function(_0x35c12c,_0x378ba0){_0x35c12c=_0x35c12c-0x0;var _0x2bab3a=_0xa321[_0x35c12c];return _0x2bab3a;};'use strict';var _=require(_0x1a32('0x0'));var util=require('util');var moment=require(_0x1a32('0x1'));var BPromise=require('bluebird');var rs=require(_0x1a32('0x2'));var fs=require('fs');var Redis=require(_0x1a32('0x3'));var db=require(_0x1a32('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a32('0x5'));var config=require(_0x1a32('0x6'));var jayson=require(_0x1a32('0x7'));var client=jayson[_0x1a32('0x8')][_0x1a32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ca734,_0x1eb98c,_0x2cbe96){return new BPromise(function(_0x43e939,_0x3c8a66){return client['request'](_0x3ca734,_0x2cbe96)[_0x1a32('0xa')](function(_0x467dfc){logger[_0x1a32('0xb')](_0x1a32('0xc'),_0x1eb98c,'request\x20sent');logger[_0x1a32('0xd')](_0x1a32('0xe'),_0x1eb98c,_0x1a32('0xf'),JSON[_0x1a32('0x10')](_0x467dfc));if(_0x467dfc[_0x1a32('0x11')]){if(_0x467dfc[_0x1a32('0x11')][_0x1a32('0x12')]===0x1f4){logger[_0x1a32('0x11')](_0x1a32('0xc'),_0x1eb98c,_0x467dfc[_0x1a32('0x11')][_0x1a32('0x13')]);return _0x3c8a66(_0x467dfc[_0x1a32('0x11')]['message']);}logger[_0x1a32('0x11')](_0x1a32('0xc'),_0x1eb98c,_0x467dfc[_0x1a32('0x11')][_0x1a32('0x13')]);return _0x43e939(_0x467dfc['error'][_0x1a32('0x13')]);}else{logger[_0x1a32('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1eb98c,'request\x20sent');_0x43e939(_0x467dfc[_0x1a32('0x14')][_0x1a32('0x13')]);}})[_0x1a32('0x15')](function(_0x24bd8f){logger[_0x1a32('0x11')](_0x1a32('0xc'),_0x1eb98c,_0x24bd8f);_0x3c8a66(_0x24bd8f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 18577a8..035de63 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 _0xbf82=['multer','path','express','Router','fs-extra','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','exports'];(function(_0x4dfb03,_0x5837a5){var _0x5a85da=function(_0x4f3629){while(--_0x4f3629){_0x4dfb03['push'](_0x4dfb03['shift']());}};_0x5a85da(++_0x5837a5);}(_0xbf82,0x1cb));var _0x2bf8=function(_0x32c0a4,_0x309956){_0x32c0a4=_0x32c0a4-0x0;var _0x1a2dff=_0xbf82[_0x32c0a4];return _0x1a2dff;};'use strict';var multer=require(_0x2bf8('0x0'));var util=require('util');var path=require(_0x2bf8('0x1'));var timeout=require('connect-timeout');var express=require(_0x2bf8('0x2'));var router=express[_0x2bf8('0x3')]();var fs_extra=require(_0x2bf8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2bf8('0x5'));var controller=require(_0x2bf8('0x6'));router[_0x2bf8('0x7')]('/',auth[_0x2bf8('0x8')](),controller[_0x2bf8('0x9')]);router['get']('/:id',auth[_0x2bf8('0x8')](),controller['show']);router[_0x2bf8('0xa')]('/',auth[_0x2bf8('0x8')](),controller[_0x2bf8('0xb')]);router['put'](_0x2bf8('0xc'),auth[_0x2bf8('0x8')](),controller[_0x2bf8('0xd')]);router[_0x2bf8('0xe')](_0x2bf8('0xc'),auth[_0x2bf8('0x8')](),controller[_0x2bf8('0xf')]);module[_0x2bf8('0x10')]=router; \ No newline at end of file +var _0x24a6=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x4bbdae,_0x54f13b){var _0x4dd6b9=function(_0x36a32d){while(--_0x36a32d){_0x4bbdae['push'](_0x4bbdae['shift']());}};_0x4dd6b9(++_0x54f13b);}(_0x24a6,0x14f));var _0x624a=function(_0x1f8c88,_0x6c095c){_0x1f8c88=_0x1f8c88-0x0;var _0x19ef02=_0x24a6[_0x1f8c88];return _0x19ef02;};'use strict';var multer=require(_0x624a('0x0'));var util=require('util');var path=require(_0x624a('0x1'));var timeout=require(_0x624a('0x2'));var express=require(_0x624a('0x3'));var router=express[_0x624a('0x4')]();var fs_extra=require(_0x624a('0x5'));var auth=require(_0x624a('0x6'));var interaction=require(_0x624a('0x7'));var config=require(_0x624a('0x8'));var controller=require(_0x624a('0x9'));router[_0x624a('0xa')]('/',auth[_0x624a('0xb')](),controller[_0x624a('0xc')]);router[_0x624a('0xa')](_0x624a('0xd'),auth[_0x624a('0xb')](),controller[_0x624a('0xe')]);router[_0x624a('0xf')]('/',auth[_0x624a('0xb')](),controller[_0x624a('0x10')]);router[_0x624a('0x11')](_0x624a('0xd'),auth[_0x624a('0xb')](),controller[_0x624a('0x12')]);router['delete']('/:id',auth[_0x624a('0xb')](),controller[_0x624a('0x13')]);module[_0x624a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2330aef..f9b12a0 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 _0xfa13=['picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable'];(function(_0x31b99a,_0xfb8adb){var _0x4c5223=function(_0x110443){while(--_0x110443){_0x31b99a['push'](_0x31b99a['shift']());}};_0x4c5223(++_0xfb8adb);}(_0xfa13,0x1e4));var _0x3fa1=function(_0x1a5c85,_0x385211){_0x1a5c85=_0x1a5c85-0x0;var _0x2b1e5e=_0xfa13[_0x1a5c85];return _0x2b1e5e;};'use strict';var Sequelize=require(_0x3fa1('0x0'));module['exports']={'type':{'type':Sequelize[_0x3fa1('0x1')](_0x3fa1('0x2'),'variable',_0x3fa1('0x3'),'keyValue',_0x3fa1('0x4')),'defaultValue':_0x3fa1('0x2')},'content':{'type':Sequelize[_0x3fa1('0x5')]},'key':{'type':Sequelize[_0x3fa1('0x5')]},'keyType':{'type':Sequelize[_0x3fa1('0x1')](_0x3fa1('0x2'),_0x3fa1('0x6'),_0x3fa1('0x3'))},'keyContent':{'type':Sequelize[_0x3fa1('0x5')]},'idField':{'type':Sequelize[_0x3fa1('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3fa1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3fa1('0x5')]}}; \ No newline at end of file +var _0xbe2c=['exports','ENUM','customVariable','STRING','variable'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xbe2c,0x87));var _0xcbe2=function(_0x4b770c,_0x2cf6f6){_0x4b770c=_0x4b770c-0x0;var _0x174199=_0xbe2c[_0x4b770c];return _0x174199;};'use strict';var Sequelize=require('sequelize');module[_0xcbe2('0x0')]={'type':{'type':Sequelize[_0xcbe2('0x1')]('string','variable',_0xcbe2('0x2'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xcbe2('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xcbe2('0x4'),_0xcbe2('0x2'))},'keyContent':{'type':Sequelize[_0xcbe2('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcbe2('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcbe2('0x3')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 4132f42..d66c590 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 _0x11b8=['json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','FreshsalesField','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status'];(function(_0x210388,_0x13b1a3){var _0x561f6a=function(_0x5a2da0){while(--_0x5a2da0){_0x210388['push'](_0x210388['shift']());}};_0x561f6a(++_0x13b1a3);}(_0x11b8,0x14a));var _0x811b=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x11b8[_0x4715d2];return _0x141811;};'use strict';var emlformat=require(_0x811b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x811b('0x1'));var rp=require(_0x811b('0x2'));var moment=require('moment');var BPromise=require(_0x811b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x811b('0x4'));var sox=require(_0x811b('0x5'));var csv=require(_0x811b('0x6'));var ejs=require(_0x811b('0x7'));var fs=require('fs');var fs_extra=require(_0x811b('0x8'));var _=require(_0x811b('0x9'));var squel=require(_0x811b('0xa'));var crypto=require(_0x811b('0xb'));var jsforce=require(_0x811b('0xc'));var deskjs=require(_0x811b('0xd'));var toCsv=require(_0x811b('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x811b('0xe'));var authService=require(_0x811b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x811b('0x10'));var hardwareService=require(_0x811b('0x11'));var logger=require('../../config/logger')(_0x811b('0x12'));var utils=require(_0x811b('0x13'));var config=require(_0x811b('0x14'));var licenseUtil=require(_0x811b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52519e,_0x593105){_0x593105=_0x593105||0xcc;return function(_0x281857){if(_0x281857){return _0x52519e[_0x811b('0x16')](_0x593105);}return _0x52519e['status'](_0x593105)[_0x811b('0x17')]();};}function respondWithResult(_0x3711a1,_0x54ed09){_0x54ed09=_0x54ed09||0xc8;return function(_0x32ab96){if(_0x32ab96){return _0x3711a1[_0x811b('0x18')](_0x54ed09)[_0x811b('0x19')](_0x32ab96);}};}function respondWithFilteredResult(_0x56feb3,_0x440e72){return function(_0x328041){if(_0x328041){var _0x556ab8=typeof _0x440e72[_0x811b('0x1a')]===_0x811b('0x1b')&&typeof _0x440e72[_0x811b('0x1c')]===_0x811b('0x1b');var _0x3e6473=_0x328041[_0x811b('0x1d')];var _0x153841=_0x556ab8?0x0:_0x440e72['offset'];var _0x1b73a2=_0x556ab8?_0x328041[_0x811b('0x1d')]:_0x440e72[_0x811b('0x1a')]+_0x440e72[_0x811b('0x1c')];var _0x3675da;if(_0x1b73a2>=_0x3e6473){_0x1b73a2=_0x3e6473;_0x3675da=0xc8;}else{_0x3675da=0xce;}_0x56feb3[_0x811b('0x18')](_0x3675da);return _0x56feb3[_0x811b('0x1e')]('Content-Range',_0x153841+'-'+_0x1b73a2+'/'+_0x3e6473)['json'](_0x328041);}return null;};}function patchUpdates(_0x31e972){return function(_0x1982fb){try{jsonpatch[_0x811b('0x1f')](_0x1982fb,_0x31e972,!![]);}catch(_0x157e97){return BPromise[_0x811b('0x20')](_0x157e97);}return _0x1982fb[_0x811b('0x21')]();};}function saveUpdates(_0x482a4b,_0x4541e5){return function(_0x1d0723){if(_0x1d0723){return _0x1d0723[_0x811b('0x22')](_0x482a4b)[_0x811b('0x23')](function(_0x1fbf06){return _0x1fbf06;});}return null;};}function removeEntity(_0xdcc453,_0x2736a1){return function(_0x3bd250){if(_0x3bd250){return _0x3bd250[_0x811b('0x24')]()[_0x811b('0x23')](function(){_0xdcc453[_0x811b('0x18')](0xcc)[_0x811b('0x17')]();});}};}function handleEntityNotFound(_0x4ac0e5,_0x29d595){return function(_0x1b7299){if(!_0x1b7299){_0x4ac0e5[_0x811b('0x16')](0x194);}return _0x1b7299;};}function handleError(_0x1b85ba,_0x450195){_0x450195=_0x450195||0x1f4;return function(_0x32ee81){logger['error'](_0x32ee81[_0x811b('0x25')]);if(_0x32ee81[_0x811b('0x26')]){delete _0x32ee81[_0x811b('0x26')];}_0x1b85ba[_0x811b('0x18')](_0x450195)[_0x811b('0x27')](_0x32ee81);};}exports['index']=function(_0x1011a0,_0x243c20){var _0x432d06={},_0x2122cf={},_0x15ab05={'count':0x0,'rows':[]};var _0x190e59=_['map'](db['FreshsalesField'][_0x811b('0x28')],function(_0x332ab6){return{'name':_0x332ab6[_0x811b('0x29')],'type':_0x332ab6[_0x811b('0x2a')][_0x811b('0x2b')]};});_0x2122cf['model']=_[_0x811b('0x2c')](_0x190e59,'name');_0x2122cf[_0x811b('0x2d')]=_[_0x811b('0x2e')](_0x1011a0[_0x811b('0x2d')]);_0x2122cf[_0x811b('0x2f')]=_[_0x811b('0x30')](_0x2122cf[_0x811b('0x31')],_0x2122cf['query']);_0x432d06[_0x811b('0x32')]=_[_0x811b('0x30')](_0x2122cf[_0x811b('0x31')],qs[_0x811b('0x33')](_0x1011a0[_0x811b('0x2d')][_0x811b('0x33')]));_0x432d06['attributes']=_0x432d06[_0x811b('0x32')]['length']?_0x432d06[_0x811b('0x32')]:_0x2122cf[_0x811b('0x31')];if(!_0x1011a0[_0x811b('0x2d')][_0x811b('0x34')](_0x811b('0x35'))){_0x432d06['limit']=qs[_0x811b('0x1c')](_0x1011a0[_0x811b('0x2d')][_0x811b('0x1c')]);_0x432d06['offset']=qs[_0x811b('0x1a')](_0x1011a0[_0x811b('0x2d')][_0x811b('0x1a')]);}_0x432d06[_0x811b('0x36')]=qs['sort'](_0x1011a0[_0x811b('0x2d')]['sort']);_0x432d06[_0x811b('0x37')]=qs[_0x811b('0x2f')](_[_0x811b('0x38')](_0x1011a0[_0x811b('0x2d')],_0x2122cf['filters']),_0x190e59);if(_0x1011a0[_0x811b('0x2d')]['filter']){_0x432d06['where']=_[_0x811b('0x39')](_0x432d06['where'],{'$or':_[_0x811b('0x2c')](_0x190e59,function(_0x52fdbc){if(_0x52fdbc['type']!==_0x811b('0x3a')){var _0x69f49d={};_0x69f49d[_0x52fdbc[_0x811b('0x26')]]={'$like':'%'+_0x1011a0[_0x811b('0x2d')][_0x811b('0x3b')]+'%'};return _0x69f49d;}})});}_0x432d06=_['merge']({},_0x432d06,_0x1011a0[_0x811b('0x3c')]);var _0x430005={'where':_0x432d06[_0x811b('0x37')]};return db[_0x811b('0x3d')]['count'](_0x430005)[_0x811b('0x23')](function(_0x1c642b){_0x15ab05[_0x811b('0x1d')]=_0x1c642b;if(_0x1011a0[_0x811b('0x2d')][_0x811b('0x3e')]){_0x432d06[_0x811b('0x3f')]=[{'all':!![]}];}return db[_0x811b('0x3d')][_0x811b('0x40')](_0x432d06);})[_0x811b('0x23')](function(_0x2e28d2){_0x15ab05['rows']=_0x2e28d2;return _0x15ab05;})['then'](respondWithFilteredResult(_0x243c20,_0x432d06))['catch'](handleError(_0x243c20,null));};exports[_0x811b('0x41')]=function(_0x5812a3,_0x581d78){var _0x9aa1cb={'raw':!![],'where':{'id':_0x5812a3[_0x811b('0x42')]['id']}},_0x470a4d={};_0x470a4d[_0x811b('0x31')]=_[_0x811b('0x2e')](db[_0x811b('0x3d')][_0x811b('0x28')]);_0x470a4d[_0x811b('0x2d')]=_[_0x811b('0x2e')](_0x5812a3[_0x811b('0x2d')]);_0x470a4d[_0x811b('0x2f')]=_[_0x811b('0x30')](_0x470a4d[_0x811b('0x31')],_0x470a4d[_0x811b('0x2d')]);_0x9aa1cb[_0x811b('0x32')]=_[_0x811b('0x30')](_0x470a4d[_0x811b('0x31')],qs[_0x811b('0x33')](_0x5812a3[_0x811b('0x2d')][_0x811b('0x33')]));_0x9aa1cb[_0x811b('0x32')]=_0x9aa1cb[_0x811b('0x32')]['length']?_0x9aa1cb[_0x811b('0x32')]:_0x470a4d[_0x811b('0x31')];if(_0x5812a3['query'][_0x811b('0x3e')]){_0x9aa1cb[_0x811b('0x3f')]=[{'all':!![]}];}_0x9aa1cb=_[_0x811b('0x39')]({},_0x9aa1cb,_0x5812a3[_0x811b('0x3c')]);return db[_0x811b('0x3d')][_0x811b('0x43')](_0x9aa1cb)[_0x811b('0x23')](handleEntityNotFound(_0x581d78,null))[_0x811b('0x23')](respondWithResult(_0x581d78,null))[_0x811b('0x44')](handleError(_0x581d78,null));};exports['create']=function(_0x1da9a5,_0x1f1e80){return db[_0x811b('0x3d')][_0x811b('0x45')](_0x1da9a5['body'],{})[_0x811b('0x23')](respondWithResult(_0x1f1e80,0xc9))[_0x811b('0x44')](handleError(_0x1f1e80,null));};exports['update']=function(_0x2f99ed,_0x154c80){if(_0x2f99ed['body']['id']){delete _0x2f99ed[_0x811b('0x46')]['id'];}return db[_0x811b('0x3d')][_0x811b('0x43')]({'where':{'id':_0x2f99ed[_0x811b('0x42')]['id']}})[_0x811b('0x23')](handleEntityNotFound(_0x154c80,null))[_0x811b('0x23')](saveUpdates(_0x2f99ed['body'],null))[_0x811b('0x23')](respondWithResult(_0x154c80,null))[_0x811b('0x44')](handleError(_0x154c80,null));};exports[_0x811b('0x24')]=function(_0x4f6033,_0x991549){return db[_0x811b('0x3d')][_0x811b('0x43')]({'where':{'id':_0x4f6033['params']['id']}})[_0x811b('0x23')](handleEntityNotFound(_0x991549,null))[_0x811b('0x23')](removeEntity(_0x991549,null))[_0x811b('0x44')](handleError(_0x991549,null));}; \ No newline at end of file +var _0x7d1b=['params','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','includeAll','include','rows','catch','show','find','create','body','destroy'];(function(_0xc43a44,_0x8ee03a){var _0x306cd6=function(_0x1d7992){while(--_0x1d7992){_0xc43a44['push'](_0xc43a44['shift']());}};_0x306cd6(++_0x8ee03a);}(_0x7d1b,0x173));var _0xb7d1=function(_0x11a1ac,_0x4c77bc){_0x11a1ac=_0x11a1ac-0x0;var _0xdefeab=_0x7d1b[_0x11a1ac];return _0xdefeab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7d1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7d1('0x1'));var rp=require(_0xb7d1('0x2'));var moment=require(_0xb7d1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb7d1('0x4'));var util=require(_0xb7d1('0x5'));var path=require('path');var sox=require(_0xb7d1('0x6'));var csv=require('to-csv');var ejs=require(_0xb7d1('0x7'));var fs=require('fs');var fs_extra=require(_0xb7d1('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb7d1('0x9'));var jsforce=require(_0xb7d1('0xa'));var deskjs=require(_0xb7d1('0xb'));var toCsv=require(_0xb7d1('0xc'));var querystring=require(_0xb7d1('0xd'));var Papa=require(_0xb7d1('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb7d1('0xf'));var as=require(_0xb7d1('0x10'));var hardwareService=require(_0xb7d1('0x11'));var logger=require(_0xb7d1('0x12'))(_0xb7d1('0x13'));var utils=require('../../config/utils');var config=require(_0xb7d1('0x14'));var licenseUtil=require(_0xb7d1('0x15'));var db=require(_0xb7d1('0x16'))['db'];function respondWithStatusCode(_0x45286c,_0x1f637d){_0x1f637d=_0x1f637d||0xcc;return function(_0x281f35){if(_0x281f35){return _0x45286c[_0xb7d1('0x17')](_0x1f637d);}return _0x45286c['status'](_0x1f637d)[_0xb7d1('0x18')]();};}function respondWithResult(_0x349336,_0x75e488){_0x75e488=_0x75e488||0xc8;return function(_0x3f9e08){if(_0x3f9e08){return _0x349336[_0xb7d1('0x19')](_0x75e488)['json'](_0x3f9e08);}};}function respondWithFilteredResult(_0x55d276,_0x2659f6){return function(_0x27a181){if(_0x27a181){var _0x50b5be=typeof _0x2659f6[_0xb7d1('0x1a')]===_0xb7d1('0x1b')&&typeof _0x2659f6[_0xb7d1('0x1c')]===_0xb7d1('0x1b');var _0x3a5bfa=_0x27a181[_0xb7d1('0x1d')];var _0x5ac138=_0x50b5be?0x0:_0x2659f6[_0xb7d1('0x1a')];var _0x367814=_0x50b5be?_0x27a181[_0xb7d1('0x1d')]:_0x2659f6['offset']+_0x2659f6['limit'];var _0x1a25b5;if(_0x367814>=_0x3a5bfa){_0x367814=_0x3a5bfa;_0x1a25b5=0xc8;}else{_0x1a25b5=0xce;}_0x55d276['status'](_0x1a25b5);return _0x55d276[_0xb7d1('0x1e')](_0xb7d1('0x1f'),_0x5ac138+'-'+_0x367814+'/'+_0x3a5bfa)['json'](_0x27a181);}return null;};}function patchUpdates(_0x4713c6){return function(_0x5215c5){try{jsonpatch[_0xb7d1('0x20')](_0x5215c5,_0x4713c6,!![]);}catch(_0x351c5f){return BPromise['reject'](_0x351c5f);}return _0x5215c5[_0xb7d1('0x21')]();};}function saveUpdates(_0x5b5085,_0x6b14d0){return function(_0x585fb5){if(_0x585fb5){return _0x585fb5[_0xb7d1('0x22')](_0x5b5085)['then'](function(_0x36f6e2){return _0x36f6e2;});}return null;};}function removeEntity(_0x4a7698,_0x59f7c5){return function(_0x227fb4){if(_0x227fb4){return _0x227fb4['destroy']()[_0xb7d1('0x23')](function(){_0x4a7698[_0xb7d1('0x19')](0xcc)[_0xb7d1('0x18')]();});}};}function handleEntityNotFound(_0x4afbae,_0x3f828f){return function(_0x3dceee){if(!_0x3dceee){_0x4afbae[_0xb7d1('0x17')](0x194);}return _0x3dceee;};}function handleError(_0x30ddd2,_0x33d6b0){_0x33d6b0=_0x33d6b0||0x1f4;return function(_0x4e59c8){logger[_0xb7d1('0x24')](_0x4e59c8[_0xb7d1('0x25')]);if(_0x4e59c8[_0xb7d1('0x26')]){delete _0x4e59c8['name'];}_0x30ddd2[_0xb7d1('0x19')](_0x33d6b0)[_0xb7d1('0x27')](_0x4e59c8);};}exports[_0xb7d1('0x28')]=function(_0x2d5a20,_0x40f339){var _0x162267={},_0x4cfc8e={},_0x5a54c9={'count':0x0,'rows':[]};var _0x5f1d86=_[_0xb7d1('0x29')](db['FreshsalesField'][_0xb7d1('0x2a')],function(_0x466b08){return{'name':_0x466b08[_0xb7d1('0x2b')],'type':_0x466b08[_0xb7d1('0x2c')]['key']};});_0x4cfc8e[_0xb7d1('0x2d')]=_[_0xb7d1('0x29')](_0x5f1d86,_0xb7d1('0x26'));_0x4cfc8e['query']=_[_0xb7d1('0x2e')](_0x2d5a20[_0xb7d1('0x2f')]);_0x4cfc8e[_0xb7d1('0x30')]=_['intersection'](_0x4cfc8e['model'],_0x4cfc8e['query']);_0x162267[_0xb7d1('0x31')]=_[_0xb7d1('0x32')](_0x4cfc8e[_0xb7d1('0x2d')],qs[_0xb7d1('0x33')](_0x2d5a20[_0xb7d1('0x2f')]['fields']));_0x162267['attributes']=_0x162267['attributes'][_0xb7d1('0x34')]?_0x162267[_0xb7d1('0x31')]:_0x4cfc8e[_0xb7d1('0x2d')];if(!_0x2d5a20['query'][_0xb7d1('0x35')](_0xb7d1('0x36'))){_0x162267['limit']=qs[_0xb7d1('0x1c')](_0x2d5a20['query'][_0xb7d1('0x1c')]);_0x162267[_0xb7d1('0x1a')]=qs['offset'](_0x2d5a20[_0xb7d1('0x2f')][_0xb7d1('0x1a')]);}_0x162267[_0xb7d1('0x37')]=qs[_0xb7d1('0x38')](_0x2d5a20[_0xb7d1('0x2f')][_0xb7d1('0x38')]);_0x162267[_0xb7d1('0x39')]=qs[_0xb7d1('0x30')](_[_0xb7d1('0x3a')](_0x2d5a20[_0xb7d1('0x2f')],_0x4cfc8e[_0xb7d1('0x30')]),_0x5f1d86);if(_0x2d5a20[_0xb7d1('0x2f')][_0xb7d1('0x3b')]){_0x162267[_0xb7d1('0x39')]=_[_0xb7d1('0x3c')](_0x162267['where'],{'$or':_[_0xb7d1('0x29')](_0x5f1d86,function(_0xfa332b){if(_0xfa332b[_0xb7d1('0x2c')]!==_0xb7d1('0x3d')){var _0x5c5afd={};_0x5c5afd[_0xfa332b[_0xb7d1('0x26')]]={'$like':'%'+_0x2d5a20[_0xb7d1('0x2f')][_0xb7d1('0x3b')]+'%'};return _0x5c5afd;}})});}_0x162267=_[_0xb7d1('0x3c')]({},_0x162267,_0x2d5a20[_0xb7d1('0x3e')]);var _0x2e8b49={'where':_0x162267[_0xb7d1('0x39')]};return db[_0xb7d1('0x3f')][_0xb7d1('0x1d')](_0x2e8b49)['then'](function(_0x1db60f){_0x5a54c9[_0xb7d1('0x1d')]=_0x1db60f;if(_0x2d5a20[_0xb7d1('0x2f')][_0xb7d1('0x40')]){_0x162267[_0xb7d1('0x41')]=[{'all':!![]}];}return db[_0xb7d1('0x3f')]['findAll'](_0x162267);})[_0xb7d1('0x23')](function(_0x5dcae6){_0x5a54c9[_0xb7d1('0x42')]=_0x5dcae6;return _0x5a54c9;})[_0xb7d1('0x23')](respondWithFilteredResult(_0x40f339,_0x162267))[_0xb7d1('0x43')](handleError(_0x40f339,null));};exports[_0xb7d1('0x44')]=function(_0xb94109,_0x2c5736){var _0x20bec3={'raw':!![],'where':{'id':_0xb94109['params']['id']}},_0x48c789={};_0x48c789[_0xb7d1('0x2d')]=_['keys'](db[_0xb7d1('0x3f')][_0xb7d1('0x2a')]);_0x48c789[_0xb7d1('0x2f')]=_[_0xb7d1('0x2e')](_0xb94109[_0xb7d1('0x2f')]);_0x48c789[_0xb7d1('0x30')]=_[_0xb7d1('0x32')](_0x48c789[_0xb7d1('0x2d')],_0x48c789[_0xb7d1('0x2f')]);_0x20bec3[_0xb7d1('0x31')]=_[_0xb7d1('0x32')](_0x48c789[_0xb7d1('0x2d')],qs[_0xb7d1('0x33')](_0xb94109['query'][_0xb7d1('0x33')]));_0x20bec3[_0xb7d1('0x31')]=_0x20bec3[_0xb7d1('0x31')][_0xb7d1('0x34')]?_0x20bec3[_0xb7d1('0x31')]:_0x48c789[_0xb7d1('0x2d')];if(_0xb94109[_0xb7d1('0x2f')][_0xb7d1('0x40')]){_0x20bec3[_0xb7d1('0x41')]=[{'all':!![]}];}_0x20bec3=_[_0xb7d1('0x3c')]({},_0x20bec3,_0xb94109[_0xb7d1('0x3e')]);return db[_0xb7d1('0x3f')][_0xb7d1('0x45')](_0x20bec3)[_0xb7d1('0x23')](handleEntityNotFound(_0x2c5736,null))['then'](respondWithResult(_0x2c5736,null))[_0xb7d1('0x43')](handleError(_0x2c5736,null));};exports[_0xb7d1('0x46')]=function(_0x368135,_0x41e148){return db[_0xb7d1('0x3f')][_0xb7d1('0x46')](_0x368135[_0xb7d1('0x47')],{})[_0xb7d1('0x23')](respondWithResult(_0x41e148,0xc9))[_0xb7d1('0x43')](handleError(_0x41e148,null));};exports[_0xb7d1('0x22')]=function(_0x3857a9,_0x55414d){if(_0x3857a9[_0xb7d1('0x47')]['id']){delete _0x3857a9[_0xb7d1('0x47')]['id'];}return db[_0xb7d1('0x3f')][_0xb7d1('0x45')]({'where':{'id':_0x3857a9['params']['id']}})['then'](handleEntityNotFound(_0x55414d,null))[_0xb7d1('0x23')](saveUpdates(_0x3857a9[_0xb7d1('0x47')],null))['then'](respondWithResult(_0x55414d,null))[_0xb7d1('0x43')](handleError(_0x55414d,null));};exports[_0xb7d1('0x48')]=function(_0x51d55e,_0x4b0e63){return db['FreshsalesField']['find']({'where':{'id':_0x51d55e[_0xb7d1('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b0e63,null))[_0xb7d1('0x23')](removeEntity(_0x4b0e63,null))[_0xb7d1('0x43')](handleError(_0x4b0e63,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5ef0a6c..da7735c 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 _0xd386=['freshsales_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields'];(function(_0x3c600d,_0x4b5c85){var _0xd195e3=function(_0x2a2f5f){while(--_0x2a2f5f){_0x3c600d['push'](_0x3c600d['shift']());}};_0xd195e3(++_0x4b5c85);}(_0xd386,0x10c));var _0x6d38=function(_0x175d1e,_0x48ad7e){_0x175d1e=_0x175d1e-0x0;var _0x10aefc=_0xd386[_0x175d1e];return _0x10aefc;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var logger=require(_0x6d38('0x2'))('api');var moment=require(_0x6d38('0x3'));var BPromise=require(_0x6d38('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d38('0x5'));var rimraf=require(_0x6d38('0x6'));var config=require(_0x6d38('0x7'));var attributes=require(_0x6d38('0x8'));module['exports']=function(_0x1a54fa,_0x25eef5){return _0x1a54fa[_0x6d38('0x9')](_0x6d38('0xa'),attributes,{'tableName':_0x6d38('0xb'),'paranoid':![],'indexes':[{'name':_0x6d38('0xc'),'fields':['idField',_0x6d38('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4325=['../../config/environment','./intFreshsalesField.attributes','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x5432('0x9'),'fields':[_0x5432('0xa'),_0x5432('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 180b684..fdc110e 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 _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0xc8bfa2,_0x25710b){var _0x455ecf=function(_0x335dbb){while(--_0x335dbb){_0xc8bfa2['push'](_0xc8bfa2['shift']());}};_0x455ecf(++_0x25710b);}(_0x4819,0xcd));var _0x9481=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x4819[_0x315b61];return _0x3521e8;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3de1bc,_0x45616c){var _0xff4436=function(_0x5e0a11){while(--_0x5e0a11){_0x3de1bc['push'](_0x3de1bc['shift']());}};_0xff4436(++_0x45616c);}(_0x2a07,0x74));var _0x72a0=function(_0x8f7825,_0xaa0ca0){_0x8f7825=_0x8f7825-0x0;var _0x29a7c9=_0x2a07[_0x8f7825];return _0x29a7c9;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 2cc9717..046fe8e 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1ddb40,_0x2966c8){var _0x508db9=function(_0x33767d){while(--_0x33767d){_0x1ddb40['push'](_0x1ddb40['shift']());}};_0x508db9(++_0x2966c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x13595f,_0x15c31b){var _0x31b7db=function(_0x2b30fb){while(--_0x2b30fb){_0x13595f['push'](_0x13595f['shift']());}};_0x31b7db(++_0x15c31b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 3cf6218..1116c61 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 _0x4a03=['integrationTab','exports','STRING','username','ENUM'];(function(_0x596e30,_0x301282){var _0x5e46af=function(_0x2c3918){while(--_0x2c3918){_0x596e30['push'](_0x596e30['shift']());}};_0x5e46af(++_0x301282);}(_0x4a03,0x16e));var _0x34a0=function(_0xa1cde5,_0x153cbf){_0xa1cde5=_0xa1cde5-0x0;var _0x109a5e=_0x4a03[_0xa1cde5];return _0x109a5e;};'use strict';var Sequelize=require('sequelize');module[_0x34a0('0x0')]={'name':{'type':Sequelize[_0x34a0('0x1')]},'description':{'type':Sequelize[_0x34a0('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x34a0('0x2')},'remoteUri':{'type':Sequelize[_0x34a0('0x1')]},'password':{'type':Sequelize[_0x34a0('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x34a0('0x1')]},'securityToken':{'type':Sequelize[_0x34a0('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x34a0('0x3')](_0x34a0('0x4'),'newTab'),'defaultValue':_0x34a0('0x4')}}; \ No newline at end of file +var _0x8969=['STRING','username','integrationTab','newTab','sequelize'];(function(_0x356d1b,_0x2a9fb7){var _0x4c2ca4=function(_0x4bf366){while(--_0x4bf366){_0x356d1b['push'](_0x356d1b['shift']());}};_0x4c2ca4(++_0x2a9fb7);}(_0x8969,0x130));var _0x9896=function(_0xa64bdd,_0xb6caed){_0xa64bdd=_0xa64bdd-0x0;var _0x3b3436=_0x8969[_0xa64bdd];return _0x3b3436;};'use strict';var Sequelize=require(_0x9896('0x0'));module['exports']={'name':{'type':Sequelize[_0x9896('0x1')]},'description':{'type':Sequelize[_0x9896('0x1')]},'username':{'type':Sequelize[_0x9896('0x1')],'unique':_0x9896('0x2')},'remoteUri':{'type':Sequelize[_0x9896('0x1')]},'password':{'type':Sequelize[_0x9896('0x1')]},'clientId':{'type':Sequelize[_0x9896('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x9896('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9896('0x3'),_0x9896('0x4')),'defaultValue':_0x9896('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 3d95326..2a340ed 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 _0xd176=['destroy','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','length','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','show','params','fields','find','catch','create','body','update','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','value','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','json'];(function(_0x2fbbc2,_0x5d1b8c){var _0x4a55f5=function(_0x19a926){while(--_0x19a926){_0x2fbbc2['push'](_0x2fbbc2['shift']());}};_0x4a55f5(++_0x5d1b8c);}(_0xd176,0x19c));var _0x6d17=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0xd176[_0x204ad4];return _0x50675f;};'use strict';var emlformat=require(_0x6d17('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d17('0x1'));var jsonpatch=require(_0x6d17('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6d17('0x3'));var Mustache=require(_0x6d17('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6d17('0x5'));var csv=require('to-csv');var ejs=require(_0x6d17('0x6'));var fs=require('fs');var fs_extra=require(_0x6d17('0x7'));var _=require('lodash');var squel=require(_0x6d17('0x8'));var crypto=require(_0x6d17('0x9'));var jsforce=require(_0x6d17('0xa'));var deskjs=require(_0x6d17('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6d17('0xc'));var Papa=require(_0x6d17('0xd'));var Redis=require(_0x6d17('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6d17('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d17('0x10'));var logger=require(_0x6d17('0x11'))(_0x6d17('0x12'));var utils=require('../../config/utils');var config=require(_0x6d17('0x13'));var licenseUtil=require(_0x6d17('0x14'));var db=require(_0x6d17('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x17983f,_0x3c4bb7){_0x3c4bb7=_0x3c4bb7||0xcc;return function(_0x553433){if(_0x553433){return _0x17983f[_0x6d17('0x16')](_0x3c4bb7);}return _0x17983f['status'](_0x3c4bb7)['end']();};}function respondWithResult(_0x739973,_0x2f2ea4){_0x2f2ea4=_0x2f2ea4||0xc8;return function(_0x237e98){if(_0x237e98){return _0x739973[_0x6d17('0x17')](_0x2f2ea4)['json'](_0x237e98);}};}function respondWithFilteredResult(_0x719f75,_0x2af85b){return function(_0x16400c){if(_0x16400c){var _0x3ab83f=typeof _0x2af85b['offset']===_0x6d17('0x18')&&typeof _0x2af85b[_0x6d17('0x19')]===_0x6d17('0x18');var _0x49a5c7=_0x16400c['count'];var _0x44d56b=_0x3ab83f?0x0:_0x2af85b[_0x6d17('0x1a')];var _0x4c76f0=_0x3ab83f?_0x16400c['count']:_0x2af85b[_0x6d17('0x1a')]+_0x2af85b[_0x6d17('0x19')];var _0x5a5fc5;if(_0x4c76f0>=_0x49a5c7){_0x4c76f0=_0x49a5c7;_0x5a5fc5=0xc8;}else{_0x5a5fc5=0xce;}_0x719f75[_0x6d17('0x17')](_0x5a5fc5);return _0x719f75['set']('Content-Range',_0x44d56b+'-'+_0x4c76f0+'/'+_0x49a5c7)[_0x6d17('0x1b')](_0x16400c);}return null;};}function patchUpdates(_0xee5258){return function(_0x4fbe48){try{jsonpatch['apply'](_0x4fbe48,_0xee5258,!![]);}catch(_0x277fb1){return BPromise['reject'](_0x277fb1);}return _0x4fbe48['save']();};}function saveUpdates(_0x273566,_0xca1e66){return function(_0xd94f5f){if(_0xd94f5f){return _0xd94f5f['update'](_0x273566)['then'](function(_0x18fdd4){return _0x18fdd4;});}return null;};}function removeEntity(_0x5a6871,_0x1a7779){return function(_0x55a39e){if(_0x55a39e){return _0x55a39e[_0x6d17('0x1c')]()[_0x6d17('0x1d')](function(){_0x5a6871[_0x6d17('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b19b1,_0x4ba466){return function(_0x20ad06){if(!_0x20ad06){_0x4b19b1[_0x6d17('0x16')](0x194);}return _0x20ad06;};}function handleError(_0x55b311,_0x33eb0e){_0x33eb0e=_0x33eb0e||0x1f4;return function(_0x1dbb50){logger[_0x6d17('0x1e')](_0x1dbb50[_0x6d17('0x1f')]);if(_0x1dbb50['name']){delete _0x1dbb50[_0x6d17('0x20')];}_0x55b311[_0x6d17('0x17')](_0x33eb0e)[_0x6d17('0x21')](_0x1dbb50);};}exports[_0x6d17('0x22')]=function(_0x42d861,_0x4bf6e7){var _0x30925c={},_0x4618f6={},_0x5d1c32={'count':0x0,'rows':[]};var _0xbd549d=_[_0x6d17('0x23')](db[_0x6d17('0x24')][_0x6d17('0x25')],function(_0x40207f){return{'name':_0x40207f['fieldName'],'type':_0x40207f[_0x6d17('0x26')][_0x6d17('0x27')]};});_0x4618f6['model']=_[_0x6d17('0x23')](_0xbd549d,'name');_0x4618f6[_0x6d17('0x28')]=_[_0x6d17('0x29')](_0x42d861[_0x6d17('0x28')]);_0x4618f6[_0x6d17('0x2a')]=_['intersection'](_0x4618f6['model'],_0x4618f6[_0x6d17('0x28')]);_0x30925c[_0x6d17('0x2b')]=_[_0x6d17('0x2c')](_0x4618f6[_0x6d17('0x2d')],qs['fields'](_0x42d861[_0x6d17('0x28')]['fields']));_0x30925c[_0x6d17('0x2b')]=_0x30925c[_0x6d17('0x2b')][_0x6d17('0x2e')]?_0x30925c[_0x6d17('0x2b')]:_0x4618f6[_0x6d17('0x2d')];if(!_0x42d861[_0x6d17('0x28')]['hasOwnProperty']('nolimit')){_0x30925c[_0x6d17('0x19')]=qs['limit'](_0x42d861[_0x6d17('0x28')][_0x6d17('0x19')]);_0x30925c[_0x6d17('0x1a')]=qs[_0x6d17('0x1a')](_0x42d861['query'][_0x6d17('0x1a')]);}_0x30925c[_0x6d17('0x2f')]=qs['sort'](_0x42d861['query'][_0x6d17('0x30')]);_0x30925c[_0x6d17('0x31')]=qs[_0x6d17('0x2a')](_[_0x6d17('0x32')](_0x42d861[_0x6d17('0x28')],_0x4618f6[_0x6d17('0x2a')]),_0xbd549d);if(_0x42d861[_0x6d17('0x28')][_0x6d17('0x33')]){_0x30925c['where']=_[_0x6d17('0x34')](_0x30925c[_0x6d17('0x31')],{'$or':_[_0x6d17('0x23')](_0xbd549d,function(_0x3a6b9a){if(_0x3a6b9a[_0x6d17('0x26')]!=='VIRTUAL'){var _0x103bb7={};_0x103bb7[_0x3a6b9a['name']]={'$like':'%'+_0x42d861[_0x6d17('0x28')][_0x6d17('0x33')]+'%'};return _0x103bb7;}})});}_0x30925c=_['merge']({},_0x30925c,_0x42d861[_0x6d17('0x35')]);var _0x399c70={'where':_0x30925c[_0x6d17('0x31')]};return db[_0x6d17('0x24')][_0x6d17('0x36')](_0x399c70)['then'](function(_0x1bafc1){_0x5d1c32['count']=_0x1bafc1;if(_0x42d861[_0x6d17('0x28')][_0x6d17('0x37')]){_0x30925c[_0x6d17('0x38')]=[{'all':!![]}];}return db[_0x6d17('0x24')][_0x6d17('0x39')](_0x30925c);})[_0x6d17('0x1d')](function(_0x9809d3){_0x5d1c32['rows']=_0x9809d3;return _0x5d1c32;})['then'](respondWithFilteredResult(_0x4bf6e7,_0x30925c))['catch'](handleError(_0x4bf6e7,null));};exports[_0x6d17('0x3a')]=function(_0x228efe,_0x424120){var _0x5a135c={'raw':![],'where':{'id':_0x228efe[_0x6d17('0x3b')]['id']}},_0x1be626={};_0x1be626['model']=_[_0x6d17('0x29')](db[_0x6d17('0x24')][_0x6d17('0x25')]);_0x1be626['query']=_['keys'](_0x228efe[_0x6d17('0x28')]);_0x1be626[_0x6d17('0x2a')]=_['intersection'](_0x1be626[_0x6d17('0x2d')],_0x1be626['query']);_0x5a135c[_0x6d17('0x2b')]=_[_0x6d17('0x2c')](_0x1be626[_0x6d17('0x2d')],qs[_0x6d17('0x3c')](_0x228efe['query'][_0x6d17('0x3c')]));_0x5a135c[_0x6d17('0x2b')]=_0x5a135c[_0x6d17('0x2b')][_0x6d17('0x2e')]?_0x5a135c[_0x6d17('0x2b')]:_0x1be626[_0x6d17('0x2d')];if(_0x228efe[_0x6d17('0x28')][_0x6d17('0x37')]){_0x5a135c[_0x6d17('0x38')]=[{'all':!![]}];}_0x5a135c=_[_0x6d17('0x34')]({},_0x5a135c,_0x228efe['options']);return db[_0x6d17('0x24')][_0x6d17('0x3d')](_0x5a135c)[_0x6d17('0x1d')](handleEntityNotFound(_0x424120,null))[_0x6d17('0x1d')](respondWithResult(_0x424120,null))[_0x6d17('0x3e')](handleError(_0x424120,null));};exports[_0x6d17('0x3f')]=function(_0x2d1e2e,_0x5314dd){return db[_0x6d17('0x24')][_0x6d17('0x3f')](_0x2d1e2e[_0x6d17('0x40')],{})['then'](respondWithResult(_0x5314dd,0xc9))[_0x6d17('0x3e')](handleError(_0x5314dd,null));};exports[_0x6d17('0x41')]=function(_0x20210e,_0x3d5a13){if(_0x20210e[_0x6d17('0x40')]['id']){delete _0x20210e['body']['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x20210e[_0x6d17('0x3b')]['id']}})[_0x6d17('0x1d')](handleEntityNotFound(_0x3d5a13,null))[_0x6d17('0x1d')](saveUpdates(_0x20210e[_0x6d17('0x40')],null))['then'](respondWithResult(_0x3d5a13,null))[_0x6d17('0x3e')](handleError(_0x3d5a13,null));};exports[_0x6d17('0x1c')]=function(_0x4cddb6,_0x35ae93){return db[_0x6d17('0x24')]['find']({'where':{'id':_0x4cddb6[_0x6d17('0x3b')]['id']}})[_0x6d17('0x1d')](handleEntityNotFound(_0x35ae93,null))['then'](removeEntity(_0x35ae93,null))[_0x6d17('0x3e')](handleError(_0x35ae93,null));};exports[_0x6d17('0x42')]=function(_0xafdc8c,_0x1b81b1,_0xd923f7){var _0x173c33={};var _0x56b0f8={};var _0xf82207;var _0x2f5969;return db[_0x6d17('0x24')]['findOne']({'where':{'id':_0xafdc8c[_0x6d17('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1b81b1,null))['then'](function(_0x26c756){if(_0x26c756){_0xf82207=_0x26c756;_0x56b0f8[_0x6d17('0x2d')]=_[_0x6d17('0x29')](db['SalesforceConfiguration'][_0x6d17('0x25')]);_0x56b0f8[_0x6d17('0x28')]=_['keys'](_0xafdc8c[_0x6d17('0x28')]);_0x56b0f8[_0x6d17('0x2a')]=_[_0x6d17('0x2c')](_0x56b0f8[_0x6d17('0x2d')],_0x56b0f8[_0x6d17('0x28')]);_0x173c33[_0x6d17('0x2b')]=_[_0x6d17('0x2c')](_0x56b0f8[_0x6d17('0x2d')],qs['fields'](_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x3c')]));_0x173c33[_0x6d17('0x2b')]=_0x173c33['attributes'][_0x6d17('0x2e')]?_0x173c33['attributes']:_0x56b0f8['model'];_0x173c33[_0x6d17('0x2f')]=qs[_0x6d17('0x30')](_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x30')]);_0x173c33[_0x6d17('0x31')]=qs[_0x6d17('0x2a')](_[_0x6d17('0x32')](_0xafdc8c['query'],_0x56b0f8[_0x6d17('0x2a')]));if(_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x33')]){_0x173c33['where']=_[_0x6d17('0x34')](_0x173c33[_0x6d17('0x31')],{'$or':_[_0x6d17('0x23')](_0x173c33['attributes'],function(_0xc1b34f){var _0x11dced={};_0x11dced[_0xc1b34f]={'$like':'%'+_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x33')]+'%'};return _0x11dced;})});}_0x173c33=_[_0x6d17('0x34')]({},_0x173c33,_0xafdc8c['options']);return _0xf82207['getConfigurations'](_0x173c33);}})['then'](function(_0x52f2b8){if(_0x52f2b8){_0x2f5969=_0x52f2b8['length'];if(!_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x43')]('nolimit')){_0x173c33[_0x6d17('0x19')]=qs['limit'](_0xafdc8c[_0x6d17('0x28')]['limit']);_0x173c33['offset']=qs['offset'](_0xafdc8c['query'][_0x6d17('0x1a')]);}return _0xf82207[_0x6d17('0x42')](_0x173c33);}})['then'](function(_0x3a9329){if(_0x3a9329){return _0x3a9329?{'count':_0x2f5969,'rows':_0x3a9329}:null;}})[_0x6d17('0x1d')](respondWithResult(_0x1b81b1,null))['catch'](handleError(_0x1b81b1,null));};exports[_0x6d17('0x44')]=function(_0x4db3dc,_0x422ee3,_0x271bc0){if(_0x4db3dc[_0x6d17('0x40')]['id']){delete _0x4db3dc[_0x6d17('0x40')]['id'];}return db[_0x6d17('0x24')][_0x6d17('0x45')]({'where':{'id':_0x4db3dc[_0x6d17('0x3b')]['id']}})[_0x6d17('0x1d')](handleEntityNotFound(_0x422ee3,null))['then'](function(_0x11eb16){if(_0x11eb16){_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x46')]=_0x11eb16['id'];_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x47')]=integrations[_0x6d17('0x48')](_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x49')],_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x26')]);_0x4db3dc['body'][_0x6d17('0x4a')]=integrations['getDescriptions'](_0x4db3dc[_0x6d17('0x40')]['channel'],_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x26')]);return db['SalesforceConfiguration'][_0x6d17('0x3f')](_0x4db3dc[_0x6d17('0x40')],{'include':[{'model':db[_0x6d17('0x4b')],'as':_0x6d17('0x47')},{'model':db[_0x6d17('0x4b')],'as':_0x6d17('0x4a')}]});}return null;})[_0x6d17('0x1d')](respondWithResult(_0x422ee3,null))['catch'](handleError(_0x422ee3,null));};exports[_0x6d17('0x4c')]=function(_0x25ef17,_0xc0c4e,_0x287283){var _0x4dbd7c;var _0x232dd3='';var _0x5d326e='Task';return db['SalesforceAccount'][_0x6d17('0x45')]({'where':{'id':_0x25ef17[_0x6d17('0x3b')]['id']},'attributes':['id','remoteUri','clientId',_0x6d17('0x4d'),_0x6d17('0x4e'),'password',_0x6d17('0x4f')]})[_0x6d17('0x1d')](handleEntityNotFound(_0xc0c4e,null))[_0x6d17('0x1d')](function(_0x226892){if(_0x226892){_0x232dd3=_0x226892['remoteUri'];var _0x17ab9b=_0x232dd3[_0x6d17('0x50')](-0x1);if(_0x17ab9b==='/'){_0x232dd3=_0x232dd3[_0x6d17('0x51')](0x0,_0x232dd3[_0x6d17('0x52')](_0x17ab9b));}_0x4dbd7c=new jsforce[(_0x6d17('0x53'))]({'oauth2':{'loginUrl':_0x232dd3,'clientId':_0x226892['clientId'],'clientSecret':_0x226892['clientSecret']}});return _0x4dbd7c[_0x6d17('0x54')](_0x226892[_0x6d17('0x4e')],_0x226892['password'][_0x6d17('0x55')](_0x226892[_0x6d17('0x4f')]));}})[_0x6d17('0x1d')](function(_0x4f53b0){if(_0x4f53b0){if(!_[_0x6d17('0x56')](_0x25ef17[_0x6d17('0x28')][_0x6d17('0x57')])){_0x5d326e=_0x25ef17[_0x6d17('0x28')][_0x6d17('0x57')];}return _0x4dbd7c['sobject'](_0x5d326e)[_0x6d17('0x58')]();}})['then'](function(_0x442012){var _0x4ac88b=[_0x6d17('0x59'),_0x6d17('0x5a'),_0x6d17('0x5b'),_0x6d17('0x5c'),_0x6d17('0x5d'),_0x6d17('0x5e')];var _0x465537=[_0x6d17('0x5f'),'int',_0x6d17('0x60'),_0x6d17('0x61'),_0x6d17('0x62'),_0x6d17('0x63'),_0x6d17('0x64')];if(_0x442012){_[_0x6d17('0x65')](_0x442012[_0x6d17('0x3c')],function(_0x3f06fb){return _0x4ac88b[_0x6d17('0x66')](_0x3f06fb[_0x6d17('0x20')])||!_0x465537[_0x6d17('0x66')](_0x3f06fb[_0x6d17('0x26')]);});return{'count':_0x442012[_0x6d17('0x3c')]['length'],'rows':_[_0x6d17('0x23')](_0x442012['fields'],function(_0x390310){return{'id':_0x390310[_0x6d17('0x20')],'name':_0x390310[_0x6d17('0x67')],'custom':_0x390310[_0x6d17('0x68')],'options':_0x390310['picklistValues']['length']>0x0?_[_0x6d17('0x23')](_0x390310['picklistValues'],function(_0x4cc040){return{'name':_0x4cc040[_0x6d17('0x67')],'value':_0x4cc040[_0x6d17('0x69')]};}):_0x390310['type']==_0x6d17('0x61')?[{'name':'True','value':'true'},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0xc0c4e,null))[_0x6d17('0x3e')](function(_0x3bb232){var _0x12bb1a=_0x25ef17['query'][_0x6d17('0x6a')]?0x1f4:_0x3bb232[_0x6d17('0x6b')]||0x1f4;logger[_0x6d17('0x1e')]('getFields,\x20%s,\x20%s,\x20%s',_0x6d17('0x4c'),_0x12bb1a,JSON[_0x6d17('0x6c')](_0x3bb232));delete _0x3bb232[_0x6d17('0x20')];if(_0x12bb1a===0x191){_0x12bb1a=0x190;}_0xc0c4e[_0x6d17('0x17')](_0x12bb1a)['send'](_0x25ef17[_0x6d17('0x28')][_0x6d17('0x6a')]?{'message':_0x6d17('0x6d'),'statusCode':_0x3bb232[_0x6d17('0x6b')]}:_0x3bb232);});}; \ No newline at end of file +var _0xaf65=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','length','options','find','create','body','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','SalesforceField','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','remove','includes','picklistValues','label','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3844ab,_0x461e40){var _0x2a3276=function(_0x1d1176){while(--_0x1d1176){_0x3844ab['push'](_0x3844ab['shift']());}};_0x2a3276(++_0x461e40);}(_0xaf65,0x69));var _0x5af6=function(_0x1308e1,_0x5358d7){_0x1308e1=_0x1308e1-0x0;var _0xb10ccf=_0xaf65[_0x1308e1];return _0xb10ccf;};'use strict';var emlformat=require(_0x5af6('0x0'));var rimraf=require(_0x5af6('0x1'));var zipdir=require(_0x5af6('0x2'));var jsonpatch=require(_0x5af6('0x3'));var rp=require('request-promise');var moment=require(_0x5af6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5af6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5af6('0x6'));var ejs=require(_0x5af6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5af6('0x8'));var squel=require('squel');var crypto=require(_0x5af6('0x9'));var jsforce=require(_0x5af6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5af6('0xb'));var Papa=require(_0x5af6('0xc'));var Redis=require(_0x5af6('0xd'));var authService=require(_0x5af6('0xe'));var qs=require(_0x5af6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5af6('0x10'));var logger=require('../../config/logger')(_0x5af6('0x11'));var utils=require(_0x5af6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5af6('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5af6('0x14'));function respondWithStatusCode(_0x31222a,_0x540349){_0x540349=_0x540349||0xcc;return function(_0x2ec396){if(_0x2ec396){return _0x31222a[_0x5af6('0x15')](_0x540349);}return _0x31222a['status'](_0x540349)[_0x5af6('0x16')]();};}function respondWithResult(_0x245f4c,_0x4f85a0){_0x4f85a0=_0x4f85a0||0xc8;return function(_0xd814e0){if(_0xd814e0){return _0x245f4c[_0x5af6('0x17')](_0x4f85a0)['json'](_0xd814e0);}};}function respondWithFilteredResult(_0x7c8ef1,_0x41a833){return function(_0x1bacd0){if(_0x1bacd0){var _0x2674dc=typeof _0x41a833[_0x5af6('0x18')]===_0x5af6('0x19')&&typeof _0x41a833[_0x5af6('0x1a')]===_0x5af6('0x19');var _0x1347a1=_0x1bacd0['count'];var _0xffa3d2=_0x2674dc?0x0:_0x41a833[_0x5af6('0x18')];var _0x336766=_0x2674dc?_0x1bacd0[_0x5af6('0x1b')]:_0x41a833[_0x5af6('0x18')]+_0x41a833['limit'];var _0x5efc31;if(_0x336766>=_0x1347a1){_0x336766=_0x1347a1;_0x5efc31=0xc8;}else{_0x5efc31=0xce;}_0x7c8ef1[_0x5af6('0x17')](_0x5efc31);return _0x7c8ef1['set'](_0x5af6('0x1c'),_0xffa3d2+'-'+_0x336766+'/'+_0x1347a1)[_0x5af6('0x1d')](_0x1bacd0);}return null;};}function patchUpdates(_0x3e1f03){return function(_0x10b4e3){try{jsonpatch['apply'](_0x10b4e3,_0x3e1f03,!![]);}catch(_0x20748a){return BPromise[_0x5af6('0x1e')](_0x20748a);}return _0x10b4e3[_0x5af6('0x1f')]();};}function saveUpdates(_0x465832,_0x237121){return function(_0x50013b){if(_0x50013b){return _0x50013b[_0x5af6('0x20')](_0x465832)[_0x5af6('0x21')](function(_0x59f6b1){return _0x59f6b1;});}return null;};}function removeEntity(_0x311cc2,_0x1adc36){return function(_0x1a5911){if(_0x1a5911){return _0x1a5911[_0x5af6('0x22')]()[_0x5af6('0x21')](function(){_0x311cc2[_0x5af6('0x17')](0xcc)[_0x5af6('0x16')]();});}};}function handleEntityNotFound(_0x273651,_0x11769e){return function(_0x4cb01a){if(!_0x4cb01a){_0x273651[_0x5af6('0x15')](0x194);}return _0x4cb01a;};}function handleError(_0x4d84ec,_0x1181d1){_0x1181d1=_0x1181d1||0x1f4;return function(_0xd90da0){logger[_0x5af6('0x23')](_0xd90da0[_0x5af6('0x24')]);if(_0xd90da0[_0x5af6('0x25')]){delete _0xd90da0[_0x5af6('0x25')];}_0x4d84ec[_0x5af6('0x17')](_0x1181d1)[_0x5af6('0x26')](_0xd90da0);};}exports[_0x5af6('0x27')]=function(_0x4dfbf5,_0x318de2){var _0x3add28={},_0x186e98={},_0x312f4e={'count':0x0,'rows':[]};var _0x3e8f6c=_[_0x5af6('0x28')](db[_0x5af6('0x29')][_0x5af6('0x2a')],function(_0x45ba2e){return{'name':_0x45ba2e['fieldName'],'type':_0x45ba2e[_0x5af6('0x2b')][_0x5af6('0x2c')]};});_0x186e98[_0x5af6('0x2d')]=_[_0x5af6('0x28')](_0x3e8f6c,_0x5af6('0x25'));_0x186e98[_0x5af6('0x2e')]=_[_0x5af6('0x2f')](_0x4dfbf5['query']);_0x186e98[_0x5af6('0x30')]=_['intersection'](_0x186e98['model'],_0x186e98[_0x5af6('0x2e')]);_0x3add28['attributes']=_[_0x5af6('0x31')](_0x186e98[_0x5af6('0x2d')],qs[_0x5af6('0x32')](_0x4dfbf5[_0x5af6('0x2e')]['fields']));_0x3add28[_0x5af6('0x33')]=_0x3add28[_0x5af6('0x33')]['length']?_0x3add28[_0x5af6('0x33')]:_0x186e98['model'];if(!_0x4dfbf5[_0x5af6('0x2e')][_0x5af6('0x34')](_0x5af6('0x35'))){_0x3add28['limit']=qs[_0x5af6('0x1a')](_0x4dfbf5[_0x5af6('0x2e')][_0x5af6('0x1a')]);_0x3add28[_0x5af6('0x18')]=qs[_0x5af6('0x18')](_0x4dfbf5['query'][_0x5af6('0x18')]);}_0x3add28[_0x5af6('0x36')]=qs[_0x5af6('0x37')](_0x4dfbf5[_0x5af6('0x2e')][_0x5af6('0x37')]);_0x3add28[_0x5af6('0x38')]=qs['filters'](_[_0x5af6('0x39')](_0x4dfbf5[_0x5af6('0x2e')],_0x186e98[_0x5af6('0x30')]),_0x3e8f6c);if(_0x4dfbf5['query'][_0x5af6('0x3a')]){_0x3add28[_0x5af6('0x38')]=_[_0x5af6('0x3b')](_0x3add28[_0x5af6('0x38')],{'$or':_[_0x5af6('0x28')](_0x3e8f6c,function(_0x55c2ed){if(_0x55c2ed[_0x5af6('0x2b')]!==_0x5af6('0x3c')){var _0x2a5f40={};_0x2a5f40[_0x55c2ed[_0x5af6('0x25')]]={'$like':'%'+_0x4dfbf5[_0x5af6('0x2e')]['filter']+'%'};return _0x2a5f40;}})});}_0x3add28=_[_0x5af6('0x3b')]({},_0x3add28,_0x4dfbf5['options']);var _0x413994={'where':_0x3add28['where']};return db['SalesforceAccount'][_0x5af6('0x1b')](_0x413994)[_0x5af6('0x21')](function(_0x8a697c){_0x312f4e[_0x5af6('0x1b')]=_0x8a697c;if(_0x4dfbf5['query']['includeAll']){_0x3add28[_0x5af6('0x3d')]=[{'all':!![]}];}return db[_0x5af6('0x29')]['findAll'](_0x3add28);})[_0x5af6('0x21')](function(_0x5a3317){_0x312f4e[_0x5af6('0x3e')]=_0x5a3317;return _0x312f4e;})[_0x5af6('0x21')](respondWithFilteredResult(_0x318de2,_0x3add28))[_0x5af6('0x3f')](handleError(_0x318de2,null));};exports[_0x5af6('0x40')]=function(_0x1b9a90,_0x106bea){var _0x59fa86={'raw':![],'where':{'id':_0x1b9a90[_0x5af6('0x41')]['id']}},_0x2e9752={};_0x2e9752[_0x5af6('0x2d')]=_['keys'](db[_0x5af6('0x29')][_0x5af6('0x2a')]);_0x2e9752[_0x5af6('0x2e')]=_[_0x5af6('0x2f')](_0x1b9a90[_0x5af6('0x2e')]);_0x2e9752[_0x5af6('0x30')]=_['intersection'](_0x2e9752[_0x5af6('0x2d')],_0x2e9752['query']);_0x59fa86['attributes']=_[_0x5af6('0x31')](_0x2e9752[_0x5af6('0x2d')],qs[_0x5af6('0x32')](_0x1b9a90['query']['fields']));_0x59fa86[_0x5af6('0x33')]=_0x59fa86['attributes'][_0x5af6('0x42')]?_0x59fa86[_0x5af6('0x33')]:_0x2e9752[_0x5af6('0x2d')];if(_0x1b9a90[_0x5af6('0x2e')]['includeAll']){_0x59fa86[_0x5af6('0x3d')]=[{'all':!![]}];}_0x59fa86=_['merge']({},_0x59fa86,_0x1b9a90[_0x5af6('0x43')]);return db[_0x5af6('0x29')][_0x5af6('0x44')](_0x59fa86)['then'](handleEntityNotFound(_0x106bea,null))[_0x5af6('0x21')](respondWithResult(_0x106bea,null))[_0x5af6('0x3f')](handleError(_0x106bea,null));};exports[_0x5af6('0x45')]=function(_0x59b48e,_0x1c3a93){return db[_0x5af6('0x29')][_0x5af6('0x45')](_0x59b48e[_0x5af6('0x46')],{})['then'](respondWithResult(_0x1c3a93,0xc9))['catch'](handleError(_0x1c3a93,null));};exports[_0x5af6('0x20')]=function(_0x596ef9,_0x56db3e){if(_0x596ef9[_0x5af6('0x46')]['id']){delete _0x596ef9[_0x5af6('0x46')]['id'];}return db[_0x5af6('0x29')][_0x5af6('0x44')]({'where':{'id':_0x596ef9['params']['id']}})[_0x5af6('0x21')](handleEntityNotFound(_0x56db3e,null))[_0x5af6('0x21')](saveUpdates(_0x596ef9[_0x5af6('0x46')],null))['then'](respondWithResult(_0x56db3e,null))[_0x5af6('0x3f')](handleError(_0x56db3e,null));};exports[_0x5af6('0x22')]=function(_0x8a51b6,_0x108622){return db[_0x5af6('0x29')][_0x5af6('0x44')]({'where':{'id':_0x8a51b6[_0x5af6('0x41')]['id']}})['then'](handleEntityNotFound(_0x108622,null))[_0x5af6('0x21')](removeEntity(_0x108622,null))['catch'](handleError(_0x108622,null));};exports[_0x5af6('0x47')]=function(_0x475579,_0x3fd05e,_0x4e3a09){var _0x16b602={};var _0x35105b={};var _0x526b65;var _0xffe663;return db[_0x5af6('0x29')]['findOne']({'where':{'id':_0x475579[_0x5af6('0x41')]['id']}})[_0x5af6('0x21')](handleEntityNotFound(_0x3fd05e,null))[_0x5af6('0x21')](function(_0x3f3197){if(_0x3f3197){_0x526b65=_0x3f3197;_0x35105b['model']=_[_0x5af6('0x2f')](db[_0x5af6('0x48')][_0x5af6('0x2a')]);_0x35105b[_0x5af6('0x2e')]=_[_0x5af6('0x2f')](_0x475579[_0x5af6('0x2e')]);_0x35105b[_0x5af6('0x30')]=_[_0x5af6('0x31')](_0x35105b['model'],_0x35105b[_0x5af6('0x2e')]);_0x16b602[_0x5af6('0x33')]=_[_0x5af6('0x31')](_0x35105b[_0x5af6('0x2d')],qs[_0x5af6('0x32')](_0x475579[_0x5af6('0x2e')][_0x5af6('0x32')]));_0x16b602[_0x5af6('0x33')]=_0x16b602[_0x5af6('0x33')][_0x5af6('0x42')]?_0x16b602[_0x5af6('0x33')]:_0x35105b[_0x5af6('0x2d')];_0x16b602['order']=qs[_0x5af6('0x37')](_0x475579[_0x5af6('0x2e')][_0x5af6('0x37')]);_0x16b602[_0x5af6('0x38')]=qs[_0x5af6('0x30')](_[_0x5af6('0x39')](_0x475579[_0x5af6('0x2e')],_0x35105b[_0x5af6('0x30')]));if(_0x475579[_0x5af6('0x2e')][_0x5af6('0x3a')]){_0x16b602[_0x5af6('0x38')]=_[_0x5af6('0x3b')](_0x16b602[_0x5af6('0x38')],{'$or':_[_0x5af6('0x28')](_0x16b602['attributes'],function(_0x176f18){var _0x3dcd39={};_0x3dcd39[_0x176f18]={'$like':'%'+_0x475579[_0x5af6('0x2e')]['filter']+'%'};return _0x3dcd39;})});}_0x16b602=_['merge']({},_0x16b602,_0x475579[_0x5af6('0x43')]);return _0x526b65[_0x5af6('0x47')](_0x16b602);}})['then'](function(_0x5bb37c){if(_0x5bb37c){_0xffe663=_0x5bb37c[_0x5af6('0x42')];if(!_0x475579[_0x5af6('0x2e')]['hasOwnProperty']('nolimit')){_0x16b602[_0x5af6('0x1a')]=qs['limit'](_0x475579[_0x5af6('0x2e')][_0x5af6('0x1a')]);_0x16b602[_0x5af6('0x18')]=qs['offset'](_0x475579[_0x5af6('0x2e')]['offset']);}return _0x526b65[_0x5af6('0x47')](_0x16b602);}})[_0x5af6('0x21')](function(_0x3c46b1){if(_0x3c46b1){return _0x3c46b1?{'count':_0xffe663,'rows':_0x3c46b1}:null;}})[_0x5af6('0x21')](respondWithResult(_0x3fd05e,null))[_0x5af6('0x3f')](handleError(_0x3fd05e,null));};exports[_0x5af6('0x49')]=function(_0xf43aba,_0x17834f,_0x21c83d){if(_0xf43aba[_0x5af6('0x46')]['id']){delete _0xf43aba[_0x5af6('0x46')]['id'];}return db[_0x5af6('0x29')][_0x5af6('0x4a')]({'where':{'id':_0xf43aba['params']['id']}})[_0x5af6('0x21')](handleEntityNotFound(_0x17834f,null))[_0x5af6('0x21')](function(_0x475224){if(_0x475224){_0xf43aba['body'][_0x5af6('0x4b')]=_0x475224['id'];_0xf43aba[_0x5af6('0x46')]['Subjects']=integrations[_0x5af6('0x4c')](_0xf43aba[_0x5af6('0x46')][_0x5af6('0x4d')],_0xf43aba[_0x5af6('0x46')][_0x5af6('0x2b')]);_0xf43aba[_0x5af6('0x46')][_0x5af6('0x4e')]=integrations['getDescriptions'](_0xf43aba[_0x5af6('0x46')][_0x5af6('0x4d')],_0xf43aba['body'][_0x5af6('0x2b')]);return db[_0x5af6('0x48')][_0x5af6('0x45')](_0xf43aba['body'],{'include':[{'model':db[_0x5af6('0x4f')],'as':'Subjects'},{'model':db[_0x5af6('0x4f')],'as':_0x5af6('0x4e')}]});}return null;})['then'](respondWithResult(_0x17834f,null))[_0x5af6('0x3f')](handleError(_0x17834f,null));};exports['getFields']=function(_0x1b822a,_0x1f7374,_0x368933){var _0x3a5078;var _0x2066e6='';var _0x3ab35c='Task';return db['SalesforceAccount']['findOne']({'where':{'id':_0x1b822a[_0x5af6('0x41')]['id']},'attributes':['id',_0x5af6('0x50'),_0x5af6('0x51'),_0x5af6('0x52'),_0x5af6('0x53'),_0x5af6('0x54'),_0x5af6('0x55')]})[_0x5af6('0x21')](handleEntityNotFound(_0x1f7374,null))[_0x5af6('0x21')](function(_0x5a3011){if(_0x5a3011){_0x2066e6=_0x5a3011[_0x5af6('0x50')];var _0x384582=_0x2066e6['slice'](-0x1);if(_0x384582==='/'){_0x2066e6=_0x2066e6[_0x5af6('0x56')](0x0,_0x2066e6[_0x5af6('0x57')](_0x384582));}_0x3a5078=new jsforce[(_0x5af6('0x58'))]({'oauth2':{'loginUrl':_0x2066e6,'clientId':_0x5a3011['clientId'],'clientSecret':_0x5a3011['clientSecret']}});return _0x3a5078[_0x5af6('0x59')](_0x5a3011[_0x5af6('0x53')],_0x5a3011[_0x5af6('0x54')][_0x5af6('0x5a')](_0x5a3011[_0x5af6('0x55')]));}})[_0x5af6('0x21')](function(_0xef20dd){if(_0xef20dd){if(!_[_0x5af6('0x5b')](_0x1b822a[_0x5af6('0x2e')]['ticketType'])){_0x3ab35c=_0x1b822a[_0x5af6('0x2e')][_0x5af6('0x5c')];}return _0x3a5078[_0x5af6('0x5d')](_0x3ab35c)[_0x5af6('0x5e')]();}})['then'](function(_0x5ed46c){var _0xb4d399=[_0x5af6('0x5f'),_0x5af6('0x60'),'IsReminderSet',_0x5af6('0x61'),_0x5af6('0x62'),_0x5af6('0x63')];var _0x6c6c3e=[_0x5af6('0x64'),_0x5af6('0x65'),_0x5af6('0x66'),_0x5af6('0x67'),_0x5af6('0x68'),'textarea','phone'];if(_0x5ed46c){_[_0x5af6('0x69')](_0x5ed46c[_0x5af6('0x32')],function(_0x38bf8c){return _0xb4d399[_0x5af6('0x6a')](_0x38bf8c[_0x5af6('0x25')])||!_0x6c6c3e[_0x5af6('0x6a')](_0x38bf8c[_0x5af6('0x2b')]);});return{'count':_0x5ed46c[_0x5af6('0x32')]['length'],'rows':_[_0x5af6('0x28')](_0x5ed46c[_0x5af6('0x32')],function(_0x46d7b3){return{'id':_0x46d7b3['name'],'name':_0x46d7b3['label'],'custom':_0x46d7b3['custom'],'options':_0x46d7b3[_0x5af6('0x6b')]['length']>0x0?_['map'](_0x46d7b3['picklistValues'],function(_0x37553f){return{'name':_0x37553f[_0x5af6('0x6c')],'value':_0x37553f[_0x5af6('0x6d')]};}):_0x46d7b3['type']=='boolean'?[{'name':_0x5af6('0x6e'),'value':_0x5af6('0x6f')},{'name':_0x5af6('0x70'),'value':_0x5af6('0x71')}]:[]};})};}})[_0x5af6('0x21')](respondWithResult(_0x1f7374,null))[_0x5af6('0x3f')](function(_0xa91b09){var _0x2c82cb=_0x1b822a[_0x5af6('0x2e')][_0x5af6('0x72')]?0x1f4:_0xa91b09[_0x5af6('0x73')]||0x1f4;logger[_0x5af6('0x23')](_0x5af6('0x74'),_0x5af6('0x75'),_0x2c82cb,JSON[_0x5af6('0x76')](_0xa91b09));delete _0xa91b09['name'];if(_0x2c82cb===0x191){_0x2c82cb=0x190;}_0x1f7374[_0x5af6('0x17')](_0x2c82cb)[_0x5af6('0x26')](_0x1b822a[_0x5af6('0x2e')]['test']?{'message':_0x5af6('0x77'),'statusCode':_0xa91b09[_0x5af6('0x73')]}:_0xa91b09);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index fda30d5..b2ad09c 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 _0x1323=['../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','rimraf'];(function(_0x242117,_0x505596){var _0x51e9df=function(_0x522ddc){while(--_0x522ddc){_0x242117['push'](_0x242117['shift']());}};_0x51e9df(++_0x505596);}(_0x1323,0xcc));var _0x3132=function(_0x261861,_0x4f0a05){_0x261861=_0x261861-0x0;var _0x330f1b=_0x1323[_0x261861];return _0x330f1b;};'use strict';var _=require('lodash');var util=require(_0x3132('0x0'));var logger=require(_0x3132('0x1'))(_0x3132('0x2'));var moment=require(_0x3132('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3132('0x4'));var config=require(_0x3132('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x3132('0x6'));module[_0x3132('0x7')]=function(_0x30a5d5,_0x4f10b8){return _0x30a5d5[_0x3132('0x8')](_0x3132('0x9'),attributes,{'tableName':_0x3132('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa75b=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','lodash','api','moment','bluebird'];(function(_0x33114c,_0x5c1016){var _0x2946aa=function(_0x5bec1f){while(--_0x5bec1f){_0x33114c['push'](_0x33114c['shift']());}};_0x2946aa(++_0x5c1016);}(_0xa75b,0x170));var _0xba75=function(_0xd01c2d,_0x5e27f8){_0xd01c2d=_0xd01c2d-0x0;var _0x1391fc=_0xa75b[_0xd01c2d];return _0x1391fc;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));var integrations=require(_0xba75('0x9'));module[_0xba75('0xa')]=function(_0x2baa28,_0x238a33){return _0x2baa28[_0xba75('0xb')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 06a9fd6..cb0b698 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 _0xbc71=['include','map','model','catch','ShowSalesforceAccount','find','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit'];(function(_0x58a03d,_0x4276e5){var _0xd3e2e9=function(_0x292a88){while(--_0x292a88){_0x58a03d['push'](_0x58a03d['shift']());}};_0xd3e2e9(++_0x4276e5);}(_0xbc71,0x86));var _0x1bc7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbc71[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x1bc7('0x0'));var util=require('util');var moment=require(_0x1bc7('0x1'));var BPromise=require('bluebird');var rs=require(_0x1bc7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bc7('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1bc7('0x4'));var config=require(_0x1bc7('0x5'));var jayson=require(_0x1bc7('0x6'));var client=jayson['client'][_0x1bc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ea667,_0xeb4ea4,_0x15e220){return new BPromise(function(_0x4cf0a4,_0x844b0a){return client['request'](_0x2ea667,_0x15e220)[_0x1bc7('0x8')](function(_0x5ba951){logger[_0x1bc7('0x9')](_0x1bc7('0xa'),_0xeb4ea4,'request\x20sent');logger[_0x1bc7('0xb')](_0x1bc7('0xc'),_0xeb4ea4,_0x1bc7('0xd'),JSON[_0x1bc7('0xe')](_0x5ba951));if(_0x5ba951['error']){if(_0x5ba951[_0x1bc7('0xf')][_0x1bc7('0x10')]===0x1f4){logger['error'](_0x1bc7('0xa'),_0xeb4ea4,_0x5ba951[_0x1bc7('0xf')][_0x1bc7('0x11')]);return _0x844b0a(_0x5ba951[_0x1bc7('0xf')][_0x1bc7('0x11')]);}logger['error'](_0x1bc7('0xa'),_0xeb4ea4,_0x5ba951['error']['message']);return _0x4cf0a4(_0x5ba951['error'][_0x1bc7('0x11')]);}else{logger[_0x1bc7('0x9')]('SalesforceAccount,\x20%s,\x20%s',_0xeb4ea4,_0x1bc7('0xd'));_0x4cf0a4(_0x5ba951['result'][_0x1bc7('0x11')]);}})['catch'](function(_0x5806f1){logger[_0x1bc7('0xf')](_0x1bc7('0xa'),_0xeb4ea4,_0x5806f1);_0x844b0a(_0x5806f1);});});}exports[_0x1bc7('0x12')]=function(_0xbd4f88){var _0x2b0ae4=this;return new Promise(function(_0x21e3f3,_0x2e309e){return db[_0x1bc7('0x13')][_0x1bc7('0x14')]({'raw':_0xbd4f88['options']?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x16')]===undefined?!![]:![]:!![],'where':_0xbd4f88['options']?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x17')]||null:null,'attributes':_0xbd4f88[_0x1bc7('0x15')]?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x18')]||null:null,'limit':_0xbd4f88[_0x1bc7('0x15')]?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x19')]||null:null,'include':_0xbd4f88[_0x1bc7('0x15')]?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x1a')],function(_0x3ce3d8){return{'model':db[_0x3ce3d8['model']],'as':_0x3ce3d8['as'],'attributes':_0x3ce3d8['attributes'],'include':_0x3ce3d8[_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0x3ce3d8[_0x1bc7('0x1a')],function(_0x1cddb4){return{'model':db[_0x1cddb4[_0x1bc7('0x1c')]],'as':_0x1cddb4['as'],'attributes':_0x1cddb4[_0x1bc7('0x18')],'include':_0x1cddb4[_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0x1cddb4['include'],function(_0x552a84){return{'model':db[_0x552a84[_0x1bc7('0x1c')]],'as':_0x552a84['as'],'attributes':_0x552a84[_0x1bc7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1bc7('0x8')](function(_0x584a2c){logger[_0x1bc7('0x9')](_0x1bc7('0x12'),_0xbd4f88);logger[_0x1bc7('0xb')]('GetSalesforceAccount',_0xbd4f88,JSON[_0x1bc7('0xe')](_0x584a2c));_0x21e3f3(_0x584a2c);})[_0x1bc7('0x1d')](function(_0xdb5fbd){logger[_0x1bc7('0xf')](_0x1bc7('0x12'),_0xdb5fbd[_0x1bc7('0x11')],_0xbd4f88);_0x2e309e(_0x2b0ae4['error'](0x1f4,_0xdb5fbd[_0x1bc7('0x11')]));});});};exports[_0x1bc7('0x1e')]=function(_0x326a0e){var _0x14b2dd=this;return new Promise(function(_0x56b059,_0x460749){return db[_0x1bc7('0x13')][_0x1bc7('0x1f')]({'raw':_0x326a0e[_0x1bc7('0x15')]?_0x326a0e[_0x1bc7('0x15')][_0x1bc7('0x16')]===undefined?!![]:![]:!![],'where':_0x326a0e[_0x1bc7('0x15')]?_0x326a0e['options'][_0x1bc7('0x17')]||null:null,'attributes':_0x326a0e[_0x1bc7('0x15')]?_0x326a0e[_0x1bc7('0x15')][_0x1bc7('0x18')]||null:null,'include':_0x326a0e[_0x1bc7('0x15')]?_0x326a0e[_0x1bc7('0x15')][_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0x326a0e['options'][_0x1bc7('0x1a')],function(_0x3ee7a8){return{'model':db[_0x3ee7a8['model']],'as':_0x3ee7a8['as'],'attributes':_0x3ee7a8[_0x1bc7('0x18')],'include':_0x3ee7a8['include']?_[_0x1bc7('0x1b')](_0x3ee7a8[_0x1bc7('0x1a')],function(_0x48ef5c){return{'model':db[_0x48ef5c[_0x1bc7('0x1c')]],'as':_0x48ef5c['as'],'attributes':_0x48ef5c[_0x1bc7('0x18')],'include':_0x48ef5c[_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0x48ef5c[_0x1bc7('0x1a')],function(_0x21432c){return{'model':db[_0x21432c['model']],'as':_0x21432c['as'],'attributes':_0x21432c[_0x1bc7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1bc7('0x8')](function(_0x152353){logger[_0x1bc7('0x9')]('ShowSalesforceAccount',_0x326a0e);logger[_0x1bc7('0xb')](_0x1bc7('0x1e'),_0x326a0e,JSON[_0x1bc7('0xe')](_0x152353));_0x56b059(_0x152353);})['catch'](function(_0x43c7f4){logger[_0x1bc7('0xf')](_0x1bc7('0x1e'),_0x43c7f4[_0x1bc7('0x11')],_0x326a0e);_0x460749(_0x14b2dd[_0x1bc7('0xf')](0x1f4,_0x43c7f4[_0x1bc7('0x11')]));});});}; \ No newline at end of file +var _0xe1a1=['request','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','limit','include','map','model','attributes','info','ShowSalesforceAccount','find','raw','where','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x11167c,_0xb0ff07){var _0x34bdb0=function(_0x34f17f){while(--_0x34f17f){_0x11167c['push'](_0x11167c['shift']());}};_0x34bdb0(++_0xb0ff07);}(_0xe1a1,0x14a));var _0x1e1a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe1a1[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1e1a('0x0'));var BPromise=require(_0x1e1a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e1a('0x2'))['db'];var utils=require(_0x1e1a('0x3'));var logger=require(_0x1e1a('0x4'))(_0x1e1a('0x5'));var config=require(_0x1e1a('0x6'));var jayson=require(_0x1e1a('0x7'));var client=jayson[_0x1e1a('0x8')][_0x1e1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf1d3f5,_0x582e55,_0xd6f52b){return new BPromise(function(_0x5800b8,_0x49db37){return client[_0x1e1a('0xa')](_0xf1d3f5,_0xd6f52b)[_0x1e1a('0xb')](function(_0x2a2302){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x582e55,_0x1e1a('0xc'));logger[_0x1e1a('0xd')](_0x1e1a('0xe'),_0x582e55,_0x1e1a('0xc'),JSON[_0x1e1a('0xf')](_0x2a2302));if(_0x2a2302[_0x1e1a('0x10')]){if(_0x2a2302[_0x1e1a('0x10')]['code']===0x1f4){logger[_0x1e1a('0x10')](_0x1e1a('0x11'),_0x582e55,_0x2a2302[_0x1e1a('0x10')]['message']);return _0x49db37(_0x2a2302[_0x1e1a('0x10')][_0x1e1a('0x12')]);}logger['error'](_0x1e1a('0x11'),_0x582e55,_0x2a2302[_0x1e1a('0x10')][_0x1e1a('0x12')]);return _0x5800b8(_0x2a2302['error'][_0x1e1a('0x12')]);}else{logger['info'](_0x1e1a('0x11'),_0x582e55,_0x1e1a('0xc'));_0x5800b8(_0x2a2302[_0x1e1a('0x13')][_0x1e1a('0x12')]);}})[_0x1e1a('0x14')](function(_0x15fd49){logger[_0x1e1a('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x582e55,_0x15fd49);_0x49db37(_0x15fd49);});});}exports[_0x1e1a('0x15')]=function(_0x5cdf87){var _0xf6f976=this;return new Promise(function(_0x2f7649,_0x3ac9c8){return db[_0x1e1a('0x16')]['findAll']({'raw':_0x5cdf87[_0x1e1a('0x17')]?_0x5cdf87[_0x1e1a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5cdf87[_0x1e1a('0x17')]?_0x5cdf87[_0x1e1a('0x17')]['where']||null:null,'attributes':_0x5cdf87[_0x1e1a('0x17')]?_0x5cdf87[_0x1e1a('0x17')]['attributes']||null:null,'limit':_0x5cdf87[_0x1e1a('0x17')]?_0x5cdf87['options'][_0x1e1a('0x18')]||null:null,'include':_0x5cdf87[_0x1e1a('0x17')]?_0x5cdf87[_0x1e1a('0x17')][_0x1e1a('0x19')]?_[_0x1e1a('0x1a')](_0x5cdf87[_0x1e1a('0x17')][_0x1e1a('0x19')],function(_0xe2c396){return{'model':db[_0xe2c396[_0x1e1a('0x1b')]],'as':_0xe2c396['as'],'attributes':_0xe2c396[_0x1e1a('0x1c')],'include':_0xe2c396[_0x1e1a('0x19')]?_[_0x1e1a('0x1a')](_0xe2c396[_0x1e1a('0x19')],function(_0x16b35b){return{'model':db[_0x16b35b['model']],'as':_0x16b35b['as'],'attributes':_0x16b35b[_0x1e1a('0x1c')],'include':_0x16b35b[_0x1e1a('0x19')]?_[_0x1e1a('0x1a')](_0x16b35b[_0x1e1a('0x19')],function(_0x4a127b){return{'model':db[_0x4a127b[_0x1e1a('0x1b')]],'as':_0x4a127b['as'],'attributes':_0x4a127b[_0x1e1a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53576b){logger[_0x1e1a('0x1d')](_0x1e1a('0x15'),_0x5cdf87);logger[_0x1e1a('0xd')](_0x1e1a('0x15'),_0x5cdf87,JSON[_0x1e1a('0xf')](_0x53576b));_0x2f7649(_0x53576b);})[_0x1e1a('0x14')](function(_0x2f9f2a){logger[_0x1e1a('0x10')](_0x1e1a('0x15'),_0x2f9f2a[_0x1e1a('0x12')],_0x5cdf87);_0x3ac9c8(_0xf6f976[_0x1e1a('0x10')](0x1f4,_0x2f9f2a[_0x1e1a('0x12')]));});});};exports[_0x1e1a('0x1e')]=function(_0x2731a6){var _0x3882ab=this;return new Promise(function(_0x1ae327,_0x2be8c5){return db[_0x1e1a('0x16')][_0x1e1a('0x1f')]({'raw':_0x2731a6[_0x1e1a('0x17')]?_0x2731a6[_0x1e1a('0x17')][_0x1e1a('0x20')]===undefined?!![]:![]:!![],'where':_0x2731a6[_0x1e1a('0x17')]?_0x2731a6['options'][_0x1e1a('0x21')]||null:null,'attributes':_0x2731a6['options']?_0x2731a6[_0x1e1a('0x17')][_0x1e1a('0x1c')]||null:null,'include':_0x2731a6['options']?_0x2731a6[_0x1e1a('0x17')][_0x1e1a('0x19')]?_['map'](_0x2731a6[_0x1e1a('0x17')][_0x1e1a('0x19')],function(_0x1d5cdc){return{'model':db[_0x1d5cdc[_0x1e1a('0x1b')]],'as':_0x1d5cdc['as'],'attributes':_0x1d5cdc[_0x1e1a('0x1c')],'include':_0x1d5cdc[_0x1e1a('0x19')]?_[_0x1e1a('0x1a')](_0x1d5cdc[_0x1e1a('0x19')],function(_0x55643e){return{'model':db[_0x55643e['model']],'as':_0x55643e['as'],'attributes':_0x55643e[_0x1e1a('0x1c')],'include':_0x55643e[_0x1e1a('0x19')]?_[_0x1e1a('0x1a')](_0x55643e[_0x1e1a('0x19')],function(_0x1d6def){return{'model':db[_0x1d6def[_0x1e1a('0x1b')]],'as':_0x1d6def['as'],'attributes':_0x1d6def[_0x1e1a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1e1a('0xb')](function(_0x318ac6){logger[_0x1e1a('0x1d')]('ShowSalesforceAccount',_0x2731a6);logger[_0x1e1a('0xd')](_0x1e1a('0x1e'),_0x2731a6,JSON[_0x1e1a('0xf')](_0x318ac6));_0x1ae327(_0x318ac6);})[_0x1e1a('0x14')](function(_0x282a4e){logger[_0x1e1a('0x10')](_0x1e1a('0x1e'),_0x282a4e[_0x1e1a('0x12')],_0x2731a6);_0x2be8c5(_0x3882ab[_0x1e1a('0x10')](0x1f4,_0x282a4e['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ac06502..8cb3a35 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5d15af,_0x33a716){var _0x306530=function(_0x25eb58){while(--_0x25eb58){_0x5d15af['push'](_0x5d15af['shift']());}};_0x306530(++_0x33a716);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x1093db,_0x8c286c){var _0x193c01=function(_0xa5a7fe){while(--_0xa5a7fe){_0x1093db['push'](_0x1093db['shift']());}};_0x193c01(++_0x8c286c);}(_0xadb5,0xad));var _0x5adb=function(_0x20cb1d,_0x22509b){_0x20cb1d=_0x20cb1d-0x0;var _0x256845=_0xadb5[_0x20cb1d];return _0x256845;};'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('./intSalesforceConfiguration.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['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 5c1e1cd..55dc4eb 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 _0xe7c3=['contact','lead','account_contact_lead','nothing','sequelize','exports','STRING','Task','ENUM','contact_lead'];(function(_0x243c62,_0xcb3177){var _0x1b618b=function(_0x527879){while(--_0x527879){_0x243c62['push'](_0x243c62['shift']());}};_0x1b618b(++_0xcb3177);}(_0xe7c3,0x1a8));var _0x3e7c=function(_0x5acc9d,_0x1ff605){_0x5acc9d=_0x5acc9d-0x0;var _0x7490a=_0xe7c3[_0x5acc9d];return _0x7490a;};'use strict';var Sequelize=require(_0x3e7c('0x0'));module[_0x3e7c('0x1')]={'name':{'type':Sequelize[_0x3e7c('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x3e7c('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x3e7c('0x4')](_0x3e7c('0x5'),_0x3e7c('0x6'),_0x3e7c('0x7'),_0x3e7c('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x3e7c('0x9'),_0x3e7c('0x6'),_0x3e7c('0x7'),'account'),'defaultValue':_0x3e7c('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x3e7c('0x2')]}}; \ No newline at end of file +var _0x422f=['lead','account_contact_lead','account','nothing','exports','STRING','ENUM','Case','Task','contact_lead','contact'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x422f,0x1c7));var _0xf422=function(_0xda556a,_0x27c0fe){_0xda556a=_0xda556a-0x0;var _0x141697=_0x422f[_0xda556a];return _0x141697;};'use strict';var Sequelize=require('sequelize');module[_0xf422('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf422('0x1')]},'ticketType':{'type':Sequelize[_0xf422('0x2')]('Task',_0xf422('0x3')),'defaultValue':_0xf422('0x4')},'moduleSearch':{'type':Sequelize[_0xf422('0x2')](_0xf422('0x5'),_0xf422('0x6'),_0xf422('0x7'),_0xf422('0x8'),_0xf422('0x9')),'defaultValue':_0xf422('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0xf422('0xa'),_0xf422('0x6'),_0xf422('0x7'),_0xf422('0x9')),'defaultValue':_0xf422('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xf422('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 28e76db..c3a930b 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 _0x97cd=['set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','SalesforceConfiguration','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','create','body','update','find','getFields','findOne','SalesforceField','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','undefined'];(function(_0x3c0666,_0xa7e902){var _0x17801e=function(_0x277552){while(--_0x277552){_0x3c0666['push'](_0x3c0666['shift']());}};_0x17801e(++_0xa7e902);}(_0x97cd,0x1e9));var _0xd97c=function(_0x5a44b5,_0x802d9b){_0x5a44b5=_0x5a44b5-0x0;var _0x4c6f1b=_0x97cd[_0x5a44b5];return _0x4c6f1b;};'use strict';var emlformat=require(_0xd97c('0x0'));var rimraf=require(_0xd97c('0x1'));var zipdir=require(_0xd97c('0x2'));var jsonpatch=require(_0xd97c('0x3'));var rp=require(_0xd97c('0x4'));var moment=require(_0xd97c('0x5'));var BPromise=require(_0xd97c('0x6'));var Mustache=require(_0xd97c('0x7'));var util=require(_0xd97c('0x8'));var path=require(_0xd97c('0x9'));var sox=require(_0xd97c('0xa'));var csv=require(_0xd97c('0xb'));var ejs=require(_0xd97c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd97c('0xd'));var squel=require(_0xd97c('0xe'));var crypto=require(_0xd97c('0xf'));var jsforce=require(_0xd97c('0x10'));var deskjs=require(_0xd97c('0x11'));var toCsv=require(_0xd97c('0xb'));var querystring=require(_0xd97c('0x12'));var Papa=require(_0xd97c('0x13'));var Redis=require(_0xd97c('0x14'));var authService=require(_0xd97c('0x15'));var qs=require(_0xd97c('0x16'));var as=require(_0xd97c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd97c('0x18'))('api');var utils=require(_0xd97c('0x19'));var config=require(_0xd97c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd97c('0x1b'))['db'];function respondWithStatusCode(_0x4bd0a8,_0x302084){_0x302084=_0x302084||0xcc;return function(_0x5e67e4){if(_0x5e67e4){return _0x4bd0a8['sendStatus'](_0x302084);}return _0x4bd0a8['status'](_0x302084)[_0xd97c('0x1c')]();};}function respondWithResult(_0xbb298a,_0x53a562){_0x53a562=_0x53a562||0xc8;return function(_0x488748){if(_0x488748){return _0xbb298a[_0xd97c('0x1d')](_0x53a562)['json'](_0x488748);}};}function respondWithFilteredResult(_0x9caaeb,_0x4b2d3c){return function(_0x4d1b6c){if(_0x4d1b6c){var _0x7337bb=typeof _0x4b2d3c[_0xd97c('0x1e')]==='undefined'&&typeof _0x4b2d3c[_0xd97c('0x1f')]===_0xd97c('0x20');var _0x18ee0b=_0x4d1b6c['count'];var _0x5cb2b5=_0x7337bb?0x0:_0x4b2d3c[_0xd97c('0x1e')];var _0x373988=_0x7337bb?_0x4d1b6c['count']:_0x4b2d3c[_0xd97c('0x1e')]+_0x4b2d3c[_0xd97c('0x1f')];var _0xa1f6b6;if(_0x373988>=_0x18ee0b){_0x373988=_0x18ee0b;_0xa1f6b6=0xc8;}else{_0xa1f6b6=0xce;}_0x9caaeb[_0xd97c('0x1d')](_0xa1f6b6);return _0x9caaeb[_0xd97c('0x21')](_0xd97c('0x22'),_0x5cb2b5+'-'+_0x373988+'/'+_0x18ee0b)[_0xd97c('0x23')](_0x4d1b6c);}return null;};}function patchUpdates(_0x356bbf){return function(_0x283dda){try{jsonpatch[_0xd97c('0x24')](_0x283dda,_0x356bbf,!![]);}catch(_0x3d97fb){return BPromise[_0xd97c('0x25')](_0x3d97fb);}return _0x283dda[_0xd97c('0x26')]();};}function saveUpdates(_0x27bbed,_0x46a154){return function(_0x2b2995){if(_0x2b2995){return _0x2b2995['update'](_0x27bbed)[_0xd97c('0x27')](function(_0x516972){return _0x516972;});}return null;};}function removeEntity(_0x3e2086,_0x5c49a6){return function(_0x4ac329){if(_0x4ac329){return _0x4ac329[_0xd97c('0x28')]()['then'](function(){_0x3e2086['status'](0xcc)[_0xd97c('0x1c')]();});}};}function handleEntityNotFound(_0xab35d,_0x5234af){return function(_0x33d24c){if(!_0x33d24c){_0xab35d[_0xd97c('0x29')](0x194);}return _0x33d24c;};}function handleError(_0x30a282,_0x2df606){_0x2df606=_0x2df606||0x1f4;return function(_0x2f335a){logger[_0xd97c('0x2a')](_0x2f335a[_0xd97c('0x2b')]);if(_0x2f335a['name']){delete _0x2f335a['name'];}_0x30a282[_0xd97c('0x1d')](_0x2df606)[_0xd97c('0x2c')](_0x2f335a);};}exports[_0xd97c('0x2d')]=function(_0x49cff7,_0x302b8b){var _0x121e49={},_0x3968dd={},_0x96a2d0={'count':0x0,'rows':[]};var _0x4056ec=_[_0xd97c('0x2e')](db[_0xd97c('0x2f')]['rawAttributes'],function(_0x1344b6){return{'name':_0x1344b6[_0xd97c('0x30')],'type':_0x1344b6[_0xd97c('0x31')][_0xd97c('0x32')]};});_0x3968dd[_0xd97c('0x33')]=_['map'](_0x4056ec,_0xd97c('0x34'));_0x3968dd[_0xd97c('0x35')]=_['keys'](_0x49cff7['query']);_0x3968dd['filters']=_[_0xd97c('0x36')](_0x3968dd[_0xd97c('0x33')],_0x3968dd[_0xd97c('0x35')]);_0x121e49[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x3968dd['model'],qs[_0xd97c('0x38')](_0x49cff7['query'][_0xd97c('0x38')]));_0x121e49[_0xd97c('0x37')]=_0x121e49['attributes'][_0xd97c('0x39')]?_0x121e49[_0xd97c('0x37')]:_0x3968dd['model'];if(!_0x49cff7[_0xd97c('0x35')][_0xd97c('0x3a')](_0xd97c('0x3b'))){_0x121e49[_0xd97c('0x1f')]=qs[_0xd97c('0x1f')](_0x49cff7['query'][_0xd97c('0x1f')]);_0x121e49[_0xd97c('0x1e')]=qs['offset'](_0x49cff7[_0xd97c('0x35')][_0xd97c('0x1e')]);}_0x121e49[_0xd97c('0x3c')]=qs[_0xd97c('0x3d')](_0x49cff7[_0xd97c('0x35')][_0xd97c('0x3d')]);_0x121e49[_0xd97c('0x3e')]=qs[_0xd97c('0x3f')](_[_0xd97c('0x40')](_0x49cff7[_0xd97c('0x35')],_0x3968dd[_0xd97c('0x3f')]),_0x4056ec);if(_0x49cff7[_0xd97c('0x35')]['filter']){_0x121e49[_0xd97c('0x3e')]=_[_0xd97c('0x41')](_0x121e49[_0xd97c('0x3e')],{'$or':_[_0xd97c('0x2e')](_0x4056ec,function(_0x30898f){if(_0x30898f['type']!==_0xd97c('0x42')){var _0x301b04={};_0x301b04[_0x30898f[_0xd97c('0x34')]]={'$like':'%'+_0x49cff7['query']['filter']+'%'};return _0x301b04;}})});}_0x121e49=_[_0xd97c('0x41')]({},_0x121e49,_0x49cff7[_0xd97c('0x43')]);var _0x253a0e={'where':_0x121e49[_0xd97c('0x3e')]};return db[_0xd97c('0x2f')][_0xd97c('0x44')](_0x253a0e)[_0xd97c('0x27')](function(_0x5874a3){_0x96a2d0[_0xd97c('0x44')]=_0x5874a3;if(_0x49cff7[_0xd97c('0x35')][_0xd97c('0x45')]){_0x121e49[_0xd97c('0x46')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xd97c('0x47')](_0x121e49);})[_0xd97c('0x27')](function(_0x586aac){_0x96a2d0[_0xd97c('0x48')]=_0x586aac;return _0x96a2d0;})['then'](respondWithFilteredResult(_0x302b8b,_0x121e49))[_0xd97c('0x49')](handleError(_0x302b8b,null));};exports['show']=function(_0xff3cac,_0x46a8ce){var _0x4ef7c8={'raw':![],'where':{'id':_0xff3cac[_0xd97c('0x4a')]['id']}},_0x224272={};_0x224272[_0xd97c('0x33')]=_['keys'](db['SalesforceConfiguration'][_0xd97c('0x4b')]);_0x224272['query']=_[_0xd97c('0x4c')](_0xff3cac[_0xd97c('0x35')]);_0x224272['filters']=_[_0xd97c('0x36')](_0x224272[_0xd97c('0x33')],_0x224272['query']);_0x4ef7c8[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x224272[_0xd97c('0x33')],qs[_0xd97c('0x38')](_0xff3cac[_0xd97c('0x35')]['fields']));_0x4ef7c8[_0xd97c('0x37')]=_0x4ef7c8[_0xd97c('0x37')]['length']?_0x4ef7c8[_0xd97c('0x37')]:_0x224272[_0xd97c('0x33')];if(_0xff3cac[_0xd97c('0x35')]['includeAll']){_0x4ef7c8[_0xd97c('0x46')]=[{'all':!![]}];}_0x4ef7c8=_[_0xd97c('0x41')]({},_0x4ef7c8,_0xff3cac['options']);return db['SalesforceConfiguration']['find'](_0x4ef7c8)[_0xd97c('0x27')](handleEntityNotFound(_0x46a8ce,null))[_0xd97c('0x27')](respondWithResult(_0x46a8ce,null))[_0xd97c('0x49')](handleError(_0x46a8ce,null));};exports['create']=function(_0x3aca19,_0x576f95){return db[_0xd97c('0x2f')][_0xd97c('0x4d')](_0x3aca19[_0xd97c('0x4e')],{})[_0xd97c('0x27')](respondWithResult(_0x576f95,0xc9))[_0xd97c('0x49')](handleError(_0x576f95,null));};exports[_0xd97c('0x4f')]=function(_0x47673a,_0x3feb32){if(_0x47673a[_0xd97c('0x4e')]['id']){delete _0x47673a['body']['id'];}return db[_0xd97c('0x2f')]['find']({'where':{'id':_0x47673a[_0xd97c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3feb32,null))[_0xd97c('0x27')](saveUpdates(_0x47673a[_0xd97c('0x4e')],null))['then'](respondWithResult(_0x3feb32,null))['catch'](handleError(_0x3feb32,null));};exports['destroy']=function(_0x433f4a,_0x302f01){return db[_0xd97c('0x2f')][_0xd97c('0x50')]({'where':{'id':_0x433f4a[_0xd97c('0x4a')]['id']}})[_0xd97c('0x27')](handleEntityNotFound(_0x302f01,null))['then'](removeEntity(_0x302f01,null))[_0xd97c('0x49')](handleError(_0x302f01,null));};exports[_0xd97c('0x51')]=function(_0x246532,_0x239c0e,_0x17b1b4){var _0x11dbaa={};var _0x16a47e={};var _0x5f569e;var _0x41d55a;return db['SalesforceConfiguration'][_0xd97c('0x52')]({'where':{'id':_0x246532[_0xd97c('0x4a')]['id']}})[_0xd97c('0x27')](handleEntityNotFound(_0x239c0e,null))['then'](function(_0x3304e1){if(_0x3304e1){_0x5f569e=_0x3304e1;_0x16a47e[_0xd97c('0x33')]=_[_0xd97c('0x4c')](db[_0xd97c('0x53')][_0xd97c('0x4b')]);_0x16a47e['query']=_['keys'](_0x246532[_0xd97c('0x35')]);_0x16a47e['filters']=_[_0xd97c('0x36')](_0x16a47e[_0xd97c('0x33')],_0x16a47e[_0xd97c('0x35')]);_0x11dbaa[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x16a47e[_0xd97c('0x33')],qs['fields'](_0x246532['query'][_0xd97c('0x38')]));_0x11dbaa[_0xd97c('0x37')]=_0x11dbaa[_0xd97c('0x37')][_0xd97c('0x39')]?_0x11dbaa[_0xd97c('0x37')]:_0x16a47e['model'];_0x11dbaa['order']=qs['sort'](_0x246532[_0xd97c('0x35')][_0xd97c('0x3d')]);_0x11dbaa[_0xd97c('0x3e')]=qs[_0xd97c('0x3f')](_[_0xd97c('0x40')](_0x246532[_0xd97c('0x35')],_0x16a47e[_0xd97c('0x3f')]));if(_0x246532['query']['filter']){_0x11dbaa[_0xd97c('0x3e')]=_[_0xd97c('0x41')](_0x11dbaa[_0xd97c('0x3e')],{'$or':_[_0xd97c('0x2e')](_0x11dbaa['attributes'],function(_0x3804fe){var _0x277163={};_0x277163[_0x3804fe]={'$like':'%'+_0x246532[_0xd97c('0x35')]['filter']+'%'};return _0x277163;})});}_0x11dbaa=_['merge']({},_0x11dbaa,_0x246532['options']);return _0x5f569e[_0xd97c('0x51')](_0x11dbaa);}})[_0xd97c('0x27')](function(_0x3b18d0){if(_0x3b18d0){_0x41d55a=_0x3b18d0[_0xd97c('0x39')];if(!_0x246532['query'][_0xd97c('0x3a')](_0xd97c('0x3b'))){_0x11dbaa[_0xd97c('0x1f')]=qs[_0xd97c('0x1f')](_0x246532[_0xd97c('0x35')][_0xd97c('0x1f')]);_0x11dbaa['offset']=qs['offset'](_0x246532[_0xd97c('0x35')][_0xd97c('0x1e')]);}return _0x5f569e[_0xd97c('0x51')](_0x11dbaa);}})[_0xd97c('0x27')](function(_0x29f0fb){if(_0x29f0fb){return _0x29f0fb?{'count':_0x41d55a,'rows':_0x29f0fb}:null;}})[_0xd97c('0x27')](respondWithResult(_0x239c0e,null))[_0xd97c('0x49')](handleError(_0x239c0e,null));};exports['getSubjects']=function(_0x174202,_0x560462,_0x38e561){var _0x3a87e8={};var _0x15c5f3={};var _0x44ec05;var _0x132811;return db[_0xd97c('0x2f')][_0xd97c('0x52')]({'where':{'id':_0x174202['params']['id']}})[_0xd97c('0x27')](handleEntityNotFound(_0x560462,null))['then'](function(_0x369ee3){if(_0x369ee3){_0x44ec05=_0x369ee3;_0x15c5f3[_0xd97c('0x33')]=_[_0xd97c('0x4c')](db[_0xd97c('0x53')][_0xd97c('0x4b')]);_0x15c5f3[_0xd97c('0x35')]=_[_0xd97c('0x4c')](_0x174202[_0xd97c('0x35')]);_0x15c5f3[_0xd97c('0x3f')]=_[_0xd97c('0x36')](_0x15c5f3[_0xd97c('0x33')],_0x15c5f3[_0xd97c('0x35')]);_0x3a87e8[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x15c5f3['model'],qs[_0xd97c('0x38')](_0x174202['query'][_0xd97c('0x38')]));_0x3a87e8[_0xd97c('0x37')]=_0x3a87e8[_0xd97c('0x37')][_0xd97c('0x39')]?_0x3a87e8[_0xd97c('0x37')]:_0x15c5f3[_0xd97c('0x33')];_0x3a87e8[_0xd97c('0x3c')]=qs[_0xd97c('0x3d')](_0x174202[_0xd97c('0x35')][_0xd97c('0x3d')]);_0x3a87e8[_0xd97c('0x3e')]=qs[_0xd97c('0x3f')](_[_0xd97c('0x40')](_0x174202[_0xd97c('0x35')],_0x15c5f3[_0xd97c('0x3f')]));if(_0x174202[_0xd97c('0x35')][_0xd97c('0x54')]){_0x3a87e8['where']=_['merge'](_0x3a87e8['where'],{'$or':_[_0xd97c('0x2e')](_0x3a87e8[_0xd97c('0x37')],function(_0xb88c60){var _0x5ef255={};_0x5ef255[_0xb88c60]={'$like':'%'+_0x174202[_0xd97c('0x35')][_0xd97c('0x54')]+'%'};return _0x5ef255;})});}_0x3a87e8=_[_0xd97c('0x41')]({},_0x3a87e8,_0x174202[_0xd97c('0x43')]);return _0x44ec05[_0xd97c('0x55')](_0x3a87e8);}})[_0xd97c('0x27')](function(_0x3fcafb){if(_0x3fcafb){_0x132811=_0x3fcafb[_0xd97c('0x39')];if(!_0x174202['query']['hasOwnProperty'](_0xd97c('0x3b'))){_0x3a87e8[_0xd97c('0x1f')]=qs[_0xd97c('0x1f')](_0x174202[_0xd97c('0x35')]['limit']);_0x3a87e8[_0xd97c('0x1e')]=qs[_0xd97c('0x1e')](_0x174202[_0xd97c('0x35')][_0xd97c('0x1e')]);}return _0x44ec05[_0xd97c('0x55')](_0x3a87e8);}})[_0xd97c('0x27')](function(_0x4c526a){if(_0x4c526a){return _0x4c526a?{'count':_0x132811,'rows':_0x4c526a}:null;}})[_0xd97c('0x27')](respondWithResult(_0x560462,null))[_0xd97c('0x49')](handleError(_0x560462,null));};exports[_0xd97c('0x56')]=function(_0x888c2b,_0x151951,_0x566593){var _0x20a401={};var _0x3fba45={};var _0x58f653;var _0x2e9588;return db[_0xd97c('0x2f')]['findOne']({'where':{'id':_0x888c2b[_0xd97c('0x4a')]['id']}})[_0xd97c('0x27')](handleEntityNotFound(_0x151951,null))[_0xd97c('0x27')](function(_0x27dc76){if(_0x27dc76){_0x58f653=_0x27dc76;_0x3fba45[_0xd97c('0x33')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x3fba45[_0xd97c('0x35')]=_[_0xd97c('0x4c')](_0x888c2b[_0xd97c('0x35')]);_0x3fba45[_0xd97c('0x3f')]=_[_0xd97c('0x36')](_0x3fba45[_0xd97c('0x33')],_0x3fba45[_0xd97c('0x35')]);_0x20a401[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x3fba45[_0xd97c('0x33')],qs[_0xd97c('0x38')](_0x888c2b[_0xd97c('0x35')][_0xd97c('0x38')]));_0x20a401['attributes']=_0x20a401['attributes'][_0xd97c('0x39')]?_0x20a401['attributes']:_0x3fba45[_0xd97c('0x33')];_0x20a401['order']=qs[_0xd97c('0x3d')](_0x888c2b[_0xd97c('0x35')][_0xd97c('0x3d')]);_0x20a401[_0xd97c('0x3e')]=qs[_0xd97c('0x3f')](_[_0xd97c('0x40')](_0x888c2b['query'],_0x3fba45[_0xd97c('0x3f')]));if(_0x888c2b[_0xd97c('0x35')][_0xd97c('0x54')]){_0x20a401[_0xd97c('0x3e')]=_[_0xd97c('0x41')](_0x20a401['where'],{'$or':_[_0xd97c('0x2e')](_0x20a401[_0xd97c('0x37')],function(_0x46e9e0){var _0x5a9baf={};_0x5a9baf[_0x46e9e0]={'$like':'%'+_0x888c2b[_0xd97c('0x35')][_0xd97c('0x54')]+'%'};return _0x5a9baf;})});}_0x20a401=_[_0xd97c('0x41')]({},_0x20a401,_0x888c2b[_0xd97c('0x43')]);return _0x58f653['getDescriptions'](_0x20a401);}})[_0xd97c('0x27')](function(_0x3bac97){if(_0x3bac97){_0x2e9588=_0x3bac97[_0xd97c('0x39')];if(!_0x888c2b['query'][_0xd97c('0x3a')](_0xd97c('0x3b'))){_0x20a401[_0xd97c('0x1f')]=qs[_0xd97c('0x1f')](_0x888c2b[_0xd97c('0x35')][_0xd97c('0x1f')]);_0x20a401[_0xd97c('0x1e')]=qs[_0xd97c('0x1e')](_0x888c2b['query']['offset']);}return _0x58f653[_0xd97c('0x56')](_0x20a401);}})[_0xd97c('0x27')](function(_0x3ab78c){if(_0x3ab78c){return _0x3ab78c?{'count':_0x2e9588,'rows':_0x3ab78c}:null;}})['then'](respondWithResult(_0x151951,null))[_0xd97c('0x49')](handleError(_0x151951,null));}; \ No newline at end of file +var _0x966a=['fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','set','apply','reject','update','then','destroy','error','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','merge','where','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv'];(function(_0x3ba5a4,_0x1ab3a2){var _0x361851=function(_0x2711bb){while(--_0x2711bb){_0x3ba5a4['push'](_0x3ba5a4['shift']());}};_0x361851(++_0x1ab3a2);}(_0x966a,0x138));var _0xa966=function(_0x4f140e,_0x574bee){_0x4f140e=_0x4f140e-0x0;var _0x357343=_0x966a[_0x4f140e];return _0x357343;};'use strict';var emlformat=require(_0xa966('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa966('0x1'));var jsonpatch=require(_0xa966('0x2'));var rp=require('request-promise');var moment=require(_0xa966('0x3'));var BPromise=require(_0xa966('0x4'));var Mustache=require('mustache');var util=require(_0xa966('0x5'));var path=require('path');var sox=require(_0xa966('0x6'));var csv=require(_0xa966('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa966('0x8'));var _=require('lodash');var squel=require(_0xa966('0x9'));var crypto=require(_0xa966('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa966('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa966('0xc'));var Papa=require(_0xa966('0xd'));var Redis=require(_0xa966('0xe'));var authService=require(_0xa966('0xf'));var qs=require(_0xa966('0x10'));var as=require(_0xa966('0x11'));var hardwareService=require(_0xa966('0x12'));var logger=require(_0xa966('0x13'))(_0xa966('0x14'));var utils=require('../../config/utils');var config=require(_0xa966('0x15'));var licenseUtil=require(_0xa966('0x16'));var db=require(_0xa966('0x17'))['db'];function respondWithStatusCode(_0x3db2cd,_0xd1da87){_0xd1da87=_0xd1da87||0xcc;return function(_0x142d18){if(_0x142d18){return _0x3db2cd[_0xa966('0x18')](_0xd1da87);}return _0x3db2cd[_0xa966('0x19')](_0xd1da87)['end']();};}function respondWithResult(_0x3f5dc5,_0x274f7a){_0x274f7a=_0x274f7a||0xc8;return function(_0xc97088){if(_0xc97088){return _0x3f5dc5['status'](_0x274f7a)[_0xa966('0x1a')](_0xc97088);}};}function respondWithFilteredResult(_0x4785cc,_0x1bd295){return function(_0x1d71d1){if(_0x1d71d1){var _0x23a2f4=typeof _0x1bd295['offset']==='undefined'&&typeof _0x1bd295['limit']===_0xa966('0x1b');var _0x594a7c=_0x1d71d1['count'];var _0x3baa56=_0x23a2f4?0x0:_0x1bd295[_0xa966('0x1c')];var _0x8ae17a=_0x23a2f4?_0x1d71d1['count']:_0x1bd295['offset']+_0x1bd295['limit'];var _0x3251a2;if(_0x8ae17a>=_0x594a7c){_0x8ae17a=_0x594a7c;_0x3251a2=0xc8;}else{_0x3251a2=0xce;}_0x4785cc[_0xa966('0x19')](_0x3251a2);return _0x4785cc[_0xa966('0x1d')]('Content-Range',_0x3baa56+'-'+_0x8ae17a+'/'+_0x594a7c)['json'](_0x1d71d1);}return null;};}function patchUpdates(_0x1195c1){return function(_0xae541d){try{jsonpatch[_0xa966('0x1e')](_0xae541d,_0x1195c1,!![]);}catch(_0x49fcac){return BPromise[_0xa966('0x1f')](_0x49fcac);}return _0xae541d['save']();};}function saveUpdates(_0x11a22e,_0x4e5a86){return function(_0x11cbf7){if(_0x11cbf7){return _0x11cbf7[_0xa966('0x20')](_0x11a22e)[_0xa966('0x21')](function(_0x3311ce){return _0x3311ce;});}return null;};}function removeEntity(_0x23f1bb,_0x1945b6){return function(_0x46f7e8){if(_0x46f7e8){return _0x46f7e8[_0xa966('0x22')]()[_0xa966('0x21')](function(){_0x23f1bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x550dcc,_0x3a8f13){return function(_0x566003){if(!_0x566003){_0x550dcc[_0xa966('0x18')](0x194);}return _0x566003;};}function handleError(_0x58125b,_0x3c8bbe){_0x3c8bbe=_0x3c8bbe||0x1f4;return function(_0x2fe9f5){logger[_0xa966('0x23')](_0x2fe9f5['stack']);if(_0x2fe9f5[_0xa966('0x24')]){delete _0x2fe9f5[_0xa966('0x24')];}_0x58125b['status'](_0x3c8bbe)[_0xa966('0x25')](_0x2fe9f5);};}exports[_0xa966('0x26')]=function(_0x58a77f,_0x4c8ec1){var _0x4277d2={},_0x18f7d9={},_0x28ceb2={'count':0x0,'rows':[]};var _0x4e959e=_['map'](db[_0xa966('0x27')][_0xa966('0x28')],function(_0x3ad2fd){return{'name':_0x3ad2fd[_0xa966('0x29')],'type':_0x3ad2fd[_0xa966('0x2a')][_0xa966('0x2b')]};});_0x18f7d9[_0xa966('0x2c')]=_[_0xa966('0x2d')](_0x4e959e,_0xa966('0x24'));_0x18f7d9[_0xa966('0x2e')]=_[_0xa966('0x2f')](_0x58a77f[_0xa966('0x2e')]);_0x18f7d9['filters']=_[_0xa966('0x30')](_0x18f7d9['model'],_0x18f7d9[_0xa966('0x2e')]);_0x4277d2['attributes']=_[_0xa966('0x30')](_0x18f7d9[_0xa966('0x2c')],qs[_0xa966('0x31')](_0x58a77f[_0xa966('0x2e')][_0xa966('0x31')]));_0x4277d2['attributes']=_0x4277d2[_0xa966('0x32')][_0xa966('0x33')]?_0x4277d2[_0xa966('0x32')]:_0x18f7d9[_0xa966('0x2c')];if(!_0x58a77f[_0xa966('0x2e')][_0xa966('0x34')](_0xa966('0x35'))){_0x4277d2[_0xa966('0x36')]=qs[_0xa966('0x36')](_0x58a77f[_0xa966('0x2e')][_0xa966('0x36')]);_0x4277d2[_0xa966('0x1c')]=qs[_0xa966('0x1c')](_0x58a77f['query'][_0xa966('0x1c')]);}_0x4277d2[_0xa966('0x37')]=qs['sort'](_0x58a77f['query'][_0xa966('0x38')]);_0x4277d2['where']=qs[_0xa966('0x39')](_[_0xa966('0x3a')](_0x58a77f[_0xa966('0x2e')],_0x18f7d9[_0xa966('0x39')]),_0x4e959e);if(_0x58a77f[_0xa966('0x2e')][_0xa966('0x3b')]){_0x4277d2['where']=_[_0xa966('0x3c')](_0x4277d2[_0xa966('0x3d')],{'$or':_[_0xa966('0x2d')](_0x4e959e,function(_0x2b60ed){if(_0x2b60ed[_0xa966('0x2a')]!==_0xa966('0x3e')){var _0x3147e1={};_0x3147e1[_0x2b60ed[_0xa966('0x24')]]={'$like':'%'+_0x58a77f[_0xa966('0x2e')]['filter']+'%'};return _0x3147e1;}})});}_0x4277d2=_[_0xa966('0x3c')]({},_0x4277d2,_0x58a77f['options']);var _0x5ebdc1={'where':_0x4277d2[_0xa966('0x3d')]};return db[_0xa966('0x27')][_0xa966('0x3f')](_0x5ebdc1)[_0xa966('0x21')](function(_0x1fa8fd){_0x28ceb2[_0xa966('0x3f')]=_0x1fa8fd;if(_0x58a77f[_0xa966('0x2e')][_0xa966('0x40')]){_0x4277d2['include']=[{'all':!![]}];}return db[_0xa966('0x27')][_0xa966('0x41')](_0x4277d2);})['then'](function(_0x14c3b2){_0x28ceb2[_0xa966('0x42')]=_0x14c3b2;return _0x28ceb2;})[_0xa966('0x21')](respondWithFilteredResult(_0x4c8ec1,_0x4277d2))[_0xa966('0x43')](handleError(_0x4c8ec1,null));};exports[_0xa966('0x44')]=function(_0x283e94,_0x2f51a1){var _0x251933={'raw':![],'where':{'id':_0x283e94[_0xa966('0x45')]['id']}},_0x50e5f0={};_0x50e5f0[_0xa966('0x2c')]=_[_0xa966('0x2f')](db[_0xa966('0x27')]['rawAttributes']);_0x50e5f0[_0xa966('0x2e')]=_['keys'](_0x283e94['query']);_0x50e5f0[_0xa966('0x39')]=_[_0xa966('0x30')](_0x50e5f0[_0xa966('0x2c')],_0x50e5f0['query']);_0x251933['attributes']=_[_0xa966('0x30')](_0x50e5f0[_0xa966('0x2c')],qs[_0xa966('0x31')](_0x283e94[_0xa966('0x2e')][_0xa966('0x31')]));_0x251933[_0xa966('0x32')]=_0x251933[_0xa966('0x32')][_0xa966('0x33')]?_0x251933['attributes']:_0x50e5f0[_0xa966('0x2c')];if(_0x283e94[_0xa966('0x2e')]['includeAll']){_0x251933[_0xa966('0x46')]=[{'all':!![]}];}_0x251933=_[_0xa966('0x3c')]({},_0x251933,_0x283e94[_0xa966('0x47')]);return db['SalesforceConfiguration'][_0xa966('0x48')](_0x251933)[_0xa966('0x21')](handleEntityNotFound(_0x2f51a1,null))[_0xa966('0x21')](respondWithResult(_0x2f51a1,null))[_0xa966('0x43')](handleError(_0x2f51a1,null));};exports[_0xa966('0x49')]=function(_0x447f87,_0xe62e44){return db[_0xa966('0x27')][_0xa966('0x49')](_0x447f87[_0xa966('0x4a')],{})[_0xa966('0x21')](respondWithResult(_0xe62e44,0xc9))[_0xa966('0x43')](handleError(_0xe62e44,null));};exports[_0xa966('0x20')]=function(_0x486b6d,_0x55797d){if(_0x486b6d[_0xa966('0x4a')]['id']){delete _0x486b6d['body']['id'];}return db[_0xa966('0x27')][_0xa966('0x48')]({'where':{'id':_0x486b6d[_0xa966('0x45')]['id']}})[_0xa966('0x21')](handleEntityNotFound(_0x55797d,null))[_0xa966('0x21')](saveUpdates(_0x486b6d[_0xa966('0x4a')],null))['then'](respondWithResult(_0x55797d,null))[_0xa966('0x43')](handleError(_0x55797d,null));};exports[_0xa966('0x22')]=function(_0x500b53,_0x150a2b){return db[_0xa966('0x27')][_0xa966('0x48')]({'where':{'id':_0x500b53[_0xa966('0x45')]['id']}})[_0xa966('0x21')](handleEntityNotFound(_0x150a2b,null))[_0xa966('0x21')](removeEntity(_0x150a2b,null))[_0xa966('0x43')](handleError(_0x150a2b,null));};exports[_0xa966('0x4b')]=function(_0x546b74,_0x49112e,_0x43ccf8){var _0x31c267={};var _0xc22d5f={};var _0x209627;var _0x2f87a4;return db[_0xa966('0x27')][_0xa966('0x4c')]({'where':{'id':_0x546b74[_0xa966('0x45')]['id']}})[_0xa966('0x21')](handleEntityNotFound(_0x49112e,null))[_0xa966('0x21')](function(_0x5ec695){if(_0x5ec695){_0x209627=_0x5ec695;_0xc22d5f['model']=_['keys'](db[_0xa966('0x4d')][_0xa966('0x28')]);_0xc22d5f['query']=_[_0xa966('0x2f')](_0x546b74[_0xa966('0x2e')]);_0xc22d5f[_0xa966('0x39')]=_['intersection'](_0xc22d5f[_0xa966('0x2c')],_0xc22d5f[_0xa966('0x2e')]);_0x31c267[_0xa966('0x32')]=_[_0xa966('0x30')](_0xc22d5f[_0xa966('0x2c')],qs[_0xa966('0x31')](_0x546b74['query'][_0xa966('0x31')]));_0x31c267[_0xa966('0x32')]=_0x31c267['attributes'][_0xa966('0x33')]?_0x31c267[_0xa966('0x32')]:_0xc22d5f[_0xa966('0x2c')];_0x31c267[_0xa966('0x37')]=qs[_0xa966('0x38')](_0x546b74['query'][_0xa966('0x38')]);_0x31c267[_0xa966('0x3d')]=qs[_0xa966('0x39')](_[_0xa966('0x3a')](_0x546b74[_0xa966('0x2e')],_0xc22d5f['filters']));if(_0x546b74['query'][_0xa966('0x3b')]){_0x31c267[_0xa966('0x3d')]=_[_0xa966('0x3c')](_0x31c267[_0xa966('0x3d')],{'$or':_[_0xa966('0x2d')](_0x31c267[_0xa966('0x32')],function(_0x1bede2){var _0x2e8c78={};_0x2e8c78[_0x1bede2]={'$like':'%'+_0x546b74[_0xa966('0x2e')][_0xa966('0x3b')]+'%'};return _0x2e8c78;})});}_0x31c267=_['merge']({},_0x31c267,_0x546b74[_0xa966('0x47')]);return _0x209627['getFields'](_0x31c267);}})['then'](function(_0x5d7c7e){if(_0x5d7c7e){_0x2f87a4=_0x5d7c7e[_0xa966('0x33')];if(!_0x546b74[_0xa966('0x2e')][_0xa966('0x34')](_0xa966('0x35'))){_0x31c267[_0xa966('0x36')]=qs[_0xa966('0x36')](_0x546b74[_0xa966('0x2e')][_0xa966('0x36')]);_0x31c267['offset']=qs['offset'](_0x546b74[_0xa966('0x2e')][_0xa966('0x1c')]);}return _0x209627[_0xa966('0x4b')](_0x31c267);}})['then'](function(_0x3b11a1){if(_0x3b11a1){return _0x3b11a1?{'count':_0x2f87a4,'rows':_0x3b11a1}:null;}})['then'](respondWithResult(_0x49112e,null))[_0xa966('0x43')](handleError(_0x49112e,null));};exports[_0xa966('0x4e')]=function(_0xa4ff3d,_0xfab5e6,_0x4577a1){var _0x1283d8={};var _0x110ba7={};var _0x3c7dbe;var _0x18ee46;return db[_0xa966('0x27')][_0xa966('0x4c')]({'where':{'id':_0xa4ff3d[_0xa966('0x45')]['id']}})[_0xa966('0x21')](handleEntityNotFound(_0xfab5e6,null))[_0xa966('0x21')](function(_0x54987f){if(_0x54987f){_0x3c7dbe=_0x54987f;_0x110ba7[_0xa966('0x2c')]=_[_0xa966('0x2f')](db[_0xa966('0x4d')][_0xa966('0x28')]);_0x110ba7[_0xa966('0x2e')]=_[_0xa966('0x2f')](_0xa4ff3d['query']);_0x110ba7[_0xa966('0x39')]=_['intersection'](_0x110ba7[_0xa966('0x2c')],_0x110ba7[_0xa966('0x2e')]);_0x1283d8['attributes']=_[_0xa966('0x30')](_0x110ba7[_0xa966('0x2c')],qs[_0xa966('0x31')](_0xa4ff3d[_0xa966('0x2e')][_0xa966('0x31')]));_0x1283d8[_0xa966('0x32')]=_0x1283d8[_0xa966('0x32')][_0xa966('0x33')]?_0x1283d8[_0xa966('0x32')]:_0x110ba7[_0xa966('0x2c')];_0x1283d8[_0xa966('0x37')]=qs[_0xa966('0x38')](_0xa4ff3d[_0xa966('0x2e')][_0xa966('0x38')]);_0x1283d8[_0xa966('0x3d')]=qs[_0xa966('0x39')](_['pick'](_0xa4ff3d[_0xa966('0x2e')],_0x110ba7[_0xa966('0x39')]));if(_0xa4ff3d['query'][_0xa966('0x3b')]){_0x1283d8[_0xa966('0x3d')]=_[_0xa966('0x3c')](_0x1283d8[_0xa966('0x3d')],{'$or':_[_0xa966('0x2d')](_0x1283d8[_0xa966('0x32')],function(_0x7fe45e){var _0x4883d9={};_0x4883d9[_0x7fe45e]={'$like':'%'+_0xa4ff3d[_0xa966('0x2e')]['filter']+'%'};return _0x4883d9;})});}_0x1283d8=_[_0xa966('0x3c')]({},_0x1283d8,_0xa4ff3d[_0xa966('0x47')]);return _0x3c7dbe['getSubjects'](_0x1283d8);}})[_0xa966('0x21')](function(_0x4fa156){if(_0x4fa156){_0x18ee46=_0x4fa156[_0xa966('0x33')];if(!_0xa4ff3d[_0xa966('0x2e')][_0xa966('0x34')](_0xa966('0x35'))){_0x1283d8[_0xa966('0x36')]=qs[_0xa966('0x36')](_0xa4ff3d['query'][_0xa966('0x36')]);_0x1283d8[_0xa966('0x1c')]=qs[_0xa966('0x1c')](_0xa4ff3d[_0xa966('0x2e')][_0xa966('0x1c')]);}return _0x3c7dbe[_0xa966('0x4e')](_0x1283d8);}})[_0xa966('0x21')](function(_0x46347a){if(_0x46347a){return _0x46347a?{'count':_0x18ee46,'rows':_0x46347a}:null;}})[_0xa966('0x21')](respondWithResult(_0xfab5e6,null))['catch'](handleError(_0xfab5e6,null));};exports[_0xa966('0x4f')]=function(_0x15d055,_0x2b1b12,_0x860fff){var _0x14daa0={};var _0x22b697={};var _0x44e816;var _0x3bb0bf;return db['SalesforceConfiguration'][_0xa966('0x4c')]({'where':{'id':_0x15d055[_0xa966('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b1b12,null))[_0xa966('0x21')](function(_0x1e843a){if(_0x1e843a){_0x44e816=_0x1e843a;_0x22b697['model']=_[_0xa966('0x2f')](db['SalesforceField']['rawAttributes']);_0x22b697[_0xa966('0x2e')]=_[_0xa966('0x2f')](_0x15d055[_0xa966('0x2e')]);_0x22b697[_0xa966('0x39')]=_[_0xa966('0x30')](_0x22b697[_0xa966('0x2c')],_0x22b697[_0xa966('0x2e')]);_0x14daa0['attributes']=_['intersection'](_0x22b697[_0xa966('0x2c')],qs['fields'](_0x15d055[_0xa966('0x2e')]['fields']));_0x14daa0[_0xa966('0x32')]=_0x14daa0[_0xa966('0x32')][_0xa966('0x33')]?_0x14daa0[_0xa966('0x32')]:_0x22b697[_0xa966('0x2c')];_0x14daa0[_0xa966('0x37')]=qs[_0xa966('0x38')](_0x15d055[_0xa966('0x2e')][_0xa966('0x38')]);_0x14daa0[_0xa966('0x3d')]=qs[_0xa966('0x39')](_[_0xa966('0x3a')](_0x15d055[_0xa966('0x2e')],_0x22b697[_0xa966('0x39')]));if(_0x15d055['query']['filter']){_0x14daa0[_0xa966('0x3d')]=_[_0xa966('0x3c')](_0x14daa0[_0xa966('0x3d')],{'$or':_['map'](_0x14daa0['attributes'],function(_0x1f2b05){var _0x2b1522={};_0x2b1522[_0x1f2b05]={'$like':'%'+_0x15d055[_0xa966('0x2e')][_0xa966('0x3b')]+'%'};return _0x2b1522;})});}_0x14daa0=_['merge']({},_0x14daa0,_0x15d055[_0xa966('0x47')]);return _0x44e816[_0xa966('0x4f')](_0x14daa0);}})[_0xa966('0x21')](function(_0x15709e){if(_0x15709e){_0x3bb0bf=_0x15709e[_0xa966('0x33')];if(!_0x15d055['query']['hasOwnProperty'](_0xa966('0x35'))){_0x14daa0[_0xa966('0x36')]=qs[_0xa966('0x36')](_0x15d055[_0xa966('0x2e')]['limit']);_0x14daa0['offset']=qs[_0xa966('0x1c')](_0x15d055[_0xa966('0x2e')]['offset']);}return _0x44e816[_0xa966('0x4f')](_0x14daa0);}})[_0xa966('0x21')](function(_0xec87ad){if(_0xec87ad){return _0xec87ad?{'count':_0x3bb0bf,'rows':_0xec87ad}:null;}})[_0xa966('0x21')](respondWithResult(_0x2b1b12,null))[_0xa966('0x43')](handleError(_0x2b1b12,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2481562..a8797bd 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 _0xc3a7=['request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4f5ba9,_0x1c5fc5){var _0xfb4878=function(_0x38b4d5){while(--_0x38b4d5){_0x4f5ba9['push'](_0x4f5ba9['shift']());}};_0xfb4878(++_0x1c5fc5);}(_0xc3a7,0x191));var _0x7c3a=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xc3a7[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x7c3a('0x0'));var util=require(_0x7c3a('0x1'));var logger=require(_0x7c3a('0x2'))(_0x7c3a('0x3'));var moment=require(_0x7c3a('0x4'));var BPromise=require('bluebird');var rp=require(_0x7c3a('0x5'));var fs=require('fs');var path=require(_0x7c3a('0x6'));var rimraf=require(_0x7c3a('0x7'));var config=require(_0x7c3a('0x8'));var attributes=require(_0x7c3a('0x9'));module[_0x7c3a('0xa')]=function(_0x126fb6,_0x47bee6){return _0x126fb6[_0x7c3a('0xb')](_0x7c3a('0xc'),attributes,{'tableName':_0x7c3a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ffc=['bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','int_salesforce_configurations','lodash','util','api'];(function(_0x563739,_0x4b9199){var _0x1f326a=function(_0x447a71){while(--_0x447a71){_0x563739['push'](_0x563739['shift']());}};_0x1f326a(++_0x4b9199);}(_0x8ffc,0xcf));var _0xc8ff=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x8ffc[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0xc8ff('0x0'));var util=require(_0xc8ff('0x1'));var logger=require('../../config/logger')(_0xc8ff('0x2'));var moment=require('moment');var BPromise=require(_0xc8ff('0x3'));var rp=require(_0xc8ff('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8ff('0x5'));var config=require(_0xc8ff('0x6'));var attributes=require(_0xc8ff('0x7'));module['exports']=function(_0x5ced83,_0x52506a){return _0x5ced83[_0xc8ff('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0xc8ff('0x9'),'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 c52c84a..acce7c6 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 _0xf435=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0xf435,0x14d));var _0x5f43=function(_0x5a0364,_0x2ed849){_0x5a0364=_0x5a0364-0x0;var _0x3d00e2=_0xf435[_0x5a0364];return _0x3d00e2;};'use strict';var _=require(_0x5f43('0x0'));var util=require(_0x5f43('0x1'));var moment=require(_0x5f43('0x2'));var BPromise=require(_0x5f43('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f43('0x4'));var db=require(_0x5f43('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f43('0x6'))(_0x5f43('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f43('0x8'));var client=jayson[_0x5f43('0x9')][_0x5f43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263f9a,_0x110096,_0x2ab2e3){return new BPromise(function(_0x3b5224,_0x3c7a59){return client['request'](_0x263f9a,_0x2ab2e3)[_0x5f43('0xb')](function(_0x43d480){logger[_0x5f43('0xc')](_0x5f43('0xd'),_0x110096,_0x5f43('0xe'));logger['debug'](_0x5f43('0xf'),_0x110096,_0x5f43('0xe'),JSON['stringify'](_0x43d480));if(_0x43d480[_0x5f43('0x10')]){if(_0x43d480['error'][_0x5f43('0x11')]===0x1f4){logger[_0x5f43('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x110096,_0x43d480[_0x5f43('0x10')][_0x5f43('0x12')]);return _0x3c7a59(_0x43d480[_0x5f43('0x10')][_0x5f43('0x12')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x110096,_0x43d480['error'][_0x5f43('0x12')]);return _0x3b5224(_0x43d480['error']['message']);}else{logger['info'](_0x5f43('0xd'),_0x110096,_0x5f43('0xe'));_0x3b5224(_0x43d480[_0x5f43('0x13')][_0x5f43('0x12')]);}})[_0x5f43('0x14')](function(_0x33ed7e){logger[_0x5f43('0x10')](_0x5f43('0xd'),_0x110096,_0x33ed7e);_0x3c7a59(_0x33ed7e);});});} \ No newline at end of file +var _0x826f=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x5eb8d4,_0x21fdd7){var _0x543c80=function(_0x51da62){while(--_0x51da62){_0x5eb8d4['push'](_0x5eb8d4['shift']());}};_0x543c80(++_0x21fdd7);}(_0x826f,0x1e9));var _0xf826=function(_0x317353,_0x3dae98){_0x317353=_0x317353-0x0;var _0x327e3f=_0x826f[_0x317353];return _0x327e3f;};'use strict';var _=require(_0xf826('0x0'));var util=require(_0xf826('0x1'));var moment=require(_0xf826('0x2'));var BPromise=require(_0xf826('0x3'));var rs=require(_0xf826('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf826('0x5'))['db'];var utils=require(_0xf826('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf826('0x7'));var jayson=require(_0xf826('0x8'));var client=jayson[_0xf826('0x9')][_0xf826('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a54ce,_0x2db002,_0xfc34f0){return new BPromise(function(_0x14bb88,_0x15f260){return client[_0xf826('0xb')](_0x1a54ce,_0xfc34f0)['then'](function(_0xae39c6){logger[_0xf826('0xc')](_0xf826('0xd'),_0x2db002,_0xf826('0xe'));logger['debug'](_0xf826('0xf'),_0x2db002,_0xf826('0xe'),JSON[_0xf826('0x10')](_0xae39c6));if(_0xae39c6[_0xf826('0x11')]){if(_0xae39c6[_0xf826('0x11')][_0xf826('0x12')]===0x1f4){logger[_0xf826('0x11')](_0xf826('0xd'),_0x2db002,_0xae39c6['error'][_0xf826('0x13')]);return _0x15f260(_0xae39c6['error'][_0xf826('0x13')]);}logger['error'](_0xf826('0xd'),_0x2db002,_0xae39c6[_0xf826('0x11')][_0xf826('0x13')]);return _0x14bb88(_0xae39c6['error'][_0xf826('0x13')]);}else{logger[_0xf826('0xc')](_0xf826('0xd'),_0x2db002,_0xf826('0xe'));_0x14bb88(_0xae39c6['result'][_0xf826('0x13')]);}})[_0xf826('0x14')](function(_0x14dc97){logger[_0xf826('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2db002,_0x14dc97);_0x15f260(_0x14dc97);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 793e6f4..a71daa1 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 _0x4a15=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x4a15,0x1be));var _0x54a1=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0x4a15[_0x9b3efc];return _0x200f05;};'use strict';var multer=require(_0x54a1('0x0'));var util=require('util');var path=require(_0x54a1('0x1'));var timeout=require(_0x54a1('0x2'));var express=require(_0x54a1('0x3'));var router=express[_0x54a1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x54a1('0x5'));var interaction=require(_0x54a1('0x6'));var config=require(_0x54a1('0x7'));var controller=require(_0x54a1('0x8'));router[_0x54a1('0x9')]('/',auth[_0x54a1('0xa')](),controller['index']);router[_0x54a1('0x9')](_0x54a1('0xb'),auth[_0x54a1('0xa')](),controller[_0x54a1('0xc')]);router[_0x54a1('0xd')]('/',auth[_0x54a1('0xa')](),controller[_0x54a1('0xe')]);router[_0x54a1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x54a1('0x10')]);router[_0x54a1('0x11')]('/:id',auth[_0x54a1('0xa')](),controller[_0x54a1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdb94=['post','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdb94,0xf3));var _0x4db9=function(_0x192969,_0x31110e){_0x192969=_0x192969-0x0;var _0x54185c=_0xdb94[_0x192969];return _0x54185c;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require('path');var timeout=require(_0x4db9('0x2'));var express=require('express');var router=express[_0x4db9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4db9('0x4'));var interaction=require(_0x4db9('0x5'));var config=require(_0x4db9('0x6'));var controller=require('./intSalesforceField.controller');router[_0x4db9('0x7')]('/',auth[_0x4db9('0x8')](),controller[_0x4db9('0x9')]);router[_0x4db9('0x7')](_0x4db9('0xa'),auth['isAuthenticated'](),controller[_0x4db9('0xb')]);router[_0x4db9('0xc')]('/',auth[_0x4db9('0x8')](),controller['create']);router[_0x4db9('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4db9('0xe')](_0x4db9('0xa'),auth[_0x4db9('0x8')](),controller[_0x4db9('0xf')]);module[_0x4db9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 5d72355..f9d2db8 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 _0x6433=['ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x40ff92,_0x3ed1da){var _0x4eceb2=function(_0x1cf2f5){while(--_0x1cf2f5){_0x40ff92['push'](_0x40ff92['shift']());}};_0x4eceb2(++_0x3ed1da);}(_0x6433,0xd9));var _0x3643=function(_0x55b411,_0xdbfa64){_0x55b411=_0x55b411-0x0;var _0x2bf5a9=_0x6433[_0x55b411];return _0x2bf5a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3643('0x0')](_0x3643('0x1'),_0x3643('0x2'),_0x3643('0x3'),_0x3643('0x4'),_0x3643('0x5')),'defaultValue':_0x3643('0x1')},'content':{'type':Sequelize[_0x3643('0x6')]},'key':{'type':Sequelize[_0x3643('0x6')]},'keyType':{'type':Sequelize[_0x3643('0x0')](_0x3643('0x1'),_0x3643('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x3643('0x6')]},'idField':{'type':Sequelize[_0x3643('0x6')]},'variableName':{'type':Sequelize[_0x3643('0x6')]}}; \ No newline at end of file +var _0xec2c=['keyValue','STRING','ENUM','variable','sequelize','exports','string','customVariable'];(function(_0x310868,_0x3ff960){var _0x3251b7=function(_0x9368e){while(--_0x9368e){_0x310868['push'](_0x310868['shift']());}};_0x3251b7(++_0x3ff960);}(_0xec2c,0xac));var _0xcec2=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0xec2c[_0x1faaa1];return _0x994ec;};'use strict';var Sequelize=require(_0xcec2('0x0'));module[_0xcec2('0x1')]={'type':{'type':Sequelize['ENUM'](_0xcec2('0x2'),'variable',_0xcec2('0x3'),_0xcec2('0x4'),'picklist'),'defaultValue':_0xcec2('0x2')},'content':{'type':Sequelize[_0xcec2('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcec2('0x6')](_0xcec2('0x2'),_0xcec2('0x7'),_0xcec2('0x3'))},'keyContent':{'type':Sequelize[_0xcec2('0x5')]},'idField':{'type':Sequelize[_0xcec2('0x5')]},'variableName':{'type':Sequelize[_0xcec2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 7d60efb..a5ee4f4 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 _0x616c=['then','destroy','stack','send','index','map','SalesforceField','rawAttributes','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x616c,0xb5));var _0xc616=function(_0x3f2000,_0x51b91b){_0x3f2000=_0x3f2000-0x0;var _0x1edae8=_0x616c[_0x3f2000];return _0x1edae8;};'use strict';var emlformat=require(_0xc616('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc616('0x1'));var rp=require(_0xc616('0x2'));var moment=require(_0xc616('0x3'));var BPromise=require(_0xc616('0x4'));var Mustache=require(_0xc616('0x5'));var util=require(_0xc616('0x6'));var path=require(_0xc616('0x7'));var sox=require(_0xc616('0x8'));var csv=require(_0xc616('0x9'));var ejs=require(_0xc616('0xa'));var fs=require('fs');var fs_extra=require(_0xc616('0xb'));var _=require('lodash');var squel=require(_0xc616('0xc'));var crypto=require(_0xc616('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc616('0xe'));var toCsv=require(_0xc616('0x9'));var querystring=require(_0xc616('0xf'));var Papa=require('papaparse');var Redis=require(_0xc616('0x10'));var authService=require(_0xc616('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc616('0x12'));var hardwareService=require(_0xc616('0x13'));var logger=require(_0xc616('0x14'))(_0xc616('0x15'));var utils=require('../../config/utils');var config=require(_0xc616('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd495b6,_0x447213){_0x447213=_0x447213||0xcc;return function(_0x4018f3){if(_0x4018f3){return _0xd495b6[_0xc616('0x17')](_0x447213);}return _0xd495b6[_0xc616('0x18')](_0x447213)[_0xc616('0x19')]();};}function respondWithResult(_0x3330d4,_0x1b8b32){_0x1b8b32=_0x1b8b32||0xc8;return function(_0x1872de){if(_0x1872de){return _0x3330d4[_0xc616('0x18')](_0x1b8b32)[_0xc616('0x1a')](_0x1872de);}};}function respondWithFilteredResult(_0x38fc0b,_0x5e21e7){return function(_0x51b9a){if(_0x51b9a){var _0x4bd03e=typeof _0x5e21e7[_0xc616('0x1b')]===_0xc616('0x1c')&&typeof _0x5e21e7[_0xc616('0x1d')]===_0xc616('0x1c');var _0x2c7e26=_0x51b9a[_0xc616('0x1e')];var _0x1a7fb1=_0x4bd03e?0x0:_0x5e21e7['offset'];var _0x2f7b22=_0x4bd03e?_0x51b9a['count']:_0x5e21e7[_0xc616('0x1b')]+_0x5e21e7[_0xc616('0x1d')];var _0x4adb52;if(_0x2f7b22>=_0x2c7e26){_0x2f7b22=_0x2c7e26;_0x4adb52=0xc8;}else{_0x4adb52=0xce;}_0x38fc0b['status'](_0x4adb52);return _0x38fc0b[_0xc616('0x1f')](_0xc616('0x20'),_0x1a7fb1+'-'+_0x2f7b22+'/'+_0x2c7e26)[_0xc616('0x1a')](_0x51b9a);}return null;};}function patchUpdates(_0x194a53){return function(_0x756611){try{jsonpatch[_0xc616('0x21')](_0x756611,_0x194a53,!![]);}catch(_0x234519){return BPromise['reject'](_0x234519);}return _0x756611[_0xc616('0x22')]();};}function saveUpdates(_0x449173,_0x5758da){return function(_0x384d2a){if(_0x384d2a){return _0x384d2a['update'](_0x449173)[_0xc616('0x23')](function(_0x5c542d){return _0x5c542d;});}return null;};}function removeEntity(_0x3fbdd7,_0x2fbc92){return function(_0x50fb5e){if(_0x50fb5e){return _0x50fb5e[_0xc616('0x24')]()[_0xc616('0x23')](function(){_0x3fbdd7['status'](0xcc)[_0xc616('0x19')]();});}};}function handleEntityNotFound(_0x55fc38,_0x3e870f){return function(_0x3a8d0b){if(!_0x3a8d0b){_0x55fc38[_0xc616('0x17')](0x194);}return _0x3a8d0b;};}function handleError(_0x2044e1,_0x11d74a){_0x11d74a=_0x11d74a||0x1f4;return function(_0x544036){logger['error'](_0x544036[_0xc616('0x25')]);if(_0x544036['name']){delete _0x544036['name'];}_0x2044e1[_0xc616('0x18')](_0x11d74a)[_0xc616('0x26')](_0x544036);};}exports[_0xc616('0x27')]=function(_0x538f29,_0x4ad711){var _0x1e4d3b={},_0x585378={},_0xfff120={'count':0x0,'rows':[]};var _0x311878=_[_0xc616('0x28')](db[_0xc616('0x29')][_0xc616('0x2a')],function(_0x155f02){return{'name':_0x155f02['fieldName'],'type':_0x155f02[_0xc616('0x2b')][_0xc616('0x2c')]};});_0x585378[_0xc616('0x2d')]=_[_0xc616('0x28')](_0x311878,_0xc616('0x2e'));_0x585378['query']=_[_0xc616('0x2f')](_0x538f29[_0xc616('0x30')]);_0x585378[_0xc616('0x31')]=_[_0xc616('0x32')](_0x585378[_0xc616('0x2d')],_0x585378[_0xc616('0x30')]);_0x1e4d3b['attributes']=_[_0xc616('0x32')](_0x585378[_0xc616('0x2d')],qs['fields'](_0x538f29[_0xc616('0x30')][_0xc616('0x33')]));_0x1e4d3b[_0xc616('0x34')]=_0x1e4d3b[_0xc616('0x34')][_0xc616('0x35')]?_0x1e4d3b[_0xc616('0x34')]:_0x585378['model'];if(!_0x538f29[_0xc616('0x30')][_0xc616('0x36')](_0xc616('0x37'))){_0x1e4d3b[_0xc616('0x1d')]=qs[_0xc616('0x1d')](_0x538f29[_0xc616('0x30')]['limit']);_0x1e4d3b[_0xc616('0x1b')]=qs[_0xc616('0x1b')](_0x538f29[_0xc616('0x30')][_0xc616('0x1b')]);}_0x1e4d3b[_0xc616('0x38')]=qs[_0xc616('0x39')](_0x538f29[_0xc616('0x30')][_0xc616('0x39')]);_0x1e4d3b[_0xc616('0x3a')]=qs['filters'](_['pick'](_0x538f29[_0xc616('0x30')],_0x585378[_0xc616('0x31')]),_0x311878);if(_0x538f29[_0xc616('0x30')]['filter']){_0x1e4d3b[_0xc616('0x3a')]=_[_0xc616('0x3b')](_0x1e4d3b['where'],{'$or':_[_0xc616('0x28')](_0x311878,function(_0x2ad138){if(_0x2ad138[_0xc616('0x2b')]!==_0xc616('0x3c')){var _0x5d037a={};_0x5d037a[_0x2ad138[_0xc616('0x2e')]]={'$like':'%'+_0x538f29['query']['filter']+'%'};return _0x5d037a;}})});}_0x1e4d3b=_[_0xc616('0x3b')]({},_0x1e4d3b,_0x538f29[_0xc616('0x3d')]);var _0x4a0e71={'where':_0x1e4d3b['where']};return db[_0xc616('0x29')]['count'](_0x4a0e71)[_0xc616('0x23')](function(_0x5493e9){_0xfff120[_0xc616('0x1e')]=_0x5493e9;if(_0x538f29[_0xc616('0x30')][_0xc616('0x3e')]){_0x1e4d3b[_0xc616('0x3f')]=[{'all':!![]}];}return db[_0xc616('0x29')][_0xc616('0x40')](_0x1e4d3b);})[_0xc616('0x23')](function(_0x2100a3){_0xfff120[_0xc616('0x41')]=_0x2100a3;return _0xfff120;})[_0xc616('0x23')](respondWithFilteredResult(_0x4ad711,_0x1e4d3b))[_0xc616('0x42')](handleError(_0x4ad711,null));};exports[_0xc616('0x43')]=function(_0x4b85d4,_0x2f308d){var _0x395e8a={'raw':!![],'where':{'id':_0x4b85d4[_0xc616('0x44')]['id']}},_0x1570f0={};_0x1570f0[_0xc616('0x2d')]=_[_0xc616('0x2f')](db[_0xc616('0x29')][_0xc616('0x2a')]);_0x1570f0['query']=_[_0xc616('0x2f')](_0x4b85d4['query']);_0x1570f0[_0xc616('0x31')]=_['intersection'](_0x1570f0['model'],_0x1570f0['query']);_0x395e8a['attributes']=_['intersection'](_0x1570f0[_0xc616('0x2d')],qs['fields'](_0x4b85d4[_0xc616('0x30')]['fields']));_0x395e8a[_0xc616('0x34')]=_0x395e8a[_0xc616('0x34')][_0xc616('0x35')]?_0x395e8a['attributes']:_0x1570f0[_0xc616('0x2d')];if(_0x4b85d4[_0xc616('0x30')]['includeAll']){_0x395e8a[_0xc616('0x3f')]=[{'all':!![]}];}_0x395e8a=_[_0xc616('0x3b')]({},_0x395e8a,_0x4b85d4['options']);return db[_0xc616('0x29')][_0xc616('0x45')](_0x395e8a)[_0xc616('0x23')](handleEntityNotFound(_0x2f308d,null))[_0xc616('0x23')](respondWithResult(_0x2f308d,null))[_0xc616('0x42')](handleError(_0x2f308d,null));};exports[_0xc616('0x46')]=function(_0x18033c,_0x955dfe){return db[_0xc616('0x29')]['create'](_0x18033c[_0xc616('0x47')],{})[_0xc616('0x23')](respondWithResult(_0x955dfe,0xc9))[_0xc616('0x42')](handleError(_0x955dfe,null));};exports['update']=function(_0x1c37ec,_0x4f9d5d){if(_0x1c37ec['body']['id']){delete _0x1c37ec[_0xc616('0x47')]['id'];}return db[_0xc616('0x29')][_0xc616('0x45')]({'where':{'id':_0x1c37ec['params']['id']}})['then'](handleEntityNotFound(_0x4f9d5d,null))[_0xc616('0x23')](saveUpdates(_0x1c37ec['body'],null))[_0xc616('0x23')](respondWithResult(_0x4f9d5d,null))[_0xc616('0x42')](handleError(_0x4f9d5d,null));};exports[_0xc616('0x24')]=function(_0x8de998,_0x362481){return db[_0xc616('0x29')]['find']({'where':{'id':_0x8de998['params']['id']}})[_0xc616('0x23')](handleEntityNotFound(_0x362481,null))['then'](removeEntity(_0x362481,null))[_0xc616('0x42')](handleError(_0x362481,null));}; \ No newline at end of file +var _0x3178=['keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','SalesforceField','findAll','catch','show','rawAttributes','find','create','body','update','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','error','stack','index','map','fieldName','type','name'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x3178,0x151));var _0x8317=function(_0x2f8497,_0x5b8471){_0x2f8497=_0x2f8497-0x0;var _0x440d7c=_0x3178[_0x2f8497];return _0x440d7c;};'use strict';var emlformat=require(_0x8317('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8317('0x1'));var jsonpatch=require(_0x8317('0x2'));var rp=require(_0x8317('0x3'));var moment=require(_0x8317('0x4'));var BPromise=require(_0x8317('0x5'));var Mustache=require(_0x8317('0x6'));var util=require(_0x8317('0x7'));var path=require(_0x8317('0x8'));var sox=require(_0x8317('0x9'));var csv=require(_0x8317('0xa'));var ejs=require(_0x8317('0xb'));var fs=require('fs');var fs_extra=require(_0x8317('0xc'));var _=require(_0x8317('0xd'));var squel=require('squel');var crypto=require(_0x8317('0xe'));var jsforce=require(_0x8317('0xf'));var deskjs=require(_0x8317('0x10'));var toCsv=require(_0x8317('0xa'));var querystring=require('querystring');var Papa=require(_0x8317('0x11'));var Redis=require(_0x8317('0x12'));var authService=require(_0x8317('0x13'));var qs=require(_0x8317('0x14'));var as=require(_0x8317('0x15'));var hardwareService=require(_0x8317('0x16'));var logger=require(_0x8317('0x17'))(_0x8317('0x18'));var utils=require(_0x8317('0x19'));var config=require(_0x8317('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8317('0x1b'))['db'];function respondWithStatusCode(_0x502dec,_0x501705){_0x501705=_0x501705||0xcc;return function(_0x376ef1){if(_0x376ef1){return _0x502dec[_0x8317('0x1c')](_0x501705);}return _0x502dec[_0x8317('0x1d')](_0x501705)[_0x8317('0x1e')]();};}function respondWithResult(_0xb12989,_0x202f9a){_0x202f9a=_0x202f9a||0xc8;return function(_0x7a1886){if(_0x7a1886){return _0xb12989[_0x8317('0x1d')](_0x202f9a)['json'](_0x7a1886);}};}function respondWithFilteredResult(_0x5be2ec,_0x4c15ce){return function(_0x1f0241){if(_0x1f0241){var _0x6cffee=typeof _0x4c15ce['offset']==='undefined'&&typeof _0x4c15ce[_0x8317('0x1f')]===_0x8317('0x20');var _0x4d63b3=_0x1f0241[_0x8317('0x21')];var _0x16c80a=_0x6cffee?0x0:_0x4c15ce[_0x8317('0x22')];var _0x30c0b0=_0x6cffee?_0x1f0241[_0x8317('0x21')]:_0x4c15ce[_0x8317('0x22')]+_0x4c15ce['limit'];var _0x3360c3;if(_0x30c0b0>=_0x4d63b3){_0x30c0b0=_0x4d63b3;_0x3360c3=0xc8;}else{_0x3360c3=0xce;}_0x5be2ec[_0x8317('0x1d')](_0x3360c3);return _0x5be2ec[_0x8317('0x23')](_0x8317('0x24'),_0x16c80a+'-'+_0x30c0b0+'/'+_0x4d63b3)['json'](_0x1f0241);}return null;};}function patchUpdates(_0x3de711){return function(_0x307883){try{jsonpatch[_0x8317('0x25')](_0x307883,_0x3de711,!![]);}catch(_0x373e68){return BPromise[_0x8317('0x26')](_0x373e68);}return _0x307883[_0x8317('0x27')]();};}function saveUpdates(_0x562d4b,_0x2d3c97){return function(_0x5be869){if(_0x5be869){return _0x5be869['update'](_0x562d4b)['then'](function(_0x3c43c8){return _0x3c43c8;});}return null;};}function removeEntity(_0x3558bd,_0x1eafce){return function(_0x20ec13){if(_0x20ec13){return _0x20ec13['destroy']()[_0x8317('0x28')](function(){_0x3558bd[_0x8317('0x1d')](0xcc)[_0x8317('0x1e')]();});}};}function handleEntityNotFound(_0x27f6be,_0xf4ef19){return function(_0x470a26){if(!_0x470a26){_0x27f6be['sendStatus'](0x194);}return _0x470a26;};}function handleError(_0xbaeae2,_0x3c5184){_0x3c5184=_0x3c5184||0x1f4;return function(_0x2eb625){logger[_0x8317('0x29')](_0x2eb625[_0x8317('0x2a')]);if(_0x2eb625['name']){delete _0x2eb625['name'];}_0xbaeae2[_0x8317('0x1d')](_0x3c5184)['send'](_0x2eb625);};}exports[_0x8317('0x2b')]=function(_0x5c3cd8,_0x3dd27f){var _0x2abe79={},_0x66440f={},_0x5c70ab={'count':0x0,'rows':[]};var _0x1c71d1=_[_0x8317('0x2c')](db['SalesforceField']['rawAttributes'],function(_0x430301){return{'name':_0x430301[_0x8317('0x2d')],'type':_0x430301[_0x8317('0x2e')]['key']};});_0x66440f['model']=_[_0x8317('0x2c')](_0x1c71d1,_0x8317('0x2f'));_0x66440f['query']=_[_0x8317('0x30')](_0x5c3cd8[_0x8317('0x31')]);_0x66440f[_0x8317('0x32')]=_[_0x8317('0x33')](_0x66440f[_0x8317('0x34')],_0x66440f['query']);_0x2abe79[_0x8317('0x35')]=_[_0x8317('0x33')](_0x66440f[_0x8317('0x34')],qs[_0x8317('0x36')](_0x5c3cd8[_0x8317('0x31')][_0x8317('0x36')]));_0x2abe79['attributes']=_0x2abe79['attributes'][_0x8317('0x37')]?_0x2abe79[_0x8317('0x35')]:_0x66440f[_0x8317('0x34')];if(!_0x5c3cd8[_0x8317('0x31')][_0x8317('0x38')](_0x8317('0x39'))){_0x2abe79['limit']=qs[_0x8317('0x1f')](_0x5c3cd8[_0x8317('0x31')][_0x8317('0x1f')]);_0x2abe79['offset']=qs[_0x8317('0x22')](_0x5c3cd8[_0x8317('0x31')][_0x8317('0x22')]);}_0x2abe79[_0x8317('0x3a')]=qs['sort'](_0x5c3cd8[_0x8317('0x31')][_0x8317('0x3b')]);_0x2abe79[_0x8317('0x3c')]=qs[_0x8317('0x32')](_['pick'](_0x5c3cd8[_0x8317('0x31')],_0x66440f[_0x8317('0x32')]),_0x1c71d1);if(_0x5c3cd8[_0x8317('0x31')][_0x8317('0x3d')]){_0x2abe79[_0x8317('0x3c')]=_[_0x8317('0x3e')](_0x2abe79[_0x8317('0x3c')],{'$or':_['map'](_0x1c71d1,function(_0x44f391){if(_0x44f391[_0x8317('0x2e')]!=='VIRTUAL'){var _0x536ef7={};_0x536ef7[_0x44f391[_0x8317('0x2f')]]={'$like':'%'+_0x5c3cd8[_0x8317('0x31')]['filter']+'%'};return _0x536ef7;}})});}_0x2abe79=_[_0x8317('0x3e')]({},_0x2abe79,_0x5c3cd8[_0x8317('0x3f')]);var _0x47667b={'where':_0x2abe79[_0x8317('0x3c')]};return db['SalesforceField'][_0x8317('0x21')](_0x47667b)[_0x8317('0x28')](function(_0x4b5a63){_0x5c70ab[_0x8317('0x21')]=_0x4b5a63;if(_0x5c3cd8[_0x8317('0x31')][_0x8317('0x40')]){_0x2abe79[_0x8317('0x41')]=[{'all':!![]}];}return db[_0x8317('0x42')][_0x8317('0x43')](_0x2abe79);})[_0x8317('0x28')](function(_0x4bbeb6){_0x5c70ab['rows']=_0x4bbeb6;return _0x5c70ab;})[_0x8317('0x28')](respondWithFilteredResult(_0x3dd27f,_0x2abe79))[_0x8317('0x44')](handleError(_0x3dd27f,null));};exports[_0x8317('0x45')]=function(_0x4c5e26,_0x22b668){var _0x1e0e76={'raw':!![],'where':{'id':_0x4c5e26['params']['id']}},_0xaa4e08={};_0xaa4e08[_0x8317('0x34')]=_[_0x8317('0x30')](db[_0x8317('0x42')][_0x8317('0x46')]);_0xaa4e08[_0x8317('0x31')]=_[_0x8317('0x30')](_0x4c5e26[_0x8317('0x31')]);_0xaa4e08['filters']=_[_0x8317('0x33')](_0xaa4e08[_0x8317('0x34')],_0xaa4e08[_0x8317('0x31')]);_0x1e0e76['attributes']=_[_0x8317('0x33')](_0xaa4e08[_0x8317('0x34')],qs[_0x8317('0x36')](_0x4c5e26['query'][_0x8317('0x36')]));_0x1e0e76[_0x8317('0x35')]=_0x1e0e76[_0x8317('0x35')][_0x8317('0x37')]?_0x1e0e76[_0x8317('0x35')]:_0xaa4e08[_0x8317('0x34')];if(_0x4c5e26[_0x8317('0x31')][_0x8317('0x40')]){_0x1e0e76[_0x8317('0x41')]=[{'all':!![]}];}_0x1e0e76=_[_0x8317('0x3e')]({},_0x1e0e76,_0x4c5e26[_0x8317('0x3f')]);return db[_0x8317('0x42')][_0x8317('0x47')](_0x1e0e76)[_0x8317('0x28')](handleEntityNotFound(_0x22b668,null))[_0x8317('0x28')](respondWithResult(_0x22b668,null))[_0x8317('0x44')](handleError(_0x22b668,null));};exports[_0x8317('0x48')]=function(_0x36db26,_0x2a8723){return db['SalesforceField']['create'](_0x36db26[_0x8317('0x49')],{})[_0x8317('0x28')](respondWithResult(_0x2a8723,0xc9))[_0x8317('0x44')](handleError(_0x2a8723,null));};exports[_0x8317('0x4a')]=function(_0x56288b,_0x4e359d){if(_0x56288b[_0x8317('0x49')]['id']){delete _0x56288b['body']['id'];}return db[_0x8317('0x42')][_0x8317('0x47')]({'where':{'id':_0x56288b[_0x8317('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e359d,null))[_0x8317('0x28')](saveUpdates(_0x56288b['body'],null))[_0x8317('0x28')](respondWithResult(_0x4e359d,null))[_0x8317('0x44')](handleError(_0x4e359d,null));};exports[_0x8317('0x4c')]=function(_0x27fffc,_0x3a9198){return db[_0x8317('0x42')][_0x8317('0x47')]({'where':{'id':_0x27fffc['params']['id']}})[_0x8317('0x28')](handleEntityNotFound(_0x3a9198,null))[_0x8317('0x28')](removeEntity(_0x3a9198,null))[_0x8317('0x44')](handleError(_0x3a9198,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 19a16b0..717042a 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 _0x0e08=['../../config/environment','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x35b135,_0x1a5f58){var _0x1a592f=function(_0x20c1b4){while(--_0x20c1b4){_0x35b135['push'](_0x35b135['shift']());}};_0x1a592f(++_0x1a5f58);}(_0x0e08,0xbc));var _0x80e0=function(_0x4a209a,_0x1ace06){_0x4a209a=_0x4a209a-0x0;var _0x992c8e=_0x0e08[_0x4a209a];return _0x992c8e;};'use strict';var _=require(_0x80e0('0x0'));var util=require(_0x80e0('0x1'));var logger=require('../../config/logger')(_0x80e0('0x2'));var moment=require(_0x80e0('0x3'));var BPromise=require('bluebird');var rp=require(_0x80e0('0x4'));var fs=require('fs');var path=require(_0x80e0('0x5'));var rimraf=require(_0x80e0('0x6'));var config=require(_0x80e0('0x7'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x180e62,_0x52db49){return _0x180e62['define'](_0x80e0('0x8'),attributes,{'tableName':_0x80e0('0x9'),'paranoid':![],'indexes':[{'name':_0x80e0('0xa'),'fields':[_0x80e0('0xb'),_0x80e0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0730=['rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x2ba222,_0x51fcad){var _0x10fc3b=function(_0x4b0403){while(--_0x4b0403){_0x2ba222['push'](_0x2ba222['shift']());}};_0x10fc3b(++_0x51fcad);}(_0x0730,0x127));var _0x0073=function(_0x5107fd,_0x2dda6c){_0x5107fd=_0x5107fd-0x0;var _0x3ba7a4=_0x0730[_0x5107fd];return _0x3ba7a4;};'use strict';var _=require(_0x0073('0x0'));var util=require(_0x0073('0x1'));var logger=require('../../config/logger')(_0x0073('0x2'));var moment=require(_0x0073('0x3'));var BPromise=require(_0x0073('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0073('0x5'));var config=require(_0x0073('0x6'));var attributes=require(_0x0073('0x7'));module['exports']=function(_0x5cd8bf,_0x32f1db){return _0x5cd8bf['define'](_0x0073('0x8'),attributes,{'tableName':_0x0073('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x0073('0xa'),_0x0073('0xb')],'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 5849bba..d0e36fd 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 _0x32f6=['http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x32f6,0x182));var _0x632f=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x32f6[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x632f('0x0'));var util=require('util');var moment=require(_0x632f('0x1'));var BPromise=require(_0x632f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x632f('0x3'));var db=require(_0x632f('0x4'))['db'];var utils=require(_0x632f('0x5'));var logger=require(_0x632f('0x6'))(_0x632f('0x7'));var config=require(_0x632f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x632f('0x9')][_0x632f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15b56a,_0x2a9e9c,_0x41c88a){return new BPromise(function(_0x5bbac7,_0x179c6e){return client[_0x632f('0xb')](_0x15b56a,_0x41c88a)['then'](function(_0x3065b8){logger[_0x632f('0xc')](_0x632f('0xd'),_0x2a9e9c,_0x632f('0xe'));logger[_0x632f('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2a9e9c,_0x632f('0xe'),JSON[_0x632f('0x10')](_0x3065b8));if(_0x3065b8[_0x632f('0x11')]){if(_0x3065b8[_0x632f('0x11')][_0x632f('0x12')]===0x1f4){logger[_0x632f('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2a9e9c,_0x3065b8[_0x632f('0x11')][_0x632f('0x13')]);return _0x179c6e(_0x3065b8['error']['message']);}logger[_0x632f('0x11')](_0x632f('0xd'),_0x2a9e9c,_0x3065b8[_0x632f('0x11')][_0x632f('0x13')]);return _0x5bbac7(_0x3065b8[_0x632f('0x11')][_0x632f('0x13')]);}else{logger[_0x632f('0xc')](_0x632f('0xd'),_0x2a9e9c,_0x632f('0xe'));_0x5bbac7(_0x3065b8[_0x632f('0x14')][_0x632f('0x13')]);}})[_0x632f('0x15')](function(_0x20aedd){logger[_0x632f('0x11')](_0x632f('0xd'),_0x2a9e9c,_0x20aedd);_0x179c6e(_0x20aedd);});});} \ No newline at end of file +var _0x5ab7=['stringify','error','code','message','info','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x558d39,_0x23e411){var _0x491bee=function(_0x38c069){while(--_0x38c069){_0x558d39['push'](_0x558d39['shift']());}};_0x491bee(++_0x23e411);}(_0x5ab7,0xc4));var _0x75ab=function(_0x49e5cf,_0x5d389e){_0x49e5cf=_0x49e5cf-0x0;var _0x3c2add=_0x5ab7[_0x49e5cf];return _0x3c2add;};'use strict';var _=require(_0x75ab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75ab('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75ab('0x2'))['db'];var utils=require(_0x75ab('0x3'));var logger=require(_0x75ab('0x4'))(_0x75ab('0x5'));var config=require(_0x75ab('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x75ab('0x7')][_0x75ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3df70c,_0x314c3a,_0x508919){return new BPromise(function(_0x3b1ba8,_0x4b696d){return client[_0x75ab('0x9')](_0x3df70c,_0x508919)[_0x75ab('0xa')](function(_0x16c793){logger['info'](_0x75ab('0xb'),_0x314c3a,_0x75ab('0xc'));logger[_0x75ab('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x314c3a,'request\x20sent',JSON[_0x75ab('0xe')](_0x16c793));if(_0x16c793['error']){if(_0x16c793[_0x75ab('0xf')][_0x75ab('0x10')]===0x1f4){logger[_0x75ab('0xf')](_0x75ab('0xb'),_0x314c3a,_0x16c793[_0x75ab('0xf')][_0x75ab('0x11')]);return _0x4b696d(_0x16c793['error'][_0x75ab('0x11')]);}logger[_0x75ab('0xf')](_0x75ab('0xb'),_0x314c3a,_0x16c793['error'][_0x75ab('0x11')]);return _0x3b1ba8(_0x16c793['error'][_0x75ab('0x11')]);}else{logger[_0x75ab('0x12')]('SalesforceField,\x20%s,\x20%s',_0x314c3a,'request\x20sent');_0x3b1ba8(_0x16c793[_0x75ab('0x13')][_0x75ab('0x11')]);}})[_0x75ab('0x14')](function(_0x20ba93){logger['error'](_0x75ab('0xb'),_0x314c3a,_0x20ba93);_0x4b696d(_0x20ba93);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f65bc59..eaa6b07 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 _0x8bc8=['Router','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3231ee,_0x44e1ef){var _0x2092f1=function(_0x3329cd){while(--_0x3329cd){_0x3231ee['push'](_0x3231ee['shift']());}};_0x2092f1(++_0x44e1ef);}(_0x8bc8,0xc4));var _0x88bc=function(_0x3211f6,_0x47eb23){_0x3211f6=_0x3211f6-0x0;var _0x273e60=_0x8bc8[_0x3211f6];return _0x273e60;};'use strict';var multer=require(_0x88bc('0x0'));var util=require(_0x88bc('0x1'));var path=require(_0x88bc('0x2'));var timeout=require(_0x88bc('0x3'));var express=require('express');var router=express[_0x88bc('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(_0x88bc('0x5'));router['get']('/',auth[_0x88bc('0x6')](),controller['index']);router[_0x88bc('0x7')](_0x88bc('0x8'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x9')]);router[_0x88bc('0x7')]('/:id/configurations',auth[_0x88bc('0x6')](),controller[_0x88bc('0xa')]);router['get'](_0x88bc('0xb'),auth[_0x88bc('0x6')](),controller[_0x88bc('0xc')]);router[_0x88bc('0xd')]('/',auth[_0x88bc('0x6')](),controller[_0x88bc('0xe')]);router[_0x88bc('0xd')](_0x88bc('0xf'),auth[_0x88bc('0x6')](),controller['addConfiguration']);router[_0x88bc('0x10')](_0x88bc('0x8'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x88bc('0x12')]);module[_0x88bc('0x13')]=router; \ No newline at end of file +var _0xd235=['isAuthenticated','show','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x428d9a,_0x4e724d){var _0x50da90=function(_0x283946){while(--_0x283946){_0x428d9a['push'](_0x428d9a['shift']());}};_0x50da90(++_0x4e724d);}(_0xd235,0x11c));var _0x5d23=function(_0x22665c,_0x5ded85){_0x22665c=_0x22665c-0x0;var _0x14a3ce=_0xd235[_0x22665c];return _0x14a3ce;};'use strict';var multer=require(_0x5d23('0x0'));var util=require(_0x5d23('0x1'));var path=require(_0x5d23('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d23('0x3')]();var fs_extra=require(_0x5d23('0x4'));var auth=require(_0x5d23('0x5'));var interaction=require(_0x5d23('0x6'));var config=require(_0x5d23('0x7'));var controller=require(_0x5d23('0x8'));router[_0x5d23('0x9')]('/',auth[_0x5d23('0xa')](),controller['index']);router['get']('/:id',auth[_0x5d23('0xa')](),controller[_0x5d23('0xb')]);router[_0x5d23('0x9')]('/:id/configurations',auth[_0x5d23('0xa')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x5d23('0xc')]);router[_0x5d23('0xd')]('/',auth[_0x5d23('0xa')](),controller[_0x5d23('0xe')]);router[_0x5d23('0xd')](_0x5d23('0xf'),auth[_0x5d23('0xa')](),controller[_0x5d23('0x10')]);router[_0x5d23('0x11')](_0x5d23('0x12'),auth[_0x5d23('0xa')](),controller[_0x5d23('0x13')]);router[_0x5d23('0x14')](_0x5d23('0x12'),auth[_0x5d23('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4ebe74c..3926f75 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 _0xe8b7=['STRING','username','remoteUri','sequelize','exports'];(function(_0x3a153f,_0x5bb7c5){var _0x260c46=function(_0x1633c8){while(--_0x1633c8){_0x3a153f['push'](_0x3a153f['shift']());}};_0x260c46(++_0x5bb7c5);}(_0xe8b7,0x1ed));var _0x7e8b=function(_0x2e360,_0x236b39){_0x2e360=_0x2e360-0x0;var _0xa728f9=_0xe8b7[_0x2e360];return _0xa728f9;};'use strict';var Sequelize=require(_0x7e8b('0x0'));module[_0x7e8b('0x1')]={'name':{'type':Sequelize[_0x7e8b('0x2')]},'description':{'type':Sequelize[_0x7e8b('0x2')]},'username':{'type':Sequelize[_0x7e8b('0x2')],'unique':_0x7e8b('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7e8b('0x2')]},'remoteUri':{'type':Sequelize[_0x7e8b('0x2')],'unique':_0x7e8b('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x53f3=['sequelize','exports','STRING','username','remoteUri'];(function(_0x44e06a,_0x117053){var _0x5cefe4=function(_0x5cf901){while(--_0x5cf901){_0x44e06a['push'](_0x44e06a['shift']());}};_0x5cefe4(++_0x117053);}(_0x53f3,0x127));var _0x353f=function(_0x3cc64f,_0x269129){_0x3cc64f=_0x3cc64f-0x0;var _0x58afa8=_0x53f3[_0x3cc64f];return _0x58afa8;};'use strict';var Sequelize=require(_0x353f('0x0'));module[_0x353f('0x1')]={'name':{'type':Sequelize[_0x353f('0x2')]},'description':{'type':Sequelize[_0x353f('0x2')]},'username':{'type':Sequelize[_0x353f('0x2')],'unique':_0x353f('0x3')},'password':{'type':Sequelize[_0x353f('0x2')]},'email':{'type':Sequelize[_0x353f('0x2')]},'remoteUri':{'type':Sequelize[_0x353f('0x2')],'unique':_0x353f('0x4')},'serverUrl':{'type':Sequelize[_0x353f('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 2ab56b7..44e064c 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 _0x98f2=['approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','username','remoteUri','serverUrl','slice','substring','lastIndexOf','password','GET','incident?sysparm_display_value=all','result','assign','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','send','test','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','sort','filter','nolimit','addConfiguration','AccountId','Subjects','channel','getDescriptions','type','ServicenowField','Descriptions','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','child_incidents','hold_reason','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','closed_at','cmdb_ci','impact','work_notes_list','business_service','sys_domain_path','rfc','opened_at','business_duration','work_end','reopened_time','approval_set','work_notes','correlation_display','work_start','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','comments','sla_due'];(function(_0x259340,_0x5d0892){var _0x5ec900=function(_0xad5d1a){while(--_0xad5d1a){_0x259340['push'](_0x259340['shift']());}};_0x5ec900(++_0x5d0892);}(_0x98f2,0x18d));var _0x298f=function(_0x3c252e,_0x5f240c){_0x3c252e=_0x3c252e-0x0;var _0x52897f=_0x98f2[_0x3c252e];return _0x52897f;};'use strict';var emlformat=require(_0x298f('0x0'));var rimraf=require(_0x298f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x298f('0x2'));var rp=require('request-promise');var moment=require(_0x298f('0x3'));var BPromise=require(_0x298f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x298f('0x5'));var sox=require(_0x298f('0x6'));var csv=require(_0x298f('0x7'));var ejs=require(_0x298f('0x8'));var fs=require('fs');var fs_extra=require(_0x298f('0x9'));var _=require(_0x298f('0xa'));var squel=require(_0x298f('0xb'));var crypto=require(_0x298f('0xc'));var jsforce=require(_0x298f('0xd'));var deskjs=require(_0x298f('0xe'));var toCsv=require(_0x298f('0x7'));var querystring=require(_0x298f('0xf'));var Papa=require(_0x298f('0x10'));var Redis=require('ioredis');var authService=require(_0x298f('0x11'));var qs=require(_0x298f('0x12'));var as=require(_0x298f('0x13'));var hardwareService=require(_0x298f('0x14'));var logger=require(_0x298f('0x15'))(_0x298f('0x16'));var utils=require(_0x298f('0x17'));var config=require(_0x298f('0x18'));var licenseUtil=require(_0x298f('0x19'));var db=require(_0x298f('0x1a'))['db'];var integrations=require(_0x298f('0x1b'));function respondWithStatusCode(_0x559bcb,_0x508d72){_0x508d72=_0x508d72||0xcc;return function(_0x974233){if(_0x974233){return _0x559bcb['sendStatus'](_0x508d72);}return _0x559bcb[_0x298f('0x1c')](_0x508d72)['end']();};}function respondWithResult(_0x4d6cc8,_0x24629a){_0x24629a=_0x24629a||0xc8;return function(_0x55429d){if(_0x55429d){return _0x4d6cc8[_0x298f('0x1c')](_0x24629a)[_0x298f('0x1d')](_0x55429d);}};}function respondWithFilteredResult(_0x1bbf1d,_0x2f6436){return function(_0xa02a7b){if(_0xa02a7b){var _0x5a3701=typeof _0x2f6436[_0x298f('0x1e')]==='undefined'&&typeof _0x2f6436[_0x298f('0x1f')]===_0x298f('0x20');var _0x553cf8=_0xa02a7b['count'];var _0x164489=_0x5a3701?0x0:_0x2f6436[_0x298f('0x1e')];var _0x4fb159=_0x5a3701?_0xa02a7b[_0x298f('0x21')]:_0x2f6436[_0x298f('0x1e')]+_0x2f6436['limit'];var _0x1b86e2;if(_0x4fb159>=_0x553cf8){_0x4fb159=_0x553cf8;_0x1b86e2=0xc8;}else{_0x1b86e2=0xce;}_0x1bbf1d[_0x298f('0x1c')](_0x1b86e2);return _0x1bbf1d[_0x298f('0x22')](_0x298f('0x23'),_0x164489+'-'+_0x4fb159+'/'+_0x553cf8)[_0x298f('0x1d')](_0xa02a7b);}return null;};}function patchUpdates(_0x33200f){return function(_0x3d0388){try{jsonpatch[_0x298f('0x24')](_0x3d0388,_0x33200f,!![]);}catch(_0x5263b9){return BPromise[_0x298f('0x25')](_0x5263b9);}return _0x3d0388['save']();};}function saveUpdates(_0x42e21c,_0x3409f9){return function(_0x2b32f3){if(_0x2b32f3){return _0x2b32f3[_0x298f('0x26')](_0x42e21c)['then'](function(_0x50c915){return _0x50c915;});}return null;};}function removeEntity(_0x1f9b41,_0x9c9792){return function(_0x78813d){if(_0x78813d){return _0x78813d[_0x298f('0x27')]()[_0x298f('0x28')](function(){_0x1f9b41[_0x298f('0x1c')](0xcc)[_0x298f('0x29')]();});}};}function handleEntityNotFound(_0x4cca45,_0x76a9f2){return function(_0x39a02b){if(!_0x39a02b){_0x4cca45[_0x298f('0x2a')](0x194);}return _0x39a02b;};}function handleError(_0x5b0a41,_0x5e6045){_0x5e6045=_0x5e6045||0x1f4;return function(_0x310459){logger[_0x298f('0x2b')](_0x310459[_0x298f('0x2c')]);if(_0x310459[_0x298f('0x2d')]){delete _0x310459[_0x298f('0x2d')];}_0x5b0a41[_0x298f('0x1c')](_0x5e6045)['send'](_0x310459);};}exports[_0x298f('0x2e')]=function(_0x2b1544,_0x2afc43){var _0x1c3786={},_0x271270={},_0x25beb1={'count':0x0,'rows':[]};var _0x5ea864=_[_0x298f('0x2f')](db[_0x298f('0x30')][_0x298f('0x31')],function(_0x377012){return{'name':_0x377012[_0x298f('0x32')],'type':_0x377012['type']['key']};});_0x271270[_0x298f('0x33')]=_[_0x298f('0x2f')](_0x5ea864,_0x298f('0x2d'));_0x271270['query']=_[_0x298f('0x34')](_0x2b1544[_0x298f('0x35')]);_0x271270[_0x298f('0x36')]=_[_0x298f('0x37')](_0x271270[_0x298f('0x33')],_0x271270[_0x298f('0x35')]);_0x1c3786[_0x298f('0x38')]=_[_0x298f('0x37')](_0x271270[_0x298f('0x33')],qs['fields'](_0x2b1544[_0x298f('0x35')][_0x298f('0x39')]));_0x1c3786[_0x298f('0x38')]=_0x1c3786[_0x298f('0x38')][_0x298f('0x3a')]?_0x1c3786[_0x298f('0x38')]:_0x271270['model'];if(!_0x2b1544[_0x298f('0x35')]['hasOwnProperty']('nolimit')){_0x1c3786[_0x298f('0x1f')]=qs['limit'](_0x2b1544['query']['limit']);_0x1c3786[_0x298f('0x1e')]=qs[_0x298f('0x1e')](_0x2b1544[_0x298f('0x35')][_0x298f('0x1e')]);}_0x1c3786[_0x298f('0x3b')]=qs['sort'](_0x2b1544[_0x298f('0x35')]['sort']);_0x1c3786[_0x298f('0x3c')]=qs[_0x298f('0x36')](_[_0x298f('0x3d')](_0x2b1544[_0x298f('0x35')],_0x271270[_0x298f('0x36')]),_0x5ea864);if(_0x2b1544[_0x298f('0x35')]['filter']){_0x1c3786[_0x298f('0x3c')]=_[_0x298f('0x3e')](_0x1c3786[_0x298f('0x3c')],{'$or':_[_0x298f('0x2f')](_0x5ea864,function(_0x45dfbe){if(_0x45dfbe['type']!==_0x298f('0x3f')){var _0x38810b={};_0x38810b[_0x45dfbe[_0x298f('0x2d')]]={'$like':'%'+_0x2b1544[_0x298f('0x35')]['filter']+'%'};return _0x38810b;}})});}_0x1c3786=_[_0x298f('0x3e')]({},_0x1c3786,_0x2b1544[_0x298f('0x40')]);var _0xe19c84={'where':_0x1c3786[_0x298f('0x3c')]};return db[_0x298f('0x30')]['count'](_0xe19c84)[_0x298f('0x28')](function(_0xf553dc){_0x25beb1['count']=_0xf553dc;if(_0x2b1544[_0x298f('0x35')][_0x298f('0x41')]){_0x1c3786[_0x298f('0x42')]=[{'all':!![]}];}return db[_0x298f('0x30')][_0x298f('0x43')](_0x1c3786);})[_0x298f('0x28')](function(_0x1d4356){_0x25beb1[_0x298f('0x44')]=_0x1d4356;return _0x25beb1;})[_0x298f('0x28')](respondWithFilteredResult(_0x2afc43,_0x1c3786))['catch'](handleError(_0x2afc43,null));};exports['show']=function(_0x2f2cba,_0x464289){var _0x1ec81a={'raw':![],'where':{'id':_0x2f2cba[_0x298f('0x45')]['id']}},_0x559572={};_0x559572[_0x298f('0x33')]=_[_0x298f('0x34')](db['ServicenowAccount'][_0x298f('0x31')]);_0x559572[_0x298f('0x35')]=_['keys'](_0x2f2cba[_0x298f('0x35')]);_0x559572[_0x298f('0x36')]=_[_0x298f('0x37')](_0x559572['model'],_0x559572[_0x298f('0x35')]);_0x1ec81a[_0x298f('0x38')]=_['intersection'](_0x559572['model'],qs[_0x298f('0x39')](_0x2f2cba[_0x298f('0x35')][_0x298f('0x39')]));_0x1ec81a[_0x298f('0x38')]=_0x1ec81a[_0x298f('0x38')][_0x298f('0x3a')]?_0x1ec81a[_0x298f('0x38')]:_0x559572[_0x298f('0x33')];if(_0x2f2cba[_0x298f('0x35')][_0x298f('0x41')]){_0x1ec81a[_0x298f('0x42')]=[{'all':!![]}];}_0x1ec81a=_[_0x298f('0x3e')]({},_0x1ec81a,_0x2f2cba['options']);return db[_0x298f('0x30')][_0x298f('0x46')](_0x1ec81a)['then'](handleEntityNotFound(_0x464289,null))[_0x298f('0x28')](respondWithResult(_0x464289,null))[_0x298f('0x47')](handleError(_0x464289,null));};exports[_0x298f('0x48')]=function(_0x2e8ab4,_0x380d4e){return db[_0x298f('0x30')][_0x298f('0x48')](_0x2e8ab4[_0x298f('0x49')],{})[_0x298f('0x28')](respondWithResult(_0x380d4e,0xc9))[_0x298f('0x47')](handleError(_0x380d4e,null));};exports[_0x298f('0x26')]=function(_0x4db3ce,_0x38a4c1){if(_0x4db3ce[_0x298f('0x49')]['id']){delete _0x4db3ce[_0x298f('0x49')]['id'];}return db[_0x298f('0x30')][_0x298f('0x46')]({'where':{'id':_0x4db3ce['params']['id']}})[_0x298f('0x28')](handleEntityNotFound(_0x38a4c1,null))[_0x298f('0x28')](saveUpdates(_0x4db3ce['body'],null))[_0x298f('0x28')](respondWithResult(_0x38a4c1,null))['catch'](handleError(_0x38a4c1,null));};exports['destroy']=function(_0x471d41,_0x7ca100){return db[_0x298f('0x30')][_0x298f('0x46')]({'where':{'id':_0x471d41[_0x298f('0x45')]['id']}})[_0x298f('0x28')](handleEntityNotFound(_0x7ca100,null))[_0x298f('0x28')](removeEntity(_0x7ca100,null))[_0x298f('0x47')](handleError(_0x7ca100,null));};exports[_0x298f('0x4a')]=function(_0x43df03,_0x39abec,_0x31d418){var _0x595ed3={};var _0x3676ae={};var _0x587259;var _0x48a2eb;return db[_0x298f('0x30')][_0x298f('0x4b')]({'where':{'id':_0x43df03[_0x298f('0x45')]['id']}})[_0x298f('0x28')](handleEntityNotFound(_0x39abec,null))[_0x298f('0x28')](function(_0x556608){if(_0x556608){_0x587259=_0x556608;_0x3676ae[_0x298f('0x33')]=_['keys'](db[_0x298f('0x4c')][_0x298f('0x31')]);_0x3676ae[_0x298f('0x35')]=_[_0x298f('0x34')](_0x43df03[_0x298f('0x35')]);_0x3676ae[_0x298f('0x36')]=_['intersection'](_0x3676ae[_0x298f('0x33')],_0x3676ae[_0x298f('0x35')]);_0x595ed3[_0x298f('0x38')]=_[_0x298f('0x37')](_0x3676ae[_0x298f('0x33')],qs['fields'](_0x43df03['query'][_0x298f('0x39')]));_0x595ed3[_0x298f('0x38')]=_0x595ed3[_0x298f('0x38')][_0x298f('0x3a')]?_0x595ed3[_0x298f('0x38')]:_0x3676ae['model'];_0x595ed3[_0x298f('0x3b')]=qs['sort'](_0x43df03['query'][_0x298f('0x4d')]);_0x595ed3[_0x298f('0x3c')]=qs['filters'](_[_0x298f('0x3d')](_0x43df03[_0x298f('0x35')],_0x3676ae[_0x298f('0x36')]));if(_0x43df03['query'][_0x298f('0x4e')]){_0x595ed3[_0x298f('0x3c')]=_[_0x298f('0x3e')](_0x595ed3[_0x298f('0x3c')],{'$or':_[_0x298f('0x2f')](_0x595ed3[_0x298f('0x38')],function(_0x504b50){var _0x55cb17={};_0x55cb17[_0x504b50]={'$like':'%'+_0x43df03['query']['filter']+'%'};return _0x55cb17;})});}_0x595ed3=_[_0x298f('0x3e')]({},_0x595ed3,_0x43df03['options']);return _0x587259[_0x298f('0x4a')](_0x595ed3);}})[_0x298f('0x28')](function(_0x3b552b){if(_0x3b552b){_0x48a2eb=_0x3b552b['length'];if(!_0x43df03[_0x298f('0x35')]['hasOwnProperty'](_0x298f('0x4f'))){_0x595ed3[_0x298f('0x1f')]=qs[_0x298f('0x1f')](_0x43df03[_0x298f('0x35')][_0x298f('0x1f')]);_0x595ed3['offset']=qs[_0x298f('0x1e')](_0x43df03[_0x298f('0x35')]['offset']);}return _0x587259[_0x298f('0x4a')](_0x595ed3);}})[_0x298f('0x28')](function(_0x1f12bc){if(_0x1f12bc){return _0x1f12bc?{'count':_0x48a2eb,'rows':_0x1f12bc}:null;}})['then'](respondWithResult(_0x39abec,null))[_0x298f('0x47')](handleError(_0x39abec,null));};exports[_0x298f('0x50')]=function(_0x79aa07,_0x22a6b4,_0x2bbe77){if(_0x79aa07[_0x298f('0x49')]['id']){delete _0x79aa07['body']['id'];}return db['ServicenowAccount'][_0x298f('0x4b')]({'where':{'id':_0x79aa07[_0x298f('0x45')]['id']}})[_0x298f('0x28')](handleEntityNotFound(_0x22a6b4,null))['then'](function(_0x2055e5){if(_0x2055e5){_0x79aa07['body'][_0x298f('0x51')]=_0x2055e5['id'];_0x79aa07[_0x298f('0x49')][_0x298f('0x52')]=integrations['getSubjects'](_0x79aa07[_0x298f('0x49')][_0x298f('0x53')],_0x79aa07['body']['type']);_0x79aa07[_0x298f('0x49')]['Descriptions']=integrations[_0x298f('0x54')](_0x79aa07[_0x298f('0x49')][_0x298f('0x53')],_0x79aa07[_0x298f('0x49')][_0x298f('0x55')]);return db[_0x298f('0x4c')]['create'](_0x79aa07[_0x298f('0x49')],{'include':[{'model':db[_0x298f('0x56')],'as':_0x298f('0x52')},{'model':db[_0x298f('0x56')],'as':_0x298f('0x57')}]});}return null;})[_0x298f('0x28')](respondWithResult(_0x22a6b4,null))[_0x298f('0x47')](handleError(_0x22a6b4,null));};exports[_0x298f('0x58')]=function(_0x2d8d83,_0x36e784,_0x433751){var _0x35e72b=[_0x298f('0x59'),'hold_reason',_0x298f('0x5a'),_0x298f('0x5b'),_0x298f('0x5c'),_0x298f('0x5d'),_0x298f('0x5e'),_0x298f('0x5f'),_0x298f('0x60')];var _0x3a9f80=[_0x298f('0x61'),_0x298f('0x59'),_0x298f('0x62'),'watch_list','upon_reject','sys_updated_on',_0x298f('0x63'),_0x298f('0x64'),'approval_history',_0x298f('0x65'),_0x298f('0x66'),_0x298f('0x67'),_0x298f('0x68'),_0x298f('0x69'),_0x298f('0x6a'),_0x298f('0x6b'),_0x298f('0x6c'),'sys_created_by',_0x298f('0x5a'),_0x298f('0x3b'),'calendar_stc',_0x298f('0x6d'),_0x298f('0x6e'),'delivery_plan',_0x298f('0x6f'),'active',_0x298f('0x70'),_0x298f('0x71'),'priority',_0x298f('0x72'),_0x298f('0x73'),'time_worked','expected_start',_0x298f('0x74'),_0x298f('0x75'),'group_list',_0x298f('0x76'),_0x298f('0x77'),'resolved_at','caller_id',_0x298f('0x78'),'subcategory',_0x298f('0x79'),'short_description',_0x298f('0x5c'),_0x298f('0x7a'),'delivery_task',_0x298f('0x7b'),'assignment_group',_0x298f('0x7c'),'additional_assignee_list',_0x298f('0x7d'),_0x298f('0x7e'),_0x298f('0x5d'),_0x298f('0x7f'),_0x298f('0x80'),_0x298f('0x81'),_0x298f('0x82'),_0x298f('0x83'),_0x298f('0x84'),_0x298f('0x85'),_0x298f('0x86'),_0x298f('0x5e'),_0x298f('0x87'),_0x298f('0x88'),'company',_0x298f('0x89'),'activity_due','assigned_to',_0x298f('0x5f'),_0x298f('0x8a'),_0x298f('0x8b'),_0x298f('0x8c'),_0x298f('0x8d'),'due_date','sys_mod_count',_0x298f('0x8e'),_0x298f('0x8f'),_0x298f('0x90'),_0x298f('0x91'),'correlation_id','location',_0x298f('0x60')];var _0x1775b3='';var _0x5d9924='';var _0x3fde42=[];var _0x3192fd='';var _0x530bd7='';var _0x44f3a5=[];var _0x329f22='';var _0x53b3c6='';var _0x1976ec={};var _0x233671='';return db[_0x298f('0x30')][_0x298f('0x4b')]({'where':{'id':_0x2d8d83['params']['id']},'attributes':['id',_0x298f('0x92'),'password','email',_0x298f('0x93'),_0x298f('0x94')]})['then'](handleEntityNotFound(_0x36e784,null))['then'](function(_0x5bd625){if(_0x5bd625){_0x233671=_0x5bd625[_0x298f('0x93')];var _0x37676c=_0x233671[_0x298f('0x95')](-0x1);if(_0x37676c==='/'){_0x233671=_0x233671[_0x298f('0x96')](0x0,_0x233671[_0x298f('0x97')](_0x37676c));}_0x53b3c6=util['format']('%s/api/now/doc/table/schema/',_0x233671);_0x329f22=util['format']('%s/api/now/table/',_0x233671);_0x1976ec={'user':_0x5bd625[_0x298f('0x92')],'pass':_0x5bd625[_0x298f('0x98')]};var _0x3f2622={'method':_0x298f('0x99'),'uri':_0x53b3c6+_0x298f('0x9a'),'auth':_0x1976ec,'json':!![]};return rp(_0x3f2622);}})['then'](function(_0x51a229){if(_0x51a229[_0x298f('0x9b')][_0x298f('0x3a')]>0x0){_0x1775b3=_0x51a229[_0x298f('0x9b')];}console['log']('incident\x20table\x20objects',_0x1775b3);_0x44f3a5=[];_0x5d9924=Object[_0x298f('0x9c')]([],_0x1775b3);_['remove'](_0x5d9924,function(_0x190cb3){return!_0x35e72b[_0x298f('0x9d')](_0x190cb3[_0x298f('0x2d')]);});_0x5d9924[_0x298f('0x9e')](function(_0x4dfdd5){var _0x447bdb=createFieldObject(_0x329f22,_0x1976ec,_0x4dfdd5[_0x298f('0x9f')],_0x4dfdd5[_0x298f('0x2d')],_0x4dfdd5[_0x298f('0xa0')],![]);_0x44f3a5[_0x298f('0xa1')](_0x447bdb);});return Promise[_0x298f('0xa2')](_0x44f3a5);})[_0x298f('0x28')](function(_0x5d1dbe){_0x3fde42=_0x5d1dbe;_0x3192fd=Object['assign']([],_0x1775b3);console[_0x298f('0xa3')](_0x298f('0xa4'),_0x1775b3);_[_0x298f('0xa5')](_0x3192fd,function(_0x5766f9){return _0x3a9f80['includes'](_0x5766f9[_0x298f('0x2d')]);});console[_0x298f('0xa3')](_0x298f('0xa6'),_0x3192fd);_0x44f3a5=[];_0x3192fd[_0x298f('0x9e')](function(_0x2e85d7){var _0x5bb48d=createFieldObject(_0x329f22,_0x1976ec,_0x2e85d7[_0x298f('0x9f')],_0x2e85d7[_0x298f('0x2d')],_0x2e85d7['label'],!![]);_0x44f3a5[_0x298f('0xa1')](_0x5bb48d);});return Promise['all'](_0x44f3a5);})[_0x298f('0x28')](function(_0x28f1f5){_0x530bd7=_0x28f1f5;var _0x10980f=_0x3fde42[_0x298f('0xa7')](_0x530bd7);return{'count':_0x10980f['length'],'rows':_0x10980f};})[_0x298f('0x28')](respondWithResult(_0x36e784,null))[_0x298f('0x47')](function(_0x5948bf){console[_0x298f('0xa3')](_0x298f('0xa8')+_0x5948bf);var _0x5ab484=_0x2d8d83['query']['test']?0x1f4:_0x5948bf[_0x298f('0xa9')]||0x1f4;logger[_0x298f('0x2b')](_0x5948bf[_0x298f('0x2c')]);delete _0x5948bf['name'];if(_0x5ab484===0x191){_0x5ab484=0x190;}_0x36e784[_0x298f('0x1c')](_0x5ab484)[_0x298f('0xaa')](_0x2d8d83['query'][_0x298f('0xab')]?{'message':_0x298f('0xac'),'statusCode':_0x5948bf['statusCode']}:_0x5948bf);});};function createFieldObject(_0x1bab76,_0x4302b3,_0x44c932,_0x2bdcc2,_0xbef4e1,_0xdcf444){return new Promise(function(_0x210348,_0x91f1f4){var _0x18787b={'id':_0x2bdcc2,'name':_0xbef4e1,'custom':_0xdcf444};if(_0x44c932===_0x298f('0xad')){_0x18787b['options']=[{'name':'True','value':_0x298f('0xae')},{'name':_0x298f('0xaf'),'value':_0x298f('0xb0')}];_0x210348(_0x18787b);}else{var _0x1bd3e2={'method':'GET','uri':_0x1bab76+_0x298f('0xb1')+_0x2bdcc2,'auth':_0x4302b3,'json':!![]};return rp(_0x1bd3e2)[_0x298f('0x28')](function(_0x15abaa){var _0x63bae5=[];if(_0x15abaa['result']['length']>0x0){_0x15abaa['result'][_0x298f('0x9e')](function(_0x56e60e){if(_0x56e60e[_0x298f('0xb2')]===_0x298f('0xb0')){var _0x903b4d={'name':_0x56e60e[_0x298f('0xa0')],'value':_0x56e60e['value']};_0x63bae5[_0x298f('0xa1')](_0x903b4d);}});}_0x18787b[_0x298f('0x40')]=_0x63bae5;if(_0x18787b[_0x298f('0x40')][_0x298f('0x3a')]>0x0){_0x210348(_0x18787b);}else{if(_0xdcf444==![]){_0x210348();}else{_0x210348(_0x18787b);}}});}});} \ No newline at end of file +var _0xaa28=['subcategory','close_code','category','parent','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','sys_created_on','sys_created_by','knowledge','calendar_stc','cmdb_ci','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','caller_id','short_description','correlation_display','delivery_task','assignment_group','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','username','password','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','statusCode','stack','Wrong\x20credentials','True','true','False','false','GET','inactive','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','getConfigurations','findOne','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason'];(function(_0x58a364,_0x3439f6){var _0x409b74=function(_0xff5c15){while(--_0xff5c15){_0x58a364['push'](_0x58a364['shift']());}};_0x409b74(++_0x3439f6);}(_0xaa28,0x108));var _0x8aa2=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0xaa28[_0x5678b5];return _0x4c09a5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8aa2('0x0'));var jsonpatch=require(_0x8aa2('0x1'));var rp=require(_0x8aa2('0x2'));var moment=require('moment');var BPromise=require(_0x8aa2('0x3'));var Mustache=require('mustache');var util=require(_0x8aa2('0x4'));var path=require(_0x8aa2('0x5'));var sox=require(_0x8aa2('0x6'));var csv=require(_0x8aa2('0x7'));var ejs=require(_0x8aa2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8aa2('0x9'));var crypto=require(_0x8aa2('0xa'));var jsforce=require(_0x8aa2('0xb'));var deskjs=require(_0x8aa2('0xc'));var toCsv=require(_0x8aa2('0x7'));var querystring=require(_0x8aa2('0xd'));var Papa=require(_0x8aa2('0xe'));var Redis=require(_0x8aa2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8aa2('0x10'));var as=require(_0x8aa2('0x11'));var hardwareService=require(_0x8aa2('0x12'));var logger=require(_0x8aa2('0x13'))('api');var utils=require(_0x8aa2('0x14'));var config=require(_0x8aa2('0x15'));var licenseUtil=require(_0x8aa2('0x16'));var db=require(_0x8aa2('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x46ec0c,_0x1b98b9){_0x1b98b9=_0x1b98b9||0xcc;return function(_0x5ceb5f){if(_0x5ceb5f){return _0x46ec0c[_0x8aa2('0x18')](_0x1b98b9);}return _0x46ec0c[_0x8aa2('0x19')](_0x1b98b9)[_0x8aa2('0x1a')]();};}function respondWithResult(_0x28f9bb,_0xf43b89){_0xf43b89=_0xf43b89||0xc8;return function(_0x20da5b){if(_0x20da5b){return _0x28f9bb[_0x8aa2('0x19')](_0xf43b89)[_0x8aa2('0x1b')](_0x20da5b);}};}function respondWithFilteredResult(_0x340685,_0x252253){return function(_0x20dff9){if(_0x20dff9){var _0x2016a5=typeof _0x252253['offset']==='undefined'&&typeof _0x252253[_0x8aa2('0x1c')]===_0x8aa2('0x1d');var _0x1a8858=_0x20dff9['count'];var _0x8eefb2=_0x2016a5?0x0:_0x252253[_0x8aa2('0x1e')];var _0x2cc584=_0x2016a5?_0x20dff9[_0x8aa2('0x1f')]:_0x252253[_0x8aa2('0x1e')]+_0x252253[_0x8aa2('0x1c')];var _0x3a5c0f;if(_0x2cc584>=_0x1a8858){_0x2cc584=_0x1a8858;_0x3a5c0f=0xc8;}else{_0x3a5c0f=0xce;}_0x340685[_0x8aa2('0x19')](_0x3a5c0f);return _0x340685['set'](_0x8aa2('0x20'),_0x8eefb2+'-'+_0x2cc584+'/'+_0x1a8858)[_0x8aa2('0x1b')](_0x20dff9);}return null;};}function patchUpdates(_0x347193){return function(_0xd3d8e0){try{jsonpatch[_0x8aa2('0x21')](_0xd3d8e0,_0x347193,!![]);}catch(_0x49b436){return BPromise['reject'](_0x49b436);}return _0xd3d8e0[_0x8aa2('0x22')]();};}function saveUpdates(_0x1c8707,_0x2701e9){return function(_0x523563){if(_0x523563){return _0x523563[_0x8aa2('0x23')](_0x1c8707)[_0x8aa2('0x24')](function(_0x18db3f){return _0x18db3f;});}return null;};}function removeEntity(_0x622328,_0x2de093){return function(_0xa7db4d){if(_0xa7db4d){return _0xa7db4d[_0x8aa2('0x25')]()[_0x8aa2('0x24')](function(){_0x622328[_0x8aa2('0x19')](0xcc)[_0x8aa2('0x1a')]();});}};}function handleEntityNotFound(_0x12d69d,_0x17a92b){return function(_0xdebd9f){if(!_0xdebd9f){_0x12d69d[_0x8aa2('0x18')](0x194);}return _0xdebd9f;};}function handleError(_0x279ed0,_0x1dd9ce){_0x1dd9ce=_0x1dd9ce||0x1f4;return function(_0x3ec485){logger[_0x8aa2('0x26')](_0x3ec485['stack']);if(_0x3ec485['name']){delete _0x3ec485[_0x8aa2('0x27')];}_0x279ed0[_0x8aa2('0x19')](_0x1dd9ce)[_0x8aa2('0x28')](_0x3ec485);};}exports[_0x8aa2('0x29')]=function(_0x27840f,_0x71412){var _0x3d604d={},_0x2a6719={},_0x115f5a={'count':0x0,'rows':[]};var _0x2d2f8e=_[_0x8aa2('0x2a')](db[_0x8aa2('0x2b')][_0x8aa2('0x2c')],function(_0x2ba2fe){return{'name':_0x2ba2fe[_0x8aa2('0x2d')],'type':_0x2ba2fe[_0x8aa2('0x2e')][_0x8aa2('0x2f')]};});_0x2a6719[_0x8aa2('0x30')]=_[_0x8aa2('0x2a')](_0x2d2f8e,_0x8aa2('0x27'));_0x2a6719[_0x8aa2('0x31')]=_['keys'](_0x27840f[_0x8aa2('0x31')]);_0x2a6719[_0x8aa2('0x32')]=_[_0x8aa2('0x33')](_0x2a6719[_0x8aa2('0x30')],_0x2a6719[_0x8aa2('0x31')]);_0x3d604d[_0x8aa2('0x34')]=_[_0x8aa2('0x33')](_0x2a6719[_0x8aa2('0x30')],qs[_0x8aa2('0x35')](_0x27840f[_0x8aa2('0x31')][_0x8aa2('0x35')]));_0x3d604d[_0x8aa2('0x34')]=_0x3d604d[_0x8aa2('0x34')][_0x8aa2('0x36')]?_0x3d604d[_0x8aa2('0x34')]:_0x2a6719['model'];if(!_0x27840f[_0x8aa2('0x31')][_0x8aa2('0x37')](_0x8aa2('0x38'))){_0x3d604d[_0x8aa2('0x1c')]=qs[_0x8aa2('0x1c')](_0x27840f[_0x8aa2('0x31')][_0x8aa2('0x1c')]);_0x3d604d['offset']=qs[_0x8aa2('0x1e')](_0x27840f[_0x8aa2('0x31')][_0x8aa2('0x1e')]);}_0x3d604d[_0x8aa2('0x39')]=qs['sort'](_0x27840f[_0x8aa2('0x31')]['sort']);_0x3d604d['where']=qs[_0x8aa2('0x32')](_[_0x8aa2('0x3a')](_0x27840f[_0x8aa2('0x31')],_0x2a6719['filters']),_0x2d2f8e);if(_0x27840f['query'][_0x8aa2('0x3b')]){_0x3d604d[_0x8aa2('0x3c')]=_[_0x8aa2('0x3d')](_0x3d604d['where'],{'$or':_[_0x8aa2('0x2a')](_0x2d2f8e,function(_0x1d77b3){if(_0x1d77b3[_0x8aa2('0x2e')]!==_0x8aa2('0x3e')){var _0xf939af={};_0xf939af[_0x1d77b3[_0x8aa2('0x27')]]={'$like':'%'+_0x27840f[_0x8aa2('0x31')][_0x8aa2('0x3b')]+'%'};return _0xf939af;}})});}_0x3d604d=_[_0x8aa2('0x3d')]({},_0x3d604d,_0x27840f[_0x8aa2('0x3f')]);var _0x371340={'where':_0x3d604d[_0x8aa2('0x3c')]};return db[_0x8aa2('0x2b')][_0x8aa2('0x1f')](_0x371340)[_0x8aa2('0x24')](function(_0x369a6e){_0x115f5a[_0x8aa2('0x1f')]=_0x369a6e;if(_0x27840f[_0x8aa2('0x31')][_0x8aa2('0x40')]){_0x3d604d['include']=[{'all':!![]}];}return db[_0x8aa2('0x2b')][_0x8aa2('0x41')](_0x3d604d);})[_0x8aa2('0x24')](function(_0x49f7de){_0x115f5a[_0x8aa2('0x42')]=_0x49f7de;return _0x115f5a;})[_0x8aa2('0x24')](respondWithFilteredResult(_0x71412,_0x3d604d))[_0x8aa2('0x43')](handleError(_0x71412,null));};exports[_0x8aa2('0x44')]=function(_0x3bdd94,_0x471e17){var _0x1441a5={'raw':![],'where':{'id':_0x3bdd94[_0x8aa2('0x45')]['id']}},_0x15581b={};_0x15581b[_0x8aa2('0x30')]=_[_0x8aa2('0x46')](db[_0x8aa2('0x2b')][_0x8aa2('0x2c')]);_0x15581b[_0x8aa2('0x31')]=_[_0x8aa2('0x46')](_0x3bdd94[_0x8aa2('0x31')]);_0x15581b[_0x8aa2('0x32')]=_[_0x8aa2('0x33')](_0x15581b[_0x8aa2('0x30')],_0x15581b[_0x8aa2('0x31')]);_0x1441a5['attributes']=_[_0x8aa2('0x33')](_0x15581b[_0x8aa2('0x30')],qs[_0x8aa2('0x35')](_0x3bdd94[_0x8aa2('0x31')][_0x8aa2('0x35')]));_0x1441a5[_0x8aa2('0x34')]=_0x1441a5[_0x8aa2('0x34')][_0x8aa2('0x36')]?_0x1441a5[_0x8aa2('0x34')]:_0x15581b[_0x8aa2('0x30')];if(_0x3bdd94[_0x8aa2('0x31')][_0x8aa2('0x40')]){_0x1441a5[_0x8aa2('0x47')]=[{'all':!![]}];}_0x1441a5=_[_0x8aa2('0x3d')]({},_0x1441a5,_0x3bdd94[_0x8aa2('0x3f')]);return db['ServicenowAccount']['find'](_0x1441a5)[_0x8aa2('0x24')](handleEntityNotFound(_0x471e17,null))['then'](respondWithResult(_0x471e17,null))['catch'](handleError(_0x471e17,null));};exports[_0x8aa2('0x48')]=function(_0x235b88,_0xde2cbf){return db[_0x8aa2('0x2b')]['create'](_0x235b88[_0x8aa2('0x49')],{})[_0x8aa2('0x24')](respondWithResult(_0xde2cbf,0xc9))[_0x8aa2('0x43')](handleError(_0xde2cbf,null));};exports[_0x8aa2('0x23')]=function(_0x3819ee,_0x4aa160){if(_0x3819ee[_0x8aa2('0x49')]['id']){delete _0x3819ee[_0x8aa2('0x49')]['id'];}return db[_0x8aa2('0x2b')][_0x8aa2('0x4a')]({'where':{'id':_0x3819ee[_0x8aa2('0x45')]['id']}})[_0x8aa2('0x24')](handleEntityNotFound(_0x4aa160,null))['then'](saveUpdates(_0x3819ee[_0x8aa2('0x49')],null))[_0x8aa2('0x24')](respondWithResult(_0x4aa160,null))[_0x8aa2('0x43')](handleError(_0x4aa160,null));};exports[_0x8aa2('0x25')]=function(_0x3ce0fa,_0x52dd7b){return db[_0x8aa2('0x2b')][_0x8aa2('0x4a')]({'where':{'id':_0x3ce0fa[_0x8aa2('0x45')]['id']}})['then'](handleEntityNotFound(_0x52dd7b,null))['then'](removeEntity(_0x52dd7b,null))['catch'](handleError(_0x52dd7b,null));};exports[_0x8aa2('0x4b')]=function(_0x53c4ed,_0x418e09,_0x20584a){var _0x7fef58={};var _0x4c3d6c={};var _0x5691ab;var _0x5d534e;return db['ServicenowAccount'][_0x8aa2('0x4c')]({'where':{'id':_0x53c4ed[_0x8aa2('0x45')]['id']}})[_0x8aa2('0x24')](handleEntityNotFound(_0x418e09,null))[_0x8aa2('0x24')](function(_0xbc5abe){if(_0xbc5abe){_0x5691ab=_0xbc5abe;_0x4c3d6c['model']=_['keys'](db['ServicenowConfiguration'][_0x8aa2('0x2c')]);_0x4c3d6c[_0x8aa2('0x31')]=_[_0x8aa2('0x46')](_0x53c4ed['query']);_0x4c3d6c['filters']=_['intersection'](_0x4c3d6c[_0x8aa2('0x30')],_0x4c3d6c['query']);_0x7fef58[_0x8aa2('0x34')]=_[_0x8aa2('0x33')](_0x4c3d6c[_0x8aa2('0x30')],qs[_0x8aa2('0x35')](_0x53c4ed[_0x8aa2('0x31')][_0x8aa2('0x35')]));_0x7fef58['attributes']=_0x7fef58[_0x8aa2('0x34')][_0x8aa2('0x36')]?_0x7fef58[_0x8aa2('0x34')]:_0x4c3d6c[_0x8aa2('0x30')];_0x7fef58[_0x8aa2('0x39')]=qs[_0x8aa2('0x4d')](_0x53c4ed[_0x8aa2('0x31')][_0x8aa2('0x4d')]);_0x7fef58[_0x8aa2('0x3c')]=qs['filters'](_[_0x8aa2('0x3a')](_0x53c4ed['query'],_0x4c3d6c['filters']));if(_0x53c4ed['query'][_0x8aa2('0x3b')]){_0x7fef58[_0x8aa2('0x3c')]=_[_0x8aa2('0x3d')](_0x7fef58['where'],{'$or':_[_0x8aa2('0x2a')](_0x7fef58[_0x8aa2('0x34')],function(_0x133e03){var _0x14c542={};_0x14c542[_0x133e03]={'$like':'%'+_0x53c4ed['query'][_0x8aa2('0x3b')]+'%'};return _0x14c542;})});}_0x7fef58=_['merge']({},_0x7fef58,_0x53c4ed['options']);return _0x5691ab[_0x8aa2('0x4b')](_0x7fef58);}})['then'](function(_0x5070c1){if(_0x5070c1){_0x5d534e=_0x5070c1[_0x8aa2('0x36')];if(!_0x53c4ed[_0x8aa2('0x31')][_0x8aa2('0x37')](_0x8aa2('0x38'))){_0x7fef58[_0x8aa2('0x1c')]=qs[_0x8aa2('0x1c')](_0x53c4ed[_0x8aa2('0x31')][_0x8aa2('0x1c')]);_0x7fef58[_0x8aa2('0x1e')]=qs[_0x8aa2('0x1e')](_0x53c4ed[_0x8aa2('0x31')][_0x8aa2('0x1e')]);}return _0x5691ab['getConfigurations'](_0x7fef58);}})['then'](function(_0x3e4e07){if(_0x3e4e07){return _0x3e4e07?{'count':_0x5d534e,'rows':_0x3e4e07}:null;}})[_0x8aa2('0x24')](respondWithResult(_0x418e09,null))['catch'](handleError(_0x418e09,null));};exports[_0x8aa2('0x4e')]=function(_0x1cebd9,_0x1c3713,_0x154d30){if(_0x1cebd9[_0x8aa2('0x49')]['id']){delete _0x1cebd9[_0x8aa2('0x49')]['id'];}return db[_0x8aa2('0x2b')][_0x8aa2('0x4c')]({'where':{'id':_0x1cebd9[_0x8aa2('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c3713,null))[_0x8aa2('0x24')](function(_0x3de752){if(_0x3de752){_0x1cebd9[_0x8aa2('0x49')][_0x8aa2('0x4f')]=_0x3de752['id'];_0x1cebd9['body'][_0x8aa2('0x50')]=integrations[_0x8aa2('0x51')](_0x1cebd9['body'][_0x8aa2('0x52')],_0x1cebd9[_0x8aa2('0x49')][_0x8aa2('0x2e')]);_0x1cebd9[_0x8aa2('0x49')][_0x8aa2('0x53')]=integrations[_0x8aa2('0x54')](_0x1cebd9[_0x8aa2('0x49')][_0x8aa2('0x52')],_0x1cebd9[_0x8aa2('0x49')]['type']);return db[_0x8aa2('0x55')][_0x8aa2('0x48')](_0x1cebd9[_0x8aa2('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0x8aa2('0x50')},{'model':db[_0x8aa2('0x56')],'as':_0x8aa2('0x53')}]});}return null;})[_0x8aa2('0x24')](respondWithResult(_0x1c3713,null))[_0x8aa2('0x43')](handleError(_0x1c3713,null));};exports[_0x8aa2('0x57')]=function(_0x140904,_0x5136bd,_0x312a17){var _0x2bffb0=[_0x8aa2('0x58'),_0x8aa2('0x59'),'knowledge',_0x8aa2('0x5a'),_0x8aa2('0x5b'),'notify','incident_state','severity',_0x8aa2('0x5c')];var _0x193555=[_0x8aa2('0x5d'),_0x8aa2('0x58'),'caused_by',_0x8aa2('0x5e'),'upon_reject',_0x8aa2('0x5f'),_0x8aa2('0x60'),_0x8aa2('0x59'),_0x8aa2('0x61'),_0x8aa2('0x62'),_0x8aa2('0x63'),'sys_updated_by',_0x8aa2('0x64'),'user_input',_0x8aa2('0x65'),'sys_domain','state',_0x8aa2('0x66'),_0x8aa2('0x67'),_0x8aa2('0x39'),_0x8aa2('0x68'),'closed_at',_0x8aa2('0x69'),'delivery_plan','impact','active',_0x8aa2('0x6a'),_0x8aa2('0x6b'),'priority',_0x8aa2('0x6c'),_0x8aa2('0x6d'),_0x8aa2('0x6e'),_0x8aa2('0x6f'),'opened_at',_0x8aa2('0x70'),_0x8aa2('0x71'),'work_end','reopened_time','resolved_at',_0x8aa2('0x72'),'approval_set',_0x8aa2('0x5a'),'work_notes',_0x8aa2('0x73'),'close_code',_0x8aa2('0x74'),_0x8aa2('0x75'),'work_start',_0x8aa2('0x76'),'business_stc',_0x8aa2('0x77'),'description',_0x8aa2('0x78'),_0x8aa2('0x79'),_0x8aa2('0x7a'),_0x8aa2('0x7b'),_0x8aa2('0x7c'),_0x8aa2('0x7d'),_0x8aa2('0x7e'),_0x8aa2('0x7f'),_0x8aa2('0x80'),_0x8aa2('0x81'),'incident_state',_0x8aa2('0x82'),_0x8aa2('0x83'),_0x8aa2('0x84'),_0x8aa2('0x85'),_0x8aa2('0x86'),_0x8aa2('0x87'),'severity',_0x8aa2('0x88'),_0x8aa2('0x89'),'approval','comments_and_work_notes',_0x8aa2('0x8a'),_0x8aa2('0x8b'),_0x8aa2('0x8c'),_0x8aa2('0x8d'),_0x8aa2('0x8e'),_0x8aa2('0x8f'),'correlation_id','location',_0x8aa2('0x5c')];var _0xc3969e='';var _0x4266b6='';var _0x33e5c5=[];var _0xc910d2='';var _0x48d63a='';var _0x479270=[];var _0x5e93ec='';var _0x2d4a8f='';var _0x30ea40={};var _0x303dcb='';return db[_0x8aa2('0x2b')][_0x8aa2('0x4c')]({'where':{'id':_0x140904[_0x8aa2('0x45')]['id']},'attributes':['id',_0x8aa2('0x90'),_0x8aa2('0x91'),'email','remoteUri',_0x8aa2('0x92')]})[_0x8aa2('0x24')](handleEntityNotFound(_0x5136bd,null))[_0x8aa2('0x24')](function(_0x261ffd){if(_0x261ffd){_0x303dcb=_0x261ffd['remoteUri'];var _0x158be1=_0x303dcb[_0x8aa2('0x93')](-0x1);if(_0x158be1==='/'){_0x303dcb=_0x303dcb[_0x8aa2('0x94')](0x0,_0x303dcb[_0x8aa2('0x95')](_0x158be1));}_0x2d4a8f=util[_0x8aa2('0x96')](_0x8aa2('0x97'),_0x303dcb);_0x5e93ec=util['format'](_0x8aa2('0x98'),_0x303dcb);_0x30ea40={'user':_0x261ffd[_0x8aa2('0x90')],'pass':_0x261ffd[_0x8aa2('0x91')]};var _0x3bbf38={'method':'GET','uri':_0x2d4a8f+_0x8aa2('0x99'),'auth':_0x30ea40,'json':!![]};return rp(_0x3bbf38);}})[_0x8aa2('0x24')](function(_0x1169fc){if(_0x1169fc[_0x8aa2('0x9a')][_0x8aa2('0x36')]>0x0){_0xc3969e=_0x1169fc[_0x8aa2('0x9a')];}console[_0x8aa2('0x9b')](_0x8aa2('0x9c'),_0xc3969e);_0x479270=[];_0x4266b6=Object[_0x8aa2('0x9d')]([],_0xc3969e);_[_0x8aa2('0x9e')](_0x4266b6,function(_0x178308){return!_0x2bffb0[_0x8aa2('0x9f')](_0x178308['name']);});_0x4266b6[_0x8aa2('0xa0')](function(_0x15e8f5){var _0x176b73=createFieldObject(_0x5e93ec,_0x30ea40,_0x15e8f5[_0x8aa2('0xa1')],_0x15e8f5[_0x8aa2('0x27')],_0x15e8f5[_0x8aa2('0xa2')],![]);_0x479270[_0x8aa2('0xa3')](_0x176b73);});return Promise[_0x8aa2('0xa4')](_0x479270);})[_0x8aa2('0x24')](function(_0x52cdf2){_0x33e5c5=_0x52cdf2;_0xc910d2=Object[_0x8aa2('0x9d')]([],_0xc3969e);console['log'](_0x8aa2('0xa5'),_0xc3969e);_[_0x8aa2('0x9e')](_0xc910d2,function(_0x346781){return _0x193555[_0x8aa2('0x9f')](_0x346781[_0x8aa2('0x27')]);});console[_0x8aa2('0x9b')](_0x8aa2('0xa6'),_0xc910d2);_0x479270=[];_0xc910d2['forEach'](function(_0x4258dd){var _0x46d494=createFieldObject(_0x5e93ec,_0x30ea40,_0x4258dd[_0x8aa2('0xa1')],_0x4258dd[_0x8aa2('0x27')],_0x4258dd[_0x8aa2('0xa2')],!![]);_0x479270['push'](_0x46d494);});return Promise[_0x8aa2('0xa4')](_0x479270);})['then'](function(_0x2f856d){_0x48d63a=_0x2f856d;var _0x2b3c58=_0x33e5c5['concat'](_0x48d63a);return{'count':_0x2b3c58[_0x8aa2('0x36')],'rows':_0x2b3c58};})[_0x8aa2('0x24')](respondWithResult(_0x5136bd,null))[_0x8aa2('0x43')](function(_0x4eb583){console['log']('ServiceNow\x20error:\x20'+_0x4eb583);var _0x4bb5f0=_0x140904[_0x8aa2('0x31')][_0x8aa2('0xa7')]?0x1f4:_0x4eb583[_0x8aa2('0xa8')]||0x1f4;logger['error'](_0x4eb583[_0x8aa2('0xa9')]);delete _0x4eb583[_0x8aa2('0x27')];if(_0x4bb5f0===0x191){_0x4bb5f0=0x190;}_0x5136bd['status'](_0x4bb5f0)['send'](_0x140904[_0x8aa2('0x31')][_0x8aa2('0xa7')]?{'message':_0x8aa2('0xaa'),'statusCode':_0x4eb583[_0x8aa2('0xa8')]}:_0x4eb583);});};function createFieldObject(_0x30d7a6,_0x510fef,_0x2d0c28,_0x113802,_0x5346df,_0x417ee3){return new Promise(function(_0x38b993,_0xbe785f){var _0x24344c={'id':_0x113802,'name':_0x5346df,'custom':_0x417ee3};if(_0x2d0c28==='boolean'){_0x24344c[_0x8aa2('0x3f')]=[{'name':_0x8aa2('0xab'),'value':_0x8aa2('0xac')},{'name':_0x8aa2('0xad'),'value':_0x8aa2('0xae')}];_0x38b993(_0x24344c);}else{var _0x273910={'method':_0x8aa2('0xaf'),'uri':_0x30d7a6+'sys_choice?sysparm_query=name=incident^element='+_0x113802,'auth':_0x510fef,'json':!![]};return rp(_0x273910)['then'](function(_0x4508de){var _0x48defa=[];if(_0x4508de[_0x8aa2('0x9a')][_0x8aa2('0x36')]>0x0){_0x4508de[_0x8aa2('0x9a')][_0x8aa2('0xa0')](function(_0x32d68b){if(_0x32d68b[_0x8aa2('0xb0')]===_0x8aa2('0xae')){var _0x575aae={'name':_0x32d68b[_0x8aa2('0xa2')],'value':_0x32d68b['value']};_0x48defa[_0x8aa2('0xa3')](_0x575aae);}});}_0x24344c[_0x8aa2('0x3f')]=_0x48defa;if(_0x24344c[_0x8aa2('0x3f')][_0x8aa2('0x36')]>0x0){_0x38b993(_0x24344c);}else{if(_0x417ee3==![]){_0x38b993();}else{_0x38b993(_0x24344c);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9ab1b01..76cac96 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','../../config/logger','api'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0x7fbe[_0x3f3f06];return _0x140feb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));var integrations=require(_0xe7fb('0x9'));module[_0xe7fb('0xa')]=function(_0x12d1b0,_0x24cd67){return _0x12d1b0[_0xe7fb('0xb')]('ServicenowAccount',attributes,{'tableName':_0xe7fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xfcf0,0x138));var _0x0fcf=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xfcf0[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));var integrations=require(_0x0fcf('0x9'));module[_0x0fcf('0xa')]=function(_0x1a7b03,_0x61bbb9){return _0x1a7b03[_0x0fcf('0xb')]('ServicenowAccount',attributes,{'tableName':_0x0fcf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 1d17aa9..de43d1c 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 _0x1c5d=['error','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','options','raw','where','attributes','limit','include','map','model','then','catch','ShowServicenowAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x5a6c35,_0x115202){var _0x2ad02d=function(_0x424481){while(--_0x424481){_0x5a6c35['push'](_0x5a6c35['shift']());}};_0x2ad02d(++_0x115202);}(_0x1c5d,0xd7));var _0xd1c5=function(_0x4b9f8c,_0x29ee48){_0x4b9f8c=_0x4b9f8c-0x0;var _0x3fb25d=_0x1c5d[_0x4b9f8c];return _0x3fb25d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd1c5('0x0'));var BPromise=require(_0xd1c5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1c5('0x2'));var db=require(_0xd1c5('0x3'))['db'];var utils=require(_0xd1c5('0x4'));var logger=require(_0xd1c5('0x5'))(_0xd1c5('0x6'));var config=require('../../config/environment');var jayson=require(_0xd1c5('0x7'));var client=jayson[_0xd1c5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d5e8,_0x719482,_0x33f32a){return new BPromise(function(_0x47a2c6,_0x25db80){return client[_0xd1c5('0x9')](_0x40d5e8,_0x33f32a)['then'](function(_0xf848ee){logger[_0xd1c5('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x719482,'request\x20sent');logger[_0xd1c5('0xb')](_0xd1c5('0xc'),_0x719482,_0xd1c5('0xd'),JSON[_0xd1c5('0xe')](_0xf848ee));if(_0xf848ee['error']){if(_0xf848ee['error'][_0xd1c5('0xf')]===0x1f4){logger[_0xd1c5('0x10')](_0xd1c5('0x11'),_0x719482,_0xf848ee[_0xd1c5('0x10')][_0xd1c5('0x12')]);return _0x25db80(_0xf848ee[_0xd1c5('0x10')][_0xd1c5('0x12')]);}logger[_0xd1c5('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x719482,_0xf848ee[_0xd1c5('0x10')][_0xd1c5('0x12')]);return _0x47a2c6(_0xf848ee['error'][_0xd1c5('0x12')]);}else{logger[_0xd1c5('0xa')](_0xd1c5('0x11'),_0x719482,_0xd1c5('0xd'));_0x47a2c6(_0xf848ee[_0xd1c5('0x13')]['message']);}})['catch'](function(_0x1badc2){logger['error'](_0xd1c5('0x11'),_0x719482,_0x1badc2);_0x25db80(_0x1badc2);});});}exports[_0xd1c5('0x14')]=function(_0x2273d0){var _0x26610a=this;return new Promise(function(_0x49048c,_0x250f86){return db['ServicenowAccount']['findAll']({'raw':_0x2273d0['options']?_0x2273d0[_0xd1c5('0x15')][_0xd1c5('0x16')]===undefined?!![]:![]:!![],'where':_0x2273d0[_0xd1c5('0x15')]?_0x2273d0[_0xd1c5('0x15')][_0xd1c5('0x17')]||null:null,'attributes':_0x2273d0[_0xd1c5('0x15')]?_0x2273d0[_0xd1c5('0x15')][_0xd1c5('0x18')]||null:null,'limit':_0x2273d0[_0xd1c5('0x15')]?_0x2273d0[_0xd1c5('0x15')][_0xd1c5('0x19')]||null:null,'include':_0x2273d0[_0xd1c5('0x15')]?_0x2273d0[_0xd1c5('0x15')]['include']?_['map'](_0x2273d0['options'][_0xd1c5('0x1a')],function(_0x2755c4){return{'model':db[_0x2755c4['model']],'as':_0x2755c4['as'],'attributes':_0x2755c4['attributes'],'include':_0x2755c4[_0xd1c5('0x1a')]?_[_0xd1c5('0x1b')](_0x2755c4[_0xd1c5('0x1a')],function(_0x447896){return{'model':db[_0x447896[_0xd1c5('0x1c')]],'as':_0x447896['as'],'attributes':_0x447896[_0xd1c5('0x18')],'include':_0x447896[_0xd1c5('0x1a')]?_[_0xd1c5('0x1b')](_0x447896[_0xd1c5('0x1a')],function(_0x2b86c3){return{'model':db[_0x2b86c3[_0xd1c5('0x1c')]],'as':_0x2b86c3['as'],'attributes':_0x2b86c3['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1c5('0x1d')](function(_0x3b2f81){logger[_0xd1c5('0xa')]('GetServicenowAccount',_0x2273d0);logger[_0xd1c5('0xb')](_0xd1c5('0x14'),_0x2273d0,JSON['stringify'](_0x3b2f81));_0x49048c(_0x3b2f81);})[_0xd1c5('0x1e')](function(_0x5eadf7){logger[_0xd1c5('0x10')]('GetServicenowAccount',_0x5eadf7[_0xd1c5('0x12')],_0x2273d0);_0x250f86(_0x26610a['error'](0x1f4,_0x5eadf7['message']));});});};exports[_0xd1c5('0x1f')]=function(_0xd1473b){var _0x5697cb=this;return new Promise(function(_0x123bad,_0x25a70c){return db['ServicenowAccount'][_0xd1c5('0x20')]({'raw':_0xd1473b[_0xd1c5('0x15')]?_0xd1473b[_0xd1c5('0x15')][_0xd1c5('0x16')]===undefined?!![]:![]:!![],'where':_0xd1473b[_0xd1c5('0x15')]?_0xd1473b['options'][_0xd1c5('0x17')]||null:null,'attributes':_0xd1473b['options']?_0xd1473b[_0xd1c5('0x15')][_0xd1c5('0x18')]||null:null,'include':_0xd1473b[_0xd1c5('0x15')]?_0xd1473b[_0xd1c5('0x15')]['include']?_['map'](_0xd1473b[_0xd1c5('0x15')][_0xd1c5('0x1a')],function(_0x2ddb57){return{'model':db[_0x2ddb57[_0xd1c5('0x1c')]],'as':_0x2ddb57['as'],'attributes':_0x2ddb57[_0xd1c5('0x18')],'include':_0x2ddb57[_0xd1c5('0x1a')]?_[_0xd1c5('0x1b')](_0x2ddb57[_0xd1c5('0x1a')],function(_0x646604){return{'model':db[_0x646604[_0xd1c5('0x1c')]],'as':_0x646604['as'],'attributes':_0x646604[_0xd1c5('0x18')],'include':_0x646604['include']?_[_0xd1c5('0x1b')](_0x646604['include'],function(_0x5880be){return{'model':db[_0x5880be['model']],'as':_0x5880be['as'],'attributes':_0x5880be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d0824){logger[_0xd1c5('0xa')](_0xd1c5('0x1f'),_0xd1473b);logger[_0xd1c5('0xb')](_0xd1c5('0x1f'),_0xd1473b,JSON[_0xd1c5('0xe')](_0x4d0824));_0x123bad(_0x4d0824);})[_0xd1c5('0x1e')](function(_0x23afd2){logger[_0xd1c5('0x10')]('ShowServicenowAccount',_0x23afd2['message'],_0xd1473b);_0x25a70c(_0x5697cb[_0xd1c5('0x10')](0x1f4,_0x23afd2[_0xd1c5('0x12')]));});});}; \ No newline at end of file +var _0x1df4=['error','code','message','info','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowServicenowAccount','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5ce2e3,_0x3dc503){var _0x3b53ab=function(_0x1efe66){while(--_0x1efe66){_0x5ce2e3['push'](_0x5ce2e3['shift']());}};_0x3b53ab(++_0x3dc503);}(_0x1df4,0xa2));var _0x41df=function(_0x553ad9,_0x48ec4b){_0x553ad9=_0x553ad9-0x0;var _0x10bdd1=_0x1df4[_0x553ad9];return _0x10bdd1;};'use strict';var _=require(_0x41df('0x0'));var util=require(_0x41df('0x1'));var moment=require(_0x41df('0x2'));var BPromise=require('bluebird');var rs=require(_0x41df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x41df('0x4'));var logger=require(_0x41df('0x5'))(_0x41df('0x6'));var config=require(_0x41df('0x7'));var jayson=require(_0x41df('0x8'));var client=jayson[_0x41df('0x9')][_0x41df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1106a9,_0x131a6d,_0x10ea40){return new BPromise(function(_0xeadcd,_0x3f144d){return client[_0x41df('0xb')](_0x1106a9,_0x10ea40)[_0x41df('0xc')](function(_0x3feec8){logger['info'](_0x41df('0xd'),_0x131a6d,_0x41df('0xe'));logger[_0x41df('0xf')](_0x41df('0x10'),_0x131a6d,_0x41df('0xe'),JSON[_0x41df('0x11')](_0x3feec8));if(_0x3feec8[_0x41df('0x12')]){if(_0x3feec8[_0x41df('0x12')][_0x41df('0x13')]===0x1f4){logger[_0x41df('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x131a6d,_0x3feec8[_0x41df('0x12')][_0x41df('0x14')]);return _0x3f144d(_0x3feec8[_0x41df('0x12')][_0x41df('0x14')]);}logger['error'](_0x41df('0xd'),_0x131a6d,_0x3feec8['error'][_0x41df('0x14')]);return _0xeadcd(_0x3feec8[_0x41df('0x12')][_0x41df('0x14')]);}else{logger[_0x41df('0x15')]('ServicenowAccount,\x20%s,\x20%s',_0x131a6d,_0x41df('0xe'));_0xeadcd(_0x3feec8['result'][_0x41df('0x14')]);}})[_0x41df('0x16')](function(_0x5756fe){logger[_0x41df('0x12')](_0x41df('0xd'),_0x131a6d,_0x5756fe);_0x3f144d(_0x5756fe);});});}exports[_0x41df('0x17')]=function(_0x1fc2ab){var _0x252541=this;return new Promise(function(_0xe071b2,_0x22a159){return db[_0x41df('0x18')][_0x41df('0x19')]({'raw':_0x1fc2ab[_0x41df('0x1a')]?_0x1fc2ab[_0x41df('0x1a')][_0x41df('0x1b')]===undefined?!![]:![]:!![],'where':_0x1fc2ab['options']?_0x1fc2ab[_0x41df('0x1a')][_0x41df('0x1c')]||null:null,'attributes':_0x1fc2ab[_0x41df('0x1a')]?_0x1fc2ab['options']['attributes']||null:null,'limit':_0x1fc2ab['options']?_0x1fc2ab['options'][_0x41df('0x1d')]||null:null,'include':_0x1fc2ab[_0x41df('0x1a')]?_0x1fc2ab[_0x41df('0x1a')][_0x41df('0x1e')]?_[_0x41df('0x1f')](_0x1fc2ab[_0x41df('0x1a')][_0x41df('0x1e')],function(_0x2d6d17){return{'model':db[_0x2d6d17[_0x41df('0x20')]],'as':_0x2d6d17['as'],'attributes':_0x2d6d17['attributes'],'include':_0x2d6d17['include']?_['map'](_0x2d6d17[_0x41df('0x1e')],function(_0x5c0c59){return{'model':db[_0x5c0c59[_0x41df('0x20')]],'as':_0x5c0c59['as'],'attributes':_0x5c0c59[_0x41df('0x21')],'include':_0x5c0c59[_0x41df('0x1e')]?_[_0x41df('0x1f')](_0x5c0c59[_0x41df('0x1e')],function(_0x9dee33){return{'model':db[_0x9dee33[_0x41df('0x20')]],'as':_0x9dee33['as'],'attributes':_0x9dee33[_0x41df('0x21')]};}):[]};}):[]};}):[]:[]})[_0x41df('0xc')](function(_0x202954){logger[_0x41df('0x15')](_0x41df('0x17'),_0x1fc2ab);logger[_0x41df('0xf')](_0x41df('0x17'),_0x1fc2ab,JSON[_0x41df('0x11')](_0x202954));_0xe071b2(_0x202954);})['catch'](function(_0x3f0987){logger[_0x41df('0x12')](_0x41df('0x17'),_0x3f0987[_0x41df('0x14')],_0x1fc2ab);_0x22a159(_0x252541[_0x41df('0x12')](0x1f4,_0x3f0987[_0x41df('0x14')]));});});};exports[_0x41df('0x22')]=function(_0x20828a){var _0x5be1ea=this;return new Promise(function(_0xd17dfb,_0x41ea16){return db[_0x41df('0x18')][_0x41df('0x23')]({'raw':_0x20828a['options']?_0x20828a[_0x41df('0x1a')][_0x41df('0x1b')]===undefined?!![]:![]:!![],'where':_0x20828a[_0x41df('0x1a')]?_0x20828a['options'][_0x41df('0x1c')]||null:null,'attributes':_0x20828a[_0x41df('0x1a')]?_0x20828a[_0x41df('0x1a')]['attributes']||null:null,'include':_0x20828a['options']?_0x20828a['options']['include']?_[_0x41df('0x1f')](_0x20828a[_0x41df('0x1a')][_0x41df('0x1e')],function(_0x5dde34){return{'model':db[_0x5dde34[_0x41df('0x20')]],'as':_0x5dde34['as'],'attributes':_0x5dde34[_0x41df('0x21')],'include':_0x5dde34[_0x41df('0x1e')]?_['map'](_0x5dde34['include'],function(_0x25fceb){return{'model':db[_0x25fceb[_0x41df('0x20')]],'as':_0x25fceb['as'],'attributes':_0x25fceb[_0x41df('0x21')],'include':_0x25fceb['include']?_[_0x41df('0x1f')](_0x25fceb[_0x41df('0x1e')],function(_0x2540e9){return{'model':db[_0x2540e9[_0x41df('0x20')]],'as':_0x2540e9['as'],'attributes':_0x2540e9[_0x41df('0x21')]};}):[]};}):[]};}):[]:[]})[_0x41df('0xc')](function(_0xe41071){logger[_0x41df('0x15')](_0x41df('0x22'),_0x20828a);logger[_0x41df('0xf')](_0x41df('0x22'),_0x20828a,JSON['stringify'](_0xe41071));_0xd17dfb(_0xe41071);})[_0x41df('0x16')](function(_0x4e756f){logger[_0x41df('0x12')](_0x41df('0x22'),_0x4e756f[_0x41df('0x14')],_0x20828a);_0x41ea16(_0x5be1ea[_0x41df('0x12')](0x1f4,_0x4e756f[_0x41df('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e7522ac..a3e5eb9 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 _0x03c8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x50536f,_0x20685b){var _0x52f229=function(_0x16c0be){while(--_0x16c0be){_0x50536f['push'](_0x50536f['shift']());}};_0x52f229(++_0x20685b);}(_0x03c8,0x177));var _0x803c=function(_0x34a243,_0x24489f){_0x34a243=_0x34a243-0x0;var _0x21ce4e=_0x03c8[_0x34a243];return _0x21ce4e;};'use strict';var multer=require(_0x803c('0x0'));var util=require(_0x803c('0x1'));var path=require(_0x803c('0x2'));var timeout=require(_0x803c('0x3'));var express=require(_0x803c('0x4'));var router=express[_0x803c('0x5')]();var fs_extra=require(_0x803c('0x6'));var auth=require(_0x803c('0x7'));var interaction=require(_0x803c('0x8'));var config=require(_0x803c('0x9'));var controller=require(_0x803c('0xa'));router[_0x803c('0xb')]('/',auth[_0x803c('0xc')](),controller[_0x803c('0xd')]);router['get'](_0x803c('0xe'),auth[_0x803c('0xc')](),controller['show']);router[_0x803c('0xb')](_0x803c('0xf'),auth[_0x803c('0xc')](),controller[_0x803c('0x10')]);router[_0x803c('0xb')](_0x803c('0x11'),auth[_0x803c('0xc')](),controller[_0x803c('0x12')]);router['get'](_0x803c('0x13'),auth['isAuthenticated'](),controller[_0x803c('0x14')]);router[_0x803c('0x15')]('/',auth[_0x803c('0xc')](),controller[_0x803c('0x16')]);router[_0x803c('0x17')]('/:id',auth[_0x803c('0xc')](),controller[_0x803c('0x18')]);router[_0x803c('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x803c('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x78fc=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields'];(function(_0x5a511a,_0xb86431){var _0x178711=function(_0xb46f66){while(--_0xb46f66){_0x5a511a['push'](_0x5a511a['shift']());}};_0x178711(++_0xb86431);}(_0x78fc,0x1e4));var _0xc78f=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x78fc[_0x3e44fa];return _0x2a0aba;};'use strict';var multer=require(_0xc78f('0x0'));var util=require(_0xc78f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc78f('0x2'));var router=express[_0xc78f('0x3')]();var fs_extra=require(_0xc78f('0x4'));var auth=require(_0xc78f('0x5'));var interaction=require(_0xc78f('0x6'));var config=require(_0xc78f('0x7'));var controller=require(_0xc78f('0x8'));router['get']('/',auth[_0xc78f('0x9')](),controller[_0xc78f('0xa')]);router['get'](_0xc78f('0xb'),auth[_0xc78f('0x9')](),controller[_0xc78f('0xc')]);router[_0xc78f('0xd')](_0xc78f('0xe'),auth[_0xc78f('0x9')](),controller[_0xc78f('0xf')]);router['get'](_0xc78f('0x10'),auth[_0xc78f('0x9')](),controller[_0xc78f('0x11')]);router[_0xc78f('0xd')](_0xc78f('0x12'),auth['isAuthenticated'](),controller[_0xc78f('0x13')]);router[_0xc78f('0x14')]('/',auth[_0xc78f('0x9')](),controller[_0xc78f('0x15')]);router['put'](_0xc78f('0xb'),auth[_0xc78f('0x9')](),controller['update']);router[_0xc78f('0x16')](_0xc78f('0xb'),auth[_0xc78f('0x9')](),controller[_0xc78f('0x17')]);module[_0xc78f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 912c782..d56972c 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 _0x769f=['STRING','sequelize','exports'];(function(_0x49e0b8,_0x3954a1){var _0x2c869c=function(_0x4ec95b){while(--_0x4ec95b){_0x49e0b8['push'](_0x49e0b8['shift']());}};_0x2c869c(++_0x3954a1);}(_0x769f,0x9a));var _0xf769=function(_0x3718c0,_0x373595){_0x3718c0=_0x3718c0-0x0;var _0x1adae7=_0x769f[_0x3718c0];return _0x1adae7;};'use strict';var Sequelize=require(_0xf769('0x0'));module[_0xf769('0x1')]={'name':{'type':Sequelize[_0xf769('0x2')]},'description':{'type':Sequelize[_0xf769('0x2')]}}; \ No newline at end of file +var _0x4e1e=['exports','STRING'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x4e1e,0xbe));var _0xe4e1=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x4e1e[_0x5cc3d4];return _0x17ca31;};'use strict';var Sequelize=require('sequelize');module[_0xe4e1('0x0')]={'name':{'type':Sequelize[_0xe4e1('0x1')]},'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 0c7e33c..b932916 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 _0xa8b1=['include','findAll','rows','catch','show','length','find','create','body','params','findOne','ServicenowField','getFields','getSubjects','nolimit','getDescriptions','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ServicenowConfiguration'];(function(_0x297380,_0x133458){var _0x4fd815=function(_0x39b515){while(--_0x39b515){_0x297380['push'](_0x297380['shift']());}};_0x4fd815(++_0x133458);}(_0xa8b1,0x140));var _0x1a8b=function(_0x32a4e9,_0x34e0e9){_0x32a4e9=_0x32a4e9-0x0;var _0x4f9347=_0xa8b1[_0x32a4e9];return _0x4f9347;};'use strict';var emlformat=require(_0x1a8b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1a8b('0x1'));var rp=require('request-promise');var moment=require(_0x1a8b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1a8b('0x3'));var util=require(_0x1a8b('0x4'));var path=require(_0x1a8b('0x5'));var sox=require(_0x1a8b('0x6'));var csv=require(_0x1a8b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a8b('0x8'));var _=require('lodash');var squel=require(_0x1a8b('0x9'));var crypto=require(_0x1a8b('0xa'));var jsforce=require(_0x1a8b('0xb'));var deskjs=require(_0x1a8b('0xc'));var toCsv=require(_0x1a8b('0x7'));var querystring=require(_0x1a8b('0xd'));var Papa=require('papaparse');var Redis=require(_0x1a8b('0xe'));var authService=require(_0x1a8b('0xf'));var qs=require(_0x1a8b('0x10'));var as=require(_0x1a8b('0x11'));var hardwareService=require(_0x1a8b('0x12'));var logger=require('../../config/logger')(_0x1a8b('0x13'));var utils=require(_0x1a8b('0x14'));var config=require(_0x1a8b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52aa27,_0xba6cf9){_0xba6cf9=_0xba6cf9||0xcc;return function(_0x338701){if(_0x338701){return _0x52aa27[_0x1a8b('0x16')](_0xba6cf9);}return _0x52aa27[_0x1a8b('0x17')](_0xba6cf9)[_0x1a8b('0x18')]();};}function respondWithResult(_0xfd8639,_0xa8327e){_0xa8327e=_0xa8327e||0xc8;return function(_0x18000d){if(_0x18000d){return _0xfd8639[_0x1a8b('0x17')](_0xa8327e)[_0x1a8b('0x19')](_0x18000d);}};}function respondWithFilteredResult(_0x1fe76f,_0x439e00){return function(_0x3006f3){if(_0x3006f3){var _0xec00b8=typeof _0x439e00[_0x1a8b('0x1a')]==='undefined'&&typeof _0x439e00['limit']===_0x1a8b('0x1b');var _0x26c57b=_0x3006f3['count'];var _0xd2d74e=_0xec00b8?0x0:_0x439e00['offset'];var _0x384952=_0xec00b8?_0x3006f3[_0x1a8b('0x1c')]:_0x439e00[_0x1a8b('0x1a')]+_0x439e00[_0x1a8b('0x1d')];var _0x398462;if(_0x384952>=_0x26c57b){_0x384952=_0x26c57b;_0x398462=0xc8;}else{_0x398462=0xce;}_0x1fe76f[_0x1a8b('0x17')](_0x398462);return _0x1fe76f['set']('Content-Range',_0xd2d74e+'-'+_0x384952+'/'+_0x26c57b)[_0x1a8b('0x19')](_0x3006f3);}return null;};}function patchUpdates(_0x42d08c){return function(_0x17b8e0){try{jsonpatch[_0x1a8b('0x1e')](_0x17b8e0,_0x42d08c,!![]);}catch(_0x59f76e){return BPromise[_0x1a8b('0x1f')](_0x59f76e);}return _0x17b8e0[_0x1a8b('0x20')]();};}function saveUpdates(_0x340df7,_0x73e997){return function(_0x3df2dc){if(_0x3df2dc){return _0x3df2dc[_0x1a8b('0x21')](_0x340df7)[_0x1a8b('0x22')](function(_0x598dd2){return _0x598dd2;});}return null;};}function removeEntity(_0x3bce7c,_0x341a58){return function(_0x29b9a9){if(_0x29b9a9){return _0x29b9a9[_0x1a8b('0x23')]()[_0x1a8b('0x22')](function(){_0x3bce7c[_0x1a8b('0x17')](0xcc)[_0x1a8b('0x18')]();});}};}function handleEntityNotFound(_0x17bc12,_0xb56a52){return function(_0x3db9dc){if(!_0x3db9dc){_0x17bc12[_0x1a8b('0x16')](0x194);}return _0x3db9dc;};}function handleError(_0x12defa,_0x528074){_0x528074=_0x528074||0x1f4;return function(_0x1eed1a){logger['error'](_0x1eed1a[_0x1a8b('0x24')]);if(_0x1eed1a[_0x1a8b('0x25')]){delete _0x1eed1a[_0x1a8b('0x25')];}_0x12defa[_0x1a8b('0x17')](_0x528074)['send'](_0x1eed1a);};}exports[_0x1a8b('0x26')]=function(_0x25ab01,_0x405503){var _0x2d97b3={},_0x2173cf={},_0x36a77f={'count':0x0,'rows':[]};var _0x35046d=_[_0x1a8b('0x27')](db['ServicenowConfiguration'][_0x1a8b('0x28')],function(_0x3afe39){return{'name':_0x3afe39['fieldName'],'type':_0x3afe39[_0x1a8b('0x29')][_0x1a8b('0x2a')]};});_0x2173cf[_0x1a8b('0x2b')]=_[_0x1a8b('0x27')](_0x35046d,_0x1a8b('0x25'));_0x2173cf[_0x1a8b('0x2c')]=_[_0x1a8b('0x2d')](_0x25ab01[_0x1a8b('0x2c')]);_0x2173cf['filters']=_['intersection'](_0x2173cf[_0x1a8b('0x2b')],_0x2173cf['query']);_0x2d97b3[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x2173cf[_0x1a8b('0x2b')],qs[_0x1a8b('0x30')](_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x30')]));_0x2d97b3[_0x1a8b('0x2e')]=_0x2d97b3[_0x1a8b('0x2e')]['length']?_0x2d97b3['attributes']:_0x2173cf[_0x1a8b('0x2b')];if(!_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x31')]('nolimit')){_0x2d97b3[_0x1a8b('0x1d')]=qs[_0x1a8b('0x1d')](_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x1d')]);_0x2d97b3['offset']=qs[_0x1a8b('0x1a')](_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x1a')]);}_0x2d97b3[_0x1a8b('0x32')]=qs[_0x1a8b('0x33')](_0x25ab01[_0x1a8b('0x2c')]['sort']);_0x2d97b3[_0x1a8b('0x34')]=qs[_0x1a8b('0x35')](_[_0x1a8b('0x36')](_0x25ab01[_0x1a8b('0x2c')],_0x2173cf[_0x1a8b('0x35')]),_0x35046d);if(_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x37')]){_0x2d97b3[_0x1a8b('0x34')]=_['merge'](_0x2d97b3[_0x1a8b('0x34')],{'$or':_[_0x1a8b('0x27')](_0x35046d,function(_0x528f13){if(_0x528f13[_0x1a8b('0x29')]!==_0x1a8b('0x38')){var _0x363c86={};_0x363c86[_0x528f13[_0x1a8b('0x25')]]={'$like':'%'+_0x25ab01['query'][_0x1a8b('0x37')]+'%'};return _0x363c86;}})});}_0x2d97b3=_[_0x1a8b('0x39')]({},_0x2d97b3,_0x25ab01[_0x1a8b('0x3a')]);var _0x3c86e2={'where':_0x2d97b3[_0x1a8b('0x34')]};return db[_0x1a8b('0x3b')][_0x1a8b('0x1c')](_0x3c86e2)[_0x1a8b('0x22')](function(_0x5ac5b2){_0x36a77f[_0x1a8b('0x1c')]=_0x5ac5b2;if(_0x25ab01['query']['includeAll']){_0x2d97b3[_0x1a8b('0x3c')]=[{'all':!![]}];}return db[_0x1a8b('0x3b')][_0x1a8b('0x3d')](_0x2d97b3);})[_0x1a8b('0x22')](function(_0x2af47f){_0x36a77f[_0x1a8b('0x3e')]=_0x2af47f;return _0x36a77f;})[_0x1a8b('0x22')](respondWithFilteredResult(_0x405503,_0x2d97b3))[_0x1a8b('0x3f')](handleError(_0x405503,null));};exports[_0x1a8b('0x40')]=function(_0x9e53f5,_0x287383){var _0x29aa96={'raw':![],'where':{'id':_0x9e53f5['params']['id']}},_0x5d4ae5={};_0x5d4ae5[_0x1a8b('0x2b')]=_[_0x1a8b('0x2d')](db[_0x1a8b('0x3b')][_0x1a8b('0x28')]);_0x5d4ae5[_0x1a8b('0x2c')]=_['keys'](_0x9e53f5[_0x1a8b('0x2c')]);_0x5d4ae5['filters']=_[_0x1a8b('0x2f')](_0x5d4ae5[_0x1a8b('0x2b')],_0x5d4ae5[_0x1a8b('0x2c')]);_0x29aa96[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x5d4ae5[_0x1a8b('0x2b')],qs[_0x1a8b('0x30')](_0x9e53f5[_0x1a8b('0x2c')][_0x1a8b('0x30')]));_0x29aa96[_0x1a8b('0x2e')]=_0x29aa96[_0x1a8b('0x2e')][_0x1a8b('0x41')]?_0x29aa96[_0x1a8b('0x2e')]:_0x5d4ae5[_0x1a8b('0x2b')];if(_0x9e53f5[_0x1a8b('0x2c')]['includeAll']){_0x29aa96['include']=[{'all':!![]}];}_0x29aa96=_[_0x1a8b('0x39')]({},_0x29aa96,_0x9e53f5['options']);return db[_0x1a8b('0x3b')][_0x1a8b('0x42')](_0x29aa96)[_0x1a8b('0x22')](handleEntityNotFound(_0x287383,null))[_0x1a8b('0x22')](respondWithResult(_0x287383,null))[_0x1a8b('0x3f')](handleError(_0x287383,null));};exports[_0x1a8b('0x43')]=function(_0x4831dc,_0x14f755){return db[_0x1a8b('0x3b')][_0x1a8b('0x43')](_0x4831dc[_0x1a8b('0x44')],{})[_0x1a8b('0x22')](respondWithResult(_0x14f755,0xc9))['catch'](handleError(_0x14f755,null));};exports[_0x1a8b('0x21')]=function(_0x4547f1,_0x21bc35){if(_0x4547f1[_0x1a8b('0x44')]['id']){delete _0x4547f1[_0x1a8b('0x44')]['id'];}return db[_0x1a8b('0x3b')][_0x1a8b('0x42')]({'where':{'id':_0x4547f1['params']['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x21bc35,null))[_0x1a8b('0x22')](saveUpdates(_0x4547f1['body'],null))[_0x1a8b('0x22')](respondWithResult(_0x21bc35,null))[_0x1a8b('0x3f')](handleError(_0x21bc35,null));};exports[_0x1a8b('0x23')]=function(_0x55e048,_0x634d9b){return db[_0x1a8b('0x3b')][_0x1a8b('0x42')]({'where':{'id':_0x55e048[_0x1a8b('0x45')]['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x634d9b,null))[_0x1a8b('0x22')](removeEntity(_0x634d9b,null))['catch'](handleError(_0x634d9b,null));};exports['getFields']=function(_0x566ce0,_0x59a6b7,_0xff34d4){var _0x45c33f={};var _0x3ba57d={};var _0x212aa0;var _0x2aa3fd;return db[_0x1a8b('0x3b')][_0x1a8b('0x46')]({'where':{'id':_0x566ce0[_0x1a8b('0x45')]['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x59a6b7,null))[_0x1a8b('0x22')](function(_0x14c127){if(_0x14c127){_0x212aa0=_0x14c127;_0x3ba57d['model']=_[_0x1a8b('0x2d')](db[_0x1a8b('0x47')][_0x1a8b('0x28')]);_0x3ba57d['query']=_[_0x1a8b('0x2d')](_0x566ce0['query']);_0x3ba57d[_0x1a8b('0x35')]=_[_0x1a8b('0x2f')](_0x3ba57d[_0x1a8b('0x2b')],_0x3ba57d[_0x1a8b('0x2c')]);_0x45c33f[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x3ba57d[_0x1a8b('0x2b')],qs[_0x1a8b('0x30')](_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x30')]));_0x45c33f['attributes']=_0x45c33f[_0x1a8b('0x2e')][_0x1a8b('0x41')]?_0x45c33f[_0x1a8b('0x2e')]:_0x3ba57d[_0x1a8b('0x2b')];_0x45c33f[_0x1a8b('0x32')]=qs[_0x1a8b('0x33')](_0x566ce0['query'][_0x1a8b('0x33')]);_0x45c33f[_0x1a8b('0x34')]=qs[_0x1a8b('0x35')](_[_0x1a8b('0x36')](_0x566ce0[_0x1a8b('0x2c')],_0x3ba57d[_0x1a8b('0x35')]));if(_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x37')]){_0x45c33f[_0x1a8b('0x34')]=_['merge'](_0x45c33f[_0x1a8b('0x34')],{'$or':_[_0x1a8b('0x27')](_0x45c33f[_0x1a8b('0x2e')],function(_0x18646c){var _0x2ada46={};_0x2ada46[_0x18646c]={'$like':'%'+_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x37')]+'%'};return _0x2ada46;})});}_0x45c33f=_[_0x1a8b('0x39')]({},_0x45c33f,_0x566ce0[_0x1a8b('0x3a')]);return _0x212aa0[_0x1a8b('0x48')](_0x45c33f);}})[_0x1a8b('0x22')](function(_0x3b5c41){if(_0x3b5c41){_0x2aa3fd=_0x3b5c41[_0x1a8b('0x41')];if(!_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x31')]('nolimit')){_0x45c33f[_0x1a8b('0x1d')]=qs[_0x1a8b('0x1d')](_0x566ce0['query'][_0x1a8b('0x1d')]);_0x45c33f[_0x1a8b('0x1a')]=qs[_0x1a8b('0x1a')](_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x1a')]);}return _0x212aa0[_0x1a8b('0x48')](_0x45c33f);}})[_0x1a8b('0x22')](function(_0x1616f4){if(_0x1616f4){return _0x1616f4?{'count':_0x2aa3fd,'rows':_0x1616f4}:null;}})[_0x1a8b('0x22')](respondWithResult(_0x59a6b7,null))[_0x1a8b('0x3f')](handleError(_0x59a6b7,null));};exports[_0x1a8b('0x49')]=function(_0x423a25,_0x1674f1,_0x6e73c4){var _0x829a11={};var _0x4a8b6f={};var _0x516d24;var _0x311a8c;return db[_0x1a8b('0x3b')][_0x1a8b('0x46')]({'where':{'id':_0x423a25[_0x1a8b('0x45')]['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x1674f1,null))['then'](function(_0x56bb5c){if(_0x56bb5c){_0x516d24=_0x56bb5c;_0x4a8b6f['model']=_[_0x1a8b('0x2d')](db[_0x1a8b('0x47')][_0x1a8b('0x28')]);_0x4a8b6f[_0x1a8b('0x2c')]=_[_0x1a8b('0x2d')](_0x423a25['query']);_0x4a8b6f[_0x1a8b('0x35')]=_[_0x1a8b('0x2f')](_0x4a8b6f[_0x1a8b('0x2b')],_0x4a8b6f[_0x1a8b('0x2c')]);_0x829a11[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x4a8b6f[_0x1a8b('0x2b')],qs['fields'](_0x423a25['query'][_0x1a8b('0x30')]));_0x829a11['attributes']=_0x829a11[_0x1a8b('0x2e')][_0x1a8b('0x41')]?_0x829a11[_0x1a8b('0x2e')]:_0x4a8b6f[_0x1a8b('0x2b')];_0x829a11['order']=qs[_0x1a8b('0x33')](_0x423a25[_0x1a8b('0x2c')]['sort']);_0x829a11[_0x1a8b('0x34')]=qs['filters'](_[_0x1a8b('0x36')](_0x423a25[_0x1a8b('0x2c')],_0x4a8b6f[_0x1a8b('0x35')]));if(_0x423a25['query'][_0x1a8b('0x37')]){_0x829a11[_0x1a8b('0x34')]=_[_0x1a8b('0x39')](_0x829a11[_0x1a8b('0x34')],{'$or':_[_0x1a8b('0x27')](_0x829a11[_0x1a8b('0x2e')],function(_0x36a824){var _0x248fce={};_0x248fce[_0x36a824]={'$like':'%'+_0x423a25[_0x1a8b('0x2c')][_0x1a8b('0x37')]+'%'};return _0x248fce;})});}_0x829a11=_[_0x1a8b('0x39')]({},_0x829a11,_0x423a25['options']);return _0x516d24[_0x1a8b('0x49')](_0x829a11);}})['then'](function(_0x128a12){if(_0x128a12){_0x311a8c=_0x128a12['length'];if(!_0x423a25[_0x1a8b('0x2c')]['hasOwnProperty'](_0x1a8b('0x4a'))){_0x829a11[_0x1a8b('0x1d')]=qs[_0x1a8b('0x1d')](_0x423a25[_0x1a8b('0x2c')][_0x1a8b('0x1d')]);_0x829a11['offset']=qs[_0x1a8b('0x1a')](_0x423a25[_0x1a8b('0x2c')][_0x1a8b('0x1a')]);}return _0x516d24[_0x1a8b('0x49')](_0x829a11);}})[_0x1a8b('0x22')](function(_0x120253){if(_0x120253){return _0x120253?{'count':_0x311a8c,'rows':_0x120253}:null;}})[_0x1a8b('0x22')](respondWithResult(_0x1674f1,null))[_0x1a8b('0x3f')](handleError(_0x1674f1,null));};exports[_0x1a8b('0x4b')]=function(_0x129f59,_0x46a2f8,_0x504678){var _0x210a66={};var _0x5417b={};var _0x4dc7c6;var _0x2c0a95;return db[_0x1a8b('0x3b')][_0x1a8b('0x46')]({'where':{'id':_0x129f59[_0x1a8b('0x45')]['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x46a2f8,null))['then'](function(_0xcdd414){if(_0xcdd414){_0x4dc7c6=_0xcdd414;_0x5417b['model']=_[_0x1a8b('0x2d')](db['ServicenowField'][_0x1a8b('0x28')]);_0x5417b[_0x1a8b('0x2c')]=_[_0x1a8b('0x2d')](_0x129f59[_0x1a8b('0x2c')]);_0x5417b[_0x1a8b('0x35')]=_['intersection'](_0x5417b['model'],_0x5417b[_0x1a8b('0x2c')]);_0x210a66[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x5417b[_0x1a8b('0x2b')],qs['fields'](_0x129f59[_0x1a8b('0x2c')]['fields']));_0x210a66['attributes']=_0x210a66[_0x1a8b('0x2e')][_0x1a8b('0x41')]?_0x210a66[_0x1a8b('0x2e')]:_0x5417b[_0x1a8b('0x2b')];_0x210a66[_0x1a8b('0x32')]=qs[_0x1a8b('0x33')](_0x129f59[_0x1a8b('0x2c')][_0x1a8b('0x33')]);_0x210a66[_0x1a8b('0x34')]=qs[_0x1a8b('0x35')](_[_0x1a8b('0x36')](_0x129f59[_0x1a8b('0x2c')],_0x5417b[_0x1a8b('0x35')]));if(_0x129f59[_0x1a8b('0x2c')][_0x1a8b('0x37')]){_0x210a66[_0x1a8b('0x34')]=_['merge'](_0x210a66[_0x1a8b('0x34')],{'$or':_[_0x1a8b('0x27')](_0x210a66[_0x1a8b('0x2e')],function(_0x5602de){var _0xce3211={};_0xce3211[_0x5602de]={'$like':'%'+_0x129f59['query'][_0x1a8b('0x37')]+'%'};return _0xce3211;})});}_0x210a66=_[_0x1a8b('0x39')]({},_0x210a66,_0x129f59[_0x1a8b('0x3a')]);return _0x4dc7c6['getDescriptions'](_0x210a66);}})['then'](function(_0x5c2557){if(_0x5c2557){_0x2c0a95=_0x5c2557[_0x1a8b('0x41')];if(!_0x129f59[_0x1a8b('0x2c')][_0x1a8b('0x31')]('nolimit')){_0x210a66['limit']=qs[_0x1a8b('0x1d')](_0x129f59['query'][_0x1a8b('0x1d')]);_0x210a66[_0x1a8b('0x1a')]=qs[_0x1a8b('0x1a')](_0x129f59[_0x1a8b('0x2c')]['offset']);}return _0x4dc7c6[_0x1a8b('0x4b')](_0x210a66);}})[_0x1a8b('0x22')](function(_0x1742e8){if(_0x1742e8){return _0x1742e8?{'count':_0x2c0a95,'rows':_0x1742e8}:null;}})[_0x1a8b('0x22')](respondWithResult(_0x46a2f8,null))['catch'](handleError(_0x46a2f8,null));}; \ No newline at end of file +var _0x27d4=['getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','name','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','then','includeAll','include','rows','catch','params','length','find','create','body','destroy','getFields','findOne','ServicenowField','filter','hasOwnProperty'];(function(_0x3cd468,_0x4bae1e){var _0x3f0f4a=function(_0xecdb30){while(--_0xecdb30){_0x3cd468['push'](_0x3cd468['shift']());}};_0x3f0f4a(++_0x4bae1e);}(_0x27d4,0x12e));var _0x427d=function(_0x12dfa1,_0x36ff32){_0x12dfa1=_0x12dfa1-0x0;var _0x5db581=_0x27d4[_0x12dfa1];return _0x5db581;};'use strict';var emlformat=require(_0x427d('0x0'));var rimraf=require(_0x427d('0x1'));var zipdir=require(_0x427d('0x2'));var jsonpatch=require(_0x427d('0x3'));var rp=require(_0x427d('0x4'));var moment=require('moment');var BPromise=require(_0x427d('0x5'));var Mustache=require(_0x427d('0x6'));var util=require(_0x427d('0x7'));var path=require(_0x427d('0x8'));var sox=require(_0x427d('0x9'));var csv=require('to-csv');var ejs=require(_0x427d('0xa'));var fs=require('fs');var fs_extra=require(_0x427d('0xb'));var _=require(_0x427d('0xc'));var squel=require('squel');var crypto=require(_0x427d('0xd'));var jsforce=require(_0x427d('0xe'));var deskjs=require(_0x427d('0xf'));var toCsv=require(_0x427d('0x10'));var querystring=require('querystring');var Papa=require(_0x427d('0x11'));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(_0x427d('0x12'))(_0x427d('0x13'));var utils=require(_0x427d('0x14'));var config=require(_0x427d('0x15'));var licenseUtil=require(_0x427d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f1175,_0x594b7e){_0x594b7e=_0x594b7e||0xcc;return function(_0x5dc64a){if(_0x5dc64a){return _0x1f1175[_0x427d('0x17')](_0x594b7e);}return _0x1f1175[_0x427d('0x18')](_0x594b7e)[_0x427d('0x19')]();};}function respondWithResult(_0x58a2b6,_0x1a19da){_0x1a19da=_0x1a19da||0xc8;return function(_0x4740f0){if(_0x4740f0){return _0x58a2b6[_0x427d('0x18')](_0x1a19da)[_0x427d('0x1a')](_0x4740f0);}};}function respondWithFilteredResult(_0x80f44b,_0x551a80){return function(_0x1a7971){if(_0x1a7971){var _0x2e9458=typeof _0x551a80[_0x427d('0x1b')]===_0x427d('0x1c')&&typeof _0x551a80[_0x427d('0x1d')]===_0x427d('0x1c');var _0x30089b=_0x1a7971[_0x427d('0x1e')];var _0x453b43=_0x2e9458?0x0:_0x551a80[_0x427d('0x1b')];var _0x21dec8=_0x2e9458?_0x1a7971[_0x427d('0x1e')]:_0x551a80['offset']+_0x551a80['limit'];var _0x240e54;if(_0x21dec8>=_0x30089b){_0x21dec8=_0x30089b;_0x240e54=0xc8;}else{_0x240e54=0xce;}_0x80f44b[_0x427d('0x18')](_0x240e54);return _0x80f44b[_0x427d('0x1f')]('Content-Range',_0x453b43+'-'+_0x21dec8+'/'+_0x30089b)[_0x427d('0x1a')](_0x1a7971);}return null;};}function patchUpdates(_0x361503){return function(_0x28a713){try{jsonpatch['apply'](_0x28a713,_0x361503,!![]);}catch(_0x4d05de){return BPromise[_0x427d('0x20')](_0x4d05de);}return _0x28a713[_0x427d('0x21')]();};}function saveUpdates(_0x133cfb,_0x576343){return function(_0x9f9e1f){if(_0x9f9e1f){return _0x9f9e1f[_0x427d('0x22')](_0x133cfb)['then'](function(_0x2684f4){return _0x2684f4;});}return null;};}function removeEntity(_0x34e876,_0x4a7ef4){return function(_0x4098dd){if(_0x4098dd){return _0x4098dd['destroy']()['then'](function(){_0x34e876[_0x427d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3195b4,_0xdc924c){return function(_0x144b1){if(!_0x144b1){_0x3195b4[_0x427d('0x17')](0x194);}return _0x144b1;};}function handleError(_0x145cc2,_0x4d1a15){_0x4d1a15=_0x4d1a15||0x1f4;return function(_0x2341c6){logger['error'](_0x2341c6['stack']);if(_0x2341c6[_0x427d('0x23')]){delete _0x2341c6[_0x427d('0x23')];}_0x145cc2[_0x427d('0x18')](_0x4d1a15)['send'](_0x2341c6);};}exports[_0x427d('0x24')]=function(_0x5343dc,_0x27144d){var _0xab59cb={},_0x10f6c4={},_0x20abdf={'count':0x0,'rows':[]};var _0x520a22=_[_0x427d('0x25')](db[_0x427d('0x26')][_0x427d('0x27')],function(_0xd7e291){return{'name':_0xd7e291['fieldName'],'type':_0xd7e291[_0x427d('0x28')][_0x427d('0x29')]};});_0x10f6c4[_0x427d('0x2a')]=_[_0x427d('0x25')](_0x520a22,_0x427d('0x23'));_0x10f6c4[_0x427d('0x2b')]=_[_0x427d('0x2c')](_0x5343dc[_0x427d('0x2b')]);_0x10f6c4[_0x427d('0x2d')]=_[_0x427d('0x2e')](_0x10f6c4[_0x427d('0x2a')],_0x10f6c4['query']);_0xab59cb[_0x427d('0x2f')]=_[_0x427d('0x2e')](_0x10f6c4[_0x427d('0x2a')],qs[_0x427d('0x30')](_0x5343dc[_0x427d('0x2b')][_0x427d('0x30')]));_0xab59cb[_0x427d('0x2f')]=_0xab59cb[_0x427d('0x2f')]['length']?_0xab59cb[_0x427d('0x2f')]:_0x10f6c4[_0x427d('0x2a')];if(!_0x5343dc[_0x427d('0x2b')]['hasOwnProperty'](_0x427d('0x31'))){_0xab59cb[_0x427d('0x1d')]=qs[_0x427d('0x1d')](_0x5343dc[_0x427d('0x2b')][_0x427d('0x1d')]);_0xab59cb[_0x427d('0x1b')]=qs['offset'](_0x5343dc[_0x427d('0x2b')][_0x427d('0x1b')]);}_0xab59cb[_0x427d('0x32')]=qs[_0x427d('0x33')](_0x5343dc[_0x427d('0x2b')][_0x427d('0x33')]);_0xab59cb[_0x427d('0x34')]=qs[_0x427d('0x2d')](_[_0x427d('0x35')](_0x5343dc[_0x427d('0x2b')],_0x10f6c4[_0x427d('0x2d')]),_0x520a22);if(_0x5343dc[_0x427d('0x2b')]['filter']){_0xab59cb[_0x427d('0x34')]=_[_0x427d('0x36')](_0xab59cb[_0x427d('0x34')],{'$or':_[_0x427d('0x25')](_0x520a22,function(_0x2ec259){if(_0x2ec259[_0x427d('0x28')]!==_0x427d('0x37')){var _0x57df27={};_0x57df27[_0x2ec259[_0x427d('0x23')]]={'$like':'%'+_0x5343dc[_0x427d('0x2b')]['filter']+'%'};return _0x57df27;}})});}_0xab59cb=_[_0x427d('0x36')]({},_0xab59cb,_0x5343dc[_0x427d('0x38')]);var _0x161cdc={'where':_0xab59cb[_0x427d('0x34')]};return db[_0x427d('0x26')][_0x427d('0x1e')](_0x161cdc)[_0x427d('0x39')](function(_0x25a063){_0x20abdf[_0x427d('0x1e')]=_0x25a063;if(_0x5343dc[_0x427d('0x2b')][_0x427d('0x3a')]){_0xab59cb[_0x427d('0x3b')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0xab59cb);})[_0x427d('0x39')](function(_0x112c48){_0x20abdf[_0x427d('0x3c')]=_0x112c48;return _0x20abdf;})[_0x427d('0x39')](respondWithFilteredResult(_0x27144d,_0xab59cb))[_0x427d('0x3d')](handleError(_0x27144d,null));};exports['show']=function(_0x3aabfe,_0x49c9f6){var _0x4446f3={'raw':![],'where':{'id':_0x3aabfe[_0x427d('0x3e')]['id']}},_0x1a21f3={};_0x1a21f3[_0x427d('0x2a')]=_[_0x427d('0x2c')](db[_0x427d('0x26')][_0x427d('0x27')]);_0x1a21f3[_0x427d('0x2b')]=_[_0x427d('0x2c')](_0x3aabfe[_0x427d('0x2b')]);_0x1a21f3[_0x427d('0x2d')]=_[_0x427d('0x2e')](_0x1a21f3[_0x427d('0x2a')],_0x1a21f3[_0x427d('0x2b')]);_0x4446f3['attributes']=_[_0x427d('0x2e')](_0x1a21f3['model'],qs[_0x427d('0x30')](_0x3aabfe['query'][_0x427d('0x30')]));_0x4446f3[_0x427d('0x2f')]=_0x4446f3[_0x427d('0x2f')][_0x427d('0x3f')]?_0x4446f3[_0x427d('0x2f')]:_0x1a21f3[_0x427d('0x2a')];if(_0x3aabfe['query'][_0x427d('0x3a')]){_0x4446f3[_0x427d('0x3b')]=[{'all':!![]}];}_0x4446f3=_[_0x427d('0x36')]({},_0x4446f3,_0x3aabfe[_0x427d('0x38')]);return db['ServicenowConfiguration'][_0x427d('0x40')](_0x4446f3)[_0x427d('0x39')](handleEntityNotFound(_0x49c9f6,null))[_0x427d('0x39')](respondWithResult(_0x49c9f6,null))[_0x427d('0x3d')](handleError(_0x49c9f6,null));};exports[_0x427d('0x41')]=function(_0x640192,_0x2af4ad){return db['ServicenowConfiguration']['create'](_0x640192[_0x427d('0x42')],{})[_0x427d('0x39')](respondWithResult(_0x2af4ad,0xc9))['catch'](handleError(_0x2af4ad,null));};exports[_0x427d('0x22')]=function(_0x39137d,_0x2a3578){if(_0x39137d['body']['id']){delete _0x39137d[_0x427d('0x42')]['id'];}return db[_0x427d('0x26')][_0x427d('0x40')]({'where':{'id':_0x39137d[_0x427d('0x3e')]['id']}})[_0x427d('0x39')](handleEntityNotFound(_0x2a3578,null))[_0x427d('0x39')](saveUpdates(_0x39137d['body'],null))['then'](respondWithResult(_0x2a3578,null))[_0x427d('0x3d')](handleError(_0x2a3578,null));};exports[_0x427d('0x43')]=function(_0x22d9f3,_0x54df11){return db[_0x427d('0x26')]['find']({'where':{'id':_0x22d9f3['params']['id']}})['then'](handleEntityNotFound(_0x54df11,null))[_0x427d('0x39')](removeEntity(_0x54df11,null))[_0x427d('0x3d')](handleError(_0x54df11,null));};exports[_0x427d('0x44')]=function(_0x139506,_0x552926,_0x39479c){var _0x1be510={};var _0xb3703e={};var _0x34f38b;var _0x5bd5d2;return db[_0x427d('0x26')][_0x427d('0x45')]({'where':{'id':_0x139506['params']['id']}})['then'](handleEntityNotFound(_0x552926,null))[_0x427d('0x39')](function(_0x357618){if(_0x357618){_0x34f38b=_0x357618;_0xb3703e[_0x427d('0x2a')]=_[_0x427d('0x2c')](db[_0x427d('0x46')]['rawAttributes']);_0xb3703e['query']=_['keys'](_0x139506[_0x427d('0x2b')]);_0xb3703e[_0x427d('0x2d')]=_['intersection'](_0xb3703e[_0x427d('0x2a')],_0xb3703e[_0x427d('0x2b')]);_0x1be510[_0x427d('0x2f')]=_['intersection'](_0xb3703e[_0x427d('0x2a')],qs['fields'](_0x139506['query'][_0x427d('0x30')]));_0x1be510[_0x427d('0x2f')]=_0x1be510[_0x427d('0x2f')][_0x427d('0x3f')]?_0x1be510['attributes']:_0xb3703e[_0x427d('0x2a')];_0x1be510[_0x427d('0x32')]=qs[_0x427d('0x33')](_0x139506[_0x427d('0x2b')][_0x427d('0x33')]);_0x1be510[_0x427d('0x34')]=qs['filters'](_[_0x427d('0x35')](_0x139506[_0x427d('0x2b')],_0xb3703e[_0x427d('0x2d')]));if(_0x139506[_0x427d('0x2b')]['filter']){_0x1be510[_0x427d('0x34')]=_['merge'](_0x1be510[_0x427d('0x34')],{'$or':_[_0x427d('0x25')](_0x1be510['attributes'],function(_0x206cee){var _0x31fc60={};_0x31fc60[_0x206cee]={'$like':'%'+_0x139506[_0x427d('0x2b')][_0x427d('0x47')]+'%'};return _0x31fc60;})});}_0x1be510=_[_0x427d('0x36')]({},_0x1be510,_0x139506[_0x427d('0x38')]);return _0x34f38b[_0x427d('0x44')](_0x1be510);}})[_0x427d('0x39')](function(_0x86657e){if(_0x86657e){_0x5bd5d2=_0x86657e[_0x427d('0x3f')];if(!_0x139506[_0x427d('0x2b')][_0x427d('0x48')](_0x427d('0x31'))){_0x1be510[_0x427d('0x1d')]=qs[_0x427d('0x1d')](_0x139506['query'][_0x427d('0x1d')]);_0x1be510['offset']=qs[_0x427d('0x1b')](_0x139506['query']['offset']);}return _0x34f38b[_0x427d('0x44')](_0x1be510);}})[_0x427d('0x39')](function(_0x960f45){if(_0x960f45){return _0x960f45?{'count':_0x5bd5d2,'rows':_0x960f45}:null;}})['then'](respondWithResult(_0x552926,null))[_0x427d('0x3d')](handleError(_0x552926,null));};exports[_0x427d('0x49')]=function(_0x2e962d,_0x1968c2,_0x334106){var _0x3df32e={};var _0x3082d1={};var _0x3c1811;var _0xf7dcee;return db[_0x427d('0x26')][_0x427d('0x45')]({'where':{'id':_0x2e962d[_0x427d('0x3e')]['id']}})[_0x427d('0x39')](handleEntityNotFound(_0x1968c2,null))['then'](function(_0x1555da){if(_0x1555da){_0x3c1811=_0x1555da;_0x3082d1[_0x427d('0x2a')]=_[_0x427d('0x2c')](db[_0x427d('0x46')]['rawAttributes']);_0x3082d1[_0x427d('0x2b')]=_[_0x427d('0x2c')](_0x2e962d[_0x427d('0x2b')]);_0x3082d1['filters']=_['intersection'](_0x3082d1[_0x427d('0x2a')],_0x3082d1['query']);_0x3df32e['attributes']=_['intersection'](_0x3082d1['model'],qs[_0x427d('0x30')](_0x2e962d[_0x427d('0x2b')][_0x427d('0x30')]));_0x3df32e[_0x427d('0x2f')]=_0x3df32e[_0x427d('0x2f')][_0x427d('0x3f')]?_0x3df32e[_0x427d('0x2f')]:_0x3082d1[_0x427d('0x2a')];_0x3df32e[_0x427d('0x32')]=qs[_0x427d('0x33')](_0x2e962d[_0x427d('0x2b')][_0x427d('0x33')]);_0x3df32e[_0x427d('0x34')]=qs[_0x427d('0x2d')](_[_0x427d('0x35')](_0x2e962d[_0x427d('0x2b')],_0x3082d1[_0x427d('0x2d')]));if(_0x2e962d['query']['filter']){_0x3df32e[_0x427d('0x34')]=_['merge'](_0x3df32e[_0x427d('0x34')],{'$or':_[_0x427d('0x25')](_0x3df32e[_0x427d('0x2f')],function(_0x2c51ca){var _0x418b78={};_0x418b78[_0x2c51ca]={'$like':'%'+_0x2e962d[_0x427d('0x2b')][_0x427d('0x47')]+'%'};return _0x418b78;})});}_0x3df32e=_[_0x427d('0x36')]({},_0x3df32e,_0x2e962d[_0x427d('0x38')]);return _0x3c1811['getSubjects'](_0x3df32e);}})['then'](function(_0x478427){if(_0x478427){_0xf7dcee=_0x478427[_0x427d('0x3f')];if(!_0x2e962d[_0x427d('0x2b')]['hasOwnProperty'](_0x427d('0x31'))){_0x3df32e[_0x427d('0x1d')]=qs[_0x427d('0x1d')](_0x2e962d[_0x427d('0x2b')][_0x427d('0x1d')]);_0x3df32e[_0x427d('0x1b')]=qs[_0x427d('0x1b')](_0x2e962d['query'][_0x427d('0x1b')]);}return _0x3c1811[_0x427d('0x49')](_0x3df32e);}})[_0x427d('0x39')](function(_0x391164){if(_0x391164){return _0x391164?{'count':_0xf7dcee,'rows':_0x391164}:null;}})['then'](respondWithResult(_0x1968c2,null))['catch'](handleError(_0x1968c2,null));};exports['getDescriptions']=function(_0x58f06d,_0x5a5d1e,_0x26e48c){var _0x5de61f={};var _0x567189={};var _0x15308f;var _0x27df34;return db[_0x427d('0x26')][_0x427d('0x45')]({'where':{'id':_0x58f06d[_0x427d('0x3e')]['id']}})[_0x427d('0x39')](handleEntityNotFound(_0x5a5d1e,null))[_0x427d('0x39')](function(_0x56a79c){if(_0x56a79c){_0x15308f=_0x56a79c;_0x567189[_0x427d('0x2a')]=_[_0x427d('0x2c')](db[_0x427d('0x46')][_0x427d('0x27')]);_0x567189[_0x427d('0x2b')]=_[_0x427d('0x2c')](_0x58f06d[_0x427d('0x2b')]);_0x567189[_0x427d('0x2d')]=_['intersection'](_0x567189[_0x427d('0x2a')],_0x567189[_0x427d('0x2b')]);_0x5de61f['attributes']=_['intersection'](_0x567189[_0x427d('0x2a')],qs[_0x427d('0x30')](_0x58f06d[_0x427d('0x2b')][_0x427d('0x30')]));_0x5de61f[_0x427d('0x2f')]=_0x5de61f[_0x427d('0x2f')][_0x427d('0x3f')]?_0x5de61f[_0x427d('0x2f')]:_0x567189[_0x427d('0x2a')];_0x5de61f['order']=qs[_0x427d('0x33')](_0x58f06d[_0x427d('0x2b')][_0x427d('0x33')]);_0x5de61f['where']=qs[_0x427d('0x2d')](_[_0x427d('0x35')](_0x58f06d[_0x427d('0x2b')],_0x567189['filters']));if(_0x58f06d[_0x427d('0x2b')]['filter']){_0x5de61f[_0x427d('0x34')]=_[_0x427d('0x36')](_0x5de61f[_0x427d('0x34')],{'$or':_[_0x427d('0x25')](_0x5de61f['attributes'],function(_0x120d5c){var _0x65e7e9={};_0x65e7e9[_0x120d5c]={'$like':'%'+_0x58f06d[_0x427d('0x2b')]['filter']+'%'};return _0x65e7e9;})});}_0x5de61f=_[_0x427d('0x36')]({},_0x5de61f,_0x58f06d['options']);return _0x15308f[_0x427d('0x4a')](_0x5de61f);}})[_0x427d('0x39')](function(_0x48d58f){if(_0x48d58f){_0x27df34=_0x48d58f[_0x427d('0x3f')];if(!_0x58f06d[_0x427d('0x2b')]['hasOwnProperty'](_0x427d('0x31'))){_0x5de61f[_0x427d('0x1d')]=qs['limit'](_0x58f06d['query'][_0x427d('0x1d')]);_0x5de61f[_0x427d('0x1b')]=qs['offset'](_0x58f06d[_0x427d('0x2b')][_0x427d('0x1b')]);}return _0x15308f[_0x427d('0x4a')](_0x5de61f);}})['then'](function(_0xd7d2c3){if(_0xd7d2c3){return _0xd7d2c3?{'count':_0x27df34,'rows':_0xd7d2c3}:null;}})[_0x427d('0x39')](respondWithResult(_0x5a5d1e,null))[_0x427d('0x3d')](handleError(_0x5a5d1e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index f3c8379..920521e 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 _0x7d06=['moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x915426,_0x1a0a05){var _0x1ab376=function(_0x5821ce){while(--_0x5821ce){_0x915426['push'](_0x915426['shift']());}};_0x1ab376(++_0x1a0a05);}(_0x7d06,0x158));var _0x67d0=function(_0x47a4eb,_0x1d950d){_0x47a4eb=_0x47a4eb-0x0;var _0x40209c=_0x7d06[_0x47a4eb];return _0x40209c;};'use strict';var _=require(_0x67d0('0x0'));var util=require(_0x67d0('0x1'));var logger=require(_0x67d0('0x2'))(_0x67d0('0x3'));var moment=require(_0x67d0('0x4'));var BPromise=require('bluebird');var rp=require(_0x67d0('0x5'));var fs=require('fs');var path=require(_0x67d0('0x6'));var rimraf=require(_0x67d0('0x7'));var config=require('../../config/environment');var attributes=require(_0x67d0('0x8'));module['exports']=function(_0x1ba2b3,_0x1f4dc9){return _0x1ba2b3[_0x67d0('0x9')](_0x67d0('0xa'),attributes,{'tableName':_0x67d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc692=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','int_servicenow_configurations','lodash'];(function(_0x197d14,_0x24b358){var _0x2b160e=function(_0x4fa61c){while(--_0x4fa61c){_0x197d14['push'](_0x197d14['shift']());}};_0x2b160e(++_0x24b358);}(_0xc692,0x15f));var _0x2c69=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xc692[_0x543084];return _0x306a57;};'use strict';var _=require(_0x2c69('0x0'));var util=require(_0x2c69('0x1'));var logger=require(_0x2c69('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2c69('0x3'));var rp=require(_0x2c69('0x4'));var fs=require('fs');var path=require(_0x2c69('0x5'));var rimraf=require(_0x2c69('0x6'));var config=require(_0x2c69('0x7'));var attributes=require(_0x2c69('0x8'));module[_0x2c69('0x9')]=function(_0x53b84e,_0x17a476){return _0x53b84e['define']('ServicenowConfiguration',attributes,{'tableName':_0x2c69('0xa'),'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 b82fd6d..8e148b1 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 _0x0a29=['info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a29,0x134));var _0x90a2=function(_0x249daa,_0x2473a5){_0x249daa=_0x249daa-0x0;var _0x11a975=_0x0a29[_0x249daa];return _0x11a975;};'use strict';var _=require(_0x90a2('0x0'));var util=require(_0x90a2('0x1'));var moment=require(_0x90a2('0x2'));var BPromise=require(_0x90a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90a2('0x4'))['db'];var utils=require(_0x90a2('0x5'));var logger=require('../../config/logger')(_0x90a2('0x6'));var config=require('../../config/environment');var jayson=require(_0x90a2('0x7'));var client=jayson[_0x90a2('0x8')][_0x90a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19249d,_0x47b296,_0xdd4426){return new BPromise(function(_0x3231ca,_0x4885b6){return client[_0x90a2('0xa')](_0x19249d,_0xdd4426)[_0x90a2('0xb')](function(_0x417d7d){logger[_0x90a2('0xc')](_0x90a2('0xd'),_0x47b296,'request\x20sent');logger[_0x90a2('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x47b296,_0x90a2('0xf'),JSON['stringify'](_0x417d7d));if(_0x417d7d['error']){if(_0x417d7d[_0x90a2('0x10')][_0x90a2('0x11')]===0x1f4){logger['error'](_0x90a2('0xd'),_0x47b296,_0x417d7d[_0x90a2('0x10')][_0x90a2('0x12')]);return _0x4885b6(_0x417d7d['error'][_0x90a2('0x12')]);}logger[_0x90a2('0x10')](_0x90a2('0xd'),_0x47b296,_0x417d7d['error'][_0x90a2('0x12')]);return _0x3231ca(_0x417d7d[_0x90a2('0x10')][_0x90a2('0x12')]);}else{logger[_0x90a2('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47b296,_0x90a2('0xf'));_0x3231ca(_0x417d7d['result'][_0x90a2('0x12')]);}})[_0x90a2('0x13')](function(_0xac4c87){logger[_0x90a2('0x10')](_0x90a2('0xd'),_0x47b296,_0xac4c87);_0x4885b6(_0xac4c87);});});} \ No newline at end of file +var _0xd5a9=['then','debug','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd5a9,0x6a));var _0x9d5a=function(_0x353ad1,_0x4ed6b9){_0x353ad1=_0x353ad1-0x0;var _0x45f086=_0xd5a9[_0x353ad1];return _0x45f086;};'use strict';var _=require(_0x9d5a('0x0'));var util=require(_0x9d5a('0x1'));var moment=require('moment');var BPromise=require(_0x9d5a('0x2'));var rs=require(_0x9d5a('0x3'));var fs=require('fs');var Redis=require(_0x9d5a('0x4'));var db=require(_0x9d5a('0x5'))['db'];var utils=require(_0x9d5a('0x6'));var logger=require(_0x9d5a('0x7'))(_0x9d5a('0x8'));var config=require(_0x9d5a('0x9'));var jayson=require(_0x9d5a('0xa'));var client=jayson[_0x9d5a('0xb')][_0x9d5a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x137b58,_0x223e3,_0x12d04c){return new BPromise(function(_0x23c321,_0xc7f4f2){return client[_0x9d5a('0xd')](_0x137b58,_0x12d04c)[_0x9d5a('0xe')](function(_0x55ba90){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x223e3,'request\x20sent');logger[_0x9d5a('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x223e3,_0x9d5a('0x10'),JSON[_0x9d5a('0x11')](_0x55ba90));if(_0x55ba90[_0x9d5a('0x12')]){if(_0x55ba90[_0x9d5a('0x12')][_0x9d5a('0x13')]===0x1f4){logger[_0x9d5a('0x12')](_0x9d5a('0x14'),_0x223e3,_0x55ba90[_0x9d5a('0x12')][_0x9d5a('0x15')]);return _0xc7f4f2(_0x55ba90[_0x9d5a('0x12')]['message']);}logger[_0x9d5a('0x12')](_0x9d5a('0x14'),_0x223e3,_0x55ba90['error'][_0x9d5a('0x15')]);return _0x23c321(_0x55ba90[_0x9d5a('0x12')]['message']);}else{logger[_0x9d5a('0x16')](_0x9d5a('0x14'),_0x223e3,'request\x20sent');_0x23c321(_0x55ba90[_0x9d5a('0x17')]['message']);}})['catch'](function(_0x32dc02){logger[_0x9d5a('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x223e3,_0x32dc02);_0xc7f4f2(_0x32dc02);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 20eebe5..cf66dc5 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 _0x1627=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer'];(function(_0x515b25,_0x10d567){var _0x3e6450=function(_0x11ec7a){while(--_0x11ec7a){_0x515b25['push'](_0x515b25['shift']());}};_0x3e6450(++_0x10d567);}(_0x1627,0x142));var _0x7162=function(_0x395327,_0x3a7b63){_0x395327=_0x395327-0x0;var _0x2774b7=_0x1627[_0x395327];return _0x2774b7;};'use strict';var multer=require(_0x7162('0x0'));var util=require('util');var path=require(_0x7162('0x1'));var timeout=require(_0x7162('0x2'));var express=require(_0x7162('0x3'));var router=express['Router']();var fs_extra=require(_0x7162('0x4'));var auth=require(_0x7162('0x5'));var interaction=require(_0x7162('0x6'));var config=require(_0x7162('0x7'));var controller=require(_0x7162('0x8'));router[_0x7162('0x9')]('/',auth[_0x7162('0xa')](),controller[_0x7162('0xb')]);router['get'](_0x7162('0xc'),auth['isAuthenticated'](),controller[_0x7162('0xd')]);router[_0x7162('0xe')]('/',auth[_0x7162('0xa')](),controller[_0x7162('0xf')]);router['put'](_0x7162('0xc'),auth[_0x7162('0xa')](),controller[_0x7162('0x10')]);router[_0x7162('0x11')](_0x7162('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7162('0x12')]=router; \ No newline at end of file +var _0x30b7=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x1e77cc,_0x2c2221){var _0x5b7bf3=function(_0x3f12eb){while(--_0x3f12eb){_0x1e77cc['push'](_0x1e77cc['shift']());}};_0x5b7bf3(++_0x2c2221);}(_0x30b7,0x80));var _0x730b=function(_0x428561,_0x5a75af){_0x428561=_0x428561-0x0;var _0x11eb69=_0x30b7[_0x428561];return _0x11eb69;};'use strict';var multer=require(_0x730b('0x0'));var util=require(_0x730b('0x1'));var path=require(_0x730b('0x2'));var timeout=require(_0x730b('0x3'));var express=require(_0x730b('0x4'));var router=express[_0x730b('0x5')]();var fs_extra=require(_0x730b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x730b('0x7'));var controller=require(_0x730b('0x8'));router[_0x730b('0x9')]('/',auth[_0x730b('0xa')](),controller['index']);router[_0x730b('0x9')](_0x730b('0xb'),auth['isAuthenticated'](),controller[_0x730b('0xc')]);router[_0x730b('0xd')]('/',auth[_0x730b('0xa')](),controller['create']);router[_0x730b('0xe')](_0x730b('0xb'),auth[_0x730b('0xa')](),controller[_0x730b('0xf')]);router[_0x730b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x730b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 8bda437..ed33606 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 _0xacc2=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x54c1e5,_0xa82da4){var _0x1c0a1a=function(_0x5567f4){while(--_0x5567f4){_0x54c1e5['push'](_0x54c1e5['shift']());}};_0x1c0a1a(++_0xa82da4);}(_0xacc2,0x1ab));var _0x2acc=function(_0x18b549,_0x3504d4){_0x18b549=_0x18b549-0x0;var _0x57453b=_0xacc2[_0x18b549];return _0x57453b;};'use strict';var Sequelize=require('sequelize');module[_0x2acc('0x0')]={'type':{'type':Sequelize[_0x2acc('0x1')](_0x2acc('0x2'),_0x2acc('0x3'),_0x2acc('0x4'),_0x2acc('0x5'),'picklist'),'defaultValue':_0x2acc('0x2')},'content':{'type':Sequelize[_0x2acc('0x6')]},'key':{'type':Sequelize[_0x2acc('0x6')]},'keyType':{'type':Sequelize[_0x2acc('0x1')](_0x2acc('0x2'),_0x2acc('0x3'),_0x2acc('0x4'))},'keyContent':{'type':Sequelize[_0x2acc('0x6')]},'idField':{'type':Sequelize[_0x2acc('0x6')]},'nameField':{'type':Sequelize[_0x2acc('0x6')]},'customField':{'type':Sequelize[_0x2acc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x313d=['string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x42a0fd,_0x6f3cb3){var _0x18181b=function(_0xcd53b1){while(--_0xcd53b1){_0x42a0fd['push'](_0x42a0fd['shift']());}};_0x18181b(++_0x6f3cb3);}(_0x313d,0x1ae));var _0xd313=function(_0x4ef28e,_0x2a52ed){_0x4ef28e=_0x4ef28e-0x0;var _0x46f072=_0x313d[_0x4ef28e];return _0x46f072;};'use strict';var Sequelize=require('sequelize');module[_0xd313('0x0')]={'type':{'type':Sequelize[_0xd313('0x1')](_0xd313('0x2'),_0xd313('0x3'),'customVariable',_0xd313('0x4'),_0xd313('0x5')),'defaultValue':_0xd313('0x2')},'content':{'type':Sequelize[_0xd313('0x6')]},'key':{'type':Sequelize[_0xd313('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd313('0x2'),'variable',_0xd313('0x7'))},'keyContent':{'type':Sequelize[_0xd313('0x6')]},'idField':{'type':Sequelize[_0xd313('0x6')]},'nameField':{'type':Sequelize[_0xd313('0x6')]},'customField':{'type':Sequelize[_0xd313('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a12065a..c4cf8fa 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 _0xbb89=['../../config/license/util','sendStatus','status','limit','undefined','count','offset','json','apply','reject','save','update','destroy','end','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x236023,_0xa7f6b6){var _0x5ef19f=function(_0x4e3dfa){while(--_0x4e3dfa){_0x236023['push'](_0x236023['shift']());}};_0x5ef19f(++_0xa7f6b6);}(_0xbb89,0x168));var _0x9bb8=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xbb89[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9bb8('0x0'));var jsonpatch=require(_0x9bb8('0x1'));var rp=require('request-promise');var moment=require(_0x9bb8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9bb8('0x3'));var util=require(_0x9bb8('0x4'));var path=require(_0x9bb8('0x5'));var sox=require(_0x9bb8('0x6'));var csv=require(_0x9bb8('0x7'));var ejs=require(_0x9bb8('0x8'));var fs=require('fs');var fs_extra=require(_0x9bb8('0x9'));var _=require(_0x9bb8('0xa'));var squel=require(_0x9bb8('0xb'));var crypto=require(_0x9bb8('0xc'));var jsforce=require(_0x9bb8('0xd'));var deskjs=require(_0x9bb8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9bb8('0xf'));var Papa=require(_0x9bb8('0x10'));var Redis=require('ioredis');var authService=require(_0x9bb8('0x11'));var qs=require(_0x9bb8('0x12'));var as=require(_0x9bb8('0x13'));var hardwareService=require(_0x9bb8('0x14'));var logger=require(_0x9bb8('0x15'))(_0x9bb8('0x16'));var utils=require(_0x9bb8('0x17'));var config=require(_0x9bb8('0x18'));var licenseUtil=require(_0x9bb8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9a0b0a,_0x5c083b){_0x5c083b=_0x5c083b||0xcc;return function(_0x46ff07){if(_0x46ff07){return _0x9a0b0a[_0x9bb8('0x1a')](_0x5c083b);}return _0x9a0b0a[_0x9bb8('0x1b')](_0x5c083b)['end']();};}function respondWithResult(_0x2b227a,_0x39e6bc){_0x39e6bc=_0x39e6bc||0xc8;return function(_0x3d9491){if(_0x3d9491){return _0x2b227a[_0x9bb8('0x1b')](_0x39e6bc)['json'](_0x3d9491);}};}function respondWithFilteredResult(_0x49b2df,_0x215ee9){return function(_0x2e10cf){if(_0x2e10cf){var _0x51a711=typeof _0x215ee9['offset']==='undefined'&&typeof _0x215ee9[_0x9bb8('0x1c')]===_0x9bb8('0x1d');var _0x3ea294=_0x2e10cf[_0x9bb8('0x1e')];var _0x3f405f=_0x51a711?0x0:_0x215ee9['offset'];var _0x4194b8=_0x51a711?_0x2e10cf[_0x9bb8('0x1e')]:_0x215ee9[_0x9bb8('0x1f')]+_0x215ee9[_0x9bb8('0x1c')];var _0xcc0f36;if(_0x4194b8>=_0x3ea294){_0x4194b8=_0x3ea294;_0xcc0f36=0xc8;}else{_0xcc0f36=0xce;}_0x49b2df[_0x9bb8('0x1b')](_0xcc0f36);return _0x49b2df['set']('Content-Range',_0x3f405f+'-'+_0x4194b8+'/'+_0x3ea294)[_0x9bb8('0x20')](_0x2e10cf);}return null;};}function patchUpdates(_0x5df77f){return function(_0x5d1908){try{jsonpatch[_0x9bb8('0x21')](_0x5d1908,_0x5df77f,!![]);}catch(_0x178fdb){return BPromise[_0x9bb8('0x22')](_0x178fdb);}return _0x5d1908[_0x9bb8('0x23')]();};}function saveUpdates(_0x1ef849,_0x2a365c){return function(_0x488236){if(_0x488236){return _0x488236[_0x9bb8('0x24')](_0x1ef849)['then'](function(_0x576eca){return _0x576eca;});}return null;};}function removeEntity(_0x2cf285,_0x296554){return function(_0x50111c){if(_0x50111c){return _0x50111c[_0x9bb8('0x25')]()['then'](function(){_0x2cf285['status'](0xcc)[_0x9bb8('0x26')]();});}};}function handleEntityNotFound(_0x48abef,_0x1b3a89){return function(_0x14df19){if(!_0x14df19){_0x48abef[_0x9bb8('0x1a')](0x194);}return _0x14df19;};}function handleError(_0x3e74cc,_0x5048c9){_0x5048c9=_0x5048c9||0x1f4;return function(_0x437eee){logger[_0x9bb8('0x27')](_0x437eee[_0x9bb8('0x28')]);if(_0x437eee[_0x9bb8('0x29')]){delete _0x437eee[_0x9bb8('0x29')];}_0x3e74cc['status'](_0x5048c9)[_0x9bb8('0x2a')](_0x437eee);};}exports[_0x9bb8('0x2b')]=function(_0x46f5f9,_0xfdda80){var _0xebefe0={},_0x3eae6f={},_0x2066f3={'count':0x0,'rows':[]};var _0x4b7df2=_['map'](db[_0x9bb8('0x2c')]['rawAttributes'],function(_0x3d6511){return{'name':_0x3d6511[_0x9bb8('0x2d')],'type':_0x3d6511[_0x9bb8('0x2e')][_0x9bb8('0x2f')]};});_0x3eae6f[_0x9bb8('0x30')]=_[_0x9bb8('0x31')](_0x4b7df2,'name');_0x3eae6f[_0x9bb8('0x32')]=_[_0x9bb8('0x33')](_0x46f5f9['query']);_0x3eae6f['filters']=_[_0x9bb8('0x34')](_0x3eae6f['model'],_0x3eae6f[_0x9bb8('0x32')]);_0xebefe0[_0x9bb8('0x35')]=_[_0x9bb8('0x34')](_0x3eae6f[_0x9bb8('0x30')],qs[_0x9bb8('0x36')](_0x46f5f9[_0x9bb8('0x32')]['fields']));_0xebefe0[_0x9bb8('0x35')]=_0xebefe0[_0x9bb8('0x35')][_0x9bb8('0x37')]?_0xebefe0[_0x9bb8('0x35')]:_0x3eae6f[_0x9bb8('0x30')];if(!_0x46f5f9[_0x9bb8('0x32')][_0x9bb8('0x38')](_0x9bb8('0x39'))){_0xebefe0['limit']=qs[_0x9bb8('0x1c')](_0x46f5f9[_0x9bb8('0x32')][_0x9bb8('0x1c')]);_0xebefe0['offset']=qs[_0x9bb8('0x1f')](_0x46f5f9[_0x9bb8('0x32')]['offset']);}_0xebefe0[_0x9bb8('0x3a')]=qs[_0x9bb8('0x3b')](_0x46f5f9['query'][_0x9bb8('0x3b')]);_0xebefe0[_0x9bb8('0x3c')]=qs[_0x9bb8('0x3d')](_[_0x9bb8('0x3e')](_0x46f5f9[_0x9bb8('0x32')],_0x3eae6f[_0x9bb8('0x3d')]),_0x4b7df2);if(_0x46f5f9[_0x9bb8('0x32')]['filter']){_0xebefe0[_0x9bb8('0x3c')]=_[_0x9bb8('0x3f')](_0xebefe0[_0x9bb8('0x3c')],{'$or':_[_0x9bb8('0x31')](_0x4b7df2,function(_0xc85743){if(_0xc85743[_0x9bb8('0x2e')]!==_0x9bb8('0x40')){var _0x1c915d={};_0x1c915d[_0xc85743[_0x9bb8('0x29')]]={'$like':'%'+_0x46f5f9[_0x9bb8('0x32')][_0x9bb8('0x41')]+'%'};return _0x1c915d;}})});}_0xebefe0=_[_0x9bb8('0x3f')]({},_0xebefe0,_0x46f5f9[_0x9bb8('0x42')]);var _0x15b619={'where':_0xebefe0['where']};return db[_0x9bb8('0x2c')]['count'](_0x15b619)[_0x9bb8('0x43')](function(_0x346f5a){_0x2066f3[_0x9bb8('0x1e')]=_0x346f5a;if(_0x46f5f9['query'][_0x9bb8('0x44')]){_0xebefe0[_0x9bb8('0x45')]=[{'all':!![]}];}return db[_0x9bb8('0x2c')][_0x9bb8('0x46')](_0xebefe0);})['then'](function(_0x2a9867){_0x2066f3[_0x9bb8('0x47')]=_0x2a9867;return _0x2066f3;})['then'](respondWithFilteredResult(_0xfdda80,_0xebefe0))[_0x9bb8('0x48')](handleError(_0xfdda80,null));};exports['show']=function(_0x2b2046,_0x4a8165){var _0x3f8e6b={'raw':!![],'where':{'id':_0x2b2046[_0x9bb8('0x49')]['id']}},_0x579066={};_0x579066['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x579066[_0x9bb8('0x32')]=_[_0x9bb8('0x33')](_0x2b2046['query']);_0x579066['filters']=_['intersection'](_0x579066[_0x9bb8('0x30')],_0x579066[_0x9bb8('0x32')]);_0x3f8e6b[_0x9bb8('0x35')]=_[_0x9bb8('0x34')](_0x579066[_0x9bb8('0x30')],qs[_0x9bb8('0x36')](_0x2b2046['query'][_0x9bb8('0x36')]));_0x3f8e6b[_0x9bb8('0x35')]=_0x3f8e6b['attributes'][_0x9bb8('0x37')]?_0x3f8e6b['attributes']:_0x579066[_0x9bb8('0x30')];if(_0x2b2046[_0x9bb8('0x32')][_0x9bb8('0x44')]){_0x3f8e6b[_0x9bb8('0x45')]=[{'all':!![]}];}_0x3f8e6b=_['merge']({},_0x3f8e6b,_0x2b2046[_0x9bb8('0x42')]);return db[_0x9bb8('0x2c')][_0x9bb8('0x4a')](_0x3f8e6b)[_0x9bb8('0x43')](handleEntityNotFound(_0x4a8165,null))[_0x9bb8('0x43')](respondWithResult(_0x4a8165,null))['catch'](handleError(_0x4a8165,null));};exports[_0x9bb8('0x4b')]=function(_0x413ef9,_0x46cbd1){return db[_0x9bb8('0x2c')]['create'](_0x413ef9[_0x9bb8('0x4c')],{})[_0x9bb8('0x43')](respondWithResult(_0x46cbd1,0xc9))[_0x9bb8('0x48')](handleError(_0x46cbd1,null));};exports[_0x9bb8('0x24')]=function(_0x491b1b,_0x158d88){if(_0x491b1b[_0x9bb8('0x4c')]['id']){delete _0x491b1b[_0x9bb8('0x4c')]['id'];}return db[_0x9bb8('0x2c')][_0x9bb8('0x4a')]({'where':{'id':_0x491b1b[_0x9bb8('0x49')]['id']}})['then'](handleEntityNotFound(_0x158d88,null))[_0x9bb8('0x43')](saveUpdates(_0x491b1b[_0x9bb8('0x4c')],null))['then'](respondWithResult(_0x158d88,null))[_0x9bb8('0x48')](handleError(_0x158d88,null));};exports[_0x9bb8('0x25')]=function(_0x48dc5c,_0x4f0702){return db[_0x9bb8('0x2c')][_0x9bb8('0x4a')]({'where':{'id':_0x48dc5c['params']['id']}})[_0x9bb8('0x43')](handleEntityNotFound(_0x4f0702,null))[_0x9bb8('0x43')](removeEntity(_0x4f0702,null))[_0x9bb8('0x48')](handleError(_0x4f0702,null));}; \ No newline at end of file +var _0xbb38=['send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','show','params','keys','length','create','body','catch','update','find','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','error','stack','name'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xbb38,0x1f4));var _0x8bb3=function(_0x23266e,_0x3647e2){_0x23266e=_0x23266e-0x0;var _0x55c2b6=_0xbb38[_0x23266e];return _0x55c2b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bb3('0x0'));var zipdir=require(_0x8bb3('0x1'));var jsonpatch=require(_0x8bb3('0x2'));var rp=require('request-promise');var moment=require(_0x8bb3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8bb3('0x4'));var util=require(_0x8bb3('0x5'));var path=require(_0x8bb3('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8bb3('0x7'));var fs=require('fs');var fs_extra=require(_0x8bb3('0x8'));var _=require(_0x8bb3('0x9'));var squel=require('squel');var crypto=require(_0x8bb3('0xa'));var jsforce=require(_0x8bb3('0xb'));var deskjs=require(_0x8bb3('0xc'));var toCsv=require(_0x8bb3('0xd'));var querystring=require(_0x8bb3('0xe'));var Papa=require(_0x8bb3('0xf'));var Redis=require('ioredis');var authService=require(_0x8bb3('0x10'));var qs=require(_0x8bb3('0x11'));var as=require(_0x8bb3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bb3('0x13'))(_0x8bb3('0x14'));var utils=require('../../config/utils');var config=require(_0x8bb3('0x15'));var licenseUtil=require(_0x8bb3('0x16'));var db=require(_0x8bb3('0x17'))['db'];function respondWithStatusCode(_0x3d138a,_0x46be4f){_0x46be4f=_0x46be4f||0xcc;return function(_0x5af419){if(_0x5af419){return _0x3d138a[_0x8bb3('0x18')](_0x46be4f);}return _0x3d138a[_0x8bb3('0x19')](_0x46be4f)[_0x8bb3('0x1a')]();};}function respondWithResult(_0xd09b84,_0x31da9f){_0x31da9f=_0x31da9f||0xc8;return function(_0x14a453){if(_0x14a453){return _0xd09b84[_0x8bb3('0x19')](_0x31da9f)[_0x8bb3('0x1b')](_0x14a453);}};}function respondWithFilteredResult(_0x2167e4,_0xfa8bf6){return function(_0x166927){if(_0x166927){var _0x258905=typeof _0xfa8bf6[_0x8bb3('0x1c')]===_0x8bb3('0x1d')&&typeof _0xfa8bf6[_0x8bb3('0x1e')]===_0x8bb3('0x1d');var _0x581705=_0x166927[_0x8bb3('0x1f')];var _0x11b489=_0x258905?0x0:_0xfa8bf6[_0x8bb3('0x1c')];var _0x2cc4b3=_0x258905?_0x166927['count']:_0xfa8bf6[_0x8bb3('0x1c')]+_0xfa8bf6[_0x8bb3('0x1e')];var _0x1d882a;if(_0x2cc4b3>=_0x581705){_0x2cc4b3=_0x581705;_0x1d882a=0xc8;}else{_0x1d882a=0xce;}_0x2167e4['status'](_0x1d882a);return _0x2167e4['set'](_0x8bb3('0x20'),_0x11b489+'-'+_0x2cc4b3+'/'+_0x581705)[_0x8bb3('0x1b')](_0x166927);}return null;};}function patchUpdates(_0x2acc72){return function(_0x590dce){try{jsonpatch['apply'](_0x590dce,_0x2acc72,!![]);}catch(_0xb71bf1){return BPromise[_0x8bb3('0x21')](_0xb71bf1);}return _0x590dce[_0x8bb3('0x22')]();};}function saveUpdates(_0x1e396a,_0x13c2f8){return function(_0x2a7eb6){if(_0x2a7eb6){return _0x2a7eb6['update'](_0x1e396a)['then'](function(_0x4fb8c5){return _0x4fb8c5;});}return null;};}function removeEntity(_0x1a4422,_0x124349){return function(_0x23b0f8){if(_0x23b0f8){return _0x23b0f8[_0x8bb3('0x23')]()['then'](function(){_0x1a4422['status'](0xcc)[_0x8bb3('0x1a')]();});}};}function handleEntityNotFound(_0x5933f9,_0xba2dea){return function(_0x38004e){if(!_0x38004e){_0x5933f9[_0x8bb3('0x18')](0x194);}return _0x38004e;};}function handleError(_0x4ff9e6,_0x4a1882){_0x4a1882=_0x4a1882||0x1f4;return function(_0x4c5af2){logger[_0x8bb3('0x24')](_0x4c5af2[_0x8bb3('0x25')]);if(_0x4c5af2[_0x8bb3('0x26')]){delete _0x4c5af2[_0x8bb3('0x26')];}_0x4ff9e6['status'](_0x4a1882)[_0x8bb3('0x27')](_0x4c5af2);};}exports[_0x8bb3('0x28')]=function(_0x333589,_0x5e1508){var _0x40628d={},_0x48b609={},_0x33f16c={'count':0x0,'rows':[]};var _0x187466=_[_0x8bb3('0x29')](db[_0x8bb3('0x2a')][_0x8bb3('0x2b')],function(_0x732f11){return{'name':_0x732f11[_0x8bb3('0x2c')],'type':_0x732f11[_0x8bb3('0x2d')][_0x8bb3('0x2e')]};});_0x48b609[_0x8bb3('0x2f')]=_[_0x8bb3('0x29')](_0x187466,_0x8bb3('0x26'));_0x48b609[_0x8bb3('0x30')]=_['keys'](_0x333589[_0x8bb3('0x30')]);_0x48b609[_0x8bb3('0x31')]=_[_0x8bb3('0x32')](_0x48b609['model'],_0x48b609[_0x8bb3('0x30')]);_0x40628d[_0x8bb3('0x33')]=_[_0x8bb3('0x32')](_0x48b609[_0x8bb3('0x2f')],qs[_0x8bb3('0x34')](_0x333589[_0x8bb3('0x30')][_0x8bb3('0x34')]));_0x40628d[_0x8bb3('0x33')]=_0x40628d['attributes']['length']?_0x40628d[_0x8bb3('0x33')]:_0x48b609[_0x8bb3('0x2f')];if(!_0x333589['query'][_0x8bb3('0x35')](_0x8bb3('0x36'))){_0x40628d[_0x8bb3('0x1e')]=qs[_0x8bb3('0x1e')](_0x333589[_0x8bb3('0x30')]['limit']);_0x40628d[_0x8bb3('0x1c')]=qs[_0x8bb3('0x1c')](_0x333589['query']['offset']);}_0x40628d[_0x8bb3('0x37')]=qs['sort'](_0x333589[_0x8bb3('0x30')][_0x8bb3('0x38')]);_0x40628d[_0x8bb3('0x39')]=qs[_0x8bb3('0x31')](_[_0x8bb3('0x3a')](_0x333589['query'],_0x48b609[_0x8bb3('0x31')]),_0x187466);if(_0x333589[_0x8bb3('0x30')]['filter']){_0x40628d[_0x8bb3('0x39')]=_[_0x8bb3('0x3b')](_0x40628d[_0x8bb3('0x39')],{'$or':_[_0x8bb3('0x29')](_0x187466,function(_0x17714b){if(_0x17714b[_0x8bb3('0x2d')]!==_0x8bb3('0x3c')){var _0x18427c={};_0x18427c[_0x17714b[_0x8bb3('0x26')]]={'$like':'%'+_0x333589[_0x8bb3('0x30')][_0x8bb3('0x3d')]+'%'};return _0x18427c;}})});}_0x40628d=_[_0x8bb3('0x3b')]({},_0x40628d,_0x333589[_0x8bb3('0x3e')]);var _0x2506d8={'where':_0x40628d[_0x8bb3('0x39')]};return db[_0x8bb3('0x2a')]['count'](_0x2506d8)[_0x8bb3('0x3f')](function(_0x33555a){_0x33f16c[_0x8bb3('0x1f')]=_0x33555a;if(_0x333589['query'][_0x8bb3('0x40')]){_0x40628d[_0x8bb3('0x41')]=[{'all':!![]}];}return db['ServicenowField'][_0x8bb3('0x42')](_0x40628d);})[_0x8bb3('0x3f')](function(_0x4c9862){_0x33f16c[_0x8bb3('0x43')]=_0x4c9862;return _0x33f16c;})['then'](respondWithFilteredResult(_0x5e1508,_0x40628d))['catch'](handleError(_0x5e1508,null));};exports[_0x8bb3('0x44')]=function(_0x5e86af,_0x5ed86f){var _0x28224d={'raw':!![],'where':{'id':_0x5e86af[_0x8bb3('0x45')]['id']}},_0x4baf73={};_0x4baf73[_0x8bb3('0x2f')]=_[_0x8bb3('0x46')](db[_0x8bb3('0x2a')]['rawAttributes']);_0x4baf73[_0x8bb3('0x30')]=_['keys'](_0x5e86af[_0x8bb3('0x30')]);_0x4baf73[_0x8bb3('0x31')]=_['intersection'](_0x4baf73['model'],_0x4baf73[_0x8bb3('0x30')]);_0x28224d[_0x8bb3('0x33')]=_['intersection'](_0x4baf73[_0x8bb3('0x2f')],qs['fields'](_0x5e86af['query'][_0x8bb3('0x34')]));_0x28224d[_0x8bb3('0x33')]=_0x28224d[_0x8bb3('0x33')][_0x8bb3('0x47')]?_0x28224d['attributes']:_0x4baf73[_0x8bb3('0x2f')];if(_0x5e86af[_0x8bb3('0x30')]['includeAll']){_0x28224d[_0x8bb3('0x41')]=[{'all':!![]}];}_0x28224d=_[_0x8bb3('0x3b')]({},_0x28224d,_0x5e86af[_0x8bb3('0x3e')]);return db[_0x8bb3('0x2a')]['find'](_0x28224d)[_0x8bb3('0x3f')](handleEntityNotFound(_0x5ed86f,null))[_0x8bb3('0x3f')](respondWithResult(_0x5ed86f,null))['catch'](handleError(_0x5ed86f,null));};exports[_0x8bb3('0x48')]=function(_0x4fed5f,_0x543479){return db['ServicenowField']['create'](_0x4fed5f[_0x8bb3('0x49')],{})[_0x8bb3('0x3f')](respondWithResult(_0x543479,0xc9))[_0x8bb3('0x4a')](handleError(_0x543479,null));};exports[_0x8bb3('0x4b')]=function(_0x3c6736,_0xdb4ef3){if(_0x3c6736[_0x8bb3('0x49')]['id']){delete _0x3c6736[_0x8bb3('0x49')]['id'];}return db[_0x8bb3('0x2a')][_0x8bb3('0x4c')]({'where':{'id':_0x3c6736[_0x8bb3('0x45')]['id']}})[_0x8bb3('0x3f')](handleEntityNotFound(_0xdb4ef3,null))['then'](saveUpdates(_0x3c6736[_0x8bb3('0x49')],null))[_0x8bb3('0x3f')](respondWithResult(_0xdb4ef3,null))[_0x8bb3('0x4a')](handleError(_0xdb4ef3,null));};exports[_0x8bb3('0x23')]=function(_0x10d6c7,_0x20fb94){return db[_0x8bb3('0x2a')][_0x8bb3('0x4c')]({'where':{'id':_0x10d6c7[_0x8bb3('0x45')]['id']}})[_0x8bb3('0x3f')](handleEntityNotFound(_0x20fb94,null))[_0x8bb3('0x3f')](removeEntity(_0x20fb94,null))['catch'](handleError(_0x20fb94,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c7a24ad..44c2b16 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 _0xee6f=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ServicenowField','servicenow_unique_index'];(function(_0x441981,_0x12a3eb){var _0x19ce77=function(_0x26973d){while(--_0x26973d){_0x441981['push'](_0x441981['shift']());}};_0x19ce77(++_0x12a3eb);}(_0xee6f,0x17b));var _0xfee6=function(_0x460103,_0x5397b7){_0x460103=_0x460103-0x0;var _0x44499c=_0xee6f[_0x460103];return _0x44499c;};'use strict';var _=require(_0xfee6('0x0'));var util=require(_0xfee6('0x1'));var logger=require(_0xfee6('0x2'))(_0xfee6('0x3'));var moment=require(_0xfee6('0x4'));var BPromise=require(_0xfee6('0x5'));var rp=require(_0xfee6('0x6'));var fs=require('fs');var path=require(_0xfee6('0x7'));var rimraf=require(_0xfee6('0x8'));var config=require(_0xfee6('0x9'));var attributes=require('./intServicenowField.attributes');module[_0xfee6('0xa')]=function(_0x32266a,_0x543edf){return _0x32266a['define'](_0xfee6('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xfee6('0xc'),'fields':['idField',_0xfee6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb36b=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb36b,0x1f0));var _0xbb36=function(_0x2c8e3a,_0x4fab4e){_0x2c8e3a=_0x2c8e3a-0x0;var _0xd0850e=_0xb36b[_0x2c8e3a];return _0xd0850e;};'use strict';var _=require(_0xbb36('0x0'));var util=require(_0xbb36('0x1'));var logger=require(_0xbb36('0x2'))(_0xbb36('0x3'));var moment=require(_0xbb36('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb36('0x5'));var rimraf=require(_0xbb36('0x6'));var config=require(_0xbb36('0x7'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x128089,_0x1e8ba1){return _0x128089[_0xbb36('0x8')](_0xbb36('0x9'),attributes,{'tableName':_0xbb36('0xa'),'paranoid':![],'indexes':[{'name':_0xbb36('0xb'),'fields':[_0xbb36('0xc'),_0xbb36('0xd')],'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 d844781..35eccd8 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x3f08f8,_0x181c8e){var _0x304753=function(_0x426d12){while(--_0x426d12){_0x3f08f8['push'](_0x3f08f8['shift']());}};_0x304753(++_0x181c8e);}(_0xe706,0xa3));var _0x6e70=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0xe706[_0x874cf1];return _0x233579;};'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']('ServicenowField,\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']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x52454b,_0x5e4d5f){var _0x51e68b=function(_0x93adf9){while(--_0x93adf9){_0x52454b['push'](_0x52454b['shift']());}};_0x51e68b(++_0x5e4d5f);}(_0xaa88,0x137));var _0x8aa8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xaa88[_0x432682];return _0x463d05;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7db2573..cd7a558 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x87ef,_0xc508da){var _0x2bc21d=function(_0x105b4a){while(--_0x105b4a){_0x87ef['push'](_0x87ef['shift']());}};_0x2bc21d(++_0xc508da);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1a68cb,_0x3c3465){var _0x1295c2=function(_0x36455a){while(--_0x36455a){_0x1a68cb['push'](_0x1a68cb['shift']());}};_0x1295c2(++_0x3c3465);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index a360df9..9bb8a7b 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(_0x2e47ec,_0x2b412f){var _0xd88707=function(_0x3f531a){while(--_0x3f531a){_0x2e47ec['push'](_0x2e47ec['shift']());}};_0xd88707(++_0x2b412f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'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(_0x497804,_0x396a59){var _0x2244b5=function(_0x3d3365){while(--_0x3d3365){_0x497804['push'](_0x497804['shift']());}};_0x2244b5(++_0x396a59);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 bd3ec3a..4e1f631 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 _0x6641=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','update','body','destroy','getConfigurations','findOne','keys','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','stringify','password','PLAIN','Invalid\x20Login','POST','/service/v4_1/rest.php','get_module_fields','JSON','Calls','includes','label','values','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','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','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','save','then','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type'];(function(_0x4f644c,_0x267433){var _0x5b1528=function(_0x1ccf08){while(--_0x1ccf08){_0x4f644c['push'](_0x4f644c['shift']());}};_0x5b1528(++_0x267433);}(_0x6641,0xc0));var _0x1664=function(_0x5a1667,_0x123ff4){_0x5a1667=_0x5a1667-0x0;var _0x127eaa=_0x6641[_0x5a1667];return _0x127eaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1664('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1664('0x1'));var moment=require(_0x1664('0x2'));var BPromise=require(_0x1664('0x3'));var Mustache=require('mustache');var util=require(_0x1664('0x4'));var path=require(_0x1664('0x5'));var sox=require('sox');var csv=require(_0x1664('0x6'));var ejs=require(_0x1664('0x7'));var fs=require('fs');var fs_extra=require(_0x1664('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1664('0x9'));var deskjs=require(_0x1664('0xa'));var toCsv=require(_0x1664('0x6'));var querystring=require(_0x1664('0xb'));var Papa=require(_0x1664('0xc'));var Redis=require('ioredis');var authService=require(_0x1664('0xd'));var qs=require(_0x1664('0xe'));var as=require(_0x1664('0xf'));var hardwareService=require(_0x1664('0x10'));var logger=require('../../config/logger')(_0x1664('0x11'));var utils=require(_0x1664('0x12'));var config=require(_0x1664('0x13'));var licenseUtil=require(_0x1664('0x14'));var db=require(_0x1664('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x25c6f2,_0x3fc7c1){_0x3fc7c1=_0x3fc7c1||0xcc;return function(_0x2d296d){if(_0x2d296d){return _0x25c6f2[_0x1664('0x16')](_0x3fc7c1);}return _0x25c6f2['status'](_0x3fc7c1)[_0x1664('0x17')]();};}function respondWithResult(_0x5d4f3b,_0xbb74c8){_0xbb74c8=_0xbb74c8||0xc8;return function(_0x168873){if(_0x168873){return _0x5d4f3b[_0x1664('0x18')](_0xbb74c8)[_0x1664('0x19')](_0x168873);}};}function respondWithFilteredResult(_0x13b242,_0x33d77c){return function(_0x42a4f0){if(_0x42a4f0){var _0x4d0752=typeof _0x33d77c[_0x1664('0x1a')]===_0x1664('0x1b')&&typeof _0x33d77c['limit']===_0x1664('0x1b');var _0x448a27=_0x42a4f0['count'];var _0x27f5ef=_0x4d0752?0x0:_0x33d77c[_0x1664('0x1a')];var _0x3e3b42=_0x4d0752?_0x42a4f0[_0x1664('0x1c')]:_0x33d77c['offset']+_0x33d77c[_0x1664('0x1d')];var _0x51531b;if(_0x3e3b42>=_0x448a27){_0x3e3b42=_0x448a27;_0x51531b=0xc8;}else{_0x51531b=0xce;}_0x13b242[_0x1664('0x18')](_0x51531b);return _0x13b242[_0x1664('0x1e')]('Content-Range',_0x27f5ef+'-'+_0x3e3b42+'/'+_0x448a27)[_0x1664('0x19')](_0x42a4f0);}return null;};}function patchUpdates(_0x224bce){return function(_0x372aa2){try{jsonpatch[_0x1664('0x1f')](_0x372aa2,_0x224bce,!![]);}catch(_0x3c6f5e){return BPromise['reject'](_0x3c6f5e);}return _0x372aa2[_0x1664('0x20')]();};}function saveUpdates(_0x4de688,_0x42e77c){return function(_0x4953d2){if(_0x4953d2){return _0x4953d2['update'](_0x4de688)[_0x1664('0x21')](function(_0x59b560){return _0x59b560;});}return null;};}function removeEntity(_0x2691ec,_0x299991){return function(_0x483365){if(_0x483365){return _0x483365['destroy']()['then'](function(){_0x2691ec[_0x1664('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4091d9,_0x13b241){return function(_0x840b86){if(!_0x840b86){_0x4091d9['sendStatus'](0x194);}return _0x840b86;};}function handleError(_0x30a5fb,_0x35b823){_0x35b823=_0x35b823||0x1f4;return function(_0x4e3d6f){logger['error'](_0x4e3d6f['stack']);if(_0x4e3d6f[_0x1664('0x22')]){delete _0x4e3d6f[_0x1664('0x22')];}_0x30a5fb[_0x1664('0x18')](_0x35b823)[_0x1664('0x23')](_0x4e3d6f);};}exports[_0x1664('0x24')]=function(_0x305b9b,_0x3969ea){var _0x440c33={},_0x14021f={},_0x5176b9={'count':0x0,'rows':[]};var _0x2225e6=_[_0x1664('0x25')](db[_0x1664('0x26')][_0x1664('0x27')],function(_0x458641){return{'name':_0x458641[_0x1664('0x28')],'type':_0x458641[_0x1664('0x29')][_0x1664('0x2a')]};});_0x14021f[_0x1664('0x2b')]=_[_0x1664('0x25')](_0x2225e6,_0x1664('0x22'));_0x14021f['query']=_['keys'](_0x305b9b[_0x1664('0x2c')]);_0x14021f[_0x1664('0x2d')]=_[_0x1664('0x2e')](_0x14021f[_0x1664('0x2b')],_0x14021f['query']);_0x440c33[_0x1664('0x2f')]=_[_0x1664('0x2e')](_0x14021f[_0x1664('0x2b')],qs[_0x1664('0x30')](_0x305b9b[_0x1664('0x2c')][_0x1664('0x30')]));_0x440c33[_0x1664('0x2f')]=_0x440c33[_0x1664('0x2f')][_0x1664('0x31')]?_0x440c33[_0x1664('0x2f')]:_0x14021f['model'];if(!_0x305b9b[_0x1664('0x2c')][_0x1664('0x32')](_0x1664('0x33'))){_0x440c33['limit']=qs['limit'](_0x305b9b[_0x1664('0x2c')][_0x1664('0x1d')]);_0x440c33['offset']=qs['offset'](_0x305b9b[_0x1664('0x2c')][_0x1664('0x1a')]);}_0x440c33[_0x1664('0x34')]=qs['sort'](_0x305b9b['query'][_0x1664('0x35')]);_0x440c33[_0x1664('0x36')]=qs[_0x1664('0x2d')](_[_0x1664('0x37')](_0x305b9b['query'],_0x14021f['filters']),_0x2225e6);if(_0x305b9b['query'][_0x1664('0x38')]){_0x440c33[_0x1664('0x36')]=_[_0x1664('0x39')](_0x440c33[_0x1664('0x36')],{'$or':_[_0x1664('0x25')](_0x2225e6,function(_0x1014e6){if(_0x1014e6[_0x1664('0x29')]!==_0x1664('0x3a')){var _0x2ab113={};_0x2ab113[_0x1014e6[_0x1664('0x22')]]={'$like':'%'+_0x305b9b[_0x1664('0x2c')][_0x1664('0x38')]+'%'};return _0x2ab113;}})});}_0x440c33=_[_0x1664('0x39')]({},_0x440c33,_0x305b9b['options']);var _0x1b2406={'where':_0x440c33['where']};return db[_0x1664('0x26')][_0x1664('0x1c')](_0x1b2406)[_0x1664('0x21')](function(_0x57bcf6){_0x5176b9[_0x1664('0x1c')]=_0x57bcf6;if(_0x305b9b[_0x1664('0x2c')][_0x1664('0x3b')]){_0x440c33[_0x1664('0x3c')]=[{'all':!![]}];}return db[_0x1664('0x26')]['findAll'](_0x440c33);})[_0x1664('0x21')](function(_0x4501e5){_0x5176b9[_0x1664('0x3d')]=_0x4501e5;return _0x5176b9;})[_0x1664('0x21')](respondWithFilteredResult(_0x3969ea,_0x440c33))[_0x1664('0x3e')](handleError(_0x3969ea,null));};exports[_0x1664('0x3f')]=function(_0x4150c6,_0x1b39d6){var _0x37ed07={'raw':![],'where':{'id':_0x4150c6[_0x1664('0x40')]['id']}},_0x2bb50e={};_0x2bb50e[_0x1664('0x2b')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x2bb50e['query']=_['keys'](_0x4150c6['query']);_0x2bb50e[_0x1664('0x2d')]=_[_0x1664('0x2e')](_0x2bb50e[_0x1664('0x2b')],_0x2bb50e['query']);_0x37ed07[_0x1664('0x2f')]=_['intersection'](_0x2bb50e[_0x1664('0x2b')],qs[_0x1664('0x30')](_0x4150c6[_0x1664('0x2c')]['fields']));_0x37ed07['attributes']=_0x37ed07[_0x1664('0x2f')][_0x1664('0x31')]?_0x37ed07['attributes']:_0x2bb50e[_0x1664('0x2b')];if(_0x4150c6[_0x1664('0x2c')]['includeAll']){_0x37ed07[_0x1664('0x3c')]=[{'all':!![]}];}_0x37ed07=_[_0x1664('0x39')]({},_0x37ed07,_0x4150c6[_0x1664('0x41')]);return db[_0x1664('0x26')][_0x1664('0x42')](_0x37ed07)[_0x1664('0x21')](handleEntityNotFound(_0x1b39d6,null))[_0x1664('0x21')](respondWithResult(_0x1b39d6,null))[_0x1664('0x3e')](handleError(_0x1b39d6,null));};exports[_0x1664('0x43')]=function(_0x5ccc68,_0x510dab){return db['SugarcrmAccount'][_0x1664('0x43')](_0x5ccc68['body'],{})[_0x1664('0x21')](respondWithResult(_0x510dab,0xc9))[_0x1664('0x3e')](handleError(_0x510dab,null));};exports[_0x1664('0x44')]=function(_0x2428fe,_0x144538){if(_0x2428fe[_0x1664('0x45')]['id']){delete _0x2428fe[_0x1664('0x45')]['id'];}return db[_0x1664('0x26')][_0x1664('0x42')]({'where':{'id':_0x2428fe['params']['id']}})[_0x1664('0x21')](handleEntityNotFound(_0x144538,null))['then'](saveUpdates(_0x2428fe[_0x1664('0x45')],null))['then'](respondWithResult(_0x144538,null))[_0x1664('0x3e')](handleError(_0x144538,null));};exports[_0x1664('0x46')]=function(_0x365ef4,_0x5ecb09){return db['SugarcrmAccount'][_0x1664('0x42')]({'where':{'id':_0x365ef4[_0x1664('0x40')]['id']}})['then'](handleEntityNotFound(_0x5ecb09,null))[_0x1664('0x21')](removeEntity(_0x5ecb09,null))[_0x1664('0x3e')](handleError(_0x5ecb09,null));};exports[_0x1664('0x47')]=function(_0x1170b7,_0x5e7205,_0x3e9413){var _0x481647={};var _0x3e356c={};var _0x205ca0;var _0x4b824a;return db[_0x1664('0x26')][_0x1664('0x48')]({'where':{'id':_0x1170b7[_0x1664('0x40')]['id']}})[_0x1664('0x21')](handleEntityNotFound(_0x5e7205,null))['then'](function(_0x57ad54){if(_0x57ad54){_0x205ca0=_0x57ad54;_0x3e356c[_0x1664('0x2b')]=_[_0x1664('0x49')](db[_0x1664('0x4a')][_0x1664('0x27')]);_0x3e356c[_0x1664('0x2c')]=_[_0x1664('0x49')](_0x1170b7[_0x1664('0x2c')]);_0x3e356c[_0x1664('0x2d')]=_['intersection'](_0x3e356c[_0x1664('0x2b')],_0x3e356c['query']);_0x481647[_0x1664('0x2f')]=_[_0x1664('0x2e')](_0x3e356c[_0x1664('0x2b')],qs[_0x1664('0x30')](_0x1170b7[_0x1664('0x2c')][_0x1664('0x30')]));_0x481647[_0x1664('0x2f')]=_0x481647[_0x1664('0x2f')][_0x1664('0x31')]?_0x481647[_0x1664('0x2f')]:_0x3e356c[_0x1664('0x2b')];_0x481647[_0x1664('0x34')]=qs[_0x1664('0x35')](_0x1170b7['query'][_0x1664('0x35')]);_0x481647[_0x1664('0x36')]=qs[_0x1664('0x2d')](_[_0x1664('0x37')](_0x1170b7['query'],_0x3e356c[_0x1664('0x2d')]));if(_0x1170b7[_0x1664('0x2c')]['filter']){_0x481647[_0x1664('0x36')]=_[_0x1664('0x39')](_0x481647[_0x1664('0x36')],{'$or':_['map'](_0x481647[_0x1664('0x2f')],function(_0x27022b){var _0x153b14={};_0x153b14[_0x27022b]={'$like':'%'+_0x1170b7[_0x1664('0x2c')][_0x1664('0x38')]+'%'};return _0x153b14;})});}_0x481647=_[_0x1664('0x39')]({},_0x481647,_0x1170b7['options']);return _0x205ca0[_0x1664('0x47')](_0x481647);}})[_0x1664('0x21')](function(_0x5adf4f){if(_0x5adf4f){_0x4b824a=_0x5adf4f['length'];if(!_0x1170b7[_0x1664('0x2c')]['hasOwnProperty'](_0x1664('0x33'))){_0x481647[_0x1664('0x1d')]=qs[_0x1664('0x1d')](_0x1170b7[_0x1664('0x2c')][_0x1664('0x1d')]);_0x481647[_0x1664('0x1a')]=qs['offset'](_0x1170b7['query']['offset']);}return _0x205ca0[_0x1664('0x47')](_0x481647);}})['then'](function(_0x3db5bf){if(_0x3db5bf){return _0x3db5bf?{'count':_0x4b824a,'rows':_0x3db5bf}:null;}})['then'](respondWithResult(_0x5e7205,null))[_0x1664('0x3e')](handleError(_0x5e7205,null));};exports[_0x1664('0x4b')]=function(_0x105f63,_0x49c5e3,_0x102010){if(_0x105f63[_0x1664('0x45')]['id']){delete _0x105f63[_0x1664('0x45')]['id'];}return db[_0x1664('0x26')][_0x1664('0x48')]({'where':{'id':_0x105f63[_0x1664('0x40')]['id']}})[_0x1664('0x21')](handleEntityNotFound(_0x49c5e3,null))[_0x1664('0x21')](function(_0x13e55e){if(_0x13e55e){_0x105f63[_0x1664('0x45')][_0x1664('0x4c')]=_0x13e55e['id'];_0x105f63[_0x1664('0x45')]['Subjects']=integrations[_0x1664('0x4d')](_0x105f63[_0x1664('0x45')][_0x1664('0x4e')],_0x105f63[_0x1664('0x45')]['type']);_0x105f63[_0x1664('0x45')][_0x1664('0x4f')]=integrations['getDescriptions'](_0x105f63[_0x1664('0x45')][_0x1664('0x4e')],_0x105f63[_0x1664('0x45')][_0x1664('0x29')]);return db[_0x1664('0x4a')][_0x1664('0x43')](_0x105f63[_0x1664('0x45')],{'include':[{'model':db['SugarcrmField'],'as':_0x1664('0x50')},{'model':db[_0x1664('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x49c5e3,null))[_0x1664('0x3e')](handleError(_0x49c5e3,null));};exports[_0x1664('0x52')]=function(_0x536919,_0x3c8695,_0xa24c68){var _0x252d5b='';var _0x36af7f=['id',_0x1664('0x22'),_0x1664('0x53'),'created_by',_0x1664('0x54'),_0x1664('0x55'),_0x1664('0x56'),'duration_minutes',_0x1664('0x57'),_0x1664('0x58'),_0x1664('0x59'),_0x1664('0x5a')];return db[_0x1664('0x26')][_0x1664('0x48')]({'where':{'id':_0x536919[_0x1664('0x40')]['id']},'attributes':['id',_0x1664('0x5b'),'password','remoteUri']})[_0x1664('0x21')](handleEntityNotFound(_0x3c8695,null))['then'](function(_0x5a9118){if(_0x5a9118){_0x252d5b=_0x5a9118[_0x1664('0x5c')];var _0x5caf3f=_0x252d5b[_0x1664('0x5d')](-0x1);if(_0x5caf3f==='/'){_0x252d5b=_0x252d5b[_0x1664('0x5e')](0x0,_0x252d5b[_0x1664('0x5f')](_0x5caf3f));}return rp({'method':'POST','uri':util[_0x1664('0x60')](_0x1664('0x61'),_0x252d5b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1664('0x62'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1664('0x63')]({'user_auth':{'user_name':_0x5a9118[_0x1664('0x5b')],'password':_0x5a9118[_0x1664('0x64')],'encryption':_0x1664('0x65')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x1664('0x21')](function(_0x5d0420){if(_0x5d0420&&_0x5d0420[_0x1664('0x22')]!==_0x1664('0x66')&&_0x5d0420[_0x1664('0x22')]!=='Password\x20Expired'){return rp({'method':_0x1664('0x67'),'uri':util[_0x1664('0x60')]('%s%s',_0x252d5b,_0x1664('0x68')),'json':!![],'form':{'method':_0x1664('0x69'),'input_type':_0x1664('0x6a'),'response_type':'JSON','rest_data':JSON[_0x1664('0x63')]({'session':_0x5d0420['id'],'module_name':_0x1664('0x6b')})}})[_0x1664('0x21')](function(_0x23ee37){if(_0x23ee37){var _0x53ec6f=_['values'](_0x23ee37['module_fields']);_['remove'](_0x53ec6f,function(_0x44af1e){return _0x36af7f[_0x1664('0x6c')](_0x44af1e[_0x1664('0x22')]);});return{'count':_0x53ec6f[_0x1664('0x31')],'rows':_[_0x1664('0x25')](_0x53ec6f,function(_0x2eb1b6){return{'id':_0x2eb1b6[_0x1664('0x22')],'name':_0x2eb1b6[_0x1664('0x6d')],'custom':_['endsWith'](_0x2eb1b6['name'],'_c')?!![]:![],'options':_0x2eb1b6['options']?_[_0x1664('0x25')](_[_0x1664('0x6e')](_0x2eb1b6['options']),function(_0x237e7c){return{'name':_0x237e7c[_0x1664('0x6f')],'value':_0x237e7c['name']};}):[]};})};}})[_0x1664('0x21')](respondWithResult(_0x3c8695,null))['catch'](function(_0x2054b5){var _0x3d3959=_0x536919[_0x1664('0x2c')][_0x1664('0x70')]?0x1f4:_0x2054b5[_0x1664('0x71')]||0x1f4;logger[_0x1664('0x72')](_0x1664('0x73'),_0x1664('0x52'),_0x3d3959,JSON[_0x1664('0x63')](_0x2054b5));delete _0x2054b5['name'];if(_0x3d3959===0x191){_0x3d3959=0x190;}_0x3c8695['status'](_0x3d3959)[_0x1664('0x23')](_0x536919[_0x1664('0x2c')][_0x1664('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x2054b5[_0x1664('0x71')]}:_0x2054b5);});}else{var _0x261c3d=0x1f4;_0x3c8695['status'](_0x261c3d)[_0x1664('0x23')]({'message':_0x1664('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2334=['xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','send','map','SugarcrmAccount','rawAttributes','type','key','name','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','filter','Subjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','POST','format','%s%s','login','JSON','stringify','PLAIN'];(function(_0x14a3cf,_0xae014f){var _0x5bcffb=function(_0x45fdad){while(--_0x45fdad){_0x14a3cf['push'](_0x14a3cf['shift']());}};_0x5bcffb(++_0xae014f);}(_0x2334,0x1d6));var _0x4233=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x2334[_0x13524d];return _0x9918b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4233('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4233('0x1'));var rp=require(_0x4233('0x2'));var moment=require(_0x4233('0x3'));var BPromise=require(_0x4233('0x4'));var Mustache=require(_0x4233('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4233('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4233('0x7'));var squel=require(_0x4233('0x8'));var crypto=require(_0x4233('0x9'));var jsforce=require(_0x4233('0xa'));var deskjs=require(_0x4233('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4233('0xc'));var Papa=require(_0x4233('0xd'));var Redis=require(_0x4233('0xe'));var authService=require(_0x4233('0xf'));var qs=require(_0x4233('0x10'));var as=require(_0x4233('0x11'));var hardwareService=require(_0x4233('0x12'));var logger=require(_0x4233('0x13'))(_0x4233('0x14'));var utils=require(_0x4233('0x15'));var config=require(_0x4233('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4233('0x17'))['db'];var integrations=require(_0x4233('0x18'));function respondWithStatusCode(_0x484976,_0x310d8c){_0x310d8c=_0x310d8c||0xcc;return function(_0x50a0ba){if(_0x50a0ba){return _0x484976[_0x4233('0x19')](_0x310d8c);}return _0x484976[_0x4233('0x1a')](_0x310d8c)[_0x4233('0x1b')]();};}function respondWithResult(_0x5096b8,_0x5c0adb){_0x5c0adb=_0x5c0adb||0xc8;return function(_0x2264aa){if(_0x2264aa){return _0x5096b8[_0x4233('0x1a')](_0x5c0adb)[_0x4233('0x1c')](_0x2264aa);}};}function respondWithFilteredResult(_0x28486c,_0x6ff241){return function(_0x1a727e){if(_0x1a727e){var _0x5cbe91=typeof _0x6ff241[_0x4233('0x1d')]===_0x4233('0x1e')&&typeof _0x6ff241[_0x4233('0x1f')]===_0x4233('0x1e');var _0x5c332c=_0x1a727e[_0x4233('0x20')];var _0x57ad15=_0x5cbe91?0x0:_0x6ff241[_0x4233('0x1d')];var _0x1ff7e2=_0x5cbe91?_0x1a727e[_0x4233('0x20')]:_0x6ff241[_0x4233('0x1d')]+_0x6ff241[_0x4233('0x1f')];var _0x4c3dc4;if(_0x1ff7e2>=_0x5c332c){_0x1ff7e2=_0x5c332c;_0x4c3dc4=0xc8;}else{_0x4c3dc4=0xce;}_0x28486c['status'](_0x4c3dc4);return _0x28486c['set'](_0x4233('0x21'),_0x57ad15+'-'+_0x1ff7e2+'/'+_0x5c332c)[_0x4233('0x1c')](_0x1a727e);}return null;};}function patchUpdates(_0x3c1035){return function(_0x21b21d){try{jsonpatch[_0x4233('0x22')](_0x21b21d,_0x3c1035,!![]);}catch(_0x372a0e){return BPromise['reject'](_0x372a0e);}return _0x21b21d[_0x4233('0x23')]();};}function saveUpdates(_0x1869a1,_0x1b3ee1){return function(_0x3ab330){if(_0x3ab330){return _0x3ab330[_0x4233('0x24')](_0x1869a1)['then'](function(_0x4381ab){return _0x4381ab;});}return null;};}function removeEntity(_0x16fc8d,_0x1a942c){return function(_0x54c8f5){if(_0x54c8f5){return _0x54c8f5[_0x4233('0x25')]()[_0x4233('0x26')](function(){_0x16fc8d[_0x4233('0x1a')](0xcc)[_0x4233('0x1b')]();});}};}function handleEntityNotFound(_0x2acc59,_0x275982){return function(_0x553596){if(!_0x553596){_0x2acc59[_0x4233('0x19')](0x194);}return _0x553596;};}function handleError(_0x204d92,_0x123813){_0x123813=_0x123813||0x1f4;return function(_0x382e97){logger[_0x4233('0x27')](_0x382e97[_0x4233('0x28')]);if(_0x382e97['name']){delete _0x382e97['name'];}_0x204d92['status'](_0x123813)[_0x4233('0x29')](_0x382e97);};}exports['index']=function(_0x3bffb1,_0x158b3a){var _0xc266b3={},_0x21b37e={},_0x32a90f={'count':0x0,'rows':[]};var _0xa211a9=_[_0x4233('0x2a')](db[_0x4233('0x2b')][_0x4233('0x2c')],function(_0x1a0d59){return{'name':_0x1a0d59['fieldName'],'type':_0x1a0d59[_0x4233('0x2d')][_0x4233('0x2e')]};});_0x21b37e['model']=_[_0x4233('0x2a')](_0xa211a9,_0x4233('0x2f'));_0x21b37e[_0x4233('0x30')]=_['keys'](_0x3bffb1[_0x4233('0x30')]);_0x21b37e[_0x4233('0x31')]=_[_0x4233('0x32')](_0x21b37e[_0x4233('0x33')],_0x21b37e[_0x4233('0x30')]);_0xc266b3['attributes']=_[_0x4233('0x32')](_0x21b37e['model'],qs[_0x4233('0x34')](_0x3bffb1[_0x4233('0x30')][_0x4233('0x34')]));_0xc266b3[_0x4233('0x35')]=_0xc266b3['attributes'][_0x4233('0x36')]?_0xc266b3['attributes']:_0x21b37e[_0x4233('0x33')];if(!_0x3bffb1['query']['hasOwnProperty']('nolimit')){_0xc266b3[_0x4233('0x1f')]=qs['limit'](_0x3bffb1['query'][_0x4233('0x1f')]);_0xc266b3[_0x4233('0x1d')]=qs[_0x4233('0x1d')](_0x3bffb1[_0x4233('0x30')]['offset']);}_0xc266b3[_0x4233('0x37')]=qs[_0x4233('0x38')](_0x3bffb1[_0x4233('0x30')][_0x4233('0x38')]);_0xc266b3[_0x4233('0x39')]=qs['filters'](_[_0x4233('0x3a')](_0x3bffb1['query'],_0x21b37e[_0x4233('0x31')]),_0xa211a9);if(_0x3bffb1[_0x4233('0x30')]['filter']){_0xc266b3['where']=_['merge'](_0xc266b3[_0x4233('0x39')],{'$or':_['map'](_0xa211a9,function(_0x358585){if(_0x358585[_0x4233('0x2d')]!==_0x4233('0x3b')){var _0x783a9c={};_0x783a9c[_0x358585['name']]={'$like':'%'+_0x3bffb1['query']['filter']+'%'};return _0x783a9c;}})});}_0xc266b3=_[_0x4233('0x3c')]({},_0xc266b3,_0x3bffb1[_0x4233('0x3d')]);var _0x25ad79={'where':_0xc266b3[_0x4233('0x39')]};return db[_0x4233('0x2b')][_0x4233('0x20')](_0x25ad79)[_0x4233('0x26')](function(_0x492267){_0x32a90f[_0x4233('0x20')]=_0x492267;if(_0x3bffb1[_0x4233('0x30')][_0x4233('0x3e')]){_0xc266b3[_0x4233('0x3f')]=[{'all':!![]}];}return db[_0x4233('0x2b')][_0x4233('0x40')](_0xc266b3);})['then'](function(_0x867ecf){_0x32a90f[_0x4233('0x41')]=_0x867ecf;return _0x32a90f;})[_0x4233('0x26')](respondWithFilteredResult(_0x158b3a,_0xc266b3))[_0x4233('0x42')](handleError(_0x158b3a,null));};exports[_0x4233('0x43')]=function(_0x2ebfc2,_0x12564f){var _0x51a814={'raw':![],'where':{'id':_0x2ebfc2[_0x4233('0x44')]['id']}},_0x37098f={};_0x37098f['model']=_['keys'](db[_0x4233('0x2b')][_0x4233('0x2c')]);_0x37098f[_0x4233('0x30')]=_[_0x4233('0x45')](_0x2ebfc2[_0x4233('0x30')]);_0x37098f[_0x4233('0x31')]=_['intersection'](_0x37098f[_0x4233('0x33')],_0x37098f[_0x4233('0x30')]);_0x51a814['attributes']=_['intersection'](_0x37098f['model'],qs['fields'](_0x2ebfc2[_0x4233('0x30')][_0x4233('0x34')]));_0x51a814[_0x4233('0x35')]=_0x51a814[_0x4233('0x35')][_0x4233('0x36')]?_0x51a814[_0x4233('0x35')]:_0x37098f[_0x4233('0x33')];if(_0x2ebfc2[_0x4233('0x30')][_0x4233('0x3e')]){_0x51a814['include']=[{'all':!![]}];}_0x51a814=_[_0x4233('0x3c')]({},_0x51a814,_0x2ebfc2[_0x4233('0x3d')]);return db[_0x4233('0x2b')]['find'](_0x51a814)['then'](handleEntityNotFound(_0x12564f,null))['then'](respondWithResult(_0x12564f,null))[_0x4233('0x42')](handleError(_0x12564f,null));};exports['create']=function(_0x2dd585,_0x4cde13){return db[_0x4233('0x2b')][_0x4233('0x46')](_0x2dd585['body'],{})[_0x4233('0x26')](respondWithResult(_0x4cde13,0xc9))[_0x4233('0x42')](handleError(_0x4cde13,null));};exports['update']=function(_0x196c7d,_0x49a4fa){if(_0x196c7d[_0x4233('0x47')]['id']){delete _0x196c7d[_0x4233('0x47')]['id'];}return db[_0x4233('0x2b')]['find']({'where':{'id':_0x196c7d[_0x4233('0x44')]['id']}})[_0x4233('0x26')](handleEntityNotFound(_0x49a4fa,null))[_0x4233('0x26')](saveUpdates(_0x196c7d[_0x4233('0x47')],null))[_0x4233('0x26')](respondWithResult(_0x49a4fa,null))[_0x4233('0x42')](handleError(_0x49a4fa,null));};exports[_0x4233('0x25')]=function(_0x193877,_0x5547b9){return db[_0x4233('0x2b')][_0x4233('0x48')]({'where':{'id':_0x193877[_0x4233('0x44')]['id']}})['then'](handleEntityNotFound(_0x5547b9,null))[_0x4233('0x26')](removeEntity(_0x5547b9,null))[_0x4233('0x42')](handleError(_0x5547b9,null));};exports[_0x4233('0x49')]=function(_0xc085f6,_0x553a96,_0xe26d6b){var _0x323b0d={};var _0x158216={};var _0x361031;var _0x51717d;return db[_0x4233('0x2b')][_0x4233('0x4a')]({'where':{'id':_0xc085f6[_0x4233('0x44')]['id']}})['then'](handleEntityNotFound(_0x553a96,null))[_0x4233('0x26')](function(_0x135088){if(_0x135088){_0x361031=_0x135088;_0x158216[_0x4233('0x33')]=_['keys'](db[_0x4233('0x4b')]['rawAttributes']);_0x158216['query']=_[_0x4233('0x45')](_0xc085f6[_0x4233('0x30')]);_0x158216['filters']=_[_0x4233('0x32')](_0x158216[_0x4233('0x33')],_0x158216[_0x4233('0x30')]);_0x323b0d[_0x4233('0x35')]=_['intersection'](_0x158216[_0x4233('0x33')],qs[_0x4233('0x34')](_0xc085f6[_0x4233('0x30')][_0x4233('0x34')]));_0x323b0d[_0x4233('0x35')]=_0x323b0d['attributes']['length']?_0x323b0d[_0x4233('0x35')]:_0x158216['model'];_0x323b0d[_0x4233('0x37')]=qs[_0x4233('0x38')](_0xc085f6['query']['sort']);_0x323b0d[_0x4233('0x39')]=qs[_0x4233('0x31')](_[_0x4233('0x3a')](_0xc085f6[_0x4233('0x30')],_0x158216[_0x4233('0x31')]));if(_0xc085f6['query'][_0x4233('0x4c')]){_0x323b0d['where']=_[_0x4233('0x3c')](_0x323b0d[_0x4233('0x39')],{'$or':_[_0x4233('0x2a')](_0x323b0d['attributes'],function(_0x38d5a0){var _0x480785={};_0x480785[_0x38d5a0]={'$like':'%'+_0xc085f6[_0x4233('0x30')]['filter']+'%'};return _0x480785;})});}_0x323b0d=_[_0x4233('0x3c')]({},_0x323b0d,_0xc085f6[_0x4233('0x3d')]);return _0x361031[_0x4233('0x49')](_0x323b0d);}})[_0x4233('0x26')](function(_0x32b04c){if(_0x32b04c){_0x51717d=_0x32b04c[_0x4233('0x36')];if(!_0xc085f6[_0x4233('0x30')]['hasOwnProperty']('nolimit')){_0x323b0d['limit']=qs[_0x4233('0x1f')](_0xc085f6[_0x4233('0x30')][_0x4233('0x1f')]);_0x323b0d['offset']=qs[_0x4233('0x1d')](_0xc085f6[_0x4233('0x30')][_0x4233('0x1d')]);}return _0x361031['getConfigurations'](_0x323b0d);}})[_0x4233('0x26')](function(_0x414d80){if(_0x414d80){return _0x414d80?{'count':_0x51717d,'rows':_0x414d80}:null;}})[_0x4233('0x26')](respondWithResult(_0x553a96,null))[_0x4233('0x42')](handleError(_0x553a96,null));};exports['addConfiguration']=function(_0x414a46,_0x2b8d04,_0x11e16c){if(_0x414a46[_0x4233('0x47')]['id']){delete _0x414a46[_0x4233('0x47')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x414a46['params']['id']}})['then'](handleEntityNotFound(_0x2b8d04,null))[_0x4233('0x26')](function(_0x5ca793){if(_0x5ca793){_0x414a46[_0x4233('0x47')]['AccountId']=_0x5ca793['id'];_0x414a46[_0x4233('0x47')][_0x4233('0x4d')]=integrations['getSubjects'](_0x414a46['body']['channel'],_0x414a46[_0x4233('0x47')][_0x4233('0x2d')]);_0x414a46[_0x4233('0x47')][_0x4233('0x4e')]=integrations[_0x4233('0x4f')](_0x414a46[_0x4233('0x47')][_0x4233('0x50')],_0x414a46[_0x4233('0x47')]['type']);return db[_0x4233('0x4b')][_0x4233('0x46')](_0x414a46[_0x4233('0x47')],{'include':[{'model':db[_0x4233('0x51')],'as':_0x4233('0x4d')},{'model':db[_0x4233('0x51')],'as':_0x4233('0x4e')}]});}return null;})['then'](respondWithResult(_0x2b8d04,null))['catch'](handleError(_0x2b8d04,null));};exports[_0x4233('0x52')]=function(_0x25f1c8,_0x5edac2,_0x4c29bd){var _0x2f0833='';var _0x1384ca=['id',_0x4233('0x2f'),_0x4233('0x53'),'created_by','description',_0x4233('0x54'),_0x4233('0x55'),_0x4233('0x56'),_0x4233('0x57'),_0x4233('0x58'),_0x4233('0x59'),'direction'];return db['SugarcrmAccount'][_0x4233('0x4a')]({'where':{'id':_0x25f1c8['params']['id']},'attributes':['id',_0x4233('0x5a'),_0x4233('0x5b'),_0x4233('0x5c')]})['then'](handleEntityNotFound(_0x5edac2,null))[_0x4233('0x26')](function(_0x567b55){if(_0x567b55){_0x2f0833=_0x567b55[_0x4233('0x5c')];var _0x38a2fe=_0x2f0833['slice'](-0x1);if(_0x38a2fe==='/'){_0x2f0833=_0x2f0833['substring'](0x0,_0x2f0833['lastIndexOf'](_0x38a2fe));}return rp({'method':_0x4233('0x5d'),'uri':util[_0x4233('0x5e')](_0x4233('0x5f'),_0x2f0833,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x4233('0x60'),'input_type':_0x4233('0x61'),'response_type':_0x4233('0x61'),'rest_data':JSON[_0x4233('0x62')]({'user_auth':{'user_name':_0x567b55['username'],'password':_0x567b55[_0x4233('0x5b')],'encryption':_0x4233('0x63')},'application':_0x4233('0x64')})}});}})['then'](function(_0x42b762){if(_0x42b762&&_0x42b762['name']!==_0x4233('0x65')&&_0x42b762['name']!=='Password\x20Expired'){return rp({'method':_0x4233('0x5d'),'uri':util['format'](_0x4233('0x5f'),_0x2f0833,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x4233('0x66'),'input_type':'JSON','response_type':_0x4233('0x61'),'rest_data':JSON[_0x4233('0x62')]({'session':_0x42b762['id'],'module_name':_0x4233('0x67')})}})[_0x4233('0x26')](function(_0x19d360){if(_0x19d360){var _0x2fe14c=_[_0x4233('0x68')](_0x19d360[_0x4233('0x69')]);_[_0x4233('0x6a')](_0x2fe14c,function(_0x2bc258){return _0x1384ca[_0x4233('0x6b')](_0x2bc258['name']);});return{'count':_0x2fe14c[_0x4233('0x36')],'rows':_[_0x4233('0x2a')](_0x2fe14c,function(_0x24c14f){return{'id':_0x24c14f['name'],'name':_0x24c14f[_0x4233('0x6c')],'custom':_[_0x4233('0x6d')](_0x24c14f[_0x4233('0x2f')],'_c')?!![]:![],'options':_0x24c14f[_0x4233('0x3d')]?_[_0x4233('0x2a')](_[_0x4233('0x68')](_0x24c14f[_0x4233('0x3d')]),function(_0x1d3134){return{'name':_0x1d3134['value'],'value':_0x1d3134[_0x4233('0x2f')]};}):[]};})};}})[_0x4233('0x26')](respondWithResult(_0x5edac2,null))[_0x4233('0x42')](function(_0x247b02){var _0x1acdb8=_0x25f1c8['query'][_0x4233('0x6e')]?0x1f4:_0x247b02[_0x4233('0x6f')]||0x1f4;logger[_0x4233('0x27')](_0x4233('0x70'),_0x4233('0x52'),_0x1acdb8,JSON[_0x4233('0x62')](_0x247b02));delete _0x247b02[_0x4233('0x2f')];if(_0x1acdb8===0x191){_0x1acdb8=0x190;}_0x5edac2['status'](_0x1acdb8)[_0x4233('0x29')](_0x25f1c8[_0x4233('0x30')][_0x4233('0x6e')]?{'message':_0x4233('0x71'),'statusCode':_0x247b02[_0x4233('0x6f')]}:_0x247b02);});}else{var _0x450ec2=0x1f4;_0x5edac2[_0x4233('0x1a')](_0x450ec2)[_0x4233('0x29')]({'message':_0x4233('0x71'),'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 eaf9b42..3756144 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 _0xfecc=['exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x533176,_0xc60118){var _0x22ec6d=function(_0x17441d){while(--_0x17441d){_0x533176['push'](_0x533176['shift']());}};_0x22ec6d(++_0xc60118);}(_0xfecc,0x107));var _0xcfec=function(_0x11742c,_0x421caa){_0x11742c=_0x11742c-0x0;var _0x1dc91b=_0xfecc[_0x11742c];return _0x1dc91b;};'use strict';var _=require(_0xcfec('0x0'));var util=require(_0xcfec('0x1'));var logger=require(_0xcfec('0x2'))(_0xcfec('0x3'));var moment=require(_0xcfec('0x4'));var BPromise=require(_0xcfec('0x5'));var rp=require(_0xcfec('0x6'));var fs=require('fs');var path=require(_0xcfec('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcfec('0x8'));var integrations=require(_0xcfec('0x9'));module[_0xcfec('0xa')]=function(_0x2f84e9,_0x4c387e){return _0x2f84e9['define'](_0xcfec('0xb'),attributes,{'tableName':_0xcfec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x532e=['exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x115ef0,_0x5a83b2){var _0x420f5a=function(_0x102b2d){while(--_0x102b2d){_0x115ef0['push'](_0x115ef0['shift']());}};_0x420f5a(++_0x5a83b2);}(_0x532e,0xb8));var _0xe532=function(_0x2b825a,_0x2f007e){_0x2b825a=_0x2b825a-0x0;var _0x9bd7b1=_0x532e[_0x2b825a];return _0x9bd7b1;};'use strict';var _=require(_0xe532('0x0'));var util=require(_0xe532('0x1'));var logger=require(_0xe532('0x2'))(_0xe532('0x3'));var moment=require(_0xe532('0x4'));var BPromise=require(_0xe532('0x5'));var rp=require(_0xe532('0x6'));var fs=require('fs');var path=require(_0xe532('0x7'));var rimraf=require(_0xe532('0x8'));var config=require(_0xe532('0x9'));var attributes=require(_0xe532('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xe532('0xb')]=function(_0x169f71,_0x7987f2){return _0x169f71[_0xe532('0xc')](_0xe532('0xd'),attributes,{'tableName':_0xe532('0xe'),'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 89d2786..af806ac 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 _0x563e=['client','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowSugarcrmAccount','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfd1bc5,_0x175155){var _0x17d0eb=function(_0x18afe4){while(--_0x18afe4){_0xfd1bc5['push'](_0xfd1bc5['shift']());}};_0x17d0eb(++_0x175155);}(_0x563e,0xeb));var _0xe563=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x563e[_0x25df80];return _0x17b6d0;};'use strict';var _=require(_0xe563('0x0'));var util=require('util');var moment=require(_0xe563('0x1'));var BPromise=require(_0xe563('0x2'));var rs=require(_0xe563('0x3'));var fs=require('fs');var Redis=require(_0xe563('0x4'));var db=require(_0xe563('0x5'))['db'];var utils=require(_0xe563('0x6'));var logger=require(_0xe563('0x7'))(_0xe563('0x8'));var config=require(_0xe563('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe563('0xa')][_0xe563('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x574099,_0x1932a0,_0x3e5710){return new BPromise(function(_0x38964e,_0x13a012){return client['request'](_0x574099,_0x3e5710)['then'](function(_0xf09ec2){logger[_0xe563('0xc')](_0xe563('0xd'),_0x1932a0,_0xe563('0xe'));logger[_0xe563('0xf')](_0xe563('0x10'),_0x1932a0,_0xe563('0xe'),JSON['stringify'](_0xf09ec2));if(_0xf09ec2['error']){if(_0xf09ec2['error'][_0xe563('0x11')]===0x1f4){logger[_0xe563('0x12')](_0xe563('0xd'),_0x1932a0,_0xf09ec2[_0xe563('0x12')][_0xe563('0x13')]);return _0x13a012(_0xf09ec2[_0xe563('0x12')]['message']);}logger[_0xe563('0x12')](_0xe563('0xd'),_0x1932a0,_0xf09ec2[_0xe563('0x12')][_0xe563('0x13')]);return _0x38964e(_0xf09ec2[_0xe563('0x12')]['message']);}else{logger[_0xe563('0xc')](_0xe563('0xd'),_0x1932a0,_0xe563('0xe'));_0x38964e(_0xf09ec2[_0xe563('0x14')]['message']);}})[_0xe563('0x15')](function(_0x4f498f){logger[_0xe563('0x12')](_0xe563('0xd'),_0x1932a0,_0x4f498f);_0x13a012(_0x4f498f);});});}exports[_0xe563('0x16')]=function(_0x279ef0){var _0x2a4bf2=this;return new Promise(function(_0x26bf97,_0x46fbf0){return db[_0xe563('0x17')][_0xe563('0x18')]({'raw':_0x279ef0[_0xe563('0x19')]?_0x279ef0[_0xe563('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x279ef0[_0xe563('0x19')]?_0x279ef0['options'][_0xe563('0x1a')]||null:null,'attributes':_0x279ef0[_0xe563('0x19')]?_0x279ef0[_0xe563('0x19')][_0xe563('0x1b')]||null:null,'limit':_0x279ef0[_0xe563('0x19')]?_0x279ef0[_0xe563('0x19')][_0xe563('0x1c')]||null:null,'include':_0x279ef0[_0xe563('0x19')]?_0x279ef0[_0xe563('0x19')][_0xe563('0x1d')]?_[_0xe563('0x1e')](_0x279ef0[_0xe563('0x19')]['include'],function(_0x207ab8){return{'model':db[_0x207ab8[_0xe563('0x1f')]],'as':_0x207ab8['as'],'attributes':_0x207ab8['attributes'],'include':_0x207ab8[_0xe563('0x1d')]?_['map'](_0x207ab8[_0xe563('0x1d')],function(_0x3037fe){return{'model':db[_0x3037fe[_0xe563('0x1f')]],'as':_0x3037fe['as'],'attributes':_0x3037fe[_0xe563('0x1b')],'include':_0x3037fe[_0xe563('0x1d')]?_['map'](_0x3037fe['include'],function(_0x5cea20){return{'model':db[_0x5cea20[_0xe563('0x1f')]],'as':_0x5cea20['as'],'attributes':_0x5cea20['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x38b852){logger[_0xe563('0xc')](_0xe563('0x16'),_0x279ef0);logger[_0xe563('0xf')](_0xe563('0x16'),_0x279ef0,JSON[_0xe563('0x20')](_0x38b852));_0x26bf97(_0x38b852);})[_0xe563('0x15')](function(_0x34e8a9){logger[_0xe563('0x12')](_0xe563('0x16'),_0x34e8a9[_0xe563('0x13')],_0x279ef0);_0x46fbf0(_0x2a4bf2['error'](0x1f4,_0x34e8a9[_0xe563('0x13')]));});});};exports[_0xe563('0x21')]=function(_0x431687){var _0x4c0875=this;return new Promise(function(_0x105f83,_0x5ea8eb){return db[_0xe563('0x17')]['find']({'raw':_0x431687[_0xe563('0x19')]?_0x431687[_0xe563('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x431687[_0xe563('0x19')]?_0x431687[_0xe563('0x19')][_0xe563('0x1a')]||null:null,'attributes':_0x431687[_0xe563('0x19')]?_0x431687[_0xe563('0x19')][_0xe563('0x1b')]||null:null,'include':_0x431687['options']?_0x431687[_0xe563('0x19')][_0xe563('0x1d')]?_[_0xe563('0x1e')](_0x431687[_0xe563('0x19')][_0xe563('0x1d')],function(_0x1e6ef6){return{'model':db[_0x1e6ef6[_0xe563('0x1f')]],'as':_0x1e6ef6['as'],'attributes':_0x1e6ef6[_0xe563('0x1b')],'include':_0x1e6ef6['include']?_[_0xe563('0x1e')](_0x1e6ef6[_0xe563('0x1d')],function(_0x19fc37){return{'model':db[_0x19fc37[_0xe563('0x1f')]],'as':_0x19fc37['as'],'attributes':_0x19fc37[_0xe563('0x1b')],'include':_0x19fc37['include']?_[_0xe563('0x1e')](_0x19fc37[_0xe563('0x1d')],function(_0x5942b5){return{'model':db[_0x5942b5[_0xe563('0x1f')]],'as':_0x5942b5['as'],'attributes':_0x5942b5[_0xe563('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe563('0x22')](function(_0x22cfde){logger['info'](_0xe563('0x21'),_0x431687);logger[_0xe563('0xf')](_0xe563('0x21'),_0x431687,JSON[_0xe563('0x20')](_0x22cfde));_0x105f83(_0x22cfde);})[_0xe563('0x15')](function(_0x346654){logger[_0xe563('0x12')](_0xe563('0x21'),_0x346654[_0xe563('0x13')],_0x431687);_0x5ea8eb(_0x4c0875[_0xe563('0x12')](0x1f4,_0x346654[_0xe563('0x13')]));});});}; \ No newline at end of file +var _0x48e9=['catch','find','ShowSugarcrmAccount','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','GetSugarcrmAccount','findAll','options','where','attributes','limit','map','include','model','debug','stringify'];(function(_0x2e39e8,_0xd7987e){var _0x2e1a83=function(_0x5f213b){while(--_0x5f213b){_0x2e39e8['push'](_0x2e39e8['shift']());}};_0x2e1a83(++_0xd7987e);}(_0x48e9,0xea));var _0x948e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48e9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x948e('0x0'));var moment=require(_0x948e('0x1'));var BPromise=require('bluebird');var rs=require(_0x948e('0x2'));var fs=require('fs');var Redis=require(_0x948e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x948e('0x4'))(_0x948e('0x5'));var config=require(_0x948e('0x6'));var jayson=require(_0x948e('0x7'));var client=jayson[_0x948e('0x8')][_0x948e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x551691,_0x285cbc,_0x302846){return new BPromise(function(_0xeef493,_0x301262){return client[_0x948e('0xa')](_0x551691,_0x302846)[_0x948e('0xb')](function(_0xd5d0e9){logger['info'](_0x948e('0xc'),_0x285cbc,_0x948e('0xd'));logger['debug'](_0x948e('0xe'),_0x285cbc,_0x948e('0xd'),JSON['stringify'](_0xd5d0e9));if(_0xd5d0e9['error']){if(_0xd5d0e9[_0x948e('0xf')]['code']===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x285cbc,_0xd5d0e9[_0x948e('0xf')][_0x948e('0x10')]);return _0x301262(_0xd5d0e9[_0x948e('0xf')][_0x948e('0x10')]);}logger[_0x948e('0xf')](_0x948e('0xc'),_0x285cbc,_0xd5d0e9['error'][_0x948e('0x10')]);return _0xeef493(_0xd5d0e9[_0x948e('0xf')][_0x948e('0x10')]);}else{logger[_0x948e('0x11')](_0x948e('0xc'),_0x285cbc,_0x948e('0xd'));_0xeef493(_0xd5d0e9[_0x948e('0x12')][_0x948e('0x10')]);}})['catch'](function(_0x13dff4){logger[_0x948e('0xf')](_0x948e('0xc'),_0x285cbc,_0x13dff4);_0x301262(_0x13dff4);});});}exports[_0x948e('0x13')]=function(_0x36de05){var _0x1bb7ad=this;return new Promise(function(_0x5c5107,_0x12a91d){return db['SugarcrmAccount'][_0x948e('0x14')]({'raw':_0x36de05[_0x948e('0x15')]?_0x36de05['options']['raw']===undefined?!![]:![]:!![],'where':_0x36de05['options']?_0x36de05['options'][_0x948e('0x16')]||null:null,'attributes':_0x36de05[_0x948e('0x15')]?_0x36de05[_0x948e('0x15')][_0x948e('0x17')]||null:null,'limit':_0x36de05[_0x948e('0x15')]?_0x36de05[_0x948e('0x15')][_0x948e('0x18')]||null:null,'include':_0x36de05[_0x948e('0x15')]?_0x36de05[_0x948e('0x15')]['include']?_[_0x948e('0x19')](_0x36de05[_0x948e('0x15')]['include'],function(_0x32a25e){return{'model':db[_0x32a25e['model']],'as':_0x32a25e['as'],'attributes':_0x32a25e[_0x948e('0x17')],'include':_0x32a25e[_0x948e('0x1a')]?_['map'](_0x32a25e['include'],function(_0xf3f876){return{'model':db[_0xf3f876['model']],'as':_0xf3f876['as'],'attributes':_0xf3f876[_0x948e('0x17')],'include':_0xf3f876[_0x948e('0x1a')]?_['map'](_0xf3f876[_0x948e('0x1a')],function(_0x20c5f1){return{'model':db[_0x20c5f1[_0x948e('0x1b')]],'as':_0x20c5f1['as'],'attributes':_0x20c5f1[_0x948e('0x17')]};}):[]};}):[]};}):[]:[]})[_0x948e('0xb')](function(_0xcc3c65){logger[_0x948e('0x11')](_0x948e('0x13'),_0x36de05);logger[_0x948e('0x1c')](_0x948e('0x13'),_0x36de05,JSON[_0x948e('0x1d')](_0xcc3c65));_0x5c5107(_0xcc3c65);})[_0x948e('0x1e')](function(_0x5e7add){logger['error'](_0x948e('0x13'),_0x5e7add[_0x948e('0x10')],_0x36de05);_0x12a91d(_0x1bb7ad['error'](0x1f4,_0x5e7add[_0x948e('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0x1f90fb){var _0x3df974=this;return new Promise(function(_0x154b3b,_0xc669d){return db['SugarcrmAccount'][_0x948e('0x1f')]({'raw':_0x1f90fb[_0x948e('0x15')]?_0x1f90fb[_0x948e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1f90fb[_0x948e('0x15')]?_0x1f90fb[_0x948e('0x15')][_0x948e('0x16')]||null:null,'attributes':_0x1f90fb[_0x948e('0x15')]?_0x1f90fb[_0x948e('0x15')]['attributes']||null:null,'include':_0x1f90fb['options']?_0x1f90fb['options'][_0x948e('0x1a')]?_[_0x948e('0x19')](_0x1f90fb[_0x948e('0x15')]['include'],function(_0x2711f5){return{'model':db[_0x2711f5[_0x948e('0x1b')]],'as':_0x2711f5['as'],'attributes':_0x2711f5[_0x948e('0x17')],'include':_0x2711f5[_0x948e('0x1a')]?_[_0x948e('0x19')](_0x2711f5['include'],function(_0x37e9db){return{'model':db[_0x37e9db[_0x948e('0x1b')]],'as':_0x37e9db['as'],'attributes':_0x37e9db['attributes'],'include':_0x37e9db[_0x948e('0x1a')]?_[_0x948e('0x19')](_0x37e9db[_0x948e('0x1a')],function(_0x553e03){return{'model':db[_0x553e03[_0x948e('0x1b')]],'as':_0x553e03['as'],'attributes':_0x553e03[_0x948e('0x17')]};}):[]};}):[]};}):[]:[]})[_0x948e('0xb')](function(_0x4f8db8){logger[_0x948e('0x11')](_0x948e('0x20'),_0x1f90fb);logger['debug']('ShowSugarcrmAccount',_0x1f90fb,JSON[_0x948e('0x1d')](_0x4f8db8));_0x154b3b(_0x4f8db8);})[_0x948e('0x1e')](function(_0x397da3){logger[_0x948e('0xf')](_0x948e('0x20'),_0x397da3[_0x948e('0x10')],_0x1f90fb);_0xc669d(_0x3df974[_0x948e('0xf')](0x1f4,_0x397da3[_0x948e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a6bd3dc..dda7b10 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 _0x87d9=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','/:id','update','delete','destroy'];(function(_0x162305,_0xb6fe6f){var _0x366761=function(_0x4e6025){while(--_0x4e6025){_0x162305['push'](_0x162305['shift']());}};_0x366761(++_0xb6fe6f);}(_0x87d9,0x93));var _0x987d=function(_0x1c223c,_0x3cef2f){_0x1c223c=_0x1c223c-0x0;var _0x141766=_0x87d9[_0x1c223c];return _0x141766;};'use strict';var multer=require(_0x987d('0x0'));var util=require(_0x987d('0x1'));var path=require(_0x987d('0x2'));var timeout=require(_0x987d('0x3'));var express=require('express');var router=express[_0x987d('0x4')]();var fs_extra=require(_0x987d('0x5'));var auth=require(_0x987d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x987d('0x7'));router['get']('/',auth[_0x987d('0x8')](),controller[_0x987d('0x9')]);router[_0x987d('0xa')]('/:id',auth[_0x987d('0x8')](),controller[_0x987d('0xb')]);router[_0x987d('0xa')](_0x987d('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x987d('0xa')](_0x987d('0xd'),auth[_0x987d('0x8')](),controller[_0x987d('0xe')]);router[_0x987d('0xa')]('/:id/descriptions',auth[_0x987d('0x8')](),controller[_0x987d('0xf')]);router[_0x987d('0x10')]('/',auth[_0x987d('0x8')](),controller['create']);router['put'](_0x987d('0x11'),auth[_0x987d('0x8')](),controller[_0x987d('0x12')]);router[_0x987d('0x13')](_0x987d('0x11'),auth[_0x987d('0x8')](),controller[_0x987d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x73e0=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x5594bc,_0x211372){var _0x4ffd54=function(_0x254900){while(--_0x254900){_0x5594bc['push'](_0x5594bc['shift']());}};_0x4ffd54(++_0x211372);}(_0x73e0,0x1ae));var _0x073e=function(_0x1509b8,_0x47154f){_0x1509b8=_0x1509b8-0x0;var _0x60f3c8=_0x73e0[_0x1509b8];return _0x60f3c8;};'use strict';var multer=require('multer');var util=require(_0x073e('0x0'));var path=require(_0x073e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x073e('0x2'));var auth=require(_0x073e('0x3'));var interaction=require(_0x073e('0x4'));var config=require(_0x073e('0x5'));var controller=require(_0x073e('0x6'));router[_0x073e('0x7')]('/',auth[_0x073e('0x8')](),controller[_0x073e('0x9')]);router[_0x073e('0x7')](_0x073e('0xa'),auth[_0x073e('0x8')](),controller[_0x073e('0xb')]);router[_0x073e('0x7')](_0x073e('0xc'),auth[_0x073e('0x8')](),controller[_0x073e('0xd')]);router[_0x073e('0x7')](_0x073e('0xe'),auth['isAuthenticated'](),controller[_0x073e('0xf')]);router[_0x073e('0x7')](_0x073e('0x10'),auth[_0x073e('0x8')](),controller[_0x073e('0x11')]);router[_0x073e('0x12')]('/',auth[_0x073e('0x8')](),controller[_0x073e('0x13')]);router[_0x073e('0x14')](_0x073e('0xa'),auth[_0x073e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x073e('0x15')]);module[_0x073e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index dd17bf2..937cd87 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 _0xd293=['STRING','sequelize'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xd293,0xb1));var _0x3d29=function(_0x2830d8,_0x3f31f4){_0x2830d8=_0x2830d8-0x0;var _0x58541c=_0xd293[_0x2830d8];return _0x58541c;};'use strict';var Sequelize=require(_0x3d29('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d29('0x1')]},'description':{'type':Sequelize[_0x3d29('0x1')]}}; \ No newline at end of file +var _0x0d92=['STRING','sequelize','exports'];(function(_0x2fea2b,_0x1f8033){var _0x5ab3a6=function(_0x35da13){while(--_0x35da13){_0x2fea2b['push'](_0x2fea2b['shift']());}};_0x5ab3a6(++_0x1f8033);}(_0x0d92,0x1f0));var _0x20d9=function(_0x4edcee,_0xb227){_0x4edcee=_0x4edcee-0x0;var _0x77cf86=_0x0d92[_0x4edcee];return _0x77cf86;};'use strict';var Sequelize=require(_0x20d9('0x0'));module[_0x20d9('0x1')]={'name':{'type':Sequelize[_0x20d9('0x2')]},'description':{'type':Sequelize[_0x20d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 766ce1e..83d4e0f 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 _0xb85d=['type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SugarcrmConfiguration','include','rows','catch','params','rawAttributes','includeAll','find','create','body','getFields','findOne','SugarcrmField','pick','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','fieldName'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xb85d,0x19e));var _0xdb85=function(_0x5071dc,_0x1f2cee){_0x5071dc=_0x5071dc-0x0;var _0x12d1d7=_0xb85d[_0x5071dc];return _0x12d1d7;};'use strict';var emlformat=require(_0xdb85('0x0'));var rimraf=require(_0xdb85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb85('0x2'));var rp=require('request-promise');var moment=require(_0xdb85('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdb85('0x4'));var util=require(_0xdb85('0x5'));var path=require(_0xdb85('0x6'));var sox=require(_0xdb85('0x7'));var csv=require('to-csv');var ejs=require(_0xdb85('0x8'));var fs=require('fs');var fs_extra=require(_0xdb85('0x9'));var _=require(_0xdb85('0xa'));var squel=require(_0xdb85('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb85('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb85('0xd'));var Papa=require('papaparse');var Redis=require(_0xdb85('0xe'));var authService=require(_0xdb85('0xf'));var qs=require(_0xdb85('0x10'));var as=require(_0xdb85('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb85('0x12'))(_0xdb85('0x13'));var utils=require('../../config/utils');var config=require(_0xdb85('0x14'));var licenseUtil=require(_0xdb85('0x15'));var db=require(_0xdb85('0x16'))['db'];function respondWithStatusCode(_0x2f18a0,_0x18aa9b){_0x18aa9b=_0x18aa9b||0xcc;return function(_0x3e6c47){if(_0x3e6c47){return _0x2f18a0['sendStatus'](_0x18aa9b);}return _0x2f18a0[_0xdb85('0x17')](_0x18aa9b)[_0xdb85('0x18')]();};}function respondWithResult(_0x3f506d,_0x51b5fe){_0x51b5fe=_0x51b5fe||0xc8;return function(_0x35e5ba){if(_0x35e5ba){return _0x3f506d['status'](_0x51b5fe)['json'](_0x35e5ba);}};}function respondWithFilteredResult(_0x10f4ff,_0x1669aa){return function(_0x2bc238){if(_0x2bc238){var _0x4bdeb4=typeof _0x1669aa[_0xdb85('0x19')]===_0xdb85('0x1a')&&typeof _0x1669aa[_0xdb85('0x1b')]===_0xdb85('0x1a');var _0x188b4b=_0x2bc238[_0xdb85('0x1c')];var _0x3e7501=_0x4bdeb4?0x0:_0x1669aa[_0xdb85('0x19')];var _0x38002c=_0x4bdeb4?_0x2bc238[_0xdb85('0x1c')]:_0x1669aa['offset']+_0x1669aa['limit'];var _0x32cdeb;if(_0x38002c>=_0x188b4b){_0x38002c=_0x188b4b;_0x32cdeb=0xc8;}else{_0x32cdeb=0xce;}_0x10f4ff[_0xdb85('0x17')](_0x32cdeb);return _0x10f4ff['set']('Content-Range',_0x3e7501+'-'+_0x38002c+'/'+_0x188b4b)[_0xdb85('0x1d')](_0x2bc238);}return null;};}function patchUpdates(_0xfcbe46){return function(_0x25f50b){try{jsonpatch[_0xdb85('0x1e')](_0x25f50b,_0xfcbe46,!![]);}catch(_0x5aba63){return BPromise[_0xdb85('0x1f')](_0x5aba63);}return _0x25f50b[_0xdb85('0x20')]();};}function saveUpdates(_0x24995c,_0x583eba){return function(_0x298f29){if(_0x298f29){return _0x298f29[_0xdb85('0x21')](_0x24995c)[_0xdb85('0x22')](function(_0x3d4722){return _0x3d4722;});}return null;};}function removeEntity(_0x1b15ca,_0xb87f03){return function(_0x4079b5){if(_0x4079b5){return _0x4079b5[_0xdb85('0x23')]()['then'](function(){_0x1b15ca[_0xdb85('0x17')](0xcc)[_0xdb85('0x18')]();});}};}function handleEntityNotFound(_0x31d9b7,_0x49ebef){return function(_0x490a75){if(!_0x490a75){_0x31d9b7[_0xdb85('0x24')](0x194);}return _0x490a75;};}function handleError(_0x34d609,_0x3aaf79){_0x3aaf79=_0x3aaf79||0x1f4;return function(_0x54da7a){logger['error'](_0x54da7a['stack']);if(_0x54da7a[_0xdb85('0x25')]){delete _0x54da7a[_0xdb85('0x25')];}_0x34d609['status'](_0x3aaf79)[_0xdb85('0x26')](_0x54da7a);};}exports[_0xdb85('0x27')]=function(_0x121e93,_0x596070){var _0xa70a63={},_0x4959cd={},_0x147cfb={'count':0x0,'rows':[]};var _0xcece5d=_[_0xdb85('0x28')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x21f86f){return{'name':_0x21f86f[_0xdb85('0x29')],'type':_0x21f86f[_0xdb85('0x2a')]['key']};});_0x4959cd[_0xdb85('0x2b')]=_[_0xdb85('0x28')](_0xcece5d,_0xdb85('0x25'));_0x4959cd[_0xdb85('0x2c')]=_[_0xdb85('0x2d')](_0x121e93['query']);_0x4959cd[_0xdb85('0x2e')]=_['intersection'](_0x4959cd['model'],_0x4959cd[_0xdb85('0x2c')]);_0xa70a63[_0xdb85('0x2f')]=_[_0xdb85('0x30')](_0x4959cd[_0xdb85('0x2b')],qs[_0xdb85('0x31')](_0x121e93['query'][_0xdb85('0x31')]));_0xa70a63[_0xdb85('0x2f')]=_0xa70a63[_0xdb85('0x2f')][_0xdb85('0x32')]?_0xa70a63[_0xdb85('0x2f')]:_0x4959cd[_0xdb85('0x2b')];if(!_0x121e93[_0xdb85('0x2c')]['hasOwnProperty'](_0xdb85('0x33'))){_0xa70a63[_0xdb85('0x1b')]=qs['limit'](_0x121e93[_0xdb85('0x2c')]['limit']);_0xa70a63[_0xdb85('0x19')]=qs[_0xdb85('0x19')](_0x121e93[_0xdb85('0x2c')][_0xdb85('0x19')]);}_0xa70a63[_0xdb85('0x34')]=qs[_0xdb85('0x35')](_0x121e93[_0xdb85('0x2c')]['sort']);_0xa70a63[_0xdb85('0x36')]=qs[_0xdb85('0x2e')](_['pick'](_0x121e93['query'],_0x4959cd[_0xdb85('0x2e')]),_0xcece5d);if(_0x121e93['query'][_0xdb85('0x37')]){_0xa70a63['where']=_['merge'](_0xa70a63[_0xdb85('0x36')],{'$or':_[_0xdb85('0x28')](_0xcece5d,function(_0x9acf6e){if(_0x9acf6e[_0xdb85('0x2a')]!==_0xdb85('0x38')){var _0x17a7b9={};_0x17a7b9[_0x9acf6e['name']]={'$like':'%'+_0x121e93[_0xdb85('0x2c')][_0xdb85('0x37')]+'%'};return _0x17a7b9;}})});}_0xa70a63=_[_0xdb85('0x39')]({},_0xa70a63,_0x121e93[_0xdb85('0x3a')]);var _0x2a3c27={'where':_0xa70a63['where']};return db[_0xdb85('0x3b')][_0xdb85('0x1c')](_0x2a3c27)[_0xdb85('0x22')](function(_0x30589a){_0x147cfb['count']=_0x30589a;if(_0x121e93['query']['includeAll']){_0xa70a63[_0xdb85('0x3c')]=[{'all':!![]}];}return db[_0xdb85('0x3b')]['findAll'](_0xa70a63);})[_0xdb85('0x22')](function(_0x1418d2){_0x147cfb[_0xdb85('0x3d')]=_0x1418d2;return _0x147cfb;})[_0xdb85('0x22')](respondWithFilteredResult(_0x596070,_0xa70a63))[_0xdb85('0x3e')](handleError(_0x596070,null));};exports['show']=function(_0x329bea,_0xa59771){var _0x43ac10={'raw':![],'where':{'id':_0x329bea[_0xdb85('0x3f')]['id']}},_0x38c5f9={};_0x38c5f9[_0xdb85('0x2b')]=_[_0xdb85('0x2d')](db['SugarcrmConfiguration'][_0xdb85('0x40')]);_0x38c5f9['query']=_[_0xdb85('0x2d')](_0x329bea[_0xdb85('0x2c')]);_0x38c5f9[_0xdb85('0x2e')]=_[_0xdb85('0x30')](_0x38c5f9[_0xdb85('0x2b')],_0x38c5f9[_0xdb85('0x2c')]);_0x43ac10['attributes']=_[_0xdb85('0x30')](_0x38c5f9[_0xdb85('0x2b')],qs[_0xdb85('0x31')](_0x329bea[_0xdb85('0x2c')][_0xdb85('0x31')]));_0x43ac10[_0xdb85('0x2f')]=_0x43ac10['attributes'][_0xdb85('0x32')]?_0x43ac10[_0xdb85('0x2f')]:_0x38c5f9['model'];if(_0x329bea[_0xdb85('0x2c')][_0xdb85('0x41')]){_0x43ac10[_0xdb85('0x3c')]=[{'all':!![]}];}_0x43ac10=_[_0xdb85('0x39')]({},_0x43ac10,_0x329bea[_0xdb85('0x3a')]);return db[_0xdb85('0x3b')][_0xdb85('0x42')](_0x43ac10)[_0xdb85('0x22')](handleEntityNotFound(_0xa59771,null))[_0xdb85('0x22')](respondWithResult(_0xa59771,null))[_0xdb85('0x3e')](handleError(_0xa59771,null));};exports['create']=function(_0x2f5532,_0x148f50){return db[_0xdb85('0x3b')][_0xdb85('0x43')](_0x2f5532[_0xdb85('0x44')],{})[_0xdb85('0x22')](respondWithResult(_0x148f50,0xc9))[_0xdb85('0x3e')](handleError(_0x148f50,null));};exports[_0xdb85('0x21')]=function(_0x24e568,_0xef2017){if(_0x24e568['body']['id']){delete _0x24e568[_0xdb85('0x44')]['id'];}return db[_0xdb85('0x3b')][_0xdb85('0x42')]({'where':{'id':_0x24e568[_0xdb85('0x3f')]['id']}})[_0xdb85('0x22')](handleEntityNotFound(_0xef2017,null))[_0xdb85('0x22')](saveUpdates(_0x24e568[_0xdb85('0x44')],null))[_0xdb85('0x22')](respondWithResult(_0xef2017,null))[_0xdb85('0x3e')](handleError(_0xef2017,null));};exports[_0xdb85('0x23')]=function(_0xf8962d,_0x57a77c){return db[_0xdb85('0x3b')][_0xdb85('0x42')]({'where':{'id':_0xf8962d[_0xdb85('0x3f')]['id']}})[_0xdb85('0x22')](handleEntityNotFound(_0x57a77c,null))[_0xdb85('0x22')](removeEntity(_0x57a77c,null))[_0xdb85('0x3e')](handleError(_0x57a77c,null));};exports[_0xdb85('0x45')]=function(_0x187c4c,_0x5e1dc0,_0x503a18){var _0x42d053={};var _0x309eb8={};var _0x24fc54;var _0xf06e5d;return db['SugarcrmConfiguration'][_0xdb85('0x46')]({'where':{'id':_0x187c4c[_0xdb85('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5e1dc0,null))[_0xdb85('0x22')](function(_0x5353bd){if(_0x5353bd){_0x24fc54=_0x5353bd;_0x309eb8[_0xdb85('0x2b')]=_['keys'](db[_0xdb85('0x47')][_0xdb85('0x40')]);_0x309eb8[_0xdb85('0x2c')]=_[_0xdb85('0x2d')](_0x187c4c[_0xdb85('0x2c')]);_0x309eb8[_0xdb85('0x2e')]=_[_0xdb85('0x30')](_0x309eb8['model'],_0x309eb8[_0xdb85('0x2c')]);_0x42d053[_0xdb85('0x2f')]=_[_0xdb85('0x30')](_0x309eb8[_0xdb85('0x2b')],qs[_0xdb85('0x31')](_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x31')]));_0x42d053[_0xdb85('0x2f')]=_0x42d053['attributes']['length']?_0x42d053[_0xdb85('0x2f')]:_0x309eb8[_0xdb85('0x2b')];_0x42d053['order']=qs['sort'](_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x35')]);_0x42d053[_0xdb85('0x36')]=qs['filters'](_[_0xdb85('0x48')](_0x187c4c[_0xdb85('0x2c')],_0x309eb8['filters']));if(_0x187c4c[_0xdb85('0x2c')]['filter']){_0x42d053['where']=_[_0xdb85('0x39')](_0x42d053[_0xdb85('0x36')],{'$or':_['map'](_0x42d053['attributes'],function(_0x59bc2c){var _0x2540ca={};_0x2540ca[_0x59bc2c]={'$like':'%'+_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x37')]+'%'};return _0x2540ca;})});}_0x42d053=_[_0xdb85('0x39')]({},_0x42d053,_0x187c4c['options']);return _0x24fc54[_0xdb85('0x45')](_0x42d053);}})['then'](function(_0x110fba){if(_0x110fba){_0xf06e5d=_0x110fba[_0xdb85('0x32')];if(!_0x187c4c[_0xdb85('0x2c')]['hasOwnProperty'](_0xdb85('0x33'))){_0x42d053[_0xdb85('0x1b')]=qs[_0xdb85('0x1b')](_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x1b')]);_0x42d053[_0xdb85('0x19')]=qs[_0xdb85('0x19')](_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x19')]);}return _0x24fc54[_0xdb85('0x45')](_0x42d053);}})[_0xdb85('0x22')](function(_0x197fd2){if(_0x197fd2){return _0x197fd2?{'count':_0xf06e5d,'rows':_0x197fd2}:null;}})[_0xdb85('0x22')](respondWithResult(_0x5e1dc0,null))['catch'](handleError(_0x5e1dc0,null));};exports['getSubjects']=function(_0x23fb80,_0x3112e4,_0xa02d0a){var _0x1341cd={};var _0xe77516={};var _0x5ec64e;var _0x4f21c8;return db[_0xdb85('0x3b')][_0xdb85('0x46')]({'where':{'id':_0x23fb80[_0xdb85('0x3f')]['id']}})[_0xdb85('0x22')](handleEntityNotFound(_0x3112e4,null))[_0xdb85('0x22')](function(_0x1df534){if(_0x1df534){_0x5ec64e=_0x1df534;_0xe77516[_0xdb85('0x2b')]=_[_0xdb85('0x2d')](db['SugarcrmField'][_0xdb85('0x40')]);_0xe77516[_0xdb85('0x2c')]=_[_0xdb85('0x2d')](_0x23fb80[_0xdb85('0x2c')]);_0xe77516[_0xdb85('0x2e')]=_[_0xdb85('0x30')](_0xe77516[_0xdb85('0x2b')],_0xe77516[_0xdb85('0x2c')]);_0x1341cd['attributes']=_[_0xdb85('0x30')](_0xe77516[_0xdb85('0x2b')],qs['fields'](_0x23fb80['query'][_0xdb85('0x31')]));_0x1341cd['attributes']=_0x1341cd[_0xdb85('0x2f')]['length']?_0x1341cd[_0xdb85('0x2f')]:_0xe77516[_0xdb85('0x2b')];_0x1341cd[_0xdb85('0x34')]=qs[_0xdb85('0x35')](_0x23fb80['query'][_0xdb85('0x35')]);_0x1341cd['where']=qs['filters'](_[_0xdb85('0x48')](_0x23fb80[_0xdb85('0x2c')],_0xe77516[_0xdb85('0x2e')]));if(_0x23fb80[_0xdb85('0x2c')][_0xdb85('0x37')]){_0x1341cd['where']=_['merge'](_0x1341cd[_0xdb85('0x36')],{'$or':_[_0xdb85('0x28')](_0x1341cd[_0xdb85('0x2f')],function(_0x5b8514){var _0x1f619d={};_0x1f619d[_0x5b8514]={'$like':'%'+_0x23fb80[_0xdb85('0x2c')][_0xdb85('0x37')]+'%'};return _0x1f619d;})});}_0x1341cd=_['merge']({},_0x1341cd,_0x23fb80['options']);return _0x5ec64e[_0xdb85('0x49')](_0x1341cd);}})['then'](function(_0x4b75dd){if(_0x4b75dd){_0x4f21c8=_0x4b75dd[_0xdb85('0x32')];if(!_0x23fb80[_0xdb85('0x2c')][_0xdb85('0x4a')](_0xdb85('0x33'))){_0x1341cd[_0xdb85('0x1b')]=qs[_0xdb85('0x1b')](_0x23fb80['query'][_0xdb85('0x1b')]);_0x1341cd[_0xdb85('0x19')]=qs[_0xdb85('0x19')](_0x23fb80['query'][_0xdb85('0x19')]);}return _0x5ec64e[_0xdb85('0x49')](_0x1341cd);}})[_0xdb85('0x22')](function(_0x4446d5){if(_0x4446d5){return _0x4446d5?{'count':_0x4f21c8,'rows':_0x4446d5}:null;}})[_0xdb85('0x22')](respondWithResult(_0x3112e4,null))['catch'](handleError(_0x3112e4,null));};exports[_0xdb85('0x4b')]=function(_0x28a0ff,_0x75c16f,_0x5ef73f){var _0x2f827d={};var _0x2ab1e2={};var _0x1171ae;var _0x3ec255;return db[_0xdb85('0x3b')][_0xdb85('0x46')]({'where':{'id':_0x28a0ff[_0xdb85('0x3f')]['id']}})['then'](handleEntityNotFound(_0x75c16f,null))[_0xdb85('0x22')](function(_0x2c53dd){if(_0x2c53dd){_0x1171ae=_0x2c53dd;_0x2ab1e2[_0xdb85('0x2b')]=_[_0xdb85('0x2d')](db[_0xdb85('0x47')]['rawAttributes']);_0x2ab1e2[_0xdb85('0x2c')]=_[_0xdb85('0x2d')](_0x28a0ff[_0xdb85('0x2c')]);_0x2ab1e2[_0xdb85('0x2e')]=_[_0xdb85('0x30')](_0x2ab1e2[_0xdb85('0x2b')],_0x2ab1e2[_0xdb85('0x2c')]);_0x2f827d[_0xdb85('0x2f')]=_[_0xdb85('0x30')](_0x2ab1e2['model'],qs[_0xdb85('0x31')](_0x28a0ff['query'][_0xdb85('0x31')]));_0x2f827d[_0xdb85('0x2f')]=_0x2f827d['attributes']['length']?_0x2f827d[_0xdb85('0x2f')]:_0x2ab1e2[_0xdb85('0x2b')];_0x2f827d['order']=qs[_0xdb85('0x35')](_0x28a0ff['query'][_0xdb85('0x35')]);_0x2f827d[_0xdb85('0x36')]=qs[_0xdb85('0x2e')](_[_0xdb85('0x48')](_0x28a0ff[_0xdb85('0x2c')],_0x2ab1e2[_0xdb85('0x2e')]));if(_0x28a0ff[_0xdb85('0x2c')][_0xdb85('0x37')]){_0x2f827d[_0xdb85('0x36')]=_[_0xdb85('0x39')](_0x2f827d['where'],{'$or':_[_0xdb85('0x28')](_0x2f827d[_0xdb85('0x2f')],function(_0x2b7946){var _0x38399d={};_0x38399d[_0x2b7946]={'$like':'%'+_0x28a0ff[_0xdb85('0x2c')][_0xdb85('0x37')]+'%'};return _0x38399d;})});}_0x2f827d=_[_0xdb85('0x39')]({},_0x2f827d,_0x28a0ff[_0xdb85('0x3a')]);return _0x1171ae[_0xdb85('0x4b')](_0x2f827d);}})[_0xdb85('0x22')](function(_0xf2e962){if(_0xf2e962){_0x3ec255=_0xf2e962['length'];if(!_0x28a0ff[_0xdb85('0x2c')][_0xdb85('0x4a')](_0xdb85('0x33'))){_0x2f827d[_0xdb85('0x1b')]=qs['limit'](_0x28a0ff[_0xdb85('0x2c')][_0xdb85('0x1b')]);_0x2f827d[_0xdb85('0x19')]=qs[_0xdb85('0x19')](_0x28a0ff['query']['offset']);}return _0x1171ae[_0xdb85('0x4b')](_0x2f827d);}})['then'](function(_0x21b2ca){if(_0x21b2ca){return _0x21b2ca?{'count':_0x3ec255,'rows':_0x21b2ca}:null;}})[_0xdb85('0x22')](respondWithResult(_0x75c16f,null))[_0xdb85('0x3e')](handleError(_0x75c16f,null));}; \ No newline at end of file +var _0xc4df=['map','rawAttributes','fieldName','key','model','filters','intersection','attributes','query','fields','length','nolimit','sort','where','pick','filter','merge','type','options','SugarcrmConfiguration','findAll','rows','params','keys','includeAll','include','find','catch','create','body','destroy','getFields','SugarcrmField','order','findOne','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index'];(function(_0x51bf62,_0xb1390e){var _0x28d7fb=function(_0x11ae6c){while(--_0x11ae6c){_0x51bf62['push'](_0x51bf62['shift']());}};_0x28d7fb(++_0xb1390e);}(_0xc4df,0x1b1));var _0xfc4d=function(_0x3ff3a3,_0x55c9af){_0x3ff3a3=_0x3ff3a3-0x0;var _0x5dad07=_0xc4df[_0x3ff3a3];return _0x5dad07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc4d('0x0'));var zipdir=require(_0xfc4d('0x1'));var jsonpatch=require(_0xfc4d('0x2'));var rp=require(_0xfc4d('0x3'));var moment=require(_0xfc4d('0x4'));var BPromise=require(_0xfc4d('0x5'));var Mustache=require('mustache');var util=require(_0xfc4d('0x6'));var path=require('path');var sox=require(_0xfc4d('0x7'));var csv=require(_0xfc4d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc4d('0x9'));var squel=require(_0xfc4d('0xa'));var crypto=require(_0xfc4d('0xb'));var jsforce=require(_0xfc4d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfc4d('0x8'));var querystring=require(_0xfc4d('0xd'));var Papa=require('papaparse');var Redis=require(_0xfc4d('0xe'));var authService=require(_0xfc4d('0xf'));var qs=require(_0xfc4d('0x10'));var as=require(_0xfc4d('0x11'));var hardwareService=require(_0xfc4d('0x12'));var logger=require(_0xfc4d('0x13'))('api');var utils=require(_0xfc4d('0x14'));var config=require(_0xfc4d('0x15'));var licenseUtil=require(_0xfc4d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d6dfb,_0x445a02){_0x445a02=_0x445a02||0xcc;return function(_0x20cb48){if(_0x20cb48){return _0x4d6dfb[_0xfc4d('0x17')](_0x445a02);}return _0x4d6dfb[_0xfc4d('0x18')](_0x445a02)['end']();};}function respondWithResult(_0x53a435,_0x5e1d5b){_0x5e1d5b=_0x5e1d5b||0xc8;return function(_0x10f944){if(_0x10f944){return _0x53a435['status'](_0x5e1d5b)[_0xfc4d('0x19')](_0x10f944);}};}function respondWithFilteredResult(_0x177458,_0x900b31){return function(_0x1f42bb){if(_0x1f42bb){var _0x21cfa1=typeof _0x900b31[_0xfc4d('0x1a')]===_0xfc4d('0x1b')&&typeof _0x900b31[_0xfc4d('0x1c')]===_0xfc4d('0x1b');var _0x567018=_0x1f42bb[_0xfc4d('0x1d')];var _0x5ee807=_0x21cfa1?0x0:_0x900b31[_0xfc4d('0x1a')];var _0x51e355=_0x21cfa1?_0x1f42bb[_0xfc4d('0x1d')]:_0x900b31[_0xfc4d('0x1a')]+_0x900b31[_0xfc4d('0x1c')];var _0x164950;if(_0x51e355>=_0x567018){_0x51e355=_0x567018;_0x164950=0xc8;}else{_0x164950=0xce;}_0x177458[_0xfc4d('0x18')](_0x164950);return _0x177458[_0xfc4d('0x1e')](_0xfc4d('0x1f'),_0x5ee807+'-'+_0x51e355+'/'+_0x567018)[_0xfc4d('0x19')](_0x1f42bb);}return null;};}function patchUpdates(_0x2e5380){return function(_0xfa5fba){try{jsonpatch[_0xfc4d('0x20')](_0xfa5fba,_0x2e5380,!![]);}catch(_0x1f4953){return BPromise[_0xfc4d('0x21')](_0x1f4953);}return _0xfa5fba[_0xfc4d('0x22')]();};}function saveUpdates(_0x2c76ae,_0x12bd9b){return function(_0x232b4c){if(_0x232b4c){return _0x232b4c[_0xfc4d('0x23')](_0x2c76ae)[_0xfc4d('0x24')](function(_0x2f2338){return _0x2f2338;});}return null;};}function removeEntity(_0x2f029a,_0x310b46){return function(_0x21dc7a){if(_0x21dc7a){return _0x21dc7a['destroy']()[_0xfc4d('0x24')](function(){_0x2f029a[_0xfc4d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d721e,_0x5edd79){return function(_0x4746a2){if(!_0x4746a2){_0x3d721e[_0xfc4d('0x17')](0x194);}return _0x4746a2;};}function handleError(_0x5205a4,_0x170ec4){_0x170ec4=_0x170ec4||0x1f4;return function(_0x40ed2e){logger['error'](_0x40ed2e[_0xfc4d('0x25')]);if(_0x40ed2e[_0xfc4d('0x26')]){delete _0x40ed2e[_0xfc4d('0x26')];}_0x5205a4[_0xfc4d('0x18')](_0x170ec4)[_0xfc4d('0x27')](_0x40ed2e);};}exports[_0xfc4d('0x28')]=function(_0x46a994,_0x329e81){var _0x532c99={},_0x525625={},_0x580a05={'count':0x0,'rows':[]};var _0x34894d=_[_0xfc4d('0x29')](db['SugarcrmConfiguration'][_0xfc4d('0x2a')],function(_0x20a0f){return{'name':_0x20a0f[_0xfc4d('0x2b')],'type':_0x20a0f['type'][_0xfc4d('0x2c')]};});_0x525625[_0xfc4d('0x2d')]=_[_0xfc4d('0x29')](_0x34894d,'name');_0x525625['query']=_['keys'](_0x46a994['query']);_0x525625[_0xfc4d('0x2e')]=_[_0xfc4d('0x2f')](_0x525625[_0xfc4d('0x2d')],_0x525625['query']);_0x532c99[_0xfc4d('0x30')]=_['intersection'](_0x525625[_0xfc4d('0x2d')],qs['fields'](_0x46a994[_0xfc4d('0x31')][_0xfc4d('0x32')]));_0x532c99[_0xfc4d('0x30')]=_0x532c99[_0xfc4d('0x30')][_0xfc4d('0x33')]?_0x532c99[_0xfc4d('0x30')]:_0x525625[_0xfc4d('0x2d')];if(!_0x46a994[_0xfc4d('0x31')]['hasOwnProperty'](_0xfc4d('0x34'))){_0x532c99[_0xfc4d('0x1c')]=qs['limit'](_0x46a994[_0xfc4d('0x31')]['limit']);_0x532c99['offset']=qs[_0xfc4d('0x1a')](_0x46a994[_0xfc4d('0x31')][_0xfc4d('0x1a')]);}_0x532c99['order']=qs[_0xfc4d('0x35')](_0x46a994[_0xfc4d('0x31')]['sort']);_0x532c99[_0xfc4d('0x36')]=qs['filters'](_[_0xfc4d('0x37')](_0x46a994[_0xfc4d('0x31')],_0x525625[_0xfc4d('0x2e')]),_0x34894d);if(_0x46a994[_0xfc4d('0x31')][_0xfc4d('0x38')]){_0x532c99[_0xfc4d('0x36')]=_[_0xfc4d('0x39')](_0x532c99[_0xfc4d('0x36')],{'$or':_[_0xfc4d('0x29')](_0x34894d,function(_0x27c4e8){if(_0x27c4e8[_0xfc4d('0x3a')]!=='VIRTUAL'){var _0x191b10={};_0x191b10[_0x27c4e8[_0xfc4d('0x26')]]={'$like':'%'+_0x46a994[_0xfc4d('0x31')]['filter']+'%'};return _0x191b10;}})});}_0x532c99=_[_0xfc4d('0x39')]({},_0x532c99,_0x46a994[_0xfc4d('0x3b')]);var _0x4f0eee={'where':_0x532c99[_0xfc4d('0x36')]};return db[_0xfc4d('0x3c')][_0xfc4d('0x1d')](_0x4f0eee)[_0xfc4d('0x24')](function(_0xc38396){_0x580a05[_0xfc4d('0x1d')]=_0xc38396;if(_0x46a994[_0xfc4d('0x31')]['includeAll']){_0x532c99['include']=[{'all':!![]}];}return db[_0xfc4d('0x3c')][_0xfc4d('0x3d')](_0x532c99);})['then'](function(_0xde02d6){_0x580a05[_0xfc4d('0x3e')]=_0xde02d6;return _0x580a05;})[_0xfc4d('0x24')](respondWithFilteredResult(_0x329e81,_0x532c99))['catch'](handleError(_0x329e81,null));};exports['show']=function(_0x128945,_0x74955a){var _0x2e6984={'raw':![],'where':{'id':_0x128945[_0xfc4d('0x3f')]['id']}},_0xfda4eb={};_0xfda4eb[_0xfc4d('0x2d')]=_[_0xfc4d('0x40')](db[_0xfc4d('0x3c')][_0xfc4d('0x2a')]);_0xfda4eb[_0xfc4d('0x31')]=_[_0xfc4d('0x40')](_0x128945['query']);_0xfda4eb[_0xfc4d('0x2e')]=_['intersection'](_0xfda4eb['model'],_0xfda4eb[_0xfc4d('0x31')]);_0x2e6984['attributes']=_['intersection'](_0xfda4eb[_0xfc4d('0x2d')],qs[_0xfc4d('0x32')](_0x128945[_0xfc4d('0x31')][_0xfc4d('0x32')]));_0x2e6984['attributes']=_0x2e6984[_0xfc4d('0x30')][_0xfc4d('0x33')]?_0x2e6984[_0xfc4d('0x30')]:_0xfda4eb[_0xfc4d('0x2d')];if(_0x128945['query'][_0xfc4d('0x41')]){_0x2e6984[_0xfc4d('0x42')]=[{'all':!![]}];}_0x2e6984=_['merge']({},_0x2e6984,_0x128945[_0xfc4d('0x3b')]);return db[_0xfc4d('0x3c')][_0xfc4d('0x43')](_0x2e6984)[_0xfc4d('0x24')](handleEntityNotFound(_0x74955a,null))[_0xfc4d('0x24')](respondWithResult(_0x74955a,null))[_0xfc4d('0x44')](handleError(_0x74955a,null));};exports['create']=function(_0x49c2b7,_0x4b6f09){return db[_0xfc4d('0x3c')][_0xfc4d('0x45')](_0x49c2b7['body'],{})[_0xfc4d('0x24')](respondWithResult(_0x4b6f09,0xc9))[_0xfc4d('0x44')](handleError(_0x4b6f09,null));};exports[_0xfc4d('0x23')]=function(_0x4525e0,_0x43df6b){if(_0x4525e0[_0xfc4d('0x46')]['id']){delete _0x4525e0[_0xfc4d('0x46')]['id'];}return db[_0xfc4d('0x3c')][_0xfc4d('0x43')]({'where':{'id':_0x4525e0['params']['id']}})['then'](handleEntityNotFound(_0x43df6b,null))[_0xfc4d('0x24')](saveUpdates(_0x4525e0[_0xfc4d('0x46')],null))[_0xfc4d('0x24')](respondWithResult(_0x43df6b,null))[_0xfc4d('0x44')](handleError(_0x43df6b,null));};exports[_0xfc4d('0x47')]=function(_0x591e62,_0x4fd8a8){return db[_0xfc4d('0x3c')][_0xfc4d('0x43')]({'where':{'id':_0x591e62[_0xfc4d('0x3f')]['id']}})[_0xfc4d('0x24')](handleEntityNotFound(_0x4fd8a8,null))[_0xfc4d('0x24')](removeEntity(_0x4fd8a8,null))[_0xfc4d('0x44')](handleError(_0x4fd8a8,null));};exports[_0xfc4d('0x48')]=function(_0x525055,_0x219ba9,_0x5802af){var _0x55c96f={};var _0x44cf69={};var _0x358f5b;var _0x42d342;return db[_0xfc4d('0x3c')]['findOne']({'where':{'id':_0x525055[_0xfc4d('0x3f')]['id']}})[_0xfc4d('0x24')](handleEntityNotFound(_0x219ba9,null))['then'](function(_0x10b22e){if(_0x10b22e){_0x358f5b=_0x10b22e;_0x44cf69['model']=_[_0xfc4d('0x40')](db[_0xfc4d('0x49')][_0xfc4d('0x2a')]);_0x44cf69[_0xfc4d('0x31')]=_[_0xfc4d('0x40')](_0x525055[_0xfc4d('0x31')]);_0x44cf69[_0xfc4d('0x2e')]=_[_0xfc4d('0x2f')](_0x44cf69[_0xfc4d('0x2d')],_0x44cf69[_0xfc4d('0x31')]);_0x55c96f[_0xfc4d('0x30')]=_[_0xfc4d('0x2f')](_0x44cf69[_0xfc4d('0x2d')],qs[_0xfc4d('0x32')](_0x525055[_0xfc4d('0x31')][_0xfc4d('0x32')]));_0x55c96f[_0xfc4d('0x30')]=_0x55c96f[_0xfc4d('0x30')][_0xfc4d('0x33')]?_0x55c96f[_0xfc4d('0x30')]:_0x44cf69[_0xfc4d('0x2d')];_0x55c96f[_0xfc4d('0x4a')]=qs[_0xfc4d('0x35')](_0x525055[_0xfc4d('0x31')][_0xfc4d('0x35')]);_0x55c96f['where']=qs[_0xfc4d('0x2e')](_[_0xfc4d('0x37')](_0x525055[_0xfc4d('0x31')],_0x44cf69['filters']));if(_0x525055[_0xfc4d('0x31')][_0xfc4d('0x38')]){_0x55c96f[_0xfc4d('0x36')]=_[_0xfc4d('0x39')](_0x55c96f['where'],{'$or':_[_0xfc4d('0x29')](_0x55c96f[_0xfc4d('0x30')],function(_0x5e88f9){var _0x2a2f26={};_0x2a2f26[_0x5e88f9]={'$like':'%'+_0x525055[_0xfc4d('0x31')][_0xfc4d('0x38')]+'%'};return _0x2a2f26;})});}_0x55c96f=_[_0xfc4d('0x39')]({},_0x55c96f,_0x525055[_0xfc4d('0x3b')]);return _0x358f5b['getFields'](_0x55c96f);}})[_0xfc4d('0x24')](function(_0x54cb44){if(_0x54cb44){_0x42d342=_0x54cb44[_0xfc4d('0x33')];if(!_0x525055[_0xfc4d('0x31')]['hasOwnProperty']('nolimit')){_0x55c96f['limit']=qs['limit'](_0x525055[_0xfc4d('0x31')][_0xfc4d('0x1c')]);_0x55c96f[_0xfc4d('0x1a')]=qs[_0xfc4d('0x1a')](_0x525055[_0xfc4d('0x31')][_0xfc4d('0x1a')]);}return _0x358f5b[_0xfc4d('0x48')](_0x55c96f);}})[_0xfc4d('0x24')](function(_0x3611b4){if(_0x3611b4){return _0x3611b4?{'count':_0x42d342,'rows':_0x3611b4}:null;}})[_0xfc4d('0x24')](respondWithResult(_0x219ba9,null))[_0xfc4d('0x44')](handleError(_0x219ba9,null));};exports['getSubjects']=function(_0x221797,_0x742ac7,_0x10e428){var _0x102d85={};var _0x5d7d42={};var _0x18feef;var _0x5b0209;return db[_0xfc4d('0x3c')][_0xfc4d('0x4b')]({'where':{'id':_0x221797[_0xfc4d('0x3f')]['id']}})[_0xfc4d('0x24')](handleEntityNotFound(_0x742ac7,null))[_0xfc4d('0x24')](function(_0x2b1ff3){if(_0x2b1ff3){_0x18feef=_0x2b1ff3;_0x5d7d42[_0xfc4d('0x2d')]=_['keys'](db[_0xfc4d('0x49')][_0xfc4d('0x2a')]);_0x5d7d42['query']=_['keys'](_0x221797[_0xfc4d('0x31')]);_0x5d7d42[_0xfc4d('0x2e')]=_[_0xfc4d('0x2f')](_0x5d7d42[_0xfc4d('0x2d')],_0x5d7d42[_0xfc4d('0x31')]);_0x102d85[_0xfc4d('0x30')]=_[_0xfc4d('0x2f')](_0x5d7d42['model'],qs[_0xfc4d('0x32')](_0x221797[_0xfc4d('0x31')]['fields']));_0x102d85[_0xfc4d('0x30')]=_0x102d85[_0xfc4d('0x30')][_0xfc4d('0x33')]?_0x102d85[_0xfc4d('0x30')]:_0x5d7d42['model'];_0x102d85[_0xfc4d('0x4a')]=qs[_0xfc4d('0x35')](_0x221797[_0xfc4d('0x31')][_0xfc4d('0x35')]);_0x102d85['where']=qs['filters'](_[_0xfc4d('0x37')](_0x221797[_0xfc4d('0x31')],_0x5d7d42[_0xfc4d('0x2e')]));if(_0x221797[_0xfc4d('0x31')]['filter']){_0x102d85[_0xfc4d('0x36')]=_[_0xfc4d('0x39')](_0x102d85[_0xfc4d('0x36')],{'$or':_['map'](_0x102d85[_0xfc4d('0x30')],function(_0x371b58){var _0x50ea4c={};_0x50ea4c[_0x371b58]={'$like':'%'+_0x221797[_0xfc4d('0x31')][_0xfc4d('0x38')]+'%'};return _0x50ea4c;})});}_0x102d85=_['merge']({},_0x102d85,_0x221797[_0xfc4d('0x3b')]);return _0x18feef[_0xfc4d('0x4c')](_0x102d85);}})[_0xfc4d('0x24')](function(_0x4f30b5){if(_0x4f30b5){_0x5b0209=_0x4f30b5['length'];if(!_0x221797[_0xfc4d('0x31')][_0xfc4d('0x4d')](_0xfc4d('0x34'))){_0x102d85['limit']=qs[_0xfc4d('0x1c')](_0x221797['query']['limit']);_0x102d85['offset']=qs['offset'](_0x221797[_0xfc4d('0x31')]['offset']);}return _0x18feef[_0xfc4d('0x4c')](_0x102d85);}})['then'](function(_0x4681a6){if(_0x4681a6){return _0x4681a6?{'count':_0x5b0209,'rows':_0x4681a6}:null;}})[_0xfc4d('0x24')](respondWithResult(_0x742ac7,null))[_0xfc4d('0x44')](handleError(_0x742ac7,null));};exports['getDescriptions']=function(_0x49ed79,_0x283bbc,_0x558c11){var _0x32eb5c={};var _0x290699={};var _0x281ea3;var _0x2ed171;return db['SugarcrmConfiguration'][_0xfc4d('0x4b')]({'where':{'id':_0x49ed79[_0xfc4d('0x3f')]['id']}})[_0xfc4d('0x24')](handleEntityNotFound(_0x283bbc,null))[_0xfc4d('0x24')](function(_0x29fb55){if(_0x29fb55){_0x281ea3=_0x29fb55;_0x290699[_0xfc4d('0x2d')]=_[_0xfc4d('0x40')](db['SugarcrmField'][_0xfc4d('0x2a')]);_0x290699[_0xfc4d('0x31')]=_[_0xfc4d('0x40')](_0x49ed79[_0xfc4d('0x31')]);_0x290699[_0xfc4d('0x2e')]=_[_0xfc4d('0x2f')](_0x290699[_0xfc4d('0x2d')],_0x290699['query']);_0x32eb5c['attributes']=_[_0xfc4d('0x2f')](_0x290699[_0xfc4d('0x2d')],qs[_0xfc4d('0x32')](_0x49ed79[_0xfc4d('0x31')]['fields']));_0x32eb5c[_0xfc4d('0x30')]=_0x32eb5c[_0xfc4d('0x30')][_0xfc4d('0x33')]?_0x32eb5c[_0xfc4d('0x30')]:_0x290699[_0xfc4d('0x2d')];_0x32eb5c['order']=qs[_0xfc4d('0x35')](_0x49ed79[_0xfc4d('0x31')]['sort']);_0x32eb5c[_0xfc4d('0x36')]=qs['filters'](_[_0xfc4d('0x37')](_0x49ed79[_0xfc4d('0x31')],_0x290699[_0xfc4d('0x2e')]));if(_0x49ed79['query'][_0xfc4d('0x38')]){_0x32eb5c[_0xfc4d('0x36')]=_[_0xfc4d('0x39')](_0x32eb5c['where'],{'$or':_[_0xfc4d('0x29')](_0x32eb5c[_0xfc4d('0x30')],function(_0x14f528){var _0x1d5ca5={};_0x1d5ca5[_0x14f528]={'$like':'%'+_0x49ed79[_0xfc4d('0x31')][_0xfc4d('0x38')]+'%'};return _0x1d5ca5;})});}_0x32eb5c=_['merge']({},_0x32eb5c,_0x49ed79[_0xfc4d('0x3b')]);return _0x281ea3[_0xfc4d('0x4e')](_0x32eb5c);}})[_0xfc4d('0x24')](function(_0x4d558d){if(_0x4d558d){_0x2ed171=_0x4d558d[_0xfc4d('0x33')];if(!_0x49ed79['query'][_0xfc4d('0x4d')](_0xfc4d('0x34'))){_0x32eb5c[_0xfc4d('0x1c')]=qs[_0xfc4d('0x1c')](_0x49ed79[_0xfc4d('0x31')][_0xfc4d('0x1c')]);_0x32eb5c[_0xfc4d('0x1a')]=qs[_0xfc4d('0x1a')](_0x49ed79[_0xfc4d('0x31')][_0xfc4d('0x1a')]);}return _0x281ea3['getDescriptions'](_0x32eb5c);}})[_0xfc4d('0x24')](function(_0x586f44){if(_0x586f44){return _0x586f44?{'count':_0x2ed171,'rows':_0x586f44}:null;}})[_0xfc4d('0x24')](respondWithResult(_0x283bbc,null))[_0xfc4d('0x44')](handleError(_0x283bbc,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index cd3733c..fb47a41 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 _0xa6d0=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4de31f,_0x5118c4){var _0x2477d3=function(_0x324ab2){while(--_0x324ab2){_0x4de31f['push'](_0x4de31f['shift']());}};_0x2477d3(++_0x5118c4);}(_0xa6d0,0x158));var _0x0a6d=function(_0x55785f,_0x5c0475){_0x55785f=_0x55785f-0x0;var _0x30c4aa=_0xa6d0[_0x55785f];return _0x30c4aa;};'use strict';var _=require(_0x0a6d('0x0'));var util=require('util');var logger=require(_0x0a6d('0x1'))(_0x0a6d('0x2'));var moment=require(_0x0a6d('0x3'));var BPromise=require(_0x0a6d('0x4'));var rp=require(_0x0a6d('0x5'));var fs=require('fs');var path=require(_0x0a6d('0x6'));var rimraf=require(_0x0a6d('0x7'));var config=require(_0x0a6d('0x8'));var attributes=require(_0x0a6d('0x9'));module[_0x0a6d('0xa')]=function(_0x17fdba,_0x357d34){return _0x17fdba[_0x0a6d('0xb')](_0x0a6d('0xc'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46a7=['../../config/logger','api','moment','path','rimraf','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations','util'];(function(_0x39a104,_0x4baa8b){var _0x531b09=function(_0x1490aa){while(--_0x1490aa){_0x39a104['push'](_0x39a104['shift']());}};_0x531b09(++_0x4baa8b);}(_0x46a7,0x77));var _0x746a=function(_0x5f5467,_0x5afec4){_0x5f5467=_0x5f5467-0x0;var _0x2996cd=_0x46a7[_0x5f5467];return _0x2996cd;};'use strict';var _=require('lodash');var util=require(_0x746a('0x0'));var logger=require(_0x746a('0x1'))(_0x746a('0x2'));var moment=require(_0x746a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x746a('0x4'));var rimraf=require(_0x746a('0x5'));var config=require(_0x746a('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x495902,_0x17b7e4){return _0x495902[_0x746a('0x7')](_0x746a('0x8'),attributes,{'tableName':_0x746a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index dafac4c..5ba030d 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 _0x33c5=['jayson/promise','client','http','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x57fe10,_0xc39128){var _0x183c17=function(_0x5bb8bb){while(--_0x5bb8bb){_0x57fe10['push'](_0x57fe10['shift']());}};_0x183c17(++_0xc39128);}(_0x33c5,0x1ae));var _0x533c=function(_0x3a723e,_0x59d99a){_0x3a723e=_0x3a723e-0x0;var _0x3e9c03=_0x33c5[_0x3a723e];return _0x3e9c03;};'use strict';var _=require(_0x533c('0x0'));var util=require('util');var moment=require(_0x533c('0x1'));var BPromise=require(_0x533c('0x2'));var rs=require(_0x533c('0x3'));var fs=require('fs');var Redis=require(_0x533c('0x4'));var db=require(_0x533c('0x5'))['db'];var utils=require(_0x533c('0x6'));var logger=require(_0x533c('0x7'))(_0x533c('0x8'));var config=require(_0x533c('0x9'));var jayson=require(_0x533c('0xa'));var client=jayson[_0x533c('0xb')][_0x533c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57c886,_0x18f9b4,_0x4c6999){return new BPromise(function(_0x14c331,_0x56caea){return client['request'](_0x57c886,_0x4c6999)['then'](function(_0xde2bcb){logger['info'](_0x533c('0xd'),_0x18f9b4,_0x533c('0xe'));logger['debug'](_0x533c('0xf'),_0x18f9b4,'request\x20sent',JSON[_0x533c('0x10')](_0xde2bcb));if(_0xde2bcb[_0x533c('0x11')]){if(_0xde2bcb[_0x533c('0x11')][_0x533c('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x18f9b4,_0xde2bcb[_0x533c('0x11')][_0x533c('0x13')]);return _0x56caea(_0xde2bcb[_0x533c('0x11')][_0x533c('0x13')]);}logger['error'](_0x533c('0xd'),_0x18f9b4,_0xde2bcb[_0x533c('0x11')][_0x533c('0x13')]);return _0x14c331(_0xde2bcb['error'][_0x533c('0x13')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x18f9b4,_0x533c('0xe'));_0x14c331(_0xde2bcb[_0x533c('0x14')][_0x533c('0x13')]);}})[_0x533c('0x15')](function(_0x2770d2){logger[_0x533c('0x11')](_0x533c('0xd'),_0x18f9b4,_0x2770d2);_0x56caea(_0x2770d2);});});} \ No newline at end of file +var _0xbcce=['moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xbcce,0x18d));var _0xebcc=function(_0x470971,_0x15a5a2){_0x470971=_0x470971-0x0;var _0x5607b0=_0xbcce[_0x470971];return _0x5607b0;};'use strict';var _=require(_0xebcc('0x0'));var util=require(_0xebcc('0x1'));var moment=require(_0xebcc('0x2'));var BPromise=require(_0xebcc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebcc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xebcc('0x5'));var logger=require('../../config/logger')(_0xebcc('0x6'));var config=require(_0xebcc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xebcc('0x8')][_0xebcc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a3bbf,_0x501e47,_0x5ed8e3){return new BPromise(function(_0x78ac4b,_0x30da6a){return client['request'](_0x4a3bbf,_0x5ed8e3)[_0xebcc('0xa')](function(_0x246287){logger[_0xebcc('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x501e47,_0xebcc('0xc'));logger[_0xebcc('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x501e47,_0xebcc('0xc'),JSON[_0xebcc('0xe')](_0x246287));if(_0x246287[_0xebcc('0xf')]){if(_0x246287['error'][_0xebcc('0x10')]===0x1f4){logger['error'](_0xebcc('0x11'),_0x501e47,_0x246287[_0xebcc('0xf')][_0xebcc('0x12')]);return _0x30da6a(_0x246287[_0xebcc('0xf')][_0xebcc('0x12')]);}logger[_0xebcc('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x501e47,_0x246287[_0xebcc('0xf')][_0xebcc('0x12')]);return _0x78ac4b(_0x246287[_0xebcc('0xf')][_0xebcc('0x12')]);}else{logger[_0xebcc('0xb')](_0xebcc('0x11'),_0x501e47,_0xebcc('0xc'));_0x78ac4b(_0x246287[_0xebcc('0x13')]['message']);}})[_0xebcc('0x14')](function(_0x466475){logger[_0xebcc('0xf')](_0xebcc('0x11'),_0x501e47,_0x466475);_0x30da6a(_0x466475);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 08954f1..f6142f5 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 _0xae6c=['./intSugarcrmField.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xcc919e,_0xaf01e){var _0x8317c3=function(_0x24c189){while(--_0x24c189){_0xcc919e['push'](_0xcc919e['shift']());}};_0x8317c3(++_0xaf01e);}(_0xae6c,0xc9));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xcae6('0x0'));var path=require(_0xcae6('0x1'));var timeout=require(_0xcae6('0x2'));var express=require(_0xcae6('0x3'));var router=express[_0xcae6('0x4')]();var fs_extra=require(_0xcae6('0x5'));var auth=require(_0xcae6('0x6'));var interaction=require(_0xcae6('0x7'));var config=require(_0xcae6('0x8'));var controller=require(_0xcae6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xcae6('0xa')]);router['get'](_0xcae6('0xb'),auth[_0xcae6('0xc')](),controller[_0xcae6('0xd')]);router[_0xcae6('0xe')]('/',auth['isAuthenticated'](),controller[_0xcae6('0xf')]);router[_0xcae6('0x10')](_0xcae6('0xb'),auth[_0xcae6('0xc')](),controller[_0xcae6('0x11')]);router[_0xcae6('0x12')](_0xcae6('0xb'),auth[_0xcae6('0xc')](),controller[_0xcae6('0x13')]);module[_0xcae6('0x14')]=router; \ No newline at end of file +var _0x2e85=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x3bc159,_0x4de639){var _0x5755e7=function(_0x3d1291){while(--_0x3d1291){_0x3bc159['push'](_0x3bc159['shift']());}};_0x5755e7(++_0x4de639);}(_0x2e85,0x11d));var _0x52e8=function(_0xc0c23f,_0x35c9db){_0xc0c23f=_0xc0c23f-0x0;var _0x2166df=_0x2e85[_0xc0c23f];return _0x2166df;};'use strict';var multer=require(_0x52e8('0x0'));var util=require(_0x52e8('0x1'));var path=require('path');var timeout=require(_0x52e8('0x2'));var express=require('express');var router=express[_0x52e8('0x3')]();var fs_extra=require(_0x52e8('0x4'));var auth=require(_0x52e8('0x5'));var interaction=require(_0x52e8('0x6'));var config=require('../../config/environment');var controller=require(_0x52e8('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x52e8('0x8'),auth[_0x52e8('0x9')](),controller[_0x52e8('0xa')]);router['post']('/',auth[_0x52e8('0x9')](),controller[_0x52e8('0xb')]);router[_0x52e8('0xc')](_0x52e8('0x8'),auth['isAuthenticated'](),controller[_0x52e8('0xd')]);router[_0x52e8('0xe')]('/:id',auth[_0x52e8('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 52f578c..d3f6442 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 _0xa532=['customVariable','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x4ed77e,_0x1fd527){var _0x35c245=function(_0x45e988){while(--_0x45e988){_0x4ed77e['push'](_0x4ed77e['shift']());}};_0x35c245(++_0x1fd527);}(_0xa532,0x64));var _0x2a53=function(_0x494dab,_0x24a6c5){_0x494dab=_0x494dab-0x0;var _0x2c9e47=_0xa532[_0x494dab];return _0x2c9e47;};'use strict';var Sequelize=require(_0x2a53('0x0'));module[_0x2a53('0x1')]={'type':{'type':Sequelize[_0x2a53('0x2')](_0x2a53('0x3'),_0x2a53('0x4'),'customVariable',_0x2a53('0x5'),_0x2a53('0x6')),'defaultValue':_0x2a53('0x3')},'content':{'type':Sequelize[_0x2a53('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2a53('0x3'),_0x2a53('0x4'),_0x2a53('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2a53('0x7')]},'nameField':{'type':Sequelize[_0x2a53('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a53('0x7')]}}; \ No newline at end of file +var _0x6d98=['variable','customVariable','picklist','string','STRING','BOOLEAN','exports','ENUM'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x6d98,0x86));var _0x86d9=function(_0x4326a0,_0x1c6474){_0x4326a0=_0x4326a0-0x0;var _0x4d1449=_0x6d98[_0x4326a0];return _0x4d1449;};'use strict';var Sequelize=require('sequelize');module[_0x86d9('0x0')]={'type':{'type':Sequelize[_0x86d9('0x1')]('string',_0x86d9('0x2'),_0x86d9('0x3'),'keyValue',_0x86d9('0x4')),'defaultValue':_0x86d9('0x5')},'content':{'type':Sequelize[_0x86d9('0x6')]},'key':{'type':Sequelize[_0x86d9('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x86d9('0x3'))},'keyContent':{'type':Sequelize[_0x86d9('0x6')]},'idField':{'type':Sequelize[_0x86d9('0x6')]},'nameField':{'type':Sequelize[_0x86d9('0x6')]},'customField':{'type':Sequelize[_0x86d9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x86d9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index ec338ad..17efdd8 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 _0x36c7=['apply','reject','save','update','then','sendStatus','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2fe952,_0xa77e25){var _0x28c7cd=function(_0x45025b){while(--_0x45025b){_0x2fe952['push'](_0x2fe952['shift']());}};_0x28c7cd(++_0xa77e25);}(_0x36c7,0x174));var _0x736c=function(_0x183dd6,_0x488036){_0x183dd6=_0x183dd6-0x0;var _0x4b3be2=_0x36c7[_0x183dd6];return _0x4b3be2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x736c('0x0'));var zipdir=require(_0x736c('0x1'));var jsonpatch=require(_0x736c('0x2'));var rp=require(_0x736c('0x3'));var moment=require(_0x736c('0x4'));var BPromise=require(_0x736c('0x5'));var Mustache=require(_0x736c('0x6'));var util=require(_0x736c('0x7'));var path=require(_0x736c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x736c('0x9'));var fs=require('fs');var fs_extra=require(_0x736c('0xa'));var _=require(_0x736c('0xb'));var squel=require(_0x736c('0xc'));var crypto=require(_0x736c('0xd'));var jsforce=require(_0x736c('0xe'));var deskjs=require(_0x736c('0xf'));var toCsv=require(_0x736c('0x10'));var querystring=require(_0x736c('0x11'));var Papa=require(_0x736c('0x12'));var Redis=require(_0x736c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x736c('0x14'));var as=require(_0x736c('0x15'));var hardwareService=require(_0x736c('0x16'));var logger=require(_0x736c('0x17'))(_0x736c('0x18'));var utils=require(_0x736c('0x19'));var config=require(_0x736c('0x1a'));var licenseUtil=require(_0x736c('0x1b'));var db=require(_0x736c('0x1c'))['db'];function respondWithStatusCode(_0x502d22,_0x33e974){_0x33e974=_0x33e974||0xcc;return function(_0x4f72d1){if(_0x4f72d1){return _0x502d22['sendStatus'](_0x33e974);}return _0x502d22[_0x736c('0x1d')](_0x33e974)[_0x736c('0x1e')]();};}function respondWithResult(_0x5e7ed3,_0x1f3413){_0x1f3413=_0x1f3413||0xc8;return function(_0x46cbfe){if(_0x46cbfe){return _0x5e7ed3['status'](_0x1f3413)[_0x736c('0x1f')](_0x46cbfe);}};}function respondWithFilteredResult(_0x43b01a,_0x17471e){return function(_0x58cf08){if(_0x58cf08){var _0x5a92d5=typeof _0x17471e[_0x736c('0x20')]===_0x736c('0x21')&&typeof _0x17471e[_0x736c('0x22')]===_0x736c('0x21');var _0x3d7c94=_0x58cf08[_0x736c('0x23')];var _0x435ca2=_0x5a92d5?0x0:_0x17471e[_0x736c('0x20')];var _0xde2263=_0x5a92d5?_0x58cf08[_0x736c('0x23')]:_0x17471e[_0x736c('0x20')]+_0x17471e[_0x736c('0x22')];var _0x254fdb;if(_0xde2263>=_0x3d7c94){_0xde2263=_0x3d7c94;_0x254fdb=0xc8;}else{_0x254fdb=0xce;}_0x43b01a[_0x736c('0x1d')](_0x254fdb);return _0x43b01a[_0x736c('0x24')](_0x736c('0x25'),_0x435ca2+'-'+_0xde2263+'/'+_0x3d7c94)[_0x736c('0x1f')](_0x58cf08);}return null;};}function patchUpdates(_0x192f7a){return function(_0x326de2){try{jsonpatch[_0x736c('0x26')](_0x326de2,_0x192f7a,!![]);}catch(_0x1696ee){return BPromise[_0x736c('0x27')](_0x1696ee);}return _0x326de2[_0x736c('0x28')]();};}function saveUpdates(_0x46f614,_0x3aec24){return function(_0x51e363){if(_0x51e363){return _0x51e363[_0x736c('0x29')](_0x46f614)['then'](function(_0x3b8ad5){return _0x3b8ad5;});}return null;};}function removeEntity(_0x3b1d0a,_0x156aa4){return function(_0x17e169){if(_0x17e169){return _0x17e169['destroy']()[_0x736c('0x2a')](function(){_0x3b1d0a[_0x736c('0x1d')](0xcc)[_0x736c('0x1e')]();});}};}function handleEntityNotFound(_0x106590,_0x4b6749){return function(_0x4f2e05){if(!_0x4f2e05){_0x106590[_0x736c('0x2b')](0x194);}return _0x4f2e05;};}function handleError(_0x25081b,_0x24d882){_0x24d882=_0x24d882||0x1f4;return function(_0x37c178){logger[_0x736c('0x2c')](_0x37c178['stack']);if(_0x37c178['name']){delete _0x37c178[_0x736c('0x2d')];}_0x25081b['status'](_0x24d882)[_0x736c('0x2e')](_0x37c178);};}exports[_0x736c('0x2f')]=function(_0x168675,_0x3e2184){var _0x4f52b4={},_0x46bdeb={},_0x327b1c={'count':0x0,'rows':[]};var _0x57c3c8=_[_0x736c('0x30')](db[_0x736c('0x31')][_0x736c('0x32')],function(_0xde1ca2){return{'name':_0xde1ca2[_0x736c('0x33')],'type':_0xde1ca2[_0x736c('0x34')][_0x736c('0x35')]};});_0x46bdeb[_0x736c('0x36')]=_[_0x736c('0x30')](_0x57c3c8,_0x736c('0x2d'));_0x46bdeb['query']=_['keys'](_0x168675[_0x736c('0x37')]);_0x46bdeb['filters']=_['intersection'](_0x46bdeb[_0x736c('0x36')],_0x46bdeb['query']);_0x4f52b4[_0x736c('0x38')]=_[_0x736c('0x39')](_0x46bdeb['model'],qs[_0x736c('0x3a')](_0x168675['query']['fields']));_0x4f52b4[_0x736c('0x38')]=_0x4f52b4[_0x736c('0x38')][_0x736c('0x3b')]?_0x4f52b4[_0x736c('0x38')]:_0x46bdeb[_0x736c('0x36')];if(!_0x168675['query'][_0x736c('0x3c')](_0x736c('0x3d'))){_0x4f52b4[_0x736c('0x22')]=qs[_0x736c('0x22')](_0x168675[_0x736c('0x37')][_0x736c('0x22')]);_0x4f52b4[_0x736c('0x20')]=qs[_0x736c('0x20')](_0x168675[_0x736c('0x37')]['offset']);}_0x4f52b4[_0x736c('0x3e')]=qs[_0x736c('0x3f')](_0x168675['query'][_0x736c('0x3f')]);_0x4f52b4['where']=qs[_0x736c('0x40')](_[_0x736c('0x41')](_0x168675['query'],_0x46bdeb[_0x736c('0x40')]),_0x57c3c8);if(_0x168675['query'][_0x736c('0x42')]){_0x4f52b4['where']=_[_0x736c('0x43')](_0x4f52b4[_0x736c('0x44')],{'$or':_['map'](_0x57c3c8,function(_0x3fef0c){if(_0x3fef0c[_0x736c('0x34')]!=='VIRTUAL'){var _0x522d6b={};_0x522d6b[_0x3fef0c['name']]={'$like':'%'+_0x168675['query'][_0x736c('0x42')]+'%'};return _0x522d6b;}})});}_0x4f52b4=_[_0x736c('0x43')]({},_0x4f52b4,_0x168675[_0x736c('0x45')]);var _0x48083d={'where':_0x4f52b4[_0x736c('0x44')]};return db[_0x736c('0x31')][_0x736c('0x23')](_0x48083d)['then'](function(_0x4fe51d){_0x327b1c[_0x736c('0x23')]=_0x4fe51d;if(_0x168675['query'][_0x736c('0x46')]){_0x4f52b4[_0x736c('0x47')]=[{'all':!![]}];}return db['SugarcrmField'][_0x736c('0x48')](_0x4f52b4);})['then'](function(_0x190881){_0x327b1c[_0x736c('0x49')]=_0x190881;return _0x327b1c;})[_0x736c('0x2a')](respondWithFilteredResult(_0x3e2184,_0x4f52b4))['catch'](handleError(_0x3e2184,null));};exports[_0x736c('0x4a')]=function(_0x21f9a9,_0xc04f8e){var _0x1bf897={'raw':!![],'where':{'id':_0x21f9a9[_0x736c('0x4b')]['id']}},_0xa1df2b={};_0xa1df2b[_0x736c('0x36')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0xa1df2b['query']=_[_0x736c('0x4c')](_0x21f9a9[_0x736c('0x37')]);_0xa1df2b['filters']=_[_0x736c('0x39')](_0xa1df2b['model'],_0xa1df2b[_0x736c('0x37')]);_0x1bf897['attributes']=_[_0x736c('0x39')](_0xa1df2b['model'],qs['fields'](_0x21f9a9[_0x736c('0x37')][_0x736c('0x3a')]));_0x1bf897['attributes']=_0x1bf897[_0x736c('0x38')]['length']?_0x1bf897[_0x736c('0x38')]:_0xa1df2b[_0x736c('0x36')];if(_0x21f9a9[_0x736c('0x37')]['includeAll']){_0x1bf897[_0x736c('0x47')]=[{'all':!![]}];}_0x1bf897=_[_0x736c('0x43')]({},_0x1bf897,_0x21f9a9['options']);return db[_0x736c('0x31')][_0x736c('0x4d')](_0x1bf897)[_0x736c('0x2a')](handleEntityNotFound(_0xc04f8e,null))['then'](respondWithResult(_0xc04f8e,null))[_0x736c('0x4e')](handleError(_0xc04f8e,null));};exports[_0x736c('0x4f')]=function(_0x454aa8,_0x57e61b){return db[_0x736c('0x31')][_0x736c('0x4f')](_0x454aa8[_0x736c('0x50')],{})['then'](respondWithResult(_0x57e61b,0xc9))[_0x736c('0x4e')](handleError(_0x57e61b,null));};exports[_0x736c('0x29')]=function(_0x5642f7,_0x4628b5){if(_0x5642f7[_0x736c('0x50')]['id']){delete _0x5642f7[_0x736c('0x50')]['id'];}return db[_0x736c('0x31')][_0x736c('0x4d')]({'where':{'id':_0x5642f7[_0x736c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4628b5,null))[_0x736c('0x2a')](saveUpdates(_0x5642f7[_0x736c('0x50')],null))[_0x736c('0x2a')](respondWithResult(_0x4628b5,null))[_0x736c('0x4e')](handleError(_0x4628b5,null));};exports[_0x736c('0x51')]=function(_0x432754,_0x6082b3){return db[_0x736c('0x31')][_0x736c('0x4d')]({'where':{'id':_0x432754[_0x736c('0x4b')]['id']}})[_0x736c('0x2a')](handleEntityNotFound(_0x6082b3,null))['then'](removeEntity(_0x6082b3,null))['catch'](handleError(_0x6082b3,null));}; \ No newline at end of file +var _0xee9b=['merge','options','include','SugarcrmField','rows','show','params','includeAll','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter'];(function(_0x55f0be,_0x19eee7){var _0x1ceaae=function(_0x11a2bd){while(--_0x11a2bd){_0x55f0be['push'](_0x55f0be['shift']());}};_0x1ceaae(++_0x19eee7);}(_0xee9b,0x12f));var _0xbee9=function(_0x360409,_0xe0f489){_0x360409=_0x360409-0x0;var _0x5a8a7d=_0xee9b[_0x360409];return _0x5a8a7d;};'use strict';var emlformat=require(_0xbee9('0x0'));var rimraf=require(_0xbee9('0x1'));var zipdir=require(_0xbee9('0x2'));var jsonpatch=require(_0xbee9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbee9('0x4'));var Mustache=require(_0xbee9('0x5'));var util=require('util');var path=require(_0xbee9('0x6'));var sox=require(_0xbee9('0x7'));var csv=require(_0xbee9('0x8'));var ejs=require(_0xbee9('0x9'));var fs=require('fs');var fs_extra=require(_0xbee9('0xa'));var _=require(_0xbee9('0xb'));var squel=require('squel');var crypto=require(_0xbee9('0xc'));var jsforce=require(_0xbee9('0xd'));var deskjs=require(_0xbee9('0xe'));var toCsv=require(_0xbee9('0x8'));var querystring=require(_0xbee9('0xf'));var Papa=require('papaparse');var Redis=require(_0xbee9('0x10'));var authService=require(_0xbee9('0x11'));var qs=require(_0xbee9('0x12'));var as=require(_0xbee9('0x13'));var hardwareService=require(_0xbee9('0x14'));var logger=require(_0xbee9('0x15'))('api');var utils=require(_0xbee9('0x16'));var config=require(_0xbee9('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bfa22,_0x79a0c9){_0x79a0c9=_0x79a0c9||0xcc;return function(_0x3201c5){if(_0x3201c5){return _0x4bfa22[_0xbee9('0x18')](_0x79a0c9);}return _0x4bfa22[_0xbee9('0x19')](_0x79a0c9)[_0xbee9('0x1a')]();};}function respondWithResult(_0x2beca5,_0x19c132){_0x19c132=_0x19c132||0xc8;return function(_0x65d761){if(_0x65d761){return _0x2beca5[_0xbee9('0x19')](_0x19c132)['json'](_0x65d761);}};}function respondWithFilteredResult(_0x4f5a66,_0x23118e){return function(_0x38e1ce){if(_0x38e1ce){var _0x3c80c7=typeof _0x23118e[_0xbee9('0x1b')]==='undefined'&&typeof _0x23118e[_0xbee9('0x1c')]===_0xbee9('0x1d');var _0x410aac=_0x38e1ce['count'];var _0x5c90d9=_0x3c80c7?0x0:_0x23118e[_0xbee9('0x1b')];var _0x41dcca=_0x3c80c7?_0x38e1ce[_0xbee9('0x1e')]:_0x23118e[_0xbee9('0x1b')]+_0x23118e[_0xbee9('0x1c')];var _0x3f4ce6;if(_0x41dcca>=_0x410aac){_0x41dcca=_0x410aac;_0x3f4ce6=0xc8;}else{_0x3f4ce6=0xce;}_0x4f5a66[_0xbee9('0x19')](_0x3f4ce6);return _0x4f5a66['set'](_0xbee9('0x1f'),_0x5c90d9+'-'+_0x41dcca+'/'+_0x410aac)[_0xbee9('0x20')](_0x38e1ce);}return null;};}function patchUpdates(_0x479126){return function(_0x13b705){try{jsonpatch[_0xbee9('0x21')](_0x13b705,_0x479126,!![]);}catch(_0x3e981f){return BPromise[_0xbee9('0x22')](_0x3e981f);}return _0x13b705[_0xbee9('0x23')]();};}function saveUpdates(_0x2ac224,_0x53bbc1){return function(_0x5941dc){if(_0x5941dc){return _0x5941dc[_0xbee9('0x24')](_0x2ac224)[_0xbee9('0x25')](function(_0x35347f){return _0x35347f;});}return null;};}function removeEntity(_0x5a3214,_0x8f39cf){return function(_0x43b620){if(_0x43b620){return _0x43b620[_0xbee9('0x26')]()[_0xbee9('0x25')](function(){_0x5a3214[_0xbee9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6f92,_0x3fdc79){return function(_0x32ef3d){if(!_0x32ef3d){_0x2f6f92[_0xbee9('0x18')](0x194);}return _0x32ef3d;};}function handleError(_0x129565,_0x5b424c){_0x5b424c=_0x5b424c||0x1f4;return function(_0x5b0749){logger[_0xbee9('0x27')](_0x5b0749[_0xbee9('0x28')]);if(_0x5b0749[_0xbee9('0x29')]){delete _0x5b0749['name'];}_0x129565[_0xbee9('0x19')](_0x5b424c)['send'](_0x5b0749);};}exports[_0xbee9('0x2a')]=function(_0x1ca7c9,_0x40da41){var _0xc02b63={},_0x3702df={},_0x241203={'count':0x0,'rows':[]};var _0x3d76d5=_[_0xbee9('0x2b')](db['SugarcrmField'][_0xbee9('0x2c')],function(_0x1699f9){return{'name':_0x1699f9[_0xbee9('0x2d')],'type':_0x1699f9[_0xbee9('0x2e')][_0xbee9('0x2f')]};});_0x3702df[_0xbee9('0x30')]=_[_0xbee9('0x2b')](_0x3d76d5,'name');_0x3702df[_0xbee9('0x31')]=_[_0xbee9('0x32')](_0x1ca7c9[_0xbee9('0x31')]);_0x3702df[_0xbee9('0x33')]=_[_0xbee9('0x34')](_0x3702df[_0xbee9('0x30')],_0x3702df[_0xbee9('0x31')]);_0xc02b63[_0xbee9('0x35')]=_[_0xbee9('0x34')](_0x3702df[_0xbee9('0x30')],qs[_0xbee9('0x36')](_0x1ca7c9[_0xbee9('0x31')][_0xbee9('0x36')]));_0xc02b63[_0xbee9('0x35')]=_0xc02b63[_0xbee9('0x35')][_0xbee9('0x37')]?_0xc02b63[_0xbee9('0x35')]:_0x3702df['model'];if(!_0x1ca7c9[_0xbee9('0x31')][_0xbee9('0x38')](_0xbee9('0x39'))){_0xc02b63[_0xbee9('0x1c')]=qs[_0xbee9('0x1c')](_0x1ca7c9[_0xbee9('0x31')][_0xbee9('0x1c')]);_0xc02b63[_0xbee9('0x1b')]=qs['offset'](_0x1ca7c9[_0xbee9('0x31')][_0xbee9('0x1b')]);}_0xc02b63[_0xbee9('0x3a')]=qs['sort'](_0x1ca7c9['query']['sort']);_0xc02b63[_0xbee9('0x3b')]=qs[_0xbee9('0x33')](_[_0xbee9('0x3c')](_0x1ca7c9[_0xbee9('0x31')],_0x3702df[_0xbee9('0x33')]),_0x3d76d5);if(_0x1ca7c9[_0xbee9('0x31')]['filter']){_0xc02b63[_0xbee9('0x3b')]=_['merge'](_0xc02b63[_0xbee9('0x3b')],{'$or':_['map'](_0x3d76d5,function(_0x9e1935){if(_0x9e1935[_0xbee9('0x2e')]!=='VIRTUAL'){var _0x42c38d={};_0x42c38d[_0x9e1935[_0xbee9('0x29')]]={'$like':'%'+_0x1ca7c9[_0xbee9('0x31')][_0xbee9('0x3d')]+'%'};return _0x42c38d;}})});}_0xc02b63=_[_0xbee9('0x3e')]({},_0xc02b63,_0x1ca7c9[_0xbee9('0x3f')]);var _0x35883b={'where':_0xc02b63[_0xbee9('0x3b')]};return db['SugarcrmField']['count'](_0x35883b)[_0xbee9('0x25')](function(_0x3a0646){_0x241203[_0xbee9('0x1e')]=_0x3a0646;if(_0x1ca7c9[_0xbee9('0x31')]['includeAll']){_0xc02b63[_0xbee9('0x40')]=[{'all':!![]}];}return db[_0xbee9('0x41')]['findAll'](_0xc02b63);})[_0xbee9('0x25')](function(_0x3f5e6b){_0x241203[_0xbee9('0x42')]=_0x3f5e6b;return _0x241203;})['then'](respondWithFilteredResult(_0x40da41,_0xc02b63))['catch'](handleError(_0x40da41,null));};exports[_0xbee9('0x43')]=function(_0x3a4b8d,_0x1e8aad){var _0x33d8b4={'raw':!![],'where':{'id':_0x3a4b8d[_0xbee9('0x44')]['id']}},_0x106b2c={};_0x106b2c['model']=_[_0xbee9('0x32')](db[_0xbee9('0x41')][_0xbee9('0x2c')]);_0x106b2c[_0xbee9('0x31')]=_['keys'](_0x3a4b8d[_0xbee9('0x31')]);_0x106b2c[_0xbee9('0x33')]=_[_0xbee9('0x34')](_0x106b2c[_0xbee9('0x30')],_0x106b2c[_0xbee9('0x31')]);_0x33d8b4[_0xbee9('0x35')]=_['intersection'](_0x106b2c['model'],qs[_0xbee9('0x36')](_0x3a4b8d[_0xbee9('0x31')][_0xbee9('0x36')]));_0x33d8b4[_0xbee9('0x35')]=_0x33d8b4[_0xbee9('0x35')][_0xbee9('0x37')]?_0x33d8b4[_0xbee9('0x35')]:_0x106b2c[_0xbee9('0x30')];if(_0x3a4b8d[_0xbee9('0x31')][_0xbee9('0x45')]){_0x33d8b4['include']=[{'all':!![]}];}_0x33d8b4=_[_0xbee9('0x3e')]({},_0x33d8b4,_0x3a4b8d[_0xbee9('0x3f')]);return db[_0xbee9('0x41')][_0xbee9('0x46')](_0x33d8b4)[_0xbee9('0x25')](handleEntityNotFound(_0x1e8aad,null))[_0xbee9('0x25')](respondWithResult(_0x1e8aad,null))['catch'](handleError(_0x1e8aad,null));};exports['create']=function(_0x19cdda,_0x2e6040){return db[_0xbee9('0x41')]['create'](_0x19cdda['body'],{})['then'](respondWithResult(_0x2e6040,0xc9))[_0xbee9('0x47')](handleError(_0x2e6040,null));};exports[_0xbee9('0x24')]=function(_0x20ea10,_0x129a19){if(_0x20ea10['body']['id']){delete _0x20ea10[_0xbee9('0x48')]['id'];}return db[_0xbee9('0x41')][_0xbee9('0x46')]({'where':{'id':_0x20ea10[_0xbee9('0x44')]['id']}})[_0xbee9('0x25')](handleEntityNotFound(_0x129a19,null))['then'](saveUpdates(_0x20ea10[_0xbee9('0x48')],null))[_0xbee9('0x25')](respondWithResult(_0x129a19,null))[_0xbee9('0x47')](handleError(_0x129a19,null));};exports['destroy']=function(_0x44d67e,_0x2f79be){return db[_0xbee9('0x41')][_0xbee9('0x46')]({'where':{'id':_0x44d67e[_0xbee9('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f79be,null))[_0xbee9('0x25')](removeEntity(_0x2f79be,null))[_0xbee9('0x47')](handleError(_0x2f79be,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b7fedb5..fa54b53 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 _0x2b7a=['api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','define','sugarcrm_unique_index','idField','lodash','util','../../config/logger'];(function(_0x53b266,_0x249cf9){var _0x58bf1d=function(_0x981885){while(--_0x981885){_0x53b266['push'](_0x53b266['shift']());}};_0x58bf1d(++_0x249cf9);}(_0x2b7a,0xe7));var _0xa2b7=function(_0x18b584,_0x38af55){_0x18b584=_0x18b584-0x0;var _0x59b826=_0x2b7a[_0x18b584];return _0x59b826;};'use strict';var _=require(_0xa2b7('0x0'));var util=require(_0xa2b7('0x1'));var logger=require(_0xa2b7('0x2'))(_0xa2b7('0x3'));var moment=require(_0xa2b7('0x4'));var BPromise=require(_0xa2b7('0x5'));var rp=require(_0xa2b7('0x6'));var fs=require('fs');var path=require(_0xa2b7('0x7'));var rimraf=require(_0xa2b7('0x8'));var config=require('../../config/environment');var attributes=require(_0xa2b7('0x9'));module['exports']=function(_0x5d0cd7,_0x102872){return _0x5d0cd7[_0xa2b7('0xa')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xa2b7('0xb'),'fields':[_0xa2b7('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa6d=['moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x3c62ef,_0x4bb6ab){var _0x4d44f1=function(_0x12b12c){while(--_0x12b12c){_0x3c62ef['push'](_0x3c62ef['shift']());}};_0x4d44f1(++_0x4bb6ab);}(_0xfa6d,0xfc));var _0xdfa6=function(_0x43d72f,_0x1ff0a3){_0x43d72f=_0x43d72f-0x0;var _0x47330a=_0xfa6d[_0x43d72f];return _0x47330a;};'use strict';var _=require(_0xdfa6('0x0'));var util=require(_0xdfa6('0x1'));var logger=require(_0xdfa6('0x2'))(_0xdfa6('0x3'));var moment=require(_0xdfa6('0x4'));var BPromise=require('bluebird');var rp=require(_0xdfa6('0x5'));var fs=require('fs');var path=require(_0xdfa6('0x6'));var rimraf=require(_0xdfa6('0x7'));var config=require(_0xdfa6('0x8'));var attributes=require(_0xdfa6('0x9'));module[_0xdfa6('0xa')]=function(_0x4f48d9,_0x56c5bb){return _0x4f48d9[_0xdfa6('0xb')](_0xdfa6('0xc'),attributes,{'tableName':_0xdfa6('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xdfa6('0xe'),_0xdfa6('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index c489d1e..e72044d 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 _0xa6e6=['../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x13c174,_0xda25fe){var _0x160654=function(_0x1b6ac2){while(--_0x1b6ac2){_0x13c174['push'](_0x13c174['shift']());}};_0x160654(++_0xda25fe);}(_0xa6e6,0x74));var _0x6a6e=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xa6e6[_0x2a67fe];return _0x57e726;};'use strict';var _=require(_0x6a6e('0x0'));var util=require(_0x6a6e('0x1'));var moment=require(_0x6a6e('0x2'));var BPromise=require(_0x6a6e('0x3'));var rs=require(_0x6a6e('0x4'));var fs=require('fs');var Redis=require(_0x6a6e('0x5'));var db=require(_0x6a6e('0x6'))['db'];var utils=require(_0x6a6e('0x7'));var logger=require(_0x6a6e('0x8'))('rpc');var config=require(_0x6a6e('0x9'));var jayson=require(_0x6a6e('0xa'));var client=jayson[_0x6a6e('0xb')][_0x6a6e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x368b99,_0x2bbc7b,_0x16bc94){return new BPromise(function(_0x15fdd9,_0x400320){return client[_0x6a6e('0xd')](_0x368b99,_0x16bc94)[_0x6a6e('0xe')](function(_0x45327d){logger['info'](_0x6a6e('0xf'),_0x2bbc7b,_0x6a6e('0x10'));logger['debug'](_0x6a6e('0x11'),_0x2bbc7b,_0x6a6e('0x10'),JSON[_0x6a6e('0x12')](_0x45327d));if(_0x45327d[_0x6a6e('0x13')]){if(_0x45327d[_0x6a6e('0x13')][_0x6a6e('0x14')]===0x1f4){logger['error'](_0x6a6e('0xf'),_0x2bbc7b,_0x45327d[_0x6a6e('0x13')][_0x6a6e('0x15')]);return _0x400320(_0x45327d['error'][_0x6a6e('0x15')]);}logger[_0x6a6e('0x13')](_0x6a6e('0xf'),_0x2bbc7b,_0x45327d[_0x6a6e('0x13')][_0x6a6e('0x15')]);return _0x15fdd9(_0x45327d[_0x6a6e('0x13')]['message']);}else{logger[_0x6a6e('0x16')]('SugarcrmField,\x20%s,\x20%s',_0x2bbc7b,'request\x20sent');_0x15fdd9(_0x45327d[_0x6a6e('0x17')][_0x6a6e('0x15')]);}})[_0x6a6e('0x18')](function(_0x48c8f0){logger['error'](_0x6a6e('0xf'),_0x2bbc7b,_0x48c8f0);_0x400320(_0x48c8f0);});});} \ No newline at end of file +var _0x877a=['http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x148da6,_0x367a47){var _0x211e8f=function(_0xe9ae7e){while(--_0xe9ae7e){_0x148da6['push'](_0x148da6['shift']());}};_0x211e8f(++_0x367a47);}(_0x877a,0x1a9));var _0xa877=function(_0xb265b5,_0x3a1d12){_0xb265b5=_0xb265b5-0x0;var _0x4aee9e=_0x877a[_0xb265b5];return _0x4aee9e;};'use strict';var _=require(_0xa877('0x0'));var util=require(_0xa877('0x1'));var moment=require(_0xa877('0x2'));var BPromise=require(_0xa877('0x3'));var rs=require(_0xa877('0x4'));var fs=require('fs');var Redis=require(_0xa877('0x5'));var db=require(_0xa877('0x6'))['db'];var utils=require(_0xa877('0x7'));var logger=require(_0xa877('0x8'))(_0xa877('0x9'));var config=require('../../config/environment');var jayson=require(_0xa877('0xa'));var client=jayson[_0xa877('0xb')][_0xa877('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d4c0a,_0x4ece42,_0x4c9558){return new BPromise(function(_0x55af7e,_0x3ce1a1){return client[_0xa877('0xd')](_0x3d4c0a,_0x4c9558)[_0xa877('0xe')](function(_0x5b9004){logger['info'](_0xa877('0xf'),_0x4ece42,_0xa877('0x10'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x4ece42,'request\x20sent',JSON[_0xa877('0x11')](_0x5b9004));if(_0x5b9004['error']){if(_0x5b9004[_0xa877('0x12')][_0xa877('0x13')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4ece42,_0x5b9004[_0xa877('0x12')][_0xa877('0x14')]);return _0x3ce1a1(_0x5b9004[_0xa877('0x12')][_0xa877('0x14')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4ece42,_0x5b9004[_0xa877('0x12')]['message']);return _0x55af7e(_0x5b9004['error']['message']);}else{logger['info'](_0xa877('0xf'),_0x4ece42,'request\x20sent');_0x55af7e(_0x5b9004[_0xa877('0x15')]['message']);}})[_0xa877('0x16')](function(_0x51bd16){logger[_0xa877('0x12')](_0xa877('0xf'),_0x4ece42,_0x51bd16);_0x3ce1a1(_0x51bd16);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0cb0ff1..1a4e198 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 _0x0627=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0627,0x1d8));var _0x7062=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x0627[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0x7062('0x0'));var util=require(_0x7062('0x1'));var path=require(_0x7062('0x2'));var timeout=require(_0x7062('0x3'));var express=require(_0x7062('0x4'));var router=express[_0x7062('0x5')]();var fs_extra=require(_0x7062('0x6'));var auth=require(_0x7062('0x7'));var interaction=require(_0x7062('0x8'));var config=require(_0x7062('0x9'));var controller=require(_0x7062('0xa'));router['get']('/',auth[_0x7062('0xb')](),controller[_0x7062('0xc')]);router[_0x7062('0xd')](_0x7062('0xe'),auth[_0x7062('0xb')](),controller['show']);router[_0x7062('0xd')]('/:id/configurations',auth[_0x7062('0xb')](),controller[_0x7062('0xf')]);router['get']('/:id/fields',auth[_0x7062('0xb')](),controller[_0x7062('0x10')]);router[_0x7062('0x11')]('/',auth['isAuthenticated'](),controller[_0x7062('0x12')]);router[_0x7062('0x11')](_0x7062('0x13'),auth[_0x7062('0xb')](),controller[_0x7062('0x14')]);router[_0x7062('0x15')](_0x7062('0xe'),auth[_0x7062('0xb')](),controller[_0x7062('0x16')]);router[_0x7062('0x17')]('/:id',auth[_0x7062('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x455d=['update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x455d,0x190));var _0xd455=function(_0x5decc1,_0x294575){_0x5decc1=_0x5decc1-0x0;var _0x4babfe=_0x455d[_0x5decc1];return _0x4babfe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd455('0x0'));var timeout=require(_0xd455('0x1'));var express=require(_0xd455('0x2'));var router=express['Router']();var fs_extra=require(_0xd455('0x3'));var auth=require(_0xd455('0x4'));var interaction=require(_0xd455('0x5'));var config=require(_0xd455('0x6'));var controller=require(_0xd455('0x7'));router[_0xd455('0x8')]('/',auth[_0xd455('0x9')](),controller[_0xd455('0xa')]);router[_0xd455('0x8')]('/:id',auth[_0xd455('0x9')](),controller[_0xd455('0xb')]);router['get'](_0xd455('0xc'),auth[_0xd455('0x9')](),controller[_0xd455('0xd')]);router[_0xd455('0x8')]('/:id/fields',auth[_0xd455('0x9')](),controller[_0xd455('0xe')]);router['post']('/',auth[_0xd455('0x9')](),controller[_0xd455('0xf')]);router[_0xd455('0x10')](_0xd455('0xc'),auth[_0xd455('0x9')](),controller[_0xd455('0x11')]);router['put']('/:id',auth[_0xd455('0x9')](),controller[_0xd455('0x12')]);router[_0xd455('0x13')]('/:id',auth[_0xd455('0x9')](),controller[_0xd455('0x14')]);module[_0xd455('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 32d208f..df6ca67 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 _0x1ef3=['sequelize','exports','STRING'];(function(_0x117bfa,_0x41278d){var _0x16b0c2=function(_0x509b30){while(--_0x509b30){_0x117bfa['push'](_0x117bfa['shift']());}};_0x16b0c2(++_0x41278d);}(_0x1ef3,0xa2));var _0x31ef=function(_0x4d4844,_0x1cd43f){_0x4d4844=_0x4d4844-0x0;var _0x4706d1=_0x1ef3[_0x4d4844];return _0x4706d1;};'use strict';var Sequelize=require(_0x31ef('0x0'));module[_0x31ef('0x1')]={'name':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x31ef('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe175=['HelpDesk','sequelize','STRING'];(function(_0x38162f,_0x1558f2){var _0xad645a=function(_0x1fb032){while(--_0x1fb032){_0x38162f['push'](_0x38162f['shift']());}};_0xad645a(++_0x1558f2);}(_0xe175,0xdf));var _0x5e17=function(_0x2ac828,_0x261250){_0x2ac828=_0x2ac828-0x0;var _0x331425=_0xe175[_0x2ac828];return _0x331425;};'use strict';var Sequelize=require(_0x5e17('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e17('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5e17('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5e17('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5e17('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5e17('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b16ea47..9ee4856 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 _0xbc13=['slice','substring','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','owner','remove','editable','false','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','end','error','stack','name','index','map','VtigerAccount','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','rawAttributes','find','body','update','destroy','params','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username'];(function(_0x93cead,_0x5ba4c1){var _0x1f33e0=function(_0x3aa131){while(--_0x3aa131){_0x93cead['push'](_0x93cead['shift']());}};_0x1f33e0(++_0x5ba4c1);}(_0xbc13,0x10c));var _0x3bc1=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xbc13[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bc1('0x0'));var zipdir=require(_0x3bc1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3bc1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bc1('0x3'));var util=require(_0x3bc1('0x4'));var path=require(_0x3bc1('0x5'));var sox=require(_0x3bc1('0x6'));var csv=require(_0x3bc1('0x7'));var ejs=require(_0x3bc1('0x8'));var fs=require('fs');var fs_extra=require(_0x3bc1('0x9'));var _=require(_0x3bc1('0xa'));var squel=require(_0x3bc1('0xb'));var crypto=require(_0x3bc1('0xc'));var jsforce=require(_0x3bc1('0xd'));var deskjs=require(_0x3bc1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3bc1('0xf'));var Papa=require(_0x3bc1('0x10'));var Redis=require(_0x3bc1('0x11'));var authService=require(_0x3bc1('0x12'));var qs=require(_0x3bc1('0x13'));var as=require(_0x3bc1('0x14'));var hardwareService=require(_0x3bc1('0x15'));var logger=require(_0x3bc1('0x16'))(_0x3bc1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3bc1('0x18'));function respondWithStatusCode(_0x20b9ce,_0x1bdcb6){_0x1bdcb6=_0x1bdcb6||0xcc;return function(_0x2084d1){if(_0x2084d1){return _0x20b9ce[_0x3bc1('0x19')](_0x1bdcb6);}return _0x20b9ce[_0x3bc1('0x1a')](_0x1bdcb6)['end']();};}function respondWithResult(_0x5ec3f3,_0x3402fd){_0x3402fd=_0x3402fd||0xc8;return function(_0x2e1bbc){if(_0x2e1bbc){return _0x5ec3f3['status'](_0x3402fd)['json'](_0x2e1bbc);}};}function respondWithFilteredResult(_0x318d16,_0x4d92b6){return function(_0xc0f8cd){if(_0xc0f8cd){var _0x4ec317=typeof _0x4d92b6[_0x3bc1('0x1b')]==='undefined'&&typeof _0x4d92b6['limit']===_0x3bc1('0x1c');var _0x74c982=_0xc0f8cd[_0x3bc1('0x1d')];var _0x5e5699=_0x4ec317?0x0:_0x4d92b6[_0x3bc1('0x1b')];var _0x147df9=_0x4ec317?_0xc0f8cd[_0x3bc1('0x1d')]:_0x4d92b6[_0x3bc1('0x1b')]+_0x4d92b6[_0x3bc1('0x1e')];var _0x2837c2;if(_0x147df9>=_0x74c982){_0x147df9=_0x74c982;_0x2837c2=0xc8;}else{_0x2837c2=0xce;}_0x318d16[_0x3bc1('0x1a')](_0x2837c2);return _0x318d16[_0x3bc1('0x1f')](_0x3bc1('0x20'),_0x5e5699+'-'+_0x147df9+'/'+_0x74c982)[_0x3bc1('0x21')](_0xc0f8cd);}return null;};}function patchUpdates(_0x44ca79){return function(_0x5e4f66){try{jsonpatch[_0x3bc1('0x22')](_0x5e4f66,_0x44ca79,!![]);}catch(_0x759bbf){return BPromise[_0x3bc1('0x23')](_0x759bbf);}return _0x5e4f66[_0x3bc1('0x24')]();};}function saveUpdates(_0x157cd5,_0x4795ed){return function(_0x20353c){if(_0x20353c){return _0x20353c['update'](_0x157cd5)['then'](function(_0x368687){return _0x368687;});}return null;};}function removeEntity(_0x9599a4,_0x384d79){return function(_0x395461){if(_0x395461){return _0x395461['destroy']()['then'](function(){_0x9599a4[_0x3bc1('0x1a')](0xcc)[_0x3bc1('0x25')]();});}};}function handleEntityNotFound(_0x2d2491,_0x159d0b){return function(_0x418f13){if(!_0x418f13){_0x2d2491[_0x3bc1('0x19')](0x194);}return _0x418f13;};}function handleError(_0x9c1d63,_0x60310){_0x60310=_0x60310||0x1f4;return function(_0xeecddc){logger[_0x3bc1('0x26')](_0xeecddc[_0x3bc1('0x27')]);if(_0xeecddc[_0x3bc1('0x28')]){delete _0xeecddc[_0x3bc1('0x28')];}_0x9c1d63['status'](_0x60310)['send'](_0xeecddc);};}exports[_0x3bc1('0x29')]=function(_0x5c5866,_0x589583){var _0x44a96e={},_0x2d19a6={},_0x2cda2f={'count':0x0,'rows':[]};var _0x3067ff=_[_0x3bc1('0x2a')](db[_0x3bc1('0x2b')]['rawAttributes'],function(_0x3f13ee){return{'name':_0x3f13ee[_0x3bc1('0x2c')],'type':_0x3f13ee[_0x3bc1('0x2d')]['key']};});_0x2d19a6[_0x3bc1('0x2e')]=_[_0x3bc1('0x2a')](_0x3067ff,_0x3bc1('0x28'));_0x2d19a6['query']=_[_0x3bc1('0x2f')](_0x5c5866[_0x3bc1('0x30')]);_0x2d19a6[_0x3bc1('0x31')]=_[_0x3bc1('0x32')](_0x2d19a6[_0x3bc1('0x2e')],_0x2d19a6[_0x3bc1('0x30')]);_0x44a96e[_0x3bc1('0x33')]=_[_0x3bc1('0x32')](_0x2d19a6[_0x3bc1('0x2e')],qs['fields'](_0x5c5866[_0x3bc1('0x30')][_0x3bc1('0x34')]));_0x44a96e['attributes']=_0x44a96e[_0x3bc1('0x33')][_0x3bc1('0x35')]?_0x44a96e['attributes']:_0x2d19a6['model'];if(!_0x5c5866[_0x3bc1('0x30')]['hasOwnProperty'](_0x3bc1('0x36'))){_0x44a96e[_0x3bc1('0x1e')]=qs['limit'](_0x5c5866[_0x3bc1('0x30')][_0x3bc1('0x1e')]);_0x44a96e[_0x3bc1('0x1b')]=qs[_0x3bc1('0x1b')](_0x5c5866[_0x3bc1('0x30')][_0x3bc1('0x1b')]);}_0x44a96e[_0x3bc1('0x37')]=qs[_0x3bc1('0x38')](_0x5c5866[_0x3bc1('0x30')]['sort']);_0x44a96e[_0x3bc1('0x39')]=qs[_0x3bc1('0x31')](_[_0x3bc1('0x3a')](_0x5c5866['query'],_0x2d19a6[_0x3bc1('0x31')]),_0x3067ff);if(_0x5c5866[_0x3bc1('0x30')]['filter']){_0x44a96e[_0x3bc1('0x39')]=_['merge'](_0x44a96e[_0x3bc1('0x39')],{'$or':_[_0x3bc1('0x2a')](_0x3067ff,function(_0x2e446d){if(_0x2e446d[_0x3bc1('0x2d')]!==_0x3bc1('0x3b')){var _0x1a859d={};_0x1a859d[_0x2e446d[_0x3bc1('0x28')]]={'$like':'%'+_0x5c5866['query'][_0x3bc1('0x3c')]+'%'};return _0x1a859d;}})});}_0x44a96e=_[_0x3bc1('0x3d')]({},_0x44a96e,_0x5c5866[_0x3bc1('0x3e')]);var _0x59bda8={'where':_0x44a96e[_0x3bc1('0x39')]};return db[_0x3bc1('0x2b')][_0x3bc1('0x1d')](_0x59bda8)[_0x3bc1('0x3f')](function(_0x57f5b0){_0x2cda2f[_0x3bc1('0x1d')]=_0x57f5b0;if(_0x5c5866[_0x3bc1('0x30')][_0x3bc1('0x40')]){_0x44a96e[_0x3bc1('0x41')]=[{'all':!![]}];}return db[_0x3bc1('0x2b')][_0x3bc1('0x42')](_0x44a96e);})[_0x3bc1('0x3f')](function(_0x2ed08f){_0x2cda2f[_0x3bc1('0x43')]=_0x2ed08f;return _0x2cda2f;})[_0x3bc1('0x3f')](respondWithFilteredResult(_0x589583,_0x44a96e))[_0x3bc1('0x44')](handleError(_0x589583,null));};exports[_0x3bc1('0x45')]=function(_0x37d10b,_0x44556a){var _0xaf3d2f={'raw':![],'where':{'id':_0x37d10b['params']['id']}},_0x4d9323={};_0x4d9323['model']=_[_0x3bc1('0x2f')](db[_0x3bc1('0x2b')][_0x3bc1('0x46')]);_0x4d9323[_0x3bc1('0x30')]=_[_0x3bc1('0x2f')](_0x37d10b[_0x3bc1('0x30')]);_0x4d9323[_0x3bc1('0x31')]=_['intersection'](_0x4d9323[_0x3bc1('0x2e')],_0x4d9323[_0x3bc1('0x30')]);_0xaf3d2f[_0x3bc1('0x33')]=_['intersection'](_0x4d9323[_0x3bc1('0x2e')],qs[_0x3bc1('0x34')](_0x37d10b[_0x3bc1('0x30')][_0x3bc1('0x34')]));_0xaf3d2f[_0x3bc1('0x33')]=_0xaf3d2f[_0x3bc1('0x33')][_0x3bc1('0x35')]?_0xaf3d2f[_0x3bc1('0x33')]:_0x4d9323[_0x3bc1('0x2e')];if(_0x37d10b[_0x3bc1('0x30')][_0x3bc1('0x40')]){_0xaf3d2f[_0x3bc1('0x41')]=[{'all':!![]}];}_0xaf3d2f=_[_0x3bc1('0x3d')]({},_0xaf3d2f,_0x37d10b[_0x3bc1('0x3e')]);return db[_0x3bc1('0x2b')][_0x3bc1('0x47')](_0xaf3d2f)['then'](handleEntityNotFound(_0x44556a,null))['then'](respondWithResult(_0x44556a,null))[_0x3bc1('0x44')](handleError(_0x44556a,null));};exports['create']=function(_0x54e9c9,_0x3e0b13){return db[_0x3bc1('0x2b')]['create'](_0x54e9c9[_0x3bc1('0x48')],{})['then'](respondWithResult(_0x3e0b13,0xc9))['catch'](handleError(_0x3e0b13,null));};exports[_0x3bc1('0x49')]=function(_0x43dc08,_0x46d914){if(_0x43dc08[_0x3bc1('0x48')]['id']){delete _0x43dc08[_0x3bc1('0x48')]['id'];}return db[_0x3bc1('0x2b')]['find']({'where':{'id':_0x43dc08['params']['id']}})['then'](handleEntityNotFound(_0x46d914,null))[_0x3bc1('0x3f')](saveUpdates(_0x43dc08[_0x3bc1('0x48')],null))['then'](respondWithResult(_0x46d914,null))[_0x3bc1('0x44')](handleError(_0x46d914,null));};exports[_0x3bc1('0x4a')]=function(_0x209a4f,_0x270481){return db['VtigerAccount'][_0x3bc1('0x47')]({'where':{'id':_0x209a4f[_0x3bc1('0x4b')]['id']}})[_0x3bc1('0x3f')](handleEntityNotFound(_0x270481,null))[_0x3bc1('0x3f')](removeEntity(_0x270481,null))[_0x3bc1('0x44')](handleError(_0x270481,null));};exports[_0x3bc1('0x4c')]=function(_0x28eb83,_0x50705b,_0xa57a66){var _0x4a0e85={};var _0x5996ca={};var _0x4295ee;var _0x12597e;return db[_0x3bc1('0x2b')][_0x3bc1('0x4d')]({'where':{'id':_0x28eb83[_0x3bc1('0x4b')]['id']}})[_0x3bc1('0x3f')](handleEntityNotFound(_0x50705b,null))[_0x3bc1('0x3f')](function(_0x6ca17b){if(_0x6ca17b){_0x4295ee=_0x6ca17b;_0x5996ca[_0x3bc1('0x2e')]=_[_0x3bc1('0x2f')](db[_0x3bc1('0x4e')]['rawAttributes']);_0x5996ca['query']=_[_0x3bc1('0x2f')](_0x28eb83[_0x3bc1('0x30')]);_0x5996ca[_0x3bc1('0x31')]=_[_0x3bc1('0x32')](_0x5996ca[_0x3bc1('0x2e')],_0x5996ca[_0x3bc1('0x30')]);_0x4a0e85[_0x3bc1('0x33')]=_[_0x3bc1('0x32')](_0x5996ca[_0x3bc1('0x2e')],qs[_0x3bc1('0x34')](_0x28eb83[_0x3bc1('0x30')]['fields']));_0x4a0e85[_0x3bc1('0x33')]=_0x4a0e85[_0x3bc1('0x33')][_0x3bc1('0x35')]?_0x4a0e85[_0x3bc1('0x33')]:_0x5996ca[_0x3bc1('0x2e')];_0x4a0e85[_0x3bc1('0x37')]=qs[_0x3bc1('0x38')](_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x38')]);_0x4a0e85[_0x3bc1('0x39')]=qs[_0x3bc1('0x31')](_[_0x3bc1('0x3a')](_0x28eb83[_0x3bc1('0x30')],_0x5996ca[_0x3bc1('0x31')]));if(_0x28eb83['query'][_0x3bc1('0x3c')]){_0x4a0e85[_0x3bc1('0x39')]=_[_0x3bc1('0x3d')](_0x4a0e85[_0x3bc1('0x39')],{'$or':_[_0x3bc1('0x2a')](_0x4a0e85[_0x3bc1('0x33')],function(_0x5613bd){var _0x4efe15={};_0x4efe15[_0x5613bd]={'$like':'%'+_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x3c')]+'%'};return _0x4efe15;})});}_0x4a0e85=_[_0x3bc1('0x3d')]({},_0x4a0e85,_0x28eb83[_0x3bc1('0x3e')]);return _0x4295ee[_0x3bc1('0x4c')](_0x4a0e85);}})[_0x3bc1('0x3f')](function(_0x46f693){if(_0x46f693){_0x12597e=_0x46f693[_0x3bc1('0x35')];if(!_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x4f')](_0x3bc1('0x36'))){_0x4a0e85[_0x3bc1('0x1e')]=qs[_0x3bc1('0x1e')](_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x1e')]);_0x4a0e85['offset']=qs[_0x3bc1('0x1b')](_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x1b')]);}return _0x4295ee[_0x3bc1('0x4c')](_0x4a0e85);}})[_0x3bc1('0x3f')](function(_0x1b6653){if(_0x1b6653){return _0x1b6653?{'count':_0x12597e,'rows':_0x1b6653}:null;}})['then'](respondWithResult(_0x50705b,null))['catch'](handleError(_0x50705b,null));};exports[_0x3bc1('0x50')]=function(_0x259510,_0x230439,_0xec0eaa){if(_0x259510[_0x3bc1('0x48')]['id']){delete _0x259510[_0x3bc1('0x48')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x259510[_0x3bc1('0x4b')]['id']}})[_0x3bc1('0x3f')](handleEntityNotFound(_0x230439,null))['then'](function(_0x489043){if(_0x489043){_0x259510['body'][_0x3bc1('0x51')]=_0x489043['id'];_0x259510[_0x3bc1('0x48')][_0x3bc1('0x52')]=integrations['getSubjects'](_0x259510[_0x3bc1('0x48')][_0x3bc1('0x53')],_0x259510[_0x3bc1('0x48')][_0x3bc1('0x2d')]);_0x259510[_0x3bc1('0x48')][_0x3bc1('0x54')]=integrations[_0x3bc1('0x55')](_0x259510['body'][_0x3bc1('0x53')],_0x259510['body']['type']);return db['VtigerConfiguration']['create'](_0x259510[_0x3bc1('0x48')],{'include':[{'model':db[_0x3bc1('0x56')],'as':_0x3bc1('0x52')},{'model':db[_0x3bc1('0x56')],'as':_0x3bc1('0x54')}]});}return null;})[_0x3bc1('0x3f')](respondWithResult(_0x230439,null))[_0x3bc1('0x44')](handleError(_0x230439,null));};var md5=require(_0x3bc1('0x57'));exports[_0x3bc1('0x58')]=function(_0x357b5b,_0x10f555,_0x535b0e){var _0x1517c2=null;var _0x258cec=null;var _0x16bd98=null;var _0x19b4f9=null;var _0x5af13c='';return db[_0x3bc1('0x2b')]['findOne']({'where':{'id':_0x357b5b['params']['id']},'attributes':['id',_0x3bc1('0x28'),'username',_0x3bc1('0x59'),_0x3bc1('0x5a'),_0x3bc1('0x5b'),_0x3bc1('0x5c'),_0x3bc1('0x5d')]})['then'](handleEntityNotFound(_0x10f555,null))['then'](function(_0x253733){if(_0x253733){_0x1517c2=_0x253733[_0x3bc1('0x5e')];_0x258cec=_0x253733[_0x3bc1('0x5d')];_0x16bd98=_0x253733[_0x3bc1('0x5a')];_0x5af13c=_0x253733[_0x3bc1('0x5b')];var _0x19115b=_0x5af13c[_0x3bc1('0x5f')](-0x1);if(_0x19115b==='/'){_0x5af13c=_0x5af13c[_0x3bc1('0x60')](0x0,_0x5af13c['lastIndexOf'](_0x19115b));}_0x19b4f9=util['format']('%s/webservice.php',_0x5af13c);var _0x4f3d69={'method':_0x3bc1('0x61'),'uri':_0x19b4f9,'qs':{'operation':_0x3bc1('0x62'),'username':_0x253733[_0x3bc1('0x5e')]},'json':!![]};return rp(_0x4f3d69);}})[_0x3bc1('0x3f')](function(_0x2c2bd4){if(_0x2c2bd4[_0x3bc1('0x63')]){var _0x2e3f88={'method':_0x3bc1('0x64'),'uri':_0x19b4f9,'form':{'operation':_0x3bc1('0x65'),'username':_0x1517c2,'accessKey':md5(_0x2c2bd4[_0x3bc1('0x66')][_0x3bc1('0x67')]+_0x258cec)},'json':!![]};return rp(_0x2e3f88);}})['then'](function(_0x13b051){if(_0x13b051[_0x3bc1('0x63')]){var _0x4b9f55={'method':_0x3bc1('0x61'),'uri':_0x19b4f9,'qs':{'operation':_0x3bc1('0x68'),'username':_0x1517c2,'sessionName':_0x13b051[_0x3bc1('0x66')][_0x3bc1('0x69')],'elementType':_0x16bd98},'json':!![]};return rp(_0x4b9f55);}})[_0x3bc1('0x3f')](function(_0x378177){if(_0x378177[_0x3bc1('0x63')]){var _0x5cefc2=[_0x3bc1('0x6a'),'reference',_0x3bc1('0x6b')];_['remove'](_0x378177[_0x3bc1('0x66')][_0x3bc1('0x34')],function(_0x5ee7b3){return _0x5cefc2['includes'](_0x5ee7b3[_0x3bc1('0x2d')][_0x3bc1('0x28')]);});_[_0x3bc1('0x6c')](_0x378177[_0x3bc1('0x66')][_0x3bc1('0x34')],function(_0x143c6c){return _0x143c6c[_0x3bc1('0x6d')]===_0x3bc1('0x6e');});return{'count':_0x378177[_0x3bc1('0x66')][_0x3bc1('0x34')]['length'],'rows':_[_0x3bc1('0x2a')](_0x378177[_0x3bc1('0x66')][_0x3bc1('0x34')],function(_0x21b14a){return{'id':_0x21b14a['name'],'name':_0x21b14a['label'],'custom':_['startsWith'](_0x21b14a[_0x3bc1('0x28')],_0x3bc1('0x6f'))?!![]:![],'options':_0x21b14a[_0x3bc1('0x2d')]['name']===_0x3bc1('0x70')&&_0x21b14a['type'][_0x3bc1('0x71')][_0x3bc1('0x35')]>0x0?_['map'](_0x21b14a['type'][_0x3bc1('0x71')],function(_0x1dfeb4){return{'name':_0x1dfeb4['label'],'value':_0x1dfeb4[_0x3bc1('0x72')]};}):[]};})};}})[_0x3bc1('0x3f')](respondWithResult(_0x10f555,null))['catch'](function(_0x313d58){console['log'](_0x3bc1('0x73')+_0x313d58);var _0x1133cd=_0x357b5b[_0x3bc1('0x30')][_0x3bc1('0x74')]?0x1f4:_0x313d58['statusCode']||0x1f4;logger[_0x3bc1('0x26')](_0x3bc1('0x75'),_0x3bc1('0x58'),_0x1133cd,JSON[_0x3bc1('0x76')](_0x313d58));delete _0x313d58[_0x3bc1('0x28')];if(_0x1133cd===0x191){_0x1133cd=0x190;}_0x10f555[_0x3bc1('0x1a')](_0x1133cd)[_0x3bc1('0x77')](_0x357b5b['query'][_0x3bc1('0x74')]?{'message':_0x3bc1('0x78'),'statusCode':_0x313d58['statusCode']}:_0x313d58);});}; \ No newline at end of file +var _0xf4e2=['options','include','findAll','rows','catch','show','params','includeAll','create','body','find','findOne','VtigerConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','remoteUri','accessKey','username','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','POST','login','result','token','success','describe','sessionName','reference','owner','remove','editable','false','label','startsWith','cf_','picklistValues','value','vTiger\x20error:\x20','test','statusCode','stringify','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x4c617c,_0x32bf97){var _0x361d79=function(_0x4b92df){while(--_0x4b92df){_0x4c617c['push'](_0x4c617c['shift']());}};_0x361d79(++_0x32bf97);}(_0xf4e2,0xae));var _0x2f4e=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0xf4e2[_0x55c485];return _0x6bb521;};'use strict';var emlformat=require(_0x2f4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2f4e('0x1'));var jsonpatch=require(_0x2f4e('0x2'));var rp=require('request-promise');var moment=require(_0x2f4e('0x3'));var BPromise=require(_0x2f4e('0x4'));var Mustache=require(_0x2f4e('0x5'));var util=require(_0x2f4e('0x6'));var path=require('path');var sox=require(_0x2f4e('0x7'));var csv=require(_0x2f4e('0x8'));var ejs=require(_0x2f4e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f4e('0xa'));var squel=require(_0x2f4e('0xb'));var crypto=require('crypto');var jsforce=require(_0x2f4e('0xc'));var deskjs=require(_0x2f4e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2f4e('0xe'));var Papa=require(_0x2f4e('0xf'));var Redis=require(_0x2f4e('0x10'));var authService=require(_0x2f4e('0x11'));var qs=require(_0x2f4e('0x12'));var as=require(_0x2f4e('0x13'));var hardwareService=require(_0x2f4e('0x14'));var logger=require(_0x2f4e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2f4e('0x16'));var licenseUtil=require(_0x2f4e('0x17'));var db=require(_0x2f4e('0x18'))['db'];var integrations=require(_0x2f4e('0x19'));function respondWithStatusCode(_0x1868f1,_0x8c095a){_0x8c095a=_0x8c095a||0xcc;return function(_0x13bbb4){if(_0x13bbb4){return _0x1868f1[_0x2f4e('0x1a')](_0x8c095a);}return _0x1868f1[_0x2f4e('0x1b')](_0x8c095a)[_0x2f4e('0x1c')]();};}function respondWithResult(_0x3da0d5,_0x39bd14){_0x39bd14=_0x39bd14||0xc8;return function(_0x3171fe){if(_0x3171fe){return _0x3da0d5['status'](_0x39bd14)[_0x2f4e('0x1d')](_0x3171fe);}};}function respondWithFilteredResult(_0xc8bc2a,_0x4cb738){return function(_0x589e7a){if(_0x589e7a){var _0x3a4d4c=typeof _0x4cb738[_0x2f4e('0x1e')]===_0x2f4e('0x1f')&&typeof _0x4cb738[_0x2f4e('0x20')]===_0x2f4e('0x1f');var _0x51ff34=_0x589e7a[_0x2f4e('0x21')];var _0x142f93=_0x3a4d4c?0x0:_0x4cb738[_0x2f4e('0x1e')];var _0x2c29b3=_0x3a4d4c?_0x589e7a[_0x2f4e('0x21')]:_0x4cb738[_0x2f4e('0x1e')]+_0x4cb738['limit'];var _0x1958db;if(_0x2c29b3>=_0x51ff34){_0x2c29b3=_0x51ff34;_0x1958db=0xc8;}else{_0x1958db=0xce;}_0xc8bc2a['status'](_0x1958db);return _0xc8bc2a[_0x2f4e('0x22')]('Content-Range',_0x142f93+'-'+_0x2c29b3+'/'+_0x51ff34)[_0x2f4e('0x1d')](_0x589e7a);}return null;};}function patchUpdates(_0x397437){return function(_0x9568f3){try{jsonpatch['apply'](_0x9568f3,_0x397437,!![]);}catch(_0x199789){return BPromise[_0x2f4e('0x23')](_0x199789);}return _0x9568f3[_0x2f4e('0x24')]();};}function saveUpdates(_0x5e11fb,_0x3d5546){return function(_0x182bc0){if(_0x182bc0){return _0x182bc0[_0x2f4e('0x25')](_0x5e11fb)[_0x2f4e('0x26')](function(_0x47253a){return _0x47253a;});}return null;};}function removeEntity(_0x4546ca,_0x1a30e9){return function(_0x581e21){if(_0x581e21){return _0x581e21[_0x2f4e('0x27')]()['then'](function(){_0x4546ca[_0x2f4e('0x1b')](0xcc)[_0x2f4e('0x1c')]();});}};}function handleEntityNotFound(_0x36c268,_0x10ea3c){return function(_0x19067d){if(!_0x19067d){_0x36c268[_0x2f4e('0x1a')](0x194);}return _0x19067d;};}function handleError(_0x31546d,_0x28141b){_0x28141b=_0x28141b||0x1f4;return function(_0x299613){logger[_0x2f4e('0x28')](_0x299613['stack']);if(_0x299613[_0x2f4e('0x29')]){delete _0x299613[_0x2f4e('0x29')];}_0x31546d[_0x2f4e('0x1b')](_0x28141b)[_0x2f4e('0x2a')](_0x299613);};}exports['index']=function(_0x11dd8e,_0x3c374a){var _0xbe2bd5={},_0x1c27c0={},_0x1922b1={'count':0x0,'rows':[]};var _0x191bc4=_[_0x2f4e('0x2b')](db[_0x2f4e('0x2c')][_0x2f4e('0x2d')],function(_0x2319aa){return{'name':_0x2319aa[_0x2f4e('0x2e')],'type':_0x2319aa[_0x2f4e('0x2f')][_0x2f4e('0x30')]};});_0x1c27c0[_0x2f4e('0x31')]=_['map'](_0x191bc4,_0x2f4e('0x29'));_0x1c27c0[_0x2f4e('0x32')]=_[_0x2f4e('0x33')](_0x11dd8e[_0x2f4e('0x32')]);_0x1c27c0[_0x2f4e('0x34')]=_['intersection'](_0x1c27c0[_0x2f4e('0x31')],_0x1c27c0[_0x2f4e('0x32')]);_0xbe2bd5[_0x2f4e('0x35')]=_[_0x2f4e('0x36')](_0x1c27c0[_0x2f4e('0x31')],qs[_0x2f4e('0x37')](_0x11dd8e[_0x2f4e('0x32')][_0x2f4e('0x37')]));_0xbe2bd5[_0x2f4e('0x35')]=_0xbe2bd5['attributes'][_0x2f4e('0x38')]?_0xbe2bd5[_0x2f4e('0x35')]:_0x1c27c0[_0x2f4e('0x31')];if(!_0x11dd8e[_0x2f4e('0x32')][_0x2f4e('0x39')](_0x2f4e('0x3a'))){_0xbe2bd5[_0x2f4e('0x20')]=qs[_0x2f4e('0x20')](_0x11dd8e[_0x2f4e('0x32')][_0x2f4e('0x20')]);_0xbe2bd5[_0x2f4e('0x1e')]=qs[_0x2f4e('0x1e')](_0x11dd8e[_0x2f4e('0x32')][_0x2f4e('0x1e')]);}_0xbe2bd5[_0x2f4e('0x3b')]=qs[_0x2f4e('0x3c')](_0x11dd8e[_0x2f4e('0x32')]['sort']);_0xbe2bd5[_0x2f4e('0x3d')]=qs['filters'](_[_0x2f4e('0x3e')](_0x11dd8e['query'],_0x1c27c0['filters']),_0x191bc4);if(_0x11dd8e[_0x2f4e('0x32')][_0x2f4e('0x3f')]){_0xbe2bd5[_0x2f4e('0x3d')]=_[_0x2f4e('0x40')](_0xbe2bd5['where'],{'$or':_['map'](_0x191bc4,function(_0x2ff785){if(_0x2ff785[_0x2f4e('0x2f')]!==_0x2f4e('0x41')){var _0x2f89ca={};_0x2f89ca[_0x2ff785[_0x2f4e('0x29')]]={'$like':'%'+_0x11dd8e[_0x2f4e('0x32')][_0x2f4e('0x3f')]+'%'};return _0x2f89ca;}})});}_0xbe2bd5=_[_0x2f4e('0x40')]({},_0xbe2bd5,_0x11dd8e[_0x2f4e('0x42')]);var _0x4c31b3={'where':_0xbe2bd5[_0x2f4e('0x3d')]};return db[_0x2f4e('0x2c')][_0x2f4e('0x21')](_0x4c31b3)[_0x2f4e('0x26')](function(_0x4dbc54){_0x1922b1[_0x2f4e('0x21')]=_0x4dbc54;if(_0x11dd8e[_0x2f4e('0x32')]['includeAll']){_0xbe2bd5[_0x2f4e('0x43')]=[{'all':!![]}];}return db[_0x2f4e('0x2c')][_0x2f4e('0x44')](_0xbe2bd5);})[_0x2f4e('0x26')](function(_0x47ed07){_0x1922b1[_0x2f4e('0x45')]=_0x47ed07;return _0x1922b1;})[_0x2f4e('0x26')](respondWithFilteredResult(_0x3c374a,_0xbe2bd5))[_0x2f4e('0x46')](handleError(_0x3c374a,null));};exports[_0x2f4e('0x47')]=function(_0x558352,_0x46fde1){var _0x220274={'raw':![],'where':{'id':_0x558352[_0x2f4e('0x48')]['id']}},_0x289aef={};_0x289aef[_0x2f4e('0x31')]=_[_0x2f4e('0x33')](db['VtigerAccount'][_0x2f4e('0x2d')]);_0x289aef[_0x2f4e('0x32')]=_[_0x2f4e('0x33')](_0x558352[_0x2f4e('0x32')]);_0x289aef[_0x2f4e('0x34')]=_[_0x2f4e('0x36')](_0x289aef[_0x2f4e('0x31')],_0x289aef[_0x2f4e('0x32')]);_0x220274[_0x2f4e('0x35')]=_['intersection'](_0x289aef[_0x2f4e('0x31')],qs[_0x2f4e('0x37')](_0x558352[_0x2f4e('0x32')][_0x2f4e('0x37')]));_0x220274['attributes']=_0x220274[_0x2f4e('0x35')][_0x2f4e('0x38')]?_0x220274[_0x2f4e('0x35')]:_0x289aef[_0x2f4e('0x31')];if(_0x558352[_0x2f4e('0x32')][_0x2f4e('0x49')]){_0x220274[_0x2f4e('0x43')]=[{'all':!![]}];}_0x220274=_[_0x2f4e('0x40')]({},_0x220274,_0x558352[_0x2f4e('0x42')]);return db[_0x2f4e('0x2c')]['find'](_0x220274)[_0x2f4e('0x26')](handleEntityNotFound(_0x46fde1,null))['then'](respondWithResult(_0x46fde1,null))[_0x2f4e('0x46')](handleError(_0x46fde1,null));};exports[_0x2f4e('0x4a')]=function(_0x327d7e,_0x3a247){return db['VtigerAccount'][_0x2f4e('0x4a')](_0x327d7e[_0x2f4e('0x4b')],{})[_0x2f4e('0x26')](respondWithResult(_0x3a247,0xc9))[_0x2f4e('0x46')](handleError(_0x3a247,null));};exports[_0x2f4e('0x25')]=function(_0x32aeb1,_0x3213b5){if(_0x32aeb1[_0x2f4e('0x4b')]['id']){delete _0x32aeb1[_0x2f4e('0x4b')]['id'];}return db[_0x2f4e('0x2c')][_0x2f4e('0x4c')]({'where':{'id':_0x32aeb1[_0x2f4e('0x48')]['id']}})[_0x2f4e('0x26')](handleEntityNotFound(_0x3213b5,null))['then'](saveUpdates(_0x32aeb1[_0x2f4e('0x4b')],null))[_0x2f4e('0x26')](respondWithResult(_0x3213b5,null))[_0x2f4e('0x46')](handleError(_0x3213b5,null));};exports['destroy']=function(_0x43b5c1,_0x2d8caa){return db[_0x2f4e('0x2c')]['find']({'where':{'id':_0x43b5c1['params']['id']}})[_0x2f4e('0x26')](handleEntityNotFound(_0x2d8caa,null))[_0x2f4e('0x26')](removeEntity(_0x2d8caa,null))[_0x2f4e('0x46')](handleError(_0x2d8caa,null));};exports['getConfigurations']=function(_0x314c75,_0x3d9c57,_0x5d0e45){var _0x451644={};var _0x32efd3={};var _0x21b239;var _0x369ec5;return db[_0x2f4e('0x2c')][_0x2f4e('0x4d')]({'where':{'id':_0x314c75[_0x2f4e('0x48')]['id']}})[_0x2f4e('0x26')](handleEntityNotFound(_0x3d9c57,null))[_0x2f4e('0x26')](function(_0xc7976e){if(_0xc7976e){_0x21b239=_0xc7976e;_0x32efd3[_0x2f4e('0x31')]=_[_0x2f4e('0x33')](db[_0x2f4e('0x4e')][_0x2f4e('0x2d')]);_0x32efd3[_0x2f4e('0x32')]=_['keys'](_0x314c75[_0x2f4e('0x32')]);_0x32efd3['filters']=_['intersection'](_0x32efd3[_0x2f4e('0x31')],_0x32efd3[_0x2f4e('0x32')]);_0x451644['attributes']=_[_0x2f4e('0x36')](_0x32efd3[_0x2f4e('0x31')],qs[_0x2f4e('0x37')](_0x314c75[_0x2f4e('0x32')][_0x2f4e('0x37')]));_0x451644[_0x2f4e('0x35')]=_0x451644[_0x2f4e('0x35')][_0x2f4e('0x38')]?_0x451644[_0x2f4e('0x35')]:_0x32efd3[_0x2f4e('0x31')];_0x451644[_0x2f4e('0x3b')]=qs['sort'](_0x314c75[_0x2f4e('0x32')]['sort']);_0x451644[_0x2f4e('0x3d')]=qs[_0x2f4e('0x34')](_[_0x2f4e('0x3e')](_0x314c75[_0x2f4e('0x32')],_0x32efd3[_0x2f4e('0x34')]));if(_0x314c75[_0x2f4e('0x32')]['filter']){_0x451644[_0x2f4e('0x3d')]=_['merge'](_0x451644[_0x2f4e('0x3d')],{'$or':_[_0x2f4e('0x2b')](_0x451644[_0x2f4e('0x35')],function(_0x4eda2f){var _0x1e57fe={};_0x1e57fe[_0x4eda2f]={'$like':'%'+_0x314c75['query'][_0x2f4e('0x3f')]+'%'};return _0x1e57fe;})});}_0x451644=_[_0x2f4e('0x40')]({},_0x451644,_0x314c75['options']);return _0x21b239[_0x2f4e('0x4f')](_0x451644);}})[_0x2f4e('0x26')](function(_0x3df42f){if(_0x3df42f){_0x369ec5=_0x3df42f[_0x2f4e('0x38')];if(!_0x314c75[_0x2f4e('0x32')]['hasOwnProperty'](_0x2f4e('0x3a'))){_0x451644[_0x2f4e('0x20')]=qs[_0x2f4e('0x20')](_0x314c75[_0x2f4e('0x32')][_0x2f4e('0x20')]);_0x451644[_0x2f4e('0x1e')]=qs[_0x2f4e('0x1e')](_0x314c75[_0x2f4e('0x32')][_0x2f4e('0x1e')]);}return _0x21b239[_0x2f4e('0x4f')](_0x451644);}})[_0x2f4e('0x26')](function(_0x2e4585){if(_0x2e4585){return _0x2e4585?{'count':_0x369ec5,'rows':_0x2e4585}:null;}})[_0x2f4e('0x26')](respondWithResult(_0x3d9c57,null))['catch'](handleError(_0x3d9c57,null));};exports[_0x2f4e('0x50')]=function(_0x2b0470,_0x18745b,_0x1238d4){if(_0x2b0470[_0x2f4e('0x4b')]['id']){delete _0x2b0470[_0x2f4e('0x4b')]['id'];}return db[_0x2f4e('0x2c')][_0x2f4e('0x4d')]({'where':{'id':_0x2b0470[_0x2f4e('0x48')]['id']}})[_0x2f4e('0x26')](handleEntityNotFound(_0x18745b,null))['then'](function(_0x349712){if(_0x349712){_0x2b0470['body']['AccountId']=_0x349712['id'];_0x2b0470[_0x2f4e('0x4b')][_0x2f4e('0x51')]=integrations[_0x2f4e('0x52')](_0x2b0470[_0x2f4e('0x4b')][_0x2f4e('0x53')],_0x2b0470['body']['type']);_0x2b0470[_0x2f4e('0x4b')][_0x2f4e('0x54')]=integrations[_0x2f4e('0x55')](_0x2b0470['body']['channel'],_0x2b0470['body'][_0x2f4e('0x2f')]);return db[_0x2f4e('0x4e')][_0x2f4e('0x4a')](_0x2b0470[_0x2f4e('0x4b')],{'include':[{'model':db[_0x2f4e('0x56')],'as':'Subjects'},{'model':db[_0x2f4e('0x56')],'as':'Descriptions'}]});}return null;})[_0x2f4e('0x26')](respondWithResult(_0x18745b,null))[_0x2f4e('0x46')](handleError(_0x18745b,null));};var md5=require(_0x2f4e('0x57'));exports[_0x2f4e('0x58')]=function(_0x391d1c,_0x382610,_0x19398a){var _0x41a907=null;var _0x54fc12=null;var _0x5b8536=null;var _0x318bd7=null;var _0x19c5b1='';return db['VtigerAccount'][_0x2f4e('0x4d')]({'where':{'id':_0x391d1c[_0x2f4e('0x48')]['id']},'attributes':['id',_0x2f4e('0x29'),'username','description','moduleName',_0x2f4e('0x59'),'serverUrl',_0x2f4e('0x5a')]})[_0x2f4e('0x26')](handleEntityNotFound(_0x382610,null))[_0x2f4e('0x26')](function(_0x5d5987){if(_0x5d5987){_0x41a907=_0x5d5987[_0x2f4e('0x5b')];_0x54fc12=_0x5d5987[_0x2f4e('0x5a')];_0x5b8536=_0x5d5987[_0x2f4e('0x5c')];_0x19c5b1=_0x5d5987[_0x2f4e('0x59')];var _0x366235=_0x19c5b1[_0x2f4e('0x5d')](-0x1);if(_0x366235==='/'){_0x19c5b1=_0x19c5b1[_0x2f4e('0x5e')](0x0,_0x19c5b1[_0x2f4e('0x5f')](_0x366235));}_0x318bd7=util[_0x2f4e('0x60')](_0x2f4e('0x61'),_0x19c5b1);var _0x4e8709={'method':_0x2f4e('0x62'),'uri':_0x318bd7,'qs':{'operation':'getchallenge','username':_0x5d5987[_0x2f4e('0x5b')]},'json':!![]};return rp(_0x4e8709);}})[_0x2f4e('0x26')](function(_0x33ded2){if(_0x33ded2['success']){var _0x366869={'method':_0x2f4e('0x63'),'uri':_0x318bd7,'form':{'operation':_0x2f4e('0x64'),'username':_0x41a907,'accessKey':md5(_0x33ded2[_0x2f4e('0x65')][_0x2f4e('0x66')]+_0x54fc12)},'json':!![]};return rp(_0x366869);}})['then'](function(_0xe48e05){if(_0xe48e05[_0x2f4e('0x67')]){var _0x2928d0={'method':_0x2f4e('0x62'),'uri':_0x318bd7,'qs':{'operation':_0x2f4e('0x68'),'username':_0x41a907,'sessionName':_0xe48e05[_0x2f4e('0x65')][_0x2f4e('0x69')],'elementType':_0x5b8536},'json':!![]};return rp(_0x2928d0);}})[_0x2f4e('0x26')](function(_0x966ca4){if(_0x966ca4[_0x2f4e('0x67')]){var _0x6e7f62=['autogenerated',_0x2f4e('0x6a'),_0x2f4e('0x6b')];_[_0x2f4e('0x6c')](_0x966ca4[_0x2f4e('0x65')]['fields'],function(_0x354b3d){return _0x6e7f62['includes'](_0x354b3d['type']['name']);});_[_0x2f4e('0x6c')](_0x966ca4[_0x2f4e('0x65')][_0x2f4e('0x37')],function(_0x4dbb4a){return _0x4dbb4a[_0x2f4e('0x6d')]===_0x2f4e('0x6e');});return{'count':_0x966ca4[_0x2f4e('0x65')]['fields'][_0x2f4e('0x38')],'rows':_[_0x2f4e('0x2b')](_0x966ca4[_0x2f4e('0x65')][_0x2f4e('0x37')],function(_0x61eb4c){return{'id':_0x61eb4c[_0x2f4e('0x29')],'name':_0x61eb4c[_0x2f4e('0x6f')],'custom':_[_0x2f4e('0x70')](_0x61eb4c[_0x2f4e('0x29')],_0x2f4e('0x71'))?!![]:![],'options':_0x61eb4c['type'][_0x2f4e('0x29')]==='picklist'&&_0x61eb4c['type'][_0x2f4e('0x72')][_0x2f4e('0x38')]>0x0?_[_0x2f4e('0x2b')](_0x61eb4c[_0x2f4e('0x2f')][_0x2f4e('0x72')],function(_0x52d5bb){return{'name':_0x52d5bb[_0x2f4e('0x6f')],'value':_0x52d5bb[_0x2f4e('0x73')]};}):[]};})};}})[_0x2f4e('0x26')](respondWithResult(_0x382610,null))[_0x2f4e('0x46')](function(_0x395b8b){console['log'](_0x2f4e('0x74')+_0x395b8b);var _0x93b904=_0x391d1c[_0x2f4e('0x32')][_0x2f4e('0x75')]?0x1f4:_0x395b8b[_0x2f4e('0x76')]||0x1f4;logger[_0x2f4e('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x2f4e('0x58'),_0x93b904,JSON[_0x2f4e('0x77')](_0x395b8b));delete _0x395b8b[_0x2f4e('0x29')];if(_0x93b904===0x191){_0x93b904=0x190;}_0x382610[_0x2f4e('0x1b')](_0x93b904)[_0x2f4e('0x2a')](_0x391d1c['query'][_0x2f4e('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x395b8b[_0x2f4e('0x76')]}:_0x395b8b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 17abb23..bdfc4e0 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 _0xf606=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xf606,0x169));var _0x6f60=function(_0x131eea,_0x12987f){_0x131eea=_0x131eea-0x0;var _0x203e86=_0xf606[_0x131eea];return _0x203e86;};'use strict';var _=require(_0x6f60('0x0'));var util=require(_0x6f60('0x1'));var logger=require(_0x6f60('0x2'))(_0x6f60('0x3'));var moment=require(_0x6f60('0x4'));var BPromise=require(_0x6f60('0x5'));var rp=require(_0x6f60('0x6'));var fs=require('fs');var path=require(_0x6f60('0x7'));var rimraf=require('rimraf');var config=require(_0x6f60('0x8'));var attributes=require(_0x6f60('0x9'));var integrations=require(_0x6f60('0xa'));module[_0x6f60('0xb')]=function(_0x4ceb97,_0x1ec34f){return _0x4ceb97[_0x6f60('0xc')]('VtigerAccount',attributes,{'tableName':_0x6f60('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde87=['bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','lodash','util','../../config/logger','moment'];(function(_0x28adc2,_0x5c55ab){var _0x532b3d=function(_0x399964){while(--_0x399964){_0x28adc2['push'](_0x28adc2['shift']());}};_0x532b3d(++_0x5c55ab);}(_0xde87,0x1dc));var _0x7de8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xde87[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7de8('0x0'));var util=require(_0x7de8('0x1'));var logger=require(_0x7de8('0x2'))('api');var moment=require(_0x7de8('0x3'));var BPromise=require(_0x7de8('0x4'));var rp=require(_0x7de8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7de8('0x6'));var config=require(_0x7de8('0x7'));var attributes=require(_0x7de8('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x7de8('0x9')]=function(_0x3e4d17,_0x1fc5cb){return _0x3e4d17[_0x7de8('0xa')](_0x7de8('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index efd7fe3..e7f8985 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 _0x087b=['find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','limit','map','include','model','GetVtigerAccount','catch','ShowVtigerAccount'];(function(_0x2ec3aa,_0x29bd65){var _0x284ab2=function(_0x41bf34){while(--_0x41bf34){_0x2ec3aa['push'](_0x2ec3aa['shift']());}};_0x284ab2(++_0x29bd65);}(_0x087b,0x11a));var _0xb087=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x087b[_0x580647];return _0x5f0792;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['GetVtigerAccount']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['VtigerAccount'][_0xb087('0x16')]({'raw':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0x330005['options']?_0x330005['options']['where']||null:null,'attributes':_0x330005['options']?_0x330005[_0xb087('0x17')][_0xb087('0x19')]||null:null,'limit':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x1a')]||null:null,'include':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')]['include']?_[_0xb087('0x1b')](_0x330005[_0xb087('0x17')][_0xb087('0x1c')],function(_0x1cfb3e){return{'model':db[_0x1cfb3e[_0xb087('0x1d')]],'as':_0x1cfb3e['as'],'attributes':_0x1cfb3e['attributes'],'include':_0x1cfb3e[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x1cfb3e['include'],function(_0x5a2dc6){return{'model':db[_0x5a2dc6['model']],'as':_0x5a2dc6['as'],'attributes':_0x5a2dc6['attributes'],'include':_0x5a2dc6['include']?_[_0xb087('0x1b')](_0x5a2dc6[_0xb087('0x1c')],function(_0x1d124f){return{'model':db[_0x1d124f[_0xb087('0x1d')]],'as':_0x1d124f['as'],'attributes':_0x1d124f[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0xf3f41f){logger[_0xb087('0xd')](_0xb087('0x1e'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x1e'),_0x330005,JSON[_0xb087('0x11')](_0xf3f41f));_0x17200d(_0xf3f41f);})[_0xb087('0x1f')](function(_0x263259){logger['error'](_0xb087('0x1e'),_0x263259[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x263259[_0xb087('0x14')]));});});};exports[_0xb087('0x20')]=function(_0xa6d90c){var _0x2e1c57=this;return new Promise(function(_0x13fb2f,_0x53a535){return db['VtigerAccount'][_0xb087('0x21')]({'raw':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c['options'][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x22')]||null:null,'attributes':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x19')]||null:null,'include':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x1c')]?_[_0xb087('0x1b')](_0xa6d90c[_0xb087('0x17')]['include'],function(_0x3bec03){return{'model':db[_0x3bec03['model']],'as':_0x3bec03['as'],'attributes':_0x3bec03[_0xb087('0x19')],'include':_0x3bec03[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x3bec03[_0xb087('0x1c')],function(_0x13cb5d){return{'model':db[_0x13cb5d[_0xb087('0x1d')]],'as':_0x13cb5d['as'],'attributes':_0x13cb5d[_0xb087('0x19')],'include':_0x13cb5d[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x13cb5d['include'],function(_0x5814c2){return{'model':db[_0x5814c2[_0xb087('0x1d')]],'as':_0x5814c2['as'],'attributes':_0x5814c2[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0x2d2902){logger[_0xb087('0xd')]('ShowVtigerAccount',_0xa6d90c);logger[_0xb087('0xf')](_0xb087('0x20'),_0xa6d90c,JSON['stringify'](_0x2d2902));_0x13fb2f(_0x2d2902);})['catch'](function(_0x1726c2){logger[_0xb087('0x12')](_0xb087('0x20'),_0x1726c2['message'],_0xa6d90c);_0x53a535(_0x2e1c57[_0xb087('0x12')](0x1f4,_0x1726c2[_0xb087('0x14')]));});});}; \ No newline at end of file +var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','include','map','model','then','ShowVtigerAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xcb91[_0x22e47a];return _0x15a12a;};'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')]('VtigerAccount,\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);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetVtigerAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['VtigerAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowVtigerAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 5e19392..e71148f 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 _0xf8a7=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','put','update','multer','util','path'];(function(_0x41e880,_0x40d287){var _0x4bf20f=function(_0x1c47a0){while(--_0x1c47a0){_0x41e880['push'](_0x41e880['shift']());}};_0x4bf20f(++_0x40d287);}(_0xf8a7,0xba));var _0x7f8a=function(_0x24da02,_0x5a90e0){_0x24da02=_0x24da02-0x0;var _0x44b2dd=_0xf8a7[_0x24da02];return _0x44b2dd;};'use strict';var multer=require(_0x7f8a('0x0'));var util=require(_0x7f8a('0x1'));var path=require(_0x7f8a('0x2'));var timeout=require(_0x7f8a('0x3'));var express=require(_0x7f8a('0x4'));var router=express[_0x7f8a('0x5')]();var fs_extra=require(_0x7f8a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7f8a('0x7'));var config=require('../../config/environment');var controller=require(_0x7f8a('0x8'));router[_0x7f8a('0x9')]('/',auth[_0x7f8a('0xa')](),controller[_0x7f8a('0xb')]);router[_0x7f8a('0x9')](_0x7f8a('0xc'),auth['isAuthenticated'](),controller[_0x7f8a('0xd')]);router[_0x7f8a('0x9')](_0x7f8a('0xe'),auth['isAuthenticated'](),controller[_0x7f8a('0xf')]);router[_0x7f8a('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x7f8a('0x10')]);router[_0x7f8a('0x9')]('/:id/descriptions',auth[_0x7f8a('0xa')](),controller[_0x7f8a('0x11')]);router[_0x7f8a('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7f8a('0x13')]('/:id',auth[_0x7f8a('0xa')](),controller[_0x7f8a('0x14')]);router['delete'](_0x7f8a('0xc'),auth[_0x7f8a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7061=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','index','isAuthenticated','show','getFields','getSubjects','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x5ca107,_0x4c6b72){var _0x213a12=function(_0x5c995f){while(--_0x5c995f){_0x5ca107['push'](_0x5ca107['shift']());}};_0x213a12(++_0x4c6b72);}(_0x7061,0xb7));var _0x1706=function(_0x10b513,_0x2f674b){_0x10b513=_0x10b513-0x0;var _0x3b7705=_0x7061[_0x10b513];return _0x3b7705;};'use strict';var multer=require(_0x1706('0x0'));var util=require(_0x1706('0x1'));var path=require(_0x1706('0x2'));var timeout=require('connect-timeout');var express=require(_0x1706('0x3'));var router=express['Router']();var fs_extra=require(_0x1706('0x4'));var auth=require(_0x1706('0x5'));var interaction=require(_0x1706('0x6'));var config=require('../../config/environment');var controller=require(_0x1706('0x7'));router[_0x1706('0x8')]('/',auth['isAuthenticated'](),controller[_0x1706('0x9')]);router[_0x1706('0x8')]('/:id',auth[_0x1706('0xa')](),controller[_0x1706('0xb')]);router[_0x1706('0x8')]('/:id/fields',auth[_0x1706('0xa')](),controller[_0x1706('0xc')]);router[_0x1706('0x8')]('/:id/subjects',auth[_0x1706('0xa')](),controller[_0x1706('0xd')]);router[_0x1706('0x8')]('/:id/descriptions',auth[_0x1706('0xa')](),controller[_0x1706('0xe')]);router[_0x1706('0xf')]('/',auth[_0x1706('0xa')](),controller[_0x1706('0x10')]);router[_0x1706('0x11')](_0x1706('0x12'),auth['isAuthenticated'](),controller[_0x1706('0x13')]);router[_0x1706('0x14')]('/:id',auth[_0x1706('0xa')](),controller[_0x1706('0x15')]);module[_0x1706('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index b2c1fad..6d822a5 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 _0xf6ca=['STRING'];(function(_0x1d0eda,_0x21b537){var _0x2f8ac1=function(_0x34e393){while(--_0x34e393){_0x1d0eda['push'](_0x1d0eda['shift']());}};_0x2f8ac1(++_0x21b537);}(_0xf6ca,0x128));var _0xaf6c=function(_0x207b82,_0x3dd70e){_0x207b82=_0x207b82-0x0;var _0x35afe4=_0xf6ca[_0x207b82];return _0x35afe4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaf6c('0x0')]},'description':{'type':Sequelize[_0xaf6c('0x0')]}}; \ No newline at end of file +var _0x6d58=['exports','STRING'];(function(_0x3ad2dc,_0x4c4dd9){var _0x7c9ee7=function(_0x4ce34f){while(--_0x4ce34f){_0x3ad2dc['push'](_0x3ad2dc['shift']());}};_0x7c9ee7(++_0x4c4dd9);}(_0x6d58,0x1b0));var _0x86d5=function(_0xbf0261,_0x4a0852){_0xbf0261=_0xbf0261-0x0;var _0x91d138=_0x6d58[_0xbf0261];return _0x91d138;};'use strict';var Sequelize=require('sequelize');module[_0x86d5('0x0')]={'name':{'type':Sequelize[_0x86d5('0x1')]},'description':{'type':Sequelize[_0x86d5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index fbadc74..c59c7aa 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 _0x175f=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','getFields','VtigerField','order','findOne','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','key','map','query'];(function(_0xfd5ec6,_0x3c1203){var _0x4c585c=function(_0x1081c2){while(--_0x1081c2){_0xfd5ec6['push'](_0xfd5ec6['shift']());}};_0x4c585c(++_0x3c1203);}(_0x175f,0x1ab));var _0xf175=function(_0x30bc61,_0xb834ed){_0x30bc61=_0x30bc61-0x0;var _0x214191=_0x175f[_0x30bc61];return _0x214191;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf175('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf175('0x1'));var rp=require(_0xf175('0x2'));var moment=require('moment');var BPromise=require(_0xf175('0x3'));var Mustache=require(_0xf175('0x4'));var util=require(_0xf175('0x5'));var path=require(_0xf175('0x6'));var sox=require(_0xf175('0x7'));var csv=require(_0xf175('0x8'));var ejs=require(_0xf175('0x9'));var fs=require('fs');var fs_extra=require(_0xf175('0xa'));var _=require(_0xf175('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf175('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf175('0x8'));var querystring=require('querystring');var Papa=require(_0xf175('0xd'));var Redis=require(_0xf175('0xe'));var authService=require(_0xf175('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf175('0x10'));var logger=require(_0xf175('0x11'))('api');var utils=require(_0xf175('0x12'));var config=require(_0xf175('0x13'));var licenseUtil=require(_0xf175('0x14'));var db=require(_0xf175('0x15'))['db'];function respondWithStatusCode(_0x243176,_0x16295b){_0x16295b=_0x16295b||0xcc;return function(_0x542259){if(_0x542259){return _0x243176[_0xf175('0x16')](_0x16295b);}return _0x243176['status'](_0x16295b)[_0xf175('0x17')]();};}function respondWithResult(_0x7aeef9,_0xe80c6f){_0xe80c6f=_0xe80c6f||0xc8;return function(_0x66a11d){if(_0x66a11d){return _0x7aeef9[_0xf175('0x18')](_0xe80c6f)[_0xf175('0x19')](_0x66a11d);}};}function respondWithFilteredResult(_0x4fa1e9,_0x3bf953){return function(_0x83a11d){if(_0x83a11d){var _0x1a2798=typeof _0x3bf953['offset']==='undefined'&&typeof _0x3bf953[_0xf175('0x1a')]===_0xf175('0x1b');var _0x48a38a=_0x83a11d[_0xf175('0x1c')];var _0x4d2247=_0x1a2798?0x0:_0x3bf953[_0xf175('0x1d')];var _0x25cac8=_0x1a2798?_0x83a11d[_0xf175('0x1c')]:_0x3bf953[_0xf175('0x1d')]+_0x3bf953['limit'];var _0x25866b;if(_0x25cac8>=_0x48a38a){_0x25cac8=_0x48a38a;_0x25866b=0xc8;}else{_0x25866b=0xce;}_0x4fa1e9[_0xf175('0x18')](_0x25866b);return _0x4fa1e9[_0xf175('0x1e')](_0xf175('0x1f'),_0x4d2247+'-'+_0x25cac8+'/'+_0x48a38a)[_0xf175('0x19')](_0x83a11d);}return null;};}function patchUpdates(_0x37e6f5){return function(_0x2dbba6){try{jsonpatch[_0xf175('0x20')](_0x2dbba6,_0x37e6f5,!![]);}catch(_0x2069d2){return BPromise[_0xf175('0x21')](_0x2069d2);}return _0x2dbba6['save']();};}function saveUpdates(_0x599318,_0x6572d6){return function(_0xd3fa8c){if(_0xd3fa8c){return _0xd3fa8c['update'](_0x599318)[_0xf175('0x22')](function(_0x32cde2){return _0x32cde2;});}return null;};}function removeEntity(_0x2635b7,_0x55f4d5){return function(_0x2b4abf){if(_0x2b4abf){return _0x2b4abf[_0xf175('0x23')]()[_0xf175('0x22')](function(){_0x2635b7[_0xf175('0x18')](0xcc)[_0xf175('0x17')]();});}};}function handleEntityNotFound(_0x51f388,_0x256863){return function(_0x940f4d){if(!_0x940f4d){_0x51f388[_0xf175('0x16')](0x194);}return _0x940f4d;};}function handleError(_0x5c99b5,_0x5152a2){_0x5152a2=_0x5152a2||0x1f4;return function(_0x2cc47b){logger[_0xf175('0x24')](_0x2cc47b[_0xf175('0x25')]);if(_0x2cc47b[_0xf175('0x26')]){delete _0x2cc47b[_0xf175('0x26')];}_0x5c99b5[_0xf175('0x18')](_0x5152a2)[_0xf175('0x27')](_0x2cc47b);};}exports[_0xf175('0x28')]=function(_0xed036f,_0x33b281){var _0x3cfe5d={},_0x597c83={},_0xe1e09b={'count':0x0,'rows':[]};var _0x4d6c52=_['map'](db[_0xf175('0x29')][_0xf175('0x2a')],function(_0x5d75d9){return{'name':_0x5d75d9[_0xf175('0x2b')],'type':_0x5d75d9['type'][_0xf175('0x2c')]};});_0x597c83['model']=_[_0xf175('0x2d')](_0x4d6c52,_0xf175('0x26'));_0x597c83[_0xf175('0x2e')]=_['keys'](_0xed036f[_0xf175('0x2e')]);_0x597c83['filters']=_['intersection'](_0x597c83['model'],_0x597c83[_0xf175('0x2e')]);_0x3cfe5d['attributes']=_[_0xf175('0x2f')](_0x597c83[_0xf175('0x30')],qs[_0xf175('0x31')](_0xed036f['query'][_0xf175('0x31')]));_0x3cfe5d['attributes']=_0x3cfe5d[_0xf175('0x32')][_0xf175('0x33')]?_0x3cfe5d[_0xf175('0x32')]:_0x597c83[_0xf175('0x30')];if(!_0xed036f['query'][_0xf175('0x34')](_0xf175('0x35'))){_0x3cfe5d[_0xf175('0x1a')]=qs[_0xf175('0x1a')](_0xed036f[_0xf175('0x2e')][_0xf175('0x1a')]);_0x3cfe5d[_0xf175('0x1d')]=qs[_0xf175('0x1d')](_0xed036f[_0xf175('0x2e')]['offset']);}_0x3cfe5d['order']=qs[_0xf175('0x36')](_0xed036f[_0xf175('0x2e')][_0xf175('0x36')]);_0x3cfe5d[_0xf175('0x37')]=qs['filters'](_[_0xf175('0x38')](_0xed036f[_0xf175('0x2e')],_0x597c83[_0xf175('0x39')]),_0x4d6c52);if(_0xed036f[_0xf175('0x2e')][_0xf175('0x3a')]){_0x3cfe5d[_0xf175('0x37')]=_[_0xf175('0x3b')](_0x3cfe5d['where'],{'$or':_[_0xf175('0x2d')](_0x4d6c52,function(_0x577857){if(_0x577857[_0xf175('0x3c')]!=='VIRTUAL'){var _0x2eff90={};_0x2eff90[_0x577857[_0xf175('0x26')]]={'$like':'%'+_0xed036f[_0xf175('0x2e')]['filter']+'%'};return _0x2eff90;}})});}_0x3cfe5d=_['merge']({},_0x3cfe5d,_0xed036f[_0xf175('0x3d')]);var _0xc94abc={'where':_0x3cfe5d[_0xf175('0x37')]};return db['VtigerConfiguration'][_0xf175('0x1c')](_0xc94abc)[_0xf175('0x22')](function(_0x43004a){_0xe1e09b['count']=_0x43004a;if(_0xed036f[_0xf175('0x2e')]['includeAll']){_0x3cfe5d[_0xf175('0x3e')]=[{'all':!![]}];}return db[_0xf175('0x29')][_0xf175('0x3f')](_0x3cfe5d);})[_0xf175('0x22')](function(_0x8d2be1){_0xe1e09b[_0xf175('0x40')]=_0x8d2be1;return _0xe1e09b;})['then'](respondWithFilteredResult(_0x33b281,_0x3cfe5d))[_0xf175('0x41')](handleError(_0x33b281,null));};exports[_0xf175('0x42')]=function(_0x4cf345,_0xf9a12f){var _0x3483ba={'raw':![],'where':{'id':_0x4cf345[_0xf175('0x43')]['id']}},_0x20e76e={};_0x20e76e[_0xf175('0x30')]=_[_0xf175('0x44')](db[_0xf175('0x29')][_0xf175('0x2a')]);_0x20e76e[_0xf175('0x2e')]=_[_0xf175('0x44')](_0x4cf345[_0xf175('0x2e')]);_0x20e76e[_0xf175('0x39')]=_['intersection'](_0x20e76e[_0xf175('0x30')],_0x20e76e[_0xf175('0x2e')]);_0x3483ba[_0xf175('0x32')]=_[_0xf175('0x2f')](_0x20e76e[_0xf175('0x30')],qs[_0xf175('0x31')](_0x4cf345['query'][_0xf175('0x31')]));_0x3483ba[_0xf175('0x32')]=_0x3483ba[_0xf175('0x32')][_0xf175('0x33')]?_0x3483ba[_0xf175('0x32')]:_0x20e76e[_0xf175('0x30')];if(_0x4cf345[_0xf175('0x2e')][_0xf175('0x45')]){_0x3483ba[_0xf175('0x3e')]=[{'all':!![]}];}_0x3483ba=_[_0xf175('0x3b')]({},_0x3483ba,_0x4cf345[_0xf175('0x3d')]);return db[_0xf175('0x29')][_0xf175('0x46')](_0x3483ba)['then'](handleEntityNotFound(_0xf9a12f,null))[_0xf175('0x22')](respondWithResult(_0xf9a12f,null))['catch'](handleError(_0xf9a12f,null));};exports['create']=function(_0x569177,_0x225ddf){return db[_0xf175('0x29')][_0xf175('0x47')](_0x569177[_0xf175('0x48')],{})[_0xf175('0x22')](respondWithResult(_0x225ddf,0xc9))[_0xf175('0x41')](handleError(_0x225ddf,null));};exports['update']=function(_0x583a9b,_0x1e77fd){if(_0x583a9b['body']['id']){delete _0x583a9b[_0xf175('0x48')]['id'];}return db[_0xf175('0x29')][_0xf175('0x46')]({'where':{'id':_0x583a9b['params']['id']}})[_0xf175('0x22')](handleEntityNotFound(_0x1e77fd,null))[_0xf175('0x22')](saveUpdates(_0x583a9b['body'],null))[_0xf175('0x22')](respondWithResult(_0x1e77fd,null))[_0xf175('0x41')](handleError(_0x1e77fd,null));};exports[_0xf175('0x23')]=function(_0x491ebf,_0x1526ec){return db[_0xf175('0x29')]['find']({'where':{'id':_0x491ebf[_0xf175('0x43')]['id']}})['then'](handleEntityNotFound(_0x1526ec,null))[_0xf175('0x22')](removeEntity(_0x1526ec,null))['catch'](handleError(_0x1526ec,null));};exports[_0xf175('0x49')]=function(_0x185c72,_0x26a161,_0x1b1d42){var _0x1d889f={};var _0x4992ce={};var _0x555781;var _0x5d539b;return db[_0xf175('0x29')]['findOne']({'where':{'id':_0x185c72['params']['id']}})[_0xf175('0x22')](handleEntityNotFound(_0x26a161,null))['then'](function(_0x41fe78){if(_0x41fe78){_0x555781=_0x41fe78;_0x4992ce[_0xf175('0x30')]=_['keys'](db[_0xf175('0x4a')]['rawAttributes']);_0x4992ce['query']=_[_0xf175('0x44')](_0x185c72['query']);_0x4992ce[_0xf175('0x39')]=_[_0xf175('0x2f')](_0x4992ce[_0xf175('0x30')],_0x4992ce[_0xf175('0x2e')]);_0x1d889f[_0xf175('0x32')]=_[_0xf175('0x2f')](_0x4992ce['model'],qs[_0xf175('0x31')](_0x185c72['query'][_0xf175('0x31')]));_0x1d889f[_0xf175('0x32')]=_0x1d889f[_0xf175('0x32')]['length']?_0x1d889f[_0xf175('0x32')]:_0x4992ce[_0xf175('0x30')];_0x1d889f[_0xf175('0x4b')]=qs['sort'](_0x185c72[_0xf175('0x2e')][_0xf175('0x36')]);_0x1d889f['where']=qs['filters'](_['pick'](_0x185c72[_0xf175('0x2e')],_0x4992ce[_0xf175('0x39')]));if(_0x185c72[_0xf175('0x2e')][_0xf175('0x3a')]){_0x1d889f[_0xf175('0x37')]=_[_0xf175('0x3b')](_0x1d889f[_0xf175('0x37')],{'$or':_['map'](_0x1d889f[_0xf175('0x32')],function(_0x3e37d3){var _0x20ba9a={};_0x20ba9a[_0x3e37d3]={'$like':'%'+_0x185c72['query'][_0xf175('0x3a')]+'%'};return _0x20ba9a;})});}_0x1d889f=_[_0xf175('0x3b')]({},_0x1d889f,_0x185c72[_0xf175('0x3d')]);return _0x555781['getFields'](_0x1d889f);}})['then'](function(_0x5cd856){if(_0x5cd856){_0x5d539b=_0x5cd856[_0xf175('0x33')];if(!_0x185c72[_0xf175('0x2e')][_0xf175('0x34')]('nolimit')){_0x1d889f['limit']=qs['limit'](_0x185c72[_0xf175('0x2e')][_0xf175('0x1a')]);_0x1d889f[_0xf175('0x1d')]=qs[_0xf175('0x1d')](_0x185c72['query'][_0xf175('0x1d')]);}return _0x555781[_0xf175('0x49')](_0x1d889f);}})[_0xf175('0x22')](function(_0xfabf6f){if(_0xfabf6f){return _0xfabf6f?{'count':_0x5d539b,'rows':_0xfabf6f}:null;}})[_0xf175('0x22')](respondWithResult(_0x26a161,null))[_0xf175('0x41')](handleError(_0x26a161,null));};exports['getSubjects']=function(_0x38a00e,_0x354b1d,_0x1c8a88){var _0x4bc39e={};var _0x53ed5b={};var _0x2d0f94;var _0x1fc2ef;return db['VtigerConfiguration'][_0xf175('0x4c')]({'where':{'id':_0x38a00e[_0xf175('0x43')]['id']}})['then'](handleEntityNotFound(_0x354b1d,null))['then'](function(_0x2adb12){if(_0x2adb12){_0x2d0f94=_0x2adb12;_0x53ed5b[_0xf175('0x30')]=_[_0xf175('0x44')](db[_0xf175('0x4a')][_0xf175('0x2a')]);_0x53ed5b[_0xf175('0x2e')]=_[_0xf175('0x44')](_0x38a00e[_0xf175('0x2e')]);_0x53ed5b['filters']=_[_0xf175('0x2f')](_0x53ed5b[_0xf175('0x30')],_0x53ed5b[_0xf175('0x2e')]);_0x4bc39e[_0xf175('0x32')]=_[_0xf175('0x2f')](_0x53ed5b['model'],qs[_0xf175('0x31')](_0x38a00e[_0xf175('0x2e')][_0xf175('0x31')]));_0x4bc39e[_0xf175('0x32')]=_0x4bc39e[_0xf175('0x32')][_0xf175('0x33')]?_0x4bc39e[_0xf175('0x32')]:_0x53ed5b[_0xf175('0x30')];_0x4bc39e[_0xf175('0x4b')]=qs[_0xf175('0x36')](_0x38a00e[_0xf175('0x2e')][_0xf175('0x36')]);_0x4bc39e[_0xf175('0x37')]=qs[_0xf175('0x39')](_[_0xf175('0x38')](_0x38a00e[_0xf175('0x2e')],_0x53ed5b[_0xf175('0x39')]));if(_0x38a00e['query'][_0xf175('0x3a')]){_0x4bc39e[_0xf175('0x37')]=_[_0xf175('0x3b')](_0x4bc39e[_0xf175('0x37')],{'$or':_[_0xf175('0x2d')](_0x4bc39e['attributes'],function(_0x513c85){var _0x56795b={};_0x56795b[_0x513c85]={'$like':'%'+_0x38a00e[_0xf175('0x2e')][_0xf175('0x3a')]+'%'};return _0x56795b;})});}_0x4bc39e=_[_0xf175('0x3b')]({},_0x4bc39e,_0x38a00e[_0xf175('0x3d')]);return _0x2d0f94[_0xf175('0x4d')](_0x4bc39e);}})[_0xf175('0x22')](function(_0x371bdd){if(_0x371bdd){_0x1fc2ef=_0x371bdd[_0xf175('0x33')];if(!_0x38a00e[_0xf175('0x2e')]['hasOwnProperty'](_0xf175('0x35'))){_0x4bc39e['limit']=qs[_0xf175('0x1a')](_0x38a00e[_0xf175('0x2e')][_0xf175('0x1a')]);_0x4bc39e[_0xf175('0x1d')]=qs[_0xf175('0x1d')](_0x38a00e[_0xf175('0x2e')]['offset']);}return _0x2d0f94['getSubjects'](_0x4bc39e);}})[_0xf175('0x22')](function(_0x1a298c){if(_0x1a298c){return _0x1a298c?{'count':_0x1fc2ef,'rows':_0x1a298c}:null;}})[_0xf175('0x22')](respondWithResult(_0x354b1d,null))[_0xf175('0x41')](handleError(_0x354b1d,null));};exports[_0xf175('0x4e')]=function(_0x83e134,_0x5e8372,_0x2c0f87){var _0x2caaac={};var _0x322e65={};var _0x1ecd2b;var _0x3a1566;return db[_0xf175('0x29')][_0xf175('0x4c')]({'where':{'id':_0x83e134['params']['id']}})[_0xf175('0x22')](handleEntityNotFound(_0x5e8372,null))[_0xf175('0x22')](function(_0x29d65a){if(_0x29d65a){_0x1ecd2b=_0x29d65a;_0x322e65['model']=_['keys'](db[_0xf175('0x4a')][_0xf175('0x2a')]);_0x322e65[_0xf175('0x2e')]=_[_0xf175('0x44')](_0x83e134['query']);_0x322e65[_0xf175('0x39')]=_[_0xf175('0x2f')](_0x322e65[_0xf175('0x30')],_0x322e65[_0xf175('0x2e')]);_0x2caaac[_0xf175('0x32')]=_['intersection'](_0x322e65[_0xf175('0x30')],qs[_0xf175('0x31')](_0x83e134[_0xf175('0x2e')][_0xf175('0x31')]));_0x2caaac['attributes']=_0x2caaac[_0xf175('0x32')][_0xf175('0x33')]?_0x2caaac[_0xf175('0x32')]:_0x322e65[_0xf175('0x30')];_0x2caaac[_0xf175('0x4b')]=qs[_0xf175('0x36')](_0x83e134['query'][_0xf175('0x36')]);_0x2caaac[_0xf175('0x37')]=qs['filters'](_[_0xf175('0x38')](_0x83e134[_0xf175('0x2e')],_0x322e65[_0xf175('0x39')]));if(_0x83e134['query'][_0xf175('0x3a')]){_0x2caaac['where']=_[_0xf175('0x3b')](_0x2caaac[_0xf175('0x37')],{'$or':_[_0xf175('0x2d')](_0x2caaac[_0xf175('0x32')],function(_0x3e15b7){var _0x3393f8={};_0x3393f8[_0x3e15b7]={'$like':'%'+_0x83e134[_0xf175('0x2e')][_0xf175('0x3a')]+'%'};return _0x3393f8;})});}_0x2caaac=_['merge']({},_0x2caaac,_0x83e134[_0xf175('0x3d')]);return _0x1ecd2b[_0xf175('0x4e')](_0x2caaac);}})[_0xf175('0x22')](function(_0x2ee39b){if(_0x2ee39b){_0x3a1566=_0x2ee39b[_0xf175('0x33')];if(!_0x83e134[_0xf175('0x2e')][_0xf175('0x34')]('nolimit')){_0x2caaac[_0xf175('0x1a')]=qs[_0xf175('0x1a')](_0x83e134[_0xf175('0x2e')][_0xf175('0x1a')]);_0x2caaac[_0xf175('0x1d')]=qs['offset'](_0x83e134[_0xf175('0x2e')][_0xf175('0x1d')]);}return _0x1ecd2b[_0xf175('0x4e')](_0x2caaac);}})['then'](function(_0x1cd420){if(_0x1cd420){return _0x1cd420?{'count':_0x3a1566,'rows':_0x1cd420}:null;}})[_0xf175('0x22')](respondWithResult(_0x5e8372,null))[_0xf175('0x41')](handleError(_0x5e8372,null));}; \ No newline at end of file +var _0xe71e=['pick','filter','merge','where','options','findAll','rows','show','includeAll','include','catch','create','body','update','find','params','destroy','getFields','VtigerField','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3163b5,_0x534c32){var _0x32b3d3=function(_0x72b15c){while(--_0x72b15c){_0x3163b5['push'](_0x3163b5['shift']());}};_0x32b3d3(++_0x534c32);}(_0xe71e,0x103));var _0xee71=function(_0x5e390e,_0x396801){_0x5e390e=_0x5e390e-0x0;var _0x34b044=_0xe71e[_0x5e390e];return _0x34b044;};'use strict';var emlformat=require(_0xee71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee71('0x1'));var jsonpatch=require(_0xee71('0x2'));var rp=require(_0xee71('0x3'));var moment=require('moment');var BPromise=require(_0xee71('0x4'));var Mustache=require(_0xee71('0x5'));var util=require(_0xee71('0x6'));var path=require('path');var sox=require(_0xee71('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee71('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xee71('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xee71('0xa'));var toCsv=require(_0xee71('0xb'));var querystring=require('querystring');var Papa=require(_0xee71('0xc'));var Redis=require(_0xee71('0xd'));var authService=require(_0xee71('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xee71('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee71('0x10'))(_0xee71('0x11'));var utils=require(_0xee71('0x12'));var config=require(_0xee71('0x13'));var licenseUtil=require(_0xee71('0x14'));var db=require(_0xee71('0x15'))['db'];function respondWithStatusCode(_0x7afbb8,_0x5d8ddb){_0x5d8ddb=_0x5d8ddb||0xcc;return function(_0x4bb880){if(_0x4bb880){return _0x7afbb8[_0xee71('0x16')](_0x5d8ddb);}return _0x7afbb8['status'](_0x5d8ddb)[_0xee71('0x17')]();};}function respondWithResult(_0x5225eb,_0x56818b){_0x56818b=_0x56818b||0xc8;return function(_0x3c7c31){if(_0x3c7c31){return _0x5225eb[_0xee71('0x18')](_0x56818b)[_0xee71('0x19')](_0x3c7c31);}};}function respondWithFilteredResult(_0x2e2b2a,_0x3d1322){return function(_0x5f1bb2){if(_0x5f1bb2){var _0x53ef3b=typeof _0x3d1322[_0xee71('0x1a')]===_0xee71('0x1b')&&typeof _0x3d1322[_0xee71('0x1c')]===_0xee71('0x1b');var _0x435e4b=_0x5f1bb2[_0xee71('0x1d')];var _0x3660d9=_0x53ef3b?0x0:_0x3d1322[_0xee71('0x1a')];var _0x7a88e2=_0x53ef3b?_0x5f1bb2['count']:_0x3d1322['offset']+_0x3d1322[_0xee71('0x1c')];var _0x54e645;if(_0x7a88e2>=_0x435e4b){_0x7a88e2=_0x435e4b;_0x54e645=0xc8;}else{_0x54e645=0xce;}_0x2e2b2a['status'](_0x54e645);return _0x2e2b2a[_0xee71('0x1e')](_0xee71('0x1f'),_0x3660d9+'-'+_0x7a88e2+'/'+_0x435e4b)[_0xee71('0x19')](_0x5f1bb2);}return null;};}function patchUpdates(_0x19c42a){return function(_0x2ba154){try{jsonpatch[_0xee71('0x20')](_0x2ba154,_0x19c42a,!![]);}catch(_0x3f8018){return BPromise[_0xee71('0x21')](_0x3f8018);}return _0x2ba154[_0xee71('0x22')]();};}function saveUpdates(_0x4f4906,_0x2aa31a){return function(_0x33ce21){if(_0x33ce21){return _0x33ce21['update'](_0x4f4906)[_0xee71('0x23')](function(_0x3846fa){return _0x3846fa;});}return null;};}function removeEntity(_0x4b75b2,_0x1f6419){return function(_0x16a19d){if(_0x16a19d){return _0x16a19d['destroy']()[_0xee71('0x23')](function(){_0x4b75b2['status'](0xcc)[_0xee71('0x17')]();});}};}function handleEntityNotFound(_0x2bf5c1,_0x16fc38){return function(_0x4f23c3){if(!_0x4f23c3){_0x2bf5c1[_0xee71('0x16')](0x194);}return _0x4f23c3;};}function handleError(_0x5f4592,_0x24497b){_0x24497b=_0x24497b||0x1f4;return function(_0x1b9891){logger[_0xee71('0x24')](_0x1b9891['stack']);if(_0x1b9891[_0xee71('0x25')]){delete _0x1b9891[_0xee71('0x25')];}_0x5f4592[_0xee71('0x18')](_0x24497b)[_0xee71('0x26')](_0x1b9891);};}exports[_0xee71('0x27')]=function(_0x69e576,_0xc4afb1){var _0x546f93={},_0x1c38ad={},_0x5b1c93={'count':0x0,'rows':[]};var _0x1dd5af=_[_0xee71('0x28')](db[_0xee71('0x29')][_0xee71('0x2a')],function(_0x3575d3){return{'name':_0x3575d3[_0xee71('0x2b')],'type':_0x3575d3[_0xee71('0x2c')]['key']};});_0x1c38ad[_0xee71('0x2d')]=_['map'](_0x1dd5af,'name');_0x1c38ad['query']=_[_0xee71('0x2e')](_0x69e576['query']);_0x1c38ad[_0xee71('0x2f')]=_[_0xee71('0x30')](_0x1c38ad['model'],_0x1c38ad[_0xee71('0x31')]);_0x546f93[_0xee71('0x32')]=_[_0xee71('0x30')](_0x1c38ad['model'],qs[_0xee71('0x33')](_0x69e576[_0xee71('0x31')][_0xee71('0x33')]));_0x546f93['attributes']=_0x546f93[_0xee71('0x32')][_0xee71('0x34')]?_0x546f93[_0xee71('0x32')]:_0x1c38ad['model'];if(!_0x69e576[_0xee71('0x31')][_0xee71('0x35')](_0xee71('0x36'))){_0x546f93[_0xee71('0x1c')]=qs['limit'](_0x69e576[_0xee71('0x31')][_0xee71('0x1c')]);_0x546f93[_0xee71('0x1a')]=qs[_0xee71('0x1a')](_0x69e576[_0xee71('0x31')][_0xee71('0x1a')]);}_0x546f93[_0xee71('0x37')]=qs[_0xee71('0x38')](_0x69e576[_0xee71('0x31')][_0xee71('0x38')]);_0x546f93['where']=qs[_0xee71('0x2f')](_[_0xee71('0x39')](_0x69e576[_0xee71('0x31')],_0x1c38ad['filters']),_0x1dd5af);if(_0x69e576[_0xee71('0x31')][_0xee71('0x3a')]){_0x546f93['where']=_[_0xee71('0x3b')](_0x546f93[_0xee71('0x3c')],{'$or':_[_0xee71('0x28')](_0x1dd5af,function(_0x27760c){if(_0x27760c['type']!=='VIRTUAL'){var _0x33e653={};_0x33e653[_0x27760c[_0xee71('0x25')]]={'$like':'%'+_0x69e576[_0xee71('0x31')][_0xee71('0x3a')]+'%'};return _0x33e653;}})});}_0x546f93=_[_0xee71('0x3b')]({},_0x546f93,_0x69e576[_0xee71('0x3d')]);var _0x3ae718={'where':_0x546f93['where']};return db[_0xee71('0x29')][_0xee71('0x1d')](_0x3ae718)['then'](function(_0x3d268b){_0x5b1c93[_0xee71('0x1d')]=_0x3d268b;if(_0x69e576[_0xee71('0x31')]['includeAll']){_0x546f93['include']=[{'all':!![]}];}return db[_0xee71('0x29')][_0xee71('0x3e')](_0x546f93);})['then'](function(_0x1b29b7){_0x5b1c93[_0xee71('0x3f')]=_0x1b29b7;return _0x5b1c93;})['then'](respondWithFilteredResult(_0xc4afb1,_0x546f93))['catch'](handleError(_0xc4afb1,null));};exports[_0xee71('0x40')]=function(_0x2aee5f,_0x3de7a9){var _0x120101={'raw':![],'where':{'id':_0x2aee5f['params']['id']}},_0x3de088={};_0x3de088[_0xee71('0x2d')]=_[_0xee71('0x2e')](db['VtigerConfiguration'][_0xee71('0x2a')]);_0x3de088[_0xee71('0x31')]=_[_0xee71('0x2e')](_0x2aee5f[_0xee71('0x31')]);_0x3de088[_0xee71('0x2f')]=_[_0xee71('0x30')](_0x3de088['model'],_0x3de088[_0xee71('0x31')]);_0x120101[_0xee71('0x32')]=_[_0xee71('0x30')](_0x3de088['model'],qs[_0xee71('0x33')](_0x2aee5f['query'][_0xee71('0x33')]));_0x120101['attributes']=_0x120101['attributes']['length']?_0x120101[_0xee71('0x32')]:_0x3de088[_0xee71('0x2d')];if(_0x2aee5f[_0xee71('0x31')][_0xee71('0x41')]){_0x120101[_0xee71('0x42')]=[{'all':!![]}];}_0x120101=_[_0xee71('0x3b')]({},_0x120101,_0x2aee5f[_0xee71('0x3d')]);return db['VtigerConfiguration']['find'](_0x120101)[_0xee71('0x23')](handleEntityNotFound(_0x3de7a9,null))['then'](respondWithResult(_0x3de7a9,null))[_0xee71('0x43')](handleError(_0x3de7a9,null));};exports[_0xee71('0x44')]=function(_0x252c7a,_0x1349ea){return db[_0xee71('0x29')][_0xee71('0x44')](_0x252c7a[_0xee71('0x45')],{})[_0xee71('0x23')](respondWithResult(_0x1349ea,0xc9))['catch'](handleError(_0x1349ea,null));};exports[_0xee71('0x46')]=function(_0x39e35d,_0x15f1db){if(_0x39e35d['body']['id']){delete _0x39e35d[_0xee71('0x45')]['id'];}return db[_0xee71('0x29')][_0xee71('0x47')]({'where':{'id':_0x39e35d[_0xee71('0x48')]['id']}})[_0xee71('0x23')](handleEntityNotFound(_0x15f1db,null))[_0xee71('0x23')](saveUpdates(_0x39e35d['body'],null))[_0xee71('0x23')](respondWithResult(_0x15f1db,null))[_0xee71('0x43')](handleError(_0x15f1db,null));};exports[_0xee71('0x49')]=function(_0x517827,_0x422ba0){return db['VtigerConfiguration']['find']({'where':{'id':_0x517827[_0xee71('0x48')]['id']}})[_0xee71('0x23')](handleEntityNotFound(_0x422ba0,null))['then'](removeEntity(_0x422ba0,null))[_0xee71('0x43')](handleError(_0x422ba0,null));};exports[_0xee71('0x4a')]=function(_0x444a1a,_0x250265,_0x39b1e3){var _0x4899c8={};var _0x3672b7={};var _0x3c830e;var _0x4975a5;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x444a1a['params']['id']}})[_0xee71('0x23')](handleEntityNotFound(_0x250265,null))[_0xee71('0x23')](function(_0x3209ef){if(_0x3209ef){_0x3c830e=_0x3209ef;_0x3672b7[_0xee71('0x2d')]=_[_0xee71('0x2e')](db[_0xee71('0x4b')][_0xee71('0x2a')]);_0x3672b7[_0xee71('0x31')]=_[_0xee71('0x2e')](_0x444a1a[_0xee71('0x31')]);_0x3672b7[_0xee71('0x2f')]=_[_0xee71('0x30')](_0x3672b7[_0xee71('0x2d')],_0x3672b7['query']);_0x4899c8[_0xee71('0x32')]=_[_0xee71('0x30')](_0x3672b7[_0xee71('0x2d')],qs[_0xee71('0x33')](_0x444a1a[_0xee71('0x31')][_0xee71('0x33')]));_0x4899c8[_0xee71('0x32')]=_0x4899c8[_0xee71('0x32')][_0xee71('0x34')]?_0x4899c8['attributes']:_0x3672b7[_0xee71('0x2d')];_0x4899c8['order']=qs[_0xee71('0x38')](_0x444a1a[_0xee71('0x31')][_0xee71('0x38')]);_0x4899c8[_0xee71('0x3c')]=qs['filters'](_[_0xee71('0x39')](_0x444a1a[_0xee71('0x31')],_0x3672b7[_0xee71('0x2f')]));if(_0x444a1a[_0xee71('0x31')][_0xee71('0x3a')]){_0x4899c8[_0xee71('0x3c')]=_[_0xee71('0x3b')](_0x4899c8[_0xee71('0x3c')],{'$or':_[_0xee71('0x28')](_0x4899c8[_0xee71('0x32')],function(_0x5ce7bc){var _0x4e7cc3={};_0x4e7cc3[_0x5ce7bc]={'$like':'%'+_0x444a1a[_0xee71('0x31')][_0xee71('0x3a')]+'%'};return _0x4e7cc3;})});}_0x4899c8=_['merge']({},_0x4899c8,_0x444a1a['options']);return _0x3c830e['getFields'](_0x4899c8);}})['then'](function(_0x2c82a2){if(_0x2c82a2){_0x4975a5=_0x2c82a2[_0xee71('0x34')];if(!_0x444a1a[_0xee71('0x31')][_0xee71('0x35')](_0xee71('0x36'))){_0x4899c8[_0xee71('0x1c')]=qs[_0xee71('0x1c')](_0x444a1a['query'][_0xee71('0x1c')]);_0x4899c8['offset']=qs[_0xee71('0x1a')](_0x444a1a[_0xee71('0x31')][_0xee71('0x1a')]);}return _0x3c830e['getFields'](_0x4899c8);}})[_0xee71('0x23')](function(_0x243b04){if(_0x243b04){return _0x243b04?{'count':_0x4975a5,'rows':_0x243b04}:null;}})[_0xee71('0x23')](respondWithResult(_0x250265,null))[_0xee71('0x43')](handleError(_0x250265,null));};exports[_0xee71('0x4c')]=function(_0xecbef5,_0x726b8b,_0x5c2f9e){var _0x3d25b2={};var _0xfcbe6d={};var _0x2eb36d;var _0x12e696;return db[_0xee71('0x29')][_0xee71('0x4d')]({'where':{'id':_0xecbef5[_0xee71('0x48')]['id']}})[_0xee71('0x23')](handleEntityNotFound(_0x726b8b,null))[_0xee71('0x23')](function(_0x5c1291){if(_0x5c1291){_0x2eb36d=_0x5c1291;_0xfcbe6d[_0xee71('0x2d')]=_[_0xee71('0x2e')](db[_0xee71('0x4b')]['rawAttributes']);_0xfcbe6d[_0xee71('0x31')]=_['keys'](_0xecbef5[_0xee71('0x31')]);_0xfcbe6d[_0xee71('0x2f')]=_[_0xee71('0x30')](_0xfcbe6d[_0xee71('0x2d')],_0xfcbe6d['query']);_0x3d25b2[_0xee71('0x32')]=_[_0xee71('0x30')](_0xfcbe6d[_0xee71('0x2d')],qs['fields'](_0xecbef5[_0xee71('0x31')]['fields']));_0x3d25b2['attributes']=_0x3d25b2[_0xee71('0x32')][_0xee71('0x34')]?_0x3d25b2['attributes']:_0xfcbe6d[_0xee71('0x2d')];_0x3d25b2['order']=qs[_0xee71('0x38')](_0xecbef5['query'][_0xee71('0x38')]);_0x3d25b2[_0xee71('0x3c')]=qs['filters'](_[_0xee71('0x39')](_0xecbef5[_0xee71('0x31')],_0xfcbe6d[_0xee71('0x2f')]));if(_0xecbef5['query'][_0xee71('0x3a')]){_0x3d25b2['where']=_[_0xee71('0x3b')](_0x3d25b2[_0xee71('0x3c')],{'$or':_[_0xee71('0x28')](_0x3d25b2['attributes'],function(_0x340889){var _0x4433d0={};_0x4433d0[_0x340889]={'$like':'%'+_0xecbef5[_0xee71('0x31')][_0xee71('0x3a')]+'%'};return _0x4433d0;})});}_0x3d25b2=_[_0xee71('0x3b')]({},_0x3d25b2,_0xecbef5['options']);return _0x2eb36d[_0xee71('0x4c')](_0x3d25b2);}})[_0xee71('0x23')](function(_0x38a896){if(_0x38a896){_0x12e696=_0x38a896['length'];if(!_0xecbef5[_0xee71('0x31')]['hasOwnProperty'](_0xee71('0x36'))){_0x3d25b2[_0xee71('0x1c')]=qs[_0xee71('0x1c')](_0xecbef5[_0xee71('0x31')][_0xee71('0x1c')]);_0x3d25b2[_0xee71('0x1a')]=qs[_0xee71('0x1a')](_0xecbef5[_0xee71('0x31')]['offset']);}return _0x2eb36d[_0xee71('0x4c')](_0x3d25b2);}})[_0xee71('0x23')](function(_0x1d8804){if(_0x1d8804){return _0x1d8804?{'count':_0x12e696,'rows':_0x1d8804}:null;}})[_0xee71('0x23')](respondWithResult(_0x726b8b,null))[_0xee71('0x43')](handleError(_0x726b8b,null));};exports[_0xee71('0x4e')]=function(_0x5e89df,_0x42dcd0,_0x45be87){var _0xf6b495={};var _0x40997e={};var _0x326d71;var _0x3897a9;return db[_0xee71('0x29')][_0xee71('0x4d')]({'where':{'id':_0x5e89df[_0xee71('0x48')]['id']}})['then'](handleEntityNotFound(_0x42dcd0,null))[_0xee71('0x23')](function(_0x115f02){if(_0x115f02){_0x326d71=_0x115f02;_0x40997e[_0xee71('0x2d')]=_[_0xee71('0x2e')](db[_0xee71('0x4b')]['rawAttributes']);_0x40997e[_0xee71('0x31')]=_[_0xee71('0x2e')](_0x5e89df[_0xee71('0x31')]);_0x40997e['filters']=_[_0xee71('0x30')](_0x40997e[_0xee71('0x2d')],_0x40997e[_0xee71('0x31')]);_0xf6b495['attributes']=_[_0xee71('0x30')](_0x40997e['model'],qs[_0xee71('0x33')](_0x5e89df[_0xee71('0x31')][_0xee71('0x33')]));_0xf6b495['attributes']=_0xf6b495[_0xee71('0x32')][_0xee71('0x34')]?_0xf6b495[_0xee71('0x32')]:_0x40997e[_0xee71('0x2d')];_0xf6b495[_0xee71('0x37')]=qs[_0xee71('0x38')](_0x5e89df[_0xee71('0x31')][_0xee71('0x38')]);_0xf6b495['where']=qs['filters'](_[_0xee71('0x39')](_0x5e89df['query'],_0x40997e['filters']));if(_0x5e89df[_0xee71('0x31')][_0xee71('0x3a')]){_0xf6b495[_0xee71('0x3c')]=_[_0xee71('0x3b')](_0xf6b495[_0xee71('0x3c')],{'$or':_['map'](_0xf6b495[_0xee71('0x32')],function(_0xdb5041){var _0x11f0ee={};_0x11f0ee[_0xdb5041]={'$like':'%'+_0x5e89df['query']['filter']+'%'};return _0x11f0ee;})});}_0xf6b495=_['merge']({},_0xf6b495,_0x5e89df['options']);return _0x326d71[_0xee71('0x4e')](_0xf6b495);}})['then'](function(_0x2dd70f){if(_0x2dd70f){_0x3897a9=_0x2dd70f[_0xee71('0x34')];if(!_0x5e89df[_0xee71('0x31')]['hasOwnProperty'](_0xee71('0x36'))){_0xf6b495[_0xee71('0x1c')]=qs['limit'](_0x5e89df[_0xee71('0x31')][_0xee71('0x1c')]);_0xf6b495['offset']=qs[_0xee71('0x1a')](_0x5e89df[_0xee71('0x31')][_0xee71('0x1a')]);}return _0x326d71[_0xee71('0x4e')](_0xf6b495);}})[_0xee71('0x23')](function(_0x2e99ba){if(_0x2e99ba){return _0x2e99ba?{'count':_0x3897a9,'rows':_0x2e99ba}:null;}})['then'](respondWithResult(_0x42dcd0,null))['catch'](handleError(_0x42dcd0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4757210..244d03f 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 _0x13ce=['int_vtiger_configurations','util','api','moment','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration'];(function(_0x1d79f5,_0x3b2216){var _0x2bf37f=function(_0x2bbd7c){while(--_0x2bbd7c){_0x1d79f5['push'](_0x1d79f5['shift']());}};_0x2bf37f(++_0x3b2216);}(_0x13ce,0x1d7));var _0xe13c=function(_0x2500da,_0x135e4a){_0x2500da=_0x2500da-0x0;var _0x4221e2=_0x13ce[_0x2500da];return _0x4221e2;};'use strict';var _=require('lodash');var util=require(_0xe13c('0x0'));var logger=require('../../config/logger')(_0xe13c('0x1'));var moment=require(_0xe13c('0x2'));var BPromise=require('bluebird');var rp=require(_0xe13c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe13c('0x4'));var config=require(_0xe13c('0x5'));var attributes=require(_0xe13c('0x6'));module['exports']=function(_0x987fad,_0x48d7bb){return _0x987fad[_0xe13c('0x7')](_0xe13c('0x8'),attributes,{'tableName':_0xe13c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28a8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','lodash','util'];(function(_0x51f48d,_0x36d84f){var _0x2dbfbe=function(_0x18a6d9){while(--_0x18a6d9){_0x51f48d['push'](_0x51f48d['shift']());}};_0x2dbfbe(++_0x36d84f);}(_0x28a8,0x16f));var _0x828a=function(_0x45a099,_0x20ea5c){_0x45a099=_0x45a099-0x0;var _0x557e01=_0x28a8[_0x45a099];return _0x557e01;};'use strict';var _=require(_0x828a('0x0'));var util=require(_0x828a('0x1'));var logger=require(_0x828a('0x2'))(_0x828a('0x3'));var moment=require(_0x828a('0x4'));var BPromise=require(_0x828a('0x5'));var rp=require(_0x828a('0x6'));var fs=require('fs');var path=require(_0x828a('0x7'));var rimraf=require(_0x828a('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x4baa62,_0x3948bd){return _0x4baa62['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 72262ff..9193fed 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 _0x33d8=['debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3439db,_0x454f6){var _0x361d47=function(_0x1e76d9){while(--_0x1e76d9){_0x3439db['push'](_0x3439db['shift']());}};_0x361d47(++_0x454f6);}(_0x33d8,0xb9));var _0x833d=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x33d8[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x833d('0x0'));var util=require(_0x833d('0x1'));var moment=require(_0x833d('0x2'));var BPromise=require(_0x833d('0x3'));var rs=require(_0x833d('0x4'));var fs=require('fs');var Redis=require(_0x833d('0x5'));var db=require(_0x833d('0x6'))['db'];var utils=require(_0x833d('0x7'));var logger=require('../../config/logger')(_0x833d('0x8'));var config=require(_0x833d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x833d('0xa')][_0x833d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b7df1,_0x11b526,_0x27ea35){return new BPromise(function(_0x303598,_0x2ff084){return client['request'](_0x5b7df1,_0x27ea35)[_0x833d('0xc')](function(_0x4a007d){logger['info'](_0x833d('0xd'),_0x11b526,_0x833d('0xe'));logger[_0x833d('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x11b526,_0x833d('0xe'),JSON[_0x833d('0x10')](_0x4a007d));if(_0x4a007d['error']){if(_0x4a007d[_0x833d('0x11')]['code']===0x1f4){logger[_0x833d('0x11')](_0x833d('0xd'),_0x11b526,_0x4a007d[_0x833d('0x11')]['message']);return _0x2ff084(_0x4a007d[_0x833d('0x11')][_0x833d('0x12')]);}logger[_0x833d('0x11')](_0x833d('0xd'),_0x11b526,_0x4a007d[_0x833d('0x11')][_0x833d('0x12')]);return _0x303598(_0x4a007d[_0x833d('0x11')][_0x833d('0x12')]);}else{logger['info'](_0x833d('0xd'),_0x11b526,_0x833d('0xe'));_0x303598(_0x4a007d['result'][_0x833d('0x12')]);}})[_0x833d('0x13')](function(_0x57d4b7){logger['error'](_0x833d('0xd'),_0x11b526,_0x57d4b7);_0x2ff084(_0x57d4b7);});});} \ No newline at end of file +var _0xc9f8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x1148c4,_0x394df9){var _0x451564=function(_0x5ee353){while(--_0x5ee353){_0x1148c4['push'](_0x1148c4['shift']());}};_0x451564(++_0x394df9);}(_0xc9f8,0x13f));var _0x8c9f=function(_0x4fb15a,_0x24f15a){_0x4fb15a=_0x4fb15a-0x0;var _0x406b15=_0xc9f8[_0x4fb15a];return _0x406b15;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c9f('0x0'));var BPromise=require(_0x8c9f('0x1'));var rs=require(_0x8c9f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c9f('0x3'))['db'];var utils=require(_0x8c9f('0x4'));var logger=require(_0x8c9f('0x5'))(_0x8c9f('0x6'));var config=require(_0x8c9f('0x7'));var jayson=require(_0x8c9f('0x8'));var client=jayson[_0x8c9f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5828a5,_0x260e2a,_0x5e1e2b){return new BPromise(function(_0x387ed9,_0xc2f4db){return client[_0x8c9f('0xa')](_0x5828a5,_0x5e1e2b)[_0x8c9f('0xb')](function(_0x4abd96){logger[_0x8c9f('0xc')](_0x8c9f('0xd'),_0x260e2a,_0x8c9f('0xe'));logger[_0x8c9f('0xf')](_0x8c9f('0x10'),_0x260e2a,_0x8c9f('0xe'),JSON[_0x8c9f('0x11')](_0x4abd96));if(_0x4abd96[_0x8c9f('0x12')]){if(_0x4abd96[_0x8c9f('0x12')][_0x8c9f('0x13')]===0x1f4){logger[_0x8c9f('0x12')](_0x8c9f('0xd'),_0x260e2a,_0x4abd96[_0x8c9f('0x12')]['message']);return _0xc2f4db(_0x4abd96[_0x8c9f('0x12')][_0x8c9f('0x14')]);}logger[_0x8c9f('0x12')](_0x8c9f('0xd'),_0x260e2a,_0x4abd96['error'][_0x8c9f('0x14')]);return _0x387ed9(_0x4abd96[_0x8c9f('0x12')][_0x8c9f('0x14')]);}else{logger[_0x8c9f('0xc')](_0x8c9f('0xd'),_0x260e2a,'request\x20sent');_0x387ed9(_0x4abd96[_0x8c9f('0x15')][_0x8c9f('0x14')]);}})[_0x8c9f('0x16')](function(_0x5f138a){logger['error'](_0x8c9f('0xd'),_0x260e2a,_0x5f138a);_0xc2f4db(_0x5f138a);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4298b9f..5cfbd26 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 _0x9c45=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','update','delete','destroy','exports','path','Router'];(function(_0x20a510,_0x1c8846){var _0x12994a=function(_0x3a74d0){while(--_0x3a74d0){_0x20a510['push'](_0x20a510['shift']());}};_0x12994a(++_0x1c8846);}(_0x9c45,0x108));var _0x59c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c45[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x59c4('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59c4('0x1')]();var fs_extra=require(_0x59c4('0x2'));var auth=require(_0x59c4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x59c4('0x4'));var controller=require('./intVtigerField.controller');router[_0x59c4('0x5')]('/',auth[_0x59c4('0x6')](),controller[_0x59c4('0x7')]);router[_0x59c4('0x5')](_0x59c4('0x8'),auth['isAuthenticated'](),controller[_0x59c4('0x9')]);router['post']('/',auth[_0x59c4('0x6')](),controller['create']);router['put']('/:id',auth[_0x59c4('0x6')](),controller[_0x59c4('0xa')]);router[_0x59c4('0xb')](_0x59c4('0x8'),auth['isAuthenticated'](),controller[_0x59c4('0xc')]);module[_0x59c4('0xd')]=router; \ No newline at end of file +var _0x1262=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x36e84e,_0x3f53a3){var _0xe0d182=function(_0x2e91ab){while(--_0x2e91ab){_0x36e84e['push'](_0x36e84e['shift']());}};_0xe0d182(++_0x3f53a3);}(_0x1262,0x115));var _0x2126=function(_0x3f5069,_0x336c12){_0x3f5069=_0x3f5069-0x0;var _0x142d1e=_0x1262[_0x3f5069];return _0x142d1e;};'use strict';var multer=require(_0x2126('0x0'));var util=require(_0x2126('0x1'));var path=require(_0x2126('0x2'));var timeout=require(_0x2126('0x3'));var express=require(_0x2126('0x4'));var router=express[_0x2126('0x5')]();var fs_extra=require(_0x2126('0x6'));var auth=require(_0x2126('0x7'));var interaction=require(_0x2126('0x8'));var config=require('../../config/environment');var controller=require(_0x2126('0x9'));router['get']('/',auth[_0x2126('0xa')](),controller[_0x2126('0xb')]);router[_0x2126('0xc')](_0x2126('0xd'),auth['isAuthenticated'](),controller[_0x2126('0xe')]);router[_0x2126('0xf')]('/',auth[_0x2126('0xa')](),controller[_0x2126('0x10')]);router[_0x2126('0x11')](_0x2126('0xd'),auth[_0x2126('0xa')](),controller[_0x2126('0x12')]);router[_0x2126('0x13')](_0x2126('0xd'),auth[_0x2126('0xa')](),controller['destroy']);module[_0x2126('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 29e61b6..447a65b 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 _0x4527=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0xe9ec20,_0x4d6a00){var _0x46a5bd=function(_0x4c95f5){while(--_0x4c95f5){_0xe9ec20['push'](_0xe9ec20['shift']());}};_0x46a5bd(++_0x4d6a00);}(_0x4527,0x88));var _0x7452=function(_0x429fca,_0x54efd5){_0x429fca=_0x429fca-0x0;var _0x3e136e=_0x4527[_0x429fca];return _0x3e136e;};'use strict';var Sequelize=require(_0x7452('0x0'));module['exports']={'type':{'type':Sequelize[_0x7452('0x1')]('string',_0x7452('0x2'),_0x7452('0x3'),_0x7452('0x4'),_0x7452('0x5')),'defaultValue':_0x7452('0x6')},'content':{'type':Sequelize[_0x7452('0x7')]},'key':{'type':Sequelize[_0x7452('0x7')]},'keyType':{'type':Sequelize[_0x7452('0x1')](_0x7452('0x6'),_0x7452('0x2'),_0x7452('0x3'))},'keyContent':{'type':Sequelize[_0x7452('0x7')]},'idField':{'type':Sequelize[_0x7452('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7452('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7452('0x7')]}}; \ No newline at end of file +var _0xeb77=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xeb77,0x88));var _0x7eb7=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xeb77[_0x2e5f9c];return _0x538b44;};'use strict';var Sequelize=require(_0x7eb7('0x0'));module['exports']={'type':{'type':Sequelize[_0x7eb7('0x1')]('string',_0x7eb7('0x2'),_0x7eb7('0x3'),_0x7eb7('0x4'),_0x7eb7('0x5')),'defaultValue':_0x7eb7('0x6')},'content':{'type':Sequelize[_0x7eb7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7eb7('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x7eb7('0x7')]},'idField':{'type':Sequelize[_0x7eb7('0x7')]},'nameField':{'type':Sequelize[_0x7eb7('0x7')]},'customField':{'type':Sequelize[_0x7eb7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7eb7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index cda862d..8432b22 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 _0xd31d=['merge','type','options','includeAll','include','VtigerField','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','apply','save','update','then','destroy','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','pick','filter','where'];(function(_0x3ec487,_0x17ae54){var _0x91d6a9=function(_0x3c2424){while(--_0x3c2424){_0x3ec487['push'](_0x3ec487['shift']());}};_0x91d6a9(++_0x17ae54);}(_0xd31d,0x92));var _0xdd31=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xd31d[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0xdd31('0x0'));var rimraf=require(_0xdd31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd31('0x2'));var BPromise=require(_0xdd31('0x3'));var Mustache=require('mustache');var util=require(_0xdd31('0x4'));var path=require(_0xdd31('0x5'));var sox=require(_0xdd31('0x6'));var csv=require(_0xdd31('0x7'));var ejs=require(_0xdd31('0x8'));var fs=require('fs');var fs_extra=require(_0xdd31('0x9'));var _=require(_0xdd31('0xa'));var squel=require(_0xdd31('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd31('0xc'));var toCsv=require(_0xdd31('0x7'));var querystring=require(_0xdd31('0xd'));var Papa=require('papaparse');var Redis=require(_0xdd31('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdd31('0xf'));var as=require(_0xdd31('0x10'));var hardwareService=require(_0xdd31('0x11'));var logger=require('../../config/logger')(_0xdd31('0x12'));var utils=require('../../config/utils');var config=require(_0xdd31('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd31('0x14'))['db'];function respondWithStatusCode(_0x47527e,_0x2cad0f){_0x2cad0f=_0x2cad0f||0xcc;return function(_0xa3ebc9){if(_0xa3ebc9){return _0x47527e['sendStatus'](_0x2cad0f);}return _0x47527e[_0xdd31('0x15')](_0x2cad0f)[_0xdd31('0x16')]();};}function respondWithResult(_0x3f96ac,_0x922b8e){_0x922b8e=_0x922b8e||0xc8;return function(_0x217a1e){if(_0x217a1e){return _0x3f96ac['status'](_0x922b8e)[_0xdd31('0x17')](_0x217a1e);}};}function respondWithFilteredResult(_0x29030a,_0x190cf9){return function(_0x4e89b2){if(_0x4e89b2){var _0x39cdcc=typeof _0x190cf9[_0xdd31('0x18')]==='undefined'&&typeof _0x190cf9[_0xdd31('0x19')]==='undefined';var _0x3e6964=_0x4e89b2[_0xdd31('0x1a')];var _0x1e292e=_0x39cdcc?0x0:_0x190cf9['offset'];var _0x2cbd68=_0x39cdcc?_0x4e89b2[_0xdd31('0x1a')]:_0x190cf9['offset']+_0x190cf9[_0xdd31('0x19')];var _0x18e31d;if(_0x2cbd68>=_0x3e6964){_0x2cbd68=_0x3e6964;_0x18e31d=0xc8;}else{_0x18e31d=0xce;}_0x29030a['status'](_0x18e31d);return _0x29030a[_0xdd31('0x1b')]('Content-Range',_0x1e292e+'-'+_0x2cbd68+'/'+_0x3e6964)[_0xdd31('0x17')](_0x4e89b2);}return null;};}function patchUpdates(_0x5abd8f){return function(_0x2f191e){try{jsonpatch[_0xdd31('0x1c')](_0x2f191e,_0x5abd8f,!![]);}catch(_0x3638d2){return BPromise['reject'](_0x3638d2);}return _0x2f191e[_0xdd31('0x1d')]();};}function saveUpdates(_0x2b5786,_0x14effb){return function(_0x575f45){if(_0x575f45){return _0x575f45[_0xdd31('0x1e')](_0x2b5786)[_0xdd31('0x1f')](function(_0x5cc405){return _0x5cc405;});}return null;};}function removeEntity(_0x39c70a,_0x35b549){return function(_0x39f238){if(_0x39f238){return _0x39f238[_0xdd31('0x20')]()[_0xdd31('0x1f')](function(){_0x39c70a[_0xdd31('0x15')](0xcc)[_0xdd31('0x16')]();});}};}function handleEntityNotFound(_0x2e75b1,_0x5389a3){return function(_0x64f99f){if(!_0x64f99f){_0x2e75b1['sendStatus'](0x194);}return _0x64f99f;};}function handleError(_0x5dd1de,_0x2f4955){_0x2f4955=_0x2f4955||0x1f4;return function(_0x4ba571){logger['error'](_0x4ba571['stack']);if(_0x4ba571[_0xdd31('0x21')]){delete _0x4ba571[_0xdd31('0x21')];}_0x5dd1de[_0xdd31('0x15')](_0x2f4955)[_0xdd31('0x22')](_0x4ba571);};}exports[_0xdd31('0x23')]=function(_0x228e9f,_0x3e6a5b){var _0xa8a295={},_0x7b0c67={},_0x423906={'count':0x0,'rows':[]};var _0x32cc21=_['map'](db['VtigerField'][_0xdd31('0x24')],function(_0x274263){return{'name':_0x274263[_0xdd31('0x25')],'type':_0x274263['type'][_0xdd31('0x26')]};});_0x7b0c67['model']=_[_0xdd31('0x27')](_0x32cc21,_0xdd31('0x21'));_0x7b0c67[_0xdd31('0x28')]=_[_0xdd31('0x29')](_0x228e9f[_0xdd31('0x28')]);_0x7b0c67[_0xdd31('0x2a')]=_[_0xdd31('0x2b')](_0x7b0c67[_0xdd31('0x2c')],_0x7b0c67[_0xdd31('0x28')]);_0xa8a295['attributes']=_['intersection'](_0x7b0c67['model'],qs[_0xdd31('0x2d')](_0x228e9f[_0xdd31('0x28')][_0xdd31('0x2d')]));_0xa8a295[_0xdd31('0x2e')]=_0xa8a295[_0xdd31('0x2e')]['length']?_0xa8a295[_0xdd31('0x2e')]:_0x7b0c67['model'];if(!_0x228e9f[_0xdd31('0x28')][_0xdd31('0x2f')]('nolimit')){_0xa8a295['limit']=qs[_0xdd31('0x19')](_0x228e9f[_0xdd31('0x28')][_0xdd31('0x19')]);_0xa8a295[_0xdd31('0x18')]=qs[_0xdd31('0x18')](_0x228e9f[_0xdd31('0x28')][_0xdd31('0x18')]);}_0xa8a295['order']=qs[_0xdd31('0x30')](_0x228e9f[_0xdd31('0x28')]['sort']);_0xa8a295['where']=qs[_0xdd31('0x2a')](_[_0xdd31('0x31')](_0x228e9f[_0xdd31('0x28')],_0x7b0c67['filters']),_0x32cc21);if(_0x228e9f[_0xdd31('0x28')][_0xdd31('0x32')]){_0xa8a295[_0xdd31('0x33')]=_[_0xdd31('0x34')](_0xa8a295[_0xdd31('0x33')],{'$or':_['map'](_0x32cc21,function(_0x2da21e){if(_0x2da21e[_0xdd31('0x35')]!=='VIRTUAL'){var _0x60d7d7={};_0x60d7d7[_0x2da21e[_0xdd31('0x21')]]={'$like':'%'+_0x228e9f[_0xdd31('0x28')][_0xdd31('0x32')]+'%'};return _0x60d7d7;}})});}_0xa8a295=_[_0xdd31('0x34')]({},_0xa8a295,_0x228e9f[_0xdd31('0x36')]);var _0x34fec0={'where':_0xa8a295[_0xdd31('0x33')]};return db['VtigerField'][_0xdd31('0x1a')](_0x34fec0)[_0xdd31('0x1f')](function(_0x87d336){_0x423906[_0xdd31('0x1a')]=_0x87d336;if(_0x228e9f[_0xdd31('0x28')][_0xdd31('0x37')]){_0xa8a295[_0xdd31('0x38')]=[{'all':!![]}];}return db[_0xdd31('0x39')][_0xdd31('0x3a')](_0xa8a295);})[_0xdd31('0x1f')](function(_0x35eb77){_0x423906[_0xdd31('0x3b')]=_0x35eb77;return _0x423906;})[_0xdd31('0x1f')](respondWithFilteredResult(_0x3e6a5b,_0xa8a295))[_0xdd31('0x3c')](handleError(_0x3e6a5b,null));};exports[_0xdd31('0x3d')]=function(_0x22ed7f,_0x62119a){var _0x188b10={'raw':!![],'where':{'id':_0x22ed7f[_0xdd31('0x3e')]['id']}},_0x36e0d7={};_0x36e0d7['model']=_[_0xdd31('0x29')](db[_0xdd31('0x39')][_0xdd31('0x24')]);_0x36e0d7[_0xdd31('0x28')]=_[_0xdd31('0x29')](_0x22ed7f[_0xdd31('0x28')]);_0x36e0d7[_0xdd31('0x2a')]=_[_0xdd31('0x2b')](_0x36e0d7[_0xdd31('0x2c')],_0x36e0d7[_0xdd31('0x28')]);_0x188b10[_0xdd31('0x2e')]=_[_0xdd31('0x2b')](_0x36e0d7[_0xdd31('0x2c')],qs['fields'](_0x22ed7f[_0xdd31('0x28')]['fields']));_0x188b10[_0xdd31('0x2e')]=_0x188b10[_0xdd31('0x2e')]['length']?_0x188b10['attributes']:_0x36e0d7['model'];if(_0x22ed7f['query'][_0xdd31('0x37')]){_0x188b10[_0xdd31('0x38')]=[{'all':!![]}];}_0x188b10=_[_0xdd31('0x34')]({},_0x188b10,_0x22ed7f[_0xdd31('0x36')]);return db[_0xdd31('0x39')][_0xdd31('0x3f')](_0x188b10)[_0xdd31('0x1f')](handleEntityNotFound(_0x62119a,null))[_0xdd31('0x1f')](respondWithResult(_0x62119a,null))[_0xdd31('0x3c')](handleError(_0x62119a,null));};exports[_0xdd31('0x40')]=function(_0x1b9ce4,_0x11011a){return db[_0xdd31('0x39')]['create'](_0x1b9ce4[_0xdd31('0x41')],{})[_0xdd31('0x1f')](respondWithResult(_0x11011a,0xc9))[_0xdd31('0x3c')](handleError(_0x11011a,null));};exports[_0xdd31('0x1e')]=function(_0x319038,_0x4a16e2){if(_0x319038[_0xdd31('0x41')]['id']){delete _0x319038[_0xdd31('0x41')]['id'];}return db[_0xdd31('0x39')]['find']({'where':{'id':_0x319038[_0xdd31('0x3e')]['id']}})[_0xdd31('0x1f')](handleEntityNotFound(_0x4a16e2,null))[_0xdd31('0x1f')](saveUpdates(_0x319038[_0xdd31('0x41')],null))[_0xdd31('0x1f')](respondWithResult(_0x4a16e2,null))['catch'](handleError(_0x4a16e2,null));};exports[_0xdd31('0x20')]=function(_0x104e4d,_0x562dd7){return db[_0xdd31('0x39')][_0xdd31('0x3f')]({'where':{'id':_0x104e4d[_0xdd31('0x3e')]['id']}})[_0xdd31('0x1f')](handleEntityNotFound(_0x562dd7,null))['then'](removeEntity(_0x562dd7,null))[_0xdd31('0x3c')](handleError(_0x562dd7,null));}; \ No newline at end of file +var _0x7939=['findAll','rows','catch','show','keys','options','find','create','body','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','destroy','error','name','index','map','VtigerField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','then','includeAll','include'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7939,0x11d));var _0x9793=function(_0x3ed16a,_0x48d43a){_0x3ed16a=_0x3ed16a-0x0;var _0x16346e=_0x7939[_0x3ed16a];return _0x16346e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9793('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9793('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9793('0x2'));var Mustache=require(_0x9793('0x3'));var util=require(_0x9793('0x4'));var path=require('path');var sox=require(_0x9793('0x5'));var csv=require(_0x9793('0x6'));var ejs=require(_0x9793('0x7'));var fs=require('fs');var fs_extra=require(_0x9793('0x8'));var _=require(_0x9793('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9793('0xa'));var deskjs=require(_0x9793('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9793('0xc'));var Papa=require(_0x9793('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9793('0xe'));var hardwareService=require(_0x9793('0xf'));var logger=require(_0x9793('0x10'))('api');var utils=require(_0x9793('0x11'));var config=require(_0x9793('0x12'));var licenseUtil=require(_0x9793('0x13'));var db=require(_0x9793('0x14'))['db'];function respondWithStatusCode(_0x136141,_0x5f05c3){_0x5f05c3=_0x5f05c3||0xcc;return function(_0x5f0e6a){if(_0x5f0e6a){return _0x136141['sendStatus'](_0x5f05c3);}return _0x136141[_0x9793('0x15')](_0x5f05c3)[_0x9793('0x16')]();};}function respondWithResult(_0x46116b,_0x51a563){_0x51a563=_0x51a563||0xc8;return function(_0x398678){if(_0x398678){return _0x46116b['status'](_0x51a563)[_0x9793('0x17')](_0x398678);}};}function respondWithFilteredResult(_0x4622ef,_0x147bf5){return function(_0x42fb51){if(_0x42fb51){var _0x2698f4=typeof _0x147bf5['offset']===_0x9793('0x18')&&typeof _0x147bf5['limit']==='undefined';var _0x1b92c8=_0x42fb51[_0x9793('0x19')];var _0x3b9a77=_0x2698f4?0x0:_0x147bf5[_0x9793('0x1a')];var _0x444a0a=_0x2698f4?_0x42fb51[_0x9793('0x19')]:_0x147bf5['offset']+_0x147bf5[_0x9793('0x1b')];var _0x173e79;if(_0x444a0a>=_0x1b92c8){_0x444a0a=_0x1b92c8;_0x173e79=0xc8;}else{_0x173e79=0xce;}_0x4622ef[_0x9793('0x15')](_0x173e79);return _0x4622ef[_0x9793('0x1c')](_0x9793('0x1d'),_0x3b9a77+'-'+_0x444a0a+'/'+_0x1b92c8)['json'](_0x42fb51);}return null;};}function patchUpdates(_0x158ede){return function(_0x439e32){try{jsonpatch['apply'](_0x439e32,_0x158ede,!![]);}catch(_0x3952b1){return BPromise[_0x9793('0x1e')](_0x3952b1);}return _0x439e32['save']();};}function saveUpdates(_0x4f7b37,_0x3a8726){return function(_0x7dc705){if(_0x7dc705){return _0x7dc705[_0x9793('0x1f')](_0x4f7b37)['then'](function(_0x22b17d){return _0x22b17d;});}return null;};}function removeEntity(_0x2ee7b3,_0x3c0bbb){return function(_0x55b3dd){if(_0x55b3dd){return _0x55b3dd[_0x9793('0x20')]()['then'](function(){_0x2ee7b3[_0x9793('0x15')](0xcc)[_0x9793('0x16')]();});}};}function handleEntityNotFound(_0x1390a7,_0x30e72d){return function(_0x5755c5){if(!_0x5755c5){_0x1390a7['sendStatus'](0x194);}return _0x5755c5;};}function handleError(_0x5922e7,_0x38ca2b){_0x38ca2b=_0x38ca2b||0x1f4;return function(_0x2357bf){logger[_0x9793('0x21')](_0x2357bf['stack']);if(_0x2357bf[_0x9793('0x22')]){delete _0x2357bf['name'];}_0x5922e7[_0x9793('0x15')](_0x38ca2b)['send'](_0x2357bf);};}exports[_0x9793('0x23')]=function(_0x431d43,_0x45319d){var _0x190b31={},_0x35317e={},_0x4b9a6a={'count':0x0,'rows':[]};var _0xfb16cb=_[_0x9793('0x24')](db[_0x9793('0x25')][_0x9793('0x26')],function(_0xe0edd8){return{'name':_0xe0edd8[_0x9793('0x27')],'type':_0xe0edd8['type'][_0x9793('0x28')]};});_0x35317e[_0x9793('0x29')]=_[_0x9793('0x24')](_0xfb16cb,_0x9793('0x22'));_0x35317e['query']=_['keys'](_0x431d43[_0x9793('0x2a')]);_0x35317e[_0x9793('0x2b')]=_[_0x9793('0x2c')](_0x35317e[_0x9793('0x29')],_0x35317e['query']);_0x190b31[_0x9793('0x2d')]=_[_0x9793('0x2c')](_0x35317e[_0x9793('0x29')],qs[_0x9793('0x2e')](_0x431d43[_0x9793('0x2a')][_0x9793('0x2e')]));_0x190b31[_0x9793('0x2d')]=_0x190b31[_0x9793('0x2d')][_0x9793('0x2f')]?_0x190b31['attributes']:_0x35317e[_0x9793('0x29')];if(!_0x431d43[_0x9793('0x2a')][_0x9793('0x30')](_0x9793('0x31'))){_0x190b31['limit']=qs[_0x9793('0x1b')](_0x431d43[_0x9793('0x2a')][_0x9793('0x1b')]);_0x190b31[_0x9793('0x1a')]=qs['offset'](_0x431d43[_0x9793('0x2a')]['offset']);}_0x190b31[_0x9793('0x32')]=qs['sort'](_0x431d43['query']['sort']);_0x190b31[_0x9793('0x33')]=qs[_0x9793('0x2b')](_[_0x9793('0x34')](_0x431d43[_0x9793('0x2a')],_0x35317e[_0x9793('0x2b')]),_0xfb16cb);if(_0x431d43[_0x9793('0x2a')][_0x9793('0x35')]){_0x190b31[_0x9793('0x33')]=_['merge'](_0x190b31[_0x9793('0x33')],{'$or':_[_0x9793('0x24')](_0xfb16cb,function(_0x449bdc){if(_0x449bdc[_0x9793('0x36')]!==_0x9793('0x37')){var _0x26096a={};_0x26096a[_0x449bdc[_0x9793('0x22')]]={'$like':'%'+_0x431d43[_0x9793('0x2a')][_0x9793('0x35')]+'%'};return _0x26096a;}})});}_0x190b31=_[_0x9793('0x38')]({},_0x190b31,_0x431d43['options']);var _0x398767={'where':_0x190b31[_0x9793('0x33')]};return db['VtigerField'][_0x9793('0x19')](_0x398767)[_0x9793('0x39')](function(_0x3d94a1){_0x4b9a6a[_0x9793('0x19')]=_0x3d94a1;if(_0x431d43[_0x9793('0x2a')][_0x9793('0x3a')]){_0x190b31[_0x9793('0x3b')]=[{'all':!![]}];}return db[_0x9793('0x25')][_0x9793('0x3c')](_0x190b31);})[_0x9793('0x39')](function(_0x5ee512){_0x4b9a6a[_0x9793('0x3d')]=_0x5ee512;return _0x4b9a6a;})[_0x9793('0x39')](respondWithFilteredResult(_0x45319d,_0x190b31))[_0x9793('0x3e')](handleError(_0x45319d,null));};exports[_0x9793('0x3f')]=function(_0x9b4a2a,_0x31406e){var _0x5b322c={'raw':!![],'where':{'id':_0x9b4a2a['params']['id']}},_0x3dab90={};_0x3dab90['model']=_['keys'](db[_0x9793('0x25')][_0x9793('0x26')]);_0x3dab90[_0x9793('0x2a')]=_[_0x9793('0x40')](_0x9b4a2a[_0x9793('0x2a')]);_0x3dab90[_0x9793('0x2b')]=_[_0x9793('0x2c')](_0x3dab90[_0x9793('0x29')],_0x3dab90[_0x9793('0x2a')]);_0x5b322c['attributes']=_['intersection'](_0x3dab90[_0x9793('0x29')],qs[_0x9793('0x2e')](_0x9b4a2a[_0x9793('0x2a')][_0x9793('0x2e')]));_0x5b322c['attributes']=_0x5b322c[_0x9793('0x2d')]['length']?_0x5b322c['attributes']:_0x3dab90[_0x9793('0x29')];if(_0x9b4a2a[_0x9793('0x2a')][_0x9793('0x3a')]){_0x5b322c[_0x9793('0x3b')]=[{'all':!![]}];}_0x5b322c=_[_0x9793('0x38')]({},_0x5b322c,_0x9b4a2a[_0x9793('0x41')]);return db[_0x9793('0x25')][_0x9793('0x42')](_0x5b322c)[_0x9793('0x39')](handleEntityNotFound(_0x31406e,null))['then'](respondWithResult(_0x31406e,null))[_0x9793('0x3e')](handleError(_0x31406e,null));};exports[_0x9793('0x43')]=function(_0x1241e9,_0x1b4f31){return db[_0x9793('0x25')][_0x9793('0x43')](_0x1241e9[_0x9793('0x44')],{})[_0x9793('0x39')](respondWithResult(_0x1b4f31,0xc9))[_0x9793('0x3e')](handleError(_0x1b4f31,null));};exports['update']=function(_0x2f6a28,_0x1f6e74){if(_0x2f6a28[_0x9793('0x44')]['id']){delete _0x2f6a28[_0x9793('0x44')]['id'];}return db[_0x9793('0x25')][_0x9793('0x42')]({'where':{'id':_0x2f6a28['params']['id']}})['then'](handleEntityNotFound(_0x1f6e74,null))[_0x9793('0x39')](saveUpdates(_0x2f6a28[_0x9793('0x44')],null))[_0x9793('0x39')](respondWithResult(_0x1f6e74,null))[_0x9793('0x3e')](handleError(_0x1f6e74,null));};exports['destroy']=function(_0x2bb78f,_0x3f0668){return db['VtigerField'][_0x9793('0x42')]({'where':{'id':_0x2bb78f['params']['id']}})[_0x9793('0x39')](handleEntityNotFound(_0x3f0668,null))[_0x9793('0x39')](removeEntity(_0x3f0668,null))['catch'](handleError(_0x3f0668,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3256f29..cde21a1 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 _0x3f68=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','api','moment'];(function(_0x505d6c,_0x5681cc){var _0x115f2e=function(_0x2dda68){while(--_0x2dda68){_0x505d6c['push'](_0x505d6c['shift']());}};_0x115f2e(++_0x5681cc);}(_0x3f68,0x7c));var _0x83f6=function(_0x196c1f,_0x181785){_0x196c1f=_0x196c1f-0x0;var _0x14ff24=_0x3f68[_0x196c1f];return _0x14ff24;};'use strict';var _=require(_0x83f6('0x0'));var util=require(_0x83f6('0x1'));var logger=require('../../config/logger')(_0x83f6('0x2'));var moment=require(_0x83f6('0x3'));var BPromise=require(_0x83f6('0x4'));var rp=require(_0x83f6('0x5'));var fs=require('fs');var path=require(_0x83f6('0x6'));var rimraf=require(_0x83f6('0x7'));var config=require(_0x83f6('0x8'));var attributes=require(_0x83f6('0x9'));module[_0x83f6('0xa')]=function(_0x3e1dbd,_0x4777d4){return _0x3e1dbd[_0x83f6('0xb')](_0x83f6('0xc'),attributes,{'tableName':_0x83f6('0xd'),'paranoid':![],'indexes':[{'name':_0x83f6('0xe'),'fields':[_0x83f6('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x40b1=['vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields'];(function(_0x57cf35,_0x17a77c){var _0x3a7360=function(_0xb62ef1){while(--_0xb62ef1){_0x57cf35['push'](_0x57cf35['shift']());}};_0x3a7360(++_0x17a77c);}(_0x40b1,0x69));var _0x140b=function(_0x523361,_0x1577f4){_0x523361=_0x523361-0x0;var _0x1c5c0c=_0x40b1[_0x523361];return _0x1c5c0c;};'use strict';var _=require(_0x140b('0x0'));var util=require(_0x140b('0x1'));var logger=require(_0x140b('0x2'))(_0x140b('0x3'));var moment=require(_0x140b('0x4'));var BPromise=require(_0x140b('0x5'));var rp=require(_0x140b('0x6'));var fs=require('fs');var path=require(_0x140b('0x7'));var rimraf=require(_0x140b('0x8'));var config=require(_0x140b('0x9'));var attributes=require(_0x140b('0xa'));module[_0x140b('0xb')]=function(_0x386abc,_0xfbd84b){return _0x386abc[_0x140b('0xc')]('VtigerField',attributes,{'tableName':_0x140b('0xd'),'paranoid':![],'indexes':[{'name':_0x140b('0xe'),'fields':[_0x140b('0xf'),_0x140b('0x10')],'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 0ceee07..96ef32a 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 _0xf6ec=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x55e677,_0x4a1157){var _0x5d0798=function(_0x65a609){while(--_0x65a609){_0x55e677['push'](_0x55e677['shift']());}};_0x5d0798(++_0x4a1157);}(_0xf6ec,0x198));var _0xcf6e=function(_0x24aefa,_0x473eef){_0x24aefa=_0x24aefa-0x0;var _0x51ccaa=_0xf6ec[_0x24aefa];return _0x51ccaa;};'use strict';var _=require('lodash');var util=require(_0xcf6e('0x0'));var moment=require(_0xcf6e('0x1'));var BPromise=require(_0xcf6e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf6e('0x3'));var db=require(_0xcf6e('0x4'))['db'];var utils=require(_0xcf6e('0x5'));var logger=require(_0xcf6e('0x6'))(_0xcf6e('0x7'));var config=require(_0xcf6e('0x8'));var jayson=require(_0xcf6e('0x9'));var client=jayson[_0xcf6e('0xa')][_0xcf6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15d212,_0x48b426,_0x3c8df1){return new BPromise(function(_0x36a925,_0x191531){return client['request'](_0x15d212,_0x3c8df1)[_0xcf6e('0xc')](function(_0x24b15a){logger['info'](_0xcf6e('0xd'),_0x48b426,_0xcf6e('0xe'));logger[_0xcf6e('0xf')](_0xcf6e('0x10'),_0x48b426,'request\x20sent',JSON[_0xcf6e('0x11')](_0x24b15a));if(_0x24b15a[_0xcf6e('0x12')]){if(_0x24b15a[_0xcf6e('0x12')][_0xcf6e('0x13')]===0x1f4){logger['error'](_0xcf6e('0xd'),_0x48b426,_0x24b15a[_0xcf6e('0x12')][_0xcf6e('0x14')]);return _0x191531(_0x24b15a[_0xcf6e('0x12')]['message']);}logger[_0xcf6e('0x12')](_0xcf6e('0xd'),_0x48b426,_0x24b15a[_0xcf6e('0x12')][_0xcf6e('0x14')]);return _0x36a925(_0x24b15a['error'][_0xcf6e('0x14')]);}else{logger[_0xcf6e('0x15')](_0xcf6e('0xd'),_0x48b426,_0xcf6e('0xe'));_0x36a925(_0x24b15a[_0xcf6e('0x16')]['message']);}})[_0xcf6e('0x17')](function(_0x475837){logger[_0xcf6e('0x12')](_0xcf6e('0xd'),_0x48b426,_0x475837);_0x191531(_0x475837);});});} \ No newline at end of file +var _0x8b6c=['lodash','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x55c257,_0x28c048){var _0x255379=function(_0x3df3c5){while(--_0x3df3c5){_0x55c257['push'](_0x55c257['shift']());}};_0x255379(++_0x28c048);}(_0x8b6c,0x11d));var _0xc8b6=function(_0x396a3c,_0xfa6bc3){_0x396a3c=_0x396a3c-0x0;var _0x1f532a=_0x8b6c[_0x396a3c];return _0x1f532a;};'use strict';var _=require(_0xc8b6('0x0'));var util=require('util');var moment=require(_0xc8b6('0x1'));var BPromise=require(_0xc8b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8b6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc8b6('0x4'));var config=require('../../config/environment');var jayson=require(_0xc8b6('0x5'));var client=jayson[_0xc8b6('0x6')][_0xc8b6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e28c3,_0x1f52f9,_0x76b9da){return new BPromise(function(_0x5ede96,_0x35de4b){return client['request'](_0x1e28c3,_0x76b9da)['then'](function(_0x29d991){logger[_0xc8b6('0x8')](_0xc8b6('0x9'),_0x1f52f9,_0xc8b6('0xa'));logger[_0xc8b6('0xb')](_0xc8b6('0xc'),_0x1f52f9,_0xc8b6('0xa'),JSON[_0xc8b6('0xd')](_0x29d991));if(_0x29d991['error']){if(_0x29d991[_0xc8b6('0xe')][_0xc8b6('0xf')]===0x1f4){logger[_0xc8b6('0xe')](_0xc8b6('0x9'),_0x1f52f9,_0x29d991['error'][_0xc8b6('0x10')]);return _0x35de4b(_0x29d991[_0xc8b6('0xe')]['message']);}logger['error'](_0xc8b6('0x9'),_0x1f52f9,_0x29d991[_0xc8b6('0xe')][_0xc8b6('0x10')]);return _0x5ede96(_0x29d991['error'][_0xc8b6('0x10')]);}else{logger[_0xc8b6('0x8')](_0xc8b6('0x9'),_0x1f52f9,_0xc8b6('0xa'));_0x5ede96(_0x29d991[_0xc8b6('0x11')][_0xc8b6('0x10')]);}})[_0xc8b6('0x12')](function(_0x4141f8){logger['error']('VtigerField,\x20%s,\x20%s',_0x1f52f9,_0x4141f8);_0x35de4b(_0x4141f8);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index c38348c..4b395f1 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 _0x2013=['express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','multer','path'];(function(_0x44e201,_0x2477f9){var _0xb720a9=function(_0x52c73f){while(--_0x52c73f){_0x44e201['push'](_0x44e201['shift']());}};_0xb720a9(++_0x2477f9);}(_0x2013,0xae));var _0x3201=function(_0x4b8018,_0x2bff47){_0x4b8018=_0x4b8018-0x0;var _0x18bde6=_0x2013[_0x4b8018];return _0x18bde6;};'use strict';var multer=require(_0x3201('0x0'));var util=require('util');var path=require(_0x3201('0x1'));var timeout=require('connect-timeout');var express=require(_0x3201('0x2'));var router=express['Router']();var fs_extra=require(_0x3201('0x3'));var auth=require(_0x3201('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3201('0x5'));var controller=require(_0x3201('0x6'));router['get']('/',auth[_0x3201('0x7')](),controller[_0x3201('0x8')]);router[_0x3201('0x9')](_0x3201('0xa'),auth[_0x3201('0x7')](),controller[_0x3201('0xb')]);router[_0x3201('0x9')](_0x3201('0xc'),auth[_0x3201('0x7')](),controller[_0x3201('0xd')]);router[_0x3201('0x9')](_0x3201('0xe'),auth['isAuthenticated'](),controller[_0x3201('0xf')]);router[_0x3201('0x10')]('/',auth[_0x3201('0x7')](),controller[_0x3201('0x11')]);router['post'](_0x3201('0xc'),auth[_0x3201('0x7')](),controller[_0x3201('0x12')]);router['put'](_0x3201('0xa'),auth[_0x3201('0x7')](),controller[_0x3201('0x13')]);router['delete'](_0x3201('0xa'),auth[_0x3201('0x7')](),controller[_0x3201('0x14')]);module[_0x3201('0x15')]=router; \ No newline at end of file +var _0x0a14=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x36524f,_0x12e2d0){var _0x5af16f=function(_0x186bb4){while(--_0x186bb4){_0x36524f['push'](_0x36524f['shift']());}};_0x5af16f(++_0x12e2d0);}(_0x0a14,0x120));var _0x40a1=function(_0x3e9e41,_0x39aa8c){_0x3e9e41=_0x3e9e41-0x0;var _0x328172=_0x0a14[_0x3e9e41];return _0x328172;};'use strict';var multer=require(_0x40a1('0x0'));var util=require(_0x40a1('0x1'));var path=require(_0x40a1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x40a1('0x3')]();var fs_extra=require(_0x40a1('0x4'));var auth=require(_0x40a1('0x5'));var interaction=require(_0x40a1('0x6'));var config=require(_0x40a1('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x40a1('0x8')]('/',auth[_0x40a1('0x9')](),controller['index']);router[_0x40a1('0x8')](_0x40a1('0xa'),auth[_0x40a1('0x9')](),controller['show']);router[_0x40a1('0x8')](_0x40a1('0xb'),auth[_0x40a1('0x9')](),controller[_0x40a1('0xc')]);router[_0x40a1('0x8')](_0x40a1('0xd'),auth[_0x40a1('0x9')](),controller[_0x40a1('0xe')]);router[_0x40a1('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x40a1('0xf')]('/:id/configurations',auth[_0x40a1('0x9')](),controller[_0x40a1('0x10')]);router[_0x40a1('0x11')](_0x40a1('0xa'),auth['isAuthenticated'](),controller[_0x40a1('0x12')]);router[_0x40a1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x40a1('0x14')]);module[_0x40a1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4cfe0d2..21340e6 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 _0x4325=['token','password','newTab','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x3e8710,_0x30b866){var _0x13ec9c=function(_0x5420d0){while(--_0x5420d0){_0x3e8710['push'](_0x3e8710['shift']());}};_0x13ec9c(++_0x30b866);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5432('0x2')]},'username':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x4')},'authType':{'type':Sequelize[_0x5432('0x5')]('password',_0x5432('0x6')),'defaultValue':_0x5432('0x7')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5432('0x5')]('integrationTab',_0x5432('0x8')),'defaultValue':_0x5432('0x9')}}; \ No newline at end of file +var _0x39e6=['ENUM','password','token','integrationTab','newTab','sequelize','STRING','username','remoteUri'];(function(_0x526876,_0x2473ec){var _0x379ab5=function(_0x55d1fb){while(--_0x55d1fb){_0x526876['push'](_0x526876['shift']());}};_0x379ab5(++_0x2473ec);}(_0x39e6,0x9e));var _0x639e=function(_0x59cca9,_0x33092a){_0x59cca9=_0x59cca9-0x0;var _0x40a9bd=_0x39e6[_0x59cca9];return _0x40a9bd;};'use strict';var Sequelize=require(_0x639e('0x0'));module['exports']={'name':{'type':Sequelize[_0x639e('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x639e('0x2')},'password':{'type':Sequelize[_0x639e('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x639e('0x1')],'unique':_0x639e('0x3')},'authType':{'type':Sequelize[_0x639e('0x4')](_0x639e('0x5'),_0x639e('0x6')),'defaultValue':_0x639e('0x5')},'serverUrl':{'type':Sequelize[_0x639e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x639e('0x4')](_0x639e('0x7'),_0x639e('0x8')),'defaultValue':_0x639e('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index cbe235f..3456dbe 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 _0x69d3=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','findAll','rows','show','keys','find','catch','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','remoteUri','slice','lastIndexOf','format','ticket_fields','authType','password','Basic\x20%s','%s:%s','base64','headers','%s/token:%s','toString','Unknown\x20authentication\x20type','subject','description','assignee','remove','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x3f9b9e,_0x209ec4){var _0x4d4270=function(_0x396fbd){while(--_0x396fbd){_0x3f9b9e['push'](_0x3f9b9e['shift']());}};_0x4d4270(++_0x209ec4);}(_0x69d3,0xda));var _0x369d=function(_0x506211,_0x5d9f77){_0x506211=_0x506211-0x0;var _0x3da272=_0x69d3[_0x506211];return _0x3da272;};'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'];var integrations=require(_0x369d('0x17'));function respondWithStatusCode(_0x52c126,_0x15b417){_0x15b417=_0x15b417||0xcc;return function(_0x9d016){if(_0x9d016){return _0x52c126[_0x369d('0x18')](_0x15b417);}return _0x52c126[_0x369d('0x19')](_0x15b417)[_0x369d('0x1a')]();};}function respondWithResult(_0x539536,_0x5cd4c3){_0x5cd4c3=_0x5cd4c3||0xc8;return function(_0x5485a1){if(_0x5485a1){return _0x539536[_0x369d('0x19')](_0x5cd4c3)[_0x369d('0x1b')](_0x5485a1);}};}function respondWithFilteredResult(_0x389c43,_0x5b4f55){return function(_0x2c1a4a){if(_0x2c1a4a){var _0x29c1fe=typeof _0x5b4f55[_0x369d('0x1c')]==='undefined'&&typeof _0x5b4f55[_0x369d('0x1d')]===_0x369d('0x1e');var _0x4ea6c2=_0x2c1a4a['count'];var _0x597b67=_0x29c1fe?0x0:_0x5b4f55[_0x369d('0x1c')];var _0x4494b3=_0x29c1fe?_0x2c1a4a[_0x369d('0x1f')]:_0x5b4f55['offset']+_0x5b4f55[_0x369d('0x1d')];var _0x24dfff;if(_0x4494b3>=_0x4ea6c2){_0x4494b3=_0x4ea6c2;_0x24dfff=0xc8;}else{_0x24dfff=0xce;}_0x389c43[_0x369d('0x19')](_0x24dfff);return _0x389c43[_0x369d('0x20')](_0x369d('0x21'),_0x597b67+'-'+_0x4494b3+'/'+_0x4ea6c2)['json'](_0x2c1a4a);}return null;};}function patchUpdates(_0x5c9fdd){return function(_0x448e6e){try{jsonpatch[_0x369d('0x22')](_0x448e6e,_0x5c9fdd,!![]);}catch(_0x11ac1d){return BPromise[_0x369d('0x23')](_0x11ac1d);}return _0x448e6e[_0x369d('0x24')]();};}function saveUpdates(_0x15fbef,_0x1b262a){return function(_0x54a42e){if(_0x54a42e){return _0x54a42e['update'](_0x15fbef)[_0x369d('0x25')](function(_0xed16e){return _0xed16e;});}return null;};}function removeEntity(_0xf7bc3a,_0xcae58){return function(_0x30e7c5){if(_0x30e7c5){return _0x30e7c5[_0x369d('0x26')]()[_0x369d('0x25')](function(){_0xf7bc3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16145e,_0x46de2b){return function(_0x15cd81){if(!_0x15cd81){_0x16145e[_0x369d('0x18')](0x194);}return _0x15cd81;};}function handleError(_0x8aa521,_0x41e0cf){_0x41e0cf=_0x41e0cf||0x1f4;return function(_0x8090b0){logger['error'](_0x8090b0[_0x369d('0x27')]);if(_0x8090b0[_0x369d('0x28')]){delete _0x8090b0[_0x369d('0x28')];}_0x8aa521[_0x369d('0x19')](_0x41e0cf)[_0x369d('0x29')](_0x8090b0);};}exports[_0x369d('0x2a')]=function(_0x3d1ce0,_0x4d42ea){var _0x157291={},_0x56efb1={},_0x57b94c={'count':0x0,'rows':[]};var _0x38feda=_[_0x369d('0x2b')](db['ZendeskAccount'][_0x369d('0x2c')],function(_0x5a14ce){return{'name':_0x5a14ce[_0x369d('0x2d')],'type':_0x5a14ce[_0x369d('0x2e')][_0x369d('0x2f')]};});_0x56efb1[_0x369d('0x30')]=_[_0x369d('0x2b')](_0x38feda,_0x369d('0x28'));_0x56efb1[_0x369d('0x31')]=_['keys'](_0x3d1ce0[_0x369d('0x31')]);_0x56efb1[_0x369d('0x32')]=_[_0x369d('0x33')](_0x56efb1[_0x369d('0x30')],_0x56efb1[_0x369d('0x31')]);_0x157291[_0x369d('0x34')]=_[_0x369d('0x33')](_0x56efb1[_0x369d('0x30')],qs['fields'](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x35')]));_0x157291[_0x369d('0x34')]=_0x157291[_0x369d('0x34')][_0x369d('0x36')]?_0x157291['attributes']:_0x56efb1[_0x369d('0x30')];if(!_0x3d1ce0[_0x369d('0x31')][_0x369d('0x37')](_0x369d('0x38'))){_0x157291[_0x369d('0x1d')]=qs[_0x369d('0x1d')](_0x3d1ce0['query'][_0x369d('0x1d')]);_0x157291[_0x369d('0x1c')]=qs[_0x369d('0x1c')](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x1c')]);}_0x157291[_0x369d('0x39')]=qs[_0x369d('0x3a')](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x3a')]);_0x157291[_0x369d('0x3b')]=qs[_0x369d('0x32')](_[_0x369d('0x3c')](_0x3d1ce0[_0x369d('0x31')],_0x56efb1[_0x369d('0x32')]),_0x38feda);if(_0x3d1ce0[_0x369d('0x31')][_0x369d('0x3d')]){_0x157291[_0x369d('0x3b')]=_[_0x369d('0x3e')](_0x157291[_0x369d('0x3b')],{'$or':_[_0x369d('0x2b')](_0x38feda,function(_0x10c5b6){if(_0x10c5b6[_0x369d('0x2e')]!==_0x369d('0x3f')){var _0xd58366={};_0xd58366[_0x10c5b6['name']]={'$like':'%'+_0x3d1ce0['query'][_0x369d('0x3d')]+'%'};return _0xd58366;}})});}_0x157291=_[_0x369d('0x3e')]({},_0x157291,_0x3d1ce0[_0x369d('0x40')]);var _0x401bc7={'where':_0x157291[_0x369d('0x3b')]};return db[_0x369d('0x41')][_0x369d('0x1f')](_0x401bc7)[_0x369d('0x25')](function(_0x46c940){_0x57b94c['count']=_0x46c940;if(_0x3d1ce0[_0x369d('0x31')][_0x369d('0x42')]){_0x157291[_0x369d('0x43')]=[{'all':!![]}];}return db[_0x369d('0x41')][_0x369d('0x44')](_0x157291);})[_0x369d('0x25')](function(_0x28803c){_0x57b94c[_0x369d('0x45')]=_0x28803c;return _0x57b94c;})['then'](respondWithFilteredResult(_0x4d42ea,_0x157291))['catch'](handleError(_0x4d42ea,null));};exports[_0x369d('0x46')]=function(_0x3222ce,_0x30909a){var _0x4dad71={'raw':![],'where':{'id':_0x3222ce['params']['id']}},_0x4d07ac={};_0x4d07ac[_0x369d('0x30')]=_[_0x369d('0x47')](db['ZendeskAccount'][_0x369d('0x2c')]);_0x4d07ac[_0x369d('0x31')]=_[_0x369d('0x47')](_0x3222ce[_0x369d('0x31')]);_0x4d07ac['filters']=_[_0x369d('0x33')](_0x4d07ac['model'],_0x4d07ac[_0x369d('0x31')]);_0x4dad71['attributes']=_[_0x369d('0x33')](_0x4d07ac[_0x369d('0x30')],qs[_0x369d('0x35')](_0x3222ce['query']['fields']));_0x4dad71[_0x369d('0x34')]=_0x4dad71[_0x369d('0x34')][_0x369d('0x36')]?_0x4dad71['attributes']:_0x4d07ac[_0x369d('0x30')];if(_0x3222ce[_0x369d('0x31')][_0x369d('0x42')]){_0x4dad71[_0x369d('0x43')]=[{'all':!![]}];}_0x4dad71=_[_0x369d('0x3e')]({},_0x4dad71,_0x3222ce[_0x369d('0x40')]);return db[_0x369d('0x41')][_0x369d('0x48')](_0x4dad71)[_0x369d('0x25')](handleEntityNotFound(_0x30909a,null))['then'](respondWithResult(_0x30909a,null))[_0x369d('0x49')](handleError(_0x30909a,null));};exports[_0x369d('0x4a')]=function(_0xcc1465,_0x257c3d){return db[_0x369d('0x41')][_0x369d('0x4a')](_0xcc1465['body'],{})[_0x369d('0x25')](respondWithResult(_0x257c3d,0xc9))[_0x369d('0x49')](handleError(_0x257c3d,null));};exports[_0x369d('0x4b')]=function(_0x44a357,_0x1b04d9){if(_0x44a357[_0x369d('0x4c')]['id']){delete _0x44a357[_0x369d('0x4c')]['id'];}return db[_0x369d('0x41')][_0x369d('0x48')]({'where':{'id':_0x44a357[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x1b04d9,null))[_0x369d('0x25')](saveUpdates(_0x44a357['body'],null))[_0x369d('0x25')](respondWithResult(_0x1b04d9,null))[_0x369d('0x49')](handleError(_0x1b04d9,null));};exports[_0x369d('0x26')]=function(_0x85edd6,_0x648a0d){return db['ZendeskAccount'][_0x369d('0x48')]({'where':{'id':_0x85edd6['params']['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x648a0d,null))[_0x369d('0x25')](removeEntity(_0x648a0d,null))[_0x369d('0x49')](handleError(_0x648a0d,null));};exports[_0x369d('0x4e')]=function(_0x46c62c,_0x1bd31c,_0x22e2d4){var _0x418cab={};var _0x1cdeca={};var _0x9f1544;var _0x4d582a;return db['ZendeskAccount'][_0x369d('0x4f')]({'where':{'id':_0x46c62c[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x1bd31c,null))[_0x369d('0x25')](function(_0x347df4){if(_0x347df4){_0x9f1544=_0x347df4;_0x1cdeca['model']=_['keys'](db[_0x369d('0x50')][_0x369d('0x2c')]);_0x1cdeca['query']=_[_0x369d('0x47')](_0x46c62c['query']);_0x1cdeca[_0x369d('0x32')]=_[_0x369d('0x33')](_0x1cdeca[_0x369d('0x30')],_0x1cdeca['query']);_0x418cab[_0x369d('0x34')]=_[_0x369d('0x33')](_0x1cdeca[_0x369d('0x30')],qs[_0x369d('0x35')](_0x46c62c['query']['fields']));_0x418cab[_0x369d('0x34')]=_0x418cab[_0x369d('0x34')][_0x369d('0x36')]?_0x418cab['attributes']:_0x1cdeca[_0x369d('0x30')];_0x418cab[_0x369d('0x39')]=qs[_0x369d('0x3a')](_0x46c62c['query']['sort']);_0x418cab[_0x369d('0x3b')]=qs[_0x369d('0x32')](_[_0x369d('0x3c')](_0x46c62c[_0x369d('0x31')],_0x1cdeca['filters']));if(_0x46c62c[_0x369d('0x31')][_0x369d('0x3d')]){_0x418cab[_0x369d('0x3b')]=_[_0x369d('0x3e')](_0x418cab[_0x369d('0x3b')],{'$or':_['map'](_0x418cab[_0x369d('0x34')],function(_0x304a9e){var _0x28b752={};_0x28b752[_0x304a9e]={'$like':'%'+_0x46c62c['query'][_0x369d('0x3d')]+'%'};return _0x28b752;})});}_0x418cab=_['merge']({},_0x418cab,_0x46c62c[_0x369d('0x40')]);return _0x9f1544['getConfigurations'](_0x418cab);}})['then'](function(_0x5f440e){if(_0x5f440e){_0x4d582a=_0x5f440e['length'];if(!_0x46c62c[_0x369d('0x31')]['hasOwnProperty'](_0x369d('0x38'))){_0x418cab['limit']=qs[_0x369d('0x1d')](_0x46c62c[_0x369d('0x31')][_0x369d('0x1d')]);_0x418cab['offset']=qs[_0x369d('0x1c')](_0x46c62c[_0x369d('0x31')][_0x369d('0x1c')]);}return _0x9f1544[_0x369d('0x4e')](_0x418cab);}})[_0x369d('0x25')](function(_0xe63e0f){if(_0xe63e0f){return _0xe63e0f?{'count':_0x4d582a,'rows':_0xe63e0f}:null;}})['then'](respondWithResult(_0x1bd31c,null))[_0x369d('0x49')](handleError(_0x1bd31c,null));};exports['addConfiguration']=function(_0x5706be,_0x56c98e,_0x36e990){if(_0x5706be[_0x369d('0x4c')]['id']){delete _0x5706be[_0x369d('0x4c')]['id'];}return db[_0x369d('0x41')][_0x369d('0x4f')]({'where':{'id':_0x5706be[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x56c98e,null))[_0x369d('0x25')](function(_0x1c9683){if(_0x1c9683){_0x5706be[_0x369d('0x4c')][_0x369d('0x51')]=_0x1c9683['id'];_0x5706be[_0x369d('0x4c')][_0x369d('0x52')]=integrations[_0x369d('0x53')](_0x5706be[_0x369d('0x4c')][_0x369d('0x54')],_0x5706be['body'][_0x369d('0x2e')]);_0x5706be['body'][_0x369d('0x55')]=integrations[_0x369d('0x56')](_0x5706be[_0x369d('0x4c')][_0x369d('0x54')],_0x5706be[_0x369d('0x4c')]['type']);return db[_0x369d('0x50')]['create'](_0x5706be['body'],{'include':[{'model':db[_0x369d('0x57')],'as':_0x369d('0x52')},{'model':db[_0x369d('0x57')],'as':_0x369d('0x55')}]});}return null;})[_0x369d('0x25')](respondWithResult(_0x56c98e,null))[_0x369d('0x49')](handleError(_0x56c98e,null));};exports[_0x369d('0x58')]=function(_0x11ac7d,_0x55a811,_0x461782){var _0x24e70d='';return db['ZendeskAccount'][_0x369d('0x4f')]({'where':{'id':_0x11ac7d[_0x369d('0x4d')]['id']},'attributes':['id',_0x369d('0x59'),'password',_0x369d('0x5a'),'authType',_0x369d('0x5b')]})[_0x369d('0x25')](handleEntityNotFound(_0x55a811,null))[_0x369d('0x25')](function(_0x369199){if(_0x369199){_0x24e70d=_0x369199[_0x369d('0x5b')];var _0x1a9a01=_0x24e70d[_0x369d('0x5c')](-0x1);if(_0x1a9a01==='/'){_0x24e70d=_0x24e70d['substring'](0x0,_0x24e70d[_0x369d('0x5d')](_0x1a9a01));}var _0x7e8d08={'method':'GET','uri':util[_0x369d('0x5e')]('%s/%s',_0x24e70d,_0x369d('0x5f')),'json':!![]};switch(_0x369199[_0x369d('0x60')]){case _0x369d('0x61'):_0x7e8d08['headers']={'Authorization':util[_0x369d('0x5e')](_0x369d('0x62'),new Buffer(util['format'](_0x369d('0x63'),_0x369199[_0x369d('0x59')],_0x369199[_0x369d('0x61')]))['toString'](_0x369d('0x64')))};break;case _0x369d('0x5a'):_0x7e8d08[_0x369d('0x65')]={'Authorization':util[_0x369d('0x5e')](_0x369d('0x62'),new Buffer(util['format'](_0x369d('0x66'),_0x369199[_0x369d('0x59')],_0x369199[_0x369d('0x5a')]))[_0x369d('0x67')](_0x369d('0x64')))};break;default:throw new db['Sequelize']['ValidationError'](_0x369d('0x68'));}return rp(_0x7e8d08);}})[_0x369d('0x25')](function(_0x2307fc){if(_0x2307fc){var _0x11b348=[_0x369d('0x69'),_0x369d('0x6a'),'group',_0x369d('0x6b')];_[_0x369d('0x6c')](_0x2307fc['ticket_fields'],function(_0x6c8235){return _0x11b348['includes'](_0x6c8235[_0x369d('0x2e')]);});return{'count':_0x2307fc['ticket_fields'][_0x369d('0x36')],'rows':_[_0x369d('0x2b')](_0x2307fc['ticket_fields'],function(_0x4148a9){return{'id':_0x4148a9['id'],'name':_0x4148a9['position']>0x7?_0x4148a9[_0x369d('0x6d')]:_0x4148a9['type'],'custom':_0x4148a9['position']>0x7?!![]:![],'options':_0x4148a9[_0x369d('0x6e')]?_0x4148a9[_0x369d('0x6e')]:_0x4148a9[_0x369d('0x6f')]?_0x4148a9[_0x369d('0x6f')]:[]};})};}})[_0x369d('0x25')](respondWithResult(_0x55a811,null))['catch'](function(_0x28ec32){var _0xaff7cc=_0x11ac7d[_0x369d('0x31')][_0x369d('0x70')]?0x1f4:_0x28ec32[_0x369d('0x71')]||0x1f4;logger[_0x369d('0x72')](_0x369d('0x73'),_0x369d('0x58'),_0xaff7cc,JSON[_0x369d('0x74')](_0x28ec32));delete _0x28ec32['name'];if(_0xaff7cc===0x191){_0xaff7cc=0x190;}_0x55a811[_0x369d('0x19')](_0xaff7cc)[_0x369d('0x29')](_0x11ac7d[_0x369d('0x31')][_0x369d('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x28ec32[_0x369d('0x71')]}:_0x28ec32);});}; \ No newline at end of file +var _0x4e81=['limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ZendeskAccount','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','ZendeskConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','password','headers','Basic\x20%s','toString','base64','format','%s/token:%s','Sequelize','ValidationError','subject','description','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','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'];(function(_0x116c98,_0x47a56a){var _0x301423=function(_0x3ca4f0){while(--_0x3ca4f0){_0x116c98['push'](_0x116c98['shift']());}};_0x301423(++_0x47a56a);}(_0x4e81,0x1bc));var _0x14e8=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0x4e81[_0x2f37e0];return _0x43ccce;};'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['ZendeskAccount'][_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'),'password',_0x14e8('0x56'),_0x14e8('0x57'),_0x14e8('0x58')]})[_0x14e8('0x27')](handleEntityNotFound(_0x53d0c8,null))[_0x14e8('0x27')](function(_0x6dee32){if(_0x6dee32){_0x5cbce8=_0x6dee32[_0x14e8('0x58')];var _0x2ba695=_0x5cbce8[_0x14e8('0x59')](-0x1);if(_0x2ba695==='/'){_0x5cbce8=_0x5cbce8[_0x14e8('0x5a')](0x0,_0x5cbce8[_0x14e8('0x5b')](_0x2ba695));}var _0x2e0e7d={'method':_0x14e8('0x5c'),'uri':util['format']('%s/%s',_0x5cbce8,'ticket_fields'),'json':!![]};switch(_0x6dee32[_0x14e8('0x57')]){case _0x14e8('0x5d'):_0x2e0e7d[_0x14e8('0x5e')]={'Authorization':util['format'](_0x14e8('0x5f'),new Buffer(util['format']('%s:%s',_0x6dee32['username'],_0x6dee32[_0x14e8('0x5d')]))[_0x14e8('0x60')](_0x14e8('0x61')))};break;case'token':_0x2e0e7d[_0x14e8('0x5e')]={'Authorization':util['format'](_0x14e8('0x5f'),new Buffer(util[_0x14e8('0x62')](_0x14e8('0x63'),_0x6dee32[_0x14e8('0x55')],_0x6dee32[_0x14e8('0x56')]))[_0x14e8('0x60')](_0x14e8('0x61')))};break;default:throw new db[(_0x14e8('0x64'))][(_0x14e8('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x2e0e7d);}})[_0x14e8('0x27')](function(_0x4eb2ef){if(_0x4eb2ef){var _0x355395=[_0x14e8('0x66'),_0x14e8('0x67'),_0x14e8('0x68'),_0x14e8('0x69')];_[_0x14e8('0x6a')](_0x4eb2ef[_0x14e8('0x6b')],function(_0x308617){return _0x355395[_0x14e8('0x6c')](_0x308617['type']);});return{'count':_0x4eb2ef[_0x14e8('0x6b')][_0x14e8('0x39')],'rows':_[_0x14e8('0x2d')](_0x4eb2ef[_0x14e8('0x6b')],function(_0x492757){return{'id':_0x492757['id'],'name':_0x492757[_0x14e8('0x6d')]>0x7?_0x492757[_0x14e8('0x6e')]:_0x492757[_0x14e8('0x30')],'custom':_0x492757[_0x14e8('0x6d')]>0x7?!![]:![],'options':_0x492757['system_field_options']?_0x492757[_0x14e8('0x6f')]:_0x492757['custom_field_options']?_0x492757[_0x14e8('0x70')]:[]};})};}})['then'](respondWithResult(_0x53d0c8,null))['catch'](function(_0x3e820f){var _0xb68079=_0x20a598[_0x14e8('0x34')][_0x14e8('0x71')]?0x1f4:_0x3e820f[_0x14e8('0x72')]||0x1f4;logger[_0x14e8('0x28')](_0x14e8('0x73'),_0x14e8('0x74'),_0xb68079,JSON[_0x14e8('0x75')](_0x3e820f));delete _0x3e820f[_0x14e8('0x2a')];if(_0xb68079===0x191){_0xb68079=0x190;}_0x53d0c8[_0x14e8('0x1c')](_0xb68079)['send'](_0x20a598[_0x14e8('0x34')][_0x14e8('0x71')]?{'message':_0x14e8('0x76'),'statusCode':_0x3e820f['statusCode']}:_0x3e820f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f39c3af..ad35fdc 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 _0x38d8=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x38d8,0xa2));var _0x838d=function(_0x3b29d5,_0x12faa2){_0x3b29d5=_0x3b29d5-0x0;var _0x20b96d=_0x38d8[_0x3b29d5];return _0x20b96d;};'use strict';var _=require(_0x838d('0x0'));var util=require(_0x838d('0x1'));var logger=require(_0x838d('0x2'))(_0x838d('0x3'));var moment=require('moment');var BPromise=require(_0x838d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x838d('0x5'));var rimraf=require('rimraf');var config=require(_0x838d('0x6'));var attributes=require(_0x838d('0x7'));var integrations=require(_0x838d('0x8'));module[_0x838d('0x9')]=function(_0x237db4,_0x43ff3c){return _0x237db4[_0x838d('0xa')](_0x838d('0xb'),attributes,{'tableName':_0x838d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6dd=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','int_zendesk_accounts','lodash'];(function(_0x730c8,_0x2bf4da){var _0x4e170b=function(_0x10b418){while(--_0x10b418){_0x730c8['push'](_0x730c8['shift']());}};_0x4e170b(++_0x2bf4da);}(_0xc6dd,0x175));var _0xdc6d=function(_0x1094f2,_0x5efcfa){_0x1094f2=_0x1094f2-0x0;var _0x3a5fb7=_0xc6dd[_0x1094f2];return _0x3a5fb7;};'use strict';var _=require(_0xdc6d('0x0'));var util=require('util');var logger=require(_0xdc6d('0x1'))(_0xdc6d('0x2'));var moment=require(_0xdc6d('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc6d('0x4'));var fs=require('fs');var path=require(_0xdc6d('0x5'));var rimraf=require(_0xdc6d('0x6'));var config=require(_0xdc6d('0x7'));var attributes=require(_0xdc6d('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xdc6d('0x9')]=function(_0x17820f,_0x151abd){return _0x17820f['define']('ZendeskAccount',attributes,{'tableName':_0xdc6d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 6d75417..b84a881 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 _0xb962=['http','request','then','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','GetZendeskAccount','findAll','options','where','attributes','limit','include','model','map','catch','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f2dfc,_0x2cda88){var _0x125bdf=function(_0x47dcc7){while(--_0x47dcc7){_0x2f2dfc['push'](_0x2f2dfc['shift']());}};_0x125bdf(++_0x2cda88);}(_0xb962,0x88));var _0x2b96=function(_0x372e33,_0x385d5f){_0x372e33=_0x372e33-0x0;var _0x55e3aa=_0xb962[_0x372e33];return _0x55e3aa;};'use strict';var _=require(_0x2b96('0x0'));var util=require(_0x2b96('0x1'));var moment=require(_0x2b96('0x2'));var BPromise=require(_0x2b96('0x3'));var rs=require(_0x2b96('0x4'));var fs=require('fs');var Redis=require(_0x2b96('0x5'));var db=require(_0x2b96('0x6'))['db'];var utils=require(_0x2b96('0x7'));var logger=require(_0x2b96('0x8'))(_0x2b96('0x9'));var config=require(_0x2b96('0xa'));var jayson=require(_0x2b96('0xb'));var client=jayson['client'][_0x2b96('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x557574,_0x4abd05,_0x213b19){return new BPromise(function(_0x579cb6,_0xb9828a){return client[_0x2b96('0xd')](_0x557574,_0x213b19)[_0x2b96('0xe')](function(_0x428ade){logger[_0x2b96('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x4abd05,'request\x20sent');logger[_0x2b96('0x10')](_0x2b96('0x11'),_0x4abd05,_0x2b96('0x12'),JSON[_0x2b96('0x13')](_0x428ade));if(_0x428ade[_0x2b96('0x14')]){if(_0x428ade['error'][_0x2b96('0x15')]===0x1f4){logger[_0x2b96('0x14')](_0x2b96('0x16'),_0x4abd05,_0x428ade[_0x2b96('0x14')]['message']);return _0xb9828a(_0x428ade[_0x2b96('0x14')]['message']);}logger[_0x2b96('0x14')](_0x2b96('0x16'),_0x4abd05,_0x428ade['error'][_0x2b96('0x17')]);return _0x579cb6(_0x428ade['error']['message']);}else{logger[_0x2b96('0xf')](_0x2b96('0x16'),_0x4abd05,'request\x20sent');_0x579cb6(_0x428ade[_0x2b96('0x18')][_0x2b96('0x17')]);}})['catch'](function(_0x375025){logger[_0x2b96('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x4abd05,_0x375025);_0xb9828a(_0x375025);});});}exports[_0x2b96('0x19')]=function(_0x476c5c){var _0x1ee528=this;return new Promise(function(_0x1f553d,_0x3e6cd5){return db['ZendeskAccount'][_0x2b96('0x1a')]({'raw':_0x476c5c[_0x2b96('0x1b')]?_0x476c5c[_0x2b96('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x476c5c['options']?_0x476c5c['options'][_0x2b96('0x1c')]||null:null,'attributes':_0x476c5c['options']?_0x476c5c['options'][_0x2b96('0x1d')]||null:null,'limit':_0x476c5c['options']?_0x476c5c[_0x2b96('0x1b')][_0x2b96('0x1e')]||null:null,'include':_0x476c5c[_0x2b96('0x1b')]?_0x476c5c[_0x2b96('0x1b')][_0x2b96('0x1f')]?_['map'](_0x476c5c[_0x2b96('0x1b')][_0x2b96('0x1f')],function(_0x528f56){return{'model':db[_0x528f56[_0x2b96('0x20')]],'as':_0x528f56['as'],'attributes':_0x528f56[_0x2b96('0x1d')],'include':_0x528f56[_0x2b96('0x1f')]?_['map'](_0x528f56['include'],function(_0x3f14f5){return{'model':db[_0x3f14f5['model']],'as':_0x3f14f5['as'],'attributes':_0x3f14f5['attributes'],'include':_0x3f14f5[_0x2b96('0x1f')]?_[_0x2b96('0x21')](_0x3f14f5[_0x2b96('0x1f')],function(_0xd3b8d5){return{'model':db[_0xd3b8d5[_0x2b96('0x20')]],'as':_0xd3b8d5['as'],'attributes':_0xd3b8d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x2b96('0xe')](function(_0x520bcd){logger[_0x2b96('0xf')](_0x2b96('0x19'),_0x476c5c);logger['debug']('GetZendeskAccount',_0x476c5c,JSON['stringify'](_0x520bcd));_0x1f553d(_0x520bcd);})[_0x2b96('0x22')](function(_0x38cf31){logger[_0x2b96('0x14')](_0x2b96('0x19'),_0x38cf31[_0x2b96('0x17')],_0x476c5c);_0x3e6cd5(_0x1ee528['error'](0x1f4,_0x38cf31[_0x2b96('0x17')]));});});};exports[_0x2b96('0x23')]=function(_0x58405e){var _0x2b24a3=this;return new Promise(function(_0x556872,_0x20724c){return db['ZendeskAccount'][_0x2b96('0x24')]({'raw':_0x58405e['options']?_0x58405e[_0x2b96('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x58405e[_0x2b96('0x1b')]?_0x58405e[_0x2b96('0x1b')][_0x2b96('0x1c')]||null:null,'attributes':_0x58405e['options']?_0x58405e[_0x2b96('0x1b')][_0x2b96('0x1d')]||null:null,'include':_0x58405e['options']?_0x58405e['options']['include']?_[_0x2b96('0x21')](_0x58405e[_0x2b96('0x1b')]['include'],function(_0x43c39e){return{'model':db[_0x43c39e['model']],'as':_0x43c39e['as'],'attributes':_0x43c39e[_0x2b96('0x1d')],'include':_0x43c39e[_0x2b96('0x1f')]?_[_0x2b96('0x21')](_0x43c39e[_0x2b96('0x1f')],function(_0x1200f3){return{'model':db[_0x1200f3[_0x2b96('0x20')]],'as':_0x1200f3['as'],'attributes':_0x1200f3['attributes'],'include':_0x1200f3['include']?_[_0x2b96('0x21')](_0x1200f3[_0x2b96('0x1f')],function(_0x2501fd){return{'model':db[_0x2501fd[_0x2b96('0x20')]],'as':_0x2501fd['as'],'attributes':_0x2501fd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52c739){logger[_0x2b96('0xf')](_0x2b96('0x23'),_0x58405e);logger['debug'](_0x2b96('0x23'),_0x58405e,JSON[_0x2b96('0x13')](_0x52c739));_0x556872(_0x52c739);})['catch'](function(_0x189111){logger['error']('ShowZendeskAccount',_0x189111[_0x2b96('0x17')],_0x58405e);_0x20724c(_0x2b24a3[_0x2b96('0x14')](0x1f4,_0x189111[_0x2b96('0x17')]));});});}; \ No newline at end of file +var _0x1bf3=['error','code','ZendeskAccount,\x20%s,\x20%s','message','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowZendeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x515262,_0x5efdd3){var _0x403c6f=function(_0x3bfc37){while(--_0x3bfc37){_0x515262['push'](_0x515262['shift']());}};_0x403c6f(++_0x5efdd3);}(_0x1bf3,0x16f));var _0x31bf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bf3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x31bf('0x0'));var util=require(_0x31bf('0x1'));var moment=require('moment');var BPromise=require(_0x31bf('0x2'));var rs=require(_0x31bf('0x3'));var fs=require('fs');var Redis=require(_0x31bf('0x4'));var db=require(_0x31bf('0x5'))['db'];var utils=require(_0x31bf('0x6'));var logger=require(_0x31bf('0x7'))(_0x31bf('0x8'));var config=require(_0x31bf('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x31bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18ffd9,_0x92366b,_0x84e6ee){return new BPromise(function(_0x1998b5,_0x3f9dfc){return client[_0x31bf('0xb')](_0x18ffd9,_0x84e6ee)[_0x31bf('0xc')](function(_0x1c2a0e){logger[_0x31bf('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x92366b,_0x31bf('0xe'));logger[_0x31bf('0xf')](_0x31bf('0x10'),_0x92366b,'request\x20sent',JSON[_0x31bf('0x11')](_0x1c2a0e));if(_0x1c2a0e[_0x31bf('0x12')]){if(_0x1c2a0e[_0x31bf('0x12')][_0x31bf('0x13')]===0x1f4){logger['error'](_0x31bf('0x14'),_0x92366b,_0x1c2a0e['error'][_0x31bf('0x15')]);return _0x3f9dfc(_0x1c2a0e[_0x31bf('0x12')][_0x31bf('0x15')]);}logger['error'](_0x31bf('0x14'),_0x92366b,_0x1c2a0e[_0x31bf('0x12')][_0x31bf('0x15')]);return _0x1998b5(_0x1c2a0e[_0x31bf('0x12')][_0x31bf('0x15')]);}else{logger[_0x31bf('0xd')](_0x31bf('0x14'),_0x92366b,_0x31bf('0xe'));_0x1998b5(_0x1c2a0e['result'][_0x31bf('0x15')]);}})['catch'](function(_0x462056){logger[_0x31bf('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x92366b,_0x462056);_0x3f9dfc(_0x462056);});});}exports[_0x31bf('0x16')]=function(_0x4e0f61){var _0x4b0313=this;return new Promise(function(_0x2fa8ef,_0x1a40f9){return db[_0x31bf('0x17')][_0x31bf('0x18')]({'raw':_0x4e0f61[_0x31bf('0x19')]?_0x4e0f61[_0x31bf('0x19')][_0x31bf('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e0f61[_0x31bf('0x19')]?_0x4e0f61[_0x31bf('0x19')][_0x31bf('0x1b')]||null:null,'attributes':_0x4e0f61[_0x31bf('0x19')]?_0x4e0f61['options'][_0x31bf('0x1c')]||null:null,'limit':_0x4e0f61['options']?_0x4e0f61[_0x31bf('0x19')]['limit']||null:null,'include':_0x4e0f61[_0x31bf('0x19')]?_0x4e0f61['options'][_0x31bf('0x1d')]?_[_0x31bf('0x1e')](_0x4e0f61['options']['include'],function(_0x3a140a){return{'model':db[_0x3a140a[_0x31bf('0x1f')]],'as':_0x3a140a['as'],'attributes':_0x3a140a[_0x31bf('0x1c')],'include':_0x3a140a['include']?_[_0x31bf('0x1e')](_0x3a140a[_0x31bf('0x1d')],function(_0x2139f0){return{'model':db[_0x2139f0[_0x31bf('0x1f')]],'as':_0x2139f0['as'],'attributes':_0x2139f0['attributes'],'include':_0x2139f0['include']?_[_0x31bf('0x1e')](_0x2139f0[_0x31bf('0x1d')],function(_0x3a26cf){return{'model':db[_0x3a26cf[_0x31bf('0x1f')]],'as':_0x3a26cf['as'],'attributes':_0x3a26cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x31bf('0xc')](function(_0x2d82e4){logger['info']('GetZendeskAccount',_0x4e0f61);logger['debug']('GetZendeskAccount',_0x4e0f61,JSON[_0x31bf('0x11')](_0x2d82e4));_0x2fa8ef(_0x2d82e4);})[_0x31bf('0x20')](function(_0x1c2450){logger['error'](_0x31bf('0x16'),_0x1c2450['message'],_0x4e0f61);_0x1a40f9(_0x4b0313[_0x31bf('0x12')](0x1f4,_0x1c2450[_0x31bf('0x15')]));});});};exports[_0x31bf('0x21')]=function(_0x55c786){var _0x2f2db8=this;return new Promise(function(_0x1b105b,_0x5a063c){return db[_0x31bf('0x17')][_0x31bf('0x22')]({'raw':_0x55c786[_0x31bf('0x19')]?_0x55c786[_0x31bf('0x19')][_0x31bf('0x1a')]===undefined?!![]:![]:!![],'where':_0x55c786[_0x31bf('0x19')]?_0x55c786[_0x31bf('0x19')][_0x31bf('0x1b')]||null:null,'attributes':_0x55c786[_0x31bf('0x19')]?_0x55c786[_0x31bf('0x19')][_0x31bf('0x1c')]||null:null,'include':_0x55c786['options']?_0x55c786['options'][_0x31bf('0x1d')]?_[_0x31bf('0x1e')](_0x55c786[_0x31bf('0x19')][_0x31bf('0x1d')],function(_0x528cf4){return{'model':db[_0x528cf4['model']],'as':_0x528cf4['as'],'attributes':_0x528cf4[_0x31bf('0x1c')],'include':_0x528cf4['include']?_[_0x31bf('0x1e')](_0x528cf4[_0x31bf('0x1d')],function(_0x5ce289){return{'model':db[_0x5ce289['model']],'as':_0x5ce289['as'],'attributes':_0x5ce289[_0x31bf('0x1c')],'include':_0x5ce289['include']?_[_0x31bf('0x1e')](_0x5ce289['include'],function(_0x485255){return{'model':db[_0x485255[_0x31bf('0x1f')]],'as':_0x485255['as'],'attributes':_0x485255[_0x31bf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x31bf('0xc')](function(_0x1f3417){logger[_0x31bf('0xd')](_0x31bf('0x21'),_0x55c786);logger[_0x31bf('0xf')](_0x31bf('0x21'),_0x55c786,JSON['stringify'](_0x1f3417));_0x1b105b(_0x1f3417);})[_0x31bf('0x20')](function(_0x8398fb){logger[_0x31bf('0x12')](_0x31bf('0x21'),_0x8398fb[_0x31bf('0x15')],_0x55c786);_0x5a063c(_0x2f2db8[_0x31bf('0x12')](0x1f4,_0x8398fb[_0x31bf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 000dd29..601e628 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 _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0xe12ca,_0x3a8e29){var _0x5ac9a8=function(_0x321b68){while(--_0x321b68){_0xe12ca['push'](_0xe12ca['shift']());}};_0x5ac9a8(++_0x3a8e29);}(_0xb10b,0x12a));var _0xbb10=function(_0x17bfa4,_0x3eb5f7){_0x17bfa4=_0x17bfa4-0x0;var _0x3d9ca8=_0xb10b[_0x17bfa4];return _0x3d9ca8;};'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['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file +var _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x4483,0x1a3));var _0x3448=function(_0x2682eb,_0x37d97b){_0x2682eb=_0x2682eb-0x0;var _0x52f401=_0x4483[_0x2682eb];return _0x52f401;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 59f7706..f502310 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 _0x3989=['sequelize','exports','STRING'];(function(_0x20f50d,_0x47e70d){var _0x2385d9=function(_0x5e97bd){while(--_0x5e97bd){_0x20f50d['push'](_0x20f50d['shift']());}};_0x2385d9(++_0x47e70d);}(_0x3989,0x1bf));var _0x9398=function(_0x3f2bb6,_0x34f81a){_0x3f2bb6=_0x3f2bb6-0x0;var _0x3cdb6f=_0x3989[_0x3f2bb6];return _0x3cdb6f;};'use strict';var Sequelize=require(_0x9398('0x0'));module[_0x9398('0x1')]={'name':{'type':Sequelize[_0x9398('0x2')]},'description':{'type':Sequelize[_0x9398('0x2')]}}; \ No newline at end of file +var _0x5f69=['exports','STRING','sequelize'];(function(_0x3c0fb0,_0x30329f){var _0x726751=function(_0x177806){while(--_0x177806){_0x3c0fb0['push'](_0x3c0fb0['shift']());}};_0x726751(++_0x30329f);}(_0x5f69,0x128));var _0x95f6=function(_0x16cfb0,_0x28d646){_0x16cfb0=_0x16cfb0-0x0;var _0x3d8504=_0x5f69[_0x16cfb0];return _0x3d8504;};'use strict';var Sequelize=require(_0x95f6('0x0'));module[_0x95f6('0x1')]={'name':{'type':Sequelize[_0x95f6('0x2')]},'description':{'type':Sequelize[_0x95f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 274e786..08e503e 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 _0x9ecf=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','fields','include','find','catch','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2f152a,_0x7c71a5){var _0x4714ad=function(_0x1989f6){while(--_0x1989f6){_0x2f152a['push'](_0x2f152a['shift']());}};_0x4714ad(++_0x7c71a5);}(_0x9ecf,0x1aa));var _0xf9ec=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x9ecf[_0x17bb31];return _0x505c71;};'use strict';var emlformat=require(_0xf9ec('0x0'));var rimraf=require(_0xf9ec('0x1'));var zipdir=require(_0xf9ec('0x2'));var jsonpatch=require(_0xf9ec('0x3'));var rp=require(_0xf9ec('0x4'));var moment=require(_0xf9ec('0x5'));var BPromise=require(_0xf9ec('0x6'));var Mustache=require(_0xf9ec('0x7'));var util=require(_0xf9ec('0x8'));var path=require(_0xf9ec('0x9'));var sox=require(_0xf9ec('0xa'));var csv=require(_0xf9ec('0xb'));var ejs=require(_0xf9ec('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9ec('0xd'));var squel=require('squel');var crypto=require(_0xf9ec('0xe'));var jsforce=require(_0xf9ec('0xf'));var deskjs=require(_0xf9ec('0x10'));var toCsv=require(_0xf9ec('0xb'));var querystring=require(_0xf9ec('0x11'));var Papa=require(_0xf9ec('0x12'));var Redis=require('ioredis');var authService=require(_0xf9ec('0x13'));var qs=require(_0xf9ec('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9ec('0x15'));var logger=require(_0xf9ec('0x16'))(_0xf9ec('0x17'));var utils=require('../../config/utils');var config=require(_0xf9ec('0x18'));var licenseUtil=require(_0xf9ec('0x19'));var db=require(_0xf9ec('0x1a'))['db'];function respondWithStatusCode(_0x3e85ca,_0x3a8643){_0x3a8643=_0x3a8643||0xcc;return function(_0xd63a2c){if(_0xd63a2c){return _0x3e85ca[_0xf9ec('0x1b')](_0x3a8643);}return _0x3e85ca['status'](_0x3a8643)[_0xf9ec('0x1c')]();};}function respondWithResult(_0xc04772,_0xec7fc){_0xec7fc=_0xec7fc||0xc8;return function(_0x5bc0b2){if(_0x5bc0b2){return _0xc04772[_0xf9ec('0x1d')](_0xec7fc)[_0xf9ec('0x1e')](_0x5bc0b2);}};}function respondWithFilteredResult(_0x2b32f8,_0x8f3c86){return function(_0x333903){if(_0x333903){var _0x340afe=typeof _0x8f3c86[_0xf9ec('0x1f')]===_0xf9ec('0x20')&&typeof _0x8f3c86[_0xf9ec('0x21')]==='undefined';var _0x510b5e=_0x333903['count'];var _0x5f23f7=_0x340afe?0x0:_0x8f3c86['offset'];var _0x1f4e8d=_0x340afe?_0x333903[_0xf9ec('0x22')]:_0x8f3c86['offset']+_0x8f3c86[_0xf9ec('0x21')];var _0x223af6;if(_0x1f4e8d>=_0x510b5e){_0x1f4e8d=_0x510b5e;_0x223af6=0xc8;}else{_0x223af6=0xce;}_0x2b32f8['status'](_0x223af6);return _0x2b32f8[_0xf9ec('0x23')](_0xf9ec('0x24'),_0x5f23f7+'-'+_0x1f4e8d+'/'+_0x510b5e)[_0xf9ec('0x1e')](_0x333903);}return null;};}function patchUpdates(_0x39a402){return function(_0x1dacfc){try{jsonpatch[_0xf9ec('0x25')](_0x1dacfc,_0x39a402,!![]);}catch(_0x39bb6a){return BPromise[_0xf9ec('0x26')](_0x39bb6a);}return _0x1dacfc[_0xf9ec('0x27')]();};}function saveUpdates(_0x453e48,_0x4b04b0){return function(_0x2da7ca){if(_0x2da7ca){return _0x2da7ca[_0xf9ec('0x28')](_0x453e48)['then'](function(_0x3e7214){return _0x3e7214;});}return null;};}function removeEntity(_0x9c9da5,_0x1526ac){return function(_0x26bd56){if(_0x26bd56){return _0x26bd56[_0xf9ec('0x29')]()[_0xf9ec('0x2a')](function(){_0x9c9da5[_0xf9ec('0x1d')](0xcc)[_0xf9ec('0x1c')]();});}};}function handleEntityNotFound(_0x2a977b,_0x896d91){return function(_0x3554db){if(!_0x3554db){_0x2a977b[_0xf9ec('0x1b')](0x194);}return _0x3554db;};}function handleError(_0x3ca9bc,_0x286a9c){_0x286a9c=_0x286a9c||0x1f4;return function(_0x459087){logger[_0xf9ec('0x2b')](_0x459087[_0xf9ec('0x2c')]);if(_0x459087[_0xf9ec('0x2d')]){delete _0x459087[_0xf9ec('0x2d')];}_0x3ca9bc[_0xf9ec('0x1d')](_0x286a9c)[_0xf9ec('0x2e')](_0x459087);};}exports['index']=function(_0x3c6052,_0x55ca6a){var _0x315930={},_0x9c7d32={},_0x5209dc={'count':0x0,'rows':[]};var _0x35e2e9=_[_0xf9ec('0x2f')](db[_0xf9ec('0x30')][_0xf9ec('0x31')],function(_0x33fef9){return{'name':_0x33fef9[_0xf9ec('0x32')],'type':_0x33fef9[_0xf9ec('0x33')][_0xf9ec('0x34')]};});_0x9c7d32[_0xf9ec('0x35')]=_[_0xf9ec('0x2f')](_0x35e2e9,_0xf9ec('0x2d'));_0x9c7d32['query']=_[_0xf9ec('0x36')](_0x3c6052[_0xf9ec('0x37')]);_0x9c7d32[_0xf9ec('0x38')]=_['intersection'](_0x9c7d32[_0xf9ec('0x35')],_0x9c7d32[_0xf9ec('0x37')]);_0x315930[_0xf9ec('0x39')]=_[_0xf9ec('0x3a')](_0x9c7d32['model'],qs['fields'](_0x3c6052[_0xf9ec('0x37')]['fields']));_0x315930['attributes']=_0x315930[_0xf9ec('0x39')][_0xf9ec('0x3b')]?_0x315930[_0xf9ec('0x39')]:_0x9c7d32['model'];if(!_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x3c')](_0xf9ec('0x3d'))){_0x315930[_0xf9ec('0x21')]=qs[_0xf9ec('0x21')](_0x3c6052[_0xf9ec('0x37')]['limit']);_0x315930[_0xf9ec('0x1f')]=qs['offset'](_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x1f')]);}_0x315930[_0xf9ec('0x3e')]=qs['sort'](_0x3c6052['query'][_0xf9ec('0x3f')]);_0x315930[_0xf9ec('0x40')]=qs[_0xf9ec('0x38')](_[_0xf9ec('0x41')](_0x3c6052[_0xf9ec('0x37')],_0x9c7d32[_0xf9ec('0x38')]),_0x35e2e9);if(_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x42')]){_0x315930['where']=_[_0xf9ec('0x43')](_0x315930['where'],{'$or':_[_0xf9ec('0x2f')](_0x35e2e9,function(_0x90f401){if(_0x90f401[_0xf9ec('0x33')]!==_0xf9ec('0x44')){var _0xbffa82={};_0xbffa82[_0x90f401[_0xf9ec('0x2d')]]={'$like':'%'+_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x42')]+'%'};return _0xbffa82;}})});}_0x315930=_[_0xf9ec('0x43')]({},_0x315930,_0x3c6052[_0xf9ec('0x45')]);var _0x20066a={'where':_0x315930[_0xf9ec('0x40')]};return db[_0xf9ec('0x30')][_0xf9ec('0x22')](_0x20066a)[_0xf9ec('0x2a')](function(_0xeba3e5){_0x5209dc[_0xf9ec('0x22')]=_0xeba3e5;if(_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x46')]){_0x315930['include']=[{'all':!![]}];}return db[_0xf9ec('0x30')]['findAll'](_0x315930);})[_0xf9ec('0x2a')](function(_0x64e1cd){_0x5209dc[_0xf9ec('0x47')]=_0x64e1cd;return _0x5209dc;})[_0xf9ec('0x2a')](respondWithFilteredResult(_0x55ca6a,_0x315930))['catch'](handleError(_0x55ca6a,null));};exports['show']=function(_0x1859e0,_0xc6c42b){var _0x2f5f62={'raw':![],'where':{'id':_0x1859e0[_0xf9ec('0x48')]['id']}},_0x5062e1={};_0x5062e1[_0xf9ec('0x35')]=_[_0xf9ec('0x36')](db[_0xf9ec('0x30')][_0xf9ec('0x31')]);_0x5062e1[_0xf9ec('0x37')]=_[_0xf9ec('0x36')](_0x1859e0['query']);_0x5062e1[_0xf9ec('0x38')]=_[_0xf9ec('0x3a')](_0x5062e1[_0xf9ec('0x35')],_0x5062e1['query']);_0x2f5f62[_0xf9ec('0x39')]=_[_0xf9ec('0x3a')](_0x5062e1[_0xf9ec('0x35')],qs[_0xf9ec('0x49')](_0x1859e0[_0xf9ec('0x37')][_0xf9ec('0x49')]));_0x2f5f62[_0xf9ec('0x39')]=_0x2f5f62[_0xf9ec('0x39')][_0xf9ec('0x3b')]?_0x2f5f62[_0xf9ec('0x39')]:_0x5062e1[_0xf9ec('0x35')];if(_0x1859e0[_0xf9ec('0x37')][_0xf9ec('0x46')]){_0x2f5f62[_0xf9ec('0x4a')]=[{'all':!![]}];}_0x2f5f62=_[_0xf9ec('0x43')]({},_0x2f5f62,_0x1859e0[_0xf9ec('0x45')]);return db['ZendeskConfiguration'][_0xf9ec('0x4b')](_0x2f5f62)[_0xf9ec('0x2a')](handleEntityNotFound(_0xc6c42b,null))[_0xf9ec('0x2a')](respondWithResult(_0xc6c42b,null))[_0xf9ec('0x4c')](handleError(_0xc6c42b,null));};exports['create']=function(_0x211c1c,_0x342190){return db[_0xf9ec('0x30')]['create'](_0x211c1c['body'],{})[_0xf9ec('0x2a')](respondWithResult(_0x342190,0xc9))[_0xf9ec('0x4c')](handleError(_0x342190,null));};exports[_0xf9ec('0x28')]=function(_0xeea8b2,_0x509c96){if(_0xeea8b2[_0xf9ec('0x4d')]['id']){delete _0xeea8b2[_0xf9ec('0x4d')]['id'];}return db[_0xf9ec('0x30')]['find']({'where':{'id':_0xeea8b2[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x509c96,null))[_0xf9ec('0x2a')](saveUpdates(_0xeea8b2[_0xf9ec('0x4d')],null))[_0xf9ec('0x2a')](respondWithResult(_0x509c96,null))['catch'](handleError(_0x509c96,null));};exports['destroy']=function(_0x1e1230,_0x254b9a){return db[_0xf9ec('0x30')]['find']({'where':{'id':_0x1e1230[_0xf9ec('0x48')]['id']}})['then'](handleEntityNotFound(_0x254b9a,null))['then'](removeEntity(_0x254b9a,null))[_0xf9ec('0x4c')](handleError(_0x254b9a,null));};exports[_0xf9ec('0x4e')]=function(_0x33a4d7,_0x41a0c8,_0x5e763e){var _0x1a1eea={};var _0x550e0b={};var _0x5d5747;var _0x554bab;return db[_0xf9ec('0x30')][_0xf9ec('0x4f')]({'where':{'id':_0x33a4d7[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x41a0c8,null))[_0xf9ec('0x2a')](function(_0x5554eb){if(_0x5554eb){_0x5d5747=_0x5554eb;_0x550e0b[_0xf9ec('0x35')]=_[_0xf9ec('0x36')](db[_0xf9ec('0x50')][_0xf9ec('0x31')]);_0x550e0b[_0xf9ec('0x37')]=_['keys'](_0x33a4d7[_0xf9ec('0x37')]);_0x550e0b['filters']=_['intersection'](_0x550e0b[_0xf9ec('0x35')],_0x550e0b['query']);_0x1a1eea[_0xf9ec('0x39')]=_[_0xf9ec('0x3a')](_0x550e0b['model'],qs['fields'](_0x33a4d7[_0xf9ec('0x37')][_0xf9ec('0x49')]));_0x1a1eea[_0xf9ec('0x39')]=_0x1a1eea['attributes'][_0xf9ec('0x3b')]?_0x1a1eea[_0xf9ec('0x39')]:_0x550e0b[_0xf9ec('0x35')];_0x1a1eea[_0xf9ec('0x3e')]=qs[_0xf9ec('0x3f')](_0x33a4d7[_0xf9ec('0x37')][_0xf9ec('0x3f')]);_0x1a1eea['where']=qs[_0xf9ec('0x38')](_['pick'](_0x33a4d7[_0xf9ec('0x37')],_0x550e0b[_0xf9ec('0x38')]));if(_0x33a4d7['query'][_0xf9ec('0x42')]){_0x1a1eea[_0xf9ec('0x40')]=_['merge'](_0x1a1eea[_0xf9ec('0x40')],{'$or':_[_0xf9ec('0x2f')](_0x1a1eea[_0xf9ec('0x39')],function(_0x5cf122){var _0x87793e={};_0x87793e[_0x5cf122]={'$like':'%'+_0x33a4d7[_0xf9ec('0x37')]['filter']+'%'};return _0x87793e;})});}_0x1a1eea=_[_0xf9ec('0x43')]({},_0x1a1eea,_0x33a4d7[_0xf9ec('0x45')]);return _0x5d5747[_0xf9ec('0x4e')](_0x1a1eea);}})['then'](function(_0xa8d223){if(_0xa8d223){_0x554bab=_0xa8d223[_0xf9ec('0x3b')];if(!_0x33a4d7[_0xf9ec('0x37')][_0xf9ec('0x3c')](_0xf9ec('0x3d'))){_0x1a1eea['limit']=qs[_0xf9ec('0x21')](_0x33a4d7[_0xf9ec('0x37')]['limit']);_0x1a1eea[_0xf9ec('0x1f')]=qs[_0xf9ec('0x1f')](_0x33a4d7[_0xf9ec('0x37')][_0xf9ec('0x1f')]);}return _0x5d5747[_0xf9ec('0x4e')](_0x1a1eea);}})[_0xf9ec('0x2a')](function(_0x369460){if(_0x369460){return _0x369460?{'count':_0x554bab,'rows':_0x369460}:null;}})[_0xf9ec('0x2a')](respondWithResult(_0x41a0c8,null))[_0xf9ec('0x4c')](handleError(_0x41a0c8,null));};exports[_0xf9ec('0x51')]=function(_0x18687e,_0x21d032,_0x4586d4){var _0x16e36d={};var _0x1c87ae={};var _0x11a187;var _0x1ce18e;return db[_0xf9ec('0x30')][_0xf9ec('0x4f')]({'where':{'id':_0x18687e[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x21d032,null))[_0xf9ec('0x2a')](function(_0x2f5424){if(_0x2f5424){_0x11a187=_0x2f5424;_0x1c87ae[_0xf9ec('0x35')]=_['keys'](db['ZendeskField'][_0xf9ec('0x31')]);_0x1c87ae['query']=_[_0xf9ec('0x36')](_0x18687e[_0xf9ec('0x37')]);_0x1c87ae['filters']=_[_0xf9ec('0x3a')](_0x1c87ae[_0xf9ec('0x35')],_0x1c87ae[_0xf9ec('0x37')]);_0x16e36d['attributes']=_['intersection'](_0x1c87ae[_0xf9ec('0x35')],qs[_0xf9ec('0x49')](_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x49')]));_0x16e36d['attributes']=_0x16e36d[_0xf9ec('0x39')]['length']?_0x16e36d[_0xf9ec('0x39')]:_0x1c87ae['model'];_0x16e36d[_0xf9ec('0x3e')]=qs[_0xf9ec('0x3f')](_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x3f')]);_0x16e36d['where']=qs['filters'](_[_0xf9ec('0x41')](_0x18687e[_0xf9ec('0x37')],_0x1c87ae['filters']));if(_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x42')]){_0x16e36d[_0xf9ec('0x40')]=_[_0xf9ec('0x43')](_0x16e36d[_0xf9ec('0x40')],{'$or':_[_0xf9ec('0x2f')](_0x16e36d[_0xf9ec('0x39')],function(_0x3403a3){var _0x4c1297={};_0x4c1297[_0x3403a3]={'$like':'%'+_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x42')]+'%'};return _0x4c1297;})});}_0x16e36d=_[_0xf9ec('0x43')]({},_0x16e36d,_0x18687e[_0xf9ec('0x45')]);return _0x11a187[_0xf9ec('0x51')](_0x16e36d);}})[_0xf9ec('0x2a')](function(_0x44288d){if(_0x44288d){_0x1ce18e=_0x44288d[_0xf9ec('0x3b')];if(!_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x3c')](_0xf9ec('0x3d'))){_0x16e36d[_0xf9ec('0x21')]=qs[_0xf9ec('0x21')](_0x18687e['query'][_0xf9ec('0x21')]);_0x16e36d[_0xf9ec('0x1f')]=qs[_0xf9ec('0x1f')](_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x1f')]);}return _0x11a187[_0xf9ec('0x51')](_0x16e36d);}})[_0xf9ec('0x2a')](function(_0x584fef){if(_0x584fef){return _0x584fef?{'count':_0x1ce18e,'rows':_0x584fef}:null;}})['then'](respondWithResult(_0x21d032,null))[_0xf9ec('0x4c')](handleError(_0x21d032,null));};exports[_0xf9ec('0x52')]=function(_0x49c18e,_0x4bab0c,_0xb07632){var _0xf902c1={};var _0x14283c={};var _0xb1657d;var _0x1eae6a;return db[_0xf9ec('0x30')][_0xf9ec('0x4f')]({'where':{'id':_0x49c18e[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x4bab0c,null))[_0xf9ec('0x2a')](function(_0x4657d7){if(_0x4657d7){_0xb1657d=_0x4657d7;_0x14283c[_0xf9ec('0x35')]=_[_0xf9ec('0x36')](db[_0xf9ec('0x50')][_0xf9ec('0x31')]);_0x14283c[_0xf9ec('0x37')]=_[_0xf9ec('0x36')](_0x49c18e[_0xf9ec('0x37')]);_0x14283c[_0xf9ec('0x38')]=_[_0xf9ec('0x3a')](_0x14283c[_0xf9ec('0x35')],_0x14283c[_0xf9ec('0x37')]);_0xf902c1[_0xf9ec('0x39')]=_['intersection'](_0x14283c[_0xf9ec('0x35')],qs[_0xf9ec('0x49')](_0x49c18e['query'][_0xf9ec('0x49')]));_0xf902c1['attributes']=_0xf902c1[_0xf9ec('0x39')][_0xf9ec('0x3b')]?_0xf902c1['attributes']:_0x14283c['model'];_0xf902c1[_0xf9ec('0x3e')]=qs[_0xf9ec('0x3f')](_0x49c18e['query']['sort']);_0xf902c1[_0xf9ec('0x40')]=qs['filters'](_[_0xf9ec('0x41')](_0x49c18e['query'],_0x14283c['filters']));if(_0x49c18e[_0xf9ec('0x37')][_0xf9ec('0x42')]){_0xf902c1[_0xf9ec('0x40')]=_[_0xf9ec('0x43')](_0xf902c1['where'],{'$or':_[_0xf9ec('0x2f')](_0xf902c1[_0xf9ec('0x39')],function(_0x1faa80){var _0x4346cf={};_0x4346cf[_0x1faa80]={'$like':'%'+_0x49c18e[_0xf9ec('0x37')][_0xf9ec('0x42')]+'%'};return _0x4346cf;})});}_0xf902c1=_['merge']({},_0xf902c1,_0x49c18e[_0xf9ec('0x45')]);return _0xb1657d[_0xf9ec('0x52')](_0xf902c1);}})[_0xf9ec('0x2a')](function(_0x245f21){if(_0x245f21){_0x1eae6a=_0x245f21[_0xf9ec('0x3b')];if(!_0x49c18e['query'][_0xf9ec('0x3c')]('nolimit')){_0xf902c1[_0xf9ec('0x21')]=qs[_0xf9ec('0x21')](_0x49c18e[_0xf9ec('0x37')][_0xf9ec('0x21')]);_0xf902c1['offset']=qs['offset'](_0x49c18e[_0xf9ec('0x37')][_0xf9ec('0x1f')]);}return _0xb1657d[_0xf9ec('0x52')](_0xf902c1);}})[_0xf9ec('0x2a')](function(_0x50a3e4){if(_0x50a3e4){return _0x50a3e4?{'count':_0x1eae6a,'rows':_0x50a3e4}:null;}})[_0xf9ec('0x2a')](respondWithResult(_0x4bab0c,null))[_0xf9ec('0x4c')](handleError(_0x4bab0c,null));};exports[_0xf9ec('0x53')]=function(_0x4a81b5,_0x4ed127,_0x137710){var _0x3fd194={};var _0x3f4a94={};var _0x1d545b;var _0x4e328a;return db['ZendeskConfiguration'][_0xf9ec('0x4f')]({'where':{'id':_0x4a81b5[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x4ed127,null))[_0xf9ec('0x2a')](function(_0x1496bb){if(_0x1496bb){_0x1d545b=_0x1496bb;_0x3f4a94['model']=_[_0xf9ec('0x36')](db['Tag'][_0xf9ec('0x31')]);_0x3f4a94[_0xf9ec('0x37')]=_[_0xf9ec('0x36')](_0x4a81b5[_0xf9ec('0x37')]);_0x3f4a94[_0xf9ec('0x38')]=_[_0xf9ec('0x3a')](_0x3f4a94[_0xf9ec('0x35')],_0x3f4a94[_0xf9ec('0x37')]);_0x3fd194['attributes']=_[_0xf9ec('0x3a')](_0x3f4a94[_0xf9ec('0x35')],qs['fields'](_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x49')]));_0x3fd194['attributes']=_0x3fd194[_0xf9ec('0x39')][_0xf9ec('0x3b')]?_0x3fd194[_0xf9ec('0x39')]:_0x3f4a94[_0xf9ec('0x35')];_0x3fd194[_0xf9ec('0x3e')]=qs[_0xf9ec('0x3f')](_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x3f')]);_0x3fd194[_0xf9ec('0x40')]=qs[_0xf9ec('0x38')](_['pick'](_0x4a81b5['query'],_0x3f4a94[_0xf9ec('0x38')]));if(_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x42')]){_0x3fd194[_0xf9ec('0x40')]=_[_0xf9ec('0x43')](_0x3fd194[_0xf9ec('0x40')],{'$or':_[_0xf9ec('0x2f')](_0x3fd194['attributes'],function(_0x12752d){var _0x5c32e4={};_0x5c32e4[_0x12752d]={'$like':'%'+_0x4a81b5['query'][_0xf9ec('0x42')]+'%'};return _0x5c32e4;})});}_0x3fd194=_[_0xf9ec('0x43')]({},_0x3fd194,_0x4a81b5['options']);return _0x1d545b[_0xf9ec('0x53')](_0x3fd194);}})[_0xf9ec('0x2a')](function(_0x512d9d){if(_0x512d9d){_0x4e328a=_0x512d9d[_0xf9ec('0x3b')];if(!_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x3c')](_0xf9ec('0x3d'))){_0x3fd194[_0xf9ec('0x21')]=qs[_0xf9ec('0x21')](_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x21')]);_0x3fd194['offset']=qs[_0xf9ec('0x1f')](_0x4a81b5['query'][_0xf9ec('0x1f')]);}return _0x1d545b[_0xf9ec('0x53')](_0x3fd194);}})[_0xf9ec('0x2a')](function(_0x1601e8){if(_0x1601e8){return _0x1601e8?{'count':_0x4e328a,'rows':_0x1601e8}:null;}})['then'](respondWithResult(_0x4ed127,null))[_0xf9ec('0x4c')](handleError(_0x4ed127,null));};exports['setTags']=function(_0x19ac86,_0x864057,_0x4d65ea){if(_0x19ac86[_0xf9ec('0x4d')]['id']){delete _0x19ac86[_0xf9ec('0x4d')]['id'];}return db['ZendeskConfiguration'][_0xf9ec('0x4f')]({'where':{'id':_0x19ac86[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x864057,null))[_0xf9ec('0x2a')](function(_0x570f04){if(_0x570f04){return _0x570f04[_0xf9ec('0x54')](_0x19ac86[_0xf9ec('0x4d')][_0xf9ec('0x55')]||[]);}return null;})[_0xf9ec('0x2a')](respondWithResult(_0x864057,null))[_0xf9ec('0x4c')](handleError(_0x864057,null));}; \ No newline at end of file +var _0x1e8d=['sendStatus','error','stack','name','send','ZendeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','find','create','body','getFields','findOne','params','ZendeskField','options','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end'];(function(_0x2a77de,_0x5c56f5){var _0x532075=function(_0x333d04){while(--_0x333d04){_0x2a77de['push'](_0x2a77de['shift']());}};_0x532075(++_0x5c56f5);}(_0x1e8d,0x1d5));var _0xd1e8=function(_0x5d425c,_0x2c0b0f){_0x5d425c=_0x5d425c-0x0;var _0x5e3b30=_0x1e8d[_0x5d425c];return _0x5e3b30;};'use strict';var emlformat=require(_0xd1e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1e8('0x1'));var jsonpatch=require(_0xd1e8('0x2'));var rp=require(_0xd1e8('0x3'));var moment=require(_0xd1e8('0x4'));var BPromise=require(_0xd1e8('0x5'));var Mustache=require(_0xd1e8('0x6'));var util=require(_0xd1e8('0x7'));var path=require(_0xd1e8('0x8'));var sox=require(_0xd1e8('0x9'));var csv=require(_0xd1e8('0xa'));var ejs=require(_0xd1e8('0xb'));var fs=require('fs');var fs_extra=require(_0xd1e8('0xc'));var _=require(_0xd1e8('0xd'));var squel=require(_0xd1e8('0xe'));var crypto=require(_0xd1e8('0xf'));var jsforce=require(_0xd1e8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd1e8('0xa'));var querystring=require(_0xd1e8('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd1e8('0x12'));var qs=require(_0xd1e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1e8('0x14'));var logger=require(_0xd1e8('0x15'))(_0xd1e8('0x16'));var utils=require(_0xd1e8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd1e8('0x18'));var db=require(_0xd1e8('0x19'))['db'];function respondWithStatusCode(_0x56a4b6,_0x3775cb){_0x3775cb=_0x3775cb||0xcc;return function(_0x1f9ce1){if(_0x1f9ce1){return _0x56a4b6['sendStatus'](_0x3775cb);}return _0x56a4b6[_0xd1e8('0x1a')](_0x3775cb)['end']();};}function respondWithResult(_0x38ccae,_0x3ad69c){_0x3ad69c=_0x3ad69c||0xc8;return function(_0x4f4faf){if(_0x4f4faf){return _0x38ccae['status'](_0x3ad69c)[_0xd1e8('0x1b')](_0x4f4faf);}};}function respondWithFilteredResult(_0xc931f3,_0x182253){return function(_0x1c51cf){if(_0x1c51cf){var _0x1cbe4d=typeof _0x182253[_0xd1e8('0x1c')]==='undefined'&&typeof _0x182253['limit']===_0xd1e8('0x1d');var _0x23a66b=_0x1c51cf['count'];var _0xa4f028=_0x1cbe4d?0x0:_0x182253[_0xd1e8('0x1c')];var _0xec9ec3=_0x1cbe4d?_0x1c51cf[_0xd1e8('0x1e')]:_0x182253[_0xd1e8('0x1c')]+_0x182253[_0xd1e8('0x1f')];var _0x2bfd4f;if(_0xec9ec3>=_0x23a66b){_0xec9ec3=_0x23a66b;_0x2bfd4f=0xc8;}else{_0x2bfd4f=0xce;}_0xc931f3[_0xd1e8('0x1a')](_0x2bfd4f);return _0xc931f3[_0xd1e8('0x20')](_0xd1e8('0x21'),_0xa4f028+'-'+_0xec9ec3+'/'+_0x23a66b)[_0xd1e8('0x1b')](_0x1c51cf);}return null;};}function patchUpdates(_0x272d14){return function(_0x11c529){try{jsonpatch[_0xd1e8('0x22')](_0x11c529,_0x272d14,!![]);}catch(_0x3c0ff0){return BPromise[_0xd1e8('0x23')](_0x3c0ff0);}return _0x11c529[_0xd1e8('0x24')]();};}function saveUpdates(_0x7e1029,_0x4f376c){return function(_0x419489){if(_0x419489){return _0x419489[_0xd1e8('0x25')](_0x7e1029)['then'](function(_0x3990ab){return _0x3990ab;});}return null;};}function removeEntity(_0x3df98f,_0x4428e6){return function(_0x1a40c0){if(_0x1a40c0){return _0x1a40c0[_0xd1e8('0x26')]()[_0xd1e8('0x27')](function(){_0x3df98f[_0xd1e8('0x1a')](0xcc)[_0xd1e8('0x28')]();});}};}function handleEntityNotFound(_0x5b0f50,_0x4ffc02){return function(_0x4b82fb){if(!_0x4b82fb){_0x5b0f50[_0xd1e8('0x29')](0x194);}return _0x4b82fb;};}function handleError(_0x52e68a,_0xd16d61){_0xd16d61=_0xd16d61||0x1f4;return function(_0x4bef48){logger[_0xd1e8('0x2a')](_0x4bef48[_0xd1e8('0x2b')]);if(_0x4bef48[_0xd1e8('0x2c')]){delete _0x4bef48[_0xd1e8('0x2c')];}_0x52e68a[_0xd1e8('0x1a')](_0xd16d61)[_0xd1e8('0x2d')](_0x4bef48);};}exports['index']=function(_0x375700,_0x3031cd){var _0x396aee={},_0x9973c6={},_0x56f2b2={'count':0x0,'rows':[]};var _0x482ebf=_['map'](db[_0xd1e8('0x2e')][_0xd1e8('0x2f')],function(_0x34fb5b){return{'name':_0x34fb5b['fieldName'],'type':_0x34fb5b[_0xd1e8('0x30')][_0xd1e8('0x31')]};});_0x9973c6[_0xd1e8('0x32')]=_[_0xd1e8('0x33')](_0x482ebf,_0xd1e8('0x2c'));_0x9973c6[_0xd1e8('0x34')]=_[_0xd1e8('0x35')](_0x375700[_0xd1e8('0x34')]);_0x9973c6[_0xd1e8('0x36')]=_['intersection'](_0x9973c6[_0xd1e8('0x32')],_0x9973c6[_0xd1e8('0x34')]);_0x396aee[_0xd1e8('0x37')]=_[_0xd1e8('0x38')](_0x9973c6['model'],qs[_0xd1e8('0x39')](_0x375700[_0xd1e8('0x34')]['fields']));_0x396aee[_0xd1e8('0x37')]=_0x396aee[_0xd1e8('0x37')][_0xd1e8('0x3a')]?_0x396aee[_0xd1e8('0x37')]:_0x9973c6[_0xd1e8('0x32')];if(!_0x375700[_0xd1e8('0x34')]['hasOwnProperty'](_0xd1e8('0x3b'))){_0x396aee[_0xd1e8('0x1f')]=qs['limit'](_0x375700[_0xd1e8('0x34')]['limit']);_0x396aee[_0xd1e8('0x1c')]=qs[_0xd1e8('0x1c')](_0x375700[_0xd1e8('0x34')][_0xd1e8('0x1c')]);}_0x396aee[_0xd1e8('0x3c')]=qs[_0xd1e8('0x3d')](_0x375700[_0xd1e8('0x34')][_0xd1e8('0x3d')]);_0x396aee['where']=qs[_0xd1e8('0x36')](_[_0xd1e8('0x3e')](_0x375700[_0xd1e8('0x34')],_0x9973c6[_0xd1e8('0x36')]),_0x482ebf);if(_0x375700[_0xd1e8('0x34')][_0xd1e8('0x3f')]){_0x396aee[_0xd1e8('0x40')]=_[_0xd1e8('0x41')](_0x396aee[_0xd1e8('0x40')],{'$or':_['map'](_0x482ebf,function(_0x5a3727){if(_0x5a3727[_0xd1e8('0x30')]!=='VIRTUAL'){var _0x303bfb={};_0x303bfb[_0x5a3727['name']]={'$like':'%'+_0x375700[_0xd1e8('0x34')][_0xd1e8('0x3f')]+'%'};return _0x303bfb;}})});}_0x396aee=_[_0xd1e8('0x41')]({},_0x396aee,_0x375700['options']);var _0x146165={'where':_0x396aee['where']};return db[_0xd1e8('0x2e')][_0xd1e8('0x1e')](_0x146165)[_0xd1e8('0x27')](function(_0x52efc0){_0x56f2b2[_0xd1e8('0x1e')]=_0x52efc0;if(_0x375700[_0xd1e8('0x34')][_0xd1e8('0x42')]){_0x396aee[_0xd1e8('0x43')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xd1e8('0x44')](_0x396aee);})[_0xd1e8('0x27')](function(_0x1a952b){_0x56f2b2['rows']=_0x1a952b;return _0x56f2b2;})[_0xd1e8('0x27')](respondWithFilteredResult(_0x3031cd,_0x396aee))[_0xd1e8('0x45')](handleError(_0x3031cd,null));};exports['show']=function(_0x594caa,_0x3f7b90){var _0x1cd34d={'raw':![],'where':{'id':_0x594caa['params']['id']}},_0x5e6c62={};_0x5e6c62[_0xd1e8('0x32')]=_[_0xd1e8('0x35')](db['ZendeskConfiguration'][_0xd1e8('0x2f')]);_0x5e6c62[_0xd1e8('0x34')]=_[_0xd1e8('0x35')](_0x594caa['query']);_0x5e6c62['filters']=_['intersection'](_0x5e6c62[_0xd1e8('0x32')],_0x5e6c62[_0xd1e8('0x34')]);_0x1cd34d[_0xd1e8('0x37')]=_[_0xd1e8('0x38')](_0x5e6c62['model'],qs[_0xd1e8('0x39')](_0x594caa[_0xd1e8('0x34')][_0xd1e8('0x39')]));_0x1cd34d[_0xd1e8('0x37')]=_0x1cd34d[_0xd1e8('0x37')][_0xd1e8('0x3a')]?_0x1cd34d[_0xd1e8('0x37')]:_0x5e6c62[_0xd1e8('0x32')];if(_0x594caa[_0xd1e8('0x34')][_0xd1e8('0x42')]){_0x1cd34d[_0xd1e8('0x43')]=[{'all':!![]}];}_0x1cd34d=_[_0xd1e8('0x41')]({},_0x1cd34d,_0x594caa['options']);return db[_0xd1e8('0x2e')][_0xd1e8('0x46')](_0x1cd34d)[_0xd1e8('0x27')](handleEntityNotFound(_0x3f7b90,null))[_0xd1e8('0x27')](respondWithResult(_0x3f7b90,null))[_0xd1e8('0x45')](handleError(_0x3f7b90,null));};exports[_0xd1e8('0x47')]=function(_0x36c5ee,_0x43c321){return db['ZendeskConfiguration'][_0xd1e8('0x47')](_0x36c5ee[_0xd1e8('0x48')],{})['then'](respondWithResult(_0x43c321,0xc9))[_0xd1e8('0x45')](handleError(_0x43c321,null));};exports[_0xd1e8('0x25')]=function(_0x37f352,_0x179c2e){if(_0x37f352[_0xd1e8('0x48')]['id']){delete _0x37f352[_0xd1e8('0x48')]['id'];}return db[_0xd1e8('0x2e')][_0xd1e8('0x46')]({'where':{'id':_0x37f352['params']['id']}})['then'](handleEntityNotFound(_0x179c2e,null))[_0xd1e8('0x27')](saveUpdates(_0x37f352[_0xd1e8('0x48')],null))[_0xd1e8('0x27')](respondWithResult(_0x179c2e,null))[_0xd1e8('0x45')](handleError(_0x179c2e,null));};exports[_0xd1e8('0x26')]=function(_0x581481,_0x2558b2){return db[_0xd1e8('0x2e')]['find']({'where':{'id':_0x581481['params']['id']}})[_0xd1e8('0x27')](handleEntityNotFound(_0x2558b2,null))[_0xd1e8('0x27')](removeEntity(_0x2558b2,null))[_0xd1e8('0x45')](handleError(_0x2558b2,null));};exports[_0xd1e8('0x49')]=function(_0x58cbac,_0x4bedde,_0x33ee46){var _0x2a5bb8={};var _0x2eab36={};var _0x11ade8;var _0x3f44bf;return db[_0xd1e8('0x2e')][_0xd1e8('0x4a')]({'where':{'id':_0x58cbac[_0xd1e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4bedde,null))['then'](function(_0x5262b4){if(_0x5262b4){_0x11ade8=_0x5262b4;_0x2eab36[_0xd1e8('0x32')]=_[_0xd1e8('0x35')](db[_0xd1e8('0x4c')]['rawAttributes']);_0x2eab36[_0xd1e8('0x34')]=_[_0xd1e8('0x35')](_0x58cbac[_0xd1e8('0x34')]);_0x2eab36[_0xd1e8('0x36')]=_[_0xd1e8('0x38')](_0x2eab36[_0xd1e8('0x32')],_0x2eab36[_0xd1e8('0x34')]);_0x2a5bb8[_0xd1e8('0x37')]=_[_0xd1e8('0x38')](_0x2eab36[_0xd1e8('0x32')],qs[_0xd1e8('0x39')](_0x58cbac[_0xd1e8('0x34')][_0xd1e8('0x39')]));_0x2a5bb8[_0xd1e8('0x37')]=_0x2a5bb8[_0xd1e8('0x37')]['length']?_0x2a5bb8['attributes']:_0x2eab36[_0xd1e8('0x32')];_0x2a5bb8[_0xd1e8('0x3c')]=qs[_0xd1e8('0x3d')](_0x58cbac['query'][_0xd1e8('0x3d')]);_0x2a5bb8['where']=qs[_0xd1e8('0x36')](_[_0xd1e8('0x3e')](_0x58cbac[_0xd1e8('0x34')],_0x2eab36[_0xd1e8('0x36')]));if(_0x58cbac[_0xd1e8('0x34')][_0xd1e8('0x3f')]){_0x2a5bb8[_0xd1e8('0x40')]=_[_0xd1e8('0x41')](_0x2a5bb8['where'],{'$or':_[_0xd1e8('0x33')](_0x2a5bb8[_0xd1e8('0x37')],function(_0xa408c6){var _0x11534b={};_0x11534b[_0xa408c6]={'$like':'%'+_0x58cbac[_0xd1e8('0x34')][_0xd1e8('0x3f')]+'%'};return _0x11534b;})});}_0x2a5bb8=_['merge']({},_0x2a5bb8,_0x58cbac[_0xd1e8('0x4d')]);return _0x11ade8[_0xd1e8('0x49')](_0x2a5bb8);}})['then'](function(_0x1d48c8){if(_0x1d48c8){_0x3f44bf=_0x1d48c8[_0xd1e8('0x3a')];if(!_0x58cbac['query'][_0xd1e8('0x4e')](_0xd1e8('0x3b'))){_0x2a5bb8[_0xd1e8('0x1f')]=qs['limit'](_0x58cbac[_0xd1e8('0x34')][_0xd1e8('0x1f')]);_0x2a5bb8['offset']=qs['offset'](_0x58cbac[_0xd1e8('0x34')][_0xd1e8('0x1c')]);}return _0x11ade8[_0xd1e8('0x49')](_0x2a5bb8);}})[_0xd1e8('0x27')](function(_0x13c820){if(_0x13c820){return _0x13c820?{'count':_0x3f44bf,'rows':_0x13c820}:null;}})[_0xd1e8('0x27')](respondWithResult(_0x4bedde,null))[_0xd1e8('0x45')](handleError(_0x4bedde,null));};exports[_0xd1e8('0x4f')]=function(_0x4d7824,_0x7d7ac7,_0x446da4){var _0xab6507={};var _0x794692={};var _0x79a24c;var _0x39eaea;return db[_0xd1e8('0x2e')][_0xd1e8('0x4a')]({'where':{'id':_0x4d7824[_0xd1e8('0x4b')]['id']}})[_0xd1e8('0x27')](handleEntityNotFound(_0x7d7ac7,null))[_0xd1e8('0x27')](function(_0x18c94d){if(_0x18c94d){_0x79a24c=_0x18c94d;_0x794692[_0xd1e8('0x32')]=_['keys'](db[_0xd1e8('0x4c')][_0xd1e8('0x2f')]);_0x794692[_0xd1e8('0x34')]=_['keys'](_0x4d7824[_0xd1e8('0x34')]);_0x794692[_0xd1e8('0x36')]=_[_0xd1e8('0x38')](_0x794692['model'],_0x794692[_0xd1e8('0x34')]);_0xab6507[_0xd1e8('0x37')]=_['intersection'](_0x794692['model'],qs[_0xd1e8('0x39')](_0x4d7824[_0xd1e8('0x34')][_0xd1e8('0x39')]));_0xab6507[_0xd1e8('0x37')]=_0xab6507['attributes']['length']?_0xab6507[_0xd1e8('0x37')]:_0x794692[_0xd1e8('0x32')];_0xab6507[_0xd1e8('0x3c')]=qs['sort'](_0x4d7824[_0xd1e8('0x34')]['sort']);_0xab6507[_0xd1e8('0x40')]=qs['filters'](_[_0xd1e8('0x3e')](_0x4d7824['query'],_0x794692[_0xd1e8('0x36')]));if(_0x4d7824[_0xd1e8('0x34')][_0xd1e8('0x3f')]){_0xab6507[_0xd1e8('0x40')]=_[_0xd1e8('0x41')](_0xab6507['where'],{'$or':_[_0xd1e8('0x33')](_0xab6507[_0xd1e8('0x37')],function(_0x4b5349){var _0x3aec31={};_0x3aec31[_0x4b5349]={'$like':'%'+_0x4d7824['query'][_0xd1e8('0x3f')]+'%'};return _0x3aec31;})});}_0xab6507=_['merge']({},_0xab6507,_0x4d7824['options']);return _0x79a24c[_0xd1e8('0x4f')](_0xab6507);}})[_0xd1e8('0x27')](function(_0xc4c06d){if(_0xc4c06d){_0x39eaea=_0xc4c06d['length'];if(!_0x4d7824[_0xd1e8('0x34')][_0xd1e8('0x4e')]('nolimit')){_0xab6507[_0xd1e8('0x1f')]=qs[_0xd1e8('0x1f')](_0x4d7824[_0xd1e8('0x34')][_0xd1e8('0x1f')]);_0xab6507[_0xd1e8('0x1c')]=qs[_0xd1e8('0x1c')](_0x4d7824[_0xd1e8('0x34')][_0xd1e8('0x1c')]);}return _0x79a24c[_0xd1e8('0x4f')](_0xab6507);}})[_0xd1e8('0x27')](function(_0x8357d7){if(_0x8357d7){return _0x8357d7?{'count':_0x39eaea,'rows':_0x8357d7}:null;}})[_0xd1e8('0x27')](respondWithResult(_0x7d7ac7,null))['catch'](handleError(_0x7d7ac7,null));};exports[_0xd1e8('0x50')]=function(_0x3649ff,_0x3599c8,_0x4889ed){var _0x18d8f6={};var _0x55167e={};var _0x201ff8;var _0x169238;return db[_0xd1e8('0x2e')][_0xd1e8('0x4a')]({'where':{'id':_0x3649ff['params']['id']}})[_0xd1e8('0x27')](handleEntityNotFound(_0x3599c8,null))[_0xd1e8('0x27')](function(_0x41331b){if(_0x41331b){_0x201ff8=_0x41331b;_0x55167e[_0xd1e8('0x32')]=_['keys'](db[_0xd1e8('0x4c')][_0xd1e8('0x2f')]);_0x55167e['query']=_[_0xd1e8('0x35')](_0x3649ff[_0xd1e8('0x34')]);_0x55167e[_0xd1e8('0x36')]=_[_0xd1e8('0x38')](_0x55167e[_0xd1e8('0x32')],_0x55167e[_0xd1e8('0x34')]);_0x18d8f6[_0xd1e8('0x37')]=_[_0xd1e8('0x38')](_0x55167e[_0xd1e8('0x32')],qs[_0xd1e8('0x39')](_0x3649ff[_0xd1e8('0x34')][_0xd1e8('0x39')]));_0x18d8f6['attributes']=_0x18d8f6['attributes'][_0xd1e8('0x3a')]?_0x18d8f6[_0xd1e8('0x37')]:_0x55167e[_0xd1e8('0x32')];_0x18d8f6['order']=qs['sort'](_0x3649ff[_0xd1e8('0x34')]['sort']);_0x18d8f6[_0xd1e8('0x40')]=qs[_0xd1e8('0x36')](_[_0xd1e8('0x3e')](_0x3649ff[_0xd1e8('0x34')],_0x55167e[_0xd1e8('0x36')]));if(_0x3649ff['query']['filter']){_0x18d8f6[_0xd1e8('0x40')]=_[_0xd1e8('0x41')](_0x18d8f6[_0xd1e8('0x40')],{'$or':_[_0xd1e8('0x33')](_0x18d8f6[_0xd1e8('0x37')],function(_0x4edcc5){var _0x1b88c5={};_0x1b88c5[_0x4edcc5]={'$like':'%'+_0x3649ff[_0xd1e8('0x34')][_0xd1e8('0x3f')]+'%'};return _0x1b88c5;})});}_0x18d8f6=_[_0xd1e8('0x41')]({},_0x18d8f6,_0x3649ff[_0xd1e8('0x4d')]);return _0x201ff8[_0xd1e8('0x50')](_0x18d8f6);}})[_0xd1e8('0x27')](function(_0x20134c){if(_0x20134c){_0x169238=_0x20134c[_0xd1e8('0x3a')];if(!_0x3649ff[_0xd1e8('0x34')]['hasOwnProperty']('nolimit')){_0x18d8f6['limit']=qs[_0xd1e8('0x1f')](_0x3649ff[_0xd1e8('0x34')][_0xd1e8('0x1f')]);_0x18d8f6[_0xd1e8('0x1c')]=qs['offset'](_0x3649ff[_0xd1e8('0x34')][_0xd1e8('0x1c')]);}return _0x201ff8[_0xd1e8('0x50')](_0x18d8f6);}})[_0xd1e8('0x27')](function(_0x15b5be){if(_0x15b5be){return _0x15b5be?{'count':_0x169238,'rows':_0x15b5be}:null;}})['then'](respondWithResult(_0x3599c8,null))[_0xd1e8('0x45')](handleError(_0x3599c8,null));};exports[_0xd1e8('0x51')]=function(_0x16a207,_0x59525a,_0x5e804a){var _0x178b96={};var _0x46cc88={};var _0x42be39;var _0x201e1b;return db['ZendeskConfiguration'][_0xd1e8('0x4a')]({'where':{'id':_0x16a207[_0xd1e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x59525a,null))['then'](function(_0x4810e4){if(_0x4810e4){_0x42be39=_0x4810e4;_0x46cc88[_0xd1e8('0x32')]=_[_0xd1e8('0x35')](db[_0xd1e8('0x52')][_0xd1e8('0x2f')]);_0x46cc88[_0xd1e8('0x34')]=_[_0xd1e8('0x35')](_0x16a207[_0xd1e8('0x34')]);_0x46cc88[_0xd1e8('0x36')]=_['intersection'](_0x46cc88['model'],_0x46cc88['query']);_0x178b96[_0xd1e8('0x37')]=_[_0xd1e8('0x38')](_0x46cc88[_0xd1e8('0x32')],qs['fields'](_0x16a207[_0xd1e8('0x34')]['fields']));_0x178b96[_0xd1e8('0x37')]=_0x178b96[_0xd1e8('0x37')][_0xd1e8('0x3a')]?_0x178b96[_0xd1e8('0x37')]:_0x46cc88[_0xd1e8('0x32')];_0x178b96[_0xd1e8('0x3c')]=qs[_0xd1e8('0x3d')](_0x16a207[_0xd1e8('0x34')][_0xd1e8('0x3d')]);_0x178b96[_0xd1e8('0x40')]=qs[_0xd1e8('0x36')](_[_0xd1e8('0x3e')](_0x16a207[_0xd1e8('0x34')],_0x46cc88[_0xd1e8('0x36')]));if(_0x16a207[_0xd1e8('0x34')]['filter']){_0x178b96[_0xd1e8('0x40')]=_[_0xd1e8('0x41')](_0x178b96[_0xd1e8('0x40')],{'$or':_[_0xd1e8('0x33')](_0x178b96[_0xd1e8('0x37')],function(_0x5cf3c3){var _0x56fee3={};_0x56fee3[_0x5cf3c3]={'$like':'%'+_0x16a207[_0xd1e8('0x34')][_0xd1e8('0x3f')]+'%'};return _0x56fee3;})});}_0x178b96=_[_0xd1e8('0x41')]({},_0x178b96,_0x16a207[_0xd1e8('0x4d')]);return _0x42be39[_0xd1e8('0x51')](_0x178b96);}})[_0xd1e8('0x27')](function(_0x572d61){if(_0x572d61){_0x201e1b=_0x572d61[_0xd1e8('0x3a')];if(!_0x16a207[_0xd1e8('0x34')]['hasOwnProperty'](_0xd1e8('0x3b'))){_0x178b96[_0xd1e8('0x1f')]=qs[_0xd1e8('0x1f')](_0x16a207[_0xd1e8('0x34')][_0xd1e8('0x1f')]);_0x178b96[_0xd1e8('0x1c')]=qs['offset'](_0x16a207[_0xd1e8('0x34')]['offset']);}return _0x42be39[_0xd1e8('0x51')](_0x178b96);}})[_0xd1e8('0x27')](function(_0x29d5f9){if(_0x29d5f9){return _0x29d5f9?{'count':_0x201e1b,'rows':_0x29d5f9}:null;}})['then'](respondWithResult(_0x59525a,null))[_0xd1e8('0x45')](handleError(_0x59525a,null));};exports[_0xd1e8('0x53')]=function(_0x3ab3ef,_0x3e8dda,_0x17721d){if(_0x3ab3ef[_0xd1e8('0x48')]['id']){delete _0x3ab3ef[_0xd1e8('0x48')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3ab3ef[_0xd1e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e8dda,null))['then'](function(_0x3a99b7){if(_0x3a99b7){return _0x3a99b7[_0xd1e8('0x53')](_0x3ab3ef[_0xd1e8('0x48')][_0xd1e8('0x54')]||[]);}return null;})[_0xd1e8('0x27')](respondWithResult(_0x3e8dda,null))['catch'](handleError(_0x3e8dda,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 9c8945f..5f29e94 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 _0x2032=['int_zendesk_configurations','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x374afb,_0x390b4a){var _0x65888c=function(_0x323f80){while(--_0x323f80){_0x374afb['push'](_0x374afb['shift']());}};_0x65888c(++_0x390b4a);}(_0x2032,0xd9));var _0x2203=function(_0x3edb1c,_0x290fa1){_0x3edb1c=_0x3edb1c-0x0;var _0x298453=_0x2032[_0x3edb1c];return _0x298453;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x1649fe,_0x5916da){var _0x473a67=function(_0x163cae){while(--_0x163cae){_0x1649fe['push'](_0x1649fe['shift']());}};_0x473a67(++_0x5916da);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x4fef93,_0x373fac){_0x4fef93=_0x4fef93-0x0;var _0x57ccce=_0xe1e3[_0x4fef93];return _0x57ccce;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 293f6bc..e9f8187 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 _0xbc18=['message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7c2965,_0x508b8c){var _0xfbcfb1=function(_0x573621){while(--_0x573621){_0x7c2965['push'](_0x7c2965['shift']());}};_0xfbcfb1(++_0x508b8c);}(_0xbc18,0x86));var _0x8bc1=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0xbc18[_0x3dc538];return _0x72c2fd;};'use strict';var _=require('lodash');var util=require(_0x8bc1('0x0'));var moment=require('moment');var BPromise=require(_0x8bc1('0x1'));var rs=require(_0x8bc1('0x2'));var fs=require('fs');var Redis=require(_0x8bc1('0x3'));var db=require(_0x8bc1('0x4'))['db'];var utils=require(_0x8bc1('0x5'));var logger=require(_0x8bc1('0x6'))(_0x8bc1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8bc1('0x8')][_0x8bc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf3923,_0x5a112b,_0x549f01){return new BPromise(function(_0x2e4dce,_0x3067fd){return client[_0x8bc1('0xa')](_0xf3923,_0x549f01)[_0x8bc1('0xb')](function(_0x2705cb){logger[_0x8bc1('0xc')](_0x8bc1('0xd'),_0x5a112b,_0x8bc1('0xe'));logger[_0x8bc1('0xf')](_0x8bc1('0x10'),_0x5a112b,'request\x20sent',JSON[_0x8bc1('0x11')](_0x2705cb));if(_0x2705cb[_0x8bc1('0x12')]){if(_0x2705cb[_0x8bc1('0x12')][_0x8bc1('0x13')]===0x1f4){logger[_0x8bc1('0x12')](_0x8bc1('0xd'),_0x5a112b,_0x2705cb[_0x8bc1('0x12')]['message']);return _0x3067fd(_0x2705cb[_0x8bc1('0x12')]['message']);}logger[_0x8bc1('0x12')](_0x8bc1('0xd'),_0x5a112b,_0x2705cb[_0x8bc1('0x12')][_0x8bc1('0x14')]);return _0x2e4dce(_0x2705cb[_0x8bc1('0x12')][_0x8bc1('0x14')]);}else{logger[_0x8bc1('0xc')](_0x8bc1('0xd'),_0x5a112b,'request\x20sent');_0x2e4dce(_0x2705cb['result'][_0x8bc1('0x14')]);}})[_0x8bc1('0x15')](function(_0x249088){logger[_0x8bc1('0x12')](_0x8bc1('0xd'),_0x5a112b,_0x249088);_0x3067fd(_0x249088);});});} \ No newline at end of file +var _0x36a5=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util'];(function(_0x52c223,_0x3c932e){var _0x1d91c7=function(_0x302eb5){while(--_0x302eb5){_0x52c223['push'](_0x52c223['shift']());}};_0x1d91c7(++_0x3c932e);}(_0x36a5,0x166));var _0x536a=function(_0xd36783,_0x171d43){_0xd36783=_0xd36783-0x0;var _0x241e50=_0x36a5[_0xd36783];return _0x241e50;};'use strict';var _=require(_0x536a('0x0'));var util=require(_0x536a('0x1'));var moment=require(_0x536a('0x2'));var BPromise=require(_0x536a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x536a('0x4'));var db=require(_0x536a('0x5'))['db'];var utils=require(_0x536a('0x6'));var logger=require(_0x536a('0x7'))(_0x536a('0x8'));var config=require('../../config/environment');var jayson=require(_0x536a('0x9'));var client=jayson['client'][_0x536a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26c8cf,_0x23e33c,_0x3246c7){return new BPromise(function(_0x27dedc,_0x2b725d){return client['request'](_0x26c8cf,_0x3246c7)[_0x536a('0xb')](function(_0x75e5bd){logger[_0x536a('0xc')](_0x536a('0xd'),_0x23e33c,_0x536a('0xe'));logger[_0x536a('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x23e33c,_0x536a('0xe'),JSON[_0x536a('0x10')](_0x75e5bd));if(_0x75e5bd[_0x536a('0x11')]){if(_0x75e5bd[_0x536a('0x11')]['code']===0x1f4){logger[_0x536a('0x11')](_0x536a('0xd'),_0x23e33c,_0x75e5bd[_0x536a('0x11')][_0x536a('0x12')]);return _0x2b725d(_0x75e5bd[_0x536a('0x11')][_0x536a('0x12')]);}logger[_0x536a('0x11')](_0x536a('0xd'),_0x23e33c,_0x75e5bd[_0x536a('0x11')][_0x536a('0x12')]);return _0x27dedc(_0x75e5bd['error'][_0x536a('0x12')]);}else{logger[_0x536a('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x23e33c,_0x536a('0xe'));_0x27dedc(_0x75e5bd[_0x536a('0x13')]['message']);}})['catch'](function(_0x5dcdd1){logger[_0x536a('0x11')](_0x536a('0xd'),_0x23e33c,_0x5dcdd1);_0x2b725d(_0x5dcdd1);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index be385f5..1c3179a 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 _0x11d5=['express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','path'];(function(_0x11536c,_0x5dd752){var _0x14cb23=function(_0x171a9c){while(--_0x171a9c){_0x11536c['push'](_0x11536c['shift']());}};_0x14cb23(++_0x5dd752);}(_0x11d5,0xde));var _0x511d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x11d5[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x511d('0x0'));var util=require('util');var path=require(_0x511d('0x1'));var timeout=require('connect-timeout');var express=require(_0x511d('0x2'));var router=express[_0x511d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x511d('0x4'));var interaction=require(_0x511d('0x5'));var config=require('../../config/environment');var controller=require(_0x511d('0x6'));router[_0x511d('0x7')]('/',auth[_0x511d('0x8')](),controller['index']);router[_0x511d('0x7')](_0x511d('0x9'),auth[_0x511d('0x8')](),controller[_0x511d('0xa')]);router[_0x511d('0xb')]('/',auth[_0x511d('0x8')](),controller['create']);router['put'](_0x511d('0x9'),auth[_0x511d('0x8')](),controller[_0x511d('0xc')]);router[_0x511d('0xd')]('/:id',auth[_0x511d('0x8')](),controller[_0x511d('0xe')]);module[_0x511d('0xf')]=router; \ No newline at end of file +var _0x82ff=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','get','/:id','show','post','create','put'];(function(_0x1ed704,_0x20d261){var _0x50829d=function(_0x2ad87b){while(--_0x2ad87b){_0x1ed704['push'](_0x1ed704['shift']());}};_0x50829d(++_0x20d261);}(_0x82ff,0x11c));var _0xf82f=function(_0x488a6d,_0x20b0f0){_0x488a6d=_0x488a6d-0x0;var _0xf15838=_0x82ff[_0x488a6d];return _0xf15838;};'use strict';var multer=require('multer');var util=require(_0xf82f('0x0'));var path=require('path');var timeout=require(_0xf82f('0x1'));var express=require(_0xf82f('0x2'));var router=express[_0xf82f('0x3')]();var fs_extra=require(_0xf82f('0x4'));var auth=require(_0xf82f('0x5'));var interaction=require(_0xf82f('0x6'));var config=require(_0xf82f('0x7'));var controller=require(_0xf82f('0x8'));router['get']('/',auth[_0xf82f('0x9')](),controller['index']);router[_0xf82f('0xa')](_0xf82f('0xb'),auth[_0xf82f('0x9')](),controller[_0xf82f('0xc')]);router[_0xf82f('0xd')]('/',auth[_0xf82f('0x9')](),controller[_0xf82f('0xe')]);router[_0xf82f('0xf')](_0xf82f('0xb'),auth[_0xf82f('0x9')](),controller[_0xf82f('0x10')]);router[_0xf82f('0x11')](_0xf82f('0xb'),auth[_0xf82f('0x9')](),controller[_0xf82f('0x12')]);module[_0xf82f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 85037b2..4923b84 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 _0x6700=['variable','keyValue','picklist','string','STRING','customVariable','BOOLEAN','ENUM'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x6700,0x167));var _0x0670=function(_0x3ecb48,_0x5631bf){_0x3ecb48=_0x3ecb48-0x0;var _0x2f14fa=_0x6700[_0x3ecb48];return _0x2f14fa;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0670('0x0')]('string',_0x0670('0x1'),'customVariable',_0x0670('0x2'),_0x0670('0x3')),'defaultValue':_0x0670('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0670('0x5')]},'keyType':{'type':Sequelize[_0x0670('0x0')](_0x0670('0x4'),_0x0670('0x1'),_0x0670('0x6'))},'keyContent':{'type':Sequelize[_0x0670('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0670('0x5')]},'customField':{'type':Sequelize[_0x0670('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0670('0x5')]}}; \ No newline at end of file +var _0xf69c=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf69c,0x132));var _0xcf69=function(_0x15e0f2,_0x6cedd7){_0x15e0f2=_0x15e0f2-0x0;var _0x4fe6a8=_0xf69c[_0x15e0f2];return _0x4fe6a8;};'use strict';var Sequelize=require(_0xcf69('0x0'));module[_0xcf69('0x1')]={'type':{'type':Sequelize[_0xcf69('0x2')](_0xcf69('0x3'),_0xcf69('0x4'),_0xcf69('0x5'),_0xcf69('0x6'),_0xcf69('0x7')),'defaultValue':_0xcf69('0x3')},'content':{'type':Sequelize[_0xcf69('0x8')]},'key':{'type':Sequelize[_0xcf69('0x8')]},'keyType':{'type':Sequelize[_0xcf69('0x2')]('string',_0xcf69('0x4'),_0xcf69('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xcf69('0x8')]},'nameField':{'type':Sequelize[_0xcf69('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'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 e6cfd57..da44e03 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 _0xfa5d=['limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZendeskField','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','include','catch','show','includeAll','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','count'];(function(_0x18c84a,_0x58670b){var _0x1b6f46=function(_0x491d2a){while(--_0x491d2a){_0x18c84a['push'](_0x18c84a['shift']());}};_0x1b6f46(++_0x58670b);}(_0xfa5d,0x152));var _0xdfa5=function(_0x4d8217,_0x43f574){_0x4d8217=_0x4d8217-0x0;var _0x129569=_0xfa5d[_0x4d8217];return _0x129569;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfa5('0x0'));var zipdir=require(_0xdfa5('0x1'));var jsonpatch=require(_0xdfa5('0x2'));var rp=require(_0xdfa5('0x3'));var moment=require(_0xdfa5('0x4'));var BPromise=require(_0xdfa5('0x5'));var Mustache=require(_0xdfa5('0x6'));var util=require(_0xdfa5('0x7'));var path=require(_0xdfa5('0x8'));var sox=require(_0xdfa5('0x9'));var csv=require(_0xdfa5('0xa'));var ejs=require(_0xdfa5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfa5('0xc'));var squel=require(_0xdfa5('0xd'));var crypto=require(_0xdfa5('0xe'));var jsforce=require(_0xdfa5('0xf'));var deskjs=require(_0xdfa5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdfa5('0x11'));var Papa=require(_0xdfa5('0x12'));var Redis=require(_0xdfa5('0x13'));var authService=require(_0xdfa5('0x14'));var qs=require(_0xdfa5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfa5('0x16'));var logger=require('../../config/logger')(_0xdfa5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdfa5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2917e9,_0x4dc7cd){_0x4dc7cd=_0x4dc7cd||0xcc;return function(_0x5cc173){if(_0x5cc173){return _0x2917e9[_0xdfa5('0x19')](_0x4dc7cd);}return _0x2917e9['status'](_0x4dc7cd)[_0xdfa5('0x1a')]();};}function respondWithResult(_0x29d498,_0x1ee4f7){_0x1ee4f7=_0x1ee4f7||0xc8;return function(_0x3ab2fa){if(_0x3ab2fa){return _0x29d498[_0xdfa5('0x1b')](_0x1ee4f7)[_0xdfa5('0x1c')](_0x3ab2fa);}};}function respondWithFilteredResult(_0x30f0ca,_0x49cf70){return function(_0x36b338){if(_0x36b338){var _0x3143b8=typeof _0x49cf70[_0xdfa5('0x1d')]===_0xdfa5('0x1e')&&typeof _0x49cf70['limit']==='undefined';var _0x42c9da=_0x36b338[_0xdfa5('0x1f')];var _0x5b8810=_0x3143b8?0x0:_0x49cf70[_0xdfa5('0x1d')];var _0x1d5c47=_0x3143b8?_0x36b338['count']:_0x49cf70['offset']+_0x49cf70[_0xdfa5('0x20')];var _0x303283;if(_0x1d5c47>=_0x42c9da){_0x1d5c47=_0x42c9da;_0x303283=0xc8;}else{_0x303283=0xce;}_0x30f0ca[_0xdfa5('0x1b')](_0x303283);return _0x30f0ca[_0xdfa5('0x21')](_0xdfa5('0x22'),_0x5b8810+'-'+_0x1d5c47+'/'+_0x42c9da)[_0xdfa5('0x1c')](_0x36b338);}return null;};}function patchUpdates(_0xd67f72){return function(_0x138736){try{jsonpatch[_0xdfa5('0x23')](_0x138736,_0xd67f72,!![]);}catch(_0xc164ea){return BPromise[_0xdfa5('0x24')](_0xc164ea);}return _0x138736[_0xdfa5('0x25')]();};}function saveUpdates(_0x1f6c19,_0x21a441){return function(_0x3cff05){if(_0x3cff05){return _0x3cff05['update'](_0x1f6c19)[_0xdfa5('0x26')](function(_0x244eb5){return _0x244eb5;});}return null;};}function removeEntity(_0x19826a,_0x1b9d6d){return function(_0x4d5b66){if(_0x4d5b66){return _0x4d5b66[_0xdfa5('0x27')]()[_0xdfa5('0x26')](function(){_0x19826a[_0xdfa5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d0ca9,_0x1a4873){return function(_0x3ba123){if(!_0x3ba123){_0x4d0ca9[_0xdfa5('0x19')](0x194);}return _0x3ba123;};}function handleError(_0xb41eef,_0x5ca104){_0x5ca104=_0x5ca104||0x1f4;return function(_0xdbb720){logger[_0xdfa5('0x28')](_0xdbb720[_0xdfa5('0x29')]);if(_0xdbb720[_0xdfa5('0x2a')]){delete _0xdbb720[_0xdfa5('0x2a')];}_0xb41eef[_0xdfa5('0x1b')](_0x5ca104)[_0xdfa5('0x2b')](_0xdbb720);};}exports[_0xdfa5('0x2c')]=function(_0x4d49a9,_0x320256){var _0x23429f={},_0x55fdf6={},_0x48e28a={'count':0x0,'rows':[]};var _0x5c6e6e=_[_0xdfa5('0x2d')](db[_0xdfa5('0x2e')]['rawAttributes'],function(_0x54114c){return{'name':_0x54114c[_0xdfa5('0x2f')],'type':_0x54114c['type'][_0xdfa5('0x30')]};});_0x55fdf6[_0xdfa5('0x31')]=_[_0xdfa5('0x2d')](_0x5c6e6e,_0xdfa5('0x2a'));_0x55fdf6['query']=_[_0xdfa5('0x32')](_0x4d49a9[_0xdfa5('0x33')]);_0x55fdf6[_0xdfa5('0x34')]=_[_0xdfa5('0x35')](_0x55fdf6[_0xdfa5('0x31')],_0x55fdf6['query']);_0x23429f[_0xdfa5('0x36')]=_[_0xdfa5('0x35')](_0x55fdf6[_0xdfa5('0x31')],qs[_0xdfa5('0x37')](_0x4d49a9[_0xdfa5('0x33')]['fields']));_0x23429f[_0xdfa5('0x36')]=_0x23429f[_0xdfa5('0x36')][_0xdfa5('0x38')]?_0x23429f[_0xdfa5('0x36')]:_0x55fdf6[_0xdfa5('0x31')];if(!_0x4d49a9[_0xdfa5('0x33')]['hasOwnProperty']('nolimit')){_0x23429f[_0xdfa5('0x20')]=qs[_0xdfa5('0x20')](_0x4d49a9[_0xdfa5('0x33')][_0xdfa5('0x20')]);_0x23429f[_0xdfa5('0x1d')]=qs[_0xdfa5('0x1d')](_0x4d49a9['query'][_0xdfa5('0x1d')]);}_0x23429f['order']=qs['sort'](_0x4d49a9['query'][_0xdfa5('0x39')]);_0x23429f[_0xdfa5('0x3a')]=qs[_0xdfa5('0x34')](_[_0xdfa5('0x3b')](_0x4d49a9[_0xdfa5('0x33')],_0x55fdf6[_0xdfa5('0x34')]),_0x5c6e6e);if(_0x4d49a9[_0xdfa5('0x33')][_0xdfa5('0x3c')]){_0x23429f['where']=_[_0xdfa5('0x3d')](_0x23429f[_0xdfa5('0x3a')],{'$or':_[_0xdfa5('0x2d')](_0x5c6e6e,function(_0x51809b){if(_0x51809b[_0xdfa5('0x3e')]!==_0xdfa5('0x3f')){var _0x1c158a={};_0x1c158a[_0x51809b[_0xdfa5('0x2a')]]={'$like':'%'+_0x4d49a9[_0xdfa5('0x33')][_0xdfa5('0x3c')]+'%'};return _0x1c158a;}})});}_0x23429f=_[_0xdfa5('0x3d')]({},_0x23429f,_0x4d49a9[_0xdfa5('0x40')]);var _0x5a754d={'where':_0x23429f[_0xdfa5('0x3a')]};return db[_0xdfa5('0x2e')][_0xdfa5('0x1f')](_0x5a754d)[_0xdfa5('0x26')](function(_0x11a0ee){_0x48e28a[_0xdfa5('0x1f')]=_0x11a0ee;if(_0x4d49a9[_0xdfa5('0x33')]['includeAll']){_0x23429f[_0xdfa5('0x41')]=[{'all':!![]}];}return db[_0xdfa5('0x2e')]['findAll'](_0x23429f);})[_0xdfa5('0x26')](function(_0x265863){_0x48e28a['rows']=_0x265863;return _0x48e28a;})[_0xdfa5('0x26')](respondWithFilteredResult(_0x320256,_0x23429f))[_0xdfa5('0x42')](handleError(_0x320256,null));};exports[_0xdfa5('0x43')]=function(_0x3b00f0,_0x143a30){var _0x229e8d={'raw':!![],'where':{'id':_0x3b00f0['params']['id']}},_0xb1c9bc={};_0xb1c9bc[_0xdfa5('0x31')]=_[_0xdfa5('0x32')](db[_0xdfa5('0x2e')]['rawAttributes']);_0xb1c9bc['query']=_[_0xdfa5('0x32')](_0x3b00f0[_0xdfa5('0x33')]);_0xb1c9bc[_0xdfa5('0x34')]=_[_0xdfa5('0x35')](_0xb1c9bc[_0xdfa5('0x31')],_0xb1c9bc[_0xdfa5('0x33')]);_0x229e8d[_0xdfa5('0x36')]=_[_0xdfa5('0x35')](_0xb1c9bc[_0xdfa5('0x31')],qs[_0xdfa5('0x37')](_0x3b00f0[_0xdfa5('0x33')][_0xdfa5('0x37')]));_0x229e8d[_0xdfa5('0x36')]=_0x229e8d['attributes'][_0xdfa5('0x38')]?_0x229e8d[_0xdfa5('0x36')]:_0xb1c9bc[_0xdfa5('0x31')];if(_0x3b00f0['query'][_0xdfa5('0x44')]){_0x229e8d['include']=[{'all':!![]}];}_0x229e8d=_[_0xdfa5('0x3d')]({},_0x229e8d,_0x3b00f0[_0xdfa5('0x40')]);return db[_0xdfa5('0x2e')][_0xdfa5('0x45')](_0x229e8d)[_0xdfa5('0x26')](handleEntityNotFound(_0x143a30,null))[_0xdfa5('0x26')](respondWithResult(_0x143a30,null))[_0xdfa5('0x42')](handleError(_0x143a30,null));};exports[_0xdfa5('0x46')]=function(_0x2ccee5,_0x41c416){return db['ZendeskField']['create'](_0x2ccee5[_0xdfa5('0x47')],{})[_0xdfa5('0x26')](respondWithResult(_0x41c416,0xc9))[_0xdfa5('0x42')](handleError(_0x41c416,null));};exports[_0xdfa5('0x48')]=function(_0x2d9ea1,_0x43d3b4){if(_0x2d9ea1[_0xdfa5('0x47')]['id']){delete _0x2d9ea1['body']['id'];}return db[_0xdfa5('0x2e')][_0xdfa5('0x45')]({'where':{'id':_0x2d9ea1[_0xdfa5('0x49')]['id']}})[_0xdfa5('0x26')](handleEntityNotFound(_0x43d3b4,null))['then'](saveUpdates(_0x2d9ea1[_0xdfa5('0x47')],null))[_0xdfa5('0x26')](respondWithResult(_0x43d3b4,null))[_0xdfa5('0x42')](handleError(_0x43d3b4,null));};exports['destroy']=function(_0xfc7ef5,_0x4d1b18){return db[_0xdfa5('0x2e')][_0xdfa5('0x45')]({'where':{'id':_0xfc7ef5[_0xdfa5('0x49')]['id']}})[_0xdfa5('0x26')](handleEntityNotFound(_0x4d1b18,null))[_0xdfa5('0x26')](removeEntity(_0x4d1b18,null))[_0xdfa5('0x42')](handleError(_0x4d1b18,null));}; \ No newline at end of file +var _0x82f4=['filters','filter','merge','VIRTUAL','options','ZendeskField','include','findAll','rows','catch','params','keys','length','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','end','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','where','pick'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x82f4,0xed));var _0x482f=function(_0x1e2ccf,_0x367b8b){_0x1e2ccf=_0x1e2ccf-0x0;var _0x1c4080=_0x82f4[_0x1e2ccf];return _0x1c4080;};'use strict';var emlformat=require(_0x482f('0x0'));var rimraf=require(_0x482f('0x1'));var zipdir=require(_0x482f('0x2'));var jsonpatch=require(_0x482f('0x3'));var rp=require(_0x482f('0x4'));var moment=require(_0x482f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x482f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x482f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x482f('0x8'));var _=require(_0x482f('0x9'));var squel=require('squel');var crypto=require(_0x482f('0xa'));var jsforce=require(_0x482f('0xb'));var deskjs=require(_0x482f('0xc'));var toCsv=require(_0x482f('0xd'));var querystring=require(_0x482f('0xe'));var Papa=require(_0x482f('0xf'));var Redis=require(_0x482f('0x10'));var authService=require(_0x482f('0x11'));var qs=require(_0x482f('0x12'));var as=require(_0x482f('0x13'));var hardwareService=require(_0x482f('0x14'));var logger=require(_0x482f('0x15'))(_0x482f('0x16'));var utils=require(_0x482f('0x17'));var config=require(_0x482f('0x18'));var licenseUtil=require(_0x482f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d9807,_0x16a04b){_0x16a04b=_0x16a04b||0xcc;return function(_0x296d99){if(_0x296d99){return _0x4d9807[_0x482f('0x1a')](_0x16a04b);}return _0x4d9807[_0x482f('0x1b')](_0x16a04b)['end']();};}function respondWithResult(_0x4a9714,_0x189f6c){_0x189f6c=_0x189f6c||0xc8;return function(_0x1de64a){if(_0x1de64a){return _0x4a9714[_0x482f('0x1b')](_0x189f6c)[_0x482f('0x1c')](_0x1de64a);}};}function respondWithFilteredResult(_0x3d1564,_0x477de9){return function(_0x2c7048){if(_0x2c7048){var _0x1343f8=typeof _0x477de9['offset']===_0x482f('0x1d')&&typeof _0x477de9[_0x482f('0x1e')]===_0x482f('0x1d');var _0x517986=_0x2c7048[_0x482f('0x1f')];var _0x1147e0=_0x1343f8?0x0:_0x477de9[_0x482f('0x20')];var _0x1e9182=_0x1343f8?_0x2c7048['count']:_0x477de9[_0x482f('0x20')]+_0x477de9['limit'];var _0x2c5980;if(_0x1e9182>=_0x517986){_0x1e9182=_0x517986;_0x2c5980=0xc8;}else{_0x2c5980=0xce;}_0x3d1564['status'](_0x2c5980);return _0x3d1564['set'](_0x482f('0x21'),_0x1147e0+'-'+_0x1e9182+'/'+_0x517986)[_0x482f('0x1c')](_0x2c7048);}return null;};}function patchUpdates(_0x4d5366){return function(_0x9b65ad){try{jsonpatch['apply'](_0x9b65ad,_0x4d5366,!![]);}catch(_0x28d09a){return BPromise[_0x482f('0x22')](_0x28d09a);}return _0x9b65ad[_0x482f('0x23')]();};}function saveUpdates(_0x2ecdde,_0x4c0d00){return function(_0x348b13){if(_0x348b13){return _0x348b13[_0x482f('0x24')](_0x2ecdde)[_0x482f('0x25')](function(_0x17cb7e){return _0x17cb7e;});}return null;};}function removeEntity(_0x3f3c38,_0x2364a6){return function(_0x11b6bb){if(_0x11b6bb){return _0x11b6bb['destroy']()[_0x482f('0x25')](function(){_0x3f3c38[_0x482f('0x1b')](0xcc)[_0x482f('0x26')]();});}};}function handleEntityNotFound(_0x571e2b,_0x316a38){return function(_0x5a21cf){if(!_0x5a21cf){_0x571e2b['sendStatus'](0x194);}return _0x5a21cf;};}function handleError(_0x121a1a,_0x1aea32){_0x1aea32=_0x1aea32||0x1f4;return function(_0x1affa5){logger['error'](_0x1affa5['stack']);if(_0x1affa5[_0x482f('0x27')]){delete _0x1affa5[_0x482f('0x27')];}_0x121a1a['status'](_0x1aea32)[_0x482f('0x28')](_0x1affa5);};}exports[_0x482f('0x29')]=function(_0x388cbb,_0x41583e){var _0x804982={},_0x355c04={},_0x2c9e3b={'count':0x0,'rows':[]};var _0x95e166=_[_0x482f('0x2a')](db['ZendeskField'][_0x482f('0x2b')],function(_0x1984d2){return{'name':_0x1984d2['fieldName'],'type':_0x1984d2[_0x482f('0x2c')][_0x482f('0x2d')]};});_0x355c04[_0x482f('0x2e')]=_[_0x482f('0x2a')](_0x95e166,'name');_0x355c04[_0x482f('0x2f')]=_['keys'](_0x388cbb[_0x482f('0x2f')]);_0x355c04['filters']=_[_0x482f('0x30')](_0x355c04['model'],_0x355c04[_0x482f('0x2f')]);_0x804982[_0x482f('0x31')]=_['intersection'](_0x355c04[_0x482f('0x2e')],qs[_0x482f('0x32')](_0x388cbb[_0x482f('0x2f')][_0x482f('0x32')]));_0x804982[_0x482f('0x31')]=_0x804982['attributes']['length']?_0x804982[_0x482f('0x31')]:_0x355c04[_0x482f('0x2e')];if(!_0x388cbb[_0x482f('0x2f')][_0x482f('0x33')]('nolimit')){_0x804982['limit']=qs[_0x482f('0x1e')](_0x388cbb[_0x482f('0x2f')][_0x482f('0x1e')]);_0x804982[_0x482f('0x20')]=qs[_0x482f('0x20')](_0x388cbb[_0x482f('0x2f')][_0x482f('0x20')]);}_0x804982[_0x482f('0x34')]=qs['sort'](_0x388cbb[_0x482f('0x2f')]['sort']);_0x804982[_0x482f('0x35')]=qs['filters'](_[_0x482f('0x36')](_0x388cbb[_0x482f('0x2f')],_0x355c04[_0x482f('0x37')]),_0x95e166);if(_0x388cbb[_0x482f('0x2f')][_0x482f('0x38')]){_0x804982[_0x482f('0x35')]=_[_0x482f('0x39')](_0x804982[_0x482f('0x35')],{'$or':_['map'](_0x95e166,function(_0x446e97){if(_0x446e97['type']!==_0x482f('0x3a')){var _0x42b7dd={};_0x42b7dd[_0x446e97['name']]={'$like':'%'+_0x388cbb[_0x482f('0x2f')][_0x482f('0x38')]+'%'};return _0x42b7dd;}})});}_0x804982=_[_0x482f('0x39')]({},_0x804982,_0x388cbb[_0x482f('0x3b')]);var _0x1091f7={'where':_0x804982['where']};return db[_0x482f('0x3c')]['count'](_0x1091f7)[_0x482f('0x25')](function(_0x2478bf){_0x2c9e3b[_0x482f('0x1f')]=_0x2478bf;if(_0x388cbb['query']['includeAll']){_0x804982[_0x482f('0x3d')]=[{'all':!![]}];}return db[_0x482f('0x3c')][_0x482f('0x3e')](_0x804982);})[_0x482f('0x25')](function(_0x14f3ec){_0x2c9e3b[_0x482f('0x3f')]=_0x14f3ec;return _0x2c9e3b;})[_0x482f('0x25')](respondWithFilteredResult(_0x41583e,_0x804982))[_0x482f('0x40')](handleError(_0x41583e,null));};exports['show']=function(_0x2d691e,_0x1e2601){var _0x2aa307={'raw':!![],'where':{'id':_0x2d691e[_0x482f('0x41')]['id']}},_0x5a3192={};_0x5a3192[_0x482f('0x2e')]=_[_0x482f('0x42')](db[_0x482f('0x3c')]['rawAttributes']);_0x5a3192[_0x482f('0x2f')]=_[_0x482f('0x42')](_0x2d691e['query']);_0x5a3192[_0x482f('0x37')]=_['intersection'](_0x5a3192['model'],_0x5a3192[_0x482f('0x2f')]);_0x2aa307[_0x482f('0x31')]=_[_0x482f('0x30')](_0x5a3192[_0x482f('0x2e')],qs['fields'](_0x2d691e[_0x482f('0x2f')][_0x482f('0x32')]));_0x2aa307[_0x482f('0x31')]=_0x2aa307[_0x482f('0x31')][_0x482f('0x43')]?_0x2aa307[_0x482f('0x31')]:_0x5a3192[_0x482f('0x2e')];if(_0x2d691e[_0x482f('0x2f')][_0x482f('0x44')]){_0x2aa307[_0x482f('0x3d')]=[{'all':!![]}];}_0x2aa307=_[_0x482f('0x39')]({},_0x2aa307,_0x2d691e['options']);return db[_0x482f('0x3c')]['find'](_0x2aa307)[_0x482f('0x25')](handleEntityNotFound(_0x1e2601,null))['then'](respondWithResult(_0x1e2601,null))['catch'](handleError(_0x1e2601,null));};exports[_0x482f('0x45')]=function(_0x4b4432,_0x5475bb){return db[_0x482f('0x3c')]['create'](_0x4b4432[_0x482f('0x46')],{})[_0x482f('0x25')](respondWithResult(_0x5475bb,0xc9))[_0x482f('0x40')](handleError(_0x5475bb,null));};exports['update']=function(_0x2ca748,_0x5370d7){if(_0x2ca748[_0x482f('0x46')]['id']){delete _0x2ca748[_0x482f('0x46')]['id'];}return db['ZendeskField'][_0x482f('0x47')]({'where':{'id':_0x2ca748[_0x482f('0x41')]['id']}})[_0x482f('0x25')](handleEntityNotFound(_0x5370d7,null))[_0x482f('0x25')](saveUpdates(_0x2ca748[_0x482f('0x46')],null))[_0x482f('0x25')](respondWithResult(_0x5370d7,null))[_0x482f('0x40')](handleError(_0x5370d7,null));};exports[_0x482f('0x48')]=function(_0x4fb828,_0x5527cf){return db[_0x482f('0x3c')][_0x482f('0x47')]({'where':{'id':_0x4fb828[_0x482f('0x41')]['id']}})[_0x482f('0x25')](handleEntityNotFound(_0x5527cf,null))[_0x482f('0x25')](removeEntity(_0x5527cf,null))['catch'](handleError(_0x5527cf,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index db9d8a2..8091039 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 _0x59b0=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x59b0,0x114));var _0x059b=function(_0x4ebdf4,_0x57d47f){_0x4ebdf4=_0x4ebdf4-0x0;var _0x18d1c1=_0x59b0[_0x4ebdf4];return _0x18d1c1;};'use strict';var _=require(_0x059b('0x0'));var util=require(_0x059b('0x1'));var logger=require(_0x059b('0x2'))(_0x059b('0x3'));var moment=require('moment');var BPromise=require(_0x059b('0x4'));var rp=require(_0x059b('0x5'));var fs=require('fs');var path=require(_0x059b('0x6'));var rimraf=require(_0x059b('0x7'));var config=require(_0x059b('0x8'));var attributes=require(_0x059b('0x9'));module['exports']=function(_0x3812cd,_0x122f08){return _0x3812cd['define']('ZendeskField',attributes,{'tableName':_0x059b('0xa'),'paranoid':![],'indexes':[{'name':_0x059b('0xb'),'fields':[_0x059b('0xc'),_0x059b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeeac=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xeeac,0x13c));var _0xceea=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xeeac[_0x176329];return _0x31997c;};'use strict';var _=require(_0xceea('0x0'));var util=require(_0xceea('0x1'));var logger=require(_0xceea('0x2'))(_0xceea('0x3'));var moment=require(_0xceea('0x4'));var BPromise=require(_0xceea('0x5'));var rp=require(_0xceea('0x6'));var fs=require('fs');var path=require(_0xceea('0x7'));var rimraf=require(_0xceea('0x8'));var config=require(_0xceea('0x9'));var attributes=require(_0xceea('0xa'));module[_0xceea('0xb')]=function(_0x3c94a7,_0x2ff0c3){return _0x3c94a7['define']('ZendeskField',attributes,{'tableName':_0xceea('0xc'),'paranoid':![],'indexes':[{'name':_0xceea('0xd'),'fields':['idField',_0xceea('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 5a79568..0cbe07e 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 _0xa255=['request','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x43ff49,_0x1efbd2){var _0x125785=function(_0x2479d6){while(--_0x2479d6){_0x43ff49['push'](_0x43ff49['shift']());}};_0x125785(++_0x1efbd2);}(_0xa255,0x109));var _0x5a25=function(_0x6fa74c,_0x1ebc8b){_0x6fa74c=_0x6fa74c-0x0;var _0x22d795=_0xa255[_0x6fa74c];return _0x22d795;};'use strict';var _=require('lodash');var util=require(_0x5a25('0x0'));var moment=require(_0x5a25('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a25('0x2'))['db'];var utils=require(_0x5a25('0x3'));var logger=require(_0x5a25('0x4'))(_0x5a25('0x5'));var config=require(_0x5a25('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f68ca,_0x5bc02a,_0x5231e9){return new BPromise(function(_0x171236,_0x304bc6){return client[_0x5a25('0x7')](_0x1f68ca,_0x5231e9)['then'](function(_0x6a0ebe){logger[_0x5a25('0x8')](_0x5a25('0x9'),_0x5bc02a,'request\x20sent');logger[_0x5a25('0xa')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5bc02a,_0x5a25('0xb'),JSON[_0x5a25('0xc')](_0x6a0ebe));if(_0x6a0ebe[_0x5a25('0xd')]){if(_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xe')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x5bc02a,_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xf')]);return _0x304bc6(_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xf')]);}logger[_0x5a25('0xd')]('ZendeskField,\x20%s,\x20%s',_0x5bc02a,_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xf')]);return _0x171236(_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xf')]);}else{logger['info'](_0x5a25('0x9'),_0x5bc02a,_0x5a25('0xb'));_0x171236(_0x6a0ebe['result'][_0x5a25('0xf')]);}})[_0x5a25('0x10')](function(_0x1022d6){logger[_0x5a25('0xd')](_0x5a25('0x9'),_0x5bc02a,_0x1022d6);_0x304bc6(_0x1022d6);});});} \ No newline at end of file +var _0x99b3=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','ZendeskField,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x2c4820,_0x3f6ee4){var _0x2669c2=function(_0x4feeb6){while(--_0x4feeb6){_0x2c4820['push'](_0x2c4820['shift']());}};_0x2669c2(++_0x3f6ee4);}(_0x99b3,0x137));var _0x399b=function(_0x42bd52,_0x54433e){_0x42bd52=_0x42bd52-0x0;var _0x2ef3d1=_0x99b3[_0x42bd52];return _0x2ef3d1;};'use strict';var _=require(_0x399b('0x0'));var util=require(_0x399b('0x1'));var moment=require(_0x399b('0x2'));var BPromise=require(_0x399b('0x3'));var rs=require(_0x399b('0x4'));var fs=require('fs');var Redis=require(_0x399b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x399b('0x6'));var logger=require(_0x399b('0x7'))(_0x399b('0x8'));var config=require('../../config/environment');var jayson=require(_0x399b('0x9'));var client=jayson[_0x399b('0xa')][_0x399b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e1c71,_0x404ae2,_0x1251bf){return new BPromise(function(_0x203455,_0xf4ba15){return client[_0x399b('0xc')](_0x4e1c71,_0x1251bf)[_0x399b('0xd')](function(_0x2f8afb){logger['info']('ZendeskField,\x20%s,\x20%s',_0x404ae2,_0x399b('0xe'));logger[_0x399b('0xf')](_0x399b('0x10'),_0x404ae2,_0x399b('0xe'),JSON['stringify'](_0x2f8afb));if(_0x2f8afb[_0x399b('0x11')]){if(_0x2f8afb[_0x399b('0x11')][_0x399b('0x12')]===0x1f4){logger[_0x399b('0x11')](_0x399b('0x13'),_0x404ae2,_0x2f8afb['error'][_0x399b('0x14')]);return _0xf4ba15(_0x2f8afb[_0x399b('0x11')][_0x399b('0x14')]);}logger[_0x399b('0x11')]('ZendeskField,\x20%s,\x20%s',_0x404ae2,_0x2f8afb['error'][_0x399b('0x14')]);return _0x203455(_0x2f8afb[_0x399b('0x11')][_0x399b('0x14')]);}else{logger[_0x399b('0x15')]('ZendeskField,\x20%s,\x20%s',_0x404ae2,_0x399b('0xe'));_0x203455(_0x2f8afb[_0x399b('0x16')][_0x399b('0x14')]);}})[_0x399b('0x17')](function(_0x54704a){logger[_0x399b('0x11')](_0x399b('0x13'),_0x404ae2,_0x54704a);_0xf4ba15(_0x54704a);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index d8d15fc..bc84c61 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 _0x0ef7=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x34eebc,_0x3b84f9){var _0x2cda7a=function(_0xedc345){while(--_0xedc345){_0x34eebc['push'](_0x34eebc['shift']());}};_0x2cda7a(++_0x3b84f9);}(_0x0ef7,0x115));var _0x70ef=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x0ef7[_0x26da89];return _0xc95b7b;};'use strict';var multer=require(_0x70ef('0x0'));var util=require(_0x70ef('0x1'));var path=require(_0x70ef('0x2'));var timeout=require('connect-timeout');var express=require(_0x70ef('0x3'));var router=express[_0x70ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ef('0x5'));var interaction=require(_0x70ef('0x6'));var config=require('../../config/environment');var controller=require(_0x70ef('0x7'));router['get']('/',auth[_0x70ef('0x8')](),controller['index']);router[_0x70ef('0x9')](_0x70ef('0xa'),auth[_0x70ef('0x8')](),controller['show']);router['get'](_0x70ef('0xb'),auth[_0x70ef('0x8')](),controller[_0x70ef('0xc')]);router[_0x70ef('0x9')](_0x70ef('0xd'),auth[_0x70ef('0x8')](),controller[_0x70ef('0xe')]);router[_0x70ef('0xf')]('/',auth[_0x70ef('0x8')](),controller[_0x70ef('0x10')]);router['post']('/:id/configurations',auth[_0x70ef('0x8')](),controller[_0x70ef('0x11')]);router[_0x70ef('0x12')](_0x70ef('0xa'),auth[_0x70ef('0x8')](),controller[_0x70ef('0x13')]);router[_0x70ef('0x14')](_0x70ef('0xa'),auth[_0x70ef('0x8')](),controller[_0x70ef('0x15')]);module[_0x70ef('0x16')]=router; \ No newline at end of file +var _0x1bea=['addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x408f3d,_0x14ced2){var _0x29afd0=function(_0x57f12c){while(--_0x57f12c){_0x408f3d['push'](_0x408f3d['shift']());}};_0x29afd0(++_0x14ced2);}(_0x1bea,0x65));var _0xa1be=function(_0x22185a,_0x2c9c0f){_0x22185a=_0x22185a-0x0;var _0x27e1f1=_0x1bea[_0x22185a];return _0x27e1f1;};'use strict';var multer=require(_0xa1be('0x0'));var util=require('util');var path=require(_0xa1be('0x1'));var timeout=require(_0xa1be('0x2'));var express=require('express');var router=express[_0xa1be('0x3')]();var fs_extra=require(_0xa1be('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa1be('0x5'));router[_0xa1be('0x6')]('/',auth[_0xa1be('0x7')](),controller['index']);router[_0xa1be('0x6')](_0xa1be('0x8'),auth[_0xa1be('0x7')](),controller[_0xa1be('0x9')]);router['get'](_0xa1be('0xa'),auth[_0xa1be('0x7')](),controller['getConfigurations']);router[_0xa1be('0x6')](_0xa1be('0xb'),auth[_0xa1be('0x7')](),controller[_0xa1be('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa1be('0xa'),auth[_0xa1be('0x7')](),controller[_0xa1be('0xd')]);router[_0xa1be('0xe')]('/:id',auth[_0xa1be('0x7')](),controller[_0xa1be('0xf')]);router[_0xa1be('0x10')](_0xa1be('0x8'),auth[_0xa1be('0x7')](),controller[_0xa1be('0x11')]);module[_0xa1be('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 97ac50a..130db70 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 _0x9f62=['exports','STRING'];(function(_0x5c30cf,_0x4fdde2){var _0x2e0e21=function(_0x3d4e9e){while(--_0x3d4e9e){_0x5c30cf['push'](_0x5c30cf['shift']());}};_0x2e0e21(++_0x4fdde2);}(_0x9f62,0x154));var _0x29f6=function(_0x220e40,_0x34bddc){_0x220e40=_0x220e40-0x0;var _0x5cc1f3=_0x9f62[_0x220e40];return _0x5cc1f3;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29f6('0x1')]},'host':{'type':Sequelize[_0x29f6('0x1')]},'zone':{'type':Sequelize[_0x29f6('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x29f6('0x1')]},'refreshToken':{'type':Sequelize[_0x29f6('0x1')]}}; \ No newline at end of file +var _0xb821=['STRING','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xb821,0xa7));var _0x1b82=function(_0x9a374b,_0x148406){_0x9a374b=_0x9a374b-0x0;var _0x1ed711=_0xb821[_0x9a374b];return _0x1ed711;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'name':{'type':Sequelize[_0x1b82('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x1b82('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1b82('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x1b82('0x1')]},'refreshToken':{'type':Sequelize[_0x1b82('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index adcaccd..6b52360 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 _0xc7df=['Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','limit','count','set','Content-Range','reject','save','update','destroy','end','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','then','includeAll','findAll','rows','show','options','find','catch','create','body','params','keys','ZohoConfiguration','nolimit','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0xc7df,0xa1));var _0xfc7d=function(_0x3a3525,_0x20bccf){_0x3a3525=_0x3a3525-0x0;var _0x54f07f=_0xc7df[_0x3a3525];return _0x54f07f;};'use strict';var emlformat=require(_0xfc7d('0x0'));var rimraf=require(_0xfc7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc7d('0x2'));var rp=require('request-promise');var moment=require(_0xfc7d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfc7d('0x4'));var util=require(_0xfc7d('0x5'));var path=require(_0xfc7d('0x6'));var sox=require(_0xfc7d('0x7'));var csv=require('to-csv');var ejs=require(_0xfc7d('0x8'));var fs=require('fs');var fs_extra=require(_0xfc7d('0x9'));var _=require(_0xfc7d('0xa'));var squel=require(_0xfc7d('0xb'));var crypto=require('crypto');var jsforce=require(_0xfc7d('0xc'));var deskjs=require(_0xfc7d('0xd'));var toCsv=require(_0xfc7d('0xe'));var querystring=require(_0xfc7d('0xf'));var Papa=require('papaparse');var Redis=require(_0xfc7d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfc7d('0x11'));var as=require(_0xfc7d('0x12'));var hardwareService=require(_0xfc7d('0x13'));var logger=require(_0xfc7d('0x14'))('api');var utils=require(_0xfc7d('0x15'));var config=require(_0xfc7d('0x16'));var licenseUtil=require(_0xfc7d('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfc7d('0x18'));function respondWithStatusCode(_0x26a747,_0xe86c0){_0xe86c0=_0xe86c0||0xcc;return function(_0x2844e1){if(_0x2844e1){return _0x26a747[_0xfc7d('0x19')](_0xe86c0);}return _0x26a747['status'](_0xe86c0)['end']();};}function respondWithResult(_0x53b2b1,_0x31e6d2){_0x31e6d2=_0x31e6d2||0xc8;return function(_0x36cff2){if(_0x36cff2){return _0x53b2b1[_0xfc7d('0x1a')](_0x31e6d2)['json'](_0x36cff2);}};}function respondWithFilteredResult(_0x1a72d5,_0x280c38){return function(_0x2f627d){if(_0x2f627d){var _0x249155=typeof _0x280c38[_0xfc7d('0x1b')]==='undefined'&&typeof _0x280c38[_0xfc7d('0x1c')]==='undefined';var _0x1bd213=_0x2f627d[_0xfc7d('0x1d')];var _0x5b7c93=_0x249155?0x0:_0x280c38['offset'];var _0x3491be=_0x249155?_0x2f627d[_0xfc7d('0x1d')]:_0x280c38[_0xfc7d('0x1b')]+_0x280c38[_0xfc7d('0x1c')];var _0x24ba4a;if(_0x3491be>=_0x1bd213){_0x3491be=_0x1bd213;_0x24ba4a=0xc8;}else{_0x24ba4a=0xce;}_0x1a72d5[_0xfc7d('0x1a')](_0x24ba4a);return _0x1a72d5[_0xfc7d('0x1e')](_0xfc7d('0x1f'),_0x5b7c93+'-'+_0x3491be+'/'+_0x1bd213)['json'](_0x2f627d);}return null;};}function patchUpdates(_0x5c866b){return function(_0x30105a){try{jsonpatch['apply'](_0x30105a,_0x5c866b,!![]);}catch(_0x3d2eed){return BPromise[_0xfc7d('0x20')](_0x3d2eed);}return _0x30105a[_0xfc7d('0x21')]();};}function saveUpdates(_0x38dbe8,_0x5e5cce){return function(_0x11e0b7){if(_0x11e0b7){return _0x11e0b7[_0xfc7d('0x22')](_0x38dbe8)['then'](function(_0x2d10b9){return _0x2d10b9;});}return null;};}function removeEntity(_0x19681f,_0x1aee66){return function(_0x1120fa){if(_0x1120fa){return _0x1120fa[_0xfc7d('0x23')]()['then'](function(){_0x19681f['status'](0xcc)[_0xfc7d('0x24')]();});}};}function handleEntityNotFound(_0x253506,_0x30f9f9){return function(_0x5e4b4b){if(!_0x5e4b4b){_0x253506[_0xfc7d('0x19')](0x194);}return _0x5e4b4b;};}function handleError(_0x355d83,_0x9b8ea8){_0x9b8ea8=_0x9b8ea8||0x1f4;return function(_0x3cb5dc){logger[_0xfc7d('0x25')](_0x3cb5dc[_0xfc7d('0x26')]);if(_0x3cb5dc[_0xfc7d('0x27')]){delete _0x3cb5dc[_0xfc7d('0x27')];}_0x355d83[_0xfc7d('0x1a')](_0x9b8ea8)[_0xfc7d('0x28')](_0x3cb5dc);};}exports[_0xfc7d('0x29')]=function(_0x1dbbea,_0x151495){var _0x3b6fbb={},_0x421c4a={},_0x340064={'count':0x0,'rows':[]};var _0x6d6b92=_[_0xfc7d('0x2a')](db[_0xfc7d('0x2b')][_0xfc7d('0x2c')],function(_0x3257b5){return{'name':_0x3257b5[_0xfc7d('0x2d')],'type':_0x3257b5[_0xfc7d('0x2e')][_0xfc7d('0x2f')]};});_0x421c4a[_0xfc7d('0x30')]=_[_0xfc7d('0x2a')](_0x6d6b92,'name');_0x421c4a['query']=_['keys'](_0x1dbbea['query']);_0x421c4a[_0xfc7d('0x31')]=_[_0xfc7d('0x32')](_0x421c4a['model'],_0x421c4a['query']);_0x3b6fbb['attributes']=_[_0xfc7d('0x32')](_0x421c4a[_0xfc7d('0x30')],qs['fields'](_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x34')]));_0x3b6fbb[_0xfc7d('0x35')]=_0x3b6fbb[_0xfc7d('0x35')][_0xfc7d('0x36')]?_0x3b6fbb['attributes']:_0x421c4a[_0xfc7d('0x30')];if(!_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x37')]('nolimit')){_0x3b6fbb[_0xfc7d('0x1c')]=qs[_0xfc7d('0x1c')](_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x1c')]);_0x3b6fbb[_0xfc7d('0x1b')]=qs[_0xfc7d('0x1b')](_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x1b')]);}_0x3b6fbb[_0xfc7d('0x38')]=qs[_0xfc7d('0x39')](_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x39')]);_0x3b6fbb[_0xfc7d('0x3a')]=qs['filters'](_[_0xfc7d('0x3b')](_0x1dbbea['query'],_0x421c4a[_0xfc7d('0x31')]),_0x6d6b92);if(_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x3c')]){_0x3b6fbb[_0xfc7d('0x3a')]=_[_0xfc7d('0x3d')](_0x3b6fbb[_0xfc7d('0x3a')],{'$or':_[_0xfc7d('0x2a')](_0x6d6b92,function(_0x203243){if(_0x203243['type']!=='VIRTUAL'){var _0x5efe03={};_0x5efe03[_0x203243['name']]={'$like':'%'+_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x3c')]+'%'};return _0x5efe03;}})});}_0x3b6fbb=_[_0xfc7d('0x3d')]({},_0x3b6fbb,_0x1dbbea['options']);var _0x593230={'where':_0x3b6fbb[_0xfc7d('0x3a')]};return db[_0xfc7d('0x2b')][_0xfc7d('0x1d')](_0x593230)[_0xfc7d('0x3e')](function(_0x76677a){_0x340064[_0xfc7d('0x1d')]=_0x76677a;if(_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x3f')]){_0x3b6fbb['include']=[{'all':!![]}];}return db[_0xfc7d('0x2b')][_0xfc7d('0x40')](_0x3b6fbb);})[_0xfc7d('0x3e')](function(_0x14f2b0){_0x340064[_0xfc7d('0x41')]=_0x14f2b0;return _0x340064;})[_0xfc7d('0x3e')](respondWithFilteredResult(_0x151495,_0x3b6fbb))['catch'](handleError(_0x151495,null));};exports[_0xfc7d('0x42')]=function(_0x2b0b7b,_0x2cfe90){var _0x457583={'raw':![],'where':{'id':_0x2b0b7b['params']['id']}},_0x3cf67a={};_0x3cf67a[_0xfc7d('0x30')]=_['keys'](db[_0xfc7d('0x2b')][_0xfc7d('0x2c')]);_0x3cf67a[_0xfc7d('0x33')]=_['keys'](_0x2b0b7b[_0xfc7d('0x33')]);_0x3cf67a[_0xfc7d('0x31')]=_[_0xfc7d('0x32')](_0x3cf67a[_0xfc7d('0x30')],_0x3cf67a[_0xfc7d('0x33')]);_0x457583['attributes']=_[_0xfc7d('0x32')](_0x3cf67a[_0xfc7d('0x30')],qs[_0xfc7d('0x34')](_0x2b0b7b[_0xfc7d('0x33')]['fields']));_0x457583[_0xfc7d('0x35')]=_0x457583[_0xfc7d('0x35')][_0xfc7d('0x36')]?_0x457583[_0xfc7d('0x35')]:_0x3cf67a[_0xfc7d('0x30')];if(_0x2b0b7b['query']['includeAll']){_0x457583['include']=[{'all':!![]}];}_0x457583=_[_0xfc7d('0x3d')]({},_0x457583,_0x2b0b7b[_0xfc7d('0x43')]);return db[_0xfc7d('0x2b')][_0xfc7d('0x44')](_0x457583)[_0xfc7d('0x3e')](handleEntityNotFound(_0x2cfe90,null))['then'](respondWithResult(_0x2cfe90,null))[_0xfc7d('0x45')](handleError(_0x2cfe90,null));};exports[_0xfc7d('0x46')]=function(_0xe3fcfe,_0x5e7701){return db[_0xfc7d('0x2b')][_0xfc7d('0x46')](_0xe3fcfe[_0xfc7d('0x47')],{})[_0xfc7d('0x3e')](respondWithResult(_0x5e7701,0xc9))['catch'](handleError(_0x5e7701,null));};exports['update']=function(_0x75c3d1,_0x5d3f32){if(_0x75c3d1[_0xfc7d('0x47')]['id']){delete _0x75c3d1[_0xfc7d('0x47')]['id'];}return db[_0xfc7d('0x2b')]['find']({'where':{'id':_0x75c3d1[_0xfc7d('0x48')]['id']}})[_0xfc7d('0x3e')](handleEntityNotFound(_0x5d3f32,null))[_0xfc7d('0x3e')](saveUpdates(_0x75c3d1[_0xfc7d('0x47')],null))[_0xfc7d('0x3e')](respondWithResult(_0x5d3f32,null))[_0xfc7d('0x45')](handleError(_0x5d3f32,null));};exports['destroy']=function(_0x5b2f57,_0x4a104f){return db[_0xfc7d('0x2b')][_0xfc7d('0x44')]({'where':{'id':_0x5b2f57[_0xfc7d('0x48')]['id']}})[_0xfc7d('0x3e')](handleEntityNotFound(_0x4a104f,null))[_0xfc7d('0x3e')](removeEntity(_0x4a104f,null))[_0xfc7d('0x45')](handleError(_0x4a104f,null));};exports['getConfigurations']=function(_0x36fe41,_0x542d79,_0x610137){var _0x49e317={};var _0x26109b={};var _0x6a283d;var _0x486add;return db[_0xfc7d('0x2b')]['findOne']({'where':{'id':_0x36fe41[_0xfc7d('0x48')]['id']}})[_0xfc7d('0x3e')](handleEntityNotFound(_0x542d79,null))[_0xfc7d('0x3e')](function(_0x5d1e1a){if(_0x5d1e1a){_0x6a283d=_0x5d1e1a;_0x26109b[_0xfc7d('0x30')]=_[_0xfc7d('0x49')](db[_0xfc7d('0x4a')][_0xfc7d('0x2c')]);_0x26109b['query']=_['keys'](_0x36fe41[_0xfc7d('0x33')]);_0x26109b[_0xfc7d('0x31')]=_['intersection'](_0x26109b[_0xfc7d('0x30')],_0x26109b[_0xfc7d('0x33')]);_0x49e317[_0xfc7d('0x35')]=_[_0xfc7d('0x32')](_0x26109b[_0xfc7d('0x30')],qs[_0xfc7d('0x34')](_0x36fe41[_0xfc7d('0x33')][_0xfc7d('0x34')]));_0x49e317[_0xfc7d('0x35')]=_0x49e317[_0xfc7d('0x35')][_0xfc7d('0x36')]?_0x49e317[_0xfc7d('0x35')]:_0x26109b[_0xfc7d('0x30')];_0x49e317['order']=qs['sort'](_0x36fe41[_0xfc7d('0x33')][_0xfc7d('0x39')]);_0x49e317[_0xfc7d('0x3a')]=qs[_0xfc7d('0x31')](_[_0xfc7d('0x3b')](_0x36fe41[_0xfc7d('0x33')],_0x26109b[_0xfc7d('0x31')]));if(_0x36fe41['query']['filter']){_0x49e317[_0xfc7d('0x3a')]=_['merge'](_0x49e317[_0xfc7d('0x3a')],{'$or':_['map'](_0x49e317[_0xfc7d('0x35')],function(_0x8742be){var _0x3e0b1a={};_0x3e0b1a[_0x8742be]={'$like':'%'+_0x36fe41['query'][_0xfc7d('0x3c')]+'%'};return _0x3e0b1a;})});}_0x49e317=_[_0xfc7d('0x3d')]({},_0x49e317,_0x36fe41['options']);return _0x6a283d['getConfigurations'](_0x49e317);}})['then'](function(_0xc717e4){if(_0xc717e4){_0x486add=_0xc717e4[_0xfc7d('0x36')];if(!_0x36fe41[_0xfc7d('0x33')][_0xfc7d('0x37')](_0xfc7d('0x4b'))){_0x49e317['limit']=qs[_0xfc7d('0x1c')](_0x36fe41[_0xfc7d('0x33')][_0xfc7d('0x1c')]);_0x49e317[_0xfc7d('0x1b')]=qs[_0xfc7d('0x1b')](_0x36fe41[_0xfc7d('0x33')]['offset']);}return _0x6a283d[_0xfc7d('0x4c')](_0x49e317);}})[_0xfc7d('0x3e')](function(_0x4764d9){if(_0x4764d9){return _0x4764d9?{'count':_0x486add,'rows':_0x4764d9}:null;}})['then'](respondWithResult(_0x542d79,null))[_0xfc7d('0x45')](handleError(_0x542d79,null));};exports[_0xfc7d('0x4d')]=function(_0x482452,_0x211e0e,_0x222f51){if(_0x482452[_0xfc7d('0x47')]['id']){delete _0x482452[_0xfc7d('0x47')]['id'];}return db['ZohoAccount'][_0xfc7d('0x4e')]({'where':{'id':_0x482452['params']['id']}})['then'](handleEntityNotFound(_0x211e0e,null))['then'](function(_0x198a4d){if(_0x198a4d){_0x482452[_0xfc7d('0x47')]['AccountId']=_0x198a4d['id'];_0x482452[_0xfc7d('0x47')][_0xfc7d('0x4f')]=integrations[_0xfc7d('0x50')](_0x482452[_0xfc7d('0x47')][_0xfc7d('0x51')],_0x482452[_0xfc7d('0x47')]['type']);_0x482452['body'][_0xfc7d('0x52')]=integrations['getDescriptions'](_0x482452[_0xfc7d('0x47')][_0xfc7d('0x51')],_0x482452[_0xfc7d('0x47')][_0xfc7d('0x2e')]);return db[_0xfc7d('0x4a')][_0xfc7d('0x46')](_0x482452[_0xfc7d('0x47')],{'include':[{'model':db[_0xfc7d('0x53')],'as':_0xfc7d('0x4f')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xfc7d('0x3e')](respondWithResult(_0x211e0e,null))[_0xfc7d('0x45')](handleError(_0x211e0e,null));};function getAccessToken(_0x58a682){return new Promise(function(_0x436f82,_0x52014e){var _0x8a5ee0;switch(_0x58a682[_0xfc7d('0x54')]){case'US':_0x8a5ee0=_0xfc7d('0x55');break;case'AU':_0x8a5ee0='https://accounts.zoho.com.au';break;case'EU':_0x8a5ee0=_0xfc7d('0x56');break;case'IN':_0x8a5ee0='https://accounts.zoho.in';break;case'CN':_0x8a5ee0=_0xfc7d('0x57');break;default:_0x8a5ee0=_0xfc7d('0x56');break;}var _0x3129cf={'method':_0xfc7d('0x58'),'uri':_0x8a5ee0+_0xfc7d('0x59'),'qs':{'refresh_token':_0x58a682[_0xfc7d('0x5a')],'client_id':_0x58a682[_0xfc7d('0x5b')],'client_secret':_0x58a682[_0xfc7d('0x5c')],'grant_type':_0xfc7d('0x5d')},'json':!![]};return rp(_0x3129cf)[_0xfc7d('0x3e')](function(_0x4c014d){if(_0x4c014d[_0xfc7d('0x5e')]){_0x436f82(_0x4c014d[_0xfc7d('0x5e')]);}else{_0x52014e(_0xfc7d('0x5f'));}})[_0xfc7d('0x45')](function(_0x23f50a){_0x52014e(_0x23f50a);});});}exports['getFields']=function(_0x7d6af0,_0x147d2d,_0x2b8e7b){var _0x4a2dcc,_0xa8076,_0x476341,_0x147e0a,_0xa23325;return db[_0xfc7d('0x2b')][_0xfc7d('0x4e')]({'where':{'id':_0x7d6af0['params']['id']},'attributes':['id',_0xfc7d('0x60'),'zone',_0xfc7d('0x5b'),_0xfc7d('0x5c'),_0xfc7d('0x61'),_0xfc7d('0x62'),_0xfc7d('0x5a')]})[_0xfc7d('0x3e')](handleEntityNotFound(_0x147d2d,null))[_0xfc7d('0x3e')](function(_0x1c1783){_0xa23325=_0x1c1783;_0x4a2dcc=_0xa23325[_0xfc7d('0x60')];_0xa8076=_0x4a2dcc===_0xfc7d('0x63')?'eu':'com';_0x476341=_0xa23325[_0xfc7d('0x61')];var _0x1bc7d3=_0x476341[_0xfc7d('0x64')](-0x1);if(_0x1bc7d3==='/'||_0x1bc7d3==='\x5c'||_0x1bc7d3===':'){_0x476341=_0x476341[_0xfc7d('0x65')](0x0,_0x476341['lastIndexOf'](_0x1bc7d3));}if(!_0xa23325[_0xfc7d('0x5a')]){throw new Error(_0xfc7d('0x66'));}return getAccessToken(_0xa23325);})[_0xfc7d('0x3e')](function(_0x33e1a5){if(_0x33e1a5){return rp({'method':_0xfc7d('0x67'),'uri':util[_0xfc7d('0x68')](_0xfc7d('0x69'),_0xa8076),'qs':{'module':'Calls'},'headers':{'Authorization':_0xfc7d('0x6a')+_0x33e1a5},'json':!![]});}})[_0xfc7d('0x3e')](function(_0x29f1b5){if(_0x29f1b5){if(_0x29f1b5[_0xfc7d('0x6b')]&&_0x29f1b5[_0xfc7d('0x6b')][_0xfc7d('0x25')]){throw new Error(_0x29f1b5['response'][_0xfc7d('0x25')][_0xfc7d('0x6c')]);}var _0x4e7a2f=[];var _0x4871fb=[];var _0x870851=['Owner',_0xfc7d('0x6d'),_0xfc7d('0x6e'),_0xfc7d('0x6f'),_0xfc7d('0x70'),'Call_Result','Call_Start_Time',_0xfc7d('0x71')];_0x4871fb=_[_0xfc7d('0x72')](_0x29f1b5['fields'],function(_0x1488ce){return _0x870851[_0xfc7d('0x73')](_0x1488ce[_0xfc7d('0x74')]);});for(var _0x5d8096=0x0;_0x5d8096<_0x4871fb[_0xfc7d('0x36')];_0x5d8096++){if(_0x4871fb[_0x5d8096]['system_mandatory']===![]){_0x4e7a2f[_0xfc7d('0x75')]({'id':_0x4871fb[_0x5d8096]['id'],'name':_0x4871fb[_0x5d8096][_0xfc7d('0x76')],'custom':_0x4871fb[_0x5d8096][_0xfc7d('0x77')],'options':_0x4871fb[_0x5d8096][_0xfc7d('0x78')]===_0xfc7d('0x79')&&_0x4871fb[_0x5d8096][_0xfc7d('0x7a')][_0xfc7d('0x36')]>-0x1?_['map'](_0x4871fb[_0x5d8096]['pick_list_values'],function(_0x38288e){return{'name':_0x38288e,'value':_0x38288e};}):[]});}}return{'count':_0x4e7a2f['length'],'rows':_0x4e7a2f};}else{return{'count':0x0,'rows':[]};}})[_0xfc7d('0x3e')](respondWithResult(_0x147d2d,null))['catch'](function(_0x34b3fb){var _0x46f380=_0x7d6af0['query']['test']?0x1f4:_0x34b3fb[_0xfc7d('0x7b')]||0x1f4;logger[_0xfc7d('0x25')](_0xfc7d('0x7c'),_0xfc7d('0x7d'),_0x46f380,JSON['stringify'](_0x34b3fb));delete _0x34b3fb[_0xfc7d('0x27')];if(_0x46f380===0x191){_0x46f380=0x190;}_0x147d2d['status'](_0x46f380)['send'](_0x7d6af0[_0xfc7d('0x33')][_0xfc7d('0x7e')]?{'message':_0xfc7d('0x7f'),'statusCode':_0x34b3fb[_0xfc7d('0x7b')]}:_0x34b3fb);});}; \ No newline at end of file +var _0x6acc=['mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','name','send','index','map','ZohoAccount','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','catch','params','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','AccountId','getSubjects','channel','Descriptions','ZohoField','Subjects','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','access_token','host','serverUrl','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Subject','WhoId','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x20214c,_0x16ffd0){var _0x36288d=function(_0x3fda5b){while(--_0x3fda5b){_0x20214c['push'](_0x20214c['shift']());}};_0x36288d(++_0x16ffd0);}(_0x6acc,0xf1));var _0xc6ac=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x6acc[_0x2adbeb];return _0x5e18a6;};'use strict';var emlformat=require(_0xc6ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6ac('0x1'));var jsonpatch=require(_0xc6ac('0x2'));var rp=require(_0xc6ac('0x3'));var moment=require(_0xc6ac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc6ac('0x5'));var util=require(_0xc6ac('0x6'));var path=require('path');var sox=require(_0xc6ac('0x7'));var csv=require('to-csv');var ejs=require(_0xc6ac('0x8'));var fs=require('fs');var fs_extra=require(_0xc6ac('0x9'));var _=require(_0xc6ac('0xa'));var squel=require(_0xc6ac('0xb'));var crypto=require(_0xc6ac('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc6ac('0xd'));var Papa=require(_0xc6ac('0xe'));var Redis=require(_0xc6ac('0xf'));var authService=require(_0xc6ac('0x10'));var qs=require(_0xc6ac('0x11'));var as=require(_0xc6ac('0x12'));var hardwareService=require(_0xc6ac('0x13'));var logger=require(_0xc6ac('0x14'))(_0xc6ac('0x15'));var utils=require(_0xc6ac('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc6ac('0x17'));var db=require(_0xc6ac('0x18'))['db'];var integrations=require(_0xc6ac('0x19'));function respondWithStatusCode(_0x5dbdca,_0x100320){_0x100320=_0x100320||0xcc;return function(_0x1decb6){if(_0x1decb6){return _0x5dbdca[_0xc6ac('0x1a')](_0x100320);}return _0x5dbdca[_0xc6ac('0x1b')](_0x100320)[_0xc6ac('0x1c')]();};}function respondWithResult(_0x378dcb,_0x211b36){_0x211b36=_0x211b36||0xc8;return function(_0x50787d){if(_0x50787d){return _0x378dcb[_0xc6ac('0x1b')](_0x211b36)[_0xc6ac('0x1d')](_0x50787d);}};}function respondWithFilteredResult(_0x24c6cd,_0x3d407f){return function(_0x4375c0){if(_0x4375c0){var _0x2f0c16=typeof _0x3d407f[_0xc6ac('0x1e')]===_0xc6ac('0x1f')&&typeof _0x3d407f[_0xc6ac('0x20')]===_0xc6ac('0x1f');var _0x2eac6c=_0x4375c0['count'];var _0x200716=_0x2f0c16?0x0:_0x3d407f[_0xc6ac('0x1e')];var _0x11c36e=_0x2f0c16?_0x4375c0[_0xc6ac('0x21')]:_0x3d407f['offset']+_0x3d407f[_0xc6ac('0x20')];var _0x1cd0ab;if(_0x11c36e>=_0x2eac6c){_0x11c36e=_0x2eac6c;_0x1cd0ab=0xc8;}else{_0x1cd0ab=0xce;}_0x24c6cd[_0xc6ac('0x1b')](_0x1cd0ab);return _0x24c6cd[_0xc6ac('0x22')](_0xc6ac('0x23'),_0x200716+'-'+_0x11c36e+'/'+_0x2eac6c)[_0xc6ac('0x1d')](_0x4375c0);}return null;};}function patchUpdates(_0x154380){return function(_0xce668e){try{jsonpatch['apply'](_0xce668e,_0x154380,!![]);}catch(_0x89752a){return BPromise['reject'](_0x89752a);}return _0xce668e[_0xc6ac('0x24')]();};}function saveUpdates(_0x42c695,_0x54a70c){return function(_0x4b53d8){if(_0x4b53d8){return _0x4b53d8[_0xc6ac('0x25')](_0x42c695)[_0xc6ac('0x26')](function(_0x56e43d){return _0x56e43d;});}return null;};}function removeEntity(_0x2afdc9,_0x23a211){return function(_0x32c9ed){if(_0x32c9ed){return _0x32c9ed[_0xc6ac('0x27')]()[_0xc6ac('0x26')](function(){_0x2afdc9[_0xc6ac('0x1b')](0xcc)[_0xc6ac('0x1c')]();});}};}function handleEntityNotFound(_0x2273ed,_0x573e1c){return function(_0x544577){if(!_0x544577){_0x2273ed['sendStatus'](0x194);}return _0x544577;};}function handleError(_0x32f514,_0xad304d){_0xad304d=_0xad304d||0x1f4;return function(_0x3936f7){logger['error'](_0x3936f7['stack']);if(_0x3936f7[_0xc6ac('0x28')]){delete _0x3936f7[_0xc6ac('0x28')];}_0x32f514['status'](_0xad304d)[_0xc6ac('0x29')](_0x3936f7);};}exports[_0xc6ac('0x2a')]=function(_0x411a7c,_0x3f942e){var _0x64a31f={},_0x2a1347={},_0x28ab41={'count':0x0,'rows':[]};var _0x2073e8=_[_0xc6ac('0x2b')](db[_0xc6ac('0x2c')][_0xc6ac('0x2d')],function(_0x238ffe){return{'name':_0x238ffe['fieldName'],'type':_0x238ffe[_0xc6ac('0x2e')]['key']};});_0x2a1347[_0xc6ac('0x2f')]=_[_0xc6ac('0x2b')](_0x2073e8,'name');_0x2a1347[_0xc6ac('0x30')]=_[_0xc6ac('0x31')](_0x411a7c[_0xc6ac('0x30')]);_0x2a1347['filters']=_[_0xc6ac('0x32')](_0x2a1347['model'],_0x2a1347['query']);_0x64a31f['attributes']=_['intersection'](_0x2a1347[_0xc6ac('0x2f')],qs['fields'](_0x411a7c['query'][_0xc6ac('0x33')]));_0x64a31f[_0xc6ac('0x34')]=_0x64a31f[_0xc6ac('0x34')][_0xc6ac('0x35')]?_0x64a31f[_0xc6ac('0x34')]:_0x2a1347[_0xc6ac('0x2f')];if(!_0x411a7c[_0xc6ac('0x30')]['hasOwnProperty'](_0xc6ac('0x36'))){_0x64a31f[_0xc6ac('0x20')]=qs['limit'](_0x411a7c['query']['limit']);_0x64a31f[_0xc6ac('0x1e')]=qs[_0xc6ac('0x1e')](_0x411a7c[_0xc6ac('0x30')][_0xc6ac('0x1e')]);}_0x64a31f[_0xc6ac('0x37')]=qs[_0xc6ac('0x38')](_0x411a7c['query'][_0xc6ac('0x38')]);_0x64a31f['where']=qs[_0xc6ac('0x39')](_[_0xc6ac('0x3a')](_0x411a7c[_0xc6ac('0x30')],_0x2a1347[_0xc6ac('0x39')]),_0x2073e8);if(_0x411a7c[_0xc6ac('0x30')][_0xc6ac('0x3b')]){_0x64a31f[_0xc6ac('0x3c')]=_[_0xc6ac('0x3d')](_0x64a31f[_0xc6ac('0x3c')],{'$or':_[_0xc6ac('0x2b')](_0x2073e8,function(_0x332d11){if(_0x332d11['type']!=='VIRTUAL'){var _0x153d8e={};_0x153d8e[_0x332d11[_0xc6ac('0x28')]]={'$like':'%'+_0x411a7c[_0xc6ac('0x30')][_0xc6ac('0x3b')]+'%'};return _0x153d8e;}})});}_0x64a31f=_[_0xc6ac('0x3d')]({},_0x64a31f,_0x411a7c[_0xc6ac('0x3e')]);var _0x40901b={'where':_0x64a31f[_0xc6ac('0x3c')]};return db[_0xc6ac('0x2c')][_0xc6ac('0x21')](_0x40901b)[_0xc6ac('0x26')](function(_0x3a87fe){_0x28ab41[_0xc6ac('0x21')]=_0x3a87fe;if(_0x411a7c['query'][_0xc6ac('0x3f')]){_0x64a31f[_0xc6ac('0x40')]=[{'all':!![]}];}return db['ZohoAccount'][_0xc6ac('0x41')](_0x64a31f);})['then'](function(_0x3b3430){_0x28ab41['rows']=_0x3b3430;return _0x28ab41;})[_0xc6ac('0x26')](respondWithFilteredResult(_0x3f942e,_0x64a31f))[_0xc6ac('0x42')](handleError(_0x3f942e,null));};exports['show']=function(_0x2b8fbf,_0x330b52){var _0x59e987={'raw':![],'where':{'id':_0x2b8fbf[_0xc6ac('0x43')]['id']}},_0x23f4e2={};_0x23f4e2[_0xc6ac('0x2f')]=_['keys'](db[_0xc6ac('0x2c')][_0xc6ac('0x2d')]);_0x23f4e2[_0xc6ac('0x30')]=_[_0xc6ac('0x31')](_0x2b8fbf[_0xc6ac('0x30')]);_0x23f4e2[_0xc6ac('0x39')]=_[_0xc6ac('0x32')](_0x23f4e2['model'],_0x23f4e2[_0xc6ac('0x30')]);_0x59e987[_0xc6ac('0x34')]=_[_0xc6ac('0x32')](_0x23f4e2[_0xc6ac('0x2f')],qs[_0xc6ac('0x33')](_0x2b8fbf['query'][_0xc6ac('0x33')]));_0x59e987[_0xc6ac('0x34')]=_0x59e987[_0xc6ac('0x34')]['length']?_0x59e987[_0xc6ac('0x34')]:_0x23f4e2[_0xc6ac('0x2f')];if(_0x2b8fbf[_0xc6ac('0x30')][_0xc6ac('0x3f')]){_0x59e987['include']=[{'all':!![]}];}_0x59e987=_[_0xc6ac('0x3d')]({},_0x59e987,_0x2b8fbf[_0xc6ac('0x3e')]);return db['ZohoAccount'][_0xc6ac('0x44')](_0x59e987)[_0xc6ac('0x26')](handleEntityNotFound(_0x330b52,null))[_0xc6ac('0x26')](respondWithResult(_0x330b52,null))[_0xc6ac('0x42')](handleError(_0x330b52,null));};exports['create']=function(_0x489a72,_0x1a2f67){return db[_0xc6ac('0x2c')][_0xc6ac('0x45')](_0x489a72[_0xc6ac('0x46')],{})[_0xc6ac('0x26')](respondWithResult(_0x1a2f67,0xc9))[_0xc6ac('0x42')](handleError(_0x1a2f67,null));};exports[_0xc6ac('0x25')]=function(_0x2d744b,_0x19a120){if(_0x2d744b['body']['id']){delete _0x2d744b[_0xc6ac('0x46')]['id'];}return db[_0xc6ac('0x2c')][_0xc6ac('0x44')]({'where':{'id':_0x2d744b[_0xc6ac('0x43')]['id']}})[_0xc6ac('0x26')](handleEntityNotFound(_0x19a120,null))[_0xc6ac('0x26')](saveUpdates(_0x2d744b[_0xc6ac('0x46')],null))[_0xc6ac('0x26')](respondWithResult(_0x19a120,null))[_0xc6ac('0x42')](handleError(_0x19a120,null));};exports['destroy']=function(_0x21bc86,_0x3af97f){return db[_0xc6ac('0x2c')]['find']({'where':{'id':_0x21bc86[_0xc6ac('0x43')]['id']}})['then'](handleEntityNotFound(_0x3af97f,null))[_0xc6ac('0x26')](removeEntity(_0x3af97f,null))[_0xc6ac('0x42')](handleError(_0x3af97f,null));};exports[_0xc6ac('0x47')]=function(_0x4b7257,_0x3e2777,_0x57b57e){var _0xd54ed8={};var _0xd866d0={};var _0x52d6a4;var _0x1753ca;return db['ZohoAccount'][_0xc6ac('0x48')]({'where':{'id':_0x4b7257[_0xc6ac('0x43')]['id']}})[_0xc6ac('0x26')](handleEntityNotFound(_0x3e2777,null))[_0xc6ac('0x26')](function(_0x154c7b){if(_0x154c7b){_0x52d6a4=_0x154c7b;_0xd866d0[_0xc6ac('0x2f')]=_[_0xc6ac('0x31')](db[_0xc6ac('0x49')][_0xc6ac('0x2d')]);_0xd866d0[_0xc6ac('0x30')]=_[_0xc6ac('0x31')](_0x4b7257[_0xc6ac('0x30')]);_0xd866d0[_0xc6ac('0x39')]=_[_0xc6ac('0x32')](_0xd866d0[_0xc6ac('0x2f')],_0xd866d0['query']);_0xd54ed8[_0xc6ac('0x34')]=_[_0xc6ac('0x32')](_0xd866d0[_0xc6ac('0x2f')],qs[_0xc6ac('0x33')](_0x4b7257[_0xc6ac('0x30')]['fields']));_0xd54ed8[_0xc6ac('0x34')]=_0xd54ed8[_0xc6ac('0x34')][_0xc6ac('0x35')]?_0xd54ed8[_0xc6ac('0x34')]:_0xd866d0[_0xc6ac('0x2f')];_0xd54ed8[_0xc6ac('0x37')]=qs[_0xc6ac('0x38')](_0x4b7257[_0xc6ac('0x30')][_0xc6ac('0x38')]);_0xd54ed8['where']=qs[_0xc6ac('0x39')](_[_0xc6ac('0x3a')](_0x4b7257[_0xc6ac('0x30')],_0xd866d0[_0xc6ac('0x39')]));if(_0x4b7257[_0xc6ac('0x30')]['filter']){_0xd54ed8[_0xc6ac('0x3c')]=_['merge'](_0xd54ed8[_0xc6ac('0x3c')],{'$or':_[_0xc6ac('0x2b')](_0xd54ed8[_0xc6ac('0x34')],function(_0x48b189){var _0x32f21a={};_0x32f21a[_0x48b189]={'$like':'%'+_0x4b7257[_0xc6ac('0x30')]['filter']+'%'};return _0x32f21a;})});}_0xd54ed8=_[_0xc6ac('0x3d')]({},_0xd54ed8,_0x4b7257['options']);return _0x52d6a4[_0xc6ac('0x47')](_0xd54ed8);}})[_0xc6ac('0x26')](function(_0x51f3fb){if(_0x51f3fb){_0x1753ca=_0x51f3fb[_0xc6ac('0x35')];if(!_0x4b7257[_0xc6ac('0x30')][_0xc6ac('0x4a')]('nolimit')){_0xd54ed8[_0xc6ac('0x20')]=qs[_0xc6ac('0x20')](_0x4b7257[_0xc6ac('0x30')][_0xc6ac('0x20')]);_0xd54ed8['offset']=qs[_0xc6ac('0x1e')](_0x4b7257[_0xc6ac('0x30')][_0xc6ac('0x1e')]);}return _0x52d6a4[_0xc6ac('0x47')](_0xd54ed8);}})[_0xc6ac('0x26')](function(_0x279b9a){if(_0x279b9a){return _0x279b9a?{'count':_0x1753ca,'rows':_0x279b9a}:null;}})[_0xc6ac('0x26')](respondWithResult(_0x3e2777,null))[_0xc6ac('0x42')](handleError(_0x3e2777,null));};exports['addConfiguration']=function(_0x5c1f67,_0x5eb8d9,_0x46a54c){if(_0x5c1f67[_0xc6ac('0x46')]['id']){delete _0x5c1f67[_0xc6ac('0x46')]['id'];}return db[_0xc6ac('0x2c')][_0xc6ac('0x48')]({'where':{'id':_0x5c1f67[_0xc6ac('0x43')]['id']}})[_0xc6ac('0x26')](handleEntityNotFound(_0x5eb8d9,null))['then'](function(_0x4be8d0){if(_0x4be8d0){_0x5c1f67['body'][_0xc6ac('0x4b')]=_0x4be8d0['id'];_0x5c1f67['body']['Subjects']=integrations[_0xc6ac('0x4c')](_0x5c1f67['body'][_0xc6ac('0x4d')],_0x5c1f67[_0xc6ac('0x46')][_0xc6ac('0x2e')]);_0x5c1f67[_0xc6ac('0x46')][_0xc6ac('0x4e')]=integrations['getDescriptions'](_0x5c1f67[_0xc6ac('0x46')][_0xc6ac('0x4d')],_0x5c1f67[_0xc6ac('0x46')][_0xc6ac('0x2e')]);return db[_0xc6ac('0x49')][_0xc6ac('0x45')](_0x5c1f67[_0xc6ac('0x46')],{'include':[{'model':db[_0xc6ac('0x4f')],'as':_0xc6ac('0x50')},{'model':db[_0xc6ac('0x4f')],'as':_0xc6ac('0x4e')}]});}return null;})['then'](respondWithResult(_0x5eb8d9,null))[_0xc6ac('0x42')](handleError(_0x5eb8d9,null));};function getAccessToken(_0x1b72f5){return new Promise(function(_0x224720,_0x1a60ba){var _0x3c6ae1;switch(_0x1b72f5['zone']){case'US':_0x3c6ae1='https://accounts.zoho.com';break;case'AU':_0x3c6ae1=_0xc6ac('0x51');break;case'EU':_0x3c6ae1=_0xc6ac('0x52');break;case'IN':_0x3c6ae1=_0xc6ac('0x53');break;case'CN':_0x3c6ae1=_0xc6ac('0x54');break;default:_0x3c6ae1=_0xc6ac('0x52');break;}var _0x5be52d={'method':_0xc6ac('0x55'),'uri':_0x3c6ae1+_0xc6ac('0x56'),'qs':{'refresh_token':_0x1b72f5['refreshToken'],'client_id':_0x1b72f5[_0xc6ac('0x57')],'client_secret':_0x1b72f5[_0xc6ac('0x58')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5be52d)[_0xc6ac('0x26')](function(_0x26eff6){if(_0x26eff6[_0xc6ac('0x59')]){_0x224720(_0x26eff6[_0xc6ac('0x59')]);}else{_0x1a60ba('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x4cc9c7){_0x1a60ba(_0x4cc9c7);});});}exports['getFields']=function(_0x52511c,_0xd05bba,_0x4618de){var _0x5e1bf9,_0x484b3e,_0x57f470,_0x4cba42,_0x549465;return db[_0xc6ac('0x2c')][_0xc6ac('0x48')]({'where':{'id':_0x52511c[_0xc6ac('0x43')]['id']},'attributes':['id',_0xc6ac('0x5a'),'zone',_0xc6ac('0x57'),_0xc6ac('0x58'),_0xc6ac('0x5b'),'code',_0xc6ac('0x5c')]})[_0xc6ac('0x26')](handleEntityNotFound(_0xd05bba,null))[_0xc6ac('0x26')](function(_0x2accd0){_0x549465=_0x2accd0;_0x5e1bf9=_0x549465[_0xc6ac('0x5a')];_0x484b3e=_0x5e1bf9===_0xc6ac('0x5d')?'eu':_0xc6ac('0x5e');_0x57f470=_0x549465[_0xc6ac('0x5b')];var _0x2ca035=_0x57f470[_0xc6ac('0x5f')](-0x1);if(_0x2ca035==='/'||_0x2ca035==='\x5c'||_0x2ca035===':'){_0x57f470=_0x57f470[_0xc6ac('0x60')](0x0,_0x57f470[_0xc6ac('0x61')](_0x2ca035));}if(!_0x549465[_0xc6ac('0x5c')]){throw new Error(_0xc6ac('0x62'));}return getAccessToken(_0x549465);})['then'](function(_0x544a83){if(_0x544a83){return rp({'method':_0xc6ac('0x63'),'uri':util[_0xc6ac('0x64')](_0xc6ac('0x65'),_0x484b3e),'qs':{'module':_0xc6ac('0x66')},'headers':{'Authorization':_0xc6ac('0x67')+_0x544a83},'json':!![]});}})['then'](function(_0x5d9d31){if(_0x5d9d31){if(_0x5d9d31['response']&&_0x5d9d31[_0xc6ac('0x68')][_0xc6ac('0x69')]){throw new Error(_0x5d9d31[_0xc6ac('0x68')]['error'][_0xc6ac('0x6a')]);}var _0x5368fc=[];var _0x50b28f=[];var _0x1c3ea9=['Owner',_0xc6ac('0x6b'),'Description',_0xc6ac('0x6c'),'Call_Duration',_0xc6ac('0x6d'),'Call_Start_Time',_0xc6ac('0x6e')];_0x50b28f=_[_0xc6ac('0x6f')](_0x5d9d31[_0xc6ac('0x33')],function(_0x42f75b){return _0x1c3ea9[_0xc6ac('0x70')](_0x42f75b[_0xc6ac('0x71')]);});for(var _0x2ebff3=0x0;_0x2ebff3<_0x50b28f['length'];_0x2ebff3++){if(_0x50b28f[_0x2ebff3][_0xc6ac('0x72')]===![]){_0x5368fc[_0xc6ac('0x73')]({'id':_0x50b28f[_0x2ebff3]['id'],'name':_0x50b28f[_0x2ebff3]['display_label'],'custom':_0x50b28f[_0x2ebff3]['custom_field'],'options':_0x50b28f[_0x2ebff3][_0xc6ac('0x74')]==='picklist'&&_0x50b28f[_0x2ebff3][_0xc6ac('0x75')]['length']>-0x1?_[_0xc6ac('0x2b')](_0x50b28f[_0x2ebff3][_0xc6ac('0x75')],function(_0x474d67){return{'name':_0x474d67,'value':_0x474d67};}):[]});}}return{'count':_0x5368fc[_0xc6ac('0x35')],'rows':_0x5368fc};}else{return{'count':0x0,'rows':[]};}})[_0xc6ac('0x26')](respondWithResult(_0xd05bba,null))['catch'](function(_0x54a59d){var _0x498628=_0x52511c[_0xc6ac('0x30')][_0xc6ac('0x76')]?0x1f4:_0x54a59d[_0xc6ac('0x77')]||0x1f4;logger[_0xc6ac('0x69')](_0xc6ac('0x78'),_0xc6ac('0x79'),_0x498628,JSON[_0xc6ac('0x7a')](_0x54a59d));delete _0x54a59d[_0xc6ac('0x28')];if(_0x498628===0x191){_0x498628=0x190;}_0xd05bba[_0xc6ac('0x1b')](_0x498628)[_0xc6ac('0x29')](_0x52511c[_0xc6ac('0x30')][_0xc6ac('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x54a59d[_0xc6ac('0x77')]}:_0x54a59d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2e2221c..2e548f0 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 _0xe91b=['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','slice','/oauth/v2/token','refreshToken','catch','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token'];(function(_0x49cf09,_0x389ba2){var _0x5b2014=function(_0x2961b5){while(--_0x2961b5){_0x49cf09['push'](_0x49cf09['shift']());}};_0x5b2014(++_0x389ba2);}(_0xe91b,0x15b));var _0xbe91=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xe91b[_0xbe40ad];return _0x50fac9;};'use strict';var _=require(_0xbe91('0x0'));var util=require(_0xbe91('0x1'));var logger=require(_0xbe91('0x2'))('api');var moment=require(_0xbe91('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe91('0x4'));var config=require(_0xbe91('0x5'));var attributes=require(_0xbe91('0x6'));var integrations=require(_0xbe91('0x7'));module[_0xbe91('0x8')]=function(_0x1e9912,_0x240cd1){return _0x1e9912[_0xbe91('0x9')](_0xbe91('0xa'),attributes,{'tableName':_0xbe91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1655c9,_0x20396b,_0x475333){if(_0x1655c9[_0xbe91('0xc')](_0xbe91('0xd'))||_0x1655c9[_0xbe91('0xc')](_0xbe91('0xe'))||_0x1655c9[_0xbe91('0xc')](_0xbe91('0xf'))||_0x1655c9[_0xbe91('0xc')](_0xbe91('0x10'))||_0x1655c9[_0xbe91('0xc')]('code')||_0x1655c9[_0xbe91('0xc')](_0xbe91('0x11'))){var _0x863ea9,_0xed150c;_0x863ea9=_0x1655c9['serverUrl'];var _0xa01185=_0x863ea9['slice'](-0x1);if(_0xa01185==='/'||_0xa01185==='\x5c'||_0xa01185===':'){_0x863ea9=_0x863ea9[_0xbe91('0x12')](0x0,_0x863ea9[_0xbe91('0x13')](_0xa01185));}switch(_0x1655c9[_0xbe91('0xd')]){case'US':_0xed150c=_0xbe91('0x14');break;case'AU':_0xed150c=_0xbe91('0x15');break;case'IN':_0xed150c=_0xbe91('0x16');break;case'CN':_0xed150c=_0xbe91('0x17');break;default:_0xed150c=_0xbe91('0x18');break;}var _0x18f322={'method':'POST','uri':_0xed150c+'/oauth/v2/token','form':{'grant_type':_0xbe91('0x19'),'client_id':_0x1655c9['clientId'],'client_secret':_0x1655c9[_0xbe91('0x10')],'redirect_uri':_0x1655c9[_0xbe91('0xe')],'code':_0x1655c9[_0xbe91('0x1a')]},'headers':{'Content-Type':_0xbe91('0x1b')}};return rp(_0x18f322)[_0xbe91('0x1c')](function(_0x2ec244){var _0xe68c2d=JSON[_0xbe91('0x1d')](_0x2ec244);if(_0xe68c2d['refresh_token']){_0x1655c9['refreshToken']=_0xe68c2d[_0xbe91('0x1e')];logger[_0xbe91('0x1f')](util['format'](_0xbe91('0x20'),_0x1655c9[_0xbe91('0x21')],_0x1655c9['id']));}else{logger[_0xbe91('0x22')](util[_0xbe91('0x23')](_0xbe91('0x24'),_0x1655c9[_0xbe91('0x21')],_0x1655c9['id']),util['inspect'](_0xe68c2d,{'showHidden':![],'depth':null}));}return _0x475333(null,_0x20396b);})['catch'](function(_0x57c5dd){logger[_0xbe91('0x22')](util[_0xbe91('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1655c9[_0xbe91('0x21')],_0x1655c9['id']),util[_0xbe91('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x475333(_0x57c5dd);});}else{return _0x475333(null,_0x20396b);}},'beforeUpdate':function(_0x141596,_0xc433f6,_0x25cc96){if(_0x141596[_0xbe91('0xc')](_0xbe91('0xd'))||_0x141596[_0xbe91('0xc')]('serverUrl')||_0x141596[_0xbe91('0xc')](_0xbe91('0xf'))||_0x141596[_0xbe91('0xc')](_0xbe91('0x10'))||_0x141596['changed'](_0xbe91('0x1a'))||_0x141596[_0xbe91('0xc')](_0xbe91('0x11'))){var _0x2daba6,_0x2fe8ac;_0x2daba6=_0x141596[_0xbe91('0xe')];var _0x267fa4=_0x2daba6[_0xbe91('0x26')](-0x1);if(_0x267fa4==='/'||_0x267fa4==='\x5c'||_0x267fa4===':'){_0x2daba6=_0x2daba6[_0xbe91('0x12')](0x0,_0x2daba6[_0xbe91('0x13')](_0x267fa4));}switch(_0x141596[_0xbe91('0xd')]){case'US':_0x2fe8ac='https://accounts.zoho.com';break;case'AU':_0x2fe8ac='https://accounts.zoho.com.au';break;case'IN':_0x2fe8ac=_0xbe91('0x16');break;case'CN':_0x2fe8ac=_0xbe91('0x17');break;default:_0x2fe8ac=_0xbe91('0x18');break;}var _0x370dd2={'method':'POST','uri':_0x2fe8ac+_0xbe91('0x27'),'form':{'grant_type':_0xbe91('0x19'),'client_id':_0x141596[_0xbe91('0xf')],'client_secret':_0x141596['clientSecret'],'redirect_uri':_0x141596[_0xbe91('0xe')],'code':_0x141596[_0xbe91('0x1a')]},'headers':{'Content-Type':_0xbe91('0x1b')}};return rp(_0x370dd2)['then'](function(_0x580722){var _0x3294d7=JSON[_0xbe91('0x1d')](_0x580722);if(_0x3294d7[_0xbe91('0x1e')]){_0x141596[_0xbe91('0x28')]=_0x3294d7[_0xbe91('0x1e')];logger[_0xbe91('0x1f')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x141596[_0xbe91('0x21')],_0x141596['id']));}else{logger['error'](util[_0xbe91('0x23')](_0xbe91('0x24'),_0x141596[_0xbe91('0x21')],_0x141596['id']),util[_0xbe91('0x25')](_0x3294d7,{'showHidden':![],'depth':null}));}return _0x25cc96(null,_0xc433f6);})[_0xbe91('0x29')](function(_0x1262eb){logger[_0xbe91('0x22')](util[_0xbe91('0x23')](_0xbe91('0x24'),_0x141596[_0xbe91('0x21')],_0x141596['id']),util[_0xbe91('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x25cc96(_0x1262eb);});}else{return _0x25cc96(null,_0xc433f6);}}}});}; \ No newline at end of file +var _0xa99b=['catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','lastIndexOf','https://accounts.zoho.in','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','int_zoho_accounts','changed','zone','serverUrl','clientId','code','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xa99b,0x1f3));var _0xba99=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa99b[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0xba99('0x0'));var util=require('util');var logger=require(_0xba99('0x1'))('api');var moment=require('moment');var BPromise=require(_0xba99('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba99('0x3'));var rimraf=require(_0xba99('0x4'));var config=require(_0xba99('0x5'));var attributes=require(_0xba99('0x6'));var integrations=require(_0xba99('0x7'));module['exports']=function(_0x3400fe,_0x190149){return _0x3400fe['define']('ZohoAccount',attributes,{'tableName':_0xba99('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x908f04,_0x47d511,_0x356f0d){if(_0x908f04[_0xba99('0x9')](_0xba99('0xa'))||_0x908f04[_0xba99('0x9')](_0xba99('0xb'))||_0x908f04[_0xba99('0x9')](_0xba99('0xc'))||_0x908f04['changed']('clientSecret')||_0x908f04[_0xba99('0x9')](_0xba99('0xd'))||_0x908f04[_0xba99('0x9')]('host')){var _0x1ca943,_0x3bf31e;_0x1ca943=_0x908f04['serverUrl'];var _0x2327f8=_0x1ca943['slice'](-0x1);if(_0x2327f8==='/'||_0x2327f8==='\x5c'||_0x2327f8===':'){_0x1ca943=_0x1ca943[_0xba99('0xe')](0x0,_0x1ca943['lastIndexOf'](_0x2327f8));}switch(_0x908f04[_0xba99('0xa')]){case'US':_0x3bf31e=_0xba99('0xf');break;case'AU':_0x3bf31e=_0xba99('0x10');break;case'IN':_0x3bf31e='https://accounts.zoho.in';break;case'CN':_0x3bf31e=_0xba99('0x11');break;default:_0x3bf31e=_0xba99('0x12');break;}var _0x3b418e={'method':'POST','uri':_0x3bf31e+_0xba99('0x13'),'form':{'grant_type':_0xba99('0x14'),'client_id':_0x908f04[_0xba99('0xc')],'client_secret':_0x908f04[_0xba99('0x15')],'redirect_uri':_0x908f04[_0xba99('0xb')],'code':_0x908f04[_0xba99('0xd')]},'headers':{'Content-Type':_0xba99('0x16')}};return rp(_0x3b418e)[_0xba99('0x17')](function(_0x6704e2){var _0x2f0ed4=JSON[_0xba99('0x18')](_0x6704e2);if(_0x2f0ed4[_0xba99('0x19')]){_0x908f04[_0xba99('0x1a')]=_0x2f0ed4[_0xba99('0x19')];logger[_0xba99('0x1b')](util[_0xba99('0x1c')](_0xba99('0x1d'),_0x908f04[_0xba99('0x1e')],_0x908f04['id']));}else{logger[_0xba99('0x1f')](util[_0xba99('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x908f04[_0xba99('0x1e')],_0x908f04['id']),util[_0xba99('0x20')](_0x2f0ed4,{'showHidden':![],'depth':null}));}return _0x356f0d(null,_0x47d511);})[_0xba99('0x21')](function(_0x56d12d){logger[_0xba99('0x1f')](util[_0xba99('0x1c')](_0xba99('0x22'),_0x908f04[_0xba99('0x1e')],_0x908f04['id']),util[_0xba99('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x356f0d(_0x56d12d);});}else{return _0x356f0d(null,_0x47d511);}},'beforeUpdate':function(_0xfe1915,_0x5969dd,_0xb17824){if(_0xfe1915[_0xba99('0x9')](_0xba99('0xa'))||_0xfe1915[_0xba99('0x9')](_0xba99('0xb'))||_0xfe1915['changed'](_0xba99('0xc'))||_0xfe1915[_0xba99('0x9')]('clientSecret')||_0xfe1915[_0xba99('0x9')](_0xba99('0xd'))||_0xfe1915[_0xba99('0x9')](_0xba99('0x23'))){var _0x5c6248,_0x5c483c;_0x5c6248=_0xfe1915['serverUrl'];var _0x2e0fdb=_0x5c6248['slice'](-0x1);if(_0x2e0fdb==='/'||_0x2e0fdb==='\x5c'||_0x2e0fdb===':'){_0x5c6248=_0x5c6248[_0xba99('0xe')](0x0,_0x5c6248[_0xba99('0x24')](_0x2e0fdb));}switch(_0xfe1915[_0xba99('0xa')]){case'US':_0x5c483c=_0xba99('0xf');break;case'AU':_0x5c483c='https://accounts.zoho.com.au';break;case'IN':_0x5c483c=_0xba99('0x25');break;case'CN':_0x5c483c=_0xba99('0x11');break;default:_0x5c483c=_0xba99('0x12');break;}var _0x564b79={'method':'POST','uri':_0x5c483c+'/oauth/v2/token','form':{'grant_type':_0xba99('0x14'),'client_id':_0xfe1915[_0xba99('0xc')],'client_secret':_0xfe1915['clientSecret'],'redirect_uri':_0xfe1915[_0xba99('0xb')],'code':_0xfe1915[_0xba99('0xd')]},'headers':{'Content-Type':_0xba99('0x16')}};return rp(_0x564b79)[_0xba99('0x17')](function(_0x197fde){var _0x59bd75=JSON[_0xba99('0x18')](_0x197fde);if(_0x59bd75[_0xba99('0x19')]){_0xfe1915[_0xba99('0x1a')]=_0x59bd75[_0xba99('0x19')];logger[_0xba99('0x1b')](util[_0xba99('0x1c')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xfe1915['name'],_0xfe1915['id']));}else{logger[_0xba99('0x1f')](util[_0xba99('0x1c')](_0xba99('0x22'),_0xfe1915[_0xba99('0x1e')],_0xfe1915['id']),util[_0xba99('0x20')](_0x59bd75,{'showHidden':![],'depth':null}));}return _0xb17824(null,_0x5969dd);})['catch'](function(_0xdab533){logger[_0xba99('0x1f')](util['format'](_0xba99('0x22'),_0xfe1915[_0xba99('0x1e')],_0xfe1915['id']),util[_0xba99('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0xb17824(_0xdab533);});}else{return _0xb17824(null,_0x5969dd);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index fb67a34..ac2ddbc 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 _0x89fb=['ZohoAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','where','include','map','model','attributes','then','GetZohoAccount','ShowZohoAccount'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x89fb,0x14b));var _0xb89f=function(_0x1d7cd6,_0x4a1836){_0x1d7cd6=_0x1d7cd6-0x0;var _0x2675cf=_0x89fb[_0x1d7cd6];return _0x2675cf;};'use strict';var _=require('lodash');var util=require(_0xb89f('0x0'));var moment=require(_0xb89f('0x1'));var BPromise=require(_0xb89f('0x2'));var rs=require(_0xb89f('0x3'));var fs=require('fs');var Redis=require(_0xb89f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb89f('0x5'));var logger=require(_0xb89f('0x6'))(_0xb89f('0x7'));var config=require(_0xb89f('0x8'));var jayson=require(_0xb89f('0x9'));var client=jayson['client'][_0xb89f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b467c,_0x334236,_0x537685){return new BPromise(function(_0x3c0105,_0x95385){return client[_0xb89f('0xb')](_0x5b467c,_0x537685)['then'](function(_0x18f75f){logger[_0xb89f('0xc')](_0xb89f('0xd'),_0x334236,_0xb89f('0xe'));logger[_0xb89f('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x334236,'request\x20sent',JSON[_0xb89f('0x10')](_0x18f75f));if(_0x18f75f[_0xb89f('0x11')]){if(_0x18f75f[_0xb89f('0x11')][_0xb89f('0x12')]===0x1f4){logger[_0xb89f('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x334236,_0x18f75f[_0xb89f('0x11')][_0xb89f('0x13')]);return _0x95385(_0x18f75f[_0xb89f('0x11')][_0xb89f('0x13')]);}logger[_0xb89f('0x11')](_0xb89f('0xd'),_0x334236,_0x18f75f['error'][_0xb89f('0x13')]);return _0x3c0105(_0x18f75f[_0xb89f('0x11')][_0xb89f('0x13')]);}else{logger[_0xb89f('0xc')](_0xb89f('0xd'),_0x334236,_0xb89f('0xe'));_0x3c0105(_0x18f75f[_0xb89f('0x14')]['message']);}})[_0xb89f('0x15')](function(_0xfc48d){logger[_0xb89f('0x11')](_0xb89f('0xd'),_0x334236,_0xfc48d);_0x95385(_0xfc48d);});});}exports['GetZohoAccount']=function(_0x55c865){var _0x77a882=this;return new Promise(function(_0x3004b7,_0xc35f8){return db['ZohoAccount']['findAll']({'raw':_0x55c865[_0xb89f('0x16')]?_0x55c865[_0xb89f('0x16')][_0xb89f('0x17')]===undefined?!![]:![]:!![],'where':_0x55c865[_0xb89f('0x16')]?_0x55c865[_0xb89f('0x16')][_0xb89f('0x18')]||null:null,'attributes':_0x55c865[_0xb89f('0x16')]?_0x55c865['options']['attributes']||null:null,'limit':_0x55c865['options']?_0x55c865['options']['limit']||null:null,'include':_0x55c865[_0xb89f('0x16')]?_0x55c865['options'][_0xb89f('0x19')]?_[_0xb89f('0x1a')](_0x55c865[_0xb89f('0x16')][_0xb89f('0x19')],function(_0x19b881){return{'model':db[_0x19b881[_0xb89f('0x1b')]],'as':_0x19b881['as'],'attributes':_0x19b881['attributes'],'include':_0x19b881[_0xb89f('0x19')]?_[_0xb89f('0x1a')](_0x19b881[_0xb89f('0x19')],function(_0x3b3829){return{'model':db[_0x3b3829[_0xb89f('0x1b')]],'as':_0x3b3829['as'],'attributes':_0x3b3829[_0xb89f('0x1c')],'include':_0x3b3829[_0xb89f('0x19')]?_[_0xb89f('0x1a')](_0x3b3829['include'],function(_0x20b2b7){return{'model':db[_0x20b2b7[_0xb89f('0x1b')]],'as':_0x20b2b7['as'],'attributes':_0x20b2b7[_0xb89f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb89f('0x1d')](function(_0x1defa1){logger[_0xb89f('0xc')]('GetZohoAccount',_0x55c865);logger[_0xb89f('0xf')](_0xb89f('0x1e'),_0x55c865,JSON[_0xb89f('0x10')](_0x1defa1));_0x3004b7(_0x1defa1);})[_0xb89f('0x15')](function(_0x4eb8da){logger['error']('GetZohoAccount',_0x4eb8da[_0xb89f('0x13')],_0x55c865);_0xc35f8(_0x77a882[_0xb89f('0x11')](0x1f4,_0x4eb8da[_0xb89f('0x13')]));});});};exports[_0xb89f('0x1f')]=function(_0x283091){var _0x69713a=this;return new Promise(function(_0x215925,_0xfeaac7){return db[_0xb89f('0x20')]['find']({'raw':_0x283091[_0xb89f('0x16')]?_0x283091[_0xb89f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x283091[_0xb89f('0x16')]?_0x283091[_0xb89f('0x16')][_0xb89f('0x18')]||null:null,'attributes':_0x283091[_0xb89f('0x16')]?_0x283091['options'][_0xb89f('0x1c')]||null:null,'include':_0x283091[_0xb89f('0x16')]?_0x283091[_0xb89f('0x16')][_0xb89f('0x19')]?_['map'](_0x283091[_0xb89f('0x16')]['include'],function(_0x19d655){return{'model':db[_0x19d655[_0xb89f('0x1b')]],'as':_0x19d655['as'],'attributes':_0x19d655[_0xb89f('0x1c')],'include':_0x19d655['include']?_[_0xb89f('0x1a')](_0x19d655[_0xb89f('0x19')],function(_0x4539b8){return{'model':db[_0x4539b8['model']],'as':_0x4539b8['as'],'attributes':_0x4539b8[_0xb89f('0x1c')],'include':_0x4539b8[_0xb89f('0x19')]?_[_0xb89f('0x1a')](_0x4539b8[_0xb89f('0x19')],function(_0x2444d7){return{'model':db[_0x2444d7[_0xb89f('0x1b')]],'as':_0x2444d7['as'],'attributes':_0x2444d7[_0xb89f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb3c552){logger[_0xb89f('0xc')](_0xb89f('0x1f'),_0x283091);logger[_0xb89f('0xf')]('ShowZohoAccount',_0x283091,JSON[_0xb89f('0x10')](_0xb3c552));_0x215925(_0xb3c552);})['catch'](function(_0x388606){logger[_0xb89f('0x11')]('ShowZohoAccount',_0x388606[_0xb89f('0x13')],_0x283091);_0xfeaac7(_0x69713a[_0xb89f('0x11')](0x1f4,_0x388606[_0xb89f('0x13')]));});});}; \ No newline at end of file +var _0x5ae9=['rpc','jayson/promise','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','map','include','model','info','stringify','raw','ShowZohoAccount','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x593385,_0x5e1c24){var _0xcfa35c=function(_0x8fde1b){while(--_0x8fde1b){_0x593385['push'](_0x593385['shift']());}};_0xcfa35c(++_0x5e1c24);}(_0x5ae9,0x19b));var _0x95ae=function(_0x1fe140,_0x19263c){_0x1fe140=_0x1fe140-0x0;var _0x59877c=_0x5ae9[_0x1fe140];return _0x59877c;};'use strict';var _=require(_0x95ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x95ae('0x1'));var rs=require(_0x95ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95ae('0x3'))['db'];var utils=require(_0x95ae('0x4'));var logger=require('../../config/logger')(_0x95ae('0x5'));var config=require('../../config/environment');var jayson=require(_0x95ae('0x6'));var client=jayson[_0x95ae('0x7')][_0x95ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xec2c41,_0x3c4cda,_0x4df142){return new BPromise(function(_0x588bab,_0x19ba28){return client[_0x95ae('0x9')](_0xec2c41,_0x4df142)[_0x95ae('0xa')](function(_0x25b2ec){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x3c4cda,_0x95ae('0xb'));logger[_0x95ae('0xc')](_0x95ae('0xd'),_0x3c4cda,_0x95ae('0xb'),JSON['stringify'](_0x25b2ec));if(_0x25b2ec['error']){if(_0x25b2ec[_0x95ae('0xe')]['code']===0x1f4){logger[_0x95ae('0xe')](_0x95ae('0xf'),_0x3c4cda,_0x25b2ec['error'][_0x95ae('0x10')]);return _0x19ba28(_0x25b2ec[_0x95ae('0xe')][_0x95ae('0x10')]);}logger['error'](_0x95ae('0xf'),_0x3c4cda,_0x25b2ec[_0x95ae('0xe')][_0x95ae('0x10')]);return _0x588bab(_0x25b2ec['error'][_0x95ae('0x10')]);}else{logger['info'](_0x95ae('0xf'),_0x3c4cda,'request\x20sent');_0x588bab(_0x25b2ec[_0x95ae('0x11')][_0x95ae('0x10')]);}})[_0x95ae('0x12')](function(_0x11e960){logger[_0x95ae('0xe')](_0x95ae('0xf'),_0x3c4cda,_0x11e960);_0x19ba28(_0x11e960);});});}exports[_0x95ae('0x13')]=function(_0x24d5d2){var _0x3e1afc=this;return new Promise(function(_0x47ed05,_0x4ef50f){return db[_0x95ae('0x14')]['findAll']({'raw':_0x24d5d2[_0x95ae('0x15')]?_0x24d5d2[_0x95ae('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x24d5d2['options']?_0x24d5d2[_0x95ae('0x15')][_0x95ae('0x16')]||null:null,'attributes':_0x24d5d2[_0x95ae('0x15')]?_0x24d5d2[_0x95ae('0x15')][_0x95ae('0x17')]||null:null,'limit':_0x24d5d2['options']?_0x24d5d2[_0x95ae('0x15')][_0x95ae('0x18')]||null:null,'include':_0x24d5d2[_0x95ae('0x15')]?_0x24d5d2[_0x95ae('0x15')]['include']?_[_0x95ae('0x19')](_0x24d5d2['options'][_0x95ae('0x1a')],function(_0x59f88a){return{'model':db[_0x59f88a[_0x95ae('0x1b')]],'as':_0x59f88a['as'],'attributes':_0x59f88a[_0x95ae('0x17')],'include':_0x59f88a[_0x95ae('0x1a')]?_['map'](_0x59f88a[_0x95ae('0x1a')],function(_0x25d81c){return{'model':db[_0x25d81c[_0x95ae('0x1b')]],'as':_0x25d81c['as'],'attributes':_0x25d81c[_0x95ae('0x17')],'include':_0x25d81c[_0x95ae('0x1a')]?_['map'](_0x25d81c[_0x95ae('0x1a')],function(_0x4e2436){return{'model':db[_0x4e2436[_0x95ae('0x1b')]],'as':_0x4e2436['as'],'attributes':_0x4e2436[_0x95ae('0x17')]};}):[]};}):[]};}):[]:[]})[_0x95ae('0xa')](function(_0x51ba5d){logger[_0x95ae('0x1c')]('GetZohoAccount',_0x24d5d2);logger[_0x95ae('0xc')](_0x95ae('0x13'),_0x24d5d2,JSON[_0x95ae('0x1d')](_0x51ba5d));_0x47ed05(_0x51ba5d);})[_0x95ae('0x12')](function(_0x4fa625){logger[_0x95ae('0xe')](_0x95ae('0x13'),_0x4fa625[_0x95ae('0x10')],_0x24d5d2);_0x4ef50f(_0x3e1afc['error'](0x1f4,_0x4fa625[_0x95ae('0x10')]));});});};exports['ShowZohoAccount']=function(_0x4c44f4){var _0x4ab2db=this;return new Promise(function(_0x1820b4,_0x1e893e){return db[_0x95ae('0x14')]['find']({'raw':_0x4c44f4[_0x95ae('0x15')]?_0x4c44f4['options'][_0x95ae('0x1e')]===undefined?!![]:![]:!![],'where':_0x4c44f4[_0x95ae('0x15')]?_0x4c44f4['options'][_0x95ae('0x16')]||null:null,'attributes':_0x4c44f4['options']?_0x4c44f4[_0x95ae('0x15')][_0x95ae('0x17')]||null:null,'include':_0x4c44f4['options']?_0x4c44f4[_0x95ae('0x15')][_0x95ae('0x1a')]?_[_0x95ae('0x19')](_0x4c44f4[_0x95ae('0x15')][_0x95ae('0x1a')],function(_0xd0ce8){return{'model':db[_0xd0ce8[_0x95ae('0x1b')]],'as':_0xd0ce8['as'],'attributes':_0xd0ce8['attributes'],'include':_0xd0ce8['include']?_[_0x95ae('0x19')](_0xd0ce8[_0x95ae('0x1a')],function(_0x8ce95d){return{'model':db[_0x8ce95d[_0x95ae('0x1b')]],'as':_0x8ce95d['as'],'attributes':_0x8ce95d[_0x95ae('0x17')],'include':_0x8ce95d['include']?_[_0x95ae('0x19')](_0x8ce95d[_0x95ae('0x1a')],function(_0x5d58f3){return{'model':db[_0x5d58f3[_0x95ae('0x1b')]],'as':_0x5d58f3['as'],'attributes':_0x5d58f3[_0x95ae('0x17')]};}):[]};}):[]};}):[]:[]})[_0x95ae('0xa')](function(_0x4ebdbb){logger[_0x95ae('0x1c')](_0x95ae('0x1f'),_0x4c44f4);logger[_0x95ae('0xc')](_0x95ae('0x1f'),_0x4c44f4,JSON['stringify'](_0x4ebdbb));_0x1820b4(_0x4ebdbb);})[_0x95ae('0x12')](function(_0x50783e){logger[_0x95ae('0xe')](_0x95ae('0x1f'),_0x50783e[_0x95ae('0x10')],_0x4c44f4);_0x1e893e(_0x4ab2db[_0x95ae('0xe')](0x1f4,_0x50783e[_0x95ae('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 341e5a8..899e418 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 _0x5fa0=['getSubjects','/:id/descriptions','post','create','put','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/subjects'];(function(_0x364d6e,_0x34ea10){var _0x50018b=function(_0x2b3e5e){while(--_0x2b3e5e){_0x364d6e['push'](_0x364d6e['shift']());}};_0x50018b(++_0x34ea10);}(_0x5fa0,0xeb));var _0x05fa=function(_0x1508e2,_0x4b4f39){_0x1508e2=_0x1508e2-0x0;var _0x70a75c=_0x5fa0[_0x1508e2];return _0x70a75c;};'use strict';var multer=require('multer');var util=require(_0x05fa('0x0'));var path=require(_0x05fa('0x1'));var timeout=require(_0x05fa('0x2'));var express=require('express');var router=express[_0x05fa('0x3')]();var fs_extra=require(_0x05fa('0x4'));var auth=require(_0x05fa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x05fa('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x05fa('0x7')]('/',auth[_0x05fa('0x8')](),controller[_0x05fa('0x9')]);router[_0x05fa('0x7')](_0x05fa('0xa'),auth[_0x05fa('0x8')](),controller['show']);router[_0x05fa('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x05fa('0xb'),auth['isAuthenticated'](),controller[_0x05fa('0xc')]);router[_0x05fa('0x7')](_0x05fa('0xd'),auth[_0x05fa('0x8')](),controller['getDescriptions']);router[_0x05fa('0xe')]('/',auth[_0x05fa('0x8')](),controller[_0x05fa('0xf')]);router[_0x05fa('0x10')](_0x05fa('0xa'),auth[_0x05fa('0x8')](),controller['update']);router[_0x05fa('0x11')](_0x05fa('0xa'),auth[_0x05fa('0x8')](),controller['destroy']);module[_0x05fa('0x12')]=router; \ No newline at end of file +var _0x04e1=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index'];(function(_0x22e84a,_0x4ccf71){var _0x49dcb6=function(_0xa71727){while(--_0xa71727){_0x22e84a['push'](_0x22e84a['shift']());}};_0x49dcb6(++_0x4ccf71);}(_0x04e1,0xbd));var _0x104e=function(_0x3cea34,_0x459157){_0x3cea34=_0x3cea34-0x0;var _0x131d11=_0x04e1[_0x3cea34];return _0x131d11;};'use strict';var multer=require('multer');var util=require(_0x104e('0x0'));var path=require(_0x104e('0x1'));var timeout=require(_0x104e('0x2'));var express=require('express');var router=express[_0x104e('0x3')]();var fs_extra=require(_0x104e('0x4'));var auth=require(_0x104e('0x5'));var interaction=require(_0x104e('0x6'));var config=require(_0x104e('0x7'));var controller=require(_0x104e('0x8'));router[_0x104e('0x9')]('/',auth['isAuthenticated'](),controller[_0x104e('0xa')]);router['get']('/:id',auth[_0x104e('0xb')](),controller[_0x104e('0xc')]);router[_0x104e('0x9')](_0x104e('0xd'),auth['isAuthenticated'](),controller[_0x104e('0xe')]);router['get'](_0x104e('0xf'),auth['isAuthenticated'](),controller[_0x104e('0x10')]);router[_0x104e('0x9')](_0x104e('0x11'),auth['isAuthenticated'](),controller[_0x104e('0x12')]);router[_0x104e('0x13')]('/',auth[_0x104e('0xb')](),controller[_0x104e('0x14')]);router['put'](_0x104e('0x15'),auth[_0x104e('0xb')](),controller[_0x104e('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x104e('0x17')]);module[_0x104e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index bb4434d..a0eab4f 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 _0x02ee=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x2e32a5,_0xc5e0e4){var _0xeaf48a=function(_0x2a0592){while(--_0x2a0592){_0x2e32a5['push'](_0x2e32a5['shift']());}};_0xeaf48a(++_0xc5e0e4);}(_0x02ee,0x72));var _0xe02e=function(_0x1952c6,_0x1089d2){_0x1952c6=_0x1952c6-0x0;var _0x1c520b=_0x02ee[_0x1952c6];return _0x1c520b;};'use strict';var Sequelize=require(_0xe02e('0x0'));module[_0xe02e('0x1')]={'name':{'type':Sequelize[_0xe02e('0x2')]},'moduleCreate':{'type':Sequelize[_0xe02e('0x3')](_0xe02e('0x4'),_0xe02e('0x5'),_0xe02e('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe02e('0x3')](_0xe02e('0x7'),_0xe02e('0x5'),'lead'),'defaultValue':_0xe02e('0x7')},'description':{'type':Sequelize[_0xe02e('0x2')]}}; \ No newline at end of file +var _0x96b2=['contact_lead','exports','STRING','ENUM','contact','nothing','lead'];(function(_0x4c99e4,_0x266348){var _0x4bdd67=function(_0x1a6f36){while(--_0x1a6f36){_0x4c99e4['push'](_0x4c99e4['shift']());}};_0x4bdd67(++_0x266348);}(_0x96b2,0x1cf));var _0x296b=function(_0x50ff77,_0x47050c){_0x50ff77=_0x50ff77-0x0;var _0x4dd3c3=_0x96b2[_0x50ff77];return _0x4dd3c3;};'use strict';var Sequelize=require('sequelize');module[_0x296b('0x0')]={'name':{'type':Sequelize[_0x296b('0x1')]},'moduleCreate':{'type':Sequelize[_0x296b('0x2')]('lead',_0x296b('0x3'),_0x296b('0x4')),'defaultValue':_0x296b('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x296b('0x6'),_0x296b('0x3'),_0x296b('0x5')),'defaultValue':_0x296b('0x6')},'description':{'type':Sequelize[_0x296b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 437e1a2..0d30af5 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 _0xb5ad=['../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','map','ZohoConfiguration','fieldName','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','update','params','getFields','findOne','options','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xb5ad,0x1c5));var _0xdb5a=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0xb5ad[_0x3fb9dd];return _0x20136a;};'use strict';var emlformat=require(_0xdb5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb5a('0x1'));var jsonpatch=require(_0xdb5a('0x2'));var rp=require('request-promise');var moment=require(_0xdb5a('0x3'));var BPromise=require(_0xdb5a('0x4'));var Mustache=require(_0xdb5a('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdb5a('0x6'));var csv=require(_0xdb5a('0x7'));var ejs=require(_0xdb5a('0x8'));var fs=require('fs');var fs_extra=require(_0xdb5a('0x9'));var _=require('lodash');var squel=require(_0xdb5a('0xa'));var crypto=require('crypto');var jsforce=require(_0xdb5a('0xb'));var deskjs=require(_0xdb5a('0xc'));var toCsv=require(_0xdb5a('0x7'));var querystring=require('querystring');var Papa=require(_0xdb5a('0xd'));var Redis=require(_0xdb5a('0xe'));var authService=require(_0xdb5a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb5a('0x10'));var logger=require(_0xdb5a('0x11'))(_0xdb5a('0x12'));var utils=require(_0xdb5a('0x13'));var config=require(_0xdb5a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb5a('0x15'))['db'];function respondWithStatusCode(_0x37110c,_0x49a2a6){_0x49a2a6=_0x49a2a6||0xcc;return function(_0x3fc2b6){if(_0x3fc2b6){return _0x37110c[_0xdb5a('0x16')](_0x49a2a6);}return _0x37110c[_0xdb5a('0x17')](_0x49a2a6)['end']();};}function respondWithResult(_0x278f0a,_0x484122){_0x484122=_0x484122||0xc8;return function(_0x527ff2){if(_0x527ff2){return _0x278f0a[_0xdb5a('0x17')](_0x484122)['json'](_0x527ff2);}};}function respondWithFilteredResult(_0x11e51a,_0x232b80){return function(_0x5e97ca){if(_0x5e97ca){var _0x7d4077=typeof _0x232b80['offset']===_0xdb5a('0x18')&&typeof _0x232b80[_0xdb5a('0x19')]===_0xdb5a('0x18');var _0x1b6c27=_0x5e97ca[_0xdb5a('0x1a')];var _0xda7a71=_0x7d4077?0x0:_0x232b80[_0xdb5a('0x1b')];var _0xed7175=_0x7d4077?_0x5e97ca['count']:_0x232b80[_0xdb5a('0x1b')]+_0x232b80['limit'];var _0x193ce8;if(_0xed7175>=_0x1b6c27){_0xed7175=_0x1b6c27;_0x193ce8=0xc8;}else{_0x193ce8=0xce;}_0x11e51a['status'](_0x193ce8);return _0x11e51a[_0xdb5a('0x1c')](_0xdb5a('0x1d'),_0xda7a71+'-'+_0xed7175+'/'+_0x1b6c27)[_0xdb5a('0x1e')](_0x5e97ca);}return null;};}function patchUpdates(_0x1d3e92){return function(_0x455c2e){try{jsonpatch['apply'](_0x455c2e,_0x1d3e92,!![]);}catch(_0x1869d4){return BPromise[_0xdb5a('0x1f')](_0x1869d4);}return _0x455c2e[_0xdb5a('0x20')]();};}function saveUpdates(_0x4c459c,_0x163ab5){return function(_0x4b0a99){if(_0x4b0a99){return _0x4b0a99['update'](_0x4c459c)[_0xdb5a('0x21')](function(_0x5beb53){return _0x5beb53;});}return null;};}function removeEntity(_0x3edede,_0x5343e0){return function(_0x3052c8){if(_0x3052c8){return _0x3052c8[_0xdb5a('0x22')]()[_0xdb5a('0x21')](function(){_0x3edede[_0xdb5a('0x17')](0xcc)[_0xdb5a('0x23')]();});}};}function handleEntityNotFound(_0x4a5bf4,_0x2a4b8b){return function(_0x1c8aba){if(!_0x1c8aba){_0x4a5bf4[_0xdb5a('0x16')](0x194);}return _0x1c8aba;};}function handleError(_0x34b355,_0x4740d2){_0x4740d2=_0x4740d2||0x1f4;return function(_0x2609ed){logger[_0xdb5a('0x24')](_0x2609ed[_0xdb5a('0x25')]);if(_0x2609ed[_0xdb5a('0x26')]){delete _0x2609ed['name'];}_0x34b355['status'](_0x4740d2)['send'](_0x2609ed);};}exports['index']=function(_0x5d1f5d,_0x27e0c9){var _0xfc8955={},_0xaa97aa={},_0x29f79c={'count':0x0,'rows':[]};var _0x5c20fd=_[_0xdb5a('0x27')](db[_0xdb5a('0x28')]['rawAttributes'],function(_0x3b7afa){return{'name':_0x3b7afa[_0xdb5a('0x29')],'type':_0x3b7afa['type'][_0xdb5a('0x2a')]};});_0xaa97aa['model']=_[_0xdb5a('0x27')](_0x5c20fd,_0xdb5a('0x26'));_0xaa97aa[_0xdb5a('0x2b')]=_[_0xdb5a('0x2c')](_0x5d1f5d[_0xdb5a('0x2b')]);_0xaa97aa['filters']=_['intersection'](_0xaa97aa[_0xdb5a('0x2d')],_0xaa97aa[_0xdb5a('0x2b')]);_0xfc8955['attributes']=_[_0xdb5a('0x2e')](_0xaa97aa[_0xdb5a('0x2d')],qs[_0xdb5a('0x2f')](_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x2f')]));_0xfc8955[_0xdb5a('0x30')]=_0xfc8955[_0xdb5a('0x30')][_0xdb5a('0x31')]?_0xfc8955[_0xdb5a('0x30')]:_0xaa97aa[_0xdb5a('0x2d')];if(!_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x32')](_0xdb5a('0x33'))){_0xfc8955[_0xdb5a('0x19')]=qs[_0xdb5a('0x19')](_0x5d1f5d[_0xdb5a('0x2b')]['limit']);_0xfc8955[_0xdb5a('0x1b')]=qs[_0xdb5a('0x1b')](_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x1b')]);}_0xfc8955[_0xdb5a('0x34')]=qs[_0xdb5a('0x35')](_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x35')]);_0xfc8955[_0xdb5a('0x36')]=qs[_0xdb5a('0x37')](_[_0xdb5a('0x38')](_0x5d1f5d[_0xdb5a('0x2b')],_0xaa97aa['filters']),_0x5c20fd);if(_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x39')]){_0xfc8955[_0xdb5a('0x36')]=_[_0xdb5a('0x3a')](_0xfc8955[_0xdb5a('0x36')],{'$or':_[_0xdb5a('0x27')](_0x5c20fd,function(_0x58d61e){if(_0x58d61e[_0xdb5a('0x3b')]!==_0xdb5a('0x3c')){var _0x16391f={};_0x16391f[_0x58d61e[_0xdb5a('0x26')]]={'$like':'%'+_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x39')]+'%'};return _0x16391f;}})});}_0xfc8955=_[_0xdb5a('0x3a')]({},_0xfc8955,_0x5d1f5d['options']);var _0x373429={'where':_0xfc8955[_0xdb5a('0x36')]};return db[_0xdb5a('0x28')][_0xdb5a('0x1a')](_0x373429)['then'](function(_0x3b34a7){_0x29f79c[_0xdb5a('0x1a')]=_0x3b34a7;if(_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x3d')]){_0xfc8955['include']=[{'all':!![]}];}return db[_0xdb5a('0x28')][_0xdb5a('0x3e')](_0xfc8955);})[_0xdb5a('0x21')](function(_0x5c577c){_0x29f79c[_0xdb5a('0x3f')]=_0x5c577c;return _0x29f79c;})[_0xdb5a('0x21')](respondWithFilteredResult(_0x27e0c9,_0xfc8955))[_0xdb5a('0x40')](handleError(_0x27e0c9,null));};exports[_0xdb5a('0x41')]=function(_0x365fda,_0x31e0e8){var _0xf8ada6={'raw':![],'where':{'id':_0x365fda['params']['id']}},_0x27bb57={};_0x27bb57[_0xdb5a('0x2d')]=_[_0xdb5a('0x2c')](db['ZohoConfiguration'][_0xdb5a('0x42')]);_0x27bb57[_0xdb5a('0x2b')]=_['keys'](_0x365fda[_0xdb5a('0x2b')]);_0x27bb57[_0xdb5a('0x37')]=_[_0xdb5a('0x2e')](_0x27bb57[_0xdb5a('0x2d')],_0x27bb57['query']);_0xf8ada6[_0xdb5a('0x30')]=_['intersection'](_0x27bb57['model'],qs[_0xdb5a('0x2f')](_0x365fda[_0xdb5a('0x2b')][_0xdb5a('0x2f')]));_0xf8ada6['attributes']=_0xf8ada6[_0xdb5a('0x30')][_0xdb5a('0x31')]?_0xf8ada6['attributes']:_0x27bb57[_0xdb5a('0x2d')];if(_0x365fda[_0xdb5a('0x2b')]['includeAll']){_0xf8ada6[_0xdb5a('0x43')]=[{'all':!![]}];}_0xf8ada6=_[_0xdb5a('0x3a')]({},_0xf8ada6,_0x365fda['options']);return db['ZohoConfiguration'][_0xdb5a('0x44')](_0xf8ada6)[_0xdb5a('0x21')](handleEntityNotFound(_0x31e0e8,null))[_0xdb5a('0x21')](respondWithResult(_0x31e0e8,null))[_0xdb5a('0x40')](handleError(_0x31e0e8,null));};exports[_0xdb5a('0x45')]=function(_0x2c8579,_0x191e8f){return db[_0xdb5a('0x28')][_0xdb5a('0x45')](_0x2c8579[_0xdb5a('0x46')],{})[_0xdb5a('0x21')](respondWithResult(_0x191e8f,0xc9))[_0xdb5a('0x40')](handleError(_0x191e8f,null));};exports[_0xdb5a('0x47')]=function(_0x36a15d,_0x5dc9eb){if(_0x36a15d[_0xdb5a('0x46')]['id']){delete _0x36a15d['body']['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x36a15d[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x5dc9eb,null))['then'](saveUpdates(_0x36a15d['body'],null))[_0xdb5a('0x21')](respondWithResult(_0x5dc9eb,null))[_0xdb5a('0x40')](handleError(_0x5dc9eb,null));};exports[_0xdb5a('0x22')]=function(_0xc263a7,_0x2de265){return db[_0xdb5a('0x28')][_0xdb5a('0x44')]({'where':{'id':_0xc263a7[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x2de265,null))[_0xdb5a('0x21')](removeEntity(_0x2de265,null))[_0xdb5a('0x40')](handleError(_0x2de265,null));};exports[_0xdb5a('0x49')]=function(_0x2a42d3,_0x1cfb0e,_0x11192f){var _0x36a2e2={};var _0x1c77f1={};var _0x72face;var _0x16ebe5;return db[_0xdb5a('0x28')][_0xdb5a('0x4a')]({'where':{'id':_0x2a42d3[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x1cfb0e,null))['then'](function(_0x42cf2c){if(_0x42cf2c){_0x72face=_0x42cf2c;_0x1c77f1['model']=_[_0xdb5a('0x2c')](db['ZohoField'][_0xdb5a('0x42')]);_0x1c77f1[_0xdb5a('0x2b')]=_['keys'](_0x2a42d3[_0xdb5a('0x2b')]);_0x1c77f1[_0xdb5a('0x37')]=_[_0xdb5a('0x2e')](_0x1c77f1[_0xdb5a('0x2d')],_0x1c77f1[_0xdb5a('0x2b')]);_0x36a2e2['attributes']=_[_0xdb5a('0x2e')](_0x1c77f1[_0xdb5a('0x2d')],qs[_0xdb5a('0x2f')](_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x2f')]));_0x36a2e2[_0xdb5a('0x30')]=_0x36a2e2[_0xdb5a('0x30')][_0xdb5a('0x31')]?_0x36a2e2['attributes']:_0x1c77f1[_0xdb5a('0x2d')];_0x36a2e2[_0xdb5a('0x34')]=qs[_0xdb5a('0x35')](_0x2a42d3['query'][_0xdb5a('0x35')]);_0x36a2e2[_0xdb5a('0x36')]=qs[_0xdb5a('0x37')](_['pick'](_0x2a42d3[_0xdb5a('0x2b')],_0x1c77f1['filters']));if(_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x39')]){_0x36a2e2[_0xdb5a('0x36')]=_['merge'](_0x36a2e2[_0xdb5a('0x36')],{'$or':_[_0xdb5a('0x27')](_0x36a2e2[_0xdb5a('0x30')],function(_0x25f02a){var _0x3ba9b1={};_0x3ba9b1[_0x25f02a]={'$like':'%'+_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x39')]+'%'};return _0x3ba9b1;})});}_0x36a2e2=_[_0xdb5a('0x3a')]({},_0x36a2e2,_0x2a42d3[_0xdb5a('0x4b')]);return _0x72face['getFields'](_0x36a2e2);}})[_0xdb5a('0x21')](function(_0x4e74e2){if(_0x4e74e2){_0x16ebe5=_0x4e74e2[_0xdb5a('0x31')];if(!_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x32')]('nolimit')){_0x36a2e2['limit']=qs[_0xdb5a('0x19')](_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x19')]);_0x36a2e2[_0xdb5a('0x1b')]=qs[_0xdb5a('0x1b')](_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x1b')]);}return _0x72face[_0xdb5a('0x49')](_0x36a2e2);}})[_0xdb5a('0x21')](function(_0x215181){if(_0x215181){return _0x215181?{'count':_0x16ebe5,'rows':_0x215181}:null;}})[_0xdb5a('0x21')](respondWithResult(_0x1cfb0e,null))[_0xdb5a('0x40')](handleError(_0x1cfb0e,null));};exports['getSubjects']=function(_0x1a2853,_0x5510db,_0x963ea7){var _0x473e83={};var _0x92127d={};var _0x1d9ccd;var _0x10a925;return db[_0xdb5a('0x28')][_0xdb5a('0x4a')]({'where':{'id':_0x1a2853[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x5510db,null))[_0xdb5a('0x21')](function(_0x51c65b){if(_0x51c65b){_0x1d9ccd=_0x51c65b;_0x92127d['model']=_[_0xdb5a('0x2c')](db[_0xdb5a('0x4c')][_0xdb5a('0x42')]);_0x92127d[_0xdb5a('0x2b')]=_['keys'](_0x1a2853[_0xdb5a('0x2b')]);_0x92127d['filters']=_[_0xdb5a('0x2e')](_0x92127d[_0xdb5a('0x2d')],_0x92127d[_0xdb5a('0x2b')]);_0x473e83[_0xdb5a('0x30')]=_[_0xdb5a('0x2e')](_0x92127d[_0xdb5a('0x2d')],qs['fields'](_0x1a2853[_0xdb5a('0x2b')]['fields']));_0x473e83['attributes']=_0x473e83[_0xdb5a('0x30')][_0xdb5a('0x31')]?_0x473e83[_0xdb5a('0x30')]:_0x92127d[_0xdb5a('0x2d')];_0x473e83['order']=qs[_0xdb5a('0x35')](_0x1a2853[_0xdb5a('0x2b')][_0xdb5a('0x35')]);_0x473e83[_0xdb5a('0x36')]=qs[_0xdb5a('0x37')](_[_0xdb5a('0x38')](_0x1a2853[_0xdb5a('0x2b')],_0x92127d[_0xdb5a('0x37')]));if(_0x1a2853[_0xdb5a('0x2b')]['filter']){_0x473e83['where']=_[_0xdb5a('0x3a')](_0x473e83[_0xdb5a('0x36')],{'$or':_['map'](_0x473e83[_0xdb5a('0x30')],function(_0x2a3d3a){var _0x496969={};_0x496969[_0x2a3d3a]={'$like':'%'+_0x1a2853[_0xdb5a('0x2b')][_0xdb5a('0x39')]+'%'};return _0x496969;})});}_0x473e83=_['merge']({},_0x473e83,_0x1a2853[_0xdb5a('0x4b')]);return _0x1d9ccd[_0xdb5a('0x4d')](_0x473e83);}})['then'](function(_0x224814){if(_0x224814){_0x10a925=_0x224814[_0xdb5a('0x31')];if(!_0x1a2853[_0xdb5a('0x2b')][_0xdb5a('0x32')](_0xdb5a('0x33'))){_0x473e83[_0xdb5a('0x19')]=qs[_0xdb5a('0x19')](_0x1a2853[_0xdb5a('0x2b')][_0xdb5a('0x19')]);_0x473e83['offset']=qs[_0xdb5a('0x1b')](_0x1a2853['query']['offset']);}return _0x1d9ccd[_0xdb5a('0x4d')](_0x473e83);}})[_0xdb5a('0x21')](function(_0x3970a3){if(_0x3970a3){return _0x3970a3?{'count':_0x10a925,'rows':_0x3970a3}:null;}})['then'](respondWithResult(_0x5510db,null))[_0xdb5a('0x40')](handleError(_0x5510db,null));};exports[_0xdb5a('0x4e')]=function(_0x54166a,_0x3cf7fb,_0xba5238){var _0x524b3d={};var _0x214e2b={};var _0x11836b;var _0x559de4;return db[_0xdb5a('0x28')][_0xdb5a('0x4a')]({'where':{'id':_0x54166a[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x3cf7fb,null))[_0xdb5a('0x21')](function(_0x500ce8){if(_0x500ce8){_0x11836b=_0x500ce8;_0x214e2b[_0xdb5a('0x2d')]=_['keys'](db[_0xdb5a('0x4c')][_0xdb5a('0x42')]);_0x214e2b[_0xdb5a('0x2b')]=_[_0xdb5a('0x2c')](_0x54166a['query']);_0x214e2b[_0xdb5a('0x37')]=_[_0xdb5a('0x2e')](_0x214e2b[_0xdb5a('0x2d')],_0x214e2b[_0xdb5a('0x2b')]);_0x524b3d[_0xdb5a('0x30')]=_[_0xdb5a('0x2e')](_0x214e2b[_0xdb5a('0x2d')],qs[_0xdb5a('0x2f')](_0x54166a[_0xdb5a('0x2b')][_0xdb5a('0x2f')]));_0x524b3d[_0xdb5a('0x30')]=_0x524b3d[_0xdb5a('0x30')]['length']?_0x524b3d['attributes']:_0x214e2b[_0xdb5a('0x2d')];_0x524b3d[_0xdb5a('0x34')]=qs[_0xdb5a('0x35')](_0x54166a['query'][_0xdb5a('0x35')]);_0x524b3d[_0xdb5a('0x36')]=qs[_0xdb5a('0x37')](_[_0xdb5a('0x38')](_0x54166a['query'],_0x214e2b['filters']));if(_0x54166a[_0xdb5a('0x2b')][_0xdb5a('0x39')]){_0x524b3d[_0xdb5a('0x36')]=_[_0xdb5a('0x3a')](_0x524b3d[_0xdb5a('0x36')],{'$or':_['map'](_0x524b3d[_0xdb5a('0x30')],function(_0x540758){var _0x57213a={};_0x57213a[_0x540758]={'$like':'%'+_0x54166a[_0xdb5a('0x2b')]['filter']+'%'};return _0x57213a;})});}_0x524b3d=_[_0xdb5a('0x3a')]({},_0x524b3d,_0x54166a[_0xdb5a('0x4b')]);return _0x11836b[_0xdb5a('0x4e')](_0x524b3d);}})[_0xdb5a('0x21')](function(_0xcea06d){if(_0xcea06d){_0x559de4=_0xcea06d['length'];if(!_0x54166a[_0xdb5a('0x2b')][_0xdb5a('0x32')](_0xdb5a('0x33'))){_0x524b3d['limit']=qs[_0xdb5a('0x19')](_0x54166a[_0xdb5a('0x2b')][_0xdb5a('0x19')]);_0x524b3d[_0xdb5a('0x1b')]=qs['offset'](_0x54166a['query'][_0xdb5a('0x1b')]);}return _0x11836b[_0xdb5a('0x4e')](_0x524b3d);}})[_0xdb5a('0x21')](function(_0x266e28){if(_0x266e28){return _0x266e28?{'count':_0x559de4,'rows':_0x266e28}:null;}})['then'](respondWithResult(_0x3cf7fb,null))['catch'](handleError(_0x3cf7fb,null));}; \ No newline at end of file +var _0x4c6e=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','findOne','getFields','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x2eaa2d,_0xb29eb9){var _0x576fbe=function(_0x373199){while(--_0x373199){_0x2eaa2d['push'](_0x2eaa2d['shift']());}};_0x576fbe(++_0xb29eb9);}(_0x4c6e,0x1ef));var _0xe4c6=function(_0x3b6283,_0x59f8f3){_0x3b6283=_0x3b6283-0x0;var _0x28b56d=_0x4c6e[_0x3b6283];return _0x28b56d;};'use strict';var emlformat=require(_0xe4c6('0x0'));var rimraf=require(_0xe4c6('0x1'));var zipdir=require(_0xe4c6('0x2'));var jsonpatch=require(_0xe4c6('0x3'));var rp=require('request-promise');var moment=require(_0xe4c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe4c6('0x5'));var util=require(_0xe4c6('0x6'));var path=require(_0xe4c6('0x7'));var sox=require(_0xe4c6('0x8'));var csv=require('to-csv');var ejs=require(_0xe4c6('0x9'));var fs=require('fs');var fs_extra=require(_0xe4c6('0xa'));var _=require('lodash');var squel=require(_0xe4c6('0xb'));var crypto=require('crypto');var jsforce=require(_0xe4c6('0xc'));var deskjs=require(_0xe4c6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe4c6('0xe'));var Papa=require(_0xe4c6('0xf'));var Redis=require(_0xe4c6('0x10'));var authService=require(_0xe4c6('0x11'));var qs=require(_0xe4c6('0x12'));var as=require(_0xe4c6('0x13'));var hardwareService=require(_0xe4c6('0x14'));var logger=require(_0xe4c6('0x15'))('api');var utils=require(_0xe4c6('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9c414d,_0xb3e153){_0xb3e153=_0xb3e153||0xcc;return function(_0x26ed33){if(_0x26ed33){return _0x9c414d['sendStatus'](_0xb3e153);}return _0x9c414d[_0xe4c6('0x17')](_0xb3e153)[_0xe4c6('0x18')]();};}function respondWithResult(_0x4cb440,_0x14586e){_0x14586e=_0x14586e||0xc8;return function(_0x22066c){if(_0x22066c){return _0x4cb440[_0xe4c6('0x17')](_0x14586e)[_0xe4c6('0x19')](_0x22066c);}};}function respondWithFilteredResult(_0x58bb3d,_0x5f1368){return function(_0x477289){if(_0x477289){var _0x27baa4=typeof _0x5f1368[_0xe4c6('0x1a')]===_0xe4c6('0x1b')&&typeof _0x5f1368[_0xe4c6('0x1c')]===_0xe4c6('0x1b');var _0x51c5f7=_0x477289[_0xe4c6('0x1d')];var _0x5957bb=_0x27baa4?0x0:_0x5f1368[_0xe4c6('0x1a')];var _0x4b5d8f=_0x27baa4?_0x477289[_0xe4c6('0x1d')]:_0x5f1368[_0xe4c6('0x1a')]+_0x5f1368[_0xe4c6('0x1c')];var _0x219fd3;if(_0x4b5d8f>=_0x51c5f7){_0x4b5d8f=_0x51c5f7;_0x219fd3=0xc8;}else{_0x219fd3=0xce;}_0x58bb3d[_0xe4c6('0x17')](_0x219fd3);return _0x58bb3d[_0xe4c6('0x1e')](_0xe4c6('0x1f'),_0x5957bb+'-'+_0x4b5d8f+'/'+_0x51c5f7)[_0xe4c6('0x19')](_0x477289);}return null;};}function patchUpdates(_0x36c338){return function(_0x410efe){try{jsonpatch[_0xe4c6('0x20')](_0x410efe,_0x36c338,!![]);}catch(_0x3af663){return BPromise[_0xe4c6('0x21')](_0x3af663);}return _0x410efe[_0xe4c6('0x22')]();};}function saveUpdates(_0x213663,_0xe456d4){return function(_0x3672f4){if(_0x3672f4){return _0x3672f4[_0xe4c6('0x23')](_0x213663)[_0xe4c6('0x24')](function(_0x2e0fe3){return _0x2e0fe3;});}return null;};}function removeEntity(_0x2a77d1,_0x208825){return function(_0x64cf8b){if(_0x64cf8b){return _0x64cf8b[_0xe4c6('0x25')]()[_0xe4c6('0x24')](function(){_0x2a77d1[_0xe4c6('0x17')](0xcc)[_0xe4c6('0x18')]();});}};}function handleEntityNotFound(_0x5df756,_0xdc8085){return function(_0x7c09be){if(!_0x7c09be){_0x5df756[_0xe4c6('0x26')](0x194);}return _0x7c09be;};}function handleError(_0x42383b,_0x28badb){_0x28badb=_0x28badb||0x1f4;return function(_0x5cc3f5){logger[_0xe4c6('0x27')](_0x5cc3f5[_0xe4c6('0x28')]);if(_0x5cc3f5[_0xe4c6('0x29')]){delete _0x5cc3f5[_0xe4c6('0x29')];}_0x42383b[_0xe4c6('0x17')](_0x28badb)[_0xe4c6('0x2a')](_0x5cc3f5);};}exports['index']=function(_0x42e705,_0x2f6d60){var _0x536883={},_0x173c8c={},_0x1dcb97={'count':0x0,'rows':[]};var _0x572174=_[_0xe4c6('0x2b')](db[_0xe4c6('0x2c')][_0xe4c6('0x2d')],function(_0x658b22){return{'name':_0x658b22[_0xe4c6('0x2e')],'type':_0x658b22[_0xe4c6('0x2f')]['key']};});_0x173c8c[_0xe4c6('0x30')]=_[_0xe4c6('0x2b')](_0x572174,_0xe4c6('0x29'));_0x173c8c[_0xe4c6('0x31')]=_[_0xe4c6('0x32')](_0x42e705[_0xe4c6('0x31')]);_0x173c8c[_0xe4c6('0x33')]=_[_0xe4c6('0x34')](_0x173c8c[_0xe4c6('0x30')],_0x173c8c[_0xe4c6('0x31')]);_0x536883[_0xe4c6('0x35')]=_[_0xe4c6('0x34')](_0x173c8c['model'],qs[_0xe4c6('0x36')](_0x42e705[_0xe4c6('0x31')][_0xe4c6('0x36')]));_0x536883['attributes']=_0x536883[_0xe4c6('0x35')]['length']?_0x536883[_0xe4c6('0x35')]:_0x173c8c['model'];if(!_0x42e705[_0xe4c6('0x31')][_0xe4c6('0x37')](_0xe4c6('0x38'))){_0x536883[_0xe4c6('0x1c')]=qs[_0xe4c6('0x1c')](_0x42e705[_0xe4c6('0x31')]['limit']);_0x536883[_0xe4c6('0x1a')]=qs[_0xe4c6('0x1a')](_0x42e705[_0xe4c6('0x31')][_0xe4c6('0x1a')]);}_0x536883[_0xe4c6('0x39')]=qs[_0xe4c6('0x3a')](_0x42e705[_0xe4c6('0x31')]['sort']);_0x536883[_0xe4c6('0x3b')]=qs[_0xe4c6('0x33')](_[_0xe4c6('0x3c')](_0x42e705[_0xe4c6('0x31')],_0x173c8c[_0xe4c6('0x33')]),_0x572174);if(_0x42e705[_0xe4c6('0x31')][_0xe4c6('0x3d')]){_0x536883[_0xe4c6('0x3b')]=_[_0xe4c6('0x3e')](_0x536883[_0xe4c6('0x3b')],{'$or':_[_0xe4c6('0x2b')](_0x572174,function(_0x26a545){if(_0x26a545[_0xe4c6('0x2f')]!==_0xe4c6('0x3f')){var _0x2ad8ed={};_0x2ad8ed[_0x26a545['name']]={'$like':'%'+_0x42e705[_0xe4c6('0x31')][_0xe4c6('0x3d')]+'%'};return _0x2ad8ed;}})});}_0x536883=_[_0xe4c6('0x3e')]({},_0x536883,_0x42e705[_0xe4c6('0x40')]);var _0x59d196={'where':_0x536883['where']};return db[_0xe4c6('0x2c')][_0xe4c6('0x1d')](_0x59d196)[_0xe4c6('0x24')](function(_0x591df4){_0x1dcb97[_0xe4c6('0x1d')]=_0x591df4;if(_0x42e705[_0xe4c6('0x31')][_0xe4c6('0x41')]){_0x536883[_0xe4c6('0x42')]=[{'all':!![]}];}return db[_0xe4c6('0x2c')]['findAll'](_0x536883);})['then'](function(_0x37605f){_0x1dcb97[_0xe4c6('0x43')]=_0x37605f;return _0x1dcb97;})[_0xe4c6('0x24')](respondWithFilteredResult(_0x2f6d60,_0x536883))[_0xe4c6('0x44')](handleError(_0x2f6d60,null));};exports['show']=function(_0x199859,_0x3f468c){var _0x592f78={'raw':![],'where':{'id':_0x199859[_0xe4c6('0x45')]['id']}},_0x86a70c={};_0x86a70c[_0xe4c6('0x30')]=_['keys'](db[_0xe4c6('0x2c')][_0xe4c6('0x2d')]);_0x86a70c[_0xe4c6('0x31')]=_[_0xe4c6('0x32')](_0x199859[_0xe4c6('0x31')]);_0x86a70c[_0xe4c6('0x33')]=_['intersection'](_0x86a70c['model'],_0x86a70c[_0xe4c6('0x31')]);_0x592f78[_0xe4c6('0x35')]=_['intersection'](_0x86a70c['model'],qs[_0xe4c6('0x36')](_0x199859[_0xe4c6('0x31')][_0xe4c6('0x36')]));_0x592f78[_0xe4c6('0x35')]=_0x592f78['attributes'][_0xe4c6('0x46')]?_0x592f78[_0xe4c6('0x35')]:_0x86a70c['model'];if(_0x199859[_0xe4c6('0x31')][_0xe4c6('0x41')]){_0x592f78['include']=[{'all':!![]}];}_0x592f78=_[_0xe4c6('0x3e')]({},_0x592f78,_0x199859[_0xe4c6('0x40')]);return db['ZohoConfiguration'][_0xe4c6('0x47')](_0x592f78)['then'](handleEntityNotFound(_0x3f468c,null))[_0xe4c6('0x24')](respondWithResult(_0x3f468c,null))[_0xe4c6('0x44')](handleError(_0x3f468c,null));};exports[_0xe4c6('0x48')]=function(_0x4daccf,_0x3d3a33){return db[_0xe4c6('0x2c')][_0xe4c6('0x48')](_0x4daccf[_0xe4c6('0x49')],{})[_0xe4c6('0x24')](respondWithResult(_0x3d3a33,0xc9))['catch'](handleError(_0x3d3a33,null));};exports[_0xe4c6('0x23')]=function(_0x1c8cfd,_0x4dc584){if(_0x1c8cfd[_0xe4c6('0x49')]['id']){delete _0x1c8cfd[_0xe4c6('0x49')]['id'];}return db[_0xe4c6('0x2c')][_0xe4c6('0x47')]({'where':{'id':_0x1c8cfd[_0xe4c6('0x45')]['id']}})[_0xe4c6('0x24')](handleEntityNotFound(_0x4dc584,null))[_0xe4c6('0x24')](saveUpdates(_0x1c8cfd['body'],null))[_0xe4c6('0x24')](respondWithResult(_0x4dc584,null))[_0xe4c6('0x44')](handleError(_0x4dc584,null));};exports[_0xe4c6('0x25')]=function(_0x478971,_0xcb6710){return db[_0xe4c6('0x2c')][_0xe4c6('0x47')]({'where':{'id':_0x478971[_0xe4c6('0x45')]['id']}})[_0xe4c6('0x24')](handleEntityNotFound(_0xcb6710,null))[_0xe4c6('0x24')](removeEntity(_0xcb6710,null))[_0xe4c6('0x44')](handleError(_0xcb6710,null));};exports['getFields']=function(_0x2eeafc,_0x2491ab,_0x9e2e1c){var _0x3f4f50={};var _0x15faf8={};var _0x3ae7e3;var _0x960125;return db[_0xe4c6('0x2c')][_0xe4c6('0x4a')]({'where':{'id':_0x2eeafc[_0xe4c6('0x45')]['id']}})['then'](handleEntityNotFound(_0x2491ab,null))[_0xe4c6('0x24')](function(_0x44fdb3){if(_0x44fdb3){_0x3ae7e3=_0x44fdb3;_0x15faf8[_0xe4c6('0x30')]=_[_0xe4c6('0x32')](db['ZohoField'][_0xe4c6('0x2d')]);_0x15faf8['query']=_['keys'](_0x2eeafc[_0xe4c6('0x31')]);_0x15faf8['filters']=_[_0xe4c6('0x34')](_0x15faf8[_0xe4c6('0x30')],_0x15faf8[_0xe4c6('0x31')]);_0x3f4f50[_0xe4c6('0x35')]=_[_0xe4c6('0x34')](_0x15faf8[_0xe4c6('0x30')],qs[_0xe4c6('0x36')](_0x2eeafc['query']['fields']));_0x3f4f50[_0xe4c6('0x35')]=_0x3f4f50[_0xe4c6('0x35')][_0xe4c6('0x46')]?_0x3f4f50[_0xe4c6('0x35')]:_0x15faf8[_0xe4c6('0x30')];_0x3f4f50['order']=qs[_0xe4c6('0x3a')](_0x2eeafc[_0xe4c6('0x31')][_0xe4c6('0x3a')]);_0x3f4f50[_0xe4c6('0x3b')]=qs[_0xe4c6('0x33')](_['pick'](_0x2eeafc[_0xe4c6('0x31')],_0x15faf8[_0xe4c6('0x33')]));if(_0x2eeafc['query'][_0xe4c6('0x3d')]){_0x3f4f50[_0xe4c6('0x3b')]=_[_0xe4c6('0x3e')](_0x3f4f50['where'],{'$or':_['map'](_0x3f4f50['attributes'],function(_0xc42948){var _0x4fcd79={};_0x4fcd79[_0xc42948]={'$like':'%'+_0x2eeafc[_0xe4c6('0x31')]['filter']+'%'};return _0x4fcd79;})});}_0x3f4f50=_['merge']({},_0x3f4f50,_0x2eeafc[_0xe4c6('0x40')]);return _0x3ae7e3[_0xe4c6('0x4b')](_0x3f4f50);}})[_0xe4c6('0x24')](function(_0x16273b){if(_0x16273b){_0x960125=_0x16273b[_0xe4c6('0x46')];if(!_0x2eeafc[_0xe4c6('0x31')][_0xe4c6('0x37')](_0xe4c6('0x38'))){_0x3f4f50['limit']=qs[_0xe4c6('0x1c')](_0x2eeafc[_0xe4c6('0x31')][_0xe4c6('0x1c')]);_0x3f4f50[_0xe4c6('0x1a')]=qs[_0xe4c6('0x1a')](_0x2eeafc[_0xe4c6('0x31')]['offset']);}return _0x3ae7e3[_0xe4c6('0x4b')](_0x3f4f50);}})[_0xe4c6('0x24')](function(_0xe638bf){if(_0xe638bf){return _0xe638bf?{'count':_0x960125,'rows':_0xe638bf}:null;}})['then'](respondWithResult(_0x2491ab,null))['catch'](handleError(_0x2491ab,null));};exports[_0xe4c6('0x4c')]=function(_0x25fc14,_0x476662,_0x130866){var _0x363ece={};var _0x52c98b={};var _0x297b95;var _0x334c00;return db[_0xe4c6('0x2c')][_0xe4c6('0x4a')]({'where':{'id':_0x25fc14[_0xe4c6('0x45')]['id']}})[_0xe4c6('0x24')](handleEntityNotFound(_0x476662,null))[_0xe4c6('0x24')](function(_0x7d3978){if(_0x7d3978){_0x297b95=_0x7d3978;_0x52c98b[_0xe4c6('0x30')]=_[_0xe4c6('0x32')](db[_0xe4c6('0x4d')][_0xe4c6('0x2d')]);_0x52c98b[_0xe4c6('0x31')]=_['keys'](_0x25fc14['query']);_0x52c98b[_0xe4c6('0x33')]=_[_0xe4c6('0x34')](_0x52c98b['model'],_0x52c98b[_0xe4c6('0x31')]);_0x363ece[_0xe4c6('0x35')]=_[_0xe4c6('0x34')](_0x52c98b[_0xe4c6('0x30')],qs['fields'](_0x25fc14[_0xe4c6('0x31')][_0xe4c6('0x36')]));_0x363ece['attributes']=_0x363ece[_0xe4c6('0x35')][_0xe4c6('0x46')]?_0x363ece[_0xe4c6('0x35')]:_0x52c98b[_0xe4c6('0x30')];_0x363ece[_0xe4c6('0x39')]=qs['sort'](_0x25fc14[_0xe4c6('0x31')][_0xe4c6('0x3a')]);_0x363ece['where']=qs[_0xe4c6('0x33')](_[_0xe4c6('0x3c')](_0x25fc14[_0xe4c6('0x31')],_0x52c98b[_0xe4c6('0x33')]));if(_0x25fc14[_0xe4c6('0x31')]['filter']){_0x363ece[_0xe4c6('0x3b')]=_['merge'](_0x363ece[_0xe4c6('0x3b')],{'$or':_[_0xe4c6('0x2b')](_0x363ece[_0xe4c6('0x35')],function(_0x153e7e){var _0x1e1dca={};_0x1e1dca[_0x153e7e]={'$like':'%'+_0x25fc14[_0xe4c6('0x31')][_0xe4c6('0x3d')]+'%'};return _0x1e1dca;})});}_0x363ece=_[_0xe4c6('0x3e')]({},_0x363ece,_0x25fc14['options']);return _0x297b95['getSubjects'](_0x363ece);}})[_0xe4c6('0x24')](function(_0x2a0dfb){if(_0x2a0dfb){_0x334c00=_0x2a0dfb[_0xe4c6('0x46')];if(!_0x25fc14[_0xe4c6('0x31')]['hasOwnProperty'](_0xe4c6('0x38'))){_0x363ece[_0xe4c6('0x1c')]=qs['limit'](_0x25fc14[_0xe4c6('0x31')][_0xe4c6('0x1c')]);_0x363ece[_0xe4c6('0x1a')]=qs[_0xe4c6('0x1a')](_0x25fc14[_0xe4c6('0x31')][_0xe4c6('0x1a')]);}return _0x297b95['getSubjects'](_0x363ece);}})[_0xe4c6('0x24')](function(_0x595e95){if(_0x595e95){return _0x595e95?{'count':_0x334c00,'rows':_0x595e95}:null;}})[_0xe4c6('0x24')](respondWithResult(_0x476662,null))[_0xe4c6('0x44')](handleError(_0x476662,null));};exports['getDescriptions']=function(_0x480621,_0x1d66b1,_0x2344a6){var _0x22fcd0={};var _0x144fdb={};var _0xf144d8;var _0x3b7ea2;return db[_0xe4c6('0x2c')][_0xe4c6('0x4a')]({'where':{'id':_0x480621[_0xe4c6('0x45')]['id']}})[_0xe4c6('0x24')](handleEntityNotFound(_0x1d66b1,null))[_0xe4c6('0x24')](function(_0x1cb8f1){if(_0x1cb8f1){_0xf144d8=_0x1cb8f1;_0x144fdb[_0xe4c6('0x30')]=_['keys'](db[_0xe4c6('0x4d')][_0xe4c6('0x2d')]);_0x144fdb[_0xe4c6('0x31')]=_[_0xe4c6('0x32')](_0x480621['query']);_0x144fdb[_0xe4c6('0x33')]=_['intersection'](_0x144fdb[_0xe4c6('0x30')],_0x144fdb['query']);_0x22fcd0[_0xe4c6('0x35')]=_[_0xe4c6('0x34')](_0x144fdb[_0xe4c6('0x30')],qs[_0xe4c6('0x36')](_0x480621['query']['fields']));_0x22fcd0[_0xe4c6('0x35')]=_0x22fcd0[_0xe4c6('0x35')][_0xe4c6('0x46')]?_0x22fcd0['attributes']:_0x144fdb[_0xe4c6('0x30')];_0x22fcd0[_0xe4c6('0x39')]=qs[_0xe4c6('0x3a')](_0x480621['query'][_0xe4c6('0x3a')]);_0x22fcd0[_0xe4c6('0x3b')]=qs['filters'](_[_0xe4c6('0x3c')](_0x480621[_0xe4c6('0x31')],_0x144fdb[_0xe4c6('0x33')]));if(_0x480621[_0xe4c6('0x31')]['filter']){_0x22fcd0[_0xe4c6('0x3b')]=_[_0xe4c6('0x3e')](_0x22fcd0[_0xe4c6('0x3b')],{'$or':_[_0xe4c6('0x2b')](_0x22fcd0[_0xe4c6('0x35')],function(_0x1af3c6){var _0x1f8f8e={};_0x1f8f8e[_0x1af3c6]={'$like':'%'+_0x480621[_0xe4c6('0x31')][_0xe4c6('0x3d')]+'%'};return _0x1f8f8e;})});}_0x22fcd0=_[_0xe4c6('0x3e')]({},_0x22fcd0,_0x480621['options']);return _0xf144d8[_0xe4c6('0x4e')](_0x22fcd0);}})[_0xe4c6('0x24')](function(_0x18eedf){if(_0x18eedf){_0x3b7ea2=_0x18eedf['length'];if(!_0x480621[_0xe4c6('0x31')]['hasOwnProperty'](_0xe4c6('0x38'))){_0x22fcd0[_0xe4c6('0x1c')]=qs['limit'](_0x480621[_0xe4c6('0x31')][_0xe4c6('0x1c')]);_0x22fcd0[_0xe4c6('0x1a')]=qs[_0xe4c6('0x1a')](_0x480621[_0xe4c6('0x31')][_0xe4c6('0x1a')]);}return _0xf144d8[_0xe4c6('0x4e')](_0x22fcd0);}})[_0xe4c6('0x24')](function(_0x103750){if(_0x103750){return _0x103750?{'count':_0x3b7ea2,'rows':_0x103750}:null;}})['then'](respondWithResult(_0x1d66b1,null))[_0xe4c6('0x44')](handleError(_0x1d66b1,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index cac200f..75eb01f 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 _0x7bd3=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./intZohoConfiguration.attributes','define'];(function(_0x1097b1,_0x511954){var _0x3b19c2=function(_0x45d930){while(--_0x45d930){_0x1097b1['push'](_0x1097b1['shift']());}};_0x3b19c2(++_0x511954);}(_0x7bd3,0x188));var _0x37bd=function(_0x228c0f,_0x2548ac){_0x228c0f=_0x228c0f-0x0;var _0x11a414=_0x7bd3[_0x228c0f];return _0x11a414;};'use strict';var _=require(_0x37bd('0x0'));var util=require(_0x37bd('0x1'));var logger=require(_0x37bd('0x2'))('api');var moment=require(_0x37bd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x37bd('0x4'));var config=require(_0x37bd('0x5'));var attributes=require(_0x37bd('0x6'));module['exports']=function(_0x256055,_0x5cdab9){return _0x256055[_0x37bd('0x7')](_0x37bd('0x8'),attributes,{'tableName':_0x37bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc70c=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./intZohoConfiguration.attributes'];(function(_0x1373ab,_0x10b63f){var _0x580d18=function(_0x2ba3fa){while(--_0x2ba3fa){_0x1373ab['push'](_0x1373ab['shift']());}};_0x580d18(++_0x10b63f);}(_0xc70c,0xb8));var _0xcc70=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc70c[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xcc70('0x0'));var util=require(_0xcc70('0x1'));var logger=require(_0xcc70('0x2'))(_0xcc70('0x3'));var moment=require(_0xcc70('0x4'));var BPromise=require(_0xcc70('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcc70('0x6'));var config=require('../../config/environment');var attributes=require(_0xcc70('0x7'));module[_0xcc70('0x8')]=function(_0x46eca7,_0x529f7d){return _0x46eca7[_0xcc70('0x9')](_0xcc70('0xa'),attributes,{'tableName':_0xcc70('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 f413491..cf28ec4 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 _0x957e=['info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x8fc830,_0x1e96ae){var _0x529d46=function(_0x34c4e7){while(--_0x34c4e7){_0x8fc830['push'](_0x8fc830['shift']());}};_0x529d46(++_0x1e96ae);}(_0x957e,0x6e));var _0xe957=function(_0x4cde9e,_0x57150a){_0x4cde9e=_0x4cde9e-0x0;var _0x38df0c=_0x957e[_0x4cde9e];return _0x38df0c;};'use strict';var _=require(_0xe957('0x0'));var util=require('util');var moment=require(_0xe957('0x1'));var BPromise=require(_0xe957('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe957('0x3'))['db'];var utils=require(_0xe957('0x4'));var logger=require('../../config/logger')(_0xe957('0x5'));var config=require(_0xe957('0x6'));var jayson=require(_0xe957('0x7'));var client=jayson['client'][_0xe957('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x486c25,_0x2371a0,_0x249917){return new BPromise(function(_0x57a196,_0xf230da){return client['request'](_0x486c25,_0x249917)[_0xe957('0x9')](function(_0x276de4){logger[_0xe957('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x2371a0,_0xe957('0xb'));logger[_0xe957('0xc')](_0xe957('0xd'),_0x2371a0,_0xe957('0xb'),JSON[_0xe957('0xe')](_0x276de4));if(_0x276de4['error']){if(_0x276de4[_0xe957('0xf')][_0xe957('0x10')]===0x1f4){logger[_0xe957('0xf')](_0xe957('0x11'),_0x2371a0,_0x276de4[_0xe957('0xf')][_0xe957('0x12')]);return _0xf230da(_0x276de4['error'][_0xe957('0x12')]);}logger[_0xe957('0xf')](_0xe957('0x11'),_0x2371a0,_0x276de4[_0xe957('0xf')][_0xe957('0x12')]);return _0x57a196(_0x276de4[_0xe957('0xf')][_0xe957('0x12')]);}else{logger[_0xe957('0xa')](_0xe957('0x11'),_0x2371a0,_0xe957('0xb'));_0x57a196(_0x276de4[_0xe957('0x13')][_0xe957('0x12')]);}})['catch'](function(_0xb28244){logger[_0xe957('0xf')](_0xe957('0x11'),_0x2371a0,_0xb28244);_0xf230da(_0xb28244);});});} \ No newline at end of file +var _0xa5e8=['then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x245d89,_0x1ebbbc){var _0x3bb629=function(_0x2703d6){while(--_0x2703d6){_0x245d89['push'](_0x245d89['shift']());}};_0x3bb629(++_0x1ebbbc);}(_0xa5e8,0xfb));var _0x8a5e=function(_0x15d715,_0x16c046){_0x15d715=_0x15d715-0x0;var _0x129065=_0xa5e8[_0x15d715];return _0x129065;};'use strict';var _=require(_0x8a5e('0x0'));var util=require('util');var moment=require(_0x8a5e('0x1'));var BPromise=require(_0x8a5e('0x2'));var rs=require(_0x8a5e('0x3'));var fs=require('fs');var Redis=require(_0x8a5e('0x4'));var db=require(_0x8a5e('0x5'))['db'];var utils=require(_0x8a5e('0x6'));var logger=require(_0x8a5e('0x7'))('rpc');var config=require(_0x8a5e('0x8'));var jayson=require(_0x8a5e('0x9'));var client=jayson[_0x8a5e('0xa')][_0x8a5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c59b6,_0x53e741,_0x415593){return new BPromise(function(_0x4d262a,_0x1bfca0){return client[_0x8a5e('0xc')](_0x2c59b6,_0x415593)[_0x8a5e('0xd')](function(_0x2bfa40){logger['info'](_0x8a5e('0xe'),_0x53e741,'request\x20sent');logger[_0x8a5e('0xf')](_0x8a5e('0x10'),_0x53e741,_0x8a5e('0x11'),JSON[_0x8a5e('0x12')](_0x2bfa40));if(_0x2bfa40[_0x8a5e('0x13')]){if(_0x2bfa40['error'][_0x8a5e('0x14')]===0x1f4){logger[_0x8a5e('0x13')](_0x8a5e('0xe'),_0x53e741,_0x2bfa40[_0x8a5e('0x13')]['message']);return _0x1bfca0(_0x2bfa40['error'][_0x8a5e('0x15')]);}logger[_0x8a5e('0x13')](_0x8a5e('0xe'),_0x53e741,_0x2bfa40[_0x8a5e('0x13')][_0x8a5e('0x15')]);return _0x4d262a(_0x2bfa40['error'][_0x8a5e('0x15')]);}else{logger[_0x8a5e('0x16')](_0x8a5e('0xe'),_0x53e741,'request\x20sent');_0x4d262a(_0x2bfa40[_0x8a5e('0x17')][_0x8a5e('0x15')]);}})['catch'](function(_0x27ebf9){logger[_0x8a5e('0x13')](_0x8a5e('0xe'),_0x53e741,_0x27ebf9);_0x1bfca0(_0x27ebf9);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0d72598..64d3c22 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 _0xf42a=['multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5d154b,_0x2bb108){var _0x59ced6=function(_0x26b7ff){while(--_0x26b7ff){_0x5d154b['push'](_0x5d154b['shift']());}};_0x59ced6(++_0x2bb108);}(_0xf42a,0xab));var _0xaf42=function(_0x4b98eb,_0x36d2bd){_0x4b98eb=_0x4b98eb-0x0;var _0x224a29=_0xf42a[_0x4b98eb];return _0x224a29;};'use strict';var multer=require(_0xaf42('0x0'));var util=require('util');var path=require(_0xaf42('0x1'));var timeout=require(_0xaf42('0x2'));var express=require('express');var router=express[_0xaf42('0x3')]();var fs_extra=require(_0xaf42('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf42('0x5'));var controller=require(_0xaf42('0x6'));router['get']('/',auth[_0xaf42('0x7')](),controller[_0xaf42('0x8')]);router[_0xaf42('0x9')](_0xaf42('0xa'),auth[_0xaf42('0x7')](),controller[_0xaf42('0xb')]);router[_0xaf42('0xc')]('/',auth[_0xaf42('0x7')](),controller[_0xaf42('0xd')]);router[_0xaf42('0xe')](_0xaf42('0xa'),auth[_0xaf42('0x7')](),controller[_0xaf42('0xf')]);router[_0xaf42('0x10')](_0xaf42('0xa'),auth[_0xaf42('0x7')](),controller[_0xaf42('0x11')]);module[_0xaf42('0x12')]=router; \ No newline at end of file +var _0x0ab1=['update','/:id','destroy','exports','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','post','create','put'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x0ab1,0x84));var _0x10ab=function(_0x58c18a,_0x57fbec){_0x58c18a=_0x58c18a-0x0;var _0xcc4b10=_0x0ab1[_0x58c18a];return _0xcc4b10;};'use strict';var multer=require('multer');var util=require(_0x10ab('0x0'));var path=require('path');var timeout=require(_0x10ab('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x10ab('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x10ab('0x3'));var config=require(_0x10ab('0x4'));var controller=require(_0x10ab('0x5'));router[_0x10ab('0x6')]('/',auth[_0x10ab('0x7')](),controller[_0x10ab('0x8')]);router[_0x10ab('0x6')]('/:id',auth[_0x10ab('0x7')](),controller['show']);router[_0x10ab('0x9')]('/',auth['isAuthenticated'](),controller[_0x10ab('0xa')]);router[_0x10ab('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x10ab('0xc')]);router['delete'](_0x10ab('0xd'),auth[_0x10ab('0x7')](),controller[_0x10ab('0xe')]);module[_0x10ab('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index d2c35c5..fe5b3f2 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 _0xa550=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x13b3f2,_0x1f230e){var _0x476495=function(_0x34670c){while(--_0x34670c){_0x13b3f2['push'](_0x13b3f2['shift']());}};_0x476495(++_0x1f230e);}(_0xa550,0x170));var _0x0a55=function(_0x53c8c7,_0x348f83){_0x53c8c7=_0x53c8c7-0x0;var _0x4f9626=_0xa550[_0x53c8c7];return _0x4f9626;};'use strict';var Sequelize=require(_0x0a55('0x0'));module['exports']={'type':{'type':Sequelize[_0x0a55('0x1')](_0x0a55('0x2'),_0x0a55('0x3'),_0x0a55('0x4'),_0x0a55('0x5'),'picklist'),'defaultValue':_0x0a55('0x2')},'content':{'type':Sequelize[_0x0a55('0x6')]},'key':{'type':Sequelize[_0x0a55('0x6')]},'keyType':{'type':Sequelize[_0x0a55('0x1')](_0x0a55('0x2'),_0x0a55('0x3'),_0x0a55('0x4'))},'keyContent':{'type':Sequelize[_0x0a55('0x6')]},'idField':{'type':Sequelize[_0x0a55('0x6')]},'nameField':{'type':Sequelize[_0x0a55('0x6')]},'customField':{'type':Sequelize[_0x0a55('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x195a=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x195a,0xf6));var _0xa195=function(_0x390063,_0x1df72b){_0x390063=_0x390063-0x0;var _0x3e7a80=_0x195a[_0x390063];return _0x3e7a80;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa195('0x0')](_0xa195('0x1'),_0xa195('0x2'),_0xa195('0x3'),_0xa195('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa195('0x5')]},'keyType':{'type':Sequelize[_0xa195('0x0')](_0xa195('0x1'),'variable',_0xa195('0x3'))},'keyContent':{'type':Sequelize[_0xa195('0x5')]},'idField':{'type':Sequelize[_0xa195('0x5')]},'nameField':{'type':Sequelize[_0xa195('0x5')]},'customField':{'type':Sequelize[_0xa195('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa195('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a96aa66..31f6059 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 _0x9285=['../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','end','error','stack','send','index','map','ZohoField','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x292bab,_0x18b725){var _0x3a1de1=function(_0x8d52cf){while(--_0x8d52cf){_0x292bab['push'](_0x292bab['shift']());}};_0x3a1de1(++_0x18b725);}(_0x9285,0x1a0));var _0x5928=function(_0x4681a9,_0x3ca309){_0x4681a9=_0x4681a9-0x0;var _0x37077c=_0x9285[_0x4681a9];return _0x37077c;};'use strict';var emlformat=require(_0x5928('0x0'));var rimraf=require(_0x5928('0x1'));var zipdir=require(_0x5928('0x2'));var jsonpatch=require(_0x5928('0x3'));var rp=require(_0x5928('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5928('0x5'));var util=require(_0x5928('0x6'));var path=require(_0x5928('0x7'));var sox=require(_0x5928('0x8'));var csv=require(_0x5928('0x9'));var ejs=require(_0x5928('0xa'));var fs=require('fs');var fs_extra=require(_0x5928('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5928('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5928('0xd'));var Papa=require(_0x5928('0xe'));var Redis=require(_0x5928('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5928('0x10'));var as=require(_0x5928('0x11'));var hardwareService=require(_0x5928('0x12'));var logger=require(_0x5928('0x13'))(_0x5928('0x14'));var utils=require(_0x5928('0x15'));var config=require(_0x5928('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5928('0x17'))['db'];function respondWithStatusCode(_0x29d94f,_0x2d82c8){_0x2d82c8=_0x2d82c8||0xcc;return function(_0x929fa2){if(_0x929fa2){return _0x29d94f[_0x5928('0x18')](_0x2d82c8);}return _0x29d94f[_0x5928('0x19')](_0x2d82c8)['end']();};}function respondWithResult(_0xcf24db,_0x258567){_0x258567=_0x258567||0xc8;return function(_0x335ec0){if(_0x335ec0){return _0xcf24db[_0x5928('0x19')](_0x258567)['json'](_0x335ec0);}};}function respondWithFilteredResult(_0x5ac86e,_0xf1c25a){return function(_0x5001c5){if(_0x5001c5){var _0x24ded1=typeof _0xf1c25a[_0x5928('0x1a')]==='undefined'&&typeof _0xf1c25a[_0x5928('0x1b')]===_0x5928('0x1c');var _0x367c68=_0x5001c5[_0x5928('0x1d')];var _0x40e3cf=_0x24ded1?0x0:_0xf1c25a[_0x5928('0x1a')];var _0x15ee9b=_0x24ded1?_0x5001c5[_0x5928('0x1d')]:_0xf1c25a['offset']+_0xf1c25a[_0x5928('0x1b')];var _0x3dc093;if(_0x15ee9b>=_0x367c68){_0x15ee9b=_0x367c68;_0x3dc093=0xc8;}else{_0x3dc093=0xce;}_0x5ac86e['status'](_0x3dc093);return _0x5ac86e[_0x5928('0x1e')]('Content-Range',_0x40e3cf+'-'+_0x15ee9b+'/'+_0x367c68)[_0x5928('0x1f')](_0x5001c5);}return null;};}function patchUpdates(_0x2d0a99){return function(_0x3f1d97){try{jsonpatch[_0x5928('0x20')](_0x3f1d97,_0x2d0a99,!![]);}catch(_0x63b707){return BPromise[_0x5928('0x21')](_0x63b707);}return _0x3f1d97[_0x5928('0x22')]();};}function saveUpdates(_0x2e6819,_0x75529d){return function(_0x2f766e){if(_0x2f766e){return _0x2f766e[_0x5928('0x23')](_0x2e6819)[_0x5928('0x24')](function(_0x25cef9){return _0x25cef9;});}return null;};}function removeEntity(_0x290baa,_0x830f49){return function(_0x13ba88){if(_0x13ba88){return _0x13ba88['destroy']()['then'](function(){_0x290baa[_0x5928('0x19')](0xcc)[_0x5928('0x25')]();});}};}function handleEntityNotFound(_0x33ea06,_0x4e80d5){return function(_0x3ff7a6){if(!_0x3ff7a6){_0x33ea06[_0x5928('0x18')](0x194);}return _0x3ff7a6;};}function handleError(_0x4fbf7d,_0x5ba05e){_0x5ba05e=_0x5ba05e||0x1f4;return function(_0x220d33){logger[_0x5928('0x26')](_0x220d33[_0x5928('0x27')]);if(_0x220d33['name']){delete _0x220d33['name'];}_0x4fbf7d['status'](_0x5ba05e)[_0x5928('0x28')](_0x220d33);};}exports[_0x5928('0x29')]=function(_0x42f1c2,_0x37dbb2){var _0x5593ed={},_0x3c03fa={},_0x341c0f={'count':0x0,'rows':[]};var _0x20ec18=_[_0x5928('0x2a')](db[_0x5928('0x2b')][_0x5928('0x2c')],function(_0x194262){return{'name':_0x194262[_0x5928('0x2d')],'type':_0x194262[_0x5928('0x2e')]['key']};});_0x3c03fa['model']=_[_0x5928('0x2a')](_0x20ec18,_0x5928('0x2f'));_0x3c03fa[_0x5928('0x30')]=_[_0x5928('0x31')](_0x42f1c2[_0x5928('0x30')]);_0x3c03fa[_0x5928('0x32')]=_[_0x5928('0x33')](_0x3c03fa[_0x5928('0x34')],_0x3c03fa[_0x5928('0x30')]);_0x5593ed['attributes']=_['intersection'](_0x3c03fa[_0x5928('0x34')],qs[_0x5928('0x35')](_0x42f1c2[_0x5928('0x30')][_0x5928('0x35')]));_0x5593ed[_0x5928('0x36')]=_0x5593ed[_0x5928('0x36')][_0x5928('0x37')]?_0x5593ed[_0x5928('0x36')]:_0x3c03fa[_0x5928('0x34')];if(!_0x42f1c2[_0x5928('0x30')][_0x5928('0x38')]('nolimit')){_0x5593ed[_0x5928('0x1b')]=qs[_0x5928('0x1b')](_0x42f1c2[_0x5928('0x30')]['limit']);_0x5593ed[_0x5928('0x1a')]=qs[_0x5928('0x1a')](_0x42f1c2['query'][_0x5928('0x1a')]);}_0x5593ed['order']=qs[_0x5928('0x39')](_0x42f1c2['query'][_0x5928('0x39')]);_0x5593ed[_0x5928('0x3a')]=qs[_0x5928('0x32')](_[_0x5928('0x3b')](_0x42f1c2[_0x5928('0x30')],_0x3c03fa['filters']),_0x20ec18);if(_0x42f1c2[_0x5928('0x30')]['filter']){_0x5593ed[_0x5928('0x3a')]=_[_0x5928('0x3c')](_0x5593ed[_0x5928('0x3a')],{'$or':_['map'](_0x20ec18,function(_0x2a6589){if(_0x2a6589['type']!==_0x5928('0x3d')){var _0x36973e={};_0x36973e[_0x2a6589[_0x5928('0x2f')]]={'$like':'%'+_0x42f1c2[_0x5928('0x30')]['filter']+'%'};return _0x36973e;}})});}_0x5593ed=_[_0x5928('0x3c')]({},_0x5593ed,_0x42f1c2[_0x5928('0x3e')]);var _0x175590={'where':_0x5593ed[_0x5928('0x3a')]};return db[_0x5928('0x2b')][_0x5928('0x1d')](_0x175590)[_0x5928('0x24')](function(_0x13c4b0){_0x341c0f[_0x5928('0x1d')]=_0x13c4b0;if(_0x42f1c2[_0x5928('0x30')][_0x5928('0x3f')]){_0x5593ed[_0x5928('0x40')]=[{'all':!![]}];}return db[_0x5928('0x2b')]['findAll'](_0x5593ed);})['then'](function(_0x206bed){_0x341c0f[_0x5928('0x41')]=_0x206bed;return _0x341c0f;})['then'](respondWithFilteredResult(_0x37dbb2,_0x5593ed))[_0x5928('0x42')](handleError(_0x37dbb2,null));};exports[_0x5928('0x43')]=function(_0x46a141,_0x424187){var _0x187096={'raw':!![],'where':{'id':_0x46a141[_0x5928('0x44')]['id']}},_0x4d1164={};_0x4d1164['model']=_[_0x5928('0x31')](db['ZohoField']['rawAttributes']);_0x4d1164['query']=_[_0x5928('0x31')](_0x46a141[_0x5928('0x30')]);_0x4d1164[_0x5928('0x32')]=_[_0x5928('0x33')](_0x4d1164[_0x5928('0x34')],_0x4d1164['query']);_0x187096[_0x5928('0x36')]=_['intersection'](_0x4d1164['model'],qs[_0x5928('0x35')](_0x46a141['query'][_0x5928('0x35')]));_0x187096[_0x5928('0x36')]=_0x187096[_0x5928('0x36')][_0x5928('0x37')]?_0x187096[_0x5928('0x36')]:_0x4d1164[_0x5928('0x34')];if(_0x46a141[_0x5928('0x30')]['includeAll']){_0x187096[_0x5928('0x40')]=[{'all':!![]}];}_0x187096=_[_0x5928('0x3c')]({},_0x187096,_0x46a141[_0x5928('0x3e')]);return db[_0x5928('0x2b')][_0x5928('0x45')](_0x187096)[_0x5928('0x24')](handleEntityNotFound(_0x424187,null))[_0x5928('0x24')](respondWithResult(_0x424187,null))[_0x5928('0x42')](handleError(_0x424187,null));};exports[_0x5928('0x46')]=function(_0x47fdaf,_0x3cd938){return db[_0x5928('0x2b')][_0x5928('0x46')](_0x47fdaf[_0x5928('0x47')],{})[_0x5928('0x24')](respondWithResult(_0x3cd938,0xc9))[_0x5928('0x42')](handleError(_0x3cd938,null));};exports[_0x5928('0x23')]=function(_0x371dd5,_0x52df87){if(_0x371dd5['body']['id']){delete _0x371dd5[_0x5928('0x47')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x371dd5['params']['id']}})[_0x5928('0x24')](handleEntityNotFound(_0x52df87,null))[_0x5928('0x24')](saveUpdates(_0x371dd5[_0x5928('0x47')],null))[_0x5928('0x24')](respondWithResult(_0x52df87,null))[_0x5928('0x42')](handleError(_0x52df87,null));};exports[_0x5928('0x48')]=function(_0x5d6a20,_0x59cd5d){return db[_0x5928('0x2b')]['find']({'where':{'id':_0x5d6a20[_0x5928('0x44')]['id']}})[_0x5928('0x24')](handleEntityNotFound(_0x59cd5d,null))['then'](removeEntity(_0x59cd5d,null))[_0x5928('0x42')](handleError(_0x59cd5d,null));}; \ No newline at end of file +var _0x4274=['set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','ZohoField','findAll','rows','catch','show','params','rawAttributes','include','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x4274,0x1f4));var _0x4427=function(_0x20a8ea,_0x3937d8){_0x20a8ea=_0x20a8ea-0x0;var _0x4df51b=_0x4274[_0x20a8ea];return _0x4df51b;};'use strict';var emlformat=require(_0x4427('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4427('0x1'));var jsonpatch=require(_0x4427('0x2'));var rp=require(_0x4427('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4427('0x4'));var util=require(_0x4427('0x5'));var path=require(_0x4427('0x6'));var sox=require(_0x4427('0x7'));var csv=require(_0x4427('0x8'));var ejs=require(_0x4427('0x9'));var fs=require('fs');var fs_extra=require(_0x4427('0xa'));var _=require(_0x4427('0xb'));var squel=require(_0x4427('0xc'));var crypto=require('crypto');var jsforce=require(_0x4427('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4427('0x8'));var querystring=require(_0x4427('0xe'));var Papa=require(_0x4427('0xf'));var Redis=require(_0x4427('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4427('0x11'));var as=require(_0x4427('0x12'));var hardwareService=require(_0x4427('0x13'));var logger=require(_0x4427('0x14'))(_0x4427('0x15'));var utils=require(_0x4427('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4427('0x17'));var db=require(_0x4427('0x18'))['db'];function respondWithStatusCode(_0x46d3cc,_0x21b83b){_0x21b83b=_0x21b83b||0xcc;return function(_0x17c8d9){if(_0x17c8d9){return _0x46d3cc[_0x4427('0x19')](_0x21b83b);}return _0x46d3cc['status'](_0x21b83b)[_0x4427('0x1a')]();};}function respondWithResult(_0x290b4c,_0x3394e5){_0x3394e5=_0x3394e5||0xc8;return function(_0x4c9f58){if(_0x4c9f58){return _0x290b4c[_0x4427('0x1b')](_0x3394e5)['json'](_0x4c9f58);}};}function respondWithFilteredResult(_0x1f698b,_0x563aea){return function(_0x1f401e){if(_0x1f401e){var _0x59d04e=typeof _0x563aea[_0x4427('0x1c')]===_0x4427('0x1d')&&typeof _0x563aea[_0x4427('0x1e')]==='undefined';var _0xf6aa48=_0x1f401e[_0x4427('0x1f')];var _0x331911=_0x59d04e?0x0:_0x563aea['offset'];var _0x3db877=_0x59d04e?_0x1f401e[_0x4427('0x1f')]:_0x563aea[_0x4427('0x1c')]+_0x563aea[_0x4427('0x1e')];var _0xc42587;if(_0x3db877>=_0xf6aa48){_0x3db877=_0xf6aa48;_0xc42587=0xc8;}else{_0xc42587=0xce;}_0x1f698b['status'](_0xc42587);return _0x1f698b[_0x4427('0x20')](_0x4427('0x21'),_0x331911+'-'+_0x3db877+'/'+_0xf6aa48)[_0x4427('0x22')](_0x1f401e);}return null;};}function patchUpdates(_0x52a110){return function(_0x22e82f){try{jsonpatch[_0x4427('0x23')](_0x22e82f,_0x52a110,!![]);}catch(_0x4b2047){return BPromise[_0x4427('0x24')](_0x4b2047);}return _0x22e82f['save']();};}function saveUpdates(_0xdf6924,_0x20e455){return function(_0x427e6b){if(_0x427e6b){return _0x427e6b[_0x4427('0x25')](_0xdf6924)[_0x4427('0x26')](function(_0x103d56){return _0x103d56;});}return null;};}function removeEntity(_0x2bdf65,_0x4706c9){return function(_0x1614f2){if(_0x1614f2){return _0x1614f2[_0x4427('0x27')]()[_0x4427('0x26')](function(){_0x2bdf65[_0x4427('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d171a,_0x32c998){return function(_0xa7ccf9){if(!_0xa7ccf9){_0x4d171a[_0x4427('0x19')](0x194);}return _0xa7ccf9;};}function handleError(_0x38dd39,_0x47eafc){_0x47eafc=_0x47eafc||0x1f4;return function(_0x4a5789){logger[_0x4427('0x28')](_0x4a5789[_0x4427('0x29')]);if(_0x4a5789[_0x4427('0x2a')]){delete _0x4a5789['name'];}_0x38dd39[_0x4427('0x1b')](_0x47eafc)['send'](_0x4a5789);};}exports['index']=function(_0x47f837,_0x4722f9){var _0x2b3e05={},_0x540165={},_0x76480c={'count':0x0,'rows':[]};var _0x4a801c=_[_0x4427('0x2b')](db['ZohoField']['rawAttributes'],function(_0xe6df5b){return{'name':_0xe6df5b[_0x4427('0x2c')],'type':_0xe6df5b[_0x4427('0x2d')][_0x4427('0x2e')]};});_0x540165[_0x4427('0x2f')]=_[_0x4427('0x2b')](_0x4a801c,_0x4427('0x2a'));_0x540165['query']=_[_0x4427('0x30')](_0x47f837[_0x4427('0x31')]);_0x540165[_0x4427('0x32')]=_[_0x4427('0x33')](_0x540165['model'],_0x540165['query']);_0x2b3e05[_0x4427('0x34')]=_[_0x4427('0x33')](_0x540165[_0x4427('0x2f')],qs[_0x4427('0x35')](_0x47f837[_0x4427('0x31')][_0x4427('0x35')]));_0x2b3e05['attributes']=_0x2b3e05[_0x4427('0x34')][_0x4427('0x36')]?_0x2b3e05[_0x4427('0x34')]:_0x540165[_0x4427('0x2f')];if(!_0x47f837[_0x4427('0x31')][_0x4427('0x37')](_0x4427('0x38'))){_0x2b3e05['limit']=qs[_0x4427('0x1e')](_0x47f837[_0x4427('0x31')][_0x4427('0x1e')]);_0x2b3e05[_0x4427('0x1c')]=qs['offset'](_0x47f837[_0x4427('0x31')][_0x4427('0x1c')]);}_0x2b3e05['order']=qs[_0x4427('0x39')](_0x47f837[_0x4427('0x31')][_0x4427('0x39')]);_0x2b3e05[_0x4427('0x3a')]=qs[_0x4427('0x32')](_[_0x4427('0x3b')](_0x47f837[_0x4427('0x31')],_0x540165[_0x4427('0x32')]),_0x4a801c);if(_0x47f837[_0x4427('0x31')][_0x4427('0x3c')]){_0x2b3e05[_0x4427('0x3a')]=_['merge'](_0x2b3e05[_0x4427('0x3a')],{'$or':_['map'](_0x4a801c,function(_0x57f7be){if(_0x57f7be[_0x4427('0x2d')]!==_0x4427('0x3d')){var _0x474e7e={};_0x474e7e[_0x57f7be[_0x4427('0x2a')]]={'$like':'%'+_0x47f837['query']['filter']+'%'};return _0x474e7e;}})});}_0x2b3e05=_['merge']({},_0x2b3e05,_0x47f837[_0x4427('0x3e')]);var _0x329169={'where':_0x2b3e05[_0x4427('0x3a')]};return db['ZohoField'][_0x4427('0x1f')](_0x329169)['then'](function(_0x3f0bae){_0x76480c[_0x4427('0x1f')]=_0x3f0bae;if(_0x47f837[_0x4427('0x31')][_0x4427('0x3f')]){_0x2b3e05['include']=[{'all':!![]}];}return db[_0x4427('0x40')][_0x4427('0x41')](_0x2b3e05);})['then'](function(_0x83c4e8){_0x76480c[_0x4427('0x42')]=_0x83c4e8;return _0x76480c;})[_0x4427('0x26')](respondWithFilteredResult(_0x4722f9,_0x2b3e05))[_0x4427('0x43')](handleError(_0x4722f9,null));};exports[_0x4427('0x44')]=function(_0x53d8cd,_0x166258){var _0x1b82dc={'raw':!![],'where':{'id':_0x53d8cd[_0x4427('0x45')]['id']}},_0x774ed1={};_0x774ed1['model']=_[_0x4427('0x30')](db[_0x4427('0x40')][_0x4427('0x46')]);_0x774ed1['query']=_['keys'](_0x53d8cd[_0x4427('0x31')]);_0x774ed1[_0x4427('0x32')]=_['intersection'](_0x774ed1['model'],_0x774ed1[_0x4427('0x31')]);_0x1b82dc[_0x4427('0x34')]=_[_0x4427('0x33')](_0x774ed1[_0x4427('0x2f')],qs[_0x4427('0x35')](_0x53d8cd[_0x4427('0x31')][_0x4427('0x35')]));_0x1b82dc[_0x4427('0x34')]=_0x1b82dc[_0x4427('0x34')][_0x4427('0x36')]?_0x1b82dc[_0x4427('0x34')]:_0x774ed1[_0x4427('0x2f')];if(_0x53d8cd['query'][_0x4427('0x3f')]){_0x1b82dc[_0x4427('0x47')]=[{'all':!![]}];}_0x1b82dc=_[_0x4427('0x48')]({},_0x1b82dc,_0x53d8cd[_0x4427('0x3e')]);return db['ZohoField'][_0x4427('0x49')](_0x1b82dc)[_0x4427('0x26')](handleEntityNotFound(_0x166258,null))[_0x4427('0x26')](respondWithResult(_0x166258,null))['catch'](handleError(_0x166258,null));};exports[_0x4427('0x4a')]=function(_0x367b03,_0x46eff6){return db[_0x4427('0x40')][_0x4427('0x4a')](_0x367b03[_0x4427('0x4b')],{})['then'](respondWithResult(_0x46eff6,0xc9))[_0x4427('0x43')](handleError(_0x46eff6,null));};exports[_0x4427('0x25')]=function(_0x1ed023,_0x209055){if(_0x1ed023['body']['id']){delete _0x1ed023['body']['id'];}return db[_0x4427('0x40')][_0x4427('0x49')]({'where':{'id':_0x1ed023['params']['id']}})[_0x4427('0x26')](handleEntityNotFound(_0x209055,null))[_0x4427('0x26')](saveUpdates(_0x1ed023[_0x4427('0x4b')],null))[_0x4427('0x26')](respondWithResult(_0x209055,null))['catch'](handleError(_0x209055,null));};exports[_0x4427('0x27')]=function(_0xc91a0f,_0x3e3aed){return db[_0x4427('0x40')]['find']({'where':{'id':_0xc91a0f[_0x4427('0x45')]['id']}})[_0x4427('0x26')](handleEntityNotFound(_0x3e3aed,null))[_0x4427('0x26')](removeEntity(_0x3e3aed,null))[_0x4427('0x43')](handleError(_0x3e3aed,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index c9d3ce3..816ffa2 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1a37,0xb4));var _0x71a3=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x1a37[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intZohoField.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','util','api','bluebird','request-promise','path'];(function(_0x337b37,_0x26a488){var _0x2b9a89=function(_0x2572c6){while(--_0x2572c6){_0x337b37['push'](_0x337b37['shift']());}};_0x2b9a89(++_0x26a488);}(_0x7096,0x10c));var _0x6709=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7096[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['idField','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 c0c9838..ff589d0 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 _0xb462=['request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x2ac756,_0x33408b){var _0xa621fb=function(_0x5a316f){while(--_0x5a316f){_0x2ac756['push'](_0x2ac756['shift']());}};_0xa621fb(++_0x33408b);}(_0xb462,0x85));var _0x2b46=function(_0x4dafbb,_0xd041a3){_0x4dafbb=_0x4dafbb-0x0;var _0x600535=_0xb462[_0x4dafbb];return _0x600535;};'use strict';var _=require('lodash');var util=require(_0x2b46('0x0'));var moment=require(_0x2b46('0x1'));var BPromise=require(_0x2b46('0x2'));var rs=require(_0x2b46('0x3'));var fs=require('fs');var Redis=require(_0x2b46('0x4'));var db=require(_0x2b46('0x5'))['db'];var utils=require(_0x2b46('0x6'));var logger=require(_0x2b46('0x7'))(_0x2b46('0x8'));var config=require(_0x2b46('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2b46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2979a0,_0x326b48,_0x340dea){return new BPromise(function(_0x3b0772,_0x33db0c){return client[_0x2b46('0xb')](_0x2979a0,_0x340dea)[_0x2b46('0xc')](function(_0x3102ad){logger[_0x2b46('0xd')](_0x2b46('0xe'),_0x326b48,'request\x20sent');logger[_0x2b46('0xf')](_0x2b46('0x10'),_0x326b48,_0x2b46('0x11'),JSON[_0x2b46('0x12')](_0x3102ad));if(_0x3102ad[_0x2b46('0x13')]){if(_0x3102ad['error'][_0x2b46('0x14')]===0x1f4){logger[_0x2b46('0x13')](_0x2b46('0xe'),_0x326b48,_0x3102ad[_0x2b46('0x13')][_0x2b46('0x15')]);return _0x33db0c(_0x3102ad['error'][_0x2b46('0x15')]);}logger['error'](_0x2b46('0xe'),_0x326b48,_0x3102ad[_0x2b46('0x13')][_0x2b46('0x15')]);return _0x3b0772(_0x3102ad[_0x2b46('0x13')][_0x2b46('0x15')]);}else{logger[_0x2b46('0xd')](_0x2b46('0xe'),_0x326b48,_0x2b46('0x11'));_0x3b0772(_0x3102ad[_0x2b46('0x16')][_0x2b46('0x15')]);}})[_0x2b46('0x17')](function(_0x2433f7){logger[_0x2b46('0x13')](_0x2b46('0xe'),_0x326b48,_0x2433f7);_0x33db0c(_0x2433f7);});});} \ No newline at end of file +var _0x4e8e=['http','then','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4e8e,0xf3));var _0xe4e8=function(_0x53184b,_0x23a0f9){_0x53184b=_0x53184b-0x0;var _0x21fb25=_0x4e8e[_0x53184b];return _0x21fb25;};'use strict';var _=require(_0xe4e8('0x0'));var util=require(_0xe4e8('0x1'));var moment=require('moment');var BPromise=require(_0xe4e8('0x2'));var rs=require(_0xe4e8('0x3'));var fs=require('fs');var Redis=require(_0xe4e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4e8('0x5'));var logger=require(_0xe4e8('0x6'))('rpc');var config=require(_0xe4e8('0x7'));var jayson=require(_0xe4e8('0x8'));var client=jayson['client'][_0xe4e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41e484,_0x528527,_0x567535){return new BPromise(function(_0x3cdbb5,_0xd573ea){return client['request'](_0x41e484,_0x567535)[_0xe4e8('0xa')](function(_0x51d9f6){logger['info'](_0xe4e8('0xb'),_0x528527,'request\x20sent');logger[_0xe4e8('0xc')](_0xe4e8('0xd'),_0x528527,'request\x20sent',JSON[_0xe4e8('0xe')](_0x51d9f6));if(_0x51d9f6[_0xe4e8('0xf')]){if(_0x51d9f6[_0xe4e8('0xf')]['code']===0x1f4){logger[_0xe4e8('0xf')](_0xe4e8('0xb'),_0x528527,_0x51d9f6[_0xe4e8('0xf')][_0xe4e8('0x10')]);return _0xd573ea(_0x51d9f6[_0xe4e8('0xf')][_0xe4e8('0x10')]);}logger[_0xe4e8('0xf')](_0xe4e8('0xb'),_0x528527,_0x51d9f6['error']['message']);return _0x3cdbb5(_0x51d9f6[_0xe4e8('0xf')][_0xe4e8('0x10')]);}else{logger[_0xe4e8('0x11')](_0xe4e8('0xb'),_0x528527,_0xe4e8('0x12'));_0x3cdbb5(_0x51d9f6[_0xe4e8('0x13')][_0xe4e8('0x10')]);}})[_0xe4e8('0x14')](function(_0x1d92fb){logger[_0xe4e8('0xf')]('ZohoField,\x20%s,\x20%s',_0x528527,_0x1d92fb);_0xd573ea(_0x1d92fb);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 7497051..b259a9d 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x149a2a,_0x2dfe35){var _0x3697b1=function(_0x5a14d1){while(--_0x5a14d1){_0x149a2a['push'](_0x149a2a['shift']());}};_0x3697b1(++_0x2dfe35);}(_0xe706,0xa3));var _0x6e70=function(_0x13d9ac,_0x193a78){_0x13d9ac=_0x13d9ac-0x0;var _0x348a17=_0xe706[_0x13d9ac];return _0x348a17;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4f3b4b,_0x590f08){var _0x1249e0=function(_0x308ba8){while(--_0x308ba8){_0x4f3b4b['push'](_0x4f3b4b['shift']());}};_0x1249e0(++_0x590f08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 0ab6524..335a557 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 _0x83d6=['sequelize','exports','STRING','unique_name_and_version','INTEGER','state'];(function(_0x32c3b2,_0x66618d){var _0x964579=function(_0x4c841b){while(--_0x4c841b){_0x32c3b2['push'](_0x32c3b2['shift']());}};_0x964579(++_0x66618d);}(_0x83d6,0xd8));var _0x683d=function(_0x33adc6,_0x1c1471){_0x33adc6=_0x33adc6-0x0;var _0x140078=_0x83d6[_0x33adc6];return _0x140078;};'use strict';var Sequelize=require(_0x683d('0x0'));module[_0x683d('0x1')]={'name':{'type':Sequelize[_0x683d('0x2')],'allowNull':![],'unique':_0x683d('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x683d('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x683d('0x2')]},'size':{'type':Sequelize[_0x683d('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x683d('0x2')]},'logo':{'type':Sequelize[_0x683d('0x2')]},'state':{'type':Sequelize[_0x683d('0x2')],'unique':_0x683d('0x5')},'description':{'type':Sequelize[_0x683d('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x683d('0x2')]},'link':{'type':Sequelize[_0x683d('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xa130=['unique_name_and_version','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x8200ed,_0x144de7){var _0x577ccb=function(_0x452305){while(--_0x452305){_0x8200ed['push'](_0x8200ed['shift']());}};_0x577ccb(++_0x144de7);}(_0xa130,0x1cb));var _0x0a13=function(_0x5a8b0e,_0x3e8c93){_0x5a8b0e=_0x5a8b0e-0x0;var _0x1ca7cc=_0xa130[_0x5a8b0e];return _0x1ca7cc;};'use strict';var Sequelize=require(_0x0a13('0x0'));module[_0x0a13('0x1')]={'name':{'type':Sequelize[_0x0a13('0x2')],'allowNull':![],'unique':_0x0a13('0x3')},'version':{'type':Sequelize[_0x0a13('0x2')],'allowNull':![],'unique':_0x0a13('0x3')},'main':{'type':Sequelize[_0x0a13('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x0a13('0x4')]},'active':{'type':Sequelize[_0x0a13('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x0a13('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x0a13('0x6')},'description':{'type':Sequelize[_0x0a13('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x0a13('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 5d72c05..14b9b08 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 _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x1a37,0xb4));var _0x71a3=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x1a37[_0x2283dc];return _0x16db90;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file +var _0xd117=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','Integration','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length'];(function(_0x4d061f,_0x3d66ad){var _0xc352d5=function(_0x3802e5){while(--_0x3802e5){_0x4d061f['push'](_0x4d061f['shift']());}};_0xc352d5(++_0x3d66ad);}(_0xd117,0x182));var _0x7d11=function(_0x2dfd28,_0x153b3c){_0x2dfd28=_0x2dfd28-0x0;var _0x49c016=_0xd117[_0x2dfd28];return _0x49c016;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['Integration'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index fd4dbd0..ca6e705 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 _0xe61b=['exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x178bb6,_0x1fe40c){var _0x43961b=function(_0xb35f7f){while(--_0xb35f7f){_0x178bb6['push'](_0x178bb6['shift']());}};_0x43961b(++_0x1fe40c);}(_0xe61b,0x138));var _0xbe61=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0xe61b[_0x337a10];return _0x575f98;};'use strict';var _=require(_0xbe61('0x0'));var util=require(_0xbe61('0x1'));var logger=require(_0xbe61('0x2'))(_0xbe61('0x3'));var moment=require('moment');var BPromise=require(_0xbe61('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe61('0x5'));var config=require(_0xbe61('0x6'));var attributes=require('./integration.attributes');module[_0xbe61('0x7')]=function(_0x49d9ea,_0x45fb65){return _0x49d9ea[_0xbe61('0x8')](_0xbe61('0x9'),attributes,{'tableName':_0xbe61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc1a=['path','rimraf','../../config/environment','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','request-promise'];(function(_0x33eb5c,_0x4a7d98){var _0x253328=function(_0x3b23a0){while(--_0x3b23a0){_0x33eb5c['push'](_0x33eb5c['shift']());}};_0x253328(++_0x4a7d98);}(_0xcc1a,0x80));var _0xacc1=function(_0x388914,_0x3c63f9){_0x388914=_0x388914-0x0;var _0x1f9111=_0xcc1a[_0x388914];return _0x1f9111;};'use strict';var _=require(_0xacc1('0x0'));var util=require(_0xacc1('0x1'));var logger=require(_0xacc1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xacc1('0x3'));var fs=require('fs');var path=require(_0xacc1('0x4'));var rimraf=require(_0xacc1('0x5'));var config=require(_0xacc1('0x6'));var attributes=require(_0xacc1('0x7'));module[_0xacc1('0x8')]=function(_0x2a6b8b,_0x4ea230){return _0x2a6b8b[_0xacc1('0x9')]('Integration',attributes,{'tableName':_0xacc1('0xa'),'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 cce3e50..40aa694 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x55f982,_0x3a4992){var _0x4db75b=function(_0x20a0cd){while(--_0x20a0cd){_0x55f982['push'](_0x55f982['shift']());}};_0x4db75b(++_0x3a4992);}(_0x66fa,0x117));var _0xa66f=function(_0x4da32c,_0x19a52e){_0x4da32c=_0x4da32c-0x0;var _0x24369d=_0x66fa[_0x4da32c];return _0x24369d;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0x7a54=['info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x1c42f1,_0x26cd0c){_0x1c42f1=_0x1c42f1-0x0;var _0x41b0ba=_0x7a54[_0x1c42f1];return _0x41b0ba;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Integration,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index eb9bb22..cce71d3 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 _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xda2d,0x102));var _0xdda2=function(_0x44cc2e,_0x103603){_0x44cc2e=_0x44cc2e-0x0;var _0x55cd93=_0xda2d[_0x44cc2e];return _0x55cd93;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0xeb51e9,_0x592ea4){var _0xb92903=function(_0x2d7434){while(--_0x2d7434){_0xeb51e9['push'](_0xeb51e9['shift']());}};_0xb92903(++_0x592ea4);}(_0x7880,0x1f4));var _0x0788=function(_0x3de0d9,_0x2ccb8f){_0x3de0d9=_0x3de0d9-0x0;var _0x161cd9=_0x7880[_0x3de0d9];return _0x161cd9;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index dcf7ccb..02b0c27 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 _0x7f02=['BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x21f405,_0x316de9){var _0x57f6aa=function(_0x584316){while(--_0x584316){_0x21f405['push'](_0x21f405['shift']());}};_0x57f6aa(++_0x316de9);}(_0x7f02,0x1a8));var _0x27f0=function(_0x36eafc,_0x23fc6e){_0x36eafc=_0x36eafc-0x0;var _0x412f49=_0x7f02[_0x36eafc];return _0x412f49;};'use strict';var Sequelize=require(_0x27f0('0x0'));module[_0x27f0('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x27f0('0x2')]},'exitStatus':{'type':Sequelize[_0x27f0('0x2')]},'ticketId':{'type':Sequelize[_0x27f0('0x2')]},'integrationId':{'type':Sequelize[_0x27f0('0x3')]},'contacts':{'type':Sequelize[_0x27f0('0x2')]},'uniqueid':{'type':Sequelize[_0x27f0('0x2')]},'calleridnum':{'type':Sequelize[_0x27f0('0x2')]},'calleridname':{'type':Sequelize[_0x27f0('0x2')]},'queue':{'type':Sequelize[_0x27f0('0x2')]},'interface':{'type':Sequelize[_0x27f0('0x2')]},'membername':{'type':Sequelize[_0x27f0('0x2')]},'agentcalledAt':{'type':Sequelize[_0x27f0('0x4')]},'agentconnectAt':{'type':Sequelize[_0x27f0('0x4')]},'holdtime':{'type':Sequelize[_0x27f0('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x27f0('0x3')]},'agentacw':{'type':Sequelize[_0x27f0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x27f0('0x3')]},'reason':{'type':Sequelize[_0x27f0('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x27f0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x27f0('0x4')]},'agentdump':{'type':Sequelize[_0x27f0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x27f0('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x27f0('0x2')]},'channelstate':{'type':Sequelize[_0x27f0('0x3')]},'channelstatedesc':{'type':Sequelize[_0x27f0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x27f0('0x2')]},'connectedlinename':{'type':Sequelize[_0x27f0('0x2')]},'language':{'type':Sequelize[_0x27f0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x27f0('0x2')]},'exten':{'type':Sequelize[_0x27f0('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x27f0('0x2')]},'destchannelstate':{'type':Sequelize[_0x27f0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x27f0('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x27f0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x27f0('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x27f0('0x2')]},'destaccountcode':{'type':Sequelize[_0x27f0('0x2')]},'destcontext':{'type':Sequelize[_0x27f0('0x2')]},'destexten':{'type':Sequelize[_0x27f0('0x2')]},'destpriority':{'type':Sequelize[_0x27f0('0x2')]},'destuniqueid':{'type':Sequelize[_0x27f0('0x2')]},'messageId':{'type':Sequelize[_0x27f0('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x27f0('0x2')]},'from':{'type':Sequelize[_0x27f0('0x2')]},'to':{'type':Sequelize[_0x27f0('0x2')]},'cc':{'type':Sequelize[_0x27f0('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x27f0('0x6')]},'text':{'type':Sequelize[_0x27f0('0x6')]},'status':{'type':Sequelize[_0x27f0('0x7')]('SENT',_0x27f0('0x8'),_0x27f0('0x9'),_0x27f0('0xa'))},'url':{'type':Sequelize[_0x27f0('0x2')]},'app':{'type':Sequelize[_0x27f0('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x27f0('0x3')]}}; \ No newline at end of file +var _0xab9e=['RECEIVED','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x59fe6b,_0x12bc6c){var _0x5ab993=function(_0x211a50){while(--_0x211a50){_0x59fe6b['push'](_0x59fe6b['shift']());}};_0x5ab993(++_0x12bc6c);}(_0xab9e,0x14e));var _0xeab9=function(_0x5ca1c1,_0x5af837){_0x5ca1c1=_0x5ca1c1-0x0;var _0x1cccd7=_0xab9e[_0x5ca1c1];return _0x1cccd7;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0xeab9('0x0')]},'eventChannel':{'type':Sequelize[_0xeab9('0x0')]},'exitStatus':{'type':Sequelize[_0xeab9('0x0')]},'ticketId':{'type':Sequelize[_0xeab9('0x0')]},'integrationId':{'type':Sequelize[_0xeab9('0x1')]},'contacts':{'type':Sequelize[_0xeab9('0x0')]},'uniqueid':{'type':Sequelize[_0xeab9('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xeab9('0x0')]},'queue':{'type':Sequelize[_0xeab9('0x0')]},'interface':{'type':Sequelize[_0xeab9('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xeab9('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xeab9('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xeab9('0x1')]},'agentacw':{'type':Sequelize[_0xeab9('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeab9('0x1')]},'reason':{'type':Sequelize[_0xeab9('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xeab9('0x2')]},'agentdump':{'type':Sequelize[_0xeab9('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xeab9('0x2')]},'lastevent':{'type':Sequelize[_0xeab9('0x0')]},'channel':{'type':Sequelize[_0xeab9('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xeab9('0x0')]},'language':{'type':Sequelize[_0xeab9('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xeab9('0x0')]},'priority':{'type':Sequelize[_0xeab9('0x0')]},'destchannel':{'type':Sequelize[_0xeab9('0x0')]},'destchannelstate':{'type':Sequelize[_0xeab9('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0xeab9('0x0')]},'destcalleridnum':{'type':Sequelize[_0xeab9('0x0')]},'destcalleridname':{'type':Sequelize[_0xeab9('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xeab9('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xeab9('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xeab9('0x0')]},'destcontext':{'type':Sequelize[_0xeab9('0x0')]},'destexten':{'type':Sequelize[_0xeab9('0x0')]},'destpriority':{'type':Sequelize[_0xeab9('0x0')]},'destuniqueid':{'type':Sequelize[_0xeab9('0x0')]},'messageId':{'type':Sequelize[_0xeab9('0x0')]},'inReplyTo':{'type':Sequelize[_0xeab9('0x0')]},'subject':{'type':Sequelize[_0xeab9('0x0')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xeab9('0x0')]},'cc':{'type':Sequelize[_0xeab9('0x0')]},'attachment':{'type':Sequelize[_0xeab9('0x4')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xeab9('0x4')]},'status':{'type':Sequelize[_0xeab9('0x5')](_0xeab9('0x6'),_0xeab9('0x7'),_0xeab9('0x8'),'FAILED')},'url':{'type':Sequelize[_0xeab9('0x0')]},'app':{'type':Sequelize[_0xeab9('0x0')]},'appdata':{'type':Sequelize[_0xeab9('0x0')]},'projectId':{'type':Sequelize[_0xeab9('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 3ebb041..15b0ccf 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 _0xd39b=['filter','where','merge','VIRTUAL','options','findAll','catch','params','rawAttributes','length','includeAll','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','IntegrationReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','filters'];(function(_0x712903,_0x999dad){var _0x474a06=function(_0x1932d7){while(--_0x1932d7){_0x712903['push'](_0x712903['shift']());}};_0x474a06(++_0x999dad);}(_0xd39b,0x138));var _0xbd39=function(_0x462ab0,_0x545049){_0x462ab0=_0x462ab0-0x0;var _0x161360=_0xd39b[_0x462ab0];return _0x161360;};'use strict';var emlformat=require(_0xbd39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd39('0x1'));var jsonpatch=require(_0xbd39('0x2'));var rp=require('request-promise');var moment=require(_0xbd39('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbd39('0x4'));var util=require(_0xbd39('0x5'));var path=require(_0xbd39('0x6'));var sox=require(_0xbd39('0x7'));var csv=require(_0xbd39('0x8'));var ejs=require(_0xbd39('0x9'));var fs=require('fs');var fs_extra=require(_0xbd39('0xa'));var _=require(_0xbd39('0xb'));var squel=require('squel');var crypto=require(_0xbd39('0xc'));var jsforce=require(_0xbd39('0xd'));var deskjs=require(_0xbd39('0xe'));var toCsv=require(_0xbd39('0x8'));var querystring=require(_0xbd39('0xf'));var Papa=require(_0xbd39('0x10'));var Redis=require('ioredis');var authService=require(_0xbd39('0x11'));var qs=require(_0xbd39('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd39('0x13'));var logger=require('../../config/logger')(_0xbd39('0x14'));var utils=require(_0xbd39('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbd39('0x16'));var db=require(_0xbd39('0x17'))['db'];function respondWithStatusCode(_0x48c075,_0xd83a1){_0xd83a1=_0xd83a1||0xcc;return function(_0x1c55f8){if(_0x1c55f8){return _0x48c075[_0xbd39('0x18')](_0xd83a1);}return _0x48c075['status'](_0xd83a1)[_0xbd39('0x19')]();};}function respondWithResult(_0x86189f,_0x44da6f){_0x44da6f=_0x44da6f||0xc8;return function(_0x2cc36e){if(_0x2cc36e){return _0x86189f[_0xbd39('0x1a')](_0x44da6f)[_0xbd39('0x1b')](_0x2cc36e);}};}function respondWithFilteredResult(_0x3dfaa2,_0x23ccc7){return function(_0x307d38){if(_0x307d38){var _0x5d8ccc=typeof _0x23ccc7[_0xbd39('0x1c')]==='undefined'&&typeof _0x23ccc7[_0xbd39('0x1d')]===_0xbd39('0x1e');var _0x398c4d=_0x307d38[_0xbd39('0x1f')];var _0x3eef06=_0x5d8ccc?0x0:_0x23ccc7[_0xbd39('0x1c')];var _0x19268d=_0x5d8ccc?_0x307d38['count']:_0x23ccc7[_0xbd39('0x1c')]+_0x23ccc7['limit'];var _0x37b1a4;if(_0x19268d>=_0x398c4d){_0x19268d=_0x398c4d;_0x37b1a4=0xc8;}else{_0x37b1a4=0xce;}_0x3dfaa2[_0xbd39('0x1a')](_0x37b1a4);return _0x3dfaa2[_0xbd39('0x20')](_0xbd39('0x21'),_0x3eef06+'-'+_0x19268d+'/'+_0x398c4d)[_0xbd39('0x1b')](_0x307d38);}return null;};}function patchUpdates(_0xf8fa27){return function(_0x98140d){try{jsonpatch[_0xbd39('0x22')](_0x98140d,_0xf8fa27,!![]);}catch(_0x31cde8){return BPromise[_0xbd39('0x23')](_0x31cde8);}return _0x98140d[_0xbd39('0x24')]();};}function saveUpdates(_0x4aa0c7,_0x1a6755){return function(_0x4d67a1){if(_0x4d67a1){return _0x4d67a1[_0xbd39('0x25')](_0x4aa0c7)[_0xbd39('0x26')](function(_0x2b27af){return _0x2b27af;});}return null;};}function removeEntity(_0x395d8e,_0x3830cf){return function(_0x3ed11d){if(_0x3ed11d){return _0x3ed11d['destroy']()[_0xbd39('0x26')](function(){_0x395d8e[_0xbd39('0x1a')](0xcc)[_0xbd39('0x19')]();});}};}function handleEntityNotFound(_0x3acd27,_0x1d7e1f){return function(_0x17bb2e){if(!_0x17bb2e){_0x3acd27['sendStatus'](0x194);}return _0x17bb2e;};}function handleError(_0x4ca097,_0x45f754){_0x45f754=_0x45f754||0x1f4;return function(_0x1b4eb1){logger[_0xbd39('0x27')](_0x1b4eb1[_0xbd39('0x28')]);if(_0x1b4eb1['name']){delete _0x1b4eb1[_0xbd39('0x29')];}_0x4ca097[_0xbd39('0x1a')](_0x45f754)[_0xbd39('0x2a')](_0x1b4eb1);};}exports[_0xbd39('0x2b')]=function(_0x1228f3,_0x15f251){var _0x26c20a={},_0x3891d6={},_0x5b026f={'count':0x0,'rows':[]};var _0x30a7d4=_[_0xbd39('0x2c')](db[_0xbd39('0x2d')]['rawAttributes'],function(_0x20dd0f){return{'name':_0x20dd0f[_0xbd39('0x2e')],'type':_0x20dd0f[_0xbd39('0x2f')][_0xbd39('0x30')]};});_0x3891d6[_0xbd39('0x31')]=_[_0xbd39('0x2c')](_0x30a7d4,_0xbd39('0x29'));_0x3891d6[_0xbd39('0x32')]=_[_0xbd39('0x33')](_0x1228f3[_0xbd39('0x32')]);_0x3891d6['filters']=_[_0xbd39('0x34')](_0x3891d6[_0xbd39('0x31')],_0x3891d6[_0xbd39('0x32')]);_0x26c20a[_0xbd39('0x35')]=_[_0xbd39('0x34')](_0x3891d6['model'],qs[_0xbd39('0x36')](_0x1228f3[_0xbd39('0x32')][_0xbd39('0x36')]));_0x26c20a['attributes']=_0x26c20a['attributes']['length']?_0x26c20a['attributes']:_0x3891d6['model'];if(!_0x1228f3[_0xbd39('0x32')]['hasOwnProperty']('nolimit')){_0x26c20a['limit']=qs[_0xbd39('0x1d')](_0x1228f3[_0xbd39('0x32')][_0xbd39('0x1d')]);_0x26c20a[_0xbd39('0x1c')]=qs[_0xbd39('0x1c')](_0x1228f3[_0xbd39('0x32')][_0xbd39('0x1c')]);}_0x26c20a[_0xbd39('0x37')]=qs[_0xbd39('0x38')](_0x1228f3[_0xbd39('0x32')]['sort']);_0x26c20a['where']=qs['filters'](_['pick'](_0x1228f3[_0xbd39('0x32')],_0x3891d6[_0xbd39('0x39')]),_0x30a7d4);if(_0x1228f3[_0xbd39('0x32')][_0xbd39('0x3a')]){_0x26c20a[_0xbd39('0x3b')]=_[_0xbd39('0x3c')](_0x26c20a[_0xbd39('0x3b')],{'$or':_[_0xbd39('0x2c')](_0x30a7d4,function(_0x361e31){if(_0x361e31[_0xbd39('0x2f')]!==_0xbd39('0x3d')){var _0x41fdc7={};_0x41fdc7[_0x361e31[_0xbd39('0x29')]]={'$like':'%'+_0x1228f3[_0xbd39('0x32')][_0xbd39('0x3a')]+'%'};return _0x41fdc7;}})});}_0x26c20a=_['merge']({},_0x26c20a,_0x1228f3[_0xbd39('0x3e')]);var _0x5e2c07={'where':_0x26c20a[_0xbd39('0x3b')]};return db[_0xbd39('0x2d')]['count'](_0x5e2c07)[_0xbd39('0x26')](function(_0x27711c){_0x5b026f[_0xbd39('0x1f')]=_0x27711c;if(_0x1228f3[_0xbd39('0x32')]['includeAll']){_0x26c20a['include']=[{'all':!![]}];}return db[_0xbd39('0x2d')][_0xbd39('0x3f')](_0x26c20a);})[_0xbd39('0x26')](function(_0x1bebfc){_0x5b026f['rows']=_0x1bebfc;return _0x5b026f;})['then'](respondWithFilteredResult(_0x15f251,_0x26c20a))[_0xbd39('0x40')](handleError(_0x15f251,null));};exports['show']=function(_0x4750e4,_0x12d63d){var _0x95ce0d={'raw':![],'where':{'id':_0x4750e4[_0xbd39('0x41')]['id']}},_0x475272={};_0x475272[_0xbd39('0x31')]=_[_0xbd39('0x33')](db[_0xbd39('0x2d')][_0xbd39('0x42')]);_0x475272[_0xbd39('0x32')]=_[_0xbd39('0x33')](_0x4750e4['query']);_0x475272[_0xbd39('0x39')]=_['intersection'](_0x475272[_0xbd39('0x31')],_0x475272[_0xbd39('0x32')]);_0x95ce0d[_0xbd39('0x35')]=_['intersection'](_0x475272['model'],qs[_0xbd39('0x36')](_0x4750e4[_0xbd39('0x32')][_0xbd39('0x36')]));_0x95ce0d[_0xbd39('0x35')]=_0x95ce0d[_0xbd39('0x35')][_0xbd39('0x43')]?_0x95ce0d[_0xbd39('0x35')]:_0x475272[_0xbd39('0x31')];if(_0x4750e4[_0xbd39('0x32')][_0xbd39('0x44')]){_0x95ce0d['include']=[{'all':!![]}];}_0x95ce0d=_['merge']({},_0x95ce0d,_0x4750e4[_0xbd39('0x3e')]);return db[_0xbd39('0x2d')][_0xbd39('0x45')](_0x95ce0d)[_0xbd39('0x26')](handleEntityNotFound(_0x12d63d,null))[_0xbd39('0x26')](respondWithResult(_0x12d63d,null))['catch'](handleError(_0x12d63d,null));};exports[_0xbd39('0x46')]=function(_0x3f42c1,_0x435186){return db[_0xbd39('0x2d')][_0xbd39('0x46')](_0x3f42c1[_0xbd39('0x47')],{})[_0xbd39('0x26')](respondWithResult(_0x435186,0xc9))[_0xbd39('0x40')](handleError(_0x435186,null));};exports[_0xbd39('0x25')]=function(_0x3e1e05,_0xe07f0f){if(_0x3e1e05['body']['id']){delete _0x3e1e05['body']['id'];}return db[_0xbd39('0x2d')][_0xbd39('0x45')]({'where':{'id':_0x3e1e05[_0xbd39('0x41')]['id']}})[_0xbd39('0x26')](handleEntityNotFound(_0xe07f0f,null))['then'](saveUpdates(_0x3e1e05['body'],null))[_0xbd39('0x26')](respondWithResult(_0xe07f0f,null))[_0xbd39('0x40')](handleError(_0xe07f0f,null));};exports[_0xbd39('0x48')]=function(_0x31ebd0,_0x59a11c){return db[_0xbd39('0x2d')][_0xbd39('0x45')]({'where':{'id':_0x31ebd0['params']['id']}})[_0xbd39('0x26')](handleEntityNotFound(_0x59a11c,null))['then'](removeEntity(_0x59a11c,null))[_0xbd39('0x40')](handleError(_0x59a11c,null));};exports[_0xbd39('0x49')]=function(_0x132016,_0xc8dfd9){return db['IntegrationReport'][_0xbd39('0x49')]()[_0xbd39('0x26')](respondWithResult(_0xc8dfd9,null))[_0xbd39('0x40')](handleError(_0xc8dfd9,null));}; \ No newline at end of file +var _0xb266=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params','catch','create','body','find','describe','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb266,0x75));var _0x6b26=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb266[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b26('0x0'));var zipdir=require(_0x6b26('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b26('0x2'));var moment=require(_0x6b26('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6b26('0x4'));var util=require('util');var path=require(_0x6b26('0x5'));var sox=require('sox');var csv=require(_0x6b26('0x6'));var ejs=require(_0x6b26('0x7'));var fs=require('fs');var fs_extra=require(_0x6b26('0x8'));var _=require(_0x6b26('0x9'));var squel=require(_0x6b26('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6b26('0x6'));var querystring=require(_0x6b26('0xb'));var Papa=require(_0x6b26('0xc'));var Redis=require('ioredis');var authService=require(_0x6b26('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6b26('0xe'));var hardwareService=require(_0x6b26('0xf'));var logger=require(_0x6b26('0x10'))(_0x6b26('0x11'));var utils=require('../../config/utils');var config=require(_0x6b26('0x12'));var licenseUtil=require(_0x6b26('0x13'));var db=require(_0x6b26('0x14'))['db'];function respondWithStatusCode(_0x191e0b,_0x1fbeef){_0x1fbeef=_0x1fbeef||0xcc;return function(_0x3c9b25){if(_0x3c9b25){return _0x191e0b['sendStatus'](_0x1fbeef);}return _0x191e0b['status'](_0x1fbeef)[_0x6b26('0x15')]();};}function respondWithResult(_0x7dd845,_0x3e62d5){_0x3e62d5=_0x3e62d5||0xc8;return function(_0x3ced1b){if(_0x3ced1b){return _0x7dd845[_0x6b26('0x16')](_0x3e62d5)[_0x6b26('0x17')](_0x3ced1b);}};}function respondWithFilteredResult(_0x598f60,_0x3d192f){return function(_0x5e836f){if(_0x5e836f){var _0x700e11=typeof _0x3d192f[_0x6b26('0x18')]===_0x6b26('0x19')&&typeof _0x3d192f[_0x6b26('0x1a')]===_0x6b26('0x19');var _0x2dcffb=_0x5e836f[_0x6b26('0x1b')];var _0x3402ba=_0x700e11?0x0:_0x3d192f['offset'];var _0xaaa113=_0x700e11?_0x5e836f[_0x6b26('0x1b')]:_0x3d192f[_0x6b26('0x18')]+_0x3d192f[_0x6b26('0x1a')];var _0x2923d0;if(_0xaaa113>=_0x2dcffb){_0xaaa113=_0x2dcffb;_0x2923d0=0xc8;}else{_0x2923d0=0xce;}_0x598f60['status'](_0x2923d0);return _0x598f60[_0x6b26('0x1c')](_0x6b26('0x1d'),_0x3402ba+'-'+_0xaaa113+'/'+_0x2dcffb)['json'](_0x5e836f);}return null;};}function patchUpdates(_0x3296b6){return function(_0x569816){try{jsonpatch[_0x6b26('0x1e')](_0x569816,_0x3296b6,!![]);}catch(_0xc34d04){return BPromise[_0x6b26('0x1f')](_0xc34d04);}return _0x569816[_0x6b26('0x20')]();};}function saveUpdates(_0x49a30a,_0x32cdd8){return function(_0x45a156){if(_0x45a156){return _0x45a156['update'](_0x49a30a)['then'](function(_0x4ca1aa){return _0x4ca1aa;});}return null;};}function removeEntity(_0x5484c9,_0x39b1e7){return function(_0x48490f){if(_0x48490f){return _0x48490f['destroy']()[_0x6b26('0x21')](function(){_0x5484c9[_0x6b26('0x16')](0xcc)[_0x6b26('0x15')]();});}};}function handleEntityNotFound(_0x51399f,_0x4bcbf6){return function(_0x3a917f){if(!_0x3a917f){_0x51399f[_0x6b26('0x22')](0x194);}return _0x3a917f;};}function handleError(_0x1eaa3b,_0x58da8b){_0x58da8b=_0x58da8b||0x1f4;return function(_0x2ab1a0){logger[_0x6b26('0x23')](_0x2ab1a0['stack']);if(_0x2ab1a0[_0x6b26('0x24')]){delete _0x2ab1a0['name'];}_0x1eaa3b['status'](_0x58da8b)[_0x6b26('0x25')](_0x2ab1a0);};}exports[_0x6b26('0x26')]=function(_0xed5b12,_0x487745){var _0x34bf72={},_0x17926d={},_0x596120={'count':0x0,'rows':[]};var _0x3f0dd9=_[_0x6b26('0x27')](db[_0x6b26('0x28')][_0x6b26('0x29')],function(_0xbb7daa){return{'name':_0xbb7daa[_0x6b26('0x2a')],'type':_0xbb7daa[_0x6b26('0x2b')][_0x6b26('0x2c')]};});_0x17926d[_0x6b26('0x2d')]=_['map'](_0x3f0dd9,_0x6b26('0x24'));_0x17926d[_0x6b26('0x2e')]=_[_0x6b26('0x2f')](_0xed5b12[_0x6b26('0x2e')]);_0x17926d[_0x6b26('0x30')]=_[_0x6b26('0x31')](_0x17926d['model'],_0x17926d[_0x6b26('0x2e')]);_0x34bf72[_0x6b26('0x32')]=_[_0x6b26('0x31')](_0x17926d[_0x6b26('0x2d')],qs[_0x6b26('0x33')](_0xed5b12['query'][_0x6b26('0x33')]));_0x34bf72[_0x6b26('0x32')]=_0x34bf72[_0x6b26('0x32')][_0x6b26('0x34')]?_0x34bf72['attributes']:_0x17926d[_0x6b26('0x2d')];if(!_0xed5b12[_0x6b26('0x2e')][_0x6b26('0x35')](_0x6b26('0x36'))){_0x34bf72[_0x6b26('0x1a')]=qs['limit'](_0xed5b12[_0x6b26('0x2e')][_0x6b26('0x1a')]);_0x34bf72[_0x6b26('0x18')]=qs['offset'](_0xed5b12[_0x6b26('0x2e')][_0x6b26('0x18')]);}_0x34bf72['order']=qs[_0x6b26('0x37')](_0xed5b12[_0x6b26('0x2e')][_0x6b26('0x37')]);_0x34bf72[_0x6b26('0x38')]=qs['filters'](_[_0x6b26('0x39')](_0xed5b12[_0x6b26('0x2e')],_0x17926d['filters']),_0x3f0dd9);if(_0xed5b12['query'][_0x6b26('0x3a')]){_0x34bf72['where']=_[_0x6b26('0x3b')](_0x34bf72[_0x6b26('0x38')],{'$or':_[_0x6b26('0x27')](_0x3f0dd9,function(_0xb9c67b){if(_0xb9c67b['type']!==_0x6b26('0x3c')){var _0x2a11a4={};_0x2a11a4[_0xb9c67b['name']]={'$like':'%'+_0xed5b12[_0x6b26('0x2e')]['filter']+'%'};return _0x2a11a4;}})});}_0x34bf72=_['merge']({},_0x34bf72,_0xed5b12[_0x6b26('0x3d')]);var _0x2739f1={'where':_0x34bf72[_0x6b26('0x38')]};return db['IntegrationReport'][_0x6b26('0x1b')](_0x2739f1)[_0x6b26('0x21')](function(_0x3237ce){_0x596120[_0x6b26('0x1b')]=_0x3237ce;if(_0xed5b12[_0x6b26('0x2e')]['includeAll']){_0x34bf72[_0x6b26('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x6b26('0x3f')](_0x34bf72);})[_0x6b26('0x21')](function(_0x56b5e3){_0x596120['rows']=_0x56b5e3;return _0x596120;})[_0x6b26('0x21')](respondWithFilteredResult(_0x487745,_0x34bf72))['catch'](handleError(_0x487745,null));};exports['show']=function(_0x567e43,_0x43a9f7){var _0x1466a8={'raw':![],'where':{'id':_0x567e43[_0x6b26('0x40')]['id']}},_0x512c7b={};_0x512c7b['model']=_['keys'](db[_0x6b26('0x28')][_0x6b26('0x29')]);_0x512c7b[_0x6b26('0x2e')]=_[_0x6b26('0x2f')](_0x567e43[_0x6b26('0x2e')]);_0x512c7b[_0x6b26('0x30')]=_['intersection'](_0x512c7b['model'],_0x512c7b[_0x6b26('0x2e')]);_0x1466a8['attributes']=_[_0x6b26('0x31')](_0x512c7b[_0x6b26('0x2d')],qs[_0x6b26('0x33')](_0x567e43[_0x6b26('0x2e')]['fields']));_0x1466a8[_0x6b26('0x32')]=_0x1466a8['attributes'][_0x6b26('0x34')]?_0x1466a8[_0x6b26('0x32')]:_0x512c7b['model'];if(_0x567e43['query']['includeAll']){_0x1466a8[_0x6b26('0x3e')]=[{'all':!![]}];}_0x1466a8=_[_0x6b26('0x3b')]({},_0x1466a8,_0x567e43[_0x6b26('0x3d')]);return db[_0x6b26('0x28')]['find'](_0x1466a8)[_0x6b26('0x21')](handleEntityNotFound(_0x43a9f7,null))[_0x6b26('0x21')](respondWithResult(_0x43a9f7,null))[_0x6b26('0x41')](handleError(_0x43a9f7,null));};exports[_0x6b26('0x42')]=function(_0x3aba02,_0x4d93f9){return db['IntegrationReport'][_0x6b26('0x42')](_0x3aba02['body'],{})[_0x6b26('0x21')](respondWithResult(_0x4d93f9,0xc9))[_0x6b26('0x41')](handleError(_0x4d93f9,null));};exports['update']=function(_0x262135,_0xbdb8ed){if(_0x262135[_0x6b26('0x43')]['id']){delete _0x262135[_0x6b26('0x43')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x262135['params']['id']}})['then'](handleEntityNotFound(_0xbdb8ed,null))['then'](saveUpdates(_0x262135[_0x6b26('0x43')],null))[_0x6b26('0x21')](respondWithResult(_0xbdb8ed,null))[_0x6b26('0x41')](handleError(_0xbdb8ed,null));};exports['destroy']=function(_0x22d934,_0x3a088e){return db[_0x6b26('0x28')][_0x6b26('0x44')]({'where':{'id':_0x22d934['params']['id']}})[_0x6b26('0x21')](handleEntityNotFound(_0x3a088e,null))[_0x6b26('0x21')](removeEntity(_0x3a088e,null))[_0x6b26('0x41')](handleError(_0x3a088e,null));};exports['describe']=function(_0x535f0e,_0xebfb41){return db[_0x6b26('0x28')][_0x6b26('0x45')]()[_0x6b26('0x21')](respondWithResult(_0xebfb41,null))[_0x6b26('0x41')](handleError(_0xebfb41,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index be54c0d..b297b70 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 _0x535a=['../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x30fc6d,_0x1ccd9f){var _0x538a68=function(_0x367108){while(--_0x367108){_0x30fc6d['push'](_0x30fc6d['shift']());}};_0x538a68(++_0x1ccd9f);}(_0x535a,0x131));var _0xa535=function(_0x44bd70,_0x5a2f80){_0x44bd70=_0x44bd70-0x0;var _0xf09da9=_0x535a[_0x44bd70];return _0xf09da9;};'use strict';var _=require(_0xa535('0x0'));var util=require('util');var logger=require(_0xa535('0x1'))('api');var moment=require(_0xa535('0x2'));var BPromise=require(_0xa535('0x3'));var rp=require(_0xa535('0x4'));var fs=require('fs');var path=require(_0xa535('0x5'));var rimraf=require(_0xa535('0x6'));var config=require(_0xa535('0x7'));var attributes=require(_0xa535('0x8'));module[_0xa535('0x9')]=function(_0x554025,_0x13b0cb){return _0x554025[_0xa535('0xa')]('IntegrationReport',attributes,{'tableName':_0xa535('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x330f=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x330f,0x92));var _0xf330=function(_0x5f50b5,_0xa8db83){_0x5f50b5=_0x5f50b5-0x0;var _0x54c383=_0x330f[_0x5f50b5];return _0x54c383;};'use strict';var _=require(_0xf330('0x0'));var util=require(_0xf330('0x1'));var logger=require(_0xf330('0x2'))(_0xf330('0x3'));var moment=require(_0xf330('0x4'));var BPromise=require(_0xf330('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf330('0x6'));var config=require(_0xf330('0x7'));var attributes=require(_0xf330('0x8'));module[_0xf330('0x9')]=function(_0x14b93a,_0x5c925c){return _0x14b93a[_0xf330('0xa')](_0xf330('0xb'),attributes,{'tableName':_0xf330('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 6e91ef3..ab99084 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x687b,0x14a));var _0xb687=function(_0x3def1b,_0x56f748){_0x3def1b=_0x3def1b-0x0;var _0x57340e=_0x687b[_0x3def1b];return _0x57340e;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x814b=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x814b,0x1a2));var _0xb814=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x814b[_0x8b0f43];return _0x3f4425;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 3277896..74550f6 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 _0xf961=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete'];(function(_0x523ac4,_0x2c000f){var _0x289043=function(_0x595145){while(--_0x595145){_0x523ac4['push'](_0x523ac4['shift']());}};_0x289043(++_0x2c000f);}(_0xf961,0x1cf));var _0x1f96=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xf961[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0x1f96('0x0'));var util=require(_0x1f96('0x1'));var path=require(_0x1f96('0x2'));var timeout=require(_0x1f96('0x3'));var express=require('express');var router=express[_0x1f96('0x4')]();var fs_extra=require(_0x1f96('0x5'));var auth=require(_0x1f96('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f96('0x7'));var controller=require(_0x1f96('0x8'));router[_0x1f96('0x9')]('/',auth['isAuthenticated'](),controller[_0x1f96('0xa')]);router['get'](_0x1f96('0xb'),auth[_0x1f96('0xc')](),controller[_0x1f96('0xd')]);router[_0x1f96('0x9')](_0x1f96('0xe'),auth[_0x1f96('0xc')](),controller['getIntervals']);router['post']('/',auth[_0x1f96('0xc')](),controller['create']);router[_0x1f96('0xf')](_0x1f96('0xe'),auth[_0x1f96('0xc')](),controller[_0x1f96('0x10')]);router['post'](_0x1f96('0x11'),auth[_0x1f96('0xc')](),controller[_0x1f96('0x12')]);router['put'](_0x1f96('0xb'),auth[_0x1f96('0xc')](),controller[_0x1f96('0x13')]);router[_0x1f96('0x14')](_0x1f96('0xb'),auth[_0x1f96('0xc')](),controller['destroy']);module[_0x1f96('0x15')]=router; \ No newline at end of file +var _0x78e0=['/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','create','addInterval'];(function(_0x37e32a,_0x454300){var _0x376622=function(_0x1daf97){while(--_0x1daf97){_0x37e32a['push'](_0x37e32a['shift']());}};_0x376622(++_0x454300);}(_0x78e0,0x13e));var _0x078e=function(_0x149f64,_0x5438e4){_0x149f64=_0x149f64-0x0;var _0x5da58c=_0x78e0[_0x149f64];return _0x5da58c;};'use strict';var multer=require(_0x078e('0x0'));var util=require(_0x078e('0x1'));var path=require(_0x078e('0x2'));var timeout=require(_0x078e('0x3'));var express=require(_0x078e('0x4'));var router=express[_0x078e('0x5')]();var fs_extra=require(_0x078e('0x6'));var auth=require(_0x078e('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x078e('0x8'));router[_0x078e('0x9')]('/',auth[_0x078e('0xa')](),controller[_0x078e('0xb')]);router[_0x078e('0x9')]('/:id',auth[_0x078e('0xa')](),controller[_0x078e('0xc')]);router[_0x078e('0x9')](_0x078e('0xd'),auth[_0x078e('0xa')](),controller[_0x078e('0xe')]);router[_0x078e('0xf')]('/',auth['isAuthenticated'](),controller[_0x078e('0x10')]);router[_0x078e('0xf')](_0x078e('0xd'),auth[_0x078e('0xa')](),controller[_0x078e('0x11')]);router[_0x078e('0xf')](_0x078e('0x12'),auth[_0x078e('0xa')](),controller[_0x078e('0x13')]);router['put'](_0x078e('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x078e('0x15')]('/:id',auth[_0x078e('0xa')](),controller[_0x078e('0x16')]);module[_0x078e('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index c5226c2..8517dfd 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 _0xe37e=['sequelize','exports','STRING'];(function(_0xa73937,_0x29f9ce){var _0x2bbe3e=function(_0x48ed73){while(--_0x48ed73){_0xa73937['push'](_0xa73937['shift']());}};_0x2bbe3e(++_0x29f9ce);}(_0xe37e,0x8a));var _0xee37=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xe37e[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require(_0xee37('0x0'));module[_0xee37('0x1')]={'name':{'type':Sequelize[_0xee37('0x2')]},'description':{'type':Sequelize[_0xee37('0x2')]},'interval':{'type':Sequelize[_0xee37('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xd25e=['STRING','exports'];(function(_0x2f49dd,_0x3da9a7){var _0x89d5f3=function(_0x3c9ac1){while(--_0x3c9ac1){_0x2f49dd['push'](_0x2f49dd['shift']());}};_0x89d5f3(++_0x3da9a7);}(_0xd25e,0x155));var _0xed25=function(_0x57d9e9,_0x48ae6c){_0x57d9e9=_0x57d9e9-0x0;var _0x55b5bf=_0xd25e[_0x57d9e9];return _0x55b5bf;};'use strict';var Sequelize=require('sequelize');module[_0xed25('0x0')]={'name':{'type':Sequelize[_0xed25('0x1')]},'description':{'type':Sequelize[_0xed25('0x1')]},'interval':{'type':Sequelize[_0xed25('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 0bdce6f..1deaeac 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 _0xa8c2=['path','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','Intervals','error','stack','name','send','index','map','Interval','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','update','body','params','addInterval','getIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x5a36e1,_0x3f552b){var _0x284436=function(_0x5b56b4){while(--_0x5b56b4){_0x5a36e1['push'](_0x5a36e1['shift']());}};_0x284436(++_0x3f552b);}(_0xa8c2,0xff));var _0x2a8c=function(_0x463a03,_0x13914f){_0x463a03=_0x463a03-0x0;var _0x5baa30=_0xa8c2[_0x463a03];return _0x5baa30;};'use strict';var emlformat=require(_0x2a8c('0x0'));var rimraf=require(_0x2a8c('0x1'));var zipdir=require(_0x2a8c('0x2'));var jsonpatch=require(_0x2a8c('0x3'));var rp=require(_0x2a8c('0x4'));var moment=require(_0x2a8c('0x5'));var BPromise=require(_0x2a8c('0x6'));var Mustache=require(_0x2a8c('0x7'));var util=require(_0x2a8c('0x8'));var path=require(_0x2a8c('0x9'));var sox=require(_0x2a8c('0xa'));var csv=require(_0x2a8c('0xb'));var ejs=require(_0x2a8c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a8c('0xd'));var squel=require(_0x2a8c('0xe'));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(_0x2a8c('0xf'));var Redis=require(_0x2a8c('0x10'));var authService=require(_0x2a8c('0x11'));var qs=require(_0x2a8c('0x12'));var as=require(_0x2a8c('0x13'));var hardwareService=require(_0x2a8c('0x14'));var logger=require(_0x2a8c('0x15'))('api');var utils=require(_0x2a8c('0x16'));var config=require(_0x2a8c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x41a415,_0x3faaaf){_0x3faaaf=_0x3faaaf||0xcc;return function(_0xfe5d42){if(_0xfe5d42){return _0x41a415[_0x2a8c('0x18')](_0x3faaaf);}return _0x41a415[_0x2a8c('0x19')](_0x3faaaf)[_0x2a8c('0x1a')]();};}function respondWithResult(_0x485299,_0x5ef278){_0x5ef278=_0x5ef278||0xc8;return function(_0xcf7ba4){if(_0xcf7ba4){return _0x485299[_0x2a8c('0x19')](_0x5ef278)[_0x2a8c('0x1b')](_0xcf7ba4);}};}function respondWithFilteredResult(_0x373360,_0x5019a2){return function(_0x3e9e40){if(_0x3e9e40){var _0x385531=typeof _0x5019a2[_0x2a8c('0x1c')]===_0x2a8c('0x1d')&&typeof _0x5019a2['limit']==='undefined';var _0x1d7c2c=_0x3e9e40[_0x2a8c('0x1e')];var _0x5b49d3=_0x385531?0x0:_0x5019a2[_0x2a8c('0x1c')];var _0x2adbaf=_0x385531?_0x3e9e40[_0x2a8c('0x1e')]:_0x5019a2['offset']+_0x5019a2[_0x2a8c('0x1f')];var _0x3ad641;if(_0x2adbaf>=_0x1d7c2c){_0x2adbaf=_0x1d7c2c;_0x3ad641=0xc8;}else{_0x3ad641=0xce;}_0x373360[_0x2a8c('0x19')](_0x3ad641);return _0x373360[_0x2a8c('0x20')](_0x2a8c('0x21'),_0x5b49d3+'-'+_0x2adbaf+'/'+_0x1d7c2c)[_0x2a8c('0x1b')](_0x3e9e40);}return null;};}function patchUpdates(_0x4c5c96){return function(_0x386457){try{jsonpatch[_0x2a8c('0x22')](_0x386457,_0x4c5c96,!![]);}catch(_0x53261d){return BPromise['reject'](_0x53261d);}return _0x386457[_0x2a8c('0x23')]();};}function saveUpdates(_0x349501,_0x5ac2ff){return function(_0x346251){if(_0x346251){return _0x346251['update'](_0x349501)[_0x2a8c('0x24')](function(_0x1ee313){return _0x1ee313;});}return null;};}function removeEntity(_0x4f59c4,_0x453ecb){return function(_0x2c9b1a){if(_0x2c9b1a){return _0x2c9b1a[_0x2a8c('0x25')]()[_0x2a8c('0x24')](function(){var _0x1d4fb2=_0x2c9b1a[_0x2a8c('0x26')]({'plain':!![]});var _0x4136de=_0x2a8c('0x27');return db['UserProfileResource'][_0x2a8c('0x25')]({'where':{'type':_0x4136de,'resourceId':_0x1d4fb2['id']}})[_0x2a8c('0x24')](function(){return _0x2c9b1a;});})[_0x2a8c('0x24')](function(){_0x4f59c4['status'](0xcc)[_0x2a8c('0x1a')]();});}};}function handleEntityNotFound(_0x352560,_0x548aeb){return function(_0x257206){if(!_0x257206){_0x352560[_0x2a8c('0x18')](0x194);}return _0x257206;};}function handleError(_0xe24de7,_0x23f087){_0x23f087=_0x23f087||0x1f4;return function(_0x4cd18f){logger[_0x2a8c('0x28')](_0x4cd18f[_0x2a8c('0x29')]);if(_0x4cd18f[_0x2a8c('0x2a')]){delete _0x4cd18f[_0x2a8c('0x2a')];}_0xe24de7['status'](_0x23f087)[_0x2a8c('0x2b')](_0x4cd18f);};}exports[_0x2a8c('0x2c')]=function(_0x32630d,_0x2b46ce){var _0x24a843={},_0x27bc62={},_0x5a99b4={'count':0x0,'rows':[]};var _0x3d9cfc=_[_0x2a8c('0x2d')](db[_0x2a8c('0x2e')]['rawAttributes'],function(_0x4acf21){return{'name':_0x4acf21[_0x2a8c('0x2f')],'type':_0x4acf21[_0x2a8c('0x30')]['key']};});_0x27bc62[_0x2a8c('0x31')]=_[_0x2a8c('0x2d')](_0x3d9cfc,_0x2a8c('0x2a'));_0x27bc62['query']=_[_0x2a8c('0x32')](_0x32630d[_0x2a8c('0x33')]);_0x27bc62[_0x2a8c('0x34')]=_['intersection'](_0x27bc62[_0x2a8c('0x31')],_0x27bc62[_0x2a8c('0x33')]);_0x24a843[_0x2a8c('0x35')]=_[_0x2a8c('0x36')](_0x27bc62[_0x2a8c('0x31')],qs['fields'](_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x37')]));_0x24a843[_0x2a8c('0x35')]=_0x24a843[_0x2a8c('0x35')][_0x2a8c('0x38')]?_0x24a843[_0x2a8c('0x35')]:_0x27bc62['model'];if(!_0x32630d['query'][_0x2a8c('0x39')](_0x2a8c('0x3a'))){_0x24a843[_0x2a8c('0x1f')]=qs['limit'](_0x32630d[_0x2a8c('0x33')]['limit']);_0x24a843['offset']=qs[_0x2a8c('0x1c')](_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x1c')]);}_0x24a843[_0x2a8c('0x3b')]=qs['sort'](_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x3c')]);_0x24a843[_0x2a8c('0x3d')]=qs['filters'](_[_0x2a8c('0x3e')](_0x32630d[_0x2a8c('0x33')],_0x27bc62['filters']),_0x3d9cfc);if(_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x3f')]){_0x24a843[_0x2a8c('0x3d')]=_[_0x2a8c('0x40')](_0x24a843[_0x2a8c('0x3d')],{'$or':_[_0x2a8c('0x2d')](_0x3d9cfc,function(_0x41a513){if(_0x41a513[_0x2a8c('0x30')]!==_0x2a8c('0x41')){var _0x9191ca={};_0x9191ca[_0x41a513[_0x2a8c('0x2a')]]={'$like':'%'+_0x32630d['query'][_0x2a8c('0x3f')]+'%'};return _0x9191ca;}})});}_0x24a843=_['merge']({},_0x24a843,_0x32630d[_0x2a8c('0x42')]);var _0x359770={'where':_0x24a843[_0x2a8c('0x3d')]};return db[_0x2a8c('0x2e')]['count'](_0x359770)[_0x2a8c('0x24')](function(_0x212e68){_0x5a99b4[_0x2a8c('0x1e')]=_0x212e68;if(_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x43')]){_0x24a843[_0x2a8c('0x44')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x24a843);})[_0x2a8c('0x24')](function(_0x3e77db){_0x5a99b4[_0x2a8c('0x45')]=_0x3e77db;return _0x5a99b4;})[_0x2a8c('0x24')](respondWithFilteredResult(_0x2b46ce,_0x24a843))['catch'](handleError(_0x2b46ce,null));};exports['show']=function(_0x17bbe8,_0x1d3d9e){var _0xdc5639={'raw':!![],'where':{'id':_0x17bbe8['params']['id']}},_0x48e16c={};_0x48e16c[_0x2a8c('0x31')]=_[_0x2a8c('0x32')](db[_0x2a8c('0x2e')][_0x2a8c('0x46')]);_0x48e16c[_0x2a8c('0x33')]=_[_0x2a8c('0x32')](_0x17bbe8[_0x2a8c('0x33')]);_0x48e16c[_0x2a8c('0x34')]=_[_0x2a8c('0x36')](_0x48e16c['model'],_0x48e16c['query']);_0xdc5639[_0x2a8c('0x35')]=_['intersection'](_0x48e16c[_0x2a8c('0x31')],qs[_0x2a8c('0x37')](_0x17bbe8[_0x2a8c('0x33')][_0x2a8c('0x37')]));_0xdc5639[_0x2a8c('0x35')]=_0xdc5639['attributes']['length']?_0xdc5639[_0x2a8c('0x35')]:_0x48e16c[_0x2a8c('0x31')];if(_0x17bbe8[_0x2a8c('0x33')][_0x2a8c('0x43')]){_0xdc5639[_0x2a8c('0x44')]=[{'all':!![]}];}_0xdc5639=_[_0x2a8c('0x40')]({},_0xdc5639,_0x17bbe8[_0x2a8c('0x42')]);return db[_0x2a8c('0x2e')][_0x2a8c('0x47')](_0xdc5639)[_0x2a8c('0x24')](handleEntityNotFound(_0x1d3d9e,null))[_0x2a8c('0x24')](respondWithResult(_0x1d3d9e,null))[_0x2a8c('0x48')](handleError(_0x1d3d9e,null));};exports[_0x2a8c('0x49')]=function(_0x42d782,_0x1e74d6){return db[_0x2a8c('0x2e')][_0x2a8c('0x49')](_0x42d782['body'],{})['then'](function(_0xfee574){var _0x507bef=_0x42d782[_0x2a8c('0x4a')][_0x2a8c('0x26')]({'plain':!![]});if(!_0x507bef)throw new Error(_0x2a8c('0x4b'));if(_0x507bef['role']==='user'){var _0x5f1e1a=_0xfee574[_0x2a8c('0x26')]({'plain':!![]});var _0x5b6e88=_0x2a8c('0x27');return db['UserProfileSection'][_0x2a8c('0x47')]({'where':{'name':_0x5b6e88,'userProfileId':_0x507bef['userProfileId']},'raw':!![]})[_0x2a8c('0x24')](function(_0x49ccdb){if(_0x49ccdb&&_0x49ccdb['autoAssociation']===0x0){return db[_0x2a8c('0x4c')]['create']({'name':_0x5f1e1a['name'],'resourceId':_0x5f1e1a['id'],'type':_0x49ccdb['name'],'sectionId':_0x49ccdb['id']},{})['then'](function(){return _0xfee574;});}else{return _0xfee574;}})[_0x2a8c('0x48')](function(_0x1f0cfc){logger[_0x2a8c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f0cfc);throw _0x1f0cfc;});}return _0xfee574;})['then'](respondWithResult(_0x1e74d6,0xc9))[_0x2a8c('0x48')](handleError(_0x1e74d6,null));};exports[_0x2a8c('0x4d')]=function(_0x44aba5,_0x23d096){if(_0x44aba5[_0x2a8c('0x4e')]['id']){delete _0x44aba5['body']['id'];}return db[_0x2a8c('0x2e')][_0x2a8c('0x47')]({'where':{'id':_0x44aba5[_0x2a8c('0x4f')]['id']}})[_0x2a8c('0x24')](handleEntityNotFound(_0x23d096,null))[_0x2a8c('0x24')](saveUpdates(_0x44aba5[_0x2a8c('0x4e')],null))[_0x2a8c('0x24')](respondWithResult(_0x23d096,null))['catch'](handleError(_0x23d096,null));};exports[_0x2a8c('0x25')]=function(_0x31808d,_0x3e90bc){return db[_0x2a8c('0x2e')][_0x2a8c('0x47')]({'where':{'id':_0x31808d[_0x2a8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3e90bc,null))['then'](removeEntity(_0x3e90bc,null))['catch'](handleError(_0x3e90bc,null));};exports[_0x2a8c('0x50')]=function(_0x485159,_0x57f702,_0x23b07a){if(_0x485159[_0x2a8c('0x4e')]['id']){delete _0x485159[_0x2a8c('0x4e')]['id'];}return db['Interval']['find']({'where':{'id':_0x485159['params']['id']}})[_0x2a8c('0x24')](handleEntityNotFound(_0x57f702,null))[_0x2a8c('0x24')](function(_0x299b7f){if(_0x299b7f){_0x485159['body']['IntervalId']=_0x299b7f['id'];return db[_0x2a8c('0x2e')]['create'](_0x485159[_0x2a8c('0x4e')]);}})[_0x2a8c('0x24')](respondWithResult(_0x57f702,null))[_0x2a8c('0x48')](handleError(_0x57f702,null));};exports[_0x2a8c('0x51')]=function(_0x5a33db,_0x6636ea,_0xfda042){var _0x2df024={};var _0x490a57={};var _0x32019c;var _0x4f0f87;return db[_0x2a8c('0x2e')][_0x2a8c('0x52')]({'where':{'id':_0x5a33db[_0x2a8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6636ea,null))[_0x2a8c('0x24')](function(_0x17839d){if(_0x17839d){_0x32019c=_0x17839d;_0x490a57[_0x2a8c('0x31')]=_[_0x2a8c('0x32')](db[_0x2a8c('0x2e')][_0x2a8c('0x46')]);_0x490a57['query']=_['keys'](_0x5a33db[_0x2a8c('0x33')]);_0x490a57['filters']=_['intersection'](_0x490a57[_0x2a8c('0x31')],_0x490a57[_0x2a8c('0x33')]);_0x2df024[_0x2a8c('0x35')]=_[_0x2a8c('0x36')](_0x490a57['model'],qs[_0x2a8c('0x37')](_0x5a33db[_0x2a8c('0x33')][_0x2a8c('0x37')]));_0x2df024[_0x2a8c('0x35')]=_0x2df024[_0x2a8c('0x35')][_0x2a8c('0x38')]?_0x2df024[_0x2a8c('0x35')]:_0x490a57[_0x2a8c('0x31')];_0x2df024[_0x2a8c('0x3b')]=qs[_0x2a8c('0x3c')](_0x5a33db[_0x2a8c('0x33')][_0x2a8c('0x3c')]);_0x2df024[_0x2a8c('0x3d')]=qs['filters'](_['pick'](_0x5a33db[_0x2a8c('0x33')],_0x490a57[_0x2a8c('0x34')]));if(_0x5a33db['query'][_0x2a8c('0x3f')]){_0x2df024['where']=_[_0x2a8c('0x40')](_0x2df024[_0x2a8c('0x3d')],{'$or':_[_0x2a8c('0x2d')](_0x2df024[_0x2a8c('0x35')],function(_0xd6e6bf){var _0x2e6347={};_0x2e6347[_0xd6e6bf]={'$like':'%'+_0x5a33db['query'][_0x2a8c('0x3f')]+'%'};return _0x2e6347;})});}_0x2df024=_['merge']({},_0x2df024,_0x5a33db[_0x2a8c('0x42')]);return _0x32019c[_0x2a8c('0x51')](_0x2df024);}})['then'](function(_0xc06154){if(_0xc06154){_0x4f0f87=_0xc06154['length'];if(!_0x5a33db['query']['hasOwnProperty'](_0x2a8c('0x3a'))){_0x2df024[_0x2a8c('0x1f')]=qs[_0x2a8c('0x1f')](_0x5a33db['query']['limit']);_0x2df024['offset']=qs[_0x2a8c('0x1c')](_0x5a33db[_0x2a8c('0x33')][_0x2a8c('0x1c')]);}return _0x32019c['getIntervals'](_0x2df024);}})[_0x2a8c('0x24')](function(_0x3ef560){if(_0x3ef560){return _0x3ef560?{'count':_0x4f0f87,'rows':_0x3ef560}:null;}})[_0x2a8c('0x24')](respondWithResult(_0x6636ea,null))[_0x2a8c('0x48')](handleError(_0x6636ea,null));};exports['addIntervals']=function(_0x4f879f,_0x16a5a5,_0x2d773b){return db[_0x2a8c('0x2e')][_0x2a8c('0x52')]({'where':{'id':_0x4f879f['params']['id']}})[_0x2a8c('0x24')](handleEntityNotFound(_0x16a5a5,null))['then'](function(_0x7c2502){if(_0x7c2502){return db[_0x2a8c('0x53')][_0x2a8c('0x54')](function(_0x3b8320){return db['Interval']['destroy']({'where':{'IntervalId':_0x4f879f['params']['id']},'transaction':_0x3b8320})['then'](function(_0x58c305){var _0x29ae77=_[_0x2a8c('0x2d')](_0x4f879f[_0x2a8c('0x4e')],function(_0x206a00){delete _0x206a00['id'];_0x206a00[_0x2a8c('0x55')]=_0x4f879f[_0x2a8c('0x4f')]['id'];return _0x206a00;});return db['Interval'][_0x2a8c('0x56')](_0x29ae77,{'transaction':_0x3b8320});});})['then'](function(){return db[_0x2a8c('0x2e')][_0x2a8c('0x57')]({'where':{'IntervalId':_0x4f879f[_0x2a8c('0x4f')]['id']}});});}})[_0x2a8c('0x24')](respondWithResult(_0x16a5a5,null))[_0x2a8c('0x48')](handleError(_0x16a5a5,null));}; \ No newline at end of file +var _0x1daf=['role','UserProfileSection','userProfileId','autoAssociation','error','params','addInterval','getIntervals','findOne','addIntervals','transaction','bulkCreate','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','Intervals','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Interval','include','findAll','rows','keys','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x1daf,0x17c));var _0xf1da=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1daf[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xf1da('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1da('0x1'));var rp=require(_0xf1da('0x2'));var moment=require(_0xf1da('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf1da('0x4'));var util=require(_0xf1da('0x5'));var path=require(_0xf1da('0x6'));var sox=require(_0xf1da('0x7'));var csv=require('to-csv');var ejs=require(_0xf1da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf1da('0x9'));var crypto=require(_0xf1da('0xa'));var jsforce=require(_0xf1da('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf1da('0xc'));var Papa=require(_0xf1da('0xd'));var Redis=require(_0xf1da('0xe'));var authService=require(_0xf1da('0xf'));var qs=require(_0xf1da('0x10'));var as=require(_0xf1da('0x11'));var hardwareService=require(_0xf1da('0x12'));var logger=require(_0xf1da('0x13'))(_0xf1da('0x14'));var utils=require(_0xf1da('0x15'));var config=require(_0xf1da('0x16'));var licenseUtil=require(_0xf1da('0x17'));var db=require(_0xf1da('0x18'))['db'];var extensions=require(_0xf1da('0x19'));function respondWithStatusCode(_0x4de893,_0x5cdc90){_0x5cdc90=_0x5cdc90||0xcc;return function(_0x5658b9){if(_0x5658b9){return _0x4de893[_0xf1da('0x1a')](_0x5cdc90);}return _0x4de893[_0xf1da('0x1b')](_0x5cdc90)[_0xf1da('0x1c')]();};}function respondWithResult(_0x1a9740,_0x191b05){_0x191b05=_0x191b05||0xc8;return function(_0x7e6f45){if(_0x7e6f45){return _0x1a9740[_0xf1da('0x1b')](_0x191b05)[_0xf1da('0x1d')](_0x7e6f45);}};}function respondWithFilteredResult(_0x84e1cd,_0x4dbb89){return function(_0x159618){if(_0x159618){var _0x25df2b=typeof _0x4dbb89[_0xf1da('0x1e')]===_0xf1da('0x1f')&&typeof _0x4dbb89['limit']===_0xf1da('0x1f');var _0xb384db=_0x159618[_0xf1da('0x20')];var _0x1cef58=_0x25df2b?0x0:_0x4dbb89[_0xf1da('0x1e')];var _0x46761c=_0x25df2b?_0x159618[_0xf1da('0x20')]:_0x4dbb89[_0xf1da('0x1e')]+_0x4dbb89[_0xf1da('0x21')];var _0x2ccf4c;if(_0x46761c>=_0xb384db){_0x46761c=_0xb384db;_0x2ccf4c=0xc8;}else{_0x2ccf4c=0xce;}_0x84e1cd[_0xf1da('0x1b')](_0x2ccf4c);return _0x84e1cd[_0xf1da('0x22')](_0xf1da('0x23'),_0x1cef58+'-'+_0x46761c+'/'+_0xb384db)['json'](_0x159618);}return null;};}function patchUpdates(_0x15c82){return function(_0x284693){try{jsonpatch['apply'](_0x284693,_0x15c82,!![]);}catch(_0x49235e){return BPromise[_0xf1da('0x24')](_0x49235e);}return _0x284693[_0xf1da('0x25')]();};}function saveUpdates(_0x580721,_0x25c928){return function(_0x3b001c){if(_0x3b001c){return _0x3b001c[_0xf1da('0x26')](_0x580721)[_0xf1da('0x27')](function(_0x499acc){return _0x499acc;});}return null;};}function removeEntity(_0x388541,_0x4cc73b){return function(_0x176f9f){if(_0x176f9f){return _0x176f9f['destroy']()['then'](function(){var _0x48e143=_0x176f9f['get']({'plain':!![]});var _0x39cb39=_0xf1da('0x28');return db[_0xf1da('0x29')][_0xf1da('0x2a')]({'where':{'type':_0x39cb39,'resourceId':_0x48e143['id']}})[_0xf1da('0x27')](function(){return _0x176f9f;});})[_0xf1da('0x27')](function(){_0x388541[_0xf1da('0x1b')](0xcc)[_0xf1da('0x1c')]();});}};}function handleEntityNotFound(_0x1029eb,_0xfed4ea){return function(_0x4ba3a0){if(!_0x4ba3a0){_0x1029eb['sendStatus'](0x194);}return _0x4ba3a0;};}function handleError(_0x4f161c,_0xd9522f){_0xd9522f=_0xd9522f||0x1f4;return function(_0x13dc66){logger['error'](_0x13dc66[_0xf1da('0x2b')]);if(_0x13dc66[_0xf1da('0x2c')]){delete _0x13dc66[_0xf1da('0x2c')];}_0x4f161c['status'](_0xd9522f)[_0xf1da('0x2d')](_0x13dc66);};}exports[_0xf1da('0x2e')]=function(_0x2c34e8,_0x284730){var _0x5d0692={},_0x1bde66={},_0x43f461={'count':0x0,'rows':[]};var _0x357774=_[_0xf1da('0x2f')](db['Interval'][_0xf1da('0x30')],function(_0x1b5740){return{'name':_0x1b5740[_0xf1da('0x31')],'type':_0x1b5740[_0xf1da('0x32')][_0xf1da('0x33')]};});_0x1bde66[_0xf1da('0x34')]=_[_0xf1da('0x2f')](_0x357774,_0xf1da('0x2c'));_0x1bde66['query']=_['keys'](_0x2c34e8[_0xf1da('0x35')]);_0x1bde66[_0xf1da('0x36')]=_[_0xf1da('0x37')](_0x1bde66[_0xf1da('0x34')],_0x1bde66[_0xf1da('0x35')]);_0x5d0692[_0xf1da('0x38')]=_[_0xf1da('0x37')](_0x1bde66['model'],qs[_0xf1da('0x39')](_0x2c34e8['query'][_0xf1da('0x39')]));_0x5d0692[_0xf1da('0x38')]=_0x5d0692['attributes']['length']?_0x5d0692['attributes']:_0x1bde66[_0xf1da('0x34')];if(!_0x2c34e8[_0xf1da('0x35')][_0xf1da('0x3a')](_0xf1da('0x3b'))){_0x5d0692[_0xf1da('0x21')]=qs[_0xf1da('0x21')](_0x2c34e8['query']['limit']);_0x5d0692[_0xf1da('0x1e')]=qs[_0xf1da('0x1e')](_0x2c34e8[_0xf1da('0x35')][_0xf1da('0x1e')]);}_0x5d0692[_0xf1da('0x3c')]=qs[_0xf1da('0x3d')](_0x2c34e8[_0xf1da('0x35')][_0xf1da('0x3d')]);_0x5d0692[_0xf1da('0x3e')]=qs[_0xf1da('0x36')](_['pick'](_0x2c34e8[_0xf1da('0x35')],_0x1bde66[_0xf1da('0x36')]),_0x357774);if(_0x2c34e8[_0xf1da('0x35')][_0xf1da('0x3f')]){_0x5d0692[_0xf1da('0x3e')]=_[_0xf1da('0x40')](_0x5d0692['where'],{'$or':_[_0xf1da('0x2f')](_0x357774,function(_0x4633a9){if(_0x4633a9['type']!==_0xf1da('0x41')){var _0x4855f3={};_0x4855f3[_0x4633a9[_0xf1da('0x2c')]]={'$like':'%'+_0x2c34e8[_0xf1da('0x35')][_0xf1da('0x3f')]+'%'};return _0x4855f3;}})});}_0x5d0692=_['merge']({},_0x5d0692,_0x2c34e8[_0xf1da('0x42')]);var _0x3273da={'where':_0x5d0692[_0xf1da('0x3e')]};return db[_0xf1da('0x43')][_0xf1da('0x20')](_0x3273da)[_0xf1da('0x27')](function(_0x1a21f9){_0x43f461[_0xf1da('0x20')]=_0x1a21f9;if(_0x2c34e8[_0xf1da('0x35')]['includeAll']){_0x5d0692[_0xf1da('0x44')]=[{'all':!![]}];}return db['Interval'][_0xf1da('0x45')](_0x5d0692);})[_0xf1da('0x27')](function(_0x130258){_0x43f461[_0xf1da('0x46')]=_0x130258;return _0x43f461;})[_0xf1da('0x27')](respondWithFilteredResult(_0x284730,_0x5d0692))['catch'](handleError(_0x284730,null));};exports['show']=function(_0x56748a,_0x3dbdd9){var _0x32c90d={'raw':!![],'where':{'id':_0x56748a['params']['id']}},_0x2b605b={};_0x2b605b[_0xf1da('0x34')]=_[_0xf1da('0x47')](db[_0xf1da('0x43')][_0xf1da('0x30')]);_0x2b605b[_0xf1da('0x35')]=_[_0xf1da('0x47')](_0x56748a[_0xf1da('0x35')]);_0x2b605b[_0xf1da('0x36')]=_[_0xf1da('0x37')](_0x2b605b[_0xf1da('0x34')],_0x2b605b[_0xf1da('0x35')]);_0x32c90d[_0xf1da('0x38')]=_['intersection'](_0x2b605b[_0xf1da('0x34')],qs[_0xf1da('0x39')](_0x56748a[_0xf1da('0x35')][_0xf1da('0x39')]));_0x32c90d['attributes']=_0x32c90d['attributes'][_0xf1da('0x48')]?_0x32c90d['attributes']:_0x2b605b['model'];if(_0x56748a[_0xf1da('0x35')]['includeAll']){_0x32c90d['include']=[{'all':!![]}];}_0x32c90d=_['merge']({},_0x32c90d,_0x56748a[_0xf1da('0x42')]);return db['Interval'][_0xf1da('0x49')](_0x32c90d)['then'](handleEntityNotFound(_0x3dbdd9,null))['then'](respondWithResult(_0x3dbdd9,null))[_0xf1da('0x4a')](handleError(_0x3dbdd9,null));};exports[_0xf1da('0x4b')]=function(_0x4baa08,_0x59cd87){return db['Interval'][_0xf1da('0x4b')](_0x4baa08[_0xf1da('0x4c')],{})['then'](function(_0x1b89c8){var _0x46d9e8=_0x4baa08[_0xf1da('0x4d')][_0xf1da('0x4e')]({'plain':!![]});if(!_0x46d9e8)throw new Error(_0xf1da('0x4f'));if(_0x46d9e8[_0xf1da('0x50')]===_0xf1da('0x4d')){var _0x57eb14=_0x1b89c8[_0xf1da('0x4e')]({'plain':!![]});var _0x1d4359='Intervals';return db[_0xf1da('0x51')][_0xf1da('0x49')]({'where':{'name':_0x1d4359,'userProfileId':_0x46d9e8[_0xf1da('0x52')]},'raw':!![]})['then'](function(_0x3f4f83){if(_0x3f4f83&&_0x3f4f83[_0xf1da('0x53')]===0x0){return db[_0xf1da('0x29')]['create']({'name':_0x57eb14[_0xf1da('0x2c')],'resourceId':_0x57eb14['id'],'type':_0x3f4f83[_0xf1da('0x2c')],'sectionId':_0x3f4f83['id']},{})['then'](function(){return _0x1b89c8;});}else{return _0x1b89c8;}})[_0xf1da('0x4a')](function(_0x193d08){logger[_0xf1da('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x193d08);throw _0x193d08;});}return _0x1b89c8;})['then'](respondWithResult(_0x59cd87,0xc9))[_0xf1da('0x4a')](handleError(_0x59cd87,null));};exports[_0xf1da('0x26')]=function(_0x3c17f5,_0x10788a){if(_0x3c17f5[_0xf1da('0x4c')]['id']){delete _0x3c17f5[_0xf1da('0x4c')]['id'];}return db[_0xf1da('0x43')][_0xf1da('0x49')]({'where':{'id':_0x3c17f5[_0xf1da('0x55')]['id']}})[_0xf1da('0x27')](handleEntityNotFound(_0x10788a,null))[_0xf1da('0x27')](saveUpdates(_0x3c17f5[_0xf1da('0x4c')],null))[_0xf1da('0x27')](respondWithResult(_0x10788a,null))[_0xf1da('0x4a')](handleError(_0x10788a,null));};exports[_0xf1da('0x2a')]=function(_0x1e4123,_0x1a6870){return db[_0xf1da('0x43')][_0xf1da('0x49')]({'where':{'id':_0x1e4123[_0xf1da('0x55')]['id']}})['then'](handleEntityNotFound(_0x1a6870,null))['then'](removeEntity(_0x1a6870,null))[_0xf1da('0x4a')](handleError(_0x1a6870,null));};exports[_0xf1da('0x56')]=function(_0x4c581a,_0x16bfc3,_0x205629){if(_0x4c581a['body']['id']){delete _0x4c581a[_0xf1da('0x4c')]['id'];}return db['Interval']['find']({'where':{'id':_0x4c581a[_0xf1da('0x55')]['id']}})[_0xf1da('0x27')](handleEntityNotFound(_0x16bfc3,null))[_0xf1da('0x27')](function(_0x3a4205){if(_0x3a4205){_0x4c581a[_0xf1da('0x4c')]['IntervalId']=_0x3a4205['id'];return db[_0xf1da('0x43')][_0xf1da('0x4b')](_0x4c581a[_0xf1da('0x4c')]);}})[_0xf1da('0x27')](respondWithResult(_0x16bfc3,null))[_0xf1da('0x4a')](handleError(_0x16bfc3,null));};exports[_0xf1da('0x57')]=function(_0x5ed1a6,_0x2a698c,_0x3bfc1c){var _0x536347={};var _0x19bd79={};var _0x3e465c;var _0x47c5ba;return db[_0xf1da('0x43')][_0xf1da('0x58')]({'where':{'id':_0x5ed1a6[_0xf1da('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a698c,null))[_0xf1da('0x27')](function(_0x538b60){if(_0x538b60){_0x3e465c=_0x538b60;_0x19bd79[_0xf1da('0x34')]=_[_0xf1da('0x47')](db[_0xf1da('0x43')][_0xf1da('0x30')]);_0x19bd79['query']=_[_0xf1da('0x47')](_0x5ed1a6[_0xf1da('0x35')]);_0x19bd79[_0xf1da('0x36')]=_['intersection'](_0x19bd79[_0xf1da('0x34')],_0x19bd79[_0xf1da('0x35')]);_0x536347[_0xf1da('0x38')]=_[_0xf1da('0x37')](_0x19bd79[_0xf1da('0x34')],qs[_0xf1da('0x39')](_0x5ed1a6['query'][_0xf1da('0x39')]));_0x536347[_0xf1da('0x38')]=_0x536347['attributes']['length']?_0x536347[_0xf1da('0x38')]:_0x19bd79['model'];_0x536347[_0xf1da('0x3c')]=qs['sort'](_0x5ed1a6[_0xf1da('0x35')]['sort']);_0x536347[_0xf1da('0x3e')]=qs[_0xf1da('0x36')](_['pick'](_0x5ed1a6[_0xf1da('0x35')],_0x19bd79['filters']));if(_0x5ed1a6['query'][_0xf1da('0x3f')]){_0x536347[_0xf1da('0x3e')]=_[_0xf1da('0x40')](_0x536347[_0xf1da('0x3e')],{'$or':_[_0xf1da('0x2f')](_0x536347[_0xf1da('0x38')],function(_0x5f57a7){var _0x169dd1={};_0x169dd1[_0x5f57a7]={'$like':'%'+_0x5ed1a6[_0xf1da('0x35')]['filter']+'%'};return _0x169dd1;})});}_0x536347=_[_0xf1da('0x40')]({},_0x536347,_0x5ed1a6[_0xf1da('0x42')]);return _0x3e465c['getIntervals'](_0x536347);}})['then'](function(_0x583154){if(_0x583154){_0x47c5ba=_0x583154[_0xf1da('0x48')];if(!_0x5ed1a6['query'][_0xf1da('0x3a')]('nolimit')){_0x536347[_0xf1da('0x21')]=qs[_0xf1da('0x21')](_0x5ed1a6[_0xf1da('0x35')][_0xf1da('0x21')]);_0x536347[_0xf1da('0x1e')]=qs['offset'](_0x5ed1a6[_0xf1da('0x35')]['offset']);}return _0x3e465c['getIntervals'](_0x536347);}})['then'](function(_0x5c1dfc){if(_0x5c1dfc){return _0x5c1dfc?{'count':_0x47c5ba,'rows':_0x5c1dfc}:null;}})[_0xf1da('0x27')](respondWithResult(_0x2a698c,null))['catch'](handleError(_0x2a698c,null));};exports[_0xf1da('0x59')]=function(_0x83adb1,_0x2f9cdc,_0x431799){return db[_0xf1da('0x43')][_0xf1da('0x58')]({'where':{'id':_0x83adb1[_0xf1da('0x55')]['id']}})['then'](handleEntityNotFound(_0x2f9cdc,null))[_0xf1da('0x27')](function(_0x14b7ff){if(_0x14b7ff){return db['sequelize'][_0xf1da('0x5a')](function(_0x3b94d6){return db[_0xf1da('0x43')]['destroy']({'where':{'IntervalId':_0x83adb1[_0xf1da('0x55')]['id']},'transaction':_0x3b94d6})[_0xf1da('0x27')](function(_0x255255){var _0x5ae5e9=_[_0xf1da('0x2f')](_0x83adb1[_0xf1da('0x4c')],function(_0x13117a){delete _0x13117a['id'];_0x13117a['IntervalId']=_0x83adb1['params']['id'];return _0x13117a;});return db[_0xf1da('0x43')][_0xf1da('0x5b')](_0x5ae5e9,{'transaction':_0x3b94d6});});})['then'](function(){return db['Interval'][_0xf1da('0x45')]({'where':{'IntervalId':_0x83adb1['params']['id']}});});}})[_0xf1da('0x27')](respondWithResult(_0x2f9cdc,null))[_0xf1da('0x4a')](handleError(_0x2f9cdc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index a5b5b4d..dcdd28b 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 _0x36f2=['rewrite','lodash','../../config/logger','moment','path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x36f2,0x9b));var _0x236f=function(_0x335687,_0xf33653){_0x335687=_0x335687-0x0;var _0x330d7e=_0x36f2[_0x335687];return _0x330d7e;};'use strict';var _=require(_0x236f('0x0'));var util=require('util');var logger=require(_0x236f('0x1'))('api');var moment=require(_0x236f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x236f('0x3'));var rimraf=require(_0x236f('0x4'));var config=require('../../config/environment');var attributes=require(_0x236f('0x5'));var extensions=require(_0x236f('0x6'));module[_0x236f('0x7')]=function(_0x546eae,_0x562f7c){return _0x546eae['define'](_0x236f('0x8'),attributes,{'tableName':_0x236f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x20daee,_0xffd2b7){extensions[_0x236f('0xa')](_0x546eae,_0x20daee);},'afterBulkCreate':function(_0x2e7b4b,_0x16ce6c,_0x508d79){_0x508d79();extensions[_0x236f('0xa')](_0x546eae,_0x2e7b4b[0x0]);},'afterUpdate':function(_0x39b69b,_0x480f58){extensions[_0x236f('0xa')](_0x546eae,_0x39b69b);},'afterDestroy':function(_0x3bb719,_0x583b4a){extensions[_0x236f('0xa')](_0x546eae,_0x3bb719);}}});}; \ No newline at end of file +var _0xc63e=['request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','rewrite','lodash','util','../../config/logger','moment','bluebird'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xc63e,0x1db));var _0xec63=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0xc63e[_0x102f97];return _0xd22058;};'use strict';var _=require(_0xec63('0x0'));var util=require(_0xec63('0x1'));var logger=require(_0xec63('0x2'))('api');var moment=require(_0xec63('0x3'));var BPromise=require(_0xec63('0x4'));var rp=require(_0xec63('0x5'));var fs=require('fs');var path=require(_0xec63('0x6'));var rimraf=require('rimraf');var config=require(_0xec63('0x7'));var attributes=require(_0xec63('0x8'));var extensions=require(_0xec63('0x9'));module['exports']=function(_0x5b92ea,_0x17a464){return _0x5b92ea[_0xec63('0xa')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x518241,_0x2e1391){extensions[_0xec63('0xb')](_0x5b92ea,_0x518241);},'afterBulkCreate':function(_0x87be03,_0x5c268a,_0x182cb7){_0x182cb7();extensions['rewrite'](_0x5b92ea,_0x87be03[0x0]);},'afterUpdate':function(_0x6801f3,_0x590e5a){extensions[_0xec63('0xb')](_0x5b92ea,_0x6801f3);},'afterDestroy':function(_0x82a23e,_0x4f9922){extensions[_0xec63('0xb')](_0x5b92ea,_0x82a23e);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 64d9ddc..b1de455 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 _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 824cfb0..c1656d4 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(_0x3a5f51,_0x48a740){var _0x5d5d86=function(_0x151f4b){while(--_0x151f4b){_0x3a5f51['push'](_0x3a5f51['shift']());}};_0x5d5d86(++_0x48a740);}(_0xdb28,0x106));var _0x8db2=function(_0x45913d,_0x5668fe){_0x45913d=_0x45913d-0x0;var _0xcca703=_0xdb28[_0x45913d];return _0xcca703;};'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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x4c51d6,_0x3ee3cb){var _0x5dd987=function(_0x34d627){while(--_0x34d627){_0x4c51d6['push'](_0x4c51d6['shift']());}};_0x5dd987(++_0x3ee3cb);}(_0xadb5,0xad));var _0x5adb=function(_0x285487,_0x185d1c){_0x285487=_0x285487-0x0;var _0x5d8c45=_0xadb5[_0x285487];return _0x5d8c45;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index d2c0751..5aea8e9 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 _0x6d40=['customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','setEncoding','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','x-forwarded-for','connection','socket','remoteAddress','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504'];(function(_0x383ef6,_0x36d43e){var _0x3dd3a9=function(_0x16933c){while(--_0x16933c){_0x383ef6['push'](_0x383ef6['shift']());}};_0x3dd3a9(++_0x36d43e);}(_0x6d40,0x97));var _0x06d4=function(_0x14871e,_0x247791){_0x14871e=_0x14871e-0x0;var _0x538226=_0x6d40[_0x14871e];return _0x538226;};'use strict';var BPromise=require('bluebird');var https=require(_0x06d4('0x0'));var logger=require('../../config/logger')(_0x06d4('0x1'));var USERNAME=_0x06d4('0x2');var PASSWORD=_0x06d4('0x3');function openIssue(_0x24a096,_0x46ac9c){var _0x1be6f5={'fields':{'project':{'key':_0x24a096[_0x06d4('0x4')]||_0x06d4('0x5')},'summary':(_0x24a096[_0x06d4('0x6')]||_0x06d4('0x7'))+_0x06d4('0x8')+_0x24a096['ip'],'description':_0x24a096[_0x06d4('0x9')]||JSON[_0x06d4('0xa')](_0x24a096),'issuetype':{'name':_0x24a096[_0x06d4('0xb')]||_0x06d4('0xc')}}};_0x1be6f5[_0x06d4('0xd')]['customfield_11500']=_0x24a096['email'];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0xe')]=_0x24a096[_0x06d4('0xf')];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0x10')]=_0x24a096[_0x06d4('0x11')];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0x12')]=_0x24a096[_0x06d4('0x13')];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0x14')]=_0x24a096['reason'];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0x15')]=_0x24a096['ip'];var _0x25301d={'host':_0x06d4('0x16'),'port':0x1bb,'path':_0x06d4('0x17'),'method':_0x06d4('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x06d4('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x06d4('0x1a')]('base64')}};var _0x4c19c6=JSON[_0x06d4('0xa')](_0x1be6f5);var _0x4378e9=https['request'](_0x25301d,function(_0x43aa57){_0x43aa57[_0x06d4('0x1b')]('utf8');var _0x5e8c07='';_0x43aa57['on'](_0x06d4('0x1c'),function(_0x1dc438){_0x5e8c07+=_0x1dc438;});_0x43aa57['on'](_0x06d4('0x1d'),function(){if(_0x46ac9c){return _0x46ac9c[_0x06d4('0x1e')](_0x43aa57[_0x06d4('0x1f')])[_0x06d4('0x20')](JSON[_0x06d4('0x21')](_0x5e8c07));}});});_0x4378e9['on']('error',function(_0x31275d){if(_0x46ac9c){return _0x46ac9c[_0x06d4('0x1e')](0x1f4)[_0x06d4('0x20')]({'errors':[{'message':_0x06d4('0x22'),'type':_0x06d4('0x23')}]});}});_0x4378e9['write'](_0x4c19c6);_0x4378e9['end']();}exports[_0x06d4('0x24')]=openIssue;exports[_0x06d4('0x25')]=function(_0x39a90c,_0xb10981){_0x39a90c[_0x06d4('0x26')]['ip']=_0x39a90c['headers'][_0x06d4('0x27')]||_0x39a90c[_0x06d4('0x28')]['remoteAddress']||_0x39a90c[_0x06d4('0x29')][_0x06d4('0x2a')]||_0x39a90c[_0x06d4('0x28')]['socket'][_0x06d4('0x2a')];return openIssue(_0x39a90c[_0x06d4('0x26')],_0xb10981);}; \ No newline at end of file +var _0xa768=['email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','stringify','request','utf8','data','end','status','statusCode','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','fields'];(function(_0x10ca6f,_0x2906b6){var _0x4a284f=function(_0x3bbed8){while(--_0x3bbed8){_0x10ca6f['push'](_0x10ca6f['shift']());}};_0x4a284f(++_0x2906b6);}(_0xa768,0xa4));var _0x8a76=function(_0x147843,_0x196a0a){_0x147843=_0x147843-0x0;var _0x1be8c4=_0xa768[_0x147843];return _0x1be8c4;};'use strict';var BPromise=require('bluebird');var https=require(_0x8a76('0x0'));var logger=require(_0x8a76('0x1'))(_0x8a76('0x2'));var USERNAME=_0x8a76('0x3');var PASSWORD=_0x8a76('0x4');function openIssue(_0x2aa01a,_0x1744e1){var _0x515d52={'fields':{'project':{'key':_0x2aa01a[_0x8a76('0x5')]||_0x8a76('0x6')},'summary':(_0x2aa01a[_0x8a76('0x7')]||_0x8a76('0x8'))+_0x8a76('0x9')+_0x2aa01a['ip'],'description':_0x2aa01a[_0x8a76('0xa')]||JSON['stringify'](_0x2aa01a),'issuetype':{'name':_0x2aa01a['issuetype']||'Bug'}}};_0x515d52[_0x8a76('0xb')]['customfield_11500']=_0x2aa01a[_0x8a76('0xc')];_0x515d52[_0x8a76('0xb')][_0x8a76('0xd')]=_0x2aa01a[_0x8a76('0xe')];_0x515d52[_0x8a76('0xb')][_0x8a76('0xf')]=_0x2aa01a[_0x8a76('0x10')];_0x515d52['fields']['customfield_11503']=_0x2aa01a[_0x8a76('0x11')];_0x515d52[_0x8a76('0xb')][_0x8a76('0x12')]=_0x2aa01a[_0x8a76('0x13')];_0x515d52[_0x8a76('0xb')][_0x8a76('0x14')]=_0x2aa01a['ip'];var _0x220c86={'host':_0x8a76('0x15'),'port':0x1bb,'path':_0x8a76('0x16'),'method':_0x8a76('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x8a76('0x18')](_0x8a76('0x19'))}};var _0x31df5d=JSON[_0x8a76('0x1a')](_0x515d52);var _0x4672c6=https[_0x8a76('0x1b')](_0x220c86,function(_0x38424b){_0x38424b['setEncoding'](_0x8a76('0x1c'));var _0x51072c='';_0x38424b['on'](_0x8a76('0x1d'),function(_0x54321d){_0x51072c+=_0x54321d;});_0x38424b['on'](_0x8a76('0x1e'),function(){if(_0x1744e1){return _0x1744e1[_0x8a76('0x1f')](_0x38424b[_0x8a76('0x20')])['json'](JSON['parse'](_0x51072c));}});});_0x4672c6['on'](_0x8a76('0x21'),function(_0x4e6f41){if(_0x1744e1){return _0x1744e1['status'](0x1f4)[_0x8a76('0x22')]({'errors':[{'message':_0x8a76('0x23'),'type':_0x8a76('0x24')}]});}});_0x4672c6[_0x8a76('0x25')](_0x31df5d);_0x4672c6[_0x8a76('0x1e')]();}exports[_0x8a76('0x26')]=openIssue;exports['send']=function(_0x311be0,_0x39c7b3){_0x311be0[_0x8a76('0x27')]['ip']=_0x311be0[_0x8a76('0x28')][_0x8a76('0x29')]||_0x311be0[_0x8a76('0x2a')][_0x8a76('0x2b')]||_0x311be0['socket'][_0x8a76('0x2b')]||_0x311be0[_0x8a76('0x2a')]['socket'][_0x8a76('0x2b')];return openIssue(_0x311be0['body'],_0x39c7b3);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 78049b5..a5a2931 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 _0x1339=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x40ff79,_0x578a04){var _0x32234c=function(_0x1012fa){while(--_0x1012fa){_0x40ff79['push'](_0x40ff79['shift']());}};_0x32234c(++_0x578a04);}(_0x1339,0x1ed));var _0x9133=function(_0x84729e,_0x556434){_0x84729e=_0x84729e-0x0;var _0x33c775=_0x1339[_0x84729e];return _0x33c775;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['destroy']);module[_0x9133('0x13')]=router; \ No newline at end of file +var _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x329ba0,_0x2e889b){var _0x526123=function(_0x42656e){while(--_0x42656e){_0x329ba0['push'](_0x329ba0['shift']());}};_0x526123(++_0x2e889b);}(_0xa74f,0x9a));var _0xfa74=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0xa74f[_0x457b64];return _0x437111;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 4e018db..d4365ef 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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x43454,_0x884929){_0x43454=_0x43454-0x0;var _0x556b04=_0x7a54[_0x43454];return _0x556b04;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x42499e,_0x511ef1){_0x42499e=_0x42499e-0x0;var _0x3f4e67=_0x7a54[_0x42499e];return _0x3f4e67;};'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 e0847e8..d9176c4 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 _0x29b1=['where','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','order','sort','pick','filter'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x29b1,0x13b));var _0x129b=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x29b1[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x129b('0x0'));var jsonpatch=require(_0x129b('0x1'));var rp=require(_0x129b('0x2'));var moment=require(_0x129b('0x3'));var BPromise=require(_0x129b('0x4'));var Mustache=require(_0x129b('0x5'));var util=require(_0x129b('0x6'));var path=require(_0x129b('0x7'));var sox=require(_0x129b('0x8'));var csv=require(_0x129b('0x9'));var ejs=require(_0x129b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x129b('0xb'));var squel=require('squel');var crypto=require(_0x129b('0xc'));var jsforce=require(_0x129b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x129b('0xe'));var Papa=require('papaparse');var Redis=require(_0x129b('0xf'));var authService=require(_0x129b('0x10'));var qs=require(_0x129b('0x11'));var as=require(_0x129b('0x12'));var hardwareService=require(_0x129b('0x13'));var logger=require(_0x129b('0x14'))('api');var utils=require(_0x129b('0x15'));var config=require(_0x129b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x129b('0x17'))['db'];function respondWithStatusCode(_0x1e5102,_0x4b8f35){_0x4b8f35=_0x4b8f35||0xcc;return function(_0x3cf7c5){if(_0x3cf7c5){return _0x1e5102[_0x129b('0x18')](_0x4b8f35);}return _0x1e5102[_0x129b('0x19')](_0x4b8f35)[_0x129b('0x1a')]();};}function respondWithResult(_0x379cd1,_0x4f3ff3){_0x4f3ff3=_0x4f3ff3||0xc8;return function(_0x94390d){if(_0x94390d){return _0x379cd1[_0x129b('0x19')](_0x4f3ff3)[_0x129b('0x1b')](_0x94390d);}};}function respondWithFilteredResult(_0x4edd0e,_0x139d4b){return function(_0x30beb8){if(_0x30beb8){var _0x5b49a8=typeof _0x139d4b[_0x129b('0x1c')]==='undefined'&&typeof _0x139d4b[_0x129b('0x1d')]===_0x129b('0x1e');var _0x1ba4c7=_0x30beb8[_0x129b('0x1f')];var _0x463095=_0x5b49a8?0x0:_0x139d4b[_0x129b('0x1c')];var _0x5d704e=_0x5b49a8?_0x30beb8[_0x129b('0x1f')]:_0x139d4b[_0x129b('0x1c')]+_0x139d4b['limit'];var _0x12899c;if(_0x5d704e>=_0x1ba4c7){_0x5d704e=_0x1ba4c7;_0x12899c=0xc8;}else{_0x12899c=0xce;}_0x4edd0e[_0x129b('0x19')](_0x12899c);return _0x4edd0e[_0x129b('0x20')](_0x129b('0x21'),_0x463095+'-'+_0x5d704e+'/'+_0x1ba4c7)[_0x129b('0x1b')](_0x30beb8);}return null;};}function patchUpdates(_0x1062ab){return function(_0x54c15b){try{jsonpatch[_0x129b('0x22')](_0x54c15b,_0x1062ab,!![]);}catch(_0x352dd4){return BPromise['reject'](_0x352dd4);}return _0x54c15b[_0x129b('0x23')]();};}function saveUpdates(_0x4ecb00,_0x352e71){return function(_0x575a01){if(_0x575a01){return _0x575a01[_0x129b('0x24')](_0x4ecb00)['then'](function(_0x26d9d5){return _0x26d9d5;});}return null;};}function removeEntity(_0x11f11c,_0x1c3022){return function(_0x5bae73){if(_0x5bae73){return _0x5bae73[_0x129b('0x25')]()[_0x129b('0x26')](function(){_0x11f11c[_0x129b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59819b,_0x458f11){return function(_0x168beb){if(!_0x168beb){_0x59819b['sendStatus'](0x194);}return _0x168beb;};}function handleError(_0x2aeaee,_0x17b6f4){_0x17b6f4=_0x17b6f4||0x1f4;return function(_0x245abd){logger[_0x129b('0x27')](_0x245abd[_0x129b('0x28')]);if(_0x245abd[_0x129b('0x29')]){delete _0x245abd[_0x129b('0x29')];}_0x2aeaee[_0x129b('0x19')](_0x17b6f4)[_0x129b('0x2a')](_0x245abd);};}exports[_0x129b('0x2b')]=function(_0x3979eb,_0xf262aa){var _0x15cf9b={},_0x1cbac9={},_0x424f90={'count':0x0,'rows':[]};var _0x1747c0=_['map'](db[_0x129b('0x2c')][_0x129b('0x2d')],function(_0x5c2b10){return{'name':_0x5c2b10[_0x129b('0x2e')],'type':_0x5c2b10[_0x129b('0x2f')]['key']};});_0x1cbac9['model']=_[_0x129b('0x30')](_0x1747c0,'name');_0x1cbac9[_0x129b('0x31')]=_[_0x129b('0x32')](_0x3979eb[_0x129b('0x31')]);_0x1cbac9[_0x129b('0x33')]=_[_0x129b('0x34')](_0x1cbac9[_0x129b('0x35')],_0x1cbac9[_0x129b('0x31')]);_0x15cf9b[_0x129b('0x36')]=_[_0x129b('0x34')](_0x1cbac9[_0x129b('0x35')],qs[_0x129b('0x37')](_0x3979eb['query']['fields']));_0x15cf9b[_0x129b('0x36')]=_0x15cf9b[_0x129b('0x36')]['length']?_0x15cf9b[_0x129b('0x36')]:_0x1cbac9[_0x129b('0x35')];if(!_0x3979eb['query']['hasOwnProperty']('nolimit')){_0x15cf9b[_0x129b('0x1d')]=qs[_0x129b('0x1d')](_0x3979eb[_0x129b('0x31')]['limit']);_0x15cf9b['offset']=qs[_0x129b('0x1c')](_0x3979eb[_0x129b('0x31')][_0x129b('0x1c')]);}_0x15cf9b[_0x129b('0x38')]=qs[_0x129b('0x39')](_0x3979eb[_0x129b('0x31')][_0x129b('0x39')]);_0x15cf9b['where']=qs[_0x129b('0x33')](_[_0x129b('0x3a')](_0x3979eb[_0x129b('0x31')],_0x1cbac9[_0x129b('0x33')]),_0x1747c0);if(_0x3979eb[_0x129b('0x31')][_0x129b('0x3b')]){_0x15cf9b[_0x129b('0x3c')]=_[_0x129b('0x3d')](_0x15cf9b[_0x129b('0x3c')],{'$or':_[_0x129b('0x30')](_0x1747c0,function(_0x3d92f8){if(_0x3d92f8[_0x129b('0x2f')]!=='VIRTUAL'){var _0xabc270={};_0xabc270[_0x3d92f8[_0x129b('0x29')]]={'$like':'%'+_0x3979eb[_0x129b('0x31')][_0x129b('0x3b')]+'%'};return _0xabc270;}})});}_0x15cf9b=_['merge']({},_0x15cf9b,_0x3979eb[_0x129b('0x3e')]);var _0x503b07={'where':_0x15cf9b[_0x129b('0x3c')]};return db[_0x129b('0x2c')][_0x129b('0x1f')](_0x503b07)[_0x129b('0x26')](function(_0x348e06){_0x424f90[_0x129b('0x1f')]=_0x348e06;if(_0x3979eb[_0x129b('0x31')][_0x129b('0x3f')]){_0x15cf9b['include']=[{'all':!![]}];}return db[_0x129b('0x2c')][_0x129b('0x40')](_0x15cf9b);})[_0x129b('0x26')](function(_0x49bdce){_0x424f90[_0x129b('0x41')]=_0x49bdce;return _0x424f90;})[_0x129b('0x26')](respondWithFilteredResult(_0xf262aa,_0x15cf9b))[_0x129b('0x42')](handleError(_0xf262aa,null));};exports[_0x129b('0x43')]=function(_0x33c741,_0x14810f){var _0x5273c6={'raw':!![],'where':{'id':_0x33c741[_0x129b('0x44')]['id']}},_0x4b5b8d={};_0x4b5b8d[_0x129b('0x35')]=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x4b5b8d[_0x129b('0x31')]=_['keys'](_0x33c741['query']);_0x4b5b8d[_0x129b('0x33')]=_[_0x129b('0x34')](_0x4b5b8d['model'],_0x4b5b8d[_0x129b('0x31')]);_0x5273c6['attributes']=_[_0x129b('0x34')](_0x4b5b8d['model'],qs['fields'](_0x33c741[_0x129b('0x31')][_0x129b('0x37')]));_0x5273c6[_0x129b('0x36')]=_0x5273c6[_0x129b('0x36')][_0x129b('0x45')]?_0x5273c6['attributes']:_0x4b5b8d[_0x129b('0x35')];if(_0x33c741['query'][_0x129b('0x3f')]){_0x5273c6[_0x129b('0x46')]=[{'all':!![]}];}_0x5273c6=_[_0x129b('0x3d')]({},_0x5273c6,_0x33c741[_0x129b('0x3e')]);return db[_0x129b('0x2c')]['find'](_0x5273c6)[_0x129b('0x26')](handleEntityNotFound(_0x14810f,null))['then'](respondWithResult(_0x14810f,null))[_0x129b('0x42')](handleError(_0x14810f,null));};exports[_0x129b('0x47')]=function(_0xa0244d,_0x2f034e){return db[_0x129b('0x2c')][_0x129b('0x47')](_0xa0244d[_0x129b('0x48')],{})['then'](respondWithResult(_0x2f034e,0xc9))['catch'](handleError(_0x2f034e,null));};exports[_0x129b('0x24')]=function(_0x29bbcc,_0x1989f6){if(_0x29bbcc[_0x129b('0x48')]['id']){delete _0x29bbcc[_0x129b('0x48')]['id'];}return db[_0x129b('0x2c')][_0x129b('0x49')]({'where':{'id':_0x29bbcc[_0x129b('0x44')]['id']}})[_0x129b('0x26')](handleEntityNotFound(_0x1989f6,null))['then'](saveUpdates(_0x29bbcc[_0x129b('0x48')],null))[_0x129b('0x26')](respondWithResult(_0x1989f6,null))['catch'](handleError(_0x1989f6,null));};exports[_0x129b('0x25')]=function(_0x2105c2,_0x173263){return db[_0x129b('0x2c')]['find']({'where':{'id':_0x2105c2['params']['id']}})[_0x129b('0x26')](handleEntityNotFound(_0x173263,null))[_0x129b('0x26')](removeEntity(_0x173263,null))[_0x129b('0x42')](handleError(_0x173263,null));};exports[_0x129b('0x4a')]=function(_0x22560b,_0x4317d1){return db[_0x129b('0x2c')][_0x129b('0x4a')]()[_0x129b('0x26')](respondWithResult(_0x4317d1,null))[_0x129b('0x42')](handleError(_0x4317d1,null));}; \ No newline at end of file +var _0x3c17=['apply','reject','save','update','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','then','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json'];(function(_0xfaf049,_0x1e1cee){var _0x3cf60b=function(_0x25e4c7){while(--_0x25e4c7){_0xfaf049['push'](_0xfaf049['shift']());}};_0x3cf60b(++_0x1e1cee);}(_0x3c17,0x1a1));var _0x73c1=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x3c17[_0x363ef8];return _0x148822;};'use strict';var emlformat=require(_0x73c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73c1('0x2'));var moment=require(_0x73c1('0x3'));var BPromise=require(_0x73c1('0x4'));var Mustache=require('mustache');var util=require(_0x73c1('0x5'));var path=require(_0x73c1('0x6'));var sox=require(_0x73c1('0x7'));var csv=require(_0x73c1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73c1('0x9'));var _=require('lodash');var squel=require(_0x73c1('0xa'));var crypto=require(_0x73c1('0xb'));var jsforce=require(_0x73c1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x73c1('0xd'));var Papa=require(_0x73c1('0xe'));var Redis=require(_0x73c1('0xf'));var authService=require(_0x73c1('0x10'));var qs=require(_0x73c1('0x11'));var as=require(_0x73c1('0x12'));var hardwareService=require(_0x73c1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x73c1('0x14'));var config=require(_0x73c1('0x15'));var licenseUtil=require(_0x73c1('0x16'));var db=require(_0x73c1('0x17'))['db'];function respondWithStatusCode(_0x592a6a,_0x2b77bc){_0x2b77bc=_0x2b77bc||0xcc;return function(_0x5e6b55){if(_0x5e6b55){return _0x592a6a[_0x73c1('0x18')](_0x2b77bc);}return _0x592a6a['status'](_0x2b77bc)[_0x73c1('0x19')]();};}function respondWithResult(_0x3ecf5a,_0x57cb11){_0x57cb11=_0x57cb11||0xc8;return function(_0x537965){if(_0x537965){return _0x3ecf5a[_0x73c1('0x1a')](_0x57cb11)['json'](_0x537965);}};}function respondWithFilteredResult(_0x72a36,_0x52d0ff){return function(_0xe5d5c8){if(_0xe5d5c8){var _0x47d81e=typeof _0x52d0ff[_0x73c1('0x1b')]===_0x73c1('0x1c')&&typeof _0x52d0ff[_0x73c1('0x1d')]===_0x73c1('0x1c');var _0x8c0803=_0xe5d5c8[_0x73c1('0x1e')];var _0x16deb6=_0x47d81e?0x0:_0x52d0ff[_0x73c1('0x1b')];var _0x1ce19e=_0x47d81e?_0xe5d5c8['count']:_0x52d0ff[_0x73c1('0x1b')]+_0x52d0ff[_0x73c1('0x1d')];var _0x28df60;if(_0x1ce19e>=_0x8c0803){_0x1ce19e=_0x8c0803;_0x28df60=0xc8;}else{_0x28df60=0xce;}_0x72a36[_0x73c1('0x1a')](_0x28df60);return _0x72a36['set'](_0x73c1('0x1f'),_0x16deb6+'-'+_0x1ce19e+'/'+_0x8c0803)[_0x73c1('0x20')](_0xe5d5c8);}return null;};}function patchUpdates(_0x344fb5){return function(_0x2e17e5){try{jsonpatch[_0x73c1('0x21')](_0x2e17e5,_0x344fb5,!![]);}catch(_0x2aa7df){return BPromise[_0x73c1('0x22')](_0x2aa7df);}return _0x2e17e5[_0x73c1('0x23')]();};}function saveUpdates(_0x49b817,_0x2eba51){return function(_0x32b379){if(_0x32b379){return _0x32b379[_0x73c1('0x24')](_0x49b817)['then'](function(_0x10254c){return _0x10254c;});}return null;};}function removeEntity(_0x2ebfda,_0x1125ff){return function(_0x3abaab){if(_0x3abaab){return _0x3abaab[_0x73c1('0x25')]()['then'](function(){_0x2ebfda[_0x73c1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54feeb,_0x2301b7){return function(_0x1c567d){if(!_0x1c567d){_0x54feeb[_0x73c1('0x18')](0x194);}return _0x1c567d;};}function handleError(_0x1c54aa,_0x123cc0){_0x123cc0=_0x123cc0||0x1f4;return function(_0x30ec73){logger[_0x73c1('0x26')](_0x30ec73[_0x73c1('0x27')]);if(_0x30ec73[_0x73c1('0x28')]){delete _0x30ec73[_0x73c1('0x28')];}_0x1c54aa[_0x73c1('0x1a')](_0x123cc0)[_0x73c1('0x29')](_0x30ec73);};}exports[_0x73c1('0x2a')]=function(_0x240137,_0x5bf2b1){var _0x2b2996={},_0x9050fd={},_0x33b5bc={'count':0x0,'rows':[]};var _0x153141=_[_0x73c1('0x2b')](db[_0x73c1('0x2c')][_0x73c1('0x2d')],function(_0x45c411){return{'name':_0x45c411[_0x73c1('0x2e')],'type':_0x45c411['type']['key']};});_0x9050fd[_0x73c1('0x2f')]=_[_0x73c1('0x2b')](_0x153141,_0x73c1('0x28'));_0x9050fd[_0x73c1('0x30')]=_['keys'](_0x240137[_0x73c1('0x30')]);_0x9050fd[_0x73c1('0x31')]=_[_0x73c1('0x32')](_0x9050fd['model'],_0x9050fd[_0x73c1('0x30')]);_0x2b2996[_0x73c1('0x33')]=_[_0x73c1('0x32')](_0x9050fd[_0x73c1('0x2f')],qs[_0x73c1('0x34')](_0x240137[_0x73c1('0x30')]['fields']));_0x2b2996[_0x73c1('0x33')]=_0x2b2996[_0x73c1('0x33')][_0x73c1('0x35')]?_0x2b2996[_0x73c1('0x33')]:_0x9050fd[_0x73c1('0x2f')];if(!_0x240137[_0x73c1('0x30')][_0x73c1('0x36')](_0x73c1('0x37'))){_0x2b2996[_0x73c1('0x1d')]=qs[_0x73c1('0x1d')](_0x240137['query'][_0x73c1('0x1d')]);_0x2b2996['offset']=qs[_0x73c1('0x1b')](_0x240137[_0x73c1('0x30')][_0x73c1('0x1b')]);}_0x2b2996[_0x73c1('0x38')]=qs['sort'](_0x240137['query']['sort']);_0x2b2996[_0x73c1('0x39')]=qs['filters'](_[_0x73c1('0x3a')](_0x240137[_0x73c1('0x30')],_0x9050fd[_0x73c1('0x31')]),_0x153141);if(_0x240137[_0x73c1('0x30')][_0x73c1('0x3b')]){_0x2b2996[_0x73c1('0x39')]=_[_0x73c1('0x3c')](_0x2b2996[_0x73c1('0x39')],{'$or':_[_0x73c1('0x2b')](_0x153141,function(_0x304c2b){if(_0x304c2b[_0x73c1('0x3d')]!=='VIRTUAL'){var _0x2bb535={};_0x2bb535[_0x304c2b[_0x73c1('0x28')]]={'$like':'%'+_0x240137[_0x73c1('0x30')][_0x73c1('0x3b')]+'%'};return _0x2bb535;}})});}_0x2b2996=_[_0x73c1('0x3c')]({},_0x2b2996,_0x240137[_0x73c1('0x3e')]);var _0x5a8c11={'where':_0x2b2996[_0x73c1('0x39')]};return db[_0x73c1('0x2c')][_0x73c1('0x1e')](_0x5a8c11)[_0x73c1('0x3f')](function(_0x21feb9){_0x33b5bc[_0x73c1('0x1e')]=_0x21feb9;if(_0x240137['query'][_0x73c1('0x40')]){_0x2b2996['include']=[{'all':!![]}];}return db[_0x73c1('0x2c')][_0x73c1('0x41')](_0x2b2996);})['then'](function(_0x57d843){_0x33b5bc[_0x73c1('0x42')]=_0x57d843;return _0x33b5bc;})[_0x73c1('0x3f')](respondWithFilteredResult(_0x5bf2b1,_0x2b2996))[_0x73c1('0x43')](handleError(_0x5bf2b1,null));};exports[_0x73c1('0x44')]=function(_0x689ca5,_0x282b73){var _0x515a52={'raw':!![],'where':{'id':_0x689ca5[_0x73c1('0x45')]['id']}},_0x5c70b9={};_0x5c70b9[_0x73c1('0x2f')]=_['keys'](db['JscriptyAnswerReport'][_0x73c1('0x2d')]);_0x5c70b9['query']=_[_0x73c1('0x46')](_0x689ca5[_0x73c1('0x30')]);_0x5c70b9[_0x73c1('0x31')]=_[_0x73c1('0x32')](_0x5c70b9[_0x73c1('0x2f')],_0x5c70b9[_0x73c1('0x30')]);_0x515a52[_0x73c1('0x33')]=_[_0x73c1('0x32')](_0x5c70b9['model'],qs['fields'](_0x689ca5[_0x73c1('0x30')][_0x73c1('0x34')]));_0x515a52[_0x73c1('0x33')]=_0x515a52['attributes'][_0x73c1('0x35')]?_0x515a52[_0x73c1('0x33')]:_0x5c70b9[_0x73c1('0x2f')];if(_0x689ca5[_0x73c1('0x30')][_0x73c1('0x40')]){_0x515a52[_0x73c1('0x47')]=[{'all':!![]}];}_0x515a52=_[_0x73c1('0x3c')]({},_0x515a52,_0x689ca5[_0x73c1('0x3e')]);return db[_0x73c1('0x2c')][_0x73c1('0x48')](_0x515a52)[_0x73c1('0x3f')](handleEntityNotFound(_0x282b73,null))[_0x73c1('0x3f')](respondWithResult(_0x282b73,null))['catch'](handleError(_0x282b73,null));};exports[_0x73c1('0x49')]=function(_0x512295,_0x1a681c){return db[_0x73c1('0x2c')][_0x73c1('0x49')](_0x512295[_0x73c1('0x4a')],{})[_0x73c1('0x3f')](respondWithResult(_0x1a681c,0xc9))[_0x73c1('0x43')](handleError(_0x1a681c,null));};exports['update']=function(_0x34093c,_0x2ccd11){if(_0x34093c[_0x73c1('0x4a')]['id']){delete _0x34093c['body']['id'];}return db[_0x73c1('0x2c')][_0x73c1('0x48')]({'where':{'id':_0x34093c[_0x73c1('0x45')]['id']}})[_0x73c1('0x3f')](handleEntityNotFound(_0x2ccd11,null))[_0x73c1('0x3f')](saveUpdates(_0x34093c[_0x73c1('0x4a')],null))[_0x73c1('0x3f')](respondWithResult(_0x2ccd11,null))[_0x73c1('0x43')](handleError(_0x2ccd11,null));};exports[_0x73c1('0x25')]=function(_0x53d491,_0x3291db){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x53d491['params']['id']}})['then'](handleEntityNotFound(_0x3291db,null))['then'](removeEntity(_0x3291db,null))[_0x73c1('0x43')](handleError(_0x3291db,null));};exports['describe']=function(_0x3c31e8,_0x47e3ca){return db['JscriptyAnswerReport']['describe']()[_0x73c1('0x3f')](respondWithResult(_0x47e3ca,null))['catch'](handleError(_0x47e3ca,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 14fe8bc..9a2cc14 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 _0x305e=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','lodash','api','moment','bluebird'];(function(_0x3b172e,_0x51c2e0){var _0x2e1b79=function(_0x5c8948){while(--_0x5c8948){_0x3b172e['push'](_0x3b172e['shift']());}};_0x2e1b79(++_0x51c2e0);}(_0x305e,0x9c));var _0xe305=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x305e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xe305('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe305('0x1'));var moment=require(_0xe305('0x2'));var BPromise=require(_0xe305('0x3'));var rp=require(_0xe305('0x4'));var fs=require('fs');var path=require(_0xe305('0x5'));var rimraf=require(_0xe305('0x6'));var config=require(_0xe305('0x7'));var attributes=require(_0xe305('0x8'));module[_0xe305('0x9')]=function(_0x5536b3,_0x507ee6){return _0x5536b3['define']('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb85=['exports','define','JscriptyAnswerReport','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x337a7a,_0x5f3233){var _0x1f72db=function(_0xc1a70c){while(--_0xc1a70c){_0x337a7a['push'](_0x337a7a['shift']());}};_0x1f72db(++_0x5f3233);}(_0xbb85,0x153));var _0x5bb8=function(_0x5ed98b,_0x226aa9){_0x5ed98b=_0x5ed98b-0x0;var _0x5e634c=_0xbb85[_0x5ed98b];return _0x5e634c;};'use strict';var _=require('lodash');var util=require(_0x5bb8('0x0'));var logger=require(_0x5bb8('0x1'))(_0x5bb8('0x2'));var moment=require(_0x5bb8('0x3'));var BPromise=require('bluebird');var rp=require(_0x5bb8('0x4'));var fs=require('fs');var path=require(_0x5bb8('0x5'));var rimraf=require(_0x5bb8('0x6'));var config=require(_0x5bb8('0x7'));var attributes=require(_0x5bb8('0x8'));module[_0x5bb8('0x9')]=function(_0x33db93,_0x475b9b){return _0x33db93[_0x5bb8('0xa')](_0x5bb8('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 1e7386a..d49ef5d 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 _0x1b27=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b27,0xa3));var _0x71b2=function(_0x5e74d4,_0x102665){_0x5e74d4=_0x5e74d4-0x0;var _0x4ecc82=_0x1b27[_0x5e74d4];return _0x4ecc82;};'use strict';var _=require(_0x71b2('0x0'));var util=require(_0x71b2('0x1'));var moment=require('moment');var BPromise=require(_0x71b2('0x2'));var rs=require(_0x71b2('0x3'));var fs=require('fs');var Redis=require(_0x71b2('0x4'));var db=require(_0x71b2('0x5'))['db'];var utils=require(_0x71b2('0x6'));var logger=require(_0x71b2('0x7'))(_0x71b2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71b2('0x9')][_0x71b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x406d17,_0x8fc6a0,_0xda57c5){return new BPromise(function(_0xfae2db,_0xac65d6){return client['request'](_0x406d17,_0xda57c5)[_0x71b2('0xb')](function(_0x321b2a){logger[_0x71b2('0xc')](_0x71b2('0xd'),_0x8fc6a0,_0x71b2('0xe'));logger[_0x71b2('0xf')](_0x71b2('0x10'),_0x8fc6a0,'request\x20sent',JSON[_0x71b2('0x11')](_0x321b2a));if(_0x321b2a[_0x71b2('0x12')]){if(_0x321b2a[_0x71b2('0x12')][_0x71b2('0x13')]===0x1f4){logger['error'](_0x71b2('0xd'),_0x8fc6a0,_0x321b2a['error'][_0x71b2('0x14')]);return _0xac65d6(_0x321b2a[_0x71b2('0x12')][_0x71b2('0x14')]);}logger[_0x71b2('0x12')](_0x71b2('0xd'),_0x8fc6a0,_0x321b2a['error'][_0x71b2('0x14')]);return _0xfae2db(_0x321b2a['error'][_0x71b2('0x14')]);}else{logger[_0x71b2('0xc')](_0x71b2('0xd'),_0x8fc6a0,_0x71b2('0xe'));_0xfae2db(_0x321b2a[_0x71b2('0x15')][_0x71b2('0x14')]);}})[_0x71b2('0x16')](function(_0x2f3421){logger[_0x71b2('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x8fc6a0,_0x2f3421);_0xac65d6(_0x2f3421);});});} \ No newline at end of file +var _0xa1d0=['result','catch','util','bluebird','randomstring','ioredis','../../config/utils','client','http','request','then','info','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','request\x20sent'];(function(_0x57989d,_0xee3e5){var _0x15b7fc=function(_0x181aca){while(--_0x181aca){_0x57989d['push'](_0x57989d['shift']());}};_0x15b7fc(++_0xee3e5);}(_0xa1d0,0x17e));var _0x0a1d=function(_0x22c977,_0x1c6c15){_0x22c977=_0x22c977-0x0;var _0x58b1bc=_0xa1d0[_0x22c977];return _0x58b1bc;};'use strict';var _=require('lodash');var util=require(_0x0a1d('0x0'));var moment=require('moment');var BPromise=require(_0x0a1d('0x1'));var rs=require(_0x0a1d('0x2'));var fs=require('fs');var Redis=require(_0x0a1d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a1d('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a1d('0x5')][_0x0a1d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x834283,_0x18ef3e,_0x50f836){return new BPromise(function(_0x17f5fe,_0x41011c){return client[_0x0a1d('0x7')](_0x834283,_0x50f836)[_0x0a1d('0x8')](function(_0x5cc05b){logger[_0x0a1d('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x18ef3e,'request\x20sent');logger[_0x0a1d('0xa')](_0x0a1d('0xb'),_0x18ef3e,'request\x20sent',JSON['stringify'](_0x5cc05b));if(_0x5cc05b[_0x0a1d('0xc')]){if(_0x5cc05b['error'][_0x0a1d('0xd')]===0x1f4){logger[_0x0a1d('0xc')](_0x0a1d('0xe'),_0x18ef3e,_0x5cc05b['error'][_0x0a1d('0xf')]);return _0x41011c(_0x5cc05b[_0x0a1d('0xc')]['message']);}logger[_0x0a1d('0xc')](_0x0a1d('0xe'),_0x18ef3e,_0x5cc05b[_0x0a1d('0xc')][_0x0a1d('0xf')]);return _0x17f5fe(_0x5cc05b[_0x0a1d('0xc')]['message']);}else{logger['info'](_0x0a1d('0xe'),_0x18ef3e,_0x0a1d('0x10'));_0x17f5fe(_0x5cc05b[_0x0a1d('0x11')][_0x0a1d('0xf')]);}})[_0x0a1d('0x12')](function(_0x3a238f){logger['error'](_0x0a1d('0xe'),_0x18ef3e,_0x3a238f);_0x41011c(_0x3a238f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 7fb9059..dacad4f 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 _0x941d=['getSessions','getAnswers','/:id/summary','30s','post','/:id/clone','clone','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions'];(function(_0x270406,_0x29a99a){var _0x45aff6=function(_0x2a129e){while(--_0x2a129e){_0x270406['push'](_0x270406['shift']());}};_0x45aff6(++_0x29a99a);}(_0x941d,0xc1));var _0xd941=function(_0x45bcb1,_0x46cad0){_0x45bcb1=_0x45bcb1-0x0;var _0x4bd6a3=_0x941d[_0x45bcb1];return _0x4bd6a3;};'use strict';var multer=require('multer');var util=require(_0xd941('0x0'));var path=require(_0xd941('0x1'));var timeout=require(_0xd941('0x2'));var express=require(_0xd941('0x3'));var router=express[_0xd941('0x4')]();var fs_extra=require(_0xd941('0x5'));var auth=require(_0xd941('0x6'));var interaction=require(_0xd941('0x7'));var config=require(_0xd941('0x8'));var controller=require(_0xd941('0x9'));router[_0xd941('0xa')]('/',auth[_0xd941('0xb')](),controller[_0xd941('0xc')]);router[_0xd941('0xa')](_0xd941('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd941('0xe'),auth[_0xd941('0xb')](),controller[_0xd941('0xf')]);router[_0xd941('0xa')]('/:id/answers',auth[_0xd941('0xb')](),controller[_0xd941('0x10')]);router[_0xd941('0xa')](_0xd941('0x11'),auth['isAuthenticated'](),timeout(_0xd941('0x12')),controller['getSummary']);router[_0xd941('0x13')]('/',auth[_0xd941('0xb')](),controller['create']);router[_0xd941('0x13')](_0xd941('0x14'),auth[_0xd941('0xb')](),controller[_0xd941('0x15')]);router['put'](_0xd941('0xd'),auth[_0xd941('0xb')](),controller[_0xd941('0x16')]);router[_0xd941('0x17')](_0xd941('0xd'),auth[_0xd941('0xb')](),controller[_0xd941('0x18')]);module[_0xd941('0x19')]=router; \ No newline at end of file +var _0x7f05=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','/:id','isAuthenticated','show','/:id/sessions','/:id/answers','getAnswers','get','/:id/summary','getSummary','post','create','/:id/clone','put','update','delete'];(function(_0x5ea7f1,_0xf80c83){var _0x305f33=function(_0x3df6bd){while(--_0x3df6bd){_0x5ea7f1['push'](_0x5ea7f1['shift']());}};_0x305f33(++_0xf80c83);}(_0x7f05,0x17b));var _0x57f0=function(_0x4e8e12,_0x2ed702){_0x4e8e12=_0x4e8e12-0x0;var _0x37f9a4=_0x7f05[_0x4e8e12];return _0x37f9a4;};'use strict';var multer=require('multer');var util=require(_0x57f0('0x0'));var path=require(_0x57f0('0x1'));var timeout=require(_0x57f0('0x2'));var express=require(_0x57f0('0x3'));var router=express[_0x57f0('0x4')]();var fs_extra=require(_0x57f0('0x5'));var auth=require(_0x57f0('0x6'));var interaction=require(_0x57f0('0x7'));var config=require(_0x57f0('0x8'));var controller=require(_0x57f0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x57f0('0xa')]);router['get'](_0x57f0('0xb'),auth[_0x57f0('0xc')](),controller[_0x57f0('0xd')]);router['get'](_0x57f0('0xe'),auth[_0x57f0('0xc')](),controller['getSessions']);router['get'](_0x57f0('0xf'),auth[_0x57f0('0xc')](),controller[_0x57f0('0x10')]);router[_0x57f0('0x11')](_0x57f0('0x12'),auth['isAuthenticated'](),timeout('30s'),controller[_0x57f0('0x13')]);router[_0x57f0('0x14')]('/',auth[_0x57f0('0xc')](),controller[_0x57f0('0x15')]);router[_0x57f0('0x14')](_0x57f0('0x16'),auth['isAuthenticated'](),controller['clone']);router[_0x57f0('0x17')](_0x57f0('0xb'),auth[_0x57f0('0xc')](),controller[_0x57f0('0x18')]);router[_0x57f0('0x19')](_0x57f0('0xb'),auth[_0x57f0('0xc')](),controller['destroy']);module[_0x57f0('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 b7a1475..d6b6ec8 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 _0x892d=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','long','setDataValue','formData','stringify','isString'];(function(_0x1ce64b,_0x39f8c3){var _0x10cf3d=function(_0x372a7b){while(--_0x372a7b){_0x1ce64b['push'](_0x1ce64b['shift']());}};_0x10cf3d(++_0x39f8c3);}(_0x892d,0x16d));var _0xd892=function(_0x2fdaa5,_0x4c8149){_0x2fdaa5=_0x2fdaa5-0x0;var _0x34a511=_0x892d[_0x2fdaa5];return _0x34a511;};'use strict';var Sequelize=require(_0xd892('0x0'));var _=require(_0xd892('0x1'));var util=require(_0xd892('0x2'));module['exports']={'name':{'type':Sequelize[_0xd892('0x3')],'unique':'name'},'description':{'type':Sequelize[_0xd892('0x3')]},'formData':{'type':Sequelize[_0xd892('0x4')](_0xd892('0x5')),'set':function(_0x593b3b){if(_['isObjectLike'](_0x593b3b)){this[_0xd892('0x6')](_0xd892('0x7'),JSON[_0xd892('0x8')](_0x593b3b));}else if(_[_0xd892('0x9')](_0x593b3b)){this[_0xd892('0x6')](_0xd892('0x7'),_0x593b3b);}else{this['setDataValue'](_0xd892('0x7'),util[_0xd892('0xa')](_0xd892('0xb'),this['getDataValue']('name')||'',this[_0xd892('0xc')](_0xd892('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd892('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd892('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xaa16=['exports','name','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(_0x22221f,_0x2d468){var _0x5e9e0d=function(_0x1c0425){while(--_0x1c0425){_0x22221f['push'](_0x22221f['shift']());}};_0x5e9e0d(++_0x2d468);}(_0xaa16,0xa4));var _0x6aa1=function(_0x2dbb49,_0x4955d6){_0x2dbb49=_0x2dbb49-0x0;var _0x59083b=_0xaa16[_0x2dbb49];return _0x59083b;};'use strict';var Sequelize=require(_0x6aa1('0x0'));var _=require('lodash');var util=require('util');module[_0x6aa1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6aa1('0x2')},'description':{'type':Sequelize[_0x6aa1('0x3')]},'formData':{'type':Sequelize[_0x6aa1('0x4')]('long'),'set':function(_0x384423){if(_[_0x6aa1('0x5')](_0x384423)){this[_0x6aa1('0x6')](_0x6aa1('0x7'),JSON[_0x6aa1('0x8')](_0x384423));}else if(_[_0x6aa1('0x9')](_0x384423)){this[_0x6aa1('0x6')](_0x6aa1('0x7'),_0x384423);}else{this[_0x6aa1('0x6')](_0x6aa1('0x7'),util[_0x6aa1('0xa')](_0x6aa1('0xb'),this[_0x6aa1('0xc')]('name')||'',this[_0x6aa1('0xc')](_0x6aa1('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6aa1('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6aa1('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 01a62cd..81adfa0 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 _0xdc7b=['undefined','limit','count','offset','set','reject','save','then','destroy','Projects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','params','omit','createdAt','updatedAt','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','filter','findAll','getAnswers','JscriptyAnswerReport','order','number','fromCharCode','apply','indexOf','toString','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x45fca1,_0x4786c7){var _0x3e3cf1=function(_0x13be67){while(--_0x13be67){_0x45fca1['push'](_0x45fca1['shift']());}};_0x3e3cf1(++_0x4786c7);}(_0xdc7b,0x153));var _0xbdc7=function(_0x2d3fa2,_0x2a2b3e){_0x2d3fa2=_0x2d3fa2-0x0;var _0x5bb642=_0xdc7b[_0x2d3fa2];return _0x5bb642;};'use strict';var emlformat=require(_0xbdc7('0x0'));var rimraf=require(_0xbdc7('0x1'));var zipdir=require(_0xbdc7('0x2'));var jsonpatch=require(_0xbdc7('0x3'));var rp=require(_0xbdc7('0x4'));var moment=require(_0xbdc7('0x5'));var BPromise=require(_0xbdc7('0x6'));var Mustache=require('mustache');var util=require(_0xbdc7('0x7'));var path=require(_0xbdc7('0x8'));var sox=require(_0xbdc7('0x9'));var csv=require('to-csv');var ejs=require(_0xbdc7('0xa'));var fs=require('fs');var fs_extra=require(_0xbdc7('0xb'));var _=require(_0xbdc7('0xc'));var squel=require(_0xbdc7('0xd'));var crypto=require(_0xbdc7('0xe'));var jsforce=require(_0xbdc7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbdc7('0x10'));var querystring=require(_0xbdc7('0x11'));var Papa=require(_0xbdc7('0x12'));var Redis=require(_0xbdc7('0x13'));var authService=require(_0xbdc7('0x14'));var qs=require(_0xbdc7('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdc7('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xbdc7('0x17'));var config=require(_0xbdc7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdc7('0x19'))['db'];function respondWithStatusCode(_0x564745,_0x35c48b){_0x35c48b=_0x35c48b||0xcc;return function(_0x375900){if(_0x375900){return _0x564745[_0xbdc7('0x1a')](_0x35c48b);}return _0x564745[_0xbdc7('0x1b')](_0x35c48b)[_0xbdc7('0x1c')]();};}function respondWithResult(_0x18daec,_0x589967){_0x589967=_0x589967||0xc8;return function(_0x3045f3){if(_0x3045f3){return _0x18daec[_0xbdc7('0x1b')](_0x589967)[_0xbdc7('0x1d')](_0x3045f3);}};}function respondWithFilteredResult(_0x267145,_0x440282){return function(_0x35630a){if(_0x35630a){var _0x286a38=typeof _0x440282['offset']===_0xbdc7('0x1e')&&typeof _0x440282[_0xbdc7('0x1f')]===_0xbdc7('0x1e');var _0x4a1e1c=_0x35630a[_0xbdc7('0x20')];var _0x5677f9=_0x286a38?0x0:_0x440282[_0xbdc7('0x21')];var _0x5aa1bd=_0x286a38?_0x35630a['count']:_0x440282[_0xbdc7('0x21')]+_0x440282[_0xbdc7('0x1f')];var _0x55cfcc;if(_0x5aa1bd>=_0x4a1e1c){_0x5aa1bd=_0x4a1e1c;_0x55cfcc=0xc8;}else{_0x55cfcc=0xce;}_0x267145[_0xbdc7('0x1b')](_0x55cfcc);return _0x267145[_0xbdc7('0x22')]('Content-Range',_0x5677f9+'-'+_0x5aa1bd+'/'+_0x4a1e1c)['json'](_0x35630a);}return null;};}function patchUpdates(_0x56b9cc){return function(_0x554d54){try{jsonpatch['apply'](_0x554d54,_0x56b9cc,!![]);}catch(_0x322d28){return BPromise[_0xbdc7('0x23')](_0x322d28);}return _0x554d54[_0xbdc7('0x24')]();};}function saveUpdates(_0x4af89e,_0x5d6d2e){return function(_0x46640f){if(_0x46640f){return _0x46640f['update'](_0x4af89e)[_0xbdc7('0x25')](function(_0xa8d731){return _0xa8d731;});}return null;};}function removeEntity(_0x49d8e8,_0x224c4e){return function(_0x38d068){if(_0x38d068){return _0x38d068[_0xbdc7('0x26')]()[_0xbdc7('0x25')](function(){var _0x53a6e7=_0x38d068['get']({'plain':!![]});var _0x44f825=_0xbdc7('0x27');return db[_0xbdc7('0x28')][_0xbdc7('0x26')]({'where':{'type':_0x44f825,'resourceId':_0x53a6e7['id']}})[_0xbdc7('0x25')](function(){return _0x38d068;});})[_0xbdc7('0x25')](function(){_0x49d8e8[_0xbdc7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b0487,_0x207ee3){return function(_0x4d70ef){if(!_0x4d70ef){_0x2b0487[_0xbdc7('0x1a')](0x194);}return _0x4d70ef;};}function handleError(_0x401b46,_0x949cb0){_0x949cb0=_0x949cb0||0x1f4;return function(_0x2435fc){logger[_0xbdc7('0x29')](_0x2435fc[_0xbdc7('0x2a')]);if(_0x2435fc[_0xbdc7('0x2b')]){delete _0x2435fc[_0xbdc7('0x2b')];}_0x401b46[_0xbdc7('0x1b')](_0x949cb0)[_0xbdc7('0x2c')](_0x2435fc);};}exports[_0xbdc7('0x2d')]=function(_0x2ff8e3,_0x52e8b2){var _0x50e7fd={},_0x48c5d6={},_0x305e09={'count':0x0,'rows':[]};var _0x3955ff=_[_0xbdc7('0x2e')](db['JscriptyProject'][_0xbdc7('0x2f')],function(_0x4cad94){return{'name':_0x4cad94[_0xbdc7('0x30')],'type':_0x4cad94[_0xbdc7('0x31')][_0xbdc7('0x32')]};});_0x48c5d6['model']=_[_0xbdc7('0x2e')](_0x3955ff,_0xbdc7('0x2b'));_0x48c5d6[_0xbdc7('0x33')]=_[_0xbdc7('0x34')](_0x2ff8e3['query']);_0x48c5d6[_0xbdc7('0x35')]=_[_0xbdc7('0x36')](_0x48c5d6[_0xbdc7('0x37')],_0x48c5d6[_0xbdc7('0x33')]);_0x50e7fd[_0xbdc7('0x38')]=_[_0xbdc7('0x36')](_0x48c5d6[_0xbdc7('0x37')],qs[_0xbdc7('0x39')](_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x39')]));_0x50e7fd[_0xbdc7('0x38')]=_0x50e7fd[_0xbdc7('0x38')][_0xbdc7('0x3a')]?_0x50e7fd['attributes']:_0x48c5d6['model'];if(!_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x3b')]('nolimit')){_0x50e7fd[_0xbdc7('0x1f')]=qs[_0xbdc7('0x1f')](_0x2ff8e3['query'][_0xbdc7('0x1f')]);_0x50e7fd[_0xbdc7('0x21')]=qs[_0xbdc7('0x21')](_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x21')]);}_0x50e7fd['order']=qs[_0xbdc7('0x3c')](_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x3c')]);_0x50e7fd[_0xbdc7('0x3d')]=qs[_0xbdc7('0x35')](_[_0xbdc7('0x3e')](_0x2ff8e3['query'],_0x48c5d6[_0xbdc7('0x35')]),_0x3955ff);if(_0x2ff8e3[_0xbdc7('0x33')]['filter']){_0x50e7fd[_0xbdc7('0x3d')]=_[_0xbdc7('0x3f')](_0x50e7fd[_0xbdc7('0x3d')],{'$or':_[_0xbdc7('0x2e')](_0x3955ff,function(_0x1db908){if(_0x1db908['type']!==_0xbdc7('0x40')){var _0x24abc9={};_0x24abc9[_0x1db908[_0xbdc7('0x2b')]]={'$like':'%'+_0x2ff8e3[_0xbdc7('0x33')]['filter']+'%'};return _0x24abc9;}})});}_0x50e7fd=_[_0xbdc7('0x3f')]({},_0x50e7fd,_0x2ff8e3[_0xbdc7('0x41')]);var _0x106540={'where':_0x50e7fd[_0xbdc7('0x3d')]};return db[_0xbdc7('0x42')][_0xbdc7('0x20')](_0x106540)[_0xbdc7('0x25')](function(_0x3b401a){_0x305e09[_0xbdc7('0x20')]=_0x3b401a;if(_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x43')]){_0x50e7fd[_0xbdc7('0x44')]=[{'all':!![]}];}return db[_0xbdc7('0x42')]['findAll'](_0x50e7fd);})[_0xbdc7('0x25')](function(_0xfc6a6f){_0x305e09[_0xbdc7('0x45')]=_0xfc6a6f;return _0x305e09;})['then'](respondWithFilteredResult(_0x52e8b2,_0x50e7fd))[_0xbdc7('0x46')](handleError(_0x52e8b2,null));};exports[_0xbdc7('0x47')]=function(_0x3fcb3d,_0x50db61){var _0x14584c={'raw':![],'where':{'id':_0x3fcb3d['params']['id']}},_0x14a1be={};_0x14a1be['model']=_[_0xbdc7('0x34')](db['JscriptyProject'][_0xbdc7('0x2f')]);_0x14a1be[_0xbdc7('0x33')]=_[_0xbdc7('0x34')](_0x3fcb3d[_0xbdc7('0x33')]);_0x14a1be[_0xbdc7('0x35')]=_['intersection'](_0x14a1be[_0xbdc7('0x37')],_0x14a1be[_0xbdc7('0x33')]);_0x14584c[_0xbdc7('0x38')]=_[_0xbdc7('0x36')](_0x14a1be[_0xbdc7('0x37')],qs['fields'](_0x3fcb3d['query'][_0xbdc7('0x39')]));_0x14584c[_0xbdc7('0x38')]=_0x14584c['attributes']['length']?_0x14584c[_0xbdc7('0x38')]:_0x14a1be[_0xbdc7('0x37')];if(_0x3fcb3d[_0xbdc7('0x33')][_0xbdc7('0x43')]){_0x14584c[_0xbdc7('0x44')]=[{'all':!![]}];}_0x14584c=_['merge']({},_0x14584c,_0x3fcb3d[_0xbdc7('0x41')]);return db[_0xbdc7('0x42')][_0xbdc7('0x48')](_0x14584c)[_0xbdc7('0x25')](handleEntityNotFound(_0x50db61,null))['then'](respondWithResult(_0x50db61,null))['catch'](handleError(_0x50db61,null));};exports['create']=function(_0x32e8ce,_0x1966ca){return db[_0xbdc7('0x42')][_0xbdc7('0x49')](_0x32e8ce[_0xbdc7('0x4a')],{})[_0xbdc7('0x25')](function(_0x4694f5){var _0x29d81b=_0x32e8ce[_0xbdc7('0x4b')][_0xbdc7('0x4c')]({'plain':!![]});if(!_0x29d81b)throw new Error(_0xbdc7('0x4d'));if(_0x29d81b[_0xbdc7('0x4e')]===_0xbdc7('0x4b')){var _0x37fe46=_0x4694f5[_0xbdc7('0x4c')]({'plain':!![]});var _0x18ebda=_0xbdc7('0x27');return db['UserProfileSection'][_0xbdc7('0x48')]({'where':{'name':_0x18ebda,'userProfileId':_0x29d81b['userProfileId']},'raw':!![]})['then'](function(_0x3d72b2){if(_0x3d72b2&&_0x3d72b2['autoAssociation']===0x0){return db[_0xbdc7('0x28')]['create']({'name':_0x37fe46[_0xbdc7('0x2b')],'resourceId':_0x37fe46['id'],'type':_0x3d72b2[_0xbdc7('0x2b')],'sectionId':_0x3d72b2['id']},{})[_0xbdc7('0x25')](function(){return _0x4694f5;});}else{return _0x4694f5;}})[_0xbdc7('0x46')](function(_0x1e6b79){logger[_0xbdc7('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e6b79);throw _0x1e6b79;});}return _0x4694f5;})[_0xbdc7('0x25')](respondWithResult(_0x1966ca,0xc9))['catch'](handleError(_0x1966ca,null));};exports['clone']=function(_0x15fa91,_0x554b68){var _0x267161={'where':{'id':_0x15fa91[_0xbdc7('0x4f')]['id']}},_0x4817c0={};_0x4817c0[_0xbdc7('0x37')]=_[_0xbdc7('0x34')](db[_0xbdc7('0x42')][_0xbdc7('0x2f')]);_0x267161[_0xbdc7('0x38')]=_['intersection'](_0x4817c0[_0xbdc7('0x37')],qs[_0xbdc7('0x39')](_0x15fa91[_0xbdc7('0x33')][_0xbdc7('0x39')]));_0x267161['attributes']=_0x267161[_0xbdc7('0x38')][_0xbdc7('0x3a')]?_0x267161[_0xbdc7('0x38')]:_0x4817c0[_0xbdc7('0x37')];if(_0x15fa91[_0xbdc7('0x33')][_0xbdc7('0x43')]){_0x267161[_0xbdc7('0x44')]=[{'all':!![]}];}_0x267161=_[_0xbdc7('0x3f')]({},_0x267161,_0x15fa91[_0xbdc7('0x41')]);return db[_0xbdc7('0x42')]['find'](_0x267161)['then'](handleEntityNotFound(_0x554b68,null))['then'](function(_0x31d64b){if(_0x31d64b){var _0x34d8fe=_0x31d64b[_0xbdc7('0x4c')]({'plain':!![]});_0x34d8fe=qs[_0xbdc7('0x50')](_0x34d8fe,['id',_0xbdc7('0x51'),_0xbdc7('0x52')]);_0x15fa91[_0xbdc7('0x4a')]=_['omit'](_0x15fa91[_0xbdc7('0x4a')],['id',_0xbdc7('0x51'),_0xbdc7('0x52')]);return db[_0xbdc7('0x42')][_0xbdc7('0x49')](_['merge'](_0x34d8fe,_0x15fa91['body']),{'include':_0x15fa91[_0xbdc7('0x33')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3283bd){var _0x1d6e17=_0x15fa91[_0xbdc7('0x4b')][_0xbdc7('0x4c')]({'plain':!![]});if(!_0x1d6e17)throw new Error(_0xbdc7('0x4d'));if(_0x1d6e17[_0xbdc7('0x4e')]===_0xbdc7('0x4b')){var _0x552118=_0x3283bd['get']({'plain':!![]});var _0x7dcf9c='Projects';return db['UserProfileSection'][_0xbdc7('0x48')]({'where':{'name':_0x7dcf9c,'userProfileId':_0x1d6e17[_0xbdc7('0x53')]},'raw':!![]})['then'](function(_0x572d83){if(_0x572d83&&_0x572d83[_0xbdc7('0x54')]===0x0){return db['UserProfileResource'][_0xbdc7('0x49')]({'name':_0x552118[_0xbdc7('0x2b')],'resourceId':_0x552118['id'],'type':_0x572d83['name'],'sectionId':_0x572d83['id']},{})[_0xbdc7('0x25')](function(){return _0x3283bd;});}else{return _0x3283bd;}})[_0xbdc7('0x46')](function(_0x47a11e){logger[_0xbdc7('0x29')](_0xbdc7('0x55'),_0x47a11e);throw _0x47a11e;});}return _0x3283bd;});}})[_0xbdc7('0x25')](respondWithResult(_0x554b68,0xc9))[_0xbdc7('0x46')](handleError(_0x554b68,null));};exports[_0xbdc7('0x56')]=function(_0x4813e4,_0x29b681){if(_0x4813e4['body']['id']){delete _0x4813e4[_0xbdc7('0x4a')]['id'];}return db[_0xbdc7('0x42')][_0xbdc7('0x48')]({'where':{'id':_0x4813e4[_0xbdc7('0x4f')]['id']}})[_0xbdc7('0x25')](handleEntityNotFound(_0x29b681,null))[_0xbdc7('0x25')](saveUpdates(_0x4813e4['body'],null))[_0xbdc7('0x25')](respondWithResult(_0x29b681,null))['catch'](handleError(_0x29b681,null));};exports[_0xbdc7('0x26')]=function(_0x41f7b7,_0x374f1c){return db[_0xbdc7('0x42')][_0xbdc7('0x48')]({'where':{'id':_0x41f7b7['params']['id']}})[_0xbdc7('0x25')](handleEntityNotFound(_0x374f1c,null))[_0xbdc7('0x25')](removeEntity(_0x374f1c,null))[_0xbdc7('0x46')](handleError(_0x374f1c,null));};exports[_0xbdc7('0x57')]=function(_0x6d3020,_0xecbe2a,_0x3d4573){var _0x13aa7c={'raw':!![],'where':{}};var _0x3c8129={};var _0x1348ca={'count':0x0,'rows':[]};return db[_0xbdc7('0x42')][_0xbdc7('0x58')]({'where':{'id':_0x6d3020['params']['id']}})[_0xbdc7('0x25')](handleEntityNotFound(_0xecbe2a,null))[_0xbdc7('0x25')](function(_0x667026){if(_0x667026){_0x3c8129['model']=_[_0xbdc7('0x34')](db[_0xbdc7('0x59')][_0xbdc7('0x2f')]);_0x3c8129[_0xbdc7('0x33')]=_[_0xbdc7('0x34')](_0x6d3020[_0xbdc7('0x33')]);_0x3c8129[_0xbdc7('0x35')]=_['intersection'](_0x3c8129[_0xbdc7('0x37')],_0x3c8129[_0xbdc7('0x33')]);_0x13aa7c['attributes']=_[_0xbdc7('0x36')](_0x3c8129['model'],qs['fields'](_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x39')]));_0x13aa7c[_0xbdc7('0x38')]=_0x13aa7c['attributes'][_0xbdc7('0x3a')]?_0x13aa7c[_0xbdc7('0x38')]:_0x3c8129[_0xbdc7('0x37')];if(!_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x3b')](_0xbdc7('0x5a'))){_0x13aa7c[_0xbdc7('0x1f')]=qs['limit'](_0x6d3020[_0xbdc7('0x33')]['limit']);_0x13aa7c[_0xbdc7('0x21')]=qs[_0xbdc7('0x21')](_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x21')]);}_0x13aa7c['order']=qs['sort'](_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x3c')]);_0x13aa7c[_0xbdc7('0x3d')]=qs[_0xbdc7('0x35')](_[_0xbdc7('0x3e')](_0x6d3020[_0xbdc7('0x33')],_0x3c8129[_0xbdc7('0x35')]));_0x13aa7c[_0xbdc7('0x3d')][_0xbdc7('0x5b')]=_0x667026['id'];if(_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x5c')]){_0x13aa7c[_0xbdc7('0x3d')]=_[_0xbdc7('0x3f')](_0x13aa7c[_0xbdc7('0x3d')],{'$or':_['map'](_0x13aa7c[_0xbdc7('0x38')],function(_0x19039e){var _0x4a444d={};_0x4a444d[_0x19039e]={'$like':'%'+_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x5c')]+'%'};return _0x4a444d;})});}_0x13aa7c=_[_0xbdc7('0x3f')]({},_0x13aa7c,_0x6d3020[_0xbdc7('0x41')]);return db['JscriptySessionReport']['count']({'where':_0x13aa7c['where']})[_0xbdc7('0x25')](function(_0x1c446e){_0x1348ca[_0xbdc7('0x20')]=_0x1c446e;if(_0x6d3020['query'][_0xbdc7('0x43')]){_0x13aa7c['include']=[{'all':!![]}];}return db[_0xbdc7('0x59')][_0xbdc7('0x5d')](_0x13aa7c);})['then'](function(_0xbe1fd1){_0x1348ca[_0xbdc7('0x45')]=_0xbe1fd1;return _0x1348ca;});}})['then'](respondWithFilteredResult(_0xecbe2a,_0x13aa7c))[_0xbdc7('0x46')](handleError(_0xecbe2a,null));};exports[_0xbdc7('0x5e')]=function(_0x38a948,_0x10f6b3,_0x1e58b0){var _0x532d10={'raw':!![],'where':{}};var _0x217428={};var _0xac1669={'count':0x0,'rows':[]};return db[_0xbdc7('0x42')][_0xbdc7('0x58')]({'where':{'id':_0x38a948['params']['id']}})[_0xbdc7('0x25')](handleEntityNotFound(_0x10f6b3,null))['then'](function(_0x5da124){if(_0x5da124){_0x217428['model']=_[_0xbdc7('0x34')](db[_0xbdc7('0x5f')][_0xbdc7('0x2f')]);_0x217428[_0xbdc7('0x33')]=_[_0xbdc7('0x34')](_0x38a948[_0xbdc7('0x33')]);_0x217428[_0xbdc7('0x35')]=_[_0xbdc7('0x36')](_0x217428[_0xbdc7('0x37')],_0x217428[_0xbdc7('0x33')]);_0x532d10[_0xbdc7('0x38')]=_[_0xbdc7('0x36')](_0x217428['model'],qs[_0xbdc7('0x39')](_0x38a948[_0xbdc7('0x33')][_0xbdc7('0x39')]));_0x532d10['attributes']=_0x532d10['attributes'][_0xbdc7('0x3a')]?_0x532d10[_0xbdc7('0x38')]:_0x217428[_0xbdc7('0x37')];if(!_0x38a948['query']['hasOwnProperty']('nolimit')){_0x532d10[_0xbdc7('0x1f')]=qs[_0xbdc7('0x1f')](_0x38a948[_0xbdc7('0x33')]['limit']);_0x532d10[_0xbdc7('0x21')]=qs['offset'](_0x38a948['query'][_0xbdc7('0x21')]);}_0x532d10[_0xbdc7('0x60')]=qs[_0xbdc7('0x3c')](_0x38a948[_0xbdc7('0x33')][_0xbdc7('0x3c')]);_0x532d10[_0xbdc7('0x3d')]=qs['filters'](_[_0xbdc7('0x3e')](_0x38a948['query'],_0x217428['filters']));_0x532d10[_0xbdc7('0x3d')]['ProjectId']=_0x5da124['id'];if(_0x38a948[_0xbdc7('0x33')][_0xbdc7('0x5c')]){_0x532d10[_0xbdc7('0x3d')]=_[_0xbdc7('0x3f')](_0x532d10[_0xbdc7('0x3d')],{'$or':_['map'](_0x532d10['attributes'],function(_0x341026){var _0x2a6917={};_0x2a6917[_0x341026]={'$like':'%'+_0x38a948[_0xbdc7('0x33')][_0xbdc7('0x5c')]+'%'};return _0x2a6917;})});}_0x532d10=_[_0xbdc7('0x3f')]({},_0x532d10,_0x38a948['options']);return db[_0xbdc7('0x5f')][_0xbdc7('0x20')]({'where':_0x532d10[_0xbdc7('0x3d')]})[_0xbdc7('0x25')](function(_0x300649){_0xac1669['count']=_0x300649;if(_0x38a948[_0xbdc7('0x33')]['includeAll']){_0x532d10['include']=[{'all':!![]}];}return db[_0xbdc7('0x5f')][_0xbdc7('0x5d')](_0x532d10);})[_0xbdc7('0x25')](function(_0x2cdf92){_0xac1669['rows']=_0x2cdf92;return _0xac1669;});}})[_0xbdc7('0x25')](respondWithFilteredResult(_0x10f6b3,_0x532d10))[_0xbdc7('0x46')](handleError(_0x10f6b3,null));};function char(_0x2f19f5){return _0xbdc7('0x61')===typeof _0x2f19f5?String[_0xbdc7('0x62')][_0xbdc7('0x63')](null,arguments):_0x2f19f5;}function needsEncapsulation(_0x158371){return!!_0x158371&&(_0x158371['toString']()[_0xbdc7('0x64')](char(0xd))>=0x0||_0x158371[_0xbdc7('0x65')]()[_0xbdc7('0x64')](char(0xa))>=0x0||_0x158371[_0xbdc7('0x65')]()[_0xbdc7('0x64')](char(0x2c))>=0x0||_0x158371[_0xbdc7('0x65')]()[_0xbdc7('0x64')](char(0x22))>=0x0);}function encapsulate(_0x24afac){var _0x264db8=char(0x22),_0x26f46d='\x5c'+char(0x22),_0x51b3f3=_0x24afac['toString']()['replace'](new RegExp(_0x264db8,'g'),_0x26f46d);return _0x264db8+_0x51b3f3+_0x264db8;}exports[_0xbdc7('0x66')]=function(_0x52c1af,_0x531c55,_0x1e3f1e){var _0x48c6fa,_0x161fcb;var _0x57c5b3={'where':{'ProjectId':_0x52c1af[_0xbdc7('0x4f')]['id']}};if(_0x52c1af[_0xbdc7('0x33')][_0xbdc7('0x67')]){_0x57c5b3[_0xbdc7('0x3d')][_0xbdc7('0x68')]=JSON[_0xbdc7('0x69')](_0x52c1af['query'][_0xbdc7('0x67')]);}return db[_0xbdc7('0x59')][_0xbdc7('0x5d')](_0x57c5b3)[_0xbdc7('0x25')](handleEntityNotFound(_0x531c55,null))['then'](function(_0x54f71e){if(_0x54f71e){_0x48c6fa=_0x54f71e;return db[_0xbdc7('0x6a')]['findAll']({'where':{'SessionId':{'$in':_[_0xbdc7('0x2e')](_0x48c6fa,'id')},'ProjectId':_0x52c1af[_0xbdc7('0x4f')]['id']},'order':_0xbdc7('0x6b')});}})[_0xbdc7('0x25')](handleEntityNotFound(_0x531c55,null))[_0xbdc7('0x25')](function(_0x3ca971){if(_0x3ca971){_0x161fcb=_0x3ca971;var _0x3fa74c={};for(var _0x176cbd=0x0,_0x107ab6=_0x161fcb[_0xbdc7('0x3a')];_0x176cbd<_0x107ab6;_0x176cbd++){if(!_0x3fa74c['hasOwnProperty'](_0x161fcb[_0x176cbd][_0xbdc7('0x6c')])){_0x3fa74c[_0x161fcb[_0x176cbd]['questionId']]=needsEncapsulation(_0x161fcb[_0x176cbd][_0xbdc7('0x6d')])?encapsulate(_0x161fcb[_0x176cbd][_0xbdc7('0x6d')]):_0x161fcb[_0x176cbd][_0xbdc7('0x6d')];}}var _0x1eba43=[],_0x34dae2={};for(var _0x25ad79=0x0,_0x5f047e=_0x48c6fa['length'];_0x25ad79<_0x5f047e;_0x25ad79++){_0x34dae2={'ProjectId':_0x52c1af['params']['id'],'SessionId':_0x48c6fa[_0x25ad79]['id'],'StartTime':moment(_0x48c6fa[_0x25ad79]['starttime'])['format'](_0xbdc7('0x6e'))};for(var _0x479ece=0x0,_0x50e1b3=_0x161fcb[_0xbdc7('0x3a')];_0x479ece<_0x50e1b3;_0x479ece++){if(_0x161fcb[_0x479ece][_0xbdc7('0x6f')]==_0x48c6fa[_0x25ad79]['id']&&_0x3fa74c[_0xbdc7('0x3b')](_0x161fcb[_0x479ece][_0xbdc7('0x6c')])){_0x34dae2[_0x3fa74c[_0x161fcb[_0x479ece][_0xbdc7('0x6c')]]]=_0x161fcb[_0x479ece][_0xbdc7('0x70')];}}for(var _0xe95a03 in _0x3fa74c){if(!_0x34dae2[_0xbdc7('0x3b')](_0x3fa74c[_0xe95a03])){_0x34dae2[_0x3fa74c[_0xe95a03]]=null;}}_0x1eba43[_0xbdc7('0x71')](_0x34dae2);}return _0x1eba43;}})['then'](function(_0x3df11a){if(!_[_0xbdc7('0x72')](_0x3df11a)){var _0x2ca6b6=toCsv(_0x3df11a);var _0x2f5be7=Date['now']();fs[_0xbdc7('0x73')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x52c1af[_0xbdc7('0x4f')]['id'],_0x2f5be7),_0x2ca6b6);_0x531c55[_0xbdc7('0x74')](_0xbdc7('0x75'),_0xbdc7('0x76')+util[_0xbdc7('0x77')]('Jscripty_Project_%d_Summary_%s.csv',_0x52c1af[_0xbdc7('0x4f')]['id'],_0x2f5be7));_0x531c55['setHeader'](_0xbdc7('0x78'),'text/csv');return _0x531c55[_0xbdc7('0x79')](util[_0xbdc7('0x77')](_0xbdc7('0x7a'),_0x52c1af[_0xbdc7('0x4f')]['id'],_0x2f5be7));}else{return _0x531c55[_0xbdc7('0x1a')](0xcc);}})[_0xbdc7('0x46')](handleError(_0x531c55,null));}; \ No newline at end of file +var _0x980c=['toString','indexOf','replace','getSummary','starttime','startTime','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','Projects','UserProfileResource','error','stack','send','index','map','JscriptyProject','rawAttributes','fieldName','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','getSessions','JscriptySessionReport','pick','ProjectId','getAnswers','findOne','JscriptyAnswerReport','apply'];(function(_0x472351,_0x471c97){var _0x577662=function(_0x5b7bf1){while(--_0x5b7bf1){_0x472351['push'](_0x472351['shift']());}};_0x577662(++_0x471c97);}(_0x980c,0x100));var _0xc980=function(_0x491ad9,_0x32584a){_0x491ad9=_0x491ad9-0x0;var _0x51c7b9=_0x980c[_0x491ad9];return _0x51c7b9;};'use strict';var emlformat=require(_0xc980('0x0'));var rimraf=require(_0xc980('0x1'));var zipdir=require(_0xc980('0x2'));var jsonpatch=require(_0xc980('0x3'));var rp=require(_0xc980('0x4'));var moment=require(_0xc980('0x5'));var BPromise=require(_0xc980('0x6'));var Mustache=require(_0xc980('0x7'));var util=require(_0xc980('0x8'));var path=require(_0xc980('0x9'));var sox=require(_0xc980('0xa'));var csv=require('to-csv');var ejs=require(_0xc980('0xb'));var fs=require('fs');var fs_extra=require(_0xc980('0xc'));var _=require(_0xc980('0xd'));var squel=require(_0xc980('0xe'));var crypto=require(_0xc980('0xf'));var jsforce=require(_0xc980('0x10'));var deskjs=require(_0xc980('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc980('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc980('0x13'));var as=require(_0xc980('0x14'));var hardwareService=require(_0xc980('0x15'));var logger=require('../../config/logger')(_0xc980('0x16'));var utils=require(_0xc980('0x17'));var config=require(_0xc980('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc980('0x19'))['db'];function respondWithStatusCode(_0x42ef16,_0x3101fa){_0x3101fa=_0x3101fa||0xcc;return function(_0x20b510){if(_0x20b510){return _0x42ef16[_0xc980('0x1a')](_0x3101fa);}return _0x42ef16[_0xc980('0x1b')](_0x3101fa)[_0xc980('0x1c')]();};}function respondWithResult(_0x18aef9,_0x3c4ae0){_0x3c4ae0=_0x3c4ae0||0xc8;return function(_0x23e0fc){if(_0x23e0fc){return _0x18aef9[_0xc980('0x1b')](_0x3c4ae0)[_0xc980('0x1d')](_0x23e0fc);}};}function respondWithFilteredResult(_0x20ce6c,_0x5b95ac){return function(_0x59c547){if(_0x59c547){var _0xd12d7e=typeof _0x5b95ac['offset']==='undefined'&&typeof _0x5b95ac[_0xc980('0x1e')]===_0xc980('0x1f');var _0x3b86f1=_0x59c547[_0xc980('0x20')];var _0x32782d=_0xd12d7e?0x0:_0x5b95ac[_0xc980('0x21')];var _0x593e9e=_0xd12d7e?_0x59c547[_0xc980('0x20')]:_0x5b95ac[_0xc980('0x21')]+_0x5b95ac[_0xc980('0x1e')];var _0x5e093c;if(_0x593e9e>=_0x3b86f1){_0x593e9e=_0x3b86f1;_0x5e093c=0xc8;}else{_0x5e093c=0xce;}_0x20ce6c[_0xc980('0x1b')](_0x5e093c);return _0x20ce6c[_0xc980('0x22')](_0xc980('0x23'),_0x32782d+'-'+_0x593e9e+'/'+_0x3b86f1)[_0xc980('0x1d')](_0x59c547);}return null;};}function patchUpdates(_0x3249db){return function(_0x36087f){try{jsonpatch['apply'](_0x36087f,_0x3249db,!![]);}catch(_0x3c17f4){return BPromise[_0xc980('0x24')](_0x3c17f4);}return _0x36087f[_0xc980('0x25')]();};}function saveUpdates(_0x138d77,_0x101947){return function(_0x161c4a){if(_0x161c4a){return _0x161c4a[_0xc980('0x26')](_0x138d77)['then'](function(_0x591619){return _0x591619;});}return null;};}function removeEntity(_0x41f468,_0x39f92c){return function(_0x2fdd99){if(_0x2fdd99){return _0x2fdd99[_0xc980('0x27')]()[_0xc980('0x28')](function(){var _0x32845e=_0x2fdd99['get']({'plain':!![]});var _0x38eaf4=_0xc980('0x29');return db[_0xc980('0x2a')][_0xc980('0x27')]({'where':{'type':_0x38eaf4,'resourceId':_0x32845e['id']}})[_0xc980('0x28')](function(){return _0x2fdd99;});})[_0xc980('0x28')](function(){_0x41f468[_0xc980('0x1b')](0xcc)[_0xc980('0x1c')]();});}};}function handleEntityNotFound(_0x141129,_0x25bff6){return function(_0x893bca){if(!_0x893bca){_0x141129[_0xc980('0x1a')](0x194);}return _0x893bca;};}function handleError(_0x177ef6,_0x505388){_0x505388=_0x505388||0x1f4;return function(_0x4e08f2){logger[_0xc980('0x2b')](_0x4e08f2[_0xc980('0x2c')]);if(_0x4e08f2['name']){delete _0x4e08f2['name'];}_0x177ef6['status'](_0x505388)[_0xc980('0x2d')](_0x4e08f2);};}exports[_0xc980('0x2e')]=function(_0x53670c,_0x19d985){var _0x57912e={},_0x24a485={},_0x5e8435={'count':0x0,'rows':[]};var _0x19139d=_[_0xc980('0x2f')](db[_0xc980('0x30')][_0xc980('0x31')],function(_0x44389f){return{'name':_0x44389f[_0xc980('0x32')],'type':_0x44389f['type']['key']};});_0x24a485[_0xc980('0x33')]=_[_0xc980('0x2f')](_0x19139d,_0xc980('0x34'));_0x24a485[_0xc980('0x35')]=_[_0xc980('0x36')](_0x53670c[_0xc980('0x35')]);_0x24a485[_0xc980('0x37')]=_[_0xc980('0x38')](_0x24a485['model'],_0x24a485[_0xc980('0x35')]);_0x57912e['attributes']=_['intersection'](_0x24a485[_0xc980('0x33')],qs[_0xc980('0x39')](_0x53670c[_0xc980('0x35')][_0xc980('0x39')]));_0x57912e[_0xc980('0x3a')]=_0x57912e[_0xc980('0x3a')]['length']?_0x57912e[_0xc980('0x3a')]:_0x24a485['model'];if(!_0x53670c[_0xc980('0x35')][_0xc980('0x3b')](_0xc980('0x3c'))){_0x57912e[_0xc980('0x1e')]=qs['limit'](_0x53670c[_0xc980('0x35')][_0xc980('0x1e')]);_0x57912e[_0xc980('0x21')]=qs[_0xc980('0x21')](_0x53670c[_0xc980('0x35')][_0xc980('0x21')]);}_0x57912e[_0xc980('0x3d')]=qs[_0xc980('0x3e')](_0x53670c[_0xc980('0x35')][_0xc980('0x3e')]);_0x57912e[_0xc980('0x3f')]=qs[_0xc980('0x37')](_['pick'](_0x53670c['query'],_0x24a485['filters']),_0x19139d);if(_0x53670c['query'][_0xc980('0x40')]){_0x57912e[_0xc980('0x3f')]=_[_0xc980('0x41')](_0x57912e[_0xc980('0x3f')],{'$or':_['map'](_0x19139d,function(_0x54a9e9){if(_0x54a9e9['type']!==_0xc980('0x42')){var _0x16ed12={};_0x16ed12[_0x54a9e9[_0xc980('0x34')]]={'$like':'%'+_0x53670c[_0xc980('0x35')]['filter']+'%'};return _0x16ed12;}})});}_0x57912e=_[_0xc980('0x41')]({},_0x57912e,_0x53670c[_0xc980('0x43')]);var _0x19af3f={'where':_0x57912e[_0xc980('0x3f')]};return db[_0xc980('0x30')][_0xc980('0x20')](_0x19af3f)[_0xc980('0x28')](function(_0x80e624){_0x5e8435['count']=_0x80e624;if(_0x53670c[_0xc980('0x35')][_0xc980('0x44')]){_0x57912e[_0xc980('0x45')]=[{'all':!![]}];}return db[_0xc980('0x30')][_0xc980('0x46')](_0x57912e);})[_0xc980('0x28')](function(_0x3191d7){_0x5e8435[_0xc980('0x47')]=_0x3191d7;return _0x5e8435;})[_0xc980('0x28')](respondWithFilteredResult(_0x19d985,_0x57912e))[_0xc980('0x48')](handleError(_0x19d985,null));};exports['show']=function(_0x58e720,_0x52729c){var _0x21d23c={'raw':![],'where':{'id':_0x58e720[_0xc980('0x49')]['id']}},_0x5c1161={};_0x5c1161[_0xc980('0x33')]=_[_0xc980('0x36')](db[_0xc980('0x30')][_0xc980('0x31')]);_0x5c1161[_0xc980('0x35')]=_['keys'](_0x58e720[_0xc980('0x35')]);_0x5c1161[_0xc980('0x37')]=_[_0xc980('0x38')](_0x5c1161[_0xc980('0x33')],_0x5c1161[_0xc980('0x35')]);_0x21d23c[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x5c1161[_0xc980('0x33')],qs[_0xc980('0x39')](_0x58e720[_0xc980('0x35')][_0xc980('0x39')]));_0x21d23c[_0xc980('0x3a')]=_0x21d23c[_0xc980('0x3a')][_0xc980('0x4a')]?_0x21d23c[_0xc980('0x3a')]:_0x5c1161['model'];if(_0x58e720[_0xc980('0x35')][_0xc980('0x44')]){_0x21d23c[_0xc980('0x45')]=[{'all':!![]}];}_0x21d23c=_['merge']({},_0x21d23c,_0x58e720[_0xc980('0x43')]);return db['JscriptyProject'][_0xc980('0x4b')](_0x21d23c)['then'](handleEntityNotFound(_0x52729c,null))[_0xc980('0x28')](respondWithResult(_0x52729c,null))[_0xc980('0x48')](handleError(_0x52729c,null));};exports[_0xc980('0x4c')]=function(_0x549cc4,_0x562453){return db[_0xc980('0x30')][_0xc980('0x4c')](_0x549cc4[_0xc980('0x4d')],{})[_0xc980('0x28')](function(_0x3e0447){var _0x3b17fe=_0x549cc4[_0xc980('0x4e')][_0xc980('0x4f')]({'plain':!![]});if(!_0x3b17fe)throw new Error(_0xc980('0x50'));if(_0x3b17fe[_0xc980('0x51')]===_0xc980('0x4e')){var _0x25e7eb=_0x3e0447[_0xc980('0x4f')]({'plain':!![]});var _0x3e28e3='Projects';return db['UserProfileSection'][_0xc980('0x4b')]({'where':{'name':_0x3e28e3,'userProfileId':_0x3b17fe[_0xc980('0x52')]},'raw':!![]})['then'](function(_0x57c265){if(_0x57c265&&_0x57c265[_0xc980('0x53')]===0x0){return db[_0xc980('0x2a')][_0xc980('0x4c')]({'name':_0x25e7eb[_0xc980('0x34')],'resourceId':_0x25e7eb['id'],'type':_0x57c265[_0xc980('0x34')],'sectionId':_0x57c265['id']},{})[_0xc980('0x28')](function(){return _0x3e0447;});}else{return _0x3e0447;}})[_0xc980('0x48')](function(_0x3b53a3){logger[_0xc980('0x2b')](_0xc980('0x54'),_0x3b53a3);throw _0x3b53a3;});}return _0x3e0447;})[_0xc980('0x28')](respondWithResult(_0x562453,0xc9))['catch'](handleError(_0x562453,null));};exports['clone']=function(_0x43c320,_0x26f9c3){var _0x4a9856={'where':{'id':_0x43c320['params']['id']}},_0x2ab0b0={};_0x2ab0b0['model']=_[_0xc980('0x36')](db[_0xc980('0x30')][_0xc980('0x31')]);_0x4a9856[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x2ab0b0[_0xc980('0x33')],qs[_0xc980('0x39')](_0x43c320[_0xc980('0x35')][_0xc980('0x39')]));_0x4a9856[_0xc980('0x3a')]=_0x4a9856[_0xc980('0x3a')]['length']?_0x4a9856[_0xc980('0x3a')]:_0x2ab0b0[_0xc980('0x33')];if(_0x43c320[_0xc980('0x35')]['includeAll']){_0x4a9856['include']=[{'all':!![]}];}_0x4a9856=_['merge']({},_0x4a9856,_0x43c320[_0xc980('0x43')]);return db[_0xc980('0x30')]['find'](_0x4a9856)[_0xc980('0x28')](handleEntityNotFound(_0x26f9c3,null))['then'](function(_0x26a2d4){if(_0x26a2d4){var _0x3d0d05=_0x26a2d4['get']({'plain':!![]});_0x3d0d05=qs[_0xc980('0x55')](_0x3d0d05,['id',_0xc980('0x56'),'updatedAt']);_0x43c320['body']=_[_0xc980('0x55')](_0x43c320[_0xc980('0x4d')],['id',_0xc980('0x56'),'updatedAt']);return db[_0xc980('0x30')][_0xc980('0x4c')](_[_0xc980('0x41')](_0x3d0d05,_0x43c320[_0xc980('0x4d')]),{'include':_0x43c320[_0xc980('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x120892){var _0x30363b=_0x43c320[_0xc980('0x4e')][_0xc980('0x4f')]({'plain':!![]});if(!_0x30363b)throw new Error(_0xc980('0x50'));if(_0x30363b[_0xc980('0x51')]===_0xc980('0x4e')){var _0x26d73c=_0x120892[_0xc980('0x4f')]({'plain':!![]});var _0x39b56b=_0xc980('0x29');return db['UserProfileSection'][_0xc980('0x4b')]({'where':{'name':_0x39b56b,'userProfileId':_0x30363b[_0xc980('0x52')]},'raw':!![]})[_0xc980('0x28')](function(_0x25120b){if(_0x25120b&&_0x25120b[_0xc980('0x53')]===0x0){return db['UserProfileResource'][_0xc980('0x4c')]({'name':_0x26d73c[_0xc980('0x34')],'resourceId':_0x26d73c['id'],'type':_0x25120b['name'],'sectionId':_0x25120b['id']},{})['then'](function(){return _0x120892;});}else{return _0x120892;}})['catch'](function(_0xa47e03){logger[_0xc980('0x2b')](_0xc980('0x54'),_0xa47e03);throw _0xa47e03;});}return _0x120892;});}})['then'](respondWithResult(_0x26f9c3,0xc9))[_0xc980('0x48')](handleError(_0x26f9c3,null));};exports[_0xc980('0x26')]=function(_0x44d172,_0x9a742f){if(_0x44d172['body']['id']){delete _0x44d172[_0xc980('0x4d')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x44d172[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x9a742f,null))[_0xc980('0x28')](saveUpdates(_0x44d172[_0xc980('0x4d')],null))['then'](respondWithResult(_0x9a742f,null))[_0xc980('0x48')](handleError(_0x9a742f,null));};exports[_0xc980('0x27')]=function(_0x4de2df,_0x1db810){return db[_0xc980('0x30')]['find']({'where':{'id':_0x4de2df[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x1db810,null))['then'](removeEntity(_0x1db810,null))[_0xc980('0x48')](handleError(_0x1db810,null));};exports[_0xc980('0x57')]=function(_0x407506,_0x44a05b,_0x381b3b){var _0x19cd8f={'raw':!![],'where':{}};var _0x4261cc={};var _0x28f72e={'count':0x0,'rows':[]};return db[_0xc980('0x30')]['findOne']({'where':{'id':_0x407506[_0xc980('0x49')]['id']}})['then'](handleEntityNotFound(_0x44a05b,null))['then'](function(_0x2fea4f){if(_0x2fea4f){_0x4261cc[_0xc980('0x33')]=_[_0xc980('0x36')](db[_0xc980('0x58')][_0xc980('0x31')]);_0x4261cc[_0xc980('0x35')]=_[_0xc980('0x36')](_0x407506[_0xc980('0x35')]);_0x4261cc[_0xc980('0x37')]=_['intersection'](_0x4261cc[_0xc980('0x33')],_0x4261cc[_0xc980('0x35')]);_0x19cd8f[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x4261cc[_0xc980('0x33')],qs[_0xc980('0x39')](_0x407506['query'][_0xc980('0x39')]));_0x19cd8f[_0xc980('0x3a')]=_0x19cd8f[_0xc980('0x3a')][_0xc980('0x4a')]?_0x19cd8f[_0xc980('0x3a')]:_0x4261cc['model'];if(!_0x407506[_0xc980('0x35')][_0xc980('0x3b')](_0xc980('0x3c'))){_0x19cd8f[_0xc980('0x1e')]=qs['limit'](_0x407506[_0xc980('0x35')][_0xc980('0x1e')]);_0x19cd8f[_0xc980('0x21')]=qs[_0xc980('0x21')](_0x407506[_0xc980('0x35')][_0xc980('0x21')]);}_0x19cd8f[_0xc980('0x3d')]=qs[_0xc980('0x3e')](_0x407506[_0xc980('0x35')]['sort']);_0x19cd8f[_0xc980('0x3f')]=qs[_0xc980('0x37')](_[_0xc980('0x59')](_0x407506[_0xc980('0x35')],_0x4261cc['filters']));_0x19cd8f['where'][_0xc980('0x5a')]=_0x2fea4f['id'];if(_0x407506[_0xc980('0x35')]['filter']){_0x19cd8f[_0xc980('0x3f')]=_[_0xc980('0x41')](_0x19cd8f[_0xc980('0x3f')],{'$or':_['map'](_0x19cd8f[_0xc980('0x3a')],function(_0x505bd2){var _0x2500aa={};_0x2500aa[_0x505bd2]={'$like':'%'+_0x407506[_0xc980('0x35')][_0xc980('0x40')]+'%'};return _0x2500aa;})});}_0x19cd8f=_['merge']({},_0x19cd8f,_0x407506['options']);return db[_0xc980('0x58')]['count']({'where':_0x19cd8f[_0xc980('0x3f')]})[_0xc980('0x28')](function(_0x3a49a8){_0x28f72e['count']=_0x3a49a8;if(_0x407506[_0xc980('0x35')]['includeAll']){_0x19cd8f[_0xc980('0x45')]=[{'all':!![]}];}return db[_0xc980('0x58')][_0xc980('0x46')](_0x19cd8f);})['then'](function(_0x1d97b8){_0x28f72e[_0xc980('0x47')]=_0x1d97b8;return _0x28f72e;});}})[_0xc980('0x28')](respondWithFilteredResult(_0x44a05b,_0x19cd8f))[_0xc980('0x48')](handleError(_0x44a05b,null));};exports[_0xc980('0x5b')]=function(_0x283642,_0x2c8b2d,_0x266927){var _0x1a0c18={'raw':!![],'where':{}};var _0x4894c4={};var _0x2168e4={'count':0x0,'rows':[]};return db[_0xc980('0x30')][_0xc980('0x5c')]({'where':{'id':_0x283642[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x2c8b2d,null))['then'](function(_0x4bd44b){if(_0x4bd44b){_0x4894c4[_0xc980('0x33')]=_[_0xc980('0x36')](db[_0xc980('0x5d')][_0xc980('0x31')]);_0x4894c4[_0xc980('0x35')]=_[_0xc980('0x36')](_0x283642[_0xc980('0x35')]);_0x4894c4['filters']=_[_0xc980('0x38')](_0x4894c4[_0xc980('0x33')],_0x4894c4[_0xc980('0x35')]);_0x1a0c18['attributes']=_[_0xc980('0x38')](_0x4894c4[_0xc980('0x33')],qs[_0xc980('0x39')](_0x283642[_0xc980('0x35')][_0xc980('0x39')]));_0x1a0c18[_0xc980('0x3a')]=_0x1a0c18[_0xc980('0x3a')][_0xc980('0x4a')]?_0x1a0c18[_0xc980('0x3a')]:_0x4894c4[_0xc980('0x33')];if(!_0x283642[_0xc980('0x35')][_0xc980('0x3b')](_0xc980('0x3c'))){_0x1a0c18[_0xc980('0x1e')]=qs[_0xc980('0x1e')](_0x283642[_0xc980('0x35')][_0xc980('0x1e')]);_0x1a0c18[_0xc980('0x21')]=qs['offset'](_0x283642[_0xc980('0x35')][_0xc980('0x21')]);}_0x1a0c18[_0xc980('0x3d')]=qs[_0xc980('0x3e')](_0x283642['query'][_0xc980('0x3e')]);_0x1a0c18['where']=qs[_0xc980('0x37')](_[_0xc980('0x59')](_0x283642['query'],_0x4894c4[_0xc980('0x37')]));_0x1a0c18[_0xc980('0x3f')]['ProjectId']=_0x4bd44b['id'];if(_0x283642[_0xc980('0x35')][_0xc980('0x40')]){_0x1a0c18[_0xc980('0x3f')]=_[_0xc980('0x41')](_0x1a0c18[_0xc980('0x3f')],{'$or':_[_0xc980('0x2f')](_0x1a0c18['attributes'],function(_0x4b9f51){var _0x429742={};_0x429742[_0x4b9f51]={'$like':'%'+_0x283642[_0xc980('0x35')]['filter']+'%'};return _0x429742;})});}_0x1a0c18=_[_0xc980('0x41')]({},_0x1a0c18,_0x283642[_0xc980('0x43')]);return db[_0xc980('0x5d')][_0xc980('0x20')]({'where':_0x1a0c18[_0xc980('0x3f')]})[_0xc980('0x28')](function(_0x24bcdf){_0x2168e4['count']=_0x24bcdf;if(_0x283642[_0xc980('0x35')]['includeAll']){_0x1a0c18[_0xc980('0x45')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc980('0x46')](_0x1a0c18);})[_0xc980('0x28')](function(_0x388f8c){_0x2168e4[_0xc980('0x47')]=_0x388f8c;return _0x2168e4;});}})['then'](respondWithFilteredResult(_0x2c8b2d,_0x1a0c18))['catch'](handleError(_0x2c8b2d,null));};function char(_0x556120){return'number'===typeof _0x556120?String['fromCharCode'][_0xc980('0x5e')](null,arguments):_0x556120;}function needsEncapsulation(_0x518ebf){return!!_0x518ebf&&(_0x518ebf[_0xc980('0x5f')]()[_0xc980('0x60')](char(0xd))>=0x0||_0x518ebf[_0xc980('0x5f')]()[_0xc980('0x60')](char(0xa))>=0x0||_0x518ebf[_0xc980('0x5f')]()[_0xc980('0x60')](char(0x2c))>=0x0||_0x518ebf['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x1b0500){var _0x398644=char(0x22),_0x3862af='\x5c'+char(0x22),_0x5d6846=_0x1b0500[_0xc980('0x5f')]()[_0xc980('0x61')](new RegExp(_0x398644,'g'),_0x3862af);return _0x398644+_0x5d6846+_0x398644;}exports[_0xc980('0x62')]=function(_0x2b51e4,_0x5e0001,_0x20e3f4){var _0x225ca5,_0x3e343a;var _0x1710eb={'where':{'ProjectId':_0x2b51e4[_0xc980('0x49')]['id']}};if(_0x2b51e4[_0xc980('0x35')]['startTime']){_0x1710eb[_0xc980('0x3f')][_0xc980('0x63')]=JSON['parse'](_0x2b51e4[_0xc980('0x35')][_0xc980('0x64')]);}return db[_0xc980('0x58')][_0xc980('0x46')](_0x1710eb)[_0xc980('0x28')](handleEntityNotFound(_0x5e0001,null))[_0xc980('0x28')](function(_0x7f1255){if(_0x7f1255){_0x225ca5=_0x7f1255;return db['JscriptyQuestionReport'][_0xc980('0x46')]({'where':{'SessionId':{'$in':_[_0xc980('0x2f')](_0x225ca5,'id')},'ProjectId':_0x2b51e4['params']['id']},'order':'-createdAt'});}})[_0xc980('0x28')](handleEntityNotFound(_0x5e0001,null))[_0xc980('0x28')](function(_0x4f211f){if(_0x4f211f){_0x3e343a=_0x4f211f;var _0x5bdb5d={};for(var _0x1a8978=0x0,_0x523c32=_0x3e343a[_0xc980('0x4a')];_0x1a8978<_0x523c32;_0x1a8978++){if(!_0x5bdb5d[_0xc980('0x3b')](_0x3e343a[_0x1a8978][_0xc980('0x65')])){_0x5bdb5d[_0x3e343a[_0x1a8978]['questionId']]=needsEncapsulation(_0x3e343a[_0x1a8978][_0xc980('0x66')])?encapsulate(_0x3e343a[_0x1a8978][_0xc980('0x66')]):_0x3e343a[_0x1a8978][_0xc980('0x66')];}}var _0x2796cc=[],_0x3f1613={};for(var _0x54e801=0x0,_0x12b8fd=_0x225ca5[_0xc980('0x4a')];_0x54e801<_0x12b8fd;_0x54e801++){_0x3f1613={'ProjectId':_0x2b51e4['params']['id'],'SessionId':_0x225ca5[_0x54e801]['id'],'StartTime':moment(_0x225ca5[_0x54e801][_0xc980('0x63')])[_0xc980('0x67')](_0xc980('0x68'))};for(var _0x58b1d0=0x0,_0x4aefe7=_0x3e343a[_0xc980('0x4a')];_0x58b1d0<_0x4aefe7;_0x58b1d0++){if(_0x3e343a[_0x58b1d0][_0xc980('0x69')]==_0x225ca5[_0x54e801]['id']&&_0x5bdb5d[_0xc980('0x3b')](_0x3e343a[_0x58b1d0][_0xc980('0x65')])){_0x3f1613[_0x5bdb5d[_0x3e343a[_0x58b1d0]['questionId']]]=_0x3e343a[_0x58b1d0][_0xc980('0x6a')];}}for(var _0x4b6d08 in _0x5bdb5d){if(!_0x3f1613[_0xc980('0x3b')](_0x5bdb5d[_0x4b6d08])){_0x3f1613[_0x5bdb5d[_0x4b6d08]]=null;}}_0x2796cc[_0xc980('0x6b')](_0x3f1613);}return _0x2796cc;}})['then'](function(_0x48303a){if(!_['isEmpty'](_0x48303a)){var _0x261d12=toCsv(_0x48303a);var _0x7c9ad7=Date[_0xc980('0x6c')]();fs[_0xc980('0x6d')](util[_0xc980('0x67')](_0xc980('0x6e'),_0x2b51e4[_0xc980('0x49')]['id'],_0x7c9ad7),_0x261d12);_0x5e0001[_0xc980('0x6f')](_0xc980('0x70'),_0xc980('0x71')+util[_0xc980('0x67')]('Jscripty_Project_%d_Summary_%s.csv',_0x2b51e4['params']['id'],_0x7c9ad7));_0x5e0001[_0xc980('0x6f')](_0xc980('0x72'),_0xc980('0x73'));return _0x5e0001[_0xc980('0x74')](util[_0xc980('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2b51e4[_0xc980('0x49')]['id'],_0x7c9ad7));}else{return _0x5e0001[_0xc980('0x1a')](0xcc);}})[_0xc980('0x48')](handleError(_0x5e0001,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 67c3ffc..0731ff1 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 _0x5162=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash'];(function(_0x49d1d9,_0x1f4f66){var _0x4ccb55=function(_0x144a5e){while(--_0x144a5e){_0x49d1d9['push'](_0x49d1d9['shift']());}};_0x4ccb55(++_0x1f4f66);}(_0x5162,0x103));var _0x2516=function(_0x4eeca4,_0x5901c9){_0x4eeca4=_0x4eeca4-0x0;var _0x430031=_0x5162[_0x4eeca4];return _0x430031;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2516('0x1'));var rp=require(_0x2516('0x2'));var fs=require('fs');var path=require(_0x2516('0x3'));var rimraf=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));module[_0x2516('0x7')]=function(_0x5b71b5,_0x48f411){return _0x5b71b5['define'](_0x2516('0x8'),attributes,{'tableName':_0x2516('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f90=['rimraf','./jscriptyProject.attributes','exports','define','lodash','util','../../config/logger','api','moment','path'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x7f90,0xf4));var _0x07f9=function(_0x54f149,_0x345618){_0x54f149=_0x54f149-0x0;var _0x1bbcb3=_0x7f90[_0x54f149];return _0x1bbcb3;};'use strict';var _=require(_0x07f9('0x0'));var util=require(_0x07f9('0x1'));var logger=require(_0x07f9('0x2'))(_0x07f9('0x3'));var moment=require(_0x07f9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x07f9('0x5'));var rimraf=require(_0x07f9('0x6'));var config=require('../../config/environment');var attributes=require(_0x07f9('0x7'));module[_0x07f9('0x8')]=function(_0x46f86e,_0x449544){return _0x46f86e[_0x07f9('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 82b20d4..85b3590 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1b591b,_0x6d2e2b){var _0x3c24f0=function(_0x265093){while(--_0x265093){_0x1b591b['push'](_0x1b591b['shift']());}};_0x3c24f0(++_0x6d2e2b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x23a7ef,_0x2ed832){_0x23a7ef=_0x23a7ef-0x0;var _0x2e333b=_0xf4eb[_0x23a7ef];return _0x2e333b;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x557ea5,_0x260d73){var _0x87d301=function(_0x276d7a){while(--_0x276d7a){_0x557ea5['push'](_0x557ea5['shift']());}};_0x87d301(++_0x260d73);}(_0xe706,0xa3));var _0x6e70=function(_0x2bd8a6,_0x5b9211){_0x2bd8a6=_0x2bd8a6-0x0;var _0x1e037a=_0xe706[_0x2bd8a6];return _0x1e037a;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f5f3745..3b4158a 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 _0x319c=['update','delete','destroy','exports','multer','util','connect-timeout','Router','../../config/environment','get','/describe','isAuthenticated','/:id','show','create','put'];(function(_0x506ff5,_0x16d10f){var _0x2bd51b=function(_0x1a7f2b){while(--_0x1a7f2b){_0x506ff5['push'](_0x506ff5['shift']());}};_0x2bd51b(++_0x16d10f);}(_0x319c,0x164));var _0xc319=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x319c[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xc319('0x0'));var util=require(_0xc319('0x1'));var path=require('path');var timeout=require(_0xc319('0x2'));var express=require('express');var router=express[_0xc319('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc319('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0xc319('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc319('0x5')](_0xc319('0x6'),auth[_0xc319('0x7')](),controller['describe']);router[_0xc319('0x5')](_0xc319('0x8'),auth[_0xc319('0x7')](),controller[_0xc319('0x9')]);router['post']('/',auth[_0xc319('0x7')](),controller[_0xc319('0xa')]);router[_0xc319('0xb')](_0xc319('0x8'),auth['isAuthenticated'](),controller[_0xc319('0xc')]);router[_0xc319('0xd')](_0xc319('0x8'),auth['isAuthenticated'](),controller[_0xc319('0xe')]);module[_0xc319('0xf')]=router; \ No newline at end of file +var _0x53d6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5a7282,_0xa6e195){var _0x4928ec=function(_0x55594b){while(--_0x55594b){_0x5a7282['push'](_0x5a7282['shift']());}};_0x4928ec(++_0xa6e195);}(_0x53d6,0x1f4));var _0x653d=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x53d6[_0xa148b7];return _0x51efd3;};'use strict';var multer=require('multer');var util=require(_0x653d('0x0'));var path=require(_0x653d('0x1'));var timeout=require(_0x653d('0x2'));var express=require(_0x653d('0x3'));var router=express[_0x653d('0x4')]();var fs_extra=require(_0x653d('0x5'));var auth=require(_0x653d('0x6'));var interaction=require(_0x653d('0x7'));var config=require(_0x653d('0x8'));var controller=require(_0x653d('0x9'));router[_0x653d('0xa')]('/',auth[_0x653d('0xb')](),controller[_0x653d('0xc')]);router['get'](_0x653d('0xd'),auth[_0x653d('0xb')](),controller[_0x653d('0xe')]);router[_0x653d('0xa')](_0x653d('0xf'),auth[_0x653d('0xb')](),controller[_0x653d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x653d('0x11')]);router['put']('/:id',auth[_0x653d('0xb')](),controller[_0x653d('0x12')]);router[_0x653d('0x13')](_0x653d('0xf'),auth[_0x653d('0xb')](),controller[_0x653d('0x14')]);module[_0x653d('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9a231bf..597eebb 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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x47dace,_0x11ed9c){_0x47dace=_0x47dace-0x0;var _0x286a39=_0x7a54[_0x47dace];return _0x286a39;};'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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x2dca08,_0x20067d){_0x2dca08=_0x2dca08-0x0;var _0x54228a=_0x7a54[_0x2dca08];return _0x54228a;};'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 206fe8c..0cd3ef6 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 _0x874b=['body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','offset','limit','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create'];(function(_0x14a258,_0x29fedd){var _0x54030c=function(_0x156a82){while(--_0x156a82){_0x14a258['push'](_0x14a258['shift']());}};_0x54030c(++_0x29fedd);}(_0x874b,0x17a));var _0xb874=function(_0x5612f0,_0x227259){_0x5612f0=_0x5612f0-0x0;var _0x57cfb2=_0x874b[_0x5612f0];return _0x57cfb2;};'use strict';var emlformat=require(_0xb874('0x0'));var rimraf=require(_0xb874('0x1'));var zipdir=require(_0xb874('0x2'));var jsonpatch=require(_0xb874('0x3'));var rp=require(_0xb874('0x4'));var moment=require(_0xb874('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb874('0x6'));var util=require(_0xb874('0x7'));var path=require(_0xb874('0x8'));var sox=require(_0xb874('0x9'));var csv=require(_0xb874('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb874('0xb'));var squel=require(_0xb874('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb874('0xd'));var toCsv=require(_0xb874('0xa'));var querystring=require(_0xb874('0xe'));var Papa=require(_0xb874('0xf'));var Redis=require(_0xb874('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb874('0x11'));var as=require(_0xb874('0x12'));var hardwareService=require(_0xb874('0x13'));var logger=require(_0xb874('0x14'))(_0xb874('0x15'));var utils=require(_0xb874('0x16'));var config=require(_0xb874('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bd311,_0xfe10fa){_0xfe10fa=_0xfe10fa||0xcc;return function(_0x35b52f){if(_0x35b52f){return _0x1bd311[_0xb874('0x18')](_0xfe10fa);}return _0x1bd311[_0xb874('0x19')](_0xfe10fa)['end']();};}function respondWithResult(_0x50185d,_0x3cd661){_0x3cd661=_0x3cd661||0xc8;return function(_0x9e801a){if(_0x9e801a){return _0x50185d['status'](_0x3cd661)[_0xb874('0x1a')](_0x9e801a);}};}function respondWithFilteredResult(_0x235479,_0x72a5f1){return function(_0x9e06fa){if(_0x9e06fa){var _0x240585=typeof _0x72a5f1['offset']===_0xb874('0x1b')&&typeof _0x72a5f1['limit']===_0xb874('0x1b');var _0x92871=_0x9e06fa[_0xb874('0x1c')];var _0x2f664b=_0x240585?0x0:_0x72a5f1[_0xb874('0x1d')];var _0x147ed0=_0x240585?_0x9e06fa['count']:_0x72a5f1[_0xb874('0x1d')]+_0x72a5f1[_0xb874('0x1e')];var _0x19d253;if(_0x147ed0>=_0x92871){_0x147ed0=_0x92871;_0x19d253=0xc8;}else{_0x19d253=0xce;}_0x235479[_0xb874('0x19')](_0x19d253);return _0x235479['set']('Content-Range',_0x2f664b+'-'+_0x147ed0+'/'+_0x92871)['json'](_0x9e06fa);}return null;};}function patchUpdates(_0x48cbf2){return function(_0x2e5cf1){try{jsonpatch[_0xb874('0x1f')](_0x2e5cf1,_0x48cbf2,!![]);}catch(_0x632b2a){return BPromise[_0xb874('0x20')](_0x632b2a);}return _0x2e5cf1[_0xb874('0x21')]();};}function saveUpdates(_0x4db1b5,_0x35560a){return function(_0x53b7ad){if(_0x53b7ad){return _0x53b7ad[_0xb874('0x22')](_0x4db1b5)['then'](function(_0x569b6c){return _0x569b6c;});}return null;};}function removeEntity(_0x4fa3c2,_0x176966){return function(_0x4eb1f9){if(_0x4eb1f9){return _0x4eb1f9[_0xb874('0x23')]()['then'](function(){_0x4fa3c2[_0xb874('0x19')](0xcc)[_0xb874('0x24')]();});}};}function handleEntityNotFound(_0x259435,_0x3897f5){return function(_0x1525b4){if(!_0x1525b4){_0x259435['sendStatus'](0x194);}return _0x1525b4;};}function handleError(_0xab853,_0x1ffbe5){_0x1ffbe5=_0x1ffbe5||0x1f4;return function(_0x492791){logger[_0xb874('0x25')](_0x492791[_0xb874('0x26')]);if(_0x492791[_0xb874('0x27')]){delete _0x492791[_0xb874('0x27')];}_0xab853[_0xb874('0x19')](_0x1ffbe5)[_0xb874('0x28')](_0x492791);};}exports[_0xb874('0x29')]=function(_0xcca92d,_0x5ca831){var _0x2dd57c={},_0xd605a4={},_0x5b5c30={'count':0x0,'rows':[]};var _0x4f584e=_[_0xb874('0x2a')](db[_0xb874('0x2b')]['rawAttributes'],function(_0x213068){return{'name':_0x213068[_0xb874('0x2c')],'type':_0x213068[_0xb874('0x2d')][_0xb874('0x2e')]};});_0xd605a4[_0xb874('0x2f')]=_[_0xb874('0x2a')](_0x4f584e,_0xb874('0x27'));_0xd605a4[_0xb874('0x30')]=_['keys'](_0xcca92d[_0xb874('0x30')]);_0xd605a4[_0xb874('0x31')]=_[_0xb874('0x32')](_0xd605a4['model'],_0xd605a4[_0xb874('0x30')]);_0x2dd57c[_0xb874('0x33')]=_[_0xb874('0x32')](_0xd605a4[_0xb874('0x2f')],qs[_0xb874('0x34')](_0xcca92d[_0xb874('0x30')][_0xb874('0x34')]));_0x2dd57c[_0xb874('0x33')]=_0x2dd57c['attributes'][_0xb874('0x35')]?_0x2dd57c[_0xb874('0x33')]:_0xd605a4['model'];if(!_0xcca92d[_0xb874('0x30')]['hasOwnProperty'](_0xb874('0x36'))){_0x2dd57c[_0xb874('0x1e')]=qs[_0xb874('0x1e')](_0xcca92d[_0xb874('0x30')][_0xb874('0x1e')]);_0x2dd57c[_0xb874('0x1d')]=qs['offset'](_0xcca92d[_0xb874('0x30')][_0xb874('0x1d')]);}_0x2dd57c[_0xb874('0x37')]=qs[_0xb874('0x38')](_0xcca92d[_0xb874('0x30')]['sort']);_0x2dd57c[_0xb874('0x39')]=qs['filters'](_[_0xb874('0x3a')](_0xcca92d['query'],_0xd605a4[_0xb874('0x31')]),_0x4f584e);if(_0xcca92d[_0xb874('0x30')][_0xb874('0x3b')]){_0x2dd57c[_0xb874('0x39')]=_[_0xb874('0x3c')](_0x2dd57c['where'],{'$or':_[_0xb874('0x2a')](_0x4f584e,function(_0x28f16f){if(_0x28f16f['type']!=='VIRTUAL'){var _0x1fa1ea={};_0x1fa1ea[_0x28f16f[_0xb874('0x27')]]={'$like':'%'+_0xcca92d[_0xb874('0x30')]['filter']+'%'};return _0x1fa1ea;}})});}_0x2dd57c=_[_0xb874('0x3c')]({},_0x2dd57c,_0xcca92d[_0xb874('0x3d')]);var _0x52193d={'where':_0x2dd57c['where']};return db[_0xb874('0x2b')][_0xb874('0x1c')](_0x52193d)[_0xb874('0x3e')](function(_0x51d30d){_0x5b5c30[_0xb874('0x1c')]=_0x51d30d;if(_0xcca92d[_0xb874('0x30')][_0xb874('0x3f')]){_0x2dd57c[_0xb874('0x40')]=[{'all':!![]}];}return db[_0xb874('0x2b')][_0xb874('0x41')](_0x2dd57c);})[_0xb874('0x3e')](function(_0x253181){_0x5b5c30[_0xb874('0x42')]=_0x253181;return _0x5b5c30;})['then'](respondWithFilteredResult(_0x5ca831,_0x2dd57c))[_0xb874('0x43')](handleError(_0x5ca831,null));};exports['show']=function(_0x160ae3,_0x2360cb){var _0x48779f={'raw':!![],'where':{'id':_0x160ae3[_0xb874('0x44')]['id']}},_0x198847={};_0x198847['model']=_[_0xb874('0x45')](db['JscriptyQuestionReport'][_0xb874('0x46')]);_0x198847[_0xb874('0x30')]=_[_0xb874('0x45')](_0x160ae3[_0xb874('0x30')]);_0x198847[_0xb874('0x31')]=_['intersection'](_0x198847['model'],_0x198847['query']);_0x48779f[_0xb874('0x33')]=_[_0xb874('0x32')](_0x198847[_0xb874('0x2f')],qs[_0xb874('0x34')](_0x160ae3[_0xb874('0x30')][_0xb874('0x34')]));_0x48779f[_0xb874('0x33')]=_0x48779f[_0xb874('0x33')]['length']?_0x48779f[_0xb874('0x33')]:_0x198847[_0xb874('0x2f')];if(_0x160ae3[_0xb874('0x30')][_0xb874('0x3f')]){_0x48779f['include']=[{'all':!![]}];}_0x48779f=_[_0xb874('0x3c')]({},_0x48779f,_0x160ae3[_0xb874('0x3d')]);return db[_0xb874('0x2b')]['find'](_0x48779f)[_0xb874('0x3e')](handleEntityNotFound(_0x2360cb,null))[_0xb874('0x3e')](respondWithResult(_0x2360cb,null))['catch'](handleError(_0x2360cb,null));};exports[_0xb874('0x47')]=function(_0x5c24b5,_0x316f51){return db[_0xb874('0x2b')]['create'](_0x5c24b5[_0xb874('0x48')],{})[_0xb874('0x3e')](respondWithResult(_0x316f51,0xc9))[_0xb874('0x43')](handleError(_0x316f51,null));};exports[_0xb874('0x22')]=function(_0x1fbd4b,_0x15e09a){if(_0x1fbd4b[_0xb874('0x48')]['id']){delete _0x1fbd4b['body']['id'];}return db[_0xb874('0x2b')][_0xb874('0x49')]({'where':{'id':_0x1fbd4b[_0xb874('0x44')]['id']}})['then'](handleEntityNotFound(_0x15e09a,null))[_0xb874('0x3e')](saveUpdates(_0x1fbd4b[_0xb874('0x48')],null))[_0xb874('0x3e')](respondWithResult(_0x15e09a,null))[_0xb874('0x43')](handleError(_0x15e09a,null));};exports[_0xb874('0x23')]=function(_0x2acdbb,_0x4aa994){return db['JscriptyQuestionReport'][_0xb874('0x49')]({'where':{'id':_0x2acdbb[_0xb874('0x44')]['id']}})[_0xb874('0x3e')](handleEntityNotFound(_0x4aa994,null))[_0xb874('0x3e')](removeEntity(_0x4aa994,null))[_0xb874('0x43')](handleError(_0x4aa994,null));};exports[_0xb874('0x4a')]=function(_0x5b0e5d,_0xe071e6){return db[_0xb874('0x2b')]['describe']()[_0xb874('0x3e')](respondWithResult(_0xe071e6,null))[_0xb874('0x43')](handleError(_0xe071e6,null));}; \ No newline at end of file +var _0x144c=['include','catch','create','body','find','describe','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','show','params'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x144c,0xde));var _0xc144=function(_0xa92559,_0x1d2e45){_0xa92559=_0xa92559-0x0;var _0x502df8=_0x144c[_0xa92559];return _0x502df8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc144('0x0'));var zipdir=require(_0xc144('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc144('0x2'));var moment=require('moment');var BPromise=require(_0xc144('0x3'));var Mustache=require('mustache');var util=require(_0xc144('0x4'));var path=require('path');var sox=require(_0xc144('0x5'));var csv=require('to-csv');var ejs=require(_0xc144('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc144('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc144('0x8'));var deskjs=require(_0xc144('0x9'));var toCsv=require(_0xc144('0xa'));var querystring=require(_0xc144('0xb'));var Papa=require('papaparse');var Redis=require(_0xc144('0xc'));var authService=require(_0xc144('0xd'));var qs=require(_0xc144('0xe'));var as=require(_0xc144('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc144('0x10'))('api');var utils=require(_0xc144('0x11'));var config=require(_0xc144('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc144('0x13'))['db'];function respondWithStatusCode(_0xf58677,_0x593746){_0x593746=_0x593746||0xcc;return function(_0x1bdfdc){if(_0x1bdfdc){return _0xf58677['sendStatus'](_0x593746);}return _0xf58677[_0xc144('0x14')](_0x593746)[_0xc144('0x15')]();};}function respondWithResult(_0x53f2cd,_0x4a7d1d){_0x4a7d1d=_0x4a7d1d||0xc8;return function(_0x117bde){if(_0x117bde){return _0x53f2cd[_0xc144('0x14')](_0x4a7d1d)[_0xc144('0x16')](_0x117bde);}};}function respondWithFilteredResult(_0x1054cf,_0x25adb7){return function(_0x3e0c5c){if(_0x3e0c5c){var _0x524f4a=typeof _0x25adb7['offset']===_0xc144('0x17')&&typeof _0x25adb7[_0xc144('0x18')]===_0xc144('0x17');var _0x23de0f=_0x3e0c5c[_0xc144('0x19')];var _0x10c3c9=_0x524f4a?0x0:_0x25adb7['offset'];var _0x28c653=_0x524f4a?_0x3e0c5c[_0xc144('0x19')]:_0x25adb7[_0xc144('0x1a')]+_0x25adb7['limit'];var _0x1525f8;if(_0x28c653>=_0x23de0f){_0x28c653=_0x23de0f;_0x1525f8=0xc8;}else{_0x1525f8=0xce;}_0x1054cf['status'](_0x1525f8);return _0x1054cf[_0xc144('0x1b')]('Content-Range',_0x10c3c9+'-'+_0x28c653+'/'+_0x23de0f)[_0xc144('0x16')](_0x3e0c5c);}return null;};}function patchUpdates(_0x5c20fa){return function(_0x4e6a2c){try{jsonpatch[_0xc144('0x1c')](_0x4e6a2c,_0x5c20fa,!![]);}catch(_0x42c503){return BPromise[_0xc144('0x1d')](_0x42c503);}return _0x4e6a2c[_0xc144('0x1e')]();};}function saveUpdates(_0x5e2c60,_0x2ebc7c){return function(_0x3ed7f6){if(_0x3ed7f6){return _0x3ed7f6[_0xc144('0x1f')](_0x5e2c60)[_0xc144('0x20')](function(_0x3f90b0){return _0x3f90b0;});}return null;};}function removeEntity(_0x516856,_0x4093fe){return function(_0xfd71f2){if(_0xfd71f2){return _0xfd71f2[_0xc144('0x21')]()[_0xc144('0x20')](function(){_0x516856[_0xc144('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b17cb,_0xaaec79){return function(_0x513328){if(!_0x513328){_0x5b17cb[_0xc144('0x22')](0x194);}return _0x513328;};}function handleError(_0xa9f47b,_0x5e305a){_0x5e305a=_0x5e305a||0x1f4;return function(_0xab9a1f){logger[_0xc144('0x23')](_0xab9a1f[_0xc144('0x24')]);if(_0xab9a1f['name']){delete _0xab9a1f[_0xc144('0x25')];}_0xa9f47b[_0xc144('0x14')](_0x5e305a)[_0xc144('0x26')](_0xab9a1f);};}exports[_0xc144('0x27')]=function(_0x299fe1,_0x487a5b){var _0x3f37b8={},_0x3b8686={},_0x384518={'count':0x0,'rows':[]};var _0x3e2be0=_[_0xc144('0x28')](db[_0xc144('0x29')][_0xc144('0x2a')],function(_0x160122){return{'name':_0x160122[_0xc144('0x2b')],'type':_0x160122[_0xc144('0x2c')][_0xc144('0x2d')]};});_0x3b8686[_0xc144('0x2e')]=_[_0xc144('0x28')](_0x3e2be0,_0xc144('0x25'));_0x3b8686[_0xc144('0x2f')]=_[_0xc144('0x30')](_0x299fe1[_0xc144('0x2f')]);_0x3b8686[_0xc144('0x31')]=_['intersection'](_0x3b8686['model'],_0x3b8686[_0xc144('0x2f')]);_0x3f37b8[_0xc144('0x32')]=_[_0xc144('0x33')](_0x3b8686[_0xc144('0x2e')],qs[_0xc144('0x34')](_0x299fe1[_0xc144('0x2f')]['fields']));_0x3f37b8[_0xc144('0x32')]=_0x3f37b8['attributes'][_0xc144('0x35')]?_0x3f37b8[_0xc144('0x32')]:_0x3b8686[_0xc144('0x2e')];if(!_0x299fe1['query'][_0xc144('0x36')]('nolimit')){_0x3f37b8[_0xc144('0x18')]=qs[_0xc144('0x18')](_0x299fe1[_0xc144('0x2f')][_0xc144('0x18')]);_0x3f37b8['offset']=qs[_0xc144('0x1a')](_0x299fe1[_0xc144('0x2f')]['offset']);}_0x3f37b8[_0xc144('0x37')]=qs[_0xc144('0x38')](_0x299fe1['query'][_0xc144('0x38')]);_0x3f37b8[_0xc144('0x39')]=qs[_0xc144('0x31')](_['pick'](_0x299fe1[_0xc144('0x2f')],_0x3b8686[_0xc144('0x31')]),_0x3e2be0);if(_0x299fe1[_0xc144('0x2f')]['filter']){_0x3f37b8[_0xc144('0x39')]=_[_0xc144('0x3a')](_0x3f37b8[_0xc144('0x39')],{'$or':_[_0xc144('0x28')](_0x3e2be0,function(_0x512216){if(_0x512216['type']!==_0xc144('0x3b')){var _0x4bbb81={};_0x4bbb81[_0x512216[_0xc144('0x25')]]={'$like':'%'+_0x299fe1[_0xc144('0x2f')][_0xc144('0x3c')]+'%'};return _0x4bbb81;}})});}_0x3f37b8=_['merge']({},_0x3f37b8,_0x299fe1[_0xc144('0x3d')]);var _0x3a69ee={'where':_0x3f37b8[_0xc144('0x39')]};return db[_0xc144('0x29')]['count'](_0x3a69ee)[_0xc144('0x20')](function(_0xd14337){_0x384518[_0xc144('0x19')]=_0xd14337;if(_0x299fe1[_0xc144('0x2f')][_0xc144('0x3e')]){_0x3f37b8['include']=[{'all':!![]}];}return db[_0xc144('0x29')]['findAll'](_0x3f37b8);})['then'](function(_0x723499){_0x384518[_0xc144('0x3f')]=_0x723499;return _0x384518;})['then'](respondWithFilteredResult(_0x487a5b,_0x3f37b8))['catch'](handleError(_0x487a5b,null));};exports[_0xc144('0x40')]=function(_0x5e7886,_0xef0cfd){var _0x76385d={'raw':!![],'where':{'id':_0x5e7886[_0xc144('0x41')]['id']}},_0x4f6eb0={};_0x4f6eb0[_0xc144('0x2e')]=_['keys'](db['JscriptyQuestionReport']['rawAttributes']);_0x4f6eb0[_0xc144('0x2f')]=_[_0xc144('0x30')](_0x5e7886[_0xc144('0x2f')]);_0x4f6eb0[_0xc144('0x31')]=_['intersection'](_0x4f6eb0['model'],_0x4f6eb0[_0xc144('0x2f')]);_0x76385d[_0xc144('0x32')]=_['intersection'](_0x4f6eb0[_0xc144('0x2e')],qs[_0xc144('0x34')](_0x5e7886[_0xc144('0x2f')][_0xc144('0x34')]));_0x76385d[_0xc144('0x32')]=_0x76385d[_0xc144('0x32')][_0xc144('0x35')]?_0x76385d['attributes']:_0x4f6eb0[_0xc144('0x2e')];if(_0x5e7886[_0xc144('0x2f')][_0xc144('0x3e')]){_0x76385d[_0xc144('0x42')]=[{'all':!![]}];}_0x76385d=_[_0xc144('0x3a')]({},_0x76385d,_0x5e7886['options']);return db[_0xc144('0x29')]['find'](_0x76385d)[_0xc144('0x20')](handleEntityNotFound(_0xef0cfd,null))[_0xc144('0x20')](respondWithResult(_0xef0cfd,null))[_0xc144('0x43')](handleError(_0xef0cfd,null));};exports[_0xc144('0x44')]=function(_0x436d85,_0xdf797c){return db[_0xc144('0x29')][_0xc144('0x44')](_0x436d85[_0xc144('0x45')],{})[_0xc144('0x20')](respondWithResult(_0xdf797c,0xc9))['catch'](handleError(_0xdf797c,null));};exports[_0xc144('0x1f')]=function(_0x5d48ec,_0x353f9e){if(_0x5d48ec[_0xc144('0x45')]['id']){delete _0x5d48ec[_0xc144('0x45')]['id'];}return db['JscriptyQuestionReport'][_0xc144('0x46')]({'where':{'id':_0x5d48ec[_0xc144('0x41')]['id']}})[_0xc144('0x20')](handleEntityNotFound(_0x353f9e,null))[_0xc144('0x20')](saveUpdates(_0x5d48ec['body'],null))[_0xc144('0x20')](respondWithResult(_0x353f9e,null))[_0xc144('0x43')](handleError(_0x353f9e,null));};exports[_0xc144('0x21')]=function(_0x20ea37,_0x4b1adf){return db[_0xc144('0x29')]['find']({'where':{'id':_0x20ea37[_0xc144('0x41')]['id']}})[_0xc144('0x20')](handleEntityNotFound(_0x4b1adf,null))[_0xc144('0x20')](removeEntity(_0x4b1adf,null))[_0xc144('0x43')](handleError(_0x4b1adf,null));};exports[_0xc144('0x47')]=function(_0x52dbdf,_0x2aee1b){return db['JscriptyQuestionReport'][_0xc144('0x47')]()[_0xc144('0x20')](respondWithResult(_0x2aee1b,null))['catch'](handleError(_0x2aee1b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index f7fe949..6a87fff 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 _0x3c5a=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x271c9c,_0x50a3e8){var _0xfa67ee=function(_0x55d9e3){while(--_0x55d9e3){_0x271c9c['push'](_0x271c9c['shift']());}};_0xfa67ee(++_0x50a3e8);}(_0x3c5a,0x117));var _0xa3c5=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0x3c5a[_0x4667b2];return _0x1070f2;};'use strict';var _=require(_0xa3c5('0x0'));var util=require(_0xa3c5('0x1'));var logger=require('../../config/logger')(_0xa3c5('0x2'));var moment=require(_0xa3c5('0x3'));var BPromise=require(_0xa3c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3c5('0x5'));var rimraf=require(_0xa3c5('0x6'));var config=require(_0xa3c5('0x7'));var attributes=require(_0xa3c5('0x8'));module[_0xa3c5('0x9')]=function(_0x2778e8,_0x183f40){return _0x2778e8[_0xa3c5('0xa')](_0xa3c5('0xb'),attributes,{'tableName':_0xa3c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6585=['define','JscriptyQuestionReport','report_jscripty_questions','util','moment','bluebird','path','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x404d5d,_0x35580d){var _0x490020=function(_0x32fea4){while(--_0x32fea4){_0x404d5d['push'](_0x404d5d['shift']());}};_0x490020(++_0x35580d);}(_0x6585,0x11a));var _0x5658=function(_0x13033f,_0x2045af){_0x13033f=_0x13033f-0x0;var _0x2ed576=_0x6585[_0x13033f];return _0x2ed576;};'use strict';var _=require('lodash');var util=require(_0x5658('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5658('0x1'));var BPromise=require(_0x5658('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5658('0x3'));var rimraf=require('rimraf');var config=require(_0x5658('0x4'));var attributes=require(_0x5658('0x5'));module['exports']=function(_0x21e9f2,_0xb9f00c){return _0x21e9f2[_0x5658('0x6')](_0x5658('0x7'),attributes,{'tableName':_0x5658('0x8'),'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 f02f77e..a7bf6e8 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 _0x39d4=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39d4,0xa0));var _0x439d=function(_0x38a4fc,_0x4f8fdf){_0x38a4fc=_0x38a4fc-0x0;var _0x8a6951=_0x39d4[_0x38a4fc];return _0x8a6951;};'use strict';var _=require(_0x439d('0x0'));var util=require(_0x439d('0x1'));var moment=require(_0x439d('0x2'));var BPromise=require(_0x439d('0x3'));var rs=require(_0x439d('0x4'));var fs=require('fs');var Redis=require(_0x439d('0x5'));var db=require(_0x439d('0x6'))['db'];var utils=require(_0x439d('0x7'));var logger=require('../../config/logger')(_0x439d('0x8'));var config=require(_0x439d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x439d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dd6bd,_0xe44256,_0x570a47){return new BPromise(function(_0x47f1fa,_0x3ff171){return client[_0x439d('0xb')](_0x2dd6bd,_0x570a47)[_0x439d('0xc')](function(_0x47a769){logger[_0x439d('0xd')](_0x439d('0xe'),_0xe44256,_0x439d('0xf'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xe44256,_0x439d('0xf'),JSON[_0x439d('0x10')](_0x47a769));if(_0x47a769[_0x439d('0x11')]){if(_0x47a769['error'][_0x439d('0x12')]===0x1f4){logger['error'](_0x439d('0xe'),_0xe44256,_0x47a769[_0x439d('0x11')]['message']);return _0x3ff171(_0x47a769['error']['message']);}logger[_0x439d('0x11')](_0x439d('0xe'),_0xe44256,_0x47a769[_0x439d('0x11')][_0x439d('0x13')]);return _0x47f1fa(_0x47a769[_0x439d('0x11')]['message']);}else{logger[_0x439d('0xd')](_0x439d('0xe'),_0xe44256,'request\x20sent');_0x47f1fa(_0x47a769[_0x439d('0x14')][_0x439d('0x13')]);}})[_0x439d('0x15')](function(_0x44f3d){logger['error'](_0x439d('0xe'),_0xe44256,_0x44f3d);_0x3ff171(_0x44f3d);});});} \ No newline at end of file +var _0x2960=['info','request\x20sent','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x3c7bb0,_0x1a9fc2){var _0x3944a4=function(_0x3f68fc){while(--_0x3f68fc){_0x3c7bb0['push'](_0x3c7bb0['shift']());}};_0x3944a4(++_0x1a9fc2);}(_0x2960,0xe4));var _0x0296=function(_0x35ec01,_0x5c44ac){_0x35ec01=_0x35ec01-0x0;var _0x4f75d5=_0x2960[_0x35ec01];return _0x4f75d5;};'use strict';var _=require(_0x0296('0x0'));var util=require(_0x0296('0x1'));var moment=require(_0x0296('0x2'));var BPromise=require(_0x0296('0x3'));var rs=require(_0x0296('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0296('0x5'))['db'];var utils=require(_0x0296('0x6'));var logger=require('../../config/logger')(_0x0296('0x7'));var config=require(_0x0296('0x8'));var jayson=require(_0x0296('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6be7c1,_0x10ef7b,_0x2919d6){return new BPromise(function(_0x204fdb,_0x30fd81){return client[_0x0296('0xa')](_0x6be7c1,_0x2919d6)[_0x0296('0xb')](function(_0x57d7bf){logger[_0x0296('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x10ef7b,_0x0296('0xd'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x10ef7b,'request\x20sent',JSON[_0x0296('0xe')](_0x57d7bf));if(_0x57d7bf['error']){if(_0x57d7bf[_0x0296('0xf')]['code']===0x1f4){logger[_0x0296('0xf')](_0x0296('0x10'),_0x10ef7b,_0x57d7bf[_0x0296('0xf')][_0x0296('0x11')]);return _0x30fd81(_0x57d7bf['error'][_0x0296('0x11')]);}logger[_0x0296('0xf')](_0x0296('0x10'),_0x10ef7b,_0x57d7bf[_0x0296('0xf')][_0x0296('0x11')]);return _0x204fdb(_0x57d7bf[_0x0296('0xf')]['message']);}else{logger[_0x0296('0xc')](_0x0296('0x10'),_0x10ef7b,_0x0296('0xd'));_0x204fdb(_0x57d7bf[_0x0296('0x12')]['message']);}})[_0x0296('0x13')](function(_0x38ea9f){logger[_0x0296('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x10ef7b,_0x38ea9f);_0x30fd81(_0x38ea9f);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 35834cf..e7894a4 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 _0x9a68=['create','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','getQuestions','post'];(function(_0x3a63a2,_0x239997){var _0x1be579=function(_0x3d363c){while(--_0x3d363c){_0x3a63a2['push'](_0x3a63a2['shift']());}};_0x1be579(++_0x239997);}(_0x9a68,0x156));var _0x89a6=function(_0x54cc7e,_0x493400){_0x54cc7e=_0x54cc7e-0x0;var _0x5bb3a1=_0x9a68[_0x54cc7e];return _0x5bb3a1;};'use strict';var multer=require('multer');var util=require(_0x89a6('0x0'));var path=require('path');var timeout=require(_0x89a6('0x1'));var express=require(_0x89a6('0x2'));var router=express[_0x89a6('0x3')]();var fs_extra=require(_0x89a6('0x4'));var auth=require(_0x89a6('0x5'));var interaction=require(_0x89a6('0x6'));var config=require(_0x89a6('0x7'));var controller=require(_0x89a6('0x8'));router[_0x89a6('0x9')]('/',auth[_0x89a6('0xa')](),controller[_0x89a6('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x89a6('0xc')]);router[_0x89a6('0x9')]('/:id',auth[_0x89a6('0xa')](),controller['show']);router[_0x89a6('0x9')]('/:id/questions',auth[_0x89a6('0xa')](),controller[_0x89a6('0xd')]);router[_0x89a6('0xe')]('/',auth['isAuthenticated'](),controller[_0x89a6('0xf')]);router['put']('/:id',auth[_0x89a6('0xa')](),controller[_0x89a6('0x10')]);router[_0x89a6('0x11')](_0x89a6('0x12'),auth[_0x89a6('0xa')](),controller[_0x89a6('0x13')]);module[_0x89a6('0x14')]=router; \ No newline at end of file +var _0x569f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','getQuestions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x6692bd,_0x4e37b6){var _0xec1a1c=function(_0x55548){while(--_0x55548){_0x6692bd['push'](_0x6692bd['shift']());}};_0xec1a1c(++_0x4e37b6);}(_0x569f,0xe1));var _0xf569=function(_0x22404e,_0x12caeb){_0x22404e=_0x22404e-0x0;var _0x5fc0f8=_0x569f[_0x22404e];return _0x5fc0f8;};'use strict';var multer=require(_0xf569('0x0'));var util=require(_0xf569('0x1'));var path=require(_0xf569('0x2'));var timeout=require(_0xf569('0x3'));var express=require(_0xf569('0x4'));var router=express[_0xf569('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf569('0x6'));var interaction=require(_0xf569('0x7'));var config=require(_0xf569('0x8'));var controller=require(_0xf569('0x9'));router[_0xf569('0xa')]('/',auth[_0xf569('0xb')](),controller[_0xf569('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf569('0xd')]);router[_0xf569('0xa')](_0xf569('0xe'),auth[_0xf569('0xb')](),controller[_0xf569('0xf')]);router[_0xf569('0xa')]('/:id/questions',auth[_0xf569('0xb')](),controller[_0xf569('0x10')]);router[_0xf569('0x11')]('/',auth[_0xf569('0xb')](),controller[_0xf569('0x12')]);router[_0xf569('0x13')]('/:id',auth[_0xf569('0xb')](),controller[_0xf569('0x14')]);router[_0xf569('0x15')](_0xf569('0xe'),auth[_0xf569('0xb')](),controller[_0xf569('0x16')]);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 8ec815d..c3540da 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 _0x5a2f=['STRING','moment','sequelize','DATE','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x400c46,_0x15ce88){var _0x415d73=function(_0x5a2795){while(--_0x5a2795){_0x400c46['push'](_0x400c46['shift']());}};_0x415d73(++_0x15ce88);}(_0x5a2f,0x9b));var _0xf5a2=function(_0x1667d1,_0x36f7b3){_0x1667d1=_0x1667d1-0x0;var _0x56f5b3=_0x5a2f[_0x1667d1];return _0x56f5b3;};'use strict';var moment=require(_0xf5a2('0x0'));var Sequelize=require(_0xf5a2('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xf5a2('0x2')],'set':function(_0x14e987){this['setDataValue'](_0xf5a2('0x3'),_0x14e987);this['setDataValue'](_0xf5a2('0x4'),moment()['format'](_0xf5a2('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xf5a2('0x6')]},'projectname':{'type':Sequelize[_0xf5a2('0x6')]},'queue':{'type':Sequelize[_0xf5a2('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf5a2('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xeb27=['exports','DATE','setDataValue','starttime','endtime','format','STRING','BOOLEAN','sequelize'];(function(_0x2198b9,_0x21c713){var _0x349089=function(_0x3b8192){while(--_0x3b8192){_0x2198b9['push'](_0x2198b9['shift']());}};_0x349089(++_0x21c713);}(_0xeb27,0x74));var _0x7eb2=function(_0x4a93ae,_0x3c2b04){_0x4a93ae=_0x4a93ae-0x0;var _0x2c12ef=_0xeb27[_0x4a93ae];return _0x2c12ef;};'use strict';var moment=require('moment');var Sequelize=require(_0x7eb2('0x0'));module[_0x7eb2('0x1')]={'starttime':{'type':Sequelize[_0x7eb2('0x2')],'set':function(_0x4a2bb4){this[_0x7eb2('0x3')](_0x7eb2('0x4'),_0x4a2bb4);this['setDataValue'](_0x7eb2('0x5'),moment()[_0x7eb2('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x7eb2('0x2')]},'membername':{'type':Sequelize[_0x7eb2('0x7')]},'projectname':{'type':Sequelize[_0x7eb2('0x7')]},'queue':{'type':Sequelize[_0x7eb2('0x7')]},'uniqueid':{'type':Sequelize[_0x7eb2('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7eb2('0x7')]},'completed':{'type':Sequelize[_0x7eb2('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 3565077..fe74961 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 _0x1520=['end','json','offset','limit','count','set','save','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','JscriptySessionReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','update','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x9e575,_0x5894d4){var _0x522277=function(_0x1f5458){while(--_0x1f5458){_0x9e575['push'](_0x9e575['shift']());}};_0x522277(++_0x5894d4);}(_0x1520,0x128));var _0x0152=function(_0x2216f9,_0x3615dd){_0x2216f9=_0x2216f9-0x0;var _0x570c68=_0x1520[_0x2216f9];return _0x570c68;};'use strict';var emlformat=require(_0x0152('0x0'));var rimraf=require(_0x0152('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0152('0x2'));var rp=require(_0x0152('0x3'));var moment=require(_0x0152('0x4'));var BPromise=require(_0x0152('0x5'));var Mustache=require(_0x0152('0x6'));var util=require(_0x0152('0x7'));var path=require(_0x0152('0x8'));var sox=require(_0x0152('0x9'));var csv=require(_0x0152('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0152('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0152('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0152('0xd'));var toCsv=require(_0x0152('0xa'));var querystring=require(_0x0152('0xe'));var Papa=require(_0x0152('0xf'));var Redis=require(_0x0152('0x10'));var authService=require(_0x0152('0x11'));var qs=require(_0x0152('0x12'));var as=require(_0x0152('0x13'));var hardwareService=require(_0x0152('0x14'));var logger=require(_0x0152('0x15'))('api');var utils=require(_0x0152('0x16'));var config=require(_0x0152('0x17'));var licenseUtil=require(_0x0152('0x18'));var db=require(_0x0152('0x19'))['db'];function respondWithStatusCode(_0x2ead17,_0x2dc49e){_0x2dc49e=_0x2dc49e||0xcc;return function(_0x9be0ac){if(_0x9be0ac){return _0x2ead17[_0x0152('0x1a')](_0x2dc49e);}return _0x2ead17[_0x0152('0x1b')](_0x2dc49e)[_0x0152('0x1c')]();};}function respondWithResult(_0x355ce7,_0x2afd47){_0x2afd47=_0x2afd47||0xc8;return function(_0x47dd5f){if(_0x47dd5f){return _0x355ce7[_0x0152('0x1b')](_0x2afd47)[_0x0152('0x1d')](_0x47dd5f);}};}function respondWithFilteredResult(_0x56043e,_0x2cbfcd){return function(_0x42730b){if(_0x42730b){var _0x45870e=typeof _0x2cbfcd[_0x0152('0x1e')]==='undefined'&&typeof _0x2cbfcd[_0x0152('0x1f')]==='undefined';var _0xbb956e=_0x42730b[_0x0152('0x20')];var _0x2c8427=_0x45870e?0x0:_0x2cbfcd[_0x0152('0x1e')];var _0xbd3e7d=_0x45870e?_0x42730b[_0x0152('0x20')]:_0x2cbfcd[_0x0152('0x1e')]+_0x2cbfcd['limit'];var _0x55be72;if(_0xbd3e7d>=_0xbb956e){_0xbd3e7d=_0xbb956e;_0x55be72=0xc8;}else{_0x55be72=0xce;}_0x56043e['status'](_0x55be72);return _0x56043e[_0x0152('0x21')]('Content-Range',_0x2c8427+'-'+_0xbd3e7d+'/'+_0xbb956e)[_0x0152('0x1d')](_0x42730b);}return null;};}function patchUpdates(_0x194101){return function(_0x329df5){try{jsonpatch['apply'](_0x329df5,_0x194101,!![]);}catch(_0x1f52f8){return BPromise['reject'](_0x1f52f8);}return _0x329df5[_0x0152('0x22')]();};}function saveUpdates(_0xb513c2,_0xa4c584){return function(_0x31068d){if(_0x31068d){return _0x31068d['update'](_0xb513c2)[_0x0152('0x23')](function(_0x38dba4){return _0x38dba4;});}return null;};}function removeEntity(_0x3c9436,_0x5f3dde){return function(_0x9403ee){if(_0x9403ee){return _0x9403ee[_0x0152('0x24')]()[_0x0152('0x23')](function(){_0x3c9436[_0x0152('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c31b,_0x1fc804){return function(_0x4a4112){if(!_0x4a4112){_0x26c31b[_0x0152('0x1a')](0x194);}return _0x4a4112;};}function handleError(_0x44b62c,_0xcec826){_0xcec826=_0xcec826||0x1f4;return function(_0x7b214c){logger['error'](_0x7b214c[_0x0152('0x25')]);if(_0x7b214c['name']){delete _0x7b214c[_0x0152('0x26')];}_0x44b62c[_0x0152('0x1b')](_0xcec826)[_0x0152('0x27')](_0x7b214c);};}exports[_0x0152('0x28')]=function(_0x14b977,_0x4f2e15){var _0x5a4140={},_0x548210={},_0x2db10a={'count':0x0,'rows':[]};var _0x5406ed=_[_0x0152('0x29')](db['JscriptySessionReport']['rawAttributes'],function(_0x5687c0){return{'name':_0x5687c0[_0x0152('0x2a')],'type':_0x5687c0[_0x0152('0x2b')][_0x0152('0x2c')]};});_0x548210[_0x0152('0x2d')]=_[_0x0152('0x29')](_0x5406ed,_0x0152('0x26'));_0x548210[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0x14b977[_0x0152('0x2e')]);_0x548210[_0x0152('0x30')]=_[_0x0152('0x31')](_0x548210[_0x0152('0x2d')],_0x548210[_0x0152('0x2e')]);_0x5a4140[_0x0152('0x32')]=_[_0x0152('0x31')](_0x548210[_0x0152('0x2d')],qs[_0x0152('0x33')](_0x14b977[_0x0152('0x2e')][_0x0152('0x33')]));_0x5a4140[_0x0152('0x32')]=_0x5a4140[_0x0152('0x32')][_0x0152('0x34')]?_0x5a4140['attributes']:_0x548210[_0x0152('0x2d')];if(!_0x14b977[_0x0152('0x2e')][_0x0152('0x35')](_0x0152('0x36'))){_0x5a4140['limit']=qs['limit'](_0x14b977[_0x0152('0x2e')][_0x0152('0x1f')]);_0x5a4140['offset']=qs[_0x0152('0x1e')](_0x14b977['query'][_0x0152('0x1e')]);}_0x5a4140[_0x0152('0x37')]=qs[_0x0152('0x38')](_0x14b977[_0x0152('0x2e')]['sort']);_0x5a4140[_0x0152('0x39')]=qs[_0x0152('0x30')](_[_0x0152('0x3a')](_0x14b977[_0x0152('0x2e')],_0x548210[_0x0152('0x30')]),_0x5406ed);if(_0x14b977[_0x0152('0x2e')][_0x0152('0x3b')]){_0x5a4140[_0x0152('0x39')]=_[_0x0152('0x3c')](_0x5a4140[_0x0152('0x39')],{'$or':_[_0x0152('0x29')](_0x5406ed,function(_0x3d351c){if(_0x3d351c[_0x0152('0x2b')]!==_0x0152('0x3d')){var _0x329fe4={};_0x329fe4[_0x3d351c[_0x0152('0x26')]]={'$like':'%'+_0x14b977['query'][_0x0152('0x3b')]+'%'};return _0x329fe4;}})});}_0x5a4140=_[_0x0152('0x3c')]({},_0x5a4140,_0x14b977['options']);var _0x189a5e={'where':_0x5a4140[_0x0152('0x39')]};return db[_0x0152('0x3e')][_0x0152('0x20')](_0x189a5e)[_0x0152('0x23')](function(_0x205768){_0x2db10a[_0x0152('0x20')]=_0x205768;if(_0x14b977[_0x0152('0x2e')][_0x0152('0x3f')]){_0x5a4140['include']=[{'all':!![]}];}return db[_0x0152('0x3e')][_0x0152('0x40')](_0x5a4140);})['then'](function(_0x4ad5b4){_0x2db10a[_0x0152('0x41')]=_0x4ad5b4;return _0x2db10a;})[_0x0152('0x23')](respondWithFilteredResult(_0x4f2e15,_0x5a4140))[_0x0152('0x42')](handleError(_0x4f2e15,null));};exports[_0x0152('0x43')]=function(_0x46a6f9,_0x1e491e){var _0x406fd7={'raw':!![],'where':{'id':_0x46a6f9[_0x0152('0x44')]['id']}},_0x5822c3={};_0x5822c3[_0x0152('0x2d')]=_[_0x0152('0x2f')](db[_0x0152('0x3e')][_0x0152('0x45')]);_0x5822c3[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0x46a6f9['query']);_0x5822c3[_0x0152('0x30')]=_[_0x0152('0x31')](_0x5822c3['model'],_0x5822c3['query']);_0x406fd7[_0x0152('0x32')]=_[_0x0152('0x31')](_0x5822c3[_0x0152('0x2d')],qs[_0x0152('0x33')](_0x46a6f9[_0x0152('0x2e')][_0x0152('0x33')]));_0x406fd7[_0x0152('0x32')]=_0x406fd7['attributes']['length']?_0x406fd7[_0x0152('0x32')]:_0x5822c3[_0x0152('0x2d')];if(_0x46a6f9[_0x0152('0x2e')]['includeAll']){_0x406fd7[_0x0152('0x46')]=[{'all':!![]}];}_0x406fd7=_[_0x0152('0x3c')]({},_0x406fd7,_0x46a6f9[_0x0152('0x47')]);return db[_0x0152('0x3e')][_0x0152('0x48')](_0x406fd7)['then'](handleEntityNotFound(_0x1e491e,null))[_0x0152('0x23')](respondWithResult(_0x1e491e,null))[_0x0152('0x42')](handleError(_0x1e491e,null));};exports[_0x0152('0x49')]=function(_0x1aa86d,_0x29f607){return db['JscriptySessionReport'][_0x0152('0x49')](_0x1aa86d['body'],{})['then'](respondWithResult(_0x29f607,0xc9))[_0x0152('0x42')](handleError(_0x29f607,null));};exports[_0x0152('0x4a')]=function(_0x4707f3,_0x263fa3){if(_0x4707f3[_0x0152('0x4b')]['id']){delete _0x4707f3[_0x0152('0x4b')]['id'];}return db['JscriptySessionReport'][_0x0152('0x48')]({'where':{'id':_0x4707f3[_0x0152('0x44')]['id']}})[_0x0152('0x23')](handleEntityNotFound(_0x263fa3,null))[_0x0152('0x23')](saveUpdates(_0x4707f3['body'],null))['then'](respondWithResult(_0x263fa3,null))['catch'](handleError(_0x263fa3,null));};exports['destroy']=function(_0x1c8c4e,_0x33b1ef){return db[_0x0152('0x3e')][_0x0152('0x48')]({'where':{'id':_0x1c8c4e['params']['id']}})[_0x0152('0x23')](handleEntityNotFound(_0x33b1ef,null))[_0x0152('0x23')](removeEntity(_0x33b1ef,null))[_0x0152('0x42')](handleError(_0x33b1ef,null));};exports[_0x0152('0x4c')]=function(_0x17eabc,_0x439a09){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x439a09,null))[_0x0152('0x42')](handleError(_0x439a09,null));};exports[_0x0152('0x4d')]=function(_0x502e73,_0x3d591f,_0x59e557){var _0x3d60dd={'raw':!![],'where':{}};var _0x3ca8dd={};var _0x2cf659={'count':0x0,'rows':[]};return db[_0x0152('0x3e')][_0x0152('0x4e')]({'where':{'id':_0x502e73[_0x0152('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d591f,null))[_0x0152('0x23')](function(_0x217d60){if(_0x217d60){_0x3ca8dd[_0x0152('0x2d')]=_[_0x0152('0x2f')](db[_0x0152('0x4f')]['rawAttributes']);_0x3ca8dd[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0x502e73['query']);_0x3ca8dd['filters']=_[_0x0152('0x31')](_0x3ca8dd['model'],_0x3ca8dd['query']);_0x3d60dd['attributes']=_[_0x0152('0x31')](_0x3ca8dd[_0x0152('0x2d')],qs[_0x0152('0x33')](_0x502e73[_0x0152('0x2e')]['fields']));_0x3d60dd[_0x0152('0x32')]=_0x3d60dd[_0x0152('0x32')][_0x0152('0x34')]?_0x3d60dd[_0x0152('0x32')]:_0x3ca8dd[_0x0152('0x2d')];if(!_0x502e73[_0x0152('0x2e')]['hasOwnProperty'](_0x0152('0x36'))){_0x3d60dd[_0x0152('0x1f')]=qs['limit'](_0x502e73[_0x0152('0x2e')][_0x0152('0x1f')]);_0x3d60dd[_0x0152('0x1e')]=qs[_0x0152('0x1e')](_0x502e73[_0x0152('0x2e')][_0x0152('0x1e')]);}_0x3d60dd[_0x0152('0x37')]=qs[_0x0152('0x38')](_0x502e73[_0x0152('0x2e')]['sort']);_0x3d60dd[_0x0152('0x39')]=qs[_0x0152('0x30')](_[_0x0152('0x3a')](_0x502e73['query'],_0x3ca8dd['filters']));_0x3d60dd['where'][_0x0152('0x50')]=_0x217d60['id'];if(_0x502e73[_0x0152('0x2e')][_0x0152('0x3b')]){_0x3d60dd['where']=_['merge'](_0x3d60dd['where'],{'$or':_[_0x0152('0x29')](_0x3d60dd[_0x0152('0x32')],function(_0xec4a6a){var _0x127b1d={};_0x127b1d[_0xec4a6a]={'$like':'%'+_0x502e73[_0x0152('0x2e')][_0x0152('0x3b')]+'%'};return _0x127b1d;})});}_0x3d60dd=_[_0x0152('0x3c')]({},_0x3d60dd,_0x502e73['options']);return db[_0x0152('0x4f')][_0x0152('0x20')]({'where':_0x3d60dd[_0x0152('0x39')]})[_0x0152('0x23')](function(_0x407131){_0x2cf659[_0x0152('0x20')]=_0x407131;if(_0x502e73['query'][_0x0152('0x3f')]){_0x3d60dd[_0x0152('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3d60dd);})[_0x0152('0x23')](function(_0x4a60f2){_0x2cf659[_0x0152('0x41')]=_0x4a60f2;return _0x2cf659;});}})[_0x0152('0x23')](respondWithFilteredResult(_0x3d591f,_0x3d60dd))[_0x0152('0x42')](handleError(_0x3d591f,null));}; \ No newline at end of file +var _0x208e=['fieldName','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','update','describe','getQuestions','findOne','order','SessionId','JscriptyQuestionReport','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','save','destroy','then','sendStatus','index','map','JscriptySessionReport','rawAttributes'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x208e,0x112));var _0xe208=function(_0xee1ec9,_0x2f0599){_0xee1ec9=_0xee1ec9-0x0;var _0x102a53=_0x208e[_0xee1ec9];return _0x102a53;};'use strict';var emlformat=require(_0xe208('0x0'));var rimraf=require(_0xe208('0x1'));var zipdir=require(_0xe208('0x2'));var jsonpatch=require(_0xe208('0x3'));var rp=require(_0xe208('0x4'));var moment=require(_0xe208('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe208('0x6'));var util=require(_0xe208('0x7'));var path=require(_0xe208('0x8'));var sox=require(_0xe208('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe208('0xa'));var squel=require(_0xe208('0xb'));var crypto=require(_0xe208('0xc'));var jsforce=require(_0xe208('0xd'));var deskjs=require(_0xe208('0xe'));var toCsv=require(_0xe208('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe208('0x10'));var authService=require(_0xe208('0x11'));var qs=require(_0xe208('0x12'));var as=require(_0xe208('0x13'));var hardwareService=require(_0xe208('0x14'));var logger=require(_0xe208('0x15'))('api');var utils=require(_0xe208('0x16'));var config=require(_0xe208('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe208('0x18'))['db'];function respondWithStatusCode(_0x3b4100,_0x319abb){_0x319abb=_0x319abb||0xcc;return function(_0x28bcde){if(_0x28bcde){return _0x3b4100['sendStatus'](_0x319abb);}return _0x3b4100[_0xe208('0x19')](_0x319abb)[_0xe208('0x1a')]();};}function respondWithResult(_0x46edfb,_0x2effeb){_0x2effeb=_0x2effeb||0xc8;return function(_0x985345){if(_0x985345){return _0x46edfb[_0xe208('0x19')](_0x2effeb)['json'](_0x985345);}};}function respondWithFilteredResult(_0x1e962b,_0x5bc8cd){return function(_0xa064e4){if(_0xa064e4){var _0x56778e=typeof _0x5bc8cd[_0xe208('0x1b')]==='undefined'&&typeof _0x5bc8cd[_0xe208('0x1c')]===_0xe208('0x1d');var _0x5e46de=_0xa064e4[_0xe208('0x1e')];var _0x449470=_0x56778e?0x0:_0x5bc8cd[_0xe208('0x1b')];var _0x1ca03b=_0x56778e?_0xa064e4[_0xe208('0x1e')]:_0x5bc8cd[_0xe208('0x1b')]+_0x5bc8cd[_0xe208('0x1c')];var _0x29037f;if(_0x1ca03b>=_0x5e46de){_0x1ca03b=_0x5e46de;_0x29037f=0xc8;}else{_0x29037f=0xce;}_0x1e962b['status'](_0x29037f);return _0x1e962b[_0xe208('0x1f')]('Content-Range',_0x449470+'-'+_0x1ca03b+'/'+_0x5e46de)[_0xe208('0x20')](_0xa064e4);}return null;};}function patchUpdates(_0x1e8847){return function(_0x3cd54a){try{jsonpatch[_0xe208('0x21')](_0x3cd54a,_0x1e8847,!![]);}catch(_0x424b25){return BPromise['reject'](_0x424b25);}return _0x3cd54a[_0xe208('0x22')]();};}function saveUpdates(_0x272010,_0x2b10d5){return function(_0x56d092){if(_0x56d092){return _0x56d092['update'](_0x272010)['then'](function(_0x5a84fe){return _0x5a84fe;});}return null;};}function removeEntity(_0x528872,_0x3b30a2){return function(_0x379b54){if(_0x379b54){return _0x379b54[_0xe208('0x23')]()[_0xe208('0x24')](function(){_0x528872[_0xe208('0x19')](0xcc)[_0xe208('0x1a')]();});}};}function handleEntityNotFound(_0x38873a,_0x202e0f){return function(_0x4f4221){if(!_0x4f4221){_0x38873a[_0xe208('0x25')](0x194);}return _0x4f4221;};}function handleError(_0x4079e3,_0x7ce011){_0x7ce011=_0x7ce011||0x1f4;return function(_0xb955c7){logger['error'](_0xb955c7['stack']);if(_0xb955c7['name']){delete _0xb955c7['name'];}_0x4079e3[_0xe208('0x19')](_0x7ce011)['send'](_0xb955c7);};}exports[_0xe208('0x26')]=function(_0x146f41,_0x257118){var _0x1315af={},_0x488ba9={},_0xfec8f6={'count':0x0,'rows':[]};var _0x1f8ac2=_[_0xe208('0x27')](db[_0xe208('0x28')][_0xe208('0x29')],function(_0x17a3ec){return{'name':_0x17a3ec[_0xe208('0x2a')],'type':_0x17a3ec[_0xe208('0x2b')]['key']};});_0x488ba9['model']=_[_0xe208('0x27')](_0x1f8ac2,_0xe208('0x2c'));_0x488ba9[_0xe208('0x2d')]=_['keys'](_0x146f41['query']);_0x488ba9[_0xe208('0x2e')]=_[_0xe208('0x2f')](_0x488ba9[_0xe208('0x30')],_0x488ba9['query']);_0x1315af[_0xe208('0x31')]=_['intersection'](_0x488ba9[_0xe208('0x30')],qs[_0xe208('0x32')](_0x146f41[_0xe208('0x2d')][_0xe208('0x32')]));_0x1315af[_0xe208('0x31')]=_0x1315af['attributes'][_0xe208('0x33')]?_0x1315af[_0xe208('0x31')]:_0x488ba9[_0xe208('0x30')];if(!_0x146f41[_0xe208('0x2d')][_0xe208('0x34')](_0xe208('0x35'))){_0x1315af[_0xe208('0x1c')]=qs[_0xe208('0x1c')](_0x146f41['query'][_0xe208('0x1c')]);_0x1315af['offset']=qs[_0xe208('0x1b')](_0x146f41[_0xe208('0x2d')]['offset']);}_0x1315af['order']=qs['sort'](_0x146f41[_0xe208('0x2d')][_0xe208('0x36')]);_0x1315af[_0xe208('0x37')]=qs['filters'](_[_0xe208('0x38')](_0x146f41[_0xe208('0x2d')],_0x488ba9[_0xe208('0x2e')]),_0x1f8ac2);if(_0x146f41[_0xe208('0x2d')]['filter']){_0x1315af['where']=_[_0xe208('0x39')](_0x1315af['where'],{'$or':_[_0xe208('0x27')](_0x1f8ac2,function(_0x5dc4a5){if(_0x5dc4a5[_0xe208('0x2b')]!==_0xe208('0x3a')){var _0x504ca0={};_0x504ca0[_0x5dc4a5['name']]={'$like':'%'+_0x146f41[_0xe208('0x2d')][_0xe208('0x3b')]+'%'};return _0x504ca0;}})});}_0x1315af=_[_0xe208('0x39')]({},_0x1315af,_0x146f41[_0xe208('0x3c')]);var _0x537305={'where':_0x1315af[_0xe208('0x37')]};return db[_0xe208('0x28')][_0xe208('0x1e')](_0x537305)[_0xe208('0x24')](function(_0x17034c){_0xfec8f6['count']=_0x17034c;if(_0x146f41[_0xe208('0x2d')][_0xe208('0x3d')]){_0x1315af[_0xe208('0x3e')]=[{'all':!![]}];}return db[_0xe208('0x28')][_0xe208('0x3f')](_0x1315af);})[_0xe208('0x24')](function(_0x32888c){_0xfec8f6['rows']=_0x32888c;return _0xfec8f6;})[_0xe208('0x24')](respondWithFilteredResult(_0x257118,_0x1315af))['catch'](handleError(_0x257118,null));};exports[_0xe208('0x40')]=function(_0x4b5ba6,_0x4887bd){var _0x33d159={'raw':!![],'where':{'id':_0x4b5ba6[_0xe208('0x41')]['id']}},_0x348640={};_0x348640[_0xe208('0x30')]=_[_0xe208('0x42')](db[_0xe208('0x28')][_0xe208('0x29')]);_0x348640[_0xe208('0x2d')]=_[_0xe208('0x42')](_0x4b5ba6['query']);_0x348640[_0xe208('0x2e')]=_[_0xe208('0x2f')](_0x348640['model'],_0x348640[_0xe208('0x2d')]);_0x33d159['attributes']=_[_0xe208('0x2f')](_0x348640[_0xe208('0x30')],qs[_0xe208('0x32')](_0x4b5ba6[_0xe208('0x2d')][_0xe208('0x32')]));_0x33d159[_0xe208('0x31')]=_0x33d159[_0xe208('0x31')]['length']?_0x33d159[_0xe208('0x31')]:_0x348640[_0xe208('0x30')];if(_0x4b5ba6[_0xe208('0x2d')][_0xe208('0x3d')]){_0x33d159[_0xe208('0x3e')]=[{'all':!![]}];}_0x33d159=_[_0xe208('0x39')]({},_0x33d159,_0x4b5ba6[_0xe208('0x3c')]);return db[_0xe208('0x28')][_0xe208('0x43')](_0x33d159)['then'](handleEntityNotFound(_0x4887bd,null))[_0xe208('0x24')](respondWithResult(_0x4887bd,null))[_0xe208('0x44')](handleError(_0x4887bd,null));};exports[_0xe208('0x45')]=function(_0x4d30eb,_0x1d0c0){return db[_0xe208('0x28')][_0xe208('0x45')](_0x4d30eb[_0xe208('0x46')],{})[_0xe208('0x24')](respondWithResult(_0x1d0c0,0xc9))[_0xe208('0x44')](handleError(_0x1d0c0,null));};exports[_0xe208('0x47')]=function(_0x2fc7c2,_0x29b64e){if(_0x2fc7c2[_0xe208('0x46')]['id']){delete _0x2fc7c2['body']['id'];}return db[_0xe208('0x28')]['find']({'where':{'id':_0x2fc7c2[_0xe208('0x41')]['id']}})[_0xe208('0x24')](handleEntityNotFound(_0x29b64e,null))[_0xe208('0x24')](saveUpdates(_0x2fc7c2[_0xe208('0x46')],null))[_0xe208('0x24')](respondWithResult(_0x29b64e,null))['catch'](handleError(_0x29b64e,null));};exports[_0xe208('0x23')]=function(_0xa6efd1,_0x3372a8){return db[_0xe208('0x28')][_0xe208('0x43')]({'where':{'id':_0xa6efd1['params']['id']}})[_0xe208('0x24')](handleEntityNotFound(_0x3372a8,null))[_0xe208('0x24')](removeEntity(_0x3372a8,null))[_0xe208('0x44')](handleError(_0x3372a8,null));};exports['describe']=function(_0x3d74f4,_0x26309f){return db[_0xe208('0x28')][_0xe208('0x48')]()[_0xe208('0x24')](respondWithResult(_0x26309f,null))['catch'](handleError(_0x26309f,null));};exports[_0xe208('0x49')]=function(_0x1ab44d,_0x4446de,_0x2d0d64){var _0x3de9f0={'raw':!![],'where':{}};var _0x3ae450={};var _0x5d853c={'count':0x0,'rows':[]};return db[_0xe208('0x28')][_0xe208('0x4a')]({'where':{'id':_0x1ab44d['params']['id']}})[_0xe208('0x24')](handleEntityNotFound(_0x4446de,null))[_0xe208('0x24')](function(_0x530c51){if(_0x530c51){_0x3ae450['model']=_[_0xe208('0x42')](db['JscriptyQuestionReport'][_0xe208('0x29')]);_0x3ae450['query']=_[_0xe208('0x42')](_0x1ab44d['query']);_0x3ae450[_0xe208('0x2e')]=_[_0xe208('0x2f')](_0x3ae450[_0xe208('0x30')],_0x3ae450['query']);_0x3de9f0[_0xe208('0x31')]=_[_0xe208('0x2f')](_0x3ae450['model'],qs[_0xe208('0x32')](_0x1ab44d[_0xe208('0x2d')]['fields']));_0x3de9f0[_0xe208('0x31')]=_0x3de9f0[_0xe208('0x31')][_0xe208('0x33')]?_0x3de9f0['attributes']:_0x3ae450[_0xe208('0x30')];if(!_0x1ab44d[_0xe208('0x2d')][_0xe208('0x34')](_0xe208('0x35'))){_0x3de9f0[_0xe208('0x1c')]=qs['limit'](_0x1ab44d[_0xe208('0x2d')][_0xe208('0x1c')]);_0x3de9f0[_0xe208('0x1b')]=qs[_0xe208('0x1b')](_0x1ab44d[_0xe208('0x2d')][_0xe208('0x1b')]);}_0x3de9f0[_0xe208('0x4b')]=qs[_0xe208('0x36')](_0x1ab44d[_0xe208('0x2d')][_0xe208('0x36')]);_0x3de9f0[_0xe208('0x37')]=qs[_0xe208('0x2e')](_[_0xe208('0x38')](_0x1ab44d['query'],_0x3ae450[_0xe208('0x2e')]));_0x3de9f0[_0xe208('0x37')][_0xe208('0x4c')]=_0x530c51['id'];if(_0x1ab44d[_0xe208('0x2d')][_0xe208('0x3b')]){_0x3de9f0[_0xe208('0x37')]=_[_0xe208('0x39')](_0x3de9f0[_0xe208('0x37')],{'$or':_[_0xe208('0x27')](_0x3de9f0['attributes'],function(_0x29933c){var _0x313e6a={};_0x313e6a[_0x29933c]={'$like':'%'+_0x1ab44d[_0xe208('0x2d')][_0xe208('0x3b')]+'%'};return _0x313e6a;})});}_0x3de9f0=_[_0xe208('0x39')]({},_0x3de9f0,_0x1ab44d[_0xe208('0x3c')]);return db[_0xe208('0x4d')]['count']({'where':_0x3de9f0[_0xe208('0x37')]})[_0xe208('0x24')](function(_0x418682){_0x5d853c[_0xe208('0x1e')]=_0x418682;if(_0x1ab44d[_0xe208('0x2d')][_0xe208('0x3d')]){_0x3de9f0[_0xe208('0x3e')]=[{'all':!![]}];}return db[_0xe208('0x4d')][_0xe208('0x3f')](_0x3de9f0);})[_0xe208('0x24')](function(_0x1b165a){_0x5d853c[_0xe208('0x4e')]=_0x1b165a;return _0x5d853c;});}})[_0xe208('0x24')](respondWithFilteredResult(_0x4446de,_0x3de9f0))[_0xe208('0x44')](handleError(_0x4446de,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 48d9334..3d7a99f 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 _0x7bd0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x30920a,_0x29e5b3){var _0x37fa1c=function(_0x3476d2){while(--_0x3476d2){_0x30920a['push'](_0x30920a['shift']());}};_0x37fa1c(++_0x29e5b3);}(_0x7bd0,0x111));var _0x07bd=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x7bd0[_0x591cfd];return _0x4d0100;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var logger=require(_0x07bd('0x2'))(_0x07bd('0x3'));var moment=require(_0x07bd('0x4'));var BPromise=require(_0x07bd('0x5'));var rp=require(_0x07bd('0x6'));var fs=require('fs');var path=require(_0x07bd('0x7'));var rimraf=require('rimraf');var config=require(_0x07bd('0x8'));var attributes=require(_0x07bd('0x9'));module[_0x07bd('0xa')]=function(_0x313548,_0x3e8349){return _0x313548[_0x07bd('0xb')](_0x07bd('0xc'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x46ed,0x168));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 304c79a..f86dbf8 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 _0x32b6=['JscriptySessionReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0x4f2498,_0x6428e1){var _0xe9a958=function(_0x174154){while(--_0x174154){_0x4f2498['push'](_0x4f2498['shift']());}};_0xe9a958(++_0x6428e1);}(_0x32b6,0x1d1));var _0x632b=function(_0x3737cb,_0x5a639f){_0x3737cb=_0x3737cb-0x0;var _0x3564be=_0x32b6[_0x3737cb];return _0x3564be;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});} \ No newline at end of file +var _0x32f4=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x5eae84,_0x193d5e){var _0x5b44cc=function(_0x501640){while(--_0x501640){_0x5eae84['push'](_0x5eae84['shift']());}};_0x5b44cc(++_0x193d5e);}(_0x32f4,0x154));var _0x432f=function(_0x27ac9c,_0x50f44c){_0x27ac9c=_0x27ac9c-0x0;var _0x2ce715=_0x32f4[_0x27ac9c];return _0x2ce715;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ac5ae6a..da1d3d9 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 _0x10b8=['../../config/environment','get','index','put','/:id','isAuthenticated','update','/download_log_file','exports','multer','path','Router','fs-extra'];(function(_0x23363a,_0x10f9c3){var _0x40b369=function(_0x109f13){while(--_0x109f13){_0x23363a['push'](_0x23363a['shift']());}};_0x40b369(++_0x10f9c3);}(_0x10b8,0x1b6));var _0x810b=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x10b8[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x810b('0x0'));var util=require('util');var path=require(_0x810b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x810b('0x2')]();var fs_extra=require(_0x810b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x810b('0x4'));var controller=require('./license.controller');router[_0x810b('0x5')]('/',controller[_0x810b('0x6')]);router[_0x810b('0x7')](_0x810b('0x8'),auth[_0x810b('0x9')](),controller[_0x810b('0xa')]);router[_0x810b('0x5')](_0x810b('0xb'),auth[_0x810b('0x9')](),controller['downloadLogFile']);module[_0x810b('0xc')]=router; \ No newline at end of file +var _0x5ac6=['../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update','/download_log_file','util','path','connect-timeout','../../components/auth/service'];(function(_0x4d3cef,_0x5b2267){var _0x2377ae=function(_0x4abd25){while(--_0x4abd25){_0x4d3cef['push'](_0x4d3cef['shift']());}};_0x2377ae(++_0x5b2267);}(_0x5ac6,0x194));var _0x65ac=function(_0x39f9a4,_0x8ac964){_0x39f9a4=_0x39f9a4-0x0;var _0x3c83c2=_0x5ac6[_0x39f9a4];return _0x3c83c2;};'use strict';var multer=require('multer');var util=require(_0x65ac('0x0'));var path=require(_0x65ac('0x1'));var timeout=require(_0x65ac('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x65ac('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x65ac('0x4'));var controller=require(_0x65ac('0x5'));router[_0x65ac('0x6')]('/',controller[_0x65ac('0x7')]);router['put'](_0x65ac('0x8'),auth[_0x65ac('0x9')](),controller[_0x65ac('0xa')]);router[_0x65ac('0x6')](_0x65ac('0xb'),auth[_0x65ac('0x9')](),controller['downloadLogFile']);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 5cf56cd..ab2606b 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 _0x5292=['sequelize','TEXT','STRING'];(function(_0x25f797,_0x449916){var _0x157fdd=function(_0x329fe1){while(--_0x329fe1){_0x25f797['push'](_0x25f797['shift']());}};_0x157fdd(++_0x449916);}(_0x5292,0x9c));var _0x2529=function(_0x42c5a2,_0x38a2b9){_0x42c5a2=_0x42c5a2-0x0;var _0xbaf6e1=_0x5292[_0x42c5a2];return _0xbaf6e1;};'use strict';var Sequelize=require(_0x2529('0x0'));module['exports']={'license':{'type':Sequelize[_0x2529('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x2529('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa37c=['STRING','sequelize','exports'];(function(_0x2aa639,_0x1f0504){var _0x489951=function(_0x28c760){while(--_0x28c760){_0x2aa639['push'](_0x2aa639['shift']());}};_0x489951(++_0x1f0504);}(_0xa37c,0x1bd));var _0xca37=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xa37c[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0xca37('0x0'));module[_0xca37('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xca37('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 f1b89be..4081270 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 _0x68bd=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','license-info.log','join','/var','Content-disposition','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x68bd,0x182));var _0xd68b=function(_0x25390b,_0x1771ca){_0x25390b=_0x25390b-0x0;var _0x490180=_0x68bd[_0x25390b];return _0x490180;};'use strict';var emlformat=require(_0xd68b('0x0'));var rimraf=require(_0xd68b('0x1'));var zipdir=require(_0xd68b('0x2'));var jsonpatch=require(_0xd68b('0x3'));var rp=require(_0xd68b('0x4'));var moment=require('moment');var BPromise=require(_0xd68b('0x5'));var Mustache=require(_0xd68b('0x6'));var util=require('util');var path=require(_0xd68b('0x7'));var sox=require(_0xd68b('0x8'));var csv=require(_0xd68b('0x9'));var ejs=require(_0xd68b('0xa'));var fs=require('fs');var fs_extra=require(_0xd68b('0xb'));var _=require(_0xd68b('0xc'));var squel=require(_0xd68b('0xd'));var crypto=require('crypto');var jsforce=require(_0xd68b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd68b('0x9'));var querystring=require(_0xd68b('0xf'));var Papa=require('papaparse');var Redis=require(_0xd68b('0x10'));var authService=require(_0xd68b('0x11'));var qs=require(_0xd68b('0x12'));var as=require(_0xd68b('0x13'));var hardwareService=require(_0xd68b('0x14'));var logger=require(_0xd68b('0x15'))('api');var utils=require(_0xd68b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd68b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c804a,_0x38b8f3){_0x38b8f3=_0x38b8f3||0xcc;return function(_0x2ac7d6){if(_0x2ac7d6){return _0x5c804a[_0xd68b('0x18')](_0x38b8f3);}return _0x5c804a['status'](_0x38b8f3)[_0xd68b('0x19')]();};}function respondWithResult(_0x40d684,_0x796d6){_0x796d6=_0x796d6||0xc8;return function(_0x33ab53){if(_0x33ab53){return _0x40d684['status'](_0x796d6)[_0xd68b('0x1a')](_0x33ab53);}};}function respondWithFilteredResult(_0x7a4e3a,_0x3652c6){return function(_0xaf6faa){if(_0xaf6faa){var _0x392422=typeof _0x3652c6[_0xd68b('0x1b')]===_0xd68b('0x1c')&&typeof _0x3652c6[_0xd68b('0x1d')]==='undefined';var _0x453904=_0xaf6faa[_0xd68b('0x1e')];var _0xd94580=_0x392422?0x0:_0x3652c6[_0xd68b('0x1b')];var _0x8e2a14=_0x392422?_0xaf6faa[_0xd68b('0x1e')]:_0x3652c6['offset']+_0x3652c6[_0xd68b('0x1d')];var _0x7add2;if(_0x8e2a14>=_0x453904){_0x8e2a14=_0x453904;_0x7add2=0xc8;}else{_0x7add2=0xce;}_0x7a4e3a[_0xd68b('0x1f')](_0x7add2);return _0x7a4e3a[_0xd68b('0x20')](_0xd68b('0x21'),_0xd94580+'-'+_0x8e2a14+'/'+_0x453904)['json'](_0xaf6faa);}return null;};}function patchUpdates(_0x154d95){return function(_0x86d1a){try{jsonpatch[_0xd68b('0x22')](_0x86d1a,_0x154d95,!![]);}catch(_0x57e285){return BPromise['reject'](_0x57e285);}return _0x86d1a[_0xd68b('0x23')]();};}function saveUpdates(_0xceba03,_0x21442b){return function(_0x466382){if(_0x466382){return _0x466382[_0xd68b('0x24')](_0xceba03)[_0xd68b('0x25')](function(_0x5de3a6){return _0x5de3a6;});}return null;};}function removeEntity(_0x169e06,_0xf0d810){return function(_0x3b0f2a){if(_0x3b0f2a){return _0x3b0f2a[_0xd68b('0x26')]()[_0xd68b('0x25')](function(){_0x169e06[_0xd68b('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4357d0,_0x2f8dbd){return function(_0x1c62eb){if(!_0x1c62eb){_0x4357d0['sendStatus'](0x194);}return _0x1c62eb;};}function handleError(_0x3f6adf,_0x121ac0){_0x121ac0=_0x121ac0||0x1f4;return function(_0x127eda){logger['error'](_0x127eda['stack']);if(_0x127eda[_0xd68b('0x27')]){delete _0x127eda[_0xd68b('0x27')];}_0x3f6adf[_0xd68b('0x1f')](_0x121ac0)[_0xd68b('0x28')](_0x127eda);};}var utilLicense=require('../../config/license/util');exports[_0xd68b('0x29')]=function(_0xd971f7,_0x20e373){var _0x135f03={'raw':!![],'where':{'id':0x1}},_0x32de24={};_0x32de24[_0xd68b('0x2a')]=_[_0xd68b('0x2b')](db[_0xd68b('0x2c')][_0xd68b('0x2d')]);_0x32de24[_0xd68b('0x2e')]=_[_0xd68b('0x2b')](_0xd971f7[_0xd68b('0x2e')]);_0x32de24[_0xd68b('0x2f')]=_[_0xd68b('0x30')](_0x32de24[_0xd68b('0x2a')],_0x32de24[_0xd68b('0x2e')]);_0x135f03[_0xd68b('0x31')]=_[_0xd68b('0x30')](_0x32de24['model'],qs[_0xd68b('0x32')](_0xd971f7[_0xd68b('0x2e')]['fields']));_0x135f03[_0xd68b('0x31')]=_0x135f03[_0xd68b('0x31')][_0xd68b('0x33')]?_0x135f03[_0xd68b('0x31')]:_0x32de24[_0xd68b('0x2a')];_0x135f03=_[_0xd68b('0x34')]({},_0x135f03,_0xd971f7[_0xd68b('0x35')]);return utilLicense[_0xd68b('0x36')](_0x135f03)[_0xd68b('0x25')](respondWithResult(_0x20e373,null))[_0xd68b('0x37')](handleError(_0x20e373,null));};exports[_0xd68b('0x24')]=function(_0x152886,_0x25f0f3){if(_0x152886[_0xd68b('0x38')]['id']){delete _0x152886['body']['id'];}return db[_0xd68b('0x2c')][_0xd68b('0x39')]({'where':{'id':_0x152886['params']['id']}})[_0xd68b('0x25')](handleEntityNotFound(_0x25f0f3,null))[_0xd68b('0x25')](function(_0x46f649){var _0x1d98e2=_0x46f649[_0xd68b('0x3a')]({'plain':!![]});return utilLicense[_0xd68b('0x3b')](_0x1d98e2,_0x152886['body']['key']);})[_0xd68b('0x25')](function(_0x58f04b){if(!_0x58f04b['demo']){return saveUpdates(_0x152886[_0xd68b('0x38')],null);}return _0x58f04b;})[_0xd68b('0x25')](respondWithResult(_0x25f0f3,null))[_0xd68b('0x37')](handleError(_0x25f0f3,null));};exports['downloadLogFile']=function(_0x38b204,_0x37d953){var _0x525cf3=_0xd68b('0x3c');var _0x1a4c20=path[_0xd68b('0x3d')](_0xd68b('0x3e'),'log','xcally',_0x525cf3);_0x37d953['setHeader'](_0xd68b('0x3f'),'attachment;\x20filename='+_0x525cf3);_0x37d953[_0xd68b('0x20')](_0xd68b('0x40'),_0xd68b('0x41'));_0x37d953[_0xd68b('0x42')](_0x1a4c20);}; \ No newline at end of file +var _0x1b41=['text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','../../config/license/util','index','keys','License','query','filters','intersection','model','attributes','fields','options','getLicense','body','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','attachment;\x20filename='];(function(_0x46355a,_0x18ba99){var _0x21d349=function(_0x163fd8){while(--_0x163fd8){_0x46355a['push'](_0x46355a['shift']());}};_0x21d349(++_0x18ba99);}(_0x1b41,0x1a6));var _0x11b4=function(_0x1c5385,_0x3aba1a){_0x1c5385=_0x1c5385-0x0;var _0x478ddb=_0x1b41[_0x1c5385];return _0x478ddb;};'use strict';var emlformat=require(_0x11b4('0x0'));var rimraf=require(_0x11b4('0x1'));var zipdir=require(_0x11b4('0x2'));var jsonpatch=require(_0x11b4('0x3'));var rp=require(_0x11b4('0x4'));var moment=require(_0x11b4('0x5'));var BPromise=require(_0x11b4('0x6'));var Mustache=require(_0x11b4('0x7'));var util=require('util');var path=require(_0x11b4('0x8'));var sox=require('sox');var csv=require(_0x11b4('0x9'));var ejs=require(_0x11b4('0xa'));var fs=require('fs');var fs_extra=require(_0x11b4('0xb'));var _=require('lodash');var squel=require(_0x11b4('0xc'));var crypto=require(_0x11b4('0xd'));var jsforce=require(_0x11b4('0xe'));var deskjs=require(_0x11b4('0xf'));var toCsv=require(_0x11b4('0x9'));var querystring=require(_0x11b4('0x10'));var Papa=require(_0x11b4('0x11'));var Redis=require(_0x11b4('0x12'));var authService=require(_0x11b4('0x13'));var qs=require(_0x11b4('0x14'));var as=require(_0x11b4('0x15'));var hardwareService=require(_0x11b4('0x16'));var logger=require('../../config/logger')(_0x11b4('0x17'));var utils=require(_0x11b4('0x18'));var config=require(_0x11b4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x11b4('0x1a'))['db'];function respondWithStatusCode(_0x5a9cee,_0x4202cc){_0x4202cc=_0x4202cc||0xcc;return function(_0x57ec17){if(_0x57ec17){return _0x5a9cee[_0x11b4('0x1b')](_0x4202cc);}return _0x5a9cee[_0x11b4('0x1c')](_0x4202cc)[_0x11b4('0x1d')]();};}function respondWithResult(_0x31ad37,_0x4dc1d5){_0x4dc1d5=_0x4dc1d5||0xc8;return function(_0x5a64c5){if(_0x5a64c5){return _0x31ad37[_0x11b4('0x1c')](_0x4dc1d5)[_0x11b4('0x1e')](_0x5a64c5);}};}function respondWithFilteredResult(_0x1a4837,_0x5a33e7){return function(_0x752212){if(_0x752212){var _0x58f76c=typeof _0x5a33e7['offset']===_0x11b4('0x1f')&&typeof _0x5a33e7[_0x11b4('0x20')]===_0x11b4('0x1f');var _0x4833dc=_0x752212[_0x11b4('0x21')];var _0x255efd=_0x58f76c?0x0:_0x5a33e7[_0x11b4('0x22')];var _0x1d6c38=_0x58f76c?_0x752212[_0x11b4('0x21')]:_0x5a33e7[_0x11b4('0x22')]+_0x5a33e7[_0x11b4('0x20')];var _0x5d5681;if(_0x1d6c38>=_0x4833dc){_0x1d6c38=_0x4833dc;_0x5d5681=0xc8;}else{_0x5d5681=0xce;}_0x1a4837[_0x11b4('0x1c')](_0x5d5681);return _0x1a4837[_0x11b4('0x23')](_0x11b4('0x24'),_0x255efd+'-'+_0x1d6c38+'/'+_0x4833dc)[_0x11b4('0x1e')](_0x752212);}return null;};}function patchUpdates(_0x13a9b0){return function(_0x38df73){try{jsonpatch[_0x11b4('0x25')](_0x38df73,_0x13a9b0,!![]);}catch(_0x3677e4){return BPromise[_0x11b4('0x26')](_0x3677e4);}return _0x38df73['save']();};}function saveUpdates(_0x1547cc,_0x4b7766){return function(_0x3df1b8){if(_0x3df1b8){return _0x3df1b8[_0x11b4('0x27')](_0x1547cc)[_0x11b4('0x28')](function(_0x58fe7e){return _0x58fe7e;});}return null;};}function removeEntity(_0x1c95b3,_0x34a7ec){return function(_0x5ae954){if(_0x5ae954){return _0x5ae954['destroy']()[_0x11b4('0x28')](function(){_0x1c95b3[_0x11b4('0x1c')](0xcc)[_0x11b4('0x1d')]();});}};}function handleEntityNotFound(_0x3a9926,_0x584c4f){return function(_0x221537){if(!_0x221537){_0x3a9926['sendStatus'](0x194);}return _0x221537;};}function handleError(_0x4aea91,_0x544bfc){_0x544bfc=_0x544bfc||0x1f4;return function(_0x40592a){logger[_0x11b4('0x29')](_0x40592a['stack']);if(_0x40592a['name']){delete _0x40592a['name'];}_0x4aea91['status'](_0x544bfc)['send'](_0x40592a);};}var utilLicense=require(_0x11b4('0x2a'));exports[_0x11b4('0x2b')]=function(_0x3453fe,_0x1874db){var _0x4955b8={'raw':!![],'where':{'id':0x1}},_0x3c9801={};_0x3c9801['model']=_[_0x11b4('0x2c')](db[_0x11b4('0x2d')]['rawAttributes']);_0x3c9801[_0x11b4('0x2e')]=_[_0x11b4('0x2c')](_0x3453fe[_0x11b4('0x2e')]);_0x3c9801[_0x11b4('0x2f')]=_[_0x11b4('0x30')](_0x3c9801[_0x11b4('0x31')],_0x3c9801[_0x11b4('0x2e')]);_0x4955b8[_0x11b4('0x32')]=_[_0x11b4('0x30')](_0x3c9801[_0x11b4('0x31')],qs[_0x11b4('0x33')](_0x3453fe[_0x11b4('0x2e')][_0x11b4('0x33')]));_0x4955b8[_0x11b4('0x32')]=_0x4955b8[_0x11b4('0x32')]['length']?_0x4955b8[_0x11b4('0x32')]:_0x3c9801['model'];_0x4955b8=_['merge']({},_0x4955b8,_0x3453fe[_0x11b4('0x34')]);return utilLicense[_0x11b4('0x35')](_0x4955b8)[_0x11b4('0x28')](respondWithResult(_0x1874db,null))['catch'](handleError(_0x1874db,null));};exports['update']=function(_0x361ed2,_0x20e98a){if(_0x361ed2[_0x11b4('0x36')]['id']){delete _0x361ed2[_0x11b4('0x36')]['id'];}return db[_0x11b4('0x2d')]['find']({'where':{'id':_0x361ed2[_0x11b4('0x37')]['id']}})['then'](handleEntityNotFound(_0x20e98a,null))[_0x11b4('0x28')](function(_0x3230c0){var _0x5a5997=_0x3230c0[_0x11b4('0x38')]({'plain':!![]});return utilLicense[_0x11b4('0x39')](_0x5a5997,_0x361ed2[_0x11b4('0x36')][_0x11b4('0x3a')]);})[_0x11b4('0x28')](function(_0xb465f7){if(!_0xb465f7[_0x11b4('0x3b')]){return saveUpdates(_0x361ed2[_0x11b4('0x36')],null);}return _0xb465f7;})[_0x11b4('0x28')](respondWithResult(_0x20e98a,null))['catch'](handleError(_0x20e98a,null));};exports[_0x11b4('0x3c')]=function(_0x654b46,_0x278b5c){var _0x4e4729=_0x11b4('0x3d');var _0xda911e=path[_0x11b4('0x3e')](_0x11b4('0x3f'),_0x11b4('0x40'),_0x11b4('0x41'),_0x4e4729);_0x278b5c[_0x11b4('0x42')]('Content-disposition',_0x11b4('0x43')+_0x4e4729);_0x278b5c[_0x11b4('0x23')]('Content-Type',_0x11b4('0x44'));_0x278b5c[_0x11b4('0x45')](_0xda911e);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d757dc2..581482e 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 _0xdf32=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','License','license'];(function(_0x50b3f3,_0x1824d2){var _0x14774a=function(_0x1cf14a){while(--_0x1cf14a){_0x50b3f3['push'](_0x50b3f3['shift']());}};_0x14774a(++_0x1824d2);}(_0xdf32,0x1a4));var _0x2df3=function(_0x2dca4b,_0x39971f){_0x2dca4b=_0x2dca4b-0x0;var _0x6ef9a4=_0xdf32[_0x2dca4b];return _0x6ef9a4;};'use strict';var _=require(_0x2df3('0x0'));var util=require('util');var logger=require(_0x2df3('0x1'))(_0x2df3('0x2'));var moment=require(_0x2df3('0x3'));var BPromise=require(_0x2df3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2df3('0x5'));var rimraf=require(_0x2df3('0x6'));var config=require(_0x2df3('0x7'));var attributes=require('./license.attributes');module[_0x2df3('0x8')]=function(_0xc56994,_0x35301d){return _0xc56994[_0x2df3('0x9')](_0x2df3('0xa'),attributes,{'tableName':_0x2df3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f66=['request-promise','../../config/environment','./license.attributes','exports','License','lodash','util','../../config/logger','api'];(function(_0x287568,_0x30cf59){var _0x1a7a5d=function(_0x4a2ea8){while(--_0x4a2ea8){_0x287568['push'](_0x287568['shift']());}};_0x1a7a5d(++_0x30cf59);}(_0x0f66,0x12e));var _0x60f6=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x0f66[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x60f6('0x0'));var util=require(_0x60f6('0x1'));var logger=require(_0x60f6('0x2'))(_0x60f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x60f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x60f6('0x5'));var attributes=require(_0x60f6('0x6'));module[_0x60f6('0x7')]=function(_0x1ec31c,_0x16efff){return _0x1ec31c['define'](_0x60f6('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index adb4e28..cf50056 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 _0xae1f=['info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then'];(function(_0x2b62c8,_0x36c80b){var _0x569ebb=function(_0x1f2f37){while(--_0x1f2f37){_0x2b62c8['push'](_0x2b62c8['shift']());}};_0x569ebb(++_0x36c80b);}(_0xae1f,0x15f));var _0xfae1=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xae1f[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xfae1('0x0'));var util=require(_0xfae1('0x1'));var moment=require(_0xfae1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfae1('0x3'));var db=require(_0xfae1('0x4'))['db'];var utils=require(_0xfae1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfae1('0x6'));var client=jayson[_0xfae1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x425165,_0x4eced4,_0x33b40e){return new BPromise(function(_0x25684d,_0x53350e){return client[_0xfae1('0x8')](_0x425165,_0x33b40e)[_0xfae1('0x9')](function(_0x53145f){logger[_0xfae1('0xa')](_0xfae1('0xb'),_0x4eced4,_0xfae1('0xc'));logger[_0xfae1('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x4eced4,_0xfae1('0xc'),JSON[_0xfae1('0xe')](_0x53145f));if(_0x53145f[_0xfae1('0xf')]){if(_0x53145f[_0xfae1('0xf')][_0xfae1('0x10')]===0x1f4){logger[_0xfae1('0xf')]('License,\x20%s,\x20%s',_0x4eced4,_0x53145f[_0xfae1('0xf')][_0xfae1('0x11')]);return _0x53350e(_0x53145f['error']['message']);}logger[_0xfae1('0xf')](_0xfae1('0xb'),_0x4eced4,_0x53145f[_0xfae1('0xf')][_0xfae1('0x11')]);return _0x25684d(_0x53145f[_0xfae1('0xf')][_0xfae1('0x11')]);}else{logger['info']('License,\x20%s,\x20%s',_0x4eced4,_0xfae1('0xc'));_0x25684d(_0x53145f['result'][_0xfae1('0x11')]);}})[_0xfae1('0x12')](function(_0x33c2ed){logger['error'](_0xfae1('0xb'),_0x4eced4,_0x33c2ed);_0x53350e(_0x33c2ed);});});} \ No newline at end of file +var _0x40c6=['ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring'];(function(_0x21ca00,_0x2d9f28){var _0x43f543=function(_0x20b6a6){while(--_0x20b6a6){_0x21ca00['push'](_0x21ca00['shift']());}};_0x43f543(++_0x2d9f28);}(_0x40c6,0x8f));var _0x640c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x40c6[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x640c('0x0'));var util=require(_0x640c('0x1'));var moment=require(_0x640c('0x2'));var BPromise=require('bluebird');var rs=require(_0x640c('0x3'));var fs=require('fs');var Redis=require(_0x640c('0x4'));var db=require(_0x640c('0x5'))['db'];var utils=require(_0x640c('0x6'));var logger=require('../../config/logger')(_0x640c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x640c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bcdc6,_0xe3f013,_0x1f6ca5){return new BPromise(function(_0x586582,_0x5baa44){return client[_0x640c('0x9')](_0x5bcdc6,_0x1f6ca5)[_0x640c('0xa')](function(_0x39bd10){logger[_0x640c('0xb')](_0x640c('0xc'),_0xe3f013,'request\x20sent');logger[_0x640c('0xd')](_0x640c('0xe'),_0xe3f013,_0x640c('0xf'),JSON[_0x640c('0x10')](_0x39bd10));if(_0x39bd10[_0x640c('0x11')]){if(_0x39bd10[_0x640c('0x11')][_0x640c('0x12')]===0x1f4){logger[_0x640c('0x11')](_0x640c('0xc'),_0xe3f013,_0x39bd10['error'][_0x640c('0x13')]);return _0x5baa44(_0x39bd10[_0x640c('0x11')][_0x640c('0x13')]);}logger['error'](_0x640c('0xc'),_0xe3f013,_0x39bd10['error'][_0x640c('0x13')]);return _0x586582(_0x39bd10[_0x640c('0x11')][_0x640c('0x13')]);}else{logger[_0x640c('0xb')](_0x640c('0xc'),_0xe3f013,_0x640c('0xf'));_0x586582(_0x39bd10['result'][_0x640c('0x13')]);}})[_0x640c('0x14')](function(_0x27fb04){logger[_0x640c('0x11')](_0x640c('0xc'),_0xe3f013,_0x27fb04);_0x5baa44(_0x27fb04);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 691e193..a41e6b9 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 _0x4040=['index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addAnswer','addImap','addSmtp','addInteraction','/:id/send','/:id/users','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x4980de,_0x30abca){var _0x637c8a=function(_0x2c6385){while(--_0x2c6385){_0x4980de['push'](_0x4980de['shift']());}};_0x637c8a(++_0x30abca);}(_0x4040,0xac));var _0x0404=function(_0x194612,_0x2ef463){_0x194612=_0x194612-0x0;var _0x659aba=_0x4040[_0x194612];return _0x659aba;};'use strict';var multer=require(_0x0404('0x0'));var util=require('util');var path=require(_0x0404('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0404('0x2')]();var fs_extra=require(_0x0404('0x3'));var auth=require(_0x0404('0x4'));var interaction=require(_0x0404('0x5'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x0404('0x6')]('/',auth[_0x0404('0x7')](),controller[_0x0404('0x8')]);router[_0x0404('0x6')](_0x0404('0x9'),auth['isAuthenticated'](),controller[_0x0404('0xa')]);router[_0x0404('0x6')](_0x0404('0xb'),auth[_0x0404('0x7')](),controller['show']);router[_0x0404('0x6')](_0x0404('0xc'),auth[_0x0404('0x7')](),controller[_0x0404('0xd')]);router[_0x0404('0x6')](_0x0404('0xe'),auth['isAuthenticated'](),controller[_0x0404('0xf')]);router[_0x0404('0x6')](_0x0404('0x10'),auth[_0x0404('0x7')](),controller['getImap']);router[_0x0404('0x6')](_0x0404('0x11'),auth[_0x0404('0x7')](),controller[_0x0404('0x12')]);router[_0x0404('0x6')](_0x0404('0x13'),auth['isAuthenticated'](),controller[_0x0404('0x14')]);router[_0x0404('0x6')](_0x0404('0x15'),auth[_0x0404('0x7')](),controller[_0x0404('0x16')]);router[_0x0404('0x6')](_0x0404('0x17'),auth[_0x0404('0x7')](),controller[_0x0404('0x18')]);router[_0x0404('0x6')](_0x0404('0x19'),auth[_0x0404('0x7')](),controller[_0x0404('0x1a')]);router[_0x0404('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x0404('0x1b')]);router[_0x0404('0x1c')](_0x0404('0xc'),auth[_0x0404('0x7')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x0404('0x7')](),controller[_0x0404('0x1d')]);router[_0x0404('0x1c')]('/',auth[_0x0404('0x7')](),controller['create']);router[_0x0404('0x1c')](_0x0404('0x10'),auth[_0x0404('0x7')](),controller[_0x0404('0x1e')]);router[_0x0404('0x1c')](_0x0404('0x11'),auth['isAuthenticated'](),controller[_0x0404('0x1f')]);router[_0x0404('0x1c')](_0x0404('0x13'),auth[_0x0404('0x7')](),controller[_0x0404('0x20')]);router[_0x0404('0x1c')](_0x0404('0x15'),auth[_0x0404('0x7')](),controller['addApplications']);router[_0x0404('0x1c')](_0x0404('0x21'),auth[_0x0404('0x7')](),controller['send']);router[_0x0404('0x1c')](_0x0404('0x22'),auth[_0x0404('0x7')](),controller[_0x0404('0x23')]);router[_0x0404('0x24')](_0x0404('0xb'),auth[_0x0404('0x7')](),controller[_0x0404('0x25')]);router[_0x0404('0x26')](_0x0404('0xc'),auth[_0x0404('0x7')](),controller['removeDispositions']);router[_0x0404('0x26')](_0x0404('0xe'),auth[_0x0404('0x7')](),controller[_0x0404('0x27')]);router[_0x0404('0x26')](_0x0404('0x10'),auth[_0x0404('0x7')](),controller[_0x0404('0x28')]);router[_0x0404('0x26')]('/:id/out_servers',auth[_0x0404('0x7')](),controller[_0x0404('0x29')]);router[_0x0404('0x26')](_0x0404('0xb'),auth[_0x0404('0x7')](),controller[_0x0404('0x2a')]);router[_0x0404('0x26')]('/:id/users',auth[_0x0404('0x7')](),controller[_0x0404('0x2b')]);module[_0x0404('0x2c')]=router; \ No newline at end of file +var _0x5501=['destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeImap','removeSmtp'];(function(_0x310df5,_0xd99ed9){var _0x425868=function(_0x1704fa){while(--_0x1704fa){_0x310df5['push'](_0x310df5['shift']());}};_0x425868(++_0xd99ed9);}(_0x5501,0x103));var _0x1550=function(_0xc1cae0,_0x544528){_0xc1cae0=_0xc1cae0-0x0;var _0x29966=_0x5501[_0xc1cae0];return _0x29966;};'use strict';var multer=require(_0x1550('0x0'));var util=require(_0x1550('0x1'));var path=require(_0x1550('0x2'));var timeout=require(_0x1550('0x3'));var express=require(_0x1550('0x4'));var router=express[_0x1550('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1550('0x6'));var config=require(_0x1550('0x7'));var controller=require(_0x1550('0x8'));router[_0x1550('0x9')]('/',auth[_0x1550('0xa')](),controller['index']);router[_0x1550('0x9')]('/describe',auth[_0x1550('0xa')](),controller[_0x1550('0xb')]);router[_0x1550('0x9')](_0x1550('0xc'),auth[_0x1550('0xa')](),controller[_0x1550('0xd')]);router['get'](_0x1550('0xe'),auth[_0x1550('0xa')](),controller[_0x1550('0xf')]);router[_0x1550('0x9')](_0x1550('0x10'),auth[_0x1550('0xa')](),controller[_0x1550('0x11')]);router[_0x1550('0x9')](_0x1550('0x12'),auth[_0x1550('0xa')](),controller[_0x1550('0x13')]);router['get'](_0x1550('0x14'),auth['isAuthenticated'](),controller[_0x1550('0x15')]);router[_0x1550('0x9')](_0x1550('0x16'),auth['isAuthenticated'](),controller[_0x1550('0x17')]);router[_0x1550('0x9')](_0x1550('0x18'),auth[_0x1550('0xa')](),controller[_0x1550('0x19')]);router[_0x1550('0x9')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x1550('0x9')]('/:id/verify',auth[_0x1550('0xa')](),controller[_0x1550('0x1a')]);router[_0x1550('0x9')](_0x1550('0x1b'),auth[_0x1550('0xa')](),controller[_0x1550('0x1c')]);router[_0x1550('0x1d')](_0x1550('0xe'),auth[_0x1550('0xa')](),controller[_0x1550('0x1e')]);router[_0x1550('0x1d')]('/:id/canned_answers',auth[_0x1550('0xa')](),controller[_0x1550('0x1f')]);router['post']('/',auth[_0x1550('0xa')](),controller['create']);router[_0x1550('0x1d')](_0x1550('0x12'),auth['isAuthenticated'](),controller['addImap']);router[_0x1550('0x1d')](_0x1550('0x14'),auth[_0x1550('0xa')](),controller['addSmtp']);router[_0x1550('0x1d')](_0x1550('0x16'),auth[_0x1550('0xa')](),controller[_0x1550('0x20')]);router['post'](_0x1550('0x18'),auth[_0x1550('0xa')](),controller[_0x1550('0x21')]);router[_0x1550('0x1d')](_0x1550('0x22'),auth[_0x1550('0xa')](),controller[_0x1550('0x23')]);router[_0x1550('0x1d')](_0x1550('0x1b'),auth[_0x1550('0xa')](),controller[_0x1550('0x24')]);router[_0x1550('0x25')](_0x1550('0xc'),auth[_0x1550('0xa')](),controller[_0x1550('0x26')]);router['delete'](_0x1550('0xe'),auth[_0x1550('0xa')](),controller['removeDispositions']);router[_0x1550('0x27')](_0x1550('0x10'),auth[_0x1550('0xa')](),controller['removeAnswers']);router[_0x1550('0x27')](_0x1550('0x12'),auth['isAuthenticated'](),controller[_0x1550('0x28')]);router['delete'](_0x1550('0x14'),auth[_0x1550('0xa')](),controller[_0x1550('0x29')]);router[_0x1550('0x27')](_0x1550('0xc'),auth[_0x1550('0xa')](),controller[_0x1550('0x2a')]);router[_0x1550('0x27')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 29bb8a2..5b2d396 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 _0x0f00=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','gmail','hotmail','yahoo','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x3e72ff,_0x5d03d){var _0x48efd2=function(_0x259239){while(--_0x259239){_0x3e72ff['push'](_0x3e72ff['shift']());}};_0x48efd2(++_0x5d03d);}(_0x0f00,0x1d2));var _0x00f0=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x0f00[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0x00f0('0x0'));module[_0x00f0('0x1')]={'description':{'type':Sequelize[_0x00f0('0x2')]},'name':{'type':Sequelize[_0x00f0('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x00f0('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x00f0('0x2')],'allowNull':![],'defaultValue':_0x00f0('0x4')},'fontSize':{'type':Sequelize[_0x00f0('0x5')](0x2)[_0x00f0('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x00f0('0x7')],'defaultValue':function(){return _0x00f0('0x8');}},'notificationSound':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x00f0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x00f0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x00f0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x00f0('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x00f0('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![],'comment':_0x00f0('0xa'),'set':function(_0x58ee90){if(!_0x58ee90)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x00f0('0xb')]('mandatoryDisposition',_0x58ee90);}},'provider':{'type':Sequelize[_0x00f0('0xc')](_0x00f0('0xd'),_0x00f0('0xe'),_0x00f0('0xf'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x00f0('0x10')]('provider'))return _0x00f0('0x11');return this[_0x00f0('0x10')](_0x00f0('0x12'));},'set':function(_0x299127){if(_0x299127===_0x00f0('0x11'))_0x299127=null;return this['setDataValue'](_0x00f0('0x12'),_0x299127);}}}; \ No newline at end of file +var _0xcab2=['gmail','hotmail','provider','custom','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0x4f7e6c,_0x54dab8){var _0x3be11f=function(_0x782b38){while(--_0x782b38){_0x4f7e6c['push'](_0x4f7e6c['shift']());}};_0x3be11f(++_0x54dab8);}(_0xcab2,0x74));var _0x2cab=function(_0x1098e3,_0x142593){_0x1098e3=_0x1098e3-0x0;var _0x47ffb9=_0xcab2[_0x1098e3];return _0x47ffb9;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x2cab('0x0')]},'name':{'type':Sequelize[_0x2cab('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x2cab('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x2cab('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2cab('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2cab('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x2cab('0x2')]},'markAsUnread':{'type':Sequelize[_0x2cab('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2cab('0x0')],'allowNull':![],'defaultValue':_0x2cab('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x2cab('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2cab('0x5');}},'notificationSound':{'type':Sequelize[_0x2cab('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2cab('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2cab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2cab('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2cab('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x2cab('0x1')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x290609){if(!_0x290609)this[_0x2cab('0x8')](_0x2cab('0x9'),null);this[_0x2cab('0x8')](_0x2cab('0xa'),_0x290609);}},'provider':{'type':Sequelize[_0x2cab('0xb')](_0x2cab('0xc'),_0x2cab('0xd'),'yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x2cab('0xe')))return _0x2cab('0xf');return this['getDataValue'](_0x2cab('0xe'));},'set':function(_0x35e7c3){if(_0x35e7c3===_0x2cab('0xf'))_0x35e7c3=null;return this['setDataValue'](_0x2cab('0xe'),_0x35e7c3);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 77a4f55..3a8e0cb 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 _0x3e09=['error','code','message','catch','status','end','offset','undefined','limit','count','Content-Range','json','update','get','MailAccounts','UserProfileResource','destroy','name','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','yahoo','hotmail','outlook365','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','MailAccount','include','rows','show','keys','includeAll','options','body','provider','custom','find','params','Mail\x20Account\x20not\x20found','service','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','email','ListId','isNil','active','description','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','stack','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','List','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','CmContact','defaults','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','register','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s'];(function(_0x487b09,_0x349b11){var _0x28830b=function(_0x51705f){while(--_0x51705f){_0x487b09['push'](_0x487b09['shift']());}};_0x28830b(++_0x349b11);}(_0x3e09,0xae));var _0x93e0=function(_0x5da54c,_0x520452){_0x5da54c=_0x5da54c-0x0;var _0x1246b0=_0x3e09[_0x5da54c];return _0x1246b0;};'use strict';var moment=require('moment');var BPromise=require(_0x93e0('0x0'));var util=require(_0x93e0('0x1'));var path=require(_0x93e0('0x2'));var _=require(_0x93e0('0x3'));var juice=require(_0x93e0('0x4'));var Redis=require(_0x93e0('0x5'));var qs=require(_0x93e0('0x6'));var logger=require('../../config/logger')(_0x93e0('0x7'));var config=require(_0x93e0('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x93e0('0x9')],{'host':_0x93e0('0xa'),'port':0x18eb});var socket=require(_0x93e0('0xb'))(new Redis(config[_0x93e0('0x9')]));require(_0x93e0('0xc'))[_0x93e0('0xd')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x93e0('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x42bf00,_0x27a8dd,_0x165025,_0x24088b){return new BPromise(function(_0x416528,_0x1e10ab){var _0x4a71f9=_0x24088b||client;return _0x4a71f9[_0x93e0('0xf')](_0x42bf00,_0x165025)[_0x93e0('0x10')](function(_0x208355){logger[_0x93e0('0x11')](_0x93e0('0x12'),_0x27a8dd,_0x93e0('0x13'));logger[_0x93e0('0x14')](_0x93e0('0x15'),_0x27a8dd,_0x93e0('0x13'),JSON['stringify'](_0x208355));if(_0x208355[_0x93e0('0x16')]){if(_0x208355['error'][_0x93e0('0x17')]===0x1f4){logger[_0x93e0('0x16')](_0x93e0('0x12'),_0x27a8dd,_0x208355[_0x93e0('0x16')][_0x93e0('0x18')]);return _0x1e10ab(_0x208355[_0x93e0('0x16')][_0x93e0('0x18')]);}logger[_0x93e0('0x16')](_0x93e0('0x12'),_0x27a8dd,_0x208355[_0x93e0('0x16')]['message']);return _0x416528(_0x208355[_0x93e0('0x16')][_0x93e0('0x18')]);}else{logger[_0x93e0('0x11')](_0x93e0('0x12'),_0x27a8dd,_0x93e0('0x13'));_0x416528(_0x208355['result'][_0x93e0('0x18')]);}})[_0x93e0('0x19')](function(_0x2b1d24){logger[_0x93e0('0x16')]('MailAccount,\x20%s,\x20%s',_0x27a8dd,_0x2b1d24);_0x1e10ab(_0x2b1d24);});});}function respondWithStatusCode(_0x5b7301,_0x368361){_0x368361=_0x368361||0xcc;return function(_0x348450){if(_0x348450){return _0x5b7301['sendStatus'](_0x368361);}return _0x5b7301[_0x93e0('0x1a')](_0x368361)[_0x93e0('0x1b')]();};}function respondWithResult(_0x487b69,_0x19f1df){_0x19f1df=_0x19f1df||0xc8;return function(_0x562c1f){if(_0x562c1f){return _0x487b69[_0x93e0('0x1a')](_0x19f1df)['json'](_0x562c1f);}};}function respondWithFilteredResult(_0x3c3205,_0x4b349a){return function(_0x144f8c){if(_0x144f8c){var _0x4929e6=typeof _0x4b349a[_0x93e0('0x1c')]===_0x93e0('0x1d')&&typeof _0x4b349a[_0x93e0('0x1e')]==='undefined';var _0x543f2f=_0x144f8c[_0x93e0('0x1f')];var _0x29fe3e=_0x4929e6?0x0:_0x4b349a[_0x93e0('0x1c')];var _0x5c6888=_0x4929e6?_0x144f8c[_0x93e0('0x1f')]:_0x4b349a[_0x93e0('0x1c')]+_0x4b349a[_0x93e0('0x1e')];var _0x32dd3f;if(_0x5c6888>=_0x543f2f){_0x5c6888=_0x543f2f;_0x32dd3f=0xc8;}else{_0x32dd3f=0xce;}_0x3c3205[_0x93e0('0x1a')](_0x32dd3f);return _0x3c3205['set'](_0x93e0('0x20'),_0x29fe3e+'-'+_0x5c6888+'/'+_0x543f2f)[_0x93e0('0x21')](_0x144f8c);}return null;};}function saveUpdates(_0x137e3e){return function(_0x5e128d){if(_0x5e128d){return _0x5e128d[_0x93e0('0x22')](_0x137e3e)[_0x93e0('0x10')](function(_0x2007a0){return _0x2007a0;});}return null;};}function removeEntity(_0x1d6245){return function(_0x3a6261){if(_0x3a6261){return _0x3a6261['destroy']()['then'](function(){var _0x4641c8=_0x3a6261[_0x93e0('0x23')]({'plain':!![]});var _0x554d33=_0x93e0('0x24');return db[_0x93e0('0x25')][_0x93e0('0x26')]({'where':{'type':_0x554d33,'resourceId':_0x4641c8['id']}})['then'](function(){return _0x3a6261;});})['then'](function(){_0x1d6245[_0x93e0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a30e1){return function(_0xff0ec7){if(!_0xff0ec7){_0x5a30e1['sendStatus'](0x194);}return _0xff0ec7;};}function handleError(_0x5017ce,_0x2124fb){_0x2124fb=_0x2124fb||0x1f4;return function(_0x35fb15){logger[_0x93e0('0x16')](_0x35fb15['stack']);if(_0x35fb15[_0x93e0('0x27')]){delete _0x35fb15[_0x93e0('0x27')];}_0x5017ce[_0x93e0('0x1a')](_0x2124fb)['send'](_0x35fb15);};}function getImapHost(_0x5bdfe3){switch(_0x5bdfe3){case _0x93e0('0x28'):return _0x93e0('0x29');case'yahoo':return _0x93e0('0x2a');case'hotmail':return _0x93e0('0x2b');case'outlook365':return _0x93e0('0x2c');}throw new Error(_0x93e0('0x2d'),_0x5bdfe3);}function getSmtpHost(_0x5f13e7){switch(_0x5f13e7){case'gmail':return'smtp.gmail.com';case _0x93e0('0x2e'):return'smtp.mail.yahoo.com';case _0x93e0('0x2f'):return'smtp-mail.outlook.com';case _0x93e0('0x30'):return'smtp.office365.com';}throw new Error(_0x93e0('0x2d'),_0x5f13e7);}function getAuthenticationOptions(_0x204d13,_0x2966b0){var _0x3ea000={};var _0x3fd131={};if(_0x204d13){_0x3ea000[_0x93e0('0x31')]=_0x3fd131[_0x93e0('0x31')]=_0x2966b0[_0x93e0('0x32')];_0x3ea000[_0x93e0('0x33')]=_0x3fd131[_0x93e0('0x34')]=_0x2966b0['password'];if(_0x2966b0[_0x93e0('0x35')]){_0x3ea000[_0x93e0('0x35')]=_0x3fd131[_0x93e0('0x35')]=!![];_0x3ea000[_0x93e0('0x36')]=_0x3fd131[_0x93e0('0x36')]=_0x2966b0[_0x93e0('0x36')];_0x3ea000['password']=_0x3fd131[_0x93e0('0x34')]=null;}else{_0x3ea000[_0x93e0('0x36')]=_0x3fd131[_0x93e0('0x36')]=null;}_0x3ea000[_0x93e0('0x37')]=getImapHost(_0x204d13);_0x3ea000['port']=0x3e1;_0x3fd131[_0x93e0('0x37')]=getSmtpHost(_0x204d13);_0x3fd131[_0x93e0('0x38')]=0x24b;_0x3fd131[_0x93e0('0x39')]=![];_0x3ea000['service']=_0x3fd131['service']=null;}else{if(_0x2966b0[_0x93e0('0x3a')]){_0x3ea000['user']=_0x3fd131[_0x93e0('0x31')]=_0x2966b0[_0x93e0('0x32')];_0x3ea000[_0x93e0('0x33')]=_0x3fd131[_0x93e0('0x34')]=_0x2966b0[_0x93e0('0x33')];}else{_0x3ea000[_0x93e0('0x3a')]=_0x3fd131['authentication']=![];_0x3ea000[_0x93e0('0x31')]=_0x3fd131[_0x93e0('0x31')]=null;_0x3ea000[_0x93e0('0x33')]=_0x3fd131['pass']=null;}_0x3ea000[_0x93e0('0x37')]=_0x2966b0[_0x93e0('0x3b')][_0x93e0('0x37')];_0x3ea000[_0x93e0('0x38')]=_0x2966b0[_0x93e0('0x3b')][_0x93e0('0x38')];_0x3fd131[_0x93e0('0x37')]=_0x2966b0['Smtp'][_0x93e0('0x37')];_0x3fd131[_0x93e0('0x38')]=_0x2966b0[_0x93e0('0x3c')][_0x93e0('0x38')];}return{'Imap':_0x3ea000,'Smtp':_0x3fd131};}exports[_0x93e0('0x3d')]=function(_0x3732d3,_0x354117){var _0x4a8e0e={'include':[{'model':db[_0x93e0('0x3e')],'as':_0x93e0('0x3b')},{'model':db[_0x93e0('0x3f')],'as':_0x93e0('0x3c')},{'model':db[_0x93e0('0x40')],'as':_0x93e0('0x41')}]},_0x5575fa={},_0x24ba85={'count':0x0,'rows':[]};var _0x12f03f=_[_0x93e0('0x42')](db['MailAccount'][_0x93e0('0x43')],function(_0x5bf9ec){return{'name':_0x5bf9ec[_0x93e0('0x44')],'type':_0x5bf9ec[_0x93e0('0x45')][_0x93e0('0x46')]};});_0x5575fa['model']=_['map'](_0x12f03f,'name');_0x5575fa[_0x93e0('0x47')]=_['keys'](_0x3732d3['query']);_0x5575fa[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x5575fa['model'],_0x5575fa[_0x93e0('0x47')]);_0x4a8e0e[_0x93e0('0x4a')]=_['intersection'](_0x5575fa[_0x93e0('0x4b')],qs['fields'](_0x3732d3['query'][_0x93e0('0x4c')]));_0x4a8e0e[_0x93e0('0x4a')]=_0x4a8e0e[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x4a8e0e[_0x93e0('0x4a')]:_0x5575fa[_0x93e0('0x4b')];if(!_0x3732d3[_0x93e0('0x47')][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x4a8e0e['limit']=qs[_0x93e0('0x1e')](_0x3732d3[_0x93e0('0x47')][_0x93e0('0x1e')]);_0x4a8e0e[_0x93e0('0x1c')]=qs[_0x93e0('0x1c')](_0x3732d3['query']['offset']);}_0x4a8e0e[_0x93e0('0x50')]=qs[_0x93e0('0x51')](_0x3732d3['query'][_0x93e0('0x51')]);_0x4a8e0e[_0x93e0('0x52')]=qs['filters'](_[_0x93e0('0x53')](_0x3732d3[_0x93e0('0x47')],_0x5575fa[_0x93e0('0x48')]),_0x12f03f);if(_0x3732d3['query']['filter']){_0x4a8e0e[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x4a8e0e[_0x93e0('0x52')],{'$or':_[_0x93e0('0x42')](_0x12f03f,function(_0x367fd6){if(_0x367fd6['type']!=='VIRTUAL'){var _0x557f98={};_0x557f98[_0x367fd6[_0x93e0('0x27')]]={'$like':'%'+_0x3732d3[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x557f98;}})});}_0x4a8e0e=_[_0x93e0('0x54')]({},_0x4a8e0e,_0x3732d3['options']);var _0x35b1b8={'where':_0x4a8e0e['where']};return db[_0x93e0('0x56')]['count'](_0x35b1b8)[_0x93e0('0x10')](function(_0x9dd908){_0x24ba85[_0x93e0('0x1f')]=_0x9dd908;if(_0x3732d3['query']['includeAll']){_0x4a8e0e[_0x93e0('0x57')]=[{'all':!![]}];}return db[_0x93e0('0x56')]['findAll'](_0x4a8e0e);})[_0x93e0('0x10')](function(_0x14931c){_0x24ba85[_0x93e0('0x58')]=_0x14931c;return _0x24ba85;})['then'](respondWithFilteredResult(_0x354117,_0x4a8e0e))[_0x93e0('0x19')](handleError(_0x354117,null));};exports[_0x93e0('0x59')]=function(_0x47809a,_0x5624fe){var _0x17b308={'raw':![],'where':{'id':_0x47809a['params']['id']},'include':[{'model':db[_0x93e0('0x3e')],'as':_0x93e0('0x3b')},{'model':db[_0x93e0('0x3f')],'as':'Smtp'},{'model':db[_0x93e0('0x40')],'as':'mandatoryDispositionPause'}]},_0x24e23e={};_0x24e23e[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x56')][_0x93e0('0x43')]);_0x24e23e['query']=_['keys'](_0x47809a[_0x93e0('0x47')]);_0x24e23e[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x24e23e['model'],_0x24e23e[_0x93e0('0x47')]);_0x17b308['attributes']=_[_0x93e0('0x49')](_0x24e23e[_0x93e0('0x4b')],qs['fields'](_0x47809a[_0x93e0('0x47')]['fields']));_0x17b308['attributes']=_0x17b308[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x17b308[_0x93e0('0x4a')]:_0x24e23e[_0x93e0('0x4b')];if(_0x47809a[_0x93e0('0x47')][_0x93e0('0x5b')]){_0x17b308['include']=[{'all':!![]}];}_0x17b308=_[_0x93e0('0x54')]({},_0x17b308,_0x47809a[_0x93e0('0x5c')]);return db['MailAccount']['find'](_0x17b308)[_0x93e0('0x10')](handleEntityNotFound(_0x5624fe,null))['then'](respondWithResult(_0x5624fe,null))[_0x93e0('0x19')](handleError(_0x5624fe,null));};exports[_0x93e0('0x22')]=function(_0x39193f,_0x15623e){if(_0x39193f[_0x93e0('0x5d')]['id']){delete _0x39193f[_0x93e0('0x5d')]['id'];}var _0x447b9a=_0x39193f[_0x93e0('0x5d')][_0x93e0('0x5e')]===_0x93e0('0x5f')?null:_0x39193f[_0x93e0('0x5d')][_0x93e0('0x5e')];var _0x49ca13=_0x39193f[_0x93e0('0x5d')]['Imap']||{};var _0x18eabd=_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3c')]||{};if(_0x447b9a){_0x49ca13['host']=getImapHost(_0x447b9a);_0x49ca13['port']=0x3e1;_0x18eabd[_0x93e0('0x37')]=getSmtpHost(_0x447b9a);_0x18eabd[_0x93e0('0x38')]=0x24b;_0x18eabd[_0x93e0('0x39')]=![];}if(_0x18eabd['modernAuthentication']){_0x18eabd[_0x93e0('0x39')]=![];}else{_0x18eabd[_0x93e0('0x36')]=null;}if(!_0x49ca13[_0x93e0('0x35')])_0x49ca13[_0x93e0('0x36')]=null;_0x39193f['body'][_0x93e0('0x3b')]=_0x49ca13;_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3c')]=_0x18eabd;return db['MailAccount'][_0x93e0('0x60')]({'where':{'id':_0x39193f[_0x93e0('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x93e0('0x3b')},{'model':db[_0x93e0('0x3f')],'as':_0x93e0('0x3c')},{'model':db[_0x93e0('0x40')],'as':_0x93e0('0x41')}]})[_0x93e0('0x10')](handleEntityNotFound(_0x15623e,null))[_0x93e0('0x10')](function(_0xdeb97e){if(!_0xdeb97e)throw new Error(_0x93e0('0x62'));if(_0xdeb97e[_0x93e0('0x63')])delete _0x39193f[_0x93e0('0x5d')][_0x93e0('0x3b')];return _0xdeb97e;})[_0x93e0('0x10')](saveUpdates(_0x39193f[_0x93e0('0x5d')],null))[_0x93e0('0x10')](function(_0x3aa248){if(!_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3b')])return _0x3aa248;return db[_0x93e0('0x3e')][_0x93e0('0x22')](_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3b')],{'where':{'MailAccountId':_0x3aa248['id']}})[_0x93e0('0x10')](function(){return _0x3aa248;});})[_0x93e0('0x10')](function(_0x4d899d){if(!_0x39193f[_0x93e0('0x5d')]['Smtp'])return _0x4d899d;return db[_0x93e0('0x3f')][_0x93e0('0x22')](_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3c')],{'where':{'MailAccountId':_0x4d899d['id']}})[_0x93e0('0x10')](function(){return _0x4d899d;});})[_0x93e0('0x10')](respondWithResult(_0x15623e,null))['catch'](handleError(_0x15623e,null));};exports[_0x93e0('0x64')]=function(_0x203790,_0x461b83){return db[_0x93e0('0x56')]['describe']()['then'](respondWithResult(_0x461b83,null))[_0x93e0('0x19')](handleError(_0x461b83,null));};exports[_0x93e0('0x65')]=function(_0x25462c,_0xa5796b){if(_0x25462c['body']['id']){delete _0x25462c[_0x93e0('0x5d')]['id'];}return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x25462c[_0x93e0('0x61')]['id']}})['then'](handleEntityNotFound(_0xa5796b,null))['then'](function(_0x4d3b96){if(_0x4d3b96){_0x25462c[_0x93e0('0x5d')][_0x93e0('0x66')]=_0x4d3b96['id'];return db[_0x93e0('0x67')][_0x93e0('0x68')](_0x25462c['body']);}})[_0x93e0('0x10')](respondWithResult(_0xa5796b,null))[_0x93e0('0x19')](handleError(_0xa5796b,null));};exports[_0x93e0('0x69')]=function(_0x10cf94,_0x4c9577){var _0x19652b={'raw':![],'where':{}};var _0x4b62f3={};var _0x32977b={'count':0x0,'rows':[]};return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x10cf94[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x4c9577,null))[_0x93e0('0x10')](function(_0x48f01f){if(_0x48f01f){_0x4b62f3[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x67')][_0x93e0('0x43')]);_0x4b62f3[_0x93e0('0x47')]=_[_0x93e0('0x5a')](_0x10cf94[_0x93e0('0x47')]);_0x4b62f3[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x4b62f3[_0x93e0('0x4b')],_0x4b62f3[_0x93e0('0x47')]);_0x19652b[_0x93e0('0x4a')]=_[_0x93e0('0x49')](_0x4b62f3['model'],qs['fields'](_0x10cf94[_0x93e0('0x47')]['fields']));_0x19652b[_0x93e0('0x4a')]=_0x19652b[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x19652b['attributes']:_0x4b62f3['model'];if(!_0x10cf94['query'][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x19652b['limit']=qs[_0x93e0('0x1e')](_0x10cf94[_0x93e0('0x47')][_0x93e0('0x1e')]);_0x19652b['offset']=qs[_0x93e0('0x1c')](_0x10cf94[_0x93e0('0x47')][_0x93e0('0x1c')]);}_0x19652b['order']=qs[_0x93e0('0x51')](_0x10cf94[_0x93e0('0x47')][_0x93e0('0x51')]);_0x19652b[_0x93e0('0x52')]=qs[_0x93e0('0x48')](_['pick'](_0x10cf94['query'],_0x4b62f3['filters']));_0x19652b[_0x93e0('0x52')]['MailAccountId']=_0x48f01f['id'];if(_0x10cf94['query'][_0x93e0('0x55')]){_0x19652b[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x19652b['where'],{'$or':_['map'](_0x19652b[_0x93e0('0x4a')],function(_0x43324b){var _0x5d8c64={};_0x5d8c64[_0x43324b]={'$like':'%'+_0x10cf94['query'][_0x93e0('0x55')]+'%'};return _0x5d8c64;})});}_0x19652b=_[_0x93e0('0x54')]({},_0x19652b,_0x10cf94[_0x93e0('0x5c')]);return db[_0x93e0('0x67')]['count']({'where':_0x19652b[_0x93e0('0x52')]})[_0x93e0('0x10')](function(_0x1e54f7){_0x32977b[_0x93e0('0x1f')]=_0x1e54f7;if(_0x10cf94[_0x93e0('0x47')][_0x93e0('0x5b')]){_0x19652b[_0x93e0('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x93e0('0x6b')](_0x19652b);})['then'](function(_0x326826){_0x32977b[_0x93e0('0x58')]=_0x326826;return _0x32977b;});}})[_0x93e0('0x10')](respondWithFilteredResult(_0x4c9577,_0x19652b))['catch'](handleError(_0x4c9577,null));};exports[_0x93e0('0x6c')]=function(_0x2966e3,_0x3edec8){return db['MailAccount'][_0x93e0('0x60')]({'where':{'id':_0x2966e3['params']['id']}})['then'](handleEntityNotFound(_0x3edec8,null))['then'](function(_0x3eb0a2){if(_0x3eb0a2){return _0x3eb0a2[_0x93e0('0x6c')](_0x2966e3[_0x93e0('0x47')]['ids']);}})[_0x93e0('0x10')](respondWithStatusCode(_0x3edec8,null))[_0x93e0('0x19')](handleError(_0x3edec8,null));};exports[_0x93e0('0x6d')]=function(_0x3cb3b7,_0x2699d6){if(_0x3cb3b7[_0x93e0('0x5d')]['id']){delete _0x3cb3b7[_0x93e0('0x5d')]['id'];}return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x3cb3b7[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x2699d6,null))[_0x93e0('0x10')](function(_0x4c4eb8){if(_0x4c4eb8){_0x3cb3b7[_0x93e0('0x5d')]['MailAccountId']=_0x4c4eb8['id'];return db[_0x93e0('0x6e')]['create'](_0x3cb3b7['body']);}})[_0x93e0('0x10')](respondWithResult(_0x2699d6,null))[_0x93e0('0x19')](handleError(_0x2699d6,null));};exports[_0x93e0('0x6f')]=function(_0x5f19af,_0x3a6ea1){var _0x5189b4={'raw':![],'where':{}};var _0x2367f6={};var _0x16679a={'count':0x0,'rows':[]};return db['MailAccount'][_0x93e0('0x6a')]({'where':{'id':_0x5f19af[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x3a6ea1,null))[_0x93e0('0x10')](function(_0x152fb6){if(_0x152fb6){_0x2367f6[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x6e')]['rawAttributes']);_0x2367f6['query']=_[_0x93e0('0x5a')](_0x5f19af[_0x93e0('0x47')]);_0x2367f6['filters']=_[_0x93e0('0x49')](_0x2367f6[_0x93e0('0x4b')],_0x2367f6[_0x93e0('0x47')]);_0x5189b4[_0x93e0('0x4a')]=_[_0x93e0('0x49')](_0x2367f6[_0x93e0('0x4b')],qs[_0x93e0('0x4c')](_0x5f19af[_0x93e0('0x47')][_0x93e0('0x4c')]));_0x5189b4[_0x93e0('0x4a')]=_0x5189b4[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x5189b4[_0x93e0('0x4a')]:_0x2367f6[_0x93e0('0x4b')];if(!_0x5f19af[_0x93e0('0x47')][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x5189b4['limit']=qs[_0x93e0('0x1e')](_0x5f19af[_0x93e0('0x47')]['limit']);_0x5189b4[_0x93e0('0x1c')]=qs[_0x93e0('0x1c')](_0x5f19af[_0x93e0('0x47')][_0x93e0('0x1c')]);}_0x5189b4['order']=qs[_0x93e0('0x51')](_0x5f19af[_0x93e0('0x47')][_0x93e0('0x51')]);_0x5189b4['where']=qs[_0x93e0('0x48')](_[_0x93e0('0x53')](_0x5f19af[_0x93e0('0x47')],_0x2367f6[_0x93e0('0x48')]));_0x5189b4[_0x93e0('0x52')][_0x93e0('0x66')]=_0x152fb6['id'];if(_0x5f19af[_0x93e0('0x47')][_0x93e0('0x55')]){_0x5189b4[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x5189b4[_0x93e0('0x52')],{'$or':_['map'](_0x5189b4[_0x93e0('0x4a')],function(_0x23979b){var _0x105db3={};_0x105db3[_0x23979b]={'$like':'%'+_0x5f19af[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x105db3;})});}_0x5189b4=_['merge']({},_0x5189b4,_0x5f19af[_0x93e0('0x5c')]);return db['CannedAnswer'][_0x93e0('0x1f')]({'where':_0x5189b4[_0x93e0('0x52')]})[_0x93e0('0x10')](function(_0x1a67f2){_0x16679a[_0x93e0('0x1f')]=_0x1a67f2;if(_0x5f19af['query'][_0x93e0('0x5b')]){_0x5189b4['include']=[{'all':!![]}];}return db[_0x93e0('0x6e')][_0x93e0('0x6b')](_0x5189b4);})[_0x93e0('0x10')](function(_0x1774eb){_0x16679a[_0x93e0('0x58')]=_0x1774eb;return _0x16679a;});}})[_0x93e0('0x10')](respondWithFilteredResult(_0x3a6ea1,_0x5189b4))[_0x93e0('0x19')](handleError(_0x3a6ea1,null));};exports[_0x93e0('0x70')]=function(_0x112f10,_0x1a2d3e){return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x112f10[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x1a2d3e,null))[_0x93e0('0x10')](function(_0x4bfb8c){if(_0x4bfb8c){return _0x4bfb8c[_0x93e0('0x70')](_0x112f10[_0x93e0('0x47')][_0x93e0('0x71')]);}})['then'](respondWithStatusCode(_0x1a2d3e,null))[_0x93e0('0x19')](handleError(_0x1a2d3e,null));};exports[_0x93e0('0x68')]=function(_0x57ed61,_0x1e81ba){var _0x601ef5={'name':_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x27')],'key':_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x46')],'provider':_0x57ed61[_0x93e0('0x5d')]['provider']===_0x93e0('0x5f')?null:_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x5e')],'email':_0x57ed61['body'][_0x93e0('0x72')],'ListId':_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x73')],'active':!_[_0x93e0('0x74')](_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x75')])?_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x75')]:!![],'description':_0x57ed61['body'][_0x93e0('0x76')]||null};var _0x2a15e5=getAuthenticationOptions(_0x601ef5[_0x93e0('0x5e')],_0x57ed61[_0x93e0('0x5d')]);_0x601ef5['Imap']=_0x2a15e5[_0x93e0('0x3b')];_0x601ef5[_0x93e0('0x3c')]=_0x2a15e5[_0x93e0('0x3c')];return db[_0x93e0('0x56')][_0x93e0('0x68')](_0x601ef5,{'include':[{'model':db['MailServerOut'],'as':_0x93e0('0x3c')},{'model':db[_0x93e0('0x3e')],'as':_0x93e0('0x3b')}]})[_0x93e0('0x10')](function(_0x3f1d94){var _0x5ae4a4=_0x57ed61[_0x93e0('0x31')][_0x93e0('0x23')]({'plain':!![]});if(!_0x5ae4a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ae4a4[_0x93e0('0x77')]==='user'){var _0xb50267=_0x3f1d94['get']({'plain':!![]});return db[_0x93e0('0x78')]['find']({'where':{'name':_0x93e0('0x24'),'userProfileId':_0x5ae4a4[_0x93e0('0x79')]},'raw':!![]})[_0x93e0('0x10')](function(_0x57d3c2){if(_0x57d3c2&&_0x57d3c2[_0x93e0('0x7a')]===0x0){return db[_0x93e0('0x25')]['create']({'name':_0xb50267[_0x93e0('0x27')],'resourceId':_0xb50267['id'],'type':_0x57d3c2[_0x93e0('0x27')],'sectionId':_0x57d3c2['id']},{})[_0x93e0('0x10')](function(){return _0x3f1d94;});}else{return _0x3f1d94;}})[_0x93e0('0x19')](function(_0x38d6ae){logger[_0x93e0('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38d6ae);throw _0x38d6ae;});}return _0x3f1d94;})[_0x93e0('0x10')](respondWithResult(_0x1e81ba,0xc9))[_0x93e0('0x19')](handleError(_0x1e81ba,null));};exports[_0x93e0('0x7b')]=function(_0x20aa5f,_0x4e1a4d){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x20aa5f[_0x93e0('0x61')]['id']}})['then'](handleEntityNotFound(_0x4e1a4d,null))['then'](function(_0xafdfd0){if(_0xafdfd0){return _0xafdfd0['getImap']();}return null;})[_0x93e0('0x10')](respondWithResult(_0x4e1a4d,null))[_0x93e0('0x19')](handleError(_0x4e1a4d,null));};exports[_0x93e0('0x7c')]=function(_0x4ae304,_0x87d557){if(_0x4ae304[_0x93e0('0x5d')]['id']){delete _0x4ae304[_0x93e0('0x5d')]['id'];}return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x4ae304[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x87d557,null))[_0x93e0('0x10')](function(_0x5a393f){if(_0x5a393f){_0x4ae304[_0x93e0('0x5d')]['MailAccountId']=_0x5a393f['id'];return db[_0x93e0('0x3e')][_0x93e0('0x68')](_0x4ae304[_0x93e0('0x5d')]);}})[_0x93e0('0x10')](respondWithResult(_0x87d557,null))[_0x93e0('0x19')](handleError(_0x87d557,null));};exports[_0x93e0('0x7d')]=function(_0x241f6e,_0x3099dd){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x241f6e[_0x93e0('0x61')]['id']}})['then'](handleEntityNotFound(_0x3099dd,null))[_0x93e0('0x10')](function(_0x18d7fc){if(_0x18d7fc){return _0x18d7fc[_0x93e0('0x7e')](null);}return null;})[_0x93e0('0x10')](respondWithStatusCode(_0x3099dd,null))[_0x93e0('0x19')](handleError(_0x3099dd,null));};exports[_0x93e0('0x7f')]=function(_0x3456db,_0x51bb3d){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x3456db['params']['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x51bb3d,null))['then'](function(_0x271828){if(_0x271828){return _0x271828['getSmtp']();}return null;})[_0x93e0('0x10')](respondWithResult(_0x51bb3d,null))[_0x93e0('0x19')](handleError(_0x51bb3d,null));};exports[_0x93e0('0x80')]=function(_0x23c0bd,_0x3b24c7){if(_0x23c0bd[_0x93e0('0x5d')]['id']){delete _0x23c0bd[_0x93e0('0x5d')]['id'];}return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x23c0bd[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x3b24c7,null))[_0x93e0('0x10')](function(_0x5d3f09){if(_0x5d3f09){_0x23c0bd['body'][_0x93e0('0x66')]=_0x5d3f09['id'];return db['MailServerOut'][_0x93e0('0x68')](_0x23c0bd[_0x93e0('0x5d')]);}})[_0x93e0('0x10')](respondWithResult(_0x3b24c7,null))[_0x93e0('0x19')](handleError(_0x3b24c7,null));};exports[_0x93e0('0x81')]=function(_0x26a2ca,_0x4829ab){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x26a2ca['params']['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x4829ab,null))[_0x93e0('0x10')](function(_0x4feb31){if(_0x4feb31){return _0x4feb31[_0x93e0('0x82')](null);}return null;})[_0x93e0('0x10')](respondWithStatusCode(_0x4829ab,null))[_0x93e0('0x19')](handleError(_0x4829ab,null));};exports[_0x93e0('0x83')]=function(_0x2c5a9d,_0x1d1ee3){return db[_0x93e0('0x84')]['find']({'where':{'id':_0x2c5a9d[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x1d1ee3,null))[_0x93e0('0x10')](function(_0x244a35){if(_0x244a35){return _0x244a35[_0x93e0('0x83')](_0x2c5a9d[_0x93e0('0x5d')][_0x93e0('0x71')],_[_0x93e0('0x85')](_0x2c5a9d[_0x93e0('0x5d')],['ids','id'])||{});}})[_0x93e0('0x10')](respondWithResult(_0x1d1ee3,null))[_0x93e0('0x19')](handleError(_0x1d1ee3,null));};exports[_0x93e0('0x86')]=function(_0x37f1bf,_0x23e334){var _0x188868={'raw':![],'where':{}};var _0x3c1a0d={};var _0x479f24={'count':0x0,'rows':[]};return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x37f1bf[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x23e334,null))[_0x93e0('0x10')](function(_0x326141){if(_0x326141){_0x3c1a0d[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x84')]['rawAttributes']);_0x3c1a0d[_0x93e0('0x47')]=_[_0x93e0('0x5a')](_0x37f1bf[_0x93e0('0x47')]);_0x3c1a0d[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x3c1a0d[_0x93e0('0x4b')],_0x3c1a0d[_0x93e0('0x47')]);_0x188868['attributes']=_[_0x93e0('0x49')](_0x3c1a0d['model'],qs['fields'](_0x37f1bf['query'][_0x93e0('0x4c')]));_0x188868[_0x93e0('0x4a')]=_0x188868[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x188868[_0x93e0('0x4a')]:_0x3c1a0d[_0x93e0('0x4b')];if(!_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x188868[_0x93e0('0x1e')]=qs['limit'](_0x37f1bf['query'][_0x93e0('0x1e')]);_0x188868[_0x93e0('0x1c')]=qs[_0x93e0('0x1c')](_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x1c')]);}_0x188868[_0x93e0('0x50')]=qs[_0x93e0('0x51')](_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x51')]);_0x188868['where']=qs['filters'](_[_0x93e0('0x53')](_0x37f1bf[_0x93e0('0x47')],_0x3c1a0d['filters']));_0x188868[_0x93e0('0x52')][_0x93e0('0x66')]=_0x326141['id'];if(_0x37f1bf['query']['filter']){_0x188868['where']=_[_0x93e0('0x54')](_0x188868[_0x93e0('0x52')],{'$or':_[_0x93e0('0x42')](_0x188868[_0x93e0('0x4a')],function(_0x1f64e7){var _0x40aa81={};_0x40aa81[_0x1f64e7]={'$like':'%'+_0x37f1bf['query'][_0x93e0('0x55')]+'%'};return _0x40aa81;})});}_0x188868=_[_0x93e0('0x54')]({},_0x188868,_0x37f1bf['options']);return db[_0x93e0('0x84')][_0x93e0('0x1f')]({'where':_0x188868[_0x93e0('0x52')]})[_0x93e0('0x10')](function(_0x500ece){_0x479f24[_0x93e0('0x1f')]=_0x500ece;if(_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x5b')]){_0x188868[_0x93e0('0x57')]=[{'model':db['CmContact'],'as':_0x93e0('0x87'),'required':![]},{'model':db[_0x93e0('0x88')],'as':_0x93e0('0x89'),'attributes':['name',_0x93e0('0x8a'),_0x93e0('0x8b')],'required':![]},{'model':db[_0x93e0('0x8c')],'as':_0x93e0('0x8d'),'attributes':['id','name',_0x93e0('0x8e')],'where':_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x8f')]?{'id':_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x8f')]}:undefined,'required':_0x37f1bf['query'][_0x93e0('0x8f')]?!![]:![]}];}return db[_0x93e0('0x84')][_0x93e0('0x6b')](_0x188868);})['then'](function(_0x510ad7){_0x479f24[_0x93e0('0x58')]=_0x510ad7;return _0x479f24;});}})[_0x93e0('0x10')](respondWithFilteredResult(_0x23e334,_0x188868))['catch'](handleError(_0x23e334,null));};exports[_0x93e0('0x90')]=function addApplications(_0x3cab7d,_0x962e08){var _0x4cb4d6=_0x3cab7d['params']['id'];var _0x1f51d3=_0x3cab7d['body'];var _0x4b2064=0xc8;var _0x5759a5=null;return db[_0x93e0('0x91')]['transaction']({'isolationLevel':db[_0x93e0('0x91')][_0x93e0('0x92')][_0x93e0('0x93')][_0x93e0('0x94')]},function(_0x3bf5a5){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x4cb4d6},'transaction':_0x3bf5a5})[_0x93e0('0x10')](function(_0x1009d8){if(_0x1009d8){return db[_0x93e0('0x95')][_0x93e0('0x26')]({'where':{'MailAccountId':_0x4cb4d6},'transaction':_0x3bf5a5})[_0x93e0('0x10')](function(){var _0x55524a=_[_0x93e0('0x42')](_0x1f51d3,function(_0x22a071){_0x22a071[_0x93e0('0x66')]=_0x4cb4d6;return _0x22a071;});return db[_0x93e0('0x95')][_0x93e0('0x96')](_0x55524a,{'transaction':_0x3bf5a5});});}else{_0x4b2064=0x194;_0x5759a5=[];}});})['then'](function(){if(_0x4b2064!==0x194){return db[_0x93e0('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0x4cb4d6},'order':_0x93e0('0x97')})[_0x93e0('0x10')](function(_0x52e325){_0x5759a5=_0x52e325;});}})[_0x93e0('0x19')](function(_0x28243d){_0x4b2064=0x1f4;logger[_0x93e0('0x16')](_0x28243d[_0x93e0('0x98')]);if(_0x28243d[_0x93e0('0x27')]){delete _0x28243d[_0x93e0('0x27')];}_0x5759a5=_0x28243d;})['finally'](function(){if(_0x5759a5===null){_0x962e08['sendStatus'](_0x4b2064);}else{if(_0x4b2064===0x1f4){_0x962e08[_0x93e0('0x1a')](_0x4b2064)[_0x93e0('0x99')](_0x5759a5);}else{_0x962e08[_0x93e0('0x1a')](_0x4b2064)[_0x93e0('0x21')](_0x5759a5);}}});};exports['getApplications']=function(_0x2f23a2,_0x15eb1f){var _0x1c041a={};var _0x5b4159={};var _0x1c6fe2;var _0x39da90;return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x2f23a2[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x15eb1f,null))[_0x93e0('0x10')](function(_0x8d6226){if(_0x8d6226){_0x1c6fe2=_0x8d6226;_0x5b4159[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x95')][_0x93e0('0x43')]);_0x5b4159[_0x93e0('0x47')]=_['keys'](_0x2f23a2[_0x93e0('0x47')]);_0x5b4159[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x5b4159[_0x93e0('0x4b')],_0x5b4159[_0x93e0('0x47')]);_0x1c041a['attributes']=_['intersection'](_0x5b4159[_0x93e0('0x4b')],qs['fields'](_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x4c')]));_0x1c041a[_0x93e0('0x4a')]=_0x1c041a[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x1c041a[_0x93e0('0x4a')]:_0x5b4159['model'];_0x1c041a[_0x93e0('0x50')]=qs[_0x93e0('0x51')](_0x2f23a2['query'][_0x93e0('0x51')]);_0x1c041a[_0x93e0('0x52')]=qs[_0x93e0('0x48')](_[_0x93e0('0x53')](_0x2f23a2[_0x93e0('0x47')],_0x5b4159[_0x93e0('0x48')]));if(_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x55')]){_0x1c041a[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x1c041a['where'],{'$or':_[_0x93e0('0x42')](_0x1c041a[_0x93e0('0x4a')],function(_0x147248){var _0x1c5210={};_0x1c5210[_0x147248]={'$like':'%'+_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x1c5210;})});}_0x1c041a=_['merge']({},_0x1c041a,_0x2f23a2[_0x93e0('0x5c')]);return _0x1c6fe2[_0x93e0('0x9a')](_0x1c041a);}})['then'](function(_0x203af7){if(_0x203af7){_0x39da90=_0x203af7[_0x93e0('0x4d')];if(!_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x1c041a[_0x93e0('0x1e')]=qs[_0x93e0('0x1e')](_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x1e')]);_0x1c041a['offset']=qs['offset'](_0x2f23a2[_0x93e0('0x47')]['offset']);}return _0x1c6fe2['getApplications'](_0x1c041a);}})[_0x93e0('0x10')](function(_0xcadc23){if(_0xcadc23){return _0xcadc23?{'count':_0x39da90,'rows':_0xcadc23}:null;}})[_0x93e0('0x10')](respondWithResult(_0x15eb1f,null))[_0x93e0('0x19')](handleError(_0x15eb1f,null));};exports[_0x93e0('0x9b')]=function(_0x111ed9,_0x12e83c){var _0x214cee={'raw':!![],'where':{}};var _0x220b9f={};var _0xd39822={'count':0x0,'rows':[]};return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x111ed9['params']['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x12e83c,null))[_0x93e0('0x10')](function(_0x5c4cdb){if(_0x5c4cdb){_0x220b9f[_0x93e0('0x4b')]=_['keys'](db[_0x93e0('0x9c')]['rawAttributes']);_0x220b9f[_0x93e0('0x47')]=_['keys'](_0x111ed9['query']);_0x220b9f['filters']=_[_0x93e0('0x49')](_0x220b9f[_0x93e0('0x4b')],_0x220b9f[_0x93e0('0x47')]);_0x214cee[_0x93e0('0x4a')]=_[_0x93e0('0x49')](_0x220b9f[_0x93e0('0x4b')],qs[_0x93e0('0x4c')](_0x111ed9[_0x93e0('0x47')][_0x93e0('0x4c')]));_0x214cee[_0x93e0('0x4a')]=_0x214cee['attributes'][_0x93e0('0x4d')]?_0x214cee['attributes']:_0x220b9f[_0x93e0('0x4b')];if(!_0x111ed9['query'][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x214cee[_0x93e0('0x1e')]=qs[_0x93e0('0x1e')](_0x111ed9[_0x93e0('0x47')][_0x93e0('0x1e')]);_0x214cee['offset']=qs[_0x93e0('0x1c')](_0x111ed9[_0x93e0('0x47')]['offset']);}_0x214cee['order']=qs[_0x93e0('0x51')](_0x111ed9[_0x93e0('0x47')]['sort']);_0x214cee[_0x93e0('0x52')]=qs['filters'](_[_0x93e0('0x53')](_0x111ed9[_0x93e0('0x47')],_0x220b9f[_0x93e0('0x48')]));_0x214cee[_0x93e0('0x52')]['MailAccountId']=_0x5c4cdb['id'];if(_0x111ed9[_0x93e0('0x47')][_0x93e0('0x55')]){_0x214cee['where']=_['merge'](_0x214cee[_0x93e0('0x52')],{'$or':_[_0x93e0('0x42')](_0x214cee['attributes'],function(_0x3bc80b){var _0x3eff24={};_0x3eff24[_0x3bc80b]={'$like':'%'+_0x111ed9[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x3eff24;})});}if(_0x111ed9[_0x93e0('0x47')][_0x93e0('0x9d')]){var _0x2dd363=_0x111ed9['query'][_0x93e0('0x9d')][_0x93e0('0x9e')](',');var _0x2a7535={};_0x2a7535[_0x2dd363[0x0]]={'$gte':moment(_0x2dd363[0x1])[_0x93e0('0x9f')](_0x93e0('0xa0'))};_0x214cee['where']=_[_0x93e0('0x54')](_0x214cee[_0x93e0('0x52')],_0x2a7535);}_0x214cee=_[_0x93e0('0x54')]({},_0x214cee,_0x111ed9['options']);return db[_0x93e0('0x9c')][_0x93e0('0x1f')]({'where':_0x214cee[_0x93e0('0x52')]})['then'](function(_0x7edfce){_0xd39822[_0x93e0('0x1f')]=_0x7edfce;if(_0x111ed9[_0x93e0('0x47')][_0x93e0('0x5b')]){_0x214cee[_0x93e0('0x57')]=[{'all':!![]}];}return db[_0x93e0('0x9c')][_0x93e0('0x6b')](_0x214cee);})[_0x93e0('0x10')](function(_0x18f4fb){if(_0x111ed9[_0x93e0('0x47')]['inlineCss']===_0x93e0('0xa1')){for(var _0x289787=0x0;_0x289787<_0x18f4fb[_0x93e0('0x4d')];_0x289787++){_0x18f4fb[_0x289787][_0x93e0('0x5d')]=juice(_0x18f4fb[_0x289787][_0x93e0('0x5d')]);}}_0xd39822['rows']=_0x18f4fb;return _0xd39822;});}})[_0x93e0('0x10')](respondWithFilteredResult(_0x12e83c,_0x214cee))['catch'](handleError(_0x12e83c,null));};exports[_0x93e0('0x99')]=function(_0x168071,_0xe3529a){var _0x1ff737,_0x2c273f={},_0x4f279e;if(_0x168071[_0x93e0('0x5d')]['to']){_0x4f279e=_0x168071[_0x93e0('0x5d')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x93e0('0x60')]({'where':{'id':_0x168071[_0x93e0('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x93e0('0xa2'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x4f279e},'limit':0x1,'order':[[_0x93e0('0xa3'),'DESC']]}]},{'model':db[_0x93e0('0x3f')],'as':_0x93e0('0x3c'),'raw':!![],'include':[{'model':db[_0x93e0('0xa4')],'as':_0x93e0('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xe3529a,null))['then'](function(_0x187c7a){if(!_0x187c7a)return;_0x1ff737=_0x187c7a;if(!_0x187c7a['Smtp'])throw new Error(_0x93e0('0xa5'));if(_[_0x93e0('0x74')](_0x168071[_0x93e0('0x5d')][_0x93e0('0xa6')])){_0x168071[_0x93e0('0x5d')][_0x93e0('0xa6')]=util[_0x93e0('0x9f')](_0x93e0('0xa7'),_0x187c7a['name'],_0x187c7a[_0x93e0('0x72')]||_0x187c7a[_0x93e0('0x3c')][_0x93e0('0x31')]);}if(_0x168071[_0x93e0('0x5d')]['attachments']&&_0x168071[_0x93e0('0x5d')][_0x93e0('0xa8')][_0x93e0('0x4d')]){for(var _0x9c9070=0x0;_0x9c9070<_0x168071[_0x93e0('0x5d')][_0x93e0('0xa8')][_0x93e0('0x4d')];_0x9c9070+=0x1){_0x168071[_0x93e0('0x5d')][_0x93e0('0xa8')][_0x9c9070]={'filename':_0x168071['body']['attachments'][_0x9c9070][_0x93e0('0x27')],'path':path[_0x93e0('0xa9')](config[_0x93e0('0xaa')],'server/files/attachments',_0x168071[_0x93e0('0x5d')][_0x93e0('0xa8')][_0x9c9070][_0x93e0('0xab')])};}}var _0x46ee3b=_0x187c7a[_0x93e0('0xac')]();return respondWithRpcPromise(_0x93e0('0xad'),_0x93e0('0xae'),{'account':_0x46ee3b,'message':_0x168071['body']});})[_0x93e0('0x10')](function(_0x34c9a8){if(!_0x34c9a8)return;_0x2c273f=_0x34c9a8;if(!_0x1ff737[_0x93e0('0xa2')])throw new Error(_0x93e0('0xaf'));if(_0x1ff737[_0x93e0('0xa2')][_0x93e0('0xb0')][_0x93e0('0x4d')])return _0x1ff737[_0x93e0('0xa2')][_0x93e0('0xb0')][0x0];return db[_0x93e0('0xb1')][_0x93e0('0x68')](_[_0x93e0('0xb2')](_0x168071[_0x93e0('0x5d')],{'firstName':_0x168071[_0x93e0('0x5d')]['to'],'email':_0x168071[_0x93e0('0x5d')]['to'],'phone':_0x168071[_0x93e0('0x5d')]['to'],'ListId':_0x1ff737[_0x93e0('0x73')]}));})[_0x93e0('0x10')](function(_0x113cc6){if(!_0x113cc6)return;var _0x3fbb35={'UserId':_0x168071['user']['id'],'ContactId':_0x113cc6['id'],'MailAccountId':_0x1ff737['id'],'inReplyTo':_0x2c273f[_0x93e0('0xb3')],'to':_0x168071[_0x93e0('0x5d')][_0x93e0('0xa6')],'cc':_0x168071[_0x93e0('0x5d')]['cc'],'subject':_0x168071['body'][_0x93e0('0xb4')],'attach':_0x168071[_0x93e0('0x5d')][_0x93e0('0xb5')],'firstMsgDirection':_0x93e0('0xb6'),'lastMsgAt':moment()[_0x93e0('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x93e0('0xb6'),'Messages':[_[_0x93e0('0x54')](_0x168071[_0x93e0('0x5d')],{'messageId':_0x2c273f[_0x93e0('0xb3')],'sentAt':moment()[_0x93e0('0x9f')](_0x93e0('0xa0')),'read':!![],'MailAccountId':_0x1ff737['id'],'UserId':_0x168071[_0x93e0('0x31')]['id'],'ContactId':_0x113cc6['id']})]};if(_0x168071['body'][_0x93e0('0xb7')]){_0x3fbb35=_[_0x93e0('0x54')](_0x3fbb35,_0x168071[_0x93e0('0x5d')][_0x93e0('0xb7')]);}return db[_0x93e0('0x84')][_0x93e0('0x68')](_0x3fbb35,{'include':[{'model':db[_0x93e0('0x9c')],'as':'Messages'}]});})[_0x93e0('0x10')](respondWithResult(_0xe3529a,null))['catch'](handleError(_0xe3529a,null));};exports[_0x93e0('0xb8')]=function(_0x1c0055,_0x4db3d9){return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x1c0055[_0x93e0('0x61')]['id']},'include':[{'model':db[_0x93e0('0x3f')],'as':_0x93e0('0x3c'),'raw':!![],'include':[{'model':db[_0x93e0('0xa4')],'as':_0x93e0('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4db3d9,null))[_0x93e0('0x10')](function(_0x4752e1){if(!_0x4752e1[_0x93e0('0x3c')])return;var _0x4fd3bf=_0x4752e1[_0x93e0('0xac')]();return respondWithRpcPromise(_0x93e0('0xb9'),_0x93e0('0xb8'),{'account':_0x4fd3bf});})[_0x93e0('0x10')](respondWithResult(_0x4db3d9,null))[_0x93e0('0x19')](handleError(_0x4db3d9,null));};exports[_0x93e0('0x26')]=function(_0x4b6a02,_0x4e1267){return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x4b6a02[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x4e1267,null))[_0x93e0('0x10')](function(_0x1b35ec){if(_0x1b35ec&&_0x1b35ec[_0x93e0('0x63')]){throw new db[(_0x93e0('0xba'))]['ValidationError'](_0x93e0('0xbb'));}return _0x1b35ec;})[_0x93e0('0x10')](removeEntity(_0x4e1267,null))['catch'](handleError(_0x4e1267,null));};exports[_0x93e0('0xbc')]=function(_0x5d2306,_0x585339){return db['MailAccount']['find']({'where':{'id':_0x5d2306[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x585339,null))[_0x93e0('0x10')](function(_0x389481){if(_0x389481){return _0x389481[_0x93e0('0xbc')](_0x5d2306[_0x93e0('0x5d')][_0x93e0('0x71')],_[_0x93e0('0x85')](_0x5d2306['body'],[_0x93e0('0x71'),'id'])||{})[_0x93e0('0xbd')](function(_0x1f312b){for(var _0x4e314d=0x0;_0x4e314d<_0x5d2306[_0x93e0('0x5d')]['ids'][_0x93e0('0x4d')];_0x4e314d+=0x1){socket['emit'](_0x93e0('0xbe'),{'UserId':Number(_0x5d2306['body'][_0x93e0('0x71')][_0x4e314d]),'MailAccountId':Number(_0x5d2306['params']['id'])});}return _0x1f312b;});}})[_0x93e0('0x10')](respondWithResult(_0x585339,null))[_0x93e0('0x19')](handleError(_0x585339,null));};exports[_0x93e0('0xbf')]=function(_0x1212ff,_0x5b06fb){return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x1212ff['params']['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x5b06fb,null))[_0x93e0('0x10')](function(_0x2a78dd){if(_0x2a78dd){return _0x2a78dd[_0x93e0('0xbf')](_0x1212ff[_0x93e0('0x47')][_0x93e0('0x71')])[_0x93e0('0x10')](function(){if(_[_0x93e0('0xc0')](_0x1212ff[_0x93e0('0x47')][_0x93e0('0x71')])){for(var _0x10bc8f=0x0;_0x10bc8f<_0x1212ff['query'][_0x93e0('0x71')]['length'];_0x10bc8f+=0x1){socket[_0x93e0('0xc1')](_0x93e0('0xc2'),{'UserId':Number(_0x1212ff[_0x93e0('0x47')][_0x93e0('0x71')][_0x10bc8f]),'MailAccountId':Number(_0x1212ff['params']['id'])});}}else{socket[_0x93e0('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x1212ff[_0x93e0('0x47')][_0x93e0('0x71')]),'MailAccountId':Number(_0x1212ff[_0x93e0('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x5b06fb,null))[_0x93e0('0x19')](handleError(_0x5b06fb,null));};exports[_0x93e0('0xc3')]=function(_0x5fae6f,_0x584e74){var _0x536366={};var _0x237ae1={};var _0x204da1;var _0x22492b;return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x5fae6f[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x584e74,null))[_0x93e0('0x10')](function(_0x1069af){if(_0x1069af){_0x204da1=_0x1069af;_0x237ae1[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x88')][_0x93e0('0x43')]);_0x237ae1[_0x93e0('0x47')]=_[_0x93e0('0x5a')](_0x5fae6f['query']);_0x237ae1[_0x93e0('0x48')]=_['intersection'](_0x237ae1[_0x93e0('0x4b')],_0x237ae1[_0x93e0('0x47')]);_0x536366[_0x93e0('0x4a')]=_['intersection'](_0x237ae1['model'],qs[_0x93e0('0x4c')](_0x5fae6f[_0x93e0('0x47')][_0x93e0('0x4c')]));_0x536366[_0x93e0('0x4a')]=_0x536366[_0x93e0('0x4a')]['length']?_0x536366[_0x93e0('0x4a')]:_0x237ae1[_0x93e0('0x4b')];_0x536366[_0x93e0('0x50')]=qs[_0x93e0('0x51')](_0x5fae6f['query'][_0x93e0('0x51')]);_0x536366[_0x93e0('0x52')]=qs[_0x93e0('0x48')](_['pick'](_0x5fae6f[_0x93e0('0x47')],_0x237ae1[_0x93e0('0x48')]));if(_0x5fae6f[_0x93e0('0x47')]['filter']){_0x536366[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x536366['where'],{'$or':_[_0x93e0('0x42')](_0x536366[_0x93e0('0x4a')],function(_0x3a61fa){var _0x1ec062={};_0x1ec062[_0x3a61fa]={'$like':'%'+_0x5fae6f[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x1ec062;})});}_0x536366=_[_0x93e0('0x54')]({},_0x536366,_0x5fae6f['options']);return _0x204da1[_0x93e0('0xc3')](_0x536366);}})[_0x93e0('0x10')](function(_0x5c619c){if(_0x5c619c){_0x22492b=_0x5c619c['length'];if(!_0x5fae6f['query']['hasOwnProperty'](_0x93e0('0x4f'))){_0x536366[_0x93e0('0x1e')]=qs[_0x93e0('0x1e')](_0x5fae6f['query'][_0x93e0('0x1e')]);_0x536366['offset']=qs[_0x93e0('0x1c')](_0x5fae6f[_0x93e0('0x47')]['offset']);}return _0x204da1[_0x93e0('0xc3')](_0x536366);}})[_0x93e0('0x10')](function(_0x15e8df){if(_0x15e8df){return _0x15e8df?{'count':_0x22492b,'rows':_0x15e8df}:null;}})[_0x93e0('0x10')](respondWithResult(_0x584e74,null))[_0x93e0('0x19')](handleError(_0x584e74,null));}; \ No newline at end of file +var _0xa84d=['result','sendStatus','status','end','offset','undefined','limit','count','set','json','update','destroy','then','get','MailAccounts','UserProfileResource','stack','name','send','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Smtp','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','MailAccount','includeAll','include','findAll','rows','catch','show','params','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','Disposition','create','getDispositions','findOne','order','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','email','ListId','isNil','active','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','omit','getInteractions','MailInteraction','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','$gte','split','format','inlineCss','true','CmList','List','CmContact','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','getSmtpOptions','List\x20not\x20found','Contacts','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa84d,0x159));var _0xda84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa84d[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var BPromise=require(_0xda84('0x0'));var util=require(_0xda84('0x1'));var path=require('path');var _=require(_0xda84('0x2'));var juice=require(_0xda84('0x3'));var Redis=require(_0xda84('0x4'));var qs=require(_0xda84('0x5'));var logger=require('../../config/logger')(_0xda84('0x6'));var config=require(_0xda84('0x7'));var db=require('../../mysqldb')['db'];config[_0xda84('0x8')]=_[_0xda84('0x9')](config[_0xda84('0x8')],{'host':_0xda84('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xda84('0xb'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xda84('0xc')]['http']({'port':0x232b});function respondWithRpcPromise(_0x465351,_0x4b3150,_0x12a1f7,_0x5ae261){return new BPromise(function(_0x4462ca,_0x5e008a){var _0x5c0205=_0x5ae261||client;return _0x5c0205[_0xda84('0xd')](_0x465351,_0x12a1f7)['then'](function(_0x3f0a47){logger[_0xda84('0xe')](_0xda84('0xf'),_0x4b3150,_0xda84('0x10'));logger[_0xda84('0x11')](_0xda84('0x12'),_0x4b3150,'request\x20sent',JSON[_0xda84('0x13')](_0x3f0a47));if(_0x3f0a47[_0xda84('0x14')]){if(_0x3f0a47[_0xda84('0x14')][_0xda84('0x15')]===0x1f4){logger[_0xda84('0x14')]('MailAccount,\x20%s,\x20%s',_0x4b3150,_0x3f0a47[_0xda84('0x14')][_0xda84('0x16')]);return _0x5e008a(_0x3f0a47[_0xda84('0x14')]['message']);}logger[_0xda84('0x14')](_0xda84('0xf'),_0x4b3150,_0x3f0a47[_0xda84('0x14')][_0xda84('0x16')]);return _0x4462ca(_0x3f0a47['error'][_0xda84('0x16')]);}else{logger[_0xda84('0xe')](_0xda84('0xf'),_0x4b3150,_0xda84('0x10'));_0x4462ca(_0x3f0a47[_0xda84('0x17')]['message']);}})['catch'](function(_0x4d7133){logger[_0xda84('0x14')](_0xda84('0xf'),_0x4b3150,_0x4d7133);_0x5e008a(_0x4d7133);});});}function respondWithStatusCode(_0x13fa5f,_0x5a8e3b){_0x5a8e3b=_0x5a8e3b||0xcc;return function(_0x456493){if(_0x456493){return _0x13fa5f[_0xda84('0x18')](_0x5a8e3b);}return _0x13fa5f[_0xda84('0x19')](_0x5a8e3b)[_0xda84('0x1a')]();};}function respondWithResult(_0x22f8d4,_0x50b04d){_0x50b04d=_0x50b04d||0xc8;return function(_0x53bc05){if(_0x53bc05){return _0x22f8d4[_0xda84('0x19')](_0x50b04d)['json'](_0x53bc05);}};}function respondWithFilteredResult(_0x10cac5,_0x512aed){return function(_0xfd637f){if(_0xfd637f){var _0x27d45b=typeof _0x512aed[_0xda84('0x1b')]===_0xda84('0x1c')&&typeof _0x512aed[_0xda84('0x1d')]===_0xda84('0x1c');var _0x21e7dd=_0xfd637f[_0xda84('0x1e')];var _0x347342=_0x27d45b?0x0:_0x512aed[_0xda84('0x1b')];var _0x569041=_0x27d45b?_0xfd637f['count']:_0x512aed['offset']+_0x512aed[_0xda84('0x1d')];var _0x4c35e6;if(_0x569041>=_0x21e7dd){_0x569041=_0x21e7dd;_0x4c35e6=0xc8;}else{_0x4c35e6=0xce;}_0x10cac5[_0xda84('0x19')](_0x4c35e6);return _0x10cac5[_0xda84('0x1f')]('Content-Range',_0x347342+'-'+_0x569041+'/'+_0x21e7dd)[_0xda84('0x20')](_0xfd637f);}return null;};}function saveUpdates(_0x278e2d){return function(_0x27c6c2){if(_0x27c6c2){return _0x27c6c2[_0xda84('0x21')](_0x278e2d)['then'](function(_0x123104){return _0x123104;});}return null;};}function removeEntity(_0x1e93a2){return function(_0x5cbedc){if(_0x5cbedc){return _0x5cbedc[_0xda84('0x22')]()[_0xda84('0x23')](function(){var _0x43ed9c=_0x5cbedc[_0xda84('0x24')]({'plain':!![]});var _0xbba4ab=_0xda84('0x25');return db[_0xda84('0x26')][_0xda84('0x22')]({'where':{'type':_0xbba4ab,'resourceId':_0x43ed9c['id']}})[_0xda84('0x23')](function(){return _0x5cbedc;});})[_0xda84('0x23')](function(){_0x1e93a2[_0xda84('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c3bb){return function(_0x3e8189){if(!_0x3e8189){_0x48c3bb['sendStatus'](0x194);}return _0x3e8189;};}function handleError(_0x4b9657,_0x3fa29e){_0x3fa29e=_0x3fa29e||0x1f4;return function(_0x2fd14a){logger[_0xda84('0x14')](_0x2fd14a[_0xda84('0x27')]);if(_0x2fd14a[_0xda84('0x28')]){delete _0x2fd14a[_0xda84('0x28')];}_0x4b9657[_0xda84('0x19')](_0x3fa29e)[_0xda84('0x29')](_0x2fd14a);};}function getImapHost(_0x47a2c5){switch(_0x47a2c5){case _0xda84('0x2a'):return'imap.gmail.com';case _0xda84('0x2b'):return'imap.mail.yahoo.com';case _0xda84('0x2c'):return _0xda84('0x2d');case _0xda84('0x2e'):return _0xda84('0x2f');}throw new Error(_0xda84('0x30'),_0x47a2c5);}function getSmtpHost(_0x4e3eae){switch(_0x4e3eae){case _0xda84('0x2a'):return _0xda84('0x31');case _0xda84('0x2b'):return _0xda84('0x32');case _0xda84('0x2c'):return _0xda84('0x33');case _0xda84('0x2e'):return _0xda84('0x34');}throw new Error(_0xda84('0x30'),_0x4e3eae);}function getAuthenticationOptions(_0x32e25f,_0x13ff3b){var _0x40ce6e={};var _0x406922={};if(_0x32e25f){_0x40ce6e[_0xda84('0x35')]=_0x406922[_0xda84('0x35')]=_0x13ff3b[_0xda84('0x36')];_0x40ce6e[_0xda84('0x37')]=_0x406922[_0xda84('0x38')]=_0x13ff3b['password'];if(_0x13ff3b[_0xda84('0x39')]){_0x40ce6e[_0xda84('0x39')]=_0x406922[_0xda84('0x39')]=!![];_0x40ce6e[_0xda84('0x3a')]=_0x406922[_0xda84('0x3a')]=_0x13ff3b[_0xda84('0x3a')];_0x40ce6e[_0xda84('0x37')]=_0x406922['pass']=null;}else{_0x40ce6e[_0xda84('0x3a')]=_0x406922[_0xda84('0x3a')]=null;}_0x40ce6e[_0xda84('0x3b')]=getImapHost(_0x32e25f);_0x40ce6e[_0xda84('0x3c')]=0x3e1;_0x406922[_0xda84('0x3b')]=getSmtpHost(_0x32e25f);_0x406922['port']=0x24b;_0x406922[_0xda84('0x3d')]=![];_0x40ce6e['service']=_0x406922[_0xda84('0x3e')]=null;}else{if(_0x13ff3b[_0xda84('0x3f')]){_0x40ce6e[_0xda84('0x35')]=_0x406922[_0xda84('0x35')]=_0x13ff3b[_0xda84('0x36')];_0x40ce6e[_0xda84('0x37')]=_0x406922[_0xda84('0x38')]=_0x13ff3b['password'];}else{_0x40ce6e[_0xda84('0x3f')]=_0x406922[_0xda84('0x3f')]=![];_0x40ce6e[_0xda84('0x35')]=_0x406922['user']=null;_0x40ce6e['password']=_0x406922['pass']=null;}_0x40ce6e[_0xda84('0x3b')]=_0x13ff3b['Imap']['host'];_0x40ce6e[_0xda84('0x3c')]=_0x13ff3b['Imap']['port'];_0x406922[_0xda84('0x3b')]=_0x13ff3b[_0xda84('0x40')][_0xda84('0x3b')];_0x406922['port']=_0x13ff3b[_0xda84('0x40')][_0xda84('0x3c')];}return{'Imap':_0x40ce6e,'Smtp':_0x406922};}exports['index']=function(_0x380769,_0x6fdfca){var _0xf43a61={'include':[{'model':db[_0xda84('0x41')],'as':_0xda84('0x42')},{'model':db[_0xda84('0x43')],'as':_0xda84('0x40')},{'model':db[_0xda84('0x44')],'as':_0xda84('0x45')}]},_0x330aff={},_0x5ad143={'count':0x0,'rows':[]};var _0x45d9c7=_[_0xda84('0x46')](db['MailAccount'][_0xda84('0x47')],function(_0xca3b7b){return{'name':_0xca3b7b[_0xda84('0x48')],'type':_0xca3b7b[_0xda84('0x49')][_0xda84('0x4a')]};});_0x330aff['model']=_[_0xda84('0x46')](_0x45d9c7,_0xda84('0x28'));_0x330aff[_0xda84('0x4b')]=_[_0xda84('0x4c')](_0x380769[_0xda84('0x4b')]);_0x330aff[_0xda84('0x4d')]=_[_0xda84('0x4e')](_0x330aff[_0xda84('0x4f')],_0x330aff['query']);_0xf43a61['attributes']=_[_0xda84('0x4e')](_0x330aff[_0xda84('0x4f')],qs[_0xda84('0x50')](_0x380769[_0xda84('0x4b')][_0xda84('0x50')]));_0xf43a61[_0xda84('0x51')]=_0xf43a61[_0xda84('0x51')][_0xda84('0x52')]?_0xf43a61[_0xda84('0x51')]:_0x330aff['model'];if(!_0x380769[_0xda84('0x4b')][_0xda84('0x53')](_0xda84('0x54'))){_0xf43a61[_0xda84('0x1d')]=qs['limit'](_0x380769[_0xda84('0x4b')][_0xda84('0x1d')]);_0xf43a61[_0xda84('0x1b')]=qs[_0xda84('0x1b')](_0x380769[_0xda84('0x4b')][_0xda84('0x1b')]);}_0xf43a61['order']=qs['sort'](_0x380769[_0xda84('0x4b')][_0xda84('0x55')]);_0xf43a61[_0xda84('0x56')]=qs[_0xda84('0x4d')](_[_0xda84('0x57')](_0x380769[_0xda84('0x4b')],_0x330aff['filters']),_0x45d9c7);if(_0x380769[_0xda84('0x4b')][_0xda84('0x58')]){_0xf43a61[_0xda84('0x56')]=_[_0xda84('0x59')](_0xf43a61['where'],{'$or':_[_0xda84('0x46')](_0x45d9c7,function(_0x2ee31e){if(_0x2ee31e['type']!=='VIRTUAL'){var _0x1d84f8={};_0x1d84f8[_0x2ee31e[_0xda84('0x28')]]={'$like':'%'+_0x380769[_0xda84('0x4b')][_0xda84('0x58')]+'%'};return _0x1d84f8;}})});}_0xf43a61=_['merge']({},_0xf43a61,_0x380769[_0xda84('0x5a')]);var _0x1fbdb4={'where':_0xf43a61[_0xda84('0x56')]};return db[_0xda84('0x5b')]['count'](_0x1fbdb4)[_0xda84('0x23')](function(_0x2a22ba){_0x5ad143[_0xda84('0x1e')]=_0x2a22ba;if(_0x380769[_0xda84('0x4b')][_0xda84('0x5c')]){_0xf43a61[_0xda84('0x5d')]=[{'all':!![]}];}return db[_0xda84('0x5b')][_0xda84('0x5e')](_0xf43a61);})[_0xda84('0x23')](function(_0x3cbe3c){_0x5ad143[_0xda84('0x5f')]=_0x3cbe3c;return _0x5ad143;})['then'](respondWithFilteredResult(_0x6fdfca,_0xf43a61))[_0xda84('0x60')](handleError(_0x6fdfca,null));};exports[_0xda84('0x61')]=function(_0x2416a6,_0x194e5a){var _0x420b10={'raw':![],'where':{'id':_0x2416a6[_0xda84('0x62')]['id']},'include':[{'model':db[_0xda84('0x41')],'as':_0xda84('0x42')},{'model':db[_0xda84('0x43')],'as':_0xda84('0x40')},{'model':db[_0xda84('0x44')],'as':_0xda84('0x45')}]},_0xcecd3b={};_0xcecd3b['model']=_['keys'](db['MailAccount'][_0xda84('0x47')]);_0xcecd3b[_0xda84('0x4b')]=_[_0xda84('0x4c')](_0x2416a6[_0xda84('0x4b')]);_0xcecd3b[_0xda84('0x4d')]=_[_0xda84('0x4e')](_0xcecd3b[_0xda84('0x4f')],_0xcecd3b['query']);_0x420b10[_0xda84('0x51')]=_[_0xda84('0x4e')](_0xcecd3b[_0xda84('0x4f')],qs[_0xda84('0x50')](_0x2416a6[_0xda84('0x4b')][_0xda84('0x50')]));_0x420b10[_0xda84('0x51')]=_0x420b10[_0xda84('0x51')][_0xda84('0x52')]?_0x420b10[_0xda84('0x51')]:_0xcecd3b['model'];if(_0x2416a6[_0xda84('0x4b')][_0xda84('0x5c')]){_0x420b10[_0xda84('0x5d')]=[{'all':!![]}];}_0x420b10=_[_0xda84('0x59')]({},_0x420b10,_0x2416a6[_0xda84('0x5a')]);return db[_0xda84('0x5b')][_0xda84('0x63')](_0x420b10)['then'](handleEntityNotFound(_0x194e5a,null))[_0xda84('0x23')](respondWithResult(_0x194e5a,null))[_0xda84('0x60')](handleError(_0x194e5a,null));};exports[_0xda84('0x21')]=function(_0x13dbc3,_0x14e904){if(_0x13dbc3[_0xda84('0x64')]['id']){delete _0x13dbc3[_0xda84('0x64')]['id'];}var _0x2f7f52=_0x13dbc3[_0xda84('0x64')][_0xda84('0x65')]===_0xda84('0x66')?null:_0x13dbc3[_0xda84('0x64')]['provider'];var _0x342287=_0x13dbc3[_0xda84('0x64')]['Imap']||{};var _0x1d29ba=_0x13dbc3['body'][_0xda84('0x40')]||{};if(_0x2f7f52){_0x342287[_0xda84('0x3b')]=getImapHost(_0x2f7f52);_0x342287[_0xda84('0x3c')]=0x3e1;_0x1d29ba[_0xda84('0x3b')]=getSmtpHost(_0x2f7f52);_0x1d29ba[_0xda84('0x3c')]=0x24b;_0x1d29ba[_0xda84('0x3d')]=![];}if(_0x1d29ba[_0xda84('0x39')]){_0x1d29ba[_0xda84('0x3d')]=![];}else{_0x1d29ba[_0xda84('0x3a')]=null;}if(!_0x342287['modernAuthentication'])_0x342287[_0xda84('0x3a')]=null;_0x13dbc3['body'][_0xda84('0x42')]=_0x342287;_0x13dbc3[_0xda84('0x64')][_0xda84('0x40')]=_0x1d29ba;return db[_0xda84('0x5b')][_0xda84('0x63')]({'where':{'id':_0x13dbc3[_0xda84('0x62')]['id']},'include':[{'model':db[_0xda84('0x41')],'as':_0xda84('0x42')},{'model':db[_0xda84('0x43')],'as':_0xda84('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xda84('0x23')](handleEntityNotFound(_0x14e904,null))['then'](function(_0x582125){if(!_0x582125)throw new Error(_0xda84('0x67'));if(_0x582125[_0xda84('0x3e')])delete _0x13dbc3['body'][_0xda84('0x42')];return _0x582125;})[_0xda84('0x23')](saveUpdates(_0x13dbc3[_0xda84('0x64')],null))[_0xda84('0x23')](function(_0x2e75c6){if(!_0x13dbc3['body'][_0xda84('0x42')])return _0x2e75c6;return db[_0xda84('0x41')][_0xda84('0x21')](_0x13dbc3['body']['Imap'],{'where':{'MailAccountId':_0x2e75c6['id']}})[_0xda84('0x23')](function(){return _0x2e75c6;});})[_0xda84('0x23')](function(_0x46d815){if(!_0x13dbc3[_0xda84('0x64')][_0xda84('0x40')])return _0x46d815;return db[_0xda84('0x43')][_0xda84('0x21')](_0x13dbc3[_0xda84('0x64')][_0xda84('0x40')],{'where':{'MailAccountId':_0x46d815['id']}})['then'](function(){return _0x46d815;});})['then'](respondWithResult(_0x14e904,null))[_0xda84('0x60')](handleError(_0x14e904,null));};exports[_0xda84('0x68')]=function(_0x52363e,_0x2d1b4f){return db[_0xda84('0x5b')][_0xda84('0x68')]()[_0xda84('0x23')](respondWithResult(_0x2d1b4f,null))['catch'](handleError(_0x2d1b4f,null));};exports['addDisposition']=function(_0x30cbbd,_0x540594){if(_0x30cbbd[_0xda84('0x64')]['id']){delete _0x30cbbd[_0xda84('0x64')]['id'];}return db[_0xda84('0x5b')][_0xda84('0x63')]({'where':{'id':_0x30cbbd['params']['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x540594,null))[_0xda84('0x23')](function(_0x5afdcb){if(_0x5afdcb){_0x30cbbd[_0xda84('0x64')]['MailAccountId']=_0x5afdcb['id'];return db[_0xda84('0x69')][_0xda84('0x6a')](_0x30cbbd['body']);}})[_0xda84('0x23')](respondWithResult(_0x540594,null))[_0xda84('0x60')](handleError(_0x540594,null));};exports[_0xda84('0x6b')]=function(_0x23d527,_0x4aec6d){var _0x3360e7={'raw':![],'where':{}};var _0x3e33e0={};var _0x3949aa={'count':0x0,'rows':[]};return db[_0xda84('0x5b')][_0xda84('0x6c')]({'where':{'id':_0x23d527[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x4aec6d,null))['then'](function(_0x1f264c){if(_0x1f264c){_0x3e33e0[_0xda84('0x4f')]=_['keys'](db[_0xda84('0x69')][_0xda84('0x47')]);_0x3e33e0[_0xda84('0x4b')]=_['keys'](_0x23d527[_0xda84('0x4b')]);_0x3e33e0[_0xda84('0x4d')]=_['intersection'](_0x3e33e0['model'],_0x3e33e0[_0xda84('0x4b')]);_0x3360e7['attributes']=_[_0xda84('0x4e')](_0x3e33e0['model'],qs[_0xda84('0x50')](_0x23d527[_0xda84('0x4b')][_0xda84('0x50')]));_0x3360e7[_0xda84('0x51')]=_0x3360e7[_0xda84('0x51')][_0xda84('0x52')]?_0x3360e7[_0xda84('0x51')]:_0x3e33e0[_0xda84('0x4f')];if(!_0x23d527[_0xda84('0x4b')][_0xda84('0x53')]('nolimit')){_0x3360e7[_0xda84('0x1d')]=qs[_0xda84('0x1d')](_0x23d527[_0xda84('0x4b')][_0xda84('0x1d')]);_0x3360e7['offset']=qs['offset'](_0x23d527[_0xda84('0x4b')]['offset']);}_0x3360e7[_0xda84('0x6d')]=qs[_0xda84('0x55')](_0x23d527[_0xda84('0x4b')][_0xda84('0x55')]);_0x3360e7['where']=qs['filters'](_[_0xda84('0x57')](_0x23d527[_0xda84('0x4b')],_0x3e33e0['filters']));_0x3360e7['where']['MailAccountId']=_0x1f264c['id'];if(_0x23d527['query'][_0xda84('0x58')]){_0x3360e7[_0xda84('0x56')]=_['merge'](_0x3360e7[_0xda84('0x56')],{'$or':_[_0xda84('0x46')](_0x3360e7[_0xda84('0x51')],function(_0x52d2e3){var _0x1987e={};_0x1987e[_0x52d2e3]={'$like':'%'+_0x23d527[_0xda84('0x4b')][_0xda84('0x58')]+'%'};return _0x1987e;})});}_0x3360e7=_[_0xda84('0x59')]({},_0x3360e7,_0x23d527[_0xda84('0x5a')]);return db[_0xda84('0x69')][_0xda84('0x1e')]({'where':_0x3360e7[_0xda84('0x56')]})[_0xda84('0x23')](function(_0x442b5d){_0x3949aa[_0xda84('0x1e')]=_0x442b5d;if(_0x23d527[_0xda84('0x4b')][_0xda84('0x5c')]){_0x3360e7[_0xda84('0x5d')]=[{'all':!![]}];}return db[_0xda84('0x69')][_0xda84('0x5e')](_0x3360e7);})['then'](function(_0x54ccf0){_0x3949aa[_0xda84('0x5f')]=_0x54ccf0;return _0x3949aa;});}})[_0xda84('0x23')](respondWithFilteredResult(_0x4aec6d,_0x3360e7))[_0xda84('0x60')](handleError(_0x4aec6d,null));};exports[_0xda84('0x6e')]=function(_0x4021fc,_0x3ae5b6){return db[_0xda84('0x5b')][_0xda84('0x63')]({'where':{'id':_0x4021fc[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x3ae5b6,null))[_0xda84('0x23')](function(_0x1d40ab){if(_0x1d40ab){return _0x1d40ab[_0xda84('0x6e')](_0x4021fc[_0xda84('0x4b')][_0xda84('0x6f')]);}})[_0xda84('0x23')](respondWithStatusCode(_0x3ae5b6,null))['catch'](handleError(_0x3ae5b6,null));};exports[_0xda84('0x70')]=function(_0x2d2316,_0x36c3d0){if(_0x2d2316[_0xda84('0x64')]['id']){delete _0x2d2316['body']['id'];}return db['MailAccount'][_0xda84('0x63')]({'where':{'id':_0x2d2316[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x36c3d0,null))[_0xda84('0x23')](function(_0x4587de){if(_0x4587de){_0x2d2316['body'][_0xda84('0x71')]=_0x4587de['id'];return db[_0xda84('0x72')][_0xda84('0x6a')](_0x2d2316['body']);}})[_0xda84('0x23')](respondWithResult(_0x36c3d0,null))[_0xda84('0x60')](handleError(_0x36c3d0,null));};exports[_0xda84('0x73')]=function(_0xc97eb3,_0x46e554){var _0x159c15={'raw':![],'where':{}};var _0xc549a5={};var _0x535622={'count':0x0,'rows':[]};return db[_0xda84('0x5b')][_0xda84('0x6c')]({'where':{'id':_0xc97eb3[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x46e554,null))[_0xda84('0x23')](function(_0x6446c7){if(_0x6446c7){_0xc549a5[_0xda84('0x4f')]=_[_0xda84('0x4c')](db[_0xda84('0x72')][_0xda84('0x47')]);_0xc549a5[_0xda84('0x4b')]=_[_0xda84('0x4c')](_0xc97eb3[_0xda84('0x4b')]);_0xc549a5[_0xda84('0x4d')]=_['intersection'](_0xc549a5[_0xda84('0x4f')],_0xc549a5[_0xda84('0x4b')]);_0x159c15[_0xda84('0x51')]=_['intersection'](_0xc549a5[_0xda84('0x4f')],qs[_0xda84('0x50')](_0xc97eb3[_0xda84('0x4b')]['fields']));_0x159c15[_0xda84('0x51')]=_0x159c15[_0xda84('0x51')][_0xda84('0x52')]?_0x159c15[_0xda84('0x51')]:_0xc549a5[_0xda84('0x4f')];if(!_0xc97eb3[_0xda84('0x4b')][_0xda84('0x53')](_0xda84('0x54'))){_0x159c15[_0xda84('0x1d')]=qs[_0xda84('0x1d')](_0xc97eb3['query'][_0xda84('0x1d')]);_0x159c15['offset']=qs[_0xda84('0x1b')](_0xc97eb3['query'][_0xda84('0x1b')]);}_0x159c15[_0xda84('0x6d')]=qs[_0xda84('0x55')](_0xc97eb3['query'][_0xda84('0x55')]);_0x159c15[_0xda84('0x56')]=qs[_0xda84('0x4d')](_['pick'](_0xc97eb3[_0xda84('0x4b')],_0xc549a5[_0xda84('0x4d')]));_0x159c15[_0xda84('0x56')][_0xda84('0x71')]=_0x6446c7['id'];if(_0xc97eb3['query'][_0xda84('0x58')]){_0x159c15[_0xda84('0x56')]=_['merge'](_0x159c15[_0xda84('0x56')],{'$or':_['map'](_0x159c15[_0xda84('0x51')],function(_0xd2dfc9){var _0xfae4={};_0xfae4[_0xd2dfc9]={'$like':'%'+_0xc97eb3['query'][_0xda84('0x58')]+'%'};return _0xfae4;})});}_0x159c15=_[_0xda84('0x59')]({},_0x159c15,_0xc97eb3[_0xda84('0x5a')]);return db[_0xda84('0x72')]['count']({'where':_0x159c15[_0xda84('0x56')]})['then'](function(_0x3aaa5c){_0x535622['count']=_0x3aaa5c;if(_0xc97eb3['query'][_0xda84('0x5c')]){_0x159c15['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xda84('0x5e')](_0x159c15);})[_0xda84('0x23')](function(_0x582306){_0x535622[_0xda84('0x5f')]=_0x582306;return _0x535622;});}})[_0xda84('0x23')](respondWithFilteredResult(_0x46e554,_0x159c15))[_0xda84('0x60')](handleError(_0x46e554,null));};exports['removeAnswers']=function(_0x5625b1,_0x1f3151){return db[_0xda84('0x5b')][_0xda84('0x63')]({'where':{'id':_0x5625b1['params']['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x1f3151,null))['then'](function(_0x2aa012){if(_0x2aa012){return _0x2aa012['removeAnswers'](_0x5625b1['query']['ids']);}})['then'](respondWithStatusCode(_0x1f3151,null))[_0xda84('0x60')](handleError(_0x1f3151,null));};exports[_0xda84('0x6a')]=function(_0x48195b,_0x3ec56d){var _0x1b8d73={'name':_0x48195b['body']['name'],'key':_0x48195b['body'][_0xda84('0x4a')],'provider':_0x48195b[_0xda84('0x64')][_0xda84('0x65')]===_0xda84('0x66')?null:_0x48195b['body']['provider'],'email':_0x48195b['body'][_0xda84('0x74')],'ListId':_0x48195b['body'][_0xda84('0x75')],'active':!_[_0xda84('0x76')](_0x48195b['body'][_0xda84('0x77')])?_0x48195b['body'][_0xda84('0x77')]:!![],'description':_0x48195b[_0xda84('0x64')]['description']||null};var _0x37e07b=getAuthenticationOptions(_0x1b8d73[_0xda84('0x65')],_0x48195b[_0xda84('0x64')]);_0x1b8d73[_0xda84('0x42')]=_0x37e07b[_0xda84('0x42')];_0x1b8d73[_0xda84('0x40')]=_0x37e07b[_0xda84('0x40')];return db[_0xda84('0x5b')][_0xda84('0x6a')](_0x1b8d73,{'include':[{'model':db[_0xda84('0x43')],'as':_0xda84('0x40')},{'model':db[_0xda84('0x41')],'as':_0xda84('0x42')}]})[_0xda84('0x23')](function(_0x54feb2){var _0x6f72c0=_0x48195b[_0xda84('0x35')][_0xda84('0x24')]({'plain':!![]});if(!_0x6f72c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6f72c0[_0xda84('0x78')]===_0xda84('0x35')){var _0x2e7601=_0x54feb2[_0xda84('0x24')]({'plain':!![]});return db[_0xda84('0x79')][_0xda84('0x63')]({'where':{'name':'MailAccounts','userProfileId':_0x6f72c0['userProfileId']},'raw':!![]})[_0xda84('0x23')](function(_0x447a90){if(_0x447a90&&_0x447a90[_0xda84('0x7a')]===0x0){return db[_0xda84('0x26')][_0xda84('0x6a')]({'name':_0x2e7601['name'],'resourceId':_0x2e7601['id'],'type':_0x447a90[_0xda84('0x28')],'sectionId':_0x447a90['id']},{})[_0xda84('0x23')](function(){return _0x54feb2;});}else{return _0x54feb2;}})[_0xda84('0x60')](function(_0x52acfc){logger[_0xda84('0x14')](_0xda84('0x7b'),_0x52acfc);throw _0x52acfc;});}return _0x54feb2;})[_0xda84('0x23')](respondWithResult(_0x3ec56d,0xc9))[_0xda84('0x60')](handleError(_0x3ec56d,null));};exports[_0xda84('0x7c')]=function(_0x3a5a47,_0x189a60){return db[_0xda84('0x5b')][_0xda84('0x6c')]({'where':{'id':_0x3a5a47['params']['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x189a60,null))['then'](function(_0x3c8a44){if(_0x3c8a44){return _0x3c8a44[_0xda84('0x7c')]();}return null;})[_0xda84('0x23')](respondWithResult(_0x189a60,null))[_0xda84('0x60')](handleError(_0x189a60,null));};exports['addImap']=function(_0x1d265d,_0x20c40d){if(_0x1d265d[_0xda84('0x64')]['id']){delete _0x1d265d[_0xda84('0x64')]['id'];}return db[_0xda84('0x5b')][_0xda84('0x63')]({'where':{'id':_0x1d265d[_0xda84('0x62')]['id']}})['then'](handleEntityNotFound(_0x20c40d,null))['then'](function(_0x3a51ac){if(_0x3a51ac){_0x1d265d[_0xda84('0x64')][_0xda84('0x71')]=_0x3a51ac['id'];return db[_0xda84('0x41')][_0xda84('0x6a')](_0x1d265d['body']);}})[_0xda84('0x23')](respondWithResult(_0x20c40d,null))[_0xda84('0x60')](handleError(_0x20c40d,null));};exports[_0xda84('0x7d')]=function(_0x4aaf73,_0x28deed){return db[_0xda84('0x5b')][_0xda84('0x6c')]({'where':{'id':_0x4aaf73[_0xda84('0x62')]['id']}})['then'](handleEntityNotFound(_0x28deed,null))['then'](function(_0x48404f){if(_0x48404f){return _0x48404f[_0xda84('0x7e')](null);}return null;})[_0xda84('0x23')](respondWithStatusCode(_0x28deed,null))[_0xda84('0x60')](handleError(_0x28deed,null));};exports['getSmtp']=function(_0x4afd10,_0x23c941){return db[_0xda84('0x5b')]['findOne']({'where':{'id':_0x4afd10[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x23c941,null))[_0xda84('0x23')](function(_0xceb7ba){if(_0xceb7ba){return _0xceb7ba[_0xda84('0x7f')]();}return null;})[_0xda84('0x23')](respondWithResult(_0x23c941,null))[_0xda84('0x60')](handleError(_0x23c941,null));};exports[_0xda84('0x80')]=function(_0x13dbcc,_0x11a2aa){if(_0x13dbcc[_0xda84('0x64')]['id']){delete _0x13dbcc[_0xda84('0x64')]['id'];}return db[_0xda84('0x5b')][_0xda84('0x63')]({'where':{'id':_0x13dbcc[_0xda84('0x62')]['id']}})['then'](handleEntityNotFound(_0x11a2aa,null))['then'](function(_0x4c2298){if(_0x4c2298){_0x13dbcc[_0xda84('0x64')]['MailAccountId']=_0x4c2298['id'];return db[_0xda84('0x43')][_0xda84('0x6a')](_0x13dbcc['body']);}})['then'](respondWithResult(_0x11a2aa,null))[_0xda84('0x60')](handleError(_0x11a2aa,null));};exports['removeSmtp']=function(_0x14e87e,_0x2e62bf){return db['MailAccount'][_0xda84('0x6c')]({'where':{'id':_0x14e87e[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x2e62bf,null))[_0xda84('0x23')](function(_0x2b01b4){if(_0x2b01b4){return _0x2b01b4['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x2e62bf,null))[_0xda84('0x60')](handleError(_0x2e62bf,null));};exports[_0xda84('0x81')]=function(_0x31857a,_0x3e6820){return db['MailInteraction'][_0xda84('0x63')]({'where':{'id':_0x31857a[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x3e6820,null))['then'](function(_0x34d5ec){if(_0x34d5ec){return _0x34d5ec[_0xda84('0x81')](_0x31857a[_0xda84('0x64')]['ids'],_[_0xda84('0x82')](_0x31857a['body'],['ids','id'])||{});}})[_0xda84('0x23')](respondWithResult(_0x3e6820,null))[_0xda84('0x60')](handleError(_0x3e6820,null));};exports[_0xda84('0x83')]=function(_0x1d65ad,_0xad7bc8){var _0x5dbd43={'raw':![],'where':{}};var _0x5a553e={};var _0x43f28d={'count':0x0,'rows':[]};return db[_0xda84('0x5b')]['findOne']({'where':{'id':_0x1d65ad[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0xad7bc8,null))[_0xda84('0x23')](function(_0x295e2d){if(_0x295e2d){_0x5a553e[_0xda84('0x4f')]=_['keys'](db[_0xda84('0x84')][_0xda84('0x47')]);_0x5a553e[_0xda84('0x4b')]=_['keys'](_0x1d65ad[_0xda84('0x4b')]);_0x5a553e['filters']=_[_0xda84('0x4e')](_0x5a553e[_0xda84('0x4f')],_0x5a553e[_0xda84('0x4b')]);_0x5dbd43[_0xda84('0x51')]=_[_0xda84('0x4e')](_0x5a553e[_0xda84('0x4f')],qs['fields'](_0x1d65ad['query']['fields']));_0x5dbd43[_0xda84('0x51')]=_0x5dbd43[_0xda84('0x51')]['length']?_0x5dbd43[_0xda84('0x51')]:_0x5a553e[_0xda84('0x4f')];if(!_0x1d65ad['query']['hasOwnProperty'](_0xda84('0x54'))){_0x5dbd43[_0xda84('0x1d')]=qs[_0xda84('0x1d')](_0x1d65ad[_0xda84('0x4b')][_0xda84('0x1d')]);_0x5dbd43[_0xda84('0x1b')]=qs[_0xda84('0x1b')](_0x1d65ad[_0xda84('0x4b')][_0xda84('0x1b')]);}_0x5dbd43['order']=qs[_0xda84('0x55')](_0x1d65ad[_0xda84('0x4b')][_0xda84('0x55')]);_0x5dbd43[_0xda84('0x56')]=qs[_0xda84('0x4d')](_[_0xda84('0x57')](_0x1d65ad[_0xda84('0x4b')],_0x5a553e[_0xda84('0x4d')]));_0x5dbd43[_0xda84('0x56')]['MailAccountId']=_0x295e2d['id'];if(_0x1d65ad[_0xda84('0x4b')][_0xda84('0x58')]){_0x5dbd43[_0xda84('0x56')]=_[_0xda84('0x59')](_0x5dbd43[_0xda84('0x56')],{'$or':_[_0xda84('0x46')](_0x5dbd43['attributes'],function(_0x53dd4b){var _0x85761a={};_0x85761a[_0x53dd4b]={'$like':'%'+_0x1d65ad[_0xda84('0x4b')][_0xda84('0x58')]+'%'};return _0x85761a;})});}_0x5dbd43=_[_0xda84('0x59')]({},_0x5dbd43,_0x1d65ad[_0xda84('0x5a')]);return db[_0xda84('0x84')][_0xda84('0x1e')]({'where':_0x5dbd43[_0xda84('0x56')]})[_0xda84('0x23')](function(_0x3ecda4){_0x43f28d[_0xda84('0x1e')]=_0x3ecda4;if(_0x1d65ad[_0xda84('0x4b')][_0xda84('0x5c')]){_0x5dbd43[_0xda84('0x5d')]=[{'model':db['CmContact'],'as':_0xda84('0x85'),'required':![]},{'model':db[_0xda84('0x86')],'as':_0xda84('0x87'),'attributes':[_0xda84('0x28'),_0xda84('0x88'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xda84('0x89'),'attributes':['id',_0xda84('0x28'),_0xda84('0x8a')],'where':_0x1d65ad[_0xda84('0x4b')][_0xda84('0x8b')]?{'id':_0x1d65ad[_0xda84('0x4b')][_0xda84('0x8b')]}:undefined,'required':_0x1d65ad['query'][_0xda84('0x8b')]?!![]:![]}];}return db[_0xda84('0x84')]['findAll'](_0x5dbd43);})[_0xda84('0x23')](function(_0x9c1f57){_0x43f28d[_0xda84('0x5f')]=_0x9c1f57;return _0x43f28d;});}})[_0xda84('0x23')](respondWithFilteredResult(_0xad7bc8,_0x5dbd43))[_0xda84('0x60')](handleError(_0xad7bc8,null));};exports[_0xda84('0x8c')]=function addApplications(_0xe4607d,_0x216e95){var _0x510723=_0xe4607d[_0xda84('0x62')]['id'];var _0x38a47b=_0xe4607d['body'];var _0x2aba7e=0xc8;var _0x37f975=null;return db[_0xda84('0x8d')][_0xda84('0x8e')]({'isolationLevel':db[_0xda84('0x8d')][_0xda84('0x8f')][_0xda84('0x90')]['READ_COMMITTED']},function(_0x46116d){return db[_0xda84('0x5b')][_0xda84('0x6c')]({'where':{'id':_0x510723},'transaction':_0x46116d})[_0xda84('0x23')](function(_0xffb5c4){if(_0xffb5c4){return db['MailApplication'][_0xda84('0x22')]({'where':{'MailAccountId':_0x510723},'transaction':_0x46116d})['then'](function(){var _0xbc3b45=_[_0xda84('0x46')](_0x38a47b,function(_0x28450e){_0x28450e[_0xda84('0x71')]=_0x510723;return _0x28450e;});return db[_0xda84('0x91')][_0xda84('0x92')](_0xbc3b45,{'transaction':_0x46116d});});}else{_0x2aba7e=0x194;_0x37f975=[];}});})[_0xda84('0x23')](function(){if(_0x2aba7e!==0x194){return db[_0xda84('0x91')]['findAndCountAll']({'where':{'MailAccountId':_0x510723},'order':_0xda84('0x93')})[_0xda84('0x23')](function(_0x14cc7c){_0x37f975=_0x14cc7c;});}})['catch'](function(_0x3f750f){_0x2aba7e=0x1f4;logger[_0xda84('0x14')](_0x3f750f[_0xda84('0x27')]);if(_0x3f750f[_0xda84('0x28')]){delete _0x3f750f[_0xda84('0x28')];}_0x37f975=_0x3f750f;})[_0xda84('0x94')](function(){if(_0x37f975===null){_0x216e95[_0xda84('0x18')](_0x2aba7e);}else{if(_0x2aba7e===0x1f4){_0x216e95[_0xda84('0x19')](_0x2aba7e)[_0xda84('0x29')](_0x37f975);}else{_0x216e95[_0xda84('0x19')](_0x2aba7e)[_0xda84('0x20')](_0x37f975);}}});};exports[_0xda84('0x95')]=function(_0x142d0b,_0x206d1e){var _0x10f536={};var _0x45bd0d={};var _0x36f1a1;var _0x55d96c;return db[_0xda84('0x5b')][_0xda84('0x6c')]({'where':{'id':_0x142d0b['params']['id']}})['then'](handleEntityNotFound(_0x206d1e,null))['then'](function(_0x1df582){if(_0x1df582){_0x36f1a1=_0x1df582;_0x45bd0d[_0xda84('0x4f')]=_['keys'](db[_0xda84('0x91')][_0xda84('0x47')]);_0x45bd0d[_0xda84('0x4b')]=_[_0xda84('0x4c')](_0x142d0b[_0xda84('0x4b')]);_0x45bd0d[_0xda84('0x4d')]=_['intersection'](_0x45bd0d['model'],_0x45bd0d[_0xda84('0x4b')]);_0x10f536[_0xda84('0x51')]=_[_0xda84('0x4e')](_0x45bd0d[_0xda84('0x4f')],qs[_0xda84('0x50')](_0x142d0b[_0xda84('0x4b')][_0xda84('0x50')]));_0x10f536['attributes']=_0x10f536[_0xda84('0x51')][_0xda84('0x52')]?_0x10f536[_0xda84('0x51')]:_0x45bd0d[_0xda84('0x4f')];_0x10f536[_0xda84('0x6d')]=qs[_0xda84('0x55')](_0x142d0b[_0xda84('0x4b')][_0xda84('0x55')]);_0x10f536[_0xda84('0x56')]=qs[_0xda84('0x4d')](_[_0xda84('0x57')](_0x142d0b['query'],_0x45bd0d[_0xda84('0x4d')]));if(_0x142d0b[_0xda84('0x4b')]['filter']){_0x10f536['where']=_[_0xda84('0x59')](_0x10f536['where'],{'$or':_[_0xda84('0x46')](_0x10f536[_0xda84('0x51')],function(_0x1f02e9){var _0x176311={};_0x176311[_0x1f02e9]={'$like':'%'+_0x142d0b[_0xda84('0x4b')][_0xda84('0x58')]+'%'};return _0x176311;})});}_0x10f536=_[_0xda84('0x59')]({},_0x10f536,_0x142d0b[_0xda84('0x5a')]);return _0x36f1a1[_0xda84('0x95')](_0x10f536);}})[_0xda84('0x23')](function(_0x23983f){if(_0x23983f){_0x55d96c=_0x23983f[_0xda84('0x52')];if(!_0x142d0b[_0xda84('0x4b')][_0xda84('0x53')]('nolimit')){_0x10f536[_0xda84('0x1d')]=qs['limit'](_0x142d0b['query']['limit']);_0x10f536[_0xda84('0x1b')]=qs[_0xda84('0x1b')](_0x142d0b[_0xda84('0x4b')][_0xda84('0x1b')]);}return _0x36f1a1[_0xda84('0x95')](_0x10f536);}})[_0xda84('0x23')](function(_0x3684b6){if(_0x3684b6){return _0x3684b6?{'count':_0x55d96c,'rows':_0x3684b6}:null;}})['then'](respondWithResult(_0x206d1e,null))[_0xda84('0x60')](handleError(_0x206d1e,null));};exports[_0xda84('0x96')]=function(_0x3c33d1,_0x45fc9a){var _0x3560aa={'raw':!![],'where':{}};var _0x54ed8a={};var _0x419a1c={'count':0x0,'rows':[]};return db['MailAccount'][_0xda84('0x6c')]({'where':{'id':_0x3c33d1['params']['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x45fc9a,null))[_0xda84('0x23')](function(_0x303ffb){if(_0x303ffb){_0x54ed8a[_0xda84('0x4f')]=_[_0xda84('0x4c')](db['MailMessage'][_0xda84('0x47')]);_0x54ed8a[_0xda84('0x4b')]=_[_0xda84('0x4c')](_0x3c33d1['query']);_0x54ed8a['filters']=_[_0xda84('0x4e')](_0x54ed8a['model'],_0x54ed8a[_0xda84('0x4b')]);_0x3560aa[_0xda84('0x51')]=_[_0xda84('0x4e')](_0x54ed8a[_0xda84('0x4f')],qs[_0xda84('0x50')](_0x3c33d1[_0xda84('0x4b')][_0xda84('0x50')]));_0x3560aa[_0xda84('0x51')]=_0x3560aa['attributes'][_0xda84('0x52')]?_0x3560aa[_0xda84('0x51')]:_0x54ed8a['model'];if(!_0x3c33d1['query'][_0xda84('0x53')](_0xda84('0x54'))){_0x3560aa[_0xda84('0x1d')]=qs[_0xda84('0x1d')](_0x3c33d1[_0xda84('0x4b')][_0xda84('0x1d')]);_0x3560aa[_0xda84('0x1b')]=qs[_0xda84('0x1b')](_0x3c33d1[_0xda84('0x4b')][_0xda84('0x1b')]);}_0x3560aa[_0xda84('0x6d')]=qs[_0xda84('0x55')](_0x3c33d1[_0xda84('0x4b')]['sort']);_0x3560aa[_0xda84('0x56')]=qs[_0xda84('0x4d')](_['pick'](_0x3c33d1[_0xda84('0x4b')],_0x54ed8a[_0xda84('0x4d')]));_0x3560aa[_0xda84('0x56')][_0xda84('0x71')]=_0x303ffb['id'];if(_0x3c33d1['query'][_0xda84('0x58')]){_0x3560aa[_0xda84('0x56')]=_[_0xda84('0x59')](_0x3560aa[_0xda84('0x56')],{'$or':_[_0xda84('0x46')](_0x3560aa[_0xda84('0x51')],function(_0x3e54e3){var _0x4ec8c3={};_0x4ec8c3[_0x3e54e3]={'$like':'%'+_0x3c33d1['query'][_0xda84('0x58')]+'%'};return _0x4ec8c3;})});}if(_0x3c33d1[_0xda84('0x4b')][_0xda84('0x97')]){var _0x3a71cc=_0x3c33d1[_0xda84('0x4b')][_0xda84('0x97')][_0xda84('0x98')](',');var _0x346b42={};_0x346b42[_0x3a71cc[0x0]]={'$gte':moment(_0x3a71cc[0x1])[_0xda84('0x99')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3560aa['where']=_[_0xda84('0x59')](_0x3560aa[_0xda84('0x56')],_0x346b42);}_0x3560aa=_[_0xda84('0x59')]({},_0x3560aa,_0x3c33d1[_0xda84('0x5a')]);return db['MailMessage'][_0xda84('0x1e')]({'where':_0x3560aa[_0xda84('0x56')]})[_0xda84('0x23')](function(_0x2f8bd0){_0x419a1c['count']=_0x2f8bd0;if(_0x3c33d1[_0xda84('0x4b')][_0xda84('0x5c')]){_0x3560aa[_0xda84('0x5d')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x3560aa);})[_0xda84('0x23')](function(_0x1b7341){if(_0x3c33d1[_0xda84('0x4b')][_0xda84('0x9a')]===_0xda84('0x9b')){for(var _0x3a45e4=0x0;_0x3a45e4<_0x1b7341[_0xda84('0x52')];_0x3a45e4++){_0x1b7341[_0x3a45e4][_0xda84('0x64')]=juice(_0x1b7341[_0x3a45e4][_0xda84('0x64')]);}}_0x419a1c[_0xda84('0x5f')]=_0x1b7341;return _0x419a1c;});}})[_0xda84('0x23')](respondWithFilteredResult(_0x45fc9a,_0x3560aa))[_0xda84('0x60')](handleError(_0x45fc9a,null));};exports[_0xda84('0x29')]=function(_0x12984a,_0x119e96){var _0x3f76d2,_0x2c1f52={},_0x45368d;if(_0x12984a[_0xda84('0x64')]['to']){_0x45368d=_0x12984a[_0xda84('0x64')]['to'][_0xda84('0x98')](',')[0x0];}return db[_0xda84('0x5b')][_0xda84('0x63')]({'where':{'id':_0x12984a[_0xda84('0x62')]['id']},'include':[{'model':db[_0xda84('0x9c')],'as':_0xda84('0x9d'),'include':[{'model':db[_0xda84('0x9e')],'as':'Contacts','where':{'email':_0x45368d},'limit':0x1,'order':[[_0xda84('0x9f'),_0xda84('0xa0')]]}]},{'model':db[_0xda84('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xda84('0xa1'),'raw':!![]}]}]})[_0xda84('0x23')](handleEntityNotFound(_0x119e96,null))['then'](function(_0x137598){if(!_0x137598)return;_0x3f76d2=_0x137598;if(!_0x137598[_0xda84('0x40')])throw new Error(_0xda84('0xa2'));if(_['isNil'](_0x12984a[_0xda84('0x64')][_0xda84('0xa3')])){_0x12984a[_0xda84('0x64')][_0xda84('0xa3')]=util['format'](_0xda84('0xa4'),_0x137598['name'],_0x137598[_0xda84('0x74')]||_0x137598[_0xda84('0x40')]['user']);}if(_0x12984a[_0xda84('0x64')][_0xda84('0xa5')]&&_0x12984a[_0xda84('0x64')][_0xda84('0xa5')][_0xda84('0x52')]){for(var _0xd524de=0x0;_0xd524de<_0x12984a[_0xda84('0x64')][_0xda84('0xa5')]['length'];_0xd524de+=0x1){_0x12984a[_0xda84('0x64')]['attachments'][_0xd524de]={'filename':_0x12984a[_0xda84('0x64')][_0xda84('0xa5')][_0xd524de][_0xda84('0x28')],'path':path[_0xda84('0xa6')](config['root'],'server/files/attachments',_0x12984a[_0xda84('0x64')][_0xda84('0xa5')][_0xd524de]['basename'])};}}var _0x28e78b=_0x137598[_0xda84('0xa7')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x28e78b,'message':_0x12984a[_0xda84('0x64')]});})[_0xda84('0x23')](function(_0x5cef0f){if(!_0x5cef0f)return;_0x2c1f52=_0x5cef0f;if(!_0x3f76d2['List'])throw new Error(_0xda84('0xa8'));if(_0x3f76d2['List'][_0xda84('0xa9')]['length'])return _0x3f76d2[_0xda84('0x9d')]['Contacts'][0x0];return db[_0xda84('0x9e')][_0xda84('0x6a')](_['defaults'](_0x12984a['body'],{'firstName':_0x12984a[_0xda84('0x64')]['to'],'email':_0x12984a['body']['to'],'phone':_0x12984a['body']['to'],'ListId':_0x3f76d2[_0xda84('0x75')]}));})[_0xda84('0x23')](function(_0x2f1ead){if(!_0x2f1ead)return;var _0x11d6ab={'UserId':_0x12984a[_0xda84('0x35')]['id'],'ContactId':_0x2f1ead['id'],'MailAccountId':_0x3f76d2['id'],'inReplyTo':_0x2c1f52[_0xda84('0xaa')],'to':_0x12984a[_0xda84('0x64')]['from'],'cc':_0x12984a[_0xda84('0x64')]['cc'],'subject':_0x12984a[_0xda84('0x64')]['subject'],'attach':_0x12984a[_0xda84('0x64')][_0xda84('0xab')],'firstMsgDirection':_0xda84('0xac'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xda84('0xac'),'Messages':[_['merge'](_0x12984a['body'],{'messageId':_0x2c1f52[_0xda84('0xaa')],'sentAt':moment()[_0xda84('0x99')](_0xda84('0xad')),'read':!![],'MailAccountId':_0x3f76d2['id'],'UserId':_0x12984a[_0xda84('0x35')]['id'],'ContactId':_0x2f1ead['id']})]};if(_0x12984a['body'][_0xda84('0xae')]){_0x11d6ab=_[_0xda84('0x59')](_0x11d6ab,_0x12984a[_0xda84('0x64')]['Interaction']);}return db['MailInteraction'][_0xda84('0x6a')](_0x11d6ab,{'include':[{'model':db['MailMessage'],'as':_0xda84('0xaf')}]});})[_0xda84('0x23')](respondWithResult(_0x119e96,null))['catch'](handleError(_0x119e96,null));};exports[_0xda84('0xb0')]=function(_0x2902f8,_0x356245){return db[_0xda84('0x5b')][_0xda84('0x63')]({'where':{'id':_0x2902f8[_0xda84('0x62')]['id']},'include':[{'model':db[_0xda84('0x43')],'as':_0xda84('0x40'),'raw':!![],'include':[{'model':db[_0xda84('0xa1')],'as':_0xda84('0xa1'),'raw':!![]}]}]})[_0xda84('0x23')](handleEntityNotFound(_0x356245,null))['then'](function(_0x5e43bc){if(!_0x5e43bc['Smtp'])return;var _0x58ae3=_0x5e43bc[_0xda84('0xa7')]();return respondWithRpcPromise('VerifySmtp',_0xda84('0xb0'),{'account':_0x58ae3});})[_0xda84('0x23')](respondWithResult(_0x356245,null))[_0xda84('0x60')](handleError(_0x356245,null));};exports[_0xda84('0x22')]=function(_0xf68e41,_0x9151f0){return db['MailAccount'][_0xda84('0x63')]({'where':{'id':_0xf68e41[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x9151f0,null))[_0xda84('0x23')](function(_0x22f55b){if(_0x22f55b&&_0x22f55b[_0xda84('0x3e')]){throw new db['Sequelize']['ValidationError'](_0xda84('0xb1'));}return _0x22f55b;})[_0xda84('0x23')](removeEntity(_0x9151f0,null))['catch'](handleError(_0x9151f0,null));};exports[_0xda84('0xb2')]=function(_0x36421e,_0x391130){return db['MailAccount']['find']({'where':{'id':_0x36421e[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x391130,null))['then'](function(_0x5b7986){if(_0x5b7986){return _0x5b7986[_0xda84('0xb2')](_0x36421e[_0xda84('0x64')]['ids'],_[_0xda84('0x82')](_0x36421e[_0xda84('0x64')],[_0xda84('0x6f'),'id'])||{})['spread'](function(_0x2b2eda){for(var _0x22e87f=0x0;_0x22e87f<_0x36421e[_0xda84('0x64')][_0xda84('0x6f')]['length'];_0x22e87f+=0x1){socket[_0xda84('0xb3')]('userMailAccount:save',{'UserId':Number(_0x36421e[_0xda84('0x64')][_0xda84('0x6f')][_0x22e87f]),'MailAccountId':Number(_0x36421e['params']['id'])});}return _0x2b2eda;});}})[_0xda84('0x23')](respondWithResult(_0x391130,null))[_0xda84('0x60')](handleError(_0x391130,null));};exports[_0xda84('0xb4')]=function(_0x1e3b9b,_0x200de6){return db[_0xda84('0x5b')][_0xda84('0x63')]({'where':{'id':_0x1e3b9b[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x200de6,null))[_0xda84('0x23')](function(_0x475c84){if(_0x475c84){return _0x475c84[_0xda84('0xb4')](_0x1e3b9b[_0xda84('0x4b')][_0xda84('0x6f')])['then'](function(){if(_[_0xda84('0xb5')](_0x1e3b9b[_0xda84('0x4b')][_0xda84('0x6f')])){for(var _0x1df45b=0x0;_0x1df45b<_0x1e3b9b[_0xda84('0x4b')][_0xda84('0x6f')]['length'];_0x1df45b+=0x1){socket[_0xda84('0xb3')](_0xda84('0xb6'),{'UserId':Number(_0x1e3b9b[_0xda84('0x4b')]['ids'][_0x1df45b]),'MailAccountId':Number(_0x1e3b9b[_0xda84('0x62')]['id'])});}}else{socket[_0xda84('0xb3')](_0xda84('0xb6'),{'UserId':Number(_0x1e3b9b[_0xda84('0x4b')][_0xda84('0x6f')]),'MailAccountId':Number(_0x1e3b9b[_0xda84('0x62')]['id'])});}});}})[_0xda84('0x23')](respondWithStatusCode(_0x200de6,null))[_0xda84('0x60')](handleError(_0x200de6,null));};exports[_0xda84('0xb7')]=function(_0x18ffbf,_0x61f9c1){var _0x185ed7={};var _0xe57f96={};var _0x28e2d3;var _0x18a4d3;return db[_0xda84('0x5b')][_0xda84('0x6c')]({'where':{'id':_0x18ffbf[_0xda84('0x62')]['id']}})[_0xda84('0x23')](handleEntityNotFound(_0x61f9c1,null))[_0xda84('0x23')](function(_0x235077){if(_0x235077){_0x28e2d3=_0x235077;_0xe57f96[_0xda84('0x4f')]=_[_0xda84('0x4c')](db[_0xda84('0x86')][_0xda84('0x47')]);_0xe57f96['query']=_['keys'](_0x18ffbf['query']);_0xe57f96[_0xda84('0x4d')]=_[_0xda84('0x4e')](_0xe57f96[_0xda84('0x4f')],_0xe57f96[_0xda84('0x4b')]);_0x185ed7[_0xda84('0x51')]=_[_0xda84('0x4e')](_0xe57f96[_0xda84('0x4f')],qs[_0xda84('0x50')](_0x18ffbf[_0xda84('0x4b')]['fields']));_0x185ed7['attributes']=_0x185ed7[_0xda84('0x51')][_0xda84('0x52')]?_0x185ed7[_0xda84('0x51')]:_0xe57f96[_0xda84('0x4f')];_0x185ed7[_0xda84('0x6d')]=qs[_0xda84('0x55')](_0x18ffbf[_0xda84('0x4b')][_0xda84('0x55')]);_0x185ed7[_0xda84('0x56')]=qs[_0xda84('0x4d')](_[_0xda84('0x57')](_0x18ffbf['query'],_0xe57f96[_0xda84('0x4d')]));if(_0x18ffbf[_0xda84('0x4b')]['filter']){_0x185ed7[_0xda84('0x56')]=_[_0xda84('0x59')](_0x185ed7[_0xda84('0x56')],{'$or':_[_0xda84('0x46')](_0x185ed7[_0xda84('0x51')],function(_0x489404){var _0x218621={};_0x218621[_0x489404]={'$like':'%'+_0x18ffbf['query'][_0xda84('0x58')]+'%'};return _0x218621;})});}_0x185ed7=_[_0xda84('0x59')]({},_0x185ed7,_0x18ffbf[_0xda84('0x5a')]);return _0x28e2d3[_0xda84('0xb7')](_0x185ed7);}})['then'](function(_0x40edff){if(_0x40edff){_0x18a4d3=_0x40edff[_0xda84('0x52')];if(!_0x18ffbf[_0xda84('0x4b')][_0xda84('0x53')](_0xda84('0x54'))){_0x185ed7['limit']=qs['limit'](_0x18ffbf[_0xda84('0x4b')][_0xda84('0x1d')]);_0x185ed7['offset']=qs[_0xda84('0x1b')](_0x18ffbf[_0xda84('0x4b')][_0xda84('0x1b')]);}return _0x28e2d3[_0xda84('0xb7')](_0x185ed7);}})[_0xda84('0x23')](function(_0x50141c){if(_0x50141c){return _0x50141c?{'count':_0x18a4d3,'rows':_0x50141c}:null;}})[_0xda84('0x23')](respondWithResult(_0x61f9c1,null))[_0xda84('0x60')](handleError(_0x61f9c1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index a6baf0f..948d6aa 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 _0x7da6=['save','update','emit','hook','MailAccount','setMaxListeners'];(function(_0x35f5bb,_0x354149){var _0xf8d19e=function(_0x391754){while(--_0x391754){_0x35f5bb['push'](_0x35f5bb['shift']());}};_0xf8d19e(++_0x354149);}(_0x7da6,0x124));var _0x67da=function(_0x2dacca,_0x3b55a5){_0x2dacca=_0x2dacca-0x0;var _0x4e8745=_0x7da6[_0x2dacca];return _0x4e8745;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x67da('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x67da('0x1')](0x0);var events={'afterCreate':_0x67da('0x2'),'afterUpdate':_0x67da('0x3'),'afterDestroy':'remove'};function emitEvent(_0x42a2f3){return function(_0x282a52,_0x37ef9d,_0x2d4937){MailAccountEvents[_0x67da('0x4')](_0x42a2f3+':'+_0x282a52['id'],_0x282a52);MailAccountEvents[_0x67da('0x4')](_0x42a2f3,_0x282a52);_0x2d4937(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x67da('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xc55e=['hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit'];(function(_0x4baac8,_0x5f1dc7){var _0x56ebc5=function(_0x23d717){while(--_0x23d717){_0x4baac8['push'](_0x4baac8['shift']());}};_0x56ebc5(++_0x5f1dc7);}(_0xc55e,0x146));var _0xec55=function(_0x1d5164,_0x4de06e){_0x1d5164=_0x1d5164-0x0;var _0x2428de=_0xc55e[_0x1d5164];return _0x2428de;};'use strict';var EventEmitter=require(_0xec55('0x0'));var MailAccount=require(_0xec55('0x1'))['db'][_0xec55('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xec55('0x3')](0x0);var events={'afterCreate':_0xec55('0x4'),'afterUpdate':'update','afterDestroy':_0xec55('0x5')};function emitEvent(_0x1f2bc5){return function(_0x35cd14,_0xdcb93,_0x3b7b45){MailAccountEvents['emit'](_0x1f2bc5+':'+_0x35cd14['id'],_0x35cd14);MailAccountEvents[_0xec55('0x6')](_0x1f2bc5,_0x35cd14);_0x3b7b45(null);};}for(var e in events){if(events[_0xec55('0x7')](e)){var event=events[e];MailAccount[_0xec55('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 0dfe0b5..551ee92 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 _0x63ac=['auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','provider','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x29ba9d,_0x14b57a){var _0x1685e3=function(_0x37d763){while(--_0x37d763){_0x29ba9d['push'](_0x29ba9d['shift']());}};_0x1685e3(++_0x14b57a);}(_0x63ac,0x196));var _0xc63a=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x63ac[_0x18aaaf];return _0x52d892;};'use strict';var attributes=require(_0xc63a('0x0'));module[_0xc63a('0x1')]=function(_0x1b2e8c){return _0x1b2e8c[_0xc63a('0x2')](_0xc63a('0x3'),attributes,{'tableName':_0xc63a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2db7c8=this;var _0x3510ad={'id':_0x2db7c8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2db7c8['provider']!==_0xc63a('0x5')){_0x3510ad[_0xc63a('0x6')]=_0x2db7c8[_0xc63a('0x7')];}else{_0x3510ad['host']=_0x2db7c8['Smtp']['host'];_0x3510ad['port']=_0x2db7c8[_0xc63a('0x8')][_0xc63a('0x9')];_0x3510ad[_0xc63a('0xa')]=_0x2db7c8[_0xc63a('0x8')][_0xc63a('0xa')];}if(_0x2db7c8['Smtp'][_0xc63a('0xb')]){if(_0x2db7c8['Smtp'][_0xc63a('0xc')]){if(!_0x2db7c8['Smtp']['CloudProvider'])throw new Error(_0xc63a('0xd'));_0x3510ad[_0xc63a('0xe')]={'type':_0xc63a('0xf'),'user':_0x2db7c8['Smtp'][_0xc63a('0x10')],'accessToken':_0x2db7c8[_0xc63a('0x8')][_0xc63a('0x11')][_0xc63a('0x12')]};}else{_0x3510ad[_0xc63a('0xe')]={'user':_0x2db7c8['Smtp'][_0xc63a('0x10')],'pass':_0x2db7c8[_0xc63a('0x8')][_0xc63a('0x13')]};}}return _0x3510ad;}}});}; \ No newline at end of file +var _0xd48d=['provider','custom','service','host','port','Smtp','secure','authentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts'];(function(_0x4c067f,_0x11576a){var _0x4f3b6f=function(_0x3c106){while(--_0x3c106){_0x4c067f['push'](_0x4c067f['shift']());}};_0x4f3b6f(++_0x11576a);}(_0xd48d,0x11c));var _0xdd48=function(_0x124162,_0x2685b3){_0x124162=_0x124162-0x0;var _0x46b6fa=_0xd48d[_0x124162];return _0x46b6fa;};'use strict';var attributes=require(_0xdd48('0x0'));module[_0xdd48('0x1')]=function(_0x990205){return _0x990205['define'](_0xdd48('0x2'),attributes,{'tableName':_0xdd48('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x38efad=this;var _0x16a662={'id':_0x38efad['id'],'tls':{'rejectUnauthorized':![]}};if(_0x38efad[_0xdd48('0x4')]!==_0xdd48('0x5')){_0x16a662[_0xdd48('0x6')]=_0x38efad[_0xdd48('0x4')];}else{_0x16a662[_0xdd48('0x7')]=_0x38efad['Smtp'][_0xdd48('0x7')];_0x16a662[_0xdd48('0x8')]=_0x38efad[_0xdd48('0x9')]['port'];_0x16a662[_0xdd48('0xa')]=_0x38efad[_0xdd48('0x9')][_0xdd48('0xa')];}if(_0x38efad[_0xdd48('0x9')][_0xdd48('0xb')]){if(_0x38efad[_0xdd48('0x9')]['modernAuthentication']){if(!_0x38efad[_0xdd48('0x9')]['CloudProvider'])throw new Error(_0xdd48('0xc'));_0x16a662[_0xdd48('0xd')]={'type':_0xdd48('0xe'),'user':_0x38efad['Smtp'][_0xdd48('0xf')],'accessToken':_0x38efad[_0xdd48('0x9')]['CloudProvider'][_0xdd48('0x10')]};}else{_0x16a662[_0xdd48('0xd')]={'user':_0x38efad[_0xdd48('0x9')]['user'],'pass':_0x38efad[_0xdd48('0x9')][_0xdd48('0x11')]};}}return _0x16a662;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 975e459..ec4c948 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 _0x5f66=['../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','request\x20sent','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','where','limit','include','map','model','attributes','stringify','find','smtp','smtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','getSmtpOptions','list','applications','orderBy','priority','autoclose','push','close','defaults','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','MailMessage','create','attachments','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','name','unshift','agent','*,*,*,*','startRouting','Start','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var db=require(_0x65f6('0x3'))['db'];var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x6'));var client=jayson['client'][_0x65f6('0x7')]({'port':0x232c});config[_0x65f6('0x8')]=_['defaults'](config['redis'],{'host':_0x65f6('0x9'),'port':0x18eb});var socket=require(_0x65f6('0xa'))(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0xb'))[_0x65f6('0xc')](socket);function respondWithRpcPromise(_0x14f4c7,_0x48d85c,_0x5123ee){return new BPromise(function(_0x18fea1,_0x2f6d5b){return client[_0x65f6('0xd')](_0x14f4c7,_0x5123ee)[_0x65f6('0xe')](function(_0x50d26d){logger[_0x65f6('0xf')]('MailAccount,\x20%s,\x20%s',_0x48d85c,'request\x20sent');logger[_0x65f6('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x48d85c,_0x65f6('0x11'),JSON['stringify'](_0x50d26d));if(_0x50d26d[_0x65f6('0x12')]){if(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x13')]===0x1f4){logger[_0x65f6('0x12')](_0x65f6('0x14'),_0x48d85c,_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);return _0x2f6d5b(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);}logger[_0x65f6('0x12')]('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x50d26d[_0x65f6('0x12')]['message']);return _0x18fea1(_0x50d26d['error'][_0x65f6('0x15')]);}else{logger[_0x65f6('0xf')](_0x65f6('0x14'),_0x48d85c,_0x65f6('0x11'));_0x18fea1(_0x50d26d[_0x65f6('0x16')][_0x65f6('0x15')]);}})[_0x65f6('0x17')](function(_0x18380e){logger['error']('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x18380e);_0x2f6d5b(_0x18380e);});});}exports[_0x65f6('0x18')]=function(_0x5b4055){var _0x4c81f3=this;return new Promise(function(_0x5c5b91,_0x365159){return db[_0x65f6('0x19')]['findAll']({'raw':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1c')]||null:null,'attributes':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')]['attributes']||null:null,'limit':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1d')]||null:null,'include':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x5b4055[_0x65f6('0x1a')]['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x20')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x21')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x20')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes'],'include':_0x29abdb[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x29abdb['include'],function(_0x325cb4){return{'model':db[_0x325cb4[_0x65f6('0x20')]],'as':_0x325cb4['as'],'attributes':_0x325cb4[_0x65f6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ac04b){logger['info'](_0x65f6('0x18'),_0x5b4055);logger[_0x65f6('0x10')](_0x65f6('0x18'),_0x5b4055,JSON[_0x65f6('0x22')](_0x4ac04b));_0x5c5b91(_0x4ac04b);})[_0x65f6('0x17')](function(_0x14a387){logger[_0x65f6('0x12')]('GetMailAccount',_0x14a387['message'],_0x5b4055);_0x365159(_0x4c81f3[_0x65f6('0x12')](0x1f4,_0x14a387[_0x65f6('0x15')]));});});};exports['ShowMailAccount']=function(_0x4e50c0){var _0x10b368=this;return new Promise(function(_0x1ce43c,_0x11fe3b){return db[_0x65f6('0x19')][_0x65f6('0x23')]({'raw':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0['options'][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')]['where']||null:null,'attributes':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x21')]||null:null,'include':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')]?_['map'](_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x20')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1e')]?_['map'](_0x4f3e22[_0x65f6('0x1e')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x21')],'include':_0x24f7fd[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x24f7fd['include'],function(_0x582c7e){return{'model':db[_0x582c7e[_0x65f6('0x20')]],'as':_0x582c7e['as'],'attributes':_0x582c7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xe')](function(_0x4e6653){if(_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x24')]===!![])_0x4e6653['setDataValue'](_0x65f6('0x25'),_0x4e6653['getSmtpOptions']());logger['info'](_0x65f6('0x26'),_0x4e50c0);logger[_0x65f6('0x10')](_0x65f6('0x26'),_0x4e50c0,JSON[_0x65f6('0x22')](_0x4e6653));_0x1ce43c(_0x4e6653);})[_0x65f6('0x17')](function(_0x28845a){logger[_0x65f6('0x12')](_0x65f6('0x26'),_0x28845a['message'],_0x4e50c0);_0x11fe3b(_0x10b368[_0x65f6('0x12')](0x1f4,_0x28845a['message']));});});};exports[_0x65f6('0x27')]=function(_0xa4394a){var _0x4ba7db=this;return new Promise(function(_0x2ea7f7,_0x5ef5c2){var _0x32148f={'body':_0xa4394a[_0x65f6('0x28')],'channel':_0x65f6('0x29')};var _0x3fb1c6=_[_0x65f6('0x2a')](_[_0x65f6('0x2b')](db[_0x65f6('0x2c')][_0x65f6('0x2d')]),[_0x65f6('0x2e'),'updatedAt',_0x65f6('0x2f'),_0x65f6('0x30')]);var _0x377ae5=![];if(_0xa4394a[_0x65f6('0x28')]['id']){delete _0xa4394a[_0x65f6('0x28')]['id'];}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x65f6('0x33')));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')])||_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')]===''){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3fb1c6));}if(!_[_0x65f6('0x35')](_0x3fb1c6,_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db['error'](0x1f4,_0x65f6('0x36')+_0x3fb1c6));}var _0x3386a2={};_0x3386a2[_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')]]=_0xa4394a['body'][_0x65f6('0x32')];return db['MailAccount'][_0x65f6('0x23')]({'where':{'id':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x65f6('0x38'),'include':[{'model':db['CmContact'],'as':_0x65f6('0x39'),'where':_0x3386a2,'limit':0x1,'order':[[_0x65f6('0x3a'),_0x65f6('0x3b')]]}]},{'model':db[_0x65f6('0x3c')],'as':_0x65f6('0x3d')},{'model':db[_0x65f6('0x3e')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x65f6('0x3f')}]}]})[_0x65f6('0xe')](function(_0x3b647a){if(_0x3b647a&&_0x3b647a[_0x65f6('0x38')]){var _0x3b907c=_0x3b647a[_0x65f6('0x40')]({'plain':!![]});_0x32148f[_0x65f6('0x37')]=_[_0x65f6('0x41')](_0x3b907c,[_0x65f6('0x3d'),'List']);_0x32148f[_0x65f6('0x37')][_0x65f6('0x25')]=_0x3b647a[_0x65f6('0x42')]();_0x32148f['applications']=_0x3b907c[_0x65f6('0x3d')];_0x32148f[_0x65f6('0x43')]=_0x3b907c['List'];_0x32148f[_0x65f6('0x44')]=_[_0x65f6('0x45')](_0x32148f['applications'],[_0x65f6('0x46')],['asc']);if(_0x32148f[_0x65f6('0x37')]&&_0x32148f[_0x65f6('0x37')][_0x65f6('0x47')]){_0x32148f['applications'][_0x65f6('0x48')]({'id':0x0,'priority':_0x32148f[_0x65f6('0x44')]['length']+0x1,'app':_0x65f6('0x49'),'appdata':_0x65f6('0x47'),'interval':'*,*,*,*'});}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')];}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x38')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x38')];}if(_0x3b907c['List']['Contacts']['length']){return _0x3b907c[_0x65f6('0x38')][_0x65f6('0x39')][0x0];}var _0x111a8a=_[_0x65f6('0x4a')](_0xa4394a['body'],{'firstName':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')],'ListId':_0x3b907c[_0x65f6('0x30')]});_0x111a8a[_0xa4394a['body'][_0x65f6('0x34')]]=_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')];return db['CmContact']['create'](_0x111a8a);}else{throw new Error(_0x65f6('0x4b'));}})[_0x65f6('0xe')](function(_0x4125cb){_0x32148f[_0x65f6('0x4c')]=_0x4125cb;if(_0x4125cb){if(!_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]){_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]=rs[_0x65f6('0x4e')]()+'\x20'+_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')];}var _0x5ba9c6={'ContactId':_0x4125cb['id'],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a[_0x65f6('0x28')]['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x50')],'lastMsgAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x65f6('0x52')][_0x65f6('0x23')]({'where':{'closed':![],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x65f6('0x53'),'attributes':[_0x65f6('0x4d')],'where':{'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x54')]}}]})[_0x65f6('0xe')](function(_0x5e4759){if(_0x5e4759){return[_0x5e4759,![]];}return db['MailInteraction']['create'](_0x5ba9c6)[_0x65f6('0xe')](function(_0x367d95){return[_0x367d95,!![]];});});}else{throw new Error(_0x65f6('0x55'));}})[_0x65f6('0x56')](function(_0xab6f0,_0x304cf9){if(_0xab6f0){_0x377ae5=_0x304cf9;if(!_0x304cf9){return _0xab6f0['update']({'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a['body'][_0x65f6('0x15')]['cc'],'subject':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x4f')],'attach':_0xab6f0[_0x65f6('0x50')]?_0xab6f0[_0x65f6('0x50')]:_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'substatus':null,'substatusAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x65f6('0x57')),'lastMsgDirection':'in'});}else{return _0xab6f0;}}})[_0x65f6('0xe')](function(_0x4a9524){_0x32148f[_0x65f6('0x58')]=_0x4a9524['get']({'plain':!![]});_0x32148f[_0x65f6('0x58')]['created']=_0x377ae5;return db[_0x65f6('0x59')][_0x65f6('0x5a')]({'body':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'MailInteractionId':_0x4a9524['id'],'direction':'in','ContactId':_0x32148f[_0x65f6('0x4c')]['id'],'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')],'from':_0xa4394a['body']['message'][_0x65f6('0x32')],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['to'],'cc':_0xa4394a['body']['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'Attachments':_0xa4394a['body']['message'][_0x65f6('0x5b')],'originTo':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x5c')],'originCc':_0xa4394a['body'][_0x65f6('0x15')][_0x65f6('0x5d')],'bcc':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['bcc'],'ChatWebsiteId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x5e')]||null,'originChannel':_0xa4394a['body']['message'][_0x65f6('0x5f')]||'Email','ChatOfflineMessageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x60')]||null},{'include':[{'model':db[_0x65f6('0x61')],'as':'Attachments'}]});})['then'](function(_0x56f7f1){_0x32148f[_0x65f6('0x15')]=_0x56f7f1;if(_0x32148f[_0x65f6('0x58')][_0x65f6('0x62')]){return db['User'][_0x65f6('0x23')]({'attributes':['id',_0x65f6('0x63')],'where':{'id':_0x32148f[_0x65f6('0x58')]['UserId']}})[_0x65f6('0xe')](function(_0x15809e){if(_0x15809e){_0x32148f['applications'][_0x65f6('0x64')]({'id':0x0,'priority':0x0,'app':_0x65f6('0x65'),'appdata':_0x15809e['name']+','+(_0x32148f[_0x65f6('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x65f6('0x66')});}return respondWithRpcPromise('Start',_0x65f6('0x67'),_0x32148f);});}return respondWithRpcPromise(_0x65f6('0x68'),'startRouting',_0x32148f);})[_0x65f6('0xe')](function(_0x442e25){_0x2ea7f7(_0x442e25);})[_0x65f6('0x17')](function(_0x299b85){_0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x299b85[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x524e=['ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','CloudProvider','get','Applications','applications','orderBy','priority','asc','autoclose','push','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','attachments','originTo','originCc','bcc'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x524e,0x15e));var _0xe524=function(_0x1639b7,_0x5114d6){_0x1639b7=_0x1639b7-0x0;var _0x2fecc1=_0x524e[_0x1639b7];return _0x2fecc1;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xe524('0x0'));var rs=require(_0xe524('0x1'));var Redis=require(_0xe524('0x2'));var db=require(_0xe524('0x3'))['db'];var logger=require(_0xe524('0x4'))(_0xe524('0x5'));var config=require(_0xe524('0x6'));var jayson=require(_0xe524('0x7'));var client=jayson[_0xe524('0x8')][_0xe524('0x9')]({'port':0x232c});config['redis']=_[_0xe524('0xa')](config[_0xe524('0xb')],{'host':_0xe524('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe524('0xb')]));require(_0xe524('0xd'))[_0xe524('0xe')](socket);function respondWithRpcPromise(_0x1f36e5,_0x991924,_0x4082b1){return new BPromise(function(_0x1a08e2,_0xb3eb9f){return client[_0xe524('0xf')](_0x1f36e5,_0x4082b1)[_0xe524('0x10')](function(_0x1e4459){logger[_0xe524('0x11')](_0xe524('0x12'),_0x991924,_0xe524('0x13'));logger[_0xe524('0x14')](_0xe524('0x15'),_0x991924,'request\x20sent',JSON['stringify'](_0x1e4459));if(_0x1e4459[_0xe524('0x16')]){if(_0x1e4459[_0xe524('0x16')][_0xe524('0x17')]===0x1f4){logger[_0xe524('0x16')](_0xe524('0x12'),_0x991924,_0x1e4459['error'][_0xe524('0x18')]);return _0xb3eb9f(_0x1e4459['error'][_0xe524('0x18')]);}logger[_0xe524('0x16')]('MailAccount,\x20%s,\x20%s',_0x991924,_0x1e4459[_0xe524('0x16')]['message']);return _0x1a08e2(_0x1e4459[_0xe524('0x16')]['message']);}else{logger[_0xe524('0x11')]('MailAccount,\x20%s,\x20%s',_0x991924,'request\x20sent');_0x1a08e2(_0x1e4459['result'][_0xe524('0x18')]);}})['catch'](function(_0x11b2a1){logger[_0xe524('0x16')](_0xe524('0x12'),_0x991924,_0x11b2a1);_0xb3eb9f(_0x11b2a1);});});}exports[_0xe524('0x19')]=function(_0x5d7b17){var _0x1fd93a=this;return new Promise(function(_0x3ccb3f,_0x49d104){return db[_0xe524('0x1a')][_0xe524('0x1b')]({'raw':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x1e')]||null:null,'attributes':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17['options'][_0xe524('0x1f')]||null:null,'limit':_0x5d7b17['options']?_0x5d7b17['options'][_0xe524('0x20')]||null:null,'include':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x21')]?_['map'](_0x5d7b17[_0xe524('0x1c')]['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x22')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1f')],'include':_0x17e245[_0xe524('0x21')]?_[_0xe524('0x23')](_0x17e245[_0xe524('0x21')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes'],'include':_0x2141db[_0xe524('0x21')]?_[_0xe524('0x23')](_0x2141db[_0xe524('0x21')],function(_0x109a96){return{'model':db[_0x109a96[_0xe524('0x22')]],'as':_0x109a96['as'],'attributes':_0x109a96['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b1ff){logger[_0xe524('0x11')](_0xe524('0x19'),_0x5d7b17);logger[_0xe524('0x14')](_0xe524('0x19'),_0x5d7b17,JSON['stringify'](_0x4b1ff));_0x3ccb3f(_0x4b1ff);})[_0xe524('0x24')](function(_0x9a7e98){logger['error']('GetMailAccount',_0x9a7e98[_0xe524('0x18')],_0x5d7b17);_0x49d104(_0x1fd93a[_0xe524('0x16')](0x1f4,_0x9a7e98['message']));});});};exports[_0xe524('0x25')]=function(_0x535354){var _0x3fec06=this;return new Promise(function(_0x54af2a,_0x315e56){return db[_0xe524('0x1a')][_0xe524('0x26')]({'raw':_0x535354['options']?_0x535354[_0xe524('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x535354[_0xe524('0x1c')]?_0x535354[_0xe524('0x1c')][_0xe524('0x1e')]||null:null,'attributes':_0x535354['options']?_0x535354[_0xe524('0x1c')][_0xe524('0x1f')]||null:null,'include':_0x535354['options']?_0x535354[_0xe524('0x1c')][_0xe524('0x21')]?_[_0xe524('0x23')](_0x535354[_0xe524('0x1c')]['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x22')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1f')],'include':_0x415450[_0xe524('0x21')]?_[_0xe524('0x23')](_0x415450[_0xe524('0x21')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x22')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes'],'include':_0x2741e8[_0xe524('0x21')]?_['map'](_0x2741e8[_0xe524('0x21')],function(_0x53eeee){return{'model':db[_0x53eeee['model']],'as':_0x53eeee['as'],'attributes':_0x53eeee[_0xe524('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c3aae){if(_0x535354[_0xe524('0x1c')][_0xe524('0x27')]===!![])_0x1c3aae[_0xe524('0x28')](_0xe524('0x29'),_0x1c3aae[_0xe524('0x2a')]());logger[_0xe524('0x11')](_0xe524('0x25'),_0x535354);logger['debug'](_0xe524('0x25'),_0x535354,JSON[_0xe524('0x2b')](_0x1c3aae));_0x54af2a(_0x1c3aae);})[_0xe524('0x24')](function(_0x3fd023){logger[_0xe524('0x16')](_0xe524('0x25'),_0x3fd023[_0xe524('0x18')],_0x535354);_0x315e56(_0x3fec06[_0xe524('0x16')](0x1f4,_0x3fd023['message']));});});};exports[_0xe524('0x2c')]=function(_0x849307){var _0x2e4a13=this;return new Promise(function(_0x59781b,_0x238673){var _0x5213ed={'body':_0x849307[_0xe524('0x2d')],'channel':_0xe524('0x2e')};var _0x43c314=_[_0xe524('0x2f')](_[_0xe524('0x30')](db[_0xe524('0x31')][_0xe524('0x32')]),['createdAt',_0xe524('0x33'),_0xe524('0x34'),_0xe524('0x35')]);var _0x376505=![];if(_0x849307[_0xe524('0x2d')]['id']){delete _0x849307[_0xe524('0x2d')]['id'];}if(_['isNil'](_0x849307[_0xe524('0x2d')][_0xe524('0x36')])){return _0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe524('0x37')](_0x849307['body']['body'])||_0x849307[_0xe524('0x2d')][_0xe524('0x2d')]===''){return _0x238673(_0x2e4a13['error'](0x1f4,_0xe524('0x38')));}if(_[_0xe524('0x37')](_0x849307[_0xe524('0x2d')][_0xe524('0x39')])){return _0x238673(_0x2e4a13['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43c314));}if(!_[_0xe524('0x3a')](_0x43c314,_0x849307[_0xe524('0x2d')]['mapKey'])){return _0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43c314));}var _0x472519={};_0x472519[_0x849307[_0xe524('0x2d')][_0xe524('0x39')]]=_0x849307[_0xe524('0x2d')][_0xe524('0x36')];return db[_0xe524('0x1a')][_0xe524('0x26')]({'where':{'id':_0x849307[_0xe524('0x3b')]['id']},'include':[{'model':db[_0xe524('0x3c')],'as':_0xe524('0x3d'),'include':[{'model':db[_0xe524('0x31')],'as':_0xe524('0x3e'),'where':_0x472519,'limit':0x1,'order':[[_0xe524('0x33'),_0xe524('0x3f')]]}]},{'model':db[_0xe524('0x40')],'as':'Applications'},{'model':db[_0xe524('0x41')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xe524('0x42')}]}]})['then'](function(_0x232cf0){if(_0x232cf0&&_0x232cf0[_0xe524('0x3d')]){var _0x561107=_0x232cf0[_0xe524('0x43')]({'plain':!![]});_0x5213ed['account']=_['omit'](_0x561107,[_0xe524('0x44'),_0xe524('0x3d')]);_0x5213ed[_0xe524('0x3b')]['smtpOptions']=_0x232cf0['getSmtpOptions']();_0x5213ed['applications']=_0x561107['Applications'];_0x5213ed['list']=_0x561107['List'];_0x5213ed[_0xe524('0x45')]=_[_0xe524('0x46')](_0x5213ed['applications'],[_0xe524('0x47')],[_0xe524('0x48')]);if(_0x5213ed[_0xe524('0x3b')]&&_0x5213ed[_0xe524('0x3b')][_0xe524('0x49')]){_0x5213ed['applications'][_0xe524('0x4a')]({'id':0x0,'priority':_0x5213ed[_0xe524('0x45')][_0xe524('0x4b')]+0x1,'app':'close','appdata':_0xe524('0x49'),'interval':'*,*,*,*'});}if(_0x5213ed[_0xe524('0x3b')][_0xe524('0x44')]){delete _0x5213ed[_0xe524('0x3b')][_0xe524('0x44')];}if(_0x5213ed[_0xe524('0x3b')][_0xe524('0x3d')]){delete _0x5213ed[_0xe524('0x3b')][_0xe524('0x3d')];}if(_0x561107[_0xe524('0x3d')][_0xe524('0x3e')][_0xe524('0x4b')]){return _0x561107[_0xe524('0x3d')]['Contacts'][0x0];}var _0x4dac0f=_['defaults'](_0x849307[_0xe524('0x2d')],{'firstName':_0x849307[_0xe524('0x2d')][_0xe524('0x36')],'ListId':_0x561107[_0xe524('0x35')]});_0x4dac0f[_0x849307[_0xe524('0x2d')][_0xe524('0x39')]]=_0x849307[_0xe524('0x2d')][_0xe524('0x36')];return db[_0xe524('0x31')][_0xe524('0x4c')](_0x4dac0f);}else{throw new Error(_0xe524('0x4d'));}})['then'](function(_0x5012fc){_0x5213ed[_0xe524('0x4e')]=_0x5012fc;if(_0x5012fc){if(!_0x849307['body']['message']['messageId']){_0x849307['body'][_0xe524('0x18')][_0xe524('0x4f')]=rs[_0xe524('0x50')]()+'\x20'+_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x36')];}var _0x244f08={'ContactId':_0x5012fc['id'],'MailAccountId':_0x849307[_0xe524('0x3b')]['id'],'inReplyTo':_0x849307[_0xe524('0x2d')]['message']['messageId'],'to':_0x849307['body'][_0xe524('0x18')]['from'],'cc':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x51')],'attach':_0x849307['body']['message'][_0xe524('0x52')],'lastMsgAt':moment()[_0xe524('0x53')](_0xe524('0x54')),'lastMsgDirection':'in'};return db[_0xe524('0x55')][_0xe524('0x26')]({'where':{'closed':![],'MailAccountId':_0x849307[_0xe524('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':_0xe524('0x56'),'attributes':[_0xe524('0x4f')],'where':{'messageId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x57')]}}]})[_0xe524('0x10')](function(_0x3bd9f9){if(_0x3bd9f9){return[_0x3bd9f9,![]];}return db['MailInteraction']['create'](_0x244f08)[_0xe524('0x10')](function(_0x35cbe9){return[_0x35cbe9,!![]];});});}else{throw new Error(_0xe524('0x58'));}})[_0xe524('0x59')](function(_0x139a0a,_0x4c6869){if(_0x139a0a){_0x376505=_0x4c6869;if(!_0x4c6869){return _0x139a0a[_0xe524('0x5a')]({'inReplyTo':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x4f')],'to':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x36')],'cc':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['subject'],'attach':_0x139a0a[_0xe524('0x52')]?_0x139a0a[_0xe524('0x52')]:_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x52')],'substatus':null,'substatusAt':moment()['format'](_0xe524('0x54')),'lastMsgAt':moment()[_0xe524('0x53')](_0xe524('0x54')),'lastMsgDirection':'in'});}else{return _0x139a0a;}}})[_0xe524('0x10')](function(_0x387c4b){_0x5213ed[_0xe524('0x5b')]=_0x387c4b[_0xe524('0x43')]({'plain':!![]});_0x5213ed['interaction'][_0xe524('0x5c')]=_0x376505;return db[_0xe524('0x5d')][_0xe524('0x4c')]({'body':_0x849307[_0xe524('0x2d')]['body'],'MailAccountId':_0x849307[_0xe524('0x3b')]['id'],'MailInteractionId':_0x387c4b['id'],'direction':'in','ContactId':_0x5213ed['contact']['id'],'messageId':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x4f')],'from':_0x849307['body'][_0xe524('0x18')][_0xe524('0x36')],'to':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['to'],'cc':_0x849307[_0xe524('0x2d')]['message']['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x51')],'attach':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['attach'],'Attachments':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x5e')],'originTo':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x5f')],'originCc':_0x849307['body'][_0xe524('0x18')][_0xe524('0x60')],'bcc':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x61')],'ChatWebsiteId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x62')]||null,'originChannel':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x63')]||_0xe524('0x64'),'ChatOfflineMessageId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x65')]||null},{'include':[{'model':db[_0xe524('0x66')],'as':_0xe524('0x67')}]});})[_0xe524('0x10')](function(_0x19b28a){_0x5213ed[_0xe524('0x18')]=_0x19b28a;if(_0x5213ed[_0xe524('0x5b')][_0xe524('0x68')]){return db[_0xe524('0x69')][_0xe524('0x26')]({'attributes':['id',_0xe524('0x6a')],'where':{'id':_0x5213ed[_0xe524('0x5b')][_0xe524('0x68')]}})[_0xe524('0x10')](function(_0x23425c){if(_0x23425c){_0x5213ed['applications'][_0xe524('0x6b')]({'id':0x0,'priority':0x0,'app':_0xe524('0x6c'),'appdata':_0x23425c[_0xe524('0x6a')]+','+(_0x5213ed['account'][_0xe524('0x6d')]||0xa),'interval':_0xe524('0x6e')});}return respondWithRpcPromise('Start','startRouting',_0x5213ed);});}return respondWithRpcPromise(_0xe524('0x6f'),'startRouting',_0x5213ed);})[_0xe524('0x10')](function(_0x5a6a07){_0x59781b(_0x5a6a07);})[_0xe524('0x24')](function(_0x1ed60b){_0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,_0x1ed60b[_0xe524('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b72cea8..c31698d 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 _0xb77e=['./mailAccount.events','save','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb77e,0x1e6));var _0xeb77=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb77e[_0x24237f];return _0x48298e;};'use strict';var MailAccountEvents=require(_0xeb77('0x0'));var events=[_0xeb77('0x1'),_0xeb77('0x2'),_0xeb77('0x3')];function createListener(_0x1ae2d5,_0x6264ba){return function(_0x3b4cf5){_0x6264ba[_0xeb77('0x4')](_0x1ae2d5,_0x3b4cf5);};}function removeListener(_0x3ba434,_0x2618c2){return function(){MailAccountEvents[_0xeb77('0x5')](_0x3ba434,_0x2618c2);};}exports[_0xeb77('0x6')]=function(_0x6b6538){for(var _0x1301d2=0x0,_0x5135ae=events[_0xeb77('0x7')];_0x1301d2<_0x5135ae;_0x1301d2++){var _0x45dd88=events[_0x1301d2];var _0x1f5824=createListener(_0xeb77('0x8')+_0x45dd88,_0x6b6538);MailAccountEvents['on'](_0x45dd88,_0x1f5824);}}; \ No newline at end of file +var _0x9fbb=['save','remove','update','removeListener','length','./mailAccount.events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9fbb,0x83));var _0xb9fb=function(_0x8dd631,_0x37419b){_0x8dd631=_0x8dd631-0x0;var _0x374ee5=_0x9fbb[_0x8dd631];return _0x374ee5;};'use strict';var MailAccountEvents=require(_0xb9fb('0x0'));var events=[_0xb9fb('0x1'),_0xb9fb('0x2'),_0xb9fb('0x3')];function createListener(_0x164fd7,_0x22e47f){return function(_0x1fe823){_0x22e47f['emit'](_0x164fd7,_0x1fe823);};}function removeListener(_0x556018,_0x17ca20){return function(){MailAccountEvents[_0xb9fb('0x4')](_0x556018,_0x17ca20);};}exports['register']=function(_0x181ca6){for(var _0x2b4ceb=0x0,_0x5d96d5=events[_0xb9fb('0x5')];_0x2b4ceb<_0x5d96d5;_0x2b4ceb++){var _0x42ee67=events[_0x2b4ceb];var _0x5ca45c=createListener('mailAccount:'+_0x42ee67,_0x181ca6);MailAccountEvents['on'](_0x42ee67,_0x5ca45c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 706ea6a..28e29ba 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 _0xb2ea=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','update','delete','exports'];(function(_0xbe61db,_0x512e66){var _0x2550bf=function(_0x4127ec){while(--_0x4127ec){_0xbe61db['push'](_0xbe61db['shift']());}};_0x2550bf(++_0x512e66);}(_0xb2ea,0x188));var _0xab2e=function(_0x16ec9d,_0x36ac5d){_0x16ec9d=_0x16ec9d-0x0;var _0x1e98b=_0xb2ea[_0x16ec9d];return _0x1e98b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab2e('0x0'));var timeout=require(_0xab2e('0x1'));var express=require('express');var router=express[_0xab2e('0x2')]();var fs_extra=require(_0xab2e('0x3'));var auth=require(_0xab2e('0x4'));var interaction=require(_0xab2e('0x5'));var config=require(_0xab2e('0x6'));var controller=require(_0xab2e('0x7'));router[_0xab2e('0x8')](_0xab2e('0x9'),auth['isAuthenticated'](),controller[_0xab2e('0xa')]);router['put'](_0xab2e('0x9'),auth['isAuthenticated'](),controller[_0xab2e('0xb')]);router[_0xab2e('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xab2e('0xd')]=router; \ No newline at end of file +var _0xa623=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x26e7dd,_0x3f49d9){var _0x49db22=function(_0x381365){while(--_0x381365){_0x26e7dd['push'](_0x26e7dd['shift']());}};_0x49db22(++_0x3f49d9);}(_0xa623,0xba));var _0x3a62=function(_0x5943ae,_0xd76cf2){_0x5943ae=_0x5943ae-0x0;var _0x329c20=_0xa623[_0x5943ae];return _0x329c20;};'use strict';var multer=require(_0x3a62('0x0'));var util=require(_0x3a62('0x1'));var path=require(_0x3a62('0x2'));var timeout=require(_0x3a62('0x3'));var express=require(_0x3a62('0x4'));var router=express[_0x3a62('0x5')]();var fs_extra=require(_0x3a62('0x6'));var auth=require(_0x3a62('0x7'));var interaction=require(_0x3a62('0x8'));var config=require(_0x3a62('0x9'));var controller=require(_0x3a62('0xa'));router['get']('/:id',auth[_0x3a62('0xb')](),controller[_0x3a62('0xc')]);router[_0x3a62('0xd')](_0x3a62('0xe'),auth[_0x3a62('0xb')](),controller[_0x3a62('0xf')]);router[_0x3a62('0x10')](_0x3a62('0xe'),auth[_0x3a62('0xb')](),controller[_0x3a62('0x11')]);module[_0x3a62('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index edf23b5..82d5577 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 _0xa3aa=['INTEGER','STRING','TEXT','sequelize'];(function(_0x53d267,_0x3cfbc2){var _0x3f46c0=function(_0x12d321){while(--_0x12d321){_0x53d267['push'](_0x53d267['shift']());}};_0x3f46c0(++_0x3cfbc2);}(_0xa3aa,0x1bb));var _0xaa3a=function(_0x52c864,_0x314587){_0x52c864=_0x52c864-0x0;var _0x1637ae=_0xa3aa[_0x52c864];return _0x1637ae;};'use strict';var Sequelize=require(_0xaa3a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xaa3a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaa3a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xaa3a('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xaa3a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf141=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf141,0x10b));var _0x1f14=function(_0x2d96f6,_0x4ce2fe){_0x2d96f6=_0x2d96f6-0x0;var _0x52cb8f=_0xf141[_0x2d96f6];return _0x52cb8f;};'use strict';var Sequelize=require(_0x1f14('0x0'));module[_0x1f14('0x1')]={'priority':{'type':Sequelize[_0x1f14('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1f14('0x3')],'allowNull':![],'defaultValue':_0x1f14('0x4')},'appdata':{'type':Sequelize[_0x1f14('0x5')]()},'description':{'type':Sequelize[_0x1f14('0x3')]},'interval':{'type':Sequelize[_0x1f14('0x3')],'defaultValue':_0x1f14('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 9a2e576..977be05 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x5274b8,_0x492cfb){var _0x1a4b00=function(_0x22bffd){while(--_0x22bffd){_0x5274b8['push'](_0x5274b8['shift']());}};_0x1a4b00(++_0x492cfb);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3576a8,_0x2a096e){_0x3576a8=_0x3576a8-0x0;var _0x49d6c7=_0xf4eb[_0x3576a8];return _0x49d6c7;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x14bce2,_0x38e8ef){var _0x1db8fd=function(_0x526db9){while(--_0x526db9){_0x14bce2['push'](_0x14bce2['shift']());}};_0x1db8fd(++_0x38e8ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 51b38b6..2578877 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 _0x5a11=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes','exports','MailApplication','mail_applications'];(function(_0xc99b49,_0x490bc3){var _0x597097=function(_0x28cb5c){while(--_0x28cb5c){_0xc99b49['push'](_0xc99b49['shift']());}};_0x597097(++_0x490bc3);}(_0x5a11,0xec));var _0x15a1=function(_0x16fc46,_0x55190d){_0x16fc46=_0x16fc46-0x0;var _0x20b456=_0x5a11[_0x16fc46];return _0x20b456;};'use strict';var _=require('lodash');var util=require(_0x15a1('0x0'));var logger=require('../../config/logger')(_0x15a1('0x1'));var moment=require(_0x15a1('0x2'));var BPromise=require(_0x15a1('0x3'));var rp=require(_0x15a1('0x4'));var fs=require('fs');var path=require(_0x15a1('0x5'));var rimraf=require(_0x15a1('0x6'));var config=require('../../config/environment');var attributes=require(_0x15a1('0x7'));module[_0x15a1('0x8')]=function(_0xbf73ce,_0x5c8fe9){return _0xbf73ce['define'](_0x15a1('0x9'),attributes,{'tableName':_0x15a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x15a1('0xb'),'collate':_0x15a1('0xc')});}; \ No newline at end of file +var _0xa99f=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x5a5aef,_0x19e804){var _0x16cd96=function(_0x21fb49){while(--_0x21fb49){_0x5a5aef['push'](_0x5a5aef['shift']());}};_0x16cd96(++_0x19e804);}(_0xa99f,0x1d5));var _0xfa99=function(_0x385926,_0x3e4785){_0x385926=_0x385926-0x0;var _0x31b323=_0xa99f[_0x385926];return _0x31b323;};'use strict';var _=require(_0xfa99('0x0'));var util=require('util');var logger=require(_0xfa99('0x1'))('api');var moment=require(_0xfa99('0x2'));var BPromise=require('bluebird');var rp=require(_0xfa99('0x3'));var fs=require('fs');var path=require(_0xfa99('0x4'));var rimraf=require(_0xfa99('0x5'));var config=require(_0xfa99('0x6'));var attributes=require('./mailApplication.attributes');module[_0xfa99('0x7')]=function(_0x1de803,_0x250151){return _0x1de803[_0xfa99('0x8')](_0xfa99('0x9'),attributes,{'tableName':_0xfa99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfa99('0xb'),'collate':_0xfa99('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index bbe9fa1..c61ad13 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 _0xca71=['../../config/logger','rpc','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x53c8c7,_0x348f83){var _0x4f9626=function(_0x25c457){while(--_0x25c457){_0x53c8c7['push'](_0x53c8c7['shift']());}};_0x4f9626(++_0x348f83);}(_0xca71,0x164));var _0x1ca7=function(_0x4e1ef7,_0x349fa5){_0x4e1ef7=_0x4e1ef7-0x0;var _0x20f191=_0xca71[_0x4e1ef7];return _0x20f191;};'use strict';var _=require('lodash');var util=require(_0x1ca7('0x0'));var moment=require(_0x1ca7('0x1'));var BPromise=require(_0x1ca7('0x2'));var rs=require(_0x1ca7('0x3'));var fs=require('fs');var Redis=require(_0x1ca7('0x4'));var db=require(_0x1ca7('0x5'))['db'];var utils=require(_0x1ca7('0x6'));var logger=require(_0x1ca7('0x7'))(_0x1ca7('0x8'));var config=require('../../config/environment');var jayson=require(_0x1ca7('0x9'));var client=jayson[_0x1ca7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57b5a4,_0x58dafb,_0x36bfe3){return new BPromise(function(_0x721bf9,_0x1a6e7d){return client[_0x1ca7('0xb')](_0x57b5a4,_0x36bfe3)[_0x1ca7('0xc')](function(_0x36abad){logger['info'](_0x1ca7('0xd'),_0x58dafb,'request\x20sent');logger[_0x1ca7('0xe')](_0x1ca7('0xf'),_0x58dafb,_0x1ca7('0x10'),JSON[_0x1ca7('0x11')](_0x36abad));if(_0x36abad[_0x1ca7('0x12')]){if(_0x36abad['error'][_0x1ca7('0x13')]===0x1f4){logger['error'](_0x1ca7('0xd'),_0x58dafb,_0x36abad['error']['message']);return _0x1a6e7d(_0x36abad['error'][_0x1ca7('0x14')]);}logger[_0x1ca7('0x12')]('MailApplication,\x20%s,\x20%s',_0x58dafb,_0x36abad['error']['message']);return _0x721bf9(_0x36abad[_0x1ca7('0x12')][_0x1ca7('0x14')]);}else{logger['info'](_0x1ca7('0xd'),_0x58dafb,_0x1ca7('0x10'));_0x721bf9(_0x36abad[_0x1ca7('0x15')][_0x1ca7('0x14')]);}})[_0x1ca7('0x16')](function(_0x15b429){logger[_0x1ca7('0x12')]('MailApplication,\x20%s,\x20%s',_0x58dafb,_0x15b429);_0x1a6e7d(_0x15b429);});});}exports[_0x1ca7('0x17')]=function(_0x330d06){var _0x4fbca8=this;return new Promise(function(_0x281f8e,_0x275daa){return db[_0x1ca7('0x18')][_0x1ca7('0x19')](_0x330d06[_0x1ca7('0x1a')],{'raw':_0x330d06[_0x1ca7('0x1b')]?_0x330d06[_0x1ca7('0x1b')][_0x1ca7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x330d06[_0x1ca7('0x1b')]?_0x330d06[_0x1ca7('0x1b')][_0x1ca7('0x1d')]||null:null,'attributes':_0x330d06[_0x1ca7('0x1b')]?_0x330d06[_0x1ca7('0x1b')][_0x1ca7('0x1e')]||null:null,'limit':_0x330d06[_0x1ca7('0x1b')]?_0x330d06[_0x1ca7('0x1b')][_0x1ca7('0x1f')]||null:null})[_0x1ca7('0xc')](function(_0x22c48d){logger[_0x1ca7('0x20')]('UpdateMailApplication',_0x330d06);logger[_0x1ca7('0xe')](_0x1ca7('0x17'),_0x330d06,JSON['stringify'](_0x22c48d));_0x281f8e(_0x22c48d);})['catch'](function(_0x23cd80){logger['error'](_0x1ca7('0x17'),_0x23cd80['message'],_0x330d06);_0x275daa(_0x4fbca8[_0x1ca7('0x12')](0x1f4,_0x23cd80['message']));});});}; \ No newline at end of file +var _0xaa52=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','MailApplication','update','body','options','raw','where','limit','UpdateMailApplication','catch','lodash','util','moment'];(function(_0x3d8dbd,_0x11104f){var _0x35e9c1=function(_0x4d4d74){while(--_0x4d4d74){_0x3d8dbd['push'](_0x3d8dbd['shift']());}};_0x35e9c1(++_0x11104f);}(_0xaa52,0x1a1));var _0x2aa5=function(_0x586625,_0xde075e){_0x586625=_0x586625-0x0;var _0x9ae7c8=_0xaa52[_0x586625];return _0x9ae7c8;};'use strict';var _=require(_0x2aa5('0x0'));var util=require(_0x2aa5('0x1'));var moment=require(_0x2aa5('0x2'));var BPromise=require(_0x2aa5('0x3'));var rs=require(_0x2aa5('0x4'));var fs=require('fs');var Redis=require(_0x2aa5('0x5'));var db=require(_0x2aa5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2aa5('0x7'));var config=require(_0x2aa5('0x8'));var jayson=require(_0x2aa5('0x9'));var client=jayson[_0x2aa5('0xa')][_0x2aa5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19cd94,_0x251e11,_0x46da6c){return new BPromise(function(_0x466a5c,_0x2355fa){return client['request'](_0x19cd94,_0x46da6c)[_0x2aa5('0xc')](function(_0x41b5bc){logger[_0x2aa5('0xd')](_0x2aa5('0xe'),_0x251e11,_0x2aa5('0xf'));logger[_0x2aa5('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x251e11,_0x2aa5('0xf'),JSON[_0x2aa5('0x11')](_0x41b5bc));if(_0x41b5bc[_0x2aa5('0x12')]){if(_0x41b5bc[_0x2aa5('0x12')][_0x2aa5('0x13')]===0x1f4){logger[_0x2aa5('0x12')](_0x2aa5('0xe'),_0x251e11,_0x41b5bc[_0x2aa5('0x12')][_0x2aa5('0x14')]);return _0x2355fa(_0x41b5bc['error'][_0x2aa5('0x14')]);}logger['error'](_0x2aa5('0xe'),_0x251e11,_0x41b5bc[_0x2aa5('0x12')][_0x2aa5('0x14')]);return _0x466a5c(_0x41b5bc['error']['message']);}else{logger[_0x2aa5('0xd')](_0x2aa5('0xe'),_0x251e11,'request\x20sent');_0x466a5c(_0x41b5bc['result'][_0x2aa5('0x14')]);}})['catch'](function(_0x353f51){logger[_0x2aa5('0x12')]('MailApplication,\x20%s,\x20%s',_0x251e11,_0x353f51);_0x2355fa(_0x353f51);});});}exports['UpdateMailApplication']=function(_0x2cb964){var _0x29f341=this;return new Promise(function(_0x258a01,_0x4bc487){return db[_0x2aa5('0x15')][_0x2aa5('0x16')](_0x2cb964[_0x2aa5('0x17')],{'raw':_0x2cb964[_0x2aa5('0x18')]?_0x2cb964[_0x2aa5('0x18')][_0x2aa5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cb964[_0x2aa5('0x18')]?_0x2cb964['options'][_0x2aa5('0x1a')]||null:null,'attributes':_0x2cb964[_0x2aa5('0x18')]?_0x2cb964[_0x2aa5('0x18')]['attributes']||null:null,'limit':_0x2cb964[_0x2aa5('0x18')]?_0x2cb964[_0x2aa5('0x18')][_0x2aa5('0x1b')]||null:null})['then'](function(_0x4931a2){logger[_0x2aa5('0xd')](_0x2aa5('0x1c'),_0x2cb964);logger['debug']('UpdateMailApplication',_0x2cb964,JSON[_0x2aa5('0x11')](_0x4931a2));_0x258a01(_0x4931a2);})[_0x2aa5('0x1d')](function(_0x425d93){logger[_0x2aa5('0x12')](_0x2aa5('0x1c'),_0x425d93['message'],_0x2cb964);_0x4bc487(_0x29f341['error'](0x1f4,_0x425d93[_0x2aa5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index d550831..9328c77 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 _0x943a=['index','describe','show','/:id/messages','getMessages','download','post','create','mailinteraction:addtags','/:id','tracked','mail','update','delete','mailinteraction:destroy','destroy','/:id/tags','exports','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x558d34,_0x29a338){var _0x4d99c2=function(_0x1ccd48){while(--_0x1ccd48){_0x558d34['push'](_0x558d34['shift']());}};_0x4d99c2(++_0x29a338);}(_0x943a,0x85));var _0xa943=function(_0x288076,_0x415fbf){_0x288076=_0x288076-0x0;var _0x50444b=_0x943a[_0x288076];return _0x50444b;};'use strict';var express=require(_0xa943('0x0'));var router=express[_0xa943('0x1')]();var auth=require(_0xa943('0x2'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0xa943('0x3')]('/',auth[_0xa943('0x4')](),controller[_0xa943('0x5')]);router[_0xa943('0x3')]('/describe',auth[_0xa943('0x4')](),controller[_0xa943('0x6')]);router[_0xa943('0x3')]('/:id',auth[_0xa943('0x4')](),controller[_0xa943('0x7')]);router[_0xa943('0x3')](_0xa943('0x8'),auth[_0xa943('0x4')](),controller[_0xa943('0x9')]);router[_0xa943('0x3')]('/:id/download',auth[_0xa943('0x4')](),controller[_0xa943('0xa')]);router[_0xa943('0xb')]('/',auth[_0xa943('0x4')](),controller[_0xa943('0xc')]);router[_0xa943('0xb')]('/:id/messages',auth[_0xa943('0x4')](),controller['addMessage']);router[_0xa943('0xb')]('/:id/tags',auth[_0xa943('0x4')](),interaction['tracked']('mail',_0xa943('0xd')),controller['addTags']);router['put'](_0xa943('0xe'),auth[_0xa943('0x4')](),interaction[_0xa943('0xf')](_0xa943('0x10'),'mailinteraction:update'),controller[_0xa943('0x11')]);router[_0xa943('0x12')](_0xa943('0xe'),auth[_0xa943('0x4')](),interaction[_0xa943('0xf')](_0xa943('0x10'),_0xa943('0x13')),controller[_0xa943('0x14')]);router['delete'](_0xa943('0x15'),auth[_0xa943('0x4')](),controller['removeTags']);module[_0xa943('0x16')]=router; \ No newline at end of file +var _0xd286=['../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','/:id','mailinteraction:destroy','exports','express','Router','../../components/auth/service'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd286,0x126));var _0x6d28=function(_0x21ce32,_0x2ccd1c){_0x21ce32=_0x21ce32-0x0;var _0xd6b087=_0xd286[_0x21ce32];return _0xd6b087;};'use strict';var express=require(_0x6d28('0x0'));var router=express[_0x6d28('0x1')]();var auth=require(_0x6d28('0x2'));var interaction=require(_0x6d28('0x3'));var controller=require(_0x6d28('0x4'));router['get']('/',auth[_0x6d28('0x5')](),controller[_0x6d28('0x6')]);router[_0x6d28('0x7')](_0x6d28('0x8'),auth['isAuthenticated'](),controller[_0x6d28('0x9')]);router[_0x6d28('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6d28('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6d28('0xa')]);router['get'](_0x6d28('0xb'),auth[_0x6d28('0x5')](),controller[_0x6d28('0xc')]);router[_0x6d28('0xd')]('/',auth[_0x6d28('0x5')](),controller['create']);router[_0x6d28('0xd')](_0x6d28('0xe'),auth[_0x6d28('0x5')](),controller[_0x6d28('0xf')]);router['post'](_0x6d28('0x10'),auth[_0x6d28('0x5')](),interaction[_0x6d28('0x11')](_0x6d28('0x12'),_0x6d28('0x13')),controller[_0x6d28('0x14')]);router[_0x6d28('0x15')]('/:id',auth[_0x6d28('0x5')](),interaction[_0x6d28('0x11')](_0x6d28('0x12'),_0x6d28('0x16')),controller['update']);router[_0x6d28('0x17')](_0x6d28('0x18'),auth[_0x6d28('0x5')](),interaction[_0x6d28('0x11')](_0x6d28('0x12'),_0x6d28('0x19')),controller['destroy']);router['delete'](_0x6d28('0x10'),auth[_0x6d28('0x5')](),controller['removeTags']);module[_0x6d28('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b042ba9..483a397 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 _0x9a02=['sequelize','exports','STRING','BOOLEAN','DATE','ENUM','out'];(function(_0x7ae0d1,_0x5ce7d8){var _0x5427f4=function(_0x570b4e){while(--_0x570b4e){_0x7ae0d1['push'](_0x7ae0d1['shift']());}};_0x5427f4(++_0x5ce7d8);}(_0x9a02,0x1a4));var _0x29a0=function(_0x22a6d3,_0x64b4){_0x22a6d3=_0x22a6d3-0x0;var _0x586afe=_0x9a02[_0x22a6d3];return _0x586afe;};'use strict';var Sequelize=require(_0x29a0('0x0'));var iconv=require('iconv');module[_0x29a0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x29a0('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x29a0('0x2')]},'note':{'type':Sequelize[_0x29a0('0x2')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x29a0('0x2')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x29a0('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x29a0('0x4')]},'substatus':{'type':Sequelize[_0x29a0('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x29a0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x29a0('0x5')]('in',_0x29a0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x29a0('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x29a0('0x5')]('in',_0x29a0('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x29a0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc16b=['TEXT','DATE','out','ENUM','sequelize','iconv','BOOLEAN','STRING','long'];(function(_0x4f383a,_0x23e2db){var _0x2c30b1=function(_0x219098){while(--_0x219098){_0x4f383a['push'](_0x4f383a['shift']());}};_0x2c30b1(++_0x23e2db);}(_0xc16b,0x109));var _0xbc16=function(_0x3425ff,_0x7d0b87){_0x3425ff=_0x3425ff-0x0;var _0xcc19b4=_0xc16b[_0x3425ff];return _0xcc19b4;};'use strict';var Sequelize=require(_0xbc16('0x0'));var iconv=require(_0xbc16('0x1'));module['exports']={'closed':{'type':Sequelize[_0xbc16('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xbc16('0x3')](0x1fe)},'to':{'type':Sequelize[_0xbc16('0x3')]},'cc':{'type':Sequelize['TEXT'](_0xbc16('0x4'))},'subject':{'type':Sequelize[_0xbc16('0x5')]()},'attach':{'type':Sequelize[_0xbc16('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbc16('0x6')]},'substatus':{'type':Sequelize[_0xbc16('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xbc16('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbc16('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbc16('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xbc16('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbc16('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index dbad0ab..c1b5376 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 _0x6b1b=['unix','join','root','files','tmp','transcript-%d-%s.zip','attachments','Attachment','bcc','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','sendStatus','rimraf','zip-dir','moment','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','html-entities','redis','socket.io-emitter','status','json','offset','undefined','limit','count','update','then','destroy','error','stack','name','send','Users','TagIds','Tags','split','push','MailMessage','out','plainBody','-id','trimStart','catch','waiting','talking','answered','UserId','closed','unmanaged','total','index','map','MailInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','color','tools_tags','select','u.fullname','ui.MailInteractionId','from','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','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','buildExpression','text','start','Tag','forEach','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','end','some','compact','isEmpty','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','i.id\x20LIKE\x20?','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)','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closedAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','findOne','enableEmailPreview','all','rows','params','include','options','create','body','describe','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','addTags','setTags','spread','removeTags','download'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x6b1b[_0x4e6ae6];return _0x23c108;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6b1('0x0'));var zipdir=require(_0xb6b1('0x1'));var moment=require(_0xb6b1('0x2'));var BPromise=require('bluebird');var util=require(_0xb6b1('0x3'));var path=require(_0xb6b1('0x4'));var fs=require('fs');var _=require(_0xb6b1('0x5'));var squel=require(_0xb6b1('0x6'));var juice=require(_0xb6b1('0x7'));var Redis=require(_0xb6b1('0x8'));var qs=require(_0xb6b1('0x9'));var as=require(_0xb6b1('0xa'));var logger=require(_0xb6b1('0xb'))(_0xb6b1('0xc'));var config=require(_0xb6b1('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xb6b1('0xe'));config['redis']=_['defaults'](config[_0xb6b1('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xb6b1('0x10'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x593218,_0x1f8f10){_0x1f8f10=_0x1f8f10||0xcc;return function(_0x1cec84){if(_0x1cec84){return _0x593218['sendStatus'](_0x1f8f10);}return _0x593218[_0xb6b1('0x11')](_0x1f8f10)['end']();};}function respondWithResult(_0x5c5837,_0x406dce){_0x406dce=_0x406dce||0xc8;return function(_0x2e5256){if(_0x2e5256){return _0x5c5837[_0xb6b1('0x11')](_0x406dce)[_0xb6b1('0x12')](_0x2e5256);}};}function respondWithFilteredResult(_0x23881d,_0x18f6b5){return function(_0x360fc7){if(_0x360fc7){var _0x429d0d=typeof _0x18f6b5[_0xb6b1('0x13')]===_0xb6b1('0x14')&&typeof _0x18f6b5[_0xb6b1('0x15')]===_0xb6b1('0x14');var _0x4f770a=_0x360fc7['count'];var _0x513207=_0x429d0d?0x0:_0x18f6b5['offset'];var _0xee229d=_0x429d0d?_0x360fc7[_0xb6b1('0x16')]:_0x18f6b5[_0xb6b1('0x13')]+_0x18f6b5[_0xb6b1('0x15')];var _0x32e395;if(_0xee229d>=_0x4f770a){_0xee229d=_0x4f770a;_0x32e395=0xc8;}else{_0x32e395=0xce;}_0x23881d[_0xb6b1('0x11')](_0x32e395);return _0x23881d['set']('Content-Range',_0x513207+'-'+_0xee229d+'/'+_0x4f770a)[_0xb6b1('0x12')](_0x360fc7);}return null;};}function saveUpdates(_0x15456d){return function(_0x16d969){if(_0x16d969){return _0x16d969[_0xb6b1('0x17')](_0x15456d)[_0xb6b1('0x18')](function(_0x3fc9b1){return _0x3fc9b1;});}return null;};}function removeEntity(_0x5ba14d){return function(_0x4e132a){if(_0x4e132a){return _0x4e132a[_0xb6b1('0x19')]()[_0xb6b1('0x18')](function(){_0x5ba14d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc247a){return function(_0x5c8529){if(!_0x5c8529){_0xfc247a['sendStatus'](0x194);}return _0x5c8529;};}function handleError(_0x232157,_0x2086ea){_0x2086ea=_0x2086ea||0x1f4;return function(_0x36ac63){logger[_0xb6b1('0x1a')](_0x36ac63[_0xb6b1('0x1b')]);if(_0x36ac63[_0xb6b1('0x1c')]){delete _0x36ac63[_0xb6b1('0x1c')];}_0x232157[_0xb6b1('0x11')](_0x2086ea)[_0xb6b1('0x1d')](_0x36ac63);};}function getInteractionUsers(_0x20066f,_0x5069cd){return new BPromise(function(_0x214cd0,_0x4f1e2e){try{if(_0x5069cd[_0x20066f['id']]){_0x20066f[_0xb6b1('0x1e')]=_['map'](_0x5069cd[_0x20066f['id']],function(_0xdbcb77){return{'id':_0xdbcb77['id'],'fullname':_0xdbcb77['fullname']};});}}catch(_0x35a567){_0x4f1e2e(_0x35a567);}_0x214cd0(_0x20066f);});}function getInteractionTags(_0x387603,_0xac4256){return new BPromise(function(_0x178401,_0x13e841){try{if(_0x387603[_0xb6b1('0x1f')]){_0x387603[_0xb6b1('0x20')]=[];_0x387603[_0xb6b1('0x1f')][_0xb6b1('0x21')](',')['forEach'](function(_0xf40426){_0x387603['Tags'][_0xb6b1('0x22')](_0xac4256[_0xf40426]);});}delete _0x387603[_0xb6b1('0x1f')];}catch(_0x367d66){_0x13e841(_0x367d66);}_0x178401(_0x387603);});}function getLastMessageText(_0x3f8849){return new BPromise(function(_0x136fe5,_0x12f369){return db[_0xb6b1('0x23')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x3f8849['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb6b1('0x24')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb6b1('0x25')],'order':_0xb6b1('0x26'),'raw':!![]})['then'](function(_0x22beb9){if(_0x22beb9&&_0x22beb9[_0xb6b1('0x25')]){_0x3f8849['lastMsgText']=_[_0xb6b1('0x27')](_0x22beb9[_0xb6b1('0x25')]);}_0x136fe5(_0x3f8849);})[_0xb6b1('0x28')](function(_0x21bfac){_0x12f369(_0x21bfac);});});}function updateMailInteraction(_0x3ead6b,_0x326c5f,_0x4d29e4,_0x3cca75){return new BPromise(function(_0xff1d43,_0x4abe40){return getInteractionUsers(_0x3ead6b,_0x4d29e4)[_0xb6b1('0x18')](function(_0x4e11a1){return getInteractionTags(_0x4e11a1,_0x326c5f);})[_0xb6b1('0x18')](function(_0x242ec3){return getStateInteraction(_0x242ec3);})[_0xb6b1('0x18')](function(_0x4cad81){if(_0x3cca75){_0xff1d43(getLastMessageText(_0x4cad81));}else{_0xff1d43(_0x4cad81);}})[_0xb6b1('0x28')](function(_0x2dd9e2){_0x4abe40(_0x2dd9e2);});});}function getStateInteraction(_0x59efdc){return new BPromise(function(_0x203d8e){_0x59efdc[_0xb6b1('0x29')]=0x0;_0x59efdc[_0xb6b1('0x2a')]=0x0;_0x59efdc[_0xb6b1('0x2b')]=0x0;_0x59efdc['unmanaged']=0x0;_0x59efdc['total']=0x0;if(!_0x59efdc['closed']&&!_0x59efdc[_0xb6b1('0x2c')]){_0x59efdc[_0xb6b1('0x29')]+=0x1;}if(!_0x59efdc[_0xb6b1('0x2d')]&&_0x59efdc[_0xb6b1('0x2c')]){_0x59efdc[_0xb6b1('0x2a')]+=0x1;if(_0x59efdc[_0xb6b1('0x29')]){_0x59efdc[_0xb6b1('0x29')]-=0x1;}}if(_0x59efdc[_0xb6b1('0x2d')]&&_0x59efdc[_0xb6b1('0x2c')]){_0x59efdc[_0xb6b1('0x2b')]+=0x1;if(_0x59efdc[_0xb6b1('0x2a')]){_0x59efdc[_0xb6b1('0x2a')]-=0x1;}}if(_0x59efdc['closed']&&!_0x59efdc[_0xb6b1('0x2c')]){_0x59efdc[_0xb6b1('0x2e')]+=0x1;if(_0x59efdc[_0xb6b1('0x29')]){_0x59efdc[_0xb6b1('0x29')]-=0x1;}}_0x59efdc[_0xb6b1('0x2f')]+=0x1;_0x203d8e(_0x59efdc);});}exports[_0xb6b1('0x30')]=function(_0xfe126,_0x3df192){var _0x33dc30={},_0x276801={},_0x44a61a={'count':0x0,'rows':[]};var _0x56470a=_[_0xb6b1('0x31')](db[_0xb6b1('0x32')][_0xb6b1('0x33')],function(_0x2d6b2b){return{'name':_0x2d6b2b[_0xb6b1('0x34')],'type':_0x2d6b2b[_0xb6b1('0x35')][_0xb6b1('0x36')]};});_0x276801[_0xb6b1('0x37')]=_['map'](_0x56470a,'name');_0x276801[_0xb6b1('0x38')]=_[_0xb6b1('0x39')](_0xfe126[_0xb6b1('0x38')]);_0x276801['filters']=_[_0xb6b1('0x3a')](_0x276801[_0xb6b1('0x37')],_0x276801[_0xb6b1('0x38')]);_0x33dc30[_0xb6b1('0x3b')]=_[_0xb6b1('0x3a')](_0x276801[_0xb6b1('0x37')],qs[_0xb6b1('0x3c')](_0xfe126[_0xb6b1('0x38')]['fields']));_0x33dc30[_0xb6b1('0x3b')]=_0x33dc30['attributes'][_0xb6b1('0x3d')]?_0x33dc30[_0xb6b1('0x3b')]:_0x276801[_0xb6b1('0x37')];if(!_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x3e')](_0xb6b1('0x3f'))){_0x33dc30['limit']=qs[_0xb6b1('0x15')](_0xfe126[_0xb6b1('0x38')]['limit']);_0x33dc30[_0xb6b1('0x13')]=qs['offset'](_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x13')]);}_0x33dc30[_0xb6b1('0x40')]=qs[_0xb6b1('0x41')](_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x41')]);_0x33dc30[_0xb6b1('0x42')]=qs[_0xb6b1('0x43')](_[_0xb6b1('0x44')](_0xfe126['query'],_0x276801['filters']),_0x56470a);var _0x3826bd=[];var _0x2c00fb=squel['select']()[_0xb6b1('0x45')]('id')[_0xb6b1('0x45')](_0xb6b1('0x1c'))[_0xb6b1('0x45')](_0xb6b1('0x46'))['from'](_0xb6b1('0x47'));var _0x1f4881=squel[_0xb6b1('0x48')]()[_0xb6b1('0x45')]('u.id')['field'](_0xb6b1('0x49'))['field'](_0xb6b1('0x4a'))[_0xb6b1('0x4b')]('user_has_mail_interactions','ui')[_0xb6b1('0x4c')]('users','u',_0xb6b1('0x4d'));var _0x7d4763=squel[_0xb6b1('0x48')]()[_0xb6b1('0x4b')](_0xb6b1('0x4e'),'i')[_0xb6b1('0x4c')](_0xb6b1('0x4f'),'c',_0xb6b1('0x50'))[_0xb6b1('0x4c')](_0xb6b1('0x51'),'o','o.id\x20=\x20i.UserId')[_0xb6b1('0x4c')](_0xb6b1('0x52'),'a',_0xb6b1('0x53'))[_0xb6b1('0x4c')](_0xb6b1('0x54'),'me',_0xb6b1('0x55'))[_0xb6b1('0x4c')](_0xb6b1('0x56'),'it',_0xb6b1('0x57'))['left_join'](_0xb6b1('0x47'),'t','t.id\x20=\x20it.TagId');var _0x5adb1c=squel[_0xb6b1('0x58')]();var _0x2123f5=[];var _0x5be7bf=squel[_0xb6b1('0x58')]();var _0x323231;if(_0xfe126[_0xb6b1('0x38')]['search']){_0x323231=as[_0xb6b1('0x59')](_0xfe126['query']['search']);var _0x239de5=_0x323231[_0xb6b1('0x5a')];for(var _0x49eaf4=0x0;_0x49eaf4<_0x323231['conditions']['length'];_0x49eaf4++){var _0x2e7af7=_0x323231['conditions'][_0x49eaf4];var _0x54c88f='i';var _0x47e64e=_[_0xb6b1('0x5b')](_0x56470a,[_0xb6b1('0x1c'),_0x2e7af7[_0xb6b1('0x45')]]);if(!_0x47e64e){switch(_0x2e7af7[_0xb6b1('0x45')]){case _0xb6b1('0x5c'):if(_0x2e7af7[_0xb6b1('0x5d')]==0x1){_0x7d4763['having']('`'+_0x2e7af7[_0xb6b1('0x45')]+_0xb6b1('0x5e'));}else{_0x7d4763['having']('`'+_0x2e7af7['field']+_0xb6b1('0x5f'));}break;case _0xb6b1('0x60'):if(_0x2e7af7['operator']==='$substring'){if(_0x2e7af7[_0xb6b1('0x5d')]['split']('\x20')[_0xb6b1('0x3d')]>0x1){_0x5adb1c[_0x239de5](_0xb6b1('0x61'),qs['getFullTextValue'](_0x2e7af7[_0xb6b1('0x5d')]),null);}else{var _0x30f8e5='%'+_0x2e7af7[_0xb6b1('0x5d')]+'%';_0x5adb1c[_0x239de5](_0xb6b1('0x62'),_0x30f8e5,_0x30f8e5,_0x30f8e5);}}else{_0x47e64e=_[_0xb6b1('0x5b')](_0x56470a,[_0xb6b1('0x1c'),_0xb6b1('0x63')]);_0x2e7af7[_0xb6b1('0x45')]=_0xb6b1('0x63');_0x55f565=as[_0xb6b1('0x64')](_0x54c88f,_0x47e64e['type'],_0x2e7af7);_0x5adb1c[_0x239de5](_0x55f565[_0xb6b1('0x65')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x66')],_0x55f565[_0xb6b1('0x5d')]['end']);}break;case _0xb6b1('0x67'):var _0xce50c3=_0x2e7af7[_0xb6b1('0x5d')][_0xb6b1('0x21')](',')[_0xb6b1('0x31')](function(_0x676c89){return Number(_0x676c89);});_0xce50c3[_0xb6b1('0x68')](function(_0x4e34ef){_0x5be7bf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e34ef+',%');});_0x2123f5=_[_0xb6b1('0x69')](_0x2123f5,_0xce50c3);break;case'User':if(_0x2e7af7[_0xb6b1('0x6a')]===_0xb6b1('0x6b')){_0x5adb1c[_0x239de5](_0xb6b1('0x6c'),'%'+_0x2e7af7['value']+'%',null);}else{_0x47e64e=_[_0xb6b1('0x5b')](_0x56470a,[_0xb6b1('0x1c'),_0xb6b1('0x2c')]);_0x2e7af7[_0xb6b1('0x45')]=_0xb6b1('0x2c');_0x55f565=as['buildExpression'](_0x54c88f,_0x47e64e['type'],_0x2e7af7);_0x5adb1c[_0x239de5](_0x55f565[_0xb6b1('0x65')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x66')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x6d')]);}break;case _0xb6b1('0x25'):_0x55f565=as[_0xb6b1('0x64')]('me',null,_0x2e7af7);_0x5adb1c[_0x239de5](_0x55f565[_0xb6b1('0x65')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x66')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x6d')]);break;}}else{var _0x55f565=as[_0xb6b1('0x64')](_0x54c88f,_0x47e64e['type'],_0x2e7af7);_0x5adb1c[_0x239de5](_0x55f565[_0xb6b1('0x65')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x66')],_0x55f565['value'][_0xb6b1('0x6d')]);}}}else{var _0x4c795a=_(_0xfe126['query'])[_0xb6b1('0x39')]()['map'](function(_0x462175){return _[_0xb6b1('0x6e')](_0x56470a,['name',_0x462175])?_0x462175:undefined;})[_0xb6b1('0x6f')]()['value']();if(!_[_0xb6b1('0x70')](_0x4c795a)){_0x4c795a[_0xb6b1('0x68')](function(_0x2b280e){if(_0x2b280e==='MailAccountId'){_0x7d4763[_0xb6b1('0x42')]('i.MailAccountId\x20IN\x20?',[][_0xb6b1('0x71')](_0xfe126[_0xb6b1('0x38')][_0x2b280e]));}else if(_0x2b280e===_0xb6b1('0x72')){var _0xa740a5=JSON['parse'](_0xfe126[_0xb6b1('0x38')][_0x2b280e])[_0xb6b1('0x73')];var _0x3e663d=JSON[_0xb6b1('0x74')](_0xfe126[_0xb6b1('0x38')][_0x2b280e])[_0xb6b1('0x75')];_0x7d4763['where'](_0xb6b1('0x76'),_0xa740a5,_0x3e663d);}else{if(_0xfe126[_0xb6b1('0x38')][_0x2b280e]===_0xb6b1('0x77')){_0x7d4763[_0xb6b1('0x42')]('i.'+_0x2b280e+'\x20IS\x20NULL');}else{_0x7d4763[_0xb6b1('0x42')]('i.'+_0x2b280e+_0xb6b1('0x78'),_0xfe126['query'][_0x2b280e]);}}});}if(_0xfe126['query']['read']){if(_0xfe126['query'][_0xb6b1('0x79')]==0x1){_0x7d4763[_0xb6b1('0x7a')](_0xb6b1('0x7b'));}else{_0x7d4763[_0xb6b1('0x7a')](_0xb6b1('0x7c'));}}if(_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x7d')]){_0x2123f5=_['isArray'](_0xfe126[_0xb6b1('0x38')]['tag'])?_0xfe126['query'][_0xb6b1('0x7d')]:new Array(_0xfe126[_0xb6b1('0x38')]['tag']);_0x2123f5[_0xb6b1('0x68')](function(_0x394b82){_0x5be7bf['or'](_0xb6b1('0x7e'),'%,'+_0x394b82+',%');});}if(_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x7f')]){var _0x5516c7=_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x7f')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb6b1('0x80')](_0x5516c7)){_0x5adb1c['or'](_0xb6b1('0x81'),_0x5516c7+'%');}else if(qs[_0xb6b1('0x82')](_0x5516c7)){_0x5adb1c['or'](_0xb6b1('0x83'),_0x5516c7+'%');}else{_0x5adb1c['or'](_0xb6b1('0x84'),qs[_0xb6b1('0x85')](_0x5516c7))['or'](_0xb6b1('0x86'),qs[_0xb6b1('0x85')](_0x5516c7));}}}_0x7d4763[_0xb6b1('0x42')](_0x5adb1c);_0x7d4763['group'](_0xb6b1('0x87'));var _0x57fd39={'type':db[_0xb6b1('0x88')][_0xb6b1('0x89')][_0xb6b1('0x8a')],'raw':!![]};var _0x500945=_0x7d4763[_0xb6b1('0x8b')]();_0x500945[_0xb6b1('0x45')]('i.id');_0x500945[_0xb6b1('0x45')](_0xb6b1('0x8c'),'unreadMessages');if(_0x33dc30[_0xb6b1('0x40')]){_0x33dc30['order'][_0xb6b1('0x68')](function(_0x58da6c){var _0x300508=_0x58da6c[0x0]===_0xb6b1('0x8d')?_0x58da6c[0x0]:'i.'+_0x58da6c[0x0];_0x7d4763[_0xb6b1('0x40')](_0x300508,_0x58da6c[0x1]===_0xb6b1('0x8e')?![]:!![]);});}if(!_[_0xb6b1('0x70')](_0x2123f5)){_0x7d4763['having'](_0x5be7bf);_0x500945[_0xb6b1('0x42')](_0xb6b1('0x8f'),_0x2123f5);}BPromise[_0xb6b1('0x90')]()[_0xb6b1('0x18')](function(){if(!_0x323231){if(_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x91')])return;_0x500945[_0xb6b1('0x42')](_0xb6b1('0x92'));_0x7d4763[_0xb6b1('0x42')](_0xb6b1('0x92'));return;}if(_0xfe126[_0xb6b1('0x93')][_0xb6b1('0x94')]!=='agent')return;return _0xfe126[_0xb6b1('0x93')][_0xb6b1('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x22ebac){if(_[_0xb6b1('0x70')](_0x22ebac)){_0x500945['where'](_0xb6b1('0x96'));_0x7d4763['where'](_0xb6b1('0x96'));}else{_0x500945['where'](_0xb6b1('0x97'),_['map'](_0x22ebac,'id'));_0x7d4763['where'](_0xb6b1('0x97'),_[_0xb6b1('0x31')](_0x22ebac,'id'));}});})['then'](function(){if(_0xfe126[_0xb6b1('0x93')][_0xb6b1('0x94')]===_0xb6b1('0x98')&&!_0x323231&&!_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x91')])return[];return db[_0xb6b1('0x99')][_0xb6b1('0x38')](_0x500945[_0xb6b1('0x9a')](),_0x57fd39);})[_0xb6b1('0x18')](function(_0x267c1d){_0x44a61a[_0xb6b1('0x16')]=_0x267c1d[_0xb6b1('0x3d')];if(_0x44a61a['count']===0x0)return[];return db[_0xb6b1('0x99')][_0xb6b1('0x38')](_0x2c00fb[_0xb6b1('0x9a')](),_0x57fd39)[_0xb6b1('0x18')](function(_0x489898){_0x3826bd=_[_0xb6b1('0x9b')](_0x489898,'id');_0x57fd39=_[_0xb6b1('0x9c')](_0x57fd39,{'model':db[_0xb6b1('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x3c')]){_0x33dc30[_0xb6b1('0x3b')]['forEach'](function(_0x3954dd){_0x7d4763[_0xb6b1('0x45')]('i.'+_0x3954dd);});}else{_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0x8c'),_0xb6b1('0x5c'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0x9d'),_0xb6b1('0x9e'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0x9f'),_0xb6b1('0xa0'));_0x7d4763[_0xb6b1('0x45')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb6b1('0x8d'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0x87'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa1'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa2'));_0x7d4763[_0xb6b1('0x45')]('i.closed');_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa3'));_0x7d4763[_0xb6b1('0x45')]('i.attach');_0x7d4763[_0xb6b1('0x45')]('i.lastMsgAt');_0x7d4763['field'](_0xb6b1('0xa4'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa5'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa6'));_0x7d4763[_0xb6b1('0x45')]('i.secondDisposition');_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa7'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa8'));_0x7d4763['field']('i.to');_0x7d4763[_0xb6b1('0x45')]('i.ContactId');_0x7d4763[_0xb6b1('0x45')]('i.MailAccountId');_0x7d4763[_0xb6b1('0x45')]('i.UserId');_0x7d4763['field'](_0xb6b1('0xa9'),_0xb6b1('0xaa'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xab'),_0xb6b1('0xac'));_0x7d4763['field'](_0xb6b1('0xad'),_0xb6b1('0xae'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xaf'),'Contact.phone');_0x7d4763[_0xb6b1('0x45')]('c.mobile',_0xb6b1('0xb0'));_0x7d4763['field'](_0xb6b1('0xb1'),'Contact.fax');_0x7d4763['field']('o.fullname','Owner.fullname');_0x7d4763[_0xb6b1('0x45')]('o.internal',_0xb6b1('0xb2'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xb3'),_0xb6b1('0x1f'));}if(_0x33dc30['limit'])_0x7d4763[_0xb6b1('0x15')](_0x33dc30[_0xb6b1('0x15')]);if(_0x33dc30['offset'])_0x7d4763['offset'](_0x33dc30['offset']);return db[_0xb6b1('0x99')]['query'](_0x7d4763[_0xb6b1('0x9a')](),_0x57fd39);})['then'](function(_0x3173d2){if(_0x3173d2['length']>0x0)_0x1f4881[_0xb6b1('0x42')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x3173d2,'id'));return db[_0xb6b1('0x99')][_0xb6b1('0x38')](_0x1f4881[_0xb6b1('0x9a')](),_0x57fd39)[_0xb6b1('0x18')](function(_0xb25776){var _0x2ca465=_['groupBy'](_0xb25776,_0xb6b1('0xb4'));var _0x1dcf93=[];return db['Setting'][_0xb6b1('0xb5')]({'attributes':[_0xb6b1('0xb6')],'raw':!![]})[_0xb6b1('0x18')](function(_0x5236a3){var _0x36f39e=_0x5236a3[_0xb6b1('0xb6')];_0x3173d2[_0xb6b1('0x68')](function(_0x2579c2){_0x1dcf93[_0xb6b1('0x22')](updateMailInteraction(_0x2579c2,_0x3826bd,_0x2ca465,_0x36f39e));});return BPromise[_0xb6b1('0xb7')](_0x1dcf93);});});});})[_0xb6b1('0x18')](function(_0x24c4db){_0x44a61a[_0xb6b1('0xb8')]=_0x24c4db;return _0x44a61a;})[_0xb6b1('0x18')](respondWithFilteredResult(_0x3df192,_0x33dc30))[_0xb6b1('0x28')](handleError(_0x3df192,null));};exports['show']=function(_0x59b19f,_0x54fb1e){var _0x160166={'raw':![],'where':{'id':_0x59b19f[_0xb6b1('0xb9')]['id']}},_0x535d47={};_0x535d47[_0xb6b1('0x37')]=_[_0xb6b1('0x39')](db[_0xb6b1('0x32')]['rawAttributes']);_0x535d47[_0xb6b1('0x38')]=_['keys'](_0x59b19f['query']);_0x535d47['filters']=_[_0xb6b1('0x3a')](_0x535d47[_0xb6b1('0x37')],_0x535d47[_0xb6b1('0x38')]);_0x160166[_0xb6b1('0x3b')]=_[_0xb6b1('0x3a')](_0x535d47[_0xb6b1('0x37')],qs[_0xb6b1('0x3c')](_0x59b19f['query']['fields']));_0x160166[_0xb6b1('0x3b')]=_0x160166['attributes'][_0xb6b1('0x3d')]?_0x160166['attributes']:_0x535d47['model'];if(_0x59b19f['query']['includeAll']){_0x160166[_0xb6b1('0xba')]=[{'all':!![]}];}_0x160166=_[_0xb6b1('0x9c')]({},_0x160166,_0x59b19f[_0xb6b1('0xbb')]);return db[_0xb6b1('0x32')][_0xb6b1('0x5b')](_0x160166)['then'](handleEntityNotFound(_0x54fb1e,null))[_0xb6b1('0x18')](respondWithResult(_0x54fb1e,null))['catch'](handleError(_0x54fb1e,null));};exports[_0xb6b1('0xbc')]=function(_0x28b252,_0x235ae7){return db[_0xb6b1('0x32')][_0xb6b1('0xbc')](_0x28b252[_0xb6b1('0xbd')],{})[_0xb6b1('0x18')](respondWithResult(_0x235ae7,0xc9))[_0xb6b1('0x28')](handleError(_0x235ae7,null));};exports[_0xb6b1('0x17')]=function(_0x49bbbb,_0x193c0a){if(_0x49bbbb[_0xb6b1('0xbd')]['id']){delete _0x49bbbb[_0xb6b1('0xbd')]['id'];}return db[_0xb6b1('0x32')][_0xb6b1('0x5b')]({'where':{'id':_0x49bbbb[_0xb6b1('0xb9')]['id']}})[_0xb6b1('0x18')](handleEntityNotFound(_0x193c0a,null))[_0xb6b1('0x18')](saveUpdates(_0x49bbbb['body'],null))['then'](respondWithResult(_0x193c0a,null))['catch'](handleError(_0x193c0a,null));};exports[_0xb6b1('0x19')]=function(_0x271599,_0x2a9fe9){return db['MailInteraction']['find']({'where':{'id':_0x271599['params']['id']}})[_0xb6b1('0x18')](handleEntityNotFound(_0x2a9fe9,null))['then'](removeEntity(_0x2a9fe9,null))[_0xb6b1('0x28')](handleError(_0x2a9fe9,null));};exports[_0xb6b1('0xbe')]=function(_0x434c1c,_0x4ac5ed){return db[_0xb6b1('0x32')]['describe']()[_0xb6b1('0x18')](respondWithResult(_0x4ac5ed,null))[_0xb6b1('0x28')](handleError(_0x4ac5ed,null));};exports[_0xb6b1('0xbf')]=function(_0x840ed1,_0x5576bf){return db[_0xb6b1('0x23')][_0xb6b1('0x5b')]({'where':{'id':_0x840ed1[_0xb6b1('0xb9')]['id']}})[_0xb6b1('0x18')](handleEntityNotFound(_0x5576bf,null))['then'](function(_0x1f27b6){if(_0x1f27b6){return _0x1f27b6[_0xb6b1('0xbf')](_0x840ed1['body'][_0xb6b1('0xc0')],_[_0xb6b1('0xc1')](_0x840ed1[_0xb6b1('0xbd')],['ids','id'])||{});}})[_0xb6b1('0x18')](respondWithResult(_0x5576bf,null))[_0xb6b1('0x28')](handleError(_0x5576bf,null));};exports[_0xb6b1('0xc2')]=function(_0x2e95ca,_0x257e05){var _0xa31640={'raw':![],'where':{}};var _0x1bf97a={};var _0x58244e={'count':0x0,'rows':[]};return db[_0xb6b1('0x32')][_0xb6b1('0xb5')]({'where':{'id':_0x2e95ca['params']['id']}})['then'](handleEntityNotFound(_0x257e05,null))[_0xb6b1('0x18')](function(_0x2d3ce6){if(_0x2d3ce6){_0x1bf97a[_0xb6b1('0x37')]=_['keys'](db[_0xb6b1('0x23')]['rawAttributes']);_0x1bf97a[_0xb6b1('0x38')]=_['keys'](_0x2e95ca[_0xb6b1('0x38')]);_0x1bf97a[_0xb6b1('0x43')]=_[_0xb6b1('0x3a')](_0x1bf97a[_0xb6b1('0x37')],_0x1bf97a[_0xb6b1('0x38')]);_0xa31640[_0xb6b1('0x3b')]=_['intersection'](_0x1bf97a['model'],qs[_0xb6b1('0x3c')](_0x2e95ca[_0xb6b1('0x38')]['fields']));_0xa31640[_0xb6b1('0x3b')]=_0xa31640[_0xb6b1('0x3b')][_0xb6b1('0x3d')]?_0xa31640[_0xb6b1('0x3b')]:_0x1bf97a[_0xb6b1('0x37')];if(!_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0x3e')](_0xb6b1('0x3f'))){_0xa31640[_0xb6b1('0x15')]=qs[_0xb6b1('0x15')](_0x2e95ca['query'][_0xb6b1('0x15')]);_0xa31640[_0xb6b1('0x13')]=qs['offset'](_0x2e95ca[_0xb6b1('0x38')]['offset']);}_0xa31640[_0xb6b1('0x40')]=qs[_0xb6b1('0x41')](_0x2e95ca['query'][_0xb6b1('0x41')]);_0xa31640['where']=qs['filters'](_['pick'](_0x2e95ca[_0xb6b1('0x38')],_0x1bf97a['filters']));_0xa31640[_0xb6b1('0x42')][_0xb6b1('0xb4')]=_0x2d3ce6['id'];if(_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0x7f')]){_0xa31640['where']=_[_0xb6b1('0x9c')](_0xa31640[_0xb6b1('0x42')],{'$or':_[_0xb6b1('0x31')](_0xa31640['attributes'],function(_0x1e2137){var _0x2b6ddf={};_0x2b6ddf[_0x1e2137]={'$like':'%'+_0x2e95ca[_0xb6b1('0x38')]['filter']+'%'};return _0x2b6ddf;})});}if(_0x2e95ca['query'][_0xb6b1('0x73')]){var _0x50406d=_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0x73')]['split'](',');var _0x555aa2={};_0x555aa2[_0x50406d[0x0]]={'$gte':moment(_0x50406d[0x1])[_0xb6b1('0xc3')](_0xb6b1('0xc4'))};_0xa31640[_0xb6b1('0x42')]=_[_0xb6b1('0x9c')](_0xa31640[_0xb6b1('0x42')],_0x555aa2);}_0xa31640=_[_0xb6b1('0x9c')]({},_0xa31640,_0x2e95ca[_0xb6b1('0xbb')]);return db[_0xb6b1('0x23')][_0xb6b1('0x16')]({'where':_0xa31640[_0xb6b1('0x42')]})[_0xb6b1('0x18')](function(_0x173eee){_0x58244e['count']=_0x173eee;if(_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0xc5')]){_0xa31640[_0xb6b1('0xba')]=[{'all':!![]}];}return db['MailMessage'][_0xb6b1('0xc6')](_0xa31640);})[_0xb6b1('0x18')](function(_0x564a97){if(_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0xc7')]===_0xb6b1('0xc8')){for(var _0x588be2=0x0;_0x588be2<_0x564a97['length'];_0x588be2++){_0x564a97[_0x588be2][_0xb6b1('0xbd')]=juice(_0x564a97[_0x588be2][_0xb6b1('0xbd')]);}}_0x58244e[_0xb6b1('0xb8')]=_0x564a97;return _0x58244e;});}})['then'](respondWithFilteredResult(_0x257e05,_0xa31640))['catch'](handleError(_0x257e05,null));};exports[_0xb6b1('0xc9')]=function(_0x129648,_0x9131e9){return db[_0xb6b1('0x32')][_0xb6b1('0x5b')]({'where':{'id':_0x129648['params']['id']}})['then'](handleEntityNotFound(_0x9131e9,null))[_0xb6b1('0x18')](function(_0x1f5381){if(_0x1f5381){return _0x1f5381[_0xb6b1('0xca')](_0x129648[_0xb6b1('0xbd')][_0xb6b1('0xc0')],_[_0xb6b1('0xc1')](_0x129648[_0xb6b1('0xbd')],['ids','id'])||{})[_0xb6b1('0xcb')](function(){return db[_0xb6b1('0x67')][_0xb6b1('0xc6')]({'attributes':['id',_0xb6b1('0x1c'),_0xb6b1('0x46')],'where':{'id':_0x129648[_0xb6b1('0xbd')][_0xb6b1('0xc0')]}});})['then'](function(_0x5813e4){socket['emit']('mailInteractionTags:save',{'id':Number(_0x129648[_0xb6b1('0xb9')]['id']),'tags':_0x5813e4||[]});return{'id':Number(_0x129648['params']['id']),'tags':_0x5813e4||[]};});}})['then'](respondWithResult(_0x9131e9,null))[_0xb6b1('0x28')](handleError(_0x9131e9,null));};exports['removeTags']=function(_0xd0eaa4,_0x51a36a){return db[_0xb6b1('0x32')]['find']({'where':{'id':_0xd0eaa4[_0xb6b1('0xb9')]['id']}})[_0xb6b1('0x18')](handleEntityNotFound(_0x51a36a,null))[_0xb6b1('0x18')](function(_0x3d081e){if(_0x3d081e){return _0x3d081e[_0xb6b1('0xcc')](_0xd0eaa4['query']['ids']);}})['then'](respondWithStatusCode(_0x51a36a,null))[_0xb6b1('0x28')](handleError(_0x51a36a,null));};exports[_0xb6b1('0xcd')]=function(_0x1bc26b,_0x286c65){var _0x24a136=moment()[_0xb6b1('0xce')]()[_0xb6b1('0x9a')]();var _0x4a7c67=path[_0xb6b1('0xcf')](config[_0xb6b1('0xd0')],'server',_0xb6b1('0xd1'),_0xb6b1('0xd2'));var _0x56b5c7=path[_0xb6b1('0xcf')](config[_0xb6b1('0xd0')],'server',_0xb6b1('0xd1'),'attachments');var _0x18be57=path[_0xb6b1('0xcf')](_0x4a7c67,_0x24a136);var _0x5b9247=util[_0xb6b1('0xc3')](_0xb6b1('0xd3'),_0x1bc26b[_0xb6b1('0xb9')]['id'],_0x24a136);var _0x1ffd3b=path[_0xb6b1('0xcf')](_0x4a7c67,_0x5b9247);var _0x6dec10=[];if(_0x1bc26b[_0xb6b1('0x38')][_0xb6b1('0xd4')]){_0x6dec10[_0xb6b1('0x22')]({'model':db[_0xb6b1('0xd5')],'as':'Attachments','raw':!![]});}var _0xb2e401=[{'model':db[_0xb6b1('0x23')],'as':'Messages','attributes':['id','body',_0xb6b1('0x4b'),'to','cc',_0xb6b1('0xd6'),_0xb6b1('0xd7'),'createdAt'],'where':{'secret':![]},'order':qs[_0xb6b1('0x41')]('id'),'include':_0x6dec10}];return db[_0xb6b1('0x32')][_0xb6b1('0x5b')]({'where':{'id':_0x1bc26b[_0xb6b1('0xb9')]['id']},'include':_0xb2e401})['then'](handleEntityNotFound(_0x286c65,null))['then'](function(_0x737fa0){if(_0x737fa0&&_0x737fa0[_0xb6b1('0xd8')]){var _0x288f12=_0x737fa0[_0xb6b1('0xd9')]({'plain':!![]});fs[_0xb6b1('0xda')](_0x18be57);return BPromise[_0xb6b1('0xdb')](_0x288f12[_0xb6b1('0xd8')],function(_0x570d67,_0x409aad){var _0x2ab39a={'from':_0x570d67[_0xb6b1('0x4b')],'to':_0x570d67['to'],'subject':_0x570d67[_0xb6b1('0xd7')],'html':htmlEntities['decode'](_0x570d67[_0xb6b1('0xbd')]),'headers':{'Date':moment(_0x570d67[_0xb6b1('0x72')])[_0xb6b1('0xc3')](_0xb6b1('0xdc'))},'attachments':[]};if(_0x570d67['cc']){_0x2ab39a['headers']['Cc']=_0x570d67['cc'];}if(_0x570d67[_0xb6b1('0xd6')]){_0x2ab39a[_0xb6b1('0xdd')][_0xb6b1('0xde')]=_0x570d67[_0xb6b1('0xd6')];}return new BPromise(function(_0x3cdd09,_0x37a71b){if(_0x570d67['Attachments']){for(var _0x8486dc=0x0;_0x8486dc<_0x570d67[_0xb6b1('0xdf')][_0xb6b1('0x3d')];_0x8486dc++){var _0x18c0fa=_0x570d67[_0xb6b1('0xdf')][_0x8486dc];var _0x20eeed=path[_0xb6b1('0xcf')](_0x56b5c7,_0x18c0fa[_0xb6b1('0xe0')]);if(fs[_0xb6b1('0xe1')](_0x20eeed)){_0x2ab39a[_0xb6b1('0xd4')][_0xb6b1('0x22')]({'name':_0x18c0fa['name'],'contentType':_0x18c0fa['type'],'data':fs[_0xb6b1('0xe2')](_0x20eeed)});}}}emlformat[_0xb6b1('0xe3')](_0x2ab39a,function(_0x2d8d1f,_0x25a2c4){if(_0x2d8d1f)return _0x37a71b(_0x2d8d1f);fs['writeFileSync'](path['join'](_0x18be57,util['format'](_0xb6b1('0xe4'),_0x409aad)),_0x25a2c4);return _0x3cdd09(_0x25a2c4);});});})['then'](function(){return new BPromise(function(_0x2f2ba2,_0x2414dc){zipdir(_0x18be57,{'saveTo':_0x1ffd3b},function(_0xf8e6b0,_0x2151a9){if(_0xf8e6b0)return _0x2414dc(_0xf8e6b0);return _0x2f2ba2(_0x2151a9);});})['then'](function(){return new BPromise(function(_0x530a16,_0x142d71){rimraf(_0x18be57,function(_0x1085c5){if(_0x1085c5)_0x142d71(_0x1085c5);return _0x530a16();});});})['then'](function(){return _0x286c65[_0xb6b1('0xcd')](_0x1ffd3b,_0x5b9247,function(_0x4c166f){if(!_0x4c166f)fs[_0xb6b1('0xe5')](_0x1ffd3b);});});});}else{return _0x286c65[_0xb6b1('0xe6')](0xc8);}})['catch'](handleError(_0x286c65,null));}; \ No newline at end of file +var _0xfc17=['set','update','then','destroy','error','stack','name','send','fullname','TagIds','Tags','split','push','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','UserId','closed','total','index','map','MailInteraction','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','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?','buildExpression','text','start','Tag','forEach','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','getFullTextValue','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','agent','sequelize','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.substatus','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','rows','show','includeAll','include','body','params','describe','addMessage','ids','rawAttributes','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','inlineCss','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','MailMessage','bcc','subject','Messages','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','util','path','lodash','squel','juice','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x2ea41,_0x4f807b){var _0x8ee23b=function(_0x2e5fd8){while(--_0x2e5fd8){_0x2ea41['push'](_0x2ea41['shift']());}};_0x8ee23b(++_0x4f807b);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x14c959,_0x298598){_0x14c959=_0x14c959-0x0;var _0x371779=_0xfc17[_0x14c959];return _0x371779;};'use strict';var emlformat=require(_0x7fc1('0x0'));var rimraf=require(_0x7fc1('0x1'));var zipdir=require(_0x7fc1('0x2'));var moment=require(_0x7fc1('0x3'));var BPromise=require('bluebird');var util=require(_0x7fc1('0x4'));var path=require(_0x7fc1('0x5'));var fs=require('fs');var _=require(_0x7fc1('0x6'));var squel=require(_0x7fc1('0x7'));var juice=require(_0x7fc1('0x8'));var Redis=require(_0x7fc1('0x9'));var qs=require('../../components/parsers/qs');var as=require(_0x7fc1('0xa'));var logger=require(_0x7fc1('0xb'))(_0x7fc1('0xc'));var config=require(_0x7fc1('0xd'));var db=require(_0x7fc1('0xe'))['db'];var htmlEntities=require(_0x7fc1('0xf'));config[_0x7fc1('0x10')]=_['defaults'](config[_0x7fc1('0x10')],{'host':_0x7fc1('0x11'),'port':0x18eb});var socket=require(_0x7fc1('0x12'))(new Redis(config['redis']));require(_0x7fc1('0x13'))['register'](socket);function respondWithStatusCode(_0x5c59ad,_0x775538){_0x775538=_0x775538||0xcc;return function(_0xe06cb4){if(_0xe06cb4){return _0x5c59ad[_0x7fc1('0x14')](_0x775538);}return _0x5c59ad[_0x7fc1('0x15')](_0x775538)[_0x7fc1('0x16')]();};}function respondWithResult(_0x20ed58,_0x53277f){_0x53277f=_0x53277f||0xc8;return function(_0x3a7c8e){if(_0x3a7c8e){return _0x20ed58[_0x7fc1('0x15')](_0x53277f)[_0x7fc1('0x17')](_0x3a7c8e);}};}function respondWithFilteredResult(_0x12ddce,_0x3c328c){return function(_0x5651f2){if(_0x5651f2){var _0x54a204=typeof _0x3c328c[_0x7fc1('0x18')]===_0x7fc1('0x19')&&typeof _0x3c328c[_0x7fc1('0x1a')]===_0x7fc1('0x19');var _0x432825=_0x5651f2[_0x7fc1('0x1b')];var _0x3d8e82=_0x54a204?0x0:_0x3c328c[_0x7fc1('0x18')];var _0x18be8e=_0x54a204?_0x5651f2[_0x7fc1('0x1b')]:_0x3c328c['offset']+_0x3c328c[_0x7fc1('0x1a')];var _0x5e89b1;if(_0x18be8e>=_0x432825){_0x18be8e=_0x432825;_0x5e89b1=0xc8;}else{_0x5e89b1=0xce;}_0x12ddce[_0x7fc1('0x15')](_0x5e89b1);return _0x12ddce[_0x7fc1('0x1c')]('Content-Range',_0x3d8e82+'-'+_0x18be8e+'/'+_0x432825)[_0x7fc1('0x17')](_0x5651f2);}return null;};}function saveUpdates(_0x1c12cf){return function(_0x58c20a){if(_0x58c20a){return _0x58c20a[_0x7fc1('0x1d')](_0x1c12cf)[_0x7fc1('0x1e')](function(_0x1158f0){return _0x1158f0;});}return null;};}function removeEntity(_0x416748){return function(_0x10b4b7){if(_0x10b4b7){return _0x10b4b7[_0x7fc1('0x1f')]()[_0x7fc1('0x1e')](function(){_0x416748[_0x7fc1('0x15')](0xcc)[_0x7fc1('0x16')]();});}};}function handleEntityNotFound(_0xac99f6){return function(_0x4dea9c){if(!_0x4dea9c){_0xac99f6['sendStatus'](0x194);}return _0x4dea9c;};}function handleError(_0x2390b8,_0x5e10cd){_0x5e10cd=_0x5e10cd||0x1f4;return function(_0x3c39e2){logger[_0x7fc1('0x20')](_0x3c39e2[_0x7fc1('0x21')]);if(_0x3c39e2[_0x7fc1('0x22')]){delete _0x3c39e2['name'];}_0x2390b8[_0x7fc1('0x15')](_0x5e10cd)[_0x7fc1('0x23')](_0x3c39e2);};}function getInteractionUsers(_0x2cbf9b,_0x4d6c46){return new BPromise(function(_0x190204,_0x252b18){try{if(_0x4d6c46[_0x2cbf9b['id']]){_0x2cbf9b['Users']=_['map'](_0x4d6c46[_0x2cbf9b['id']],function(_0x2e4256){return{'id':_0x2e4256['id'],'fullname':_0x2e4256[_0x7fc1('0x24')]};});}}catch(_0x1f58ca){_0x252b18(_0x1f58ca);}_0x190204(_0x2cbf9b);});}function getInteractionTags(_0x2ae7db,_0x58c7a2){return new BPromise(function(_0x1d7b77,_0x1628fd){try{if(_0x2ae7db[_0x7fc1('0x25')]){_0x2ae7db[_0x7fc1('0x26')]=[];_0x2ae7db['TagIds'][_0x7fc1('0x27')](',')['forEach'](function(_0x1f7fce){_0x2ae7db[_0x7fc1('0x26')][_0x7fc1('0x28')](_0x58c7a2[_0x1f7fce]);});}delete _0x2ae7db[_0x7fc1('0x25')];}catch(_0x2317f5){_0x1628fd(_0x2317f5);}_0x1d7b77(_0x2ae7db);});}function getLastMessageText(_0x4cf06e){return new BPromise(function(_0x17be3a,_0x59a89a){return db['MailMessage'][_0x7fc1('0x29')]({'where':{'$and':[{'MailInteractionId':_0x4cf06e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7fc1('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x7fc1('0x2b')],'order':_0x7fc1('0x2c'),'raw':!![]})[_0x7fc1('0x1e')](function(_0x444b51){if(_0x444b51&&_0x444b51[_0x7fc1('0x2b')]){_0x4cf06e[_0x7fc1('0x2d')]=_[_0x7fc1('0x2e')](_0x444b51[_0x7fc1('0x2b')]);}_0x17be3a(_0x4cf06e);})[_0x7fc1('0x2f')](function(_0x2c95c8){_0x59a89a(_0x2c95c8);});});}function updateMailInteraction(_0x242fd1,_0x2c3ead,_0x211df6,_0x19064f){return new BPromise(function(_0x5e3f04,_0x24904b){return getInteractionUsers(_0x242fd1,_0x211df6)[_0x7fc1('0x1e')](function(_0x4282b5){return getInteractionTags(_0x4282b5,_0x2c3ead);})[_0x7fc1('0x1e')](function(_0x2c91cb){return getStateInteraction(_0x2c91cb);})[_0x7fc1('0x1e')](function(_0x5b96ea){if(_0x19064f){_0x5e3f04(getLastMessageText(_0x5b96ea));}else{_0x5e3f04(_0x5b96ea);}})[_0x7fc1('0x2f')](function(_0x3f8961){_0x24904b(_0x3f8961);});});}function getStateInteraction(_0x4f36c8){return new BPromise(function(_0x295268){_0x4f36c8[_0x7fc1('0x30')]=0x0;_0x4f36c8[_0x7fc1('0x31')]=0x0;_0x4f36c8[_0x7fc1('0x32')]=0x0;_0x4f36c8[_0x7fc1('0x33')]=0x0;_0x4f36c8['total']=0x0;if(!_0x4f36c8['closed']&&!_0x4f36c8[_0x7fc1('0x34')]){_0x4f36c8[_0x7fc1('0x30')]+=0x1;}if(!_0x4f36c8[_0x7fc1('0x35')]&&_0x4f36c8[_0x7fc1('0x34')]){_0x4f36c8[_0x7fc1('0x31')]+=0x1;if(_0x4f36c8[_0x7fc1('0x30')]){_0x4f36c8[_0x7fc1('0x30')]-=0x1;}}if(_0x4f36c8[_0x7fc1('0x35')]&&_0x4f36c8['UserId']){_0x4f36c8[_0x7fc1('0x32')]+=0x1;if(_0x4f36c8[_0x7fc1('0x31')]){_0x4f36c8['talking']-=0x1;}}if(_0x4f36c8[_0x7fc1('0x35')]&&!_0x4f36c8[_0x7fc1('0x34')]){_0x4f36c8[_0x7fc1('0x33')]+=0x1;if(_0x4f36c8['waiting']){_0x4f36c8['waiting']-=0x1;}}_0x4f36c8[_0x7fc1('0x36')]+=0x1;_0x295268(_0x4f36c8);});}exports[_0x7fc1('0x37')]=function(_0xafc8b0,_0x564437){var _0x4e640b={},_0x50c728={},_0x2fc293={'count':0x0,'rows':[]};var _0x1e4f53=_[_0x7fc1('0x38')](db[_0x7fc1('0x39')]['rawAttributes'],function(_0x548885){return{'name':_0x548885[_0x7fc1('0x3a')],'type':_0x548885[_0x7fc1('0x3b')][_0x7fc1('0x3c')]};});_0x50c728['model']=_['map'](_0x1e4f53,'name');_0x50c728['query']=_['keys'](_0xafc8b0[_0x7fc1('0x3d')]);_0x50c728['filters']=_[_0x7fc1('0x3e')](_0x50c728[_0x7fc1('0x3f')],_0x50c728['query']);_0x4e640b[_0x7fc1('0x40')]=_[_0x7fc1('0x3e')](_0x50c728[_0x7fc1('0x3f')],qs[_0x7fc1('0x41')](_0xafc8b0['query'][_0x7fc1('0x41')]));_0x4e640b['attributes']=_0x4e640b[_0x7fc1('0x40')][_0x7fc1('0x42')]?_0x4e640b[_0x7fc1('0x40')]:_0x50c728[_0x7fc1('0x3f')];if(!_0xafc8b0['query'][_0x7fc1('0x43')](_0x7fc1('0x44'))){_0x4e640b['limit']=qs[_0x7fc1('0x1a')](_0xafc8b0[_0x7fc1('0x3d')]['limit']);_0x4e640b[_0x7fc1('0x18')]=qs[_0x7fc1('0x18')](_0xafc8b0['query'][_0x7fc1('0x18')]);}_0x4e640b[_0x7fc1('0x45')]=qs[_0x7fc1('0x46')](_0xafc8b0['query'][_0x7fc1('0x46')]);_0x4e640b[_0x7fc1('0x47')]=qs[_0x7fc1('0x48')](_[_0x7fc1('0x49')](_0xafc8b0['query'],_0x50c728['filters']),_0x1e4f53);var _0x15edd4=[];var _0x425e5a=squel[_0x7fc1('0x4a')]()[_0x7fc1('0x4b')]('id')[_0x7fc1('0x4b')](_0x7fc1('0x22'))[_0x7fc1('0x4b')](_0x7fc1('0x4c'))[_0x7fc1('0x4d')]('tools_tags');var _0x518a54=squel['select']()[_0x7fc1('0x4b')](_0x7fc1('0x4e'))[_0x7fc1('0x4b')](_0x7fc1('0x4f'))['field'](_0x7fc1('0x50'))[_0x7fc1('0x4d')](_0x7fc1('0x51'),'ui')[_0x7fc1('0x52')]('users','u',_0x7fc1('0x53'));var _0x5ef33=squel[_0x7fc1('0x4a')]()[_0x7fc1('0x4d')](_0x7fc1('0x54'),'i')[_0x7fc1('0x52')](_0x7fc1('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x7fc1('0x52')]('users','o',_0x7fc1('0x56'))['left_join'](_0x7fc1('0x57'),'a',_0x7fc1('0x58'))['left_join'](_0x7fc1('0x59'),'me',_0x7fc1('0x5a'))['left_join'](_0x7fc1('0x5b'),'it',_0x7fc1('0x5c'))[_0x7fc1('0x52')](_0x7fc1('0x5d'),'t','t.id\x20=\x20it.TagId');var _0x48cc9b=squel[_0x7fc1('0x5e')]();var _0x4a75d6=[];var _0x802d83=squel[_0x7fc1('0x5e')]();var _0x1dbfbd;if(_0xafc8b0[_0x7fc1('0x3d')][_0x7fc1('0x5f')]){_0x1dbfbd=as[_0x7fc1('0x60')](_0xafc8b0[_0x7fc1('0x3d')][_0x7fc1('0x5f')]);var _0x1ea117=_0x1dbfbd['sqlOperator'];for(var _0x562e2b=0x0;_0x562e2b<_0x1dbfbd[_0x7fc1('0x61')]['length'];_0x562e2b++){var _0x320d7a=_0x1dbfbd['conditions'][_0x562e2b];var _0x268f71='i';var _0x143a9f=_[_0x7fc1('0x62')](_0x1e4f53,[_0x7fc1('0x22'),_0x320d7a[_0x7fc1('0x4b')]]);if(!_0x143a9f){switch(_0x320d7a[_0x7fc1('0x4b')]){case _0x7fc1('0x63'):if(_0x320d7a[_0x7fc1('0x64')]==0x1){_0x5ef33['having']('`'+_0x320d7a[_0x7fc1('0x4b')]+'`\x20=\x200');}else{_0x5ef33[_0x7fc1('0x65')]('`'+_0x320d7a['field']+_0x7fc1('0x66'));}break;case'Contact':if(_0x320d7a[_0x7fc1('0x67')]===_0x7fc1('0x68')){if(_0x320d7a[_0x7fc1('0x64')][_0x7fc1('0x27')]('\x20')['length']>0x1){_0x48cc9b[_0x1ea117](_0x7fc1('0x69'),qs['getFullTextValue'](_0x320d7a[_0x7fc1('0x64')]),null);}else{var _0x297f19='%'+_0x320d7a[_0x7fc1('0x64')]+'%';_0x48cc9b[_0x1ea117](_0x7fc1('0x6a'),_0x297f19,_0x297f19,_0x297f19);}}else{_0x143a9f=_[_0x7fc1('0x62')](_0x1e4f53,[_0x7fc1('0x22'),'ContactId']);_0x320d7a['field']='ContactId';_0x19acde=as[_0x7fc1('0x6b')](_0x268f71,_0x143a9f[_0x7fc1('0x3b')],_0x320d7a);_0x48cc9b[_0x1ea117](_0x19acde[_0x7fc1('0x6c')],_0x19acde[_0x7fc1('0x64')][_0x7fc1('0x6d')],_0x19acde[_0x7fc1('0x64')][_0x7fc1('0x16')]);}break;case _0x7fc1('0x6e'):var _0x1de6b8=_0x320d7a['value'][_0x7fc1('0x27')](',')[_0x7fc1('0x38')](function(_0xd0f09d){return Number(_0xd0f09d);});_0x1de6b8[_0x7fc1('0x6f')](function(_0x3294c3){_0x802d83['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3294c3+',%');});_0x4a75d6=_['union'](_0x4a75d6,_0x1de6b8);break;case _0x7fc1('0x70'):if(_0x320d7a[_0x7fc1('0x67')]===_0x7fc1('0x68')){_0x48cc9b[_0x1ea117](_0x7fc1('0x71'),'%'+_0x320d7a[_0x7fc1('0x64')]+'%',null);}else{_0x143a9f=_[_0x7fc1('0x62')](_0x1e4f53,['name',_0x7fc1('0x34')]);_0x320d7a[_0x7fc1('0x4b')]=_0x7fc1('0x34');_0x19acde=as[_0x7fc1('0x6b')](_0x268f71,_0x143a9f[_0x7fc1('0x3b')],_0x320d7a);_0x48cc9b[_0x1ea117](_0x19acde[_0x7fc1('0x6c')],_0x19acde[_0x7fc1('0x64')][_0x7fc1('0x6d')],_0x19acde['value'][_0x7fc1('0x16')]);}break;case'plainBody':_0x19acde=as[_0x7fc1('0x6b')]('me',null,_0x320d7a);_0x48cc9b[_0x1ea117](_0x19acde[_0x7fc1('0x6c')],_0x19acde[_0x7fc1('0x64')][_0x7fc1('0x6d')],_0x19acde[_0x7fc1('0x64')]['end']);break;}}else{var _0x19acde=as[_0x7fc1('0x6b')](_0x268f71,_0x143a9f[_0x7fc1('0x3b')],_0x320d7a);_0x48cc9b[_0x1ea117](_0x19acde['text'],_0x19acde[_0x7fc1('0x64')]['start'],_0x19acde[_0x7fc1('0x64')][_0x7fc1('0x16')]);}}}else{var _0x513894=_(_0xafc8b0[_0x7fc1('0x3d')])[_0x7fc1('0x72')]()[_0x7fc1('0x38')](function(_0x1119fc){return _['some'](_0x1e4f53,[_0x7fc1('0x22'),_0x1119fc])?_0x1119fc:undefined;})[_0x7fc1('0x73')]()[_0x7fc1('0x64')]();if(!_[_0x7fc1('0x74')](_0x513894)){_0x513894[_0x7fc1('0x6f')](function(_0x2c85e9){if(_0x2c85e9===_0x7fc1('0x75')){_0x5ef33[_0x7fc1('0x47')](_0x7fc1('0x76'),[][_0x7fc1('0x77')](_0xafc8b0[_0x7fc1('0x3d')][_0x2c85e9]));}else if(_0x2c85e9===_0x7fc1('0x78')){var _0x372905=JSON[_0x7fc1('0x79')](_0xafc8b0[_0x7fc1('0x3d')][_0x2c85e9])['$gte'];var _0x19e649=JSON[_0x7fc1('0x79')](_0xafc8b0[_0x7fc1('0x3d')][_0x2c85e9])[_0x7fc1('0x7a')];_0x5ef33[_0x7fc1('0x47')](_0x7fc1('0x7b'),_0x372905,_0x19e649);}else{if(_0xafc8b0['query'][_0x2c85e9]==='null'){_0x5ef33[_0x7fc1('0x47')]('i.'+_0x2c85e9+_0x7fc1('0x7c'));}else{_0x5ef33[_0x7fc1('0x47')]('i.'+_0x2c85e9+_0x7fc1('0x7d'),_0xafc8b0[_0x7fc1('0x3d')][_0x2c85e9]);}}});}if(_0xafc8b0[_0x7fc1('0x3d')]['read']){if(_0xafc8b0[_0x7fc1('0x3d')][_0x7fc1('0x7e')]==0x1){_0x5ef33['having'](_0x7fc1('0x7f'));}else{_0x5ef33['having'](_0x7fc1('0x80'));}}if(_0xafc8b0[_0x7fc1('0x3d')]['tag']){_0x4a75d6=_['isArray'](_0xafc8b0[_0x7fc1('0x3d')][_0x7fc1('0x81')])?_0xafc8b0[_0x7fc1('0x3d')][_0x7fc1('0x81')]:new Array(_0xafc8b0[_0x7fc1('0x3d')][_0x7fc1('0x81')]);_0x4a75d6[_0x7fc1('0x6f')](function(_0x488718){_0x802d83['or'](_0x7fc1('0x82'),'%,'+_0x488718+',%');});}if(_0xafc8b0[_0x7fc1('0x3d')][_0x7fc1('0x83')]){var _0x2c4dc5=_0xafc8b0[_0x7fc1('0x3d')][_0x7fc1('0x83')]['replace']('\x5c','\x5c\x5c')[_0x7fc1('0x84')](/'/g,'\x27\x27');if(qs[_0x7fc1('0x85')](_0x2c4dc5)){_0x48cc9b['or'](_0x7fc1('0x86'),_0x2c4dc5+'%');}else if(qs['isEmail'](_0x2c4dc5)){_0x48cc9b['or'](_0x7fc1('0x87'),_0x2c4dc5+'%');}else{_0x48cc9b['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2c4dc5))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7fc1('0x88')](_0x2c4dc5));}}}_0x5ef33[_0x7fc1('0x47')](_0x48cc9b);_0x5ef33[_0x7fc1('0x89')](_0x7fc1('0x8a'));var _0x1a33b9={'type':db[_0x7fc1('0x8b')]['QueryTypes'][_0x7fc1('0x8c')],'raw':!![]};var _0x54757d=_0x5ef33['clone']();_0x54757d['field'](_0x7fc1('0x8a'));_0x54757d[_0x7fc1('0x4b')](_0x7fc1('0x8d'),'unreadMessages');if(_0x4e640b[_0x7fc1('0x45')]){_0x4e640b[_0x7fc1('0x45')][_0x7fc1('0x6f')](function(_0x306932){var _0x1e04e7=_0x306932[0x0]===_0x7fc1('0x8e')?_0x306932[0x0]:'i.'+_0x306932[0x0];_0x5ef33['order'](_0x1e04e7,_0x306932[0x1]===_0x7fc1('0x8f')?![]:!![]);});}if(!_[_0x7fc1('0x74')](_0x4a75d6)){_0x5ef33[_0x7fc1('0x65')](_0x802d83);_0x54757d[_0x7fc1('0x47')]('t.id\x20IN\x20?',_0x4a75d6);}BPromise['resolve']()['then'](function(){if(!_0x1dbfbd){if(_0xafc8b0[_0x7fc1('0x3d')][_0x7fc1('0x75')])return;_0x54757d[_0x7fc1('0x47')](_0x7fc1('0x90'));_0x5ef33['where'](_0x7fc1('0x90'));return;}if(_0xafc8b0[_0x7fc1('0x91')]['role']!=='agent')return;return _0xafc8b0[_0x7fc1('0x91')][_0x7fc1('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x15899d){if(_[_0x7fc1('0x74')](_0x15899d)){_0x54757d['where'](_0x7fc1('0x93'));_0x5ef33[_0x7fc1('0x47')](_0x7fc1('0x93'));}else{_0x54757d['where'](_0x7fc1('0x76'),_[_0x7fc1('0x38')](_0x15899d,'id'));_0x5ef33[_0x7fc1('0x47')](_0x7fc1('0x76'),_['map'](_0x15899d,'id'));}});})['then'](function(){if(_0xafc8b0['user'][_0x7fc1('0x94')]===_0x7fc1('0x95')&&!_0x1dbfbd&&!_0xafc8b0['query'][_0x7fc1('0x75')])return[];return db[_0x7fc1('0x96')][_0x7fc1('0x3d')](_0x54757d[_0x7fc1('0x97')](),_0x1a33b9);})[_0x7fc1('0x1e')](function(_0x13c895){_0x2fc293[_0x7fc1('0x1b')]=_0x13c895[_0x7fc1('0x42')];if(_0x2fc293[_0x7fc1('0x1b')]===0x0)return[];return db[_0x7fc1('0x96')][_0x7fc1('0x3d')](_0x425e5a['toString'](),_0x1a33b9)[_0x7fc1('0x1e')](function(_0x388817){_0x15edd4=_['keyBy'](_0x388817,'id');_0x1a33b9=_[_0x7fc1('0x98')](_0x1a33b9,{'model':db[_0x7fc1('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xafc8b0['query']['fields']){_0x4e640b[_0x7fc1('0x40')][_0x7fc1('0x6f')](function(_0x42f448){_0x5ef33['field']('i.'+_0x42f448);});}else{_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0x8d'),_0x7fc1('0x63'));_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0x99'),'Account.key');_0x5ef33['field'](_0x7fc1('0x9a'),_0x7fc1('0x9b'));_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0x9c'),_0x7fc1('0x8e'));_0x5ef33['field'](_0x7fc1('0x8a'));_0x5ef33['field'](_0x7fc1('0x9d'));_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0x9e'));_0x5ef33['field'](_0x7fc1('0x9f'));_0x5ef33[_0x7fc1('0x4b')]('i.closedAt');_0x5ef33[_0x7fc1('0x4b')]('i.attach');_0x5ef33['field'](_0x7fc1('0xa0'));_0x5ef33['field']('i.lastMsgDirection');_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xa1'));_0x5ef33['field'](_0x7fc1('0xa2'));_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xa3'));_0x5ef33['field']('i.thirdDisposition');_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xa4'));_0x5ef33['field']('i.to');_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xa5'));_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xa6'));_0x5ef33[_0x7fc1('0x4b')]('i.UserId');_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xa7'),_0x7fc1('0xa8'));_0x5ef33['field']('c.lastName',_0x7fc1('0xa9'));_0x5ef33['field'](_0x7fc1('0xaa'),'Contact.email');_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xab'),'Contact.phone');_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xac'),'Contact.mobile');_0x5ef33['field'](_0x7fc1('0xad'),'Contact.fax');_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xae'),_0x7fc1('0xaf'));_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xb0'),_0x7fc1('0xb1'));_0x5ef33[_0x7fc1('0x4b')](_0x7fc1('0xb2'),'TagIds');}if(_0x4e640b['limit'])_0x5ef33[_0x7fc1('0x1a')](_0x4e640b[_0x7fc1('0x1a')]);if(_0x4e640b['offset'])_0x5ef33[_0x7fc1('0x18')](_0x4e640b['offset']);return db['sequelize'][_0x7fc1('0x3d')](_0x5ef33['toString'](),_0x1a33b9);})[_0x7fc1('0x1e')](function(_0x6fdd15){if(_0x6fdd15['length']>0x0)_0x518a54[_0x7fc1('0x47')](_0x7fc1('0xb3'),_['map'](_0x6fdd15,'id'));return db[_0x7fc1('0x96')]['query'](_0x518a54[_0x7fc1('0x97')](),_0x1a33b9)[_0x7fc1('0x1e')](function(_0x461ae2){var _0x5f5d56=_[_0x7fc1('0xb4')](_0x461ae2,_0x7fc1('0xb5'));var _0x5e42f2=[];return db[_0x7fc1('0xb6')][_0x7fc1('0x29')]({'attributes':[_0x7fc1('0xb7')],'raw':!![]})['then'](function(_0x5e7ec0){var _0x3f5770=_0x5e7ec0[_0x7fc1('0xb7')];_0x6fdd15['forEach'](function(_0x2d95fb){_0x5e42f2[_0x7fc1('0x28')](updateMailInteraction(_0x2d95fb,_0x15edd4,_0x5f5d56,_0x3f5770));});return BPromise['all'](_0x5e42f2);});});});})['then'](function(_0xc627c1){_0x2fc293[_0x7fc1('0xb8')]=_0xc627c1;return _0x2fc293;})['then'](respondWithFilteredResult(_0x564437,_0x4e640b))[_0x7fc1('0x2f')](handleError(_0x564437,null));};exports[_0x7fc1('0xb9')]=function(_0x4d584c,_0x2b12bf){var _0x2f676f={'raw':![],'where':{'id':_0x4d584c['params']['id']}},_0xde49ed={};_0xde49ed[_0x7fc1('0x3f')]=_[_0x7fc1('0x72')](db[_0x7fc1('0x39')]['rawAttributes']);_0xde49ed['query']=_[_0x7fc1('0x72')](_0x4d584c['query']);_0xde49ed['filters']=_['intersection'](_0xde49ed[_0x7fc1('0x3f')],_0xde49ed[_0x7fc1('0x3d')]);_0x2f676f[_0x7fc1('0x40')]=_['intersection'](_0xde49ed[_0x7fc1('0x3f')],qs[_0x7fc1('0x41')](_0x4d584c['query'][_0x7fc1('0x41')]));_0x2f676f['attributes']=_0x2f676f[_0x7fc1('0x40')][_0x7fc1('0x42')]?_0x2f676f[_0x7fc1('0x40')]:_0xde49ed[_0x7fc1('0x3f')];if(_0x4d584c[_0x7fc1('0x3d')][_0x7fc1('0xba')]){_0x2f676f[_0x7fc1('0xbb')]=[{'all':!![]}];}_0x2f676f=_[_0x7fc1('0x98')]({},_0x2f676f,_0x4d584c['options']);return db[_0x7fc1('0x39')][_0x7fc1('0x62')](_0x2f676f)[_0x7fc1('0x1e')](handleEntityNotFound(_0x2b12bf,null))[_0x7fc1('0x1e')](respondWithResult(_0x2b12bf,null))['catch'](handleError(_0x2b12bf,null));};exports['create']=function(_0x48ffb3,_0x462dd4){return db[_0x7fc1('0x39')]['create'](_0x48ffb3[_0x7fc1('0xbc')],{})[_0x7fc1('0x1e')](respondWithResult(_0x462dd4,0xc9))[_0x7fc1('0x2f')](handleError(_0x462dd4,null));};exports['update']=function(_0x11d81c,_0x7f16e){if(_0x11d81c[_0x7fc1('0xbc')]['id']){delete _0x11d81c[_0x7fc1('0xbc')]['id'];}return db[_0x7fc1('0x39')][_0x7fc1('0x62')]({'where':{'id':_0x11d81c[_0x7fc1('0xbd')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x7f16e,null))[_0x7fc1('0x1e')](saveUpdates(_0x11d81c[_0x7fc1('0xbc')],null))[_0x7fc1('0x1e')](respondWithResult(_0x7f16e,null))[_0x7fc1('0x2f')](handleError(_0x7f16e,null));};exports[_0x7fc1('0x1f')]=function(_0x400e21,_0x440be1){return db[_0x7fc1('0x39')][_0x7fc1('0x62')]({'where':{'id':_0x400e21['params']['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x440be1,null))[_0x7fc1('0x1e')](removeEntity(_0x440be1,null))[_0x7fc1('0x2f')](handleError(_0x440be1,null));};exports[_0x7fc1('0xbe')]=function(_0x560cf4,_0x239fc7){return db[_0x7fc1('0x39')][_0x7fc1('0xbe')]()[_0x7fc1('0x1e')](respondWithResult(_0x239fc7,null))[_0x7fc1('0x2f')](handleError(_0x239fc7,null));};exports[_0x7fc1('0xbf')]=function(_0x25fdca,_0x5161b4){return db['MailMessage'][_0x7fc1('0x62')]({'where':{'id':_0x25fdca[_0x7fc1('0xbd')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x5161b4,null))[_0x7fc1('0x1e')](function(_0xc217c3){if(_0xc217c3){return _0xc217c3[_0x7fc1('0xbf')](_0x25fdca['body']['ids'],_['omit'](_0x25fdca[_0x7fc1('0xbc')],[_0x7fc1('0xc0'),'id'])||{});}})[_0x7fc1('0x1e')](respondWithResult(_0x5161b4,null))[_0x7fc1('0x2f')](handleError(_0x5161b4,null));};exports['getMessages']=function(_0x58fe4b,_0x51698f){var _0x390456={'raw':![],'where':{}};var _0xa3826a={};var _0x37bce6={'count':0x0,'rows':[]};return db[_0x7fc1('0x39')][_0x7fc1('0x29')]({'where':{'id':_0x58fe4b[_0x7fc1('0xbd')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x51698f,null))[_0x7fc1('0x1e')](function(_0x24a3b8){if(_0x24a3b8){_0xa3826a[_0x7fc1('0x3f')]=_['keys'](db['MailMessage'][_0x7fc1('0xc1')]);_0xa3826a['query']=_[_0x7fc1('0x72')](_0x58fe4b[_0x7fc1('0x3d')]);_0xa3826a[_0x7fc1('0x48')]=_[_0x7fc1('0x3e')](_0xa3826a[_0x7fc1('0x3f')],_0xa3826a[_0x7fc1('0x3d')]);_0x390456['attributes']=_[_0x7fc1('0x3e')](_0xa3826a[_0x7fc1('0x3f')],qs['fields'](_0x58fe4b[_0x7fc1('0x3d')][_0x7fc1('0x41')]));_0x390456[_0x7fc1('0x40')]=_0x390456[_0x7fc1('0x40')][_0x7fc1('0x42')]?_0x390456[_0x7fc1('0x40')]:_0xa3826a[_0x7fc1('0x3f')];if(!_0x58fe4b['query'][_0x7fc1('0x43')](_0x7fc1('0x44'))){_0x390456[_0x7fc1('0x1a')]=qs[_0x7fc1('0x1a')](_0x58fe4b[_0x7fc1('0x3d')][_0x7fc1('0x1a')]);_0x390456[_0x7fc1('0x18')]=qs[_0x7fc1('0x18')](_0x58fe4b[_0x7fc1('0x3d')]['offset']);}_0x390456[_0x7fc1('0x45')]=qs[_0x7fc1('0x46')](_0x58fe4b[_0x7fc1('0x3d')][_0x7fc1('0x46')]);_0x390456[_0x7fc1('0x47')]=qs[_0x7fc1('0x48')](_[_0x7fc1('0x49')](_0x58fe4b[_0x7fc1('0x3d')],_0xa3826a[_0x7fc1('0x48')]));_0x390456[_0x7fc1('0x47')][_0x7fc1('0xb5')]=_0x24a3b8['id'];if(_0x58fe4b[_0x7fc1('0x3d')][_0x7fc1('0x83')]){_0x390456['where']=_[_0x7fc1('0x98')](_0x390456['where'],{'$or':_[_0x7fc1('0x38')](_0x390456[_0x7fc1('0x40')],function(_0x5031db){var _0x3099e1={};_0x3099e1[_0x5031db]={'$like':'%'+_0x58fe4b[_0x7fc1('0x3d')][_0x7fc1('0x83')]+'%'};return _0x3099e1;})});}if(_0x58fe4b[_0x7fc1('0x3d')][_0x7fc1('0xc2')]){var _0x251305=_0x58fe4b['query']['$gte'][_0x7fc1('0x27')](',');var _0x25ecfe={};_0x25ecfe[_0x251305[0x0]]={'$gte':moment(_0x251305[0x1])[_0x7fc1('0xc3')](_0x7fc1('0xc4'))};_0x390456[_0x7fc1('0x47')]=_['merge'](_0x390456[_0x7fc1('0x47')],_0x25ecfe);}_0x390456=_[_0x7fc1('0x98')]({},_0x390456,_0x58fe4b[_0x7fc1('0xc5')]);return db['MailMessage']['count']({'where':_0x390456['where']})['then'](function(_0x13e7f7){_0x37bce6[_0x7fc1('0x1b')]=_0x13e7f7;if(_0x58fe4b[_0x7fc1('0x3d')][_0x7fc1('0xba')]){_0x390456[_0x7fc1('0xbb')]=[{'all':!![]}];}return db['MailMessage'][_0x7fc1('0xc6')](_0x390456);})[_0x7fc1('0x1e')](function(_0x2fc5b2){if(_0x58fe4b[_0x7fc1('0x3d')][_0x7fc1('0xc7')]==='true'){for(var _0x1a462e=0x0;_0x1a462e<_0x2fc5b2[_0x7fc1('0x42')];_0x1a462e++){_0x2fc5b2[_0x1a462e][_0x7fc1('0xbc')]=juice(_0x2fc5b2[_0x1a462e][_0x7fc1('0xbc')]);}}_0x37bce6[_0x7fc1('0xb8')]=_0x2fc5b2;return _0x37bce6;});}})[_0x7fc1('0x1e')](respondWithFilteredResult(_0x51698f,_0x390456))['catch'](handleError(_0x51698f,null));};exports[_0x7fc1('0xc8')]=function(_0x48f27d,_0x4c326c){return db[_0x7fc1('0x39')][_0x7fc1('0x62')]({'where':{'id':_0x48f27d[_0x7fc1('0xbd')]['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x4c326c,null))['then'](function(_0x2f3cf3){if(_0x2f3cf3){return _0x2f3cf3[_0x7fc1('0xc9')](_0x48f27d[_0x7fc1('0xbc')][_0x7fc1('0xc0')],_['omit'](_0x48f27d[_0x7fc1('0xbc')],['ids','id'])||{})[_0x7fc1('0xca')](function(){return db[_0x7fc1('0x6e')][_0x7fc1('0xc6')]({'attributes':['id',_0x7fc1('0x22'),_0x7fc1('0x4c')],'where':{'id':_0x48f27d[_0x7fc1('0xbc')][_0x7fc1('0xc0')]}});})[_0x7fc1('0x1e')](function(_0x5105f6){socket[_0x7fc1('0xcb')](_0x7fc1('0xcc'),{'id':Number(_0x48f27d[_0x7fc1('0xbd')]['id']),'tags':_0x5105f6||[]});return{'id':Number(_0x48f27d[_0x7fc1('0xbd')]['id']),'tags':_0x5105f6||[]};});}})[_0x7fc1('0x1e')](respondWithResult(_0x4c326c,null))[_0x7fc1('0x2f')](handleError(_0x4c326c,null));};exports[_0x7fc1('0xcd')]=function(_0x354508,_0x210956){return db[_0x7fc1('0x39')][_0x7fc1('0x62')]({'where':{'id':_0x354508['params']['id']}})[_0x7fc1('0x1e')](handleEntityNotFound(_0x210956,null))[_0x7fc1('0x1e')](function(_0x16b0a0){if(_0x16b0a0){return _0x16b0a0[_0x7fc1('0xcd')](_0x354508[_0x7fc1('0x3d')][_0x7fc1('0xc0')]);}})[_0x7fc1('0x1e')](respondWithStatusCode(_0x210956,null))[_0x7fc1('0x2f')](handleError(_0x210956,null));};exports[_0x7fc1('0xce')]=function(_0x18447f,_0x391a33){var _0x3aadfe=moment()[_0x7fc1('0xcf')]()['toString']();var _0x4d75fc=path[_0x7fc1('0xd0')](config[_0x7fc1('0xd1')],_0x7fc1('0xd2'),_0x7fc1('0xd3'),'tmp');var _0x34ebfc=path[_0x7fc1('0xd0')](config[_0x7fc1('0xd1')],_0x7fc1('0xd2'),_0x7fc1('0xd3'),_0x7fc1('0xd4'));var _0x511072=path[_0x7fc1('0xd0')](_0x4d75fc,_0x3aadfe);var _0x3bff5a=util[_0x7fc1('0xc3')](_0x7fc1('0xd5'),_0x18447f[_0x7fc1('0xbd')]['id'],_0x3aadfe);var _0x5c17f1=path[_0x7fc1('0xd0')](_0x4d75fc,_0x3bff5a);var _0x181086=[];if(_0x18447f['query']['attachments']){_0x181086[_0x7fc1('0x28')]({'model':db[_0x7fc1('0xd6')],'as':_0x7fc1('0xd7'),'raw':!![]});}var _0x4866b8=[{'model':db[_0x7fc1('0xd8')],'as':'Messages','attributes':['id',_0x7fc1('0xbc'),_0x7fc1('0x4d'),'to','cc',_0x7fc1('0xd9'),_0x7fc1('0xda'),_0x7fc1('0x78')],'where':{'secret':![]},'order':qs[_0x7fc1('0x46')]('id'),'include':_0x181086}];return db[_0x7fc1('0x39')][_0x7fc1('0x62')]({'where':{'id':_0x18447f[_0x7fc1('0xbd')]['id']},'include':_0x4866b8})[_0x7fc1('0x1e')](handleEntityNotFound(_0x391a33,null))[_0x7fc1('0x1e')](function(_0x10cec8){if(_0x10cec8&&_0x10cec8[_0x7fc1('0xdb')]){var _0x18db07=_0x10cec8[_0x7fc1('0xdc')]({'plain':!![]});fs[_0x7fc1('0xdd')](_0x511072);return BPromise[_0x7fc1('0xde')](_0x18db07[_0x7fc1('0xdb')],function(_0x2325a7,_0x3d146a){var _0xbb1b6e={'from':_0x2325a7[_0x7fc1('0x4d')],'to':_0x2325a7['to'],'subject':_0x2325a7['subject'],'html':htmlEntities[_0x7fc1('0xdf')](_0x2325a7[_0x7fc1('0xbc')]),'headers':{'Date':moment(_0x2325a7[_0x7fc1('0x78')])[_0x7fc1('0xc3')](_0x7fc1('0xe0'))},'attachments':[]};if(_0x2325a7['cc']){_0xbb1b6e['headers']['Cc']=_0x2325a7['cc'];}if(_0x2325a7[_0x7fc1('0xd9')]){_0xbb1b6e[_0x7fc1('0xe1')]['Bcc']=_0x2325a7[_0x7fc1('0xd9')];}return new BPromise(function(_0x109c3b,_0x136f44){if(_0x2325a7[_0x7fc1('0xd7')]){for(var _0x467293=0x0;_0x467293<_0x2325a7['Attachments'][_0x7fc1('0x42')];_0x467293++){var _0x1fcd68=_0x2325a7[_0x7fc1('0xd7')][_0x467293];var _0x562e83=path[_0x7fc1('0xd0')](_0x34ebfc,_0x1fcd68[_0x7fc1('0xe2')]);if(fs[_0x7fc1('0xe3')](_0x562e83)){_0xbb1b6e[_0x7fc1('0xd4')][_0x7fc1('0x28')]({'name':_0x1fcd68['name'],'contentType':_0x1fcd68[_0x7fc1('0x3b')],'data':fs[_0x7fc1('0xe4')](_0x562e83)});}}}emlformat[_0x7fc1('0xe5')](_0xbb1b6e,function(_0x3d09c7,_0x598617){if(_0x3d09c7)return _0x136f44(_0x3d09c7);fs[_0x7fc1('0xe6')](path[_0x7fc1('0xd0')](_0x511072,util[_0x7fc1('0xc3')](_0x7fc1('0xe7'),_0x3d146a)),_0x598617);return _0x109c3b(_0x598617);});});})[_0x7fc1('0x1e')](function(){return new BPromise(function(_0x221d97,_0x4cd0b4){zipdir(_0x511072,{'saveTo':_0x5c17f1},function(_0x2316db,_0x7860b){if(_0x2316db)return _0x4cd0b4(_0x2316db);return _0x221d97(_0x7860b);});})[_0x7fc1('0x1e')](function(){return new BPromise(function(_0x1e2887,_0x5d2b3a){rimraf(_0x511072,function(_0x4bb095){if(_0x4bb095)_0x5d2b3a(_0x4bb095);return _0x1e2887();});});})['then'](function(){return _0x391a33['download'](_0x5c17f1,_0x3bff5a,function(_0x2d2721){if(!_0x2d2721)fs['unlinkSync'](_0x5c17f1);});});});}else{return _0x391a33['sendStatus'](0xc8);}})[_0x7fc1('0x2f')](handleError(_0x391a33,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 349b8d3..3c7cf8b 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 _0x443d=['setMaxListeners','save','update','getUsers','Users','findAll','then','length','emit','catch','hook','exports','../../mysqldb','MailInteraction','MailMessage'];(function(_0x5df59f,_0xf11a72){var _0x190e3b=function(_0x2b983e){while(--_0x2b983e){_0x5df59f['push'](_0x5df59f['shift']());}};_0x190e3b(++_0xf11a72);}(_0x443d,0x165));var _0xd443=function(_0x44502b,_0x13fd65){_0x44502b=_0x44502b-0x0;var _0x3073fb=_0x443d[_0x44502b];return _0x3073fb;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xd443('0x0'))['db'][_0xd443('0x1')];var MailMessage=require(_0xd443('0x0'))['db'][_0xd443('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd443('0x3')](0x0);var events={'afterCreate':_0xd443('0x4'),'afterUpdate':_0xd443('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4cc0ac){return function(_0x19cf44,_0x453282,_0x31ed99){_0x19cf44[_0xd443('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5e1c2d){_0x19cf44['setDataValue'](_0xd443('0x7'),_0x5e1c2d['map'](function(_0x5d0d8c){return{'id':_0x5d0d8c['id']};}));return MailMessage[_0xd443('0x8')]({'where':{'MailInteractionId':_0x19cf44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd443('0x9')](function(_0x394a45){_0x19cf44['setDataValue']('unreadMessages',_0x394a45[_0xd443('0xa')]);MailInteractionEvents[_0xd443('0xb')](_0x4cc0ac+':'+_0x19cf44['id'],_0x19cf44);MailInteractionEvents[_0xd443('0xb')](_0x4cc0ac,_0x19cf44);_0x31ed99(null);})[_0xd443('0xc')](_0x31ed99(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xd443('0xd')](e,emitEvent(event));}}module[_0xd443('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x9ce7=['Users','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','setDataValue'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x9ce7,0x1e7));var _0x79ce=function(_0x2b7566,_0x122e4e){_0x2b7566=_0x2b7566-0x0;var _0x44dc9d=_0x9ce7[_0x2b7566];return _0x44dc9d;};'use strict';var EventEmitter=require(_0x79ce('0x0'));var MailInteraction=require(_0x79ce('0x1'))['db'][_0x79ce('0x2')];var MailMessage=require(_0x79ce('0x1'))['db'][_0x79ce('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x79ce('0x4')](0x0);var events={'afterCreate':_0x79ce('0x5'),'afterUpdate':_0x79ce('0x6'),'afterDestroy':'remove'};function emitEvent(_0x72f14c){return function(_0x310f72,_0x3c227a,_0x5b02f4){_0x310f72[_0x79ce('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x194870){_0x310f72[_0x79ce('0x8')](_0x79ce('0x9'),_0x194870['map'](function(_0x3d2f39){return{'id':_0x3d2f39['id']};}));return MailMessage[_0x79ce('0xa')]({'where':{'MailInteractionId':_0x310f72['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x10b95d){_0x310f72[_0x79ce('0x8')](_0x79ce('0xb'),_0x10b95d[_0x79ce('0xc')]);MailInteractionEvents['emit'](_0x72f14c+':'+_0x310f72['id'],_0x310f72);MailInteractionEvents[_0x79ce('0xd')](_0x72f14c,_0x310f72);_0x5b02f4(null);})[_0x79ce('0xe')](_0x5b02f4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x79ce('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 3ad8193..d1a7734 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 _0xeedf=['changed','closedAt','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x329da2,_0x29d437){var _0x13d546=function(_0x217567){while(--_0x217567){_0x329da2['push'](_0x329da2['shift']());}};_0x13d546(++_0x29d437);}(_0xeedf,0xf1));var _0xfeed=function(_0x4a3526,_0x17ddd1){_0x4a3526=_0x4a3526-0x0;var _0x8f5716=_0xeedf[_0x4a3526];return _0x8f5716;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require('../../config/logger')(_0xfeed('0x2'));var moment=require(_0xfeed('0x3'));var BPromise=require(_0xfeed('0x4'));var rp=require(_0xfeed('0x5'));var fs=require('fs');var path=require(_0xfeed('0x6'));var rimraf=require('rimraf');var config=require(_0xfeed('0x7'));var attributes=require(_0xfeed('0x8'));module[_0xfeed('0x9')]=function(_0x33c6cb,_0x285c83){return _0x33c6cb[_0xfeed('0xa')](_0xfeed('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xfeed('0xc'),'fields':[_0xfeed('0xd'),'to'],'type':_0xfeed('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xc69969,_0x19cb6b,_0x2afcf3){if(_0xc69969[_0xfeed('0xf')]){_0xc69969[_0xfeed('0x10')]=moment()[_0xfeed('0x11')](_0xfeed('0x12'));}if(_0xc69969[_0xfeed('0x13')]){_0xc69969['closedAt']=moment()[_0xfeed('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2afcf3(null,_0x19cb6b);},'beforeUpdate':function(_0x2364c8,_0x4a63b7,_0x1f1c25){if(_0x2364c8['changed'](_0xfeed('0xf'))){_0x2364c8[_0xfeed('0x10')]=_0x2364c8[_0xfeed('0xf')]?moment()[_0xfeed('0x11')](_0xfeed('0x12')):null;}if(_0x2364c8[_0xfeed('0x14')]('closed')){_0x2364c8[_0xfeed('0x15')]=moment()['format'](_0xfeed('0x12'));_0x2364c8[_0xfeed('0xf')]=null;_0x2364c8[_0xfeed('0x10')]=null;}_0x1f1c25(null,_0x2364c8);},'afterUpdate':function(_0x2ddb86,_0x5aef2b,_0x2f2a98){var _0x41657f=_0x33c6cb[_0xfeed('0x16')];var _0x35c177=_0x2ddb86['get']({'plain':!![]});if(_0x35c177[_0xfeed('0x13')]){return _0x41657f[_0xfeed('0x17')][_0xfeed('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x35c177['id']}})[_0xfeed('0x19')](function(){_0x2f2a98();})[_0xfeed('0x1a')](function(_0x1a3660){_0x2f2a98(_0x1a3660);});}else{_0x2f2a98();}}},'charset':_0xfeed('0x1b'),'collate':_0xfeed('0x1c')});}; \ No newline at end of file +var _0xd4b8=['path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','catch','utf8mb4','util','../../config/logger','api','moment','request-promise'];(function(_0x64fed3,_0xdfcc08){var _0x5a22fb=function(_0x6cff16){while(--_0x6cff16){_0x64fed3['push'](_0x64fed3['shift']());}};_0x5a22fb(++_0xdfcc08);}(_0xd4b8,0x1cf));var _0x8d4b=function(_0x417459,_0xc2b71a){_0x417459=_0x417459-0x0;var _0x1f1bc6=_0xd4b8[_0x417459];return _0x1f1bc6;};'use strict';var _=require('lodash');var util=require(_0x8d4b('0x0'));var logger=require(_0x8d4b('0x1'))(_0x8d4b('0x2'));var moment=require(_0x8d4b('0x3'));var BPromise=require('bluebird');var rp=require(_0x8d4b('0x4'));var fs=require('fs');var path=require(_0x8d4b('0x5'));var rimraf=require(_0x8d4b('0x6'));var config=require(_0x8d4b('0x7'));var attributes=require(_0x8d4b('0x8'));module['exports']=function(_0x216af1,_0xa3002b){return _0x216af1[_0x8d4b('0x9')](_0x8d4b('0xa'),attributes,{'tableName':_0x8d4b('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x8d4b('0xc'),'to'],'type':_0x8d4b('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b9474,_0xfd9d53,_0x4ab5ef){if(_0x1b9474[_0x8d4b('0xe')]){_0x1b9474[_0x8d4b('0xf')]=moment()[_0x8d4b('0x10')](_0x8d4b('0x11'));}if(_0x1b9474[_0x8d4b('0x12')]){_0x1b9474[_0x8d4b('0x13')]=moment()[_0x8d4b('0x10')](_0x8d4b('0x11'));}_0x4ab5ef(null,_0xfd9d53);},'beforeUpdate':function(_0x2e44b1,_0x3d7639,_0x5b444d){if(_0x2e44b1[_0x8d4b('0x14')]('substatus')){_0x2e44b1[_0x8d4b('0xf')]=_0x2e44b1[_0x8d4b('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2e44b1[_0x8d4b('0x14')](_0x8d4b('0x12'))){_0x2e44b1[_0x8d4b('0x13')]=moment()[_0x8d4b('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e44b1[_0x8d4b('0xe')]=null;_0x2e44b1[_0x8d4b('0xf')]=null;}_0x5b444d(null,_0x2e44b1);},'afterUpdate':function(_0xe38d03,_0x541ce6,_0x365dab){var _0x23d417=_0x216af1[_0x8d4b('0x15')];var _0x317c85=_0xe38d03[_0x8d4b('0x16')]({'plain':!![]});if(_0x317c85[_0x8d4b('0x12')]){return _0x23d417['MailMessage'][_0x8d4b('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x317c85['id']}})['then'](function(){_0x365dab();})[_0x8d4b('0x18')](function(_0x2b955d){_0x365dab(_0x2b955d);});}else{_0x365dab();}}},'charset':_0x8d4b('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 5fc85a7..74beb2f 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 _0x664d=['redis','localhost','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateMailInteraction','MailInteraction','body','raw','options','where','attributes','limit','info','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x43eafd,_0x4084ad){var _0x32a874=function(_0x117b83){while(--_0x117b83){_0x43eafd['push'](_0x43eafd['shift']());}};_0x32a874(++_0x4084ad);}(_0x664d,0x1c2));var _0xd664=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x664d[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require(_0xd664('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd664('0x1'));var rs=require(_0xd664('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd664('0x3'))['db'];var utils=require(_0xd664('0x4'));var logger=require(_0xd664('0x5'))(_0xd664('0x6'));var config=require(_0xd664('0x7'));var jayson=require(_0xd664('0x8'));var client=jayson[_0xd664('0x9')][_0xd664('0xa')]({'port':0x232a});config['redis']=_[_0xd664('0xb')](config[_0xd664('0xc')],{'host':_0xd664('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd664('0xc')]));require('./mailInteraction.socket')[_0xd664('0xe')](socket);function respondWithRpcPromise(_0x4db279,_0x2c0f2f,_0x51062c){return new BPromise(function(_0x4ef6b4,_0x218fb8){return client[_0xd664('0xf')](_0x4db279,_0x51062c)[_0xd664('0x10')](function(_0xe34a62){logger['info'](_0xd664('0x11'),_0x2c0f2f,_0xd664('0x12'));logger[_0xd664('0x13')](_0xd664('0x14'),_0x2c0f2f,_0xd664('0x12'),JSON['stringify'](_0xe34a62));if(_0xe34a62[_0xd664('0x15')]){if(_0xe34a62[_0xd664('0x15')]['code']===0x1f4){logger[_0xd664('0x15')]('MailInteraction,\x20%s,\x20%s',_0x2c0f2f,_0xe34a62[_0xd664('0x15')][_0xd664('0x16')]);return _0x218fb8(_0xe34a62[_0xd664('0x15')][_0xd664('0x16')]);}logger[_0xd664('0x15')](_0xd664('0x11'),_0x2c0f2f,_0xe34a62[_0xd664('0x15')][_0xd664('0x16')]);return _0x4ef6b4(_0xe34a62[_0xd664('0x15')][_0xd664('0x16')]);}else{logger['info'](_0xd664('0x11'),_0x2c0f2f,'request\x20sent');_0x4ef6b4(_0xe34a62[_0xd664('0x17')]['message']);}})[_0xd664('0x18')](function(_0x489c54){logger[_0xd664('0x15')]('MailInteraction,\x20%s,\x20%s',_0x2c0f2f,_0x489c54);_0x218fb8(_0x489c54);});});}exports[_0xd664('0x19')]=function(_0x45c6f0){var _0x1d1ba0=this;return new Promise(function(_0xff5f0a,_0x28975c){return db[_0xd664('0x1a')]['update'](_0x45c6f0[_0xd664('0x1b')],{'raw':_0x45c6f0['options']?_0x45c6f0['options'][_0xd664('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45c6f0[_0xd664('0x1d')]?_0x45c6f0[_0xd664('0x1d')][_0xd664('0x1e')]||null:null,'attributes':_0x45c6f0[_0xd664('0x1d')]?_0x45c6f0[_0xd664('0x1d')][_0xd664('0x1f')]||null:null,'limit':_0x45c6f0[_0xd664('0x1d')]?_0x45c6f0[_0xd664('0x1d')][_0xd664('0x20')]||null:null})[_0xd664('0x10')](function(_0x31de20){logger[_0xd664('0x21')](_0xd664('0x19'),_0x45c6f0);logger[_0xd664('0x13')](_0xd664('0x19'),_0x45c6f0,JSON[_0xd664('0x22')](_0x31de20));_0xff5f0a(_0x31de20);})[_0xd664('0x18')](function(_0x39446d){logger[_0xd664('0x15')](_0xd664('0x19'),_0x39446d['message'],_0x45c6f0);_0x28975c(_0x1d1ba0[_0xd664('0x15')](0x1f4,_0x39446d[_0xd664('0x16')]));});});};exports[_0xd664('0x23')]=function(_0x1816ab){return new Promise(function(_0xe49cd4,_0x2d4553){return db[_0xd664('0x1a')][_0xd664('0x24')]({'where':_0x1816ab['options']?_0x1816ab[_0xd664('0x1d')][_0xd664('0x1e')]||null:null})[_0xd664('0x10')](function(_0x449fe8){if(_0x449fe8){return _0x449fe8[_0xd664('0x25')](_0x1816ab[_0xd664('0x1b')][_0xd664('0x26')],_[_0xd664('0x27')](_0x1816ab[_0xd664('0x1b')],[_0xd664('0x26'),'id'])||{});}})[_0xd664('0x28')](function(_0x1a4d92){logger[_0xd664('0x21')](_0xd664('0x29'),_0x1816ab);logger[_0xd664('0x13')]('AddTags',_0x1816ab,JSON[_0xd664('0x22')](_0x1a4d92));_0xe49cd4(_0x1a4d92);})['catch'](function(_0x2dadb9){logger[_0xd664('0x15')]('AddTags',_0x2dadb9[_0xd664('0x16')],_0x1816ab);_0x2d4553(_this[_0xd664('0x15')](0x1f4,_0x2dadb9[_0xd664('0x16')]));});});}; \ No newline at end of file +var _0x33e6=['message','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','then','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','AddTags','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x39aed8,_0x559116){var _0x33591c=function(_0x104df3){while(--_0x104df3){_0x39aed8['push'](_0x39aed8['shift']());}};_0x33591c(++_0x559116);}(_0x33e6,0xaa));var _0x633e=function(_0x418c54,_0x584357){_0x418c54=_0x418c54-0x0;var _0x4a9b6b=_0x33e6[_0x418c54];return _0x4a9b6b;};'use strict';var _=require(_0x633e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x633e('0x1'));var db=require(_0x633e('0x2'))['db'];var utils=require(_0x633e('0x3'));var logger=require(_0x633e('0x4'))('rpc');var config=require(_0x633e('0x5'));var jayson=require(_0x633e('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x633e('0x7')](config[_0x633e('0x8')],{'host':_0x633e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x633e('0xa'))['register'](socket);function respondWithRpcPromise(_0x186a84,_0x882004,_0x15ace2){return new BPromise(function(_0x488bf1,_0x128e5c){return client[_0x633e('0xb')](_0x186a84,_0x15ace2)['then'](function(_0x598ac8){logger[_0x633e('0xc')](_0x633e('0xd'),_0x882004,'request\x20sent');logger[_0x633e('0xe')](_0x633e('0xf'),_0x882004,_0x633e('0x10'),JSON[_0x633e('0x11')](_0x598ac8));if(_0x598ac8['error']){if(_0x598ac8[_0x633e('0x12')][_0x633e('0x13')]===0x1f4){logger[_0x633e('0x12')](_0x633e('0xd'),_0x882004,_0x598ac8[_0x633e('0x12')][_0x633e('0x14')]);return _0x128e5c(_0x598ac8[_0x633e('0x12')][_0x633e('0x14')]);}logger['error'](_0x633e('0xd'),_0x882004,_0x598ac8[_0x633e('0x12')][_0x633e('0x14')]);return _0x488bf1(_0x598ac8[_0x633e('0x12')][_0x633e('0x14')]);}else{logger[_0x633e('0xc')](_0x633e('0xd'),_0x882004,_0x633e('0x10'));_0x488bf1(_0x598ac8[_0x633e('0x15')][_0x633e('0x14')]);}})[_0x633e('0x16')](function(_0x468d93){logger[_0x633e('0x12')](_0x633e('0xd'),_0x882004,_0x468d93);_0x128e5c(_0x468d93);});});}exports['UpdateMailInteraction']=function(_0x28404e){var _0x47d943=this;return new Promise(function(_0x2cb5a3,_0x3c41a3){return db[_0x633e('0x17')][_0x633e('0x18')](_0x28404e[_0x633e('0x19')],{'raw':_0x28404e[_0x633e('0x1a')]?_0x28404e[_0x633e('0x1a')][_0x633e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28404e['options']?_0x28404e[_0x633e('0x1a')][_0x633e('0x1c')]||null:null,'attributes':_0x28404e[_0x633e('0x1a')]?_0x28404e['options'][_0x633e('0x1d')]||null:null,'limit':_0x28404e[_0x633e('0x1a')]?_0x28404e[_0x633e('0x1a')][_0x633e('0x1e')]||null:null})[_0x633e('0x1f')](function(_0x5240a0){logger[_0x633e('0xc')]('UpdateMailInteraction',_0x28404e);logger[_0x633e('0xe')](_0x633e('0x20'),_0x28404e,JSON[_0x633e('0x11')](_0x5240a0));_0x2cb5a3(_0x5240a0);})[_0x633e('0x16')](function(_0x285919){logger[_0x633e('0x12')](_0x633e('0x20'),_0x285919[_0x633e('0x14')],_0x28404e);_0x3c41a3(_0x47d943[_0x633e('0x12')](0x1f4,_0x285919['message']));});});};exports[_0x633e('0x21')]=function(_0x19a90e){return new Promise(function(_0x58f5b0,_0xbeda04){return db[_0x633e('0x17')][_0x633e('0x22')]({'where':_0x19a90e['options']?_0x19a90e[_0x633e('0x1a')][_0x633e('0x1c')]||null:null})['then'](function(_0x2d11a6){if(_0x2d11a6){return _0x2d11a6[_0x633e('0x23')](_0x19a90e[_0x633e('0x19')]['ids'],_['omit'](_0x19a90e[_0x633e('0x19')],[_0x633e('0x24'),'id'])||{});}})['spread'](function(_0x360d2e){logger['info'](_0x633e('0x25'),_0x19a90e);logger['debug'](_0x633e('0x25'),_0x19a90e,JSON[_0x633e('0x11')](_0x360d2e));_0x58f5b0(_0x360d2e);})[_0x633e('0x16')](function(_0x32a190){logger[_0x633e('0x12')](_0x633e('0x25'),_0x32a190[_0x633e('0x14')],_0x19a90e);_0xbeda04(_this[_0x633e('0x12')](0x1f4,_0x32a190[_0x633e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 11d0710..c7ff953 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 _0x32e1=['mailInteraction:','./mailInteraction.events','remove','update','register'];(function(_0x14fe9f,_0x37e6f2){var _0x4cef94=function(_0x29e569){while(--_0x29e569){_0x14fe9f['push'](_0x14fe9f['shift']());}};_0x4cef94(++_0x37e6f2);}(_0x32e1,0xf6));var _0x132e=function(_0x4910f7,_0x48d0b4){_0x4910f7=_0x4910f7-0x0;var _0x550ee2=_0x32e1[_0x4910f7];return _0x550ee2;};'use strict';var MailInteractionEvents=require(_0x132e('0x0'));var events=['save',_0x132e('0x1'),_0x132e('0x2')];function createListener(_0x2c9149,_0x939d7c){return function(_0x54e209){_0x939d7c['emit'](_0x2c9149,_0x54e209);};}function removeListener(_0x1a0ebc,_0x451af1){return function(){MailInteractionEvents['removeListener'](_0x1a0ebc,_0x451af1);};}exports[_0x132e('0x3')]=function(_0x4c2903){for(var _0x11b3b4=0x0,_0x59ca39=events['length'];_0x11b3b4<_0x59ca39;_0x11b3b4++){var _0x371610=events[_0x11b3b4];var _0x43e068=createListener(_0x132e('0x4')+_0x371610,_0x4c2903);MailInteractionEvents['on'](_0x371610,_0x43e068);}}; \ No newline at end of file +var _0x9984=['./mailInteraction.events','remove','update','removeListener','register'];(function(_0x167e10,_0x13a03d){var _0xcd67a3=function(_0x11a26f){while(--_0x11a26f){_0x167e10['push'](_0x167e10['shift']());}};_0xcd67a3(++_0x13a03d);}(_0x9984,0x1f4));var _0x4998=function(_0x1e4381,_0x2847cf){_0x1e4381=_0x1e4381-0x0;var _0x406336=_0x9984[_0x1e4381];return _0x406336;};'use strict';var MailInteractionEvents=require(_0x4998('0x0'));var events=['save',_0x4998('0x1'),_0x4998('0x2')];function createListener(_0x550fc7,_0x22c8e5){return function(_0x1f19b4){_0x22c8e5['emit'](_0x550fc7,_0x1f19b4);};}function removeListener(_0x3652da,_0xbe0ea4){return function(){MailInteractionEvents[_0x4998('0x3')](_0x3652da,_0xbe0ea4);};}exports[_0x4998('0x4')]=function(_0x16d116){for(var _0x34a892=0x0,_0x324066=events['length'];_0x34a892<_0x324066;_0x34a892++){var _0x4c78d7=events[_0x34a892];var _0x291597=createListener('mailInteraction:'+_0x4c78d7,_0x16d116);MailInteractionEvents['on'](_0x4c78d7,_0x291597);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 13b89c2..125b8cf 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 _0x8ec7=['tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download'];(function(_0x480b14,_0x397259){var _0x271f62=function(_0x3a47a1){while(--_0x3a47a1){_0x480b14['push'](_0x480b14['shift']());}};_0x271f62(++_0x397259);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x8ec7[_0x4207f4];return _0x29a621;};'use strict';var multer=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var path=require('path');var timeout=require(_0x78ec('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x78ec('0x3'));var auth=require(_0x78ec('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78ec('0x5'));var controller=require(_0x78ec('0x6'));router[_0x78ec('0x7')]('/',auth[_0x78ec('0x8')](),controller[_0x78ec('0x9')]);router['get'](_0x78ec('0xa'),auth['isAuthenticated'](),controller[_0x78ec('0xb')]);router[_0x78ec('0x7')](_0x78ec('0xc'),auth['isAuthenticated'](),controller[_0x78ec('0xd')]);router[_0x78ec('0x7')](_0x78ec('0xe'),auth[_0x78ec('0x8')](),controller[_0x78ec('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x78ec('0x10')](_0x78ec('0x11'),_0x78ec('0x12')),controller['create']);router[_0x78ec('0x13')](_0x78ec('0xc'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x14')]);router[_0x78ec('0x13')](_0x78ec('0x15'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x16')]);router[_0x78ec('0x13')](_0x78ec('0x17'),auth[_0x78ec('0x8')](),controller['reject']);router[_0x78ec('0x18')](_0x78ec('0xc'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x19')]);module[_0x78ec('0x1a')]=router; \ No newline at end of file +var _0xdab3=['describe','/:id','/:id/download','tracked','mailmessage:create','create','put','/:id/accept','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x2d3199,_0x2c5a63){var _0x243765=function(_0x4fd976){while(--_0x4fd976){_0x2d3199['push'](_0x2d3199['shift']());}};_0x243765(++_0x2c5a63);}(_0xdab3,0x97));var _0x3dab=function(_0x20d7d9,_0x6205b8){_0x20d7d9=_0x20d7d9-0x0;var _0x4dc88a=_0xdab3[_0x20d7d9];return _0x4dc88a;};'use strict';var multer=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var path=require('path');var timeout=require(_0x3dab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3dab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3dab('0x4'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x3dab('0x5')]('/',auth[_0x3dab('0x6')](),controller[_0x3dab('0x7')]);router[_0x3dab('0x5')](_0x3dab('0x8'),auth['isAuthenticated'](),controller[_0x3dab('0x9')]);router[_0x3dab('0x5')](_0x3dab('0xa'),auth[_0x3dab('0x6')](),controller['show']);router[_0x3dab('0x5')](_0x3dab('0xb'),auth[_0x3dab('0x6')](),controller['download']);router['post']('/',auth[_0x3dab('0x6')](),interaction[_0x3dab('0xc')]('mail',_0x3dab('0xd')),controller[_0x3dab('0xe')]);router['put'](_0x3dab('0xa'),auth[_0x3dab('0x6')](),controller['update']);router[_0x3dab('0xf')](_0x3dab('0x10'),auth[_0x3dab('0x6')](),controller['accept']);router[_0x3dab('0xf')]('/:id/reject',auth[_0x3dab('0x6')](),controller['reject']);router[_0x3dab('0x11')](_0x3dab('0xa'),auth['isAuthenticated'](),controller[_0x3dab('0x12')]);module[_0x3dab('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 95abb11..2440153 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 _0xfc73=['Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM'];(function(_0x38c8d7,_0x5370c7){var _0x5c5521=function(_0xad3828){while(--_0xad3828){_0x38c8d7['push'](_0x38c8d7['shift']());}};_0x5c5521(++_0x5370c7);}(_0xfc73,0x160));var _0x3fc7=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfc73[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x3fc7('0x0'));var _=require(_0x3fc7('0x1'));module[_0x3fc7('0x2')]={'body':{'type':Sequelize[_0x3fc7('0x3')](_0x3fc7('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3fc7('0x3')](_0x3fc7('0x5'))},'read':{'type':Sequelize[_0x3fc7('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3fc7('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3fc7('0x8')](0x1fe)},'from':{'type':Sequelize[_0x3fc7('0x8')]},'to':{'type':Sequelize['TEXT'](_0x3fc7('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x3fc7('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x3fc7('0x3')]},'sentAt':{'type':Sequelize[_0x3fc7('0x9')]},'attach':{'type':Sequelize[_0x3fc7('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3fc7('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3fc7('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x3fc7('0x4'))},'originCc':{'type':Sequelize[_0x3fc7('0x3')](_0x3fc7('0x4'))},'originChannel':{'type':Sequelize[_0x3fc7('0xb')](_0x3fc7('0xc'),_0x3fc7('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xdc1b=['DATE','INTEGER','ENUM','Email','sequelize','lodash','long','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc1b,0x1f0));var _0xbdc1=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xdc1b[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0xbdc1('0x0'));var _=require(_0xbdc1('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xbdc1('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbdc1('0x3')](_0xbdc1('0x4'))},'read':{'type':Sequelize[_0xbdc1('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbdc1('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbdc1('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xbdc1('0x3')]('long')},'cc':{'type':Sequelize[_0xbdc1('0x3')](_0xbdc1('0x2'))},'bcc':{'type':Sequelize[_0xbdc1('0x3')](_0xbdc1('0x2'))},'subject':{'type':Sequelize[_0xbdc1('0x3')]},'sentAt':{'type':Sequelize[_0xbdc1('0x8')]},'attach':{'type':Sequelize[_0xbdc1('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xbdc1('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xbdc1('0x3')](_0xbdc1('0x2'))},'originCc':{'type':Sequelize[_0xbdc1('0x3')](_0xbdc1('0x2'))},'originChannel':{'type':Sequelize[_0xbdc1('0xa')](_0xbdc1('0xb'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e3bdada..fbd66bb 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 _0xdd38=['rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','push','build','unlinkSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','includeAll','include','findAll','rows','show','params','rawAttributes','options','update','body','find','describe','create','direction','out','secret','split','MailAccountId','CmList','List','updatedAt','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','CmContact','List\x20not\x20found','SendMail','sendMail','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','MailInteractionId','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','agent','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','interaction','fullname','event'];(function(_0x5b089b,_0x575be6){var _0x56d66c=function(_0x438842){while(--_0x438842){_0x5b089b['push'](_0x5b089b['shift']());}};_0x56d66c(++_0x575be6);}(_0xdd38,0x14b));var _0x8dd3=function(_0x442a5d,_0x2a6745){_0x442a5d=_0x442a5d-0x0;var _0x51d134=_0xdd38[_0x442a5d];return _0x51d134;};'use strict';var emlformat=require(_0x8dd3('0x0'));var moment=require(_0x8dd3('0x1'));var BPromise=require(_0x8dd3('0x2'));var util=require(_0x8dd3('0x3'));var path=require(_0x8dd3('0x4'));var fs=require('fs');var _=require(_0x8dd3('0x5'));var Redis=require('ioredis');var htmlToText=require(_0x8dd3('0x6'));var qs=require(_0x8dd3('0x7'));var logger=require(_0x8dd3('0x8'))(_0x8dd3('0x9'));var interaction_log=require(_0x8dd3('0x8'))(_0x8dd3('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8dd3('0xb')](config['redis'],{'host':_0x8dd3('0xc'),'port':0x18eb});var socket=require(_0x8dd3('0xd'))(new Redis(config[_0x8dd3('0xe')]));var htmlEntities=require('html-entities');require(_0x8dd3('0xf'))['register'](socket);var jayson=require(_0x8dd3('0x10'));var client=jayson['client'][_0x8dd3('0x11')]({'port':0x232c});var client9003=jayson['client'][_0x8dd3('0x11')]({'port':0x232b});var client9002=jayson[_0x8dd3('0x12')][_0x8dd3('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x3a84d2,_0x579f93,_0x113787,_0x34acc5){return new BPromise(function(_0x192f08,_0x40bcc5){var _0x135165=_0x34acc5||client;return _0x135165['request'](_0x3a84d2,_0x113787)[_0x8dd3('0x13')](function(_0x1906b9){logger[_0x8dd3('0x14')](_0x8dd3('0x15'),_0x579f93,'request\x20sent');logger[_0x8dd3('0x16')](_0x8dd3('0x17'),_0x579f93,_0x8dd3('0x18'),JSON[_0x8dd3('0x19')](_0x1906b9));if(_0x1906b9[_0x8dd3('0x1a')]){if(_0x1906b9[_0x8dd3('0x1a')][_0x8dd3('0x1b')]===0x1f4){logger[_0x8dd3('0x1a')](_0x8dd3('0x15'),_0x579f93,_0x1906b9['error'][_0x8dd3('0x1c')]);return _0x40bcc5(_0x1906b9[_0x8dd3('0x1a')][_0x8dd3('0x1c')]);}logger[_0x8dd3('0x1a')]('MailMessage,\x20%s,\x20%s',_0x579f93,_0x1906b9[_0x8dd3('0x1a')]['message']);return _0x192f08(_0x1906b9[_0x8dd3('0x1a')][_0x8dd3('0x1c')]);}else{logger['info'](_0x8dd3('0x15'),_0x579f93,_0x8dd3('0x18'));_0x192f08(_0x1906b9[_0x8dd3('0x1d')][_0x8dd3('0x1c')]);}})[_0x8dd3('0x1e')](function(_0x4a6fbf){logger[_0x8dd3('0x1a')](_0x8dd3('0x15'),_0x579f93,_0x4a6fbf);_0x40bcc5(_0x4a6fbf);});});}function respondWithResult(_0xbf37d6,_0x151a1c){_0x151a1c=_0x151a1c||0xc8;return function(_0x1da3e6){if(_0x1da3e6){return _0xbf37d6['status'](_0x151a1c)[_0x8dd3('0x1f')](_0x1da3e6);}};}function respondWithFilteredResult(_0x262495,_0x54217e){return function(_0x1a0f62){if(_0x1a0f62){var _0x222491=typeof _0x54217e[_0x8dd3('0x20')]===_0x8dd3('0x21')&&typeof _0x54217e[_0x8dd3('0x22')]===_0x8dd3('0x21');var _0x55c234=_0x1a0f62[_0x8dd3('0x23')];var _0x2c6004=_0x222491?0x0:_0x54217e[_0x8dd3('0x20')];var _0x32ef34=_0x222491?_0x1a0f62[_0x8dd3('0x23')]:_0x54217e[_0x8dd3('0x20')]+_0x54217e[_0x8dd3('0x22')];var _0x1ba35c;if(_0x32ef34>=_0x55c234){_0x32ef34=_0x55c234;_0x1ba35c=0xc8;}else{_0x1ba35c=0xce;}_0x262495[_0x8dd3('0x24')](_0x1ba35c);return _0x262495[_0x8dd3('0x25')](_0x8dd3('0x26'),_0x2c6004+'-'+_0x32ef34+'/'+_0x55c234)['json'](_0x1a0f62);}return null;};}function saveUpdates(_0x5eea37){return function(_0xecf159){if(_0xecf159){return _0xecf159['update'](_0x5eea37)['then'](function(_0x31a90d){return _0x31a90d;});}return null;};}function removeEntity(_0x1e73fa){return function(_0xb91a1e){if(_0xb91a1e){return _0xb91a1e[_0x8dd3('0x27')]()[_0x8dd3('0x13')](function(){_0x1e73fa[_0x8dd3('0x24')](0xcc)[_0x8dd3('0x28')]();});}};}function handleEntityNotFound(_0x2aa3c2){return function(_0x1072df){if(!_0x1072df){_0x2aa3c2[_0x8dd3('0x29')](0x194);}return _0x1072df;};}function handleError(_0x158c55,_0x1d38f0){_0x1d38f0=_0x1d38f0||0x1f4;return function(_0x37fae3){logger[_0x8dd3('0x1a')](_0x37fae3[_0x8dd3('0x2a')]);if(_0x37fae3[_0x8dd3('0x2b')]){delete _0x37fae3[_0x8dd3('0x2b')];}_0x158c55['status'](_0x1d38f0)[_0x8dd3('0x2c')](_0x37fae3);};}exports[_0x8dd3('0x2d')]=function(_0x46c051,_0x157ace){var _0x721fd0={},_0x95ca0e={},_0x30cd61={'count':0x0,'rows':[]};var _0x332cf3=_[_0x8dd3('0x2e')](db[_0x8dd3('0x2f')]['rawAttributes'],function(_0x55ec5b){return{'name':_0x55ec5b[_0x8dd3('0x30')],'type':_0x55ec5b[_0x8dd3('0x31')]['key']};});_0x95ca0e[_0x8dd3('0x32')]=_['map'](_0x332cf3,_0x8dd3('0x2b'));_0x95ca0e[_0x8dd3('0x33')]=_[_0x8dd3('0x34')](_0x46c051[_0x8dd3('0x33')]);_0x95ca0e[_0x8dd3('0x35')]=_[_0x8dd3('0x36')](_0x95ca0e['model'],_0x95ca0e[_0x8dd3('0x33')]);_0x721fd0['attributes']=_[_0x8dd3('0x36')](_0x95ca0e[_0x8dd3('0x32')],qs[_0x8dd3('0x37')](_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x37')]));_0x721fd0[_0x8dd3('0x38')]=_0x721fd0[_0x8dd3('0x38')][_0x8dd3('0x39')]?_0x721fd0[_0x8dd3('0x38')]:_0x95ca0e['model'];if(!_0x46c051['query']['hasOwnProperty'](_0x8dd3('0x3a'))){_0x721fd0['limit']=qs[_0x8dd3('0x22')](_0x46c051['query'][_0x8dd3('0x22')]);_0x721fd0[_0x8dd3('0x20')]=qs['offset'](_0x46c051[_0x8dd3('0x33')]['offset']);}_0x721fd0[_0x8dd3('0x3b')]=qs[_0x8dd3('0x3c')](_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x3c')]);_0x721fd0[_0x8dd3('0x3d')]=qs[_0x8dd3('0x35')](_['pick'](_0x46c051[_0x8dd3('0x33')],_0x95ca0e[_0x8dd3('0x35')]),_0x332cf3);if(_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x3e')]){_0x721fd0[_0x8dd3('0x3d')]=_['merge'](_0x721fd0[_0x8dd3('0x3d')],{'$or':_['map'](_0x332cf3,function(_0x2ade2c){if(_0x2ade2c[_0x8dd3('0x31')]!=='VIRTUAL'){var _0x58e86b={};_0x58e86b[_0x2ade2c[_0x8dd3('0x2b')]]={'$like':'%'+_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x3e')]+'%'};return _0x58e86b;}})});}_0x721fd0=_['merge']({},_0x721fd0,_0x46c051['options']);var _0x57c7ef={'where':_0x721fd0[_0x8dd3('0x3d')]};return db[_0x8dd3('0x2f')][_0x8dd3('0x23')](_0x57c7ef)['then'](function(_0x3682a2){_0x30cd61[_0x8dd3('0x23')]=_0x3682a2;if(_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x3f')]){_0x721fd0[_0x8dd3('0x40')]=[{'all':!![]}];}return db[_0x8dd3('0x2f')][_0x8dd3('0x41')](_0x721fd0);})['then'](function(_0x5c13d8){_0x30cd61[_0x8dd3('0x42')]=_0x5c13d8;return _0x30cd61;})['then'](respondWithFilteredResult(_0x157ace,_0x721fd0))['catch'](handleError(_0x157ace,null));};exports[_0x8dd3('0x43')]=function(_0x3034b9,_0x17e6a4){var _0x52e3eb={'raw':!![],'where':{'id':_0x3034b9[_0x8dd3('0x44')]['id']}},_0x50e1c9={};_0x50e1c9[_0x8dd3('0x32')]=_[_0x8dd3('0x34')](db[_0x8dd3('0x2f')][_0x8dd3('0x45')]);_0x50e1c9[_0x8dd3('0x33')]=_[_0x8dd3('0x34')](_0x3034b9[_0x8dd3('0x33')]);_0x50e1c9[_0x8dd3('0x35')]=_['intersection'](_0x50e1c9[_0x8dd3('0x32')],_0x50e1c9[_0x8dd3('0x33')]);_0x52e3eb[_0x8dd3('0x38')]=_[_0x8dd3('0x36')](_0x50e1c9['model'],qs['fields'](_0x3034b9['query'][_0x8dd3('0x37')]));_0x52e3eb[_0x8dd3('0x38')]=_0x52e3eb[_0x8dd3('0x38')]['length']?_0x52e3eb[_0x8dd3('0x38')]:_0x50e1c9['model'];if(_0x3034b9[_0x8dd3('0x33')][_0x8dd3('0x3f')]){_0x52e3eb[_0x8dd3('0x40')]=[{'all':!![]}];}_0x52e3eb=_['merge']({},_0x52e3eb,_0x3034b9[_0x8dd3('0x46')]);return db[_0x8dd3('0x2f')]['find'](_0x52e3eb)[_0x8dd3('0x13')](handleEntityNotFound(_0x17e6a4,null))[_0x8dd3('0x13')](respondWithResult(_0x17e6a4,null))['catch'](handleError(_0x17e6a4,null));};exports[_0x8dd3('0x47')]=function(_0x39500d,_0x434d4f){if(_0x39500d[_0x8dd3('0x48')]['id']){delete _0x39500d[_0x8dd3('0x48')]['id'];}return db[_0x8dd3('0x2f')][_0x8dd3('0x49')]({'where':{'id':_0x39500d['params']['id']}})[_0x8dd3('0x13')](handleEntityNotFound(_0x434d4f,null))[_0x8dd3('0x13')](saveUpdates(_0x39500d[_0x8dd3('0x48')],null))['then'](respondWithResult(_0x434d4f,null))['catch'](handleError(_0x434d4f,null));};exports[_0x8dd3('0x27')]=function(_0x36d560,_0x4107f0){return db['MailMessage'][_0x8dd3('0x49')]({'where':{'id':_0x36d560[_0x8dd3('0x44')]['id']}})[_0x8dd3('0x13')](handleEntityNotFound(_0x4107f0,null))['then'](removeEntity(_0x4107f0,null))[_0x8dd3('0x1e')](handleError(_0x4107f0,null));};exports[_0x8dd3('0x4a')]=function(_0x4c0c92,_0x4a55a2){return db['MailMessage'][_0x8dd3('0x4a')]()[_0x8dd3('0x13')](respondWithResult(_0x4a55a2,null))['catch'](handleError(_0x4a55a2,null));};exports[_0x8dd3('0x4b')]=function(_0x1c01ad,_0x149e65){return db[_0x8dd3('0x2f')][_0x8dd3('0x4b')](_0x1c01ad[_0x8dd3('0x48')])[_0x8dd3('0x13')](function(_0x515650){if(_0x515650){if(_0x515650[_0x8dd3('0x4c')]===_0x8dd3('0x4d')&&!_0x515650[_0x8dd3('0x4e')]){var _0x26207d,_0x2561e7,_0x585670;if(_0x1c01ad[_0x8dd3('0x48')]['to']){_0x2561e7=_0x1c01ad[_0x8dd3('0x48')]['to'][_0x8dd3('0x4f')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x515650[_0x8dd3('0x50')]},'include':[{'model':db[_0x8dd3('0x51')],'as':_0x8dd3('0x52'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x2561e7},'limit':0x1,'order':[[_0x8dd3('0x53'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8dd3('0x54')],'as':_0x8dd3('0x54'),'raw':!![]}]}]})[_0x8dd3('0x13')](function(_0x534155){_0x26207d=_0x534155;if(!_0x26207d||!_0x26207d[_0x8dd3('0x55')])return;var _0x25248c=_0x26207d[_0x8dd3('0x56')]();if(_0x1c01ad[_0x8dd3('0x48')][_0x8dd3('0x57')]&&_0x1c01ad['body'][_0x8dd3('0x57')]['length']){for(var _0x2bd061=0x0;_0x2bd061<_0x1c01ad[_0x8dd3('0x48')][_0x8dd3('0x57')][_0x8dd3('0x39')];_0x2bd061+=0x1){_0x1c01ad['body'][_0x8dd3('0x57')][_0x2bd061]={'filename':_0x1c01ad[_0x8dd3('0x48')][_0x8dd3('0x57')][_0x2bd061][_0x8dd3('0x2b')],'path':path[_0x8dd3('0x58')](config[_0x8dd3('0x59')],_0x8dd3('0x5a'),_0x1c01ad[_0x8dd3('0x48')][_0x8dd3('0x57')][_0x2bd061][_0x8dd3('0x5b')])};}}_0x585670={'account':_0x25248c,'message':_0x1c01ad[_0x8dd3('0x48')]};return;})['then'](function(){if(_0x26207d[_0x8dd3('0x52')]){if(_0x26207d[_0x8dd3('0x52')][_0x8dd3('0x5c')][_0x8dd3('0x39')]){return _0x26207d['List'][_0x8dd3('0x5c')][0x0];}else{return db[_0x8dd3('0x5d')][_0x8dd3('0x4b')](_[_0x8dd3('0xb')](_0x1c01ad[_0x8dd3('0x48')],{'firstName':_0x1c01ad[_0x8dd3('0x48')]['to'],'email':_0x1c01ad[_0x8dd3('0x48')]['to'],'phone':_0x1c01ad['body']['to'],'ListId':_0x26207d['ListId']}));}}else{throw new Error(_0x8dd3('0x5e'));}})[_0x8dd3('0x13')](function(){if(_0x585670){return respondWithRpcPromise(_0x8dd3('0x5f'),_0x8dd3('0x60'),_0x585670,client9003)['then'](function(_0x57be28){return _0x515650[_0x8dd3('0x47')]({'read':!![],'messageId':_0x57be28['messageId'],'sentAt':moment()[_0x8dd3('0x61')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x8dd3('0x1e')](function(_0x3b35f2){logger['error']('%s',JSON['stringify'](_0x3b35f2));return _0x515650;});}return _0x515650;});}return _0x515650;}})[_0x8dd3('0x13')](respondWithResult(_0x149e65,0xc9))[_0x8dd3('0x1e')](handleError(_0x149e65,null));};exports[_0x8dd3('0x62')]=function(_0x64a837,_0x4a3fc2){var _0x25fced={'agent':{},'channel':_0x8dd3('0x63')};if(_0x64a837[_0x8dd3('0x48')]['id']){delete _0x64a837['body']['id'];}_0x64a837[_0x8dd3('0x48')][_0x8dd3('0x64')]=!![];_0x64a837[_0x8dd3('0x48')][_0x8dd3('0x65')]=moment()[_0x8dd3('0x61')](_0x8dd3('0x66'));_0x64a837[_0x8dd3('0x48')]['UserId']=_0x64a837['body'][_0x8dd3('0x67')]||_0x64a837['user']['id'];_0x25fced['agent']['id']=_0x64a837[_0x8dd3('0x48')]['UserId'];return db[_0x8dd3('0x2f')][_0x8dd3('0x49')]({'where':{'id':_0x64a837[_0x8dd3('0x44')]['id'],'UserId':null}})[_0x8dd3('0x13')](handleEntityNotFound(_0x4a3fc2,null))['then'](saveUpdates(_0x64a837[_0x8dd3('0x48')],null))['then'](function(_0x38f3af){if(_0x38f3af){_0x25fced[_0x8dd3('0x1c')]=_0x38f3af[_0x8dd3('0x68')]({'plain':!![]});return db[_0x8dd3('0x69')]['find']({'where':{'id':_0x38f3af[_0x8dd3('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x4a3fc2,null))[_0x8dd3('0x13')](function(_0x1a98c3){if(_0x1a98c3){return _0x1a98c3[_0x8dd3('0x47')]({'UserId':_0x64a837[_0x8dd3('0x48')]['UserId'],'read1stAt':_[_0x8dd3('0x6b')](_0x1a98c3['read1stAt'])?moment()[_0x8dd3('0x61')](_0x8dd3('0x66')):undefined});}return null;})[_0x8dd3('0x13')](function(_0x567841){if(_0x567841){_0x25fced['interaction']=_0x567841[_0x8dd3('0x68')]({'plain':!![]});interaction_log['info'](_0x8dd3('0x6c'),_0x64a837[_0x8dd3('0x6d')]['id'],_0x64a837['user'][_0x8dd3('0x2b')],_0x64a837['user'][_0x8dd3('0x6e')],_0x25fced['interaction']['id'],_0x64a837[_0x8dd3('0x48')]?JSON[_0x8dd3('0x19')](_0x64a837[_0x8dd3('0x48')]):_0x8dd3('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x8dd3('0x70'),_0x25fced);}return null;})[_0x8dd3('0x13')](function(_0x1241a7){var _0xfb9be4=_0x8dd3('0x71')+_0x1241a7[_0x8dd3('0x1c')][_0x8dd3('0x72')];return db[_0x8dd3('0x73')][_0x8dd3('0x33')](_0xfb9be4,{'type':db[_0x8dd3('0x74')][_0x8dd3('0x75')][_0x8dd3('0x76')],'raw':!![]})[_0x8dd3('0x13')](function(_0x4d26c9){return _0x4d26c9;});})[_0x8dd3('0x13')](function(_0x4a10b8){if(_0x4a10b8){_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x77')]=_0x4a10b8[0x0];if(!_0x64a837[_0x8dd3('0x48')][_0x8dd3('0x67')])return;return db[_0x8dd3('0x78')][_0x8dd3('0x49')]({'where':{'id':_0x64a837['body'][_0x8dd3('0x67')],'role':'agent'},'attributes':['id','name','fullname',_0x8dd3('0x79'),_0x8dd3('0x7a')],'raw':!![]});}return null;})[_0x8dd3('0x13')](function(_0x2de897){if(!_0x2de897)return null;_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x7b')]=_0x2de897;return _0x25fced;})[_0x8dd3('0x13')](function(_0x37bb74){if(_0x37bb74){if(_0x64a837[_0x8dd3('0x48')]['manual']){_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x7c')]=util['format'](_0x8dd3('0x7d'),_0x64a837[_0x8dd3('0x6d')][_0x8dd3('0x2b')]);_0x25fced['message'][_0x8dd3('0x7e')]=_0x25fced['channel'];_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x7f')]=_0x25fced[_0x8dd3('0x7e')];_0x25fced[_0x8dd3('0x1c')]['event']=_0x8dd3('0x62');_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x48')]=htmlToText['fromString'](_0x25fced['message'][_0x8dd3('0x48')]);return respondWithRpcPromise(_0x8dd3('0x80'),_0x8dd3('0x80'),{'event':_0x8dd3('0x81'),'message':_0x25fced['message']},client9002)['then'](function(){return _0x25fced;});}return _0x25fced;}return null;})[_0x8dd3('0x13')](respondWithResult(_0x4a3fc2,null))['catch'](handleError(_0x4a3fc2,null));};exports[_0x8dd3('0x82')]=function(_0xe13262,_0x2acaa0){var _0x1794c6={'agent':{},'channel':'mail'};if(_0xe13262[_0x8dd3('0x48')]['id']){delete _0xe13262[_0x8dd3('0x48')]['id'];}_0xe13262[_0x8dd3('0x48')]['UserId']=_0xe13262[_0x8dd3('0x48')][_0x8dd3('0x67')]||_0xe13262['user']['id'];_0x1794c6['agent']['id']=_0xe13262[_0x8dd3('0x48')][_0x8dd3('0x67')];return db[_0x8dd3('0x2f')][_0x8dd3('0x49')]({'where':{'id':_0xe13262['params']['id'],'UserId':null}})[_0x8dd3('0x13')](handleEntityNotFound(_0x2acaa0,null))[_0x8dd3('0x13')](function(_0x570eaa){if(_0x570eaa){_0x1794c6[_0x8dd3('0x1c')]=_0x570eaa[_0x8dd3('0x68')]({'plain':!![]});return db[_0x8dd3('0x69')][_0x8dd3('0x49')]({'where':{'id':_0x570eaa['MailInteractionId']}});}return null;})[_0x8dd3('0x13')](handleEntityNotFound(_0x2acaa0,null))[_0x8dd3('0x13')](function(_0x3da548){if(_0x3da548){_0x1794c6[_0x8dd3('0x83')]=_0x3da548['get']({'plain':!![]});interaction_log[_0x8dd3('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe13262[_0x8dd3('0x6d')]['id'],_0xe13262[_0x8dd3('0x6d')][_0x8dd3('0x2b')],_0xe13262[_0x8dd3('0x6d')][_0x8dd3('0x6e')],_0x1794c6[_0x8dd3('0x83')]['id'],_0xe13262['body']?JSON[_0x8dd3('0x19')](_0xe13262[_0x8dd3('0x48')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1794c6);}return null;})[_0x8dd3('0x13')](function(_0x2fa5e7){var _0x2e773=_0x8dd3('0x71')+_0x2fa5e7['message'][_0x8dd3('0x72')];return db['sequelize']['query'](_0x2e773,{'type':db[_0x8dd3('0x74')][_0x8dd3('0x75')]['SELECT'],'raw':!![]})['then'](function(_0x2add34){return _0x2add34;});})[_0x8dd3('0x13')](function(_0x5507d1){if(_0x5507d1){_0x1794c6[_0x8dd3('0x1c')]['contact']=_0x5507d1[0x0];if(!_0xe13262['body'][_0x8dd3('0x67')])return;return db[_0x8dd3('0x78')]['find']({'where':{'id':_0xe13262[_0x8dd3('0x48')][_0x8dd3('0x67')],'role':_0x8dd3('0x7b')},'attributes':['id',_0x8dd3('0x2b'),_0x8dd3('0x84'),_0x8dd3('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2cf271){if(!_0x2cf271)return null;_0x1794c6['message']['agent']=_0x2cf271;return _0x1794c6;})[_0x8dd3('0x13')](function(_0x1a770a){if(_0x1a770a){_0x1a770a[_0x8dd3('0x1c')][_0x8dd3('0x7c')]=util['format']('SIP/%s',_0xe13262[_0x8dd3('0x6d')][_0x8dd3('0x2b')]);_0x1a770a[_0x8dd3('0x1c')][_0x8dd3('0x7e')]=_0x1794c6['channel'];_0x1a770a[_0x8dd3('0x1c')][_0x8dd3('0x7f')]=_0x1794c6[_0x8dd3('0x7e')];_0x1a770a[_0x8dd3('0x1c')][_0x8dd3('0x85')]=_0x8dd3('0x82');_0x1a770a['message'][_0x8dd3('0x48')]=htmlToText['fromString'](_0x1794c6['message']['body']);respondWithRpcPromise('EventManager',_0x8dd3('0x80'),{'event':_0x8dd3('0x86'),'message':_0x1a770a['message']},client9002);return _0x1794c6;}return null;})['then'](respondWithResult(_0x2acaa0,null))['catch'](handleError(_0x2acaa0,null));};exports[_0x8dd3('0x87')]=function(_0x5d63d0,_0x16c954){var _0x1757ce=moment()[_0x8dd3('0x88')]()[_0x8dd3('0x89')]();var _0x709e19=path[_0x8dd3('0x58')](config[_0x8dd3('0x59')],_0x8dd3('0x8a'),_0x8dd3('0x8b'),_0x8dd3('0x8c'));var _0x17cc10=path[_0x8dd3('0x58')](config['root'],'server',_0x8dd3('0x8b'),_0x8dd3('0x57'));var _0x461cec=util['format'](_0x8dd3('0x8d'),_0x1757ce);return db[_0x8dd3('0x2f')][_0x8dd3('0x49')]({'where':{'id':_0x5d63d0[_0x8dd3('0x44')]['id']},'attributes':['id',_0x8dd3('0x48'),_0x8dd3('0x8e'),'to','cc','bcc',_0x8dd3('0x8f'),_0x8dd3('0x90')],'include':_0x5d63d0['query']['attachments']?[{'model':db[_0x8dd3('0x91')],'as':_0x8dd3('0x92')}]:undefined})[_0x8dd3('0x13')](handleEntityNotFound(_0x16c954,null))[_0x8dd3('0x13')](function(_0x32c2d4){if(_0x32c2d4){var _0x2260af=_0x32c2d4;var _0x4be074={'from':_0x2260af[_0x8dd3('0x8e')],'to':_0x2260af['to'],'subject':_0x2260af[_0x8dd3('0x8f')],'html':htmlEntities[_0x8dd3('0x93')](_0x2260af['body']),'headers':{'Date':moment(_0x2260af[_0x8dd3('0x90')])[_0x8dd3('0x61')](_0x8dd3('0x94'))},'attachments':[]};if(_0x32c2d4['cc']){_0x4be074[_0x8dd3('0x95')]['Cc']=_0x32c2d4['cc'];}if(_0x32c2d4[_0x8dd3('0x96')]){_0x4be074[_0x8dd3('0x95')][_0x8dd3('0x97')]=_0x32c2d4[_0x8dd3('0x96')];}return new BPromise(function(_0x805227,_0x3bd858){if(_0x32c2d4[_0x8dd3('0x92')]){for(var _0xfced46=0x0;_0xfced46<_0x32c2d4['Attachments'][_0x8dd3('0x39')];_0xfced46++){var _0x26ee54=_0x32c2d4['Attachments'][_0xfced46];var _0x2b6f0f=path['join'](_0x17cc10,_0x26ee54['basename']);if(fs['existsSync'](_0x2b6f0f)){_0x4be074['attachments'][_0x8dd3('0x98')]({'name':_0x26ee54['name'],'contentType':_0x26ee54[_0x8dd3('0x31')],'data':fs['readFileSync'](_0x2b6f0f)});}}}emlformat[_0x8dd3('0x99')](_0x4be074,function(_0x10283f,_0x1885d8){if(_0x10283f)return _0x3bd858(_0x10283f);fs['writeFileSync'](path['join'](_0x709e19,_0x461cec),_0x1885d8);return _0x805227(_0x1885d8);});});}})[_0x8dd3('0x13')](function(_0x51a00a){if(_0x51a00a){return _0x16c954['download'](path[_0x8dd3('0x58')](_0x709e19,_0x461cec),_0x461cec,function(_0x54dd74){if(!_0x54dd74)fs[_0x8dd3('0x9a')](path[_0x8dd3('0x58')](_0x709e19,_0x461cec));});}})[_0x8dd3('0x1e')](handleError(_0x16c954,null));}; \ No newline at end of file +var _0x5302=['info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','json','offset','undefined','limit','count','Content-Range','destroy','status','end','sendStatus','name','send','index','MailMessage','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','length','body','find','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','CmContact','sendMail','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','rejectmessage','download','unix','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','bluebird','util','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then'];(function(_0x309448,_0x5e1674){var _0x30e792=function(_0x58251d){while(--_0x58251d){_0x309448['push'](_0x309448['shift']());}};_0x30e792(++_0x5e1674);}(_0x5302,0x8c));var _0x2530=function(_0x582f8b,_0x27e0d6){_0x582f8b=_0x582f8b-0x0;var _0x46cfcc=_0x5302[_0x582f8b];return _0x46cfcc;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x2530('0x0'));var util=require(_0x2530('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x2530('0x2'));var Redis=require('ioredis');var htmlToText=require(_0x2530('0x3'));var qs=require(_0x2530('0x4'));var logger=require(_0x2530('0x5'))(_0x2530('0x6'));var interaction_log=require(_0x2530('0x5'))(_0x2530('0x7'));var config=require('../../config/environment');var db=require(_0x2530('0x8'))['db'];config[_0x2530('0x9')]=_['defaults'](config[_0x2530('0x9')],{'host':_0x2530('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2530('0x9')]));var htmlEntities=require(_0x2530('0xb'));require(_0x2530('0xc'))['register'](socket);var jayson=require(_0x2530('0xd'));var client=jayson[_0x2530('0xe')][_0x2530('0xf')]({'port':0x232c});var client9003=jayson[_0x2530('0xe')][_0x2530('0xf')]({'port':0x232b});var client9002=jayson[_0x2530('0xe')][_0x2530('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x1c3b14,_0x53bd86,_0x33eeb9,_0x496fd2){return new BPromise(function(_0x1984c1,_0x17e1d2){var _0x539d70=_0x496fd2||client;return _0x539d70[_0x2530('0x10')](_0x1c3b14,_0x33eeb9)[_0x2530('0x11')](function(_0x2b2645){logger[_0x2530('0x12')](_0x2530('0x13'),_0x53bd86,_0x2530('0x14'));logger[_0x2530('0x15')](_0x2530('0x16'),_0x53bd86,_0x2530('0x14'),JSON[_0x2530('0x17')](_0x2b2645));if(_0x2b2645['error']){if(_0x2b2645['error'][_0x2530('0x18')]===0x1f4){logger[_0x2530('0x19')](_0x2530('0x13'),_0x53bd86,_0x2b2645[_0x2530('0x19')][_0x2530('0x1a')]);return _0x17e1d2(_0x2b2645[_0x2530('0x19')]['message']);}logger[_0x2530('0x19')](_0x2530('0x13'),_0x53bd86,_0x2b2645[_0x2530('0x19')][_0x2530('0x1a')]);return _0x1984c1(_0x2b2645[_0x2530('0x19')][_0x2530('0x1a')]);}else{logger[_0x2530('0x12')](_0x2530('0x13'),_0x53bd86,_0x2530('0x14'));_0x1984c1(_0x2b2645[_0x2530('0x1b')][_0x2530('0x1a')]);}})[_0x2530('0x1c')](function(_0x3b6da2){logger[_0x2530('0x19')]('MailMessage,\x20%s,\x20%s',_0x53bd86,_0x3b6da2);_0x17e1d2(_0x3b6da2);});});}function respondWithResult(_0x2ec0f8,_0x117ca2){_0x117ca2=_0x117ca2||0xc8;return function(_0x115676){if(_0x115676){return _0x2ec0f8['status'](_0x117ca2)[_0x2530('0x1d')](_0x115676);}};}function respondWithFilteredResult(_0xb81e71,_0x28340e){return function(_0x483237){if(_0x483237){var _0x44f068=typeof _0x28340e[_0x2530('0x1e')]===_0x2530('0x1f')&&typeof _0x28340e[_0x2530('0x20')]===_0x2530('0x1f');var _0x31d81c=_0x483237[_0x2530('0x21')];var _0x3f2452=_0x44f068?0x0:_0x28340e[_0x2530('0x1e')];var _0x1b91c5=_0x44f068?_0x483237[_0x2530('0x21')]:_0x28340e[_0x2530('0x1e')]+_0x28340e['limit'];var _0x20e4b1;if(_0x1b91c5>=_0x31d81c){_0x1b91c5=_0x31d81c;_0x20e4b1=0xc8;}else{_0x20e4b1=0xce;}_0xb81e71['status'](_0x20e4b1);return _0xb81e71['set'](_0x2530('0x22'),_0x3f2452+'-'+_0x1b91c5+'/'+_0x31d81c)[_0x2530('0x1d')](_0x483237);}return null;};}function saveUpdates(_0x5b3742){return function(_0xd8e552){if(_0xd8e552){return _0xd8e552['update'](_0x5b3742)[_0x2530('0x11')](function(_0x13bb18){return _0x13bb18;});}return null;};}function removeEntity(_0xc2a138){return function(_0x395679){if(_0x395679){return _0x395679[_0x2530('0x23')]()[_0x2530('0x11')](function(){_0xc2a138[_0x2530('0x24')](0xcc)[_0x2530('0x25')]();});}};}function handleEntityNotFound(_0x30c41c){return function(_0x24912c){if(!_0x24912c){_0x30c41c[_0x2530('0x26')](0x194);}return _0x24912c;};}function handleError(_0x290200,_0x5a4d3c){_0x5a4d3c=_0x5a4d3c||0x1f4;return function(_0x35b8a2){logger['error'](_0x35b8a2['stack']);if(_0x35b8a2[_0x2530('0x27')]){delete _0x35b8a2[_0x2530('0x27')];}_0x290200['status'](_0x5a4d3c)[_0x2530('0x28')](_0x35b8a2);};}exports[_0x2530('0x29')]=function(_0xe15b10,_0x5d1538){var _0xd4fdf8={},_0x49832c={},_0x479a8b={'count':0x0,'rows':[]};var _0x596a80=_['map'](db[_0x2530('0x2a')][_0x2530('0x2b')],function(_0x48c677){return{'name':_0x48c677[_0x2530('0x2c')],'type':_0x48c677[_0x2530('0x2d')]['key']};});_0x49832c[_0x2530('0x2e')]=_['map'](_0x596a80,_0x2530('0x27'));_0x49832c[_0x2530('0x2f')]=_[_0x2530('0x30')](_0xe15b10[_0x2530('0x2f')]);_0x49832c['filters']=_['intersection'](_0x49832c[_0x2530('0x2e')],_0x49832c[_0x2530('0x2f')]);_0xd4fdf8[_0x2530('0x31')]=_[_0x2530('0x32')](_0x49832c[_0x2530('0x2e')],qs['fields'](_0xe15b10[_0x2530('0x2f')][_0x2530('0x33')]));_0xd4fdf8[_0x2530('0x31')]=_0xd4fdf8['attributes']['length']?_0xd4fdf8[_0x2530('0x31')]:_0x49832c[_0x2530('0x2e')];if(!_0xe15b10[_0x2530('0x2f')][_0x2530('0x34')](_0x2530('0x35'))){_0xd4fdf8[_0x2530('0x20')]=qs[_0x2530('0x20')](_0xe15b10[_0x2530('0x2f')][_0x2530('0x20')]);_0xd4fdf8['offset']=qs[_0x2530('0x1e')](_0xe15b10[_0x2530('0x2f')]['offset']);}_0xd4fdf8[_0x2530('0x36')]=qs[_0x2530('0x37')](_0xe15b10[_0x2530('0x2f')][_0x2530('0x37')]);_0xd4fdf8['where']=qs[_0x2530('0x38')](_[_0x2530('0x39')](_0xe15b10[_0x2530('0x2f')],_0x49832c[_0x2530('0x38')]),_0x596a80);if(_0xe15b10[_0x2530('0x2f')][_0x2530('0x3a')]){_0xd4fdf8['where']=_['merge'](_0xd4fdf8[_0x2530('0x3b')],{'$or':_['map'](_0x596a80,function(_0x1890b9){if(_0x1890b9[_0x2530('0x2d')]!==_0x2530('0x3c')){var _0x319c64={};_0x319c64[_0x1890b9[_0x2530('0x27')]]={'$like':'%'+_0xe15b10[_0x2530('0x2f')][_0x2530('0x3a')]+'%'};return _0x319c64;}})});}_0xd4fdf8=_[_0x2530('0x3d')]({},_0xd4fdf8,_0xe15b10[_0x2530('0x3e')]);var _0xbfc6c3={'where':_0xd4fdf8[_0x2530('0x3b')]};return db[_0x2530('0x2a')][_0x2530('0x21')](_0xbfc6c3)[_0x2530('0x11')](function(_0x4e4372){_0x479a8b[_0x2530('0x21')]=_0x4e4372;if(_0xe15b10[_0x2530('0x2f')][_0x2530('0x3f')]){_0xd4fdf8[_0x2530('0x40')]=[{'all':!![]}];}return db['MailMessage'][_0x2530('0x41')](_0xd4fdf8);})['then'](function(_0x3ccc55){_0x479a8b[_0x2530('0x42')]=_0x3ccc55;return _0x479a8b;})[_0x2530('0x11')](respondWithFilteredResult(_0x5d1538,_0xd4fdf8))[_0x2530('0x1c')](handleError(_0x5d1538,null));};exports['show']=function(_0x4d8e10,_0xc06afb){var _0x4d04e2={'raw':!![],'where':{'id':_0x4d8e10[_0x2530('0x43')]['id']}},_0x44c0d0={};_0x44c0d0[_0x2530('0x2e')]=_[_0x2530('0x30')](db[_0x2530('0x2a')][_0x2530('0x2b')]);_0x44c0d0[_0x2530('0x2f')]=_[_0x2530('0x30')](_0x4d8e10[_0x2530('0x2f')]);_0x44c0d0[_0x2530('0x38')]=_[_0x2530('0x32')](_0x44c0d0[_0x2530('0x2e')],_0x44c0d0[_0x2530('0x2f')]);_0x4d04e2[_0x2530('0x31')]=_[_0x2530('0x32')](_0x44c0d0['model'],qs[_0x2530('0x33')](_0x4d8e10[_0x2530('0x2f')][_0x2530('0x33')]));_0x4d04e2[_0x2530('0x31')]=_0x4d04e2['attributes'][_0x2530('0x44')]?_0x4d04e2[_0x2530('0x31')]:_0x44c0d0[_0x2530('0x2e')];if(_0x4d8e10['query'][_0x2530('0x3f')]){_0x4d04e2[_0x2530('0x40')]=[{'all':!![]}];}_0x4d04e2=_[_0x2530('0x3d')]({},_0x4d04e2,_0x4d8e10[_0x2530('0x3e')]);return db[_0x2530('0x2a')]['find'](_0x4d04e2)['then'](handleEntityNotFound(_0xc06afb,null))[_0x2530('0x11')](respondWithResult(_0xc06afb,null))['catch'](handleError(_0xc06afb,null));};exports['update']=function(_0x270015,_0x76df75){if(_0x270015['body']['id']){delete _0x270015[_0x2530('0x45')]['id'];}return db['MailMessage'][_0x2530('0x46')]({'where':{'id':_0x270015[_0x2530('0x43')]['id']}})[_0x2530('0x11')](handleEntityNotFound(_0x76df75,null))[_0x2530('0x11')](saveUpdates(_0x270015[_0x2530('0x45')],null))[_0x2530('0x11')](respondWithResult(_0x76df75,null))[_0x2530('0x1c')](handleError(_0x76df75,null));};exports[_0x2530('0x23')]=function(_0x3ed171,_0x2f14e8){return db[_0x2530('0x2a')][_0x2530('0x46')]({'where':{'id':_0x3ed171['params']['id']}})[_0x2530('0x11')](handleEntityNotFound(_0x2f14e8,null))['then'](removeEntity(_0x2f14e8,null))[_0x2530('0x1c')](handleError(_0x2f14e8,null));};exports[_0x2530('0x47')]=function(_0x324c96,_0x521901){return db['MailMessage'][_0x2530('0x47')]()['then'](respondWithResult(_0x521901,null))[_0x2530('0x1c')](handleError(_0x521901,null));};exports[_0x2530('0x48')]=function(_0x4ebc44,_0x278efe){return db[_0x2530('0x2a')][_0x2530('0x48')](_0x4ebc44['body'])[_0x2530('0x11')](function(_0x360c53){if(_0x360c53){if(_0x360c53[_0x2530('0x49')]===_0x2530('0x4a')&&!_0x360c53[_0x2530('0x4b')]){var _0x52d8c8,_0x25994e,_0x4b3b7c;if(_0x4ebc44[_0x2530('0x45')]['to']){_0x25994e=_0x4ebc44[_0x2530('0x45')]['to'][_0x2530('0x4c')](',')[0x0];}return db[_0x2530('0x4d')][_0x2530('0x4e')]({'where':{'id':_0x360c53[_0x2530('0x4f')]},'include':[{'model':db[_0x2530('0x50')],'as':_0x2530('0x51'),'include':[{'model':db['CmContact'],'as':_0x2530('0x52'),'where':{'email':_0x25994e},'limit':0x1,'order':[['updatedAt',_0x2530('0x53')]]}]},{'model':db[_0x2530('0x54')],'as':_0x2530('0x55'),'raw':!![],'include':[{'model':db[_0x2530('0x56')],'as':_0x2530('0x56'),'raw':!![]}]}]})[_0x2530('0x11')](function(_0x14e59b){_0x52d8c8=_0x14e59b;if(!_0x52d8c8||!_0x52d8c8[_0x2530('0x55')])return;var _0x2b4ed3=_0x52d8c8[_0x2530('0x57')]();if(_0x4ebc44[_0x2530('0x45')][_0x2530('0x58')]&&_0x4ebc44[_0x2530('0x45')][_0x2530('0x58')][_0x2530('0x44')]){for(var _0x5ec3d4=0x0;_0x5ec3d4<_0x4ebc44['body'][_0x2530('0x58')]['length'];_0x5ec3d4+=0x1){_0x4ebc44[_0x2530('0x45')][_0x2530('0x58')][_0x5ec3d4]={'filename':_0x4ebc44[_0x2530('0x45')][_0x2530('0x58')][_0x5ec3d4][_0x2530('0x27')],'path':path[_0x2530('0x59')](config[_0x2530('0x5a')],'server/files/attachments',_0x4ebc44[_0x2530('0x45')][_0x2530('0x58')][_0x5ec3d4][_0x2530('0x5b')])};}}_0x4b3b7c={'account':_0x2b4ed3,'message':_0x4ebc44['body']};return;})[_0x2530('0x11')](function(){if(_0x52d8c8['List']){if(_0x52d8c8[_0x2530('0x51')]['Contacts'][_0x2530('0x44')]){return _0x52d8c8[_0x2530('0x51')][_0x2530('0x52')][0x0];}else{return db[_0x2530('0x5c')][_0x2530('0x48')](_['defaults'](_0x4ebc44[_0x2530('0x45')],{'firstName':_0x4ebc44[_0x2530('0x45')]['to'],'email':_0x4ebc44['body']['to'],'phone':_0x4ebc44[_0x2530('0x45')]['to'],'ListId':_0x52d8c8['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x2530('0x11')](function(){if(_0x4b3b7c){return respondWithRpcPromise('SendMail',_0x2530('0x5d'),_0x4b3b7c,client9003)[_0x2530('0x11')](function(_0x5997aa){return _0x360c53[_0x2530('0x5e')]({'read':!![],'messageId':_0x5997aa[_0x2530('0x5f')],'sentAt':moment()[_0x2530('0x60')](_0x2530('0x61'))});})[_0x2530('0x1c')](function(_0x53131b){logger[_0x2530('0x19')]('%s',JSON[_0x2530('0x17')](_0x53131b));return _0x360c53;});}return _0x360c53;});}return _0x360c53;}})[_0x2530('0x11')](respondWithResult(_0x278efe,0xc9))[_0x2530('0x1c')](handleError(_0x278efe,null));};exports[_0x2530('0x62')]=function(_0x3d82ec,_0x289396){var _0x343b95={'agent':{},'channel':_0x2530('0x63')};if(_0x3d82ec[_0x2530('0x45')]['id']){delete _0x3d82ec[_0x2530('0x45')]['id'];}_0x3d82ec[_0x2530('0x45')]['read']=!![];_0x3d82ec['body'][_0x2530('0x64')]=moment()[_0x2530('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d82ec[_0x2530('0x45')][_0x2530('0x65')]=_0x3d82ec[_0x2530('0x45')]['UserId']||_0x3d82ec[_0x2530('0x66')]['id'];_0x343b95[_0x2530('0x67')]['id']=_0x3d82ec[_0x2530('0x45')][_0x2530('0x65')];return db[_0x2530('0x2a')][_0x2530('0x46')]({'where':{'id':_0x3d82ec[_0x2530('0x43')]['id'],'UserId':null}})[_0x2530('0x11')](handleEntityNotFound(_0x289396,null))[_0x2530('0x11')](saveUpdates(_0x3d82ec['body'],null))[_0x2530('0x11')](function(_0x3c9cd7){if(_0x3c9cd7){_0x343b95[_0x2530('0x1a')]=_0x3c9cd7[_0x2530('0x68')]({'plain':!![]});return db[_0x2530('0x69')][_0x2530('0x46')]({'where':{'id':_0x3c9cd7[_0x2530('0x6a')]}});}return null;})[_0x2530('0x11')](handleEntityNotFound(_0x289396,null))['then'](function(_0x248f46){if(_0x248f46){return _0x248f46[_0x2530('0x5e')]({'UserId':_0x3d82ec['body'][_0x2530('0x65')],'read1stAt':_[_0x2530('0x6b')](_0x248f46['read1stAt'])?moment()[_0x2530('0x60')](_0x2530('0x61')):undefined});}return null;})[_0x2530('0x11')](function(_0x4ec6c2){if(_0x4ec6c2){_0x343b95[_0x2530('0x6c')]=_0x4ec6c2[_0x2530('0x68')]({'plain':!![]});interaction_log['info'](_0x2530('0x6d'),_0x3d82ec['user']['id'],_0x3d82ec[_0x2530('0x66')][_0x2530('0x27')],_0x3d82ec[_0x2530('0x66')][_0x2530('0x6e')],_0x343b95[_0x2530('0x6c')]['id'],_0x3d82ec['body']?JSON['stringify'](_0x3d82ec[_0x2530('0x45')]):_0x2530('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x2530('0x70'),_0x343b95);}return null;})[_0x2530('0x11')](function(_0x50e134){var _0x1c638d=_0x2530('0x71')+_0x50e134['message'][_0x2530('0x72')];return db['sequelize'][_0x2530('0x2f')](_0x1c638d,{'type':db[_0x2530('0x73')][_0x2530('0x74')][_0x2530('0x75')],'raw':!![]})[_0x2530('0x11')](function(_0x1933d5){return _0x1933d5;});})[_0x2530('0x11')](function(_0x2a1ab7){if(_0x2a1ab7){_0x343b95[_0x2530('0x1a')][_0x2530('0x76')]=_0x2a1ab7[0x0];if(!_0x3d82ec[_0x2530('0x45')][_0x2530('0x65')])return;return db[_0x2530('0x77')]['find']({'where':{'id':_0x3d82ec[_0x2530('0x45')]['UserId'],'role':'agent'},'attributes':['id',_0x2530('0x27'),_0x2530('0x78'),_0x2530('0x79'),_0x2530('0x7a')],'raw':!![]});}return null;})[_0x2530('0x11')](function(_0x150f4f){if(!_0x150f4f)return null;_0x343b95[_0x2530('0x1a')][_0x2530('0x67')]=_0x150f4f;return _0x343b95;})[_0x2530('0x11')](function(_0x4cb406){if(_0x4cb406){if(_0x3d82ec[_0x2530('0x45')][_0x2530('0x7b')]){_0x343b95[_0x2530('0x1a')][_0x2530('0x7c')]=util[_0x2530('0x60')](_0x2530('0x7d'),_0x3d82ec[_0x2530('0x66')][_0x2530('0x27')]);_0x343b95[_0x2530('0x1a')]['channel']=_0x343b95[_0x2530('0x7e')];_0x343b95[_0x2530('0x1a')][_0x2530('0x7f')]=_0x343b95[_0x2530('0x7e')];_0x343b95[_0x2530('0x1a')][_0x2530('0x80')]=_0x2530('0x62');_0x343b95[_0x2530('0x1a')][_0x2530('0x45')]=htmlToText[_0x2530('0x81')](_0x343b95[_0x2530('0x1a')][_0x2530('0x45')]);return respondWithRpcPromise(_0x2530('0x82'),'EventManager',{'event':'acceptmessage','message':_0x343b95[_0x2530('0x1a')]},client9002)['then'](function(){return _0x343b95;});}return _0x343b95;}return null;})[_0x2530('0x11')](respondWithResult(_0x289396,null))[_0x2530('0x1c')](handleError(_0x289396,null));};exports[_0x2530('0x83')]=function(_0x207cf7,_0x51f139){var _0x1903c8={'agent':{},'channel':'mail'};if(_0x207cf7[_0x2530('0x45')]['id']){delete _0x207cf7[_0x2530('0x45')]['id'];}_0x207cf7[_0x2530('0x45')][_0x2530('0x65')]=_0x207cf7['body'][_0x2530('0x65')]||_0x207cf7[_0x2530('0x66')]['id'];_0x1903c8[_0x2530('0x67')]['id']=_0x207cf7[_0x2530('0x45')][_0x2530('0x65')];return db[_0x2530('0x2a')][_0x2530('0x46')]({'where':{'id':_0x207cf7[_0x2530('0x43')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x51f139,null))[_0x2530('0x11')](function(_0x1e85ac){if(_0x1e85ac){_0x1903c8[_0x2530('0x1a')]=_0x1e85ac[_0x2530('0x68')]({'plain':!![]});return db[_0x2530('0x69')]['find']({'where':{'id':_0x1e85ac[_0x2530('0x6a')]}});}return null;})[_0x2530('0x11')](handleEntityNotFound(_0x51f139,null))['then'](function(_0x3cbf2f){if(_0x3cbf2f){_0x1903c8[_0x2530('0x6c')]=_0x3cbf2f[_0x2530('0x68')]({'plain':!![]});interaction_log[_0x2530('0x12')](_0x2530('0x84'),_0x207cf7[_0x2530('0x66')]['id'],_0x207cf7[_0x2530('0x66')]['name'],_0x207cf7['user'][_0x2530('0x6e')],_0x1903c8[_0x2530('0x6c')]['id'],_0x207cf7[_0x2530('0x45')]?JSON['stringify'](_0x207cf7[_0x2530('0x45')]):'null');return respondWithRpcPromise(_0x2530('0x85'),_0x2530('0x86'),_0x1903c8);}return null;})['then'](function(_0x20fa35){var _0x1eb7aa=_0x2530('0x71')+_0x20fa35[_0x2530('0x1a')][_0x2530('0x72')];return db[_0x2530('0x87')][_0x2530('0x2f')](_0x1eb7aa,{'type':db[_0x2530('0x73')][_0x2530('0x74')][_0x2530('0x75')],'raw':!![]})[_0x2530('0x11')](function(_0x169f14){return _0x169f14;});})[_0x2530('0x11')](function(_0x9303a4){if(_0x9303a4){_0x1903c8[_0x2530('0x1a')][_0x2530('0x76')]=_0x9303a4[0x0];if(!_0x207cf7[_0x2530('0x45')][_0x2530('0x65')])return;return db['User'][_0x2530('0x46')]({'where':{'id':_0x207cf7[_0x2530('0x45')][_0x2530('0x65')],'role':'agent'},'attributes':['id',_0x2530('0x27'),'fullname','email',_0x2530('0x7a')],'raw':!![]});}return null;})[_0x2530('0x11')](function(_0x1fd09e){if(!_0x1fd09e)return null;_0x1903c8[_0x2530('0x1a')][_0x2530('0x67')]=_0x1fd09e;return _0x1903c8;})[_0x2530('0x11')](function(_0xfc6892){if(_0xfc6892){_0xfc6892['message'][_0x2530('0x7c')]=util['format']('SIP/%s',_0x207cf7[_0x2530('0x66')][_0x2530('0x27')]);_0xfc6892[_0x2530('0x1a')][_0x2530('0x7e')]=_0x1903c8['channel'];_0xfc6892[_0x2530('0x1a')]['motionChannel']=_0x1903c8['channel'];_0xfc6892['message'][_0x2530('0x80')]=_0x2530('0x83');_0xfc6892['message'][_0x2530('0x45')]=htmlToText['fromString'](_0x1903c8['message'][_0x2530('0x45')]);respondWithRpcPromise(_0x2530('0x82'),_0x2530('0x82'),{'event':_0x2530('0x88'),'message':_0xfc6892['message']},client9002);return _0x1903c8;}return null;})['then'](respondWithResult(_0x51f139,null))[_0x2530('0x1c')](handleError(_0x51f139,null));};exports[_0x2530('0x89')]=function(_0x84c84c,_0x438e53){var _0x4782c0=moment()[_0x2530('0x8a')]()['toString']();var _0x24cd4a=path[_0x2530('0x59')](config[_0x2530('0x5a')],_0x2530('0x8b'),_0x2530('0x8c'),_0x2530('0x8d'));var _0x3c73f1=path[_0x2530('0x59')](config['root'],_0x2530('0x8b'),_0x2530('0x8c'),_0x2530('0x58'));var _0xbbfcfa=util[_0x2530('0x60')]('message-%s.eml',_0x4782c0);return db[_0x2530('0x2a')][_0x2530('0x46')]({'where':{'id':_0x84c84c[_0x2530('0x43')]['id']},'attributes':['id',_0x2530('0x45'),_0x2530('0x8e'),'to','cc',_0x2530('0x8f'),_0x2530('0x90'),_0x2530('0x91')],'include':_0x84c84c[_0x2530('0x2f')][_0x2530('0x58')]?[{'model':db[_0x2530('0x92')],'as':_0x2530('0x93')}]:undefined})[_0x2530('0x11')](handleEntityNotFound(_0x438e53,null))[_0x2530('0x11')](function(_0x1454e4){if(_0x1454e4){var _0x2af3c6=_0x1454e4;var _0x157d2c={'from':_0x2af3c6[_0x2530('0x8e')],'to':_0x2af3c6['to'],'subject':_0x2af3c6[_0x2530('0x90')],'html':htmlEntities[_0x2530('0x94')](_0x2af3c6[_0x2530('0x45')]),'headers':{'Date':moment(_0x2af3c6[_0x2530('0x91')])[_0x2530('0x60')](_0x2530('0x95'))},'attachments':[]};if(_0x1454e4['cc']){_0x157d2c[_0x2530('0x96')]['Cc']=_0x1454e4['cc'];}if(_0x1454e4[_0x2530('0x8f')]){_0x157d2c[_0x2530('0x96')][_0x2530('0x97')]=_0x1454e4['bcc'];}return new BPromise(function(_0x41c282,_0x5bc562){if(_0x1454e4[_0x2530('0x93')]){for(var _0x3fa225=0x0;_0x3fa225<_0x1454e4[_0x2530('0x93')][_0x2530('0x44')];_0x3fa225++){var _0x1d6a5f=_0x1454e4['Attachments'][_0x3fa225];var _0x344f87=path['join'](_0x3c73f1,_0x1d6a5f[_0x2530('0x5b')]);if(fs[_0x2530('0x98')](_0x344f87)){_0x157d2c['attachments'][_0x2530('0x99')]({'name':_0x1d6a5f['name'],'contentType':_0x1d6a5f[_0x2530('0x2d')],'data':fs[_0x2530('0x9a')](_0x344f87)});}}}emlformat[_0x2530('0x9b')](_0x157d2c,function(_0x62d5e2,_0x871bf){if(_0x62d5e2)return _0x5bc562(_0x62d5e2);fs[_0x2530('0x9c')](path['join'](_0x24cd4a,_0xbbfcfa),_0x871bf);return _0x41c282(_0x871bf);});});}})[_0x2530('0x11')](function(_0x48d947){if(_0x48d947){return _0x438e53['download'](path['join'](_0x24cd4a,_0xbbfcfa),_0xbbfcfa,function(_0x4b0d95){if(!_0x4b0d95)fs[_0x2530('0x9d')](path[_0x2530('0x59')](_0x24cd4a,_0xbbfcfa));});}})['catch'](handleError(_0x438e53,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index afca908..1940676 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 _0x63c4=['update','remove','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x63c4,0x134));var _0x463c=function(_0x1325d9,_0x5222ed){_0x1325d9=_0x1325d9-0x0;var _0x4f4e4a=_0x63c4[_0x1325d9];return _0x4f4e4a;};'use strict';var EventEmitter=require(_0x463c('0x0'));var MailMessage=require(_0x463c('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x463c('0x2')](0x0);var events={'afterCreate':_0x463c('0x3'),'afterUpdate':_0x463c('0x4'),'afterDestroy':_0x463c('0x5')};function emitEvent(_0x32db58){return function(_0x57037f,_0x141f89,_0x3826c0){MailMessageEvents['emit'](_0x32db58+':'+_0x57037f['id'],_0x57037f);MailMessageEvents['emit'](_0x32db58,_0x57037f);_0x3826c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x463c('0x6')](e,emitEvent(event));}}module[_0x463c('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x9033=['MailMessage','setMaxListeners','save','update','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x9033,0x178));var _0x3903=function(_0x1a4699,_0x5a03c5){_0x1a4699=_0x1a4699-0x0;var _0x596041=_0x9033[_0x1a4699];return _0x596041;};'use strict';var EventEmitter=require(_0x3903('0x0'));var MailMessage=require(_0x3903('0x1'))['db'][_0x3903('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3903('0x3')](0x0);var events={'afterCreate':_0x3903('0x4'),'afterUpdate':_0x3903('0x5'),'afterDestroy':_0x3903('0x6')};function emitEvent(_0x269046){return function(_0x31a6c8,_0x42f7b4,_0x265c17){MailMessageEvents['emit'](_0x269046+':'+_0x31a6c8['id'],_0x31a6c8);MailMessageEvents['emit'](_0x269046,_0x31a6c8);_0x265c17(null);};}for(var e in events){if(events[_0x3903('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x3903('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index c39a3cf..8385d44 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 _0x8bfa=['messageId','fti_mail_messages','plainBody','subject','body','models','get','direction','toLowerCase','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','exports','define'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0x8bfa,0xee));var _0xa8bf=function(_0x31c5fd,_0x33131f){_0x31c5fd=_0x31c5fd-0x0;var _0x3799ab=_0x8bfa[_0x31c5fd];return _0x3799ab;};'use strict';var _=require(_0xa8bf('0x0'));var util=require('util');var logger=require(_0xa8bf('0x1'))('api');var moment=require(_0xa8bf('0x2'));var BPromise=require(_0xa8bf('0x3'));var rp=require(_0xa8bf('0x4'));var htmlToText=require(_0xa8bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8bf('0x6'));var config=require(_0xa8bf('0x7'));var attributes=require('./mailMessage.attributes');module[_0xa8bf('0x8')]=function(_0x5b4c92,_0x256902){return _0x5b4c92[_0xa8bf('0x9')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xa8bf('0xa'),'fields':[_0xa8bf('0xa')]},{'name':_0xa8bf('0xb'),'fields':[_0xa8bf('0xc'),_0xa8bf('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4316ba,_0x85489d,_0x528efc){if(_0x4316ba[_0xa8bf('0xe')]){_0x4316ba[_0xa8bf('0xc')]=htmlToText['fromString'](_0x4316ba['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x528efc(null,_0x85489d);},'afterCreate':function(_0x1ccce0,_0x5a2eaf,_0x2baa0e){var _0x3b9f1c=_0x5b4c92[_0xa8bf('0xf')];var _0x2033e2=_0x1ccce0[_0xa8bf('0x10')]({'plain':!![]});if(_0x2033e2[_0xa8bf('0x11')]['toLowerCase']()==='in'||_0x2033e2[_0xa8bf('0x11')][_0xa8bf('0x12')]()==='out'&&!_0x2033e2['secret']&&!_[_0xa8bf('0x13')](_0x2033e2[_0xa8bf('0x14')])){_0x3b9f1c[_0xa8bf('0x15')][_0xa8bf('0x16')]({'where':{'id':_0x2033e2[_0xa8bf('0x17')]}})[_0xa8bf('0x18')](function(_0x525d06){if(_0x525d06){_0x525d06[_0xa8bf('0x19')]({'lastMsgAt':_0x2033e2[_0xa8bf('0x1a')],'lastMsgDirection':_0x2033e2[_0xa8bf('0x11')][_0xa8bf('0x12')]()});}})[_0xa8bf('0x1b')](function(_0x2e4751){console[_0xa8bf('0x1c')](_0x2e4751);});}_0x2baa0e();}},'charset':_0xa8bf('0x1d'),'collate':_0xa8bf('0x1e')});}; \ No newline at end of file +var _0x1022=['MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','secret','isNil'];(function(_0x32ce54,_0x55e52f){var _0x42482b=function(_0x5a1317){while(--_0x5a1317){_0x32ce54['push'](_0x32ce54['shift']());}};_0x42482b(++_0x55e52f);}(_0x1022,0x1a1));var _0x2102=function(_0x2166e1,_0x4a9a63){_0x2166e1=_0x2166e1-0x0;var _0x42ada1=_0x1022[_0x2166e1];return _0x42ada1;};'use strict';var _=require('lodash');var util=require(_0x2102('0x0'));var logger=require(_0x2102('0x1'))('api');var moment=require(_0x2102('0x2'));var BPromise=require(_0x2102('0x3'));var rp=require(_0x2102('0x4'));var htmlToText=require(_0x2102('0x5'));var fs=require('fs');var path=require(_0x2102('0x6'));var rimraf=require(_0x2102('0x7'));var config=require(_0x2102('0x8'));var attributes=require('./mailMessage.attributes');module[_0x2102('0x9')]=function(_0x53115b,_0x561d9f){return _0x53115b[_0x2102('0xa')](_0x2102('0xb'),attributes,{'tableName':_0x2102('0xc'),'paranoid':![],'indexes':[{'name':_0x2102('0xd'),'fields':[_0x2102('0xd')]},{'name':_0x2102('0xe'),'fields':['plainBody','subject'],'type':_0x2102('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x72cabf,_0x2aecfb,_0x13fed9){if(_0x72cabf[_0x2102('0x10')]){_0x72cabf[_0x2102('0x11')]=htmlToText[_0x2102('0x12')](_0x72cabf[_0x2102('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x13fed9(null,_0x2aecfb);},'afterCreate':function(_0x468777,_0x40fd85,_0x3cbb07){var _0x41a57c=_0x53115b[_0x2102('0x13')];var _0x3f07bb=_0x468777[_0x2102('0x14')]({'plain':!![]});if(_0x3f07bb[_0x2102('0x15')][_0x2102('0x16')]()==='in'||_0x3f07bb[_0x2102('0x15')][_0x2102('0x16')]()==='out'&&!_0x3f07bb[_0x2102('0x17')]&&!_[_0x2102('0x18')](_0x3f07bb['UserId'])){_0x41a57c[_0x2102('0x19')]['findOne']({'where':{'id':_0x3f07bb[_0x2102('0x1a')]}})[_0x2102('0x1b')](function(_0x2479c9){if(_0x2479c9){_0x2479c9[_0x2102('0x1c')]({'lastMsgAt':_0x3f07bb[_0x2102('0x1d')],'lastMsgDirection':_0x3f07bb[_0x2102('0x15')][_0x2102('0x16')]()});}})[_0x2102('0x1e')](function(_0x30192a){console[_0x2102('0x1f')](_0x30192a);});}_0x3cbb07();}},'charset':_0x2102('0x20'),'collate':_0x2102('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e8c49e1..957a05e 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(_0x3e058f,_0x31faee){var _0x12b162=function(_0x1730e3){while(--_0x1730e3){_0x3e058f['push'](_0x3e058f['shift']());}};_0x12b162(++_0x31faee);}(_0xd943,0x15d));var _0x3d94=function(_0x55e70f,_0x10d1a5){_0x55e70f=_0x55e70f-0x0;var _0x312170=_0xd943[_0x55e70f];return _0x312170;};'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 _0x236c=['http','defaults','redis','./mailMessage.socket','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','info','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x236c,0x155));var _0xc236=function(_0x4c6054,_0x4c3d9a){_0x4c6054=_0x4c6054-0x0;var _0x5eeca9=_0x236c[_0x4c6054];return _0x5eeca9;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});config['redis']=_[_0xc236('0xc')](config[_0xc236('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc236('0xe'))['register'](socket);function respondWithRpcPromise(_0x30a28d,_0x381ed1,_0x18f33b){return new BPromise(function(_0x2f8b72,_0xaf651b){return client['request'](_0x30a28d,_0x18f33b)[_0xc236('0xf')](function(_0x3311f7){logger['info'](_0xc236('0x10'),_0x381ed1,_0xc236('0x11'));logger['debug'](_0xc236('0x12'),_0x381ed1,'request\x20sent',JSON['stringify'](_0x3311f7));if(_0x3311f7[_0xc236('0x13')]){if(_0x3311f7[_0xc236('0x13')][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('MailMessage,\x20%s,\x20%s',_0x381ed1,_0x3311f7[_0xc236('0x13')]['message']);return _0xaf651b(_0x3311f7['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0x10'),_0x381ed1,_0x3311f7[_0xc236('0x13')][_0xc236('0x15')]);return _0x2f8b72(_0x3311f7['error']['message']);}else{logger['info'](_0xc236('0x10'),_0x381ed1,_0xc236('0x11'));_0x2f8b72(_0x3311f7[_0xc236('0x16')]['message']);}})[_0xc236('0x17')](function(_0x506974){logger['error'](_0xc236('0x10'),_0x381ed1,_0x506974);_0xaf651b(_0x506974);});});}exports[_0xc236('0x18')]=function(_0x3a6183){var _0x46bc69=this;return new Promise(function(_0x2b6d3f,_0x27c6ab){return db[_0xc236('0x19')][_0xc236('0x1a')](_0x3a6183[_0xc236('0x1b')],{'raw':_0x3a6183[_0xc236('0x1c')]?_0x3a6183[_0xc236('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc236('0xf')](function(_0x34d73a){logger[_0xc236('0x1d')](_0xc236('0x18'),_0x3a6183);logger[_0xc236('0x1e')](_0xc236('0x18'),_0x3a6183,JSON[_0xc236('0x1f')](_0x34d73a));_0x2b6d3f(_0x34d73a);})[_0xc236('0x17')](function(_0x1d65e2){logger[_0xc236('0x13')](_0xc236('0x18'),_0x1d65e2['message'],_0x3a6183);_0x27c6ab(_0x46bc69[_0xc236('0x13')](0x1f4,_0x1d65e2[_0xc236('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 0b0a3cd..d27a471 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 _0xaab2=['removeListener','register','length','mailMessage:','remove','update','emit'];(function(_0x551bd4,_0xd75ce6){var _0x5152e4=function(_0x5aa3e3){while(--_0x5aa3e3){_0x551bd4['push'](_0x551bd4['shift']());}};_0x5152e4(++_0xd75ce6);}(_0xaab2,0x15b));var _0x2aab=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xaab2[_0x23e7c1];return _0x1add43;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x2aab('0x0'),_0x2aab('0x1')];function createListener(_0x38f809,_0x53d6c7){return function(_0x8ed68d){_0x53d6c7[_0x2aab('0x2')](_0x38f809,_0x8ed68d);};}function removeListener(_0x1adc6a,_0x4ffb8b){return function(){MailMessageEvents[_0x2aab('0x3')](_0x1adc6a,_0x4ffb8b);};}exports[_0x2aab('0x4')]=function(_0x42b48f){for(var _0x19984a=0x0,_0x1c567d=events[_0x2aab('0x5')];_0x19984a<_0x1c567d;_0x19984a++){var _0x105bfd=events[_0x19984a];var _0x370b2b=createListener(_0x2aab('0x6')+_0x105bfd,_0x42b48f);MailMessageEvents['on'](_0x105bfd,_0x370b2b);}}; \ No newline at end of file +var _0xbb95=['mailMessage:','./mailMessage.events','save','emit','register','length'];(function(_0x5ce5f6,_0x35835c){var _0x421897=function(_0x1b881b){while(--_0x1b881b){_0x5ce5f6['push'](_0x5ce5f6['shift']());}};_0x421897(++_0x35835c);}(_0xbb95,0x7f));var _0x5bb9=function(_0x509dad,_0x459580){_0x509dad=_0x509dad-0x0;var _0x31ae78=_0xbb95[_0x509dad];return _0x31ae78;};'use strict';var MailMessageEvents=require(_0x5bb9('0x0'));var events=[_0x5bb9('0x1'),'remove','update'];function createListener(_0x15492a,_0x2a9386){return function(_0x535716){_0x2a9386[_0x5bb9('0x2')](_0x15492a,_0x535716);};}function removeListener(_0x572ef3,_0x4ef42d){return function(){MailMessageEvents['removeListener'](_0x572ef3,_0x4ef42d);};}exports[_0x5bb9('0x3')]=function(_0x2b72aa){for(var _0x49b590=0x0,_0x180e69=events[_0x5bb9('0x4')];_0x49b590<_0x180e69;_0x49b590++){var _0x39f347=events[_0x49b590];var _0x5e8b1c=createListener(_0x5bb9('0x5')+_0x39f347,_0x2b72aa);MailMessageEvents['on'](_0x39f347,_0x5e8b1c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f1522d9..69f8548 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 _0x36cb=['./mailQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1109db,_0x5c6dc7){var _0x27d529=function(_0x558547){while(--_0x558547){_0x1109db['push'](_0x1109db['shift']());}};_0x27d529(++_0x5c6dc7);}(_0x36cb,0x122));var _0xb36c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x36cb[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xb36c('0x0'));var util=require(_0xb36c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb36c('0x2'));var router=express[_0xb36c('0x3')]();var fs_extra=require(_0xb36c('0x4'));var auth=require(_0xb36c('0x5'));var interaction=require(_0xb36c('0x6'));var config=require('../../config/environment');var controller=require(_0xb36c('0x7'));router[_0xb36c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb36c('0x9')]);router[_0xb36c('0x8')](_0xb36c('0xa'),auth[_0xb36c('0xb')](),controller['describe']);router['get'](_0xb36c('0xc'),auth['isAuthenticated'](),controller[_0xb36c('0xd')]);router['get']('/:id/members',auth[_0xb36c('0xb')](),controller['getMembers']);router[_0xb36c('0x8')](_0xb36c('0xe'),auth['isAuthenticated'](),controller[_0xb36c('0xf')]);router[_0xb36c('0x8')](_0xb36c('0x10'),auth[_0xb36c('0xb')](),controller[_0xb36c('0x11')]);router[_0xb36c('0x12')]('/',auth[_0xb36c('0xb')](),controller[_0xb36c('0x13')]);router[_0xb36c('0x12')](_0xb36c('0xe'),auth['isAuthenticated'](),controller[_0xb36c('0x14')]);router[_0xb36c('0x12')](_0xb36c('0x10'),auth[_0xb36c('0xb')](),controller[_0xb36c('0x15')]);router[_0xb36c('0x16')](_0xb36c('0xc'),auth['isAuthenticated'](),controller[_0xb36c('0x17')]);router[_0xb36c('0x18')](_0xb36c('0xc'),auth[_0xb36c('0xb')](),controller['destroy']);router[_0xb36c('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb36c('0x19')]);router[_0xb36c('0x18')](_0xb36c('0x10'),auth[_0xb36c('0xb')](),controller['removeAgents']);module[_0xb36c('0x1a')]=router; \ No newline at end of file +var _0xed8b=['addTeams','put','destroy','delete','removeTeams','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','/:id/users','getAgents','create','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xed8b,0x1da));var _0xbed8=function(_0x33d181,_0x342d2d){_0x33d181=_0x33d181-0x0;var _0x58abef=_0xed8b[_0x33d181];return _0x58abef;};'use strict';var multer=require('multer');var util=require(_0xbed8('0x0'));var path=require('path');var timeout=require(_0xbed8('0x1'));var express=require(_0xbed8('0x2'));var router=express[_0xbed8('0x3')]();var fs_extra=require(_0xbed8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbed8('0x5'));var config=require(_0xbed8('0x6'));var controller=require(_0xbed8('0x7'));router[_0xbed8('0x8')]('/',auth[_0xbed8('0x9')](),controller[_0xbed8('0xa')]);router[_0xbed8('0x8')](_0xbed8('0xb'),auth['isAuthenticated'](),controller[_0xbed8('0xc')]);router[_0xbed8('0x8')](_0xbed8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbed8('0x8')](_0xbed8('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbed8('0x8')](_0xbed8('0xf'),auth[_0xbed8('0x9')](),controller['getTeams']);router[_0xbed8('0x8')](_0xbed8('0x10'),auth[_0xbed8('0x9')](),controller[_0xbed8('0x11')]);router['post']('/',auth[_0xbed8('0x9')](),controller[_0xbed8('0x12')]);router[_0xbed8('0x13')]('/:id/teams',auth[_0xbed8('0x9')](),controller[_0xbed8('0x14')]);router[_0xbed8('0x13')](_0xbed8('0x10'),auth[_0xbed8('0x9')](),controller['addAgents']);router[_0xbed8('0x15')]('/:id',auth[_0xbed8('0x9')](),controller['update']);router['delete'](_0xbed8('0xd'),auth[_0xbed8('0x9')](),controller[_0xbed8('0x16')]);router[_0xbed8('0x17')](_0xbed8('0xf'),auth[_0xbed8('0x9')](),controller[_0xbed8('0x18')]);router['delete']('/:id/users',auth[_0xbed8('0x9')](),controller[_0xbed8('0x19')]);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 0b51e13..7ba53e9 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 _0xd0a7=['exports','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3afa4f,_0x4dcf8f){var _0x42c8f2=function(_0x17fc4c){while(--_0x17fc4c){_0x3afa4f['push'](_0x3afa4f['shift']());}};_0x42c8f2(++_0x4dcf8f);}(_0xd0a7,0xfc));var _0x7d0a=function(_0x12bd20,_0x13b239){_0x12bd20=_0x12bd20-0x0;var _0x1dc219=_0xd0a7[_0x12bd20];return _0x1dc219;};'use strict';var Sequelize=require('sequelize');module[_0x7d0a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d0a('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d0a('0x2')](_0x7d0a('0x3'),_0x7d0a('0x4'),_0x7d0a('0x5'))}}; \ No newline at end of file +var _0xb95b=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x5dcab1,_0x1c42b2){var _0x35709c=function(_0x1ff082){while(--_0x1ff082){_0x5dcab1['push'](_0x5dcab1['shift']());}};_0x35709c(++_0x1c42b2);}(_0xb95b,0x18c));var _0xbb95=function(_0x334428,_0x17a59b){_0x334428=_0x334428-0x0;var _0x2f88a5=_0xb95b[_0x334428];return _0x2f88a5;};'use strict';var Sequelize=require('sequelize');module[_0xbb95('0x0')]={'name':{'type':Sequelize[_0xbb95('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb95('0x1')]},'timeout':{'type':Sequelize[_0xbb95('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb95('0x3')](_0xbb95('0x4'),_0xbb95('0x5'),_0xbb95('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ddc63b2..8f1781d 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 _0xbccf=['params','rawAttributes','length','MailQueue','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','nolimit','MailQueueId','filter','User','findAndCountAll','UserId','mailPause','createdAt','format','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','forEach','emit','removeTeams','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','all','union','compact','value','transaction','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x33f366,_0x131b8b){var _0x249aa5=function(_0x2b3e91){while(--_0x2b3e91){_0x33f366['push'](_0x33f366['shift']());}};_0x249aa5(++_0x131b8b);}(_0xbccf,0x1d2));var _0xfbcc=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0xbccf[_0x623e7];return _0x121131;};'use strict';var emlformat=require(_0xfbcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbcc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbcc('0x2'));var moment=require(_0xfbcc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfbcc('0x4'));var path=require(_0xfbcc('0x5'));var sox=require(_0xfbcc('0x6'));var csv=require(_0xfbcc('0x7'));var ejs=require(_0xfbcc('0x8'));var fs=require('fs');var fs_extra=require(_0xfbcc('0x9'));var _=require(_0xfbcc('0xa'));var squel=require(_0xfbcc('0xb'));var crypto=require(_0xfbcc('0xc'));var jsforce=require(_0xfbcc('0xd'));var deskjs=require(_0xfbcc('0xe'));var toCsv=require(_0xfbcc('0x7'));var querystring=require(_0xfbcc('0xf'));var Papa=require(_0xfbcc('0x10'));var Redis=require(_0xfbcc('0x11'));var authService=require(_0xfbcc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfbcc('0x13'));var hardwareService=require(_0xfbcc('0x14'));var logger=require('../../config/logger')(_0xfbcc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfbcc('0x16'));var db=require(_0xfbcc('0x17'))['db'];config[_0xfbcc('0x18')]=_['defaults'](config[_0xfbcc('0x18')],{'host':_0xfbcc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbcc('0x18')]));require(_0xfbcc('0x1a'))[_0xfbcc('0x1b')](socket);function respondWithStatusCode(_0x42aa92,_0x4d3d5e){_0x4d3d5e=_0x4d3d5e||0xcc;return function(_0xc2e8f8){if(_0xc2e8f8){return _0x42aa92['sendStatus'](_0x4d3d5e);}return _0x42aa92[_0xfbcc('0x1c')](_0x4d3d5e)[_0xfbcc('0x1d')]();};}function respondWithResult(_0x356c05,_0x4e4dd0){_0x4e4dd0=_0x4e4dd0||0xc8;return function(_0x4ef826){if(_0x4ef826){return _0x356c05[_0xfbcc('0x1c')](_0x4e4dd0)[_0xfbcc('0x1e')](_0x4ef826);}};}function respondWithFilteredResult(_0x21f910,_0x3fbaa7){return function(_0x3fe600){if(_0x3fe600){var _0x5d6fcf=typeof _0x3fbaa7[_0xfbcc('0x1f')]===_0xfbcc('0x20')&&typeof _0x3fbaa7[_0xfbcc('0x21')]===_0xfbcc('0x20');var _0x23f0e0=_0x3fe600[_0xfbcc('0x22')];var _0x11cf3d=_0x5d6fcf?0x0:_0x3fbaa7['offset'];var _0x481e6f=_0x5d6fcf?_0x3fe600['count']:_0x3fbaa7['offset']+_0x3fbaa7['limit'];var _0x2c1f80;if(_0x481e6f>=_0x23f0e0){_0x481e6f=_0x23f0e0;_0x2c1f80=0xc8;}else{_0x2c1f80=0xce;}_0x21f910[_0xfbcc('0x1c')](_0x2c1f80);return _0x21f910[_0xfbcc('0x23')](_0xfbcc('0x24'),_0x11cf3d+'-'+_0x481e6f+'/'+_0x23f0e0)[_0xfbcc('0x1e')](_0x3fe600);}return null;};}function patchUpdates(_0x5c9ff4){return function(_0xf5bfd3){try{jsonpatch[_0xfbcc('0x25')](_0xf5bfd3,_0x5c9ff4,!![]);}catch(_0x2c3228){return BPromise['reject'](_0x2c3228);}return _0xf5bfd3[_0xfbcc('0x26')]();};}function saveUpdates(_0x384443,_0x206969){return function(_0x2d6b0c){if(_0x2d6b0c){return _0x2d6b0c[_0xfbcc('0x27')](_0x384443)[_0xfbcc('0x28')](function(_0x56b1fd){return _0x56b1fd;});}return null;};}function removeEntity(_0x48025d,_0xc29958){return function(_0x5cb3e0){if(_0x5cb3e0){return _0x5cb3e0[_0xfbcc('0x29')]()[_0xfbcc('0x28')](function(){var _0x479b0b=_0x5cb3e0[_0xfbcc('0x2a')]({'plain':!![]});var _0x574e63=_0xfbcc('0x2b');return db[_0xfbcc('0x2c')][_0xfbcc('0x29')]({'where':{'type':_0x574e63,'resourceId':_0x479b0b['id']}})[_0xfbcc('0x28')](function(){return _0x5cb3e0;});})[_0xfbcc('0x28')](function(){_0x48025d[_0xfbcc('0x1c')](0xcc)[_0xfbcc('0x1d')]();});}};}function handleEntityNotFound(_0x3bfe8e,_0x31328f){return function(_0x4835cc){if(!_0x4835cc){_0x3bfe8e[_0xfbcc('0x2d')](0x194);}return _0x4835cc;};}function handleError(_0x4af4af,_0x487fea){_0x487fea=_0x487fea||0x1f4;return function(_0x5a9a0a){logger[_0xfbcc('0x2e')](_0x5a9a0a['stack']);if(_0x5a9a0a[_0xfbcc('0x2f')]){delete _0x5a9a0a['name'];}_0x4af4af[_0xfbcc('0x1c')](_0x487fea)[_0xfbcc('0x30')](_0x5a9a0a);};}exports[_0xfbcc('0x31')]=function(_0x511405,_0x4822b6){var _0x4c3fbe={},_0x3ecd37={},_0x3e9a82={'count':0x0,'rows':[]};var _0x417af4=_[_0xfbcc('0x32')](db['MailQueue']['rawAttributes'],function(_0x10363e){return{'name':_0x10363e['fieldName'],'type':_0x10363e[_0xfbcc('0x33')][_0xfbcc('0x34')]};});_0x3ecd37[_0xfbcc('0x35')]=_[_0xfbcc('0x32')](_0x417af4,_0xfbcc('0x2f'));_0x3ecd37[_0xfbcc('0x36')]=_[_0xfbcc('0x37')](_0x511405['query']);_0x3ecd37[_0xfbcc('0x38')]=_[_0xfbcc('0x39')](_0x3ecd37['model'],_0x3ecd37['query']);_0x4c3fbe['attributes']=_['intersection'](_0x3ecd37['model'],qs['fields'](_0x511405[_0xfbcc('0x36')][_0xfbcc('0x3a')]));_0x4c3fbe[_0xfbcc('0x3b')]=_0x4c3fbe[_0xfbcc('0x3b')]['length']?_0x4c3fbe[_0xfbcc('0x3b')]:_0x3ecd37[_0xfbcc('0x35')];if(!_0x511405[_0xfbcc('0x36')][_0xfbcc('0x3c')]('nolimit')){_0x4c3fbe[_0xfbcc('0x21')]=qs[_0xfbcc('0x21')](_0x511405['query'][_0xfbcc('0x21')]);_0x4c3fbe[_0xfbcc('0x1f')]=qs[_0xfbcc('0x1f')](_0x511405[_0xfbcc('0x36')][_0xfbcc('0x1f')]);}_0x4c3fbe[_0xfbcc('0x3d')]=qs[_0xfbcc('0x3e')](_0x511405[_0xfbcc('0x36')][_0xfbcc('0x3e')]);_0x4c3fbe[_0xfbcc('0x3f')]=qs[_0xfbcc('0x38')](_[_0xfbcc('0x40')](_0x511405['query'],_0x3ecd37[_0xfbcc('0x38')]),_0x417af4);if(_0x511405[_0xfbcc('0x36')]['filter']){_0x4c3fbe[_0xfbcc('0x3f')]=_[_0xfbcc('0x41')](_0x4c3fbe['where'],{'$or':_['map'](_0x417af4,function(_0x3d936b){if(_0x3d936b[_0xfbcc('0x33')]!==_0xfbcc('0x42')){var _0x2e8165={};_0x2e8165[_0x3d936b['name']]={'$like':'%'+_0x511405['query']['filter']+'%'};return _0x2e8165;}})});}_0x4c3fbe=_['merge']({},_0x4c3fbe,_0x511405[_0xfbcc('0x43')]);var _0x37e3ee={'where':_0x4c3fbe[_0xfbcc('0x3f')]};return db['MailQueue'][_0xfbcc('0x22')](_0x37e3ee)[_0xfbcc('0x28')](function(_0x6430bc){_0x3e9a82[_0xfbcc('0x22')]=_0x6430bc;if(_0x511405[_0xfbcc('0x36')][_0xfbcc('0x44')]){_0x4c3fbe[_0xfbcc('0x45')]=[{'all':!![]}];}return db['MailQueue'][_0xfbcc('0x46')](_0x4c3fbe);})['then'](function(_0x196409){_0x3e9a82[_0xfbcc('0x47')]=_0x196409;return _0x3e9a82;})['then'](respondWithFilteredResult(_0x4822b6,_0x4c3fbe))[_0xfbcc('0x48')](handleError(_0x4822b6,null));};exports[_0xfbcc('0x49')]=function(_0x216a06,_0x47cc23){var _0x302939={'raw':!![],'where':{'id':_0x216a06[_0xfbcc('0x4a')]['id']}},_0x263822={};_0x263822[_0xfbcc('0x35')]=_['keys'](db['MailQueue'][_0xfbcc('0x4b')]);_0x263822[_0xfbcc('0x36')]=_[_0xfbcc('0x37')](_0x216a06[_0xfbcc('0x36')]);_0x263822[_0xfbcc('0x38')]=_['intersection'](_0x263822[_0xfbcc('0x35')],_0x263822[_0xfbcc('0x36')]);_0x302939[_0xfbcc('0x3b')]=_['intersection'](_0x263822['model'],qs['fields'](_0x216a06[_0xfbcc('0x36')][_0xfbcc('0x3a')]));_0x302939[_0xfbcc('0x3b')]=_0x302939[_0xfbcc('0x3b')][_0xfbcc('0x4c')]?_0x302939['attributes']:_0x263822[_0xfbcc('0x35')];if(_0x216a06['query'][_0xfbcc('0x44')]){_0x302939[_0xfbcc('0x45')]=[{'all':!![]}];}_0x302939=_[_0xfbcc('0x41')]({},_0x302939,_0x216a06[_0xfbcc('0x43')]);return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')](_0x302939)[_0xfbcc('0x28')](handleEntityNotFound(_0x47cc23,null))[_0xfbcc('0x28')](respondWithResult(_0x47cc23,null))['catch'](handleError(_0x47cc23,null));};exports[_0xfbcc('0x4f')]=function(_0x44f724,_0x319383){return db[_0xfbcc('0x4d')][_0xfbcc('0x4f')](_0x44f724[_0xfbcc('0x50')],{})[_0xfbcc('0x28')](function(_0x690224){var _0x44fed0=_0x44f724[_0xfbcc('0x51')][_0xfbcc('0x2a')]({'plain':!![]});if(!_0x44fed0)throw new Error(_0xfbcc('0x52'));if(_0x44fed0['role']===_0xfbcc('0x51')){var _0x148c46=_0x690224[_0xfbcc('0x2a')]({'plain':!![]});var _0x18e27a=_0xfbcc('0x2b');return db[_0xfbcc('0x53')][_0xfbcc('0x4e')]({'where':{'name':_0x18e27a,'userProfileId':_0x44fed0['userProfileId']},'raw':!![]})[_0xfbcc('0x28')](function(_0x594e59){if(_0x594e59&&_0x594e59[_0xfbcc('0x54')]===0x0){return db[_0xfbcc('0x2c')][_0xfbcc('0x4f')]({'name':_0x148c46['name'],'resourceId':_0x148c46['id'],'type':_0x594e59[_0xfbcc('0x2f')],'sectionId':_0x594e59['id']},{})['then'](function(){return _0x690224;});}else{return _0x690224;}})[_0xfbcc('0x48')](function(_0x44a430){logger[_0xfbcc('0x2e')](_0xfbcc('0x55'),_0x44a430);throw _0x44a430;});}return _0x690224;})[_0xfbcc('0x28')](respondWithResult(_0x319383,0xc9))[_0xfbcc('0x48')](handleError(_0x319383,null));};exports[_0xfbcc('0x27')]=function(_0x701a9,_0xfc3aab){if(_0x701a9[_0xfbcc('0x50')]['id']){delete _0x701a9[_0xfbcc('0x50')]['id'];}return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x701a9['params']['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0xfc3aab,null))['then'](saveUpdates(_0x701a9[_0xfbcc('0x50')],null))['then'](respondWithResult(_0xfc3aab,null))[_0xfbcc('0x48')](handleError(_0xfc3aab,null));};exports[_0xfbcc('0x29')]=function(_0x783ce0,_0x5a25e6){return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x783ce0[_0xfbcc('0x4a')]['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x5a25e6,null))[_0xfbcc('0x28')](removeEntity(_0x5a25e6,null))['catch'](handleError(_0x5a25e6,null));};exports[_0xfbcc('0x56')]=function(_0x11fe1f,_0x52a2db){return db['MailQueue'][_0xfbcc('0x56')]()[_0xfbcc('0x28')](respondWithResult(_0x52a2db,null))[_0xfbcc('0x48')](handleError(_0x52a2db,null));};exports['getMembers']=function(_0x55b094,_0x45ec01,_0x64a6d8){var _0x479a2d={'raw':!![],'where':{}},_0x5b87f3={},_0x3197b1;return db[_0xfbcc('0x4d')]['findOne']({'where':{'id':_0x55b094[_0xfbcc('0x4a')]['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x45ec01,null))['then'](function(_0x25245c){if(_0x25245c){_0x3197b1=_0x25245c[_0xfbcc('0x2a')]({'plain':!![]});_0x5b87f3[_0xfbcc('0x35')]=_[_0xfbcc('0x37')](db[_0xfbcc('0x57')][_0xfbcc('0x4b')]);_0x5b87f3[_0xfbcc('0x36')]=_[_0xfbcc('0x37')](_0x55b094['query']);_0x5b87f3[_0xfbcc('0x38')]=_[_0xfbcc('0x39')](_0x5b87f3[_0xfbcc('0x35')],_0x5b87f3[_0xfbcc('0x36')]);_0x479a2d[_0xfbcc('0x3b')]=_[_0xfbcc('0x39')](_0x5b87f3[_0xfbcc('0x35')],qs[_0xfbcc('0x3a')](_0x55b094['query']['fields']));_0x479a2d[_0xfbcc('0x3b')]=_0x479a2d[_0xfbcc('0x3b')][_0xfbcc('0x4c')]?_0x479a2d[_0xfbcc('0x3b')]:_0x5b87f3['model'];if(!_0x55b094['query'][_0xfbcc('0x3c')](_0xfbcc('0x58'))){_0x479a2d[_0xfbcc('0x21')]=qs[_0xfbcc('0x21')](_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x21')]);_0x479a2d[_0xfbcc('0x1f')]=qs[_0xfbcc('0x1f')](_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x1f')]);}_0x479a2d[_0xfbcc('0x3d')]=qs[_0xfbcc('0x3e')](_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x3e')]);_0x479a2d[_0xfbcc('0x3f')]=qs['filters'](_['pick'](_0x55b094['query'],_0x5b87f3[_0xfbcc('0x38')]));_0x479a2d[_0xfbcc('0x3f')][_0xfbcc('0x59')]=_0x25245c['id'];if(_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x5a')]){_0x479a2d['where']=_[_0xfbcc('0x41')](_0x479a2d[_0xfbcc('0x3f')],{'$or':_[_0xfbcc('0x32')](_0x479a2d[_0xfbcc('0x3b')],function(_0x3c5f67){var _0x2f1afb={};_0x2f1afb[_0x3c5f67]={'$like':'%'+_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x5a')]+'%'};return _0x2f1afb;})});}_0x479a2d=_[_0xfbcc('0x41')]({},_0x479a2d,_0x55b094[_0xfbcc('0x43')]);return db[_0xfbcc('0x57')][_0xfbcc('0x46')](_0x479a2d);}})['then'](function(_0x325914){if(_0x325914){return db[_0xfbcc('0x5b')][_0xfbcc('0x5c')]({'where':{'id':_[_0xfbcc('0x32')](_0x325914,_0xfbcc('0x5d')),'role':'agent'},'attributes':['id','name',_0xfbcc('0x5e'),'updatedAt',_0xfbcc('0x5f')]});}})[_0xfbcc('0x28')](function(_0x4bb34b){if(_0x4bb34b){return{'count':_0x4bb34b['count'],'rows':_[_0xfbcc('0x32')](_0x4bb34b[_0xfbcc('0x47')],function(_0x30116e){return{'membername':_0x30116e['name'],'UserId':_0x30116e['id'],'queue_name':_0x3197b1['name'],'MailQueueId':_0x3197b1['id'],'interface':util[_0xfbcc('0x60')]('%s/%s',_0xfbcc('0x61'),_0x30116e[_0xfbcc('0x2f')]),'penalty':0x0,'paused':_0x30116e[_0xfbcc('0x5e')],'createdAt':_0x30116e[_0xfbcc('0x5f')],'updatedAt':_0x30116e[_0xfbcc('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x45ec01,_0x479a2d))[_0xfbcc('0x48')](handleError(_0x45ec01,null));};exports[_0xfbcc('0x63')]=function(_0x2efd37,_0xe8e81a,_0x495a0d){var _0x168e66={};var _0x5954e4={};var _0x2e6a15;var _0x371702;return db[_0xfbcc('0x4d')][_0xfbcc('0x64')]({'where':{'id':_0x2efd37['params']['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0xe8e81a,null))[_0xfbcc('0x28')](function(_0x2ba93c){if(_0x2ba93c){_0x2e6a15=_0x2ba93c;_0x5954e4[_0xfbcc('0x35')]=_[_0xfbcc('0x37')](db[_0xfbcc('0x65')]['rawAttributes']);_0x5954e4[_0xfbcc('0x36')]=_[_0xfbcc('0x37')](_0x2efd37['query']);_0x5954e4[_0xfbcc('0x38')]=_['intersection'](_0x5954e4[_0xfbcc('0x35')],_0x5954e4[_0xfbcc('0x36')]);_0x168e66[_0xfbcc('0x3b')]=_[_0xfbcc('0x39')](_0x5954e4[_0xfbcc('0x35')],qs[_0xfbcc('0x3a')](_0x2efd37[_0xfbcc('0x36')][_0xfbcc('0x3a')]));_0x168e66[_0xfbcc('0x3b')]=_0x168e66[_0xfbcc('0x3b')][_0xfbcc('0x4c')]?_0x168e66[_0xfbcc('0x3b')]:_0x5954e4[_0xfbcc('0x35')];_0x168e66['order']=qs[_0xfbcc('0x3e')](_0x2efd37['query'][_0xfbcc('0x3e')]);_0x168e66[_0xfbcc('0x3f')]=qs['filters'](_[_0xfbcc('0x40')](_0x2efd37['query'],_0x5954e4[_0xfbcc('0x38')]));if(_0x2efd37[_0xfbcc('0x36')]['filter']){_0x168e66[_0xfbcc('0x3f')]=_[_0xfbcc('0x41')](_0x168e66[_0xfbcc('0x3f')],{'$or':_[_0xfbcc('0x32')](_0x168e66[_0xfbcc('0x3b')],function(_0x11095b){var _0x49a93b={};_0x49a93b[_0x11095b]={'$like':'%'+_0x2efd37['query']['filter']+'%'};return _0x49a93b;})});}_0x168e66=_[_0xfbcc('0x41')]({},_0x168e66,_0x2efd37['options']);return _0x2e6a15['getTeams'](_0x168e66);}})[_0xfbcc('0x28')](function(_0x8daad5){if(_0x8daad5){_0x371702=_0x8daad5[_0xfbcc('0x4c')];if(!_0x2efd37[_0xfbcc('0x36')]['hasOwnProperty'](_0xfbcc('0x58'))){_0x168e66[_0xfbcc('0x21')]=qs['limit'](_0x2efd37[_0xfbcc('0x36')]['limit']);_0x168e66['offset']=qs[_0xfbcc('0x1f')](_0x2efd37[_0xfbcc('0x36')][_0xfbcc('0x1f')]);}return _0x2e6a15[_0xfbcc('0x63')](_0x168e66);}})[_0xfbcc('0x28')](function(_0xd18b5e){if(_0xd18b5e){return _0xd18b5e?{'count':_0x371702,'rows':_0xd18b5e}:null;}})[_0xfbcc('0x28')](respondWithResult(_0xe8e81a,null))[_0xfbcc('0x48')](handleError(_0xe8e81a,null));};exports[_0xfbcc('0x66')]=function(_0x54c24c,_0x52c823,_0x126085){var _0x13b221=_0x54c24c[_0xfbcc('0x50')][_0xfbcc('0x67')];return db['Team']['findAll']({'where':{'id':_0x13b221},'attributes':['id'],'include':[{'model':db[_0xfbcc('0x5b')],'as':_0xfbcc('0x68'),'attributes':['id',_0xfbcc('0x2f'),'online',_0xfbcc('0x69'),'interface'],'raw':!![]}]})['then'](function(_0x3e944c){if(_0x3e944c){var _0x52ff21=_[_0xfbcc('0x6a')](_0x3e944c,function(_0x323f6d){var _0x49f286=_0x323f6d[_0xfbcc('0x2a')]({'plain':!![]});return _0x49f286['Agents'];});return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x54c24c[_0xfbcc('0x4a')]['id']}})['then'](function(_0x2f68d6){return db[_0xfbcc('0x6b')]['transaction'](function(_0x16302a){return _0x2f68d6[_0xfbcc('0x66')](_0x13b221,{'transaction':_0x16302a})['then'](function(){return BPromise['each'](_0x52ff21,function(_0x266fa2){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x266fa2['id'],'MailQueueId':_0x54c24c[_0xfbcc('0x4a')]['id']},'transaction':_0x16302a});});})[_0xfbcc('0x28')](function(){_0x52ff21[_0xfbcc('0x6c')](function(_0x489560){socket[_0xfbcc('0x6d')]('userMailQueue:save',{'UserId':_0x489560['id'],'MailQueueId':_0x2f68d6['id']});});});});});}})[_0xfbcc('0x28')](respondWithStatusCode(_0x52c823,null))[_0xfbcc('0x48')](handleError(_0x52c823,null));};exports[_0xfbcc('0x6e')]=function(_0x490c8c,_0x477a0b,_0x15ec98){return db[_0xfbcc('0x65')][_0xfbcc('0x46')]({'where':{'id':_0x490c8c[_0xfbcc('0x36')][_0xfbcc('0x67')]},'attributes':['id'],'include':[{'model':db[_0xfbcc('0x5b')],'as':_0xfbcc('0x68'),'attributes':['id'],'raw':!![]}]})[_0xfbcc('0x28')](handleEntityNotFound(_0x477a0b,null))[_0xfbcc('0x28')](function(_0x4ab631){var _0x59b80f=_['map'](_0x4ab631,'id');var _0x1dac6a=[];var _0x3adc2d=[];var _0x44f007=squel['select']();_0x44f007['field'](_0xfbcc('0x6f'))['from'](_0xfbcc('0x70'),'tq')[_0xfbcc('0x71')](_0xfbcc('0x72'),'ut',_0xfbcc('0x73'))[_0xfbcc('0x3f')](_0xfbcc('0x74'),_0x490c8c[_0xfbcc('0x4a')]['id']);for(var _0x27f4a0=0x0;_0x27f4a0<_0x4ab631[_0xfbcc('0x4c')];_0x27f4a0+=0x1){let _0x4f6f35=_0x4ab631[_0x27f4a0];for(var _0x4d86ad=0x0;_0x4d86ad<_0x4f6f35['Agents'][_0xfbcc('0x4c')];_0x4d86ad+=0x1){let _0x1c02dd=_0x4f6f35[_0xfbcc('0x68')][_0x4d86ad];var _0x330bde=_0x44f007[_0xfbcc('0x75')]();_0x330bde[_0xfbcc('0x3f')](_0xfbcc('0x76'),_0x1c02dd['id']);_0x3adc2d['push'](db[_0xfbcc('0x6b')][_0xfbcc('0x36')](_0x330bde[_0xfbcc('0x77')](),{'type':db['sequelize']['QueryTypes'][_0xfbcc('0x78')]})[_0xfbcc('0x28')](function(_0x176a6e){if(_0x176a6e[_0xfbcc('0x4c')]===0x1){return _0x1c02dd['id'];}else{var _0x3cb709=_['every'](_[_0xfbcc('0x32')](_0x176a6e,_0xfbcc('0x79')),function(_0x478a74){return _['includes'](_0x59b80f,_0x478a74);});if(_0x3cb709){return _0x1c02dd['id'];}}}));}}return BPromise[_0xfbcc('0x7a')](_0x3adc2d)[_0xfbcc('0x28')](function(_0x283fe6){_0x1dac6a=_(_0x1dac6a)[_0xfbcc('0x7b')](_0x283fe6)[_0xfbcc('0x7c')]()[_0xfbcc('0x7d')]();return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x490c8c[_0xfbcc('0x4a')]['id']}})['then'](function(_0x297b2a){return db[_0xfbcc('0x6b')][_0xfbcc('0x7e')](function(_0x85d2a3){return _0x297b2a['removeTeams'](_0x490c8c[_0xfbcc('0x36')]['ids'],{'transaction':_0x85d2a3})['then'](function(){if(!_['isEmpty'](_0x1dac6a)){return _0x297b2a[_0xfbcc('0x7f')](_0x1dac6a,{'transaction':_0x85d2a3});}})[_0xfbcc('0x28')](function(){_0x1dac6a[_0xfbcc('0x6c')](function(_0x5c81e7){socket['emit'](_0xfbcc('0x80'),{'UserId':_0x5c81e7,'MailQueueId':_0x297b2a['id']});});});});});});})[_0xfbcc('0x28')](respondWithStatusCode(_0x477a0b,null))[_0xfbcc('0x48')](handleError(_0x477a0b,null));};exports[_0xfbcc('0x81')]=function(_0x1d82bb,_0x4c33b0,_0x4db2d5){return db['MailQueue'][_0xfbcc('0x4e')]({'where':{'id':_0x1d82bb['params']['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x4c33b0,null))[_0xfbcc('0x28')](function(_0x22ba57){if(_0x22ba57){return _0x22ba57['addAgents'](_0x1d82bb[_0xfbcc('0x50')][_0xfbcc('0x67')],_[_0xfbcc('0x82')](_0x1d82bb[_0xfbcc('0x50')],[_0xfbcc('0x67'),'id'])||{})[_0xfbcc('0x83')](function(_0xf59f1e){for(var _0x5007e7=0x0;_0x5007e7<_0x1d82bb['body']['ids'][_0xfbcc('0x4c')];_0x5007e7+=0x1){socket[_0xfbcc('0x6d')](_0xfbcc('0x84'),{'UserId':Number(_0x1d82bb[_0xfbcc('0x50')][_0xfbcc('0x67')][_0x5007e7]),'MailQueueId':Number(_0x1d82bb[_0xfbcc('0x4a')]['id'])});}return _0xf59f1e;});}})[_0xfbcc('0x28')](respondWithResult(_0x4c33b0,null))[_0xfbcc('0x48')](handleError(_0x4c33b0,null));};exports['removeAgents']=function(_0x3be525,_0x15ca54,_0x1b61ab){return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x3be525[_0xfbcc('0x4a')]['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x15ca54,null))[_0xfbcc('0x28')](function(_0x2a4063){if(_0x2a4063){return _0x2a4063[_0xfbcc('0x7f')](_0x3be525[_0xfbcc('0x36')][_0xfbcc('0x67')])['then'](function(){if(_[_0xfbcc('0x85')](_0x3be525[_0xfbcc('0x36')][_0xfbcc('0x67')])){for(var _0x8ce0e6=0x0;_0x8ce0e6<_0x3be525[_0xfbcc('0x36')][_0xfbcc('0x67')][_0xfbcc('0x4c')];_0x8ce0e6+=0x1){socket[_0xfbcc('0x6d')](_0xfbcc('0x80'),{'UserId':Number(_0x3be525['query']['ids'][_0x8ce0e6]),'MailQueueId':Number(_0x3be525[_0xfbcc('0x4a')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3be525['query'][_0xfbcc('0x67')]),'MailQueueId':Number(_0x3be525[_0xfbcc('0x4a')]['id'])});}});}})[_0xfbcc('0x28')](respondWithStatusCode(_0x15ca54,null))[_0xfbcc('0x48')](handleError(_0x15ca54,null));};exports['getAgents']=function(_0x3ef7ed,_0x32846c,_0x21806b){var _0x262053={};var _0x387d19={};var _0xa96a7c;var _0x3566f2;return db[_0xfbcc('0x4d')][_0xfbcc('0x64')]({'where':{'id':_0x3ef7ed[_0xfbcc('0x4a')]['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x32846c,null))[_0xfbcc('0x28')](function(_0x36c36e){if(_0x36c36e){_0xa96a7c=_0x36c36e;_0x387d19[_0xfbcc('0x35')]=_[_0xfbcc('0x37')](db['User']['rawAttributes']);_0x387d19['query']=_[_0xfbcc('0x37')](_0x3ef7ed[_0xfbcc('0x36')]);_0x387d19[_0xfbcc('0x38')]=_[_0xfbcc('0x39')](_0x387d19[_0xfbcc('0x35')],_0x387d19[_0xfbcc('0x36')]);_0x262053[_0xfbcc('0x3b')]=_[_0xfbcc('0x39')](_0x387d19[_0xfbcc('0x35')],qs[_0xfbcc('0x3a')](_0x3ef7ed['query'][_0xfbcc('0x3a')]));_0x262053[_0xfbcc('0x3b')]=_0x262053[_0xfbcc('0x3b')][_0xfbcc('0x4c')]?_0x262053[_0xfbcc('0x3b')]:_0x387d19[_0xfbcc('0x35')];_0x262053['order']=qs[_0xfbcc('0x3e')](_0x3ef7ed[_0xfbcc('0x36')][_0xfbcc('0x3e')]);_0x262053[_0xfbcc('0x3f')]=qs[_0xfbcc('0x38')](_[_0xfbcc('0x40')](_0x3ef7ed[_0xfbcc('0x36')],_0x387d19['filters']));if(_0x3ef7ed[_0xfbcc('0x36')][_0xfbcc('0x5a')]){_0x262053[_0xfbcc('0x3f')]=_[_0xfbcc('0x41')](_0x262053[_0xfbcc('0x3f')],{'$or':_[_0xfbcc('0x32')](_0x262053[_0xfbcc('0x3b')],function(_0x97e3e7){var _0x591e6c={};_0x591e6c[_0x97e3e7]={'$like':'%'+_0x3ef7ed[_0xfbcc('0x36')][_0xfbcc('0x5a')]+'%'};return _0x591e6c;})});}_0x262053=_[_0xfbcc('0x41')]({},_0x262053,_0x3ef7ed[_0xfbcc('0x43')]);return _0xa96a7c['getAgents'](_0x262053);}})[_0xfbcc('0x28')](function(_0x5df623){if(_0x5df623){_0x3566f2=_0x5df623['length'];if(!_0x3ef7ed[_0xfbcc('0x36')][_0xfbcc('0x3c')](_0xfbcc('0x58'))){_0x262053[_0xfbcc('0x21')]=qs[_0xfbcc('0x21')](_0x3ef7ed[_0xfbcc('0x36')]['limit']);_0x262053[_0xfbcc('0x1f')]=qs[_0xfbcc('0x1f')](_0x3ef7ed['query'][_0xfbcc('0x1f')]);}return _0xa96a7c[_0xfbcc('0x86')](_0x262053);}})[_0xfbcc('0x28')](function(_0x62da34){if(_0x62da34){return _0x62da34?{'count':_0x3566f2,'rows':_0x62da34}:null;}})[_0xfbcc('0x28')](respondWithResult(_0x32846c,null))[_0xfbcc('0x48')](handleError(_0x32846c,null));}; \ No newline at end of file +var _0x4431=['MailQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','spread','isArray','userMailQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','get','MailQueues','name','index','map','MailQueue','rawAttributes','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','error','update','destroy','describe','getMembers','UserMailQueue','keys','pick','MailQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','getTeams','findOne','ids','Agents','interface','flatMap','transaction','addTeams','each','emit','userMailQueue:save','removeTeams','Team','select','field','from','team_has_mail_queues','user_has_teams'];(function(_0x230b5e,_0x207baa){var _0x1bfbc=function(_0x4454c2){while(--_0x4454c2){_0x230b5e['push'](_0x230b5e['shift']());}};_0x1bfbc(++_0x207baa);}(_0x4431,0x1b4));var _0x1443=function(_0x148db6,_0x59272e){_0x148db6=_0x148db6-0x0;var _0xefb0e9=_0x4431[_0x148db6];return _0xefb0e9;};'use strict';var emlformat=require(_0x1443('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1443('0x1'));var jsonpatch=require(_0x1443('0x2'));var rp=require(_0x1443('0x3'));var moment=require(_0x1443('0x4'));var BPromise=require(_0x1443('0x5'));var Mustache=require(_0x1443('0x6'));var util=require(_0x1443('0x7'));var path=require(_0x1443('0x8'));var sox=require(_0x1443('0x9'));var csv=require(_0x1443('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1443('0xb'));var _=require(_0x1443('0xc'));var squel=require(_0x1443('0xd'));var crypto=require(_0x1443('0xe'));var jsforce=require(_0x1443('0xf'));var deskjs=require(_0x1443('0x10'));var toCsv=require(_0x1443('0xa'));var querystring=require(_0x1443('0x11'));var Papa=require(_0x1443('0x12'));var Redis=require('ioredis');var authService=require(_0x1443('0x13'));var qs=require(_0x1443('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1443('0x15'));var logger=require(_0x1443('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1443('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1443('0x18'))['db'];config[_0x1443('0x19')]=_[_0x1443('0x1a')](config[_0x1443('0x19')],{'host':_0x1443('0x1b'),'port':0x18eb});var socket=require(_0x1443('0x1c'))(new Redis(config[_0x1443('0x19')]));require(_0x1443('0x1d'))[_0x1443('0x1e')](socket);function respondWithStatusCode(_0x266ca9,_0x5ea3d1){_0x5ea3d1=_0x5ea3d1||0xcc;return function(_0x18f758){if(_0x18f758){return _0x266ca9[_0x1443('0x1f')](_0x5ea3d1);}return _0x266ca9[_0x1443('0x20')](_0x5ea3d1)[_0x1443('0x21')]();};}function respondWithResult(_0x356cd6,_0x1776e8){_0x1776e8=_0x1776e8||0xc8;return function(_0x15f772){if(_0x15f772){return _0x356cd6[_0x1443('0x20')](_0x1776e8)[_0x1443('0x22')](_0x15f772);}};}function respondWithFilteredResult(_0x33e128,_0x3c2b7b){return function(_0x3e00f8){if(_0x3e00f8){var _0x5bbde4=typeof _0x3c2b7b[_0x1443('0x23')]===_0x1443('0x24')&&typeof _0x3c2b7b['limit']===_0x1443('0x24');var _0x388216=_0x3e00f8[_0x1443('0x25')];var _0x223e82=_0x5bbde4?0x0:_0x3c2b7b[_0x1443('0x23')];var _0x16a9a8=_0x5bbde4?_0x3e00f8[_0x1443('0x25')]:_0x3c2b7b[_0x1443('0x23')]+_0x3c2b7b[_0x1443('0x26')];var _0x58ac12;if(_0x16a9a8>=_0x388216){_0x16a9a8=_0x388216;_0x58ac12=0xc8;}else{_0x58ac12=0xce;}_0x33e128[_0x1443('0x20')](_0x58ac12);return _0x33e128[_0x1443('0x27')](_0x1443('0x28'),_0x223e82+'-'+_0x16a9a8+'/'+_0x388216)[_0x1443('0x22')](_0x3e00f8);}return null;};}function patchUpdates(_0x8065bd){return function(_0x5c6821){try{jsonpatch[_0x1443('0x29')](_0x5c6821,_0x8065bd,!![]);}catch(_0x291de6){return BPromise[_0x1443('0x2a')](_0x291de6);}return _0x5c6821[_0x1443('0x2b')]();};}function saveUpdates(_0x1ddba3,_0x1aae1c){return function(_0x166adb){if(_0x166adb){return _0x166adb['update'](_0x1ddba3)[_0x1443('0x2c')](function(_0x3bea27){return _0x3bea27;});}return null;};}function removeEntity(_0x2648aa,_0x1e04d1){return function(_0x493db1){if(_0x493db1){return _0x493db1['destroy']()[_0x1443('0x2c')](function(){var _0x12f564=_0x493db1[_0x1443('0x2d')]({'plain':!![]});var _0x5aee0a=_0x1443('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x5aee0a,'resourceId':_0x12f564['id']}})[_0x1443('0x2c')](function(){return _0x493db1;});})['then'](function(){_0x2648aa[_0x1443('0x20')](0xcc)[_0x1443('0x21')]();});}};}function handleEntityNotFound(_0x37637e,_0x2c36af){return function(_0x45f8ff){if(!_0x45f8ff){_0x37637e[_0x1443('0x1f')](0x194);}return _0x45f8ff;};}function handleError(_0x44878b,_0x778e59){_0x778e59=_0x778e59||0x1f4;return function(_0xcc2f6d){logger['error'](_0xcc2f6d['stack']);if(_0xcc2f6d[_0x1443('0x2f')]){delete _0xcc2f6d['name'];}_0x44878b[_0x1443('0x20')](_0x778e59)['send'](_0xcc2f6d);};}exports[_0x1443('0x30')]=function(_0xdde16d,_0x7ed730){var _0x2eacea={},_0x2bbdbb={},_0x21cea4={'count':0x0,'rows':[]};var _0x146fef=_[_0x1443('0x31')](db[_0x1443('0x32')][_0x1443('0x33')],function(_0x4277ba){return{'name':_0x4277ba['fieldName'],'type':_0x4277ba['type'][_0x1443('0x34')]};});_0x2bbdbb['model']=_[_0x1443('0x31')](_0x146fef,_0x1443('0x2f'));_0x2bbdbb['query']=_['keys'](_0xdde16d[_0x1443('0x35')]);_0x2bbdbb[_0x1443('0x36')]=_['intersection'](_0x2bbdbb['model'],_0x2bbdbb[_0x1443('0x35')]);_0x2eacea[_0x1443('0x37')]=_[_0x1443('0x38')](_0x2bbdbb[_0x1443('0x39')],qs[_0x1443('0x3a')](_0xdde16d['query'][_0x1443('0x3a')]));_0x2eacea[_0x1443('0x37')]=_0x2eacea[_0x1443('0x37')][_0x1443('0x3b')]?_0x2eacea[_0x1443('0x37')]:_0x2bbdbb[_0x1443('0x39')];if(!_0xdde16d[_0x1443('0x35')][_0x1443('0x3c')](_0x1443('0x3d'))){_0x2eacea[_0x1443('0x26')]=qs[_0x1443('0x26')](_0xdde16d[_0x1443('0x35')][_0x1443('0x26')]);_0x2eacea[_0x1443('0x23')]=qs[_0x1443('0x23')](_0xdde16d['query'][_0x1443('0x23')]);}_0x2eacea[_0x1443('0x3e')]=qs['sort'](_0xdde16d['query'][_0x1443('0x3f')]);_0x2eacea[_0x1443('0x40')]=qs[_0x1443('0x36')](_['pick'](_0xdde16d['query'],_0x2bbdbb[_0x1443('0x36')]),_0x146fef);if(_0xdde16d[_0x1443('0x35')][_0x1443('0x41')]){_0x2eacea['where']=_['merge'](_0x2eacea[_0x1443('0x40')],{'$or':_[_0x1443('0x31')](_0x146fef,function(_0x118c72){if(_0x118c72[_0x1443('0x42')]!==_0x1443('0x43')){var _0x43a55b={};_0x43a55b[_0x118c72[_0x1443('0x2f')]]={'$like':'%'+_0xdde16d['query'][_0x1443('0x41')]+'%'};return _0x43a55b;}})});}_0x2eacea=_[_0x1443('0x44')]({},_0x2eacea,_0xdde16d[_0x1443('0x45')]);var _0x93ee4b={'where':_0x2eacea[_0x1443('0x40')]};return db[_0x1443('0x32')][_0x1443('0x25')](_0x93ee4b)[_0x1443('0x2c')](function(_0x57d750){_0x21cea4['count']=_0x57d750;if(_0xdde16d[_0x1443('0x35')][_0x1443('0x46')]){_0x2eacea[_0x1443('0x47')]=[{'all':!![]}];}return db[_0x1443('0x32')]['findAll'](_0x2eacea);})[_0x1443('0x2c')](function(_0x5e4979){_0x21cea4[_0x1443('0x48')]=_0x5e4979;return _0x21cea4;})[_0x1443('0x2c')](respondWithFilteredResult(_0x7ed730,_0x2eacea))['catch'](handleError(_0x7ed730,null));};exports[_0x1443('0x49')]=function(_0x2ce64a,_0x3ac8bc){var _0x8607a={'raw':!![],'where':{'id':_0x2ce64a[_0x1443('0x4a')]['id']}},_0x4600a4={};_0x4600a4[_0x1443('0x39')]=_['keys'](db[_0x1443('0x32')][_0x1443('0x33')]);_0x4600a4[_0x1443('0x35')]=_['keys'](_0x2ce64a[_0x1443('0x35')]);_0x4600a4[_0x1443('0x36')]=_[_0x1443('0x38')](_0x4600a4[_0x1443('0x39')],_0x4600a4[_0x1443('0x35')]);_0x8607a[_0x1443('0x37')]=_['intersection'](_0x4600a4['model'],qs[_0x1443('0x3a')](_0x2ce64a[_0x1443('0x35')][_0x1443('0x3a')]));_0x8607a[_0x1443('0x37')]=_0x8607a['attributes'][_0x1443('0x3b')]?_0x8607a[_0x1443('0x37')]:_0x4600a4[_0x1443('0x39')];if(_0x2ce64a[_0x1443('0x35')][_0x1443('0x46')]){_0x8607a[_0x1443('0x47')]=[{'all':!![]}];}_0x8607a=_[_0x1443('0x44')]({},_0x8607a,_0x2ce64a[_0x1443('0x45')]);return db[_0x1443('0x32')][_0x1443('0x4b')](_0x8607a)[_0x1443('0x2c')](handleEntityNotFound(_0x3ac8bc,null))[_0x1443('0x2c')](respondWithResult(_0x3ac8bc,null))[_0x1443('0x4c')](handleError(_0x3ac8bc,null));};exports['create']=function(_0x3e88dd,_0x7b0a09){return db[_0x1443('0x32')][_0x1443('0x4d')](_0x3e88dd[_0x1443('0x4e')],{})[_0x1443('0x2c')](function(_0x3b1ce0){var _0x49cc08=_0x3e88dd['user'][_0x1443('0x2d')]({'plain':!![]});if(!_0x49cc08)throw new Error(_0x1443('0x4f'));if(_0x49cc08[_0x1443('0x50')]===_0x1443('0x51')){var _0x3eafff=_0x3b1ce0[_0x1443('0x2d')]({'plain':!![]});var _0x6bfc42=_0x1443('0x2e');return db[_0x1443('0x52')][_0x1443('0x4b')]({'where':{'name':_0x6bfc42,'userProfileId':_0x49cc08['userProfileId']},'raw':!![]})[_0x1443('0x2c')](function(_0xf1822){if(_0xf1822&&_0xf1822[_0x1443('0x53')]===0x0){return db[_0x1443('0x54')]['create']({'name':_0x3eafff[_0x1443('0x2f')],'resourceId':_0x3eafff['id'],'type':_0xf1822['name'],'sectionId':_0xf1822['id']},{})[_0x1443('0x2c')](function(){return _0x3b1ce0;});}else{return _0x3b1ce0;}})[_0x1443('0x4c')](function(_0x3762f2){logger[_0x1443('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3762f2);throw _0x3762f2;});}return _0x3b1ce0;})[_0x1443('0x2c')](respondWithResult(_0x7b0a09,0xc9))[_0x1443('0x4c')](handleError(_0x7b0a09,null));};exports[_0x1443('0x56')]=function(_0x299882,_0x20aa63){if(_0x299882['body']['id']){delete _0x299882[_0x1443('0x4e')]['id'];}return db[_0x1443('0x32')]['find']({'where':{'id':_0x299882[_0x1443('0x4a')]['id']}})[_0x1443('0x2c')](handleEntityNotFound(_0x20aa63,null))['then'](saveUpdates(_0x299882['body'],null))['then'](respondWithResult(_0x20aa63,null))[_0x1443('0x4c')](handleError(_0x20aa63,null));};exports[_0x1443('0x57')]=function(_0x2961f1,_0x444f5f){return db[_0x1443('0x32')][_0x1443('0x4b')]({'where':{'id':_0x2961f1[_0x1443('0x4a')]['id']}})[_0x1443('0x2c')](handleEntityNotFound(_0x444f5f,null))[_0x1443('0x2c')](removeEntity(_0x444f5f,null))[_0x1443('0x4c')](handleError(_0x444f5f,null));};exports[_0x1443('0x58')]=function(_0x19a919,_0x1a45bd){return db[_0x1443('0x32')][_0x1443('0x58')]()[_0x1443('0x2c')](respondWithResult(_0x1a45bd,null))['catch'](handleError(_0x1a45bd,null));};exports[_0x1443('0x59')]=function(_0x287fdc,_0xcda2e2,_0x4f64f2){var _0x7f5333={'raw':!![],'where':{}},_0x1d36a2={},_0x3ad8bb;return db[_0x1443('0x32')]['findOne']({'where':{'id':_0x287fdc[_0x1443('0x4a')]['id']}})[_0x1443('0x2c')](handleEntityNotFound(_0xcda2e2,null))[_0x1443('0x2c')](function(_0x3062c2){if(_0x3062c2){_0x3ad8bb=_0x3062c2[_0x1443('0x2d')]({'plain':!![]});_0x1d36a2['model']=_['keys'](db[_0x1443('0x5a')][_0x1443('0x33')]);_0x1d36a2[_0x1443('0x35')]=_[_0x1443('0x5b')](_0x287fdc[_0x1443('0x35')]);_0x1d36a2[_0x1443('0x36')]=_[_0x1443('0x38')](_0x1d36a2[_0x1443('0x39')],_0x1d36a2['query']);_0x7f5333[_0x1443('0x37')]=_[_0x1443('0x38')](_0x1d36a2[_0x1443('0x39')],qs[_0x1443('0x3a')](_0x287fdc[_0x1443('0x35')][_0x1443('0x3a')]));_0x7f5333['attributes']=_0x7f5333[_0x1443('0x37')][_0x1443('0x3b')]?_0x7f5333['attributes']:_0x1d36a2[_0x1443('0x39')];if(!_0x287fdc[_0x1443('0x35')][_0x1443('0x3c')](_0x1443('0x3d'))){_0x7f5333[_0x1443('0x26')]=qs[_0x1443('0x26')](_0x287fdc[_0x1443('0x35')][_0x1443('0x26')]);_0x7f5333[_0x1443('0x23')]=qs[_0x1443('0x23')](_0x287fdc[_0x1443('0x35')][_0x1443('0x23')]);}_0x7f5333[_0x1443('0x3e')]=qs[_0x1443('0x3f')](_0x287fdc[_0x1443('0x35')][_0x1443('0x3f')]);_0x7f5333[_0x1443('0x40')]=qs[_0x1443('0x36')](_[_0x1443('0x5c')](_0x287fdc[_0x1443('0x35')],_0x1d36a2['filters']));_0x7f5333[_0x1443('0x40')][_0x1443('0x5d')]=_0x3062c2['id'];if(_0x287fdc[_0x1443('0x35')][_0x1443('0x41')]){_0x7f5333['where']=_[_0x1443('0x44')](_0x7f5333[_0x1443('0x40')],{'$or':_[_0x1443('0x31')](_0x7f5333[_0x1443('0x37')],function(_0x2590a3){var _0x572ac3={};_0x572ac3[_0x2590a3]={'$like':'%'+_0x287fdc['query']['filter']+'%'};return _0x572ac3;})});}_0x7f5333=_['merge']({},_0x7f5333,_0x287fdc[_0x1443('0x45')]);return db[_0x1443('0x5a')][_0x1443('0x5e')](_0x7f5333);}})[_0x1443('0x2c')](function(_0x1cd805){if(_0x1cd805){return db[_0x1443('0x5f')][_0x1443('0x60')]({'where':{'id':_[_0x1443('0x31')](_0x1cd805,_0x1443('0x61')),'role':_0x1443('0x62')},'attributes':['id',_0x1443('0x2f'),'mailPause',_0x1443('0x63'),_0x1443('0x64')]});}})[_0x1443('0x2c')](function(_0x131a76){if(_0x131a76){return{'count':_0x131a76[_0x1443('0x25')],'rows':_[_0x1443('0x31')](_0x131a76['rows'],function(_0x2f30f0){return{'membername':_0x2f30f0['name'],'UserId':_0x2f30f0['id'],'queue_name':_0x3ad8bb[_0x1443('0x2f')],'MailQueueId':_0x3ad8bb['id'],'interface':util['format'](_0x1443('0x65'),'SIP',_0x2f30f0[_0x1443('0x2f')]),'penalty':0x0,'paused':_0x2f30f0['mailPause'],'createdAt':_0x2f30f0[_0x1443('0x64')],'updatedAt':_0x2f30f0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1443('0x2c')](respondWithFilteredResult(_0xcda2e2,_0x7f5333))[_0x1443('0x4c')](handleError(_0xcda2e2,null));};exports[_0x1443('0x66')]=function(_0x183bed,_0x746d32,_0xa2cf94){var _0x35aceb={};var _0x1a9fc6={};var _0x2c50cb;var _0xcd09aa;return db[_0x1443('0x32')][_0x1443('0x67')]({'where':{'id':_0x183bed[_0x1443('0x4a')]['id']}})[_0x1443('0x2c')](handleEntityNotFound(_0x746d32,null))[_0x1443('0x2c')](function(_0xc8df7){if(_0xc8df7){_0x2c50cb=_0xc8df7;_0x1a9fc6['model']=_['keys'](db['Team'][_0x1443('0x33')]);_0x1a9fc6['query']=_[_0x1443('0x5b')](_0x183bed[_0x1443('0x35')]);_0x1a9fc6[_0x1443('0x36')]=_[_0x1443('0x38')](_0x1a9fc6[_0x1443('0x39')],_0x1a9fc6['query']);_0x35aceb[_0x1443('0x37')]=_[_0x1443('0x38')](_0x1a9fc6[_0x1443('0x39')],qs['fields'](_0x183bed['query']['fields']));_0x35aceb[_0x1443('0x37')]=_0x35aceb[_0x1443('0x37')][_0x1443('0x3b')]?_0x35aceb[_0x1443('0x37')]:_0x1a9fc6[_0x1443('0x39')];_0x35aceb['order']=qs[_0x1443('0x3f')](_0x183bed[_0x1443('0x35')][_0x1443('0x3f')]);_0x35aceb[_0x1443('0x40')]=qs['filters'](_[_0x1443('0x5c')](_0x183bed[_0x1443('0x35')],_0x1a9fc6[_0x1443('0x36')]));if(_0x183bed[_0x1443('0x35')][_0x1443('0x41')]){_0x35aceb[_0x1443('0x40')]=_[_0x1443('0x44')](_0x35aceb[_0x1443('0x40')],{'$or':_[_0x1443('0x31')](_0x35aceb[_0x1443('0x37')],function(_0x5adfc2){var _0x3dee31={};_0x3dee31[_0x5adfc2]={'$like':'%'+_0x183bed[_0x1443('0x35')][_0x1443('0x41')]+'%'};return _0x3dee31;})});}_0x35aceb=_['merge']({},_0x35aceb,_0x183bed[_0x1443('0x45')]);return _0x2c50cb[_0x1443('0x66')](_0x35aceb);}})[_0x1443('0x2c')](function(_0xfcef2b){if(_0xfcef2b){_0xcd09aa=_0xfcef2b[_0x1443('0x3b')];if(!_0x183bed[_0x1443('0x35')][_0x1443('0x3c')](_0x1443('0x3d'))){_0x35aceb[_0x1443('0x26')]=qs[_0x1443('0x26')](_0x183bed[_0x1443('0x35')][_0x1443('0x26')]);_0x35aceb[_0x1443('0x23')]=qs[_0x1443('0x23')](_0x183bed['query'][_0x1443('0x23')]);}return _0x2c50cb[_0x1443('0x66')](_0x35aceb);}})['then'](function(_0x2067bb){if(_0x2067bb){return _0x2067bb?{'count':_0xcd09aa,'rows':_0x2067bb}:null;}})[_0x1443('0x2c')](respondWithResult(_0x746d32,null))['catch'](handleError(_0x746d32,null));};exports['addTeams']=function(_0x2868a6,_0x4f98f,_0x2b2e92){var _0x4dce3d=_0x2868a6[_0x1443('0x4e')][_0x1443('0x68')];return db['Team'][_0x1443('0x5e')]({'where':{'id':_0x4dce3d},'attributes':['id'],'include':[{'model':db[_0x1443('0x5f')],'as':_0x1443('0x69'),'attributes':['id',_0x1443('0x2f'),'online','voicePause',_0x1443('0x6a')],'raw':!![]}]})[_0x1443('0x2c')](function(_0x56c4d7){if(_0x56c4d7){var _0x5873fc=_[_0x1443('0x6b')](_0x56c4d7,function(_0x19f248){var _0x2d5101=_0x19f248[_0x1443('0x2d')]({'plain':!![]});return _0x2d5101[_0x1443('0x69')];});return db[_0x1443('0x32')][_0x1443('0x4b')]({'where':{'id':_0x2868a6[_0x1443('0x4a')]['id']}})['then'](function(_0x196eec){return db['sequelize'][_0x1443('0x6c')](function(_0x26b9ea){return _0x196eec[_0x1443('0x6d')](_0x4dce3d,{'transaction':_0x26b9ea})[_0x1443('0x2c')](function(){return BPromise[_0x1443('0x6e')](_0x5873fc,function(_0x25fed4){return db[_0x1443('0x5a')]['findOrCreate']({'where':{'UserId':_0x25fed4['id'],'MailQueueId':_0x2868a6['params']['id']},'transaction':_0x26b9ea});});})[_0x1443('0x2c')](function(){_0x5873fc['forEach'](function(_0x286ce2){socket[_0x1443('0x6f')](_0x1443('0x70'),{'UserId':_0x286ce2['id'],'MailQueueId':_0x196eec['id']});});});});});}})[_0x1443('0x2c')](respondWithStatusCode(_0x4f98f,null))[_0x1443('0x4c')](handleError(_0x4f98f,null));};exports[_0x1443('0x71')]=function(_0x5e2ec4,_0x3722b1,_0xf63292){return db[_0x1443('0x72')][_0x1443('0x5e')]({'where':{'id':_0x5e2ec4['query'][_0x1443('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1443('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3722b1,null))[_0x1443('0x2c')](function(_0x59b076){var _0x1c3a8c=_['map'](_0x59b076,'id');var _0x89927d=[];var _0x23cede=[];var _0x4b5d0c=squel[_0x1443('0x73')]();_0x4b5d0c[_0x1443('0x74')]('tq.TeamId')[_0x1443('0x75')](_0x1443('0x76'),'tq')['join'](_0x1443('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x1443('0x78'),_0x5e2ec4[_0x1443('0x4a')]['id']);for(var _0x4a4bc8=0x0;_0x4a4bc8<_0x59b076[_0x1443('0x3b')];_0x4a4bc8+=0x1){let _0x3a127c=_0x59b076[_0x4a4bc8];for(var _0x37bad3=0x0;_0x37bad3<_0x3a127c[_0x1443('0x69')][_0x1443('0x3b')];_0x37bad3+=0x1){let _0x521bc0=_0x3a127c['Agents'][_0x37bad3];var _0x209f73=_0x4b5d0c[_0x1443('0x79')]();_0x209f73['where']('ut.UserId\x20=\x20?',_0x521bc0['id']);_0x23cede[_0x1443('0x7a')](db[_0x1443('0x7b')]['query'](_0x209f73['toString'](),{'type':db[_0x1443('0x7b')][_0x1443('0x7c')]['SELECT']})['then'](function(_0x22b91b){if(_0x22b91b[_0x1443('0x3b')]===0x1){return _0x521bc0['id'];}else{var _0x26887d=_[_0x1443('0x7d')](_[_0x1443('0x31')](_0x22b91b,_0x1443('0x7e')),function(_0x23821d){return _[_0x1443('0x7f')](_0x1c3a8c,_0x23821d);});if(_0x26887d){return _0x521bc0['id'];}}}));}}return BPromise[_0x1443('0x80')](_0x23cede)[_0x1443('0x2c')](function(_0x175229){_0x89927d=_(_0x89927d)[_0x1443('0x81')](_0x175229)['compact']()[_0x1443('0x82')]();return db['MailQueue'][_0x1443('0x4b')]({'where':{'id':_0x5e2ec4[_0x1443('0x4a')]['id']}})[_0x1443('0x2c')](function(_0x1707f2){return db[_0x1443('0x7b')][_0x1443('0x6c')](function(_0xa1390e){return _0x1707f2[_0x1443('0x71')](_0x5e2ec4[_0x1443('0x35')]['ids'],{'transaction':_0xa1390e})[_0x1443('0x2c')](function(){if(!_[_0x1443('0x83')](_0x89927d)){return _0x1707f2[_0x1443('0x84')](_0x89927d,{'transaction':_0xa1390e});}})[_0x1443('0x2c')](function(){_0x89927d[_0x1443('0x85')](function(_0x34e951){socket[_0x1443('0x6f')]('userMailQueue:remove',{'UserId':_0x34e951,'MailQueueId':_0x1707f2['id']});});});});});});})['then'](respondWithStatusCode(_0x3722b1,null))[_0x1443('0x4c')](handleError(_0x3722b1,null));};exports[_0x1443('0x86')]=function(_0x45763d,_0x446d95,_0xfa090d){return db[_0x1443('0x32')][_0x1443('0x4b')]({'where':{'id':_0x45763d[_0x1443('0x4a')]['id']}})['then'](handleEntityNotFound(_0x446d95,null))[_0x1443('0x2c')](function(_0x4a88dc){if(_0x4a88dc){return _0x4a88dc[_0x1443('0x86')](_0x45763d['body'][_0x1443('0x68')],_['omit'](_0x45763d['body'],[_0x1443('0x68'),'id'])||{})[_0x1443('0x87')](function(_0x1a620a){for(var _0x19914c=0x0;_0x19914c<_0x45763d[_0x1443('0x4e')][_0x1443('0x68')][_0x1443('0x3b')];_0x19914c+=0x1){socket[_0x1443('0x6f')](_0x1443('0x70'),{'UserId':Number(_0x45763d[_0x1443('0x4e')][_0x1443('0x68')][_0x19914c]),'MailQueueId':Number(_0x45763d[_0x1443('0x4a')]['id'])});}return _0x1a620a;});}})[_0x1443('0x2c')](respondWithResult(_0x446d95,null))[_0x1443('0x4c')](handleError(_0x446d95,null));};exports['removeAgents']=function(_0x5baa21,_0x599f65,_0x2825f9){return db[_0x1443('0x32')][_0x1443('0x4b')]({'where':{'id':_0x5baa21['params']['id']}})[_0x1443('0x2c')](handleEntityNotFound(_0x599f65,null))['then'](function(_0x2f68e1){if(_0x2f68e1){return _0x2f68e1[_0x1443('0x84')](_0x5baa21[_0x1443('0x35')][_0x1443('0x68')])[_0x1443('0x2c')](function(){if(_[_0x1443('0x88')](_0x5baa21[_0x1443('0x35')][_0x1443('0x68')])){for(var _0x117b00=0x0;_0x117b00<_0x5baa21[_0x1443('0x35')][_0x1443('0x68')][_0x1443('0x3b')];_0x117b00+=0x1){socket[_0x1443('0x6f')](_0x1443('0x89'),{'UserId':Number(_0x5baa21[_0x1443('0x35')]['ids'][_0x117b00]),'MailQueueId':Number(_0x5baa21[_0x1443('0x4a')]['id'])});}}else{socket[_0x1443('0x6f')](_0x1443('0x89'),{'UserId':Number(_0x5baa21[_0x1443('0x35')][_0x1443('0x68')]),'MailQueueId':Number(_0x5baa21[_0x1443('0x4a')]['id'])});}});}})[_0x1443('0x2c')](respondWithStatusCode(_0x599f65,null))[_0x1443('0x4c')](handleError(_0x599f65,null));};exports['getAgents']=function(_0x1048c4,_0x215997,_0x1b1310){var _0x4706aa={};var _0x2e5b1c={};var _0xa27445;var _0x12f104;return db[_0x1443('0x32')][_0x1443('0x67')]({'where':{'id':_0x1048c4[_0x1443('0x4a')]['id']}})[_0x1443('0x2c')](handleEntityNotFound(_0x215997,null))[_0x1443('0x2c')](function(_0x4bea1c){if(_0x4bea1c){_0xa27445=_0x4bea1c;_0x2e5b1c['model']=_[_0x1443('0x5b')](db['User'][_0x1443('0x33')]);_0x2e5b1c['query']=_[_0x1443('0x5b')](_0x1048c4['query']);_0x2e5b1c[_0x1443('0x36')]=_[_0x1443('0x38')](_0x2e5b1c[_0x1443('0x39')],_0x2e5b1c[_0x1443('0x35')]);_0x4706aa['attributes']=_[_0x1443('0x38')](_0x2e5b1c['model'],qs[_0x1443('0x3a')](_0x1048c4['query'][_0x1443('0x3a')]));_0x4706aa[_0x1443('0x37')]=_0x4706aa[_0x1443('0x37')]['length']?_0x4706aa['attributes']:_0x2e5b1c['model'];_0x4706aa[_0x1443('0x3e')]=qs[_0x1443('0x3f')](_0x1048c4['query']['sort']);_0x4706aa[_0x1443('0x40')]=qs['filters'](_[_0x1443('0x5c')](_0x1048c4[_0x1443('0x35')],_0x2e5b1c[_0x1443('0x36')]));if(_0x1048c4[_0x1443('0x35')][_0x1443('0x41')]){_0x4706aa[_0x1443('0x40')]=_[_0x1443('0x44')](_0x4706aa[_0x1443('0x40')],{'$or':_[_0x1443('0x31')](_0x4706aa[_0x1443('0x37')],function(_0x124bad){var _0x2c4429={};_0x2c4429[_0x124bad]={'$like':'%'+_0x1048c4[_0x1443('0x35')][_0x1443('0x41')]+'%'};return _0x2c4429;})});}_0x4706aa=_[_0x1443('0x44')]({},_0x4706aa,_0x1048c4[_0x1443('0x45')]);return _0xa27445['getAgents'](_0x4706aa);}})['then'](function(_0x24bc78){if(_0x24bc78){_0x12f104=_0x24bc78[_0x1443('0x3b')];if(!_0x1048c4[_0x1443('0x35')][_0x1443('0x3c')](_0x1443('0x3d'))){_0x4706aa[_0x1443('0x26')]=qs[_0x1443('0x26')](_0x1048c4[_0x1443('0x35')][_0x1443('0x26')]);_0x4706aa['offset']=qs[_0x1443('0x23')](_0x1048c4[_0x1443('0x35')][_0x1443('0x23')]);}return _0xa27445[_0x1443('0x8a')](_0x4706aa);}})['then'](function(_0x1a2301){if(_0x1a2301){return _0x1a2301?{'count':_0x12f104,'rows':_0x1a2301}:null;}})['then'](respondWithResult(_0x215997,null))['catch'](handleError(_0x215997,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 6c2d705..a626f6f 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 _0x2ddf=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x476852,_0x2a66c0){var _0x5ce4e5=function(_0x5c8258){while(--_0x5c8258){_0x476852['push'](_0x476852['shift']());}};_0x5ce4e5(++_0x2a66c0);}(_0x2ddf,0x18a));var _0xf2dd=function(_0x1586da,_0x4d4ce0){_0x1586da=_0x1586da-0x0;var _0x190021=_0x2ddf[_0x1586da];return _0x190021;};'use strict';var EventEmitter=require(_0xf2dd('0x0'));var MailQueue=require(_0xf2dd('0x1'))['db'][_0xf2dd('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf2dd('0x3')](0x0);var events={'afterCreate':_0xf2dd('0x4'),'afterUpdate':_0xf2dd('0x5'),'afterDestroy':_0xf2dd('0x6')};function emitEvent(_0x29240d){return function(_0x494c9a,_0x4f6b07,_0xbb331f){MailQueueEvents[_0xf2dd('0x7')](_0x29240d+':'+_0x494c9a['id'],_0x494c9a);MailQueueEvents[_0xf2dd('0x7')](_0x29240d,_0x494c9a);_0xbb331f(null);};}for(var e in events){if(events[_0xf2dd('0x8')](e)){var event=events[e];MailQueue[_0xf2dd('0x9')](e,emitEvent(event));}}module[_0xf2dd('0xa')]=MailQueueEvents; \ No newline at end of file +var _0x0b88=['emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove'];(function(_0x406d93,_0x25ccfb){var _0x1654e3=function(_0x5b7b4b){while(--_0x5b7b4b){_0x406d93['push'](_0x406d93['shift']());}};_0x1654e3(++_0x25ccfb);}(_0x0b88,0x1e3));var _0x80b8=function(_0x3eb314,_0xf71211){_0x3eb314=_0x3eb314-0x0;var _0x398881=_0x0b88[_0x3eb314];return _0x398881;};'use strict';var EventEmitter=require(_0x80b8('0x0'));var MailQueue=require(_0x80b8('0x1'))['db'][_0x80b8('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x80b8('0x3')](0x0);var events={'afterCreate':_0x80b8('0x4'),'afterUpdate':_0x80b8('0x5'),'afterDestroy':_0x80b8('0x6')};function emitEvent(_0x3d947a){return function(_0x223b4b,_0x4d61cb,_0x556bf8){MailQueueEvents[_0x80b8('0x7')](_0x3d947a+':'+_0x223b4b['id'],_0x223b4b);MailQueueEvents[_0x80b8('0x7')](_0x3d947a,_0x223b4b);_0x556bf8(null);};}for(var e in events){if(events[_0x80b8('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x80b8('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 5363df5..86dacc1 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 _0x6a45=['exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x2eda7f,_0x2ce49c){var _0x16a6c5=function(_0x4ed586){while(--_0x4ed586){_0x2eda7f['push'](_0x2eda7f['shift']());}};_0x16a6c5(++_0x2ce49c);}(_0x6a45,0x1e4));var _0x56a4=function(_0x5167cb,_0x321546){_0x5167cb=_0x5167cb-0x0;var _0x86a88e=_0x6a45[_0x5167cb];return _0x86a88e;};'use strict';var _=require(_0x56a4('0x0'));var util=require(_0x56a4('0x1'));var logger=require(_0x56a4('0x2'))(_0x56a4('0x3'));var moment=require(_0x56a4('0x4'));var BPromise=require(_0x56a4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a4('0x6'));var rimraf=require(_0x56a4('0x7'));var config=require(_0x56a4('0x8'));var attributes=require(_0x56a4('0x9'));module[_0x56a4('0xa')]=function(_0x4cbb3e,_0x3b8fa2){return _0x4cbb3e['define'](_0x56a4('0xb'),attributes,{'tableName':_0x56a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fed=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','util','../../config/logger','api'];(function(_0x237933,_0x2a5a52){var _0x206c5e=function(_0x2ddc0f){while(--_0x2ddc0f){_0x237933['push'](_0x237933['shift']());}};_0x206c5e(++_0x2a5a52);}(_0x3fed,0xf9));var _0xd3fe=function(_0x2a85ee,_0x1e9be0){_0x2a85ee=_0x2a85ee-0x0;var _0x36d691=_0x3fed[_0x2a85ee];return _0x36d691;};'use strict';var _=require('lodash');var util=require(_0xd3fe('0x0'));var logger=require(_0xd3fe('0x1'))(_0xd3fe('0x2'));var moment=require('moment');var BPromise=require(_0xd3fe('0x3'));var rp=require(_0xd3fe('0x4'));var fs=require('fs');var path=require(_0xd3fe('0x5'));var rimraf=require(_0xd3fe('0x6'));var config=require(_0xd3fe('0x7'));var attributes=require(_0xd3fe('0x8'));module['exports']=function(_0x2b615d,_0x103c99){return _0x2b615d[_0xd3fe('0x9')](_0xd3fe('0xa'),attributes,{'tableName':_0xd3fe('0xb'),'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 cc270c0..f89ab03 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 _0x5686=['localhost','socket.io-emitter','register','request','then','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','GetMailQueue','options','where','attributes','limit','include','map','model','ShowMailQueue','MailQueue','find','raw','debug','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults'];(function(_0x4d747a,_0x3b0e75){var _0xf465ee=function(_0xda6a81){while(--_0xda6a81){_0x4d747a['push'](_0x4d747a['shift']());}};_0xf465ee(++_0x3b0e75);}(_0x5686,0xbc));var _0x6568=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x5686[_0x4b7d87];return _0x3b9f82;};'use strict';var _=require('lodash');var util=require(_0x6568('0x0'));var moment=require(_0x6568('0x1'));var BPromise=require('bluebird');var rs=require(_0x6568('0x2'));var fs=require('fs');var Redis=require(_0x6568('0x3'));var db=require(_0x6568('0x4'))['db'];var utils=require(_0x6568('0x5'));var logger=require(_0x6568('0x6'))(_0x6568('0x7'));var config=require(_0x6568('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6568('0x9')]['http']({'port':0x232a});config[_0x6568('0xa')]=_[_0x6568('0xb')](config['redis'],{'host':_0x6568('0xc'),'port':0x18eb});var socket=require(_0x6568('0xd'))(new Redis(config[_0x6568('0xa')]));require('./mailQueue.socket')[_0x6568('0xe')](socket);function respondWithRpcPromise(_0x5ab4be,_0x2d75ab,_0x145c5f){return new BPromise(function(_0x1a9766,_0x4ad38d){return client[_0x6568('0xf')](_0x5ab4be,_0x145c5f)[_0x6568('0x10')](function(_0xc7109d){logger['info'](_0x6568('0x11'),_0x2d75ab,'request\x20sent');logger['debug'](_0x6568('0x12'),_0x2d75ab,'request\x20sent',JSON['stringify'](_0xc7109d));if(_0xc7109d[_0x6568('0x13')]){if(_0xc7109d[_0x6568('0x13')][_0x6568('0x14')]===0x1f4){logger[_0x6568('0x13')](_0x6568('0x11'),_0x2d75ab,_0xc7109d['error'][_0x6568('0x15')]);return _0x4ad38d(_0xc7109d[_0x6568('0x13')][_0x6568('0x15')]);}logger[_0x6568('0x13')](_0x6568('0x11'),_0x2d75ab,_0xc7109d[_0x6568('0x13')][_0x6568('0x15')]);return _0x1a9766(_0xc7109d[_0x6568('0x13')][_0x6568('0x15')]);}else{logger[_0x6568('0x16')]('MailQueue,\x20%s,\x20%s',_0x2d75ab,_0x6568('0x17'));_0x1a9766(_0xc7109d[_0x6568('0x18')][_0x6568('0x15')]);}})[_0x6568('0x19')](function(_0x2f3cbc){logger[_0x6568('0x13')](_0x6568('0x11'),_0x2d75ab,_0x2f3cbc);_0x4ad38d(_0x2f3cbc);});});}exports[_0x6568('0x1a')]=function(_0x854239){var _0x4f1bc9=this;return new Promise(function(_0x24fc25,_0x556659){return db['MailQueue']['findAll']({'raw':_0x854239[_0x6568('0x1b')]?_0x854239[_0x6568('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x854239[_0x6568('0x1b')]?_0x854239['options'][_0x6568('0x1c')]||null:null,'attributes':_0x854239[_0x6568('0x1b')]?_0x854239[_0x6568('0x1b')][_0x6568('0x1d')]||null:null,'limit':_0x854239[_0x6568('0x1b')]?_0x854239['options'][_0x6568('0x1e')]||null:null,'include':_0x854239[_0x6568('0x1b')]?_0x854239[_0x6568('0x1b')][_0x6568('0x1f')]?_[_0x6568('0x20')](_0x854239[_0x6568('0x1b')][_0x6568('0x1f')],function(_0x3f6a8e){return{'model':db[_0x3f6a8e['model']],'as':_0x3f6a8e['as'],'attributes':_0x3f6a8e[_0x6568('0x1d')],'include':_0x3f6a8e[_0x6568('0x1f')]?_['map'](_0x3f6a8e[_0x6568('0x1f')],function(_0x2db85f){return{'model':db[_0x2db85f[_0x6568('0x21')]],'as':_0x2db85f['as'],'attributes':_0x2db85f[_0x6568('0x1d')],'include':_0x2db85f['include']?_['map'](_0x2db85f[_0x6568('0x1f')],function(_0x51c01f){return{'model':db[_0x51c01f['model']],'as':_0x51c01f['as'],'attributes':_0x51c01f[_0x6568('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14f770){logger[_0x6568('0x16')]('GetMailQueue',_0x854239);logger['debug']('GetMailQueue',_0x854239,JSON['stringify'](_0x14f770));_0x24fc25(_0x14f770);})['catch'](function(_0x428eeb){logger[_0x6568('0x13')]('GetMailQueue',_0x428eeb[_0x6568('0x15')],_0x854239);_0x556659(_0x4f1bc9['error'](0x1f4,_0x428eeb['message']));});});};exports[_0x6568('0x22')]=function(_0x2c4f6a){var _0x25608a=this;return new Promise(function(_0x1fcec7,_0x63ddc0){return db[_0x6568('0x23')][_0x6568('0x24')]({'raw':_0x2c4f6a[_0x6568('0x1b')]?_0x2c4f6a[_0x6568('0x1b')][_0x6568('0x25')]===undefined?!![]:![]:!![],'where':_0x2c4f6a[_0x6568('0x1b')]?_0x2c4f6a[_0x6568('0x1b')][_0x6568('0x1c')]||null:null,'attributes':_0x2c4f6a[_0x6568('0x1b')]?_0x2c4f6a[_0x6568('0x1b')][_0x6568('0x1d')]||null:null,'include':_0x2c4f6a['options']?_0x2c4f6a['options'][_0x6568('0x1f')]?_[_0x6568('0x20')](_0x2c4f6a['options']['include'],function(_0x654fd7){return{'model':db[_0x654fd7[_0x6568('0x21')]],'as':_0x654fd7['as'],'attributes':_0x654fd7[_0x6568('0x1d')],'include':_0x654fd7['include']?_['map'](_0x654fd7[_0x6568('0x1f')],function(_0x44ba5d){return{'model':db[_0x44ba5d['model']],'as':_0x44ba5d['as'],'attributes':_0x44ba5d[_0x6568('0x1d')],'include':_0x44ba5d[_0x6568('0x1f')]?_[_0x6568('0x20')](_0x44ba5d[_0x6568('0x1f')],function(_0x3e3fa8){return{'model':db[_0x3e3fa8[_0x6568('0x21')]],'as':_0x3e3fa8['as'],'attributes':_0x3e3fa8[_0x6568('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6568('0x10')](function(_0x335311){logger[_0x6568('0x16')](_0x6568('0x22'),_0x2c4f6a);logger[_0x6568('0x26')]('ShowMailQueue',_0x2c4f6a,JSON[_0x6568('0x27')](_0x335311));_0x1fcec7(_0x335311);})[_0x6568('0x19')](function(_0x40baf1){logger[_0x6568('0x13')]('ShowMailQueue',_0x40baf1[_0x6568('0x15')],_0x2c4f6a);_0x63ddc0(_0x25608a[_0x6568('0x13')](0x1f4,_0x40baf1[_0x6568('0x15')]));});});}; \ No newline at end of file +var _0x1a4b=['request\x20sent','debug','stringify','code','error','message','result','MailQueue','findAll','options','limit','include','map','model','attributes','GetMailQueue','ShowMailQueue','find','raw','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s'];(function(_0x3661fb,_0x7d9f6e){var _0x523e4e=function(_0x7b9e42){while(--_0x7b9e42){_0x3661fb['push'](_0x3661fb['shift']());}};_0x523e4e(++_0x7d9f6e);}(_0x1a4b,0x86));var _0xb1a4=function(_0x3839eb,_0x50a888){_0x3839eb=_0x3839eb-0x0;var _0x487656=_0x1a4b[_0x3839eb];return _0x487656;};'use strict';var _=require('lodash');var util=require(_0xb1a4('0x0'));var moment=require(_0xb1a4('0x1'));var BPromise=require(_0xb1a4('0x2'));var rs=require(_0xb1a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb1a4('0x4'));var logger=require(_0xb1a4('0x5'))('rpc');var config=require(_0xb1a4('0x6'));var jayson=require(_0xb1a4('0x7'));var client=jayson[_0xb1a4('0x8')][_0xb1a4('0x9')]({'port':0x232a});config[_0xb1a4('0xa')]=_['defaults'](config[_0xb1a4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb1a4('0xb'))(new Redis(config['redis']));require(_0xb1a4('0xc'))[_0xb1a4('0xd')](socket);function respondWithRpcPromise(_0x51db3b,_0x408333,_0x2439c8){return new BPromise(function(_0x1e3157,_0x4345fa){return client[_0xb1a4('0xe')](_0x51db3b,_0x2439c8)[_0xb1a4('0xf')](function(_0x2e1a56){logger[_0xb1a4('0x10')](_0xb1a4('0x11'),_0x408333,_0xb1a4('0x12'));logger[_0xb1a4('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x408333,_0xb1a4('0x12'),JSON[_0xb1a4('0x14')](_0x2e1a56));if(_0x2e1a56['error']){if(_0x2e1a56['error'][_0xb1a4('0x15')]===0x1f4){logger[_0xb1a4('0x16')](_0xb1a4('0x11'),_0x408333,_0x2e1a56[_0xb1a4('0x16')][_0xb1a4('0x17')]);return _0x4345fa(_0x2e1a56[_0xb1a4('0x16')][_0xb1a4('0x17')]);}logger[_0xb1a4('0x16')](_0xb1a4('0x11'),_0x408333,_0x2e1a56[_0xb1a4('0x16')][_0xb1a4('0x17')]);return _0x1e3157(_0x2e1a56['error'][_0xb1a4('0x17')]);}else{logger[_0xb1a4('0x10')]('MailQueue,\x20%s,\x20%s',_0x408333,_0xb1a4('0x12'));_0x1e3157(_0x2e1a56[_0xb1a4('0x18')][_0xb1a4('0x17')]);}})['catch'](function(_0x3b8cb7){logger[_0xb1a4('0x16')](_0xb1a4('0x11'),_0x408333,_0x3b8cb7);_0x4345fa(_0x3b8cb7);});});}exports['GetMailQueue']=function(_0x1f26ad){var _0x11e33a=this;return new Promise(function(_0x36cc2f,_0x2ae17c){return db[_0xb1a4('0x19')][_0xb1a4('0x1a')]({'raw':_0x1f26ad['options']?_0x1f26ad[_0xb1a4('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1f26ad[_0xb1a4('0x1b')]?_0x1f26ad['options']['where']||null:null,'attributes':_0x1f26ad['options']?_0x1f26ad[_0xb1a4('0x1b')]['attributes']||null:null,'limit':_0x1f26ad[_0xb1a4('0x1b')]?_0x1f26ad['options'][_0xb1a4('0x1c')]||null:null,'include':_0x1f26ad['options']?_0x1f26ad[_0xb1a4('0x1b')][_0xb1a4('0x1d')]?_['map'](_0x1f26ad[_0xb1a4('0x1b')]['include'],function(_0x53e0e9){return{'model':db[_0x53e0e9['model']],'as':_0x53e0e9['as'],'attributes':_0x53e0e9['attributes'],'include':_0x53e0e9[_0xb1a4('0x1d')]?_[_0xb1a4('0x1e')](_0x53e0e9[_0xb1a4('0x1d')],function(_0x59cbdd){return{'model':db[_0x59cbdd[_0xb1a4('0x1f')]],'as':_0x59cbdd['as'],'attributes':_0x59cbdd[_0xb1a4('0x20')],'include':_0x59cbdd[_0xb1a4('0x1d')]?_[_0xb1a4('0x1e')](_0x59cbdd[_0xb1a4('0x1d')],function(_0x40207a){return{'model':db[_0x40207a['model']],'as':_0x40207a['as'],'attributes':_0x40207a[_0xb1a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb1a4('0xf')](function(_0x5ff6d9){logger[_0xb1a4('0x10')](_0xb1a4('0x21'),_0x1f26ad);logger[_0xb1a4('0x13')](_0xb1a4('0x21'),_0x1f26ad,JSON[_0xb1a4('0x14')](_0x5ff6d9));_0x36cc2f(_0x5ff6d9);})['catch'](function(_0x27ddf3){logger['error'](_0xb1a4('0x21'),_0x27ddf3['message'],_0x1f26ad);_0x2ae17c(_0x11e33a[_0xb1a4('0x16')](0x1f4,_0x27ddf3[_0xb1a4('0x17')]));});});};exports[_0xb1a4('0x22')]=function(_0x3660d0){var _0x4f2806=this;return new Promise(function(_0x68bb37,_0x22b1b1){return db[_0xb1a4('0x19')][_0xb1a4('0x23')]({'raw':_0x3660d0[_0xb1a4('0x1b')]?_0x3660d0[_0xb1a4('0x1b')][_0xb1a4('0x24')]===undefined?!![]:![]:!![],'where':_0x3660d0['options']?_0x3660d0['options']['where']||null:null,'attributes':_0x3660d0['options']?_0x3660d0[_0xb1a4('0x1b')][_0xb1a4('0x20')]||null:null,'include':_0x3660d0['options']?_0x3660d0[_0xb1a4('0x1b')][_0xb1a4('0x1d')]?_[_0xb1a4('0x1e')](_0x3660d0[_0xb1a4('0x1b')]['include'],function(_0x303e77){return{'model':db[_0x303e77[_0xb1a4('0x1f')]],'as':_0x303e77['as'],'attributes':_0x303e77[_0xb1a4('0x20')],'include':_0x303e77['include']?_[_0xb1a4('0x1e')](_0x303e77['include'],function(_0x5b92a9){return{'model':db[_0x5b92a9[_0xb1a4('0x1f')]],'as':_0x5b92a9['as'],'attributes':_0x5b92a9[_0xb1a4('0x20')],'include':_0x5b92a9[_0xb1a4('0x1d')]?_[_0xb1a4('0x1e')](_0x5b92a9['include'],function(_0x5a29f5){return{'model':db[_0x5a29f5[_0xb1a4('0x1f')]],'as':_0x5a29f5['as'],'attributes':_0x5a29f5[_0xb1a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb1a4('0xf')](function(_0x4bcfb9){logger[_0xb1a4('0x10')](_0xb1a4('0x22'),_0x3660d0);logger['debug'](_0xb1a4('0x22'),_0x3660d0,JSON[_0xb1a4('0x14')](_0x4bcfb9));_0x68bb37(_0x4bcfb9);})[_0xb1a4('0x25')](function(_0x32e070){logger['error'](_0xb1a4('0x22'),_0x32e070[_0xb1a4('0x17')],_0x3660d0);_0x22b1b1(_0x4f2806[_0xb1a4('0x16')](0x1f4,_0x32e070[_0xb1a4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 25d7809..8073722 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 _0x7aab=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x50b7c4,_0x5becdf){var _0x192220=function(_0x1ac4d1){while(--_0x1ac4d1){_0x50b7c4['push'](_0x50b7c4['shift']());}};_0x192220(++_0x5becdf);}(_0x7aab,0x1e5));var _0xb7aa=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7aab[_0x432682];return _0x463d05;};'use strict';var MailQueueEvents=require(_0xb7aa('0x0'));var events=[_0xb7aa('0x1'),_0xb7aa('0x2'),_0xb7aa('0x3')];function createListener(_0x56def7,_0x52ffbe){return function(_0x3a9cdd){_0x52ffbe[_0xb7aa('0x4')](_0x56def7,_0x3a9cdd);};}function removeListener(_0x5a15d9,_0x4e880b){return function(){MailQueueEvents[_0xb7aa('0x5')](_0x5a15d9,_0x4e880b);};}exports[_0xb7aa('0x6')]=function(_0x281120){for(var _0x1d170b=0x0,_0x8cfd82=events[_0xb7aa('0x7')];_0x1d170b<_0x8cfd82;_0x1d170b++){var _0x3f4c06=events[_0x1d170b];var _0x58538a=createListener(_0xb7aa('0x8')+_0x3f4c06,_0x281120);MailQueueEvents['on'](_0x3f4c06,_0x58538a);}}; \ No newline at end of file +var _0x36bd=['save','update','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x4ff97d,_0x4b8edf){var _0x2cdfc3=function(_0x2adad4){while(--_0x2adad4){_0x4ff97d['push'](_0x4ff97d['shift']());}};_0x2cdfc3(++_0x4b8edf);}(_0x36bd,0x179));var _0xd36b=function(_0x2303e3,_0x27f351){_0x2303e3=_0x2303e3-0x0;var _0x5bf084=_0x36bd[_0x2303e3];return _0x5bf084;};'use strict';var MailQueueEvents=require(_0xd36b('0x0'));var events=[_0xd36b('0x1'),'remove',_0xd36b('0x2')];function createListener(_0x197b1d,_0x1ab30c){return function(_0x3f5933){_0x1ab30c['emit'](_0x197b1d,_0x3f5933);};}function removeListener(_0x3bf529,_0x5c9570){return function(){MailQueueEvents[_0xd36b('0x3')](_0x3bf529,_0x5c9570);};}exports[_0xd36b('0x4')]=function(_0x45ddae){for(var _0xdd7308=0x0,_0x18113e=events[_0xd36b('0x5')];_0xdd7308<_0x18113e;_0xdd7308++){var _0x4069fe=events[_0xdd7308];var _0x26a0d5=createListener(_0xd36b('0x6')+_0x4069fe,_0x45ddae);MailQueueEvents['on'](_0x4069fe,_0x26a0d5);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 49c092c..82ba596 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 _0xf115=['../../config/environment','./mailQueueReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xf115,0x15e));var _0x5f11=function(_0x7ea25d,_0x238911){_0x7ea25d=_0x7ea25d-0x0;var _0x1ce750=_0xf115[_0x7ea25d];return _0x1ce750;};'use strict';var multer=require(_0x5f11('0x0'));var util=require(_0x5f11('0x1'));var path=require(_0x5f11('0x2'));var timeout=require(_0x5f11('0x3'));var express=require(_0x5f11('0x4'));var router=express[_0x5f11('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5f11('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f11('0x7'));var controller=require(_0x5f11('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5f11('0x9')]);router[_0x5f11('0xa')](_0x5f11('0xb'),auth['isAuthenticated'](),controller[_0x5f11('0xc')]);router[_0x5f11('0xa')](_0x5f11('0xd'),auth[_0x5f11('0xe')](),controller[_0x5f11('0xf')]);router[_0x5f11('0x10')]('/',auth[_0x5f11('0xe')](),controller[_0x5f11('0x11')]);router[_0x5f11('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5f11('0x13')]);router['delete'](_0x5f11('0xd'),auth[_0x5f11('0xe')](),controller[_0x5f11('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd393=['describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x4e691c,_0x275ff0){var _0x1c72d6=function(_0x5f5bac){while(--_0x5f5bac){_0x4e691c['push'](_0x4e691c['shift']());}};_0x1c72d6(++_0x275ff0);}(_0xd393,0x159));var _0x3d39=function(_0x4aa324,_0x25f820){_0x4aa324=_0x4aa324-0x0;var _0x3bc507=_0xd393[_0x4aa324];return _0x3bc507;};'use strict';var multer=require(_0x3d39('0x0'));var util=require(_0x3d39('0x1'));var path=require('path');var timeout=require(_0x3d39('0x2'));var express=require('express');var router=express[_0x3d39('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3d39('0x4'));var interaction=require(_0x3d39('0x5'));var config=require(_0x3d39('0x6'));var controller=require(_0x3d39('0x7'));router[_0x3d39('0x8')]('/',auth[_0x3d39('0x9')](),controller[_0x3d39('0xa')]);router['get'](_0x3d39('0xb'),auth['isAuthenticated'](),controller[_0x3d39('0xc')]);router[_0x3d39('0x8')](_0x3d39('0xd'),auth[_0x3d39('0x9')](),controller[_0x3d39('0xe')]);router[_0x3d39('0xf')]('/',auth[_0x3d39('0x9')](),controller[_0x3d39('0x10')]);router[_0x3d39('0x11')]('/:id',auth[_0x3d39('0x9')](),controller[_0x3d39('0x12')]);router['delete'](_0x3d39('0xd'),auth['isAuthenticated'](),controller[_0x3d39('0x13')]);module[_0x3d39('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index cd336fa..40348a6 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 _0xdf0f=['DATE','sequelize','exports','STRING'];(function(_0x32d9b1,_0x32a24c){var _0x50a4a0=function(_0x16c6a5){while(--_0x16c6a5){_0x32d9b1['push'](_0x32d9b1['shift']());}};_0x50a4a0(++_0x32a24c);}(_0xdf0f,0x1e9));var _0xfdf0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdf0f[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require('moment');var Sequelize=require(_0xfdf0('0x0'));module[_0xfdf0('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfdf0('0x2')]},'joinAt':{'type':Sequelize[_0xfdf0('0x3')]},'leaveAt':{'type':Sequelize[_0xfdf0('0x3')]},'acceptAt':{'type':Sequelize[_0xfdf0('0x3')]},'exitAt':{'type':Sequelize[_0xfdf0('0x3')]},'reason':{'type':Sequelize[_0xfdf0('0x2')]}}; \ No newline at end of file +var _0x2287=['exports','STRING','DATE','moment'];(function(_0x457585,_0x47e33a){var _0x1f96e1=function(_0x5be312){while(--_0x5be312){_0x457585['push'](_0x457585['shift']());}};_0x1f96e1(++_0x47e33a);}(_0x2287,0x123));var _0x7228=function(_0x233779,_0x5afeb8){_0x233779=_0x233779-0x0;var _0x2395ee=_0x2287[_0x233779];return _0x2395ee;};'use strict';var moment=require(_0x7228('0x0'));var Sequelize=require('sequelize');module[_0x7228('0x1')]={'uniqueid':{'type':Sequelize[_0x7228('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7228('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7228('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 74a5e96..47a106b 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 _0x1893=['query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','includeAll','include','catch','keys','merge','find','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','send','index','MailQueueReport','rawAttributes','type','key','model','name'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1893,0xa2));var _0x3189=function(_0x3d8eb2,_0x5e58a3){_0x3d8eb2=_0x3d8eb2-0x0;var _0x1bb6bb=_0x1893[_0x3d8eb2];return _0x1bb6bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x1dc1c8,_0x3cc1e5){return function(_0x103de4){if(!_0x103de4){_0x1dc1c8[_0x3189('0x19')](0x194);}return _0x103de4;};}function handleError(_0xdda38b,_0x379a48){_0x379a48=_0x379a48||0x1f4;return function(_0x17b540){logger[_0x3189('0x27')](_0x17b540['stack']);if(_0x17b540['name']){delete _0x17b540['name'];}_0xdda38b[_0x3189('0x1a')](_0x379a48)[_0x3189('0x28')](_0x17b540);};}exports[_0x3189('0x29')]=function(_0x90c31,_0x36b258){var _0x2f7504={},_0x4d453a={},_0x1ab94b={'count':0x0,'rows':[]};var _0x37b9ec=_['map'](db[_0x3189('0x2a')][_0x3189('0x2b')],function(_0x39c5e4){return{'name':_0x39c5e4['fieldName'],'type':_0x39c5e4[_0x3189('0x2c')][_0x3189('0x2d')]};});_0x4d453a[_0x3189('0x2e')]=_['map'](_0x37b9ec,_0x3189('0x2f'));_0x4d453a[_0x3189('0x30')]=_['keys'](_0x90c31[_0x3189('0x30')]);_0x4d453a[_0x3189('0x31')]=_[_0x3189('0x32')](_0x4d453a[_0x3189('0x2e')],_0x4d453a[_0x3189('0x30')]);_0x2f7504['attributes']=_['intersection'](_0x4d453a[_0x3189('0x2e')],qs['fields'](_0x90c31[_0x3189('0x30')][_0x3189('0x33')]));_0x2f7504[_0x3189('0x34')]=_0x2f7504[_0x3189('0x34')][_0x3189('0x35')]?_0x2f7504[_0x3189('0x34')]:_0x4d453a[_0x3189('0x2e')];if(!_0x90c31[_0x3189('0x30')][_0x3189('0x36')]('nolimit')){_0x2f7504[_0x3189('0x20')]=qs[_0x3189('0x20')](_0x90c31[_0x3189('0x30')][_0x3189('0x20')]);_0x2f7504[_0x3189('0x1d')]=qs[_0x3189('0x1d')](_0x90c31[_0x3189('0x30')]['offset']);}_0x2f7504['order']=qs[_0x3189('0x37')](_0x90c31['query'][_0x3189('0x37')]);_0x2f7504[_0x3189('0x38')]=qs['filters'](_[_0x3189('0x39')](_0x90c31[_0x3189('0x30')],_0x4d453a[_0x3189('0x31')]),_0x37b9ec);if(_0x90c31[_0x3189('0x30')]['filter']){_0x2f7504[_0x3189('0x38')]=_['merge'](_0x2f7504['where'],{'$or':_[_0x3189('0x3a')](_0x37b9ec,function(_0xed3041){if(_0xed3041[_0x3189('0x2c')]!==_0x3189('0x3b')){var _0x12dee0={};_0x12dee0[_0xed3041[_0x3189('0x2f')]]={'$like':'%'+_0x90c31[_0x3189('0x30')][_0x3189('0x3c')]+'%'};return _0x12dee0;}})});}_0x2f7504=_['merge']({},_0x2f7504,_0x90c31['options']);var _0x407e0a={'where':_0x2f7504[_0x3189('0x38')]};return db[_0x3189('0x2a')][_0x3189('0x1f')](_0x407e0a)[_0x3189('0x26')](function(_0xb52c70){_0x1ab94b['count']=_0xb52c70;if(_0x90c31[_0x3189('0x30')][_0x3189('0x3d')]){_0x2f7504[_0x3189('0x3e')]=[{'all':!![]}];}return db[_0x3189('0x2a')]['findAll'](_0x2f7504);})[_0x3189('0x26')](function(_0x2f0d49){_0x1ab94b['rows']=_0x2f0d49;return _0x1ab94b;})['then'](respondWithFilteredResult(_0x36b258,_0x2f7504))[_0x3189('0x3f')](handleError(_0x36b258,null));};exports['show']=function(_0x376787,_0x3074b9){var _0x38bf83={'raw':!![],'where':{'id':_0x376787['params']['id']}},_0x9593f3={};_0x9593f3[_0x3189('0x2e')]=_[_0x3189('0x40')](db['MailQueueReport'][_0x3189('0x2b')]);_0x9593f3[_0x3189('0x30')]=_[_0x3189('0x40')](_0x376787[_0x3189('0x30')]);_0x9593f3[_0x3189('0x31')]=_['intersection'](_0x9593f3['model'],_0x9593f3[_0x3189('0x30')]);_0x38bf83['attributes']=_[_0x3189('0x32')](_0x9593f3[_0x3189('0x2e')],qs[_0x3189('0x33')](_0x376787['query'][_0x3189('0x33')]));_0x38bf83[_0x3189('0x34')]=_0x38bf83[_0x3189('0x34')]['length']?_0x38bf83[_0x3189('0x34')]:_0x9593f3[_0x3189('0x2e')];if(_0x376787[_0x3189('0x30')][_0x3189('0x3d')]){_0x38bf83[_0x3189('0x3e')]=[{'all':!![]}];}_0x38bf83=_[_0x3189('0x41')]({},_0x38bf83,_0x376787['options']);return db['MailQueueReport'][_0x3189('0x42')](_0x38bf83)['then'](handleEntityNotFound(_0x3074b9,null))['then'](respondWithResult(_0x3074b9,null))[_0x3189('0x3f')](handleError(_0x3074b9,null));};exports['create']=function(_0x2d58fd,_0x1b6f09){return db[_0x3189('0x2a')]['create'](_0x2d58fd[_0x3189('0x43')],{})['then'](respondWithResult(_0x1b6f09,0xc9))[_0x3189('0x3f')](handleError(_0x1b6f09,null));};exports['update']=function(_0x49c4a8,_0x244166){if(_0x49c4a8['body']['id']){delete _0x49c4a8[_0x3189('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x49c4a8[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x244166,null))[_0x3189('0x26')](saveUpdates(_0x49c4a8[_0x3189('0x43')],null))[_0x3189('0x26')](respondWithResult(_0x244166,null))[_0x3189('0x3f')](handleError(_0x244166,null));};exports['destroy']=function(_0x21d446,_0x549bc7){return db['MailQueueReport'][_0x3189('0x42')]({'where':{'id':_0x21d446[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x549bc7,null))[_0x3189('0x26')](removeEntity(_0x549bc7,null))[_0x3189('0x3f')](handleError(_0x549bc7,null));};exports[_0x3189('0x45')]=function(_0x556ee5,_0x5117fb){return db['MailQueueReport'][_0x3189('0x45')]()[_0x3189('0x26')](respondWithResult(_0x5117fb,null))[_0x3189('0x3f')](handleError(_0x5117fb,null));}; \ No newline at end of file +var _0xe5af=['length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','MailQueueReport','includeAll','include','findAll','catch','params','create','body','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xe5af,0x9c));var _0xfe5a=function(_0x5411af,_0x1a4cff){_0x5411af=_0x5411af-0x0;var _0x264d74=_0xe5af[_0x5411af];return _0x264d74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe5a('0x0'));var zipdir=require(_0xfe5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe5a('0x2'));var moment=require(_0xfe5a('0x3'));var BPromise=require(_0xfe5a('0x4'));var Mustache=require('mustache');var util=require(_0xfe5a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfe5a('0x6'));var ejs=require(_0xfe5a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe5a('0x8'));var crypto=require(_0xfe5a('0x9'));var jsforce=require(_0xfe5a('0xa'));var deskjs=require(_0xfe5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfe5a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe5a('0xd'));var qs=require(_0xfe5a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe5a('0xf'));var logger=require(_0xfe5a('0x10'))(_0xfe5a('0x11'));var utils=require(_0xfe5a('0x12'));var config=require(_0xfe5a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe5a('0x14'))['db'];function respondWithStatusCode(_0x9d1f4f,_0x20b206){_0x20b206=_0x20b206||0xcc;return function(_0x374ded){if(_0x374ded){return _0x9d1f4f[_0xfe5a('0x15')](_0x20b206);}return _0x9d1f4f['status'](_0x20b206)[_0xfe5a('0x16')]();};}function respondWithResult(_0x17bbbe,_0x42969b){_0x42969b=_0x42969b||0xc8;return function(_0x362115){if(_0x362115){return _0x17bbbe[_0xfe5a('0x17')](_0x42969b)[_0xfe5a('0x18')](_0x362115);}};}function respondWithFilteredResult(_0x375380,_0xeb454){return function(_0x111d4d){if(_0x111d4d){var _0x18c57b=typeof _0xeb454[_0xfe5a('0x19')]===_0xfe5a('0x1a')&&typeof _0xeb454[_0xfe5a('0x1b')]===_0xfe5a('0x1a');var _0x3edcab=_0x111d4d[_0xfe5a('0x1c')];var _0x5bf597=_0x18c57b?0x0:_0xeb454[_0xfe5a('0x19')];var _0x456707=_0x18c57b?_0x111d4d['count']:_0xeb454[_0xfe5a('0x19')]+_0xeb454[_0xfe5a('0x1b')];var _0x39d905;if(_0x456707>=_0x3edcab){_0x456707=_0x3edcab;_0x39d905=0xc8;}else{_0x39d905=0xce;}_0x375380['status'](_0x39d905);return _0x375380['set'](_0xfe5a('0x1d'),_0x5bf597+'-'+_0x456707+'/'+_0x3edcab)[_0xfe5a('0x18')](_0x111d4d);}return null;};}function patchUpdates(_0xded538){return function(_0x3b3022){try{jsonpatch[_0xfe5a('0x1e')](_0x3b3022,_0xded538,!![]);}catch(_0x355869){return BPromise['reject'](_0x355869);}return _0x3b3022[_0xfe5a('0x1f')]();};}function saveUpdates(_0x592521,_0x3dfa57){return function(_0x39d825){if(_0x39d825){return _0x39d825[_0xfe5a('0x20')](_0x592521)['then'](function(_0x4bbef1){return _0x4bbef1;});}return null;};}function removeEntity(_0x247be4,_0x3e55fd){return function(_0x494df3){if(_0x494df3){return _0x494df3[_0xfe5a('0x21')]()[_0xfe5a('0x22')](function(){_0x247be4['status'](0xcc)[_0xfe5a('0x16')]();});}};}function handleEntityNotFound(_0x3a4f3c,_0x31cc60){return function(_0x2b4f1c){if(!_0x2b4f1c){_0x3a4f3c['sendStatus'](0x194);}return _0x2b4f1c;};}function handleError(_0x42136e,_0x2f5d04){_0x2f5d04=_0x2f5d04||0x1f4;return function(_0x24481f){logger[_0xfe5a('0x23')](_0x24481f[_0xfe5a('0x24')]);if(_0x24481f[_0xfe5a('0x25')]){delete _0x24481f[_0xfe5a('0x25')];}_0x42136e[_0xfe5a('0x17')](_0x2f5d04)['send'](_0x24481f);};}exports['index']=function(_0x712b44,_0x485f9d){var _0xc53869={},_0xfcb05b={},_0x11bf97={'count':0x0,'rows':[]};var _0x482a35=_['map'](db['MailQueueReport'][_0xfe5a('0x26')],function(_0x582f2d){return{'name':_0x582f2d['fieldName'],'type':_0x582f2d['type'][_0xfe5a('0x27')]};});_0xfcb05b[_0xfe5a('0x28')]=_[_0xfe5a('0x29')](_0x482a35,_0xfe5a('0x25'));_0xfcb05b[_0xfe5a('0x2a')]=_[_0xfe5a('0x2b')](_0x712b44[_0xfe5a('0x2a')]);_0xfcb05b[_0xfe5a('0x2c')]=_[_0xfe5a('0x2d')](_0xfcb05b[_0xfe5a('0x28')],_0xfcb05b[_0xfe5a('0x2a')]);_0xc53869['attributes']=_[_0xfe5a('0x2d')](_0xfcb05b[_0xfe5a('0x28')],qs['fields'](_0x712b44[_0xfe5a('0x2a')][_0xfe5a('0x2e')]));_0xc53869[_0xfe5a('0x2f')]=_0xc53869[_0xfe5a('0x2f')][_0xfe5a('0x30')]?_0xc53869['attributes']:_0xfcb05b['model'];if(!_0x712b44[_0xfe5a('0x2a')]['hasOwnProperty'](_0xfe5a('0x31'))){_0xc53869[_0xfe5a('0x1b')]=qs[_0xfe5a('0x1b')](_0x712b44[_0xfe5a('0x2a')]['limit']);_0xc53869[_0xfe5a('0x19')]=qs[_0xfe5a('0x19')](_0x712b44[_0xfe5a('0x2a')]['offset']);}_0xc53869[_0xfe5a('0x32')]=qs[_0xfe5a('0x33')](_0x712b44[_0xfe5a('0x2a')][_0xfe5a('0x33')]);_0xc53869['where']=qs[_0xfe5a('0x2c')](_['pick'](_0x712b44[_0xfe5a('0x2a')],_0xfcb05b[_0xfe5a('0x2c')]),_0x482a35);if(_0x712b44['query'][_0xfe5a('0x34')]){_0xc53869[_0xfe5a('0x35')]=_[_0xfe5a('0x36')](_0xc53869[_0xfe5a('0x35')],{'$or':_['map'](_0x482a35,function(_0x193ce0){if(_0x193ce0[_0xfe5a('0x37')]!==_0xfe5a('0x38')){var _0x560088={};_0x560088[_0x193ce0[_0xfe5a('0x25')]]={'$like':'%'+_0x712b44[_0xfe5a('0x2a')][_0xfe5a('0x34')]+'%'};return _0x560088;}})});}_0xc53869=_[_0xfe5a('0x36')]({},_0xc53869,_0x712b44[_0xfe5a('0x39')]);var _0x162c48={'where':_0xc53869[_0xfe5a('0x35')]};return db[_0xfe5a('0x3a')][_0xfe5a('0x1c')](_0x162c48)[_0xfe5a('0x22')](function(_0x20da14){_0x11bf97['count']=_0x20da14;if(_0x712b44[_0xfe5a('0x2a')][_0xfe5a('0x3b')]){_0xc53869[_0xfe5a('0x3c')]=[{'all':!![]}];}return db[_0xfe5a('0x3a')][_0xfe5a('0x3d')](_0xc53869);})[_0xfe5a('0x22')](function(_0x3475fb){_0x11bf97['rows']=_0x3475fb;return _0x11bf97;})[_0xfe5a('0x22')](respondWithFilteredResult(_0x485f9d,_0xc53869))[_0xfe5a('0x3e')](handleError(_0x485f9d,null));};exports['show']=function(_0x59caa1,_0x252904){var _0x4c17fd={'raw':!![],'where':{'id':_0x59caa1[_0xfe5a('0x3f')]['id']}},_0x54096d={};_0x54096d[_0xfe5a('0x28')]=_['keys'](db[_0xfe5a('0x3a')]['rawAttributes']);_0x54096d[_0xfe5a('0x2a')]=_[_0xfe5a('0x2b')](_0x59caa1[_0xfe5a('0x2a')]);_0x54096d[_0xfe5a('0x2c')]=_[_0xfe5a('0x2d')](_0x54096d[_0xfe5a('0x28')],_0x54096d['query']);_0x4c17fd[_0xfe5a('0x2f')]=_[_0xfe5a('0x2d')](_0x54096d[_0xfe5a('0x28')],qs[_0xfe5a('0x2e')](_0x59caa1[_0xfe5a('0x2a')][_0xfe5a('0x2e')]));_0x4c17fd[_0xfe5a('0x2f')]=_0x4c17fd[_0xfe5a('0x2f')][_0xfe5a('0x30')]?_0x4c17fd[_0xfe5a('0x2f')]:_0x54096d[_0xfe5a('0x28')];if(_0x59caa1[_0xfe5a('0x2a')][_0xfe5a('0x3b')]){_0x4c17fd[_0xfe5a('0x3c')]=[{'all':!![]}];}_0x4c17fd=_['merge']({},_0x4c17fd,_0x59caa1[_0xfe5a('0x39')]);return db[_0xfe5a('0x3a')]['find'](_0x4c17fd)['then'](handleEntityNotFound(_0x252904,null))[_0xfe5a('0x22')](respondWithResult(_0x252904,null))[_0xfe5a('0x3e')](handleError(_0x252904,null));};exports[_0xfe5a('0x40')]=function(_0x3ccf98,_0x3cf1b5){return db[_0xfe5a('0x3a')][_0xfe5a('0x40')](_0x3ccf98['body'],{})[_0xfe5a('0x22')](respondWithResult(_0x3cf1b5,0xc9))['catch'](handleError(_0x3cf1b5,null));};exports[_0xfe5a('0x20')]=function(_0x5a807e,_0x433562){if(_0x5a807e[_0xfe5a('0x41')]['id']){delete _0x5a807e[_0xfe5a('0x41')]['id'];}return db[_0xfe5a('0x3a')]['find']({'where':{'id':_0x5a807e[_0xfe5a('0x3f')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x433562,null))['then'](saveUpdates(_0x5a807e[_0xfe5a('0x41')],null))['then'](respondWithResult(_0x433562,null))['catch'](handleError(_0x433562,null));};exports[_0xfe5a('0x21')]=function(_0x4e02c9,_0x374ce5){return db[_0xfe5a('0x3a')][_0xfe5a('0x42')]({'where':{'id':_0x4e02c9[_0xfe5a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x374ce5,null))[_0xfe5a('0x22')](removeEntity(_0x374ce5,null))['catch'](handleError(_0x374ce5,null));};exports[_0xfe5a('0x43')]=function(_0x38409b,_0x149132){return db['MailQueueReport'][_0xfe5a('0x43')]()[_0xfe5a('0x22')](respondWithResult(_0x149132,null))['catch'](handleError(_0x149132,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0af161c..1c69769 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 _0x133b=['bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x133b,0x101));var _0xb133=function(_0x1b9a8d,_0x1a96ea){_0x1b9a8d=_0x1b9a8d-0x0;var _0xf16a97=_0x133b[_0x1b9a8d];return _0xf16a97;};'use strict';var _=require(_0xb133('0x0'));var util=require(_0xb133('0x1'));var logger=require(_0xb133('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb133('0x3'));var rp=require(_0xb133('0x4'));var fs=require('fs');var path=require(_0xb133('0x5'));var rimraf=require('rimraf');var config=require(_0xb133('0x6'));var attributes=require(_0xb133('0x7'));module[_0xb133('0x8')]=function(_0x5224bd,_0x1c27c8){return _0x5224bd[_0xb133('0x9')](_0xb133('0xa'),attributes,{'tableName':_0xb133('0xb'),'paranoid':![],'indexes':[{'name':_0xb133('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3aed=['report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x3aed,0x89));var _0xd3ae=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x3aed[_0x5a79e2];return _0x266c45;};'use strict';var _=require('lodash');var util=require(_0xd3ae('0x0'));var logger=require(_0xd3ae('0x1'))(_0xd3ae('0x2'));var moment=require(_0xd3ae('0x3'));var BPromise=require(_0xd3ae('0x4'));var rp=require(_0xd3ae('0x5'));var fs=require('fs');var path=require(_0xd3ae('0x6'));var rimraf=require(_0xd3ae('0x7'));var config=require(_0xd3ae('0x8'));var attributes=require(_0xd3ae('0x9'));module[_0xd3ae('0xa')]=function(_0x4488cd,_0x3c15c6){return _0x4488cd[_0xd3ae('0xb')](_0xd3ae('0xc'),attributes,{'tableName':_0xd3ae('0xd'),'paranoid':![],'indexes':[{'name':_0xd3ae('0xe'),'fields':[_0xd3ae('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index f3f9a06..55e9689 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x1c4872,_0x4d1dcc){var _0x2f4bce=function(_0xf29d65){while(--_0xf29d65){_0x1c4872['push'](_0x1c4872['shift']());}};_0x2f4bce(++_0x4d1dcc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0xc1548d,_0xce418a){var _0x5cf1ff=function(_0x2d8085){while(--_0x2d8085){_0xc1548d['push'](_0xc1548d['shift']());}};_0x5cf1ff(++_0xce418a);}(_0x7a54,0x106));var _0x47a5=function(_0x54f46d,_0x47db6c){_0x54f46d=_0x54f46d-0x0;var _0x18e738=_0x7a54[_0x54f46d];return _0x18e738;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index da45ebb..1a59be1 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x31c0d4,_0x1f2503){var _0x3eaf54=function(_0x401849){while(--_0x401849){_0x31c0d4['push'](_0x31c0d4['shift']());}};_0x3eaf54(++_0x1f2503);}(_0x70e0,0x17b));var _0x070e=function(_0x550a58,_0x1daca0){_0x550a58=_0x550a58-0x0;var _0x4ec74b=_0x70e0[_0x550a58];return _0x4ec74b;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x54768b,_0x28c721){var _0x142c84=function(_0x22a261){while(--_0x22a261){_0x54768b['push'](_0x54768b['shift']());}};_0x142c84(++_0x28c721);}(_0x70e0,0x17b));var _0x070e=function(_0xb5f7e4,_0x597372){_0xb5f7e4=_0xb5f7e4-0x0;var _0x4a5c1f=_0x70e0[_0xb5f7e4];return _0x4a5c1f;};'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 bd86603..02a641f 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 _0xe0ee=['sequelize','exports','STRING','BOOLEAN','INBOX','INTEGER'];(function(_0x2e93f2,_0x3013ee){var _0x2b8ed4=function(_0x42bd12){while(--_0x42bd12){_0x2e93f2['push'](_0x2e93f2['shift']());}};_0x2b8ed4(++_0x3013ee);}(_0xe0ee,0xd2));var _0xee0e=function(_0x2b57fc,_0x4b3658){_0x2b57fc=_0x2b57fc-0x0;var _0x5bf238=_0xe0ee[_0x2b57fc];return _0x5bf238;};'use strict';var Sequelize=require(_0xee0e('0x0'));module[_0xee0e('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xee0e('0x2')]},'authentication':{'type':Sequelize[_0xee0e('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xee0e('0x2')]},'password':{'type':Sequelize[_0xee0e('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xee0e('0x2')],'defaultValue':_0xee0e('0x4')},'connTimeout':{'type':Sequelize[_0xee0e('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xee0e('0x2')]},'modernAuthentication':{'type':Sequelize[_0xee0e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa341=['STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x4f7a88,_0x184717){var _0x9336c4=function(_0x270ce3){while(--_0x270ce3){_0x4f7a88['push'](_0x4f7a88['shift']());}};_0x9336c4(++_0x184717);}(_0xa341,0xef));var _0x1a34=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa341[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1a34('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1a34('0x1')]},'authentication':{'type':Sequelize[_0x1a34('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1a34('0x1')]},'password':{'type':Sequelize[_0x1a34('0x1')]},'port':{'type':Sequelize[_0x1a34('0x3')]},'tls':{'type':Sequelize[_0x1a34('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1a34('0x1')],'defaultValue':_0x1a34('0x4')},'connTimeout':{'type':Sequelize[_0x1a34('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x1a34('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0a2dbbb..fbdb4d2 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 _0xd3a0=['exports','mail_servers_in','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x29751a,_0xc38453){var _0x39388f=function(_0x1e4693){while(--_0x1e4693){_0x29751a['push'](_0x29751a['shift']());}};_0x39388f(++_0xc38453);}(_0xd3a0,0x17c));var _0x0d3a=function(_0x38f280,_0x37303c){_0x38f280=_0x38f280-0x0;var _0x571559=_0xd3a0[_0x38f280];return _0x571559;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d3a('0x0'))('api');var moment=require(_0x0d3a('0x1'));var BPromise=require(_0x0d3a('0x2'));var rp=require(_0x0d3a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d3a('0x4'));var config=require(_0x0d3a('0x5'));var attributes=require(_0x0d3a('0x6'));module[_0x0d3a('0x7')]=function(_0x34069b,_0x39c79b){return _0x34069b['define']('MailServerIn',attributes,{'tableName':_0x0d3a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc606=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x40018c,_0x10cbe8){var _0x5bd1d4=function(_0x3fa834){while(--_0x3fa834){_0x40018c['push'](_0x40018c['shift']());}};_0x5bd1d4(++_0x10cbe8);}(_0xc606,0x15e));var _0x6c60=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0xc606[_0x2aee2f];return _0x19337f;};'use strict';var _=require(_0x6c60('0x0'));var util=require(_0x6c60('0x1'));var logger=require(_0x6c60('0x2'))(_0x6c60('0x3'));var moment=require(_0x6c60('0x4'));var BPromise=require(_0x6c60('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c60('0x6'));var rimraf=require(_0x6c60('0x7'));var config=require(_0x6c60('0x8'));var attributes=require(_0x6c60('0x9'));module[_0x6c60('0xa')]=function(_0x5a7272,_0x220e7d){return _0x5a7272[_0x6c60('0xb')](_0x6c60('0xc'),attributes,{'tableName':_0x6c60('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 94cd09c..8b4aa64 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 _0x3a61=['then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','MailServerIn','options','raw','where','attributes','map','include','model','GetMailServerIn','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x42276c,_0x141d47){var _0x1b5009=function(_0x23713f){while(--_0x23713f){_0x42276c['push'](_0x42276c['shift']());}};_0x1b5009(++_0x141d47);}(_0x3a61,0xd4));var _0x13a6=function(_0x7d0412,_0x5a7a0d){_0x7d0412=_0x7d0412-0x0;var _0x3baf99=_0x3a61[_0x7d0412];return _0x3baf99;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x13a6('0x0'));var rs=require(_0x13a6('0x1'));var fs=require('fs');var Redis=require(_0x13a6('0x2'));var db=require(_0x13a6('0x3'))['db'];var utils=require(_0x13a6('0x4'));var logger=require(_0x13a6('0x5'))(_0x13a6('0x6'));var config=require(_0x13a6('0x7'));var jayson=require(_0x13a6('0x8'));var client=jayson[_0x13a6('0x9')][_0x13a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f6ed2,_0x14e075,_0x274d05){return new BPromise(function(_0xb82e5f,_0x5a6bb8){return client[_0x13a6('0xb')](_0x2f6ed2,_0x274d05)[_0x13a6('0xc')](function(_0x11ab59){logger[_0x13a6('0xd')](_0x13a6('0xe'),_0x14e075,'request\x20sent');logger[_0x13a6('0xf')](_0x13a6('0x10'),_0x14e075,'request\x20sent',JSON[_0x13a6('0x11')](_0x11ab59));if(_0x11ab59[_0x13a6('0x12')]){if(_0x11ab59[_0x13a6('0x12')][_0x13a6('0x13')]===0x1f4){logger[_0x13a6('0x12')](_0x13a6('0xe'),_0x14e075,_0x11ab59['error'][_0x13a6('0x14')]);return _0x5a6bb8(_0x11ab59[_0x13a6('0x12')][_0x13a6('0x14')]);}logger[_0x13a6('0x12')]('MailServerIn,\x20%s,\x20%s',_0x14e075,_0x11ab59[_0x13a6('0x12')][_0x13a6('0x14')]);return _0xb82e5f(_0x11ab59['error']['message']);}else{logger[_0x13a6('0xd')](_0x13a6('0xe'),_0x14e075,_0x13a6('0x15'));_0xb82e5f(_0x11ab59['result'][_0x13a6('0x14')]);}})[_0x13a6('0x16')](function(_0x16be50){logger[_0x13a6('0x12')](_0x13a6('0xe'),_0x14e075,_0x16be50);_0x5a6bb8(_0x16be50);});});}exports['GetMailServerIn']=function(_0xf13806){var _0x57a25a=this;return new Promise(function(_0x1433ba,_0x144995){return db[_0x13a6('0x17')]['findAll']({'raw':_0xf13806['options']?_0xf13806[_0x13a6('0x18')][_0x13a6('0x19')]===undefined?!![]:![]:!![],'where':_0xf13806[_0x13a6('0x18')]?_0xf13806[_0x13a6('0x18')][_0x13a6('0x1a')]||null:null,'attributes':_0xf13806[_0x13a6('0x18')]?_0xf13806[_0x13a6('0x18')][_0x13a6('0x1b')]||null:null,'limit':_0xf13806[_0x13a6('0x18')]?_0xf13806[_0x13a6('0x18')]['limit']||null:null,'include':_0xf13806[_0x13a6('0x18')]?_0xf13806[_0x13a6('0x18')]['include']?_[_0x13a6('0x1c')](_0xf13806[_0x13a6('0x18')][_0x13a6('0x1d')],function(_0x49e107){return{'model':db[_0x49e107[_0x13a6('0x1e')]],'as':_0x49e107['as'],'attributes':_0x49e107[_0x13a6('0x1b')],'include':_0x49e107[_0x13a6('0x1d')]?_['map'](_0x49e107[_0x13a6('0x1d')],function(_0x462105){return{'model':db[_0x462105[_0x13a6('0x1e')]],'as':_0x462105['as'],'attributes':_0x462105[_0x13a6('0x1b')],'include':_0x462105[_0x13a6('0x1d')]?_['map'](_0x462105[_0x13a6('0x1d')],function(_0x5c414b){return{'model':db[_0x5c414b[_0x13a6('0x1e')]],'as':_0x5c414b['as'],'attributes':_0x5c414b[_0x13a6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x13a6('0xc')](function(_0x2dd34e){logger['info']('GetMailServerIn',_0xf13806);logger[_0x13a6('0xf')](_0x13a6('0x1f'),_0xf13806,JSON['stringify'](_0x2dd34e));_0x1433ba(_0x2dd34e);})[_0x13a6('0x16')](function(_0x2f03ac){logger[_0x13a6('0x12')](_0x13a6('0x1f'),_0x2f03ac[_0x13a6('0x14')],_0xf13806);_0x144995(_0x57a25a[_0x13a6('0x12')](0x1f4,_0x2f03ac[_0x13a6('0x14')]));});});}; \ No newline at end of file +var _0x7b19=['attributes','model','then','lodash','moment','ioredis','../../config/logger','rpc','client','http','request','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','options','raw','where','include','map'];(function(_0x439a85,_0x4b8860){var _0x351741=function(_0x1a0c21){while(--_0x1a0c21){_0x439a85['push'](_0x439a85['shift']());}};_0x351741(++_0x4b8860);}(_0x7b19,0x1df));var _0x97b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7b19[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x97b1('0x0'));var util=require('util');var moment=require(_0x97b1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97b1('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x97b1('0x3'))(_0x97b1('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x97b1('0x5')][_0x97b1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1e51ab,_0x225be6,_0x330d8f){return new BPromise(function(_0x3a1833,_0x519633){return client[_0x97b1('0x7')](_0x1e51ab,_0x330d8f)['then'](function(_0x15dcc3){logger[_0x97b1('0x8')](_0x97b1('0x9'),_0x225be6,'request\x20sent');logger[_0x97b1('0xa')](_0x97b1('0xb'),_0x225be6,_0x97b1('0xc'),JSON[_0x97b1('0xd')](_0x15dcc3));if(_0x15dcc3[_0x97b1('0xe')]){if(_0x15dcc3[_0x97b1('0xe')][_0x97b1('0xf')]===0x1f4){logger[_0x97b1('0xe')](_0x97b1('0x9'),_0x225be6,_0x15dcc3['error'][_0x97b1('0x10')]);return _0x519633(_0x15dcc3[_0x97b1('0xe')][_0x97b1('0x10')]);}logger[_0x97b1('0xe')](_0x97b1('0x9'),_0x225be6,_0x15dcc3[_0x97b1('0xe')][_0x97b1('0x10')]);return _0x3a1833(_0x15dcc3[_0x97b1('0xe')][_0x97b1('0x10')]);}else{logger[_0x97b1('0x8')]('MailServerIn,\x20%s,\x20%s',_0x225be6,_0x97b1('0xc'));_0x3a1833(_0x15dcc3['result']['message']);}})[_0x97b1('0x11')](function(_0x590808){logger['error']('MailServerIn,\x20%s,\x20%s',_0x225be6,_0x590808);_0x519633(_0x590808);});});}exports[_0x97b1('0x12')]=function(_0x174f2a){var _0x5eb2e4=this;return new Promise(function(_0x42a84f,_0x1bcadf){return db[_0x97b1('0x13')]['findAll']({'raw':_0x174f2a[_0x97b1('0x14')]?_0x174f2a[_0x97b1('0x14')][_0x97b1('0x15')]===undefined?!![]:![]:!![],'where':_0x174f2a[_0x97b1('0x14')]?_0x174f2a[_0x97b1('0x14')][_0x97b1('0x16')]||null:null,'attributes':_0x174f2a['options']?_0x174f2a[_0x97b1('0x14')]['attributes']||null:null,'limit':_0x174f2a[_0x97b1('0x14')]?_0x174f2a[_0x97b1('0x14')]['limit']||null:null,'include':_0x174f2a['options']?_0x174f2a[_0x97b1('0x14')][_0x97b1('0x17')]?_[_0x97b1('0x18')](_0x174f2a[_0x97b1('0x14')]['include'],function(_0x274a7d){return{'model':db[_0x274a7d['model']],'as':_0x274a7d['as'],'attributes':_0x274a7d[_0x97b1('0x19')],'include':_0x274a7d['include']?_['map'](_0x274a7d[_0x97b1('0x17')],function(_0x2e431f){return{'model':db[_0x2e431f[_0x97b1('0x1a')]],'as':_0x2e431f['as'],'attributes':_0x2e431f[_0x97b1('0x19')],'include':_0x2e431f[_0x97b1('0x17')]?_[_0x97b1('0x18')](_0x2e431f[_0x97b1('0x17')],function(_0x6a4664){return{'model':db[_0x6a4664[_0x97b1('0x1a')]],'as':_0x6a4664['as'],'attributes':_0x6a4664[_0x97b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x97b1('0x1b')](function(_0x361b63){logger[_0x97b1('0x8')]('GetMailServerIn',_0x174f2a);logger[_0x97b1('0xa')](_0x97b1('0x12'),_0x174f2a,JSON[_0x97b1('0xd')](_0x361b63));_0x42a84f(_0x361b63);})[_0x97b1('0x11')](function(_0x2f6891){logger[_0x97b1('0xe')](_0x97b1('0x12'),_0x2f6891[_0x97b1('0x10')],_0x174f2a);_0x1bcadf(_0x5eb2e4['error'](0x1f4,_0x2f6891['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2ca509b..5cafae5 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x55e3ce,_0x4a0033){_0x55e3ce=_0x55e3ce-0x0;var _0x532e9c=_0x7a54[_0x55e3ce];return _0x532e9c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a54,0x106));var _0x47a5=function(_0x33e48a,_0x236d71){_0x33e48a=_0x33e48a-0x0;var _0x252971=_0x7a54[_0x33e48a];return _0x252971;};'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 926cf1b..1fb479d 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 _0xa74f=['BOOLEAN','STRING','INTEGER'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa74f,0x9a));var _0xfa74=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xa74f[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xfa74('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfa74('0x0')]},'port':{'type':Sequelize[_0xfa74('0x1')]},'secure':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xfa74('0x0')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5ec6=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x5ec6,0x7f));var _0x65ec=function(_0x3fa816,_0x2139ab){_0x3fa816=_0x3fa816-0x0;var _0x43ea02=_0x5ec6[_0x3fa816];return _0x43ea02;};'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 e237a7b..d457d08 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 _0xca6f=['reject','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','apply'];(function(_0x4bd183,_0x50b95f){var _0x3c8071=function(_0x1e46c3){while(--_0x1e46c3){_0x4bd183['push'](_0x4bd183['shift']());}};_0x3c8071(++_0x50b95f);}(_0xca6f,0x151));var _0xfca6=function(_0x59250d,_0x3faa07){_0x59250d=_0x59250d-0x0;var _0x7635eb=_0xca6f[_0x59250d];return _0x7635eb;};'use strict';var emlformat=require(_0xfca6('0x0'));var rimraf=require(_0xfca6('0x1'));var zipdir=require(_0xfca6('0x2'));var jsonpatch=require(_0xfca6('0x3'));var rp=require(_0xfca6('0x4'));var moment=require(_0xfca6('0x5'));var BPromise=require(_0xfca6('0x6'));var Mustache=require(_0xfca6('0x7'));var util=require(_0xfca6('0x8'));var path=require(_0xfca6('0x9'));var sox=require(_0xfca6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfca6('0xb'));var _=require(_0xfca6('0xc'));var squel=require('squel');var crypto=require(_0xfca6('0xd'));var jsforce=require(_0xfca6('0xe'));var deskjs=require(_0xfca6('0xf'));var toCsv=require(_0xfca6('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfca6('0x11'));var qs=require(_0xfca6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfca6('0x13'))(_0xfca6('0x14'));var utils=require(_0xfca6('0x15'));var config=require(_0xfca6('0x16'));var licenseUtil=require(_0xfca6('0x17'));var db=require(_0xfca6('0x18'))['db'];function respondWithStatusCode(_0x43981b,_0xc9fb13){_0xc9fb13=_0xc9fb13||0xcc;return function(_0x474fed){if(_0x474fed){return _0x43981b['sendStatus'](_0xc9fb13);}return _0x43981b[_0xfca6('0x19')](_0xc9fb13)[_0xfca6('0x1a')]();};}function respondWithResult(_0x360d4b,_0x26f425){_0x26f425=_0x26f425||0xc8;return function(_0x47a15c){if(_0x47a15c){return _0x360d4b[_0xfca6('0x19')](_0x26f425)[_0xfca6('0x1b')](_0x47a15c);}};}function respondWithFilteredResult(_0x13cea0,_0x5dba8a){return function(_0x3cd763){if(_0x3cd763){var _0xb849e9=typeof _0x5dba8a[_0xfca6('0x1c')]==='undefined'&&typeof _0x5dba8a[_0xfca6('0x1d')]===_0xfca6('0x1e');var _0x19ba94=_0x3cd763[_0xfca6('0x1f')];var _0x2d2063=_0xb849e9?0x0:_0x5dba8a['offset'];var _0x349489=_0xb849e9?_0x3cd763[_0xfca6('0x1f')]:_0x5dba8a[_0xfca6('0x1c')]+_0x5dba8a[_0xfca6('0x1d')];var _0x308c8b;if(_0x349489>=_0x19ba94){_0x349489=_0x19ba94;_0x308c8b=0xc8;}else{_0x308c8b=0xce;}_0x13cea0[_0xfca6('0x19')](_0x308c8b);return _0x13cea0['set']('Content-Range',_0x2d2063+'-'+_0x349489+'/'+_0x19ba94)['json'](_0x3cd763);}return null;};}function patchUpdates(_0x35cf2c){return function(_0x46694e){try{jsonpatch[_0xfca6('0x20')](_0x46694e,_0x35cf2c,!![]);}catch(_0x1d7cd4){return BPromise[_0xfca6('0x21')](_0x1d7cd4);}return _0x46694e['save']();};}function saveUpdates(_0x58cdfa,_0x30ffcd){return function(_0x592eb5){if(_0x592eb5){return _0x592eb5[_0xfca6('0x22')](_0x58cdfa)[_0xfca6('0x23')](function(_0x435a32){return _0x435a32;});}return null;};}function removeEntity(_0x361811,_0x408899){return function(_0x534c0d){if(_0x534c0d){return _0x534c0d[_0xfca6('0x24')]()[_0xfca6('0x23')](function(){_0x361811[_0xfca6('0x19')](0xcc)[_0xfca6('0x1a')]();});}};}function handleEntityNotFound(_0x3b9a86,_0x26b299){return function(_0x42c26d){if(!_0x42c26d){_0x3b9a86[_0xfca6('0x25')](0x194);}return _0x42c26d;};}function handleError(_0x47e8bc,_0x5171d9){_0x5171d9=_0x5171d9||0x1f4;return function(_0x19d610){logger[_0xfca6('0x26')](_0x19d610['stack']);if(_0x19d610['name']){delete _0x19d610[_0xfca6('0x27')];}_0x47e8bc[_0xfca6('0x19')](_0x5171d9)[_0xfca6('0x28')](_0x19d610);};}exports[_0xfca6('0x29')]=function(_0x22b25e,_0x5b6cf7){var _0x3d1766={},_0x12c0fe={},_0x500c38={'count':0x0,'rows':[]};var _0x1bc67c=_['map'](db['MailServerOut'][_0xfca6('0x2a')],function(_0x3751eb){return{'name':_0x3751eb[_0xfca6('0x2b')],'type':_0x3751eb[_0xfca6('0x2c')][_0xfca6('0x2d')]};});_0x12c0fe[_0xfca6('0x2e')]=_['map'](_0x1bc67c,'name');_0x12c0fe[_0xfca6('0x2f')]=_[_0xfca6('0x30')](_0x22b25e[_0xfca6('0x2f')]);_0x12c0fe[_0xfca6('0x31')]=_[_0xfca6('0x32')](_0x12c0fe[_0xfca6('0x2e')],_0x12c0fe[_0xfca6('0x2f')]);_0x3d1766[_0xfca6('0x33')]=_[_0xfca6('0x32')](_0x12c0fe[_0xfca6('0x2e')],qs['fields'](_0x22b25e['query']['fields']));_0x3d1766[_0xfca6('0x33')]=_0x3d1766[_0xfca6('0x33')]['length']?_0x3d1766[_0xfca6('0x33')]:_0x12c0fe[_0xfca6('0x2e')];if(!_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x34')](_0xfca6('0x35'))){_0x3d1766[_0xfca6('0x1d')]=qs[_0xfca6('0x1d')](_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x1d')]);_0x3d1766[_0xfca6('0x1c')]=qs['offset'](_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x1c')]);}_0x3d1766[_0xfca6('0x36')]=qs['sort'](_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x37')]);_0x3d1766['where']=qs[_0xfca6('0x31')](_[_0xfca6('0x38')](_0x22b25e[_0xfca6('0x2f')],_0x12c0fe[_0xfca6('0x31')]),_0x1bc67c);if(_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x39')]){_0x3d1766[_0xfca6('0x3a')]=_[_0xfca6('0x3b')](_0x3d1766[_0xfca6('0x3a')],{'$or':_['map'](_0x1bc67c,function(_0x47e424){if(_0x47e424['type']!==_0xfca6('0x3c')){var _0x376f5b={};_0x376f5b[_0x47e424[_0xfca6('0x27')]]={'$like':'%'+_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x39')]+'%'};return _0x376f5b;}})});}_0x3d1766=_['merge']({},_0x3d1766,_0x22b25e[_0xfca6('0x3d')]);var _0x2b465b={'where':_0x3d1766[_0xfca6('0x3a')]};return db[_0xfca6('0x3e')]['count'](_0x2b465b)['then'](function(_0x84c3fd){_0x500c38[_0xfca6('0x1f')]=_0x84c3fd;if(_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x3f')]){_0x3d1766[_0xfca6('0x40')]=[{'all':!![]}];}return db[_0xfca6('0x3e')][_0xfca6('0x41')](_0x3d1766);})['then'](function(_0x3c6cd0){_0x500c38[_0xfca6('0x42')]=_0x3c6cd0;return _0x500c38;})[_0xfca6('0x23')](respondWithFilteredResult(_0x5b6cf7,_0x3d1766))[_0xfca6('0x43')](handleError(_0x5b6cf7,null));};exports['show']=function(_0x1008e6,_0x2618cc){var _0xa2410b={'raw':!![],'where':{'id':_0x1008e6[_0xfca6('0x44')]['id']}},_0x206129={};_0x206129[_0xfca6('0x2e')]=_['keys'](db[_0xfca6('0x3e')]['rawAttributes']);_0x206129[_0xfca6('0x2f')]=_[_0xfca6('0x30')](_0x1008e6[_0xfca6('0x2f')]);_0x206129[_0xfca6('0x31')]=_[_0xfca6('0x32')](_0x206129['model'],_0x206129[_0xfca6('0x2f')]);_0xa2410b[_0xfca6('0x33')]=_[_0xfca6('0x32')](_0x206129[_0xfca6('0x2e')],qs[_0xfca6('0x45')](_0x1008e6[_0xfca6('0x2f')][_0xfca6('0x45')]));_0xa2410b[_0xfca6('0x33')]=_0xa2410b[_0xfca6('0x33')][_0xfca6('0x46')]?_0xa2410b['attributes']:_0x206129[_0xfca6('0x2e')];if(_0x1008e6[_0xfca6('0x2f')][_0xfca6('0x3f')]){_0xa2410b[_0xfca6('0x40')]=[{'all':!![]}];}_0xa2410b=_[_0xfca6('0x3b')]({},_0xa2410b,_0x1008e6['options']);return db[_0xfca6('0x3e')][_0xfca6('0x47')](_0xa2410b)['then'](handleEntityNotFound(_0x2618cc,null))[_0xfca6('0x23')](respondWithResult(_0x2618cc,null))['catch'](handleError(_0x2618cc,null));};exports[_0xfca6('0x48')]=function(_0x3146ce,_0x4b89fe){return db[_0xfca6('0x3e')]['create'](_0x3146ce['body'],{})['then'](respondWithResult(_0x4b89fe,0xc9))[_0xfca6('0x43')](handleError(_0x4b89fe,null));};exports['update']=function(_0x53c74f,_0x4d84cb){if(_0x53c74f['body']['id']){delete _0x53c74f[_0xfca6('0x49')]['id'];}return db[_0xfca6('0x3e')][_0xfca6('0x47')]({'where':{'id':_0x53c74f[_0xfca6('0x44')]['id']}})[_0xfca6('0x23')](handleEntityNotFound(_0x4d84cb,null))['then'](saveUpdates(_0x53c74f[_0xfca6('0x49')],null))[_0xfca6('0x23')](respondWithResult(_0x4d84cb,null))[_0xfca6('0x43')](handleError(_0x4d84cb,null));};exports[_0xfca6('0x24')]=function(_0x30fd29,_0x551b33){return db[_0xfca6('0x3e')][_0xfca6('0x47')]({'where':{'id':_0x30fd29[_0xfca6('0x44')]['id']}})[_0xfca6('0x23')](handleEntityNotFound(_0x551b33,null))['then'](removeEntity(_0x551b33,null))[_0xfca6('0x43')](handleError(_0x551b33,null));}; \ No newline at end of file +var _0xc37f=['../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','reject','save','destroy','then','error','name','send','map','MailServerOut','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x72493a,_0x158721){var _0x4c6027=function(_0x471e97){while(--_0x471e97){_0x72493a['push'](_0x72493a['shift']());}};_0x4c6027(++_0x158721);}(_0xc37f,0x10d));var _0xfc37=function(_0x2699bb,_0x4367f3){_0x2699bb=_0x2699bb-0x0;var _0x12c137=_0xc37f[_0x2699bb];return _0x12c137;};'use strict';var emlformat=require(_0xfc37('0x0'));var rimraf=require(_0xfc37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc37('0x2'));var rp=require(_0xfc37('0x3'));var moment=require('moment');var BPromise=require(_0xfc37('0x4'));var Mustache=require(_0xfc37('0x5'));var util=require(_0xfc37('0x6'));var path=require('path');var sox=require(_0xfc37('0x7'));var csv=require(_0xfc37('0x8'));var ejs=require(_0xfc37('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc37('0xa'));var squel=require(_0xfc37('0xb'));var crypto=require(_0xfc37('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfc37('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfc37('0xe'));var Papa=require('papaparse');var Redis=require(_0xfc37('0xf'));var authService=require(_0xfc37('0x10'));var qs=require(_0xfc37('0x11'));var as=require(_0xfc37('0x12'));var hardwareService=require(_0xfc37('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfc37('0x14'));var config=require(_0xfc37('0x15'));var licenseUtil=require(_0xfc37('0x16'));var db=require(_0xfc37('0x17'))['db'];function respondWithStatusCode(_0x396ec2,_0x28d582){_0x28d582=_0x28d582||0xcc;return function(_0x23ff3a){if(_0x23ff3a){return _0x396ec2[_0xfc37('0x18')](_0x28d582);}return _0x396ec2['status'](_0x28d582)[_0xfc37('0x19')]();};}function respondWithResult(_0x4097d0,_0x50caef){_0x50caef=_0x50caef||0xc8;return function(_0x1d5a74){if(_0x1d5a74){return _0x4097d0['status'](_0x50caef)['json'](_0x1d5a74);}};}function respondWithFilteredResult(_0x1d318a,_0x5d6a50){return function(_0x157b8a){if(_0x157b8a){var _0x25a05b=typeof _0x5d6a50[_0xfc37('0x1a')]==='undefined'&&typeof _0x5d6a50[_0xfc37('0x1b')]===_0xfc37('0x1c');var _0x3039b2=_0x157b8a['count'];var _0x1d4118=_0x25a05b?0x0:_0x5d6a50['offset'];var _0x4655dc=_0x25a05b?_0x157b8a[_0xfc37('0x1d')]:_0x5d6a50[_0xfc37('0x1a')]+_0x5d6a50[_0xfc37('0x1b')];var _0x1c933b;if(_0x4655dc>=_0x3039b2){_0x4655dc=_0x3039b2;_0x1c933b=0xc8;}else{_0x1c933b=0xce;}_0x1d318a[_0xfc37('0x1e')](_0x1c933b);return _0x1d318a[_0xfc37('0x1f')](_0xfc37('0x20'),_0x1d4118+'-'+_0x4655dc+'/'+_0x3039b2)[_0xfc37('0x21')](_0x157b8a);}return null;};}function patchUpdates(_0x186d40){return function(_0x157ce7){try{jsonpatch[_0xfc37('0x22')](_0x157ce7,_0x186d40,!![]);}catch(_0x4522db){return BPromise[_0xfc37('0x23')](_0x4522db);}return _0x157ce7[_0xfc37('0x24')]();};}function saveUpdates(_0x5cea4c,_0x2f4f98){return function(_0x1d28cb){if(_0x1d28cb){return _0x1d28cb['update'](_0x5cea4c)['then'](function(_0x1a5fda){return _0x1a5fda;});}return null;};}function removeEntity(_0x1be596,_0x40beb9){return function(_0x2792f1){if(_0x2792f1){return _0x2792f1[_0xfc37('0x25')]()[_0xfc37('0x26')](function(){_0x1be596[_0xfc37('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x304c26,_0x581064){return function(_0x1b4a31){if(!_0x1b4a31){_0x304c26[_0xfc37('0x18')](0x194);}return _0x1b4a31;};}function handleError(_0x1a2ebc,_0x32486e){_0x32486e=_0x32486e||0x1f4;return function(_0x1622ae){logger[_0xfc37('0x27')](_0x1622ae['stack']);if(_0x1622ae[_0xfc37('0x28')]){delete _0x1622ae[_0xfc37('0x28')];}_0x1a2ebc['status'](_0x32486e)[_0xfc37('0x29')](_0x1622ae);};}exports['index']=function(_0x35bd24,_0x249b47){var _0x3846ea={},_0x2b6cd6={},_0x2fead5={'count':0x0,'rows':[]};var _0x1b4e38=_[_0xfc37('0x2a')](db[_0xfc37('0x2b')][_0xfc37('0x2c')],function(_0x18b06f){return{'name':_0x18b06f['fieldName'],'type':_0x18b06f[_0xfc37('0x2d')][_0xfc37('0x2e')]};});_0x2b6cd6[_0xfc37('0x2f')]=_['map'](_0x1b4e38,'name');_0x2b6cd6[_0xfc37('0x30')]=_[_0xfc37('0x31')](_0x35bd24[_0xfc37('0x30')]);_0x2b6cd6['filters']=_[_0xfc37('0x32')](_0x2b6cd6['model'],_0x2b6cd6[_0xfc37('0x30')]);_0x3846ea['attributes']=_['intersection'](_0x2b6cd6[_0xfc37('0x2f')],qs[_0xfc37('0x33')](_0x35bd24[_0xfc37('0x30')][_0xfc37('0x33')]));_0x3846ea[_0xfc37('0x34')]=_0x3846ea['attributes'][_0xfc37('0x35')]?_0x3846ea[_0xfc37('0x34')]:_0x2b6cd6[_0xfc37('0x2f')];if(!_0x35bd24['query']['hasOwnProperty']('nolimit')){_0x3846ea['limit']=qs[_0xfc37('0x1b')](_0x35bd24[_0xfc37('0x30')][_0xfc37('0x1b')]);_0x3846ea[_0xfc37('0x1a')]=qs[_0xfc37('0x1a')](_0x35bd24[_0xfc37('0x30')][_0xfc37('0x1a')]);}_0x3846ea[_0xfc37('0x36')]=qs[_0xfc37('0x37')](_0x35bd24[_0xfc37('0x30')]['sort']);_0x3846ea['where']=qs[_0xfc37('0x38')](_['pick'](_0x35bd24[_0xfc37('0x30')],_0x2b6cd6[_0xfc37('0x38')]),_0x1b4e38);if(_0x35bd24[_0xfc37('0x30')][_0xfc37('0x39')]){_0x3846ea[_0xfc37('0x3a')]=_['merge'](_0x3846ea[_0xfc37('0x3a')],{'$or':_[_0xfc37('0x2a')](_0x1b4e38,function(_0x203e08){if(_0x203e08[_0xfc37('0x2d')]!==_0xfc37('0x3b')){var _0x527e09={};_0x527e09[_0x203e08[_0xfc37('0x28')]]={'$like':'%'+_0x35bd24[_0xfc37('0x30')]['filter']+'%'};return _0x527e09;}})});}_0x3846ea=_[_0xfc37('0x3c')]({},_0x3846ea,_0x35bd24[_0xfc37('0x3d')]);var _0x212d94={'where':_0x3846ea[_0xfc37('0x3a')]};return db[_0xfc37('0x2b')][_0xfc37('0x1d')](_0x212d94)[_0xfc37('0x26')](function(_0x39c30b){_0x2fead5['count']=_0x39c30b;if(_0x35bd24[_0xfc37('0x30')][_0xfc37('0x3e')]){_0x3846ea[_0xfc37('0x3f')]=[{'all':!![]}];}return db[_0xfc37('0x2b')][_0xfc37('0x40')](_0x3846ea);})['then'](function(_0x3f69aa){_0x2fead5[_0xfc37('0x41')]=_0x3f69aa;return _0x2fead5;})[_0xfc37('0x26')](respondWithFilteredResult(_0x249b47,_0x3846ea))[_0xfc37('0x42')](handleError(_0x249b47,null));};exports[_0xfc37('0x43')]=function(_0x1b9668,_0x275ae3){var _0x1d1043={'raw':!![],'where':{'id':_0x1b9668[_0xfc37('0x44')]['id']}},_0x4f7d60={};_0x4f7d60[_0xfc37('0x2f')]=_['keys'](db[_0xfc37('0x2b')][_0xfc37('0x2c')]);_0x4f7d60[_0xfc37('0x30')]=_['keys'](_0x1b9668[_0xfc37('0x30')]);_0x4f7d60[_0xfc37('0x38')]=_[_0xfc37('0x32')](_0x4f7d60[_0xfc37('0x2f')],_0x4f7d60['query']);_0x1d1043[_0xfc37('0x34')]=_[_0xfc37('0x32')](_0x4f7d60[_0xfc37('0x2f')],qs[_0xfc37('0x33')](_0x1b9668[_0xfc37('0x30')][_0xfc37('0x33')]));_0x1d1043[_0xfc37('0x34')]=_0x1d1043[_0xfc37('0x34')][_0xfc37('0x35')]?_0x1d1043[_0xfc37('0x34')]:_0x4f7d60[_0xfc37('0x2f')];if(_0x1b9668[_0xfc37('0x30')][_0xfc37('0x3e')]){_0x1d1043[_0xfc37('0x3f')]=[{'all':!![]}];}_0x1d1043=_[_0xfc37('0x3c')]({},_0x1d1043,_0x1b9668[_0xfc37('0x3d')]);return db[_0xfc37('0x2b')][_0xfc37('0x45')](_0x1d1043)[_0xfc37('0x26')](handleEntityNotFound(_0x275ae3,null))[_0xfc37('0x26')](respondWithResult(_0x275ae3,null))[_0xfc37('0x42')](handleError(_0x275ae3,null));};exports[_0xfc37('0x46')]=function(_0x5d98d4,_0x36a692){return db[_0xfc37('0x2b')][_0xfc37('0x46')](_0x5d98d4[_0xfc37('0x47')],{})[_0xfc37('0x26')](respondWithResult(_0x36a692,0xc9))['catch'](handleError(_0x36a692,null));};exports[_0xfc37('0x48')]=function(_0x2b3de4,_0x29d570){if(_0x2b3de4['body']['id']){delete _0x2b3de4[_0xfc37('0x47')]['id'];}return db[_0xfc37('0x2b')][_0xfc37('0x45')]({'where':{'id':_0x2b3de4['params']['id']}})['then'](handleEntityNotFound(_0x29d570,null))[_0xfc37('0x26')](saveUpdates(_0x2b3de4[_0xfc37('0x47')],null))[_0xfc37('0x26')](respondWithResult(_0x29d570,null))[_0xfc37('0x42')](handleError(_0x29d570,null));};exports[_0xfc37('0x25')]=function(_0x58ee75,_0x3065e1){return db[_0xfc37('0x2b')][_0xfc37('0x45')]({'where':{'id':_0x58ee75[_0xfc37('0x44')]['id']}})[_0xfc37('0x26')](handleEntityNotFound(_0x3065e1,null))[_0xfc37('0x26')](removeEntity(_0x3065e1,null))['catch'](handleError(_0x3065e1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 5ed33df..43c9c49 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 _0x7912=['define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./mailServerOut.attributes','exports'];(function(_0x3373b7,_0x19160d){var _0x50e444=function(_0x2f7c9f){while(--_0x2f7c9f){_0x3373b7['push'](_0x3373b7['shift']());}};_0x50e444(++_0x19160d);}(_0x7912,0xdf));var _0x2791=function(_0x13e5b4,_0x350cbd){_0x13e5b4=_0x13e5b4-0x0;var _0x13605a=_0x7912[_0x13e5b4];return _0x13605a;};'use strict';var _=require(_0x2791('0x0'));var util=require(_0x2791('0x1'));var logger=require(_0x2791('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2791('0x3'));var rp=require(_0x2791('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2791('0x5'));var config=require('../../config/environment');var attributes=require(_0x2791('0x6'));module[_0x2791('0x7')]=function(_0x413703,_0x3de711){return _0x413703[_0x2791('0x8')](_0x2791('0x9'),attributes,{'tableName':_0x2791('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a22=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7a22,0xa3));var _0x27a2=function(_0x2501e2,_0x136e25){_0x2501e2=_0x2501e2-0x0;var _0xda5f30=_0x7a22[_0x2501e2];return _0xda5f30;};'use strict';var _=require(_0x27a2('0x0'));var util=require(_0x27a2('0x1'));var logger=require(_0x27a2('0x2'))(_0x27a2('0x3'));var moment=require(_0x27a2('0x4'));var BPromise=require(_0x27a2('0x5'));var rp=require(_0x27a2('0x6'));var fs=require('fs');var path=require(_0x27a2('0x7'));var rimraf=require(_0x27a2('0x8'));var config=require(_0x27a2('0x9'));var attributes=require(_0x27a2('0xa'));module[_0x27a2('0xb')]=function(_0x3ecc74,_0x1e398e){return _0x3ecc74[_0x27a2('0xc')](_0x27a2('0xd'),attributes,{'tableName':_0x27a2('0xe'),'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 6b6524e..0adab60 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x12566c,_0x2668c4){var _0x2034c9=function(_0x5b2133){while(--_0x5b2133){_0x12566c['push'](_0x12566c['shift']());}};_0x2034c9(++_0x2668c4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x38030d,_0x2eae24){var _0xbcb817=function(_0x2f5253){while(--_0x2f5253){_0x38030d['push'](_0x38030d['shift']());}};_0xbcb817(++_0x2eae24);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 7fafb7b..d08caf0 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 _0xd529=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path'];(function(_0x56407c,_0x3f9ca7){var _0x3edf9a=function(_0x50a620){while(--_0x50a620){_0x56407c['push'](_0x56407c['shift']());}};_0x3edf9a(++_0x3f9ca7);}(_0xd529,0xb5));var _0x9d52=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd529[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x9d52('0x0'));var util=require(_0x9d52('0x1'));var path=require(_0x9d52('0x2'));var timeout=require(_0x9d52('0x3'));var express=require(_0x9d52('0x4'));var router=express[_0x9d52('0x5')]();var fs_extra=require(_0x9d52('0x6'));var auth=require(_0x9d52('0x7'));var interaction=require(_0x9d52('0x8'));var config=require(_0x9d52('0x9'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x9d52('0xa')](),controller['index']);router[_0x9d52('0xb')](_0x9d52('0xc'),auth[_0x9d52('0xa')](),controller[_0x9d52('0xd')]);router[_0x9d52('0xb')]('/:id',auth[_0x9d52('0xa')](),controller[_0x9d52('0xe')]);router[_0x9d52('0xf')]('/',auth['isAuthenticated'](),controller[_0x9d52('0x10')]);router[_0x9d52('0x11')]('/:id',auth[_0x9d52('0xa')](),controller[_0x9d52('0x12')]);router[_0x9d52('0x13')](_0x9d52('0x14'),auth['isAuthenticated'](),controller[_0x9d52('0x15')]);module[_0x9d52('0x16')]=router; \ No newline at end of file +var _0xe995=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x116682,_0x329113){var _0x1ce4d9=function(_0x3af8d5){while(--_0x3af8d5){_0x116682['push'](_0x116682['shift']());}};_0x1ce4d9(++_0x329113);}(_0xe995,0x1b6));var _0x5e99=function(_0x584184,_0x1b6b1b){_0x584184=_0x584184-0x0;var _0x5ad6e7=_0xe995[_0x584184];return _0x5ad6e7;};'use strict';var multer=require(_0x5e99('0x0'));var util=require(_0x5e99('0x1'));var path=require(_0x5e99('0x2'));var timeout=require(_0x5e99('0x3'));var express=require(_0x5e99('0x4'));var router=express[_0x5e99('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5e99('0x6'));var interaction=require(_0x5e99('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x5e99('0x8')](),controller['index']);router[_0x5e99('0x9')](_0x5e99('0xa'),auth[_0x5e99('0x8')](),controller[_0x5e99('0xb')]);router[_0x5e99('0x9')](_0x5e99('0xc'),auth['isAuthenticated'](),controller[_0x5e99('0xd')]);router['post']('/',auth[_0x5e99('0x8')](),controller[_0x5e99('0xe')]);router[_0x5e99('0xf')](_0x5e99('0xc'),auth[_0x5e99('0x8')](),controller[_0x5e99('0x10')]);router[_0x5e99('0x11')](_0x5e99('0xc'),auth[_0x5e99('0x8')](),controller[_0x5e99('0x12')]);module[_0x5e99('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e8a87c3..1e0d2fb 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 _0xfc65=['STRING','sequelize','name'];(function(_0xa8d305,_0x2119a5){var _0x28b365=function(_0x5f2ec4){while(--_0x5f2ec4){_0xa8d305['push'](_0xa8d305['shift']());}};_0x28b365(++_0x2119a5);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x1b0eb4,_0x3ec80c){_0x1b0eb4=_0x1b0eb4-0x0;var _0x5c57f4=_0xfc65[_0x1b0eb4];return _0x5c57f4;};'use strict';var Sequelize=require(_0x5fc6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5fc6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5fc6('0x2')]}}; \ No newline at end of file +var _0xc359=['name','STRING','exports'];(function(_0x44fd6b,_0x338098){var _0x7cba12=function(_0x5a6bb5){while(--_0x5a6bb5){_0x44fd6b['push'](_0x44fd6b['shift']());}};_0x7cba12(++_0x338098);}(_0xc359,0x1d9));var _0x9c35=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xc359[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require('sequelize');module[_0x9c35('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9c35('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c35('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 364ebb1..b585d0b 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 _0x29a7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','MailSubstatus','findAll','rows','show','params','rawAttributes','keys','include','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3695df,_0x22c52b){var _0x4d0f16=function(_0x3f15dd){while(--_0x3f15dd){_0x3695df['push'](_0x3695df['shift']());}};_0x4d0f16(++_0x22c52b);}(_0x29a7,0x1af));var _0x729a=function(_0x239e78,_0x2e5e3){_0x239e78=_0x239e78-0x0;var _0x46d5e4=_0x29a7[_0x239e78];return _0x46d5e4;};'use strict';var emlformat=require(_0x729a('0x0'));var rimraf=require(_0x729a('0x1'));var zipdir=require(_0x729a('0x2'));var jsonpatch=require(_0x729a('0x3'));var rp=require(_0x729a('0x4'));var moment=require(_0x729a('0x5'));var BPromise=require(_0x729a('0x6'));var Mustache=require(_0x729a('0x7'));var util=require(_0x729a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x729a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x729a('0xa'));var _=require(_0x729a('0xb'));var squel=require(_0x729a('0xc'));var crypto=require(_0x729a('0xd'));var jsforce=require(_0x729a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x729a('0x9'));var querystring=require(_0x729a('0xf'));var Papa=require(_0x729a('0x10'));var Redis=require(_0x729a('0x11'));var authService=require(_0x729a('0x12'));var qs=require(_0x729a('0x13'));var as=require(_0x729a('0x14'));var hardwareService=require(_0x729a('0x15'));var logger=require(_0x729a('0x16'))('api');var utils=require(_0x729a('0x17'));var config=require(_0x729a('0x18'));var licenseUtil=require(_0x729a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa2a0d4,_0x1f96d0){_0x1f96d0=_0x1f96d0||0xcc;return function(_0x41958c){if(_0x41958c){return _0xa2a0d4[_0x729a('0x1a')](_0x1f96d0);}return _0xa2a0d4['status'](_0x1f96d0)['end']();};}function respondWithResult(_0x259442,_0x511cc9){_0x511cc9=_0x511cc9||0xc8;return function(_0x3aa2a7){if(_0x3aa2a7){return _0x259442[_0x729a('0x1b')](_0x511cc9)[_0x729a('0x1c')](_0x3aa2a7);}};}function respondWithFilteredResult(_0x531c42,_0x237b13){return function(_0x55e735){if(_0x55e735){var _0x3783c2=typeof _0x237b13['offset']===_0x729a('0x1d')&&typeof _0x237b13[_0x729a('0x1e')]===_0x729a('0x1d');var _0x121a82=_0x55e735[_0x729a('0x1f')];var _0x5de22e=_0x3783c2?0x0:_0x237b13[_0x729a('0x20')];var _0x369c97=_0x3783c2?_0x55e735[_0x729a('0x1f')]:_0x237b13[_0x729a('0x20')]+_0x237b13[_0x729a('0x1e')];var _0x229622;if(_0x369c97>=_0x121a82){_0x369c97=_0x121a82;_0x229622=0xc8;}else{_0x229622=0xce;}_0x531c42[_0x729a('0x1b')](_0x229622);return _0x531c42[_0x729a('0x21')](_0x729a('0x22'),_0x5de22e+'-'+_0x369c97+'/'+_0x121a82)[_0x729a('0x1c')](_0x55e735);}return null;};}function patchUpdates(_0x372727){return function(_0x16fb93){try{jsonpatch[_0x729a('0x23')](_0x16fb93,_0x372727,!![]);}catch(_0x2262b1){return BPromise[_0x729a('0x24')](_0x2262b1);}return _0x16fb93['save']();};}function saveUpdates(_0x5e09cc,_0x3a28db){return function(_0x248294){if(_0x248294){return _0x248294[_0x729a('0x25')](_0x5e09cc)[_0x729a('0x26')](function(_0x137241){return _0x137241;});}return null;};}function removeEntity(_0x145b9a,_0x46a2c2){return function(_0xc8a8d1){if(_0xc8a8d1){return _0xc8a8d1[_0x729a('0x27')]()['then'](function(){_0x145b9a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x373cb0,_0x20407c){return function(_0x5ea2a6){if(!_0x5ea2a6){_0x373cb0[_0x729a('0x1a')](0x194);}return _0x5ea2a6;};}function handleError(_0x5889e4,_0x41ceb0){_0x41ceb0=_0x41ceb0||0x1f4;return function(_0x2bdd91){logger[_0x729a('0x28')](_0x2bdd91[_0x729a('0x29')]);if(_0x2bdd91['name']){delete _0x2bdd91[_0x729a('0x2a')];}_0x5889e4[_0x729a('0x1b')](_0x41ceb0)[_0x729a('0x2b')](_0x2bdd91);};}exports['index']=function(_0x6a1e4d,_0x46a53f){var _0x4bf151={},_0x5dd096={},_0xa240d2={'count':0x0,'rows':[]};var _0x3b10cc=_[_0x729a('0x2c')](db['MailSubstatus']['rawAttributes'],function(_0x35d82c){return{'name':_0x35d82c[_0x729a('0x2d')],'type':_0x35d82c[_0x729a('0x2e')][_0x729a('0x2f')]};});_0x5dd096[_0x729a('0x30')]=_[_0x729a('0x2c')](_0x3b10cc,_0x729a('0x2a'));_0x5dd096[_0x729a('0x31')]=_['keys'](_0x6a1e4d[_0x729a('0x31')]);_0x5dd096[_0x729a('0x32')]=_[_0x729a('0x33')](_0x5dd096[_0x729a('0x30')],_0x5dd096[_0x729a('0x31')]);_0x4bf151[_0x729a('0x34')]=_[_0x729a('0x33')](_0x5dd096[_0x729a('0x30')],qs[_0x729a('0x35')](_0x6a1e4d[_0x729a('0x31')][_0x729a('0x35')]));_0x4bf151[_0x729a('0x34')]=_0x4bf151[_0x729a('0x34')][_0x729a('0x36')]?_0x4bf151['attributes']:_0x5dd096[_0x729a('0x30')];if(!_0x6a1e4d['query']['hasOwnProperty'](_0x729a('0x37'))){_0x4bf151['limit']=qs[_0x729a('0x1e')](_0x6a1e4d[_0x729a('0x31')][_0x729a('0x1e')]);_0x4bf151[_0x729a('0x20')]=qs[_0x729a('0x20')](_0x6a1e4d[_0x729a('0x31')]['offset']);}_0x4bf151[_0x729a('0x38')]=qs[_0x729a('0x39')](_0x6a1e4d[_0x729a('0x31')][_0x729a('0x39')]);_0x4bf151[_0x729a('0x3a')]=qs[_0x729a('0x32')](_[_0x729a('0x3b')](_0x6a1e4d[_0x729a('0x31')],_0x5dd096['filters']),_0x3b10cc);if(_0x6a1e4d[_0x729a('0x31')]['filter']){_0x4bf151['where']=_['merge'](_0x4bf151[_0x729a('0x3a')],{'$or':_[_0x729a('0x2c')](_0x3b10cc,function(_0xfa2b43){if(_0xfa2b43[_0x729a('0x2e')]!=='VIRTUAL'){var _0xc27947={};_0xc27947[_0xfa2b43[_0x729a('0x2a')]]={'$like':'%'+_0x6a1e4d[_0x729a('0x31')][_0x729a('0x3c')]+'%'};return _0xc27947;}})});}_0x4bf151=_[_0x729a('0x3d')]({},_0x4bf151,_0x6a1e4d[_0x729a('0x3e')]);var _0xb6dd16={'where':_0x4bf151[_0x729a('0x3a')]};return db[_0x729a('0x3f')][_0x729a('0x1f')](_0xb6dd16)[_0x729a('0x26')](function(_0x20e767){_0xa240d2[_0x729a('0x1f')]=_0x20e767;if(_0x6a1e4d['query']['includeAll']){_0x4bf151['include']=[{'all':!![]}];}return db[_0x729a('0x3f')][_0x729a('0x40')](_0x4bf151);})['then'](function(_0xa18d8d){_0xa240d2[_0x729a('0x41')]=_0xa18d8d;return _0xa240d2;})['then'](respondWithFilteredResult(_0x46a53f,_0x4bf151))['catch'](handleError(_0x46a53f,null));};exports[_0x729a('0x42')]=function(_0x2d4b4e,_0x1f1188){var _0x108b17={'raw':!![],'where':{'id':_0x2d4b4e[_0x729a('0x43')]['id']}},_0x2066af={};_0x2066af[_0x729a('0x30')]=_['keys'](db['MailSubstatus'][_0x729a('0x44')]);_0x2066af[_0x729a('0x31')]=_[_0x729a('0x45')](_0x2d4b4e[_0x729a('0x31')]);_0x2066af[_0x729a('0x32')]=_[_0x729a('0x33')](_0x2066af[_0x729a('0x30')],_0x2066af[_0x729a('0x31')]);_0x108b17[_0x729a('0x34')]=_[_0x729a('0x33')](_0x2066af['model'],qs['fields'](_0x2d4b4e[_0x729a('0x31')][_0x729a('0x35')]));_0x108b17['attributes']=_0x108b17[_0x729a('0x34')]['length']?_0x108b17[_0x729a('0x34')]:_0x2066af[_0x729a('0x30')];if(_0x2d4b4e['query']['includeAll']){_0x108b17[_0x729a('0x46')]=[{'all':!![]}];}_0x108b17=_['merge']({},_0x108b17,_0x2d4b4e[_0x729a('0x3e')]);return db[_0x729a('0x3f')]['find'](_0x108b17)[_0x729a('0x26')](handleEntityNotFound(_0x1f1188,null))[_0x729a('0x26')](respondWithResult(_0x1f1188,null))[_0x729a('0x47')](handleError(_0x1f1188,null));};exports[_0x729a('0x48')]=function(_0x46a926,_0x1b9b26){return db[_0x729a('0x3f')][_0x729a('0x48')](_0x46a926[_0x729a('0x49')],{})[_0x729a('0x26')](respondWithResult(_0x1b9b26,0xc9))[_0x729a('0x47')](handleError(_0x1b9b26,null));};exports[_0x729a('0x25')]=function(_0x4c9d09,_0x4ada1d){if(_0x4c9d09[_0x729a('0x49')]['id']){delete _0x4c9d09[_0x729a('0x49')]['id'];}return db[_0x729a('0x3f')]['find']({'where':{'id':_0x4c9d09['params']['id']}})[_0x729a('0x26')](handleEntityNotFound(_0x4ada1d,null))[_0x729a('0x26')](saveUpdates(_0x4c9d09[_0x729a('0x49')],null))['then'](respondWithResult(_0x4ada1d,null))['catch'](handleError(_0x4ada1d,null));};exports[_0x729a('0x27')]=function(_0x677646,_0x5d3c58){return db[_0x729a('0x3f')]['find']({'where':{'id':_0x677646[_0x729a('0x43')]['id']}})[_0x729a('0x26')](handleEntityNotFound(_0x5d3c58,null))[_0x729a('0x26')](removeEntity(_0x5d3c58,null))[_0x729a('0x47')](handleError(_0x5d3c58,null));};exports[_0x729a('0x4a')]=function(_0x8702ed,_0x34ad6a){return db['MailSubstatus'][_0x729a('0x4a')]()['then'](respondWithResult(_0x34ad6a,null))[_0x729a('0x47')](handleError(_0x34ad6a,null));}; \ No newline at end of file +var _0x3687=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','MailSubstatus','rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','length','order','sort','where','pick','filters','filter','VIRTUAL','options','include','findAll','rows','params','merge','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0xae8766,_0x5419d2){var _0x4d0eb9=function(_0x153727){while(--_0x153727){_0xae8766['push'](_0xae8766['shift']());}};_0x4d0eb9(++_0x5419d2);}(_0x3687,0x117));var _0x7368=function(_0x496702,_0x4f37c4){_0x496702=_0x496702-0x0;var _0x66cc05=_0x3687[_0x496702];return _0x66cc05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7368('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7368('0x1'));var rp=require(_0x7368('0x2'));var moment=require(_0x7368('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7368('0x4'));var util=require(_0x7368('0x5'));var path=require(_0x7368('0x6'));var sox=require(_0x7368('0x7'));var csv=require(_0x7368('0x8'));var ejs=require(_0x7368('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7368('0xa'));var squel=require(_0x7368('0xb'));var crypto=require('crypto');var jsforce=require(_0x7368('0xc'));var deskjs=require(_0x7368('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7368('0xe'));var Redis=require(_0x7368('0xf'));var authService=require(_0x7368('0x10'));var qs=require(_0x7368('0x11'));var as=require(_0x7368('0x12'));var hardwareService=require(_0x7368('0x13'));var logger=require(_0x7368('0x14'))(_0x7368('0x15'));var utils=require(_0x7368('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7368('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ac1ec,_0x94709e){_0x94709e=_0x94709e||0xcc;return function(_0x4b2b6d){if(_0x4b2b6d){return _0x4ac1ec[_0x7368('0x18')](_0x94709e);}return _0x4ac1ec['status'](_0x94709e)['end']();};}function respondWithResult(_0x4d4885,_0x477edd){_0x477edd=_0x477edd||0xc8;return function(_0x4305f1){if(_0x4305f1){return _0x4d4885['status'](_0x477edd)[_0x7368('0x19')](_0x4305f1);}};}function respondWithFilteredResult(_0x26ca97,_0x34956d){return function(_0x358b40){if(_0x358b40){var _0x542704=typeof _0x34956d[_0x7368('0x1a')]===_0x7368('0x1b')&&typeof _0x34956d['limit']===_0x7368('0x1b');var _0xa7cd02=_0x358b40[_0x7368('0x1c')];var _0x17f2ec=_0x542704?0x0:_0x34956d[_0x7368('0x1a')];var _0x584a5a=_0x542704?_0x358b40[_0x7368('0x1c')]:_0x34956d[_0x7368('0x1a')]+_0x34956d[_0x7368('0x1d')];var _0x25be47;if(_0x584a5a>=_0xa7cd02){_0x584a5a=_0xa7cd02;_0x25be47=0xc8;}else{_0x25be47=0xce;}_0x26ca97[_0x7368('0x1e')](_0x25be47);return _0x26ca97[_0x7368('0x1f')](_0x7368('0x20'),_0x17f2ec+'-'+_0x584a5a+'/'+_0xa7cd02)[_0x7368('0x19')](_0x358b40);}return null;};}function patchUpdates(_0x1d7176){return function(_0x335e82){try{jsonpatch[_0x7368('0x21')](_0x335e82,_0x1d7176,!![]);}catch(_0x372352){return BPromise[_0x7368('0x22')](_0x372352);}return _0x335e82[_0x7368('0x23')]();};}function saveUpdates(_0x138a3a,_0x3fc11a){return function(_0x24f243){if(_0x24f243){return _0x24f243[_0x7368('0x24')](_0x138a3a)[_0x7368('0x25')](function(_0x3018da){return _0x3018da;});}return null;};}function removeEntity(_0x40ab49,_0x5666ed){return function(_0x3ac8db){if(_0x3ac8db){return _0x3ac8db[_0x7368('0x26')]()[_0x7368('0x25')](function(){_0x40ab49[_0x7368('0x1e')](0xcc)[_0x7368('0x27')]();});}};}function handleEntityNotFound(_0x95815c,_0x2f1489){return function(_0x20e7d1){if(!_0x20e7d1){_0x95815c[_0x7368('0x18')](0x194);}return _0x20e7d1;};}function handleError(_0x171551,_0x1f22c0){_0x1f22c0=_0x1f22c0||0x1f4;return function(_0x57f2de){logger[_0x7368('0x28')](_0x57f2de[_0x7368('0x29')]);if(_0x57f2de[_0x7368('0x2a')]){delete _0x57f2de['name'];}_0x171551['status'](_0x1f22c0)['send'](_0x57f2de);};}exports['index']=function(_0x8754f3,_0x1bad1e){var _0x1beb9f={},_0x27fb2e={},_0x36c72b={'count':0x0,'rows':[]};var _0x2bb52f=_['map'](db[_0x7368('0x2b')][_0x7368('0x2c')],function(_0x4b502b){return{'name':_0x4b502b['fieldName'],'type':_0x4b502b[_0x7368('0x2d')][_0x7368('0x2e')]};});_0x27fb2e[_0x7368('0x2f')]=_[_0x7368('0x30')](_0x2bb52f,_0x7368('0x2a'));_0x27fb2e['query']=_[_0x7368('0x31')](_0x8754f3['query']);_0x27fb2e['filters']=_[_0x7368('0x32')](_0x27fb2e[_0x7368('0x2f')],_0x27fb2e[_0x7368('0x33')]);_0x1beb9f[_0x7368('0x34')]=_[_0x7368('0x32')](_0x27fb2e[_0x7368('0x2f')],qs[_0x7368('0x35')](_0x8754f3[_0x7368('0x33')][_0x7368('0x35')]));_0x1beb9f['attributes']=_0x1beb9f[_0x7368('0x34')][_0x7368('0x36')]?_0x1beb9f[_0x7368('0x34')]:_0x27fb2e[_0x7368('0x2f')];if(!_0x8754f3['query']['hasOwnProperty']('nolimit')){_0x1beb9f[_0x7368('0x1d')]=qs[_0x7368('0x1d')](_0x8754f3[_0x7368('0x33')][_0x7368('0x1d')]);_0x1beb9f[_0x7368('0x1a')]=qs[_0x7368('0x1a')](_0x8754f3[_0x7368('0x33')]['offset']);}_0x1beb9f[_0x7368('0x37')]=qs[_0x7368('0x38')](_0x8754f3[_0x7368('0x33')][_0x7368('0x38')]);_0x1beb9f[_0x7368('0x39')]=qs['filters'](_[_0x7368('0x3a')](_0x8754f3[_0x7368('0x33')],_0x27fb2e[_0x7368('0x3b')]),_0x2bb52f);if(_0x8754f3[_0x7368('0x33')][_0x7368('0x3c')]){_0x1beb9f['where']=_['merge'](_0x1beb9f['where'],{'$or':_[_0x7368('0x30')](_0x2bb52f,function(_0x1530a3){if(_0x1530a3[_0x7368('0x2d')]!==_0x7368('0x3d')){var _0x1ed903={};_0x1ed903[_0x1530a3[_0x7368('0x2a')]]={'$like':'%'+_0x8754f3[_0x7368('0x33')][_0x7368('0x3c')]+'%'};return _0x1ed903;}})});}_0x1beb9f=_['merge']({},_0x1beb9f,_0x8754f3[_0x7368('0x3e')]);var _0xf36768={'where':_0x1beb9f[_0x7368('0x39')]};return db[_0x7368('0x2b')][_0x7368('0x1c')](_0xf36768)['then'](function(_0xc497bf){_0x36c72b['count']=_0xc497bf;if(_0x8754f3['query']['includeAll']){_0x1beb9f[_0x7368('0x3f')]=[{'all':!![]}];}return db['MailSubstatus'][_0x7368('0x40')](_0x1beb9f);})[_0x7368('0x25')](function(_0x4f3db0){_0x36c72b[_0x7368('0x41')]=_0x4f3db0;return _0x36c72b;})[_0x7368('0x25')](respondWithFilteredResult(_0x1bad1e,_0x1beb9f))['catch'](handleError(_0x1bad1e,null));};exports['show']=function(_0x2d60f6,_0x10d323){var _0x2e7dd7={'raw':!![],'where':{'id':_0x2d60f6[_0x7368('0x42')]['id']}},_0x3fa6c0={};_0x3fa6c0[_0x7368('0x2f')]=_[_0x7368('0x31')](db[_0x7368('0x2b')]['rawAttributes']);_0x3fa6c0[_0x7368('0x33')]=_[_0x7368('0x31')](_0x2d60f6['query']);_0x3fa6c0[_0x7368('0x3b')]=_[_0x7368('0x32')](_0x3fa6c0['model'],_0x3fa6c0[_0x7368('0x33')]);_0x2e7dd7[_0x7368('0x34')]=_['intersection'](_0x3fa6c0[_0x7368('0x2f')],qs[_0x7368('0x35')](_0x2d60f6[_0x7368('0x33')][_0x7368('0x35')]));_0x2e7dd7['attributes']=_0x2e7dd7[_0x7368('0x34')]['length']?_0x2e7dd7[_0x7368('0x34')]:_0x3fa6c0[_0x7368('0x2f')];if(_0x2d60f6['query']['includeAll']){_0x2e7dd7[_0x7368('0x3f')]=[{'all':!![]}];}_0x2e7dd7=_[_0x7368('0x43')]({},_0x2e7dd7,_0x2d60f6[_0x7368('0x3e')]);return db[_0x7368('0x2b')][_0x7368('0x44')](_0x2e7dd7)['then'](handleEntityNotFound(_0x10d323,null))[_0x7368('0x25')](respondWithResult(_0x10d323,null))[_0x7368('0x45')](handleError(_0x10d323,null));};exports[_0x7368('0x46')]=function(_0x37b321,_0x396f0e){return db[_0x7368('0x2b')][_0x7368('0x46')](_0x37b321['body'],{})[_0x7368('0x25')](respondWithResult(_0x396f0e,0xc9))['catch'](handleError(_0x396f0e,null));};exports[_0x7368('0x24')]=function(_0x3b5a47,_0x60bda5){if(_0x3b5a47[_0x7368('0x47')]['id']){delete _0x3b5a47[_0x7368('0x47')]['id'];}return db[_0x7368('0x2b')][_0x7368('0x44')]({'where':{'id':_0x3b5a47[_0x7368('0x42')]['id']}})[_0x7368('0x25')](handleEntityNotFound(_0x60bda5,null))[_0x7368('0x25')](saveUpdates(_0x3b5a47[_0x7368('0x47')],null))[_0x7368('0x25')](respondWithResult(_0x60bda5,null))[_0x7368('0x45')](handleError(_0x60bda5,null));};exports['destroy']=function(_0x26d750,_0x4321e0){return db[_0x7368('0x2b')][_0x7368('0x44')]({'where':{'id':_0x26d750[_0x7368('0x42')]['id']}})[_0x7368('0x25')](handleEntityNotFound(_0x4321e0,null))[_0x7368('0x25')](removeEntity(_0x4321e0,null))[_0x7368('0x45')](handleError(_0x4321e0,null));};exports[_0x7368('0x48')]=function(_0x153bb2,_0x338c3d){return db[_0x7368('0x2b')][_0x7368('0x48')]()[_0x7368('0x25')](respondWithResult(_0x338c3d,null))['catch'](handleError(_0x338c3d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 1621003..4740417 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 _0x3ff9=['hasOwnProperty','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3ff9,0x12a));var _0x93ff=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x3ff9[_0x1e4360];return _0x31e6b4;};'use strict';var EventEmitter=require(_0x93ff('0x0'));var MailSubstatus=require(_0x93ff('0x1'))['db'][_0x93ff('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x93ff('0x3')](0x0);var events={'afterUpdate':_0x93ff('0x4')};function emitEvent(_0x430c49){return function(_0x2c6a29,_0x5b6ef9,_0x46ab64){MailSubstatusEvents[_0x93ff('0x5')](_0x430c49+':'+_0x2c6a29['id'],_0x2c6a29);MailSubstatusEvents[_0x93ff('0x5')](_0x430c49,_0x2c6a29);_0x46ab64(null);};}for(var e in events){if(events[_0x93ff('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x93ff('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x6cd6=['emit','hasOwnProperty','hook','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x59f27b,_0x1d94a8){var _0x52dea5=function(_0x5098f7){while(--_0x5098f7){_0x59f27b['push'](_0x59f27b['shift']());}};_0x52dea5(++_0x1d94a8);}(_0x6cd6,0x193));var _0x66cd=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6cd6[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0x66cd('0x0'));var MailSubstatus=require(_0x66cd('0x1'))['db'][_0x66cd('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x66cd('0x3')](0x0);var events={'afterUpdate':_0x66cd('0x4')};function emitEvent(_0x3a329e){return function(_0x23fdb5,_0x6339c8,_0x4b42ce){MailSubstatusEvents[_0x66cd('0x5')](_0x3a329e+':'+_0x23fdb5['id'],_0x23fdb5);MailSubstatusEvents[_0x66cd('0x5')](_0x3a329e,_0x23fdb5);_0x4b42ce(null);};}for(var e in events){if(events[_0x66cd('0x6')](e)){var event=events[e];MailSubstatus[_0x66cd('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index e560e87..1ae8069 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 _0xe29b=['mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','exports','models','define'];(function(_0x10a3ed,_0x26b0ff){var _0x42aa8a=function(_0xa3fdf7){while(--_0xa3fdf7){_0x10a3ed['push'](_0x10a3ed['shift']());}};_0x42aa8a(++_0x26b0ff);}(_0xe29b,0x81));var _0xbe29=function(_0xcdae05,_0x403d48){_0xcdae05=_0xcdae05-0x0;var _0xc2b40e=_0xe29b[_0xcdae05];return _0xc2b40e;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xbe29('0x0')]=function(_0x3071af){var _0x31bc53=_0x3071af[_0xbe29('0x1')];return _0x3071af[_0xbe29('0x2')]('MailSubstatus',attributes,{'tableName':_0xbe29('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1dfdfe,_0x1e9b48,_0x5dbac4){return _0x31bc53[_0xbe29('0x4')][_0xbe29('0x5')]({'value':_0x1dfdfe[_0xbe29('0x6')]},{'where':{'field':_0xbe29('0x7'),'value':_0x1dfdfe[_0xbe29('0x8')][_0xbe29('0x6')]}})[_0xbe29('0x9')](function(){_0x5dbac4();})[_0xbe29('0xa')](function(_0x594618){_0x5dbac4(_0x594618);});}}});}; \ No newline at end of file +var _0x5244=['mailSubstatus','_previousDataValues','exports','define','MailSubstatus','mail_substatuses','Condition','name'];(function(_0x2e9a4f,_0x44dc78){var _0x276a54=function(_0x494420){while(--_0x494420){_0x2e9a4f['push'](_0x2e9a4f['shift']());}};_0x276a54(++_0x44dc78);}(_0x5244,0x1a2));var _0x4524=function(_0x45c3ef,_0x3373d5){_0x45c3ef=_0x45c3ef-0x0;var _0x291e25=_0x5244[_0x45c3ef];return _0x291e25;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x4524('0x0')]=function(_0x1c7cc0){var _0x2bc235=_0x1c7cc0['models'];return _0x1c7cc0[_0x4524('0x1')](_0x4524('0x2'),attributes,{'tableName':_0x4524('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1e0744,_0x4c82ab,_0x49ed14){return _0x2bc235[_0x4524('0x4')]['update']({'value':_0x1e0744[_0x4524('0x5')]},{'where':{'field':_0x4524('0x6'),'value':_0x1e0744[_0x4524('0x7')]['name']}})['then'](function(){_0x49ed14();})['catch'](function(_0x237ec7){_0x49ed14(_0x237ec7);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 266cda4..773c898 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 _0xf989=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x5df85e,_0x329160){var _0x179af6=function(_0x368078){while(--_0x368078){_0x5df85e['push'](_0x5df85e['shift']());}};_0x179af6(++_0x329160);}(_0xf989,0x133));var _0x9f98=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0xf989[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0x9f98('0x0'));var util=require('util');var moment=require(_0x9f98('0x1'));var BPromise=require(_0x9f98('0x2'));var rs=require(_0x9f98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f98('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f98('0x5'))(_0x9f98('0x6'));var config=require('../../config/environment');var jayson=require(_0x9f98('0x7'));var client=jayson['client'][_0x9f98('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x158ad7,_0x5dc167,_0x5961b3){return new BPromise(function(_0x4d7e2a,_0x13ebbe){return client[_0x9f98('0x9')](_0x158ad7,_0x5961b3)[_0x9f98('0xa')](function(_0xb505c1){logger[_0x9f98('0xb')](_0x9f98('0xc'),_0x5dc167,_0x9f98('0xd'));logger[_0x9f98('0xe')](_0x9f98('0xf'),_0x5dc167,_0x9f98('0xd'),JSON[_0x9f98('0x10')](_0xb505c1));if(_0xb505c1[_0x9f98('0x11')]){if(_0xb505c1[_0x9f98('0x11')][_0x9f98('0x12')]===0x1f4){logger[_0x9f98('0x11')](_0x9f98('0xc'),_0x5dc167,_0xb505c1[_0x9f98('0x11')][_0x9f98('0x13')]);return _0x13ebbe(_0xb505c1['error'][_0x9f98('0x13')]);}logger[_0x9f98('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x5dc167,_0xb505c1[_0x9f98('0x11')][_0x9f98('0x13')]);return _0x4d7e2a(_0xb505c1['error']['message']);}else{logger[_0x9f98('0xb')](_0x9f98('0xc'),_0x5dc167,_0x9f98('0xd'));_0x4d7e2a(_0xb505c1['result'][_0x9f98('0x13')]);}})[_0x9f98('0x14')](function(_0x3c1c8e){logger[_0x9f98('0x11')](_0x9f98('0xc'),_0x5dc167,_0x3c1c8e);_0x13ebbe(_0x3c1c8e);});});} \ No newline at end of file +var _0xd43c=['rpc','../../config/environment','jayson/promise','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x58a663,_0x5dfe66){var _0x7c9423=function(_0x45529a){while(--_0x45529a){_0x58a663['push'](_0x58a663['shift']());}};_0x7c9423(++_0x5dfe66);}(_0xd43c,0x178));var _0xcd43=function(_0xad8e17,_0x25aa6d){_0xad8e17=_0xad8e17-0x0;var _0xec7a73=_0xd43c[_0xad8e17];return _0xec7a73;};'use strict';var _=require(_0xcd43('0x0'));var util=require('util');var moment=require(_0xcd43('0x1'));var BPromise=require(_0xcd43('0x2'));var rs=require(_0xcd43('0x3'));var fs=require('fs');var Redis=require(_0xcd43('0x4'));var db=require(_0xcd43('0x5'))['db'];var utils=require(_0xcd43('0x6'));var logger=require(_0xcd43('0x7'))(_0xcd43('0x8'));var config=require(_0xcd43('0x9'));var jayson=require(_0xcd43('0xa'));var client=jayson['client'][_0xcd43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fedea,_0x167ebd,_0x1f2ff1){return new BPromise(function(_0x490668,_0x4cd9bc){return client[_0xcd43('0xc')](_0x3fedea,_0x1f2ff1)[_0xcd43('0xd')](function(_0x3ed385){logger['info'](_0xcd43('0xe'),_0x167ebd,_0xcd43('0xf'));logger[_0xcd43('0x10')](_0xcd43('0x11'),_0x167ebd,'request\x20sent',JSON[_0xcd43('0x12')](_0x3ed385));if(_0x3ed385[_0xcd43('0x13')]){if(_0x3ed385['error'][_0xcd43('0x14')]===0x1f4){logger['error'](_0xcd43('0xe'),_0x167ebd,_0x3ed385[_0xcd43('0x13')][_0xcd43('0x15')]);return _0x4cd9bc(_0x3ed385['error']['message']);}logger[_0xcd43('0x13')](_0xcd43('0xe'),_0x167ebd,_0x3ed385[_0xcd43('0x13')][_0xcd43('0x15')]);return _0x490668(_0x3ed385[_0xcd43('0x13')][_0xcd43('0x15')]);}else{logger[_0xcd43('0x16')](_0xcd43('0xe'),_0x167ebd,'request\x20sent');_0x490668(_0x3ed385['result']['message']);}})[_0xcd43('0x17')](function(_0x57ad47){logger[_0xcd43('0x13')](_0xcd43('0xe'),_0x167ebd,_0x57ad47);_0x4cd9bc(_0x57ad47);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 06f00ab..2e792be 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 _0x3f69=['isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./mailTransferReport.controller','get'];(function(_0x4a9324,_0xf840ed){var _0x2c45f5=function(_0xfbf347){while(--_0xfbf347){_0x4a9324['push'](_0x4a9324['shift']());}};_0x2c45f5(++_0xf840ed);}(_0x3f69,0x161));var _0x93f6=function(_0x286b50,_0x26fefc){_0x286b50=_0x286b50-0x0;var _0x23a90d=_0x3f69[_0x286b50];return _0x23a90d;};'use strict';var multer=require(_0x93f6('0x0'));var util=require('util');var path=require(_0x93f6('0x1'));var timeout=require(_0x93f6('0x2'));var express=require('express');var router=express[_0x93f6('0x3')]();var fs_extra=require(_0x93f6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x93f6('0x5'));var controller=require(_0x93f6('0x6'));router[_0x93f6('0x7')]('/',auth[_0x93f6('0x8')](),controller[_0x93f6('0x9')]);router[_0x93f6('0x7')](_0x93f6('0xa'),auth[_0x93f6('0x8')](),controller[_0x93f6('0xb')]);router[_0x93f6('0x7')]('/:id',auth[_0x93f6('0x8')](),controller[_0x93f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x93f6('0xd')]);router[_0x93f6('0xe')](_0x93f6('0xf'),auth['isAuthenticated'](),controller[_0x93f6('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x93f6('0x11')]);module[_0x93f6('0x12')]=router; \ No newline at end of file +var _0x08be=['express','Router','../../components/auth/service','./mailTransferReport.controller','isAuthenticated','get','/describe','describe','show','post','put','update','delete','destroy','exports','connect-timeout'];(function(_0x1cb7c2,_0x314fbc){var _0x436048=function(_0x469692){while(--_0x469692){_0x1cb7c2['push'](_0x1cb7c2['shift']());}};_0x436048(++_0x314fbc);}(_0x08be,0xaf));var _0xe08b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08be[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe08b('0x0'));var express=require(_0xe08b('0x1'));var router=express[_0xe08b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe08b('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe08b('0x4'));router['get']('/',auth[_0xe08b('0x5')](),controller['index']);router[_0xe08b('0x6')](_0xe08b('0x7'),auth[_0xe08b('0x5')](),controller[_0xe08b('0x8')]);router[_0xe08b('0x6')]('/:id',auth[_0xe08b('0x5')](),controller[_0xe08b('0x9')]);router[_0xe08b('0xa')]('/',auth[_0xe08b('0x5')](),controller['create']);router[_0xe08b('0xb')]('/:id',auth[_0xe08b('0x5')](),controller[_0xe08b('0xc')]);router[_0xe08b('0xd')]('/:id',auth[_0xe08b('0x5')](),controller[_0xe08b('0xe')]);module[_0xe08b('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5904829..c9fdb86 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x431d4d,_0x216f4b){var _0x21a1b4=function(_0x56c2ac){while(--_0x56c2ac){_0x431d4d['push'](_0x431d4d['shift']());}};_0x21a1b4(++_0x216f4b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x00bb[_0x2b10c6];return _0x3789d2;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4a5972,_0x22541e){var _0x49a63c=function(_0x4e1d39){while(--_0x4e1d39){_0x4a5972['push'](_0x4a5972['shift']());}};_0x49a63c(++_0x22541e);}(_0x008c,0x188));var _0xc008=function(_0xb18b17,_0x121eb1){_0xb18b17=_0xb18b17-0x0;var _0xd1ff7c=_0x008c[_0xb18b17];return _0xd1ff7c;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 09a0b10..11da545 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 _0x5ca7=['then','error','stack','name','index','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','MailTransferReport','includeAll','show','rawAttributes','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','update','destroy'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x5ca7,0x103));var _0x75ca=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x5ca7[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0x75ca('0x0'));var rimraf=require(_0x75ca('0x1'));var zipdir=require(_0x75ca('0x2'));var jsonpatch=require(_0x75ca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x75ca('0x4'));var Mustache=require(_0x75ca('0x5'));var util=require('util');var path=require(_0x75ca('0x6'));var sox=require(_0x75ca('0x7'));var csv=require('to-csv');var ejs=require(_0x75ca('0x8'));var fs=require('fs');var fs_extra=require(_0x75ca('0x9'));var _=require(_0x75ca('0xa'));var squel=require(_0x75ca('0xb'));var crypto=require(_0x75ca('0xc'));var jsforce=require(_0x75ca('0xd'));var deskjs=require(_0x75ca('0xe'));var toCsv=require(_0x75ca('0xf'));var querystring=require(_0x75ca('0x10'));var Papa=require('papaparse');var Redis=require(_0x75ca('0x11'));var authService=require(_0x75ca('0x12'));var qs=require(_0x75ca('0x13'));var as=require(_0x75ca('0x14'));var hardwareService=require(_0x75ca('0x15'));var logger=require(_0x75ca('0x16'))(_0x75ca('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x75ca('0x18'))['db'];function respondWithStatusCode(_0x1160ab,_0x58fe77){_0x58fe77=_0x58fe77||0xcc;return function(_0x6bdd1f){if(_0x6bdd1f){return _0x1160ab[_0x75ca('0x19')](_0x58fe77);}return _0x1160ab[_0x75ca('0x1a')](_0x58fe77)[_0x75ca('0x1b')]();};}function respondWithResult(_0x476299,_0xbf0a22){_0xbf0a22=_0xbf0a22||0xc8;return function(_0x13f02a){if(_0x13f02a){return _0x476299[_0x75ca('0x1a')](_0xbf0a22)[_0x75ca('0x1c')](_0x13f02a);}};}function respondWithFilteredResult(_0x2dbd65,_0x31cde5){return function(_0x3d605f){if(_0x3d605f){var _0x13fb99=typeof _0x31cde5['offset']===_0x75ca('0x1d')&&typeof _0x31cde5['limit']==='undefined';var _0x4154cb=_0x3d605f[_0x75ca('0x1e')];var _0x4c9f5a=_0x13fb99?0x0:_0x31cde5[_0x75ca('0x1f')];var _0x357cc1=_0x13fb99?_0x3d605f[_0x75ca('0x1e')]:_0x31cde5[_0x75ca('0x1f')]+_0x31cde5[_0x75ca('0x20')];var _0x37cdab;if(_0x357cc1>=_0x4154cb){_0x357cc1=_0x4154cb;_0x37cdab=0xc8;}else{_0x37cdab=0xce;}_0x2dbd65[_0x75ca('0x1a')](_0x37cdab);return _0x2dbd65['set']('Content-Range',_0x4c9f5a+'-'+_0x357cc1+'/'+_0x4154cb)[_0x75ca('0x1c')](_0x3d605f);}return null;};}function patchUpdates(_0x4a9462){return function(_0x430be6){try{jsonpatch[_0x75ca('0x21')](_0x430be6,_0x4a9462,!![]);}catch(_0xfa2db6){return BPromise[_0x75ca('0x22')](_0xfa2db6);}return _0x430be6['save']();};}function saveUpdates(_0x206ca2,_0x2ebb6d){return function(_0x2815e0){if(_0x2815e0){return _0x2815e0[_0x75ca('0x23')](_0x206ca2)['then'](function(_0xcbed87){return _0xcbed87;});}return null;};}function removeEntity(_0x56f6a5,_0x41313c){return function(_0xcb520f){if(_0xcb520f){return _0xcb520f[_0x75ca('0x24')]()[_0x75ca('0x25')](function(){_0x56f6a5[_0x75ca('0x1a')](0xcc)[_0x75ca('0x1b')]();});}};}function handleEntityNotFound(_0x1cd998,_0x374b2d){return function(_0x1adba6){if(!_0x1adba6){_0x1cd998[_0x75ca('0x19')](0x194);}return _0x1adba6;};}function handleError(_0x119111,_0x16982b){_0x16982b=_0x16982b||0x1f4;return function(_0x59e2f9){logger[_0x75ca('0x26')](_0x59e2f9[_0x75ca('0x27')]);if(_0x59e2f9[_0x75ca('0x28')]){delete _0x59e2f9['name'];}_0x119111[_0x75ca('0x1a')](_0x16982b)['send'](_0x59e2f9);};}exports[_0x75ca('0x29')]=function(_0x15039a,_0x45f2f2){var _0x4b3299={},_0x52876e={},_0x4c912c={'count':0x0,'rows':[]};var _0x3bd581=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x3d579c){return{'name':_0x3d579c[_0x75ca('0x2a')],'type':_0x3d579c[_0x75ca('0x2b')][_0x75ca('0x2c')]};});_0x52876e['model']=_['map'](_0x3bd581,_0x75ca('0x28'));_0x52876e[_0x75ca('0x2d')]=_[_0x75ca('0x2e')](_0x15039a[_0x75ca('0x2d')]);_0x52876e['filters']=_[_0x75ca('0x2f')](_0x52876e[_0x75ca('0x30')],_0x52876e[_0x75ca('0x2d')]);_0x4b3299[_0x75ca('0x31')]=_[_0x75ca('0x2f')](_0x52876e[_0x75ca('0x30')],qs[_0x75ca('0x32')](_0x15039a[_0x75ca('0x2d')][_0x75ca('0x32')]));_0x4b3299[_0x75ca('0x31')]=_0x4b3299[_0x75ca('0x31')][_0x75ca('0x33')]?_0x4b3299[_0x75ca('0x31')]:_0x52876e[_0x75ca('0x30')];if(!_0x15039a[_0x75ca('0x2d')][_0x75ca('0x34')](_0x75ca('0x35'))){_0x4b3299[_0x75ca('0x20')]=qs['limit'](_0x15039a[_0x75ca('0x2d')][_0x75ca('0x20')]);_0x4b3299['offset']=qs[_0x75ca('0x1f')](_0x15039a['query'][_0x75ca('0x1f')]);}_0x4b3299[_0x75ca('0x36')]=qs[_0x75ca('0x37')](_0x15039a[_0x75ca('0x2d')]['sort']);_0x4b3299[_0x75ca('0x38')]=qs[_0x75ca('0x39')](_[_0x75ca('0x3a')](_0x15039a['query'],_0x52876e[_0x75ca('0x39')]),_0x3bd581);if(_0x15039a[_0x75ca('0x2d')]['filter']){_0x4b3299['where']=_['merge'](_0x4b3299[_0x75ca('0x38')],{'$or':_[_0x75ca('0x3b')](_0x3bd581,function(_0x277d54){if(_0x277d54['type']!==_0x75ca('0x3c')){var _0x53d463={};_0x53d463[_0x277d54[_0x75ca('0x28')]]={'$like':'%'+_0x15039a[_0x75ca('0x2d')][_0x75ca('0x3d')]+'%'};return _0x53d463;}})});}_0x4b3299=_[_0x75ca('0x3e')]({},_0x4b3299,_0x15039a['options']);var _0x1dc5ca={'where':_0x4b3299['where']};return db[_0x75ca('0x3f')]['count'](_0x1dc5ca)[_0x75ca('0x25')](function(_0x2912c5){_0x4c912c[_0x75ca('0x1e')]=_0x2912c5;if(_0x15039a[_0x75ca('0x2d')][_0x75ca('0x40')]){_0x4b3299['include']=[{'all':!![]}];}return db[_0x75ca('0x3f')]['findAll'](_0x4b3299);})['then'](function(_0x28fb89){_0x4c912c['rows']=_0x28fb89;return _0x4c912c;})[_0x75ca('0x25')](respondWithFilteredResult(_0x45f2f2,_0x4b3299))['catch'](handleError(_0x45f2f2,null));};exports[_0x75ca('0x41')]=function(_0x1b2ed1,_0x4e7c29){var _0x5669f9={'raw':!![],'where':{'id':_0x1b2ed1['params']['id']}},_0x461ded={};_0x461ded['model']=_[_0x75ca('0x2e')](db[_0x75ca('0x3f')][_0x75ca('0x42')]);_0x461ded[_0x75ca('0x2d')]=_['keys'](_0x1b2ed1['query']);_0x461ded[_0x75ca('0x39')]=_[_0x75ca('0x2f')](_0x461ded[_0x75ca('0x30')],_0x461ded['query']);_0x5669f9['attributes']=_['intersection'](_0x461ded[_0x75ca('0x30')],qs[_0x75ca('0x32')](_0x1b2ed1['query'][_0x75ca('0x32')]));_0x5669f9['attributes']=_0x5669f9[_0x75ca('0x31')][_0x75ca('0x33')]?_0x5669f9[_0x75ca('0x31')]:_0x461ded[_0x75ca('0x30')];if(_0x1b2ed1['query'][_0x75ca('0x40')]){_0x5669f9['include']=[{'all':!![]}];}_0x5669f9=_['merge']({},_0x5669f9,_0x1b2ed1[_0x75ca('0x43')]);return db[_0x75ca('0x3f')][_0x75ca('0x44')](_0x5669f9)['then'](handleEntityNotFound(_0x4e7c29,null))[_0x75ca('0x25')](respondWithResult(_0x4e7c29,null))[_0x75ca('0x45')](handleError(_0x4e7c29,null));};exports[_0x75ca('0x46')]=function(_0x4dd6d1,_0x15143e){return db['MailTransferReport']['create'](_0x4dd6d1['body'],{})[_0x75ca('0x25')](respondWithResult(_0x15143e,0xc9))[_0x75ca('0x45')](handleError(_0x15143e,null));};exports['update']=function(_0x1d085b,_0x3fdef4){if(_0x1d085b[_0x75ca('0x47')]['id']){delete _0x1d085b[_0x75ca('0x47')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x1d085b[_0x75ca('0x48')]['id']}})[_0x75ca('0x25')](handleEntityNotFound(_0x3fdef4,null))[_0x75ca('0x25')](saveUpdates(_0x1d085b[_0x75ca('0x47')],null))['then'](respondWithResult(_0x3fdef4,null))[_0x75ca('0x45')](handleError(_0x3fdef4,null));};exports['destroy']=function(_0x476f90,_0x1619aa){return db[_0x75ca('0x3f')][_0x75ca('0x44')]({'where':{'id':_0x476f90[_0x75ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x1619aa,null))['then'](removeEntity(_0x1619aa,null))[_0x75ca('0x45')](handleError(_0x1619aa,null));};exports[_0x75ca('0x49')]=function(_0x5417b4,_0x24e764){return db[_0x75ca('0x3f')][_0x75ca('0x49')]()[_0x75ca('0x25')](respondWithResult(_0x24e764,null))[_0x75ca('0x45')](handleError(_0x24e764,null));}; \ No newline at end of file +var _0xcddf=['map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','name','filter','merge','options','include','rows','catch','show','params','includeAll','create','body','update','find','destroy','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','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','then','error','stack'];(function(_0x51e8fd,_0x150aec){var _0x9f9a07=function(_0x1022f1){while(--_0x1022f1){_0x51e8fd['push'](_0x51e8fd['shift']());}};_0x9f9a07(++_0x150aec);}(_0xcddf,0x6f));var _0xfcdd=function(_0x23d3b0,_0x47b591){_0x23d3b0=_0x23d3b0-0x0;var _0x3c3d98=_0xcddf[_0x23d3b0];return _0x3c3d98;};'use strict';var emlformat=require(_0xfcdd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfcdd('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfcdd('0x2'));var Mustache=require(_0xfcdd('0x3'));var util=require(_0xfcdd('0x4'));var path=require(_0xfcdd('0x5'));var sox=require('sox');var csv=require(_0xfcdd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcdd('0x7'));var _=require(_0xfcdd('0x8'));var squel=require(_0xfcdd('0x9'));var crypto=require('crypto');var jsforce=require(_0xfcdd('0xa'));var deskjs=require(_0xfcdd('0xb'));var toCsv=require(_0xfcdd('0x6'));var querystring=require(_0xfcdd('0xc'));var Papa=require(_0xfcdd('0xd'));var Redis=require(_0xfcdd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfcdd('0xf'));var as=require(_0xfcdd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcdd('0x11'))('api');var utils=require(_0xfcdd('0x12'));var config=require(_0xfcdd('0x13'));var licenseUtil=require(_0xfcdd('0x14'));var db=require(_0xfcdd('0x15'))['db'];function respondWithStatusCode(_0x687a2d,_0x2b57fa){_0x2b57fa=_0x2b57fa||0xcc;return function(_0x1e58d3){if(_0x1e58d3){return _0x687a2d[_0xfcdd('0x16')](_0x2b57fa);}return _0x687a2d['status'](_0x2b57fa)[_0xfcdd('0x17')]();};}function respondWithResult(_0x5dac9b,_0x1debd6){_0x1debd6=_0x1debd6||0xc8;return function(_0x4e0b1d){if(_0x4e0b1d){return _0x5dac9b[_0xfcdd('0x18')](_0x1debd6)[_0xfcdd('0x19')](_0x4e0b1d);}};}function respondWithFilteredResult(_0x56c30d,_0x5365c7){return function(_0x3fe241){if(_0x3fe241){var _0x44624d=typeof _0x5365c7[_0xfcdd('0x1a')]===_0xfcdd('0x1b')&&typeof _0x5365c7[_0xfcdd('0x1c')]===_0xfcdd('0x1b');var _0xd3c98c=_0x3fe241[_0xfcdd('0x1d')];var _0x29455e=_0x44624d?0x0:_0x5365c7[_0xfcdd('0x1a')];var _0x44e390=_0x44624d?_0x3fe241[_0xfcdd('0x1d')]:_0x5365c7[_0xfcdd('0x1a')]+_0x5365c7[_0xfcdd('0x1c')];var _0x4cbdf7;if(_0x44e390>=_0xd3c98c){_0x44e390=_0xd3c98c;_0x4cbdf7=0xc8;}else{_0x4cbdf7=0xce;}_0x56c30d[_0xfcdd('0x18')](_0x4cbdf7);return _0x56c30d[_0xfcdd('0x1e')](_0xfcdd('0x1f'),_0x29455e+'-'+_0x44e390+'/'+_0xd3c98c)[_0xfcdd('0x19')](_0x3fe241);}return null;};}function patchUpdates(_0xa5c107){return function(_0x178bee){try{jsonpatch[_0xfcdd('0x20')](_0x178bee,_0xa5c107,!![]);}catch(_0x3e92e4){return BPromise[_0xfcdd('0x21')](_0x3e92e4);}return _0x178bee['save']();};}function saveUpdates(_0xb73884,_0x29de36){return function(_0x572110){if(_0x572110){return _0x572110['update'](_0xb73884)[_0xfcdd('0x22')](function(_0x15a83c){return _0x15a83c;});}return null;};}function removeEntity(_0xc40d1,_0x3ae5d6){return function(_0x428e2c){if(_0x428e2c){return _0x428e2c['destroy']()[_0xfcdd('0x22')](function(){_0xc40d1['status'](0xcc)[_0xfcdd('0x17')]();});}};}function handleEntityNotFound(_0x4d3d53,_0x45caab){return function(_0x304a06){if(!_0x304a06){_0x4d3d53[_0xfcdd('0x16')](0x194);}return _0x304a06;};}function handleError(_0x1b66c2,_0x525ac9){_0x525ac9=_0x525ac9||0x1f4;return function(_0x5bf54){logger[_0xfcdd('0x23')](_0x5bf54[_0xfcdd('0x24')]);if(_0x5bf54['name']){delete _0x5bf54['name'];}_0x1b66c2['status'](_0x525ac9)['send'](_0x5bf54);};}exports['index']=function(_0x4d58a5,_0x1307d2){var _0x301c14={},_0x22ecda={},_0x3224d1={'count':0x0,'rows':[]};var _0x3f8419=_[_0xfcdd('0x25')](db[_0xfcdd('0x26')][_0xfcdd('0x27')],function(_0x2bd5b2){return{'name':_0x2bd5b2[_0xfcdd('0x28')],'type':_0x2bd5b2[_0xfcdd('0x29')][_0xfcdd('0x2a')]};});_0x22ecda[_0xfcdd('0x2b')]=_['map'](_0x3f8419,'name');_0x22ecda[_0xfcdd('0x2c')]=_[_0xfcdd('0x2d')](_0x4d58a5[_0xfcdd('0x2c')]);_0x22ecda[_0xfcdd('0x2e')]=_[_0xfcdd('0x2f')](_0x22ecda[_0xfcdd('0x2b')],_0x22ecda[_0xfcdd('0x2c')]);_0x301c14[_0xfcdd('0x30')]=_['intersection'](_0x22ecda[_0xfcdd('0x2b')],qs[_0xfcdd('0x31')](_0x4d58a5[_0xfcdd('0x2c')]['fields']));_0x301c14[_0xfcdd('0x30')]=_0x301c14['attributes'][_0xfcdd('0x32')]?_0x301c14[_0xfcdd('0x30')]:_0x22ecda[_0xfcdd('0x2b')];if(!_0x4d58a5[_0xfcdd('0x2c')][_0xfcdd('0x33')](_0xfcdd('0x34'))){_0x301c14['limit']=qs[_0xfcdd('0x1c')](_0x4d58a5[_0xfcdd('0x2c')]['limit']);_0x301c14[_0xfcdd('0x1a')]=qs[_0xfcdd('0x1a')](_0x4d58a5[_0xfcdd('0x2c')][_0xfcdd('0x1a')]);}_0x301c14[_0xfcdd('0x35')]=qs[_0xfcdd('0x36')](_0x4d58a5['query'][_0xfcdd('0x36')]);_0x301c14[_0xfcdd('0x37')]=qs[_0xfcdd('0x2e')](_[_0xfcdd('0x38')](_0x4d58a5['query'],_0x22ecda[_0xfcdd('0x2e')]),_0x3f8419);if(_0x4d58a5[_0xfcdd('0x2c')]['filter']){_0x301c14[_0xfcdd('0x37')]=_['merge'](_0x301c14[_0xfcdd('0x37')],{'$or':_[_0xfcdd('0x25')](_0x3f8419,function(_0x2017b3){if(_0x2017b3['type']!==_0xfcdd('0x39')){var _0xa82cce={};_0xa82cce[_0x2017b3[_0xfcdd('0x3a')]]={'$like':'%'+_0x4d58a5['query'][_0xfcdd('0x3b')]+'%'};return _0xa82cce;}})});}_0x301c14=_[_0xfcdd('0x3c')]({},_0x301c14,_0x4d58a5[_0xfcdd('0x3d')]);var _0x1d8d3a={'where':_0x301c14[_0xfcdd('0x37')]};return db[_0xfcdd('0x26')]['count'](_0x1d8d3a)[_0xfcdd('0x22')](function(_0x4717b0){_0x3224d1[_0xfcdd('0x1d')]=_0x4717b0;if(_0x4d58a5[_0xfcdd('0x2c')]['includeAll']){_0x301c14[_0xfcdd('0x3e')]=[{'all':!![]}];}return db[_0xfcdd('0x26')]['findAll'](_0x301c14);})[_0xfcdd('0x22')](function(_0x1ec968){_0x3224d1[_0xfcdd('0x3f')]=_0x1ec968;return _0x3224d1;})['then'](respondWithFilteredResult(_0x1307d2,_0x301c14))[_0xfcdd('0x40')](handleError(_0x1307d2,null));};exports[_0xfcdd('0x41')]=function(_0x4d61e7,_0x520611){var _0x5e3713={'raw':!![],'where':{'id':_0x4d61e7[_0xfcdd('0x42')]['id']}},_0x44045d={};_0x44045d[_0xfcdd('0x2b')]=_[_0xfcdd('0x2d')](db[_0xfcdd('0x26')][_0xfcdd('0x27')]);_0x44045d[_0xfcdd('0x2c')]=_['keys'](_0x4d61e7['query']);_0x44045d[_0xfcdd('0x2e')]=_[_0xfcdd('0x2f')](_0x44045d[_0xfcdd('0x2b')],_0x44045d['query']);_0x5e3713['attributes']=_[_0xfcdd('0x2f')](_0x44045d['model'],qs['fields'](_0x4d61e7['query'][_0xfcdd('0x31')]));_0x5e3713[_0xfcdd('0x30')]=_0x5e3713['attributes'][_0xfcdd('0x32')]?_0x5e3713[_0xfcdd('0x30')]:_0x44045d[_0xfcdd('0x2b')];if(_0x4d61e7[_0xfcdd('0x2c')][_0xfcdd('0x43')]){_0x5e3713[_0xfcdd('0x3e')]=[{'all':!![]}];}_0x5e3713=_['merge']({},_0x5e3713,_0x4d61e7['options']);return db['MailTransferReport']['find'](_0x5e3713)[_0xfcdd('0x22')](handleEntityNotFound(_0x520611,null))['then'](respondWithResult(_0x520611,null))[_0xfcdd('0x40')](handleError(_0x520611,null));};exports[_0xfcdd('0x44')]=function(_0x11d824,_0x5c1ae2){return db[_0xfcdd('0x26')]['create'](_0x11d824[_0xfcdd('0x45')],{})[_0xfcdd('0x22')](respondWithResult(_0x5c1ae2,0xc9))[_0xfcdd('0x40')](handleError(_0x5c1ae2,null));};exports[_0xfcdd('0x46')]=function(_0x2849fe,_0x2da5e8){if(_0x2849fe[_0xfcdd('0x45')]['id']){delete _0x2849fe[_0xfcdd('0x45')]['id'];}return db[_0xfcdd('0x26')][_0xfcdd('0x47')]({'where':{'id':_0x2849fe['params']['id']}})['then'](handleEntityNotFound(_0x2da5e8,null))['then'](saveUpdates(_0x2849fe[_0xfcdd('0x45')],null))[_0xfcdd('0x22')](respondWithResult(_0x2da5e8,null))[_0xfcdd('0x40')](handleError(_0x2da5e8,null));};exports[_0xfcdd('0x48')]=function(_0x1aea48,_0x22faa9){return db[_0xfcdd('0x26')][_0xfcdd('0x47')]({'where':{'id':_0x1aea48[_0xfcdd('0x42')]['id']}})[_0xfcdd('0x22')](handleEntityNotFound(_0x22faa9,null))[_0xfcdd('0x22')](removeEntity(_0x22faa9,null))[_0xfcdd('0x40')](handleError(_0x22faa9,null));};exports[_0xfcdd('0x49')]=function(_0x14cab1,_0x5bc87c){return db[_0xfcdd('0x26')][_0xfcdd('0x49')]()[_0xfcdd('0x22')](respondWithResult(_0x5bc87c,null))[_0xfcdd('0x40')](handleError(_0x5bc87c,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index dcbb0b4..f10090d 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 _0x897d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x49a5f6,_0x2eea42){var _0x22fe92=function(_0x4ed337){while(--_0x4ed337){_0x49a5f6['push'](_0x49a5f6['shift']());}};_0x22fe92(++_0x2eea42);}(_0x897d,0x80));var _0xd897=function(_0x57687e,_0x2520d6){_0x57687e=_0x57687e-0x0;var _0x2f4497=_0x897d[_0x57687e];return _0x2f4497;};'use strict';var _=require(_0xd897('0x0'));var util=require(_0xd897('0x1'));var logger=require(_0xd897('0x2'))(_0xd897('0x3'));var moment=require(_0xd897('0x4'));var BPromise=require(_0xd897('0x5'));var rp=require(_0xd897('0x6'));var fs=require('fs');var path=require(_0xd897('0x7'));var rimraf=require(_0xd897('0x8'));var config=require(_0xd897('0x9'));var attributes=require(_0xd897('0xa'));module[_0xd897('0xb')]=function(_0x3e1cc5,_0x386bc2){return _0x3e1cc5[_0xd897('0xc')](_0xd897('0xd'),attributes,{'tableName':_0xd897('0xe'),'paranoid':![],'indexes':[{'name':_0xd897('0xf'),'fields':[_0xd897('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e9d=['api','moment','bluebird','request-promise','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x4ae515,_0x310a8e){var _0xb0653=function(_0x1357b9){while(--_0x1357b9){_0x4ae515['push'](_0x4ae515['shift']());}};_0xb0653(++_0x310a8e);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x4932eb,_0x5d11f4){_0x4932eb=_0x4932eb-0x0;var _0x2b52bf=_0x3e9d[_0x4932eb];return _0x2b52bf;};'use strict';var _=require(_0xd3e9('0x0'));var util=require(_0xd3e9('0x1'));var logger=require('../../config/logger')(_0xd3e9('0x2'));var moment=require(_0xd3e9('0x3'));var BPromise=require(_0xd3e9('0x4'));var rp=require(_0xd3e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd3e9('0x6'));var attributes=require(_0xd3e9('0x7'));module[_0xd3e9('0x8')]=function(_0x3dea0a,_0x568eea){return _0x3dea0a['define'](_0xd3e9('0x9'),attributes,{'tableName':_0xd3e9('0xa'),'paranoid':![],'indexes':[{'name':_0xd3e9('0xb'),'fields':[_0xd3e9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8dcc365..3caf9ab 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 _0x4260=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x4260,0xa2));var _0x0426=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x4260[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0426('0x0'));var util=require(_0x0426('0x1'));var moment=require(_0x0426('0x2'));var BPromise=require(_0x0426('0x3'));var rs=require(_0x0426('0x4'));var fs=require('fs');var Redis=require(_0x0426('0x5'));var db=require(_0x0426('0x6'))['db'];var utils=require(_0x0426('0x7'));var logger=require(_0x0426('0x8'))(_0x0426('0x9'));var config=require(_0x0426('0xa'));var jayson=require(_0x0426('0xb'));var client=jayson['client'][_0x0426('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d51e1,_0x48b14c,_0x50af26){return new BPromise(function(_0x576927,_0x5e74d8){return client[_0x0426('0xd')](_0x2d51e1,_0x50af26)[_0x0426('0xe')](function(_0x3a25bc){logger[_0x0426('0xf')](_0x0426('0x10'),_0x48b14c,_0x0426('0x11'));logger[_0x0426('0x12')](_0x0426('0x13'),_0x48b14c,_0x0426('0x11'),JSON[_0x0426('0x14')](_0x3a25bc));if(_0x3a25bc[_0x0426('0x15')]){if(_0x3a25bc[_0x0426('0x15')][_0x0426('0x16')]===0x1f4){logger[_0x0426('0x15')](_0x0426('0x10'),_0x48b14c,_0x3a25bc[_0x0426('0x15')]['message']);return _0x5e74d8(_0x3a25bc['error'][_0x0426('0x17')]);}logger[_0x0426('0x15')](_0x0426('0x10'),_0x48b14c,_0x3a25bc[_0x0426('0x15')][_0x0426('0x17')]);return _0x576927(_0x3a25bc[_0x0426('0x15')]['message']);}else{logger[_0x0426('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x48b14c,'request\x20sent');_0x576927(_0x3a25bc[_0x0426('0x18')][_0x0426('0x17')]);}})['catch'](function(_0x517315){logger[_0x0426('0x15')](_0x0426('0x10'),_0x48b14c,_0x517315);_0x5e74d8(_0x517315);});});} \ No newline at end of file +var _0xb14f=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0xa70eb0,_0x2971ef){var _0x3b44a6=function(_0x47c967){while(--_0x47c967){_0xa70eb0['push'](_0xa70eb0['shift']());}};_0x3b44a6(++_0x2971ef);}(_0xb14f,0x152));var _0xfb14=function(_0x497d3e,_0x3500f3){_0x497d3e=_0x497d3e-0x0;var _0x3014d1=_0xb14f[_0x497d3e];return _0x3014d1;};'use strict';var _=require(_0xfb14('0x0'));var util=require(_0xfb14('0x1'));var moment=require(_0xfb14('0x2'));var BPromise=require(_0xfb14('0x3'));var rs=require(_0xfb14('0x4'));var fs=require('fs');var Redis=require(_0xfb14('0x5'));var db=require(_0xfb14('0x6'))['db'];var utils=require(_0xfb14('0x7'));var logger=require(_0xfb14('0x8'))('rpc');var config=require(_0xfb14('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfb14('0xa')][_0xfb14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492dbc,_0x4f4d9a,_0x1bd6e2){return new BPromise(function(_0x31dc36,_0x16ed71){return client[_0xfb14('0xc')](_0x492dbc,_0x1bd6e2)[_0xfb14('0xd')](function(_0x5da1d2){logger[_0xfb14('0xe')](_0xfb14('0xf'),_0x4f4d9a,_0xfb14('0x10'));logger['debug'](_0xfb14('0x11'),_0x4f4d9a,_0xfb14('0x10'),JSON['stringify'](_0x5da1d2));if(_0x5da1d2[_0xfb14('0x12')]){if(_0x5da1d2[_0xfb14('0x12')]['code']===0x1f4){logger[_0xfb14('0x12')](_0xfb14('0xf'),_0x4f4d9a,_0x5da1d2[_0xfb14('0x12')][_0xfb14('0x13')]);return _0x16ed71(_0x5da1d2[_0xfb14('0x12')][_0xfb14('0x13')]);}logger[_0xfb14('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x4f4d9a,_0x5da1d2['error'][_0xfb14('0x13')]);return _0x31dc36(_0x5da1d2['error']['message']);}else{logger[_0xfb14('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x4f4d9a,'request\x20sent');_0x31dc36(_0x5da1d2[_0xfb14('0x14')][_0xfb14('0x13')]);}})[_0xfb14('0x15')](function(_0x5ece28){logger[_0xfb14('0x12')](_0xfb14('0xf'),_0x4f4d9a,_0x5ece28);_0x16ed71(_0x5ece28);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index aee726f..a8e82e2 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 _0x4b66=['describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x40e87a,_0x430f27){var _0x217ab6=function(_0x5926a1){while(--_0x5926a1){_0x40e87a['push'](_0x40e87a['shift']());}};_0x217ab6(++_0x430f27);}(_0x4b66,0xb1));var _0x64b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b66[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x64b6('0x0'));var util=require('util');var path=require(_0x64b6('0x1'));var timeout=require(_0x64b6('0x2'));var express=require(_0x64b6('0x3'));var router=express[_0x64b6('0x4')]();var fs_extra=require(_0x64b6('0x5'));var auth=require(_0x64b6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x64b6('0x7'));var controller=require('./memberReport.controller');router[_0x64b6('0x8')]('/',auth[_0x64b6('0x9')](),controller[_0x64b6('0xa')]);router[_0x64b6('0x8')](_0x64b6('0xb'),auth[_0x64b6('0x9')](),controller[_0x64b6('0xc')]);router['get'](_0x64b6('0xd'),auth['isAuthenticated'](),controller[_0x64b6('0xe')]);router[_0x64b6('0xf')]('/',auth[_0x64b6('0x9')](),controller[_0x64b6('0x10')]);router[_0x64b6('0x11')](_0x64b6('0xd'),auth[_0x64b6('0x9')](),controller[_0x64b6('0x12')]);router[_0x64b6('0x13')](_0x64b6('0xd'),auth[_0x64b6('0x9')](),controller[_0x64b6('0x14')]);module['exports']=router; \ No newline at end of file +var _0xfb26=['describe','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xfb26,0x170));var _0x6fb2=function(_0x1e8ac9,_0x1bd0fe){_0x1e8ac9=_0x1e8ac9-0x0;var _0x4c895c=_0xfb26[_0x1e8ac9];return _0x4c895c;};'use strict';var multer=require(_0x6fb2('0x0'));var util=require('util');var path=require(_0x6fb2('0x1'));var timeout=require(_0x6fb2('0x2'));var express=require(_0x6fb2('0x3'));var router=express['Router']();var fs_extra=require(_0x6fb2('0x4'));var auth=require(_0x6fb2('0x5'));var interaction=require(_0x6fb2('0x6'));var config=require('../../config/environment');var controller=require(_0x6fb2('0x7'));router[_0x6fb2('0x8')]('/',auth[_0x6fb2('0x9')](),controller[_0x6fb2('0xa')]);router[_0x6fb2('0x8')](_0x6fb2('0xb'),auth[_0x6fb2('0x9')](),controller[_0x6fb2('0xc')]);router['get'](_0x6fb2('0xd'),auth[_0x6fb2('0x9')](),controller[_0x6fb2('0xe')]);router[_0x6fb2('0xf')]('/',auth[_0x6fb2('0x9')](),controller['create']);router[_0x6fb2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6fb2('0x11')]);router[_0x6fb2('0x12')](_0x6fb2('0xd'),auth[_0x6fb2('0x9')](),controller['destroy']);module[_0x6fb2('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 6b0bc2e..0725ed5 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 _0x30bb=['enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x30bb,0xe7));var _0xb30b=function(_0xb2f9fc,_0x57920){_0xb2f9fc=_0xb2f9fc-0x0;var _0x371b0b=_0x30bb[_0xb2f9fc];return _0x371b0b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb30b('0x0'));module[_0xb30b('0x1')]={'channel':{'type':Sequelize[_0xb30b('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb30b('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xb30b('0x3'),'comment':_0xb30b('0x4')},'duration':{'type':Sequelize[_0xb30b('0x5')]},'enterAt':{'type':Sequelize[_0xb30b('0x6')]},'exitAt':{'type':Sequelize[_0xb30b('0x6')],'set':function(_0xc75c6c){var _0x2e6a31=moment(_0xc75c6c);var _0x37d650=moment(this['getDataValue'](_0xb30b('0x7')));var _0x36cf3a=_0x2e6a31[_0xb30b('0x8')](_0x37d650,_0xb30b('0x9'));this[_0xb30b('0xa')](_0xb30b('0xb'),_0xc75c6c);this[_0xb30b('0xa')](_0xb30b('0xc'),_0x36cf3a>=0x0?_0x36cf3a:null);}},'data1':{'type':Sequelize[_0xb30b('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xb30b('0x2')],'comment':_0xb30b('0xd')},'data3':{'type':Sequelize[_0xb30b('0x2')],'comment':_0xb30b('0xe')},'data4':{'type':Sequelize[_0xb30b('0x2')],'comment':_0xb30b('0xf')},'data5':{'type':Sequelize[_0xb30b('0x2')],'comment':_0xb30b('0x10')},'role':{'type':Sequelize[_0xb30b('0x2')]},'internal':{'type':Sequelize[_0xb30b('0x5')]},'uniqueid':{'type':Sequelize[_0xb30b('0x2')]}}; \ No newline at end of file +var _0x54a6=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue'];(function(_0x4a0419,_0x36c89c){var _0x4a5056=function(_0x21b6cc){while(--_0x21b6cc){_0x4a0419['push'](_0x4a0419['shift']());}};_0x4a5056(++_0x36c89c);}(_0x54a6,0x6c));var _0x654a=function(_0x3a8161,_0x493ef5){_0x3a8161=_0x3a8161-0x0;var _0x7d3b34=_0x54a6[_0x3a8161];return _0x7d3b34;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x654a('0x0')]={'channel':{'type':Sequelize[_0x654a('0x1')]},'membername':{'type':Sequelize[_0x654a('0x1')]},'interface':{'type':Sequelize[_0x654a('0x1')]},'type':{'type':Sequelize[_0x654a('0x1')],'defaultValue':_0x654a('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x654a('0x3')]},'enterAt':{'type':Sequelize[_0x654a('0x4')]},'exitAt':{'type':Sequelize[_0x654a('0x4')],'set':function(_0x391b97){var _0x42b1d0=moment(_0x391b97);var _0x30c2d9=moment(this[_0x654a('0x5')](_0x654a('0x6')));var _0x3ac561=_0x42b1d0[_0x654a('0x7')](_0x30c2d9,_0x654a('0x8'));this['setDataValue'](_0x654a('0x9'),_0x391b97);this[_0x654a('0xa')](_0x654a('0xb'),_0x3ac561>=0x0?_0x3ac561:null);}},'data1':{'type':Sequelize[_0x654a('0x1')],'comment':_0x654a('0xc')},'data2':{'type':Sequelize[_0x654a('0x1')],'comment':_0x654a('0xd')},'data3':{'type':Sequelize[_0x654a('0x1')],'comment':_0x654a('0xe')},'data4':{'type':Sequelize[_0x654a('0x1')],'comment':_0x654a('0xf')},'data5':{'type':Sequelize[_0x654a('0x1')],'comment':_0x654a('0x10')},'role':{'type':Sequelize[_0x654a('0x1')]},'internal':{'type':Sequelize[_0x654a('0x3')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 981783c..ce25883 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x37964c,_0x5367fe){var _0x44fc6a=function(_0x5a9f6b){while(--_0x5a9f6b){_0x37964c['push'](_0x37964c['shift']());}};_0x44fc6a(++_0x5367fe);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +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(_0x517681,_0x342a5e){var _0x24dac7=function(_0xd139dd){while(--_0xd139dd){_0x517681['push'](_0x517681['shift']());}};_0x24dac7(++_0x342a5e);}(_0x008c,0x188));var _0xc008=function(_0x44e577,_0x16a38d){_0x44e577=_0x44e577-0x0;var _0x2ff124=_0x008c[_0x44e577];return _0x2ff124;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a113df5..46740d9 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 _0xfa62=['report_member','membername_interface','membername','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MemberReport'];(function(_0x5d60e5,_0xd497ca){var _0x23f7a9=function(_0x597ba4){while(--_0x597ba4){_0x5d60e5['push'](_0x5d60e5['shift']());}};_0x23f7a9(++_0xd497ca);}(_0xfa62,0x120));var _0x2fa6=function(_0xeec067,_0x52520f){_0xeec067=_0xeec067-0x0;var _0x1cc162=_0xfa62[_0xeec067];return _0x1cc162;};'use strict';var _=require(_0x2fa6('0x0'));var util=require(_0x2fa6('0x1'));var logger=require('../../config/logger')(_0x2fa6('0x2'));var moment=require(_0x2fa6('0x3'));var BPromise=require(_0x2fa6('0x4'));var rp=require(_0x2fa6('0x5'));var fs=require('fs');var path=require(_0x2fa6('0x6'));var rimraf=require(_0x2fa6('0x7'));var config=require(_0x2fa6('0x8'));var attributes=require('./memberReport.attributes');module[_0x2fa6('0x9')]=function(_0x32d21c,_0x33fcc2){return _0x32d21c[_0x2fa6('0xa')](_0x2fa6('0xb'),attributes,{'tableName':_0x2fa6('0xc'),'paranoid':![],'indexes':[{'name':_0x2fa6('0xd'),'fields':[_0x2fa6('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0b3=['rimraf','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x32ba58,_0x1ca0ff){var _0x201fae=function(_0x482fb2){while(--_0x482fb2){_0x32ba58['push'](_0x32ba58['shift']());}};_0x201fae(++_0x1ca0ff);}(_0xc0b3,0x1a8));var _0x3c0b=function(_0x28d76e,_0x51c7c1){_0x28d76e=_0x28d76e-0x0;var _0x2ab1b9=_0xc0b3[_0x28d76e];return _0x2ab1b9;};'use strict';var _=require(_0x3c0b('0x0'));var util=require(_0x3c0b('0x1'));var logger=require(_0x3c0b('0x2'))(_0x3c0b('0x3'));var moment=require(_0x3c0b('0x4'));var BPromise=require(_0x3c0b('0x5'));var rp=require(_0x3c0b('0x6'));var fs=require('fs');var path=require(_0x3c0b('0x7'));var rimraf=require(_0x3c0b('0x8'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x3c0b('0x9')]=function(_0x41f671,_0x312d35){return _0x41f671[_0x3c0b('0xa')](_0x3c0b('0xb'),attributes,{'tableName':_0x3c0b('0xc'),'paranoid':![],'indexes':[{'name':_0x3c0b('0xd'),'fields':[_0x3c0b('0xe'),_0x3c0b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 2b25158..546d97a 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 _0x66c7=['then','create','body','CreateMemberReport','UpdateMemberReport','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','limit','include','attributes','map','model'];(function(_0x2c1980,_0x9da7c3){var _0x3bf0bb=function(_0x43dba7){while(--_0x43dba7){_0x2c1980['push'](_0x2c1980['shift']());}};_0x3bf0bb(++_0x9da7c3);}(_0x66c7,0x15c));var _0x766c=function(_0x365c7f,_0xa99915){_0x365c7f=_0x365c7f-0x0;var _0x4a697e=_0x66c7[_0x365c7f];return _0x4a697e;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var moment=require(_0x766c('0x2'));var BPromise=require('bluebird');var rs=require(_0x766c('0x3'));var fs=require('fs');var Redis=require(_0x766c('0x4'));var db=require(_0x766c('0x5'))['db'];var utils=require(_0x766c('0x6'));var logger=require(_0x766c('0x7'))(_0x766c('0x8'));var config=require('../../config/environment');var jayson=require(_0x766c('0x9'));var client=jayson[_0x766c('0xa')][_0x766c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb0b5f7,_0x46d290,_0x3c4683){return new BPromise(function(_0x22a524,_0x4488b8){return client['request'](_0xb0b5f7,_0x3c4683)['then'](function(_0x141744){logger[_0x766c('0xc')](_0x766c('0xd'),_0x46d290,'request\x20sent');logger[_0x766c('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x46d290,_0x766c('0xf'),JSON[_0x766c('0x10')](_0x141744));if(_0x141744[_0x766c('0x11')]){if(_0x141744[_0x766c('0x11')][_0x766c('0x12')]===0x1f4){logger[_0x766c('0x11')](_0x766c('0xd'),_0x46d290,_0x141744[_0x766c('0x11')][_0x766c('0x13')]);return _0x4488b8(_0x141744[_0x766c('0x11')][_0x766c('0x13')]);}logger[_0x766c('0x11')](_0x766c('0xd'),_0x46d290,_0x141744[_0x766c('0x11')][_0x766c('0x13')]);return _0x22a524(_0x141744['error']['message']);}else{logger['info'](_0x766c('0xd'),_0x46d290,_0x766c('0xf'));_0x22a524(_0x141744[_0x766c('0x14')][_0x766c('0x13')]);}})[_0x766c('0x15')](function(_0x357602){logger['error']('MemberReport,\x20%s,\x20%s',_0x46d290,_0x357602);_0x4488b8(_0x357602);});});}exports[_0x766c('0x16')]=function(_0x23c566){var _0x105f60=this;return new Promise(function(_0x47c887,_0x2cd2e7){return db[_0x766c('0x17')][_0x766c('0x18')]({'raw':_0x23c566['options']?_0x23c566['options']['raw']===undefined?!![]:![]:!![],'where':_0x23c566[_0x766c('0x19')]?_0x23c566['options'][_0x766c('0x1a')]||null:null,'attributes':_0x23c566[_0x766c('0x19')]?_0x23c566['options']['attributes']||null:null,'limit':_0x23c566[_0x766c('0x19')]?_0x23c566[_0x766c('0x19')][_0x766c('0x1b')]||null:null,'include':_0x23c566['options']?_0x23c566[_0x766c('0x19')][_0x766c('0x1c')]?_['map'](_0x23c566['options']['include'],function(_0x43d91f){return{'model':db[_0x43d91f['model']],'as':_0x43d91f['as'],'attributes':_0x43d91f[_0x766c('0x1d')],'include':_0x43d91f[_0x766c('0x1c')]?_[_0x766c('0x1e')](_0x43d91f['include'],function(_0x44659e){return{'model':db[_0x44659e[_0x766c('0x1f')]],'as':_0x44659e['as'],'attributes':_0x44659e[_0x766c('0x1d')],'include':_0x44659e[_0x766c('0x1c')]?_[_0x766c('0x1e')](_0x44659e[_0x766c('0x1c')],function(_0x5ad1d6){return{'model':db[_0x5ad1d6[_0x766c('0x1f')]],'as':_0x5ad1d6['as'],'attributes':_0x5ad1d6[_0x766c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x766c('0x20')](function(_0x3a6757){logger[_0x766c('0xc')]('GetMemberReport',_0x23c566);logger['debug'](_0x766c('0x16'),_0x23c566,JSON[_0x766c('0x10')](_0x3a6757));_0x47c887(_0x3a6757);})[_0x766c('0x15')](function(_0x549dde){logger[_0x766c('0x11')](_0x766c('0x16'),_0x549dde['message'],_0x23c566);_0x2cd2e7(_0x105f60[_0x766c('0x11')](0x1f4,_0x549dde['message']));});});};exports['CreateMemberReport']=function(_0x3a4561){var _0x10421d=this;return new Promise(function(_0x1eac49,_0x5b94cf){return db[_0x766c('0x17')][_0x766c('0x21')](_0x3a4561[_0x766c('0x22')],{'raw':_0x3a4561[_0x766c('0x19')]?_0x3a4561[_0x766c('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4659cc){logger[_0x766c('0xc')](_0x766c('0x23'),_0x3a4561);logger[_0x766c('0xe')](_0x766c('0x23'),_0x3a4561,JSON['stringify'](_0x4659cc));_0x1eac49(_0x4659cc);})[_0x766c('0x15')](function(_0x40c43a){logger[_0x766c('0x11')]('CreateMemberReport',_0x40c43a[_0x766c('0x13')],_0x3a4561);_0x5b94cf(_0x10421d['error'](0x1f4,_0x40c43a['message']));});});};exports[_0x766c('0x24')]=function(_0x4e5eec){var _0x26bd0b=this;return new Promise(function(_0x182a81,_0x2f96e3){return db[_0x766c('0x17')]['update'](_0x4e5eec['body'],{'raw':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1a')]||null:null,'attributes':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1d')]||null:null,'limit':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1b')]||null:null})[_0x766c('0x20')](function(_0x4b2b06){logger[_0x766c('0xc')]('UpdateMemberReport',_0x4e5eec);logger[_0x766c('0xe')]('UpdateMemberReport',_0x4e5eec,JSON[_0x766c('0x10')](_0x4b2b06));_0x182a81(_0x4b2b06);})[_0x766c('0x15')](function(_0x4832da){logger[_0x766c('0x11')](_0x766c('0x24'),_0x4832da['message'],_0x4e5eec);_0x2f96e3(_0x26bd0b[_0x766c('0x11')](0x1f4,_0x4832da['message']));});});}; \ No newline at end of file +var _0x042a=['catch','GetMemberReport','MemberReport','options','where','attributes','limit','include','model','map','stringify','CreateMemberReport','create','raw','UpdateMemberReport','update','body','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x042a,0x1d9));var _0xa042=function(_0x630d82,_0x3b5ce0){_0x630d82=_0x630d82-0x0;var _0x19f5f6=_0x042a[_0x630d82];return _0x19f5f6;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var moment=require(_0xa042('0x1'));var BPromise=require(_0xa042('0x2'));var rs=require(_0xa042('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa042('0x4'))['db'];var utils=require(_0xa042('0x5'));var logger=require(_0xa042('0x6'))(_0xa042('0x7'));var config=require(_0xa042('0x8'));var jayson=require(_0xa042('0x9'));var client=jayson[_0xa042('0xa')][_0xa042('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47981b,_0x15774e,_0x5cfa15){return new BPromise(function(_0x58a031,_0x36fd79){return client['request'](_0x47981b,_0x5cfa15)[_0xa042('0xc')](function(_0xd80124){logger[_0xa042('0xd')](_0xa042('0xe'),_0x15774e,_0xa042('0xf'));logger[_0xa042('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x15774e,_0xa042('0xf'),JSON['stringify'](_0xd80124));if(_0xd80124[_0xa042('0x11')]){if(_0xd80124['error'][_0xa042('0x12')]===0x1f4){logger[_0xa042('0x11')](_0xa042('0xe'),_0x15774e,_0xd80124['error'][_0xa042('0x13')]);return _0x36fd79(_0xd80124[_0xa042('0x11')][_0xa042('0x13')]);}logger['error'](_0xa042('0xe'),_0x15774e,_0xd80124[_0xa042('0x11')][_0xa042('0x13')]);return _0x58a031(_0xd80124[_0xa042('0x11')]['message']);}else{logger[_0xa042('0xd')](_0xa042('0xe'),_0x15774e,_0xa042('0xf'));_0x58a031(_0xd80124[_0xa042('0x14')][_0xa042('0x13')]);}})[_0xa042('0x15')](function(_0x5a4fbf){logger['error'](_0xa042('0xe'),_0x15774e,_0x5a4fbf);_0x36fd79(_0x5a4fbf);});});}exports[_0xa042('0x16')]=function(_0x1752bf){var _0x3271fd=this;return new Promise(function(_0x20879b,_0xab379){return db[_0xa042('0x17')]['findAll']({'raw':_0x1752bf['options']?_0x1752bf['options']['raw']===undefined?!![]:![]:!![],'where':_0x1752bf['options']?_0x1752bf[_0xa042('0x18')][_0xa042('0x19')]||null:null,'attributes':_0x1752bf[_0xa042('0x18')]?_0x1752bf[_0xa042('0x18')][_0xa042('0x1a')]||null:null,'limit':_0x1752bf[_0xa042('0x18')]?_0x1752bf['options'][_0xa042('0x1b')]||null:null,'include':_0x1752bf[_0xa042('0x18')]?_0x1752bf[_0xa042('0x18')][_0xa042('0x1c')]?_['map'](_0x1752bf[_0xa042('0x18')][_0xa042('0x1c')],function(_0x384d9e){return{'model':db[_0x384d9e[_0xa042('0x1d')]],'as':_0x384d9e['as'],'attributes':_0x384d9e[_0xa042('0x1a')],'include':_0x384d9e[_0xa042('0x1c')]?_[_0xa042('0x1e')](_0x384d9e[_0xa042('0x1c')],function(_0x3b4ec8){return{'model':db[_0x3b4ec8[_0xa042('0x1d')]],'as':_0x3b4ec8['as'],'attributes':_0x3b4ec8[_0xa042('0x1a')],'include':_0x3b4ec8[_0xa042('0x1c')]?_[_0xa042('0x1e')](_0x3b4ec8[_0xa042('0x1c')],function(_0x4b41f0){return{'model':db[_0x4b41f0[_0xa042('0x1d')]],'as':_0x4b41f0['as'],'attributes':_0x4b41f0[_0xa042('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44b518){logger[_0xa042('0xd')]('GetMemberReport',_0x1752bf);logger[_0xa042('0x10')](_0xa042('0x16'),_0x1752bf,JSON[_0xa042('0x1f')](_0x44b518));_0x20879b(_0x44b518);})[_0xa042('0x15')](function(_0x3baff3){logger[_0xa042('0x11')](_0xa042('0x16'),_0x3baff3[_0xa042('0x13')],_0x1752bf);_0xab379(_0x3271fd[_0xa042('0x11')](0x1f4,_0x3baff3[_0xa042('0x13')]));});});};exports[_0xa042('0x20')]=function(_0x5e963d){var _0x566665=this;return new Promise(function(_0x2c499b,_0xadc429){return db[_0xa042('0x17')][_0xa042('0x21')](_0x5e963d['body'],{'raw':_0x5e963d[_0xa042('0x18')]?_0x5e963d['options'][_0xa042('0x22')]===undefined?!![]:![]:!![]})[_0xa042('0xc')](function(_0x4be891){logger['info']('CreateMemberReport',_0x5e963d);logger['debug'](_0xa042('0x20'),_0x5e963d,JSON['stringify'](_0x4be891));_0x2c499b(_0x4be891);})[_0xa042('0x15')](function(_0x315137){logger['error'](_0xa042('0x20'),_0x315137['message'],_0x5e963d);_0xadc429(_0x566665['error'](0x1f4,_0x315137[_0xa042('0x13')]));});});};exports[_0xa042('0x23')]=function(_0x38e09d){var _0x411ba4=this;return new Promise(function(_0x2d4d97,_0x152ff0){return db[_0xa042('0x17')][_0xa042('0x24')](_0x38e09d[_0xa042('0x25')],{'raw':_0x38e09d[_0xa042('0x18')]?_0x38e09d[_0xa042('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38e09d['options']?_0x38e09d['options'][_0xa042('0x19')]||null:null,'attributes':_0x38e09d['options']?_0x38e09d[_0xa042('0x18')][_0xa042('0x1a')]||null:null,'limit':_0x38e09d[_0xa042('0x18')]?_0x38e09d[_0xa042('0x18')]['limit']||null:null})[_0xa042('0xc')](function(_0x4b97dc){logger['info'](_0xa042('0x23'),_0x38e09d);logger['debug'](_0xa042('0x23'),_0x38e09d,JSON[_0xa042('0x1f')](_0x4b97dc));_0x2d4d97(_0x4b97dc);})[_0xa042('0x15')](function(_0xad343e){logger[_0xa042('0x11')]('UpdateMemberReport',_0xad343e[_0xa042('0x13')],_0x38e09d);_0x152ff0(_0x411ba4[_0xa042('0x11')](0x1f4,_0xad343e[_0xa042('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 61982d9..b3b3b85 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 _0x855d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','exports'];(function(_0x2a8f60,_0x130679){var _0x383a17=function(_0x16437a){while(--_0x16437a){_0x2a8f60['push'](_0x2a8f60['shift']());}};_0x383a17(++_0x130679);}(_0x855d,0x64));var _0xd855=function(_0x73640f,_0x1ed619){_0x73640f=_0x73640f-0x0;var _0x22feea=_0x855d[_0x73640f];return _0x22feea;};'use strict';var multer=require(_0xd855('0x0'));var util=require(_0xd855('0x1'));var path=require(_0xd855('0x2'));var timeout=require(_0xd855('0x3'));var express=require(_0xd855('0x4'));var router=express[_0xd855('0x5')]();var fs_extra=require(_0xd855('0x6'));var auth=require(_0xd855('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd855('0x8'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0xd855('0x9')]=router; \ No newline at end of file +var _0xcbe5=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util'];(function(_0x48a928,_0x430727){var _0x11c1e9=function(_0x338805){while(--_0x338805){_0x48a928['push'](_0x48a928['shift']());}};_0x11c1e9(++_0x430727);}(_0xcbe5,0xee));var _0x5cbe=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xcbe5[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x5cbe('0x0'));var util=require(_0x5cbe('0x1'));var path=require(_0x5cbe('0x2'));var timeout=require('connect-timeout');var express=require(_0x5cbe('0x3'));var router=express[_0x5cbe('0x4')]();var fs_extra=require(_0x5cbe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5cbe('0x6'));var config=require(_0x5cbe('0x7'));var controller=require(_0x5cbe('0x8'));router[_0x5cbe('0x9')]('/',controller[_0x5cbe('0xa')]);module[_0x5cbe('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 03d92d8..015eaa1 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x9a47=['STRING','version'];(function(_0x310a01,_0x55ed5a){var _0x578883=function(_0x389f4c){while(--_0x389f4c){_0x310a01['push'](_0x310a01['shift']());}};_0x578883(++_0x55ed5a);}(_0x9a47,0xaa));var _0x79a4=function(_0x58c37f,_0x23f3b3){_0x58c37f=_0x58c37f-0x0;var _0x52c596=_0x9a47[_0x58c37f];return _0x52c596;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x79a4('0x0')],'unique':_0x79a4('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 7b3bb85..41cf757 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 _0xdbdc=['fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Migration','fieldName','key','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x166e1d,_0x43130b){var _0x4efcf2=function(_0x374bd5){while(--_0x374bd5){_0x166e1d['push'](_0x166e1d['shift']());}};_0x4efcf2(++_0x43130b);}(_0xdbdc,0xfb));var _0xcdbd=function(_0x32721f,_0x48b061){_0x32721f=_0x32721f-0x0;var _0x328750=_0xdbdc[_0x32721f];return _0x328750;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdbd('0x0'));var zipdir=require(_0xcdbd('0x1'));var jsonpatch=require(_0xcdbd('0x2'));var rp=require(_0xcdbd('0x3'));var moment=require(_0xcdbd('0x4'));var BPromise=require(_0xcdbd('0x5'));var Mustache=require(_0xcdbd('0x6'));var util=require(_0xcdbd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcdbd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdbd('0x9'));var _=require(_0xcdbd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcdbd('0xb'));var deskjs=require(_0xcdbd('0xc'));var toCsv=require(_0xcdbd('0x8'));var querystring=require(_0xcdbd('0xd'));var Papa=require(_0xcdbd('0xe'));var Redis=require('ioredis');var authService=require(_0xcdbd('0xf'));var qs=require(_0xcdbd('0x10'));var as=require(_0xcdbd('0x11'));var hardwareService=require(_0xcdbd('0x12'));var logger=require(_0xcdbd('0x13'))('api');var utils=require(_0xcdbd('0x14'));var config=require(_0xcdbd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdbd('0x16'))['db'];function respondWithStatusCode(_0x4d20fb,_0x2cc616){_0x2cc616=_0x2cc616||0xcc;return function(_0x3cba8e){if(_0x3cba8e){return _0x4d20fb[_0xcdbd('0x17')](_0x2cc616);}return _0x4d20fb[_0xcdbd('0x18')](_0x2cc616)[_0xcdbd('0x19')]();};}function respondWithResult(_0x3ff830,_0x24e0ea){_0x24e0ea=_0x24e0ea||0xc8;return function(_0x14ad7d){if(_0x14ad7d){return _0x3ff830[_0xcdbd('0x18')](_0x24e0ea)[_0xcdbd('0x1a')](_0x14ad7d);}};}function respondWithFilteredResult(_0x21f472,_0x26bc0b){return function(_0x3f3258){if(_0x3f3258){var _0x4fe5c4=typeof _0x26bc0b['offset']===_0xcdbd('0x1b')&&typeof _0x26bc0b[_0xcdbd('0x1c')]===_0xcdbd('0x1b');var _0x52d3a2=_0x3f3258[_0xcdbd('0x1d')];var _0x2f9fda=_0x4fe5c4?0x0:_0x26bc0b[_0xcdbd('0x1e')];var _0x1c9d6c=_0x4fe5c4?_0x3f3258['count']:_0x26bc0b[_0xcdbd('0x1e')]+_0x26bc0b[_0xcdbd('0x1c')];var _0x3f7ae1;if(_0x1c9d6c>=_0x52d3a2){_0x1c9d6c=_0x52d3a2;_0x3f7ae1=0xc8;}else{_0x3f7ae1=0xce;}_0x21f472[_0xcdbd('0x18')](_0x3f7ae1);return _0x21f472['set'](_0xcdbd('0x1f'),_0x2f9fda+'-'+_0x1c9d6c+'/'+_0x52d3a2)[_0xcdbd('0x1a')](_0x3f3258);}return null;};}function patchUpdates(_0x4ff100){return function(_0x199d93){try{jsonpatch[_0xcdbd('0x20')](_0x199d93,_0x4ff100,!![]);}catch(_0x43e754){return BPromise[_0xcdbd('0x21')](_0x43e754);}return _0x199d93[_0xcdbd('0x22')]();};}function saveUpdates(_0x3bea4b,_0xfc86ca){return function(_0x16234b){if(_0x16234b){return _0x16234b[_0xcdbd('0x23')](_0x3bea4b)[_0xcdbd('0x24')](function(_0x20a84e){return _0x20a84e;});}return null;};}function removeEntity(_0x4fe57d,_0x946476){return function(_0x5b9f43){if(_0x5b9f43){return _0x5b9f43[_0xcdbd('0x25')]()[_0xcdbd('0x24')](function(){_0x4fe57d[_0xcdbd('0x18')](0xcc)[_0xcdbd('0x19')]();});}};}function handleEntityNotFound(_0x2e95c5,_0x48dda3){return function(_0x1ec07c){if(!_0x1ec07c){_0x2e95c5[_0xcdbd('0x17')](0x194);}return _0x1ec07c;};}function handleError(_0x491cb6,_0x2395f8){_0x2395f8=_0x2395f8||0x1f4;return function(_0x57767f){logger[_0xcdbd('0x26')](_0x57767f[_0xcdbd('0x27')]);if(_0x57767f[_0xcdbd('0x28')]){delete _0x57767f[_0xcdbd('0x28')];}_0x491cb6[_0xcdbd('0x18')](_0x2395f8)[_0xcdbd('0x29')](_0x57767f);};}exports['index']=function(_0x26685b,_0x32237a){var _0x3242a5={},_0xc04e2={},_0x44b179={'count':0x0,'rows':[]};var _0x31c418=_['map'](db[_0xcdbd('0x2a')]['rawAttributes'],function(_0x493e01){return{'name':_0x493e01[_0xcdbd('0x2b')],'type':_0x493e01['type'][_0xcdbd('0x2c')]};});_0xc04e2['model']=_['map'](_0x31c418,_0xcdbd('0x28'));_0xc04e2[_0xcdbd('0x2d')]=_[_0xcdbd('0x2e')](_0x26685b[_0xcdbd('0x2d')]);_0xc04e2[_0xcdbd('0x2f')]=_[_0xcdbd('0x30')](_0xc04e2['model'],_0xc04e2['query']);_0x3242a5[_0xcdbd('0x31')]=_['intersection'](_0xc04e2['model'],qs['fields'](_0x26685b['query']['fields']));_0x3242a5[_0xcdbd('0x31')]=_0x3242a5[_0xcdbd('0x31')][_0xcdbd('0x32')]?_0x3242a5['attributes']:_0xc04e2[_0xcdbd('0x33')];if(!_0x26685b[_0xcdbd('0x2d')][_0xcdbd('0x34')]('nolimit')){_0x3242a5[_0xcdbd('0x1c')]=qs[_0xcdbd('0x1c')](_0x26685b[_0xcdbd('0x2d')][_0xcdbd('0x1c')]);_0x3242a5[_0xcdbd('0x1e')]=qs['offset'](_0x26685b['query'][_0xcdbd('0x1e')]);}_0x3242a5[_0xcdbd('0x35')]=qs[_0xcdbd('0x36')](_0x26685b['query']['sort']);_0x3242a5[_0xcdbd('0x37')]=qs['filters'](_[_0xcdbd('0x38')](_0x26685b[_0xcdbd('0x2d')],_0xc04e2[_0xcdbd('0x2f')]),_0x31c418);if(_0x26685b[_0xcdbd('0x2d')][_0xcdbd('0x39')]){_0x3242a5[_0xcdbd('0x37')]=_[_0xcdbd('0x3a')](_0x3242a5['where'],{'$or':_[_0xcdbd('0x3b')](_0x31c418,function(_0x2b8ed3){if(_0x2b8ed3['type']!==_0xcdbd('0x3c')){var _0x28b425={};_0x28b425[_0x2b8ed3['name']]={'$like':'%'+_0x26685b[_0xcdbd('0x2d')][_0xcdbd('0x39')]+'%'};return _0x28b425;}})});}_0x3242a5=_[_0xcdbd('0x3a')]({},_0x3242a5,_0x26685b[_0xcdbd('0x3d')]);var _0x289091={'where':_0x3242a5['where']};return db[_0xcdbd('0x2a')]['count'](_0x289091)[_0xcdbd('0x24')](function(_0xcebdf){_0x44b179[_0xcdbd('0x1d')]=_0xcebdf;if(_0x26685b[_0xcdbd('0x2d')]['includeAll']){_0x3242a5[_0xcdbd('0x3e')]=[{'all':!![]}];}return db[_0xcdbd('0x2a')]['findAll'](_0x3242a5);})[_0xcdbd('0x24')](function(_0x1b8bc8){_0x44b179[_0xcdbd('0x3f')]=_0x1b8bc8;return _0x44b179;})[_0xcdbd('0x24')](respondWithFilteredResult(_0x32237a,_0x3242a5))[_0xcdbd('0x40')](handleError(_0x32237a,null));}; \ No newline at end of file +var _0xbeb6=['end','json','offset','undefined','limit','count','reject','save','update','then','destroy','sendStatus','name','index','Migration','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x5f13f8,_0x2337cb){var _0xdabca4=function(_0x1e814d){while(--_0x1e814d){_0x5f13f8['push'](_0x5f13f8['shift']());}};_0xdabca4(++_0x2337cb);}(_0xbeb6,0xa3));var _0x6beb=function(_0x418b55,_0x462931){_0x418b55=_0x418b55-0x0;var _0x1675fa=_0xbeb6[_0x418b55];return _0x1675fa;};'use strict';var emlformat=require(_0x6beb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6beb('0x1'));var jsonpatch=require(_0x6beb('0x2'));var rp=require('request-promise');var moment=require(_0x6beb('0x3'));var BPromise=require(_0x6beb('0x4'));var Mustache=require(_0x6beb('0x5'));var util=require(_0x6beb('0x6'));var path=require(_0x6beb('0x7'));var sox=require(_0x6beb('0x8'));var csv=require(_0x6beb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6beb('0xa'));var _=require(_0x6beb('0xb'));var squel=require(_0x6beb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6beb('0xd'));var toCsv=require(_0x6beb('0x9'));var querystring=require(_0x6beb('0xe'));var Papa=require(_0x6beb('0xf'));var Redis=require(_0x6beb('0x10'));var authService=require(_0x6beb('0x11'));var qs=require(_0x6beb('0x12'));var as=require(_0x6beb('0x13'));var hardwareService=require(_0x6beb('0x14'));var logger=require(_0x6beb('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6beb('0x16'));var licenseUtil=require(_0x6beb('0x17'));var db=require(_0x6beb('0x18'))['db'];function respondWithStatusCode(_0x42efd4,_0x39c94f){_0x39c94f=_0x39c94f||0xcc;return function(_0x5b2da0){if(_0x5b2da0){return _0x42efd4['sendStatus'](_0x39c94f);}return _0x42efd4[_0x6beb('0x19')](_0x39c94f)[_0x6beb('0x1a')]();};}function respondWithResult(_0x21b55b,_0x51d189){_0x51d189=_0x51d189||0xc8;return function(_0x3bae51){if(_0x3bae51){return _0x21b55b[_0x6beb('0x19')](_0x51d189)[_0x6beb('0x1b')](_0x3bae51);}};}function respondWithFilteredResult(_0x41c9c0,_0x508c89){return function(_0x321b88){if(_0x321b88){var _0x12382e=typeof _0x508c89[_0x6beb('0x1c')]===_0x6beb('0x1d')&&typeof _0x508c89[_0x6beb('0x1e')]==='undefined';var _0x123296=_0x321b88[_0x6beb('0x1f')];var _0x467687=_0x12382e?0x0:_0x508c89[_0x6beb('0x1c')];var _0x801151=_0x12382e?_0x321b88['count']:_0x508c89[_0x6beb('0x1c')]+_0x508c89['limit'];var _0x3a48e1;if(_0x801151>=_0x123296){_0x801151=_0x123296;_0x3a48e1=0xc8;}else{_0x3a48e1=0xce;}_0x41c9c0[_0x6beb('0x19')](_0x3a48e1);return _0x41c9c0['set']('Content-Range',_0x467687+'-'+_0x801151+'/'+_0x123296)[_0x6beb('0x1b')](_0x321b88);}return null;};}function patchUpdates(_0x5b2aa0){return function(_0x2d32d7){try{jsonpatch['apply'](_0x2d32d7,_0x5b2aa0,!![]);}catch(_0x38d22e){return BPromise[_0x6beb('0x20')](_0x38d22e);}return _0x2d32d7[_0x6beb('0x21')]();};}function saveUpdates(_0x411a1c,_0x536bdc){return function(_0x448d5d){if(_0x448d5d){return _0x448d5d[_0x6beb('0x22')](_0x411a1c)[_0x6beb('0x23')](function(_0x55ad7a){return _0x55ad7a;});}return null;};}function removeEntity(_0x451b8,_0x3d2468){return function(_0x332763){if(_0x332763){return _0x332763[_0x6beb('0x24')]()[_0x6beb('0x23')](function(){_0x451b8['status'](0xcc)[_0x6beb('0x1a')]();});}};}function handleEntityNotFound(_0x1f4ade,_0x15e1ff){return function(_0x1caaa4){if(!_0x1caaa4){_0x1f4ade[_0x6beb('0x25')](0x194);}return _0x1caaa4;};}function handleError(_0x2365cd,_0x40a2c4){_0x40a2c4=_0x40a2c4||0x1f4;return function(_0x1ee7fc){logger['error'](_0x1ee7fc['stack']);if(_0x1ee7fc[_0x6beb('0x26')]){delete _0x1ee7fc[_0x6beb('0x26')];}_0x2365cd[_0x6beb('0x19')](_0x40a2c4)['send'](_0x1ee7fc);};}exports[_0x6beb('0x27')]=function(_0x4620d3,_0x4b4a64){var _0x500de4={},_0x2e55f0={},_0x16f1c3={'count':0x0,'rows':[]};var _0x56d794=_['map'](db[_0x6beb('0x28')]['rawAttributes'],function(_0x2409e6){return{'name':_0x2409e6[_0x6beb('0x29')],'type':_0x2409e6[_0x6beb('0x2a')][_0x6beb('0x2b')]};});_0x2e55f0[_0x6beb('0x2c')]=_[_0x6beb('0x2d')](_0x56d794,'name');_0x2e55f0['query']=_['keys'](_0x4620d3[_0x6beb('0x2e')]);_0x2e55f0[_0x6beb('0x2f')]=_['intersection'](_0x2e55f0['model'],_0x2e55f0[_0x6beb('0x2e')]);_0x500de4[_0x6beb('0x30')]=_[_0x6beb('0x31')](_0x2e55f0[_0x6beb('0x2c')],qs[_0x6beb('0x32')](_0x4620d3[_0x6beb('0x2e')][_0x6beb('0x32')]));_0x500de4[_0x6beb('0x30')]=_0x500de4[_0x6beb('0x30')]['length']?_0x500de4[_0x6beb('0x30')]:_0x2e55f0['model'];if(!_0x4620d3['query'][_0x6beb('0x33')](_0x6beb('0x34'))){_0x500de4[_0x6beb('0x1e')]=qs[_0x6beb('0x1e')](_0x4620d3[_0x6beb('0x2e')][_0x6beb('0x1e')]);_0x500de4[_0x6beb('0x1c')]=qs[_0x6beb('0x1c')](_0x4620d3[_0x6beb('0x2e')][_0x6beb('0x1c')]);}_0x500de4[_0x6beb('0x35')]=qs[_0x6beb('0x36')](_0x4620d3[_0x6beb('0x2e')][_0x6beb('0x36')]);_0x500de4['where']=qs[_0x6beb('0x2f')](_[_0x6beb('0x37')](_0x4620d3['query'],_0x2e55f0[_0x6beb('0x2f')]),_0x56d794);if(_0x4620d3[_0x6beb('0x2e')][_0x6beb('0x38')]){_0x500de4[_0x6beb('0x39')]=_[_0x6beb('0x3a')](_0x500de4[_0x6beb('0x39')],{'$or':_['map'](_0x56d794,function(_0x5b3c93){if(_0x5b3c93['type']!==_0x6beb('0x3b')){var _0x882823={};_0x882823[_0x5b3c93[_0x6beb('0x26')]]={'$like':'%'+_0x4620d3['query'][_0x6beb('0x38')]+'%'};return _0x882823;}})});}_0x500de4=_[_0x6beb('0x3a')]({},_0x500de4,_0x4620d3['options']);var _0x41faac={'where':_0x500de4[_0x6beb('0x39')]};return db[_0x6beb('0x28')]['count'](_0x41faac)['then'](function(_0x3a070d){_0x16f1c3[_0x6beb('0x1f')]=_0x3a070d;if(_0x4620d3['query'][_0x6beb('0x3c')]){_0x500de4[_0x6beb('0x3d')]=[{'all':!![]}];}return db[_0x6beb('0x28')]['findAll'](_0x500de4);})[_0x6beb('0x23')](function(_0x3503b1){_0x16f1c3[_0x6beb('0x3e')]=_0x3503b1;return _0x16f1c3;})[_0x6beb('0x23')](respondWithFilteredResult(_0x4b4a64,_0x500de4))['catch'](handleError(_0x4b4a64,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index c54e426..50e701b 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 _0x452c=['migrations','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./migration.attributes','exports'];(function(_0x464665,_0x4330d5){var _0x2c2e07=function(_0xd9b40f){while(--_0xd9b40f){_0x464665['push'](_0x464665['shift']());}};_0x2c2e07(++_0x4330d5);}(_0x452c,0x1d7));var _0xc452=function(_0x2a45a1,_0x25b9f5){_0x2a45a1=_0x2a45a1-0x0;var _0x2c1643=_0x452c[_0x2a45a1];return _0x2c1643;};'use strict';var _=require(_0xc452('0x0'));var util=require('util');var logger=require(_0xc452('0x1'))(_0xc452('0x2'));var moment=require(_0xc452('0x3'));var BPromise=require(_0xc452('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc452('0x5'));var config=require(_0xc452('0x6'));var attributes=require(_0xc452('0x7'));module[_0xc452('0x8')]=function(_0x40b11c,_0x310d4b){return _0x40b11c['define']('Migration',attributes,{'tableName':_0xc452('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa737=['./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3064e7,_0x34edba){var _0x26038e=function(_0x35336c){while(--_0x35336c){_0x3064e7['push'](_0x3064e7['shift']());}};_0x26038e(++_0x34edba);}(_0xa737,0x1d3));var _0x7a73=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa737[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7a73('0x0'));var util=require(_0x7a73('0x1'));var logger=require(_0x7a73('0x2'))(_0x7a73('0x3'));var moment=require(_0x7a73('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a73('0x5'));var fs=require('fs');var path=require(_0x7a73('0x6'));var rimraf=require(_0x7a73('0x7'));var config=require(_0x7a73('0x8'));var attributes=require(_0x7a73('0x9'));module[_0x7a73('0xa')]=function(_0x15b22b,_0x26f91b){return _0x15b22b[_0x7a73('0xb')](_0x7a73('0xc'),attributes,{'tableName':_0x7a73('0xd'),'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 51cf7f6..d5c79d6 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 _0x2285=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4a9771,_0x52429b){var _0x52e0ed=function(_0x5485c0){while(--_0x5485c0){_0x4a9771['push'](_0x4a9771['shift']());}};_0x52e0ed(++_0x52429b);}(_0x2285,0x177));var _0x5228=function(_0x156fd2,_0x41694a){_0x156fd2=_0x156fd2-0x0;var _0x471889=_0x2285[_0x156fd2];return _0x471889;};'use strict';var _=require('lodash');var util=require(_0x5228('0x0'));var moment=require(_0x5228('0x1'));var BPromise=require(_0x5228('0x2'));var rs=require(_0x5228('0x3'));var fs=require('fs');var Redis=require(_0x5228('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5228('0x5'));var logger=require(_0x5228('0x6'))('rpc');var config=require(_0x5228('0x7'));var jayson=require(_0x5228('0x8'));var client=jayson[_0x5228('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18b2db,_0x156977,_0x192393){return new BPromise(function(_0x322b86,_0x81c9c6){return client[_0x5228('0xa')](_0x18b2db,_0x192393)[_0x5228('0xb')](function(_0xbd1b8d){logger[_0x5228('0xc')](_0x5228('0xd'),_0x156977,'request\x20sent');logger[_0x5228('0xe')](_0x5228('0xf'),_0x156977,_0x5228('0x10'),JSON[_0x5228('0x11')](_0xbd1b8d));if(_0xbd1b8d['error']){if(_0xbd1b8d[_0x5228('0x12')][_0x5228('0x13')]===0x1f4){logger[_0x5228('0x12')](_0x5228('0xd'),_0x156977,_0xbd1b8d['error'][_0x5228('0x14')]);return _0x81c9c6(_0xbd1b8d[_0x5228('0x12')][_0x5228('0x14')]);}logger[_0x5228('0x12')](_0x5228('0xd'),_0x156977,_0xbd1b8d[_0x5228('0x12')]['message']);return _0x322b86(_0xbd1b8d[_0x5228('0x12')][_0x5228('0x14')]);}else{logger['info'](_0x5228('0xd'),_0x156977,_0x5228('0x10'));_0x322b86(_0xbd1b8d['result'][_0x5228('0x14')]);}})[_0x5228('0x15')](function(_0x1c4121){logger[_0x5228('0x12')]('Migration,\x20%s,\x20%s',_0x156977,_0x1c4121);_0x81c9c6(_0x1c4121);});});} \ No newline at end of file +var _0x19c3=['message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0x19c3,0xf9));var _0x319c=function(_0x433491,_0x403f20){_0x433491=_0x433491-0x0;var _0x3a9c0d=_0x19c3[_0x433491];return _0x3a9c0d;};'use strict';var _=require(_0x319c('0x0'));var util=require('util');var moment=require(_0x319c('0x1'));var BPromise=require(_0x319c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x319c('0x3'));var db=require(_0x319c('0x4'))['db'];var utils=require(_0x319c('0x5'));var logger=require(_0x319c('0x6'))(_0x319c('0x7'));var config=require(_0x319c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x319c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e38c4,_0x2df1a9,_0x9a5cf8){return new BPromise(function(_0x306a4b,_0x3662ed){return client['request'](_0x2e38c4,_0x9a5cf8)[_0x319c('0xa')](function(_0x1b7ffd){logger[_0x319c('0xb')](_0x319c('0xc'),_0x2df1a9,_0x319c('0xd'));logger[_0x319c('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x2df1a9,_0x319c('0xd'),JSON['stringify'](_0x1b7ffd));if(_0x1b7ffd[_0x319c('0xf')]){if(_0x1b7ffd[_0x319c('0xf')][_0x319c('0x10')]===0x1f4){logger[_0x319c('0xf')](_0x319c('0xc'),_0x2df1a9,_0x1b7ffd[_0x319c('0xf')][_0x319c('0x11')]);return _0x3662ed(_0x1b7ffd['error']['message']);}logger[_0x319c('0xf')](_0x319c('0xc'),_0x2df1a9,_0x1b7ffd['error'][_0x319c('0x11')]);return _0x306a4b(_0x1b7ffd[_0x319c('0xf')][_0x319c('0x11')]);}else{logger[_0x319c('0xb')](_0x319c('0xc'),_0x2df1a9,_0x319c('0xd'));_0x306a4b(_0x1b7ffd[_0x319c('0x12')]['message']);}})['catch'](function(_0x9415a5){logger[_0x319c('0xf')]('Migration,\x20%s,\x20%s',_0x2df1a9,_0x9415a5);_0x3662ed(_0x9415a5);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 86e8af6..576dcf3 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 _0xa428=['/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index'];(function(_0x5cb9c9,_0x273265){var _0x53d63b=function(_0x333212){while(--_0x333212){_0x5cb9c9['push'](_0x5cb9c9['shift']());}};_0x53d63b(++_0x273265);}(_0xa428,0xd8));var _0x8a42=function(_0x3509b8,_0x38f51c){_0x3509b8=_0x3509b8-0x0;var _0x24239c=_0xa428[_0x3509b8];return _0x24239c;};'use strict';var multer=require(_0x8a42('0x0'));var util=require('util');var path=require(_0x8a42('0x1'));var timeout=require(_0x8a42('0x2'));var express=require(_0x8a42('0x3'));var router=express[_0x8a42('0x4')]();var fs_extra=require(_0x8a42('0x5'));var auth=require(_0x8a42('0x6'));var interaction=require(_0x8a42('0x7'));var config=require('../../config/environment');var controller=require(_0x8a42('0x8'));router[_0x8a42('0x9')]('/',auth[_0x8a42('0xa')](),controller[_0x8a42('0xb')]);router['get'](_0x8a42('0xc'),auth[_0x8a42('0xa')](),controller['show']);router[_0x8a42('0xd')]('/',auth[_0x8a42('0xa')](),controller[_0x8a42('0xe')]);router[_0x8a42('0xf')](_0x8a42('0xc'),auth[_0x8a42('0xa')](),controller[_0x8a42('0x10')]);router[_0x8a42('0x11')](_0x8a42('0xc'),auth[_0x8a42('0xa')](),controller['destroy']);module[_0x8a42('0x12')]=router; \ No newline at end of file +var _0xf1d6=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','create','destroy','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf1d6,0x195));var _0x6f1d=function(_0x1fe8a4,_0xf42ddd){_0x1fe8a4=_0x1fe8a4-0x0;var _0x83d7ec=_0xf1d6[_0x1fe8a4];return _0x83d7ec;};'use strict';var multer=require(_0x6f1d('0x0'));var util=require(_0x6f1d('0x1'));var path=require(_0x6f1d('0x2'));var timeout=require(_0x6f1d('0x3'));var express=require(_0x6f1d('0x4'));var router=express['Router']();var fs_extra=require(_0x6f1d('0x5'));var auth=require(_0x6f1d('0x6'));var interaction=require(_0x6f1d('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0x6f1d('0x8')](),controller[_0x6f1d('0x9')]);router[_0x6f1d('0xa')](_0x6f1d('0xb'),auth[_0x6f1d('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6f1d('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x6f1d('0xb'),auth['isAuthenticated'](),controller[_0x6f1d('0xd')]);module[_0x6f1d('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index a1968dc..9a5731a 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 _0x2fef=['externip','turn','STRING','sequelize','ENUM'];(function(_0x341d8d,_0x5622ed){var _0x11b9cd=function(_0x458ca3){while(--_0x458ca3){_0x341d8d['push'](_0x341d8d['shift']());}};_0x11b9cd(++_0x5622ed);}(_0x2fef,0x94));var _0xf2fe=function(_0x47bcee,_0x5c0311){_0x47bcee=_0x47bcee-0x0;var _0x4b88a8=_0x2fef[_0x47bcee];return _0x4b88a8;};'use strict';var Sequelize=require(_0xf2fe('0x0'));module['exports']={'type':{'type':Sequelize[_0xf2fe('0x1')]('localnet',_0xf2fe('0x2'),'stun',_0xf2fe('0x3'))},'value':{'type':Sequelize[_0xf2fe('0x4')]},'username':{'type':Sequelize[_0xf2fe('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa95a=['ENUM','localnet','externip','stun','turn','STRING','exports'];(function(_0x2abf7f,_0x23b05a){var _0x248bce=function(_0x4c836d){while(--_0x4c836d){_0x2abf7f['push'](_0x2abf7f['shift']());}};_0x248bce(++_0x23b05a);}(_0xa95a,0xed));var _0xaa95=function(_0x1ce441,_0x3c2be5){_0x1ce441=_0x1ce441-0x0;var _0x1dc7b0=_0xa95a[_0x1ce441];return _0x1dc7b0;};'use strict';var Sequelize=require('sequelize');module[_0xaa95('0x0')]={'type':{'type':Sequelize[_0xaa95('0x1')](_0xaa95('0x2'),_0xaa95('0x3'),_0xaa95('0x4'),_0xaa95('0x5'))},'value':{'type':Sequelize[_0xaa95('0x6')]},'username':{'type':Sequelize[_0xaa95('0x6')]},'password':{'type':Sequelize[_0xaa95('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 85bac32..7cab156 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 _0x389e=['error','message','result','catch','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','update','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','Network','include','findAll','rows','params','includeAll','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','utf8','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','format','toLowerCase','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','destroy','server/files/templates/turn_multiple.ejs','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','code'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x389e,0x188));var _0xe389=function(_0x739550,_0x57aa93){_0x739550=_0x739550-0x0;var _0x5c17ef=_0x389e[_0x739550];return _0x5c17ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe389('0x0'));var rp=require(_0xe389('0x1'));var moment=require('moment');var BPromise=require(_0xe389('0x2'));var Mustache=require(_0xe389('0x3'));var util=require(_0xe389('0x4'));var path=require(_0xe389('0x5'));var sox=require(_0xe389('0x6'));var csv=require(_0xe389('0x7'));var ejs=require(_0xe389('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe389('0x9'));var squel=require(_0xe389('0xa'));var crypto=require(_0xe389('0xb'));var jsforce=require(_0xe389('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe389('0x7'));var querystring=require(_0xe389('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe389('0xe'));var qs=require(_0xe389('0xf'));var as=require(_0xe389('0x10'));var hardwareService=require(_0xe389('0x11'));var logger=require(_0xe389('0x12'))(_0xe389('0x13'));var utils=require(_0xe389('0x14'));var config=require(_0xe389('0x15'));var licenseUtil=require(_0xe389('0x16'));var db=require(_0xe389('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe389('0x18')][_0xe389('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2672c0,_0x5487cb,_0x5a7df4,_0x5b4580){return new BPromise(function(_0x389e29,_0x587d75){var _0x5661c8=_0x5b4580||client;return _0x5661c8[_0xe389('0x1a')](_0x2672c0,_0x5a7df4)[_0xe389('0x1b')](function(_0x67a626){logger[_0xe389('0x1c')](_0xe389('0x1d'),_0x5487cb,_0xe389('0x1e'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x5487cb,_0xe389('0x1e'),JSON['stringify'](_0x67a626));if(_0x67a626['error']){if(_0x67a626['error'][_0xe389('0x1f')]===0x1f4){logger['error'](_0xe389('0x1d'),_0x5487cb,_0x67a626[_0xe389('0x20')][_0xe389('0x21')]);return _0x587d75(_0x67a626[_0xe389('0x20')][_0xe389('0x21')]);}logger['error'](_0xe389('0x1d'),_0x5487cb,_0x67a626['error'][_0xe389('0x21')]);return _0x389e29(_0x67a626['error'][_0xe389('0x21')]);}else{logger['info'](_0xe389('0x1d'),_0x5487cb,_0xe389('0x1e'));_0x389e29(_0x67a626[_0xe389('0x22')][_0xe389('0x21')]);}})[_0xe389('0x23')](function(_0x4cc220){logger[_0xe389('0x20')]('Network,\x20%s,\x20%s',_0x5487cb,_0x4cc220);_0x587d75(_0x4cc220);});});}function respondWithStatusCode(_0x38d9d5,_0x462a71){_0x462a71=_0x462a71||0xcc;return function(_0x2a39aa){if(_0x2a39aa){return _0x38d9d5[_0xe389('0x24')](_0x462a71);}return _0x38d9d5[_0xe389('0x25')](_0x462a71)[_0xe389('0x26')]();};}function respondWithResult(_0x38d311,_0xe2465f){_0xe2465f=_0xe2465f||0xc8;return function(_0x566016){if(_0x566016){return _0x38d311[_0xe389('0x25')](_0xe2465f)[_0xe389('0x27')](_0x566016);}};}function respondWithFilteredResult(_0x2f9512,_0x100f12){return function(_0x5a9ce1){if(_0x5a9ce1){var _0x31571a=typeof _0x100f12['offset']===_0xe389('0x28')&&typeof _0x100f12['limit']==='undefined';var _0x20a9cc=_0x5a9ce1[_0xe389('0x29')];var _0x50dbef=_0x31571a?0x0:_0x100f12['offset'];var _0x367043=_0x31571a?_0x5a9ce1[_0xe389('0x29')]:_0x100f12[_0xe389('0x2a')]+_0x100f12['limit'];var _0x5bf7b2;if(_0x367043>=_0x20a9cc){_0x367043=_0x20a9cc;_0x5bf7b2=0xc8;}else{_0x5bf7b2=0xce;}_0x2f9512['status'](_0x5bf7b2);return _0x2f9512['set'](_0xe389('0x2b'),_0x50dbef+'-'+_0x367043+'/'+_0x20a9cc)['json'](_0x5a9ce1);}return null;};}function patchUpdates(_0x2906a0){return function(_0x47e669){try{jsonpatch[_0xe389('0x2c')](_0x47e669,_0x2906a0,!![]);}catch(_0x266fa0){return BPromise[_0xe389('0x2d')](_0x266fa0);}return _0x47e669[_0xe389('0x2e')]();};}function saveUpdates(_0x40d90a,_0x391563){return function(_0x137edf){if(_0x137edf){return _0x137edf[_0xe389('0x2f')](_0x40d90a)['then'](function(_0xac88bf){return _0xac88bf;});}return null;};}function removeEntity(_0x278ee3,_0x10a229){return function(_0x520300){if(_0x520300){return _0x520300['destroy']()[_0xe389('0x1b')](function(){_0x278ee3[_0xe389('0x25')](0xcc)[_0xe389('0x26')]();});}};}function handleEntityNotFound(_0x375e63,_0x26d920){return function(_0x266624){if(!_0x266624){_0x375e63['sendStatus'](0x194);}return _0x266624;};}function handleError(_0x3dbba7,_0x273ad8){_0x273ad8=_0x273ad8||0x1f4;return function(_0x44c469){logger[_0xe389('0x20')](_0x44c469[_0xe389('0x30')]);if(_0x44c469[_0xe389('0x31')]){delete _0x44c469[_0xe389('0x31')];}_0x3dbba7[_0xe389('0x25')](_0x273ad8)[_0xe389('0x32')](_0x44c469);};}exports[_0xe389('0x33')]=function(_0x295090,_0x57aa95){var _0x3995e8={},_0x13a496={},_0x29e766={'count':0x0,'rows':[]};var _0x310a05=_[_0xe389('0x34')](db['Network'][_0xe389('0x35')],function(_0x326798){return{'name':_0x326798['fieldName'],'type':_0x326798['type'][_0xe389('0x36')]};});_0x13a496[_0xe389('0x37')]=_[_0xe389('0x34')](_0x310a05,_0xe389('0x31'));_0x13a496[_0xe389('0x38')]=_[_0xe389('0x39')](_0x295090[_0xe389('0x38')]);_0x13a496[_0xe389('0x3a')]=_[_0xe389('0x3b')](_0x13a496[_0xe389('0x37')],_0x13a496[_0xe389('0x38')]);_0x3995e8[_0xe389('0x3c')]=_[_0xe389('0x3b')](_0x13a496['model'],qs['fields'](_0x295090['query'][_0xe389('0x3d')]));_0x3995e8['attributes']=_0x3995e8[_0xe389('0x3c')][_0xe389('0x3e')]?_0x3995e8[_0xe389('0x3c')]:_0x13a496[_0xe389('0x37')];if(!_0x295090[_0xe389('0x38')]['hasOwnProperty'](_0xe389('0x3f'))){_0x3995e8[_0xe389('0x40')]=qs[_0xe389('0x40')](_0x295090[_0xe389('0x38')][_0xe389('0x40')]);_0x3995e8[_0xe389('0x2a')]=qs[_0xe389('0x2a')](_0x295090[_0xe389('0x38')][_0xe389('0x2a')]);}_0x3995e8[_0xe389('0x41')]=qs[_0xe389('0x42')](_0x295090['query'][_0xe389('0x42')]);_0x3995e8['where']=qs[_0xe389('0x3a')](_[_0xe389('0x43')](_0x295090[_0xe389('0x38')],_0x13a496[_0xe389('0x3a')]),_0x310a05);if(_0x295090[_0xe389('0x38')][_0xe389('0x44')]){_0x3995e8[_0xe389('0x45')]=_['merge'](_0x3995e8[_0xe389('0x45')],{'$or':_[_0xe389('0x34')](_0x310a05,function(_0x4c7073){if(_0x4c7073[_0xe389('0x46')]!==_0xe389('0x47')){var _0xd1e819={};_0xd1e819[_0x4c7073[_0xe389('0x31')]]={'$like':'%'+_0x295090['query'][_0xe389('0x44')]+'%'};return _0xd1e819;}})});}_0x3995e8=_[_0xe389('0x48')]({},_0x3995e8,_0x295090[_0xe389('0x49')]);var _0x5d5335={'where':_0x3995e8['where']};return db[_0xe389('0x4a')][_0xe389('0x29')](_0x5d5335)[_0xe389('0x1b')](function(_0x29f0ea){_0x29e766['count']=_0x29f0ea;if(_0x295090[_0xe389('0x38')]['includeAll']){_0x3995e8[_0xe389('0x4b')]=[{'all':!![]}];}return db[_0xe389('0x4a')][_0xe389('0x4c')](_0x3995e8);})['then'](function(_0x19cd99){_0x29e766[_0xe389('0x4d')]=_0x19cd99;return _0x29e766;})[_0xe389('0x1b')](respondWithFilteredResult(_0x57aa95,_0x3995e8))['catch'](handleError(_0x57aa95,null));};exports['show']=function(_0x14026f,_0x19cebf){var _0x2ee5b3={'raw':!![],'where':{'id':_0x14026f[_0xe389('0x4e')]['id']}},_0xbcf9ef={};_0xbcf9ef['model']=_['keys'](db[_0xe389('0x4a')][_0xe389('0x35')]);_0xbcf9ef[_0xe389('0x38')]=_[_0xe389('0x39')](_0x14026f['query']);_0xbcf9ef['filters']=_[_0xe389('0x3b')](_0xbcf9ef['model'],_0xbcf9ef[_0xe389('0x38')]);_0x2ee5b3[_0xe389('0x3c')]=_['intersection'](_0xbcf9ef[_0xe389('0x37')],qs[_0xe389('0x3d')](_0x14026f[_0xe389('0x38')][_0xe389('0x3d')]));_0x2ee5b3[_0xe389('0x3c')]=_0x2ee5b3[_0xe389('0x3c')][_0xe389('0x3e')]?_0x2ee5b3[_0xe389('0x3c')]:_0xbcf9ef[_0xe389('0x37')];if(_0x14026f[_0xe389('0x38')][_0xe389('0x4f')]){_0x2ee5b3[_0xe389('0x4b')]=[{'all':!![]}];}_0x2ee5b3=_['merge']({},_0x2ee5b3,_0x14026f['options']);return db[_0xe389('0x4a')][_0xe389('0x50')](_0x2ee5b3)[_0xe389('0x1b')](handleEntityNotFound(_0x19cebf,null))['then'](respondWithResult(_0x19cebf,null))[_0xe389('0x23')](handleError(_0x19cebf,null));};exports[_0xe389('0x51')]=function(_0x4e56e8,_0x3d5fb5,_0x419ffd){var _0x3525a7;return db[_0xe389('0x52')][_0xe389('0x53')](function(_0x48a629){return db[_0xe389('0x4a')][_0xe389('0x51')](_0x4e56e8['body'],{'raw':!![]})['then'](function(_0x501341){_0x3525a7=_0x501341;return db[_0xe389('0x4a')]['findAll']({'where':{'type':_0x4e56e8[_0xe389('0x54')]['type']},'raw':!![]});})[_0xe389('0x1b')](function(_0x438439){if(_0x3525a7['type'][_0xe389('0x55')]()==_0xe389('0x56')){var _0x107940=fs[_0xe389('0x57')](path[_0xe389('0x58')](config[_0xe389('0x59')],_0xe389('0x5a')),'utf8');var _0x3262ab=ejs[_0xe389('0x5b')](_0x107940,{'networks':_0x438439||[]});fs[_0xe389('0x5c')](_0xe389('0x5d'),_0x3262ab);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x51'),{'module':'res_stun_monitor.so'});}else if(_0x3525a7[_0xe389('0x46')][_0xe389('0x55')]()==_0xe389('0x5f')){var _0x3077f9=fs[_0xe389('0x57')](path['join'](config[_0xe389('0x59')],'server/files/templates/turn_multiple.ejs'),_0xe389('0x60'));var _0x48f4cd=ejs[_0xe389('0x5b')](_0x3077f9,{'networks':_0x438439||[]});fs['writeFileSync'](_0xe389('0x61'),_0x48f4cd);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x51'),{'module':_0xe389('0x62')});}else{var _0x2f659f=fs[_0xe389('0x57')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xe389('0x60'));var _0x34dec8=ejs['render'](_0x2f659f,{'networks':_0x438439||[]});fs[_0xe389('0x5c')](util[_0xe389('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x4e56e8[_0xe389('0x54')]['type'][_0xe389('0x64')]()),_0x34dec8);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x51'),{'module':'chan_sip.so'});}return null;})[_0xe389('0x1b')](function(){return _0x3525a7;});})['then'](respondWithResult(_0x3d5fb5,0xc9))[_0xe389('0x23')](handleError(_0x3d5fb5,null));};exports[_0xe389('0x2f')]=function(_0x4c1302,_0x5b6142,_0x1bace4){var _0x3cb9cf;return db['sequelize'][_0xe389('0x53')](function(_0xea942b){return db[_0xe389('0x4a')][_0xe389('0x50')]({'where':{'id':_0x4c1302[_0xe389('0x4e')]['id']}})[_0xe389('0x1b')](handleEntityNotFound(_0x5b6142,null))['then'](saveUpdates(_0x4c1302[_0xe389('0x54')],null))[_0xe389('0x1b')](function(_0x11fec9){if(_0x11fec9){_0x3cb9cf=_0x11fec9;return db[_0xe389('0x4a')][_0xe389('0x4c')]({'where':{'type':_0x3cb9cf[_0xe389('0x46')]},'raw':!![]});}return null;})['then'](function(_0x3fdc55){if(_0x3cb9cf[_0xe389('0x46')][_0xe389('0x55')]()=='STUN'){var _0x28eb9a=fs[_0xe389('0x57')](path[_0xe389('0x58')](config['root'],_0xe389('0x5a')),_0xe389('0x60'));var _0x4dcd0b=ejs[_0xe389('0x5b')](_0x28eb9a,{'networks':_0x3fdc55||[]});fs[_0xe389('0x5c')](_0xe389('0x5d'),_0x4dcd0b);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x2f'),{'module':_0xe389('0x62')});}else if(_0x3cb9cf[_0xe389('0x46')][_0xe389('0x55')]()=='TURN'){var _0x2b7e56=fs[_0xe389('0x57')](path[_0xe389('0x58')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xe389('0x60'));var _0x1b19c9=ejs[_0xe389('0x5b')](_0x2b7e56,{'networks':_0x3fdc55||[]});fs[_0xe389('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x1b19c9);return respondWithRpcPromise('Reload',_0xe389('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x4e3ae8=fs[_0xe389('0x57')](path[_0xe389('0x58')](config['root'],_0xe389('0x65')),_0xe389('0x60'));var _0x4c262c=ejs['render'](_0x4e3ae8,{'networks':_0x3fdc55||[]});fs['writeFileSync'](util[_0xe389('0x63')](_0xe389('0x66'),_0x4c1302[_0xe389('0x54')][_0xe389('0x46')][_0xe389('0x64')]()),_0x4c262c);return respondWithRpcPromise('Reload',_0xe389('0x2f'),{'module':_0xe389('0x67')});}return null;})[_0xe389('0x1b')](function(_0x3f9acb){if(_0x3f9acb){return _0x3cb9cf;}return null;});})[_0xe389('0x1b')](respondWithResult(_0x5b6142,null))[_0xe389('0x23')](handleError(_0x5b6142,null));};exports[_0xe389('0x68')]=function(_0x138363,_0x5955ee,_0x57d6ec){var _0xf56aa9;return db[_0xe389('0x4a')][_0xe389('0x50')]({'where':{'id':_0x138363[_0xe389('0x4e')]['id']}})[_0xe389('0x1b')](function(_0x5eaa25){_0xf56aa9=_0x5eaa25;return _0x5eaa25;})[_0xe389('0x1b')](handleEntityNotFound(_0x5955ee,null))[_0xe389('0x1b')](removeEntity(_0x5955ee,null))[_0xe389('0x1b')](function(){if(_0xf56aa9){return db['Network'][_0xe389('0x4c')]({'where':{'type':_0xf56aa9['type']},'raw':!![]});}})[_0xe389('0x1b')](function(_0x409407){if(_0xf56aa9[_0xe389('0x46')][_0xe389('0x55')]()==_0xe389('0x56')){var _0x731f30=fs[_0xe389('0x57')](path[_0xe389('0x58')](config[_0xe389('0x59')],_0xe389('0x5a')),_0xe389('0x60'));var _0x17e844=ejs['render'](_0x731f30,{'networks':_0x409407||[]});fs['writeFileSync'](_0xe389('0x5d'),_0x17e844);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x68'),{'module':_0xe389('0x62')});}else if(_0xf56aa9['type']['toUpperCase']()==_0xe389('0x5f')){var _0x28209f=fs['readFileSync'](path[_0xe389('0x58')](config['root'],_0xe389('0x69')),_0xe389('0x60'));var _0x4d916d=ejs[_0xe389('0x5b')](_0x28209f,{'networks':_0x409407||[]});fs[_0xe389('0x5c')](_0xe389('0x61'),_0x4d916d);return respondWithRpcPromise(_0xe389('0x5e'),'destroy',{'module':_0xe389('0x62')});}else{var _0x234f10=fs['readFileSync'](path[_0xe389('0x58')](config[_0xe389('0x59')],_0xe389('0x65')),'utf8');var _0x4e0db7=ejs['render'](_0x234f10,{'networks':_0x409407||[]});fs['writeFileSync'](util[_0xe389('0x63')](_0xe389('0x66'),_0x138363[_0xe389('0x54')]['type'][_0xe389('0x64')]()),_0x4e0db7);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x68'),{'module':'chan_sip.so'});}return null;})[_0xe389('0x23')](handleError(_0x5955ee,null));}; \ No newline at end of file +var _0xa120=['attributes','fields','hasOwnProperty','sort','pick','filters','filter','where','merge','includeAll','include','findAll','rows','show','params','rawAttributes','length','options','find','create','sequelize','transaction','body','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','format','/etc/asterisk/sip_xcally_%s.conf','catch','toUpperCase','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','chan_sip.so','destroy','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','index','map','Network','fieldName','type','key','model','name','keys','query','intersection'];(function(_0x494854,_0x3f981e){var _0x5edaaa=function(_0x13675b){while(--_0x13675b){_0x494854['push'](_0x494854['shift']());}};_0x5edaaa(++_0x3f981e);}(_0xa120,0x168));var _0x0a12=function(_0xcdb976,_0x346721){_0xcdb976=_0xcdb976-0x0;var _0x4d4c74=_0xa120[_0xcdb976];return _0x4d4c74;};'use strict';var emlformat=require(_0x0a12('0x0'));var rimraf=require(_0x0a12('0x1'));var zipdir=require(_0x0a12('0x2'));var jsonpatch=require(_0x0a12('0x3'));var rp=require(_0x0a12('0x4'));var moment=require(_0x0a12('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0a12('0x6'));var util=require(_0x0a12('0x7'));var path=require(_0x0a12('0x8'));var sox=require('sox');var csv=require(_0x0a12('0x9'));var ejs=require(_0x0a12('0xa'));var fs=require('fs');var fs_extra=require(_0x0a12('0xb'));var _=require(_0x0a12('0xc'));var squel=require(_0x0a12('0xd'));var crypto=require(_0x0a12('0xe'));var jsforce=require(_0x0a12('0xf'));var deskjs=require(_0x0a12('0x10'));var toCsv=require(_0x0a12('0x9'));var querystring=require(_0x0a12('0x11'));var Papa=require(_0x0a12('0x12'));var Redis=require(_0x0a12('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0a12('0x14'));var as=require(_0x0a12('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a12('0x16'))(_0x0a12('0x17'));var utils=require('../../config/utils');var config=require(_0x0a12('0x18'));var licenseUtil=require(_0x0a12('0x19'));var db=require(_0x0a12('0x1a'))['db'];var jayson=require(_0x0a12('0x1b'));var client=jayson['client'][_0x0a12('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x262d37,_0x40499f,_0x261234,_0xdc75a4){return new BPromise(function(_0x394040,_0xc5ef8c){var _0x5f45e9=_0xdc75a4||client;return _0x5f45e9['request'](_0x262d37,_0x261234)[_0x0a12('0x1d')](function(_0xb3df89){logger[_0x0a12('0x1e')](_0x0a12('0x1f'),_0x40499f,_0x0a12('0x20'));logger['debug'](_0x0a12('0x21'),_0x40499f,_0x0a12('0x20'),JSON['stringify'](_0xb3df89));if(_0xb3df89[_0x0a12('0x22')]){if(_0xb3df89[_0x0a12('0x22')]['code']===0x1f4){logger[_0x0a12('0x22')](_0x0a12('0x1f'),_0x40499f,_0xb3df89['error'][_0x0a12('0x23')]);return _0xc5ef8c(_0xb3df89[_0x0a12('0x22')]['message']);}logger[_0x0a12('0x22')](_0x0a12('0x1f'),_0x40499f,_0xb3df89[_0x0a12('0x22')][_0x0a12('0x23')]);return _0x394040(_0xb3df89[_0x0a12('0x22')][_0x0a12('0x23')]);}else{logger[_0x0a12('0x1e')](_0x0a12('0x1f'),_0x40499f,'request\x20sent');_0x394040(_0xb3df89[_0x0a12('0x24')][_0x0a12('0x23')]);}})['catch'](function(_0xfcf907){logger[_0x0a12('0x22')](_0x0a12('0x1f'),_0x40499f,_0xfcf907);_0xc5ef8c(_0xfcf907);});});}function respondWithStatusCode(_0x116295,_0x9c8d77){_0x9c8d77=_0x9c8d77||0xcc;return function(_0x2e16d9){if(_0x2e16d9){return _0x116295[_0x0a12('0x25')](_0x9c8d77);}return _0x116295[_0x0a12('0x26')](_0x9c8d77)[_0x0a12('0x27')]();};}function respondWithResult(_0x5da5f2,_0x5472f3){_0x5472f3=_0x5472f3||0xc8;return function(_0x3c9f3d){if(_0x3c9f3d){return _0x5da5f2['status'](_0x5472f3)[_0x0a12('0x28')](_0x3c9f3d);}};}function respondWithFilteredResult(_0x295d3e,_0x14f6ae){return function(_0x11f74e){if(_0x11f74e){var _0x5cc48d=typeof _0x14f6ae[_0x0a12('0x29')]===_0x0a12('0x2a')&&typeof _0x14f6ae[_0x0a12('0x2b')]==='undefined';var _0x2f48f5=_0x11f74e[_0x0a12('0x2c')];var _0x18af7a=_0x5cc48d?0x0:_0x14f6ae[_0x0a12('0x29')];var _0x59d111=_0x5cc48d?_0x11f74e[_0x0a12('0x2c')]:_0x14f6ae[_0x0a12('0x29')]+_0x14f6ae['limit'];var _0x537545;if(_0x59d111>=_0x2f48f5){_0x59d111=_0x2f48f5;_0x537545=0xc8;}else{_0x537545=0xce;}_0x295d3e['status'](_0x537545);return _0x295d3e[_0x0a12('0x2d')]('Content-Range',_0x18af7a+'-'+_0x59d111+'/'+_0x2f48f5)['json'](_0x11f74e);}return null;};}function patchUpdates(_0x3f14b5){return function(_0x59d99d){try{jsonpatch[_0x0a12('0x2e')](_0x59d99d,_0x3f14b5,!![]);}catch(_0x14d1eb){return BPromise['reject'](_0x14d1eb);}return _0x59d99d[_0x0a12('0x2f')]();};}function saveUpdates(_0x25093a,_0x2b37c5){return function(_0x4255df){if(_0x4255df){return _0x4255df[_0x0a12('0x30')](_0x25093a)[_0x0a12('0x1d')](function(_0x297920){return _0x297920;});}return null;};}function removeEntity(_0xc0d90a,_0x3f5b85){return function(_0x10cc82){if(_0x10cc82){return _0x10cc82['destroy']()[_0x0a12('0x1d')](function(){_0xc0d90a[_0x0a12('0x26')](0xcc)[_0x0a12('0x27')]();});}};}function handleEntityNotFound(_0x237810,_0x17a8ea){return function(_0x271433){if(!_0x271433){_0x237810['sendStatus'](0x194);}return _0x271433;};}function handleError(_0x3b1e67,_0x1b598e){_0x1b598e=_0x1b598e||0x1f4;return function(_0x4b57fd){logger['error'](_0x4b57fd['stack']);if(_0x4b57fd['name']){delete _0x4b57fd['name'];}_0x3b1e67[_0x0a12('0x26')](_0x1b598e)['send'](_0x4b57fd);};}exports[_0x0a12('0x31')]=function(_0x493ed4,_0x3cb241){var _0x3704d0={},_0x4b15d2={},_0x2e833d={'count':0x0,'rows':[]};var _0x6ef7b4=_[_0x0a12('0x32')](db[_0x0a12('0x33')]['rawAttributes'],function(_0x305b77){return{'name':_0x305b77[_0x0a12('0x34')],'type':_0x305b77[_0x0a12('0x35')][_0x0a12('0x36')]};});_0x4b15d2[_0x0a12('0x37')]=_['map'](_0x6ef7b4,_0x0a12('0x38'));_0x4b15d2['query']=_[_0x0a12('0x39')](_0x493ed4[_0x0a12('0x3a')]);_0x4b15d2['filters']=_[_0x0a12('0x3b')](_0x4b15d2[_0x0a12('0x37')],_0x4b15d2[_0x0a12('0x3a')]);_0x3704d0[_0x0a12('0x3c')]=_['intersection'](_0x4b15d2[_0x0a12('0x37')],qs[_0x0a12('0x3d')](_0x493ed4[_0x0a12('0x3a')][_0x0a12('0x3d')]));_0x3704d0[_0x0a12('0x3c')]=_0x3704d0[_0x0a12('0x3c')]['length']?_0x3704d0[_0x0a12('0x3c')]:_0x4b15d2[_0x0a12('0x37')];if(!_0x493ed4[_0x0a12('0x3a')][_0x0a12('0x3e')]('nolimit')){_0x3704d0[_0x0a12('0x2b')]=qs['limit'](_0x493ed4[_0x0a12('0x3a')][_0x0a12('0x2b')]);_0x3704d0[_0x0a12('0x29')]=qs[_0x0a12('0x29')](_0x493ed4[_0x0a12('0x3a')][_0x0a12('0x29')]);}_0x3704d0['order']=qs['sort'](_0x493ed4[_0x0a12('0x3a')][_0x0a12('0x3f')]);_0x3704d0['where']=qs['filters'](_[_0x0a12('0x40')](_0x493ed4[_0x0a12('0x3a')],_0x4b15d2[_0x0a12('0x41')]),_0x6ef7b4);if(_0x493ed4[_0x0a12('0x3a')][_0x0a12('0x42')]){_0x3704d0[_0x0a12('0x43')]=_[_0x0a12('0x44')](_0x3704d0[_0x0a12('0x43')],{'$or':_[_0x0a12('0x32')](_0x6ef7b4,function(_0x48e4f4){if(_0x48e4f4[_0x0a12('0x35')]!=='VIRTUAL'){var _0x394363={};_0x394363[_0x48e4f4[_0x0a12('0x38')]]={'$like':'%'+_0x493ed4['query'][_0x0a12('0x42')]+'%'};return _0x394363;}})});}_0x3704d0=_[_0x0a12('0x44')]({},_0x3704d0,_0x493ed4['options']);var _0x270b79={'where':_0x3704d0[_0x0a12('0x43')]};return db[_0x0a12('0x33')][_0x0a12('0x2c')](_0x270b79)[_0x0a12('0x1d')](function(_0x581f3b){_0x2e833d['count']=_0x581f3b;if(_0x493ed4[_0x0a12('0x3a')][_0x0a12('0x45')]){_0x3704d0[_0x0a12('0x46')]=[{'all':!![]}];}return db[_0x0a12('0x33')][_0x0a12('0x47')](_0x3704d0);})[_0x0a12('0x1d')](function(_0x18db1e){_0x2e833d[_0x0a12('0x48')]=_0x18db1e;return _0x2e833d;})[_0x0a12('0x1d')](respondWithFilteredResult(_0x3cb241,_0x3704d0))['catch'](handleError(_0x3cb241,null));};exports[_0x0a12('0x49')]=function(_0x474656,_0x223aef){var _0x40fa58={'raw':!![],'where':{'id':_0x474656[_0x0a12('0x4a')]['id']}},_0xd21d35={};_0xd21d35[_0x0a12('0x37')]=_[_0x0a12('0x39')](db[_0x0a12('0x33')][_0x0a12('0x4b')]);_0xd21d35['query']=_[_0x0a12('0x39')](_0x474656[_0x0a12('0x3a')]);_0xd21d35[_0x0a12('0x41')]=_['intersection'](_0xd21d35['model'],_0xd21d35[_0x0a12('0x3a')]);_0x40fa58[_0x0a12('0x3c')]=_['intersection'](_0xd21d35[_0x0a12('0x37')],qs[_0x0a12('0x3d')](_0x474656[_0x0a12('0x3a')][_0x0a12('0x3d')]));_0x40fa58[_0x0a12('0x3c')]=_0x40fa58['attributes'][_0x0a12('0x4c')]?_0x40fa58[_0x0a12('0x3c')]:_0xd21d35[_0x0a12('0x37')];if(_0x474656[_0x0a12('0x3a')]['includeAll']){_0x40fa58[_0x0a12('0x46')]=[{'all':!![]}];}_0x40fa58=_[_0x0a12('0x44')]({},_0x40fa58,_0x474656[_0x0a12('0x4d')]);return db[_0x0a12('0x33')][_0x0a12('0x4e')](_0x40fa58)[_0x0a12('0x1d')](handleEntityNotFound(_0x223aef,null))[_0x0a12('0x1d')](respondWithResult(_0x223aef,null))['catch'](handleError(_0x223aef,null));};exports[_0x0a12('0x4f')]=function(_0xa27a40,_0x4437ad,_0x5673f5){var _0x1d8a95;return db[_0x0a12('0x50')][_0x0a12('0x51')](function(_0x45af41){return db['Network'][_0x0a12('0x4f')](_0xa27a40[_0x0a12('0x52')],{'raw':!![]})[_0x0a12('0x1d')](function(_0x446885){_0x1d8a95=_0x446885;return db[_0x0a12('0x33')][_0x0a12('0x47')]({'where':{'type':_0xa27a40[_0x0a12('0x52')][_0x0a12('0x35')]},'raw':!![]});})[_0x0a12('0x1d')](function(_0x1629e4){if(_0x1d8a95['type']['toUpperCase']()==_0x0a12('0x53')){var _0x43a940=fs[_0x0a12('0x54')](path[_0x0a12('0x55')](config['root'],_0x0a12('0x56')),_0x0a12('0x57'));var _0x57aa56=ejs[_0x0a12('0x58')](_0x43a940,{'networks':_0x1629e4||[]});fs[_0x0a12('0x59')](_0x0a12('0x5a'),_0x57aa56);return respondWithRpcPromise(_0x0a12('0x5b'),_0x0a12('0x4f'),{'module':_0x0a12('0x5c')});}else if(_0x1d8a95[_0x0a12('0x35')]['toUpperCase']()=='TURN'){var _0x3a5ddb=fs[_0x0a12('0x54')](path[_0x0a12('0x55')](config[_0x0a12('0x5d')],_0x0a12('0x5e')),_0x0a12('0x57'));var _0x263d13=ejs[_0x0a12('0x58')](_0x3a5ddb,{'networks':_0x1629e4||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x263d13);return respondWithRpcPromise('Reload',_0x0a12('0x4f'),{'module':_0x0a12('0x5c')});}else{var _0x36c843=fs[_0x0a12('0x54')](path[_0x0a12('0x55')](config[_0x0a12('0x5d')],'server/files/templates/network.ejs'),_0x0a12('0x57'));var _0x4f63e1=ejs[_0x0a12('0x58')](_0x36c843,{'networks':_0x1629e4||[]});fs['writeFileSync'](util[_0x0a12('0x5f')](_0x0a12('0x60'),_0xa27a40[_0x0a12('0x52')]['type']['toLowerCase']()),_0x4f63e1);return respondWithRpcPromise('Reload',_0x0a12('0x4f'),{'module':'chan_sip.so'});}return null;})[_0x0a12('0x1d')](function(){return _0x1d8a95;});})[_0x0a12('0x1d')](respondWithResult(_0x4437ad,0xc9))[_0x0a12('0x61')](handleError(_0x4437ad,null));};exports[_0x0a12('0x30')]=function(_0x30f20b,_0x31bf44,_0x40c0a7){var _0x1d32c3;return db[_0x0a12('0x50')][_0x0a12('0x51')](function(_0x233686){return db[_0x0a12('0x33')][_0x0a12('0x4e')]({'where':{'id':_0x30f20b['params']['id']}})['then'](handleEntityNotFound(_0x31bf44,null))[_0x0a12('0x1d')](saveUpdates(_0x30f20b[_0x0a12('0x52')],null))[_0x0a12('0x1d')](function(_0x49c3ef){if(_0x49c3ef){_0x1d32c3=_0x49c3ef;return db[_0x0a12('0x33')]['findAll']({'where':{'type':_0x1d32c3[_0x0a12('0x35')]},'raw':!![]});}return null;})[_0x0a12('0x1d')](function(_0x41c773){if(_0x1d32c3['type'][_0x0a12('0x62')]()=='STUN'){var _0x599208=fs[_0x0a12('0x54')](path[_0x0a12('0x55')](config[_0x0a12('0x5d')],_0x0a12('0x56')),'utf8');var _0x352269=ejs['render'](_0x599208,{'networks':_0x41c773||[]});fs[_0x0a12('0x59')](_0x0a12('0x5a'),_0x352269);return respondWithRpcPromise(_0x0a12('0x5b'),_0x0a12('0x30'),{'module':_0x0a12('0x5c')});}else if(_0x1d32c3['type'][_0x0a12('0x62')]()==_0x0a12('0x63')){var _0x4a08fd=fs[_0x0a12('0x54')](path[_0x0a12('0x55')](config[_0x0a12('0x5d')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x281bd2=ejs[_0x0a12('0x58')](_0x4a08fd,{'networks':_0x41c773||[]});fs['writeFileSync'](_0x0a12('0x64'),_0x281bd2);return respondWithRpcPromise(_0x0a12('0x5b'),_0x0a12('0x30'),{'module':_0x0a12('0x5c')});}else{var _0x36dbd4=fs[_0x0a12('0x54')](path[_0x0a12('0x55')](config[_0x0a12('0x5d')],_0x0a12('0x65')),_0x0a12('0x57'));var _0x613309=ejs[_0x0a12('0x58')](_0x36dbd4,{'networks':_0x41c773||[]});fs[_0x0a12('0x59')](util[_0x0a12('0x5f')](_0x0a12('0x60'),_0x30f20b[_0x0a12('0x52')]['type']['toLowerCase']()),_0x613309);return respondWithRpcPromise(_0x0a12('0x5b'),_0x0a12('0x30'),{'module':_0x0a12('0x66')});}return null;})['then'](function(_0x25fb6a){if(_0x25fb6a){return _0x1d32c3;}return null;});})[_0x0a12('0x1d')](respondWithResult(_0x31bf44,null))['catch'](handleError(_0x31bf44,null));};exports[_0x0a12('0x67')]=function(_0x264514,_0x5a0b94,_0x3251d6){var _0x7707a0;return db['Network'][_0x0a12('0x4e')]({'where':{'id':_0x264514[_0x0a12('0x4a')]['id']}})[_0x0a12('0x1d')](function(_0x3c02ef){_0x7707a0=_0x3c02ef;return _0x3c02ef;})[_0x0a12('0x1d')](handleEntityNotFound(_0x5a0b94,null))[_0x0a12('0x1d')](removeEntity(_0x5a0b94,null))[_0x0a12('0x1d')](function(){if(_0x7707a0){return db[_0x0a12('0x33')][_0x0a12('0x47')]({'where':{'type':_0x7707a0[_0x0a12('0x35')]},'raw':!![]});}})[_0x0a12('0x1d')](function(_0x3fe637){if(_0x7707a0['type']['toUpperCase']()==_0x0a12('0x53')){var _0x173030=fs[_0x0a12('0x54')](path[_0x0a12('0x55')](config[_0x0a12('0x5d')],_0x0a12('0x56')),_0x0a12('0x57'));var _0xf7d03b=ejs[_0x0a12('0x58')](_0x173030,{'networks':_0x3fe637||[]});fs[_0x0a12('0x59')](_0x0a12('0x5a'),_0xf7d03b);return respondWithRpcPromise(_0x0a12('0x5b'),_0x0a12('0x67'),{'module':'res_stun_monitor.so'});}else if(_0x7707a0[_0x0a12('0x35')][_0x0a12('0x62')]()=='TURN'){var _0x41a88c=fs[_0x0a12('0x54')](path[_0x0a12('0x55')](config[_0x0a12('0x5d')],_0x0a12('0x5e')),'utf8');var _0x503c2b=ejs[_0x0a12('0x58')](_0x41a88c,{'networks':_0x3fe637||[]});fs['writeFileSync'](_0x0a12('0x64'),_0x503c2b);return respondWithRpcPromise(_0x0a12('0x5b'),_0x0a12('0x67'),{'module':_0x0a12('0x5c')});}else{var _0x3955a5=fs[_0x0a12('0x54')](path[_0x0a12('0x55')](config['root'],_0x0a12('0x65')),'utf8');var _0x3d6a6f=ejs[_0x0a12('0x58')](_0x3955a5,{'networks':_0x3fe637||[]});fs[_0x0a12('0x59')](util['format'](_0x0a12('0x60'),_0x264514[_0x0a12('0x52')][_0x0a12('0x35')][_0x0a12('0x68')]()),_0x3d6a6f);return respondWithRpcPromise('Reload',_0x0a12('0x67'),{'module':_0x0a12('0x66')});}return null;})['catch'](handleError(_0x5a0b94,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e5c2a53..48c16d9 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 _0xeffd=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','../../config/logger','api','moment','bluebird'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xeffd,0x6b));var _0xdeff=function(_0xcf42b6,_0x567c7f){_0xcf42b6=_0xcf42b6-0x0;var _0x546b5c=_0xeffd[_0xcf42b6];return _0x546b5c;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var logger=require(_0xdeff('0x1'))(_0xdeff('0x2'));var moment=require(_0xdeff('0x3'));var BPromise=require(_0xdeff('0x4'));var rp=require(_0xdeff('0x5'));var fs=require('fs');var path=require(_0xdeff('0x6'));var rimraf=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var attributes=require(_0xdeff('0x9'));module[_0xdeff('0xa')]=function(_0x1ed641,_0x132631){return _0x1ed641[_0xdeff('0xb')](_0xdeff('0xc'),attributes,{'tableName':_0xdeff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7af2=['../../config/environment','./network.attributes','exports','define','network','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x34f344,_0x337801){var _0x4e4e4f=function(_0x436f0c){while(--_0x436f0c){_0x34f344['push'](_0x34f344['shift']());}};_0x4e4e4f(++_0x337801);}(_0x7af2,0x119));var _0x27af=function(_0x45c19c,_0x5e8b36){_0x45c19c=_0x45c19c-0x0;var _0x5b1142=_0x7af2[_0x45c19c];return _0x5b1142;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var logger=require(_0x27af('0x1'))(_0x27af('0x2'));var moment=require(_0x27af('0x3'));var BPromise=require('bluebird');var rp=require(_0x27af('0x4'));var fs=require('fs');var path=require(_0x27af('0x5'));var rimraf=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var attributes=require(_0x27af('0x8'));module[_0x27af('0x9')]=function(_0x350532,_0x184630){return _0x350532[_0x27af('0xa')]('Network',attributes,{'tableName':_0x27af('0xb'),'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 8296b42..7c37aaa 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4f170f,_0x9d40fd){var _0x5cb738=function(_0x19b08c){while(--_0x19b08c){_0x4f170f['push'](_0x4f170f['shift']());}};_0x5cb738(++_0x9d40fd);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x12ce41,_0x2e3dff){_0x12ce41=_0x12ce41-0x0;var _0x1a43e9=_0x7a54[_0x12ce41];return _0x1a43e9;};'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 9f8d3e3..7b55349 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 _0xa331=['destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','send','update'];(function(_0x519ed8,_0x5c9e9e){var _0x4f174e=function(_0xa58da6){while(--_0xa58da6){_0x519ed8['push'](_0x519ed8['shift']());}};_0x4f174e(++_0x5c9e9e);}(_0xa331,0x13e));var _0x1a33=function(_0x5d8b12,_0x5799d4){_0x5d8b12=_0x5d8b12-0x0;var _0x4f08a0=_0xa331[_0x5d8b12];return _0x4f08a0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a33('0x0'));var timeout=require(_0x1a33('0x1'));var express=require(_0x1a33('0x2'));var router=express[_0x1a33('0x3')]();var fs_extra=require(_0x1a33('0x4'));var auth=require(_0x1a33('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a33('0x6'));var controller=require(_0x1a33('0x7'));router[_0x1a33('0x8')]('/',auth['isAuthenticated'](),controller[_0x1a33('0x9')]);router[_0x1a33('0x8')](_0x1a33('0xa'),auth['isAuthenticated'](),controller[_0x1a33('0xb')]);router['get'](_0x1a33('0xc'),auth[_0x1a33('0xd')](),controller[_0x1a33('0xe')]);router[_0x1a33('0x8')](_0x1a33('0xf'),auth['isAuthenticated'](),controller[_0x1a33('0x10')]);router[_0x1a33('0x8')](_0x1a33('0x11'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x12')]);router[_0x1a33('0x8')](_0x1a33('0x13'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x14')]);router[_0x1a33('0x8')](_0x1a33('0x15'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x16')]);router[_0x1a33('0x8')](_0x1a33('0x17'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x18')]);router[_0x1a33('0x19')]('/',auth[_0x1a33('0xd')](),controller[_0x1a33('0x1a')]);router[_0x1a33('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x1a33('0x19')](_0x1a33('0x11'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x1b')]);router['post'](_0x1a33('0x1c'),controller[_0x1a33('0x1d')]);router[_0x1a33('0x19')](_0x1a33('0x13'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x1e')]);router[_0x1a33('0x19')](_0x1a33('0x17'),auth[_0x1a33('0xd')](),controller['addAgents']);router[_0x1a33('0x19')]('/:id/send',auth[_0x1a33('0xd')](),controller[_0x1a33('0x1f')]);router['put'](_0x1a33('0xc'),auth['isAuthenticated'](),controller[_0x1a33('0x20')]);router['delete'](_0x1a33('0xc'),auth['isAuthenticated'](),controller[_0x1a33('0x21')]);router[_0x1a33('0x22')](_0x1a33('0xf'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x23')]);router[_0x1a33('0x22')](_0x1a33('0x11'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x24')]);router[_0x1a33('0x22')](_0x1a33('0x17'),auth['isAuthenticated'](),controller[_0x1a33('0x25')]);module[_0x1a33('0x26')]=router; \ No newline at end of file +var _0xae0a=['index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','send','put','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae0a,0x1d6));var _0xaae0=function(_0x33d9d7,_0x19a281){_0x33d9d7=_0x33d9d7-0x0;var _0x21aaef=_0xae0a[_0x33d9d7];return _0x21aaef;};'use strict';var multer=require(_0xaae0('0x0'));var util=require(_0xaae0('0x1'));var path=require('path');var timeout=require(_0xaae0('0x2'));var express=require(_0xaae0('0x3'));var router=express[_0xaae0('0x4')]();var fs_extra=require(_0xaae0('0x5'));var auth=require(_0xaae0('0x6'));var interaction=require(_0xaae0('0x7'));var config=require(_0xaae0('0x8'));var controller=require(_0xaae0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xaae0('0xa')]);router[_0xaae0('0xb')](_0xaae0('0xc'),auth[_0xaae0('0xd')](),controller[_0xaae0('0xe')]);router[_0xaae0('0xb')](_0xaae0('0xf'),auth['isAuthenticated'](),controller[_0xaae0('0x10')]);router[_0xaae0('0xb')](_0xaae0('0x11'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x12')]);router['get'](_0xaae0('0x13'),auth[_0xaae0('0xd')](),controller['getAnswers']);router[_0xaae0('0xb')]('/:id/applications',auth['isAuthenticated'](),controller[_0xaae0('0x14')]);router[_0xaae0('0xb')](_0xaae0('0x15'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x16')]);router[_0xaae0('0xb')](_0xaae0('0x17'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x18')]);router[_0xaae0('0x19')]('/',auth[_0xaae0('0xd')](),controller['create']);router['post'](_0xaae0('0x11'),auth['isAuthenticated'](),controller[_0xaae0('0x1a')]);router[_0xaae0('0x19')](_0xaae0('0x13'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x1b')]);router[_0xaae0('0x19')](_0xaae0('0x1c'),controller[_0xaae0('0x1d')]);router['post'](_0xaae0('0x1e'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x1f')]);router[_0xaae0('0x19')](_0xaae0('0x17'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x20')]);router[_0xaae0('0x19')]('/:id/send',auth['isAuthenticated'](),controller[_0xaae0('0x21')]);router[_0xaae0('0x22')](_0xaae0('0xf'),auth[_0xaae0('0xd')](),controller['update']);router['delete'](_0xaae0('0xf'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x23')]);router['delete'](_0xaae0('0x11'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x24')]);router['delete'](_0xaae0('0x13'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x25')]);router['delete'](_0xaae0('0x17'),auth[_0xaae0('0xd')](),controller[_0xaae0('0x26')]);module[_0xaae0('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 1f6264c..72584c7 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 _0xd160=['name','STRING','generate','TEXT','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xd160,0x117));var _0x0d16=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0xd160[_0x12d951];return _0x44de17;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x0d16('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0d16('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x0d16('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0d16('0x3')]();}},'replyUri':{'type':Sequelize[_0x0d16('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x0d16('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0d16('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0d16('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0d16('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0d16('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0d16('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0d16('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0d16('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d16('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0d16('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x267b7b){if(!_0x267b7b)this[_0x0d16('0x7')](_0x0d16('0x8'),null);this[_0x0d16('0x7')](_0x0d16('0x9'),_0x267b7b);}}}; \ No newline at end of file +var _0x01eb=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2d615a,_0x5ee8f2){var _0x80a8a5=function(_0x109db5){while(--_0x109db5){_0x2d615a['push'](_0x2d615a['shift']());}};_0x80a8a5(++_0x5ee8f2);}(_0x01eb,0x178));var _0xb01e=function(_0xfbba38,_0x651026){_0xfbba38=_0xfbba38-0x0;var _0x716876=_0x01eb[_0xfbba38];return _0x716876;};'use strict';var Sequelize=require(_0xb01e('0x0'));var rs=require(_0xb01e('0x1'));module[_0xb01e('0x2')]={'name':{'type':Sequelize[_0xb01e('0x3')],'unique':_0xb01e('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xb01e('0x3')],'defaultValue':function(){return rs[_0xb01e('0x5')]();}},'replyUri':{'type':Sequelize[_0xb01e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb01e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb01e('0x6');}},'notificationSound':{'type':Sequelize[_0xb01e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb01e('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb01e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb01e('0x3')]},'queueTransfer':{'type':Sequelize[_0xb01e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb01e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb01e('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb01e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb01e('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb01e('0x7')],'defaultValue':![],'comment':_0xb01e('0x9'),'set':function(_0x18fefc){if(!_0x18fefc)this[_0xb01e('0xa')]('mandatoryDispositionPauseId',null);this[_0xb01e('0xa')]('mandatoryDisposition',_0x18fefc);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 1275433..7068a60 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 _0xbc70=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','then','get','UserProfileResource','destroy','name','index','mandatoryDispositionPause','map','OpenchannelAccount','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','Pause','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','OpenchannelAccountId','getDispositions','findOne','rawAttributes','options','Disposition','removeDispositions','ids','getAnswers','CannedAnswer','length','removeAnswers','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','OpenchannelApplication','Applications','list','applications','priority','asc','account','ListId','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','stack','finally','sendStatus','send','getApplications','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf'];(function(_0x4a0058,_0x413446){var _0x1e0db0=function(_0x37e952){while(--_0x37e952){_0x4a0058['push'](_0x4a0058['shift']());}};_0x1e0db0(++_0x413446);}(_0xbc70,0xbc));var _0x0bc7=function(_0x361009,_0x33a618){_0x361009=_0x361009-0x0;var _0x53ec33=_0xbc70[_0x361009];return _0x53ec33;};'use strict';var emlformat=require(_0x0bc7('0x0'));var rimraf=require(_0x0bc7('0x1'));var zipdir=require(_0x0bc7('0x2'));var jsonpatch=require(_0x0bc7('0x3'));var rp=require(_0x0bc7('0x4'));var moment=require('moment');var BPromise=require(_0x0bc7('0x5'));var Mustache=require(_0x0bc7('0x6'));var util=require(_0x0bc7('0x7'));var path=require(_0x0bc7('0x8'));var sox=require(_0x0bc7('0x9'));var csv=require('to-csv');var ejs=require(_0x0bc7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0bc7('0xb'));var deskjs=require(_0x0bc7('0xc'));var toCsv=require(_0x0bc7('0xd'));var querystring=require(_0x0bc7('0xe'));var Papa=require(_0x0bc7('0xf'));var Redis=require(_0x0bc7('0x10'));var authService=require(_0x0bc7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0bc7('0x12'));var hardwareService=require(_0x0bc7('0x13'));var logger=require(_0x0bc7('0x14'))('api');var utils=require(_0x0bc7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0bc7('0x16'));var db=require('../../mysqldb')['db'];config[_0x0bc7('0x17')]=_[_0x0bc7('0x18')](config[_0x0bc7('0x17')],{'host':_0x0bc7('0x19'),'port':0x18eb});var socket=require(_0x0bc7('0x1a'))(new Redis(config['redis']));require(_0x0bc7('0x1b'))[_0x0bc7('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x0bc7('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47ed3e,_0x4b157e,_0x4e54fe,_0x42592b){return new BPromise(function(_0xcf6d81,_0x311c1d){var _0x536df7=_0x42592b||client;return _0x536df7['request'](_0x47ed3e,_0x4e54fe)['then'](function(_0x52b1e2){logger[_0x0bc7('0x1e')](_0x0bc7('0x1f'),_0x4b157e,'request\x20sent');logger[_0x0bc7('0x20')](_0x0bc7('0x21'),_0x4b157e,'request\x20sent',JSON[_0x0bc7('0x22')](_0x52b1e2));if(_0x52b1e2[_0x0bc7('0x23')]){if(_0x52b1e2[_0x0bc7('0x23')][_0x0bc7('0x24')]===0x1f4){logger[_0x0bc7('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b157e,_0x52b1e2[_0x0bc7('0x23')][_0x0bc7('0x25')]);return _0x311c1d(_0x52b1e2[_0x0bc7('0x23')][_0x0bc7('0x25')]);}logger[_0x0bc7('0x23')](_0x0bc7('0x1f'),_0x4b157e,_0x52b1e2['error'][_0x0bc7('0x25')]);return _0xcf6d81(_0x52b1e2[_0x0bc7('0x23')][_0x0bc7('0x25')]);}else{logger['info'](_0x0bc7('0x1f'),_0x4b157e,_0x0bc7('0x26'));_0xcf6d81(_0x52b1e2[_0x0bc7('0x27')][_0x0bc7('0x25')]);}})[_0x0bc7('0x28')](function(_0x1497f4){logger[_0x0bc7('0x23')](_0x0bc7('0x1f'),_0x4b157e,_0x1497f4);_0x311c1d(_0x1497f4);});});}function respondWithStatusCode(_0x4295f5,_0x5028c1){_0x5028c1=_0x5028c1||0xcc;return function(_0x4fc777){if(_0x4fc777){return _0x4295f5['sendStatus'](_0x5028c1);}return _0x4295f5['status'](_0x5028c1)[_0x0bc7('0x29')]();};}function respondWithResult(_0x55e354,_0x3ef3ea){_0x3ef3ea=_0x3ef3ea||0xc8;return function(_0x5745ab){if(_0x5745ab){return _0x55e354[_0x0bc7('0x2a')](_0x3ef3ea)[_0x0bc7('0x2b')](_0x5745ab);}};}function respondWithFilteredResult(_0x5dedf6,_0x14bab6){return function(_0x41c3aa){if(_0x41c3aa){var _0x439378=typeof _0x14bab6[_0x0bc7('0x2c')]===_0x0bc7('0x2d')&&typeof _0x14bab6['limit']===_0x0bc7('0x2d');var _0x5a7249=_0x41c3aa['count'];var _0x5aa9cc=_0x439378?0x0:_0x14bab6[_0x0bc7('0x2c')];var _0x334dbe=_0x439378?_0x41c3aa[_0x0bc7('0x2e')]:_0x14bab6[_0x0bc7('0x2c')]+_0x14bab6[_0x0bc7('0x2f')];var _0x358d9e;if(_0x334dbe>=_0x5a7249){_0x334dbe=_0x5a7249;_0x358d9e=0xc8;}else{_0x358d9e=0xce;}_0x5dedf6[_0x0bc7('0x2a')](_0x358d9e);return _0x5dedf6[_0x0bc7('0x30')](_0x0bc7('0x31'),_0x5aa9cc+'-'+_0x334dbe+'/'+_0x5a7249)[_0x0bc7('0x2b')](_0x41c3aa);}return null;};}function patchUpdates(_0x195ac0){return function(_0x23039c){try{jsonpatch['apply'](_0x23039c,_0x195ac0,!![]);}catch(_0x4d66d3){return BPromise[_0x0bc7('0x32')](_0x4d66d3);}return _0x23039c['save']();};}function saveUpdates(_0x5896cc,_0x4586f5){return function(_0xfb41ac){if(_0xfb41ac){return _0xfb41ac['update'](_0x5896cc)[_0x0bc7('0x33')](function(_0x1cd001){return _0x1cd001;});}return null;};}function removeEntity(_0x512c1d,_0x4f2acf){return function(_0x3380d9){if(_0x3380d9){return _0x3380d9['destroy']()[_0x0bc7('0x33')](function(){var _0x3e9ba8=_0x3380d9[_0x0bc7('0x34')]({'plain':!![]});var _0x4198ce='OpenchannelAccounts';return db[_0x0bc7('0x35')][_0x0bc7('0x36')]({'where':{'type':_0x4198ce,'resourceId':_0x3e9ba8['id']}})[_0x0bc7('0x33')](function(){return _0x3380d9;});})[_0x0bc7('0x33')](function(){_0x512c1d[_0x0bc7('0x2a')](0xcc)[_0x0bc7('0x29')]();});}};}function handleEntityNotFound(_0x594c8e,_0x4fabee){return function(_0x38b132){if(!_0x38b132){_0x594c8e['sendStatus'](0x194);}return _0x38b132;};}function handleError(_0x5c0e40,_0x26d7b9){_0x26d7b9=_0x26d7b9||0x1f4;return function(_0x1e46cb){logger[_0x0bc7('0x23')](_0x1e46cb['stack']);if(_0x1e46cb[_0x0bc7('0x37')]){delete _0x1e46cb[_0x0bc7('0x37')];}_0x5c0e40[_0x0bc7('0x2a')](_0x26d7b9)['send'](_0x1e46cb);};}exports[_0x0bc7('0x38')]=function(_0x310787,_0x5bdf00){var _0x579ba6={'include':[{'model':db['Pause'],'as':_0x0bc7('0x39')}]},_0x38b567={},_0x23eb8f={'count':0x0,'rows':[]};var _0x19e859=_[_0x0bc7('0x3a')](db[_0x0bc7('0x3b')]['rawAttributes'],function(_0x25dab1){return{'name':_0x25dab1['fieldName'],'type':_0x25dab1[_0x0bc7('0x3c')][_0x0bc7('0x3d')]};});_0x38b567[_0x0bc7('0x3e')]=_[_0x0bc7('0x3a')](_0x19e859,_0x0bc7('0x37'));_0x38b567['query']=_[_0x0bc7('0x3f')](_0x310787[_0x0bc7('0x40')]);_0x38b567[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x38b567['model'],_0x38b567['query']);_0x579ba6[_0x0bc7('0x43')]=_[_0x0bc7('0x42')](_0x38b567[_0x0bc7('0x3e')],qs[_0x0bc7('0x44')](_0x310787['query']['fields']));_0x579ba6[_0x0bc7('0x43')]=_0x579ba6[_0x0bc7('0x43')]['length']?_0x579ba6[_0x0bc7('0x43')]:_0x38b567[_0x0bc7('0x3e')];if(!_0x310787['query'][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x579ba6[_0x0bc7('0x2f')]=qs[_0x0bc7('0x2f')](_0x310787['query']['limit']);_0x579ba6[_0x0bc7('0x2c')]=qs[_0x0bc7('0x2c')](_0x310787['query'][_0x0bc7('0x2c')]);}_0x579ba6[_0x0bc7('0x47')]=qs[_0x0bc7('0x48')](_0x310787[_0x0bc7('0x40')][_0x0bc7('0x48')]);_0x579ba6[_0x0bc7('0x49')]=qs[_0x0bc7('0x41')](_[_0x0bc7('0x4a')](_0x310787['query'],_0x38b567['filters']),_0x19e859);if(_0x310787['query'][_0x0bc7('0x4b')]){_0x579ba6[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x579ba6[_0x0bc7('0x49')],{'$or':_[_0x0bc7('0x3a')](_0x19e859,function(_0x433577){if(_0x433577['type']!==_0x0bc7('0x4d')){var _0x95e572={};_0x95e572[_0x433577[_0x0bc7('0x37')]]={'$like':'%'+_0x310787[_0x0bc7('0x40')][_0x0bc7('0x4b')]+'%'};return _0x95e572;}})});}_0x579ba6=_[_0x0bc7('0x4c')]({},_0x579ba6,_0x310787['options']);var _0x5a51f7={'where':_0x579ba6['where']};return db[_0x0bc7('0x3b')][_0x0bc7('0x2e')](_0x5a51f7)[_0x0bc7('0x33')](function(_0x4c5c54){_0x23eb8f['count']=_0x4c5c54;if(_0x310787[_0x0bc7('0x40')][_0x0bc7('0x4e')]){_0x579ba6[_0x0bc7('0x4f')]=[{'all':!![]}];}return db[_0x0bc7('0x3b')][_0x0bc7('0x50')](_0x579ba6);})[_0x0bc7('0x33')](function(_0x4c215a){_0x23eb8f[_0x0bc7('0x51')]=_0x4c215a;return _0x23eb8f;})[_0x0bc7('0x33')](respondWithFilteredResult(_0x5bdf00,_0x579ba6))['catch'](handleError(_0x5bdf00,null));};exports[_0x0bc7('0x52')]=function(_0xa85efb,_0x42a3ec){var _0x2326c6={'raw':![],'where':{'id':_0xa85efb[_0x0bc7('0x53')]['id']},'include':[{'model':db[_0x0bc7('0x54')],'as':_0x0bc7('0x39')}]},_0x8d8a8f={};_0x8d8a8f['model']=_['keys'](db[_0x0bc7('0x3b')]['rawAttributes']);_0x8d8a8f[_0x0bc7('0x40')]=_[_0x0bc7('0x3f')](_0xa85efb[_0x0bc7('0x40')]);_0x8d8a8f[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x8d8a8f[_0x0bc7('0x3e')],_0x8d8a8f[_0x0bc7('0x40')]);_0x2326c6[_0x0bc7('0x43')]=_['intersection'](_0x8d8a8f['model'],qs[_0x0bc7('0x44')](_0xa85efb[_0x0bc7('0x40')][_0x0bc7('0x44')]));_0x2326c6[_0x0bc7('0x43')]=_0x2326c6[_0x0bc7('0x43')]['length']?_0x2326c6['attributes']:_0x8d8a8f[_0x0bc7('0x3e')];if(_0xa85efb[_0x0bc7('0x40')][_0x0bc7('0x4e')]){_0x2326c6[_0x0bc7('0x4f')]=[{'all':!![]}];}_0x2326c6=_['merge']({},_0x2326c6,_0xa85efb['options']);return db['OpenchannelAccount'][_0x0bc7('0x55')](_0x2326c6)[_0x0bc7('0x33')](handleEntityNotFound(_0x42a3ec,null))[_0x0bc7('0x33')](respondWithResult(_0x42a3ec,null))[_0x0bc7('0x28')](handleError(_0x42a3ec,null));};exports['create']=function(_0x465853,_0x48fb64){return db[_0x0bc7('0x3b')]['create'](_0x465853[_0x0bc7('0x56')],{})[_0x0bc7('0x33')](function(_0x146898){var _0x4b4725=_0x465853[_0x0bc7('0x57')][_0x0bc7('0x34')]({'plain':!![]});if(!_0x4b4725)throw new Error(_0x0bc7('0x58'));if(_0x4b4725['role']===_0x0bc7('0x57')){var _0x32a24a=_0x146898[_0x0bc7('0x34')]({'plain':!![]});var _0x3be2b5=_0x0bc7('0x59');return db['UserProfileSection'][_0x0bc7('0x55')]({'where':{'name':_0x3be2b5,'userProfileId':_0x4b4725[_0x0bc7('0x5a')]},'raw':!![]})[_0x0bc7('0x33')](function(_0x24c16d){if(_0x24c16d&&_0x24c16d[_0x0bc7('0x5b')]===0x0){return db[_0x0bc7('0x35')][_0x0bc7('0x5c')]({'name':_0x32a24a[_0x0bc7('0x37')],'resourceId':_0x32a24a['id'],'type':_0x24c16d[_0x0bc7('0x37')],'sectionId':_0x24c16d['id']},{})['then'](function(){return _0x146898;});}else{return _0x146898;}})[_0x0bc7('0x28')](function(_0x2879fe){logger[_0x0bc7('0x23')](_0x0bc7('0x5d'),_0x2879fe);throw _0x2879fe;});}return _0x146898;})[_0x0bc7('0x33')](respondWithResult(_0x48fb64,0xc9))['catch'](handleError(_0x48fb64,null));};exports[_0x0bc7('0x5e')]=function(_0x4aac07,_0x2f893c){if(_0x4aac07[_0x0bc7('0x56')]['id']){delete _0x4aac07['body']['id'];}return db['OpenchannelAccount'][_0x0bc7('0x55')]({'where':{'id':_0x4aac07['params']['id']},'include':[{'model':db[_0x0bc7('0x54')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2f893c,null))[_0x0bc7('0x33')](saveUpdates(_0x4aac07['body'],null))['then'](respondWithResult(_0x2f893c,null))[_0x0bc7('0x28')](handleError(_0x2f893c,null));};exports[_0x0bc7('0x36')]=function(_0x14d12f,_0x25fbd1){return db['OpenchannelAccount'][_0x0bc7('0x55')]({'where':{'id':_0x14d12f['params']['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x25fbd1,null))[_0x0bc7('0x33')](removeEntity(_0x25fbd1,null))[_0x0bc7('0x28')](handleError(_0x25fbd1,null));};exports[_0x0bc7('0x5f')]=function(_0x25820e,_0x18739c){return db[_0x0bc7('0x3b')][_0x0bc7('0x5f')]()[_0x0bc7('0x33')](respondWithResult(_0x18739c,null))[_0x0bc7('0x28')](handleError(_0x18739c,null));};exports['addDisposition']=function(_0x160742,_0x71d418,_0x3d946d){if(_0x160742['body']['id']){delete _0x160742[_0x0bc7('0x56')]['id'];}return db['OpenchannelAccount'][_0x0bc7('0x55')]({'where':{'id':_0x160742[_0x0bc7('0x53')]['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x71d418,null))[_0x0bc7('0x33')](function(_0x718c4f){if(_0x718c4f){_0x160742[_0x0bc7('0x56')][_0x0bc7('0x60')]=_0x718c4f['id'];return db['Disposition'][_0x0bc7('0x5c')](_0x160742[_0x0bc7('0x56')]);}})[_0x0bc7('0x33')](respondWithResult(_0x71d418,null))[_0x0bc7('0x28')](handleError(_0x71d418,null));};exports[_0x0bc7('0x61')]=function(_0x1e95cc,_0x339604,_0xa01c75){var _0x9ae3eb={'raw':![],'where':{}};var _0x1ded20={};var _0x327098={'count':0x0,'rows':[]};return db[_0x0bc7('0x3b')][_0x0bc7('0x62')]({'where':{'id':_0x1e95cc['params']['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x339604,null))['then'](function(_0x3ab928){if(_0x3ab928){_0x1ded20['model']=_['keys'](db['Disposition'][_0x0bc7('0x63')]);_0x1ded20['query']=_[_0x0bc7('0x3f')](_0x1e95cc[_0x0bc7('0x40')]);_0x1ded20[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x1ded20['model'],_0x1ded20['query']);_0x9ae3eb['attributes']=_[_0x0bc7('0x42')](_0x1ded20[_0x0bc7('0x3e')],qs['fields'](_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x44')]));_0x9ae3eb[_0x0bc7('0x43')]=_0x9ae3eb[_0x0bc7('0x43')]['length']?_0x9ae3eb['attributes']:_0x1ded20[_0x0bc7('0x3e')];if(!_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x9ae3eb[_0x0bc7('0x2f')]=qs[_0x0bc7('0x2f')](_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x2f')]);_0x9ae3eb[_0x0bc7('0x2c')]=qs['offset'](_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x2c')]);}_0x9ae3eb[_0x0bc7('0x47')]=qs['sort'](_0x1e95cc[_0x0bc7('0x40')]['sort']);_0x9ae3eb[_0x0bc7('0x49')]=qs[_0x0bc7('0x41')](_[_0x0bc7('0x4a')](_0x1e95cc[_0x0bc7('0x40')],_0x1ded20['filters']));_0x9ae3eb[_0x0bc7('0x49')]['OpenchannelAccountId']=_0x3ab928['id'];if(_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x4b')]){_0x9ae3eb[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x9ae3eb['where'],{'$or':_[_0x0bc7('0x3a')](_0x9ae3eb[_0x0bc7('0x43')],function(_0x5893e9){var _0x56b194={};_0x56b194[_0x5893e9]={'$like':'%'+_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x4b')]+'%'};return _0x56b194;})});}_0x9ae3eb=_[_0x0bc7('0x4c')]({},_0x9ae3eb,_0x1e95cc[_0x0bc7('0x64')]);return db['Disposition'][_0x0bc7('0x2e')]({'where':_0x9ae3eb[_0x0bc7('0x49')]})[_0x0bc7('0x33')](function(_0x4a2c68){_0x327098['count']=_0x4a2c68;if(_0x1e95cc['query']['includeAll']){_0x9ae3eb[_0x0bc7('0x4f')]=[{'all':!![]}];}return db[_0x0bc7('0x65')][_0x0bc7('0x50')](_0x9ae3eb);})[_0x0bc7('0x33')](function(_0x2293d6){_0x327098[_0x0bc7('0x51')]=_0x2293d6;return _0x327098;});}})['then'](respondWithFilteredResult(_0x339604,_0x9ae3eb))[_0x0bc7('0x28')](handleError(_0x339604,null));};exports['removeDispositions']=function(_0x4788b3,_0x241bef,_0x5e16eb){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0x4788b3[_0x0bc7('0x53')]['id']}})['then'](handleEntityNotFound(_0x241bef,null))[_0x0bc7('0x33')](function(_0x45251f){if(_0x45251f){return _0x45251f[_0x0bc7('0x66')](_0x4788b3[_0x0bc7('0x40')][_0x0bc7('0x67')]);}})['then'](respondWithStatusCode(_0x241bef,null))[_0x0bc7('0x28')](handleError(_0x241bef,null));};exports['addAnswer']=function(_0x30091f,_0x2facd4,_0x29ccd2){if(_0x30091f[_0x0bc7('0x56')]['id']){delete _0x30091f[_0x0bc7('0x56')]['id'];}return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0x30091f['params']['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x2facd4,null))[_0x0bc7('0x33')](function(_0x1f1a23){if(_0x1f1a23){_0x30091f[_0x0bc7('0x56')]['OpenchannelAccountId']=_0x1f1a23['id'];return db['CannedAnswer']['create'](_0x30091f[_0x0bc7('0x56')]);}})[_0x0bc7('0x33')](respondWithResult(_0x2facd4,null))[_0x0bc7('0x28')](handleError(_0x2facd4,null));};exports[_0x0bc7('0x68')]=function(_0xd1db45,_0x1c41fd,_0x515689){var _0x396d27={'raw':![],'where':{}};var _0x471705={};var _0x2694d1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0bc7('0x62')]({'where':{'id':_0xd1db45[_0x0bc7('0x53')]['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x1c41fd,null))['then'](function(_0xa4156){if(_0xa4156){_0x471705['model']=_[_0x0bc7('0x3f')](db[_0x0bc7('0x69')]['rawAttributes']);_0x471705['query']=_[_0x0bc7('0x3f')](_0xd1db45['query']);_0x471705[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x471705['model'],_0x471705[_0x0bc7('0x40')]);_0x396d27[_0x0bc7('0x43')]=_[_0x0bc7('0x42')](_0x471705['model'],qs[_0x0bc7('0x44')](_0xd1db45[_0x0bc7('0x40')]['fields']));_0x396d27['attributes']=_0x396d27[_0x0bc7('0x43')][_0x0bc7('0x6a')]?_0x396d27['attributes']:_0x471705[_0x0bc7('0x3e')];if(!_0xd1db45[_0x0bc7('0x40')]['hasOwnProperty']('nolimit')){_0x396d27['limit']=qs[_0x0bc7('0x2f')](_0xd1db45[_0x0bc7('0x40')][_0x0bc7('0x2f')]);_0x396d27[_0x0bc7('0x2c')]=qs[_0x0bc7('0x2c')](_0xd1db45['query'][_0x0bc7('0x2c')]);}_0x396d27[_0x0bc7('0x47')]=qs[_0x0bc7('0x48')](_0xd1db45[_0x0bc7('0x40')][_0x0bc7('0x48')]);_0x396d27[_0x0bc7('0x49')]=qs['filters'](_[_0x0bc7('0x4a')](_0xd1db45[_0x0bc7('0x40')],_0x471705[_0x0bc7('0x41')]));_0x396d27[_0x0bc7('0x49')][_0x0bc7('0x60')]=_0xa4156['id'];if(_0xd1db45[_0x0bc7('0x40')][_0x0bc7('0x4b')]){_0x396d27['where']=_['merge'](_0x396d27['where'],{'$or':_['map'](_0x396d27['attributes'],function(_0x248ead){var _0x2fa836={};_0x2fa836[_0x248ead]={'$like':'%'+_0xd1db45['query'][_0x0bc7('0x4b')]+'%'};return _0x2fa836;})});}_0x396d27=_[_0x0bc7('0x4c')]({},_0x396d27,_0xd1db45[_0x0bc7('0x64')]);return db['CannedAnswer'][_0x0bc7('0x2e')]({'where':_0x396d27['where']})[_0x0bc7('0x33')](function(_0x5bcf5d){_0x2694d1[_0x0bc7('0x2e')]=_0x5bcf5d;if(_0xd1db45[_0x0bc7('0x40')][_0x0bc7('0x4e')]){_0x396d27[_0x0bc7('0x4f')]=[{'all':!![]}];}return db[_0x0bc7('0x69')][_0x0bc7('0x50')](_0x396d27);})[_0x0bc7('0x33')](function(_0xc4df7e){_0x2694d1[_0x0bc7('0x51')]=_0xc4df7e;return _0x2694d1;});}})[_0x0bc7('0x33')](respondWithFilteredResult(_0x1c41fd,_0x396d27))[_0x0bc7('0x28')](handleError(_0x1c41fd,null));};exports['removeAnswers']=function(_0x723663,_0x62931d,_0x4d151a){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0x723663[_0x0bc7('0x53')]['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x62931d,null))[_0x0bc7('0x33')](function(_0x35d1c4){if(_0x35d1c4){return _0x35d1c4[_0x0bc7('0x6b')](_0x723663['query'][_0x0bc7('0x67')]);}})[_0x0bc7('0x33')](respondWithStatusCode(_0x62931d,null))[_0x0bc7('0x28')](handleError(_0x62931d,null));};exports['notify']=function(_0xd4556c,_0x523d04,_0x5f0155){var _0x540e46={'body':_0xd4556c['body'],'channel':'openchannel'};var _0x3c054c=[];var _0x28ec9c=[];var _0x2aa7da={};var _0x109d8e=![];return db[_0x0bc7('0x6c')]['describe']()[_0x0bc7('0x33')](function(_0x50f513){if(!_0x50f513){throw new db[(_0x0bc7('0x6d'))][(_0x0bc7('0x6e'))](_0x0bc7('0x6f'));}_0x3c054c=_[_0x0bc7('0x70')](_[_0x0bc7('0x3f')](_0x50f513),[_0x0bc7('0x71'),_0x0bc7('0x72')]);_0x28ec9c=_['difference'](_[_0x0bc7('0x3f')](_0x50f513),[_0x0bc7('0x71'),_0x0bc7('0x72'),_0x0bc7('0x73'),'ListId']);if(_0xd4556c[_0x0bc7('0x56')]['id']){delete _0xd4556c['body']['id'];}if(_[_0x0bc7('0x74')](_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x75')])){throw new db[(_0x0bc7('0x6d'))]['ValidationError'](_0x0bc7('0x76'));}if(_[_0x0bc7('0x74')](_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x56')])||_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x56')]===''){throw new db[(_0x0bc7('0x6d'))][(_0x0bc7('0x6e'))](_0x0bc7('0x77'));}if(_[_0x0bc7('0x74')](_0xd4556c['body'][_0x0bc7('0x78')])){throw new db[(_0x0bc7('0x6d'))][(_0x0bc7('0x6e'))](_0x0bc7('0x79')+_0x28ec9c);}if(!_[_0x0bc7('0x7a')](_0x28ec9c,_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x78')])){throw new db[(_0x0bc7('0x6d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28ec9c);}_0x2aa7da[_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x78')]]=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x75')];})['then'](function(){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0xd4556c[_0x0bc7('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x0bc7('0x7b'),'include':[{'model':db[_0x0bc7('0x6c')],'as':_0x0bc7('0x7c'),'where':_0x2aa7da,'limit':0x1,'order':[[_0x0bc7('0x72'),'DESC']]}]},{'model':db[_0x0bc7('0x7d')],'as':_0x0bc7('0x7e')}]});})[_0x0bc7('0x33')](handleEntityNotFound(_0x523d04,null))[_0x0bc7('0x33')](function(_0x3459f8){if(_0x3459f8&&_0x3459f8[_0x0bc7('0x7b')]){_0x540e46['account']=_0x3459f8;_0x540e46['applications']=_0x3459f8['Applications'];_0x540e46[_0x0bc7('0x7f')]=_0x3459f8[_0x0bc7('0x7b')];_0x540e46[_0x0bc7('0x80')]=_['orderBy'](_0x540e46[_0x0bc7('0x80')],[_0x0bc7('0x81')],[_0x0bc7('0x82')]);if(_0x540e46['account'][_0x0bc7('0x7e')]){delete _0x540e46[_0x0bc7('0x83')][_0x0bc7('0x7e')];}if(_0x540e46[_0x0bc7('0x83')][_0x0bc7('0x7b')]&&_0x540e46[_0x0bc7('0x83')][_0x0bc7('0x7b')][_0x0bc7('0x7c')][_0x0bc7('0x6a')]){return _0x540e46[_0x0bc7('0x83')][_0x0bc7('0x7b')][_0x0bc7('0x7c')][0x0];}var _0x53333a=_['defaults'](_0xd4556c[_0x0bc7('0x56')],{'firstName':_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x75')],'ListId':_0x3459f8[_0x0bc7('0x84')]});_0x53333a[_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x78')]]=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x75')];return db['CmContact'][_0x0bc7('0x5c')](_0x53333a,{'fields':_0x3c054c,'raw':!![]});}})[_0x0bc7('0x33')](handleEntityNotFound(_0x523d04,null))['then'](function(_0x4ad035){_0x540e46['contact']=_0x4ad035;if(_0x4ad035){var _0x2e845f={'ContactId':_0x4ad035['id'],'OpenchannelAccountId':_0xd4556c['params']['id'],'from':(_0x4ad035[_0x0bc7('0x85')]||'')+'\x20'+(_0x4ad035['lastName']||'')};var _0x1b2ccb={'OpenchannelAccountId':_0xd4556c[_0x0bc7('0x53')]['id'],'closed':![]};if(_0xd4556c['body']['threadId']){_0x1b2ccb[_0x0bc7('0x86')]=_0xd4556c[_0x0bc7('0x56')]['threadId'];return db[_0x0bc7('0x87')][_0x0bc7('0x55')]({'where':_0x1b2ccb})['then'](function(_0x35fe07){if(_0x35fe07){return[_0x35fe07,![]];}_0x2e845f[_0x0bc7('0x86')]=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x86')];_0x2e845f[_0x0bc7('0x88')]=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x88')];return db[_0x0bc7('0x87')]['create'](_0x2e845f)[_0x0bc7('0x33')](function(_0x4af37a){return[_0x4af37a,!![]];});});}else{_0x1b2ccb[_0x0bc7('0x86')]=null;}_0x1b2ccb[_0x0bc7('0x89')]=_0x4ad035['id'];return db[_0x0bc7('0x87')]['find']({'where':_0x1b2ccb})[_0x0bc7('0x33')](function(_0x3b1e72){if(_0x3b1e72){return[_0x3b1e72,![]];}return db[_0x0bc7('0x87')][_0x0bc7('0x5c')](_0x2e845f)['then'](function(_0x4f9912){return[_0x4f9912,!![]];});});}})[_0x0bc7('0x8a')](function(_0x1e1203,_0x314d88){if(_0x1e1203){_0x109d8e=_0x314d88;if(!_0x314d88){var _0x4d3ad6={'from':(_0x540e46[_0x0bc7('0x8b')][_0x0bc7('0x85')]||'')+'\x20'+(_0x540e46[_0x0bc7('0x8b')][_0x0bc7('0x8c')]||'')};if(_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x86')]&&_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x8d')]&&_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x86')]!=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x8d')]){_0x4d3ad6['threadId']=_0xd4556c['body'][_0x0bc7('0x8d')];}return _0x1e1203[_0x0bc7('0x5e')](_0x4d3ad6);}else{return _0x1e1203;}}})[_0x0bc7('0x33')](function(_0x30d145){_0x540e46[_0x0bc7('0x8e')]=_0x30d145[_0x0bc7('0x34')]({'plain':!![]});_0x540e46[_0x0bc7('0x8e')]['created']=_0x109d8e;if(_0x540e46[_0x0bc7('0x8e')][_0x0bc7('0x8f')]){if(_0x540e46[_0x0bc7('0x83')][_0x0bc7('0x90')]){_0x540e46[_0x0bc7('0x80')][_0x0bc7('0x91')]({'id':0x0,'priority':_0x540e46[_0x0bc7('0x80')][_0x0bc7('0x6a')]+0x1,'app':_0x0bc7('0x92'),'appdata':_0x0bc7('0x93'),'interval':_0x0bc7('0x94')});}}return db[_0x0bc7('0x95')]['create']({'body':_0xd4556c[_0x0bc7('0x56')]['body'],'OpenchannelAccountId':_0xd4556c[_0x0bc7('0x53')]['id'],'OpenchannelInteractionId':_0x30d145['id'],'direction':'in','ContactId':_0x540e46[_0x0bc7('0x8b')]['id'],'AttachmentId':_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x96')]});})[_0x0bc7('0x33')](function(_0x26dffb){_0x540e46[_0x0bc7('0x25')]=_0x26dffb;if(_0x540e46[_0x0bc7('0x8e')][_0x0bc7('0x97')]){return db[_0x0bc7('0x98')]['find']({'attributes':['id','name'],'where':{'id':_0x540e46[_0x0bc7('0x8e')][_0x0bc7('0x97')]}})[_0x0bc7('0x33')](function(_0x4fc985){if(_0x4fc985){_0x540e46['applications'][_0x0bc7('0x99')]({'id':0x0,'priority':0x0,'app':_0x0bc7('0x9a'),'appdata':_0x4fc985[_0x0bc7('0x37')]+','+(_0x540e46['account'][_0x0bc7('0x9b')]||0xa),'interval':_0x0bc7('0x94')});_0x540e46[_0x0bc7('0x9c')]=![];}return respondWithRpcPromise('Start','startRouting',_0x540e46);});}return respondWithRpcPromise(_0x0bc7('0x9d'),_0x0bc7('0x9e'),_0x540e46);})[_0x0bc7('0x33')](function(_0x35ade6){respondWithRpcPromise('EventManager',_0x0bc7('0x9f'),{'event':_0x0bc7('0xa0'),'message':_0x35ade6},client9002);return _0x35ade6;})[_0x0bc7('0x33')](respondWithResult(_0x523d04,null))[_0x0bc7('0x28')](handleError(_0x523d04,null));};exports[_0x0bc7('0xa1')]=function(_0x4c9fec,_0x56dcef){var _0x385699=_0x4c9fec[_0x0bc7('0x53')]['id'];var _0x5e7251=_0x4c9fec[_0x0bc7('0x56')];var _0x491142=0xc8;var _0xe45ed7=null;return db[_0x0bc7('0xa2')][_0x0bc7('0xa3')]({'isolationLevel':db['sequelize'][_0x0bc7('0xa4')][_0x0bc7('0xa5')][_0x0bc7('0xa6')]},function(_0x152b70){return db[_0x0bc7('0x3b')]['findOne']({'where':{'id':_0x385699},'transaction':_0x152b70})[_0x0bc7('0x33')](function(_0x5eb47f){if(_0x5eb47f){return db[_0x0bc7('0x7d')]['destroy']({'where':{'OpenchannelAccountId':_0x385699},'transaction':_0x152b70})[_0x0bc7('0x33')](function(){var _0x4d8284=_[_0x0bc7('0x3a')](_0x5e7251,function(_0x210f23){_0x210f23[_0x0bc7('0x60')]=_0x385699;return _0x210f23;});return db[_0x0bc7('0x7d')]['bulkCreate'](_0x4d8284,{'transaction':_0x152b70});});}else{_0x491142=0x194;_0xe45ed7=[];}});})[_0x0bc7('0x33')](function(){if(_0x491142!==0x194){return db[_0x0bc7('0x7d')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x385699},'order':_0x0bc7('0x81')})[_0x0bc7('0x33')](function(_0x54d0cd){_0xe45ed7=_0x54d0cd;});}})['catch'](function(_0x4fcd40){_0x491142=0x1f4;logger[_0x0bc7('0x23')](_0x4fcd40[_0x0bc7('0xa7')]);if(_0x4fcd40[_0x0bc7('0x37')]){delete _0x4fcd40[_0x0bc7('0x37')];}_0xe45ed7=_0x4fcd40;})[_0x0bc7('0xa8')](function(){if(_0xe45ed7===null){_0x56dcef[_0x0bc7('0xa9')](_0x491142);}else{if(_0x491142===0x1f4){_0x56dcef[_0x0bc7('0x2a')](_0x491142)[_0x0bc7('0xaa')](_0xe45ed7);}else{_0x56dcef[_0x0bc7('0x2a')](_0x491142)['json'](_0xe45ed7);}}});};exports['getApplications']=function(_0x235759,_0x2dea19,_0x8fc146){var _0x77a17e={};var _0x269ec6={};var _0x32583f;var _0x49f8ae;return db[_0x0bc7('0x3b')][_0x0bc7('0x62')]({'where':{'id':_0x235759[_0x0bc7('0x53')]['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x2dea19,null))[_0x0bc7('0x33')](function(_0x3fd5ba){if(_0x3fd5ba){_0x32583f=_0x3fd5ba;_0x269ec6[_0x0bc7('0x3e')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x269ec6['query']=_[_0x0bc7('0x3f')](_0x235759[_0x0bc7('0x40')]);_0x269ec6[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x269ec6[_0x0bc7('0x3e')],_0x269ec6['query']);_0x77a17e['attributes']=_[_0x0bc7('0x42')](_0x269ec6['model'],qs[_0x0bc7('0x44')](_0x235759['query'][_0x0bc7('0x44')]));_0x77a17e['attributes']=_0x77a17e['attributes'][_0x0bc7('0x6a')]?_0x77a17e['attributes']:_0x269ec6[_0x0bc7('0x3e')];_0x77a17e['order']=qs['sort'](_0x235759['query'][_0x0bc7('0x48')]);_0x77a17e[_0x0bc7('0x49')]=qs['filters'](_[_0x0bc7('0x4a')](_0x235759[_0x0bc7('0x40')],_0x269ec6['filters']));if(_0x235759[_0x0bc7('0x40')][_0x0bc7('0x4b')]){_0x77a17e[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x77a17e[_0x0bc7('0x49')],{'$or':_[_0x0bc7('0x3a')](_0x77a17e[_0x0bc7('0x43')],function(_0x48c789){var _0x35945b={};_0x35945b[_0x48c789]={'$like':'%'+_0x235759[_0x0bc7('0x40')][_0x0bc7('0x4b')]+'%'};return _0x35945b;})});}_0x77a17e=_[_0x0bc7('0x4c')]({},_0x77a17e,_0x235759[_0x0bc7('0x64')]);return _0x32583f['getApplications'](_0x77a17e);}})[_0x0bc7('0x33')](function(_0x351cc1){if(_0x351cc1){_0x49f8ae=_0x351cc1[_0x0bc7('0x6a')];if(!_0x235759[_0x0bc7('0x40')][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x77a17e['limit']=qs[_0x0bc7('0x2f')](_0x235759[_0x0bc7('0x40')]['limit']);_0x77a17e[_0x0bc7('0x2c')]=qs[_0x0bc7('0x2c')](_0x235759[_0x0bc7('0x40')][_0x0bc7('0x2c')]);}return _0x32583f[_0x0bc7('0xab')](_0x77a17e);}})['then'](function(_0x947274){if(_0x947274){return _0x947274?{'count':_0x49f8ae,'rows':_0x947274}:null;}})[_0x0bc7('0x33')](respondWithResult(_0x2dea19,null))['catch'](handleError(_0x2dea19,null));};exports['getInteractions']=function(_0x129a8b,_0x1f0c26,_0x3e5b83){var _0x545498={'raw':![],'where':{}};var _0x2351ae={};var _0x1bb5be={'count':0x0,'rows':[]};return db[_0x0bc7('0x3b')][_0x0bc7('0x62')]({'where':{'id':_0x129a8b[_0x0bc7('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f0c26,null))[_0x0bc7('0x33')](function(_0x114ebb){if(_0x114ebb){_0x2351ae[_0x0bc7('0x3e')]=_[_0x0bc7('0x3f')](db[_0x0bc7('0x87')]['rawAttributes']);_0x2351ae[_0x0bc7('0x40')]=_[_0x0bc7('0x3f')](_0x129a8b[_0x0bc7('0x40')]);_0x2351ae[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x2351ae[_0x0bc7('0x3e')],_0x2351ae[_0x0bc7('0x40')]);_0x545498[_0x0bc7('0x43')]=_['intersection'](_0x2351ae[_0x0bc7('0x3e')],qs['fields'](_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0x44')]));_0x545498['attributes']=_0x545498[_0x0bc7('0x43')]['length']?_0x545498[_0x0bc7('0x43')]:_0x2351ae[_0x0bc7('0x3e')];if(!_0x129a8b['query'][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x545498[_0x0bc7('0x2f')]=qs['limit'](_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0x2f')]);_0x545498['offset']=qs[_0x0bc7('0x2c')](_0x129a8b['query'][_0x0bc7('0x2c')]);}_0x545498['order']=qs[_0x0bc7('0x48')](_0x129a8b['query']['sort']);_0x545498[_0x0bc7('0x49')]=qs[_0x0bc7('0x41')](_[_0x0bc7('0x4a')](_0x129a8b[_0x0bc7('0x40')],_0x2351ae[_0x0bc7('0x41')]));_0x545498[_0x0bc7('0x49')][_0x0bc7('0x60')]=_0x114ebb['id'];if(_0x129a8b[_0x0bc7('0x40')]['filter']){_0x545498[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x545498['where'],{'$or':_['map'](_0x545498[_0x0bc7('0x43')],function(_0x5b8985){var _0x2a6a22={};_0x2a6a22[_0x5b8985]={'$like':'%'+_0x129a8b[_0x0bc7('0x40')]['filter']+'%'};return _0x2a6a22;})});}_0x545498=_[_0x0bc7('0x4c')]({},_0x545498,_0x129a8b['options']);return db[_0x0bc7('0x87')][_0x0bc7('0x2e')]({'where':_0x545498['where']})[_0x0bc7('0x33')](function(_0x13f343){_0x1bb5be[_0x0bc7('0x2e')]=_0x13f343;if(_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0x4e')]){_0x545498['include']=[{'model':db[_0x0bc7('0x6c')],'as':_0x0bc7('0xac'),'required':![]},{'model':db[_0x0bc7('0x98')],'as':_0x0bc7('0xad'),'attributes':[_0x0bc7('0x37'),_0x0bc7('0xae'),_0x0bc7('0xaf')],'required':![]},{'model':db[_0x0bc7('0xb0')],'as':_0x0bc7('0xb1'),'attributes':['id','name','color'],'where':_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0xb2')]?{'id':_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0xb2')]}:undefined,'required':_0x129a8b[_0x0bc7('0x40')]['tag']?!![]:![]}];}return db[_0x0bc7('0x87')][_0x0bc7('0x50')](_0x545498);})[_0x0bc7('0x33')](function(_0x2437c0){_0x1bb5be[_0x0bc7('0x51')]=_0x2437c0;return _0x1bb5be;});}})['then'](respondWithFilteredResult(_0x1f0c26,_0x545498))['catch'](handleError(_0x1f0c26,null));};exports[_0x0bc7('0xb3')]=function(_0xeaf929,_0x5dfd9f,_0x259b4f){return db['OpenchannelAccount'][_0x0bc7('0x55')]({'where':{'id':_0xeaf929[_0x0bc7('0x53')]['id']}})['then'](handleEntityNotFound(_0x5dfd9f,null))[_0x0bc7('0x33')](function(_0x3adebf){if(_0x3adebf){return _0x3adebf['addAgents'](_0xeaf929[_0x0bc7('0x56')][_0x0bc7('0x67')],_[_0x0bc7('0xb4')](_0xeaf929[_0x0bc7('0x56')],[_0x0bc7('0x67'),'id'])||{})['spread'](function(_0x445996){for(var _0x50dc66=0x0;_0x50dc66<_0xeaf929['body'][_0x0bc7('0x67')][_0x0bc7('0x6a')];_0x50dc66+=0x1){socket[_0x0bc7('0xb5')](_0x0bc7('0xb6'),{'UserId':Number(_0xeaf929[_0x0bc7('0x56')][_0x0bc7('0x67')][_0x50dc66]),'OpenchannelAccountId':Number(_0xeaf929[_0x0bc7('0x53')]['id'])});}return _0x445996;});}})[_0x0bc7('0x33')](respondWithResult(_0x5dfd9f,null))['catch'](handleError(_0x5dfd9f,null));};exports['removeAgents']=function(_0x1013c3,_0x15fb2e,_0x39b80e){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0x1013c3['params']['id']}})['then'](handleEntityNotFound(_0x15fb2e,null))[_0x0bc7('0x33')](function(_0x616eb2){if(_0x616eb2){return _0x616eb2[_0x0bc7('0xb7')](_0x1013c3['query'][_0x0bc7('0x67')])['then'](function(){if(_['isArray'](_0x1013c3[_0x0bc7('0x40')][_0x0bc7('0x67')])){for(var _0x22b255=0x0;_0x22b255<_0x1013c3[_0x0bc7('0x40')][_0x0bc7('0x67')][_0x0bc7('0x6a')];_0x22b255+=0x1){socket[_0x0bc7('0xb5')](_0x0bc7('0xb8'),{'UserId':Number(_0x1013c3[_0x0bc7('0x40')][_0x0bc7('0x67')][_0x22b255]),'OpenchannelAccountId':Number(_0x1013c3[_0x0bc7('0x53')]['id'])});}}else{socket['emit'](_0x0bc7('0xb8'),{'UserId':Number(_0x1013c3[_0x0bc7('0x40')][_0x0bc7('0x67')]),'OpenchannelAccountId':Number(_0x1013c3[_0x0bc7('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x15fb2e,null))[_0x0bc7('0x28')](handleError(_0x15fb2e,null));};exports['getAgents']=function(_0x21824c,_0x16ed19,_0x2b4e0f){var _0x3a8f3e={};var _0x88feac={};var _0x5b0a74;var _0x314d33;return db['OpenchannelAccount'][_0x0bc7('0x62')]({'where':{'id':_0x21824c[_0x0bc7('0x53')]['id']}})['then'](handleEntityNotFound(_0x16ed19,null))[_0x0bc7('0x33')](function(_0x42e045){if(_0x42e045){_0x5b0a74=_0x42e045;_0x88feac[_0x0bc7('0x3e')]=_[_0x0bc7('0x3f')](db[_0x0bc7('0x98')][_0x0bc7('0x63')]);_0x88feac[_0x0bc7('0x40')]=_[_0x0bc7('0x3f')](_0x21824c[_0x0bc7('0x40')]);_0x88feac[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x88feac[_0x0bc7('0x3e')],_0x88feac[_0x0bc7('0x40')]);_0x3a8f3e[_0x0bc7('0x43')]=_['intersection'](_0x88feac[_0x0bc7('0x3e')],qs[_0x0bc7('0x44')](_0x21824c[_0x0bc7('0x40')][_0x0bc7('0x44')]));_0x3a8f3e[_0x0bc7('0x43')]=_0x3a8f3e[_0x0bc7('0x43')][_0x0bc7('0x6a')]?_0x3a8f3e['attributes']:_0x88feac[_0x0bc7('0x3e')];_0x3a8f3e[_0x0bc7('0x47')]=qs[_0x0bc7('0x48')](_0x21824c['query'][_0x0bc7('0x48')]);_0x3a8f3e['where']=qs[_0x0bc7('0x41')](_[_0x0bc7('0x4a')](_0x21824c[_0x0bc7('0x40')],_0x88feac['filters']));if(_0x21824c[_0x0bc7('0x40')]['filter']){_0x3a8f3e[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x3a8f3e['where'],{'$or':_[_0x0bc7('0x3a')](_0x3a8f3e[_0x0bc7('0x43')],function(_0x1ffa3a){var _0x198791={};_0x198791[_0x1ffa3a]={'$like':'%'+_0x21824c[_0x0bc7('0x40')][_0x0bc7('0x4b')]+'%'};return _0x198791;})});}_0x3a8f3e=_[_0x0bc7('0x4c')]({},_0x3a8f3e,_0x21824c[_0x0bc7('0x64')]);return _0x5b0a74['getAgents'](_0x3a8f3e);}})[_0x0bc7('0x33')](function(_0x11c597){if(_0x11c597){_0x314d33=_0x11c597[_0x0bc7('0x6a')];if(!_0x21824c[_0x0bc7('0x40')][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x3a8f3e[_0x0bc7('0x2f')]=qs[_0x0bc7('0x2f')](_0x21824c[_0x0bc7('0x40')][_0x0bc7('0x2f')]);_0x3a8f3e[_0x0bc7('0x2c')]=qs[_0x0bc7('0x2c')](_0x21824c['query']['offset']);}return _0x5b0a74[_0x0bc7('0xb9')](_0x3a8f3e);}})['then'](function(_0xa2509d){if(_0xa2509d){return _0xa2509d?{'count':_0x314d33,'rows':_0xa2509d}:null;}})['then'](respondWithResult(_0x16ed19,null))[_0x0bc7('0x28')](handleError(_0x16ed19,null));};exports['send']=function(_0x14d76c,_0xd60f10,_0x3cd451){var _0x4a0b50,_0x3f0be6,_0x19bd8b;if(_['isNil'](_0x14d76c['body']['body'])||_0x14d76c[_0x0bc7('0x56')][_0x0bc7('0x56')]===''){throw new db[(_0x0bc7('0x6d'))][(_0x0bc7('0x6e'))](_0x0bc7('0x77'));}if(_[_0x0bc7('0x74')](_0x14d76c[_0x0bc7('0x56')]['to'])){}_0x4a0b50=_0x14d76c['body']['to'];return db['OpenchannelAccount'][_0x0bc7('0x62')]({'where':{'id':_0x14d76c['params']['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0xd60f10,null))['then'](function(_0xbf9599){if(_0xbf9599){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0xbf9599['id']},'include':[{'model':db[_0x0bc7('0xba')],'as':_0x0bc7('0x7b'),'include':[{'model':db[_0x0bc7('0x6c')],'as':_0x0bc7('0x7c'),'where':{[_0xbf9599[_0x0bc7('0x78')]]:_0x4a0b50},'limit':0x1,'order':[[_0x0bc7('0x72'),'DESC']]}]}]})[_0x0bc7('0x33')](handleEntityNotFound(_0xd60f10,null))[_0x0bc7('0x33')](function(_0x4ffb42){if(_0x4ffb42&&_0x4ffb42[_0x0bc7('0x7b')]){_0x3f0be6=_0x4ffb42[_0x0bc7('0x34')]({'plain':!![]});if(_0x3f0be6[_0x0bc7('0x7b')]&&_0x3f0be6[_0x0bc7('0x7b')][_0x0bc7('0x7c')][_0x0bc7('0x6a')]){return _0x3f0be6[_0x0bc7('0x7b')]['Contacts'][0x0];}return db[_0x0bc7('0x6c')][_0x0bc7('0x5c')](_[_0x0bc7('0x18')](_0x14d76c[_0x0bc7('0x56')],{'firstName':_0x4a0b50,[_0x4ffb42['mapKey']]:_0x4a0b50,'phone':_0x4a0b50,'ListId':_0x3f0be6['ListId']}));}})[_0x0bc7('0x33')](handleEntityNotFound(_0xd60f10,null))[_0x0bc7('0x33')](function(_0x38794d){if(_0x38794d){_0x19bd8b=_0x38794d;return db[_0x0bc7('0x87')][_0x0bc7('0x55')]({'where':{'ContactId':_0x19bd8b['id'],'closed':![],'OpenchannelAccountId':_0x3f0be6['id']}})[_0x0bc7('0x33')](function(_0x578fb8){if(_0x578fb8){return[_0x578fb8,![]];}return db[_0x0bc7('0x87')][_0x0bc7('0x5c')]({'UserId':_0x14d76c['user']['id'],'ContactId':_0x19bd8b['id'],'OpenchannelAccountId':_0x3f0be6['id'],'lastMsgDirection':_0x0bc7('0xbb'),'Messages':[_[_0x0bc7('0x4c')](_0x14d76c[_0x0bc7('0x56')],{'read':![],'body':_0x14d76c[_0x0bc7('0x56')][_0x0bc7('0x56')],'OpenchannelAccountId':_0x3f0be6['id'],'UserId':_0x14d76c[_0x0bc7('0x57')]['id'],'ContactId':_0x19bd8b['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x0bc7('0xbc')}]})[_0x0bc7('0x33')](function(_0x45cfd1){return[_0x45cfd1,!![]];});});}})[_0x0bc7('0x8a')](function(_0x529614,_0xd139ac){if(_0xd139ac){return _0x529614;}return db[_0x0bc7('0x95')][_0x0bc7('0x5c')](_[_0x0bc7('0x4c')](_0x14d76c[_0x0bc7('0x56')],{'read':![],'body':_0x14d76c[_0x0bc7('0x56')][_0x0bc7('0x56')],'OpenchannelAccountId':_0x3f0be6['id'],'OpenchannelInteractionId':_0x529614['id'],'UserId':_0x14d76c[_0x0bc7('0x57')]['id'],'ContactId':_0x19bd8b['id']}))['then'](function(_0x2cc445){_0x529614[_0x0bc7('0xbd')][_0x0bc7('0xbc')]=[];_0x529614['dataValues'][_0x0bc7('0xbc')][_0x0bc7('0x91')](_0x2cc445[_0x0bc7('0xbd')]);return _0x529614;});});}})[_0x0bc7('0x33')](respondWithResult(_0xd60f10,null))[_0x0bc7('0x28')](handleError(_0xd60f10,null));}; \ No newline at end of file +var _0x1da1=['Contacts','OpenchannelApplication','Applications','List','account','applications','list','orderBy','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','push','unmanaged','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','stack','finally','sendStatus','send','getApplications','hasOwnProperty','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','User','DESC','out','Messages','dataValues','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','name','index','Pause','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','OpenchannelAccount','includeAll','include','rows','params','mandatoryDispositionPause','options','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','describe','addDisposition','getDispositions','findOne','Disposition','rawAttributes','findAll','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','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','CmList'];(function(_0x189b3f,_0x281b9c){var _0x207ecd=function(_0x44950f){while(--_0x44950f){_0x189b3f['push'](_0x189b3f['shift']());}};_0x207ecd(++_0x281b9c);}(_0x1da1,0x1d1));var _0x11da=function(_0x5ada5f,_0x3bed7a){_0x5ada5f=_0x5ada5f-0x0;var _0x548a16=_0x1da1[_0x5ada5f];return _0x548a16;};'use strict';var emlformat=require(_0x11da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11da('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11da('0x2'));var moment=require(_0x11da('0x3'));var BPromise=require(_0x11da('0x4'));var Mustache=require('mustache');var util=require(_0x11da('0x5'));var path=require(_0x11da('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x11da('0x7'));var fs=require('fs');var fs_extra=require(_0x11da('0x8'));var _=require(_0x11da('0x9'));var squel=require('squel');var crypto=require(_0x11da('0xa'));var jsforce=require(_0x11da('0xb'));var deskjs=require(_0x11da('0xc'));var toCsv=require(_0x11da('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x11da('0xe'));var qs=require(_0x11da('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x11da('0x10'))(_0x11da('0x11'));var utils=require(_0x11da('0x12'));var config=require(_0x11da('0x13'));var licenseUtil=require(_0x11da('0x14'));var db=require(_0x11da('0x15'))['db'];config[_0x11da('0x16')]=_[_0x11da('0x17')](config['redis'],{'host':_0x11da('0x18'),'port':0x18eb});var socket=require(_0x11da('0x19'))(new Redis(config[_0x11da('0x16')]));require(_0x11da('0x1a'))['register'](socket);var jayson=require(_0x11da('0x1b'));var client=jayson[_0x11da('0x1c')][_0x11da('0x1d')]({'port':0x232c});var client9002=jayson[_0x11da('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c4cb9,_0x4ea3ab,_0x4e9277,_0x463a36){return new BPromise(function(_0x596bf8,_0x85dd25){var _0x407bff=_0x463a36||client;return _0x407bff[_0x11da('0x1e')](_0x2c4cb9,_0x4e9277)[_0x11da('0x1f')](function(_0x53021b){logger[_0x11da('0x20')](_0x11da('0x21'),_0x4ea3ab,_0x11da('0x22'));logger[_0x11da('0x23')](_0x11da('0x24'),_0x4ea3ab,'request\x20sent',JSON[_0x11da('0x25')](_0x53021b));if(_0x53021b[_0x11da('0x26')]){if(_0x53021b[_0x11da('0x26')][_0x11da('0x27')]===0x1f4){logger[_0x11da('0x26')](_0x11da('0x21'),_0x4ea3ab,_0x53021b[_0x11da('0x26')]['message']);return _0x85dd25(_0x53021b[_0x11da('0x26')]['message']);}logger[_0x11da('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x4ea3ab,_0x53021b['error'][_0x11da('0x28')]);return _0x596bf8(_0x53021b['error'][_0x11da('0x28')]);}else{logger[_0x11da('0x20')](_0x11da('0x21'),_0x4ea3ab,'request\x20sent');_0x596bf8(_0x53021b[_0x11da('0x29')][_0x11da('0x28')]);}})[_0x11da('0x2a')](function(_0x4267eb){logger['error'](_0x11da('0x21'),_0x4ea3ab,_0x4267eb);_0x85dd25(_0x4267eb);});});}function respondWithStatusCode(_0x2126e4,_0x558498){_0x558498=_0x558498||0xcc;return function(_0x4ffbf4){if(_0x4ffbf4){return _0x2126e4['sendStatus'](_0x558498);}return _0x2126e4[_0x11da('0x2b')](_0x558498)[_0x11da('0x2c')]();};}function respondWithResult(_0x13eecf,_0x5722f4){_0x5722f4=_0x5722f4||0xc8;return function(_0x4d1450){if(_0x4d1450){return _0x13eecf[_0x11da('0x2b')](_0x5722f4)[_0x11da('0x2d')](_0x4d1450);}};}function respondWithFilteredResult(_0x1ef671,_0x201c44){return function(_0x4cece2){if(_0x4cece2){var _0x23e74c=typeof _0x201c44[_0x11da('0x2e')]===_0x11da('0x2f')&&typeof _0x201c44['limit']===_0x11da('0x2f');var _0x1b1f5f=_0x4cece2[_0x11da('0x30')];var _0x41ee85=_0x23e74c?0x0:_0x201c44[_0x11da('0x2e')];var _0x5e9265=_0x23e74c?_0x4cece2['count']:_0x201c44[_0x11da('0x2e')]+_0x201c44[_0x11da('0x31')];var _0x2f329b;if(_0x5e9265>=_0x1b1f5f){_0x5e9265=_0x1b1f5f;_0x2f329b=0xc8;}else{_0x2f329b=0xce;}_0x1ef671['status'](_0x2f329b);return _0x1ef671[_0x11da('0x32')](_0x11da('0x33'),_0x41ee85+'-'+_0x5e9265+'/'+_0x1b1f5f)[_0x11da('0x2d')](_0x4cece2);}return null;};}function patchUpdates(_0x1382de){return function(_0x31cbcb){try{jsonpatch[_0x11da('0x34')](_0x31cbcb,_0x1382de,!![]);}catch(_0xb27cb6){return BPromise[_0x11da('0x35')](_0xb27cb6);}return _0x31cbcb[_0x11da('0x36')]();};}function saveUpdates(_0x2382a0,_0x378e10){return function(_0x3d708a){if(_0x3d708a){return _0x3d708a['update'](_0x2382a0)[_0x11da('0x1f')](function(_0x3f9e45){return _0x3f9e45;});}return null;};}function removeEntity(_0x31cd08,_0x5f3ba6){return function(_0xde5055){if(_0xde5055){return _0xde5055[_0x11da('0x37')]()[_0x11da('0x1f')](function(){var _0x5d2284=_0xde5055[_0x11da('0x38')]({'plain':!![]});var _0x23e1b0=_0x11da('0x39');return db['UserProfileResource'][_0x11da('0x37')]({'where':{'type':_0x23e1b0,'resourceId':_0x5d2284['id']}})[_0x11da('0x1f')](function(){return _0xde5055;});})[_0x11da('0x1f')](function(){_0x31cd08['status'](0xcc)[_0x11da('0x2c')]();});}};}function handleEntityNotFound(_0x47c557,_0xd0d6e2){return function(_0x44722){if(!_0x44722){_0x47c557['sendStatus'](0x194);}return _0x44722;};}function handleError(_0x2d1ec5,_0x437236){_0x437236=_0x437236||0x1f4;return function(_0x29d0f2){logger[_0x11da('0x26')](_0x29d0f2['stack']);if(_0x29d0f2['name']){delete _0x29d0f2[_0x11da('0x3a')];}_0x2d1ec5[_0x11da('0x2b')](_0x437236)['send'](_0x29d0f2);};}exports[_0x11da('0x3b')]=function(_0x5451df,_0x2073ea){var _0x39f8a5={'include':[{'model':db[_0x11da('0x3c')],'as':'mandatoryDispositionPause'}]},_0x373332={},_0x166caa={'count':0x0,'rows':[]};var _0x538db0=_[_0x11da('0x3d')](db['OpenchannelAccount']['rawAttributes'],function(_0x5d8709){return{'name':_0x5d8709[_0x11da('0x3e')],'type':_0x5d8709['type'][_0x11da('0x3f')]};});_0x373332['model']=_[_0x11da('0x3d')](_0x538db0,_0x11da('0x3a'));_0x373332[_0x11da('0x40')]=_[_0x11da('0x41')](_0x5451df[_0x11da('0x40')]);_0x373332[_0x11da('0x42')]=_[_0x11da('0x43')](_0x373332[_0x11da('0x44')],_0x373332[_0x11da('0x40')]);_0x39f8a5[_0x11da('0x45')]=_[_0x11da('0x43')](_0x373332['model'],qs['fields'](_0x5451df[_0x11da('0x40')][_0x11da('0x46')]));_0x39f8a5['attributes']=_0x39f8a5[_0x11da('0x45')][_0x11da('0x47')]?_0x39f8a5['attributes']:_0x373332[_0x11da('0x44')];if(!_0x5451df[_0x11da('0x40')]['hasOwnProperty'](_0x11da('0x48'))){_0x39f8a5[_0x11da('0x31')]=qs[_0x11da('0x31')](_0x5451df[_0x11da('0x40')]['limit']);_0x39f8a5['offset']=qs[_0x11da('0x2e')](_0x5451df[_0x11da('0x40')]['offset']);}_0x39f8a5[_0x11da('0x49')]=qs[_0x11da('0x4a')](_0x5451df[_0x11da('0x40')][_0x11da('0x4a')]);_0x39f8a5[_0x11da('0x4b')]=qs[_0x11da('0x42')](_[_0x11da('0x4c')](_0x5451df[_0x11da('0x40')],_0x373332[_0x11da('0x42')]),_0x538db0);if(_0x5451df['query'][_0x11da('0x4d')]){_0x39f8a5[_0x11da('0x4b')]=_[_0x11da('0x4e')](_0x39f8a5[_0x11da('0x4b')],{'$or':_[_0x11da('0x3d')](_0x538db0,function(_0x3fe989){if(_0x3fe989[_0x11da('0x4f')]!=='VIRTUAL'){var _0x3fa637={};_0x3fa637[_0x3fe989['name']]={'$like':'%'+_0x5451df['query'][_0x11da('0x4d')]+'%'};return _0x3fa637;}})});}_0x39f8a5=_['merge']({},_0x39f8a5,_0x5451df['options']);var _0x541bb0={'where':_0x39f8a5[_0x11da('0x4b')]};return db[_0x11da('0x50')][_0x11da('0x30')](_0x541bb0)[_0x11da('0x1f')](function(_0x25684f){_0x166caa[_0x11da('0x30')]=_0x25684f;if(_0x5451df[_0x11da('0x40')][_0x11da('0x51')]){_0x39f8a5[_0x11da('0x52')]=[{'all':!![]}];}return db[_0x11da('0x50')]['findAll'](_0x39f8a5);})[_0x11da('0x1f')](function(_0x9b1c48){_0x166caa[_0x11da('0x53')]=_0x9b1c48;return _0x166caa;})['then'](respondWithFilteredResult(_0x2073ea,_0x39f8a5))[_0x11da('0x2a')](handleError(_0x2073ea,null));};exports['show']=function(_0x39d0a4,_0x5789ab){var _0x1817d5={'raw':![],'where':{'id':_0x39d0a4[_0x11da('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x11da('0x55')}]},_0x27e4c4={};_0x27e4c4[_0x11da('0x44')]=_[_0x11da('0x41')](db[_0x11da('0x50')]['rawAttributes']);_0x27e4c4[_0x11da('0x40')]=_[_0x11da('0x41')](_0x39d0a4['query']);_0x27e4c4[_0x11da('0x42')]=_[_0x11da('0x43')](_0x27e4c4[_0x11da('0x44')],_0x27e4c4['query']);_0x1817d5[_0x11da('0x45')]=_['intersection'](_0x27e4c4[_0x11da('0x44')],qs[_0x11da('0x46')](_0x39d0a4['query'][_0x11da('0x46')]));_0x1817d5[_0x11da('0x45')]=_0x1817d5[_0x11da('0x45')]['length']?_0x1817d5['attributes']:_0x27e4c4['model'];if(_0x39d0a4[_0x11da('0x40')]['includeAll']){_0x1817d5[_0x11da('0x52')]=[{'all':!![]}];}_0x1817d5=_[_0x11da('0x4e')]({},_0x1817d5,_0x39d0a4[_0x11da('0x56')]);return db[_0x11da('0x50')][_0x11da('0x57')](_0x1817d5)[_0x11da('0x1f')](handleEntityNotFound(_0x5789ab,null))[_0x11da('0x1f')](respondWithResult(_0x5789ab,null))[_0x11da('0x2a')](handleError(_0x5789ab,null));};exports[_0x11da('0x58')]=function(_0x3e328e,_0x564c19){return db[_0x11da('0x50')]['create'](_0x3e328e[_0x11da('0x59')],{})[_0x11da('0x1f')](function(_0x10679c){var _0x813f57=_0x3e328e[_0x11da('0x5a')][_0x11da('0x38')]({'plain':!![]});if(!_0x813f57)throw new Error(_0x11da('0x5b'));if(_0x813f57[_0x11da('0x5c')]==='user'){var _0x3050b1=_0x10679c[_0x11da('0x38')]({'plain':!![]});var _0x15fc33=_0x11da('0x39');return db[_0x11da('0x5d')][_0x11da('0x57')]({'where':{'name':_0x15fc33,'userProfileId':_0x813f57[_0x11da('0x5e')]},'raw':!![]})[_0x11da('0x1f')](function(_0x1da803){if(_0x1da803&&_0x1da803[_0x11da('0x5f')]===0x0){return db[_0x11da('0x60')][_0x11da('0x58')]({'name':_0x3050b1[_0x11da('0x3a')],'resourceId':_0x3050b1['id'],'type':_0x1da803['name'],'sectionId':_0x1da803['id']},{})[_0x11da('0x1f')](function(){return _0x10679c;});}else{return _0x10679c;}})[_0x11da('0x2a')](function(_0x438fc2){logger[_0x11da('0x26')](_0x11da('0x61'),_0x438fc2);throw _0x438fc2;});}return _0x10679c;})[_0x11da('0x1f')](respondWithResult(_0x564c19,0xc9))['catch'](handleError(_0x564c19,null));};exports[_0x11da('0x62')]=function(_0x5d0aee,_0x4d348e){if(_0x5d0aee['body']['id']){delete _0x5d0aee[_0x11da('0x59')]['id'];}return db[_0x11da('0x50')][_0x11da('0x57')]({'where':{'id':_0x5d0aee[_0x11da('0x54')]['id']},'include':[{'model':db[_0x11da('0x3c')],'as':_0x11da('0x55')}]})['then'](handleEntityNotFound(_0x4d348e,null))['then'](saveUpdates(_0x5d0aee[_0x11da('0x59')],null))[_0x11da('0x1f')](respondWithResult(_0x4d348e,null))[_0x11da('0x2a')](handleError(_0x4d348e,null));};exports[_0x11da('0x37')]=function(_0x5d9783,_0x1c536a){return db[_0x11da('0x50')][_0x11da('0x57')]({'where':{'id':_0x5d9783['params']['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0x1c536a,null))[_0x11da('0x1f')](removeEntity(_0x1c536a,null))[_0x11da('0x2a')](handleError(_0x1c536a,null));};exports[_0x11da('0x63')]=function(_0xd3c2a2,_0x22da30){return db[_0x11da('0x50')][_0x11da('0x63')]()[_0x11da('0x1f')](respondWithResult(_0x22da30,null))[_0x11da('0x2a')](handleError(_0x22da30,null));};exports[_0x11da('0x64')]=function(_0x542113,_0x2d16e0,_0x484872){if(_0x542113[_0x11da('0x59')]['id']){delete _0x542113[_0x11da('0x59')]['id'];}return db[_0x11da('0x50')][_0x11da('0x57')]({'where':{'id':_0x542113['params']['id']}})['then'](handleEntityNotFound(_0x2d16e0,null))[_0x11da('0x1f')](function(_0x3274dc){if(_0x3274dc){_0x542113['body']['OpenchannelAccountId']=_0x3274dc['id'];return db['Disposition'][_0x11da('0x58')](_0x542113['body']);}})['then'](respondWithResult(_0x2d16e0,null))[_0x11da('0x2a')](handleError(_0x2d16e0,null));};exports[_0x11da('0x65')]=function(_0x50b2d4,_0x131210,_0x50acf6){var _0x4e3c22={'raw':![],'where':{}};var _0x7da28c={};var _0x28897d={'count':0x0,'rows':[]};return db[_0x11da('0x50')][_0x11da('0x66')]({'where':{'id':_0x50b2d4[_0x11da('0x54')]['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0x131210,null))[_0x11da('0x1f')](function(_0x11c2bf){if(_0x11c2bf){_0x7da28c[_0x11da('0x44')]=_[_0x11da('0x41')](db[_0x11da('0x67')][_0x11da('0x68')]);_0x7da28c[_0x11da('0x40')]=_[_0x11da('0x41')](_0x50b2d4[_0x11da('0x40')]);_0x7da28c['filters']=_[_0x11da('0x43')](_0x7da28c['model'],_0x7da28c['query']);_0x4e3c22[_0x11da('0x45')]=_[_0x11da('0x43')](_0x7da28c[_0x11da('0x44')],qs['fields'](_0x50b2d4['query'][_0x11da('0x46')]));_0x4e3c22[_0x11da('0x45')]=_0x4e3c22[_0x11da('0x45')][_0x11da('0x47')]?_0x4e3c22['attributes']:_0x7da28c[_0x11da('0x44')];if(!_0x50b2d4[_0x11da('0x40')]['hasOwnProperty']('nolimit')){_0x4e3c22[_0x11da('0x31')]=qs['limit'](_0x50b2d4['query'][_0x11da('0x31')]);_0x4e3c22[_0x11da('0x2e')]=qs[_0x11da('0x2e')](_0x50b2d4['query'][_0x11da('0x2e')]);}_0x4e3c22[_0x11da('0x49')]=qs[_0x11da('0x4a')](_0x50b2d4['query']['sort']);_0x4e3c22['where']=qs[_0x11da('0x42')](_['pick'](_0x50b2d4['query'],_0x7da28c['filters']));_0x4e3c22['where']['OpenchannelAccountId']=_0x11c2bf['id'];if(_0x50b2d4['query'][_0x11da('0x4d')]){_0x4e3c22[_0x11da('0x4b')]=_[_0x11da('0x4e')](_0x4e3c22[_0x11da('0x4b')],{'$or':_[_0x11da('0x3d')](_0x4e3c22[_0x11da('0x45')],function(_0x54027f){var _0x4370a8={};_0x4370a8[_0x54027f]={'$like':'%'+_0x50b2d4['query'][_0x11da('0x4d')]+'%'};return _0x4370a8;})});}_0x4e3c22=_['merge']({},_0x4e3c22,_0x50b2d4[_0x11da('0x56')]);return db['Disposition'][_0x11da('0x30')]({'where':_0x4e3c22[_0x11da('0x4b')]})[_0x11da('0x1f')](function(_0x2835c4){_0x28897d['count']=_0x2835c4;if(_0x50b2d4[_0x11da('0x40')][_0x11da('0x51')]){_0x4e3c22['include']=[{'all':!![]}];}return db[_0x11da('0x67')][_0x11da('0x69')](_0x4e3c22);})[_0x11da('0x1f')](function(_0xf103a){_0x28897d['rows']=_0xf103a;return _0x28897d;});}})[_0x11da('0x1f')](respondWithFilteredResult(_0x131210,_0x4e3c22))[_0x11da('0x2a')](handleError(_0x131210,null));};exports[_0x11da('0x6a')]=function(_0x1d7719,_0x22217e,_0x4f5da3){return db[_0x11da('0x50')][_0x11da('0x57')]({'where':{'id':_0x1d7719['params']['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0x22217e,null))[_0x11da('0x1f')](function(_0xbec3b5){if(_0xbec3b5){return _0xbec3b5[_0x11da('0x6a')](_0x1d7719[_0x11da('0x40')][_0x11da('0x6b')]);}})['then'](respondWithStatusCode(_0x22217e,null))[_0x11da('0x2a')](handleError(_0x22217e,null));};exports[_0x11da('0x6c')]=function(_0x2795de,_0x4371c8,_0x1b910d){if(_0x2795de[_0x11da('0x59')]['id']){delete _0x2795de[_0x11da('0x59')]['id'];}return db[_0x11da('0x50')][_0x11da('0x57')]({'where':{'id':_0x2795de['params']['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0x4371c8,null))['then'](function(_0x2a4e8a){if(_0x2a4e8a){_0x2795de[_0x11da('0x59')][_0x11da('0x6d')]=_0x2a4e8a['id'];return db[_0x11da('0x6e')][_0x11da('0x58')](_0x2795de[_0x11da('0x59')]);}})[_0x11da('0x1f')](respondWithResult(_0x4371c8,null))[_0x11da('0x2a')](handleError(_0x4371c8,null));};exports['getAnswers']=function(_0x372480,_0x274f89,_0x4c5b08){var _0xd3d4c8={'raw':![],'where':{}};var _0x511372={};var _0x202d74={'count':0x0,'rows':[]};return db[_0x11da('0x50')]['findOne']({'where':{'id':_0x372480['params']['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0x274f89,null))['then'](function(_0x93e3ec){if(_0x93e3ec){_0x511372[_0x11da('0x44')]=_[_0x11da('0x41')](db[_0x11da('0x6e')][_0x11da('0x68')]);_0x511372['query']=_[_0x11da('0x41')](_0x372480[_0x11da('0x40')]);_0x511372['filters']=_[_0x11da('0x43')](_0x511372[_0x11da('0x44')],_0x511372[_0x11da('0x40')]);_0xd3d4c8[_0x11da('0x45')]=_['intersection'](_0x511372[_0x11da('0x44')],qs['fields'](_0x372480[_0x11da('0x40')][_0x11da('0x46')]));_0xd3d4c8[_0x11da('0x45')]=_0xd3d4c8[_0x11da('0x45')][_0x11da('0x47')]?_0xd3d4c8[_0x11da('0x45')]:_0x511372[_0x11da('0x44')];if(!_0x372480[_0x11da('0x40')]['hasOwnProperty'](_0x11da('0x48'))){_0xd3d4c8[_0x11da('0x31')]=qs[_0x11da('0x31')](_0x372480[_0x11da('0x40')][_0x11da('0x31')]);_0xd3d4c8[_0x11da('0x2e')]=qs['offset'](_0x372480[_0x11da('0x40')][_0x11da('0x2e')]);}_0xd3d4c8[_0x11da('0x49')]=qs[_0x11da('0x4a')](_0x372480[_0x11da('0x40')]['sort']);_0xd3d4c8['where']=qs[_0x11da('0x42')](_[_0x11da('0x4c')](_0x372480['query'],_0x511372[_0x11da('0x42')]));_0xd3d4c8['where'][_0x11da('0x6d')]=_0x93e3ec['id'];if(_0x372480[_0x11da('0x40')][_0x11da('0x4d')]){_0xd3d4c8[_0x11da('0x4b')]=_[_0x11da('0x4e')](_0xd3d4c8[_0x11da('0x4b')],{'$or':_[_0x11da('0x3d')](_0xd3d4c8[_0x11da('0x45')],function(_0x26ec86){var _0x498e35={};_0x498e35[_0x26ec86]={'$like':'%'+_0x372480[_0x11da('0x40')][_0x11da('0x4d')]+'%'};return _0x498e35;})});}_0xd3d4c8=_['merge']({},_0xd3d4c8,_0x372480['options']);return db[_0x11da('0x6e')][_0x11da('0x30')]({'where':_0xd3d4c8['where']})[_0x11da('0x1f')](function(_0x19ec92){_0x202d74[_0x11da('0x30')]=_0x19ec92;if(_0x372480[_0x11da('0x40')]['includeAll']){_0xd3d4c8[_0x11da('0x52')]=[{'all':!![]}];}return db[_0x11da('0x6e')]['findAll'](_0xd3d4c8);})['then'](function(_0x43f446){_0x202d74[_0x11da('0x53')]=_0x43f446;return _0x202d74;});}})[_0x11da('0x1f')](respondWithFilteredResult(_0x274f89,_0xd3d4c8))[_0x11da('0x2a')](handleError(_0x274f89,null));};exports[_0x11da('0x6f')]=function(_0x376b4f,_0x257f03,_0x65f1df){return db[_0x11da('0x50')]['find']({'where':{'id':_0x376b4f[_0x11da('0x54')]['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0x257f03,null))[_0x11da('0x1f')](function(_0x347dfc){if(_0x347dfc){return _0x347dfc[_0x11da('0x6f')](_0x376b4f[_0x11da('0x40')][_0x11da('0x6b')]);}})['then'](respondWithStatusCode(_0x257f03,null))[_0x11da('0x2a')](handleError(_0x257f03,null));};exports[_0x11da('0x70')]=function(_0x100093,_0x2f1132,_0x2ca31a){var _0x4c99b9={'body':_0x100093[_0x11da('0x59')],'channel':_0x11da('0x71')};var _0x43e1b2=[];var _0x3498d1=[];var _0x15d3ce={};var _0xc192cc=![];return db[_0x11da('0x72')][_0x11da('0x63')]()[_0x11da('0x1f')](function(_0x1393b1){if(!_0x1393b1){throw new db[(_0x11da('0x73'))][(_0x11da('0x74'))](_0x11da('0x75'));}_0x43e1b2=_[_0x11da('0x76')](_[_0x11da('0x41')](_0x1393b1),['createdAt',_0x11da('0x77')]);_0x3498d1=_[_0x11da('0x76')](_[_0x11da('0x41')](_0x1393b1),[_0x11da('0x78'),_0x11da('0x77'),_0x11da('0x79'),_0x11da('0x7a')]);if(_0x100093[_0x11da('0x59')]['id']){delete _0x100093['body']['id'];}if(_[_0x11da('0x7b')](_0x100093[_0x11da('0x59')][_0x11da('0x7c')])){throw new db[(_0x11da('0x73'))][(_0x11da('0x74'))](_0x11da('0x7d'));}if(_['isNil'](_0x100093[_0x11da('0x59')]['body'])||_0x100093[_0x11da('0x59')][_0x11da('0x59')]===''){throw new db[(_0x11da('0x73'))]['ValidationError'](_0x11da('0x7e'));}if(_[_0x11da('0x7b')](_0x100093[_0x11da('0x59')][_0x11da('0x7f')])){throw new db['Sequelize']['ValidationError'](_0x11da('0x80')+_0x3498d1);}if(!_[_0x11da('0x81')](_0x3498d1,_0x100093[_0x11da('0x59')]['mapKey'])){throw new db[(_0x11da('0x73'))][(_0x11da('0x74'))](_0x11da('0x82')+_0x3498d1);}_0x15d3ce[_0x100093[_0x11da('0x59')]['mapKey']]=_0x100093[_0x11da('0x59')][_0x11da('0x7c')];})[_0x11da('0x1f')](function(){return db[_0x11da('0x50')][_0x11da('0x57')]({'where':{'id':_0x100093[_0x11da('0x54')]['id']},'include':[{'model':db[_0x11da('0x83')],'as':'List','include':[{'model':db['CmContact'],'as':_0x11da('0x84'),'where':_0x15d3ce,'limit':0x1,'order':[[_0x11da('0x77'),'DESC']]}]},{'model':db[_0x11da('0x85')],'as':_0x11da('0x86')}]});})[_0x11da('0x1f')](handleEntityNotFound(_0x2f1132,null))[_0x11da('0x1f')](function(_0x3c061f){if(_0x3c061f&&_0x3c061f[_0x11da('0x87')]){_0x4c99b9[_0x11da('0x88')]=_0x3c061f;_0x4c99b9[_0x11da('0x89')]=_0x3c061f['Applications'];_0x4c99b9[_0x11da('0x8a')]=_0x3c061f[_0x11da('0x87')];_0x4c99b9[_0x11da('0x89')]=_[_0x11da('0x8b')](_0x4c99b9[_0x11da('0x89')],['priority'],[_0x11da('0x8c')]);if(_0x4c99b9[_0x11da('0x88')][_0x11da('0x86')]){delete _0x4c99b9[_0x11da('0x88')]['Applications'];}if(_0x4c99b9[_0x11da('0x88')]['List']&&_0x4c99b9[_0x11da('0x88')][_0x11da('0x87')][_0x11da('0x84')][_0x11da('0x47')]){return _0x4c99b9['account'][_0x11da('0x87')][_0x11da('0x84')][0x0];}var _0x231995=_[_0x11da('0x17')](_0x100093[_0x11da('0x59')],{'firstName':_0x100093[_0x11da('0x59')][_0x11da('0x7c')],'ListId':_0x3c061f[_0x11da('0x7a')]});_0x231995[_0x100093[_0x11da('0x59')]['mapKey']]=_0x100093[_0x11da('0x59')][_0x11da('0x7c')];return db[_0x11da('0x72')][_0x11da('0x58')](_0x231995,{'fields':_0x43e1b2,'raw':!![]});}})['then'](handleEntityNotFound(_0x2f1132,null))['then'](function(_0xb46e8a){_0x4c99b9[_0x11da('0x8d')]=_0xb46e8a;if(_0xb46e8a){var _0x153267={'ContactId':_0xb46e8a['id'],'OpenchannelAccountId':_0x100093[_0x11da('0x54')]['id'],'from':(_0xb46e8a['firstName']||'')+'\x20'+(_0xb46e8a[_0x11da('0x8e')]||'')};var _0x162d91={'OpenchannelAccountId':_0x100093[_0x11da('0x54')]['id'],'closed':![]};if(_0x100093[_0x11da('0x59')][_0x11da('0x8f')]){_0x162d91[_0x11da('0x8f')]=_0x100093['body']['threadId'];return db[_0x11da('0x90')][_0x11da('0x57')]({'where':_0x162d91})[_0x11da('0x1f')](function(_0x2b5735){if(_0x2b5735){return[_0x2b5735,![]];}_0x153267[_0x11da('0x8f')]=_0x100093['body'][_0x11da('0x8f')];_0x153267['externalUrl']=_0x100093[_0x11da('0x59')][_0x11da('0x91')];return db['OpenchannelInteraction'][_0x11da('0x58')](_0x153267)[_0x11da('0x1f')](function(_0x21544b){return[_0x21544b,!![]];});});}else{_0x162d91[_0x11da('0x8f')]=null;}_0x162d91[_0x11da('0x92')]=_0xb46e8a['id'];return db[_0x11da('0x90')][_0x11da('0x57')]({'where':_0x162d91})[_0x11da('0x1f')](function(_0x4255d3){if(_0x4255d3){return[_0x4255d3,![]];}return db[_0x11da('0x90')][_0x11da('0x58')](_0x153267)[_0x11da('0x1f')](function(_0x5d387b){return[_0x5d387b,!![]];});});}})[_0x11da('0x93')](function(_0x2b4a84,_0x41ffa2){if(_0x2b4a84){_0xc192cc=_0x41ffa2;if(!_0x41ffa2){var _0x12e89d={'from':(_0x4c99b9[_0x11da('0x8d')][_0x11da('0x94')]||'')+'\x20'+(_0x4c99b9[_0x11da('0x8d')][_0x11da('0x8e')]||'')};if(_0x100093[_0x11da('0x59')][_0x11da('0x8f')]&&_0x100093[_0x11da('0x59')][_0x11da('0x95')]&&_0x100093[_0x11da('0x59')]['threadId']!=_0x100093[_0x11da('0x59')]['messageId']){_0x12e89d[_0x11da('0x8f')]=_0x100093['body'][_0x11da('0x95')];}return _0x2b4a84[_0x11da('0x62')](_0x12e89d);}else{return _0x2b4a84;}}})[_0x11da('0x1f')](function(_0x5c5fde){_0x4c99b9['interaction']=_0x5c5fde[_0x11da('0x38')]({'plain':!![]});_0x4c99b9['interaction']['created']=_0xc192cc;if(_0x4c99b9[_0x11da('0x96')][_0x11da('0x97')]){if(_0x4c99b9[_0x11da('0x88')]['autoclose']){_0x4c99b9['applications'][_0x11da('0x98')]({'id':0x0,'priority':_0x4c99b9[_0x11da('0x89')][_0x11da('0x47')]+0x1,'app':'close','appdata':_0x11da('0x99'),'interval':'*,*,*,*'});}}return db[_0x11da('0x9a')]['create']({'body':_0x100093['body'][_0x11da('0x59')],'OpenchannelAccountId':_0x100093[_0x11da('0x54')]['id'],'OpenchannelInteractionId':_0x5c5fde['id'],'direction':'in','ContactId':_0x4c99b9[_0x11da('0x8d')]['id'],'AttachmentId':_0x100093['body'][_0x11da('0x9b')]});})['then'](function(_0x40eb26){_0x4c99b9['message']=_0x40eb26;if(_0x4c99b9[_0x11da('0x96')][_0x11da('0x9c')]){return db['User']['find']({'attributes':['id',_0x11da('0x3a')],'where':{'id':_0x4c99b9[_0x11da('0x96')][_0x11da('0x9c')]}})['then'](function(_0x5d2627){if(_0x5d2627){_0x4c99b9[_0x11da('0x89')][_0x11da('0x9d')]({'id':0x0,'priority':0x0,'app':_0x11da('0x9e'),'appdata':_0x5d2627['name']+','+(_0x4c99b9[_0x11da('0x88')][_0x11da('0x9f')]||0xa),'interval':_0x11da('0xa0')});_0x4c99b9[_0x11da('0xa1')]=![];}return respondWithRpcPromise('Start',_0x11da('0xa2'),_0x4c99b9);});}return respondWithRpcPromise(_0x11da('0xa3'),_0x11da('0xa2'),_0x4c99b9);})[_0x11da('0x1f')](function(_0x31baf2){respondWithRpcPromise(_0x11da('0xa4'),_0x11da('0xa4'),{'event':'notify','message':_0x31baf2},client9002);return _0x31baf2;})['then'](respondWithResult(_0x2f1132,null))[_0x11da('0x2a')](handleError(_0x2f1132,null));};exports[_0x11da('0xa5')]=function(_0x119ec8,_0x596441){var _0x1f432c=_0x119ec8['params']['id'];var _0x1ceb69=_0x119ec8[_0x11da('0x59')];var _0x27f555=0xc8;var _0xe74712=null;return db[_0x11da('0xa6')][_0x11da('0xa7')]({'isolationLevel':db[_0x11da('0xa6')]['Transaction']['ISOLATION_LEVELS'][_0x11da('0xa8')]},function(_0xa82db1){return db[_0x11da('0x50')][_0x11da('0x66')]({'where':{'id':_0x1f432c},'transaction':_0xa82db1})[_0x11da('0x1f')](function(_0x2a4b16){if(_0x2a4b16){return db[_0x11da('0x85')][_0x11da('0x37')]({'where':{'OpenchannelAccountId':_0x1f432c},'transaction':_0xa82db1})[_0x11da('0x1f')](function(){var _0x74d710=_[_0x11da('0x3d')](_0x1ceb69,function(_0x26cd2e){_0x26cd2e[_0x11da('0x6d')]=_0x1f432c;return _0x26cd2e;});return db[_0x11da('0x85')][_0x11da('0xa9')](_0x74d710,{'transaction':_0xa82db1});});}else{_0x27f555=0x194;_0xe74712=[];}});})[_0x11da('0x1f')](function(){if(_0x27f555!==0x194){return db[_0x11da('0x85')][_0x11da('0xaa')]({'where':{'OpenchannelAccountId':_0x1f432c},'order':_0x11da('0xab')})['then'](function(_0x25c272){_0xe74712=_0x25c272;});}})[_0x11da('0x2a')](function(_0x548641){_0x27f555=0x1f4;logger[_0x11da('0x26')](_0x548641[_0x11da('0xac')]);if(_0x548641['name']){delete _0x548641[_0x11da('0x3a')];}_0xe74712=_0x548641;})[_0x11da('0xad')](function(){if(_0xe74712===null){_0x596441[_0x11da('0xae')](_0x27f555);}else{if(_0x27f555===0x1f4){_0x596441[_0x11da('0x2b')](_0x27f555)[_0x11da('0xaf')](_0xe74712);}else{_0x596441['status'](_0x27f555)[_0x11da('0x2d')](_0xe74712);}}});};exports[_0x11da('0xb0')]=function(_0x2c3f8a,_0x106bdc,_0x32275c){var _0xc6eafa={};var _0x49e29e={};var _0x7c7013;var _0x4ea378;return db[_0x11da('0x50')][_0x11da('0x66')]({'where':{'id':_0x2c3f8a[_0x11da('0x54')]['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0x106bdc,null))[_0x11da('0x1f')](function(_0x3e3433){if(_0x3e3433){_0x7c7013=_0x3e3433;_0x49e29e['model']=_[_0x11da('0x41')](db[_0x11da('0x85')][_0x11da('0x68')]);_0x49e29e[_0x11da('0x40')]=_[_0x11da('0x41')](_0x2c3f8a[_0x11da('0x40')]);_0x49e29e['filters']=_[_0x11da('0x43')](_0x49e29e[_0x11da('0x44')],_0x49e29e[_0x11da('0x40')]);_0xc6eafa[_0x11da('0x45')]=_['intersection'](_0x49e29e[_0x11da('0x44')],qs[_0x11da('0x46')](_0x2c3f8a[_0x11da('0x40')]['fields']));_0xc6eafa[_0x11da('0x45')]=_0xc6eafa[_0x11da('0x45')]['length']?_0xc6eafa['attributes']:_0x49e29e[_0x11da('0x44')];_0xc6eafa[_0x11da('0x49')]=qs[_0x11da('0x4a')](_0x2c3f8a[_0x11da('0x40')][_0x11da('0x4a')]);_0xc6eafa[_0x11da('0x4b')]=qs['filters'](_[_0x11da('0x4c')](_0x2c3f8a['query'],_0x49e29e[_0x11da('0x42')]));if(_0x2c3f8a[_0x11da('0x40')]['filter']){_0xc6eafa['where']=_['merge'](_0xc6eafa[_0x11da('0x4b')],{'$or':_[_0x11da('0x3d')](_0xc6eafa['attributes'],function(_0x49486a){var _0x4af240={};_0x4af240[_0x49486a]={'$like':'%'+_0x2c3f8a[_0x11da('0x40')][_0x11da('0x4d')]+'%'};return _0x4af240;})});}_0xc6eafa=_['merge']({},_0xc6eafa,_0x2c3f8a[_0x11da('0x56')]);return _0x7c7013[_0x11da('0xb0')](_0xc6eafa);}})[_0x11da('0x1f')](function(_0x3d5928){if(_0x3d5928){_0x4ea378=_0x3d5928['length'];if(!_0x2c3f8a[_0x11da('0x40')][_0x11da('0xb1')]('nolimit')){_0xc6eafa['limit']=qs['limit'](_0x2c3f8a[_0x11da('0x40')][_0x11da('0x31')]);_0xc6eafa['offset']=qs[_0x11da('0x2e')](_0x2c3f8a[_0x11da('0x40')]['offset']);}return _0x7c7013[_0x11da('0xb0')](_0xc6eafa);}})[_0x11da('0x1f')](function(_0x5d85ca){if(_0x5d85ca){return _0x5d85ca?{'count':_0x4ea378,'rows':_0x5d85ca}:null;}})[_0x11da('0x1f')](respondWithResult(_0x106bdc,null))[_0x11da('0x2a')](handleError(_0x106bdc,null));};exports[_0x11da('0xb2')]=function(_0x36709f,_0x985456,_0x456db6){var _0x2cf6af={'raw':![],'where':{}};var _0x2db731={};var _0x2c9d8a={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x36709f[_0x11da('0x54')]['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0x985456,null))['then'](function(_0x4d92f9){if(_0x4d92f9){_0x2db731[_0x11da('0x44')]=_[_0x11da('0x41')](db['OpenchannelInteraction'][_0x11da('0x68')]);_0x2db731[_0x11da('0x40')]=_[_0x11da('0x41')](_0x36709f['query']);_0x2db731['filters']=_[_0x11da('0x43')](_0x2db731[_0x11da('0x44')],_0x2db731[_0x11da('0x40')]);_0x2cf6af[_0x11da('0x45')]=_[_0x11da('0x43')](_0x2db731[_0x11da('0x44')],qs[_0x11da('0x46')](_0x36709f[_0x11da('0x40')]['fields']));_0x2cf6af['attributes']=_0x2cf6af[_0x11da('0x45')][_0x11da('0x47')]?_0x2cf6af[_0x11da('0x45')]:_0x2db731[_0x11da('0x44')];if(!_0x36709f['query']['hasOwnProperty']('nolimit')){_0x2cf6af[_0x11da('0x31')]=qs[_0x11da('0x31')](_0x36709f[_0x11da('0x40')][_0x11da('0x31')]);_0x2cf6af['offset']=qs[_0x11da('0x2e')](_0x36709f['query'][_0x11da('0x2e')]);}_0x2cf6af['order']=qs[_0x11da('0x4a')](_0x36709f['query']['sort']);_0x2cf6af['where']=qs[_0x11da('0x42')](_[_0x11da('0x4c')](_0x36709f[_0x11da('0x40')],_0x2db731[_0x11da('0x42')]));_0x2cf6af[_0x11da('0x4b')]['OpenchannelAccountId']=_0x4d92f9['id'];if(_0x36709f[_0x11da('0x40')][_0x11da('0x4d')]){_0x2cf6af[_0x11da('0x4b')]=_[_0x11da('0x4e')](_0x2cf6af[_0x11da('0x4b')],{'$or':_[_0x11da('0x3d')](_0x2cf6af[_0x11da('0x45')],function(_0x197a9f){var _0x488061={};_0x488061[_0x197a9f]={'$like':'%'+_0x36709f['query'][_0x11da('0x4d')]+'%'};return _0x488061;})});}_0x2cf6af=_[_0x11da('0x4e')]({},_0x2cf6af,_0x36709f[_0x11da('0x56')]);return db['OpenchannelInteraction']['count']({'where':_0x2cf6af['where']})[_0x11da('0x1f')](function(_0xd5232b){_0x2c9d8a[_0x11da('0x30')]=_0xd5232b;if(_0x36709f['query'][_0x11da('0x51')]){_0x2cf6af['include']=[{'model':db['CmContact'],'as':_0x11da('0xb3'),'required':![]},{'model':db['User'],'as':_0x11da('0xb4'),'attributes':['name',_0x11da('0xb5'),'internal'],'required':![]},{'model':db[_0x11da('0xb6')],'as':_0x11da('0xb7'),'attributes':['id',_0x11da('0x3a'),_0x11da('0xb8')],'where':_0x36709f[_0x11da('0x40')][_0x11da('0xb9')]?{'id':_0x36709f[_0x11da('0x40')][_0x11da('0xb9')]}:undefined,'required':_0x36709f[_0x11da('0x40')]['tag']?!![]:![]}];}return db[_0x11da('0x90')][_0x11da('0x69')](_0x2cf6af);})[_0x11da('0x1f')](function(_0x454b47){_0x2c9d8a['rows']=_0x454b47;return _0x2c9d8a;});}})[_0x11da('0x1f')](respondWithFilteredResult(_0x985456,_0x2cf6af))[_0x11da('0x2a')](handleError(_0x985456,null));};exports[_0x11da('0xba')]=function(_0x331c4e,_0x45fe81,_0x713d58){return db[_0x11da('0x50')][_0x11da('0x57')]({'where':{'id':_0x331c4e['params']['id']}})['then'](handleEntityNotFound(_0x45fe81,null))[_0x11da('0x1f')](function(_0xf2419d){if(_0xf2419d){return _0xf2419d[_0x11da('0xba')](_0x331c4e[_0x11da('0x59')][_0x11da('0x6b')],_[_0x11da('0xbb')](_0x331c4e[_0x11da('0x59')],[_0x11da('0x6b'),'id'])||{})['spread'](function(_0x1eafce){for(var _0xd99382=0x0;_0xd99382<_0x331c4e[_0x11da('0x59')][_0x11da('0x6b')]['length'];_0xd99382+=0x1){socket['emit'](_0x11da('0xbc'),{'UserId':Number(_0x331c4e['body']['ids'][_0xd99382]),'OpenchannelAccountId':Number(_0x331c4e['params']['id'])});}return _0x1eafce;});}})[_0x11da('0x1f')](respondWithResult(_0x45fe81,null))[_0x11da('0x2a')](handleError(_0x45fe81,null));};exports[_0x11da('0xbd')]=function(_0x293ca6,_0xb8e256,_0x21e226){return db[_0x11da('0x50')][_0x11da('0x57')]({'where':{'id':_0x293ca6[_0x11da('0x54')]['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0xb8e256,null))[_0x11da('0x1f')](function(_0x5c9906){if(_0x5c9906){return _0x5c9906[_0x11da('0xbd')](_0x293ca6[_0x11da('0x40')][_0x11da('0x6b')])[_0x11da('0x1f')](function(){if(_[_0x11da('0xbe')](_0x293ca6[_0x11da('0x40')]['ids'])){for(var _0x45d59b=0x0;_0x45d59b<_0x293ca6[_0x11da('0x40')][_0x11da('0x6b')][_0x11da('0x47')];_0x45d59b+=0x1){socket[_0x11da('0xbf')](_0x11da('0xc0'),{'UserId':Number(_0x293ca6[_0x11da('0x40')][_0x11da('0x6b')][_0x45d59b]),'OpenchannelAccountId':Number(_0x293ca6[_0x11da('0x54')]['id'])});}}else{socket[_0x11da('0xbf')](_0x11da('0xc0'),{'UserId':Number(_0x293ca6[_0x11da('0x40')]['ids']),'OpenchannelAccountId':Number(_0x293ca6[_0x11da('0x54')]['id'])});}});}})[_0x11da('0x1f')](respondWithStatusCode(_0xb8e256,null))[_0x11da('0x2a')](handleError(_0xb8e256,null));};exports[_0x11da('0xc1')]=function(_0x489a09,_0x49c12b,_0x1aa51c){var _0x78b979={};var _0x27d16f={};var _0x1c4d9;var _0x136c54;return db['OpenchannelAccount'][_0x11da('0x66')]({'where':{'id':_0x489a09[_0x11da('0x54')]['id']}})[_0x11da('0x1f')](handleEntityNotFound(_0x49c12b,null))['then'](function(_0x19260d){if(_0x19260d){_0x1c4d9=_0x19260d;_0x27d16f[_0x11da('0x44')]=_[_0x11da('0x41')](db[_0x11da('0xc2')]['rawAttributes']);_0x27d16f[_0x11da('0x40')]=_[_0x11da('0x41')](_0x489a09[_0x11da('0x40')]);_0x27d16f['filters']=_[_0x11da('0x43')](_0x27d16f[_0x11da('0x44')],_0x27d16f[_0x11da('0x40')]);_0x78b979['attributes']=_[_0x11da('0x43')](_0x27d16f['model'],qs[_0x11da('0x46')](_0x489a09[_0x11da('0x40')][_0x11da('0x46')]));_0x78b979['attributes']=_0x78b979[_0x11da('0x45')]['length']?_0x78b979['attributes']:_0x27d16f['model'];_0x78b979[_0x11da('0x49')]=qs[_0x11da('0x4a')](_0x489a09[_0x11da('0x40')]['sort']);_0x78b979[_0x11da('0x4b')]=qs[_0x11da('0x42')](_['pick'](_0x489a09[_0x11da('0x40')],_0x27d16f[_0x11da('0x42')]));if(_0x489a09[_0x11da('0x40')][_0x11da('0x4d')]){_0x78b979['where']=_[_0x11da('0x4e')](_0x78b979[_0x11da('0x4b')],{'$or':_['map'](_0x78b979[_0x11da('0x45')],function(_0xa83541){var _0x133b85={};_0x133b85[_0xa83541]={'$like':'%'+_0x489a09['query'][_0x11da('0x4d')]+'%'};return _0x133b85;})});}_0x78b979=_['merge']({},_0x78b979,_0x489a09[_0x11da('0x56')]);return _0x1c4d9['getAgents'](_0x78b979);}})[_0x11da('0x1f')](function(_0x4d606e){if(_0x4d606e){_0x136c54=_0x4d606e[_0x11da('0x47')];if(!_0x489a09['query'][_0x11da('0xb1')](_0x11da('0x48'))){_0x78b979['limit']=qs['limit'](_0x489a09[_0x11da('0x40')][_0x11da('0x31')]);_0x78b979['offset']=qs[_0x11da('0x2e')](_0x489a09['query'][_0x11da('0x2e')]);}return _0x1c4d9[_0x11da('0xc1')](_0x78b979);}})[_0x11da('0x1f')](function(_0x51b0b4){if(_0x51b0b4){return _0x51b0b4?{'count':_0x136c54,'rows':_0x51b0b4}:null;}})[_0x11da('0x1f')](respondWithResult(_0x49c12b,null))[_0x11da('0x2a')](handleError(_0x49c12b,null));};exports['send']=function(_0x525fa3,_0x30b594,_0x508207){var _0x5064f8,_0xdae832,_0x1dd6a1;if(_['isNil'](_0x525fa3[_0x11da('0x59')][_0x11da('0x59')])||_0x525fa3[_0x11da('0x59')][_0x11da('0x59')]===''){throw new db[(_0x11da('0x73'))]['ValidationError'](_0x11da('0x7e'));}if(_[_0x11da('0x7b')](_0x525fa3['body']['to'])){}_0x5064f8=_0x525fa3[_0x11da('0x59')]['to'];return db['OpenchannelAccount'][_0x11da('0x66')]({'where':{'id':_0x525fa3[_0x11da('0x54')]['id']}})['then'](handleEntityNotFound(_0x30b594,null))[_0x11da('0x1f')](function(_0x24c40b){if(_0x24c40b){return db[_0x11da('0x50')][_0x11da('0x57')]({'where':{'id':_0x24c40b['id']},'include':[{'model':db[_0x11da('0x83')],'as':'List','include':[{'model':db[_0x11da('0x72')],'as':_0x11da('0x84'),'where':{[_0x24c40b[_0x11da('0x7f')]]:_0x5064f8},'limit':0x1,'order':[[_0x11da('0x77'),_0x11da('0xc3')]]}]}]})['then'](handleEntityNotFound(_0x30b594,null))['then'](function(_0x57861b){if(_0x57861b&&_0x57861b[_0x11da('0x87')]){_0xdae832=_0x57861b[_0x11da('0x38')]({'plain':!![]});if(_0xdae832[_0x11da('0x87')]&&_0xdae832[_0x11da('0x87')][_0x11da('0x84')][_0x11da('0x47')]){return _0xdae832[_0x11da('0x87')][_0x11da('0x84')][0x0];}return db[_0x11da('0x72')][_0x11da('0x58')](_[_0x11da('0x17')](_0x525fa3[_0x11da('0x59')],{'firstName':_0x5064f8,[_0x57861b['mapKey']]:_0x5064f8,'phone':_0x5064f8,'ListId':_0xdae832[_0x11da('0x7a')]}));}})[_0x11da('0x1f')](handleEntityNotFound(_0x30b594,null))[_0x11da('0x1f')](function(_0x20daa4){if(_0x20daa4){_0x1dd6a1=_0x20daa4;return db[_0x11da('0x90')][_0x11da('0x57')]({'where':{'ContactId':_0x1dd6a1['id'],'closed':![],'OpenchannelAccountId':_0xdae832['id']}})[_0x11da('0x1f')](function(_0x7d8509){if(_0x7d8509){return[_0x7d8509,![]];}return db[_0x11da('0x90')]['create']({'UserId':_0x525fa3[_0x11da('0x5a')]['id'],'ContactId':_0x1dd6a1['id'],'OpenchannelAccountId':_0xdae832['id'],'lastMsgDirection':_0x11da('0xc4'),'Messages':[_[_0x11da('0x4e')](_0x525fa3['body'],{'read':![],'body':_0x525fa3[_0x11da('0x59')]['body'],'OpenchannelAccountId':_0xdae832['id'],'UserId':_0x525fa3[_0x11da('0x5a')]['id'],'ContactId':_0x1dd6a1['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x11da('0xc5')}]})[_0x11da('0x1f')](function(_0x5c886b){return[_0x5c886b,!![]];});});}})[_0x11da('0x93')](function(_0x5978e7,_0x51909f){if(_0x51909f){return _0x5978e7;}return db[_0x11da('0x9a')][_0x11da('0x58')](_[_0x11da('0x4e')](_0x525fa3[_0x11da('0x59')],{'read':![],'body':_0x525fa3[_0x11da('0x59')][_0x11da('0x59')],'OpenchannelAccountId':_0xdae832['id'],'OpenchannelInteractionId':_0x5978e7['id'],'UserId':_0x525fa3[_0x11da('0x5a')]['id'],'ContactId':_0x1dd6a1['id']}))[_0x11da('0x1f')](function(_0x2a8ed1){_0x5978e7[_0x11da('0xc6')][_0x11da('0xc5')]=[];_0x5978e7['dataValues']['Messages'][_0x11da('0x98')](_0x2a8ed1[_0x11da('0xc6')]);return _0x5978e7;});});}})['then'](respondWithResult(_0x30b594,null))[_0x11da('0x2a')](handleError(_0x30b594,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a61fe20..4d8cd30 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 _0xf109=['OpenchannelAccount','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x23c5a8,_0x231dcd){var _0x3ba1b0=function(_0x1985e6){while(--_0x1985e6){_0x23c5a8['push'](_0x23c5a8['shift']());}};_0x3ba1b0(++_0x231dcd);}(_0xf109,0xce));var _0x9f10=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xf109[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require(_0x9f10('0x0'));var OpenchannelAccount=require(_0x9f10('0x1'))['db'][_0x9f10('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9f10('0x3')};function emitEvent(_0x74f517){return function(_0x74d0ee,_0x26f01c,_0x4027f4){OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517+':'+_0x74d0ee['id'],_0x74d0ee);OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517,_0x74d0ee);_0x4027f4(null);};}for(var e in events){if(events[_0x9f10('0x5')](e)){var event=events[e];OpenchannelAccount[_0x9f10('0x6')](e,emitEvent(event));}}module[_0x9f10('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb43b=['events','../../mysqldb','setMaxListeners','save','update','hasOwnProperty','exports'];(function(_0x5e4edc,_0x5f5078){var _0x37a685=function(_0x551173){while(--_0x551173){_0x5e4edc['push'](_0x5e4edc['shift']());}};_0x37a685(++_0x5f5078);}(_0xb43b,0x1b2));var _0xbb43=function(_0x23a261,_0x4e7a2b){_0x23a261=_0x23a261-0x0;var _0x50e1bd=_0xb43b[_0x23a261];return _0x50e1bd;};'use strict';var EventEmitter=require(_0xbb43('0x0'));var OpenchannelAccount=require(_0xbb43('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb43('0x2')](0x0);var events={'afterCreate':_0xbb43('0x3'),'afterUpdate':_0xbb43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x131e9e){return function(_0x41aff6,_0x351254,_0x16432a){OpenchannelAccountEvents['emit'](_0x131e9e+':'+_0x41aff6['id'],_0x41aff6);OpenchannelAccountEvents['emit'](_0x131e9e,_0x41aff6);_0x16432a(null);};}for(var e in events){if(events[_0xbb43('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xbb43('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 7aa0556..e21d16f 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(_0x3e6c38,_0x6eabbd){var _0x3c488c=function(_0x5a376b){while(--_0x5a376b){_0x3e6c38['push'](_0x3e6c38['shift']());}};_0x3c488c(++_0x6eabbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x341cbc,_0x223985){var _0x5c1e41=function(_0x304518){while(--_0x304518){_0x341cbc['push'](_0x341cbc['shift']());}};_0x5c1e41(++_0x223985);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 a87f23e..23a4602 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 _0x1339=['OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info'];(function(_0x4b15a4,_0x4241fe){var _0x40a783=function(_0x1f3de1){while(--_0x1f3de1){_0x4b15a4['push'](_0x4b15a4['shift']());}};_0x40a783(++_0x4241fe);}(_0x1339,0x1ed));var _0x9133=function(_0x3280a3,_0x156983){_0x3280a3=_0x3280a3-0x0;var _0x3d673a=_0x1339[_0x3280a3];return _0x3d673a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});config['redis']=_[_0x9133('0xb')](config[_0x9133('0xc')],{'host':_0x9133('0xd'),'port':0x18eb});var socket=require(_0x9133('0xe'))(new Redis(config[_0x9133('0xc')]));require(_0x9133('0xf'))[_0x9133('0x10')](socket);function respondWithRpcPromise(_0x245134,_0x10a9e4,_0xd588c){return new BPromise(function(_0x4c4517,_0x3f9650){return client[_0x9133('0x11')](_0x245134,_0xd588c)[_0x9133('0x12')](function(_0x452481){logger[_0x9133('0x13')](_0x9133('0x14'),_0x10a9e4,'request\x20sent');logger[_0x9133('0x15')](_0x9133('0x16'),_0x10a9e4,'request\x20sent',JSON['stringify'](_0x452481));if(_0x452481[_0x9133('0x17')]){if(_0x452481['error'][_0x9133('0x18')]===0x1f4){logger[_0x9133('0x17')](_0x9133('0x14'),_0x10a9e4,_0x452481[_0x9133('0x17')][_0x9133('0x19')]);return _0x3f9650(_0x452481[_0x9133('0x17')]['message']);}logger[_0x9133('0x17')](_0x9133('0x14'),_0x10a9e4,_0x452481['error'][_0x9133('0x19')]);return _0x4c4517(_0x452481[_0x9133('0x17')][_0x9133('0x19')]);}else{logger[_0x9133('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x10a9e4,_0x9133('0x1a'));_0x4c4517(_0x452481['result'][_0x9133('0x19')]);}})['catch'](function(_0x115ee8){logger[_0x9133('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x10a9e4,_0x115ee8);_0x3f9650(_0x115ee8);});});} \ No newline at end of file +var _0xcffe=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x580869,_0x540760){var _0x3bfc5d=function(_0x1ee282){while(--_0x1ee282){_0x580869['push'](_0x580869['shift']());}};_0x3bfc5d(++_0x540760);}(_0xcffe,0x1a1));var _0xecff=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0xcffe[_0x45ee03];return _0x13d535;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var moment=require(_0xecff('0x2'));var BPromise=require(_0xecff('0x3'));var rs=require(_0xecff('0x4'));var fs=require('fs');var Redis=require(_0xecff('0x5'));var db=require(_0xecff('0x6'))['db'];var utils=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecff('0xa')][_0xecff('0xb')]({'port':0x232a});config[_0xecff('0xc')]=_[_0xecff('0xd')](config[_0xecff('0xc')],{'host':_0xecff('0xe'),'port':0x18eb});var socket=require(_0xecff('0xf'))(new Redis(config['redis']));require(_0xecff('0x10'))[_0xecff('0x11')](socket);function respondWithRpcPromise(_0x195b15,_0x20ab4f,_0x698e40){return new BPromise(function(_0x4fa444,_0x425380){return client[_0xecff('0x12')](_0x195b15,_0x698e40)[_0xecff('0x13')](function(_0x3ed904){logger[_0xecff('0x14')](_0xecff('0x15'),_0x20ab4f,_0xecff('0x16'));logger[_0xecff('0x17')](_0xecff('0x18'),_0x20ab4f,_0xecff('0x16'),JSON[_0xecff('0x19')](_0x3ed904));if(_0x3ed904[_0xecff('0x1a')]){if(_0x3ed904[_0xecff('0x1a')][_0xecff('0x1b')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x20ab4f,_0x3ed904[_0xecff('0x1a')][_0xecff('0x1c')]);return _0x425380(_0x3ed904['error'][_0xecff('0x1c')]);}logger[_0xecff('0x1a')](_0xecff('0x15'),_0x20ab4f,_0x3ed904['error']['message']);return _0x4fa444(_0x3ed904[_0xecff('0x1a')][_0xecff('0x1c')]);}else{logger['info'](_0xecff('0x15'),_0x20ab4f,_0xecff('0x16'));_0x4fa444(_0x3ed904[_0xecff('0x1d')][_0xecff('0x1c')]);}})[_0xecff('0x1e')](function(_0x1682a2){logger['error'](_0xecff('0x15'),_0x20ab4f,_0x1682a2);_0x425380(_0x1682a2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 34f2186..5ac638c 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 _0xa4db=['removeListener','length','openchannelAccount:','update','emit'];(function(_0x2c7c98,_0x23ca3c){var _0x1e267f=function(_0xefc0a1){while(--_0xefc0a1){_0x2c7c98['push'](_0x2c7c98['shift']());}};_0x1e267f(++_0x23ca3c);}(_0xa4db,0x139));var _0xba4d=function(_0x3f1c20,_0x3d22f3){_0x3f1c20=_0x3f1c20-0x0;var _0xd18fa8=_0xa4db[_0x3f1c20];return _0xd18fa8;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save','remove',_0xba4d('0x0')];function createListener(_0x46aae0,_0x22432c){return function(_0x1f3b60){_0x22432c[_0xba4d('0x1')](_0x46aae0,_0x1f3b60);};}function removeListener(_0x158edc,_0x5870ff){return function(){OpenchannelAccountEvents[_0xba4d('0x2')](_0x158edc,_0x5870ff);};}exports['register']=function(_0x1c798c){for(var _0x1b1d52=0x0,_0x325531=events[_0xba4d('0x3')];_0x1b1d52<_0x325531;_0x1b1d52++){var _0x2c8823=events[_0x1b1d52];var _0xdfc6bf=createListener(_0xba4d('0x4')+_0x2c8823,_0x1c798c);OpenchannelAccountEvents['on'](_0x2c8823,_0xdfc6bf);}}; \ No newline at end of file +var _0x4a3d=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4a3d,0x79));var _0xd4a3=function(_0x4f3652,_0x3ec249){_0x4f3652=_0x4f3652-0x0;var _0x1dc216=_0x4a3d[_0x4f3652];return _0x1dc216;};'use strict';var OpenchannelAccountEvents=require(_0xd4a3('0x0'));var events=[_0xd4a3('0x1'),_0xd4a3('0x2'),_0xd4a3('0x3')];function createListener(_0x314a8a,_0x34fd01){return function(_0x1f44cb){_0x34fd01[_0xd4a3('0x4')](_0x314a8a,_0x1f44cb);};}function removeListener(_0xcae31b,_0x8ff04a){return function(){OpenchannelAccountEvents[_0xd4a3('0x5')](_0xcae31b,_0x8ff04a);};}exports[_0xd4a3('0x6')]=function(_0x52ffaf){for(var _0x523038=0x0,_0x2449da=events[_0xd4a3('0x7')];_0x523038<_0x2449da;_0x523038++){var _0x5910aa=events[_0x523038];var _0x490bc1=createListener(_0xd4a3('0x8')+_0x5910aa,_0x52ffaf);OpenchannelAccountEvents['on'](_0x5910aa,_0x490bc1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1feec93..fe191ae 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 _0xe50c=['delete','exports','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','update'];(function(_0xc1c2aa,_0x18a034){var _0x5813ee=function(_0xea3fc3){while(--_0xea3fc3){_0xc1c2aa['push'](_0xc1c2aa['shift']());}};_0x5813ee(++_0x18a034);}(_0xe50c,0x6b));var _0xce50=function(_0x43c02a,_0x46213e){_0x43c02a=_0x43c02a-0x0;var _0x3c54ed=_0xe50c[_0x43c02a];return _0x3c54ed;};'use strict';var multer=require(_0xce50('0x0'));var util=require(_0xce50('0x1'));var path=require(_0xce50('0x2'));var timeout=require(_0xce50('0x3'));var express=require(_0xce50('0x4'));var router=express[_0xce50('0x5')]();var fs_extra=require(_0xce50('0x6'));var auth=require(_0xce50('0x7'));var interaction=require(_0xce50('0x8'));var config=require(_0xce50('0x9'));var controller=require(_0xce50('0xa'));router[_0xce50('0xb')]('/',auth[_0xce50('0xc')](),controller[_0xce50('0xd')]);router[_0xce50('0xb')](_0xce50('0xe'),auth['isAuthenticated'](),controller[_0xce50('0xf')]);router['post']('/',auth[_0xce50('0xc')](),controller[_0xce50('0x10')]);router[_0xce50('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xce50('0x12')]);router[_0xce50('0x13')](_0xce50('0xe'),auth[_0xce50('0xc')](),controller['destroy']);module[_0xce50('0x14')]=router; \ No newline at end of file +var _0xbf07=['show','create','put','/:id','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x17fd90,_0x27b4f0){var _0x5e5122=function(_0x2ac04d){while(--_0x2ac04d){_0x17fd90['push'](_0x17fd90['shift']());}};_0x5e5122(++_0x27b4f0);}(_0xbf07,0x125));var _0x7bf0=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0xbf07[_0x305b20];return _0x26d64a;};'use strict';var multer=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7bf0('0x2')]();var fs_extra=require(_0x7bf0('0x3'));var auth=require(_0x7bf0('0x4'));var interaction=require(_0x7bf0('0x5'));var config=require(_0x7bf0('0x6'));var controller=require(_0x7bf0('0x7'));router[_0x7bf0('0x8')]('/',auth[_0x7bf0('0x9')](),controller[_0x7bf0('0xa')]);router['get']('/:id',auth[_0x7bf0('0x9')](),controller[_0x7bf0('0xb')]);router['post']('/',auth[_0x7bf0('0x9')](),controller[_0x7bf0('0xc')]);router[_0x7bf0('0xd')](_0x7bf0('0xe'),auth[_0x7bf0('0x9')](),controller['update']);router['delete'](_0x7bf0('0xe'),auth[_0x7bf0('0x9')](),controller['destroy']);module[_0x7bf0('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 846b5e3..6c1b139 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 _0x1b0b=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x1b0b,0x129));var _0xb1b0=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x1b0b[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require('sequelize');module[_0xb1b0('0x0')]={'priority':{'type':Sequelize[_0xb1b0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb1b0('0x2')],'allowNull':![],'defaultValue':_0xb1b0('0x3')},'appdata':{'type':Sequelize[_0xb1b0('0x4')]()},'description':{'type':Sequelize[_0xb1b0('0x2')]},'interval':{'type':Sequelize[_0xb1b0('0x2')],'defaultValue':_0xb1b0('0x5')}}; \ No newline at end of file +var _0xef49=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x302d0b,_0x2c7dbb){var _0x3b9e1d=function(_0x598beb){while(--_0x598beb){_0x302d0b['push'](_0x302d0b['shift']());}};_0x3b9e1d(++_0x2c7dbb);}(_0xef49,0xdb));var _0x9ef4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xef49[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x9ef4('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9ef4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9ef4('0x2')],'allowNull':![],'defaultValue':_0x9ef4('0x3')},'appdata':{'type':Sequelize[_0x9ef4('0x4')]()},'description':{'type':Sequelize[_0x9ef4('0x2')]},'interval':{'type':Sequelize[_0x9ef4('0x2')],'defaultValue':_0x9ef4('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index ff66c94..e968cab 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 _0x42e2=['send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x42e2,0x147));var _0x242e=function(_0x17eb97,_0x4ac748){_0x17eb97=_0x17eb97-0x0;var _0x8c569f=_0x42e2[_0x17eb97];return _0x8c569f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x242e('0x0'));var zipdir=require(_0x242e('0x1'));var jsonpatch=require(_0x242e('0x2'));var rp=require(_0x242e('0x3'));var moment=require(_0x242e('0x4'));var BPromise=require(_0x242e('0x5'));var Mustache=require('mustache');var util=require(_0x242e('0x6'));var path=require(_0x242e('0x7'));var sox=require(_0x242e('0x8'));var csv=require(_0x242e('0x9'));var ejs=require(_0x242e('0xa'));var fs=require('fs');var fs_extra=require(_0x242e('0xb'));var _=require('lodash');var squel=require(_0x242e('0xc'));var crypto=require(_0x242e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x242e('0x9'));var querystring=require(_0x242e('0xe'));var Papa=require('papaparse');var Redis=require(_0x242e('0xf'));var authService=require(_0x242e('0x10'));var qs=require(_0x242e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x242e('0x12'))(_0x242e('0x13'));var utils=require(_0x242e('0x14'));var config=require(_0x242e('0x15'));var licenseUtil=require(_0x242e('0x16'));var db=require(_0x242e('0x17'))['db'];function respondWithStatusCode(_0x20fba4,_0x357e56){_0x357e56=_0x357e56||0xcc;return function(_0x5003fb){if(_0x5003fb){return _0x20fba4[_0x242e('0x18')](_0x357e56);}return _0x20fba4[_0x242e('0x19')](_0x357e56)['end']();};}function respondWithResult(_0x36fd82,_0x3cf9ce){_0x3cf9ce=_0x3cf9ce||0xc8;return function(_0x4c23da){if(_0x4c23da){return _0x36fd82[_0x242e('0x19')](_0x3cf9ce)['json'](_0x4c23da);}};}function respondWithFilteredResult(_0x55b1c4,_0x7fca36){return function(_0x5228f9){if(_0x5228f9){var _0xe21ad8=typeof _0x7fca36['offset']===_0x242e('0x1a')&&typeof _0x7fca36[_0x242e('0x1b')]==='undefined';var _0x252c0a=_0x5228f9['count'];var _0x6af7bf=_0xe21ad8?0x0:_0x7fca36[_0x242e('0x1c')];var _0x2eff15=_0xe21ad8?_0x5228f9[_0x242e('0x1d')]:_0x7fca36[_0x242e('0x1c')]+_0x7fca36[_0x242e('0x1b')];var _0x31b7c3;if(_0x2eff15>=_0x252c0a){_0x2eff15=_0x252c0a;_0x31b7c3=0xc8;}else{_0x31b7c3=0xce;}_0x55b1c4[_0x242e('0x19')](_0x31b7c3);return _0x55b1c4[_0x242e('0x1e')](_0x242e('0x1f'),_0x6af7bf+'-'+_0x2eff15+'/'+_0x252c0a)[_0x242e('0x20')](_0x5228f9);}return null;};}function patchUpdates(_0x55480f){return function(_0x16bb60){try{jsonpatch[_0x242e('0x21')](_0x16bb60,_0x55480f,!![]);}catch(_0x382425){return BPromise[_0x242e('0x22')](_0x382425);}return _0x16bb60[_0x242e('0x23')]();};}function saveUpdates(_0x3d45fc,_0x1a17d1){return function(_0x51081c){if(_0x51081c){return _0x51081c[_0x242e('0x24')](_0x3d45fc)[_0x242e('0x25')](function(_0x468702){return _0x468702;});}return null;};}function removeEntity(_0x524a70,_0x4f5197){return function(_0x43c427){if(_0x43c427){return _0x43c427[_0x242e('0x26')]()[_0x242e('0x25')](function(){_0x524a70[_0x242e('0x19')](0xcc)[_0x242e('0x27')]();});}};}function handleEntityNotFound(_0x1d7427,_0x4b8076){return function(_0x29c2dd){if(!_0x29c2dd){_0x1d7427[_0x242e('0x18')](0x194);}return _0x29c2dd;};}function handleError(_0x1517a2,_0x589481){_0x589481=_0x589481||0x1f4;return function(_0x4ed15b){logger[_0x242e('0x28')](_0x4ed15b[_0x242e('0x29')]);if(_0x4ed15b[_0x242e('0x2a')]){delete _0x4ed15b['name'];}_0x1517a2[_0x242e('0x19')](_0x589481)[_0x242e('0x2b')](_0x4ed15b);};}exports[_0x242e('0x2c')]=function(_0x14ac93,_0x2515ad){var _0xc86779={},_0x46031e={},_0x1e38fb={'count':0x0,'rows':[]};var _0x58afc5=_[_0x242e('0x2d')](db[_0x242e('0x2e')][_0x242e('0x2f')],function(_0x375d62){return{'name':_0x375d62[_0x242e('0x30')],'type':_0x375d62[_0x242e('0x31')]['key']};});_0x46031e[_0x242e('0x32')]=_['map'](_0x58afc5,'name');_0x46031e[_0x242e('0x33')]=_['keys'](_0x14ac93[_0x242e('0x33')]);_0x46031e[_0x242e('0x34')]=_[_0x242e('0x35')](_0x46031e[_0x242e('0x32')],_0x46031e[_0x242e('0x33')]);_0xc86779[_0x242e('0x36')]=_[_0x242e('0x35')](_0x46031e[_0x242e('0x32')],qs[_0x242e('0x37')](_0x14ac93[_0x242e('0x33')]['fields']));_0xc86779[_0x242e('0x36')]=_0xc86779['attributes'][_0x242e('0x38')]?_0xc86779[_0x242e('0x36')]:_0x46031e[_0x242e('0x32')];if(!_0x14ac93[_0x242e('0x33')][_0x242e('0x39')]('nolimit')){_0xc86779[_0x242e('0x1b')]=qs['limit'](_0x14ac93[_0x242e('0x33')][_0x242e('0x1b')]);_0xc86779[_0x242e('0x1c')]=qs[_0x242e('0x1c')](_0x14ac93[_0x242e('0x33')][_0x242e('0x1c')]);}_0xc86779['order']=qs[_0x242e('0x3a')](_0x14ac93[_0x242e('0x33')][_0x242e('0x3a')]);_0xc86779[_0x242e('0x3b')]=qs[_0x242e('0x34')](_['pick'](_0x14ac93['query'],_0x46031e[_0x242e('0x34')]),_0x58afc5);if(_0x14ac93[_0x242e('0x33')][_0x242e('0x3c')]){_0xc86779[_0x242e('0x3b')]=_[_0x242e('0x3d')](_0xc86779[_0x242e('0x3b')],{'$or':_[_0x242e('0x2d')](_0x58afc5,function(_0x138207){if(_0x138207[_0x242e('0x31')]!==_0x242e('0x3e')){var _0x26898e={};_0x26898e[_0x138207[_0x242e('0x2a')]]={'$like':'%'+_0x14ac93[_0x242e('0x33')][_0x242e('0x3c')]+'%'};return _0x26898e;}})});}_0xc86779=_[_0x242e('0x3d')]({},_0xc86779,_0x14ac93[_0x242e('0x3f')]);var _0x1105a4={'where':_0xc86779['where']};return db[_0x242e('0x2e')][_0x242e('0x1d')](_0x1105a4)['then'](function(_0x4c1c0c){_0x1e38fb[_0x242e('0x1d')]=_0x4c1c0c;if(_0x14ac93[_0x242e('0x33')]['includeAll']){_0xc86779[_0x242e('0x40')]=[{'all':!![]}];}return db[_0x242e('0x2e')][_0x242e('0x41')](_0xc86779);})[_0x242e('0x25')](function(_0xa6ebee){_0x1e38fb[_0x242e('0x42')]=_0xa6ebee;return _0x1e38fb;})['then'](respondWithFilteredResult(_0x2515ad,_0xc86779))[_0x242e('0x43')](handleError(_0x2515ad,null));};exports[_0x242e('0x44')]=function(_0x4d4cfe,_0x499fed){var _0x48ff2f={'raw':!![],'where':{'id':_0x4d4cfe['params']['id']}},_0x50e47a={};_0x50e47a[_0x242e('0x32')]=_[_0x242e('0x45')](db['OpenchannelApplication'][_0x242e('0x2f')]);_0x50e47a[_0x242e('0x33')]=_[_0x242e('0x45')](_0x4d4cfe[_0x242e('0x33')]);_0x50e47a['filters']=_[_0x242e('0x35')](_0x50e47a[_0x242e('0x32')],_0x50e47a[_0x242e('0x33')]);_0x48ff2f['attributes']=_[_0x242e('0x35')](_0x50e47a[_0x242e('0x32')],qs['fields'](_0x4d4cfe[_0x242e('0x33')]['fields']));_0x48ff2f[_0x242e('0x36')]=_0x48ff2f[_0x242e('0x36')][_0x242e('0x38')]?_0x48ff2f[_0x242e('0x36')]:_0x50e47a[_0x242e('0x32')];if(_0x4d4cfe[_0x242e('0x33')]['includeAll']){_0x48ff2f['include']=[{'all':!![]}];}_0x48ff2f=_[_0x242e('0x3d')]({},_0x48ff2f,_0x4d4cfe[_0x242e('0x3f')]);return db['OpenchannelApplication'][_0x242e('0x46')](_0x48ff2f)['then'](handleEntityNotFound(_0x499fed,null))['then'](respondWithResult(_0x499fed,null))['catch'](handleError(_0x499fed,null));};exports[_0x242e('0x47')]=function(_0x5f47e3,_0x4bd53a){return db[_0x242e('0x2e')]['create'](_0x5f47e3['body'],{})[_0x242e('0x25')](respondWithResult(_0x4bd53a,0xc9))[_0x242e('0x43')](handleError(_0x4bd53a,null));};exports[_0x242e('0x24')]=function(_0x18590a,_0x50430e){if(_0x18590a[_0x242e('0x48')]['id']){delete _0x18590a['body']['id'];}return db[_0x242e('0x2e')][_0x242e('0x46')]({'where':{'id':_0x18590a[_0x242e('0x49')]['id']}})['then'](handleEntityNotFound(_0x50430e,null))[_0x242e('0x25')](saveUpdates(_0x18590a[_0x242e('0x48')],null))[_0x242e('0x25')](respondWithResult(_0x50430e,null))[_0x242e('0x43')](handleError(_0x50430e,null));};exports[_0x242e('0x26')]=function(_0x27dc6a,_0x18c875){return db['OpenchannelApplication']['find']({'where':{'id':_0x27dc6a[_0x242e('0x49')]['id']}})['then'](handleEntityNotFound(_0x18c875,null))[_0x242e('0x25')](removeEntity(_0x18c875,null))[_0x242e('0x43')](handleError(_0x18c875,null));}; \ No newline at end of file +var _0x45c3=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x45c3,0x117));var _0x345c=function(_0x3c86dc,_0x5d22fc){_0x3c86dc=_0x3c86dc-0x0;var _0x4aeb79=_0x45c3[_0x3c86dc];return _0x4aeb79;};'use strict';var emlformat=require(_0x345c('0x0'));var rimraf=require(_0x345c('0x1'));var zipdir=require(_0x345c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x345c('0x3'));var moment=require('moment');var BPromise=require(_0x345c('0x4'));var Mustache=require(_0x345c('0x5'));var util=require('util');var path=require(_0x345c('0x6'));var sox=require(_0x345c('0x7'));var csv=require(_0x345c('0x8'));var ejs=require(_0x345c('0x9'));var fs=require('fs');var fs_extra=require(_0x345c('0xa'));var _=require(_0x345c('0xb'));var squel=require(_0x345c('0xc'));var crypto=require(_0x345c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x345c('0xe'));var toCsv=require(_0x345c('0x8'));var querystring=require(_0x345c('0xf'));var Papa=require('papaparse');var Redis=require(_0x345c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x345c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x345c('0x12'));var utils=require(_0x345c('0x13'));var config=require(_0x345c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5db46e,_0x1d23bc){_0x1d23bc=_0x1d23bc||0xcc;return function(_0x466633){if(_0x466633){return _0x5db46e[_0x345c('0x15')](_0x1d23bc);}return _0x5db46e['status'](_0x1d23bc)[_0x345c('0x16')]();};}function respondWithResult(_0x190196,_0x42c812){_0x42c812=_0x42c812||0xc8;return function(_0x320f45){if(_0x320f45){return _0x190196[_0x345c('0x17')](_0x42c812)[_0x345c('0x18')](_0x320f45);}};}function respondWithFilteredResult(_0x37068c,_0x1fc114){return function(_0x16c3fa){if(_0x16c3fa){var _0x3290e7=typeof _0x1fc114[_0x345c('0x19')]===_0x345c('0x1a')&&typeof _0x1fc114['limit']===_0x345c('0x1a');var _0x3d9b0b=_0x16c3fa[_0x345c('0x1b')];var _0x2e986a=_0x3290e7?0x0:_0x1fc114[_0x345c('0x19')];var _0x3fe163=_0x3290e7?_0x16c3fa[_0x345c('0x1b')]:_0x1fc114[_0x345c('0x19')]+_0x1fc114[_0x345c('0x1c')];var _0x4c8315;if(_0x3fe163>=_0x3d9b0b){_0x3fe163=_0x3d9b0b;_0x4c8315=0xc8;}else{_0x4c8315=0xce;}_0x37068c[_0x345c('0x17')](_0x4c8315);return _0x37068c[_0x345c('0x1d')](_0x345c('0x1e'),_0x2e986a+'-'+_0x3fe163+'/'+_0x3d9b0b)[_0x345c('0x18')](_0x16c3fa);}return null;};}function patchUpdates(_0xbfef4){return function(_0xe2d56a){try{jsonpatch[_0x345c('0x1f')](_0xe2d56a,_0xbfef4,!![]);}catch(_0x4d45fe){return BPromise['reject'](_0x4d45fe);}return _0xe2d56a[_0x345c('0x20')]();};}function saveUpdates(_0xcd531f,_0x145f0d){return function(_0x596158){if(_0x596158){return _0x596158['update'](_0xcd531f)[_0x345c('0x21')](function(_0x34c524){return _0x34c524;});}return null;};}function removeEntity(_0x23c0d8,_0x40ecd6){return function(_0x105020){if(_0x105020){return _0x105020['destroy']()[_0x345c('0x21')](function(){_0x23c0d8[_0x345c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c147d,_0x1b16d7){return function(_0x445f62){if(!_0x445f62){_0x1c147d[_0x345c('0x15')](0x194);}return _0x445f62;};}function handleError(_0x1fb153,_0x2bd93d){_0x2bd93d=_0x2bd93d||0x1f4;return function(_0x46a5f0){logger[_0x345c('0x22')](_0x46a5f0[_0x345c('0x23')]);if(_0x46a5f0[_0x345c('0x24')]){delete _0x46a5f0['name'];}_0x1fb153[_0x345c('0x17')](_0x2bd93d)[_0x345c('0x25')](_0x46a5f0);};}exports[_0x345c('0x26')]=function(_0x5302ec,_0x570ed0){var _0x8b301d={},_0x1f9a4f={},_0x21834d={'count':0x0,'rows':[]};var _0x1b3eaa=_[_0x345c('0x27')](db[_0x345c('0x28')][_0x345c('0x29')],function(_0x7a16ce){return{'name':_0x7a16ce['fieldName'],'type':_0x7a16ce[_0x345c('0x2a')][_0x345c('0x2b')]};});_0x1f9a4f['model']=_[_0x345c('0x27')](_0x1b3eaa,_0x345c('0x24'));_0x1f9a4f['query']=_['keys'](_0x5302ec[_0x345c('0x2c')]);_0x1f9a4f['filters']=_[_0x345c('0x2d')](_0x1f9a4f[_0x345c('0x2e')],_0x1f9a4f[_0x345c('0x2c')]);_0x8b301d['attributes']=_['intersection'](_0x1f9a4f[_0x345c('0x2e')],qs[_0x345c('0x2f')](_0x5302ec['query'][_0x345c('0x2f')]));_0x8b301d[_0x345c('0x30')]=_0x8b301d[_0x345c('0x30')][_0x345c('0x31')]?_0x8b301d[_0x345c('0x30')]:_0x1f9a4f[_0x345c('0x2e')];if(!_0x5302ec['query'][_0x345c('0x32')](_0x345c('0x33'))){_0x8b301d[_0x345c('0x1c')]=qs[_0x345c('0x1c')](_0x5302ec[_0x345c('0x2c')][_0x345c('0x1c')]);_0x8b301d[_0x345c('0x19')]=qs[_0x345c('0x19')](_0x5302ec['query'][_0x345c('0x19')]);}_0x8b301d[_0x345c('0x34')]=qs[_0x345c('0x35')](_0x5302ec[_0x345c('0x2c')][_0x345c('0x35')]);_0x8b301d[_0x345c('0x36')]=qs[_0x345c('0x37')](_['pick'](_0x5302ec[_0x345c('0x2c')],_0x1f9a4f['filters']),_0x1b3eaa);if(_0x5302ec['query'][_0x345c('0x38')]){_0x8b301d[_0x345c('0x36')]=_[_0x345c('0x39')](_0x8b301d[_0x345c('0x36')],{'$or':_['map'](_0x1b3eaa,function(_0x3a9eac){if(_0x3a9eac[_0x345c('0x2a')]!==_0x345c('0x3a')){var _0x31424e={};_0x31424e[_0x3a9eac[_0x345c('0x24')]]={'$like':'%'+_0x5302ec['query'][_0x345c('0x38')]+'%'};return _0x31424e;}})});}_0x8b301d=_[_0x345c('0x39')]({},_0x8b301d,_0x5302ec[_0x345c('0x3b')]);var _0x320148={'where':_0x8b301d[_0x345c('0x36')]};return db[_0x345c('0x28')][_0x345c('0x1b')](_0x320148)[_0x345c('0x21')](function(_0xda7714){_0x21834d[_0x345c('0x1b')]=_0xda7714;if(_0x5302ec[_0x345c('0x2c')]['includeAll']){_0x8b301d[_0x345c('0x3c')]=[{'all':!![]}];}return db[_0x345c('0x28')][_0x345c('0x3d')](_0x8b301d);})[_0x345c('0x21')](function(_0x3f8c7b){_0x21834d[_0x345c('0x3e')]=_0x3f8c7b;return _0x21834d;})['then'](respondWithFilteredResult(_0x570ed0,_0x8b301d))[_0x345c('0x3f')](handleError(_0x570ed0,null));};exports['show']=function(_0x9a695c,_0xbf0a6f){var _0x5daa23={'raw':!![],'where':{'id':_0x9a695c[_0x345c('0x40')]['id']}},_0x4d32e9={};_0x4d32e9[_0x345c('0x2e')]=_[_0x345c('0x41')](db[_0x345c('0x28')][_0x345c('0x29')]);_0x4d32e9['query']=_[_0x345c('0x41')](_0x9a695c[_0x345c('0x2c')]);_0x4d32e9[_0x345c('0x37')]=_['intersection'](_0x4d32e9[_0x345c('0x2e')],_0x4d32e9[_0x345c('0x2c')]);_0x5daa23[_0x345c('0x30')]=_[_0x345c('0x2d')](_0x4d32e9['model'],qs[_0x345c('0x2f')](_0x9a695c[_0x345c('0x2c')][_0x345c('0x2f')]));_0x5daa23['attributes']=_0x5daa23[_0x345c('0x30')][_0x345c('0x31')]?_0x5daa23[_0x345c('0x30')]:_0x4d32e9['model'];if(_0x9a695c['query'][_0x345c('0x42')]){_0x5daa23[_0x345c('0x3c')]=[{'all':!![]}];}_0x5daa23=_[_0x345c('0x39')]({},_0x5daa23,_0x9a695c['options']);return db['OpenchannelApplication'][_0x345c('0x43')](_0x5daa23)[_0x345c('0x21')](handleEntityNotFound(_0xbf0a6f,null))['then'](respondWithResult(_0xbf0a6f,null))[_0x345c('0x3f')](handleError(_0xbf0a6f,null));};exports[_0x345c('0x44')]=function(_0x34209d,_0x23b203){return db['OpenchannelApplication']['create'](_0x34209d['body'],{})[_0x345c('0x21')](respondWithResult(_0x23b203,0xc9))[_0x345c('0x3f')](handleError(_0x23b203,null));};exports['update']=function(_0x44b942,_0x3369af){if(_0x44b942['body']['id']){delete _0x44b942[_0x345c('0x45')]['id'];}return db[_0x345c('0x28')][_0x345c('0x43')]({'where':{'id':_0x44b942['params']['id']}})[_0x345c('0x21')](handleEntityNotFound(_0x3369af,null))[_0x345c('0x21')](saveUpdates(_0x44b942[_0x345c('0x45')],null))[_0x345c('0x21')](respondWithResult(_0x3369af,null))[_0x345c('0x3f')](handleError(_0x3369af,null));};exports[_0x345c('0x46')]=function(_0xfaaca5,_0x5a608f){return db[_0x345c('0x28')][_0x345c('0x43')]({'where':{'id':_0xfaaca5[_0x345c('0x40')]['id']}})[_0x345c('0x21')](handleEntityNotFound(_0x5a608f,null))[_0x345c('0x21')](removeEntity(_0x5a608f,null))[_0x345c('0x3f')](handleError(_0x5a608f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 805ceee..ff332f3 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 _0xf5f4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5ee562,_0x427582){var _0x15110d=function(_0x29a89d){while(--_0x29a89d){_0x5ee562['push'](_0x5ee562['shift']());}};_0x15110d(++_0x427582);}(_0xf5f4,0x186));var _0x4f5f=function(_0x46fb8a,_0x25c3b8){_0x46fb8a=_0x46fb8a-0x0;var _0x5b10d7=_0xf5f4[_0x46fb8a];return _0x5b10d7;};'use strict';var _=require(_0x4f5f('0x0'));var util=require(_0x4f5f('0x1'));var logger=require(_0x4f5f('0x2'))(_0x4f5f('0x3'));var moment=require(_0x4f5f('0x4'));var BPromise=require(_0x4f5f('0x5'));var rp=require(_0x4f5f('0x6'));var fs=require('fs');var path=require(_0x4f5f('0x7'));var rimraf=require(_0x4f5f('0x8'));var config=require(_0x4f5f('0x9'));var attributes=require(_0x4f5f('0xa'));module['exports']=function(_0x45a31a,_0x52994f){return _0x45a31a[_0x4f5f('0xb')](_0x4f5f('0xc'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4f5f('0xd'),'collate':_0x4f5f('0xe')});}; \ No newline at end of file +var _0x19b4=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4'];(function(_0xaa7fc6,_0x2969cf){var _0x3c77f8=function(_0x2c8164){while(--_0x2c8164){_0xaa7fc6['push'](_0xaa7fc6['shift']());}};_0x3c77f8(++_0x2969cf);}(_0x19b4,0x88));var _0x419b=function(_0x50ed59,_0x2a9e3a){_0x50ed59=_0x50ed59-0x0;var _0x4e38d3=_0x19b4[_0x50ed59];return _0x4e38d3;};'use strict';var _=require(_0x419b('0x0'));var util=require(_0x419b('0x1'));var logger=require('../../config/logger')(_0x419b('0x2'));var moment=require(_0x419b('0x3'));var BPromise=require(_0x419b('0x4'));var rp=require(_0x419b('0x5'));var fs=require('fs');var path=require(_0x419b('0x6'));var rimraf=require(_0x419b('0x7'));var config=require(_0x419b('0x8'));var attributes=require(_0x419b('0x9'));module[_0x419b('0xa')]=function(_0x8ffe3,_0x12627e){return _0x8ffe3[_0x419b('0xb')](_0x419b('0xc'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x419b('0xd'),'collate':_0x419b('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 38c07c5..e491ef3 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 _0x15aa=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','OpenchannelApplication','update','body','options','raw','attributes','limit','then','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a760,_0x4e820b){var _0x5b53e8=function(_0x46acd5){while(--_0x46acd5){_0x20a760['push'](_0x20a760['shift']());}};_0x5b53e8(++_0x4e820b);}(_0x15aa,0xd9));var _0xa15a=function(_0x1d2c4b,_0x23167a){_0x1d2c4b=_0x1d2c4b-0x0;var _0x414687=_0x15aa[_0x1d2c4b];return _0x414687;};'use strict';var _=require(_0xa15a('0x0'));var util=require(_0xa15a('0x1'));var moment=require(_0xa15a('0x2'));var BPromise=require(_0xa15a('0x3'));var rs=require(_0xa15a('0x4'));var fs=require('fs');var Redis=require(_0xa15a('0x5'));var db=require(_0xa15a('0x6'))['db'];var utils=require(_0xa15a('0x7'));var logger=require(_0xa15a('0x8'))(_0xa15a('0x9'));var config=require('../../config/environment');var jayson=require(_0xa15a('0xa'));var client=jayson['client'][_0xa15a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5121cf,_0x3cecdf,_0x5b4124){return new BPromise(function(_0x1c1779,_0x41b80d){return client[_0xa15a('0xc')](_0x5121cf,_0x5b4124)['then'](function(_0x4be82b){logger[_0xa15a('0xd')](_0xa15a('0xe'),_0x3cecdf,_0xa15a('0xf'));logger[_0xa15a('0x10')](_0xa15a('0x11'),_0x3cecdf,'request\x20sent',JSON[_0xa15a('0x12')](_0x4be82b));if(_0x4be82b[_0xa15a('0x13')]){if(_0x4be82b[_0xa15a('0x13')][_0xa15a('0x14')]===0x1f4){logger['error'](_0xa15a('0xe'),_0x3cecdf,_0x4be82b[_0xa15a('0x13')][_0xa15a('0x15')]);return _0x41b80d(_0x4be82b['error'][_0xa15a('0x15')]);}logger[_0xa15a('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x3cecdf,_0x4be82b[_0xa15a('0x13')][_0xa15a('0x15')]);return _0x1c1779(_0x4be82b[_0xa15a('0x13')][_0xa15a('0x15')]);}else{logger[_0xa15a('0xd')](_0xa15a('0xe'),_0x3cecdf,'request\x20sent');_0x1c1779(_0x4be82b['result']['message']);}})[_0xa15a('0x16')](function(_0x8025a8){logger['error'](_0xa15a('0xe'),_0x3cecdf,_0x8025a8);_0x41b80d(_0x8025a8);});});}exports['UpdateOpenchannelApplication']=function(_0x1e16ce){var _0x4ccd0e=this;return new Promise(function(_0x3379b2,_0x241e21){return db[_0xa15a('0x17')][_0xa15a('0x18')](_0x1e16ce[_0xa15a('0x19')],{'raw':_0x1e16ce[_0xa15a('0x1a')]?_0x1e16ce[_0xa15a('0x1a')][_0xa15a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e16ce[_0xa15a('0x1a')]?_0x1e16ce['options']['where']||null:null,'attributes':_0x1e16ce['options']?_0x1e16ce['options'][_0xa15a('0x1c')]||null:null,'limit':_0x1e16ce[_0xa15a('0x1a')]?_0x1e16ce['options'][_0xa15a('0x1d')]||null:null})[_0xa15a('0x1e')](function(_0x45c7f7){logger[_0xa15a('0xd')](_0xa15a('0x1f'),_0x1e16ce);logger[_0xa15a('0x10')](_0xa15a('0x1f'),_0x1e16ce,JSON[_0xa15a('0x12')](_0x45c7f7));_0x3379b2(_0x45c7f7);})[_0xa15a('0x16')](function(_0x530871){logger[_0xa15a('0x13')](_0xa15a('0x1f'),_0x530871[_0xa15a('0x15')],_0x1e16ce);_0x241e21(_0x4ccd0e[_0xa15a('0x13')](0x1f4,_0x530871[_0xa15a('0x15')]));});});}; \ No newline at end of file +var _0xc183=['OpenchannelApplication','body','options','raw','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','UpdateOpenchannelApplication'];(function(_0x14c823,_0x2158a8){var _0x523939=function(_0x1f5cc6){while(--_0x1f5cc6){_0x14c823['push'](_0x14c823['shift']());}};_0x523939(++_0x2158a8);}(_0xc183,0x11f));var _0x3c18=function(_0x1879ac,_0x3b3fd5){_0x1879ac=_0x1879ac-0x0;var _0x4a6b52=_0xc183[_0x1879ac];return _0x4a6b52;};'use strict';var _=require(_0x3c18('0x0'));var util=require(_0x3c18('0x1'));var moment=require(_0x3c18('0x2'));var BPromise=require(_0x3c18('0x3'));var rs=require(_0x3c18('0x4'));var fs=require('fs');var Redis=require(_0x3c18('0x5'));var db=require(_0x3c18('0x6'))['db'];var utils=require(_0x3c18('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3c18('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3c18('0x9')][_0x3c18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52fc1a,_0x580d72,_0x3cb1d3){return new BPromise(function(_0x20325f,_0x326f07){return client['request'](_0x52fc1a,_0x3cb1d3)[_0x3c18('0xb')](function(_0x1edf7a){logger[_0x3c18('0xc')](_0x3c18('0xd'),_0x580d72,_0x3c18('0xe'));logger[_0x3c18('0xf')](_0x3c18('0x10'),_0x580d72,_0x3c18('0xe'),JSON['stringify'](_0x1edf7a));if(_0x1edf7a[_0x3c18('0x11')]){if(_0x1edf7a[_0x3c18('0x11')]['code']===0x1f4){logger[_0x3c18('0x11')](_0x3c18('0xd'),_0x580d72,_0x1edf7a[_0x3c18('0x11')][_0x3c18('0x12')]);return _0x326f07(_0x1edf7a[_0x3c18('0x11')][_0x3c18('0x12')]);}logger[_0x3c18('0x11')](_0x3c18('0xd'),_0x580d72,_0x1edf7a[_0x3c18('0x11')][_0x3c18('0x12')]);return _0x20325f(_0x1edf7a[_0x3c18('0x11')][_0x3c18('0x12')]);}else{logger[_0x3c18('0xc')](_0x3c18('0xd'),_0x580d72,_0x3c18('0xe'));_0x20325f(_0x1edf7a[_0x3c18('0x13')][_0x3c18('0x12')]);}})['catch'](function(_0x4168de){logger[_0x3c18('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x580d72,_0x4168de);_0x326f07(_0x4168de);});});}exports[_0x3c18('0x14')]=function(_0x4f2a73){var _0x2d508b=this;return new Promise(function(_0x29bc33,_0x159d09){return db[_0x3c18('0x15')]['update'](_0x4f2a73[_0x3c18('0x16')],{'raw':_0x4f2a73[_0x3c18('0x17')]?_0x4f2a73[_0x3c18('0x17')][_0x3c18('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f2a73['options']?_0x4f2a73['options']['where']||null:null,'attributes':_0x4f2a73['options']?_0x4f2a73[_0x3c18('0x17')][_0x3c18('0x19')]||null:null,'limit':_0x4f2a73[_0x3c18('0x17')]?_0x4f2a73['options'][_0x3c18('0x1a')]||null:null})[_0x3c18('0xb')](function(_0x106884){logger[_0x3c18('0xc')](_0x3c18('0x14'),_0x4f2a73);logger['debug'](_0x3c18('0x14'),_0x4f2a73,JSON['stringify'](_0x106884));_0x29bc33(_0x106884);})[_0x3c18('0x1b')](function(_0x10affb){logger['error'](_0x3c18('0x14'),_0x10affb[_0x3c18('0x12')],_0x4f2a73);_0x159d09(_0x2d508b[_0x3c18('0x11')](0x1f4,_0x10affb[_0x3c18('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index df7d202..baca65f 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 _0x4f05=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put','tracked','openchannel'];(function(_0x193659,_0x386ff5){var _0x538a71=function(_0x49ca36){while(--_0x49ca36){_0x193659['push'](_0x193659['shift']());}};_0x538a71(++_0x386ff5);}(_0x4f05,0x1f4));var _0x54f0=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x4f05[_0xa8883];return _0x479426;};'use strict';var multer=require(_0x54f0('0x0'));var util=require(_0x54f0('0x1'));var path=require(_0x54f0('0x2'));var timeout=require(_0x54f0('0x3'));var express=require(_0x54f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x54f0('0x5'));var interaction=require(_0x54f0('0x6'));var config=require(_0x54f0('0x7'));var controller=require(_0x54f0('0x8'));router[_0x54f0('0x9')]('/',auth[_0x54f0('0xa')](),controller['index']);router[_0x54f0('0x9')](_0x54f0('0xb'),auth['isAuthenticated'](),controller[_0x54f0('0xc')]);router[_0x54f0('0x9')](_0x54f0('0xd'),auth[_0x54f0('0xa')](),controller[_0x54f0('0xe')]);router['get'](_0x54f0('0xf'),auth[_0x54f0('0xa')](),controller[_0x54f0('0x10')]);router[_0x54f0('0x9')](_0x54f0('0x11'),auth[_0x54f0('0xa')](),controller[_0x54f0('0x12')]);router[_0x54f0('0x13')]('/',auth[_0x54f0('0xa')](),controller['create']);router[_0x54f0('0x13')](_0x54f0('0xf'),auth[_0x54f0('0xa')](),controller[_0x54f0('0x14')]);router['post'](_0x54f0('0x15'),auth[_0x54f0('0xa')](),interaction['tracked']('openchannel',_0x54f0('0x16')),controller[_0x54f0('0x17')]);router[_0x54f0('0x18')]('/:id',auth[_0x54f0('0xa')](),interaction[_0x54f0('0x19')](_0x54f0('0x1a'),'openchannelinteraction:update'),controller[_0x54f0('0x1b')]);router[_0x54f0('0x1c')]('/:id',auth[_0x54f0('0xa')](),interaction[_0x54f0('0x19')](_0x54f0('0x1a'),'openchannelinteraction:destroy'),controller[_0x54f0('0x1d')]);router[_0x54f0('0x1c')](_0x54f0('0x15'),auth[_0x54f0('0xa')](),controller['removeTags']);module[_0x54f0('0x1e')]=router; \ No newline at end of file +var _0xaefa=['post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','/:id','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id/messages','getMessages','download'];(function(_0x1712a7,_0x1a65d0){var _0x3bdd34=function(_0x2b69b2){while(--_0x2b69b2){_0x1712a7['push'](_0x1712a7['shift']());}};_0x3bdd34(++_0x1a65d0);}(_0xaefa,0x1b2));var _0xaaef=function(_0x19c12c,_0x15f684){_0x19c12c=_0x19c12c-0x0;var _0x1eecef=_0xaefa[_0x19c12c];return _0x1eecef;};'use strict';var multer=require(_0xaaef('0x0'));var util=require(_0xaaef('0x1'));var path=require(_0xaaef('0x2'));var timeout=require(_0xaaef('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaaef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaaef('0x5'));var config=require(_0xaaef('0x6'));var controller=require(_0xaaef('0x7'));router['get']('/',auth[_0xaaef('0x8')](),controller[_0xaaef('0x9')]);router[_0xaaef('0xa')](_0xaaef('0xb'),auth[_0xaaef('0x8')](),controller[_0xaaef('0xc')]);router[_0xaaef('0xa')]('/:id',auth[_0xaaef('0x8')](),controller['show']);router['get'](_0xaaef('0xd'),auth[_0xaaef('0x8')](),controller[_0xaaef('0xe')]);router[_0xaaef('0xa')]('/:id/download',auth[_0xaaef('0x8')](),controller[_0xaaef('0xf')]);router['post']('/',auth[_0xaaef('0x8')](),controller['create']);router[_0xaaef('0x10')](_0xaaef('0xd'),auth['isAuthenticated'](),controller[_0xaaef('0x11')]);router[_0xaaef('0x10')](_0xaaef('0x12'),auth[_0xaaef('0x8')](),interaction[_0xaaef('0x13')](_0xaaef('0x14'),_0xaaef('0x15')),controller['addTags']);router[_0xaaef('0x16')]('/:id',auth[_0xaaef('0x8')](),interaction[_0xaaef('0x13')](_0xaaef('0x14'),_0xaaef('0x17')),controller[_0xaaef('0x18')]);router['delete'](_0xaaef('0x19'),auth[_0xaaef('0x8')](),interaction['tracked'](_0xaaef('0x14'),_0xaaef('0x1a')),controller[_0xaaef('0x1b')]);router['delete'](_0xaaef('0x12'),auth[_0xaaef('0x8')](),controller[_0xaaef('0x1c')]);module[_0xaaef('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index e71c5d3..64b4218 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 _0xd405=['out','BOOLEAN','STRING','DATE'];(function(_0x541d97,_0x2b12cd){var _0x56dd51=function(_0x17fb8b){while(--_0x17fb8b){_0x541d97['push'](_0x541d97['shift']());}};_0x56dd51(++_0x2b12cd);}(_0xd405,0x1d2));var _0x5d40=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0xd405[_0x3f8a03];return _0x147fb2;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5d40('0x0')]},'secondDisposition':{'type':Sequelize[_0x5d40('0x0')]},'thirdDisposition':{'type':Sequelize[_0x5d40('0x0')]},'note':{'type':Sequelize[_0x5d40('0x0')]},'read1stAt':{'type':Sequelize[_0x5d40('0x1')]},'threadId':{'type':Sequelize[_0x5d40('0x0')]},'externalUrl':{'type':Sequelize[_0x5d40('0x0')]},'lastMsgAt':{'type':Sequelize[_0x5d40('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5d40('0x2')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x5d40('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9649=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x539b0d,_0x5d0572){var _0x1729c2=function(_0x244ae2){while(--_0x244ae2){_0x539b0d['push'](_0x539b0d['shift']());}};_0x1729c2(++_0x5d0572);}(_0x9649,0x19f));var _0x9964=function(_0x358666,_0x52dd62){_0x358666=_0x358666-0x0;var _0x18a2e5=_0x9649[_0x358666];return _0x18a2e5;};'use strict';var Sequelize=require(_0x9964('0x0'));module[_0x9964('0x1')]={'closed':{'type':Sequelize[_0x9964('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9964('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9964('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9964('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9964('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x9964('0x4')]},'lastMsgAt':{'type':Sequelize[_0x9964('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9964('0x5')]('in',_0x9964('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9964('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x9964('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f04de8d..a91ce0a 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 _0x1636=['ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','where','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','user','sequelize','toString','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','catch','show','params','keys','includeAll','include','merge','options','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','findAll','rows','addTags','setTags','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','System','out','secret','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','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','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','Users','map','fullname','TagIds','split','forEach','Tags','push','waiting','talking','answered','unmanaged','total','closed','UserId','index','OpenchannelInteraction','rawAttributes','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x1e0566,_0x376824){var _0x16b3a6=function(_0x57b815){while(--_0x57b815){_0x1e0566['push'](_0x1e0566['shift']());}};_0x16b3a6(++_0x376824);}(_0x1636,0x186));var _0x6163=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1636[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x6163('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6163('0x1'));var rp=require(_0x6163('0x2'));var moment=require(_0x6163('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6163('0x4'));var path=require(_0x6163('0x5'));var sox=require(_0x6163('0x6'));var csv=require(_0x6163('0x7'));var ejs=require(_0x6163('0x8'));var fs=require('fs');var fs_extra=require(_0x6163('0x9'));var _=require(_0x6163('0xa'));var squel=require(_0x6163('0xb'));var crypto=require(_0x6163('0xc'));var jsforce=require(_0x6163('0xd'));var deskjs=require(_0x6163('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6163('0xf'));var Papa=require(_0x6163('0x10'));var Redis=require(_0x6163('0x11'));var authService=require(_0x6163('0x12'));var qs=require(_0x6163('0x13'));var as=require(_0x6163('0x14'));var pdf=require(_0x6163('0x15'));var hardwareService=require(_0x6163('0x16'));var logger=require(_0x6163('0x17'))(_0x6163('0x18'));var utils=require('../../config/utils');var config=require(_0x6163('0x19'));var licenseUtil=require(_0x6163('0x1a'));var db=require(_0x6163('0x1b'))['db'];config[_0x6163('0x1c')]=_[_0x6163('0x1d')](config[_0x6163('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x6163('0x1e'))(new Redis(config[_0x6163('0x1c')]));require('./openchannelInteraction.socket')[_0x6163('0x1f')](socket);function respondWithStatusCode(_0x19990c,_0x28bdd1){_0x28bdd1=_0x28bdd1||0xcc;return function(_0x44097c){if(_0x44097c){return _0x19990c[_0x6163('0x20')](_0x28bdd1);}return _0x19990c[_0x6163('0x21')](_0x28bdd1)[_0x6163('0x22')]();};}function respondWithResult(_0x17131e,_0x5d6354){_0x5d6354=_0x5d6354||0xc8;return function(_0x29f5b6){if(_0x29f5b6){return _0x17131e[_0x6163('0x21')](_0x5d6354)[_0x6163('0x23')](_0x29f5b6);}};}function respondWithFilteredResult(_0x325cba,_0x560851){return function(_0x42cfb0){if(_0x42cfb0){var _0x14b9ae=typeof _0x560851[_0x6163('0x24')]===_0x6163('0x25')&&typeof _0x560851[_0x6163('0x26')]===_0x6163('0x25');var _0x86d983=_0x42cfb0[_0x6163('0x27')];var _0x34b470=_0x14b9ae?0x0:_0x560851[_0x6163('0x24')];var _0x35e3f3=_0x14b9ae?_0x42cfb0[_0x6163('0x27')]:_0x560851[_0x6163('0x24')]+_0x560851[_0x6163('0x26')];var _0x39298c;if(_0x35e3f3>=_0x86d983){_0x35e3f3=_0x86d983;_0x39298c=0xc8;}else{_0x39298c=0xce;}_0x325cba[_0x6163('0x21')](_0x39298c);return _0x325cba[_0x6163('0x28')](_0x6163('0x29'),_0x34b470+'-'+_0x35e3f3+'/'+_0x86d983)[_0x6163('0x23')](_0x42cfb0);}return null;};}function patchUpdates(_0x3b8121){return function(_0x31326b){try{jsonpatch[_0x6163('0x2a')](_0x31326b,_0x3b8121,!![]);}catch(_0x125fc9){return BPromise[_0x6163('0x2b')](_0x125fc9);}return _0x31326b[_0x6163('0x2c')]();};}function saveUpdates(_0x48cda9,_0x500fd0){return function(_0x1c7c0b){if(_0x1c7c0b){return _0x1c7c0b['update'](_0x48cda9)[_0x6163('0x2d')](function(_0x227d67){return _0x227d67;});}return null;};}function removeEntity(_0x3d425b,_0xa552b2){return function(_0x5aa78f){if(_0x5aa78f){return _0x5aa78f[_0x6163('0x2e')]()[_0x6163('0x2d')](function(){_0x3d425b[_0x6163('0x21')](0xcc)[_0x6163('0x22')]();});}};}function handleEntityNotFound(_0x5dce29,_0x2d2677){return function(_0x27088e){if(!_0x27088e){_0x5dce29[_0x6163('0x20')](0x194);}return _0x27088e;};}function handleError(_0xf5a7e6,_0x29f5be){_0x29f5be=_0x29f5be||0x1f4;return function(_0x8c4445){logger[_0x6163('0x2f')](_0x8c4445[_0x6163('0x30')]);if(_0x8c4445['name']){delete _0x8c4445['name'];}_0xf5a7e6[_0x6163('0x21')](_0x29f5be)[_0x6163('0x31')](_0x8c4445);};}function getInteractionUsers(_0x5d7765,_0x4eac8c){return new BPromise(function(_0x2055d0,_0x3896e8){try{if(_0x4eac8c[_0x5d7765['id']]){_0x5d7765[_0x6163('0x32')]=_[_0x6163('0x33')](_0x4eac8c[_0x5d7765['id']],function(_0x172b98){return{'id':_0x172b98['id'],'fullname':_0x172b98[_0x6163('0x34')]};});}}catch(_0x36a117){_0x3896e8(_0x36a117);}_0x2055d0(_0x5d7765);});}function getInteractionTags(_0x5af67c,_0x5d781a){return new BPromise(function(_0x1bbb9a,_0x5cca2c){try{if(_0x5af67c[_0x6163('0x35')]){_0x5af67c['Tags']=[];_0x5af67c['TagIds'][_0x6163('0x36')](',')[_0x6163('0x37')](function(_0x2043b4){_0x5af67c[_0x6163('0x38')][_0x6163('0x39')](_0x5d781a[_0x2043b4]);});}delete _0x5af67c[_0x6163('0x35')];}catch(_0x4d5609){_0x5cca2c(_0x4d5609);}_0x1bbb9a(_0x5af67c);});}function updateOpenchannelInteraction(_0xa1d397,_0x3a4301,_0x3e62e4){return new BPromise(function(_0x488a7e,_0x46bc83){return getInteractionUsers(_0xa1d397,_0x3e62e4)['then'](function(_0x447c41){return getInteractionTags(_0x447c41,_0x3a4301);})[_0x6163('0x2d')](function(_0x2de9b4){return getStateInteraction(_0x2de9b4);})['then'](function(_0x193df5){_0x488a7e(_0x193df5);})['catch'](function(_0x41e720){_0x46bc83(_0x41e720);});});}function getStateInteraction(_0x2eacb0){return new BPromise(function(_0x3ceb53){_0x2eacb0[_0x6163('0x3a')]=0x0;_0x2eacb0[_0x6163('0x3b')]=0x0;_0x2eacb0[_0x6163('0x3c')]=0x0;_0x2eacb0[_0x6163('0x3d')]=0x0;_0x2eacb0[_0x6163('0x3e')]=0x0;if(!_0x2eacb0[_0x6163('0x3f')]&&!_0x2eacb0[_0x6163('0x40')]){_0x2eacb0[_0x6163('0x3a')]+=0x1;}if(!_0x2eacb0[_0x6163('0x3f')]&&_0x2eacb0[_0x6163('0x40')]){_0x2eacb0[_0x6163('0x3b')]+=0x1;if(_0x2eacb0[_0x6163('0x3a')]){_0x2eacb0['waiting']-=0x1;}}if(_0x2eacb0[_0x6163('0x3f')]&&_0x2eacb0['UserId']){_0x2eacb0[_0x6163('0x3c')]+=0x1;if(_0x2eacb0[_0x6163('0x3b')]){_0x2eacb0[_0x6163('0x3b')]-=0x1;}}if(_0x2eacb0[_0x6163('0x3f')]&&!_0x2eacb0[_0x6163('0x40')]){_0x2eacb0[_0x6163('0x3d')]+=0x1;if(_0x2eacb0[_0x6163('0x3a')]){_0x2eacb0[_0x6163('0x3a')]-=0x1;}}_0x2eacb0[_0x6163('0x3e')]+=0x1;_0x3ceb53(_0x2eacb0);});}exports[_0x6163('0x41')]=function(_0x35bf22,_0x460744){var _0xea7b21={},_0x293928={},_0x144d2b={'count':0x0,'rows':[]};var _0x544409=_[_0x6163('0x33')](db[_0x6163('0x42')][_0x6163('0x43')],function(_0x429d0e){return{'name':_0x429d0e['fieldName'],'type':_0x429d0e[_0x6163('0x44')][_0x6163('0x45')]};});_0x293928[_0x6163('0x46')]=_['map'](_0x544409,_0x6163('0x47'));_0x293928[_0x6163('0x48')]=_['keys'](_0x35bf22['query']);_0x293928['filters']=_[_0x6163('0x49')](_0x293928['model'],_0x293928[_0x6163('0x48')]);_0xea7b21[_0x6163('0x4a')]=_[_0x6163('0x49')](_0x293928[_0x6163('0x46')],qs[_0x6163('0x4b')](_0x35bf22['query'][_0x6163('0x4b')]));_0xea7b21['attributes']=_0xea7b21[_0x6163('0x4a')][_0x6163('0x4c')]?_0xea7b21[_0x6163('0x4a')]:_0x293928[_0x6163('0x46')];if(!_0x35bf22[_0x6163('0x48')][_0x6163('0x4d')]('nolimit')){_0xea7b21[_0x6163('0x26')]=qs[_0x6163('0x26')](_0x35bf22['query'][_0x6163('0x26')]);_0xea7b21['offset']=qs[_0x6163('0x24')](_0x35bf22[_0x6163('0x48')][_0x6163('0x24')]);}_0xea7b21['order']=qs['sort'](_0x35bf22[_0x6163('0x48')][_0x6163('0x4e')]);_0xea7b21['where']=qs[_0x6163('0x4f')](_[_0x6163('0x50')](_0x35bf22[_0x6163('0x48')],_0x293928[_0x6163('0x4f')]),_0x544409);var _0x5224f2=[];var _0x2063a5=squel[_0x6163('0x51')]()[_0x6163('0x52')]('id')[_0x6163('0x52')](_0x6163('0x47'))[_0x6163('0x52')]('color')[_0x6163('0x53')](_0x6163('0x54'));var _0xddeaf=squel[_0x6163('0x51')]()[_0x6163('0x52')](_0x6163('0x55'))[_0x6163('0x52')](_0x6163('0x56'))[_0x6163('0x52')]('ui.OpenchannelInteractionId')[_0x6163('0x53')](_0x6163('0x57'),'ui')[_0x6163('0x58')](_0x6163('0x59'),'u',_0x6163('0x5a'));var _0x2d9d6b=squel['select']()[_0x6163('0x53')]('openchannel_interactions','i')[_0x6163('0x58')](_0x6163('0x5b'),'c',_0x6163('0x5c'))[_0x6163('0x58')](_0x6163('0x59'),'o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0x6163('0x5d'))[_0x6163('0x58')](_0x6163('0x5e'),'me',_0x6163('0x5f'))[_0x6163('0x58')](_0x6163('0x60'),'it',_0x6163('0x61'))['left_join'](_0x6163('0x54'),'t','t.id\x20=\x20it.TagId');var _0x4c32d8=squel[_0x6163('0x62')]();var _0x995bbd=[];var _0x371d18=squel['expr']();var _0x6a880c;if(_0x35bf22[_0x6163('0x48')][_0x6163('0x63')]){_0x6a880c=as[_0x6163('0x64')](_0x35bf22[_0x6163('0x48')][_0x6163('0x63')]);var _0x1f7352=_0x6a880c[_0x6163('0x65')];for(var _0xe5022c=0x0;_0xe5022c<_0x6a880c[_0x6163('0x66')]['length'];_0xe5022c++){var _0x3cdbf7=_0x6a880c[_0x6163('0x66')][_0xe5022c];var _0x5d64e3='i';var _0x4cdbac=_[_0x6163('0x67')](_0x544409,[_0x6163('0x47'),_0x3cdbf7[_0x6163('0x52')]]);if(!_0x4cdbac){switch(_0x3cdbf7[_0x6163('0x52')]){case'unreadMessages':if(_0x3cdbf7[_0x6163('0x68')]==0x1){_0x2d9d6b[_0x6163('0x69')]('`'+_0x3cdbf7[_0x6163('0x52')]+'`\x20=\x200');}else{_0x2d9d6b[_0x6163('0x69')]('`'+_0x3cdbf7[_0x6163('0x52')]+_0x6163('0x6a'));}break;case _0x6163('0x6b'):if(_0x3cdbf7[_0x6163('0x6c')]===_0x6163('0x6d')){if(_0x3cdbf7[_0x6163('0x68')]['split']('\x20')['length']>0x1){_0x4c32d8[_0x1f7352](_0x6163('0x6e'),qs['getFullTextValue'](_0x3cdbf7['value']),null);}else{var _0x3a29dc='%'+_0x3cdbf7[_0x6163('0x68')]+'%';_0x4c32d8[_0x1f7352](_0x6163('0x6f'),_0x3a29dc,_0x3a29dc,_0x3a29dc);}}else{_0x4cdbac=_['find'](_0x544409,[_0x6163('0x47'),_0x6163('0x70')]);_0x3cdbf7[_0x6163('0x52')]=_0x6163('0x70');_0x1b3168=as[_0x6163('0x71')](_0x5d64e3,_0x4cdbac[_0x6163('0x44')],_0x3cdbf7);_0x4c32d8[_0x1f7352](_0x1b3168[_0x6163('0x72')],_0x1b3168['value'][_0x6163('0x73')],_0x1b3168[_0x6163('0x68')][_0x6163('0x22')]);}break;case _0x6163('0x74'):var _0x2f2467=_0x3cdbf7[_0x6163('0x68')][_0x6163('0x36')](',')[_0x6163('0x33')](function(_0x57243d){return Number(_0x57243d);});_0x2f2467[_0x6163('0x37')](function(_0x299ece){_0x371d18['or'](_0x6163('0x75'),'%,'+_0x299ece+',%');});_0x995bbd=_['union'](_0x995bbd,_0x2f2467);break;case _0x6163('0x76'):if(_0x3cdbf7[_0x6163('0x6c')]===_0x6163('0x6d')){_0x4c32d8[_0x1f7352](_0x6163('0x77'),'%'+_0x3cdbf7[_0x6163('0x68')]+'%',null);}else{_0x4cdbac=_[_0x6163('0x67')](_0x544409,[_0x6163('0x47'),'UserId']);_0x3cdbf7[_0x6163('0x52')]=_0x6163('0x40');_0x1b3168=as[_0x6163('0x71')](_0x5d64e3,_0x4cdbac[_0x6163('0x44')],_0x3cdbf7);_0x4c32d8[_0x1f7352](_0x1b3168[_0x6163('0x72')],_0x1b3168[_0x6163('0x68')][_0x6163('0x73')],_0x1b3168[_0x6163('0x68')][_0x6163('0x22')]);}break;case'body':_0x1b3168=as[_0x6163('0x71')]('me',null,_0x3cdbf7);_0x4c32d8[_0x1f7352](_0x1b3168[_0x6163('0x72')],_0x1b3168['value'][_0x6163('0x73')],_0x1b3168[_0x6163('0x68')]['end']);break;}}else{var _0x1b3168=as[_0x6163('0x71')](_0x5d64e3,_0x4cdbac[_0x6163('0x44')],_0x3cdbf7);_0x4c32d8[_0x1f7352](_0x1b3168[_0x6163('0x72')],_0x1b3168[_0x6163('0x68')][_0x6163('0x73')],_0x1b3168['value'][_0x6163('0x22')]);}}}else{var _0x4e8874=_(_0x35bf22[_0x6163('0x48')])['keys']()[_0x6163('0x33')](function(_0x138693){return _[_0x6163('0x78')](_0x544409,[_0x6163('0x47'),_0x138693])?_0x138693:undefined;})[_0x6163('0x79')]()['value']();if(!_[_0x6163('0x7a')](_0x4e8874)){_0x4e8874[_0x6163('0x37')](function(_0x29e10d){if(_0x29e10d==='OpenchannelAccountId'){_0x2d9d6b[_0x6163('0x7b')](_0x6163('0x7c'),[]['concat'](_0x35bf22[_0x6163('0x48')][_0x29e10d]));}else if(_0x29e10d===_0x6163('0x7d')){var _0x34e737=JSON[_0x6163('0x7e')](_0x35bf22[_0x6163('0x48')][_0x29e10d])[_0x6163('0x7f')];var _0x5c0289=JSON[_0x6163('0x7e')](_0x35bf22[_0x6163('0x48')][_0x29e10d])[_0x6163('0x80')];_0x2d9d6b['where'](_0x6163('0x81'),_0x34e737,_0x5c0289);}else{if(_0x35bf22[_0x6163('0x48')][_0x29e10d]===_0x6163('0x82')){_0x2d9d6b['where']('i.'+_0x29e10d+_0x6163('0x83'));}else{_0x2d9d6b[_0x6163('0x7b')]('i.'+_0x29e10d+_0x6163('0x84'),_0x35bf22[_0x6163('0x48')][_0x29e10d]);}}});}if(_0x35bf22[_0x6163('0x48')][_0x6163('0x85')]){if(_0x35bf22[_0x6163('0x48')][_0x6163('0x85')]==0x1){_0x2d9d6b[_0x6163('0x69')](_0x6163('0x86'));}else{_0x2d9d6b[_0x6163('0x69')](_0x6163('0x87'));}}if(_0x35bf22[_0x6163('0x48')][_0x6163('0x88')]){_0x995bbd=_[_0x6163('0x89')](_0x35bf22[_0x6163('0x48')][_0x6163('0x88')])?_0x35bf22[_0x6163('0x48')][_0x6163('0x88')]:new Array(_0x35bf22['query'][_0x6163('0x88')]);_0x995bbd[_0x6163('0x37')](function(_0x41387b){_0x371d18['or'](_0x6163('0x75'),'%,'+_0x41387b+',%');});}if(_0x35bf22[_0x6163('0x48')][_0x6163('0x8a')]){var _0x44e675=_0x35bf22[_0x6163('0x48')][_0x6163('0x8a')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6163('0x8b')](_0x44e675)){_0x4c32d8['or'](_0x6163('0x8c'),_0x44e675+'%');}else{_0x4c32d8['or'](_0x6163('0x8d'),qs['getFullTextValue'](_0x44e675))['or'](_0x6163('0x8e'),_0x44e675+'%')['or'](_0x6163('0x8f'),_0x44e675+'%');}}}_0x2d9d6b[_0x6163('0x7b')](_0x4c32d8);_0x2d9d6b['group'](_0x6163('0x90'));var _0x1866d1={'type':db[_0x6163('0x91')][_0x6163('0x92')][_0x6163('0x93')],'raw':!![]};var _0x4292b8=_0x2d9d6b[_0x6163('0x94')]();_0x4292b8['field'](_0x6163('0x90'));_0x4292b8['field'](_0x6163('0x95'),'unreadMessages');if(_0xea7b21[_0x6163('0x96')]){_0xea7b21['order'][_0x6163('0x37')](function(_0x2c045a){var _0x3f26bd=_0x2c045a[0x0]===_0x6163('0x97')?_0x2c045a[0x0]:'i.'+_0x2c045a[0x0];_0x2d9d6b[_0x6163('0x96')](_0x3f26bd,_0x2c045a[0x1]===_0x6163('0x98')?![]:!![]);});}if(!_['isEmpty'](_0x995bbd)){_0x2d9d6b['having'](_0x371d18);_0x4292b8[_0x6163('0x7b')](_0x6163('0x99'),_0x995bbd);}BPromise[_0x6163('0x9a')]()[_0x6163('0x2d')](function(){if(!_0x6a880c){if(_0x35bf22[_0x6163('0x48')][_0x6163('0x9b')])return;_0x4292b8[_0x6163('0x7b')](_0x6163('0x9c'));_0x2d9d6b[_0x6163('0x7b')](_0x6163('0x9c'));return;}if(_0x35bf22['user']['role']!==_0x6163('0x9d'))return;return _0x35bf22['user'][_0x6163('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x49451c){if(_[_0x6163('0x7a')](_0x49451c)){_0x4292b8[_0x6163('0x7b')](_0x6163('0x9f'));_0x2d9d6b[_0x6163('0x7b')](_0x6163('0x9f'));}else{_0x4292b8[_0x6163('0x7b')](_0x6163('0x7c'),_['map'](_0x49451c,'id'));_0x2d9d6b[_0x6163('0x7b')](_0x6163('0x7c'),_[_0x6163('0x33')](_0x49451c,'id'));}});})[_0x6163('0x2d')](function(){if(_0x35bf22[_0x6163('0xa0')]['role']===_0x6163('0x9d')&&!_0x6a880c&&!_0x35bf22[_0x6163('0x48')]['OpenchannelAccountId'])return[];return db[_0x6163('0xa1')][_0x6163('0x48')](_0x4292b8[_0x6163('0xa2')](),_0x1866d1);})[_0x6163('0x2d')](function(_0x4e81ae){_0x144d2b['count']=_0x4e81ae[_0x6163('0x4c')];if(_0x144d2b[_0x6163('0x27')]===0x0)return[];return db[_0x6163('0xa1')][_0x6163('0x48')](_0x2063a5['toString'](),_0x1866d1)[_0x6163('0x2d')](function(_0x6892d8){_0x5224f2=_['keyBy'](_0x6892d8,'id');_0x1866d1=_['merge'](_0x1866d1,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35bf22[_0x6163('0x48')][_0x6163('0x4b')]){_0xea7b21[_0x6163('0x4a')][_0x6163('0x37')](function(_0x36ce3c){_0x2d9d6b[_0x6163('0x52')]('i.'+_0x36ce3c);});}else{_0x2d9d6b[_0x6163('0x52')](_0x6163('0x95'),'unreadMessages');_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa3'),'Account.key');_0x2d9d6b['field'](_0x6163('0xa4'),_0x6163('0xa5'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa6'),_0x6163('0x97'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa7'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa8'),'Contact.firstName');_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa9'),'Contact.lastName');_0x2d9d6b[_0x6163('0x52')](_0x6163('0xaa'),_0x6163('0xab'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xac'),'Contact.phone');_0x2d9d6b[_0x6163('0x52')]('c.mobile',_0x6163('0xad'));_0x2d9d6b['field'](_0x6163('0xae'),_0x6163('0xaf'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xb0'),_0x6163('0xb1'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xb2'),'Owner.internal');_0x2d9d6b[_0x6163('0x52')](_0x6163('0xb3'),_0x6163('0x35'));}if(_0xea7b21[_0x6163('0x26')])_0x2d9d6b['limit'](_0xea7b21['limit']);if(_0xea7b21['offset'])_0x2d9d6b[_0x6163('0x24')](_0xea7b21['offset']);return db[_0x6163('0xa1')][_0x6163('0x48')](_0x2d9d6b['toString'](),_0x1866d1);})['then'](function(_0x104cc1){if(_0x104cc1[_0x6163('0x4c')]>0x0)_0xddeaf[_0x6163('0x7b')](_0x6163('0xb4'),_['map'](_0x104cc1,'id'));return db[_0x6163('0xa1')][_0x6163('0x48')](_0xddeaf[_0x6163('0xa2')](),_0x1866d1)[_0x6163('0x2d')](function(_0x2e195c){var _0x2d36bc=_[_0x6163('0xb5')](_0x2e195c,_0x6163('0xb6'));var _0x2f1d96=[];_0x104cc1[_0x6163('0x37')](function(_0x3139f1){_0x2f1d96['push'](updateOpenchannelInteraction(_0x3139f1,_0x5224f2,_0x2d36bc));});return BPromise[_0x6163('0xb7')](_0x2f1d96);});});})[_0x6163('0x2d')](function(_0x47e866){_0x144d2b['rows']=_0x47e866;return _0x144d2b;})[_0x6163('0x2d')](respondWithFilteredResult(_0x460744,_0xea7b21))[_0x6163('0xb8')](handleError(_0x460744,null));};exports[_0x6163('0xb9')]=function(_0x335879,_0x1009f3){var _0x30c05a={};if(_0x335879[_0x6163('0x48')][_0x6163('0x44')]&&_0x335879['query'][_0x6163('0x44')]===_0x6163('0x53')){_0x30c05a[_0x6163('0x53')]=_0x335879[_0x6163('0xba')]['id'];}else{_0x30c05a['id']=_0x335879['params']['id'];}var _0x5e2008={'raw':![],'where':_0x30c05a},_0x37dd9a={};_0x37dd9a['model']=_[_0x6163('0xbb')](db[_0x6163('0x42')][_0x6163('0x43')]);_0x37dd9a[_0x6163('0x48')]=_[_0x6163('0xbb')](_0x335879[_0x6163('0x48')]);_0x37dd9a[_0x6163('0x4f')]=_['intersection'](_0x37dd9a[_0x6163('0x46')],_0x37dd9a['query']);_0x5e2008[_0x6163('0x4a')]=_[_0x6163('0x49')](_0x37dd9a[_0x6163('0x46')],qs['fields'](_0x335879[_0x6163('0x48')][_0x6163('0x4b')]));_0x5e2008[_0x6163('0x4a')]=_0x5e2008[_0x6163('0x4a')][_0x6163('0x4c')]?_0x5e2008[_0x6163('0x4a')]:_0x37dd9a[_0x6163('0x46')];if(_0x335879['query'][_0x6163('0xbc')]){_0x5e2008[_0x6163('0xbd')]=[{'all':!![]}];}_0x5e2008=_[_0x6163('0xbe')]({},_0x5e2008,_0x335879[_0x6163('0xbf')]);return db[_0x6163('0x42')][_0x6163('0x67')](_0x5e2008)[_0x6163('0x2d')](handleEntityNotFound(_0x1009f3,null))[_0x6163('0x2d')](respondWithResult(_0x1009f3,null))[_0x6163('0xb8')](handleError(_0x1009f3,null));};exports[_0x6163('0xc0')]=function(_0x407d2c,_0x5ef281){return db[_0x6163('0x42')][_0x6163('0xc0')](_0x407d2c[_0x6163('0xc1')],{})['then'](respondWithResult(_0x5ef281,0xc9))[_0x6163('0xb8')](handleError(_0x5ef281,null));};exports[_0x6163('0xc2')]=function(_0x3a76a8,_0x52adfd){if(_0x3a76a8['body']['id']){delete _0x3a76a8[_0x6163('0xc1')]['id'];}return db[_0x6163('0x42')][_0x6163('0x67')]({'where':{'id':_0x3a76a8[_0x6163('0xba')]['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x52adfd,null))['then'](saveUpdates(_0x3a76a8[_0x6163('0xc1')],null))[_0x6163('0x2d')](respondWithResult(_0x52adfd,null))[_0x6163('0xb8')](handleError(_0x52adfd,null));};exports[_0x6163('0x2e')]=function(_0xd6c3b7,_0x667d){return db['OpenchannelInteraction']['find']({'where':{'id':_0xd6c3b7['params']['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x667d,null))['then'](removeEntity(_0x667d,null))['catch'](handleError(_0x667d,null));};exports['describe']=function(_0x11fd33,_0xee4223){return db['OpenchannelInteraction'][_0x6163('0xc3')]()[_0x6163('0x2d')](respondWithResult(_0xee4223,null))[_0x6163('0xb8')](handleError(_0xee4223,null));};exports[_0x6163('0xc4')]=function(_0x3aceb9,_0x246998,_0x3e48df){return db[_0x6163('0xc5')][_0x6163('0x67')]({'where':{'id':_0x3aceb9[_0x6163('0xba')]['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x246998,null))[_0x6163('0x2d')](function(_0x128ba4){if(_0x128ba4){return _0x128ba4[_0x6163('0xc4')](_0x3aceb9[_0x6163('0xc1')][_0x6163('0xc6')],_[_0x6163('0xc7')](_0x3aceb9[_0x6163('0xc1')],['ids','id'])||{});}})[_0x6163('0x2d')](respondWithResult(_0x246998,null))[_0x6163('0xb8')](handleError(_0x246998,null));};exports[_0x6163('0xc8')]=function(_0x43d124,_0x31a002,_0x40aca1){var _0x690f6e={'raw':![],'where':{}};var _0x31e789={};var _0x1946b1={'count':0x0,'rows':[]};return db[_0x6163('0x42')][_0x6163('0xc9')]({'where':{'id':_0x43d124['params']['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x31a002,null))[_0x6163('0x2d')](function(_0x11eabb){if(_0x11eabb){_0x31e789[_0x6163('0x46')]=_[_0x6163('0xbb')](db[_0x6163('0xc5')][_0x6163('0x43')]);_0x31e789[_0x6163('0x48')]=_['keys'](_0x43d124[_0x6163('0x48')]);_0x31e789['filters']=_[_0x6163('0x49')](_0x31e789[_0x6163('0x46')],_0x31e789[_0x6163('0x48')]);_0x690f6e[_0x6163('0x4a')]=_[_0x6163('0x49')](_0x31e789[_0x6163('0x46')],qs[_0x6163('0x4b')](_0x43d124[_0x6163('0x48')][_0x6163('0x4b')]));_0x690f6e['attributes']=_0x690f6e[_0x6163('0x4a')][_0x6163('0x4c')]?_0x690f6e[_0x6163('0x4a')]:_0x31e789[_0x6163('0x46')];if(!_0x43d124[_0x6163('0x48')][_0x6163('0x4d')](_0x6163('0xca'))){_0x690f6e[_0x6163('0x26')]=qs[_0x6163('0x26')](_0x43d124[_0x6163('0x48')][_0x6163('0x26')]);_0x690f6e[_0x6163('0x24')]=qs[_0x6163('0x24')](_0x43d124['query']['offset']);}_0x690f6e[_0x6163('0x96')]=qs[_0x6163('0x4e')](_0x43d124[_0x6163('0x48')][_0x6163('0x4e')]);_0x690f6e['where']=qs['filters'](_[_0x6163('0x50')](_0x43d124[_0x6163('0x48')],_0x31e789[_0x6163('0x4f')]));_0x690f6e['where']['OpenchannelInteractionId']=_0x11eabb['id'];if(_0x43d124[_0x6163('0x48')][_0x6163('0x8a')]){_0x690f6e[_0x6163('0x7b')]=_[_0x6163('0xbe')](_0x690f6e[_0x6163('0x7b')],{'$or':_[_0x6163('0x33')](_0x690f6e[_0x6163('0x4a')],function(_0x653592){var _0x50eefe={};_0x50eefe[_0x653592]={'$like':'%'+_0x43d124['query'][_0x6163('0x8a')]+'%'};return _0x50eefe;})});}if(_0x43d124[_0x6163('0x48')][_0x6163('0x7f')]){var _0x55868c=_0x43d124[_0x6163('0x48')][_0x6163('0x7f')]['split'](',');var _0x85f4ae={};_0x85f4ae[_0x55868c[0x0]]={'$gte':moment(_0x55868c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x690f6e[_0x6163('0x7b')]=_[_0x6163('0xbe')](_0x690f6e[_0x6163('0x7b')],_0x85f4ae);}_0x690f6e=_[_0x6163('0xbe')]({},_0x690f6e,_0x43d124[_0x6163('0xbf')]);return db[_0x6163('0xc5')][_0x6163('0x27')]({'where':_0x690f6e['where']})[_0x6163('0x2d')](function(_0x406012){_0x1946b1[_0x6163('0x27')]=_0x406012;if(_0x43d124[_0x6163('0x48')][_0x6163('0xbc')]){_0x690f6e['include']=[{'all':!![]}];}return db[_0x6163('0xc5')][_0x6163('0xcb')](_0x690f6e);})[_0x6163('0x2d')](function(_0x10c9c9){_0x1946b1[_0x6163('0xcc')]=_0x10c9c9;return _0x1946b1;});}})['then'](respondWithFilteredResult(_0x31a002,_0x690f6e))['catch'](handleError(_0x31a002,null));};exports[_0x6163('0xcd')]=function(_0x1536b7,_0x41fffa,_0x386aa0){return db[_0x6163('0x42')][_0x6163('0x67')]({'where':{'id':_0x1536b7[_0x6163('0xba')]['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x41fffa,null))[_0x6163('0x2d')](function(_0x1902c4){if(_0x1902c4){return _0x1902c4[_0x6163('0xce')](_0x1536b7['body'][_0x6163('0xc6')],_['omit'](_0x1536b7[_0x6163('0xc1')],[_0x6163('0xc6'),'id'])||{})['spread'](function(){return db[_0x6163('0x74')]['findAll']({'attributes':['id',_0x6163('0x47'),_0x6163('0xcf')],'where':{'id':_0x1536b7['body'][_0x6163('0xc6')]}});})[_0x6163('0x2d')](function(_0x4af184){socket[_0x6163('0xd0')](_0x6163('0xd1'),{'id':Number(_0x1536b7[_0x6163('0xba')]['id']),'tags':_0x4af184||[]});return{'id':Number(_0x1536b7[_0x6163('0xba')]['id']),'tags':_0x4af184||[]};});}})[_0x6163('0x2d')](respondWithResult(_0x41fffa,null))[_0x6163('0xb8')](handleError(_0x41fffa,null));};exports[_0x6163('0xd2')]=function(_0xd2e9fd,_0x224416,_0x50ec25){return db[_0x6163('0x42')][_0x6163('0x67')]({'where':{'id':_0xd2e9fd[_0x6163('0xba')]['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x224416,null))['then'](function(_0x526839){if(_0x526839){return _0x526839['removeTags'](_0xd2e9fd[_0x6163('0x48')]['ids']);}})[_0x6163('0x2d')](respondWithStatusCode(_0x224416,null))[_0x6163('0xb8')](handleError(_0x224416,null));};exports[_0x6163('0xd3')]=function(_0x188d5c,_0x45511f){var _0x2ac3d4=moment()[_0x6163('0xd4')]()[_0x6163('0xa2')]();var _0x5044a1=path[_0x6163('0xd5')](config[_0x6163('0xd6')],'server','files','tmp');var _0x1d7e93=path[_0x6163('0xd5')](config[_0x6163('0xd6')],_0x6163('0xd7'),_0x6163('0xd8'),_0x6163('0xd9'));var _0x3f4547=path[_0x6163('0xd5')](_0x5044a1,_0x2ac3d4);var _0x5dcb0f=util['format'](_0x6163('0xda'),_0x188d5c[_0x6163('0xba')]['id'],_0x2ac3d4);var _0x2d190e=path[_0x6163('0xd5')](_0x5044a1,_0x5dcb0f);var _0x218ed9=[];_0x218ed9['push']({'model':db[_0x6163('0x76')],'as':'User','attributes':['id',_0x6163('0x34')],'raw':!![]});_0x218ed9[_0x6163('0x39')]({'model':db['CmContact'],'as':_0x6163('0x6b'),'attributes':['id',_0x6163('0xdb'),_0x6163('0xdc')],'raw':!![]});if(_0x188d5c[_0x6163('0x48')][_0x6163('0xd9')]){_0x218ed9[_0x6163('0x39')]({'model':db[_0x6163('0xdd')],'as':'Attachment','raw':!![]});}var _0x39cdfe=[{'model':db[_0x6163('0xc5')],'as':'Messages','attributes':['id','body','createdAt',_0x6163('0xde'),'secret',_0x6163('0x85')],'include':_0x218ed9}];_0x39cdfe[_0x6163('0x39')]({'model':db[_0x6163('0xdf')],'as':_0x6163('0xe0'),'attributes':['id',_0x6163('0x47')]});_0x39cdfe['push']({'model':db['User'],'as':_0x6163('0xe1'),'attributes':['id',_0x6163('0x34')]});return db[_0x6163('0x42')][_0x6163('0x67')]({'where':{'id':_0x188d5c[_0x6163('0xba')]['id']},'include':_0x39cdfe})['then'](handleEntityNotFound(_0x45511f,null))['then'](function(_0x57a69c){if(_0x57a69c){var _0x5dde94=_0x57a69c[_0x6163('0xe2')]({'plain':!![]});fs[_0x6163('0xe3')](_0x3f4547);var _0x4c5f59={'channel':'Openchannel','account':_0x5dde94['Account']['name'],'agent':_0x5dde94[_0x6163('0xe1')]?_0x5dde94['Owner']['fullname']:_0x6163('0xe4'),'createdAt':moment(_0x5dde94[_0x6163('0x7d')])[_0x6163('0xe5')](_0x6163('0xe6'))[_0x6163('0xa2')](),'closedAt':_0x5dde94[_0x6163('0x3f')]?moment(_0x5dde94[_0x6163('0xe7')])[_0x6163('0xe5')](_0x6163('0xe6'))[_0x6163('0xa2')]():'','disposition':_0x5dde94[_0x6163('0xe8')],'visibility':_0x5dde94[_0x6163('0xe9')]?'Public':_0x6163('0xea'),'messages':_(_0x5dde94[_0x6163('0xeb')])[_0x6163('0x8a')]({'secret':![]})[_0x6163('0x33')](function(_0x4e1c0f){if(_0x4e1c0f[_0x6163('0xdd')]){var _0x514cd2=path[_0x6163('0xd5')](_0x1d7e93,_0x4e1c0f[_0x6163('0xdd')][_0x6163('0xec')]);if(fs[_0x6163('0xed')](_0x514cd2)){fs[_0x6163('0xee')](_0x514cd2)[_0x6163('0xef')](fs['createWriteStream'](path[_0x6163('0xd5')](_0x3f4547,_0x4e1c0f[_0x6163('0xdd')][_0x6163('0xec')])));}}return{'date':moment(_0x4e1c0f[_0x6163('0x7d')])['format'](_0x6163('0xe6'))[_0x6163('0xa2')](),'sender':_0x4e1c0f[_0x6163('0xde')]==='out'?_0x4e1c0f['User']?_0x4e1c0f[_0x6163('0x76')][_0x6163('0x34')]:_0x6163('0xf0'):_0x4e1c0f[_0x6163('0x6b')][_0x6163('0xdb')]+(_0x4e1c0f[_0x6163('0x6b')][_0x6163('0xdc')]?'\x20'+_0x4e1c0f[_0x6163('0x6b')][_0x6163('0xdc')]:''),'body':_0x4e1c0f[_0x6163('0xdd')]?_0x4e1c0f['Attachment'][_0x6163('0xec')]:_0x4e1c0f[_0x6163('0xc1')],'direction':_0x4e1c0f[_0x6163('0xde')]===_0x6163('0xf1')?'A':'C','secret':_0x4e1c0f[_0x6163('0xf2')],'read':_0x4e1c0f['read'],'attachment':_0x4e1c0f['Attachment']};})[_0x6163('0x68')]()};return ejs['renderFile'](path[_0x6163('0xd5')](config[_0x6163('0xd6')],'server',_0x6163('0xf3'),_0x6163('0xf4')),{'interaction':_0x4c5f59})[_0x6163('0x2d')](function(_0x31bb03){var _0x49ed3d=path['join'](_0x3f4547,_0x6163('0xf5')+_0x5dde94['id']+'-'+_0x2ac3d4+_0x6163('0xf6'));var _0x4e80d8={'path':_0x49ed3d,'channel':_0x6163('0xf7'),'interactionId':_0x5dde94['id']};return pdf['createPdfFromHTML'](_0x31bb03,_0x4e80d8);})[_0x6163('0x2d')](function(){return new BPromise(function(_0x1080f9,_0x477b60){zipdir(_0x3f4547,{'saveTo':_0x2d190e},function(_0x2dc716,_0x53d66c){if(_0x2dc716)return _0x477b60(_0x2dc716);return _0x1080f9(_0x53d66c);});})[_0x6163('0x2d')](function(){return new BPromise(function(_0x35e555,_0x459234){rimraf(_0x3f4547,function(_0x1f6b5d){if(_0x1f6b5d)_0x459234(_0x1f6b5d);return _0x35e555();});});})[_0x6163('0x2d')](function(){return _0x45511f['download'](_0x2d190e,_0x5dcb0f,function(_0x2b134a){if(_0x2b134a){console[_0x6163('0xf8')](_0x6163('0xf9'),_0x2b134a);}else{fs[_0x6163('0xfa')](_0x2d190e);}});});});}else{return _0x45511f[_0x6163('0x20')](0xc8);}})[_0x6163('0xb8')](handleError(_0x45511f,null));}; \ No newline at end of file +var _0x2aac=['Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','pipe','createWriteStream','basename','out','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','stack','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','body','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','merge','options','create','update','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread'];(function(_0x41d0ba,_0x5ea2de){var _0x47ae0a=function(_0xdb88b2){while(--_0xdb88b2){_0x41d0ba['push'](_0x41d0ba['shift']());}};_0x47ae0a(++_0x5ea2de);}(_0x2aac,0x118));var _0xc2aa=function(_0x154975,_0x20bab8){_0x154975=_0x154975-0x0;var _0x238018=_0x2aac[_0x154975];return _0x238018;};'use strict';var emlformat=require(_0xc2aa('0x0'));var rimraf=require(_0xc2aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc2aa('0x2'));var BPromise=require(_0xc2aa('0x3'));var Mustache=require(_0xc2aa('0x4'));var util=require(_0xc2aa('0x5'));var path=require(_0xc2aa('0x6'));var sox=require(_0xc2aa('0x7'));var csv=require(_0xc2aa('0x8'));var ejs=require(_0xc2aa('0x9'));var fs=require('fs');var fs_extra=require(_0xc2aa('0xa'));var _=require(_0xc2aa('0xb'));var squel=require('squel');var crypto=require(_0xc2aa('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc2aa('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc2aa('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc2aa('0xe'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xc2aa('0xf'));var hardwareService=require(_0xc2aa('0x10'));var logger=require('../../config/logger')(_0xc2aa('0x11'));var utils=require(_0xc2aa('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc2aa('0x13'));var db=require(_0xc2aa('0x14'))['db'];config[_0xc2aa('0x15')]=_['defaults'](config['redis'],{'host':_0xc2aa('0x16'),'port':0x18eb});var socket=require(_0xc2aa('0x17'))(new Redis(config[_0xc2aa('0x15')]));require(_0xc2aa('0x18'))[_0xc2aa('0x19')](socket);function respondWithStatusCode(_0x291360,_0xe2ef78){_0xe2ef78=_0xe2ef78||0xcc;return function(_0x789a54){if(_0x789a54){return _0x291360[_0xc2aa('0x1a')](_0xe2ef78);}return _0x291360[_0xc2aa('0x1b')](_0xe2ef78)[_0xc2aa('0x1c')]();};}function respondWithResult(_0x151e74,_0x56f74d){_0x56f74d=_0x56f74d||0xc8;return function(_0x325593){if(_0x325593){return _0x151e74[_0xc2aa('0x1b')](_0x56f74d)[_0xc2aa('0x1d')](_0x325593);}};}function respondWithFilteredResult(_0x4043e7,_0x35cfbc){return function(_0xd04c1){if(_0xd04c1){var _0x5a16cc=typeof _0x35cfbc[_0xc2aa('0x1e')]===_0xc2aa('0x1f')&&typeof _0x35cfbc[_0xc2aa('0x20')]===_0xc2aa('0x1f');var _0x12afab=_0xd04c1[_0xc2aa('0x21')];var _0x1ce6e7=_0x5a16cc?0x0:_0x35cfbc['offset'];var _0x44b1d4=_0x5a16cc?_0xd04c1[_0xc2aa('0x21')]:_0x35cfbc[_0xc2aa('0x1e')]+_0x35cfbc[_0xc2aa('0x20')];var _0x31d2f9;if(_0x44b1d4>=_0x12afab){_0x44b1d4=_0x12afab;_0x31d2f9=0xc8;}else{_0x31d2f9=0xce;}_0x4043e7[_0xc2aa('0x1b')](_0x31d2f9);return _0x4043e7['set'](_0xc2aa('0x22'),_0x1ce6e7+'-'+_0x44b1d4+'/'+_0x12afab)[_0xc2aa('0x1d')](_0xd04c1);}return null;};}function patchUpdates(_0xf624bb){return function(_0x21022b){try{jsonpatch['apply'](_0x21022b,_0xf624bb,!![]);}catch(_0x8c5b33){return BPromise[_0xc2aa('0x23')](_0x8c5b33);}return _0x21022b[_0xc2aa('0x24')]();};}function saveUpdates(_0x1a6e91,_0x201668){return function(_0x438524){if(_0x438524){return _0x438524['update'](_0x1a6e91)[_0xc2aa('0x25')](function(_0x1569b9){return _0x1569b9;});}return null;};}function removeEntity(_0x24b871,_0x1e6829){return function(_0x18c1d9){if(_0x18c1d9){return _0x18c1d9[_0xc2aa('0x26')]()['then'](function(){_0x24b871[_0xc2aa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x533661,_0x467ee5){return function(_0x37f707){if(!_0x37f707){_0x533661[_0xc2aa('0x1a')](0x194);}return _0x37f707;};}function handleError(_0x2a7f89,_0x12b04a){_0x12b04a=_0x12b04a||0x1f4;return function(_0x42bc32){logger['error'](_0x42bc32[_0xc2aa('0x27')]);if(_0x42bc32[_0xc2aa('0x28')]){delete _0x42bc32[_0xc2aa('0x28')];}_0x2a7f89['status'](_0x12b04a)[_0xc2aa('0x29')](_0x42bc32);};}function getInteractionUsers(_0x3caa14,_0x251cb7){return new BPromise(function(_0x1cf8ac,_0x137edb){try{if(_0x251cb7[_0x3caa14['id']]){_0x3caa14[_0xc2aa('0x2a')]=_[_0xc2aa('0x2b')](_0x251cb7[_0x3caa14['id']],function(_0x3aa8dd){return{'id':_0x3aa8dd['id'],'fullname':_0x3aa8dd[_0xc2aa('0x2c')]};});}}catch(_0x1cb86e){_0x137edb(_0x1cb86e);}_0x1cf8ac(_0x3caa14);});}function getInteractionTags(_0x400fcd,_0x31a95a){return new BPromise(function(_0x56fbdc,_0x2e12b7){try{if(_0x400fcd['TagIds']){_0x400fcd[_0xc2aa('0x2d')]=[];_0x400fcd['TagIds'][_0xc2aa('0x2e')](',')[_0xc2aa('0x2f')](function(_0x18dd52){_0x400fcd[_0xc2aa('0x2d')][_0xc2aa('0x30')](_0x31a95a[_0x18dd52]);});}delete _0x400fcd[_0xc2aa('0x31')];}catch(_0x28cae8){_0x2e12b7(_0x28cae8);}_0x56fbdc(_0x400fcd);});}function updateOpenchannelInteraction(_0x3b253f,_0x53a525,_0x336778){return new BPromise(function(_0x4af494,_0x117fbe){return getInteractionUsers(_0x3b253f,_0x336778)[_0xc2aa('0x25')](function(_0x2b458f){return getInteractionTags(_0x2b458f,_0x53a525);})[_0xc2aa('0x25')](function(_0x3e4a51){return getStateInteraction(_0x3e4a51);})[_0xc2aa('0x25')](function(_0x19a890){_0x4af494(_0x19a890);})[_0xc2aa('0x32')](function(_0x371ec0){_0x117fbe(_0x371ec0);});});}function getStateInteraction(_0x39f3e8){return new BPromise(function(_0x630957){_0x39f3e8[_0xc2aa('0x33')]=0x0;_0x39f3e8[_0xc2aa('0x34')]=0x0;_0x39f3e8[_0xc2aa('0x35')]=0x0;_0x39f3e8[_0xc2aa('0x36')]=0x0;_0x39f3e8[_0xc2aa('0x37')]=0x0;if(!_0x39f3e8['closed']&&!_0x39f3e8[_0xc2aa('0x38')]){_0x39f3e8[_0xc2aa('0x33')]+=0x1;}if(!_0x39f3e8[_0xc2aa('0x39')]&&_0x39f3e8[_0xc2aa('0x38')]){_0x39f3e8['talking']+=0x1;if(_0x39f3e8[_0xc2aa('0x33')]){_0x39f3e8[_0xc2aa('0x33')]-=0x1;}}if(_0x39f3e8['closed']&&_0x39f3e8['UserId']){_0x39f3e8[_0xc2aa('0x35')]+=0x1;if(_0x39f3e8['talking']){_0x39f3e8[_0xc2aa('0x34')]-=0x1;}}if(_0x39f3e8[_0xc2aa('0x39')]&&!_0x39f3e8['UserId']){_0x39f3e8[_0xc2aa('0x36')]+=0x1;if(_0x39f3e8[_0xc2aa('0x33')]){_0x39f3e8[_0xc2aa('0x33')]-=0x1;}}_0x39f3e8[_0xc2aa('0x37')]+=0x1;_0x630957(_0x39f3e8);});}exports[_0xc2aa('0x3a')]=function(_0x27822f,_0xbefcd8){var _0x34e0c0={},_0xf73659={},_0x3d6d28={'count':0x0,'rows':[]};var _0x556b6d=_[_0xc2aa('0x2b')](db['OpenchannelInteraction'][_0xc2aa('0x3b')],function(_0x1c72bd){return{'name':_0x1c72bd[_0xc2aa('0x3c')],'type':_0x1c72bd[_0xc2aa('0x3d')][_0xc2aa('0x3e')]};});_0xf73659[_0xc2aa('0x3f')]=_['map'](_0x556b6d,_0xc2aa('0x28'));_0xf73659['query']=_[_0xc2aa('0x40')](_0x27822f[_0xc2aa('0x41')]);_0xf73659[_0xc2aa('0x42')]=_[_0xc2aa('0x43')](_0xf73659['model'],_0xf73659['query']);_0x34e0c0[_0xc2aa('0x44')]=_[_0xc2aa('0x43')](_0xf73659['model'],qs[_0xc2aa('0x45')](_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x45')]));_0x34e0c0['attributes']=_0x34e0c0[_0xc2aa('0x44')][_0xc2aa('0x46')]?_0x34e0c0[_0xc2aa('0x44')]:_0xf73659[_0xc2aa('0x3f')];if(!_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x47')](_0xc2aa('0x48'))){_0x34e0c0['limit']=qs[_0xc2aa('0x20')](_0x27822f[_0xc2aa('0x41')]['limit']);_0x34e0c0[_0xc2aa('0x1e')]=qs[_0xc2aa('0x1e')](_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x1e')]);}_0x34e0c0[_0xc2aa('0x49')]=qs['sort'](_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x4a')]);_0x34e0c0[_0xc2aa('0x4b')]=qs['filters'](_[_0xc2aa('0x4c')](_0x27822f[_0xc2aa('0x41')],_0xf73659[_0xc2aa('0x42')]),_0x556b6d);var _0x525cfb=[];var _0x22718d=squel[_0xc2aa('0x4d')]()[_0xc2aa('0x4e')]('id')[_0xc2aa('0x4e')](_0xc2aa('0x28'))[_0xc2aa('0x4e')](_0xc2aa('0x4f'))[_0xc2aa('0x50')]('tools_tags');var _0x503e57=squel[_0xc2aa('0x4d')]()[_0xc2aa('0x4e')](_0xc2aa('0x51'))[_0xc2aa('0x4e')](_0xc2aa('0x52'))[_0xc2aa('0x4e')](_0xc2aa('0x53'))[_0xc2aa('0x50')](_0xc2aa('0x54'),'ui')[_0xc2aa('0x55')]('users','u',_0xc2aa('0x56'));var _0xfe8f4b=squel['select']()[_0xc2aa('0x50')](_0xc2aa('0x57'),'i')[_0xc2aa('0x55')]('cm_contacts','c',_0xc2aa('0x58'))['left_join'](_0xc2aa('0x59'),'o',_0xc2aa('0x5a'))['left_join'](_0xc2aa('0x5b'),'a',_0xc2aa('0x5c'))[_0xc2aa('0x55')](_0xc2aa('0x5d'),'me',_0xc2aa('0x5e'))['left_join'](_0xc2aa('0x5f'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xc2aa('0x60'),'t',_0xc2aa('0x61'));var _0x478e5b=squel[_0xc2aa('0x62')]();var _0x55f67b=[];var _0x5c02ed=squel[_0xc2aa('0x62')]();var _0x543fb3;if(_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x63')]){_0x543fb3=as[_0xc2aa('0x64')](_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x63')]);var _0x437572=_0x543fb3[_0xc2aa('0x65')];for(var _0xa60c7c=0x0;_0xa60c7c<_0x543fb3[_0xc2aa('0x66')][_0xc2aa('0x46')];_0xa60c7c++){var _0x31c5fe=_0x543fb3[_0xc2aa('0x66')][_0xa60c7c];var _0x1bdb74='i';var _0xd96a75=_[_0xc2aa('0x67')](_0x556b6d,[_0xc2aa('0x28'),_0x31c5fe['field']]);if(!_0xd96a75){switch(_0x31c5fe['field']){case _0xc2aa('0x68'):if(_0x31c5fe[_0xc2aa('0x69')]==0x1){_0xfe8f4b['having']('`'+_0x31c5fe['field']+_0xc2aa('0x6a'));}else{_0xfe8f4b[_0xc2aa('0x6b')]('`'+_0x31c5fe[_0xc2aa('0x4e')]+_0xc2aa('0x6c'));}break;case _0xc2aa('0x6d'):if(_0x31c5fe[_0xc2aa('0x6e')]==='$substring'){if(_0x31c5fe[_0xc2aa('0x69')][_0xc2aa('0x2e')]('\x20')[_0xc2aa('0x46')]>0x1){_0x478e5b[_0x437572](_0xc2aa('0x6f'),qs[_0xc2aa('0x70')](_0x31c5fe[_0xc2aa('0x69')]),null);}else{var _0x3cc3df='%'+_0x31c5fe[_0xc2aa('0x69')]+'%';_0x478e5b[_0x437572](_0xc2aa('0x71'),_0x3cc3df,_0x3cc3df,_0x3cc3df);}}else{_0xd96a75=_['find'](_0x556b6d,['name',_0xc2aa('0x72')]);_0x31c5fe[_0xc2aa('0x4e')]='ContactId';_0x4391bc=as[_0xc2aa('0x73')](_0x1bdb74,_0xd96a75[_0xc2aa('0x3d')],_0x31c5fe);_0x478e5b[_0x437572](_0x4391bc[_0xc2aa('0x74')],_0x4391bc[_0xc2aa('0x69')][_0xc2aa('0x75')],_0x4391bc[_0xc2aa('0x69')]['end']);}break;case'Tag':var _0x4ffd46=_0x31c5fe[_0xc2aa('0x69')][_0xc2aa('0x2e')](',')[_0xc2aa('0x2b')](function(_0x4efbfa){return Number(_0x4efbfa);});_0x4ffd46[_0xc2aa('0x2f')](function(_0x3c67e5){_0x5c02ed['or'](_0xc2aa('0x76'),'%,'+_0x3c67e5+',%');});_0x55f67b=_[_0xc2aa('0x77')](_0x55f67b,_0x4ffd46);break;case _0xc2aa('0x78'):if(_0x31c5fe[_0xc2aa('0x6e')]===_0xc2aa('0x79')){_0x478e5b[_0x437572]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x31c5fe[_0xc2aa('0x69')]+'%',null);}else{_0xd96a75=_[_0xc2aa('0x67')](_0x556b6d,[_0xc2aa('0x28'),_0xc2aa('0x38')]);_0x31c5fe[_0xc2aa('0x4e')]=_0xc2aa('0x38');_0x4391bc=as[_0xc2aa('0x73')](_0x1bdb74,_0xd96a75[_0xc2aa('0x3d')],_0x31c5fe);_0x478e5b[_0x437572](_0x4391bc[_0xc2aa('0x74')],_0x4391bc[_0xc2aa('0x69')][_0xc2aa('0x75')],_0x4391bc['value'][_0xc2aa('0x1c')]);}break;case _0xc2aa('0x7a'):_0x4391bc=as[_0xc2aa('0x73')]('me',null,_0x31c5fe);_0x478e5b[_0x437572](_0x4391bc['text'],_0x4391bc[_0xc2aa('0x69')]['start'],_0x4391bc[_0xc2aa('0x69')][_0xc2aa('0x1c')]);break;}}else{var _0x4391bc=as['buildExpression'](_0x1bdb74,_0xd96a75[_0xc2aa('0x3d')],_0x31c5fe);_0x478e5b[_0x437572](_0x4391bc[_0xc2aa('0x74')],_0x4391bc['value']['start'],_0x4391bc[_0xc2aa('0x69')]['end']);}}}else{var _0x281ed6=_(_0x27822f[_0xc2aa('0x41')])['keys']()[_0xc2aa('0x2b')](function(_0x1379e5){return _['some'](_0x556b6d,['name',_0x1379e5])?_0x1379e5:undefined;})[_0xc2aa('0x7b')]()[_0xc2aa('0x69')]();if(!_[_0xc2aa('0x7c')](_0x281ed6)){_0x281ed6['forEach'](function(_0x3c6024){if(_0x3c6024===_0xc2aa('0x7d')){_0xfe8f4b[_0xc2aa('0x4b')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xc2aa('0x7e')](_0x27822f[_0xc2aa('0x41')][_0x3c6024]));}else if(_0x3c6024===_0xc2aa('0x7f')){var _0x9e76d=JSON[_0xc2aa('0x80')](_0x27822f[_0xc2aa('0x41')][_0x3c6024])[_0xc2aa('0x81')];var _0x33bbcf=JSON[_0xc2aa('0x80')](_0x27822f[_0xc2aa('0x41')][_0x3c6024])[_0xc2aa('0x82')];_0xfe8f4b[_0xc2aa('0x4b')](_0xc2aa('0x83'),_0x9e76d,_0x33bbcf);}else{if(_0x27822f[_0xc2aa('0x41')][_0x3c6024]===_0xc2aa('0x84')){_0xfe8f4b[_0xc2aa('0x4b')]('i.'+_0x3c6024+_0xc2aa('0x85'));}else{_0xfe8f4b[_0xc2aa('0x4b')]('i.'+_0x3c6024+_0xc2aa('0x86'),_0x27822f[_0xc2aa('0x41')][_0x3c6024]);}}});}if(_0x27822f['query'][_0xc2aa('0x87')]){if(_0x27822f[_0xc2aa('0x41')]['read']==0x1){_0xfe8f4b[_0xc2aa('0x6b')](_0xc2aa('0x88'));}else{_0xfe8f4b['having']('`unreadMessages`\x20>\x200');}}if(_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x89')]){_0x55f67b=_[_0xc2aa('0x8a')](_0x27822f[_0xc2aa('0x41')]['tag'])?_0x27822f['query'][_0xc2aa('0x89')]:new Array(_0x27822f[_0xc2aa('0x41')]['tag']);_0x55f67b[_0xc2aa('0x2f')](function(_0x4bcd6d){_0x5c02ed['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4bcd6d+',%');});}if(_0x27822f[_0xc2aa('0x41')]['filter']){var _0x5e17b8=_0x27822f['query'][_0xc2aa('0x8b')][_0xc2aa('0x8c')]('\x5c','\x5c\x5c')[_0xc2aa('0x8c')](/'/g,'\x27\x27');if(qs[_0xc2aa('0x8d')](_0x5e17b8)){_0x478e5b['or'](_0xc2aa('0x8e'),_0x5e17b8+'%');}else{_0x478e5b['or'](_0xc2aa('0x8f'),qs['getFullTextValue'](_0x5e17b8))['or']('i.from\x20LIKE\x20?',_0x5e17b8+'%')['or'](_0xc2aa('0x90'),_0x5e17b8+'%');}}}_0xfe8f4b[_0xc2aa('0x4b')](_0x478e5b);_0xfe8f4b['group']('i.id');var _0x1e6e1c={'type':db[_0xc2aa('0x91')][_0xc2aa('0x92')][_0xc2aa('0x93')],'raw':!![]};var _0x2d353d=_0xfe8f4b[_0xc2aa('0x94')]();_0x2d353d['field'](_0xc2aa('0x95'));_0x2d353d[_0xc2aa('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x34e0c0['order']){_0x34e0c0[_0xc2aa('0x49')][_0xc2aa('0x2f')](function(_0x215d88){var _0x32e248=_0x215d88[0x0]===_0xc2aa('0x96')?_0x215d88[0x0]:'i.'+_0x215d88[0x0];_0xfe8f4b[_0xc2aa('0x49')](_0x32e248,_0x215d88[0x1]===_0xc2aa('0x97')?![]:!![]);});}if(!_[_0xc2aa('0x7c')](_0x55f67b)){_0xfe8f4b['having'](_0x5c02ed);_0x2d353d['where'](_0xc2aa('0x98'),_0x55f67b);}BPromise[_0xc2aa('0x99')]()[_0xc2aa('0x25')](function(){if(!_0x543fb3){if(_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x7d')])return;_0x2d353d[_0xc2aa('0x4b')](_0xc2aa('0x9a'));_0xfe8f4b[_0xc2aa('0x4b')](_0xc2aa('0x9a'));return;}if(_0x27822f[_0xc2aa('0x9b')][_0xc2aa('0x9c')]!==_0xc2aa('0x9d'))return;return _0x27822f['user'][_0xc2aa('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x39fa5f){if(_[_0xc2aa('0x7c')](_0x39fa5f)){_0x2d353d[_0xc2aa('0x4b')](_0xc2aa('0x9f'));_0xfe8f4b[_0xc2aa('0x4b')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x2d353d['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xc2aa('0x2b')](_0x39fa5f,'id'));_0xfe8f4b[_0xc2aa('0x4b')](_0xc2aa('0xa0'),_[_0xc2aa('0x2b')](_0x39fa5f,'id'));}});})[_0xc2aa('0x25')](function(){if(_0x27822f[_0xc2aa('0x9b')][_0xc2aa('0x9c')]===_0xc2aa('0x9d')&&!_0x543fb3&&!_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x7d')])return[];return db[_0xc2aa('0xa1')][_0xc2aa('0x41')](_0x2d353d[_0xc2aa('0xa2')](),_0x1e6e1c);})['then'](function(_0x197c96){_0x3d6d28[_0xc2aa('0x21')]=_0x197c96[_0xc2aa('0x46')];if(_0x3d6d28[_0xc2aa('0x21')]===0x0)return[];return db[_0xc2aa('0xa1')][_0xc2aa('0x41')](_0x22718d['toString'](),_0x1e6e1c)['then'](function(_0x3d7b10){_0x525cfb=_[_0xc2aa('0xa3')](_0x3d7b10,'id');_0x1e6e1c=_['merge'](_0x1e6e1c,{'model':db[_0xc2aa('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27822f[_0xc2aa('0x41')][_0xc2aa('0x45')]){_0x34e0c0['attributes'][_0xc2aa('0x2f')](function(_0x368095){_0xfe8f4b[_0xc2aa('0x4e')]('i.'+_0x368095);});}else{_0xfe8f4b[_0xc2aa('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc2aa('0x68'));_0xfe8f4b[_0xc2aa('0x4e')](_0xc2aa('0xa5'),_0xc2aa('0xa6'));_0xfe8f4b[_0xc2aa('0x4e')](_0xc2aa('0xa7'),'Account.mandatoryDisposition');_0xfe8f4b['field']('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0xfe8f4b[_0xc2aa('0x4e')](_0xc2aa('0xa8'));_0xfe8f4b['field'](_0xc2aa('0xa9'),'Contact.firstName');_0xfe8f4b[_0xc2aa('0x4e')]('c.lastName',_0xc2aa('0xaa'));_0xfe8f4b[_0xc2aa('0x4e')](_0xc2aa('0xab'),_0xc2aa('0xac'));_0xfe8f4b[_0xc2aa('0x4e')](_0xc2aa('0xad'),_0xc2aa('0xae'));_0xfe8f4b['field']('c.mobile',_0xc2aa('0xaf'));_0xfe8f4b[_0xc2aa('0x4e')](_0xc2aa('0xb0'),'Contact.fax');_0xfe8f4b[_0xc2aa('0x4e')]('o.fullname',_0xc2aa('0xb1'));_0xfe8f4b['field'](_0xc2aa('0xb2'),'Owner.internal');_0xfe8f4b['field'](_0xc2aa('0xb3'),'TagIds');}if(_0x34e0c0['limit'])_0xfe8f4b[_0xc2aa('0x20')](_0x34e0c0[_0xc2aa('0x20')]);if(_0x34e0c0['offset'])_0xfe8f4b[_0xc2aa('0x1e')](_0x34e0c0[_0xc2aa('0x1e')]);return db['sequelize'][_0xc2aa('0x41')](_0xfe8f4b[_0xc2aa('0xa2')](),_0x1e6e1c);})[_0xc2aa('0x25')](function(_0x2127dd){if(_0x2127dd['length']>0x0)_0x503e57[_0xc2aa('0x4b')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xc2aa('0x2b')](_0x2127dd,'id'));return db[_0xc2aa('0xa1')][_0xc2aa('0x41')](_0x503e57['toString'](),_0x1e6e1c)[_0xc2aa('0x25')](function(_0x4b00d2){var _0xb51b3c=_[_0xc2aa('0xb4')](_0x4b00d2,_0xc2aa('0xb5'));var _0x50af8f=[];_0x2127dd['forEach'](function(_0x3b99c4){_0x50af8f[_0xc2aa('0x30')](updateOpenchannelInteraction(_0x3b99c4,_0x525cfb,_0xb51b3c));});return BPromise[_0xc2aa('0xb6')](_0x50af8f);});});})['then'](function(_0x47c2e7){_0x3d6d28[_0xc2aa('0xb7')]=_0x47c2e7;return _0x3d6d28;})[_0xc2aa('0x25')](respondWithFilteredResult(_0xbefcd8,_0x34e0c0))[_0xc2aa('0x32')](handleError(_0xbefcd8,null));};exports[_0xc2aa('0xb8')]=function(_0x36adb9,_0x2d8bb5){var _0x313cd3={};if(_0x36adb9[_0xc2aa('0x41')][_0xc2aa('0x3d')]&&_0x36adb9[_0xc2aa('0x41')][_0xc2aa('0x3d')]===_0xc2aa('0x50')){_0x313cd3[_0xc2aa('0x50')]=_0x36adb9[_0xc2aa('0xb9')]['id'];}else{_0x313cd3['id']=_0x36adb9[_0xc2aa('0xb9')]['id'];}var _0x3bf499={'raw':![],'where':_0x313cd3},_0x35dbc1={};_0x35dbc1['model']=_[_0xc2aa('0x40')](db[_0xc2aa('0xa4')]['rawAttributes']);_0x35dbc1['query']=_[_0xc2aa('0x40')](_0x36adb9[_0xc2aa('0x41')]);_0x35dbc1[_0xc2aa('0x42')]=_[_0xc2aa('0x43')](_0x35dbc1[_0xc2aa('0x3f')],_0x35dbc1[_0xc2aa('0x41')]);_0x3bf499[_0xc2aa('0x44')]=_[_0xc2aa('0x43')](_0x35dbc1[_0xc2aa('0x3f')],qs[_0xc2aa('0x45')](_0x36adb9[_0xc2aa('0x41')][_0xc2aa('0x45')]));_0x3bf499['attributes']=_0x3bf499[_0xc2aa('0x44')]['length']?_0x3bf499[_0xc2aa('0x44')]:_0x35dbc1[_0xc2aa('0x3f')];if(_0x36adb9['query'][_0xc2aa('0xba')]){_0x3bf499[_0xc2aa('0xbb')]=[{'all':!![]}];}_0x3bf499=_[_0xc2aa('0xbc')]({},_0x3bf499,_0x36adb9[_0xc2aa('0xbd')]);return db[_0xc2aa('0xa4')][_0xc2aa('0x67')](_0x3bf499)['then'](handleEntityNotFound(_0x2d8bb5,null))[_0xc2aa('0x25')](respondWithResult(_0x2d8bb5,null))['catch'](handleError(_0x2d8bb5,null));};exports[_0xc2aa('0xbe')]=function(_0x30b893,_0x157ebb){return db[_0xc2aa('0xa4')]['create'](_0x30b893[_0xc2aa('0x7a')],{})['then'](respondWithResult(_0x157ebb,0xc9))[_0xc2aa('0x32')](handleError(_0x157ebb,null));};exports[_0xc2aa('0xbf')]=function(_0x4ce53a,_0x46bf85){if(_0x4ce53a['body']['id']){delete _0x4ce53a[_0xc2aa('0x7a')]['id'];}return db[_0xc2aa('0xa4')][_0xc2aa('0x67')]({'where':{'id':_0x4ce53a[_0xc2aa('0xb9')]['id']}})[_0xc2aa('0x25')](handleEntityNotFound(_0x46bf85,null))[_0xc2aa('0x25')](saveUpdates(_0x4ce53a[_0xc2aa('0x7a')],null))['then'](respondWithResult(_0x46bf85,null))['catch'](handleError(_0x46bf85,null));};exports[_0xc2aa('0x26')]=function(_0x41ddeb,_0x321f08){return db['OpenchannelInteraction'][_0xc2aa('0x67')]({'where':{'id':_0x41ddeb['params']['id']}})[_0xc2aa('0x25')](handleEntityNotFound(_0x321f08,null))[_0xc2aa('0x25')](removeEntity(_0x321f08,null))['catch'](handleError(_0x321f08,null));};exports[_0xc2aa('0xc0')]=function(_0x4eb9b3,_0x13033e){return db[_0xc2aa('0xa4')][_0xc2aa('0xc0')]()[_0xc2aa('0x25')](respondWithResult(_0x13033e,null))['catch'](handleError(_0x13033e,null));};exports[_0xc2aa('0xc1')]=function(_0x1d3958,_0x2183b9,_0x38f0e6){return db[_0xc2aa('0xc2')]['find']({'where':{'id':_0x1d3958['params']['id']}})[_0xc2aa('0x25')](handleEntityNotFound(_0x2183b9,null))[_0xc2aa('0x25')](function(_0xc826d6){if(_0xc826d6){return _0xc826d6[_0xc2aa('0xc1')](_0x1d3958[_0xc2aa('0x7a')]['ids'],_[_0xc2aa('0xc3')](_0x1d3958[_0xc2aa('0x7a')],[_0xc2aa('0xc4'),'id'])||{});}})['then'](respondWithResult(_0x2183b9,null))[_0xc2aa('0x32')](handleError(_0x2183b9,null));};exports[_0xc2aa('0xc5')]=function(_0x1f553b,_0x1afdbd,_0x35dfd0){var _0x46a735={'raw':![],'where':{}};var _0x5aa57f={};var _0x2c92a2={'count':0x0,'rows':[]};return db[_0xc2aa('0xa4')][_0xc2aa('0xc6')]({'where':{'id':_0x1f553b[_0xc2aa('0xb9')]['id']}})[_0xc2aa('0x25')](handleEntityNotFound(_0x1afdbd,null))[_0xc2aa('0x25')](function(_0x282686){if(_0x282686){_0x5aa57f[_0xc2aa('0x3f')]=_[_0xc2aa('0x40')](db['OpenchannelMessage']['rawAttributes']);_0x5aa57f[_0xc2aa('0x41')]=_[_0xc2aa('0x40')](_0x1f553b[_0xc2aa('0x41')]);_0x5aa57f[_0xc2aa('0x42')]=_[_0xc2aa('0x43')](_0x5aa57f[_0xc2aa('0x3f')],_0x5aa57f[_0xc2aa('0x41')]);_0x46a735[_0xc2aa('0x44')]=_[_0xc2aa('0x43')](_0x5aa57f[_0xc2aa('0x3f')],qs['fields'](_0x1f553b[_0xc2aa('0x41')][_0xc2aa('0x45')]));_0x46a735[_0xc2aa('0x44')]=_0x46a735[_0xc2aa('0x44')]['length']?_0x46a735[_0xc2aa('0x44')]:_0x5aa57f[_0xc2aa('0x3f')];if(!_0x1f553b[_0xc2aa('0x41')][_0xc2aa('0x47')](_0xc2aa('0x48'))){_0x46a735['limit']=qs['limit'](_0x1f553b[_0xc2aa('0x41')][_0xc2aa('0x20')]);_0x46a735[_0xc2aa('0x1e')]=qs['offset'](_0x1f553b[_0xc2aa('0x41')]['offset']);}_0x46a735[_0xc2aa('0x49')]=qs[_0xc2aa('0x4a')](_0x1f553b[_0xc2aa('0x41')]['sort']);_0x46a735[_0xc2aa('0x4b')]=qs[_0xc2aa('0x42')](_[_0xc2aa('0x4c')](_0x1f553b['query'],_0x5aa57f[_0xc2aa('0x42')]));_0x46a735[_0xc2aa('0x4b')]['OpenchannelInteractionId']=_0x282686['id'];if(_0x1f553b[_0xc2aa('0x41')][_0xc2aa('0x8b')]){_0x46a735['where']=_['merge'](_0x46a735['where'],{'$or':_[_0xc2aa('0x2b')](_0x46a735[_0xc2aa('0x44')],function(_0x366d30){var _0x25440d={};_0x25440d[_0x366d30]={'$like':'%'+_0x1f553b['query'][_0xc2aa('0x8b')]+'%'};return _0x25440d;})});}if(_0x1f553b[_0xc2aa('0x41')][_0xc2aa('0x81')]){var _0x1828f8=_0x1f553b['query'][_0xc2aa('0x81')][_0xc2aa('0x2e')](',');var _0x3371d8={};_0x3371d8[_0x1828f8[0x0]]={'$gte':moment(_0x1828f8[0x1])[_0xc2aa('0xc7')](_0xc2aa('0xc8'))};_0x46a735['where']=_[_0xc2aa('0xbc')](_0x46a735[_0xc2aa('0x4b')],_0x3371d8);}_0x46a735=_[_0xc2aa('0xbc')]({},_0x46a735,_0x1f553b[_0xc2aa('0xbd')]);return db[_0xc2aa('0xc2')][_0xc2aa('0x21')]({'where':_0x46a735['where']})['then'](function(_0x4be893){_0x2c92a2[_0xc2aa('0x21')]=_0x4be893;if(_0x1f553b[_0xc2aa('0x41')][_0xc2aa('0xba')]){_0x46a735[_0xc2aa('0xbb')]=[{'all':!![]}];}return db[_0xc2aa('0xc2')][_0xc2aa('0xc9')](_0x46a735);})[_0xc2aa('0x25')](function(_0xf03bf0){_0x2c92a2[_0xc2aa('0xb7')]=_0xf03bf0;return _0x2c92a2;});}})[_0xc2aa('0x25')](respondWithFilteredResult(_0x1afdbd,_0x46a735))[_0xc2aa('0x32')](handleError(_0x1afdbd,null));};exports['addTags']=function(_0x4e51fe,_0x35d857,_0x447332){return db[_0xc2aa('0xa4')][_0xc2aa('0x67')]({'where':{'id':_0x4e51fe[_0xc2aa('0xb9')]['id']}})[_0xc2aa('0x25')](handleEntityNotFound(_0x35d857,null))[_0xc2aa('0x25')](function(_0x2d8a12){if(_0x2d8a12){return _0x2d8a12[_0xc2aa('0xca')](_0x4e51fe['body']['ids'],_[_0xc2aa('0xc3')](_0x4e51fe[_0xc2aa('0x7a')],['ids','id'])||{})[_0xc2aa('0xcb')](function(){return db[_0xc2aa('0xcc')][_0xc2aa('0xc9')]({'attributes':['id',_0xc2aa('0x28'),_0xc2aa('0x4f')],'where':{'id':_0x4e51fe[_0xc2aa('0x7a')]['ids']}});})[_0xc2aa('0x25')](function(_0x4b7280){socket[_0xc2aa('0xcd')](_0xc2aa('0xce'),{'id':Number(_0x4e51fe['params']['id']),'tags':_0x4b7280||[]});return{'id':Number(_0x4e51fe[_0xc2aa('0xb9')]['id']),'tags':_0x4b7280||[]};});}})['then'](respondWithResult(_0x35d857,null))[_0xc2aa('0x32')](handleError(_0x35d857,null));};exports[_0xc2aa('0xcf')]=function(_0x360624,_0x511a2a,_0x20c059){return db[_0xc2aa('0xa4')][_0xc2aa('0x67')]({'where':{'id':_0x360624[_0xc2aa('0xb9')]['id']}})[_0xc2aa('0x25')](handleEntityNotFound(_0x511a2a,null))[_0xc2aa('0x25')](function(_0x373295){if(_0x373295){return _0x373295['removeTags'](_0x360624[_0xc2aa('0x41')][_0xc2aa('0xc4')]);}})[_0xc2aa('0x25')](respondWithStatusCode(_0x511a2a,null))[_0xc2aa('0x32')](handleError(_0x511a2a,null));};exports[_0xc2aa('0xd0')]=function(_0x2beea1,_0x4300f4){var _0x48436d=moment()[_0xc2aa('0xd1')]()['toString']();var _0x5d9507=path[_0xc2aa('0xd2')](config[_0xc2aa('0xd3')],_0xc2aa('0xd4'),_0xc2aa('0xd5'),_0xc2aa('0xd6'));var _0x2b8d43=path['join'](config[_0xc2aa('0xd3')],_0xc2aa('0xd4'),'files','attachments');var _0x182fcd=path['join'](_0x5d9507,_0x48436d);var _0x7e9a6f=util[_0xc2aa('0xc7')]('transcript-%d-%s.zip',_0x2beea1[_0xc2aa('0xb9')]['id'],_0x48436d);var _0x1d8318=path[_0xc2aa('0xd2')](_0x5d9507,_0x7e9a6f);var _0x239c76=[];_0x239c76[_0xc2aa('0x30')]({'model':db[_0xc2aa('0x78')],'as':_0xc2aa('0x78'),'attributes':['id','fullname'],'raw':!![]});_0x239c76['push']({'model':db[_0xc2aa('0xd7')],'as':_0xc2aa('0x6d'),'attributes':['id',_0xc2aa('0xd8'),_0xc2aa('0xd9')],'raw':!![]});if(_0x2beea1[_0xc2aa('0x41')]['attachments']){_0x239c76[_0xc2aa('0x30')]({'model':db[_0xc2aa('0xda')],'as':'Attachment','raw':!![]});}var _0x1c7dfe=[{'model':db[_0xc2aa('0xc2')],'as':_0xc2aa('0xdb'),'attributes':['id','body',_0xc2aa('0x7f'),_0xc2aa('0xdc'),_0xc2aa('0xdd'),_0xc2aa('0x87')],'include':_0x239c76}];_0x1c7dfe[_0xc2aa('0x30')]({'model':db[_0xc2aa('0xde')],'as':_0xc2aa('0xdf'),'attributes':['id','name']});_0x1c7dfe[_0xc2aa('0x30')]({'model':db['User'],'as':_0xc2aa('0xe0'),'attributes':['id',_0xc2aa('0x2c')]});return db[_0xc2aa('0xa4')][_0xc2aa('0x67')]({'where':{'id':_0x2beea1[_0xc2aa('0xb9')]['id']},'include':_0x1c7dfe})['then'](handleEntityNotFound(_0x4300f4,null))['then'](function(_0x1080dd){if(_0x1080dd){var _0x5c886e=_0x1080dd['get']({'plain':!![]});fs[_0xc2aa('0xe1')](_0x182fcd);var _0x4acd7f={'channel':_0xc2aa('0xe2'),'account':_0x5c886e['Account'][_0xc2aa('0x28')],'agent':_0x5c886e[_0xc2aa('0xe0')]?_0x5c886e[_0xc2aa('0xe0')][_0xc2aa('0x2c')]:_0xc2aa('0xe3'),'createdAt':moment(_0x5c886e[_0xc2aa('0x7f')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x5c886e[_0xc2aa('0x39')]?moment(_0x5c886e[_0xc2aa('0xe4')])['format'](_0xc2aa('0xc8'))[_0xc2aa('0xa2')]():'','disposition':_0x5c886e[_0xc2aa('0xe5')],'visibility':_0x5c886e[_0xc2aa('0xe6')]?_0xc2aa('0xe7'):_0xc2aa('0xe8'),'messages':_(_0x5c886e[_0xc2aa('0xdb')])[_0xc2aa('0x8b')]({'secret':![]})[_0xc2aa('0x2b')](function(_0x25e762){if(_0x25e762['Attachment']){var _0x198914=path[_0xc2aa('0xd2')](_0x2b8d43,_0x25e762[_0xc2aa('0xda')]['basename']);if(fs['existsSync'](_0x198914)){fs['createReadStream'](_0x198914)[_0xc2aa('0xe9')](fs[_0xc2aa('0xea')](path[_0xc2aa('0xd2')](_0x182fcd,_0x25e762[_0xc2aa('0xda')][_0xc2aa('0xeb')])));}}return{'date':moment(_0x25e762[_0xc2aa('0x7f')])[_0xc2aa('0xc7')](_0xc2aa('0xc8'))[_0xc2aa('0xa2')](),'sender':_0x25e762[_0xc2aa('0xdc')]===_0xc2aa('0xec')?_0x25e762[_0xc2aa('0x78')]?_0x25e762['User'][_0xc2aa('0x2c')]:'System':_0x25e762[_0xc2aa('0x6d')][_0xc2aa('0xd8')]+(_0x25e762[_0xc2aa('0x6d')]['lastName']?'\x20'+_0x25e762[_0xc2aa('0x6d')][_0xc2aa('0xd9')]:''),'body':_0x25e762[_0xc2aa('0xda')]?_0x25e762[_0xc2aa('0xda')][_0xc2aa('0xeb')]:_0x25e762['body'],'direction':_0x25e762[_0xc2aa('0xdc')]===_0xc2aa('0xec')?'A':'C','secret':_0x25e762[_0xc2aa('0xdd')],'read':_0x25e762[_0xc2aa('0x87')],'attachment':_0x25e762[_0xc2aa('0xda')]};})['value']()};return ejs['renderFile'](path[_0xc2aa('0xd2')](config[_0xc2aa('0xd3')],'server','views',_0xc2aa('0xed')),{'interaction':_0x4acd7f})[_0xc2aa('0x25')](function(_0x1a6797){var _0x3b5988=path[_0xc2aa('0xd2')](_0x182fcd,'transcript-'+_0x5c886e['id']+'-'+_0x48436d+_0xc2aa('0xee'));var _0x44fcd4={'path':_0x3b5988,'channel':_0xc2aa('0xe2'),'interactionId':_0x5c886e['id']};return pdf[_0xc2aa('0xef')](_0x1a6797,_0x44fcd4);})['then'](function(){return new BPromise(function(_0x219894,_0x1acb4b){zipdir(_0x182fcd,{'saveTo':_0x1d8318},function(_0x1b3dd9,_0x41ba82){if(_0x1b3dd9)return _0x1acb4b(_0x1b3dd9);return _0x219894(_0x41ba82);});})['then'](function(){return new BPromise(function(_0x1f0ea5,_0x33866f){rimraf(_0x182fcd,function(_0x53455c){if(_0x53455c)_0x33866f(_0x53455c);return _0x1f0ea5();});});})[_0xc2aa('0x25')](function(){return _0x4300f4[_0xc2aa('0xd0')](_0x1d8318,_0x7e9a6f,function(_0x3a166e){if(_0x3a166e){console[_0xc2aa('0xf0')](_0xc2aa('0xf1'),_0x3a166e);}else{fs['unlinkSync'](_0x1d8318);}});});});}else{return _0x4300f4['sendStatus'](0xc8);}})[_0xc2aa('0x32')](handleError(_0x4300f4,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 12353f6..446e4e7 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 _0xbf07=['events','OpenchannelInteraction','../../mysqldb','setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbf07,0x17a));var _0x7bf0=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xbf07[_0x504df1];return _0x1063b5;};'use strict';var EventEmitter=require(_0x7bf0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x7bf0('0x1')];var OpenchannelMessage=require(_0x7bf0('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7bf0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7bf0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21f58c){return function(_0x1c7d51,_0x4503e0,_0x563ccc){_0x1c7d51[_0x7bf0('0x5')]({'attributes':['id'],'raw':!![]})[_0x7bf0('0x6')](function(_0x2ba82b){_0x1c7d51[_0x7bf0('0x7')](_0x7bf0('0x8'),_0x2ba82b[_0x7bf0('0x9')](function(_0x1fffbd){return{'id':_0x1fffbd['id']};}));return OpenchannelMessage[_0x7bf0('0xa')]({'where':{'OpenchannelInteractionId':_0x1c7d51['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7bf0('0x6')](function(_0x59cdc1){_0x1c7d51[_0x7bf0('0x7')](_0x7bf0('0xb'),_0x59cdc1[_0x7bf0('0xc')]);OpenchannelInteractionEvents[_0x7bf0('0xd')](_0x21f58c+':'+_0x1c7d51['id'],_0x1c7d51);OpenchannelInteractionEvents[_0x7bf0('0xd')](_0x21f58c,_0x1c7d51);_0x563ccc(null);})[_0x7bf0('0xe')](_0x563ccc(null));};}for(var e in events){if(events[_0x7bf0('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7bf0('0x10')](e,emitEvent(event));}}module[_0x7bf0('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6e6a=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','remove','getUsers','then','setDataValue','Users','map'];(function(_0x25cf91,_0x58ff29){var _0x57b6ac=function(_0x5aa7c3){while(--_0x5aa7c3){_0x25cf91['push'](_0x25cf91['shift']());}};_0x57b6ac(++_0x58ff29);}(_0x6e6a,0x7e));var _0xa6e6=function(_0x4aea04,_0x164e5e){_0x4aea04=_0x4aea04-0x0;var _0x549b9b=_0x6e6a[_0x4aea04];return _0x549b9b;};'use strict';var EventEmitter=require(_0xa6e6('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xa6e6('0x1')];var OpenchannelMessage=require(_0xa6e6('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa6e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa6e6('0x4')};function emitEvent(_0x5e4996){return function(_0x1667b5,_0x3e2c6a,_0x14c5f7){_0x1667b5[_0xa6e6('0x5')]({'attributes':['id'],'raw':!![]})[_0xa6e6('0x6')](function(_0x3924fa){_0x1667b5[_0xa6e6('0x7')](_0xa6e6('0x8'),_0x3924fa[_0xa6e6('0x9')](function(_0x116e8a){return{'id':_0x116e8a['id']};}));return OpenchannelMessage[_0xa6e6('0xa')]({'where':{'OpenchannelInteractionId':_0x1667b5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa6e6('0x6')](function(_0x3789b7){_0x1667b5[_0xa6e6('0x7')](_0xa6e6('0xb'),_0x3789b7[_0xa6e6('0xc')]);OpenchannelInteractionEvents['emit'](_0x5e4996+':'+_0x1667b5['id'],_0x1667b5);OpenchannelInteractionEvents[_0xa6e6('0xd')](_0x5e4996,_0x1667b5);_0x14c5f7(null);})[_0xa6e6('0xe')](_0x14c5f7(null));};}for(var e in events){if(events[_0xa6e6('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xa6e6('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index bbd5cc3..29bb5e0 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 _0x7bb9=['OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path','./openchannelInteraction.attributes','exports','define'];(function(_0x3e308a,_0x445fea){var _0x836ce6=function(_0x765f81){while(--_0x765f81){_0x3e308a['push'](_0x3e308a['shift']());}};_0x836ce6(++_0x445fea);}(_0x7bb9,0x158));var _0x97bb=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7bb9[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x97bb('0x0'));var util=require('util');var logger=require(_0x97bb('0x1'))(_0x97bb('0x2'));var moment=require('moment');var BPromise=require(_0x97bb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97bb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x97bb('0x5'));module[_0x97bb('0x6')]=function(_0xee1968,_0x4b71f4){return _0xee1968[_0x97bb('0x7')](_0x97bb('0x8'),attributes,{'tableName':_0x97bb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x97bb('0xa'),'collate':_0x97bb('0xb'),'hooks':{'beforeUpdate':function(_0x1ba081,_0x417e5e,_0x3285ff){if(_0x1ba081[_0x97bb('0xc')](_0x97bb('0xd'))){_0x1ba081['closedAt']=moment()[_0x97bb('0xe')](_0x97bb('0xf'));}_0x3285ff(null,_0x1ba081);}}});}; \ No newline at end of file +var _0x1c2a=['api','moment','bluebird','path','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x443e79,_0x351b9f){var _0x9fe83c=function(_0x68e500){while(--_0x68e500){_0x443e79['push'](_0x443e79['shift']());}};_0x9fe83c(++_0x351b9f);}(_0x1c2a,0xc3));var _0xa1c2=function(_0x2de549,_0x2d890d){_0x2de549=_0x2de549-0x0;var _0x397132=_0x1c2a[_0x2de549];return _0x397132;};'use strict';var _=require(_0xa1c2('0x0'));var util=require(_0xa1c2('0x1'));var logger=require(_0xa1c2('0x2'))(_0xa1c2('0x3'));var moment=require(_0xa1c2('0x4'));var BPromise=require(_0xa1c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1c2('0x6'));var rimraf=require('rimraf');var config=require(_0xa1c2('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xa1c2('0x8')]=function(_0x70fa40,_0x1d61b7){return _0x70fa40[_0xa1c2('0x9')](_0xa1c2('0xa'),attributes,{'tableName':_0xa1c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1c2('0xc'),'collate':_0xa1c2('0xd'),'hooks':{'beforeUpdate':function(_0x1cac64,_0x1539c1,_0x575346){if(_0x1cac64['changed'](_0xa1c2('0xe'))){_0x1cac64[_0xa1c2('0xf')]=moment()[_0xa1c2('0x10')](_0xa1c2('0x11'));}_0x575346(null,_0x1cac64);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6112140..ac3c9a5 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 _0xf944=['body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','find','then','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update'];(function(_0x1e1232,_0x575d4b){var _0x10d42d=function(_0x5a6c00){while(--_0x5a6c00){_0x1e1232['push'](_0x1e1232['shift']());}};_0x10d42d(++_0x575d4b);}(_0xf944,0xb5));var _0x4f94=function(_0x4ba2e1,_0x36efae){_0x4ba2e1=_0x4ba2e1-0x0;var _0x28ae3f=_0xf944[_0x4ba2e1];return _0x28ae3f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f94('0x0'));var BPromise=require(_0x4f94('0x1'));var rs=require(_0x4f94('0x2'));var fs=require('fs');var Redis=require(_0x4f94('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f94('0x4'));var logger=require(_0x4f94('0x5'))(_0x4f94('0x6'));var config=require(_0x4f94('0x7'));var jayson=require(_0x4f94('0x8'));var client=jayson[_0x4f94('0x9')][_0x4f94('0xa')]({'port':0x232a});config[_0x4f94('0xb')]=_['defaults'](config[_0x4f94('0xb')],{'host':_0x4f94('0xc'),'port':0x18eb});var socket=require(_0x4f94('0xd'))(new Redis(config['redis']));require(_0x4f94('0xe'))[_0x4f94('0xf')](socket);function respondWithRpcPromise(_0x3a7bf7,_0x5c5005,_0x27b3d5){return new BPromise(function(_0x26a798,_0x59ea17){return client['request'](_0x3a7bf7,_0x27b3d5)['then'](function(_0x23e951){logger[_0x4f94('0x10')](_0x4f94('0x11'),_0x5c5005,_0x4f94('0x12'));logger[_0x4f94('0x13')](_0x4f94('0x14'),_0x5c5005,'request\x20sent',JSON[_0x4f94('0x15')](_0x23e951));if(_0x23e951[_0x4f94('0x16')]){if(_0x23e951[_0x4f94('0x16')]['code']===0x1f4){logger[_0x4f94('0x16')](_0x4f94('0x11'),_0x5c5005,_0x23e951[_0x4f94('0x16')][_0x4f94('0x17')]);return _0x59ea17(_0x23e951[_0x4f94('0x16')][_0x4f94('0x17')]);}logger[_0x4f94('0x16')](_0x4f94('0x11'),_0x5c5005,_0x23e951[_0x4f94('0x16')]['message']);return _0x26a798(_0x23e951['error'][_0x4f94('0x17')]);}else{logger[_0x4f94('0x10')](_0x4f94('0x11'),_0x5c5005,_0x4f94('0x12'));_0x26a798(_0x23e951[_0x4f94('0x18')][_0x4f94('0x17')]);}})[_0x4f94('0x19')](function(_0x58e552){logger[_0x4f94('0x16')](_0x4f94('0x11'),_0x5c5005,_0x58e552);_0x59ea17(_0x58e552);});});}exports[_0x4f94('0x1a')]=function(_0x3ad7dc){var _0x26a46d=this;return new Promise(function(_0x470121,_0x716135){return db[_0x4f94('0x1b')][_0x4f94('0x1c')](_0x3ad7dc[_0x4f94('0x1d')],{'raw':_0x3ad7dc['options']?_0x3ad7dc[_0x4f94('0x1e')][_0x4f94('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad7dc[_0x4f94('0x1e')]?_0x3ad7dc['options'][_0x4f94('0x20')]||null:null,'attributes':_0x3ad7dc[_0x4f94('0x1e')]?_0x3ad7dc[_0x4f94('0x1e')][_0x4f94('0x21')]||null:null,'limit':_0x3ad7dc[_0x4f94('0x1e')]?_0x3ad7dc[_0x4f94('0x1e')]['limit']||null:null})['then'](function(_0x52a8a4){logger['info'](_0x4f94('0x1a'),_0x3ad7dc);logger['debug']('UpdateOpenchannelInteraction',_0x3ad7dc,JSON[_0x4f94('0x15')](_0x52a8a4));_0x470121(_0x52a8a4);})['catch'](function(_0x2dd9a8){logger[_0x4f94('0x16')](_0x4f94('0x1a'),_0x2dd9a8[_0x4f94('0x17')],_0x3ad7dc);_0x716135(_0x26a46d['error'](0x1f4,_0x2dd9a8[_0x4f94('0x17')]));});});};exports[_0x4f94('0x22')]=function(_0x356db6){return new Promise(function(_0x1a3f41,_0x2f23e4){return db[_0x4f94('0x1b')][_0x4f94('0x23')]({'where':_0x356db6['options']?_0x356db6[_0x4f94('0x1e')][_0x4f94('0x20')]||null:null})[_0x4f94('0x24')](function(_0xc5678e){if(_0xc5678e){return _0xc5678e[_0x4f94('0x25')](_0x356db6[_0x4f94('0x1d')][_0x4f94('0x26')],_[_0x4f94('0x27')](_0x356db6['body'],['ids','id'])||{});}})[_0x4f94('0x28')](function(_0x326567){logger['info']('AddTags',_0x356db6);logger[_0x4f94('0x13')](_0x4f94('0x29'),_0x356db6,JSON[_0x4f94('0x15')](_0x326567));_0x1a3f41(_0x326567);})[_0x4f94('0x19')](function(_0x5bac6c){logger[_0x4f94('0x16')](_0x4f94('0x29'),_0x5bac6c[_0x4f94('0x17')],_0x356db6);_0x2f23e4(_this[_0x4f94('0x16')](0x1f4,_0x5bac6c[_0x4f94('0x17')]));});});}; \ No newline at end of file +var _0x235f=['then','AddTagsToOpenchannelInteraction','addTags','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where'];(function(_0x4b52f0,_0x17a116){var _0x488a90=function(_0x1f55fa){while(--_0x1f55fa){_0x4b52f0['push'](_0x4b52f0['shift']());}};_0x488a90(++_0x17a116);}(_0x235f,0xdd));var _0xf235=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x235f[_0x52085a];return _0x5afc1a;};'use strict';var _=require(_0xf235('0x0'));var util=require(_0xf235('0x1'));var moment=require(_0xf235('0x2'));var BPromise=require(_0xf235('0x3'));var rs=require(_0xf235('0x4'));var fs=require('fs');var Redis=require(_0xf235('0x5'));var db=require(_0xf235('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf235('0x7'))(_0xf235('0x8'));var config=require(_0xf235('0x9'));var jayson=require(_0xf235('0xa'));var client=jayson[_0xf235('0xb')]['http']({'port':0x232a});config[_0xf235('0xc')]=_['defaults'](config[_0xf235('0xc')],{'host':_0xf235('0xd'),'port':0x18eb});var socket=require(_0xf235('0xe'))(new Redis(config[_0xf235('0xc')]));require(_0xf235('0xf'))['register'](socket);function respondWithRpcPromise(_0x2bc476,_0xb90144,_0x4a5c47){return new BPromise(function(_0x4dd293,_0x5b5372){return client['request'](_0x2bc476,_0x4a5c47)['then'](function(_0x43cc4d){logger[_0xf235('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0xb90144,'request\x20sent');logger[_0xf235('0x11')](_0xf235('0x12'),_0xb90144,'request\x20sent',JSON['stringify'](_0x43cc4d));if(_0x43cc4d['error']){if(_0x43cc4d[_0xf235('0x13')]['code']===0x1f4){logger['error'](_0xf235('0x14'),_0xb90144,_0x43cc4d['error']['message']);return _0x5b5372(_0x43cc4d[_0xf235('0x13')]['message']);}logger[_0xf235('0x13')](_0xf235('0x14'),_0xb90144,_0x43cc4d[_0xf235('0x13')][_0xf235('0x15')]);return _0x4dd293(_0x43cc4d['error'][_0xf235('0x15')]);}else{logger[_0xf235('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0xb90144,'request\x20sent');_0x4dd293(_0x43cc4d[_0xf235('0x16')][_0xf235('0x15')]);}})[_0xf235('0x17')](function(_0x2580cb){logger[_0xf235('0x13')](_0xf235('0x14'),_0xb90144,_0x2580cb);_0x5b5372(_0x2580cb);});});}exports[_0xf235('0x18')]=function(_0x2dff49){var _0x46de00=this;return new Promise(function(_0x536f4c,_0x5be422){return db[_0xf235('0x19')][_0xf235('0x1a')](_0x2dff49[_0xf235('0x1b')],{'raw':_0x2dff49[_0xf235('0x1c')]?_0x2dff49[_0xf235('0x1c')][_0xf235('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dff49['options']?_0x2dff49[_0xf235('0x1c')][_0xf235('0x1e')]||null:null,'attributes':_0x2dff49[_0xf235('0x1c')]?_0x2dff49[_0xf235('0x1c')]['attributes']||null:null,'limit':_0x2dff49[_0xf235('0x1c')]?_0x2dff49[_0xf235('0x1c')]['limit']||null:null})[_0xf235('0x1f')](function(_0x231ec8){logger['info'](_0xf235('0x18'),_0x2dff49);logger['debug'](_0xf235('0x18'),_0x2dff49,JSON['stringify'](_0x231ec8));_0x536f4c(_0x231ec8);})[_0xf235('0x17')](function(_0x1e7ac5){logger[_0xf235('0x13')](_0xf235('0x18'),_0x1e7ac5[_0xf235('0x15')],_0x2dff49);_0x5be422(_0x46de00[_0xf235('0x13')](0x1f4,_0x1e7ac5['message']));});});};exports[_0xf235('0x20')]=function(_0x24aa3e){return new Promise(function(_0x21cf5a,_0x5015da){return db['OpenchannelInteraction']['find']({'where':_0x24aa3e[_0xf235('0x1c')]?_0x24aa3e['options'][_0xf235('0x1e')]||null:null})['then'](function(_0x4d66ad){if(_0x4d66ad){return _0x4d66ad[_0xf235('0x21')](_0x24aa3e[_0xf235('0x1b')]['ids'],_['omit'](_0x24aa3e['body'],['ids','id'])||{});}})['spread'](function(_0x2a9160){logger[_0xf235('0x10')](_0xf235('0x22'),_0x24aa3e);logger[_0xf235('0x11')](_0xf235('0x22'),_0x24aa3e,JSON[_0xf235('0x23')](_0x2a9160));_0x21cf5a(_0x2a9160);})[_0xf235('0x17')](function(_0x1df2ac){logger[_0xf235('0x13')](_0xf235('0x22'),_0x1df2ac['message'],_0x24aa3e);_0x5015da(_this[_0xf235('0x13')](0x1f4,_0x1df2ac[_0xf235('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b2b4711..e8b6cf1 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 _0x95fe=['length','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x95fe,0x182));var _0xe95f=function(_0x3bbe4b,_0x35f067){_0x3bbe4b=_0x3bbe4b-0x0;var _0x402d37=_0x95fe[_0x3bbe4b];return _0x402d37;};'use strict';var OpenchannelInteractionEvents=require(_0xe95f('0x0'));var events=[_0xe95f('0x1'),_0xe95f('0x2'),_0xe95f('0x3')];function createListener(_0x1e3413,_0x15f59a){return function(_0x1ab791){_0x15f59a[_0xe95f('0x4')](_0x1e3413,_0x1ab791);};}function removeListener(_0x5ecbd6,_0x13d267){return function(){OpenchannelInteractionEvents[_0xe95f('0x5')](_0x5ecbd6,_0x13d267);};}exports['register']=function(_0x308687){for(var _0x266c28=0x0,_0x45c993=events[_0xe95f('0x6')];_0x266c28<_0x45c993;_0x266c28++){var _0x3da690=events[_0x266c28];var _0x34a3ea=createListener('openchannelInteraction:'+_0x3da690,_0x308687);OpenchannelInteractionEvents['on'](_0x3da690,_0x34a3ea);}}; \ No newline at end of file +var _0xec05=['removeListener','register','length','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x13be06,_0x41214c){var _0x54d525=function(_0x3cad66){while(--_0x3cad66){_0x13be06['push'](_0x13be06['shift']());}};_0x54d525(++_0x41214c);}(_0xec05,0xbb));var _0x5ec0=function(_0x5ac942,_0x4c3dd0){_0x5ac942=_0x5ac942-0x0;var _0x4164ea=_0xec05[_0x5ac942];return _0x4164ea;};'use strict';var OpenchannelInteractionEvents=require(_0x5ec0('0x0'));var events=[_0x5ec0('0x1'),_0x5ec0('0x2'),_0x5ec0('0x3')];function createListener(_0x11860c,_0x4da6f9){return function(_0x1e5fff){_0x4da6f9[_0x5ec0('0x4')](_0x11860c,_0x1e5fff);};}function removeListener(_0x3b015a,_0x2842b0){return function(){OpenchannelInteractionEvents[_0x5ec0('0x5')](_0x3b015a,_0x2842b0);};}exports[_0x5ec0('0x6')]=function(_0x154711){for(var _0x150d61=0x0,_0x37b519=events[_0x5ec0('0x7')];_0x150d61<_0x37b519;_0x150d61++){var _0xc1a808=events[_0x150d61];var _0x32a64e=createListener('openchannelInteraction:'+_0xc1a808,_0x154711);OpenchannelInteractionEvents['on'](_0xc1a808,_0x32a64e);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 07bcbc8..4b856d9 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 _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(_0x2c6c95,_0x3e88d6){var _0x109f35=function(_0x1f02e3){while(--_0x1f02e3){_0x2c6c95['push'](_0x2c6c95['shift']());}};_0x109f35(++_0x3e88d6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x45a717,_0x47377c){var _0xfb95b6=function(_0x15bb26){while(--_0x15bb26){_0x45a717['push'](_0x45a717['shift']());}};_0xfb95b6(++_0x47377c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 9958bf8..9b14b91 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 _0xb03e=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3cd0dc,_0x5c0e3a){var _0x5dce1a=function(_0x2471d0){while(--_0x2471d0){_0x3cd0dc['push'](_0x3cd0dc['shift']());}};_0x5dce1a(++_0x5c0e3a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x4a2499,_0x2917ed){_0x4a2499=_0x4a2499-0x0;var _0x439cd4=_0xb03e[_0x4a2499];return _0x439cd4;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'body':{'type':Sequelize[_0xeb03('0x1')](_0xeb03('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xeb03('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeb03('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeb03('0x4')]('in',_0xeb03('0x5')),'defaultValue':_0xeb03('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeb03('0x6')]},'providerName':{'type':Sequelize[_0xeb03('0x7')]},'providerResponse':{'type':Sequelize[_0xeb03('0x1')]}}; \ No newline at end of file +var _0x36ee=['ENUM','out','DATE','STRING','TEXT','BOOLEAN'];(function(_0x5806f7,_0x415618){var _0x2ef419=function(_0x252424){while(--_0x252424){_0x5806f7['push'](_0x5806f7['shift']());}};_0x2ef419(++_0x415618);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xe36e('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe36e('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe36e('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe36e('0x2')]('in',_0xe36e('0x3')),'defaultValue':_0xe36e('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe36e('0x4')]},'providerName':{'type':Sequelize[_0xe36e('0x5')]},'providerResponse':{'type':Sequelize[_0xe36e('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index ee12a52..cd2dc23 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 _0xf1c7=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','create','body','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','rejectmessage','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x912b06,_0x44db09){var _0x1d0f68=function(_0x56b7c3){while(--_0x56b7c3){_0x912b06['push'](_0x912b06['shift']());}};_0x1d0f68(++_0x44db09);}(_0xf1c7,0x193));var _0x7f1c=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0xf1c7[_0x4fdcc0];return _0xc0ce94;};'use strict';var emlformat=require(_0x7f1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f1c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f1c('0x2'));var moment=require(_0x7f1c('0x3'));var BPromise=require(_0x7f1c('0x4'));var Mustache=require(_0x7f1c('0x5'));var util=require(_0x7f1c('0x6'));var path=require(_0x7f1c('0x7'));var sox=require(_0x7f1c('0x8'));var csv=require(_0x7f1c('0x9'));var ejs=require(_0x7f1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7f1c('0xb'));var crypto=require(_0x7f1c('0xc'));var jsforce=require(_0x7f1c('0xd'));var deskjs=require(_0x7f1c('0xe'));var toCsv=require(_0x7f1c('0x9'));var querystring=require(_0x7f1c('0xf'));var Papa=require(_0x7f1c('0x10'));var Redis=require(_0x7f1c('0x11'));var authService=require(_0x7f1c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f1c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f1c('0x14'))(_0x7f1c('0x15'));var utils=require(_0x7f1c('0x16'));var config=require(_0x7f1c('0x17'));var licenseUtil=require(_0x7f1c('0x18'));var db=require(_0x7f1c('0x19'))['db'];config[_0x7f1c('0x1a')]=_[_0x7f1c('0x1b')](config[_0x7f1c('0x1a')],{'host':_0x7f1c('0x1c'),'port':0x18eb});var socket=require(_0x7f1c('0x1d'))(new Redis(config[_0x7f1c('0x1a')]));require(_0x7f1c('0x1e'))[_0x7f1c('0x1f')](socket);var jayson=require(_0x7f1c('0x20'));var client=jayson[_0x7f1c('0x21')][_0x7f1c('0x22')]({'port':0x232c});var client9002=jayson[_0x7f1c('0x21')][_0x7f1c('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x10a02b,_0x4b8aa7,_0x4d439b,_0xa67dbf){return new BPromise(function(_0x6c36f4,_0x1d18c3){var _0x13b849=_0xa67dbf||client;return _0x13b849[_0x7f1c('0x23')](_0x10a02b,_0x4d439b)[_0x7f1c('0x24')](function(_0x455827){logger[_0x7f1c('0x25')](_0x7f1c('0x26'),_0x4b8aa7,_0x7f1c('0x27'));logger[_0x7f1c('0x28')](_0x7f1c('0x29'),_0x4b8aa7,_0x7f1c('0x27'),JSON[_0x7f1c('0x2a')](_0x455827));if(_0x455827[_0x7f1c('0x2b')]){if(_0x455827['error'][_0x7f1c('0x2c')]===0x1f4){logger[_0x7f1c('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x4b8aa7,_0x455827[_0x7f1c('0x2b')][_0x7f1c('0x2d')]);return _0x1d18c3(_0x455827[_0x7f1c('0x2b')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x4b8aa7,_0x455827[_0x7f1c('0x2b')][_0x7f1c('0x2d')]);return _0x6c36f4(_0x455827[_0x7f1c('0x2b')]['message']);}else{logger[_0x7f1c('0x25')](_0x7f1c('0x26'),_0x4b8aa7,'request\x20sent');_0x6c36f4(_0x455827[_0x7f1c('0x2e')][_0x7f1c('0x2d')]);}})[_0x7f1c('0x2f')](function(_0x57506e){logger[_0x7f1c('0x2b')](_0x7f1c('0x26'),_0x4b8aa7,_0x57506e);_0x1d18c3(_0x57506e);});});}function respondWithStatusCode(_0x252692,_0x57b2a8){_0x57b2a8=_0x57b2a8||0xcc;return function(_0x2e4001){if(_0x2e4001){return _0x252692[_0x7f1c('0x30')](_0x57b2a8);}return _0x252692[_0x7f1c('0x31')](_0x57b2a8)[_0x7f1c('0x32')]();};}function respondWithResult(_0x42208a,_0x34f9f9){_0x34f9f9=_0x34f9f9||0xc8;return function(_0x548f65){if(_0x548f65){return _0x42208a[_0x7f1c('0x31')](_0x34f9f9)[_0x7f1c('0x33')](_0x548f65);}};}function respondWithFilteredResult(_0x12ec44,_0x50d3ca){return function(_0x1b24e0){if(_0x1b24e0){var _0xa6316f=typeof _0x50d3ca[_0x7f1c('0x34')]===_0x7f1c('0x35')&&typeof _0x50d3ca['limit']==='undefined';var _0x34af6b=_0x1b24e0[_0x7f1c('0x36')];var _0x24a1a2=_0xa6316f?0x0:_0x50d3ca[_0x7f1c('0x34')];var _0x28729b=_0xa6316f?_0x1b24e0[_0x7f1c('0x36')]:_0x50d3ca[_0x7f1c('0x34')]+_0x50d3ca[_0x7f1c('0x37')];var _0x669d30;if(_0x28729b>=_0x34af6b){_0x28729b=_0x34af6b;_0x669d30=0xc8;}else{_0x669d30=0xce;}_0x12ec44[_0x7f1c('0x31')](_0x669d30);return _0x12ec44[_0x7f1c('0x38')](_0x7f1c('0x39'),_0x24a1a2+'-'+_0x28729b+'/'+_0x34af6b)[_0x7f1c('0x33')](_0x1b24e0);}return null;};}function patchUpdates(_0x4313ba){return function(_0xb14245){try{jsonpatch[_0x7f1c('0x3a')](_0xb14245,_0x4313ba,!![]);}catch(_0xc757f9){return BPromise[_0x7f1c('0x3b')](_0xc757f9);}return _0xb14245[_0x7f1c('0x3c')]();};}function saveUpdates(_0x2452d4,_0x596983){return function(_0x156055){if(_0x156055){return _0x156055[_0x7f1c('0x3d')](_0x2452d4)['then'](function(_0x78f131){return _0x78f131;});}return null;};}function removeEntity(_0x1b65b6,_0x301c23){return function(_0x3a4501){if(_0x3a4501){return _0x3a4501[_0x7f1c('0x3e')]()['then'](function(){_0x1b65b6[_0x7f1c('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ed8e,_0x85abc3){return function(_0x1313e8){if(!_0x1313e8){_0x45ed8e[_0x7f1c('0x30')](0x194);}return _0x1313e8;};}function handleError(_0x48646b,_0x5c2cc1){_0x5c2cc1=_0x5c2cc1||0x1f4;return function(_0x10780e){logger[_0x7f1c('0x2b')](_0x10780e[_0x7f1c('0x3f')]);if(_0x10780e[_0x7f1c('0x40')]){delete _0x10780e[_0x7f1c('0x40')];}_0x48646b[_0x7f1c('0x31')](_0x5c2cc1)['send'](_0x10780e);};}exports['index']=function(_0x40dcfa,_0x55af70){var _0x498f32={},_0xa532ac={},_0x2cc17c={'count':0x0,'rows':[]};var _0x480b1a=_[_0x7f1c('0x41')](db[_0x7f1c('0x42')][_0x7f1c('0x43')],function(_0x2ddc4f){return{'name':_0x2ddc4f[_0x7f1c('0x44')],'type':_0x2ddc4f['type'][_0x7f1c('0x45')]};});_0xa532ac[_0x7f1c('0x46')]=_[_0x7f1c('0x41')](_0x480b1a,_0x7f1c('0x40'));_0xa532ac[_0x7f1c('0x47')]=_[_0x7f1c('0x48')](_0x40dcfa['query']);_0xa532ac[_0x7f1c('0x49')]=_[_0x7f1c('0x4a')](_0xa532ac['model'],_0xa532ac[_0x7f1c('0x47')]);_0x498f32['attributes']=_[_0x7f1c('0x4a')](_0xa532ac[_0x7f1c('0x46')],qs[_0x7f1c('0x4b')](_0x40dcfa[_0x7f1c('0x47')]['fields']));_0x498f32[_0x7f1c('0x4c')]=_0x498f32[_0x7f1c('0x4c')][_0x7f1c('0x4d')]?_0x498f32[_0x7f1c('0x4c')]:_0xa532ac[_0x7f1c('0x46')];if(!_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x4e')]('nolimit')){_0x498f32[_0x7f1c('0x37')]=qs[_0x7f1c('0x37')](_0x40dcfa['query'][_0x7f1c('0x37')]);_0x498f32['offset']=qs[_0x7f1c('0x34')](_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x34')]);}_0x498f32[_0x7f1c('0x4f')]=qs['sort'](_0x40dcfa['query']['sort']);_0x498f32['where']=qs[_0x7f1c('0x49')](_[_0x7f1c('0x50')](_0x40dcfa[_0x7f1c('0x47')],_0xa532ac[_0x7f1c('0x49')]),_0x480b1a);if(_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x51')]){_0x498f32[_0x7f1c('0x52')]=_[_0x7f1c('0x53')](_0x498f32[_0x7f1c('0x52')],{'$or':_[_0x7f1c('0x41')](_0x480b1a,function(_0x5f44b8){if(_0x5f44b8[_0x7f1c('0x54')]!==_0x7f1c('0x55')){var _0x3f549a={};_0x3f549a[_0x5f44b8[_0x7f1c('0x40')]]={'$like':'%'+_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x51')]+'%'};return _0x3f549a;}})});}_0x498f32=_[_0x7f1c('0x53')]({},_0x498f32,_0x40dcfa['options']);var _0x2d8da4={'where':_0x498f32['where']};return db[_0x7f1c('0x42')]['count'](_0x2d8da4)[_0x7f1c('0x24')](function(_0x197435){_0x2cc17c[_0x7f1c('0x36')]=_0x197435;if(_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x56')]){_0x498f32['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7f1c('0x57')](_0x498f32);})['then'](function(_0x430396){_0x2cc17c[_0x7f1c('0x58')]=_0x430396;return _0x2cc17c;})[_0x7f1c('0x24')](respondWithFilteredResult(_0x55af70,_0x498f32))['catch'](handleError(_0x55af70,null));};exports[_0x7f1c('0x59')]=function(_0x430bf6,_0x1ac7dc){var _0x13c2a5={'raw':!![],'where':{'id':_0x430bf6[_0x7f1c('0x5a')]['id']}},_0x40ad34={};_0x40ad34[_0x7f1c('0x46')]=_[_0x7f1c('0x48')](db['OpenchannelMessage'][_0x7f1c('0x43')]);_0x40ad34['query']=_[_0x7f1c('0x48')](_0x430bf6[_0x7f1c('0x47')]);_0x40ad34[_0x7f1c('0x49')]=_['intersection'](_0x40ad34[_0x7f1c('0x46')],_0x40ad34['query']);_0x13c2a5[_0x7f1c('0x4c')]=_[_0x7f1c('0x4a')](_0x40ad34[_0x7f1c('0x46')],qs[_0x7f1c('0x4b')](_0x430bf6[_0x7f1c('0x47')][_0x7f1c('0x4b')]));_0x13c2a5[_0x7f1c('0x4c')]=_0x13c2a5[_0x7f1c('0x4c')]['length']?_0x13c2a5[_0x7f1c('0x4c')]:_0x40ad34[_0x7f1c('0x46')];if(_0x430bf6[_0x7f1c('0x47')][_0x7f1c('0x56')]){_0x13c2a5[_0x7f1c('0x5b')]=[{'all':!![]}];}_0x13c2a5=_['merge']({},_0x13c2a5,_0x430bf6[_0x7f1c('0x5c')]);return db[_0x7f1c('0x42')][_0x7f1c('0x5d')](_0x13c2a5)['then'](handleEntityNotFound(_0x1ac7dc,null))[_0x7f1c('0x24')](respondWithResult(_0x1ac7dc,null))[_0x7f1c('0x2f')](handleError(_0x1ac7dc,null));};exports[_0x7f1c('0x5e')]=function(_0x589e93,_0x3de937){return db['OpenchannelMessage'][_0x7f1c('0x5e')](_0x589e93[_0x7f1c('0x5f')],{})[_0x7f1c('0x24')](respondWithResult(_0x3de937,0xc9))[_0x7f1c('0x2f')](handleError(_0x3de937,null));};exports[_0x7f1c('0x3d')]=function(_0x402315,_0x4a36bc){if(_0x402315[_0x7f1c('0x5f')]['id']){delete _0x402315['body']['id'];}return db['OpenchannelMessage'][_0x7f1c('0x5d')]({'where':{'id':_0x402315['params']['id']}})['then'](handleEntityNotFound(_0x4a36bc,null))[_0x7f1c('0x24')](saveUpdates(_0x402315[_0x7f1c('0x5f')],null))['then'](respondWithResult(_0x4a36bc,null))[_0x7f1c('0x2f')](handleError(_0x4a36bc,null));};exports[_0x7f1c('0x3e')]=function(_0x386ab8,_0x4f8420){return db[_0x7f1c('0x42')][_0x7f1c('0x5d')]({'where':{'id':_0x386ab8[_0x7f1c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4f8420,null))['then'](removeEntity(_0x4f8420,null))['catch'](handleError(_0x4f8420,null));};exports[_0x7f1c('0x60')]=function(_0x196748,_0x4b4cbb){return db[_0x7f1c('0x42')][_0x7f1c('0x60')]()[_0x7f1c('0x24')](respondWithResult(_0x4b4cbb,null))[_0x7f1c('0x2f')](handleError(_0x4b4cbb,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x7f1c('0x61')]=function(_0xfc0f28,_0x21cd7a,_0x425a8c){var _0x3ae378={'agent':{},'channel':'openchannel'};if(_0xfc0f28[_0x7f1c('0x5f')]['id']){delete _0xfc0f28[_0x7f1c('0x5f')]['id'];}_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x62')]=!![];_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x63')]=moment()['format'](_0x7f1c('0x64'));_0xfc0f28['body'][_0x7f1c('0x65')]=_0xfc0f28[_0x7f1c('0x5f')]['UserId']||_0xfc0f28[_0x7f1c('0x66')]['id'];_0x3ae378[_0x7f1c('0x67')]['id']=_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')];return db[_0x7f1c('0x42')]['find']({'where':{'id':_0xfc0f28[_0x7f1c('0x5a')]['id'],'UserId':null}})[_0x7f1c('0x24')](handleEntityNotFound(_0x21cd7a,null))[_0x7f1c('0x24')](saveUpdates(_0xfc0f28['body'],null))[_0x7f1c('0x24')](function(_0xb6bf4a){if(_0xb6bf4a){_0x3ae378[_0x7f1c('0x2d')]=_0xb6bf4a[_0x7f1c('0x68')]({'plain':!![]});return db[_0x7f1c('0x69')][_0x7f1c('0x5d')]({'where':{'id':_0xb6bf4a[_0x7f1c('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x21cd7a,null))['then'](function(_0x2fc3c6){if(_0x2fc3c6){return _0x2fc3c6[_0x7f1c('0x3d')]({'UserId':_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')],'read1stAt':_[_0x7f1c('0x6b')](_0x2fc3c6[_0x7f1c('0x6c')])?moment()[_0x7f1c('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7f1c('0x24')](function(_0x5aba2c){if(_0x5aba2c){_0x3ae378[_0x7f1c('0x6e')]=_0x5aba2c[_0x7f1c('0x68')]({'plain':!![]});interaction_log['info'](_0x7f1c('0x6f'),_0xfc0f28[_0x7f1c('0x66')]['id'],_0xfc0f28[_0x7f1c('0x66')][_0x7f1c('0x40')],_0xfc0f28['user'][_0x7f1c('0x70')],_0x3ae378[_0x7f1c('0x6e')]['id'],_0xfc0f28[_0x7f1c('0x5f')]?JSON[_0x7f1c('0x2a')](_0xfc0f28[_0x7f1c('0x5f')]):_0x7f1c('0x71'));return respondWithRpcPromise('AcceptMessage',_0x7f1c('0x72'),_0x3ae378);}return null;})['then'](function(_0x5b492b){var _0x2b8a57=_0x7f1c('0x73')+_0x5b492b[_0x7f1c('0x2d')][_0x7f1c('0x74')];return db[_0x7f1c('0x75')][_0x7f1c('0x47')](_0x2b8a57,{'type':db['Sequelize'][_0x7f1c('0x76')][_0x7f1c('0x77')],'raw':!![]})[_0x7f1c('0x24')](function(_0x146f92){return _0x146f92;});})[_0x7f1c('0x24')](function(_0x2bab6d){if(_0x2bab6d){_0x3ae378['message'][_0x7f1c('0x78')]=_0x2bab6d[0x0];if(!_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')])return;return db[_0x7f1c('0x79')]['find']({'where':{'id':_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')],'role':_0x7f1c('0x67')},'attributes':['id',_0x7f1c('0x40'),_0x7f1c('0x7a'),_0x7f1c('0x7b'),_0x7f1c('0x7c')],'raw':!![]});}return null;})[_0x7f1c('0x24')](function(_0x4128c7){if(!_0x4128c7)return null;_0x3ae378[_0x7f1c('0x2d')][_0x7f1c('0x67')]=_0x4128c7;return _0x3ae378;})['then'](function(_0x52fa68){if(_0x52fa68){if(_0xfc0f28[_0x7f1c('0x5f')]['manual']){_0x3ae378['message'][_0x7f1c('0x7d')]=util[_0x7f1c('0x6d')](_0x7f1c('0x7e'),_0xfc0f28[_0x7f1c('0x66')][_0x7f1c('0x40')]);_0x3ae378[_0x7f1c('0x2d')][_0x7f1c('0x7f')]=_0x3ae378[_0x7f1c('0x7f')];_0x3ae378['message'][_0x7f1c('0x80')]=_0x3ae378[_0x7f1c('0x7f')];_0x3ae378[_0x7f1c('0x2d')][_0x7f1c('0x81')]=_0x7f1c('0x61');return respondWithRpcPromise(_0x7f1c('0x82'),_0x7f1c('0x82'),{'event':_0x7f1c('0x83'),'message':_0x3ae378['message']},client9002)[_0x7f1c('0x24')](function(){return _0x3ae378;});}return _0x3ae378;}return null;})[_0x7f1c('0x24')](respondWithResult(_0x21cd7a,null))[_0x7f1c('0x2f')](handleError(_0x21cd7a,null));};var interaction_log=require(_0x7f1c('0x14'))(_0x7f1c('0x84'));exports[_0x7f1c('0x3b')]=function(_0x5032e4,_0x3ebdc0,_0x140989){var _0x3003b6={'agent':{},'channel':'openchannel'};if(_0x5032e4['body']['id']){delete _0x5032e4[_0x7f1c('0x5f')]['id'];}_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')]=_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')]||_0x5032e4[_0x7f1c('0x66')]['id'];_0x3003b6[_0x7f1c('0x67')]['id']=_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')];return db['OpenchannelMessage'][_0x7f1c('0x5d')]({'where':{'id':_0x5032e4[_0x7f1c('0x5a')]['id'],'UserId':null}})[_0x7f1c('0x24')](handleEntityNotFound(_0x3ebdc0,null))[_0x7f1c('0x24')](function(_0x1c0ac2){if(_0x1c0ac2){_0x3003b6[_0x7f1c('0x2d')]=_0x1c0ac2[_0x7f1c('0x68')]({'plain':!![]});return db[_0x7f1c('0x69')][_0x7f1c('0x5d')]({'where':{'id':_0x1c0ac2['OpenchannelInteractionId']}});}return null;})[_0x7f1c('0x24')](handleEntityNotFound(_0x3ebdc0,null))[_0x7f1c('0x24')](function(_0x19c43b){if(_0x19c43b){_0x3003b6[_0x7f1c('0x6e')]=_0x19c43b[_0x7f1c('0x68')]({'plain':!![]});interaction_log[_0x7f1c('0x25')](_0x7f1c('0x85'),_0x5032e4[_0x7f1c('0x66')]['id'],_0x5032e4[_0x7f1c('0x66')]['name'],_0x5032e4[_0x7f1c('0x66')][_0x7f1c('0x70')],_0x3003b6[_0x7f1c('0x6e')]['id'],_0x5032e4[_0x7f1c('0x5f')]?JSON[_0x7f1c('0x2a')](_0x5032e4[_0x7f1c('0x5f')]):_0x7f1c('0x71'));return respondWithRpcPromise(_0x7f1c('0x86'),_0x7f1c('0x87'),_0x3003b6);}return null;})[_0x7f1c('0x24')](function(_0x33f1aa){var _0x53fb5f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x33f1aa['message'][_0x7f1c('0x74')];return db[_0x7f1c('0x75')]['query'](_0x53fb5f,{'type':db[_0x7f1c('0x88')][_0x7f1c('0x76')][_0x7f1c('0x77')],'raw':!![]})['then'](function(_0x4a869b){return _0x4a869b;});})[_0x7f1c('0x24')](function(_0x3a609c){if(_0x3a609c){_0x3003b6['message']['contact']=_0x3a609c[0x0];if(!_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')])return;return db[_0x7f1c('0x79')]['find']({'where':{'id':_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')],'role':_0x7f1c('0x67')},'attributes':['id','name','fullname',_0x7f1c('0x7b'),_0x7f1c('0x7c')],'raw':!![]});}return null;})[_0x7f1c('0x24')](function(_0x33374f){if(!_0x33374f)return null;_0x3003b6['message'][_0x7f1c('0x67')]=_0x33374f;return _0x3003b6;})[_0x7f1c('0x24')](function(_0x2b78c8){if(_0x2b78c8){_0x2b78c8[_0x7f1c('0x2d')][_0x7f1c('0x7d')]=util['format'](_0x7f1c('0x7e'),_0x5032e4[_0x7f1c('0x66')][_0x7f1c('0x40')]);_0x2b78c8[_0x7f1c('0x2d')][_0x7f1c('0x7f')]=_0x3003b6[_0x7f1c('0x7f')];_0x2b78c8['message']['motionChannel']=_0x3003b6[_0x7f1c('0x7f')];_0x2b78c8[_0x7f1c('0x2d')][_0x7f1c('0x81')]=_0x7f1c('0x3b');respondWithRpcPromise('EventManager',_0x7f1c('0x82'),{'event':_0x7f1c('0x89'),'message':_0x2b78c8[_0x7f1c('0x2d')]},client9002);return _0x3003b6;}return null;})['then'](respondWithResult(_0x3ebdc0,null))['catch'](handleError(_0x3ebdc0,null));}; \ No newline at end of file +var _0x31ce=['Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','accept','EventManager','acceptmessage','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','jayson/promise','http','client','request','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','stack','name','map','OpenchannelMessage','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','create','body','find','destroy','describe','../../config/logger','openchannel-interactions','openchannel','read','readAt','format','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize'];(function(_0xdb4fa6,_0xfd3f51){var _0x20ef2e=function(_0x7b4bf3){while(--_0x7b4bf3){_0xdb4fa6['push'](_0xdb4fa6['shift']());}};_0x20ef2e(++_0xfd3f51);}(_0x31ce,0x99));var _0xe31c=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0x31ce[_0x16051a];return _0x35d20d;};'use strict';var emlformat=require(_0xe31c('0x0'));var rimraf=require(_0xe31c('0x1'));var zipdir=require(_0xe31c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe31c('0x3'));var moment=require(_0xe31c('0x4'));var BPromise=require(_0xe31c('0x5'));var Mustache=require(_0xe31c('0x6'));var util=require('util');var path=require(_0xe31c('0x7'));var sox=require(_0xe31c('0x8'));var csv=require(_0xe31c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe31c('0xa'));var _=require(_0xe31c('0xb'));var squel=require('squel');var crypto=require(_0xe31c('0xc'));var jsforce=require(_0xe31c('0xd'));var deskjs=require(_0xe31c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe31c('0xf'));var Papa=require(_0xe31c('0x10'));var Redis=require('ioredis');var authService=require(_0xe31c('0x11'));var qs=require(_0xe31c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe31c('0x13'));var logger=require('../../config/logger')(_0xe31c('0x14'));var utils=require(_0xe31c('0x15'));var config=require(_0xe31c('0x16'));var licenseUtil=require(_0xe31c('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe31c('0x18')](config['redis'],{'host':_0xe31c('0x19'),'port':0x18eb});var socket=require(_0xe31c('0x1a'))(new Redis(config[_0xe31c('0x1b')]));require(_0xe31c('0x1c'))[_0xe31c('0x1d')](socket);var jayson=require(_0xe31c('0x1e'));var client=jayson['client'][_0xe31c('0x1f')]({'port':0x232c});var client9002=jayson[_0xe31c('0x20')][_0xe31c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2814e5,_0x4f817f,_0xfc3c46,_0x5d9c7e){return new BPromise(function(_0x2fd5e7,_0xaac899){var _0x1a69c0=_0x5d9c7e||client;return _0x1a69c0[_0xe31c('0x21')](_0x2814e5,_0xfc3c46)['then'](function(_0x55b88e){logger[_0xe31c('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f817f,'request\x20sent');logger[_0xe31c('0x23')](_0xe31c('0x24'),_0x4f817f,'request\x20sent',JSON[_0xe31c('0x25')](_0x55b88e));if(_0x55b88e['error']){if(_0x55b88e[_0xe31c('0x26')]['code']===0x1f4){logger[_0xe31c('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f817f,_0x55b88e[_0xe31c('0x26')][_0xe31c('0x27')]);return _0xaac899(_0x55b88e['error']['message']);}logger[_0xe31c('0x26')](_0xe31c('0x28'),_0x4f817f,_0x55b88e[_0xe31c('0x26')][_0xe31c('0x27')]);return _0x2fd5e7(_0x55b88e[_0xe31c('0x26')]['message']);}else{logger[_0xe31c('0x22')](_0xe31c('0x28'),_0x4f817f,'request\x20sent');_0x2fd5e7(_0x55b88e[_0xe31c('0x29')][_0xe31c('0x27')]);}})[_0xe31c('0x2a')](function(_0x3180ae){logger[_0xe31c('0x26')](_0xe31c('0x28'),_0x4f817f,_0x3180ae);_0xaac899(_0x3180ae);});});}function respondWithStatusCode(_0x26d1b2,_0x1b198b){_0x1b198b=_0x1b198b||0xcc;return function(_0x40923d){if(_0x40923d){return _0x26d1b2[_0xe31c('0x2b')](_0x1b198b);}return _0x26d1b2[_0xe31c('0x2c')](_0x1b198b)[_0xe31c('0x2d')]();};}function respondWithResult(_0x5a5b86,_0x599d56){_0x599d56=_0x599d56||0xc8;return function(_0x56076a){if(_0x56076a){return _0x5a5b86['status'](_0x599d56)[_0xe31c('0x2e')](_0x56076a);}};}function respondWithFilteredResult(_0xe43f93,_0x562387){return function(_0x1f99de){if(_0x1f99de){var _0x28bbfd=typeof _0x562387[_0xe31c('0x2f')]===_0xe31c('0x30')&&typeof _0x562387[_0xe31c('0x31')]===_0xe31c('0x30');var _0x5c56de=_0x1f99de[_0xe31c('0x32')];var _0x32f724=_0x28bbfd?0x0:_0x562387['offset'];var _0x1d08b4=_0x28bbfd?_0x1f99de[_0xe31c('0x32')]:_0x562387['offset']+_0x562387['limit'];var _0x37c889;if(_0x1d08b4>=_0x5c56de){_0x1d08b4=_0x5c56de;_0x37c889=0xc8;}else{_0x37c889=0xce;}_0xe43f93['status'](_0x37c889);return _0xe43f93[_0xe31c('0x33')](_0xe31c('0x34'),_0x32f724+'-'+_0x1d08b4+'/'+_0x5c56de)[_0xe31c('0x2e')](_0x1f99de);}return null;};}function patchUpdates(_0x4e9b43){return function(_0x5efc14){try{jsonpatch[_0xe31c('0x35')](_0x5efc14,_0x4e9b43,!![]);}catch(_0x5bc8d6){return BPromise['reject'](_0x5bc8d6);}return _0x5efc14[_0xe31c('0x36')]();};}function saveUpdates(_0x56b0c0,_0x1da80e){return function(_0x3597f1){if(_0x3597f1){return _0x3597f1['update'](_0x56b0c0)[_0xe31c('0x37')](function(_0x135703){return _0x135703;});}return null;};}function removeEntity(_0x57f7c5,_0xe79295){return function(_0x48a24d){if(_0x48a24d){return _0x48a24d['destroy']()[_0xe31c('0x37')](function(){_0x57f7c5[_0xe31c('0x2c')](0xcc)[_0xe31c('0x2d')]();});}};}function handleEntityNotFound(_0x33ad15,_0xb977c8){return function(_0x4f6dc5){if(!_0x4f6dc5){_0x33ad15[_0xe31c('0x2b')](0x194);}return _0x4f6dc5;};}function handleError(_0x33ba38,_0x60a122){_0x60a122=_0x60a122||0x1f4;return function(_0x3c7f6a){logger[_0xe31c('0x26')](_0x3c7f6a[_0xe31c('0x38')]);if(_0x3c7f6a[_0xe31c('0x39')]){delete _0x3c7f6a['name'];}_0x33ba38[_0xe31c('0x2c')](_0x60a122)['send'](_0x3c7f6a);};}exports['index']=function(_0x35946e,_0x227106){var _0x19deee={},_0x46eb6d={},_0x31a468={'count':0x0,'rows':[]};var _0x1f9e02=_[_0xe31c('0x3a')](db[_0xe31c('0x3b')]['rawAttributes'],function(_0x2d75ad){return{'name':_0x2d75ad[_0xe31c('0x3c')],'type':_0x2d75ad[_0xe31c('0x3d')][_0xe31c('0x3e')]};});_0x46eb6d[_0xe31c('0x3f')]=_[_0xe31c('0x3a')](_0x1f9e02,_0xe31c('0x39'));_0x46eb6d['query']=_[_0xe31c('0x40')](_0x35946e[_0xe31c('0x41')]);_0x46eb6d[_0xe31c('0x42')]=_[_0xe31c('0x43')](_0x46eb6d[_0xe31c('0x3f')],_0x46eb6d[_0xe31c('0x41')]);_0x19deee['attributes']=_[_0xe31c('0x43')](_0x46eb6d[_0xe31c('0x3f')],qs[_0xe31c('0x44')](_0x35946e['query']['fields']));_0x19deee['attributes']=_0x19deee[_0xe31c('0x45')][_0xe31c('0x46')]?_0x19deee[_0xe31c('0x45')]:_0x46eb6d[_0xe31c('0x3f')];if(!_0x35946e[_0xe31c('0x41')]['hasOwnProperty']('nolimit')){_0x19deee[_0xe31c('0x31')]=qs[_0xe31c('0x31')](_0x35946e[_0xe31c('0x41')][_0xe31c('0x31')]);_0x19deee[_0xe31c('0x2f')]=qs[_0xe31c('0x2f')](_0x35946e[_0xe31c('0x41')][_0xe31c('0x2f')]);}_0x19deee['order']=qs[_0xe31c('0x47')](_0x35946e[_0xe31c('0x41')][_0xe31c('0x47')]);_0x19deee[_0xe31c('0x48')]=qs[_0xe31c('0x42')](_[_0xe31c('0x49')](_0x35946e['query'],_0x46eb6d['filters']),_0x1f9e02);if(_0x35946e[_0xe31c('0x41')]['filter']){_0x19deee[_0xe31c('0x48')]=_[_0xe31c('0x4a')](_0x19deee[_0xe31c('0x48')],{'$or':_[_0xe31c('0x3a')](_0x1f9e02,function(_0xf0108b){if(_0xf0108b['type']!==_0xe31c('0x4b')){var _0x487abb={};_0x487abb[_0xf0108b['name']]={'$like':'%'+_0x35946e['query']['filter']+'%'};return _0x487abb;}})});}_0x19deee=_['merge']({},_0x19deee,_0x35946e[_0xe31c('0x4c')]);var _0x4c8dbc={'where':_0x19deee[_0xe31c('0x48')]};return db[_0xe31c('0x3b')][_0xe31c('0x32')](_0x4c8dbc)[_0xe31c('0x37')](function(_0x6ad238){_0x31a468['count']=_0x6ad238;if(_0x35946e[_0xe31c('0x41')][_0xe31c('0x4d')]){_0x19deee[_0xe31c('0x4e')]=[{'all':!![]}];}return db[_0xe31c('0x3b')]['findAll'](_0x19deee);})['then'](function(_0x326728){_0x31a468[_0xe31c('0x4f')]=_0x326728;return _0x31a468;})[_0xe31c('0x37')](respondWithFilteredResult(_0x227106,_0x19deee))[_0xe31c('0x2a')](handleError(_0x227106,null));};exports[_0xe31c('0x50')]=function(_0xe0cc0a,_0x291370){var _0x254a94={'raw':!![],'where':{'id':_0xe0cc0a[_0xe31c('0x51')]['id']}},_0x515a81={};_0x515a81[_0xe31c('0x3f')]=_['keys'](db[_0xe31c('0x3b')][_0xe31c('0x52')]);_0x515a81[_0xe31c('0x41')]=_[_0xe31c('0x40')](_0xe0cc0a['query']);_0x515a81[_0xe31c('0x42')]=_[_0xe31c('0x43')](_0x515a81[_0xe31c('0x3f')],_0x515a81[_0xe31c('0x41')]);_0x254a94[_0xe31c('0x45')]=_[_0xe31c('0x43')](_0x515a81[_0xe31c('0x3f')],qs[_0xe31c('0x44')](_0xe0cc0a[_0xe31c('0x41')][_0xe31c('0x44')]));_0x254a94[_0xe31c('0x45')]=_0x254a94[_0xe31c('0x45')][_0xe31c('0x46')]?_0x254a94[_0xe31c('0x45')]:_0x515a81['model'];if(_0xe0cc0a[_0xe31c('0x41')][_0xe31c('0x4d')]){_0x254a94['include']=[{'all':!![]}];}_0x254a94=_[_0xe31c('0x4a')]({},_0x254a94,_0xe0cc0a[_0xe31c('0x4c')]);return db['OpenchannelMessage']['find'](_0x254a94)[_0xe31c('0x37')](handleEntityNotFound(_0x291370,null))[_0xe31c('0x37')](respondWithResult(_0x291370,null))[_0xe31c('0x2a')](handleError(_0x291370,null));};exports['create']=function(_0x37b3a7,_0x48cba2){return db[_0xe31c('0x3b')][_0xe31c('0x53')](_0x37b3a7[_0xe31c('0x54')],{})[_0xe31c('0x37')](respondWithResult(_0x48cba2,0xc9))['catch'](handleError(_0x48cba2,null));};exports['update']=function(_0x33a6c1,_0x22f07c){if(_0x33a6c1[_0xe31c('0x54')]['id']){delete _0x33a6c1[_0xe31c('0x54')]['id'];}return db['OpenchannelMessage'][_0xe31c('0x55')]({'where':{'id':_0x33a6c1[_0xe31c('0x51')]['id']}})['then'](handleEntityNotFound(_0x22f07c,null))['then'](saveUpdates(_0x33a6c1['body'],null))['then'](respondWithResult(_0x22f07c,null))[_0xe31c('0x2a')](handleError(_0x22f07c,null));};exports[_0xe31c('0x56')]=function(_0x3a9fe2,_0x55861d){return db[_0xe31c('0x3b')][_0xe31c('0x55')]({'where':{'id':_0x3a9fe2[_0xe31c('0x51')]['id']}})[_0xe31c('0x37')](handleEntityNotFound(_0x55861d,null))[_0xe31c('0x37')](removeEntity(_0x55861d,null))['catch'](handleError(_0x55861d,null));};exports[_0xe31c('0x57')]=function(_0x5e3b30,_0x12e007){return db[_0xe31c('0x3b')][_0xe31c('0x57')]()[_0xe31c('0x37')](respondWithResult(_0x12e007,null))[_0xe31c('0x2a')](handleError(_0x12e007,null));};var interaction_log=require(_0xe31c('0x58'))(_0xe31c('0x59'));exports['accept']=function(_0x423d98,_0x277c1a,_0x2eb85d){var _0xe09e65={'agent':{},'channel':_0xe31c('0x5a')};if(_0x423d98[_0xe31c('0x54')]['id']){delete _0x423d98[_0xe31c('0x54')]['id'];}_0x423d98['body'][_0xe31c('0x5b')]=!![];_0x423d98[_0xe31c('0x54')][_0xe31c('0x5c')]=moment()[_0xe31c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x423d98[_0xe31c('0x54')][_0xe31c('0x5e')]=_0x423d98[_0xe31c('0x54')][_0xe31c('0x5e')]||_0x423d98['user']['id'];_0xe09e65[_0xe31c('0x5f')]['id']=_0x423d98['body']['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x423d98[_0xe31c('0x51')]['id'],'UserId':null}})[_0xe31c('0x37')](handleEntityNotFound(_0x277c1a,null))['then'](saveUpdates(_0x423d98['body'],null))[_0xe31c('0x37')](function(_0x2ef4cd){if(_0x2ef4cd){_0xe09e65['message']=_0x2ef4cd[_0xe31c('0x60')]({'plain':!![]});return db[_0xe31c('0x61')]['find']({'where':{'id':_0x2ef4cd[_0xe31c('0x62')]}});}return null;})[_0xe31c('0x37')](handleEntityNotFound(_0x277c1a,null))[_0xe31c('0x37')](function(_0x4eb540){if(_0x4eb540){return _0x4eb540[_0xe31c('0x63')]({'UserId':_0x423d98[_0xe31c('0x54')][_0xe31c('0x5e')],'read1stAt':_[_0xe31c('0x64')](_0x4eb540[_0xe31c('0x65')])?moment()[_0xe31c('0x5d')](_0xe31c('0x66')):undefined});}return null;})[_0xe31c('0x37')](function(_0x2cf016){if(_0x2cf016){_0xe09e65[_0xe31c('0x67')]=_0x2cf016[_0xe31c('0x60')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x423d98[_0xe31c('0x68')]['id'],_0x423d98[_0xe31c('0x68')][_0xe31c('0x39')],_0x423d98[_0xe31c('0x68')][_0xe31c('0x69')],_0xe09e65[_0xe31c('0x67')]['id'],_0x423d98[_0xe31c('0x54')]?JSON[_0xe31c('0x25')](_0x423d98[_0xe31c('0x54')]):_0xe31c('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xe31c('0x6b'),_0xe09e65);}return null;})[_0xe31c('0x37')](function(_0x53b422){var _0x3358f5=_0xe31c('0x6c')+_0x53b422[_0xe31c('0x27')][_0xe31c('0x6d')];return db[_0xe31c('0x6e')][_0xe31c('0x41')](_0x3358f5,{'type':db[_0xe31c('0x6f')][_0xe31c('0x70')][_0xe31c('0x71')],'raw':!![]})[_0xe31c('0x37')](function(_0x36ec43){return _0x36ec43;});})[_0xe31c('0x37')](function(_0x108caf){if(_0x108caf){_0xe09e65[_0xe31c('0x27')][_0xe31c('0x72')]=_0x108caf[0x0];if(!_0x423d98[_0xe31c('0x54')][_0xe31c('0x5e')])return;return db[_0xe31c('0x73')][_0xe31c('0x55')]({'where':{'id':_0x423d98[_0xe31c('0x54')][_0xe31c('0x5e')],'role':'agent'},'attributes':['id',_0xe31c('0x39'),_0xe31c('0x74'),_0xe31c('0x75'),_0xe31c('0x76')],'raw':!![]});}return null;})[_0xe31c('0x37')](function(_0x5b8d3c){if(!_0x5b8d3c)return null;_0xe09e65[_0xe31c('0x27')]['agent']=_0x5b8d3c;return _0xe09e65;})[_0xe31c('0x37')](function(_0x496e4d){if(_0x496e4d){if(_0x423d98[_0xe31c('0x54')][_0xe31c('0x77')]){_0xe09e65[_0xe31c('0x27')][_0xe31c('0x78')]=util[_0xe31c('0x5d')]('SIP/%s',_0x423d98['user'][_0xe31c('0x39')]);_0xe09e65['message'][_0xe31c('0x79')]=_0xe09e65[_0xe31c('0x79')];_0xe09e65[_0xe31c('0x27')][_0xe31c('0x7a')]=_0xe09e65[_0xe31c('0x79')];_0xe09e65[_0xe31c('0x27')]['event']=_0xe31c('0x7b');return respondWithRpcPromise(_0xe31c('0x7c'),'EventManager',{'event':_0xe31c('0x7d'),'message':_0xe09e65['message']},client9002)[_0xe31c('0x37')](function(){return _0xe09e65;});}return _0xe09e65;}return null;})[_0xe31c('0x37')](respondWithResult(_0x277c1a,null))[_0xe31c('0x2a')](handleError(_0x277c1a,null));};var interaction_log=require(_0xe31c('0x58'))(_0xe31c('0x59'));exports[_0xe31c('0x7e')]=function(_0x1389bc,_0x34fc34,_0x20114c){var _0x2359bb={'agent':{},'channel':_0xe31c('0x5a')};if(_0x1389bc['body']['id']){delete _0x1389bc['body']['id'];}_0x1389bc[_0xe31c('0x54')][_0xe31c('0x5e')]=_0x1389bc[_0xe31c('0x54')]['UserId']||_0x1389bc[_0xe31c('0x68')]['id'];_0x2359bb[_0xe31c('0x5f')]['id']=_0x1389bc['body'][_0xe31c('0x5e')];return db[_0xe31c('0x3b')]['find']({'where':{'id':_0x1389bc[_0xe31c('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x34fc34,null))[_0xe31c('0x37')](function(_0x39717f){if(_0x39717f){_0x2359bb[_0xe31c('0x27')]=_0x39717f[_0xe31c('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0xe31c('0x55')]({'where':{'id':_0x39717f[_0xe31c('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x34fc34,null))[_0xe31c('0x37')](function(_0x6a686a){if(_0x6a686a){_0x2359bb[_0xe31c('0x67')]=_0x6a686a['get']({'plain':!![]});interaction_log[_0xe31c('0x22')](_0xe31c('0x7f'),_0x1389bc[_0xe31c('0x68')]['id'],_0x1389bc['user'][_0xe31c('0x39')],_0x1389bc[_0xe31c('0x68')][_0xe31c('0x69')],_0x2359bb[_0xe31c('0x67')]['id'],_0x1389bc[_0xe31c('0x54')]?JSON['stringify'](_0x1389bc[_0xe31c('0x54')]):_0xe31c('0x6a'));return respondWithRpcPromise(_0xe31c('0x80'),_0xe31c('0x81'),_0x2359bb);}return null;})[_0xe31c('0x37')](function(_0xbe8c3e){var _0x42b29a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xbe8c3e[_0xe31c('0x27')]['ContactId'];return db[_0xe31c('0x6e')][_0xe31c('0x41')](_0x42b29a,{'type':db[_0xe31c('0x6f')][_0xe31c('0x70')][_0xe31c('0x71')],'raw':!![]})[_0xe31c('0x37')](function(_0x25ee00){return _0x25ee00;});})['then'](function(_0x223fae){if(_0x223fae){_0x2359bb[_0xe31c('0x27')][_0xe31c('0x72')]=_0x223fae[0x0];if(!_0x1389bc[_0xe31c('0x54')][_0xe31c('0x5e')])return;return db[_0xe31c('0x73')][_0xe31c('0x55')]({'where':{'id':_0x1389bc[_0xe31c('0x54')][_0xe31c('0x5e')],'role':_0xe31c('0x5f')},'attributes':['id',_0xe31c('0x39'),_0xe31c('0x74'),_0xe31c('0x75'),_0xe31c('0x76')],'raw':!![]});}return null;})['then'](function(_0x484d25){if(!_0x484d25)return null;_0x2359bb['message'][_0xe31c('0x5f')]=_0x484d25;return _0x2359bb;})[_0xe31c('0x37')](function(_0x23a93c){if(_0x23a93c){_0x23a93c['message']['interface']=util[_0xe31c('0x5d')](_0xe31c('0x82'),_0x1389bc['user'][_0xe31c('0x39')]);_0x23a93c['message'][_0xe31c('0x79')]=_0x2359bb[_0xe31c('0x79')];_0x23a93c[_0xe31c('0x27')][_0xe31c('0x7a')]=_0x2359bb[_0xe31c('0x79')];_0x23a93c[_0xe31c('0x27')]['event']='reject';respondWithRpcPromise(_0xe31c('0x7c'),'EventManager',{'event':_0xe31c('0x83'),'message':_0x23a93c['message']},client9002);return _0x2359bb;}return null;})['then'](respondWithResult(_0x34fc34,null))[_0xe31c('0x2a')](handleError(_0x34fc34,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 432d21c..92d77d3 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 _0xffc6=['remove','emit','hook','../../mysqldb','setMaxListeners','save','update'];(function(_0x4fc6cc,_0x75064a){var _0xf6a592=function(_0x296507){while(--_0x296507){_0x4fc6cc['push'](_0x4fc6cc['shift']());}};_0xf6a592(++_0x75064a);}(_0xffc6,0x88));var _0x6ffc=function(_0xf858d,_0x5867e5){_0xf858d=_0xf858d-0x0;var _0x473f59=_0xffc6[_0xf858d];return _0x473f59;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x6ffc('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6ffc('0x1')](0x0);var events={'afterCreate':_0x6ffc('0x2'),'afterUpdate':_0x6ffc('0x3'),'afterDestroy':_0x6ffc('0x4')};function emitEvent(_0x2ef012){return function(_0x5d42ab,_0xf50d97,_0x1b1aff){OpenchannelMessageEvents['emit'](_0x2ef012+':'+_0x5d42ab['id'],_0x5d42ab);OpenchannelMessageEvents[_0x6ffc('0x5')](_0x2ef012,_0x5d42ab);_0x1b1aff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x6ffc('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xdfc7=['emit','hasOwnProperty','hook','exports','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x37b05a,_0x591e82){var _0x5a0722=function(_0xfe9eb7){while(--_0xfe9eb7){_0x37b05a['push'](_0x37b05a['shift']());}};_0x5a0722(++_0x591e82);}(_0xdfc7,0xc1));var _0x7dfc=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0xdfc7[_0xe84805];return _0x398efd;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x7dfc('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7dfc('0x1')](0x0);var events={'afterCreate':_0x7dfc('0x2'),'afterUpdate':_0x7dfc('0x3'),'afterDestroy':_0x7dfc('0x4')};function emitEvent(_0x319848){return function(_0xa3ba0c,_0x3b438a,_0x38a2fc){OpenchannelMessageEvents['emit'](_0x319848+':'+_0xa3ba0c['id'],_0xa3ba0c);OpenchannelMessageEvents[_0x7dfc('0x5')](_0x319848,_0xa3ba0c);_0x38a2fc(null);};}for(var e in events){if(events[_0x7dfc('0x6')](e)){var event=events[e];OpenchannelMessage[_0x7dfc('0x7')](e,emitEvent(event));}}module[_0x7dfc('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 2eff737..0cc52e8 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 _0x7916=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','OpenchannelMessage','fti_openchannel_messages','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','describe','then','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','Contact','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','method','GET','POST','body','threadId','error','afterCreate','inspect','finally'];(function(_0x1eee9d,_0x300701){var _0xa9267b=function(_0x57700f){while(--_0x57700f){_0x1eee9d['push'](_0x1eee9d['shift']());}};_0xa9267b(++_0x300701);}(_0x7916,0x128));var _0x6791=function(_0x1f858a,_0xff7047){_0x1f858a=_0x1f858a-0x0;var _0x3e3b18=_0x7916[_0x1f858a];return _0x3e3b18;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x6791('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a9915,_0x198a64,_0x579950){var _0xbc3bc6=_0x3ca328[_0x6791('0xa')];var _0x2aeae9=_0x2a9915['get']({'plain':!![]});if(_0x2aeae9[_0x6791('0xb')][_0x6791('0xc')]()==='in'||_0x2aeae9[_0x6791('0xb')][_0x6791('0xc')]()===_0x6791('0xd')&&!_0x2aeae9[_0x6791('0xe')]&&!_[_0x6791('0xf')](_0x2aeae9[_0x6791('0x10')])){_0xbc3bc6[_0x6791('0x11')][_0x6791('0x12')]({'where':{'id':_0x2aeae9[_0x6791('0x13')]}})['then'](function(_0x4b1719){if(_0x4b1719){_0x4b1719[_0x6791('0x14')]({'lastMsgAt':_0x2aeae9['createdAt'],'lastMsgDirection':_0x2aeae9[_0x6791('0xb')]['toLowerCase']()});}})[_0x6791('0x15')](function(_0x163898){console['error'](_0x163898);});}if(_0x2aeae9[_0x6791('0xb')]==='out'&&!_0x2aeae9[_0x6791('0xe')]){var _0x150d1f;_0xbc3bc6['CmContact'][_0x6791('0x16')]()[_0x6791('0x17')](function(_0x5bec14){return _0xbc3bc6[_0x6791('0x18')]['find']({'where':{'id':_0x2aeae9[_0x6791('0x19')]},'include':[{'model':_0xbc3bc6[_0x6791('0x11')],'as':_0x6791('0x1a'),'where':{'id':_0x2aeae9[_0x6791('0x13')]},'limit':0x1,'include':[{'model':_0xbc3bc6[_0x6791('0x1b')],'as':_0x6791('0x1c'),'attributes':_[_0x6791('0x1d')](_0x5bec14)}]}]});})['then'](function(_0x4a2922){_0x150d1f=_0x4a2922[_0x6791('0x1e')]({'plain':!![]});if(_0x150d1f&&_0x150d1f['replyUri']){logger[_0x6791('0x1f')](_0x6791('0x20'),'afterCreate',util[_0x6791('0x21')](_0x6791('0x22'),_0x2aeae9['id'],_0x150d1f[_0x6791('0x23')]));if(_0x150d1f[_0x6791('0x1a')]&&_0x150d1f['Interactions'][_0x6791('0x24')]){_0x2aeae9[_0x6791('0x25')]=_['omit'](_0x150d1f['Interactions'][0x0],'Contact');_0x2aeae9[_0x6791('0x1c')]=_0x150d1f['Interactions'][0x0][_0x6791('0x1c')];}var _0x198a64={'method':'POST','uri':encodeURI(_0x150d1f['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x198a64[_0x6791('0x26')]){case _0x6791('0x27'):_0x198a64['qs']=_0x2aeae9;break;case _0x6791('0x28'):_0x198a64['body']=_0x2aeae9;break;}return rp(_0x198a64)[_0x6791('0x17')](function(_0x30cc17){logger['info'](_0x6791('0x20'),'afterCreate',util[_0x6791('0x21')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2aeae9['id'],_0x150d1f['replyUri']));if(_0x30cc17[_0x6791('0x29')]['threadId']&&_0x30cc17[_0x6791('0x29')][_0x6791('0x2a')]!=_0x2aeae9['Interaction'][_0x6791('0x2a')]){return _0xbc3bc6[_0x6791('0x11')][_0x6791('0x14')]({'threadId':_0x30cc17[_0x6791('0x29')]['threadId']},{'logging':!![],'where':{'id':_0x2aeae9['Interaction']['id']}});}else{return;}})[_0x6791('0x17')](function(){return _0x2a9915['update']({'read':!![]});})[_0x6791('0x15')](function(_0x338d09){logger[_0x6791('0x2b')](_0x6791('0x20'),_0x6791('0x2c'),util[_0x6791('0x2d')](_0x338d09,{'showHidden':![],'depth':null}));_0x579950();});}else{_0x579950();}})[_0x6791('0x2e')](function(){_0x579950();});}else{_0x579950();}}},'charset':_0x6791('0x2f'),'collate':_0x6791('0x30')});}; \ No newline at end of file +var _0x9348=['catch','error','CmContact','describe','find','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt'];(function(_0x1223fa,_0x28a0b1){var _0x2d7067=function(_0x424468){while(--_0x424468){_0x1223fa['push'](_0x1223fa['shift']());}};_0x2d7067(++_0x28a0b1);}(_0x9348,0x10d));var _0x8934=function(_0x5d57bb,_0x1c16f9){_0x5d57bb=_0x5d57bb-0x0;var _0x5f1d62=_0x9348[_0x5d57bb];return _0x5f1d62;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x8934('0xb'),'paranoid':![],'indexes':[{'name':_0x8934('0xc'),'fields':[_0x8934('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b470d,_0x5ec16d,_0x5336f0){var _0x2c722b=_0x2bce03['models'];var _0xe1adf4=_0x4b470d[_0x8934('0xe')]({'plain':!![]});if(_0xe1adf4[_0x8934('0xf')][_0x8934('0x10')]()==='in'||_0xe1adf4[_0x8934('0xf')][_0x8934('0x10')]()===_0x8934('0x11')&&!_0xe1adf4[_0x8934('0x12')]&&!_['isNil'](_0xe1adf4[_0x8934('0x13')])){_0x2c722b[_0x8934('0x14')][_0x8934('0x15')]({'where':{'id':_0xe1adf4[_0x8934('0x16')]}})[_0x8934('0x17')](function(_0xdf59f4){if(_0xdf59f4){_0xdf59f4['update']({'lastMsgAt':_0xe1adf4[_0x8934('0x18')],'lastMsgDirection':_0xe1adf4[_0x8934('0xf')][_0x8934('0x10')]()});}})[_0x8934('0x19')](function(_0x34d4dc){console[_0x8934('0x1a')](_0x34d4dc);});}if(_0xe1adf4[_0x8934('0xf')]===_0x8934('0x11')&&!_0xe1adf4['secret']){var _0xb86bc9;_0x2c722b[_0x8934('0x1b')][_0x8934('0x1c')]()['then'](function(_0x47f25e){return _0x2c722b['OpenchannelAccount'][_0x8934('0x1d')]({'where':{'id':_0xe1adf4['OpenchannelAccountId']},'include':[{'model':_0x2c722b[_0x8934('0x14')],'as':_0x8934('0x1e'),'where':{'id':_0xe1adf4[_0x8934('0x16')]},'limit':0x1,'include':[{'model':_0x2c722b[_0x8934('0x1b')],'as':_0x8934('0x1f'),'attributes':_['keys'](_0x47f25e)}]}]});})[_0x8934('0x17')](function(_0x5ae49f){_0xb86bc9=_0x5ae49f[_0x8934('0xe')]({'plain':!![]});if(_0xb86bc9&&_0xb86bc9[_0x8934('0x20')]){logger[_0x8934('0x21')](_0x8934('0x22'),_0x8934('0x23'),util[_0x8934('0x24')](_0x8934('0x25'),_0xe1adf4['id'],_0xb86bc9['replyUri']));if(_0xb86bc9[_0x8934('0x1e')]&&_0xb86bc9[_0x8934('0x1e')][_0x8934('0x26')]){_0xe1adf4[_0x8934('0x27')]=_[_0x8934('0x28')](_0xb86bc9['Interactions'][0x0],_0x8934('0x1f'));_0xe1adf4[_0x8934('0x1f')]=_0xb86bc9[_0x8934('0x1e')][0x0]['Contact'];}var _0x5ec16d={'method':'POST','uri':encodeURI(_0xb86bc9[_0x8934('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5ec16d[_0x8934('0x29')]){case _0x8934('0x2a'):_0x5ec16d['qs']=_0xe1adf4;break;case'POST':_0x5ec16d[_0x8934('0xd')]=_0xe1adf4;break;}return rp(_0x5ec16d)[_0x8934('0x17')](function(_0x310454){logger[_0x8934('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x8934('0x23'),util[_0x8934('0x24')](_0x8934('0x2b'),_0xe1adf4['id'],_0xb86bc9[_0x8934('0x20')]));if(_0x310454[_0x8934('0xd')][_0x8934('0x2c')]&&_0x310454[_0x8934('0xd')][_0x8934('0x2c')]!=_0xe1adf4[_0x8934('0x27')][_0x8934('0x2c')]){return _0x2c722b['OpenchannelInteraction'][_0x8934('0x2d')]({'threadId':_0x310454[_0x8934('0xd')]['threadId']},{'logging':!![],'where':{'id':_0xe1adf4[_0x8934('0x27')]['id']}});}else{return;}})[_0x8934('0x17')](function(){return _0x4b470d[_0x8934('0x2d')]({'read':!![]});})[_0x8934('0x19')](function(_0x4b3cb9){logger[_0x8934('0x1a')](_0x8934('0x22'),_0x8934('0x23'),util[_0x8934('0x2e')](_0x4b3cb9,{'showHidden':![],'depth':null}));_0x5336f0();});}else{_0x5336f0();}})[_0x8934('0x2f')](function(){_0x5336f0();});}else{_0x5336f0();}}},'charset':'utf8mb4','collate':_0x8934('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 0c11b01..d66dd1c 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(_0x236d0d,_0x285c99){var _0x443710=function(_0x56134a){while(--_0x56134a){_0x236d0d['push'](_0x236d0d['shift']());}};_0x443710(++_0x285c99);}(_0x1261,0x144));var _0x1126=function(_0x188bfe,_0x2517cc){_0x188bfe=_0x188bfe-0x0;var _0x1a9efa=_0x1261[_0x188bfe];return _0x1a9efa;};'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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x47f40b,_0x330e8b){var _0x366c69=function(_0x1ac92a){while(--_0x1ac92a){_0x47f40b['push'](_0x47f40b['shift']());}};_0x366c69(++_0x330e8b);}(_0xadb5,0xad));var _0x5adb=function(_0x4fb101,_0x4d9f21){_0x4fb101=_0x4fb101-0x0;var _0x8a1fe9=_0xadb5[_0x4fb101];return _0x8a1fe9;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 168304d..106664f 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 _0x4df9=['save','emit','removeListener','register','openchannelMessage:'];(function(_0x4e3f6d,_0x1cfa54){var _0x5e6a4e=function(_0x3f5a55){while(--_0x3f5a55){_0x4e3f6d['push'](_0x4e3f6d['shift']());}};_0x5e6a4e(++_0x1cfa54);}(_0x4df9,0x19a));var _0x94df=function(_0x2b4d29,_0x46315d){_0x2b4d29=_0x2b4d29-0x0;var _0x2df09e=_0x4df9[_0x2b4d29];return _0x2df09e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x94df('0x0'),'remove','update'];function createListener(_0x83b699,_0x5ef440){return function(_0x33e81e){_0x5ef440[_0x94df('0x1')](_0x83b699,_0x33e81e);};}function removeListener(_0x412711,_0x1a7447){return function(){OpenchannelMessageEvents[_0x94df('0x2')](_0x412711,_0x1a7447);};}exports[_0x94df('0x3')]=function(_0x3a7718){for(var _0x5bd414=0x0,_0x47a5e3=events['length'];_0x5bd414<_0x47a5e3;_0x5bd414++){var _0x45a573=events[_0x5bd414];var _0x5e7d79=createListener(_0x94df('0x4')+_0x45a573,_0x3a7718);OpenchannelMessageEvents['on'](_0x45a573,_0x5e7d79);}}; \ No newline at end of file +var _0x958f=['save','remove','update','emit','removeListener','openchannelMessage:'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x958f,0x16e));var _0xf958=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x958f[_0x4565bf];return _0x5610ba;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xf958('0x0'),_0xf958('0x1'),_0xf958('0x2')];function createListener(_0x35758a,_0xbd09d9){return function(_0x4d8410){_0xbd09d9[_0xf958('0x3')](_0x35758a,_0x4d8410);};}function removeListener(_0x38b3f7,_0x5cf322){return function(){OpenchannelMessageEvents[_0xf958('0x4')](_0x38b3f7,_0x5cf322);};}exports['register']=function(_0x204612){for(var _0x1e0718=0x0,_0x7c19f4=events['length'];_0x1e0718<_0x7c19f4;_0x1e0718++){var _0x4f5a7a=events[_0x1e0718];var _0x4769ad=createListener(_0xf958('0x5')+_0x4f5a7a,_0x204612);OpenchannelMessageEvents['on'](_0x4f5a7a,_0x4769ad);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index cb063ee..c48e955 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 _0xf014=['/:id/users','getAgents','post','create','/:id/teams','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','/:id/members','getMembers'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf014,0xd5));var _0x4f01=function(_0x480eff,_0x541555){_0x480eff=_0x480eff-0x0;var _0x5c8aeb=_0xf014[_0x480eff];return _0x5c8aeb;};'use strict';var multer=require('multer');var util=require(_0x4f01('0x0'));var path=require(_0x4f01('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f01('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f01('0x3'));var interaction=require(_0x4f01('0x4'));var config=require(_0x4f01('0x5'));var controller=require(_0x4f01('0x6'));router[_0x4f01('0x7')]('/',auth[_0x4f01('0x8')](),controller['index']);router[_0x4f01('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4f01('0x9')]);router[_0x4f01('0x7')]('/:id',auth[_0x4f01('0x8')](),controller['show']);router[_0x4f01('0x7')](_0x4f01('0xa'),auth[_0x4f01('0x8')](),controller[_0x4f01('0xb')]);router[_0x4f01('0x7')]('/:id/teams',auth[_0x4f01('0x8')](),controller['getTeams']);router[_0x4f01('0x7')](_0x4f01('0xc'),auth['isAuthenticated'](),controller[_0x4f01('0xd')]);router[_0x4f01('0xe')]('/',auth[_0x4f01('0x8')](),controller[_0x4f01('0xf')]);router['post'](_0x4f01('0x10'),auth[_0x4f01('0x8')](),controller['addTeams']);router['post'](_0x4f01('0xc'),auth[_0x4f01('0x8')](),controller[_0x4f01('0x11')]);router[_0x4f01('0x12')](_0x4f01('0x13'),auth[_0x4f01('0x8')](),controller[_0x4f01('0x14')]);router[_0x4f01('0x15')](_0x4f01('0x13'),auth[_0x4f01('0x8')](),controller[_0x4f01('0x16')]);router[_0x4f01('0x15')](_0x4f01('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x4f01('0x15')]('/:id/users',auth[_0x4f01('0x8')](),controller[_0x4f01('0x17')]);module[_0x4f01('0x18')]=router; \ No newline at end of file +var _0x04ec=['../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','show','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2c2f69,_0x3897cd){var _0x14f54c=function(_0x5aaee3){while(--_0x5aaee3){_0x2c2f69['push'](_0x2c2f69['shift']());}};_0x14f54c(++_0x3897cd);}(_0x04ec,0x19c));var _0xc04e=function(_0x48f038,_0x2bde84){_0x48f038=_0x48f038-0x0;var _0x2edc62=_0x04ec[_0x48f038];return _0x2edc62;};'use strict';var multer=require('multer');var util=require(_0xc04e('0x0'));var path=require(_0xc04e('0x1'));var timeout=require(_0xc04e('0x2'));var express=require(_0xc04e('0x3'));var router=express[_0xc04e('0x4')]();var fs_extra=require(_0xc04e('0x5'));var auth=require(_0xc04e('0x6'));var interaction=require(_0xc04e('0x7'));var config=require(_0xc04e('0x8'));var controller=require(_0xc04e('0x9'));router[_0xc04e('0xa')]('/',auth['isAuthenticated'](),controller[_0xc04e('0xb')]);router[_0xc04e('0xa')](_0xc04e('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xc04e('0xd')](),controller[_0xc04e('0xe')]);router['get']('/:id/members',auth[_0xc04e('0xd')](),controller['getMembers']);router['get'](_0xc04e('0xf'),auth[_0xc04e('0xd')](),controller[_0xc04e('0x10')]);router[_0xc04e('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xc04e('0x11')]);router['post']('/',auth[_0xc04e('0xd')](),controller['create']);router[_0xc04e('0x12')](_0xc04e('0xf'),auth[_0xc04e('0xd')](),controller[_0xc04e('0x13')]);router['post'](_0xc04e('0x14'),auth['isAuthenticated'](),controller[_0xc04e('0x15')]);router[_0xc04e('0x16')](_0xc04e('0x17'),auth['isAuthenticated'](),controller[_0xc04e('0x18')]);router[_0xc04e('0x19')](_0xc04e('0x17'),auth[_0xc04e('0xd')](),controller[_0xc04e('0x1a')]);router[_0xc04e('0x19')](_0xc04e('0xf'),auth['isAuthenticated'](),controller[_0xc04e('0x1b')]);router[_0xc04e('0x19')](_0xc04e('0x14'),auth[_0xc04e('0xd')](),controller[_0xc04e('0x1c')]);module[_0xc04e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index c1619b2..db7bd18 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 _0xbdc8=['name','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x16d6a2,_0x266958){var _0x681283=function(_0xb758fd){while(--_0xb758fd){_0x16d6a2['push'](_0x16d6a2['shift']());}};_0x681283(++_0x266958);}(_0xbdc8,0xc1));var _0x8bdc=function(_0x1cbdef,_0x5ac27a){_0x1cbdef=_0x1cbdef-0x0;var _0x3bb22e=_0xbdc8[_0x1cbdef];return _0x3bb22e;};'use strict';var Sequelize=require(_0x8bdc('0x0'));module[_0x8bdc('0x1')]={'name':{'type':Sequelize[_0x8bdc('0x2')],'unique':_0x8bdc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8bdc('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8bdc('0x4')]('rrmemory',_0x8bdc('0x5'),_0x8bdc('0x6'))}}; \ No newline at end of file +var _0x1238=['roundrobin','STRING','name','INTEGER','ENUM','beepall'];(function(_0x5024c7,_0xd560bd){var _0xf2f316=function(_0x4d7748){while(--_0x4d7748){_0x5024c7['push'](_0x5024c7['shift']());}};_0xf2f316(++_0xd560bd);}(_0x1238,0x121));var _0x8123=function(_0x3236be,_0x47eb9b){_0x3236be=_0x3236be-0x0;var _0x40a904=_0x1238[_0x3236be];return _0x40a904;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8123('0x0')],'unique':_0x8123('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8123('0x0')]},'timeout':{'type':Sequelize[_0x8123('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8123('0x3')]('rrmemory',_0x8123('0x4'),_0x8123('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 5a90c0a..a3eee10 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 _0xd62a=['Team','addTeams','ids','Agents','online','interface','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','merge','includeAll','include','rows','show','keys','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','getTeams'];(function(_0x1e432a,_0x57b467){var _0x4f17a0=function(_0x5111e3){while(--_0x5111e3){_0x1e432a['push'](_0x1e432a['shift']());}};_0x4f17a0(++_0x57b467);}(_0xd62a,0xb0));var _0xad62=function(_0x2f81e9,_0x4c2a9f){_0x2f81e9=_0x2f81e9-0x0;var _0x224d61=_0xd62a[_0x2f81e9];return _0x224d61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xad62('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad62('0x1'));var moment=require(_0xad62('0x2'));var BPromise=require(_0xad62('0x3'));var Mustache=require(_0xad62('0x4'));var util=require(_0xad62('0x5'));var path=require(_0xad62('0x6'));var sox=require('sox');var csv=require(_0xad62('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad62('0x8'));var _=require(_0xad62('0x9'));var squel=require('squel');var crypto=require(_0xad62('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xad62('0xb'));var toCsv=require('to-csv');var querystring=require(_0xad62('0xc'));var Papa=require('papaparse');var Redis=require(_0xad62('0xd'));var authService=require(_0xad62('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xad62('0xf'));var hardwareService=require(_0xad62('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xad62('0x11'));var config=require(_0xad62('0x12'));var licenseUtil=require(_0xad62('0x13'));var db=require(_0xad62('0x14'))['db'];config[_0xad62('0x15')]=_[_0xad62('0x16')](config['redis'],{'host':_0xad62('0x17'),'port':0x18eb});var socket=require(_0xad62('0x18'))(new Redis(config[_0xad62('0x15')]));require(_0xad62('0x19'))[_0xad62('0x1a')](socket);function respondWithStatusCode(_0x3a0d10,_0x1fbbaa){_0x1fbbaa=_0x1fbbaa||0xcc;return function(_0xf9a18){if(_0xf9a18){return _0x3a0d10[_0xad62('0x1b')](_0x1fbbaa);}return _0x3a0d10['status'](_0x1fbbaa)[_0xad62('0x1c')]();};}function respondWithResult(_0x43c1b8,_0x1d361a){_0x1d361a=_0x1d361a||0xc8;return function(_0x3caa4a){if(_0x3caa4a){return _0x43c1b8[_0xad62('0x1d')](_0x1d361a)[_0xad62('0x1e')](_0x3caa4a);}};}function respondWithFilteredResult(_0x2b720f,_0x57bd16){return function(_0xa6d55f){if(_0xa6d55f){var _0x128b8f=typeof _0x57bd16[_0xad62('0x1f')]==='undefined'&&typeof _0x57bd16[_0xad62('0x20')]===_0xad62('0x21');var _0x52be5d=_0xa6d55f[_0xad62('0x22')];var _0x17b943=_0x128b8f?0x0:_0x57bd16[_0xad62('0x1f')];var _0x32ef0e=_0x128b8f?_0xa6d55f['count']:_0x57bd16[_0xad62('0x1f')]+_0x57bd16[_0xad62('0x20')];var _0x54cd93;if(_0x32ef0e>=_0x52be5d){_0x32ef0e=_0x52be5d;_0x54cd93=0xc8;}else{_0x54cd93=0xce;}_0x2b720f[_0xad62('0x1d')](_0x54cd93);return _0x2b720f[_0xad62('0x23')]('Content-Range',_0x17b943+'-'+_0x32ef0e+'/'+_0x52be5d)['json'](_0xa6d55f);}return null;};}function patchUpdates(_0x534a47){return function(_0x405504){try{jsonpatch[_0xad62('0x24')](_0x405504,_0x534a47,!![]);}catch(_0x192532){return BPromise[_0xad62('0x25')](_0x192532);}return _0x405504[_0xad62('0x26')]();};}function saveUpdates(_0x39426b,_0x47f9b4){return function(_0x3ae993){if(_0x3ae993){return _0x3ae993[_0xad62('0x27')](_0x39426b)[_0xad62('0x28')](function(_0x4371c2){return _0x4371c2;});}return null;};}function removeEntity(_0x182132,_0x36593b){return function(_0x5e2baf){if(_0x5e2baf){return _0x5e2baf[_0xad62('0x29')]()['then'](function(){var _0x440b3c=_0x5e2baf['get']({'plain':!![]});var _0x266d30=_0xad62('0x2a');return db[_0xad62('0x2b')][_0xad62('0x29')]({'where':{'type':_0x266d30,'resourceId':_0x440b3c['id']}})['then'](function(){return _0x5e2baf;});})[_0xad62('0x28')](function(){_0x182132['status'](0xcc)[_0xad62('0x1c')]();});}};}function handleEntityNotFound(_0x15ead2,_0x1c1e9f){return function(_0x4874e8){if(!_0x4874e8){_0x15ead2[_0xad62('0x1b')](0x194);}return _0x4874e8;};}function handleError(_0x25576b,_0x101242){_0x101242=_0x101242||0x1f4;return function(_0x32999a){logger[_0xad62('0x2c')](_0x32999a[_0xad62('0x2d')]);if(_0x32999a[_0xad62('0x2e')]){delete _0x32999a[_0xad62('0x2e')];}_0x25576b[_0xad62('0x1d')](_0x101242)[_0xad62('0x2f')](_0x32999a);};}exports[_0xad62('0x30')]=function(_0x565c11,_0x4e09af){var _0x527d57={},_0x35ad64={},_0xe5c4b={'count':0x0,'rows':[]};var _0x1435c9=_[_0xad62('0x31')](db[_0xad62('0x32')][_0xad62('0x33')],function(_0xf18200){return{'name':_0xf18200[_0xad62('0x34')],'type':_0xf18200[_0xad62('0x35')][_0xad62('0x36')]};});_0x35ad64['model']=_['map'](_0x1435c9,'name');_0x35ad64[_0xad62('0x37')]=_['keys'](_0x565c11['query']);_0x35ad64[_0xad62('0x38')]=_[_0xad62('0x39')](_0x35ad64[_0xad62('0x3a')],_0x35ad64['query']);_0x527d57[_0xad62('0x3b')]=_[_0xad62('0x39')](_0x35ad64[_0xad62('0x3a')],qs[_0xad62('0x3c')](_0x565c11[_0xad62('0x37')][_0xad62('0x3c')]));_0x527d57[_0xad62('0x3b')]=_0x527d57['attributes'][_0xad62('0x3d')]?_0x527d57[_0xad62('0x3b')]:_0x35ad64[_0xad62('0x3a')];if(!_0x565c11['query']['hasOwnProperty']('nolimit')){_0x527d57[_0xad62('0x20')]=qs['limit'](_0x565c11[_0xad62('0x37')][_0xad62('0x20')]);_0x527d57[_0xad62('0x1f')]=qs['offset'](_0x565c11[_0xad62('0x37')][_0xad62('0x1f')]);}_0x527d57['order']=qs['sort'](_0x565c11[_0xad62('0x37')][_0xad62('0x3e')]);_0x527d57[_0xad62('0x3f')]=qs[_0xad62('0x38')](_[_0xad62('0x40')](_0x565c11[_0xad62('0x37')],_0x35ad64[_0xad62('0x38')]),_0x1435c9);if(_0x565c11['query'][_0xad62('0x41')]){_0x527d57[_0xad62('0x3f')]=_['merge'](_0x527d57[_0xad62('0x3f')],{'$or':_['map'](_0x1435c9,function(_0x238c81){if(_0x238c81[_0xad62('0x35')]!=='VIRTUAL'){var _0x5d3754={};_0x5d3754[_0x238c81[_0xad62('0x2e')]]={'$like':'%'+_0x565c11[_0xad62('0x37')][_0xad62('0x41')]+'%'};return _0x5d3754;}})});}_0x527d57=_[_0xad62('0x42')]({},_0x527d57,_0x565c11['options']);var _0x5cd037={'where':_0x527d57[_0xad62('0x3f')]};return db[_0xad62('0x32')][_0xad62('0x22')](_0x5cd037)[_0xad62('0x28')](function(_0x5b3646){_0xe5c4b[_0xad62('0x22')]=_0x5b3646;if(_0x565c11['query'][_0xad62('0x43')]){_0x527d57[_0xad62('0x44')]=[{'all':!![]}];}return db[_0xad62('0x32')]['findAll'](_0x527d57);})[_0xad62('0x28')](function(_0x3c2660){_0xe5c4b[_0xad62('0x45')]=_0x3c2660;return _0xe5c4b;})['then'](respondWithFilteredResult(_0x4e09af,_0x527d57))['catch'](handleError(_0x4e09af,null));};exports[_0xad62('0x46')]=function(_0x52978e,_0x66cba8){var _0x401197={'raw':!![],'where':{'id':_0x52978e['params']['id']}},_0x59292f={};_0x59292f[_0xad62('0x3a')]=_[_0xad62('0x47')](db[_0xad62('0x32')][_0xad62('0x33')]);_0x59292f[_0xad62('0x37')]=_['keys'](_0x52978e['query']);_0x59292f['filters']=_[_0xad62('0x39')](_0x59292f[_0xad62('0x3a')],_0x59292f[_0xad62('0x37')]);_0x401197[_0xad62('0x3b')]=_[_0xad62('0x39')](_0x59292f['model'],qs[_0xad62('0x3c')](_0x52978e['query'][_0xad62('0x3c')]));_0x401197[_0xad62('0x3b')]=_0x401197[_0xad62('0x3b')][_0xad62('0x3d')]?_0x401197[_0xad62('0x3b')]:_0x59292f['model'];if(_0x52978e[_0xad62('0x37')][_0xad62('0x43')]){_0x401197[_0xad62('0x44')]=[{'all':!![]}];}_0x401197=_[_0xad62('0x42')]({},_0x401197,_0x52978e[_0xad62('0x48')]);return db[_0xad62('0x32')][_0xad62('0x49')](_0x401197)[_0xad62('0x28')](handleEntityNotFound(_0x66cba8,null))[_0xad62('0x28')](respondWithResult(_0x66cba8,null))[_0xad62('0x4a')](handleError(_0x66cba8,null));};exports[_0xad62('0x4b')]=function(_0x2cc6ef,_0x3f3a54){return db[_0xad62('0x32')][_0xad62('0x4b')](_0x2cc6ef[_0xad62('0x4c')],{})[_0xad62('0x28')](function(_0x22be71){var _0x1bd995=_0x2cc6ef[_0xad62('0x4d')][_0xad62('0x4e')]({'plain':!![]});if(!_0x1bd995)throw new Error(_0xad62('0x4f'));if(_0x1bd995['role']===_0xad62('0x4d')){var _0x467506=_0x22be71[_0xad62('0x4e')]({'plain':!![]});var _0x4f3875=_0xad62('0x2a');return db[_0xad62('0x50')][_0xad62('0x49')]({'where':{'name':_0x4f3875,'userProfileId':_0x1bd995[_0xad62('0x51')]},'raw':!![]})[_0xad62('0x28')](function(_0x540c9b){if(_0x540c9b&&_0x540c9b[_0xad62('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x467506[_0xad62('0x2e')],'resourceId':_0x467506['id'],'type':_0x540c9b['name'],'sectionId':_0x540c9b['id']},{})['then'](function(){return _0x22be71;});}else{return _0x22be71;}})[_0xad62('0x4a')](function(_0x159e76){logger[_0xad62('0x2c')](_0xad62('0x53'),_0x159e76);throw _0x159e76;});}return _0x22be71;})[_0xad62('0x28')](respondWithResult(_0x3f3a54,0xc9))[_0xad62('0x4a')](handleError(_0x3f3a54,null));};exports[_0xad62('0x27')]=function(_0x47ca98,_0x5e3687){if(_0x47ca98[_0xad62('0x4c')]['id']){delete _0x47ca98[_0xad62('0x4c')]['id'];}return db[_0xad62('0x32')][_0xad62('0x49')]({'where':{'id':_0x47ca98['params']['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x5e3687,null))[_0xad62('0x28')](saveUpdates(_0x47ca98['body'],null))[_0xad62('0x28')](respondWithResult(_0x5e3687,null))[_0xad62('0x4a')](handleError(_0x5e3687,null));};exports[_0xad62('0x29')]=function(_0x3007cc,_0x43d1ae){return db[_0xad62('0x32')][_0xad62('0x49')]({'where':{'id':_0x3007cc[_0xad62('0x54')]['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x43d1ae,null))['then'](removeEntity(_0x43d1ae,null))[_0xad62('0x4a')](handleError(_0x43d1ae,null));};exports['describe']=function(_0xf34c7f,_0x51d767){return db[_0xad62('0x32')][_0xad62('0x55')]()[_0xad62('0x28')](respondWithResult(_0x51d767,null))[_0xad62('0x4a')](handleError(_0x51d767,null));};exports['getMembers']=function(_0x520242,_0x2b3383,_0x138ceb){var _0x4b046e={'raw':!![],'where':{}},_0x41af8f={},_0x91a7fc;return db[_0xad62('0x32')][_0xad62('0x56')]({'where':{'id':_0x520242['params']['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x2b3383,null))[_0xad62('0x28')](function(_0x18aa9a){if(_0x18aa9a){_0x91a7fc=_0x18aa9a['get']({'plain':!![]});_0x41af8f[_0xad62('0x3a')]=_[_0xad62('0x47')](db[_0xad62('0x57')]['rawAttributes']);_0x41af8f[_0xad62('0x37')]=_[_0xad62('0x47')](_0x520242[_0xad62('0x37')]);_0x41af8f[_0xad62('0x38')]=_[_0xad62('0x39')](_0x41af8f[_0xad62('0x3a')],_0x41af8f[_0xad62('0x37')]);_0x4b046e[_0xad62('0x3b')]=_['intersection'](_0x41af8f['model'],qs['fields'](_0x520242['query']['fields']));_0x4b046e['attributes']=_0x4b046e['attributes'][_0xad62('0x3d')]?_0x4b046e[_0xad62('0x3b')]:_0x41af8f['model'];if(!_0x520242[_0xad62('0x37')][_0xad62('0x58')](_0xad62('0x59'))){_0x4b046e[_0xad62('0x20')]=qs[_0xad62('0x20')](_0x520242['query'][_0xad62('0x20')]);_0x4b046e[_0xad62('0x1f')]=qs[_0xad62('0x1f')](_0x520242[_0xad62('0x37')][_0xad62('0x1f')]);}_0x4b046e[_0xad62('0x5a')]=qs['sort'](_0x520242[_0xad62('0x37')]['sort']);_0x4b046e[_0xad62('0x3f')]=qs[_0xad62('0x38')](_[_0xad62('0x40')](_0x520242[_0xad62('0x37')],_0x41af8f[_0xad62('0x38')]));_0x4b046e[_0xad62('0x3f')][_0xad62('0x5b')]=_0x18aa9a['id'];if(_0x520242[_0xad62('0x37')][_0xad62('0x41')]){_0x4b046e[_0xad62('0x3f')]=_[_0xad62('0x42')](_0x4b046e['where'],{'$or':_[_0xad62('0x31')](_0x4b046e[_0xad62('0x3b')],function(_0x2fc96a){var _0x432f2f={};_0x432f2f[_0x2fc96a]={'$like':'%'+_0x520242[_0xad62('0x37')][_0xad62('0x41')]+'%'};return _0x432f2f;})});}_0x4b046e=_[_0xad62('0x42')]({},_0x4b046e,_0x520242[_0xad62('0x48')]);return db[_0xad62('0x57')][_0xad62('0x5c')](_0x4b046e);}})[_0xad62('0x28')](function(_0xa776d0){if(_0xa776d0){return db[_0xad62('0x5d')][_0xad62('0x5e')]({'where':{'id':_['map'](_0xa776d0,_0xad62('0x5f')),'role':_0xad62('0x60')},'attributes':['id',_0xad62('0x2e'),'openchannelPause',_0xad62('0x61'),'createdAt']});}})[_0xad62('0x28')](function(_0x5333fe){if(_0x5333fe){return{'count':_0x5333fe['count'],'rows':_[_0xad62('0x31')](_0x5333fe[_0xad62('0x45')],function(_0x3c0d25){return{'membername':_0x3c0d25[_0xad62('0x2e')],'UserId':_0x3c0d25['id'],'queue_name':_0x91a7fc[_0xad62('0x2e')],'OpenchannelQueueId':_0x91a7fc['id'],'interface':util[_0xad62('0x62')](_0xad62('0x63'),_0xad62('0x64'),_0x3c0d25['name']),'penalty':0x0,'paused':_0x3c0d25['openchannelPause'],'createdAt':_0x3c0d25['createdAt'],'updatedAt':_0x3c0d25[_0xad62('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xad62('0x28')](respondWithFilteredResult(_0x2b3383,_0x4b046e))[_0xad62('0x4a')](handleError(_0x2b3383,null));};exports[_0xad62('0x65')]=function(_0x3b885d,_0x2742fe,_0x5123b9){var _0x2b71dc={};var _0x52c805={};var _0x5850a1;var _0x16c3c6;return db[_0xad62('0x32')][_0xad62('0x56')]({'where':{'id':_0x3b885d[_0xad62('0x54')]['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x2742fe,null))[_0xad62('0x28')](function(_0x4d8a2e){if(_0x4d8a2e){_0x5850a1=_0x4d8a2e;_0x52c805[_0xad62('0x3a')]=_[_0xad62('0x47')](db[_0xad62('0x66')][_0xad62('0x33')]);_0x52c805[_0xad62('0x37')]=_['keys'](_0x3b885d[_0xad62('0x37')]);_0x52c805[_0xad62('0x38')]=_[_0xad62('0x39')](_0x52c805['model'],_0x52c805[_0xad62('0x37')]);_0x2b71dc[_0xad62('0x3b')]=_[_0xad62('0x39')](_0x52c805[_0xad62('0x3a')],qs[_0xad62('0x3c')](_0x3b885d[_0xad62('0x37')]['fields']));_0x2b71dc['attributes']=_0x2b71dc[_0xad62('0x3b')][_0xad62('0x3d')]?_0x2b71dc['attributes']:_0x52c805[_0xad62('0x3a')];_0x2b71dc[_0xad62('0x5a')]=qs['sort'](_0x3b885d['query'][_0xad62('0x3e')]);_0x2b71dc[_0xad62('0x3f')]=qs['filters'](_[_0xad62('0x40')](_0x3b885d[_0xad62('0x37')],_0x52c805[_0xad62('0x38')]));if(_0x3b885d[_0xad62('0x37')][_0xad62('0x41')]){_0x2b71dc[_0xad62('0x3f')]=_['merge'](_0x2b71dc['where'],{'$or':_[_0xad62('0x31')](_0x2b71dc[_0xad62('0x3b')],function(_0x21b617){var _0x501a1c={};_0x501a1c[_0x21b617]={'$like':'%'+_0x3b885d[_0xad62('0x37')][_0xad62('0x41')]+'%'};return _0x501a1c;})});}_0x2b71dc=_[_0xad62('0x42')]({},_0x2b71dc,_0x3b885d[_0xad62('0x48')]);return _0x5850a1[_0xad62('0x65')](_0x2b71dc);}})[_0xad62('0x28')](function(_0x364887){if(_0x364887){_0x16c3c6=_0x364887[_0xad62('0x3d')];if(!_0x3b885d[_0xad62('0x37')]['hasOwnProperty'](_0xad62('0x59'))){_0x2b71dc[_0xad62('0x20')]=qs[_0xad62('0x20')](_0x3b885d[_0xad62('0x37')][_0xad62('0x20')]);_0x2b71dc[_0xad62('0x1f')]=qs['offset'](_0x3b885d[_0xad62('0x37')]['offset']);}return _0x5850a1[_0xad62('0x65')](_0x2b71dc);}})[_0xad62('0x28')](function(_0x4972b0){if(_0x4972b0){return _0x4972b0?{'count':_0x16c3c6,'rows':_0x4972b0}:null;}})[_0xad62('0x28')](respondWithResult(_0x2742fe,null))[_0xad62('0x4a')](handleError(_0x2742fe,null));};exports[_0xad62('0x67')]=function(_0x21dbfe,_0x16dd9a,_0x1fd269){var _0x257998=_0x21dbfe[_0xad62('0x4c')][_0xad62('0x68')];return db[_0xad62('0x66')][_0xad62('0x5c')]({'where':{'id':_0x257998},'attributes':['id'],'include':[{'model':db['User'],'as':_0xad62('0x69'),'attributes':['id','name',_0xad62('0x6a'),'voicePause',_0xad62('0x6b')],'raw':!![]}]})[_0xad62('0x28')](function(_0x16fa3d){if(_0x16fa3d){var _0x45b9b7=_['flatMap'](_0x16fa3d,function(_0x17feb2){var _0x34dd8b=_0x17feb2[_0xad62('0x4e')]({'plain':!![]});return _0x34dd8b[_0xad62('0x69')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x21dbfe[_0xad62('0x54')]['id']}})[_0xad62('0x28')](function(_0x1f0d14){return db['sequelize'][_0xad62('0x6c')](function(_0xf5f71e){return _0x1f0d14[_0xad62('0x67')](_0x257998,{'transaction':_0xf5f71e})[_0xad62('0x28')](function(){return BPromise[_0xad62('0x6d')](_0x45b9b7,function(_0x4519ba){return db[_0xad62('0x57')]['findOrCreate']({'where':{'UserId':_0x4519ba['id'],'OpenchannelQueueId':_0x21dbfe[_0xad62('0x54')]['id']},'transaction':_0xf5f71e});});})[_0xad62('0x28')](function(){_0x45b9b7[_0xad62('0x6e')](function(_0x527f9a){socket[_0xad62('0x6f')](_0xad62('0x70'),{'UserId':_0x527f9a['id'],'OpenchannelQueueId':_0x1f0d14['id']});});});});});}})['then'](respondWithStatusCode(_0x16dd9a,null))[_0xad62('0x4a')](handleError(_0x16dd9a,null));};exports[_0xad62('0x71')]=function(_0x57e451,_0x4bf010,_0x3f8451){return db[_0xad62('0x66')][_0xad62('0x5c')]({'where':{'id':_0x57e451[_0xad62('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xad62('0x5d')],'as':_0xad62('0x69'),'attributes':['id'],'raw':!![]}]})[_0xad62('0x28')](handleEntityNotFound(_0x4bf010,null))[_0xad62('0x28')](function(_0x5086f1){var _0x2cb8ed=_[_0xad62('0x31')](_0x5086f1,'id');var _0x1096eb=[];var _0x141d0b=[];var _0x359848=squel[_0xad62('0x72')]();_0x359848[_0xad62('0x73')](_0xad62('0x74'))['from'](_0xad62('0x75'),'tq')[_0xad62('0x76')](_0xad62('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xad62('0x3f')](_0xad62('0x78'),_0x57e451[_0xad62('0x54')]['id']);for(var _0x2277f0=0x0;_0x2277f0<_0x5086f1[_0xad62('0x3d')];_0x2277f0+=0x1){let _0x4d0569=_0x5086f1[_0x2277f0];for(var _0x23ada4=0x0;_0x23ada4<_0x4d0569[_0xad62('0x69')]['length'];_0x23ada4+=0x1){let _0x1e196b=_0x4d0569[_0xad62('0x69')][_0x23ada4];var _0x58ff2b=_0x359848[_0xad62('0x79')]();_0x58ff2b[_0xad62('0x3f')]('ut.UserId\x20=\x20?',_0x1e196b['id']);_0x141d0b[_0xad62('0x7a')](db[_0xad62('0x7b')][_0xad62('0x37')](_0x58ff2b['toString'](),{'type':db[_0xad62('0x7b')][_0xad62('0x7c')][_0xad62('0x7d')]})[_0xad62('0x28')](function(_0x595d68){if(_0x595d68[_0xad62('0x3d')]===0x1){return _0x1e196b['id'];}else{var _0x476f4f=_[_0xad62('0x7e')](_[_0xad62('0x31')](_0x595d68,_0xad62('0x7f')),function(_0x50703b){return _[_0xad62('0x80')](_0x2cb8ed,_0x50703b);});if(_0x476f4f){return _0x1e196b['id'];}}}));}}return BPromise[_0xad62('0x81')](_0x141d0b)[_0xad62('0x28')](function(_0x59520b){_0x1096eb=_(_0x1096eb)[_0xad62('0x82')](_0x59520b)[_0xad62('0x83')]()['value']();return db[_0xad62('0x32')]['find']({'where':{'id':_0x57e451['params']['id']}})[_0xad62('0x28')](function(_0x2c7482){return db[_0xad62('0x7b')]['transaction'](function(_0x3ace4e){return _0x2c7482['removeTeams'](_0x57e451[_0xad62('0x37')]['ids'],{'transaction':_0x3ace4e})[_0xad62('0x28')](function(){if(!_['isEmpty'](_0x1096eb)){return _0x2c7482['removeAgents'](_0x1096eb,{'transaction':_0x3ace4e});}})[_0xad62('0x28')](function(){_0x1096eb[_0xad62('0x6e')](function(_0x27d506){socket[_0xad62('0x6f')](_0xad62('0x84'),{'UserId':_0x27d506,'OpenchannelQueueId':_0x2c7482['id']});});});});});});})[_0xad62('0x28')](respondWithStatusCode(_0x4bf010,null))[_0xad62('0x4a')](handleError(_0x4bf010,null));};exports[_0xad62('0x85')]=function(_0x4bb860,_0x383ab9,_0x446da6){return db['OpenchannelQueue'][_0xad62('0x49')]({'where':{'id':_0x4bb860['params']['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x383ab9,null))[_0xad62('0x28')](function(_0x44af8a){if(_0x44af8a){return _0x44af8a[_0xad62('0x85')](_0x4bb860[_0xad62('0x4c')][_0xad62('0x68')],_[_0xad62('0x86')](_0x4bb860[_0xad62('0x4c')],[_0xad62('0x68'),'id'])||{})[_0xad62('0x87')](function(_0x2f5ac0){for(var _0x18abab=0x0;_0x18abab<_0x4bb860[_0xad62('0x4c')][_0xad62('0x68')][_0xad62('0x3d')];_0x18abab+=0x1){socket[_0xad62('0x6f')](_0xad62('0x70'),{'UserId':Number(_0x4bb860[_0xad62('0x4c')]['ids'][_0x18abab]),'OpenchannelQueueId':Number(_0x4bb860[_0xad62('0x54')]['id'])});}return _0x2f5ac0;});}})[_0xad62('0x28')](respondWithResult(_0x383ab9,null))[_0xad62('0x4a')](handleError(_0x383ab9,null));};exports[_0xad62('0x88')]=function(_0xdb126f,_0xe0c37a,_0x26215c){return db[_0xad62('0x32')][_0xad62('0x49')]({'where':{'id':_0xdb126f[_0xad62('0x54')]['id']}})[_0xad62('0x28')](handleEntityNotFound(_0xe0c37a,null))['then'](function(_0x1303f6){if(_0x1303f6){return _0x1303f6[_0xad62('0x88')](_0xdb126f[_0xad62('0x37')][_0xad62('0x68')])[_0xad62('0x28')](function(){if(_[_0xad62('0x89')](_0xdb126f[_0xad62('0x37')][_0xad62('0x68')])){for(var _0x2901fe=0x0;_0x2901fe<_0xdb126f[_0xad62('0x37')][_0xad62('0x68')][_0xad62('0x3d')];_0x2901fe+=0x1){socket['emit'](_0xad62('0x84'),{'UserId':Number(_0xdb126f[_0xad62('0x37')][_0xad62('0x68')][_0x2901fe]),'OpenchannelQueueId':Number(_0xdb126f[_0xad62('0x54')]['id'])});}}else{socket[_0xad62('0x6f')]('userOpenchannelQueue:remove',{'UserId':Number(_0xdb126f[_0xad62('0x37')][_0xad62('0x68')]),'OpenchannelQueueId':Number(_0xdb126f['params']['id'])});}});}})[_0xad62('0x28')](respondWithStatusCode(_0xe0c37a,null))[_0xad62('0x4a')](handleError(_0xe0c37a,null));};exports[_0xad62('0x8a')]=function(_0x19bbd8,_0x12dcda,_0x482497){var _0x26a1c4={};var _0x617886={};var _0x1c00ee;var _0x401644;return db[_0xad62('0x32')][_0xad62('0x56')]({'where':{'id':_0x19bbd8[_0xad62('0x54')]['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x12dcda,null))[_0xad62('0x28')](function(_0x3d4b00){if(_0x3d4b00){_0x1c00ee=_0x3d4b00;_0x617886[_0xad62('0x3a')]=_[_0xad62('0x47')](db['User'][_0xad62('0x33')]);_0x617886[_0xad62('0x37')]=_['keys'](_0x19bbd8[_0xad62('0x37')]);_0x617886[_0xad62('0x38')]=_['intersection'](_0x617886[_0xad62('0x3a')],_0x617886[_0xad62('0x37')]);_0x26a1c4[_0xad62('0x3b')]=_[_0xad62('0x39')](_0x617886[_0xad62('0x3a')],qs['fields'](_0x19bbd8['query'][_0xad62('0x3c')]));_0x26a1c4['attributes']=_0x26a1c4[_0xad62('0x3b')][_0xad62('0x3d')]?_0x26a1c4[_0xad62('0x3b')]:_0x617886[_0xad62('0x3a')];_0x26a1c4[_0xad62('0x5a')]=qs[_0xad62('0x3e')](_0x19bbd8[_0xad62('0x37')][_0xad62('0x3e')]);_0x26a1c4[_0xad62('0x3f')]=qs[_0xad62('0x38')](_['pick'](_0x19bbd8[_0xad62('0x37')],_0x617886[_0xad62('0x38')]));if(_0x19bbd8[_0xad62('0x37')]['filter']){_0x26a1c4[_0xad62('0x3f')]=_[_0xad62('0x42')](_0x26a1c4[_0xad62('0x3f')],{'$or':_['map'](_0x26a1c4[_0xad62('0x3b')],function(_0x10924a){var _0x53958d={};_0x53958d[_0x10924a]={'$like':'%'+_0x19bbd8[_0xad62('0x37')][_0xad62('0x41')]+'%'};return _0x53958d;})});}_0x26a1c4=_[_0xad62('0x42')]({},_0x26a1c4,_0x19bbd8[_0xad62('0x48')]);return _0x1c00ee[_0xad62('0x8a')](_0x26a1c4);}})[_0xad62('0x28')](function(_0xaef603){if(_0xaef603){_0x401644=_0xaef603[_0xad62('0x3d')];if(!_0x19bbd8[_0xad62('0x37')][_0xad62('0x58')](_0xad62('0x59'))){_0x26a1c4[_0xad62('0x20')]=qs[_0xad62('0x20')](_0x19bbd8[_0xad62('0x37')][_0xad62('0x20')]);_0x26a1c4[_0xad62('0x1f')]=qs[_0xad62('0x1f')](_0x19bbd8[_0xad62('0x37')][_0xad62('0x1f')]);}return _0x1c00ee[_0xad62('0x8a')](_0x26a1c4);}})['then'](function(_0x23d082){if(_0x23d082){return _0x23d082?{'count':_0x401644,'rows':_0x23d082}:null;}})[_0xad62('0x28')](respondWithResult(_0x12dcda,null))['catch'](handleError(_0x12dcda,null));}; \ No newline at end of file +var _0xb6ee=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','ids','Team','Agents','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','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?','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','addAgents','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','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','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','OpenchannelQueues','UserProfileResource','sendStatus','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1a450a,_0x4dcb72){var _0x4f8ef4=function(_0x44c6ba){while(--_0x44c6ba){_0x1a450a['push'](_0x1a450a['shift']());}};_0x4f8ef4(++_0x4dcb72);}(_0xb6ee,0x175));var _0xeb6e=function(_0x5eacb4,_0x5a6733){_0x5eacb4=_0x5eacb4-0x0;var _0x34dcbc=_0xb6ee[_0x5eacb4];return _0x34dcbc;};'use strict';var emlformat=require(_0xeb6e('0x0'));var rimraf=require(_0xeb6e('0x1'));var zipdir=require(_0xeb6e('0x2'));var jsonpatch=require(_0xeb6e('0x3'));var rp=require('request-promise');var moment=require(_0xeb6e('0x4'));var BPromise=require(_0xeb6e('0x5'));var Mustache=require(_0xeb6e('0x6'));var util=require(_0xeb6e('0x7'));var path=require(_0xeb6e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeb6e('0x9'));var fs=require('fs');var fs_extra=require(_0xeb6e('0xa'));var _=require(_0xeb6e('0xb'));var squel=require(_0xeb6e('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb6e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeb6e('0xe'));var querystring=require(_0xeb6e('0xf'));var Papa=require(_0xeb6e('0x10'));var Redis=require(_0xeb6e('0x11'));var authService=require(_0xeb6e('0x12'));var qs=require(_0xeb6e('0x13'));var as=require(_0xeb6e('0x14'));var hardwareService=require(_0xeb6e('0x15'));var logger=require(_0xeb6e('0x16'))(_0xeb6e('0x17'));var utils=require('../../config/utils');var config=require(_0xeb6e('0x18'));var licenseUtil=require(_0xeb6e('0x19'));var db=require(_0xeb6e('0x1a'))['db'];config['redis']=_['defaults'](config[_0xeb6e('0x1b')],{'host':_0xeb6e('0x1c'),'port':0x18eb});var socket=require(_0xeb6e('0x1d'))(new Redis(config[_0xeb6e('0x1b')]));require(_0xeb6e('0x1e'))[_0xeb6e('0x1f')](socket);function respondWithStatusCode(_0x9c4636,_0x126242){_0x126242=_0x126242||0xcc;return function(_0x25d544){if(_0x25d544){return _0x9c4636['sendStatus'](_0x126242);}return _0x9c4636[_0xeb6e('0x20')](_0x126242)[_0xeb6e('0x21')]();};}function respondWithResult(_0x33d6af,_0xc4a3ce){_0xc4a3ce=_0xc4a3ce||0xc8;return function(_0x8f15c3){if(_0x8f15c3){return _0x33d6af[_0xeb6e('0x20')](_0xc4a3ce)[_0xeb6e('0x22')](_0x8f15c3);}};}function respondWithFilteredResult(_0x4f8952,_0x2bcac5){return function(_0x437bc6){if(_0x437bc6){var _0x9dd17=typeof _0x2bcac5['offset']===_0xeb6e('0x23')&&typeof _0x2bcac5[_0xeb6e('0x24')]==='undefined';var _0x1868d6=_0x437bc6[_0xeb6e('0x25')];var _0x15743d=_0x9dd17?0x0:_0x2bcac5[_0xeb6e('0x26')];var _0x47b3b1=_0x9dd17?_0x437bc6['count']:_0x2bcac5['offset']+_0x2bcac5[_0xeb6e('0x24')];var _0x5ce628;if(_0x47b3b1>=_0x1868d6){_0x47b3b1=_0x1868d6;_0x5ce628=0xc8;}else{_0x5ce628=0xce;}_0x4f8952[_0xeb6e('0x20')](_0x5ce628);return _0x4f8952[_0xeb6e('0x27')](_0xeb6e('0x28'),_0x15743d+'-'+_0x47b3b1+'/'+_0x1868d6)[_0xeb6e('0x22')](_0x437bc6);}return null;};}function patchUpdates(_0x348307){return function(_0x268b8c){try{jsonpatch[_0xeb6e('0x29')](_0x268b8c,_0x348307,!![]);}catch(_0x51ac80){return BPromise['reject'](_0x51ac80);}return _0x268b8c[_0xeb6e('0x2a')]();};}function saveUpdates(_0x53c56d,_0x4663be){return function(_0x1ec53f){if(_0x1ec53f){return _0x1ec53f[_0xeb6e('0x2b')](_0x53c56d)[_0xeb6e('0x2c')](function(_0x23d2a3){return _0x23d2a3;});}return null;};}function removeEntity(_0x30f4d1,_0x424398){return function(_0x2bde22){if(_0x2bde22){return _0x2bde22['destroy']()[_0xeb6e('0x2c')](function(){var _0x2901fa=_0x2bde22['get']({'plain':!![]});var _0x21790f=_0xeb6e('0x2d');return db[_0xeb6e('0x2e')]['destroy']({'where':{'type':_0x21790f,'resourceId':_0x2901fa['id']}})[_0xeb6e('0x2c')](function(){return _0x2bde22;});})[_0xeb6e('0x2c')](function(){_0x30f4d1['status'](0xcc)[_0xeb6e('0x21')]();});}};}function handleEntityNotFound(_0x5dba70,_0x2f84fa){return function(_0x15e14d){if(!_0x15e14d){_0x5dba70[_0xeb6e('0x2f')](0x194);}return _0x15e14d;};}function handleError(_0x50ba22,_0x91e9ce){_0x91e9ce=_0x91e9ce||0x1f4;return function(_0x431dd7){logger['error'](_0x431dd7[_0xeb6e('0x30')]);if(_0x431dd7[_0xeb6e('0x31')]){delete _0x431dd7[_0xeb6e('0x31')];}_0x50ba22['status'](_0x91e9ce)[_0xeb6e('0x32')](_0x431dd7);};}exports[_0xeb6e('0x33')]=function(_0x28d177,_0x36402a){var _0x11a598={},_0x47095a={},_0x5c3224={'count':0x0,'rows':[]};var _0xbbdfe8=_['map'](db[_0xeb6e('0x34')][_0xeb6e('0x35')],function(_0x3a89dc){return{'name':_0x3a89dc[_0xeb6e('0x36')],'type':_0x3a89dc['type'][_0xeb6e('0x37')]};});_0x47095a[_0xeb6e('0x38')]=_[_0xeb6e('0x39')](_0xbbdfe8,'name');_0x47095a[_0xeb6e('0x3a')]=_[_0xeb6e('0x3b')](_0x28d177[_0xeb6e('0x3a')]);_0x47095a[_0xeb6e('0x3c')]=_[_0xeb6e('0x3d')](_0x47095a[_0xeb6e('0x38')],_0x47095a[_0xeb6e('0x3a')]);_0x11a598[_0xeb6e('0x3e')]=_[_0xeb6e('0x3d')](_0x47095a[_0xeb6e('0x38')],qs[_0xeb6e('0x3f')](_0x28d177[_0xeb6e('0x3a')]['fields']));_0x11a598[_0xeb6e('0x3e')]=_0x11a598[_0xeb6e('0x3e')][_0xeb6e('0x40')]?_0x11a598[_0xeb6e('0x3e')]:_0x47095a[_0xeb6e('0x38')];if(!_0x28d177['query'][_0xeb6e('0x41')](_0xeb6e('0x42'))){_0x11a598['limit']=qs[_0xeb6e('0x24')](_0x28d177['query'][_0xeb6e('0x24')]);_0x11a598[_0xeb6e('0x26')]=qs[_0xeb6e('0x26')](_0x28d177['query'][_0xeb6e('0x26')]);}_0x11a598[_0xeb6e('0x43')]=qs[_0xeb6e('0x44')](_0x28d177['query'][_0xeb6e('0x44')]);_0x11a598[_0xeb6e('0x45')]=qs[_0xeb6e('0x3c')](_[_0xeb6e('0x46')](_0x28d177[_0xeb6e('0x3a')],_0x47095a[_0xeb6e('0x3c')]),_0xbbdfe8);if(_0x28d177['query'][_0xeb6e('0x47')]){_0x11a598[_0xeb6e('0x45')]=_[_0xeb6e('0x48')](_0x11a598[_0xeb6e('0x45')],{'$or':_[_0xeb6e('0x39')](_0xbbdfe8,function(_0x16d5c2){if(_0x16d5c2[_0xeb6e('0x49')]!==_0xeb6e('0x4a')){var _0x5ebd81={};_0x5ebd81[_0x16d5c2[_0xeb6e('0x31')]]={'$like':'%'+_0x28d177[_0xeb6e('0x3a')][_0xeb6e('0x47')]+'%'};return _0x5ebd81;}})});}_0x11a598=_[_0xeb6e('0x48')]({},_0x11a598,_0x28d177[_0xeb6e('0x4b')]);var _0x44ad56={'where':_0x11a598[_0xeb6e('0x45')]};return db['OpenchannelQueue'][_0xeb6e('0x25')](_0x44ad56)[_0xeb6e('0x2c')](function(_0x1b5dcc){_0x5c3224[_0xeb6e('0x25')]=_0x1b5dcc;if(_0x28d177[_0xeb6e('0x3a')][_0xeb6e('0x4c')]){_0x11a598[_0xeb6e('0x4d')]=[{'all':!![]}];}return db[_0xeb6e('0x34')]['findAll'](_0x11a598);})['then'](function(_0x15a29c){_0x5c3224[_0xeb6e('0x4e')]=_0x15a29c;return _0x5c3224;})['then'](respondWithFilteredResult(_0x36402a,_0x11a598))[_0xeb6e('0x4f')](handleError(_0x36402a,null));};exports[_0xeb6e('0x50')]=function(_0x3abd51,_0x3cc09e){var _0xc2dd1={'raw':!![],'where':{'id':_0x3abd51[_0xeb6e('0x51')]['id']}},_0x500c48={};_0x500c48[_0xeb6e('0x38')]=_[_0xeb6e('0x3b')](db[_0xeb6e('0x34')]['rawAttributes']);_0x500c48[_0xeb6e('0x3a')]=_[_0xeb6e('0x3b')](_0x3abd51[_0xeb6e('0x3a')]);_0x500c48[_0xeb6e('0x3c')]=_[_0xeb6e('0x3d')](_0x500c48[_0xeb6e('0x38')],_0x500c48[_0xeb6e('0x3a')]);_0xc2dd1[_0xeb6e('0x3e')]=_[_0xeb6e('0x3d')](_0x500c48[_0xeb6e('0x38')],qs[_0xeb6e('0x3f')](_0x3abd51[_0xeb6e('0x3a')]['fields']));_0xc2dd1[_0xeb6e('0x3e')]=_0xc2dd1[_0xeb6e('0x3e')][_0xeb6e('0x40')]?_0xc2dd1[_0xeb6e('0x3e')]:_0x500c48[_0xeb6e('0x38')];if(_0x3abd51[_0xeb6e('0x3a')][_0xeb6e('0x4c')]){_0xc2dd1[_0xeb6e('0x4d')]=[{'all':!![]}];}_0xc2dd1=_[_0xeb6e('0x48')]({},_0xc2dd1,_0x3abd51[_0xeb6e('0x4b')]);return db[_0xeb6e('0x34')][_0xeb6e('0x52')](_0xc2dd1)[_0xeb6e('0x2c')](handleEntityNotFound(_0x3cc09e,null))[_0xeb6e('0x2c')](respondWithResult(_0x3cc09e,null))['catch'](handleError(_0x3cc09e,null));};exports[_0xeb6e('0x53')]=function(_0x4e262d,_0x4a6de7){return db[_0xeb6e('0x34')][_0xeb6e('0x53')](_0x4e262d[_0xeb6e('0x54')],{})['then'](function(_0x50deec){var _0x1ab2f1=_0x4e262d[_0xeb6e('0x55')][_0xeb6e('0x56')]({'plain':!![]});if(!_0x1ab2f1)throw new Error(_0xeb6e('0x57'));if(_0x1ab2f1[_0xeb6e('0x58')]===_0xeb6e('0x55')){var _0x42122a=_0x50deec[_0xeb6e('0x56')]({'plain':!![]});var _0x452592=_0xeb6e('0x2d');return db[_0xeb6e('0x59')][_0xeb6e('0x52')]({'where':{'name':_0x452592,'userProfileId':_0x1ab2f1['userProfileId']},'raw':!![]})['then'](function(_0x5940a6){if(_0x5940a6&&_0x5940a6[_0xeb6e('0x5a')]===0x0){return db['UserProfileResource'][_0xeb6e('0x53')]({'name':_0x42122a[_0xeb6e('0x31')],'resourceId':_0x42122a['id'],'type':_0x5940a6['name'],'sectionId':_0x5940a6['id']},{})['then'](function(){return _0x50deec;});}else{return _0x50deec;}})[_0xeb6e('0x4f')](function(_0x496923){logger[_0xeb6e('0x5b')](_0xeb6e('0x5c'),_0x496923);throw _0x496923;});}return _0x50deec;})['then'](respondWithResult(_0x4a6de7,0xc9))['catch'](handleError(_0x4a6de7,null));};exports[_0xeb6e('0x2b')]=function(_0x40528b,_0x5ed6e8){if(_0x40528b[_0xeb6e('0x54')]['id']){delete _0x40528b[_0xeb6e('0x54')]['id'];}return db[_0xeb6e('0x34')][_0xeb6e('0x52')]({'where':{'id':_0x40528b['params']['id']}})[_0xeb6e('0x2c')](handleEntityNotFound(_0x5ed6e8,null))[_0xeb6e('0x2c')](saveUpdates(_0x40528b['body'],null))[_0xeb6e('0x2c')](respondWithResult(_0x5ed6e8,null))[_0xeb6e('0x4f')](handleError(_0x5ed6e8,null));};exports[_0xeb6e('0x5d')]=function(_0x242c9f,_0x4c2737){return db[_0xeb6e('0x34')]['find']({'where':{'id':_0x242c9f[_0xeb6e('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c2737,null))[_0xeb6e('0x2c')](removeEntity(_0x4c2737,null))[_0xeb6e('0x4f')](handleError(_0x4c2737,null));};exports[_0xeb6e('0x5e')]=function(_0x4234da,_0x41cde5){return db[_0xeb6e('0x34')][_0xeb6e('0x5e')]()[_0xeb6e('0x2c')](respondWithResult(_0x41cde5,null))[_0xeb6e('0x4f')](handleError(_0x41cde5,null));};exports[_0xeb6e('0x5f')]=function(_0x287b1b,_0x2bd3c6,_0x5368d7){var _0x420d1f={'raw':!![],'where':{}},_0x112325={},_0x23ea1e;return db[_0xeb6e('0x34')][_0xeb6e('0x60')]({'where':{'id':_0x287b1b['params']['id']}})[_0xeb6e('0x2c')](handleEntityNotFound(_0x2bd3c6,null))[_0xeb6e('0x2c')](function(_0x2484f3){if(_0x2484f3){_0x23ea1e=_0x2484f3['get']({'plain':!![]});_0x112325[_0xeb6e('0x38')]=_['keys'](db[_0xeb6e('0x61')][_0xeb6e('0x35')]);_0x112325[_0xeb6e('0x3a')]=_[_0xeb6e('0x3b')](_0x287b1b[_0xeb6e('0x3a')]);_0x112325[_0xeb6e('0x3c')]=_[_0xeb6e('0x3d')](_0x112325[_0xeb6e('0x38')],_0x112325[_0xeb6e('0x3a')]);_0x420d1f[_0xeb6e('0x3e')]=_['intersection'](_0x112325[_0xeb6e('0x38')],qs[_0xeb6e('0x3f')](_0x287b1b[_0xeb6e('0x3a')][_0xeb6e('0x3f')]));_0x420d1f[_0xeb6e('0x3e')]=_0x420d1f['attributes'][_0xeb6e('0x40')]?_0x420d1f[_0xeb6e('0x3e')]:_0x112325[_0xeb6e('0x38')];if(!_0x287b1b[_0xeb6e('0x3a')][_0xeb6e('0x41')](_0xeb6e('0x42'))){_0x420d1f[_0xeb6e('0x24')]=qs[_0xeb6e('0x24')](_0x287b1b[_0xeb6e('0x3a')]['limit']);_0x420d1f[_0xeb6e('0x26')]=qs[_0xeb6e('0x26')](_0x287b1b['query'][_0xeb6e('0x26')]);}_0x420d1f[_0xeb6e('0x43')]=qs[_0xeb6e('0x44')](_0x287b1b[_0xeb6e('0x3a')]['sort']);_0x420d1f['where']=qs[_0xeb6e('0x3c')](_[_0xeb6e('0x46')](_0x287b1b[_0xeb6e('0x3a')],_0x112325[_0xeb6e('0x3c')]));_0x420d1f[_0xeb6e('0x45')][_0xeb6e('0x62')]=_0x2484f3['id'];if(_0x287b1b[_0xeb6e('0x3a')][_0xeb6e('0x47')]){_0x420d1f[_0xeb6e('0x45')]=_[_0xeb6e('0x48')](_0x420d1f[_0xeb6e('0x45')],{'$or':_['map'](_0x420d1f['attributes'],function(_0x2b62b9){var _0xc054c0={};_0xc054c0[_0x2b62b9]={'$like':'%'+_0x287b1b[_0xeb6e('0x3a')][_0xeb6e('0x47')]+'%'};return _0xc054c0;})});}_0x420d1f=_[_0xeb6e('0x48')]({},_0x420d1f,_0x287b1b['options']);return db['UserOpenchannelQueue'][_0xeb6e('0x63')](_0x420d1f);}})[_0xeb6e('0x2c')](function(_0x2cc1cc){if(_0x2cc1cc){return db[_0xeb6e('0x64')][_0xeb6e('0x65')]({'where':{'id':_['map'](_0x2cc1cc,'UserId'),'role':_0xeb6e('0x66')},'attributes':['id',_0xeb6e('0x31'),_0xeb6e('0x67'),_0xeb6e('0x68'),_0xeb6e('0x69')]});}})[_0xeb6e('0x2c')](function(_0x10464c){if(_0x10464c){return{'count':_0x10464c['count'],'rows':_[_0xeb6e('0x39')](_0x10464c['rows'],function(_0x3f1016){return{'membername':_0x3f1016[_0xeb6e('0x31')],'UserId':_0x3f1016['id'],'queue_name':_0x23ea1e[_0xeb6e('0x31')],'OpenchannelQueueId':_0x23ea1e['id'],'interface':util[_0xeb6e('0x6a')]('%s/%s',_0xeb6e('0x6b'),_0x3f1016[_0xeb6e('0x31')]),'penalty':0x0,'paused':_0x3f1016[_0xeb6e('0x67')],'createdAt':_0x3f1016[_0xeb6e('0x69')],'updatedAt':_0x3f1016[_0xeb6e('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xeb6e('0x2c')](respondWithFilteredResult(_0x2bd3c6,_0x420d1f))[_0xeb6e('0x4f')](handleError(_0x2bd3c6,null));};exports[_0xeb6e('0x6c')]=function(_0x2b716c,_0xba460c,_0x74a8ca){var _0x2d71e2={};var _0x2b6b7e={};var _0x1f4384;var _0xae05eb;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2b716c[_0xeb6e('0x51')]['id']}})['then'](handleEntityNotFound(_0xba460c,null))[_0xeb6e('0x2c')](function(_0xf111a0){if(_0xf111a0){_0x1f4384=_0xf111a0;_0x2b6b7e[_0xeb6e('0x38')]=_['keys'](db['Team']['rawAttributes']);_0x2b6b7e['query']=_[_0xeb6e('0x3b')](_0x2b716c[_0xeb6e('0x3a')]);_0x2b6b7e[_0xeb6e('0x3c')]=_[_0xeb6e('0x3d')](_0x2b6b7e[_0xeb6e('0x38')],_0x2b6b7e['query']);_0x2d71e2[_0xeb6e('0x3e')]=_['intersection'](_0x2b6b7e[_0xeb6e('0x38')],qs[_0xeb6e('0x3f')](_0x2b716c['query'][_0xeb6e('0x3f')]));_0x2d71e2[_0xeb6e('0x3e')]=_0x2d71e2[_0xeb6e('0x3e')][_0xeb6e('0x40')]?_0x2d71e2['attributes']:_0x2b6b7e[_0xeb6e('0x38')];_0x2d71e2[_0xeb6e('0x43')]=qs[_0xeb6e('0x44')](_0x2b716c['query'][_0xeb6e('0x44')]);_0x2d71e2[_0xeb6e('0x45')]=qs[_0xeb6e('0x3c')](_[_0xeb6e('0x46')](_0x2b716c['query'],_0x2b6b7e['filters']));if(_0x2b716c[_0xeb6e('0x3a')][_0xeb6e('0x47')]){_0x2d71e2['where']=_['merge'](_0x2d71e2[_0xeb6e('0x45')],{'$or':_[_0xeb6e('0x39')](_0x2d71e2[_0xeb6e('0x3e')],function(_0x168fec){var _0x22db13={};_0x22db13[_0x168fec]={'$like':'%'+_0x2b716c['query'][_0xeb6e('0x47')]+'%'};return _0x22db13;})});}_0x2d71e2=_[_0xeb6e('0x48')]({},_0x2d71e2,_0x2b716c[_0xeb6e('0x4b')]);return _0x1f4384['getTeams'](_0x2d71e2);}})[_0xeb6e('0x2c')](function(_0x2eb2f8){if(_0x2eb2f8){_0xae05eb=_0x2eb2f8[_0xeb6e('0x40')];if(!_0x2b716c['query'][_0xeb6e('0x41')]('nolimit')){_0x2d71e2[_0xeb6e('0x24')]=qs['limit'](_0x2b716c[_0xeb6e('0x3a')][_0xeb6e('0x24')]);_0x2d71e2[_0xeb6e('0x26')]=qs[_0xeb6e('0x26')](_0x2b716c[_0xeb6e('0x3a')][_0xeb6e('0x26')]);}return _0x1f4384[_0xeb6e('0x6c')](_0x2d71e2);}})[_0xeb6e('0x2c')](function(_0x5811d3){if(_0x5811d3){return _0x5811d3?{'count':_0xae05eb,'rows':_0x5811d3}:null;}})[_0xeb6e('0x2c')](respondWithResult(_0xba460c,null))['catch'](handleError(_0xba460c,null));};exports['addTeams']=function(_0x544926,_0x56da12,_0x4b0cb2){var _0x2deaa7=_0x544926[_0xeb6e('0x54')][_0xeb6e('0x6d')];return db[_0xeb6e('0x6e')]['findAll']({'where':{'id':_0x2deaa7},'attributes':['id'],'include':[{'model':db[_0xeb6e('0x64')],'as':_0xeb6e('0x6f'),'attributes':['id',_0xeb6e('0x31'),'online','voicePause',_0xeb6e('0x70')],'raw':!![]}]})[_0xeb6e('0x2c')](function(_0x25bc92){if(_0x25bc92){var _0x1119a7=_[_0xeb6e('0x71')](_0x25bc92,function(_0x576b13){var _0x263b54=_0x576b13[_0xeb6e('0x56')]({'plain':!![]});return _0x263b54['Agents'];});return db['OpenchannelQueue'][_0xeb6e('0x52')]({'where':{'id':_0x544926[_0xeb6e('0x51')]['id']}})['then'](function(_0x1a8374){return db[_0xeb6e('0x72')]['transaction'](function(_0x4fd05f){return _0x1a8374['addTeams'](_0x2deaa7,{'transaction':_0x4fd05f})[_0xeb6e('0x2c')](function(){return BPromise[_0xeb6e('0x73')](_0x1119a7,function(_0x1a0829){return db[_0xeb6e('0x61')][_0xeb6e('0x74')]({'where':{'UserId':_0x1a0829['id'],'OpenchannelQueueId':_0x544926[_0xeb6e('0x51')]['id']},'transaction':_0x4fd05f});});})[_0xeb6e('0x2c')](function(){_0x1119a7[_0xeb6e('0x75')](function(_0xb7d6ec){socket[_0xeb6e('0x76')]('userOpenchannelQueue:save',{'UserId':_0xb7d6ec['id'],'OpenchannelQueueId':_0x1a8374['id']});});});});});}})[_0xeb6e('0x2c')](respondWithStatusCode(_0x56da12,null))[_0xeb6e('0x4f')](handleError(_0x56da12,null));};exports[_0xeb6e('0x77')]=function(_0xda68c,_0x343a6c,_0x27325e){return db[_0xeb6e('0x6e')][_0xeb6e('0x63')]({'where':{'id':_0xda68c[_0xeb6e('0x3a')][_0xeb6e('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xeb6e('0x64')],'as':_0xeb6e('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xeb6e('0x2c')](handleEntityNotFound(_0x343a6c,null))['then'](function(_0x8a47b5){var _0x3f06c0=_[_0xeb6e('0x39')](_0x8a47b5,'id');var _0x4e9177=[];var _0x90c2ae=[];var _0x47489d=squel['select']();_0x47489d[_0xeb6e('0x78')](_0xeb6e('0x79'))[_0xeb6e('0x7a')](_0xeb6e('0x7b'),'tq')[_0xeb6e('0x7c')](_0xeb6e('0x7d'),'ut',_0xeb6e('0x7e'))['where'](_0xeb6e('0x7f'),_0xda68c[_0xeb6e('0x51')]['id']);for(var _0x4b80b4=0x0;_0x4b80b4<_0x8a47b5[_0xeb6e('0x40')];_0x4b80b4+=0x1){let _0x196f57=_0x8a47b5[_0x4b80b4];for(var _0x42213f=0x0;_0x42213f<_0x196f57[_0xeb6e('0x6f')][_0xeb6e('0x40')];_0x42213f+=0x1){let _0x1d649c=_0x196f57['Agents'][_0x42213f];var _0x121c3f=_0x47489d[_0xeb6e('0x80')]();_0x121c3f['where'](_0xeb6e('0x81'),_0x1d649c['id']);_0x90c2ae['push'](db[_0xeb6e('0x72')][_0xeb6e('0x3a')](_0x121c3f['toString'](),{'type':db['sequelize'][_0xeb6e('0x82')][_0xeb6e('0x83')]})['then'](function(_0x2fb407){if(_0x2fb407[_0xeb6e('0x40')]===0x1){return _0x1d649c['id'];}else{var _0x4d359b=_[_0xeb6e('0x84')](_[_0xeb6e('0x39')](_0x2fb407,_0xeb6e('0x85')),function(_0x5c85e3){return _[_0xeb6e('0x86')](_0x3f06c0,_0x5c85e3);});if(_0x4d359b){return _0x1d649c['id'];}}}));}}return BPromise[_0xeb6e('0x87')](_0x90c2ae)[_0xeb6e('0x2c')](function(_0x3c0341){_0x4e9177=_(_0x4e9177)['union'](_0x3c0341)[_0xeb6e('0x88')]()[_0xeb6e('0x89')]();return db[_0xeb6e('0x34')][_0xeb6e('0x52')]({'where':{'id':_0xda68c[_0xeb6e('0x51')]['id']}})[_0xeb6e('0x2c')](function(_0x2828e3){return db[_0xeb6e('0x72')][_0xeb6e('0x8a')](function(_0x3fc9b2){return _0x2828e3[_0xeb6e('0x77')](_0xda68c[_0xeb6e('0x3a')]['ids'],{'transaction':_0x3fc9b2})['then'](function(){if(!_[_0xeb6e('0x8b')](_0x4e9177)){return _0x2828e3[_0xeb6e('0x8c')](_0x4e9177,{'transaction':_0x3fc9b2});}})[_0xeb6e('0x2c')](function(){_0x4e9177[_0xeb6e('0x75')](function(_0x56ae45){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x56ae45,'OpenchannelQueueId':_0x2828e3['id']});});});});});});})[_0xeb6e('0x2c')](respondWithStatusCode(_0x343a6c,null))[_0xeb6e('0x4f')](handleError(_0x343a6c,null));};exports[_0xeb6e('0x8d')]=function(_0x2d2351,_0x30de46,_0x382f5b){return db[_0xeb6e('0x34')][_0xeb6e('0x52')]({'where':{'id':_0x2d2351[_0xeb6e('0x51')]['id']}})[_0xeb6e('0x2c')](handleEntityNotFound(_0x30de46,null))[_0xeb6e('0x2c')](function(_0x3ec1b4){if(_0x3ec1b4){return _0x3ec1b4['addAgents'](_0x2d2351[_0xeb6e('0x54')][_0xeb6e('0x6d')],_['omit'](_0x2d2351['body'],[_0xeb6e('0x6d'),'id'])||{})[_0xeb6e('0x8e')](function(_0x34d6ed){for(var _0x436609=0x0;_0x436609<_0x2d2351[_0xeb6e('0x54')]['ids'][_0xeb6e('0x40')];_0x436609+=0x1){socket['emit'](_0xeb6e('0x8f'),{'UserId':Number(_0x2d2351['body'][_0xeb6e('0x6d')][_0x436609]),'OpenchannelQueueId':Number(_0x2d2351[_0xeb6e('0x51')]['id'])});}return _0x34d6ed;});}})['then'](respondWithResult(_0x30de46,null))['catch'](handleError(_0x30de46,null));};exports['removeAgents']=function(_0x2a557c,_0x271ea5,_0x1f8ead){return db['OpenchannelQueue']['find']({'where':{'id':_0x2a557c[_0xeb6e('0x51')]['id']}})[_0xeb6e('0x2c')](handleEntityNotFound(_0x271ea5,null))[_0xeb6e('0x2c')](function(_0x47f085){if(_0x47f085){return _0x47f085[_0xeb6e('0x8c')](_0x2a557c[_0xeb6e('0x3a')][_0xeb6e('0x6d')])[_0xeb6e('0x2c')](function(){if(_[_0xeb6e('0x90')](_0x2a557c[_0xeb6e('0x3a')][_0xeb6e('0x6d')])){for(var _0x58dcf3=0x0;_0x58dcf3<_0x2a557c[_0xeb6e('0x3a')][_0xeb6e('0x6d')][_0xeb6e('0x40')];_0x58dcf3+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x2a557c['query']['ids'][_0x58dcf3]),'OpenchannelQueueId':Number(_0x2a557c[_0xeb6e('0x51')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x2a557c[_0xeb6e('0x3a')][_0xeb6e('0x6d')]),'OpenchannelQueueId':Number(_0x2a557c[_0xeb6e('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x271ea5,null))[_0xeb6e('0x4f')](handleError(_0x271ea5,null));};exports[_0xeb6e('0x91')]=function(_0x4341ff,_0x432fdc,_0x5f003d){var _0x5e5e37={};var _0x379c99={};var _0x4aa59e;var _0x1ddbf1;return db[_0xeb6e('0x34')][_0xeb6e('0x60')]({'where':{'id':_0x4341ff[_0xeb6e('0x51')]['id']}})['then'](handleEntityNotFound(_0x432fdc,null))[_0xeb6e('0x2c')](function(_0x1a746d){if(_0x1a746d){_0x4aa59e=_0x1a746d;_0x379c99[_0xeb6e('0x38')]=_[_0xeb6e('0x3b')](db[_0xeb6e('0x64')][_0xeb6e('0x35')]);_0x379c99[_0xeb6e('0x3a')]=_[_0xeb6e('0x3b')](_0x4341ff[_0xeb6e('0x3a')]);_0x379c99[_0xeb6e('0x3c')]=_[_0xeb6e('0x3d')](_0x379c99[_0xeb6e('0x38')],_0x379c99[_0xeb6e('0x3a')]);_0x5e5e37[_0xeb6e('0x3e')]=_[_0xeb6e('0x3d')](_0x379c99[_0xeb6e('0x38')],qs[_0xeb6e('0x3f')](_0x4341ff[_0xeb6e('0x3a')][_0xeb6e('0x3f')]));_0x5e5e37['attributes']=_0x5e5e37[_0xeb6e('0x3e')][_0xeb6e('0x40')]?_0x5e5e37[_0xeb6e('0x3e')]:_0x379c99[_0xeb6e('0x38')];_0x5e5e37[_0xeb6e('0x43')]=qs['sort'](_0x4341ff[_0xeb6e('0x3a')][_0xeb6e('0x44')]);_0x5e5e37[_0xeb6e('0x45')]=qs[_0xeb6e('0x3c')](_[_0xeb6e('0x46')](_0x4341ff['query'],_0x379c99[_0xeb6e('0x3c')]));if(_0x4341ff[_0xeb6e('0x3a')][_0xeb6e('0x47')]){_0x5e5e37[_0xeb6e('0x45')]=_[_0xeb6e('0x48')](_0x5e5e37[_0xeb6e('0x45')],{'$or':_['map'](_0x5e5e37[_0xeb6e('0x3e')],function(_0x29d3d3){var _0x4cbde8={};_0x4cbde8[_0x29d3d3]={'$like':'%'+_0x4341ff[_0xeb6e('0x3a')][_0xeb6e('0x47')]+'%'};return _0x4cbde8;})});}_0x5e5e37=_['merge']({},_0x5e5e37,_0x4341ff[_0xeb6e('0x4b')]);return _0x4aa59e['getAgents'](_0x5e5e37);}})[_0xeb6e('0x2c')](function(_0x47d298){if(_0x47d298){_0x1ddbf1=_0x47d298[_0xeb6e('0x40')];if(!_0x4341ff['query'][_0xeb6e('0x41')](_0xeb6e('0x42'))){_0x5e5e37[_0xeb6e('0x24')]=qs[_0xeb6e('0x24')](_0x4341ff[_0xeb6e('0x3a')]['limit']);_0x5e5e37[_0xeb6e('0x26')]=qs[_0xeb6e('0x26')](_0x4341ff[_0xeb6e('0x3a')]['offset']);}return _0x4aa59e[_0xeb6e('0x91')](_0x5e5e37);}})['then'](function(_0x15770d){if(_0x15770d){return _0x15770d?{'count':_0x1ddbf1,'rows':_0x15770d}:null;}})['then'](respondWithResult(_0x432fdc,null))[_0xeb6e('0x4f')](handleError(_0x432fdc,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 4420260..d67b17b 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 _0x1eb4=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x1eb4,0xca));var _0x41eb=function(_0x1d9789,_0x102519){_0x1d9789=_0x1d9789-0x0;var _0x2fb74b=_0x1eb4[_0x1d9789];return _0x2fb74b;};'use strict';var EventEmitter=require(_0x41eb('0x0'));var OpenchannelQueue=require(_0x41eb('0x1'))['db'][_0x41eb('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x41eb('0x3')](0x0);var events={'afterCreate':_0x41eb('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x88ac82){return function(_0x1730b5,_0x398a84,_0x5da94b){OpenchannelQueueEvents[_0x41eb('0x5')](_0x88ac82+':'+_0x1730b5['id'],_0x1730b5);OpenchannelQueueEvents[_0x41eb('0x5')](_0x88ac82,_0x1730b5);_0x5da94b(null);};}for(var e in events){if(events[_0x41eb('0x6')](e)){var event=events[e];OpenchannelQueue[_0x41eb('0x7')](e,emitEvent(event));}}module[_0x41eb('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xc9d0=['update','emit','events','../../mysqldb','OpenchannelQueue','save'];(function(_0x51461b,_0x32ad42){var _0x1a66c4=function(_0x291777){while(--_0x291777){_0x51461b['push'](_0x51461b['shift']());}};_0x1a66c4(++_0x32ad42);}(_0xc9d0,0xda));var _0x0c9d=function(_0xb18b7f,_0x1c735b){_0xb18b7f=_0xb18b7f-0x0;var _0x51e2bd=_0xc9d0[_0xb18b7f];return _0x51e2bd;};'use strict';var EventEmitter=require(_0x0c9d('0x0'));var OpenchannelQueue=require(_0x0c9d('0x1'))['db'][_0x0c9d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0c9d('0x3'),'afterUpdate':_0x0c9d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f94d7){return function(_0x1c8dca,_0x4f58d5,_0x18efa0){OpenchannelQueueEvents[_0x0c9d('0x5')](_0x3f94d7+':'+_0x1c8dca['id'],_0x1c8dca);OpenchannelQueueEvents['emit'](_0x3f94d7,_0x1c8dca);_0x18efa0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 70ec1f9..8791e04 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 _0xd8fe=['openchannel_queues','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelQueue'];(function(_0x52ad93,_0x1422c1){var _0x7f4ff8=function(_0x593ddd){while(--_0x593ddd){_0x52ad93['push'](_0x52ad93['shift']());}};_0x7f4ff8(++_0x1422c1);}(_0xd8fe,0x155));var _0xed8f=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xd8fe[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xed8f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xed8f('0x1'));var BPromise=require(_0xed8f('0x2'));var rp=require(_0xed8f('0x3'));var fs=require('fs');var path=require(_0xed8f('0x4'));var rimraf=require(_0xed8f('0x5'));var config=require(_0xed8f('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xed8f('0x7')]=function(_0x501afb,_0xffc79){return _0x501afb['define'](_0xed8f('0x8'),attributes,{'tableName':_0xed8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf18d=['rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2ea6eb,_0x12f236){var _0x12c0b8=function(_0x552ebe){while(--_0x552ebe){_0x2ea6eb['push'](_0x2ea6eb['shift']());}};_0x12c0b8(++_0x12f236);}(_0xf18d,0x1bc));var _0xdf18=function(_0x1f1e89,_0x1b054a){_0x1f1e89=_0x1f1e89-0x0;var _0x3e1c99=_0xf18d[_0x1f1e89];return _0x3e1c99;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf18('0x0'))(_0xdf18('0x1'));var moment=require(_0xdf18('0x2'));var BPromise=require(_0xdf18('0x3'));var rp=require(_0xdf18('0x4'));var fs=require('fs');var path=require(_0xdf18('0x5'));var rimraf=require(_0xdf18('0x6'));var config=require(_0xdf18('0x7'));var attributes=require(_0xdf18('0x8'));module['exports']=function(_0x30b0fd,_0x3c49ba){return _0x30b0fd['define'](_0xdf18('0x9'),attributes,{'tableName':'openchannel_queues','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 6ec4cb8..9ffb530 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 _0xd230=['redis','defaults','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','model','attributes','map','catch','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd230,0xe5));var _0x0d23=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xd230[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x0d23('0x0'));var util=require(_0x0d23('0x1'));var moment=require(_0x0d23('0x2'));var BPromise=require(_0x0d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d23('0x4'));var db=require(_0x0d23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d23('0x6'))('rpc');var config=require(_0x0d23('0x7'));var jayson=require(_0x0d23('0x8'));var client=jayson[_0x0d23('0x9')][_0x0d23('0xa')]({'port':0x232a});config[_0x0d23('0xb')]=_[_0x0d23('0xc')](config[_0x0d23('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d23('0xb')]));require(_0x0d23('0xd'))[_0x0d23('0xe')](socket);function respondWithRpcPromise(_0x254264,_0x551e72,_0x44a92b){return new BPromise(function(_0x46eaa4,_0x59da92){return client[_0x0d23('0xf')](_0x254264,_0x44a92b)[_0x0d23('0x10')](function(_0x4edcb8){logger[_0x0d23('0x11')](_0x0d23('0x12'),_0x551e72,_0x0d23('0x13'));logger['debug'](_0x0d23('0x14'),_0x551e72,'request\x20sent',JSON[_0x0d23('0x15')](_0x4edcb8));if(_0x4edcb8['error']){if(_0x4edcb8[_0x0d23('0x16')][_0x0d23('0x17')]===0x1f4){logger[_0x0d23('0x16')](_0x0d23('0x12'),_0x551e72,_0x4edcb8[_0x0d23('0x16')][_0x0d23('0x18')]);return _0x59da92(_0x4edcb8[_0x0d23('0x16')][_0x0d23('0x18')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x551e72,_0x4edcb8[_0x0d23('0x16')]['message']);return _0x46eaa4(_0x4edcb8[_0x0d23('0x16')][_0x0d23('0x18')]);}else{logger[_0x0d23('0x11')](_0x0d23('0x12'),_0x551e72,_0x0d23('0x13'));_0x46eaa4(_0x4edcb8[_0x0d23('0x19')][_0x0d23('0x18')]);}})['catch'](function(_0x23347f){logger[_0x0d23('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x551e72,_0x23347f);_0x59da92(_0x23347f);});});}exports[_0x0d23('0x1a')]=function(_0x5d741b){var _0x5c9410=this;return new Promise(function(_0x2301c4,_0x4e7ecc){return db[_0x0d23('0x1b')][_0x0d23('0x1c')]({'raw':_0x5d741b[_0x0d23('0x1d')]?_0x5d741b[_0x0d23('0x1d')][_0x0d23('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d741b['options']?_0x5d741b[_0x0d23('0x1d')]['where']||null:null,'attributes':_0x5d741b[_0x0d23('0x1d')]?_0x5d741b[_0x0d23('0x1d')]['attributes']||null:null,'limit':_0x5d741b[_0x0d23('0x1d')]?_0x5d741b['options'][_0x0d23('0x1f')]||null:null,'include':_0x5d741b[_0x0d23('0x1d')]?_0x5d741b['options'][_0x0d23('0x20')]?_['map'](_0x5d741b[_0x0d23('0x1d')]['include'],function(_0x2b207d){return{'model':db[_0x2b207d['model']],'as':_0x2b207d['as'],'attributes':_0x2b207d['attributes'],'include':_0x2b207d['include']?_['map'](_0x2b207d[_0x0d23('0x20')],function(_0x5ccff5){return{'model':db[_0x5ccff5[_0x0d23('0x21')]],'as':_0x5ccff5['as'],'attributes':_0x5ccff5[_0x0d23('0x22')],'include':_0x5ccff5['include']?_[_0x0d23('0x23')](_0x5ccff5[_0x0d23('0x20')],function(_0x309ffb){return{'model':db[_0x309ffb[_0x0d23('0x21')]],'as':_0x309ffb['as'],'attributes':_0x309ffb[_0x0d23('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0d23('0x10')](function(_0x342864){logger[_0x0d23('0x11')]('GetOpenchannelQueue',_0x5d741b);logger['debug'](_0x0d23('0x1a'),_0x5d741b,JSON[_0x0d23('0x15')](_0x342864));_0x2301c4(_0x342864);})[_0x0d23('0x24')](function(_0x2725a5){logger['error'](_0x0d23('0x1a'),_0x2725a5[_0x0d23('0x18')],_0x5d741b);_0x4e7ecc(_0x5c9410[_0x0d23('0x16')](0x1f4,_0x2725a5[_0x0d23('0x18')]));});});};exports[_0x0d23('0x25')]=function(_0x30aa81){var _0x308c27=this;return new Promise(function(_0x43cb82,_0x31f127){return db[_0x0d23('0x1b')][_0x0d23('0x26')]({'raw':_0x30aa81['options']?_0x30aa81['options'][_0x0d23('0x1e')]===undefined?!![]:![]:!![],'where':_0x30aa81[_0x0d23('0x1d')]?_0x30aa81[_0x0d23('0x1d')][_0x0d23('0x27')]||null:null,'attributes':_0x30aa81[_0x0d23('0x1d')]?_0x30aa81[_0x0d23('0x1d')][_0x0d23('0x22')]||null:null,'include':_0x30aa81[_0x0d23('0x1d')]?_0x30aa81['options'][_0x0d23('0x20')]?_[_0x0d23('0x23')](_0x30aa81[_0x0d23('0x1d')][_0x0d23('0x20')],function(_0x59e5d2){return{'model':db[_0x59e5d2[_0x0d23('0x21')]],'as':_0x59e5d2['as'],'attributes':_0x59e5d2[_0x0d23('0x22')],'include':_0x59e5d2['include']?_[_0x0d23('0x23')](_0x59e5d2[_0x0d23('0x20')],function(_0x346fc3){return{'model':db[_0x346fc3[_0x0d23('0x21')]],'as':_0x346fc3['as'],'attributes':_0x346fc3[_0x0d23('0x22')],'include':_0x346fc3[_0x0d23('0x20')]?_[_0x0d23('0x23')](_0x346fc3[_0x0d23('0x20')],function(_0x1c4df9){return{'model':db[_0x1c4df9[_0x0d23('0x21')]],'as':_0x1c4df9['as'],'attributes':_0x1c4df9[_0x0d23('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0d23('0x10')](function(_0x13de58){logger['info'](_0x0d23('0x25'),_0x30aa81);logger['debug'](_0x0d23('0x25'),_0x30aa81,JSON['stringify'](_0x13de58));_0x43cb82(_0x13de58);})[_0x0d23('0x24')](function(_0x5c12ed){logger[_0x0d23('0x16')]('ShowOpenchannelQueue',_0x5c12ed['message'],_0x30aa81);_0x31f127(_0x308c27[_0x0d23('0x16')](0x1f4,_0x5c12ed[_0x0d23('0x18')]));});});}; \ No newline at end of file +var _0xda02=['options','raw','where','attributes','limit','include','map','model','then','ShowOpenchannelQueue','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll'];(function(_0x82505e,_0x5ab887){var _0x583bb8=function(_0x364a4a){while(--_0x364a4a){_0x82505e['push'](_0x82505e['shift']());}};_0x583bb8(++_0x5ab887);}(_0xda02,0x164));var _0x2da0=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0xda02[_0x29c3b2];return _0x4b3aa7;};'use strict';var _=require(_0x2da0('0x0'));var util=require(_0x2da0('0x1'));var moment=require(_0x2da0('0x2'));var BPromise=require(_0x2da0('0x3'));var rs=require(_0x2da0('0x4'));var fs=require('fs');var Redis=require(_0x2da0('0x5'));var db=require(_0x2da0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2da0('0x7'))(_0x2da0('0x8'));var config=require(_0x2da0('0x9'));var jayson=require(_0x2da0('0xa'));var client=jayson[_0x2da0('0xb')][_0x2da0('0xc')]({'port':0x232a});config[_0x2da0('0xd')]=_['defaults'](config[_0x2da0('0xd')],{'host':_0x2da0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2da0('0xd')]));require(_0x2da0('0xf'))[_0x2da0('0x10')](socket);function respondWithRpcPromise(_0x10689a,_0x457fc6,_0x42803b){return new BPromise(function(_0x84049e,_0x584e46){return client[_0x2da0('0x11')](_0x10689a,_0x42803b)['then'](function(_0x2e28e0){logger[_0x2da0('0x12')](_0x2da0('0x13'),_0x457fc6,_0x2da0('0x14'));logger[_0x2da0('0x15')](_0x2da0('0x16'),_0x457fc6,_0x2da0('0x14'),JSON['stringify'](_0x2e28e0));if(_0x2e28e0[_0x2da0('0x17')]){if(_0x2e28e0[_0x2da0('0x17')][_0x2da0('0x18')]===0x1f4){logger['error'](_0x2da0('0x13'),_0x457fc6,_0x2e28e0[_0x2da0('0x17')]['message']);return _0x584e46(_0x2e28e0[_0x2da0('0x17')][_0x2da0('0x19')]);}logger[_0x2da0('0x17')](_0x2da0('0x13'),_0x457fc6,_0x2e28e0[_0x2da0('0x17')][_0x2da0('0x19')]);return _0x84049e(_0x2e28e0[_0x2da0('0x17')][_0x2da0('0x19')]);}else{logger[_0x2da0('0x12')](_0x2da0('0x13'),_0x457fc6,_0x2da0('0x14'));_0x84049e(_0x2e28e0[_0x2da0('0x1a')][_0x2da0('0x19')]);}})[_0x2da0('0x1b')](function(_0x212f9b){logger['error'](_0x2da0('0x13'),_0x457fc6,_0x212f9b);_0x584e46(_0x212f9b);});});}exports[_0x2da0('0x1c')]=function(_0x1c1839){var _0x4e2cbc=this;return new Promise(function(_0x234a7d,_0x67f2b0){return db[_0x2da0('0x1d')][_0x2da0('0x1e')]({'raw':_0x1c1839[_0x2da0('0x1f')]?_0x1c1839[_0x2da0('0x1f')][_0x2da0('0x20')]===undefined?!![]:![]:!![],'where':_0x1c1839[_0x2da0('0x1f')]?_0x1c1839['options'][_0x2da0('0x21')]||null:null,'attributes':_0x1c1839[_0x2da0('0x1f')]?_0x1c1839[_0x2da0('0x1f')][_0x2da0('0x22')]||null:null,'limit':_0x1c1839[_0x2da0('0x1f')]?_0x1c1839[_0x2da0('0x1f')][_0x2da0('0x23')]||null:null,'include':_0x1c1839[_0x2da0('0x1f')]?_0x1c1839[_0x2da0('0x1f')][_0x2da0('0x24')]?_[_0x2da0('0x25')](_0x1c1839[_0x2da0('0x1f')][_0x2da0('0x24')],function(_0x4f4a5c){return{'model':db[_0x4f4a5c[_0x2da0('0x26')]],'as':_0x4f4a5c['as'],'attributes':_0x4f4a5c['attributes'],'include':_0x4f4a5c[_0x2da0('0x24')]?_[_0x2da0('0x25')](_0x4f4a5c[_0x2da0('0x24')],function(_0x2b8abc){return{'model':db[_0x2b8abc['model']],'as':_0x2b8abc['as'],'attributes':_0x2b8abc[_0x2da0('0x22')],'include':_0x2b8abc['include']?_[_0x2da0('0x25')](_0x2b8abc[_0x2da0('0x24')],function(_0xe4c5d0){return{'model':db[_0xe4c5d0[_0x2da0('0x26')]],'as':_0xe4c5d0['as'],'attributes':_0xe4c5d0[_0x2da0('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2da0('0x27')](function(_0xc4712b){logger['info'](_0x2da0('0x1c'),_0x1c1839);logger[_0x2da0('0x15')]('GetOpenchannelQueue',_0x1c1839,JSON['stringify'](_0xc4712b));_0x234a7d(_0xc4712b);})['catch'](function(_0x381a7a){logger[_0x2da0('0x17')](_0x2da0('0x1c'),_0x381a7a[_0x2da0('0x19')],_0x1c1839);_0x67f2b0(_0x4e2cbc[_0x2da0('0x17')](0x1f4,_0x381a7a[_0x2da0('0x19')]));});});};exports[_0x2da0('0x28')]=function(_0x18a88e){var _0x4911d4=this;return new Promise(function(_0x4bbb1e,_0x778b2a){return db[_0x2da0('0x1d')][_0x2da0('0x29')]({'raw':_0x18a88e[_0x2da0('0x1f')]?_0x18a88e[_0x2da0('0x1f')][_0x2da0('0x20')]===undefined?!![]:![]:!![],'where':_0x18a88e['options']?_0x18a88e[_0x2da0('0x1f')][_0x2da0('0x21')]||null:null,'attributes':_0x18a88e[_0x2da0('0x1f')]?_0x18a88e['options'][_0x2da0('0x22')]||null:null,'include':_0x18a88e[_0x2da0('0x1f')]?_0x18a88e[_0x2da0('0x1f')][_0x2da0('0x24')]?_[_0x2da0('0x25')](_0x18a88e['options'][_0x2da0('0x24')],function(_0x5a30bc){return{'model':db[_0x5a30bc['model']],'as':_0x5a30bc['as'],'attributes':_0x5a30bc['attributes'],'include':_0x5a30bc[_0x2da0('0x24')]?_[_0x2da0('0x25')](_0x5a30bc[_0x2da0('0x24')],function(_0x368ec4){return{'model':db[_0x368ec4[_0x2da0('0x26')]],'as':_0x368ec4['as'],'attributes':_0x368ec4[_0x2da0('0x22')],'include':_0x368ec4[_0x2da0('0x24')]?_[_0x2da0('0x25')](_0x368ec4[_0x2da0('0x24')],function(_0xf5697c){return{'model':db[_0xf5697c[_0x2da0('0x26')]],'as':_0xf5697c['as'],'attributes':_0xf5697c['attributes']};}):[]};}):[]};}):[]:[]})[_0x2da0('0x27')](function(_0x3d4137){logger[_0x2da0('0x12')](_0x2da0('0x28'),_0x18a88e);logger[_0x2da0('0x15')](_0x2da0('0x28'),_0x18a88e,JSON[_0x2da0('0x2a')](_0x3d4137));_0x4bbb1e(_0x3d4137);})[_0x2da0('0x1b')](function(_0x4aacb6){logger[_0x2da0('0x17')](_0x2da0('0x28'),_0x4aacb6['message'],_0x18a88e);_0x778b2a(_0x4911d4[_0x2da0('0x17')](0x1f4,_0x4aacb6[_0x2da0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e89c261..deccd48 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 _0xabf3=['remove','emit','removeListener','register','openchannelQueue:','save'];(function(_0x3b3179,_0xe4c588){var _0x381214=function(_0x22d3c5){while(--_0x22d3c5){_0x3b3179['push'](_0x3b3179['shift']());}};_0x381214(++_0xe4c588);}(_0xabf3,0x191));var _0x3abf=function(_0x1bd483,_0x5e2fd8){_0x1bd483=_0x1bd483-0x0;var _0x5a392a=_0xabf3[_0x1bd483];return _0x5a392a;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x3abf('0x0'),_0x3abf('0x1'),'update'];function createListener(_0x552c36,_0x3d7696){return function(_0x1b98f1){_0x3d7696[_0x3abf('0x2')](_0x552c36,_0x1b98f1);};}function removeListener(_0x4c7d82,_0x4a29de){return function(){OpenchannelQueueEvents[_0x3abf('0x3')](_0x4c7d82,_0x4a29de);};}exports[_0x3abf('0x4')]=function(_0x3eb062){for(var _0x3a4630=0x0,_0xb8fb93=events['length'];_0x3a4630<_0xb8fb93;_0x3a4630++){var _0x102d37=events[_0x3a4630];var _0x262e73=createListener(_0x3abf('0x5')+_0x102d37,_0x3eb062);OpenchannelQueueEvents['on'](_0x102d37,_0x262e73);}}; \ No newline at end of file +var _0x3555=['save','update','emit','removeListener','register','length'];(function(_0x43ffbc,_0x46471a){var _0x189f3e=function(_0x53295d){while(--_0x53295d){_0x43ffbc['push'](_0x43ffbc['shift']());}};_0x189f3e(++_0x46471a);}(_0x3555,0x1c8));var _0x5355=function(_0x13caf2,_0xe71d86){_0x13caf2=_0x13caf2-0x0;var _0x3f0b7c=_0x3555[_0x13caf2];return _0x3f0b7c;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x5355('0x0'),'remove',_0x5355('0x1')];function createListener(_0x5002c2,_0x4fdfd6){return function(_0x14b3ac){_0x4fdfd6[_0x5355('0x2')](_0x5002c2,_0x14b3ac);};}function removeListener(_0x4830a3,_0x490cd4){return function(){OpenchannelQueueEvents[_0x5355('0x3')](_0x4830a3,_0x490cd4);};}exports[_0x5355('0x4')]=function(_0x5cf780){for(var _0x166bce=0x0,_0x45ed41=events[_0x5355('0x5')];_0x166bce<_0x45ed41;_0x166bce++){var _0x11903c=events[_0x166bce];var _0x189c60=createListener('openchannelQueue:'+_0x11903c,_0x5cf780);OpenchannelQueueEvents['on'](_0x11903c,_0x189c60);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 782b80f..fb16875 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 _0x744d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','connect-timeout','Router'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0x744d,0x1ec));var _0xd744=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x744d[_0x59d0cc];return _0x2ae79f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd744('0x0'));var express=require('express');var router=express[_0xd744('0x1')]();var fs_extra=require(_0xd744('0x2'));var auth=require(_0xd744('0x3'));var interaction=require(_0xd744('0x4'));var config=require(_0xd744('0x5'));var controller=require(_0xd744('0x6'));router[_0xd744('0x7')]('/',auth[_0xd744('0x8')](),controller[_0xd744('0x9')]);router[_0xd744('0x7')](_0xd744('0xa'),auth['isAuthenticated'](),controller[_0xd744('0xb')]);router['get'](_0xd744('0xc'),auth[_0xd744('0x8')](),controller[_0xd744('0xd')]);router[_0xd744('0xe')]('/',auth[_0xd744('0x8')](),controller[_0xd744('0xf')]);router['put'](_0xd744('0xc'),auth[_0xd744('0x8')](),controller[_0xd744('0x10')]);router[_0xd744('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd744('0x12')]=router; \ No newline at end of file +var _0xcbc2=['/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xcbc2,0x193));var _0x2cbc=function(_0x4084fe,_0x19aad9){_0x4084fe=_0x4084fe-0x0;var _0x598649=_0xcbc2[_0x4084fe];return _0x598649;};'use strict';var multer=require(_0x2cbc('0x0'));var util=require(_0x2cbc('0x1'));var path=require('path');var timeout=require(_0x2cbc('0x2'));var express=require(_0x2cbc('0x3'));var router=express[_0x2cbc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2cbc('0x5'));var interaction=require(_0x2cbc('0x6'));var config=require(_0x2cbc('0x7'));var controller=require(_0x2cbc('0x8'));router[_0x2cbc('0x9')]('/',auth[_0x2cbc('0xa')](),controller['index']);router[_0x2cbc('0x9')](_0x2cbc('0xb'),auth[_0x2cbc('0xa')](),controller[_0x2cbc('0xc')]);router[_0x2cbc('0x9')]('/:id',auth[_0x2cbc('0xa')](),controller[_0x2cbc('0xd')]);router[_0x2cbc('0xe')]('/',auth[_0x2cbc('0xa')](),controller[_0x2cbc('0xf')]);router[_0x2cbc('0x10')](_0x2cbc('0x11'),auth[_0x2cbc('0xa')](),controller[_0x2cbc('0x12')]);router[_0x2cbc('0x13')](_0x2cbc('0x11'),auth['isAuthenticated'](),controller[_0x2cbc('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index b415e44..fdaa13c 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 _0x7bbe=['exports','STRING','DATE','moment','sequelize'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x7bbe,0x80));var _0xe7bb=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x7bbe[_0x349148];return _0x2f2b0f;};'use strict';var moment=require(_0xe7bb('0x0'));var Sequelize=require(_0xe7bb('0x1'));module[_0xe7bb('0x2')]={'uniqueid':{'type':Sequelize[_0xe7bb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe7bb('0x3')]},'joinAt':{'type':Sequelize[_0xe7bb('0x4')]},'leaveAt':{'type':Sequelize[_0xe7bb('0x4')]},'acceptAt':{'type':Sequelize[_0xe7bb('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe7bb('0x3')]}}; \ No newline at end of file +var _0x4840=['sequelize','exports','STRING','DATE','moment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x4840,0x6d));var _0x0484=function(_0x2be104,_0x4bf5d0){_0x2be104=_0x2be104-0x0;var _0x31c115=_0x4840[_0x2be104];return _0x31c115;};'use strict';var moment=require(_0x0484('0x0'));var Sequelize=require(_0x0484('0x1'));module[_0x0484('0x2')]={'uniqueid':{'type':Sequelize[_0x0484('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0484('0x3')]},'joinAt':{'type':Sequelize[_0x0484('0x4')]},'leaveAt':{'type':Sequelize[_0x0484('0x4')]},'acceptAt':{'type':Sequelize[_0x0484('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0484('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a2c5c10..fb39c4c 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 _0xfd45=['rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','OpenchannelQueueReport'];(function(_0x476df5,_0x2dbbd6){var _0x41d2b7=function(_0x3f1b60){while(--_0x3f1b60){_0x476df5['push'](_0x476df5['shift']());}};_0x41d2b7(++_0x2dbbd6);}(_0xfd45,0xfa));var _0x5fd4=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xfd45[_0x42bc91];return _0x3f5507;};'use strict';var emlformat=require(_0x5fd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5fd4('0x1'));var jsonpatch=require(_0x5fd4('0x2'));var rp=require(_0x5fd4('0x3'));var moment=require('moment');var BPromise=require(_0x5fd4('0x4'));var Mustache=require(_0x5fd4('0x5'));var util=require(_0x5fd4('0x6'));var path=require(_0x5fd4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5fd4('0x8'));var fs=require('fs');var fs_extra=require(_0x5fd4('0x9'));var _=require(_0x5fd4('0xa'));var squel=require(_0x5fd4('0xb'));var crypto=require(_0x5fd4('0xc'));var jsforce=require(_0x5fd4('0xd'));var deskjs=require(_0x5fd4('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5fd4('0xf'));var Redis=require(_0x5fd4('0x10'));var authService=require(_0x5fd4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fd4('0x12'))(_0x5fd4('0x13'));var utils=require(_0x5fd4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5fd4('0x15'))['db'];function respondWithStatusCode(_0x210bb3,_0x4f8d8c){_0x4f8d8c=_0x4f8d8c||0xcc;return function(_0x2a198d){if(_0x2a198d){return _0x210bb3[_0x5fd4('0x16')](_0x4f8d8c);}return _0x210bb3[_0x5fd4('0x17')](_0x4f8d8c)[_0x5fd4('0x18')]();};}function respondWithResult(_0x260d14,_0x57139f){_0x57139f=_0x57139f||0xc8;return function(_0x516184){if(_0x516184){return _0x260d14['status'](_0x57139f)[_0x5fd4('0x19')](_0x516184);}};}function respondWithFilteredResult(_0x285e59,_0x30b002){return function(_0x571621){if(_0x571621){var _0x254782=typeof _0x30b002[_0x5fd4('0x1a')]===_0x5fd4('0x1b')&&typeof _0x30b002[_0x5fd4('0x1c')]===_0x5fd4('0x1b');var _0x137619=_0x571621[_0x5fd4('0x1d')];var _0x138e5f=_0x254782?0x0:_0x30b002[_0x5fd4('0x1a')];var _0x26c360=_0x254782?_0x571621[_0x5fd4('0x1d')]:_0x30b002[_0x5fd4('0x1a')]+_0x30b002[_0x5fd4('0x1c')];var _0x642c8f;if(_0x26c360>=_0x137619){_0x26c360=_0x137619;_0x642c8f=0xc8;}else{_0x642c8f=0xce;}_0x285e59[_0x5fd4('0x17')](_0x642c8f);return _0x285e59[_0x5fd4('0x1e')](_0x5fd4('0x1f'),_0x138e5f+'-'+_0x26c360+'/'+_0x137619)['json'](_0x571621);}return null;};}function patchUpdates(_0x140604){return function(_0x450d1d){try{jsonpatch[_0x5fd4('0x20')](_0x450d1d,_0x140604,!![]);}catch(_0x159db6){return BPromise[_0x5fd4('0x21')](_0x159db6);}return _0x450d1d[_0x5fd4('0x22')]();};}function saveUpdates(_0x35039b,_0x283d2a){return function(_0x3a3e2){if(_0x3a3e2){return _0x3a3e2[_0x5fd4('0x23')](_0x35039b)[_0x5fd4('0x24')](function(_0x7f7e2f){return _0x7f7e2f;});}return null;};}function removeEntity(_0x95d936,_0x5c050e){return function(_0x2bee31){if(_0x2bee31){return _0x2bee31[_0x5fd4('0x25')]()['then'](function(){_0x95d936[_0x5fd4('0x17')](0xcc)[_0x5fd4('0x18')]();});}};}function handleEntityNotFound(_0x4bc024,_0x17f680){return function(_0x1b13f0){if(!_0x1b13f0){_0x4bc024['sendStatus'](0x194);}return _0x1b13f0;};}function handleError(_0x2720f2,_0x3a73ea){_0x3a73ea=_0x3a73ea||0x1f4;return function(_0xceed9c){logger[_0x5fd4('0x26')](_0xceed9c['stack']);if(_0xceed9c[_0x5fd4('0x27')]){delete _0xceed9c[_0x5fd4('0x27')];}_0x2720f2[_0x5fd4('0x17')](_0x3a73ea)['send'](_0xceed9c);};}exports['index']=function(_0x45cb97,_0x42aff2){var _0x9b0f7a={},_0x1e7ba1={},_0x15fcbc={'count':0x0,'rows':[]};var _0x4ca672=_[_0x5fd4('0x28')](db[_0x5fd4('0x29')][_0x5fd4('0x2a')],function(_0x21522c){return{'name':_0x21522c['fieldName'],'type':_0x21522c['type']['key']};});_0x1e7ba1[_0x5fd4('0x2b')]=_[_0x5fd4('0x28')](_0x4ca672,_0x5fd4('0x27'));_0x1e7ba1['query']=_[_0x5fd4('0x2c')](_0x45cb97[_0x5fd4('0x2d')]);_0x1e7ba1['filters']=_['intersection'](_0x1e7ba1[_0x5fd4('0x2b')],_0x1e7ba1['query']);_0x9b0f7a['attributes']=_[_0x5fd4('0x2e')](_0x1e7ba1['model'],qs[_0x5fd4('0x2f')](_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x2f')]));_0x9b0f7a['attributes']=_0x9b0f7a[_0x5fd4('0x30')]['length']?_0x9b0f7a[_0x5fd4('0x30')]:_0x1e7ba1[_0x5fd4('0x2b')];if(!_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x31')](_0x5fd4('0x32'))){_0x9b0f7a['limit']=qs[_0x5fd4('0x1c')](_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x1c')]);_0x9b0f7a['offset']=qs[_0x5fd4('0x1a')](_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x1a')]);}_0x9b0f7a[_0x5fd4('0x33')]=qs['sort'](_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x34')]);_0x9b0f7a[_0x5fd4('0x35')]=qs[_0x5fd4('0x36')](_[_0x5fd4('0x37')](_0x45cb97['query'],_0x1e7ba1[_0x5fd4('0x36')]),_0x4ca672);if(_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x38')]){_0x9b0f7a[_0x5fd4('0x35')]=_['merge'](_0x9b0f7a[_0x5fd4('0x35')],{'$or':_['map'](_0x4ca672,function(_0x46ff2d){if(_0x46ff2d[_0x5fd4('0x39')]!==_0x5fd4('0x3a')){var _0x3f3a9a={};_0x3f3a9a[_0x46ff2d[_0x5fd4('0x27')]]={'$like':'%'+_0x45cb97['query'][_0x5fd4('0x38')]+'%'};return _0x3f3a9a;}})});}_0x9b0f7a=_[_0x5fd4('0x3b')]({},_0x9b0f7a,_0x45cb97[_0x5fd4('0x3c')]);var _0xf18652={'where':_0x9b0f7a[_0x5fd4('0x35')]};return db['OpenchannelQueueReport']['count'](_0xf18652)[_0x5fd4('0x24')](function(_0x40e089){_0x15fcbc[_0x5fd4('0x1d')]=_0x40e089;if(_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x3d')]){_0x9b0f7a['include']=[{'all':!![]}];}return db[_0x5fd4('0x29')][_0x5fd4('0x3e')](_0x9b0f7a);})[_0x5fd4('0x24')](function(_0x4ed745){_0x15fcbc[_0x5fd4('0x3f')]=_0x4ed745;return _0x15fcbc;})[_0x5fd4('0x24')](respondWithFilteredResult(_0x42aff2,_0x9b0f7a))[_0x5fd4('0x40')](handleError(_0x42aff2,null));};exports[_0x5fd4('0x41')]=function(_0x3df0ef,_0x1a2185){var _0x589b57={'raw':!![],'where':{'id':_0x3df0ef[_0x5fd4('0x42')]['id']}},_0x362de9={};_0x362de9[_0x5fd4('0x2b')]=_[_0x5fd4('0x2c')](db[_0x5fd4('0x29')][_0x5fd4('0x2a')]);_0x362de9[_0x5fd4('0x2d')]=_['keys'](_0x3df0ef[_0x5fd4('0x2d')]);_0x362de9[_0x5fd4('0x36')]=_['intersection'](_0x362de9[_0x5fd4('0x2b')],_0x362de9[_0x5fd4('0x2d')]);_0x589b57[_0x5fd4('0x30')]=_[_0x5fd4('0x2e')](_0x362de9['model'],qs[_0x5fd4('0x2f')](_0x3df0ef[_0x5fd4('0x2d')][_0x5fd4('0x2f')]));_0x589b57[_0x5fd4('0x30')]=_0x589b57[_0x5fd4('0x30')][_0x5fd4('0x43')]?_0x589b57[_0x5fd4('0x30')]:_0x362de9['model'];if(_0x3df0ef[_0x5fd4('0x2d')]['includeAll']){_0x589b57[_0x5fd4('0x44')]=[{'all':!![]}];}_0x589b57=_[_0x5fd4('0x3b')]({},_0x589b57,_0x3df0ef['options']);return db[_0x5fd4('0x29')][_0x5fd4('0x45')](_0x589b57)[_0x5fd4('0x24')](handleEntityNotFound(_0x1a2185,null))[_0x5fd4('0x24')](respondWithResult(_0x1a2185,null))[_0x5fd4('0x40')](handleError(_0x1a2185,null));};exports[_0x5fd4('0x46')]=function(_0x56ce8e,_0x817dd1){return db[_0x5fd4('0x29')][_0x5fd4('0x46')](_0x56ce8e[_0x5fd4('0x47')],{})[_0x5fd4('0x24')](respondWithResult(_0x817dd1,0xc9))[_0x5fd4('0x40')](handleError(_0x817dd1,null));};exports['update']=function(_0x5729e0,_0x140051){if(_0x5729e0['body']['id']){delete _0x5729e0[_0x5fd4('0x47')]['id'];}return db[_0x5fd4('0x29')]['find']({'where':{'id':_0x5729e0[_0x5fd4('0x42')]['id']}})[_0x5fd4('0x24')](handleEntityNotFound(_0x140051,null))['then'](saveUpdates(_0x5729e0[_0x5fd4('0x47')],null))[_0x5fd4('0x24')](respondWithResult(_0x140051,null))[_0x5fd4('0x40')](handleError(_0x140051,null));};exports[_0x5fd4('0x25')]=function(_0x2cb414,_0x59c62d){return db['OpenchannelQueueReport'][_0x5fd4('0x45')]({'where':{'id':_0x2cb414['params']['id']}})['then'](handleEntityNotFound(_0x59c62d,null))[_0x5fd4('0x24')](removeEntity(_0x59c62d,null))[_0x5fd4('0x40')](handleError(_0x59c62d,null));};exports[_0x5fd4('0x48')]=function(_0x3862ed,_0x2ee7d3){return db[_0x5fd4('0x29')][_0x5fd4('0x48')]()['then'](respondWithResult(_0x2ee7d3,null))[_0x5fd4('0x40')](handleError(_0x2ee7d3,null));}; \ No newline at end of file +var _0x7d5f=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','fieldName','key','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','OpenchannelQueueReport','count','findAll','rows','catch','keys','rawAttributes','includeAll','include','options','create','body','find','params','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','querystring','papaparse'];(function(_0x5a99f1,_0x2b58da){var _0x5e0103=function(_0x145672){while(--_0x145672){_0x5a99f1['push'](_0x5a99f1['shift']());}};_0x5e0103(++_0x2b58da);}(_0x7d5f,0x113));var _0xf7d5=function(_0x403816,_0x22888c){_0x403816=_0x403816-0x0;var _0x521bae=_0x7d5f[_0x403816];return _0x521bae;};'use strict';var emlformat=require(_0xf7d5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7d5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7d5('0x2'));var moment=require(_0xf7d5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf7d5('0x4'));var util=require(_0xf7d5('0x5'));var path=require(_0xf7d5('0x6'));var sox=require(_0xf7d5('0x7'));var csv=require(_0xf7d5('0x8'));var ejs=require(_0xf7d5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf7d5('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf7d5('0x8'));var querystring=require(_0xf7d5('0xb'));var Papa=require(_0xf7d5('0xc'));var Redis=require('ioredis');var authService=require(_0xf7d5('0xd'));var qs=require(_0xf7d5('0xe'));var as=require(_0xf7d5('0xf'));var hardwareService=require(_0xf7d5('0x10'));var logger=require(_0xf7d5('0x11'))(_0xf7d5('0x12'));var utils=require(_0xf7d5('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf7d5('0x14'))['db'];function respondWithStatusCode(_0xa396cc,_0x41ce59){_0x41ce59=_0x41ce59||0xcc;return function(_0x380dc5){if(_0x380dc5){return _0xa396cc[_0xf7d5('0x15')](_0x41ce59);}return _0xa396cc['status'](_0x41ce59)[_0xf7d5('0x16')]();};}function respondWithResult(_0x158934,_0x9fb870){_0x9fb870=_0x9fb870||0xc8;return function(_0x48c7c6){if(_0x48c7c6){return _0x158934[_0xf7d5('0x17')](_0x9fb870)[_0xf7d5('0x18')](_0x48c7c6);}};}function respondWithFilteredResult(_0x3e9d04,_0x2b75b7){return function(_0x192cb9){if(_0x192cb9){var _0xe817a3=typeof _0x2b75b7[_0xf7d5('0x19')]===_0xf7d5('0x1a')&&typeof _0x2b75b7[_0xf7d5('0x1b')]===_0xf7d5('0x1a');var _0x15d22a=_0x192cb9['count'];var _0x505500=_0xe817a3?0x0:_0x2b75b7[_0xf7d5('0x19')];var _0x21964b=_0xe817a3?_0x192cb9['count']:_0x2b75b7[_0xf7d5('0x19')]+_0x2b75b7['limit'];var _0x29ac73;if(_0x21964b>=_0x15d22a){_0x21964b=_0x15d22a;_0x29ac73=0xc8;}else{_0x29ac73=0xce;}_0x3e9d04[_0xf7d5('0x17')](_0x29ac73);return _0x3e9d04['set'](_0xf7d5('0x1c'),_0x505500+'-'+_0x21964b+'/'+_0x15d22a)[_0xf7d5('0x18')](_0x192cb9);}return null;};}function patchUpdates(_0x55bc07){return function(_0x1a3f9d){try{jsonpatch[_0xf7d5('0x1d')](_0x1a3f9d,_0x55bc07,!![]);}catch(_0x29f6aa){return BPromise[_0xf7d5('0x1e')](_0x29f6aa);}return _0x1a3f9d[_0xf7d5('0x1f')]();};}function saveUpdates(_0xefb94d,_0x24640f){return function(_0x2a170f){if(_0x2a170f){return _0x2a170f[_0xf7d5('0x20')](_0xefb94d)['then'](function(_0x5b7f14){return _0x5b7f14;});}return null;};}function removeEntity(_0x5bf09a,_0x2e61b0){return function(_0x2cd6e7){if(_0x2cd6e7){return _0x2cd6e7[_0xf7d5('0x21')]()[_0xf7d5('0x22')](function(){_0x5bf09a[_0xf7d5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c96c4,_0x4db945){return function(_0x17c493){if(!_0x17c493){_0x1c96c4[_0xf7d5('0x15')](0x194);}return _0x17c493;};}function handleError(_0x3ec581,_0x18eb44){_0x18eb44=_0x18eb44||0x1f4;return function(_0x455242){logger[_0xf7d5('0x23')](_0x455242[_0xf7d5('0x24')]);if(_0x455242[_0xf7d5('0x25')]){delete _0x455242[_0xf7d5('0x25')];}_0x3ec581[_0xf7d5('0x17')](_0x18eb44)['send'](_0x455242);};}exports[_0xf7d5('0x26')]=function(_0x1a0cc7,_0x1d62c6){var _0x23cf4e={},_0x1e6b9e={},_0x4da7d5={'count':0x0,'rows':[]};var _0x47be8f=_[_0xf7d5('0x27')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x13d8a8){return{'name':_0x13d8a8[_0xf7d5('0x28')],'type':_0x13d8a8['type'][_0xf7d5('0x29')]};});_0x1e6b9e[_0xf7d5('0x2a')]=_['map'](_0x47be8f,_0xf7d5('0x25'));_0x1e6b9e[_0xf7d5('0x2b')]=_['keys'](_0x1a0cc7[_0xf7d5('0x2b')]);_0x1e6b9e['filters']=_[_0xf7d5('0x2c')](_0x1e6b9e[_0xf7d5('0x2a')],_0x1e6b9e[_0xf7d5('0x2b')]);_0x23cf4e['attributes']=_[_0xf7d5('0x2c')](_0x1e6b9e[_0xf7d5('0x2a')],qs[_0xf7d5('0x2d')](_0x1a0cc7['query'][_0xf7d5('0x2d')]));_0x23cf4e[_0xf7d5('0x2e')]=_0x23cf4e[_0xf7d5('0x2e')][_0xf7d5('0x2f')]?_0x23cf4e[_0xf7d5('0x2e')]:_0x1e6b9e[_0xf7d5('0x2a')];if(!_0x1a0cc7[_0xf7d5('0x2b')]['hasOwnProperty']('nolimit')){_0x23cf4e[_0xf7d5('0x1b')]=qs[_0xf7d5('0x1b')](_0x1a0cc7[_0xf7d5('0x2b')][_0xf7d5('0x1b')]);_0x23cf4e['offset']=qs[_0xf7d5('0x19')](_0x1a0cc7[_0xf7d5('0x2b')]['offset']);}_0x23cf4e[_0xf7d5('0x30')]=qs[_0xf7d5('0x31')](_0x1a0cc7['query'][_0xf7d5('0x31')]);_0x23cf4e[_0xf7d5('0x32')]=qs[_0xf7d5('0x33')](_[_0xf7d5('0x34')](_0x1a0cc7[_0xf7d5('0x2b')],_0x1e6b9e[_0xf7d5('0x33')]),_0x47be8f);if(_0x1a0cc7[_0xf7d5('0x2b')][_0xf7d5('0x35')]){_0x23cf4e['where']=_['merge'](_0x23cf4e[_0xf7d5('0x32')],{'$or':_[_0xf7d5('0x27')](_0x47be8f,function(_0x36414c){if(_0x36414c[_0xf7d5('0x36')]!==_0xf7d5('0x37')){var _0x24c58e={};_0x24c58e[_0x36414c[_0xf7d5('0x25')]]={'$like':'%'+_0x1a0cc7[_0xf7d5('0x2b')][_0xf7d5('0x35')]+'%'};return _0x24c58e;}})});}_0x23cf4e=_[_0xf7d5('0x38')]({},_0x23cf4e,_0x1a0cc7['options']);var _0x2a06fc={'where':_0x23cf4e[_0xf7d5('0x32')]};return db[_0xf7d5('0x39')][_0xf7d5('0x3a')](_0x2a06fc)['then'](function(_0x1795bd){_0x4da7d5['count']=_0x1795bd;if(_0x1a0cc7['query']['includeAll']){_0x23cf4e['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xf7d5('0x3b')](_0x23cf4e);})[_0xf7d5('0x22')](function(_0x25d77){_0x4da7d5[_0xf7d5('0x3c')]=_0x25d77;return _0x4da7d5;})[_0xf7d5('0x22')](respondWithFilteredResult(_0x1d62c6,_0x23cf4e))[_0xf7d5('0x3d')](handleError(_0x1d62c6,null));};exports['show']=function(_0x17428f,_0x34930f){var _0x3dda5d={'raw':!![],'where':{'id':_0x17428f['params']['id']}},_0x1fd360={};_0x1fd360[_0xf7d5('0x2a')]=_[_0xf7d5('0x3e')](db['OpenchannelQueueReport'][_0xf7d5('0x3f')]);_0x1fd360['query']=_[_0xf7d5('0x3e')](_0x17428f[_0xf7d5('0x2b')]);_0x1fd360[_0xf7d5('0x33')]=_[_0xf7d5('0x2c')](_0x1fd360['model'],_0x1fd360['query']);_0x3dda5d[_0xf7d5('0x2e')]=_[_0xf7d5('0x2c')](_0x1fd360[_0xf7d5('0x2a')],qs['fields'](_0x17428f[_0xf7d5('0x2b')][_0xf7d5('0x2d')]));_0x3dda5d[_0xf7d5('0x2e')]=_0x3dda5d[_0xf7d5('0x2e')][_0xf7d5('0x2f')]?_0x3dda5d['attributes']:_0x1fd360[_0xf7d5('0x2a')];if(_0x17428f[_0xf7d5('0x2b')][_0xf7d5('0x40')]){_0x3dda5d[_0xf7d5('0x41')]=[{'all':!![]}];}_0x3dda5d=_['merge']({},_0x3dda5d,_0x17428f[_0xf7d5('0x42')]);return db[_0xf7d5('0x39')]['find'](_0x3dda5d)[_0xf7d5('0x22')](handleEntityNotFound(_0x34930f,null))[_0xf7d5('0x22')](respondWithResult(_0x34930f,null))[_0xf7d5('0x3d')](handleError(_0x34930f,null));};exports[_0xf7d5('0x43')]=function(_0x4e2af1,_0x1e77a2){return db[_0xf7d5('0x39')][_0xf7d5('0x43')](_0x4e2af1[_0xf7d5('0x44')],{})[_0xf7d5('0x22')](respondWithResult(_0x1e77a2,0xc9))[_0xf7d5('0x3d')](handleError(_0x1e77a2,null));};exports[_0xf7d5('0x20')]=function(_0x45f69b,_0x5a0872){if(_0x45f69b[_0xf7d5('0x44')]['id']){delete _0x45f69b[_0xf7d5('0x44')]['id'];}return db['OpenchannelQueueReport'][_0xf7d5('0x45')]({'where':{'id':_0x45f69b[_0xf7d5('0x46')]['id']}})[_0xf7d5('0x22')](handleEntityNotFound(_0x5a0872,null))[_0xf7d5('0x22')](saveUpdates(_0x45f69b[_0xf7d5('0x44')],null))[_0xf7d5('0x22')](respondWithResult(_0x5a0872,null))[_0xf7d5('0x3d')](handleError(_0x5a0872,null));};exports[_0xf7d5('0x21')]=function(_0x4c5fd4,_0x3a2955){return db[_0xf7d5('0x39')][_0xf7d5('0x45')]({'where':{'id':_0x4c5fd4['params']['id']}})[_0xf7d5('0x22')](handleEntityNotFound(_0x3a2955,null))['then'](removeEntity(_0x3a2955,null))['catch'](handleError(_0x3a2955,null));};exports[_0xf7d5('0x47')]=function(_0x14130c,_0x43e26c){return db['OpenchannelQueueReport'][_0xf7d5('0x47')]()['then'](respondWithResult(_0x43e26c,null))[_0xf7d5('0x3d')](handleError(_0x43e26c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 2df400d..c3a5da2 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2fd01a,_0x165883){var _0x45ef25=function(_0x403b9c){while(--_0x403b9c){_0x2fd01a['push'](_0x2fd01a['shift']());}};_0x45ef25(++_0x165883);}(_0x1261,0x144));var _0x1126=function(_0xcd9ece,_0x33ff67){_0xcd9ece=_0xcd9ece-0x0;var _0x36f54f=_0x1261[_0xcd9ece];return _0x36f54f;};'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 +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x23dde1,_0x1a8bfe){var _0x449c02=function(_0x1de433){while(--_0x1de433){_0x23dde1['push'](_0x23dde1['shift']());}};_0x449c02(++_0x1a8bfe);}(_0x326f,0xd1));var _0xf326=function(_0x36e9dc,_0x1b5de2){_0x36e9dc=_0x36e9dc-0x0;var _0x27a2b9=_0x326f[_0x36e9dc];return _0x27a2b9;};'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/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 9e55b01..c573cfa 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 _0x49f8=['client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','then','stringify','update','raw','where','limit','UpdateOpenchannelQueueReport','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x177821,_0xd5f511){var _0xa515ec=function(_0x37a196){while(--_0x37a196){_0x177821['push'](_0x177821['shift']());}};_0xa515ec(++_0xd5f511);}(_0x49f8,0xff));var _0x849f=function(_0x57d160,_0x381043){_0x57d160=_0x57d160-0x0;var _0x30c242=_0x49f8[_0x57d160];return _0x30c242;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});}exports[_0x849f('0x12')]=function(_0x20bea7){var _0x189529=this;return new Promise(function(_0x541cd6,_0x1e4017){return db[_0x849f('0x13')]['create'](_0x20bea7[_0x849f('0x14')],{'raw':_0x20bea7[_0x849f('0x15')]?_0x20bea7['options']['raw']===undefined?!![]:![]:!![]})[_0x849f('0x16')](function(_0x11d183){logger[_0x849f('0x8')](_0x849f('0x12'),_0x20bea7);logger[_0x849f('0xb')](_0x849f('0x12'),_0x20bea7,JSON[_0x849f('0x17')](_0x11d183));_0x541cd6(_0x11d183);})[_0x849f('0x11')](function(_0x4b29f1){logger[_0x849f('0xd')](_0x849f('0x12'),_0x4b29f1[_0x849f('0xf')],_0x20bea7);_0x1e4017(_0x189529[_0x849f('0xd')](0x1f4,_0x4b29f1[_0x849f('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3a5724){var _0x32be69=this;return new Promise(function(_0x15a41c,_0xe404c6){return db[_0x849f('0x13')][_0x849f('0x18')](_0x3a5724[_0x849f('0x14')],{'raw':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1a')]||null:null,'attributes':_0x3a5724['options']?_0x3a5724[_0x849f('0x15')]['attributes']||null:null,'limit':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1b')]||null:null})[_0x849f('0x16')](function(_0xf0e21f){logger[_0x849f('0x8')]('UpdateOpenchannelQueueReport',_0x3a5724);logger[_0x849f('0xb')](_0x849f('0x1c'),_0x3a5724,JSON[_0x849f('0x17')](_0xf0e21f));_0x15a41c(_0xf0e21f);})['catch'](function(_0x347c93){logger['error'](_0x849f('0x1c'),_0x347c93[_0x849f('0xf')],_0x3a5724);_0xe404c6(_0x32be69[_0x849f('0xd')](0x1f4,_0x347c93[_0x849f('0xf')]));});});}; \ No newline at end of file +var _0xfff0=['../../config/environment','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','update','where','attributes','limit','info','UpdateOpenchannelQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x75aebf,_0xb132d7){var _0x148756=function(_0x561864){while(--_0x561864){_0x75aebf['push'](_0x75aebf['shift']());}};_0x148756(++_0xb132d7);}(_0xfff0,0x139));var _0x0fff=function(_0xa8e23d,_0x5d80dc){_0xa8e23d=_0xa8e23d-0x0;var _0x582bb7=_0xfff0[_0xa8e23d];return _0x582bb7;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});}exports['CreateOpenchannelQueueReport']=function(_0x48f36d){var _0x2337f=this;return new Promise(function(_0x606792,_0x46a02d){return db[_0x0fff('0x14')][_0x0fff('0x15')](_0x48f36d[_0x0fff('0x16')],{'raw':_0x48f36d['options']?_0x48f36d[_0x0fff('0x17')][_0x0fff('0x18')]===undefined?!![]:![]:!![]})[_0x0fff('0xa')](function(_0x49d211){logger['info'](_0x0fff('0x19'),_0x48f36d);logger[_0x0fff('0xd')](_0x0fff('0x19'),_0x48f36d,JSON[_0x0fff('0xf')](_0x49d211));_0x606792(_0x49d211);})['catch'](function(_0x155132){logger[_0x0fff('0x10')](_0x0fff('0x19'),_0x155132[_0x0fff('0x12')],_0x48f36d);_0x46a02d(_0x2337f[_0x0fff('0x10')](0x1f4,_0x155132[_0x0fff('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x6a116c){var _0x29f702=this;return new Promise(function(_0x37e090,_0x24cd18){return db[_0x0fff('0x14')][_0x0fff('0x1a')](_0x6a116c['body'],{'raw':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1b')]||null:null,'attributes':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1c')]||null:null,'limit':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1d')]||null:null})['then'](function(_0x7046a3){logger[_0x0fff('0x1e')](_0x0fff('0x1f'),_0x6a116c);logger[_0x0fff('0xd')](_0x0fff('0x1f'),_0x6a116c,JSON[_0x0fff('0xf')](_0x7046a3));_0x37e090(_0x7046a3);})['catch'](function(_0x31f9a4){logger[_0x0fff('0x10')](_0x0fff('0x1f'),_0x31f9a4['message'],_0x6a116c);_0x24cd18(_0x29f702[_0x0fff('0x10')](0x1f4,_0x31f9a4[_0x0fff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8ebd300..7223e45 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 _0xe660=['/describe','describe','/:id','show','create','put','destroy','exports','multer','connect-timeout','express','fs-extra','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated'];(function(_0x5de9ab,_0x2b4175){var _0x5ee8e0=function(_0x58677b){while(--_0x58677b){_0x5de9ab['push'](_0x5de9ab['shift']());}};_0x5ee8e0(++_0x2b4175);}(_0xe660,0x68));var _0x0e66=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0xe660[_0x4d0df6];return _0x4e2615;};'use strict';var multer=require(_0x0e66('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0e66('0x1'));var express=require(_0x0e66('0x2'));var router=express['Router']();var fs_extra=require(_0x0e66('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e66('0x4'));var controller=require(_0x0e66('0x5'));router[_0x0e66('0x6')]('/',auth[_0x0e66('0x7')](),controller['index']);router[_0x0e66('0x6')](_0x0e66('0x8'),auth['isAuthenticated'](),controller[_0x0e66('0x9')]);router[_0x0e66('0x6')](_0x0e66('0xa'),auth[_0x0e66('0x7')](),controller[_0x0e66('0xb')]);router['post']('/',auth[_0x0e66('0x7')](),controller[_0x0e66('0xc')]);router[_0x0e66('0xd')](_0x0e66('0xa'),auth[_0x0e66('0x7')](),controller['update']);router['delete'](_0x0e66('0xa'),auth[_0x0e66('0x7')](),controller[_0x0e66('0xe')]);module[_0x0e66('0xf')]=router; \ No newline at end of file +var _0x3ab7=['put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x3d8a9c,_0x4501fe){var _0x4f0e1c=function(_0x534984){while(--_0x534984){_0x3d8a9c['push'](_0x3d8a9c['shift']());}};_0x4f0e1c(++_0x4501fe);}(_0x3ab7,0x193));var _0x73ab=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x3ab7[_0x3c59fc];return _0x2b78d4;};'use strict';var multer=require(_0x73ab('0x0'));var util=require(_0x73ab('0x1'));var path=require(_0x73ab('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x73ab('0x3')]();var fs_extra=require(_0x73ab('0x4'));var auth=require(_0x73ab('0x5'));var interaction=require(_0x73ab('0x6'));var config=require(_0x73ab('0x7'));var controller=require(_0x73ab('0x8'));router[_0x73ab('0x9')]('/',auth['isAuthenticated'](),controller[_0x73ab('0xa')]);router['get'](_0x73ab('0xb'),auth[_0x73ab('0xc')](),controller[_0x73ab('0xd')]);router[_0x73ab('0x9')](_0x73ab('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x73ab('0xf')]('/',auth[_0x73ab('0xc')](),controller[_0x73ab('0x10')]);router[_0x73ab('0x11')](_0x73ab('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x73ab('0x12')](_0x73ab('0xe'),auth['isAuthenticated'](),controller[_0x73ab('0x13')]);module[_0x73ab('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 360cbab..668193e 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3bc787,_0x3ab660){var _0x1a5e12=function(_0xd9962f){while(--_0xd9962f){_0x3bc787['push'](_0x3bc787['shift']());}};_0x1a5e12(++_0x3ab660);}(_0x70e0,0x17b));var _0x070e=function(_0x4431f2,_0x29cc8b){_0x4431f2=_0x4431f2-0x0;var _0x522dc1=_0x70e0[_0x4431f2];return _0x522dc1;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4c0d61,_0x10dd9e){var _0x9e37b1=function(_0x25afd5){while(--_0x25afd5){_0x4c0d61['push'](_0x4c0d61['shift']());}};_0x9e37b1(++_0x10dd9e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index ad6ad49..47f1628 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 _0x6ba3=['offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','OpenchannelTransferReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x4e8c6a,_0x3b2d9c){var _0x3487c3=function(_0x566da2){while(--_0x566da2){_0x4e8c6a['push'](_0x4e8c6a['shift']());}};_0x3487c3(++_0x3b2d9c);}(_0x6ba3,0x186));var _0x36ba=function(_0x79a6e8,_0x1c2b24){_0x79a6e8=_0x79a6e8-0x0;var _0xeeb993=_0x6ba3[_0x79a6e8];return _0xeeb993;};'use strict';var emlformat=require(_0x36ba('0x0'));var rimraf=require(_0x36ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36ba('0x2'));var rp=require(_0x36ba('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x36ba('0x4'));var util=require(_0x36ba('0x5'));var path=require(_0x36ba('0x6'));var sox=require(_0x36ba('0x7'));var csv=require(_0x36ba('0x8'));var ejs=require(_0x36ba('0x9'));var fs=require('fs');var fs_extra=require(_0x36ba('0xa'));var _=require(_0x36ba('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x36ba('0x8'));var querystring=require(_0x36ba('0xc'));var Papa=require('papaparse');var Redis=require(_0x36ba('0xd'));var authService=require(_0x36ba('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x36ba('0xf'));var hardwareService=require(_0x36ba('0x10'));var logger=require(_0x36ba('0x11'))('api');var utils=require(_0x36ba('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x36ba('0x13'));var db=require(_0x36ba('0x14'))['db'];function respondWithStatusCode(_0x277d5c,_0x20c7be){_0x20c7be=_0x20c7be||0xcc;return function(_0x9fd972){if(_0x9fd972){return _0x277d5c[_0x36ba('0x15')](_0x20c7be);}return _0x277d5c[_0x36ba('0x16')](_0x20c7be)['end']();};}function respondWithResult(_0x2dc33f,_0x29a916){_0x29a916=_0x29a916||0xc8;return function(_0xf33f55){if(_0xf33f55){return _0x2dc33f[_0x36ba('0x16')](_0x29a916)[_0x36ba('0x17')](_0xf33f55);}};}function respondWithFilteredResult(_0x101ce2,_0x2febea){return function(_0x4b36a4){if(_0x4b36a4){var _0x43433e=typeof _0x2febea[_0x36ba('0x18')]===_0x36ba('0x19')&&typeof _0x2febea[_0x36ba('0x1a')]==='undefined';var _0x27c716=_0x4b36a4[_0x36ba('0x1b')];var _0x1946e1=_0x43433e?0x0:_0x2febea[_0x36ba('0x18')];var _0x3cc1f4=_0x43433e?_0x4b36a4[_0x36ba('0x1b')]:_0x2febea[_0x36ba('0x18')]+_0x2febea[_0x36ba('0x1a')];var _0x1fb14f;if(_0x3cc1f4>=_0x27c716){_0x3cc1f4=_0x27c716;_0x1fb14f=0xc8;}else{_0x1fb14f=0xce;}_0x101ce2[_0x36ba('0x16')](_0x1fb14f);return _0x101ce2[_0x36ba('0x1c')](_0x36ba('0x1d'),_0x1946e1+'-'+_0x3cc1f4+'/'+_0x27c716)[_0x36ba('0x17')](_0x4b36a4);}return null;};}function patchUpdates(_0x54c146){return function(_0x11af61){try{jsonpatch[_0x36ba('0x1e')](_0x11af61,_0x54c146,!![]);}catch(_0x582970){return BPromise[_0x36ba('0x1f')](_0x582970);}return _0x11af61['save']();};}function saveUpdates(_0x597e97,_0xe79aa5){return function(_0x34e5b9){if(_0x34e5b9){return _0x34e5b9[_0x36ba('0x20')](_0x597e97)[_0x36ba('0x21')](function(_0x5e8ba7){return _0x5e8ba7;});}return null;};}function removeEntity(_0x4d07f6,_0x48b6cb){return function(_0x2c36f5){if(_0x2c36f5){return _0x2c36f5[_0x36ba('0x22')]()['then'](function(){_0x4d07f6[_0x36ba('0x16')](0xcc)[_0x36ba('0x23')]();});}};}function handleEntityNotFound(_0x58e30f,_0x107cdd){return function(_0x1d6ccc){if(!_0x1d6ccc){_0x58e30f[_0x36ba('0x15')](0x194);}return _0x1d6ccc;};}function handleError(_0xc6d575,_0x37a06e){_0x37a06e=_0x37a06e||0x1f4;return function(_0xdf9608){logger[_0x36ba('0x24')](_0xdf9608[_0x36ba('0x25')]);if(_0xdf9608[_0x36ba('0x26')]){delete _0xdf9608[_0x36ba('0x26')];}_0xc6d575[_0x36ba('0x16')](_0x37a06e)['send'](_0xdf9608);};}exports[_0x36ba('0x27')]=function(_0x21ae70,_0x4da718){var _0x101940={},_0x4a243f={},_0x23ab61={'count':0x0,'rows':[]};var _0x5ba045=_[_0x36ba('0x28')](db[_0x36ba('0x29')]['rawAttributes'],function(_0x31a0a1){return{'name':_0x31a0a1['fieldName'],'type':_0x31a0a1[_0x36ba('0x2a')][_0x36ba('0x2b')]};});_0x4a243f[_0x36ba('0x2c')]=_[_0x36ba('0x28')](_0x5ba045,'name');_0x4a243f[_0x36ba('0x2d')]=_[_0x36ba('0x2e')](_0x21ae70[_0x36ba('0x2d')]);_0x4a243f[_0x36ba('0x2f')]=_[_0x36ba('0x30')](_0x4a243f['model'],_0x4a243f['query']);_0x101940[_0x36ba('0x31')]=_[_0x36ba('0x30')](_0x4a243f[_0x36ba('0x2c')],qs[_0x36ba('0x32')](_0x21ae70['query'][_0x36ba('0x32')]));_0x101940[_0x36ba('0x31')]=_0x101940['attributes'][_0x36ba('0x33')]?_0x101940[_0x36ba('0x31')]:_0x4a243f['model'];if(!_0x21ae70[_0x36ba('0x2d')]['hasOwnProperty'](_0x36ba('0x34'))){_0x101940[_0x36ba('0x1a')]=qs[_0x36ba('0x1a')](_0x21ae70[_0x36ba('0x2d')][_0x36ba('0x1a')]);_0x101940[_0x36ba('0x18')]=qs[_0x36ba('0x18')](_0x21ae70['query']['offset']);}_0x101940[_0x36ba('0x35')]=qs[_0x36ba('0x36')](_0x21ae70[_0x36ba('0x2d')][_0x36ba('0x36')]);_0x101940['where']=qs[_0x36ba('0x2f')](_[_0x36ba('0x37')](_0x21ae70['query'],_0x4a243f[_0x36ba('0x2f')]),_0x5ba045);if(_0x21ae70['query'][_0x36ba('0x38')]){_0x101940[_0x36ba('0x39')]=_[_0x36ba('0x3a')](_0x101940['where'],{'$or':_[_0x36ba('0x28')](_0x5ba045,function(_0x2a2620){if(_0x2a2620[_0x36ba('0x2a')]!=='VIRTUAL'){var _0x5bfdc7={};_0x5bfdc7[_0x2a2620[_0x36ba('0x26')]]={'$like':'%'+_0x21ae70[_0x36ba('0x2d')][_0x36ba('0x38')]+'%'};return _0x5bfdc7;}})});}_0x101940=_['merge']({},_0x101940,_0x21ae70[_0x36ba('0x3b')]);var _0x4d8f65={'where':_0x101940[_0x36ba('0x39')]};return db[_0x36ba('0x29')]['count'](_0x4d8f65)[_0x36ba('0x21')](function(_0x36ed35){_0x23ab61['count']=_0x36ed35;if(_0x21ae70[_0x36ba('0x2d')][_0x36ba('0x3c')]){_0x101940[_0x36ba('0x3d')]=[{'all':!![]}];}return db[_0x36ba('0x29')]['findAll'](_0x101940);})['then'](function(_0x3a1f3a){_0x23ab61[_0x36ba('0x3e')]=_0x3a1f3a;return _0x23ab61;})['then'](respondWithFilteredResult(_0x4da718,_0x101940))[_0x36ba('0x3f')](handleError(_0x4da718,null));};exports[_0x36ba('0x40')]=function(_0x46850a,_0x47d578){var _0x326330={'raw':!![],'where':{'id':_0x46850a[_0x36ba('0x41')]['id']}},_0xd48d68={};_0xd48d68[_0x36ba('0x2c')]=_['keys'](db['OpenchannelTransferReport']['rawAttributes']);_0xd48d68['query']=_['keys'](_0x46850a[_0x36ba('0x2d')]);_0xd48d68['filters']=_[_0x36ba('0x30')](_0xd48d68[_0x36ba('0x2c')],_0xd48d68[_0x36ba('0x2d')]);_0x326330[_0x36ba('0x31')]=_[_0x36ba('0x30')](_0xd48d68[_0x36ba('0x2c')],qs[_0x36ba('0x32')](_0x46850a[_0x36ba('0x2d')][_0x36ba('0x32')]));_0x326330['attributes']=_0x326330[_0x36ba('0x31')][_0x36ba('0x33')]?_0x326330[_0x36ba('0x31')]:_0xd48d68[_0x36ba('0x2c')];if(_0x46850a['query']['includeAll']){_0x326330[_0x36ba('0x3d')]=[{'all':!![]}];}_0x326330=_[_0x36ba('0x3a')]({},_0x326330,_0x46850a[_0x36ba('0x3b')]);return db[_0x36ba('0x29')][_0x36ba('0x42')](_0x326330)[_0x36ba('0x21')](handleEntityNotFound(_0x47d578,null))[_0x36ba('0x21')](respondWithResult(_0x47d578,null))[_0x36ba('0x3f')](handleError(_0x47d578,null));};exports[_0x36ba('0x43')]=function(_0x14d35a,_0x114084){return db[_0x36ba('0x29')][_0x36ba('0x43')](_0x14d35a[_0x36ba('0x44')],{})[_0x36ba('0x21')](respondWithResult(_0x114084,0xc9))[_0x36ba('0x3f')](handleError(_0x114084,null));};exports[_0x36ba('0x20')]=function(_0x5e5367,_0x3bba9d){if(_0x5e5367['body']['id']){delete _0x5e5367[_0x36ba('0x44')]['id'];}return db[_0x36ba('0x29')]['find']({'where':{'id':_0x5e5367['params']['id']}})[_0x36ba('0x21')](handleEntityNotFound(_0x3bba9d,null))['then'](saveUpdates(_0x5e5367[_0x36ba('0x44')],null))[_0x36ba('0x21')](respondWithResult(_0x3bba9d,null))[_0x36ba('0x3f')](handleError(_0x3bba9d,null));};exports[_0x36ba('0x22')]=function(_0x4d32c0,_0x2502b7){return db['OpenchannelTransferReport'][_0x36ba('0x42')]({'where':{'id':_0x4d32c0[_0x36ba('0x41')]['id']}})['then'](handleEntityNotFound(_0x2502b7,null))['then'](removeEntity(_0x2502b7,null))[_0x36ba('0x3f')](handleError(_0x2502b7,null));};exports['describe']=function(_0x31a0bc,_0x199740){return db[_0x36ba('0x29')]['describe']()['then'](respondWithResult(_0x199740,null))[_0x36ba('0x3f')](handleError(_0x199740,null));}; \ No newline at end of file +var _0x2b8b=['pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','catch','create','body','find','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5f0a83,_0x210523){var _0x46f182=function(_0x5109e7){while(--_0x5109e7){_0x5f0a83['push'](_0x5f0a83['shift']());}};_0x46f182(++_0x210523);}(_0x2b8b,0x1c0));var _0xb2b8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2b8b[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xb2b8('0x0'));var rimraf=require(_0xb2b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb2b8('0x2'));var BPromise=require(_0xb2b8('0x3'));var Mustache=require('mustache');var util=require(_0xb2b8('0x4'));var path=require(_0xb2b8('0x5'));var sox=require(_0xb2b8('0x6'));var csv=require(_0xb2b8('0x7'));var ejs=require(_0xb2b8('0x8'));var fs=require('fs');var fs_extra=require(_0xb2b8('0x9'));var _=require(_0xb2b8('0xa'));var squel=require(_0xb2b8('0xb'));var crypto=require(_0xb2b8('0xc'));var jsforce=require(_0xb2b8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb2b8('0x7'));var querystring=require(_0xb2b8('0xe'));var Papa=require('papaparse');var Redis=require(_0xb2b8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb2b8('0x10'));var as=require(_0xb2b8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb2b8('0x12'));var utils=require(_0xb2b8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb2b8('0x14'));var db=require(_0xb2b8('0x15'))['db'];function respondWithStatusCode(_0x4a8627,_0x2807bb){_0x2807bb=_0x2807bb||0xcc;return function(_0x2a95fe){if(_0x2a95fe){return _0x4a8627['sendStatus'](_0x2807bb);}return _0x4a8627[_0xb2b8('0x16')](_0x2807bb)[_0xb2b8('0x17')]();};}function respondWithResult(_0x29433b,_0x56f7e9){_0x56f7e9=_0x56f7e9||0xc8;return function(_0x21e4e3){if(_0x21e4e3){return _0x29433b['status'](_0x56f7e9)[_0xb2b8('0x18')](_0x21e4e3);}};}function respondWithFilteredResult(_0x5dac07,_0x34a137){return function(_0x5905cd){if(_0x5905cd){var _0x320c50=typeof _0x34a137['offset']===_0xb2b8('0x19')&&typeof _0x34a137[_0xb2b8('0x1a')]==='undefined';var _0x330349=_0x5905cd[_0xb2b8('0x1b')];var _0x444b4d=_0x320c50?0x0:_0x34a137[_0xb2b8('0x1c')];var _0x1812f9=_0x320c50?_0x5905cd['count']:_0x34a137[_0xb2b8('0x1c')]+_0x34a137['limit'];var _0x463867;if(_0x1812f9>=_0x330349){_0x1812f9=_0x330349;_0x463867=0xc8;}else{_0x463867=0xce;}_0x5dac07['status'](_0x463867);return _0x5dac07['set'](_0xb2b8('0x1d'),_0x444b4d+'-'+_0x1812f9+'/'+_0x330349)[_0xb2b8('0x18')](_0x5905cd);}return null;};}function patchUpdates(_0x187927){return function(_0x4b9fc7){try{jsonpatch[_0xb2b8('0x1e')](_0x4b9fc7,_0x187927,!![]);}catch(_0x4617d0){return BPromise[_0xb2b8('0x1f')](_0x4617d0);}return _0x4b9fc7[_0xb2b8('0x20')]();};}function saveUpdates(_0x56ddc8,_0x31171a){return function(_0x41ac95){if(_0x41ac95){return _0x41ac95[_0xb2b8('0x21')](_0x56ddc8)[_0xb2b8('0x22')](function(_0x4b8c7a){return _0x4b8c7a;});}return null;};}function removeEntity(_0x171aaf,_0x165328){return function(_0x3b732f){if(_0x3b732f){return _0x3b732f['destroy']()['then'](function(){_0x171aaf['status'](0xcc)[_0xb2b8('0x17')]();});}};}function handleEntityNotFound(_0x5e7ba9,_0x1e69e2){return function(_0x2f8a4b){if(!_0x2f8a4b){_0x5e7ba9['sendStatus'](0x194);}return _0x2f8a4b;};}function handleError(_0x32d2d6,_0x4305b3){_0x4305b3=_0x4305b3||0x1f4;return function(_0x461640){logger[_0xb2b8('0x23')](_0x461640[_0xb2b8('0x24')]);if(_0x461640[_0xb2b8('0x25')]){delete _0x461640['name'];}_0x32d2d6[_0xb2b8('0x16')](_0x4305b3)[_0xb2b8('0x26')](_0x461640);};}exports['index']=function(_0x147738,_0x37f7cd){var _0x5d59a2={},_0x51829e={},_0x343622={'count':0x0,'rows':[]};var _0x5d0565=_[_0xb2b8('0x27')](db[_0xb2b8('0x28')][_0xb2b8('0x29')],function(_0x2b17c9){return{'name':_0x2b17c9['fieldName'],'type':_0x2b17c9[_0xb2b8('0x2a')][_0xb2b8('0x2b')]};});_0x51829e[_0xb2b8('0x2c')]=_[_0xb2b8('0x27')](_0x5d0565,_0xb2b8('0x25'));_0x51829e['query']=_['keys'](_0x147738[_0xb2b8('0x2d')]);_0x51829e[_0xb2b8('0x2e')]=_['intersection'](_0x51829e[_0xb2b8('0x2c')],_0x51829e[_0xb2b8('0x2d')]);_0x5d59a2[_0xb2b8('0x2f')]=_[_0xb2b8('0x30')](_0x51829e[_0xb2b8('0x2c')],qs[_0xb2b8('0x31')](_0x147738['query'][_0xb2b8('0x31')]));_0x5d59a2[_0xb2b8('0x2f')]=_0x5d59a2[_0xb2b8('0x2f')][_0xb2b8('0x32')]?_0x5d59a2[_0xb2b8('0x2f')]:_0x51829e[_0xb2b8('0x2c')];if(!_0x147738['query'][_0xb2b8('0x33')](_0xb2b8('0x34'))){_0x5d59a2[_0xb2b8('0x1a')]=qs['limit'](_0x147738[_0xb2b8('0x2d')][_0xb2b8('0x1a')]);_0x5d59a2[_0xb2b8('0x1c')]=qs[_0xb2b8('0x1c')](_0x147738['query'][_0xb2b8('0x1c')]);}_0x5d59a2[_0xb2b8('0x35')]=qs[_0xb2b8('0x36')](_0x147738[_0xb2b8('0x2d')][_0xb2b8('0x36')]);_0x5d59a2[_0xb2b8('0x37')]=qs[_0xb2b8('0x2e')](_[_0xb2b8('0x38')](_0x147738[_0xb2b8('0x2d')],_0x51829e[_0xb2b8('0x2e')]),_0x5d0565);if(_0x147738[_0xb2b8('0x2d')][_0xb2b8('0x39')]){_0x5d59a2[_0xb2b8('0x37')]=_[_0xb2b8('0x3a')](_0x5d59a2['where'],{'$or':_[_0xb2b8('0x27')](_0x5d0565,function(_0x1791d1){if(_0x1791d1['type']!==_0xb2b8('0x3b')){var _0x8446fe={};_0x8446fe[_0x1791d1[_0xb2b8('0x25')]]={'$like':'%'+_0x147738[_0xb2b8('0x2d')][_0xb2b8('0x39')]+'%'};return _0x8446fe;}})});}_0x5d59a2=_['merge']({},_0x5d59a2,_0x147738['options']);var _0x35ebac={'where':_0x5d59a2[_0xb2b8('0x37')]};return db[_0xb2b8('0x28')][_0xb2b8('0x1b')](_0x35ebac)['then'](function(_0x4b879b){_0x343622[_0xb2b8('0x1b')]=_0x4b879b;if(_0x147738[_0xb2b8('0x2d')][_0xb2b8('0x3c')]){_0x5d59a2[_0xb2b8('0x3d')]=[{'all':!![]}];}return db[_0xb2b8('0x28')][_0xb2b8('0x3e')](_0x5d59a2);})[_0xb2b8('0x22')](function(_0x197c48){_0x343622[_0xb2b8('0x3f')]=_0x197c48;return _0x343622;})[_0xb2b8('0x22')](respondWithFilteredResult(_0x37f7cd,_0x5d59a2))['catch'](handleError(_0x37f7cd,null));};exports['show']=function(_0x2475cb,_0xa8ca51){var _0x47a2c0={'raw':!![],'where':{'id':_0x2475cb[_0xb2b8('0x40')]['id']}},_0x3bbb28={};_0x3bbb28[_0xb2b8('0x2c')]=_['keys'](db['OpenchannelTransferReport'][_0xb2b8('0x29')]);_0x3bbb28[_0xb2b8('0x2d')]=_[_0xb2b8('0x41')](_0x2475cb[_0xb2b8('0x2d')]);_0x3bbb28['filters']=_['intersection'](_0x3bbb28['model'],_0x3bbb28[_0xb2b8('0x2d')]);_0x47a2c0['attributes']=_[_0xb2b8('0x30')](_0x3bbb28[_0xb2b8('0x2c')],qs[_0xb2b8('0x31')](_0x2475cb[_0xb2b8('0x2d')][_0xb2b8('0x31')]));_0x47a2c0[_0xb2b8('0x2f')]=_0x47a2c0[_0xb2b8('0x2f')][_0xb2b8('0x32')]?_0x47a2c0[_0xb2b8('0x2f')]:_0x3bbb28[_0xb2b8('0x2c')];if(_0x2475cb[_0xb2b8('0x2d')]['includeAll']){_0x47a2c0[_0xb2b8('0x3d')]=[{'all':!![]}];}_0x47a2c0=_[_0xb2b8('0x3a')]({},_0x47a2c0,_0x2475cb['options']);return db[_0xb2b8('0x28')]['find'](_0x47a2c0)[_0xb2b8('0x22')](handleEntityNotFound(_0xa8ca51,null))[_0xb2b8('0x22')](respondWithResult(_0xa8ca51,null))[_0xb2b8('0x42')](handleError(_0xa8ca51,null));};exports[_0xb2b8('0x43')]=function(_0x352edf,_0x3876a7){return db[_0xb2b8('0x28')]['create'](_0x352edf[_0xb2b8('0x44')],{})[_0xb2b8('0x22')](respondWithResult(_0x3876a7,0xc9))['catch'](handleError(_0x3876a7,null));};exports[_0xb2b8('0x21')]=function(_0xa7a542,_0x9caa14){if(_0xa7a542[_0xb2b8('0x44')]['id']){delete _0xa7a542[_0xb2b8('0x44')]['id'];}return db[_0xb2b8('0x28')][_0xb2b8('0x45')]({'where':{'id':_0xa7a542[_0xb2b8('0x40')]['id']}})[_0xb2b8('0x22')](handleEntityNotFound(_0x9caa14,null))[_0xb2b8('0x22')](saveUpdates(_0xa7a542[_0xb2b8('0x44')],null))[_0xb2b8('0x22')](respondWithResult(_0x9caa14,null))[_0xb2b8('0x42')](handleError(_0x9caa14,null));};exports[_0xb2b8('0x46')]=function(_0x14f68c,_0x498812){return db['OpenchannelTransferReport'][_0xb2b8('0x45')]({'where':{'id':_0x14f68c['params']['id']}})[_0xb2b8('0x22')](handleEntityNotFound(_0x498812,null))[_0xb2b8('0x22')](removeEntity(_0x498812,null))[_0xb2b8('0x42')](handleError(_0x498812,null));};exports[_0xb2b8('0x47')]=function(_0x37fd27,_0x1b0ba0){return db[_0xb2b8('0x28')][_0xb2b8('0x47')]()[_0xb2b8('0x22')](respondWithResult(_0x1b0ba0,null))[_0xb2b8('0x42')](handleError(_0x1b0ba0,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 8c02bf7..aaa509a 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 _0xfb9a=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','report_openchannel_transfer','uniqueid','util','api','moment'];(function(_0x819632,_0x5c4ab5){var _0x4c72b5=function(_0x40b60b){while(--_0x40b60b){_0x819632['push'](_0x819632['shift']());}};_0x4c72b5(++_0x5c4ab5);}(_0xfb9a,0x1dd));var _0xafb9=function(_0x17d2e5,_0x304a6c){_0x17d2e5=_0x17d2e5-0x0;var _0x312641=_0xfb9a[_0x17d2e5];return _0x312641;};'use strict';var _=require('lodash');var util=require(_0xafb9('0x0'));var logger=require('../../config/logger')(_0xafb9('0x1'));var moment=require(_0xafb9('0x2'));var BPromise=require(_0xafb9('0x3'));var rp=require(_0xafb9('0x4'));var fs=require('fs');var path=require(_0xafb9('0x5'));var rimraf=require(_0xafb9('0x6'));var config=require(_0xafb9('0x7'));var attributes=require(_0xafb9('0x8'));module['exports']=function(_0x39f625,_0xa057f9){return _0x39f625[_0xafb9('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0xafb9('0xa'),'paranoid':![],'indexes':[{'name':_0xafb9('0xb'),'fields':[_0xafb9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x186b=['rimraf','../../config/environment','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0x186b,0x14f));var _0xb186=function(_0xf1603b,_0x257c11){_0xf1603b=_0xf1603b-0x0;var _0x298fab=_0x186b[_0xf1603b];return _0x298fab;};'use strict';var _=require(_0xb186('0x0'));var util=require(_0xb186('0x1'));var logger=require(_0xb186('0x2'))(_0xb186('0x3'));var moment=require('moment');var BPromise=require(_0xb186('0x4'));var rp=require(_0xb186('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb186('0x6'));var config=require(_0xb186('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x5aaba4,_0x4b7dfd){return _0x5aaba4[_0xb186('0x8')](_0xb186('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xb186('0xa'),'fields':[_0xb186('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 1caaa31..1e0e51e 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 _0x1c3b=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x2cb860,_0x2ab949){var _0x35c787=function(_0x21c895){while(--_0x21c895){_0x2cb860['push'](_0x2cb860['shift']());}};_0x35c787(++_0x2ab949);}(_0x1c3b,0xab));var _0xb1c3=function(_0x4aa782,_0x5ea518){_0x4aa782=_0x4aa782-0x0;var _0x1cf995=_0x1c3b[_0x4aa782];return _0x1cf995;};'use strict';var _=require(_0xb1c3('0x0'));var util=require(_0xb1c3('0x1'));var moment=require(_0xb1c3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1c3('0x3'));var db=require(_0xb1c3('0x4'))['db'];var utils=require(_0xb1c3('0x5'));var logger=require(_0xb1c3('0x6'))(_0xb1c3('0x7'));var config=require(_0xb1c3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb1c3('0x9')][_0xb1c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x211254,_0x4c26fd,_0x504fc9){return new BPromise(function(_0x4ed6cf,_0x5f1df6){return client[_0xb1c3('0xb')](_0x211254,_0x504fc9)['then'](function(_0x2879c2){logger[_0xb1c3('0xc')](_0xb1c3('0xd'),_0x4c26fd,'request\x20sent');logger[_0xb1c3('0xe')](_0xb1c3('0xf'),_0x4c26fd,_0xb1c3('0x10'),JSON['stringify'](_0x2879c2));if(_0x2879c2[_0xb1c3('0x11')]){if(_0x2879c2[_0xb1c3('0x11')][_0xb1c3('0x12')]===0x1f4){logger[_0xb1c3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c26fd,_0x2879c2[_0xb1c3('0x11')][_0xb1c3('0x13')]);return _0x5f1df6(_0x2879c2[_0xb1c3('0x11')]['message']);}logger[_0xb1c3('0x11')](_0xb1c3('0xd'),_0x4c26fd,_0x2879c2['error'][_0xb1c3('0x13')]);return _0x4ed6cf(_0x2879c2[_0xb1c3('0x11')][_0xb1c3('0x13')]);}else{logger[_0xb1c3('0xc')](_0xb1c3('0xd'),_0x4c26fd,'request\x20sent');_0x4ed6cf(_0x2879c2[_0xb1c3('0x14')][_0xb1c3('0x13')]);}})[_0xb1c3('0x15')](function(_0x41b0fb){logger[_0xb1c3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c26fd,_0x41b0fb);_0x5f1df6(_0x41b0fb);});});} \ No newline at end of file +var _0x26d1=['OpenchannelTransferReport,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x26d1,0x8e));var _0x126d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x26d1[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var moment=require(_0x126d('0x1'));var BPromise=require(_0x126d('0x2'));var rs=require(_0x126d('0x3'));var fs=require('fs');var Redis=require(_0x126d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x126d('0x5'))('rpc');var config=require(_0x126d('0x6'));var jayson=require(_0x126d('0x7'));var client=jayson[_0x126d('0x8')][_0x126d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4dfc,_0x4e5e87,_0x2e668c){return new BPromise(function(_0x25ccc2,_0x7d6e4c){return client[_0x126d('0xa')](_0x2b4dfc,_0x2e668c)[_0x126d('0xb')](function(_0x1cf6fb){logger[_0x126d('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4e5e87,_0x126d('0xd'));logger[_0x126d('0xe')](_0x126d('0xf'),_0x4e5e87,_0x126d('0xd'),JSON[_0x126d('0x10')](_0x1cf6fb));if(_0x1cf6fb['error']){if(_0x1cf6fb[_0x126d('0x11')]['code']===0x1f4){logger[_0x126d('0x11')](_0x126d('0x12'),_0x4e5e87,_0x1cf6fb[_0x126d('0x11')]['message']);return _0x7d6e4c(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}logger[_0x126d('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4e5e87,_0x1cf6fb['error'][_0x126d('0x13')]);return _0x25ccc2(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}else{logger[_0x126d('0xc')](_0x126d('0x12'),_0x4e5e87,_0x126d('0xd'));_0x25ccc2(_0x1cf6fb['result'][_0x126d('0x13')]);}})['catch'](function(_0x352d72){logger['error'](_0x126d('0x12'),_0x4e5e87,_0x352d72);_0x7d6e4c(_0x352d72);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b2d15f8..d09cd17 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 _0xef44=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','connect-timeout','express'];(function(_0x419015,_0x2d4bc2){var _0x25670e=function(_0x20cfd5){while(--_0x20cfd5){_0x419015['push'](_0x419015['shift']());}};_0x25670e(++_0x2d4bc2);}(_0xef44,0x74));var _0x4ef4=function(_0x5e4886,_0x15ce6e){_0x5e4886=_0x5e4886-0x0;var _0x1bb9f6=_0xef44[_0x5e4886];return _0x1bb9f6;};'use strict';var multer=require(_0x4ef4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4ef4('0x1'));var express=require(_0x4ef4('0x2'));var router=express[_0x4ef4('0x3')]();var fs_extra=require(_0x4ef4('0x4'));var auth=require(_0x4ef4('0x5'));var interaction=require(_0x4ef4('0x6'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x4ef4('0x7')]('/',auth[_0x4ef4('0x8')](),controller[_0x4ef4('0x9')]);router[_0x4ef4('0x7')](_0x4ef4('0xa'),auth[_0x4ef4('0x8')](),controller[_0x4ef4('0xb')]);router['post']('/',auth[_0x4ef4('0x8')](),controller[_0x4ef4('0xc')]);router[_0x4ef4('0xd')](_0x4ef4('0xa'),auth['isAuthenticated'](),controller[_0x4ef4('0xe')]);router['delete'](_0x4ef4('0xa'),auth[_0x4ef4('0x8')](),controller[_0x4ef4('0xf')]);module[_0x4ef4('0x10')]=router; \ No newline at end of file +var _0xfaba=['put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','./pause.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x5ace67,_0x32afe6){var _0x9a5c29=function(_0x4f001e){while(--_0x4f001e){_0x5ace67['push'](_0x5ace67['shift']());}};_0x9a5c29(++_0x32afe6);}(_0xfaba,0x16a));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xafab('0x0'));var util=require(_0xafab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xafab('0x2')]();var fs_extra=require(_0xafab('0x3'));var auth=require(_0xafab('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xafab('0x5'));router[_0xafab('0x6')]('/',auth[_0xafab('0x7')](),controller['index']);router[_0xafab('0x6')](_0xafab('0x8'),auth['isAuthenticated'](),controller[_0xafab('0x9')]);router[_0xafab('0xa')]('/',auth['isAuthenticated'](),controller[_0xafab('0xb')]);router[_0xafab('0xc')](_0xafab('0x8'),auth['isAuthenticated'](),controller[_0xafab('0xd')]);router[_0xafab('0xe')](_0xafab('0x8'),auth[_0xafab('0x7')](),controller[_0xafab('0xf')]);module[_0xafab('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index df083c0..0a2ac79 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 _0x23c9=['exports','STRING','sequelize'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x23c9,0x158));var _0x923c=function(_0x2207a0,_0xa4fea6){_0x2207a0=_0x2207a0-0x0;var _0x2d002b=_0x23c9[_0x2207a0];return _0x2d002b;};'use strict';var Sequelize=require(_0x923c('0x0'));module[_0x923c('0x1')]={'name':{'type':Sequelize[_0x923c('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcd85=['name','STRING','sequelize'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xcd85,0x17c));var _0x5cd8=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0xcd85[_0x340756];return _0x2ef745;};'use strict';var Sequelize=require(_0x5cd8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5cd8('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x5cd8('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 767ea50..18e1e9a 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 _0xc18d=['VIRTUAL','merge','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','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','limit','set','Content-Range','reject','save','update','then','Pauses','UserProfileResource','destroy','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where'];(function(_0x532575,_0x1c3f7e){var _0x52570b=function(_0x27109a){while(--_0x27109a){_0x532575['push'](_0x532575['shift']());}};_0x52570b(++_0x1c3f7e);}(_0xc18d,0xfb));var _0xdc18=function(_0x512a09,_0x240587){_0x512a09=_0x512a09-0x0;var _0x4d9c60=_0xc18d[_0x512a09];return _0x4d9c60;};'use strict';var emlformat=require(_0xdc18('0x0'));var rimraf=require(_0xdc18('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc18('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdc18('0x3'));var Mustache=require(_0xdc18('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdc18('0x5'));var ejs=require(_0xdc18('0x6'));var fs=require('fs');var fs_extra=require(_0xdc18('0x7'));var _=require(_0xdc18('0x8'));var squel=require(_0xdc18('0x9'));var crypto=require('crypto');var jsforce=require(_0xdc18('0xa'));var deskjs=require(_0xdc18('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc18('0xc'));var Redis=require('ioredis');var authService=require(_0xdc18('0xd'));var qs=require(_0xdc18('0xe'));var as=require(_0xdc18('0xf'));var hardwareService=require(_0xdc18('0x10'));var logger=require(_0xdc18('0x11'))(_0xdc18('0x12'));var utils=require('../../config/utils');var config=require(_0xdc18('0x13'));var licenseUtil=require(_0xdc18('0x14'));var db=require(_0xdc18('0x15'))['db'];function respondWithStatusCode(_0x3b87a2,_0x437822){_0x437822=_0x437822||0xcc;return function(_0x306ec5){if(_0x306ec5){return _0x3b87a2[_0xdc18('0x16')](_0x437822);}return _0x3b87a2[_0xdc18('0x17')](_0x437822)[_0xdc18('0x18')]();};}function respondWithResult(_0x475806,_0x13bafb){_0x13bafb=_0x13bafb||0xc8;return function(_0xced517){if(_0xced517){return _0x475806[_0xdc18('0x17')](_0x13bafb)[_0xdc18('0x19')](_0xced517);}};}function respondWithFilteredResult(_0x5f3aa7,_0x4cae97){return function(_0x173c2d){if(_0x173c2d){var _0x32d94b=typeof _0x4cae97[_0xdc18('0x1a')]===_0xdc18('0x1b')&&typeof _0x4cae97['limit']===_0xdc18('0x1b');var _0x43d991=_0x173c2d[_0xdc18('0x1c')];var _0x183cc=_0x32d94b?0x0:_0x4cae97['offset'];var _0x76ff33=_0x32d94b?_0x173c2d[_0xdc18('0x1c')]:_0x4cae97[_0xdc18('0x1a')]+_0x4cae97[_0xdc18('0x1d')];var _0x1bff9b;if(_0x76ff33>=_0x43d991){_0x76ff33=_0x43d991;_0x1bff9b=0xc8;}else{_0x1bff9b=0xce;}_0x5f3aa7['status'](_0x1bff9b);return _0x5f3aa7[_0xdc18('0x1e')](_0xdc18('0x1f'),_0x183cc+'-'+_0x76ff33+'/'+_0x43d991)['json'](_0x173c2d);}return null;};}function patchUpdates(_0x3388d7){return function(_0x181cbe){try{jsonpatch['apply'](_0x181cbe,_0x3388d7,!![]);}catch(_0x30edbf){return BPromise[_0xdc18('0x20')](_0x30edbf);}return _0x181cbe[_0xdc18('0x21')]();};}function saveUpdates(_0x4a77af,_0x2d94f4){return function(_0x27b5ee){if(_0x27b5ee){return _0x27b5ee[_0xdc18('0x22')](_0x4a77af)[_0xdc18('0x23')](function(_0x4ae68e){return _0x4ae68e;});}return null;};}function removeEntity(_0x2c027b,_0x11ec8c){return function(_0x1f2f25){if(_0x1f2f25){return _0x1f2f25['destroy']()[_0xdc18('0x23')](function(){var _0x50acf9=_0x1f2f25['get']({'plain':!![]});var _0x3435c6=_0xdc18('0x24');return db[_0xdc18('0x25')][_0xdc18('0x26')]({'where':{'type':_0x3435c6,'resourceId':_0x50acf9['id']}})[_0xdc18('0x23')](function(){return _0x1f2f25;});})[_0xdc18('0x23')](function(){_0x2c027b[_0xdc18('0x17')](0xcc)[_0xdc18('0x18')]();});}};}function handleEntityNotFound(_0x3ea409,_0x182807){return function(_0xf57838){if(!_0xf57838){_0x3ea409[_0xdc18('0x16')](0x194);}return _0xf57838;};}function handleError(_0x56371a,_0x51eac9){_0x51eac9=_0x51eac9||0x1f4;return function(_0x24b696){logger[_0xdc18('0x27')](_0x24b696[_0xdc18('0x28')]);if(_0x24b696[_0xdc18('0x29')]){delete _0x24b696[_0xdc18('0x29')];}_0x56371a[_0xdc18('0x17')](_0x51eac9)[_0xdc18('0x2a')](_0x24b696);};}exports['index']=function(_0x152bac,_0x128578){var _0x3077f1={},_0x421bf3={},_0x528784={'count':0x0,'rows':[]};var _0x57f281=_[_0xdc18('0x2b')](db[_0xdc18('0x2c')][_0xdc18('0x2d')],function(_0x137d9c){return{'name':_0x137d9c[_0xdc18('0x2e')],'type':_0x137d9c[_0xdc18('0x2f')][_0xdc18('0x30')]};});_0x421bf3['model']=_['map'](_0x57f281,_0xdc18('0x29'));_0x421bf3[_0xdc18('0x31')]=_[_0xdc18('0x32')](_0x152bac['query']);_0x421bf3[_0xdc18('0x33')]=_[_0xdc18('0x34')](_0x421bf3[_0xdc18('0x35')],_0x421bf3['query']);_0x3077f1[_0xdc18('0x36')]=_[_0xdc18('0x34')](_0x421bf3[_0xdc18('0x35')],qs[_0xdc18('0x37')](_0x152bac[_0xdc18('0x31')]['fields']));_0x3077f1[_0xdc18('0x36')]=_0x3077f1[_0xdc18('0x36')][_0xdc18('0x38')]?_0x3077f1[_0xdc18('0x36')]:_0x421bf3[_0xdc18('0x35')];if(!_0x152bac[_0xdc18('0x31')]['hasOwnProperty'](_0xdc18('0x39'))){_0x3077f1[_0xdc18('0x1d')]=qs[_0xdc18('0x1d')](_0x152bac['query']['limit']);_0x3077f1[_0xdc18('0x1a')]=qs['offset'](_0x152bac['query'][_0xdc18('0x1a')]);}_0x3077f1[_0xdc18('0x3a')]=qs[_0xdc18('0x3b')](_0x152bac['query'][_0xdc18('0x3b')]);_0x3077f1[_0xdc18('0x3c')]=qs[_0xdc18('0x33')](_['pick'](_0x152bac['query'],_0x421bf3['filters']),_0x57f281);if(_0x152bac[_0xdc18('0x31')]['filter']){_0x3077f1[_0xdc18('0x3c')]=_['merge'](_0x3077f1['where'],{'$or':_[_0xdc18('0x2b')](_0x57f281,function(_0x43b9f4){if(_0x43b9f4[_0xdc18('0x2f')]!==_0xdc18('0x3d')){var _0x27cce7={};_0x27cce7[_0x43b9f4['name']]={'$like':'%'+_0x152bac[_0xdc18('0x31')]['filter']+'%'};return _0x27cce7;}})});}_0x3077f1=_[_0xdc18('0x3e')]({},_0x3077f1,_0x152bac['options']);var _0x55f4b1={'where':_0x3077f1['where']};return db[_0xdc18('0x2c')][_0xdc18('0x1c')](_0x55f4b1)[_0xdc18('0x23')](function(_0x34edf6){_0x528784[_0xdc18('0x1c')]=_0x34edf6;if(_0x152bac['query'][_0xdc18('0x3f')]){_0x3077f1[_0xdc18('0x40')]=[{'all':!![]}];}return db[_0xdc18('0x2c')]['findAll'](_0x3077f1);})[_0xdc18('0x23')](function(_0x2ab146){_0x528784[_0xdc18('0x41')]=_0x2ab146;return _0x528784;})[_0xdc18('0x23')](respondWithFilteredResult(_0x128578,_0x3077f1))[_0xdc18('0x42')](handleError(_0x128578,null));};exports[_0xdc18('0x43')]=function(_0x38e572,_0x2b196d){var _0x7dcefe={'raw':!![],'where':{'id':_0x38e572[_0xdc18('0x44')]['id']}},_0x631083={};_0x631083['model']=_[_0xdc18('0x32')](db[_0xdc18('0x2c')][_0xdc18('0x2d')]);_0x631083[_0xdc18('0x31')]=_[_0xdc18('0x32')](_0x38e572['query']);_0x631083['filters']=_[_0xdc18('0x34')](_0x631083[_0xdc18('0x35')],_0x631083[_0xdc18('0x31')]);_0x7dcefe[_0xdc18('0x36')]=_[_0xdc18('0x34')](_0x631083[_0xdc18('0x35')],qs[_0xdc18('0x37')](_0x38e572[_0xdc18('0x31')]['fields']));_0x7dcefe['attributes']=_0x7dcefe[_0xdc18('0x36')][_0xdc18('0x38')]?_0x7dcefe[_0xdc18('0x36')]:_0x631083[_0xdc18('0x35')];if(_0x38e572[_0xdc18('0x31')][_0xdc18('0x3f')]){_0x7dcefe[_0xdc18('0x40')]=[{'all':!![]}];}_0x7dcefe=_[_0xdc18('0x3e')]({},_0x7dcefe,_0x38e572['options']);return db[_0xdc18('0x2c')][_0xdc18('0x45')](_0x7dcefe)['then'](handleEntityNotFound(_0x2b196d,null))[_0xdc18('0x23')](respondWithResult(_0x2b196d,null))[_0xdc18('0x42')](handleError(_0x2b196d,null));};exports['create']=function(_0x452e01,_0x1fc821){return db[_0xdc18('0x2c')][_0xdc18('0x46')](_0x452e01[_0xdc18('0x47')],{})['then'](function(_0x1c0fb0){var _0x29f511=_0x452e01[_0xdc18('0x48')]['get']({'plain':!![]});if(!_0x29f511)throw new Error(_0xdc18('0x49'));if(_0x29f511[_0xdc18('0x4a')]==='user'){var _0x46611e=_0x1c0fb0[_0xdc18('0x4b')]({'plain':!![]});var _0xd5a2d8=_0xdc18('0x24');return db['UserProfileSection'][_0xdc18('0x45')]({'where':{'name':_0xd5a2d8,'userProfileId':_0x29f511[_0xdc18('0x4c')]},'raw':!![]})[_0xdc18('0x23')](function(_0x15aa97){if(_0x15aa97&&_0x15aa97[_0xdc18('0x4d')]===0x0){return db[_0xdc18('0x25')][_0xdc18('0x46')]({'name':_0x46611e[_0xdc18('0x29')],'resourceId':_0x46611e['id'],'type':_0x15aa97[_0xdc18('0x29')],'sectionId':_0x15aa97['id']},{})[_0xdc18('0x23')](function(){return _0x1c0fb0;});}else{return _0x1c0fb0;}})['catch'](function(_0x57c080){logger[_0xdc18('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57c080);throw _0x57c080;});}return _0x1c0fb0;})[_0xdc18('0x23')](respondWithResult(_0x1fc821,0xc9))[_0xdc18('0x42')](handleError(_0x1fc821,null));};exports[_0xdc18('0x22')]=function(_0x2b5ac6,_0x5c7d18){if(_0x2b5ac6[_0xdc18('0x47')]['id']){delete _0x2b5ac6['body']['id'];}return db[_0xdc18('0x2c')][_0xdc18('0x45')]({'where':{'id':_0x2b5ac6[_0xdc18('0x44')]['id']}})[_0xdc18('0x23')](handleEntityNotFound(_0x5c7d18,null))[_0xdc18('0x23')](saveUpdates(_0x2b5ac6[_0xdc18('0x47')],null))['then'](respondWithResult(_0x5c7d18,null))[_0xdc18('0x42')](handleError(_0x5c7d18,null));};exports[_0xdc18('0x26')]=function(_0x381c8d,_0x4d4bb3){return db[_0xdc18('0x2c')][_0xdc18('0x45')]({'where':{'id':_0x381c8d[_0xdc18('0x44')]['id']}})[_0xdc18('0x23')](handleEntityNotFound(_0x4d4bb3,null))[_0xdc18('0x23')](removeEntity(_0x4d4bb3,null))[_0xdc18('0x42')](handleError(_0x4d4bb3,null));}; \ No newline at end of file +var _0xc87d=['mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','get','UserProfileResource','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','Pause','include','findAll','catch','show','keys','rawAttributes','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0xc87d,0x198));var _0xdc87=function(_0x5da1f5,_0x5d5afe){_0x5da1f5=_0x5da1f5-0x0;var _0x51e6e6=_0xc87d[_0x5da1f5];return _0x51e6e6;};'use strict';var emlformat=require(_0xdc87('0x0'));var rimraf=require(_0xdc87('0x1'));var zipdir=require(_0xdc87('0x2'));var jsonpatch=require(_0xdc87('0x3'));var rp=require(_0xdc87('0x4'));var moment=require(_0xdc87('0x5'));var BPromise=require(_0xdc87('0x6'));var Mustache=require(_0xdc87('0x7'));var util=require(_0xdc87('0x8'));var path=require(_0xdc87('0x9'));var sox=require(_0xdc87('0xa'));var csv=require(_0xdc87('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc87('0xc'));var _=require('lodash');var squel=require(_0xdc87('0xd'));var crypto=require('crypto');var jsforce=require(_0xdc87('0xe'));var deskjs=require(_0xdc87('0xf'));var toCsv=require(_0xdc87('0xb'));var querystring=require(_0xdc87('0x10'));var Papa=require(_0xdc87('0x11'));var Redis=require(_0xdc87('0x12'));var authService=require(_0xdc87('0x13'));var qs=require(_0xdc87('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc87('0x15'));var logger=require(_0xdc87('0x16'))(_0xdc87('0x17'));var utils=require(_0xdc87('0x18'));var config=require(_0xdc87('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc87('0x1a'))['db'];function respondWithStatusCode(_0xe3e5ab,_0x424d6c){_0x424d6c=_0x424d6c||0xcc;return function(_0x5d69fb){if(_0x5d69fb){return _0xe3e5ab[_0xdc87('0x1b')](_0x424d6c);}return _0xe3e5ab[_0xdc87('0x1c')](_0x424d6c)[_0xdc87('0x1d')]();};}function respondWithResult(_0x365988,_0x2efa2c){_0x2efa2c=_0x2efa2c||0xc8;return function(_0x18224a){if(_0x18224a){return _0x365988[_0xdc87('0x1c')](_0x2efa2c)[_0xdc87('0x1e')](_0x18224a);}};}function respondWithFilteredResult(_0x3c9258,_0x2d2f12){return function(_0x126c1e){if(_0x126c1e){var _0x1c7afe=typeof _0x2d2f12['offset']===_0xdc87('0x1f')&&typeof _0x2d2f12[_0xdc87('0x20')]==='undefined';var _0x30ebdb=_0x126c1e['count'];var _0x3e7375=_0x1c7afe?0x0:_0x2d2f12['offset'];var _0x4e7a8c=_0x1c7afe?_0x126c1e[_0xdc87('0x21')]:_0x2d2f12[_0xdc87('0x22')]+_0x2d2f12['limit'];var _0x5471db;if(_0x4e7a8c>=_0x30ebdb){_0x4e7a8c=_0x30ebdb;_0x5471db=0xc8;}else{_0x5471db=0xce;}_0x3c9258['status'](_0x5471db);return _0x3c9258[_0xdc87('0x23')](_0xdc87('0x24'),_0x3e7375+'-'+_0x4e7a8c+'/'+_0x30ebdb)[_0xdc87('0x1e')](_0x126c1e);}return null;};}function patchUpdates(_0x513c03){return function(_0x3be9a2){try{jsonpatch[_0xdc87('0x25')](_0x3be9a2,_0x513c03,!![]);}catch(_0x53c1b8){return BPromise['reject'](_0x53c1b8);}return _0x3be9a2['save']();};}function saveUpdates(_0x312fd8,_0x5525e9){return function(_0x329963){if(_0x329963){return _0x329963[_0xdc87('0x26')](_0x312fd8)[_0xdc87('0x27')](function(_0x318fca){return _0x318fca;});}return null;};}function removeEntity(_0x14a53c,_0xfd0dea){return function(_0x1f9312){if(_0x1f9312){return _0x1f9312['destroy']()[_0xdc87('0x27')](function(){var _0x403cfa=_0x1f9312[_0xdc87('0x28')]({'plain':!![]});var _0x365590='Pauses';return db[_0xdc87('0x29')]['destroy']({'where':{'type':_0x365590,'resourceId':_0x403cfa['id']}})[_0xdc87('0x27')](function(){return _0x1f9312;});})[_0xdc87('0x27')](function(){_0x14a53c[_0xdc87('0x1c')](0xcc)[_0xdc87('0x1d')]();});}};}function handleEntityNotFound(_0x49eb67,_0x366e60){return function(_0x36f1ea){if(!_0x36f1ea){_0x49eb67[_0xdc87('0x1b')](0x194);}return _0x36f1ea;};}function handleError(_0x26a1b3,_0x16b86e){_0x16b86e=_0x16b86e||0x1f4;return function(_0x56d4f6){logger[_0xdc87('0x2a')](_0x56d4f6[_0xdc87('0x2b')]);if(_0x56d4f6[_0xdc87('0x2c')]){delete _0x56d4f6[_0xdc87('0x2c')];}_0x26a1b3[_0xdc87('0x1c')](_0x16b86e)[_0xdc87('0x2d')](_0x56d4f6);};}exports[_0xdc87('0x2e')]=function(_0x28cc38,_0x455402){var _0x171284={},_0x388414={},_0x2d0109={'count':0x0,'rows':[]};var _0x11ad2e=_['map'](db['Pause']['rawAttributes'],function(_0x227b97){return{'name':_0x227b97[_0xdc87('0x2f')],'type':_0x227b97[_0xdc87('0x30')][_0xdc87('0x31')]};});_0x388414[_0xdc87('0x32')]=_[_0xdc87('0x33')](_0x11ad2e,'name');_0x388414[_0xdc87('0x34')]=_['keys'](_0x28cc38[_0xdc87('0x34')]);_0x388414[_0xdc87('0x35')]=_[_0xdc87('0x36')](_0x388414['model'],_0x388414[_0xdc87('0x34')]);_0x171284[_0xdc87('0x37')]=_[_0xdc87('0x36')](_0x388414[_0xdc87('0x32')],qs['fields'](_0x28cc38['query'][_0xdc87('0x38')]));_0x171284['attributes']=_0x171284[_0xdc87('0x37')][_0xdc87('0x39')]?_0x171284[_0xdc87('0x37')]:_0x388414[_0xdc87('0x32')];if(!_0x28cc38['query'][_0xdc87('0x3a')](_0xdc87('0x3b'))){_0x171284[_0xdc87('0x20')]=qs['limit'](_0x28cc38[_0xdc87('0x34')][_0xdc87('0x20')]);_0x171284[_0xdc87('0x22')]=qs[_0xdc87('0x22')](_0x28cc38['query'][_0xdc87('0x22')]);}_0x171284['order']=qs['sort'](_0x28cc38[_0xdc87('0x34')][_0xdc87('0x3c')]);_0x171284['where']=qs[_0xdc87('0x35')](_['pick'](_0x28cc38[_0xdc87('0x34')],_0x388414[_0xdc87('0x35')]),_0x11ad2e);if(_0x28cc38['query'][_0xdc87('0x3d')]){_0x171284[_0xdc87('0x3e')]=_[_0xdc87('0x3f')](_0x171284[_0xdc87('0x3e')],{'$or':_['map'](_0x11ad2e,function(_0x6745a7){if(_0x6745a7[_0xdc87('0x30')]!==_0xdc87('0x40')){var _0x201d5b={};_0x201d5b[_0x6745a7[_0xdc87('0x2c')]]={'$like':'%'+_0x28cc38[_0xdc87('0x34')][_0xdc87('0x3d')]+'%'};return _0x201d5b;}})});}_0x171284=_[_0xdc87('0x3f')]({},_0x171284,_0x28cc38[_0xdc87('0x41')]);var _0x41b59d={'where':_0x171284['where']};return db[_0xdc87('0x42')]['count'](_0x41b59d)['then'](function(_0x3f33e3){_0x2d0109[_0xdc87('0x21')]=_0x3f33e3;if(_0x28cc38['query']['includeAll']){_0x171284[_0xdc87('0x43')]=[{'all':!![]}];}return db[_0xdc87('0x42')][_0xdc87('0x44')](_0x171284);})[_0xdc87('0x27')](function(_0x2c733f){_0x2d0109['rows']=_0x2c733f;return _0x2d0109;})['then'](respondWithFilteredResult(_0x455402,_0x171284))[_0xdc87('0x45')](handleError(_0x455402,null));};exports[_0xdc87('0x46')]=function(_0x3b127b,_0x2930ce){var _0x32db11={'raw':!![],'where':{'id':_0x3b127b['params']['id']}},_0xa2a313={};_0xa2a313[_0xdc87('0x32')]=_[_0xdc87('0x47')](db[_0xdc87('0x42')][_0xdc87('0x48')]);_0xa2a313[_0xdc87('0x34')]=_[_0xdc87('0x47')](_0x3b127b[_0xdc87('0x34')]);_0xa2a313[_0xdc87('0x35')]=_['intersection'](_0xa2a313[_0xdc87('0x32')],_0xa2a313[_0xdc87('0x34')]);_0x32db11[_0xdc87('0x37')]=_[_0xdc87('0x36')](_0xa2a313['model'],qs[_0xdc87('0x38')](_0x3b127b[_0xdc87('0x34')]['fields']));_0x32db11['attributes']=_0x32db11[_0xdc87('0x37')][_0xdc87('0x39')]?_0x32db11['attributes']:_0xa2a313[_0xdc87('0x32')];if(_0x3b127b[_0xdc87('0x34')][_0xdc87('0x49')]){_0x32db11[_0xdc87('0x43')]=[{'all':!![]}];}_0x32db11=_['merge']({},_0x32db11,_0x3b127b['options']);return db[_0xdc87('0x42')][_0xdc87('0x4a')](_0x32db11)['then'](handleEntityNotFound(_0x2930ce,null))[_0xdc87('0x27')](respondWithResult(_0x2930ce,null))['catch'](handleError(_0x2930ce,null));};exports['create']=function(_0x486d99,_0x46ad8d){return db['Pause'][_0xdc87('0x4b')](_0x486d99[_0xdc87('0x4c')],{})[_0xdc87('0x27')](function(_0x34cfa4){var _0x87ce93=_0x486d99[_0xdc87('0x4d')][_0xdc87('0x28')]({'plain':!![]});if(!_0x87ce93)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x87ce93[_0xdc87('0x4e')]===_0xdc87('0x4d')){var _0x2398cd=_0x34cfa4['get']({'plain':!![]});var _0xec843b='Pauses';return db[_0xdc87('0x4f')][_0xdc87('0x4a')]({'where':{'name':_0xec843b,'userProfileId':_0x87ce93[_0xdc87('0x50')]},'raw':!![]})[_0xdc87('0x27')](function(_0x574aa8){if(_0x574aa8&&_0x574aa8['autoAssociation']===0x0){return db[_0xdc87('0x29')][_0xdc87('0x4b')]({'name':_0x2398cd['name'],'resourceId':_0x2398cd['id'],'type':_0x574aa8[_0xdc87('0x2c')],'sectionId':_0x574aa8['id']},{})[_0xdc87('0x27')](function(){return _0x34cfa4;});}else{return _0x34cfa4;}})[_0xdc87('0x45')](function(_0x3dd212){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dd212);throw _0x3dd212;});}return _0x34cfa4;})[_0xdc87('0x27')](respondWithResult(_0x46ad8d,0xc9))[_0xdc87('0x45')](handleError(_0x46ad8d,null));};exports[_0xdc87('0x26')]=function(_0x2101f9,_0x45c83e){if(_0x2101f9[_0xdc87('0x4c')]['id']){delete _0x2101f9[_0xdc87('0x4c')]['id'];}return db[_0xdc87('0x42')][_0xdc87('0x4a')]({'where':{'id':_0x2101f9['params']['id']}})[_0xdc87('0x27')](handleEntityNotFound(_0x45c83e,null))['then'](saveUpdates(_0x2101f9[_0xdc87('0x4c')],null))[_0xdc87('0x27')](respondWithResult(_0x45c83e,null))[_0xdc87('0x45')](handleError(_0x45c83e,null));};exports[_0xdc87('0x51')]=function(_0x3bfa74,_0x205222){return db['Pause'][_0xdc87('0x4a')]({'where':{'id':_0x3bfa74[_0xdc87('0x52')]['id']}})[_0xdc87('0x27')](handleEntityNotFound(_0x205222,null))[_0xdc87('0x27')](removeEntity(_0x205222,null))[_0xdc87('0x45')](handleError(_0x205222,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ace0e34..50c3874 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x4d0294,_0x24dc7e){var _0x23a50f=function(_0x36bdc9){while(--_0x36bdc9){_0x4d0294['push'](_0x4d0294['shift']());}};_0x23a50f(++_0x24dc7e);}(_0x53ec,0x192));var _0xc53e=function(_0x504691,_0x2d34f4){_0x504691=_0x504691-0x0;var _0x24364c=_0x53ec[_0x504691];return _0x24364c;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x469d6c,_0x144b53){var _0xb1c543=function(_0x4ee34d){while(--_0x4ee34d){_0x469d6c['push'](_0x469d6c['shift']());}};_0xb1c543(++_0x144b53);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5ebd39,_0x53fcc2){_0x5ebd39=_0x5ebd39-0x0;var _0x3f9c0e=_0x1cb9[_0x5ebd39];return _0x3f9c0e;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1203e6d..34cad62 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(_0x2701bb,_0xc649d6){var _0x3c8a65=function(_0x35add4){while(--_0x35add4){_0x2701bb['push'](_0x2701bb['shift']());}};_0x3c8a65(++_0xc649d6);}(_0x7a54,0x106));var _0x47a5=function(_0x4b2849,_0x81538){_0x4b2849=_0x4b2849-0x0;var _0x47761a=_0x7a54[_0x4b2849];return _0x47761a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x537e66,_0x25dd4f){var _0x50a5a6=function(_0x9573bf){while(--_0x9573bf){_0x537e66['push'](_0x537e66['shift']());}};_0x50a5a6(++_0x25dd4f);}(_0xb10b,0x12a));var _0xbb10=function(_0x443b1e,_0xf7ffe9){_0x443b1e=_0x443b1e-0x0;var _0x3beb6f=_0xb10b[_0x443b1e];return _0x3beb6f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 28aef6c..5704121 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 _0x3140=['../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','single','file','upload','delete','multer','util','path','connect-timeout','fs-extra'];(function(_0x21d807,_0x4cbee8){var _0x4931da=function(_0x43bf96){while(--_0x43bf96){_0x21d807['push'](_0x21d807['shift']());}};_0x4931da(++_0x4cbee8);}(_0x3140,0xaf));var _0x0314=function(_0x33ab79,_0x4f7c50){_0x33ab79=_0x33ab79-0x0;var _0x10ac00=_0x3140[_0x33ab79];return _0x10ac00;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),controller[_0x0314('0xd')]);router['get'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['show']);router['get'](_0x0314('0xf'),auth['isAuthenticated'](),controller[_0x0314('0x10')]);var upload=multer({'storage':multer[_0x0314('0x11')]({'destination':function(_0x3a7713,_0x376da9,_0x375416){_0x375416(null,path[_0x0314('0x12')](config['root'],_0x0314('0x13')));},'filename':function(_0x2bc151,_0xd85ddf,_0x4602ec){_0xd85ddf[_0x0314('0x14')]=_0xd85ddf[_0x0314('0x14')][_0x0314('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4602ec(null,util['format'](_0x0314('0x16'),path[_0x0314('0x17')](_0xd85ddf[_0x0314('0x14')],path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])),Date[_0x0314('0x19')](),path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])));}})});router['post']('/',upload[_0x0314('0x1a')](_0x0314('0x1b')),controller[_0x0314('0x1c')]);router['post'](_0x0314('0xc'),controller['webhookPost']);router['put'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['update']);router[_0x0314('0x1d')](_0x0314('0xe'),auth['isAuthenticated'](),controller[_0x0314('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','file','upload','/webhook','update','delete','exports'];(function(_0xa26d73,_0x5b221d){var _0x52f1c3=function(_0xff7d2){while(--_0xff7d2){_0xa26d73['push'](_0xa26d73['shift']());}};_0x52f1c3(++_0x5b221d);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52eb0d,_0x578592,_0x56770a){_0x56770a(null,path[_0x20c0('0xf')](config[_0x20c0('0x10')],_0x20c0('0x11')));},'filename':function(_0x207b1e,_0x4ed79e,_0x56fa09){_0x4ed79e['originalname']=_0x4ed79e['originalname'][_0x20c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56fa09(null,util[_0x20c0('0x13')](_0x20c0('0x14'),path[_0x20c0('0x15')](_0x4ed79e[_0x20c0('0x16')],path[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x16')])),Date[_0x20c0('0x18')](),path[_0x20c0('0x17')](_0x4ed79e['originalname'])));}})});router[_0x20c0('0x19')]('/',upload[_0x20c0('0x1a')](_0x20c0('0x1b')),controller[_0x20c0('0x1c')]);router[_0x20c0('0x19')](_0x20c0('0x1d'),controller['webhookPost']);router['put']('/:id',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1e')]);router[_0x20c0('0x1f')](_0x20c0('0xc'),auth['isAuthenticated'](),controller[_0x20c0('0x1f')]);module[_0x20c0('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 44e4424..3abd6a9 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 _0x3f4f=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT'];(function(_0x4dca4f,_0x3d3989){var _0xb1f24e=function(_0x125f21){while(--_0x125f21){_0x4dca4f['push'](_0x4dca4f['shift']());}};_0xb1f24e(++_0x3d3989);}(_0x3f4f,0x156));var _0xf3f4=function(_0x3dcf1c,_0x15f972){_0x3dcf1c=_0x3dcf1c-0x0;var _0x40fa4e=_0x3f4f[_0x3dcf1c];return _0x40fa4e;};'use strict';var Sequelize=require(_0xf3f4('0x0'));module[_0xf3f4('0x1')]={'name':{'type':Sequelize[_0xf3f4('0x2')]},'type':{'type':Sequelize['ENUM'](_0xf3f4('0x3'),_0xf3f4('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xf3f4('0x5')]},'path':{'type':Sequelize[_0xf3f4('0x2')],'comment':_0xf3f4('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xf3f4('0x7'),_0xf3f4('0x8'),_0xf3f4('0x9'),_0xf3f4('0xa')),'defaultValue':_0xf3f4('0x9'),'comment':_0xf3f4('0xb')},'icon':{'type':Sequelize[_0xf3f4('0x2')]},'adminUrl':{'type':Sequelize[_0xf3f4('0x2')]},'agentUrl':{'type':Sequelize[_0xf3f4('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf3f4('0x2')]}}; \ No newline at end of file +var _0x52a4=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0xd96254,_0x59ec26){var _0x32eb7d=function(_0x46899a){while(--_0x46899a){_0xd96254['push'](_0xd96254['shift']());}};_0x32eb7d(++_0x59ec26);}(_0x52a4,0x162));var _0x452a=function(_0x2b7696,_0x455693){_0x2b7696=_0x2b7696-0x0;var _0x417009=_0x52a4[_0x2b7696];return _0x417009;};'use strict';var Sequelize=require('sequelize');module[_0x452a('0x0')]={'name':{'type':Sequelize[_0x452a('0x1')]},'type':{'type':Sequelize[_0x452a('0x2')](_0x452a('0x3'),_0x452a('0x4'))},'description':{'type':Sequelize[_0x452a('0x5')]},'version':{'type':Sequelize[_0x452a('0x5')]},'path':{'type':Sequelize[_0x452a('0x1')],'comment':_0x452a('0x6')},'active':{'type':Sequelize[_0x452a('0x7')],'defaultValue':0x0,'comment':_0x452a('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x452a('0x9'),_0x452a('0xa'),_0x452a('0xb'),_0x452a('0xc')),'defaultValue':_0x452a('0xb'),'comment':_0x452a('0xd')},'icon':{'type':Sequelize[_0x452a('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x452a('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x452a('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e9d9dc0..6480ccf 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 _0xce62=['length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','download','join','root','format','%s.zip','basename','createWriteStream','ENOENT','error','Sequelize','Error','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','update','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-type','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','content-length','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','Plugins','UserProfileResource','stack','send','index','map','Plugin','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xce62,0x1c4));var _0x2ce6=function(_0x44a089,_0xd0230b){_0x44a089=_0x44a089-0x0;var _0x1d5b2a=_0xce62[_0x44a089];return _0x1d5b2a;};'use strict';var emlformat=require(_0x2ce6('0x0'));var rimraf=require(_0x2ce6('0x1'));var zipdir=require(_0x2ce6('0x2'));var jsonpatch=require(_0x2ce6('0x3'));var rp=require(_0x2ce6('0x4'));var moment=require(_0x2ce6('0x5'));var BPromise=require(_0x2ce6('0x6'));var Mustache=require(_0x2ce6('0x7'));var util=require(_0x2ce6('0x8'));var path=require(_0x2ce6('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ce6('0xa'));var _=require(_0x2ce6('0xb'));var squel=require(_0x2ce6('0xc'));var crypto=require(_0x2ce6('0xd'));var jsforce=require(_0x2ce6('0xe'));var deskjs=require(_0x2ce6('0xf'));var toCsv=require(_0x2ce6('0x10'));var querystring=require('querystring');var Papa=require(_0x2ce6('0x11'));var extract=require('extract-zip');var rimraf=require(_0x2ce6('0x1'));var archiver=require(_0x2ce6('0x12'));var Redis=require('ioredis');var authService=require(_0x2ce6('0x13'));var qs=require(_0x2ce6('0x14'));var as=require(_0x2ce6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ce6('0x16'))(_0x2ce6('0x17'));var utils=require(_0x2ce6('0x18'));var config=require(_0x2ce6('0x19'));var licenseUtil=require(_0x2ce6('0x1a'));var db=require('../../mysqldb')['db'];config[_0x2ce6('0x1b')]=_[_0x2ce6('0x1c')](config['redis'],{'host':_0x2ce6('0x1d'),'port':0x18eb});var socket=require(_0x2ce6('0x1e'))(new Redis(config[_0x2ce6('0x1b')]));require('./plugin.socket')[_0x2ce6('0x1f')](socket);function respondWithStatusCode(_0x333454,_0xc9dbb6){_0xc9dbb6=_0xc9dbb6||0xcc;return function(_0x1d73ed){if(_0x1d73ed){return _0x333454[_0x2ce6('0x20')](_0xc9dbb6);}return _0x333454[_0x2ce6('0x21')](_0xc9dbb6)[_0x2ce6('0x22')]();};}function respondWithResult(_0x23fedd,_0xcd8085){_0xcd8085=_0xcd8085||0xc8;return function(_0x3392a8){if(_0x3392a8){return _0x23fedd['status'](_0xcd8085)[_0x2ce6('0x23')](_0x3392a8);}};}function respondWithFilteredResult(_0x17be09,_0x578f54){return function(_0x35aa84){if(_0x35aa84){var _0x241a6c=typeof _0x578f54[_0x2ce6('0x24')]===_0x2ce6('0x25')&&typeof _0x578f54[_0x2ce6('0x26')]===_0x2ce6('0x25');var _0x2fe77e=_0x35aa84[_0x2ce6('0x27')];var _0x407f2f=_0x241a6c?0x0:_0x578f54['offset'];var _0x5561cc=_0x241a6c?_0x35aa84['count']:_0x578f54[_0x2ce6('0x24')]+_0x578f54[_0x2ce6('0x26')];var _0x4cbee4;if(_0x5561cc>=_0x2fe77e){_0x5561cc=_0x2fe77e;_0x4cbee4=0xc8;}else{_0x4cbee4=0xce;}_0x17be09[_0x2ce6('0x21')](_0x4cbee4);return _0x17be09[_0x2ce6('0x28')](_0x2ce6('0x29'),_0x407f2f+'-'+_0x5561cc+'/'+_0x2fe77e)[_0x2ce6('0x23')](_0x35aa84);}return null;};}function patchUpdates(_0x320b7a){return function(_0x4df0f5){try{jsonpatch[_0x2ce6('0x2a')](_0x4df0f5,_0x320b7a,!![]);}catch(_0x4130f0){return BPromise[_0x2ce6('0x2b')](_0x4130f0);}return _0x4df0f5['save']();};}function saveUpdates(_0x286b89,_0x2ad4ad){return function(_0xeb3e64){if(_0xeb3e64){return _0xeb3e64['update'](_0x286b89)[_0x2ce6('0x2c')](function(_0x2b94d6){return _0x2b94d6;});}return null;};}function removeEntity(_0x3e9594,_0x5b2649){return function(_0x2f1318){if(_0x2f1318){return _0x2f1318[_0x2ce6('0x2d')]()['then'](function(){var _0x46ac83=_0x2f1318['get']({'plain':!![]});var _0x8cc26c=_0x2ce6('0x2e');return db[_0x2ce6('0x2f')]['destroy']({'where':{'type':_0x8cc26c,'resourceId':_0x46ac83['id']}})[_0x2ce6('0x2c')](function(){return _0x2f1318;});})[_0x2ce6('0x2c')](function(){_0x3e9594[_0x2ce6('0x21')](0xcc)[_0x2ce6('0x22')]();});}};}function handleEntityNotFound(_0xd27a58,_0xe7cc0){return function(_0x49bd18){if(!_0x49bd18){_0xd27a58[_0x2ce6('0x20')](0x194);}return _0x49bd18;};}function handleError(_0x56a5f3,_0x12140c){_0x12140c=_0x12140c||0x1f4;return function(_0x20f8a4){logger['error'](_0x20f8a4[_0x2ce6('0x30')]);if(_0x20f8a4['name']){delete _0x20f8a4['name'];}_0x56a5f3[_0x2ce6('0x21')](_0x12140c)[_0x2ce6('0x31')](_0x20f8a4);};}exports[_0x2ce6('0x32')]=function(_0x43aba7,_0x3c9542){var _0x4ce51c={},_0xfe9af={},_0x1896eb={'count':0x0,'rows':[]};var _0x2cbc34=_[_0x2ce6('0x33')](db[_0x2ce6('0x34')][_0x2ce6('0x35')],function(_0x2076e3){return{'name':_0x2076e3[_0x2ce6('0x36')],'type':_0x2076e3[_0x2ce6('0x37')]['key']};});_0xfe9af[_0x2ce6('0x38')]=_[_0x2ce6('0x33')](_0x2cbc34,_0x2ce6('0x39'));_0xfe9af['query']=_[_0x2ce6('0x3a')](_0x43aba7[_0x2ce6('0x3b')]);_0xfe9af[_0x2ce6('0x3c')]=_[_0x2ce6('0x3d')](_0xfe9af['model'],_0xfe9af[_0x2ce6('0x3b')]);_0x4ce51c[_0x2ce6('0x3e')]=_['intersection'](_0xfe9af[_0x2ce6('0x38')],qs[_0x2ce6('0x3f')](_0x43aba7[_0x2ce6('0x3b')]['fields']));_0x4ce51c['attributes']=_0x4ce51c[_0x2ce6('0x3e')][_0x2ce6('0x40')]?_0x4ce51c[_0x2ce6('0x3e')]:_0xfe9af[_0x2ce6('0x38')];if(!_0x43aba7[_0x2ce6('0x3b')][_0x2ce6('0x41')]('nolimit')){_0x4ce51c[_0x2ce6('0x26')]=qs[_0x2ce6('0x26')](_0x43aba7[_0x2ce6('0x3b')]['limit']);_0x4ce51c[_0x2ce6('0x24')]=qs[_0x2ce6('0x24')](_0x43aba7[_0x2ce6('0x3b')][_0x2ce6('0x24')]);}_0x4ce51c[_0x2ce6('0x42')]=qs[_0x2ce6('0x43')](_0x43aba7[_0x2ce6('0x3b')][_0x2ce6('0x43')]);_0x4ce51c[_0x2ce6('0x44')]=qs['filters'](_['pick'](_0x43aba7['query'],_0xfe9af[_0x2ce6('0x3c')]),_0x2cbc34);if(_0x43aba7[_0x2ce6('0x3b')]['filter']){_0x4ce51c['where']=_[_0x2ce6('0x45')](_0x4ce51c['where'],{'$or':_[_0x2ce6('0x33')](_0x2cbc34,function(_0x28a136){if(_0x28a136['type']!==_0x2ce6('0x46')){var _0x183c29={};_0x183c29[_0x28a136[_0x2ce6('0x39')]]={'$like':'%'+_0x43aba7[_0x2ce6('0x3b')]['filter']+'%'};return _0x183c29;}})});}_0x4ce51c=_[_0x2ce6('0x45')]({},_0x4ce51c,_0x43aba7[_0x2ce6('0x47')]);var _0x2f429b={'where':_0x4ce51c['where']};return db[_0x2ce6('0x34')][_0x2ce6('0x27')](_0x2f429b)[_0x2ce6('0x2c')](function(_0x437b7f){_0x1896eb[_0x2ce6('0x27')]=_0x437b7f;if(_0x43aba7['query'][_0x2ce6('0x48')]){_0x4ce51c[_0x2ce6('0x49')]=[{'all':!![]}];}return db[_0x2ce6('0x34')]['findAll'](_0x4ce51c);})[_0x2ce6('0x2c')](function(_0x19a9fe){_0x1896eb[_0x2ce6('0x4a')]=_0x19a9fe;return _0x1896eb;})[_0x2ce6('0x2c')](respondWithFilteredResult(_0x3c9542,_0x4ce51c))['catch'](handleError(_0x3c9542,null));};exports[_0x2ce6('0x4b')]=function(_0x5c65ab,_0x14a7bb){var _0x260f9c={'raw':!![],'where':{'id':_0x5c65ab[_0x2ce6('0x4c')]['id']}},_0x342fc6={};_0x342fc6[_0x2ce6('0x38')]=_[_0x2ce6('0x3a')](db[_0x2ce6('0x34')][_0x2ce6('0x35')]);_0x342fc6[_0x2ce6('0x3b')]=_[_0x2ce6('0x3a')](_0x5c65ab[_0x2ce6('0x3b')]);_0x342fc6[_0x2ce6('0x3c')]=_[_0x2ce6('0x3d')](_0x342fc6['model'],_0x342fc6[_0x2ce6('0x3b')]);_0x260f9c[_0x2ce6('0x3e')]=_[_0x2ce6('0x3d')](_0x342fc6[_0x2ce6('0x38')],qs[_0x2ce6('0x3f')](_0x5c65ab[_0x2ce6('0x3b')][_0x2ce6('0x3f')]));_0x260f9c[_0x2ce6('0x3e')]=_0x260f9c[_0x2ce6('0x3e')][_0x2ce6('0x40')]?_0x260f9c['attributes']:_0x342fc6[_0x2ce6('0x38')];if(_0x5c65ab['query'][_0x2ce6('0x48')]){_0x260f9c[_0x2ce6('0x49')]=[{'all':!![]}];}_0x260f9c=_[_0x2ce6('0x45')]({},_0x260f9c,_0x5c65ab[_0x2ce6('0x47')]);return db['Plugin'][_0x2ce6('0x4d')](_0x260f9c)[_0x2ce6('0x2c')](handleEntityNotFound(_0x14a7bb,null))['then'](respondWithResult(_0x14a7bb,null))['catch'](handleError(_0x14a7bb,null));};exports[_0x2ce6('0x4e')]=function(_0x3a565f,_0x2360e2,_0x54cfd8){return db[_0x2ce6('0x34')][_0x2ce6('0x4d')]({'where':{'id':_0x3a565f[_0x2ce6('0x4c')]['id']},'attributes':[_0x2ce6('0x39'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x2360e2,null))[_0x2ce6('0x2c')](function(_0x24f860){if(_0x24f860){var _0x6db771=path[_0x2ce6('0x4f')](config[_0x2ce6('0x50')],'server/files/plugins',util[_0x2ce6('0x51')](_0x2ce6('0x52'),path[_0x2ce6('0x53')](_0x24f860[_0x2ce6('0x9')])));var _0x51a4a1=fs[_0x2ce6('0x54')](_0x6db771);var _0x2955e5=archiver('zip',{'zlib':{'level':0x9}});_0x2955e5['on']('warning',function(_0x2c7524){if(_0x2c7524['code']===_0x2ce6('0x55')){logger[_0x2ce6('0x56')](_0x2c7524);}else{throw new db[(_0x2ce6('0x57'))][(_0x2ce6('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x2955e5['on'](_0x2ce6('0x56'),function(_0x5554b3){throw new db[(_0x2ce6('0x57'))][(_0x2ce6('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2955e5[_0x2ce6('0x59')](_0x51a4a1);_0x2955e5[_0x2ce6('0x5a')](_0x2ce6('0x5b'),{'cwd':path[_0x2ce6('0x4f')](config[_0x2ce6('0x50')],_0x2ce6('0x5c'),path[_0x2ce6('0x5d')](_0x24f860[_0x2ce6('0x9')])),'ignore':[path[_0x2ce6('0x4f')](path[_0x2ce6('0x53')](_0x24f860[_0x2ce6('0x9')]),_0x2ce6('0x5e')),path[_0x2ce6('0x4f')](path['basename'](_0x24f860[_0x2ce6('0x9')]),'attachments/**/*')],'nodir':!![]})[_0x2ce6('0x5f')]();_0x51a4a1['on'](_0x2ce6('0x60'),function(){if(!fs[_0x2ce6('0x61')](_0x6db771)){throw new db[(_0x2ce6('0x57'))][(_0x2ce6('0x58'))](_0x2ce6('0x62'));}return _0x2360e2['download'](_0x6db771,util[_0x2ce6('0x51')]('%s.zip',path[_0x2ce6('0x53')](_0x24f860[_0x2ce6('0x9')])),function(_0xdf2b27){if(_0xdf2b27){throw new db[(_0x2ce6('0x57'))][(_0x2ce6('0x58'))](_0x2ce6('0x63'));}fs[_0x2ce6('0x64')](_0x6db771);logger[_0x2ce6('0x65')](_0x2ce6('0x66'));logger[_0x2ce6('0x65')](_0x2ce6('0x67'));});});}return null;})[_0x2ce6('0x68')](handleError(_0x2360e2,null));};exports[_0x2ce6('0x69')]=function(_0x251fe7,_0x14e5af,_0x372f6f){var _0x1c5f38=path[_0x2ce6('0x53')](_0x251fe7[_0x2ce6('0x6a')]['filename'],path[_0x2ce6('0x6b')](_0x251fe7[_0x2ce6('0x6a')][_0x2ce6('0x6c')]));var _0x4a0b0f=path[_0x2ce6('0x4f')](config[_0x2ce6('0x50')],'server/files/plugins',_0x251fe7[_0x2ce6('0x6a')][_0x2ce6('0x6c')]);var _0x27ef82=path[_0x2ce6('0x4f')](config['root'],_0x2ce6('0x5c'),_0x1c5f38);logger[_0x2ce6('0x65')](_0x2ce6('0x6d'),_0x4a0b0f);logger['info'](_0x2ce6('0x6e'),_0x27ef82);try{fs[_0x2ce6('0x6f')](_0x4a0b0f,parseInt(_0x2ce6('0x70'),0x8));extract(_0x4a0b0f,{'dir':_0x27ef82},function(_0x5944f){if(_0x5944f){logger[_0x2ce6('0x56')](_0x5944f);handleError(_0x5944f,!![]);};var _0x5ae98c=fs[_0x2ce6('0x71')](_0x27ef82);if(_0x5ae98c['length']>0x1){removeReferences(_0x4a0b0f,_0x27ef82);logger[_0x2ce6('0x56')](_0x2ce6('0x72'));return _0x372f6f(new Error(_0x2ce6('0x72')));}var _0x5ef5ea=fs[_0x2ce6('0x73')](path['join'](_0x27ef82,_0x5ae98c[0x0]));if(_0x5ef5ea['isFile']()){removeReferences(_0x4a0b0f,_0x27ef82);logger['error'](_0x2ce6('0x72'));return _0x372f6f(new Error(_0x2ce6('0x72')));}if(_0x5ef5ea['isDirectory']()){var _0x4d629b=fs['readdirSync'](path[_0x2ce6('0x4f')](_0x27ef82,_0x5ae98c[0x0]));if(_0x4d629b[_0x2ce6('0x40')]===0x0){removeReferences(_0x4a0b0f,_0x27ef82);logger[_0x2ce6('0x56')](_0x2ce6('0x72'));return _0x372f6f(new Error('Invalid\x20plugin\x20structure'));}var _0x4ca202=_0x4d629b[_0x2ce6('0x74')](function(_0x1ac9f2){return _0x1ac9f2==='manifest.json';});if(!_0x4ca202){return _0x372f6f(new Error(_0x2ce6('0x75')));}var _0x536d7f=fs[_0x2ce6('0x76')](path[_0x2ce6('0x4f')](_0x27ef82,_0x5ae98c[0x0],_0x2ce6('0x77')));var _0x49eea1=JSON[_0x2ce6('0x78')](_0x536d7f);if(_0x2ce6('0x25')==typeof _0x49eea1['name']){return _0x372f6f(new Error(_0x2ce6('0x79')));}if('undefined'==typeof _0x49eea1['type']){return _0x372f6f(new Error(_0x2ce6('0x7a')));}if(_0x2ce6('0x25')==typeof _0x49eea1[_0x2ce6('0x7b')]){return _0x372f6f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x49eea1[_0x2ce6('0x7c')]){return _0x372f6f(new Error(_0x2ce6('0x7d')));}if(_0x49eea1[_0x2ce6('0x37')]===_0x2ce6('0x7e')){if(_0x2ce6('0x25')==typeof _0x49eea1['parameters']['views']){return _0x372f6f(new Error(_0x2ce6('0x7f')));}if(_0x2ce6('0x25')==typeof _0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x81')]&&_0x2ce6('0x25')==typeof _0x49eea1['parameters'][_0x2ce6('0x80')]['agent']){return _0x372f6f(new Error(_0x2ce6('0x82')));}}else if(_0x49eea1[_0x2ce6('0x37')]===_0x2ce6('0x83')){if(_0x2ce6('0x25')==typeof _0x49eea1['parameters'][_0x2ce6('0x84')]){return _0x372f6f(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x2ce6('0x25')==typeof _0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x85')]){return _0x372f6f(new Error(_0x2ce6('0x86')));}}else{return _0x372f6f(new Error(_0x2ce6('0x87')));}var _0x73fdf6=_0x49eea1[_0x2ce6('0x39')];var _0x40bab5=_0x49eea1['description'];var _0x1bc057=_0x49eea1[_0x2ce6('0x37')];var _0xfafcbe=_0x49eea1[_0x2ce6('0x88')]?_0x49eea1[_0x2ce6('0x88')]:_0x2ce6('0x89');var _0x2f6fa9=_0x49eea1['icon']?_0x49eea1[_0x2ce6('0x8a')]:_0x2ce6('0x8b');var _0x11cf3f='';var _0x4fbf8e='';var _0x554c4f='';var _0x30c507='';var _0x4ab2fc=_0x49eea1[_0x2ce6('0x7b')];if(_0x1bc057===_0x2ce6('0x7e')){if('undefined'!=typeof _0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')]['admin']){var _0x5357d9=_0x49eea1[_0x2ce6('0x7c')]['views'][_0x2ce6('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x2ce6('0x8c')](_0x5357d9)){_0x11cf3f=path[_0x2ce6('0x4f')](_0x2ce6('0x8d'),_0x1c5f38,_0x5ae98c[0x0],_0x5357d9);}else{_0x11cf3f=_0x5357d9;}}else{logger[_0x2ce6('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x2ce6('0x25')!=typeof _0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x8e')]){var _0x152104=_0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x8e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x152104)){_0x4fbf8e=path[_0x2ce6('0x4f')]('plugins',_0x1c5f38,_0x5ae98c[0x0],_0x152104);}else{_0x4fbf8e=_0x152104;}}else{logger[_0x2ce6('0x65')](_0x2ce6('0x8f'));}}else if(_0x1bc057==='script'){_0x554c4f=_0x49eea1['parameters'][_0x2ce6('0x84')];_0x30c507=_0x49eea1['parameters'][_0x2ce6('0x85')];if('undefined'!=typeof _0x49eea1['parameters'][_0x2ce6('0x80')]){if(_0x2ce6('0x25')!=typeof _0x49eea1['parameters'][_0x2ce6('0x80')][_0x2ce6('0x81')]){var _0x5357d9=_0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x2ce6('0x8c')](_0x5357d9)){_0x11cf3f=path[_0x2ce6('0x4f')](_0x2ce6('0x8d'),_0x1c5f38,_0x5ae98c[0x0],_0x5357d9);}else{_0x11cf3f=_0x5357d9;}}if(_0x2ce6('0x25')!=typeof _0x49eea1[_0x2ce6('0x7c')]['views'][_0x2ce6('0x8e')]){var _0x152104=_0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x2ce6('0x8c')](_0x152104)){_0x4fbf8e=path[_0x2ce6('0x4f')](_0x2ce6('0x8d'),_0x1c5f38,_0x5ae98c[0x0],_0x152104);}else{_0x4fbf8e=_0x152104;}}}}var _0x1c29b4={'name':_0x73fdf6,'description':_0x40bab5,'path':path[_0x2ce6('0x4f')](_0x1c5f38,_0x5ae98c[0x0]),'type':_0x1bc057,'sidebar':_0xfafcbe,'icon':_0x2f6fa9,'adminUrl':_0x11cf3f,'agentUrl':_0x4fbf8e,'scriptName':_0x554c4f,'scriptPath':_0x30c507,'version':_0x4ab2fc};removeReferences(_0x4a0b0f,null);return db[_0x2ce6('0x34')][_0x2ce6('0x90')](_0x1c29b4)[_0x2ce6('0x2c')](function(_0x1299e7){var _0x392dcb={'role':_0x251fe7['body'][_0x2ce6('0x91')],'userProfileId':_0x251fe7[_0x2ce6('0x92')][_0x2ce6('0x93')]};if(!_0x392dcb)throw new Error(_0x2ce6('0x94'));if(_0x392dcb[_0x2ce6('0x91')]===_0x2ce6('0x95')){var _0x4175b9=_0x1299e7[_0x2ce6('0x96')]({'plain':!![]});return db[_0x2ce6('0x97')][_0x2ce6('0x4d')]({'where':{'name':_0x2ce6('0x2e'),'userProfileId':_0x392dcb[_0x2ce6('0x93')]},'raw':!![]})['then'](function(_0x533cc4){if(_0x533cc4&&_0x533cc4[_0x2ce6('0x98')]===0x0){return db[_0x2ce6('0x2f')][_0x2ce6('0x90')]({'name':_0x4175b9[_0x2ce6('0x39')],'resourceId':_0x4175b9['id'],'type':_0x533cc4[_0x2ce6('0x39')],'sectionId':_0x533cc4['id']},{})[_0x2ce6('0x2c')](function(){return _0x1299e7;});}else{return _0x1299e7;}})['catch'](function(_0x1d265b){logger[_0x2ce6('0x56')](_0x2ce6('0x99'),_0x1d265b);throw _0x1d265b;});}return _0x1299e7;})[_0x2ce6('0x2c')](respondWithResult(_0x14e5af,null))[_0x2ce6('0x68')](handleError(_0x14e5af,null));}});}catch(_0x56cb24){_0x14e5af[_0x2ce6('0x21')](0x1f4)[_0x2ce6('0x31')](_0x56cb24);}};function removeReferences(_0x95dbea,_0x48d6a8){try{if(_0x95dbea){fs[_0x2ce6('0x64')](_0x95dbea);logger[_0x2ce6('0x65')]('Zip\x20archive\x20removed');}if(_0x48d6a8){rimraf(_0x48d6a8,function(){});logger['info'](_0x2ce6('0x9a'));}}catch(_0x51a112){logger[_0x2ce6('0x56')](_0x51a112);}}exports[_0x2ce6('0x9b')]=function(_0x178ad0,_0xc977c9,_0x151175){return db[_0x2ce6('0x34')]['find']({'where':{'id':_0x178ad0[_0x2ce6('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc977c9,null))[_0x2ce6('0x2c')](saveUpdates(_0x178ad0[_0x2ce6('0x92')],null))[_0x2ce6('0x2c')](respondWithResult(_0xc977c9,null))[_0x2ce6('0x68')](handleError(_0xc977c9,null));};exports[_0x2ce6('0x9c')]=function(_0x31d8f5,_0x3aaf86,_0x2da94a){return db[_0x2ce6('0x34')][_0x2ce6('0x4d')]({'where':{'id':_0x31d8f5[_0x2ce6('0x4c')]['id']}})[_0x2ce6('0x2c')](function(_0x16b23e){if(_0x16b23e){return _0x16b23e['destroy']();}})[_0x2ce6('0x2c')](function(_0x20d4bd){rimraf(path[_0x2ce6('0x4f')](config[_0x2ce6('0x50')],_0x2ce6('0x5c'),path[_0x2ce6('0x5d')](_0x20d4bd[_0x2ce6('0x9')])),function(){});return _0x20d4bd;})[_0x2ce6('0x2c')](handleEntityNotFound(_0x3aaf86,null))['then'](respondWithStatusCode(_0x3aaf86,null))[_0x2ce6('0x68')](handleError(_0x3aaf86,null));};exports['webhookGet']=function(_0x45a919,_0x5916ca,_0x50f604){return BPromise['resolve']()[_0x2ce6('0x2c')](function(){if(!_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x9')]){throw new Error(_0x2ce6('0x9d'));}if(!_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x9e')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x524880=_0x45a919['query'][_0x2ce6('0x9f')]?_0x45a919[_0x2ce6('0x3b')]['hostname']+':'+_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x9e')]:'http://localhost:'+_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x9e')];var _0x21377a=_0x45a919['query'][_0x2ce6('0x23')]?_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x23')]:!![];var _0x408128=_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0xa0')]?_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0xa0')]:null;var _0x1bd143={'method':_0x45a919[_0x2ce6('0xa1')],'uri':util['format'](_0x2ce6('0xa2'),_0x524880,_0x45a919[_0x2ce6('0x3b')]['path']),'json':_0x21377a,'resolveWithFullResponse':!![],'encoding':_0x408128,'qs':_0x45a919['query']};if(_0x45a919[_0x2ce6('0xa3')]){_0x1bd143['headers']=_0x45a919[_0x2ce6('0xa3')];if(_0x1bd143['headers']['content-length']){delete _0x1bd143[_0x2ce6('0xa3')]['content-length'];}}if(_0x1bd143['headers'][_0x2ce6('0xa4')]){delete _0x1bd143['headers'][_0x2ce6('0xa4')];}return rp(_0x1bd143);})[_0x2ce6('0x2c')](function(_0x577fd3){if(_0x577fd3){_0x5916ca['set'](_0x577fd3[_0x2ce6('0xa3')]);logger[_0x2ce6('0x65')](_0x577fd3[_0x2ce6('0x92')]);if(_[_0x2ce6('0xa5')](_0x45a919['query'][_0x2ce6('0x9')],_0x2ce6('0x4e'))&&_0x577fd3[_0x2ce6('0xa6')]==0x1f4){return _0x5916ca[_0x2ce6('0x20')](_0x577fd3[_0x2ce6('0xa6')]);}else{return _0x5916ca[_0x2ce6('0x21')](_0x577fd3[_0x2ce6('0xa6')])[_0x2ce6('0x31')](_0x577fd3[_0x2ce6('0x92')]);}}else{return _0x5916ca[_0x2ce6('0x20')](0xc8);}})[_0x2ce6('0x68')](handleError(_0x5916ca,null));};exports[_0x2ce6('0xa7')]=function(_0x3151db,_0xc53e62,_0x2e2439){return BPromise[_0x2ce6('0xa8')]()[_0x2ce6('0x2c')](function(){if(!_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9')]){throw new Error(_0x2ce6('0x9d'));}if(!_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9e')]){throw new Error(_0x2ce6('0xa9'));}var _0x5ebaf1=_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9f')]?_0x3151db['query']['hostname']+':'+_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9e')]:_0x2ce6('0xaa')+_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9e')];var _0x5845a4=_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x23')]?_0x3151db['query'][_0x2ce6('0x23')]:!![];var _0x4fcac=_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0xa0')]?_0x3151db['query']['encoding']:null;var _0x5a820d={'method':_0x3151db['method'],'uri':util[_0x2ce6('0x51')](_0x2ce6('0xa2'),_0x5ebaf1,_0x3151db['query'][_0x2ce6('0x9')]),'json':_0x5845a4,'resolveWithFullResponse':!![],'encoding':_0x4fcac,'body':_0x3151db[_0x2ce6('0x92')]};if(_0x3151db['headers']){_0x5a820d[_0x2ce6('0xa3')]=_0x3151db[_0x2ce6('0xa3')];if(_0x5a820d['headers'][_0x2ce6('0xab')]){delete _0x5a820d['headers'][_0x2ce6('0xab')];}}if(_0x5a820d['headers'][_0x2ce6('0xa4')]){delete _0x5a820d[_0x2ce6('0xa3')]['content-type'];}return rp(_0x5a820d);})[_0x2ce6('0x2c')](function(_0x37899a){if(_0x37899a){_0xc53e62[_0x2ce6('0x28')](_0x37899a[_0x2ce6('0xa3')]);logger['info'](_0x37899a['body']);return _0xc53e62[_0x2ce6('0x21')](_0x37899a['statusCode'])[_0x2ce6('0x31')](_0x37899a[_0x2ce6('0x92')]);}else{return _0xc53e62['sendStatus'](0xc8);}})[_0x2ce6('0x68')](handleError(_0xc53e62,null));}; \ No newline at end of file +var _0xfc2b=['parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','headers','content-length','content-type','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','eml-format','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','extract-zip','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','stack','send','Plugin','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','name','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','download','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0xfc2b,0x187));var _0xbfc2=function(_0x14de88,_0x5deaa3){_0x14de88=_0x14de88-0x0;var _0x295cef=_0xfc2b[_0x14de88];return _0x295cef;};'use strict';var emlformat=require(_0xbfc2('0x0'));var rimraf=require(_0xbfc2('0x1'));var zipdir=require(_0xbfc2('0x2'));var jsonpatch=require(_0xbfc2('0x3'));var rp=require(_0xbfc2('0x4'));var moment=require(_0xbfc2('0x5'));var BPromise=require(_0xbfc2('0x6'));var Mustache=require(_0xbfc2('0x7'));var util=require(_0xbfc2('0x8'));var path=require(_0xbfc2('0x9'));var sox=require(_0xbfc2('0xa'));var csv=require('to-csv');var ejs=require(_0xbfc2('0xb'));var fs=require('fs');var fs_extra=require(_0xbfc2('0xc'));var _=require(_0xbfc2('0xd'));var squel=require(_0xbfc2('0xe'));var crypto=require(_0xbfc2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbfc2('0x10'));var toCsv=require(_0xbfc2('0x11'));var querystring=require(_0xbfc2('0x12'));var Papa=require(_0xbfc2('0x13'));var extract=require(_0xbfc2('0x14'));var rimraf=require(_0xbfc2('0x1'));var archiver=require('archiver');var Redis=require(_0xbfc2('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xbfc2('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfc2('0x17'));var logger=require(_0xbfc2('0x18'))(_0xbfc2('0x19'));var utils=require(_0xbfc2('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbfc2('0x1b'))['db'];config[_0xbfc2('0x1c')]=_[_0xbfc2('0x1d')](config[_0xbfc2('0x1c')],{'host':_0xbfc2('0x1e'),'port':0x18eb});var socket=require(_0xbfc2('0x1f'))(new Redis(config['redis']));require(_0xbfc2('0x20'))[_0xbfc2('0x21')](socket);function respondWithStatusCode(_0xb2dfa2,_0x30b1f0){_0x30b1f0=_0x30b1f0||0xcc;return function(_0xa74432){if(_0xa74432){return _0xb2dfa2[_0xbfc2('0x22')](_0x30b1f0);}return _0xb2dfa2[_0xbfc2('0x23')](_0x30b1f0)[_0xbfc2('0x24')]();};}function respondWithResult(_0x4b1c82,_0xb61894){_0xb61894=_0xb61894||0xc8;return function(_0x3179b2){if(_0x3179b2){return _0x4b1c82[_0xbfc2('0x23')](_0xb61894)['json'](_0x3179b2);}};}function respondWithFilteredResult(_0x25da74,_0x53bc5e){return function(_0xd05c04){if(_0xd05c04){var _0x4fbd3a=typeof _0x53bc5e['offset']==='undefined'&&typeof _0x53bc5e['limit']===_0xbfc2('0x25');var _0x16f487=_0xd05c04[_0xbfc2('0x26')];var _0x4e57a6=_0x4fbd3a?0x0:_0x53bc5e['offset'];var _0x133841=_0x4fbd3a?_0xd05c04[_0xbfc2('0x26')]:_0x53bc5e[_0xbfc2('0x27')]+_0x53bc5e[_0xbfc2('0x28')];var _0x1e1291;if(_0x133841>=_0x16f487){_0x133841=_0x16f487;_0x1e1291=0xc8;}else{_0x1e1291=0xce;}_0x25da74['status'](_0x1e1291);return _0x25da74[_0xbfc2('0x29')](_0xbfc2('0x2a'),_0x4e57a6+'-'+_0x133841+'/'+_0x16f487)[_0xbfc2('0x2b')](_0xd05c04);}return null;};}function patchUpdates(_0x8e8769){return function(_0x390c0a){try{jsonpatch[_0xbfc2('0x2c')](_0x390c0a,_0x8e8769,!![]);}catch(_0x460d26){return BPromise[_0xbfc2('0x2d')](_0x460d26);}return _0x390c0a[_0xbfc2('0x2e')]();};}function saveUpdates(_0x269be0,_0xef364a){return function(_0x6ce32b){if(_0x6ce32b){return _0x6ce32b[_0xbfc2('0x2f')](_0x269be0)['then'](function(_0x20d284){return _0x20d284;});}return null;};}function removeEntity(_0x1ddba1,_0x295529){return function(_0xe86517){if(_0xe86517){return _0xe86517[_0xbfc2('0x30')]()[_0xbfc2('0x31')](function(){var _0x755c28=_0xe86517[_0xbfc2('0x32')]({'plain':!![]});var _0x119f68=_0xbfc2('0x33');return db[_0xbfc2('0x34')]['destroy']({'where':{'type':_0x119f68,'resourceId':_0x755c28['id']}})[_0xbfc2('0x31')](function(){return _0xe86517;});})[_0xbfc2('0x31')](function(){_0x1ddba1[_0xbfc2('0x23')](0xcc)[_0xbfc2('0x24')]();});}};}function handleEntityNotFound(_0x50cf32,_0x463cc4){return function(_0x5f0628){if(!_0x5f0628){_0x50cf32[_0xbfc2('0x22')](0x194);}return _0x5f0628;};}function handleError(_0x4bb6f2,_0x593fc9){_0x593fc9=_0x593fc9||0x1f4;return function(_0x45cee9){logger['error'](_0x45cee9[_0xbfc2('0x35')]);if(_0x45cee9['name']){delete _0x45cee9['name'];}_0x4bb6f2[_0xbfc2('0x23')](_0x593fc9)[_0xbfc2('0x36')](_0x45cee9);};}exports['index']=function(_0x167f9e,_0x32a47){var _0x202e25={},_0x1666a8={},_0x33d03b={'count':0x0,'rows':[]};var _0x5709d2=_['map'](db[_0xbfc2('0x37')]['rawAttributes'],function(_0x354aae){return{'name':_0x354aae[_0xbfc2('0x38')],'type':_0x354aae[_0xbfc2('0x39')]['key']};});_0x1666a8[_0xbfc2('0x3a')]=_[_0xbfc2('0x3b')](_0x5709d2,'name');_0x1666a8[_0xbfc2('0x3c')]=_[_0xbfc2('0x3d')](_0x167f9e['query']);_0x1666a8[_0xbfc2('0x3e')]=_['intersection'](_0x1666a8['model'],_0x1666a8[_0xbfc2('0x3c')]);_0x202e25[_0xbfc2('0x3f')]=_[_0xbfc2('0x40')](_0x1666a8[_0xbfc2('0x3a')],qs[_0xbfc2('0x41')](_0x167f9e[_0xbfc2('0x3c')][_0xbfc2('0x41')]));_0x202e25[_0xbfc2('0x3f')]=_0x202e25[_0xbfc2('0x3f')][_0xbfc2('0x42')]?_0x202e25[_0xbfc2('0x3f')]:_0x1666a8[_0xbfc2('0x3a')];if(!_0x167f9e[_0xbfc2('0x3c')]['hasOwnProperty']('nolimit')){_0x202e25[_0xbfc2('0x28')]=qs['limit'](_0x167f9e[_0xbfc2('0x3c')][_0xbfc2('0x28')]);_0x202e25['offset']=qs[_0xbfc2('0x27')](_0x167f9e[_0xbfc2('0x3c')][_0xbfc2('0x27')]);}_0x202e25['order']=qs[_0xbfc2('0x43')](_0x167f9e[_0xbfc2('0x3c')][_0xbfc2('0x43')]);_0x202e25[_0xbfc2('0x44')]=qs[_0xbfc2('0x3e')](_[_0xbfc2('0x45')](_0x167f9e[_0xbfc2('0x3c')],_0x1666a8[_0xbfc2('0x3e')]),_0x5709d2);if(_0x167f9e[_0xbfc2('0x3c')][_0xbfc2('0x46')]){_0x202e25[_0xbfc2('0x44')]=_[_0xbfc2('0x47')](_0x202e25[_0xbfc2('0x44')],{'$or':_['map'](_0x5709d2,function(_0x45cf02){if(_0x45cf02[_0xbfc2('0x39')]!=='VIRTUAL'){var _0xffbedd={};_0xffbedd[_0x45cf02[_0xbfc2('0x48')]]={'$like':'%'+_0x167f9e[_0xbfc2('0x3c')]['filter']+'%'};return _0xffbedd;}})});}_0x202e25=_[_0xbfc2('0x47')]({},_0x202e25,_0x167f9e[_0xbfc2('0x49')]);var _0x1c9ae8={'where':_0x202e25[_0xbfc2('0x44')]};return db[_0xbfc2('0x37')][_0xbfc2('0x26')](_0x1c9ae8)[_0xbfc2('0x31')](function(_0x4fadf6){_0x33d03b['count']=_0x4fadf6;if(_0x167f9e[_0xbfc2('0x3c')]['includeAll']){_0x202e25[_0xbfc2('0x4a')]=[{'all':!![]}];}return db[_0xbfc2('0x37')][_0xbfc2('0x4b')](_0x202e25);})[_0xbfc2('0x31')](function(_0x7c2a50){_0x33d03b[_0xbfc2('0x4c')]=_0x7c2a50;return _0x33d03b;})[_0xbfc2('0x31')](respondWithFilteredResult(_0x32a47,_0x202e25))[_0xbfc2('0x4d')](handleError(_0x32a47,null));};exports[_0xbfc2('0x4e')]=function(_0x36f73a,_0x38854a){var _0x1d9600={'raw':!![],'where':{'id':_0x36f73a[_0xbfc2('0x4f')]['id']}},_0x55c768={};_0x55c768[_0xbfc2('0x3a')]=_[_0xbfc2('0x3d')](db[_0xbfc2('0x37')][_0xbfc2('0x50')]);_0x55c768[_0xbfc2('0x3c')]=_[_0xbfc2('0x3d')](_0x36f73a['query']);_0x55c768[_0xbfc2('0x3e')]=_[_0xbfc2('0x40')](_0x55c768[_0xbfc2('0x3a')],_0x55c768[_0xbfc2('0x3c')]);_0x1d9600[_0xbfc2('0x3f')]=_['intersection'](_0x55c768['model'],qs[_0xbfc2('0x41')](_0x36f73a[_0xbfc2('0x3c')][_0xbfc2('0x41')]));_0x1d9600['attributes']=_0x1d9600[_0xbfc2('0x3f')][_0xbfc2('0x42')]?_0x1d9600['attributes']:_0x55c768['model'];if(_0x36f73a['query'][_0xbfc2('0x51')]){_0x1d9600[_0xbfc2('0x4a')]=[{'all':!![]}];}_0x1d9600=_[_0xbfc2('0x47')]({},_0x1d9600,_0x36f73a[_0xbfc2('0x49')]);return db[_0xbfc2('0x37')][_0xbfc2('0x52')](_0x1d9600)[_0xbfc2('0x31')](handleEntityNotFound(_0x38854a,null))[_0xbfc2('0x31')](respondWithResult(_0x38854a,null))[_0xbfc2('0x4d')](handleError(_0x38854a,null));};exports[_0xbfc2('0x53')]=function(_0x2aa774,_0x467414,_0x28c88d){return db[_0xbfc2('0x37')][_0xbfc2('0x52')]({'where':{'id':_0x2aa774[_0xbfc2('0x4f')]['id']},'attributes':[_0xbfc2('0x48'),_0xbfc2('0x9')],'raw':!![]})[_0xbfc2('0x31')](handleEntityNotFound(_0x467414,null))[_0xbfc2('0x31')](function(_0x44d680){if(_0x44d680){var _0x29fab3=path['join'](config[_0xbfc2('0x54')],_0xbfc2('0x55'),util['format'](_0xbfc2('0x56'),path[_0xbfc2('0x57')](_0x44d680[_0xbfc2('0x9')])));var _0x1c7381=fs[_0xbfc2('0x58')](_0x29fab3);var _0x280e53=archiver(_0xbfc2('0x59'),{'zlib':{'level':0x9}});_0x280e53['on']('warning',function(_0x3ab77d){if(_0x3ab77d[_0xbfc2('0x5a')]==='ENOENT'){logger[_0xbfc2('0x5b')](_0x3ab77d);}else{throw new db[(_0xbfc2('0x5c'))][(_0xbfc2('0x5d'))](_0xbfc2('0x5e'));}});_0x280e53['on'](_0xbfc2('0x5b'),function(_0x2daa77){throw new db[(_0xbfc2('0x5c'))][(_0xbfc2('0x5d'))](_0xbfc2('0x5e'));});_0x280e53[_0xbfc2('0x5f')](_0x1c7381);_0x280e53[_0xbfc2('0x60')]('**/*',{'cwd':path[_0xbfc2('0x61')](config['root'],_0xbfc2('0x55'),path[_0xbfc2('0x62')](_0x44d680[_0xbfc2('0x9')])),'ignore':[path['join'](path['basename'](_0x44d680[_0xbfc2('0x9')]),_0xbfc2('0x63')),path[_0xbfc2('0x61')](path['basename'](_0x44d680['path']),_0xbfc2('0x64'))],'nodir':!![]})[_0xbfc2('0x65')]();_0x1c7381['on'](_0xbfc2('0x66'),function(){if(!fs[_0xbfc2('0x67')](_0x29fab3)){throw new db['Sequelize'][(_0xbfc2('0x5d'))](_0xbfc2('0x68'));}return _0x467414['download'](_0x29fab3,util[_0xbfc2('0x69')](_0xbfc2('0x56'),path[_0xbfc2('0x57')](_0x44d680['path'])),function(_0x22ba08){if(_0x22ba08){throw new db['Sequelize']['Error'](_0xbfc2('0x6a'));}fs[_0xbfc2('0x6b')](_0x29fab3);logger[_0xbfc2('0x6c')](_0xbfc2('0x6d'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0xbfc2('0x4d')](handleError(_0x467414,null));};exports[_0xbfc2('0x6e')]=function(_0x13f27b,_0x2df093,_0x54a89c){var _0x58573b=path[_0xbfc2('0x57')](_0x13f27b[_0xbfc2('0x6f')]['filename'],path['extname'](_0x13f27b[_0xbfc2('0x6f')]['filename']));var _0x4e2aeb=path[_0xbfc2('0x61')](config['root'],'server/files/plugins',_0x13f27b['file'][_0xbfc2('0x70')]);var _0x2a0185=path['join'](config['root'],'server/files/plugins',_0x58573b);logger[_0xbfc2('0x6c')]('Plugin\x20upload\x20filepath:\x20%s',_0x4e2aeb);logger[_0xbfc2('0x6c')](_0xbfc2('0x71'),_0x2a0185);try{fs[_0xbfc2('0x72')](_0x4e2aeb,parseInt(_0xbfc2('0x73'),0x8));extract(_0x4e2aeb,{'dir':_0x2a0185},function(_0x870524){if(_0x870524){logger[_0xbfc2('0x5b')](_0x870524);handleError(_0x870524,!![]);};var _0x3db93b=fs[_0xbfc2('0x74')](_0x2a0185);if(_0x3db93b[_0xbfc2('0x42')]>0x1){removeReferences(_0x4e2aeb,_0x2a0185);logger[_0xbfc2('0x5b')](_0xbfc2('0x75'));return _0x54a89c(new Error(_0xbfc2('0x75')));}var _0x253feb=fs[_0xbfc2('0x76')](path['join'](_0x2a0185,_0x3db93b[0x0]));if(_0x253feb[_0xbfc2('0x77')]()){removeReferences(_0x4e2aeb,_0x2a0185);logger[_0xbfc2('0x5b')](_0xbfc2('0x75'));return _0x54a89c(new Error(_0xbfc2('0x75')));}if(_0x253feb['isDirectory']()){var _0x47338d=fs[_0xbfc2('0x74')](path[_0xbfc2('0x61')](_0x2a0185,_0x3db93b[0x0]));if(_0x47338d[_0xbfc2('0x42')]===0x0){removeReferences(_0x4e2aeb,_0x2a0185);logger[_0xbfc2('0x5b')](_0xbfc2('0x75'));return _0x54a89c(new Error('Invalid\x20plugin\x20structure'));}var _0x4eadca=_0x47338d[_0xbfc2('0x78')](function(_0x5eef86){return _0x5eef86===_0xbfc2('0x79');});if(!_0x4eadca){return _0x54a89c(new Error('Plugin\x20manifest\x20missing'));}var _0x5daa1a=fs['readFileSync'](path[_0xbfc2('0x61')](_0x2a0185,_0x3db93b[0x0],'manifest.json'));var _0x2d7c2c=JSON[_0xbfc2('0x7a')](_0x5daa1a);if(_0xbfc2('0x25')==typeof _0x2d7c2c[_0xbfc2('0x48')]){return _0x54a89c(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xbfc2('0x25')==typeof _0x2d7c2c['type']){return _0x54a89c(new Error(_0xbfc2('0x7b')));}if(_0xbfc2('0x25')==typeof _0x2d7c2c[_0xbfc2('0x7c')]){return _0x54a89c(new Error(_0xbfc2('0x7d')));}if(_0xbfc2('0x25')==typeof _0x2d7c2c[_0xbfc2('0x7e')]){return _0x54a89c(new Error(_0xbfc2('0x7f')));}if(_0x2d7c2c[_0xbfc2('0x39')]===_0xbfc2('0x80')){if('undefined'==typeof _0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x81')]){return _0x54a89c(new Error(_0xbfc2('0x82')));}if('undefined'==typeof _0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x81')][_0xbfc2('0x83')]&&_0xbfc2('0x25')==typeof _0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x81')][_0xbfc2('0x84')]){return _0x54a89c(new Error(_0xbfc2('0x85')));}}else if(_0x2d7c2c[_0xbfc2('0x39')]==='script'){if(_0xbfc2('0x25')==typeof _0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x86')]){return _0x54a89c(new Error(_0xbfc2('0x87')));}if(_0xbfc2('0x25')==typeof _0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x88')]){return _0x54a89c(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x54a89c(new Error(_0xbfc2('0x89')));}var _0x4f4136=_0x2d7c2c[_0xbfc2('0x48')];var _0x589591=_0x2d7c2c[_0xbfc2('0x8a')];var _0x2a7e14=_0x2d7c2c[_0xbfc2('0x39')];var _0x4fd65b=_0x2d7c2c[_0xbfc2('0x8b')]?_0x2d7c2c[_0xbfc2('0x8b')]:_0xbfc2('0x8c');var _0x49fed1=_0x2d7c2c[_0xbfc2('0x8d')]?_0x2d7c2c[_0xbfc2('0x8d')]:_0xbfc2('0x8e');var _0x40f88d='';var _0x3bb7f4='';var _0xf5806d='';var _0x95affc='';var _0x17d80d=_0x2d7c2c[_0xbfc2('0x7c')];if(_0x2a7e14===_0xbfc2('0x80')){if('undefined'!=typeof _0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x81')][_0xbfc2('0x83')]){var _0x3b0d1b=_0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x81')][_0xbfc2('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xbfc2('0x8f')](_0x3b0d1b)){_0x40f88d=path['join'](_0xbfc2('0x90'),_0x58573b,_0x3db93b[0x0],_0x3b0d1b);}else{_0x40f88d=_0x3b0d1b;}}else{logger[_0xbfc2('0x6c')](_0xbfc2('0x91'));}if(_0xbfc2('0x25')!=typeof _0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x81')][_0xbfc2('0x84')]){var _0x39d0ba=_0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xbfc2('0x8f')](_0x39d0ba)){_0x3bb7f4=path['join'](_0xbfc2('0x90'),_0x58573b,_0x3db93b[0x0],_0x39d0ba);}else{_0x3bb7f4=_0x39d0ba;}}else{logger[_0xbfc2('0x6c')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2a7e14==='script'){_0xf5806d=_0x2d7c2c['parameters'][_0xbfc2('0x86')];_0x95affc=_0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x88')];if(_0xbfc2('0x25')!=typeof _0x2d7c2c[_0xbfc2('0x7e')][_0xbfc2('0x81')]){if(_0xbfc2('0x25')!=typeof _0x2d7c2c['parameters'][_0xbfc2('0x81')]['admin']){var _0x3b0d1b=_0x2d7c2c[_0xbfc2('0x7e')]['views'][_0xbfc2('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xbfc2('0x8f')](_0x3b0d1b)){_0x40f88d=path[_0xbfc2('0x61')](_0xbfc2('0x90'),_0x58573b,_0x3db93b[0x0],_0x3b0d1b);}else{_0x40f88d=_0x3b0d1b;}}if('undefined'!=typeof _0x2d7c2c['parameters'][_0xbfc2('0x81')][_0xbfc2('0x84')]){var _0x39d0ba=_0x2d7c2c['parameters'][_0xbfc2('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xbfc2('0x8f')](_0x39d0ba)){_0x3bb7f4=path[_0xbfc2('0x61')]('plugins',_0x58573b,_0x3db93b[0x0],_0x39d0ba);}else{_0x3bb7f4=_0x39d0ba;}}}}var _0x59982b={'name':_0x4f4136,'description':_0x589591,'path':path[_0xbfc2('0x61')](_0x58573b,_0x3db93b[0x0]),'type':_0x2a7e14,'sidebar':_0x4fd65b,'icon':_0x49fed1,'adminUrl':_0x40f88d,'agentUrl':_0x3bb7f4,'scriptName':_0xf5806d,'scriptPath':_0x95affc,'version':_0x17d80d};removeReferences(_0x4e2aeb,null);return db[_0xbfc2('0x37')][_0xbfc2('0x92')](_0x59982b)['then'](function(_0x239b71){var _0x3d10d4={'role':_0x13f27b[_0xbfc2('0x93')]['role'],'userProfileId':_0x13f27b[_0xbfc2('0x93')]['userProfileId']};if(!_0x3d10d4)throw new Error(_0xbfc2('0x94'));if(_0x3d10d4[_0xbfc2('0x95')]==='user'){var _0x4577bf=_0x239b71[_0xbfc2('0x32')]({'plain':!![]});return db[_0xbfc2('0x96')][_0xbfc2('0x52')]({'where':{'name':_0xbfc2('0x33'),'userProfileId':_0x3d10d4[_0xbfc2('0x97')]},'raw':!![]})['then'](function(_0x1dfa21){if(_0x1dfa21&&_0x1dfa21[_0xbfc2('0x98')]===0x0){return db['UserProfileResource'][_0xbfc2('0x92')]({'name':_0x4577bf[_0xbfc2('0x48')],'resourceId':_0x4577bf['id'],'type':_0x1dfa21[_0xbfc2('0x48')],'sectionId':_0x1dfa21['id']},{})[_0xbfc2('0x31')](function(){return _0x239b71;});}else{return _0x239b71;}})[_0xbfc2('0x4d')](function(_0x36d730){logger[_0xbfc2('0x5b')](_0xbfc2('0x99'),_0x36d730);throw _0x36d730;});}return _0x239b71;})[_0xbfc2('0x31')](respondWithResult(_0x2df093,null))[_0xbfc2('0x4d')](handleError(_0x2df093,null));}});}catch(_0x48066d){_0x2df093['status'](0x1f4)['send'](_0x48066d);}};function removeReferences(_0x177c7e,_0x14604f){try{if(_0x177c7e){fs[_0xbfc2('0x6b')](_0x177c7e);logger[_0xbfc2('0x6c')](_0xbfc2('0x9a'));}if(_0x14604f){rimraf(_0x14604f,function(){});logger[_0xbfc2('0x6c')](_0xbfc2('0x9b'));}}catch(_0x3f36c0){logger[_0xbfc2('0x5b')](_0x3f36c0);}}exports['update']=function(_0x408167,_0x32f087,_0x1f6b3e){return db[_0xbfc2('0x37')][_0xbfc2('0x52')]({'where':{'id':_0x408167[_0xbfc2('0x4f')]['id']}})[_0xbfc2('0x31')](handleEntityNotFound(_0x32f087,null))['then'](saveUpdates(_0x408167[_0xbfc2('0x93')],null))[_0xbfc2('0x31')](respondWithResult(_0x32f087,null))[_0xbfc2('0x4d')](handleError(_0x32f087,null));};exports[_0xbfc2('0x9c')]=function(_0x2fbfc5,_0x59e116,_0x5e9151){return db[_0xbfc2('0x37')]['find']({'where':{'id':_0x2fbfc5[_0xbfc2('0x4f')]['id']}})['then'](function(_0x208211){if(_0x208211){return _0x208211[_0xbfc2('0x30')]();}})[_0xbfc2('0x31')](function(_0x34fd0f){rimraf(path[_0xbfc2('0x61')](config[_0xbfc2('0x54')],_0xbfc2('0x55'),path[_0xbfc2('0x62')](_0x34fd0f['path'])),function(){});return _0x34fd0f;})[_0xbfc2('0x31')](handleEntityNotFound(_0x59e116,null))[_0xbfc2('0x31')](respondWithStatusCode(_0x59e116,null))['catch'](handleError(_0x59e116,null));};exports[_0xbfc2('0x9d')]=function(_0x9c3920,_0x2c3762,_0x3da2cd){return BPromise['resolve']()['then'](function(){if(!_0x9c3920[_0xbfc2('0x3c')]['path']){throw new Error(_0xbfc2('0x9e'));}if(!_0x9c3920[_0xbfc2('0x3c')][_0xbfc2('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x453cee=_0x9c3920[_0xbfc2('0x3c')][_0xbfc2('0xa0')]?_0x9c3920[_0xbfc2('0x3c')][_0xbfc2('0xa0')]+':'+_0x9c3920[_0xbfc2('0x3c')]['port']:_0xbfc2('0xa1')+_0x9c3920['query'][_0xbfc2('0x9f')];var _0x335ed2=_0x9c3920['query'][_0xbfc2('0x2b')]?_0x9c3920[_0xbfc2('0x3c')][_0xbfc2('0x2b')]:!![];var _0x4f0db4=_0x9c3920['query'][_0xbfc2('0xa2')]?_0x9c3920['query'][_0xbfc2('0xa2')]:null;var _0x60bfcc={'method':_0x9c3920['method'],'uri':util[_0xbfc2('0x69')]('%s%s',_0x453cee,_0x9c3920[_0xbfc2('0x3c')][_0xbfc2('0x9')]),'json':_0x335ed2,'resolveWithFullResponse':!![],'encoding':_0x4f0db4,'qs':_0x9c3920[_0xbfc2('0x3c')]};if(_0x9c3920[_0xbfc2('0xa3')]){_0x60bfcc['headers']=_0x9c3920['headers'];if(_0x60bfcc[_0xbfc2('0xa3')][_0xbfc2('0xa4')]){delete _0x60bfcc[_0xbfc2('0xa3')]['content-length'];}}if(_0x60bfcc[_0xbfc2('0xa3')][_0xbfc2('0xa5')]){delete _0x60bfcc[_0xbfc2('0xa3')]['content-type'];}return rp(_0x60bfcc);})[_0xbfc2('0x31')](function(_0x49d740){if(_0x49d740){_0x2c3762[_0xbfc2('0x29')](_0x49d740[_0xbfc2('0xa3')]);logger[_0xbfc2('0x6c')](_0x49d740[_0xbfc2('0x93')]);if(_['endsWith'](_0x9c3920['query'][_0xbfc2('0x9')],_0xbfc2('0x53'))&&_0x49d740[_0xbfc2('0xa6')]==0x1f4){return _0x2c3762[_0xbfc2('0x22')](_0x49d740[_0xbfc2('0xa6')]);}else{return _0x2c3762[_0xbfc2('0x23')](_0x49d740[_0xbfc2('0xa6')])[_0xbfc2('0x36')](_0x49d740[_0xbfc2('0x93')]);}}else{return _0x2c3762[_0xbfc2('0x22')](0xc8);}})[_0xbfc2('0x4d')](handleError(_0x2c3762,null));};exports[_0xbfc2('0xa7')]=function(_0x3efa45,_0x4099a4,_0x5558fc){return BPromise[_0xbfc2('0xa8')]()[_0xbfc2('0x31')](function(){if(!_0x3efa45['query'][_0xbfc2('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3efa45[_0xbfc2('0x3c')][_0xbfc2('0x9f')]){throw new Error(_0xbfc2('0xa9'));}var _0x192e9a=_0x3efa45[_0xbfc2('0x3c')]['hostname']?_0x3efa45[_0xbfc2('0x3c')]['hostname']+':'+_0x3efa45[_0xbfc2('0x3c')][_0xbfc2('0x9f')]:_0xbfc2('0xa1')+_0x3efa45[_0xbfc2('0x3c')][_0xbfc2('0x9f')];var _0x25f0a8=_0x3efa45[_0xbfc2('0x3c')][_0xbfc2('0x2b')]?_0x3efa45['query']['json']:!![];var _0xd2bfef=_0x3efa45[_0xbfc2('0x3c')][_0xbfc2('0xa2')]?_0x3efa45[_0xbfc2('0x3c')]['encoding']:null;var _0x335c46={'method':_0x3efa45['method'],'uri':util[_0xbfc2('0x69')](_0xbfc2('0xaa'),_0x192e9a,_0x3efa45['query'][_0xbfc2('0x9')]),'json':_0x25f0a8,'resolveWithFullResponse':!![],'encoding':_0xd2bfef,'body':_0x3efa45[_0xbfc2('0x93')]};if(_0x3efa45[_0xbfc2('0xa3')]){_0x335c46[_0xbfc2('0xa3')]=_0x3efa45[_0xbfc2('0xa3')];if(_0x335c46[_0xbfc2('0xa3')]['content-length']){delete _0x335c46['headers'][_0xbfc2('0xa4')];}}if(_0x335c46['headers'][_0xbfc2('0xa5')]){delete _0x335c46[_0xbfc2('0xa3')][_0xbfc2('0xa5')];}return rp(_0x335c46);})[_0xbfc2('0x31')](function(_0x18c58c){if(_0x18c58c){_0x4099a4['set'](_0x18c58c[_0xbfc2('0xa3')]);logger[_0xbfc2('0x6c')](_0x18c58c['body']);return _0x4099a4['status'](_0x18c58c[_0xbfc2('0xa6')])[_0xbfc2('0x36')](_0x18c58c['body']);}else{return _0x4099a4[_0xbfc2('0x22')](0xc8);}})[_0xbfc2('0x4d')](handleError(_0x4099a4,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 448d728..8118ddd 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 _0x0d4d=['events','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2e91d2,_0xe35e8a){var _0x25a889=function(_0x4e0d32){while(--_0x4e0d32){_0x2e91d2['push'](_0x2e91d2['shift']());}};_0x25a889(++_0xe35e8a);}(_0x0d4d,0x132));var _0xd0d4=function(_0x3dc84d,_0x2e77f7){_0x3dc84d=_0x3dc84d-0x0;var _0x467050=_0x0d4d[_0x3dc84d];return _0x467050;};'use strict';var EventEmitter=require(_0xd0d4('0x0'));var Plugin=require(_0xd0d4('0x1'))['db'][_0xd0d4('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xd0d4('0x3')](0x0);var events={'afterCreate':_0xd0d4('0x4'),'afterUpdate':_0xd0d4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x984664){return function(_0x58909f,_0x2e99ee,_0x3787f4){PluginEvents['emit'](_0x984664+':'+_0x58909f['id'],_0x58909f);PluginEvents[_0xd0d4('0x6')](_0x984664,_0x58909f);_0x3787f4(null);};}for(var e in events){if(events[_0xd0d4('0x7')](e)){var event=events[e];Plugin[_0xd0d4('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x9300=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0x9300,0x153));var _0x0930=function(_0xa4b8e1,_0x49d30b){_0xa4b8e1=_0xa4b8e1-0x0;var _0x507e42=_0x9300[_0xa4b8e1];return _0x507e42;};'use strict';var EventEmitter=require(_0x0930('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x0930('0x1')](0x0);var events={'afterCreate':_0x0930('0x2'),'afterUpdate':_0x0930('0x3'),'afterDestroy':_0x0930('0x4')};function emitEvent(_0x4130f8){return function(_0x49d993,_0x298c01,_0x1a61a6){PluginEvents['emit'](_0x4130f8+':'+_0x49d993['id'],_0x49d993);PluginEvents[_0x0930('0x5')](_0x4130f8,_0x49d993);_0x1a61a6(null);};}for(var e in events){if(events[_0x0930('0x6')](e)){var event=events[e];Plugin[_0x0930('0x7')](e,emitEvent(event));}}module[_0x0930('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index bfaa156..3ea084e 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 _0xb2f1=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x45e911,_0x517109){var _0x5df6b1=function(_0xa72468){while(--_0xa72468){_0x45e911['push'](_0x45e911['shift']());}};_0x5df6b1(++_0x517109);}(_0xb2f1,0x115));var _0x1b2f=function(_0x296c52,_0x1b48c4){_0x296c52=_0x296c52-0x0;var _0x2564e8=_0xb2f1[_0x296c52];return _0x2564e8;};'use strict';var _=require(_0x1b2f('0x0'));var util=require(_0x1b2f('0x1'));var logger=require(_0x1b2f('0x2'))(_0x1b2f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b2f('0x4'));var fs=require('fs');var path=require(_0x1b2f('0x5'));var rimraf=require(_0x1b2f('0x6'));var config=require(_0x1b2f('0x7'));var attributes=require(_0x1b2f('0x8'));module[_0x1b2f('0x9')]=function(_0x7425f9,_0x37f00c){return _0x7425f9[_0x1b2f('0xa')](_0x1b2f('0xb'),attributes,{'tableName':_0x1b2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9175=['moment','request-promise','path','rimraf','./plugin.attributes','exports','plugins','util'];(function(_0x36aec9,_0x2749de){var _0x444f7f=function(_0x562129){while(--_0x562129){_0x36aec9['push'](_0x36aec9['shift']());}};_0x444f7f(++_0x2749de);}(_0x9175,0x14f));var _0x5917=function(_0x328b11,_0x384637){_0x328b11=_0x328b11-0x0;var _0x4dde80=_0x9175[_0x328b11];return _0x4dde80;};'use strict';var _=require('lodash');var util=require(_0x5917('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5917('0x1'));var BPromise=require('bluebird');var rp=require(_0x5917('0x2'));var fs=require('fs');var path=require(_0x5917('0x3'));var rimraf=require(_0x5917('0x4'));var config=require('../../config/environment');var attributes=require(_0x5917('0x5'));module[_0x5917('0x6')]=function(_0x2ee53c,_0x76a2b8){return _0x2ee53c['define']('Plugin',attributes,{'tableName':_0x5917('0x7'),'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 c2f9e52..5a04687 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 _0xd2fc=['then','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','CreatePlugin','Plugin','create','body','options','info','stringify','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2fc,0xf8));var _0xcd2f=function(_0x219fa8,_0x186320){_0x219fa8=_0x219fa8-0x0;var _0x352d42=_0xd2fc[_0x219fa8];return _0x352d42;};'use strict';var _=require('lodash');var util=require(_0xcd2f('0x0'));var moment=require('moment');var BPromise=require(_0xcd2f('0x1'));var rs=require(_0xcd2f('0x2'));var fs=require('fs');var Redis=require(_0xcd2f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd2f('0x4'))('rpc');var config=require(_0xcd2f('0x5'));var jayson=require(_0xcd2f('0x6'));var client=jayson[_0xcd2f('0x7')]['http']({'port':0x232a});config[_0xcd2f('0x8')]=_[_0xcd2f('0x9')](config['redis'],{'host':_0xcd2f('0xa'),'port':0x18eb});var socket=require(_0xcd2f('0xb'))(new Redis(config[_0xcd2f('0x8')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x59fb7f,_0x154225,_0x52aea2){return new BPromise(function(_0x1209be,_0x12375b){return client[_0xcd2f('0xc')](_0x59fb7f,_0x52aea2)[_0xcd2f('0xd')](function(_0x560f2c){logger['info'](_0xcd2f('0xe'),_0x154225,'request\x20sent');logger[_0xcd2f('0xf')](_0xcd2f('0x10'),_0x154225,'request\x20sent',JSON['stringify'](_0x560f2c));if(_0x560f2c['error']){if(_0x560f2c[_0xcd2f('0x11')]['code']===0x1f4){logger['error'](_0xcd2f('0xe'),_0x154225,_0x560f2c['error'][_0xcd2f('0x12')]);return _0x12375b(_0x560f2c[_0xcd2f('0x11')][_0xcd2f('0x12')]);}logger[_0xcd2f('0x11')](_0xcd2f('0xe'),_0x154225,_0x560f2c['error']['message']);return _0x1209be(_0x560f2c[_0xcd2f('0x11')]['message']);}else{logger['info'](_0xcd2f('0xe'),_0x154225,_0xcd2f('0x13'));_0x1209be(_0x560f2c[_0xcd2f('0x14')][_0xcd2f('0x12')]);}})[_0xcd2f('0x15')](function(_0x5450c4){logger[_0xcd2f('0x11')]('Plugin,\x20%s,\x20%s',_0x154225,_0x5450c4);_0x12375b(_0x5450c4);});});}exports[_0xcd2f('0x16')]=function(_0x4a948f){var _0x3888ac=this;return new Promise(function(_0x122af5,_0x487723){return db[_0xcd2f('0x17')][_0xcd2f('0x18')](_0x4a948f[_0xcd2f('0x19')],{'raw':_0x4a948f[_0xcd2f('0x1a')]?_0x4a948f[_0xcd2f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xcd2f('0xd')](function(_0x145297){logger[_0xcd2f('0x1b')]('CreatePlugin',_0x4a948f);logger[_0xcd2f('0xf')](_0xcd2f('0x16'),_0x4a948f,JSON[_0xcd2f('0x1c')](_0x145297));_0x122af5(_0x145297);})[_0xcd2f('0x15')](function(_0xfc15b9){logger[_0xcd2f('0x11')]('CreatePlugin',_0xfc15b9[_0xcd2f('0x12')],_0x4a948f);_0x487723(_0x3888ac[_0xcd2f('0x11')](0x1f4,_0xfc15b9[_0xcd2f('0x12')]));});});}; \ No newline at end of file +var _0xcd4d=['Plugin','create','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin'];(function(_0x27416f,_0x116a6d){var _0x29a269=function(_0x3ba30e){while(--_0x3ba30e){_0x27416f['push'](_0x27416f['shift']());}};_0x29a269(++_0x116a6d);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x15b857,_0x585007){_0x15b857=_0x15b857-0x0;var _0x22539c=_0xcd4d[_0x15b857];return _0x22539c;};'use strict';var _=require(_0xdcd4('0x0'));var util=require(_0xdcd4('0x1'));var moment=require('moment');var BPromise=require(_0xdcd4('0x2'));var rs=require(_0xdcd4('0x3'));var fs=require('fs');var Redis=require(_0xdcd4('0x4'));var db=require(_0xdcd4('0x5'))['db'];var utils=require(_0xdcd4('0x6'));var logger=require(_0xdcd4('0x7'))(_0xdcd4('0x8'));var config=require(_0xdcd4('0x9'));var jayson=require(_0xdcd4('0xa'));var client=jayson[_0xdcd4('0xb')][_0xdcd4('0xc')]({'port':0x232a});config[_0xdcd4('0xd')]=_[_0xdcd4('0xe')](config[_0xdcd4('0xd')],{'host':_0xdcd4('0xf'),'port':0x18eb});var socket=require(_0xdcd4('0x10'))(new Redis(config['redis']));require(_0xdcd4('0x11'))[_0xdcd4('0x12')](socket);function respondWithRpcPromise(_0x56f35b,_0x3cbcec,_0x961547){return new BPromise(function(_0x47549c,_0x35e653){return client[_0xdcd4('0x13')](_0x56f35b,_0x961547)['then'](function(_0x282913){logger[_0xdcd4('0x14')](_0xdcd4('0x15'),_0x3cbcec,_0xdcd4('0x16'));logger[_0xdcd4('0x17')]('Plugin,\x20%s,\x20%s,\x20%s',_0x3cbcec,_0xdcd4('0x16'),JSON[_0xdcd4('0x18')](_0x282913));if(_0x282913['error']){if(_0x282913[_0xdcd4('0x19')][_0xdcd4('0x1a')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x3cbcec,_0x282913[_0xdcd4('0x19')][_0xdcd4('0x1b')]);return _0x35e653(_0x282913[_0xdcd4('0x19')][_0xdcd4('0x1b')]);}logger[_0xdcd4('0x19')](_0xdcd4('0x15'),_0x3cbcec,_0x282913[_0xdcd4('0x19')][_0xdcd4('0x1b')]);return _0x47549c(_0x282913[_0xdcd4('0x19')][_0xdcd4('0x1b')]);}else{logger[_0xdcd4('0x14')]('Plugin,\x20%s,\x20%s',_0x3cbcec,'request\x20sent');_0x47549c(_0x282913[_0xdcd4('0x1c')][_0xdcd4('0x1b')]);}})[_0xdcd4('0x1d')](function(_0x2cab1e){logger[_0xdcd4('0x19')](_0xdcd4('0x15'),_0x3cbcec,_0x2cab1e);_0x35e653(_0x2cab1e);});});}exports[_0xdcd4('0x1e')]=function(_0xfbae5f){var _0x9e8fa2=this;return new Promise(function(_0xa8920c,_0x28bec2){return db[_0xdcd4('0x1f')][_0xdcd4('0x20')](_0xfbae5f[_0xdcd4('0x21')],{'raw':_0xfbae5f[_0xdcd4('0x22')]?_0xfbae5f['options'][_0xdcd4('0x23')]===undefined?!![]:![]:!![]})[_0xdcd4('0x24')](function(_0x520bb7){logger[_0xdcd4('0x14')](_0xdcd4('0x1e'),_0xfbae5f);logger[_0xdcd4('0x17')]('CreatePlugin',_0xfbae5f,JSON[_0xdcd4('0x18')](_0x520bb7));_0xa8920c(_0x520bb7);})[_0xdcd4('0x1d')](function(_0x66052d){logger['error'](_0xdcd4('0x1e'),_0x66052d[_0xdcd4('0x1b')],_0xfbae5f);_0x28bec2(_0x9e8fa2['error'](0x1f4,_0x66052d[_0xdcd4('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 66ffcf9..b1e9305 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 _0xf2fc=['remove','emit','removeListener','plugin:','./plugin.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2fc,0x100));var _0xcf2f=function(_0x2bd8a6,_0x5b9211){_0x2bd8a6=_0x2bd8a6-0x0;var _0x1e037a=_0xf2fc[_0x2bd8a6];return _0x1e037a;};'use strict';var PluginEvents=require(_0xcf2f('0x0'));var events=[_0xcf2f('0x1'),_0xcf2f('0x2'),'update'];function createListener(_0x47d963,_0x5f59ab){return function(_0x218397){_0x5f59ab[_0xcf2f('0x3')](_0x47d963,_0x218397);};}function removeListener(_0x37598d,_0x15a35e){return function(){PluginEvents[_0xcf2f('0x4')](_0x37598d,_0x15a35e);};}exports['register']=function(_0x2ef44e){for(var _0x2c5042=0x0,_0x41eeb2=events['length'];_0x2c5042<_0x41eeb2;_0x2c5042++){var _0x5220b6=events[_0x2c5042];var _0xf96abc=createListener(_0xcf2f('0x5')+_0x5220b6,_0x2ef44e);PluginEvents['on'](_0x5220b6,_0xf96abc);}}; \ No newline at end of file +var _0xb48e=['removeListener','length','plugin:','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb48e,0x1d7));var _0xeb48=function(_0x5cb163,_0xd63c59){_0x5cb163=_0x5cb163-0x0;var _0x21f283=_0xb48e[_0x5cb163];return _0x21f283;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0xeb48('0x0'),_0xeb48('0x1')];function createListener(_0x1469d0,_0x4bf80b){return function(_0x1e7e7d){_0x4bf80b[_0xeb48('0x2')](_0x1469d0,_0x1e7e7d);};}function removeListener(_0x6b63d3,_0x10886c){return function(){PluginEvents[_0xeb48('0x3')](_0x6b63d3,_0x10886c);};}exports['register']=function(_0x4e866f){for(var _0x4c6f8e=0x0,_0x5438cc=events[_0xeb48('0x4')];_0x4c6f8e<_0x5438cc;_0x4c6f8e++){var _0xa66cff=events[_0x4c6f8e];var _0x5e1eb6=createListener(_0xeb48('0x5')+_0xa66cff,_0x4e866f);PluginEvents['on'](_0xa66cff,_0x5e1eb6);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 85811df..071eded 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(_0x2f2089,_0x5f2982){var _0x348830=function(_0x5de729){while(--_0x5de729){_0x2f2089['push'](_0x2f2089['shift']());}};_0x348830(++_0x5f2982);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x23c5c5,_0x578ef5){var _0x3bc811=function(_0x3c7298){while(--_0x3c7298){_0x23c5c5['push'](_0x23c5c5['shift']());}};_0x3bc811(++_0x578ef5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 2d03fbe..2c5bbfa 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 _0x55e0=['hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','json','error','name','status','send','info','index','then','reject','express','motion2','catch','show','params','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x55e0,0xdc));var _0x055e=function(_0x2a510b,_0x5db1ec){_0x2a510b=_0x2a510b-0x0;var _0xae024d=_0x55e0[_0x2a510b];return _0xae024d;};'use strict';var _=require(_0x055e('0x0'));var pm2=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var path=require('path');var exec=require('child_process')[_0x055e('0x4')];var BPromise=require(_0x055e('0x5'));function handleEntityNotFound(_0x33cd7b,_0x2773e4){return function(_0x157473){if(!_0x157473){_0x33cd7b[_0x055e('0x6')](0x194);;}return _0x157473;};}function respondWithResult(_0x490ee1,_0x5239f6){_0x5239f6=_0x5239f6||0xc8;return function(_0x4384ff){if(_0x4384ff){return _0x490ee1['status'](_0x5239f6)[_0x055e('0x7')](_0x4384ff);}return null;};}function handleError(_0x3c4cf,_0x376618){_0x376618=_0x376618||0x1f4;return function(_0x230c32){logger[_0x055e('0x8')](_0x230c32['stack']);if(_0x230c32[_0x055e('0x9')]){delete _0x230c32[_0x055e('0x9')];}_0x3c4cf[_0x055e('0xa')](_0x376618)[_0x055e('0xb')](_0x230c32);};}function execChildProcess(){return new BPromise(function(_0x238068,_0x5237d9){exec('npm\x20install',function(_0x187cce,_0x51c524,_0x3c44b2){logger[_0x055e('0xc')](_0x51c524);logger[_0x055e('0xc')](_0x3c44b2);if(_0x187cce){logger[_0x055e('0x8')](_0x187cce);return _0x5237d9(_0x187cce);}return _0x238068(_0x51c524);});});}exports[_0x055e('0xd')]=function(_0x31c649,_0x236a2b){return pm2['list']()[_0x055e('0xe')](function(_0xb80d83){if(_0xb80d83){var _0x3cfd14=_[_0x055e('0xf')](_0xb80d83,function(_0x222817){return _0x222817['name']===_0x055e('0x10')||_0x222817[_0x055e('0x9')]===_0x055e('0x11');});return{'rows':_0x3cfd14,'count':_0x3cfd14['length']};}return null;})[_0x055e('0xe')](respondWithResult(_0x236a2b,null))[_0x055e('0x12')](handleError(_0x236a2b,null));};exports[_0x055e('0x13')]=function(_0x2bad86,_0x2cc84e){return pm2['describe'](_0x2bad86[_0x055e('0x14')]['id'])[_0x055e('0xe')](respondWithResult(_0x2cc84e,null))[_0x055e('0xe')](handleEntityNotFound(_0x2cc84e,null))[_0x055e('0x12')](handleError(_0x2cc84e,null));};exports['create']=function(_0x4004ce,_0x3cdd68){if(_0x4004ce['body'][_0x055e('0x9')]&&_0x4004ce[_0x055e('0x15')][_0x055e('0x16')]){var _0x124d86=path[_0x055e('0x17')](__dirname,_0x055e('0x18'),_0x4004ce['body'][_0x055e('0x16')]);var _0x2f0346=process[_0x055e('0x19')]();process['chdir'](path[_0x055e('0x1a')](_0x124d86));return execChildProcess()[_0x055e('0xe')](function(_0x32c64e){process[_0x055e('0x1b')](_0x2f0346);return pm2['start']({'name':_0x4004ce[_0x055e('0x15')]['name'],'script':_0x124d86});})[_0x055e('0xe')](function(_0x42a6aa){pm2[_0x055e('0x1c')]();return _0x42a6aa[0x0];})[_0x055e('0xe')](respondWithResult(_0x3cdd68,0xc9))[_0x055e('0x12')](handleError(_0x3cdd68,null));}else{return _0x3cdd68[_0x055e('0xa')](0x1f4)['send']({'message':_0x055e('0x1d')});}};exports[_0x055e('0x1e')]=function(_0x2a82f8,_0x4b5891){if(_0x2a82f8[_0x055e('0x15')]['id']){delete _0x2a82f8[_0x055e('0x15')]['id'];}var _0x42f2df={'online':_0x055e('0x1f'),'stopped':'stop'};if(_0x42f2df[_0x055e('0x20')](_0x2a82f8['body'][_0x055e('0xa')])){return pm2[_0x42f2df[_0x2a82f8[_0x055e('0x15')][_0x055e('0xa')]]](_0x2a82f8[_0x055e('0x14')]['id'])[_0x055e('0xe')](respondWithResult(_0x4b5891,0xc8))['catch'](handleError(_0x4b5891,null));}else{return _0x4b5891[_0x055e('0xa')](0x1f4)[_0x055e('0xb')]({'message':_0x055e('0x21')});}};exports[_0x055e('0x22')]=function(_0x36abb2,_0x225c88){if(_0x36abb2[_0x055e('0x15')]['id']){delete _0x36abb2[_0x055e('0x15')]['id'];}if(_0x36abb2['params']['id']){return pm2[_0x055e('0x23')](_0x36abb2[_0x055e('0x14')]['id'])['then'](function(_0xd9298d){pm2[_0x055e('0x1c')]();return _0xd9298d[0x0];})[_0x055e('0xe')](respondWithResult(_0x225c88,null))[_0x055e('0x12')](handleError(_0x225c88,null));}else{return _0x225c88[_0x055e('0xa')](0x1f4)[_0x055e('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xda55=['Unknown\x20id','lodash','../../config/pm2','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','length','show','describe','params','catch','create','body','script','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty'];(function(_0x5bd219,_0xbb8823){var _0x59ac96=function(_0x3032a0){while(--_0x3032a0){_0x5bd219['push'](_0x5bd219['shift']());}};_0x59ac96(++_0xbb8823);}(_0xda55,0x6d));var _0x5da5=function(_0x336280,_0x10a45c){_0x336280=_0x336280-0x0;var _0x2a1b5b=_0xda55[_0x336280];return _0x2a1b5b;};'use strict';var _=require(_0x5da5('0x0'));var pm2=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x5da5('0x2'));var exec=require(_0x5da5('0x3'))[_0x5da5('0x4')];var BPromise=require(_0x5da5('0x5'));function handleEntityNotFound(_0x1c3afd,_0x5da254){return function(_0x3400e9){if(!_0x3400e9){_0x1c3afd['sendStatus'](0x194);;}return _0x3400e9;};}function respondWithResult(_0x356a37,_0x58e7b3){_0x58e7b3=_0x58e7b3||0xc8;return function(_0x2fd877){if(_0x2fd877){return _0x356a37[_0x5da5('0x6')](_0x58e7b3)[_0x5da5('0x7')](_0x2fd877);}return null;};}function handleError(_0x46290d,_0x3debdf){_0x3debdf=_0x3debdf||0x1f4;return function(_0x25c873){logger[_0x5da5('0x8')](_0x25c873[_0x5da5('0x9')]);if(_0x25c873['name']){delete _0x25c873[_0x5da5('0xa')];}_0x46290d[_0x5da5('0x6')](_0x3debdf)[_0x5da5('0xb')](_0x25c873);};}function execChildProcess(){return new BPromise(function(_0x26fbe3,_0x1a047e){exec(_0x5da5('0xc'),function(_0x33313e,_0x589c14,_0x2f4e4b){logger[_0x5da5('0xd')](_0x589c14);logger['info'](_0x2f4e4b);if(_0x33313e){logger[_0x5da5('0x8')](_0x33313e);return _0x1a047e(_0x33313e);}return _0x26fbe3(_0x589c14);});});}exports[_0x5da5('0xe')]=function(_0x3ced00,_0x43d526){return pm2[_0x5da5('0xf')]()[_0x5da5('0x10')](function(_0x481562){if(_0x481562){var _0x489b60=_['reject'](_0x481562,function(_0x4267cd){return _0x4267cd[_0x5da5('0xa')]===_0x5da5('0x11')||_0x4267cd[_0x5da5('0xa')]===_0x5da5('0x12');});return{'rows':_0x489b60,'count':_0x489b60[_0x5da5('0x13')]};}return null;})[_0x5da5('0x10')](respondWithResult(_0x43d526,null))['catch'](handleError(_0x43d526,null));};exports[_0x5da5('0x14')]=function(_0x290136,_0x1a4849){return pm2[_0x5da5('0x15')](_0x290136[_0x5da5('0x16')]['id'])[_0x5da5('0x10')](respondWithResult(_0x1a4849,null))['then'](handleEntityNotFound(_0x1a4849,null))[_0x5da5('0x17')](handleError(_0x1a4849,null));};exports[_0x5da5('0x18')]=function(_0x3d3d26,_0x30cde5){if(_0x3d3d26[_0x5da5('0x19')]['name']&&_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]){var _0x42a3cb=path['join'](__dirname,_0x5da5('0x1b'),_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]);var _0x2e68d5=process[_0x5da5('0x1c')]();process[_0x5da5('0x1d')](path['dirname'](_0x42a3cb));return execChildProcess()[_0x5da5('0x10')](function(_0x568ddf){process[_0x5da5('0x1d')](_0x2e68d5);return pm2[_0x5da5('0x1e')]({'name':_0x3d3d26[_0x5da5('0x19')]['name'],'script':_0x42a3cb});})[_0x5da5('0x10')](function(_0x236bf3){pm2[_0x5da5('0x1f')]();return _0x236bf3[0x0];})[_0x5da5('0x10')](respondWithResult(_0x30cde5,0xc9))['catch'](handleError(_0x30cde5,null));}else{return _0x30cde5['status'](0x1f4)['send']({'message':_0x5da5('0x20')});}};exports['update']=function(_0x4e8890,_0x1f75f3){if(_0x4e8890[_0x5da5('0x19')]['id']){delete _0x4e8890['body']['id'];}var _0x1798ae={'online':_0x5da5('0x21'),'stopped':'stop'};if(_0x1798ae[_0x5da5('0x22')](_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')])){return pm2[_0x1798ae[_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')]]](_0x4e8890['params']['id'])[_0x5da5('0x10')](respondWithResult(_0x1f75f3,0xc8))[_0x5da5('0x17')](handleError(_0x1f75f3,null));}else{return _0x1f75f3[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x4cb022,_0x245273){if(_0x4cb022[_0x5da5('0x19')]['id']){delete _0x4cb022[_0x5da5('0x19')]['id'];}if(_0x4cb022[_0x5da5('0x16')]['id']){return pm2['delete'](_0x4cb022['params']['id'])[_0x5da5('0x10')](function(_0x4afb58){pm2['dump']();return _0x4afb58[0x0];})[_0x5da5('0x10')](respondWithResult(_0x245273,null))['catch'](handleError(_0x245273,null));}else{return _0x245273[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':_0x5da5('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e0e1342..abd2e98 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 _0xb5b4=['isAuthenticated','getAgents','get','getQueues','exports','../../components/auth/service','./realtime.controller'];(function(_0x419ca1,_0x40738b){var _0x5dac91=function(_0x4019c5){while(--_0x4019c5){_0x419ca1['push'](_0x419ca1['shift']());}};_0x5dac91(++_0x40738b);}(_0xb5b4,0x98));var _0x4b5b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb5b4[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4b5b('0x0'));var controller=require(_0x4b5b('0x1'));router['get']('/agents',auth[_0x4b5b('0x2')](),controller[_0x4b5b('0x3')]);router[_0x4b5b('0x4')]('/queues',auth['isAuthenticated'](),controller[_0x4b5b('0x5')]);module[_0x4b5b('0x6')]=router; \ No newline at end of file +var _0x0de1=['/queues','getQueues','express','../../components/auth/service','isAuthenticated'];(function(_0x44b695,_0x3b7a88){var _0x51bd38=function(_0x2373ab){while(--_0x2373ab){_0x44b695['push'](_0x44b695['shift']());}};_0x51bd38(++_0x3b7a88);}(_0x0de1,0xa2));var _0x10de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0de1[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x10de('0x0'));var router=express['Router']();var auth=require(_0x10de('0x1'));var controller=require('./realtime.controller');router['get']('/agents',auth[_0x10de('0x2')](),controller['getAgents']);router['get'](_0x10de('0x3'),auth[_0x10de('0x2')](),controller[_0x10de('0x4')]);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 c23b60e..278003a 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 _0x44ee=['Queue','globalQueueFilter','fieldName','key','agent','getOptions','isEmpty','where','role','user','userProfileId','nolimit','UserProfile','omit','globalStatusFilter','pauseTypeFilter','rawAttributes','QueueCampaigns','getResources','findAndCountAll','rows','type','util','lodash','jayson/promise','../../config/logger','api','client','http','offset','undefined','count','limit','status','set','Content-Range','stack','name','send','error','result','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','talking','outbound','push','originated','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','loggedInDb','available','voice','pTalking','find','pick','filter','queue','length','busy','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','paused','voiceStatus','agents','User','Pause','findAll','idle','unknown','unavailable','ringing','isNil','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','*pause','mail','sms','toLowerCase','Invalid\x20channel','isArray','getAgents','all','flatten','value','split','fields','includes','globalStatus','order','startsWith','DESC','pauseType','lastPauseAt','chatPause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','smsStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','routealias','resolve','channel','query','sort','join'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x44ee,0x1e7));var _0xe44e=function(_0x561d9b,_0x1a7508){_0x561d9b=_0x561d9b-0x0;var _0xf0b943=_0x44ee[_0x561d9b];return _0xf0b943;};'use strict';var util=require(_0xe44e('0x0'));var _=require(_0xe44e('0x1'));var jayson=require(_0xe44e('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xe44e('0x3'))(_0xe44e('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xe44e('0x5')][_0xe44e('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0xe44e('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x2ef89f,_0x17a048){return function(_0x2668e0){if(_0x2668e0){var _0x3b56a9=typeof _0x17a048[_0xe44e('0x7')]===_0xe44e('0x8')&&typeof _0x17a048['limit']===_0xe44e('0x8');var _0x2fb2ec=_0x2668e0[_0xe44e('0x9')];var _0xd777d9=_0x3b56a9?0x0:_0x17a048[_0xe44e('0x7')];var _0x44612c=_0x3b56a9?_0x2668e0[_0xe44e('0x9')]:_0x17a048[_0xe44e('0x7')]+_0x17a048[_0xe44e('0xa')];var _0x527196;if(_0x44612c>=_0x2fb2ec){_0x44612c=_0x2fb2ec;_0x527196=0xc8;}else{_0x527196=0xce;}_0x2ef89f[_0xe44e('0xb')](_0x527196);return _0x2ef89f[_0xe44e('0xc')](_0xe44e('0xd'),_0xd777d9+'-'+_0x44612c+'/'+_0x2fb2ec)['json'](_0x2668e0);}return null;};}function handleError(_0xf9f195,_0x3fd0e6){_0x3fd0e6=_0x3fd0e6||0x1f4;return function(_0x537d55){logger['error'](_0x537d55[_0xe44e('0xe')]);if(_0x537d55[_0xe44e('0xf')]){delete _0x537d55['name'];}_0xf9f195[_0xe44e('0xb')](_0x3fd0e6)[_0xe44e('0x10')](_0x537d55);};}function getRealtimeAgents(){return new Promise(function(_0x2eaf54,_0x2a8a1b){return amiClient['request']('Agents',{})['then'](function(_0x4de300){if(_0x4de300[_0xe44e('0x11')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x15224d=_0x4de300[_0xe44e('0x12')];return routingClient[_0xe44e('0x13')](_0xe44e('0x14'),{})['then'](function(_0x15c5b3){if(_0x15c5b3[_0xe44e('0x11')])throw new Error(_0xe44e('0x15'));var _0xf7ee03=_0x15c5b3['result'];return _0x2eaf54(_[_0xe44e('0x16')]({},_0x15224d,_0xf7ee03));});})['catch'](function(_0x16f4b0){_0x2a8a1b(_0x16f4b0);});});}function getRealtimeQueues(_0x4b8401,_0x13e488){return new Promise(function(_0x470bcd,_0x136d4a){var _0x52febd=_0x13e488==='voice'?amiClient:routingClient;return _0x52febd[_0xe44e('0x13')](_[_0xe44e('0x17')](_0x13e488)+_0xe44e('0x18'),_0x4b8401)[_0xe44e('0x19')](function(_0x54da33){if(_0x54da33[_0xe44e('0x11')])throw new Error(util[_0xe44e('0x1a')](_0xe44e('0x1b'),_0x13e488));return _0x470bcd(_0x54da33[_0xe44e('0x12')]);})[_0xe44e('0x1c')](function(_0x23fc47){_0x136d4a(_0x23fc47);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x13e84f,_0x19e5d1){return amiClient[_0xe44e('0x13')](_0xe44e('0x1d'),{})[_0xe44e('0x19')](function(_0x296cef){if(_0x296cef[_0xe44e('0x11')])throw new Error(_0xe44e('0x1e'));return _0x13e84f(_0x296cef[_0xe44e('0x12')]);})[_0xe44e('0x1c')](function(_0x50b4b2){_0x19e5d1(_0x50b4b2);});});}function initializeQueues(_0x5b3b3a,_0x4769f8,_0x5b7f8d,_0x3f545f){var _0x5c2d83=[_0xe44e('0x1f'),'available',_0xe44e('0x20'),_0xe44e('0x21'),'paused'];if(_0x5b7f8d==='voice'&&_0x3f545f===_0xe44e('0x22')){_0x5c2d83[_0xe44e('0x23')]('pTalking',_0xe44e('0x24'),'message','dialActive','dialMethod',_0xe44e('0x25'),'startPredictive',_0xe44e('0x26'),'erlangCalls',_0xe44e('0x27'),_0xe44e('0x28'),_0xe44e('0x29'),_0xe44e('0x2a'),'dialPredictiveIntervalMaxThreshold',_0xe44e('0x2b'),_0xe44e('0x2c'),'predictiveIntervalTotalCalls',_0xe44e('0x2d'),_0xe44e('0x2e'),_0xe44e('0x2f'),_0xe44e('0x30'),'predictiveIntervalAvgTalktime');}return _0x5b3b3a[_0xe44e('0x31')](function(_0x3b3a27){var _0xef6488=_0x3b3a27['get']({'plain':!![]});_0xef6488['agents']=[];_0xef6488['paused']=0x0;_0xef6488[_0xe44e('0x32')]=0x0;_0xef6488['loggedIn']=0x0;_0xef6488[_0xe44e('0x33')]=0x0;_0xef6488['waiting']=0x0;if(_0x5b7f8d===_0xe44e('0x34')){_0xef6488[_0xe44e('0x21')]=0x0;_0xef6488['busy']=0x0;if(_0x3f545f===_0xe44e('0x22')){_0xef6488[_0xe44e('0x35')]=0x0;_0xef6488[_0xe44e('0x24')]=0x0;}}var _0x5a07c8=_[_0xe44e('0x36')](_0x4769f8,['id',_0xef6488['id']]);if(_0x5a07c8)_[_0xe44e('0x16')](_0xef6488,_[_0xe44e('0x37')](_0x5a07c8,_0x5c2d83));return _0xef6488;});}function updateAgentVoiceStatus(_0x14fbc3,_0x2331be,_0x1373a9){var _0x4bcb2b=_[_0xe44e('0x38')](_0x1373a9,[_0xe44e('0x39'),_0x2331be[_0xe44e('0xf')]]);if(_0x4bcb2b[_0xe44e('0x3a')]===0x0)return _0x14fbc3[_0xe44e('0x3b')]=!![];if(_['some'](_0x4bcb2b,[_0xe44e('0x3c'),_0x14fbc3[_0xe44e('0x3d')][_0xe44e('0x3e')]()]))return _0x14fbc3[_0xe44e('0x21')]=!![];if(!_0x14fbc3['talking'])return _0x14fbc3[_0xe44e('0x3b')]=!![];}function getVoiceQueueAgents(_0x43b8bc,_0x8a151a,_0x4eb566,_0x33242d){var _0xb5ca79=_[_0xe44e('0x36')](_0x8a151a,['id',_0x43b8bc['id']]);if(!_0xb5ca79)return _0x43b8bc;return _0xb5ca79[_0xe44e('0x3f')]({'raw':!![]})['then'](function(_0xaaec59){for(var _0xe2caa6=0x0;_0xe2caa6<_0xaaec59[_0xe44e('0x3a')];_0xe2caa6++){var _0x3bf4d2=_[_0xe44e('0x36')](_0x4eb566,['id',_0xaaec59[_0xe2caa6]['UserId']]);if(!_0x3bf4d2){_0x3bf4d2={'id':_0xaaec59[_0xe2caa6][_0xe44e('0x40')],'name':_0xaaec59[_0xe2caa6][_0xe44e('0x40')],'accountcode':'','online':![]};}var _0x1c1b8f={'id':_0x3bf4d2['id'],'name':_0x3bf4d2[_0xe44e('0xf')],'internal':_0x3bf4d2[_0xe44e('0x41')],'online':Boolean(_0x3bf4d2[_0xe44e('0x42')]),'paused':Boolean(_0xaaec59[_0xe2caa6][_0xe44e('0x43')])};if(_0x3bf4d2[_0xe44e('0x44')]===_0xe44e('0x21'))updateAgentVoiceStatus(_0x1c1b8f,_0x43b8bc,_0x33242d);if(_0x1c1b8f['online'])_0x43b8bc['loggedInDb']++;if(_0x1c1b8f['busy'])_0x43b8bc[_0xe44e('0x3b')]++;if(_0x1c1b8f[_0xe44e('0x43')]&&!_0x1c1b8f[_0xe44e('0x3b')]&&!_0x1c1b8f[_0xe44e('0x21')])_0x43b8bc[_0xe44e('0x43')]++;_0x43b8bc[_0xe44e('0x45')][_0xe44e('0x23')](_0x1c1b8f);}return _0x43b8bc;});}function getQueueAgents(_0x58eabb,_0x452e2d,_0x4e8c52){var _0x1065fb=_0xe44e('0x46')+_[_0xe44e('0x17')](_0x4e8c52)+'Queue';var _0x331364=_0x4e8c52+_0xe44e('0x47');return db[_0x1065fb][_0xe44e('0x48')]({'where':{[_[_0xe44e('0x17')](_0x4e8c52)+'QueueId']:_0x58eabb['id']},'raw':!![]})[_0xe44e('0x19')](function(_0x547758){for(var _0xc417e5=0x0;_0xc417e5<_0x547758[_0xe44e('0x3a')];_0xc417e5++){var _0x31ea27=_[_0xe44e('0x36')](_0x452e2d,['id',_0x547758[_0xc417e5][_0xe44e('0x40')]]);if(!_0x31ea27){_0x31ea27={'id':_0x547758[_0xc417e5][_0xe44e('0x40')],'name':_0x547758[_0xc417e5][_0xe44e('0x40')],'online':![],['pauseField']:![]};}var _0x50f930={'id':_0x31ea27['id'],'name':_0x31ea27['name'],'online':Boolean(_0x31ea27['online']),'paused':Boolean(_0x31ea27[_0x331364])};if(_0x50f930['online'])_0x58eabb[_0xe44e('0x32')]++;_0x58eabb[_0xe44e('0x45')]['push'](_0x50f930);}return _0x58eabb;});}function isIdle(_0x2e10cd){return _0x2e10cd===_0xe44e('0x49')||_0x2e10cd===_0xe44e('0x4a')||_0x2e10cd===_0xe44e('0x4b')||_0x2e10cd===_0xe44e('0x4c')||_[_0xe44e('0x4d')](_0x2e10cd);}function isAgentPaused(_0x10e765,_0x4c8451){var _0x2e8ea7=[_0x10e765['chatPause'],_0x10e765[_0xe44e('0x4e')],_0x10e765[_0xe44e('0x4f')],_0x10e765[_0xe44e('0x50')],_0x10e765[_0xe44e('0x51')],_0x10e765[_0xe44e('0x52')],_0x10e765[_0xe44e('0x53')]];if(!_0x4c8451)return _[_0xe44e('0x54')](_0x2e8ea7);var _0x5f4d49=_[_0xe44e('0x38')](_0x2e8ea7);return _0x5f4d49[_0xe44e('0x3a')]>0x0&&_0x5f4d49[_0xe44e('0x3a')]<_0x2e8ea7[_0xe44e('0x3a')]?!![]:![];}function isAgentIdle(_0x32d1dc){if(_0x32d1dc[_0xe44e('0x44')]!==_0xe44e('0x49')&&_0x32d1dc['voicePause']){_0x32d1dc['voiceStatus']=_0xe44e('0x55');return![];}return _[_0xe44e('0x54')]([_0x32d1dc[_0xe44e('0x56')],_0x32d1dc[_0xe44e('0x57')],_0x32d1dc[_0xe44e('0x58')],_0x32d1dc[_0xe44e('0x59')],_0x32d1dc['smsStatus'],_0x32d1dc[_0xe44e('0x44')],_0x32d1dc['whatsappStatus']],isIdle);}function getAgentStatus(_0x4b081a){var _0x1a342f=_0xe44e('0x4a');if(isAgentPaused(_0x4b081a))_0x1a342f=_0xe44e('0x55');else if(isAgentPaused(_0x4b081a,!![]))_0x1a342f=_0xe44e('0x5a');else if(isAgentIdle(_0x4b081a))_0x1a342f=_0xe44e('0x49');else _0x1a342f='busy';return _0x1a342f;}function validateChannel(_0x55cb0c){var _0x2dc163=[_0xe44e('0x5b'),'chat',_0xe44e('0x5c'),'openchannel','fax','whatsapp',_0xe44e('0x34')];if(!_['includes'](_0x2dc163,_0x55cb0c[_0xe44e('0x5d')]()))throw new Error(_0xe44e('0x5e'));return _0x55cb0c['toLowerCase']();}function getFilteredAgentIds(_0x14c262,_0x31364c){var _0x344788=_[_0xe44e('0x5f')](_0x14c262)?_0x14c262:[_0x14c262];var _0x258137=_[_0xe44e('0x31')](_0x344788,function(_0x131dff){return db[_0x31364c]['findOne']({'where':{'name':_0x131dff}})['then'](function(_0x5739aa){if(!_0x5739aa)return[];return _0x5739aa[_0xe44e('0x60')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xe44e('0x61')](_0x258137)[_0xe44e('0x19')](function(_0x2346cb){var _0x1dd9a8=_(_0x2346cb)[_0xe44e('0x62')]()[_0xe44e('0x31')]('id')['uniq']()[_0xe44e('0x63')]();return _0x1dd9a8;});}function getUpdatedSortOptions(_0x3801b8){var _0x332cdf={'fields':[],'order':null};var _0x46082e=_0x3801b8[_0xe44e('0x64')](',');_0x332cdf[_0xe44e('0x65')]=_[_0xe44e('0x38')](_0x46082e,function(_0x5dfbe1){if(!_0x5dfbe1[_0xe44e('0x66')](_0xe44e('0x67')))return!![];_0x332cdf[_0xe44e('0x68')]=_[_0xe44e('0x69')](_0x5dfbe1,'-')?_0xe44e('0x6a'):'ASC';return![];});return _0x332cdf;}function orderAgentsByStatus(_0x5531dc,_0x5a039b){return _0x5531dc['sort'](function(_0x1ab6ae,_0x11ee7b){if(_0x1ab6ae[_0xe44e('0x67')]===_0x11ee7b[_0xe44e('0x67')]&&_0x1ab6ae[_0xe44e('0x67')]===_0xe44e('0x55')){if(_0x5a039b===_0xe44e('0x6a'))return(_0x1ab6ae['pauseType']||'')<(_0x11ee7b[_0xe44e('0x6b')]||'')?0x1:-0x1;return _0x1ab6ae['pauseType']<_0x11ee7b['pauseType']?-0x1:0x1;}else{if(_0x5a039b===_0xe44e('0x6a'))return _0x1ab6ae['globalStatus']<_0x11ee7b[_0xe44e('0x67')]?0x1:-0x1;return _0x1ab6ae[_0xe44e('0x67')]<_0x11ee7b[_0xe44e('0x67')]?-0x1:0x1;}});}exports[_0xe44e('0x60')]=function(_0x14dbdc,_0x5463fe){var _0x88ea1b={'count':0x0,'rows':[]},_0x5c080c={},_0xd11c1f,_0x1e815e,_0x4ab16b,_0x1a03f0,_0x2dae0f=['userpic',_0xe44e('0x42'),'lastLoginAt','lastPauseAt',_0xe44e('0x6b'),_0xe44e('0x6c'),_0xe44e('0x3d'),'address',_0xe44e('0x6d'),_0xe44e('0x50'),_0xe44e('0x4f'),_0xe44e('0x51'),'whatsappPause',_0xe44e('0x4e'),'voicePause',_0xe44e('0x6e'),_0xe44e('0x6f'),'mailCapacity',_0xe44e('0x70'),_0xe44e('0x71'),_0xe44e('0x72'),'chatCurrentCapacity',_0xe44e('0x73'),_0xe44e('0x74'),_0xe44e('0x75'),_0xe44e('0x76'),'faxCurrentCapacity',_0xe44e('0x56'),_0xe44e('0x59'),'mailStatus',_0xe44e('0x77'),_0xe44e('0x78'),'faxStatus','voiceStatus',_0xe44e('0x79'),_0xe44e('0x7a'),_0xe44e('0x7b'),'smsStatusTime',_0xe44e('0x7c'),'faxStatusTime',_0xe44e('0x7d'),_0xe44e('0x39'),_0xe44e('0x7e'),'screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0xe44e('0x7f')],_0x71d430=[_0xe44e('0x6d'),_0xe44e('0x50'),'mailPause',_0xe44e('0x51'),_0xe44e('0x53'),_0xe44e('0x4e'),_0xe44e('0x52'),'online'];Promise[_0xe44e('0x80')]()[_0xe44e('0x19')](function(){if(_0x14dbdc['query']['channel'])_0xd11c1f=validateChannel(_0x14dbdc['query'][_0xe44e('0x81')]);if(!_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')]||!_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')][_0xe44e('0x66')](_0xe44e('0x67')))return;var _0x26eea4=getUpdatedSortOptions(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')]);_0x14dbdc['query'][_0xe44e('0x83')]=_0x26eea4[_0xe44e('0x65')][_0xe44e('0x84')](',');_0x1e815e=_0x26eea4[_0xe44e('0x68')];})[_0xe44e('0x19')](function(){if(!_0x14dbdc[_0xe44e('0x82')]['globalQueueFilter'])return[];var _0x2e68f9=_[_0xe44e('0x17')](_0xd11c1f)+_0xe44e('0x85');return getFilteredAgentIds(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x86')],_0x2e68f9);})[_0xe44e('0x19')](function(_0x256849){var _0x4bd192=_[_0xe44e('0x31')](db[_0xe44e('0x46')]['rawAttributes'],function(_0x396157){return{'name':_0x396157[_0xe44e('0x87')],'type':_0x396157['type'][_0xe44e('0x88')]};});_0x14dbdc[_0xe44e('0x82')]['role']=_0xe44e('0x89');_0x14dbdc['query'][_0xe44e('0x42')]=!![];_0x5c080c=qs[_0xe44e('0x8a')](_0x4bd192,_0x14dbdc);_0x5c080c['raw']=!![];if(!_[_0xe44e('0x8b')](_0x256849)){_0x5c080c['where']=_[_0xe44e('0x16')](_0x5c080c[_0xe44e('0x8c')],{'$and':[{'id':{'$in':_0x256849}}]});}else if(!_[_0xe44e('0x8b')](_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x86')])){return _0x88ea1b;}if(_0x14dbdc['user'][_0xe44e('0x8d')]===_0xe44e('0x8e')){var _0x2bc678={'params':{'id':_0x14dbdc['user'][_0xe44e('0x8f')]},'query':{'section':'Agents','role':_0xe44e('0x89'),'online':!![],'nolimit':_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x90')],'sort':_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')],'filter':_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x38')],'raw':!![],'ids':_0x256849}};return db[_0xe44e('0x91')]['getResources'](_0x2bc678);}return db[_0xe44e('0x46')]['findAndCountAll'](_0x5c080c);})[_0xe44e('0x19')](function(_0x3f0d22){_0x88ea1b[_0xe44e('0x9')]=_0x3f0d22[_0xe44e('0x9')];_0x4ab16b=_0x3f0d22['rows'];return getRealtimeAgents();})[_0xe44e('0x19')](function(_0xc22968){_0x1a03f0=_0xc22968['rows'];return _0x4ab16b[_0xe44e('0x31')](function(_0x40f2b8){var _0x4ceed1=_[_0xe44e('0x36')](_0x1a03f0,['id',_0x40f2b8['id']]);if(_0x4ceed1)_['merge'](_0x40f2b8,_['pick'](_[_0xe44e('0x92')](_0x4ceed1,_0x71d430),_0x2dae0f));_0x40f2b8[_0xe44e('0x67')]=getAgentStatus(_0x40f2b8);return _0x40f2b8;});})[_0xe44e('0x19')](function(_0x154fa3){var _0x58b5e7;if(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x93')]){_0x58b5e7=_[_0xe44e('0x38')](_0x154fa3,[_0xe44e('0x67'),_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x93')]]);if(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x94')]){_0x58b5e7=_['filter'](_0x58b5e7,[_0xe44e('0x6b'),_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x94')]]);}}if(_0x58b5e7)_0x154fa3=_0x58b5e7;if(!_0x1e815e)return _0x154fa3;return orderAgentsByStatus(_0x154fa3,_0x1e815e);})[_0xe44e('0x19')](function(_0x9a7f69){_0x88ea1b['rows']=_0x9a7f69;return _0x88ea1b;})['then'](respondWithFilteredResult(_0x5463fe,_0x5c080c))['catch'](handleError(_0x5463fe,null));};exports['getQueues']=function(_0x2b22a6,_0x452e0c){var _0x468ee2={'count':0x0,'rows':[]},_0x322d64={},_0x231030,_0x41865e,_0x148e40,_0x44ed9a,_0x251a92;Promise[_0xe44e('0x80')]()[_0xe44e('0x19')](function(){if(_0x2b22a6[_0xe44e('0x82')][_0xe44e('0x81')])_0x231030=validateChannel(_0x2b22a6['query'][_0xe44e('0x81')]);var _0x4f126c=_[_0xe44e('0x17')](_0x231030)+_0xe44e('0x85');var _0xf89534=_[_0xe44e('0x31')](db[_0x4f126c][_0xe44e('0x95')],function(_0x20655b){return{'name':_0x20655b[_0xe44e('0x87')],'type':_0x20655b['type'][_0xe44e('0x88')]};});_0x322d64=qs[_0xe44e('0x8a')](_0xf89534,_0x2b22a6);if(_0x2b22a6[_0xe44e('0x8e')][_0xe44e('0x8d')]===_0xe44e('0x8e')){var _0x4d8417={'params':{'id':_0x2b22a6[_0xe44e('0x8e')]['userProfileId']},'query':{'section':_0x231030==='voice'&&_0x2b22a6[_0xe44e('0x82')]['type']===_0xe44e('0x22')?_0xe44e('0x96'):_[_0xe44e('0x17')](_0x231030)+'Queues','type':_0x2b22a6[_0xe44e('0x82')]['type'],'nolimit':!![],'sort':'name','filter':_0x2b22a6[_0xe44e('0x82')]['filter']}};return db['UserProfile'][_0xe44e('0x97')](_0x4d8417);}return db[_0x4f126c][_0xe44e('0x98')](_0x322d64);})[_0xe44e('0x19')](function(_0x447214){_0x468ee2[_0xe44e('0x9')]=_0x447214[_0xe44e('0x9')];_0x41865e=_0x447214[_0xe44e('0x99')];return getRealtimeQueues(_0x2b22a6,_0x231030);})[_0xe44e('0x19')](function(_0x56ce4e){_0x44ed9a=_0x56ce4e[_0xe44e('0x99')];return getRealtimeAgents();})[_0xe44e('0x19')](function(_0x2dfd4c){_0x148e40=_0x2dfd4c[_0xe44e('0x99')];if(_0x231030!=_0xe44e('0x34'))return;return getRealtimeVoiceQueueChannels();})[_0xe44e('0x19')](function(_0x4f22f8){_0x251a92=_0x4f22f8?_0x4f22f8['rows']:[];return initializeQueues(_0x41865e,_0x44ed9a,_0x231030,_0x2b22a6[_0xe44e('0x82')][_0xe44e('0x9a')]);})[_0xe44e('0x19')](function(_0x4bae17){var _0x3ece2d=_0x4bae17['map'](function(_0x343963){if(_0x231030===_0xe44e('0x34'))return getVoiceQueueAgents(_0x343963,_0x41865e,_0x148e40,_0x251a92);else return getQueueAgents(_0x343963,_0x148e40,_0x231030);});return Promise[_0xe44e('0x61')](_0x3ece2d);})['then'](function(_0x261860){_0x468ee2[_0xe44e('0x99')]=_0x261860;return _0x468ee2;})[_0xe44e('0x19')](respondWithFilteredResult(_0x452e0c,_0x322d64))[_0xe44e('0x1c')](handleError(_0x452e0c,null));}; \ No newline at end of file +var _0x0f76=['merge','catch','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','voice','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','busy','find','filter','queue','length','some','connectedlinenum','internal','getMembers','UserId','accountcode','online','loggedInDb','User','startCase','Queue','findAll','QueueId','idle','unknown','unavailable','ringing','isNil','faxPause','openchannelPause','smsPause','voicePause','every','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','chat','fax','whatsapp','toLowerCase','isArray','findOne','getAgents','flatten','uniq','value','globalStatus','order','startsWith','ASC','sort','DESC','pauseType','userpic','lastLoginAt','lastPauseAt','address','mailPause','whatsappPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','query','channel','fields','join','globalQueueFilter','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','isEmpty','where','user','userProfileId','nolimit','getResources','findAndCountAll','rows','pick','omit','globalStatusFilter','pauseTypeFilter','getQueues','resolve','QueueCampaigns','Queues','all','lodash','jayson/promise','../../config/logger','api','../../mysqldb','http','offset','limit','count','status','stack','name','send','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)'];(function(_0x276469,_0x3bb9f6){var _0x3a013e=function(_0x2e1f0a){while(--_0x2e1f0a){_0x276469['push'](_0x276469['shift']());}};_0x3a013e(++_0x3bb9f6);}(_0x0f76,0x136));var _0x60f7=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0f76[_0xb24a3e];return _0x4038d7;};'use strict';var util=require('util');var _=require(_0x60f7('0x0'));var jayson=require(_0x60f7('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x60f7('0x2'))(_0x60f7('0x3'));var db=require(_0x60f7('0x4'))['db'];var amiClient=jayson['client'][_0x60f7('0x5')]({'port':0x232a});var routingClient=jayson['client'][_0x60f7('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x23ee24,_0x14e1cb){return function(_0x298f9d){if(_0x298f9d){var _0x213725=typeof _0x14e1cb[_0x60f7('0x6')]==='undefined'&&typeof _0x14e1cb[_0x60f7('0x7')]==='undefined';var _0x5328d6=_0x298f9d[_0x60f7('0x8')];var _0x213c42=_0x213725?0x0:_0x14e1cb['offset'];var _0x16507c=_0x213725?_0x298f9d[_0x60f7('0x8')]:_0x14e1cb['offset']+_0x14e1cb[_0x60f7('0x7')];var _0x1b8aee;if(_0x16507c>=_0x5328d6){_0x16507c=_0x5328d6;_0x1b8aee=0xc8;}else{_0x1b8aee=0xce;}_0x23ee24[_0x60f7('0x9')](_0x1b8aee);return _0x23ee24['set']('Content-Range',_0x213c42+'-'+_0x16507c+'/'+_0x5328d6)['json'](_0x298f9d);}return null;};}function handleError(_0x41167a,_0x5971ab){_0x5971ab=_0x5971ab||0x1f4;return function(_0x482ba9){logger['error'](_0x482ba9[_0x60f7('0xa')]);if(_0x482ba9[_0x60f7('0xb')]){delete _0x482ba9[_0x60f7('0xb')];}_0x41167a[_0x60f7('0x9')](_0x5971ab)[_0x60f7('0xc')](_0x482ba9);};}function getRealtimeAgents(){return new Promise(function(_0xba5c14,_0xbc8d55){return amiClient[_0x60f7('0xd')](_0x60f7('0xe'),{})[_0x60f7('0xf')](function(_0x3ae37f){if(_0x3ae37f[_0x60f7('0x10')])throw new Error(_0x60f7('0x11'));var _0x75d117=_0x3ae37f[_0x60f7('0x12')];return routingClient[_0x60f7('0xd')](_0x60f7('0xe'),{})['then'](function(_0x3f9505){if(_0x3f9505['error'])throw new Error(_0x60f7('0x13'));var _0x53df52=_0x3f9505[_0x60f7('0x12')];return _0xba5c14(_[_0x60f7('0x14')]({},_0x75d117,_0x53df52));});})[_0x60f7('0x15')](function(_0x2c6377){_0xbc8d55(_0x2c6377);});});}function getRealtimeQueues(_0x3466e5,_0x5ca1f7){return new Promise(function(_0x33cc98,_0x24b9f2){var _0x58e658=_0x5ca1f7==='voice'?amiClient:routingClient;return _0x58e658[_0x60f7('0xd')](_['startCase'](_0x5ca1f7)+'Queues',_0x3466e5)['then'](function(_0x347f18){if(_0x347f18['error'])throw new Error(util[_0x60f7('0x16')](_0x60f7('0x17'),_0x5ca1f7));return _0x33cc98(_0x347f18[_0x60f7('0x12')]);})[_0x60f7('0x15')](function(_0xd4f8ec){_0x24b9f2(_0xd4f8ec);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x22aa18,_0x153895){return amiClient['request'](_0x60f7('0x18'),{})[_0x60f7('0xf')](function(_0x397d8f){if(_0x397d8f[_0x60f7('0x10')])throw new Error(_0x60f7('0x19'));return _0x22aa18(_0x397d8f['result']);})[_0x60f7('0x15')](function(_0x58239a){_0x153895(_0x58239a);});});}function initializeQueues(_0x46f474,_0x3b0f7a,_0x1916e6,_0x15dfee){var _0x2a989b=[_0x60f7('0x1a'),_0x60f7('0x1b'),_0x60f7('0x1c'),_0x60f7('0x1d'),_0x60f7('0x1e')];if(_0x1916e6===_0x60f7('0x1f')&&_0x15dfee===_0x60f7('0x20')){_0x2a989b[_0x60f7('0x21')](_0x60f7('0x22'),_0x60f7('0x23'),_0x60f7('0x24'),_0x60f7('0x25'),_0x60f7('0x26'),_0x60f7('0x27'),_0x60f7('0x28'),'startProgressive',_0x60f7('0x29'),_0x60f7('0x2a'),_0x60f7('0x2b'),'erlangBusyFactor',_0x60f7('0x2c'),_0x60f7('0x2d'),'dialPredictiveIntervalMinThreshold',_0x60f7('0x2e'),_0x60f7('0x2f'),_0x60f7('0x30'),_0x60f7('0x31'),_0x60f7('0x32'),_0x60f7('0x33'),_0x60f7('0x34'));}return _0x46f474[_0x60f7('0x35')](function(_0x3f881d){var _0x4050ea=_0x3f881d[_0x60f7('0x36')]({'plain':!![]});_0x4050ea[_0x60f7('0x37')]=[];_0x4050ea['paused']=0x0;_0x4050ea['loggedInDb']=0x0;_0x4050ea[_0x60f7('0x1a')]=0x0;_0x4050ea[_0x60f7('0x1b')]=0x0;_0x4050ea[_0x60f7('0x1c')]=0x0;if(_0x1916e6===_0x60f7('0x1f')){_0x4050ea[_0x60f7('0x1d')]=0x0;_0x4050ea[_0x60f7('0x38')]=0x0;if(_0x15dfee==='outbound'){_0x4050ea[_0x60f7('0x22')]=0x0;_0x4050ea[_0x60f7('0x23')]=0x0;}}var _0xf3208f=_[_0x60f7('0x39')](_0x3b0f7a,['id',_0x4050ea['id']]);if(_0xf3208f)_[_0x60f7('0x14')](_0x4050ea,_['pick'](_0xf3208f,_0x2a989b));return _0x4050ea;});}function updateAgentVoiceStatus(_0x4cf707,_0x3d562d,_0x50365d){var _0x3b8f70=_[_0x60f7('0x3a')](_0x50365d,[_0x60f7('0x3b'),_0x3d562d['name']]);if(_0x3b8f70[_0x60f7('0x3c')]===0x0)return _0x4cf707[_0x60f7('0x38')]=!![];if(_[_0x60f7('0x3d')](_0x3b8f70,[_0x60f7('0x3e'),_0x4cf707[_0x60f7('0x3f')]['toString']()]))return _0x4cf707[_0x60f7('0x1d')]=!![];if(!_0x4cf707[_0x60f7('0x1d')])return _0x4cf707['busy']=!![];}function getVoiceQueueAgents(_0x5a0aff,_0x4c627d,_0x52f4e2,_0x2bf90e){var _0x4f2d0a=_['find'](_0x4c627d,['id',_0x5a0aff['id']]);if(!_0x4f2d0a)return _0x5a0aff;return _0x4f2d0a[_0x60f7('0x40')]({'raw':!![]})[_0x60f7('0xf')](function(_0x3dfa7c){for(var _0xe2b921=0x0;_0xe2b921<_0x3dfa7c['length'];_0xe2b921++){var _0x1bde84=_[_0x60f7('0x39')](_0x52f4e2,['id',_0x3dfa7c[_0xe2b921][_0x60f7('0x41')]]);if(!_0x1bde84){_0x1bde84={'id':_0x3dfa7c[_0xe2b921]['UserId'],'name':_0x3dfa7c[_0xe2b921][_0x60f7('0x41')],'accountcode':'','online':![]};}var _0x2ac1af={'id':_0x1bde84['id'],'name':_0x1bde84['name'],'internal':_0x1bde84[_0x60f7('0x42')],'online':Boolean(_0x1bde84[_0x60f7('0x43')]),'paused':Boolean(_0x3dfa7c[_0xe2b921][_0x60f7('0x1e')])};if(_0x1bde84['voiceStatus']===_0x60f7('0x1d'))updateAgentVoiceStatus(_0x2ac1af,_0x5a0aff,_0x2bf90e);if(_0x2ac1af[_0x60f7('0x43')])_0x5a0aff[_0x60f7('0x44')]++;if(_0x2ac1af[_0x60f7('0x38')])_0x5a0aff['busy']++;if(_0x2ac1af[_0x60f7('0x1e')]&&!_0x2ac1af[_0x60f7('0x38')]&&!_0x2ac1af[_0x60f7('0x1d')])_0x5a0aff[_0x60f7('0x1e')]++;_0x5a0aff[_0x60f7('0x37')]['push'](_0x2ac1af);}return _0x5a0aff;});}function getQueueAgents(_0x3b9a0f,_0x32900e,_0x526729){var _0x3d7b78=_0x60f7('0x45')+_[_0x60f7('0x46')](_0x526729)+_0x60f7('0x47');var _0xce6bc7=_0x526729+'Pause';return db[_0x3d7b78][_0x60f7('0x48')]({'where':{[_[_0x60f7('0x46')](_0x526729)+_0x60f7('0x49')]:_0x3b9a0f['id']},'raw':!![]})['then'](function(_0xbdd9b5){for(var _0x59c739=0x0;_0x59c739<_0xbdd9b5['length'];_0x59c739++){var _0x2efbf8=_[_0x60f7('0x39')](_0x32900e,['id',_0xbdd9b5[_0x59c739][_0x60f7('0x41')]]);if(!_0x2efbf8){_0x2efbf8={'id':_0xbdd9b5[_0x59c739][_0x60f7('0x41')],'name':_0xbdd9b5[_0x59c739][_0x60f7('0x41')],'online':![],['pauseField']:![]};}var _0x2910ae={'id':_0x2efbf8['id'],'name':_0x2efbf8[_0x60f7('0xb')],'online':Boolean(_0x2efbf8[_0x60f7('0x43')]),'paused':Boolean(_0x2efbf8[_0xce6bc7])};if(_0x2910ae['online'])_0x3b9a0f[_0x60f7('0x44')]++;_0x3b9a0f[_0x60f7('0x37')][_0x60f7('0x21')](_0x2910ae);}return _0x3b9a0f;});}function isIdle(_0x485430){return _0x485430===_0x60f7('0x4a')||_0x485430===_0x60f7('0x4b')||_0x485430===_0x60f7('0x4c')||_0x485430===_0x60f7('0x4d')||_[_0x60f7('0x4e')](_0x485430);}function isAgentPaused(_0x3485da,_0x476ec3){var _0x2a740b=[_0x3485da['chatPause'],_0x3485da[_0x60f7('0x4f')],_0x3485da['mailPause'],_0x3485da[_0x60f7('0x50')],_0x3485da[_0x60f7('0x51')],_0x3485da[_0x60f7('0x52')],_0x3485da['whatsappPause']];if(!_0x476ec3)return _[_0x60f7('0x53')](_0x2a740b);var _0x2c105=_['filter'](_0x2a740b);return _0x2c105['length']>0x0&&_0x2c105['length']<_0x2a740b[_0x60f7('0x3c')]?!![]:![];}function isAgentIdle(_0x437273){if(_0x437273[_0x60f7('0x54')]!==_0x60f7('0x4a')&&_0x437273[_0x60f7('0x52')]){_0x437273[_0x60f7('0x54')]=_0x60f7('0x55');return![];}return _['every']([_0x437273['chatStatus'],_0x437273[_0x60f7('0x56')],_0x437273[_0x60f7('0x57')],_0x437273[_0x60f7('0x58')],_0x437273[_0x60f7('0x59')],_0x437273[_0x60f7('0x54')],_0x437273[_0x60f7('0x5a')]],isIdle);}function getAgentStatus(_0x28ac95){var _0x5a639c=_0x60f7('0x4b');if(isAgentPaused(_0x28ac95))_0x5a639c='pause';else if(isAgentPaused(_0x28ac95,!![]))_0x5a639c=_0x60f7('0x5b');else if(isAgentIdle(_0x28ac95))_0x5a639c=_0x60f7('0x4a');else _0x5a639c=_0x60f7('0x38');return _0x5a639c;}function validateChannel(_0x49bf9e){var _0x49558e=[_0x60f7('0x5c'),_0x60f7('0x5d'),'sms','openchannel',_0x60f7('0x5e'),_0x60f7('0x5f'),_0x60f7('0x1f')];if(!_['includes'](_0x49558e,_0x49bf9e[_0x60f7('0x60')]()))throw new Error('Invalid\x20channel');return _0x49bf9e[_0x60f7('0x60')]();}function getFilteredAgentIds(_0x582727,_0x17f5d1){var _0x35157c=_[_0x60f7('0x61')](_0x582727)?_0x582727:[_0x582727];var _0x3fae30=_[_0x60f7('0x35')](_0x35157c,function(_0x4b435e){return db[_0x17f5d1][_0x60f7('0x62')]({'where':{'name':_0x4b435e}})[_0x60f7('0xf')](function(_0x2f08df){if(!_0x2f08df)return[];return _0x2f08df[_0x60f7('0x63')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3fae30)[_0x60f7('0xf')](function(_0x2270be){var _0x4d7ae4=_(_0x2270be)[_0x60f7('0x64')]()[_0x60f7('0x35')]('id')[_0x60f7('0x65')]()[_0x60f7('0x66')]();return _0x4d7ae4;});}function getUpdatedSortOptions(_0x3e50c8){var _0x145701={'fields':[],'order':null};var _0x1467e6=_0x3e50c8['split'](',');_0x145701['fields']=_[_0x60f7('0x3a')](_0x1467e6,function(_0x200fe2){if(!_0x200fe2['includes'](_0x60f7('0x67')))return!![];_0x145701[_0x60f7('0x68')]=_[_0x60f7('0x69')](_0x200fe2,'-')?'DESC':_0x60f7('0x6a');return![];});return _0x145701;}function orderAgentsByStatus(_0x3ac4d9,_0xddb7ba){return _0x3ac4d9[_0x60f7('0x6b')](function(_0x43d2ba,_0x1a5251){if(_0x43d2ba[_0x60f7('0x67')]===_0x1a5251[_0x60f7('0x67')]&&_0x43d2ba['globalStatus']==='pause'){if(_0xddb7ba===_0x60f7('0x6c'))return(_0x43d2ba[_0x60f7('0x6d')]||'')<(_0x1a5251[_0x60f7('0x6d')]||'')?0x1:-0x1;return _0x43d2ba[_0x60f7('0x6d')]<_0x1a5251[_0x60f7('0x6d')]?-0x1:0x1;}else{if(_0xddb7ba==='DESC')return _0x43d2ba[_0x60f7('0x67')]<_0x1a5251[_0x60f7('0x67')]?0x1:-0x1;return _0x43d2ba['globalStatus']<_0x1a5251[_0x60f7('0x67')]?-0x1:0x1;}});}exports[_0x60f7('0x63')]=function(_0x1c72d2,_0xe2c6c0){var _0x1dc371={'count':0x0,'rows':[]},_0x1ef22f={},_0x170d9c,_0x4b1189,_0xabf102,_0x599a47,_0x41bead=[_0x60f7('0x6e'),_0x60f7('0x43'),_0x60f7('0x6f'),_0x60f7('0x70'),_0x60f7('0x6d'),'lastPauseAt',_0x60f7('0x3f'),_0x60f7('0x71'),'chatPause',_0x60f7('0x50'),_0x60f7('0x72'),_0x60f7('0x51'),_0x60f7('0x73'),_0x60f7('0x4f'),_0x60f7('0x52'),_0x60f7('0x74'),_0x60f7('0x75'),_0x60f7('0x76'),_0x60f7('0x77'),_0x60f7('0x78'),_0x60f7('0x79'),_0x60f7('0x7a'),_0x60f7('0x7b'),'mailCurrentCapacity',_0x60f7('0x7c'),'whatsappCurrentCapacity',_0x60f7('0x7d'),'chatStatus',_0x60f7('0x58'),_0x60f7('0x57'),_0x60f7('0x59'),_0x60f7('0x5a'),_0x60f7('0x56'),_0x60f7('0x54'),_0x60f7('0x7e'),_0x60f7('0x7f'),_0x60f7('0x80'),'smsStatusTime',_0x60f7('0x81'),_0x60f7('0x82'),_0x60f7('0x83'),_0x60f7('0x3b'),_0x60f7('0x84'),_0x60f7('0x85'),'phoneBarEnableScreenRecordingByAgent',_0x60f7('0x86'),'routealias'],_0x33c925=['chatPause',_0x60f7('0x50'),_0x60f7('0x72'),_0x60f7('0x51'),_0x60f7('0x73'),_0x60f7('0x4f'),'voicePause',_0x60f7('0x43')];Promise['resolve']()['then'](function(){if(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x88')])_0x170d9c=validateChannel(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x88')]);if(!_0x1c72d2['query']['sort']||!_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x6b')]['includes'](_0x60f7('0x67')))return;var _0x663b68=getUpdatedSortOptions(_0x1c72d2['query']['sort']);_0x1c72d2['query'][_0x60f7('0x6b')]=_0x663b68[_0x60f7('0x89')][_0x60f7('0x8a')](',');_0x4b1189=_0x663b68['order'];})[_0x60f7('0xf')](function(){if(!_0x1c72d2[_0x60f7('0x87')]['globalQueueFilter'])return[];var _0x557d07=_[_0x60f7('0x46')](_0x170d9c)+_0x60f7('0x47');return getFilteredAgentIds(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x8b')],_0x557d07);})[_0x60f7('0xf')](function(_0x3ae4f6){var _0x40e52d=_[_0x60f7('0x35')](db[_0x60f7('0x45')][_0x60f7('0x8c')],function(_0x47e70b){return{'name':_0x47e70b[_0x60f7('0x8d')],'type':_0x47e70b[_0x60f7('0x8e')][_0x60f7('0x8f')]};});_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x90')]=_0x60f7('0x91');_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x43')]=!![];_0x1ef22f=qs[_0x60f7('0x92')](_0x40e52d,_0x1c72d2);_0x1ef22f[_0x60f7('0x93')]=!![];if(!_[_0x60f7('0x94')](_0x3ae4f6)){_0x1ef22f[_0x60f7('0x95')]=_['merge'](_0x1ef22f[_0x60f7('0x95')],{'$and':[{'id':{'$in':_0x3ae4f6}}]});}else if(!_['isEmpty'](_0x1c72d2['query'][_0x60f7('0x8b')])){return _0x1dc371;}if(_0x1c72d2[_0x60f7('0x96')][_0x60f7('0x90')]===_0x60f7('0x96')){var _0x412ced={'params':{'id':_0x1c72d2[_0x60f7('0x96')][_0x60f7('0x97')]},'query':{'section':_0x60f7('0xe'),'role':_0x60f7('0x91'),'online':!![],'nolimit':_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x98')],'sort':_0x1c72d2[_0x60f7('0x87')]['sort'],'filter':_0x1c72d2[_0x60f7('0x87')]['filter'],'raw':!![],'ids':_0x3ae4f6}};return db['UserProfile'][_0x60f7('0x99')](_0x412ced);}return db[_0x60f7('0x45')][_0x60f7('0x9a')](_0x1ef22f);})[_0x60f7('0xf')](function(_0x414b5b){_0x1dc371['count']=_0x414b5b[_0x60f7('0x8')];_0xabf102=_0x414b5b[_0x60f7('0x9b')];return getRealtimeAgents();})[_0x60f7('0xf')](function(_0x4fa6f9){_0x599a47=_0x4fa6f9['rows'];return _0xabf102[_0x60f7('0x35')](function(_0x3f6433){var _0x25f597=_[_0x60f7('0x39')](_0x599a47,['id',_0x3f6433['id']]);if(_0x25f597)_[_0x60f7('0x14')](_0x3f6433,_[_0x60f7('0x9c')](_[_0x60f7('0x9d')](_0x25f597,_0x33c925),_0x41bead));_0x3f6433['globalStatus']=getAgentStatus(_0x3f6433);return _0x3f6433;});})[_0x60f7('0xf')](function(_0x1362c1){var _0x15e5ee;if(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x9e')]){_0x15e5ee=_[_0x60f7('0x3a')](_0x1362c1,[_0x60f7('0x67'),_0x1c72d2['query'][_0x60f7('0x9e')]]);if(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x9f')]){_0x15e5ee=_[_0x60f7('0x3a')](_0x15e5ee,[_0x60f7('0x6d'),_0x1c72d2['query'][_0x60f7('0x9f')]]);}}if(_0x15e5ee)_0x1362c1=_0x15e5ee;if(!_0x4b1189)return _0x1362c1;return orderAgentsByStatus(_0x1362c1,_0x4b1189);})[_0x60f7('0xf')](function(_0x435111){_0x1dc371[_0x60f7('0x9b')]=_0x435111;return _0x1dc371;})[_0x60f7('0xf')](respondWithFilteredResult(_0xe2c6c0,_0x1ef22f))[_0x60f7('0x15')](handleError(_0xe2c6c0,null));};exports[_0x60f7('0xa0')]=function(_0xd39a03,_0x426af7){var _0x2bd7d8={'count':0x0,'rows':[]},_0x841ab={},_0x3f6504,_0x20d957,_0x35609b,_0x205ebc,_0x29df78;Promise[_0x60f7('0xa1')]()[_0x60f7('0xf')](function(){if(_0xd39a03['query'][_0x60f7('0x88')])_0x3f6504=validateChannel(_0xd39a03[_0x60f7('0x87')][_0x60f7('0x88')]);var _0x17cfce=_['startCase'](_0x3f6504)+_0x60f7('0x47');var _0x145ebf=_[_0x60f7('0x35')](db[_0x17cfce]['rawAttributes'],function(_0x515388){return{'name':_0x515388['fieldName'],'type':_0x515388['type'][_0x60f7('0x8f')]};});_0x841ab=qs[_0x60f7('0x92')](_0x145ebf,_0xd39a03);if(_0xd39a03['user']['role']===_0x60f7('0x96')){var _0x1c207e={'params':{'id':_0xd39a03[_0x60f7('0x96')][_0x60f7('0x97')]},'query':{'section':_0x3f6504===_0x60f7('0x1f')&&_0xd39a03[_0x60f7('0x87')][_0x60f7('0x8e')]===_0x60f7('0x20')?_0x60f7('0xa2'):_['startCase'](_0x3f6504)+_0x60f7('0xa3'),'type':_0xd39a03[_0x60f7('0x87')][_0x60f7('0x8e')],'nolimit':!![],'sort':_0x60f7('0xb'),'filter':_0xd39a03['query']['filter']}};return db['UserProfile'][_0x60f7('0x99')](_0x1c207e);}return db[_0x17cfce][_0x60f7('0x9a')](_0x841ab);})[_0x60f7('0xf')](function(_0x2d5179){_0x2bd7d8[_0x60f7('0x8')]=_0x2d5179['count'];_0x20d957=_0x2d5179[_0x60f7('0x9b')];return getRealtimeQueues(_0xd39a03,_0x3f6504);})[_0x60f7('0xf')](function(_0x538613){_0x205ebc=_0x538613[_0x60f7('0x9b')];return getRealtimeAgents();})['then'](function(_0xd3aa25){_0x35609b=_0xd3aa25[_0x60f7('0x9b')];if(_0x3f6504!=_0x60f7('0x1f'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x28488a){_0x29df78=_0x28488a?_0x28488a[_0x60f7('0x9b')]:[];return initializeQueues(_0x20d957,_0x205ebc,_0x3f6504,_0xd39a03[_0x60f7('0x87')][_0x60f7('0x8e')]);})[_0x60f7('0xf')](function(_0xc24484){var _0x1123c8=_0xc24484['map'](function(_0xdb9045){if(_0x3f6504==='voice')return getVoiceQueueAgents(_0xdb9045,_0x20d957,_0x35609b,_0x29df78);else return getQueueAgents(_0xdb9045,_0x35609b,_0x3f6504);});return Promise[_0x60f7('0xa4')](_0x1123c8);})['then'](function(_0xde20a8){_0x2bd7d8[_0x60f7('0x9b')]=_0xde20a8;return _0x2bd7d8;})['then'](respondWithFilteredResult(_0x426af7,_0x841ab))[_0x60f7('0x15')](handleError(_0x426af7,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 2da9b6d..4da8af3 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4b1a76,_0x5d81b3){var _0xed86e1=function(_0x34d093){while(--_0x34d093){_0x4b1a76['push'](_0x4b1a76['shift']());}};_0xed86e1(++_0x5d81b3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4cd5ca,_0x108db9){var _0x154bfc=function(_0x366ff9){while(--_0x366ff9){_0x4cd5ca['push'](_0x4cd5ca['shift']());}};_0x154bfc(++_0x108db9);}(_0xe706,0xa3));var _0x6e70=function(_0x5ba8fc,_0x3120dd){_0x5ba8fc=_0x5ba8fc-0x0;var _0x974890=_0xe706[_0x5ba8fc];return _0x974890;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5ea0ad3..f6f11e8 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 _0xfdcd=['DATE','exports','INTEGER','STRING'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0xdfdc('0x0')]={'state':{'type':Sequelize[_0xdfdc('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xdfdc('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xdfdc('0x2')]},'starttime':{'type':Sequelize[_0xdfdc('0x3')]},'responsetime':{'type':Sequelize[_0xdfdc('0x3')]},'ringtime':{'type':Sequelize[_0xdfdc('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdfdc('0x2')]},'campaigntype':{'type':Sequelize[_0xdfdc('0x2')]},'membername':{'type':Sequelize[_0xdfdc('0x2')]}}; \ No newline at end of file +var _0xda19=['STRING','exports','INTEGER','DATE'];(function(_0x28cebf,_0x2be3e9){var _0x4ffbc5=function(_0x569dee){while(--_0x569dee){_0x28cebf['push'](_0x28cebf['shift']());}};_0x4ffbc5(++_0x2be3e9);}(_0xda19,0xd5));var _0x9da1=function(_0x53a473,_0x432fff){_0x53a473=_0x53a473-0x0;var _0x204a73=_0xda19[_0x53a473];return _0x204a73;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'state':{'type':Sequelize[_0x9da1('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9da1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9da1('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9da1('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9da1('0x3')]},'campaigntype':{'type':Sequelize[_0x9da1('0x3')]},'membername':{'type':Sequelize[_0x9da1('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 93f61c2..1423c82 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 _0xf33a=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f2a6d,_0x41b785){var _0x36f857=function(_0x1a18e5){while(--_0x1a18e5){_0x2f2a6d['push'](_0x2f2a6d['shift']());}};_0x36f857(++_0x41b785);}(_0xf33a,0x155));var _0xaf33=function(_0x36f5e4,_0x36f27c){_0x36f5e4=_0x36f5e4-0x0;var _0x17f908=_0xf33a[_0x36f5e4];return _0x17f908;};'use strict';var _=require(_0xaf33('0x0'));var util=require(_0xaf33('0x1'));var logger=require('../../config/logger')(_0xaf33('0x2'));var moment=require(_0xaf33('0x3'));var BPromise=require(_0xaf33('0x4'));var rp=require(_0xaf33('0x5'));var fs=require('fs');var path=require(_0xaf33('0x6'));var rimraf=require(_0xaf33('0x7'));var config=require(_0xaf33('0x8'));var attributes=require(_0xaf33('0x9'));module[_0xaf33('0xa')]=function(_0x271daa,_0x196cc7){return _0x271daa[_0xaf33('0xb')](_0xaf33('0xc'),attributes,{'tableName':_0xaf33('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe6a=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','report_agent_preview','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xfe6a,0x15b));var _0xafe6=function(_0x18b239,_0x23edc1){_0x18b239=_0x18b239-0x0;var _0x979ed8=_0xfe6a[_0x18b239];return _0x979ed8;};'use strict';var _=require('lodash');var util=require(_0xafe6('0x0'));var logger=require(_0xafe6('0x1'))('api');var moment=require(_0xafe6('0x2'));var BPromise=require(_0xafe6('0x3'));var rp=require(_0xafe6('0x4'));var fs=require('fs');var path=require(_0xafe6('0x5'));var rimraf=require(_0xafe6('0x6'));var config=require(_0xafe6('0x7'));var attributes=require(_0xafe6('0x8'));module['exports']=function(_0x524a07,_0x9f03b){return _0x524a07[_0xafe6('0x9')]('ReportAgentPreview',attributes,{'tableName':_0xafe6('0xa'),'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 f1daa0f..7a5e3e0 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 _0xd876=['../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x330c71,_0x290139){var _0x1f5916=function(_0x3c2b8d){while(--_0x3c2b8d){_0x330c71['push'](_0x330c71['shift']());}};_0x1f5916(++_0x290139);}(_0xd876,0xff));var _0x6d87=function(_0x362e9f,_0x105264){_0x362e9f=_0x362e9f-0x0;var _0x13e5e6=_0xd876[_0x362e9f];return _0x13e5e6;};'use strict';var _=require(_0x6d87('0x0'));var util=require('util');var moment=require(_0x6d87('0x1'));var BPromise=require(_0x6d87('0x2'));var rs=require(_0x6d87('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d87('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6d87('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6d87('0x6')][_0x6d87('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15c0be,_0x65fa87,_0x1aa589){return new BPromise(function(_0x4c03e8,_0x9d6dc4){return client[_0x6d87('0x8')](_0x15c0be,_0x1aa589)[_0x6d87('0x9')](function(_0x5dd51d){logger[_0x6d87('0xa')](_0x6d87('0xb'),_0x65fa87,_0x6d87('0xc'));logger[_0x6d87('0xd')](_0x6d87('0xe'),_0x65fa87,_0x6d87('0xc'),JSON[_0x6d87('0xf')](_0x5dd51d));if(_0x5dd51d[_0x6d87('0x10')]){if(_0x5dd51d[_0x6d87('0x10')]['code']===0x1f4){logger['error'](_0x6d87('0xb'),_0x65fa87,_0x5dd51d[_0x6d87('0x10')][_0x6d87('0x11')]);return _0x9d6dc4(_0x5dd51d[_0x6d87('0x10')][_0x6d87('0x11')]);}logger[_0x6d87('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x65fa87,_0x5dd51d[_0x6d87('0x10')][_0x6d87('0x11')]);return _0x4c03e8(_0x5dd51d['error'][_0x6d87('0x11')]);}else{logger[_0x6d87('0xa')](_0x6d87('0xb'),_0x65fa87,_0x6d87('0xc'));_0x4c03e8(_0x5dd51d[_0x6d87('0x12')]['message']);}})[_0x6d87('0x13')](function(_0x4e30a2){logger['error'](_0x6d87('0xb'),_0x65fa87,_0x4e30a2);_0x9d6dc4(_0x4e30a2);});});}exports['CreateReportAgentPreview']=function(_0x28ef1e){var _0x1654ed=this;return new Promise(function(_0x34e77f,_0x29715c){return db[_0x6d87('0x14')][_0x6d87('0x15')](_0x28ef1e[_0x6d87('0x16')],{'raw':_0x28ef1e[_0x6d87('0x17')]?_0x28ef1e[_0x6d87('0x17')][_0x6d87('0x18')]===undefined?!![]:![]:!![]})[_0x6d87('0x9')](function(_0x1fa88d){logger[_0x6d87('0xa')](_0x6d87('0x19'),_0x28ef1e);logger[_0x6d87('0xd')]('CreateReportAgentPreview',_0x28ef1e,JSON['stringify'](_0x1fa88d));_0x34e77f(_0x1fa88d);})[_0x6d87('0x13')](function(_0x5362d4){logger[_0x6d87('0x10')](_0x6d87('0x19'),_0x5362d4[_0x6d87('0x11')],_0x28ef1e);_0x29715c(_0x1654ed[_0x6d87('0x10')](0x1f4,_0x5362d4['message']));});});}; \ No newline at end of file +var _0xea6d=['stringify','error','code','message','result','CreateReportAgentPreview','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x9b0ac1,_0x22718b){var _0x13e0a4=function(_0x404343){while(--_0x404343){_0x9b0ac1['push'](_0x9b0ac1['shift']());}};_0x13e0a4(++_0x22718b);}(_0xea6d,0x1ef));var _0xdea6=function(_0x35a150,_0x560b0e){_0x35a150=_0x35a150-0x0;var _0x35330e=_0xea6d[_0x35a150];return _0x35330e;};'use strict';var _=require('lodash');var util=require(_0xdea6('0x0'));var moment=require('moment');var BPromise=require(_0xdea6('0x1'));var rs=require(_0xdea6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdea6('0x3'))['db'];var utils=require(_0xdea6('0x4'));var logger=require(_0xdea6('0x5'))(_0xdea6('0x6'));var config=require(_0xdea6('0x7'));var jayson=require(_0xdea6('0x8'));var client=jayson[_0xdea6('0x9')][_0xdea6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x396453,_0xdc45a2,_0x217028){return new BPromise(function(_0x22d2a0,_0x10b966){return client[_0xdea6('0xb')](_0x396453,_0x217028)[_0xdea6('0xc')](function(_0x395a82){logger[_0xdea6('0xd')](_0xdea6('0xe'),_0xdc45a2,_0xdea6('0xf'));logger[_0xdea6('0x10')](_0xdea6('0x11'),_0xdc45a2,_0xdea6('0xf'),JSON[_0xdea6('0x12')](_0x395a82));if(_0x395a82[_0xdea6('0x13')]){if(_0x395a82[_0xdea6('0x13')][_0xdea6('0x14')]===0x1f4){logger[_0xdea6('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0xdc45a2,_0x395a82['error'][_0xdea6('0x15')]);return _0x10b966(_0x395a82[_0xdea6('0x13')][_0xdea6('0x15')]);}logger[_0xdea6('0x13')](_0xdea6('0xe'),_0xdc45a2,_0x395a82[_0xdea6('0x13')][_0xdea6('0x15')]);return _0x22d2a0(_0x395a82[_0xdea6('0x13')][_0xdea6('0x15')]);}else{logger[_0xdea6('0xd')](_0xdea6('0xe'),_0xdc45a2,_0xdea6('0xf'));_0x22d2a0(_0x395a82[_0xdea6('0x16')][_0xdea6('0x15')]);}})['catch'](function(_0x5183b1){logger[_0xdea6('0x13')](_0xdea6('0xe'),_0xdc45a2,_0x5183b1);_0x10b966(_0x5183b1);});});}exports[_0xdea6('0x17')]=function(_0x2cb23f){var _0x5a1848=this;return new Promise(function(_0x20f6b5,_0x3795c4){return db['ReportAgentPreview']['create'](_0x2cb23f[_0xdea6('0x18')],{'raw':_0x2cb23f[_0xdea6('0x19')]?_0x2cb23f[_0xdea6('0x19')][_0xdea6('0x1a')]===undefined?!![]:![]:!![]})[_0xdea6('0xc')](function(_0x418a7f){logger[_0xdea6('0xd')](_0xdea6('0x17'),_0x2cb23f);logger[_0xdea6('0x10')](_0xdea6('0x17'),_0x2cb23f,JSON['stringify'](_0x418a7f));_0x20f6b5(_0x418a7f);})['catch'](function(_0x359c50){logger[_0xdea6('0x13')](_0xdea6('0x17'),_0x359c50[_0xdea6('0x15')],_0x2cb23f);_0x3795c4(_0x5a1848['error'](0x1f4,_0x359c50['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a2dcaea..38b9c36 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 _0x3656=['util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','post','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3656,0x1a8));var _0x6365=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x3656[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x6365('0x0'));var util=require(_0x6365('0x1'));var path=require(_0x6365('0x2'));var express=require(_0x6365('0x3'));var router=express[_0x6365('0x4')]();var auth=require(_0x6365('0x5'));var controller=require(_0x6365('0x6'));router['get'](_0x6365('0x7'),auth[_0x6365('0x8')](),controller[_0x6365('0x9')]);router[_0x6365('0xa')](_0x6365('0xb'),auth[_0x6365('0x8')](),controller[_0x6365('0xc')]);router[_0x6365('0xa')](_0x6365('0xd'),auth[_0x6365('0x8')](),controller[_0x6365('0xe')]);router[_0x6365('0xa')](_0x6365('0xf'),auth[_0x6365('0x8')](),controller[_0x6365('0x10')]);router[_0x6365('0xa')]('/chat/queues',auth[_0x6365('0x8')](),controller[_0x6365('0x11')]);router['get'](_0x6365('0x12'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x6365('0xa')](_0x6365('0x13'),auth[_0x6365('0x8')](),controller[_0x6365('0x14')]);router[_0x6365('0xa')]('/openchannel/queues',auth[_0x6365('0x8')](),controller[_0x6365('0x15')]);router['get']('/sms/queues',auth[_0x6365('0x8')](),controller[_0x6365('0x16')]);router[_0x6365('0xa')](_0x6365('0x17'),auth[_0x6365('0x8')](),controller[_0x6365('0x18')]);router[_0x6365('0xa')](_0x6365('0x19'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x6365('0xa')](_0x6365('0x1a'),auth[_0x6365('0x8')](),controller[_0x6365('0x1b')]);router[_0x6365('0xa')](_0x6365('0x1c'),auth['isAuthenticated'](),controller[_0x6365('0x1d')]);router[_0x6365('0xa')](_0x6365('0x1e'),auth[_0x6365('0x8')](),controller[_0x6365('0x1f')]);router['get'](_0x6365('0x20'),auth[_0x6365('0x8')](),controller[_0x6365('0x21')]);router[_0x6365('0xa')](_0x6365('0x22'),auth[_0x6365('0x8')](),controller[_0x6365('0x23')]);router[_0x6365('0xa')](_0x6365('0x24'),auth[_0x6365('0x8')](),controller['showVoiceQueues']);router[_0x6365('0x25')](_0x6365('0x24'),auth[_0x6365('0x8')](),controller[_0x6365('0x26')]);router[_0x6365('0xa')](_0x6365('0x27'),auth[_0x6365('0x8')](),controller[_0x6365('0x28')]);router[_0x6365('0xa')](_0x6365('0x29'),auth['isAuthenticated'](),controller[_0x6365('0x2a')]);router['get'](_0x6365('0x2b'),auth[_0x6365('0x8')](),controller[_0x6365('0x2c')]);router['put']('/agents/:id/capacity',auth[_0x6365('0x8')](),controller[_0x6365('0x2d')]);router[_0x6365('0xa')](_0x6365('0x2e'),auth[_0x6365('0x8')](),controller[_0x6365('0x2f')]);router[_0x6365('0xa')]('/trunks',auth[_0x6365('0x8')](),controller['trunks']);router['get']('/campaigns',auth[_0x6365('0x8')](),controller[_0x6365('0x30')]);router['get']('/fax/accounts',auth[_0x6365('0x8')](),controller[_0x6365('0x31')]);router['get'](_0x6365('0x32'),auth[_0x6365('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x6365('0xa')](_0x6365('0x33'),auth['isAuthenticated'](),controller[_0x6365('0x34')]);router['get'](_0x6365('0x35'),auth[_0x6365('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0x6365('0xa')]('/openchannel/queues/:id/waitinginteractions',auth[_0x6365('0x8')](),controller[_0x6365('0x36')]);router['get']('/sms/queues/waitinginteractions',auth[_0x6365('0x8')](),controller[_0x6365('0x37')]);router[_0x6365('0xa')](_0x6365('0x38'),auth[_0x6365('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x6365('0xa')](_0x6365('0x39'),auth[_0x6365('0x8')](),controller[_0x6365('0x3a')]);router['post'](_0x6365('0x3b'),auth[_0x6365('0x8')](),controller[_0x6365('0x3c')](_0x6365('0x3d')));router[_0x6365('0xa')](_0x6365('0x3e'),auth[_0x6365('0x8')](),controller[_0x6365('0x3f')]);router['post'](_0x6365('0x40'),auth['isAuthenticated'](),controller[_0x6365('0x3c')](_0x6365('0x41')));router[_0x6365('0xa')](_0x6365('0x42'),auth[_0x6365('0x8')](),controller[_0x6365('0x43')]);router[_0x6365('0x44')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x6365('0x45')));router[_0x6365('0xa')](_0x6365('0x46'),auth[_0x6365('0x8')](),controller[_0x6365('0x47')]);router[_0x6365('0x44')](_0x6365('0x48'),auth[_0x6365('0x8')](),controller[_0x6365('0x3c')](_0x6365('0x49')));router[_0x6365('0xa')](_0x6365('0x4a'),auth[_0x6365('0x8')](),controller[_0x6365('0x4b')]);router['post'](_0x6365('0x4c'),auth[_0x6365('0x8')](),controller[_0x6365('0x3c')]('sms'));router['post'](_0x6365('0x4d'),auth[_0x6365('0x8')](),controller[_0x6365('0x3c')](_0x6365('0x4e')));router[_0x6365('0xa')](_0x6365('0x4f'),auth[_0x6365('0x8')](),controller[_0x6365('0x50')]);router[_0x6365('0xa')](_0x6365('0x51'),auth[_0x6365('0x8')](),controller[_0x6365('0x52')]);router[_0x6365('0x44')]('/agents/:id/notify',auth[_0x6365('0x8')](),controller[_0x6365('0x53')]);module[_0x6365('0x54')]=router; \ No newline at end of file +var _0xa069=['voiceChannelStopMixMonitor','/voice/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor'];(function(_0x8eb157,_0x59fd52){var _0x4af0be=function(_0x4ca2a4){while(--_0x4ca2a4){_0x8eb157['push'](_0x8eb157['shift']());}};_0x4af0be(++_0x59fd52);}(_0xa069,0x137));var _0x9a06=function(_0x23f1d0,_0x4edc94){_0x23f1d0=_0x23f1d0-0x0;var _0x20e9fb=_0xa069[_0x23f1d0];return _0x20e9fb;};'use strict';var multer=require(_0x9a06('0x0'));var util=require(_0x9a06('0x1'));var path=require('path');var express=require(_0x9a06('0x2'));var router=express[_0x9a06('0x3')]();var auth=require(_0x9a06('0x4'));var controller=require(_0x9a06('0x5'));router[_0x9a06('0x6')](_0x9a06('0x7'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x9')]);router[_0x9a06('0x6')](_0x9a06('0xa'),auth['isAuthenticated'](),controller[_0x9a06('0xb')]);router[_0x9a06('0x6')](_0x9a06('0xc'),auth[_0x9a06('0x8')](),controller[_0x9a06('0xd')]);router[_0x9a06('0x6')](_0x9a06('0xe'),auth[_0x9a06('0x8')](),controller['voiceQueues']);router[_0x9a06('0x6')]('/chat/queues',auth[_0x9a06('0x8')](),controller['chatQueues']);router[_0x9a06('0x6')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x9a06('0x6')](_0x9a06('0xf'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x10')]);router[_0x9a06('0x6')](_0x9a06('0x11'),auth['isAuthenticated'](),controller[_0x9a06('0x12')]);router['get'](_0x9a06('0x13'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x14')]);router['get'](_0x9a06('0x15'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x16')]);router[_0x9a06('0x6')](_0x9a06('0x17'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x18')]);router['get'](_0x9a06('0x19'),auth['isAuthenticated'](),controller[_0x9a06('0x1a')]);router[_0x9a06('0x6')](_0x9a06('0x1b'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x1c')]);router['get'](_0x9a06('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x9a06('0x8')](),controller[_0x9a06('0x1e')]);router[_0x9a06('0x6')](_0x9a06('0x1f'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router['get'](_0x9a06('0x20'),auth[_0x9a06('0x8')](),controller['showVoiceQueues']);router[_0x9a06('0x21')](_0x9a06('0x20'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x22')]);router[_0x9a06('0x6')]('/outbound',auth[_0x9a06('0x8')](),controller[_0x9a06('0x23')]);router[_0x9a06('0x6')](_0x9a06('0x24'),auth['isAuthenticated'](),controller[_0x9a06('0x25')]);router[_0x9a06('0x6')](_0x9a06('0x26'),auth[_0x9a06('0x8')](),controller['agents']);router[_0x9a06('0x21')](_0x9a06('0x27'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x28')]);router[_0x9a06('0x6')](_0x9a06('0x29'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x2a')]);router['get'](_0x9a06('0x2b'),auth[_0x9a06('0x8')](),controller['trunks']);router[_0x9a06('0x6')](_0x9a06('0x2c'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x2d')]);router[_0x9a06('0x6')](_0x9a06('0x2e'),auth['isAuthenticated'](),controller[_0x9a06('0x2f')]);router['get'](_0x9a06('0x30'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x31')]);router[_0x9a06('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x9a06('0x32')]);router[_0x9a06('0x6')](_0x9a06('0x33'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x34')]);router[_0x9a06('0x6')](_0x9a06('0x35'),auth[_0x9a06('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x9a06('0x36'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x37')]);router[_0x9a06('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x9a06('0x8')](),controller[_0x9a06('0x38')]);router['get'](_0x9a06('0x39'),auth['isAuthenticated'](),controller[_0x9a06('0x3a')]);router[_0x9a06('0x3b')](_0x9a06('0x3c'),auth[_0x9a06('0x8')](),controller['queueNotify'](_0x9a06('0x3d')));router[_0x9a06('0x6')](_0x9a06('0x3e'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x3f')]);router[_0x9a06('0x3b')](_0x9a06('0x40'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x41')](_0x9a06('0x42')));router[_0x9a06('0x6')](_0x9a06('0x43'),auth['isAuthenticated'](),controller[_0x9a06('0x44')]);router[_0x9a06('0x3b')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x9a06('0x41')]('fax'));router['get'](_0x9a06('0x45'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x46')]);router[_0x9a06('0x3b')](_0x9a06('0x47'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x41')]('openchannel'));router[_0x9a06('0x6')](_0x9a06('0x48'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x49')]);router['post'](_0x9a06('0x4a'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x41')](_0x9a06('0x4b')));router['post'](_0x9a06('0x4c'),auth[_0x9a06('0x8')](),controller['queueNotify'](_0x9a06('0x4d')));router[_0x9a06('0x6')]('/sms/queues/:id',auth[_0x9a06('0x8')](),controller['showSmsQueues']);router[_0x9a06('0x6')](_0x9a06('0x4e'),auth[_0x9a06('0x8')](),controller[_0x9a06('0x4f')]);router[_0x9a06('0x3b')]('/agents/:id/notify',auth[_0x9a06('0x8')](),controller['agentNotify']);module[_0x9a06('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 804b204..90a3feb 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 _0x207c=['moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','then','error','code','result','status','json','sendStatus','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','INTERACTION','interface','agent','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','Message','messageId','Interaction','queue','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','MessageId','From','*,*,*,*'];(function(_0x30060e,_0x2fdd81){var _0xbd2f83=function(_0x49e5a1){while(--_0x49e5a1){_0x30060e['push'](_0x30060e['shift']());}};_0xbd2f83(++_0x2fdd81);}(_0x207c,0x1e8));var _0xc207=function(_0x5ad0c6,_0x56ee17){_0x5ad0c6=_0x5ad0c6-0x0;var _0x167958=_0x207c[_0x5ad0c6];return _0x167958;};'use strict';var BPromise=require('bluebird');var moment=require(_0xc207('0x0'));var _=require(_0xc207('0x1'));var util=require(_0xc207('0x2'));var db=require(_0xc207('0x3'))['db'];var logger=require(_0xc207('0x4'))(_0xc207('0x5'));var jayson=require(_0xc207('0x6'));var amiClient=jayson['client'][_0xc207('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0xc207('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){var _0x3c579f=_0x59ff6f?_0x59ff6f:amiClient;return _0x3c579f['request'](_0x314561,_0x3395e4)[_0xc207('0x8')](function(_0x817576){if(_0x817576[_0xc207('0x9')]){if(_0x817576[_0xc207('0x9')][_0xc207('0xa')]===0x1f4){return _0xad159b(_0x817576[_0xc207('0x9')]['message']);}return _0x25cb97(_0x817576['error']['message']);}else{_0x25cb97(_0x817576[_0xc207('0xb')]);}})['catch'](function(_0x2741f3){_0xad159b(_0x2741f3);});});}function respondWithResult(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xc8;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0xc')](_0x59d401)[_0xc207('0xd')](_0x3e1108);}return _0x2782ce[_0xc207('0xe')](0x194);};}function handleError(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0x1f4;return function(_0xc62672){logger[_0xc207('0x9')](_0xc62672[_0xc207('0xf')]);if(_0xc62672[_0xc207('0x10')]){delete _0xc62672['name'];}_0xe993a0['status'](_0x51e967)['send'](_0xc62672);};}function findById(_0x1cebfa){return function(_0x6e793d){if(!_[_0xc207('0x11')](_0x1cebfa)&&!_[_0xc207('0x11')](_0x6e793d)&&!_['isNil'](_0x6e793d[_0xc207('0x12')])){return _[_0xc207('0x13')](_0x6e793d[_0xc207('0x12')],function(_0x5f288e){return _0x5f288e['id']==_0x1cebfa;});}return null;};}exports[_0xc207('0x14')]=function(_0x488cc0,_0x42c8ba){return respondWithRpcPromise(_0xc207('0x15'),_0x488cc0[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x42c8ba,null))[_0xc207('0x17')](handleError(_0x42c8ba,null));};exports[_0xc207('0x18')]=function(_0x35c0b0,_0x464dea){return respondWithRpcPromise(_0xc207('0x19'),_[_0xc207('0x1a')](_0x35c0b0[_0xc207('0x16')],_0x35c0b0[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x464dea,null))['catch'](handleError(_0x464dea,null));};exports[_0xc207('0x1c')]=function(_0x5cda23,_0x2e89c5){return respondWithRpcPromise(_0xc207('0x1d'),_[_0xc207('0x1a')](_0x5cda23[_0xc207('0x16')],_0x5cda23[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x2e89c5,null))[_0xc207('0x17')](handleError(_0x2e89c5,null));};exports[_0xc207('0x1e')]=function(_0xa52138,_0x2385f7){return respondWithRpcPromise(_0xc207('0x1f'),_0xa52138[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x2385f7,null))[_0xc207('0x17')](handleError(_0x2385f7,null));};exports[_0xc207('0x20')]=function(_0x56a066,_0x1e1440){return respondWithRpcPromise('VoiceQueues',_0x56a066['query'])[_0xc207('0x8')](findById(_0x56a066[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x1e1440,null))[_0xc207('0x17')](handleError(_0x1e1440,null));};exports[_0xc207('0x21')]=function(_0x478af7,_0xe5e848){return respondWithRpcPromise(_0xc207('0x22'),_[_0xc207('0x1a')](_0x478af7[_0xc207('0x23')],_0x478af7[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0xe5e848,null))[_0xc207('0x17')](handleError(_0xe5e848,null));};exports[_0xc207('0x24')]=function(_0xc6a7ce,_0x3f79e8){return respondWithRpcPromise(_0xc207('0x25'),_[_0xc207('0x1a')](_0xc6a7ce[_0xc207('0x16')],_0xc6a7ce['params']))[_0xc207('0x8')](respondWithResult(_0x3f79e8,null))[_0xc207('0x17')](handleError(_0x3f79e8,null));};exports[_0xc207('0x26')]=function(_0x448df1,_0x24df00){return respondWithRpcPromise(_0xc207('0x27'),_0x448df1['query'])[_0xc207('0x8')](respondWithResult(_0x24df00,null))[_0xc207('0x17')](handleError(_0x24df00,null));};exports[_0xc207('0x28')]=function(_0x1d12fa,_0x58e906){return respondWithRpcPromise(_0xc207('0x29'),_[_0xc207('0x1a')](_0x1d12fa[_0xc207('0x16')],_0x1d12fa[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x58e906,null))[_0xc207('0x17')](handleError(_0x58e906,null));};exports[_0xc207('0x2a')]=function(_0x458de9,_0x586776){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x458de9[_0xc207('0x16')],_0x458de9[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x586776,null))[_0xc207('0x17')](handleError(_0x586776,null));};exports['voiceQueuesChannelRedirect']=function(_0x3bfbf4,_0x433c0f){return respondWithRpcPromise(_0xc207('0x2b'),_[_0xc207('0x1a')](_0x3bfbf4[_0xc207('0x16')],_0x3bfbf4['params']))[_0xc207('0x8')](respondWithResult(_0x433c0f,null))[_0xc207('0x17')](handleError(_0x433c0f,null));};exports['outbound']=function(_0x21dd42,_0x49bada){return respondWithRpcPromise(_0xc207('0x2c'),_0x21dd42[_0xc207('0x16')])['then'](respondWithResult(_0x49bada,null))[_0xc207('0x17')](handleError(_0x49bada,null));};exports[_0xc207('0x2d')]=function(_0x3313b1,_0x502dde){return respondWithRpcPromise('OutboundChannels',_0x3313b1[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x502dde,null))[_0xc207('0x17')](handleError(_0x502dde,null));};exports[_0xc207('0x2e')]=function(_0x4c3e29,_0x3a6f45){var _0x47cdc4;return respondWithRpcPromise('Agents',_0x4c3e29['query'])['then'](function(_0x20cb64){_0x47cdc4=_0x20cb64;return respondWithRpcPromise(_0xc207('0x2f'),_0x4c3e29[_0xc207('0x16')],routingClient);})['then'](function(_0x1dd71e){return _[_0xc207('0x1a')]({},_0x1dd71e,_0x47cdc4);})[_0xc207('0x8')](respondWithResult(_0x3a6f45,null))[_0xc207('0x17')](handleError(_0x3a6f45,null));};exports['agentCapacity']=function(_0x47d43a,_0x223349){if(_0x47d43a[_0xc207('0x23')]&&_0x47d43a[_0xc207('0x23')][_0xc207('0x30')]&&_0x47d43a['user']&&_0x47d43a[_0xc207('0x31')][_0xc207('0x10')]){for(var _0x3a935a in _0x47d43a[_0xc207('0x23')][_0xc207('0x30')]){if(_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0xc207('0x32')](_0x3a935a)){db[_0xc207('0x33')]['findAll']({'where':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')][_0xc207('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a]&&_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0xc207('0x34')]?{'$notIn':_0x47d43a['body'][_0xc207('0x30')][_0x3a935a]}:{'$ne':null}}})[_0xc207('0x8')](function(_0x17da25){var _0x5b50cf=moment()[_0xc207('0x35')](_0xc207('0x36'));for(var _0x2967ad=0x0,_0x45536e=_0x17da25['length'];_0x2967ad<_0x45536e;_0x2967ad+=0x1){_0x17da25[_0x2967ad]['updateAttributes']({'exitAt':_0x5b50cf});}});for(var _0x11ce5a=0x0;_0x11ce5a<_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0xc207('0x34')];_0x11ce5a+=0x1){db[_0xc207('0x33')][_0xc207('0x37')]({'where':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')][_0xc207('0x10')],'type':_0xc207('0x38'),'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0x11ce5a],'exitAt':null},'defaults':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')]['name'],'interface':_['isNil'](_0x47d43a[_0xc207('0x31')][_0xc207('0x39')])?util[_0xc207('0x35')]('SIP/%s',_0x47d43a[_0xc207('0x31')][_0xc207('0x10')]):_0x47d43a[_0xc207('0x31')][_0xc207('0x39')],'type':'INTERACTION','enterAt':moment()[_0xc207('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xc207('0x3a'),'internal':_0x47d43a['user']['internal'],'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0x11ce5a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x47d43a['params']['id'],'capacity':_0x47d43a['body'][_0xc207('0x3b')]},routingClient)[_0xc207('0x8')](respondWithResult(_0x223349,null))[_0xc207('0x17')](handleError(_0x223349,null));};exports[_0xc207('0x3c')]=function(_0x173acf,_0x35e967){return respondWithRpcPromise(_0xc207('0x3d'),_0x173acf[_0xc207('0x16')])['then'](respondWithResult(_0x35e967,null))[_0xc207('0x17')](handleError(_0x35e967,null));};exports[_0xc207('0x3e')]=function(_0x5aedd3,_0x55e0c5){return respondWithRpcPromise(_0xc207('0x3f'),_0x5aedd3['query'])['then'](respondWithResult(_0x55e0c5,null))[_0xc207('0x17')](handleError(_0x55e0c5,null));};exports[_0xc207('0x40')]=function(_0x356c8c,_0x3b2448){return respondWithRpcPromise(_0xc207('0x41'),_0x356c8c[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x3b2448,null))[_0xc207('0x17')](handleError(_0x3b2448,null));};exports[_0xc207('0x42')]=function(_0x278717,_0x2fcfee){return respondWithRpcPromise('ChatQueues',_0x278717['query'],routingClient)[_0xc207('0x8')](respondWithResult(_0x2fcfee,null))[_0xc207('0x17')](handleError(_0x2fcfee,null));};exports[_0xc207('0x43')]=function(_0x313580,_0xaff7a0){return respondWithRpcPromise(_0xc207('0x44'),_0x313580[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x313580[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0xaff7a0,null))[_0xc207('0x17')](handleError(_0xaff7a0,null));};exports[_0xc207('0x45')]=function(_0x19637d,_0x6d387e){return respondWithRpcPromise('MailQueues',_0x19637d[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x6d387e,null))[_0xc207('0x17')](handleError(_0x6d387e,null));};exports[_0xc207('0x46')]=function(_0x464263,_0x45ad58){return respondWithRpcPromise(_0xc207('0x47'),_0x464263['query'],routingClient)[_0xc207('0x8')](findById(_0x464263[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x45ad58,null))[_0xc207('0x17')](handleError(_0x45ad58,null));};exports['mailAccounts']=function(_0xc7812,_0x4f4b58){return respondWithRpcPromise('MailAccounts',_0xc7812[_0xc207('0x16')],mailClient)[_0xc207('0x8')](respondWithResult(_0x4f4b58,null))[_0xc207('0x17')](handleError(_0x4f4b58,null));};exports[_0xc207('0x48')]=function(_0x441d5f,_0x3b1b4c){return respondWithRpcPromise(_0xc207('0x49'),_0x441d5f[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x3b1b4c,null))[_0xc207('0x17')](handleError(_0x3b1b4c,null));};exports[_0xc207('0x4a')]=function(_0x2f97bf,_0x416e85){return respondWithRpcPromise(_0xc207('0x49'),_0x2f97bf[_0xc207('0x16')],routingClient)['then'](findById(_0x2f97bf[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x416e85,null))[_0xc207('0x17')](handleError(_0x416e85,null));};exports[_0xc207('0x4b')]=function(_0x2ade23,_0x52dec1){return respondWithRpcPromise('SmsQueues',_0x2ade23[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x52dec1,null))[_0xc207('0x17')](handleError(_0x52dec1,null));};exports['showSmsQueues']=function(_0x31182c,_0x1cefa3){return respondWithRpcPromise(_0xc207('0x4c'),_0x31182c['query'],routingClient)['then'](findById(_0x31182c[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x1cefa3,null))[_0xc207('0x17')](handleError(_0x1cefa3,null));};exports[_0xc207('0x4d')]=function(_0x3cca53,_0x4b197){return respondWithRpcPromise(_0xc207('0x4e'),_0x3cca53[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x4b197,null))[_0xc207('0x17')](handleError(_0x4b197,null));};exports['showWhatsappQueues']=function(_0x289f7c,_0x85ecad){return respondWithRpcPromise(_0xc207('0x4e'),_0x289f7c[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x289f7c[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x85ecad,null))[_0xc207('0x17')](handleError(_0x85ecad,null));};exports[_0xc207('0x4f')]=function(_0x28f467,_0x203686){return respondWithRpcPromise('FaxQueues',_0x28f467[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x203686,null))[_0xc207('0x17')](handleError(_0x203686,null));};exports[_0xc207('0x50')]=function(_0x584a40,_0x586c41){return respondWithRpcPromise(_0xc207('0x51'),_0x584a40[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x584a40[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x586c41,null))[_0xc207('0x17')](handleError(_0x586c41,null));};exports[_0xc207('0x52')]=function(_0x440fc2,_0x5a04d5){return respondWithRpcPromise(_0xc207('0x53'),_0x440fc2[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x5a04d5,null))['catch'](handleError(_0x5a04d5,null));};exports[_0xc207('0x54')]=function(_0x488c1f,_0x1290e4){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x488c1f[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x1290e4,null))['catch'](handleError(_0x1290e4,null));};exports[_0xc207('0x55')]=function(_0x4c0ef0,_0x446fe8){return respondWithRpcPromise(_0xc207('0x56'),_0x4c0ef0[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x446fe8,null))[_0xc207('0x17')](handleError(_0x446fe8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4b9342,_0x3d1659){return respondWithRpcPromise(_0xc207('0x57'),_0x4b9342['query'],routingClient)[_0xc207('0x8')](respondWithResult(_0x3d1659,null))[_0xc207('0x17')](handleError(_0x3d1659,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x10ab93,_0x13954e){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x10ab93[_0xc207('0x16')],routingClient)[_0xc207('0x8')](function(_0x3748de){if(_0x10ab93[_0xc207('0x16')][_0xc207('0x58')]!==undefined){var _0xef037c=_(_0x3748de['rows'])['filter']([_0x10ab93[_0xc207('0x16')][_0xc207('0x58')],_0x10ab93[_0xc207('0x1b')]['id']])[_0xc207('0x59')](_0xc207('0x5a'))['uniq']()[_0xc207('0x5b')]();return _0x3748de['rows'][_0xc207('0x5c')](function(_0x97f43){return _0xef037c[_0xc207('0x5d')](_0x97f43[_0xc207('0x5a')])>-0x1;});}else{return _0x3748de[_0xc207('0x12')][_0xc207('0x5c')](function(_0x49ebe1){return _0x49ebe1[_0xc207('0x5a')]===parseInt(_0x10ab93[_0xc207('0x1b')]['id']);});}})['then'](respondWithResult(_0x13954e,null))[_0xc207('0x17')](handleError(_0x13954e,null));};exports[_0xc207('0x5e')]=function(_0x36e8b1,_0x3cb12d){return respondWithRpcPromise(_0xc207('0x5f'),_0x36e8b1[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x3cb12d,null))[_0xc207('0x17')](handleError(_0x3cb12d,null));};exports[_0xc207('0x60')]=function(_0x281c71,_0x473560){return respondWithRpcPromise(_0xc207('0x61'),_0x281c71[_0xc207('0x16')],routingClient)['then'](respondWithResult(_0x473560,null))[_0xc207('0x17')](handleError(_0x473560,null));};exports[_0xc207('0x62')]=function(_0x2f4efd,_0x266e65){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2f4efd[_0xc207('0x16')],routingClient)['then'](respondWithResult(_0x266e65,null))[_0xc207('0x17')](handleError(_0x266e65,null));};exports['queueNotify']=function(_0x53cb21){return function(_0x2967e6,_0x220293){var _0x383f83,_0x3adfeb;var _0x20089a=_[_0xc207('0x63')](_0x53cb21);var _0x51b775=_0x53cb21===_0xc207('0x64')?'Website':_0xc207('0x65');return db[_0x20089a+_0xc207('0x66')][_0xc207('0x67')]({'raw':!![],'where':{'id':_0x2967e6[_0xc207('0x1b')]['id']}})['then'](function(_0x25731c){if(_[_0xc207('0x11')](_0x25731c)){throw new Error(_0x20089a+'\x20Queue\x20not\x20found');}_0x383f83=_0x25731c;return db[_0x20089a+_0xc207('0x68')][_0xc207('0x67')]({'where':{'id':_0x2967e6[_0xc207('0x23')][_0xc207('0x69')]},'include':[{'model':db[_0x20089a+'Interaction'],'as':_0xc207('0x6a')},{'model':db[_0x20089a+_0x51b775],'as':_0xc207('0x65')}]});})[_0xc207('0x8')](function(_0x297ee0){if(_['isNil'](_0x297ee0)){throw new Error(_0x20089a+'\x20Message\x20not\x20found');}_0x3adfeb=_0x297ee0;return _0x297ee0['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x273b30={'uniqueid':_0x53cb21+'.'+_0x3adfeb['id']+'.'+_0x3adfeb[_0xc207('0x6a')]['id'],'FromUserId':_0x2967e6[_0xc207('0x31')]['id'],'type':_0xc207('0x6b')};_0x273b30[_0x20089a+'MessageId']=_0x3adfeb['id'];_0x273b30[_0x20089a+'InteractionId']=_0x3adfeb[_0xc207('0x6a')]['id'];_0x273b30['From'+_0x20089a+_0x51b775+'Id']=_0x3adfeb['Account']['id'];_0x273b30['To'+_0x20089a+_0xc207('0x6c')]=_0x383f83['id'];return db[_0x20089a+_0xc207('0x6d')][_0xc207('0x6e')](_0x273b30);})[_0xc207('0x8')](function(){return respondWithRpcPromise(_0xc207('0x6f'),{'channel':_0x53cb21,'interaction':_0x3adfeb['Interaction'],'message':_0x3adfeb,'account':_0x3adfeb[_0xc207('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x383f83[_0xc207('0x10')]+','+(_0x3adfeb[_0xc207('0x65')][_0xc207('0x70')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x220293,null))[_0xc207('0x17')](handleError(_0x220293,null));};};exports[_0xc207('0x71')]=function(_0x1841a4,_0x7d4f9c){var _0x4e5b1c,_0x4d05e5;if(_[_0xc207('0x11')](_0x1841a4['body'][_0xc207('0x72')])){throw new Error(_0xc207('0x73'));}var _0x211884=_0x1841a4[_0xc207('0x23')][_0xc207('0x72')];var _0x5a7bc9=_[_0xc207('0x63')](_0x211884);var _0x328016=_0x211884===_0xc207('0x64')?_0xc207('0x74'):_0xc207('0x65');return db[_0xc207('0x75')][_0xc207('0x67')]({'raw':!![],'where':{'id':_0x1841a4[_0xc207('0x1b')]['id'],'role':_0xc207('0x3a')}})[_0xc207('0x8')](function(_0x48213b){if(_[_0xc207('0x11')](_0x48213b)){throw new Error('Agent\x20not\x20found');}_0x4e5b1c=_0x48213b;return db[_0x5a7bc9+'Message'][_0xc207('0x67')]({'where':{'id':_0x1841a4[_0xc207('0x23')]['messageId']},'include':[{'model':db[_0x5a7bc9+'Interaction'],'as':_0xc207('0x6a')},{'model':db[_0x5a7bc9+_0x328016],'as':_0xc207('0x65')}]});})[_0xc207('0x8')](function(_0x41b655){if(_['isNil'](_0x41b655)){throw new Error(_0x5a7bc9+_0xc207('0x76'));}_0x4d05e5=_0x41b655;return _0x41b655['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xc207('0x8')](function(){var _0x1c7886={'uniqueid':_0x211884+'.'+_0x4d05e5['id']+'.'+_0x4d05e5[_0xc207('0x6a')]['id'],'FromUserId':_0x1841a4[_0xc207('0x31')]['id'],'type':_0xc207('0x6b'),'ToUserId':_0x4e5b1c['id']};_0x1c7886[_0x5a7bc9+_0xc207('0x77')]=_0x4d05e5['id'];_0x1c7886[_0x5a7bc9+'InteractionId']=_0x4d05e5[_0xc207('0x6a')]['id'];_0x1c7886[_0xc207('0x78')+_0x5a7bc9+_0x328016+'Id']=_0x4d05e5['Account']['id'];return db[_0x5a7bc9+'TransferReport']['create'](_0x1c7886);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x211884,'interaction':_0x4d05e5[_0xc207('0x6a')],'message':_0x4d05e5,'account':_0x4d05e5[_0xc207('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xc207('0x3a'),'appdata':_0x4e5b1c['name']+','+(_0x4d05e5[_0xc207('0x65')]['agentTransferTimeout']||0x12c),'interval':_0xc207('0x79')}]},routingClient);})[_0xc207('0x8')](respondWithResult(_0x7d4f9c,null))[_0xc207('0x17')](handleError(_0x7d4f9c,null));}; \ No newline at end of file +var _0x9957=['queueNotify','capitalize','chat','Website','Account','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','QueueId','TransferReport','Start','queue','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','From','create','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','catch','status','json','stack','name','send','isNil','rows','find','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','format','interface','internal','AgentCapacity','telephones','Telephones','trunks','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions'];(function(_0x4c6cf1,_0x453d0d){var _0x56e813=function(_0x3e8319){while(--_0x3e8319){_0x4c6cf1['push'](_0x4c6cf1['shift']());}};_0x56e813(++_0x453d0d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x7995('0x0'));var moment=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x7995('0x4'))(_0x7995('0x5'));var jayson=require(_0x7995('0x6'));var amiClient=jayson[_0x7995('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0x7995('0x7')][_0x7995('0x8')]({'port':0x232b});var routingClient=jayson[_0x7995('0x7')][_0x7995('0x8')]({'port':0x232c});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){var _0x4a64f7=_0x4996ca?_0x4996ca:amiClient;return _0x4a64f7[_0x7995('0x9')](_0xbda126,_0x326741)[_0x7995('0xa')](function(_0x18c8a3){if(_0x18c8a3[_0x7995('0xb')]){if(_0x18c8a3[_0x7995('0xb')][_0x7995('0xc')]===0x1f4){return _0x1cad37(_0x18c8a3[_0x7995('0xb')]['message']);}return _0x465276(_0x18c8a3[_0x7995('0xb')][_0x7995('0xd')]);}else{_0x465276(_0x18c8a3['result']);}})[_0x7995('0xe')](function(_0x2cb37a){_0x1cad37(_0x2cb37a);});});}function respondWithResult(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xc8;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0xf')](_0x385f00)[_0x7995('0x10')](_0x281576);}return _0x19a27e['sendStatus'](0x194);};}function handleError(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0x1f4;return function(_0x2233dd){logger[_0x7995('0xb')](_0x2233dd[_0x7995('0x11')]);if(_0x2233dd[_0x7995('0x12')]){delete _0x2233dd[_0x7995('0x12')];}_0x58f5ad[_0x7995('0xf')](_0x2b4e94)[_0x7995('0x13')](_0x2233dd);};}function findById(_0x5377e5){return function(_0x2eeacc){if(!_['isNil'](_0x5377e5)&&!_[_0x7995('0x14')](_0x2eeacc)&&!_[_0x7995('0x14')](_0x2eeacc[_0x7995('0x15')])){return _[_0x7995('0x16')](_0x2eeacc[_0x7995('0x15')],function(_0x37a7d4){return _0x37a7d4['id']==_0x5377e5;});}return null;};}exports['voiceChannels']=function(_0x54c9ae,_0x2536c8){return respondWithRpcPromise('VoiceChannels',_0x54c9ae['query'])[_0x7995('0xa')](respondWithResult(_0x2536c8,null))[_0x7995('0xe')](handleError(_0x2536c8,null));};exports['voiceChannelMixMonitor']=function(_0x3a9b54,_0x51f276){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x7995('0x17')](_0x3a9b54[_0x7995('0x18')],_0x3a9b54[_0x7995('0x19')]))[_0x7995('0xa')](respondWithResult(_0x51f276,null))[_0x7995('0xe')](handleError(_0x51f276,null));};exports[_0x7995('0x1a')]=function(_0x5d40ae,_0x32a09a){return respondWithRpcPromise(_0x7995('0x1b'),_[_0x7995('0x17')](_0x5d40ae[_0x7995('0x18')],_0x5d40ae[_0x7995('0x19')]))[_0x7995('0xa')](respondWithResult(_0x32a09a,null))[_0x7995('0xe')](handleError(_0x32a09a,null));};exports[_0x7995('0x1c')]=function(_0x59405a,_0x39df42){return respondWithRpcPromise(_0x7995('0x1d'),_0x59405a[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x39df42,null))[_0x7995('0xe')](handleError(_0x39df42,null));};exports[_0x7995('0x1e')]=function(_0x56691a,_0x47625f){return respondWithRpcPromise('VoiceQueues',_0x56691a[_0x7995('0x18')])[_0x7995('0xa')](findById(_0x56691a[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x47625f,null))[_0x7995('0xe')](handleError(_0x47625f,null));};exports['updateVoiceQueue']=function(_0x9b2a15,_0x514445){return respondWithRpcPromise(_0x7995('0x1f'),_[_0x7995('0x17')](_0x9b2a15[_0x7995('0x20')],_0x9b2a15['params']))['then'](respondWithResult(_0x514445,null))['catch'](handleError(_0x514445,null));};exports[_0x7995('0x21')]=function(_0xe6b0b3,_0x327a81){return respondWithRpcPromise(_0x7995('0x22'),_[_0x7995('0x17')](_0xe6b0b3[_0x7995('0x18')],_0xe6b0b3['params']))['then'](respondWithResult(_0x327a81,null))[_0x7995('0xe')](handleError(_0x327a81,null));};exports['voiceQueuesChannels']=function(_0x553671,_0x3eb566){return respondWithRpcPromise(_0x7995('0x23'),_0x553671[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x3eb566,null))['catch'](handleError(_0x3eb566,null));};exports[_0x7995('0x24')]=function(_0x33e24e,_0x5dd802){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x33e24e[_0x7995('0x18')],_0x33e24e[_0x7995('0x19')]))['then'](respondWithResult(_0x5dd802,null))[_0x7995('0xe')](handleError(_0x5dd802,null));};exports['voiceQueuesChannelHangup']=function(_0x37917b,_0x1cb058){return respondWithRpcPromise(_0x7995('0x25'),_['merge'](_0x37917b['query'],_0x37917b[_0x7995('0x19')]))['then'](respondWithResult(_0x1cb058,null))['catch'](handleError(_0x1cb058,null));};exports[_0x7995('0x26')]=function(_0xe328b1,_0x5212ff){return respondWithRpcPromise(_0x7995('0x27'),_[_0x7995('0x17')](_0xe328b1[_0x7995('0x18')],_0xe328b1[_0x7995('0x19')]))[_0x7995('0xa')](respondWithResult(_0x5212ff,null))['catch'](handleError(_0x5212ff,null));};exports[_0x7995('0x28')]=function(_0x242713,_0xf612e6){return respondWithRpcPromise(_0x7995('0x29'),_0x242713['query'])[_0x7995('0xa')](respondWithResult(_0xf612e6,null))[_0x7995('0xe')](handleError(_0xf612e6,null));};exports[_0x7995('0x2a')]=function(_0xe5ea43,_0x1f5bee){return respondWithRpcPromise(_0x7995('0x2b'),_0xe5ea43['query'])[_0x7995('0xa')](respondWithResult(_0x1f5bee,null))[_0x7995('0xe')](handleError(_0x1f5bee,null));};exports[_0x7995('0x2c')]=function(_0x2ea47f,_0x2e04cd){var _0x298fc2;return respondWithRpcPromise(_0x7995('0x2d'),_0x2ea47f[_0x7995('0x18')])[_0x7995('0xa')](function(_0x447981){_0x298fc2=_0x447981;return respondWithRpcPromise(_0x7995('0x2d'),_0x2ea47f[_0x7995('0x18')],routingClient);})[_0x7995('0xa')](function(_0x53cda2){return _['merge']({},_0x53cda2,_0x298fc2);})[_0x7995('0xa')](respondWithResult(_0x2e04cd,null))[_0x7995('0xe')](handleError(_0x2e04cd,null));};exports['agentCapacity']=function(_0x4b0855,_0x3f8522){if(_0x4b0855['body']&&_0x4b0855['body'][_0x7995('0x2e')]&&_0x4b0855[_0x7995('0x2f')]&&_0x4b0855[_0x7995('0x2f')]['name']){for(var _0x46ac4f in _0x4b0855['body'][_0x7995('0x2e')]){if(_0x4b0855['body']['interaction'][_0x7995('0x30')](_0x46ac4f)){db[_0x7995('0x31')][_0x7995('0x32')]({'where':{'channel':_0x46ac4f,'membername':_0x4b0855[_0x7995('0x2f')]['name'],'type':_0x7995('0x33'),'exitAt':null,'uniqueid':_0x4b0855[_0x7995('0x20')][_0x7995('0x2e')][_0x46ac4f]&&_0x4b0855[_0x7995('0x20')]['interaction'][_0x46ac4f]['length']?{'$notIn':_0x4b0855[_0x7995('0x20')]['interaction'][_0x46ac4f]}:{'$ne':null}}})[_0x7995('0xa')](function(_0x59c153){var _0x2f435e=moment()['format'](_0x7995('0x34'));for(var _0x1b0373=0x0,_0x4d9245=_0x59c153[_0x7995('0x35')];_0x1b0373<_0x4d9245;_0x1b0373+=0x1){_0x59c153[_0x1b0373][_0x7995('0x36')]({'exitAt':_0x2f435e});}});for(var _0x314145=0x0;_0x314145<_0x4b0855[_0x7995('0x20')]['interaction'][_0x46ac4f][_0x7995('0x35')];_0x314145+=0x1){db[_0x7995('0x31')][_0x7995('0x37')]({'where':{'channel':_0x46ac4f,'membername':_0x4b0855['user'][_0x7995('0x12')],'type':_0x7995('0x33'),'uniqueid':_0x4b0855[_0x7995('0x20')][_0x7995('0x2e')][_0x46ac4f][_0x314145],'exitAt':null},'defaults':{'channel':_0x46ac4f,'membername':_0x4b0855[_0x7995('0x2f')]['name'],'interface':_[_0x7995('0x14')](_0x4b0855[_0x7995('0x2f')]['interface'])?util[_0x7995('0x38')]('SIP/%s',_0x4b0855[_0x7995('0x2f')][_0x7995('0x12')]):_0x4b0855[_0x7995('0x2f')][_0x7995('0x39')],'type':_0x7995('0x33'),'enterAt':moment()[_0x7995('0x38')](_0x7995('0x34')),'role':'agent','internal':_0x4b0855[_0x7995('0x2f')][_0x7995('0x3a')],'uniqueid':_0x4b0855[_0x7995('0x20')]['interaction'][_0x46ac4f][_0x314145]}});}}}}return respondWithRpcPromise(_0x7995('0x3b'),{'id':_0x4b0855[_0x7995('0x19')]['id'],'capacity':_0x4b0855[_0x7995('0x20')]['capacity']},routingClient)['then'](respondWithResult(_0x3f8522,null))['catch'](handleError(_0x3f8522,null));};exports[_0x7995('0x3c')]=function(_0x1fd1ca,_0x4cf5db){return respondWithRpcPromise(_0x7995('0x3d'),_0x1fd1ca[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x4cf5db,null))[_0x7995('0xe')](handleError(_0x4cf5db,null));};exports[_0x7995('0x3e')]=function(_0x528c8e,_0x29ee32){return respondWithRpcPromise('Trunks',_0x528c8e[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x29ee32,null))[_0x7995('0xe')](handleError(_0x29ee32,null));};exports['campaigns']=function(_0x5e1f34,_0x54e2b1){return respondWithRpcPromise('Campaigns',_0x5e1f34[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x54e2b1,null))[_0x7995('0xe')](handleError(_0x54e2b1,null));};exports[_0x7995('0x3f')]=function(_0x1d957e,_0x357e60){return respondWithRpcPromise(_0x7995('0x40'),_0x1d957e[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0x357e60,null))[_0x7995('0xe')](handleError(_0x357e60,null));};exports[_0x7995('0x41')]=function(_0x133c63,_0x3da72b){return respondWithRpcPromise(_0x7995('0x40'),_0x133c63[_0x7995('0x18')],routingClient)[_0x7995('0xa')](findById(_0x133c63[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x3da72b,null))[_0x7995('0xe')](handleError(_0x3da72b,null));};exports['mailQueues']=function(_0x56a374,_0x630737){return respondWithRpcPromise(_0x7995('0x42'),_0x56a374[_0x7995('0x18')],routingClient)['then'](respondWithResult(_0x630737,null))['catch'](handleError(_0x630737,null));};exports[_0x7995('0x43')]=function(_0x197b52,_0x5b9467){return respondWithRpcPromise(_0x7995('0x42'),_0x197b52['query'],routingClient)[_0x7995('0xa')](findById(_0x197b52[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x5b9467,null))[_0x7995('0xe')](handleError(_0x5b9467,null));};exports['mailAccounts']=function(_0x5e2d97,_0x40e5fc){return respondWithRpcPromise(_0x7995('0x44'),_0x5e2d97[_0x7995('0x18')],mailClient)[_0x7995('0xa')](respondWithResult(_0x40e5fc,null))[_0x7995('0xe')](handleError(_0x40e5fc,null));};exports[_0x7995('0x45')]=function(_0x1d4689,_0x1e2206){return respondWithRpcPromise(_0x7995('0x46'),_0x1d4689['query'],routingClient)[_0x7995('0xa')](respondWithResult(_0x1e2206,null))[_0x7995('0xe')](handleError(_0x1e2206,null));};exports[_0x7995('0x47')]=function(_0x1ecfdb,_0x59c5aa){return respondWithRpcPromise('OpenchannelQueues',_0x1ecfdb[_0x7995('0x18')],routingClient)[_0x7995('0xa')](findById(_0x1ecfdb['params']['id']))[_0x7995('0xa')](respondWithResult(_0x59c5aa,null))[_0x7995('0xe')](handleError(_0x59c5aa,null));};exports[_0x7995('0x48')]=function(_0x57727e,_0x32cb04){return respondWithRpcPromise('SmsQueues',_0x57727e[_0x7995('0x18')],routingClient)['then'](respondWithResult(_0x32cb04,null))[_0x7995('0xe')](handleError(_0x32cb04,null));};exports[_0x7995('0x49')]=function(_0x1722e2,_0x25b534){return respondWithRpcPromise(_0x7995('0x4a'),_0x1722e2[_0x7995('0x18')],routingClient)[_0x7995('0xa')](findById(_0x1722e2[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x25b534,null))[_0x7995('0xe')](handleError(_0x25b534,null));};exports[_0x7995('0x4b')]=function(_0x234d8d,_0x56eb85){return respondWithRpcPromise(_0x7995('0x4c'),_0x234d8d[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0x56eb85,null))[_0x7995('0xe')](handleError(_0x56eb85,null));};exports[_0x7995('0x4d')]=function(_0x54a2e0,_0x4b54f2){return respondWithRpcPromise(_0x7995('0x4c'),_0x54a2e0[_0x7995('0x18')],routingClient)[_0x7995('0xa')](findById(_0x54a2e0[_0x7995('0x19')]['id']))['then'](respondWithResult(_0x4b54f2,null))[_0x7995('0xe')](handleError(_0x4b54f2,null));};exports['faxQueues']=function(_0x5df621,_0xca8238){return respondWithRpcPromise(_0x7995('0x4e'),_0x5df621[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0xca8238,null))[_0x7995('0xe')](handleError(_0xca8238,null));};exports[_0x7995('0x4f')]=function(_0x32a52f,_0x13dc73){return respondWithRpcPromise(_0x7995('0x4e'),_0x32a52f[_0x7995('0x18')],routingClient)['then'](findById(_0x32a52f[_0x7995('0x19')]['id']))[_0x7995('0xa')](respondWithResult(_0x13dc73,null))[_0x7995('0xe')](handleError(_0x13dc73,null));};exports['faxAccounts']=function(_0x1fe1cb,_0x1d2f9d){return respondWithRpcPromise(_0x7995('0x50'),_0x1fe1cb[_0x7995('0x18')])[_0x7995('0xa')](respondWithResult(_0x1d2f9d,null))[_0x7995('0xe')](handleError(_0x1d2f9d,null));};exports[_0x7995('0x51')]=function(_0x3adfd2,_0x2f94c4){return respondWithRpcPromise(_0x7995('0x52'),_0x3adfd2[_0x7995('0x18')],routingClient)['then'](respondWithResult(_0x2f94c4,null))['catch'](handleError(_0x2f94c4,null));};exports[_0x7995('0x53')]=function(_0xfe1105,_0x39ebb6){return respondWithRpcPromise(_0x7995('0x54'),_0xfe1105['query'],routingClient)[_0x7995('0xa')](respondWithResult(_0x39ebb6,null))[_0x7995('0xe')](handleError(_0x39ebb6,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x480fdb,_0x3253b5){return respondWithRpcPromise(_0x7995('0x55'),_0x480fdb['query'],routingClient)[_0x7995('0xa')](respondWithResult(_0x3253b5,null))['catch'](handleError(_0x3253b5,null));};exports[_0x7995('0x56')]=function(_0xea9aba,_0x4ff9ff){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0xea9aba[_0x7995('0x18')],routingClient)['then'](function(_0x31b9e6){if(_0xea9aba[_0x7995('0x18')][_0x7995('0x57')]!==undefined){var _0x45bd8a=_(_0x31b9e6[_0x7995('0x15')])[_0x7995('0x58')]([_0xea9aba[_0x7995('0x18')][_0x7995('0x57')],_0xea9aba[_0x7995('0x19')]['id']])[_0x7995('0x59')](_0x7995('0x5a'))[_0x7995('0x5b')]()[_0x7995('0x5c')]();return _0x31b9e6[_0x7995('0x15')][_0x7995('0x58')](function(_0x3773de){return _0x45bd8a[_0x7995('0x5d')](_0x3773de[_0x7995('0x5a')])>-0x1;});}else{return _0x31b9e6[_0x7995('0x15')][_0x7995('0x58')](function(_0x306fa9){return _0x306fa9[_0x7995('0x5a')]===parseInt(_0xea9aba[_0x7995('0x19')]['id']);});}})[_0x7995('0xa')](respondWithResult(_0x4ff9ff,null))[_0x7995('0xe')](handleError(_0x4ff9ff,null));};exports[_0x7995('0x5e')]=function(_0x2f7f51,_0x34724d){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2f7f51[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0x34724d,null))['catch'](handleError(_0x34724d,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x15e8d1,_0x3fe8fc){return respondWithRpcPromise(_0x7995('0x5f'),_0x15e8d1[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0x3fe8fc,null))[_0x7995('0xe')](handleError(_0x3fe8fc,null));};exports['faxQueuesWaitingInteractions']=function(_0x2f8a2d,_0xb68962){return respondWithRpcPromise(_0x7995('0x60'),_0x2f8a2d[_0x7995('0x18')],routingClient)[_0x7995('0xa')](respondWithResult(_0xb68962,null))[_0x7995('0xe')](handleError(_0xb68962,null));};exports[_0x7995('0x61')]=function(_0xc93dcb){return function(_0x560095,_0x1c8e7d){var _0x2b8217,_0x5c04c9;var _0x479271=_[_0x7995('0x62')](_0xc93dcb);var _0xf8c2ed=_0xc93dcb===_0x7995('0x63')?_0x7995('0x64'):_0x7995('0x65');return db[_0x479271+'Queue'][_0x7995('0x66')]({'raw':!![],'where':{'id':_0x560095[_0x7995('0x19')]['id']}})['then'](function(_0x209977){if(_[_0x7995('0x14')](_0x209977)){throw new Error(_0x479271+'\x20Queue\x20not\x20found');}_0x2b8217=_0x209977;return db[_0x479271+_0x7995('0x67')]['findOne']({'where':{'id':_0x560095[_0x7995('0x20')][_0x7995('0x68')]},'include':[{'model':db[_0x479271+_0x7995('0x69')],'as':_0x7995('0x69')},{'model':db[_0x479271+_0xf8c2ed],'as':_0x7995('0x65')}]});})['then'](function(_0x1f0506){if(_[_0x7995('0x14')](_0x1f0506)){throw new Error(_0x479271+_0x7995('0x6a'));}_0x5c04c9=_0x1f0506;return _0x1f0506['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x7995('0xa')](function(){var _0x3f3434={'uniqueid':_0xc93dcb+'.'+_0x5c04c9['id']+'.'+_0x5c04c9[_0x7995('0x69')]['id'],'FromUserId':_0x560095[_0x7995('0x2f')]['id'],'type':'queue'};_0x3f3434[_0x479271+_0x7995('0x6b')]=_0x5c04c9['id'];_0x3f3434[_0x479271+_0x7995('0x6c')]=_0x5c04c9[_0x7995('0x69')]['id'];_0x3f3434['From'+_0x479271+_0xf8c2ed+'Id']=_0x5c04c9['Account']['id'];_0x3f3434['To'+_0x479271+_0x7995('0x6d')]=_0x2b8217['id'];return db[_0x479271+_0x7995('0x6e')]['create'](_0x3f3434);})['then'](function(){return respondWithRpcPromise(_0x7995('0x6f'),{'channel':_0xc93dcb,'interaction':_0x5c04c9[_0x7995('0x69')],'message':_0x5c04c9,'account':_0x5c04c9[_0x7995('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7995('0x70'),'appdata':_0x2b8217[_0x7995('0x12')]+','+(_0x5c04c9['Account']['queueTransferTimeout']||0x12c),'interval':_0x7995('0x71')}]},routingClient);})['then'](respondWithResult(_0x1c8e7d,null))['catch'](handleError(_0x1c8e7d,null));};};exports[_0x7995('0x72')]=function(_0x3b731e,_0x3192b8){var _0x5eb360,_0x3b1309;if(_[_0x7995('0x14')](_0x3b731e[_0x7995('0x20')][_0x7995('0x73')])){throw new Error(_0x7995('0x74'));}var _0x5799d1=_0x3b731e[_0x7995('0x20')][_0x7995('0x73')];var _0x1a2d6a=_[_0x7995('0x62')](_0x5799d1);var _0x50bf9a=_0x5799d1===_0x7995('0x63')?_0x7995('0x64'):'Account';return db[_0x7995('0x75')][_0x7995('0x66')]({'raw':!![],'where':{'id':_0x3b731e['params']['id'],'role':_0x7995('0x76')}})['then'](function(_0x1b4b34){if(_['isNil'](_0x1b4b34)){throw new Error(_0x7995('0x77'));}_0x5eb360=_0x1b4b34;return db[_0x1a2d6a+'Message'][_0x7995('0x66')]({'where':{'id':_0x3b731e[_0x7995('0x20')]['messageId']},'include':[{'model':db[_0x1a2d6a+_0x7995('0x69')],'as':'Interaction'},{'model':db[_0x1a2d6a+_0x50bf9a],'as':'Account'}]});})[_0x7995('0xa')](function(_0x14812d){if(_[_0x7995('0x14')](_0x14812d)){throw new Error(_0x1a2d6a+_0x7995('0x6a'));}_0x3b1309=_0x14812d;return _0x14812d['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x7995('0xa')](function(){var _0x35044a={'uniqueid':_0x5799d1+'.'+_0x3b1309['id']+'.'+_0x3b1309['Interaction']['id'],'FromUserId':_0x3b731e['user']['id'],'type':_0x7995('0x70'),'ToUserId':_0x5eb360['id']};_0x35044a[_0x1a2d6a+'MessageId']=_0x3b1309['id'];_0x35044a[_0x1a2d6a+_0x7995('0x6c')]=_0x3b1309[_0x7995('0x69')]['id'];_0x35044a[_0x7995('0x78')+_0x1a2d6a+_0x50bf9a+'Id']=_0x3b1309['Account']['id'];return db[_0x1a2d6a+'TransferReport'][_0x7995('0x79')](_0x35044a);})['then'](function(){return respondWithRpcPromise(_0x7995('0x6f'),{'channel':_0x5799d1,'interaction':_0x3b1309[_0x7995('0x69')],'message':_0x3b1309,'account':_0x3b1309[_0x7995('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7995('0x76'),'appdata':_0x5eb360['name']+','+(_0x3b1309['Account']['agentTransferTimeout']||0x12c),'interval':_0x7995('0x71')}]},routingClient);})[_0x7995('0xa')](respondWithResult(_0x3192b8,null))[_0x7995('0xe')](handleError(_0x3192b8,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 13c5cf3..1b1c959 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 _0xf6c6=['run','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','show','/:id/run'];(function(_0x2216c3,_0x42e341){var _0x56fd3d=function(_0x5ac34d){while(--_0x5ac34d){_0x2216c3['push'](_0x2216c3['shift']());}};_0x56fd3d(++_0x42e341);}(_0xf6c6,0x1e8));var _0x6f6c=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf6c6[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require(_0x6f6c('0x0'));var util=require(_0x6f6c('0x1'));var path=require(_0x6f6c('0x2'));var timeout=require(_0x6f6c('0x3'));var express=require(_0x6f6c('0x4'));var router=express[_0x6f6c('0x5')]();var fs_extra=require(_0x6f6c('0x6'));var auth=require(_0x6f6c('0x7'));var interaction=require(_0x6f6c('0x8'));var config=require(_0x6f6c('0x9'));var controller=require(_0x6f6c('0xa'));router['get']('/',auth[_0x6f6c('0xb')](),controller[_0x6f6c('0xc')]);router[_0x6f6c('0xd')]('/:id',auth[_0x6f6c('0xb')](),controller[_0x6f6c('0xe')]);router[_0x6f6c('0xd')](_0x6f6c('0xf'),auth[_0x6f6c('0xb')](),controller[_0x6f6c('0x10')]);router['post']('/',auth[_0x6f6c('0xb')](),controller[_0x6f6c('0x11')]);router[_0x6f6c('0x12')](_0x6f6c('0x13'),auth['isAuthenticated'](),controller[_0x6f6c('0x14')]);router[_0x6f6c('0x15')](_0x6f6c('0x13'),auth[_0x6f6c('0xb')](),controller[_0x6f6c('0x16')]);module[_0x6f6c('0x17')]=router; \ No newline at end of file +var _0xb8a3=['/:id','show','/:id/run','run','post','put','update','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xb8a3,0x101));var _0x3b8a=function(_0x13a3cb,_0x3373fc){_0x13a3cb=_0x13a3cb-0x0;var _0x293f42=_0xb8a3[_0x13a3cb];return _0x293f42;};'use strict';var multer=require(_0x3b8a('0x0'));var util=require('util');var path=require(_0x3b8a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3b8a('0x2'));var auth=require(_0x3b8a('0x3'));var interaction=require(_0x3b8a('0x4'));var config=require(_0x3b8a('0x5'));var controller=require('./schedule.controller');router[_0x3b8a('0x6')]('/',auth[_0x3b8a('0x7')](),controller[_0x3b8a('0x8')]);router['get'](_0x3b8a('0x9'),auth[_0x3b8a('0x7')](),controller[_0x3b8a('0xa')]);router['get'](_0x3b8a('0xb'),auth[_0x3b8a('0x7')](),controller[_0x3b8a('0xc')]);router[_0x3b8a('0xd')]('/',auth[_0x3b8a('0x7')](),controller['create']);router[_0x3b8a('0xe')](_0x3b8a('0x9'),auth[_0x3b8a('0x7')](),controller[_0x3b8a('0xf')]);router[_0x3b8a('0x10')](_0x3b8a('0x9'),auth[_0x3b8a('0x7')](),controller[_0x3b8a('0x11')]);module[_0x3b8a('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index cc2a3db..2fc0d0e 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 _0x79e2=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','days','csv','pdf','xlsx','custom','default','TEXT','sequelize'];(function(_0x2435b8,_0x3bce09){var _0x2cfea0=function(_0x4d55e0){while(--_0x4d55e0){_0x2435b8['push'](_0x2435b8['shift']());}};_0x2cfea0(++_0x3bce09);}(_0x79e2,0x15f));var _0x279e=function(_0x446789,_0x40aa74){_0x446789=_0x446789-0x0;var _0x534e45=_0x79e2[_0x446789];return _0x534e45;};'use strict';var Sequelize=require(_0x279e('0x0'));module[_0x279e('0x1')]={'name':{'type':Sequelize[_0x279e('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x279e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x279e('0x4')},'startAt':{'type':Sequelize[_0x279e('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x279e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x279e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x279e('0x7')]('years',_0x279e('0x8'),'months','weeks',_0x279e('0x9'),'hours','minutes'),'allowNull':![],'defaultValue':_0x279e('0x9')},'output':{'type':Sequelize['ENUM'](_0x279e('0xa'),_0x279e('0xb'),_0x279e('0xc')),'allowNull':![],'defaultValue':_0x279e('0xa')},'type':{'type':Sequelize[_0x279e('0x7')](_0x279e('0xd'),_0x279e('0xe')),'allowNull':![],'defaultValue':_0x279e('0xd')},'sendMail':{'type':Sequelize[_0x279e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x279e('0x2')]},'cc':{'type':Sequelize[_0x279e('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6092=['sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','weeks','days','hours','minutes','ENUM','csv','pdf','xlsx','custom','TEXT'];(function(_0x641f18,_0x2919e8){var _0x16eefe=function(_0x578a89){while(--_0x578a89){_0x641f18['push'](_0x641f18['shift']());}};_0x16eefe(++_0x2919e8);}(_0x6092,0x143));var _0x2609=function(_0x1332c6,_0xac7e0){_0x1332c6=_0x1332c6-0x0;var _0x4db71b=_0x6092[_0x1332c6];return _0x4db71b;};'use strict';var Sequelize=require(_0x2609('0x0'));module['exports']={'name':{'type':Sequelize[_0x2609('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2609('0x1')]},'active':{'type':Sequelize[_0x2609('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2609('0x1')],'allowNull':![],'defaultValue':_0x2609('0x3')},'startAt':{'type':Sequelize[_0x2609('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2609('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2609('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x2609('0x6'),'quarters','months',_0x2609('0x7'),_0x2609('0x8'),_0x2609('0x9'),_0x2609('0xa')),'allowNull':![],'defaultValue':_0x2609('0x8')},'output':{'type':Sequelize[_0x2609('0xb')](_0x2609('0xc'),_0x2609('0xd'),_0x2609('0xe')),'allowNull':![],'defaultValue':_0x2609('0xc')},'type':{'type':Sequelize[_0x2609('0xb')](_0x2609('0xf'),'default'),'allowNull':![],'defaultValue':_0x2609('0xf')},'sendMail':{'type':Sequelize[_0x2609('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x2609('0x1')]},'cc':{'type':Sequelize[_0x2609('0x10')]},'bcc':{'type':Sequelize[_0x2609('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x2609('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 d6470fa..287da89 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 _0xa40e=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','name','index','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','Schedule','includeAll','findAll','catch','params','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5d72e1,_0x38740a){var _0x2f973e=function(_0x18c34d){while(--_0x18c34d){_0x5d72e1['push'](_0x5d72e1['shift']());}};_0x2f973e(++_0x38740a);}(_0xa40e,0xe5));var _0xea40=function(_0x2765b1,_0x3b47a4){_0x2765b1=_0x2765b1-0x0;var _0x761c6e=_0xa40e[_0x2765b1];return _0x761c6e;};'use strict';var emlformat=require(_0xea40('0x0'));var rimraf=require(_0xea40('0x1'));var zipdir=require(_0xea40('0x2'));var jsonpatch=require(_0xea40('0x3'));var rp=require(_0xea40('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xea40('0x5'));var sox=require(_0xea40('0x6'));var csv=require(_0xea40('0x7'));var ejs=require(_0xea40('0x8'));var fs=require('fs');var fs_extra=require(_0xea40('0x9'));var _=require(_0xea40('0xa'));var squel=require(_0xea40('0xb'));var crypto=require(_0xea40('0xc'));var jsforce=require(_0xea40('0xd'));var deskjs=require(_0xea40('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea40('0xf'));var Papa=require(_0xea40('0x10'));var Redis=require(_0xea40('0x11'));var authService=require(_0xea40('0x12'));var qs=require(_0xea40('0x13'));var as=require(_0xea40('0x14'));var hardwareService=require(_0xea40('0x15'));var logger=require('../../config/logger')(_0xea40('0x16'));var utils=require(_0xea40('0x17'));var config=require(_0xea40('0x18'));var licenseUtil=require(_0xea40('0x19'));var db=require(_0xea40('0x1a'))['db'];function respondWithStatusCode(_0x5d35db,_0x1faccc){_0x1faccc=_0x1faccc||0xcc;return function(_0x5a3b3d){if(_0x5a3b3d){return _0x5d35db[_0xea40('0x1b')](_0x1faccc);}return _0x5d35db['status'](_0x1faccc)[_0xea40('0x1c')]();};}function respondWithResult(_0x30da77,_0x17eb4a){_0x17eb4a=_0x17eb4a||0xc8;return function(_0x4be284){if(_0x4be284){return _0x30da77[_0xea40('0x1d')](_0x17eb4a)[_0xea40('0x1e')](_0x4be284);}};}function respondWithFilteredResult(_0x43fc94,_0x59969e){return function(_0x3d8389){if(_0x3d8389){var _0x45052f=typeof _0x59969e[_0xea40('0x1f')]==='undefined'&&typeof _0x59969e[_0xea40('0x20')]===_0xea40('0x21');var _0x54973f=_0x3d8389[_0xea40('0x22')];var _0x31e16d=_0x45052f?0x0:_0x59969e[_0xea40('0x1f')];var _0x502fa4=_0x45052f?_0x3d8389[_0xea40('0x22')]:_0x59969e[_0xea40('0x1f')]+_0x59969e[_0xea40('0x20')];var _0x1a2caa;if(_0x502fa4>=_0x54973f){_0x502fa4=_0x54973f;_0x1a2caa=0xc8;}else{_0x1a2caa=0xce;}_0x43fc94['status'](_0x1a2caa);return _0x43fc94[_0xea40('0x23')](_0xea40('0x24'),_0x31e16d+'-'+_0x502fa4+'/'+_0x54973f)['json'](_0x3d8389);}return null;};}function patchUpdates(_0x1f48f6){return function(_0x33335f){try{jsonpatch[_0xea40('0x25')](_0x33335f,_0x1f48f6,!![]);}catch(_0x32f09d){return BPromise[_0xea40('0x26')](_0x32f09d);}return _0x33335f[_0xea40('0x27')]();};}function saveUpdates(_0xd0d5c0,_0xfd8aef){return function(_0x552d9b){if(_0x552d9b){return _0x552d9b[_0xea40('0x28')](_0xd0d5c0)[_0xea40('0x29')](function(_0x2d8fa1){return _0x2d8fa1;});}return null;};}function removeEntity(_0x5a593d,_0x27d951){return function(_0x331d9a){if(_0x331d9a){return _0x331d9a['destroy']()[_0xea40('0x29')](function(){var _0x3f448a=_0x331d9a[_0xea40('0x2a')]({'plain':!![]});var _0x2fdb2a=_0xea40('0x2b');return db[_0xea40('0x2c')][_0xea40('0x2d')]({'where':{'type':_0x2fdb2a,'resourceId':_0x3f448a['id']}})[_0xea40('0x29')](function(){return _0x331d9a;});})[_0xea40('0x29')](function(){_0x5a593d[_0xea40('0x1d')](0xcc)[_0xea40('0x1c')]();});}};}function handleEntityNotFound(_0x4631e3,_0x2c2954){return function(_0x104fb0){if(!_0x104fb0){_0x4631e3[_0xea40('0x1b')](0x194);}return _0x104fb0;};}function handleError(_0x92d542,_0x12abbb){_0x12abbb=_0x12abbb||0x1f4;return function(_0x362e2f){logger[_0xea40('0x2e')](_0x362e2f['stack']);if(_0x362e2f[_0xea40('0x2f')]){delete _0x362e2f[_0xea40('0x2f')];}_0x92d542[_0xea40('0x1d')](_0x12abbb)['send'](_0x362e2f);};}exports[_0xea40('0x30')]=function(_0x160ab0,_0x310135){var _0x5eddca={},_0x127503={},_0x2e4c1a={'count':0x0,'rows':[]};var _0x37e0bf=_['map'](db['Schedule'][_0xea40('0x31')],function(_0x1a808f){return{'name':_0x1a808f[_0xea40('0x32')],'type':_0x1a808f[_0xea40('0x33')][_0xea40('0x34')]};});_0x127503['model']=_['map'](_0x37e0bf,'name');_0x127503[_0xea40('0x35')]=_[_0xea40('0x36')](_0x160ab0[_0xea40('0x35')]);_0x127503[_0xea40('0x37')]=_['intersection'](_0x127503[_0xea40('0x38')],_0x127503[_0xea40('0x35')]);_0x5eddca['attributes']=_[_0xea40('0x39')](_0x127503['model'],qs['fields'](_0x160ab0[_0xea40('0x35')][_0xea40('0x3a')]));_0x5eddca[_0xea40('0x3b')]=_0x5eddca[_0xea40('0x3b')]['length']?_0x5eddca['attributes']:_0x127503['model'];if(!_0x160ab0['query'][_0xea40('0x3c')](_0xea40('0x3d'))){_0x5eddca[_0xea40('0x20')]=qs[_0xea40('0x20')](_0x160ab0['query']['limit']);_0x5eddca[_0xea40('0x1f')]=qs['offset'](_0x160ab0[_0xea40('0x35')][_0xea40('0x1f')]);}_0x5eddca['order']=qs[_0xea40('0x3e')](_0x160ab0[_0xea40('0x35')][_0xea40('0x3e')]);_0x5eddca[_0xea40('0x3f')]=qs[_0xea40('0x37')](_[_0xea40('0x40')](_0x160ab0[_0xea40('0x35')],_0x127503['filters']),_0x37e0bf);if(_0x160ab0[_0xea40('0x35')][_0xea40('0x41')]){_0x5eddca['where']=_[_0xea40('0x42')](_0x5eddca[_0xea40('0x3f')],{'$or':_[_0xea40('0x43')](_0x37e0bf,function(_0x18bbc1){if(_0x18bbc1[_0xea40('0x33')]!=='VIRTUAL'){var _0x59b044={};_0x59b044[_0x18bbc1[_0xea40('0x2f')]]={'$like':'%'+_0x160ab0['query'][_0xea40('0x41')]+'%'};return _0x59b044;}})});}_0x5eddca=_[_0xea40('0x42')]({},_0x5eddca,_0x160ab0[_0xea40('0x44')]);var _0x373f82={'where':_0x5eddca[_0xea40('0x3f')]};return db[_0xea40('0x45')][_0xea40('0x22')](_0x373f82)[_0xea40('0x29')](function(_0x1fc3d8){_0x2e4c1a[_0xea40('0x22')]=_0x1fc3d8;if(_0x160ab0[_0xea40('0x35')][_0xea40('0x46')]){_0x5eddca['include']=[{'all':!![]}];}return db['Schedule'][_0xea40('0x47')](_0x5eddca);})[_0xea40('0x29')](function(_0x3001c9){_0x2e4c1a['rows']=_0x3001c9;return _0x2e4c1a;})[_0xea40('0x29')](respondWithFilteredResult(_0x310135,_0x5eddca))[_0xea40('0x48')](handleError(_0x310135,null));};exports['show']=function(_0x18bdd0,_0xd035a1){var _0x197bf4={'raw':![],'where':{'id':_0x18bdd0[_0xea40('0x49')]['id']}},_0x35c34f={};_0x35c34f[_0xea40('0x38')]=_[_0xea40('0x36')](db[_0xea40('0x45')][_0xea40('0x31')]);_0x35c34f['query']=_[_0xea40('0x36')](_0x18bdd0['query']);_0x35c34f[_0xea40('0x37')]=_['intersection'](_0x35c34f[_0xea40('0x38')],_0x35c34f[_0xea40('0x35')]);_0x197bf4['attributes']=_[_0xea40('0x39')](_0x35c34f[_0xea40('0x38')],qs[_0xea40('0x3a')](_0x18bdd0[_0xea40('0x35')][_0xea40('0x3a')]));_0x197bf4[_0xea40('0x3b')]=_0x197bf4[_0xea40('0x3b')][_0xea40('0x4a')]?_0x197bf4[_0xea40('0x3b')]:_0x35c34f[_0xea40('0x38')];if(_0x18bdd0[_0xea40('0x35')][_0xea40('0x46')]){_0x197bf4[_0xea40('0x4b')]=[{'all':!![]}];}_0x197bf4=_[_0xea40('0x42')]({},_0x197bf4,_0x18bdd0['options']);return db[_0xea40('0x45')][_0xea40('0x4c')](_0x197bf4)[_0xea40('0x29')](handleEntityNotFound(_0xd035a1,null))['then'](respondWithResult(_0xd035a1,null))[_0xea40('0x48')](handleError(_0xd035a1,null));};exports[_0xea40('0x4d')]=function(_0x4c4efd,_0x7cd543){return db[_0xea40('0x45')]['create'](_0x4c4efd[_0xea40('0x4e')],{})[_0xea40('0x29')](function(_0x4de1fa){var _0x4e0606=_0x4c4efd['user'][_0xea40('0x2a')]({'plain':!![]});if(!_0x4e0606)throw new Error(_0xea40('0x4f'));if(_0x4e0606['role']==='user'){var _0x1ae597=_0x4de1fa[_0xea40('0x2a')]({'plain':!![]});var _0xdca0c0=_0xea40('0x2b');return db['UserProfileSection'][_0xea40('0x4c')]({'where':{'name':_0xdca0c0,'userProfileId':_0x4e0606[_0xea40('0x50')]},'raw':!![]})['then'](function(_0x555d27){if(_0x555d27&&_0x555d27[_0xea40('0x51')]===0x0){return db[_0xea40('0x2c')][_0xea40('0x4d')]({'name':_0x1ae597[_0xea40('0x2f')],'resourceId':_0x1ae597['id'],'type':_0x555d27[_0xea40('0x2f')],'sectionId':_0x555d27['id']},{})[_0xea40('0x29')](function(){return _0x4de1fa;});}else{return _0x4de1fa;}})[_0xea40('0x48')](function(_0x29dce1){logger[_0xea40('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29dce1);throw _0x29dce1;});}return _0x4de1fa;})[_0xea40('0x29')](respondWithResult(_0x7cd543,0xc9))['catch'](handleError(_0x7cd543,null));};exports[_0xea40('0x28')]=function(_0x5f5285,_0x385c3e){if(_0x5f5285['body']['id']){delete _0x5f5285['body']['id'];}return db[_0xea40('0x45')][_0xea40('0x4c')]({'where':{'id':_0x5f5285['params']['id']}})[_0xea40('0x29')](handleEntityNotFound(_0x385c3e,null))[_0xea40('0x29')](saveUpdates(_0x5f5285[_0xea40('0x4e')],null))['then'](respondWithResult(_0x385c3e,null))[_0xea40('0x48')](handleError(_0x385c3e,null));};exports[_0xea40('0x2d')]=function(_0x10e92d,_0x201d69){return db['Schedule'][_0xea40('0x4c')]({'where':{'id':_0x10e92d['params']['id']}})[_0xea40('0x29')](handleEntityNotFound(_0x201d69,null))['then'](removeEntity(_0x201d69,null))[_0xea40('0x48')](handleError(_0x201d69,null));};exports[_0xea40('0x52')]=function(_0x5ed23c,_0xbc1902,_0x43d996){var _0x9c48fe=require('../../config/schedule');return db[_0xea40('0x45')][_0xea40('0x4c')]({'where':{'id':_0x5ed23c[_0xea40('0x49')]['id']},'raw':!![]})[_0xea40('0x29')](handleEntityNotFound(_0xbc1902,null))[_0xea40('0x29')](function(){_0x9c48fe[_0xea40('0x52')](_0x5ed23c[_0xea40('0x49')]['id']);})[_0xea40('0x29')](respondWithStatusCode(_0xbc1902,null))[_0xea40('0x48')](handleError(_0xbc1902,null));}; \ No newline at end of file +var _0x8040=['query','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','Schedule','rawAttributes','fieldName','key','model','map','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x5270a2,_0x119ebf){var _0x55c4f3=function(_0x107dbc){while(--_0x107dbc){_0x5270a2['push'](_0x5270a2['shift']());}};_0x55c4f3(++_0x119ebf);}(_0x8040,0x1b7));var _0x0804=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8040[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x0804('0x0'));var rimraf=require(_0x0804('0x1'));var zipdir=require(_0x0804('0x2'));var jsonpatch=require(_0x0804('0x3'));var rp=require(_0x0804('0x4'));var moment=require(_0x0804('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0804('0x6'));var util=require(_0x0804('0x7'));var path=require(_0x0804('0x8'));var sox=require('sox');var csv=require(_0x0804('0x9'));var ejs=require(_0x0804('0xa'));var fs=require('fs');var fs_extra=require(_0x0804('0xb'));var _=require(_0x0804('0xc'));var squel=require('squel');var crypto=require(_0x0804('0xd'));var jsforce=require(_0x0804('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0804('0xf'));var Papa=require(_0x0804('0x10'));var Redis=require('ioredis');var authService=require(_0x0804('0x11'));var qs=require(_0x0804('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0804('0x13'));var logger=require('../../config/logger')(_0x0804('0x14'));var utils=require('../../config/utils');var config=require(_0x0804('0x15'));var licenseUtil=require(_0x0804('0x16'));var db=require(_0x0804('0x17'))['db'];function respondWithStatusCode(_0x4b6975,_0x1a6987){_0x1a6987=_0x1a6987||0xcc;return function(_0x4750cc){if(_0x4750cc){return _0x4b6975[_0x0804('0x18')](_0x1a6987);}return _0x4b6975[_0x0804('0x19')](_0x1a6987)[_0x0804('0x1a')]();};}function respondWithResult(_0x5a201a,_0x3711b4){_0x3711b4=_0x3711b4||0xc8;return function(_0x518ddb){if(_0x518ddb){return _0x5a201a[_0x0804('0x19')](_0x3711b4)[_0x0804('0x1b')](_0x518ddb);}};}function respondWithFilteredResult(_0x568c28,_0x3b5f21){return function(_0x1b0158){if(_0x1b0158){var _0x277f6e=typeof _0x3b5f21[_0x0804('0x1c')]==='undefined'&&typeof _0x3b5f21['limit']===_0x0804('0x1d');var _0x2e9a89=_0x1b0158[_0x0804('0x1e')];var _0xbca25c=_0x277f6e?0x0:_0x3b5f21[_0x0804('0x1c')];var _0x34b9ab=_0x277f6e?_0x1b0158['count']:_0x3b5f21[_0x0804('0x1c')]+_0x3b5f21[_0x0804('0x1f')];var _0x19fd44;if(_0x34b9ab>=_0x2e9a89){_0x34b9ab=_0x2e9a89;_0x19fd44=0xc8;}else{_0x19fd44=0xce;}_0x568c28[_0x0804('0x19')](_0x19fd44);return _0x568c28[_0x0804('0x20')](_0x0804('0x21'),_0xbca25c+'-'+_0x34b9ab+'/'+_0x2e9a89)[_0x0804('0x1b')](_0x1b0158);}return null;};}function patchUpdates(_0x8c7856){return function(_0x4dbff1){try{jsonpatch[_0x0804('0x22')](_0x4dbff1,_0x8c7856,!![]);}catch(_0x24f59c){return BPromise[_0x0804('0x23')](_0x24f59c);}return _0x4dbff1[_0x0804('0x24')]();};}function saveUpdates(_0x12c574,_0x37cccb){return function(_0x2d30d6){if(_0x2d30d6){return _0x2d30d6[_0x0804('0x25')](_0x12c574)[_0x0804('0x26')](function(_0x4af15d){return _0x4af15d;});}return null;};}function removeEntity(_0x57d202,_0xd1024f){return function(_0x26dea9){if(_0x26dea9){return _0x26dea9[_0x0804('0x27')]()['then'](function(){var _0x19242c=_0x26dea9['get']({'plain':!![]});var _0x564178='Scheduler';return db[_0x0804('0x28')][_0x0804('0x27')]({'where':{'type':_0x564178,'resourceId':_0x19242c['id']}})[_0x0804('0x26')](function(){return _0x26dea9;});})[_0x0804('0x26')](function(){_0x57d202[_0x0804('0x19')](0xcc)[_0x0804('0x1a')]();});}};}function handleEntityNotFound(_0x34a01e,_0x494969){return function(_0x5666fa){if(!_0x5666fa){_0x34a01e['sendStatus'](0x194);}return _0x5666fa;};}function handleError(_0x106ec9,_0x2fbc28){_0x2fbc28=_0x2fbc28||0x1f4;return function(_0x1f6afc){logger[_0x0804('0x29')](_0x1f6afc[_0x0804('0x2a')]);if(_0x1f6afc['name']){delete _0x1f6afc[_0x0804('0x2b')];}_0x106ec9[_0x0804('0x19')](_0x2fbc28)[_0x0804('0x2c')](_0x1f6afc);};}exports[_0x0804('0x2d')]=function(_0x8b1f80,_0x5c0a40){var _0x3c043c={},_0x13e506={},_0x56f075={'count':0x0,'rows':[]};var _0x4fa9b1=_['map'](db[_0x0804('0x2e')][_0x0804('0x2f')],function(_0x2148af){return{'name':_0x2148af[_0x0804('0x30')],'type':_0x2148af['type'][_0x0804('0x31')]};});_0x13e506[_0x0804('0x32')]=_[_0x0804('0x33')](_0x4fa9b1,_0x0804('0x2b'));_0x13e506['query']=_[_0x0804('0x34')](_0x8b1f80['query']);_0x13e506[_0x0804('0x35')]=_[_0x0804('0x36')](_0x13e506[_0x0804('0x32')],_0x13e506['query']);_0x3c043c[_0x0804('0x37')]=_[_0x0804('0x36')](_0x13e506[_0x0804('0x32')],qs[_0x0804('0x38')](_0x8b1f80['query']['fields']));_0x3c043c[_0x0804('0x37')]=_0x3c043c[_0x0804('0x37')][_0x0804('0x39')]?_0x3c043c[_0x0804('0x37')]:_0x13e506[_0x0804('0x32')];if(!_0x8b1f80['query'][_0x0804('0x3a')]('nolimit')){_0x3c043c[_0x0804('0x1f')]=qs[_0x0804('0x1f')](_0x8b1f80[_0x0804('0x3b')]['limit']);_0x3c043c[_0x0804('0x1c')]=qs[_0x0804('0x1c')](_0x8b1f80[_0x0804('0x3b')]['offset']);}_0x3c043c['order']=qs['sort'](_0x8b1f80['query']['sort']);_0x3c043c[_0x0804('0x3c')]=qs[_0x0804('0x35')](_[_0x0804('0x3d')](_0x8b1f80['query'],_0x13e506[_0x0804('0x35')]),_0x4fa9b1);if(_0x8b1f80['query'][_0x0804('0x3e')]){_0x3c043c[_0x0804('0x3c')]=_[_0x0804('0x3f')](_0x3c043c[_0x0804('0x3c')],{'$or':_[_0x0804('0x33')](_0x4fa9b1,function(_0x1663e2){if(_0x1663e2[_0x0804('0x40')]!=='VIRTUAL'){var _0x16b4c1={};_0x16b4c1[_0x1663e2[_0x0804('0x2b')]]={'$like':'%'+_0x8b1f80[_0x0804('0x3b')]['filter']+'%'};return _0x16b4c1;}})});}_0x3c043c=_['merge']({},_0x3c043c,_0x8b1f80[_0x0804('0x41')]);var _0xd906f0={'where':_0x3c043c[_0x0804('0x3c')]};return db['Schedule']['count'](_0xd906f0)[_0x0804('0x26')](function(_0x46870a){_0x56f075['count']=_0x46870a;if(_0x8b1f80['query'][_0x0804('0x42')]){_0x3c043c[_0x0804('0x43')]=[{'all':!![]}];}return db['Schedule'][_0x0804('0x44')](_0x3c043c);})[_0x0804('0x26')](function(_0x1b55c8){_0x56f075[_0x0804('0x45')]=_0x1b55c8;return _0x56f075;})[_0x0804('0x26')](respondWithFilteredResult(_0x5c0a40,_0x3c043c))[_0x0804('0x46')](handleError(_0x5c0a40,null));};exports['show']=function(_0x5581c7,_0x586377){var _0x76fac9={'raw':![],'where':{'id':_0x5581c7['params']['id']}},_0x49646a={};_0x49646a[_0x0804('0x32')]=_[_0x0804('0x34')](db[_0x0804('0x2e')][_0x0804('0x2f')]);_0x49646a[_0x0804('0x3b')]=_[_0x0804('0x34')](_0x5581c7['query']);_0x49646a['filters']=_[_0x0804('0x36')](_0x49646a[_0x0804('0x32')],_0x49646a['query']);_0x76fac9['attributes']=_['intersection'](_0x49646a[_0x0804('0x32')],qs['fields'](_0x5581c7[_0x0804('0x3b')]['fields']));_0x76fac9[_0x0804('0x37')]=_0x76fac9[_0x0804('0x37')]['length']?_0x76fac9[_0x0804('0x37')]:_0x49646a['model'];if(_0x5581c7[_0x0804('0x3b')][_0x0804('0x42')]){_0x76fac9['include']=[{'all':!![]}];}_0x76fac9=_[_0x0804('0x3f')]({},_0x76fac9,_0x5581c7[_0x0804('0x41')]);return db[_0x0804('0x2e')][_0x0804('0x47')](_0x76fac9)['then'](handleEntityNotFound(_0x586377,null))[_0x0804('0x26')](respondWithResult(_0x586377,null))[_0x0804('0x46')](handleError(_0x586377,null));};exports['create']=function(_0x3b3f9f,_0x42224d){return db[_0x0804('0x2e')][_0x0804('0x48')](_0x3b3f9f[_0x0804('0x49')],{})['then'](function(_0x4a5562){var _0x3716ae=_0x3b3f9f[_0x0804('0x4a')][_0x0804('0x4b')]({'plain':!![]});if(!_0x3716ae)throw new Error(_0x0804('0x4c'));if(_0x3716ae['role']==='user'){var _0x2a5962=_0x4a5562['get']({'plain':!![]});var _0x3757ca='Scheduler';return db[_0x0804('0x4d')]['find']({'where':{'name':_0x3757ca,'userProfileId':_0x3716ae[_0x0804('0x4e')]},'raw':!![]})[_0x0804('0x26')](function(_0x3f083b){if(_0x3f083b&&_0x3f083b[_0x0804('0x4f')]===0x0){return db[_0x0804('0x28')][_0x0804('0x48')]({'name':_0x2a5962[_0x0804('0x2b')],'resourceId':_0x2a5962['id'],'type':_0x3f083b['name'],'sectionId':_0x3f083b['id']},{})['then'](function(){return _0x4a5562;});}else{return _0x4a5562;}})[_0x0804('0x46')](function(_0x580ae9){logger[_0x0804('0x29')](_0x0804('0x50'),_0x580ae9);throw _0x580ae9;});}return _0x4a5562;})[_0x0804('0x26')](respondWithResult(_0x42224d,0xc9))[_0x0804('0x46')](handleError(_0x42224d,null));};exports[_0x0804('0x25')]=function(_0x16f64f,_0x41b0db){if(_0x16f64f[_0x0804('0x49')]['id']){delete _0x16f64f[_0x0804('0x49')]['id'];}return db['Schedule'][_0x0804('0x47')]({'where':{'id':_0x16f64f[_0x0804('0x51')]['id']}})['then'](handleEntityNotFound(_0x41b0db,null))[_0x0804('0x26')](saveUpdates(_0x16f64f[_0x0804('0x49')],null))[_0x0804('0x26')](respondWithResult(_0x41b0db,null))[_0x0804('0x46')](handleError(_0x41b0db,null));};exports[_0x0804('0x27')]=function(_0x523309,_0x3bcf78){return db['Schedule'][_0x0804('0x47')]({'where':{'id':_0x523309[_0x0804('0x51')]['id']}})[_0x0804('0x26')](handleEntityNotFound(_0x3bcf78,null))[_0x0804('0x26')](removeEntity(_0x3bcf78,null))['catch'](handleError(_0x3bcf78,null));};exports['run']=function(_0x2ffaaa,_0x16b6e5,_0x50bf39){var _0x3da0d9=require(_0x0804('0x52'));return db[_0x0804('0x2e')][_0x0804('0x47')]({'where':{'id':_0x2ffaaa[_0x0804('0x51')]['id']},'raw':!![]})[_0x0804('0x26')](handleEntityNotFound(_0x16b6e5,null))[_0x0804('0x26')](function(){_0x3da0d9['run'](_0x2ffaaa['params']['id']);})[_0x0804('0x26')](respondWithStatusCode(_0x16b6e5,null))['catch'](handleError(_0x16b6e5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 973c70f..744f47f 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 _0xc268=['Schedule','util','../../config/logger','moment','bluebird','request-promise','path','./schedule.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc268,0x1b9));var _0x8c26=function(_0x29237b,_0xaba533){_0x29237b=_0x29237b-0x0;var _0x4bc5f0=_0xc268[_0x29237b];return _0x4bc5f0;};'use strict';var _=require('lodash');var util=require(_0x8c26('0x0'));var logger=require(_0x8c26('0x1'))('api');var moment=require(_0x8c26('0x2'));var BPromise=require(_0x8c26('0x3'));var rp=require(_0x8c26('0x4'));var fs=require('fs');var path=require(_0x8c26('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8c26('0x6'));module[_0x8c26('0x7')]=function(_0x4ffae8,_0x2c8837){return _0x4ffae8[_0x8c26('0x8')](_0x8c26('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5762=['tools_schedules','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./schedule.attributes','define'];(function(_0x3d4252,_0x16f359){var _0x2a2d5b=function(_0x3fedfe){while(--_0x3fedfe){_0x3d4252['push'](_0x3d4252['shift']());}};_0x2a2d5b(++_0x16f359);}(_0x5762,0x13c));var _0x2576=function(_0x5e237d,_0x358118){_0x5e237d=_0x5e237d-0x0;var _0x4bc64c=_0x5762[_0x5e237d];return _0x4bc64c;};'use strict';var _=require(_0x2576('0x0'));var util=require('util');var logger=require(_0x2576('0x1'))(_0x2576('0x2'));var moment=require('moment');var BPromise=require(_0x2576('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2576('0x4'));var config=require(_0x2576('0x5'));var attributes=require(_0x2576('0x6'));module['exports']=function(_0x187925,_0x10995a){return _0x187925[_0x2576('0x7')]('Schedule',attributes,{'tableName':_0x2576('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index ad3ccf0..17aea27 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 _0x5299=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x5299,0x13c));var _0x9529=function(_0x33d755,_0x1411ad){_0x33d755=_0x33d755-0x0;var _0x1307a6=_0x5299[_0x33d755];return _0x1307a6;};'use strict';var _=require(_0x9529('0x0'));var util=require('util');var moment=require(_0x9529('0x1'));var BPromise=require(_0x9529('0x2'));var rs=require(_0x9529('0x3'));var fs=require('fs');var Redis=require(_0x9529('0x4'));var db=require(_0x9529('0x5'))['db'];var utils=require(_0x9529('0x6'));var logger=require('../../config/logger')(_0x9529('0x7'));var config=require(_0x9529('0x8'));var jayson=require(_0x9529('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cecbc,_0x628f40,_0x4b0b75){return new BPromise(function(_0x45bef5,_0x2868b7){return client[_0x9529('0xa')](_0x5cecbc,_0x4b0b75)['then'](function(_0x28af04){logger[_0x9529('0xb')](_0x9529('0xc'),_0x628f40,_0x9529('0xd'));logger[_0x9529('0xe')](_0x9529('0xf'),_0x628f40,'request\x20sent',JSON[_0x9529('0x10')](_0x28af04));if(_0x28af04[_0x9529('0x11')]){if(_0x28af04['error'][_0x9529('0x12')]===0x1f4){logger[_0x9529('0x11')]('Schedule,\x20%s,\x20%s',_0x628f40,_0x28af04['error'][_0x9529('0x13')]);return _0x2868b7(_0x28af04[_0x9529('0x11')][_0x9529('0x13')]);}logger['error'](_0x9529('0xc'),_0x628f40,_0x28af04[_0x9529('0x11')]['message']);return _0x45bef5(_0x28af04[_0x9529('0x11')]['message']);}else{logger[_0x9529('0xb')](_0x9529('0xc'),_0x628f40,'request\x20sent');_0x45bef5(_0x28af04['result']['message']);}})[_0x9529('0x14')](function(_0x15fa50){logger[_0x9529('0x11')](_0x9529('0xc'),_0x628f40,_0x15fa50);_0x2868b7(_0x15fa50);});});} \ No newline at end of file +var _0x945f=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5e7892,_0x4108d2){var _0x4ece35=function(_0x230b4a){while(--_0x230b4a){_0x5e7892['push'](_0x5e7892['shift']());}};_0x4ece35(++_0x4108d2);}(_0x945f,0x73));var _0xf945=function(_0x4a95b9,_0x179dbd){_0x4a95b9=_0x4a95b9-0x0;var _0xab7147=_0x945f[_0x4a95b9];return _0xab7147;};'use strict';var _=require(_0xf945('0x0'));var util=require(_0xf945('0x1'));var moment=require(_0xf945('0x2'));var BPromise=require(_0xf945('0x3'));var rs=require(_0xf945('0x4'));var fs=require('fs');var Redis=require(_0xf945('0x5'));var db=require(_0xf945('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf945('0x7'))(_0xf945('0x8'));var config=require(_0xf945('0x9'));var jayson=require(_0xf945('0xa'));var client=jayson[_0xf945('0xb')][_0xf945('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x166e54,_0x3b756c,_0x4c8368){return new BPromise(function(_0x5464fb,_0x3adeb4){return client['request'](_0x166e54,_0x4c8368)[_0xf945('0xd')](function(_0x1db22b){logger[_0xf945('0xe')](_0xf945('0xf'),_0x3b756c,_0xf945('0x10'));logger[_0xf945('0x11')](_0xf945('0x12'),_0x3b756c,'request\x20sent',JSON['stringify'](_0x1db22b));if(_0x1db22b[_0xf945('0x13')]){if(_0x1db22b[_0xf945('0x13')][_0xf945('0x14')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x3b756c,_0x1db22b[_0xf945('0x13')]['message']);return _0x3adeb4(_0x1db22b[_0xf945('0x13')][_0xf945('0x15')]);}logger['error'](_0xf945('0xf'),_0x3b756c,_0x1db22b[_0xf945('0x13')][_0xf945('0x15')]);return _0x5464fb(_0x1db22b[_0xf945('0x13')][_0xf945('0x15')]);}else{logger['info'](_0xf945('0xf'),_0x3b756c,'request\x20sent');_0x5464fb(_0x1db22b[_0xf945('0x16')]['message']);}})[_0xf945('0x17')](function(_0x3730b1){logger[_0xf945('0x13')](_0xf945('0xf'),_0x3b756c,_0x3730b1);_0x3adeb4(_0x3730b1);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2707616..e07ce3b 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 _0x8f3b=['isAuthenticated','post','put','delete','destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','show','/:id/download'];(function(_0x5dbe34,_0x17081c){var _0xd9592b=function(_0x52164e){while(--_0x52164e){_0x5dbe34['push'](_0x5dbe34['shift']());}};_0xd9592b(++_0x17081c);}(_0x8f3b,0x1d9));var _0xb8f3=function(_0x201515,_0x202dc4){_0x201515=_0x201515-0x0;var _0x3163ae=_0x8f3b[_0x201515];return _0x3163ae;};'use strict';var multer=require(_0xb8f3('0x0'));var util=require('util');var path=require(_0xb8f3('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8f3('0x2'));var router=express[_0xb8f3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb8f3('0x4'));var config=require(_0xb8f3('0x5'));var controller=require('./screenRecording.controller');router[_0xb8f3('0x6')]('/',auth['isAuthenticated'](),controller[_0xb8f3('0x7')]);router['get'](_0xb8f3('0x8'),auth['isAuthenticated'](),controller[_0xb8f3('0x9')]);router[_0xb8f3('0x6')](_0xb8f3('0xa'),auth['isAuthenticated'](),controller[_0xb8f3('0xb')]);router['get'](_0xb8f3('0xc'),auth[_0xb8f3('0xd')](),controller['download']);router[_0xb8f3('0xe')]('/',auth[_0xb8f3('0xd')](),controller['create']);router[_0xb8f3('0xf')]('/:id',auth[_0xb8f3('0xd')](),controller['update']);router[_0xb8f3('0x10')](_0xb8f3('0xa'),auth['isAuthenticated'](),controller[_0xb8f3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcb99=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/download','download','post','create','/:id','update','destroy','exports','multer'];(function(_0x31f0d5,_0x4b76e3){var _0x55253f=function(_0x19448f){while(--_0x19448f){_0x31f0d5['push'](_0x31f0d5['shift']());}};_0x55253f(++_0x4b76e3);}(_0xcb99,0x14f));var _0x9cb9=function(_0x32be74,_0x1c6d78){_0x32be74=_0x32be74-0x0;var _0x59407f=_0xcb99[_0x32be74];return _0x59407f;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require(_0x9cb9('0x1'));var path=require('path');var timeout=require(_0x9cb9('0x2'));var express=require(_0x9cb9('0x3'));var router=express[_0x9cb9('0x4')]();var fs_extra=require(_0x9cb9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9cb9('0x6'));var config=require(_0x9cb9('0x7'));var controller=require('./screenRecording.controller');router[_0x9cb9('0x8')]('/',auth[_0x9cb9('0x9')](),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')]('/describe',auth[_0x9cb9('0x9')](),controller[_0x9cb9('0xb')]);router[_0x9cb9('0x8')]('/:id',auth[_0x9cb9('0x9')](),controller[_0x9cb9('0xc')]);router[_0x9cb9('0x8')](_0x9cb9('0xd'),auth[_0x9cb9('0x9')](),controller[_0x9cb9('0xe')]);router[_0x9cb9('0xf')]('/',auth[_0x9cb9('0x9')](),controller[_0x9cb9('0x10')]);router['put'](_0x9cb9('0x11'),auth['isAuthenticated'](),controller[_0x9cb9('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x13')]);module[_0x9cb9('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index a8b21af..2721a33 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 _0xf811=['updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x554d7e,_0x2a7c4a){var _0x58fb7c=function(_0xc52bb4){while(--_0xc52bb4){_0x554d7e['push'](_0x554d7e['shift']());}};_0x58fb7c(++_0x2a7c4a);}(_0xf811,0x6f));var _0x1f81=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xf811[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require(_0x1f81('0x0'));var moment=require(_0x1f81('0x1'));var path=require(_0x1f81('0x2'));var config=require(_0x1f81('0x3'));module[_0x1f81('0x4')]={'format':{'type':Sequelize[_0x1f81('0x5')],'get':function(){return this[_0x1f81('0x6')](_0x1f81('0x7'))?path[_0x1f81('0x8')](this[_0x1f81('0x6')](_0x1f81('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x1f81('0x9')]},'channel':{'type':Sequelize[_0x1f81('0x9')]},'value':{'type':Sequelize[_0x1f81('0x9')],'set':function(_0x57c512){var _0x2238b2=_0x57c512[_0x1f81('0xa')](/\\/g,'/');this[_0x1f81('0xb')]('value',_0x2238b2);}},'rating':{'type':Sequelize[_0x1f81('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1f81('0xc')],'set':function(_0x4af394){this[_0x1f81('0xb')]('startedAt',moment()[_0x1f81('0xd')](_0x4af394,'ms'));this[_0x1f81('0xb')](_0x1f81('0xe'),moment());this[_0x1f81('0xb')](_0x1f81('0xf'),_0x4af394);}},'startedAt':{'type':Sequelize[_0x1f81('0x10')],'get':function(){return moment(this[_0x1f81('0x6')](_0x1f81('0x11')))[_0x1f81('0x12')](_0x1f81('0x13'))[_0x1f81('0x14')]();}},'closedAt':{'type':Sequelize[_0x1f81('0x10')],'get':function(){return moment(this[_0x1f81('0x6')](_0x1f81('0xe')))[_0x1f81('0x12')](_0x1f81('0x13'))['toString']();}},'createdAt':{'type':Sequelize[_0x1f81('0x10')],'get':function(){return moment(this[_0x1f81('0x6')]('createdAt'))['format'](_0x1f81('0x13'))[_0x1f81('0x14')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1f81('0x6')](_0x1f81('0x15')))[_0x1f81('0x12')](_0x1f81('0x13'))['toString']();}}}; \ No newline at end of file +var _0x556a=['getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','DATE','toString','createdAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL'];(function(_0x3396ec,_0xe0e46b){var _0x27624c=function(_0x58a7a0){while(--_0x58a7a0){_0x3396ec['push'](_0x3396ec['shift']());}};_0x27624c(++_0xe0e46b);}(_0x556a,0x1dd));var _0xa556=function(_0x2ce286,_0x4104e4){_0x2ce286=_0x2ce286-0x0;var _0x4c471f=_0x556a[_0x2ce286];return _0x4c471f;};'use strict';var Sequelize=require(_0xa556('0x0'));var moment=require(_0xa556('0x1'));var path=require(_0xa556('0x2'));var config=require(_0xa556('0x3'));module[_0xa556('0x4')]={'format':{'type':Sequelize[_0xa556('0x5')],'get':function(){return this[_0xa556('0x6')](_0xa556('0x7'))?path[_0xa556('0x8')](this['getDataValue'](_0xa556('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xa556('0x9')]},'channel':{'type':Sequelize[_0xa556('0x9')]},'value':{'type':Sequelize[_0xa556('0x9')],'set':function(_0x358b8c){var _0x5a745c=_0x358b8c[_0xa556('0xa')](/\\/g,'/');this[_0xa556('0xb')](_0xa556('0x7'),_0x5a745c);}},'rating':{'type':Sequelize[_0xa556('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x44ea8e){this[_0xa556('0xb')](_0xa556('0xd'),moment()[_0xa556('0xe')](_0x44ea8e,'ms'));this[_0xa556('0xb')](_0xa556('0xf'),moment());this[_0xa556('0xb')](_0xa556('0x10'),_0x44ea8e);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa556('0x6')]('startedAt'))[_0xa556('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xa556('0x12')],'get':function(){return moment(this[_0xa556('0x6')](_0xa556('0xf')))[_0xa556('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xa556('0x13')]();}},'createdAt':{'type':Sequelize[_0xa556('0x12')],'get':function(){return moment(this[_0xa556('0x6')](_0xa556('0x14')))[_0xa556('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0xa556('0x12')],'get':function(){return moment(this[_0xa556('0x6')]('updatedAt'))[_0xa556('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index b5626cd..0503ed2 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['apply','then','error','name','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','count','includeAll','include','findAll','catch','show','find','create','body','update','duration','closedAt','value','params','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','filename','download','extname','unlink','Not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range'];(function(_0xb2790f,_0x366410){var _0x3205de=function(_0x26d1c3){while(--_0x26d1c3){_0xb2790f['push'](_0xb2790f['shift']());}};_0x3205de(++_0x366410);}(_0x2d17,0x17e));var _0x72d1=function(_0x36eeda,_0xdb6d82){_0x36eeda=_0x36eeda-0x0;var _0x13d187=_0x2d17[_0x36eeda];return _0x13d187;};'use strict';var emlformat=require(_0x72d1('0x0'));var rimraf=require(_0x72d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72d1('0x2'));var rp=require(_0x72d1('0x3'));var moment=require('moment');var BPromise=require(_0x72d1('0x4'));var Mustache=require(_0x72d1('0x5'));var util=require('util');var path=require(_0x72d1('0x6'));var sox=require('sox');var csv=require(_0x72d1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72d1('0x8'));var _=require(_0x72d1('0x9'));var squel=require('squel');var crypto=require(_0x72d1('0xa'));var jsforce=require(_0x72d1('0xb'));var deskjs=require(_0x72d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72d1('0xd'));var Papa=require(_0x72d1('0xe'));var Redis=require(_0x72d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x72d1('0x10'));var as=require(_0x72d1('0x11'));var hardwareService=require(_0x72d1('0x12'));var logger=require(_0x72d1('0x13'))(_0x72d1('0x14'));var utils=require(_0x72d1('0x15'));var config=require(_0x72d1('0x16'));var licenseUtil=require(_0x72d1('0x17'));var db=require(_0x72d1('0x18'))['db'];function respondWithStatusCode(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xcc;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0x19')](_0x5ad4df);}return _0x2f5a78[_0x72d1('0x1a')](_0x5ad4df)[_0x72d1('0x1b')]();};}function respondWithResult(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0xc8;return function(_0x143718){if(_0x143718){return _0x22ac6f[_0x72d1('0x1a')](_0x685a27)[_0x72d1('0x1c')](_0x143718);}};}function respondWithFilteredResult(_0x3f190f,_0x21c85e){return function(_0x23a238){if(_0x23a238){var _0x8d458=typeof _0x21c85e['offset']===_0x72d1('0x1d')&&typeof _0x21c85e['limit']===_0x72d1('0x1d');var _0x2c9851=_0x23a238['count'];var _0x1061b7=_0x8d458?0x0:_0x21c85e[_0x72d1('0x1e')];var _0x1ca18d=_0x8d458?_0x23a238['count']:_0x21c85e['offset']+_0x21c85e[_0x72d1('0x1f')];var _0x10d464;if(_0x1ca18d>=_0x2c9851){_0x1ca18d=_0x2c9851;_0x10d464=0xc8;}else{_0x10d464=0xce;}_0x3f190f[_0x72d1('0x1a')](_0x10d464);return _0x3f190f[_0x72d1('0x20')](_0x72d1('0x21'),_0x1061b7+'-'+_0x1ca18d+'/'+_0x2c9851)[_0x72d1('0x1c')](_0x23a238);}return null;};}function patchUpdates(_0x1e2411){return function(_0x5c7982){try{jsonpatch[_0x72d1('0x22')](_0x5c7982,_0x1e2411,!![]);}catch(_0x56e8d3){return BPromise['reject'](_0x56e8d3);}return _0x5c7982['save']();};}function saveUpdates(_0x585243,_0x445985){return function(_0x374602){if(_0x374602){return _0x374602['update'](_0x585243)[_0x72d1('0x23')](function(_0x256dc1){return _0x256dc1;});}return null;};}function removeEntity(_0x492086,_0x1431ee){return function(_0x26fa35){if(_0x26fa35){return _0x26fa35['destroy']()['then'](function(){_0x492086[_0x72d1('0x1a')](0xcc)[_0x72d1('0x1b')]();});}};}function handleEntityNotFound(_0x2f661,_0x2f879f){return function(_0xdf6a69){if(!_0xdf6a69){_0x2f661[_0x72d1('0x19')](0x194);}return _0xdf6a69;};}function handleError(_0x163bec,_0x589f7c){_0x589f7c=_0x589f7c||0x1f4;return function(_0x57ec9e){logger[_0x72d1('0x24')](_0x57ec9e['stack']);if(_0x57ec9e[_0x72d1('0x25')]){delete _0x57ec9e[_0x72d1('0x25')];}_0x163bec[_0x72d1('0x1a')](_0x589f7c)['send'](_0x57ec9e);};}exports[_0x72d1('0x26')]=function(_0x4c4c41,_0x707cd0){var _0x20055f={},_0x32588f={},_0x2cc0c8={'count':0x0,'rows':[]};var _0x51242b=_[_0x72d1('0x27')](db['ScreenRecording'][_0x72d1('0x28')],function(_0x32dc5e){return{'name':_0x32dc5e['fieldName'],'type':_0x32dc5e[_0x72d1('0x29')][_0x72d1('0x2a')]};});_0x32588f[_0x72d1('0x2b')]=_[_0x72d1('0x2c')](_[_0x72d1('0x27')](_0x51242b,'name'),[_0x72d1('0x2d')]);_0x32588f[_0x72d1('0x2e')]=_[_0x72d1('0x2f')](_0x4c4c41['query']);_0x32588f[_0x72d1('0x30')]=_[_0x72d1('0x31')](_0x32588f['model'],_0x32588f[_0x72d1('0x2e')]);_0x20055f[_0x72d1('0x32')]=_[_0x72d1('0x31')](_0x32588f['model'],qs[_0x72d1('0x33')](_0x4c4c41['query'][_0x72d1('0x33')]));_0x20055f[_0x72d1('0x32')]=_0x20055f[_0x72d1('0x32')][_0x72d1('0x34')]?_0x20055f[_0x72d1('0x32')]:_0x32588f[_0x72d1('0x2b')];if(!_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x35')](_0x72d1('0x36'))){_0x20055f[_0x72d1('0x1f')]=qs[_0x72d1('0x1f')](_0x4c4c41['query'][_0x72d1('0x1f')]);_0x20055f[_0x72d1('0x1e')]=qs[_0x72d1('0x1e')](_0x4c4c41[_0x72d1('0x2e')]['offset']);}_0x20055f[_0x72d1('0x37')]=qs[_0x72d1('0x38')](_0x4c4c41[_0x72d1('0x2e')]['sort']);_0x20055f[_0x72d1('0x39')]=qs[_0x72d1('0x30')](_[_0x72d1('0x3a')](_0x4c4c41['query'],_0x32588f[_0x72d1('0x30')]),_0x51242b);if(_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x3b')]){_0x20055f['where']=_[_0x72d1('0x3c')](_0x20055f[_0x72d1('0x39')],{'$or':_[_0x72d1('0x27')](_0x51242b,function(_0x14cb3d){if(_0x14cb3d[_0x72d1('0x29')]!==_0x72d1('0x3d')){var _0xd7ec0f={};_0xd7ec0f[_0x14cb3d['name']]={'$like':'%'+_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x3b')]+'%'};return _0xd7ec0f;}})});}_0x20055f=_[_0x72d1('0x3c')]({},_0x20055f,_0x4c4c41[_0x72d1('0x3e')]);var _0x20fb2f={'where':_0x20055f[_0x72d1('0x39')]};return db[_0x72d1('0x3f')][_0x72d1('0x40')](_0x20fb2f)['then'](function(_0x44d5b2){_0x2cc0c8[_0x72d1('0x40')]=_0x44d5b2;if(_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x41')]){_0x20055f[_0x72d1('0x42')]=[{'all':!![]}];}return db[_0x72d1('0x3f')][_0x72d1('0x43')](_0x20055f);})[_0x72d1('0x23')](function(_0x5620f0){_0x2cc0c8['rows']=_0x5620f0;return _0x2cc0c8;})[_0x72d1('0x23')](respondWithFilteredResult(_0x707cd0,_0x20055f))[_0x72d1('0x44')](handleError(_0x707cd0,null));};exports[_0x72d1('0x45')]=function(_0x21d361,_0x5a6bc4){var _0x3fe286={'raw':![],'where':{'id':_0x21d361['params']['id']}},_0x3e80e0={};_0x3e80e0[_0x72d1('0x2b')]=_['keys'](db[_0x72d1('0x3f')][_0x72d1('0x28')]);_0x3e80e0['query']=_[_0x72d1('0x2f')](_0x21d361['query']);_0x3e80e0['filters']=_['intersection'](_0x3e80e0[_0x72d1('0x2b')],_0x3e80e0['query']);_0x3fe286[_0x72d1('0x32')]=_[_0x72d1('0x31')](_0x3e80e0[_0x72d1('0x2b')],qs['fields'](_0x21d361['query'][_0x72d1('0x33')]));_0x3fe286['attributes']=_0x3fe286['attributes'][_0x72d1('0x34')]?_0x3fe286[_0x72d1('0x32')]:_0x3e80e0[_0x72d1('0x2b')];if(_0x21d361['query']['includeAll']){_0x3fe286['include']=[{'all':!![]}];}_0x3fe286=_['merge']({},_0x3fe286,_0x21d361[_0x72d1('0x3e')]);return db[_0x72d1('0x3f')][_0x72d1('0x46')](_0x3fe286)[_0x72d1('0x23')](handleEntityNotFound(_0x5a6bc4,null))[_0x72d1('0x23')](respondWithResult(_0x5a6bc4,null))[_0x72d1('0x44')](handleError(_0x5a6bc4,null));};exports[_0x72d1('0x47')]=function(_0x5924c,_0x1e2c11){return db['ScreenRecording'][_0x72d1('0x47')](_0x5924c[_0x72d1('0x48')],{})[_0x72d1('0x23')](respondWithResult(_0x1e2c11,0xc9))['catch'](handleError(_0x1e2c11,null));};exports[_0x72d1('0x49')]=function(_0x29c88f,_0x12ad75){if(_0x29c88f['body']['id']){delete _0x29c88f[_0x72d1('0x48')]['id'];}delete _0x29c88f[_0x72d1('0x48')][_0x72d1('0x4a')];delete _0x29c88f[_0x72d1('0x48')]['createdAt'];delete _0x29c88f['body'][_0x72d1('0x4b')];delete _0x29c88f[_0x72d1('0x48')][_0x72d1('0x4c')];return db['ScreenRecording'][_0x72d1('0x46')]({'where':{'id':_0x29c88f[_0x72d1('0x4d')]['id']}})[_0x72d1('0x23')](handleEntityNotFound(_0x12ad75,null))[_0x72d1('0x23')](saveUpdates(_0x29c88f[_0x72d1('0x48')],null))[_0x72d1('0x23')](respondWithResult(_0x12ad75,null))[_0x72d1('0x44')](handleError(_0x12ad75,null));};exports[_0x72d1('0x4e')]=function(_0x12870c,_0x18f986){return db[_0x72d1('0x3f')]['describe']()[_0x72d1('0x23')](respondWithResult(_0x18f986,null))['catch'](handleError(_0x18f986,null));};exports['download']=function(_0x356196,_0x5f2bba,_0x3c880e){var _0x7e401b=require(_0x72d1('0x4f'));var _0x162248=![];var _0x473a7b={};if(_0x356196[_0x72d1('0x2e')][_0x72d1('0x29')]&&_0x356196[_0x72d1('0x2e')][_0x72d1('0x29')]===_0x72d1('0x50')){_0x473a7b[_0x72d1('0x50')]=_0x356196['params']['id'];}else{_0x473a7b['id']=_0x356196[_0x72d1('0x4d')]['id'];}return db[_0x72d1('0x3f')][_0x72d1('0x46')]({'where':_0x473a7b,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5f2bba,null))[_0x72d1('0x23')](function(_0x140f0b){if(_0x140f0b){var _0x16e9e7=path[_0x72d1('0x51')](config[_0x72d1('0x52')],'server/files/screen_recordings',_0x140f0b[_0x72d1('0x4c')]);var _0x48f4a7=util[_0x72d1('0x2d')](_0x72d1('0x53'),_0x16e9e7);if(fs[_0x72d1('0x54')](_0x48f4a7)){_0x162248=!![];return _0x7e401b[_0x72d1('0x55')](_0x48f4a7,_0x16e9e7,config[_0x72d1('0x56')][_0x72d1('0x57')])[_0x72d1('0x23')](function(){return _0x140f0b;});}return _0x140f0b;}})[_0x72d1('0x23')](function(_0x384f0a){if(_0x384f0a){var _0x3a2dfe=path[_0x72d1('0x51')](config[_0x72d1('0x52')],_0x72d1('0x58'),_0x384f0a[_0x72d1('0x4c')]);if(!fs[_0x72d1('0x54')](_0x3a2dfe)){throw new db[(_0x72d1('0x59'))][(_0x72d1('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x384f0a[_0x72d1('0x5b')]){return _0x5f2bba[_0x72d1('0x5c')](_0x3a2dfe,_0x384f0a[_0x72d1('0x5b')]+path[_0x72d1('0x5d')](_0x3a2dfe),function(){if(_0x162248){fs[_0x72d1('0x5e')](_0x3a2dfe);}});}else{return _0x5f2bba[_0x72d1('0x5c')](_0x3a2dfe,function(_0x4e2d85){if(_0x162248){fs[_0x72d1('0x5e')](_0x3a2dfe);}});}}})[_0x72d1('0x44')](function(_0xb05cd9){if(_0xb05cd9['message']==='ScreenRecording\x20not\x20found'){_0x5f2bba[_0x72d1('0x1a')](0x194)['send'](_0x72d1('0x5f'));}else{return handleError(_0x5f2bba,null);}});};exports[_0x72d1('0x60')]=function(_0x201810,_0x41525c){return db[_0x72d1('0x3f')][_0x72d1('0x46')]({'where':{'id':_0x201810[_0x72d1('0x4d')]['id']}})[_0x72d1('0x23')](function(_0x28e42b){if(_['isNil'](_0x28e42b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x28e42b;})[_0x72d1('0x23')](function(_0x1d44f0){var _0x1bd80b=path['join'](config[_0x72d1('0x52')],_0x72d1('0x58'),_0x1d44f0['value']);logger[_0x72d1('0x61')](_0x72d1('0x62'),_0x1bd80b);if(!_[_0x72d1('0x63')](_0x1d44f0[_0x72d1('0x4c')])&&fs[_0x72d1('0x54')](_0x1bd80b)){logger[_0x72d1('0x61')](_0x72d1('0x64')+_0x1bd80b+_0x72d1('0x65'));fs[_0x72d1('0x66')](_0x1bd80b);}_0x1bd80b=_0x1bd80b+_0x72d1('0x67');if(!_[_0x72d1('0x63')](_0x1d44f0[_0x72d1('0x4c')])&&fs['existsSync'](_0x1bd80b)){logger['info'](_0x72d1('0x64')+_0x1bd80b+_0x72d1('0x65'));fs[_0x72d1('0x66')](_0x1bd80b);}return _0x1d44f0;})[_0x72d1('0x23')](function(_0x2ae8c9){if(!_0x2ae8c9)throw new InternalError();return _0x2ae8c9[_0x72d1('0x60')]();})[_0x72d1('0x23')](function(){_0x41525c[_0x72d1('0x1a')](0xcc)['end']();})[_0x72d1('0x44')](handleError(_0x41525c,null));}; \ No newline at end of file +var _0x5636=['rawAttributes','fieldName','type','key','model','differenceBy','map','format','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ScreenRecording','count','includeAll','include','findAll','rows','catch','show','find','create','body','duration','createdAt','closedAt','value','describe','uniqueid','params','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','download','filename','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index'];(function(_0x47fc5f,_0x7047b5){var _0x36b943=function(_0x5ac806){while(--_0x5ac806){_0x47fc5f['push'](_0x47fc5f['shift']());}};_0x36b943(++_0x7047b5);}(_0x5636,0x102));var _0x6563=function(_0xe8d05e,_0x170a38){_0xe8d05e=_0xe8d05e-0x0;var _0x5cb57e=_0x5636[_0xe8d05e];return _0x5cb57e;};'use strict';var emlformat=require(_0x6563('0x0'));var rimraf=require(_0x6563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6563('0x2'));var BPromise=require(_0x6563('0x3'));var Mustache=require(_0x6563('0x4'));var util=require('util');var path=require(_0x6563('0x5'));var sox=require(_0x6563('0x6'));var csv=require(_0x6563('0x7'));var ejs=require(_0x6563('0x8'));var fs=require('fs');var fs_extra=require(_0x6563('0x9'));var _=require(_0x6563('0xa'));var squel=require(_0x6563('0xb'));var crypto=require(_0x6563('0xc'));var jsforce=require(_0x6563('0xd'));var deskjs=require(_0x6563('0xe'));var toCsv=require(_0x6563('0x7'));var querystring=require(_0x6563('0xf'));var Papa=require(_0x6563('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6563('0x11'));var as=require(_0x6563('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6563('0x13'));var config=require(_0x6563('0x14'));var licenseUtil=require(_0x6563('0x15'));var db=require(_0x6563('0x16'))['db'];function respondWithStatusCode(_0x33816e,_0x2ed676){_0x2ed676=_0x2ed676||0xcc;return function(_0x31d3fa){if(_0x31d3fa){return _0x33816e[_0x6563('0x17')](_0x2ed676);}return _0x33816e[_0x6563('0x18')](_0x2ed676)['end']();};}function respondWithResult(_0xa0a0b6,_0x5e9329){_0x5e9329=_0x5e9329||0xc8;return function(_0x37131e){if(_0x37131e){return _0xa0a0b6[_0x6563('0x18')](_0x5e9329)[_0x6563('0x19')](_0x37131e);}};}function respondWithFilteredResult(_0x10d08c,_0x5af5d0){return function(_0x26f26e){if(_0x26f26e){var _0x11baa2=typeof _0x5af5d0[_0x6563('0x1a')]===_0x6563('0x1b')&&typeof _0x5af5d0['limit']===_0x6563('0x1b');var _0x589632=_0x26f26e['count'];var _0x47972a=_0x11baa2?0x0:_0x5af5d0[_0x6563('0x1a')];var _0x4f5609=_0x11baa2?_0x26f26e['count']:_0x5af5d0[_0x6563('0x1a')]+_0x5af5d0[_0x6563('0x1c')];var _0x17a29f;if(_0x4f5609>=_0x589632){_0x4f5609=_0x589632;_0x17a29f=0xc8;}else{_0x17a29f=0xce;}_0x10d08c[_0x6563('0x18')](_0x17a29f);return _0x10d08c[_0x6563('0x1d')](_0x6563('0x1e'),_0x47972a+'-'+_0x4f5609+'/'+_0x589632)[_0x6563('0x19')](_0x26f26e);}return null;};}function patchUpdates(_0x93a45){return function(_0x2a70f0){try{jsonpatch['apply'](_0x2a70f0,_0x93a45,!![]);}catch(_0x2f2905){return BPromise[_0x6563('0x1f')](_0x2f2905);}return _0x2a70f0[_0x6563('0x20')]();};}function saveUpdates(_0x5a335c,_0x293db2){return function(_0x5c37bb){if(_0x5c37bb){return _0x5c37bb[_0x6563('0x21')](_0x5a335c)[_0x6563('0x22')](function(_0x5610b0){return _0x5610b0;});}return null;};}function removeEntity(_0x5773e2,_0x3ab7f6){return function(_0x492f45){if(_0x492f45){return _0x492f45[_0x6563('0x23')]()[_0x6563('0x22')](function(){_0x5773e2[_0x6563('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd860d5,_0x51ff06){return function(_0x7ea857){if(!_0x7ea857){_0xd860d5[_0x6563('0x17')](0x194);}return _0x7ea857;};}function handleError(_0x5e5aeb,_0x365b16){_0x365b16=_0x365b16||0x1f4;return function(_0x28252d){logger['error'](_0x28252d[_0x6563('0x24')]);if(_0x28252d['name']){delete _0x28252d[_0x6563('0x25')];}_0x5e5aeb['status'](_0x365b16)['send'](_0x28252d);};}exports[_0x6563('0x26')]=function(_0x118d31,_0x17326c){var _0x2a1550={},_0x3eb23b={},_0x4b4d3b={'count':0x0,'rows':[]};var _0x3c8bd1=_['map'](db['ScreenRecording'][_0x6563('0x27')],function(_0x35af37){return{'name':_0x35af37[_0x6563('0x28')],'type':_0x35af37[_0x6563('0x29')][_0x6563('0x2a')]};});_0x3eb23b[_0x6563('0x2b')]=_[_0x6563('0x2c')](_[_0x6563('0x2d')](_0x3c8bd1,_0x6563('0x25')),[_0x6563('0x2e')]);_0x3eb23b['query']=_[_0x6563('0x2f')](_0x118d31[_0x6563('0x30')]);_0x3eb23b[_0x6563('0x31')]=_[_0x6563('0x32')](_0x3eb23b[_0x6563('0x2b')],_0x3eb23b[_0x6563('0x30')]);_0x2a1550[_0x6563('0x33')]=_['intersection'](_0x3eb23b[_0x6563('0x2b')],qs[_0x6563('0x34')](_0x118d31[_0x6563('0x30')][_0x6563('0x34')]));_0x2a1550[_0x6563('0x33')]=_0x2a1550[_0x6563('0x33')]['length']?_0x2a1550[_0x6563('0x33')]:_0x3eb23b[_0x6563('0x2b')];if(!_0x118d31[_0x6563('0x30')][_0x6563('0x35')](_0x6563('0x36'))){_0x2a1550[_0x6563('0x1c')]=qs[_0x6563('0x1c')](_0x118d31['query'][_0x6563('0x1c')]);_0x2a1550[_0x6563('0x1a')]=qs['offset'](_0x118d31[_0x6563('0x30')][_0x6563('0x1a')]);}_0x2a1550['order']=qs['sort'](_0x118d31[_0x6563('0x30')][_0x6563('0x37')]);_0x2a1550[_0x6563('0x38')]=qs[_0x6563('0x31')](_['pick'](_0x118d31[_0x6563('0x30')],_0x3eb23b[_0x6563('0x31')]),_0x3c8bd1);if(_0x118d31['query'][_0x6563('0x39')]){_0x2a1550[_0x6563('0x38')]=_[_0x6563('0x3a')](_0x2a1550[_0x6563('0x38')],{'$or':_[_0x6563('0x2d')](_0x3c8bd1,function(_0x1f6341){if(_0x1f6341[_0x6563('0x29')]!==_0x6563('0x3b')){var _0x2e4177={};_0x2e4177[_0x1f6341['name']]={'$like':'%'+_0x118d31[_0x6563('0x30')][_0x6563('0x39')]+'%'};return _0x2e4177;}})});}_0x2a1550=_[_0x6563('0x3a')]({},_0x2a1550,_0x118d31[_0x6563('0x3c')]);var _0x5ebe88={'where':_0x2a1550['where']};return db[_0x6563('0x3d')][_0x6563('0x3e')](_0x5ebe88)[_0x6563('0x22')](function(_0x5db29d){_0x4b4d3b[_0x6563('0x3e')]=_0x5db29d;if(_0x118d31['query'][_0x6563('0x3f')]){_0x2a1550[_0x6563('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0x6563('0x41')](_0x2a1550);})[_0x6563('0x22')](function(_0xea186){_0x4b4d3b[_0x6563('0x42')]=_0xea186;return _0x4b4d3b;})[_0x6563('0x22')](respondWithFilteredResult(_0x17326c,_0x2a1550))[_0x6563('0x43')](handleError(_0x17326c,null));};exports[_0x6563('0x44')]=function(_0x32932f,_0xd30789){var _0xfc7eb1={'raw':![],'where':{'id':_0x32932f['params']['id']}},_0x2acb52={};_0x2acb52['model']=_[_0x6563('0x2f')](db[_0x6563('0x3d')][_0x6563('0x27')]);_0x2acb52[_0x6563('0x30')]=_[_0x6563('0x2f')](_0x32932f[_0x6563('0x30')]);_0x2acb52[_0x6563('0x31')]=_['intersection'](_0x2acb52[_0x6563('0x2b')],_0x2acb52[_0x6563('0x30')]);_0xfc7eb1[_0x6563('0x33')]=_[_0x6563('0x32')](_0x2acb52['model'],qs[_0x6563('0x34')](_0x32932f[_0x6563('0x30')][_0x6563('0x34')]));_0xfc7eb1[_0x6563('0x33')]=_0xfc7eb1[_0x6563('0x33')]['length']?_0xfc7eb1['attributes']:_0x2acb52[_0x6563('0x2b')];if(_0x32932f[_0x6563('0x30')][_0x6563('0x3f')]){_0xfc7eb1['include']=[{'all':!![]}];}_0xfc7eb1=_[_0x6563('0x3a')]({},_0xfc7eb1,_0x32932f[_0x6563('0x3c')]);return db[_0x6563('0x3d')][_0x6563('0x45')](_0xfc7eb1)['then'](handleEntityNotFound(_0xd30789,null))[_0x6563('0x22')](respondWithResult(_0xd30789,null))[_0x6563('0x43')](handleError(_0xd30789,null));};exports[_0x6563('0x46')]=function(_0x55e927,_0x35b0ce){return db['ScreenRecording'][_0x6563('0x46')](_0x55e927['body'],{})['then'](respondWithResult(_0x35b0ce,0xc9))[_0x6563('0x43')](handleError(_0x35b0ce,null));};exports[_0x6563('0x21')]=function(_0x2ebab0,_0xb84325){if(_0x2ebab0[_0x6563('0x47')]['id']){delete _0x2ebab0[_0x6563('0x47')]['id'];}delete _0x2ebab0[_0x6563('0x47')][_0x6563('0x48')];delete _0x2ebab0[_0x6563('0x47')][_0x6563('0x49')];delete _0x2ebab0['body'][_0x6563('0x4a')];delete _0x2ebab0['body'][_0x6563('0x4b')];return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':{'id':_0x2ebab0['params']['id']}})[_0x6563('0x22')](handleEntityNotFound(_0xb84325,null))[_0x6563('0x22')](saveUpdates(_0x2ebab0['body'],null))[_0x6563('0x22')](respondWithResult(_0xb84325,null))[_0x6563('0x43')](handleError(_0xb84325,null));};exports[_0x6563('0x4c')]=function(_0x3883f3,_0xbd920a){return db['ScreenRecording'][_0x6563('0x4c')]()['then'](respondWithResult(_0xbd920a,null))[_0x6563('0x43')](handleError(_0xbd920a,null));};exports['download']=function(_0xd2ed6b,_0x5992c8,_0x55e002){var _0x5c8274=require('../../components/encryptor');var _0x270667=![];var _0x5ade56={};if(_0xd2ed6b[_0x6563('0x30')]['type']&&_0xd2ed6b[_0x6563('0x30')][_0x6563('0x29')]===_0x6563('0x4d')){_0x5ade56[_0x6563('0x4d')]=_0xd2ed6b[_0x6563('0x4e')]['id'];}else{_0x5ade56['id']=_0xd2ed6b[_0x6563('0x4e')]['id'];}return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':_0x5ade56,'attributes':['id',_0x6563('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x5992c8,null))[_0x6563('0x22')](function(_0x28b1c6){if(_0x28b1c6){var _0x97ee3=path[_0x6563('0x4f')](config[_0x6563('0x50')],_0x6563('0x51'),_0x28b1c6[_0x6563('0x4b')]);var _0x32c715=util[_0x6563('0x2e')](_0x6563('0x52'),_0x97ee3);if(fs[_0x6563('0x53')](_0x32c715)){_0x270667=!![];return _0x5c8274['decryptFile'](_0x32c715,_0x97ee3,config[_0x6563('0x54')][_0x6563('0x55')])[_0x6563('0x22')](function(){return _0x28b1c6;});}return _0x28b1c6;}})[_0x6563('0x22')](function(_0x46c26c){if(_0x46c26c){var _0x3c06ac=path[_0x6563('0x4f')](config[_0x6563('0x50')],'server/files/screen_recordings',_0x46c26c[_0x6563('0x4b')]);if(!fs['existsSync'](_0x3c06ac)){throw new db[(_0x6563('0x56'))][(_0x6563('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x46c26c['filename']){return _0x5992c8[_0x6563('0x58')](_0x3c06ac,_0x46c26c[_0x6563('0x59')]+path[_0x6563('0x5a')](_0x3c06ac),function(){if(_0x270667){fs[_0x6563('0x5b')](_0x3c06ac);}});}else{return _0x5992c8['download'](_0x3c06ac,function(_0x2a3df0){if(_0x270667){fs['unlink'](_0x3c06ac);}});}}})[_0x6563('0x43')](function(_0x29aecb){if(_0x29aecb['message']==='ScreenRecording\x20not\x20found'){_0x5992c8[_0x6563('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x5992c8,null);}});};exports[_0x6563('0x23')]=function(_0x49d6a5,_0x356010){return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':{'id':_0x49d6a5[_0x6563('0x4e')]['id']}})['then'](function(_0x83d5c){if(_[_0x6563('0x5c')](_0x83d5c)){throw new ReferenceError(_0x6563('0x5d'));}return _0x83d5c;})[_0x6563('0x22')](function(_0x3ffb7f){var _0x2d4694=path[_0x6563('0x4f')](config[_0x6563('0x50')],'server/files/screen_recordings',_0x3ffb7f['value']);logger[_0x6563('0x5e')](_0x6563('0x5f'),_0x2d4694);if(!_['isNil'](_0x3ffb7f['value'])&&fs['existsSync'](_0x2d4694)){logger[_0x6563('0x5e')](_0x6563('0x60')+_0x2d4694+_0x6563('0x61'));fs[_0x6563('0x62')](_0x2d4694);}_0x2d4694=_0x2d4694+'.cypher';if(!_[_0x6563('0x5c')](_0x3ffb7f[_0x6563('0x4b')])&&fs[_0x6563('0x53')](_0x2d4694)){logger[_0x6563('0x5e')](_0x6563('0x60')+_0x2d4694+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2d4694);}return _0x3ffb7f;})[_0x6563('0x22')](function(_0x1d7b5d){if(!_0x1d7b5d)throw new InternalError();return _0x1d7b5d[_0x6563('0x23')]();})['then'](function(){_0x356010[_0x6563('0x18')](0xcc)['end']();})[_0x6563('0x43')](handleError(_0x356010,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 0d4e155..0c18259 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 _0xc4ac=['screen_recordings','interactionid','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x48fa03,_0x279271){var _0x14742d=function(_0x2d585){while(--_0x2d585){_0x48fa03['push'](_0x48fa03['shift']());}};_0x14742d(++_0x279271);}(_0xc4ac,0x1a2));var _0xcc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc4a('0x0'));var util=require('util');var logger=require(_0xcc4a('0x1'))(_0xcc4a('0x2'));var moment=require('moment');var BPromise=require(_0xcc4a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc4a('0x4'));var rimraf=require(_0xcc4a('0x5'));var config=require(_0xcc4a('0x6'));var attributes=require(_0xcc4a('0x7'));module[_0xcc4a('0x8')]=function(_0x4eb3c8,_0x1ae799){return _0x4eb3c8[_0xcc4a('0x9')](_0xcc4a('0xa'),attributes,{'tableName':_0xcc4a('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xcc4a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42cb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid'];(function(_0x1e7a3c,_0x3f7b46){var _0x1146ab=function(_0x505e3e){while(--_0x505e3e){_0x1e7a3c['push'](_0x1e7a3c['shift']());}};_0x1146ab(++_0x3f7b46);}(_0x42cb,0x180));var _0xb42c=function(_0x4576ff,_0x27b290){_0x4576ff=_0x4576ff-0x0;var _0x557c5d=_0x42cb[_0x4576ff];return _0x557c5d;};'use strict';var _=require(_0xb42c('0x0'));var util=require(_0xb42c('0x1'));var logger=require(_0xb42c('0x2'))(_0xb42c('0x3'));var moment=require(_0xb42c('0x4'));var BPromise=require(_0xb42c('0x5'));var rp=require(_0xb42c('0x6'));var fs=require('fs');var path=require(_0xb42c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb42c('0x8'));module['exports']=function(_0x3a18d7,_0x10b520){return _0x3a18d7['define'](_0xb42c('0x9'),attributes,{'tableName':_0xb42c('0xa'),'paranoid':![],'indexes':[{'name':_0xb42c('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 60bac54..d2ffb2e 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 _0x9769=['catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x1bc750,_0x23f442){var _0xcd51da=function(_0x323854){while(--_0x323854){_0x1bc750['push'](_0x1bc750['shift']());}};_0xcd51da(++_0x23f442);}(_0x9769,0x178));var _0x9976=function(_0x329823,_0x3a7e22){_0x329823=_0x329823-0x0;var _0x592d5a=_0x9769[_0x329823];return _0x592d5a;};'use strict';var _=require(_0x9976('0x0'));var util=require(_0x9976('0x1'));var moment=require(_0x9976('0x2'));var BPromise=require(_0x9976('0x3'));var rs=require(_0x9976('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9976('0x5'));var logger=require(_0x9976('0x6'))(_0x9976('0x7'));var config=require(_0x9976('0x8'));var jayson=require(_0x9976('0x9'));var client=jayson[_0x9976('0xa')][_0x9976('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x401833,_0x599dcf,_0x10b12e){return new BPromise(function(_0x1b4606,_0x2cc536){return client[_0x9976('0xc')](_0x401833,_0x10b12e)[_0x9976('0xd')](function(_0x49d4b4){logger['info'](_0x9976('0xe'),_0x599dcf,'request\x20sent');logger[_0x9976('0xf')](_0x9976('0x10'),_0x599dcf,_0x9976('0x11'),JSON[_0x9976('0x12')](_0x49d4b4));if(_0x49d4b4[_0x9976('0x13')]){if(_0x49d4b4[_0x9976('0x13')][_0x9976('0x14')]===0x1f4){logger['error'](_0x9976('0xe'),_0x599dcf,_0x49d4b4[_0x9976('0x13')]['message']);return _0x2cc536(_0x49d4b4[_0x9976('0x13')][_0x9976('0x15')]);}logger[_0x9976('0x13')](_0x9976('0xe'),_0x599dcf,_0x49d4b4[_0x9976('0x13')]['message']);return _0x1b4606(_0x49d4b4[_0x9976('0x13')][_0x9976('0x15')]);}else{logger[_0x9976('0x16')](_0x9976('0xe'),_0x599dcf,_0x9976('0x11'));_0x1b4606(_0x49d4b4[_0x9976('0x17')]['message']);}})[_0x9976('0x18')](function(_0x25b34c){logger[_0x9976('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x599dcf,_0x25b34c);_0x2cc536(_0x25b34c);});});} \ No newline at end of file +var _0xcde2=['moment','bluebird','ioredis','../../config/environment','jayson/promise','client','request','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0x38616d,_0x22fbe5){var _0x505626=function(_0x5b3a5a){while(--_0x5b3a5a){_0x38616d['push'](_0x38616d['shift']());}};_0x505626(++_0x22fbe5);}(_0xcde2,0x1ec));var _0x2cde=function(_0x112aac,_0x236bf2){_0x112aac=_0x112aac-0x0;var _0x19dd08=_0xcde2[_0x112aac];return _0x19dd08;};'use strict';var _=require(_0x2cde('0x0'));var util=require(_0x2cde('0x1'));var moment=require(_0x2cde('0x2'));var BPromise=require(_0x2cde('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cde('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2cde('0x5'));var jayson=require(_0x2cde('0x6'));var client=jayson[_0x2cde('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x532ec1,_0x5475b9,_0x2ee0fc){return new BPromise(function(_0x57d0aa,_0x3c2702){return client[_0x2cde('0x8')](_0x532ec1,_0x2ee0fc)['then'](function(_0x1bd0ce){logger['info'](_0x2cde('0x9'),_0x5475b9,_0x2cde('0xa'));logger[_0x2cde('0xb')](_0x2cde('0xc'),_0x5475b9,_0x2cde('0xa'),JSON[_0x2cde('0xd')](_0x1bd0ce));if(_0x1bd0ce[_0x2cde('0xe')]){if(_0x1bd0ce[_0x2cde('0xe')]['code']===0x1f4){logger[_0x2cde('0xe')](_0x2cde('0x9'),_0x5475b9,_0x1bd0ce['error'][_0x2cde('0xf')]);return _0x3c2702(_0x1bd0ce['error']['message']);}logger['error'](_0x2cde('0x9'),_0x5475b9,_0x1bd0ce[_0x2cde('0xe')][_0x2cde('0xf')]);return _0x57d0aa(_0x1bd0ce['error'][_0x2cde('0xf')]);}else{logger[_0x2cde('0x10')](_0x2cde('0x9'),_0x5475b9,_0x2cde('0xa'));_0x57d0aa(_0x1bd0ce[_0x2cde('0x11')][_0x2cde('0xf')]);}})[_0x2cde('0x12')](function(_0x177c14){logger[_0x2cde('0xe')](_0x2cde('0x9'),_0x5475b9,_0x177c14);_0x3c2702(_0x177c14);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 52c93a7..5892664 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 _0xd38b=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','server/files/images/logos/','%s%s','logo','extname','single','addLogo','root','logologin','post','file','addLogoLogin','format','originalname','favicon','addFavicon','put','update'];(function(_0x48348e,_0x3c50c9){var _0x10b100=function(_0x43a84d){while(--_0x43a84d){_0x48348e['push'](_0x48348e['shift']());}};_0x10b100(++_0x3c50c9);}(_0xd38b,0x17b));var _0xbd38=function(_0x310ee0,_0x1c5d46){_0x310ee0=_0x310ee0-0x0;var _0x2aae43=_0xd38b[_0x310ee0];return _0x2aae43;};'use strict';var multer=require(_0xbd38('0x0'));var util=require(_0xbd38('0x1'));var path=require(_0xbd38('0x2'));var timeout=require(_0xbd38('0x3'));var express=require('express');var router=express[_0xbd38('0x4')]();var fs_extra=require(_0xbd38('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd38('0x6'));var controller=require(_0xbd38('0x7'));router[_0xbd38('0x8')]('/',auth[_0xbd38('0x9')](),controller[_0xbd38('0xa')]);router[_0xbd38('0x8')](_0xbd38('0xb'),controller[_0xbd38('0xc')]);router['get'](_0xbd38('0xd'),controller[_0xbd38('0xe')]);router[_0xbd38('0x8')]('/:id/logo',controller['getLogo']);router[_0xbd38('0x8')](_0xbd38('0xf'),controller[_0xbd38('0x10')]);router[_0xbd38('0x8')](_0xbd38('0x11'),controller[_0xbd38('0x12')]);router[_0xbd38('0x8')](_0xbd38('0x13'),controller[_0xbd38('0x14')]);router[_0xbd38('0x8')](_0xbd38('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xbd38('0x16')]({'destination':function(_0x402576,_0x19425b,_0x170123){_0x170123(null,path[_0xbd38('0x17')](config['root'],_0xbd38('0x18')));},'filename':function(_0x235132,_0x2bad31,_0x38c758){_0x38c758(null,util['format'](_0xbd38('0x19'),_0xbd38('0x1a'),path[_0xbd38('0x1b')](_0x2bad31['originalname'])));}})});router['post']('/:id/logo',upload[_0xbd38('0x1c')]('file'),controller[_0xbd38('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x153604,_0x24156c,_0x53952c){_0x53952c(null,path['join'](config[_0xbd38('0x1e')],'server/files/images/logos/'));},'filename':function(_0x2341b4,_0x2fa358,_0x52c872){_0x52c872(null,util['format'](_0xbd38('0x19'),_0xbd38('0x1f'),path[_0xbd38('0x1b')](_0x2fa358['originalname'])));}})});router[_0xbd38('0x20')](_0xbd38('0xf'),upload[_0xbd38('0x1c')](_0xbd38('0x21')),controller[_0xbd38('0x22')]);var upload=multer({'storage':multer[_0xbd38('0x16')]({'destination':function(_0x48afea,_0x4ca80e,_0x2d39cc){_0x2d39cc(null,path['join'](config['root'],_0xbd38('0x18')));},'filename':function(_0x506de2,_0x5d453d,_0x928c9c){_0x928c9c(null,util[_0xbd38('0x23')](_0xbd38('0x19'),'preferred',path[_0xbd38('0x1b')](_0x5d453d[_0xbd38('0x24')])));}})});router['post'](_0xbd38('0x13'),upload[_0xbd38('0x1c')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0xbd38('0x16')]({'destination':function(_0x55569d,_0x56d396,_0x4fd557){_0x4fd557(null,path[_0xbd38('0x17')](config[_0xbd38('0x1e')],_0xbd38('0x18')));},'filename':function(_0x49f9ba,_0x2de3a5,_0x39d7fb){_0x39d7fb(null,util[_0xbd38('0x23')](_0xbd38('0x19'),_0xbd38('0x25'),path[_0xbd38('0x1b')](_0x2de3a5['originalname'])));}})});router['post'](_0xbd38('0x15'),upload[_0xbd38('0x1c')](_0xbd38('0x21')),controller[_0xbd38('0x26')]);router[_0xbd38('0x27')](_0xbd38('0xd'),auth['isAuthenticated'](),controller[_0xbd38('0x28')]);module[_0xbd38('0x29')]=router; \ No newline at end of file +var _0xe455=['post','single','file','addLogo','logologin','addLogoLogin','%s%s','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','util','path','connect-timeout','fs-extra','../../config/environment','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe455,0x1c5));var _0x5e45=function(_0x1eb7d1,_0x26b951){_0x1eb7d1=_0x1eb7d1-0x0;var _0x511b48=_0xe455[_0x1eb7d1];return _0x511b48;};'use strict';var multer=require('multer');var util=require(_0x5e45('0x0'));var path=require(_0x5e45('0x1'));var timeout=require(_0x5e45('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5e45('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e45('0x4'));var controller=require('./setting.controller');router[_0x5e45('0x5')]('/',auth['isAuthenticated'](),controller[_0x5e45('0x6')]);router['get'](_0x5e45('0x7'),controller[_0x5e45('0x8')]);router['get'](_0x5e45('0x9'),controller[_0x5e45('0xa')]);router[_0x5e45('0x5')](_0x5e45('0xb'),controller[_0x5e45('0xc')]);router[_0x5e45('0x5')](_0x5e45('0xd'),controller[_0x5e45('0xe')]);router[_0x5e45('0x5')](_0x5e45('0xf'),controller[_0x5e45('0x10')]);router[_0x5e45('0x5')](_0x5e45('0x11'),controller['getPreferred']);router['get'](_0x5e45('0x12'),controller['getFavicon']);var upload=multer({'storage':multer[_0x5e45('0x13')]({'destination':function(_0x438e65,_0x18898c,_0x264b70){_0x264b70(null,path[_0x5e45('0x14')](config[_0x5e45('0x15')],_0x5e45('0x16')));},'filename':function(_0x4420c5,_0x5bedd3,_0x10b7c6){_0x10b7c6(null,util[_0x5e45('0x17')]('%s%s',_0x5e45('0x18'),path[_0x5e45('0x19')](_0x5bedd3[_0x5e45('0x1a')])));}})});router[_0x5e45('0x1b')]('/:id/logo',upload[_0x5e45('0x1c')](_0x5e45('0x1d')),controller[_0x5e45('0x1e')]);var upload=multer({'storage':multer[_0x5e45('0x13')]({'destination':function(_0x259967,_0xf27f27,_0x2d73ab){_0x2d73ab(null,path[_0x5e45('0x14')](config['root'],_0x5e45('0x16')));},'filename':function(_0x14be7d,_0x5620bf,_0x45efa0){_0x45efa0(null,util[_0x5e45('0x17')]('%s%s',_0x5e45('0x1f'),path[_0x5e45('0x19')](_0x5620bf[_0x5e45('0x1a')])));}})});router[_0x5e45('0x1b')](_0x5e45('0xd'),upload['single'](_0x5e45('0x1d')),controller[_0x5e45('0x20')]);var upload=multer({'storage':multer[_0x5e45('0x13')]({'destination':function(_0x24f424,_0x578264,_0x190c12){_0x190c12(null,path[_0x5e45('0x14')](config[_0x5e45('0x15')],'server/files/images/logos/'));},'filename':function(_0x21a913,_0x364b80,_0x5d9164){_0x5d9164(null,util['format'](_0x5e45('0x21'),_0x5e45('0x22'),path[_0x5e45('0x19')](_0x364b80[_0x5e45('0x1a')])));}})});router['post']('/:id/preferred',upload[_0x5e45('0x1c')](_0x5e45('0x1d')),controller[_0x5e45('0x23')]);var upload=multer({'storage':multer[_0x5e45('0x13')]({'destination':function(_0x507b3b,_0x411812,_0x5ce92c){_0x5ce92c(null,path[_0x5e45('0x14')](config[_0x5e45('0x15')],'server/files/images/logos/'));},'filename':function(_0x31a9ae,_0x6d810c,_0x581980){_0x581980(null,util[_0x5e45('0x17')]('%s%s',_0x5e45('0x24'),path[_0x5e45('0x19')](_0x6d810c[_0x5e45('0x1a')])));}})});router['post'](_0x5e45('0x12'),upload[_0x5e45('0x1c')](_0x5e45('0x1d')),controller[_0x5e45('0x25')]);router[_0x5e45('0x26')](_0x5e45('0x9'),auth[_0x5e45('0x27')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f3ea09c..f5d9805 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 _0x3166=['min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_internal'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3166,0xbb));var _0x6316=function(_0x51ae4c,_0x4a2be1){_0x51ae4c=_0x51ae4c-0x0;var _0x88a396=_0x3166[_0x51ae4c];return _0x88a396;};'use strict';var Sequelize=require('sequelize');module[_0x6316('0x0')]={'min_internal':{'type':Sequelize[_0x6316('0x1')](0xb),'unique':_0x6316('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x6316('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x6316('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x6316('0x4')},'logo':{'type':Sequelize[_0x6316('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6316('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6316('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6316('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x6316('0x5')]},'turnpassword':{'type':Sequelize[_0x6316('0x5')]},'pageTitle':{'type':Sequelize[_0x6316('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x6316('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6316('0x5')],'defaultValue':_0x6316('0x7')},'enableEmailPreview':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x6316('0x5')],'defaultValue':_0x6316('0x8')},'chatTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6316('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6316('0x5')]},'defaultFavicon':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x6316('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x6316('0x1')]},'sentimentRegion':{'type':Sequelize[_0x6316('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x6316('0x1')](0x2)[_0x6316('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x6316('0x1')](0x2)[_0x6316('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x6316('0x1')](0x2)[_0x6316('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x6316('0x1')](0x2)[_0x6316('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x14}}; \ No newline at end of file +var _0xf567=['sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x50b1ae,_0x236097){var _0x27adce=function(_0x5cd9f){while(--_0x5cd9f){_0x50b1ae['push'](_0x50b1ae['shift']());}};_0x27adce(++_0x236097);}(_0xf567,0x118));var _0x7f56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf567[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7f56('0x0'));module[_0x7f56('0x1')]={'min_internal':{'type':Sequelize[_0x7f56('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7f56('0x2')](0xb),'unique':_0x7f56('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x7f56('0x4')],'defaultValue':_0x7f56('0x5')},'logo':{'type':Sequelize[_0x7f56('0x4')]},'defaultLogo':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7f56('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7f56('0x4')]},'turnaddr':{'type':Sequelize[_0x7f56('0x4')]},'turnusername':{'type':Sequelize[_0x7f56('0x4')]},'turnpassword':{'type':Sequelize[_0x7f56('0x4')]},'pageTitle':{'type':Sequelize[_0x7f56('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7f56('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7f56('0x4')],'defaultValue':_0x7f56('0x7')},'enableEmailPreview':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7f56('0x4')],'defaultValue':_0x7f56('0x8')},'chatTimeout':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7f56('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7f56('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x7f56('0x4')]},'defaultFavicon':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7f56('0x2')]},'sentimentRegion':{'type':Sequelize[_0x7f56('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x7f56('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7f56('0x2')](0x2)[_0x7f56('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x7f56('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x7f56('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x7f56('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x7f56('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x7f56('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x7f56('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 f1aaee9..c247416 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 _0xe79a=['fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','undefined','offset','count','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','Setting','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','then','includeAll','include','show','params','find','body','addLogo','file','loginLogo','filename','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','join','root','default_logo.svg','default','upperFirst','custom','toLower','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','defaultPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe79a,0x70));var _0xae79=function(_0x5c7939,_0x22f61e){_0x5c7939=_0x5c7939-0x0;var _0x5bcfbc=_0xe79a[_0x5c7939];return _0x5bcfbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae79('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae79('0x1'));var moment=require(_0xae79('0x2'));var BPromise=require(_0xae79('0x3'));var Mustache=require(_0xae79('0x4'));var util=require('util');var path=require(_0xae79('0x5'));var sox=require(_0xae79('0x6'));var csv=require(_0xae79('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae79('0x8'));var _=require(_0xae79('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xae79('0xa'));var deskjs=require(_0xae79('0xb'));var toCsv=require('to-csv');var querystring=require(_0xae79('0xc'));var Papa=require('papaparse');var Redis=require(_0xae79('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xae79('0xe'));var hardwareService=require(_0xae79('0xf'));var logger=require(_0xae79('0x10'))('api');var utils=require(_0xae79('0x11'));var config=require(_0xae79('0x12'));var licenseUtil=require(_0xae79('0x13'));var db=require(_0xae79('0x14'))['db'];var jayson=require(_0xae79('0x15'));var client=jayson[_0xae79('0x16')][_0xae79('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x12c634,_0x15ed35,_0x471fbf,_0x478937){return new BPromise(function(_0xdbae20,_0x456180){var _0x34fc00=_0x478937||client;return _0x34fc00[_0xae79('0x18')](_0x12c634,_0x471fbf)['then'](function(_0x4e4615){logger[_0xae79('0x19')](_0xae79('0x1a'),_0x15ed35,'request\x20sent');logger[_0xae79('0x1b')]('Setting,\x20%s,\x20%s,\x20%s',_0x15ed35,_0xae79('0x1c'),JSON[_0xae79('0x1d')](_0x4e4615));if(_0x4e4615[_0xae79('0x1e')]){if(_0x4e4615[_0xae79('0x1e')][_0xae79('0x1f')]===0x1f4){logger['error'](_0xae79('0x1a'),_0x15ed35,_0x4e4615[_0xae79('0x1e')][_0xae79('0x20')]);return _0x456180(_0x4e4615[_0xae79('0x1e')][_0xae79('0x20')]);}logger[_0xae79('0x1e')]('Setting,\x20%s,\x20%s',_0x15ed35,_0x4e4615[_0xae79('0x1e')][_0xae79('0x20')]);return _0xdbae20(_0x4e4615[_0xae79('0x1e')]['message']);}else{logger[_0xae79('0x19')](_0xae79('0x1a'),_0x15ed35,'request\x20sent');_0xdbae20(_0x4e4615[_0xae79('0x21')][_0xae79('0x20')]);}})[_0xae79('0x22')](function(_0x3f8409){logger['error'](_0xae79('0x1a'),_0x15ed35,_0x3f8409);_0x456180(_0x3f8409);});});}function respondWithStatusCode(_0x33f0c5,_0x49c55e){_0x49c55e=_0x49c55e||0xcc;return function(_0x5d4a57){if(_0x5d4a57){return _0x33f0c5[_0xae79('0x23')](_0x49c55e);}return _0x33f0c5[_0xae79('0x24')](_0x49c55e)['end']();};}function respondWithResult(_0x1e5101,_0x6a289b){_0x6a289b=_0x6a289b||0xc8;return function(_0x819255){if(_0x819255){return _0x1e5101[_0xae79('0x24')](_0x6a289b)['json'](_0x819255);}};}function respondWithFilteredResult(_0x1e8618,_0x504d65){return function(_0x3ee7ea){if(_0x3ee7ea){var _0x505b85=typeof _0x504d65['offset']===_0xae79('0x25')&&typeof _0x504d65['limit']===_0xae79('0x25');var _0x1d86be=_0x3ee7ea['count'];var _0x55731c=_0x505b85?0x0:_0x504d65[_0xae79('0x26')];var _0x5b43cd=_0x505b85?_0x3ee7ea[_0xae79('0x27')]:_0x504d65[_0xae79('0x26')]+_0x504d65[_0xae79('0x28')];var _0x3a3e68;if(_0x5b43cd>=_0x1d86be){_0x5b43cd=_0x1d86be;_0x3a3e68=0xc8;}else{_0x3a3e68=0xce;}_0x1e8618['status'](_0x3a3e68);return _0x1e8618['set'](_0xae79('0x29'),_0x55731c+'-'+_0x5b43cd+'/'+_0x1d86be)['json'](_0x3ee7ea);}return null;};}function patchUpdates(_0x4693be){return function(_0x34596b){try{jsonpatch[_0xae79('0x2a')](_0x34596b,_0x4693be,!![]);}catch(_0x271a78){return BPromise[_0xae79('0x2b')](_0x271a78);}return _0x34596b[_0xae79('0x2c')]();};}function saveUpdates(_0x49bd6c,_0xb91d40){return function(_0x34aacf){if(_0x34aacf){return _0x34aacf[_0xae79('0x2d')](_0x49bd6c)['then'](function(_0x1aa76a){return _0x1aa76a;});}return null;};}function removeEntity(_0x40b461,_0x44f0dd){return function(_0x13ee06){if(_0x13ee06){return _0x13ee06[_0xae79('0x2e')]()['then'](function(){_0x40b461[_0xae79('0x24')](0xcc)[_0xae79('0x2f')]();});}};}function handleEntityNotFound(_0x71fabd,_0x59a276){return function(_0x5bc86d){if(!_0x5bc86d){_0x71fabd[_0xae79('0x23')](0x194);}return _0x5bc86d;};}function handleError(_0x9b7026,_0x44c270){_0x44c270=_0x44c270||0x1f4;return function(_0x5a3ff8){logger[_0xae79('0x1e')](_0x5a3ff8[_0xae79('0x30')]);if(_0x5a3ff8['name']){delete _0x5a3ff8[_0xae79('0x31')];}_0x9b7026[_0xae79('0x24')](_0x44c270)[_0xae79('0x32')](_0x5a3ff8);};}exports['index']=function(_0x273396,_0x2b5e69){var _0x17c3a5={},_0x388c5f={},_0x3e4db2={'count':0x0,'rows':[]};var _0x5d4cc9=_[_0xae79('0x33')](db[_0xae79('0x34')][_0xae79('0x35')],function(_0x22b342){return{'name':_0x22b342['fieldName'],'type':_0x22b342[_0xae79('0x36')][_0xae79('0x37')]};});_0x388c5f[_0xae79('0x38')]=_['map'](_0x5d4cc9,_0xae79('0x31'));_0x388c5f[_0xae79('0x39')]=_[_0xae79('0x3a')](_0x273396['query']);_0x388c5f[_0xae79('0x3b')]=_[_0xae79('0x3c')](_0x388c5f['model'],_0x388c5f[_0xae79('0x39')]);_0x17c3a5[_0xae79('0x3d')]=_[_0xae79('0x3c')](_0x388c5f['model'],qs[_0xae79('0x3e')](_0x273396[_0xae79('0x39')][_0xae79('0x3e')]));_0x17c3a5[_0xae79('0x3d')]=_0x17c3a5[_0xae79('0x3d')][_0xae79('0x3f')]?_0x17c3a5[_0xae79('0x3d')]:_0x388c5f[_0xae79('0x38')];if(!_0x273396['query'][_0xae79('0x40')]('nolimit')){_0x17c3a5[_0xae79('0x28')]=qs[_0xae79('0x28')](_0x273396[_0xae79('0x39')][_0xae79('0x28')]);_0x17c3a5[_0xae79('0x26')]=qs[_0xae79('0x26')](_0x273396['query'][_0xae79('0x26')]);}_0x17c3a5[_0xae79('0x41')]=qs[_0xae79('0x42')](_0x273396['query'][_0xae79('0x42')]);_0x17c3a5['where']=qs[_0xae79('0x3b')](_[_0xae79('0x43')](_0x273396[_0xae79('0x39')],_0x388c5f[_0xae79('0x3b')]),_0x5d4cc9);if(_0x273396[_0xae79('0x39')]['filter']){_0x17c3a5[_0xae79('0x44')]=_[_0xae79('0x45')](_0x17c3a5[_0xae79('0x44')],{'$or':_[_0xae79('0x33')](_0x5d4cc9,function(_0x1f66db){if(_0x1f66db[_0xae79('0x36')]!=='VIRTUAL'){var _0x2615fd={};_0x2615fd[_0x1f66db['name']]={'$like':'%'+_0x273396[_0xae79('0x39')][_0xae79('0x46')]+'%'};return _0x2615fd;}})});}_0x17c3a5=_['merge']({},_0x17c3a5,_0x273396[_0xae79('0x47')]);var _0x1fe151={'where':_0x17c3a5['where']};return db['Setting'][_0xae79('0x27')](_0x1fe151)[_0xae79('0x48')](function(_0x545ce2){_0x3e4db2['count']=_0x545ce2;if(_0x273396[_0xae79('0x39')][_0xae79('0x49')]){_0x17c3a5[_0xae79('0x4a')]=[{'all':!![]}];}return db[_0xae79('0x34')]['findAll'](_0x17c3a5);})['then'](function(_0x596a2b){_0x3e4db2['rows']=_0x596a2b;return _0x3e4db2;})[_0xae79('0x48')](respondWithFilteredResult(_0x2b5e69,_0x17c3a5))[_0xae79('0x22')](handleError(_0x2b5e69,null));};exports[_0xae79('0x4b')]=function(_0x2ca8b1,_0x166192){var _0x34f1b4={'raw':![],'where':{'id':_0x2ca8b1[_0xae79('0x4c')]['id']}},_0x2cea67={};_0x2cea67['model']=_[_0xae79('0x3a')](db[_0xae79('0x34')][_0xae79('0x35')]);_0x2cea67[_0xae79('0x39')]=_[_0xae79('0x3a')](_0x2ca8b1[_0xae79('0x39')]);_0x2cea67['filters']=_[_0xae79('0x3c')](_0x2cea67[_0xae79('0x38')],_0x2cea67[_0xae79('0x39')]);_0x34f1b4[_0xae79('0x3d')]=_['intersection'](_0x2cea67['model'],qs[_0xae79('0x3e')](_0x2ca8b1[_0xae79('0x39')]['fields']));_0x34f1b4[_0xae79('0x3d')]=_0x34f1b4['attributes'][_0xae79('0x3f')]?_0x34f1b4[_0xae79('0x3d')]:_0x2cea67[_0xae79('0x38')];if(_0x2ca8b1[_0xae79('0x39')]['includeAll']){_0x34f1b4[_0xae79('0x4a')]=[{'all':!![]}];}_0x34f1b4=_[_0xae79('0x45')]({},_0x34f1b4,_0x2ca8b1['options']);return db[_0xae79('0x34')][_0xae79('0x4d')](_0x34f1b4)[_0xae79('0x48')](handleEntityNotFound(_0x166192,null))[_0xae79('0x48')](respondWithResult(_0x166192,null))['catch'](handleError(_0x166192,null));};exports[_0xae79('0x2d')]=function(_0x2b5bcc,_0xc98b31){if(_0x2b5bcc['body']['id']){delete _0x2b5bcc[_0xae79('0x4e')]['id'];}return db['Setting'][_0xae79('0x4d')]({'where':{'id':_0x2b5bcc[_0xae79('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc98b31,null))['then'](saveUpdates(_0x2b5bcc['body'],null))[_0xae79('0x48')](respondWithResult(_0xc98b31,null))['catch'](handleError(_0xc98b31,null));};exports[_0xae79('0x4f')]=function(_0xfa8720,_0x35e691,_0x3ec4f4){if(_0xfa8720['file']&&_0xfa8720[_0xae79('0x50')]['filename']){_0xfa8720[_0xae79('0x4e')]['logo']=_0xfa8720[_0xae79('0x50')]['filename'];}return db['Setting'][_0xae79('0x4d')]({'where':{'id':_0xfa8720['params']['id']}})[_0xae79('0x48')](handleEntityNotFound(_0x35e691,null))[_0xae79('0x48')](saveUpdates(_0xfa8720['body'],null))['then'](respondWithResult(_0x35e691,null))[_0xae79('0x22')](handleError(_0x35e691,null));};exports['addLogoLogin']=function(_0x29ce2e,_0x35d684,_0x54f392){if(_0x29ce2e['file']&&_0x29ce2e[_0xae79('0x50')]['filename']){_0x29ce2e[_0xae79('0x4e')][_0xae79('0x51')]=_0x29ce2e[_0xae79('0x50')][_0xae79('0x52')];}return db[_0xae79('0x34')][_0xae79('0x4d')]({'where':{'id':_0x29ce2e[_0xae79('0x4c')]['id']}})[_0xae79('0x48')](handleEntityNotFound(_0x35d684,null))[_0xae79('0x48')](saveUpdates(_0x29ce2e[_0xae79('0x4e')],null))['then'](respondWithResult(_0x35d684,null))['catch'](handleError(_0x35d684,null));};var utilLicense=require('../../config/license/util');exports[_0xae79('0x53')]=function(_0x250b3a,_0x503414,_0x5e1f78){var _0x10ad25=_0xae79('0x54');var _0x533bb4={'custom':![]};return utilLicense[_0xae79('0x55')]()[_0xae79('0x48')](function(_0x5da8f5){if(_0x5da8f5){_0x533bb4=_0x5da8f5;}return db['Setting']['find']({'where':{'id':_0x250b3a[_0xae79('0x4c')]['id']},'attributes':[_0xae79('0x56'),_0xae79('0x51'),_0xae79('0x57'),_0xae79('0x58'),_0xae79('0x59'),_0xae79('0x5a'),'defaultPreferred',_0xae79('0x5b')],'raw':!![]});})[_0xae79('0x48')](handleEntityNotFound(_0x503414,null))[_0xae79('0x48')](function(_0x132f09){if(_0x132f09){var _0x47b289=_0x132f09[_0xae79('0x56')]&&fs['existsSync'](path[_0xae79('0x5c')](config['root'],_0x10ad25,_['toLower'](_0x132f09[_0xae79('0x56')])))?path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x10ad25,_['toLower'](_0x132f09[_0xae79('0x56')])):path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x10ad25,_['toLower'](_0xae79('0x5e')));var _0x4259ac=_0xae79('0x5f')+_[_0xae79('0x60')](_0xae79('0x56'));if(_0x132f09[_0x4259ac]||!_0x533bb4[_0xae79('0x61')]){_0x47b289=path['join'](config['root'],_0x10ad25,_[_0xae79('0x62')]('default_logo.svg'));}if(!fs[_0xae79('0x63')](_0x47b289)){throw new db[(_0xae79('0x64'))][(_0xae79('0x65'))](_[_0xae79('0x60')]('logo')+_0xae79('0x66'));}return _0x503414[_0xae79('0x67')](_0x47b289);}})['catch'](handleError(_0x503414,null));};var utilLicense=require(_0xae79('0x13'));exports[_0xae79('0x68')]=function(_0x5cf266,_0x29f568,_0x2c91a6){var _0xdeab6b='server/files/images/logos';var _0x4f59ad={'custom':![]};return utilLicense[_0xae79('0x55')]()[_0xae79('0x48')](function(_0x1f015e){if(_0x1f015e){_0x4f59ad=_0x1f015e;}return db[_0xae79('0x34')]['find']({'where':{'id':_0x5cf266[_0xae79('0x4c')]['id']},'attributes':['logo',_0xae79('0x51'),_0xae79('0x57'),'favicon',_0xae79('0x59'),_0xae79('0x5a'),'defaultPreferred',_0xae79('0x5b')],'raw':!![]});})[_0xae79('0x48')](handleEntityNotFound(_0x29f568,null))[_0xae79('0x48')](function(_0x46a4bd){if(_0x46a4bd){var _0x11dd2d=_0x46a4bd[_0xae79('0x51')]&&fs[_0xae79('0x63')](path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0xdeab6b,_[_0xae79('0x62')](_0x46a4bd[_0xae79('0x51')])))?path[_0xae79('0x5c')](config['root'],_0xdeab6b,_['toLower'](_0x46a4bd[_0xae79('0x51')])):path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0xdeab6b,_[_0xae79('0x62')](_0xae79('0x69')));var _0x104c3a='default'+_['upperFirst'](_0xae79('0x51'));if(_0x46a4bd[_0x104c3a]||!_0x4f59ad[_0xae79('0x61')]){_0x11dd2d=path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0xdeab6b,_[_0xae79('0x62')](_0xae79('0x69')));}if(!fs[_0xae79('0x63')](_0x11dd2d)){throw new db['Sequelize'][(_0xae79('0x65'))](_[_0xae79('0x60')](_0xae79('0x51'))+_0xae79('0x66'));}return _0x29f568[_0xae79('0x67')](_0x11dd2d);}})[_0xae79('0x22')](handleError(_0x29f568,null));};exports[_0xae79('0x6a')]=function(_0x493fbc,_0x4ae4d0){return db['Setting'][_0xae79('0x4d')]({'where':{'id':_0x493fbc[_0xae79('0x4c')]['id']},'attributes':[_0xae79('0x6b')]})[_0xae79('0x48')](respondWithResult(_0x4ae4d0,null))[_0xae79('0x22')](handleError(_0x4ae4d0,null));};exports[_0xae79('0x6c')]=function(_0x37a7e2,_0x42ed0f,_0x538569){if(_0x37a7e2[_0xae79('0x50')]&&_0x37a7e2['file'][_0xae79('0x52')]){_0x37a7e2[_0xae79('0x4e')][_0xae79('0x57')]=_0x37a7e2[_0xae79('0x50')]['filename'];}return db['Setting'][_0xae79('0x4d')]({'where':{'id':_0x37a7e2[_0xae79('0x4c')]['id']}})[_0xae79('0x48')](handleEntityNotFound(_0x42ed0f,null))['then'](saveUpdates(_0x37a7e2[_0xae79('0x4e')],null))[_0xae79('0x48')](respondWithResult(_0x42ed0f,null))[_0xae79('0x22')](handleError(_0x42ed0f,null));};var utilLicense=require('../../config/license/util');exports[_0xae79('0x6d')]=function(_0x378791,_0x2b7eea,_0x707284){var _0x4eda97=_0xae79('0x54');var _0xfee3a6={'custom':![]};return utilLicense[_0xae79('0x55')]()[_0xae79('0x48')](function(_0x1dee24){if(_0x1dee24){_0xfee3a6=_0x1dee24;}return db[_0xae79('0x34')][_0xae79('0x4d')]({'where':{'id':_0x378791[_0xae79('0x4c')]['id']},'attributes':[_0xae79('0x56'),_0xae79('0x51'),'preferred',_0xae79('0x58'),'defaultLogo','defaultLoginLogo',_0xae79('0x6e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x2b7eea,null))[_0xae79('0x48')](function(_0x7c0e4b){if(_0x7c0e4b){var _0x26a535=_0x7c0e4b[_0xae79('0x57')]&&fs['existsSync'](path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x4eda97,_[_0xae79('0x62')](_0x7c0e4b['preferred'])))?path['join'](config[_0xae79('0x5d')],_0x4eda97,_[_0xae79('0x62')](_0x7c0e4b[_0xae79('0x57')])):path['join'](config[_0xae79('0x5d')],_0x4eda97,_[_0xae79('0x62')](_0xae79('0x6f')));var _0x5f0369='default'+_[_0xae79('0x60')](_0xae79('0x57'));if(_0x7c0e4b[_0x5f0369]||!_0xfee3a6[_0xae79('0x61')]||!_0xfee3a6['preferred']){_0x26a535=path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x4eda97,_[_0xae79('0x62')](_0xae79('0x6f')));}if(!fs['existsSync'](_0x26a535)){throw new db[(_0xae79('0x64'))][(_0xae79('0x65'))](_['upperFirst'](_0xae79('0x57'))+_0xae79('0x66'));}return _0x2b7eea[_0xae79('0x67')](_0x26a535);}})['catch'](handleError(_0x2b7eea,null));};exports[_0xae79('0x70')]=function(_0x2cb87c,_0xd3170f,_0x23167b){if(_0x2cb87c[_0xae79('0x50')]&&_0x2cb87c[_0xae79('0x50')]['filename']){_0x2cb87c[_0xae79('0x4e')]['favicon']=_0x2cb87c[_0xae79('0x50')][_0xae79('0x52')];}return db[_0xae79('0x34')][_0xae79('0x4d')]({'where':{'id':_0x2cb87c[_0xae79('0x4c')]['id']}})[_0xae79('0x48')](handleEntityNotFound(_0xd3170f,null))[_0xae79('0x48')](saveUpdates(_0x2cb87c[_0xae79('0x4e')],null))[_0xae79('0x48')](respondWithResult(_0xd3170f,null))[_0xae79('0x22')](handleError(_0xd3170f,null));};var utilLicense=require(_0xae79('0x13'));exports[_0xae79('0x71')]=function(_0x2d13c1,_0x1b4b19,_0x1281c5){var _0x5bc8ad=_0xae79('0x54');var _0x4d6ef0={'custom':![]};return utilLicense[_0xae79('0x55')]()[_0xae79('0x48')](function(_0x5957f0){if(_0x5957f0){_0x4d6ef0=_0x5957f0;}return db[_0xae79('0x34')][_0xae79('0x4d')]({'where':{'id':_0x2d13c1['params']['id']},'attributes':[_0xae79('0x56'),_0xae79('0x51'),_0xae79('0x57'),_0xae79('0x58'),_0xae79('0x59'),_0xae79('0x5a'),_0xae79('0x6e'),_0xae79('0x5b')],'raw':!![]});})[_0xae79('0x48')](handleEntityNotFound(_0x1b4b19,null))[_0xae79('0x48')](function(_0x57312b){if(_0x57312b){var _0x51d4a9=_0x57312b[_0xae79('0x58')]&&fs['existsSync'](path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x5bc8ad,_[_0xae79('0x62')](_0x57312b[_0xae79('0x58')])))?path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x5bc8ad,_[_0xae79('0x62')](_0x57312b[_0xae79('0x58')])):path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x5bc8ad,_['toLower'](_0xae79('0x72')));var _0x42b9ed=_0xae79('0x5f')+_[_0xae79('0x60')]('favicon');if(_0x57312b[_0x42b9ed]||!_0x4d6ef0[_0xae79('0x61')]){_0x51d4a9=path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x5bc8ad,_[_0xae79('0x62')]('default_favicon.ico'));}if(!fs['existsSync'](_0x51d4a9)){throw new db[(_0xae79('0x64'))][(_0xae79('0x65'))](_[_0xae79('0x60')](_0xae79('0x58'))+'\x20not\x20found');}return _0x1b4b19['download'](_0x51d4a9);}})[_0xae79('0x22')](handleError(_0x1b4b19,null));};exports[_0xae79('0x73')]=function(_0x473431,_0x5eeaa1){var _0x2e571b={'offset':moment()['utcOffset']()};_0x2e571b[_0xae79('0x74')]=moment()[_0xae79('0x75')](_0x2e571b[_0xae79('0x26')])[_0xae79('0x76')](_0xae79('0x77'));return _0x5eeaa1[_0xae79('0x24')](0xc8)[_0xae79('0x32')](_0x2e571b);}; \ No newline at end of file +var _0x4cdd=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','findAll','show','length','includeAll','body','find','params','file','filename','catch','getLogo','getLicense','logo','loginLogo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','http','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName'];(function(_0x32e580,_0x4c6b0d){var _0x12e8e5=function(_0x6abb){while(--_0x6abb){_0x32e580['push'](_0x32e580['shift']());}};_0x12e8e5(++_0x4c6b0d);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x109a08,_0x51905c){_0x109a08=_0x109a08-0x0;var _0x2a42a3=_0x4cdd[_0x109a08];return _0x2a42a3;};'use strict';var emlformat=require(_0xd4cd('0x0'));var rimraf=require(_0xd4cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd4cd('0x2'));var moment=require(_0xd4cd('0x3'));var BPromise=require(_0xd4cd('0x4'));var Mustache=require(_0xd4cd('0x5'));var util=require(_0xd4cd('0x6'));var path=require(_0xd4cd('0x7'));var sox=require(_0xd4cd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4cd('0x9'));var squel=require('squel');var crypto=require(_0xd4cd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd4cd('0xb'));var toCsv=require(_0xd4cd('0xc'));var querystring=require(_0xd4cd('0xd'));var Papa=require(_0xd4cd('0xe'));var Redis=require(_0xd4cd('0xf'));var authService=require(_0xd4cd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd4cd('0x11'));var hardwareService=require(_0xd4cd('0x12'));var logger=require(_0xd4cd('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd4cd('0x14'));var db=require(_0xd4cd('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xd4cd('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x313af1,_0x5d1b49,_0x4e11a4,_0x5aa418){return new BPromise(function(_0x8bdf6f,_0x2bf761){var _0x54cf5d=_0x5aa418||client;return _0x54cf5d['request'](_0x313af1,_0x4e11a4)['then'](function(_0x35e30c){logger['info']('Setting,\x20%s,\x20%s',_0x5d1b49,_0xd4cd('0x17'));logger[_0xd4cd('0x18')](_0xd4cd('0x19'),_0x5d1b49,_0xd4cd('0x17'),JSON[_0xd4cd('0x1a')](_0x35e30c));if(_0x35e30c['error']){if(_0x35e30c[_0xd4cd('0x1b')][_0xd4cd('0x1c')]===0x1f4){logger['error'](_0xd4cd('0x1d'),_0x5d1b49,_0x35e30c[_0xd4cd('0x1b')]['message']);return _0x2bf761(_0x35e30c[_0xd4cd('0x1b')][_0xd4cd('0x1e')]);}logger[_0xd4cd('0x1b')](_0xd4cd('0x1d'),_0x5d1b49,_0x35e30c[_0xd4cd('0x1b')]['message']);return _0x8bdf6f(_0x35e30c['error'][_0xd4cd('0x1e')]);}else{logger[_0xd4cd('0x1f')](_0xd4cd('0x1d'),_0x5d1b49,_0xd4cd('0x17'));_0x8bdf6f(_0x35e30c[_0xd4cd('0x20')][_0xd4cd('0x1e')]);}})['catch'](function(_0x244ee3){logger[_0xd4cd('0x1b')]('Setting,\x20%s,\x20%s',_0x5d1b49,_0x244ee3);_0x2bf761(_0x244ee3);});});}function respondWithStatusCode(_0x282fd3,_0x2e2dbf){_0x2e2dbf=_0x2e2dbf||0xcc;return function(_0x4b370f){if(_0x4b370f){return _0x282fd3[_0xd4cd('0x21')](_0x2e2dbf);}return _0x282fd3['status'](_0x2e2dbf)['end']();};}function respondWithResult(_0x49ce20,_0x27bbe8){_0x27bbe8=_0x27bbe8||0xc8;return function(_0x230eea){if(_0x230eea){return _0x49ce20[_0xd4cd('0x22')](_0x27bbe8)[_0xd4cd('0x23')](_0x230eea);}};}function respondWithFilteredResult(_0x43efdd,_0x3897e3){return function(_0x443f9e){if(_0x443f9e){var _0x371ccf=typeof _0x3897e3[_0xd4cd('0x24')]===_0xd4cd('0x25')&&typeof _0x3897e3[_0xd4cd('0x26')]===_0xd4cd('0x25');var _0x29918d=_0x443f9e['count'];var _0xae194c=_0x371ccf?0x0:_0x3897e3[_0xd4cd('0x24')];var _0x5c8b1f=_0x371ccf?_0x443f9e[_0xd4cd('0x27')]:_0x3897e3[_0xd4cd('0x24')]+_0x3897e3['limit'];var _0x3a892b;if(_0x5c8b1f>=_0x29918d){_0x5c8b1f=_0x29918d;_0x3a892b=0xc8;}else{_0x3a892b=0xce;}_0x43efdd[_0xd4cd('0x22')](_0x3a892b);return _0x43efdd[_0xd4cd('0x28')](_0xd4cd('0x29'),_0xae194c+'-'+_0x5c8b1f+'/'+_0x29918d)[_0xd4cd('0x23')](_0x443f9e);}return null;};}function patchUpdates(_0x40ab61){return function(_0x484ec6){try{jsonpatch['apply'](_0x484ec6,_0x40ab61,!![]);}catch(_0x1bae67){return BPromise[_0xd4cd('0x2a')](_0x1bae67);}return _0x484ec6[_0xd4cd('0x2b')]();};}function saveUpdates(_0x27a1ea,_0x4e860f){return function(_0x1c788f){if(_0x1c788f){return _0x1c788f[_0xd4cd('0x2c')](_0x27a1ea)[_0xd4cd('0x2d')](function(_0x4a49ce){return _0x4a49ce;});}return null;};}function removeEntity(_0x1dbfa5,_0x5efa56){return function(_0x30c2b2){if(_0x30c2b2){return _0x30c2b2[_0xd4cd('0x2e')]()[_0xd4cd('0x2d')](function(){_0x1dbfa5[_0xd4cd('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f93e,_0x310542){return function(_0x42f7da){if(!_0x42f7da){_0x11f93e[_0xd4cd('0x21')](0x194);}return _0x42f7da;};}function handleError(_0x5dc549,_0x3ab62d){_0x3ab62d=_0x3ab62d||0x1f4;return function(_0xf2f5ab){logger[_0xd4cd('0x1b')](_0xf2f5ab[_0xd4cd('0x2f')]);if(_0xf2f5ab[_0xd4cd('0x30')]){delete _0xf2f5ab['name'];}_0x5dc549[_0xd4cd('0x22')](_0x3ab62d)[_0xd4cd('0x31')](_0xf2f5ab);};}exports[_0xd4cd('0x32')]=function(_0x30492f,_0x3fd569){var _0x2f7692={},_0x18fcfc={},_0x318019={'count':0x0,'rows':[]};var _0x536ce0=_[_0xd4cd('0x33')](db[_0xd4cd('0x34')][_0xd4cd('0x35')],function(_0x153cfc){return{'name':_0x153cfc[_0xd4cd('0x36')],'type':_0x153cfc[_0xd4cd('0x37')][_0xd4cd('0x38')]};});_0x18fcfc[_0xd4cd('0x39')]=_['map'](_0x536ce0,_0xd4cd('0x30'));_0x18fcfc[_0xd4cd('0x3a')]=_[_0xd4cd('0x3b')](_0x30492f[_0xd4cd('0x3a')]);_0x18fcfc[_0xd4cd('0x3c')]=_[_0xd4cd('0x3d')](_0x18fcfc['model'],_0x18fcfc[_0xd4cd('0x3a')]);_0x2f7692[_0xd4cd('0x3e')]=_[_0xd4cd('0x3d')](_0x18fcfc[_0xd4cd('0x39')],qs[_0xd4cd('0x3f')](_0x30492f['query'][_0xd4cd('0x3f')]));_0x2f7692[_0xd4cd('0x3e')]=_0x2f7692[_0xd4cd('0x3e')]['length']?_0x2f7692[_0xd4cd('0x3e')]:_0x18fcfc[_0xd4cd('0x39')];if(!_0x30492f[_0xd4cd('0x3a')][_0xd4cd('0x40')](_0xd4cd('0x41'))){_0x2f7692[_0xd4cd('0x26')]=qs['limit'](_0x30492f[_0xd4cd('0x3a')][_0xd4cd('0x26')]);_0x2f7692[_0xd4cd('0x24')]=qs[_0xd4cd('0x24')](_0x30492f[_0xd4cd('0x3a')]['offset']);}_0x2f7692[_0xd4cd('0x42')]=qs[_0xd4cd('0x43')](_0x30492f[_0xd4cd('0x3a')][_0xd4cd('0x43')]);_0x2f7692['where']=qs['filters'](_['pick'](_0x30492f[_0xd4cd('0x3a')],_0x18fcfc[_0xd4cd('0x3c')]),_0x536ce0);if(_0x30492f[_0xd4cd('0x3a')][_0xd4cd('0x44')]){_0x2f7692[_0xd4cd('0x45')]=_[_0xd4cd('0x46')](_0x2f7692[_0xd4cd('0x45')],{'$or':_[_0xd4cd('0x33')](_0x536ce0,function(_0x5bf7fa){if(_0x5bf7fa[_0xd4cd('0x37')]!=='VIRTUAL'){var _0x33ccd1={};_0x33ccd1[_0x5bf7fa[_0xd4cd('0x30')]]={'$like':'%'+_0x30492f[_0xd4cd('0x3a')][_0xd4cd('0x44')]+'%'};return _0x33ccd1;}})});}_0x2f7692=_['merge']({},_0x2f7692,_0x30492f[_0xd4cd('0x47')]);var _0x4f7f30={'where':_0x2f7692['where']};return db['Setting']['count'](_0x4f7f30)[_0xd4cd('0x2d')](function(_0x1296da){_0x318019[_0xd4cd('0x27')]=_0x1296da;if(_0x30492f[_0xd4cd('0x3a')]['includeAll']){_0x2f7692[_0xd4cd('0x48')]=[{'all':!![]}];}return db['Setting'][_0xd4cd('0x49')](_0x2f7692);})[_0xd4cd('0x2d')](function(_0x391e51){_0x318019['rows']=_0x391e51;return _0x318019;})[_0xd4cd('0x2d')](respondWithFilteredResult(_0x3fd569,_0x2f7692))['catch'](handleError(_0x3fd569,null));};exports[_0xd4cd('0x4a')]=function(_0x559fc6,_0x48a196){var _0x7d070c={'raw':![],'where':{'id':_0x559fc6['params']['id']}},_0x1a337d={};_0x1a337d[_0xd4cd('0x39')]=_[_0xd4cd('0x3b')](db[_0xd4cd('0x34')]['rawAttributes']);_0x1a337d[_0xd4cd('0x3a')]=_[_0xd4cd('0x3b')](_0x559fc6['query']);_0x1a337d[_0xd4cd('0x3c')]=_[_0xd4cd('0x3d')](_0x1a337d[_0xd4cd('0x39')],_0x1a337d[_0xd4cd('0x3a')]);_0x7d070c[_0xd4cd('0x3e')]=_[_0xd4cd('0x3d')](_0x1a337d[_0xd4cd('0x39')],qs['fields'](_0x559fc6[_0xd4cd('0x3a')]['fields']));_0x7d070c[_0xd4cd('0x3e')]=_0x7d070c[_0xd4cd('0x3e')][_0xd4cd('0x4b')]?_0x7d070c[_0xd4cd('0x3e')]:_0x1a337d[_0xd4cd('0x39')];if(_0x559fc6['query'][_0xd4cd('0x4c')]){_0x7d070c['include']=[{'all':!![]}];}_0x7d070c=_[_0xd4cd('0x46')]({},_0x7d070c,_0x559fc6['options']);return db[_0xd4cd('0x34')]['find'](_0x7d070c)[_0xd4cd('0x2d')](handleEntityNotFound(_0x48a196,null))[_0xd4cd('0x2d')](respondWithResult(_0x48a196,null))['catch'](handleError(_0x48a196,null));};exports[_0xd4cd('0x2c')]=function(_0x4c666e,_0x2d43b5){if(_0x4c666e['body']['id']){delete _0x4c666e[_0xd4cd('0x4d')]['id'];}return db[_0xd4cd('0x34')][_0xd4cd('0x4e')]({'where':{'id':_0x4c666e[_0xd4cd('0x4f')]['id']}})[_0xd4cd('0x2d')](handleEntityNotFound(_0x2d43b5,null))[_0xd4cd('0x2d')](saveUpdates(_0x4c666e[_0xd4cd('0x4d')],null))[_0xd4cd('0x2d')](respondWithResult(_0x2d43b5,null))['catch'](handleError(_0x2d43b5,null));};exports['addLogo']=function(_0x4ef4c0,_0x3cd4be,_0xed37ef){if(_0x4ef4c0[_0xd4cd('0x50')]&&_0x4ef4c0['file'][_0xd4cd('0x51')]){_0x4ef4c0[_0xd4cd('0x4d')]['logo']=_0x4ef4c0[_0xd4cd('0x50')][_0xd4cd('0x51')];}return db['Setting'][_0xd4cd('0x4e')]({'where':{'id':_0x4ef4c0[_0xd4cd('0x4f')]['id']}})[_0xd4cd('0x2d')](handleEntityNotFound(_0x3cd4be,null))[_0xd4cd('0x2d')](saveUpdates(_0x4ef4c0[_0xd4cd('0x4d')],null))[_0xd4cd('0x2d')](respondWithResult(_0x3cd4be,null))[_0xd4cd('0x52')](handleError(_0x3cd4be,null));};exports['addLogoLogin']=function(_0x423af1,_0x3f5553,_0x28017f){if(_0x423af1[_0xd4cd('0x50')]&&_0x423af1[_0xd4cd('0x50')][_0xd4cd('0x51')]){_0x423af1[_0xd4cd('0x4d')]['loginLogo']=_0x423af1[_0xd4cd('0x50')][_0xd4cd('0x51')];}return db[_0xd4cd('0x34')]['find']({'where':{'id':_0x423af1[_0xd4cd('0x4f')]['id']}})[_0xd4cd('0x2d')](handleEntityNotFound(_0x3f5553,null))[_0xd4cd('0x2d')](saveUpdates(_0x423af1['body'],null))[_0xd4cd('0x2d')](respondWithResult(_0x3f5553,null))[_0xd4cd('0x52')](handleError(_0x3f5553,null));};var utilLicense=require(_0xd4cd('0x14'));exports[_0xd4cd('0x53')]=function(_0x53b72c,_0xd60292,_0x53adbd){var _0x2b1bc1='server/files/images/logos';var _0x1eca34={'custom':![]};return utilLicense[_0xd4cd('0x54')]()[_0xd4cd('0x2d')](function(_0x1f9db4){if(_0x1f9db4){_0x1eca34=_0x1f9db4;}return db[_0xd4cd('0x34')]['find']({'where':{'id':_0x53b72c[_0xd4cd('0x4f')]['id']},'attributes':[_0xd4cd('0x55'),_0xd4cd('0x56'),_0xd4cd('0x57'),'favicon',_0xd4cd('0x58'),_0xd4cd('0x59'),_0xd4cd('0x5a'),_0xd4cd('0x5b')],'raw':!![]});})[_0xd4cd('0x2d')](handleEntityNotFound(_0xd60292,null))[_0xd4cd('0x2d')](function(_0x46e8f4){if(_0x46e8f4){var _0x4a5cd9=_0x46e8f4[_0xd4cd('0x55')]&&fs[_0xd4cd('0x5c')](path[_0xd4cd('0x5d')](config['root'],_0x2b1bc1,_['toLower'](_0x46e8f4[_0xd4cd('0x55')])))?path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0x2b1bc1,_['toLower'](_0x46e8f4[_0xd4cd('0x55')])):path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0x2b1bc1,_[_0xd4cd('0x5f')]('default_logo.svg'));var _0x4dacfc='default'+_[_0xd4cd('0x60')](_0xd4cd('0x55'));if(_0x46e8f4[_0x4dacfc]||!_0x1eca34[_0xd4cd('0x61')]){_0x4a5cd9=path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0x2b1bc1,_[_0xd4cd('0x5f')]('default_logo.svg'));}if(!fs[_0xd4cd('0x5c')](_0x4a5cd9)){throw new db[(_0xd4cd('0x62'))]['ValidationError'](_[_0xd4cd('0x60')](_0xd4cd('0x55'))+_0xd4cd('0x63'));}return _0xd60292[_0xd4cd('0x64')](_0x4a5cd9);}})[_0xd4cd('0x52')](handleError(_0xd60292,null));};var utilLicense=require(_0xd4cd('0x14'));exports[_0xd4cd('0x65')]=function(_0xe0153f,_0x121e87,_0x63341e){var _0x496cbc=_0xd4cd('0x66');var _0xbb150d={'custom':![]};return utilLicense[_0xd4cd('0x54')]()['then'](function(_0x36d1b8){if(_0x36d1b8){_0xbb150d=_0x36d1b8;}return db[_0xd4cd('0x34')][_0xd4cd('0x4e')]({'where':{'id':_0xe0153f[_0xd4cd('0x4f')]['id']},'attributes':['logo',_0xd4cd('0x56'),'preferred','favicon',_0xd4cd('0x58'),_0xd4cd('0x59'),_0xd4cd('0x5a'),_0xd4cd('0x5b')],'raw':!![]});})[_0xd4cd('0x2d')](handleEntityNotFound(_0x121e87,null))[_0xd4cd('0x2d')](function(_0x49a338){if(_0x49a338){var _0x3f87fb=_0x49a338[_0xd4cd('0x56')]&&fs[_0xd4cd('0x5c')](path[_0xd4cd('0x5d')](config['root'],_0x496cbc,_[_0xd4cd('0x5f')](_0x49a338['loginLogo'])))?path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0x496cbc,_['toLower'](_0x49a338['loginLogo'])):path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0x496cbc,_[_0xd4cd('0x5f')]('default_loginLogo.svg'));var _0x1e9f4c=_0xd4cd('0x67')+_[_0xd4cd('0x60')](_0xd4cd('0x56'));if(_0x49a338[_0x1e9f4c]||!_0xbb150d[_0xd4cd('0x61')]){_0x3f87fb=path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0x496cbc,_['toLower'](_0xd4cd('0x68')));}if(!fs[_0xd4cd('0x5c')](_0x3f87fb)){throw new db[(_0xd4cd('0x62'))][(_0xd4cd('0x69'))](_[_0xd4cd('0x60')](_0xd4cd('0x56'))+_0xd4cd('0x63'));}return _0x121e87[_0xd4cd('0x64')](_0x3f87fb);}})[_0xd4cd('0x52')](handleError(_0x121e87,null));};exports[_0xd4cd('0x6a')]=function(_0x59d9dd,_0xe69ef5){return db[_0xd4cd('0x34')][_0xd4cd('0x4e')]({'where':{'id':_0x59d9dd['params']['id']},'attributes':[_0xd4cd('0x6b')]})['then'](respondWithResult(_0xe69ef5,null))[_0xd4cd('0x52')](handleError(_0xe69ef5,null));};exports[_0xd4cd('0x6c')]=function(_0x3ad46f,_0x265fac,_0x3cc48f){if(_0x3ad46f[_0xd4cd('0x50')]&&_0x3ad46f[_0xd4cd('0x50')]['filename']){_0x3ad46f[_0xd4cd('0x4d')][_0xd4cd('0x57')]=_0x3ad46f[_0xd4cd('0x50')][_0xd4cd('0x51')];}return db[_0xd4cd('0x34')][_0xd4cd('0x4e')]({'where':{'id':_0x3ad46f['params']['id']}})['then'](handleEntityNotFound(_0x265fac,null))[_0xd4cd('0x2d')](saveUpdates(_0x3ad46f[_0xd4cd('0x4d')],null))[_0xd4cd('0x2d')](respondWithResult(_0x265fac,null))['catch'](handleError(_0x265fac,null));};var utilLicense=require(_0xd4cd('0x14'));exports['getPreferred']=function(_0x2cac96,_0x4820a8,_0x9142e){var _0xf95252=_0xd4cd('0x66');var _0x134132={'custom':![]};return utilLicense[_0xd4cd('0x54')]()[_0xd4cd('0x2d')](function(_0x59672f){if(_0x59672f){_0x134132=_0x59672f;}return db[_0xd4cd('0x34')][_0xd4cd('0x4e')]({'where':{'id':_0x2cac96['params']['id']},'attributes':[_0xd4cd('0x55'),_0xd4cd('0x56'),_0xd4cd('0x57'),_0xd4cd('0x6d'),_0xd4cd('0x58'),'defaultLoginLogo',_0xd4cd('0x5a'),'defaultFavicon'],'raw':!![]});})[_0xd4cd('0x2d')](handleEntityNotFound(_0x4820a8,null))[_0xd4cd('0x2d')](function(_0x1bd29c){if(_0x1bd29c){var _0x447ab6=_0x1bd29c[_0xd4cd('0x57')]&&fs[_0xd4cd('0x5c')](path[_0xd4cd('0x5d')](config['root'],_0xf95252,_[_0xd4cd('0x5f')](_0x1bd29c[_0xd4cd('0x57')])))?path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0xf95252,_[_0xd4cd('0x5f')](_0x1bd29c[_0xd4cd('0x57')])):path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0xf95252,_['toLower']('default_preferred.png'));var _0x2809d3=_0xd4cd('0x67')+_['upperFirst'](_0xd4cd('0x57'));if(_0x1bd29c[_0x2809d3]||!_0x134132[_0xd4cd('0x61')]||!_0x134132[_0xd4cd('0x57')]){_0x447ab6=path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0xf95252,_[_0xd4cd('0x5f')](_0xd4cd('0x6e')));}if(!fs[_0xd4cd('0x5c')](_0x447ab6)){throw new db[(_0xd4cd('0x62'))][(_0xd4cd('0x69'))](_[_0xd4cd('0x60')]('preferred')+_0xd4cd('0x63'));}return _0x4820a8[_0xd4cd('0x64')](_0x447ab6);}})[_0xd4cd('0x52')](handleError(_0x4820a8,null));};exports[_0xd4cd('0x6f')]=function(_0x4f2fde,_0x2f85aa,_0x343275){if(_0x4f2fde['file']&&_0x4f2fde['file'][_0xd4cd('0x51')]){_0x4f2fde['body'][_0xd4cd('0x6d')]=_0x4f2fde[_0xd4cd('0x50')][_0xd4cd('0x51')];}return db[_0xd4cd('0x34')][_0xd4cd('0x4e')]({'where':{'id':_0x4f2fde[_0xd4cd('0x4f')]['id']}})[_0xd4cd('0x2d')](handleEntityNotFound(_0x2f85aa,null))[_0xd4cd('0x2d')](saveUpdates(_0x4f2fde[_0xd4cd('0x4d')],null))[_0xd4cd('0x2d')](respondWithResult(_0x2f85aa,null))[_0xd4cd('0x52')](handleError(_0x2f85aa,null));};var utilLicense=require(_0xd4cd('0x14'));exports[_0xd4cd('0x70')]=function(_0x5bf7cb,_0x399ec5,_0x498f1d){var _0x7105c3=_0xd4cd('0x66');var _0x34462b={'custom':![]};return utilLicense[_0xd4cd('0x54')]()[_0xd4cd('0x2d')](function(_0x3144ff){if(_0x3144ff){_0x34462b=_0x3144ff;}return db[_0xd4cd('0x34')][_0xd4cd('0x4e')]({'where':{'id':_0x5bf7cb[_0xd4cd('0x4f')]['id']},'attributes':['logo',_0xd4cd('0x56'),_0xd4cd('0x57'),_0xd4cd('0x6d'),'defaultLogo',_0xd4cd('0x59'),_0xd4cd('0x5a'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x399ec5,null))[_0xd4cd('0x2d')](function(_0x135ca3){if(_0x135ca3){var _0x16f55e=_0x135ca3['favicon']&&fs[_0xd4cd('0x5c')](path['join'](config['root'],_0x7105c3,_[_0xd4cd('0x5f')](_0x135ca3[_0xd4cd('0x6d')])))?path[_0xd4cd('0x5d')](config[_0xd4cd('0x5e')],_0x7105c3,_[_0xd4cd('0x5f')](_0x135ca3[_0xd4cd('0x6d')])):path['join'](config['root'],_0x7105c3,_[_0xd4cd('0x5f')](_0xd4cd('0x71')));var _0x53cda5=_0xd4cd('0x67')+_[_0xd4cd('0x60')](_0xd4cd('0x6d'));if(_0x135ca3[_0x53cda5]||!_0x34462b[_0xd4cd('0x61')]){_0x16f55e=path[_0xd4cd('0x5d')](config['root'],_0x7105c3,_[_0xd4cd('0x5f')](_0xd4cd('0x71')));}if(!fs['existsSync'](_0x16f55e)){throw new db[(_0xd4cd('0x62'))]['ValidationError'](_['upperFirst']('favicon')+'\x20not\x20found');}return _0x399ec5[_0xd4cd('0x64')](_0x16f55e);}})['catch'](handleError(_0x399ec5,null));};exports[_0xd4cd('0x72')]=function(_0x128d89,_0x152a01){var _0x6b10fe={'offset':moment()[_0xd4cd('0x73')]()};_0x6b10fe[_0xd4cd('0x74')]=moment()['utcOffset'](_0x6b10fe[_0xd4cd('0x24')])[_0xd4cd('0x75')](_0xd4cd('0x76'));return _0x152a01['status'](0xc8)[_0xd4cd('0x31')](_0x6b10fe);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 2df6fa0..fcb293e 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x14e529,_0x17f55d){var _0x3ee718=function(_0x338b15){while(--_0x338b15){_0x14e529['push'](_0x14e529['shift']());}};_0x3ee718(++_0x17f55d);}(_0xedd9,0xfc));var _0x9edd=function(_0x44bda8,_0x1728d6){_0x44bda8=_0x44bda8-0x0;var _0x326d63=_0xedd9[_0x44bda8];return _0x326d63;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0x7217,0x19e));var _0x7721=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7217[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index d081b2c..6f5aaaa 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 _0x9413=['Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x35f9c4,_0x511cbd){var _0x40e2ea=function(_0x4e1ab4){while(--_0x4e1ab4){_0x35f9c4['push'](_0x35f9c4['shift']());}};_0x40e2ea(++_0x511cbd);}(_0x9413,0x15c));var _0x3941=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x9413[_0x673722];return _0x21249c;};'use strict';var _=require(_0x3941('0x0'));var util=require(_0x3941('0x1'));var moment=require(_0x3941('0x2'));var BPromise=require(_0x3941('0x3'));var rs=require(_0x3941('0x4'));var fs=require('fs');var Redis=require(_0x3941('0x5'));var db=require(_0x3941('0x6'))['db'];var utils=require(_0x3941('0x7'));var logger=require('../../config/logger')(_0x3941('0x8'));var config=require(_0x3941('0x9'));var jayson=require(_0x3941('0xa'));var client=jayson[_0x3941('0xb')][_0x3941('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6cbef4,_0x540ce1,_0x504508){return new BPromise(function(_0x1ebd19,_0x529080){return client[_0x3941('0xd')](_0x6cbef4,_0x504508)['then'](function(_0x4b674d){logger[_0x3941('0xe')](_0x3941('0xf'),_0x540ce1,'request\x20sent');logger[_0x3941('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x540ce1,_0x3941('0x11'),JSON[_0x3941('0x12')](_0x4b674d));if(_0x4b674d['error']){if(_0x4b674d[_0x3941('0x13')][_0x3941('0x14')]===0x1f4){logger[_0x3941('0x13')](_0x3941('0xf'),_0x540ce1,_0x4b674d['error'][_0x3941('0x15')]);return _0x529080(_0x4b674d[_0x3941('0x13')][_0x3941('0x15')]);}logger[_0x3941('0x13')](_0x3941('0xf'),_0x540ce1,_0x4b674d[_0x3941('0x13')][_0x3941('0x15')]);return _0x1ebd19(_0x4b674d['error']['message']);}else{logger[_0x3941('0xe')]('Setting,\x20%s,\x20%s',_0x540ce1,_0x3941('0x11'));_0x1ebd19(_0x4b674d['result'][_0x3941('0x15')]);}})[_0x3941('0x16')](function(_0x17e261){logger['error'](_0x3941('0xf'),_0x540ce1,_0x17e261);_0x529080(_0x17e261);});});}exports[_0x3941('0x17')]=function(_0x68e75e){var _0x9bdbab=this;return new Promise(function(_0x102de0,_0x3239a0){return db[_0x3941('0x18')][_0x3941('0x19')]({'raw':_0x68e75e[_0x3941('0x1a')]?_0x68e75e[_0x3941('0x1a')][_0x3941('0x1b')]===undefined?!![]:![]:!![],'where':_0x68e75e[_0x3941('0x1a')]?_0x68e75e['options'][_0x3941('0x1c')]||null:null,'attributes':_0x68e75e[_0x3941('0x1a')]?_0x68e75e[_0x3941('0x1a')][_0x3941('0x1d')]||null:null,'include':_0x68e75e[_0x3941('0x1a')]?_0x68e75e[_0x3941('0x1a')][_0x3941('0x1e')]?_[_0x3941('0x1f')](_0x68e75e[_0x3941('0x1a')]['include'],function(_0x431039){return{'model':db[_0x431039[_0x3941('0x20')]],'as':_0x431039['as'],'attributes':_0x431039['attributes'],'include':_0x431039[_0x3941('0x1e')]?_[_0x3941('0x1f')](_0x431039['include'],function(_0x5b643c){return{'model':db[_0x5b643c[_0x3941('0x20')]],'as':_0x5b643c['as'],'attributes':_0x5b643c[_0x3941('0x1d')],'include':_0x5b643c[_0x3941('0x1e')]?_[_0x3941('0x1f')](_0x5b643c[_0x3941('0x1e')],function(_0x894d4c){return{'model':db[_0x894d4c[_0x3941('0x20')]],'as':_0x894d4c['as'],'attributes':_0x894d4c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x46b44){logger[_0x3941('0xe')](_0x3941('0x17'),_0x68e75e);logger['debug']('ShowSetting',_0x68e75e,JSON['stringify'](_0x46b44));_0x102de0(_0x46b44);})['catch'](function(_0x16fe71){logger[_0x3941('0x13')](_0x3941('0x17'),_0x16fe71[_0x3941('0x15')],_0x68e75e);_0x3239a0(_0x9bdbab[_0x3941('0x13')](0x1f4,_0x16fe71[_0x3941('0x15')]));});});}; \ No newline at end of file +var _0x14f6=['request\x20sent','debug','stringify','error','message','catch','Setting','find','options','raw','where','attributes','map','include','model','ShowSetting','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s'];(function(_0x47741d,_0x1849dc){var _0x46d4fe=function(_0x5a5dfe){while(--_0x5a5dfe){_0x47741d['push'](_0x47741d['shift']());}};_0x46d4fe(++_0x1849dc);}(_0x14f6,0x128));var _0x614f=function(_0x5ec8ac,_0x59d133){_0x5ec8ac=_0x5ec8ac-0x0;var _0x2a7f55=_0x14f6[_0x5ec8ac];return _0x2a7f55;};'use strict';var _=require(_0x614f('0x0'));var util=require(_0x614f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x614f('0x2'));var fs=require('fs');var Redis=require(_0x614f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x614f('0x4'))(_0x614f('0x5'));var config=require(_0x614f('0x6'));var jayson=require(_0x614f('0x7'));var client=jayson['client'][_0x614f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x476325,_0x1b0a92,_0x1c3ccf){return new BPromise(function(_0x20d822,_0x547aa6){return client[_0x614f('0x9')](_0x476325,_0x1c3ccf)['then'](function(_0x1bf5c1){logger[_0x614f('0xa')](_0x614f('0xb'),_0x1b0a92,_0x614f('0xc'));logger[_0x614f('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x1b0a92,'request\x20sent',JSON[_0x614f('0xe')](_0x1bf5c1));if(_0x1bf5c1[_0x614f('0xf')]){if(_0x1bf5c1['error']['code']===0x1f4){logger[_0x614f('0xf')]('Setting,\x20%s,\x20%s',_0x1b0a92,_0x1bf5c1[_0x614f('0xf')][_0x614f('0x10')]);return _0x547aa6(_0x1bf5c1[_0x614f('0xf')][_0x614f('0x10')]);}logger[_0x614f('0xf')](_0x614f('0xb'),_0x1b0a92,_0x1bf5c1[_0x614f('0xf')]['message']);return _0x20d822(_0x1bf5c1['error'][_0x614f('0x10')]);}else{logger[_0x614f('0xa')]('Setting,\x20%s,\x20%s',_0x1b0a92,_0x614f('0xc'));_0x20d822(_0x1bf5c1['result'][_0x614f('0x10')]);}})[_0x614f('0x11')](function(_0x161cb0){logger[_0x614f('0xf')](_0x614f('0xb'),_0x1b0a92,_0x161cb0);_0x547aa6(_0x161cb0);});});}exports['ShowSetting']=function(_0x358f85){var _0x2f4319=this;return new Promise(function(_0x35ab45,_0x5ba56e){return db[_0x614f('0x12')][_0x614f('0x13')]({'raw':_0x358f85[_0x614f('0x14')]?_0x358f85['options'][_0x614f('0x15')]===undefined?!![]:![]:!![],'where':_0x358f85['options']?_0x358f85[_0x614f('0x14')][_0x614f('0x16')]||null:null,'attributes':_0x358f85[_0x614f('0x14')]?_0x358f85[_0x614f('0x14')][_0x614f('0x17')]||null:null,'include':_0x358f85[_0x614f('0x14')]?_0x358f85[_0x614f('0x14')]['include']?_[_0x614f('0x18')](_0x358f85[_0x614f('0x14')][_0x614f('0x19')],function(_0x1711ea){return{'model':db[_0x1711ea['model']],'as':_0x1711ea['as'],'attributes':_0x1711ea['attributes'],'include':_0x1711ea[_0x614f('0x19')]?_[_0x614f('0x18')](_0x1711ea[_0x614f('0x19')],function(_0x8706a3){return{'model':db[_0x8706a3['model']],'as':_0x8706a3['as'],'attributes':_0x8706a3[_0x614f('0x17')],'include':_0x8706a3[_0x614f('0x19')]?_['map'](_0x8706a3[_0x614f('0x19')],function(_0xe0874){return{'model':db[_0xe0874[_0x614f('0x1a')]],'as':_0xe0874['as'],'attributes':_0xe0874[_0x614f('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e5a4b){logger['info']('ShowSetting',_0x358f85);logger[_0x614f('0xd')](_0x614f('0x1b'),_0x358f85,JSON['stringify'](_0x5e5a4b));_0x35ab45(_0x5e5a4b);})['catch'](function(_0x10e767){logger['error'](_0x614f('0x1b'),_0x10e767[_0x614f('0x10')],_0x358f85);_0x5ba56e(_0x2f4319[_0x614f('0xf')](0x1f4,_0x10e767[_0x614f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 54a9189..e647e4d 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 _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x54332e,_0x286092){var _0x44d685=function(_0x17a296){while(--_0x17a296){_0x54332e['push'](_0x54332e['shift']());}};_0x44d685(++_0x286092);}(_0x5fab,0x177));var _0xb5fa=function(_0x54d5c8,_0x344ce5){_0x54d5c8=_0x54d5c8-0x0;var _0x525e2e=_0x5fab[_0x54d5c8];return _0x525e2e;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0xdd31c,_0x484018){var _0x11b6ce=function(_0x178aca){while(--_0x178aca){_0xdd31c['push'](_0xdd31c['shift']());}};_0x11b6ce(++_0x484018);}(_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('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 43bf465..554096b 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 _0xf7d9=['skebby','connectel','clickatell','csc','infobip','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','ENUM','twilio'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xf7d9,0x66));var _0x9f7d=function(_0xf3e9f1,_0x5a3f6f){_0xf3e9f1=_0xf3e9f1-0x0;var _0x13b584=_0xf7d9[_0xf3e9f1];return _0x13b584;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9f7d('0x0'));module[_0x9f7d('0x1')]={'name':{'type':Sequelize[_0x9f7d('0x2')],'unique':_0x9f7d('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x9f7d('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x9f7d('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x9f7d('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9f7d('0x2')]},'type':{'type':Sequelize[_0x9f7d('0x4')](_0x9f7d('0x5'),_0x9f7d('0x6'),_0x9f7d('0x7'),'clicksend','plivo',_0x9f7d('0x8'),'bandwidth',_0x9f7d('0x9'),_0x9f7d('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0x9f7d('0x2')]},'authId':{'type':Sequelize[_0x9f7d('0x2')]},'authToken':{'type':Sequelize[_0x9f7d('0x2')]},'smsMethod':{'type':Sequelize[_0x9f7d('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9f7d('0x2')]},'password':{'type':Sequelize[_0x9f7d('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x9f7d('0x2')]},'accountId':{'type':Sequelize[_0x9f7d('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x9f7d('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9f7d('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9f7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9f7d('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9f7d('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':![],'comment':_0x9f7d('0xf'),'set':function(_0x10ee2d){if(!_0x10ee2d)this[_0x9f7d('0x10')](_0x9f7d('0x11'),null);this['setDataValue']('mandatoryDisposition',_0x10ee2d);}}}; \ No newline at end of file +var _0xb74c=['plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend'];(function(_0x176237,_0x5b8ea6){var _0x355cb6=function(_0x3b89a6){while(--_0x3b89a6){_0x176237['push'](_0x176237['shift']());}};_0x355cb6(++_0x5b8ea6);}(_0xb74c,0x14e));var _0xcb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xcb74('0x0'));var rs=require(_0xcb74('0x1'));module[_0xcb74('0x2')]={'name':{'type':Sequelize[_0xcb74('0x3')],'unique':_0xcb74('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xcb74('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xcb74('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcb74('0x5')]();}},'phone':{'type':Sequelize[_0xcb74('0x3')]},'type':{'type':Sequelize[_0xcb74('0x6')](_0xcb74('0x7'),_0xcb74('0x8'),_0xcb74('0x9'),_0xcb74('0xa'),_0xcb74('0xb'),_0xcb74('0xc'),_0xcb74('0xd'),_0xcb74('0xe'),_0xcb74('0xf'),_0xcb74('0x10'))},'accountSid':{'type':Sequelize[_0xcb74('0x3')]},'authId':{'type':Sequelize[_0xcb74('0x3')]},'authToken':{'type':Sequelize[_0xcb74('0x3')]},'smsMethod':{'type':Sequelize[_0xcb74('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xcb74('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xcb74('0x3')]},'applicationId':{'type':Sequelize[_0xcb74('0x3')]},'accountId':{'type':Sequelize[_0xcb74('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xcb74('0x11')],'defaultValue':![]},'description':{'type':Sequelize[_0xcb74('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcb74('0x12')],'defaultValue':function(){return _0xcb74('0x13');}},'notificationSound':{'type':Sequelize[_0xcb74('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'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[_0xcb74('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb74('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xcb74('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcb74('0x14')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xcb74('0x11')],'defaultValue':![],'comment':_0xcb74('0x15'),'set':function(_0xb6c4de){if(!_0xb6c4de)this[_0xcb74('0x16')]('mandatoryDispositionPauseId',null);this[_0xcb74('0x16')]('mandatoryDisposition',_0xb6c4de);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9b08fcd..2a90dff 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 _0x681b=['no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','text','intelepeer','refid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','startRouting','Start','receiveMessage','entity\x20found','stringify','set','Content-Type','text/xml','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','fullname','internal','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','bandwidth','redif','error_code','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','get','SmsAccounts','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','Sequelize','ValidationError'];(function(_0x2ef740,_0x1c81be){var _0x50214b=function(_0x1b4413){while(--_0x1b4413){_0x2ef740['push'](_0x2ef740['shift']());}};_0x50214b(++_0x1c81be);}(_0x681b,0x6b));var _0xb681=function(_0x1e6a64,_0x1001d5){_0x1e6a64=_0x1e6a64-0x0;var _0x2fc43c=_0x681b[_0x1e6a64];return _0x2fc43c;};'use strict';var emlformat=require(_0xb681('0x0'));var rimraf=require(_0xb681('0x1'));var zipdir=require(_0xb681('0x2'));var jsonpatch=require(_0xb681('0x3'));var rp=require('request-promise');var moment=require(_0xb681('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb681('0x5'));var util=require(_0xb681('0x6'));var path=require(_0xb681('0x7'));var sox=require(_0xb681('0x8'));var csv=require(_0xb681('0x9'));var ejs=require(_0xb681('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb681('0xb'));var squel=require(_0xb681('0xc'));var crypto=require(_0xb681('0xd'));var jsforce=require(_0xb681('0xe'));var deskjs=require(_0xb681('0xf'));var toCsv=require(_0xb681('0x9'));var querystring=require('querystring');var Papa=require(_0xb681('0x10'));var Redis=require(_0xb681('0x11'));var authService=require(_0xb681('0x12'));var qs=require(_0xb681('0x13'));var as=require(_0xb681('0x14'));var hardwareService=require(_0xb681('0x15'));var logger=require(_0xb681('0x16'))(_0xb681('0x17'));var utils=require('../../config/utils');var config=require(_0xb681('0x18'));var licenseUtil=require(_0xb681('0x19'));var db=require(_0xb681('0x1a'))['db'];config[_0xb681('0x1b')]=_[_0xb681('0x1c')](config['redis'],{'host':_0xb681('0x1d'),'port':0x18eb});var socket=require(_0xb681('0x1e'))(new Redis(config[_0xb681('0x1b')]));require('./smsAccount.socket')[_0xb681('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb681('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x509163,_0x28a100,_0x1b697b,_0x3be0b7){return new BPromise(function(_0x41f90e,_0xc90e18){var _0x4339aa=_0x3be0b7||client;return _0x4339aa[_0xb681('0x21')](_0x509163,_0x1b697b)[_0xb681('0x22')](function(_0x422a08){logger[_0xb681('0x23')](_0xb681('0x24'),_0x28a100,'request\x20sent');logger[_0xb681('0x25')](_0xb681('0x26'),_0x28a100,_0xb681('0x27'),JSON['stringify'](_0x422a08));if(_0x422a08[_0xb681('0x28')]){if(_0x422a08['error'][_0xb681('0x29')]===0x1f4){logger[_0xb681('0x28')](_0xb681('0x24'),_0x28a100,_0x422a08[_0xb681('0x28')]['message']);return _0xc90e18(_0x422a08[_0xb681('0x28')][_0xb681('0x2a')]);}logger[_0xb681('0x28')]('SmsAccount,\x20%s,\x20%s',_0x28a100,_0x422a08[_0xb681('0x28')][_0xb681('0x2a')]);return _0x41f90e(_0x422a08[_0xb681('0x28')][_0xb681('0x2a')]);}else{logger[_0xb681('0x23')](_0xb681('0x24'),_0x28a100,_0xb681('0x27'));_0x41f90e(_0x422a08[_0xb681('0x2b')][_0xb681('0x2a')]);}})[_0xb681('0x2c')](function(_0x1b448c){logger[_0xb681('0x28')](_0xb681('0x24'),_0x28a100,_0x1b448c);_0xc90e18(_0x1b448c);});});}function respondWithStatusCode(_0x243c81,_0x4e866b){_0x4e866b=_0x4e866b||0xcc;return function(_0x445db6){if(_0x445db6){return _0x243c81[_0xb681('0x2d')](_0x4e866b);}return _0x243c81[_0xb681('0x2e')](_0x4e866b)[_0xb681('0x2f')]();};}function respondWithResult(_0x2026ad,_0x114cfd){_0x114cfd=_0x114cfd||0xc8;return function(_0x357006){if(_0x357006){return _0x2026ad['status'](_0x114cfd)[_0xb681('0x30')](_0x357006);}};}function respondWithFilteredResult(_0x37b715,_0x2b11d7){return function(_0x4d3bf3){if(_0x4d3bf3){var _0x290817=typeof _0x2b11d7[_0xb681('0x31')]==='undefined'&&typeof _0x2b11d7[_0xb681('0x32')]===_0xb681('0x33');var _0x40f4df=_0x4d3bf3[_0xb681('0x34')];var _0x37897d=_0x290817?0x0:_0x2b11d7[_0xb681('0x31')];var _0x39ecf0=_0x290817?_0x4d3bf3['count']:_0x2b11d7[_0xb681('0x31')]+_0x2b11d7['limit'];var _0x248b03;if(_0x39ecf0>=_0x40f4df){_0x39ecf0=_0x40f4df;_0x248b03=0xc8;}else{_0x248b03=0xce;}_0x37b715[_0xb681('0x2e')](_0x248b03);return _0x37b715['set'](_0xb681('0x35'),_0x37897d+'-'+_0x39ecf0+'/'+_0x40f4df)['json'](_0x4d3bf3);}return null;};}function patchUpdates(_0x223d4f){return function(_0x280dc6){try{jsonpatch[_0xb681('0x36')](_0x280dc6,_0x223d4f,!![]);}catch(_0x4603f6){return BPromise[_0xb681('0x37')](_0x4603f6);}return _0x280dc6['save']();};}function saveUpdates(_0x1820c8,_0x3cab01){return function(_0x209573){if(_0x209573){return _0x209573['update'](_0x1820c8)[_0xb681('0x22')](function(_0x272796){return _0x272796;});}return null;};}function removeEntity(_0x2e42d3,_0x41ee80){return function(_0x3c4e68){if(_0x3c4e68){return _0x3c4e68['destroy']()['then'](function(){var _0x9bb0db=_0x3c4e68[_0xb681('0x38')]({'plain':!![]});var _0x205ec7=_0xb681('0x39');return db[_0xb681('0x3a')][_0xb681('0x3b')]({'where':{'type':_0x205ec7,'resourceId':_0x9bb0db['id']}})['then'](function(){return _0x3c4e68;});})[_0xb681('0x22')](function(){_0x2e42d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2afc39,_0x38461d){return function(_0x4e526f){if(!_0x4e526f){_0x2afc39[_0xb681('0x2d')](0x194);}return _0x4e526f;};}function handleError(_0x30092d,_0x3a82a8){_0x3a82a8=_0x3a82a8||0x1f4;return function(_0x3c9d25){logger[_0xb681('0x28')](_0x3c9d25['stack']);if(_0x3c9d25[_0xb681('0x3c')]){delete _0x3c9d25[_0xb681('0x3c')];}_0x30092d[_0xb681('0x2e')](_0x3a82a8)[_0xb681('0x3d')](_0x3c9d25);};}exports['index']=function(_0x108fd9,_0x10f735){var _0x3c213a={'include':[{'model':db[_0xb681('0x3e')],'as':_0xb681('0x3f')}]},_0x545915={},_0x1d5730={'count':0x0,'rows':[]};var _0x40de8d=_['map'](db[_0xb681('0x40')][_0xb681('0x41')],function(_0x240213){return{'name':_0x240213[_0xb681('0x42')],'type':_0x240213[_0xb681('0x43')][_0xb681('0x44')]};});_0x545915[_0xb681('0x45')]=_[_0xb681('0x46')](_0x40de8d,_0xb681('0x3c'));_0x545915[_0xb681('0x47')]=_[_0xb681('0x48')](_0x108fd9[_0xb681('0x47')]);_0x545915[_0xb681('0x49')]=_['intersection'](_0x545915[_0xb681('0x45')],_0x545915[_0xb681('0x47')]);_0x3c213a[_0xb681('0x4a')]=_['intersection'](_0x545915['model'],qs[_0xb681('0x4b')](_0x108fd9[_0xb681('0x47')]['fields']));_0x3c213a[_0xb681('0x4a')]=_0x3c213a[_0xb681('0x4a')][_0xb681('0x4c')]?_0x3c213a['attributes']:_0x545915['model'];if(!_0x108fd9[_0xb681('0x47')]['hasOwnProperty'](_0xb681('0x4d'))){_0x3c213a[_0xb681('0x32')]=qs['limit'](_0x108fd9['query'][_0xb681('0x32')]);_0x3c213a[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x108fd9[_0xb681('0x47')][_0xb681('0x31')]);}_0x3c213a[_0xb681('0x4e')]=qs[_0xb681('0x4f')](_0x108fd9['query'][_0xb681('0x4f')]);_0x3c213a[_0xb681('0x50')]=qs[_0xb681('0x49')](_[_0xb681('0x51')](_0x108fd9[_0xb681('0x47')],_0x545915[_0xb681('0x49')]),_0x40de8d);if(_0x108fd9[_0xb681('0x47')][_0xb681('0x52')]){_0x3c213a[_0xb681('0x50')]=_[_0xb681('0x53')](_0x3c213a[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x40de8d,function(_0x11475f){if(_0x11475f[_0xb681('0x43')]!==_0xb681('0x54')){var _0x416d53={};_0x416d53[_0x11475f[_0xb681('0x3c')]]={'$like':'%'+_0x108fd9['query'][_0xb681('0x52')]+'%'};return _0x416d53;}})});}_0x3c213a=_[_0xb681('0x53')]({},_0x3c213a,_0x108fd9['options']);var _0x20eac1={'where':_0x3c213a['where']};return db[_0xb681('0x40')][_0xb681('0x34')](_0x20eac1)[_0xb681('0x22')](function(_0x1d62c4){_0x1d5730[_0xb681('0x34')]=_0x1d62c4;if(_0x108fd9[_0xb681('0x47')][_0xb681('0x55')]){_0x3c213a[_0xb681('0x56')]=[{'all':!![]}];}return db['SmsAccount'][_0xb681('0x57')](_0x3c213a);})[_0xb681('0x22')](function(_0x166185){_0x1d5730[_0xb681('0x58')]=_0x166185;return _0x1d5730;})[_0xb681('0x22')](respondWithFilteredResult(_0x10f735,_0x3c213a))['catch'](handleError(_0x10f735,null));};exports[_0xb681('0x59')]=function(_0x23913d,_0x324ffe){var _0x38e9aa={'raw':![],'where':{'id':_0x23913d[_0xb681('0x5a')]['id']},'include':[{'model':db[_0xb681('0x3e')],'as':_0xb681('0x3f')}]},_0x2cc525={};_0x2cc525[_0xb681('0x45')]=_[_0xb681('0x48')](db[_0xb681('0x40')][_0xb681('0x41')]);_0x2cc525[_0xb681('0x47')]=_[_0xb681('0x48')](_0x23913d['query']);_0x2cc525[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x2cc525['model'],_0x2cc525[_0xb681('0x47')]);_0x38e9aa[_0xb681('0x4a')]=_[_0xb681('0x5b')](_0x2cc525[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x23913d[_0xb681('0x47')][_0xb681('0x4b')]));_0x38e9aa[_0xb681('0x4a')]=_0x38e9aa[_0xb681('0x4a')][_0xb681('0x4c')]?_0x38e9aa['attributes']:_0x2cc525[_0xb681('0x45')];if(_0x23913d[_0xb681('0x47')][_0xb681('0x55')]){_0x38e9aa[_0xb681('0x56')]=[{'all':!![]}];}_0x38e9aa=_[_0xb681('0x53')]({},_0x38e9aa,_0x23913d[_0xb681('0x5c')]);return db[_0xb681('0x40')]['find'](_0x38e9aa)[_0xb681('0x22')](handleEntityNotFound(_0x324ffe,null))[_0xb681('0x22')](respondWithResult(_0x324ffe,null))[_0xb681('0x2c')](handleError(_0x324ffe,null));};exports['create']=function(_0x4b1d9c,_0x15fe4e){return db[_0xb681('0x40')][_0xb681('0x5d')](_0x4b1d9c[_0xb681('0x5e')],{})[_0xb681('0x22')](function(_0x136987){var _0x4ecb2e=_0x4b1d9c[_0xb681('0x5f')][_0xb681('0x38')]({'plain':!![]});if(!_0x4ecb2e)throw new Error(_0xb681('0x60'));if(_0x4ecb2e[_0xb681('0x61')]===_0xb681('0x5f')){var _0x4ac6cc=_0x136987['get']({'plain':!![]});var _0x1e4483=_0xb681('0x39');return db[_0xb681('0x62')][_0xb681('0x63')]({'where':{'name':_0x1e4483,'userProfileId':_0x4ecb2e[_0xb681('0x64')]},'raw':!![]})[_0xb681('0x22')](function(_0x46ecb2){if(_0x46ecb2&&_0x46ecb2[_0xb681('0x65')]===0x0){return db[_0xb681('0x3a')][_0xb681('0x5d')]({'name':_0x4ac6cc[_0xb681('0x3c')],'resourceId':_0x4ac6cc['id'],'type':_0x46ecb2[_0xb681('0x3c')],'sectionId':_0x46ecb2['id']},{})[_0xb681('0x22')](function(){return _0x136987;});}else{return _0x136987;}})[_0xb681('0x2c')](function(_0x5d19ee){logger[_0xb681('0x28')](_0xb681('0x66'),_0x5d19ee);throw _0x5d19ee;});}return _0x136987;})[_0xb681('0x22')](respondWithResult(_0x15fe4e,0xc9))['catch'](handleError(_0x15fe4e,null));};exports[_0xb681('0x67')]=function(_0x28c735,_0x34fc65){if(_0x28c735['body']['id']){delete _0x28c735[_0xb681('0x5e')]['id'];}return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x28c735[_0xb681('0x5a')]['id']},'include':[{'model':db[_0xb681('0x3e')],'as':_0xb681('0x3f')}]})[_0xb681('0x22')](handleEntityNotFound(_0x34fc65,null))[_0xb681('0x22')](saveUpdates(_0x28c735[_0xb681('0x5e')],null))[_0xb681('0x22')](respondWithResult(_0x34fc65,null))[_0xb681('0x2c')](handleError(_0x34fc65,null));};exports[_0xb681('0x3b')]=function(_0x31fa32,_0x2eb342){return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x31fa32[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x2eb342,null))[_0xb681('0x22')](removeEntity(_0x2eb342,null))[_0xb681('0x2c')](handleError(_0x2eb342,null));};exports['describe']=function(_0x592d54,_0x3232bb){return db[_0xb681('0x40')][_0xb681('0x68')]()[_0xb681('0x22')](respondWithResult(_0x3232bb,null))['catch'](handleError(_0x3232bb,null));};exports[_0xb681('0x69')]=function(_0x478de9,_0x2ec566,_0x423a5d){if(_0x478de9[_0xb681('0x5e')]['id']){delete _0x478de9[_0xb681('0x5e')]['id'];}return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x478de9[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x2ec566,null))[_0xb681('0x22')](function(_0x38c8b8){if(_0x38c8b8){_0x478de9[_0xb681('0x5e')][_0xb681('0x6a')]=_0x38c8b8['id'];return db[_0xb681('0x6b')][_0xb681('0x5d')](_0x478de9[_0xb681('0x5e')]);}})[_0xb681('0x22')](respondWithResult(_0x2ec566,null))[_0xb681('0x2c')](handleError(_0x2ec566,null));};exports[_0xb681('0x6c')]=function(_0x52000f,_0x5e6b1a,_0x33acbb){var _0x122046={'raw':![],'where':{}};var _0x8ab275={};var _0x33d07c={'count':0x0,'rows':[]};return db[_0xb681('0x40')]['findOne']({'where':{'id':_0x52000f[_0xb681('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5e6b1a,null))['then'](function(_0x5415cb){if(_0x5415cb){_0x8ab275[_0xb681('0x45')]=_['keys'](db[_0xb681('0x6b')][_0xb681('0x41')]);_0x8ab275[_0xb681('0x47')]=_['keys'](_0x52000f['query']);_0x8ab275[_0xb681('0x49')]=_['intersection'](_0x8ab275[_0xb681('0x45')],_0x8ab275[_0xb681('0x47')]);_0x122046[_0xb681('0x4a')]=_['intersection'](_0x8ab275[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x52000f[_0xb681('0x47')][_0xb681('0x4b')]));_0x122046['attributes']=_0x122046['attributes'][_0xb681('0x4c')]?_0x122046[_0xb681('0x4a')]:_0x8ab275[_0xb681('0x45')];if(!_0x52000f['query'][_0xb681('0x6d')](_0xb681('0x4d'))){_0x122046[_0xb681('0x32')]=qs['limit'](_0x52000f[_0xb681('0x47')][_0xb681('0x32')]);_0x122046[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x52000f[_0xb681('0x47')][_0xb681('0x31')]);}_0x122046['order']=qs[_0xb681('0x4f')](_0x52000f[_0xb681('0x47')][_0xb681('0x4f')]);_0x122046['where']=qs['filters'](_[_0xb681('0x51')](_0x52000f['query'],_0x8ab275[_0xb681('0x49')]));_0x122046[_0xb681('0x50')][_0xb681('0x6a')]=_0x5415cb['id'];if(_0x52000f[_0xb681('0x47')][_0xb681('0x52')]){_0x122046[_0xb681('0x50')]=_[_0xb681('0x53')](_0x122046[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x122046['attributes'],function(_0x3da1fd){var _0x5697f3={};_0x5697f3[_0x3da1fd]={'$like':'%'+_0x52000f[_0xb681('0x47')][_0xb681('0x52')]+'%'};return _0x5697f3;})});}_0x122046=_[_0xb681('0x53')]({},_0x122046,_0x52000f[_0xb681('0x5c')]);return db[_0xb681('0x6b')]['count']({'where':_0x122046[_0xb681('0x50')]})[_0xb681('0x22')](function(_0x1efba8){_0x33d07c[_0xb681('0x34')]=_0x1efba8;if(_0x52000f['query'][_0xb681('0x55')]){_0x122046['include']=[{'all':!![]}];}return db[_0xb681('0x6b')][_0xb681('0x57')](_0x122046);})['then'](function(_0x17172f){_0x33d07c['rows']=_0x17172f;return _0x33d07c;});}})[_0xb681('0x22')](respondWithFilteredResult(_0x5e6b1a,_0x122046))[_0xb681('0x2c')](handleError(_0x5e6b1a,null));};exports[_0xb681('0x6e')]=function(_0x4d36d1,_0x2be5c1,_0x434bf2){return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x4d36d1[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x2be5c1,null))[_0xb681('0x22')](function(_0x30c2e5){if(_0x30c2e5){return _0x30c2e5[_0xb681('0x6e')](_0x4d36d1[_0xb681('0x47')][_0xb681('0x6f')]);}})[_0xb681('0x22')](respondWithStatusCode(_0x2be5c1,null))[_0xb681('0x2c')](handleError(_0x2be5c1,null));};exports[_0xb681('0x70')]=function(_0x3bf323,_0x4b9a9e,_0x4e8caf){if(_0x3bf323[_0xb681('0x5e')]['id']){delete _0x3bf323[_0xb681('0x5e')]['id'];}return db['SmsAccount'][_0xb681('0x63')]({'where':{'id':_0x3bf323[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x4b9a9e,null))[_0xb681('0x22')](function(_0x2aed49){if(_0x2aed49){_0x3bf323[_0xb681('0x5e')][_0xb681('0x6a')]=_0x2aed49['id'];return db['CannedAnswer'][_0xb681('0x5d')](_0x3bf323['body']);}})[_0xb681('0x22')](respondWithResult(_0x4b9a9e,null))[_0xb681('0x2c')](handleError(_0x4b9a9e,null));};exports[_0xb681('0x71')]=function(_0x2fa0c4,_0x3d53dc,_0x4d53bf){var _0x30f146={'raw':![],'where':{}};var _0x43d0a7={};var _0x2821ba={'count':0x0,'rows':[]};return db[_0xb681('0x40')][_0xb681('0x72')]({'where':{'id':_0x2fa0c4[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x3d53dc,null))['then'](function(_0x2b3249){if(_0x2b3249){_0x43d0a7['model']=_[_0xb681('0x48')](db['CannedAnswer']['rawAttributes']);_0x43d0a7[_0xb681('0x47')]=_[_0xb681('0x48')](_0x2fa0c4[_0xb681('0x47')]);_0x43d0a7[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x43d0a7[_0xb681('0x45')],_0x43d0a7['query']);_0x30f146['attributes']=_[_0xb681('0x5b')](_0x43d0a7[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x2fa0c4[_0xb681('0x47')][_0xb681('0x4b')]));_0x30f146['attributes']=_0x30f146[_0xb681('0x4a')][_0xb681('0x4c')]?_0x30f146['attributes']:_0x43d0a7[_0xb681('0x45')];if(!_0x2fa0c4[_0xb681('0x47')][_0xb681('0x6d')]('nolimit')){_0x30f146[_0xb681('0x32')]=qs[_0xb681('0x32')](_0x2fa0c4['query']['limit']);_0x30f146[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x2fa0c4[_0xb681('0x47')][_0xb681('0x31')]);}_0x30f146['order']=qs[_0xb681('0x4f')](_0x2fa0c4[_0xb681('0x47')][_0xb681('0x4f')]);_0x30f146[_0xb681('0x50')]=qs['filters'](_[_0xb681('0x51')](_0x2fa0c4[_0xb681('0x47')],_0x43d0a7['filters']));_0x30f146[_0xb681('0x50')][_0xb681('0x6a')]=_0x2b3249['id'];if(_0x2fa0c4[_0xb681('0x47')]['filter']){_0x30f146[_0xb681('0x50')]=_[_0xb681('0x53')](_0x30f146[_0xb681('0x50')],{'$or':_['map'](_0x30f146['attributes'],function(_0x11c34c){var _0x270bd9={};_0x270bd9[_0x11c34c]={'$like':'%'+_0x2fa0c4[_0xb681('0x47')][_0xb681('0x52')]+'%'};return _0x270bd9;})});}_0x30f146=_[_0xb681('0x53')]({},_0x30f146,_0x2fa0c4['options']);return db[_0xb681('0x73')][_0xb681('0x34')]({'where':_0x30f146[_0xb681('0x50')]})[_0xb681('0x22')](function(_0x298de3){_0x2821ba[_0xb681('0x34')]=_0x298de3;if(_0x2fa0c4['query']['includeAll']){_0x30f146[_0xb681('0x56')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x30f146);})[_0xb681('0x22')](function(_0x1dbb77){_0x2821ba[_0xb681('0x58')]=_0x1dbb77;return _0x2821ba;});}})['then'](respondWithFilteredResult(_0x3d53dc,_0x30f146))[_0xb681('0x2c')](handleError(_0x3d53dc,null));};exports[_0xb681('0x74')]=function(_0x162ed8,_0x38bd11,_0x879b7d){return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x162ed8['params']['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x38bd11,null))[_0xb681('0x22')](function(_0x1b07a6){if(_0x1b07a6){return _0x1b07a6[_0xb681('0x74')](_0x162ed8[_0xb681('0x47')][_0xb681('0x6f')]);}})[_0xb681('0x22')](respondWithStatusCode(_0x38bd11,null))[_0xb681('0x2c')](handleError(_0x38bd11,null));};exports['notify']=function(_0x42ee57,_0x432860,_0x1129ea){var _0x434275={'channel':_0xb681('0x75')};var _0x25f260=[];var _0x30719d=[];var _0x38ffcb={};return db['SmsAccount'][_0xb681('0x63')]({'where':{'id':_0x42ee57['params']['id']},'include':[{'model':db[_0xb681('0x76')],'as':'Applications'}]})[_0xb681('0x22')](handleEntityNotFound(_0x432860,null))[_0xb681('0x22')](function(_0x438546){_0x434275[_0xb681('0x77')]=_0x438546;_0x434275[_0xb681('0x78')]=_[_0xb681('0x79')](_0x438546[_0xb681('0x7a')],[_0xb681('0x7b')],[_0xb681('0x7c')]);if(_0x434275[_0xb681('0x77')][_0xb681('0x7a')]){delete _0x434275[_0xb681('0x77')][_0xb681('0x7a')];}return db['CmContact'][_0xb681('0x68')]();})[_0xb681('0x22')](function(_0x1b4dd2){if(!_0x1b4dd2){throw new db[(_0xb681('0x7d'))][(_0xb681('0x7e'))](_0xb681('0x7f'));}_0x25f260=_[_0xb681('0x80')](_[_0xb681('0x48')](_0x1b4dd2),[_0xb681('0x81'),_0xb681('0x82')]);_0x30719d=_[_0xb681('0x80')](_[_0xb681('0x48')](_0x1b4dd2),[_0xb681('0x81'),_0xb681('0x82'),_0xb681('0x83'),_0xb681('0x84')]);_0x434275[_0xb681('0x5e')]={'mapKey':_0xb681('0x85')};if(_0x434275[_0xb681('0x77')][_0xb681('0x43')]){switch(_0x434275[_0xb681('0x77')][_0xb681('0x43')]){case _0xb681('0x86'):_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x88')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57['body']['Body'];_0x434275[_0xb681('0x5e')][_0xb681('0x89')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x8a')];break;case _0xb681('0x8b'):_0x434275[_0xb681('0x5e')]['from']='+'+_0x42ee57['body'][_0xb681('0x8c')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57['body']['text'];break;case _0xb681('0x8d'):_0x434275[_0xb681('0x5e')]['from']=_0x42ee57[_0xb681('0x5e')]['from'];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x2a')];break;case _0xb681('0x8e'):_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')]['from'];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57[_0xb681('0x5e')]['body'];_0x434275[_0xb681('0x5e')]['messageId']=_0x42ee57[_0xb681('0x5e')][_0xb681('0x8f')];break;case _0xb681('0x90'):_0x434275['body'][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x88')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57['body'][_0xb681('0x91')];_0x434275[_0xb681('0x5e')][_0xb681('0x89')]=_0x42ee57['body'][_0xb681('0x92')];break;case'infobip':_0x434275['body'][_0xb681('0x87')]='+'+_0x42ee57[_0xb681('0x5e')][_0xb681('0x93')][0x0][_0xb681('0x87')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x93')][0x0]['text'];_0x434275[_0xb681('0x5e')]['messageId']=_0x42ee57[_0xb681('0x5e')][_0xb681('0x93')][0x0][_0xb681('0x89')];break;case _0xb681('0x94'):_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x95')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57['body']['segmentedMessage'][_0xb681('0x2a')];break;case _0xb681('0x96'):_0x434275['body']['from']=_0x42ee57[_0xb681('0x5e')][_0xb681('0x97')];_0x434275['body']['body']=_0x42ee57[_0xb681('0x5e')]['text'];_0x434275['body']['messageId']=_0x42ee57[_0xb681('0x5e')]['replyMessageId'];break;case'bandwidth':_0x434275[_0xb681('0x5e')][_0xb681('0x89')]=_0x42ee57[_0xb681('0x5e')][0x0][_0xb681('0x2a')]['id'];_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][0x0][_0xb681('0x2a')][_0xb681('0x87')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57[_0xb681('0x5e')][0x0][_0xb681('0x2a')][_0xb681('0x98')];break;case _0xb681('0x99'):_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x87')];_0x434275[_0xb681('0x5e')]['body']=_0x42ee57['body'][_0xb681('0x2a')];_0x434275['body'][_0xb681('0x89')]=_0x42ee57['body'][_0xb681('0x9a')];break;}}if(_0x434275[_0xb681('0x5e')]['id']){delete _0x434275['body']['id'];}if(_['isNil'](_0x434275[_0xb681('0x5e')][_0xb681('0x87')])){throw new db['Sequelize'][(_0xb681('0x7e'))](_0xb681('0x9b'));}if(_['isNil'](_0x434275[_0xb681('0x5e')]['body'])||_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]===''){throw new db[(_0xb681('0x7d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb681('0x9c')](_0x434275[_0xb681('0x5e')][_0xb681('0x9d')])){throw new db[(_0xb681('0x7d'))][(_0xb681('0x7e'))](_0xb681('0x9e')+_0x30719d);}if(!_[_0xb681('0x9f')](_0x30719d,_0x434275[_0xb681('0x5e')][_0xb681('0x9d')])){throw new db[(_0xb681('0x7d'))][(_0xb681('0x7e'))](_0xb681('0xa0')+_0x30719d);}_0x38ffcb[_0x434275[_0xb681('0x5e')][_0xb681('0x9d')]]=_0x434275['body'][_0xb681('0x87')];return db[_0xb681('0xa1')]['find']({'where':{'id':_0x434275['account'][_0xb681('0x84')]},'include':[{'model':db[_0xb681('0xa2')],'as':_0xb681('0xa3'),'where':_0x38ffcb,'limit':0x1,'order':[[_0xb681('0x82'),'DESC']]}]});})[_0xb681('0x22')](handleEntityNotFound(_0x432860,null))[_0xb681('0x22')](function(_0x463e54){if(_0x463e54){_0x434275[_0xb681('0xa4')]=_['omit'](_0x463e54,[_0xb681('0xa3')]);if(_0x463e54['Contacts'][_0xb681('0x4c')]){return _0x463e54[_0xb681('0xa3')][0x0];}var _0x5c352d=_['defaults'](_0x434275['body'],{'firstName':_0x434275['body'][_0xb681('0x87')],'ListId':_0x463e54['id']});_0x5c352d[_0x434275[_0xb681('0x5e')][_0xb681('0x9d')]]=_0x434275[_0xb681('0x5e')][_0xb681('0x87')];return db[_0xb681('0xa2')]['create'](_0x5c352d,{'fields':_0x25f260,'raw':!![]});}})[_0xb681('0x22')](handleEntityNotFound(_0x432860,null))[_0xb681('0x22')](function(_0x4fcace){if(_0x4fcace){_0x434275[_0xb681('0xa5')]=_0x4fcace;var _0x47e652={'ContactId':_0x4fcace['id'],'phone':_0x434275[_0xb681('0x5e')][_0xb681('0x87')],'SmsAccountId':_0x42ee57[_0xb681('0x5a')]['id']};var _0x4163b3={'ContactId':_0x4fcace['id'],'SmsAccountId':_0x42ee57['params']['id'],'closed':![]};return db[_0xb681('0xa6')][_0xb681('0x63')]({'where':_0x4163b3})[_0xb681('0x22')](function(_0x2cb638){if(_0x2cb638){return[_0x2cb638,![]];}return db['SmsInteraction']['create'](_0x47e652)['then'](function(_0x358ebc){return[_0x358ebc,!![]];});});}})[_0xb681('0xa7')](function(_0xfbea99,_0x467c74){_0x434275[_0xb681('0xa8')]=_0xfbea99[_0xb681('0x38')]({'plain':!![]});_0x434275[_0xb681('0xa8')][_0xb681('0xa9')]=![];if(_0x467c74){if(_0x434275[_0xb681('0x77')]['autoclose']){_0x434275['applications']['push']({'id':0x0,'priority':_0x434275[_0xb681('0x78')]['length']+0x1,'app':_0xb681('0xaa'),'appdata':_0xb681('0xab'),'interval':_0xb681('0xac')});}_0x434275[_0xb681('0xa8')][_0xb681('0xa9')]=!![];}return db['SmsMessage'][_0xb681('0x5d')]({'phone':_0x434275[_0xb681('0x5e')][_0xb681('0x87')],'messageId':_0x434275['body']['messageId'],'body':_0x434275[_0xb681('0x5e')][_0xb681('0x5e')],'SmsAccountId':_0x42ee57[_0xb681('0x5a')]['id'],'SmsInteractionId':_0xfbea99['id'],'direction':'in','ContactId':_0xfbea99['ContactId'],'AttachmentId':_0x434275[_0xb681('0x5e')][_0xb681('0xad')]});})[_0xb681('0x22')](function(_0x35571c){_0x434275[_0xb681('0x2a')]=_0x35571c;if(_0x434275['interaction']['UserId']){return db[_0xb681('0xae')]['find']({'attributes':['id',_0xb681('0x3c')],'where':{'id':_0x434275[_0xb681('0xa8')][_0xb681('0xaf')]}})['then'](function(_0x1d53fa){if(_0x1d53fa){_0x434275[_0xb681('0x78')][_0xb681('0xb0')]({'id':0x0,'priority':0x0,'app':_0xb681('0xb1'),'appdata':_0x1d53fa[_0xb681('0x3c')]+','+(_0x434275[_0xb681('0x77')]['waitForTheAssignedAgent']||0xa),'interval':_0xb681('0xac')});}return respondWithRpcPromise('Start',_0xb681('0xb2'),_0x434275);});}return respondWithRpcPromise(_0xb681('0xb3'),_0xb681('0xb2'),_0x434275);})['then'](function(_0x2321a7){if(_0x2321a7){var _0x1d0d66=0xc8;var _0x101003=_0xb681('0xb4');logger[_0xb681('0x23')](_0xb681('0x26'),_0x101003,_0x1d0d66,_0xb681('0xb5'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x101003,_0x1d0d66,_0xb681('0xb5'),JSON[_0xb681('0xb6')](_0x2321a7));if(_0x434275[_0xb681('0x77')][_0xb681('0x43')]===_0xb681('0x86')){return _0x432860[_0xb681('0x2e')](_0x1d0d66)[_0xb681('0xb7')](_0xb681('0xb8'),_0xb681('0xb9'))['send']('\x0a');}else{return _0x432860[_0xb681('0x2e')](_0x1d0d66)[_0xb681('0x30')](_0x2321a7);}}})['catch'](handleError(_0x432860,null));};exports[_0xb681('0xba')]=function(_0x1052a9,_0x28d868){var _0x48d15d=_0x1052a9[_0xb681('0x5a')]['id'];var _0x2a7974=_0x1052a9[_0xb681('0x5e')];var _0x509670=0xc8;var _0x397c74=null;return db[_0xb681('0xbb')][_0xb681('0xbc')]({'isolationLevel':db[_0xb681('0xbb')]['Transaction'][_0xb681('0xbd')]['READ_COMMITTED']},function(_0x57536c){return db[_0xb681('0x40')]['findOne']({'where':{'id':_0x48d15d},'transaction':_0x57536c})['then'](function(_0x211822){if(_0x211822){return db[_0xb681('0x76')][_0xb681('0x3b')]({'where':{'SmsAccountId':_0x48d15d},'transaction':_0x57536c})['then'](function(){var _0x3d4d8f=_[_0xb681('0x46')](_0x2a7974,function(_0xd91a39){_0xd91a39['SmsAccountId']=_0x48d15d;return _0xd91a39;});return db['SmsApplication'][_0xb681('0xbe')](_0x3d4d8f,{'transaction':_0x57536c});});}else{_0x509670=0x194;_0x397c74=[];}});})[_0xb681('0x22')](function(){if(_0x509670!==0x194){return db[_0xb681('0x76')][_0xb681('0xbf')]({'where':{'SmsAccountId':_0x48d15d},'order':_0xb681('0x7b')})[_0xb681('0x22')](function(_0x4d819e){_0x397c74=_0x4d819e;});}})[_0xb681('0x2c')](function(_0x51a3fa){_0x509670=0x1f4;logger[_0xb681('0x28')](_0x51a3fa[_0xb681('0xc0')]);if(_0x51a3fa['name']){delete _0x51a3fa[_0xb681('0x3c')];}_0x397c74=_0x51a3fa;})['finally'](function(){if(_0x397c74===null){_0x28d868[_0xb681('0x2d')](_0x509670);}else{if(_0x509670===0x1f4){_0x28d868[_0xb681('0x2e')](_0x509670)['send'](_0x397c74);}else{_0x28d868[_0xb681('0x2e')](_0x509670)[_0xb681('0x30')](_0x397c74);}}});};exports[_0xb681('0xc1')]=function(_0x3b65f5,_0x3c783e,_0x402432){var _0x10bee4={};var _0x51456a={};var _0x5877b8;var _0x4d1bdc;return db['SmsAccount'][_0xb681('0x72')]({'where':{'id':_0x3b65f5[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x3c783e,null))['then'](function(_0x2fb438){if(_0x2fb438){_0x5877b8=_0x2fb438;_0x51456a[_0xb681('0x45')]=_['keys'](db[_0xb681('0x76')][_0xb681('0x41')]);_0x51456a[_0xb681('0x47')]=_[_0xb681('0x48')](_0x3b65f5[_0xb681('0x47')]);_0x51456a[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x51456a[_0xb681('0x45')],_0x51456a[_0xb681('0x47')]);_0x10bee4['attributes']=_[_0xb681('0x5b')](_0x51456a[_0xb681('0x45')],qs['fields'](_0x3b65f5['query'][_0xb681('0x4b')]));_0x10bee4[_0xb681('0x4a')]=_0x10bee4[_0xb681('0x4a')]['length']?_0x10bee4[_0xb681('0x4a')]:_0x51456a['model'];_0x10bee4[_0xb681('0x4e')]=qs[_0xb681('0x4f')](_0x3b65f5[_0xb681('0x47')][_0xb681('0x4f')]);_0x10bee4['where']=qs[_0xb681('0x49')](_['pick'](_0x3b65f5[_0xb681('0x47')],_0x51456a['filters']));if(_0x3b65f5[_0xb681('0x47')][_0xb681('0x52')]){_0x10bee4[_0xb681('0x50')]=_[_0xb681('0x53')](_0x10bee4[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x10bee4['attributes'],function(_0x286bd0){var _0x54439d={};_0x54439d[_0x286bd0]={'$like':'%'+_0x3b65f5[_0xb681('0x47')][_0xb681('0x52')]+'%'};return _0x54439d;})});}_0x10bee4=_[_0xb681('0x53')]({},_0x10bee4,_0x3b65f5[_0xb681('0x5c')]);return _0x5877b8[_0xb681('0xc1')](_0x10bee4);}})[_0xb681('0x22')](function(_0x4dc190){if(_0x4dc190){_0x4d1bdc=_0x4dc190['length'];if(!_0x3b65f5['query'][_0xb681('0x6d')](_0xb681('0x4d'))){_0x10bee4[_0xb681('0x32')]=qs[_0xb681('0x32')](_0x3b65f5[_0xb681('0x47')]['limit']);_0x10bee4[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x3b65f5[_0xb681('0x47')][_0xb681('0x31')]);}return _0x5877b8[_0xb681('0xc1')](_0x10bee4);}})[_0xb681('0x22')](function(_0x4bf48b){if(_0x4bf48b){return _0x4bf48b?{'count':_0x4d1bdc,'rows':_0x4bf48b}:null;}})[_0xb681('0x22')](respondWithResult(_0x3c783e,null))[_0xb681('0x2c')](handleError(_0x3c783e,null));};exports[_0xb681('0xc2')]=function(_0x32c5ad,_0x585429,_0x555423){var _0x3bb675={'raw':![],'where':{}};var _0x18cf6e={};var _0x2d2ce8={'count':0x0,'rows':[]};return db[_0xb681('0x40')][_0xb681('0x72')]({'where':{'id':_0x32c5ad[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x585429,null))[_0xb681('0x22')](function(_0x3fa6a1){if(_0x3fa6a1){_0x18cf6e[_0xb681('0x45')]=_[_0xb681('0x48')](db[_0xb681('0xa6')][_0xb681('0x41')]);_0x18cf6e['query']=_[_0xb681('0x48')](_0x32c5ad[_0xb681('0x47')]);_0x18cf6e[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x18cf6e[_0xb681('0x45')],_0x18cf6e[_0xb681('0x47')]);_0x3bb675[_0xb681('0x4a')]=_[_0xb681('0x5b')](_0x18cf6e[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x32c5ad[_0xb681('0x47')][_0xb681('0x4b')]));_0x3bb675[_0xb681('0x4a')]=_0x3bb675['attributes']['length']?_0x3bb675['attributes']:_0x18cf6e[_0xb681('0x45')];if(!_0x32c5ad[_0xb681('0x47')][_0xb681('0x6d')](_0xb681('0x4d'))){_0x3bb675[_0xb681('0x32')]=qs[_0xb681('0x32')](_0x32c5ad[_0xb681('0x47')]['limit']);_0x3bb675[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x32c5ad[_0xb681('0x47')][_0xb681('0x31')]);}_0x3bb675['order']=qs[_0xb681('0x4f')](_0x32c5ad[_0xb681('0x47')][_0xb681('0x4f')]);_0x3bb675[_0xb681('0x50')]=qs['filters'](_[_0xb681('0x51')](_0x32c5ad[_0xb681('0x47')],_0x18cf6e[_0xb681('0x49')]));_0x3bb675['where'][_0xb681('0x6a')]=_0x3fa6a1['id'];if(_0x32c5ad[_0xb681('0x47')][_0xb681('0x52')]){_0x3bb675[_0xb681('0x50')]=_[_0xb681('0x53')](_0x3bb675[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x3bb675[_0xb681('0x4a')],function(_0x48fc4c){var _0x399b7f={};_0x399b7f[_0x48fc4c]={'$like':'%'+_0x32c5ad[_0xb681('0x47')]['filter']+'%'};return _0x399b7f;})});}_0x3bb675=_[_0xb681('0x53')]({},_0x3bb675,_0x32c5ad[_0xb681('0x5c')]);return db[_0xb681('0xa6')][_0xb681('0x34')]({'where':_0x3bb675[_0xb681('0x50')]})['then'](function(_0x556893){_0x2d2ce8['count']=_0x556893;if(_0x32c5ad['query']['includeAll']){_0x3bb675[_0xb681('0x56')]=[{'model':db[_0xb681('0xa2')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xb681('0x3c'),_0xb681('0xc3'),_0xb681('0xc4')],'required':![]},{'model':db[_0xb681('0xc5')],'as':_0xb681('0xc6'),'attributes':['id',_0xb681('0x3c'),'color'],'where':_0x32c5ad[_0xb681('0x47')][_0xb681('0xc7')]?{'id':_0x32c5ad[_0xb681('0x47')][_0xb681('0xc7')]}:undefined,'required':_0x32c5ad['query'][_0xb681('0xc7')]?!![]:![]}];}return db[_0xb681('0xa6')][_0xb681('0x57')](_0x3bb675);})[_0xb681('0x22')](function(_0x53c21a){_0x2d2ce8[_0xb681('0x58')]=_0x53c21a;return _0x2d2ce8;});}})[_0xb681('0x22')](respondWithFilteredResult(_0x585429,_0x3bb675))[_0xb681('0x2c')](handleError(_0x585429,null));};exports[_0xb681('0x3d')]=function(_0x249328,_0x1ca1e2,_0x1517a1){var _0x59cee1,_0x4ec013,_0x45f9f6;if(_[_0xb681('0x9c')](_0x249328[_0xb681('0x5e')][_0xb681('0x5e')])||_0x249328[_0xb681('0x5e')][_0xb681('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0xb681('0xc8'));}if(_[_0xb681('0x9c')](_0x249328[_0xb681('0x5e')]['to'])){throw new db[(_0xb681('0x7d'))]['ValidationError'](_0xb681('0xc9'));}_0x59cee1=_0x249328['body']['to'];return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x249328[_0xb681('0x5a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb681('0xa2')],'as':_0xb681('0xa3'),'where':{'mobile':_0x59cee1},'limit':0x1,'order':[[_0xb681('0x82'),'DESC']]}]}]})[_0xb681('0x22')](handleEntityNotFound(_0x1ca1e2,null))['then'](function(_0x2fa4bc){if(_0x2fa4bc&&_0x2fa4bc[_0xb681('0xca')]){_0x4ec013=_0x2fa4bc[_0xb681('0x38')]({'plain':!![]});if(_0x4ec013[_0xb681('0xca')]&&_0x4ec013[_0xb681('0xca')][_0xb681('0xa3')][_0xb681('0x4c')]){return _0x4ec013['List'][_0xb681('0xa3')][0x0];}return db[_0xb681('0xa2')][_0xb681('0x5d')](_[_0xb681('0x1c')](_0x249328['body'],{'firstName':_0x59cee1,'mobile':_0x59cee1,'phone':_0x59cee1,'ListId':_0x4ec013[_0xb681('0x84')]}));}})[_0xb681('0x22')](handleEntityNotFound(_0x1ca1e2,null))[_0xb681('0x22')](function(_0x53721b){if(_0x53721b){_0x45f9f6=_0x53721b;return db[_0xb681('0xa6')][_0xb681('0x63')]({'where':{'ContactId':_0x45f9f6['id'],'closed':![],'SmsAccountId':_0x4ec013['id']}})[_0xb681('0x22')](function(_0xa5c21e){if(_0xa5c21e){return[_0xa5c21e,![]];}return db[_0xb681('0xa6')]['create']({'UserId':_0x249328[_0xb681('0x5f')]['id'],'ContactId':_0x45f9f6['id'],'SmsAccountId':_0x4ec013['id'],'phone':_0x59cee1,'firstMsgDirection':_0xb681('0xcb'),'Messages':[_['merge'](_0x249328['body'],{'read':![],'body':_0x249328[_0xb681('0x5e')]['body'],'phone':_0x59cee1,'SmsAccountId':_0x4ec013['id'],'UserId':_0x249328[_0xb681('0x5f')]['id'],'ContactId':_0x45f9f6['id']})]},{'include':[{'model':db[_0xb681('0xcc')],'as':_0xb681('0xcd')}]})[_0xb681('0x22')](function(_0x39b842){return[_0x39b842,!![]];});});}})['spread'](function(_0x17315d,_0x3f7faa){if(_0x3f7faa){return _0x17315d;}return db[_0xb681('0xcc')]['create'](_[_0xb681('0x53')](_0x249328[_0xb681('0x5e')],{'read':![],'body':_0x249328[_0xb681('0x5e')][_0xb681('0x5e')],'phone':_0x59cee1,'SmsAccountId':_0x4ec013['id'],'SmsInteractionId':_0x17315d['id'],'UserId':_0x249328[_0xb681('0x5f')]['id'],'ContactId':_0x45f9f6['id']}))[_0xb681('0x22')](function(_0x29c0ca){_0x17315d[_0xb681('0xce')]['Messages']=[];_0x17315d[_0xb681('0xce')][_0xb681('0xcd')][_0xb681('0xcf')](_0x29c0ca[_0xb681('0xce')]);return _0x17315d;});})['then'](respondWithResult(_0x1ca1e2,null))[_0xb681('0x2c')](handleError(_0x1ca1e2,null));};exports[_0xb681('0x2e')]=function(_0x25b40d,_0x4f05a2,_0x3197a2){if(_0x25b40d['body']['id']){delete _0x25b40d['body']['id'];}var _0x93fd66,_0x34c662,_0x5b068a;return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x25b40d[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x4f05a2,null))[_0xb681('0x22')](function(_0x1bf22f){if(_0x1bf22f){_0x5b068a=_0x1bf22f;logger['debug'](_0xb681('0x26'),'status',_0xb681('0xd0'),_0x1bf22f[_0xb681('0x43')],util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));switch(_0x1bf22f['type']){case _0xb681('0x8b'):if(_0x25b40d[_0xb681('0x5e')][_0xb681('0xd2')]&&_0x25b40d['body'][_0xb681('0x2e')]){_0x34c662=_0x25b40d[_0xb681('0x5e')][_0xb681('0x2e')];return db['SmsMessage'][_0xb681('0x63')]({'where':{'messageId':_0x25b40d['body'][_0xb681('0xd2')]}});}break;case _0xb681('0x8d'):if(_0x25b40d[_0xb681('0x5e')][_0xb681('0xd3')]&&_0x25b40d['body'][_0xb681('0xd4')]){_0x34c662=_0x25b40d[_0xb681('0x5e')][_0xb681('0xd4')];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x25b40d[_0xb681('0x5e')]['requestid']}});}break;case _0xb681('0x8e'):if(_0x25b40d[_0xb681('0x5e')][_0xb681('0x8f')]&&_0x25b40d[_0xb681('0x5e')][_0xb681('0xd5')]){_0x34c662=_0x25b40d['body']['status_code'];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x25b40d[_0xb681('0x5e')]['message_id']}});}break;case _0xb681('0xd6'):var _0x324d23=_0x25b40d[_0xb681('0x5e')]['results'][0x0];if(_0x324d23[_0xb681('0x89')]&&_0x324d23[_0xb681('0x2e')][_0xb681('0xd7')]===_0xb681('0xd8')){_0x34c662=_0x324d23[_0xb681('0x2e')]['groupName'];return db['SmsMessage'][_0xb681('0x63')]({'where':{'messageId':_0x324d23[_0xb681('0x89')]}});}break;case'clickatell':if(_0x25b40d[_0xb681('0x5e')][_0xb681('0x89')]&&_0x25b40d[_0xb681('0x5e')]['status']){_0x34c662=_0x25b40d[_0xb681('0x5e')]['status'];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x25b40d['body'][_0xb681('0x89')]}});}break;case _0xb681('0xd9'):if(_0x25b40d['body'][0x0][_0xb681('0x2a')]['id']){_0x34c662=_0x25b40d[_0xb681('0x5e')][0x0]['type'];return db['SmsMessage'][_0xb681('0x63')]({'where':{'messageId':_0x25b40d['body'][0x0]['message']['id']}});}break;case _0xb681('0x99'):if(_0x25b40d['body'][_0xb681('0xda')]&&_0x25b40d[_0xb681('0x5e')][_0xb681('0x2e')]){_0x34c662=_0x25b40d[_0xb681('0x5e')]['status'];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x25b40d['body']['redif']}});}break;}}})[_0xb681('0x22')](handleEntityNotFound(_0x4f05a2,null))[_0xb681('0x22')](function(_0x1cb7df){if(_0x1cb7df){_0x93fd66=_0x1cb7df;switch(_0x5b068a['type']){case _0xb681('0x8b'):if(_0x34c662===_0xb681('0xd8')){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger['error'](_0xb681('0x26'),_0xb681('0x2e'),'skebby',util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;case _0xb681('0x8d'):if(_0x34c662==='1'){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),_0xb681('0x2e'),_0xb681('0x8b'),util['inspect'](_0x25b40d[_0xb681('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xb681('0x8e'):if(!_0x25b40d[_0xb681('0x5e')][_0xb681('0xdb')]&&_0x34c662>=0xc8&&_0x34c662<=0xce){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),_0xb681('0x2e'),_0xb681('0x8e'),util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1c2425=_0x25b40d[_0xb681('0x5e')]['results'][0x0];if(_0x1c2425[_0xb681('0x2e')][_0xb681('0xd7')]==='DELIVERED'){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),'status','infobip',util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x34c662=='DELIVERED_TO_GATEWAY'||_0x34c662=='RECEIVED_BY_RECIPIENT'){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),_0xb681('0x2e'),_0xb681('0x96'),util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;case _0xb681('0xd9'):if(_0x34c662==_0xb681('0xdc')){return _0x93fd66['update']({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),'status','bandwidth',util[_0xb681('0xd1')](_0x25b40d[_0xb681('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xb681('0x99'):if(_0x34c662===_0xb681('0xdd')||_0x34c662===_0xb681('0xde')){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb681('0x2e'),'intelepeer',util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;}return _0x93fd66;}})[_0xb681('0x22')](respondWithResult(_0x4f05a2,null))['catch'](handleError(_0x4f05a2,null));};exports[_0xb681('0xdf')]=function(_0x44b606,_0x177be8,_0x47d016){var _0x48a14e,_0x43d24d,_0x57f5e9;return db['SmsAccount'][_0xb681('0x63')]({'where':{'id':_0x44b606['params']['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x177be8,null))[_0xb681('0x22')](function(_0x123bdf){if(_0x123bdf){_0x57f5e9=_0x123bdf;logger['debug'](_0xb681('0x26'),'status',_0xb681('0xd0'),_0x123bdf['type'],util['inspect'](_0x44b606['query'],{'showHidden':![],'depth':null}));switch(_0x123bdf['type']){case _0xb681('0x94'):if(_0x44b606[_0xb681('0x47')][_0xb681('0xe0')]&&_0x44b606[_0xb681('0x47')][_0xb681('0xe1')]){_0x43d24d=_0x44b606[_0xb681('0x47')]['state'];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x44b606[_0xb681('0x47')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x177be8,null))[_0xb681('0x22')](function(_0x32e33a){if(_0x32e33a){_0x48a14e=_0x32e33a;switch(_0x57f5e9[_0xb681('0x43')]){case _0xb681('0x94'):if(_0x43d24d==='2'||_0x43d24d==='6'){return _0x48a14e[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),_0xb681('0x2e'),_0xb681('0x94'),util[_0xb681('0xd1')](_0x44b606[_0xb681('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x48a14e;}})[_0xb681('0x22')](respondWithResult(_0x177be8,null))[_0xb681('0x2c')](handleError(_0x177be8,null));};exports[_0xb681('0xe2')]=function(_0x5937f9,_0x3ee615,_0x38382f){return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x5937f9[_0xb681('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3ee615,null))[_0xb681('0x22')](function(_0x46372a){if(_0x46372a){return _0x46372a[_0xb681('0xe2')](_0x5937f9['body'][_0xb681('0x6f')],_[_0xb681('0xe3')](_0x5937f9['body'],['ids','id'])||{})[_0xb681('0xa7')](function(_0x3c326e){for(var _0x15d04e=0x0;_0x15d04e<_0x5937f9[_0xb681('0x5e')]['ids']['length'];_0x15d04e+=0x1){socket[_0xb681('0xe4')](_0xb681('0xe5'),{'UserId':Number(_0x5937f9[_0xb681('0x5e')][_0xb681('0x6f')][_0x15d04e]),'SmsAccountId':Number(_0x5937f9['params']['id'])});}return _0x3c326e;});}})[_0xb681('0x22')](respondWithResult(_0x3ee615,null))[_0xb681('0x2c')](handleError(_0x3ee615,null));};exports[_0xb681('0xe6')]=function(_0x2114e5,_0x560d1b,_0xda2040){return db['SmsAccount']['find']({'where':{'id':_0x2114e5[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x560d1b,null))[_0xb681('0x22')](function(_0xe11fe0){if(_0xe11fe0){return _0xe11fe0['removeAgents'](_0x2114e5[_0xb681('0x47')]['ids'])[_0xb681('0x22')](function(){if(_[_0xb681('0xe7')](_0x2114e5[_0xb681('0x47')][_0xb681('0x6f')])){for(var _0x55ddf5=0x0;_0x55ddf5<_0x2114e5[_0xb681('0x47')][_0xb681('0x6f')][_0xb681('0x4c')];_0x55ddf5+=0x1){socket['emit'](_0xb681('0xe8'),{'UserId':Number(_0x2114e5[_0xb681('0x47')][_0xb681('0x6f')][_0x55ddf5]),'SmsAccountId':Number(_0x2114e5['params']['id'])});}}else{socket[_0xb681('0xe4')](_0xb681('0xe8'),{'UserId':Number(_0x2114e5[_0xb681('0x47')][_0xb681('0x6f')]),'SmsAccountId':Number(_0x2114e5[_0xb681('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x560d1b,null))[_0xb681('0x2c')](handleError(_0x560d1b,null));};exports[_0xb681('0xe9')]=function(_0x5416b1,_0x4691ab,_0x35187e){var _0x1f9bbe={};var _0x34f1b7={};var _0x4976b0;var _0x1da534;return db[_0xb681('0x40')][_0xb681('0x72')]({'where':{'id':_0x5416b1[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x4691ab,null))[_0xb681('0x22')](function(_0x5bc605){if(_0x5bc605){_0x4976b0=_0x5bc605;_0x34f1b7[_0xb681('0x45')]=_[_0xb681('0x48')](db[_0xb681('0xae')]['rawAttributes']);_0x34f1b7['query']=_[_0xb681('0x48')](_0x5416b1[_0xb681('0x47')]);_0x34f1b7[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x34f1b7['model'],_0x34f1b7[_0xb681('0x47')]);_0x1f9bbe[_0xb681('0x4a')]=_[_0xb681('0x5b')](_0x34f1b7[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x5416b1['query']['fields']));_0x1f9bbe[_0xb681('0x4a')]=_0x1f9bbe[_0xb681('0x4a')]['length']?_0x1f9bbe[_0xb681('0x4a')]:_0x34f1b7[_0xb681('0x45')];_0x1f9bbe['order']=qs[_0xb681('0x4f')](_0x5416b1['query'][_0xb681('0x4f')]);_0x1f9bbe['where']=qs[_0xb681('0x49')](_['pick'](_0x5416b1['query'],_0x34f1b7[_0xb681('0x49')]));if(_0x5416b1[_0xb681('0x47')][_0xb681('0x52')]){_0x1f9bbe[_0xb681('0x50')]=_[_0xb681('0x53')](_0x1f9bbe[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x1f9bbe[_0xb681('0x4a')],function(_0x10f1ea){var _0x43c3f9={};_0x43c3f9[_0x10f1ea]={'$like':'%'+_0x5416b1[_0xb681('0x47')][_0xb681('0x52')]+'%'};return _0x43c3f9;})});}_0x1f9bbe=_[_0xb681('0x53')]({},_0x1f9bbe,_0x5416b1['options']);return _0x4976b0[_0xb681('0xe9')](_0x1f9bbe);}})[_0xb681('0x22')](function(_0x306da9){if(_0x306da9){_0x1da534=_0x306da9[_0xb681('0x4c')];if(!_0x5416b1[_0xb681('0x47')][_0xb681('0x6d')](_0xb681('0x4d'))){_0x1f9bbe['limit']=qs[_0xb681('0x32')](_0x5416b1['query'][_0xb681('0x32')]);_0x1f9bbe[_0xb681('0x31')]=qs['offset'](_0x5416b1[_0xb681('0x47')]['offset']);}return _0x4976b0[_0xb681('0xe9')](_0x1f9bbe);}})[_0xb681('0x22')](function(_0x3e78a9){if(_0x3e78a9){return _0x3e78a9?{'count':_0x1da534,'rows':_0x3e78a9}:null;}})[_0xb681('0x22')](respondWithResult(_0x4691ab,null))[_0xb681('0x2c')](handleError(_0x4691ab,null));}; \ No newline at end of file +var _0x9d4b=['save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','SmsAccount','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rawAttributes','order','pick','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','sms','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','MessageSid','skebby','sender','connectel','clicksend','From','Text','messageId','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','addApplications','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','message_id','status_code','groupName','DELIVERED','bandwidth','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x6ff671,_0x3a88be){var _0x52ebf4=function(_0x1ce95b){while(--_0x1ce95b){_0x6ff671['push'](_0x6ff671['shift']());}};_0x52ebf4(++_0x3a88be);}(_0x9d4b,0x198));var _0xb9d4=function(_0x32e900,_0x322abb){_0x32e900=_0x32e900-0x0;var _0x2e0612=_0x9d4b[_0x32e900];return _0x2e0612;};'use strict';var emlformat=require(_0xb9d4('0x0'));var rimraf=require(_0xb9d4('0x1'));var zipdir=require(_0xb9d4('0x2'));var jsonpatch=require(_0xb9d4('0x3'));var rp=require(_0xb9d4('0x4'));var moment=require(_0xb9d4('0x5'));var BPromise=require(_0xb9d4('0x6'));var Mustache=require('mustache');var util=require(_0xb9d4('0x7'));var path=require('path');var sox=require(_0xb9d4('0x8'));var csv=require(_0xb9d4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9d4('0xa'));var _=require('lodash');var squel=require(_0xb9d4('0xb'));var crypto=require(_0xb9d4('0xc'));var jsforce=require(_0xb9d4('0xd'));var deskjs=require(_0xb9d4('0xe'));var toCsv=require(_0xb9d4('0x9'));var querystring=require(_0xb9d4('0xf'));var Papa=require(_0xb9d4('0x10'));var Redis=require(_0xb9d4('0x11'));var authService=require(_0xb9d4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9d4('0x13'))(_0xb9d4('0x14'));var utils=require(_0xb9d4('0x15'));var config=require(_0xb9d4('0x16'));var licenseUtil=require(_0xb9d4('0x17'));var db=require(_0xb9d4('0x18'))['db'];config[_0xb9d4('0x19')]=_[_0xb9d4('0x1a')](config[_0xb9d4('0x19')],{'host':_0xb9d4('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9d4('0x19')]));require(_0xb9d4('0x1c'))[_0xb9d4('0x1d')](socket);var jayson=require(_0xb9d4('0x1e'));var client=jayson[_0xb9d4('0x1f')][_0xb9d4('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4fa611,_0x22351,_0x2ebcc6,_0x534254){return new BPromise(function(_0x798218,_0x39a459){var _0x1e076b=_0x534254||client;return _0x1e076b['request'](_0x4fa611,_0x2ebcc6)[_0xb9d4('0x21')](function(_0xa3dd48){logger[_0xb9d4('0x22')](_0xb9d4('0x23'),_0x22351,'request\x20sent');logger['debug'](_0xb9d4('0x24'),_0x22351,_0xb9d4('0x25'),JSON[_0xb9d4('0x26')](_0xa3dd48));if(_0xa3dd48[_0xb9d4('0x27')]){if(_0xa3dd48[_0xb9d4('0x27')]['code']===0x1f4){logger['error'](_0xb9d4('0x23'),_0x22351,_0xa3dd48[_0xb9d4('0x27')][_0xb9d4('0x28')]);return _0x39a459(_0xa3dd48['error']['message']);}logger['error'](_0xb9d4('0x23'),_0x22351,_0xa3dd48['error']['message']);return _0x798218(_0xa3dd48['error'][_0xb9d4('0x28')]);}else{logger['info'](_0xb9d4('0x23'),_0x22351,_0xb9d4('0x25'));_0x798218(_0xa3dd48[_0xb9d4('0x29')][_0xb9d4('0x28')]);}})['catch'](function(_0x49e797){logger[_0xb9d4('0x27')](_0xb9d4('0x23'),_0x22351,_0x49e797);_0x39a459(_0x49e797);});});}function respondWithStatusCode(_0x39bf46,_0x2817bc){_0x2817bc=_0x2817bc||0xcc;return function(_0xacaa74){if(_0xacaa74){return _0x39bf46[_0xb9d4('0x2a')](_0x2817bc);}return _0x39bf46[_0xb9d4('0x2b')](_0x2817bc)[_0xb9d4('0x2c')]();};}function respondWithResult(_0xcf797e,_0x5a6e6b){_0x5a6e6b=_0x5a6e6b||0xc8;return function(_0x45de78){if(_0x45de78){return _0xcf797e[_0xb9d4('0x2b')](_0x5a6e6b)[_0xb9d4('0x2d')](_0x45de78);}};}function respondWithFilteredResult(_0x23e140,_0x42c65e){return function(_0x10724a){if(_0x10724a){var _0x16fd69=typeof _0x42c65e[_0xb9d4('0x2e')]===_0xb9d4('0x2f')&&typeof _0x42c65e[_0xb9d4('0x30')]===_0xb9d4('0x2f');var _0x64ca30=_0x10724a['count'];var _0x411896=_0x16fd69?0x0:_0x42c65e[_0xb9d4('0x2e')];var _0x5a5873=_0x16fd69?_0x10724a[_0xb9d4('0x31')]:_0x42c65e[_0xb9d4('0x2e')]+_0x42c65e['limit'];var _0x31552d;if(_0x5a5873>=_0x64ca30){_0x5a5873=_0x64ca30;_0x31552d=0xc8;}else{_0x31552d=0xce;}_0x23e140[_0xb9d4('0x2b')](_0x31552d);return _0x23e140[_0xb9d4('0x32')](_0xb9d4('0x33'),_0x411896+'-'+_0x5a5873+'/'+_0x64ca30)[_0xb9d4('0x2d')](_0x10724a);}return null;};}function patchUpdates(_0x3755bb){return function(_0x54362f){try{jsonpatch['apply'](_0x54362f,_0x3755bb,!![]);}catch(_0x41dc99){return BPromise['reject'](_0x41dc99);}return _0x54362f[_0xb9d4('0x34')]();};}function saveUpdates(_0x47847e,_0x988088){return function(_0x4b3223){if(_0x4b3223){return _0x4b3223[_0xb9d4('0x35')](_0x47847e)['then'](function(_0x187cee){return _0x187cee;});}return null;};}function removeEntity(_0x144b4d,_0xb148c7){return function(_0x325be5){if(_0x325be5){return _0x325be5[_0xb9d4('0x36')]()[_0xb9d4('0x21')](function(){var _0x52aa5f=_0x325be5[_0xb9d4('0x37')]({'plain':!![]});var _0x26dbcc=_0xb9d4('0x38');return db[_0xb9d4('0x39')][_0xb9d4('0x36')]({'where':{'type':_0x26dbcc,'resourceId':_0x52aa5f['id']}})[_0xb9d4('0x21')](function(){return _0x325be5;});})[_0xb9d4('0x21')](function(){_0x144b4d[_0xb9d4('0x2b')](0xcc)[_0xb9d4('0x2c')]();});}};}function handleEntityNotFound(_0x2046e4,_0x361dad){return function(_0x4e283a){if(!_0x4e283a){_0x2046e4[_0xb9d4('0x2a')](0x194);}return _0x4e283a;};}function handleError(_0x464c38,_0x4bed51){_0x4bed51=_0x4bed51||0x1f4;return function(_0x411aee){logger['error'](_0x411aee[_0xb9d4('0x3a')]);if(_0x411aee[_0xb9d4('0x3b')]){delete _0x411aee[_0xb9d4('0x3b')];}_0x464c38['status'](_0x4bed51)[_0xb9d4('0x3c')](_0x411aee);};}exports['index']=function(_0x33e639,_0x1793ce){var _0x39ecd9={'include':[{'model':db['Pause'],'as':_0xb9d4('0x3d')}]},_0x3e99c7={},_0x5a7fbc={'count':0x0,'rows':[]};var _0x235be1=_['map'](db[_0xb9d4('0x3e')]['rawAttributes'],function(_0x3a6690){return{'name':_0x3a6690['fieldName'],'type':_0x3a6690[_0xb9d4('0x3f')][_0xb9d4('0x40')]};});_0x3e99c7['model']=_['map'](_0x235be1,_0xb9d4('0x3b'));_0x3e99c7[_0xb9d4('0x41')]=_[_0xb9d4('0x42')](_0x33e639['query']);_0x3e99c7[_0xb9d4('0x43')]=_[_0xb9d4('0x44')](_0x3e99c7[_0xb9d4('0x45')],_0x3e99c7[_0xb9d4('0x41')]);_0x39ecd9[_0xb9d4('0x46')]=_[_0xb9d4('0x44')](_0x3e99c7['model'],qs[_0xb9d4('0x47')](_0x33e639[_0xb9d4('0x41')][_0xb9d4('0x47')]));_0x39ecd9['attributes']=_0x39ecd9[_0xb9d4('0x46')][_0xb9d4('0x48')]?_0x39ecd9[_0xb9d4('0x46')]:_0x3e99c7[_0xb9d4('0x45')];if(!_0x33e639['query'][_0xb9d4('0x49')](_0xb9d4('0x4a'))){_0x39ecd9[_0xb9d4('0x30')]=qs[_0xb9d4('0x30')](_0x33e639[_0xb9d4('0x41')][_0xb9d4('0x30')]);_0x39ecd9[_0xb9d4('0x2e')]=qs[_0xb9d4('0x2e')](_0x33e639[_0xb9d4('0x41')][_0xb9d4('0x2e')]);}_0x39ecd9['order']=qs[_0xb9d4('0x4b')](_0x33e639[_0xb9d4('0x41')]['sort']);_0x39ecd9[_0xb9d4('0x4c')]=qs[_0xb9d4('0x43')](_['pick'](_0x33e639[_0xb9d4('0x41')],_0x3e99c7['filters']),_0x235be1);if(_0x33e639[_0xb9d4('0x41')][_0xb9d4('0x4d')]){_0x39ecd9[_0xb9d4('0x4c')]=_['merge'](_0x39ecd9[_0xb9d4('0x4c')],{'$or':_[_0xb9d4('0x4e')](_0x235be1,function(_0x18bb15){if(_0x18bb15[_0xb9d4('0x3f')]!==_0xb9d4('0x4f')){var _0x9c7e36={};_0x9c7e36[_0x18bb15[_0xb9d4('0x3b')]]={'$like':'%'+_0x33e639[_0xb9d4('0x41')][_0xb9d4('0x4d')]+'%'};return _0x9c7e36;}})});}_0x39ecd9=_[_0xb9d4('0x50')]({},_0x39ecd9,_0x33e639[_0xb9d4('0x51')]);var _0x58ec2f={'where':_0x39ecd9['where']};return db[_0xb9d4('0x3e')][_0xb9d4('0x31')](_0x58ec2f)['then'](function(_0x1c931b){_0x5a7fbc[_0xb9d4('0x31')]=_0x1c931b;if(_0x33e639['query'][_0xb9d4('0x52')]){_0x39ecd9[_0xb9d4('0x53')]=[{'all':!![]}];}return db['SmsAccount'][_0xb9d4('0x54')](_0x39ecd9);})[_0xb9d4('0x21')](function(_0x5b6a11){_0x5a7fbc[_0xb9d4('0x55')]=_0x5b6a11;return _0x5a7fbc;})[_0xb9d4('0x21')](respondWithFilteredResult(_0x1793ce,_0x39ecd9))[_0xb9d4('0x56')](handleError(_0x1793ce,null));};exports[_0xb9d4('0x57')]=function(_0x36454d,_0x1ad351){var _0x214f68={'raw':![],'where':{'id':_0x36454d[_0xb9d4('0x58')]['id']},'include':[{'model':db[_0xb9d4('0x59')],'as':_0xb9d4('0x3d')}]},_0x3e9f11={};_0x3e9f11[_0xb9d4('0x45')]=_[_0xb9d4('0x42')](db['SmsAccount']['rawAttributes']);_0x3e9f11['query']=_[_0xb9d4('0x42')](_0x36454d['query']);_0x3e9f11[_0xb9d4('0x43')]=_[_0xb9d4('0x44')](_0x3e9f11[_0xb9d4('0x45')],_0x3e9f11[_0xb9d4('0x41')]);_0x214f68[_0xb9d4('0x46')]=_[_0xb9d4('0x44')](_0x3e9f11[_0xb9d4('0x45')],qs[_0xb9d4('0x47')](_0x36454d[_0xb9d4('0x41')][_0xb9d4('0x47')]));_0x214f68[_0xb9d4('0x46')]=_0x214f68[_0xb9d4('0x46')]['length']?_0x214f68[_0xb9d4('0x46')]:_0x3e9f11[_0xb9d4('0x45')];if(_0x36454d[_0xb9d4('0x41')][_0xb9d4('0x52')]){_0x214f68[_0xb9d4('0x53')]=[{'all':!![]}];}_0x214f68=_[_0xb9d4('0x50')]({},_0x214f68,_0x36454d[_0xb9d4('0x51')]);return db[_0xb9d4('0x3e')][_0xb9d4('0x5a')](_0x214f68)[_0xb9d4('0x21')](handleEntityNotFound(_0x1ad351,null))[_0xb9d4('0x21')](respondWithResult(_0x1ad351,null))['catch'](handleError(_0x1ad351,null));};exports['create']=function(_0x35577e,_0x1c36ac){return db[_0xb9d4('0x3e')][_0xb9d4('0x5b')](_0x35577e[_0xb9d4('0x5c')],{})['then'](function(_0x2b9b95){var _0x1f42f5=_0x35577e[_0xb9d4('0x5d')]['get']({'plain':!![]});if(!_0x1f42f5)throw new Error(_0xb9d4('0x5e'));if(_0x1f42f5[_0xb9d4('0x5f')]===_0xb9d4('0x5d')){var _0x36e1cc=_0x2b9b95[_0xb9d4('0x37')]({'plain':!![]});var _0x2cb7f0=_0xb9d4('0x38');return db[_0xb9d4('0x60')][_0xb9d4('0x5a')]({'where':{'name':_0x2cb7f0,'userProfileId':_0x1f42f5['userProfileId']},'raw':!![]})[_0xb9d4('0x21')](function(_0x5d84af){if(_0x5d84af&&_0x5d84af['autoAssociation']===0x0){return db[_0xb9d4('0x39')][_0xb9d4('0x5b')]({'name':_0x36e1cc[_0xb9d4('0x3b')],'resourceId':_0x36e1cc['id'],'type':_0x5d84af['name'],'sectionId':_0x5d84af['id']},{})[_0xb9d4('0x21')](function(){return _0x2b9b95;});}else{return _0x2b9b95;}})[_0xb9d4('0x56')](function(_0x3fd611){logger[_0xb9d4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fd611);throw _0x3fd611;});}return _0x2b9b95;})['then'](respondWithResult(_0x1c36ac,0xc9))[_0xb9d4('0x56')](handleError(_0x1c36ac,null));};exports[_0xb9d4('0x35')]=function(_0x30de3e,_0x593b7b){if(_0x30de3e[_0xb9d4('0x5c')]['id']){delete _0x30de3e[_0xb9d4('0x5c')]['id'];}return db[_0xb9d4('0x3e')]['find']({'where':{'id':_0x30de3e['params']['id']},'include':[{'model':db[_0xb9d4('0x59')],'as':'mandatoryDispositionPause'}]})[_0xb9d4('0x21')](handleEntityNotFound(_0x593b7b,null))['then'](saveUpdates(_0x30de3e[_0xb9d4('0x5c')],null))[_0xb9d4('0x21')](respondWithResult(_0x593b7b,null))['catch'](handleError(_0x593b7b,null));};exports[_0xb9d4('0x36')]=function(_0x488b2c,_0x1cf79d){return db[_0xb9d4('0x3e')][_0xb9d4('0x5a')]({'where':{'id':_0x488b2c[_0xb9d4('0x58')]['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x1cf79d,null))['then'](removeEntity(_0x1cf79d,null))['catch'](handleError(_0x1cf79d,null));};exports[_0xb9d4('0x61')]=function(_0x4328a,_0xc13efa){return db[_0xb9d4('0x3e')]['describe']()['then'](respondWithResult(_0xc13efa,null))[_0xb9d4('0x56')](handleError(_0xc13efa,null));};exports[_0xb9d4('0x62')]=function(_0x4fff42,_0x1cf1ba,_0x15c4a8){if(_0x4fff42['body']['id']){delete _0x4fff42['body']['id'];}return db[_0xb9d4('0x3e')]['find']({'where':{'id':_0x4fff42[_0xb9d4('0x58')]['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x1cf1ba,null))[_0xb9d4('0x21')](function(_0x1f81af){if(_0x1f81af){_0x4fff42[_0xb9d4('0x5c')][_0xb9d4('0x63')]=_0x1f81af['id'];return db[_0xb9d4('0x64')][_0xb9d4('0x5b')](_0x4fff42[_0xb9d4('0x5c')]);}})[_0xb9d4('0x21')](respondWithResult(_0x1cf1ba,null))['catch'](handleError(_0x1cf1ba,null));};exports[_0xb9d4('0x65')]=function(_0x18fccd,_0xb7985b,_0x5845e7){var _0x6a87b9={'raw':![],'where':{}};var _0x531b53={};var _0x4cc4aa={'count':0x0,'rows':[]};return db[_0xb9d4('0x3e')][_0xb9d4('0x66')]({'where':{'id':_0x18fccd['params']['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0xb7985b,null))[_0xb9d4('0x21')](function(_0x174afe){if(_0x174afe){_0x531b53['model']=_[_0xb9d4('0x42')](db[_0xb9d4('0x64')][_0xb9d4('0x67')]);_0x531b53[_0xb9d4('0x41')]=_['keys'](_0x18fccd[_0xb9d4('0x41')]);_0x531b53[_0xb9d4('0x43')]=_[_0xb9d4('0x44')](_0x531b53[_0xb9d4('0x45')],_0x531b53[_0xb9d4('0x41')]);_0x6a87b9['attributes']=_[_0xb9d4('0x44')](_0x531b53[_0xb9d4('0x45')],qs[_0xb9d4('0x47')](_0x18fccd['query'][_0xb9d4('0x47')]));_0x6a87b9['attributes']=_0x6a87b9['attributes']['length']?_0x6a87b9[_0xb9d4('0x46')]:_0x531b53[_0xb9d4('0x45')];if(!_0x18fccd['query'][_0xb9d4('0x49')](_0xb9d4('0x4a'))){_0x6a87b9[_0xb9d4('0x30')]=qs[_0xb9d4('0x30')](_0x18fccd[_0xb9d4('0x41')][_0xb9d4('0x30')]);_0x6a87b9[_0xb9d4('0x2e')]=qs[_0xb9d4('0x2e')](_0x18fccd[_0xb9d4('0x41')]['offset']);}_0x6a87b9[_0xb9d4('0x68')]=qs['sort'](_0x18fccd[_0xb9d4('0x41')][_0xb9d4('0x4b')]);_0x6a87b9[_0xb9d4('0x4c')]=qs[_0xb9d4('0x43')](_[_0xb9d4('0x69')](_0x18fccd[_0xb9d4('0x41')],_0x531b53[_0xb9d4('0x43')]));_0x6a87b9[_0xb9d4('0x4c')][_0xb9d4('0x63')]=_0x174afe['id'];if(_0x18fccd['query'][_0xb9d4('0x4d')]){_0x6a87b9[_0xb9d4('0x4c')]=_[_0xb9d4('0x50')](_0x6a87b9[_0xb9d4('0x4c')],{'$or':_['map'](_0x6a87b9['attributes'],function(_0x293490){var _0x39ee43={};_0x39ee43[_0x293490]={'$like':'%'+_0x18fccd['query']['filter']+'%'};return _0x39ee43;})});}_0x6a87b9=_['merge']({},_0x6a87b9,_0x18fccd[_0xb9d4('0x51')]);return db[_0xb9d4('0x64')]['count']({'where':_0x6a87b9['where']})[_0xb9d4('0x21')](function(_0x309e72){_0x4cc4aa[_0xb9d4('0x31')]=_0x309e72;if(_0x18fccd[_0xb9d4('0x41')][_0xb9d4('0x52')]){_0x6a87b9[_0xb9d4('0x53')]=[{'all':!![]}];}return db[_0xb9d4('0x64')][_0xb9d4('0x54')](_0x6a87b9);})['then'](function(_0x14699c){_0x4cc4aa[_0xb9d4('0x55')]=_0x14699c;return _0x4cc4aa;});}})[_0xb9d4('0x21')](respondWithFilteredResult(_0xb7985b,_0x6a87b9))[_0xb9d4('0x56')](handleError(_0xb7985b,null));};exports[_0xb9d4('0x6a')]=function(_0x43b5ba,_0x5dc786,_0x3dc0f9){return db[_0xb9d4('0x3e')]['find']({'where':{'id':_0x43b5ba[_0xb9d4('0x58')]['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x5dc786,null))[_0xb9d4('0x21')](function(_0x5dde08){if(_0x5dde08){return _0x5dde08['removeDispositions'](_0x43b5ba['query']['ids']);}})[_0xb9d4('0x21')](respondWithStatusCode(_0x5dc786,null))['catch'](handleError(_0x5dc786,null));};exports[_0xb9d4('0x6b')]=function(_0x56f7e0,_0x3b1351,_0x203277){if(_0x56f7e0['body']['id']){delete _0x56f7e0['body']['id'];}return db[_0xb9d4('0x3e')][_0xb9d4('0x5a')]({'where':{'id':_0x56f7e0['params']['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x3b1351,null))[_0xb9d4('0x21')](function(_0x4145ae){if(_0x4145ae){_0x56f7e0['body']['SmsAccountId']=_0x4145ae['id'];return db[_0xb9d4('0x6c')][_0xb9d4('0x5b')](_0x56f7e0[_0xb9d4('0x5c')]);}})['then'](respondWithResult(_0x3b1351,null))['catch'](handleError(_0x3b1351,null));};exports['getAnswers']=function(_0x198920,_0x33e200,_0x3e36d3){var _0x24d067={'raw':![],'where':{}};var _0x50c165={};var _0x3a2bad={'count':0x0,'rows':[]};return db['SmsAccount'][_0xb9d4('0x66')]({'where':{'id':_0x198920[_0xb9d4('0x58')]['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x33e200,null))[_0xb9d4('0x21')](function(_0x598846){if(_0x598846){_0x50c165[_0xb9d4('0x45')]=_[_0xb9d4('0x42')](db[_0xb9d4('0x6c')][_0xb9d4('0x67')]);_0x50c165[_0xb9d4('0x41')]=_[_0xb9d4('0x42')](_0x198920['query']);_0x50c165[_0xb9d4('0x43')]=_[_0xb9d4('0x44')](_0x50c165[_0xb9d4('0x45')],_0x50c165['query']);_0x24d067['attributes']=_[_0xb9d4('0x44')](_0x50c165[_0xb9d4('0x45')],qs[_0xb9d4('0x47')](_0x198920['query'][_0xb9d4('0x47')]));_0x24d067['attributes']=_0x24d067['attributes'][_0xb9d4('0x48')]?_0x24d067[_0xb9d4('0x46')]:_0x50c165[_0xb9d4('0x45')];if(!_0x198920[_0xb9d4('0x41')][_0xb9d4('0x49')](_0xb9d4('0x4a'))){_0x24d067['limit']=qs[_0xb9d4('0x30')](_0x198920['query'][_0xb9d4('0x30')]);_0x24d067['offset']=qs['offset'](_0x198920['query'][_0xb9d4('0x2e')]);}_0x24d067['order']=qs['sort'](_0x198920[_0xb9d4('0x41')][_0xb9d4('0x4b')]);_0x24d067[_0xb9d4('0x4c')]=qs[_0xb9d4('0x43')](_['pick'](_0x198920['query'],_0x50c165[_0xb9d4('0x43')]));_0x24d067[_0xb9d4('0x4c')][_0xb9d4('0x63')]=_0x598846['id'];if(_0x198920['query'][_0xb9d4('0x4d')]){_0x24d067[_0xb9d4('0x4c')]=_[_0xb9d4('0x50')](_0x24d067[_0xb9d4('0x4c')],{'$or':_[_0xb9d4('0x4e')](_0x24d067[_0xb9d4('0x46')],function(_0x65b7d4){var _0x1b4498={};_0x1b4498[_0x65b7d4]={'$like':'%'+_0x198920[_0xb9d4('0x41')]['filter']+'%'};return _0x1b4498;})});}_0x24d067=_[_0xb9d4('0x50')]({},_0x24d067,_0x198920[_0xb9d4('0x51')]);return db[_0xb9d4('0x6c')][_0xb9d4('0x31')]({'where':_0x24d067[_0xb9d4('0x4c')]})[_0xb9d4('0x21')](function(_0x3a4885){_0x3a2bad['count']=_0x3a4885;if(_0x198920[_0xb9d4('0x41')]['includeAll']){_0x24d067[_0xb9d4('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb9d4('0x54')](_0x24d067);})[_0xb9d4('0x21')](function(_0x54f113){_0x3a2bad[_0xb9d4('0x55')]=_0x54f113;return _0x3a2bad;});}})[_0xb9d4('0x21')](respondWithFilteredResult(_0x33e200,_0x24d067))[_0xb9d4('0x56')](handleError(_0x33e200,null));};exports[_0xb9d4('0x6d')]=function(_0x362100,_0x2ffe54,_0x50b081){return db['SmsAccount'][_0xb9d4('0x5a')]({'where':{'id':_0x362100[_0xb9d4('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ffe54,null))[_0xb9d4('0x21')](function(_0x54e230){if(_0x54e230){return _0x54e230['removeAnswers'](_0x362100['query'][_0xb9d4('0x6e')]);}})[_0xb9d4('0x21')](respondWithStatusCode(_0x2ffe54,null))['catch'](handleError(_0x2ffe54,null));};exports['notify']=function(_0x3de48d,_0x4d4258,_0xde65d8){var _0x126c8e={'channel':_0xb9d4('0x6f')};var _0x8803c0=[];var _0x51cf83=[];var _0x3831ba={};return db[_0xb9d4('0x3e')][_0xb9d4('0x5a')]({'where':{'id':_0x3de48d[_0xb9d4('0x58')]['id']},'include':[{'model':db[_0xb9d4('0x70')],'as':_0xb9d4('0x71')}]})[_0xb9d4('0x21')](handleEntityNotFound(_0x4d4258,null))[_0xb9d4('0x21')](function(_0x79fd3b){_0x126c8e[_0xb9d4('0x72')]=_0x79fd3b;_0x126c8e[_0xb9d4('0x73')]=_[_0xb9d4('0x74')](_0x79fd3b[_0xb9d4('0x71')],[_0xb9d4('0x75')],['asc']);if(_0x126c8e[_0xb9d4('0x72')][_0xb9d4('0x71')]){delete _0x126c8e[_0xb9d4('0x72')][_0xb9d4('0x71')];}return db[_0xb9d4('0x76')][_0xb9d4('0x61')]();})[_0xb9d4('0x21')](function(_0x435575){if(!_0x435575){throw new db[(_0xb9d4('0x77'))][(_0xb9d4('0x78'))](_0xb9d4('0x79'));}_0x8803c0=_[_0xb9d4('0x7a')](_['keys'](_0x435575),[_0xb9d4('0x7b'),'updatedAt']);_0x51cf83=_[_0xb9d4('0x7a')](_[_0xb9d4('0x42')](_0x435575),[_0xb9d4('0x7b'),_0xb9d4('0x7c'),_0xb9d4('0x7d'),_0xb9d4('0x7e')]);_0x126c8e[_0xb9d4('0x5c')]={'mapKey':_0xb9d4('0x7f')};if(_0x126c8e[_0xb9d4('0x72')][_0xb9d4('0x3f')]){switch(_0x126c8e[_0xb9d4('0x72')][_0xb9d4('0x3f')]){case _0xb9d4('0x80'):_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')]=_0x3de48d[_0xb9d4('0x5c')]['From'];_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x5c')]=_0x3de48d[_0xb9d4('0x5c')]['Body'];_0x126c8e[_0xb9d4('0x5c')]['messageId']=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x82')];break;case _0xb9d4('0x83'):_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')]='+'+_0x3de48d['body'][_0xb9d4('0x84')];_0x126c8e[_0xb9d4('0x5c')]['body']=_0x3de48d[_0xb9d4('0x5c')]['text'];break;case _0xb9d4('0x85'):_0x126c8e['body'][_0xb9d4('0x81')]=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x81')];_0x126c8e[_0xb9d4('0x5c')]['body']=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x28')];break;case _0xb9d4('0x86'):_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')]=_0x3de48d['body']['from'];_0x126c8e['body'][_0xb9d4('0x5c')]=_0x3de48d[_0xb9d4('0x5c')]['body'];_0x126c8e[_0xb9d4('0x5c')]['messageId']=_0x3de48d[_0xb9d4('0x5c')]['message_id'];break;case'plivo':_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')]=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x87')];_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x5c')]=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x88')];_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x89')]=_0x3de48d['body'][_0xb9d4('0x8a')];break;case _0xb9d4('0x8b'):_0x126c8e[_0xb9d4('0x5c')]['from']='+'+_0x3de48d[_0xb9d4('0x5c')]['results'][0x0]['from'];_0x126c8e[_0xb9d4('0x5c')]['body']=_0x3de48d['body'][_0xb9d4('0x8c')][0x0][_0xb9d4('0x8d')];_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x89')]=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x8c')][0x0]['messageId'];break;case'csc':_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')]=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x8e')];_0x126c8e[_0xb9d4('0x5c')]['body']=_0x3de48d['body'][_0xb9d4('0x8f')][_0xb9d4('0x28')];break;case _0xb9d4('0x90'):_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')]=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x91')];_0x126c8e[_0xb9d4('0x5c')]['body']=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x8d')];_0x126c8e[_0xb9d4('0x5c')]['messageId']=_0x3de48d['body'][_0xb9d4('0x92')];break;case'bandwidth':_0x126c8e[_0xb9d4('0x5c')]['messageId']=_0x3de48d[_0xb9d4('0x5c')][0x0][_0xb9d4('0x28')]['id'];_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')]=_0x3de48d[_0xb9d4('0x5c')][0x0][_0xb9d4('0x28')][_0xb9d4('0x81')];_0x126c8e['body']['body']=_0x3de48d['body'][0x0]['message']['text'];break;case _0xb9d4('0x93'):_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')]=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x81')];_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x5c')]=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x28')];_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x89')]=_0x3de48d[_0xb9d4('0x5c')][_0xb9d4('0x94')];break;}}if(_0x126c8e[_0xb9d4('0x5c')]['id']){delete _0x126c8e[_0xb9d4('0x5c')]['id'];}if(_[_0xb9d4('0x95')](_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')])){throw new db[(_0xb9d4('0x77'))][(_0xb9d4('0x78'))](_0xb9d4('0x96'));}if(_[_0xb9d4('0x95')](_0x126c8e['body'][_0xb9d4('0x5c')])||_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x5c')]===''){throw new db[(_0xb9d4('0x77'))][(_0xb9d4('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb9d4('0x95')](_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x97')])){throw new db['Sequelize']['ValidationError'](_0xb9d4('0x98')+_0x51cf83);}if(!_[_0xb9d4('0x99')](_0x51cf83,_0x126c8e[_0xb9d4('0x5c')]['mapKey'])){throw new db[(_0xb9d4('0x77'))][(_0xb9d4('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x51cf83);}_0x3831ba[_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x97')]]=_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')];return db[_0xb9d4('0x9a')][_0xb9d4('0x5a')]({'where':{'id':_0x126c8e[_0xb9d4('0x72')][_0xb9d4('0x7e')]},'include':[{'model':db[_0xb9d4('0x76')],'as':_0xb9d4('0x9b'),'where':_0x3831ba,'limit':0x1,'order':[[_0xb9d4('0x7c'),_0xb9d4('0x9c')]]}]});})['then'](handleEntityNotFound(_0x4d4258,null))[_0xb9d4('0x21')](function(_0x435029){if(_0x435029){_0x126c8e[_0xb9d4('0x9d')]=_[_0xb9d4('0x9e')](_0x435029,[_0xb9d4('0x9b')]);if(_0x435029[_0xb9d4('0x9b')][_0xb9d4('0x48')]){return _0x435029['Contacts'][0x0];}var _0x1a0f25=_[_0xb9d4('0x1a')](_0x126c8e['body'],{'firstName':_0x126c8e['body'][_0xb9d4('0x81')],'ListId':_0x435029['id']});_0x1a0f25[_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x97')]]=_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x81')];return db['CmContact'][_0xb9d4('0x5b')](_0x1a0f25,{'fields':_0x8803c0,'raw':!![]});}})['then'](handleEntityNotFound(_0x4d4258,null))[_0xb9d4('0x21')](function(_0x241a92){if(_0x241a92){_0x126c8e[_0xb9d4('0x9f')]=_0x241a92;var _0x299a1d={'ContactId':_0x241a92['id'],'phone':_0x126c8e['body'][_0xb9d4('0x81')],'SmsAccountId':_0x3de48d[_0xb9d4('0x58')]['id']};var _0x39cda6={'ContactId':_0x241a92['id'],'SmsAccountId':_0x3de48d[_0xb9d4('0x58')]['id'],'closed':![]};return db[_0xb9d4('0xa0')][_0xb9d4('0x5a')]({'where':_0x39cda6})[_0xb9d4('0x21')](function(_0x956f91){if(_0x956f91){return[_0x956f91,![]];}return db[_0xb9d4('0xa0')][_0xb9d4('0x5b')](_0x299a1d)[_0xb9d4('0x21')](function(_0x5d8594){return[_0x5d8594,!![]];});});}})[_0xb9d4('0xa1')](function(_0x6c12ac,_0x1b04ed){_0x126c8e[_0xb9d4('0xa2')]=_0x6c12ac['get']({'plain':!![]});_0x126c8e[_0xb9d4('0xa2')][_0xb9d4('0xa3')]=![];if(_0x1b04ed){if(_0x126c8e['account'][_0xb9d4('0xa4')]){_0x126c8e[_0xb9d4('0x73')][_0xb9d4('0xa5')]({'id':0x0,'priority':_0x126c8e[_0xb9d4('0x73')][_0xb9d4('0x48')]+0x1,'app':_0xb9d4('0xa6'),'appdata':_0xb9d4('0xa7'),'interval':_0xb9d4('0xa8')});}_0x126c8e[_0xb9d4('0xa2')][_0xb9d4('0xa3')]=!![];}return db[_0xb9d4('0xa9')][_0xb9d4('0x5b')]({'phone':_0x126c8e[_0xb9d4('0x5c')]['from'],'messageId':_0x126c8e['body']['messageId'],'body':_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0x5c')],'SmsAccountId':_0x3de48d[_0xb9d4('0x58')]['id'],'SmsInteractionId':_0x6c12ac['id'],'direction':'in','ContactId':_0x6c12ac[_0xb9d4('0xaa')],'AttachmentId':_0x126c8e[_0xb9d4('0x5c')][_0xb9d4('0xab')]});})['then'](function(_0x3a4545){_0x126c8e[_0xb9d4('0x28')]=_0x3a4545;if(_0x126c8e[_0xb9d4('0xa2')][_0xb9d4('0xac')]){return db[_0xb9d4('0xad')][_0xb9d4('0x5a')]({'attributes':['id','name'],'where':{'id':_0x126c8e[_0xb9d4('0xa2')][_0xb9d4('0xac')]}})[_0xb9d4('0x21')](function(_0xf6b4fa){if(_0xf6b4fa){_0x126c8e['applications'][_0xb9d4('0xae')]({'id':0x0,'priority':0x0,'app':_0xb9d4('0xaf'),'appdata':_0xf6b4fa[_0xb9d4('0x3b')]+','+(_0x126c8e[_0xb9d4('0x72')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb9d4('0xb0'),'startRouting',_0x126c8e);});}return respondWithRpcPromise(_0xb9d4('0xb0'),_0xb9d4('0xb1'),_0x126c8e);})[_0xb9d4('0x21')](function(_0x5b485b){if(_0x5b485b){var _0x40eebc=0xc8;var _0x5691ea='receiveMessage';logger['info'](_0xb9d4('0x24'),_0x5691ea,_0x40eebc,'entity\x20found');logger[_0xb9d4('0xb2')](_0xb9d4('0xb3'),_0x5691ea,_0x40eebc,'entity\x20found',JSON[_0xb9d4('0x26')](_0x5b485b));if(_0x126c8e[_0xb9d4('0x72')][_0xb9d4('0x3f')]===_0xb9d4('0x80')){return _0x4d4258[_0xb9d4('0x2b')](_0x40eebc)[_0xb9d4('0x32')](_0xb9d4('0xb4'),'text/xml')[_0xb9d4('0x3c')]('\x0a');}else{return _0x4d4258['status'](_0x40eebc)[_0xb9d4('0x2d')](_0x5b485b);}}})[_0xb9d4('0x56')](handleError(_0x4d4258,null));};exports[_0xb9d4('0xb5')]=function(_0x16a8f5,_0x522720){var _0x65cf7b=_0x16a8f5[_0xb9d4('0x58')]['id'];var _0x4cd40f=_0x16a8f5[_0xb9d4('0x5c')];var _0x369f2d=0xc8;var _0x744d76=null;return db['sequelize'][_0xb9d4('0xb6')]({'isolationLevel':db['sequelize'][_0xb9d4('0xb7')]['ISOLATION_LEVELS'][_0xb9d4('0xb8')]},function(_0xf1b3c9){return db[_0xb9d4('0x3e')][_0xb9d4('0x66')]({'where':{'id':_0x65cf7b},'transaction':_0xf1b3c9})[_0xb9d4('0x21')](function(_0x5c0a50){if(_0x5c0a50){return db['SmsApplication'][_0xb9d4('0x36')]({'where':{'SmsAccountId':_0x65cf7b},'transaction':_0xf1b3c9})[_0xb9d4('0x21')](function(){var _0x29cf32=_['map'](_0x4cd40f,function(_0x291ffc){_0x291ffc[_0xb9d4('0x63')]=_0x65cf7b;return _0x291ffc;});return db[_0xb9d4('0x70')][_0xb9d4('0xb9')](_0x29cf32,{'transaction':_0xf1b3c9});});}else{_0x369f2d=0x194;_0x744d76=[];}});})[_0xb9d4('0x21')](function(){if(_0x369f2d!==0x194){return db[_0xb9d4('0x70')][_0xb9d4('0xba')]({'where':{'SmsAccountId':_0x65cf7b},'order':_0xb9d4('0x75')})[_0xb9d4('0x21')](function(_0x23ce56){_0x744d76=_0x23ce56;});}})['catch'](function(_0x1a0ed8){_0x369f2d=0x1f4;logger['error'](_0x1a0ed8[_0xb9d4('0x3a')]);if(_0x1a0ed8[_0xb9d4('0x3b')]){delete _0x1a0ed8[_0xb9d4('0x3b')];}_0x744d76=_0x1a0ed8;})[_0xb9d4('0xbb')](function(){if(_0x744d76===null){_0x522720['sendStatus'](_0x369f2d);}else{if(_0x369f2d===0x1f4){_0x522720[_0xb9d4('0x2b')](_0x369f2d)['send'](_0x744d76);}else{_0x522720[_0xb9d4('0x2b')](_0x369f2d)[_0xb9d4('0x2d')](_0x744d76);}}});};exports[_0xb9d4('0xbc')]=function(_0xb60995,_0x585d6d,_0x1fe3d1){var _0x42ab26={};var _0x1c8e48={};var _0x5e1ee0;var _0x2044d0;return db[_0xb9d4('0x3e')][_0xb9d4('0x66')]({'where':{'id':_0xb60995[_0xb9d4('0x58')]['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x585d6d,null))[_0xb9d4('0x21')](function(_0x18797e){if(_0x18797e){_0x5e1ee0=_0x18797e;_0x1c8e48['model']=_['keys'](db[_0xb9d4('0x70')][_0xb9d4('0x67')]);_0x1c8e48['query']=_[_0xb9d4('0x42')](_0xb60995['query']);_0x1c8e48[_0xb9d4('0x43')]=_['intersection'](_0x1c8e48[_0xb9d4('0x45')],_0x1c8e48[_0xb9d4('0x41')]);_0x42ab26[_0xb9d4('0x46')]=_[_0xb9d4('0x44')](_0x1c8e48['model'],qs[_0xb9d4('0x47')](_0xb60995['query'][_0xb9d4('0x47')]));_0x42ab26['attributes']=_0x42ab26['attributes'][_0xb9d4('0x48')]?_0x42ab26['attributes']:_0x1c8e48['model'];_0x42ab26[_0xb9d4('0x68')]=qs['sort'](_0xb60995['query'][_0xb9d4('0x4b')]);_0x42ab26[_0xb9d4('0x4c')]=qs[_0xb9d4('0x43')](_[_0xb9d4('0x69')](_0xb60995['query'],_0x1c8e48[_0xb9d4('0x43')]));if(_0xb60995[_0xb9d4('0x41')][_0xb9d4('0x4d')]){_0x42ab26[_0xb9d4('0x4c')]=_['merge'](_0x42ab26[_0xb9d4('0x4c')],{'$or':_[_0xb9d4('0x4e')](_0x42ab26[_0xb9d4('0x46')],function(_0x30f3e8){var _0xd3c465={};_0xd3c465[_0x30f3e8]={'$like':'%'+_0xb60995[_0xb9d4('0x41')][_0xb9d4('0x4d')]+'%'};return _0xd3c465;})});}_0x42ab26=_['merge']({},_0x42ab26,_0xb60995[_0xb9d4('0x51')]);return _0x5e1ee0[_0xb9d4('0xbc')](_0x42ab26);}})[_0xb9d4('0x21')](function(_0x4cf566){if(_0x4cf566){_0x2044d0=_0x4cf566[_0xb9d4('0x48')];if(!_0xb60995[_0xb9d4('0x41')][_0xb9d4('0x49')](_0xb9d4('0x4a'))){_0x42ab26['limit']=qs[_0xb9d4('0x30')](_0xb60995[_0xb9d4('0x41')][_0xb9d4('0x30')]);_0x42ab26[_0xb9d4('0x2e')]=qs[_0xb9d4('0x2e')](_0xb60995[_0xb9d4('0x41')][_0xb9d4('0x2e')]);}return _0x5e1ee0[_0xb9d4('0xbc')](_0x42ab26);}})['then'](function(_0x4bfcf9){if(_0x4bfcf9){return _0x4bfcf9?{'count':_0x2044d0,'rows':_0x4bfcf9}:null;}})[_0xb9d4('0x21')](respondWithResult(_0x585d6d,null))[_0xb9d4('0x56')](handleError(_0x585d6d,null));};exports[_0xb9d4('0xbd')]=function(_0x175f37,_0x4aa80c,_0x40657f){var _0x343bfd={'raw':![],'where':{}};var _0x5248c1={};var _0x4ae72c={'count':0x0,'rows':[]};return db[_0xb9d4('0x3e')]['findOne']({'where':{'id':_0x175f37[_0xb9d4('0x58')]['id']}})['then'](handleEntityNotFound(_0x4aa80c,null))[_0xb9d4('0x21')](function(_0x551c6b){if(_0x551c6b){_0x5248c1['model']=_[_0xb9d4('0x42')](db['SmsInteraction'][_0xb9d4('0x67')]);_0x5248c1[_0xb9d4('0x41')]=_['keys'](_0x175f37[_0xb9d4('0x41')]);_0x5248c1[_0xb9d4('0x43')]=_[_0xb9d4('0x44')](_0x5248c1[_0xb9d4('0x45')],_0x5248c1['query']);_0x343bfd[_0xb9d4('0x46')]=_[_0xb9d4('0x44')](_0x5248c1[_0xb9d4('0x45')],qs[_0xb9d4('0x47')](_0x175f37[_0xb9d4('0x41')][_0xb9d4('0x47')]));_0x343bfd[_0xb9d4('0x46')]=_0x343bfd['attributes']['length']?_0x343bfd[_0xb9d4('0x46')]:_0x5248c1[_0xb9d4('0x45')];if(!_0x175f37[_0xb9d4('0x41')][_0xb9d4('0x49')](_0xb9d4('0x4a'))){_0x343bfd[_0xb9d4('0x30')]=qs['limit'](_0x175f37[_0xb9d4('0x41')][_0xb9d4('0x30')]);_0x343bfd[_0xb9d4('0x2e')]=qs['offset'](_0x175f37[_0xb9d4('0x41')][_0xb9d4('0x2e')]);}_0x343bfd[_0xb9d4('0x68')]=qs[_0xb9d4('0x4b')](_0x175f37['query']['sort']);_0x343bfd[_0xb9d4('0x4c')]=qs[_0xb9d4('0x43')](_[_0xb9d4('0x69')](_0x175f37['query'],_0x5248c1[_0xb9d4('0x43')]));_0x343bfd[_0xb9d4('0x4c')]['SmsAccountId']=_0x551c6b['id'];if(_0x175f37['query'][_0xb9d4('0x4d')]){_0x343bfd[_0xb9d4('0x4c')]=_[_0xb9d4('0x50')](_0x343bfd[_0xb9d4('0x4c')],{'$or':_[_0xb9d4('0x4e')](_0x343bfd[_0xb9d4('0x46')],function(_0x2dcf11){var _0x163171={};_0x163171[_0x2dcf11]={'$like':'%'+_0x175f37[_0xb9d4('0x41')]['filter']+'%'};return _0x163171;})});}_0x343bfd=_[_0xb9d4('0x50')]({},_0x343bfd,_0x175f37[_0xb9d4('0x51')]);return db[_0xb9d4('0xa0')][_0xb9d4('0x31')]({'where':_0x343bfd[_0xb9d4('0x4c')]})[_0xb9d4('0x21')](function(_0x1fe0e6){_0x4ae72c[_0xb9d4('0x31')]=_0x1fe0e6;if(_0x175f37[_0xb9d4('0x41')]['includeAll']){_0x343bfd['include']=[{'model':db[_0xb9d4('0x76')],'as':_0xb9d4('0xbe'),'required':![]},{'model':db['User'],'as':_0xb9d4('0xbf'),'attributes':[_0xb9d4('0x3b'),_0xb9d4('0xc0'),_0xb9d4('0xc1')],'required':![]},{'model':db[_0xb9d4('0xc2')],'as':_0xb9d4('0xc3'),'attributes':['id',_0xb9d4('0x3b'),_0xb9d4('0xc4')],'where':_0x175f37[_0xb9d4('0x41')][_0xb9d4('0xc5')]?{'id':_0x175f37['query']['tag']}:undefined,'required':_0x175f37[_0xb9d4('0x41')][_0xb9d4('0xc5')]?!![]:![]}];}return db[_0xb9d4('0xa0')][_0xb9d4('0x54')](_0x343bfd);})[_0xb9d4('0x21')](function(_0xd91e3d){_0x4ae72c['rows']=_0xd91e3d;return _0x4ae72c;});}})['then'](respondWithFilteredResult(_0x4aa80c,_0x343bfd))[_0xb9d4('0x56')](handleError(_0x4aa80c,null));};exports[_0xb9d4('0x3c')]=function(_0x40b5df,_0x110f9d,_0x591603){var _0x206bea,_0x46128f,_0x4a77cf;if(_[_0xb9d4('0x95')](_0x40b5df[_0xb9d4('0x5c')][_0xb9d4('0x5c')])||_0x40b5df['body'][_0xb9d4('0x5c')]===''){throw new db[(_0xb9d4('0x77'))]['ValidationError'](_0xb9d4('0xc6'));}if(_['isNil'](_0x40b5df[_0xb9d4('0x5c')]['to'])){throw new db[(_0xb9d4('0x77'))][(_0xb9d4('0x78'))](_0xb9d4('0xc7'));}_0x206bea=_0x40b5df['body']['to'];return db[_0xb9d4('0x3e')]['find']({'where':{'id':_0x40b5df['params']['id']},'include':[{'model':db[_0xb9d4('0x9a')],'as':'List','include':[{'model':db[_0xb9d4('0x76')],'as':_0xb9d4('0x9b'),'where':{'mobile':_0x206bea},'limit':0x1,'order':[[_0xb9d4('0x7c'),_0xb9d4('0x9c')]]}]}]})[_0xb9d4('0x21')](handleEntityNotFound(_0x110f9d,null))[_0xb9d4('0x21')](function(_0x5277cf){if(_0x5277cf&&_0x5277cf[_0xb9d4('0xc8')]){_0x46128f=_0x5277cf['get']({'plain':!![]});if(_0x46128f[_0xb9d4('0xc8')]&&_0x46128f[_0xb9d4('0xc8')][_0xb9d4('0x9b')][_0xb9d4('0x48')]){return _0x46128f[_0xb9d4('0xc8')][_0xb9d4('0x9b')][0x0];}return db[_0xb9d4('0x76')][_0xb9d4('0x5b')](_[_0xb9d4('0x1a')](_0x40b5df[_0xb9d4('0x5c')],{'firstName':_0x206bea,'mobile':_0x206bea,'phone':_0x206bea,'ListId':_0x46128f[_0xb9d4('0x7e')]}));}})['then'](handleEntityNotFound(_0x110f9d,null))[_0xb9d4('0x21')](function(_0x3ca69e){if(_0x3ca69e){_0x4a77cf=_0x3ca69e;return db[_0xb9d4('0xa0')]['find']({'where':{'ContactId':_0x4a77cf['id'],'closed':![],'SmsAccountId':_0x46128f['id']}})['then'](function(_0x5c2cb5){if(_0x5c2cb5){return[_0x5c2cb5,![]];}return db[_0xb9d4('0xa0')][_0xb9d4('0x5b')]({'UserId':_0x40b5df[_0xb9d4('0x5d')]['id'],'ContactId':_0x4a77cf['id'],'SmsAccountId':_0x46128f['id'],'phone':_0x206bea,'firstMsgDirection':'out','Messages':[_[_0xb9d4('0x50')](_0x40b5df['body'],{'read':![],'body':_0x40b5df['body']['body'],'phone':_0x206bea,'SmsAccountId':_0x46128f['id'],'UserId':_0x40b5df[_0xb9d4('0x5d')]['id'],'ContactId':_0x4a77cf['id']})]},{'include':[{'model':db[_0xb9d4('0xa9')],'as':_0xb9d4('0xc9')}]})[_0xb9d4('0x21')](function(_0x3b4737){return[_0x3b4737,!![]];});});}})[_0xb9d4('0xa1')](function(_0x5eafa4,_0x3e5be4){if(_0x3e5be4){return _0x5eafa4;}return db['SmsMessage'][_0xb9d4('0x5b')](_[_0xb9d4('0x50')](_0x40b5df[_0xb9d4('0x5c')],{'read':![],'body':_0x40b5df['body'][_0xb9d4('0x5c')],'phone':_0x206bea,'SmsAccountId':_0x46128f['id'],'SmsInteractionId':_0x5eafa4['id'],'UserId':_0x40b5df[_0xb9d4('0x5d')]['id'],'ContactId':_0x4a77cf['id']}))['then'](function(_0xb00e){_0x5eafa4[_0xb9d4('0xca')][_0xb9d4('0xc9')]=[];_0x5eafa4['dataValues'][_0xb9d4('0xc9')]['push'](_0xb00e[_0xb9d4('0xca')]);return _0x5eafa4;});})[_0xb9d4('0x21')](respondWithResult(_0x110f9d,null))['catch'](handleError(_0x110f9d,null));};exports['status']=function(_0x575732,_0x254817,_0x44ee02){if(_0x575732[_0xb9d4('0x5c')]['id']){delete _0x575732[_0xb9d4('0x5c')]['id'];}var _0x3b78e3,_0x557f30,_0x2ec978;return db[_0xb9d4('0x3e')][_0xb9d4('0x5a')]({'where':{'id':_0x575732['params']['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x254817,null))[_0xb9d4('0x21')](function(_0x5b4fe7){if(_0x5b4fe7){_0x2ec978=_0x5b4fe7;logger[_0xb9d4('0xb2')](_0xb9d4('0x24'),_0xb9d4('0x2b'),_0xb9d4('0xcb'),_0x5b4fe7[_0xb9d4('0x3f')],util[_0xb9d4('0xcc')](_0x575732[_0xb9d4('0x5c')],{'showHidden':![],'depth':null}));switch(_0x5b4fe7[_0xb9d4('0x3f')]){case'skebby':if(_0x575732[_0xb9d4('0x5c')][_0xb9d4('0xcd')]&&_0x575732['body'][_0xb9d4('0x2b')]){_0x557f30=_0x575732[_0xb9d4('0x5c')]['status'];return db[_0xb9d4('0xa9')][_0xb9d4('0x5a')]({'where':{'messageId':_0x575732['body']['skebby_dispatch_id']}});}break;case _0xb9d4('0x85'):if(_0x575732[_0xb9d4('0x5c')]['requestid']&&_0x575732['body'][_0xb9d4('0xce')]){_0x557f30=_0x575732['body'][_0xb9d4('0xce')];return db[_0xb9d4('0xa9')][_0xb9d4('0x5a')]({'where':{'messageId':_0x575732[_0xb9d4('0x5c')][_0xb9d4('0xcf')]}});}break;case _0xb9d4('0x86'):if(_0x575732[_0xb9d4('0x5c')][_0xb9d4('0xd0')]&&_0x575732[_0xb9d4('0x5c')][_0xb9d4('0xd1')]){_0x557f30=_0x575732['body']['status_code'];return db['SmsMessage'][_0xb9d4('0x5a')]({'where':{'messageId':_0x575732[_0xb9d4('0x5c')][_0xb9d4('0xd0')]}});}break;case _0xb9d4('0x8b'):var _0x17405e=_0x575732[_0xb9d4('0x5c')][_0xb9d4('0x8c')][0x0];if(_0x17405e[_0xb9d4('0x89')]&&_0x17405e['status'][_0xb9d4('0xd2')]===_0xb9d4('0xd3')){_0x557f30=_0x17405e[_0xb9d4('0x2b')][_0xb9d4('0xd2')];return db[_0xb9d4('0xa9')][_0xb9d4('0x5a')]({'where':{'messageId':_0x17405e['messageId']}});}break;case _0xb9d4('0x90'):if(_0x575732['body'][_0xb9d4('0x89')]&&_0x575732[_0xb9d4('0x5c')][_0xb9d4('0x2b')]){_0x557f30=_0x575732['body'][_0xb9d4('0x2b')];return db[_0xb9d4('0xa9')]['find']({'where':{'messageId':_0x575732[_0xb9d4('0x5c')][_0xb9d4('0x89')]}});}break;case _0xb9d4('0xd4'):if(_0x575732[_0xb9d4('0x5c')][0x0][_0xb9d4('0x28')]['id']){_0x557f30=_0x575732[_0xb9d4('0x5c')][0x0][_0xb9d4('0x3f')];return db[_0xb9d4('0xa9')]['find']({'where':{'messageId':_0x575732[_0xb9d4('0x5c')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x575732[_0xb9d4('0x5c')][_0xb9d4('0xd5')]&&_0x575732[_0xb9d4('0x5c')]['status']){_0x557f30=_0x575732['body'][_0xb9d4('0x2b')];return db[_0xb9d4('0xa9')][_0xb9d4('0x5a')]({'where':{'messageId':_0x575732['body'][_0xb9d4('0xd5')]}});}break;}}})[_0xb9d4('0x21')](handleEntityNotFound(_0x254817,null))['then'](function(_0x57924c){if(_0x57924c){_0x3b78e3=_0x57924c;switch(_0x2ec978[_0xb9d4('0x3f')]){case _0xb9d4('0x83'):if(_0x557f30===_0xb9d4('0xd3')){return _0x3b78e3[_0xb9d4('0x35')]({'read':!![]});}else{logger[_0xb9d4('0x27')](_0xb9d4('0x24'),_0xb9d4('0x2b'),'skebby',util['inspect'](_0x575732['body'],{'showHidden':![],'depth':null}));}break;case _0xb9d4('0x85'):if(_0x557f30==='1'){return _0x3b78e3[_0xb9d4('0x35')]({'read':!![]});}else{logger['error'](_0xb9d4('0x24'),_0xb9d4('0x2b'),_0xb9d4('0x83'),util[_0xb9d4('0xcc')](_0x575732[_0xb9d4('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x575732[_0xb9d4('0x5c')][_0xb9d4('0xd6')]&&_0x557f30>=0xc8&&_0x557f30<=0xce){return _0x3b78e3[_0xb9d4('0x35')]({'read':!![]});}else{logger[_0xb9d4('0x27')](_0xb9d4('0x24'),'status',_0xb9d4('0x86'),util[_0xb9d4('0xcc')](_0x575732[_0xb9d4('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xb9d4('0x8b'):var _0x56872b=_0x575732['body'][_0xb9d4('0x8c')][0x0];if(_0x56872b[_0xb9d4('0x2b')][_0xb9d4('0xd2')]==='DELIVERED'){return _0x3b78e3[_0xb9d4('0x35')]({'read':!![]});}else{logger[_0xb9d4('0x27')](_0xb9d4('0x24'),_0xb9d4('0x2b'),_0xb9d4('0x8b'),util[_0xb9d4('0xcc')](_0x575732[_0xb9d4('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xb9d4('0x90'):if(_0x557f30==_0xb9d4('0xd7')||_0x557f30==_0xb9d4('0xd8')){return _0x3b78e3[_0xb9d4('0x35')]({'read':!![]});}else{logger['error'](_0xb9d4('0x24'),_0xb9d4('0x2b'),'clickatell',util[_0xb9d4('0xcc')](_0x575732['body'],{'showHidden':![],'depth':null}));}break;case _0xb9d4('0xd4'):if(_0x557f30==_0xb9d4('0xd9')){return _0x3b78e3['update']({'read':!![]});}else{logger['error'](_0xb9d4('0x24'),'status','bandwidth',util[_0xb9d4('0xcc')](_0x575732[_0xb9d4('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xb9d4('0x93'):if(_0x557f30===_0xb9d4('0xda')||_0x557f30==='ACCEPTD'){return _0x3b78e3[_0xb9d4('0x35')]({'read':!![]});}else{logger[_0xb9d4('0x27')](_0xb9d4('0x24'),'status',_0xb9d4('0x93'),util[_0xb9d4('0xcc')](_0x575732['body'],{'showHidden':![],'depth':null}));}break;}return _0x3b78e3;}})[_0xb9d4('0x21')](respondWithResult(_0x254817,null))['catch'](handleError(_0x254817,null));};exports[_0xb9d4('0xdb')]=function(_0x54a7f1,_0x2985ac,_0x93bdff){var _0x185215,_0x37b670,_0x542ccb;return db[_0xb9d4('0x3e')][_0xb9d4('0x5a')]({'where':{'id':_0x54a7f1[_0xb9d4('0x58')]['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x2985ac,null))[_0xb9d4('0x21')](function(_0xe4b75a){if(_0xe4b75a){_0x542ccb=_0xe4b75a;logger[_0xb9d4('0xb2')](_0xb9d4('0x24'),_0xb9d4('0x2b'),_0xb9d4('0xcb'),_0xe4b75a[_0xb9d4('0x3f')],util[_0xb9d4('0xcc')](_0x54a7f1['query'],{'showHidden':![],'depth':null}));switch(_0xe4b75a[_0xb9d4('0x3f')]){case _0xb9d4('0xdc'):if(_0x54a7f1['query'][_0xb9d4('0xdd')]&&_0x54a7f1[_0xb9d4('0x41')][_0xb9d4('0xde')]){_0x37b670=_0x54a7f1[_0xb9d4('0x41')][_0xb9d4('0xde')];return db[_0xb9d4('0xa9')][_0xb9d4('0x5a')]({'where':{'messageId':_0x54a7f1[_0xb9d4('0x41')][_0xb9d4('0xdd')]}});}break;}}})[_0xb9d4('0x21')](handleEntityNotFound(_0x2985ac,null))['then'](function(_0x10ca00){if(_0x10ca00){_0x185215=_0x10ca00;switch(_0x542ccb[_0xb9d4('0x3f')]){case _0xb9d4('0xdc'):if(_0x37b670==='2'||_0x37b670==='6'){return _0x185215[_0xb9d4('0x35')]({'read':!![]});}else{logger[_0xb9d4('0x27')](_0xb9d4('0x24'),_0xb9d4('0x2b'),'csc',util[_0xb9d4('0xcc')](_0x54a7f1[_0xb9d4('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x185215;}})[_0xb9d4('0x21')](respondWithResult(_0x2985ac,null))['catch'](handleError(_0x2985ac,null));};exports['addAgents']=function(_0x4c4b44,_0x2c721f,_0x595ad2){return db[_0xb9d4('0x3e')]['find']({'where':{'id':_0x4c4b44[_0xb9d4('0x58')]['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x2c721f,null))[_0xb9d4('0x21')](function(_0x3d1c8f){if(_0x3d1c8f){return _0x3d1c8f[_0xb9d4('0xdf')](_0x4c4b44['body'][_0xb9d4('0x6e')],_[_0xb9d4('0x9e')](_0x4c4b44[_0xb9d4('0x5c')],[_0xb9d4('0x6e'),'id'])||{})['spread'](function(_0x14f9d4){for(var _0x34a2f8=0x0;_0x34a2f8<_0x4c4b44[_0xb9d4('0x5c')][_0xb9d4('0x6e')]['length'];_0x34a2f8+=0x1){socket[_0xb9d4('0xe0')](_0xb9d4('0xe1'),{'UserId':Number(_0x4c4b44['body']['ids'][_0x34a2f8]),'SmsAccountId':Number(_0x4c4b44[_0xb9d4('0x58')]['id'])});}return _0x14f9d4;});}})[_0xb9d4('0x21')](respondWithResult(_0x2c721f,null))[_0xb9d4('0x56')](handleError(_0x2c721f,null));};exports[_0xb9d4('0xe2')]=function(_0x8006fa,_0x3918a6,_0x2a0553){return db['SmsAccount']['find']({'where':{'id':_0x8006fa['params']['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0x3918a6,null))[_0xb9d4('0x21')](function(_0x552c33){if(_0x552c33){return _0x552c33[_0xb9d4('0xe2')](_0x8006fa[_0xb9d4('0x41')][_0xb9d4('0x6e')])[_0xb9d4('0x21')](function(){if(_[_0xb9d4('0xe3')](_0x8006fa[_0xb9d4('0x41')][_0xb9d4('0x6e')])){for(var _0x4b370d=0x0;_0x4b370d<_0x8006fa[_0xb9d4('0x41')][_0xb9d4('0x6e')][_0xb9d4('0x48')];_0x4b370d+=0x1){socket['emit'](_0xb9d4('0xe4'),{'UserId':Number(_0x8006fa[_0xb9d4('0x41')][_0xb9d4('0x6e')][_0x4b370d]),'SmsAccountId':Number(_0x8006fa['params']['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x8006fa['query'][_0xb9d4('0x6e')]),'SmsAccountId':Number(_0x8006fa[_0xb9d4('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x3918a6,null))['catch'](handleError(_0x3918a6,null));};exports[_0xb9d4('0xe5')]=function(_0x374cdc,_0xb666bc,_0x2c7abf){var _0x56ce48={};var _0x1e2782={};var _0x454abe;var _0x1fa68a;return db['SmsAccount'][_0xb9d4('0x66')]({'where':{'id':_0x374cdc[_0xb9d4('0x58')]['id']}})[_0xb9d4('0x21')](handleEntityNotFound(_0xb666bc,null))[_0xb9d4('0x21')](function(_0x37c665){if(_0x37c665){_0x454abe=_0x37c665;_0x1e2782['model']=_[_0xb9d4('0x42')](db[_0xb9d4('0xad')][_0xb9d4('0x67')]);_0x1e2782[_0xb9d4('0x41')]=_[_0xb9d4('0x42')](_0x374cdc[_0xb9d4('0x41')]);_0x1e2782['filters']=_[_0xb9d4('0x44')](_0x1e2782[_0xb9d4('0x45')],_0x1e2782['query']);_0x56ce48[_0xb9d4('0x46')]=_[_0xb9d4('0x44')](_0x1e2782[_0xb9d4('0x45')],qs[_0xb9d4('0x47')](_0x374cdc[_0xb9d4('0x41')]['fields']));_0x56ce48[_0xb9d4('0x46')]=_0x56ce48[_0xb9d4('0x46')][_0xb9d4('0x48')]?_0x56ce48[_0xb9d4('0x46')]:_0x1e2782[_0xb9d4('0x45')];_0x56ce48[_0xb9d4('0x68')]=qs['sort'](_0x374cdc[_0xb9d4('0x41')][_0xb9d4('0x4b')]);_0x56ce48[_0xb9d4('0x4c')]=qs[_0xb9d4('0x43')](_[_0xb9d4('0x69')](_0x374cdc[_0xb9d4('0x41')],_0x1e2782[_0xb9d4('0x43')]));if(_0x374cdc[_0xb9d4('0x41')][_0xb9d4('0x4d')]){_0x56ce48[_0xb9d4('0x4c')]=_[_0xb9d4('0x50')](_0x56ce48[_0xb9d4('0x4c')],{'$or':_[_0xb9d4('0x4e')](_0x56ce48['attributes'],function(_0x4f5f41){var _0x35510a={};_0x35510a[_0x4f5f41]={'$like':'%'+_0x374cdc[_0xb9d4('0x41')][_0xb9d4('0x4d')]+'%'};return _0x35510a;})});}_0x56ce48=_['merge']({},_0x56ce48,_0x374cdc['options']);return _0x454abe[_0xb9d4('0xe5')](_0x56ce48);}})['then'](function(_0x31de2f){if(_0x31de2f){_0x1fa68a=_0x31de2f['length'];if(!_0x374cdc[_0xb9d4('0x41')][_0xb9d4('0x49')](_0xb9d4('0x4a'))){_0x56ce48['limit']=qs[_0xb9d4('0x30')](_0x374cdc[_0xb9d4('0x41')][_0xb9d4('0x30')]);_0x56ce48['offset']=qs[_0xb9d4('0x2e')](_0x374cdc[_0xb9d4('0x41')][_0xb9d4('0x2e')]);}return _0x454abe['getAgents'](_0x56ce48);}})[_0xb9d4('0x21')](function(_0x647fe4){if(_0x647fe4){return _0x647fe4?{'count':_0x1fa68a,'rows':_0x647fe4}:null;}})[_0xb9d4('0x21')](respondWithResult(_0xb666bc,null))[_0xb9d4('0x56')](handleError(_0xb666bc,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a4a6812..787b956 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 _0x0409=['hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','emit'];(function(_0x2f4069,_0x74eb6c){var _0x4e5d90=function(_0x56fedf){while(--_0x56fedf){_0x2f4069['push'](_0x2f4069['shift']());}};_0x4e5d90(++_0x74eb6c);}(_0x0409,0x15a));var _0x9040=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0409[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x9040('0x0'));var SmsAccount=require(_0x9040('0x1'))['db'][_0x9040('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9040('0x3')](0x0);var events={'afterCreate':_0x9040('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x326c20){return function(_0x4989e1,_0x5307c9,_0x4769d0){SmsAccountEvents[_0x9040('0x5')](_0x326c20+':'+_0x4989e1['id'],_0x4989e1);SmsAccountEvents['emit'](_0x326c20,_0x4989e1);_0x4769d0(null);};}for(var e in events){if(events[_0x9040('0x6')](e)){var event=events[e];SmsAccount[_0x9040('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xddee=['exports','events','SmsAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2fb237,_0x3c357f){var _0x1da66d=function(_0x11756b){while(--_0x11756b){_0x2fb237['push'](_0x2fb237['shift']());}};_0x1da66d(++_0x3c357f);}(_0xddee,0x1a8));var _0xedde=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xddee[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xedde('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xedde('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xedde('0x2')](0x0);var events={'afterCreate':_0xedde('0x3'),'afterUpdate':_0xedde('0x4'),'afterDestroy':_0xedde('0x5')};function emitEvent(_0x2b1151){return function(_0x4e6b5a,_0xb0d1fe,_0x1b41a9){SmsAccountEvents['emit'](_0x2b1151+':'+_0x4e6b5a['id'],_0x4e6b5a);SmsAccountEvents[_0xedde('0x6')](_0x2b1151,_0x4e6b5a);_0x1b41a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xedde('0x7')](e,emitEvent(event));}}module[_0xedde('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d9770c6..a9c9492 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 _0x3dfe=['exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x33bb09,_0x35efd8){var _0x38988a=function(_0xf40b78){while(--_0xf40b78){_0x33bb09['push'](_0x33bb09['shift']());}};_0x38988a(++_0x35efd8);}(_0x3dfe,0x148));var _0xe3df=function(_0x19d897,_0x340e2f){_0x19d897=_0x19d897-0x0;var _0x3f1083=_0x3dfe[_0x19d897];return _0x3f1083;};'use strict';var _=require(_0xe3df('0x0'));var util=require(_0xe3df('0x1'));var logger=require(_0xe3df('0x2'))(_0xe3df('0x3'));var moment=require('moment');var BPromise=require(_0xe3df('0x4'));var rp=require(_0xe3df('0x5'));var fs=require('fs');var path=require(_0xe3df('0x6'));var rimraf=require(_0xe3df('0x7'));var config=require(_0xe3df('0x8'));var attributes=require(_0xe3df('0x9'));module[_0xe3df('0xa')]=function(_0x152087,_0x181ba0){return _0x152087['define'](_0xe3df('0xb'),attributes,{'tableName':_0xe3df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaefd=['request-promise','./smsAccount.attributes','exports','define','sms_accounts','util','api','moment','bluebird'];(function(_0x84bb24,_0x1e8e35){var _0x40f5aa=function(_0x586c8c){while(--_0x586c8c){_0x84bb24['push'](_0x84bb24['shift']());}};_0x40f5aa(++_0x1e8e35);}(_0xaefd,0xa7));var _0xdaef=function(_0x5b604f,_0x1e5a25){_0x5b604f=_0x5b604f-0x0;var _0x33df77=_0xaefd[_0x5b604f];return _0x33df77;};'use strict';var _=require('lodash');var util=require(_0xdaef('0x0'));var logger=require('../../config/logger')(_0xdaef('0x1'));var moment=require(_0xdaef('0x2'));var BPromise=require(_0xdaef('0x3'));var rp=require(_0xdaef('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdaef('0x5'));module[_0xdaef('0x6')]=function(_0x1aee9a,_0x15a4b1){return _0x1aee9a[_0xdaef('0x7')]('SmsAccount',attributes,{'tableName':_0xdaef('0x8'),'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 d0b9db3..03a4044 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 _0xa6bf=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0xa6bf,0x19b));var _0xfa6b=function(_0x14c076,_0x22a84c){_0x14c076=_0x14c076-0x0;var _0x423f1c=_0xa6bf[_0x14c076];return _0x423f1c;};'use strict';var _=require(_0xfa6b('0x0'));var util=require(_0xfa6b('0x1'));var moment=require('moment');var BPromise=require(_0xfa6b('0x2'));var rs=require(_0xfa6b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa6b('0x4'))['db'];var utils=require(_0xfa6b('0x5'));var logger=require(_0xfa6b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfa6b('0x7'));var client=jayson[_0xfa6b('0x8')][_0xfa6b('0x9')]({'port':0x232a});config['redis']=_[_0xfa6b('0xa')](config[_0xfa6b('0xb')],{'host':_0xfa6b('0xc'),'port':0x18eb});var socket=require(_0xfa6b('0xd'))(new Redis(config[_0xfa6b('0xb')]));require(_0xfa6b('0xe'))[_0xfa6b('0xf')](socket);function respondWithRpcPromise(_0x11ee17,_0x22dc98,_0x19c5c9){return new BPromise(function(_0x760879,_0x206e70){return client[_0xfa6b('0x10')](_0x11ee17,_0x19c5c9)[_0xfa6b('0x11')](function(_0x2b5fb9){logger['info'](_0xfa6b('0x12'),_0x22dc98,_0xfa6b('0x13'));logger[_0xfa6b('0x14')](_0xfa6b('0x15'),_0x22dc98,_0xfa6b('0x13'),JSON[_0xfa6b('0x16')](_0x2b5fb9));if(_0x2b5fb9['error']){if(_0x2b5fb9[_0xfa6b('0x17')][_0xfa6b('0x18')]===0x1f4){logger[_0xfa6b('0x17')](_0xfa6b('0x12'),_0x22dc98,_0x2b5fb9[_0xfa6b('0x17')]['message']);return _0x206e70(_0x2b5fb9[_0xfa6b('0x17')][_0xfa6b('0x19')]);}logger['error'](_0xfa6b('0x12'),_0x22dc98,_0x2b5fb9[_0xfa6b('0x17')]['message']);return _0x760879(_0x2b5fb9[_0xfa6b('0x17')][_0xfa6b('0x19')]);}else{logger[_0xfa6b('0x1a')](_0xfa6b('0x12'),_0x22dc98,'request\x20sent');_0x760879(_0x2b5fb9['result'][_0xfa6b('0x19')]);}})['catch'](function(_0x1bfb34){logger[_0xfa6b('0x17')]('SmsAccount,\x20%s,\x20%s',_0x22dc98,_0x1bfb34);_0x206e70(_0x1bfb34);});});}exports[_0xfa6b('0x1b')]=function(_0x49cf7a){var _0x40ab04=this;return new Promise(function(_0x22e8df,_0x2e8818){return db[_0xfa6b('0x1c')]['find']({'raw':_0x49cf7a[_0xfa6b('0x1d')]?_0x49cf7a['options'][_0xfa6b('0x1e')]===undefined?!![]:![]:!![],'where':_0x49cf7a[_0xfa6b('0x1d')]?_0x49cf7a[_0xfa6b('0x1d')][_0xfa6b('0x1f')]||null:null,'attributes':_0x49cf7a[_0xfa6b('0x1d')]?_0x49cf7a[_0xfa6b('0x1d')][_0xfa6b('0x20')]||null:null,'include':_0x49cf7a[_0xfa6b('0x1d')]?_0x49cf7a[_0xfa6b('0x1d')][_0xfa6b('0x21')]?_[_0xfa6b('0x22')](_0x49cf7a['options']['include'],function(_0x36c06d){return{'model':db[_0x36c06d[_0xfa6b('0x23')]],'as':_0x36c06d['as'],'attributes':_0x36c06d['attributes'],'include':_0x36c06d[_0xfa6b('0x21')]?_[_0xfa6b('0x22')](_0x36c06d['include'],function(_0x4520ae){return{'model':db[_0x4520ae[_0xfa6b('0x23')]],'as':_0x4520ae['as'],'attributes':_0x4520ae[_0xfa6b('0x20')],'include':_0x4520ae[_0xfa6b('0x21')]?_['map'](_0x4520ae[_0xfa6b('0x21')],function(_0x4c5ef7){return{'model':db[_0x4c5ef7[_0xfa6b('0x23')]],'as':_0x4c5ef7['as'],'attributes':_0x4c5ef7[_0xfa6b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfa6b('0x11')](function(_0x2d50ea){logger[_0xfa6b('0x1a')]('ShowSmsAccount',_0x49cf7a);logger[_0xfa6b('0x14')](_0xfa6b('0x1b'),_0x49cf7a,JSON[_0xfa6b('0x16')](_0x2d50ea));_0x22e8df(_0x2d50ea);})['catch'](function(_0x43670f){logger[_0xfa6b('0x17')](_0xfa6b('0x1b'),_0x43670f[_0xfa6b('0x19')],_0x49cf7a);_0x2e8818(_0x40ab04[_0xfa6b('0x17')](0x1f4,_0x43670f[_0xfa6b('0x19')]));});});}; \ No newline at end of file +var _0x77fa=['find','options','raw','where','attributes','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount'];(function(_0x43c648,_0x237795){var _0x2fe946=function(_0x51d165){while(--_0x51d165){_0x43c648['push'](_0x43c648['shift']());}};_0x2fe946(++_0x237795);}(_0x77fa,0x10b));var _0xa77f=function(_0x2f987c,_0xe896bb){_0x2f987c=_0x2f987c-0x0;var _0x4c994a=_0x77fa[_0x2f987c];return _0x4c994a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa77f('0x0'));var BPromise=require(_0xa77f('0x1'));var rs=require(_0xa77f('0x2'));var fs=require('fs');var Redis=require(_0xa77f('0x3'));var db=require(_0xa77f('0x4'))['db'];var utils=require(_0xa77f('0x5'));var logger=require(_0xa77f('0x6'))(_0xa77f('0x7'));var config=require(_0xa77f('0x8'));var jayson=require(_0xa77f('0x9'));var client=jayson['client'][_0xa77f('0xa')]({'port':0x232a});config[_0xa77f('0xb')]=_[_0xa77f('0xc')](config['redis'],{'host':_0xa77f('0xd'),'port':0x18eb});var socket=require(_0xa77f('0xe'))(new Redis(config[_0xa77f('0xb')]));require(_0xa77f('0xf'))[_0xa77f('0x10')](socket);function respondWithRpcPromise(_0x5468b6,_0x1eb6de,_0x4c2703){return new BPromise(function(_0x53fed0,_0x32ebef){return client['request'](_0x5468b6,_0x4c2703)[_0xa77f('0x11')](function(_0x1f6f3a){logger[_0xa77f('0x12')](_0xa77f('0x13'),_0x1eb6de,_0xa77f('0x14'));logger[_0xa77f('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1eb6de,_0xa77f('0x14'),JSON[_0xa77f('0x16')](_0x1f6f3a));if(_0x1f6f3a[_0xa77f('0x17')]){if(_0x1f6f3a[_0xa77f('0x17')][_0xa77f('0x18')]===0x1f4){logger[_0xa77f('0x17')](_0xa77f('0x13'),_0x1eb6de,_0x1f6f3a['error'][_0xa77f('0x19')]);return _0x32ebef(_0x1f6f3a[_0xa77f('0x17')][_0xa77f('0x19')]);}logger[_0xa77f('0x17')](_0xa77f('0x13'),_0x1eb6de,_0x1f6f3a[_0xa77f('0x17')][_0xa77f('0x19')]);return _0x53fed0(_0x1f6f3a[_0xa77f('0x17')][_0xa77f('0x19')]);}else{logger[_0xa77f('0x12')]('SmsAccount,\x20%s,\x20%s',_0x1eb6de,_0xa77f('0x14'));_0x53fed0(_0x1f6f3a['result'][_0xa77f('0x19')]);}})[_0xa77f('0x1a')](function(_0x377d4b){logger['error']('SmsAccount,\x20%s,\x20%s',_0x1eb6de,_0x377d4b);_0x32ebef(_0x377d4b);});});}exports[_0xa77f('0x1b')]=function(_0x599955){var _0x21ecb3=this;return new Promise(function(_0x14b34d,_0x15e9ed){return db[_0xa77f('0x1c')][_0xa77f('0x1d')]({'raw':_0x599955[_0xa77f('0x1e')]?_0x599955[_0xa77f('0x1e')][_0xa77f('0x1f')]===undefined?!![]:![]:!![],'where':_0x599955[_0xa77f('0x1e')]?_0x599955['options'][_0xa77f('0x20')]||null:null,'attributes':_0x599955[_0xa77f('0x1e')]?_0x599955[_0xa77f('0x1e')][_0xa77f('0x21')]||null:null,'include':_0x599955[_0xa77f('0x1e')]?_0x599955[_0xa77f('0x1e')][_0xa77f('0x22')]?_[_0xa77f('0x23')](_0x599955[_0xa77f('0x1e')][_0xa77f('0x22')],function(_0x1409f6){return{'model':db[_0x1409f6[_0xa77f('0x24')]],'as':_0x1409f6['as'],'attributes':_0x1409f6[_0xa77f('0x21')],'include':_0x1409f6[_0xa77f('0x22')]?_['map'](_0x1409f6['include'],function(_0x59dc27){return{'model':db[_0x59dc27[_0xa77f('0x24')]],'as':_0x59dc27['as'],'attributes':_0x59dc27[_0xa77f('0x21')],'include':_0x59dc27['include']?_[_0xa77f('0x23')](_0x59dc27['include'],function(_0x475701){return{'model':db[_0x475701[_0xa77f('0x24')]],'as':_0x475701['as'],'attributes':_0x475701[_0xa77f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa77f('0x11')](function(_0x1fae62){logger['info'](_0xa77f('0x1b'),_0x599955);logger[_0xa77f('0x15')]('ShowSmsAccount',_0x599955,JSON[_0xa77f('0x16')](_0x1fae62));_0x14b34d(_0x1fae62);})[_0xa77f('0x1a')](function(_0x26762d){logger['error']('ShowSmsAccount',_0x26762d[_0xa77f('0x19')],_0x599955);_0x15e9ed(_0x21ecb3[_0xa77f('0x17')](0x1f4,_0x26762d[_0xa77f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 661ac0e..27b0311 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 d2f73b9..ae16ff7 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x9feaaa,_0x1ae043){var _0x4eeda5=function(_0x17ceeb){while(--_0x17ceeb){_0x9feaaa['push'](_0x9feaaa['shift']());}};_0x4eeda5(++_0x1ae043);}(_0x55ca,0x126));var _0xa55c=function(_0x4b4340,_0x295fc0){_0x4b4340=_0x4b4340-0x0;var _0x4cdb42=_0x55ca[_0x4b4340];return _0x4cdb42;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +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(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 ff4b65c..86f91c3 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 _0x044b=['INTEGER','STRING','noop','*,*,*,*'];(function(_0x2ea0f1,_0x2590d0){var _0x35cea7=function(_0x434226){while(--_0x434226){_0x2ea0f1['push'](_0x2ea0f1['shift']());}};_0x35cea7(++_0x2590d0);}(_0x044b,0x188));var _0xb044=function(_0x43a5f1,_0x3bdecc){_0x43a5f1=_0x43a5f1-0x0;var _0x46e6b8=_0x044b[_0x43a5f1];return _0x46e6b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb044('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb044('0x1')],'allowNull':![],'defaultValue':_0xb044('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb044('0x3')}}; \ No newline at end of file +var _0x2182=['exports','TEXT','STRING'];(function(_0x34aec1,_0x3dfbae){var _0xd833e7=function(_0x8b803e){while(--_0x8b803e){_0x34aec1['push'](_0x34aec1['shift']());}};_0xd833e7(++_0x3dfbae);}(_0x2182,0x1c5));var _0x2218=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2182[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x2218('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2218('0x1')]()},'description':{'type':Sequelize[_0x2218('0x2')]},'interval':{'type':Sequelize[_0x2218('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 820ad17..8baa831 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 _0x0234=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','catch','show','find','create','body','params'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0234,0x12c));var _0x4023=function(_0x3a8114,_0x549ce8){_0x3a8114=_0x3a8114-0x0;var _0x4ebb2f=_0x0234[_0x3a8114];return _0x4ebb2f;};'use strict';var emlformat=require(_0x4023('0x0'));var rimraf=require(_0x4023('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4023('0x2'));var rp=require(_0x4023('0x3'));var moment=require(_0x4023('0x4'));var BPromise=require(_0x4023('0x5'));var Mustache=require(_0x4023('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4023('0x7'));var csv=require(_0x4023('0x8'));var ejs=require(_0x4023('0x9'));var fs=require('fs');var fs_extra=require(_0x4023('0xa'));var _=require(_0x4023('0xb'));var squel=require('squel');var crypto=require(_0x4023('0xc'));var jsforce=require(_0x4023('0xd'));var deskjs=require(_0x4023('0xe'));var toCsv=require(_0x4023('0x8'));var querystring=require(_0x4023('0xf'));var Papa=require('papaparse');var Redis=require(_0x4023('0x10'));var authService=require(_0x4023('0x11'));var qs=require(_0x4023('0x12'));var as=require(_0x4023('0x13'));var hardwareService=require(_0x4023('0x14'));var logger=require(_0x4023('0x15'))(_0x4023('0x16'));var utils=require(_0x4023('0x17'));var config=require(_0x4023('0x18'));var licenseUtil=require(_0x4023('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ffbcb,_0x32b31b){_0x32b31b=_0x32b31b||0xcc;return function(_0x2548ac){if(_0x2548ac){return _0x1ffbcb['sendStatus'](_0x32b31b);}return _0x1ffbcb[_0x4023('0x1a')](_0x32b31b)[_0x4023('0x1b')]();};}function respondWithResult(_0x1a6113,_0x348edc){_0x348edc=_0x348edc||0xc8;return function(_0x4c0224){if(_0x4c0224){return _0x1a6113[_0x4023('0x1a')](_0x348edc)[_0x4023('0x1c')](_0x4c0224);}};}function respondWithFilteredResult(_0x167665,_0x47d475){return function(_0xd7198){if(_0xd7198){var _0x5ea480=typeof _0x47d475[_0x4023('0x1d')]===_0x4023('0x1e')&&typeof _0x47d475[_0x4023('0x1f')]===_0x4023('0x1e');var _0xc41d6d=_0xd7198[_0x4023('0x20')];var _0x1a6fd4=_0x5ea480?0x0:_0x47d475[_0x4023('0x1d')];var _0x9114a=_0x5ea480?_0xd7198[_0x4023('0x20')]:_0x47d475[_0x4023('0x1d')]+_0x47d475['limit'];var _0x2c3896;if(_0x9114a>=_0xc41d6d){_0x9114a=_0xc41d6d;_0x2c3896=0xc8;}else{_0x2c3896=0xce;}_0x167665['status'](_0x2c3896);return _0x167665['set'](_0x4023('0x21'),_0x1a6fd4+'-'+_0x9114a+'/'+_0xc41d6d)[_0x4023('0x1c')](_0xd7198);}return null;};}function patchUpdates(_0x50b861){return function(_0x53efa9){try{jsonpatch[_0x4023('0x22')](_0x53efa9,_0x50b861,!![]);}catch(_0x54b51){return BPromise[_0x4023('0x23')](_0x54b51);}return _0x53efa9['save']();};}function saveUpdates(_0x46a95d,_0x264edd){return function(_0x2c9391){if(_0x2c9391){return _0x2c9391[_0x4023('0x24')](_0x46a95d)['then'](function(_0x52388d){return _0x52388d;});}return null;};}function removeEntity(_0x46e0ae,_0x373d33){return function(_0x3abc9b){if(_0x3abc9b){return _0x3abc9b[_0x4023('0x25')]()[_0x4023('0x26')](function(){_0x46e0ae[_0x4023('0x1a')](0xcc)[_0x4023('0x1b')]();});}};}function handleEntityNotFound(_0x127c19,_0x45ca09){return function(_0x33f3c8){if(!_0x33f3c8){_0x127c19[_0x4023('0x27')](0x194);}return _0x33f3c8;};}function handleError(_0x506c78,_0x3529a9){_0x3529a9=_0x3529a9||0x1f4;return function(_0x22b339){logger[_0x4023('0x28')](_0x22b339[_0x4023('0x29')]);if(_0x22b339[_0x4023('0x2a')]){delete _0x22b339[_0x4023('0x2a')];}_0x506c78[_0x4023('0x1a')](_0x3529a9)[_0x4023('0x2b')](_0x22b339);};}exports[_0x4023('0x2c')]=function(_0x2cbb5c,_0xd3ae08){var _0x205010={},_0x2d6fb6={},_0x59a35f={'count':0x0,'rows':[]};var _0x5c3cfc=_['map'](db[_0x4023('0x2d')][_0x4023('0x2e')],function(_0x280ad5){return{'name':_0x280ad5[_0x4023('0x2f')],'type':_0x280ad5[_0x4023('0x30')][_0x4023('0x31')]};});_0x2d6fb6[_0x4023('0x32')]=_['map'](_0x5c3cfc,_0x4023('0x2a'));_0x2d6fb6[_0x4023('0x33')]=_[_0x4023('0x34')](_0x2cbb5c[_0x4023('0x33')]);_0x2d6fb6[_0x4023('0x35')]=_[_0x4023('0x36')](_0x2d6fb6['model'],_0x2d6fb6[_0x4023('0x33')]);_0x205010[_0x4023('0x37')]=_[_0x4023('0x36')](_0x2d6fb6['model'],qs[_0x4023('0x38')](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x38')]));_0x205010[_0x4023('0x37')]=_0x205010[_0x4023('0x37')][_0x4023('0x39')]?_0x205010[_0x4023('0x37')]:_0x2d6fb6[_0x4023('0x32')];if(!_0x2cbb5c[_0x4023('0x33')][_0x4023('0x3a')](_0x4023('0x3b'))){_0x205010[_0x4023('0x1f')]=qs['limit'](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x1f')]);_0x205010[_0x4023('0x1d')]=qs[_0x4023('0x1d')](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x1d')]);}_0x205010[_0x4023('0x3c')]=qs[_0x4023('0x3d')](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x3d')]);_0x205010[_0x4023('0x3e')]=qs[_0x4023('0x35')](_['pick'](_0x2cbb5c[_0x4023('0x33')],_0x2d6fb6[_0x4023('0x35')]),_0x5c3cfc);if(_0x2cbb5c[_0x4023('0x33')][_0x4023('0x3f')]){_0x205010[_0x4023('0x3e')]=_[_0x4023('0x40')](_0x205010['where'],{'$or':_[_0x4023('0x41')](_0x5c3cfc,function(_0x1c77d8){if(_0x1c77d8[_0x4023('0x30')]!==_0x4023('0x42')){var _0x4080c3={};_0x4080c3[_0x1c77d8['name']]={'$like':'%'+_0x2cbb5c[_0x4023('0x33')]['filter']+'%'};return _0x4080c3;}})});}_0x205010=_[_0x4023('0x40')]({},_0x205010,_0x2cbb5c['options']);var _0x57042d={'where':_0x205010['where']};return db[_0x4023('0x2d')][_0x4023('0x20')](_0x57042d)[_0x4023('0x26')](function(_0x3b7c39){_0x59a35f[_0x4023('0x20')]=_0x3b7c39;if(_0x2cbb5c[_0x4023('0x33')][_0x4023('0x43')]){_0x205010[_0x4023('0x44')]=[{'all':!![]}];}return db[_0x4023('0x2d')]['findAll'](_0x205010);})['then'](function(_0x43bc3d){_0x59a35f['rows']=_0x43bc3d;return _0x59a35f;})[_0x4023('0x26')](respondWithFilteredResult(_0xd3ae08,_0x205010))[_0x4023('0x45')](handleError(_0xd3ae08,null));};exports[_0x4023('0x46')]=function(_0x7aad79,_0x15306e){var _0x24acb3={'raw':!![],'where':{'id':_0x7aad79['params']['id']}},_0x538fa2={};_0x538fa2[_0x4023('0x32')]=_['keys'](db[_0x4023('0x2d')][_0x4023('0x2e')]);_0x538fa2[_0x4023('0x33')]=_['keys'](_0x7aad79[_0x4023('0x33')]);_0x538fa2[_0x4023('0x35')]=_[_0x4023('0x36')](_0x538fa2['model'],_0x538fa2[_0x4023('0x33')]);_0x24acb3[_0x4023('0x37')]=_[_0x4023('0x36')](_0x538fa2[_0x4023('0x32')],qs['fields'](_0x7aad79['query'][_0x4023('0x38')]));_0x24acb3[_0x4023('0x37')]=_0x24acb3['attributes'][_0x4023('0x39')]?_0x24acb3[_0x4023('0x37')]:_0x538fa2['model'];if(_0x7aad79[_0x4023('0x33')][_0x4023('0x43')]){_0x24acb3[_0x4023('0x44')]=[{'all':!![]}];}_0x24acb3=_['merge']({},_0x24acb3,_0x7aad79['options']);return db[_0x4023('0x2d')][_0x4023('0x47')](_0x24acb3)['then'](handleEntityNotFound(_0x15306e,null))[_0x4023('0x26')](respondWithResult(_0x15306e,null))[_0x4023('0x45')](handleError(_0x15306e,null));};exports[_0x4023('0x48')]=function(_0x2a42c1,_0x4ee6b2){return db[_0x4023('0x2d')][_0x4023('0x48')](_0x2a42c1['body'],{})[_0x4023('0x26')](respondWithResult(_0x4ee6b2,0xc9))[_0x4023('0x45')](handleError(_0x4ee6b2,null));};exports[_0x4023('0x24')]=function(_0x238951,_0x349c4d){if(_0x238951[_0x4023('0x49')]['id']){delete _0x238951[_0x4023('0x49')]['id'];}return db[_0x4023('0x2d')][_0x4023('0x47')]({'where':{'id':_0x238951[_0x4023('0x4a')]['id']}})[_0x4023('0x26')](handleEntityNotFound(_0x349c4d,null))[_0x4023('0x26')](saveUpdates(_0x238951['body'],null))['then'](respondWithResult(_0x349c4d,null))[_0x4023('0x45')](handleError(_0x349c4d,null));};exports['destroy']=function(_0x134f21,_0x30aa60){return db['SmsApplication']['find']({'where':{'id':_0x134f21[_0x4023('0x4a')]['id']}})[_0x4023('0x26')](handleEntityNotFound(_0x30aa60,null))[_0x4023('0x26')](removeEntity(_0x30aa60,null))[_0x4023('0x45')](handleError(_0x30aa60,null));}; \ No newline at end of file +var _0x355f=['show','params','includeAll','merge','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','Content-Range','apply','reject','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','options','SmsApplication','count','include','findAll','rows','catch'];(function(_0xfeb34c,_0x371299){var _0x3b6ebb=function(_0x2ac97e){while(--_0x2ac97e){_0xfeb34c['push'](_0xfeb34c['shift']());}};_0x3b6ebb(++_0x371299);}(_0x355f,0x9a));var _0xf355=function(_0x7358c6,_0x48821f){_0x7358c6=_0x7358c6-0x0;var _0x41eaa7=_0x355f[_0x7358c6];return _0x41eaa7;};'use strict';var emlformat=require(_0xf355('0x0'));var rimraf=require(_0xf355('0x1'));var zipdir=require(_0xf355('0x2'));var jsonpatch=require(_0xf355('0x3'));var rp=require(_0xf355('0x4'));var moment=require(_0xf355('0x5'));var BPromise=require(_0xf355('0x6'));var Mustache=require('mustache');var util=require(_0xf355('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf355('0x8'));var ejs=require(_0xf355('0x9'));var fs=require('fs');var fs_extra=require(_0xf355('0xa'));var _=require('lodash');var squel=require(_0xf355('0xb'));var crypto=require('crypto');var jsforce=require(_0xf355('0xc'));var deskjs=require(_0xf355('0xd'));var toCsv=require(_0xf355('0x8'));var querystring=require('querystring');var Papa=require(_0xf355('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf355('0xf'));var hardwareService=require(_0xf355('0x10'));var logger=require(_0xf355('0x11'))(_0xf355('0x12'));var utils=require(_0xf355('0x13'));var config=require(_0xf355('0x14'));var licenseUtil=require(_0xf355('0x15'));var db=require(_0xf355('0x16'))['db'];function respondWithStatusCode(_0x346b12,_0x35f281){_0x35f281=_0x35f281||0xcc;return function(_0x42392b){if(_0x42392b){return _0x346b12[_0xf355('0x17')](_0x35f281);}return _0x346b12[_0xf355('0x18')](_0x35f281)['end']();};}function respondWithResult(_0x5ebcd8,_0x3807fe){_0x3807fe=_0x3807fe||0xc8;return function(_0x787d02){if(_0x787d02){return _0x5ebcd8[_0xf355('0x18')](_0x3807fe)[_0xf355('0x19')](_0x787d02);}};}function respondWithFilteredResult(_0x2f1dd0,_0x2341a9){return function(_0x58b982){if(_0x58b982){var _0x2755c9=typeof _0x2341a9['offset']===_0xf355('0x1a')&&typeof _0x2341a9['limit']===_0xf355('0x1a');var _0x14709a=_0x58b982['count'];var _0x413a84=_0x2755c9?0x0:_0x2341a9['offset'];var _0x9b099f=_0x2755c9?_0x58b982['count']:_0x2341a9[_0xf355('0x1b')]+_0x2341a9['limit'];var _0x188e6f;if(_0x9b099f>=_0x14709a){_0x9b099f=_0x14709a;_0x188e6f=0xc8;}else{_0x188e6f=0xce;}_0x2f1dd0[_0xf355('0x18')](_0x188e6f);return _0x2f1dd0['set'](_0xf355('0x1c'),_0x413a84+'-'+_0x9b099f+'/'+_0x14709a)[_0xf355('0x19')](_0x58b982);}return null;};}function patchUpdates(_0x2ab1bc){return function(_0xa076d8){try{jsonpatch[_0xf355('0x1d')](_0xa076d8,_0x2ab1bc,!![]);}catch(_0x5e6dde){return BPromise[_0xf355('0x1e')](_0x5e6dde);}return _0xa076d8['save']();};}function saveUpdates(_0x229d2f,_0x29450f){return function(_0x59c4f9){if(_0x59c4f9){return _0x59c4f9['update'](_0x229d2f)[_0xf355('0x1f')](function(_0x1d34cd){return _0x1d34cd;});}return null;};}function removeEntity(_0x1c8fa1,_0x1395ae){return function(_0x2292c0){if(_0x2292c0){return _0x2292c0[_0xf355('0x20')]()[_0xf355('0x1f')](function(){_0x1c8fa1[_0xf355('0x18')](0xcc)[_0xf355('0x21')]();});}};}function handleEntityNotFound(_0x448a59,_0x20a4f1){return function(_0x39b260){if(!_0x39b260){_0x448a59[_0xf355('0x17')](0x194);}return _0x39b260;};}function handleError(_0x1877ed,_0x54258c){_0x54258c=_0x54258c||0x1f4;return function(_0x434efe){logger[_0xf355('0x22')](_0x434efe['stack']);if(_0x434efe[_0xf355('0x23')]){delete _0x434efe['name'];}_0x1877ed[_0xf355('0x18')](_0x54258c)[_0xf355('0x24')](_0x434efe);};}exports[_0xf355('0x25')]=function(_0x5f39ac,_0x5bebb9){var _0x54cb15={},_0x5c6541={},_0x584ba0={'count':0x0,'rows':[]};var _0x12c930=_[_0xf355('0x26')](db['SmsApplication'][_0xf355('0x27')],function(_0x31228b){return{'name':_0x31228b[_0xf355('0x28')],'type':_0x31228b['type'][_0xf355('0x29')]};});_0x5c6541[_0xf355('0x2a')]=_['map'](_0x12c930,_0xf355('0x23'));_0x5c6541[_0xf355('0x2b')]=_[_0xf355('0x2c')](_0x5f39ac[_0xf355('0x2b')]);_0x5c6541[_0xf355('0x2d')]=_[_0xf355('0x2e')](_0x5c6541['model'],_0x5c6541[_0xf355('0x2b')]);_0x54cb15[_0xf355('0x2f')]=_['intersection'](_0x5c6541[_0xf355('0x2a')],qs['fields'](_0x5f39ac[_0xf355('0x2b')][_0xf355('0x30')]));_0x54cb15['attributes']=_0x54cb15[_0xf355('0x2f')]['length']?_0x54cb15[_0xf355('0x2f')]:_0x5c6541[_0xf355('0x2a')];if(!_0x5f39ac[_0xf355('0x2b')][_0xf355('0x31')](_0xf355('0x32'))){_0x54cb15[_0xf355('0x33')]=qs['limit'](_0x5f39ac['query'][_0xf355('0x33')]);_0x54cb15['offset']=qs['offset'](_0x5f39ac[_0xf355('0x2b')][_0xf355('0x1b')]);}_0x54cb15[_0xf355('0x34')]=qs[_0xf355('0x35')](_0x5f39ac[_0xf355('0x2b')][_0xf355('0x35')]);_0x54cb15[_0xf355('0x36')]=qs[_0xf355('0x2d')](_['pick'](_0x5f39ac[_0xf355('0x2b')],_0x5c6541[_0xf355('0x2d')]),_0x12c930);if(_0x5f39ac[_0xf355('0x2b')][_0xf355('0x37')]){_0x54cb15['where']=_['merge'](_0x54cb15[_0xf355('0x36')],{'$or':_['map'](_0x12c930,function(_0x2ef72f){if(_0x2ef72f[_0xf355('0x38')]!==_0xf355('0x39')){var _0x3d72b5={};_0x3d72b5[_0x2ef72f[_0xf355('0x23')]]={'$like':'%'+_0x5f39ac[_0xf355('0x2b')][_0xf355('0x37')]+'%'};return _0x3d72b5;}})});}_0x54cb15=_['merge']({},_0x54cb15,_0x5f39ac[_0xf355('0x3a')]);var _0x3bbb94={'where':_0x54cb15['where']};return db[_0xf355('0x3b')][_0xf355('0x3c')](_0x3bbb94)['then'](function(_0x2d0171){_0x584ba0[_0xf355('0x3c')]=_0x2d0171;if(_0x5f39ac[_0xf355('0x2b')]['includeAll']){_0x54cb15[_0xf355('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0xf355('0x3e')](_0x54cb15);})[_0xf355('0x1f')](function(_0x213302){_0x584ba0[_0xf355('0x3f')]=_0x213302;return _0x584ba0;})[_0xf355('0x1f')](respondWithFilteredResult(_0x5bebb9,_0x54cb15))[_0xf355('0x40')](handleError(_0x5bebb9,null));};exports[_0xf355('0x41')]=function(_0x3b3732,_0xc6eb7d){var _0xd812b6={'raw':!![],'where':{'id':_0x3b3732[_0xf355('0x42')]['id']}},_0x1f01bd={};_0x1f01bd['model']=_[_0xf355('0x2c')](db['SmsApplication'][_0xf355('0x27')]);_0x1f01bd[_0xf355('0x2b')]=_[_0xf355('0x2c')](_0x3b3732['query']);_0x1f01bd[_0xf355('0x2d')]=_[_0xf355('0x2e')](_0x1f01bd['model'],_0x1f01bd['query']);_0xd812b6[_0xf355('0x2f')]=_[_0xf355('0x2e')](_0x1f01bd[_0xf355('0x2a')],qs[_0xf355('0x30')](_0x3b3732[_0xf355('0x2b')][_0xf355('0x30')]));_0xd812b6[_0xf355('0x2f')]=_0xd812b6[_0xf355('0x2f')]['length']?_0xd812b6[_0xf355('0x2f')]:_0x1f01bd['model'];if(_0x3b3732['query'][_0xf355('0x43')]){_0xd812b6[_0xf355('0x3d')]=[{'all':!![]}];}_0xd812b6=_[_0xf355('0x44')]({},_0xd812b6,_0x3b3732['options']);return db[_0xf355('0x3b')][_0xf355('0x45')](_0xd812b6)['then'](handleEntityNotFound(_0xc6eb7d,null))[_0xf355('0x1f')](respondWithResult(_0xc6eb7d,null))[_0xf355('0x40')](handleError(_0xc6eb7d,null));};exports[_0xf355('0x46')]=function(_0x547a77,_0x431caf){return db[_0xf355('0x3b')][_0xf355('0x46')](_0x547a77[_0xf355('0x47')],{})[_0xf355('0x1f')](respondWithResult(_0x431caf,0xc9))[_0xf355('0x40')](handleError(_0x431caf,null));};exports[_0xf355('0x48')]=function(_0x54b6c9,_0xd6c6ad){if(_0x54b6c9['body']['id']){delete _0x54b6c9[_0xf355('0x47')]['id'];}return db[_0xf355('0x3b')][_0xf355('0x45')]({'where':{'id':_0x54b6c9[_0xf355('0x42')]['id']}})[_0xf355('0x1f')](handleEntityNotFound(_0xd6c6ad,null))['then'](saveUpdates(_0x54b6c9[_0xf355('0x47')],null))[_0xf355('0x1f')](respondWithResult(_0xd6c6ad,null))[_0xf355('0x40')](handleError(_0xd6c6ad,null));};exports[_0xf355('0x20')]=function(_0x596a00,_0x56ee53){return db[_0xf355('0x3b')][_0xf355('0x45')]({'where':{'id':_0x596a00['params']['id']}})[_0xf355('0x1f')](handleEntityNotFound(_0x56ee53,null))['then'](removeEntity(_0x56ee53,null))['catch'](handleError(_0x56ee53,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1f15ea0..7b9de5c 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 _0x52e1=['request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','../../config/logger','moment'];(function(_0x194cee,_0x5184f1){var _0x5954df=function(_0x41f3f1){while(--_0x41f3f1){_0x194cee['push'](_0x194cee['shift']());}};_0x5954df(++_0x5184f1);}(_0x52e1,0xb9));var _0x152e=function(_0x29975a,_0x2ca253){_0x29975a=_0x29975a-0x0;var _0x41bcac=_0x52e1[_0x29975a];return _0x41bcac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x152e('0x0'))('api');var moment=require(_0x152e('0x1'));var BPromise=require('bluebird');var rp=require(_0x152e('0x2'));var fs=require('fs');var path=require(_0x152e('0x3'));var rimraf=require(_0x152e('0x4'));var config=require(_0x152e('0x5'));var attributes=require(_0x152e('0x6'));module[_0x152e('0x7')]=function(_0x2fb082,_0x2b3818){return _0x2fb082[_0x152e('0x8')](_0x152e('0x9'),attributes,{'tableName':_0x152e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc5dd=['define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','../../config/environment','exports'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xc5dd,0x170));var _0xdc5d=function(_0x403257,_0x481841){_0x403257=_0x403257-0x0;var _0xa38ef0=_0xc5dd[_0x403257];return _0xa38ef0;};'use strict';var _=require(_0xdc5d('0x0'));var util=require(_0xdc5d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdc5d('0x2'));var rp=require(_0xdc5d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdc5d('0x4'));var attributes=require('./smsApplication.attributes');module[_0xdc5d('0x5')]=function(_0xd0bcd1,_0x240792){return _0xd0bcd1[_0xdc5d('0x6')](_0xdc5d('0x7'),attributes,{'tableName':_0xdc5d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdc5d('0x9'),'collate':_0xdc5d('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index d2b614f..e1a5050 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 _0xe056=['code','message','info','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17e498,_0x48989c){var _0x4cd515=function(_0x5a84c8){while(--_0x5a84c8){_0x17e498['push'](_0x17e498['shift']());}};_0x4cd515(++_0x48989c);}(_0xe056,0xdb));var _0x6e05=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xe056[_0x57e00e];return _0x415e60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e05('0x0'));var BPromise=require(_0x6e05('0x1'));var rs=require(_0x6e05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e05('0x4'))(_0x6e05('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e05('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x390bb6,_0x1c78eb,_0x5dacb2){return new BPromise(function(_0x1a54b7,_0x177b2c){return client[_0x6e05('0x7')](_0x390bb6,_0x5dacb2)[_0x6e05('0x8')](function(_0x13af56){logger['info'](_0x6e05('0x9'),_0x1c78eb,_0x6e05('0xa'));logger[_0x6e05('0xb')](_0x6e05('0xc'),_0x1c78eb,_0x6e05('0xa'),JSON[_0x6e05('0xd')](_0x13af56));if(_0x13af56['error']){if(_0x13af56[_0x6e05('0xe')][_0x6e05('0xf')]===0x1f4){logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);return _0x177b2c(_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);}logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);return _0x1a54b7(_0x13af56['error']['message']);}else{logger[_0x6e05('0x11')](_0x6e05('0x9'),_0x1c78eb,_0x6e05('0xa'));_0x1a54b7(_0x13af56['result'][_0x6e05('0x10')]);}})['catch'](function(_0x3c3ef0){logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x3c3ef0);_0x177b2c(_0x3c3ef0);});});} \ No newline at end of file +var _0x6dc0=['rpc','../../config/environment','client','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x46ad9a,_0x6e901a){var _0x2d3f54=function(_0x3285fd){while(--_0x3285fd){_0x46ad9a['push'](_0x46ad9a['shift']());}};_0x2d3f54(++_0x6e901a);}(_0x6dc0,0xb6));var _0x06dc=function(_0x2dcec9,_0x295456){_0x2dcec9=_0x2dcec9-0x0;var _0x15ce19=_0x6dc0[_0x2dcec9];return _0x15ce19;};'use strict';var _=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var moment=require(_0x06dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x06dc('0x3'));var fs=require('fs');var Redis=require(_0x06dc('0x4'));var db=require(_0x06dc('0x5'))['db'];var utils=require(_0x06dc('0x6'));var logger=require('../../config/logger')(_0x06dc('0x7'));var config=require(_0x06dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419534,_0x3212ca,_0x14c15b){return new BPromise(function(_0x10e23b,_0x140eef){return client['request'](_0x419534,_0x14c15b)['then'](function(_0x480f30){logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,'request\x20sent');logger[_0x06dc('0xc')](_0x06dc('0xd'),_0x3212ca,_0x06dc('0xe'),JSON[_0x06dc('0xf')](_0x480f30));if(_0x480f30['error']){if(_0x480f30[_0x06dc('0x10')][_0x06dc('0x11')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x3212ca,_0x480f30['error']['message']);return _0x140eef(_0x480f30[_0x06dc('0x10')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x3212ca,_0x480f30[_0x06dc('0x10')][_0x06dc('0x12')]);return _0x10e23b(_0x480f30[_0x06dc('0x10')]['message']);}else{logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,_0x06dc('0xe'));_0x10e23b(_0x480f30[_0x06dc('0x13')]['message']);}})[_0x06dc('0x14')](function(_0x30c1c5){logger[_0x06dc('0x10')](_0x06dc('0xb'),_0x3212ca,_0x30c1c5);_0x140eef(_0x30c1c5);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index fae4755..801ab95 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 _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x4eca3d,_0xa3c2be){var _0x355f3f=function(_0x2ff4bb){while(--_0x2ff4bb){_0x4eca3d['push'](_0x4eca3d['shift']());}};_0x355f3f(++_0xa3c2be);}(_0x13f6,0x124));var _0x613f=function(_0x498925,_0x28ae72){_0x498925=_0x498925-0x0;var _0x2fbaf1=_0x13f6[_0x498925];return _0x2fbaf1;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['get'](_0x613f('0xf'),auth[_0x613f('0x8')](),controller[_0x613f('0x10')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),interaction[_0x613f('0x15')](_0x613f('0x16'),_0x613f('0x17')),controller[_0x613f('0x18')]);router[_0x613f('0x19')](_0x613f('0xb'),auth['isAuthenticated'](),interaction[_0x613f('0x15')]('sms','smsinteraction:update'),controller[_0x613f('0x1a')]);router[_0x613f('0x1b')]('/:id',auth[_0x613f('0x8')](),interaction['tracked'](_0x613f('0x16'),_0x613f('0x1c')),controller[_0x613f('0x1d')]);router[_0x613f('0x1b')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x4e24e6,_0x5c021c){var _0x12ae9d=function(_0x55448c){while(--_0x55448c){_0x4e24e6['push'](_0x4e24e6['shift']());}};_0x12ae9d(++_0x5c021c);}(_0x7708,0x188));var _0x8770=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0x7708[_0x1b5a05];return _0x347931;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index b01bf74..ba7f430 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 _0xf6c1=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0xf7359d,_0x22411f){var _0x1e2429=function(_0x5cc9c5){while(--_0x5cc9c5){_0xf7359d['push'](_0xf7359d['shift']());}};_0x1e2429(++_0x22411f);}(_0xf6c1,0x99));var _0x1f6c=function(_0x29d4f5,_0x1d8d1b){_0x29d4f5=_0x29d4f5-0x0;var _0x343c1a=_0xf6c1[_0x29d4f5];return _0x343c1a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1f6c('0x0')]={'closed':{'type':Sequelize[_0x1f6c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1f6c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1f6c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1f6c('0x3')]},'phone':{'type':Sequelize[_0x1f6c('0x3')]},'read1stAt':{'type':Sequelize[_0x1f6c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1f6c('0x4')]('in',_0x1f6c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1f6c('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1f6c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1f6c('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x6bac=['DATE','STRING','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0x535f9b,_0x1cf960){var _0x981102=function(_0xd61914){while(--_0xd61914){_0x535f9b['push'](_0x535f9b['shift']());}};_0x981102(++_0x1cf960);}(_0x6bac,0xa5));var _0xc6ba=function(_0x63c4ee,_0x2d652f){_0x63c4ee=_0x63c4ee-0x0;var _0x1cc26d=_0x6bac[_0x63c4ee];return _0x1cc26d;};'use strict';var Sequelize=require(_0xc6ba('0x0'));var moment=require('moment');module[_0xc6ba('0x1')]={'closed':{'type':Sequelize[_0xc6ba('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc6ba('0x3')]},'disposition':{'type':Sequelize[_0xc6ba('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc6ba('0x4')]},'read1stAt':{'type':Sequelize[_0xc6ba('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc6ba('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc6ba('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc6ba('0x6')]('in',_0xc6ba('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc6ba('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 7c821fa..9f0e100 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 _0xb3dc=['intersection','attributes','fields','length','nolimit','sort','where','pick','filters','select','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','buildExpression','text','keys','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','all','params','rawAttributes','includeAll','include','options','create','body','describe','addMessage','ids','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','findAll','rows','setTags','omit','spread','emit','smsInteractionTags:save','download','unix','join','files','tmp','server','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','direction','secret','SmsAccount','Owner','get','Sms','Account','N.A.','closedAt','disposition','out','System','renderFile','root','views','downloadInteraction.ejs','transcript-','err','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','end','sendStatus','error','stack','name','Users','map','TagIds','Tags','forEach','catch','waiting','talking','answered','unmanaged','closed','UserId','total','index','SmsInteraction','fieldName','type','key','model','query'];(function(_0x59fbb4,_0x4b63ee){var _0x19a8d8=function(_0x2847b8){while(--_0x2847b8){_0x59fbb4['push'](_0x59fbb4['shift']());}};_0x19a8d8(++_0x4b63ee);}(_0xb3dc,0xab));var _0xcb3d=function(_0x4607a4,_0x2cc9c9){_0x4607a4=_0x4607a4-0x0;var _0x1d7679=_0xb3dc[_0x4607a4];return _0x1d7679;};'use strict';var emlformat=require(_0xcb3d('0x0'));var rimraf=require(_0xcb3d('0x1'));var zipdir=require(_0xcb3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcb3d('0x3'));var BPromise=require(_0xcb3d('0x4'));var Mustache=require(_0xcb3d('0x5'));var util=require('util');var path=require(_0xcb3d('0x6'));var sox=require(_0xcb3d('0x7'));var csv=require(_0xcb3d('0x8'));var ejs=require(_0xcb3d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcb3d('0xa'));var crypto=require(_0xcb3d('0xb'));var jsforce=require(_0xcb3d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcb3d('0xd'));var Papa=require(_0xcb3d('0xe'));var Redis=require(_0xcb3d('0xf'));var authService=require(_0xcb3d('0x10'));var qs=require(_0xcb3d('0x11'));var as=require(_0xcb3d('0x12'));var pdf=require(_0xcb3d('0x13'));var hardwareService=require(_0xcb3d('0x14'));var logger=require(_0xcb3d('0x15'))(_0xcb3d('0x16'));var utils=require(_0xcb3d('0x17'));var config=require(_0xcb3d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb3d('0x19'))['db'];config[_0xcb3d('0x1a')]=_[_0xcb3d('0x1b')](config[_0xcb3d('0x1a')],{'host':_0xcb3d('0x1c'),'port':0x18eb});var socket=require(_0xcb3d('0x1d'))(new Redis(config[_0xcb3d('0x1a')]));require(_0xcb3d('0x1e'))[_0xcb3d('0x1f')](socket);function respondWithStatusCode(_0x6abbc8,_0x5b36e8){_0x5b36e8=_0x5b36e8||0xcc;return function(_0x7b3a96){if(_0x7b3a96){return _0x6abbc8['sendStatus'](_0x5b36e8);}return _0x6abbc8[_0xcb3d('0x20')](_0x5b36e8)['end']();};}function respondWithResult(_0x49808b,_0x4c7037){_0x4c7037=_0x4c7037||0xc8;return function(_0x433ec2){if(_0x433ec2){return _0x49808b['status'](_0x4c7037)['json'](_0x433ec2);}};}function respondWithFilteredResult(_0x57d92a,_0x274b35){return function(_0x37ad9f){if(_0x37ad9f){var _0x242a1b=typeof _0x274b35[_0xcb3d('0x21')]===_0xcb3d('0x22')&&typeof _0x274b35[_0xcb3d('0x23')]===_0xcb3d('0x22');var _0x2acce1=_0x37ad9f['count'];var _0x5b47b1=_0x242a1b?0x0:_0x274b35['offset'];var _0x424cea=_0x242a1b?_0x37ad9f[_0xcb3d('0x24')]:_0x274b35['offset']+_0x274b35[_0xcb3d('0x23')];var _0x5e3186;if(_0x424cea>=_0x2acce1){_0x424cea=_0x2acce1;_0x5e3186=0xc8;}else{_0x5e3186=0xce;}_0x57d92a[_0xcb3d('0x20')](_0x5e3186);return _0x57d92a['set'](_0xcb3d('0x25'),_0x5b47b1+'-'+_0x424cea+'/'+_0x2acce1)[_0xcb3d('0x26')](_0x37ad9f);}return null;};}function patchUpdates(_0x3fde17){return function(_0x4d0fd7){try{jsonpatch[_0xcb3d('0x27')](_0x4d0fd7,_0x3fde17,!![]);}catch(_0x35429c){return BPromise['reject'](_0x35429c);}return _0x4d0fd7['save']();};}function saveUpdates(_0x4b3dc4,_0x2f97dd){return function(_0x177a12){if(_0x177a12){return _0x177a12[_0xcb3d('0x28')](_0x4b3dc4)[_0xcb3d('0x29')](function(_0x3419c8){return _0x3419c8;});}return null;};}function removeEntity(_0x56002a,_0x16738f){return function(_0x21f84f){if(_0x21f84f){return _0x21f84f[_0xcb3d('0x2a')]()['then'](function(){_0x56002a[_0xcb3d('0x20')](0xcc)[_0xcb3d('0x2b')]();});}};}function handleEntityNotFound(_0x21f128,_0x347eac){return function(_0x1e80f2){if(!_0x1e80f2){_0x21f128[_0xcb3d('0x2c')](0x194);}return _0x1e80f2;};}function handleError(_0x59cabd,_0x21749b){_0x21749b=_0x21749b||0x1f4;return function(_0x27cef2){logger[_0xcb3d('0x2d')](_0x27cef2[_0xcb3d('0x2e')]);if(_0x27cef2[_0xcb3d('0x2f')]){delete _0x27cef2[_0xcb3d('0x2f')];}_0x59cabd['status'](_0x21749b)['send'](_0x27cef2);};}function getInteractionUsers(_0x3a4884,_0x1d4014){return new BPromise(function(_0x42ccc1,_0xcc6fd4){try{if(_0x1d4014[_0x3a4884['id']]){_0x3a4884[_0xcb3d('0x30')]=_[_0xcb3d('0x31')](_0x1d4014[_0x3a4884['id']],function(_0x10203a){return{'id':_0x10203a['id'],'fullname':_0x10203a['fullname']};});}}catch(_0x303b63){_0xcc6fd4(_0x303b63);}_0x42ccc1(_0x3a4884);});}function getInteractionTags(_0x49e868,_0x68c5c3){return new BPromise(function(_0x231532,_0x2c0b5a){try{if(_0x49e868[_0xcb3d('0x32')]){_0x49e868[_0xcb3d('0x33')]=[];_0x49e868['TagIds']['split'](',')[_0xcb3d('0x34')](function(_0x4de29c){_0x49e868[_0xcb3d('0x33')]['push'](_0x68c5c3[_0x4de29c]);});}delete _0x49e868[_0xcb3d('0x32')];}catch(_0x44b3e9){_0x2c0b5a(_0x44b3e9);}_0x231532(_0x49e868);});}function updateSmsInteraction(_0x4134f7,_0x4780a2,_0x18a3bb){return new BPromise(function(_0x49104c,_0x159ba6){return getInteractionUsers(_0x4134f7,_0x18a3bb)['then'](function(_0xa630b){return getInteractionTags(_0xa630b,_0x4780a2);})[_0xcb3d('0x29')](function(_0x443420){return getStateInteraction(_0x443420);})[_0xcb3d('0x29')](function(_0x30716a){_0x49104c(_0x30716a);})[_0xcb3d('0x35')](function(_0x498a7d){_0x159ba6(_0x498a7d);});});}function getStateInteraction(_0x45466d){return new BPromise(function(_0x131ef9){_0x45466d[_0xcb3d('0x36')]=0x0;_0x45466d[_0xcb3d('0x37')]=0x0;_0x45466d[_0xcb3d('0x38')]=0x0;_0x45466d[_0xcb3d('0x39')]=0x0;_0x45466d['total']=0x0;if(!_0x45466d['closed']&&!_0x45466d['UserId']){_0x45466d[_0xcb3d('0x36')]+=0x1;}if(!_0x45466d[_0xcb3d('0x3a')]&&_0x45466d['UserId']){_0x45466d[_0xcb3d('0x37')]+=0x1;if(_0x45466d[_0xcb3d('0x36')]){_0x45466d['waiting']-=0x1;}}if(_0x45466d[_0xcb3d('0x3a')]&&_0x45466d[_0xcb3d('0x3b')]){_0x45466d[_0xcb3d('0x38')]+=0x1;if(_0x45466d[_0xcb3d('0x37')]){_0x45466d[_0xcb3d('0x37')]-=0x1;}}if(_0x45466d[_0xcb3d('0x3a')]&&!_0x45466d['UserId']){_0x45466d[_0xcb3d('0x39')]+=0x1;if(_0x45466d['waiting']){_0x45466d[_0xcb3d('0x36')]-=0x1;}}_0x45466d[_0xcb3d('0x3c')]+=0x1;_0x131ef9(_0x45466d);});}exports[_0xcb3d('0x3d')]=function(_0x12da25,_0x3b2f30){var _0x163f2d={},_0x5d5e7e={},_0x22dc29={'count':0x0,'rows':[]};var _0x6c5eac=_['map'](db[_0xcb3d('0x3e')]['rawAttributes'],function(_0x307528){return{'name':_0x307528[_0xcb3d('0x3f')],'type':_0x307528[_0xcb3d('0x40')][_0xcb3d('0x41')]};});_0x5d5e7e[_0xcb3d('0x42')]=_[_0xcb3d('0x31')](_0x6c5eac,_0xcb3d('0x2f'));_0x5d5e7e[_0xcb3d('0x43')]=_['keys'](_0x12da25[_0xcb3d('0x43')]);_0x5d5e7e['filters']=_[_0xcb3d('0x44')](_0x5d5e7e[_0xcb3d('0x42')],_0x5d5e7e[_0xcb3d('0x43')]);_0x163f2d[_0xcb3d('0x45')]=_[_0xcb3d('0x44')](_0x5d5e7e['model'],qs[_0xcb3d('0x46')](_0x12da25['query'][_0xcb3d('0x46')]));_0x163f2d[_0xcb3d('0x45')]=_0x163f2d[_0xcb3d('0x45')][_0xcb3d('0x47')]?_0x163f2d['attributes']:_0x5d5e7e[_0xcb3d('0x42')];if(!_0x12da25[_0xcb3d('0x43')]['hasOwnProperty'](_0xcb3d('0x48'))){_0x163f2d[_0xcb3d('0x23')]=qs[_0xcb3d('0x23')](_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x23')]);_0x163f2d[_0xcb3d('0x21')]=qs['offset'](_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x21')]);}_0x163f2d['order']=qs[_0xcb3d('0x49')](_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x49')]);_0x163f2d[_0xcb3d('0x4a')]=qs['filters'](_[_0xcb3d('0x4b')](_0x12da25[_0xcb3d('0x43')],_0x5d5e7e[_0xcb3d('0x4c')]),_0x6c5eac);var _0x38c555=[];var _0x4cea0f=squel[_0xcb3d('0x4d')]()[_0xcb3d('0x4e')]('id')['field']('name')[_0xcb3d('0x4e')](_0xcb3d('0x4f'))['from'](_0xcb3d('0x50'));var _0x399a96=squel[_0xcb3d('0x4d')]()['field'](_0xcb3d('0x51'))[_0xcb3d('0x4e')](_0xcb3d('0x52'))['field'](_0xcb3d('0x53'))[_0xcb3d('0x54')](_0xcb3d('0x55'),'ui')[_0xcb3d('0x56')](_0xcb3d('0x57'),'u',_0xcb3d('0x58'));var _0x4f7419=squel[_0xcb3d('0x4d')]()[_0xcb3d('0x54')](_0xcb3d('0x59'),'i')[_0xcb3d('0x56')](_0xcb3d('0x5a'),'c',_0xcb3d('0x5b'))[_0xcb3d('0x56')](_0xcb3d('0x57'),'o',_0xcb3d('0x5c'))[_0xcb3d('0x56')]('sms_accounts','a',_0xcb3d('0x5d'))[_0xcb3d('0x56')]('sms_messages','me',_0xcb3d('0x5e'))[_0xcb3d('0x56')](_0xcb3d('0x5f'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xcb3d('0x50'),'t','t.id\x20=\x20it.TagId');var _0xb28e38=squel[_0xcb3d('0x60')]();var _0x2fca4d=[];var _0x38ea30=squel['expr']();var _0x4bcd56;if(_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x61')]){_0x4bcd56=as[_0xcb3d('0x62')](_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x61')]);var _0x59ada1=_0x4bcd56[_0xcb3d('0x63')];for(var _0x4ac205=0x0;_0x4ac205<_0x4bcd56[_0xcb3d('0x64')]['length'];_0x4ac205++){var _0x171776=_0x4bcd56['conditions'][_0x4ac205];var _0x35dcf7='i';var _0x38c961=_[_0xcb3d('0x65')](_0x6c5eac,[_0xcb3d('0x2f'),_0x171776[_0xcb3d('0x4e')]]);if(!_0x38c961){switch(_0x171776[_0xcb3d('0x4e')]){case _0xcb3d('0x66'):if(_0x171776[_0xcb3d('0x67')]==0x1){_0x4f7419[_0xcb3d('0x68')]('`'+_0x171776['field']+'`\x20=\x200');}else{_0x4f7419[_0xcb3d('0x68')]('`'+_0x171776['field']+_0xcb3d('0x69'));}break;case _0xcb3d('0x6a'):if(_0x171776[_0xcb3d('0x6b')]===_0xcb3d('0x6c')){if(_0x171776['value'][_0xcb3d('0x6d')]('\x20')[_0xcb3d('0x47')]>0x1){_0xb28e38[_0x59ada1](_0xcb3d('0x6e'),qs[_0xcb3d('0x6f')](_0x171776[_0xcb3d('0x67')]),null);}else{var _0x3f5323='%'+_0x171776[_0xcb3d('0x67')]+'%';_0xb28e38[_0x59ada1](_0xcb3d('0x70'),_0x3f5323,_0x3f5323,_0x3f5323);}}else{_0x38c961=_[_0xcb3d('0x65')](_0x6c5eac,[_0xcb3d('0x2f'),_0xcb3d('0x71')]);_0x171776['field']=_0xcb3d('0x71');_0x4bcdd0=as['buildExpression'](_0x35dcf7,_0x38c961[_0xcb3d('0x40')],_0x171776);_0xb28e38[_0x59ada1](_0x4bcdd0['text'],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x72')],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x2b')]);}break;case _0xcb3d('0x73'):var _0x21ace9=_0x171776['value'][_0xcb3d('0x6d')](',')[_0xcb3d('0x31')](function(_0x2f5b37){return Number(_0x2f5b37);});_0x21ace9[_0xcb3d('0x34')](function(_0x1bf9ec){_0x38ea30['or'](_0xcb3d('0x74'),'%,'+_0x1bf9ec+',%');});_0x2fca4d=_[_0xcb3d('0x75')](_0x2fca4d,_0x21ace9);break;case _0xcb3d('0x76'):if(_0x171776[_0xcb3d('0x6b')]===_0xcb3d('0x6c')){_0xb28e38[_0x59ada1]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x171776[_0xcb3d('0x67')]+'%',null);}else{_0x38c961=_[_0xcb3d('0x65')](_0x6c5eac,[_0xcb3d('0x2f'),_0xcb3d('0x3b')]);_0x171776[_0xcb3d('0x4e')]=_0xcb3d('0x3b');_0x4bcdd0=as[_0xcb3d('0x77')](_0x35dcf7,_0x38c961[_0xcb3d('0x40')],_0x171776);_0xb28e38[_0x59ada1](_0x4bcdd0[_0xcb3d('0x78')],_0x4bcdd0[_0xcb3d('0x67')]['start'],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x2b')]);}break;case'body':_0x4bcdd0=as[_0xcb3d('0x77')]('me',null,_0x171776);_0xb28e38[_0x59ada1](_0x4bcdd0[_0xcb3d('0x78')],_0x4bcdd0[_0xcb3d('0x67')]['start'],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x2b')]);break;}}else{var _0x4bcdd0=as[_0xcb3d('0x77')](_0x35dcf7,_0x38c961[_0xcb3d('0x40')],_0x171776);_0xb28e38[_0x59ada1](_0x4bcdd0[_0xcb3d('0x78')],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x72')],_0x4bcdd0[_0xcb3d('0x67')]['end']);}}}else{var _0x23f6de=_(_0x12da25['query'])[_0xcb3d('0x79')]()[_0xcb3d('0x31')](function(_0x126e6d){return _[_0xcb3d('0x7a')](_0x6c5eac,[_0xcb3d('0x2f'),_0x126e6d])?_0x126e6d:undefined;})['compact']()[_0xcb3d('0x67')]();if(!_[_0xcb3d('0x7b')](_0x23f6de)){_0x23f6de[_0xcb3d('0x34')](function(_0x86a6c){if(_0x86a6c===_0xcb3d('0x7c')){_0x4f7419[_0xcb3d('0x4a')](_0xcb3d('0x7d'),[][_0xcb3d('0x7e')](_0x12da25[_0xcb3d('0x43')][_0x86a6c]));}else if(_0x86a6c===_0xcb3d('0x7f')){var _0x3ac31f=JSON[_0xcb3d('0x80')](_0x12da25[_0xcb3d('0x43')][_0x86a6c])[_0xcb3d('0x81')];var _0x5d27fe=JSON[_0xcb3d('0x80')](_0x12da25[_0xcb3d('0x43')][_0x86a6c])[_0xcb3d('0x82')];_0x4f7419[_0xcb3d('0x4a')](_0xcb3d('0x83'),_0x3ac31f,_0x5d27fe);}else{if(_0x12da25[_0xcb3d('0x43')][_0x86a6c]===_0xcb3d('0x84')){_0x4f7419[_0xcb3d('0x4a')]('i.'+_0x86a6c+_0xcb3d('0x85'));}else{_0x4f7419[_0xcb3d('0x4a')]('i.'+_0x86a6c+_0xcb3d('0x86'),_0x12da25[_0xcb3d('0x43')][_0x86a6c]);}}});}if(_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x87')]){if(_0x12da25['query'][_0xcb3d('0x87')]==0x1){_0x4f7419['having'](_0xcb3d('0x88'));}else{_0x4f7419[_0xcb3d('0x68')](_0xcb3d('0x89'));}}if(_0x12da25['query'][_0xcb3d('0x8a')]){_0x2fca4d=_[_0xcb3d('0x8b')](_0x12da25[_0xcb3d('0x43')]['tag'])?_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x8a')]:new Array(_0x12da25['query'][_0xcb3d('0x8a')]);_0x2fca4d[_0xcb3d('0x34')](function(_0x49c14f){_0x38ea30['or'](_0xcb3d('0x74'),'%,'+_0x49c14f+',%');});}if(_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x8c')]){var _0x42808e=_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x8c')][_0xcb3d('0x8d')]('\x5c','\x5c\x5c')[_0xcb3d('0x8d')](/'/g,'\x27\x27');if(qs[_0xcb3d('0x8e')](_0x42808e)){_0xb28e38['or']('i.id\x20LIKE\x20?',_0x42808e+'%')['or'](_0xcb3d('0x8f'),_0x42808e+'%');}else{_0xb28e38['or'](_0xcb3d('0x90'),qs[_0xcb3d('0x6f')](_0x42808e))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x42808e+'%');}}}_0x4f7419['where'](_0xb28e38);_0x4f7419[_0xcb3d('0x91')](_0xcb3d('0x92'));var _0x3871d0={'type':db[_0xcb3d('0x93')][_0xcb3d('0x94')][_0xcb3d('0x95')],'raw':!![]};var _0x1781f0=_0x4f7419[_0xcb3d('0x96')]();_0x1781f0['field'](_0xcb3d('0x92'));_0x1781f0[_0xcb3d('0x4e')](_0xcb3d('0x97'),_0xcb3d('0x66'));if(_0x163f2d[_0xcb3d('0x98')]){_0x163f2d[_0xcb3d('0x98')][_0xcb3d('0x34')](function(_0x2e851d){var _0x24d98e=_0x2e851d[0x0]==='contactName'?_0x2e851d[0x0]:'i.'+_0x2e851d[0x0];_0x4f7419[_0xcb3d('0x98')](_0x24d98e,_0x2e851d[0x1]===_0xcb3d('0x99')?![]:!![]);});}if(!_[_0xcb3d('0x7b')](_0x2fca4d)){_0x4f7419['having'](_0x38ea30);_0x1781f0[_0xcb3d('0x4a')](_0xcb3d('0x9a'),_0x2fca4d);}BPromise[_0xcb3d('0x9b')]()[_0xcb3d('0x29')](function(){if(!_0x4bcd56){if(_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x7c')])return;_0x1781f0[_0xcb3d('0x4a')](_0xcb3d('0x9c'));_0x4f7419['where'](_0xcb3d('0x9c'));return;}if(_0x12da25['user']['role']!==_0xcb3d('0x9d'))return;return _0x12da25[_0xcb3d('0x9e')][_0xcb3d('0x9f')]({'attributes':['id'],'raw':!![]})[_0xcb3d('0x29')](function(_0x4922c1){if(_[_0xcb3d('0x7b')](_0x4922c1)){_0x1781f0[_0xcb3d('0x4a')](_0xcb3d('0xa0'));_0x4f7419[_0xcb3d('0x4a')](_0xcb3d('0xa0'));}else{_0x1781f0['where'](_0xcb3d('0x7d'),_[_0xcb3d('0x31')](_0x4922c1,'id'));_0x4f7419['where']('i.SmsAccountId\x20IN\x20?',_[_0xcb3d('0x31')](_0x4922c1,'id'));}});})['then'](function(){if(_0x12da25[_0xcb3d('0x9e')]['role']===_0xcb3d('0x9d')&&!_0x4bcd56&&!_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x7c')])return[];return db[_0xcb3d('0xa1')][_0xcb3d('0x43')](_0x1781f0[_0xcb3d('0xa2')](),_0x3871d0);})[_0xcb3d('0x29')](function(_0x1d2395){_0x22dc29[_0xcb3d('0x24')]=_0x1d2395[_0xcb3d('0x47')];if(_0x22dc29[_0xcb3d('0x24')]===0x0)return[];return db[_0xcb3d('0xa1')]['query'](_0x4cea0f[_0xcb3d('0xa2')](),_0x3871d0)[_0xcb3d('0x29')](function(_0x4cb8c3){_0x38c555=_[_0xcb3d('0xa3')](_0x4cb8c3,'id');_0x3871d0=_[_0xcb3d('0xa4')](_0x3871d0,{'model':db[_0xcb3d('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x12da25['query'][_0xcb3d('0x46')]){_0x163f2d['attributes'][_0xcb3d('0x34')](function(_0x1d5cb4){_0x4f7419['field']('i.'+_0x1d5cb4);});}else{_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0x97'),_0xcb3d('0x66'));_0x4f7419['field'](_0xcb3d('0xa5'),_0xcb3d('0xa6'));_0x4f7419[_0xcb3d('0x4e')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x4f7419[_0xcb3d('0x4e')]('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');_0x4f7419[_0xcb3d('0x4e')]('i.*');_0x4f7419['field'](_0xcb3d('0xa7'),_0xcb3d('0xa8'));_0x4f7419['field'](_0xcb3d('0xa9'),'Contact.lastName');_0x4f7419['field'](_0xcb3d('0xaa'),_0xcb3d('0xab'));_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0xac'),_0xcb3d('0xad'));_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0xae'),'Contact.mobile');_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0xaf'),_0xcb3d('0xb0'));_0x4f7419['field'](_0xcb3d('0xb1'),_0xcb3d('0xb2'));_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0xb3'),_0xcb3d('0xb4'));_0x4f7419[_0xcb3d('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xcb3d('0x32'));}if(_0x163f2d[_0xcb3d('0x23')])_0x4f7419[_0xcb3d('0x23')](_0x163f2d['limit']);if(_0x163f2d[_0xcb3d('0x21')])_0x4f7419['offset'](_0x163f2d['offset']);return db['sequelize'][_0xcb3d('0x43')](_0x4f7419['toString'](),_0x3871d0);})[_0xcb3d('0x29')](function(_0x273150){if(_0x273150[_0xcb3d('0x47')]>0x0)_0x399a96[_0xcb3d('0x4a')](_0xcb3d('0xb5'),_[_0xcb3d('0x31')](_0x273150,'id'));return db[_0xcb3d('0xa1')][_0xcb3d('0x43')](_0x399a96['toString'](),_0x3871d0)['then'](function(_0x2ff16e){var _0x2d3884=_['groupBy'](_0x2ff16e,_0xcb3d('0xb6'));var _0x19b4af=[];_0x273150['forEach'](function(_0x3b72ef){_0x19b4af[_0xcb3d('0xb7')](updateSmsInteraction(_0x3b72ef,_0x38c555,_0x2d3884));});return BPromise[_0xcb3d('0xb8')](_0x19b4af);});});})[_0xcb3d('0x29')](function(_0xacd8db){_0x22dc29['rows']=_0xacd8db;return _0x22dc29;})['then'](respondWithFilteredResult(_0x3b2f30,_0x163f2d))[_0xcb3d('0x35')](handleError(_0x3b2f30,null));};exports['show']=function(_0x6d217f,_0x2b11cf){var _0x4f670b={'raw':![],'where':{'id':_0x6d217f[_0xcb3d('0xb9')]['id']}},_0x2d0c06={};_0x2d0c06[_0xcb3d('0x42')]=_[_0xcb3d('0x79')](db[_0xcb3d('0x3e')][_0xcb3d('0xba')]);_0x2d0c06[_0xcb3d('0x43')]=_[_0xcb3d('0x79')](_0x6d217f[_0xcb3d('0x43')]);_0x2d0c06[_0xcb3d('0x4c')]=_[_0xcb3d('0x44')](_0x2d0c06[_0xcb3d('0x42')],_0x2d0c06[_0xcb3d('0x43')]);_0x4f670b[_0xcb3d('0x45')]=_[_0xcb3d('0x44')](_0x2d0c06[_0xcb3d('0x42')],qs['fields'](_0x6d217f['query'][_0xcb3d('0x46')]));_0x4f670b['attributes']=_0x4f670b['attributes'][_0xcb3d('0x47')]?_0x4f670b[_0xcb3d('0x45')]:_0x2d0c06['model'];if(_0x6d217f[_0xcb3d('0x43')][_0xcb3d('0xbb')]){_0x4f670b[_0xcb3d('0xbc')]=[{'all':!![]}];}_0x4f670b=_[_0xcb3d('0xa4')]({},_0x4f670b,_0x6d217f[_0xcb3d('0xbd')]);return db['SmsInteraction']['find'](_0x4f670b)['then'](handleEntityNotFound(_0x2b11cf,null))['then'](respondWithResult(_0x2b11cf,null))[_0xcb3d('0x35')](handleError(_0x2b11cf,null));};exports[_0xcb3d('0xbe')]=function(_0x409ebc,_0x31085b){return db['SmsInteraction']['create'](_0x409ebc[_0xcb3d('0xbf')],{})[_0xcb3d('0x29')](respondWithResult(_0x31085b,0xc9))[_0xcb3d('0x35')](handleError(_0x31085b,null));};exports[_0xcb3d('0x28')]=function(_0x2a2470,_0xb1870c){if(_0x2a2470[_0xcb3d('0xbf')]['id']){delete _0x2a2470[_0xcb3d('0xbf')]['id'];}return db['SmsInteraction'][_0xcb3d('0x65')]({'where':{'id':_0x2a2470[_0xcb3d('0xb9')]['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0xb1870c,null))['then'](saveUpdates(_0x2a2470['body'],null))[_0xcb3d('0x29')](respondWithResult(_0xb1870c,null))[_0xcb3d('0x35')](handleError(_0xb1870c,null));};exports['destroy']=function(_0x37b5d7,_0x4e3e65){return db[_0xcb3d('0x3e')][_0xcb3d('0x65')]({'where':{'id':_0x37b5d7['params']['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0x4e3e65,null))[_0xcb3d('0x29')](removeEntity(_0x4e3e65,null))[_0xcb3d('0x35')](handleError(_0x4e3e65,null));};exports['describe']=function(_0x10ba8f,_0x11610f){return db[_0xcb3d('0x3e')][_0xcb3d('0xc0')]()[_0xcb3d('0x29')](respondWithResult(_0x11610f,null))[_0xcb3d('0x35')](handleError(_0x11610f,null));};exports[_0xcb3d('0xc1')]=function(_0x5ddcab,_0x29f6dc,_0x1b59c5){return db['SmsMessage'][_0xcb3d('0x65')]({'where':{'id':_0x5ddcab[_0xcb3d('0xb9')]['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0x29f6dc,null))[_0xcb3d('0x29')](function(_0x3c116d){if(_0x3c116d){return _0x3c116d['addMessage'](_0x5ddcab['body'][_0xcb3d('0xc2')],_['omit'](_0x5ddcab[_0xcb3d('0xbf')],[_0xcb3d('0xc2'),'id'])||{});}})['then'](respondWithResult(_0x29f6dc,null))['catch'](handleError(_0x29f6dc,null));};exports[_0xcb3d('0xc3')]=function(_0x5a86d0,_0x310d3c,_0x3491a9){var _0x3986e6={'raw':![],'where':{}};var _0x14b9f3={};var _0x3c88cc={'count':0x0,'rows':[]};return db[_0xcb3d('0x3e')][_0xcb3d('0xc4')]({'where':{'id':_0x5a86d0[_0xcb3d('0xb9')]['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0x310d3c,null))[_0xcb3d('0x29')](function(_0x39f587){if(_0x39f587){_0x14b9f3[_0xcb3d('0x42')]=_['keys'](db['SmsMessage'][_0xcb3d('0xba')]);_0x14b9f3[_0xcb3d('0x43')]=_[_0xcb3d('0x79')](_0x5a86d0[_0xcb3d('0x43')]);_0x14b9f3[_0xcb3d('0x4c')]=_[_0xcb3d('0x44')](_0x14b9f3[_0xcb3d('0x42')],_0x14b9f3[_0xcb3d('0x43')]);_0x3986e6['attributes']=_['intersection'](_0x14b9f3[_0xcb3d('0x42')],qs[_0xcb3d('0x46')](_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0x46')]));_0x3986e6[_0xcb3d('0x45')]=_0x3986e6[_0xcb3d('0x45')][_0xcb3d('0x47')]?_0x3986e6[_0xcb3d('0x45')]:_0x14b9f3[_0xcb3d('0x42')];if(!_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0xc5')](_0xcb3d('0x48'))){_0x3986e6[_0xcb3d('0x23')]=qs['limit'](_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0x23')]);_0x3986e6[_0xcb3d('0x21')]=qs[_0xcb3d('0x21')](_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0x21')]);}_0x3986e6[_0xcb3d('0x98')]=qs['sort'](_0x5a86d0['query']['sort']);_0x3986e6[_0xcb3d('0x4a')]=qs[_0xcb3d('0x4c')](_[_0xcb3d('0x4b')](_0x5a86d0['query'],_0x14b9f3[_0xcb3d('0x4c')]));_0x3986e6['where'][_0xcb3d('0xb6')]=_0x39f587['id'];if(_0x5a86d0[_0xcb3d('0x43')]['filter']){_0x3986e6['where']=_[_0xcb3d('0xa4')](_0x3986e6[_0xcb3d('0x4a')],{'$or':_[_0xcb3d('0x31')](_0x3986e6[_0xcb3d('0x45')],function(_0x2cc29d){var _0x10d345={};_0x10d345[_0x2cc29d]={'$like':'%'+_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0x8c')]+'%'};return _0x10d345;})});}if(_0x5a86d0['query'][_0xcb3d('0x81')]){var _0x727478=_0x5a86d0[_0xcb3d('0x43')]['$gte']['split'](',');var _0x44c297={};_0x44c297[_0x727478[0x0]]={'$gte':moment(_0x727478[0x1])[_0xcb3d('0xc6')](_0xcb3d('0xc7'))};_0x3986e6['where']=_[_0xcb3d('0xa4')](_0x3986e6[_0xcb3d('0x4a')],_0x44c297);}_0x3986e6=_['merge']({},_0x3986e6,_0x5a86d0[_0xcb3d('0xbd')]);return db[_0xcb3d('0xc8')][_0xcb3d('0x24')]({'where':_0x3986e6[_0xcb3d('0x4a')]})[_0xcb3d('0x29')](function(_0x4095a9){_0x3c88cc[_0xcb3d('0x24')]=_0x4095a9;if(_0x5a86d0[_0xcb3d('0x43')]['includeAll']){_0x3986e6[_0xcb3d('0xbc')]=[{'all':!![]}];}return db[_0xcb3d('0xc8')][_0xcb3d('0xc9')](_0x3986e6);})['then'](function(_0x10aa49){_0x3c88cc[_0xcb3d('0xca')]=_0x10aa49;return _0x3c88cc;});}})[_0xcb3d('0x29')](respondWithFilteredResult(_0x310d3c,_0x3986e6))['catch'](handleError(_0x310d3c,null));};exports['addTags']=function(_0x1cabd8,_0x1ba650,_0x86fed1){return db[_0xcb3d('0x3e')][_0xcb3d('0x65')]({'where':{'id':_0x1cabd8[_0xcb3d('0xb9')]['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0x1ba650,null))[_0xcb3d('0x29')](function(_0x36dc72){if(_0x36dc72){return _0x36dc72[_0xcb3d('0xcb')](_0x1cabd8[_0xcb3d('0xbf')][_0xcb3d('0xc2')],_[_0xcb3d('0xcc')](_0x1cabd8['body'],[_0xcb3d('0xc2'),'id'])||{})[_0xcb3d('0xcd')](function(){return db[_0xcb3d('0x73')][_0xcb3d('0xc9')]({'attributes':['id',_0xcb3d('0x2f'),_0xcb3d('0x4f')],'where':{'id':_0x1cabd8[_0xcb3d('0xbf')][_0xcb3d('0xc2')]}});})[_0xcb3d('0x29')](function(_0x3c183e){socket[_0xcb3d('0xce')](_0xcb3d('0xcf'),{'id':Number(_0x1cabd8[_0xcb3d('0xb9')]['id']),'tags':_0x3c183e||[]});return{'id':Number(_0x1cabd8[_0xcb3d('0xb9')]['id']),'tags':_0x3c183e||[]};});}})[_0xcb3d('0x29')](respondWithResult(_0x1ba650,null))[_0xcb3d('0x35')](handleError(_0x1ba650,null));};exports['removeTags']=function(_0x525621,_0x563a7f,_0x4cd487){return db['SmsInteraction'][_0xcb3d('0x65')]({'where':{'id':_0x525621[_0xcb3d('0xb9')]['id']}})['then'](handleEntityNotFound(_0x563a7f,null))[_0xcb3d('0x29')](function(_0x55cb3b){if(_0x55cb3b){return _0x55cb3b['removeTags'](_0x525621[_0xcb3d('0x43')]['ids']);}})[_0xcb3d('0x29')](respondWithStatusCode(_0x563a7f,null))[_0xcb3d('0x35')](handleError(_0x563a7f,null));};exports[_0xcb3d('0xd0')]=function(_0x113d3d,_0x46c97a){var _0x11af58=moment()[_0xcb3d('0xd1')]()[_0xcb3d('0xa2')]();var _0x5590f9=path[_0xcb3d('0xd2')](config['root'],'server',_0xcb3d('0xd3'),_0xcb3d('0xd4'));var _0x5772a6=path[_0xcb3d('0xd2')](config['root'],_0xcb3d('0xd5'),_0xcb3d('0xd3'),_0xcb3d('0xd6'));var _0x565eb7=path[_0xcb3d('0xd2')](_0x5590f9,_0x11af58);var _0x4ffbb6=util[_0xcb3d('0xc6')](_0xcb3d('0xd7'),_0x113d3d[_0xcb3d('0xb9')]['id'],_0x11af58);var _0x286b0c=path[_0xcb3d('0xd2')](_0x5590f9,_0x4ffbb6);var _0x2d2854=[];_0x2d2854[_0xcb3d('0xb7')]({'model':db[_0xcb3d('0x76')],'as':'User','attributes':['id',_0xcb3d('0xd8')],'raw':!![]});_0x2d2854[_0xcb3d('0xb7')]({'model':db[_0xcb3d('0xd9')],'as':_0xcb3d('0x6a'),'attributes':['id',_0xcb3d('0xda'),_0xcb3d('0xdb')],'raw':!![]});var _0x244402=[{'model':db[_0xcb3d('0xc8')],'as':'Messages','attributes':['id','body',_0xcb3d('0x7f'),_0xcb3d('0xdc'),_0xcb3d('0xdd'),_0xcb3d('0x87')],'include':_0x2d2854}];_0x244402[_0xcb3d('0xb7')]({'model':db[_0xcb3d('0xde')],'as':'Account','attributes':['id',_0xcb3d('0x2f')]});_0x244402[_0xcb3d('0xb7')]({'model':db[_0xcb3d('0x76')],'as':_0xcb3d('0xdf'),'attributes':['id',_0xcb3d('0xd8')]});return db['SmsInteraction'][_0xcb3d('0x65')]({'where':{'id':_0x113d3d[_0xcb3d('0xb9')]['id']},'include':_0x244402})[_0xcb3d('0x29')](handleEntityNotFound(_0x46c97a,null))[_0xcb3d('0x29')](function(_0x15ffd6){if(_0x15ffd6){var _0x212fdf=_0x15ffd6[_0xcb3d('0xe0')]({'plain':!![]});fs['mkdirSync'](_0x565eb7);var _0x325df8={'channel':_0xcb3d('0xe1'),'account':_0x212fdf[_0xcb3d('0xe2')][_0xcb3d('0x2f')],'agent':_0x212fdf['Owner']?_0x212fdf[_0xcb3d('0xdf')][_0xcb3d('0xd8')]:_0xcb3d('0xe3'),'createdAt':moment(_0x212fdf[_0xcb3d('0x7f')])[_0xcb3d('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x212fdf['closed']?moment(_0x212fdf[_0xcb3d('0xe4')])[_0xcb3d('0xc6')](_0xcb3d('0xc7'))['toString']():'','disposition':_0x212fdf[_0xcb3d('0xe5')],'messages':_(_0x212fdf['Messages'])[_0xcb3d('0x8c')]({'secret':![]})[_0xcb3d('0x31')](function(_0x2fa9ac){return{'date':moment(_0x2fa9ac[_0xcb3d('0x7f')])[_0xcb3d('0xc6')](_0xcb3d('0xc7'))[_0xcb3d('0xa2')](),'sender':_0x2fa9ac[_0xcb3d('0xdc')]===_0xcb3d('0xe6')?_0x2fa9ac[_0xcb3d('0x76')]?_0x2fa9ac[_0xcb3d('0x76')][_0xcb3d('0xd8')]:_0xcb3d('0xe7'):_0x2fa9ac['Contact'][_0xcb3d('0xda')]+(_0x2fa9ac[_0xcb3d('0x6a')][_0xcb3d('0xdb')]?'\x20'+_0x2fa9ac['Contact'][_0xcb3d('0xdb')]:''),'body':_0x2fa9ac[_0xcb3d('0xbf')],'direction':_0x2fa9ac[_0xcb3d('0xdc')]===_0xcb3d('0xe6')?'A':'C','secret':_0x2fa9ac['secret'],'read':_0x2fa9ac[_0xcb3d('0x87')]};})[_0xcb3d('0x67')]()};return ejs[_0xcb3d('0xe8')](path[_0xcb3d('0xd2')](config[_0xcb3d('0xe9')],_0xcb3d('0xd5'),_0xcb3d('0xea'),_0xcb3d('0xeb')),{'interaction':_0x325df8})[_0xcb3d('0x29')](function(_0x4ded2b){var _0x15e6c2=path[_0xcb3d('0xd2')](_0x565eb7,_0xcb3d('0xec')+_0x212fdf['id']+'-'+_0x11af58+'.pdf');var _0x57f9e6={'path':_0x15e6c2,'channel':_0xcb3d('0xe1'),'interactionId':_0x212fdf['id']};return pdf['createPdfFromHTML'](_0x4ded2b,_0x57f9e6);})[_0xcb3d('0x29')](function(){return new BPromise(function(_0x1fe7fa,_0x234aae){zipdir(_0x565eb7,{'saveTo':_0x286b0c},function(_0x3b59be,_0x44e684){if(_0x3b59be)return _0x234aae(_0x3b59be);return _0x1fe7fa(_0x44e684);});})[_0xcb3d('0x29')](function(){return new BPromise(function(_0x43410c,_0x59ea63){rimraf(_0x565eb7,function(_0x22f801){if(_0x22f801)_0x59ea63(_0x22f801);return _0x43410c();});});})[_0xcb3d('0x29')](function(){return _0x46c97a[_0xcb3d('0xd0')](_0x286b0c,_0x4ffbb6,function(_0x343889){if(_0x343889){console['log'](_0xcb3d('0xed'),_0x343889);}else{fs[_0xcb3d('0xee')](_0x286b0c);}});});});}else{return _0x46c97a[_0xcb3d('0x2c')](0xc8);}})[_0xcb3d('0x35')](handleError(_0x46c97a,null));}; \ No newline at end of file +var _0x24cb=['Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','SmsInteractionId','all','rows','show','params','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','getMessages','findOne','format','findAll','Tag','emit','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','fullname','firstName','lastName','direction','SmsAccount','Account','Owner','get','mkdirSync','Sms','createdAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','out','System','secret','views','transcript-','.pdf','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','Users','map','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','SmsInteraction','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','tools_tags','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','start','body','keys','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.id','Sequelize','SELECT','clone','order','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname'];(function(_0x284d6c,_0x528b06){var _0x3f5832=function(_0x546694){while(--_0x546694){_0x284d6c['push'](_0x284d6c['shift']());}};_0x3f5832(++_0x528b06);}(_0x24cb,0x11b));var _0xb24c=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x24cb[_0x3f0b30];return _0x2748a5;};'use strict';var emlformat=require(_0xb24c('0x0'));var rimraf=require(_0xb24c('0x1'));var zipdir=require(_0xb24c('0x2'));var jsonpatch=require(_0xb24c('0x3'));var rp=require(_0xb24c('0x4'));var moment=require(_0xb24c('0x5'));var BPromise=require(_0xb24c('0x6'));var Mustache=require('mustache');var util=require(_0xb24c('0x7'));var path=require(_0xb24c('0x8'));var sox=require(_0xb24c('0x9'));var csv=require('to-csv');var ejs=require(_0xb24c('0xa'));var fs=require('fs');var fs_extra=require(_0xb24c('0xb'));var _=require(_0xb24c('0xc'));var squel=require('squel');var crypto=require(_0xb24c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb24c('0xe'));var querystring=require(_0xb24c('0xf'));var Papa=require(_0xb24c('0x10'));var Redis=require('ioredis');var authService=require(_0xb24c('0x11'));var qs=require(_0xb24c('0x12'));var as=require(_0xb24c('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xb24c('0x14'));var logger=require('../../config/logger')(_0xb24c('0x15'));var utils=require('../../config/utils');var config=require(_0xb24c('0x16'));var licenseUtil=require(_0xb24c('0x17'));var db=require('../../mysqldb')['db'];config[_0xb24c('0x18')]=_[_0xb24c('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb24c('0x1a'))(new Redis(config[_0xb24c('0x18')]));require(_0xb24c('0x1b'))[_0xb24c('0x1c')](socket);function respondWithStatusCode(_0x30d1dd,_0x3d018f){_0x3d018f=_0x3d018f||0xcc;return function(_0x10fcbe){if(_0x10fcbe){return _0x30d1dd[_0xb24c('0x1d')](_0x3d018f);}return _0x30d1dd['status'](_0x3d018f)[_0xb24c('0x1e')]();};}function respondWithResult(_0x7d8f51,_0x45000e){_0x45000e=_0x45000e||0xc8;return function(_0x339dd9){if(_0x339dd9){return _0x7d8f51['status'](_0x45000e)[_0xb24c('0x1f')](_0x339dd9);}};}function respondWithFilteredResult(_0x1114e0,_0x208f2c){return function(_0x149f67){if(_0x149f67){var _0x97e25b=typeof _0x208f2c[_0xb24c('0x20')]==='undefined'&&typeof _0x208f2c[_0xb24c('0x21')]===_0xb24c('0x22');var _0x18ce16=_0x149f67[_0xb24c('0x23')];var _0x4a6a32=_0x97e25b?0x0:_0x208f2c['offset'];var _0x58181f=_0x97e25b?_0x149f67[_0xb24c('0x23')]:_0x208f2c[_0xb24c('0x20')]+_0x208f2c[_0xb24c('0x21')];var _0x5e277b;if(_0x58181f>=_0x18ce16){_0x58181f=_0x18ce16;_0x5e277b=0xc8;}else{_0x5e277b=0xce;}_0x1114e0[_0xb24c('0x24')](_0x5e277b);return _0x1114e0[_0xb24c('0x25')](_0xb24c('0x26'),_0x4a6a32+'-'+_0x58181f+'/'+_0x18ce16)[_0xb24c('0x1f')](_0x149f67);}return null;};}function patchUpdates(_0x481676){return function(_0x27020e){try{jsonpatch[_0xb24c('0x27')](_0x27020e,_0x481676,!![]);}catch(_0x28164a){return BPromise['reject'](_0x28164a);}return _0x27020e[_0xb24c('0x28')]();};}function saveUpdates(_0x5d7c9b,_0x1a0ea7){return function(_0x418a2c){if(_0x418a2c){return _0x418a2c[_0xb24c('0x29')](_0x5d7c9b)['then'](function(_0x3040f3){return _0x3040f3;});}return null;};}function removeEntity(_0x498fe7,_0x4898c9){return function(_0x1247d9){if(_0x1247d9){return _0x1247d9[_0xb24c('0x2a')]()[_0xb24c('0x2b')](function(){_0x498fe7['status'](0xcc)[_0xb24c('0x1e')]();});}};}function handleEntityNotFound(_0x90e109,_0x816c3){return function(_0x4c30eb){if(!_0x4c30eb){_0x90e109[_0xb24c('0x1d')](0x194);}return _0x4c30eb;};}function handleError(_0x996ef0,_0x316e2b){_0x316e2b=_0x316e2b||0x1f4;return function(_0x86dea3){logger[_0xb24c('0x2c')](_0x86dea3[_0xb24c('0x2d')]);if(_0x86dea3[_0xb24c('0x2e')]){delete _0x86dea3[_0xb24c('0x2e')];}_0x996ef0['status'](_0x316e2b)[_0xb24c('0x2f')](_0x86dea3);};}function getInteractionUsers(_0x244955,_0x140915){return new BPromise(function(_0x2afb59,_0x58c975){try{if(_0x140915[_0x244955['id']]){_0x244955[_0xb24c('0x30')]=_[_0xb24c('0x31')](_0x140915[_0x244955['id']],function(_0x16e626){return{'id':_0x16e626['id'],'fullname':_0x16e626['fullname']};});}}catch(_0x2597c6){_0x58c975(_0x2597c6);}_0x2afb59(_0x244955);});}function getInteractionTags(_0x37376f,_0x56a381){return new BPromise(function(_0x50c8bc,_0x4a2ef9){try{if(_0x37376f['TagIds']){_0x37376f[_0xb24c('0x32')]=[];_0x37376f['TagIds'][_0xb24c('0x33')](',')[_0xb24c('0x34')](function(_0x12598b){_0x37376f[_0xb24c('0x32')][_0xb24c('0x35')](_0x56a381[_0x12598b]);});}delete _0x37376f['TagIds'];}catch(_0x5324d8){_0x4a2ef9(_0x5324d8);}_0x50c8bc(_0x37376f);});}function updateSmsInteraction(_0x2bb0ab,_0x1797ad,_0x5ade47){return new BPromise(function(_0x223d6e,_0x26f168){return getInteractionUsers(_0x2bb0ab,_0x5ade47)['then'](function(_0x30b212){return getInteractionTags(_0x30b212,_0x1797ad);})[_0xb24c('0x2b')](function(_0x13ba29){return getStateInteraction(_0x13ba29);})[_0xb24c('0x2b')](function(_0x16a40b){_0x223d6e(_0x16a40b);})[_0xb24c('0x36')](function(_0xc5088c){_0x26f168(_0xc5088c);});});}function getStateInteraction(_0x1d2cf4){return new BPromise(function(_0x23f6b0){_0x1d2cf4[_0xb24c('0x37')]=0x0;_0x1d2cf4[_0xb24c('0x38')]=0x0;_0x1d2cf4[_0xb24c('0x39')]=0x0;_0x1d2cf4[_0xb24c('0x3a')]=0x0;_0x1d2cf4[_0xb24c('0x3b')]=0x0;if(!_0x1d2cf4['closed']&&!_0x1d2cf4[_0xb24c('0x3c')]){_0x1d2cf4['waiting']+=0x1;}if(!_0x1d2cf4[_0xb24c('0x3d')]&&_0x1d2cf4[_0xb24c('0x3c')]){_0x1d2cf4[_0xb24c('0x38')]+=0x1;if(_0x1d2cf4[_0xb24c('0x37')]){_0x1d2cf4[_0xb24c('0x37')]-=0x1;}}if(_0x1d2cf4[_0xb24c('0x3d')]&&_0x1d2cf4[_0xb24c('0x3c')]){_0x1d2cf4[_0xb24c('0x39')]+=0x1;if(_0x1d2cf4[_0xb24c('0x38')]){_0x1d2cf4[_0xb24c('0x38')]-=0x1;}}if(_0x1d2cf4[_0xb24c('0x3d')]&&!_0x1d2cf4[_0xb24c('0x3c')]){_0x1d2cf4[_0xb24c('0x3a')]+=0x1;if(_0x1d2cf4[_0xb24c('0x37')]){_0x1d2cf4['waiting']-=0x1;}}_0x1d2cf4[_0xb24c('0x3b')]+=0x1;_0x23f6b0(_0x1d2cf4);});}exports[_0xb24c('0x3e')]=function(_0x4b0910,_0x1d0965){var _0x41dbbf={},_0x2b1a68={},_0x2b94f5={'count':0x0,'rows':[]};var _0x812992=_[_0xb24c('0x31')](db[_0xb24c('0x3f')][_0xb24c('0x40')],function(_0x33b3b5){return{'name':_0x33b3b5['fieldName'],'type':_0x33b3b5[_0xb24c('0x41')][_0xb24c('0x42')]};});_0x2b1a68[_0xb24c('0x43')]=_[_0xb24c('0x31')](_0x812992,'name');_0x2b1a68[_0xb24c('0x44')]=_['keys'](_0x4b0910['query']);_0x2b1a68[_0xb24c('0x45')]=_[_0xb24c('0x46')](_0x2b1a68[_0xb24c('0x43')],_0x2b1a68[_0xb24c('0x44')]);_0x41dbbf[_0xb24c('0x47')]=_[_0xb24c('0x46')](_0x2b1a68[_0xb24c('0x43')],qs[_0xb24c('0x48')](_0x4b0910[_0xb24c('0x44')][_0xb24c('0x48')]));_0x41dbbf['attributes']=_0x41dbbf[_0xb24c('0x47')][_0xb24c('0x49')]?_0x41dbbf[_0xb24c('0x47')]:_0x2b1a68[_0xb24c('0x43')];if(!_0x4b0910[_0xb24c('0x44')][_0xb24c('0x4a')](_0xb24c('0x4b'))){_0x41dbbf[_0xb24c('0x21')]=qs[_0xb24c('0x21')](_0x4b0910[_0xb24c('0x44')][_0xb24c('0x21')]);_0x41dbbf['offset']=qs[_0xb24c('0x20')](_0x4b0910[_0xb24c('0x44')][_0xb24c('0x20')]);}_0x41dbbf['order']=qs[_0xb24c('0x4c')](_0x4b0910[_0xb24c('0x44')]['sort']);_0x41dbbf['where']=qs[_0xb24c('0x45')](_[_0xb24c('0x4d')](_0x4b0910[_0xb24c('0x44')],_0x2b1a68[_0xb24c('0x45')]),_0x812992);var _0x46dedf=[];var _0x22b12a=squel[_0xb24c('0x4e')]()[_0xb24c('0x4f')]('id')[_0xb24c('0x4f')](_0xb24c('0x2e'))[_0xb24c('0x4f')](_0xb24c('0x50'))[_0xb24c('0x51')](_0xb24c('0x52'));var _0x3e5e19=squel[_0xb24c('0x4e')]()['field']('u.id')[_0xb24c('0x4f')]('u.fullname')[_0xb24c('0x4f')](_0xb24c('0x53'))['from'](_0xb24c('0x54'),'ui')['left_join'](_0xb24c('0x55'),'u',_0xb24c('0x56'));var _0x52cea9=squel[_0xb24c('0x4e')]()[_0xb24c('0x51')](_0xb24c('0x57'),'i')['left_join'](_0xb24c('0x58'),'c',_0xb24c('0x59'))[_0xb24c('0x5a')](_0xb24c('0x55'),'o',_0xb24c('0x5b'))['left_join'](_0xb24c('0x5c'),'a',_0xb24c('0x5d'))[_0xb24c('0x5a')](_0xb24c('0x5e'),'me',_0xb24c('0x5f'))[_0xb24c('0x5a')]('sms_interaction_has_tags','it',_0xb24c('0x60'))[_0xb24c('0x5a')](_0xb24c('0x52'),'t',_0xb24c('0x61'));var _0xd96e0d=squel[_0xb24c('0x62')]();var _0x49dc8c=[];var _0x5dc6fc=squel[_0xb24c('0x62')]();var _0x2594c3;if(_0x4b0910[_0xb24c('0x44')]['search']){_0x2594c3=as[_0xb24c('0x63')](_0x4b0910[_0xb24c('0x44')]['search']);var _0x479970=_0x2594c3['sqlOperator'];for(var _0x596e14=0x0;_0x596e14<_0x2594c3['conditions'][_0xb24c('0x49')];_0x596e14++){var _0x510348=_0x2594c3[_0xb24c('0x64')][_0x596e14];var _0x47067f='i';var _0x242524=_['find'](_0x812992,[_0xb24c('0x2e'),_0x510348[_0xb24c('0x4f')]]);if(!_0x242524){switch(_0x510348[_0xb24c('0x4f')]){case _0xb24c('0x65'):if(_0x510348[_0xb24c('0x66')]==0x1){_0x52cea9['having']('`'+_0x510348[_0xb24c('0x4f')]+_0xb24c('0x67'));}else{_0x52cea9[_0xb24c('0x68')]('`'+_0x510348['field']+_0xb24c('0x69'));}break;case _0xb24c('0x6a'):if(_0x510348['operator']===_0xb24c('0x6b')){if(_0x510348['value'][_0xb24c('0x33')]('\x20')[_0xb24c('0x49')]>0x1){_0xd96e0d[_0x479970](_0xb24c('0x6c'),qs['getFullTextValue'](_0x510348[_0xb24c('0x66')]),null);}else{var _0x295a6b='%'+_0x510348[_0xb24c('0x66')]+'%';_0xd96e0d[_0x479970]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x295a6b,_0x295a6b,_0x295a6b);}}else{_0x242524=_['find'](_0x812992,[_0xb24c('0x2e'),_0xb24c('0x6d')]);_0x510348['field']=_0xb24c('0x6d');_0xfdbd02=as[_0xb24c('0x6e')](_0x47067f,_0x242524[_0xb24c('0x41')],_0x510348);_0xd96e0d[_0x479970](_0xfdbd02[_0xb24c('0x6f')],_0xfdbd02[_0xb24c('0x66')]['start'],_0xfdbd02['value'][_0xb24c('0x1e')]);}break;case'Tag':var _0x54b73c=_0x510348[_0xb24c('0x66')][_0xb24c('0x33')](',')[_0xb24c('0x31')](function(_0x3a181d){return Number(_0x3a181d);});_0x54b73c[_0xb24c('0x34')](function(_0x5ced5c){_0x5dc6fc['or'](_0xb24c('0x70'),'%,'+_0x5ced5c+',%');});_0x49dc8c=_[_0xb24c('0x71')](_0x49dc8c,_0x54b73c);break;case _0xb24c('0x72'):if(_0x510348[_0xb24c('0x73')]==='$substring'){_0xd96e0d[_0x479970](_0xb24c('0x74'),'%'+_0x510348['value']+'%',null);}else{_0x242524=_[_0xb24c('0x75')](_0x812992,[_0xb24c('0x2e'),'UserId']);_0x510348[_0xb24c('0x4f')]=_0xb24c('0x3c');_0xfdbd02=as[_0xb24c('0x6e')](_0x47067f,_0x242524[_0xb24c('0x41')],_0x510348);_0xd96e0d[_0x479970](_0xfdbd02[_0xb24c('0x6f')],_0xfdbd02[_0xb24c('0x66')][_0xb24c('0x76')],_0xfdbd02[_0xb24c('0x66')][_0xb24c('0x1e')]);}break;case _0xb24c('0x77'):_0xfdbd02=as[_0xb24c('0x6e')]('me',null,_0x510348);_0xd96e0d[_0x479970](_0xfdbd02[_0xb24c('0x6f')],_0xfdbd02[_0xb24c('0x66')][_0xb24c('0x76')],_0xfdbd02['value']['end']);break;}}else{var _0xfdbd02=as['buildExpression'](_0x47067f,_0x242524[_0xb24c('0x41')],_0x510348);_0xd96e0d[_0x479970](_0xfdbd02[_0xb24c('0x6f')],_0xfdbd02['value'][_0xb24c('0x76')],_0xfdbd02[_0xb24c('0x66')][_0xb24c('0x1e')]);}}}else{var _0x136071=_(_0x4b0910[_0xb24c('0x44')])[_0xb24c('0x78')]()[_0xb24c('0x31')](function(_0x24fc3c){return _['some'](_0x812992,[_0xb24c('0x2e'),_0x24fc3c])?_0x24fc3c:undefined;})[_0xb24c('0x79')]()[_0xb24c('0x66')]();if(!_[_0xb24c('0x7a')](_0x136071)){_0x136071['forEach'](function(_0x4f0cbb){if(_0x4f0cbb===_0xb24c('0x7b')){_0x52cea9[_0xb24c('0x7c')](_0xb24c('0x7d'),[][_0xb24c('0x7e')](_0x4b0910[_0xb24c('0x44')][_0x4f0cbb]));}else if(_0x4f0cbb==='createdAt'){var _0x1a0b31=JSON[_0xb24c('0x7f')](_0x4b0910['query'][_0x4f0cbb])[_0xb24c('0x80')];var _0x1f5d59=JSON[_0xb24c('0x7f')](_0x4b0910['query'][_0x4f0cbb])[_0xb24c('0x81')];_0x52cea9[_0xb24c('0x7c')](_0xb24c('0x82'),_0x1a0b31,_0x1f5d59);}else{if(_0x4b0910['query'][_0x4f0cbb]===_0xb24c('0x83')){_0x52cea9['where']('i.'+_0x4f0cbb+_0xb24c('0x84'));}else{_0x52cea9['where']('i.'+_0x4f0cbb+_0xb24c('0x85'),_0x4b0910[_0xb24c('0x44')][_0x4f0cbb]);}}});}if(_0x4b0910[_0xb24c('0x44')]['read']){if(_0x4b0910[_0xb24c('0x44')][_0xb24c('0x86')]==0x1){_0x52cea9['having'](_0xb24c('0x87'));}else{_0x52cea9[_0xb24c('0x68')](_0xb24c('0x88'));}}if(_0x4b0910[_0xb24c('0x44')]['tag']){_0x49dc8c=_[_0xb24c('0x89')](_0x4b0910[_0xb24c('0x44')][_0xb24c('0x8a')])?_0x4b0910[_0xb24c('0x44')][_0xb24c('0x8a')]:new Array(_0x4b0910[_0xb24c('0x44')][_0xb24c('0x8a')]);_0x49dc8c[_0xb24c('0x34')](function(_0x123a5d){_0x5dc6fc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x123a5d+',%');});}if(_0x4b0910[_0xb24c('0x44')]['filter']){var _0x4bce69=_0x4b0910[_0xb24c('0x44')][_0xb24c('0x8b')]['replace']('\x5c','\x5c\x5c')[_0xb24c('0x8c')](/'/g,'\x27\x27');if(qs[_0xb24c('0x8d')](_0x4bce69)){_0xd96e0d['or'](_0xb24c('0x8e'),_0x4bce69+'%')['or'](_0xb24c('0x8f'),_0x4bce69+'%');}else{_0xd96e0d['or'](_0xb24c('0x90'),qs[_0xb24c('0x91')](_0x4bce69))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4bce69+'%');}}}_0x52cea9[_0xb24c('0x7c')](_0xd96e0d);_0x52cea9['group'](_0xb24c('0x92'));var _0xfe20f2={'type':db[_0xb24c('0x93')]['QueryTypes'][_0xb24c('0x94')],'raw':!![]};var _0x15ca30=_0x52cea9[_0xb24c('0x95')]();_0x15ca30[_0xb24c('0x4f')](_0xb24c('0x92'));_0x15ca30[_0xb24c('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x41dbbf['order']){_0x41dbbf[_0xb24c('0x96')][_0xb24c('0x34')](function(_0x1548e2){var _0x230f33=_0x1548e2[0x0]==='contactName'?_0x1548e2[0x0]:'i.'+_0x1548e2[0x0];_0x52cea9[_0xb24c('0x96')](_0x230f33,_0x1548e2[0x1]===_0xb24c('0x97')?![]:!![]);});}if(!_[_0xb24c('0x7a')](_0x49dc8c)){_0x52cea9[_0xb24c('0x68')](_0x5dc6fc);_0x15ca30[_0xb24c('0x7c')]('t.id\x20IN\x20?',_0x49dc8c);}BPromise[_0xb24c('0x98')]()[_0xb24c('0x2b')](function(){if(!_0x2594c3){if(_0x4b0910[_0xb24c('0x44')]['SmsAccountId'])return;_0x15ca30[_0xb24c('0x7c')](_0xb24c('0x99'));_0x52cea9[_0xb24c('0x7c')](_0xb24c('0x99'));return;}if(_0x4b0910['user'][_0xb24c('0x9a')]!==_0xb24c('0x9b'))return;return _0x4b0910[_0xb24c('0x9c')][_0xb24c('0x9d')]({'attributes':['id'],'raw':!![]})[_0xb24c('0x2b')](function(_0x4fccb5){if(_[_0xb24c('0x7a')](_0x4fccb5)){_0x15ca30[_0xb24c('0x7c')](_0xb24c('0x9e'));_0x52cea9[_0xb24c('0x7c')](_0xb24c('0x9e'));}else{_0x15ca30[_0xb24c('0x7c')](_0xb24c('0x7d'),_[_0xb24c('0x31')](_0x4fccb5,'id'));_0x52cea9[_0xb24c('0x7c')]('i.SmsAccountId\x20IN\x20?',_[_0xb24c('0x31')](_0x4fccb5,'id'));}});})[_0xb24c('0x2b')](function(){if(_0x4b0910[_0xb24c('0x9c')][_0xb24c('0x9a')]===_0xb24c('0x9b')&&!_0x2594c3&&!_0x4b0910[_0xb24c('0x44')][_0xb24c('0x7b')])return[];return db['sequelize']['query'](_0x15ca30['toString'](),_0xfe20f2);})[_0xb24c('0x2b')](function(_0x1e2717){_0x2b94f5['count']=_0x1e2717[_0xb24c('0x49')];if(_0x2b94f5[_0xb24c('0x23')]===0x0)return[];return db[_0xb24c('0x9f')][_0xb24c('0x44')](_0x22b12a[_0xb24c('0xa0')](),_0xfe20f2)[_0xb24c('0x2b')](function(_0x38950b){_0x46dedf=_[_0xb24c('0xa1')](_0x38950b,'id');_0xfe20f2=_[_0xb24c('0xa2')](_0xfe20f2,{'model':db[_0xb24c('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b0910[_0xb24c('0x44')][_0xb24c('0x48')]){_0x41dbbf[_0xb24c('0x47')][_0xb24c('0x34')](function(_0x4f2ab4){_0x52cea9[_0xb24c('0x4f')]('i.'+_0x4f2ab4);});}else{_0x52cea9['field'](_0xb24c('0xa3'),_0xb24c('0x65'));_0x52cea9[_0xb24c('0x4f')](_0xb24c('0xa4'),'Account.key');_0x52cea9[_0xb24c('0x4f')](_0xb24c('0xa5'),_0xb24c('0xa6'));_0x52cea9[_0xb24c('0x4f')](_0xb24c('0xa7'),_0xb24c('0xa8'));_0x52cea9[_0xb24c('0x4f')]('i.*');_0x52cea9['field']('c.firstName',_0xb24c('0xa9'));_0x52cea9[_0xb24c('0x4f')](_0xb24c('0xaa'),_0xb24c('0xab'));_0x52cea9[_0xb24c('0x4f')]('c.email','Contact.email');_0x52cea9[_0xb24c('0x4f')](_0xb24c('0xac'),_0xb24c('0xad'));_0x52cea9[_0xb24c('0x4f')](_0xb24c('0xae'),_0xb24c('0xaf'));_0x52cea9[_0xb24c('0x4f')]('c.fax',_0xb24c('0xb0'));_0x52cea9[_0xb24c('0x4f')](_0xb24c('0xb1'),_0xb24c('0xb2'));_0x52cea9[_0xb24c('0x4f')]('o.internal',_0xb24c('0xb3'));_0x52cea9[_0xb24c('0x4f')](_0xb24c('0xb4'),'TagIds');}if(_0x41dbbf[_0xb24c('0x21')])_0x52cea9[_0xb24c('0x21')](_0x41dbbf[_0xb24c('0x21')]);if(_0x41dbbf[_0xb24c('0x20')])_0x52cea9[_0xb24c('0x20')](_0x41dbbf[_0xb24c('0x20')]);return db[_0xb24c('0x9f')][_0xb24c('0x44')](_0x52cea9[_0xb24c('0xa0')](),_0xfe20f2);})[_0xb24c('0x2b')](function(_0x9cbe1e){if(_0x9cbe1e[_0xb24c('0x49')]>0x0)_0x3e5e19[_0xb24c('0x7c')]('ui.SmsInteractionId\x20IN\x20?',_[_0xb24c('0x31')](_0x9cbe1e,'id'));return db[_0xb24c('0x9f')][_0xb24c('0x44')](_0x3e5e19[_0xb24c('0xa0')](),_0xfe20f2)['then'](function(_0x2aea36){var _0x2b06ec=_['groupBy'](_0x2aea36,_0xb24c('0xb5'));var _0xcf1b=[];_0x9cbe1e[_0xb24c('0x34')](function(_0x2f31ec){_0xcf1b['push'](updateSmsInteraction(_0x2f31ec,_0x46dedf,_0x2b06ec));});return BPromise[_0xb24c('0xb6')](_0xcf1b);});});})['then'](function(_0x1f52ce){_0x2b94f5[_0xb24c('0xb7')]=_0x1f52ce;return _0x2b94f5;})['then'](respondWithFilteredResult(_0x1d0965,_0x41dbbf))[_0xb24c('0x36')](handleError(_0x1d0965,null));};exports[_0xb24c('0xb8')]=function(_0x329786,_0x85b24d){var _0x32fbbb={'raw':![],'where':{'id':_0x329786[_0xb24c('0xb9')]['id']}},_0xc8c7e8={};_0xc8c7e8['model']=_[_0xb24c('0x78')](db['SmsInteraction'][_0xb24c('0x40')]);_0xc8c7e8[_0xb24c('0x44')]=_[_0xb24c('0x78')](_0x329786[_0xb24c('0x44')]);_0xc8c7e8[_0xb24c('0x45')]=_[_0xb24c('0x46')](_0xc8c7e8[_0xb24c('0x43')],_0xc8c7e8[_0xb24c('0x44')]);_0x32fbbb['attributes']=_[_0xb24c('0x46')](_0xc8c7e8['model'],qs[_0xb24c('0x48')](_0x329786['query'][_0xb24c('0x48')]));_0x32fbbb[_0xb24c('0x47')]=_0x32fbbb['attributes'][_0xb24c('0x49')]?_0x32fbbb[_0xb24c('0x47')]:_0xc8c7e8[_0xb24c('0x43')];if(_0x329786['query'][_0xb24c('0xba')]){_0x32fbbb[_0xb24c('0xbb')]=[{'all':!![]}];}_0x32fbbb=_[_0xb24c('0xa2')]({},_0x32fbbb,_0x329786[_0xb24c('0xbc')]);return db['SmsInteraction'][_0xb24c('0x75')](_0x32fbbb)[_0xb24c('0x2b')](handleEntityNotFound(_0x85b24d,null))[_0xb24c('0x2b')](respondWithResult(_0x85b24d,null))[_0xb24c('0x36')](handleError(_0x85b24d,null));};exports[_0xb24c('0xbd')]=function(_0x2e4871,_0x3a217b){return db[_0xb24c('0x3f')][_0xb24c('0xbd')](_0x2e4871[_0xb24c('0x77')],{})[_0xb24c('0x2b')](respondWithResult(_0x3a217b,0xc9))[_0xb24c('0x36')](handleError(_0x3a217b,null));};exports[_0xb24c('0x29')]=function(_0x5cf988,_0x253912){if(_0x5cf988[_0xb24c('0x77')]['id']){delete _0x5cf988[_0xb24c('0x77')]['id'];}return db[_0xb24c('0x3f')]['find']({'where':{'id':_0x5cf988[_0xb24c('0xb9')]['id']}})['then'](handleEntityNotFound(_0x253912,null))['then'](saveUpdates(_0x5cf988[_0xb24c('0x77')],null))[_0xb24c('0x2b')](respondWithResult(_0x253912,null))[_0xb24c('0x36')](handleError(_0x253912,null));};exports[_0xb24c('0x2a')]=function(_0x21c3cb,_0x10cd2a){return db[_0xb24c('0x3f')][_0xb24c('0x75')]({'where':{'id':_0x21c3cb['params']['id']}})[_0xb24c('0x2b')](handleEntityNotFound(_0x10cd2a,null))[_0xb24c('0x2b')](removeEntity(_0x10cd2a,null))[_0xb24c('0x36')](handleError(_0x10cd2a,null));};exports['describe']=function(_0x47a710,_0xe3bec7){return db[_0xb24c('0x3f')][_0xb24c('0xbe')]()[_0xb24c('0x2b')](respondWithResult(_0xe3bec7,null))[_0xb24c('0x36')](handleError(_0xe3bec7,null));};exports[_0xb24c('0xbf')]=function(_0x5f1984,_0x1309ab,_0x39ddf8){return db[_0xb24c('0xc0')]['find']({'where':{'id':_0x5f1984[_0xb24c('0xb9')]['id']}})[_0xb24c('0x2b')](handleEntityNotFound(_0x1309ab,null))[_0xb24c('0x2b')](function(_0x2d7626){if(_0x2d7626){return _0x2d7626[_0xb24c('0xbf')](_0x5f1984[_0xb24c('0x77')][_0xb24c('0xc1')],_['omit'](_0x5f1984['body'],[_0xb24c('0xc1'),'id'])||{});}})[_0xb24c('0x2b')](respondWithResult(_0x1309ab,null))['catch'](handleError(_0x1309ab,null));};exports[_0xb24c('0xc2')]=function(_0x22edeb,_0x12b413,_0x2578f2){var _0x468139={'raw':![],'where':{}};var _0x33d08d={};var _0x11f053={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb24c('0xc3')]({'where':{'id':_0x22edeb[_0xb24c('0xb9')]['id']}})[_0xb24c('0x2b')](handleEntityNotFound(_0x12b413,null))[_0xb24c('0x2b')](function(_0x19c41b){if(_0x19c41b){_0x33d08d[_0xb24c('0x43')]=_[_0xb24c('0x78')](db['SmsMessage']['rawAttributes']);_0x33d08d['query']=_[_0xb24c('0x78')](_0x22edeb[_0xb24c('0x44')]);_0x33d08d[_0xb24c('0x45')]=_[_0xb24c('0x46')](_0x33d08d['model'],_0x33d08d[_0xb24c('0x44')]);_0x468139[_0xb24c('0x47')]=_['intersection'](_0x33d08d[_0xb24c('0x43')],qs[_0xb24c('0x48')](_0x22edeb['query'][_0xb24c('0x48')]));_0x468139['attributes']=_0x468139['attributes'][_0xb24c('0x49')]?_0x468139[_0xb24c('0x47')]:_0x33d08d[_0xb24c('0x43')];if(!_0x22edeb[_0xb24c('0x44')][_0xb24c('0x4a')]('nolimit')){_0x468139[_0xb24c('0x21')]=qs[_0xb24c('0x21')](_0x22edeb[_0xb24c('0x44')][_0xb24c('0x21')]);_0x468139[_0xb24c('0x20')]=qs[_0xb24c('0x20')](_0x22edeb[_0xb24c('0x44')][_0xb24c('0x20')]);}_0x468139[_0xb24c('0x96')]=qs[_0xb24c('0x4c')](_0x22edeb[_0xb24c('0x44')]['sort']);_0x468139['where']=qs['filters'](_[_0xb24c('0x4d')](_0x22edeb[_0xb24c('0x44')],_0x33d08d[_0xb24c('0x45')]));_0x468139[_0xb24c('0x7c')][_0xb24c('0xb5')]=_0x19c41b['id'];if(_0x22edeb[_0xb24c('0x44')][_0xb24c('0x8b')]){_0x468139[_0xb24c('0x7c')]=_[_0xb24c('0xa2')](_0x468139['where'],{'$or':_[_0xb24c('0x31')](_0x468139[_0xb24c('0x47')],function(_0x4046e3){var _0x5edd9b={};_0x5edd9b[_0x4046e3]={'$like':'%'+_0x22edeb['query']['filter']+'%'};return _0x5edd9b;})});}if(_0x22edeb[_0xb24c('0x44')][_0xb24c('0x80')]){var _0x5b2789=_0x22edeb[_0xb24c('0x44')][_0xb24c('0x80')][_0xb24c('0x33')](',');var _0x2e2dc1={};_0x2e2dc1[_0x5b2789[0x0]]={'$gte':moment(_0x5b2789[0x1])[_0xb24c('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x468139[_0xb24c('0x7c')]=_[_0xb24c('0xa2')](_0x468139['where'],_0x2e2dc1);}_0x468139=_[_0xb24c('0xa2')]({},_0x468139,_0x22edeb[_0xb24c('0xbc')]);return db[_0xb24c('0xc0')][_0xb24c('0x23')]({'where':_0x468139[_0xb24c('0x7c')]})[_0xb24c('0x2b')](function(_0x49c148){_0x11f053['count']=_0x49c148;if(_0x22edeb[_0xb24c('0x44')][_0xb24c('0xba')]){_0x468139[_0xb24c('0xbb')]=[{'all':!![]}];}return db[_0xb24c('0xc0')][_0xb24c('0xc5')](_0x468139);})[_0xb24c('0x2b')](function(_0x477787){_0x11f053[_0xb24c('0xb7')]=_0x477787;return _0x11f053;});}})[_0xb24c('0x2b')](respondWithFilteredResult(_0x12b413,_0x468139))[_0xb24c('0x36')](handleError(_0x12b413,null));};exports['addTags']=function(_0x19e5ef,_0x32a74c,_0x36efa1){return db[_0xb24c('0x3f')][_0xb24c('0x75')]({'where':{'id':_0x19e5ef[_0xb24c('0xb9')]['id']}})['then'](handleEntityNotFound(_0x32a74c,null))[_0xb24c('0x2b')](function(_0x12581d){if(_0x12581d){return _0x12581d['setTags'](_0x19e5ef['body'][_0xb24c('0xc1')],_['omit'](_0x19e5ef[_0xb24c('0x77')],[_0xb24c('0xc1'),'id'])||{})['spread'](function(){return db[_0xb24c('0xc6')]['findAll']({'attributes':['id',_0xb24c('0x2e'),_0xb24c('0x50')],'where':{'id':_0x19e5ef[_0xb24c('0x77')][_0xb24c('0xc1')]}});})['then'](function(_0x37b4aa){socket[_0xb24c('0xc7')]('smsInteractionTags:save',{'id':Number(_0x19e5ef[_0xb24c('0xb9')]['id']),'tags':_0x37b4aa||[]});return{'id':Number(_0x19e5ef[_0xb24c('0xb9')]['id']),'tags':_0x37b4aa||[]};});}})[_0xb24c('0x2b')](respondWithResult(_0x32a74c,null))['catch'](handleError(_0x32a74c,null));};exports[_0xb24c('0xc8')]=function(_0x5e2d6,_0x502d78,_0x3cf8e1){return db['SmsInteraction'][_0xb24c('0x75')]({'where':{'id':_0x5e2d6[_0xb24c('0xb9')]['id']}})['then'](handleEntityNotFound(_0x502d78,null))['then'](function(_0x42150a){if(_0x42150a){return _0x42150a[_0xb24c('0xc8')](_0x5e2d6[_0xb24c('0x44')][_0xb24c('0xc1')]);}})[_0xb24c('0x2b')](respondWithStatusCode(_0x502d78,null))[_0xb24c('0x36')](handleError(_0x502d78,null));};exports[_0xb24c('0xc9')]=function(_0x4e0691,_0x5191db){var _0x530d02=moment()['unix']()[_0xb24c('0xa0')]();var _0x40cacf=path[_0xb24c('0xca')](config[_0xb24c('0xcb')],_0xb24c('0xcc'),_0xb24c('0xcd'),'tmp');var _0x2ae694=path[_0xb24c('0xca')](config[_0xb24c('0xcb')],_0xb24c('0xcc'),'files',_0xb24c('0xce'));var _0xd16742=path[_0xb24c('0xca')](_0x40cacf,_0x530d02);var _0x1465b7=util[_0xb24c('0xc4')](_0xb24c('0xcf'),_0x4e0691['params']['id'],_0x530d02);var _0x254554=path[_0xb24c('0xca')](_0x40cacf,_0x1465b7);var _0x157360=[];_0x157360['push']({'model':db[_0xb24c('0x72')],'as':_0xb24c('0x72'),'attributes':['id',_0xb24c('0xd0')],'raw':!![]});_0x157360['push']({'model':db['CmContact'],'as':_0xb24c('0x6a'),'attributes':['id',_0xb24c('0xd1'),_0xb24c('0xd2')],'raw':!![]});var _0x103415=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xb24c('0x77'),'createdAt',_0xb24c('0xd3'),'secret','read'],'include':_0x157360}];_0x103415['push']({'model':db[_0xb24c('0xd4')],'as':_0xb24c('0xd5'),'attributes':['id',_0xb24c('0x2e')]});_0x103415[_0xb24c('0x35')]({'model':db[_0xb24c('0x72')],'as':_0xb24c('0xd6'),'attributes':['id',_0xb24c('0xd0')]});return db[_0xb24c('0x3f')][_0xb24c('0x75')]({'where':{'id':_0x4e0691[_0xb24c('0xb9')]['id']},'include':_0x103415})['then'](handleEntityNotFound(_0x5191db,null))[_0xb24c('0x2b')](function(_0x3cd719){if(_0x3cd719){var _0xbff7a5=_0x3cd719[_0xb24c('0xd7')]({'plain':!![]});fs[_0xb24c('0xd8')](_0xd16742);var _0x4c3421={'channel':_0xb24c('0xd9'),'account':_0xbff7a5[_0xb24c('0xd5')]['name'],'agent':_0xbff7a5[_0xb24c('0xd6')]?_0xbff7a5['Owner']['fullname']:'N.A.','createdAt':moment(_0xbff7a5[_0xb24c('0xda')])[_0xb24c('0xc4')](_0xb24c('0xdb'))[_0xb24c('0xa0')](),'closedAt':_0xbff7a5[_0xb24c('0x3d')]?moment(_0xbff7a5[_0xb24c('0xdc')])[_0xb24c('0xc4')](_0xb24c('0xdb'))[_0xb24c('0xa0')]():'','disposition':_0xbff7a5[_0xb24c('0xdd')],'messages':_(_0xbff7a5[_0xb24c('0xde')])[_0xb24c('0x8b')]({'secret':![]})[_0xb24c('0x31')](function(_0x263ff6){return{'date':moment(_0x263ff6['createdAt'])[_0xb24c('0xc4')](_0xb24c('0xdb'))[_0xb24c('0xa0')](),'sender':_0x263ff6[_0xb24c('0xd3')]===_0xb24c('0xdf')?_0x263ff6['User']?_0x263ff6[_0xb24c('0x72')]['fullname']:_0xb24c('0xe0'):_0x263ff6[_0xb24c('0x6a')][_0xb24c('0xd1')]+(_0x263ff6[_0xb24c('0x6a')]['lastName']?'\x20'+_0x263ff6[_0xb24c('0x6a')][_0xb24c('0xd2')]:''),'body':_0x263ff6['body'],'direction':_0x263ff6[_0xb24c('0xd3')]==='out'?'A':'C','secret':_0x263ff6[_0xb24c('0xe1')],'read':_0x263ff6['read']};})['value']()};return ejs['renderFile'](path['join'](config[_0xb24c('0xcb')],'server',_0xb24c('0xe2'),'downloadInteraction.ejs'),{'interaction':_0x4c3421})[_0xb24c('0x2b')](function(_0x3c397a){var _0x29eb42=path[_0xb24c('0xca')](_0xd16742,_0xb24c('0xe3')+_0xbff7a5['id']+'-'+_0x530d02+_0xb24c('0xe4'));var _0x2c63e9={'path':_0x29eb42,'channel':'Sms','interactionId':_0xbff7a5['id']};return pdf['createPdfFromHTML'](_0x3c397a,_0x2c63e9);})[_0xb24c('0x2b')](function(){return new BPromise(function(_0x439929,_0x5c5544){zipdir(_0xd16742,{'saveTo':_0x254554},function(_0x3a5d05,_0x13a423){if(_0x3a5d05)return _0x5c5544(_0x3a5d05);return _0x439929(_0x13a423);});})[_0xb24c('0x2b')](function(){return new BPromise(function(_0x39cd53,_0x32c6d4){rimraf(_0xd16742,function(_0x44cc50){if(_0x44cc50)_0x32c6d4(_0x44cc50);return _0x39cd53();});});})['then'](function(){return _0x5191db[_0xb24c('0xc9')](_0x254554,_0x1465b7,function(_0x1654c6){if(_0x1654c6){console['log'](_0xb24c('0xe5'),_0x1654c6);}else{fs[_0xb24c('0xe6')](_0x254554);}});});});}else{return _0x5191db[_0xb24c('0x1d')](0xc8);}})['catch'](handleError(_0x5191db,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f1b8765..d8bee0a 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 _0x14a0=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','setDataValue','Users','findAll','length','emit','catch'];(function(_0x3b4e7b,_0x416d01){var _0xc353d2=function(_0x33696e){while(--_0x33696e){_0x3b4e7b['push'](_0x3b4e7b['shift']());}};_0xc353d2(++_0x416d01);}(_0x14a0,0x8e));var _0x014a=function(_0x4e7dd7,_0x3e7134){_0x4e7dd7=_0x4e7dd7-0x0;var _0x4f4461=_0x14a0[_0x4e7dd7];return _0x4f4461;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x014a('0x0'))['db'][_0x014a('0x1')];var SmsMessage=require(_0x014a('0x0'))['db'][_0x014a('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x014a('0x3')](0x0);var events={'afterCreate':_0x014a('0x4'),'afterUpdate':_0x014a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57a522){return function(_0x1730a5,_0x12e8da,_0x38a22c){_0x1730a5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x11b8ce){_0x1730a5[_0x014a('0x6')](_0x014a('0x7'),_0x11b8ce['map'](function(_0x5d3d7f){return{'id':_0x5d3d7f['id']};}));return SmsMessage[_0x014a('0x8')]({'where':{'SmsInteractionId':_0x1730a5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x490ea2){_0x1730a5['setDataValue']('unreadMessages',_0x490ea2[_0x014a('0x9')]);SmsInteractionEvents['emit'](_0x57a522+':'+_0x1730a5['id'],_0x1730a5);SmsInteractionEvents[_0x014a('0xa')](_0x57a522,_0x1730a5);_0x38a22c(null);})[_0x014a('0xb')](_0x38a22c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x014a('0xc')](e,emitEvent(event));}}module[_0x014a('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0x1399=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x1399,0x16c));var _0x9139=function(_0xc9b565,_0x14970d){_0xc9b565=_0xc9b565-0x0;var _0x3ce997=_0x1399[_0xc9b565];return _0x3ce997;};'use strict';var EventEmitter=require(_0x9139('0x0'));var SmsInteraction=require(_0x9139('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x9139('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9139('0x2')](0x0);var events={'afterCreate':_0x9139('0x3'),'afterUpdate':_0x9139('0x4'),'afterDestroy':_0x9139('0x5')};function emitEvent(_0x251798){return function(_0x2acb38,_0x5ac80b,_0x54af2d){_0x2acb38[_0x9139('0x6')]({'attributes':['id'],'raw':!![]})[_0x9139('0x7')](function(_0x4d5d1e){_0x2acb38['setDataValue'](_0x9139('0x8'),_0x4d5d1e['map'](function(_0x504ced){return{'id':_0x504ced['id']};}));return SmsMessage[_0x9139('0x9')]({'where':{'SmsInteractionId':_0x2acb38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9139('0x7')](function(_0x4830cd){_0x2acb38[_0x9139('0xa')](_0x9139('0xb'),_0x4830cd['length']);SmsInteractionEvents['emit'](_0x251798+':'+_0x2acb38['id'],_0x2acb38);SmsInteractionEvents[_0x9139('0xc')](_0x251798,_0x2acb38);_0x54af2d(null);})[_0x9139('0xd')](_0x54af2d(null));};}for(var e in events){if(events[_0x9139('0xe')](e)){var event=events[e];SmsInteraction[_0x9139('0xf')](e,emitEvent(event));}}module[_0x9139('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b67674b..05747ab 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 _0xc1db=['bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x389601,_0x3cd181){var _0x475ed3=function(_0x265ed2){while(--_0x265ed2){_0x389601['push'](_0x389601['shift']());}};_0x475ed3(++_0x3cd181);}(_0xc1db,0xeb));var _0xbc1d=function(_0x11bf34,_0x4e3a4c){_0x11bf34=_0x11bf34-0x0;var _0x3edf9a=_0xc1db[_0x11bf34];return _0x3edf9a;};'use strict';var _=require(_0xbc1d('0x0'));var util=require(_0xbc1d('0x1'));var logger=require(_0xbc1d('0x2'))(_0xbc1d('0x3'));var moment=require(_0xbc1d('0x4'));var BPromise=require(_0xbc1d('0x5'));var rp=require(_0xbc1d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc1d('0x7'));var config=require(_0xbc1d('0x8'));var attributes=require(_0xbc1d('0x9'));module['exports']=function(_0x2778f8,_0x4253e7){return _0x2778f8['define'](_0xbc1d('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xdc2f76,_0x53dc61,_0x4ae66a){if(_0xdc2f76['changed'](_0xbc1d('0xb'))){_0xdc2f76[_0xbc1d('0xc')]=moment()[_0xbc1d('0xd')](_0xbc1d('0xe'));}_0x4ae66a(null,_0xdc2f76);}}});}; \ No newline at end of file +var _0x5fd0=['request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird'];(function(_0x289576,_0x5ddc76){var _0x234ffc=function(_0x56d8b7){while(--_0x56d8b7){_0x289576['push'](_0x289576['shift']());}};_0x234ffc(++_0x5ddc76);}(_0x5fd0,0x67));var _0x05fd=function(_0xa62876,_0x2faa48){_0xa62876=_0xa62876-0x0;var _0x147953=_0x5fd0[_0xa62876];return _0x147953;};'use strict';var _=require(_0x05fd('0x0'));var util=require(_0x05fd('0x1'));var logger=require('../../config/logger')(_0x05fd('0x2'));var moment=require(_0x05fd('0x3'));var BPromise=require(_0x05fd('0x4'));var rp=require(_0x05fd('0x5'));var fs=require('fs');var path=require(_0x05fd('0x6'));var rimraf=require(_0x05fd('0x7'));var config=require(_0x05fd('0x8'));var attributes=require(_0x05fd('0x9'));module[_0x05fd('0xa')]=function(_0x4cde71,_0x333f9e){return _0x4cde71[_0x05fd('0xb')](_0x05fd('0xc'),attributes,{'tableName':_0x05fd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6eb2fb,_0x480598,_0x37bb76){if(_0x6eb2fb[_0x05fd('0xe')](_0x05fd('0xf'))){_0x6eb2fb[_0x05fd('0x10')]=moment()['format'](_0x05fd('0x11'));}_0x37bb76(null,_0x6eb2fb);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 8aefb81..b27e00f 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 _0x8e95=['options','raw','where','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','message','SmsInteraction,\x20%s,\x20%s','result','catch','SmsInteraction','update'];(function(_0xd89965,_0xb6c8b5){var _0x59bf32=function(_0x18139d){while(--_0x18139d){_0xd89965['push'](_0xd89965['shift']());}};_0x59bf32(++_0xb6c8b5);}(_0x8e95,0x87));var _0x58e9=function(_0x3e2c84,_0x450061){_0x3e2c84=_0x3e2c84-0x0;var _0x323105=_0x8e95[_0x3e2c84];return _0x323105;};'use strict';var _=require('lodash');var util=require(_0x58e9('0x0'));var moment=require(_0x58e9('0x1'));var BPromise=require(_0x58e9('0x2'));var rs=require(_0x58e9('0x3'));var fs=require('fs');var Redis=require(_0x58e9('0x4'));var db=require(_0x58e9('0x5'))['db'];var utils=require(_0x58e9('0x6'));var logger=require(_0x58e9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x58e9('0x8'));var client=jayson[_0x58e9('0x9')][_0x58e9('0xa')]({'port':0x232a});config[_0x58e9('0xb')]=_['defaults'](config[_0x58e9('0xb')],{'host':_0x58e9('0xc'),'port':0x18eb});var socket=require(_0x58e9('0xd'))(new Redis(config[_0x58e9('0xb')]));require(_0x58e9('0xe'))[_0x58e9('0xf')](socket);function respondWithRpcPromise(_0x232009,_0x13acd9,_0x258b8b){return new BPromise(function(_0x4e499e,_0x1b97ad){return client[_0x58e9('0x10')](_0x232009,_0x258b8b)[_0x58e9('0x11')](function(_0x3429ce){logger[_0x58e9('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x13acd9,_0x58e9('0x13'));logger[_0x58e9('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x13acd9,_0x58e9('0x13'),JSON[_0x58e9('0x15')](_0x3429ce));if(_0x3429ce['error']){if(_0x3429ce[_0x58e9('0x16')]['code']===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x13acd9,_0x3429ce[_0x58e9('0x16')][_0x58e9('0x17')]);return _0x1b97ad(_0x3429ce[_0x58e9('0x16')][_0x58e9('0x17')]);}logger[_0x58e9('0x16')](_0x58e9('0x18'),_0x13acd9,_0x3429ce[_0x58e9('0x16')]['message']);return _0x4e499e(_0x3429ce[_0x58e9('0x16')][_0x58e9('0x17')]);}else{logger[_0x58e9('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x13acd9,'request\x20sent');_0x4e499e(_0x3429ce[_0x58e9('0x19')][_0x58e9('0x17')]);}})[_0x58e9('0x1a')](function(_0x373547){logger[_0x58e9('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x13acd9,_0x373547);_0x1b97ad(_0x373547);});});}exports['UpdateSmsInteraction']=function(_0x1e844e){var _0x499d7a=this;return new Promise(function(_0xc6d88c,_0x54985f){return db[_0x58e9('0x1b')][_0x58e9('0x1c')](_0x1e844e['body'],{'raw':_0x1e844e[_0x58e9('0x1d')]?_0x1e844e[_0x58e9('0x1d')][_0x58e9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e844e[_0x58e9('0x1d')]?_0x1e844e['options'][_0x58e9('0x1f')]||null:null,'attributes':_0x1e844e['options']?_0x1e844e['options']['attributes']||null:null,'limit':_0x1e844e['options']?_0x1e844e[_0x58e9('0x1d')]['limit']||null:null})[_0x58e9('0x11')](function(_0x5dd3b4){logger['info'](_0x58e9('0x20'),_0x1e844e);logger[_0x58e9('0x14')](_0x58e9('0x20'),_0x1e844e,JSON[_0x58e9('0x15')](_0x5dd3b4));_0xc6d88c(_0x5dd3b4);})[_0x58e9('0x1a')](function(_0x2f997f){logger[_0x58e9('0x16')](_0x58e9('0x20'),_0x2f997f['message'],_0x1e844e);_0x54985f(_0x499d7a[_0x58e9('0x16')](0x1f4,_0x2f997f[_0x58e9('0x17')]));});});};exports[_0x58e9('0x21')]=function(_0x4c564b){return new Promise(function(_0x366b7c,_0x367ec3){return db[_0x58e9('0x1b')][_0x58e9('0x22')]({'where':_0x4c564b[_0x58e9('0x1d')]?_0x4c564b[_0x58e9('0x1d')]['where']||null:null})[_0x58e9('0x11')](function(_0x2a65fa){if(_0x2a65fa){return _0x2a65fa[_0x58e9('0x23')](_0x4c564b[_0x58e9('0x24')][_0x58e9('0x25')],_[_0x58e9('0x26')](_0x4c564b[_0x58e9('0x24')],[_0x58e9('0x25'),'id'])||{});}})[_0x58e9('0x27')](function(_0x472645){logger[_0x58e9('0x12')](_0x58e9('0x28'),_0x4c564b);logger[_0x58e9('0x14')](_0x58e9('0x28'),_0x4c564b,JSON[_0x58e9('0x15')](_0x472645));_0x366b7c(_0x472645);})[_0x58e9('0x1a')](function(_0x47f972){logger[_0x58e9('0x16')](_0x58e9('0x28'),_0x47f972[_0x58e9('0x17')],_0x4c564b);_0x367ec3(_this[_0x58e9('0x16')](0x1f4,_0x47f972[_0x58e9('0x17')]));});});}; \ No newline at end of file +var _0xa7da=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsInteraction,\x20%s,\x20%s','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','then','AddTagsToSmsInteraction','find','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis'];(function(_0x430af6,_0x4e4ae0){var _0x4d6cd9=function(_0x44f94a){while(--_0x44f94a){_0x430af6['push'](_0x430af6['shift']());}};_0x4d6cd9(++_0x4e4ae0);}(_0xa7da,0xd7));var _0xaa7d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7da[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7d('0x0'));var util=require(_0xaa7d('0x1'));var moment=require(_0xaa7d('0x2'));var BPromise=require(_0xaa7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa7d('0x4'));var db=require(_0xaa7d('0x5'))['db'];var utils=require(_0xaa7d('0x6'));var logger=require('../../config/logger')(_0xaa7d('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa7d('0x8'));var client=jayson[_0xaa7d('0x9')][_0xaa7d('0xa')]({'port':0x232a});config[_0xaa7d('0xb')]=_[_0xaa7d('0xc')](config[_0xaa7d('0xb')],{'host':_0xaa7d('0xd'),'port':0x18eb});var socket=require(_0xaa7d('0xe'))(new Redis(config[_0xaa7d('0xb')]));require(_0xaa7d('0xf'))[_0xaa7d('0x10')](socket);function respondWithRpcPromise(_0x5d31e2,_0x3b3c5b,_0x1eecac){return new BPromise(function(_0x281df8,_0x5a42a2){return client[_0xaa7d('0x11')](_0x5d31e2,_0x1eecac)['then'](function(_0x5c2070){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3b3c5b,'request\x20sent');logger[_0xaa7d('0x12')](_0xaa7d('0x13'),_0x3b3c5b,_0xaa7d('0x14'),JSON[_0xaa7d('0x15')](_0x5c2070));if(_0x5c2070[_0xaa7d('0x16')]){if(_0x5c2070[_0xaa7d('0x16')]['code']===0x1f4){logger[_0xaa7d('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x3b3c5b,_0x5c2070['error'][_0xaa7d('0x17')]);return _0x5a42a2(_0x5c2070[_0xaa7d('0x16')][_0xaa7d('0x17')]);}logger[_0xaa7d('0x16')](_0xaa7d('0x18'),_0x3b3c5b,_0x5c2070[_0xaa7d('0x16')][_0xaa7d('0x17')]);return _0x281df8(_0x5c2070[_0xaa7d('0x16')][_0xaa7d('0x17')]);}else{logger[_0xaa7d('0x19')](_0xaa7d('0x18'),_0x3b3c5b,_0xaa7d('0x14'));_0x281df8(_0x5c2070[_0xaa7d('0x1a')][_0xaa7d('0x17')]);}})[_0xaa7d('0x1b')](function(_0x2ea3f8){logger['error'](_0xaa7d('0x18'),_0x3b3c5b,_0x2ea3f8);_0x5a42a2(_0x2ea3f8);});});}exports[_0xaa7d('0x1c')]=function(_0x3735f9){var _0x4c8654=this;return new Promise(function(_0xc07636,_0x435fdf){return db[_0xaa7d('0x1d')][_0xaa7d('0x1e')](_0x3735f9['body'],{'raw':_0x3735f9[_0xaa7d('0x1f')]?_0x3735f9['options'][_0xaa7d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3735f9['options']?_0x3735f9[_0xaa7d('0x1f')][_0xaa7d('0x21')]||null:null,'attributes':_0x3735f9[_0xaa7d('0x1f')]?_0x3735f9['options'][_0xaa7d('0x22')]||null:null,'limit':_0x3735f9[_0xaa7d('0x1f')]?_0x3735f9[_0xaa7d('0x1f')][_0xaa7d('0x23')]||null:null})[_0xaa7d('0x24')](function(_0x231841){logger[_0xaa7d('0x19')](_0xaa7d('0x1c'),_0x3735f9);logger[_0xaa7d('0x12')](_0xaa7d('0x1c'),_0x3735f9,JSON[_0xaa7d('0x15')](_0x231841));_0xc07636(_0x231841);})[_0xaa7d('0x1b')](function(_0x1abe46){logger[_0xaa7d('0x16')]('UpdateSmsInteraction',_0x1abe46[_0xaa7d('0x17')],_0x3735f9);_0x435fdf(_0x4c8654[_0xaa7d('0x16')](0x1f4,_0x1abe46[_0xaa7d('0x17')]));});});};exports[_0xaa7d('0x25')]=function(_0x135924){return new Promise(function(_0x5c14fb,_0x2a8e53){return db['SmsInteraction'][_0xaa7d('0x26')]({'where':_0x135924['options']?_0x135924[_0xaa7d('0x1f')][_0xaa7d('0x21')]||null:null})[_0xaa7d('0x24')](function(_0x2e1cac){if(_0x2e1cac){return _0x2e1cac['addTags'](_0x135924[_0xaa7d('0x27')]['ids'],_[_0xaa7d('0x28')](_0x135924[_0xaa7d('0x27')],[_0xaa7d('0x29'),'id'])||{});}})[_0xaa7d('0x2a')](function(_0x285174){logger['info']('AddTags',_0x135924);logger[_0xaa7d('0x12')]('AddTags',_0x135924,JSON[_0xaa7d('0x15')](_0x285174));_0x5c14fb(_0x285174);})[_0xaa7d('0x1b')](function(_0x48eeb6){logger[_0xaa7d('0x16')](_0xaa7d('0x2b'),_0x48eeb6[_0xaa7d('0x17')],_0x135924);_0x2a8e53(_this[_0xaa7d('0x16')](0x1f4,_0x48eeb6[_0xaa7d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 3dc8acc..aeef8a4 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 _0x8f9c=['length','./smsInteraction.events','save','remove','update','emit','register'];(function(_0x584c46,_0x3b39d5){var _0x2cf98e=function(_0x328b70){while(--_0x328b70){_0x584c46['push'](_0x584c46['shift']());}};_0x2cf98e(++_0x3b39d5);}(_0x8f9c,0x189));var _0xc8f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f9c[_0x3dd15e];return _0x231fd0;};'use strict';var SmsInteractionEvents=require(_0xc8f9('0x0'));var events=[_0xc8f9('0x1'),_0xc8f9('0x2'),_0xc8f9('0x3')];function createListener(_0x9d1924,_0x297f61){return function(_0x3aed3e){_0x297f61[_0xc8f9('0x4')](_0x9d1924,_0x3aed3e);};}function removeListener(_0x1c9320,_0x339d04){return function(){SmsInteractionEvents['removeListener'](_0x1c9320,_0x339d04);};}exports[_0xc8f9('0x5')]=function(_0x3065e1){for(var _0x930b92=0x0,_0x17384a=events[_0xc8f9('0x6')];_0x930b92<_0x17384a;_0x930b92++){var _0xabe231=events[_0x930b92];var _0x5b4a3e=createListener('smsInteraction:'+_0xabe231,_0x3065e1);SmsInteractionEvents['on'](_0xabe231,_0x5b4a3e);}}; \ No newline at end of file +var _0x1ff2=['smsInteraction:','./smsInteraction.events','save','remove','update','removeListener','register','length'];(function(_0xa45779,_0x1825fb){var _0x4034f3=function(_0x5c1cba){while(--_0x5c1cba){_0xa45779['push'](_0xa45779['shift']());}};_0x4034f3(++_0x1825fb);}(_0x1ff2,0x71));var _0x21ff=function(_0x53dd80,_0x105563){_0x53dd80=_0x53dd80-0x0;var _0x1833aa=_0x1ff2[_0x53dd80];return _0x1833aa;};'use strict';var SmsInteractionEvents=require(_0x21ff('0x0'));var events=[_0x21ff('0x1'),_0x21ff('0x2'),_0x21ff('0x3')];function createListener(_0x594840,_0x2e7a16){return function(_0x358296){_0x2e7a16['emit'](_0x594840,_0x358296);};}function removeListener(_0x49a60d,_0xe00307){return function(){SmsInteractionEvents[_0x21ff('0x4')](_0x49a60d,_0xe00307);};}exports[_0x21ff('0x5')]=function(_0x297452){for(var _0xffcb3c=0x0,_0x3eed51=events[_0x21ff('0x6')];_0xffcb3c<_0x3eed51;_0xffcb3c++){var _0x1e35e8=events[_0xffcb3c];var _0x13696c=createListener(_0x21ff('0x7')+_0x1e35e8,_0x297452);SmsInteractionEvents['on'](_0x1e35e8,_0x13696c);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 98b8d8e..5cafe5c 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 _0xa3b9=['reject','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','tracked','smsmessage:create','post','status','put','update','accept','/:id/reject'];(function(_0xf6433f,_0x23cf95){var _0x5085bf=function(_0x3d69fd){while(--_0x3d69fd){_0xf6433f['push'](_0xf6433f['shift']());}};_0x5085bf(++_0x23cf95);}(_0xa3b9,0x6b));var _0x9a3b=function(_0x60a3cc,_0x5cb5e4){_0x60a3cc=_0x60a3cc-0x0;var _0x57db5e=_0xa3b9[_0x60a3cc];return _0x57db5e;};'use strict';var multer=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var path=require(_0x9a3b('0x2'));var timeout=require(_0x9a3b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9a3b('0x4'));var auth=require(_0x9a3b('0x5'));var interaction=require(_0x9a3b('0x6'));var config=require(_0x9a3b('0x7'));var controller=require('./smsMessage.controller');router[_0x9a3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x9a3b('0x9')]);router[_0x9a3b('0x8')](_0x9a3b('0xa'),auth[_0x9a3b('0xb')](),controller[_0x9a3b('0xc')]);router[_0x9a3b('0x8')](_0x9a3b('0xd'),auth[_0x9a3b('0xb')](),controller[_0x9a3b('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x9a3b('0xf')]('sms',_0x9a3b('0x10')),controller['create']);router[_0x9a3b('0x11')]('/:id/status',controller[_0x9a3b('0x12')]);router[_0x9a3b('0x13')](_0x9a3b('0xd'),auth[_0x9a3b('0xb')](),controller[_0x9a3b('0x14')]);router['put']('/:id/accept',auth[_0x9a3b('0xb')](),controller[_0x9a3b('0x15')]);router[_0x9a3b('0x13')](_0x9a3b('0x16'),auth[_0x9a3b('0xb')](),controller[_0x9a3b('0x17')]);router[_0x9a3b('0x18')](_0x9a3b('0xd'),auth[_0x9a3b('0xb')](),controller['destroy']);module[_0x9a3b('0x19')]=router; \ No newline at end of file +var _0x9824=['util','path','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','/:id/accept','accept','put','/:id/reject','reject','delete','/:id','destroy','exports','multer'];(function(_0x12222f,_0x1004a6){var _0x25bb27=function(_0x4ed9de){while(--_0x4ed9de){_0x12222f['push'](_0x12222f['shift']());}};_0x25bb27(++_0x1004a6);}(_0x9824,0xef));var _0x4982=function(_0x2e4e15,_0x18dad4){_0x2e4e15=_0x2e4e15-0x0;var _0x58185d=_0x9824[_0x2e4e15];return _0x58185d;};'use strict';var multer=require(_0x4982('0x0'));var util=require(_0x4982('0x1'));var path=require(_0x4982('0x2'));var timeout=require('connect-timeout');var express=require(_0x4982('0x3'));var router=express[_0x4982('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4982('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4982('0x6'));var controller=require(_0x4982('0x7'));router[_0x4982('0x8')]('/',auth[_0x4982('0x9')](),controller[_0x4982('0xa')]);router['get']('/describe',auth[_0x4982('0x9')](),controller[_0x4982('0xb')]);router[_0x4982('0x8')]('/:id',auth[_0x4982('0x9')](),controller[_0x4982('0xc')]);router[_0x4982('0xd')]('/',auth[_0x4982('0x9')](),interaction[_0x4982('0xe')](_0x4982('0xf'),_0x4982('0x10')),controller[_0x4982('0x11')]);router[_0x4982('0xd')](_0x4982('0x12'),controller[_0x4982('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4982('0x14')]);router['put'](_0x4982('0x15'),auth[_0x4982('0x9')](),controller[_0x4982('0x16')]);router[_0x4982('0x17')](_0x4982('0x18'),auth[_0x4982('0x9')](),controller[_0x4982('0x19')]);router[_0x4982('0x1a')](_0x4982('0x1b'),auth[_0x4982('0x9')](),controller[_0x4982('0x1c')]);module[_0x4982('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 9e6250a..35616d5 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 _0xb459=['sequelize','exports','TEXT','medium','ENUM','out','STRING','BOOLEAN'];(function(_0x361ecd,_0x32451e){var _0x31942f=function(_0x4fe2b5){while(--_0x4fe2b5){_0x361ecd['push'](_0x361ecd['shift']());}};_0x31942f(++_0x32451e);}(_0xb459,0x178));var _0x9b45=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0xb459[_0x1f5143];return _0x383a38;};'use strict';var Sequelize=require(_0x9b45('0x0'));module[_0x9b45('0x1')]={'body':{'type':Sequelize[_0x9b45('0x2')](_0x9b45('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9b45('0x4')]('in','out'),'defaultValue':_0x9b45('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9b45('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9b45('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9b45('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9b45('0x2')]}}; \ No newline at end of file +var _0xe364=['out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x38bd4b,_0x144508){var _0x27e5c3=function(_0x2640a3){while(--_0x2640a3){_0x38bd4b['push'](_0x38bd4b['shift']());}};_0x27e5c3(++_0x144508);}(_0xe364,0x1ed));var _0x4e36=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0xe364[_0x568496];return _0x26c5c1;};'use strict';var Sequelize=require(_0x4e36('0x0'));module['exports']={'body':{'type':Sequelize[_0x4e36('0x1')](_0x4e36('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4e36('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4e36('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x4e36('0x5')]},'readAt':{'type':Sequelize[_0x4e36('0x6')]},'secret':{'type':Sequelize[_0x4e36('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4e36('0x5')]},'providerResponse':{'type':Sequelize[_0x4e36('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 6ab578e..0719dd5 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 _0xea21=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','end','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','includeAll','include','show','params','find','create','body','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse'];(function(_0x5b9284,_0x1b3159){var _0x44266b=function(_0x3ee7e7){while(--_0x3ee7e7){_0x5b9284['push'](_0x5b9284['shift']());}};_0x44266b(++_0x1b3159);}(_0xea21,0x80));var _0x1ea2=function(_0x314405,_0x232782){_0x314405=_0x314405-0x0;var _0x4cf6cc=_0xea21[_0x314405];return _0x4cf6cc;};'use strict';var emlformat=require(_0x1ea2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ea2('0x1'));var jsonpatch=require(_0x1ea2('0x2'));var rp=require(_0x1ea2('0x3'));var moment=require('moment');var BPromise=require(_0x1ea2('0x4'));var Mustache=require('mustache');var util=require(_0x1ea2('0x5'));var path=require(_0x1ea2('0x6'));var sox=require(_0x1ea2('0x7'));var csv=require(_0x1ea2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ea2('0x9'));var _=require(_0x1ea2('0xa'));var squel=require(_0x1ea2('0xb'));var crypto=require(_0x1ea2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1ea2('0xd'));var toCsv=require(_0x1ea2('0x8'));var querystring=require('querystring');var Papa=require(_0x1ea2('0xe'));var Redis=require(_0x1ea2('0xf'));var authService=require(_0x1ea2('0x10'));var qs=require(_0x1ea2('0x11'));var as=require(_0x1ea2('0x12'));var hardwareService=require(_0x1ea2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1ea2('0x14'));var config=require(_0x1ea2('0x15'));var licenseUtil=require(_0x1ea2('0x16'));var db=require(_0x1ea2('0x17'))['db'];config[_0x1ea2('0x18')]=_[_0x1ea2('0x19')](config[_0x1ea2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ea2('0x1a'))(new Redis(config[_0x1ea2('0x18')]));require(_0x1ea2('0x1b'))['register'](socket);var jayson=require(_0x1ea2('0x1c'));var client=jayson[_0x1ea2('0x1d')][_0x1ea2('0x1e')]({'port':0x232c});var client9002=jayson[_0x1ea2('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f2565,_0x372dc5,_0x27bb84,_0x14b984){return new BPromise(function(_0x28040b,_0x53965f){var _0x1d006b=_0x14b984||client;return _0x1d006b[_0x1ea2('0x1f')](_0x3f2565,_0x27bb84)[_0x1ea2('0x20')](function(_0x48a16e){logger[_0x1ea2('0x21')](_0x1ea2('0x22'),_0x372dc5,_0x1ea2('0x23'));logger['debug'](_0x1ea2('0x24'),_0x372dc5,_0x1ea2('0x23'),JSON[_0x1ea2('0x25')](_0x48a16e));if(_0x48a16e[_0x1ea2('0x26')]){if(_0x48a16e[_0x1ea2('0x26')]['code']===0x1f4){logger[_0x1ea2('0x26')](_0x1ea2('0x22'),_0x372dc5,_0x48a16e[_0x1ea2('0x26')][_0x1ea2('0x27')]);return _0x53965f(_0x48a16e[_0x1ea2('0x26')][_0x1ea2('0x27')]);}logger[_0x1ea2('0x26')](_0x1ea2('0x22'),_0x372dc5,_0x48a16e[_0x1ea2('0x26')]['message']);return _0x28040b(_0x48a16e[_0x1ea2('0x26')][_0x1ea2('0x27')]);}else{logger[_0x1ea2('0x21')](_0x1ea2('0x22'),_0x372dc5,'request\x20sent');_0x28040b(_0x48a16e['result'][_0x1ea2('0x27')]);}})[_0x1ea2('0x28')](function(_0x5a539b){logger[_0x1ea2('0x26')](_0x1ea2('0x22'),_0x372dc5,_0x5a539b);_0x53965f(_0x5a539b);});});}function respondWithStatusCode(_0x2dee14,_0x232d0e){_0x232d0e=_0x232d0e||0xcc;return function(_0x31b7a7){if(_0x31b7a7){return _0x2dee14[_0x1ea2('0x29')](_0x232d0e);}return _0x2dee14['status'](_0x232d0e)['end']();};}function respondWithResult(_0x366a83,_0x22ad41){_0x22ad41=_0x22ad41||0xc8;return function(_0x1a2699){if(_0x1a2699){return _0x366a83[_0x1ea2('0x2a')](_0x22ad41)[_0x1ea2('0x2b')](_0x1a2699);}};}function respondWithFilteredResult(_0x288b26,_0x53e48c){return function(_0x127d65){if(_0x127d65){var _0x492466=typeof _0x53e48c[_0x1ea2('0x2c')]===_0x1ea2('0x2d')&&typeof _0x53e48c[_0x1ea2('0x2e')]===_0x1ea2('0x2d');var _0x149251=_0x127d65[_0x1ea2('0x2f')];var _0x10dcf8=_0x492466?0x0:_0x53e48c[_0x1ea2('0x2c')];var _0x545ea5=_0x492466?_0x127d65['count']:_0x53e48c['offset']+_0x53e48c[_0x1ea2('0x2e')];var _0x53ee7f;if(_0x545ea5>=_0x149251){_0x545ea5=_0x149251;_0x53ee7f=0xc8;}else{_0x53ee7f=0xce;}_0x288b26[_0x1ea2('0x2a')](_0x53ee7f);return _0x288b26['set'](_0x1ea2('0x30'),_0x10dcf8+'-'+_0x545ea5+'/'+_0x149251)[_0x1ea2('0x2b')](_0x127d65);}return null;};}function patchUpdates(_0x24a1b4){return function(_0x2c081d){try{jsonpatch[_0x1ea2('0x31')](_0x2c081d,_0x24a1b4,!![]);}catch(_0x152e2b){return BPromise[_0x1ea2('0x32')](_0x152e2b);}return _0x2c081d['save']();};}function saveUpdates(_0xdbc11e,_0x39a07c){return function(_0x4eeb77){if(_0x4eeb77){return _0x4eeb77[_0x1ea2('0x33')](_0xdbc11e)[_0x1ea2('0x20')](function(_0x108b74){return _0x108b74;});}return null;};}function removeEntity(_0x3266a7,_0x3716ac){return function(_0x4b78bb){if(_0x4b78bb){return _0x4b78bb[_0x1ea2('0x34')]()['then'](function(){_0x3266a7[_0x1ea2('0x2a')](0xcc)[_0x1ea2('0x35')]();});}};}function handleEntityNotFound(_0x9a56ad,_0x38a0e9){return function(_0x2b825a){if(!_0x2b825a){_0x9a56ad[_0x1ea2('0x29')](0x194);}return _0x2b825a;};}function handleError(_0x134277,_0x6543f8){_0x6543f8=_0x6543f8||0x1f4;return function(_0x9e5ece){logger[_0x1ea2('0x26')](_0x9e5ece[_0x1ea2('0x36')]);if(_0x9e5ece[_0x1ea2('0x37')]){delete _0x9e5ece[_0x1ea2('0x37')];}_0x134277[_0x1ea2('0x2a')](_0x6543f8)[_0x1ea2('0x38')](_0x9e5ece);};}exports['index']=function(_0x4a4a4d,_0x411766){var _0x7acab0={},_0x3d241c={},_0x3c6ea5={'count':0x0,'rows':[]};var _0x4c189f=_[_0x1ea2('0x39')](db[_0x1ea2('0x3a')][_0x1ea2('0x3b')],function(_0x4cf0c8){return{'name':_0x4cf0c8[_0x1ea2('0x3c')],'type':_0x4cf0c8[_0x1ea2('0x3d')][_0x1ea2('0x3e')]};});_0x3d241c[_0x1ea2('0x3f')]=_['map'](_0x4c189f,'name');_0x3d241c['query']=_[_0x1ea2('0x40')](_0x4a4a4d[_0x1ea2('0x41')]);_0x3d241c[_0x1ea2('0x42')]=_[_0x1ea2('0x43')](_0x3d241c[_0x1ea2('0x3f')],_0x3d241c[_0x1ea2('0x41')]);_0x7acab0[_0x1ea2('0x44')]=_[_0x1ea2('0x43')](_0x3d241c[_0x1ea2('0x3f')],qs[_0x1ea2('0x45')](_0x4a4a4d['query'][_0x1ea2('0x45')]));_0x7acab0['attributes']=_0x7acab0[_0x1ea2('0x44')][_0x1ea2('0x46')]?_0x7acab0[_0x1ea2('0x44')]:_0x3d241c[_0x1ea2('0x3f')];if(!_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x47')]('nolimit')){_0x7acab0[_0x1ea2('0x2e')]=qs['limit'](_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x2e')]);_0x7acab0[_0x1ea2('0x2c')]=qs['offset'](_0x4a4a4d['query'][_0x1ea2('0x2c')]);}_0x7acab0[_0x1ea2('0x48')]=qs[_0x1ea2('0x49')](_0x4a4a4d[_0x1ea2('0x41')]['sort']);_0x7acab0['where']=qs['filters'](_[_0x1ea2('0x4a')](_0x4a4a4d['query'],_0x3d241c[_0x1ea2('0x42')]),_0x4c189f);if(_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x4b')]){_0x7acab0['where']=_['merge'](_0x7acab0[_0x1ea2('0x4c')],{'$or':_['map'](_0x4c189f,function(_0x56fd1b){if(_0x56fd1b[_0x1ea2('0x3d')]!==_0x1ea2('0x4d')){var _0x3dd0da={};_0x3dd0da[_0x56fd1b[_0x1ea2('0x37')]]={'$like':'%'+_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x4b')]+'%'};return _0x3dd0da;}})});}_0x7acab0=_['merge']({},_0x7acab0,_0x4a4a4d['options']);var _0x4e1a0e={'where':_0x7acab0['where']};return db['SmsMessage'][_0x1ea2('0x2f')](_0x4e1a0e)['then'](function(_0x2090da){_0x3c6ea5[_0x1ea2('0x2f')]=_0x2090da;if(_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x4e')]){_0x7acab0[_0x1ea2('0x4f')]=[{'all':!![]}];}return db[_0x1ea2('0x3a')]['findAll'](_0x7acab0);})[_0x1ea2('0x20')](function(_0xf025e5){_0x3c6ea5['rows']=_0xf025e5;return _0x3c6ea5;})[_0x1ea2('0x20')](respondWithFilteredResult(_0x411766,_0x7acab0))[_0x1ea2('0x28')](handleError(_0x411766,null));};exports[_0x1ea2('0x50')]=function(_0x17f675,_0x208cb6){var _0x5afd52={'raw':!![],'where':{'id':_0x17f675[_0x1ea2('0x51')]['id']}},_0x57e0f0={};_0x57e0f0[_0x1ea2('0x3f')]=_[_0x1ea2('0x40')](db[_0x1ea2('0x3a')]['rawAttributes']);_0x57e0f0['query']=_['keys'](_0x17f675[_0x1ea2('0x41')]);_0x57e0f0['filters']=_[_0x1ea2('0x43')](_0x57e0f0['model'],_0x57e0f0['query']);_0x5afd52[_0x1ea2('0x44')]=_['intersection'](_0x57e0f0[_0x1ea2('0x3f')],qs['fields'](_0x17f675[_0x1ea2('0x41')][_0x1ea2('0x45')]));_0x5afd52['attributes']=_0x5afd52['attributes'][_0x1ea2('0x46')]?_0x5afd52[_0x1ea2('0x44')]:_0x57e0f0[_0x1ea2('0x3f')];if(_0x17f675[_0x1ea2('0x41')][_0x1ea2('0x4e')]){_0x5afd52[_0x1ea2('0x4f')]=[{'all':!![]}];}_0x5afd52=_['merge']({},_0x5afd52,_0x17f675['options']);return db[_0x1ea2('0x3a')][_0x1ea2('0x52')](_0x5afd52)['then'](handleEntityNotFound(_0x208cb6,null))[_0x1ea2('0x20')](respondWithResult(_0x208cb6,null))[_0x1ea2('0x28')](handleError(_0x208cb6,null));};exports[_0x1ea2('0x53')]=function(_0x39daca,_0xf300e4){return db['SmsMessage'][_0x1ea2('0x53')](_0x39daca['body'],{})[_0x1ea2('0x20')](respondWithResult(_0xf300e4,0xc9))[_0x1ea2('0x28')](handleError(_0xf300e4,null));};exports[_0x1ea2('0x33')]=function(_0x246b44,_0x4dded6){if(_0x246b44[_0x1ea2('0x54')]['id']){delete _0x246b44['body']['id'];}return db['SmsMessage']['find']({'where':{'id':_0x246b44['params']['id']}})[_0x1ea2('0x20')](handleEntityNotFound(_0x4dded6,null))[_0x1ea2('0x20')](saveUpdates(_0x246b44[_0x1ea2('0x54')],null))['then'](respondWithResult(_0x4dded6,null))[_0x1ea2('0x28')](handleError(_0x4dded6,null));};exports[_0x1ea2('0x34')]=function(_0x1cd123,_0x7f7636){return db['SmsMessage'][_0x1ea2('0x52')]({'where':{'id':_0x1cd123['params']['id']}})[_0x1ea2('0x20')](handleEntityNotFound(_0x7f7636,null))['then'](removeEntity(_0x7f7636,null))[_0x1ea2('0x28')](handleError(_0x7f7636,null));};exports[_0x1ea2('0x55')]=function(_0x3e55cf,_0xee03ef){return db[_0x1ea2('0x3a')][_0x1ea2('0x55')]()[_0x1ea2('0x20')](respondWithResult(_0xee03ef,null))[_0x1ea2('0x28')](handleError(_0xee03ef,null));};var interaction_log=require('../../config/logger')(_0x1ea2('0x56'));exports['accept']=function(_0x1c3a82,_0x364a63,_0x59ae8d){var _0x20ce44={'agent':{},'channel':_0x1ea2('0x57')};if(_0x1c3a82[_0x1ea2('0x54')]['id']){delete _0x1c3a82['body']['id'];}_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x58')]=!![];_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x59')]=moment()[_0x1ea2('0x5a')](_0x1ea2('0x5b'));_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')]=_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')]||_0x1c3a82[_0x1ea2('0x5d')]['id'];_0x20ce44[_0x1ea2('0x5e')]['id']=_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')];return db[_0x1ea2('0x3a')]['find']({'where':{'id':_0x1c3a82[_0x1ea2('0x51')]['id'],'UserId':null}})[_0x1ea2('0x20')](handleEntityNotFound(_0x364a63,null))[_0x1ea2('0x20')](saveUpdates(_0x1c3a82[_0x1ea2('0x54')],null))[_0x1ea2('0x20')](function(_0x157ee8){if(_0x157ee8){_0x20ce44[_0x1ea2('0x27')]=_0x157ee8['get']({'plain':!![]});return db[_0x1ea2('0x5f')][_0x1ea2('0x52')]({'where':{'id':_0x157ee8[_0x1ea2('0x60')]}});}return null;})[_0x1ea2('0x20')](handleEntityNotFound(_0x364a63,null))[_0x1ea2('0x20')](function(_0x4fd0f4){if(_0x4fd0f4){return _0x4fd0f4[_0x1ea2('0x33')]({'UserId':_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')],'read1stAt':_[_0x1ea2('0x61')](_0x4fd0f4[_0x1ea2('0x62')])?moment()[_0x1ea2('0x5a')](_0x1ea2('0x5b')):undefined});}return null;})[_0x1ea2('0x20')](function(_0xcedbec){if(_0xcedbec){_0x20ce44[_0x1ea2('0x63')]=_0xcedbec['get']({'plain':!![]});interaction_log[_0x1ea2('0x21')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1c3a82[_0x1ea2('0x5d')]['id'],_0x1c3a82[_0x1ea2('0x5d')][_0x1ea2('0x37')],_0x1c3a82['user'][_0x1ea2('0x64')],_0x20ce44[_0x1ea2('0x63')]['id'],_0x1c3a82[_0x1ea2('0x54')]?JSON[_0x1ea2('0x25')](_0x1c3a82['body']):_0x1ea2('0x65'));return respondWithRpcPromise(_0x1ea2('0x66'),_0x1ea2('0x67'),_0x20ce44);}return null;})[_0x1ea2('0x20')](function(_0x2488a1){var _0x4ba554='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2488a1['message'][_0x1ea2('0x68')];return db[_0x1ea2('0x69')]['query'](_0x4ba554,{'type':db[_0x1ea2('0x6a')][_0x1ea2('0x6b')][_0x1ea2('0x6c')],'raw':!![]})[_0x1ea2('0x20')](function(_0x2e50b5){return _0x2e50b5;});})[_0x1ea2('0x20')](function(_0x1eb347){if(_0x1eb347){_0x20ce44['message']['contact']=_0x1eb347[0x0];if(!_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')])return;return db['User'][_0x1ea2('0x52')]({'where':{'id':_0x1c3a82[_0x1ea2('0x54')]['UserId'],'role':_0x1ea2('0x5e')},'attributes':['id',_0x1ea2('0x37'),'fullname',_0x1ea2('0x6d'),_0x1ea2('0x6e')],'raw':!![]});}return null;})[_0x1ea2('0x20')](function(_0x547a65){if(!_0x547a65)return null;_0x20ce44['message'][_0x1ea2('0x5e')]=_0x547a65;return _0x20ce44;})['then'](function(_0x415555){if(_0x415555){if(_0x1c3a82['body']['manual']){_0x20ce44['message'][_0x1ea2('0x6f')]=util['format'](_0x1ea2('0x70'),_0x1c3a82[_0x1ea2('0x5d')][_0x1ea2('0x37')]);_0x20ce44[_0x1ea2('0x27')][_0x1ea2('0x71')]=_0x20ce44[_0x1ea2('0x71')];_0x20ce44['message'][_0x1ea2('0x72')]=_0x20ce44[_0x1ea2('0x71')];_0x20ce44[_0x1ea2('0x27')][_0x1ea2('0x73')]='accept';return respondWithRpcPromise(_0x1ea2('0x74'),_0x1ea2('0x74'),{'event':_0x1ea2('0x75'),'message':_0x20ce44[_0x1ea2('0x27')]},client9002)[_0x1ea2('0x20')](function(){return _0x20ce44;});}return _0x20ce44;}return null;})[_0x1ea2('0x20')](respondWithResult(_0x364a63,null))['catch'](handleError(_0x364a63,null));};var interaction_log=require(_0x1ea2('0x76'))(_0x1ea2('0x56'));exports[_0x1ea2('0x32')]=function(_0xe795a6,_0x4d996b,_0x19aa4c){var _0x4323cf={'agent':{},'channel':_0x1ea2('0x57')};if(_0xe795a6[_0x1ea2('0x54')]['id']){delete _0xe795a6[_0x1ea2('0x54')]['id'];}_0xe795a6[_0x1ea2('0x54')][_0x1ea2('0x5c')]=_0xe795a6[_0x1ea2('0x54')][_0x1ea2('0x5c')]||_0xe795a6['user']['id'];_0x4323cf['agent']['id']=_0xe795a6[_0x1ea2('0x54')][_0x1ea2('0x5c')];return db[_0x1ea2('0x3a')][_0x1ea2('0x52')]({'where':{'id':_0xe795a6['params']['id'],'UserId':null}})[_0x1ea2('0x20')](handleEntityNotFound(_0x4d996b,null))[_0x1ea2('0x20')](function(_0x10dc58){if(_0x10dc58){_0x4323cf[_0x1ea2('0x27')]=_0x10dc58['get']({'plain':!![]});return db[_0x1ea2('0x5f')]['find']({'where':{'id':_0x10dc58[_0x1ea2('0x60')]}});}return null;})[_0x1ea2('0x20')](handleEntityNotFound(_0x4d996b,null))['then'](function(_0x5f43ab){if(_0x5f43ab){_0x4323cf[_0x1ea2('0x63')]=_0x5f43ab[_0x1ea2('0x77')]({'plain':!![]});interaction_log[_0x1ea2('0x21')](_0x1ea2('0x78'),_0xe795a6['user']['id'],_0xe795a6['user']['name'],_0xe795a6['user']['role'],_0x4323cf[_0x1ea2('0x63')]['id'],_0xe795a6['body']?JSON['stringify'](_0xe795a6[_0x1ea2('0x54')]):_0x1ea2('0x65'));return respondWithRpcPromise(_0x1ea2('0x79'),_0x1ea2('0x7a'),_0x4323cf);}return null;})[_0x1ea2('0x20')](function(_0x504610){var _0x5c4362=_0x1ea2('0x7b')+_0x504610[_0x1ea2('0x27')]['ContactId'];return db[_0x1ea2('0x69')][_0x1ea2('0x41')](_0x5c4362,{'type':db[_0x1ea2('0x6a')][_0x1ea2('0x6b')][_0x1ea2('0x6c')],'raw':!![]})[_0x1ea2('0x20')](function(_0x377d2b){return _0x377d2b;});})[_0x1ea2('0x20')](function(_0x2a03e5){if(_0x2a03e5){_0x4323cf[_0x1ea2('0x27')][_0x1ea2('0x7c')]=_0x2a03e5[0x0];if(!_0xe795a6['body']['UserId'])return;return db['User']['find']({'where':{'id':_0xe795a6[_0x1ea2('0x54')][_0x1ea2('0x5c')],'role':_0x1ea2('0x5e')},'attributes':['id',_0x1ea2('0x37'),'fullname',_0x1ea2('0x6d'),_0x1ea2('0x6e')],'raw':!![]});}return null;})[_0x1ea2('0x20')](function(_0x3d5982){if(!_0x3d5982)return null;_0x4323cf[_0x1ea2('0x27')][_0x1ea2('0x5e')]=_0x3d5982;return _0x4323cf;})['then'](function(_0x5a7d77){if(_0x5a7d77){_0x5a7d77['message'][_0x1ea2('0x6f')]=util['format'](_0x1ea2('0x70'),_0xe795a6[_0x1ea2('0x5d')][_0x1ea2('0x37')]);_0x5a7d77[_0x1ea2('0x27')]['channel']=_0x4323cf[_0x1ea2('0x71')];_0x5a7d77[_0x1ea2('0x27')][_0x1ea2('0x72')]=_0x4323cf[_0x1ea2('0x71')];_0x5a7d77[_0x1ea2('0x27')][_0x1ea2('0x73')]=_0x1ea2('0x32');respondWithRpcPromise(_0x1ea2('0x74'),_0x1ea2('0x74'),{'event':_0x1ea2('0x7d'),'message':_0x5a7d77[_0x1ea2('0x27')]},client9002);return _0x4323cf;}return null;})[_0x1ea2('0x20')](respondWithResult(_0x4d996b,null))[_0x1ea2('0x28')](handleError(_0x4d996b,null));};exports[_0x1ea2('0x2a')]=function(_0x225f86,_0x53fdb8,_0x40a341){if(_0x225f86['body']['id']){delete _0x225f86['body']['id'];}var _0xdd392f;return db[_0x1ea2('0x3a')][_0x1ea2('0x52')]({'where':{'id':_0x225f86['params']['id']}})[_0x1ea2('0x20')](handleEntityNotFound(_0x53fdb8,null))['then'](function(_0x2c4c63){if(_0x2c4c63){_0xdd392f=_0x2c4c63;return db[_0x1ea2('0x7e')][_0x1ea2('0x52')]({'where':{'id':_0x2c4c63[_0x1ea2('0x7f')]}});}})[_0x1ea2('0x20')](handleEntityNotFound(_0x53fdb8,null))['then'](function(_0x27a77a){if(_0x27a77a){logger['debug'](_0x1ea2('0x24'),'status',_0x1ea2('0x80'),_0x27a77a[_0x1ea2('0x3d')],util[_0x1ea2('0x81')](_0x225f86['body'],{'showHidden':![],'depth':null}));switch(_0x27a77a[_0x1ea2('0x3d')]){case'twilio':if(_0x225f86[_0x1ea2('0x54')][_0x1ea2('0x82')]&&_0x225f86[_0x1ea2('0x54')][_0x1ea2('0x82')]===_0xdd392f[_0x1ea2('0x83')]){return _0xdd392f[_0x1ea2('0x33')]({'read':!![]});}else{logger['error'](_0x1ea2('0x84'),_0x1ea2('0x2a'),_0x1ea2('0x85'),util['inspect'](_0x225f86['body'],{'showHidden':![],'depth':null}));}break;case _0x1ea2('0x86'):if(_0x225f86['body'][_0x1ea2('0x87')]&&_0x225f86[_0x1ea2('0x54')][_0x1ea2('0x87')]===_0xdd392f['messageId']&&_[_0x1ea2('0x88')]([_0x1ea2('0x89'),'delivered'],_0x225f86[_0x1ea2('0x54')][_0x1ea2('0x8a')])>=0x0){return _0xdd392f[_0x1ea2('0x33')]({'read':!![]});}else{logger[_0x1ea2('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1ea2('0x2a'),_0x1ea2('0x8b'),util[_0x1ea2('0x81')](_0x225f86[_0x1ea2('0x54')],{'showHidden':![],'depth':null}));}break;case _0x1ea2('0x8c'):var _0x1f5cb3=_0x225f86[_0x1ea2('0x54')]['results'][0x0];if(_0x1f5cb3[_0x1ea2('0x2a')][_0x1ea2('0x8d')]===_0x1ea2('0x8e')){return _0xdd392f[_0x1ea2('0x33')]({'read':!![]});}else{logger[_0x1ea2('0x26')](_0x1ea2('0x84'),_0x1ea2('0x2a'),_0x1ea2('0x8c'),util[_0x1ea2('0x81')](_0x225f86[_0x1ea2('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xdd392f;}})['then'](respondWithResult(_0x53fdb8,null))[_0x1ea2('0x28')](handleError(_0x53fdb8,null));}; \ No newline at end of file +var _0x97b2=['plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','find','create','body','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','update','isNil','read1stAt','interaction','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteractionId','rejectMessage','email','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','indexOf','sent','delivered','Status'];(function(_0x501f78,_0xc08722){var _0xca5be5=function(_0x4e49e1){while(--_0x4e49e1){_0x501f78['push'](_0x501f78['shift']());}};_0xca5be5(++_0xc08722);}(_0x97b2,0x1b7));var _0x297b=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x97b2[_0x9df060];return _0x338dfe;};'use strict';var emlformat=require(_0x297b('0x0'));var rimraf=require(_0x297b('0x1'));var zipdir=require(_0x297b('0x2'));var jsonpatch=require(_0x297b('0x3'));var rp=require(_0x297b('0x4'));var moment=require(_0x297b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x297b('0x6'));var util=require(_0x297b('0x7'));var path=require('path');var sox=require(_0x297b('0x8'));var csv=require(_0x297b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x297b('0xa'));var crypto=require(_0x297b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x297b('0xc'));var toCsv=require(_0x297b('0x9'));var querystring=require('querystring');var Papa=require(_0x297b('0xd'));var Redis=require('ioredis');var authService=require(_0x297b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x297b('0xf'));var hardwareService=require(_0x297b('0x10'));var logger=require(_0x297b('0x11'))(_0x297b('0x12'));var utils=require(_0x297b('0x13'));var config=require(_0x297b('0x14'));var licenseUtil=require(_0x297b('0x15'));var db=require(_0x297b('0x16'))['db'];config[_0x297b('0x17')]=_[_0x297b('0x18')](config[_0x297b('0x17')],{'host':_0x297b('0x19'),'port':0x18eb});var socket=require(_0x297b('0x1a'))(new Redis(config[_0x297b('0x17')]));require(_0x297b('0x1b'))['register'](socket);var jayson=require(_0x297b('0x1c'));var client=jayson[_0x297b('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x297b('0x1d')][_0x297b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4455f3,_0x241ff6,_0x11469e,_0x2b0e25){return new BPromise(function(_0x4882a4,_0x3a583b){var _0x34854d=_0x2b0e25||client;return _0x34854d[_0x297b('0x1f')](_0x4455f3,_0x11469e)['then'](function(_0x5bc19c){logger[_0x297b('0x20')]('SmsMessage,\x20%s,\x20%s',_0x241ff6,_0x297b('0x21'));logger[_0x297b('0x22')](_0x297b('0x23'),_0x241ff6,_0x297b('0x21'),JSON[_0x297b('0x24')](_0x5bc19c));if(_0x5bc19c['error']){if(_0x5bc19c[_0x297b('0x25')][_0x297b('0x26')]===0x1f4){logger['error'](_0x297b('0x27'),_0x241ff6,_0x5bc19c[_0x297b('0x25')][_0x297b('0x28')]);return _0x3a583b(_0x5bc19c[_0x297b('0x25')][_0x297b('0x28')]);}logger[_0x297b('0x25')](_0x297b('0x27'),_0x241ff6,_0x5bc19c['error'][_0x297b('0x28')]);return _0x4882a4(_0x5bc19c[_0x297b('0x25')][_0x297b('0x28')]);}else{logger['info'](_0x297b('0x27'),_0x241ff6,_0x297b('0x21'));_0x4882a4(_0x5bc19c[_0x297b('0x29')][_0x297b('0x28')]);}})[_0x297b('0x2a')](function(_0x4e995f){logger['error'](_0x297b('0x27'),_0x241ff6,_0x4e995f);_0x3a583b(_0x4e995f);});});}function respondWithStatusCode(_0x3af713,_0x46c23d){_0x46c23d=_0x46c23d||0xcc;return function(_0x2894b0){if(_0x2894b0){return _0x3af713[_0x297b('0x2b')](_0x46c23d);}return _0x3af713[_0x297b('0x2c')](_0x46c23d)[_0x297b('0x2d')]();};}function respondWithResult(_0x52bb5c,_0x4ab68b){_0x4ab68b=_0x4ab68b||0xc8;return function(_0x4c7d77){if(_0x4c7d77){return _0x52bb5c[_0x297b('0x2c')](_0x4ab68b)['json'](_0x4c7d77);}};}function respondWithFilteredResult(_0x5c2c26,_0x861618){return function(_0x323c47){if(_0x323c47){var _0x2d64a=typeof _0x861618[_0x297b('0x2e')]===_0x297b('0x2f')&&typeof _0x861618[_0x297b('0x30')]==='undefined';var _0x3a7105=_0x323c47['count'];var _0xf59317=_0x2d64a?0x0:_0x861618[_0x297b('0x2e')];var _0x4544ee=_0x2d64a?_0x323c47[_0x297b('0x31')]:_0x861618[_0x297b('0x2e')]+_0x861618[_0x297b('0x30')];var _0x1e22b3;if(_0x4544ee>=_0x3a7105){_0x4544ee=_0x3a7105;_0x1e22b3=0xc8;}else{_0x1e22b3=0xce;}_0x5c2c26[_0x297b('0x2c')](_0x1e22b3);return _0x5c2c26[_0x297b('0x32')](_0x297b('0x33'),_0xf59317+'-'+_0x4544ee+'/'+_0x3a7105)[_0x297b('0x34')](_0x323c47);}return null;};}function patchUpdates(_0x25165b){return function(_0x516b23){try{jsonpatch['apply'](_0x516b23,_0x25165b,!![]);}catch(_0x45b4c5){return BPromise[_0x297b('0x35')](_0x45b4c5);}return _0x516b23[_0x297b('0x36')]();};}function saveUpdates(_0x2f0b43,_0x576fcb){return function(_0x176790){if(_0x176790){return _0x176790['update'](_0x2f0b43)['then'](function(_0x400882){return _0x400882;});}return null;};}function removeEntity(_0x37cea8,_0x742e0b){return function(_0x2816f2){if(_0x2816f2){return _0x2816f2['destroy']()[_0x297b('0x37')](function(){_0x37cea8['status'](0xcc)[_0x297b('0x2d')]();});}};}function handleEntityNotFound(_0x6b96c0,_0x51c16b){return function(_0x472595){if(!_0x472595){_0x6b96c0[_0x297b('0x2b')](0x194);}return _0x472595;};}function handleError(_0x47cdf9,_0x51fac5){_0x51fac5=_0x51fac5||0x1f4;return function(_0x8e1844){logger[_0x297b('0x25')](_0x8e1844[_0x297b('0x38')]);if(_0x8e1844['name']){delete _0x8e1844[_0x297b('0x39')];}_0x47cdf9['status'](_0x51fac5)[_0x297b('0x3a')](_0x8e1844);};}exports['index']=function(_0x3d94ed,_0x46503d){var _0x2baa3e={},_0x18d861={},_0xc102da={'count':0x0,'rows':[]};var _0x4fade6=_[_0x297b('0x3b')](db[_0x297b('0x3c')][_0x297b('0x3d')],function(_0x581897){return{'name':_0x581897[_0x297b('0x3e')],'type':_0x581897[_0x297b('0x3f')][_0x297b('0x40')]};});_0x18d861[_0x297b('0x41')]=_[_0x297b('0x3b')](_0x4fade6,_0x297b('0x39'));_0x18d861[_0x297b('0x42')]=_[_0x297b('0x43')](_0x3d94ed[_0x297b('0x42')]);_0x18d861[_0x297b('0x44')]=_['intersection'](_0x18d861['model'],_0x18d861[_0x297b('0x42')]);_0x2baa3e[_0x297b('0x45')]=_[_0x297b('0x46')](_0x18d861[_0x297b('0x41')],qs[_0x297b('0x47')](_0x3d94ed[_0x297b('0x42')]['fields']));_0x2baa3e[_0x297b('0x45')]=_0x2baa3e[_0x297b('0x45')][_0x297b('0x48')]?_0x2baa3e[_0x297b('0x45')]:_0x18d861[_0x297b('0x41')];if(!_0x3d94ed[_0x297b('0x42')][_0x297b('0x49')](_0x297b('0x4a'))){_0x2baa3e['limit']=qs[_0x297b('0x30')](_0x3d94ed['query'][_0x297b('0x30')]);_0x2baa3e[_0x297b('0x2e')]=qs[_0x297b('0x2e')](_0x3d94ed[_0x297b('0x42')][_0x297b('0x2e')]);}_0x2baa3e[_0x297b('0x4b')]=qs[_0x297b('0x4c')](_0x3d94ed['query'][_0x297b('0x4c')]);_0x2baa3e[_0x297b('0x4d')]=qs['filters'](_[_0x297b('0x4e')](_0x3d94ed[_0x297b('0x42')],_0x18d861[_0x297b('0x44')]),_0x4fade6);if(_0x3d94ed['query'][_0x297b('0x4f')]){_0x2baa3e[_0x297b('0x4d')]=_[_0x297b('0x50')](_0x2baa3e['where'],{'$or':_[_0x297b('0x3b')](_0x4fade6,function(_0x2deb62){if(_0x2deb62[_0x297b('0x3f')]!=='VIRTUAL'){var _0x1e0a80={};_0x1e0a80[_0x2deb62[_0x297b('0x39')]]={'$like':'%'+_0x3d94ed[_0x297b('0x42')][_0x297b('0x4f')]+'%'};return _0x1e0a80;}})});}_0x2baa3e=_[_0x297b('0x50')]({},_0x2baa3e,_0x3d94ed['options']);var _0x375975={'where':_0x2baa3e[_0x297b('0x4d')]};return db['SmsMessage'][_0x297b('0x31')](_0x375975)[_0x297b('0x37')](function(_0x3cd8f8){_0xc102da[_0x297b('0x31')]=_0x3cd8f8;if(_0x3d94ed[_0x297b('0x42')][_0x297b('0x51')]){_0x2baa3e[_0x297b('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x297b('0x53')](_0x2baa3e);})[_0x297b('0x37')](function(_0x113cf0){_0xc102da[_0x297b('0x54')]=_0x113cf0;return _0xc102da;})['then'](respondWithFilteredResult(_0x46503d,_0x2baa3e))[_0x297b('0x2a')](handleError(_0x46503d,null));};exports[_0x297b('0x55')]=function(_0x15c105,_0x4a15e1){var _0x11a6e6={'raw':!![],'where':{'id':_0x15c105[_0x297b('0x56')]['id']}},_0x3984d1={};_0x3984d1[_0x297b('0x41')]=_['keys'](db['SmsMessage'][_0x297b('0x3d')]);_0x3984d1[_0x297b('0x42')]=_[_0x297b('0x43')](_0x15c105['query']);_0x3984d1[_0x297b('0x44')]=_[_0x297b('0x46')](_0x3984d1[_0x297b('0x41')],_0x3984d1['query']);_0x11a6e6[_0x297b('0x45')]=_['intersection'](_0x3984d1[_0x297b('0x41')],qs[_0x297b('0x47')](_0x15c105['query'][_0x297b('0x47')]));_0x11a6e6[_0x297b('0x45')]=_0x11a6e6[_0x297b('0x45')]['length']?_0x11a6e6['attributes']:_0x3984d1['model'];if(_0x15c105[_0x297b('0x42')][_0x297b('0x51')]){_0x11a6e6['include']=[{'all':!![]}];}_0x11a6e6=_['merge']({},_0x11a6e6,_0x15c105['options']);return db['SmsMessage'][_0x297b('0x57')](_0x11a6e6)[_0x297b('0x37')](handleEntityNotFound(_0x4a15e1,null))[_0x297b('0x37')](respondWithResult(_0x4a15e1,null))[_0x297b('0x2a')](handleError(_0x4a15e1,null));};exports[_0x297b('0x58')]=function(_0x1665a2,_0x144fd4){return db[_0x297b('0x3c')][_0x297b('0x58')](_0x1665a2[_0x297b('0x59')],{})[_0x297b('0x37')](respondWithResult(_0x144fd4,0xc9))[_0x297b('0x2a')](handleError(_0x144fd4,null));};exports['update']=function(_0x33e218,_0x952533){if(_0x33e218[_0x297b('0x59')]['id']){delete _0x33e218[_0x297b('0x59')]['id'];}return db[_0x297b('0x3c')][_0x297b('0x57')]({'where':{'id':_0x33e218[_0x297b('0x56')]['id']}})[_0x297b('0x37')](handleEntityNotFound(_0x952533,null))['then'](saveUpdates(_0x33e218['body'],null))['then'](respondWithResult(_0x952533,null))[_0x297b('0x2a')](handleError(_0x952533,null));};exports['destroy']=function(_0x42487b,_0x14177d){return db[_0x297b('0x3c')][_0x297b('0x57')]({'where':{'id':_0x42487b['params']['id']}})[_0x297b('0x37')](handleEntityNotFound(_0x14177d,null))[_0x297b('0x37')](removeEntity(_0x14177d,null))['catch'](handleError(_0x14177d,null));};exports['describe']=function(_0xab1740,_0x1ed582){return db[_0x297b('0x3c')]['describe']()[_0x297b('0x37')](respondWithResult(_0x1ed582,null))[_0x297b('0x2a')](handleError(_0x1ed582,null));};var interaction_log=require(_0x297b('0x11'))(_0x297b('0x5a'));exports[_0x297b('0x5b')]=function(_0x2f2735,_0x22d463,_0x3be4f5){var _0x5590a1={'agent':{},'channel':_0x297b('0x5c')};if(_0x2f2735[_0x297b('0x59')]['id']){delete _0x2f2735['body']['id'];}_0x2f2735[_0x297b('0x59')][_0x297b('0x5d')]=!![];_0x2f2735[_0x297b('0x59')][_0x297b('0x5e')]=moment()[_0x297b('0x5f')](_0x297b('0x60'));_0x2f2735['body'][_0x297b('0x61')]=_0x2f2735[_0x297b('0x59')][_0x297b('0x61')]||_0x2f2735[_0x297b('0x62')]['id'];_0x5590a1[_0x297b('0x63')]['id']=_0x2f2735[_0x297b('0x59')][_0x297b('0x61')];return db['SmsMessage'][_0x297b('0x57')]({'where':{'id':_0x2f2735['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22d463,null))[_0x297b('0x37')](saveUpdates(_0x2f2735[_0x297b('0x59')],null))[_0x297b('0x37')](function(_0x127642){if(_0x127642){_0x5590a1['message']=_0x127642[_0x297b('0x64')]({'plain':!![]});return db[_0x297b('0x65')]['find']({'where':{'id':_0x127642['SmsInteractionId']}});}return null;})[_0x297b('0x37')](handleEntityNotFound(_0x22d463,null))[_0x297b('0x37')](function(_0x2bf2f5){if(_0x2bf2f5){return _0x2bf2f5[_0x297b('0x66')]({'UserId':_0x2f2735[_0x297b('0x59')]['UserId'],'read1stAt':_[_0x297b('0x67')](_0x2bf2f5[_0x297b('0x68')])?moment()['format'](_0x297b('0x60')):undefined});}return null;})[_0x297b('0x37')](function(_0x4d1d32){if(_0x4d1d32){_0x5590a1[_0x297b('0x69')]=_0x4d1d32[_0x297b('0x64')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2f2735[_0x297b('0x62')]['id'],_0x2f2735[_0x297b('0x62')]['name'],_0x2f2735[_0x297b('0x62')][_0x297b('0x6a')],_0x5590a1[_0x297b('0x69')]['id'],_0x2f2735['body']?JSON[_0x297b('0x24')](_0x2f2735[_0x297b('0x59')]):_0x297b('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5590a1);}return null;})[_0x297b('0x37')](function(_0x58cfb3){var _0x172b08=_0x297b('0x6c')+_0x58cfb3[_0x297b('0x28')][_0x297b('0x6d')];return db[_0x297b('0x6e')][_0x297b('0x42')](_0x172b08,{'type':db[_0x297b('0x6f')][_0x297b('0x70')][_0x297b('0x71')],'raw':!![]})['then'](function(_0x47ad74){return _0x47ad74;});})[_0x297b('0x37')](function(_0x483791){if(_0x483791){_0x5590a1['message']['contact']=_0x483791[0x0];if(!_0x2f2735[_0x297b('0x59')][_0x297b('0x61')])return;return db[_0x297b('0x72')][_0x297b('0x57')]({'where':{'id':_0x2f2735[_0x297b('0x59')][_0x297b('0x61')],'role':_0x297b('0x63')},'attributes':['id',_0x297b('0x39'),_0x297b('0x73'),'email',_0x297b('0x74')],'raw':!![]});}return null;})['then'](function(_0x25e230){if(!_0x25e230)return null;_0x5590a1[_0x297b('0x28')][_0x297b('0x63')]=_0x25e230;return _0x5590a1;})[_0x297b('0x37')](function(_0x55f606){if(_0x55f606){if(_0x2f2735[_0x297b('0x59')][_0x297b('0x75')]){_0x5590a1['message'][_0x297b('0x76')]=util[_0x297b('0x5f')](_0x297b('0x77'),_0x2f2735[_0x297b('0x62')]['name']);_0x5590a1[_0x297b('0x28')][_0x297b('0x78')]=_0x5590a1[_0x297b('0x78')];_0x5590a1[_0x297b('0x28')][_0x297b('0x79')]=_0x5590a1[_0x297b('0x78')];_0x5590a1[_0x297b('0x28')][_0x297b('0x7a')]=_0x297b('0x5b');return respondWithRpcPromise('EventManager',_0x297b('0x7b'),{'event':_0x297b('0x7c'),'message':_0x5590a1[_0x297b('0x28')]},client9002)[_0x297b('0x37')](function(){return _0x5590a1;});}return _0x5590a1;}return null;})[_0x297b('0x37')](respondWithResult(_0x22d463,null))[_0x297b('0x2a')](handleError(_0x22d463,null));};var interaction_log=require(_0x297b('0x11'))(_0x297b('0x5a'));exports[_0x297b('0x35')]=function(_0x11bbd2,_0x45f47b,_0x2026e0){var _0x587349={'agent':{},'channel':_0x297b('0x5c')};if(_0x11bbd2['body']['id']){delete _0x11bbd2[_0x297b('0x59')]['id'];}_0x11bbd2['body'][_0x297b('0x61')]=_0x11bbd2['body'][_0x297b('0x61')]||_0x11bbd2[_0x297b('0x62')]['id'];_0x587349['agent']['id']=_0x11bbd2[_0x297b('0x59')][_0x297b('0x61')];return db[_0x297b('0x3c')]['find']({'where':{'id':_0x11bbd2[_0x297b('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x45f47b,null))['then'](function(_0x1408cc){if(_0x1408cc){_0x587349['message']=_0x1408cc[_0x297b('0x64')]({'plain':!![]});return db['SmsInteraction'][_0x297b('0x57')]({'where':{'id':_0x1408cc[_0x297b('0x7d')]}});}return null;})[_0x297b('0x37')](handleEntityNotFound(_0x45f47b,null))['then'](function(_0x993109){if(_0x993109){_0x587349[_0x297b('0x69')]=_0x993109[_0x297b('0x64')]({'plain':!![]});interaction_log[_0x297b('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11bbd2[_0x297b('0x62')]['id'],_0x11bbd2[_0x297b('0x62')][_0x297b('0x39')],_0x11bbd2['user'][_0x297b('0x6a')],_0x587349[_0x297b('0x69')]['id'],_0x11bbd2[_0x297b('0x59')]?JSON['stringify'](_0x11bbd2['body']):_0x297b('0x6b'));return respondWithRpcPromise('RejectMessage',_0x297b('0x7e'),_0x587349);}return null;})[_0x297b('0x37')](function(_0x141aa7){var _0x2cdcaf=_0x297b('0x6c')+_0x141aa7[_0x297b('0x28')][_0x297b('0x6d')];return db[_0x297b('0x6e')][_0x297b('0x42')](_0x2cdcaf,{'type':db[_0x297b('0x6f')][_0x297b('0x70')][_0x297b('0x71')],'raw':!![]})[_0x297b('0x37')](function(_0x41ea30){return _0x41ea30;});})['then'](function(_0x44dc7e){if(_0x44dc7e){_0x587349['message']['contact']=_0x44dc7e[0x0];if(!_0x11bbd2[_0x297b('0x59')][_0x297b('0x61')])return;return db[_0x297b('0x72')][_0x297b('0x57')]({'where':{'id':_0x11bbd2[_0x297b('0x59')][_0x297b('0x61')],'role':_0x297b('0x63')},'attributes':['id','name',_0x297b('0x73'),_0x297b('0x7f'),_0x297b('0x74')],'raw':!![]});}return null;})['then'](function(_0x367492){if(!_0x367492)return null;_0x587349['message'][_0x297b('0x63')]=_0x367492;return _0x587349;})[_0x297b('0x37')](function(_0x392871){if(_0x392871){_0x392871[_0x297b('0x28')]['interface']=util[_0x297b('0x5f')](_0x297b('0x77'),_0x11bbd2[_0x297b('0x62')][_0x297b('0x39')]);_0x392871[_0x297b('0x28')][_0x297b('0x78')]=_0x587349[_0x297b('0x78')];_0x392871[_0x297b('0x28')][_0x297b('0x79')]=_0x587349[_0x297b('0x78')];_0x392871['message']['event']='reject';respondWithRpcPromise(_0x297b('0x7b'),_0x297b('0x7b'),{'event':_0x297b('0x80'),'message':_0x392871['message']},client9002);return _0x587349;}return null;})['then'](respondWithResult(_0x45f47b,null))['catch'](handleError(_0x45f47b,null));};exports['status']=function(_0x5950b6,_0x131acb,_0x20d61b){if(_0x5950b6['body']['id']){delete _0x5950b6[_0x297b('0x59')]['id'];}var _0x18667a;return db[_0x297b('0x3c')]['find']({'where':{'id':_0x5950b6[_0x297b('0x56')]['id']}})[_0x297b('0x37')](handleEntityNotFound(_0x131acb,null))[_0x297b('0x37')](function(_0x17f387){if(_0x17f387){_0x18667a=_0x17f387;return db[_0x297b('0x81')][_0x297b('0x57')]({'where':{'id':_0x17f387['SmsAccountId']}});}})[_0x297b('0x37')](handleEntityNotFound(_0x131acb,null))[_0x297b('0x37')](function(_0x50c996){if(_0x50c996){logger[_0x297b('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x297b('0x2c'),_0x297b('0x82'),_0x50c996[_0x297b('0x3f')],util[_0x297b('0x83')](_0x5950b6[_0x297b('0x59')],{'showHidden':![],'depth':null}));switch(_0x50c996[_0x297b('0x3f')]){case _0x297b('0x84'):if(_0x5950b6[_0x297b('0x59')][_0x297b('0x85')]&&_0x5950b6[_0x297b('0x59')][_0x297b('0x85')]===_0x18667a[_0x297b('0x86')]){return _0x18667a[_0x297b('0x66')]({'read':!![]});}else{logger[_0x297b('0x25')](_0x297b('0x87'),_0x297b('0x2c'),_0x297b('0x84'),util[_0x297b('0x83')](_0x5950b6['body'],{'showHidden':![],'depth':null}));}break;case _0x297b('0x88'):if(_0x5950b6[_0x297b('0x59')]['MessageUUID']&&_0x5950b6[_0x297b('0x59')]['MessageUUID']===_0x18667a['messageId']&&_[_0x297b('0x89')]([_0x297b('0x8a'),_0x297b('0x8b')],_0x5950b6['body'][_0x297b('0x8c')])>=0x0){return _0x18667a['update']({'read':!![]});}else{logger[_0x297b('0x25')](_0x297b('0x87'),'status',_0x297b('0x8d'),util[_0x297b('0x83')](_0x5950b6[_0x297b('0x59')],{'showHidden':![],'depth':null}));}break;case _0x297b('0x8e'):var _0x563891=_0x5950b6[_0x297b('0x59')]['results'][0x0];if(_0x563891['status'][_0x297b('0x8f')]===_0x297b('0x90')){return _0x18667a[_0x297b('0x66')]({'read':!![]});}else{logger['error'](_0x297b('0x87'),'status','infobip',util[_0x297b('0x83')](_0x5950b6[_0x297b('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x18667a;}})[_0x297b('0x37')](respondWithResult(_0x131acb,null))[_0x297b('0x2a')](handleError(_0x131acb,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f9ef2d9..7d9ae2b 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 _0xcf14=['exports','events','../../mysqldb','save','remove','emit','hook'];(function(_0x4855a7,_0x133b87){var _0x2d3855=function(_0x89fbcb){while(--_0x89fbcb){_0x4855a7['push'](_0x4855a7['shift']());}};_0x2d3855(++_0x133b87);}(_0xcf14,0x12e));var _0x4cf1=function(_0x283006,_0x54f88d){_0x283006=_0x283006-0x0;var _0x162518=_0xcf14[_0x283006];return _0x162518;};'use strict';var EventEmitter=require(_0x4cf1('0x0'));var SmsMessage=require(_0x4cf1('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4cf1('0x2'),'afterUpdate':'update','afterDestroy':_0x4cf1('0x3')};function emitEvent(_0x53787f){return function(_0x4820b4,_0x12394d,_0x479c0f){SmsMessageEvents[_0x4cf1('0x4')](_0x53787f+':'+_0x4820b4['id'],_0x4820b4);SmsMessageEvents[_0x4cf1('0x4')](_0x53787f,_0x4820b4);_0x479c0f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x4cf1('0x5')](e,emitEvent(event));}}module[_0x4cf1('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x8fae=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x29bdb3,_0x5c5afd){var _0x226a50=function(_0x45e99f){while(--_0x45e99f){_0x29bdb3['push'](_0x29bdb3['shift']());}};_0x226a50(++_0x5c5afd);}(_0x8fae,0x16a));var _0xe8fa=function(_0x5dbe03,_0x2941ff){_0x5dbe03=_0x5dbe03-0x0;var _0x8f51a9=_0x8fae[_0x5dbe03];return _0x8f51a9;};'use strict';var EventEmitter=require(_0xe8fa('0x0'));var SmsMessage=require(_0xe8fa('0x1'))['db'][_0xe8fa('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe8fa('0x3')](0x0);var events={'afterCreate':_0xe8fa('0x4'),'afterUpdate':_0xe8fa('0x5'),'afterDestroy':'remove'};function emitEvent(_0x484005){return function(_0x5d5ae6,_0x3e8add,_0x1075c4){SmsMessageEvents[_0xe8fa('0x6')](_0x484005+':'+_0x5d5ae6['id'],_0x5d5ae6);SmsMessageEvents[_0xe8fa('0x6')](_0x484005,_0x5d5ae6);_0x1075c4(null);};}for(var e in events){if(events[_0xe8fa('0x7')](e)){var event=events[e];SmsMessage[_0xe8fa('0x8')](e,emitEvent(event));}}module[_0xe8fa('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 213afe9..36a1142 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 _0xfced=['/messages','intelepeer','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','message','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','findOne','then','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','authToken','create','body','remote','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','phone','login?username=','&password=','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','POST','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','messages','message_id','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','sort','createHash','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','accountId'];(function(_0x1bbb30,_0x145f45){var _0x5955c2=function(_0x24ba7b){while(--_0x24ba7b){_0x1bbb30['push'](_0x1bbb30['shift']());}};_0x5955c2(++_0x145f45);}(_0xfced,0x1dc));var _0xdfce=function(_0xe07e35,_0x2a8935){_0xe07e35=_0xe07e35-0x0;var _0x2e5ae7=_0xfced[_0xe07e35];return _0x2e5ae7;};'use strict';var _=require(_0xdfce('0x0'));var util=require(_0xdfce('0x1'));var logger=require(_0xdfce('0x2'))(_0xdfce('0x3'));var moment=require(_0xdfce('0x4'));var BPromise=require(_0xdfce('0x5'));var rp=require(_0xdfce('0x6'));var fs=require('fs');var path=require(_0xdfce('0x7'));var rimraf=require('rimraf');var config=require(_0xdfce('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x5880ac,_0x563eaa){return _0x5880ac['define'](_0xdfce('0x9'),attributes,{'tableName':_0xdfce('0xa'),'paranoid':![],'indexes':[{'name':_0xdfce('0xb'),'fields':[_0xdfce('0xb')]},{'name':_0xdfce('0xc'),'fields':['body'],'type':_0xdfce('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x84510b,_0x3c53db,_0x246d97){var _0x1de9d2=_0x5880ac['models'];var _0x490f31=_0x84510b[_0xdfce('0xe')]({'plain':!![]});if(_0x490f31[_0xdfce('0xf')][_0xdfce('0x10')]()==='in'||_0x490f31[_0xdfce('0xf')][_0xdfce('0x10')]()===_0xdfce('0x11')&&!_0x490f31['secret']&&!_[_0xdfce('0x12')](_0x490f31[_0xdfce('0x13')])&&!_[_0xdfce('0x12')](_0x490f31[_0xdfce('0x14')])){_0x1de9d2['SmsInteraction'][_0xdfce('0x15')]({'where':{'id':_0x490f31['SmsInteractionId']}})[_0xdfce('0x16')](function(_0x13d5fe){if(_0x13d5fe){_0x13d5fe['update']({'lastMsgAt':_0x490f31[_0xdfce('0x17')],'lastMsgDirection':_0x490f31['direction']['toLowerCase']()});}})[_0xdfce('0x18')](function(_0x51153c){console[_0xdfce('0x19')](_0x51153c);});}if(_0x490f31[_0xdfce('0xf')]===_0xdfce('0x11')&&!_0x490f31[_0xdfce('0x1a')]){var _0x2c0e43;_0x1de9d2[_0xdfce('0x1b')][_0xdfce('0x1c')]({'where':{'id':_0x490f31[_0xdfce('0x1d')]},'raw':!![]})[_0xdfce('0x16')](function(_0x3bdf3a){_0x2c0e43=_0x3bdf3a;if(_0x2c0e43&&_0x2c0e43[_0xdfce('0x1e')]){switch(_0x2c0e43[_0xdfce('0x1e')]){case _0xdfce('0x1f'):var _0x4cbded=require('twilio');if(_0x2c0e43['accountSid']&&_0x2c0e43[_0xdfce('0x20')]&&_0x2c0e43['phone']){var _0x42f616=new _0x4cbded(_0x2c0e43['accountSid'],_0x2c0e43[_0xdfce('0x20')]);_0x42f616['messages'][_0xdfce('0x21')]({'body':_0x490f31[_0xdfce('0x22')],'to':_0x490f31['phone'],'from':_0x2c0e43['phone'],'statusCallback':_0x2c0e43[_0xdfce('0x23')]+'/api/sms/messages/'+_0x490f31['id']+_0xdfce('0x24')+_0x2c0e43[_0xdfce('0x25')]})[_0xdfce('0x16')](function(_0x42c409){if(_0x42c409[_0xdfce('0x26')]){return _0x84510b[_0xdfce('0x27')]({'messageId':_0x42c409[_0xdfce('0x26')]});}})['catch'](function(_0x24a79a){logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x1f'),util[_0xdfce('0x29')](_0x24a79a,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xdfce('0x2b'):var _0x2644a8=_0xdfce('0x2c');if(_0x2c0e43[_0xdfce('0x2d')]&&_0x2c0e43[_0xdfce('0x2e')]){var _0xbd8363={'recipient':[_0x490f31['phone']],'message':_0x490f31['body'],'message_type':_0x2c0e43[_0xdfce('0x2f')]};if(_0x2c0e43[_0xdfce('0x2f')]&&_0x2c0e43[_0xdfce('0x2f')]!=='SI'){_0xbd8363[_0xdfce('0x30')]=_0x2c0e43[_0xdfce('0x31')];}var _0x496f43={'url':_0x2644a8+_0xdfce('0x32')+_0x2c0e43['username']+_0xdfce('0x33')+_0x2c0e43['password'],'method':'GET'};rp(_0x496f43)[_0xdfce('0x16')](function(_0x38b17b){var _0x4c147f=_0x38b17b['split'](';');var _0x1f93a1={'user_key':_0x4c147f[0x0],'session_key':_0x4c147f[0x1]};_0x496f43={'url':_0x2644a8+'sms','method':'POST','headers':{'user_key':_0x1f93a1['user_key'],'Session_key':_0x1f93a1[_0xdfce('0x34')]},'json':!![],'body':_0xbd8363};return rp(_0x496f43);})[_0xdfce('0x16')](function(_0x46f8f8){if(_0x46f8f8[_0xdfce('0x35')]>=0x1){var _0x54e023={'messageId':_0x46f8f8[_0xdfce('0x36')]};if(_0x2c0e43[_0xdfce('0x2f')]!=='GP'||!_0x2c0e43[_0xdfce('0x37')]){_0x54e023[_0xdfce('0x38')]=!![];}return _0x84510b[_0xdfce('0x27')](_0x54e023);}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x2b'),util[_0xdfce('0x29')](_0x46f8f8,{'showHidden':![],'depth':null}));}})[_0xdfce('0x18')](function(_0x9f9e10){return logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x2b'),util[_0xdfce('0x29')](_0x9f9e10,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x2b'),_0xdfce('0x39'));}break;case'connectel':if(_0x2c0e43[_0xdfce('0x20')]){var _0x15deeb={'recipient':_0x490f31[_0xdfce('0x31')],'message':_0x490f31['body'],'sender':_0x2c0e43[_0xdfce('0x3a')]||_0x2c0e43[_0xdfce('0x31')],'authorization':_0x2c0e43[_0xdfce('0x20')]};var _0x3c53db={'method':_0xdfce('0x3b'),'uri':_0xdfce('0x3c'),'body':_0x15deeb,'json':!![]};rp(_0x3c53db)[_0xdfce('0x16')](function(_0x3d7607){var _0x50aaa3={'messageId':_0x3d7607['requestid']};if(!_0x2c0e43[_0xdfce('0x37')]){_0x50aaa3['read']=!![];}return _0x84510b[_0xdfce('0x27')](_0x50aaa3);})[_0xdfce('0x18')](function(_0x385dd0){logger['error'](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x3d'),util[_0xdfce('0x29')](_0x385dd0,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x3d'),_0xdfce('0x3e'));}break;case'clicksend':if(_0x2c0e43[_0xdfce('0x2d')]&&_0x2c0e43['password']){var _0x15deeb={'messages':[{'source':_0xdfce('0x3f'),'to':_0x490f31[_0xdfce('0x31')],'body':_0x490f31[_0xdfce('0x22')],'from':_0x2c0e43[_0xdfce('0x3a')]||_0x2c0e43[_0xdfce('0x31')]}]};var _0x56a391=util[_0xdfce('0x40')](_0xdfce('0x41'),_0x2c0e43[_0xdfce('0x2d')],_0x2c0e43[_0xdfce('0x2e')]);var _0x3c53db={'method':_0xdfce('0x3b'),'uri':_0xdfce('0x42'),'body':_0x15deeb,'headers':{'Authorization':util[_0xdfce('0x40')](_0xdfce('0x43'),new Buffer(_0x56a391)[_0xdfce('0x44')]('base64'))},'json':!![]};rp(_0x3c53db)['then'](function(_0x56f085){if(_0x56f085['http_code']>=0xc8&&_0x56f085[_0xdfce('0x45')]<=0xce){if(_0x56f085['data']&&_0x56f085[_0xdfce('0x46')]['queued_count']>0x0){var _0x1c09aa=_['head'](_0x56f085[_0xdfce('0x46')][_0xdfce('0x47')]);var _0xe974ef={'messageId':_0x1c09aa[_0xdfce('0x48')]};if(!_0x2c0e43[_0xdfce('0x37')]){_0xe974ef[_0xdfce('0x38')]=!![];}return _0x84510b[_0xdfce('0x27')](_0xe974ef);}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x49'),util['inspect'](_0x56f085,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xdfce('0x28'),'afterCreate','clickSend',util[_0xdfce('0x29')](_0x56f085,{'showHidden':![],'depth':null}));}})['catch'](function(_0x21fefd){logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate','clickSend',util['inspect'](_0x21fefd,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdfce('0x2a'),_0xdfce('0x49'),_0xdfce('0x39'));}break;case _0xdfce('0x4a'):if(_0x2c0e43[_0xdfce('0x4b')]&&_0x2c0e43[_0xdfce('0x20')]){var _0x15deeb={'dst':_0x490f31[_0xdfce('0x31')],'text':_0x490f31[_0xdfce('0x22')],'src':_0x2c0e43[_0xdfce('0x3a')]||_0x2c0e43[_0xdfce('0x31')],'url':_0x2c0e43[_0xdfce('0x23')]+_0xdfce('0x4c')+_0x490f31['id']+_0xdfce('0x24')+_0x2c0e43[_0xdfce('0x25')]};var _0x56a391=util[_0xdfce('0x40')]('%s:%s',_0x2c0e43[_0xdfce('0x4b')],_0x2c0e43[_0xdfce('0x20')]);var _0x3c53db={'method':_0xdfce('0x3b'),'uri':util[_0xdfce('0x40')](_0xdfce('0x4d'),_0x2c0e43[_0xdfce('0x4b')]),'body':_0x15deeb,'headers':{'Authorization':util[_0xdfce('0x40')](_0xdfce('0x43'),new Buffer(_0x56a391)[_0xdfce('0x44')](_0xdfce('0x4e')))},'json':!![]};rp(_0x3c53db)['then'](function(_0x1535be){var _0x147435={'messageId':_0x1535be['message_uuid'][0x0]};return _0x84510b[_0xdfce('0x27')](_0x147435);})[_0xdfce('0x18')](function(_0x4361ca){logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x4a'),util['inspect'](_0x4361ca,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdfce('0x2a'),_0xdfce('0x4a'),_0xdfce('0x4f'));}break;case _0xdfce('0x50'):if(_0x2c0e43[_0xdfce('0x2d')]&&_0x2c0e43[_0xdfce('0x2e')]){if(_0x2c0e43['baseUrl']){var _0x5e8f5a={'method':_0xdfce('0x3b'),'uri':_0x2c0e43[_0xdfce('0x51')]+_0xdfce('0x52'),'body':{'username':_0x2c0e43[_0xdfce('0x2d')],'password':_0x2c0e43[_0xdfce('0x2e')]},'json':!![]};return rp(_0x5e8f5a)[_0xdfce('0x16')](function(_0x39aba8){var _0x2603fb={'method':_0xdfce('0x3b'),'uri':_0x2c0e43[_0xdfce('0x51')]+_0xdfce('0x53'),'body':{'messages':[{'from':_0x2c0e43['phone'],'destinations':[{'to':_0x490f31[_0xdfce('0x31')]}],'text':_0x490f31[_0xdfce('0x22')],'notifyUrl':_0x2c0e43[_0xdfce('0x23')]+_0xdfce('0x4c')+_0x490f31['id']+_0xdfce('0x24')+_0x2c0e43['token'],'notifyContentType':'application/json','callbackData':_0x2c0e43[_0xdfce('0x31')]+';'+_0x490f31['body']}]},'headers':{'Authorization':_0xdfce('0x54')+_0x39aba8[_0xdfce('0x25')]},'json':!![]};return rp(_0x2603fb)[_0xdfce('0x16')](function(_0x30aa4a){if(_0x30aa4a['messages']){var _0x416ee4={'messageId':_0x30aa4a[_0xdfce('0x47')][0x0][_0xdfce('0xb')]};if(!_0x2c0e43[_0xdfce('0x37')]){_0x416ee4[_0xdfce('0x38')]=!![];}return _0x84510b[_0xdfce('0x27')](_0x416ee4);}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate','infobip',util[_0xdfce('0x29')](_0x30aa4a,{'showHidden':![],'depth':null}));}});})[_0xdfce('0x18')](function(_0x4383a7){return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x50'),util[_0xdfce('0x29')](_0x4383a7,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x50'),_0xdfce('0x55'));}}else{logger['error'](_0xdfce('0x28'),_0xdfce('0x2a'),'infobip',_0xdfce('0x39'));}break;case _0xdfce('0x56'):var _0x44fbd1=require(_0xdfce('0x57'));if(_0x2c0e43[_0xdfce('0x58')]){var _0x5c5ea5={};_0x5c5ea5[_0xdfce('0x59')]=_0x2c0e43[_0xdfce('0x2d')];_0x5c5ea5[_0xdfce('0x31')]=_0x490f31[_0xdfce('0x31')];_0x5c5ea5[_0xdfce('0x30')]=_0x2c0e43[_0xdfce('0x31')];_0x5c5ea5['text']=_0x490f31['body'];_0x5c5ea5[_0xdfce('0x5a')]=+new Date();var _0x298d75='';var _0x4e84d4='';var _0x316db9=Object[_0xdfce('0x5b')](_0x5c5ea5);_0x316db9[_0xdfce('0x5c')]();for(var _0x8abf53=0x0;_0x8abf53<_0x316db9['length'];_0x8abf53++){if(_0x298d75!=''){_0x298d75+='&';}_0x298d75+=_0x316db9[_0x8abf53]+'='+encodeURIComponent(_0x5c5ea5[_0x316db9[_0x8abf53]]);_0x4e84d4+=_0x5c5ea5[_0x316db9[_0x8abf53]];}_0x4e84d4+=_0x2c0e43['apiKey'];_0x4e84d4=_0x44fbd1[_0xdfce('0x5d')]('md5')['update'](_0x4e84d4)['digest'](_0xdfce('0x5e'));if(_0x298d75!==''){_0x298d75+='&';}_0x298d75+='signature='+_0x4e84d4;var _0x496f43={'method':'GET','uri':_0x2c0e43['baseUrl']+_0xdfce('0x5f')+_0x298d75,'json':!![]};return rp(_0x496f43)['then'](function(_0x55d4c8){var _0x31e2db=Object[_0xdfce('0x5b')](_0x55d4c8);if(_0x55d4c8[_0x31e2db[0x0]]['error']&&parseInt(_0x55d4c8[_0x31e2db[0x0]][_0xdfce('0x19')])===0x0){var _0x390c00={'messageId':_0x55d4c8[_0x31e2db[0x0]][_0xdfce('0x60')]};if(!_0x2c0e43[_0xdfce('0x37')]){_0x390c00[_0xdfce('0x38')]=!![];}return _0x84510b['update'](_0x390c00);}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate','csc',util[_0xdfce('0x29')](_0x55d4c8[_0xdfce('0x19')],{'showHidden':![],'depth':null}));}})[_0xdfce('0x18')](function(_0x98e185){return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),'csc',util['inspect'](_0x98e185,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x56'),_0xdfce('0x61'));}break;case _0xdfce('0x62'):if(_0x2c0e43['apiKey']){var _0x25cecc={'method':_0xdfce('0x3b'),'uri':_0xdfce('0x63'),'headers':{'Authorization':_0x2c0e43['apiKey']},'body':{'content':_0x490f31[_0xdfce('0x22')],'to':[_0x490f31[_0xdfce('0x31')]],'from':_0x2c0e43[_0xdfce('0x31')],'binary':![],'clientMessageId':'uuid','charset':_0xdfce('0x64')},'json':!![]};rp(_0x25cecc)[_0xdfce('0x16')](function(_0x5a3ec3){if(!_0x5a3ec3[_0xdfce('0x19')]){var _0xe54935={'messageId':_0x5a3ec3['messages'][0x0][_0xdfce('0x65')]};if(!_0x2c0e43['deliveryReport']){_0xe54935[_0xdfce('0x38')]=!![];}return _0x84510b[_0xdfce('0x27')](_0xe54935);}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),'clickatell',util[_0xdfce('0x29')](_0x5a3ec3[_0xdfce('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c98d9){return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x62'),util['inspect'](_0x3c98d9,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x62'),_0xdfce('0x61'));}break;case _0xdfce('0x66'):if(_0x2c0e43[_0xdfce('0x2d')]&&_0x2c0e43['password']){var _0x56a391=util[_0xdfce('0x40')](_0xdfce('0x41'),_0x2c0e43['username'],_0x2c0e43[_0xdfce('0x2e')]);var _0x3c53db={'method':_0xdfce('0x3b'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2c0e43[_0xdfce('0x67')]+_0xdfce('0x68'),'body':{'to':[_0x490f31[_0xdfce('0x31')]],'text':_0x490f31[_0xdfce('0x22')],'from':_0x2c0e43['phone'],'applicationId':_0x2c0e43['applicationId']},'headers':{'Authorization':util[_0xdfce('0x40')]('Basic\x20%s',new Buffer(_0x56a391)[_0xdfce('0x44')](_0xdfce('0x4e')))},'json':!![]};rp(_0x3c53db)[_0xdfce('0x16')](function(_0x4ab8f8){if(_0x4ab8f8['id']){var _0x2e5d1b={'messageId':_0x4ab8f8['id']};return _0x84510b['update'](_0x2e5d1b);}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x66'),util[_0xdfce('0x29')](_0x4ab8f8,{'showHidden':![],'depth':null}));}})[_0xdfce('0x18')](function(_0x3ee20f){logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x66'),util[_0xdfce('0x29')](_0x3ee20f,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdfce('0x2a'),'bandwidth',_0xdfce('0x39'));}break;case _0xdfce('0x69'):if(_0x2c0e43['apiKey']){var _0x51ebf0={};var _0x496f43={'method':_0xdfce('0x3b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x2c0e43[_0xdfce('0x58')],'Content-Type':_0xdfce('0x6a')},'body':{'from':_0x2c0e43['phone'],'to':_0x490f31[_0xdfce('0x31')],'text':_0x490f31['body']},'json':!![]};return rp(_0x496f43)[_0xdfce('0x16')](function(_0x1b5fd2){if(_0x1b5fd2[_0xdfce('0x6b')]==0xca){_0x51ebf0['message']=_0x1b5fd2;var _0x1ccdec={'method':'POST','uri':_0xdfce('0x6c'),'headers':{'Authorization':_0xdfce('0x6d')+_0x2c0e43['apiKey'],'Content-Type':_0xdfce('0x6a')},'body':{'refid':_0x51ebf0['message'][_0xdfce('0x6e')]},'json':!![]};return rp(_0x1ccdec)['then'](function(_0x34a08c){_0x51ebf0[_0xdfce('0x6f')]=_0x34a08c;var _0x36a608={'messageId':_0x51ebf0[_0xdfce('0x70')]['refid'],'read':!![]};return _0x84510b[_0xdfce('0x27')](_0x36a608);});}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),'intelepeer',util[_0xdfce('0x29')](_0x1b5fd2,{'showHidden':![],'depth':null}));}})[_0xdfce('0x18')](function(_0x5112d5){return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x69'),util['inspect'](_0x5112d5,{'showHidden':![],'depth':null}));});}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x69'),_0xdfce('0x71'));}break;}}})[_0xdfce('0x72')](function(){_0x246d97();});}else{_0x246d97();}}},'charset':_0xdfce('0x73'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcab6=['base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','message','refid','status','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','FULLTEXT','get','toLowerCase','direction','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','out','SmsAccount','find','type','accountSid','authToken','create','body','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','phone','smsMethod','sender','login?username=','username','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','http_code','data','queued_count','messages','message_id','clickSend','plivo','/api/sms/messages/','/status?token=','authId','https://api.plivo.com/v1/Account/%s/Message/'];(function(_0x41d44c,_0x2c92f5){var _0x456ff1=function(_0x31d363){while(--_0x31d363){_0x41d44c['push'](_0x41d44c['shift']());}};_0x456ff1(++_0x2c92f5);}(_0xcab6,0x125));var _0x6cab=function(_0x44062b,_0x1e2840){_0x44062b=_0x44062b-0x0;var _0x5797e5=_0xcab6[_0x44062b];return _0x5797e5;};'use strict';var _=require(_0x6cab('0x0'));var util=require(_0x6cab('0x1'));var logger=require(_0x6cab('0x2'))(_0x6cab('0x3'));var moment=require(_0x6cab('0x4'));var BPromise=require('bluebird');var rp=require(_0x6cab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6cab('0x6'));var attributes=require(_0x6cab('0x7'));module['exports']=function(_0x973c3f,_0x256d33){return _0x973c3f[_0x6cab('0x8')](_0x6cab('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x6cab('0xa'),'fields':[_0x6cab('0xa')]},{'name':_0x6cab('0xb'),'fields':['body'],'type':_0x6cab('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x354b84,_0x4871a2,_0x416af1){var _0x17526d=_0x973c3f['models'];var _0x6374fd=_0x354b84[_0x6cab('0xd')]({'plain':!![]});if(_0x6374fd['direction'][_0x6cab('0xe')]()==='in'||_0x6374fd[_0x6cab('0xf')][_0x6cab('0xe')]()==='out'&&!_0x6374fd[_0x6cab('0x10')]&&!_[_0x6cab('0x11')](_0x6374fd['UserId'])&&!_[_0x6cab('0x11')](_0x6374fd[_0x6cab('0x12')])){_0x17526d[_0x6cab('0x13')][_0x6cab('0x14')]({'where':{'id':_0x6374fd[_0x6cab('0x12')]}})[_0x6cab('0x15')](function(_0x5552b1){if(_0x5552b1){_0x5552b1[_0x6cab('0x16')]({'lastMsgAt':_0x6374fd[_0x6cab('0x17')],'lastMsgDirection':_0x6374fd[_0x6cab('0xf')][_0x6cab('0xe')]()});}})[_0x6cab('0x18')](function(_0x4f0634){console[_0x6cab('0x19')](_0x4f0634);});}if(_0x6374fd[_0x6cab('0xf')]===_0x6cab('0x1a')&&!_0x6374fd[_0x6cab('0x10')]){var _0x5dcdd2;_0x17526d[_0x6cab('0x1b')][_0x6cab('0x1c')]({'where':{'id':_0x6374fd['SmsAccountId']},'raw':!![]})[_0x6cab('0x15')](function(_0x300a06){_0x5dcdd2=_0x300a06;if(_0x5dcdd2&&_0x5dcdd2['type']){switch(_0x5dcdd2[_0x6cab('0x1d')]){case'twilio':var _0x4398f8=require('twilio');if(_0x5dcdd2[_0x6cab('0x1e')]&&_0x5dcdd2[_0x6cab('0x1f')]&&_0x5dcdd2['phone']){var _0x2d6649=new _0x4398f8(_0x5dcdd2[_0x6cab('0x1e')],_0x5dcdd2[_0x6cab('0x1f')]);_0x2d6649['messages'][_0x6cab('0x20')]({'body':_0x6374fd[_0x6cab('0x21')],'to':_0x6374fd['phone'],'from':_0x5dcdd2['phone'],'statusCallback':_0x5dcdd2['remote']+'/api/sms/messages/'+_0x6374fd['id']+'/status?token='+_0x5dcdd2[_0x6cab('0x22')]})['then'](function(_0x25c735){if(_0x25c735['sid']){return _0x354b84['update']({'messageId':_0x25c735[_0x6cab('0x23')]});}})['catch'](function(_0x459273){logger['error'](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x26'),util[_0x6cab('0x27')](_0x459273,{'showHidden':![],'depth':null}));});}else{logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),'twilio',_0x6cab('0x28'));}break;case _0x6cab('0x29'):var _0x2d86b0=_0x6cab('0x2a');if(_0x5dcdd2['username']&&_0x5dcdd2[_0x6cab('0x2b')]){var _0xea39ad={'recipient':[_0x6374fd[_0x6cab('0x2c')]],'message':_0x6374fd[_0x6cab('0x21')],'message_type':_0x5dcdd2['smsMethod']};if(_0x5dcdd2[_0x6cab('0x2d')]&&_0x5dcdd2[_0x6cab('0x2d')]!=='SI'){_0xea39ad[_0x6cab('0x2e')]=_0x5dcdd2[_0x6cab('0x2c')];}var _0x5a7f02={'url':_0x2d86b0+_0x6cab('0x2f')+_0x5dcdd2[_0x6cab('0x30')]+'&password='+_0x5dcdd2['password'],'method':_0x6cab('0x31')};rp(_0x5a7f02)[_0x6cab('0x15')](function(_0x3e8c06){var _0x2627cd=_0x3e8c06[_0x6cab('0x32')](';');var _0x11ef95={'user_key':_0x2627cd[0x0],'session_key':_0x2627cd[0x1]};_0x5a7f02={'url':_0x2d86b0+_0x6cab('0x33'),'method':_0x6cab('0x34'),'headers':{'user_key':_0x11ef95[_0x6cab('0x35')],'Session_key':_0x11ef95[_0x6cab('0x36')]},'json':!![],'body':_0xea39ad};return rp(_0x5a7f02);})[_0x6cab('0x15')](function(_0x38c1d1){if(_0x38c1d1[_0x6cab('0x37')]>=0x1){var _0x38a9dc={'messageId':_0x38c1d1[_0x6cab('0x38')]};if(_0x5dcdd2[_0x6cab('0x2d')]!=='GP'||!_0x5dcdd2[_0x6cab('0x39')]){_0x38a9dc[_0x6cab('0x3a')]=!![];}return _0x354b84['update'](_0x38a9dc);}else{return logger[_0x6cab('0x19')](_0x6cab('0x24'),'afterCreate',_0x6cab('0x29'),util['inspect'](_0x38c1d1,{'showHidden':![],'depth':null}));}})[_0x6cab('0x18')](function(_0x19119e){return logger['error'](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x29'),util[_0x6cab('0x27')](_0x19119e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x29'),_0x6cab('0x3b'));}break;case _0x6cab('0x3c'):if(_0x5dcdd2[_0x6cab('0x1f')]){var _0x4c5d9d={'recipient':_0x6374fd[_0x6cab('0x2c')],'message':_0x6374fd[_0x6cab('0x21')],'sender':_0x5dcdd2[_0x6cab('0x3d')]||_0x5dcdd2['phone'],'authorization':_0x5dcdd2[_0x6cab('0x1f')]};var _0x4871a2={'method':_0x6cab('0x34'),'uri':_0x6cab('0x3e'),'body':_0x4c5d9d,'json':!![]};rp(_0x4871a2)[_0x6cab('0x15')](function(_0x3750bb){var _0xc21cde={'messageId':_0x3750bb[_0x6cab('0x3f')]};if(!_0x5dcdd2[_0x6cab('0x39')]){_0xc21cde[_0x6cab('0x3a')]=!![];}return _0x354b84['update'](_0xc21cde);})[_0x6cab('0x18')](function(_0x22827d){logger[_0x6cab('0x19')](_0x6cab('0x24'),'afterCreate',_0x6cab('0x3c'),util[_0x6cab('0x27')](_0x22827d,{'showHidden':![],'depth':null}));});}else{logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),'connectel',_0x6cab('0x40'));}break;case _0x6cab('0x41'):if(_0x5dcdd2['username']&&_0x5dcdd2[_0x6cab('0x2b')]){var _0x4c5d9d={'messages':[{'source':'xCALLY\x20Motion','to':_0x6374fd[_0x6cab('0x2c')],'body':_0x6374fd[_0x6cab('0x21')],'from':_0x5dcdd2['senderString']||_0x5dcdd2[_0x6cab('0x2c')]}]};var _0x3be6f2=util['format'](_0x6cab('0x42'),_0x5dcdd2['username'],_0x5dcdd2[_0x6cab('0x2b')]);var _0x4871a2={'method':_0x6cab('0x34'),'uri':_0x6cab('0x43'),'body':_0x4c5d9d,'headers':{'Authorization':util[_0x6cab('0x44')](_0x6cab('0x45'),new Buffer(_0x3be6f2)[_0x6cab('0x46')]('base64'))},'json':!![]};rp(_0x4871a2)[_0x6cab('0x15')](function(_0x663d35){if(_0x663d35[_0x6cab('0x47')]>=0xc8&&_0x663d35[_0x6cab('0x47')]<=0xce){if(_0x663d35[_0x6cab('0x48')]&&_0x663d35[_0x6cab('0x48')][_0x6cab('0x49')]>0x0){var _0xe03284=_['head'](_0x663d35[_0x6cab('0x48')][_0x6cab('0x4a')]);var _0x5295ef={'messageId':_0xe03284[_0x6cab('0x4b')]};if(!_0x5dcdd2['deliveryReport']){_0x5295ef[_0x6cab('0x3a')]=!![];}return _0x354b84['update'](_0x5295ef);}else{logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x4c'),util[_0x6cab('0x27')](_0x663d35,{'showHidden':![],'depth':null}));}}else{logger[_0x6cab('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6cab('0x25'),'clickSend',util[_0x6cab('0x27')](_0x663d35,{'showHidden':![],'depth':null}));}})[_0x6cab('0x18')](function(_0xb6e00){logger[_0x6cab('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6cab('0x25'),'clickSend',util[_0x6cab('0x27')](_0xb6e00,{'showHidden':![],'depth':null}));});}else{logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x4c'),_0x6cab('0x3b'));}break;case _0x6cab('0x4d'):if(_0x5dcdd2['authId']&&_0x5dcdd2[_0x6cab('0x1f')]){var _0x4c5d9d={'dst':_0x6374fd[_0x6cab('0x2c')],'text':_0x6374fd[_0x6cab('0x21')],'src':_0x5dcdd2[_0x6cab('0x3d')]||_0x5dcdd2['phone'],'url':_0x5dcdd2['remote']+_0x6cab('0x4e')+_0x6374fd['id']+_0x6cab('0x4f')+_0x5dcdd2[_0x6cab('0x22')]};var _0x3be6f2=util[_0x6cab('0x44')](_0x6cab('0x42'),_0x5dcdd2[_0x6cab('0x50')],_0x5dcdd2['authToken']);var _0x4871a2={'method':'POST','uri':util[_0x6cab('0x44')](_0x6cab('0x51'),_0x5dcdd2['authId']),'body':_0x4c5d9d,'headers':{'Authorization':util[_0x6cab('0x44')](_0x6cab('0x45'),new Buffer(_0x3be6f2)[_0x6cab('0x46')](_0x6cab('0x52')))},'json':!![]};rp(_0x4871a2)['then'](function(_0x162bcc){var _0x27bced={'messageId':_0x162bcc[_0x6cab('0x53')][0x0]};return _0x354b84[_0x6cab('0x16')](_0x27bced);})[_0x6cab('0x18')](function(_0x567ed8){logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x4d'),util[_0x6cab('0x27')](_0x567ed8,{'showHidden':![],'depth':null}));});}else{logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x4d'),_0x6cab('0x54'));}break;case'infobip':if(_0x5dcdd2['username']&&_0x5dcdd2[_0x6cab('0x2b')]){if(_0x5dcdd2[_0x6cab('0x55')]){var _0x5b8e94={'method':_0x6cab('0x34'),'uri':_0x5dcdd2[_0x6cab('0x55')]+_0x6cab('0x56'),'body':{'username':_0x5dcdd2[_0x6cab('0x30')],'password':_0x5dcdd2[_0x6cab('0x2b')]},'json':!![]};return rp(_0x5b8e94)[_0x6cab('0x15')](function(_0x47957c){var _0x4b4aae={'method':_0x6cab('0x34'),'uri':_0x5dcdd2[_0x6cab('0x55')]+_0x6cab('0x57'),'body':{'messages':[{'from':_0x5dcdd2[_0x6cab('0x2c')],'destinations':[{'to':_0x6374fd[_0x6cab('0x2c')]}],'text':_0x6374fd[_0x6cab('0x21')],'notifyUrl':_0x5dcdd2[_0x6cab('0x58')]+_0x6cab('0x4e')+_0x6374fd['id']+_0x6cab('0x4f')+_0x5dcdd2[_0x6cab('0x22')],'notifyContentType':_0x6cab('0x59'),'callbackData':_0x5dcdd2[_0x6cab('0x2c')]+';'+_0x6374fd[_0x6cab('0x21')]}]},'headers':{'Authorization':_0x6cab('0x5a')+_0x47957c[_0x6cab('0x22')]},'json':!![]};return rp(_0x4b4aae)['then'](function(_0x311abf){if(_0x311abf[_0x6cab('0x4a')]){var _0x3a07e9={'messageId':_0x311abf[_0x6cab('0x4a')][0x0][_0x6cab('0xa')]};if(!_0x5dcdd2['deliveryReport']){_0x3a07e9['read']=!![];}return _0x354b84[_0x6cab('0x16')](_0x3a07e9);}else{return logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x5b'),util[_0x6cab('0x27')](_0x311abf,{'showHidden':![],'depth':null}));}});})[_0x6cab('0x18')](function(_0x374fde){return logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x5b'),util[_0x6cab('0x27')](_0x374fde,{'showHidden':![],'depth':null}));});}else{logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),'infobip',_0x6cab('0x5c'));}}else{logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x5b'),_0x6cab('0x3b'));}break;case _0x6cab('0x5d'):var _0x541821=require(_0x6cab('0x5e'));if(_0x5dcdd2['apiKey']){var _0x1fc237={};_0x1fc237['login']=_0x5dcdd2[_0x6cab('0x30')];_0x1fc237['phone']=_0x6374fd[_0x6cab('0x2c')];_0x1fc237[_0x6cab('0x2e')]=_0x5dcdd2[_0x6cab('0x2c')];_0x1fc237[_0x6cab('0x5f')]=_0x6374fd['body'];_0x1fc237[_0x6cab('0x60')]=+new Date();var _0xdb3b76='';var _0x5675dd='';var _0x3dee01=Object[_0x6cab('0x61')](_0x1fc237);_0x3dee01[_0x6cab('0x62')]();for(var _0x123db6=0x0;_0x123db6<_0x3dee01[_0x6cab('0x63')];_0x123db6++){if(_0xdb3b76!=''){_0xdb3b76+='&';}_0xdb3b76+=_0x3dee01[_0x123db6]+'='+encodeURIComponent(_0x1fc237[_0x3dee01[_0x123db6]]);_0x5675dd+=_0x1fc237[_0x3dee01[_0x123db6]];}_0x5675dd+=_0x5dcdd2['apiKey'];_0x5675dd=_0x541821[_0x6cab('0x64')](_0x6cab('0x65'))[_0x6cab('0x16')](_0x5675dd)[_0x6cab('0x66')]('hex');if(_0xdb3b76!==''){_0xdb3b76+='&';}_0xdb3b76+=_0x6cab('0x67')+_0x5675dd;var _0x5a7f02={'method':_0x6cab('0x31'),'uri':_0x5dcdd2['baseUrl']+_0x6cab('0x68')+_0xdb3b76,'json':!![]};return rp(_0x5a7f02)[_0x6cab('0x15')](function(_0x338d28){var _0x18361c=Object[_0x6cab('0x61')](_0x338d28);if(_0x338d28[_0x18361c[0x0]][_0x6cab('0x19')]&&parseInt(_0x338d28[_0x18361c[0x0]][_0x6cab('0x19')])===0x0){var _0x4f8d42={'messageId':_0x338d28[_0x18361c[0x0]]['id_sms']};if(!_0x5dcdd2[_0x6cab('0x39')]){_0x4f8d42['read']=!![];}return _0x354b84['update'](_0x4f8d42);}else{return logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x5d'),util[_0x6cab('0x27')](_0x338d28[_0x6cab('0x19')],{'showHidden':![],'depth':null}));}})[_0x6cab('0x18')](function(_0x40ca6a){return logger['error'](_0x6cab('0x24'),_0x6cab('0x25'),'csc',util[_0x6cab('0x27')](_0x40ca6a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x5d'),_0x6cab('0x69'));}break;case _0x6cab('0x6a'):if(_0x5dcdd2[_0x6cab('0x6b')]){var _0x2fbd7b={'method':_0x6cab('0x34'),'uri':_0x6cab('0x6c'),'headers':{'Authorization':_0x5dcdd2[_0x6cab('0x6b')]},'body':{'content':_0x6374fd['body'],'to':[_0x6374fd['phone']],'from':_0x5dcdd2['phone'],'binary':![],'clientMessageId':_0x6cab('0x6d'),'charset':_0x6cab('0x6e')},'json':!![]};rp(_0x2fbd7b)[_0x6cab('0x15')](function(_0x4fd273){if(!_0x4fd273[_0x6cab('0x19')]){var _0x1e1d74={'messageId':_0x4fd273[_0x6cab('0x4a')][0x0][_0x6cab('0x6f')]};if(!_0x5dcdd2[_0x6cab('0x39')]){_0x1e1d74[_0x6cab('0x3a')]=!![];}return _0x354b84['update'](_0x1e1d74);}else{return logger[_0x6cab('0x19')](_0x6cab('0x24'),'afterCreate',_0x6cab('0x6a'),util[_0x6cab('0x27')](_0x4fd273[_0x6cab('0x19')],{'showHidden':![],'depth':null}));}})[_0x6cab('0x18')](function(_0x8417c9){return logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),'clickatell',util[_0x6cab('0x27')](_0x8417c9,{'showHidden':![],'depth':null}));});}else{logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x6a'),_0x6cab('0x69'));}break;case'bandwidth':if(_0x5dcdd2[_0x6cab('0x30')]&&_0x5dcdd2['password']){var _0x3be6f2=util['format'](_0x6cab('0x42'),_0x5dcdd2[_0x6cab('0x30')],_0x5dcdd2['password']);var _0x4871a2={'method':_0x6cab('0x34'),'uri':_0x6cab('0x70')+_0x5dcdd2['accountId']+_0x6cab('0x71'),'body':{'to':[_0x6374fd[_0x6cab('0x2c')]],'text':_0x6374fd[_0x6cab('0x21')],'from':_0x5dcdd2['phone'],'applicationId':_0x5dcdd2[_0x6cab('0x72')]},'headers':{'Authorization':util[_0x6cab('0x44')](_0x6cab('0x45'),new Buffer(_0x3be6f2)[_0x6cab('0x46')](_0x6cab('0x52')))},'json':!![]};rp(_0x4871a2)['then'](function(_0x4685d9){if(_0x4685d9['id']){var _0x4721b2={'messageId':_0x4685d9['id']};return _0x354b84['update'](_0x4721b2);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6cab('0x25'),'bandwidth',util['inspect'](_0x4685d9,{'showHidden':![],'depth':null}));}})[_0x6cab('0x18')](function(_0x1e9e17){logger[_0x6cab('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6cab('0x25'),'bandwidth',util[_0x6cab('0x27')](_0x1e9e17,{'showHidden':![],'depth':null}));});}else{logger[_0x6cab('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6cab('0x25'),_0x6cab('0x73'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6cab('0x74'):if(_0x5dcdd2[_0x6cab('0x6b')]){var _0x15a37d={};var _0x5a7f02={'method':'POST','uri':_0x6cab('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x5dcdd2['apiKey'],'Content-Type':_0x6cab('0x59')},'body':{'from':_0x5dcdd2[_0x6cab('0x2c')],'to':_0x6374fd['phone'],'text':_0x6374fd[_0x6cab('0x21')]},'json':!![]};return rp(_0x5a7f02)[_0x6cab('0x15')](function(_0x2ef348){if(_0x2ef348[_0x6cab('0x76')]==0xca){_0x15a37d['message']=_0x2ef348;var _0x5dc08b={'method':'POST','uri':_0x6cab('0x77'),'headers':{'Authorization':_0x6cab('0x78')+_0x5dcdd2['apiKey'],'Content-Type':_0x6cab('0x59')},'body':{'refid':_0x15a37d[_0x6cab('0x79')][_0x6cab('0x7a')]},'json':!![]};return rp(_0x5dc08b)['then'](function(_0x260451){_0x15a37d[_0x6cab('0x7b')]=_0x260451;var _0x11d7eb={'messageId':_0x15a37d[_0x6cab('0x79')][_0x6cab('0x7a')],'read':!![]};return _0x354b84['update'](_0x11d7eb);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6cab('0x74'),util[_0x6cab('0x27')](_0x2ef348,{'showHidden':![],'depth':null}));}})[_0x6cab('0x18')](function(_0x3a4d9c){return logger[_0x6cab('0x19')](_0x6cab('0x24'),_0x6cab('0x25'),_0x6cab('0x74'),util[_0x6cab('0x27')](_0x3a4d9c,{'showHidden':![],'depth':null}));});}else{return logger[_0x6cab('0x19')](_0x6cab('0x24'),'afterCreate',_0x6cab('0x74'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x416af1();});}else{_0x416af1();}}},'charset':_0x6cab('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ce41e6f..5ca7d1b 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 _0x9417=['./smsMessage.socket','register','request','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','info','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9417,0x1f3));var _0x7941=function(_0x5c7525,_0x39490f){_0x5c7525=_0x5c7525-0x0;var _0x2e2ec8=_0x9417[_0x5c7525];return _0x2e2ec8;};'use strict';var _=require('lodash');var util=require(_0x7941('0x0'));var moment=require(_0x7941('0x1'));var BPromise=require(_0x7941('0x2'));var rs=require(_0x7941('0x3'));var fs=require('fs');var Redis=require(_0x7941('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7941('0x5'));var logger=require(_0x7941('0x6'))(_0x7941('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7941('0x8')][_0x7941('0x9')]({'port':0x232a});config[_0x7941('0xa')]=_[_0x7941('0xb')](config[_0x7941('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7941('0xc'))(new Redis(config[_0x7941('0xa')]));require(_0x7941('0xd'))[_0x7941('0xe')](socket);function respondWithRpcPromise(_0x2c3414,_0x35dc56,_0x5948dc){return new BPromise(function(_0x1de5a9,_0x3e7739){return client[_0x7941('0xf')](_0x2c3414,_0x5948dc)['then'](function(_0x478a87){logger['info']('SmsMessage,\x20%s,\x20%s',_0x35dc56,_0x7941('0x10'));logger[_0x7941('0x11')](_0x7941('0x12'),_0x35dc56,_0x7941('0x10'),JSON[_0x7941('0x13')](_0x478a87));if(_0x478a87[_0x7941('0x14')]){if(_0x478a87['error']['code']===0x1f4){logger['error'](_0x7941('0x15'),_0x35dc56,_0x478a87[_0x7941('0x14')][_0x7941('0x16')]);return _0x3e7739(_0x478a87[_0x7941('0x14')]['message']);}logger[_0x7941('0x14')](_0x7941('0x15'),_0x35dc56,_0x478a87[_0x7941('0x14')][_0x7941('0x16')]);return _0x1de5a9(_0x478a87[_0x7941('0x14')]['message']);}else{logger[_0x7941('0x17')](_0x7941('0x15'),_0x35dc56,_0x7941('0x10'));_0x1de5a9(_0x478a87[_0x7941('0x18')][_0x7941('0x16')]);}})[_0x7941('0x19')](function(_0x21f7dd){logger[_0x7941('0x14')]('SmsMessage,\x20%s,\x20%s',_0x35dc56,_0x21f7dd);_0x3e7739(_0x21f7dd);});});}exports[_0x7941('0x1a')]=function(_0xb402b5){var _0x434b7a=this;return new Promise(function(_0x4c4fa0,_0x1b2791){return db[_0x7941('0x1b')][_0x7941('0x1c')](_0xb402b5['body'],{'raw':_0xb402b5[_0x7941('0x1d')]?_0xb402b5[_0x7941('0x1d')][_0x7941('0x1e')]===undefined?!![]:![]:!![]})[_0x7941('0x1f')](function(_0x1ff6e1){logger[_0x7941('0x17')](_0x7941('0x1a'),_0xb402b5);logger[_0x7941('0x11')]('CreateSmsMessage',_0xb402b5,JSON[_0x7941('0x13')](_0x1ff6e1));_0x4c4fa0(_0x1ff6e1);})[_0x7941('0x19')](function(_0x30fa77){logger['error'](_0x7941('0x1a'),_0x30fa77[_0x7941('0x16')],_0xb402b5);_0x1b2791(_0x434b7a[_0x7941('0x14')](0x1f4,_0x30fa77[_0x7941('0x16')]));});});}; \ No newline at end of file +var _0x9a12=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSmsMessage','create','body','options','raw','debug','lodash','util','moment'];(function(_0x54c1b1,_0x1d82c8){var _0x183eaf=function(_0x5c3b0f){while(--_0x5c3b0f){_0x54c1b1['push'](_0x54c1b1['shift']());}};_0x183eaf(++_0x1d82c8);}(_0x9a12,0x10b));var _0x29a1=function(_0x50bb02,_0x37cc2b){_0x50bb02=_0x50bb02-0x0;var _0x580a99=_0x9a12[_0x50bb02];return _0x580a99;};'use strict';var _=require(_0x29a1('0x0'));var util=require(_0x29a1('0x1'));var moment=require(_0x29a1('0x2'));var BPromise=require(_0x29a1('0x3'));var rs=require(_0x29a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29a1('0x5'))['db'];var utils=require(_0x29a1('0x6'));var logger=require(_0x29a1('0x7'))(_0x29a1('0x8'));var config=require(_0x29a1('0x9'));var jayson=require(_0x29a1('0xa'));var client=jayson['client'][_0x29a1('0xb')]({'port':0x232a});config[_0x29a1('0xc')]=_[_0x29a1('0xd')](config[_0x29a1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x29a1('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x29a1('0xf')](socket);function respondWithRpcPromise(_0x13eb73,_0x19ed65,_0x2a3896){return new BPromise(function(_0xaf4cc2,_0x53cdbe){return client['request'](_0x13eb73,_0x2a3896)[_0x29a1('0x10')](function(_0x4e05c0){logger[_0x29a1('0x11')](_0x29a1('0x12'),_0x19ed65,_0x29a1('0x13'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19ed65,_0x29a1('0x13'),JSON['stringify'](_0x4e05c0));if(_0x4e05c0[_0x29a1('0x14')]){if(_0x4e05c0[_0x29a1('0x14')]['code']===0x1f4){logger[_0x29a1('0x14')]('SmsMessage,\x20%s,\x20%s',_0x19ed65,_0x4e05c0[_0x29a1('0x14')][_0x29a1('0x15')]);return _0x53cdbe(_0x4e05c0[_0x29a1('0x14')][_0x29a1('0x15')]);}logger[_0x29a1('0x14')]('SmsMessage,\x20%s,\x20%s',_0x19ed65,_0x4e05c0[_0x29a1('0x14')]['message']);return _0xaf4cc2(_0x4e05c0[_0x29a1('0x14')][_0x29a1('0x15')]);}else{logger[_0x29a1('0x11')]('SmsMessage,\x20%s,\x20%s',_0x19ed65,_0x29a1('0x13'));_0xaf4cc2(_0x4e05c0[_0x29a1('0x16')]['message']);}})[_0x29a1('0x17')](function(_0x53ad83){logger[_0x29a1('0x14')](_0x29a1('0x12'),_0x19ed65,_0x53ad83);_0x53cdbe(_0x53ad83);});});}exports[_0x29a1('0x18')]=function(_0x26b2ce){var _0x562763=this;return new Promise(function(_0x2ed735,_0x9204a8){return db['SmsMessage'][_0x29a1('0x19')](_0x26b2ce[_0x29a1('0x1a')],{'raw':_0x26b2ce[_0x29a1('0x1b')]?_0x26b2ce['options'][_0x29a1('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x9f9cad){logger[_0x29a1('0x11')]('CreateSmsMessage',_0x26b2ce);logger[_0x29a1('0x1d')](_0x29a1('0x18'),_0x26b2ce,JSON['stringify'](_0x9f9cad));_0x2ed735(_0x9f9cad);})[_0x29a1('0x17')](function(_0x202c9b){logger[_0x29a1('0x14')](_0x29a1('0x18'),_0x202c9b[_0x29a1('0x15')],_0x26b2ce);_0x9204a8(_0x562763[_0x29a1('0x14')](0x1f4,_0x202c9b[_0x29a1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index fd8ff2b..15eaf7f 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 _0x5814=['emit','register','length','smsMessage:','./smsMessage.events','save','update'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x5814,0xc1));var _0x4581=function(_0x41d773,_0x123757){_0x41d773=_0x41d773-0x0;var _0x3537b2=_0x5814[_0x41d773];return _0x3537b2;};'use strict';var SmsMessageEvents=require(_0x4581('0x0'));var events=[_0x4581('0x1'),'remove',_0x4581('0x2')];function createListener(_0x160da9,_0x392c9b){return function(_0x3a0ae1){_0x392c9b[_0x4581('0x3')](_0x160da9,_0x3a0ae1);};}function removeListener(_0x4ba910,_0x5cfa51){return function(){SmsMessageEvents['removeListener'](_0x4ba910,_0x5cfa51);};}exports[_0x4581('0x4')]=function(_0x49cabb){for(var _0x4fb15a=0x0,_0x49b2d6=events[_0x4581('0x5')];_0x4fb15a<_0x49b2d6;_0x4fb15a++){var _0x2cf524=events[_0x4fb15a];var _0x4d592f=createListener(_0x4581('0x6')+_0x2cf524,_0x49cabb);SmsMessageEvents['on'](_0x2cf524,_0x4d592f);}}; \ No newline at end of file +var _0x3b49=['remove','update','removeListener','register','smsMessage:','./smsMessage.events','save'];(function(_0x4f8769,_0x4be641){var _0x2bd651=function(_0x68213c){while(--_0x68213c){_0x4f8769['push'](_0x4f8769['shift']());}};_0x2bd651(++_0x4be641);}(_0x3b49,0x171));var _0x93b4=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x3b49[_0x199572];return _0x13cfa3;};'use strict';var SmsMessageEvents=require(_0x93b4('0x0'));var events=[_0x93b4('0x1'),_0x93b4('0x2'),_0x93b4('0x3')];function createListener(_0x521b19,_0x5ea549){return function(_0x3c5238){_0x5ea549['emit'](_0x521b19,_0x3c5238);};}function removeListener(_0x389324,_0x1d0217){return function(){SmsMessageEvents[_0x93b4('0x4')](_0x389324,_0x1d0217);};}exports[_0x93b4('0x5')]=function(_0x3d2051){for(var _0x40bc04=0x0,_0x413900=events['length'];_0x40bc04<_0x413900;_0x40bc04++){var _0x43aec9=events[_0x40bc04];var _0x1effc7=createListener(_0x93b4('0x6')+_0x43aec9,_0x3d2051);SmsMessageEvents['on'](_0x43aec9,_0x1effc7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 2fe6871..80effa4 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 _0xe233=['multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','exports'];(function(_0x55b04f,_0x59ef35){var _0x2de1a1=function(_0x4c0c3e){while(--_0x4c0c3e){_0x55b04f['push'](_0x55b04f['shift']());}};_0x2de1a1(++_0x59ef35);}(_0xe233,0x1e6));var _0x3e23=function(_0xee76bb,_0x583e9b){_0xee76bb=_0xee76bb-0x0;var _0x35a5c1=_0xe233[_0xee76bb];return _0x35a5c1;};'use strict';var multer=require(_0x3e23('0x0'));var util=require('util');var path=require(_0x3e23('0x1'));var timeout=require(_0x3e23('0x2'));var express=require(_0x3e23('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3e23('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3e23('0x5'));var controller=require(_0x3e23('0x6'));router[_0x3e23('0x7')]('/',auth[_0x3e23('0x8')](),controller[_0x3e23('0x9')]);router[_0x3e23('0x7')](_0x3e23('0xa'),auth[_0x3e23('0x8')](),controller[_0x3e23('0xb')]);router['get'](_0x3e23('0xc'),auth[_0x3e23('0x8')](),controller[_0x3e23('0xd')]);router[_0x3e23('0x7')](_0x3e23('0xe'),auth[_0x3e23('0x8')](),controller[_0x3e23('0xf')]);router[_0x3e23('0x7')](_0x3e23('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3e23('0x7')](_0x3e23('0x11'),auth['isAuthenticated'](),controller[_0x3e23('0x12')]);router[_0x3e23('0x13')]('/',auth[_0x3e23('0x8')](),controller[_0x3e23('0x14')]);router[_0x3e23('0x13')](_0x3e23('0x10'),auth[_0x3e23('0x8')](),controller[_0x3e23('0x15')]);router[_0x3e23('0x13')](_0x3e23('0x11'),auth['isAuthenticated'](),controller[_0x3e23('0x16')]);router[_0x3e23('0x17')]('/:id',auth[_0x3e23('0x8')](),controller['update']);router[_0x3e23('0x18')](_0x3e23('0xc'),auth['isAuthenticated'](),controller[_0x3e23('0x19')]);router['delete'](_0x3e23('0x10'),auth[_0x3e23('0x8')](),controller['removeTeams']);router[_0x3e23('0x18')](_0x3e23('0x11'),auth[_0x3e23('0x8')](),controller['removeAgents']);module[_0x3e23('0x1a')]=router; \ No newline at end of file +var _0xebd8=['removeTeams','removeAgents','multer','util','path','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','/:id','update','delete','destroy'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xebd8,0x120));var _0x8ebd=function(_0x2e3019,_0x544e08){_0x2e3019=_0x2e3019-0x0;var _0x590b2b=_0xebd8[_0x2e3019];return _0x590b2b;};'use strict';var multer=require(_0x8ebd('0x0'));var util=require(_0x8ebd('0x1'));var path=require(_0x8ebd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8ebd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8ebd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8ebd('0x5'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x8ebd('0x6')](),controller[_0x8ebd('0x7')]);router[_0x8ebd('0x8')]('/describe',auth[_0x8ebd('0x6')](),controller['describe']);router['get']('/:id',auth[_0x8ebd('0x6')](),controller[_0x8ebd('0x9')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x8ebd('0xa')]);router['get'](_0x8ebd('0xb'),auth[_0x8ebd('0x6')](),controller[_0x8ebd('0xc')]);router['get'](_0x8ebd('0xd'),auth['isAuthenticated'](),controller[_0x8ebd('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8ebd('0xf')]);router[_0x8ebd('0x10')](_0x8ebd('0xb'),auth[_0x8ebd('0x6')](),controller[_0x8ebd('0x11')]);router[_0x8ebd('0x10')](_0x8ebd('0xd'),auth['isAuthenticated'](),controller[_0x8ebd('0x12')]);router[_0x8ebd('0x13')](_0x8ebd('0x14'),auth['isAuthenticated'](),controller[_0x8ebd('0x15')]);router[_0x8ebd('0x16')](_0x8ebd('0x14'),auth[_0x8ebd('0x6')](),controller[_0x8ebd('0x17')]);router[_0x8ebd('0x16')](_0x8ebd('0xb'),auth[_0x8ebd('0x6')](),controller[_0x8ebd('0x18')]);router[_0x8ebd('0x16')](_0x8ebd('0xd'),auth[_0x8ebd('0x6')](),controller[_0x8ebd('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f9232bc..3f46827 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 _0x0bc2=['exports','STRING','ENUM','beepall','sequelize'];(function(_0x432d70,_0x19592b){var _0x2d35d6=function(_0x1610a4){while(--_0x1610a4){_0x432d70['push'](_0x432d70['shift']());}};_0x2d35d6(++_0x19592b);}(_0x0bc2,0x158));var _0x20bc=function(_0x3dfb0a,_0x4160a1){_0x3dfb0a=_0x3dfb0a-0x0;var _0x507eda=_0x0bc2[_0x3dfb0a];return _0x507eda;};'use strict';var Sequelize=require(_0x20bc('0x0'));module[_0x20bc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x20bc('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x20bc('0x3')]('rrmemory',_0x20bc('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x18ee=['exports','STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x46efc5,_0x2b6386){var _0x101676=function(_0x43bb11){while(--_0x43bb11){_0x46efc5['push'](_0x46efc5['shift']());}};_0x101676(++_0x2b6386);}(_0x18ee,0x107));var _0xe18e=function(_0x343359,_0x5d865d){_0x343359=_0x343359-0x0;var _0x4e62fc=_0x18ee[_0x343359];return _0x4e62fc;};'use strict';var Sequelize=require(_0xe18e('0x0'));module[_0xe18e('0x1')]={'name':{'type':Sequelize[_0xe18e('0x2')],'unique':_0xe18e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe18e('0x2')]},'timeout':{'type':Sequelize[_0xe18e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe18e('0x5')]('rrmemory',_0xe18e('0x6'),_0xe18e('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index af93e00..a608197 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 _0x5430=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','SmsQueues','UserProfileResource','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','pick','addTeams','ids','Team','online','voicePause','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0x5430,0x10c));var _0x0543=function(_0x226daf,_0x1dd1d8){_0x226daf=_0x226daf-0x0;var _0x510165=_0x5430[_0x226daf];return _0x510165;};'use strict';var emlformat=require(_0x0543('0x0'));var rimraf=require(_0x0543('0x1'));var zipdir=require(_0x0543('0x2'));var jsonpatch=require(_0x0543('0x3'));var rp=require(_0x0543('0x4'));var moment=require(_0x0543('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0543('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0543('0x7'));var ejs=require(_0x0543('0x8'));var fs=require('fs');var fs_extra=require(_0x0543('0x9'));var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x7'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];config[_0x0543('0x19')]=_[_0x0543('0x1a')](config[_0x0543('0x19')],{'host':_0x0543('0x1b'),'port':0x18eb});var socket=require(_0x0543('0x1c'))(new Redis(config[_0x0543('0x19')]));require('./smsQueue.socket')[_0x0543('0x1d')](socket);function respondWithStatusCode(_0x21e9ac,_0x4d2a27){_0x4d2a27=_0x4d2a27||0xcc;return function(_0x4c4763){if(_0x4c4763){return _0x21e9ac[_0x0543('0x1e')](_0x4d2a27);}return _0x21e9ac[_0x0543('0x1f')](_0x4d2a27)[_0x0543('0x20')]();};}function respondWithResult(_0x1cfadf,_0x38a32e){_0x38a32e=_0x38a32e||0xc8;return function(_0x50d504){if(_0x50d504){return _0x1cfadf[_0x0543('0x1f')](_0x38a32e)[_0x0543('0x21')](_0x50d504);}};}function respondWithFilteredResult(_0x2dd5cb,_0x25254e){return function(_0x20b396){if(_0x20b396){var _0x285080=typeof _0x25254e[_0x0543('0x22')]==='undefined'&&typeof _0x25254e[_0x0543('0x23')]==='undefined';var _0x50ea84=_0x20b396[_0x0543('0x24')];var _0x419913=_0x285080?0x0:_0x25254e[_0x0543('0x22')];var _0x52eb53=_0x285080?_0x20b396[_0x0543('0x24')]:_0x25254e['offset']+_0x25254e[_0x0543('0x23')];var _0x411ec2;if(_0x52eb53>=_0x50ea84){_0x52eb53=_0x50ea84;_0x411ec2=0xc8;}else{_0x411ec2=0xce;}_0x2dd5cb['status'](_0x411ec2);return _0x2dd5cb[_0x0543('0x25')](_0x0543('0x26'),_0x419913+'-'+_0x52eb53+'/'+_0x50ea84)[_0x0543('0x21')](_0x20b396);}return null;};}function patchUpdates(_0x110060){return function(_0x37347e){try{jsonpatch[_0x0543('0x27')](_0x37347e,_0x110060,!![]);}catch(_0x4adba7){return BPromise['reject'](_0x4adba7);}return _0x37347e['save']();};}function saveUpdates(_0xbfe5dc,_0x25b3a1){return function(_0x15ebeb){if(_0x15ebeb){return _0x15ebeb[_0x0543('0x28')](_0xbfe5dc)[_0x0543('0x29')](function(_0x26e500){return _0x26e500;});}return null;};}function removeEntity(_0x36d824,_0x17a3de){return function(_0x1fca8a){if(_0x1fca8a){return _0x1fca8a[_0x0543('0x2a')]()[_0x0543('0x29')](function(){var _0x21fc63=_0x1fca8a['get']({'plain':!![]});var _0x25e6f1=_0x0543('0x2b');return db[_0x0543('0x2c')]['destroy']({'where':{'type':_0x25e6f1,'resourceId':_0x21fc63['id']}})[_0x0543('0x29')](function(){return _0x1fca8a;});})[_0x0543('0x29')](function(){_0x36d824[_0x0543('0x1f')](0xcc)[_0x0543('0x20')]();});}};}function handleEntityNotFound(_0x5dd789,_0x1732be){return function(_0x10b9f3){if(!_0x10b9f3){_0x5dd789['sendStatus'](0x194);}return _0x10b9f3;};}function handleError(_0x576084,_0x3b71f0){_0x3b71f0=_0x3b71f0||0x1f4;return function(_0x16165c){logger['error'](_0x16165c[_0x0543('0x2d')]);if(_0x16165c[_0x0543('0x2e')]){delete _0x16165c[_0x0543('0x2e')];}_0x576084[_0x0543('0x1f')](_0x3b71f0)[_0x0543('0x2f')](_0x16165c);};}exports[_0x0543('0x30')]=function(_0x164bbf,_0x4f9b63){var _0x45ac71={},_0x4f6ded={},_0x2819b8={'count':0x0,'rows':[]};var _0x282787=_[_0x0543('0x31')](db[_0x0543('0x32')][_0x0543('0x33')],function(_0x57aaa2){return{'name':_0x57aaa2[_0x0543('0x34')],'type':_0x57aaa2['type'][_0x0543('0x35')]};});_0x4f6ded[_0x0543('0x36')]=_[_0x0543('0x31')](_0x282787,_0x0543('0x2e'));_0x4f6ded['query']=_[_0x0543('0x37')](_0x164bbf['query']);_0x4f6ded[_0x0543('0x38')]=_[_0x0543('0x39')](_0x4f6ded[_0x0543('0x36')],_0x4f6ded[_0x0543('0x3a')]);_0x45ac71[_0x0543('0x3b')]=_[_0x0543('0x39')](_0x4f6ded[_0x0543('0x36')],qs[_0x0543('0x3c')](_0x164bbf[_0x0543('0x3a')][_0x0543('0x3c')]));_0x45ac71['attributes']=_0x45ac71[_0x0543('0x3b')][_0x0543('0x3d')]?_0x45ac71['attributes']:_0x4f6ded[_0x0543('0x36')];if(!_0x164bbf['query'][_0x0543('0x3e')](_0x0543('0x3f'))){_0x45ac71['limit']=qs['limit'](_0x164bbf[_0x0543('0x3a')][_0x0543('0x23')]);_0x45ac71['offset']=qs[_0x0543('0x22')](_0x164bbf[_0x0543('0x3a')]['offset']);}_0x45ac71[_0x0543('0x40')]=qs[_0x0543('0x41')](_0x164bbf[_0x0543('0x3a')][_0x0543('0x41')]);_0x45ac71[_0x0543('0x42')]=qs['filters'](_['pick'](_0x164bbf['query'],_0x4f6ded[_0x0543('0x38')]),_0x282787);if(_0x164bbf[_0x0543('0x3a')][_0x0543('0x43')]){_0x45ac71[_0x0543('0x42')]=_['merge'](_0x45ac71[_0x0543('0x42')],{'$or':_[_0x0543('0x31')](_0x282787,function(_0xe3936f){if(_0xe3936f[_0x0543('0x44')]!==_0x0543('0x45')){var _0x714fa8={};_0x714fa8[_0xe3936f[_0x0543('0x2e')]]={'$like':'%'+_0x164bbf['query'][_0x0543('0x43')]+'%'};return _0x714fa8;}})});}_0x45ac71=_[_0x0543('0x46')]({},_0x45ac71,_0x164bbf[_0x0543('0x47')]);var _0x1b38bc={'where':_0x45ac71[_0x0543('0x42')]};return db[_0x0543('0x32')]['count'](_0x1b38bc)['then'](function(_0x44116a){_0x2819b8[_0x0543('0x24')]=_0x44116a;if(_0x164bbf[_0x0543('0x3a')][_0x0543('0x48')]){_0x45ac71[_0x0543('0x49')]=[{'all':!![]}];}return db[_0x0543('0x32')][_0x0543('0x4a')](_0x45ac71);})[_0x0543('0x29')](function(_0x1df75e){_0x2819b8['rows']=_0x1df75e;return _0x2819b8;})['then'](respondWithFilteredResult(_0x4f9b63,_0x45ac71))[_0x0543('0x4b')](handleError(_0x4f9b63,null));};exports[_0x0543('0x4c')]=function(_0x5058f2,_0x48a18a){var _0x14d7b2={'raw':!![],'where':{'id':_0x5058f2['params']['id']}},_0x2e16c4={};_0x2e16c4[_0x0543('0x36')]=_['keys'](db[_0x0543('0x32')][_0x0543('0x33')]);_0x2e16c4['query']=_['keys'](_0x5058f2[_0x0543('0x3a')]);_0x2e16c4['filters']=_[_0x0543('0x39')](_0x2e16c4[_0x0543('0x36')],_0x2e16c4[_0x0543('0x3a')]);_0x14d7b2[_0x0543('0x3b')]=_[_0x0543('0x39')](_0x2e16c4[_0x0543('0x36')],qs['fields'](_0x5058f2[_0x0543('0x3a')][_0x0543('0x3c')]));_0x14d7b2[_0x0543('0x3b')]=_0x14d7b2[_0x0543('0x3b')][_0x0543('0x3d')]?_0x14d7b2['attributes']:_0x2e16c4[_0x0543('0x36')];if(_0x5058f2['query'][_0x0543('0x48')]){_0x14d7b2[_0x0543('0x49')]=[{'all':!![]}];}_0x14d7b2=_[_0x0543('0x46')]({},_0x14d7b2,_0x5058f2[_0x0543('0x47')]);return db[_0x0543('0x32')][_0x0543('0x4d')](_0x14d7b2)['then'](handleEntityNotFound(_0x48a18a,null))['then'](respondWithResult(_0x48a18a,null))['catch'](handleError(_0x48a18a,null));};exports[_0x0543('0x4e')]=function(_0x2177b8,_0x4964ba){return db[_0x0543('0x32')][_0x0543('0x4e')](_0x2177b8[_0x0543('0x4f')],{})[_0x0543('0x29')](function(_0x90dd22){var _0x4038a6=_0x2177b8['user'][_0x0543('0x50')]({'plain':!![]});if(!_0x4038a6)throw new Error(_0x0543('0x51'));if(_0x4038a6[_0x0543('0x52')]===_0x0543('0x53')){var _0x2d36bf=_0x90dd22[_0x0543('0x50')]({'plain':!![]});var _0x265bc1=_0x0543('0x2b');return db[_0x0543('0x54')][_0x0543('0x4d')]({'where':{'name':_0x265bc1,'userProfileId':_0x4038a6[_0x0543('0x55')]},'raw':!![]})[_0x0543('0x29')](function(_0x222047){if(_0x222047&&_0x222047[_0x0543('0x56')]===0x0){return db['UserProfileResource'][_0x0543('0x4e')]({'name':_0x2d36bf[_0x0543('0x2e')],'resourceId':_0x2d36bf['id'],'type':_0x222047[_0x0543('0x2e')],'sectionId':_0x222047['id']},{})[_0x0543('0x29')](function(){return _0x90dd22;});}else{return _0x90dd22;}})[_0x0543('0x4b')](function(_0x2980ad){logger[_0x0543('0x57')](_0x0543('0x58'),_0x2980ad);throw _0x2980ad;});}return _0x90dd22;})[_0x0543('0x29')](respondWithResult(_0x4964ba,0xc9))[_0x0543('0x4b')](handleError(_0x4964ba,null));};exports[_0x0543('0x28')]=function(_0x100300,_0x8e8ac9){if(_0x100300[_0x0543('0x4f')]['id']){delete _0x100300[_0x0543('0x4f')]['id'];}return db['SmsQueue'][_0x0543('0x4d')]({'where':{'id':_0x100300[_0x0543('0x59')]['id']}})['then'](handleEntityNotFound(_0x8e8ac9,null))[_0x0543('0x29')](saveUpdates(_0x100300[_0x0543('0x4f')],null))[_0x0543('0x29')](respondWithResult(_0x8e8ac9,null))['catch'](handleError(_0x8e8ac9,null));};exports[_0x0543('0x2a')]=function(_0x57165c,_0x294a38){return db['SmsQueue'][_0x0543('0x4d')]({'where':{'id':_0x57165c['params']['id']}})[_0x0543('0x29')](handleEntityNotFound(_0x294a38,null))[_0x0543('0x29')](removeEntity(_0x294a38,null))[_0x0543('0x4b')](handleError(_0x294a38,null));};exports['describe']=function(_0x117466,_0x1a569b){return db[_0x0543('0x32')][_0x0543('0x5a')]()[_0x0543('0x29')](respondWithResult(_0x1a569b,null))[_0x0543('0x4b')](handleError(_0x1a569b,null));};exports[_0x0543('0x5b')]=function(_0x774cf7,_0x2bf1f9,_0x21ec88){var _0x8a3879={'raw':!![],'where':{}},_0x2ff23a={},_0x378566;return db[_0x0543('0x32')][_0x0543('0x5c')]({'where':{'id':_0x774cf7['params']['id']}})['then'](handleEntityNotFound(_0x2bf1f9,null))[_0x0543('0x29')](function(_0x685f15){if(_0x685f15){_0x378566=_0x685f15[_0x0543('0x50')]({'plain':!![]});_0x2ff23a[_0x0543('0x36')]=_[_0x0543('0x37')](db[_0x0543('0x5d')][_0x0543('0x33')]);_0x2ff23a[_0x0543('0x3a')]=_[_0x0543('0x37')](_0x774cf7['query']);_0x2ff23a[_0x0543('0x38')]=_[_0x0543('0x39')](_0x2ff23a[_0x0543('0x36')],_0x2ff23a[_0x0543('0x3a')]);_0x8a3879['attributes']=_[_0x0543('0x39')](_0x2ff23a[_0x0543('0x36')],qs[_0x0543('0x3c')](_0x774cf7['query']['fields']));_0x8a3879[_0x0543('0x3b')]=_0x8a3879[_0x0543('0x3b')][_0x0543('0x3d')]?_0x8a3879['attributes']:_0x2ff23a[_0x0543('0x36')];if(!_0x774cf7[_0x0543('0x3a')][_0x0543('0x3e')]('nolimit')){_0x8a3879[_0x0543('0x23')]=qs[_0x0543('0x23')](_0x774cf7[_0x0543('0x3a')][_0x0543('0x23')]);_0x8a3879[_0x0543('0x22')]=qs[_0x0543('0x22')](_0x774cf7[_0x0543('0x3a')][_0x0543('0x22')]);}_0x8a3879[_0x0543('0x40')]=qs[_0x0543('0x41')](_0x774cf7[_0x0543('0x3a')][_0x0543('0x41')]);_0x8a3879[_0x0543('0x42')]=qs[_0x0543('0x38')](_['pick'](_0x774cf7['query'],_0x2ff23a[_0x0543('0x38')]));_0x8a3879[_0x0543('0x42')][_0x0543('0x5e')]=_0x685f15['id'];if(_0x774cf7[_0x0543('0x3a')]['filter']){_0x8a3879[_0x0543('0x42')]=_['merge'](_0x8a3879[_0x0543('0x42')],{'$or':_[_0x0543('0x31')](_0x8a3879[_0x0543('0x3b')],function(_0x5bd53d){var _0x5cb8ce={};_0x5cb8ce[_0x5bd53d]={'$like':'%'+_0x774cf7[_0x0543('0x3a')]['filter']+'%'};return _0x5cb8ce;})});}_0x8a3879=_['merge']({},_0x8a3879,_0x774cf7[_0x0543('0x47')]);return db[_0x0543('0x5d')][_0x0543('0x4a')](_0x8a3879);}})[_0x0543('0x29')](function(_0x338c62){if(_0x338c62){return db[_0x0543('0x5f')][_0x0543('0x60')]({'where':{'id':_[_0x0543('0x31')](_0x338c62,_0x0543('0x61')),'role':'agent'},'attributes':['id',_0x0543('0x2e'),_0x0543('0x62'),_0x0543('0x63'),_0x0543('0x64')]});}})[_0x0543('0x29')](function(_0x53f0f3){if(_0x53f0f3){return{'count':_0x53f0f3[_0x0543('0x24')],'rows':_['map'](_0x53f0f3[_0x0543('0x65')],function(_0x85a666){return{'membername':_0x85a666[_0x0543('0x2e')],'UserId':_0x85a666['id'],'queue_name':_0x378566[_0x0543('0x2e')],'SmsQueueId':_0x378566['id'],'interface':util['format'](_0x0543('0x66'),_0x0543('0x67'),_0x85a666[_0x0543('0x2e')]),'penalty':0x0,'paused':_0x85a666['smsPause'],'createdAt':_0x85a666[_0x0543('0x64')],'updatedAt':_0x85a666['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0543('0x29')](respondWithFilteredResult(_0x2bf1f9,_0x8a3879))[_0x0543('0x4b')](handleError(_0x2bf1f9,null));};exports[_0x0543('0x68')]=function(_0x916a51,_0x25aecd,_0x21c920){var _0x54f120={};var _0x59f214={};var _0x5e6a72;var _0x387334;return db[_0x0543('0x32')][_0x0543('0x5c')]({'where':{'id':_0x916a51[_0x0543('0x59')]['id']}})[_0x0543('0x29')](handleEntityNotFound(_0x25aecd,null))[_0x0543('0x29')](function(_0x15a605){if(_0x15a605){_0x5e6a72=_0x15a605;_0x59f214[_0x0543('0x36')]=_['keys'](db['Team'][_0x0543('0x33')]);_0x59f214[_0x0543('0x3a')]=_['keys'](_0x916a51[_0x0543('0x3a')]);_0x59f214['filters']=_[_0x0543('0x39')](_0x59f214[_0x0543('0x36')],_0x59f214[_0x0543('0x3a')]);_0x54f120[_0x0543('0x3b')]=_[_0x0543('0x39')](_0x59f214['model'],qs[_0x0543('0x3c')](_0x916a51[_0x0543('0x3a')]['fields']));_0x54f120[_0x0543('0x3b')]=_0x54f120[_0x0543('0x3b')][_0x0543('0x3d')]?_0x54f120['attributes']:_0x59f214[_0x0543('0x36')];_0x54f120[_0x0543('0x40')]=qs[_0x0543('0x41')](_0x916a51['query'][_0x0543('0x41')]);_0x54f120[_0x0543('0x42')]=qs[_0x0543('0x38')](_[_0x0543('0x69')](_0x916a51['query'],_0x59f214[_0x0543('0x38')]));if(_0x916a51[_0x0543('0x3a')][_0x0543('0x43')]){_0x54f120[_0x0543('0x42')]=_[_0x0543('0x46')](_0x54f120[_0x0543('0x42')],{'$or':_[_0x0543('0x31')](_0x54f120[_0x0543('0x3b')],function(_0x420b02){var _0xa8ab55={};_0xa8ab55[_0x420b02]={'$like':'%'+_0x916a51[_0x0543('0x3a')][_0x0543('0x43')]+'%'};return _0xa8ab55;})});}_0x54f120=_[_0x0543('0x46')]({},_0x54f120,_0x916a51[_0x0543('0x47')]);return _0x5e6a72[_0x0543('0x68')](_0x54f120);}})[_0x0543('0x29')](function(_0x1bbba9){if(_0x1bbba9){_0x387334=_0x1bbba9['length'];if(!_0x916a51[_0x0543('0x3a')][_0x0543('0x3e')](_0x0543('0x3f'))){_0x54f120[_0x0543('0x23')]=qs[_0x0543('0x23')](_0x916a51[_0x0543('0x3a')][_0x0543('0x23')]);_0x54f120[_0x0543('0x22')]=qs[_0x0543('0x22')](_0x916a51[_0x0543('0x3a')][_0x0543('0x22')]);}return _0x5e6a72['getTeams'](_0x54f120);}})[_0x0543('0x29')](function(_0xe296e0){if(_0xe296e0){return _0xe296e0?{'count':_0x387334,'rows':_0xe296e0}:null;}})[_0x0543('0x29')](respondWithResult(_0x25aecd,null))['catch'](handleError(_0x25aecd,null));};exports[_0x0543('0x6a')]=function(_0x4d9d96,_0x47d08b,_0x46ab3c){var _0x587f56=_0x4d9d96[_0x0543('0x4f')][_0x0543('0x6b')];return db[_0x0543('0x6c')][_0x0543('0x4a')]({'where':{'id':_0x587f56},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0543('0x2e'),_0x0543('0x6d'),_0x0543('0x6e'),'interface'],'raw':!![]}]})[_0x0543('0x29')](function(_0xdfd945){if(_0xdfd945){var _0x4cf0ca=_[_0x0543('0x6f')](_0xdfd945,function(_0x146062){var _0x5979d4=_0x146062['get']({'plain':!![]});return _0x5979d4[_0x0543('0x70')];});return db[_0x0543('0x32')][_0x0543('0x4d')]({'where':{'id':_0x4d9d96['params']['id']}})[_0x0543('0x29')](function(_0x37f54b){return db[_0x0543('0x71')]['transaction'](function(_0x57d27a){return _0x37f54b[_0x0543('0x6a')](_0x587f56,{'transaction':_0x57d27a})[_0x0543('0x29')](function(){return BPromise[_0x0543('0x72')](_0x4cf0ca,function(_0x51c8ee){return db[_0x0543('0x5d')][_0x0543('0x73')]({'where':{'UserId':_0x51c8ee['id'],'SmsQueueId':_0x4d9d96[_0x0543('0x59')]['id']},'transaction':_0x57d27a});});})[_0x0543('0x29')](function(){_0x4cf0ca[_0x0543('0x74')](function(_0x2a024f){socket[_0x0543('0x75')](_0x0543('0x76'),{'UserId':_0x2a024f['id'],'SmsQueueId':_0x37f54b['id']});});});});});}})[_0x0543('0x29')](respondWithStatusCode(_0x47d08b,null))[_0x0543('0x4b')](handleError(_0x47d08b,null));};exports[_0x0543('0x77')]=function(_0xe38301,_0x243e3a,_0x3d9f3d){return db[_0x0543('0x6c')][_0x0543('0x4a')]({'where':{'id':_0xe38301[_0x0543('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0543('0x5f')],'as':_0x0543('0x70'),'attributes':['id'],'raw':!![]}]})[_0x0543('0x29')](handleEntityNotFound(_0x243e3a,null))[_0x0543('0x29')](function(_0x4f2319){var _0x3411c1=_[_0x0543('0x31')](_0x4f2319,'id');var _0xdd4d2d=[];var _0x11ec91=[];var _0x5eb668=squel[_0x0543('0x78')]();_0x5eb668[_0x0543('0x79')]('tq.TeamId')[_0x0543('0x7a')](_0x0543('0x7b'),'tq')[_0x0543('0x7c')](_0x0543('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0543('0x42')](_0x0543('0x7e'),_0xe38301[_0x0543('0x59')]['id']);for(var _0x24fca2=0x0;_0x24fca2<_0x4f2319[_0x0543('0x3d')];_0x24fca2+=0x1){let _0x57130c=_0x4f2319[_0x24fca2];for(var _0x25d634=0x0;_0x25d634<_0x57130c[_0x0543('0x70')]['length'];_0x25d634+=0x1){let _0x1407e0=_0x57130c['Agents'][_0x25d634];var _0x1db117=_0x5eb668[_0x0543('0x7f')]();_0x1db117[_0x0543('0x42')](_0x0543('0x80'),_0x1407e0['id']);_0x11ec91['push'](db[_0x0543('0x71')]['query'](_0x1db117[_0x0543('0x81')](),{'type':db[_0x0543('0x71')][_0x0543('0x82')][_0x0543('0x83')]})[_0x0543('0x29')](function(_0x343786){if(_0x343786[_0x0543('0x3d')]===0x1){return _0x1407e0['id'];}else{var _0x2d1390=_[_0x0543('0x84')](_[_0x0543('0x31')](_0x343786,_0x0543('0x85')),function(_0x57aa7e){return _[_0x0543('0x86')](_0x3411c1,_0x57aa7e);});if(_0x2d1390){return _0x1407e0['id'];}}}));}}return BPromise[_0x0543('0x87')](_0x11ec91)[_0x0543('0x29')](function(_0x508a19){_0xdd4d2d=_(_0xdd4d2d)[_0x0543('0x88')](_0x508a19)['compact']()['value']();return db[_0x0543('0x32')]['find']({'where':{'id':_0xe38301['params']['id']}})[_0x0543('0x29')](function(_0x3b6a72){return db[_0x0543('0x71')][_0x0543('0x89')](function(_0x389c0d){return _0x3b6a72[_0x0543('0x77')](_0xe38301['query']['ids'],{'transaction':_0x389c0d})['then'](function(){if(!_['isEmpty'](_0xdd4d2d)){return _0x3b6a72[_0x0543('0x8a')](_0xdd4d2d,{'transaction':_0x389c0d});}})[_0x0543('0x29')](function(){_0xdd4d2d[_0x0543('0x74')](function(_0x328526){socket['emit'](_0x0543('0x8b'),{'UserId':_0x328526,'SmsQueueId':_0x3b6a72['id']});});});});});});})[_0x0543('0x29')](respondWithStatusCode(_0x243e3a,null))[_0x0543('0x4b')](handleError(_0x243e3a,null));};exports[_0x0543('0x8c')]=function(_0x2a2e53,_0x2d9734,_0x2cead1){return db[_0x0543('0x32')][_0x0543('0x4d')]({'where':{'id':_0x2a2e53[_0x0543('0x59')]['id']}})['then'](handleEntityNotFound(_0x2d9734,null))[_0x0543('0x29')](function(_0x9c8391){if(_0x9c8391){return _0x9c8391[_0x0543('0x8c')](_0x2a2e53[_0x0543('0x4f')][_0x0543('0x6b')],_[_0x0543('0x8d')](_0x2a2e53['body'],[_0x0543('0x6b'),'id'])||{})[_0x0543('0x8e')](function(_0x4ae078){for(var _0x47e524=0x0;_0x47e524<_0x2a2e53[_0x0543('0x4f')][_0x0543('0x6b')][_0x0543('0x3d')];_0x47e524+=0x1){socket['emit'](_0x0543('0x76'),{'UserId':Number(_0x2a2e53['body']['ids'][_0x47e524]),'SmsQueueId':Number(_0x2a2e53[_0x0543('0x59')]['id'])});}return _0x4ae078;});}})['then'](respondWithResult(_0x2d9734,null))[_0x0543('0x4b')](handleError(_0x2d9734,null));};exports[_0x0543('0x8a')]=function(_0x4dffcb,_0x347404,_0x55bd20){return db[_0x0543('0x32')][_0x0543('0x4d')]({'where':{'id':_0x4dffcb[_0x0543('0x59')]['id']}})['then'](handleEntityNotFound(_0x347404,null))[_0x0543('0x29')](function(_0x53ac8a){if(_0x53ac8a){return _0x53ac8a[_0x0543('0x8a')](_0x4dffcb[_0x0543('0x3a')]['ids'])[_0x0543('0x29')](function(){if(_[_0x0543('0x8f')](_0x4dffcb[_0x0543('0x3a')]['ids'])){for(var _0x4fd84c=0x0;_0x4fd84c<_0x4dffcb[_0x0543('0x3a')]['ids'][_0x0543('0x3d')];_0x4fd84c+=0x1){socket[_0x0543('0x75')](_0x0543('0x8b'),{'UserId':Number(_0x4dffcb[_0x0543('0x3a')]['ids'][_0x4fd84c]),'SmsQueueId':Number(_0x4dffcb[_0x0543('0x59')]['id'])});}}else{socket['emit'](_0x0543('0x8b'),{'UserId':Number(_0x4dffcb[_0x0543('0x3a')][_0x0543('0x6b')]),'SmsQueueId':Number(_0x4dffcb['params']['id'])});}});}})[_0x0543('0x29')](respondWithStatusCode(_0x347404,null))[_0x0543('0x4b')](handleError(_0x347404,null));};exports['getAgents']=function(_0x1f4c5b,_0x5574f5,_0x1c00f7){var _0x11337c={};var _0x40e16c={};var _0x3a4c40;var _0x547fd9;return db[_0x0543('0x32')][_0x0543('0x5c')]({'where':{'id':_0x1f4c5b[_0x0543('0x59')]['id']}})[_0x0543('0x29')](handleEntityNotFound(_0x5574f5,null))[_0x0543('0x29')](function(_0x50b193){if(_0x50b193){_0x3a4c40=_0x50b193;_0x40e16c[_0x0543('0x36')]=_[_0x0543('0x37')](db['User']['rawAttributes']);_0x40e16c[_0x0543('0x3a')]=_['keys'](_0x1f4c5b[_0x0543('0x3a')]);_0x40e16c[_0x0543('0x38')]=_[_0x0543('0x39')](_0x40e16c[_0x0543('0x36')],_0x40e16c['query']);_0x11337c[_0x0543('0x3b')]=_[_0x0543('0x39')](_0x40e16c[_0x0543('0x36')],qs[_0x0543('0x3c')](_0x1f4c5b['query']['fields']));_0x11337c['attributes']=_0x11337c[_0x0543('0x3b')]['length']?_0x11337c[_0x0543('0x3b')]:_0x40e16c[_0x0543('0x36')];_0x11337c[_0x0543('0x40')]=qs['sort'](_0x1f4c5b[_0x0543('0x3a')][_0x0543('0x41')]);_0x11337c[_0x0543('0x42')]=qs['filters'](_[_0x0543('0x69')](_0x1f4c5b[_0x0543('0x3a')],_0x40e16c[_0x0543('0x38')]));if(_0x1f4c5b[_0x0543('0x3a')]['filter']){_0x11337c[_0x0543('0x42')]=_['merge'](_0x11337c[_0x0543('0x42')],{'$or':_[_0x0543('0x31')](_0x11337c[_0x0543('0x3b')],function(_0x32020b){var _0x23b43c={};_0x23b43c[_0x32020b]={'$like':'%'+_0x1f4c5b[_0x0543('0x3a')]['filter']+'%'};return _0x23b43c;})});}_0x11337c=_['merge']({},_0x11337c,_0x1f4c5b[_0x0543('0x47')]);return _0x3a4c40[_0x0543('0x90')](_0x11337c);}})[_0x0543('0x29')](function(_0x31b03c){if(_0x31b03c){_0x547fd9=_0x31b03c[_0x0543('0x3d')];if(!_0x1f4c5b[_0x0543('0x3a')][_0x0543('0x3e')](_0x0543('0x3f'))){_0x11337c[_0x0543('0x23')]=qs[_0x0543('0x23')](_0x1f4c5b['query']['limit']);_0x11337c[_0x0543('0x22')]=qs[_0x0543('0x22')](_0x1f4c5b['query'][_0x0543('0x22')]);}return _0x3a4c40[_0x0543('0x90')](_0x11337c);}})[_0x0543('0x29')](function(_0x120148){if(_0x120148){return _0x120148?{'count':_0x547fd9,'rows':_0x120148}:null;}})['then'](respondWithResult(_0x5574f5,null))[_0x0543('0x4b')](handleError(_0x5574f5,null));}; \ No newline at end of file +var _0x7883=['addAgents','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsQueue.socket','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','end','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','rows','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','Team','Agents','interface','flatMap','sequelize','transaction','each','forEach','emit','userSmsQueue:save','removeTeams','findAll','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','value','ids','isEmpty','removeAgents','userSmsQueue:remove'];(function(_0x2966a5,_0x473add){var _0x54244c=function(_0x12e99e){while(--_0x12e99e){_0x2966a5['push'](_0x2966a5['shift']());}};_0x54244c(++_0x473add);}(_0x7883,0x8b));var _0x3788=function(_0x1245c0,_0x488078){_0x1245c0=_0x1245c0-0x0;var _0x51c137=_0x7883[_0x1245c0];return _0x51c137;};'use strict';var emlformat=require(_0x3788('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3788('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3788('0x2'));var moment=require('moment');var BPromise=require(_0x3788('0x3'));var Mustache=require(_0x3788('0x4'));var util=require(_0x3788('0x5'));var path=require(_0x3788('0x6'));var sox=require('sox');var csv=require(_0x3788('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3788('0x8'));var squel=require(_0x3788('0x9'));var crypto=require(_0x3788('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3788('0x7'));var querystring=require(_0x3788('0xb'));var Papa=require(_0x3788('0xc'));var Redis=require(_0x3788('0xd'));var authService=require(_0x3788('0xe'));var qs=require(_0x3788('0xf'));var as=require(_0x3788('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3788('0x11'));var utils=require(_0x3788('0x12'));var config=require(_0x3788('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3788('0x14'))['db'];config['redis']=_[_0x3788('0x15')](config[_0x3788('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3788('0x17'))(new Redis(config[_0x3788('0x16')]));require(_0x3788('0x18'))['register'](socket);function respondWithStatusCode(_0x22a309,_0x45b914){_0x45b914=_0x45b914||0xcc;return function(_0x271265){if(_0x271265){return _0x22a309['sendStatus'](_0x45b914);}return _0x22a309[_0x3788('0x19')](_0x45b914)['end']();};}function respondWithResult(_0x42414d,_0x4950db){_0x4950db=_0x4950db||0xc8;return function(_0x1fb49e){if(_0x1fb49e){return _0x42414d['status'](_0x4950db)[_0x3788('0x1a')](_0x1fb49e);}};}function respondWithFilteredResult(_0x499c54,_0x2dbda3){return function(_0xe35abe){if(_0xe35abe){var _0x172b39=typeof _0x2dbda3[_0x3788('0x1b')]===_0x3788('0x1c')&&typeof _0x2dbda3[_0x3788('0x1d')]===_0x3788('0x1c');var _0x1467e6=_0xe35abe['count'];var _0x36d439=_0x172b39?0x0:_0x2dbda3[_0x3788('0x1b')];var _0x557557=_0x172b39?_0xe35abe['count']:_0x2dbda3[_0x3788('0x1b')]+_0x2dbda3[_0x3788('0x1d')];var _0x21e87a;if(_0x557557>=_0x1467e6){_0x557557=_0x1467e6;_0x21e87a=0xc8;}else{_0x21e87a=0xce;}_0x499c54[_0x3788('0x19')](_0x21e87a);return _0x499c54[_0x3788('0x1e')](_0x3788('0x1f'),_0x36d439+'-'+_0x557557+'/'+_0x1467e6)[_0x3788('0x1a')](_0xe35abe);}return null;};}function patchUpdates(_0x4ac476){return function(_0x376eeb){try{jsonpatch[_0x3788('0x20')](_0x376eeb,_0x4ac476,!![]);}catch(_0x5ce22c){return BPromise[_0x3788('0x21')](_0x5ce22c);}return _0x376eeb[_0x3788('0x22')]();};}function saveUpdates(_0x2a045d,_0x31c8de){return function(_0x2a6200){if(_0x2a6200){return _0x2a6200[_0x3788('0x23')](_0x2a045d)[_0x3788('0x24')](function(_0x3de3d8){return _0x3de3d8;});}return null;};}function removeEntity(_0x3a0064,_0x5c1d06){return function(_0x19d327){if(_0x19d327){return _0x19d327['destroy']()[_0x3788('0x24')](function(){var _0x204560=_0x19d327[_0x3788('0x25')]({'plain':!![]});var _0x3bdddd='SmsQueues';return db['UserProfileResource'][_0x3788('0x26')]({'where':{'type':_0x3bdddd,'resourceId':_0x204560['id']}})['then'](function(){return _0x19d327;});})[_0x3788('0x24')](function(){_0x3a0064['status'](0xcc)[_0x3788('0x27')]();});}};}function handleEntityNotFound(_0x2cad23,_0x49a0a4){return function(_0x30547a){if(!_0x30547a){_0x2cad23[_0x3788('0x28')](0x194);}return _0x30547a;};}function handleError(_0x44fca4,_0x19ff9c){_0x19ff9c=_0x19ff9c||0x1f4;return function(_0x4af78f){logger[_0x3788('0x29')](_0x4af78f[_0x3788('0x2a')]);if(_0x4af78f[_0x3788('0x2b')]){delete _0x4af78f[_0x3788('0x2b')];}_0x44fca4[_0x3788('0x19')](_0x19ff9c)[_0x3788('0x2c')](_0x4af78f);};}exports[_0x3788('0x2d')]=function(_0x42c28e,_0x205916){var _0x13fb8f={},_0x400220={},_0x231173={'count':0x0,'rows':[]};var _0x281e99=_[_0x3788('0x2e')](db[_0x3788('0x2f')][_0x3788('0x30')],function(_0x203976){return{'name':_0x203976[_0x3788('0x31')],'type':_0x203976[_0x3788('0x32')][_0x3788('0x33')]};});_0x400220[_0x3788('0x34')]=_[_0x3788('0x2e')](_0x281e99,_0x3788('0x2b'));_0x400220[_0x3788('0x35')]=_[_0x3788('0x36')](_0x42c28e[_0x3788('0x35')]);_0x400220[_0x3788('0x37')]=_[_0x3788('0x38')](_0x400220[_0x3788('0x34')],_0x400220[_0x3788('0x35')]);_0x13fb8f[_0x3788('0x39')]=_['intersection'](_0x400220[_0x3788('0x34')],qs[_0x3788('0x3a')](_0x42c28e[_0x3788('0x35')][_0x3788('0x3a')]));_0x13fb8f[_0x3788('0x39')]=_0x13fb8f[_0x3788('0x39')]['length']?_0x13fb8f[_0x3788('0x39')]:_0x400220[_0x3788('0x34')];if(!_0x42c28e[_0x3788('0x35')][_0x3788('0x3b')](_0x3788('0x3c'))){_0x13fb8f['limit']=qs['limit'](_0x42c28e[_0x3788('0x35')]['limit']);_0x13fb8f[_0x3788('0x1b')]=qs[_0x3788('0x1b')](_0x42c28e['query'][_0x3788('0x1b')]);}_0x13fb8f[_0x3788('0x3d')]=qs[_0x3788('0x3e')](_0x42c28e['query'][_0x3788('0x3e')]);_0x13fb8f['where']=qs[_0x3788('0x37')](_[_0x3788('0x3f')](_0x42c28e[_0x3788('0x35')],_0x400220['filters']),_0x281e99);if(_0x42c28e['query'][_0x3788('0x40')]){_0x13fb8f[_0x3788('0x41')]=_[_0x3788('0x42')](_0x13fb8f['where'],{'$or':_[_0x3788('0x2e')](_0x281e99,function(_0x35f69e){if(_0x35f69e[_0x3788('0x32')]!=='VIRTUAL'){var _0x27d204={};_0x27d204[_0x35f69e['name']]={'$like':'%'+_0x42c28e[_0x3788('0x35')]['filter']+'%'};return _0x27d204;}})});}_0x13fb8f=_[_0x3788('0x42')]({},_0x13fb8f,_0x42c28e[_0x3788('0x43')]);var _0x4309fb={'where':_0x13fb8f[_0x3788('0x41')]};return db['SmsQueue']['count'](_0x4309fb)[_0x3788('0x24')](function(_0x1ac97d){_0x231173[_0x3788('0x44')]=_0x1ac97d;if(_0x42c28e[_0x3788('0x35')][_0x3788('0x45')]){_0x13fb8f['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x13fb8f);})[_0x3788('0x24')](function(_0x3b87e8){_0x231173[_0x3788('0x46')]=_0x3b87e8;return _0x231173;})[_0x3788('0x24')](respondWithFilteredResult(_0x205916,_0x13fb8f))['catch'](handleError(_0x205916,null));};exports['show']=function(_0x45d0dd,_0x2d0b11){var _0x1d539f={'raw':!![],'where':{'id':_0x45d0dd[_0x3788('0x47')]['id']}},_0x1b2173={};_0x1b2173['model']=_[_0x3788('0x36')](db['SmsQueue'][_0x3788('0x30')]);_0x1b2173[_0x3788('0x35')]=_['keys'](_0x45d0dd['query']);_0x1b2173[_0x3788('0x37')]=_[_0x3788('0x38')](_0x1b2173[_0x3788('0x34')],_0x1b2173[_0x3788('0x35')]);_0x1d539f[_0x3788('0x39')]=_['intersection'](_0x1b2173[_0x3788('0x34')],qs[_0x3788('0x3a')](_0x45d0dd['query'][_0x3788('0x3a')]));_0x1d539f['attributes']=_0x1d539f[_0x3788('0x39')][_0x3788('0x48')]?_0x1d539f['attributes']:_0x1b2173[_0x3788('0x34')];if(_0x45d0dd[_0x3788('0x35')][_0x3788('0x45')]){_0x1d539f['include']=[{'all':!![]}];}_0x1d539f=_[_0x3788('0x42')]({},_0x1d539f,_0x45d0dd[_0x3788('0x43')]);return db[_0x3788('0x2f')][_0x3788('0x49')](_0x1d539f)['then'](handleEntityNotFound(_0x2d0b11,null))[_0x3788('0x24')](respondWithResult(_0x2d0b11,null))[_0x3788('0x4a')](handleError(_0x2d0b11,null));};exports[_0x3788('0x4b')]=function(_0x1df1b2,_0x513bd8){return db[_0x3788('0x2f')][_0x3788('0x4b')](_0x1df1b2[_0x3788('0x4c')],{})[_0x3788('0x24')](function(_0x4501c5){var _0xe58929=_0x1df1b2[_0x3788('0x4d')]['get']({'plain':!![]});if(!_0xe58929)throw new Error(_0x3788('0x4e'));if(_0xe58929[_0x3788('0x4f')]===_0x3788('0x4d')){var _0xaf79fa=_0x4501c5['get']({'plain':!![]});var _0x1d9988=_0x3788('0x50');return db[_0x3788('0x51')]['find']({'where':{'name':_0x1d9988,'userProfileId':_0xe58929['userProfileId']},'raw':!![]})[_0x3788('0x24')](function(_0x10fbf8){if(_0x10fbf8&&_0x10fbf8[_0x3788('0x52')]===0x0){return db[_0x3788('0x53')][_0x3788('0x4b')]({'name':_0xaf79fa['name'],'resourceId':_0xaf79fa['id'],'type':_0x10fbf8[_0x3788('0x2b')],'sectionId':_0x10fbf8['id']},{})['then'](function(){return _0x4501c5;});}else{return _0x4501c5;}})[_0x3788('0x4a')](function(_0x567711){logger['error'](_0x3788('0x54'),_0x567711);throw _0x567711;});}return _0x4501c5;})[_0x3788('0x24')](respondWithResult(_0x513bd8,0xc9))[_0x3788('0x4a')](handleError(_0x513bd8,null));};exports[_0x3788('0x23')]=function(_0x19b4c3,_0x1b68c2){if(_0x19b4c3['body']['id']){delete _0x19b4c3[_0x3788('0x4c')]['id'];}return db[_0x3788('0x2f')]['find']({'where':{'id':_0x19b4c3[_0x3788('0x47')]['id']}})[_0x3788('0x24')](handleEntityNotFound(_0x1b68c2,null))[_0x3788('0x24')](saveUpdates(_0x19b4c3['body'],null))['then'](respondWithResult(_0x1b68c2,null))[_0x3788('0x4a')](handleError(_0x1b68c2,null));};exports[_0x3788('0x26')]=function(_0x3bbba1,_0xa5f468){return db[_0x3788('0x2f')][_0x3788('0x49')]({'where':{'id':_0x3bbba1['params']['id']}})[_0x3788('0x24')](handleEntityNotFound(_0xa5f468,null))['then'](removeEntity(_0xa5f468,null))[_0x3788('0x4a')](handleError(_0xa5f468,null));};exports[_0x3788('0x55')]=function(_0x2ff5ba,_0x3a7ee1){return db[_0x3788('0x2f')][_0x3788('0x55')]()[_0x3788('0x24')](respondWithResult(_0x3a7ee1,null))[_0x3788('0x4a')](handleError(_0x3a7ee1,null));};exports[_0x3788('0x56')]=function(_0x58beaf,_0x1478dd,_0x4af703){var _0x4f6502={'raw':!![],'where':{}},_0x1b89a3={},_0x1d204f;return db[_0x3788('0x2f')][_0x3788('0x57')]({'where':{'id':_0x58beaf[_0x3788('0x47')]['id']}})[_0x3788('0x24')](handleEntityNotFound(_0x1478dd,null))[_0x3788('0x24')](function(_0x44a8ec){if(_0x44a8ec){_0x1d204f=_0x44a8ec['get']({'plain':!![]});_0x1b89a3[_0x3788('0x34')]=_[_0x3788('0x36')](db[_0x3788('0x58')][_0x3788('0x30')]);_0x1b89a3[_0x3788('0x35')]=_['keys'](_0x58beaf['query']);_0x1b89a3[_0x3788('0x37')]=_[_0x3788('0x38')](_0x1b89a3[_0x3788('0x34')],_0x1b89a3['query']);_0x4f6502[_0x3788('0x39')]=_['intersection'](_0x1b89a3['model'],qs[_0x3788('0x3a')](_0x58beaf[_0x3788('0x35')][_0x3788('0x3a')]));_0x4f6502['attributes']=_0x4f6502['attributes']['length']?_0x4f6502[_0x3788('0x39')]:_0x1b89a3[_0x3788('0x34')];if(!_0x58beaf[_0x3788('0x35')][_0x3788('0x3b')]('nolimit')){_0x4f6502['limit']=qs['limit'](_0x58beaf[_0x3788('0x35')][_0x3788('0x1d')]);_0x4f6502['offset']=qs[_0x3788('0x1b')](_0x58beaf['query'][_0x3788('0x1b')]);}_0x4f6502[_0x3788('0x3d')]=qs[_0x3788('0x3e')](_0x58beaf['query']['sort']);_0x4f6502['where']=qs[_0x3788('0x37')](_[_0x3788('0x3f')](_0x58beaf['query'],_0x1b89a3[_0x3788('0x37')]));_0x4f6502[_0x3788('0x41')][_0x3788('0x59')]=_0x44a8ec['id'];if(_0x58beaf[_0x3788('0x35')]['filter']){_0x4f6502[_0x3788('0x41')]=_['merge'](_0x4f6502[_0x3788('0x41')],{'$or':_['map'](_0x4f6502[_0x3788('0x39')],function(_0x2af4b5){var _0x190639={};_0x190639[_0x2af4b5]={'$like':'%'+_0x58beaf[_0x3788('0x35')][_0x3788('0x40')]+'%'};return _0x190639;})});}_0x4f6502=_[_0x3788('0x42')]({},_0x4f6502,_0x58beaf[_0x3788('0x43')]);return db[_0x3788('0x58')]['findAll'](_0x4f6502);}})[_0x3788('0x24')](function(_0x31458f){if(_0x31458f){return db[_0x3788('0x5a')][_0x3788('0x5b')]({'where':{'id':_[_0x3788('0x2e')](_0x31458f,_0x3788('0x5c')),'role':_0x3788('0x5d')},'attributes':['id',_0x3788('0x2b'),_0x3788('0x5e'),_0x3788('0x5f'),_0x3788('0x60')]});}})[_0x3788('0x24')](function(_0x219b1d){if(_0x219b1d){return{'count':_0x219b1d[_0x3788('0x44')],'rows':_['map'](_0x219b1d[_0x3788('0x46')],function(_0x3ddf42){return{'membername':_0x3ddf42[_0x3788('0x2b')],'UserId':_0x3ddf42['id'],'queue_name':_0x1d204f[_0x3788('0x2b')],'SmsQueueId':_0x1d204f['id'],'interface':util[_0x3788('0x61')]('%s/%s',_0x3788('0x62'),_0x3ddf42['name']),'penalty':0x0,'paused':_0x3ddf42[_0x3788('0x5e')],'createdAt':_0x3ddf42[_0x3788('0x60')],'updatedAt':_0x3ddf42['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3788('0x24')](respondWithFilteredResult(_0x1478dd,_0x4f6502))['catch'](handleError(_0x1478dd,null));};exports[_0x3788('0x63')]=function(_0x16aeed,_0x32e0f1,_0x38b8d9){var _0xe114be={};var _0x29a6f5={};var _0x176b49;var _0x5e62a1;return db[_0x3788('0x2f')][_0x3788('0x57')]({'where':{'id':_0x16aeed[_0x3788('0x47')]['id']}})[_0x3788('0x24')](handleEntityNotFound(_0x32e0f1,null))[_0x3788('0x24')](function(_0x21c9bf){if(_0x21c9bf){_0x176b49=_0x21c9bf;_0x29a6f5['model']=_[_0x3788('0x36')](db['Team'][_0x3788('0x30')]);_0x29a6f5[_0x3788('0x35')]=_['keys'](_0x16aeed[_0x3788('0x35')]);_0x29a6f5[_0x3788('0x37')]=_['intersection'](_0x29a6f5[_0x3788('0x34')],_0x29a6f5[_0x3788('0x35')]);_0xe114be[_0x3788('0x39')]=_[_0x3788('0x38')](_0x29a6f5[_0x3788('0x34')],qs[_0x3788('0x3a')](_0x16aeed['query']['fields']));_0xe114be[_0x3788('0x39')]=_0xe114be[_0x3788('0x39')][_0x3788('0x48')]?_0xe114be['attributes']:_0x29a6f5['model'];_0xe114be[_0x3788('0x3d')]=qs[_0x3788('0x3e')](_0x16aeed['query'][_0x3788('0x3e')]);_0xe114be[_0x3788('0x41')]=qs[_0x3788('0x37')](_[_0x3788('0x3f')](_0x16aeed[_0x3788('0x35')],_0x29a6f5[_0x3788('0x37')]));if(_0x16aeed['query'][_0x3788('0x40')]){_0xe114be[_0x3788('0x41')]=_['merge'](_0xe114be[_0x3788('0x41')],{'$or':_[_0x3788('0x2e')](_0xe114be[_0x3788('0x39')],function(_0x289693){var _0x1f29e8={};_0x1f29e8[_0x289693]={'$like':'%'+_0x16aeed['query'][_0x3788('0x40')]+'%'};return _0x1f29e8;})});}_0xe114be=_[_0x3788('0x42')]({},_0xe114be,_0x16aeed[_0x3788('0x43')]);return _0x176b49[_0x3788('0x63')](_0xe114be);}})[_0x3788('0x24')](function(_0x3d4a3a){if(_0x3d4a3a){_0x5e62a1=_0x3d4a3a[_0x3788('0x48')];if(!_0x16aeed[_0x3788('0x35')]['hasOwnProperty'](_0x3788('0x3c'))){_0xe114be[_0x3788('0x1d')]=qs[_0x3788('0x1d')](_0x16aeed[_0x3788('0x35')]['limit']);_0xe114be[_0x3788('0x1b')]=qs[_0x3788('0x1b')](_0x16aeed[_0x3788('0x35')][_0x3788('0x1b')]);}return _0x176b49[_0x3788('0x63')](_0xe114be);}})[_0x3788('0x24')](function(_0x296757){if(_0x296757){return _0x296757?{'count':_0x5e62a1,'rows':_0x296757}:null;}})[_0x3788('0x24')](respondWithResult(_0x32e0f1,null))[_0x3788('0x4a')](handleError(_0x32e0f1,null));};exports[_0x3788('0x64')]=function(_0x597afa,_0x15e1e9,_0x52593c){var _0x5c2b3b=_0x597afa['body']['ids'];return db[_0x3788('0x65')]['findAll']({'where':{'id':_0x5c2b3b},'attributes':['id'],'include':[{'model':db[_0x3788('0x5a')],'as':_0x3788('0x66'),'attributes':['id',_0x3788('0x2b'),'online','voicePause',_0x3788('0x67')],'raw':!![]}]})[_0x3788('0x24')](function(_0x2b46c2){if(_0x2b46c2){var _0x1f680d=_[_0x3788('0x68')](_0x2b46c2,function(_0xf5ccb6){var _0x5624cc=_0xf5ccb6[_0x3788('0x25')]({'plain':!![]});return _0x5624cc['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x597afa[_0x3788('0x47')]['id']}})['then'](function(_0x691505){return db[_0x3788('0x69')][_0x3788('0x6a')](function(_0x303fe8){return _0x691505[_0x3788('0x64')](_0x5c2b3b,{'transaction':_0x303fe8})[_0x3788('0x24')](function(){return BPromise[_0x3788('0x6b')](_0x1f680d,function(_0x478723){return db[_0x3788('0x58')]['findOrCreate']({'where':{'UserId':_0x478723['id'],'SmsQueueId':_0x597afa[_0x3788('0x47')]['id']},'transaction':_0x303fe8});});})['then'](function(){_0x1f680d[_0x3788('0x6c')](function(_0x3492ec){socket[_0x3788('0x6d')](_0x3788('0x6e'),{'UserId':_0x3492ec['id'],'SmsQueueId':_0x691505['id']});});});});});}})[_0x3788('0x24')](respondWithStatusCode(_0x15e1e9,null))['catch'](handleError(_0x15e1e9,null));};exports[_0x3788('0x6f')]=function(_0x4f553a,_0x1f9186,_0xd4ae7e){return db[_0x3788('0x65')][_0x3788('0x70')]({'where':{'id':_0x4f553a['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3788('0x5a')],'as':_0x3788('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1f9186,null))['then'](function(_0x3398bb){var _0x1e9e99=_[_0x3788('0x2e')](_0x3398bb,'id');var _0x20bf58=[];var _0x314d42=[];var _0x53d4cb=squel[_0x3788('0x71')]();_0x53d4cb[_0x3788('0x72')](_0x3788('0x73'))[_0x3788('0x74')](_0x3788('0x75'),'tq')[_0x3788('0x76')](_0x3788('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3788('0x41')]('SmsQueueId\x20=\x20?',_0x4f553a[_0x3788('0x47')]['id']);for(var _0x2dee3b=0x0;_0x2dee3b<_0x3398bb['length'];_0x2dee3b+=0x1){let _0x7ef853=_0x3398bb[_0x2dee3b];for(var _0x5a8f29=0x0;_0x5a8f29<_0x7ef853['Agents'][_0x3788('0x48')];_0x5a8f29+=0x1){let _0x1b331c=_0x7ef853[_0x3788('0x66')][_0x5a8f29];var _0x4d98fc=_0x53d4cb[_0x3788('0x78')]();_0x4d98fc[_0x3788('0x41')](_0x3788('0x79'),_0x1b331c['id']);_0x314d42[_0x3788('0x7a')](db['sequelize'][_0x3788('0x35')](_0x4d98fc[_0x3788('0x7b')](),{'type':db['sequelize']['QueryTypes'][_0x3788('0x7c')]})[_0x3788('0x24')](function(_0x8dd370){if(_0x8dd370[_0x3788('0x48')]===0x1){return _0x1b331c['id'];}else{var _0x588e8b=_[_0x3788('0x7d')](_[_0x3788('0x2e')](_0x8dd370,'TeamId'),function(_0x3c123d){return _[_0x3788('0x7e')](_0x1e9e99,_0x3c123d);});if(_0x588e8b){return _0x1b331c['id'];}}}));}}return BPromise[_0x3788('0x7f')](_0x314d42)[_0x3788('0x24')](function(_0x1b4f5e){_0x20bf58=_(_0x20bf58)[_0x3788('0x80')](_0x1b4f5e)[_0x3788('0x81')]()[_0x3788('0x82')]();return db[_0x3788('0x2f')][_0x3788('0x49')]({'where':{'id':_0x4f553a[_0x3788('0x47')]['id']}})['then'](function(_0x225823){return db[_0x3788('0x69')][_0x3788('0x6a')](function(_0x3ec8f3){return _0x225823['removeTeams'](_0x4f553a['query'][_0x3788('0x83')],{'transaction':_0x3ec8f3})[_0x3788('0x24')](function(){if(!_[_0x3788('0x84')](_0x20bf58)){return _0x225823[_0x3788('0x85')](_0x20bf58,{'transaction':_0x3ec8f3});}})[_0x3788('0x24')](function(){_0x20bf58[_0x3788('0x6c')](function(_0x55de0c){socket[_0x3788('0x6d')](_0x3788('0x86'),{'UserId':_0x55de0c,'SmsQueueId':_0x225823['id']});});});});});});})[_0x3788('0x24')](respondWithStatusCode(_0x1f9186,null))[_0x3788('0x4a')](handleError(_0x1f9186,null));};exports[_0x3788('0x87')]=function(_0x280bd2,_0x201921,_0x3c7726){return db['SmsQueue']['find']({'where':{'id':_0x280bd2[_0x3788('0x47')]['id']}})[_0x3788('0x24')](handleEntityNotFound(_0x201921,null))['then'](function(_0x1dc075){if(_0x1dc075){return _0x1dc075[_0x3788('0x87')](_0x280bd2[_0x3788('0x4c')][_0x3788('0x83')],_['omit'](_0x280bd2[_0x3788('0x4c')],['ids','id'])||{})['spread'](function(_0x26dff3){for(var _0x4eaf8b=0x0;_0x4eaf8b<_0x280bd2[_0x3788('0x4c')]['ids'][_0x3788('0x48')];_0x4eaf8b+=0x1){socket[_0x3788('0x6d')](_0x3788('0x6e'),{'UserId':Number(_0x280bd2['body'][_0x3788('0x83')][_0x4eaf8b]),'SmsQueueId':Number(_0x280bd2[_0x3788('0x47')]['id'])});}return _0x26dff3;});}})['then'](respondWithResult(_0x201921,null))[_0x3788('0x4a')](handleError(_0x201921,null));};exports[_0x3788('0x85')]=function(_0x142775,_0x53913e,_0x4c1007){return db['SmsQueue'][_0x3788('0x49')]({'where':{'id':_0x142775[_0x3788('0x47')]['id']}})[_0x3788('0x24')](handleEntityNotFound(_0x53913e,null))[_0x3788('0x24')](function(_0x5bed77){if(_0x5bed77){return _0x5bed77[_0x3788('0x85')](_0x142775[_0x3788('0x35')]['ids'])[_0x3788('0x24')](function(){if(_['isArray'](_0x142775[_0x3788('0x35')][_0x3788('0x83')])){for(var _0x5b8583=0x0;_0x5b8583<_0x142775[_0x3788('0x35')]['ids'][_0x3788('0x48')];_0x5b8583+=0x1){socket[_0x3788('0x6d')](_0x3788('0x86'),{'UserId':Number(_0x142775[_0x3788('0x35')][_0x3788('0x83')][_0x5b8583]),'SmsQueueId':Number(_0x142775[_0x3788('0x47')]['id'])});}}else{socket['emit'](_0x3788('0x86'),{'UserId':Number(_0x142775[_0x3788('0x35')][_0x3788('0x83')]),'SmsQueueId':Number(_0x142775[_0x3788('0x47')]['id'])});}});}})[_0x3788('0x24')](respondWithStatusCode(_0x53913e,null))[_0x3788('0x4a')](handleError(_0x53913e,null));};exports[_0x3788('0x88')]=function(_0x2d1d01,_0x2e5dfc,_0x20beea){var _0x480e42={};var _0x2f954a={};var _0x417776;var _0x4b1eb9;return db[_0x3788('0x2f')][_0x3788('0x57')]({'where':{'id':_0x2d1d01[_0x3788('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e5dfc,null))[_0x3788('0x24')](function(_0x2e2de6){if(_0x2e2de6){_0x417776=_0x2e2de6;_0x2f954a[_0x3788('0x34')]=_[_0x3788('0x36')](db[_0x3788('0x5a')][_0x3788('0x30')]);_0x2f954a['query']=_[_0x3788('0x36')](_0x2d1d01['query']);_0x2f954a[_0x3788('0x37')]=_[_0x3788('0x38')](_0x2f954a[_0x3788('0x34')],_0x2f954a[_0x3788('0x35')]);_0x480e42[_0x3788('0x39')]=_[_0x3788('0x38')](_0x2f954a[_0x3788('0x34')],qs[_0x3788('0x3a')](_0x2d1d01[_0x3788('0x35')][_0x3788('0x3a')]));_0x480e42['attributes']=_0x480e42[_0x3788('0x39')]['length']?_0x480e42[_0x3788('0x39')]:_0x2f954a['model'];_0x480e42[_0x3788('0x3d')]=qs[_0x3788('0x3e')](_0x2d1d01[_0x3788('0x35')]['sort']);_0x480e42[_0x3788('0x41')]=qs['filters'](_[_0x3788('0x3f')](_0x2d1d01[_0x3788('0x35')],_0x2f954a['filters']));if(_0x2d1d01[_0x3788('0x35')][_0x3788('0x40')]){_0x480e42[_0x3788('0x41')]=_[_0x3788('0x42')](_0x480e42['where'],{'$or':_[_0x3788('0x2e')](_0x480e42[_0x3788('0x39')],function(_0x41cd22){var _0x2db9a7={};_0x2db9a7[_0x41cd22]={'$like':'%'+_0x2d1d01['query'][_0x3788('0x40')]+'%'};return _0x2db9a7;})});}_0x480e42=_[_0x3788('0x42')]({},_0x480e42,_0x2d1d01[_0x3788('0x43')]);return _0x417776[_0x3788('0x88')](_0x480e42);}})[_0x3788('0x24')](function(_0x31b13c){if(_0x31b13c){_0x4b1eb9=_0x31b13c['length'];if(!_0x2d1d01[_0x3788('0x35')][_0x3788('0x3b')]('nolimit')){_0x480e42[_0x3788('0x1d')]=qs[_0x3788('0x1d')](_0x2d1d01[_0x3788('0x35')][_0x3788('0x1d')]);_0x480e42['offset']=qs[_0x3788('0x1b')](_0x2d1d01[_0x3788('0x35')][_0x3788('0x1b')]);}return _0x417776[_0x3788('0x88')](_0x480e42);}})[_0x3788('0x24')](function(_0x4a8fb8){if(_0x4a8fb8){return _0x4a8fb8?{'count':_0x4b1eb9,'rows':_0x4a8fb8}:null;}})['then'](respondWithResult(_0x2e5dfc,null))[_0x3788('0x4a')](handleError(_0x2e5dfc,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index c933adc..b007991 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 _0x00bb=['remove','emit','hasOwnProperty','exports','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x00bb,0x18c));var _0xb00b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x00bb[_0x5783f4];return _0x28e380;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xb00b('0x0'))['db'][_0xb00b('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb00b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb00b('0x3')};function emitEvent(_0x1ebb6e){return function(_0x236647,_0x275aa1,_0x28c330){SmsQueueEvents[_0xb00b('0x4')](_0x1ebb6e+':'+_0x236647['id'],_0x236647);SmsQueueEvents[_0xb00b('0x4')](_0x1ebb6e,_0x236647);_0x28c330(null);};}for(var e in events){if(events[_0xb00b('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xb00b('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x094f=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x46b636,_0x4452fd){var _0xf48876=function(_0x5d5e1c){while(--_0x5d5e1c){_0x46b636['push'](_0x46b636['shift']());}};_0xf48876(++_0x4452fd);}(_0x094f,0x150));var _0xf094=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x094f[_0x4fdcc0];return _0xc0ce94;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xf094('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf094('0x1')](0x0);var events={'afterCreate':_0xf094('0x2'),'afterUpdate':_0xf094('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5ad336){return function(_0x2b589f,_0x5f2f35,_0x357adf){SmsQueueEvents[_0xf094('0x4')](_0x5ad336+':'+_0x2b589f['id'],_0x2b589f);SmsQueueEvents[_0xf094('0x4')](_0x5ad336,_0x2b589f);_0x357adf(null);};}for(var e in events){if(events[_0xf094('0x5')](e)){var event=events[e];SmsQueue[_0xf094('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 691690e..3baaf49 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 _0xe3d4=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','path'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xe3d4,0x1c9));var _0x4e3d=function(_0x1b6ae1,_0x7265ae){_0x1b6ae1=_0x1b6ae1-0x0;var _0x5843a2=_0xe3d4[_0x1b6ae1];return _0x5843a2;};'use strict';var _=require(_0x4e3d('0x0'));var util=require('util');var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require(_0x4e3d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e3d('0x4'));var rimraf=require('rimraf');var config=require(_0x4e3d('0x5'));var attributes=require(_0x4e3d('0x6'));module[_0x4e3d('0x7')]=function(_0x52e3e4,_0x4ea5ee){return _0x52e3e4[_0x4e3d('0x8')](_0x4e3d('0x9'),attributes,{'tableName':_0x4e3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eb1=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','moment','bluebird','path','rimraf'];(function(_0x5ce51d,_0x39f17c){var _0x835be7=function(_0x423d53){while(--_0x423d53){_0x5ce51d['push'](_0x5ce51d['shift']());}};_0x835be7(++_0x39f17c);}(_0x7eb1,0x162));var _0x17eb=function(_0x26dd9a,_0x28a8e1){_0x26dd9a=_0x26dd9a-0x0;var _0x32c5f8=_0x7eb1[_0x26dd9a];return _0x32c5f8;};'use strict';var _=require(_0x17eb('0x0'));var util=require(_0x17eb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x17eb('0x2'));var BPromise=require(_0x17eb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17eb('0x4'));var rimraf=require(_0x17eb('0x5'));var config=require(_0x17eb('0x6'));var attributes=require(_0x17eb('0x7'));module[_0x17eb('0x8')]=function(_0x4f70e6,_0x52951a){return _0x4f70e6[_0x17eb('0x9')](_0x17eb('0xa'),attributes,{'tableName':_0x17eb('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 545a23f..2ffd78e 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 _0x3cec=['include','map','model','GetSmsQueue','ShowSmsQueue','find','util','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit'];(function(_0x20861e,_0x548492){var _0x4f89f1=function(_0x5e3d57){while(--_0x5e3d57){_0x20861e['push'](_0x20861e['shift']());}};_0x4f89f1(++_0x548492);}(_0x3cec,0xb5));var _0xc3ce=function(_0x2e85e1,_0x42428c){_0x2e85e1=_0x2e85e1-0x0;var _0x49e5b2=_0x3cec[_0x2e85e1];return _0x49e5b2;};'use strict';var _=require('lodash');var util=require(_0xc3ce('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ce('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc3ce('0x2'))('rpc');var config=require(_0xc3ce('0x3'));var jayson=require(_0xc3ce('0x4'));var client=jayson[_0xc3ce('0x5')][_0xc3ce('0x6')]({'port':0x232a});config[_0xc3ce('0x7')]=_[_0xc3ce('0x8')](config[_0xc3ce('0x7')],{'host':_0xc3ce('0x9'),'port':0x18eb});var socket=require(_0xc3ce('0xa'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5e9e23,_0x115462,_0x19d695){return new BPromise(function(_0x50e56b,_0x5cf90b){return client[_0xc3ce('0xb')](_0x5e9e23,_0x19d695)[_0xc3ce('0xc')](function(_0x185d0b){logger[_0xc3ce('0xd')](_0xc3ce('0xe'),_0x115462,_0xc3ce('0xf'));logger[_0xc3ce('0x10')](_0xc3ce('0x11'),_0x115462,'request\x20sent',JSON[_0xc3ce('0x12')](_0x185d0b));if(_0x185d0b[_0xc3ce('0x13')]){if(_0x185d0b[_0xc3ce('0x13')][_0xc3ce('0x14')]===0x1f4){logger[_0xc3ce('0x13')]('SmsQueue,\x20%s,\x20%s',_0x115462,_0x185d0b['error'][_0xc3ce('0x15')]);return _0x5cf90b(_0x185d0b[_0xc3ce('0x13')]['message']);}logger[_0xc3ce('0x13')](_0xc3ce('0xe'),_0x115462,_0x185d0b[_0xc3ce('0x13')][_0xc3ce('0x15')]);return _0x50e56b(_0x185d0b[_0xc3ce('0x13')][_0xc3ce('0x15')]);}else{logger[_0xc3ce('0xd')](_0xc3ce('0xe'),_0x115462,_0xc3ce('0xf'));_0x50e56b(_0x185d0b['result'][_0xc3ce('0x15')]);}})[_0xc3ce('0x16')](function(_0x448254){logger[_0xc3ce('0x13')]('SmsQueue,\x20%s,\x20%s',_0x115462,_0x448254);_0x5cf90b(_0x448254);});});}exports['GetSmsQueue']=function(_0x2a3ddf){var _0x2f4ad0=this;return new Promise(function(_0x1ec6c8,_0x43a703){return db['SmsQueue'][_0xc3ce('0x17')]({'raw':_0x2a3ddf[_0xc3ce('0x18')]?_0x2a3ddf[_0xc3ce('0x18')][_0xc3ce('0x19')]===undefined?!![]:![]:!![],'where':_0x2a3ddf[_0xc3ce('0x18')]?_0x2a3ddf[_0xc3ce('0x18')][_0xc3ce('0x1a')]||null:null,'attributes':_0x2a3ddf[_0xc3ce('0x18')]?_0x2a3ddf[_0xc3ce('0x18')][_0xc3ce('0x1b')]||null:null,'limit':_0x2a3ddf['options']?_0x2a3ddf['options'][_0xc3ce('0x1c')]||null:null,'include':_0x2a3ddf[_0xc3ce('0x18')]?_0x2a3ddf[_0xc3ce('0x18')][_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x2a3ddf['options']['include'],function(_0x1236bd){return{'model':db[_0x1236bd[_0xc3ce('0x1f')]],'as':_0x1236bd['as'],'attributes':_0x1236bd[_0xc3ce('0x1b')],'include':_0x1236bd[_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x1236bd[_0xc3ce('0x1d')],function(_0x27ea5b){return{'model':db[_0x27ea5b['model']],'as':_0x27ea5b['as'],'attributes':_0x27ea5b[_0xc3ce('0x1b')],'include':_0x27ea5b[_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x27ea5b['include'],function(_0x27c43b){return{'model':db[_0x27c43b[_0xc3ce('0x1f')]],'as':_0x27c43b['as'],'attributes':_0x27c43b[_0xc3ce('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bfb09){logger[_0xc3ce('0xd')](_0xc3ce('0x20'),_0x2a3ddf);logger['debug'](_0xc3ce('0x20'),_0x2a3ddf,JSON[_0xc3ce('0x12')](_0x4bfb09));_0x1ec6c8(_0x4bfb09);})[_0xc3ce('0x16')](function(_0x2c4411){logger[_0xc3ce('0x13')](_0xc3ce('0x20'),_0x2c4411['message'],_0x2a3ddf);_0x43a703(_0x2f4ad0[_0xc3ce('0x13')](0x1f4,_0x2c4411[_0xc3ce('0x15')]));});});};exports[_0xc3ce('0x21')]=function(_0x331535){var _0x56e607=this;return new Promise(function(_0x109186,_0x3ed11c){return db['SmsQueue'][_0xc3ce('0x22')]({'raw':_0x331535['options']?_0x331535[_0xc3ce('0x18')][_0xc3ce('0x19')]===undefined?!![]:![]:!![],'where':_0x331535['options']?_0x331535[_0xc3ce('0x18')]['where']||null:null,'attributes':_0x331535[_0xc3ce('0x18')]?_0x331535[_0xc3ce('0x18')]['attributes']||null:null,'include':_0x331535[_0xc3ce('0x18')]?_0x331535[_0xc3ce('0x18')][_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x331535[_0xc3ce('0x18')][_0xc3ce('0x1d')],function(_0x5ad4df){return{'model':db[_0x5ad4df[_0xc3ce('0x1f')]],'as':_0x5ad4df['as'],'attributes':_0x5ad4df[_0xc3ce('0x1b')],'include':_0x5ad4df[_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x5ad4df[_0xc3ce('0x1d')],function(_0xa6a36c){return{'model':db[_0xa6a36c[_0xc3ce('0x1f')]],'as':_0xa6a36c['as'],'attributes':_0xa6a36c['attributes'],'include':_0xa6a36c[_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0xa6a36c['include'],function(_0xd45a65){return{'model':db[_0xd45a65[_0xc3ce('0x1f')]],'as':_0xd45a65['as'],'attributes':_0xd45a65[_0xc3ce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc3ce('0xc')](function(_0x1594b2){logger['info'](_0xc3ce('0x21'),_0x331535);logger[_0xc3ce('0x10')](_0xc3ce('0x21'),_0x331535,JSON[_0xc3ce('0x12')](_0x1594b2));_0x109186(_0x1594b2);})[_0xc3ce('0x16')](function(_0x4d8ce8){logger[_0xc3ce('0x13')]('ShowSmsQueue',_0x4d8ce8[_0xc3ce('0x15')],_0x331535);_0x3ed11c(_0x56e607[_0xc3ce('0x13')](0x1f4,_0x4d8ce8['message']));});});}; \ No newline at end of file +var _0xffe5=['request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x27ba4d,_0x557f4b){var _0xecc304=function(_0x1c4592){while(--_0x1c4592){_0x27ba4d['push'](_0x27ba4d['shift']());}};_0xecc304(++_0x557f4b);}(_0xffe5,0x1c4));var _0x5ffe=function(_0x597999,_0x4858e5){_0x597999=_0x597999-0x0;var _0x360dc7=_0xffe5[_0x597999];return _0x360dc7;};'use strict';var _=require(_0x5ffe('0x0'));var util=require('util');var moment=require(_0x5ffe('0x1'));var BPromise=require(_0x5ffe('0x2'));var rs=require(_0x5ffe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ffe('0x4'))['db'];var utils=require(_0x5ffe('0x5'));var logger=require(_0x5ffe('0x6'))(_0x5ffe('0x7'));var config=require('../../config/environment');var jayson=require(_0x5ffe('0x8'));var client=jayson[_0x5ffe('0x9')][_0x5ffe('0xa')]({'port':0x232a});config[_0x5ffe('0xb')]=_[_0x5ffe('0xc')](config[_0x5ffe('0xb')],{'host':_0x5ffe('0xd'),'port':0x18eb});var socket=require(_0x5ffe('0xe'))(new Redis(config['redis']));require(_0x5ffe('0xf'))['register'](socket);function respondWithRpcPromise(_0x55d48a,_0x39ebc8,_0x25951b){return new BPromise(function(_0x3068e5,_0x50ce12){return client[_0x5ffe('0x10')](_0x55d48a,_0x25951b)[_0x5ffe('0x11')](function(_0x3546d5){logger[_0x5ffe('0x12')](_0x5ffe('0x13'),_0x39ebc8,'request\x20sent');logger[_0x5ffe('0x14')](_0x5ffe('0x15'),_0x39ebc8,_0x5ffe('0x16'),JSON[_0x5ffe('0x17')](_0x3546d5));if(_0x3546d5[_0x5ffe('0x18')]){if(_0x3546d5[_0x5ffe('0x18')][_0x5ffe('0x19')]===0x1f4){logger[_0x5ffe('0x18')](_0x5ffe('0x13'),_0x39ebc8,_0x3546d5[_0x5ffe('0x18')][_0x5ffe('0x1a')]);return _0x50ce12(_0x3546d5[_0x5ffe('0x18')][_0x5ffe('0x1a')]);}logger[_0x5ffe('0x18')](_0x5ffe('0x13'),_0x39ebc8,_0x3546d5[_0x5ffe('0x18')]['message']);return _0x3068e5(_0x3546d5[_0x5ffe('0x18')]['message']);}else{logger[_0x5ffe('0x12')](_0x5ffe('0x13'),_0x39ebc8,_0x5ffe('0x16'));_0x3068e5(_0x3546d5['result']['message']);}})[_0x5ffe('0x1b')](function(_0x140512){logger[_0x5ffe('0x18')](_0x5ffe('0x13'),_0x39ebc8,_0x140512);_0x50ce12(_0x140512);});});}exports['GetSmsQueue']=function(_0x4961e2){var _0x72701d=this;return new Promise(function(_0x4cc83c,_0x2b3de8){return db[_0x5ffe('0x1c')][_0x5ffe('0x1d')]({'raw':_0x4961e2[_0x5ffe('0x1e')]?_0x4961e2['options'][_0x5ffe('0x1f')]===undefined?!![]:![]:!![],'where':_0x4961e2['options']?_0x4961e2[_0x5ffe('0x1e')]['where']||null:null,'attributes':_0x4961e2[_0x5ffe('0x1e')]?_0x4961e2['options'][_0x5ffe('0x20')]||null:null,'limit':_0x4961e2['options']?_0x4961e2[_0x5ffe('0x1e')][_0x5ffe('0x21')]||null:null,'include':_0x4961e2[_0x5ffe('0x1e')]?_0x4961e2[_0x5ffe('0x1e')][_0x5ffe('0x22')]?_[_0x5ffe('0x23')](_0x4961e2['options'][_0x5ffe('0x22')],function(_0x1f3ab3){return{'model':db[_0x1f3ab3[_0x5ffe('0x24')]],'as':_0x1f3ab3['as'],'attributes':_0x1f3ab3[_0x5ffe('0x20')],'include':_0x1f3ab3[_0x5ffe('0x22')]?_[_0x5ffe('0x23')](_0x1f3ab3[_0x5ffe('0x22')],function(_0x57c1d6){return{'model':db[_0x57c1d6[_0x5ffe('0x24')]],'as':_0x57c1d6['as'],'attributes':_0x57c1d6['attributes'],'include':_0x57c1d6[_0x5ffe('0x22')]?_[_0x5ffe('0x23')](_0x57c1d6[_0x5ffe('0x22')],function(_0x44cd9a){return{'model':db[_0x44cd9a[_0x5ffe('0x24')]],'as':_0x44cd9a['as'],'attributes':_0x44cd9a[_0x5ffe('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5ffe('0x11')](function(_0x169c3c){logger[_0x5ffe('0x12')](_0x5ffe('0x25'),_0x4961e2);logger[_0x5ffe('0x14')]('GetSmsQueue',_0x4961e2,JSON[_0x5ffe('0x17')](_0x169c3c));_0x4cc83c(_0x169c3c);})[_0x5ffe('0x1b')](function(_0xeabe9c){logger[_0x5ffe('0x18')](_0x5ffe('0x25'),_0xeabe9c[_0x5ffe('0x1a')],_0x4961e2);_0x2b3de8(_0x72701d[_0x5ffe('0x18')](0x1f4,_0xeabe9c[_0x5ffe('0x1a')]));});});};exports[_0x5ffe('0x26')]=function(_0x617f57){var _0x398c89=this;return new Promise(function(_0xccd366,_0x809c4){return db[_0x5ffe('0x1c')]['find']({'raw':_0x617f57['options']?_0x617f57[_0x5ffe('0x1e')][_0x5ffe('0x1f')]===undefined?!![]:![]:!![],'where':_0x617f57[_0x5ffe('0x1e')]?_0x617f57[_0x5ffe('0x1e')]['where']||null:null,'attributes':_0x617f57['options']?_0x617f57[_0x5ffe('0x1e')]['attributes']||null:null,'include':_0x617f57[_0x5ffe('0x1e')]?_0x617f57['options'][_0x5ffe('0x22')]?_['map'](_0x617f57[_0x5ffe('0x1e')][_0x5ffe('0x22')],function(_0x56853f){return{'model':db[_0x56853f['model']],'as':_0x56853f['as'],'attributes':_0x56853f[_0x5ffe('0x20')],'include':_0x56853f[_0x5ffe('0x22')]?_['map'](_0x56853f[_0x5ffe('0x22')],function(_0x27d514){return{'model':db[_0x27d514['model']],'as':_0x27d514['as'],'attributes':_0x27d514[_0x5ffe('0x20')],'include':_0x27d514['include']?_[_0x5ffe('0x23')](_0x27d514[_0x5ffe('0x22')],function(_0x4b5f7c){return{'model':db[_0x4b5f7c['model']],'as':_0x4b5f7c['as'],'attributes':_0x4b5f7c[_0x5ffe('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5ffe('0x11')](function(_0x15abdd){logger[_0x5ffe('0x12')](_0x5ffe('0x26'),_0x617f57);logger[_0x5ffe('0x14')](_0x5ffe('0x26'),_0x617f57,JSON[_0x5ffe('0x17')](_0x15abdd));_0xccd366(_0x15abdd);})[_0x5ffe('0x1b')](function(_0x3e85a6){logger[_0x5ffe('0x18')](_0x5ffe('0x26'),_0x3e85a6[_0x5ffe('0x1a')],_0x617f57);_0x809c4(_0x398c89[_0x5ffe('0x18')](0x1f4,_0x3e85a6[_0x5ffe('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 47cff9f..593eb9c 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 _0xab9c=['emit','length','smsQueue:','./smsQueue.events'];(function(_0x21a1cc,_0x3d40c2){var _0xcb3ac=function(_0x21ec37){while(--_0x21ec37){_0x21a1cc['push'](_0x21a1cc['shift']());}};_0xcb3ac(++_0x3d40c2);}(_0xab9c,0x1df));var _0xcab9=function(_0x3e6875,_0x26164e){_0x3e6875=_0x3e6875-0x0;var _0x4605ea=_0xab9c[_0x3e6875];return _0x4605ea;};'use strict';var SmsQueueEvents=require(_0xcab9('0x0'));var events=['save','remove','update'];function createListener(_0x461ef0,_0x41d161){return function(_0x42f13f){_0x41d161[_0xcab9('0x1')](_0x461ef0,_0x42f13f);};}function removeListener(_0xde0453,_0xd4dc0b){return function(){SmsQueueEvents['removeListener'](_0xde0453,_0xd4dc0b);};}exports['register']=function(_0x5ca5f8){for(var _0x4f5a62=0x0,_0x36444c=events[_0xcab9('0x2')];_0x4f5a62<_0x36444c;_0x4f5a62++){var _0x51128e=events[_0x4f5a62];var _0x5d8ade=createListener(_0xcab9('0x3')+_0x51128e,_0x5ca5f8);SmsQueueEvents['on'](_0x51128e,_0x5d8ade);}}; \ No newline at end of file +var _0xd671=['length','smsQueue:','./smsQueue.events','remove','update','emit','removeListener','register'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd671,0xfa));var _0x1d67=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0xd671[_0x36fbef];return _0x45e270;};'use strict';var SmsQueueEvents=require(_0x1d67('0x0'));var events=['save',_0x1d67('0x1'),_0x1d67('0x2')];function createListener(_0x4e7905,_0x19c39a){return function(_0x360c5a){_0x19c39a[_0x1d67('0x3')](_0x4e7905,_0x360c5a);};}function removeListener(_0x2cb0cb,_0x5ad098){return function(){SmsQueueEvents[_0x1d67('0x4')](_0x2cb0cb,_0x5ad098);};}exports[_0x1d67('0x5')]=function(_0x340b33){for(var _0x1b6600=0x0,_0xcaacab=events[_0x1d67('0x6')];_0x1b6600<_0xcaacab;_0x1b6600++){var _0x311054=events[_0x1b6600];var _0x47913c=createListener(_0x1d67('0x7')+_0x311054,_0x340b33);SmsQueueEvents['on'](_0x311054,_0x47913c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 9b4b6d7..859f8d2 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 _0x3079=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy'];(function(_0x16f498,_0xb3968d){var _0x15836f=function(_0x3d98aa){while(--_0x3d98aa){_0x16f498['push'](_0x16f498['shift']());}};_0x15836f(++_0xb3968d);}(_0x3079,0x110));var _0x9307=function(_0x54ee1f,_0x1f3d67){_0x54ee1f=_0x54ee1f-0x0;var _0x145070=_0x3079[_0x54ee1f];return _0x145070;};'use strict';var multer=require('multer');var util=require(_0x9307('0x0'));var path=require(_0x9307('0x1'));var timeout=require(_0x9307('0x2'));var express=require(_0x9307('0x3'));var router=express['Router']();var fs_extra=require(_0x9307('0x4'));var auth=require(_0x9307('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9307('0x6'));router[_0x9307('0x7')]('/',auth[_0x9307('0x8')](),controller[_0x9307('0x9')]);router[_0x9307('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9307('0xa')]);router['get'](_0x9307('0xb'),auth[_0x9307('0x8')](),controller['show']);router[_0x9307('0xc')]('/',auth[_0x9307('0x8')](),controller[_0x9307('0xd')]);router['put']('/:id',auth[_0x9307('0x8')](),controller[_0x9307('0xe')]);router[_0x9307('0xf')](_0x9307('0xb'),auth[_0x9307('0x8')](),controller[_0x9307('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb2b4=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0xb2b4,0x141));var _0x4b2b=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0xb2b4[_0x4ec7f2];return _0x118004;};'use strict';var multer=require(_0x4b2b('0x0'));var util=require(_0x4b2b('0x1'));var path=require(_0x4b2b('0x2'));var timeout=require(_0x4b2b('0x3'));var express=require(_0x4b2b('0x4'));var router=express['Router']();var fs_extra=require(_0x4b2b('0x5'));var auth=require(_0x4b2b('0x6'));var interaction=require(_0x4b2b('0x7'));var config=require(_0x4b2b('0x8'));var controller=require(_0x4b2b('0x9'));router[_0x4b2b('0xa')]('/',auth[_0x4b2b('0xb')](),controller[_0x4b2b('0xc')]);router[_0x4b2b('0xa')](_0x4b2b('0xd'),auth['isAuthenticated'](),controller[_0x4b2b('0xe')]);router[_0x4b2b('0xa')](_0x4b2b('0xf'),auth['isAuthenticated'](),controller[_0x4b2b('0x10')]);router[_0x4b2b('0x11')]('/',auth[_0x4b2b('0xb')](),controller[_0x4b2b('0x12')]);router[_0x4b2b('0x13')](_0x4b2b('0xf'),auth['isAuthenticated'](),controller[_0x4b2b('0x14')]);router[_0x4b2b('0x15')](_0x4b2b('0xf'),auth[_0x4b2b('0xb')](),controller['destroy']);module[_0x4b2b('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1937186..55195a4 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 _0xe293=['exports','STRING','DATE','sequelize'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe293,0x117));var _0x3e29=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xe293[_0x2e50a2];return _0x47e5de;};'use strict';var moment=require('moment');var Sequelize=require(_0x3e29('0x0'));module[_0x3e29('0x1')]={'uniqueid':{'type':Sequelize[_0x3e29('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3e29('0x2')]},'joinAt':{'type':Sequelize[_0x3e29('0x3')]},'leaveAt':{'type':Sequelize[_0x3e29('0x3')]},'acceptAt':{'type':Sequelize[_0x3e29('0x3')]},'exitAt':{'type':Sequelize[_0x3e29('0x3')]},'reason':{'type':Sequelize[_0x3e29('0x2')]}}; \ No newline at end of file +var _0x7979=['DATE','exports','STRING'];(function(_0x565d34,_0x4176da){var _0x3751e7=function(_0x42428b){while(--_0x42428b){_0x565d34['push'](_0x565d34['shift']());}};_0x3751e7(++_0x4176da);}(_0x7979,0xeb));var _0x9797=function(_0x250316,_0x16b04f){_0x250316=_0x250316-0x0;var _0x396cb9=_0x7979[_0x250316];return _0x396cb9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9797('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9797('0x1')]},'joinAt':{'type':Sequelize[_0x9797('0x2')]},'leaveAt':{'type':Sequelize[_0x9797('0x2')]},'acceptAt':{'type':Sequelize[_0x9797('0x2')]},'exitAt':{'type':Sequelize[_0x9797('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 313de32..81eeac2 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 _0x0a3d=['util','path','to-csv','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x0a3d,0x90));var _0xd0a3=function(_0x4637da,_0x1e95dc){_0x4637da=_0x4637da-0x0;var _0x5eb41a=_0x0a3d[_0x4637da];return _0x5eb41a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0a3('0x0'));var rp=require(_0xd0a3('0x1'));var moment=require(_0xd0a3('0x2'));var BPromise=require(_0xd0a3('0x3'));var Mustache=require('mustache');var util=require(_0xd0a3('0x4'));var path=require(_0xd0a3('0x5'));var sox=require('sox');var csv=require(_0xd0a3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0a3('0x7'));var squel=require(_0xd0a3('0x8'));var crypto=require(_0xd0a3('0x9'));var jsforce=require(_0xd0a3('0xa'));var deskjs=require(_0xd0a3('0xb'));var toCsv=require(_0xd0a3('0x6'));var querystring=require('querystring');var Papa=require(_0xd0a3('0xc'));var Redis=require(_0xd0a3('0xd'));var authService=require(_0xd0a3('0xe'));var qs=require(_0xd0a3('0xf'));var as=require(_0xd0a3('0x10'));var hardwareService=require(_0xd0a3('0x11'));var logger=require('../../config/logger')(_0xd0a3('0x12'));var utils=require('../../config/utils');var config=require(_0xd0a3('0x13'));var licenseUtil=require(_0xd0a3('0x14'));var db=require(_0xd0a3('0x15'))['db'];function respondWithStatusCode(_0x2b0e0c,_0x20cc64){_0x20cc64=_0x20cc64||0xcc;return function(_0xd264e3){if(_0xd264e3){return _0x2b0e0c[_0xd0a3('0x16')](_0x20cc64);}return _0x2b0e0c[_0xd0a3('0x17')](_0x20cc64)[_0xd0a3('0x18')]();};}function respondWithResult(_0x414ef7,_0x2d78bf){_0x2d78bf=_0x2d78bf||0xc8;return function(_0x11766a){if(_0x11766a){return _0x414ef7[_0xd0a3('0x17')](_0x2d78bf)[_0xd0a3('0x19')](_0x11766a);}};}function respondWithFilteredResult(_0x12b7f0,_0x262c97){return function(_0x3921fe){if(_0x3921fe){var _0x16f50c=typeof _0x262c97[_0xd0a3('0x1a')]===_0xd0a3('0x1b')&&typeof _0x262c97['limit']===_0xd0a3('0x1b');var _0x46a319=_0x3921fe[_0xd0a3('0x1c')];var _0x5d4277=_0x16f50c?0x0:_0x262c97[_0xd0a3('0x1a')];var _0x5dce17=_0x16f50c?_0x3921fe[_0xd0a3('0x1c')]:_0x262c97[_0xd0a3('0x1a')]+_0x262c97[_0xd0a3('0x1d')];var _0x9fc3be;if(_0x5dce17>=_0x46a319){_0x5dce17=_0x46a319;_0x9fc3be=0xc8;}else{_0x9fc3be=0xce;}_0x12b7f0[_0xd0a3('0x17')](_0x9fc3be);return _0x12b7f0['set'](_0xd0a3('0x1e'),_0x5d4277+'-'+_0x5dce17+'/'+_0x46a319)[_0xd0a3('0x19')](_0x3921fe);}return null;};}function patchUpdates(_0x33320b){return function(_0x228090){try{jsonpatch[_0xd0a3('0x1f')](_0x228090,_0x33320b,!![]);}catch(_0x16beb3){return BPromise[_0xd0a3('0x20')](_0x16beb3);}return _0x228090[_0xd0a3('0x21')]();};}function saveUpdates(_0x5500c0,_0x4adc83){return function(_0x2bec6e){if(_0x2bec6e){return _0x2bec6e['update'](_0x5500c0)[_0xd0a3('0x22')](function(_0x19ac4c){return _0x19ac4c;});}return null;};}function removeEntity(_0x175248,_0x1ffd4c){return function(_0x33759f){if(_0x33759f){return _0x33759f['destroy']()[_0xd0a3('0x22')](function(){_0x175248['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x196a5e,_0x32253d){return function(_0x43f346){if(!_0x43f346){_0x196a5e['sendStatus'](0x194);}return _0x43f346;};}function handleError(_0x4720ba,_0x48545){_0x48545=_0x48545||0x1f4;return function(_0x569f30){logger[_0xd0a3('0x23')](_0x569f30['stack']);if(_0x569f30[_0xd0a3('0x24')]){delete _0x569f30[_0xd0a3('0x24')];}_0x4720ba['status'](_0x48545)[_0xd0a3('0x25')](_0x569f30);};}exports[_0xd0a3('0x26')]=function(_0x15a3f0,_0x442161){var _0x1f0c02={},_0x183282={},_0x5a3426={'count':0x0,'rows':[]};var _0x1d1f3c=_[_0xd0a3('0x27')](db[_0xd0a3('0x28')][_0xd0a3('0x29')],function(_0x5a1921){return{'name':_0x5a1921[_0xd0a3('0x2a')],'type':_0x5a1921['type'][_0xd0a3('0x2b')]};});_0x183282[_0xd0a3('0x2c')]=_[_0xd0a3('0x27')](_0x1d1f3c,'name');_0x183282['query']=_[_0xd0a3('0x2d')](_0x15a3f0['query']);_0x183282[_0xd0a3('0x2e')]=_[_0xd0a3('0x2f')](_0x183282[_0xd0a3('0x2c')],_0x183282[_0xd0a3('0x30')]);_0x1f0c02[_0xd0a3('0x31')]=_[_0xd0a3('0x2f')](_0x183282[_0xd0a3('0x2c')],qs['fields'](_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x32')]));_0x1f0c02[_0xd0a3('0x31')]=_0x1f0c02['attributes']['length']?_0x1f0c02['attributes']:_0x183282['model'];if(!_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x33')](_0xd0a3('0x34'))){_0x1f0c02['limit']=qs[_0xd0a3('0x1d')](_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x1d')]);_0x1f0c02['offset']=qs[_0xd0a3('0x1a')](_0x15a3f0['query'][_0xd0a3('0x1a')]);}_0x1f0c02[_0xd0a3('0x35')]=qs[_0xd0a3('0x36')](_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x36')]);_0x1f0c02[_0xd0a3('0x37')]=qs[_0xd0a3('0x2e')](_[_0xd0a3('0x38')](_0x15a3f0[_0xd0a3('0x30')],_0x183282[_0xd0a3('0x2e')]),_0x1d1f3c);if(_0x15a3f0[_0xd0a3('0x30')]['filter']){_0x1f0c02['where']=_['merge'](_0x1f0c02['where'],{'$or':_[_0xd0a3('0x27')](_0x1d1f3c,function(_0x1af9cf){if(_0x1af9cf[_0xd0a3('0x39')]!==_0xd0a3('0x3a')){var _0x375c48={};_0x375c48[_0x1af9cf[_0xd0a3('0x24')]]={'$like':'%'+_0x15a3f0['query'][_0xd0a3('0x3b')]+'%'};return _0x375c48;}})});}_0x1f0c02=_['merge']({},_0x1f0c02,_0x15a3f0[_0xd0a3('0x3c')]);var _0x50ec68={'where':_0x1f0c02[_0xd0a3('0x37')]};return db[_0xd0a3('0x28')][_0xd0a3('0x1c')](_0x50ec68)[_0xd0a3('0x22')](function(_0x5ecdc8){_0x5a3426[_0xd0a3('0x1c')]=_0x5ecdc8;if(_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x3d')]){_0x1f0c02[_0xd0a3('0x3e')]=[{'all':!![]}];}return db[_0xd0a3('0x28')][_0xd0a3('0x3f')](_0x1f0c02);})[_0xd0a3('0x22')](function(_0x1bb289){_0x5a3426[_0xd0a3('0x40')]=_0x1bb289;return _0x5a3426;})[_0xd0a3('0x22')](respondWithFilteredResult(_0x442161,_0x1f0c02))['catch'](handleError(_0x442161,null));};exports[_0xd0a3('0x41')]=function(_0x30ea61,_0x550a2a){var _0xcba251={'raw':!![],'where':{'id':_0x30ea61[_0xd0a3('0x42')]['id']}},_0x3e60ca={};_0x3e60ca['model']=_[_0xd0a3('0x2d')](db[_0xd0a3('0x28')][_0xd0a3('0x29')]);_0x3e60ca[_0xd0a3('0x30')]=_['keys'](_0x30ea61[_0xd0a3('0x30')]);_0x3e60ca[_0xd0a3('0x2e')]=_[_0xd0a3('0x2f')](_0x3e60ca[_0xd0a3('0x2c')],_0x3e60ca[_0xd0a3('0x30')]);_0xcba251[_0xd0a3('0x31')]=_[_0xd0a3('0x2f')](_0x3e60ca[_0xd0a3('0x2c')],qs['fields'](_0x30ea61[_0xd0a3('0x30')][_0xd0a3('0x32')]));_0xcba251[_0xd0a3('0x31')]=_0xcba251[_0xd0a3('0x31')]['length']?_0xcba251[_0xd0a3('0x31')]:_0x3e60ca[_0xd0a3('0x2c')];if(_0x30ea61['query'][_0xd0a3('0x3d')]){_0xcba251[_0xd0a3('0x3e')]=[{'all':!![]}];}_0xcba251=_[_0xd0a3('0x43')]({},_0xcba251,_0x30ea61[_0xd0a3('0x3c')]);return db[_0xd0a3('0x28')][_0xd0a3('0x44')](_0xcba251)[_0xd0a3('0x22')](handleEntityNotFound(_0x550a2a,null))[_0xd0a3('0x22')](respondWithResult(_0x550a2a,null))[_0xd0a3('0x45')](handleError(_0x550a2a,null));};exports[_0xd0a3('0x46')]=function(_0x3cb37d,_0x329e6b){return db[_0xd0a3('0x28')][_0xd0a3('0x46')](_0x3cb37d['body'],{})[_0xd0a3('0x22')](respondWithResult(_0x329e6b,0xc9))['catch'](handleError(_0x329e6b,null));};exports['update']=function(_0x34c589,_0x131c59){if(_0x34c589[_0xd0a3('0x47')]['id']){delete _0x34c589[_0xd0a3('0x47')]['id'];}return db[_0xd0a3('0x28')][_0xd0a3('0x44')]({'where':{'id':_0x34c589['params']['id']}})[_0xd0a3('0x22')](handleEntityNotFound(_0x131c59,null))['then'](saveUpdates(_0x34c589[_0xd0a3('0x47')],null))[_0xd0a3('0x22')](respondWithResult(_0x131c59,null))[_0xd0a3('0x45')](handleError(_0x131c59,null));};exports[_0xd0a3('0x48')]=function(_0x158e54,_0x5e3708){return db[_0xd0a3('0x28')][_0xd0a3('0x44')]({'where':{'id':_0x158e54[_0xd0a3('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e3708,null))['then'](removeEntity(_0x5e3708,null))[_0xd0a3('0x45')](handleError(_0x5e3708,null));};exports[_0xd0a3('0x49')]=function(_0x5b5293,_0x91681e){return db[_0xd0a3('0x28')][_0xd0a3('0x49')]()[_0xd0a3('0x22')](respondWithResult(_0x91681e,null))[_0xd0a3('0x45')](handleError(_0x91681e,null));}; \ No newline at end of file +var _0x1548=['map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','includeAll','find','body','params','destroy','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','stack','name','send','index','SmsQueueReport','rawAttributes','key','model'];(function(_0x8daa0f,_0x1384fb){var _0x57987a=function(_0x5063f8){while(--_0x5063f8){_0x8daa0f['push'](_0x8daa0f['shift']());}};_0x57987a(++_0x1384fb);}(_0x1548,0xf1));var _0x8154=function(_0x1506dd,_0x3d928c){_0x1506dd=_0x1506dd-0x0;var _0x214eca=_0x1548[_0x1506dd];return _0x214eca;};'use strict';var emlformat=require(_0x8154('0x0'));var rimraf=require(_0x8154('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8154('0x2'));var BPromise=require(_0x8154('0x3'));var Mustache=require(_0x8154('0x4'));var util=require(_0x8154('0x5'));var path=require(_0x8154('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8154('0x7'));var fs=require('fs');var fs_extra=require(_0x8154('0x8'));var _=require('lodash');var squel=require(_0x8154('0x9'));var crypto=require(_0x8154('0xa'));var jsforce=require(_0x8154('0xb'));var deskjs=require(_0x8154('0xc'));var toCsv=require(_0x8154('0xd'));var querystring=require('querystring');var Papa=require(_0x8154('0xe'));var Redis=require(_0x8154('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8154('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8154('0x11'))(_0x8154('0x12'));var utils=require('../../config/utils');var config=require(_0x8154('0x13'));var licenseUtil=require(_0x8154('0x14'));var db=require(_0x8154('0x15'))['db'];function respondWithStatusCode(_0x2838cd,_0x55fd23){_0x55fd23=_0x55fd23||0xcc;return function(_0xe079eb){if(_0xe079eb){return _0x2838cd[_0x8154('0x16')](_0x55fd23);}return _0x2838cd['status'](_0x55fd23)[_0x8154('0x17')]();};}function respondWithResult(_0xfa47ef,_0x3b54fb){_0x3b54fb=_0x3b54fb||0xc8;return function(_0x659de){if(_0x659de){return _0xfa47ef[_0x8154('0x18')](_0x3b54fb)['json'](_0x659de);}};}function respondWithFilteredResult(_0x4ce12b,_0x3d4236){return function(_0x521c92){if(_0x521c92){var _0x233f79=typeof _0x3d4236[_0x8154('0x19')]===_0x8154('0x1a')&&typeof _0x3d4236[_0x8154('0x1b')]===_0x8154('0x1a');var _0x5e8326=_0x521c92['count'];var _0x4d8c05=_0x233f79?0x0:_0x3d4236[_0x8154('0x19')];var _0x14490d=_0x233f79?_0x521c92[_0x8154('0x1c')]:_0x3d4236['offset']+_0x3d4236[_0x8154('0x1b')];var _0x502b19;if(_0x14490d>=_0x5e8326){_0x14490d=_0x5e8326;_0x502b19=0xc8;}else{_0x502b19=0xce;}_0x4ce12b[_0x8154('0x18')](_0x502b19);return _0x4ce12b[_0x8154('0x1d')](_0x8154('0x1e'),_0x4d8c05+'-'+_0x14490d+'/'+_0x5e8326)[_0x8154('0x1f')](_0x521c92);}return null;};}function patchUpdates(_0xb04977){return function(_0x30b3e0){try{jsonpatch['apply'](_0x30b3e0,_0xb04977,!![]);}catch(_0x4f5872){return BPromise['reject'](_0x4f5872);}return _0x30b3e0[_0x8154('0x20')]();};}function saveUpdates(_0x44a008,_0x89e94){return function(_0x4c3042){if(_0x4c3042){return _0x4c3042[_0x8154('0x21')](_0x44a008)[_0x8154('0x22')](function(_0x231cb0){return _0x231cb0;});}return null;};}function removeEntity(_0x21e231,_0x37e4f1){return function(_0x1a1ccc){if(_0x1a1ccc){return _0x1a1ccc['destroy']()[_0x8154('0x22')](function(){_0x21e231['status'](0xcc)[_0x8154('0x17')]();});}};}function handleEntityNotFound(_0xd47bfc,_0x46c433){return function(_0x45c766){if(!_0x45c766){_0xd47bfc[_0x8154('0x16')](0x194);}return _0x45c766;};}function handleError(_0x2f6c72,_0x34f995){_0x34f995=_0x34f995||0x1f4;return function(_0x2c4183){logger['error'](_0x2c4183[_0x8154('0x23')]);if(_0x2c4183[_0x8154('0x24')]){delete _0x2c4183[_0x8154('0x24')];}_0x2f6c72[_0x8154('0x18')](_0x34f995)[_0x8154('0x25')](_0x2c4183);};}exports[_0x8154('0x26')]=function(_0x215df7,_0x4b4eaa){var _0x1d7312={},_0x1f6d40={},_0x118da0={'count':0x0,'rows':[]};var _0x5bd612=_['map'](db[_0x8154('0x27')][_0x8154('0x28')],function(_0x3cd111){return{'name':_0x3cd111['fieldName'],'type':_0x3cd111['type'][_0x8154('0x29')]};});_0x1f6d40[_0x8154('0x2a')]=_[_0x8154('0x2b')](_0x5bd612,_0x8154('0x24'));_0x1f6d40[_0x8154('0x2c')]=_[_0x8154('0x2d')](_0x215df7['query']);_0x1f6d40[_0x8154('0x2e')]=_[_0x8154('0x2f')](_0x1f6d40[_0x8154('0x2a')],_0x1f6d40[_0x8154('0x2c')]);_0x1d7312['attributes']=_[_0x8154('0x2f')](_0x1f6d40[_0x8154('0x2a')],qs['fields'](_0x215df7['query']['fields']));_0x1d7312[_0x8154('0x30')]=_0x1d7312[_0x8154('0x30')][_0x8154('0x31')]?_0x1d7312[_0x8154('0x30')]:_0x1f6d40[_0x8154('0x2a')];if(!_0x215df7[_0x8154('0x2c')][_0x8154('0x32')](_0x8154('0x33'))){_0x1d7312[_0x8154('0x1b')]=qs['limit'](_0x215df7[_0x8154('0x2c')][_0x8154('0x1b')]);_0x1d7312[_0x8154('0x19')]=qs[_0x8154('0x19')](_0x215df7['query'][_0x8154('0x19')]);}_0x1d7312[_0x8154('0x34')]=qs[_0x8154('0x35')](_0x215df7[_0x8154('0x2c')][_0x8154('0x35')]);_0x1d7312[_0x8154('0x36')]=qs[_0x8154('0x2e')](_[_0x8154('0x37')](_0x215df7[_0x8154('0x2c')],_0x1f6d40[_0x8154('0x2e')]),_0x5bd612);if(_0x215df7['query'][_0x8154('0x38')]){_0x1d7312[_0x8154('0x36')]=_[_0x8154('0x39')](_0x1d7312[_0x8154('0x36')],{'$or':_[_0x8154('0x2b')](_0x5bd612,function(_0x327442){if(_0x327442[_0x8154('0x3a')]!==_0x8154('0x3b')){var _0x2d3e40={};_0x2d3e40[_0x327442[_0x8154('0x24')]]={'$like':'%'+_0x215df7[_0x8154('0x2c')][_0x8154('0x38')]+'%'};return _0x2d3e40;}})});}_0x1d7312=_['merge']({},_0x1d7312,_0x215df7[_0x8154('0x3c')]);var _0x2b672b={'where':_0x1d7312[_0x8154('0x36')]};return db[_0x8154('0x27')][_0x8154('0x1c')](_0x2b672b)[_0x8154('0x22')](function(_0x4f5e02){_0x118da0[_0x8154('0x1c')]=_0x4f5e02;if(_0x215df7[_0x8154('0x2c')]['includeAll']){_0x1d7312[_0x8154('0x3d')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x1d7312);})[_0x8154('0x22')](function(_0x362352){_0x118da0[_0x8154('0x3e')]=_0x362352;return _0x118da0;})[_0x8154('0x22')](respondWithFilteredResult(_0x4b4eaa,_0x1d7312))[_0x8154('0x3f')](handleError(_0x4b4eaa,null));};exports[_0x8154('0x40')]=function(_0x47ebf8,_0x521e0b){var _0x15749a={'raw':!![],'where':{'id':_0x47ebf8['params']['id']}},_0x3a556b={};_0x3a556b[_0x8154('0x2a')]=_[_0x8154('0x2d')](db[_0x8154('0x27')][_0x8154('0x28')]);_0x3a556b[_0x8154('0x2c')]=_[_0x8154('0x2d')](_0x47ebf8[_0x8154('0x2c')]);_0x3a556b[_0x8154('0x2e')]=_[_0x8154('0x2f')](_0x3a556b['model'],_0x3a556b[_0x8154('0x2c')]);_0x15749a['attributes']=_['intersection'](_0x3a556b[_0x8154('0x2a')],qs['fields'](_0x47ebf8[_0x8154('0x2c')]['fields']));_0x15749a[_0x8154('0x30')]=_0x15749a['attributes'][_0x8154('0x31')]?_0x15749a[_0x8154('0x30')]:_0x3a556b[_0x8154('0x2a')];if(_0x47ebf8[_0x8154('0x2c')][_0x8154('0x41')]){_0x15749a[_0x8154('0x3d')]=[{'all':!![]}];}_0x15749a=_[_0x8154('0x39')]({},_0x15749a,_0x47ebf8[_0x8154('0x3c')]);return db[_0x8154('0x27')][_0x8154('0x42')](_0x15749a)['then'](handleEntityNotFound(_0x521e0b,null))[_0x8154('0x22')](respondWithResult(_0x521e0b,null))[_0x8154('0x3f')](handleError(_0x521e0b,null));};exports['create']=function(_0x49febe,_0x4f1b34){return db[_0x8154('0x27')]['create'](_0x49febe[_0x8154('0x43')],{})[_0x8154('0x22')](respondWithResult(_0x4f1b34,0xc9))[_0x8154('0x3f')](handleError(_0x4f1b34,null));};exports['update']=function(_0x5dd77d,_0xf1b2e2){if(_0x5dd77d['body']['id']){delete _0x5dd77d['body']['id'];}return db[_0x8154('0x27')][_0x8154('0x42')]({'where':{'id':_0x5dd77d[_0x8154('0x44')]['id']}})[_0x8154('0x22')](handleEntityNotFound(_0xf1b2e2,null))['then'](saveUpdates(_0x5dd77d[_0x8154('0x43')],null))[_0x8154('0x22')](respondWithResult(_0xf1b2e2,null))[_0x8154('0x3f')](handleError(_0xf1b2e2,null));};exports[_0x8154('0x45')]=function(_0x41a624,_0x403e20){return db['SmsQueueReport']['find']({'where':{'id':_0x41a624['params']['id']}})[_0x8154('0x22')](handleEntityNotFound(_0x403e20,null))[_0x8154('0x22')](removeEntity(_0x403e20,null))[_0x8154('0x3f')](handleError(_0x403e20,null));};exports[_0x8154('0x46')]=function(_0x4e2ba6,_0x56bb0c){return db['SmsQueueReport'][_0x8154('0x46')]()['then'](respondWithResult(_0x56bb0c,null))[_0x8154('0x3f')](handleError(_0x56bb0c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5c69843..79c2ac9 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x2664ab,_0x1fea26){var _0x30c72b=function(_0x1ff6d4){while(--_0x1ff6d4){_0x2664ab['push'](_0x2664ab['shift']());}};_0x30c72b(++_0x1fea26);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x1a158d,_0x26f089){var _0xc2955a=function(_0x39b8c7){while(--_0x39b8c7){_0x1a158d['push'](_0x1a158d['shift']());}};_0xc2955a(++_0x26f089);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index adcb9e1..6a29e02 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 _0xe8f1=['ioredis','../../mysqldb','rpc','jayson/promise','client','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsQueueReport','create','body','options','then','CreateSmsQueueReport','catch','UpdateSmsQueueReport','update','raw','where','attributes','limit','lodash','moment','randomstring'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0xe8f1,0xdd));var _0x1e8f=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xe8f1[_0xe39824];return _0x4bc31e;};'use strict';var _=require(_0x1e8f('0x0'));var util=require('util');var moment=require(_0x1e8f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e8f('0x2'));var fs=require('fs');var Redis=require(_0x1e8f('0x3'));var db=require(_0x1e8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1e8f('0x5'));var config=require('../../config/environment');var jayson=require(_0x1e8f('0x6'));var client=jayson[_0x1e8f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33e503,_0xb43570,_0x475b08){return new BPromise(function(_0x8d65a3,_0xbf86f7){return client[_0x1e8f('0x8')](_0x33e503,_0x475b08)['then'](function(_0x11bfcc){logger[_0x1e8f('0x9')](_0x1e8f('0xa'),_0xb43570,_0x1e8f('0xb'));logger[_0x1e8f('0xc')](_0x1e8f('0xd'),_0xb43570,_0x1e8f('0xb'),JSON[_0x1e8f('0xe')](_0x11bfcc));if(_0x11bfcc[_0x1e8f('0xf')]){if(_0x11bfcc['error'][_0x1e8f('0x10')]===0x1f4){logger[_0x1e8f('0xf')](_0x1e8f('0xa'),_0xb43570,_0x11bfcc['error'][_0x1e8f('0x11')]);return _0xbf86f7(_0x11bfcc['error'][_0x1e8f('0x11')]);}logger[_0x1e8f('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0xb43570,_0x11bfcc[_0x1e8f('0xf')]['message']);return _0x8d65a3(_0x11bfcc[_0x1e8f('0xf')]['message']);}else{logger['info'](_0x1e8f('0xa'),_0xb43570,_0x1e8f('0xb'));_0x8d65a3(_0x11bfcc[_0x1e8f('0x12')][_0x1e8f('0x11')]);}})['catch'](function(_0x416504){logger[_0x1e8f('0xf')](_0x1e8f('0xa'),_0xb43570,_0x416504);_0xbf86f7(_0x416504);});});}exports['CreateSmsQueueReport']=function(_0x5580ae){var _0xeded76=this;return new Promise(function(_0x4f38ff,_0x248c47){return db[_0x1e8f('0x13')][_0x1e8f('0x14')](_0x5580ae[_0x1e8f('0x15')],{'raw':_0x5580ae[_0x1e8f('0x16')]?_0x5580ae[_0x1e8f('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x1e8f('0x17')](function(_0x4b9684){logger[_0x1e8f('0x9')](_0x1e8f('0x18'),_0x5580ae);logger[_0x1e8f('0xc')](_0x1e8f('0x18'),_0x5580ae,JSON['stringify'](_0x4b9684));_0x4f38ff(_0x4b9684);})[_0x1e8f('0x19')](function(_0x182c8a){logger[_0x1e8f('0xf')]('CreateSmsQueueReport',_0x182c8a[_0x1e8f('0x11')],_0x5580ae);_0x248c47(_0xeded76[_0x1e8f('0xf')](0x1f4,_0x182c8a['message']));});});};exports[_0x1e8f('0x1a')]=function(_0x589d89){var _0x3827f5=this;return new Promise(function(_0x406602,_0x3129c2){return db[_0x1e8f('0x13')][_0x1e8f('0x1b')](_0x589d89[_0x1e8f('0x15')],{'raw':_0x589d89[_0x1e8f('0x16')]?_0x589d89[_0x1e8f('0x16')][_0x1e8f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x589d89[_0x1e8f('0x16')]?_0x589d89[_0x1e8f('0x16')][_0x1e8f('0x1d')]||null:null,'attributes':_0x589d89['options']?_0x589d89['options'][_0x1e8f('0x1e')]||null:null,'limit':_0x589d89[_0x1e8f('0x16')]?_0x589d89[_0x1e8f('0x16')][_0x1e8f('0x1f')]||null:null})[_0x1e8f('0x17')](function(_0x4ddba8){logger[_0x1e8f('0x9')](_0x1e8f('0x1a'),_0x589d89);logger[_0x1e8f('0xc')]('UpdateSmsQueueReport',_0x589d89,JSON[_0x1e8f('0xe')](_0x4ddba8));_0x406602(_0x4ddba8);})[_0x1e8f('0x19')](function(_0x3fe80f){logger[_0x1e8f('0xf')](_0x1e8f('0x1a'),_0x3fe80f[_0x1e8f('0x11')],_0x589d89);_0x3129c2(_0x3827f5['error'](0x1f4,_0x3fe80f['message']));});});}; \ No newline at end of file +var _0xbcd8=['../../config/environment','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x499922,_0x50ea6c){var _0xeacd8d=function(_0x34e2d4){while(--_0x34e2d4){_0x499922['push'](_0x499922['shift']());}};_0xeacd8d(++_0x50ea6c);}(_0xbcd8,0x143));var _0x8bcd=function(_0x73cc89,_0x34e084){_0x73cc89=_0x73cc89-0x0;var _0x2bfa6f=_0xbcd8[_0x73cc89];return _0x2bfa6f;};'use strict';var _=require(_0x8bcd('0x0'));var util=require('util');var moment=require(_0x8bcd('0x1'));var BPromise=require(_0x8bcd('0x2'));var rs=require(_0x8bcd('0x3'));var fs=require('fs');var Redis=require(_0x8bcd('0x4'));var db=require(_0x8bcd('0x5'))['db'];var utils=require(_0x8bcd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8bcd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8bcd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf83c0b,_0x3c6c9e,_0x1c5f3f){return new BPromise(function(_0x525692,_0x301a2c){return client[_0x8bcd('0x9')](_0xf83c0b,_0x1c5f3f)[_0x8bcd('0xa')](function(_0x10bcef){logger[_0x8bcd('0xb')](_0x8bcd('0xc'),_0x3c6c9e,_0x8bcd('0xd'));logger[_0x8bcd('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3c6c9e,'request\x20sent',JSON[_0x8bcd('0xf')](_0x10bcef));if(_0x10bcef[_0x8bcd('0x10')]){if(_0x10bcef['error'][_0x8bcd('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3c6c9e,_0x10bcef[_0x8bcd('0x10')][_0x8bcd('0x12')]);return _0x301a2c(_0x10bcef[_0x8bcd('0x10')][_0x8bcd('0x12')]);}logger[_0x8bcd('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x3c6c9e,_0x10bcef['error'][_0x8bcd('0x12')]);return _0x525692(_0x10bcef[_0x8bcd('0x10')][_0x8bcd('0x12')]);}else{logger['info'](_0x8bcd('0xc'),_0x3c6c9e,_0x8bcd('0xd'));_0x525692(_0x10bcef[_0x8bcd('0x13')][_0x8bcd('0x12')]);}})[_0x8bcd('0x14')](function(_0x28a180){logger['error'](_0x8bcd('0xc'),_0x3c6c9e,_0x28a180);_0x301a2c(_0x28a180);});});}exports[_0x8bcd('0x15')]=function(_0x52660c){var _0x298698=this;return new Promise(function(_0x267262,_0x23c5a2){return db[_0x8bcd('0x16')][_0x8bcd('0x17')](_0x52660c[_0x8bcd('0x18')],{'raw':_0x52660c[_0x8bcd('0x19')]?_0x52660c['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2c0026){logger[_0x8bcd('0xb')]('CreateSmsQueueReport',_0x52660c);logger[_0x8bcd('0xe')]('CreateSmsQueueReport',_0x52660c,JSON[_0x8bcd('0xf')](_0x2c0026));_0x267262(_0x2c0026);})[_0x8bcd('0x14')](function(_0x23ae5e){logger[_0x8bcd('0x10')](_0x8bcd('0x15'),_0x23ae5e['message'],_0x52660c);_0x23c5a2(_0x298698[_0x8bcd('0x10')](0x1f4,_0x23ae5e[_0x8bcd('0x12')]));});});};exports[_0x8bcd('0x1a')]=function(_0x2f85be){var _0x1d8cee=this;return new Promise(function(_0x272b96,_0x11a620){return db[_0x8bcd('0x16')][_0x8bcd('0x1b')](_0x2f85be[_0x8bcd('0x18')],{'raw':_0x2f85be['options']?_0x2f85be[_0x8bcd('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f85be['options']?_0x2f85be[_0x8bcd('0x19')]['where']||null:null,'attributes':_0x2f85be[_0x8bcd('0x19')]?_0x2f85be[_0x8bcd('0x19')][_0x8bcd('0x1c')]||null:null,'limit':_0x2f85be[_0x8bcd('0x19')]?_0x2f85be[_0x8bcd('0x19')][_0x8bcd('0x1d')]||null:null})['then'](function(_0x4ac2d7){logger[_0x8bcd('0xb')]('UpdateSmsQueueReport',_0x2f85be);logger[_0x8bcd('0xe')](_0x8bcd('0x1a'),_0x2f85be,JSON[_0x8bcd('0xf')](_0x4ac2d7));_0x272b96(_0x4ac2d7);})[_0x8bcd('0x14')](function(_0x488e0a){logger[_0x8bcd('0x10')]('UpdateSmsQueueReport',_0x488e0a[_0x8bcd('0x12')],_0x2f85be);_0x11a620(_0x1d8cee[_0x8bcd('0x10')](0x1f4,_0x488e0a[_0x8bcd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7ed51b2..a59478b 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 _0xfd7b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x104ac8,_0x106512){var _0x241cb6=function(_0x8d2c66){while(--_0x8d2c66){_0x104ac8['push'](_0x104ac8['shift']());}};_0x241cb6(++_0x106512);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xfd7b[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require('multer');var util=require(_0xbfd7('0x0'));var path=require(_0xbfd7('0x1'));var timeout=require(_0xbfd7('0x2'));var express=require(_0xbfd7('0x3'));var router=express[_0xbfd7('0x4')]();var fs_extra=require(_0xbfd7('0x5'));var auth=require(_0xbfd7('0x6'));var interaction=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var controller=require(_0xbfd7('0x9'));router[_0xbfd7('0xa')]('/',auth[_0xbfd7('0xb')](),controller[_0xbfd7('0xc')]);router['get'](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0xe')]);router['get'](_0xbfd7('0xf'),auth[_0xbfd7('0xb')](),controller[_0xbfd7('0x10')]);router[_0xbfd7('0x11')]('/',auth['isAuthenticated'](),controller[_0xbfd7('0x12')]);router[_0xbfd7('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xbfd7('0x14')]);router[_0xbfd7('0x15')](_0xbfd7('0xf'),auth[_0xbfd7('0xb')](),controller[_0xbfd7('0x16')]);module['exports']=router; \ No newline at end of file +var _0x303a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','exports','multer','path'];(function(_0x39edd9,_0x287d32){var _0xc5bd8f=function(_0x5a290f){while(--_0x5a290f){_0x39edd9['push'](_0x39edd9['shift']());}};_0xc5bd8f(++_0x287d32);}(_0x303a,0x1a0));var _0xa303=function(_0x44da96,_0x1f19d5){_0x44da96=_0x44da96-0x0;var _0x519253=_0x303a[_0x44da96];return _0x519253;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller['show']);router[_0xa303('0xe')]('/',auth['isAuthenticated'](),controller[_0xa303('0xf')]);router['put'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller[_0xa303('0x10')]);router[_0xa303('0x11')]('/:id',auth[_0xa303('0xa')](),controller['destroy']);module[_0xa303('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ab7d958..02a085a 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3ff310,_0x195f71){var _0x4f7909=function(_0x758292){while(--_0x758292){_0x3ff310['push'](_0x3ff310['shift']());}};_0x4f7909(++_0x195f71);}(_0x70e0,0x17b));var _0x070e=function(_0x1fad82,_0xb54ae9){_0x1fad82=_0x1fad82-0x0;var _0x2db911=_0x70e0[_0x1fad82];return _0x2db911;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2df2d0,_0x1d6ea8){var _0x3c4438=function(_0x456da2){while(--_0x456da2){_0x2df2d0['push'](_0x2df2d0['shift']());}};_0x3c4438(++_0x1d6ea8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 3388ba6..761f13f 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 _0x36d2=['filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','update','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x59f67c,_0x2330d3){var _0x2b8d8=function(_0x4570ca){while(--_0x4570ca){_0x59f67c['push'](_0x59f67c['shift']());}};_0x2b8d8(++_0x2330d3);}(_0x36d2,0xa2));var _0x236d=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x36d2[_0x277107];return _0x1da046;};'use strict';var emlformat=require(_0x236d('0x0'));var rimraf=require(_0x236d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x236d('0x2'));var moment=require(_0x236d('0x3'));var BPromise=require(_0x236d('0x4'));var Mustache=require(_0x236d('0x5'));var util=require('util');var path=require(_0x236d('0x6'));var sox=require(_0x236d('0x7'));var csv=require(_0x236d('0x8'));var ejs=require(_0x236d('0x9'));var fs=require('fs');var fs_extra=require(_0x236d('0xa'));var _=require(_0x236d('0xb'));var squel=require(_0x236d('0xc'));var crypto=require('crypto');var jsforce=require(_0x236d('0xd'));var deskjs=require(_0x236d('0xe'));var toCsv=require(_0x236d('0x8'));var querystring=require(_0x236d('0xf'));var Papa=require(_0x236d('0x10'));var Redis=require(_0x236d('0x11'));var authService=require(_0x236d('0x12'));var qs=require(_0x236d('0x13'));var as=require(_0x236d('0x14'));var hardwareService=require(_0x236d('0x15'));var logger=require(_0x236d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x236d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x236d('0x18'))['db'];function respondWithStatusCode(_0x232ec9,_0x2969f1){_0x2969f1=_0x2969f1||0xcc;return function(_0x1859d7){if(_0x1859d7){return _0x232ec9[_0x236d('0x19')](_0x2969f1);}return _0x232ec9[_0x236d('0x1a')](_0x2969f1)['end']();};}function respondWithResult(_0x417ee7,_0x23935a){_0x23935a=_0x23935a||0xc8;return function(_0x2c9580){if(_0x2c9580){return _0x417ee7[_0x236d('0x1a')](_0x23935a)[_0x236d('0x1b')](_0x2c9580);}};}function respondWithFilteredResult(_0x30ba50,_0x11cc7f){return function(_0x1ac2f0){if(_0x1ac2f0){var _0x41727e=typeof _0x11cc7f[_0x236d('0x1c')]===_0x236d('0x1d')&&typeof _0x11cc7f[_0x236d('0x1e')]===_0x236d('0x1d');var _0x285ead=_0x1ac2f0[_0x236d('0x1f')];var _0x3e06b9=_0x41727e?0x0:_0x11cc7f[_0x236d('0x1c')];var _0x59c80e=_0x41727e?_0x1ac2f0[_0x236d('0x1f')]:_0x11cc7f[_0x236d('0x1c')]+_0x11cc7f['limit'];var _0xe396cc;if(_0x59c80e>=_0x285ead){_0x59c80e=_0x285ead;_0xe396cc=0xc8;}else{_0xe396cc=0xce;}_0x30ba50[_0x236d('0x1a')](_0xe396cc);return _0x30ba50[_0x236d('0x20')]('Content-Range',_0x3e06b9+'-'+_0x59c80e+'/'+_0x285ead)[_0x236d('0x1b')](_0x1ac2f0);}return null;};}function patchUpdates(_0x4e2570){return function(_0x2256bf){try{jsonpatch[_0x236d('0x21')](_0x2256bf,_0x4e2570,!![]);}catch(_0x222c9){return BPromise[_0x236d('0x22')](_0x222c9);}return _0x2256bf['save']();};}function saveUpdates(_0x2a899d,_0x541945){return function(_0x2ca2c6){if(_0x2ca2c6){return _0x2ca2c6['update'](_0x2a899d)[_0x236d('0x23')](function(_0x1fce61){return _0x1fce61;});}return null;};}function removeEntity(_0x2abdd1,_0x33e934){return function(_0x581baf){if(_0x581baf){return _0x581baf['destroy']()[_0x236d('0x23')](function(){_0x2abdd1[_0x236d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb1c89,_0xa4663e){return function(_0x3b6708){if(!_0x3b6708){_0xfb1c89[_0x236d('0x19')](0x194);}return _0x3b6708;};}function handleError(_0x16547f,_0x529964){_0x529964=_0x529964||0x1f4;return function(_0x5ac4af){logger['error'](_0x5ac4af['stack']);if(_0x5ac4af['name']){delete _0x5ac4af[_0x236d('0x24')];}_0x16547f[_0x236d('0x1a')](_0x529964)[_0x236d('0x25')](_0x5ac4af);};}exports['index']=function(_0x50e7ab,_0x23c5c9){var _0x1e75a2={},_0x4fe897={},_0x4a3845={'count':0x0,'rows':[]};var _0x4283bb=_[_0x236d('0x26')](db[_0x236d('0x27')][_0x236d('0x28')],function(_0x2abec5){return{'name':_0x2abec5[_0x236d('0x29')],'type':_0x2abec5[_0x236d('0x2a')][_0x236d('0x2b')]};});_0x4fe897[_0x236d('0x2c')]=_[_0x236d('0x26')](_0x4283bb,_0x236d('0x24'));_0x4fe897[_0x236d('0x2d')]=_[_0x236d('0x2e')](_0x50e7ab[_0x236d('0x2d')]);_0x4fe897[_0x236d('0x2f')]=_[_0x236d('0x30')](_0x4fe897[_0x236d('0x2c')],_0x4fe897[_0x236d('0x2d')]);_0x1e75a2[_0x236d('0x31')]=_[_0x236d('0x30')](_0x4fe897[_0x236d('0x2c')],qs['fields'](_0x50e7ab[_0x236d('0x2d')][_0x236d('0x32')]));_0x1e75a2['attributes']=_0x1e75a2['attributes'][_0x236d('0x33')]?_0x1e75a2[_0x236d('0x31')]:_0x4fe897['model'];if(!_0x50e7ab[_0x236d('0x2d')]['hasOwnProperty'](_0x236d('0x34'))){_0x1e75a2[_0x236d('0x1e')]=qs['limit'](_0x50e7ab['query'][_0x236d('0x1e')]);_0x1e75a2[_0x236d('0x1c')]=qs[_0x236d('0x1c')](_0x50e7ab[_0x236d('0x2d')][_0x236d('0x1c')]);}_0x1e75a2[_0x236d('0x35')]=qs[_0x236d('0x36')](_0x50e7ab[_0x236d('0x2d')]['sort']);_0x1e75a2[_0x236d('0x37')]=qs[_0x236d('0x2f')](_[_0x236d('0x38')](_0x50e7ab[_0x236d('0x2d')],_0x4fe897[_0x236d('0x2f')]),_0x4283bb);if(_0x50e7ab[_0x236d('0x2d')][_0x236d('0x39')]){_0x1e75a2[_0x236d('0x37')]=_[_0x236d('0x3a')](_0x1e75a2['where'],{'$or':_['map'](_0x4283bb,function(_0x30b1e6){if(_0x30b1e6[_0x236d('0x2a')]!==_0x236d('0x3b')){var _0x23414c={};_0x23414c[_0x30b1e6['name']]={'$like':'%'+_0x50e7ab[_0x236d('0x2d')][_0x236d('0x39')]+'%'};return _0x23414c;}})});}_0x1e75a2=_[_0x236d('0x3a')]({},_0x1e75a2,_0x50e7ab['options']);var _0x98c594={'where':_0x1e75a2['where']};return db['SmsTransferReport']['count'](_0x98c594)['then'](function(_0x50363d){_0x4a3845[_0x236d('0x1f')]=_0x50363d;if(_0x50e7ab['query'][_0x236d('0x3c')]){_0x1e75a2[_0x236d('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x236d('0x3e')](_0x1e75a2);})[_0x236d('0x23')](function(_0x530996){_0x4a3845[_0x236d('0x3f')]=_0x530996;return _0x4a3845;})[_0x236d('0x23')](respondWithFilteredResult(_0x23c5c9,_0x1e75a2))[_0x236d('0x40')](handleError(_0x23c5c9,null));};exports['show']=function(_0x4cae1c,_0x44bd92){var _0xf108e6={'raw':!![],'where':{'id':_0x4cae1c[_0x236d('0x41')]['id']}},_0x529941={};_0x529941[_0x236d('0x2c')]=_[_0x236d('0x2e')](db[_0x236d('0x27')][_0x236d('0x28')]);_0x529941[_0x236d('0x2d')]=_['keys'](_0x4cae1c[_0x236d('0x2d')]);_0x529941['filters']=_['intersection'](_0x529941[_0x236d('0x2c')],_0x529941[_0x236d('0x2d')]);_0xf108e6[_0x236d('0x31')]=_[_0x236d('0x30')](_0x529941['model'],qs[_0x236d('0x32')](_0x4cae1c['query'][_0x236d('0x32')]));_0xf108e6[_0x236d('0x31')]=_0xf108e6[_0x236d('0x31')][_0x236d('0x33')]?_0xf108e6[_0x236d('0x31')]:_0x529941[_0x236d('0x2c')];if(_0x4cae1c[_0x236d('0x2d')][_0x236d('0x3c')]){_0xf108e6[_0x236d('0x3d')]=[{'all':!![]}];}_0xf108e6=_[_0x236d('0x3a')]({},_0xf108e6,_0x4cae1c[_0x236d('0x42')]);return db[_0x236d('0x27')][_0x236d('0x43')](_0xf108e6)[_0x236d('0x23')](handleEntityNotFound(_0x44bd92,null))[_0x236d('0x23')](respondWithResult(_0x44bd92,null))[_0x236d('0x40')](handleError(_0x44bd92,null));};exports[_0x236d('0x44')]=function(_0x22a843,_0x32ab44){return db[_0x236d('0x27')][_0x236d('0x44')](_0x22a843['body'],{})[_0x236d('0x23')](respondWithResult(_0x32ab44,0xc9))[_0x236d('0x40')](handleError(_0x32ab44,null));};exports[_0x236d('0x45')]=function(_0x3b4c97,_0x4cc58f){if(_0x3b4c97[_0x236d('0x46')]['id']){delete _0x3b4c97[_0x236d('0x46')]['id'];}return db[_0x236d('0x27')]['find']({'where':{'id':_0x3b4c97[_0x236d('0x41')]['id']}})[_0x236d('0x23')](handleEntityNotFound(_0x4cc58f,null))['then'](saveUpdates(_0x3b4c97[_0x236d('0x46')],null))[_0x236d('0x23')](respondWithResult(_0x4cc58f,null))[_0x236d('0x40')](handleError(_0x4cc58f,null));};exports[_0x236d('0x47')]=function(_0x34fb44,_0x21c687){return db['SmsTransferReport']['find']({'where':{'id':_0x34fb44['params']['id']}})['then'](handleEntityNotFound(_0x21c687,null))['then'](removeEntity(_0x21c687,null))[_0x236d('0x40')](handleError(_0x21c687,null));};exports[_0x236d('0x48')]=function(_0x5d5799,_0x8f5205){return db['SmsTransferReport'][_0x236d('0x48')]()[_0x236d('0x23')](respondWithResult(_0x8f5205,null))[_0x236d('0x40')](handleError(_0x8f5205,null));}; \ No newline at end of file +var _0x3f15=['fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','catch','params','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','index','map','SmsTransferReport','rawAttributes'];(function(_0x33c888,_0x12cd0a){var _0x38c0b=function(_0x58f328){while(--_0x58f328){_0x33c888['push'](_0x33c888['shift']());}};_0x38c0b(++_0x12cd0a);}(_0x3f15,0xb1));var _0x53f1=function(_0x151160,_0x30993c){_0x151160=_0x151160-0x0;var _0x56b206=_0x3f15[_0x151160];return _0x56b206;};'use strict';var emlformat=require(_0x53f1('0x0'));var rimraf=require(_0x53f1('0x1'));var zipdir=require(_0x53f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x53f1('0x3'));var BPromise=require(_0x53f1('0x4'));var Mustache=require(_0x53f1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x53f1('0x6'));var csv=require(_0x53f1('0x7'));var ejs=require(_0x53f1('0x8'));var fs=require('fs');var fs_extra=require(_0x53f1('0x9'));var _=require('lodash');var squel=require(_0x53f1('0xa'));var crypto=require(_0x53f1('0xb'));var jsforce=require(_0x53f1('0xc'));var deskjs=require(_0x53f1('0xd'));var toCsv=require(_0x53f1('0x7'));var querystring=require(_0x53f1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x53f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x53f1('0x10'));var hardwareService=require(_0x53f1('0x11'));var logger=require(_0x53f1('0x12'))(_0x53f1('0x13'));var utils=require(_0x53f1('0x14'));var config=require(_0x53f1('0x15'));var licenseUtil=require(_0x53f1('0x16'));var db=require(_0x53f1('0x17'))['db'];function respondWithStatusCode(_0x26415d,_0x7cb77c){_0x7cb77c=_0x7cb77c||0xcc;return function(_0x394cc7){if(_0x394cc7){return _0x26415d[_0x53f1('0x18')](_0x7cb77c);}return _0x26415d[_0x53f1('0x19')](_0x7cb77c)[_0x53f1('0x1a')]();};}function respondWithResult(_0x1920cb,_0x1a88a0){_0x1a88a0=_0x1a88a0||0xc8;return function(_0x3be239){if(_0x3be239){return _0x1920cb['status'](_0x1a88a0)['json'](_0x3be239);}};}function respondWithFilteredResult(_0x807f67,_0x1ee04f){return function(_0x3d14a2){if(_0x3d14a2){var _0x2c8ff9=typeof _0x1ee04f['offset']===_0x53f1('0x1b')&&typeof _0x1ee04f[_0x53f1('0x1c')]===_0x53f1('0x1b');var _0x28a986=_0x3d14a2[_0x53f1('0x1d')];var _0x52d3e6=_0x2c8ff9?0x0:_0x1ee04f[_0x53f1('0x1e')];var _0x2d3a1a=_0x2c8ff9?_0x3d14a2[_0x53f1('0x1d')]:_0x1ee04f['offset']+_0x1ee04f['limit'];var _0x2035f4;if(_0x2d3a1a>=_0x28a986){_0x2d3a1a=_0x28a986;_0x2035f4=0xc8;}else{_0x2035f4=0xce;}_0x807f67[_0x53f1('0x19')](_0x2035f4);return _0x807f67[_0x53f1('0x1f')]('Content-Range',_0x52d3e6+'-'+_0x2d3a1a+'/'+_0x28a986)[_0x53f1('0x20')](_0x3d14a2);}return null;};}function patchUpdates(_0xf9a5f){return function(_0x108aba){try{jsonpatch[_0x53f1('0x21')](_0x108aba,_0xf9a5f,!![]);}catch(_0x1ceefe){return BPromise['reject'](_0x1ceefe);}return _0x108aba[_0x53f1('0x22')]();};}function saveUpdates(_0x4fcfe8,_0x5a0f6f){return function(_0x43e04f){if(_0x43e04f){return _0x43e04f[_0x53f1('0x23')](_0x4fcfe8)[_0x53f1('0x24')](function(_0x13915f){return _0x13915f;});}return null;};}function removeEntity(_0x164ed6,_0x1ec3c6){return function(_0x4f0118){if(_0x4f0118){return _0x4f0118['destroy']()['then'](function(){_0x164ed6[_0x53f1('0x19')](0xcc)[_0x53f1('0x1a')]();});}};}function handleEntityNotFound(_0x554ea8,_0x441a9e){return function(_0x415986){if(!_0x415986){_0x554ea8[_0x53f1('0x18')](0x194);}return _0x415986;};}function handleError(_0x469cb7,_0x4e06bf){_0x4e06bf=_0x4e06bf||0x1f4;return function(_0x298c67){logger[_0x53f1('0x25')](_0x298c67[_0x53f1('0x26')]);if(_0x298c67[_0x53f1('0x27')]){delete _0x298c67[_0x53f1('0x27')];}_0x469cb7[_0x53f1('0x19')](_0x4e06bf)[_0x53f1('0x28')](_0x298c67);};}exports[_0x53f1('0x29')]=function(_0x928694,_0x4d3060){var _0x546083={},_0x5d9ddc={},_0x49bd4a={'count':0x0,'rows':[]};var _0x4ac591=_[_0x53f1('0x2a')](db[_0x53f1('0x2b')][_0x53f1('0x2c')],function(_0x5a3280){return{'name':_0x5a3280[_0x53f1('0x2d')],'type':_0x5a3280[_0x53f1('0x2e')][_0x53f1('0x2f')]};});_0x5d9ddc[_0x53f1('0x30')]=_[_0x53f1('0x2a')](_0x4ac591,_0x53f1('0x27'));_0x5d9ddc[_0x53f1('0x31')]=_[_0x53f1('0x32')](_0x928694[_0x53f1('0x31')]);_0x5d9ddc[_0x53f1('0x33')]=_['intersection'](_0x5d9ddc[_0x53f1('0x30')],_0x5d9ddc['query']);_0x546083[_0x53f1('0x34')]=_[_0x53f1('0x35')](_0x5d9ddc[_0x53f1('0x30')],qs[_0x53f1('0x36')](_0x928694[_0x53f1('0x31')][_0x53f1('0x36')]));_0x546083[_0x53f1('0x34')]=_0x546083[_0x53f1('0x34')][_0x53f1('0x37')]?_0x546083[_0x53f1('0x34')]:_0x5d9ddc[_0x53f1('0x30')];if(!_0x928694[_0x53f1('0x31')][_0x53f1('0x38')](_0x53f1('0x39'))){_0x546083['limit']=qs['limit'](_0x928694[_0x53f1('0x31')][_0x53f1('0x1c')]);_0x546083[_0x53f1('0x1e')]=qs['offset'](_0x928694['query']['offset']);}_0x546083[_0x53f1('0x3a')]=qs[_0x53f1('0x3b')](_0x928694[_0x53f1('0x31')][_0x53f1('0x3b')]);_0x546083['where']=qs[_0x53f1('0x33')](_['pick'](_0x928694['query'],_0x5d9ddc['filters']),_0x4ac591);if(_0x928694[_0x53f1('0x31')][_0x53f1('0x3c')]){_0x546083[_0x53f1('0x3d')]=_[_0x53f1('0x3e')](_0x546083[_0x53f1('0x3d')],{'$or':_[_0x53f1('0x2a')](_0x4ac591,function(_0x5e35a2){if(_0x5e35a2[_0x53f1('0x2e')]!==_0x53f1('0x3f')){var _0x2494bf={};_0x2494bf[_0x5e35a2[_0x53f1('0x27')]]={'$like':'%'+_0x928694[_0x53f1('0x31')][_0x53f1('0x3c')]+'%'};return _0x2494bf;}})});}_0x546083=_[_0x53f1('0x3e')]({},_0x546083,_0x928694['options']);var _0x5a127e={'where':_0x546083['where']};return db[_0x53f1('0x2b')][_0x53f1('0x1d')](_0x5a127e)[_0x53f1('0x24')](function(_0xb3c7e5){_0x49bd4a[_0x53f1('0x1d')]=_0xb3c7e5;if(_0x928694[_0x53f1('0x31')][_0x53f1('0x40')]){_0x546083['include']=[{'all':!![]}];}return db[_0x53f1('0x2b')]['findAll'](_0x546083);})[_0x53f1('0x24')](function(_0x703347){_0x49bd4a['rows']=_0x703347;return _0x49bd4a;})['then'](respondWithFilteredResult(_0x4d3060,_0x546083))[_0x53f1('0x41')](handleError(_0x4d3060,null));};exports['show']=function(_0x118669,_0xeec34e){var _0x387888={'raw':!![],'where':{'id':_0x118669[_0x53f1('0x42')]['id']}},_0x5255bd={};_0x5255bd[_0x53f1('0x30')]=_['keys'](db[_0x53f1('0x2b')]['rawAttributes']);_0x5255bd['query']=_[_0x53f1('0x32')](_0x118669['query']);_0x5255bd[_0x53f1('0x33')]=_['intersection'](_0x5255bd[_0x53f1('0x30')],_0x5255bd[_0x53f1('0x31')]);_0x387888['attributes']=_[_0x53f1('0x35')](_0x5255bd[_0x53f1('0x30')],qs[_0x53f1('0x36')](_0x118669[_0x53f1('0x31')][_0x53f1('0x36')]));_0x387888[_0x53f1('0x34')]=_0x387888[_0x53f1('0x34')][_0x53f1('0x37')]?_0x387888[_0x53f1('0x34')]:_0x5255bd['model'];if(_0x118669[_0x53f1('0x31')][_0x53f1('0x40')]){_0x387888[_0x53f1('0x43')]=[{'all':!![]}];}_0x387888=_['merge']({},_0x387888,_0x118669[_0x53f1('0x44')]);return db[_0x53f1('0x2b')][_0x53f1('0x45')](_0x387888)['then'](handleEntityNotFound(_0xeec34e,null))['then'](respondWithResult(_0xeec34e,null))[_0x53f1('0x41')](handleError(_0xeec34e,null));};exports['create']=function(_0x5ecb2b,_0x547a48){return db[_0x53f1('0x2b')][_0x53f1('0x46')](_0x5ecb2b[_0x53f1('0x47')],{})[_0x53f1('0x24')](respondWithResult(_0x547a48,0xc9))[_0x53f1('0x41')](handleError(_0x547a48,null));};exports['update']=function(_0x28ca05,_0x43c47c){if(_0x28ca05[_0x53f1('0x47')]['id']){delete _0x28ca05[_0x53f1('0x47')]['id'];}return db[_0x53f1('0x2b')][_0x53f1('0x45')]({'where':{'id':_0x28ca05[_0x53f1('0x42')]['id']}})[_0x53f1('0x24')](handleEntityNotFound(_0x43c47c,null))[_0x53f1('0x24')](saveUpdates(_0x28ca05['body'],null))[_0x53f1('0x24')](respondWithResult(_0x43c47c,null))[_0x53f1('0x41')](handleError(_0x43c47c,null));};exports[_0x53f1('0x48')]=function(_0x128f8f,_0x4016d2){return db[_0x53f1('0x2b')][_0x53f1('0x45')]({'where':{'id':_0x128f8f[_0x53f1('0x42')]['id']}})[_0x53f1('0x24')](handleEntityNotFound(_0x4016d2,null))[_0x53f1('0x24')](removeEntity(_0x4016d2,null))['catch'](handleError(_0x4016d2,null));};exports[_0x53f1('0x49')]=function(_0x50f828,_0x2b87c6){return db['SmsTransferReport'][_0x53f1('0x49')]()[_0x53f1('0x24')](respondWithResult(_0x2b87c6,null))[_0x53f1('0x41')](handleError(_0x2b87c6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 9f0202c..810b97f 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 _0xb7a8=['report_sms_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x2401ee,_0x342ee6){var _0x51f7e1=function(_0x2990bc){while(--_0x2990bc){_0x2401ee['push'](_0x2401ee['shift']());}};_0x51f7e1(++_0x342ee6);}(_0xb7a8,0xec));var _0x8b7a=function(_0x780386,_0xb34541){_0x780386=_0x780386-0x0;var _0x4987a1=_0xb7a8[_0x780386];return _0x4987a1;};'use strict';var _=require('lodash');var util=require(_0x8b7a('0x0'));var logger=require(_0x8b7a('0x1'))('api');var moment=require(_0x8b7a('0x2'));var BPromise=require(_0x8b7a('0x3'));var rp=require(_0x8b7a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b7a('0x5'));var config=require(_0x8b7a('0x6'));var attributes=require(_0x8b7a('0x7'));module[_0x8b7a('0x8')]=function(_0x1d61f3,_0x42e4c1){return _0x1d61f3[_0x8b7a('0x9')](_0x8b7a('0xa'),attributes,{'tableName':_0x8b7a('0xb'),'paranoid':![],'indexes':[{'name':_0x8b7a('0xc'),'fields':[_0x8b7a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc992=['path','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x54b198,_0x49aecc){var _0x392d73=function(_0x14009b){while(--_0x14009b){_0x54b198['push'](_0x54b198['shift']());}};_0x392d73(++_0x49aecc);}(_0xc992,0xbb));var _0x2c99=function(_0x4c610c,_0x283f3c){_0x4c610c=_0x4c610c-0x0;var _0x3dc0b8=_0xc992[_0x4c610c];return _0x3dc0b8;};'use strict';var _=require(_0x2c99('0x0'));var util=require('util');var logger=require(_0x2c99('0x1'))(_0x2c99('0x2'));var moment=require('moment');var BPromise=require(_0x2c99('0x3'));var rp=require(_0x2c99('0x4'));var fs=require('fs');var path=require(_0x2c99('0x5'));var rimraf=require('rimraf');var config=require(_0x2c99('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x2c99('0x7')]=function(_0x44c15b,_0x299dd9){return _0x44c15b[_0x2c99('0x8')](_0x2c99('0x9'),attributes,{'tableName':_0x2c99('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2c99('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 e9ba684..dc1bf18 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 _0x4ce6=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x5d18e3,_0x59a263){var _0x548643=function(_0x5d9a06){while(--_0x5d9a06){_0x5d18e3['push'](_0x5d18e3['shift']());}};_0x548643(++_0x59a263);}(_0x4ce6,0x108));var _0x64ce=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x4ce6[_0x1b64dd];return _0xeb464c;};'use strict';var _=require(_0x64ce('0x0'));var util=require('util');var moment=require(_0x64ce('0x1'));var BPromise=require(_0x64ce('0x2'));var rs=require(_0x64ce('0x3'));var fs=require('fs');var Redis=require(_0x64ce('0x4'));var db=require(_0x64ce('0x5'))['db'];var utils=require(_0x64ce('0x6'));var logger=require('../../config/logger')(_0x64ce('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64ce('0x8')][_0x64ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b8f2d,_0x538b74,_0x3c279f){return new BPromise(function(_0x134230,_0x1b253e){return client[_0x64ce('0xa')](_0x5b8f2d,_0x3c279f)[_0x64ce('0xb')](function(_0x135482){logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));logger['debug'](_0x64ce('0xf'),_0x538b74,_0x64ce('0xe'),JSON[_0x64ce('0x10')](_0x135482));if(_0x135482[_0x64ce('0x11')]){if(_0x135482[_0x64ce('0x11')][_0x64ce('0x12')]===0x1f4){logger[_0x64ce('0x11')](_0x64ce('0xd'),_0x538b74,_0x135482['error'][_0x64ce('0x13')]);return _0x1b253e(_0x135482['error']['message']);}logger[_0x64ce('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x538b74,_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);return _0x134230(_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);}else{logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));_0x134230(_0x135482[_0x64ce('0x14')][_0x64ce('0x13')]);}})['catch'](function(_0x4b49be){logger['error'](_0x64ce('0xd'),_0x538b74,_0x4b49be);_0x1b253e(_0x4b49be);});});} \ No newline at end of file +var _0x972c=['../../config/environment','jayson/promise','http','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x67f7cf,_0x3d5e30){var _0x2d5472=function(_0x51939c){while(--_0x51939c){_0x67f7cf['push'](_0x67f7cf['shift']());}};_0x2d5472(++_0x3d5e30);}(_0x972c,0xf2));var _0xc972=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0x972c[_0x581249];return _0x284bae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc972('0x0'));var BPromise=require(_0xc972('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc972('0x2'));var db=require(_0xc972('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc972('0x4'));var config=require(_0xc972('0x5'));var jayson=require(_0xc972('0x6'));var client=jayson['client'][_0xc972('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4cff66,_0x1c1a16,_0xd8cd25){return new BPromise(function(_0x304d08,_0x5ef7c4){return client['request'](_0x4cff66,_0xd8cd25)['then'](function(_0xa1400f){logger['info'](_0xc972('0x8'),_0x1c1a16,_0xc972('0x9'));logger[_0xc972('0xa')](_0xc972('0xb'),_0x1c1a16,_0xc972('0x9'),JSON[_0xc972('0xc')](_0xa1400f));if(_0xa1400f[_0xc972('0xd')]){if(_0xa1400f['error'][_0xc972('0xe')]===0x1f4){logger[_0xc972('0xd')](_0xc972('0x8'),_0x1c1a16,_0xa1400f['error'][_0xc972('0xf')]);return _0x5ef7c4(_0xa1400f[_0xc972('0xd')][_0xc972('0xf')]);}logger['error'](_0xc972('0x8'),_0x1c1a16,_0xa1400f[_0xc972('0xd')][_0xc972('0xf')]);return _0x304d08(_0xa1400f[_0xc972('0xd')]['message']);}else{logger[_0xc972('0x10')](_0xc972('0x8'),_0x1c1a16,_0xc972('0x9'));_0x304d08(_0xa1400f[_0xc972('0x11')][_0xc972('0xf')]);}})[_0xc972('0x12')](function(_0x1e3389){logger[_0xc972('0xd')](_0xc972('0x8'),_0x1c1a16,_0x1e3389);_0x5ef7c4(_0x1e3389);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index ef0d2e0..7d0118a 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 _0xf1cd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','util','connect-timeout','Router'];(function(_0x1c5cd2,_0x277ceb){var _0x895e35=function(_0x4b4307){while(--_0x4b4307){_0x1c5cd2['push'](_0x1c5cd2['shift']());}};_0x895e35(++_0x277ceb);}(_0xf1cd,0xdc));var _0xdf1c=function(_0x1d3f4e,_0x1b7cbb){_0x1d3f4e=_0x1d3f4e-0x0;var _0x36105b=_0xf1cd[_0x1d3f4e];return _0x36105b;};'use strict';var multer=require(_0xdf1c('0x0'));var util=require(_0xdf1c('0x1'));var path=require('path');var timeout=require(_0xdf1c('0x2'));var express=require('express');var router=express[_0xdf1c('0x3')]();var fs_extra=require(_0xdf1c('0x4'));var auth=require(_0xdf1c('0x5'));var interaction=require(_0xdf1c('0x6'));var config=require(_0xdf1c('0x7'));var controller=require(_0xdf1c('0x8'));router[_0xdf1c('0x9')]('/',auth[_0xdf1c('0xa')](),controller[_0xdf1c('0xb')]);router[_0xdf1c('0x9')](_0xdf1c('0xc'),auth[_0xdf1c('0xa')](),controller['show']);router['get'](_0xdf1c('0xd'),auth[_0xdf1c('0xa')](),controller[_0xdf1c('0xe')]);var upload=multer({'storage':multer[_0xdf1c('0xf')]({'destination':function(_0x24b696,_0xb31119,_0x3f6475){_0x3f6475(null,path['join'](config['root'],_0xdf1c('0x10')));},'filename':function(_0x41d5fd,_0x35bedc,_0x1078b8){_0x35bedc[_0xdf1c('0x11')]=_0x35bedc[_0xdf1c('0x11')][_0xdf1c('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1078b8(null,util[_0xdf1c('0x13')](_0xdf1c('0x14'),path[_0xdf1c('0x15')](_0x35bedc[_0xdf1c('0x11')],path[_0xdf1c('0x16')](_0x35bedc[_0xdf1c('0x11')])),Date[_0xdf1c('0x17')](),path[_0xdf1c('0x16')](_0x35bedc['originalname'])));}})});router[_0xdf1c('0x18')]('/',upload[_0xdf1c('0x19')](_0xdf1c('0x1a')),controller[_0xdf1c('0x1b')]);router[_0xdf1c('0x1c')]('/:id',auth[_0xdf1c('0xa')](),controller[_0xdf1c('0x1d')]);router[_0xdf1c('0x1e')](_0xdf1c('0xc'),auth[_0xdf1c('0xa')](),controller[_0xdf1c('0x1e')]);module[_0xdf1c('0x1f')]=router; \ No newline at end of file +var _0x972b=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','file','create','put','delete'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0x972b,0x75));var _0xb972=function(_0x3c8843,_0xeb83f5){_0x3c8843=_0x3c8843-0x0;var _0x1db153=_0x972b[_0x3c8843];return _0x1db153;};'use strict';var multer=require(_0xb972('0x0'));var util=require(_0xb972('0x1'));var path=require(_0xb972('0x2'));var timeout=require(_0xb972('0x3'));var express=require(_0xb972('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb972('0x5'));var config=require(_0xb972('0x6'));var controller=require('./sound.controller');router[_0xb972('0x7')]('/',auth[_0xb972('0x8')](),controller[_0xb972('0x9')]);router[_0xb972('0x7')](_0xb972('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb972('0xb'),auth[_0xb972('0x8')](),controller[_0xb972('0xc')]);var upload=multer({'storage':multer[_0xb972('0xd')]({'destination':function(_0x1aa134,_0x34a088,_0x432c21){_0x432c21(null,path[_0xb972('0xe')](config[_0xb972('0xf')],_0xb972('0x10')));},'filename':function(_0x5cc983,_0x1b767c,_0x18f30b){_0x1b767c[_0xb972('0x11')]=_0x1b767c['originalname'][_0xb972('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x18f30b(null,util['format'](_0xb972('0x13'),path[_0xb972('0x14')](_0x1b767c['originalname'],path[_0xb972('0x15')](_0x1b767c[_0xb972('0x11')])),Date[_0xb972('0x16')](),path[_0xb972('0x15')](_0x1b767c[_0xb972('0x11')])));}})});router[_0xb972('0x17')]('/',upload['single'](_0xb972('0x18')),controller[_0xb972('0x19')]);router[_0xb972('0x1a')](_0xb972('0xa'),auth[_0xb972('0x8')](),controller['update']);router[_0xb972('0x1b')](_0xb972('0xa'),auth[_0xb972('0x8')](),controller['delete']);module[_0xb972('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 42f0a5a..ccd2a34 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 _0x6642=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x644560,_0x1783aa){var _0x41b76b=function(_0xff8c89){while(--_0xff8c89){_0x644560['push'](_0x644560['shift']());}};_0x41b76b(++_0x1783aa);}(_0x6642,0x105));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2664('0x0'));module[_0x2664('0x1')]={'name':{'type':Sequelize[_0x2664('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x2664('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x2664('0x2')]},'original_duration':{'type':Sequelize[_0x2664('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x2664('0x4')]},'original_sampleRate':{'type':Sequelize[_0x2664('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x2664('0x4')]},'converted_channelCount':{'type':Sequelize[_0x2664('0x5')]},'converted_bitRate':{'type':Sequelize[_0x2664('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x2664('0x5')]}}; \ No newline at end of file +var _0x72e3=['BIGINT','INTEGER','sequelize','exports','STRING','FLOAT'];(function(_0x484fa2,_0x30b97e){var _0x279028=function(_0x13c70d){while(--_0x13c70d){_0x484fa2['push'](_0x484fa2['shift']());}};_0x279028(++_0x30b97e);}(_0x72e3,0x134));var _0x372e=function(_0x4ecfce,_0x31a0bc){_0x4ecfce=_0x4ecfce-0x0;var _0x55d245=_0x72e3[_0x4ecfce];return _0x55d245;};'use strict';var Sequelize=require(_0x372e('0x0'));module[_0x372e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x372e('0x2')]},'display_name':{'type':Sequelize[_0x372e('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x372e('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x372e('0x3')]},'original_sampleCount':{'type':Sequelize[_0x372e('0x4')]},'original_channelCount':{'type':Sequelize[_0x372e('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x372e('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x372e('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x372e('0x5')]},'converted_bitRate':{'type':Sequelize[_0x372e('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x372e('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ff16791..7b352b8 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 _0x7116=['duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','role','body','user','userProfileId','error','start','description','original_format','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','get','Sounds','UserProfileResource','then','stack','name','send','index','map','Sound','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','extname','filename','wav','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration'];(function(_0x546dd2,_0x2d5991){var _0x265106=function(_0x5bab94){while(--_0x5bab94){_0x546dd2['push'](_0x546dd2['shift']());}};_0x265106(++_0x2d5991);}(_0x7116,0x88));var _0x6711=function(_0x508b77,_0x5de944){_0x508b77=_0x508b77-0x0;var _0x440bd=_0x7116[_0x508b77];return _0x440bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6711('0x0'));var jsonpatch=require(_0x6711('0x1'));var rp=require(_0x6711('0x2'));var moment=require('moment');var BPromise=require(_0x6711('0x3'));var Mustache=require(_0x6711('0x4'));var util=require('util');var path=require(_0x6711('0x5'));var sox=require(_0x6711('0x6'));var csv=require(_0x6711('0x7'));var ejs=require(_0x6711('0x8'));var fs=require('fs');var fs_extra=require(_0x6711('0x9'));var _=require(_0x6711('0xa'));var squel=require(_0x6711('0xb'));var crypto=require(_0x6711('0xc'));var jsforce=require(_0x6711('0xd'));var deskjs=require(_0x6711('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6711('0xf'));var Papa=require(_0x6711('0x10'));var Redis=require(_0x6711('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6711('0x12'));var utils=require(_0x6711('0x13'));var config=require(_0x6711('0x14'));var licenseUtil=require(_0x6711('0x15'));var db=require(_0x6711('0x16'))['db'];function respondWithStatusCode(_0x291904,_0x35ab1f){_0x35ab1f=_0x35ab1f||0xcc;return function(_0x5b1abf){if(_0x5b1abf){return _0x291904[_0x6711('0x17')](_0x35ab1f);}return _0x291904[_0x6711('0x18')](_0x35ab1f)[_0x6711('0x19')]();};}function respondWithResult(_0x42a582,_0x44947b){_0x44947b=_0x44947b||0xc8;return function(_0xc7172c){if(_0xc7172c){return _0x42a582[_0x6711('0x18')](_0x44947b)[_0x6711('0x1a')](_0xc7172c);}};}function respondWithFilteredResult(_0x357601,_0x4395f7){return function(_0x5424d0){if(_0x5424d0){var _0x2a0012=typeof _0x4395f7[_0x6711('0x1b')]===_0x6711('0x1c')&&typeof _0x4395f7['limit']===_0x6711('0x1c');var _0x44c113=_0x5424d0[_0x6711('0x1d')];var _0x53db67=_0x2a0012?0x0:_0x4395f7['offset'];var _0x275990=_0x2a0012?_0x5424d0[_0x6711('0x1d')]:_0x4395f7[_0x6711('0x1b')]+_0x4395f7[_0x6711('0x1e')];var _0x5b804d;if(_0x275990>=_0x44c113){_0x275990=_0x44c113;_0x5b804d=0xc8;}else{_0x5b804d=0xce;}_0x357601[_0x6711('0x18')](_0x5b804d);return _0x357601[_0x6711('0x1f')](_0x6711('0x20'),_0x53db67+'-'+_0x275990+'/'+_0x44c113)[_0x6711('0x1a')](_0x5424d0);}return null;};}function patchUpdates(_0x83af5d){return function(_0x1bd47d){try{jsonpatch['apply'](_0x1bd47d,_0x83af5d,!![]);}catch(_0x81f9c2){return BPromise['reject'](_0x81f9c2);}return _0x1bd47d[_0x6711('0x21')]();};}function saveUpdates(_0x3f5d4c,_0x5e82cd){return function(_0x2b8c87){if(_0x2b8c87){return _0x2b8c87[_0x6711('0x22')](_0x3f5d4c)['then'](function(_0x5e50c6){return _0x5e50c6;});}return null;};}function removeEntity(_0x25a0cd,_0x3f7cda){return function(_0x22c116){if(_0x22c116){return _0x22c116[_0x6711('0x23')]()['then'](function(){var _0x8925a4=_0x22c116[_0x6711('0x24')]({'plain':!![]});var _0x37e26d=_0x6711('0x25');return db[_0x6711('0x26')][_0x6711('0x23')]({'where':{'type':_0x37e26d,'resourceId':_0x8925a4['id']}})[_0x6711('0x27')](function(){return _0x22c116;});})[_0x6711('0x27')](function(){_0x25a0cd[_0x6711('0x18')](0xcc)[_0x6711('0x19')]();});}};}function handleEntityNotFound(_0x22d1d7,_0x3c9b41){return function(_0x5b62e4){if(!_0x5b62e4){_0x22d1d7['sendStatus'](0x194);}return _0x5b62e4;};}function handleError(_0x32eef0,_0x2c2ea1){_0x2c2ea1=_0x2c2ea1||0x1f4;return function(_0x2be1b8){logger['error'](_0x2be1b8[_0x6711('0x28')]);if(_0x2be1b8['name']){delete _0x2be1b8[_0x6711('0x29')];}_0x32eef0['status'](_0x2c2ea1)[_0x6711('0x2a')](_0x2be1b8);};}exports[_0x6711('0x2b')]=function(_0x4c9228,_0x4dd2fe){var _0x13d919={},_0xd1987={},_0x33be3f={'count':0x0,'rows':[]};var _0xa95b92=_[_0x6711('0x2c')](db[_0x6711('0x2d')]['rawAttributes'],function(_0x333daa){return{'name':_0x333daa['fieldName'],'type':_0x333daa[_0x6711('0x2e')][_0x6711('0x2f')]};});_0xd1987[_0x6711('0x30')]=_[_0x6711('0x2c')](_0xa95b92,_0x6711('0x29'));_0xd1987[_0x6711('0x31')]=_[_0x6711('0x32')](_0x4c9228['query']);_0xd1987[_0x6711('0x33')]=_[_0x6711('0x34')](_0xd1987['model'],_0xd1987['query']);_0x13d919[_0x6711('0x35')]=_[_0x6711('0x34')](_0xd1987[_0x6711('0x30')],qs[_0x6711('0x36')](_0x4c9228[_0x6711('0x31')][_0x6711('0x36')]));_0x13d919[_0x6711('0x35')]=_0x13d919[_0x6711('0x35')]['length']?_0x13d919['attributes']:_0xd1987[_0x6711('0x30')];if(!_0x4c9228[_0x6711('0x31')][_0x6711('0x37')](_0x6711('0x38'))){_0x13d919['limit']=qs[_0x6711('0x1e')](_0x4c9228[_0x6711('0x31')][_0x6711('0x1e')]);_0x13d919[_0x6711('0x1b')]=qs[_0x6711('0x1b')](_0x4c9228[_0x6711('0x31')][_0x6711('0x1b')]);}_0x13d919['order']=qs[_0x6711('0x39')](_0x4c9228[_0x6711('0x31')][_0x6711('0x39')]);_0x13d919[_0x6711('0x3a')]=qs[_0x6711('0x33')](_[_0x6711('0x3b')](_0x4c9228[_0x6711('0x31')],_0xd1987['filters']),_0xa95b92);if(_0x4c9228[_0x6711('0x31')][_0x6711('0x3c')]){_0x13d919['where']=_['merge'](_0x13d919[_0x6711('0x3a')],{'$or':_[_0x6711('0x2c')](_0xa95b92,function(_0x201a35){if(_0x201a35[_0x6711('0x2e')]!==_0x6711('0x3d')){var _0x23b338={};_0x23b338[_0x201a35['name']]={'$like':'%'+_0x4c9228[_0x6711('0x31')][_0x6711('0x3c')]+'%'};return _0x23b338;}})});}_0x13d919=_[_0x6711('0x3e')]({},_0x13d919,_0x4c9228[_0x6711('0x3f')]);var _0x402744={'where':_0x13d919[_0x6711('0x3a')]};return db[_0x6711('0x2d')]['count'](_0x402744)[_0x6711('0x27')](function(_0x25eb72){_0x33be3f['count']=_0x25eb72;if(_0x4c9228['query'][_0x6711('0x40')]){_0x13d919[_0x6711('0x41')]=[{'all':!![]}];}return db[_0x6711('0x2d')][_0x6711('0x42')](_0x13d919);})[_0x6711('0x27')](function(_0x41b5b3){_0x33be3f['rows']=_0x41b5b3;return _0x33be3f;})[_0x6711('0x27')](respondWithFilteredResult(_0x4dd2fe,_0x13d919))[_0x6711('0x43')](handleError(_0x4dd2fe,null));};exports['show']=function(_0xafb64a,_0x23180a){var _0x3541d9={'raw':!![],'where':{'id':_0xafb64a[_0x6711('0x44')]['id']}},_0x624372={};_0x624372[_0x6711('0x30')]=_[_0x6711('0x32')](db[_0x6711('0x2d')]['rawAttributes']);_0x624372['query']=_['keys'](_0xafb64a[_0x6711('0x31')]);_0x624372[_0x6711('0x33')]=_[_0x6711('0x34')](_0x624372[_0x6711('0x30')],_0x624372[_0x6711('0x31')]);_0x3541d9[_0x6711('0x35')]=_[_0x6711('0x34')](_0x624372[_0x6711('0x30')],qs[_0x6711('0x36')](_0xafb64a['query'][_0x6711('0x36')]));_0x3541d9[_0x6711('0x35')]=_0x3541d9[_0x6711('0x35')]['length']?_0x3541d9['attributes']:_0x624372[_0x6711('0x30')];if(_0xafb64a[_0x6711('0x31')][_0x6711('0x40')]){_0x3541d9[_0x6711('0x41')]=[{'all':!![]}];}_0x3541d9=_['merge']({},_0x3541d9,_0xafb64a[_0x6711('0x3f')]);return db[_0x6711('0x2d')][_0x6711('0x45')](_0x3541d9)[_0x6711('0x27')](handleEntityNotFound(_0x23180a,null))['then'](respondWithResult(_0x23180a,null))[_0x6711('0x43')](handleError(_0x23180a,null));};exports['download']=function(_0x1c0100,_0x4ce91b,_0x5426f6){return db[_0x6711('0x2d')][_0x6711('0x45')]({'where':{'id':_0x1c0100[_0x6711('0x44')]['id']},'attributes':['name',_0x6711('0x46'),_0x6711('0x47')],'raw':!![]})[_0x6711('0x27')](handleEntityNotFound(_0x4ce91b,null))['then'](function(_0x13b29e){if(_0x13b29e){if(!fs[_0x6711('0x48')](path[_0x6711('0x49')](config[_0x6711('0x4a')],_0x6711('0x4b'),_0x13b29e[_0x6711('0x46')]+'.'+_0x13b29e[_0x6711('0x47')]))){throw new db[(_0x6711('0x4c'))][(_0x6711('0x4d'))](_0x6711('0x4e'));}return _0x4ce91b[_0x6711('0x4f')](path[_0x6711('0x49')](config[_0x6711('0x4a')],_0x6711('0x4b'),util[_0x6711('0x50')](_0x6711('0x51'),_0x13b29e['save_name'],_0x13b29e[_0x6711('0x47')])),util[_0x6711('0x50')]('%s.%s',_0x13b29e['name'],_0x13b29e['converted_format']));}return null;})[_0x6711('0x43')](handleError(_0x4ce91b,null));};exports[_0x6711('0x52')]=function(_0x30841f,_0x1fc2f5,_0x5a7d23){var _0x344665={'name':path[_0x6711('0x53')](_0x30841f[_0x6711('0x54')][_0x6711('0x55')],path[_0x6711('0x56')](_0x30841f[_0x6711('0x54')][_0x6711('0x55')])),'save_name':path[_0x6711('0x53')](_0x30841f['file'][_0x6711('0x57')],path[_0x6711('0x56')](_0x30841f[_0x6711('0x54')][_0x6711('0x57')])),'original_format':path['extname'](_0x30841f['file'][_0x6711('0x55')])['substring'](0x1),'converted_format':_0x6711('0x58')};var _0x58e8f0=path[_0x6711('0x49')](config[_0x6711('0x4a')],'server/files/sounds/original',_0x30841f[_0x6711('0x54')][_0x6711('0x57')]);var _0x10abdd=path[_0x6711('0x49')](config[_0x6711('0x4a')],_0x6711('0x4b'),util[_0x6711('0x50')]('%s.%s',path[_0x6711('0x53')](_0x30841f[_0x6711('0x54')][_0x6711('0x57')],path['extname'](_0x30841f['file'][_0x6711('0x57')])),_0x344665['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x58e8f0);logger[_0x6711('0x59')](_0x6711('0x5a'),_0x10abdd);try{fs[_0x6711('0x5b')](_0x58e8f0,parseInt(_0x6711('0x5c'),0x8));var _0x2ae852=sox[_0x6711('0x5d')](_0x58e8f0,_0x10abdd,{'sampleRate':0x1f40,'format':_0x6711('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ae852['on']('error',function(_0x1f1302){fs[_0x6711('0x5e')](_0x58e8f0);_0x1fc2f5['status'](0x1f4)[_0x6711('0x2a')](_0x1f1302);});_0x2ae852['on']('src',function(_0xf4baf8){_0x344665[_0x6711('0x5f')]=isNaN(_0xf4baf8[_0x6711('0x60')])?null:_0xf4baf8[_0x6711('0x60')]*0x3e8;_0x344665[_0x6711('0x61')]=isNaN(_0xf4baf8['sampleCount'])?null:_0xf4baf8[_0x6711('0x62')];_0x344665[_0x6711('0x63')]=isNaN(_0xf4baf8[_0x6711('0x64')])?null:_0xf4baf8[_0x6711('0x64')];_0x344665[_0x6711('0x65')]=isNaN(_0xf4baf8[_0x6711('0x66')])?null:_0xf4baf8['bitRate'];_0x344665[_0x6711('0x67')]=isNaN(_0xf4baf8[_0x6711('0x68')])?null:_0xf4baf8[_0x6711('0x68')];});_0x2ae852['on']('dest',function(_0x2c516d){_0x344665[_0x6711('0x69')]=isNaN(_0x2c516d[_0x6711('0x60')])?null:_0x2c516d['duration']*0x3e8;_0x344665[_0x6711('0x6a')]=isNaN(_0x2c516d[_0x6711('0x62')])?null:_0x2c516d[_0x6711('0x62')];_0x344665['converted_channelCount']=isNaN(_0x2c516d[_0x6711('0x64')])?null:_0x2c516d['channelCount'];_0x344665[_0x6711('0x6b')]=isNaN(_0x2c516d[_0x6711('0x66')])?null:_0x2c516d[_0x6711('0x66')];_0x344665['converted_sampleRate']=isNaN(_0x2c516d[_0x6711('0x68')])?null:_0x2c516d[_0x6711('0x68')];});_0x2ae852['on'](_0x6711('0x19'),function(){fs[_0x6711('0x5b')](_0x10abdd,parseInt('0777',0x8));return db[_0x6711('0x2d')][_0x6711('0x52')](_0x344665)[_0x6711('0x27')](function(_0xd5f22d){var _0x4d8235={'role':_0x30841f['body'][_0x6711('0x6c')],'userProfileId':_0x30841f[_0x6711('0x6d')]['userProfileId']};if(!_0x4d8235)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d8235[_0x6711('0x6c')]===_0x6711('0x6e')){var _0x407c64=_0xd5f22d[_0x6711('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x6711('0x45')]({'where':{'name':_0x6711('0x25'),'userProfileId':_0x4d8235[_0x6711('0x6f')]},'raw':!![]})[_0x6711('0x27')](function(_0x32e2b6){if(_0x32e2b6&&_0x32e2b6['autoAssociation']===0x0){return db['UserProfileResource'][_0x6711('0x52')]({'name':_0x407c64[_0x6711('0x29')],'resourceId':_0x407c64['id'],'type':_0x32e2b6['name'],'sectionId':_0x32e2b6['id']},{})[_0x6711('0x27')](function(){return _0xd5f22d;});}else{return _0xd5f22d;}})[_0x6711('0x43')](function(_0x1940bd){logger[_0x6711('0x70')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1940bd);throw _0x1940bd;});}return _0xd5f22d;})[_0x6711('0x27')](respondWithResult(_0x1fc2f5,null))[_0x6711('0x43')](handleError(_0x1fc2f5,null));});_0x2ae852[_0x6711('0x71')]();}catch(_0x5b9c3a){_0x1fc2f5[_0x6711('0x18')](0x1f4)[_0x6711('0x2a')](_0x5b9c3a);}};exports[_0x6711('0x22')]=function(_0x5d99a8,_0x3cf8e0,_0xd93399){return db[_0x6711('0x2d')][_0x6711('0x45')]({'where':{'id':_0x5d99a8[_0x6711('0x44')]['id']}})[_0x6711('0x27')](handleEntityNotFound(_0x3cf8e0,null))['then'](saveUpdates(_[_0x6711('0x3b')](_0x5d99a8[_0x6711('0x6d')],[_0x6711('0x29'),_0x6711('0x72')]),null))['then'](respondWithResult(_0x3cf8e0,null))[_0x6711('0x43')](handleError(_0x3cf8e0,null));};exports['delete']=function(_0xc6ffea,_0x45449c,_0x15f14c){return db[_0x6711('0x2d')][_0x6711('0x45')]({'where':{'id':_0xc6ffea['params']['id']}})[_0x6711('0x27')](function(_0x140567){if(_0x140567){return _0x140567[_0x6711('0x23')]();}})[_0x6711('0x27')](function(_0x1b4ac0){var _0x3cb90d=path[_0x6711('0x49')](config[_0x6711('0x4a')],'server/files/sounds/original',util[_0x6711('0x50')]('%s.%s',_0x1b4ac0[_0x6711('0x46')],_0x1b4ac0[_0x6711('0x73')]));var _0x37151e=path[_0x6711('0x49')](config[_0x6711('0x4a')],_0x6711('0x4b'),util[_0x6711('0x50')]('%s.%s',_0x1b4ac0['save_name'],_0x1b4ac0[_0x6711('0x47')]));fs[_0x6711('0x5e')](_0x3cb90d);fs[_0x6711('0x5e')](_0x37151e);return _0x1b4ac0;})[_0x6711('0x27')](function(_0x19c5c8){if(_0x19c5c8){return _0x45449c['status'](0xcc)[_0x6711('0x19')]();}})['then'](handleEntityNotFound(_0x45449c,null))[_0x6711('0x43')](handleError(_0x45449c,null));}; \ No newline at end of file +var _0x2ff8=['role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','Sounds','UserProfileResource','destroy','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','length','options','find','download','converted_format','existsSync','join','root','ValidationError','server/files/sounds/converted','format','%s.%s','save_name','basename','file','originalname','extname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','create','body'];(function(_0x5b6d34,_0x2a32a0){var _0x65eb46=function(_0x2fed53){while(--_0x2fed53){_0x5b6d34['push'](_0x5b6d34['shift']());}};_0x65eb46(++_0x2a32a0);}(_0x2ff8,0x88));var _0x82ff=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x2ff8[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0x82ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x82ff('0x1'));var jsonpatch=require(_0x82ff('0x2'));var rp=require('request-promise');var moment=require(_0x82ff('0x3'));var BPromise=require(_0x82ff('0x4'));var Mustache=require(_0x82ff('0x5'));var util=require(_0x82ff('0x6'));var path=require(_0x82ff('0x7'));var sox=require(_0x82ff('0x8'));var csv=require(_0x82ff('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82ff('0xa'));var _=require(_0x82ff('0xb'));var squel=require(_0x82ff('0xc'));var crypto=require(_0x82ff('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x82ff('0x9'));var querystring=require(_0x82ff('0xe'));var Papa=require(_0x82ff('0xf'));var Redis=require(_0x82ff('0x10'));var authService=require(_0x82ff('0x11'));var qs=require(_0x82ff('0x12'));var as=require(_0x82ff('0x13'));var hardwareService=require(_0x82ff('0x14'));var logger=require(_0x82ff('0x15'))('api');var utils=require(_0x82ff('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x82ff('0x17'))['db'];function respondWithStatusCode(_0x5d5966,_0x37f1dc){_0x37f1dc=_0x37f1dc||0xcc;return function(_0x93c1c6){if(_0x93c1c6){return _0x5d5966[_0x82ff('0x18')](_0x37f1dc);}return _0x5d5966[_0x82ff('0x19')](_0x37f1dc)[_0x82ff('0x1a')]();};}function respondWithResult(_0x46fb1a,_0x37f9cf){_0x37f9cf=_0x37f9cf||0xc8;return function(_0x2c1c4e){if(_0x2c1c4e){return _0x46fb1a['status'](_0x37f9cf)[_0x82ff('0x1b')](_0x2c1c4e);}};}function respondWithFilteredResult(_0x59135e,_0x121c5a){return function(_0x42afa3){if(_0x42afa3){var _0x27af01=typeof _0x121c5a[_0x82ff('0x1c')]===_0x82ff('0x1d')&&typeof _0x121c5a[_0x82ff('0x1e')]===_0x82ff('0x1d');var _0x5659a0=_0x42afa3[_0x82ff('0x1f')];var _0x97c74d=_0x27af01?0x0:_0x121c5a[_0x82ff('0x1c')];var _0x2790bf=_0x27af01?_0x42afa3[_0x82ff('0x1f')]:_0x121c5a[_0x82ff('0x1c')]+_0x121c5a[_0x82ff('0x1e')];var _0x46e443;if(_0x2790bf>=_0x5659a0){_0x2790bf=_0x5659a0;_0x46e443=0xc8;}else{_0x46e443=0xce;}_0x59135e[_0x82ff('0x19')](_0x46e443);return _0x59135e[_0x82ff('0x20')](_0x82ff('0x21'),_0x97c74d+'-'+_0x2790bf+'/'+_0x5659a0)['json'](_0x42afa3);}return null;};}function patchUpdates(_0x24b798){return function(_0xe03e08){try{jsonpatch[_0x82ff('0x22')](_0xe03e08,_0x24b798,!![]);}catch(_0x2cad6b){return BPromise[_0x82ff('0x23')](_0x2cad6b);}return _0xe03e08[_0x82ff('0x24')]();};}function saveUpdates(_0x3f5e7a,_0x271b55){return function(_0x50fa82){if(_0x50fa82){return _0x50fa82[_0x82ff('0x25')](_0x3f5e7a)[_0x82ff('0x26')](function(_0x52f6f1){return _0x52f6f1;});}return null;};}function removeEntity(_0x5894cd,_0x213a07){return function(_0x182065){if(_0x182065){return _0x182065['destroy']()[_0x82ff('0x26')](function(){var _0x39b46d=_0x182065['get']({'plain':!![]});var _0x3de96c=_0x82ff('0x27');return db[_0x82ff('0x28')][_0x82ff('0x29')]({'where':{'type':_0x3de96c,'resourceId':_0x39b46d['id']}})['then'](function(){return _0x182065;});})[_0x82ff('0x26')](function(){_0x5894cd[_0x82ff('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f8c15,_0x14428a){return function(_0x3ef00d){if(!_0x3ef00d){_0x4f8c15[_0x82ff('0x18')](0x194);}return _0x3ef00d;};}function handleError(_0x1363d2,_0x1eb512){_0x1eb512=_0x1eb512||0x1f4;return function(_0x9e3c2a){logger[_0x82ff('0x2a')](_0x9e3c2a[_0x82ff('0x2b')]);if(_0x9e3c2a[_0x82ff('0x2c')]){delete _0x9e3c2a[_0x82ff('0x2c')];}_0x1363d2[_0x82ff('0x19')](_0x1eb512)[_0x82ff('0x2d')](_0x9e3c2a);};}exports[_0x82ff('0x2e')]=function(_0x1200c2,_0x4c8e65){var _0x5287bb={},_0xf7e61d={},_0x5e5009={'count':0x0,'rows':[]};var _0x346c39=_[_0x82ff('0x2f')](db[_0x82ff('0x30')][_0x82ff('0x31')],function(_0x2dde13){return{'name':_0x2dde13[_0x82ff('0x32')],'type':_0x2dde13['type'][_0x82ff('0x33')]};});_0xf7e61d[_0x82ff('0x34')]=_[_0x82ff('0x2f')](_0x346c39,_0x82ff('0x2c'));_0xf7e61d[_0x82ff('0x35')]=_[_0x82ff('0x36')](_0x1200c2[_0x82ff('0x35')]);_0xf7e61d[_0x82ff('0x37')]=_[_0x82ff('0x38')](_0xf7e61d[_0x82ff('0x34')],_0xf7e61d[_0x82ff('0x35')]);_0x5287bb[_0x82ff('0x39')]=_[_0x82ff('0x38')](_0xf7e61d['model'],qs[_0x82ff('0x3a')](_0x1200c2[_0x82ff('0x35')][_0x82ff('0x3a')]));_0x5287bb['attributes']=_0x5287bb[_0x82ff('0x39')]['length']?_0x5287bb[_0x82ff('0x39')]:_0xf7e61d['model'];if(!_0x1200c2[_0x82ff('0x35')][_0x82ff('0x3b')](_0x82ff('0x3c'))){_0x5287bb['limit']=qs['limit'](_0x1200c2[_0x82ff('0x35')][_0x82ff('0x1e')]);_0x5287bb['offset']=qs[_0x82ff('0x1c')](_0x1200c2[_0x82ff('0x35')][_0x82ff('0x1c')]);}_0x5287bb[_0x82ff('0x3d')]=qs[_0x82ff('0x3e')](_0x1200c2[_0x82ff('0x35')]['sort']);_0x5287bb[_0x82ff('0x3f')]=qs[_0x82ff('0x37')](_[_0x82ff('0x40')](_0x1200c2[_0x82ff('0x35')],_0xf7e61d[_0x82ff('0x37')]),_0x346c39);if(_0x1200c2['query'][_0x82ff('0x41')]){_0x5287bb['where']=_[_0x82ff('0x42')](_0x5287bb[_0x82ff('0x3f')],{'$or':_['map'](_0x346c39,function(_0xca5a20){if(_0xca5a20['type']!==_0x82ff('0x43')){var _0x4592b4={};_0x4592b4[_0xca5a20['name']]={'$like':'%'+_0x1200c2[_0x82ff('0x35')][_0x82ff('0x41')]+'%'};return _0x4592b4;}})});}_0x5287bb=_['merge']({},_0x5287bb,_0x1200c2['options']);var _0x266379={'where':_0x5287bb['where']};return db[_0x82ff('0x30')][_0x82ff('0x1f')](_0x266379)[_0x82ff('0x26')](function(_0x10003c){_0x5e5009[_0x82ff('0x1f')]=_0x10003c;if(_0x1200c2[_0x82ff('0x35')][_0x82ff('0x44')]){_0x5287bb[_0x82ff('0x45')]=[{'all':!![]}];}return db[_0x82ff('0x30')][_0x82ff('0x46')](_0x5287bb);})[_0x82ff('0x26')](function(_0x21f439){_0x5e5009['rows']=_0x21f439;return _0x5e5009;})[_0x82ff('0x26')](respondWithFilteredResult(_0x4c8e65,_0x5287bb))[_0x82ff('0x47')](handleError(_0x4c8e65,null));};exports['show']=function(_0x352caf,_0x1fbb63){var _0x2e6e35={'raw':!![],'where':{'id':_0x352caf[_0x82ff('0x48')]['id']}},_0x203e61={};_0x203e61[_0x82ff('0x34')]=_[_0x82ff('0x36')](db[_0x82ff('0x30')][_0x82ff('0x31')]);_0x203e61[_0x82ff('0x35')]=_[_0x82ff('0x36')](_0x352caf[_0x82ff('0x35')]);_0x203e61[_0x82ff('0x37')]=_[_0x82ff('0x38')](_0x203e61['model'],_0x203e61[_0x82ff('0x35')]);_0x2e6e35[_0x82ff('0x39')]=_[_0x82ff('0x38')](_0x203e61[_0x82ff('0x34')],qs[_0x82ff('0x3a')](_0x352caf[_0x82ff('0x35')][_0x82ff('0x3a')]));_0x2e6e35['attributes']=_0x2e6e35['attributes'][_0x82ff('0x49')]?_0x2e6e35['attributes']:_0x203e61['model'];if(_0x352caf[_0x82ff('0x35')][_0x82ff('0x44')]){_0x2e6e35[_0x82ff('0x45')]=[{'all':!![]}];}_0x2e6e35=_[_0x82ff('0x42')]({},_0x2e6e35,_0x352caf[_0x82ff('0x4a')]);return db['Sound'][_0x82ff('0x4b')](_0x2e6e35)['then'](handleEntityNotFound(_0x1fbb63,null))[_0x82ff('0x26')](respondWithResult(_0x1fbb63,null))[_0x82ff('0x47')](handleError(_0x1fbb63,null));};exports[_0x82ff('0x4c')]=function(_0x382b9c,_0x9f1421,_0x4b7ab6){return db['Sound'][_0x82ff('0x4b')]({'where':{'id':_0x382b9c[_0x82ff('0x48')]['id']},'attributes':[_0x82ff('0x2c'),'save_name',_0x82ff('0x4d')],'raw':!![]})[_0x82ff('0x26')](handleEntityNotFound(_0x9f1421,null))[_0x82ff('0x26')](function(_0x28673d){if(_0x28673d){if(!fs[_0x82ff('0x4e')](path[_0x82ff('0x4f')](config[_0x82ff('0x50')],'server/files/sounds/converted',_0x28673d['save_name']+'.'+_0x28673d[_0x82ff('0x4d')]))){throw new db['Sequelize'][(_0x82ff('0x51'))]('Sound\x20not\x20found');}return _0x9f1421[_0x82ff('0x4c')](path['join'](config[_0x82ff('0x50')],_0x82ff('0x52'),util[_0x82ff('0x53')](_0x82ff('0x54'),_0x28673d[_0x82ff('0x55')],_0x28673d['converted_format'])),util[_0x82ff('0x53')](_0x82ff('0x54'),_0x28673d['name'],_0x28673d[_0x82ff('0x4d')]));}return null;})[_0x82ff('0x47')](handleError(_0x9f1421,null));};exports['create']=function(_0x2c4ba1,_0x3251b9,_0x19ed9b){var _0x222465={'name':path[_0x82ff('0x56')](_0x2c4ba1[_0x82ff('0x57')][_0x82ff('0x58')],path[_0x82ff('0x59')](_0x2c4ba1['file']['originalname'])),'save_name':path[_0x82ff('0x56')](_0x2c4ba1[_0x82ff('0x57')]['filename'],path['extname'](_0x2c4ba1['file'][_0x82ff('0x5a')])),'original_format':path[_0x82ff('0x59')](_0x2c4ba1['file'][_0x82ff('0x58')])[_0x82ff('0x5b')](0x1),'converted_format':'wav'};var _0x1541f8=path[_0x82ff('0x4f')](config['root'],_0x82ff('0x5c'),_0x2c4ba1[_0x82ff('0x57')]['filename']);var _0x54476b=path[_0x82ff('0x4f')](config[_0x82ff('0x50')],'server/files/sounds/converted',util[_0x82ff('0x53')]('%s.%s',path[_0x82ff('0x56')](_0x2c4ba1[_0x82ff('0x57')]['filename'],path[_0x82ff('0x59')](_0x2c4ba1[_0x82ff('0x57')]['filename'])),_0x222465['converted_format']));logger[_0x82ff('0x5d')]('Sound\x20upload\x20filepath:\x20%s',_0x1541f8);logger['info'](_0x82ff('0x5e'),_0x54476b);try{fs['chmodSync'](_0x1541f8,parseInt('0777',0x8));var _0x2bc1b1=sox['transcode'](_0x1541f8,_0x54476b,{'sampleRate':0x1f40,'format':_0x82ff('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2bc1b1['on']('error',function(_0x2e6bb1){fs[_0x82ff('0x60')](_0x1541f8);_0x3251b9['status'](0x1f4)[_0x82ff('0x2d')](_0x2e6bb1);});_0x2bc1b1['on'](_0x82ff('0x61'),function(_0x6ca6d7){_0x222465[_0x82ff('0x62')]=isNaN(_0x6ca6d7[_0x82ff('0x63')])?null:_0x6ca6d7['duration']*0x3e8;_0x222465[_0x82ff('0x64')]=isNaN(_0x6ca6d7[_0x82ff('0x65')])?null:_0x6ca6d7[_0x82ff('0x65')];_0x222465['original_channelCount']=isNaN(_0x6ca6d7[_0x82ff('0x66')])?null:_0x6ca6d7['channelCount'];_0x222465['original_bitRate']=isNaN(_0x6ca6d7[_0x82ff('0x67')])?null:_0x6ca6d7[_0x82ff('0x67')];_0x222465[_0x82ff('0x68')]=isNaN(_0x6ca6d7[_0x82ff('0x69')])?null:_0x6ca6d7[_0x82ff('0x69')];});_0x2bc1b1['on']('dest',function(_0x4cc73b){_0x222465[_0x82ff('0x6a')]=isNaN(_0x4cc73b[_0x82ff('0x63')])?null:_0x4cc73b[_0x82ff('0x63')]*0x3e8;_0x222465[_0x82ff('0x6b')]=isNaN(_0x4cc73b[_0x82ff('0x65')])?null:_0x4cc73b['sampleCount'];_0x222465[_0x82ff('0x6c')]=isNaN(_0x4cc73b[_0x82ff('0x66')])?null:_0x4cc73b[_0x82ff('0x66')];_0x222465[_0x82ff('0x6d')]=isNaN(_0x4cc73b[_0x82ff('0x67')])?null:_0x4cc73b[_0x82ff('0x67')];_0x222465[_0x82ff('0x6e')]=isNaN(_0x4cc73b['sampleRate'])?null:_0x4cc73b[_0x82ff('0x69')];});_0x2bc1b1['on']('end',function(){fs[_0x82ff('0x6f')](_0x54476b,parseInt('0777',0x8));return db['Sound'][_0x82ff('0x70')](_0x222465)[_0x82ff('0x26')](function(_0x502d42){var _0x38268c={'role':_0x2c4ba1[_0x82ff('0x71')][_0x82ff('0x72')],'userProfileId':_0x2c4ba1[_0x82ff('0x71')]['userProfileId']};if(!_0x38268c)throw new Error(_0x82ff('0x73'));if(_0x38268c[_0x82ff('0x72')]===_0x82ff('0x74')){var _0x1524e3=_0x502d42[_0x82ff('0x75')]({'plain':!![]});return db[_0x82ff('0x76')][_0x82ff('0x4b')]({'where':{'name':_0x82ff('0x27'),'userProfileId':_0x38268c['userProfileId']},'raw':!![]})[_0x82ff('0x26')](function(_0x595c23){if(_0x595c23&&_0x595c23[_0x82ff('0x77')]===0x0){return db['UserProfileResource']['create']({'name':_0x1524e3[_0x82ff('0x2c')],'resourceId':_0x1524e3['id'],'type':_0x595c23[_0x82ff('0x2c')],'sectionId':_0x595c23['id']},{})[_0x82ff('0x26')](function(){return _0x502d42;});}else{return _0x502d42;}})[_0x82ff('0x47')](function(_0x341136){logger[_0x82ff('0x2a')](_0x82ff('0x78'),_0x341136);throw _0x341136;});}return _0x502d42;})[_0x82ff('0x26')](respondWithResult(_0x3251b9,null))[_0x82ff('0x47')](handleError(_0x3251b9,null));});_0x2bc1b1[_0x82ff('0x79')]();}catch(_0x47a0d6){_0x3251b9[_0x82ff('0x19')](0x1f4)[_0x82ff('0x2d')](_0x47a0d6);}};exports[_0x82ff('0x25')]=function(_0x2f59b4,_0x1d51ef,_0x568c5f){return db[_0x82ff('0x30')][_0x82ff('0x4b')]({'where':{'id':_0x2f59b4[_0x82ff('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d51ef,null))[_0x82ff('0x26')](saveUpdates(_[_0x82ff('0x40')](_0x2f59b4[_0x82ff('0x71')],[_0x82ff('0x2c'),_0x82ff('0x7a')]),null))[_0x82ff('0x26')](respondWithResult(_0x1d51ef,null))['catch'](handleError(_0x1d51ef,null));};exports[_0x82ff('0x7b')]=function(_0x3b355e,_0x269116,_0x51e202){return db[_0x82ff('0x30')][_0x82ff('0x4b')]({'where':{'id':_0x3b355e['params']['id']}})[_0x82ff('0x26')](function(_0x1570fc){if(_0x1570fc){return _0x1570fc[_0x82ff('0x29')]();}})[_0x82ff('0x26')](function(_0x2cff19){var _0x4b4704=path[_0x82ff('0x4f')](config[_0x82ff('0x50')],_0x82ff('0x5c'),util[_0x82ff('0x53')]('%s.%s',_0x2cff19[_0x82ff('0x55')],_0x2cff19[_0x82ff('0x7c')]));var _0xa25835=path['join'](config[_0x82ff('0x50')],_0x82ff('0x52'),util[_0x82ff('0x53')](_0x82ff('0x54'),_0x2cff19[_0x82ff('0x55')],_0x2cff19['converted_format']));fs[_0x82ff('0x60')](_0x4b4704);fs[_0x82ff('0x60')](_0xa25835);return _0x2cff19;})[_0x82ff('0x26')](function(_0x1b49b5){if(_0x1b49b5){return _0x269116[_0x82ff('0x19')](0xcc)[_0x82ff('0x1a')]();}})[_0x82ff('0x26')](handleEntityNotFound(_0x269116,null))[_0x82ff('0x47')](handleError(_0x269116,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index f8ff29f..0d4b191 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 _0x8dab=['rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','api','bluebird','request-promise','path'];(function(_0x4b0c2,_0x29d121){var _0x3b56a2=function(_0x34bed3){while(--_0x34bed3){_0x4b0c2['push'](_0x4b0c2['shift']());}};_0x3b56a2(++_0x29d121);}(_0x8dab,0xd7));var _0xb8da=function(_0x1e129a,_0x4bfa91){_0x1e129a=_0x1e129a-0x0;var _0x595d15=_0x8dab[_0x1e129a];return _0x595d15;};'use strict';var _=require(_0xb8da('0x0'));var util=require(_0xb8da('0x1'));var logger=require('../../config/logger')(_0xb8da('0x2'));var moment=require('moment');var BPromise=require(_0xb8da('0x3'));var rp=require(_0xb8da('0x4'));var fs=require('fs');var path=require(_0xb8da('0x5'));var rimraf=require(_0xb8da('0x6'));var config=require(_0xb8da('0x7'));var attributes=require(_0xb8da('0x8'));module[_0xb8da('0x9')]=function(_0x287261,_0x544ac6){return _0x287261[_0xb8da('0xa')](_0xb8da('0xb'),attributes,{'tableName':_0xb8da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe24d=['bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds','util','api','moment'];(function(_0x4607c0,_0x2f8738){var _0x2140b7=function(_0x243ccf){while(--_0x243ccf){_0x4607c0['push'](_0x4607c0['shift']());}};_0x2140b7(++_0x2f8738);}(_0xe24d,0x1d6));var _0xde24=function(_0x2c32bf,_0x9e489f){_0x2c32bf=_0x2c32bf-0x0;var _0x469d6b=_0xe24d[_0x2c32bf];return _0x469d6b;};'use strict';var _=require('lodash');var util=require(_0xde24('0x0'));var logger=require('../../config/logger')(_0xde24('0x1'));var moment=require(_0xde24('0x2'));var BPromise=require(_0xde24('0x3'));var rp=require(_0xde24('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde24('0x5'));var config=require(_0xde24('0x6'));var attributes=require(_0xde24('0x7'));module[_0xde24('0x8')]=function(_0x12c880,_0x59b6fd){return _0x12c880[_0xde24('0x9')]('Sound',attributes,{'tableName':_0xde24('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index e4dcfb8..8d15b39 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 _0xf020=['client','http','then','info','stringify','error','code','Sound,\x20%s,\x20%s','message','request\x20sent','result','Sound','find','options','map','include','model','attributes','debug','ShowSound','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0xf020,0x154));var _0x0f02=function(_0x30ac17,_0x1f9dde){_0x30ac17=_0x30ac17-0x0;var _0x14d4af=_0xf020[_0x30ac17];return _0x14d4af;};'use strict';var _=require(_0x0f02('0x0'));var util=require(_0x0f02('0x1'));var moment=require(_0x0f02('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f02('0x3'))['db'];var utils=require(_0x0f02('0x4'));var logger=require('../../config/logger')(_0x0f02('0x5'));var config=require(_0x0f02('0x6'));var jayson=require(_0x0f02('0x7'));var client=jayson[_0x0f02('0x8')][_0x0f02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a9da,_0x396e03,_0x2152e0){return new BPromise(function(_0x23bf64,_0x4da6f1){return client['request'](_0x34a9da,_0x2152e0)[_0x0f02('0xa')](function(_0x2606b4){logger[_0x0f02('0xb')]('Sound,\x20%s,\x20%s',_0x396e03,'request\x20sent');logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x396e03,'request\x20sent',JSON[_0x0f02('0xc')](_0x2606b4));if(_0x2606b4[_0x0f02('0xd')]){if(_0x2606b4[_0x0f02('0xd')][_0x0f02('0xe')]===0x1f4){logger['error'](_0x0f02('0xf'),_0x396e03,_0x2606b4[_0x0f02('0xd')]['message']);return _0x4da6f1(_0x2606b4['error']['message']);}logger[_0x0f02('0xd')]('Sound,\x20%s,\x20%s',_0x396e03,_0x2606b4['error'][_0x0f02('0x10')]);return _0x23bf64(_0x2606b4[_0x0f02('0xd')][_0x0f02('0x10')]);}else{logger[_0x0f02('0xb')](_0x0f02('0xf'),_0x396e03,_0x0f02('0x11'));_0x23bf64(_0x2606b4[_0x0f02('0x12')][_0x0f02('0x10')]);}})['catch'](function(_0x3f1429){logger['error'](_0x0f02('0xf'),_0x396e03,_0x3f1429);_0x4da6f1(_0x3f1429);});});}exports['ShowSound']=function(_0x390561){var _0x36b886=this;return new Promise(function(_0x3d77a5,_0x12a82c){return db[_0x0f02('0x13')][_0x0f02('0x14')]({'raw':_0x390561[_0x0f02('0x15')]?_0x390561[_0x0f02('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x390561[_0x0f02('0x15')]?_0x390561[_0x0f02('0x15')]['where']||null:null,'attributes':_0x390561[_0x0f02('0x15')]?_0x390561[_0x0f02('0x15')]['attributes']||null:null,'include':_0x390561['options']?_0x390561[_0x0f02('0x15')]['include']?_[_0x0f02('0x16')](_0x390561[_0x0f02('0x15')][_0x0f02('0x17')],function(_0x5d5f25){return{'model':db[_0x5d5f25[_0x0f02('0x18')]],'as':_0x5d5f25['as'],'attributes':_0x5d5f25[_0x0f02('0x19')],'include':_0x5d5f25[_0x0f02('0x17')]?_[_0x0f02('0x16')](_0x5d5f25[_0x0f02('0x17')],function(_0x13a7aa){return{'model':db[_0x13a7aa[_0x0f02('0x18')]],'as':_0x13a7aa['as'],'attributes':_0x13a7aa[_0x0f02('0x19')],'include':_0x13a7aa['include']?_[_0x0f02('0x16')](_0x13a7aa[_0x0f02('0x17')],function(_0x2ff743){return{'model':db[_0x2ff743['model']],'as':_0x2ff743['as'],'attributes':_0x2ff743[_0x0f02('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0f02('0xa')](function(_0x4c91c4){logger['info']('ShowSound',_0x390561);logger[_0x0f02('0x1a')](_0x0f02('0x1b'),_0x390561,JSON[_0x0f02('0xc')](_0x4c91c4));_0x3d77a5(_0x4c91c4);})[_0x0f02('0x1c')](function(_0x9ac20a){logger['error'](_0x0f02('0x1b'),_0x9ac20a[_0x0f02('0x10')],_0x390561);_0x12a82c(_0x36b886[_0x0f02('0xd')](0x1f4,_0x9ac20a[_0x0f02('0x10')]));});});}; \ No newline at end of file +var _0x4dd3=['map','attributes','model','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','options','raw','where','include'];(function(_0x2bb9fa,_0x33f63d){var _0x18a068=function(_0x1b89c3){while(--_0x1b89c3){_0x2bb9fa['push'](_0x2bb9fa['shift']());}};_0x18a068(++_0x33f63d);}(_0x4dd3,0xbe));var _0x34dd=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x4dd3[_0x199c03];return _0x11a7d4;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var moment=require('moment');var BPromise=require(_0x34dd('0x2'));var rs=require(_0x34dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34dd('0x4'))['db'];var utils=require(_0x34dd('0x5'));var logger=require(_0x34dd('0x6'))('rpc');var config=require(_0x34dd('0x7'));var jayson=require(_0x34dd('0x8'));var client=jayson[_0x34dd('0x9')][_0x34dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x215463,_0xa75511,_0x2c5716){return new BPromise(function(_0x1dba17,_0x2687a6){return client[_0x34dd('0xb')](_0x215463,_0x2c5716)['then'](function(_0x2fd172){logger[_0x34dd('0xc')](_0x34dd('0xd'),_0xa75511,_0x34dd('0xe'));logger[_0x34dd('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0xa75511,_0x34dd('0xe'),JSON[_0x34dd('0x10')](_0x2fd172));if(_0x2fd172[_0x34dd('0x11')]){if(_0x2fd172['error'][_0x34dd('0x12')]===0x1f4){logger[_0x34dd('0x11')]('Sound,\x20%s,\x20%s',_0xa75511,_0x2fd172['error'][_0x34dd('0x13')]);return _0x2687a6(_0x2fd172[_0x34dd('0x11')][_0x34dd('0x13')]);}logger[_0x34dd('0x11')](_0x34dd('0xd'),_0xa75511,_0x2fd172[_0x34dd('0x11')][_0x34dd('0x13')]);return _0x1dba17(_0x2fd172[_0x34dd('0x11')][_0x34dd('0x13')]);}else{logger[_0x34dd('0xc')](_0x34dd('0xd'),_0xa75511,'request\x20sent');_0x1dba17(_0x2fd172[_0x34dd('0x14')][_0x34dd('0x13')]);}})[_0x34dd('0x15')](function(_0x34201c){logger[_0x34dd('0x11')]('Sound,\x20%s,\x20%s',_0xa75511,_0x34201c);_0x2687a6(_0x34201c);});});}exports[_0x34dd('0x16')]=function(_0xc19e72){var _0x385e91=this;return new Promise(function(_0x10d0f5,_0x165808){return db['Sound']['find']({'raw':_0xc19e72[_0x34dd('0x17')]?_0xc19e72[_0x34dd('0x17')][_0x34dd('0x18')]===undefined?!![]:![]:!![],'where':_0xc19e72['options']?_0xc19e72[_0x34dd('0x17')][_0x34dd('0x19')]||null:null,'attributes':_0xc19e72[_0x34dd('0x17')]?_0xc19e72[_0x34dd('0x17')]['attributes']||null:null,'include':_0xc19e72[_0x34dd('0x17')]?_0xc19e72[_0x34dd('0x17')][_0x34dd('0x1a')]?_[_0x34dd('0x1b')](_0xc19e72[_0x34dd('0x17')][_0x34dd('0x1a')],function(_0x42050b){return{'model':db[_0x42050b['model']],'as':_0x42050b['as'],'attributes':_0x42050b[_0x34dd('0x1c')],'include':_0x42050b['include']?_[_0x34dd('0x1b')](_0x42050b[_0x34dd('0x1a')],function(_0x964624){return{'model':db[_0x964624[_0x34dd('0x1d')]],'as':_0x964624['as'],'attributes':_0x964624[_0x34dd('0x1c')],'include':_0x964624[_0x34dd('0x1a')]?_[_0x34dd('0x1b')](_0x964624['include'],function(_0x145417){return{'model':db[_0x145417['model']],'as':_0x145417['as'],'attributes':_0x145417[_0x34dd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x34dd('0x1e')](function(_0x5b9ae1){logger['info']('ShowSound',_0xc19e72);logger[_0x34dd('0xf')](_0x34dd('0x16'),_0xc19e72,JSON[_0x34dd('0x10')](_0x5b9ae1));_0x10d0f5(_0x5b9ae1);})[_0x34dd('0x15')](function(_0x4318a3){logger[_0x34dd('0x11')]('ShowSound',_0x4318a3[_0x34dd('0x13')],_0xc19e72);_0x165808(_0x385e91[_0x34dd('0x11')](0x1f4,_0x4318a3['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a11afdb..6196f35 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 _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x156dba,_0x4e513e){var _0xa401c=function(_0x2fcb8c){while(--_0x2fcb8c){_0x156dba['push'](_0x156dba['shift']());}};_0xa401c(++_0x4e513e);}(_0x8603,0x190));var _0x3860=function(_0x4a3eef,_0x16388a){_0x4a3eef=_0x4a3eef-0x0;var _0x2d5b79=_0x8603[_0x4a3eef];return _0x2d5b79;};'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 +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x369ac8,_0x545f6d){var _0x17bb6d=function(_0x35f087){while(--_0x35f087){_0x369ac8['push'](_0x369ac8['shift']());}};_0x17bb6d(++_0x545f6d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'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('./squareMessage.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0xb')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router['put']('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0x9'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6e08e7a..9201cde 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 _0x0788=['TEXT','medium','ENUM','out','exports','STRING'];(function(_0x4c9be7,_0x538b4d){var _0x5250a7=function(_0x4a71a0){while(--_0x4a71a0){_0x4c9be7['push'](_0x4c9be7['shift']());}};_0x5250a7(++_0x538b4d);}(_0x0788,0x88));var _0x8078=function(_0x1081b7,_0x1fc984){_0x1081b7=_0x1081b7-0x0;var _0x4603e3=_0x0788[_0x1081b7];return _0x4603e3;};'use strict';var Sequelize=require('sequelize');module[_0x8078('0x0')]={'uniqueid':{'type':Sequelize[_0x8078('0x1')]},'body':{'type':Sequelize[_0x8078('0x2')](_0x8078('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x8078('0x4')]('in',_0x8078('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x8078('0x1')]},'providerResponse':{'type':Sequelize[_0x8078('0x2')]}}; \ No newline at end of file +var _0xafe4=['out','sequelize','exports','STRING','TEXT','medium'];(function(_0x184b02,_0x53b39b){var _0x52ab0b=function(_0x2e5e68){while(--_0x2e5e68){_0x184b02['push'](_0x184b02['shift']());}};_0x52ab0b(++_0x53b39b);}(_0xafe4,0x175));var _0x4afe=function(_0xdc062c,_0x3ea498){_0xdc062c=_0xdc062c-0x0;var _0x9fa2b=_0xafe4[_0xdc062c];return _0x9fa2b;};'use strict';var Sequelize=require(_0x4afe('0x0'));module[_0x4afe('0x1')]={'uniqueid':{'type':Sequelize[_0x4afe('0x2')]},'body':{'type':Sequelize[_0x4afe('0x3')](_0x4afe('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4afe('0x5')),'defaultValue':_0x4afe('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4afe('0x2')]},'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 ac65b62..5057625 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 _0xe469=['limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','destroy','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','save','update','then','end','stack','name','send','index','map','SquareMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2c41f9,_0x550191){var _0x5f3d76=function(_0x19ff0c){while(--_0x19ff0c){_0x2c41f9['push'](_0x2c41f9['shift']());}};_0x5f3d76(++_0x550191);}(_0xe469,0xef));var _0x9e46=function(_0x1337c6,_0x3e8010){_0x1337c6=_0x1337c6-0x0;var _0x28bcf4=_0xe469[_0x1337c6];return _0x28bcf4;};'use strict';var emlformat=require(_0x9e46('0x0'));var rimraf=require(_0x9e46('0x1'));var zipdir=require(_0x9e46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9e46('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9e46('0x4'));var path=require(_0x9e46('0x5'));var sox=require(_0x9e46('0x6'));var csv=require(_0x9e46('0x7'));var ejs=require(_0x9e46('0x8'));var fs=require('fs');var fs_extra=require(_0x9e46('0x9'));var _=require(_0x9e46('0xa'));var squel=require('squel');var crypto=require(_0x9e46('0xb'));var jsforce=require(_0x9e46('0xc'));var deskjs=require(_0x9e46('0xd'));var toCsv=require(_0x9e46('0x7'));var querystring=require(_0x9e46('0xe'));var Papa=require(_0x9e46('0xf'));var Redis=require(_0x9e46('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e46('0x11'));var logger=require(_0x9e46('0x12'))(_0x9e46('0x13'));var utils=require('../../config/utils');var config=require(_0x9e46('0x14'));var licenseUtil=require(_0x9e46('0x15'));var db=require(_0x9e46('0x16'))['db'];function respondWithStatusCode(_0x3cbd98,_0x136c82){_0x136c82=_0x136c82||0xcc;return function(_0x4f85b3){if(_0x4f85b3){return _0x3cbd98[_0x9e46('0x17')](_0x136c82);}return _0x3cbd98['status'](_0x136c82)['end']();};}function respondWithResult(_0x2a5d04,_0x22efa0){_0x22efa0=_0x22efa0||0xc8;return function(_0x100911){if(_0x100911){return _0x2a5d04[_0x9e46('0x18')](_0x22efa0)['json'](_0x100911);}};}function respondWithFilteredResult(_0x1cd770,_0x201bae){return function(_0x53ebc0){if(_0x53ebc0){var _0x480f5f=typeof _0x201bae[_0x9e46('0x19')]===_0x9e46('0x1a')&&typeof _0x201bae['limit']==='undefined';var _0x519525=_0x53ebc0['count'];var _0x3a027a=_0x480f5f?0x0:_0x201bae[_0x9e46('0x19')];var _0x5b54c6=_0x480f5f?_0x53ebc0[_0x9e46('0x1b')]:_0x201bae[_0x9e46('0x19')]+_0x201bae['limit'];var _0x25e777;if(_0x5b54c6>=_0x519525){_0x5b54c6=_0x519525;_0x25e777=0xc8;}else{_0x25e777=0xce;}_0x1cd770[_0x9e46('0x18')](_0x25e777);return _0x1cd770[_0x9e46('0x1c')](_0x9e46('0x1d'),_0x3a027a+'-'+_0x5b54c6+'/'+_0x519525)[_0x9e46('0x1e')](_0x53ebc0);}return null;};}function patchUpdates(_0x1f2131){return function(_0x2c334d){try{jsonpatch['apply'](_0x2c334d,_0x1f2131,!![]);}catch(_0xaa8b60){return BPromise['reject'](_0xaa8b60);}return _0x2c334d[_0x9e46('0x1f')]();};}function saveUpdates(_0x590f73,_0x52b780){return function(_0x5a2b81){if(_0x5a2b81){return _0x5a2b81[_0x9e46('0x20')](_0x590f73)['then'](function(_0x3b89ab){return _0x3b89ab;});}return null;};}function removeEntity(_0x223557,_0x330ea6){return function(_0x1f8d35){if(_0x1f8d35){return _0x1f8d35['destroy']()[_0x9e46('0x21')](function(){_0x223557[_0x9e46('0x18')](0xcc)[_0x9e46('0x22')]();});}};}function handleEntityNotFound(_0x2454a6,_0x5bc271){return function(_0x37c568){if(!_0x37c568){_0x2454a6['sendStatus'](0x194);}return _0x37c568;};}function handleError(_0x28a43a,_0x49aaaa){_0x49aaaa=_0x49aaaa||0x1f4;return function(_0x4a665e){logger['error'](_0x4a665e[_0x9e46('0x23')]);if(_0x4a665e[_0x9e46('0x24')]){delete _0x4a665e[_0x9e46('0x24')];}_0x28a43a[_0x9e46('0x18')](_0x49aaaa)[_0x9e46('0x25')](_0x4a665e);};}exports[_0x9e46('0x26')]=function(_0x1cb0a1,_0x1dbe55){var _0x47997d={},_0x13b25c={},_0x194c70={'count':0x0,'rows':[]};var _0x10c6cd=_[_0x9e46('0x27')](db[_0x9e46('0x28')]['rawAttributes'],function(_0x4d5fc8){return{'name':_0x4d5fc8[_0x9e46('0x29')],'type':_0x4d5fc8[_0x9e46('0x2a')][_0x9e46('0x2b')]};});_0x13b25c[_0x9e46('0x2c')]=_['map'](_0x10c6cd,_0x9e46('0x24'));_0x13b25c[_0x9e46('0x2d')]=_[_0x9e46('0x2e')](_0x1cb0a1[_0x9e46('0x2d')]);_0x13b25c[_0x9e46('0x2f')]=_[_0x9e46('0x30')](_0x13b25c[_0x9e46('0x2c')],_0x13b25c[_0x9e46('0x2d')]);_0x47997d[_0x9e46('0x31')]=_[_0x9e46('0x30')](_0x13b25c['model'],qs['fields'](_0x1cb0a1['query'][_0x9e46('0x32')]));_0x47997d[_0x9e46('0x31')]=_0x47997d['attributes']['length']?_0x47997d[_0x9e46('0x31')]:_0x13b25c['model'];if(!_0x1cb0a1['query'][_0x9e46('0x33')](_0x9e46('0x34'))){_0x47997d['limit']=qs[_0x9e46('0x35')](_0x1cb0a1['query'][_0x9e46('0x35')]);_0x47997d[_0x9e46('0x19')]=qs['offset'](_0x1cb0a1['query']['offset']);}_0x47997d[_0x9e46('0x36')]=qs['sort'](_0x1cb0a1['query'][_0x9e46('0x37')]);_0x47997d[_0x9e46('0x38')]=qs['filters'](_[_0x9e46('0x39')](_0x1cb0a1['query'],_0x13b25c[_0x9e46('0x2f')]),_0x10c6cd);if(_0x1cb0a1[_0x9e46('0x2d')][_0x9e46('0x3a')]){_0x47997d['where']=_[_0x9e46('0x3b')](_0x47997d['where'],{'$or':_[_0x9e46('0x27')](_0x10c6cd,function(_0x26dce9){if(_0x26dce9['type']!==_0x9e46('0x3c')){var _0x5e4b3a={};_0x5e4b3a[_0x26dce9[_0x9e46('0x24')]]={'$like':'%'+_0x1cb0a1[_0x9e46('0x2d')][_0x9e46('0x3a')]+'%'};return _0x5e4b3a;}})});}_0x47997d=_['merge']({},_0x47997d,_0x1cb0a1[_0x9e46('0x3d')]);var _0x2e695d={'where':_0x47997d[_0x9e46('0x38')]};return db['SquareMessage'][_0x9e46('0x1b')](_0x2e695d)[_0x9e46('0x21')](function(_0x1f8acb){_0x194c70[_0x9e46('0x1b')]=_0x1f8acb;if(_0x1cb0a1['query'][_0x9e46('0x3e')]){_0x47997d['include']=[{'all':!![]}];}return db[_0x9e46('0x28')][_0x9e46('0x3f')](_0x47997d);})[_0x9e46('0x21')](function(_0x37d3b5){_0x194c70[_0x9e46('0x40')]=_0x37d3b5;return _0x194c70;})[_0x9e46('0x21')](respondWithFilteredResult(_0x1dbe55,_0x47997d))[_0x9e46('0x41')](handleError(_0x1dbe55,null));};exports['show']=function(_0xdfa815,_0x50ea44){var _0x3d468d={'raw':!![],'where':{'id':_0xdfa815[_0x9e46('0x42')]['id']}},_0x1e3bb4={};_0x1e3bb4[_0x9e46('0x2c')]=_['keys'](db[_0x9e46('0x28')][_0x9e46('0x43')]);_0x1e3bb4[_0x9e46('0x2d')]=_[_0x9e46('0x2e')](_0xdfa815['query']);_0x1e3bb4[_0x9e46('0x2f')]=_[_0x9e46('0x30')](_0x1e3bb4[_0x9e46('0x2c')],_0x1e3bb4[_0x9e46('0x2d')]);_0x3d468d[_0x9e46('0x31')]=_['intersection'](_0x1e3bb4[_0x9e46('0x2c')],qs[_0x9e46('0x32')](_0xdfa815[_0x9e46('0x2d')][_0x9e46('0x32')]));_0x3d468d[_0x9e46('0x31')]=_0x3d468d[_0x9e46('0x31')]['length']?_0x3d468d['attributes']:_0x1e3bb4[_0x9e46('0x2c')];if(_0xdfa815[_0x9e46('0x2d')][_0x9e46('0x3e')]){_0x3d468d[_0x9e46('0x44')]=[{'all':!![]}];}_0x3d468d=_[_0x9e46('0x3b')]({},_0x3d468d,_0xdfa815[_0x9e46('0x3d')]);return db[_0x9e46('0x28')][_0x9e46('0x45')](_0x3d468d)[_0x9e46('0x21')](handleEntityNotFound(_0x50ea44,null))[_0x9e46('0x21')](respondWithResult(_0x50ea44,null))[_0x9e46('0x41')](handleError(_0x50ea44,null));};exports[_0x9e46('0x46')]=function(_0x1cc59b,_0x9cf596){return db['SquareMessage'][_0x9e46('0x46')](_0x1cc59b[_0x9e46('0x47')],{})[_0x9e46('0x21')](respondWithResult(_0x9cf596,0xc9))[_0x9e46('0x41')](handleError(_0x9cf596,null));};exports['update']=function(_0x3be8b4,_0x4223dd){if(_0x3be8b4[_0x9e46('0x47')]['id']){delete _0x3be8b4[_0x9e46('0x47')]['id'];}return db[_0x9e46('0x28')]['find']({'where':{'id':_0x3be8b4[_0x9e46('0x42')]['id']}})['then'](handleEntityNotFound(_0x4223dd,null))[_0x9e46('0x21')](saveUpdates(_0x3be8b4[_0x9e46('0x47')],null))[_0x9e46('0x21')](respondWithResult(_0x4223dd,null))[_0x9e46('0x41')](handleError(_0x4223dd,null));};exports[_0x9e46('0x48')]=function(_0x5d71b4,_0x5b1419){return db[_0x9e46('0x28')]['find']({'where':{'id':_0x5d71b4[_0x9e46('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b1419,null))['then'](removeEntity(_0x5b1419,null))[_0x9e46('0x41')](handleError(_0x5b1419,null));}; \ No newline at end of file +var _0x8328=['offset','count','Content-Range','apply','reject','save','update','then','stack','name','send','index','SquareMessage','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','rawAttributes','includeAll','include','create','body','catch','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4f7a97,_0x14f986){var _0x2d97cb=function(_0x4323b6){while(--_0x4323b6){_0x4f7a97['push'](_0x4f7a97['shift']());}};_0x2d97cb(++_0x14f986);}(_0x8328,0xb3));var _0x8832=function(_0x301152,_0x210837){_0x301152=_0x301152-0x0;var _0x2fb128=_0x8328[_0x301152];return _0x2fb128;};'use strict';var emlformat=require(_0x8832('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8832('0x1'));var moment=require(_0x8832('0x2'));var BPromise=require(_0x8832('0x3'));var Mustache=require(_0x8832('0x4'));var util=require(_0x8832('0x5'));var path=require(_0x8832('0x6'));var sox=require('sox');var csv=require(_0x8832('0x7'));var ejs=require(_0x8832('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8832('0x9'));var squel=require(_0x8832('0xa'));var crypto=require('crypto');var jsforce=require(_0x8832('0xb'));var deskjs=require(_0x8832('0xc'));var toCsv=require(_0x8832('0x7'));var querystring=require(_0x8832('0xd'));var Papa=require('papaparse');var Redis=require(_0x8832('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8832('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8832('0x10'));var logger=require(_0x8832('0x11'))(_0x8832('0x12'));var utils=require('../../config/utils');var config=require(_0x8832('0x13'));var licenseUtil=require(_0x8832('0x14'));var db=require(_0x8832('0x15'))['db'];function respondWithStatusCode(_0x15f79e,_0x5529b2){_0x5529b2=_0x5529b2||0xcc;return function(_0x4e4f5b){if(_0x4e4f5b){return _0x15f79e[_0x8832('0x16')](_0x5529b2);}return _0x15f79e[_0x8832('0x17')](_0x5529b2)[_0x8832('0x18')]();};}function respondWithResult(_0x4be998,_0x494bfc){_0x494bfc=_0x494bfc||0xc8;return function(_0x2c0fd9){if(_0x2c0fd9){return _0x4be998[_0x8832('0x17')](_0x494bfc)['json'](_0x2c0fd9);}};}function respondWithFilteredResult(_0x4ce5dc,_0x170621){return function(_0x4ffec5){if(_0x4ffec5){var _0x51bd18=typeof _0x170621[_0x8832('0x19')]==='undefined'&&typeof _0x170621['limit']==='undefined';var _0x105d47=_0x4ffec5[_0x8832('0x1a')];var _0x47a7c0=_0x51bd18?0x0:_0x170621[_0x8832('0x19')];var _0x23100a=_0x51bd18?_0x4ffec5['count']:_0x170621[_0x8832('0x19')]+_0x170621['limit'];var _0x191356;if(_0x23100a>=_0x105d47){_0x23100a=_0x105d47;_0x191356=0xc8;}else{_0x191356=0xce;}_0x4ce5dc[_0x8832('0x17')](_0x191356);return _0x4ce5dc['set'](_0x8832('0x1b'),_0x47a7c0+'-'+_0x23100a+'/'+_0x105d47)['json'](_0x4ffec5);}return null;};}function patchUpdates(_0x27147f){return function(_0x448adc){try{jsonpatch[_0x8832('0x1c')](_0x448adc,_0x27147f,!![]);}catch(_0x3349ad){return BPromise[_0x8832('0x1d')](_0x3349ad);}return _0x448adc[_0x8832('0x1e')]();};}function saveUpdates(_0x5ce22f,_0x27da67){return function(_0x265c79){if(_0x265c79){return _0x265c79[_0x8832('0x1f')](_0x5ce22f)[_0x8832('0x20')](function(_0x49f465){return _0x49f465;});}return null;};}function removeEntity(_0xc3387e,_0x41d280){return function(_0x76193c){if(_0x76193c){return _0x76193c['destroy']()[_0x8832('0x20')](function(){_0xc3387e[_0x8832('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x169f96,_0x5a2d02){return function(_0x35fe81){if(!_0x35fe81){_0x169f96['sendStatus'](0x194);}return _0x35fe81;};}function handleError(_0x5ab299,_0x3e4c9b){_0x3e4c9b=_0x3e4c9b||0x1f4;return function(_0x2a0c52){logger['error'](_0x2a0c52[_0x8832('0x21')]);if(_0x2a0c52[_0x8832('0x22')]){delete _0x2a0c52[_0x8832('0x22')];}_0x5ab299['status'](_0x3e4c9b)[_0x8832('0x23')](_0x2a0c52);};}exports[_0x8832('0x24')]=function(_0x4fa4ff,_0x371f78){var _0x179d5a={},_0x127a73={},_0x4896ff={'count':0x0,'rows':[]};var _0x3f082f=_['map'](db[_0x8832('0x25')]['rawAttributes'],function(_0x64ad60){return{'name':_0x64ad60[_0x8832('0x26')],'type':_0x64ad60[_0x8832('0x27')][_0x8832('0x28')]};});_0x127a73[_0x8832('0x29')]=_['map'](_0x3f082f,_0x8832('0x22'));_0x127a73['query']=_['keys'](_0x4fa4ff['query']);_0x127a73[_0x8832('0x2a')]=_[_0x8832('0x2b')](_0x127a73[_0x8832('0x29')],_0x127a73[_0x8832('0x2c')]);_0x179d5a[_0x8832('0x2d')]=_[_0x8832('0x2b')](_0x127a73[_0x8832('0x29')],qs[_0x8832('0x2e')](_0x4fa4ff[_0x8832('0x2c')][_0x8832('0x2e')]));_0x179d5a[_0x8832('0x2d')]=_0x179d5a[_0x8832('0x2d')][_0x8832('0x2f')]?_0x179d5a['attributes']:_0x127a73[_0x8832('0x29')];if(!_0x4fa4ff[_0x8832('0x2c')][_0x8832('0x30')](_0x8832('0x31'))){_0x179d5a['limit']=qs[_0x8832('0x32')](_0x4fa4ff['query']['limit']);_0x179d5a['offset']=qs[_0x8832('0x19')](_0x4fa4ff[_0x8832('0x2c')][_0x8832('0x19')]);}_0x179d5a['order']=qs[_0x8832('0x33')](_0x4fa4ff[_0x8832('0x2c')][_0x8832('0x33')]);_0x179d5a[_0x8832('0x34')]=qs['filters'](_['pick'](_0x4fa4ff[_0x8832('0x2c')],_0x127a73['filters']),_0x3f082f);if(_0x4fa4ff[_0x8832('0x2c')][_0x8832('0x35')]){_0x179d5a[_0x8832('0x34')]=_['merge'](_0x179d5a[_0x8832('0x34')],{'$or':_['map'](_0x3f082f,function(_0x2dd7fe){if(_0x2dd7fe[_0x8832('0x27')]!==_0x8832('0x36')){var _0x53cf74={};_0x53cf74[_0x2dd7fe['name']]={'$like':'%'+_0x4fa4ff['query']['filter']+'%'};return _0x53cf74;}})});}_0x179d5a=_[_0x8832('0x37')]({},_0x179d5a,_0x4fa4ff[_0x8832('0x38')]);var _0x21421d={'where':_0x179d5a[_0x8832('0x34')]};return db[_0x8832('0x25')][_0x8832('0x1a')](_0x21421d)['then'](function(_0x4a8f83){_0x4896ff['count']=_0x4a8f83;if(_0x4fa4ff[_0x8832('0x2c')]['includeAll']){_0x179d5a['include']=[{'all':!![]}];}return db['SquareMessage'][_0x8832('0x39')](_0x179d5a);})[_0x8832('0x20')](function(_0x5117fb){_0x4896ff[_0x8832('0x3a')]=_0x5117fb;return _0x4896ff;})['then'](respondWithFilteredResult(_0x371f78,_0x179d5a))['catch'](handleError(_0x371f78,null));};exports[_0x8832('0x3b')]=function(_0x590167,_0x3efc0c){var _0x4468f5={'raw':!![],'where':{'id':_0x590167[_0x8832('0x3c')]['id']}},_0x4bb312={};_0x4bb312[_0x8832('0x29')]=_[_0x8832('0x3d')](db[_0x8832('0x25')][_0x8832('0x3e')]);_0x4bb312[_0x8832('0x2c')]=_[_0x8832('0x3d')](_0x590167['query']);_0x4bb312[_0x8832('0x2a')]=_[_0x8832('0x2b')](_0x4bb312['model'],_0x4bb312[_0x8832('0x2c')]);_0x4468f5[_0x8832('0x2d')]=_[_0x8832('0x2b')](_0x4bb312[_0x8832('0x29')],qs[_0x8832('0x2e')](_0x590167[_0x8832('0x2c')][_0x8832('0x2e')]));_0x4468f5[_0x8832('0x2d')]=_0x4468f5[_0x8832('0x2d')][_0x8832('0x2f')]?_0x4468f5[_0x8832('0x2d')]:_0x4bb312[_0x8832('0x29')];if(_0x590167[_0x8832('0x2c')][_0x8832('0x3f')]){_0x4468f5[_0x8832('0x40')]=[{'all':!![]}];}_0x4468f5=_['merge']({},_0x4468f5,_0x590167[_0x8832('0x38')]);return db[_0x8832('0x25')]['find'](_0x4468f5)[_0x8832('0x20')](handleEntityNotFound(_0x3efc0c,null))[_0x8832('0x20')](respondWithResult(_0x3efc0c,null))['catch'](handleError(_0x3efc0c,null));};exports[_0x8832('0x41')]=function(_0x1d5b7e,_0x101589){return db[_0x8832('0x25')]['create'](_0x1d5b7e[_0x8832('0x42')],{})[_0x8832('0x20')](respondWithResult(_0x101589,0xc9))['catch'](handleError(_0x101589,null));};exports[_0x8832('0x1f')]=function(_0x40378a,_0x311eac){if(_0x40378a['body']['id']){delete _0x40378a[_0x8832('0x42')]['id'];}return db[_0x8832('0x25')]['find']({'where':{'id':_0x40378a[_0x8832('0x3c')]['id']}})['then'](handleEntityNotFound(_0x311eac,null))[_0x8832('0x20')](saveUpdates(_0x40378a[_0x8832('0x42')],null))[_0x8832('0x20')](respondWithResult(_0x311eac,null))[_0x8832('0x43')](handleError(_0x311eac,null));};exports['destroy']=function(_0x3aa282,_0x2d7a35){return db[_0x8832('0x25')]['find']({'where':{'id':_0x3aa282[_0x8832('0x3c')]['id']}})[_0x8832('0x20')](handleEntityNotFound(_0x2d7a35,null))[_0x8832('0x20')](removeEntity(_0x2d7a35,null))[_0x8832('0x43')](handleError(_0x2d7a35,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4139c28..d9266ae 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 _0xcd95=['path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x7ee0af,_0x53253a){var _0x4e8458=function(_0x5a5e5e){while(--_0x5a5e5e){_0x7ee0af['push'](_0x7ee0af['shift']());}};_0x4e8458(++_0x53253a);}(_0xcd95,0x145));var _0x5cd9=function(_0x29d4b5,_0x1913e2){_0x29d4b5=_0x29d4b5-0x0;var _0x3fbb01=_0xcd95[_0x29d4b5];return _0x3fbb01;};'use strict';var _=require(_0x5cd9('0x0'));var util=require(_0x5cd9('0x1'));var logger=require(_0x5cd9('0x2'))('api');var moment=require(_0x5cd9('0x3'));var BPromise=require('bluebird');var rp=require(_0x5cd9('0x4'));var fs=require('fs');var path=require(_0x5cd9('0x5'));var rimraf=require(_0x5cd9('0x6'));var config=require(_0x5cd9('0x7'));var attributes=require(_0x5cd9('0x8'));module[_0x5cd9('0x9')]=function(_0x53085e,_0x275669){return _0x53085e[_0x5cd9('0xa')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe076=['request-promise','./squareMessage.attributes','square_messages','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xe076,0x143));var _0x6e07=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xe076[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x6e07('0x0'));var util=require('util');var logger=require(_0x6e07('0x1'))(_0x6e07('0x2'));var moment=require(_0x6e07('0x3'));var BPromise=require(_0x6e07('0x4'));var rp=require(_0x6e07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e07('0x6'));module['exports']=function(_0x1714d6,_0x50486b){return _0x1714d6['define']('SquareMessage',attributes,{'tableName':_0x6e07('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 32b21fb..85207eb 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 _0x54d8=['rpc','../../config/environment','jayson/promise','client','http','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateSquareMessage','create','options','raw','stringify','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4e3537,_0x361c10){var _0x5f48cb=function(_0x525888){while(--_0x525888){_0x4e3537['push'](_0x4e3537['shift']());}};_0x5f48cb(++_0x361c10);}(_0x54d8,0x13d));var _0x854d=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x54d8[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x854d('0x0'));var util=require(_0x854d('0x1'));var moment=require(_0x854d('0x2'));var BPromise=require(_0x854d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x854d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x854d('0x5'));var logger=require(_0x854d('0x6'))(_0x854d('0x7'));var config=require(_0x854d('0x8'));var jayson=require(_0x854d('0x9'));var client=jayson[_0x854d('0xa')][_0x854d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x102d28,_0x48f294,_0x2632bd){return new BPromise(function(_0x43d097,_0x57dc46){return client['request'](_0x102d28,_0x2632bd)['then'](function(_0x277585){logger['info'](_0x854d('0xc'),_0x48f294,_0x854d('0xd'));logger[_0x854d('0xe')](_0x854d('0xf'),_0x48f294,_0x854d('0xd'),JSON['stringify'](_0x277585));if(_0x277585[_0x854d('0x10')]){if(_0x277585[_0x854d('0x10')][_0x854d('0x11')]===0x1f4){logger[_0x854d('0x10')]('SquareMessage,\x20%s,\x20%s',_0x48f294,_0x277585[_0x854d('0x10')][_0x854d('0x12')]);return _0x57dc46(_0x277585[_0x854d('0x10')][_0x854d('0x12')]);}logger[_0x854d('0x10')]('SquareMessage,\x20%s,\x20%s',_0x48f294,_0x277585['error'][_0x854d('0x12')]);return _0x43d097(_0x277585[_0x854d('0x10')][_0x854d('0x12')]);}else{logger[_0x854d('0x13')](_0x854d('0xc'),_0x48f294,'request\x20sent');_0x43d097(_0x277585[_0x854d('0x14')][_0x854d('0x12')]);}})['catch'](function(_0x800567){logger[_0x854d('0x10')](_0x854d('0xc'),_0x48f294,_0x800567);_0x57dc46(_0x800567);});});}exports[_0x854d('0x15')]=function(_0xb58179){var _0x403a51=this;return new Promise(function(_0x18dd5c,_0x520d67){return db['SquareMessage'][_0x854d('0x16')](_0xb58179['body'],{'raw':_0xb58179[_0x854d('0x17')]?_0xb58179['options'][_0x854d('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x99494f){logger['info'](_0x854d('0x15'),_0xb58179);logger[_0x854d('0xe')](_0x854d('0x15'),_0xb58179,JSON[_0x854d('0x19')](_0x99494f));_0x18dd5c(_0x99494f);})[_0x854d('0x1a')](function(_0x41ccc0){logger[_0x854d('0x10')](_0x854d('0x15'),_0x41ccc0[_0x854d('0x12')],_0xb58179);_0x520d67(_0x403a51[_0x854d('0x10')](0x1f4,_0x41ccc0[_0x854d('0x12')]));});});}; \ No newline at end of file +var _0x2de5=['request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareMessage','SquareMessage','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x295929,_0x54030c){var _0x268498=function(_0x26a292){while(--_0x26a292){_0x295929['push'](_0x295929['shift']());}};_0x268498(++_0x54030c);}(_0x2de5,0x1dc));var _0x52de=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0x2de5[_0x547e20];return _0x359171;};'use strict';var _=require(_0x52de('0x0'));var util=require(_0x52de('0x1'));var moment=require(_0x52de('0x2'));var BPromise=require('bluebird');var rs=require(_0x52de('0x3'));var fs=require('fs');var Redis=require(_0x52de('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x52de('0x5'))(_0x52de('0x6'));var config=require('../../config/environment');var jayson=require(_0x52de('0x7'));var client=jayson[_0x52de('0x8')][_0x52de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x206bc2,_0x5d2426,_0x63719a){return new BPromise(function(_0x5de9a2,_0x19597c){return client[_0x52de('0xa')](_0x206bc2,_0x63719a)[_0x52de('0xb')](function(_0x4c75d8){logger[_0x52de('0xc')](_0x52de('0xd'),_0x5d2426,_0x52de('0xe'));logger[_0x52de('0xf')](_0x52de('0x10'),_0x5d2426,_0x52de('0xe'),JSON['stringify'](_0x4c75d8));if(_0x4c75d8['error']){if(_0x4c75d8[_0x52de('0x11')][_0x52de('0x12')]===0x1f4){logger[_0x52de('0x11')](_0x52de('0xd'),_0x5d2426,_0x4c75d8['error'][_0x52de('0x13')]);return _0x19597c(_0x4c75d8['error'][_0x52de('0x13')]);}logger[_0x52de('0x11')]('SquareMessage,\x20%s,\x20%s',_0x5d2426,_0x4c75d8[_0x52de('0x11')]['message']);return _0x5de9a2(_0x4c75d8[_0x52de('0x11')][_0x52de('0x13')]);}else{logger[_0x52de('0xc')](_0x52de('0xd'),_0x5d2426,_0x52de('0xe'));_0x5de9a2(_0x4c75d8['result']['message']);}})[_0x52de('0x14')](function(_0x462683){logger[_0x52de('0x11')](_0x52de('0xd'),_0x5d2426,_0x462683);_0x19597c(_0x462683);});});}exports[_0x52de('0x15')]=function(_0x2b5430){var _0x366caf=this;return new Promise(function(_0x119250,_0x522d2a){return db[_0x52de('0x16')]['create'](_0x2b5430[_0x52de('0x17')],{'raw':_0x2b5430[_0x52de('0x18')]?_0x2b5430[_0x52de('0x18')][_0x52de('0x19')]===undefined?!![]:![]:!![]})[_0x52de('0xb')](function(_0x40adf6){logger[_0x52de('0xc')](_0x52de('0x15'),_0x2b5430);logger['debug'](_0x52de('0x15'),_0x2b5430,JSON[_0x52de('0x1a')](_0x40adf6));_0x119250(_0x40adf6);})[_0x52de('0x14')](function(_0x1b1fa0){logger[_0x52de('0x11')](_0x52de('0x15'),_0x1b1fa0[_0x52de('0x13')],_0x2b5430);_0x522d2a(_0x366caf[_0x52de('0x11')](0x1f4,_0x1b1fa0[_0x52de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index e08ef7b..97b288c 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 _0x8e1e=['delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','update'];(function(_0x588211,_0x3d73eb){var _0x37e6de=function(_0x260c56){while(--_0x260c56){_0x588211['push'](_0x588211['shift']());}};_0x37e6de(++_0x3d73eb);}(_0x8e1e,0x193));var _0xe8e1=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x8e1e[_0x556bb1];return _0x45455f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe8e1('0x0'));var timeout=require('connect-timeout');var express=require(_0xe8e1('0x1'));var router=express[_0xe8e1('0x2')]();var fs_extra=require(_0xe8e1('0x3'));var auth=require(_0xe8e1('0x4'));var interaction=require(_0xe8e1('0x5'));var config=require('../../config/environment');var controller=require(_0xe8e1('0x6'));router[_0xe8e1('0x7')]('/',auth[_0xe8e1('0x8')](),controller[_0xe8e1('0x9')]);router[_0xe8e1('0x7')](_0xe8e1('0xa'),auth[_0xe8e1('0x8')](),controller['show']);router['get'](_0xe8e1('0xb'),auth[_0xe8e1('0x8')](),timeout(_0xe8e1('0xc')),controller[_0xe8e1('0xd')]);router[_0xe8e1('0xe')]('/',auth[_0xe8e1('0x8')](),controller[_0xe8e1('0xf')]);router['put'](_0xe8e1('0xa'),auth[_0xe8e1('0x8')](),controller[_0xe8e1('0x10')]);router[_0xe8e1('0x11')](_0xe8e1('0xa'),auth[_0xe8e1('0x8')](),controller[_0xe8e1('0x12')]);module[_0xe8e1('0x13')]=router; \ No newline at end of file +var _0x15be=['show','/:id/test','isAuthenticated','15s','test','post','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id'];(function(_0x380f57,_0x7d877a){var _0x304cce=function(_0x176043){while(--_0x176043){_0x380f57['push'](_0x380f57['shift']());}};_0x304cce(++_0x7d877a);}(_0x15be,0x131));var _0xe15b=function(_0x50ae27,_0x256afc){_0x50ae27=_0x50ae27-0x0;var _0x4aebbd=_0x15be[_0x50ae27];return _0x4aebbd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe15b('0x0'));var timeout=require(_0xe15b('0x1'));var express=require(_0xe15b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe15b('0x3'));var interaction=require(_0xe15b('0x4'));var config=require(_0xe15b('0x5'));var controller=require(_0xe15b('0x6'));router[_0xe15b('0x7')]('/',auth['isAuthenticated'](),controller[_0xe15b('0x8')]);router[_0xe15b('0x7')](_0xe15b('0x9'),auth['isAuthenticated'](),controller[_0xe15b('0xa')]);router[_0xe15b('0x7')](_0xe15b('0xb'),auth[_0xe15b('0xc')](),timeout(_0xe15b('0xd')),controller[_0xe15b('0xe')]);router[_0xe15b('0xf')]('/',auth[_0xe15b('0xc')](),controller['create']);router[_0xe15b('0x10')](_0xe15b('0x9'),auth[_0xe15b('0xc')](),controller[_0xe15b('0x11')]);router[_0xe15b('0x12')](_0xe15b('0x9'),auth[_0xe15b('0xc')](),controller[_0xe15b('0x13')]);module[_0xe15b('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f444d68..79f19f2 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 _0xacba=['STRING','sequelize'];(function(_0x212b65,_0x3a695b){var _0x2ad15a=function(_0x51b4ea){while(--_0x51b4ea){_0x212b65['push'](_0x212b65['shift']());}};_0x2ad15a(++_0x3a695b);}(_0xacba,0xd1));var _0xaacb=function(_0x2871d4,_0x233c5a){_0x2871d4=_0x2871d4-0x0;var _0x54a31e=_0xacba[_0x2871d4];return _0x54a31e;};'use strict';var Sequelize=require(_0xaacb('0x0'));module['exports']={'name':{'type':Sequelize[_0xaacb('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaacb('0x1')]}}; \ No newline at end of file +var _0xa587=['exports','STRING','name','sequelize'];(function(_0x467916,_0xa30c33){var _0x1261c5=function(_0x367fef){while(--_0x367fef){_0x467916['push'](_0x467916['shift']());}};_0x1261c5(++_0xa30c33);}(_0xa587,0x16f));var _0x7a58=function(_0x153388,_0x1c6403){_0x153388=_0x153388-0x0;var _0x2259c0=_0xa587[_0x153388];return _0x2259c0;};'use strict';var Sequelize=require(_0x7a58('0x0'));module[_0x7a58('0x1')]={'name':{'type':Sequelize[_0x7a58('0x2')],'unique':_0x7a58('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7a58('0x2')]},'description':{'type':Sequelize[_0x7a58('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index bc9d54e..2774aa6 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 _0xd56b=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SquareOdbc','includeAll','catch','show','length','include','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd56b,0x196));var _0xbd56=function(_0x31904b,_0x48100a){_0x31904b=_0x31904b-0x0;var _0x38b2a0=_0xd56b[_0x31904b];return _0x38b2a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd56('0x0'));var zipdir=require(_0xbd56('0x1'));var jsonpatch=require(_0xbd56('0x2'));var rp=require(_0xbd56('0x3'));var moment=require(_0xbd56('0x4'));var BPromise=require(_0xbd56('0x5'));var Mustache=require('mustache');var util=require(_0xbd56('0x6'));var path=require('path');var sox=require(_0xbd56('0x7'));var csv=require('to-csv');var ejs=require(_0xbd56('0x8'));var fs=require('fs');var fs_extra=require(_0xbd56('0x9'));var _=require('lodash');var squel=require(_0xbd56('0xa'));var crypto=require(_0xbd56('0xb'));var jsforce=require(_0xbd56('0xc'));var deskjs=require(_0xbd56('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbd56('0xe'));var Papa=require(_0xbd56('0xf'));var Redis=require(_0xbd56('0x10'));var authService=require(_0xbd56('0x11'));var qs=require(_0xbd56('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd56('0x13'));var logger=require(_0xbd56('0x14'))(_0xbd56('0x15'));var utils=require(_0xbd56('0x16'));var config=require(_0xbd56('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd56('0x18'))['db'];function respondWithStatusCode(_0x1071c1,_0x1cadef){_0x1cadef=_0x1cadef||0xcc;return function(_0x3f58c6){if(_0x3f58c6){return _0x1071c1[_0xbd56('0x19')](_0x1cadef);}return _0x1071c1[_0xbd56('0x1a')](_0x1cadef)[_0xbd56('0x1b')]();};}function respondWithResult(_0x454f2e,_0x10379f){_0x10379f=_0x10379f||0xc8;return function(_0x5751ff){if(_0x5751ff){return _0x454f2e[_0xbd56('0x1a')](_0x10379f)[_0xbd56('0x1c')](_0x5751ff);}};}function respondWithFilteredResult(_0x3c207e,_0x10c63e){return function(_0x4910cc){if(_0x4910cc){var _0x598204=typeof _0x10c63e['offset']===_0xbd56('0x1d')&&typeof _0x10c63e[_0xbd56('0x1e')]===_0xbd56('0x1d');var _0x466022=_0x4910cc[_0xbd56('0x1f')];var _0x4e9deb=_0x598204?0x0:_0x10c63e[_0xbd56('0x20')];var _0x5c7e18=_0x598204?_0x4910cc[_0xbd56('0x1f')]:_0x10c63e[_0xbd56('0x20')]+_0x10c63e[_0xbd56('0x1e')];var _0x8910ae;if(_0x5c7e18>=_0x466022){_0x5c7e18=_0x466022;_0x8910ae=0xc8;}else{_0x8910ae=0xce;}_0x3c207e[_0xbd56('0x1a')](_0x8910ae);return _0x3c207e['set'](_0xbd56('0x21'),_0x4e9deb+'-'+_0x5c7e18+'/'+_0x466022)[_0xbd56('0x1c')](_0x4910cc);}return null;};}function patchUpdates(_0x43e73c){return function(_0x17a468){try{jsonpatch[_0xbd56('0x22')](_0x17a468,_0x43e73c,!![]);}catch(_0x128bb5){return BPromise[_0xbd56('0x23')](_0x128bb5);}return _0x17a468[_0xbd56('0x24')]();};}function saveUpdates(_0x1db910,_0x4da1b9){return function(_0x14033d){if(_0x14033d){return _0x14033d[_0xbd56('0x25')](_0x1db910)[_0xbd56('0x26')](function(_0x39ab27){return _0x39ab27;});}return null;};}function removeEntity(_0x4bee88,_0x44f9f5){return function(_0x5e2b2b){if(_0x5e2b2b){return _0x5e2b2b['destroy']()[_0xbd56('0x26')](function(){var _0x151bf3=_0x5e2b2b[_0xbd56('0x27')]({'plain':!![]});var _0xb591f9=_0xbd56('0x28');return db[_0xbd56('0x29')][_0xbd56('0x2a')]({'where':{'type':_0xb591f9,'resourceId':_0x151bf3['id']}})[_0xbd56('0x26')](function(){return _0x5e2b2b;});})[_0xbd56('0x26')](function(){_0x4bee88[_0xbd56('0x1a')](0xcc)[_0xbd56('0x1b')]();});}};}function handleEntityNotFound(_0xa1024f,_0x3aae8d){return function(_0x38597d){if(!_0x38597d){_0xa1024f[_0xbd56('0x19')](0x194);}return _0x38597d;};}function handleError(_0x33d01c,_0x2c64fa){_0x2c64fa=_0x2c64fa||0x1f4;return function(_0x49c90a){logger[_0xbd56('0x2b')](_0x49c90a['stack']);if(_0x49c90a[_0xbd56('0x2c')]){delete _0x49c90a[_0xbd56('0x2c')];}_0x33d01c[_0xbd56('0x1a')](_0x2c64fa)[_0xbd56('0x2d')](_0x49c90a);};}exports[_0xbd56('0x2e')]=function(_0x793946,_0xa54687){var _0x1d08d1={},_0x2d72cd={},_0x5f235a={'count':0x0,'rows':[]};var _0x4bf77a=_['map'](db['SquareOdbc']['rawAttributes'],function(_0xbd5474){return{'name':_0xbd5474['fieldName'],'type':_0xbd5474[_0xbd56('0x2f')][_0xbd56('0x30')]};});_0x2d72cd[_0xbd56('0x31')]=_[_0xbd56('0x32')](_0x4bf77a,_0xbd56('0x2c'));_0x2d72cd[_0xbd56('0x33')]=_[_0xbd56('0x34')](_0x793946[_0xbd56('0x33')]);_0x2d72cd[_0xbd56('0x35')]=_[_0xbd56('0x36')](_0x2d72cd[_0xbd56('0x31')],_0x2d72cd[_0xbd56('0x33')]);_0x1d08d1[_0xbd56('0x37')]=_[_0xbd56('0x36')](_0x2d72cd[_0xbd56('0x31')],qs[_0xbd56('0x38')](_0x793946['query'][_0xbd56('0x38')]));_0x1d08d1['attributes']=_0x1d08d1[_0xbd56('0x37')]['length']?_0x1d08d1[_0xbd56('0x37')]:_0x2d72cd[_0xbd56('0x31')];if(!_0x793946[_0xbd56('0x33')][_0xbd56('0x39')](_0xbd56('0x3a'))){_0x1d08d1[_0xbd56('0x1e')]=qs['limit'](_0x793946[_0xbd56('0x33')][_0xbd56('0x1e')]);_0x1d08d1[_0xbd56('0x20')]=qs[_0xbd56('0x20')](_0x793946[_0xbd56('0x33')][_0xbd56('0x20')]);}_0x1d08d1[_0xbd56('0x3b')]=qs[_0xbd56('0x3c')](_0x793946['query']['sort']);_0x1d08d1[_0xbd56('0x3d')]=qs[_0xbd56('0x35')](_[_0xbd56('0x3e')](_0x793946[_0xbd56('0x33')],_0x2d72cd['filters']),_0x4bf77a);if(_0x793946['query'][_0xbd56('0x3f')]){_0x1d08d1[_0xbd56('0x3d')]=_[_0xbd56('0x40')](_0x1d08d1[_0xbd56('0x3d')],{'$or':_[_0xbd56('0x32')](_0x4bf77a,function(_0x48adb3){if(_0x48adb3[_0xbd56('0x2f')]!=='VIRTUAL'){var _0x3986e0={};_0x3986e0[_0x48adb3['name']]={'$like':'%'+_0x793946[_0xbd56('0x33')][_0xbd56('0x3f')]+'%'};return _0x3986e0;}})});}_0x1d08d1=_['merge']({},_0x1d08d1,_0x793946[_0xbd56('0x41')]);var _0x380442={'where':_0x1d08d1[_0xbd56('0x3d')]};return db[_0xbd56('0x42')][_0xbd56('0x1f')](_0x380442)['then'](function(_0x5b0a90){_0x5f235a[_0xbd56('0x1f')]=_0x5b0a90;if(_0x793946[_0xbd56('0x33')][_0xbd56('0x43')]){_0x1d08d1['include']=[{'all':!![]}];}return db[_0xbd56('0x42')]['findAll'](_0x1d08d1);})[_0xbd56('0x26')](function(_0x1b6a2c){_0x5f235a['rows']=_0x1b6a2c;return _0x5f235a;})[_0xbd56('0x26')](respondWithFilteredResult(_0xa54687,_0x1d08d1))[_0xbd56('0x44')](handleError(_0xa54687,null));};exports[_0xbd56('0x45')]=function(_0x153758,_0x2f5a82){var _0x234d7b={'raw':!![],'where':{'id':_0x153758['params']['id']}},_0x3840e6={};_0x3840e6[_0xbd56('0x31')]=_['keys'](db['SquareOdbc']['rawAttributes']);_0x3840e6['query']=_[_0xbd56('0x34')](_0x153758[_0xbd56('0x33')]);_0x3840e6[_0xbd56('0x35')]=_[_0xbd56('0x36')](_0x3840e6[_0xbd56('0x31')],_0x3840e6['query']);_0x234d7b[_0xbd56('0x37')]=_[_0xbd56('0x36')](_0x3840e6['model'],qs[_0xbd56('0x38')](_0x153758[_0xbd56('0x33')]['fields']));_0x234d7b[_0xbd56('0x37')]=_0x234d7b[_0xbd56('0x37')][_0xbd56('0x46')]?_0x234d7b[_0xbd56('0x37')]:_0x3840e6[_0xbd56('0x31')];if(_0x153758['query']['includeAll']){_0x234d7b[_0xbd56('0x47')]=[{'all':!![]}];}_0x234d7b=_[_0xbd56('0x40')]({},_0x234d7b,_0x153758[_0xbd56('0x41')]);return db[_0xbd56('0x42')]['find'](_0x234d7b)[_0xbd56('0x26')](handleEntityNotFound(_0x2f5a82,null))[_0xbd56('0x26')](respondWithResult(_0x2f5a82,null))[_0xbd56('0x44')](handleError(_0x2f5a82,null));};exports[_0xbd56('0x48')]=function(_0x284e54,_0x46d097){return db['SquareOdbc'][_0xbd56('0x48')](_0x284e54[_0xbd56('0x49')],{})[_0xbd56('0x26')](function(_0x5327ca){var _0x18f155=_0x284e54[_0xbd56('0x4a')][_0xbd56('0x27')]({'plain':!![]});if(!_0x18f155)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f155[_0xbd56('0x4b')]==='user'){var _0x578209=_0x5327ca[_0xbd56('0x27')]({'plain':!![]});var _0x49c92e='ODBC';return db[_0xbd56('0x4c')]['find']({'where':{'name':_0x49c92e,'userProfileId':_0x18f155['userProfileId']},'raw':!![]})[_0xbd56('0x26')](function(_0x3b9299){if(_0x3b9299&&_0x3b9299[_0xbd56('0x4d')]===0x0){return db[_0xbd56('0x29')][_0xbd56('0x48')]({'name':_0x578209[_0xbd56('0x2c')],'resourceId':_0x578209['id'],'type':_0x3b9299[_0xbd56('0x2c')],'sectionId':_0x3b9299['id']},{})[_0xbd56('0x26')](function(){return _0x5327ca;});}else{return _0x5327ca;}})[_0xbd56('0x44')](function(_0x7371cb){logger[_0xbd56('0x2b')](_0xbd56('0x4e'),_0x7371cb);throw _0x7371cb;});}return _0x5327ca;})['then'](respondWithResult(_0x46d097,0xc9))[_0xbd56('0x44')](handleError(_0x46d097,null));};exports[_0xbd56('0x25')]=function(_0x45d4d7,_0x27cd52){if(_0x45d4d7[_0xbd56('0x49')]['id']){delete _0x45d4d7[_0xbd56('0x49')]['id'];}return db[_0xbd56('0x42')]['find']({'where':{'id':_0x45d4d7[_0xbd56('0x4f')]['id']}})[_0xbd56('0x26')](handleEntityNotFound(_0x27cd52,null))[_0xbd56('0x26')](saveUpdates(_0x45d4d7['body'],null))[_0xbd56('0x26')](respondWithResult(_0x27cd52,null))[_0xbd56('0x44')](handleError(_0x27cd52,null));};exports[_0xbd56('0x2a')]=function(_0x29f2f3,_0x1f9e75){return db['SquareOdbc'][_0xbd56('0x50')]({'where':{'id':_0x29f2f3['params']['id']}})[_0xbd56('0x26')](handleEntityNotFound(_0x1f9e75,null))[_0xbd56('0x26')](removeEntity(_0x1f9e75,null))[_0xbd56('0x44')](handleError(_0x1f9e75,null));};exports[_0xbd56('0x51')]=function(_0x3ab30a,_0x5e6e9c,_0x50faf2){var _0x4cde70;return db['SquareOdbc'][_0xbd56('0x50')]({'where':{'id':_0x3ab30a[_0xbd56('0x4f')]['id']},'attributes':['id',_0xbd56('0x52')]})[_0xbd56('0x26')](handleEntityNotFound(_0x5e6e9c,null))['then'](function(_0x220759){if(_0x220759){var _0x202d79=require(_0xbd56('0x53'))();_0x202d79[_0xbd56('0x54')](_0x220759['dsn']);_0x202d79[_0xbd56('0x55')]();return _0x220759;}})[_0xbd56('0x26')](respondWithResult(_0x5e6e9c,null))[_0xbd56('0x44')](handleError(_0x5e6e9c,null));}; \ No newline at end of file +var _0x4d2a=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','update','then','destroy','get','ODBC','UserProfileResource','error','name','map','SquareOdbc','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','include','create','body','user','role','UserProfileSection','find','autoAssociation','catch','params','test','odbc','openSync','dsn','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x320f44,_0x2619b8){var _0x460136=function(_0x49b981){while(--_0x49b981){_0x320f44['push'](_0x320f44['shift']());}};_0x460136(++_0x2619b8);}(_0x4d2a,0x1cf));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa4d2('0x0'));var rimraf=require(_0xa4d2('0x1'));var zipdir=require(_0xa4d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4d2('0x3'));var moment=require('moment');var BPromise=require(_0xa4d2('0x4'));var Mustache=require('mustache');var util=require(_0xa4d2('0x5'));var path=require(_0xa4d2('0x6'));var sox=require(_0xa4d2('0x7'));var csv=require('to-csv');var ejs=require(_0xa4d2('0x8'));var fs=require('fs');var fs_extra=require(_0xa4d2('0x9'));var _=require(_0xa4d2('0xa'));var squel=require(_0xa4d2('0xb'));var crypto=require(_0xa4d2('0xc'));var jsforce=require(_0xa4d2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa4d2('0xe'));var querystring=require(_0xa4d2('0xf'));var Papa=require(_0xa4d2('0x10'));var Redis=require('ioredis');var authService=require(_0xa4d2('0x11'));var qs=require(_0xa4d2('0x12'));var as=require(_0xa4d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4d2('0x14'))(_0xa4d2('0x15'));var utils=require('../../config/utils');var config=require(_0xa4d2('0x16'));var licenseUtil=require(_0xa4d2('0x17'));var db=require(_0xa4d2('0x18'))['db'];function respondWithStatusCode(_0x5cde54,_0x36e34a){_0x36e34a=_0x36e34a||0xcc;return function(_0x16e782){if(_0x16e782){return _0x5cde54[_0xa4d2('0x19')](_0x36e34a);}return _0x5cde54[_0xa4d2('0x1a')](_0x36e34a)[_0xa4d2('0x1b')]();};}function respondWithResult(_0x55e1da,_0x4d9a1b){_0x4d9a1b=_0x4d9a1b||0xc8;return function(_0x2f2ba9){if(_0x2f2ba9){return _0x55e1da[_0xa4d2('0x1a')](_0x4d9a1b)['json'](_0x2f2ba9);}};}function respondWithFilteredResult(_0x511578,_0x2e1e78){return function(_0x2451d9){if(_0x2451d9){var _0x7ca645=typeof _0x2e1e78[_0xa4d2('0x1c')]===_0xa4d2('0x1d')&&typeof _0x2e1e78[_0xa4d2('0x1e')]===_0xa4d2('0x1d');var _0x4b853b=_0x2451d9['count'];var _0x1102df=_0x7ca645?0x0:_0x2e1e78[_0xa4d2('0x1c')];var _0x5d66e2=_0x7ca645?_0x2451d9[_0xa4d2('0x1f')]:_0x2e1e78['offset']+_0x2e1e78[_0xa4d2('0x1e')];var _0x165357;if(_0x5d66e2>=_0x4b853b){_0x5d66e2=_0x4b853b;_0x165357=0xc8;}else{_0x165357=0xce;}_0x511578[_0xa4d2('0x1a')](_0x165357);return _0x511578['set']('Content-Range',_0x1102df+'-'+_0x5d66e2+'/'+_0x4b853b)[_0xa4d2('0x20')](_0x2451d9);}return null;};}function patchUpdates(_0x32e397){return function(_0x8fbc62){try{jsonpatch[_0xa4d2('0x21')](_0x8fbc62,_0x32e397,!![]);}catch(_0x488500){return BPromise['reject'](_0x488500);}return _0x8fbc62['save']();};}function saveUpdates(_0x2f64e3,_0x44c653){return function(_0x321b33){if(_0x321b33){return _0x321b33[_0xa4d2('0x22')](_0x2f64e3)[_0xa4d2('0x23')](function(_0x48f506){return _0x48f506;});}return null;};}function removeEntity(_0x183d11,_0x1fe757){return function(_0x3f4f91){if(_0x3f4f91){return _0x3f4f91[_0xa4d2('0x24')]()[_0xa4d2('0x23')](function(){var _0x48b474=_0x3f4f91[_0xa4d2('0x25')]({'plain':!![]});var _0x6da3c4=_0xa4d2('0x26');return db[_0xa4d2('0x27')][_0xa4d2('0x24')]({'where':{'type':_0x6da3c4,'resourceId':_0x48b474['id']}})[_0xa4d2('0x23')](function(){return _0x3f4f91;});})[_0xa4d2('0x23')](function(){_0x183d11[_0xa4d2('0x1a')](0xcc)[_0xa4d2('0x1b')]();});}};}function handleEntityNotFound(_0x1a9118,_0x7bc4e6){return function(_0x58c532){if(!_0x58c532){_0x1a9118[_0xa4d2('0x19')](0x194);}return _0x58c532;};}function handleError(_0x328a7f,_0x38f4b0){_0x38f4b0=_0x38f4b0||0x1f4;return function(_0x2fd3b4){logger[_0xa4d2('0x28')](_0x2fd3b4['stack']);if(_0x2fd3b4[_0xa4d2('0x29')]){delete _0x2fd3b4[_0xa4d2('0x29')];}_0x328a7f[_0xa4d2('0x1a')](_0x38f4b0)['send'](_0x2fd3b4);};}exports['index']=function(_0x4b372d,_0x4fcec0){var _0x100dc7={},_0x4acf66={},_0x405b3b={'count':0x0,'rows':[]};var _0x31a4da=_[_0xa4d2('0x2a')](db[_0xa4d2('0x2b')][_0xa4d2('0x2c')],function(_0x179864){return{'name':_0x179864[_0xa4d2('0x2d')],'type':_0x179864[_0xa4d2('0x2e')]['key']};});_0x4acf66['model']=_[_0xa4d2('0x2a')](_0x31a4da,_0xa4d2('0x29'));_0x4acf66[_0xa4d2('0x2f')]=_[_0xa4d2('0x30')](_0x4b372d[_0xa4d2('0x2f')]);_0x4acf66[_0xa4d2('0x31')]=_[_0xa4d2('0x32')](_0x4acf66['model'],_0x4acf66['query']);_0x100dc7[_0xa4d2('0x33')]=_[_0xa4d2('0x32')](_0x4acf66[_0xa4d2('0x34')],qs[_0xa4d2('0x35')](_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x35')]));_0x100dc7[_0xa4d2('0x33')]=_0x100dc7['attributes'][_0xa4d2('0x36')]?_0x100dc7[_0xa4d2('0x33')]:_0x4acf66[_0xa4d2('0x34')];if(!_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x37')](_0xa4d2('0x38'))){_0x100dc7[_0xa4d2('0x1e')]=qs['limit'](_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x1e')]);_0x100dc7[_0xa4d2('0x1c')]=qs[_0xa4d2('0x1c')](_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x1c')]);}_0x100dc7['order']=qs['sort'](_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x39')]);_0x100dc7[_0xa4d2('0x3a')]=qs[_0xa4d2('0x31')](_[_0xa4d2('0x3b')](_0x4b372d[_0xa4d2('0x2f')],_0x4acf66[_0xa4d2('0x31')]),_0x31a4da);if(_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x3c')]){_0x100dc7[_0xa4d2('0x3a')]=_[_0xa4d2('0x3d')](_0x100dc7[_0xa4d2('0x3a')],{'$or':_[_0xa4d2('0x2a')](_0x31a4da,function(_0x13f960){if(_0x13f960['type']!==_0xa4d2('0x3e')){var _0x401ee8={};_0x401ee8[_0x13f960['name']]={'$like':'%'+_0x4b372d['query'][_0xa4d2('0x3c')]+'%'};return _0x401ee8;}})});}_0x100dc7=_[_0xa4d2('0x3d')]({},_0x100dc7,_0x4b372d[_0xa4d2('0x3f')]);var _0x48bdfa={'where':_0x100dc7[_0xa4d2('0x3a')]};return db[_0xa4d2('0x2b')][_0xa4d2('0x1f')](_0x48bdfa)['then'](function(_0x2f1cd0){_0x405b3b[_0xa4d2('0x1f')]=_0x2f1cd0;if(_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x40')]){_0x100dc7['include']=[{'all':!![]}];}return db[_0xa4d2('0x2b')][_0xa4d2('0x41')](_0x100dc7);})[_0xa4d2('0x23')](function(_0x46e8c2){_0x405b3b[_0xa4d2('0x42')]=_0x46e8c2;return _0x405b3b;})[_0xa4d2('0x23')](respondWithFilteredResult(_0x4fcec0,_0x100dc7))['catch'](handleError(_0x4fcec0,null));};exports['show']=function(_0x75b7e7,_0x476945){var _0x1f2938={'raw':!![],'where':{'id':_0x75b7e7['params']['id']}},_0x5fb36={};_0x5fb36[_0xa4d2('0x34')]=_['keys'](db[_0xa4d2('0x2b')][_0xa4d2('0x2c')]);_0x5fb36[_0xa4d2('0x2f')]=_[_0xa4d2('0x30')](_0x75b7e7[_0xa4d2('0x2f')]);_0x5fb36['filters']=_[_0xa4d2('0x32')](_0x5fb36[_0xa4d2('0x34')],_0x5fb36[_0xa4d2('0x2f')]);_0x1f2938[_0xa4d2('0x33')]=_['intersection'](_0x5fb36[_0xa4d2('0x34')],qs['fields'](_0x75b7e7[_0xa4d2('0x2f')][_0xa4d2('0x35')]));_0x1f2938['attributes']=_0x1f2938[_0xa4d2('0x33')][_0xa4d2('0x36')]?_0x1f2938['attributes']:_0x5fb36[_0xa4d2('0x34')];if(_0x75b7e7['query']['includeAll']){_0x1f2938[_0xa4d2('0x43')]=[{'all':!![]}];}_0x1f2938=_[_0xa4d2('0x3d')]({},_0x1f2938,_0x75b7e7['options']);return db[_0xa4d2('0x2b')]['find'](_0x1f2938)[_0xa4d2('0x23')](handleEntityNotFound(_0x476945,null))[_0xa4d2('0x23')](respondWithResult(_0x476945,null))['catch'](handleError(_0x476945,null));};exports[_0xa4d2('0x44')]=function(_0xca14ff,_0x14d8c1){return db['SquareOdbc']['create'](_0xca14ff[_0xa4d2('0x45')],{})[_0xa4d2('0x23')](function(_0x25dd5f){var _0x51f4ea=_0xca14ff[_0xa4d2('0x46')][_0xa4d2('0x25')]({'plain':!![]});if(!_0x51f4ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51f4ea[_0xa4d2('0x47')]===_0xa4d2('0x46')){var _0xdb1fe0=_0x25dd5f[_0xa4d2('0x25')]({'plain':!![]});var _0x15eee5=_0xa4d2('0x26');return db[_0xa4d2('0x48')][_0xa4d2('0x49')]({'where':{'name':_0x15eee5,'userProfileId':_0x51f4ea['userProfileId']},'raw':!![]})['then'](function(_0x1273ab){if(_0x1273ab&&_0x1273ab[_0xa4d2('0x4a')]===0x0){return db[_0xa4d2('0x27')]['create']({'name':_0xdb1fe0[_0xa4d2('0x29')],'resourceId':_0xdb1fe0['id'],'type':_0x1273ab[_0xa4d2('0x29')],'sectionId':_0x1273ab['id']},{})[_0xa4d2('0x23')](function(){return _0x25dd5f;});}else{return _0x25dd5f;}})[_0xa4d2('0x4b')](function(_0x26f2ab){logger[_0xa4d2('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26f2ab);throw _0x26f2ab;});}return _0x25dd5f;})['then'](respondWithResult(_0x14d8c1,0xc9))['catch'](handleError(_0x14d8c1,null));};exports[_0xa4d2('0x22')]=function(_0x30aca0,_0x31d108){if(_0x30aca0[_0xa4d2('0x45')]['id']){delete _0x30aca0[_0xa4d2('0x45')]['id'];}return db[_0xa4d2('0x2b')][_0xa4d2('0x49')]({'where':{'id':_0x30aca0[_0xa4d2('0x4c')]['id']}})[_0xa4d2('0x23')](handleEntityNotFound(_0x31d108,null))[_0xa4d2('0x23')](saveUpdates(_0x30aca0[_0xa4d2('0x45')],null))[_0xa4d2('0x23')](respondWithResult(_0x31d108,null))['catch'](handleError(_0x31d108,null));};exports[_0xa4d2('0x24')]=function(_0x2808b7,_0xf3ed84){return db[_0xa4d2('0x2b')][_0xa4d2('0x49')]({'where':{'id':_0x2808b7[_0xa4d2('0x4c')]['id']}})[_0xa4d2('0x23')](handleEntityNotFound(_0xf3ed84,null))[_0xa4d2('0x23')](removeEntity(_0xf3ed84,null))['catch'](handleError(_0xf3ed84,null));};exports[_0xa4d2('0x4d')]=function(_0x54b7e7,_0x2588bf,_0x4afa53){var _0x2c33c2;return db[_0xa4d2('0x2b')]['find']({'where':{'id':_0x54b7e7[_0xa4d2('0x4c')]['id']},'attributes':['id','dsn']})[_0xa4d2('0x23')](handleEntityNotFound(_0x2588bf,null))[_0xa4d2('0x23')](function(_0x30849b){if(_0x30849b){var _0x10afa8=require(_0xa4d2('0x4e'))();_0x10afa8[_0xa4d2('0x4f')](_0x30849b[_0xa4d2('0x50')]);_0x10afa8['closeSync']();return _0x30849b;}})[_0xa4d2('0x23')](respondWithResult(_0x2588bf,null))[_0xa4d2('0x4b')](handleError(_0x2588bf,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 20ea571..6360940 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 _0x1b0b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1b0b,0x1c7));var _0xb1b0=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x1b0b[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb1b0('0x0'))(_0xb1b0('0x1'));var moment=require(_0xb1b0('0x2'));var BPromise=require(_0xb1b0('0x3'));var rp=require(_0xb1b0('0x4'));var fs=require('fs');var path=require(_0xb1b0('0x5'));var rimraf=require(_0xb1b0('0x6'));var config=require(_0xb1b0('0x7'));var attributes=require(_0xb1b0('0x8'));module[_0xb1b0('0x9')]=function(_0x5ecfa7,_0x57c92f){return _0x5ecfa7[_0xb1b0('0xa')](_0xb1b0('0xb'),attributes,{'tableName':_0xb1b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c58=['path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','moment','request-promise'];(function(_0x20185a,_0x3bd0e6){var _0x5a471d=function(_0xc30f14){while(--_0xc30f14){_0x20185a['push'](_0x20185a['shift']());}};_0x5a471d(++_0x3bd0e6);}(_0x0c58,0x1a9));var _0x80c5=function(_0x57e771,_0xa06379){_0x57e771=_0x57e771-0x0;var _0x41049c=_0x0c58[_0x57e771];return _0x41049c;};'use strict';var _=require(_0x80c5('0x0'));var util=require(_0x80c5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x80c5('0x2'));var BPromise=require('bluebird');var rp=require(_0x80c5('0x3'));var fs=require('fs');var path=require(_0x80c5('0x4'));var rimraf=require(_0x80c5('0x5'));var config=require('../../config/environment');var attributes=require(_0x80c5('0x6'));module[_0x80c5('0x7')]=function(_0x290251,_0x516d5e){return _0x290251[_0x80c5('0x8')](_0x80c5('0x9'),attributes,{'tableName':_0x80c5('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 c816181..8f90c7e 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 _0x9735=['client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x32cf56,_0x58ed3a){var _0x1f4d8f=function(_0x134638){while(--_0x134638){_0x32cf56['push'](_0x32cf56['shift']());}};_0x1f4d8f(++_0x58ed3a);}(_0x9735,0x1a5));var _0x5973=function(_0x3b664e,_0x1919f5){_0x3b664e=_0x3b664e-0x0;var _0x2f0b07=_0x9735[_0x3b664e];return _0x2f0b07;};'use strict';var _=require(_0x5973('0x0'));var util=require(_0x5973('0x1'));var moment=require(_0x5973('0x2'));var BPromise=require(_0x5973('0x3'));var rs=require(_0x5973('0x4'));var fs=require('fs');var Redis=require(_0x5973('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5973('0x6'))(_0x5973('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5973('0x8')][_0x5973('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11ef6f,_0x24dd27,_0x455ecd){return new BPromise(function(_0x2108de,_0x407a16){return client[_0x5973('0xa')](_0x11ef6f,_0x455ecd)[_0x5973('0xb')](function(_0x5af092){logger[_0x5973('0xc')](_0x5973('0xd'),_0x24dd27,_0x5973('0xe'));logger[_0x5973('0xf')](_0x5973('0x10'),_0x24dd27,_0x5973('0xe'),JSON['stringify'](_0x5af092));if(_0x5af092[_0x5973('0x11')]){if(_0x5af092[_0x5973('0x11')][_0x5973('0x12')]===0x1f4){logger[_0x5973('0x11')](_0x5973('0xd'),_0x24dd27,_0x5af092['error']['message']);return _0x407a16(_0x5af092[_0x5973('0x11')][_0x5973('0x13')]);}logger[_0x5973('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x24dd27,_0x5af092[_0x5973('0x11')][_0x5973('0x13')]);return _0x2108de(_0x5af092['error'][_0x5973('0x13')]);}else{logger[_0x5973('0xc')](_0x5973('0xd'),_0x24dd27,_0x5973('0xe'));_0x2108de(_0x5af092[_0x5973('0x14')]['message']);}})[_0x5973('0x15')](function(_0xbd7d74){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x24dd27,_0xbd7d74);_0x407a16(_0xbd7d74);});});}exports[_0x5973('0x16')]=function(_0x148439){var _0x5a8eea=this;return new Promise(function(_0x2f0414,_0x1e60fd){return db[_0x5973('0x17')][_0x5973('0x18')]({'raw':_0x148439[_0x5973('0x19')]?_0x148439[_0x5973('0x19')][_0x5973('0x1a')]===undefined?!![]:![]:!![],'where':_0x148439[_0x5973('0x19')]?_0x148439[_0x5973('0x19')][_0x5973('0x1b')]||null:null,'attributes':_0x148439[_0x5973('0x19')]?_0x148439[_0x5973('0x19')][_0x5973('0x1c')]||null:null,'include':_0x148439[_0x5973('0x19')]?_0x148439[_0x5973('0x19')][_0x5973('0x1d')]?_['map'](_0x148439[_0x5973('0x19')][_0x5973('0x1d')],function(_0x267563){return{'model':db[_0x267563[_0x5973('0x1e')]],'as':_0x267563['as'],'attributes':_0x267563[_0x5973('0x1c')],'include':_0x267563['include']?_[_0x5973('0x1f')](_0x267563['include'],function(_0x77f23f){return{'model':db[_0x77f23f[_0x5973('0x1e')]],'as':_0x77f23f['as'],'attributes':_0x77f23f[_0x5973('0x1c')],'include':_0x77f23f[_0x5973('0x1d')]?_[_0x5973('0x1f')](_0x77f23f[_0x5973('0x1d')],function(_0x430b09){return{'model':db[_0x430b09[_0x5973('0x1e')]],'as':_0x430b09['as'],'attributes':_0x430b09[_0x5973('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5973('0xb')](function(_0x2768d7){logger['info'](_0x5973('0x16'),_0x148439);logger['debug'](_0x5973('0x16'),_0x148439,JSON[_0x5973('0x20')](_0x2768d7));_0x2f0414(_0x2768d7);})[_0x5973('0x15')](function(_0x163047){logger[_0x5973('0x11')](_0x5973('0x16'),_0x163047[_0x5973('0x13')],_0x148439);_0x1e60fd(_0x5a8eea[_0x5973('0x11')](0x1f4,_0x163047[_0x5973('0x13')]));});});}; \ No newline at end of file +var _0x4e76=['options','raw','where','include','model','map','attributes','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','ShowSquareOdbc'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4e76,0x1b9));var _0x64e7=function(_0x2360a0,_0x303a69){_0x2360a0=_0x2360a0-0x0;var _0x40055e=_0x4e76[_0x2360a0];return _0x40055e;};'use strict';var _=require(_0x64e7('0x0'));var util=require(_0x64e7('0x1'));var moment=require(_0x64e7('0x2'));var BPromise=require(_0x64e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64e7('0x5'));var logger=require(_0x64e7('0x6'))(_0x64e7('0x7'));var config=require('../../config/environment');var jayson=require(_0x64e7('0x8'));var client=jayson[_0x64e7('0x9')][_0x64e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22c8cb,_0x335252,_0x33d1e2){return new BPromise(function(_0x32779a,_0x248e43){return client[_0x64e7('0xb')](_0x22c8cb,_0x33d1e2)[_0x64e7('0xc')](function(_0x80a939){logger[_0x64e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x335252,'request\x20sent');logger[_0x64e7('0xe')](_0x64e7('0xf'),_0x335252,_0x64e7('0x10'),JSON[_0x64e7('0x11')](_0x80a939));if(_0x80a939[_0x64e7('0x12')]){if(_0x80a939[_0x64e7('0x12')][_0x64e7('0x13')]===0x1f4){logger[_0x64e7('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x335252,_0x80a939['error'][_0x64e7('0x14')]);return _0x248e43(_0x80a939[_0x64e7('0x12')][_0x64e7('0x14')]);}logger[_0x64e7('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x335252,_0x80a939['error'][_0x64e7('0x14')]);return _0x32779a(_0x80a939[_0x64e7('0x12')]['message']);}else{logger['info'](_0x64e7('0x15'),_0x335252,'request\x20sent');_0x32779a(_0x80a939[_0x64e7('0x16')]['message']);}})['catch'](function(_0x21a5c2){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x335252,_0x21a5c2);_0x248e43(_0x21a5c2);});});}exports[_0x64e7('0x17')]=function(_0x1d6a57){var _0x16171b=this;return new Promise(function(_0x31c58e,_0x4d4a60){return db['SquareOdbc']['find']({'raw':_0x1d6a57[_0x64e7('0x18')]?_0x1d6a57['options'][_0x64e7('0x19')]===undefined?!![]:![]:!![],'where':_0x1d6a57[_0x64e7('0x18')]?_0x1d6a57[_0x64e7('0x18')][_0x64e7('0x1a')]||null:null,'attributes':_0x1d6a57[_0x64e7('0x18')]?_0x1d6a57['options']['attributes']||null:null,'include':_0x1d6a57['options']?_0x1d6a57[_0x64e7('0x18')][_0x64e7('0x1b')]?_['map'](_0x1d6a57[_0x64e7('0x18')][_0x64e7('0x1b')],function(_0x10657e){return{'model':db[_0x10657e[_0x64e7('0x1c')]],'as':_0x10657e['as'],'attributes':_0x10657e['attributes'],'include':_0x10657e[_0x64e7('0x1b')]?_[_0x64e7('0x1d')](_0x10657e['include'],function(_0x1023bb){return{'model':db[_0x1023bb[_0x64e7('0x1c')]],'as':_0x1023bb['as'],'attributes':_0x1023bb[_0x64e7('0x1e')],'include':_0x1023bb[_0x64e7('0x1b')]?_['map'](_0x1023bb[_0x64e7('0x1b')],function(_0x2ac4d9){return{'model':db[_0x2ac4d9[_0x64e7('0x1c')]],'as':_0x2ac4d9['as'],'attributes':_0x2ac4d9['attributes']};}):[]};}):[]};}):[]:[]})[_0x64e7('0xc')](function(_0x36ad98){logger[_0x64e7('0xd')](_0x64e7('0x17'),_0x1d6a57);logger['debug']('ShowSquareOdbc',_0x1d6a57,JSON[_0x64e7('0x11')](_0x36ad98));_0x31c58e(_0x36ad98);})['catch'](function(_0x2486fb){logger['error']('ShowSquareOdbc',_0x2486fb[_0x64e7('0x14')],_0x1d6a57);_0x4d4a60(_0x16171b[_0x64e7('0x12')](0x1f4,_0x2486fb[_0x64e7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index ccc0589..432de00 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 _0xfef3=['./squareProject.controller','get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','update','destroy','removeUsers','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5796d0,_0x2a4569){var _0x490adb=function(_0x26b827){while(--_0x26b827){_0x5796d0['push'](_0x5796d0['shift']());}};_0x490adb(++_0x2a4569);}(_0xfef3,0x118));var _0x3fef=function(_0x2b36fd,_0x156106){_0x2b36fd=_0x2b36fd-0x0;var _0x3df453=_0xfef3[_0x2b36fd];return _0x3df453;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fef('0x4'));var interaction=require(_0x3fef('0x5'));var config=require('../../config/environment');var controller=require(_0x3fef('0x6'));router[_0x3fef('0x7')]('/',auth['isAuthenticated'](),controller[_0x3fef('0x8')]);router[_0x3fef('0x7')](_0x3fef('0x9'),auth[_0x3fef('0xa')](),controller[_0x3fef('0xb')]);router[_0x3fef('0x7')](_0x3fef('0xc'),auth[_0x3fef('0xa')](),controller[_0x3fef('0xd')]);router[_0x3fef('0xe')]('/',auth[_0x3fef('0xa')](),controller[_0x3fef('0xf')]);router[_0x3fef('0xe')](_0x3fef('0xc'),auth['isAuthenticated'](),controller[_0x3fef('0x10')]);router[_0x3fef('0x11')](_0x3fef('0x9'),auth['isAuthenticated'](),controller[_0x3fef('0x12')]);router['delete'](_0x3fef('0x9'),auth[_0x3fef('0xa')](),controller[_0x3fef('0x13')]);router['delete'](_0x3fef('0xc'),auth['isAuthenticated'](),controller[_0x3fef('0x14')]);module[_0x3fef('0x15')]=router; \ No newline at end of file +var _0xf960=['delete','destroy','removeUsers','exports','multer','path','express','Router','../../components/auth/service','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','getUsers','post','create','addUsers','put','/:id'];(function(_0x32a884,_0x183853){var _0x242f9b=function(_0x556c63){while(--_0x556c63){_0x32a884['push'](_0x32a884['shift']());}};_0x242f9b(++_0x183853);}(_0xf960,0x193));var _0x0f96=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0xf960[_0x5235a6];return _0x1cf37e;};'use strict';var multer=require(_0x0f96('0x0'));var util=require('util');var path=require(_0x0f96('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f96('0x2'));var router=express[_0x0f96('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0f96('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0f96('0x5'));router[_0x0f96('0x6')]('/',auth[_0x0f96('0x7')](),controller[_0x0f96('0x8')]);router[_0x0f96('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x0f96('0x9')]);router[_0x0f96('0x6')](_0x0f96('0xa'),auth[_0x0f96('0x7')](),controller[_0x0f96('0xb')]);router[_0x0f96('0xc')]('/',auth['isAuthenticated'](),controller[_0x0f96('0xd')]);router['post'](_0x0f96('0xa'),auth['isAuthenticated'](),controller[_0x0f96('0xe')]);router[_0x0f96('0xf')](_0x0f96('0x10'),auth[_0x0f96('0x7')](),controller['update']);router[_0x0f96('0x11')](_0x0f96('0x10'),auth[_0x0f96('0x7')](),controller[_0x0f96('0x12')]);router['delete'](_0x0f96('0xa'),auth[_0x0f96('0x7')](),controller[_0x0f96('0x13')]);module[_0x0f96('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 38c97a8..786e6a9 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 _0x7cf8=['sequelize','exports','STRING','name','TEXT','BLOB','preproduction','getDataValue','toString','utf8','long','production','DATE'];(function(_0xcd9ec8,_0x27699f){var _0x5aa31b=function(_0x32f922){while(--_0x32f922){_0xcd9ec8['push'](_0xcd9ec8['shift']());}};_0x5aa31b(++_0x27699f);}(_0x7cf8,0xa9));var _0x87cf=function(_0x2bb35c,_0x1fe5ec){_0x2bb35c=_0x2bb35c-0x0;var _0x377721=_0x7cf8[_0x2bb35c];return _0x377721;};'use strict';var Sequelize=require(_0x87cf('0x0'));module[_0x87cf('0x1')]={'name':{'type':Sequelize[_0x87cf('0x2')],'unique':_0x87cf('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x87cf('0x2')]},'notes':{'type':Sequelize[_0x87cf('0x4')]},'preproduction':{'type':Sequelize[_0x87cf('0x5')]('long'),'get':function(){if(this['getDataValue'](_0x87cf('0x6'))){return this[_0x87cf('0x7')](_0x87cf('0x6'))[_0x87cf('0x8')](_0x87cf('0x9'));}}},'production':{'type':Sequelize[_0x87cf('0x5')](_0x87cf('0xa')),'get':function(){if(this[_0x87cf('0x7')](_0x87cf('0xb'))){return this[_0x87cf('0x7')](_0x87cf('0xb'))['toString'](_0x87cf('0x9'));}}},'savedAt':{'type':Sequelize[_0x87cf('0xc')]},'publishedAt':{'type':Sequelize[_0x87cf('0xc')]}}; \ No newline at end of file +var _0x70c8=['getDataValue','preproduction','utf8','production','toString','sequelize','exports','STRING','name','TEXT','BLOB','long'];(function(_0x59eedb,_0x8de8a1){var _0x451bff=function(_0x687719){while(--_0x687719){_0x59eedb['push'](_0x59eedb['shift']());}};_0x451bff(++_0x8de8a1);}(_0x70c8,0x7d));var _0x870c=function(_0x2acdeb,_0x24fd65){_0x2acdeb=_0x2acdeb-0x0;var _0xeeb060=_0x70c8[_0x2acdeb];return _0xeeb060;};'use strict';var Sequelize=require(_0x870c('0x0'));module[_0x870c('0x1')]={'name':{'type':Sequelize[_0x870c('0x2')],'unique':_0x870c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x870c('0x2')]},'notes':{'type':Sequelize[_0x870c('0x4')]},'preproduction':{'type':Sequelize[_0x870c('0x5')](_0x870c('0x6')),'get':function(){if(this[_0x870c('0x7')]('preproduction')){return this[_0x870c('0x7')](_0x870c('0x8'))['toString'](_0x870c('0x9'));}}},'production':{'type':Sequelize[_0x870c('0x5')]('long'),'get':function(){if(this[_0x870c('0x7')](_0x870c('0xa'))){return this[_0x870c('0x7')](_0x870c('0xa'))[_0x870c('0xb')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 3772ef7..781d0e3 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 _0xf915=['type','VIRTUAL','includeAll','include','SquareProject','findAll','rows','catch','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','SquareProjects','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0xf915,0x142));var _0x5f91=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf915[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f91('0x0'));var zipdir=require(_0x5f91('0x1'));var jsonpatch=require(_0x5f91('0x2'));var rp=require(_0x5f91('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f91('0x4'));var util=require(_0x5f91('0x5'));var path=require(_0x5f91('0x6'));var sox=require(_0x5f91('0x7'));var csv=require(_0x5f91('0x8'));var ejs=require(_0x5f91('0x9'));var fs=require('fs');var fs_extra=require(_0x5f91('0xa'));var _=require(_0x5f91('0xb'));var squel=require(_0x5f91('0xc'));var crypto=require('crypto');var jsforce=require(_0x5f91('0xd'));var deskjs=require(_0x5f91('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5f91('0xf'));var Papa=require('papaparse');var Redis=require(_0x5f91('0x10'));var authService=require(_0x5f91('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5f91('0x12'));var hardwareService=require(_0x5f91('0x13'));var logger=require(_0x5f91('0x14'))(_0x5f91('0x15'));var utils=require(_0x5f91('0x16'));var config=require(_0x5f91('0x17'));var licenseUtil=require(_0x5f91('0x18'));var db=require(_0x5f91('0x19'))['db'];config[_0x5f91('0x1a')]=_[_0x5f91('0x1b')](config[_0x5f91('0x1a')],{'host':_0x5f91('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f91('0x1a')]));require(_0x5f91('0x1d'))[_0x5f91('0x1e')](socket);function respondWithStatusCode(_0x4f10af,_0x159678){_0x159678=_0x159678||0xcc;return function(_0x3b035b){if(_0x3b035b){return _0x4f10af[_0x5f91('0x1f')](_0x159678);}return _0x4f10af[_0x5f91('0x20')](_0x159678)[_0x5f91('0x21')]();};}function respondWithResult(_0x1c6e47,_0x17d5fd){_0x17d5fd=_0x17d5fd||0xc8;return function(_0x3a2c46){if(_0x3a2c46){return _0x1c6e47[_0x5f91('0x20')](_0x17d5fd)[_0x5f91('0x22')](_0x3a2c46);}};}function respondWithFilteredResult(_0x18d055,_0x1d6538){return function(_0x50c547){if(_0x50c547){var _0x219b30=typeof _0x1d6538[_0x5f91('0x23')]==='undefined'&&typeof _0x1d6538[_0x5f91('0x24')]==='undefined';var _0x2fa8b3=_0x50c547[_0x5f91('0x25')];var _0x4d6c6a=_0x219b30?0x0:_0x1d6538[_0x5f91('0x23')];var _0x416b54=_0x219b30?_0x50c547[_0x5f91('0x25')]:_0x1d6538['offset']+_0x1d6538[_0x5f91('0x24')];var _0x4476e0;if(_0x416b54>=_0x2fa8b3){_0x416b54=_0x2fa8b3;_0x4476e0=0xc8;}else{_0x4476e0=0xce;}_0x18d055[_0x5f91('0x20')](_0x4476e0);return _0x18d055[_0x5f91('0x26')](_0x5f91('0x27'),_0x4d6c6a+'-'+_0x416b54+'/'+_0x2fa8b3)[_0x5f91('0x22')](_0x50c547);}return null;};}function patchUpdates(_0x3efeef){return function(_0x1700ac){try{jsonpatch[_0x5f91('0x28')](_0x1700ac,_0x3efeef,!![]);}catch(_0x1a1080){return BPromise[_0x5f91('0x29')](_0x1a1080);}return _0x1700ac[_0x5f91('0x2a')]();};}function saveUpdates(_0x56c08c,_0x2806b4){return function(_0x5c655d){if(_0x5c655d){return _0x5c655d[_0x5f91('0x2b')](_0x56c08c)[_0x5f91('0x2c')](function(_0x43d96a){return _0x43d96a;});}return null;};}function removeEntity(_0x171a30,_0x208f44){return function(_0x3257b4){if(_0x3257b4){return _0x3257b4['destroy']()['then'](function(){var _0x639ac2=_0x3257b4['get']({'plain':!![]});var _0x1a7037=_0x5f91('0x2d');return db[_0x5f91('0x2e')]['destroy']({'where':{'type':_0x1a7037,'resourceId':_0x639ac2['id']}})['then'](function(){return _0x3257b4;});})[_0x5f91('0x2c')](function(){_0x171a30['status'](0xcc)[_0x5f91('0x21')]();});}};}function handleEntityNotFound(_0x2c6e01,_0xc59968){return function(_0x37fff3){if(!_0x37fff3){_0x2c6e01[_0x5f91('0x1f')](0x194);}return _0x37fff3;};}function handleError(_0x40b0a2,_0xba33a4){_0xba33a4=_0xba33a4||0x1f4;return function(_0x5ba0ac){logger[_0x5f91('0x2f')](_0x5ba0ac[_0x5f91('0x30')]);if(_0x5ba0ac[_0x5f91('0x31')]){delete _0x5ba0ac['name'];}_0x40b0a2['status'](_0xba33a4)['send'](_0x5ba0ac);};}exports[_0x5f91('0x32')]=function(_0x16d4d8,_0xe2536d){var _0x304f66={},_0x12b2f3={},_0x12c61b={'count':0x0,'rows':[]};var _0x4be84f=_['map'](db['SquareProject'][_0x5f91('0x33')],function(_0x10879b){return{'name':_0x10879b[_0x5f91('0x34')],'type':_0x10879b['type'][_0x5f91('0x35')]};});_0x12b2f3[_0x5f91('0x36')]=_['map'](_0x4be84f,_0x5f91('0x31'));_0x12b2f3[_0x5f91('0x37')]=_[_0x5f91('0x38')](_0x16d4d8[_0x5f91('0x37')]);_0x12b2f3[_0x5f91('0x39')]=_[_0x5f91('0x3a')](_0x12b2f3[_0x5f91('0x36')],_0x12b2f3[_0x5f91('0x37')]);_0x304f66[_0x5f91('0x3b')]=_[_0x5f91('0x3a')](_0x12b2f3['model'],qs[_0x5f91('0x3c')](_0x16d4d8['query'][_0x5f91('0x3c')]));_0x304f66['attributes']=_0x304f66['attributes'][_0x5f91('0x3d')]?_0x304f66[_0x5f91('0x3b')]:_0x12b2f3['model'];if(!_0x16d4d8[_0x5f91('0x37')][_0x5f91('0x3e')](_0x5f91('0x3f'))){_0x304f66[_0x5f91('0x24')]=qs[_0x5f91('0x24')](_0x16d4d8['query']['limit']);_0x304f66[_0x5f91('0x23')]=qs[_0x5f91('0x23')](_0x16d4d8['query'][_0x5f91('0x23')]);}_0x304f66[_0x5f91('0x40')]=qs[_0x5f91('0x41')](_0x16d4d8['query'][_0x5f91('0x41')]);_0x304f66[_0x5f91('0x42')]=qs[_0x5f91('0x39')](_[_0x5f91('0x43')](_0x16d4d8[_0x5f91('0x37')],_0x12b2f3[_0x5f91('0x39')]),_0x4be84f);if(_0x16d4d8[_0x5f91('0x37')][_0x5f91('0x44')]){_0x304f66[_0x5f91('0x42')]=_[_0x5f91('0x45')](_0x304f66[_0x5f91('0x42')],{'$or':_['map'](_0x4be84f,function(_0x569f05){if(_0x569f05[_0x5f91('0x46')]!==_0x5f91('0x47')){var _0x4ac776={};_0x4ac776[_0x569f05[_0x5f91('0x31')]]={'$like':'%'+_0x16d4d8['query'][_0x5f91('0x44')]+'%'};return _0x4ac776;}})});}_0x304f66=_[_0x5f91('0x45')]({},_0x304f66,_0x16d4d8['options']);var _0x10899e={'where':_0x304f66[_0x5f91('0x42')]};return db['SquareProject'][_0x5f91('0x25')](_0x10899e)[_0x5f91('0x2c')](function(_0x2e1f67){_0x12c61b['count']=_0x2e1f67;if(_0x16d4d8['query'][_0x5f91('0x48')]){_0x304f66[_0x5f91('0x49')]=[{'all':!![]}];}return db[_0x5f91('0x4a')][_0x5f91('0x4b')](_0x304f66);})['then'](function(_0x3c634a){_0x12c61b[_0x5f91('0x4c')]=_0x3c634a;return _0x12c61b;})['then'](respondWithFilteredResult(_0xe2536d,_0x304f66))[_0x5f91('0x4d')](handleError(_0xe2536d,null));};exports['show']=function(_0x19ab5b,_0x5d0c61){var _0x187299={'raw':![],'where':{'id':_0x19ab5b[_0x5f91('0x4e')]['id']}},_0x38af1d={};_0x38af1d[_0x5f91('0x36')]=_[_0x5f91('0x38')](db[_0x5f91('0x4a')][_0x5f91('0x33')]);_0x38af1d[_0x5f91('0x37')]=_[_0x5f91('0x38')](_0x19ab5b[_0x5f91('0x37')]);_0x38af1d['filters']=_[_0x5f91('0x3a')](_0x38af1d[_0x5f91('0x36')],_0x38af1d[_0x5f91('0x37')]);_0x187299['attributes']=_[_0x5f91('0x3a')](_0x38af1d[_0x5f91('0x36')],qs[_0x5f91('0x3c')](_0x19ab5b['query'][_0x5f91('0x3c')]));_0x187299[_0x5f91('0x3b')]=_0x187299[_0x5f91('0x3b')][_0x5f91('0x3d')]?_0x187299[_0x5f91('0x3b')]:_0x38af1d[_0x5f91('0x36')];if(_0x19ab5b[_0x5f91('0x37')]['includeAll']){_0x187299[_0x5f91('0x49')]=[{'all':!![]}];}_0x187299=_[_0x5f91('0x45')]({},_0x187299,_0x19ab5b[_0x5f91('0x4f')]);return db[_0x5f91('0x4a')][_0x5f91('0x50')](_0x187299)[_0x5f91('0x2c')](handleEntityNotFound(_0x5d0c61,null))[_0x5f91('0x2c')](respondWithResult(_0x5d0c61,null))['catch'](handleError(_0x5d0c61,null));};exports[_0x5f91('0x51')]=function(_0x1d5ada,_0x443bfb){return db[_0x5f91('0x4a')][_0x5f91('0x51')](_0x1d5ada[_0x5f91('0x52')],{})[_0x5f91('0x2c')](function(_0x351c09){var _0x203063=_0x1d5ada['user'][_0x5f91('0x53')]({'plain':!![]});if(!_0x203063)throw new Error(_0x5f91('0x54'));if(_0x203063['role']===_0x5f91('0x55')){var _0x345a86=_0x351c09[_0x5f91('0x53')]({'plain':!![]});var _0x327313=_0x5f91('0x2d');return db[_0x5f91('0x56')][_0x5f91('0x50')]({'where':{'name':_0x327313,'userProfileId':_0x203063['userProfileId']},'raw':!![]})[_0x5f91('0x2c')](function(_0x152a3d){if(_0x152a3d&&_0x152a3d[_0x5f91('0x57')]===0x0){return db[_0x5f91('0x2e')][_0x5f91('0x51')]({'name':_0x345a86['name'],'resourceId':_0x345a86['id'],'type':_0x152a3d[_0x5f91('0x31')],'sectionId':_0x152a3d['id']},{})[_0x5f91('0x2c')](function(){return _0x351c09;});}else{return _0x351c09;}})[_0x5f91('0x4d')](function(_0x3361fa){logger['error'](_0x5f91('0x58'),_0x3361fa);throw _0x3361fa;});}return _0x351c09;})[_0x5f91('0x2c')](respondWithResult(_0x443bfb,0xc9))[_0x5f91('0x4d')](handleError(_0x443bfb,null));};exports['update']=function(_0x2b517a,_0x243648){if(_0x2b517a['body']['id']){delete _0x2b517a[_0x5f91('0x52')]['id'];}return db[_0x5f91('0x4a')][_0x5f91('0x50')]({'where':{'id':_0x2b517a['params']['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x243648,null))['then'](saveUpdates(_0x2b517a[_0x5f91('0x52')],null))[_0x5f91('0x2c')](respondWithResult(_0x243648,null))[_0x5f91('0x4d')](handleError(_0x243648,null));};exports['destroy']=function(_0x1169b2,_0x4ec2e0){return db[_0x5f91('0x4a')][_0x5f91('0x50')]({'where':{'id':_0x1169b2[_0x5f91('0x4e')]['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x4ec2e0,null))[_0x5f91('0x2c')](removeEntity(_0x4ec2e0,null))[_0x5f91('0x4d')](handleError(_0x4ec2e0,null));};exports[_0x5f91('0x59')]=function(_0x2662a5,_0x572879,_0x30cd03){return db[_0x5f91('0x4a')]['find']({'where':{'id':_0x2662a5[_0x5f91('0x4e')]['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x572879,null))[_0x5f91('0x2c')](function(_0x5187c2){if(_0x5187c2){return _0x5187c2[_0x5f91('0x59')](_0x2662a5[_0x5f91('0x52')][_0x5f91('0x5a')],_[_0x5f91('0x5b')](_0x2662a5['body'],['ids','id'])||{});}})[_0x5f91('0x2c')](respondWithResult(_0x572879,null))['catch'](handleError(_0x572879,null));};exports[_0x5f91('0x5c')]=function(_0x5059c7,_0x47fa9b,_0x34a291){return db['SquareProject'][_0x5f91('0x50')]({'where':{'id':_0x5059c7[_0x5f91('0x4e')]['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x47fa9b,null))[_0x5f91('0x2c')](function(_0x3d5959){if(_0x3d5959){return _0x3d5959[_0x5f91('0x5c')](_0x5059c7[_0x5f91('0x37')]['ids'])[_0x5f91('0x2c')](function(){if(_[_0x5f91('0x5d')](_0x5059c7[_0x5f91('0x37')][_0x5f91('0x5a')])){for(var _0x4bd0e4=0x0;_0x4bd0e4<_0x5059c7[_0x5f91('0x37')][_0x5f91('0x5a')]['length'];_0x4bd0e4+=0x1){socket[_0x5f91('0x5e')](_0x5f91('0x5f'),{'UserId':Number(_0x5059c7[_0x5f91('0x37')][_0x5f91('0x5a')][_0x4bd0e4]),'SquareProjectId':Number(_0x5059c7[_0x5f91('0x4e')]['id'])});}}else{socket[_0x5f91('0x5e')](_0x5f91('0x5f'),{'UserId':Number(_0x5059c7[_0x5f91('0x37')]['ids']),'SquareProjectId':Number(_0x5059c7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x47fa9b,null))['catch'](handleError(_0x47fa9b,null));};exports[_0x5f91('0x60')]=function(_0x196bcc,_0x47fdd4,_0x3756b5){var _0x1c5453={};var _0x292154={};var _0x2599f0;var _0xb5c284;return db[_0x5f91('0x4a')]['findOne']({'where':{'id':_0x196bcc[_0x5f91('0x4e')]['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x47fdd4,null))['then'](function(_0x3d3edf){if(_0x3d3edf){_0x2599f0=_0x3d3edf;_0x292154[_0x5f91('0x36')]=_[_0x5f91('0x38')](db[_0x5f91('0x61')]['rawAttributes']);_0x292154[_0x5f91('0x37')]=_[_0x5f91('0x38')](_0x196bcc[_0x5f91('0x37')]);_0x292154[_0x5f91('0x39')]=_[_0x5f91('0x3a')](_0x292154[_0x5f91('0x36')],_0x292154[_0x5f91('0x37')]);_0x1c5453[_0x5f91('0x3b')]=_['intersection'](_0x292154[_0x5f91('0x36')],qs['fields'](_0x196bcc[_0x5f91('0x37')][_0x5f91('0x3c')]));_0x1c5453[_0x5f91('0x3b')]=_0x1c5453[_0x5f91('0x3b')][_0x5f91('0x3d')]?_0x1c5453[_0x5f91('0x3b')]:_0x292154[_0x5f91('0x36')];_0x1c5453[_0x5f91('0x40')]=qs[_0x5f91('0x41')](_0x196bcc['query'][_0x5f91('0x41')]);_0x1c5453['where']=qs[_0x5f91('0x39')](_[_0x5f91('0x43')](_0x196bcc[_0x5f91('0x37')],_0x292154[_0x5f91('0x39')]));if(_0x196bcc[_0x5f91('0x37')][_0x5f91('0x44')]){_0x1c5453[_0x5f91('0x42')]=_[_0x5f91('0x45')](_0x1c5453[_0x5f91('0x42')],{'$or':_['map'](_0x1c5453['attributes'],function(_0x2acab7){var _0x140d74={};_0x140d74[_0x2acab7]={'$like':'%'+_0x196bcc[_0x5f91('0x37')][_0x5f91('0x44')]+'%'};return _0x140d74;})});}_0x1c5453=_['merge']({},_0x1c5453,_0x196bcc[_0x5f91('0x4f')]);return _0x2599f0[_0x5f91('0x60')](_0x1c5453);}})[_0x5f91('0x2c')](function(_0x2ffd7b){if(_0x2ffd7b){_0xb5c284=_0x2ffd7b[_0x5f91('0x3d')];if(!_0x196bcc['query']['hasOwnProperty'](_0x5f91('0x3f'))){_0x1c5453[_0x5f91('0x24')]=qs['limit'](_0x196bcc['query']['limit']);_0x1c5453[_0x5f91('0x23')]=qs['offset'](_0x196bcc['query'][_0x5f91('0x23')]);}return _0x2599f0[_0x5f91('0x60')](_0x1c5453);}})[_0x5f91('0x2c')](function(_0x1ec0da){if(_0x1ec0da){return _0x1ec0da?{'count':_0xb5c284,'rows':_0x1ec0da}:null;}})[_0x5f91('0x2c')](respondWithResult(_0x47fdd4,null))['catch'](handleError(_0x47fdd4,null));}; \ No newline at end of file +var _0x67d9=['query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','findAll','params','rawAttributes','includeAll','find','catch','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./squareProject.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','SquareProjects','sendStatus','stack','name','send','index','map','SquareProject','fieldName'];(function(_0x47702f,_0x1f5009){var _0x47dd73=function(_0x14c8ab){while(--_0x14c8ab){_0x47702f['push'](_0x47702f['shift']());}};_0x47dd73(++_0x1f5009);}(_0x67d9,0xe4));var _0x967d=function(_0x4f4cfb,_0x2cdef0){_0x4f4cfb=_0x4f4cfb-0x0;var _0x59f7a1=_0x67d9[_0x4f4cfb];return _0x59f7a1;};'use strict';var emlformat=require(_0x967d('0x0'));var rimraf=require(_0x967d('0x1'));var zipdir=require(_0x967d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x967d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x967d('0x4'));var util=require(_0x967d('0x5'));var path=require(_0x967d('0x6'));var sox=require(_0x967d('0x7'));var csv=require(_0x967d('0x8'));var ejs=require(_0x967d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x967d('0xa'));var squel=require(_0x967d('0xb'));var crypto=require('crypto');var jsforce=require(_0x967d('0xc'));var deskjs=require(_0x967d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x967d('0xe'));var Papa=require(_0x967d('0xf'));var Redis=require(_0x967d('0x10'));var authService=require(_0x967d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x967d('0x12'));var hardwareService=require(_0x967d('0x13'));var logger=require(_0x967d('0x14'))('api');var utils=require(_0x967d('0x15'));var config=require(_0x967d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x967d('0x17'))['db'];config['redis']=_[_0x967d('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x967d('0x19'))(new Redis(config[_0x967d('0x1a')]));require(_0x967d('0x1b'))['register'](socket);function respondWithStatusCode(_0x11ff2d,_0x53bc85){_0x53bc85=_0x53bc85||0xcc;return function(_0x379663){if(_0x379663){return _0x11ff2d['sendStatus'](_0x53bc85);}return _0x11ff2d[_0x967d('0x1c')](_0x53bc85)[_0x967d('0x1d')]();};}function respondWithResult(_0x6a8229,_0x14fd32){_0x14fd32=_0x14fd32||0xc8;return function(_0x3de09f){if(_0x3de09f){return _0x6a8229[_0x967d('0x1c')](_0x14fd32)[_0x967d('0x1e')](_0x3de09f);}};}function respondWithFilteredResult(_0x440c90,_0x236c4c){return function(_0x1813c3){if(_0x1813c3){var _0x3e3600=typeof _0x236c4c[_0x967d('0x1f')]===_0x967d('0x20')&&typeof _0x236c4c[_0x967d('0x21')]==='undefined';var _0x530f2a=_0x1813c3[_0x967d('0x22')];var _0x3af024=_0x3e3600?0x0:_0x236c4c[_0x967d('0x1f')];var _0x3246df=_0x3e3600?_0x1813c3['count']:_0x236c4c['offset']+_0x236c4c[_0x967d('0x21')];var _0x3265ac;if(_0x3246df>=_0x530f2a){_0x3246df=_0x530f2a;_0x3265ac=0xc8;}else{_0x3265ac=0xce;}_0x440c90[_0x967d('0x1c')](_0x3265ac);return _0x440c90[_0x967d('0x23')](_0x967d('0x24'),_0x3af024+'-'+_0x3246df+'/'+_0x530f2a)['json'](_0x1813c3);}return null;};}function patchUpdates(_0x519af2){return function(_0x259062){try{jsonpatch[_0x967d('0x25')](_0x259062,_0x519af2,!![]);}catch(_0xb2b093){return BPromise['reject'](_0xb2b093);}return _0x259062[_0x967d('0x26')]();};}function saveUpdates(_0xd3d067,_0x48e05a){return function(_0xdc77b0){if(_0xdc77b0){return _0xdc77b0['update'](_0xd3d067)[_0x967d('0x27')](function(_0x5e6355){return _0x5e6355;});}return null;};}function removeEntity(_0x119058,_0xf17aa){return function(_0x2b0578){if(_0x2b0578){return _0x2b0578[_0x967d('0x28')]()[_0x967d('0x27')](function(){var _0x2b1f73=_0x2b0578[_0x967d('0x29')]({'plain':!![]});var _0x1dc49d=_0x967d('0x2a');return db['UserProfileResource'][_0x967d('0x28')]({'where':{'type':_0x1dc49d,'resourceId':_0x2b1f73['id']}})[_0x967d('0x27')](function(){return _0x2b0578;});})[_0x967d('0x27')](function(){_0x119058[_0x967d('0x1c')](0xcc)[_0x967d('0x1d')]();});}};}function handleEntityNotFound(_0x40e90a,_0x2abcba){return function(_0x44d2d0){if(!_0x44d2d0){_0x40e90a[_0x967d('0x2b')](0x194);}return _0x44d2d0;};}function handleError(_0x3a9294,_0x299c92){_0x299c92=_0x299c92||0x1f4;return function(_0x1912c8){logger['error'](_0x1912c8[_0x967d('0x2c')]);if(_0x1912c8['name']){delete _0x1912c8[_0x967d('0x2d')];}_0x3a9294['status'](_0x299c92)[_0x967d('0x2e')](_0x1912c8);};}exports[_0x967d('0x2f')]=function(_0x1f1b21,_0x2d8658){var _0x1b8456={},_0x381a92={},_0x1b44fe={'count':0x0,'rows':[]};var _0x3a12c6=_[_0x967d('0x30')](db[_0x967d('0x31')]['rawAttributes'],function(_0x46f833){return{'name':_0x46f833[_0x967d('0x32')],'type':_0x46f833['type']['key']};});_0x381a92['model']=_['map'](_0x3a12c6,'name');_0x381a92[_0x967d('0x33')]=_[_0x967d('0x34')](_0x1f1b21[_0x967d('0x33')]);_0x381a92['filters']=_['intersection'](_0x381a92[_0x967d('0x35')],_0x381a92[_0x967d('0x33')]);_0x1b8456[_0x967d('0x36')]=_[_0x967d('0x37')](_0x381a92[_0x967d('0x35')],qs[_0x967d('0x38')](_0x1f1b21[_0x967d('0x33')][_0x967d('0x38')]));_0x1b8456['attributes']=_0x1b8456[_0x967d('0x36')][_0x967d('0x39')]?_0x1b8456['attributes']:_0x381a92[_0x967d('0x35')];if(!_0x1f1b21['query'][_0x967d('0x3a')](_0x967d('0x3b'))){_0x1b8456[_0x967d('0x21')]=qs['limit'](_0x1f1b21[_0x967d('0x33')][_0x967d('0x21')]);_0x1b8456['offset']=qs[_0x967d('0x1f')](_0x1f1b21['query'][_0x967d('0x1f')]);}_0x1b8456[_0x967d('0x3c')]=qs[_0x967d('0x3d')](_0x1f1b21[_0x967d('0x33')][_0x967d('0x3d')]);_0x1b8456['where']=qs[_0x967d('0x3e')](_[_0x967d('0x3f')](_0x1f1b21[_0x967d('0x33')],_0x381a92[_0x967d('0x3e')]),_0x3a12c6);if(_0x1f1b21[_0x967d('0x33')][_0x967d('0x40')]){_0x1b8456[_0x967d('0x41')]=_[_0x967d('0x42')](_0x1b8456['where'],{'$or':_['map'](_0x3a12c6,function(_0x92ddf1){if(_0x92ddf1[_0x967d('0x43')]!==_0x967d('0x44')){var _0x438f16={};_0x438f16[_0x92ddf1[_0x967d('0x2d')]]={'$like':'%'+_0x1f1b21[_0x967d('0x33')][_0x967d('0x40')]+'%'};return _0x438f16;}})});}_0x1b8456=_[_0x967d('0x42')]({},_0x1b8456,_0x1f1b21[_0x967d('0x45')]);var _0x5523a0={'where':_0x1b8456[_0x967d('0x41')]};return db[_0x967d('0x31')][_0x967d('0x22')](_0x5523a0)[_0x967d('0x27')](function(_0x3d026b){_0x1b44fe[_0x967d('0x22')]=_0x3d026b;if(_0x1f1b21[_0x967d('0x33')]['includeAll']){_0x1b8456['include']=[{'all':!![]}];}return db[_0x967d('0x31')][_0x967d('0x46')](_0x1b8456);})['then'](function(_0x33f5d1){_0x1b44fe['rows']=_0x33f5d1;return _0x1b44fe;})[_0x967d('0x27')](respondWithFilteredResult(_0x2d8658,_0x1b8456))['catch'](handleError(_0x2d8658,null));};exports['show']=function(_0x1fc08b,_0x13abd5){var _0x259c16={'raw':![],'where':{'id':_0x1fc08b[_0x967d('0x47')]['id']}},_0x2abb52={};_0x2abb52[_0x967d('0x35')]=_[_0x967d('0x34')](db[_0x967d('0x31')][_0x967d('0x48')]);_0x2abb52[_0x967d('0x33')]=_[_0x967d('0x34')](_0x1fc08b['query']);_0x2abb52[_0x967d('0x3e')]=_[_0x967d('0x37')](_0x2abb52[_0x967d('0x35')],_0x2abb52[_0x967d('0x33')]);_0x259c16['attributes']=_[_0x967d('0x37')](_0x2abb52[_0x967d('0x35')],qs['fields'](_0x1fc08b['query'][_0x967d('0x38')]));_0x259c16[_0x967d('0x36')]=_0x259c16['attributes'][_0x967d('0x39')]?_0x259c16[_0x967d('0x36')]:_0x2abb52[_0x967d('0x35')];if(_0x1fc08b['query'][_0x967d('0x49')]){_0x259c16['include']=[{'all':!![]}];}_0x259c16=_[_0x967d('0x42')]({},_0x259c16,_0x1fc08b[_0x967d('0x45')]);return db[_0x967d('0x31')][_0x967d('0x4a')](_0x259c16)['then'](handleEntityNotFound(_0x13abd5,null))['then'](respondWithResult(_0x13abd5,null))[_0x967d('0x4b')](handleError(_0x13abd5,null));};exports[_0x967d('0x4c')]=function(_0x117f01,_0x28fcc3){return db[_0x967d('0x31')][_0x967d('0x4c')](_0x117f01[_0x967d('0x4d')],{})[_0x967d('0x27')](function(_0x52dbd2){var _0x1d40db=_0x117f01['user']['get']({'plain':!![]});if(!_0x1d40db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d40db[_0x967d('0x4e')]===_0x967d('0x4f')){var _0x50a25b=_0x52dbd2['get']({'plain':!![]});var _0x37bb91='SquareProjects';return db[_0x967d('0x50')][_0x967d('0x4a')]({'where':{'name':_0x37bb91,'userProfileId':_0x1d40db[_0x967d('0x51')]},'raw':!![]})[_0x967d('0x27')](function(_0xd4686){if(_0xd4686&&_0xd4686[_0x967d('0x52')]===0x0){return db['UserProfileResource'][_0x967d('0x4c')]({'name':_0x50a25b[_0x967d('0x2d')],'resourceId':_0x50a25b['id'],'type':_0xd4686[_0x967d('0x2d')],'sectionId':_0xd4686['id']},{})['then'](function(){return _0x52dbd2;});}else{return _0x52dbd2;}})[_0x967d('0x4b')](function(_0x2cb801){logger[_0x967d('0x53')](_0x967d('0x54'),_0x2cb801);throw _0x2cb801;});}return _0x52dbd2;})[_0x967d('0x27')](respondWithResult(_0x28fcc3,0xc9))[_0x967d('0x4b')](handleError(_0x28fcc3,null));};exports['update']=function(_0x553b06,_0xd469e2){if(_0x553b06[_0x967d('0x4d')]['id']){delete _0x553b06[_0x967d('0x4d')]['id'];}return db[_0x967d('0x31')][_0x967d('0x4a')]({'where':{'id':_0x553b06[_0x967d('0x47')]['id']}})[_0x967d('0x27')](handleEntityNotFound(_0xd469e2,null))[_0x967d('0x27')](saveUpdates(_0x553b06[_0x967d('0x4d')],null))[_0x967d('0x27')](respondWithResult(_0xd469e2,null))[_0x967d('0x4b')](handleError(_0xd469e2,null));};exports[_0x967d('0x28')]=function(_0x53b9b7,_0x596554){return db[_0x967d('0x31')]['find']({'where':{'id':_0x53b9b7['params']['id']}})[_0x967d('0x27')](handleEntityNotFound(_0x596554,null))[_0x967d('0x27')](removeEntity(_0x596554,null))['catch'](handleError(_0x596554,null));};exports[_0x967d('0x55')]=function(_0x5b9e84,_0x3421e9,_0x3ba3e7){return db[_0x967d('0x31')][_0x967d('0x4a')]({'where':{'id':_0x5b9e84[_0x967d('0x47')]['id']}})[_0x967d('0x27')](handleEntityNotFound(_0x3421e9,null))[_0x967d('0x27')](function(_0x37ff15){if(_0x37ff15){return _0x37ff15[_0x967d('0x55')](_0x5b9e84[_0x967d('0x4d')][_0x967d('0x56')],_['omit'](_0x5b9e84['body'],[_0x967d('0x56'),'id'])||{});}})[_0x967d('0x27')](respondWithResult(_0x3421e9,null))[_0x967d('0x4b')](handleError(_0x3421e9,null));};exports[_0x967d('0x57')]=function(_0x69a896,_0x3c648d,_0xabcf81){return db['SquareProject'][_0x967d('0x4a')]({'where':{'id':_0x69a896[_0x967d('0x47')]['id']}})[_0x967d('0x27')](handleEntityNotFound(_0x3c648d,null))[_0x967d('0x27')](function(_0x478484){if(_0x478484){return _0x478484[_0x967d('0x57')](_0x69a896[_0x967d('0x33')][_0x967d('0x56')])[_0x967d('0x27')](function(){if(_[_0x967d('0x58')](_0x69a896['query'][_0x967d('0x56')])){for(var _0x58e79c=0x0;_0x58e79c<_0x69a896[_0x967d('0x33')][_0x967d('0x56')][_0x967d('0x39')];_0x58e79c+=0x1){socket[_0x967d('0x59')](_0x967d('0x5a'),{'UserId':Number(_0x69a896['query'][_0x967d('0x56')][_0x58e79c]),'SquareProjectId':Number(_0x69a896[_0x967d('0x47')]['id'])});}}else{socket[_0x967d('0x59')](_0x967d('0x5a'),{'UserId':Number(_0x69a896['query']['ids']),'SquareProjectId':Number(_0x69a896['params']['id'])});}});}})[_0x967d('0x27')](respondWithStatusCode(_0x3c648d,null))[_0x967d('0x4b')](handleError(_0x3c648d,null));};exports[_0x967d('0x5b')]=function(_0x3967a6,_0x5e6f3e,_0x18eea6){var _0x1c166c={};var _0x224e5d={};var _0x3d0ffe;var _0x4a93fa;return db[_0x967d('0x31')]['findOne']({'where':{'id':_0x3967a6['params']['id']}})[_0x967d('0x27')](handleEntityNotFound(_0x5e6f3e,null))['then'](function(_0x206a4f){if(_0x206a4f){_0x3d0ffe=_0x206a4f;_0x224e5d[_0x967d('0x35')]=_[_0x967d('0x34')](db[_0x967d('0x5c')][_0x967d('0x48')]);_0x224e5d['query']=_['keys'](_0x3967a6[_0x967d('0x33')]);_0x224e5d[_0x967d('0x3e')]=_[_0x967d('0x37')](_0x224e5d[_0x967d('0x35')],_0x224e5d['query']);_0x1c166c[_0x967d('0x36')]=_[_0x967d('0x37')](_0x224e5d['model'],qs[_0x967d('0x38')](_0x3967a6['query'][_0x967d('0x38')]));_0x1c166c[_0x967d('0x36')]=_0x1c166c[_0x967d('0x36')][_0x967d('0x39')]?_0x1c166c[_0x967d('0x36')]:_0x224e5d[_0x967d('0x35')];_0x1c166c[_0x967d('0x3c')]=qs[_0x967d('0x3d')](_0x3967a6[_0x967d('0x33')]['sort']);_0x1c166c[_0x967d('0x41')]=qs[_0x967d('0x3e')](_['pick'](_0x3967a6[_0x967d('0x33')],_0x224e5d[_0x967d('0x3e')]));if(_0x3967a6[_0x967d('0x33')]['filter']){_0x1c166c[_0x967d('0x41')]=_[_0x967d('0x42')](_0x1c166c['where'],{'$or':_[_0x967d('0x30')](_0x1c166c[_0x967d('0x36')],function(_0x3a5b50){var _0x11d1d9={};_0x11d1d9[_0x3a5b50]={'$like':'%'+_0x3967a6['query'][_0x967d('0x40')]+'%'};return _0x11d1d9;})});}_0x1c166c=_[_0x967d('0x42')]({},_0x1c166c,_0x3967a6[_0x967d('0x45')]);return _0x3d0ffe[_0x967d('0x5b')](_0x1c166c);}})['then'](function(_0x4ebf96){if(_0x4ebf96){_0x4a93fa=_0x4ebf96[_0x967d('0x39')];if(!_0x3967a6['query'][_0x967d('0x3a')](_0x967d('0x3b'))){_0x1c166c[_0x967d('0x21')]=qs['limit'](_0x3967a6[_0x967d('0x33')]['limit']);_0x1c166c[_0x967d('0x1f')]=qs[_0x967d('0x1f')](_0x3967a6[_0x967d('0x33')][_0x967d('0x1f')]);}return _0x3d0ffe[_0x967d('0x5b')](_0x1c166c);}})['then'](function(_0x3553e5){if(_0x3553e5){return _0x3553e5?{'count':_0x4a93fa,'rows':_0x3553e5}:null;}})['then'](respondWithResult(_0x5e6f3e,null))[_0x967d('0x4b')](handleError(_0x5e6f3e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b7e9c96..1d988b7 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 _0x8e8b=['hook','exports','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x50a6c5,_0x51b738){var _0x15d3d2=function(_0x71d5dd){while(--_0x71d5dd){_0x50a6c5['push'](_0x50a6c5['shift']());}};_0x15d3d2(++_0x51b738);}(_0x8e8b,0x12a));var _0xb8e8=function(_0x1a2420,_0x384ceb){_0x1a2420=_0x1a2420-0x0;var _0x494361=_0x8e8b[_0x1a2420];return _0x494361;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xb8e8('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb8e8('0x1')](0x0);var events={'afterCreate':_0xb8e8('0x2'),'afterUpdate':'update','afterDestroy':_0xb8e8('0x3')};function emitEvent(_0x38a5e3){return function(_0x29465a,_0x1810ab,_0x34d512){SquareProjectEvents[_0xb8e8('0x4')](_0x38a5e3+':'+_0x29465a['id'],_0x29465a);SquareProjectEvents[_0xb8e8('0x4')](_0x38a5e3,_0x29465a);_0x34d512(null);};}for(var e in events){if(events[_0xb8e8('0x5')](e)){var event=events[e];SquareProject[_0xb8e8('0x6')](e,emitEvent(event));}}module[_0xb8e8('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xea27=['update','remove','hasOwnProperty','hook','events','../../mysqldb','SquareProject','save'];(function(_0x218e70,_0x5cbde8){var _0x1d061d=function(_0x5bf8cf){while(--_0x5bf8cf){_0x218e70['push'](_0x218e70['shift']());}};_0x1d061d(++_0x5cbde8);}(_0xea27,0x134));var _0x7ea2=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xea27[_0x3a6efd];return _0x487b9a;};'use strict';var EventEmitter=require(_0x7ea2('0x0'));var SquareProject=require(_0x7ea2('0x1'))['db'][_0x7ea2('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7ea2('0x3'),'afterUpdate':_0x7ea2('0x4'),'afterDestroy':_0x7ea2('0x5')};function emitEvent(_0x5a4d15){return function(_0x2c34cb,_0x19d147,_0x1cb817){SquareProjectEvents['emit'](_0x5a4d15+':'+_0x2c34cb['id'],_0x2c34cb);SquareProjectEvents['emit'](_0x5a4d15,_0x2c34cb);_0x1cb817(null);};}for(var e in events){if(events[_0x7ea2('0x6')](e)){var event=events[e];SquareProject[_0x7ea2('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index c468189..0acdab0 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 _0xbf2c=['./squareProject.attributes','exports','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x266e80,_0xc5183a){var _0x26cbaa=function(_0x59c43a){while(--_0x59c43a){_0x266e80['push'](_0x266e80['shift']());}};_0x26cbaa(++_0xc5183a);}(_0xbf2c,0x1d4));var _0xcbf2=function(_0x34bf69,_0x46a0e6){_0x34bf69=_0x34bf69-0x0;var _0x216a60=_0xbf2c[_0x34bf69];return _0x216a60;};'use strict';var _=require(_0xcbf2('0x0'));var util=require(_0xcbf2('0x1'));var logger=require('../../config/logger')(_0xcbf2('0x2'));var moment=require(_0xcbf2('0x3'));var BPromise=require(_0xcbf2('0x4'));var rp=require(_0xcbf2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbf2('0x6'));var config=require(_0xcbf2('0x7'));var attributes=require(_0xcbf2('0x8'));module[_0xcbf2('0x9')]=function(_0x11f5b8,_0x2b561f){return _0x11f5b8['define']('SquareProject',attributes,{'tableName':_0xcbf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48658c,_0x2ac371,_0x233693){if(_0x48658c[_0xcbf2('0xb')](_0xcbf2('0xc'))){_0x48658c['savedAt']=moment()[_0xcbf2('0xd')](_0xcbf2('0xe'));}if(_0x48658c['changed'](_0xcbf2('0xf'))){_0x48658c[_0xcbf2('0x10')]=moment()[_0xcbf2('0xd')](_0xcbf2('0xe'));}_0x233693(null,_0x48658c);}}});}; \ No newline at end of file +var _0x1a89=['./squareProject.attributes','exports','define','SquareProject','changed','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5bad8f,_0x3a51ef){var _0x2f643a=function(_0x23e4ed){while(--_0x23e4ed){_0x5bad8f['push'](_0x5bad8f['shift']());}};_0x2f643a(++_0x3a51ef);}(_0x1a89,0x171));var _0x91a8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1a89[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x91a8('0x0'));var util=require(_0x91a8('0x1'));var logger=require(_0x91a8('0x2'))(_0x91a8('0x3'));var moment=require(_0x91a8('0x4'));var BPromise=require(_0x91a8('0x5'));var rp=require(_0x91a8('0x6'));var fs=require('fs');var path=require(_0x91a8('0x7'));var rimraf=require('rimraf');var config=require(_0x91a8('0x8'));var attributes=require(_0x91a8('0x9'));module[_0x91a8('0xa')]=function(_0xa9392c,_0x40d086){return _0xa9392c[_0x91a8('0xb')](_0x91a8('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb39c,_0x85409b,_0x518b63){if(_0xb39c[_0x91a8('0xd')]('preproduction')){_0xb39c[_0x91a8('0xe')]=moment()[_0x91a8('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xb39c[_0x91a8('0xd')](_0x91a8('0x10'))){_0xb39c['publishedAt']=moment()['format'](_0x91a8('0x11'));}_0x518b63(null,_0xb39c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f6319c6..3718ad6 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 _0xdaa7=['redis','defaults','localhost','socket.io-emitter','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSquareProject','SquareProject','find','options','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xdaa7,0x82));var _0x7daa=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0xdaa7[_0xc8db6b];return _0x12cb81;};'use strict';var _=require(_0x7daa('0x0'));var util=require('util');var moment=require(_0x7daa('0x1'));var BPromise=require('bluebird');var rs=require(_0x7daa('0x2'));var fs=require('fs');var Redis=require(_0x7daa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7daa('0x4'));var logger=require(_0x7daa('0x5'))(_0x7daa('0x6'));var config=require(_0x7daa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7daa('0x8')][_0x7daa('0x9')]({'port':0x232a});config[_0x7daa('0xa')]=_[_0x7daa('0xb')](config[_0x7daa('0xa')],{'host':_0x7daa('0xc'),'port':0x18eb});var socket=require(_0x7daa('0xd'))(new Redis(config['redis']));require('./squareProject.socket')[_0x7daa('0xe')](socket);function respondWithRpcPromise(_0xc1ec6e,_0x26ad27,_0x33a194){return new BPromise(function(_0x493cdc,_0x27bb84){return client['request'](_0xc1ec6e,_0x33a194)[_0x7daa('0xf')](function(_0x86a46f){logger[_0x7daa('0x10')](_0x7daa('0x11'),_0x26ad27,_0x7daa('0x12'));logger[_0x7daa('0x13')](_0x7daa('0x14'),_0x26ad27,_0x7daa('0x12'),JSON[_0x7daa('0x15')](_0x86a46f));if(_0x86a46f['error']){if(_0x86a46f['error'][_0x7daa('0x16')]===0x1f4){logger['error'](_0x7daa('0x11'),_0x26ad27,_0x86a46f[_0x7daa('0x17')][_0x7daa('0x18')]);return _0x27bb84(_0x86a46f['error'][_0x7daa('0x18')]);}logger[_0x7daa('0x17')]('SquareProject,\x20%s,\x20%s',_0x26ad27,_0x86a46f['error'][_0x7daa('0x18')]);return _0x493cdc(_0x86a46f['error'][_0x7daa('0x18')]);}else{logger[_0x7daa('0x10')](_0x7daa('0x11'),_0x26ad27,_0x7daa('0x12'));_0x493cdc(_0x86a46f[_0x7daa('0x19')]['message']);}})[_0x7daa('0x1a')](function(_0x4783d2){logger['error'](_0x7daa('0x11'),_0x26ad27,_0x4783d2);_0x27bb84(_0x4783d2);});});}exports[_0x7daa('0x1b')]=function(_0x185306){var _0x5e65ec=this;return new Promise(function(_0x386730,_0x108a55){return db[_0x7daa('0x1c')][_0x7daa('0x1d')]({'raw':_0x185306[_0x7daa('0x1e')]?_0x185306[_0x7daa('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x185306[_0x7daa('0x1e')]?_0x185306[_0x7daa('0x1e')]['where']||null:null,'attributes':_0x185306['options']?_0x185306['options'][_0x7daa('0x1f')]||null:null,'include':_0x185306[_0x7daa('0x1e')]?_0x185306[_0x7daa('0x1e')][_0x7daa('0x20')]?_[_0x7daa('0x21')](_0x185306[_0x7daa('0x1e')][_0x7daa('0x20')],function(_0x2342ea){return{'model':db[_0x2342ea[_0x7daa('0x22')]],'as':_0x2342ea['as'],'attributes':_0x2342ea[_0x7daa('0x1f')],'include':_0x2342ea[_0x7daa('0x20')]?_['map'](_0x2342ea['include'],function(_0x131928){return{'model':db[_0x131928[_0x7daa('0x22')]],'as':_0x131928['as'],'attributes':_0x131928[_0x7daa('0x1f')],'include':_0x131928[_0x7daa('0x20')]?_[_0x7daa('0x21')](_0x131928[_0x7daa('0x20')],function(_0x312f61){return{'model':db[_0x312f61[_0x7daa('0x22')]],'as':_0x312f61['as'],'attributes':_0x312f61[_0x7daa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7daa('0xf')](function(_0x512335){logger['info'](_0x7daa('0x1b'),_0x185306);logger['debug'](_0x7daa('0x1b'),_0x185306,JSON[_0x7daa('0x15')](_0x512335));_0x386730(_0x512335);})[_0x7daa('0x1a')](function(_0x4abc94){logger[_0x7daa('0x17')](_0x7daa('0x1b'),_0x4abc94[_0x7daa('0x18')],_0x185306);_0x108a55(_0x5e65ec[_0x7daa('0x17')](0x1f4,_0x4abc94[_0x7daa('0x18')]));});});}; \ No newline at end of file +var _0x929c=['model','map','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','register','info','request\x20sent','debug','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','ShowSquareProject','find','options','raw','where','attributes','include'];(function(_0x2c2616,_0x451c62){var _0x2b45e8=function(_0x37e094){while(--_0x37e094){_0x2c2616['push'](_0x2c2616['shift']());}};_0x2b45e8(++_0x451c62);}(_0x929c,0x93));var _0xc929=function(_0x1071fd,_0x3b8f9f){_0x1071fd=_0x1071fd-0x0;var _0x3bb479=_0x929c[_0x1071fd];return _0x3bb479;};'use strict';var _=require(_0xc929('0x0'));var util=require(_0xc929('0x1'));var moment=require(_0xc929('0x2'));var BPromise=require('bluebird');var rs=require(_0xc929('0x3'));var fs=require('fs');var Redis=require(_0xc929('0x4'));var db=require(_0xc929('0x5'))['db'];var utils=require(_0xc929('0x6'));var logger=require('../../config/logger')(_0xc929('0x7'));var config=require(_0xc929('0x8'));var jayson=require(_0xc929('0x9'));var client=jayson[_0xc929('0xa')][_0xc929('0xb')]({'port':0x232a});config[_0xc929('0xc')]=_[_0xc929('0xd')](config[_0xc929('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc929('0xe'))(new Redis(config['redis']));require(_0xc929('0xf'))[_0xc929('0x10')](socket);function respondWithRpcPromise(_0xece7ad,_0x1c9a1d,_0x2c001a){return new BPromise(function(_0x484e46,_0x5437de){return client['request'](_0xece7ad,_0x2c001a)['then'](function(_0x156422){logger[_0xc929('0x11')]('SquareProject,\x20%s,\x20%s',_0x1c9a1d,_0xc929('0x12'));logger[_0xc929('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x1c9a1d,_0xc929('0x12'),JSON[_0xc929('0x14')](_0x156422));if(_0x156422[_0xc929('0x15')]){if(_0x156422['error'][_0xc929('0x16')]===0x1f4){logger[_0xc929('0x15')](_0xc929('0x17'),_0x1c9a1d,_0x156422['error'][_0xc929('0x18')]);return _0x5437de(_0x156422[_0xc929('0x15')][_0xc929('0x18')]);}logger[_0xc929('0x15')]('SquareProject,\x20%s,\x20%s',_0x1c9a1d,_0x156422[_0xc929('0x15')][_0xc929('0x18')]);return _0x484e46(_0x156422[_0xc929('0x15')][_0xc929('0x18')]);}else{logger[_0xc929('0x11')](_0xc929('0x17'),_0x1c9a1d,'request\x20sent');_0x484e46(_0x156422[_0xc929('0x19')]['message']);}})['catch'](function(_0x3c48fe){logger[_0xc929('0x15')]('SquareProject,\x20%s,\x20%s',_0x1c9a1d,_0x3c48fe);_0x5437de(_0x3c48fe);});});}exports[_0xc929('0x1a')]=function(_0x318546){var _0x36bc06=this;return new Promise(function(_0x18a9ed,_0x39f8bf){return db['SquareProject'][_0xc929('0x1b')]({'raw':_0x318546[_0xc929('0x1c')]?_0x318546[_0xc929('0x1c')][_0xc929('0x1d')]===undefined?!![]:![]:!![],'where':_0x318546[_0xc929('0x1c')]?_0x318546[_0xc929('0x1c')][_0xc929('0x1e')]||null:null,'attributes':_0x318546[_0xc929('0x1c')]?_0x318546[_0xc929('0x1c')][_0xc929('0x1f')]||null:null,'include':_0x318546[_0xc929('0x1c')]?_0x318546[_0xc929('0x1c')][_0xc929('0x20')]?_['map'](_0x318546['options'][_0xc929('0x20')],function(_0x186522){return{'model':db[_0x186522[_0xc929('0x21')]],'as':_0x186522['as'],'attributes':_0x186522['attributes'],'include':_0x186522['include']?_[_0xc929('0x22')](_0x186522['include'],function(_0x4a05f3){return{'model':db[_0x4a05f3['model']],'as':_0x4a05f3['as'],'attributes':_0x4a05f3['attributes'],'include':_0x4a05f3[_0xc929('0x20')]?_[_0xc929('0x22')](_0x4a05f3[_0xc929('0x20')],function(_0x1fd75e){return{'model':db[_0x1fd75e[_0xc929('0x21')]],'as':_0x1fd75e['as'],'attributes':_0x1fd75e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x127dba){logger[_0xc929('0x11')]('ShowSquareProject',_0x318546);logger[_0xc929('0x13')](_0xc929('0x1a'),_0x318546,JSON[_0xc929('0x14')](_0x127dba));_0x18a9ed(_0x127dba);})[_0xc929('0x23')](function(_0x3df5a1){logger[_0xc929('0x15')](_0xc929('0x1a'),_0x3df5a1[_0xc929('0x18')],_0x318546);_0x39f8bf(_0x36bc06['error'](0x1f4,_0x3df5a1[_0xc929('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 214d5c8..b138953 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 _0x5b9d=['register','squareProject:','save','update','emit','removeListener'];(function(_0x287059,_0x499940){var _0x225c79=function(_0x3aa36e){while(--_0x3aa36e){_0x287059['push'](_0x287059['shift']());}};_0x225c79(++_0x499940);}(_0x5b9d,0x1a0));var _0xd5b9=function(_0x595505,_0x56cc58){_0x595505=_0x595505-0x0;var _0x4d62d7=_0x5b9d[_0x595505];return _0x4d62d7;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xd5b9('0x0'),'remove',_0xd5b9('0x1')];function createListener(_0x655d14,_0x4c410f){return function(_0x1907e5){_0x4c410f[_0xd5b9('0x2')](_0x655d14,_0x1907e5);};}function removeListener(_0x344198,_0x22d0be){return function(){SquareProjectEvents[_0xd5b9('0x3')](_0x344198,_0x22d0be);};}exports[_0xd5b9('0x4')]=function(_0xd7d976){for(var _0x49e834=0x0,_0x2883dd=events['length'];_0x49e834<_0x2883dd;_0x49e834++){var _0x5d15d1=events[_0x49e834];var _0x4da01c=createListener(_0xd5b9('0x5')+_0x5d15d1,_0xd7d976);SquareProjectEvents['on'](_0x5d15d1,_0x4da01c);}}; \ No newline at end of file +var _0x98f8=['./squareProject.events','save','remove','removeListener','register','length','squareProject:'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x98f8,0x70));var _0x898f=function(_0x19fa95,_0x1cca0a){_0x19fa95=_0x19fa95-0x0;var _0x58a835=_0x98f8[_0x19fa95];return _0x58a835;};'use strict';var SquareProjectEvents=require(_0x898f('0x0'));var events=[_0x898f('0x1'),_0x898f('0x2'),'update'];function createListener(_0x2b9e98,_0xf805be){return function(_0x51ceb2){_0xf805be['emit'](_0x2b9e98,_0x51ceb2);};}function removeListener(_0x422bae,_0x4cbc38){return function(){SquareProjectEvents[_0x898f('0x3')](_0x422bae,_0x4cbc38);};}exports[_0x898f('0x4')]=function(_0x2d7b06){for(var _0x2d2e4a=0x0,_0x2d5f7c=events[_0x898f('0x5')];_0x2d2e4a<_0x2d5f7c;_0x2d2e4a++){var _0x9a1564=events[_0x2d2e4a];var _0x34049d=createListener(_0x898f('0x6')+_0x9a1564,_0x2d7b06);SquareProjectEvents['on'](_0x9a1564,_0x34049d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e8d6104..70eb7ff 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x5728e3,_0x5b84aa){var _0x5337d2=function(_0x1b4e8b){while(--_0x1b4e8b){_0x5728e3['push'](_0x5728e3['shift']());}};_0x5337d2(++_0x5b84aa);}(_0x7a54,0x106));var _0x47a5=function(_0x22098a,_0x13a26){_0x22098a=_0x22098a-0x0;var _0x1cbfa1=_0x7a54[_0x22098a];return _0x1cbfa1;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x0295,0x1f0));var _0x5029=function(_0x1fd4d7,_0x2feafd){_0x1fd4d7=_0x1fd4d7-0x0;var _0x7efe8a=_0x0295[_0x1fd4d7];return _0x7efe8a;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 73f7083..92faeb1 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 _0xdbf5=['lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x4da328,_0x408279){var _0x58f11f=function(_0x10f768){while(--_0x10f768){_0x4da328['push'](_0x4da328['shift']());}};_0x58f11f(++_0x408279);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4ec962,_0x4e71b5){_0x4ec962=_0x4ec962-0x0;var _0x1b8d3c=_0xdbf5[_0x4ec962];return _0x1b8d3c;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'context':{'type':Sequelize[_0x5dbf('0x1')]},'extension':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize[_0x5dbf('0x1')]},'dnid':{'type':Sequelize[_0x5dbf('0x1')]},'projectName':{'type':Sequelize[_0x5dbf('0x1')]},'saveName':{'type':Sequelize[_0x5dbf('0x1')]},'filename':{'type':Sequelize[_0x5dbf('0x1')]},'savePath':{'type':Sequelize[_0x5dbf('0x1')]},'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){var _0x88128e='';var _0x93e657=this['getDataValue'](_0x5dbf('0x3'));if(_0x93e657){_0x88128e=_0x93e657['substring'](_0x93e657[_0x5dbf('0x4')]('.'));}return _0x88128e;}}}; \ No newline at end of file +var _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xf494,0x1c6));var _0x4f49=function(_0xb4c3a7,_0x4c9d44){_0xb4c3a7=_0xb4c3a7-0x0;var _0x3ba0b2=_0xf494[_0xb4c3a7];return _0x3ba0b2;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ba837c1..71721ed 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 _0x244a=['VIRTUAL','merge','options','includeAll','catch','show','params','keys','rawAttributes','length','find','create','body','download','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','SquareRecording','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter'];(function(_0x158cfc,_0x3ff9e0){var _0x38baee=function(_0x1e30e0){while(--_0x1e30e0){_0x158cfc['push'](_0x158cfc['shift']());}};_0x38baee(++_0x3ff9e0);}(_0x244a,0x8b));var _0xa244=function(_0x4bb055,_0x48257a){_0x4bb055=_0x4bb055-0x0;var _0x2ab87e=_0x244a[_0x4bb055];return _0x2ab87e;};'use strict';var emlformat=require(_0xa244('0x0'));var rimraf=require(_0xa244('0x1'));var zipdir=require(_0xa244('0x2'));var jsonpatch=require(_0xa244('0x3'));var rp=require('request-promise');var moment=require(_0xa244('0x4'));var BPromise=require(_0xa244('0x5'));var Mustache=require(_0xa244('0x6'));var util=require(_0xa244('0x7'));var path=require(_0xa244('0x8'));var sox=require(_0xa244('0x9'));var csv=require('to-csv');var ejs=require(_0xa244('0xa'));var fs=require('fs');var fs_extra=require(_0xa244('0xb'));var _=require(_0xa244('0xc'));var squel=require(_0xa244('0xd'));var crypto=require('crypto');var jsforce=require(_0xa244('0xe'));var deskjs=require(_0xa244('0xf'));var toCsv=require(_0xa244('0x10'));var querystring=require('querystring');var Papa=require(_0xa244('0x11'));var Redis=require(_0xa244('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa244('0x13'));var as=require(_0xa244('0x14'));var hardwareService=require(_0xa244('0x15'));var logger=require(_0xa244('0x16'))(_0xa244('0x17'));var utils=require(_0xa244('0x18'));var config=require(_0xa244('0x19'));var licenseUtil=require(_0xa244('0x1a'));var db=require(_0xa244('0x1b'))['db'];function respondWithStatusCode(_0x7a6a1,_0xd5c1e7){_0xd5c1e7=_0xd5c1e7||0xcc;return function(_0x3ab9e7){if(_0x3ab9e7){return _0x7a6a1[_0xa244('0x1c')](_0xd5c1e7);}return _0x7a6a1['status'](_0xd5c1e7)[_0xa244('0x1d')]();};}function respondWithResult(_0x13e000,_0x5ef64a){_0x5ef64a=_0x5ef64a||0xc8;return function(_0x5c7e99){if(_0x5c7e99){return _0x13e000['status'](_0x5ef64a)[_0xa244('0x1e')](_0x5c7e99);}};}function respondWithFilteredResult(_0xd513d6,_0x1af25c){return function(_0x47b541){if(_0x47b541){var _0x567edf=typeof _0x1af25c['offset']===_0xa244('0x1f')&&typeof _0x1af25c['limit']===_0xa244('0x1f');var _0x5bdfbc=_0x47b541[_0xa244('0x20')];var _0x1ed7f9=_0x567edf?0x0:_0x1af25c[_0xa244('0x21')];var _0x147c24=_0x567edf?_0x47b541[_0xa244('0x20')]:_0x1af25c[_0xa244('0x21')]+_0x1af25c[_0xa244('0x22')];var _0x27d8c2;if(_0x147c24>=_0x5bdfbc){_0x147c24=_0x5bdfbc;_0x27d8c2=0xc8;}else{_0x27d8c2=0xce;}_0xd513d6[_0xa244('0x23')](_0x27d8c2);return _0xd513d6[_0xa244('0x24')](_0xa244('0x25'),_0x1ed7f9+'-'+_0x147c24+'/'+_0x5bdfbc)[_0xa244('0x1e')](_0x47b541);}return null;};}function patchUpdates(_0x5928c1){return function(_0x28b34e){try{jsonpatch[_0xa244('0x26')](_0x28b34e,_0x5928c1,!![]);}catch(_0x27c7a3){return BPromise[_0xa244('0x27')](_0x27c7a3);}return _0x28b34e['save']();};}function saveUpdates(_0x4f9565,_0x2b0b84){return function(_0x3f7bed){if(_0x3f7bed){return _0x3f7bed[_0xa244('0x28')](_0x4f9565)[_0xa244('0x29')](function(_0x3d4efa){return _0x3d4efa;});}return null;};}function removeEntity(_0xab646e,_0x538c35){return function(_0x45fa98){if(_0x45fa98){return _0x45fa98['destroy']()[_0xa244('0x29')](function(){_0xab646e[_0xa244('0x23')](0xcc)[_0xa244('0x1d')]();});}};}function handleEntityNotFound(_0x25f09f,_0x31c3b3){return function(_0x7b4450){if(!_0x7b4450){_0x25f09f['sendStatus'](0x194);}return _0x7b4450;};}function handleError(_0x529d62,_0x3cbf13){_0x3cbf13=_0x3cbf13||0x1f4;return function(_0x3ef2b2){logger[_0xa244('0x2a')](_0x3ef2b2[_0xa244('0x2b')]);if(_0x3ef2b2[_0xa244('0x2c')]){delete _0x3ef2b2['name'];}_0x529d62[_0xa244('0x23')](_0x3cbf13)[_0xa244('0x2d')](_0x3ef2b2);};}exports[_0xa244('0x2e')]=function(_0x18a380,_0x3920ce){var _0xfddf3e={},_0x42d592={},_0x279c0b={'count':0x0,'rows':[]};var _0x57bb9a=_[_0xa244('0x2f')](db[_0xa244('0x30')]['rawAttributes'],function(_0x4399fb){return{'name':_0x4399fb[_0xa244('0x31')],'type':_0x4399fb[_0xa244('0x32')][_0xa244('0x33')]};});_0x42d592[_0xa244('0x34')]=_[_0xa244('0x2f')](_0x57bb9a,_0xa244('0x2c'));_0x42d592['query']=_['keys'](_0x18a380[_0xa244('0x35')]);_0x42d592[_0xa244('0x36')]=_[_0xa244('0x37')](_0x42d592[_0xa244('0x34')],_0x42d592['query']);_0xfddf3e[_0xa244('0x38')]=_[_0xa244('0x37')](_0x42d592['model'],qs[_0xa244('0x39')](_0x18a380[_0xa244('0x35')][_0xa244('0x39')]));_0xfddf3e['attributes']=_0xfddf3e[_0xa244('0x38')]['length']?_0xfddf3e[_0xa244('0x38')]:_0x42d592[_0xa244('0x34')];if(!_0x18a380[_0xa244('0x35')][_0xa244('0x3a')]('nolimit')){_0xfddf3e[_0xa244('0x22')]=qs[_0xa244('0x22')](_0x18a380[_0xa244('0x35')][_0xa244('0x22')]);_0xfddf3e[_0xa244('0x21')]=qs[_0xa244('0x21')](_0x18a380[_0xa244('0x35')]['offset']);}_0xfddf3e[_0xa244('0x3b')]=qs[_0xa244('0x3c')](_0x18a380[_0xa244('0x35')][_0xa244('0x3c')]);_0xfddf3e[_0xa244('0x3d')]=qs['filters'](_['pick'](_0x18a380[_0xa244('0x35')],_0x42d592[_0xa244('0x36')]),_0x57bb9a);if(_0x18a380[_0xa244('0x35')][_0xa244('0x3e')]){_0xfddf3e[_0xa244('0x3d')]=_['merge'](_0xfddf3e['where'],{'$or':_[_0xa244('0x2f')](_0x57bb9a,function(_0x8309bf){if(_0x8309bf['type']!==_0xa244('0x3f')){var _0x2ce3f9={};_0x2ce3f9[_0x8309bf['name']]={'$like':'%'+_0x18a380[_0xa244('0x35')][_0xa244('0x3e')]+'%'};return _0x2ce3f9;}})});}_0xfddf3e=_[_0xa244('0x40')]({},_0xfddf3e,_0x18a380[_0xa244('0x41')]);var _0x4fe386={'where':_0xfddf3e[_0xa244('0x3d')]};return db[_0xa244('0x30')][_0xa244('0x20')](_0x4fe386)[_0xa244('0x29')](function(_0x3a1c0f){_0x279c0b[_0xa244('0x20')]=_0x3a1c0f;if(_0x18a380[_0xa244('0x35')][_0xa244('0x42')]){_0xfddf3e['include']=[{'all':!![]}];}return db[_0xa244('0x30')]['findAll'](_0xfddf3e);})[_0xa244('0x29')](function(_0xb08af4){_0x279c0b['rows']=_0xb08af4;return _0x279c0b;})[_0xa244('0x29')](respondWithFilteredResult(_0x3920ce,_0xfddf3e))[_0xa244('0x43')](handleError(_0x3920ce,null));};exports[_0xa244('0x44')]=function(_0x144570,_0x1a851f){var _0x2ba24d={'raw':!![],'where':{'id':_0x144570[_0xa244('0x45')]['id']}},_0x2e8129={};_0x2e8129[_0xa244('0x34')]=_[_0xa244('0x46')](db[_0xa244('0x30')][_0xa244('0x47')]);_0x2e8129['query']=_[_0xa244('0x46')](_0x144570[_0xa244('0x35')]);_0x2e8129['filters']=_['intersection'](_0x2e8129['model'],_0x2e8129['query']);_0x2ba24d[_0xa244('0x38')]=_['intersection'](_0x2e8129['model'],qs['fields'](_0x144570['query'][_0xa244('0x39')]));_0x2ba24d['attributes']=_0x2ba24d[_0xa244('0x38')][_0xa244('0x48')]?_0x2ba24d[_0xa244('0x38')]:_0x2e8129['model'];if(_0x144570[_0xa244('0x35')][_0xa244('0x42')]){_0x2ba24d['include']=[{'all':!![]}];}_0x2ba24d=_['merge']({},_0x2ba24d,_0x144570[_0xa244('0x41')]);return db[_0xa244('0x30')][_0xa244('0x49')](_0x2ba24d)[_0xa244('0x29')](handleEntityNotFound(_0x1a851f,null))[_0xa244('0x29')](respondWithResult(_0x1a851f,null))[_0xa244('0x43')](handleError(_0x1a851f,null));};exports[_0xa244('0x4a')]=function(_0x520f6f,_0x35d6e2){return db[_0xa244('0x30')][_0xa244('0x4a')](_0x520f6f[_0xa244('0x4b')],{})[_0xa244('0x29')](respondWithResult(_0x35d6e2,0xc9))[_0xa244('0x43')](handleError(_0x35d6e2,null));};exports[_0xa244('0x28')]=function(_0x1b7444,_0x11f39){if(_0x1b7444['body']['id']){delete _0x1b7444['body']['id'];}return db[_0xa244('0x30')][_0xa244('0x49')]({'where':{'id':_0x1b7444[_0xa244('0x45')]['id']}})['then'](handleEntityNotFound(_0x11f39,null))[_0xa244('0x29')](saveUpdates(_0x1b7444['body'],null))[_0xa244('0x29')](respondWithResult(_0x11f39,null))[_0xa244('0x43')](handleError(_0x11f39,null));};exports[_0xa244('0x4c')]=function(_0x272108,_0x274b31,_0x19b10a){var _0x5b8a4b=require('../../components/encryptor');var _0x58676f=![];var _0x11f88e={};if(_0x272108[_0xa244('0x35')][_0xa244('0x32')]&&_0x272108[_0xa244('0x35')][_0xa244('0x32')]==='uniqueid'){_0x11f88e[_0xa244('0x4d')]=_0x272108[_0xa244('0x45')]['id'];}else{_0x11f88e['id']=_0x272108[_0xa244('0x45')]['id'];}return db[_0xa244('0x30')][_0xa244('0x49')]({'where':_0x11f88e,'attributes':['id',_0xa244('0x4e'),'filename'],'raw':!![]})[_0xa244('0x29')](handleEntityNotFound(_0x274b31,null))[_0xa244('0x29')](function(_0x72dc67){if(_0x72dc67){var _0x2c3c81=_0x72dc67['savePath'];var _0x51c626=util[_0xa244('0x4f')](_0xa244('0x50'),_0x2c3c81);if(fs['existsSync'](_0x51c626)){_0x58676f=!![];return _0x5b8a4b[_0xa244('0x51')](_0x51c626,_0x2c3c81,config[_0xa244('0x52')][_0xa244('0x53')])[_0xa244('0x29')](function(){return _0x72dc67;});}return _0x72dc67;}})[_0xa244('0x29')](function(_0x349f56){if(_0x349f56){var _0x4812ae=_0x349f56[_0xa244('0x4e')];if(!fs[_0xa244('0x54')](_0x4812ae)){throw new db[(_0xa244('0x55'))][(_0xa244('0x56'))](_0xa244('0x57'));}if(_0x349f56[_0xa244('0x58')]){return _0x274b31[_0xa244('0x4c')](_0x4812ae,_0x349f56[_0xa244('0x58')]+path[_0xa244('0x59')](_0x4812ae),function(){if(_0x58676f){fs['unlink'](_0x4812ae);}});}else{return _0x274b31[_0xa244('0x4c')](_0x4812ae,function(_0x3b8782){if(_0x58676f){fs[_0xa244('0x5a')](_0x4812ae);}});}}})[_0xa244('0x43')](function(_0x1ecc2f){if(_0x1ecc2f[_0xa244('0x5b')]===_0xa244('0x57')){_0x274b31[_0xa244('0x23')](0x194)[_0xa244('0x2d')]('Not\x20found');}else{return handleError(_0x274b31,null);}});};exports[_0xa244('0x5c')]=function(_0x1eca56,_0x51987f){return db['SquareRecording']['find']({'where':{'id':_0x1eca56[_0xa244('0x45')]['id']}})[_0xa244('0x29')](function(_0x1f0068){if(_['isNil'](_0x1f0068)){throw new ReferenceError(_0xa244('0x5d'));}return _0x1f0068;})[_0xa244('0x29')](function(_0x4872cd){var _0x13a663=_0x4872cd[_0xa244('0x4e')];logger[_0xa244('0x5e')](_0xa244('0x5f'),_0x13a663);if(!_[_0xa244('0x60')](_0x4872cd[_0xa244('0x4e')])&&fs['existsSync'](_0x13a663)){logger['info'](_0xa244('0x61')+_0x13a663+_0xa244('0x62'));fs['unlinkSync'](_0x13a663);}_0x13a663=_0x13a663+_0xa244('0x63');if(!_[_0xa244('0x60')](_0x4872cd[_0xa244('0x4e')])&&fs[_0xa244('0x54')](_0x13a663)){logger[_0xa244('0x5e')]('File:\x20\x22'+_0x13a663+_0xa244('0x62'));fs[_0xa244('0x64')](_0x13a663);}return _0x4872cd;})[_0xa244('0x29')](function(_0x22ec55){if(!_0x22ec55)throw new InternalError();return _0x22ec55[_0xa244('0x5c')]();})[_0xa244('0x29')](function(){_0x51987f[_0xa244('0x23')](0xcc)['end']();})[_0xa244('0x43')](handleError(_0x51987f,null));}; \ No newline at end of file +var _0x8ffa=['Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','create','body','catch','update','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','recording','existsSync','Sequelize','ValidationError','extname','unlink','message','send','Not\x20found','isNil'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8ffa,0xcb));var _0xa8ff=function(_0xfa27a4,_0xa1426d){_0xfa27a4=_0xfa27a4-0x0;var _0x36b062=_0x8ffa[_0xfa27a4];return _0x36b062;};'use strict';var emlformat=require(_0xa8ff('0x0'));var rimraf=require(_0xa8ff('0x1'));var zipdir=require(_0xa8ff('0x2'));var jsonpatch=require(_0xa8ff('0x3'));var rp=require('request-promise');var moment=require(_0xa8ff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8ff('0x5'));var util=require(_0xa8ff('0x6'));var path=require(_0xa8ff('0x7'));var sox=require(_0xa8ff('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8ff('0x9'));var _=require('lodash');var squel=require(_0xa8ff('0xa'));var crypto=require(_0xa8ff('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa8ff('0xc'));var querystring=require(_0xa8ff('0xd'));var Papa=require(_0xa8ff('0xe'));var Redis=require(_0xa8ff('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa8ff('0x10'));var hardwareService=require(_0xa8ff('0x11'));var logger=require(_0xa8ff('0x12'))('api');var utils=require(_0xa8ff('0x13'));var config=require(_0xa8ff('0x14'));var licenseUtil=require(_0xa8ff('0x15'));var db=require(_0xa8ff('0x16'))['db'];function respondWithStatusCode(_0x207359,_0x36b6fb){_0x36b6fb=_0x36b6fb||0xcc;return function(_0x2a81f4){if(_0x2a81f4){return _0x207359[_0xa8ff('0x17')](_0x36b6fb);}return _0x207359[_0xa8ff('0x18')](_0x36b6fb)[_0xa8ff('0x19')]();};}function respondWithResult(_0x35124d,_0x27f0d1){_0x27f0d1=_0x27f0d1||0xc8;return function(_0x3ce60b){if(_0x3ce60b){return _0x35124d[_0xa8ff('0x18')](_0x27f0d1)[_0xa8ff('0x1a')](_0x3ce60b);}};}function respondWithFilteredResult(_0x2786d0,_0x942d05){return function(_0x1a4508){if(_0x1a4508){var _0x32050a=typeof _0x942d05[_0xa8ff('0x1b')]===_0xa8ff('0x1c')&&typeof _0x942d05['limit']===_0xa8ff('0x1c');var _0x3a8867=_0x1a4508[_0xa8ff('0x1d')];var _0x44c002=_0x32050a?0x0:_0x942d05[_0xa8ff('0x1b')];var _0x16b2df=_0x32050a?_0x1a4508[_0xa8ff('0x1d')]:_0x942d05['offset']+_0x942d05['limit'];var _0x92cb4c;if(_0x16b2df>=_0x3a8867){_0x16b2df=_0x3a8867;_0x92cb4c=0xc8;}else{_0x92cb4c=0xce;}_0x2786d0[_0xa8ff('0x18')](_0x92cb4c);return _0x2786d0[_0xa8ff('0x1e')](_0xa8ff('0x1f'),_0x44c002+'-'+_0x16b2df+'/'+_0x3a8867)[_0xa8ff('0x1a')](_0x1a4508);}return null;};}function patchUpdates(_0x42a9bf){return function(_0x6cd8f9){try{jsonpatch[_0xa8ff('0x20')](_0x6cd8f9,_0x42a9bf,!![]);}catch(_0x4833a8){return BPromise[_0xa8ff('0x21')](_0x4833a8);}return _0x6cd8f9[_0xa8ff('0x22')]();};}function saveUpdates(_0xc9a47a,_0x51edac){return function(_0x2d1f5d){if(_0x2d1f5d){return _0x2d1f5d['update'](_0xc9a47a)[_0xa8ff('0x23')](function(_0x194910){return _0x194910;});}return null;};}function removeEntity(_0x5d9355,_0x86a3aa){return function(_0xececb2){if(_0xececb2){return _0xececb2[_0xa8ff('0x24')]()['then'](function(){_0x5d9355[_0xa8ff('0x18')](0xcc)[_0xa8ff('0x19')]();});}};}function handleEntityNotFound(_0x2a9045,_0x2db6b0){return function(_0x331f06){if(!_0x331f06){_0x2a9045['sendStatus'](0x194);}return _0x331f06;};}function handleError(_0x3877cf,_0x392034){_0x392034=_0x392034||0x1f4;return function(_0x8e5d47){logger[_0xa8ff('0x25')](_0x8e5d47[_0xa8ff('0x26')]);if(_0x8e5d47[_0xa8ff('0x27')]){delete _0x8e5d47['name'];}_0x3877cf[_0xa8ff('0x18')](_0x392034)['send'](_0x8e5d47);};}exports[_0xa8ff('0x28')]=function(_0x49247c,_0x132a15){var _0x529131={},_0x4865e0={},_0x2b7c31={'count':0x0,'rows':[]};var _0x15ed57=_[_0xa8ff('0x29')](db[_0xa8ff('0x2a')][_0xa8ff('0x2b')],function(_0x289c7a){return{'name':_0x289c7a[_0xa8ff('0x2c')],'type':_0x289c7a['type']['key']};});_0x4865e0[_0xa8ff('0x2d')]=_[_0xa8ff('0x29')](_0x15ed57,_0xa8ff('0x27'));_0x4865e0[_0xa8ff('0x2e')]=_['keys'](_0x49247c[_0xa8ff('0x2e')]);_0x4865e0['filters']=_[_0xa8ff('0x2f')](_0x4865e0[_0xa8ff('0x2d')],_0x4865e0['query']);_0x529131[_0xa8ff('0x30')]=_['intersection'](_0x4865e0['model'],qs['fields'](_0x49247c['query'][_0xa8ff('0x31')]));_0x529131[_0xa8ff('0x30')]=_0x529131['attributes'][_0xa8ff('0x32')]?_0x529131[_0xa8ff('0x30')]:_0x4865e0['model'];if(!_0x49247c['query'][_0xa8ff('0x33')](_0xa8ff('0x34'))){_0x529131[_0xa8ff('0x35')]=qs['limit'](_0x49247c[_0xa8ff('0x2e')][_0xa8ff('0x35')]);_0x529131[_0xa8ff('0x1b')]=qs['offset'](_0x49247c[_0xa8ff('0x2e')]['offset']);}_0x529131[_0xa8ff('0x36')]=qs[_0xa8ff('0x37')](_0x49247c[_0xa8ff('0x2e')][_0xa8ff('0x37')]);_0x529131[_0xa8ff('0x38')]=qs[_0xa8ff('0x39')](_['pick'](_0x49247c['query'],_0x4865e0['filters']),_0x15ed57);if(_0x49247c[_0xa8ff('0x2e')][_0xa8ff('0x3a')]){_0x529131[_0xa8ff('0x38')]=_[_0xa8ff('0x3b')](_0x529131['where'],{'$or':_[_0xa8ff('0x29')](_0x15ed57,function(_0x3beae9){if(_0x3beae9[_0xa8ff('0x3c')]!==_0xa8ff('0x3d')){var _0x77fd4f={};_0x77fd4f[_0x3beae9[_0xa8ff('0x27')]]={'$like':'%'+_0x49247c[_0xa8ff('0x2e')][_0xa8ff('0x3a')]+'%'};return _0x77fd4f;}})});}_0x529131=_[_0xa8ff('0x3b')]({},_0x529131,_0x49247c['options']);var _0x6679f2={'where':_0x529131[_0xa8ff('0x38')]};return db[_0xa8ff('0x2a')][_0xa8ff('0x1d')](_0x6679f2)[_0xa8ff('0x23')](function(_0x37e7f7){_0x2b7c31[_0xa8ff('0x1d')]=_0x37e7f7;if(_0x49247c[_0xa8ff('0x2e')][_0xa8ff('0x3e')]){_0x529131[_0xa8ff('0x3f')]=[{'all':!![]}];}return db[_0xa8ff('0x2a')][_0xa8ff('0x40')](_0x529131);})['then'](function(_0x2ce13c){_0x2b7c31[_0xa8ff('0x41')]=_0x2ce13c;return _0x2b7c31;})[_0xa8ff('0x23')](respondWithFilteredResult(_0x132a15,_0x529131))['catch'](handleError(_0x132a15,null));};exports['show']=function(_0x3f60eb,_0x4a2b32){var _0x30212c={'raw':!![],'where':{'id':_0x3f60eb[_0xa8ff('0x42')]['id']}},_0x1570c9={};_0x1570c9[_0xa8ff('0x2d')]=_['keys'](db[_0xa8ff('0x2a')]['rawAttributes']);_0x1570c9[_0xa8ff('0x2e')]=_[_0xa8ff('0x43')](_0x3f60eb['query']);_0x1570c9[_0xa8ff('0x39')]=_[_0xa8ff('0x2f')](_0x1570c9[_0xa8ff('0x2d')],_0x1570c9[_0xa8ff('0x2e')]);_0x30212c[_0xa8ff('0x30')]=_[_0xa8ff('0x2f')](_0x1570c9[_0xa8ff('0x2d')],qs[_0xa8ff('0x31')](_0x3f60eb[_0xa8ff('0x2e')][_0xa8ff('0x31')]));_0x30212c[_0xa8ff('0x30')]=_0x30212c[_0xa8ff('0x30')][_0xa8ff('0x32')]?_0x30212c[_0xa8ff('0x30')]:_0x1570c9[_0xa8ff('0x2d')];if(_0x3f60eb[_0xa8ff('0x2e')][_0xa8ff('0x3e')]){_0x30212c[_0xa8ff('0x3f')]=[{'all':!![]}];}_0x30212c=_[_0xa8ff('0x3b')]({},_0x30212c,_0x3f60eb[_0xa8ff('0x44')]);return db['SquareRecording'][_0xa8ff('0x45')](_0x30212c)['then'](handleEntityNotFound(_0x4a2b32,null))[_0xa8ff('0x23')](respondWithResult(_0x4a2b32,null))['catch'](handleError(_0x4a2b32,null));};exports[_0xa8ff('0x46')]=function(_0x45c6e0,_0x2ee523){return db[_0xa8ff('0x2a')][_0xa8ff('0x46')](_0x45c6e0[_0xa8ff('0x47')],{})['then'](respondWithResult(_0x2ee523,0xc9))[_0xa8ff('0x48')](handleError(_0x2ee523,null));};exports[_0xa8ff('0x49')]=function(_0x4ad0fe,_0x39d366){if(_0x4ad0fe['body']['id']){delete _0x4ad0fe[_0xa8ff('0x47')]['id'];}return db[_0xa8ff('0x2a')][_0xa8ff('0x45')]({'where':{'id':_0x4ad0fe[_0xa8ff('0x42')]['id']}})['then'](handleEntityNotFound(_0x39d366,null))[_0xa8ff('0x23')](saveUpdates(_0x4ad0fe[_0xa8ff('0x47')],null))['then'](respondWithResult(_0x39d366,null))[_0xa8ff('0x48')](handleError(_0x39d366,null));};exports[_0xa8ff('0x4a')]=function(_0x926b7f,_0x150470,_0x2a66db){var _0x599e2e=require(_0xa8ff('0x4b'));var _0x5a8253=![];var _0x4b88c6={};if(_0x926b7f[_0xa8ff('0x2e')][_0xa8ff('0x3c')]&&_0x926b7f[_0xa8ff('0x2e')][_0xa8ff('0x3c')]===_0xa8ff('0x4c')){_0x4b88c6[_0xa8ff('0x4c')]=_0x926b7f['params']['id'];}else{_0x4b88c6['id']=_0x926b7f[_0xa8ff('0x42')]['id'];}return db['SquareRecording']['find']({'where':_0x4b88c6,'attributes':['id',_0xa8ff('0x4d'),_0xa8ff('0x4e')],'raw':!![]})[_0xa8ff('0x23')](handleEntityNotFound(_0x150470,null))[_0xa8ff('0x23')](function(_0x2e25f4){if(_0x2e25f4){var _0x792f00=_0x2e25f4[_0xa8ff('0x4d')];var _0x2ffb0d=util[_0xa8ff('0x4f')](_0xa8ff('0x50'),_0x792f00);if(fs['existsSync'](_0x2ffb0d)){_0x5a8253=!![];return _0x599e2e['decryptFile'](_0x2ffb0d,_0x792f00,config['secrets'][_0xa8ff('0x51')])[_0xa8ff('0x23')](function(){return _0x2e25f4;});}return _0x2e25f4;}})['then'](function(_0x2c6a46){if(_0x2c6a46){var _0x1a6bfc=_0x2c6a46[_0xa8ff('0x4d')];if(!fs[_0xa8ff('0x52')](_0x1a6bfc)){throw new db[(_0xa8ff('0x53'))][(_0xa8ff('0x54'))]('SquareRecording\x20not\x20found');}if(_0x2c6a46[_0xa8ff('0x4e')]){return _0x150470[_0xa8ff('0x4a')](_0x1a6bfc,_0x2c6a46[_0xa8ff('0x4e')]+path[_0xa8ff('0x55')](_0x1a6bfc),function(){if(_0x5a8253){fs[_0xa8ff('0x56')](_0x1a6bfc);}});}else{return _0x150470[_0xa8ff('0x4a')](_0x1a6bfc,function(_0x33f00a){if(_0x5a8253){fs[_0xa8ff('0x56')](_0x1a6bfc);}});}}})['catch'](function(_0x21874c){if(_0x21874c[_0xa8ff('0x57')]==='SquareRecording\x20not\x20found'){_0x150470[_0xa8ff('0x18')](0x194)[_0xa8ff('0x58')](_0xa8ff('0x59'));}else{return handleError(_0x150470,null);}});};exports[_0xa8ff('0x24')]=function(_0x313160,_0x2de7d0){return db['SquareRecording']['find']({'where':{'id':_0x313160[_0xa8ff('0x42')]['id']}})[_0xa8ff('0x23')](function(_0x5c5f32){if(_[_0xa8ff('0x5a')](_0x5c5f32)){throw new ReferenceError(_0xa8ff('0x5b'));}return _0x5c5f32;})[_0xa8ff('0x23')](function(_0x3174fd){var _0x441314=_0x3174fd[_0xa8ff('0x4d')];logger['info'](_0xa8ff('0x5c'),_0x441314);if(!_[_0xa8ff('0x5a')](_0x3174fd[_0xa8ff('0x4d')])&&fs[_0xa8ff('0x52')](_0x441314)){logger[_0xa8ff('0x5d')]('File:\x20\x22'+_0x441314+_0xa8ff('0x5e'));fs[_0xa8ff('0x5f')](_0x441314);}_0x441314=_0x441314+_0xa8ff('0x60');if(!_[_0xa8ff('0x5a')](_0x3174fd[_0xa8ff('0x4d')])&&fs['existsSync'](_0x441314)){logger[_0xa8ff('0x5d')](_0xa8ff('0x61')+_0x441314+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa8ff('0x5f')](_0x441314);}return _0x3174fd;})['then'](function(_0x3ed9ab){if(!_0x3ed9ab)throw new InternalError();return _0x3ed9ab['destroy']();})['then'](function(){_0x2de7d0[_0xa8ff('0x18')](0xcc)[_0xa8ff('0x19')]();})[_0xa8ff('0x48')](handleError(_0x2de7d0,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 854bc56..4b5d345 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 _0x2ef3=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareRecording.attributes'];(function(_0x2429bd,_0x5a313a){var _0xd25392=function(_0x4c6cfb){while(--_0x4c6cfb){_0x2429bd['push'](_0x2429bd['shift']());}};_0xd25392(++_0x5a313a);}(_0x2ef3,0xba));var _0x32ef=function(_0x14875c,_0x524c92){_0x14875c=_0x14875c-0x0;var _0x24ccbd=_0x2ef3[_0x14875c];return _0x24ccbd;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39e6=['exports','define','SquareRecording','square_recordings','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x3a888c,_0x415acd){var _0x1958fb=function(_0x3741bb){while(--_0x3741bb){_0x3a888c['push'](_0x3a888c['shift']());}};_0x1958fb(++_0x415acd);}(_0x39e6,0x9e));var _0x639e=function(_0x571943,_0x2f78cd){_0x571943=_0x571943-0x0;var _0x42908f=_0x39e6[_0x571943];return _0x42908f;};'use strict';var _=require(_0x639e('0x0'));var util=require('util');var logger=require(_0x639e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x639e('0x2'));var rp=require(_0x639e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x639e('0x4'));var config=require(_0x639e('0x5'));var attributes=require(_0x639e('0x6'));module[_0x639e('0x7')]=function(_0x15e5df,_0x320448){return _0x15e5df[_0x639e('0x8')](_0x639e('0x9'),attributes,{'tableName':_0x639e('0xa'),'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 08aec5e..5b536a0 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 _0xd30a=['catch','CreateSquareRecording','SquareRecording','body','options','raw','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xd30a,0x19d));var _0xad30=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd30a[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xad30('0x0'));var util=require('util');var moment=require(_0xad30('0x1'));var BPromise=require(_0xad30('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad30('0x3'));var db=require(_0xad30('0x4'))['db'];var utils=require(_0xad30('0x5'));var logger=require(_0xad30('0x6'))(_0xad30('0x7'));var config=require(_0xad30('0x8'));var jayson=require(_0xad30('0x9'));var client=jayson[_0xad30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc0,_0x2e99d4,_0x1493da){return new BPromise(function(_0x20ac8b,_0x53e6fe){return client[_0xad30('0xb')](_0x3dc0,_0x1493da)[_0xad30('0xc')](function(_0x384583){logger['info'](_0xad30('0xd'),_0x2e99d4,_0xad30('0xe'));logger['debug'](_0xad30('0xf'),_0x2e99d4,_0xad30('0xe'),JSON[_0xad30('0x10')](_0x384583));if(_0x384583[_0xad30('0x11')]){if(_0x384583[_0xad30('0x11')][_0xad30('0x12')]===0x1f4){logger[_0xad30('0x11')](_0xad30('0xd'),_0x2e99d4,_0x384583[_0xad30('0x11')][_0xad30('0x13')]);return _0x53e6fe(_0x384583['error'][_0xad30('0x13')]);}logger[_0xad30('0x11')]('SquareRecording,\x20%s,\x20%s',_0x2e99d4,_0x384583[_0xad30('0x11')][_0xad30('0x13')]);return _0x20ac8b(_0x384583[_0xad30('0x11')]['message']);}else{logger[_0xad30('0x14')](_0xad30('0xd'),_0x2e99d4,_0xad30('0xe'));_0x20ac8b(_0x384583[_0xad30('0x15')][_0xad30('0x13')]);}})[_0xad30('0x16')](function(_0x2a6d9c){logger[_0xad30('0x11')](_0xad30('0xd'),_0x2e99d4,_0x2a6d9c);_0x53e6fe(_0x2a6d9c);});});}exports[_0xad30('0x17')]=function(_0x19a0cc){var _0x16cb53=this;return new Promise(function(_0x842841,_0x5068eb){return db[_0xad30('0x18')]['create'](_0x19a0cc[_0xad30('0x19')],{'raw':_0x19a0cc[_0xad30('0x1a')]?_0x19a0cc['options'][_0xad30('0x1b')]===undefined?!![]:![]:!![]})[_0xad30('0xc')](function(_0x312704){logger[_0xad30('0x14')]('CreateSquareRecording',_0x19a0cc);logger[_0xad30('0x1c')](_0xad30('0x17'),_0x19a0cc,JSON[_0xad30('0x10')](_0x312704));_0x842841(_0x312704);})[_0xad30('0x16')](function(_0x12ec56){logger['error'](_0xad30('0x17'),_0x12ec56[_0xad30('0x13')],_0x19a0cc);_0x5068eb(_0x16cb53[_0xad30('0x11')](0x1f4,_0x12ec56[_0xad30('0x13')]));});});}; \ No newline at end of file +var _0xe995=['body','CreateSquareRecording','stringify','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe995,0x179));var _0x5e99=function(_0x23ab68,_0x165ca5){_0x23ab68=_0x23ab68-0x0;var _0x1039e8=_0xe995[_0x23ab68];return _0x1039e8;};'use strict';var _=require(_0x5e99('0x0'));var util=require('util');var moment=require(_0x5e99('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e99('0x2'));var fs=require('fs');var Redis=require(_0x5e99('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e99('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5e99('0x5'));var jayson=require(_0x5e99('0x6'));var client=jayson['client'][_0x5e99('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x145180,_0x1bbe16,_0x42cf14){return new BPromise(function(_0x4c10c7,_0x4e0560){return client[_0x5e99('0x8')](_0x145180,_0x42cf14)['then'](function(_0x42fedb){logger[_0x5e99('0x9')](_0x5e99('0xa'),_0x1bbe16,_0x5e99('0xb'));logger[_0x5e99('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1bbe16,_0x5e99('0xb'),JSON['stringify'](_0x42fedb));if(_0x42fedb[_0x5e99('0xd')]){if(_0x42fedb[_0x5e99('0xd')][_0x5e99('0xe')]===0x1f4){logger[_0x5e99('0xd')](_0x5e99('0xa'),_0x1bbe16,_0x42fedb['error'][_0x5e99('0xf')]);return _0x4e0560(_0x42fedb['error'][_0x5e99('0xf')]);}logger[_0x5e99('0xd')](_0x5e99('0xa'),_0x1bbe16,_0x42fedb[_0x5e99('0xd')][_0x5e99('0xf')]);return _0x4c10c7(_0x42fedb[_0x5e99('0xd')][_0x5e99('0xf')]);}else{logger[_0x5e99('0x9')](_0x5e99('0xa'),_0x1bbe16,_0x5e99('0xb'));_0x4c10c7(_0x42fedb[_0x5e99('0x10')][_0x5e99('0xf')]);}})[_0x5e99('0x11')](function(_0x420cf2){logger['error'](_0x5e99('0xa'),_0x1bbe16,_0x420cf2);_0x4e0560(_0x420cf2);});});}exports['CreateSquareRecording']=function(_0x4d77e9){var _0x3d9deb=this;return new Promise(function(_0x4d31bb,_0x20cb1b){return db['SquareRecording'][_0x5e99('0x12')](_0x4d77e9[_0x5e99('0x13')],{'raw':_0x4d77e9['options']?_0x4d77e9['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0xef85d7){logger[_0x5e99('0x9')]('CreateSquareRecording',_0x4d77e9);logger[_0x5e99('0xc')](_0x5e99('0x14'),_0x4d77e9,JSON[_0x5e99('0x15')](_0xef85d7));_0x4d31bb(_0xef85d7);})[_0x5e99('0x11')](function(_0x4f8517){logger[_0x5e99('0xd')](_0x5e99('0x14'),_0x4f8517['message'],_0x4d77e9);_0x20cb1b(_0x3d9deb[_0x5e99('0xd')](0x1f4,_0x4f8517['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index bb911d2..35201ee 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3619cb,_0x1020a8){var _0x4d9a99=function(_0x4ee563){while(--_0x4ee563){_0x3619cb['push'](_0x3619cb['shift']());}};_0x4d9a99(++_0x1020a8);}(_0xe706,0xa3));var _0x6e70=function(_0x3161f4,_0x8e7b45){_0x3161f4=_0x3161f4-0x0;var _0x1b2b59=_0xe706[_0x3161f4];return _0x1b2b59;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _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(_0x1920ec,_0x4d5de1){var _0x3c6d1d=function(_0x4fab08){while(--_0x4fab08){_0x1920ec['push'](_0x1920ec['shift']());}};_0x3c6d1d(++_0x4d5de1);}(_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'));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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 7c51a16..e5ba60e 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 _0xc29e=['exports','STRING','DATE','BOOLEAN'];(function(_0x2756ac,_0x102b48){var _0x551c31=function(_0x23b24f){while(--_0x23b24f){_0x2756ac['push'](_0x2756ac['shift']());}};_0x551c31(++_0x102b48);}(_0xc29e,0x1ec));var _0xec29=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc29e[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xec29('0x0')]={'network':{'type':Sequelize[_0xec29('0x1')]},'network_script':{'type':Sequelize[_0xec29('0x1')]},'request':{'type':Sequelize[_0xec29('0x1')]},'channel':{'type':Sequelize[_0xec29('0x1')]},'language':{'type':Sequelize[_0xec29('0x1')]},'type':{'type':Sequelize[_0xec29('0x1')]},'uniqueid':{'type':Sequelize[_0xec29('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xec29('0x1')]},'calleridname':{'type':Sequelize[_0xec29('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xec29('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xec29('0x1')]},'rdnis':{'type':Sequelize[_0xec29('0x1')]},'context':{'type':Sequelize[_0xec29('0x1')]},'extension':{'type':Sequelize[_0xec29('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xec29('0x1')]},'accountcode':{'type':Sequelize[_0xec29('0x1')]},'threadid':{'type':Sequelize[_0xec29('0x1')]},'project_name':{'type':Sequelize[_0xec29('0x1')]},'joinAt':{'type':Sequelize[_0xec29('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xec29('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x75e9=['BOOLEAN','exports','STRING','DATE'];(function(_0x6243bb,_0x269bd7){var _0x16ef17=function(_0x5771f1){while(--_0x5771f1){_0x6243bb['push'](_0x6243bb['shift']());}};_0x16ef17(++_0x269bd7);}(_0x75e9,0x1c1));var _0x975e=function(_0x1618d6,_0x4a1a6e){_0x1618d6=_0x1618d6-0x0;var _0x5a3e58=_0x75e9[_0x1618d6];return _0x5a3e58;};'use strict';var Sequelize=require('sequelize');module[_0x975e('0x0')]={'network':{'type':Sequelize[_0x975e('0x1')]},'network_script':{'type':Sequelize[_0x975e('0x1')]},'request':{'type':Sequelize[_0x975e('0x1')]},'channel':{'type':Sequelize[_0x975e('0x1')]},'language':{'type':Sequelize[_0x975e('0x1')]},'type':{'type':Sequelize[_0x975e('0x1')]},'uniqueid':{'type':Sequelize[_0x975e('0x1')]},'version':{'type':Sequelize[_0x975e('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x975e('0x1')]},'callingpres':{'type':Sequelize[_0x975e('0x1')]},'callingani2':{'type':Sequelize[_0x975e('0x1')]},'callington':{'type':Sequelize[_0x975e('0x1')]},'callingtns':{'type':Sequelize[_0x975e('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x975e('0x1')]},'context':{'type':Sequelize[_0x975e('0x1')]},'extension':{'type':Sequelize[_0x975e('0x1')]},'priority':{'type':Sequelize[_0x975e('0x1')]},'enhanced':{'type':Sequelize[_0x975e('0x1')]},'accountcode':{'type':Sequelize[_0x975e('0x1')]},'threadid':{'type':Sequelize[_0x975e('0x1')]},'project_name':{'type':Sequelize[_0x975e('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x975e('0x2')]},'bot':{'type':Sequelize[_0x975e('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 aab3b78..b298e31 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 _0x226f=['where','pick','merge','type','VIRTUAL','filter','SquareReport','include','findAll','rows','catch','show','params','intersection','length','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3d28c4,_0x12fdad){var _0x32f6af=function(_0x58e0b8){while(--_0x58e0b8){_0x3d28c4['push'](_0x3d28c4['shift']());}};_0x32f6af(++_0x12fdad);}(_0x226f,0xa3));var _0xf226=function(_0x42e961,_0x50673d){_0x42e961=_0x42e961-0x0;var _0x34f66b=_0x226f[_0x42e961];return _0x34f66b;};'use strict';var emlformat=require(_0xf226('0x0'));var rimraf=require(_0xf226('0x1'));var zipdir=require(_0xf226('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf226('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf226('0x4'));var sox=require(_0xf226('0x5'));var csv=require(_0xf226('0x6'));var ejs=require(_0xf226('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf226('0x8'));var squel=require(_0xf226('0x9'));var crypto=require(_0xf226('0xa'));var jsforce=require(_0xf226('0xb'));var deskjs=require(_0xf226('0xc'));var toCsv=require(_0xf226('0x6'));var querystring=require(_0xf226('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf226('0xe'));var qs=require(_0xf226('0xf'));var as=require(_0xf226('0x10'));var hardwareService=require(_0xf226('0x11'));var logger=require('../../config/logger')(_0xf226('0x12'));var utils=require('../../config/utils');var config=require(_0xf226('0x13'));var licenseUtil=require(_0xf226('0x14'));var db=require(_0xf226('0x15'))['db'];function respondWithStatusCode(_0x3e98f8,_0x4a7aa2){_0x4a7aa2=_0x4a7aa2||0xcc;return function(_0x4c8a06){if(_0x4c8a06){return _0x3e98f8[_0xf226('0x16')](_0x4a7aa2);}return _0x3e98f8['status'](_0x4a7aa2)['end']();};}function respondWithResult(_0x2a765b,_0x5555f7){_0x5555f7=_0x5555f7||0xc8;return function(_0x427d26){if(_0x427d26){return _0x2a765b[_0xf226('0x17')](_0x5555f7)[_0xf226('0x18')](_0x427d26);}};}function respondWithFilteredResult(_0x52fefc,_0x387b47){return function(_0x4c0779){if(_0x4c0779){var _0xbaf603=typeof _0x387b47['offset']==='undefined'&&typeof _0x387b47[_0xf226('0x19')]==='undefined';var _0x1f9cab=_0x4c0779[_0xf226('0x1a')];var _0x4a5a0a=_0xbaf603?0x0:_0x387b47[_0xf226('0x1b')];var _0x1039e0=_0xbaf603?_0x4c0779[_0xf226('0x1a')]:_0x387b47[_0xf226('0x1b')]+_0x387b47['limit'];var _0xefcfdf;if(_0x1039e0>=_0x1f9cab){_0x1039e0=_0x1f9cab;_0xefcfdf=0xc8;}else{_0xefcfdf=0xce;}_0x52fefc[_0xf226('0x17')](_0xefcfdf);return _0x52fefc[_0xf226('0x1c')](_0xf226('0x1d'),_0x4a5a0a+'-'+_0x1039e0+'/'+_0x1f9cab)[_0xf226('0x18')](_0x4c0779);}return null;};}function patchUpdates(_0xf16dd9){return function(_0x1a578a){try{jsonpatch['apply'](_0x1a578a,_0xf16dd9,!![]);}catch(_0x2a7a72){return BPromise[_0xf226('0x1e')](_0x2a7a72);}return _0x1a578a[_0xf226('0x1f')]();};}function saveUpdates(_0x110f6e,_0x2826a6){return function(_0x544fba){if(_0x544fba){return _0x544fba[_0xf226('0x20')](_0x110f6e)[_0xf226('0x21')](function(_0x548f4f){return _0x548f4f;});}return null;};}function removeEntity(_0x546f18,_0x361604){return function(_0x50fb73){if(_0x50fb73){return _0x50fb73[_0xf226('0x22')]()['then'](function(){_0x546f18[_0xf226('0x17')](0xcc)[_0xf226('0x23')]();});}};}function handleEntityNotFound(_0xd9362f,_0x3c561b){return function(_0x5abff8){if(!_0x5abff8){_0xd9362f[_0xf226('0x16')](0x194);}return _0x5abff8;};}function handleError(_0x5d1d10,_0x3d9078){_0x3d9078=_0x3d9078||0x1f4;return function(_0x5b5e48){logger['error'](_0x5b5e48[_0xf226('0x24')]);if(_0x5b5e48['name']){delete _0x5b5e48[_0xf226('0x25')];}_0x5d1d10[_0xf226('0x17')](_0x3d9078)['send'](_0x5b5e48);};}exports[_0xf226('0x26')]=function(_0x1e8dc5,_0x43e9e5){var _0x3038bb={},_0x130750={},_0x5ba878={'count':0x0,'rows':[]};var _0x1dfed2=_['map'](db['SquareReport'][_0xf226('0x27')],function(_0xfabc24){return{'name':_0xfabc24[_0xf226('0x28')],'type':_0xfabc24['type'][_0xf226('0x29')]};});_0x130750[_0xf226('0x2a')]=_[_0xf226('0x2b')](_0x1dfed2,_0xf226('0x25'));_0x130750[_0xf226('0x2c')]=_[_0xf226('0x2d')](_0x1e8dc5['query']);_0x130750[_0xf226('0x2e')]=_['intersection'](_0x130750[_0xf226('0x2a')],_0x130750['query']);_0x3038bb[_0xf226('0x2f')]=_['intersection'](_0x130750[_0xf226('0x2a')],qs[_0xf226('0x30')](_0x1e8dc5[_0xf226('0x2c')]['fields']));_0x3038bb['attributes']=_0x3038bb[_0xf226('0x2f')]['length']?_0x3038bb[_0xf226('0x2f')]:_0x130750[_0xf226('0x2a')];if(!_0x1e8dc5[_0xf226('0x2c')][_0xf226('0x31')](_0xf226('0x32'))){_0x3038bb[_0xf226('0x19')]=qs[_0xf226('0x19')](_0x1e8dc5[_0xf226('0x2c')][_0xf226('0x19')]);_0x3038bb[_0xf226('0x1b')]=qs['offset'](_0x1e8dc5[_0xf226('0x2c')]['offset']);}_0x3038bb[_0xf226('0x33')]=qs[_0xf226('0x34')](_0x1e8dc5[_0xf226('0x2c')]['sort']);_0x3038bb[_0xf226('0x35')]=qs[_0xf226('0x2e')](_[_0xf226('0x36')](_0x1e8dc5['query'],_0x130750[_0xf226('0x2e')]),_0x1dfed2);if(_0x1e8dc5[_0xf226('0x2c')]['filter']){_0x3038bb[_0xf226('0x35')]=_[_0xf226('0x37')](_0x3038bb[_0xf226('0x35')],{'$or':_[_0xf226('0x2b')](_0x1dfed2,function(_0x5a58fe){if(_0x5a58fe[_0xf226('0x38')]!==_0xf226('0x39')){var _0x5e591b={};_0x5e591b[_0x5a58fe[_0xf226('0x25')]]={'$like':'%'+_0x1e8dc5['query'][_0xf226('0x3a')]+'%'};return _0x5e591b;}})});}_0x3038bb=_['merge']({},_0x3038bb,_0x1e8dc5['options']);var _0x4e3e77={'where':_0x3038bb[_0xf226('0x35')]};return db[_0xf226('0x3b')][_0xf226('0x1a')](_0x4e3e77)[_0xf226('0x21')](function(_0x394837){_0x5ba878[_0xf226('0x1a')]=_0x394837;if(_0x1e8dc5[_0xf226('0x2c')]['includeAll']){_0x3038bb[_0xf226('0x3c')]=[{'all':!![]}];}return db[_0xf226('0x3b')][_0xf226('0x3d')](_0x3038bb);})[_0xf226('0x21')](function(_0x2aa2ba){_0x5ba878[_0xf226('0x3e')]=_0x2aa2ba;return _0x5ba878;})[_0xf226('0x21')](respondWithFilteredResult(_0x43e9e5,_0x3038bb))[_0xf226('0x3f')](handleError(_0x43e9e5,null));};exports[_0xf226('0x40')]=function(_0x16b102,_0xa3f446){var _0x548c36={'raw':!![],'where':{'id':_0x16b102[_0xf226('0x41')]['id']}},_0xff945d={};_0xff945d[_0xf226('0x2a')]=_[_0xf226('0x2d')](db[_0xf226('0x3b')]['rawAttributes']);_0xff945d[_0xf226('0x2c')]=_[_0xf226('0x2d')](_0x16b102['query']);_0xff945d[_0xf226('0x2e')]=_['intersection'](_0xff945d['model'],_0xff945d[_0xf226('0x2c')]);_0x548c36['attributes']=_[_0xf226('0x42')](_0xff945d['model'],qs[_0xf226('0x30')](_0x16b102[_0xf226('0x2c')][_0xf226('0x30')]));_0x548c36[_0xf226('0x2f')]=_0x548c36['attributes'][_0xf226('0x43')]?_0x548c36[_0xf226('0x2f')]:_0xff945d[_0xf226('0x2a')];if(_0x16b102[_0xf226('0x2c')]['includeAll']){_0x548c36[_0xf226('0x3c')]=[{'all':!![]}];}_0x548c36=_['merge']({},_0x548c36,_0x16b102['options']);return db['SquareReport'][_0xf226('0x44')](_0x548c36)['then'](handleEntityNotFound(_0xa3f446,null))['then'](respondWithResult(_0xa3f446,null))[_0xf226('0x3f')](handleError(_0xa3f446,null));};exports['create']=function(_0x28fade,_0x1dc935){return db[_0xf226('0x3b')][_0xf226('0x45')](_0x28fade[_0xf226('0x46')],{})[_0xf226('0x21')](respondWithResult(_0x1dc935,0xc9))[_0xf226('0x3f')](handleError(_0x1dc935,null));};exports[_0xf226('0x20')]=function(_0x3e49f6,_0x32a58f){if(_0x3e49f6[_0xf226('0x46')]['id']){delete _0x3e49f6['body']['id'];}return db[_0xf226('0x3b')]['find']({'where':{'id':_0x3e49f6[_0xf226('0x41')]['id']}})['then'](handleEntityNotFound(_0x32a58f,null))[_0xf226('0x21')](saveUpdates(_0x3e49f6[_0xf226('0x46')],null))['then'](respondWithResult(_0x32a58f,null))['catch'](handleError(_0x32a58f,null));};exports[_0xf226('0x22')]=function(_0x4da397,_0x2a4356){return db['SquareReport']['find']({'where':{'id':_0x4da397[_0xf226('0x41')]['id']}})[_0xf226('0x21')](handleEntityNotFound(_0x2a4356,null))[_0xf226('0x21')](removeEntity(_0x2a4356,null))['catch'](handleError(_0x2a4356,null));};exports[_0xf226('0x47')]=function(_0x51cd4f,_0x17ada3){return db['SquareReport'][_0xf226('0x47')]()[_0xf226('0x21')](respondWithResult(_0x17ada3,null))['catch'](handleError(_0x17ada3,null));}; \ No newline at end of file +var _0xd42f=['catch','show','rawAttributes','options','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0xb3f66a,_0x211103){var _0x1db82a=function(_0x273993){while(--_0x273993){_0xb3f66a['push'](_0xb3f66a['shift']());}};_0x1db82a(++_0x211103);}(_0xd42f,0x130));var _0xfd42=function(_0x45011a,_0x41c533){_0x45011a=_0x45011a-0x0;var _0xfcdd4=_0xd42f[_0x45011a];return _0xfcdd4;};'use strict';var emlformat=require(_0xfd42('0x0'));var rimraf=require(_0xfd42('0x1'));var zipdir=require(_0xfd42('0x2'));var jsonpatch=require(_0xfd42('0x3'));var rp=require(_0xfd42('0x4'));var moment=require(_0xfd42('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfd42('0x6'));var util=require(_0xfd42('0x7'));var path=require(_0xfd42('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd42('0x9'));var _=require('lodash');var squel=require(_0xfd42('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfd42('0xb'));var toCsv=require(_0xfd42('0xc'));var querystring=require(_0xfd42('0xd'));var Papa=require(_0xfd42('0xe'));var Redis=require(_0xfd42('0xf'));var authService=require(_0xfd42('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfd42('0x11'));var hardwareService=require(_0xfd42('0x12'));var logger=require(_0xfd42('0x13'))(_0xfd42('0x14'));var utils=require('../../config/utils');var config=require(_0xfd42('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd42('0x16'))['db'];function respondWithStatusCode(_0x206d00,_0x2e3e17){_0x2e3e17=_0x2e3e17||0xcc;return function(_0x3d9ac0){if(_0x3d9ac0){return _0x206d00[_0xfd42('0x17')](_0x2e3e17);}return _0x206d00[_0xfd42('0x18')](_0x2e3e17)[_0xfd42('0x19')]();};}function respondWithResult(_0x27fa2e,_0x1ca889){_0x1ca889=_0x1ca889||0xc8;return function(_0x2bf879){if(_0x2bf879){return _0x27fa2e[_0xfd42('0x18')](_0x1ca889)[_0xfd42('0x1a')](_0x2bf879);}};}function respondWithFilteredResult(_0x436818,_0x2c6a7f){return function(_0x47df85){if(_0x47df85){var _0x109a71=typeof _0x2c6a7f['offset']===_0xfd42('0x1b')&&typeof _0x2c6a7f[_0xfd42('0x1c')]==='undefined';var _0x298c14=_0x47df85['count'];var _0x1d4c23=_0x109a71?0x0:_0x2c6a7f[_0xfd42('0x1d')];var _0x35b442=_0x109a71?_0x47df85[_0xfd42('0x1e')]:_0x2c6a7f['offset']+_0x2c6a7f[_0xfd42('0x1c')];var _0x19927a;if(_0x35b442>=_0x298c14){_0x35b442=_0x298c14;_0x19927a=0xc8;}else{_0x19927a=0xce;}_0x436818[_0xfd42('0x18')](_0x19927a);return _0x436818['set'](_0xfd42('0x1f'),_0x1d4c23+'-'+_0x35b442+'/'+_0x298c14)[_0xfd42('0x1a')](_0x47df85);}return null;};}function patchUpdates(_0x542ea7){return function(_0x53364b){try{jsonpatch[_0xfd42('0x20')](_0x53364b,_0x542ea7,!![]);}catch(_0x37be6d){return BPromise[_0xfd42('0x21')](_0x37be6d);}return _0x53364b[_0xfd42('0x22')]();};}function saveUpdates(_0xcc3d6a,_0x34c842){return function(_0x429be0){if(_0x429be0){return _0x429be0[_0xfd42('0x23')](_0xcc3d6a)[_0xfd42('0x24')](function(_0x45fd57){return _0x45fd57;});}return null;};}function removeEntity(_0x5e6990,_0x38fbdd){return function(_0x334197){if(_0x334197){return _0x334197[_0xfd42('0x25')]()['then'](function(){_0x5e6990[_0xfd42('0x18')](0xcc)[_0xfd42('0x19')]();});}};}function handleEntityNotFound(_0x3dea39,_0x2b16c7){return function(_0xbb7915){if(!_0xbb7915){_0x3dea39[_0xfd42('0x17')](0x194);}return _0xbb7915;};}function handleError(_0x4af4d0,_0x8c192d){_0x8c192d=_0x8c192d||0x1f4;return function(_0x1e0a96){logger[_0xfd42('0x26')](_0x1e0a96[_0xfd42('0x27')]);if(_0x1e0a96['name']){delete _0x1e0a96[_0xfd42('0x28')];}_0x4af4d0[_0xfd42('0x18')](_0x8c192d)[_0xfd42('0x29')](_0x1e0a96);};}exports[_0xfd42('0x2a')]=function(_0x1048b5,_0x125652){var _0x3e7dd7={},_0x5b42fb={},_0xa0f495={'count':0x0,'rows':[]};var _0x42cc56=_[_0xfd42('0x2b')](db[_0xfd42('0x2c')]['rawAttributes'],function(_0x3f8e02){return{'name':_0x3f8e02[_0xfd42('0x2d')],'type':_0x3f8e02[_0xfd42('0x2e')]['key']};});_0x5b42fb[_0xfd42('0x2f')]=_[_0xfd42('0x2b')](_0x42cc56,'name');_0x5b42fb[_0xfd42('0x30')]=_[_0xfd42('0x31')](_0x1048b5[_0xfd42('0x30')]);_0x5b42fb[_0xfd42('0x32')]=_['intersection'](_0x5b42fb['model'],_0x5b42fb['query']);_0x3e7dd7[_0xfd42('0x33')]=_[_0xfd42('0x34')](_0x5b42fb['model'],qs[_0xfd42('0x35')](_0x1048b5['query']['fields']));_0x3e7dd7[_0xfd42('0x33')]=_0x3e7dd7['attributes'][_0xfd42('0x36')]?_0x3e7dd7['attributes']:_0x5b42fb[_0xfd42('0x2f')];if(!_0x1048b5[_0xfd42('0x30')][_0xfd42('0x37')](_0xfd42('0x38'))){_0x3e7dd7[_0xfd42('0x1c')]=qs[_0xfd42('0x1c')](_0x1048b5[_0xfd42('0x30')][_0xfd42('0x1c')]);_0x3e7dd7[_0xfd42('0x1d')]=qs['offset'](_0x1048b5[_0xfd42('0x30')]['offset']);}_0x3e7dd7[_0xfd42('0x39')]=qs[_0xfd42('0x3a')](_0x1048b5[_0xfd42('0x30')]['sort']);_0x3e7dd7[_0xfd42('0x3b')]=qs[_0xfd42('0x32')](_['pick'](_0x1048b5[_0xfd42('0x30')],_0x5b42fb[_0xfd42('0x32')]),_0x42cc56);if(_0x1048b5[_0xfd42('0x30')][_0xfd42('0x3c')]){_0x3e7dd7[_0xfd42('0x3b')]=_[_0xfd42('0x3d')](_0x3e7dd7[_0xfd42('0x3b')],{'$or':_[_0xfd42('0x2b')](_0x42cc56,function(_0x4760fd){if(_0x4760fd[_0xfd42('0x2e')]!==_0xfd42('0x3e')){var _0x351c8c={};_0x351c8c[_0x4760fd[_0xfd42('0x28')]]={'$like':'%'+_0x1048b5[_0xfd42('0x30')][_0xfd42('0x3c')]+'%'};return _0x351c8c;}})});}_0x3e7dd7=_[_0xfd42('0x3d')]({},_0x3e7dd7,_0x1048b5['options']);var _0x529d93={'where':_0x3e7dd7['where']};return db[_0xfd42('0x2c')][_0xfd42('0x1e')](_0x529d93)['then'](function(_0x4de96a){_0xa0f495[_0xfd42('0x1e')]=_0x4de96a;if(_0x1048b5[_0xfd42('0x30')][_0xfd42('0x3f')]){_0x3e7dd7[_0xfd42('0x40')]=[{'all':!![]}];}return db['SquareReport'][_0xfd42('0x41')](_0x3e7dd7);})[_0xfd42('0x24')](function(_0x479066){_0xa0f495['rows']=_0x479066;return _0xa0f495;})[_0xfd42('0x24')](respondWithFilteredResult(_0x125652,_0x3e7dd7))[_0xfd42('0x42')](handleError(_0x125652,null));};exports[_0xfd42('0x43')]=function(_0x50c200,_0x3da272){var _0x17567c={'raw':!![],'where':{'id':_0x50c200['params']['id']}},_0x4a4efb={};_0x4a4efb[_0xfd42('0x2f')]=_[_0xfd42('0x31')](db[_0xfd42('0x2c')][_0xfd42('0x44')]);_0x4a4efb[_0xfd42('0x30')]=_[_0xfd42('0x31')](_0x50c200[_0xfd42('0x30')]);_0x4a4efb[_0xfd42('0x32')]=_['intersection'](_0x4a4efb['model'],_0x4a4efb[_0xfd42('0x30')]);_0x17567c[_0xfd42('0x33')]=_['intersection'](_0x4a4efb[_0xfd42('0x2f')],qs['fields'](_0x50c200[_0xfd42('0x30')][_0xfd42('0x35')]));_0x17567c[_0xfd42('0x33')]=_0x17567c[_0xfd42('0x33')][_0xfd42('0x36')]?_0x17567c[_0xfd42('0x33')]:_0x4a4efb[_0xfd42('0x2f')];if(_0x50c200[_0xfd42('0x30')][_0xfd42('0x3f')]){_0x17567c[_0xfd42('0x40')]=[{'all':!![]}];}_0x17567c=_[_0xfd42('0x3d')]({},_0x17567c,_0x50c200[_0xfd42('0x45')]);return db[_0xfd42('0x2c')]['find'](_0x17567c)[_0xfd42('0x24')](handleEntityNotFound(_0x3da272,null))[_0xfd42('0x24')](respondWithResult(_0x3da272,null))['catch'](handleError(_0x3da272,null));};exports[_0xfd42('0x46')]=function(_0x5eb3b4,_0x538780){return db[_0xfd42('0x2c')][_0xfd42('0x46')](_0x5eb3b4[_0xfd42('0x47')],{})[_0xfd42('0x24')](respondWithResult(_0x538780,0xc9))['catch'](handleError(_0x538780,null));};exports[_0xfd42('0x23')]=function(_0x4921f3,_0x26e1ad){if(_0x4921f3[_0xfd42('0x47')]['id']){delete _0x4921f3['body']['id'];}return db[_0xfd42('0x2c')]['find']({'where':{'id':_0x4921f3[_0xfd42('0x48')]['id']}})[_0xfd42('0x24')](handleEntityNotFound(_0x26e1ad,null))[_0xfd42('0x24')](saveUpdates(_0x4921f3['body'],null))[_0xfd42('0x24')](respondWithResult(_0x26e1ad,null))[_0xfd42('0x42')](handleError(_0x26e1ad,null));};exports[_0xfd42('0x25')]=function(_0x14db5a,_0x5b5384){return db['SquareReport']['find']({'where':{'id':_0x14db5a[_0xfd42('0x48')]['id']}})[_0xfd42('0x24')](handleEntityNotFound(_0x5b5384,null))[_0xfd42('0x24')](removeEntity(_0x5b5384,null))['catch'](handleError(_0x5b5384,null));};exports[_0xfd42('0x49')]=function(_0x4515be,_0xab5c3b){return db[_0xfd42('0x2c')][_0xfd42('0x49')]()[_0xfd42('0x24')](respondWithResult(_0xab5c3b,null))[_0xfd42('0x42')](handleError(_0xab5c3b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 3bd74ec..0dcfdf9 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 _0x746d=['moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api'];(function(_0x57c955,_0x31e625){var _0x382c3f=function(_0x142bab){while(--_0x142bab){_0x57c955['push'](_0x57c955['shift']());}};_0x382c3f(++_0x31e625);}(_0x746d,0xc0));var _0xd746=function(_0xc864d,_0x3443f2){_0xc864d=_0xc864d-0x0;var _0x4a1305=_0x746d[_0xc864d];return _0x4a1305;};'use strict';var _=require(_0xd746('0x0'));var util=require(_0xd746('0x1'));var logger=require(_0xd746('0x2'))(_0xd746('0x3'));var moment=require(_0xd746('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd746('0x5'));var rimraf=require(_0xd746('0x6'));var config=require(_0xd746('0x7'));var attributes=require(_0xd746('0x8'));module[_0xd746('0x9')]=function(_0x2b87d5,_0x186249){return _0x2b87d5['define'](_0xd746('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xd746('0xb'),'fields':[_0xd746('0xc'),'project_name']},{'name':'leaveAt','fields':[_0xd746('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf48f=['../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3bf3dd,_0x215d2e){var _0x20740b=function(_0x44d693){while(--_0x44d693){_0x3bf3dd['push'](_0x3bf3dd['shift']());}};_0x20740b(++_0x215d2e);}(_0xf48f,0xc3));var _0xff48=function(_0x362b4a,_0x1cd85c){_0x362b4a=_0x362b4a-0x0;var _0x259998=_0xf48f[_0x362b4a];return _0x259998;};'use strict';var _=require(_0xff48('0x0'));var util=require(_0xff48('0x1'));var logger=require(_0xff48('0x2'))(_0xff48('0x3'));var moment=require(_0xff48('0x4'));var BPromise=require(_0xff48('0x5'));var rp=require(_0xff48('0x6'));var fs=require('fs');var path=require(_0xff48('0x7'));var rimraf=require(_0xff48('0x8'));var config=require(_0xff48('0x9'));var attributes=require(_0xff48('0xa'));module[_0xff48('0xb')]=function(_0x436fcd,_0x21c15c){return _0x436fcd['define'](_0xff48('0xc'),attributes,{'tableName':_0xff48('0xd'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xff48('0xe'),_0xff48('0xf')]},{'name':_0xff48('0x10'),'fields':[_0xff48('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 10847aa..0fd0ea1 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 _0x0127=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareReport','SquareReport','create','options','raw','update','body','where','limit','UpdateSquareReport','debug','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x555f6e,_0x365467){var _0x3e6d19=function(_0x36c297){while(--_0x36c297){_0x555f6e['push'](_0x555f6e['shift']());}};_0x3e6d19(++_0x365467);}(_0x0127,0x87));var _0x7012=function(_0x27b337,_0x193ee5){_0x27b337=_0x27b337-0x0;var _0x197a84=_0x0127[_0x27b337];return _0x197a84;};'use strict';var _=require(_0x7012('0x0'));var util=require(_0x7012('0x1'));var moment=require(_0x7012('0x2'));var BPromise=require(_0x7012('0x3'));var rs=require(_0x7012('0x4'));var fs=require('fs');var Redis=require(_0x7012('0x5'));var db=require(_0x7012('0x6'))['db'];var utils=require(_0x7012('0x7'));var logger=require(_0x7012('0x8'))(_0x7012('0x9'));var config=require(_0x7012('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7012('0xb')][_0x7012('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e63e8,_0x233387,_0x4af649){return new BPromise(function(_0x141db1,_0x1e69d8){return client[_0x7012('0xd')](_0x5e63e8,_0x4af649)[_0x7012('0xe')](function(_0x16fe90){logger[_0x7012('0xf')](_0x7012('0x10'),_0x233387,_0x7012('0x11'));logger['debug'](_0x7012('0x12'),_0x233387,'request\x20sent',JSON[_0x7012('0x13')](_0x16fe90));if(_0x16fe90['error']){if(_0x16fe90[_0x7012('0x14')][_0x7012('0x15')]===0x1f4){logger[_0x7012('0x14')]('SquareReport,\x20%s,\x20%s',_0x233387,_0x16fe90['error'][_0x7012('0x16')]);return _0x1e69d8(_0x16fe90[_0x7012('0x14')][_0x7012('0x16')]);}logger['error'](_0x7012('0x10'),_0x233387,_0x16fe90[_0x7012('0x14')][_0x7012('0x16')]);return _0x141db1(_0x16fe90[_0x7012('0x14')][_0x7012('0x16')]);}else{logger['info'](_0x7012('0x10'),_0x233387,_0x7012('0x11'));_0x141db1(_0x16fe90['result']['message']);}})['catch'](function(_0x46211a){logger[_0x7012('0x14')](_0x7012('0x10'),_0x233387,_0x46211a);_0x1e69d8(_0x46211a);});});}exports[_0x7012('0x17')]=function(_0xc5f557){var _0x6dad57=this;return new Promise(function(_0x546ecd,_0x165268){return db[_0x7012('0x18')][_0x7012('0x19')](_0xc5f557['body'],{'raw':_0xc5f557[_0x7012('0x1a')]?_0xc5f557[_0x7012('0x1a')][_0x7012('0x1b')]===undefined?!![]:![]:!![]})[_0x7012('0xe')](function(_0x2a2997){logger[_0x7012('0xf')](_0x7012('0x17'),_0xc5f557);logger['debug'](_0x7012('0x17'),_0xc5f557,JSON['stringify'](_0x2a2997));_0x546ecd(_0x2a2997);})['catch'](function(_0x3bcf11){logger['error'](_0x7012('0x17'),_0x3bcf11['message'],_0xc5f557);_0x165268(_0x6dad57[_0x7012('0x14')](0x1f4,_0x3bcf11[_0x7012('0x16')]));});});};exports['UpdateSquareReport']=function(_0x112a23){var _0x8633c5=this;return new Promise(function(_0x197386,_0x35f83a){return db['SquareReport'][_0x7012('0x1c')](_0x112a23[_0x7012('0x1d')],{'raw':_0x112a23['options']?_0x112a23[_0x7012('0x1a')][_0x7012('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x112a23[_0x7012('0x1a')]?_0x112a23[_0x7012('0x1a')][_0x7012('0x1e')]||null:null,'attributes':_0x112a23[_0x7012('0x1a')]?_0x112a23[_0x7012('0x1a')]['attributes']||null:null,'limit':_0x112a23[_0x7012('0x1a')]?_0x112a23[_0x7012('0x1a')][_0x7012('0x1f')]||null:null})[_0x7012('0xe')](function(_0x53b9f5){logger[_0x7012('0xf')](_0x7012('0x20'),_0x112a23);logger[_0x7012('0x21')]('UpdateSquareReport',_0x112a23,JSON[_0x7012('0x13')](_0x53b9f5));_0x197386(_0x53b9f5);})[_0x7012('0x22')](function(_0x23f73a){logger[_0x7012('0x14')](_0x7012('0x20'),_0x23f73a[_0x7012('0x16')],_0x112a23);_0x35f83a(_0x8633c5['error'](0x1f4,_0x23f73a['message']));});});}; \ No newline at end of file +var _0xfad6=['stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','CreateSquareReport','create','then','UpdateSquareReport','SquareReport','update','body','options','raw','where','attributes','limit'];(function(_0x425ec8,_0xc9979c){var _0x1c3930=function(_0x2e715d){while(--_0x2e715d){_0x425ec8['push'](_0x425ec8['shift']());}};_0x1c3930(++_0xc9979c);}(_0xfad6,0x199));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6fad('0x0'));var util=require(_0x6fad('0x1'));var moment=require('moment');var BPromise=require(_0x6fad('0x2'));var rs=require(_0x6fad('0x3'));var fs=require('fs');var Redis=require(_0x6fad('0x4'));var db=require(_0x6fad('0x5'))['db'];var utils=require(_0x6fad('0x6'));var logger=require(_0x6fad('0x7'))('rpc');var config=require(_0x6fad('0x8'));var jayson=require(_0x6fad('0x9'));var client=jayson[_0x6fad('0xa')][_0x6fad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cc6ff,_0x14b428,_0x387e8e){return new BPromise(function(_0x210cd7,_0x50c61c){return client[_0x6fad('0xc')](_0x5cc6ff,_0x387e8e)['then'](function(_0x5eb990){logger[_0x6fad('0xd')](_0x6fad('0xe'),_0x14b428,'request\x20sent');logger[_0x6fad('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x14b428,_0x6fad('0x10'),JSON['stringify'](_0x5eb990));if(_0x5eb990[_0x6fad('0x11')]){if(_0x5eb990[_0x6fad('0x11')][_0x6fad('0x12')]===0x1f4){logger[_0x6fad('0x11')](_0x6fad('0xe'),_0x14b428,_0x5eb990[_0x6fad('0x11')][_0x6fad('0x13')]);return _0x50c61c(_0x5eb990[_0x6fad('0x11')][_0x6fad('0x13')]);}logger[_0x6fad('0x11')](_0x6fad('0xe'),_0x14b428,_0x5eb990[_0x6fad('0x11')][_0x6fad('0x13')]);return _0x210cd7(_0x5eb990[_0x6fad('0x11')][_0x6fad('0x13')]);}else{logger['info'](_0x6fad('0xe'),_0x14b428,'request\x20sent');_0x210cd7(_0x5eb990['result'][_0x6fad('0x13')]);}})[_0x6fad('0x14')](function(_0x5967f1){logger['error'](_0x6fad('0xe'),_0x14b428,_0x5967f1);_0x50c61c(_0x5967f1);});});}exports[_0x6fad('0x15')]=function(_0x400458){var _0x1e4532=this;return new Promise(function(_0x4d1dc5,_0x31d442){return db['SquareReport'][_0x6fad('0x16')](_0x400458['body'],{'raw':_0x400458['options']?_0x400458['options']['raw']===undefined?!![]:![]:!![]})[_0x6fad('0x17')](function(_0x44f409){logger['info'](_0x6fad('0x15'),_0x400458);logger[_0x6fad('0xf')](_0x6fad('0x15'),_0x400458,JSON['stringify'](_0x44f409));_0x4d1dc5(_0x44f409);})[_0x6fad('0x14')](function(_0x41490b){logger['error'](_0x6fad('0x15'),_0x41490b['message'],_0x400458);_0x31d442(_0x1e4532[_0x6fad('0x11')](0x1f4,_0x41490b[_0x6fad('0x13')]));});});};exports[_0x6fad('0x18')]=function(_0x350655){var _0x4f68f1=this;return new Promise(function(_0x1a0291,_0x2c52c5){return db[_0x6fad('0x19')][_0x6fad('0x1a')](_0x350655[_0x6fad('0x1b')],{'raw':_0x350655['options']?_0x350655[_0x6fad('0x1c')][_0x6fad('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x350655[_0x6fad('0x1c')]?_0x350655[_0x6fad('0x1c')][_0x6fad('0x1e')]||null:null,'attributes':_0x350655[_0x6fad('0x1c')]?_0x350655['options'][_0x6fad('0x1f')]||null:null,'limit':_0x350655[_0x6fad('0x1c')]?_0x350655[_0x6fad('0x1c')][_0x6fad('0x20')]||null:null})[_0x6fad('0x17')](function(_0x4e6267){logger[_0x6fad('0xd')](_0x6fad('0x18'),_0x350655);logger['debug']('UpdateSquareReport',_0x350655,JSON[_0x6fad('0x21')](_0x4e6267));_0x1a0291(_0x4e6267);})[_0x6fad('0x14')](function(_0xe1fb){logger[_0x6fad('0x11')](_0x6fad('0x18'),_0xe1fb[_0x6fad('0x13')],_0x350655);_0x2c52c5(_0x4f68f1['error'](0x1f4,_0xe1fb[_0x6fad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 1683147..9b5330c 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 _0x0a2e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0a2e,0xb1));var _0xe0a2=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x0a2e[_0x27bd2c];return _0x3784ea;};'use strict';var multer=require(_0xe0a2('0x0'));var util=require('util');var path=require(_0xe0a2('0x1'));var timeout=require(_0xe0a2('0x2'));var express=require('express');var router=express[_0xe0a2('0x3')]();var fs_extra=require(_0xe0a2('0x4'));var auth=require(_0xe0a2('0x5'));var interaction=require(_0xe0a2('0x6'));var config=require(_0xe0a2('0x7'));var controller=require(_0xe0a2('0x8'));router[_0xe0a2('0x9')]('/',auth[_0xe0a2('0xa')](),controller[_0xe0a2('0xb')]);router[_0xe0a2('0x9')]('/describe',auth[_0xe0a2('0xa')](),controller[_0xe0a2('0xc')]);router['get'](_0xe0a2('0xd'),auth[_0xe0a2('0xa')](),controller[_0xe0a2('0xe')]);router[_0xe0a2('0xf')]('/',auth[_0xe0a2('0xa')](),controller[_0xe0a2('0x10')]);router['put'](_0xe0a2('0xd'),auth['isAuthenticated'](),controller[_0xe0a2('0x11')]);router[_0xe0a2('0x12')](_0xe0a2('0xd'),auth[_0xe0a2('0xa')](),controller[_0xe0a2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0746=['show','post','create','delete','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x351a4b,_0xf3af6){var _0x38685b=function(_0x521203){while(--_0x521203){_0x351a4b['push'](_0x351a4b['shift']());}};_0x38685b(++_0xf3af6);}(_0x0746,0xcc));var _0x6074=function(_0x33711a,_0x3420c0){_0x33711a=_0x33711a-0x0;var _0xaf87a1=_0x0746[_0x33711a];return _0xaf87a1;};'use strict';var multer=require('multer');var util=require(_0x6074('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6074('0x1')]();var fs_extra=require(_0x6074('0x2'));var auth=require(_0x6074('0x3'));var interaction=require(_0x6074('0x4'));var config=require(_0x6074('0x5'));var controller=require(_0x6074('0x6'));router[_0x6074('0x7')]('/',auth[_0x6074('0x8')](),controller['index']);router[_0x6074('0x7')](_0x6074('0x9'),auth[_0x6074('0x8')](),controller[_0x6074('0xa')]);router[_0x6074('0x7')](_0x6074('0xb'),auth[_0x6074('0x8')](),controller[_0x6074('0xc')]);router[_0x6074('0xd')]('/',auth[_0x6074('0x8')](),controller[_0x6074('0xe')]);router['put'](_0x6074('0xb'),auth[_0x6074('0x8')](),controller['update']);router[_0x6074('0xf')](_0x6074('0xb'),auth[_0x6074('0x8')](),controller[_0x6074('0x10')]);module[_0x6074('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 21a3c03..2c4b6cb 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 _0xab0f=['STRING','sequelize','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xab0f,0x14e));var _0xfab0=function(_0xdf47f8,_0x48abc5){_0xdf47f8=_0xdf47f8-0x0;var _0x506e3c=_0xab0f[_0xdf47f8];return _0x506e3c;};'use strict';var Sequelize=require(_0xfab0('0x0'));module[_0xfab0('0x1')]={'uniqueid':{'type':Sequelize[_0xfab0('0x2')]},'node':{'type':Sequelize[_0xfab0('0x2')]},'application':{'type':Sequelize[_0xfab0('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xfab0('0x2')]}}; \ No newline at end of file +var _0xa376=['STRING','TEXT'];(function(_0x44ef45,_0x194169){var _0x585ad1=function(_0x3d1826){while(--_0x3d1826){_0x44ef45['push'](_0x44ef45['shift']());}};_0x585ad1(++_0x194169);}(_0xa376,0x88));var _0x6a37=function(_0x1c19ac,_0x287846){_0x1c19ac=_0x1c19ac-0x0;var _0x2cf107=_0xa376[_0x1c19ac];return _0x2cf107;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6a37('0x0')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6a37('0x0')]},'data':{'type':Sequelize[_0x6a37('0x1')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a8b9f2a..ae0ab4b 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 _0x4ed2=['fields','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','includeAll','include','findAll','show','rawAttributes','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','then','error','name','send','index','map','SquareDetailsReport','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4ed2,0x13d));var _0x24ed=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4ed2[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x24ed('0x0'));var rimraf=require(_0x24ed('0x1'));var zipdir=require(_0x24ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24ed('0x3'));var moment=require(_0x24ed('0x4'));var BPromise=require(_0x24ed('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x24ed('0x6'));var sox=require(_0x24ed('0x7'));var csv=require('to-csv');var ejs=require(_0x24ed('0x8'));var fs=require('fs');var fs_extra=require(_0x24ed('0x9'));var _=require(_0x24ed('0xa'));var squel=require(_0x24ed('0xb'));var crypto=require('crypto');var jsforce=require(_0x24ed('0xc'));var deskjs=require(_0x24ed('0xd'));var toCsv=require(_0x24ed('0xe'));var querystring=require(_0x24ed('0xf'));var Papa=require(_0x24ed('0x10'));var Redis=require(_0x24ed('0x11'));var authService=require(_0x24ed('0x12'));var qs=require(_0x24ed('0x13'));var as=require(_0x24ed('0x14'));var hardwareService=require(_0x24ed('0x15'));var logger=require(_0x24ed('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x24ed('0x17'));var licenseUtil=require(_0x24ed('0x18'));var db=require(_0x24ed('0x19'))['db'];function respondWithStatusCode(_0x5e1cf7,_0x2e8811){_0x2e8811=_0x2e8811||0xcc;return function(_0xea470){if(_0xea470){return _0x5e1cf7[_0x24ed('0x1a')](_0x2e8811);}return _0x5e1cf7[_0x24ed('0x1b')](_0x2e8811)[_0x24ed('0x1c')]();};}function respondWithResult(_0x22ee47,_0xbc57c3){_0xbc57c3=_0xbc57c3||0xc8;return function(_0x5a7b69){if(_0x5a7b69){return _0x22ee47[_0x24ed('0x1b')](_0xbc57c3)[_0x24ed('0x1d')](_0x5a7b69);}};}function respondWithFilteredResult(_0x5d260f,_0x3c5129){return function(_0x34e1c2){if(_0x34e1c2){var _0x4f8af4=typeof _0x3c5129[_0x24ed('0x1e')]===_0x24ed('0x1f')&&typeof _0x3c5129[_0x24ed('0x20')]==='undefined';var _0x3f696f=_0x34e1c2[_0x24ed('0x21')];var _0xbdb421=_0x4f8af4?0x0:_0x3c5129[_0x24ed('0x1e')];var _0x142be8=_0x4f8af4?_0x34e1c2['count']:_0x3c5129[_0x24ed('0x1e')]+_0x3c5129['limit'];var _0x5a92c1;if(_0x142be8>=_0x3f696f){_0x142be8=_0x3f696f;_0x5a92c1=0xc8;}else{_0x5a92c1=0xce;}_0x5d260f[_0x24ed('0x1b')](_0x5a92c1);return _0x5d260f['set']('Content-Range',_0xbdb421+'-'+_0x142be8+'/'+_0x3f696f)['json'](_0x34e1c2);}return null;};}function patchUpdates(_0x466007){return function(_0xeabbbb){try{jsonpatch['apply'](_0xeabbbb,_0x466007,!![]);}catch(_0x37738f){return BPromise[_0x24ed('0x22')](_0x37738f);}return _0xeabbbb[_0x24ed('0x23')]();};}function saveUpdates(_0x589f49,_0x170661){return function(_0x2f1908){if(_0x2f1908){return _0x2f1908[_0x24ed('0x24')](_0x589f49)['then'](function(_0x67e0b7){return _0x67e0b7;});}return null;};}function removeEntity(_0x4693e6,_0x155abe){return function(_0x473b16){if(_0x473b16){return _0x473b16[_0x24ed('0x25')]()[_0x24ed('0x26')](function(){_0x4693e6[_0x24ed('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cb83b,_0x402fcb){return function(_0x1a332b){if(!_0x1a332b){_0x2cb83b[_0x24ed('0x1a')](0x194);}return _0x1a332b;};}function handleError(_0x4c6112,_0x2a5518){_0x2a5518=_0x2a5518||0x1f4;return function(_0x20dfb2){logger[_0x24ed('0x27')](_0x20dfb2['stack']);if(_0x20dfb2['name']){delete _0x20dfb2[_0x24ed('0x28')];}_0x4c6112['status'](_0x2a5518)[_0x24ed('0x29')](_0x20dfb2);};}exports[_0x24ed('0x2a')]=function(_0x4b3ffd,_0x28a7f8){var _0xd109c5={},_0xf79095={},_0x49bb76={'count':0x0,'rows':[]};var _0x431b2c=_[_0x24ed('0x2b')](db[_0x24ed('0x2c')]['rawAttributes'],function(_0x4b675c){return{'name':_0x4b675c[_0x24ed('0x2d')],'type':_0x4b675c[_0x24ed('0x2e')][_0x24ed('0x2f')]};});_0xf79095['model']=_[_0x24ed('0x2b')](_0x431b2c,_0x24ed('0x28'));_0xf79095[_0x24ed('0x30')]=_[_0x24ed('0x31')](_0x4b3ffd[_0x24ed('0x30')]);_0xf79095[_0x24ed('0x32')]=_[_0x24ed('0x33')](_0xf79095[_0x24ed('0x34')],_0xf79095['query']);_0xd109c5['attributes']=_[_0x24ed('0x33')](_0xf79095['model'],qs[_0x24ed('0x35')](_0x4b3ffd[_0x24ed('0x30')][_0x24ed('0x35')]));_0xd109c5[_0x24ed('0x36')]=_0xd109c5[_0x24ed('0x36')]['length']?_0xd109c5[_0x24ed('0x36')]:_0xf79095[_0x24ed('0x34')];if(!_0x4b3ffd['query'][_0x24ed('0x37')](_0x24ed('0x38'))){_0xd109c5[_0x24ed('0x20')]=qs[_0x24ed('0x20')](_0x4b3ffd[_0x24ed('0x30')][_0x24ed('0x20')]);_0xd109c5['offset']=qs[_0x24ed('0x1e')](_0x4b3ffd['query']['offset']);}_0xd109c5['order']=qs[_0x24ed('0x39')](_0x4b3ffd['query']['sort']);_0xd109c5['where']=qs['filters'](_[_0x24ed('0x3a')](_0x4b3ffd[_0x24ed('0x30')],_0xf79095[_0x24ed('0x32')]),_0x431b2c);if(_0x4b3ffd[_0x24ed('0x30')]['filter']){_0xd109c5[_0x24ed('0x3b')]=_[_0x24ed('0x3c')](_0xd109c5[_0x24ed('0x3b')],{'$or':_['map'](_0x431b2c,function(_0x1be267){if(_0x1be267['type']!=='VIRTUAL'){var _0x59b7e0={};_0x59b7e0[_0x1be267['name']]={'$like':'%'+_0x4b3ffd['query'][_0x24ed('0x3d')]+'%'};return _0x59b7e0;}})});}_0xd109c5=_[_0x24ed('0x3c')]({},_0xd109c5,_0x4b3ffd[_0x24ed('0x3e')]);var _0x3df4cc={'where':_0xd109c5[_0x24ed('0x3b')]};return db[_0x24ed('0x2c')]['count'](_0x3df4cc)['then'](function(_0x4c65c9){_0x49bb76['count']=_0x4c65c9;if(_0x4b3ffd[_0x24ed('0x30')][_0x24ed('0x3f')]){_0xd109c5[_0x24ed('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x24ed('0x41')](_0xd109c5);})[_0x24ed('0x26')](function(_0x54fa2c){_0x49bb76['rows']=_0x54fa2c;return _0x49bb76;})['then'](respondWithFilteredResult(_0x28a7f8,_0xd109c5))['catch'](handleError(_0x28a7f8,null));};exports[_0x24ed('0x42')]=function(_0x47b806,_0x54fe48){var _0x19da1f={'raw':!![],'where':{'id':_0x47b806['params']['id']}},_0x5f22a6={};_0x5f22a6[_0x24ed('0x34')]=_[_0x24ed('0x31')](db[_0x24ed('0x2c')][_0x24ed('0x43')]);_0x5f22a6[_0x24ed('0x30')]=_[_0x24ed('0x31')](_0x47b806[_0x24ed('0x30')]);_0x5f22a6[_0x24ed('0x32')]=_[_0x24ed('0x33')](_0x5f22a6['model'],_0x5f22a6[_0x24ed('0x30')]);_0x19da1f['attributes']=_[_0x24ed('0x33')](_0x5f22a6[_0x24ed('0x34')],qs[_0x24ed('0x35')](_0x47b806[_0x24ed('0x30')][_0x24ed('0x35')]));_0x19da1f['attributes']=_0x19da1f['attributes']['length']?_0x19da1f[_0x24ed('0x36')]:_0x5f22a6[_0x24ed('0x34')];if(_0x47b806[_0x24ed('0x30')][_0x24ed('0x3f')]){_0x19da1f[_0x24ed('0x40')]=[{'all':!![]}];}_0x19da1f=_[_0x24ed('0x3c')]({},_0x19da1f,_0x47b806[_0x24ed('0x3e')]);return db[_0x24ed('0x2c')]['find'](_0x19da1f)[_0x24ed('0x26')](handleEntityNotFound(_0x54fe48,null))[_0x24ed('0x26')](respondWithResult(_0x54fe48,null))[_0x24ed('0x44')](handleError(_0x54fe48,null));};exports[_0x24ed('0x45')]=function(_0x305a18,_0x5cee36){return db[_0x24ed('0x2c')][_0x24ed('0x45')](_0x305a18[_0x24ed('0x46')],{})[_0x24ed('0x26')](respondWithResult(_0x5cee36,0xc9))[_0x24ed('0x44')](handleError(_0x5cee36,null));};exports[_0x24ed('0x24')]=function(_0x19f42a,_0x23f4a8){if(_0x19f42a[_0x24ed('0x46')]['id']){delete _0x19f42a['body']['id'];}return db[_0x24ed('0x2c')][_0x24ed('0x47')]({'where':{'id':_0x19f42a[_0x24ed('0x48')]['id']}})['then'](handleEntityNotFound(_0x23f4a8,null))[_0x24ed('0x26')](saveUpdates(_0x19f42a[_0x24ed('0x46')],null))[_0x24ed('0x26')](respondWithResult(_0x23f4a8,null))[_0x24ed('0x44')](handleError(_0x23f4a8,null));};exports[_0x24ed('0x25')]=function(_0xf97c27,_0x3949ca){return db[_0x24ed('0x2c')]['find']({'where':{'id':_0xf97c27[_0x24ed('0x48')]['id']}})[_0x24ed('0x26')](handleEntityNotFound(_0x3949ca,null))['then'](removeEntity(_0x3949ca,null))['catch'](handleError(_0x3949ca,null));};exports['describe']=function(_0x3bf963,_0x195558){return db[_0x24ed('0x2c')][_0x24ed('0x49')]()[_0x24ed('0x26')](respondWithResult(_0x195558,null))[_0x24ed('0x44')](handleError(_0x195558,null));}; \ No newline at end of file +var _0x5db3=['destroy','error','stack','name','index','SquareDetailsReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x5db3,0x1a6));var _0x35db=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0x5db3[_0x39d39d];return _0x577ac3;};'use strict';var emlformat=require(_0x35db('0x0'));var rimraf=require(_0x35db('0x1'));var zipdir=require(_0x35db('0x2'));var jsonpatch=require(_0x35db('0x3'));var rp=require(_0x35db('0x4'));var moment=require('moment');var BPromise=require(_0x35db('0x5'));var Mustache=require(_0x35db('0x6'));var util=require(_0x35db('0x7'));var path=require(_0x35db('0x8'));var sox=require(_0x35db('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35db('0xa'));var _=require(_0x35db('0xb'));var squel=require(_0x35db('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x35db('0xd'));var toCsv=require(_0x35db('0xe'));var querystring=require(_0x35db('0xf'));var Papa=require('papaparse');var Redis=require(_0x35db('0x10'));var authService=require(_0x35db('0x11'));var qs=require(_0x35db('0x12'));var as=require(_0x35db('0x13'));var hardwareService=require(_0x35db('0x14'));var logger=require(_0x35db('0x15'))(_0x35db('0x16'));var utils=require(_0x35db('0x17'));var config=require(_0x35db('0x18'));var licenseUtil=require(_0x35db('0x19'));var db=require(_0x35db('0x1a'))['db'];function respondWithStatusCode(_0x1ab600,_0x577520){_0x577520=_0x577520||0xcc;return function(_0x5c64f7){if(_0x5c64f7){return _0x1ab600[_0x35db('0x1b')](_0x577520);}return _0x1ab600[_0x35db('0x1c')](_0x577520)[_0x35db('0x1d')]();};}function respondWithResult(_0x399636,_0x6fb8cc){_0x6fb8cc=_0x6fb8cc||0xc8;return function(_0x54aa74){if(_0x54aa74){return _0x399636[_0x35db('0x1c')](_0x6fb8cc)[_0x35db('0x1e')](_0x54aa74);}};}function respondWithFilteredResult(_0x41a29c,_0x48e993){return function(_0x5f18ff){if(_0x5f18ff){var _0x6862e1=typeof _0x48e993[_0x35db('0x1f')]===_0x35db('0x20')&&typeof _0x48e993[_0x35db('0x21')]===_0x35db('0x20');var _0x2bfeaf=_0x5f18ff[_0x35db('0x22')];var _0x5c94f8=_0x6862e1?0x0:_0x48e993[_0x35db('0x1f')];var _0x3c65de=_0x6862e1?_0x5f18ff[_0x35db('0x22')]:_0x48e993[_0x35db('0x1f')]+_0x48e993[_0x35db('0x21')];var _0x39b943;if(_0x3c65de>=_0x2bfeaf){_0x3c65de=_0x2bfeaf;_0x39b943=0xc8;}else{_0x39b943=0xce;}_0x41a29c['status'](_0x39b943);return _0x41a29c['set'](_0x35db('0x23'),_0x5c94f8+'-'+_0x3c65de+'/'+_0x2bfeaf)[_0x35db('0x1e')](_0x5f18ff);}return null;};}function patchUpdates(_0x1f878a){return function(_0x55f1af){try{jsonpatch['apply'](_0x55f1af,_0x1f878a,!![]);}catch(_0x313cab){return BPromise[_0x35db('0x24')](_0x313cab);}return _0x55f1af[_0x35db('0x25')]();};}function saveUpdates(_0x288045,_0x59076e){return function(_0x56ea28){if(_0x56ea28){return _0x56ea28[_0x35db('0x26')](_0x288045)[_0x35db('0x27')](function(_0xc4484a){return _0xc4484a;});}return null;};}function removeEntity(_0x18d58d,_0xbec53d){return function(_0x3f026c){if(_0x3f026c){return _0x3f026c[_0x35db('0x28')]()[_0x35db('0x27')](function(){_0x18d58d['status'](0xcc)[_0x35db('0x1d')]();});}};}function handleEntityNotFound(_0xeb8d7c,_0x1d8998){return function(_0x5b5db3){if(!_0x5b5db3){_0xeb8d7c[_0x35db('0x1b')](0x194);}return _0x5b5db3;};}function handleError(_0x41d807,_0x89db98){_0x89db98=_0x89db98||0x1f4;return function(_0x543fb2){logger[_0x35db('0x29')](_0x543fb2[_0x35db('0x2a')]);if(_0x543fb2[_0x35db('0x2b')]){delete _0x543fb2[_0x35db('0x2b')];}_0x41d807[_0x35db('0x1c')](_0x89db98)['send'](_0x543fb2);};}exports[_0x35db('0x2c')]=function(_0x5bfed5,_0x5af8fe){var _0x14d701={},_0x256812={},_0x3da7b7={'count':0x0,'rows':[]};var _0x2f674a=_['map'](db[_0x35db('0x2d')][_0x35db('0x2e')],function(_0x4f5e33){return{'name':_0x4f5e33['fieldName'],'type':_0x4f5e33[_0x35db('0x2f')][_0x35db('0x30')]};});_0x256812[_0x35db('0x31')]=_[_0x35db('0x32')](_0x2f674a,_0x35db('0x2b'));_0x256812[_0x35db('0x33')]=_[_0x35db('0x34')](_0x5bfed5['query']);_0x256812['filters']=_[_0x35db('0x35')](_0x256812[_0x35db('0x31')],_0x256812[_0x35db('0x33')]);_0x14d701[_0x35db('0x36')]=_[_0x35db('0x35')](_0x256812[_0x35db('0x31')],qs['fields'](_0x5bfed5[_0x35db('0x33')][_0x35db('0x37')]));_0x14d701[_0x35db('0x36')]=_0x14d701[_0x35db('0x36')]['length']?_0x14d701[_0x35db('0x36')]:_0x256812[_0x35db('0x31')];if(!_0x5bfed5['query'][_0x35db('0x38')](_0x35db('0x39'))){_0x14d701[_0x35db('0x21')]=qs[_0x35db('0x21')](_0x5bfed5['query'][_0x35db('0x21')]);_0x14d701[_0x35db('0x1f')]=qs[_0x35db('0x1f')](_0x5bfed5[_0x35db('0x33')][_0x35db('0x1f')]);}_0x14d701[_0x35db('0x3a')]=qs[_0x35db('0x3b')](_0x5bfed5[_0x35db('0x33')][_0x35db('0x3b')]);_0x14d701[_0x35db('0x3c')]=qs['filters'](_['pick'](_0x5bfed5['query'],_0x256812[_0x35db('0x3d')]),_0x2f674a);if(_0x5bfed5['query'][_0x35db('0x3e')]){_0x14d701[_0x35db('0x3c')]=_[_0x35db('0x3f')](_0x14d701[_0x35db('0x3c')],{'$or':_['map'](_0x2f674a,function(_0x2ee1f4){if(_0x2ee1f4[_0x35db('0x2f')]!==_0x35db('0x40')){var _0x485b77={};_0x485b77[_0x2ee1f4[_0x35db('0x2b')]]={'$like':'%'+_0x5bfed5[_0x35db('0x33')][_0x35db('0x3e')]+'%'};return _0x485b77;}})});}_0x14d701=_[_0x35db('0x3f')]({},_0x14d701,_0x5bfed5['options']);var _0x53841c={'where':_0x14d701['where']};return db[_0x35db('0x2d')]['count'](_0x53841c)[_0x35db('0x27')](function(_0x57e9ef){_0x3da7b7['count']=_0x57e9ef;if(_0x5bfed5[_0x35db('0x33')][_0x35db('0x41')]){_0x14d701[_0x35db('0x42')]=[{'all':!![]}];}return db[_0x35db('0x2d')][_0x35db('0x43')](_0x14d701);})[_0x35db('0x27')](function(_0x5e48c6){_0x3da7b7[_0x35db('0x44')]=_0x5e48c6;return _0x3da7b7;})[_0x35db('0x27')](respondWithFilteredResult(_0x5af8fe,_0x14d701))[_0x35db('0x45')](handleError(_0x5af8fe,null));};exports[_0x35db('0x46')]=function(_0x378e30,_0x58af78){var _0x17dad0={'raw':!![],'where':{'id':_0x378e30[_0x35db('0x47')]['id']}},_0x27b19c={};_0x27b19c[_0x35db('0x31')]=_[_0x35db('0x34')](db[_0x35db('0x2d')][_0x35db('0x2e')]);_0x27b19c['query']=_[_0x35db('0x34')](_0x378e30[_0x35db('0x33')]);_0x27b19c[_0x35db('0x3d')]=_[_0x35db('0x35')](_0x27b19c[_0x35db('0x31')],_0x27b19c[_0x35db('0x33')]);_0x17dad0[_0x35db('0x36')]=_[_0x35db('0x35')](_0x27b19c[_0x35db('0x31')],qs[_0x35db('0x37')](_0x378e30[_0x35db('0x33')]['fields']));_0x17dad0[_0x35db('0x36')]=_0x17dad0['attributes']['length']?_0x17dad0['attributes']:_0x27b19c['model'];if(_0x378e30[_0x35db('0x33')]['includeAll']){_0x17dad0[_0x35db('0x42')]=[{'all':!![]}];}_0x17dad0=_[_0x35db('0x3f')]({},_0x17dad0,_0x378e30[_0x35db('0x48')]);return db[_0x35db('0x2d')][_0x35db('0x49')](_0x17dad0)[_0x35db('0x27')](handleEntityNotFound(_0x58af78,null))['then'](respondWithResult(_0x58af78,null))[_0x35db('0x45')](handleError(_0x58af78,null));};exports['create']=function(_0x5f217d,_0xe20ffe){return db[_0x35db('0x2d')][_0x35db('0x4a')](_0x5f217d[_0x35db('0x4b')],{})[_0x35db('0x27')](respondWithResult(_0xe20ffe,0xc9))[_0x35db('0x45')](handleError(_0xe20ffe,null));};exports[_0x35db('0x26')]=function(_0x5393f4,_0x4eb617){if(_0x5393f4['body']['id']){delete _0x5393f4[_0x35db('0x4b')]['id'];}return db[_0x35db('0x2d')][_0x35db('0x49')]({'where':{'id':_0x5393f4[_0x35db('0x47')]['id']}})[_0x35db('0x27')](handleEntityNotFound(_0x4eb617,null))[_0x35db('0x27')](saveUpdates(_0x5393f4[_0x35db('0x4b')],null))[_0x35db('0x27')](respondWithResult(_0x4eb617,null))['catch'](handleError(_0x4eb617,null));};exports['destroy']=function(_0x2d8db3,_0x59a722){return db[_0x35db('0x2d')][_0x35db('0x49')]({'where':{'id':_0x2d8db3[_0x35db('0x47')]['id']}})[_0x35db('0x27')](handleEntityNotFound(_0x59a722,null))['then'](removeEntity(_0x59a722,null))['catch'](handleError(_0x59a722,null));};exports[_0x35db('0x4c')]=function(_0x2b605d,_0x1bdce8){return db[_0x35db('0x2d')][_0x35db('0x4c')]()['then'](respondWithResult(_0x1bdce8,null))[_0x35db('0x45')](handleError(_0x1bdce8,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index a4b85e0..55fdbce 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 _0x6a18=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','path','../../config/environment','./squareReportDetail.attributes'];(function(_0xf8c326,_0x38c9d3){var _0x307a22=function(_0x5ab46b){while(--_0x5ab46b){_0xf8c326['push'](_0xf8c326['shift']());}};_0x307a22(++_0x38c9d3);}(_0x6a18,0x184));var _0x86a1=function(_0x3ee3d7,_0x1df7a8){_0x3ee3d7=_0x3ee3d7-0x0;var _0x46332a=_0x6a18[_0x3ee3d7];return _0x46332a;};'use strict';var _=require(_0x86a1('0x0'));var util=require(_0x86a1('0x1'));var logger=require(_0x86a1('0x2'))(_0x86a1('0x3'));var moment=require(_0x86a1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x86a1('0x5'));var rimraf=require('rimraf');var config=require(_0x86a1('0x6'));var attributes=require(_0x86a1('0x7'));module[_0x86a1('0x8')]=function(_0x3110e0,_0x3cd2d1){return _0x3110e0[_0x86a1('0x9')](_0x86a1('0xa'),attributes,{'tableName':_0x86a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf259=['exports','SquareDetailsReport','lodash','api','request-promise','path','rimraf','../../config/environment'];(function(_0x226e5c,_0x19e27e){var _0x1c3fd6=function(_0x1f190e){while(--_0x1f190e){_0x226e5c['push'](_0x226e5c['shift']());}};_0x1c3fd6(++_0x19e27e);}(_0xf259,0xf2));var _0x9f25=function(_0x15003c,_0x5d4410){_0x15003c=_0x15003c-0x0;var _0x568810=_0xf259[_0x15003c];return _0x568810;};'use strict';var _=require(_0x9f25('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9f25('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f25('0x2'));var fs=require('fs');var path=require(_0x9f25('0x3'));var rimraf=require(_0x9f25('0x4'));var config=require(_0x9f25('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0x9f25('0x6')]=function(_0x270ccf,_0x1ae65c){return _0x270ccf['define'](_0x9f25('0x7'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index e3d1539..cece880 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 _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x40c87e,_0x40e38b){var _0xebcac5=function(_0x1c3523){while(--_0x1c3523){_0x40c87e['push'](_0x40c87e['shift']());}};_0xebcac5(++_0x40e38b);}(_0x4fc2,0x111));var _0x24fc=function(_0xdb0ce1,_0x1db757){_0xdb0ce1=_0xdb0ce1-0x0;var _0x24fa8b=_0x4fc2[_0xdb0ce1];return _0x24fa8b;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['CreateSquareDetailsReport']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['SquareDetailsReport'][_0x24fc('0x17')](_0x23873c[_0x24fc('0x18')],{'raw':_0x23873c[_0x24fc('0x19')]?_0x23873c['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![]})[_0x24fc('0xc')](function(_0xbf1d6b){logger[_0x24fc('0xd')]('CreateSquareDetailsReport',_0x23873c);logger[_0x24fc('0x10')]('CreateSquareDetailsReport',_0x23873c,JSON[_0x24fc('0x12')](_0xbf1d6b));_0x6cfa0a(_0xbf1d6b);})['catch'](function(_0x3ed464){logger[_0x24fc('0x13')](_0x24fc('0x1b'),_0x3ed464['message'],_0x23873c);_0x8ac114(_0x1cb3d0[_0x24fc('0x13')](0x1f4,_0x3ed464['message']));});});}; \ No newline at end of file +var _0xa7fa=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x592307,_0x2b8719){var _0x244eb8=function(_0x3e7c78){while(--_0x3e7c78){_0x592307['push'](_0x592307['shift']());}};_0x244eb8(++_0x2b8719);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa7f('0x1'));var rs=require(_0xaa7f('0x2'));var fs=require('fs');var Redis=require(_0xaa7f('0x3'));var db=require(_0xaa7f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa7f('0x5'))(_0xaa7f('0x6'));var config=require(_0xaa7f('0x7'));var jayson=require(_0xaa7f('0x8'));var client=jayson['client'][_0xaa7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48105b,_0x50bab6,_0x3898a3){return new BPromise(function(_0x506a91,_0x3ac236){return client[_0xaa7f('0xa')](_0x48105b,_0x3898a3)[_0xaa7f('0xb')](function(_0x2dbcb6){logger['info'](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));logger['debug'](_0xaa7f('0xe'),_0x50bab6,_0xaa7f('0xd'),JSON[_0xaa7f('0xf')](_0x2dbcb6));if(_0x2dbcb6[_0xaa7f('0x10')]){if(_0x2dbcb6['error']['code']===0x1f4){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);return _0x3ac236(_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);}logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')]['message']);return _0x506a91(_0x2dbcb6[_0xaa7f('0x10')]['message']);}else{logger[_0xaa7f('0x12')](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));_0x506a91(_0x2dbcb6['result'][_0xaa7f('0x11')]);}})[_0xaa7f('0x13')](function(_0x1bd3f9){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x1bd3f9);_0x3ac236(_0x1bd3f9);});});}exports[_0xaa7f('0x14')]=function(_0x2c17c4){var _0x4fbd09=this;return new Promise(function(_0x90863a,_0x1e18a6){return db[_0xaa7f('0x15')][_0xaa7f('0x16')](_0x2c17c4['body'],{'raw':_0x2c17c4['options']?_0x2c17c4[_0xaa7f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaa7f('0xb')](function(_0x21e870){logger['info'](_0xaa7f('0x14'),_0x2c17c4);logger['debug'](_0xaa7f('0x14'),_0x2c17c4,JSON[_0xaa7f('0xf')](_0x21e870));_0x90863a(_0x21e870);})[_0xaa7f('0x13')](function(_0x516d7e){logger[_0xaa7f('0x10')](_0xaa7f('0x14'),_0x516d7e[_0xaa7f('0x11')],_0x2c17c4);_0x1e18a6(_0x4fbd09[_0xaa7f('0x10')](0x1f4,_0x516d7e['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1889536..443fdd3 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 _0x7d79=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express','Router'];(function(_0xb33085,_0x1b00b7){var _0x31919d=function(_0x252e08){while(--_0x252e08){_0xb33085['push'](_0xb33085['shift']());}};_0x31919d(++_0x1b00b7);}(_0x7d79,0x7e));var _0x97d7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7d79[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x97d7('0x0'));var router=express[_0x97d7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x97d7('0x2'));router[_0x97d7('0x3')]('/',auth[_0x97d7('0x4')](),controller[_0x97d7('0x5')]);router[_0x97d7('0x3')](_0x97d7('0x6'),auth[_0x97d7('0x4')](),controller[_0x97d7('0x7')]);module['exports']=router; \ No newline at end of file +var _0xc7c1=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess','exports','express'];(function(_0x9d9797,_0xe3ebe8){var _0x3c16ca=function(_0x3d8735){while(--_0x3d8735){_0x9d9797['push'](_0x9d9797['shift']());}};_0x3c16ca(++_0xe3ebe8);}(_0xc7c1,0x167));var _0x1c7c=function(_0x2b9b72,_0x5ae178){_0x2b9b72=_0x2b9b72-0x0;var _0x506798=_0xc7c1[_0x2b9b72];return _0x506798;};'use strict';var express=require(_0x1c7c('0x0'));var router=express[_0x1c7c('0x1')]();var auth=require(_0x1c7c('0x2'));var controller=require(_0x1c7c('0x3'));router[_0x1c7c('0x4')]('/',auth[_0x1c7c('0x5')](),controller[_0x1c7c('0x6')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x1c7c('0x7')]);module[_0x1c7c('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 685bbbb..55f758e 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 _0xec1b=['getAllData','then','json','components/import/cm','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','exec','../../config/logger','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xec1b,0x15f));var _0xbec1=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0xec1b[_0x582274];return _0x8f14d3;};'use strict';var info=require(_0xbec1('0x0'));var exec=require('child_process')[_0xbec1('0x1')];var logger=require(_0xbec1('0x2'))('api');var util=require(_0xbec1('0x3'));var BPromise=require('bluebird');var _=require(_0xbec1('0x4'));function handleError(_0x252fbb,_0x3a80c0,_0x7ff18d){_0x3a80c0=_0x3a80c0||0x1f4;return function(_0x549237){logger['error'](_0xbec1('0x5'),_0x7ff18d,_0x3a80c0,util[_0xbec1('0x6')](_0x549237,{'showHidden':![],'depth':null}));delete _0x549237[_0xbec1('0x7')];_0x252fbb[_0xbec1('0x8')](_0x3a80c0)['send'](_0x549237);};}exports['index']=function(_0x476719,_0x24c9be){return info[_0xbec1('0x9')]()[_0xbec1('0xa')](function(_0x59dbaf){return _0x24c9be[_0xbec1('0x8')](0xc8)[_0xbec1('0xb')](_0x59dbaf);})['catch'](function(_0x268393){return _0x24c9be[_0xbec1('0x8')](0x1f4)[_0xbec1('0xb')](_0x268393);});};exports['killProcess']=function(_0x6acde9,_0x3b457d){var _0x340314=[_0xbec1('0xc')];return new BPromise(function(_0x128107,_0x46c10b){return exec(util[_0xbec1('0xd')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x6acde9[_0xbec1('0xe')][_0xbec1('0xf')]),function(_0x20255c,_0x382478,_0xbbd8e7){if(_0x20255c){return _0x46c10b(_0x20255c);}return _0x128107(_0x382478);});})[_0xbec1('0xa')](function(_0x1c171b){var _0xbe3f1c=![];var _0x168cc7=_0x1c171b[_0xbec1('0x10')](/\n/);for(var _0x28c54d=0x0,_0x5703a3=_0x340314[_0xbec1('0x11')];_0x28c54d<_0x5703a3,_0xbe3f1c===![];_0x28c54d+=0x1){if(_0x1c171b[_0xbec1('0x12')](_0x340314[_0x28c54d])>=0x0){_0xbe3f1c=!![];}}if(!_0xbe3f1c){throw new Error(util[_0xbec1('0xd')](_0xbec1('0x13'),_0x6acde9[_0xbec1('0xe')][_0xbec1('0xf')]));}process['kill'](_0x6acde9[_0xbec1('0xe')]['pid'],_0xbec1('0x14'));return _0x3b457d[_0xbec1('0x8')](0xc8)[_0xbec1('0xb')]({'message':util[_0xbec1('0xd')](_0xbec1('0x15'),_0x6acde9[_0xbec1('0xe')][_0xbec1('0xf')])});})[_0xbec1('0x16')](handleError(_0x3b457d,null,_0xbec1('0x17')));}; \ No newline at end of file +var _0xe33a=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','then','json','catch','status','killProcess','components/import/cm','format','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','../../config/logger','api','util','bluebird','lodash'];(function(_0x518856,_0x1a8416){var _0x54c5ae=function(_0x3de0ed){while(--_0x3de0ed){_0x518856['push'](_0x518856['shift']());}};_0x54c5ae(++_0x1a8416);}(_0xe33a,0x1bc));var _0xae33=function(_0x4cb23a,_0x489c9a){_0x4cb23a=_0x4cb23a-0x0;var _0x4af9b2=_0xe33a[_0x4cb23a];return _0x4af9b2;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xae33('0x0')];var logger=require(_0xae33('0x1'))(_0xae33('0x2'));var util=require(_0xae33('0x3'));var BPromise=require(_0xae33('0x4'));var _=require(_0xae33('0x5'));function handleError(_0x40ec19,_0x489612,_0x1a5163){_0x489612=_0x489612||0x1f4;return function(_0x57eaa8){logger[_0xae33('0x6')](_0xae33('0x7'),_0x1a5163,_0x489612,util['inspect'](_0x57eaa8,{'showHidden':![],'depth':null}));delete _0x57eaa8[_0xae33('0x8')];_0x40ec19['status'](_0x489612)[_0xae33('0x9')](_0x57eaa8);};}exports[_0xae33('0xa')]=function(_0x5c7585,_0x5db2be){return info[_0xae33('0xb')]()[_0xae33('0xc')](function(_0x4befee){return _0x5db2be['status'](0xc8)[_0xae33('0xd')](_0x4befee);})[_0xae33('0xe')](function(_0x1c3d3c){return _0x5db2be[_0xae33('0xf')](0x1f4)['json'](_0x1c3d3c);});};exports[_0xae33('0x10')]=function(_0x37ade9,_0x5112d2){var _0x562a13=[_0xae33('0x11')];return new BPromise(function(_0x23c79a,_0x44d4da){return exec(util[_0xae33('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x37ade9['params'][_0xae33('0x13')]),function(_0x3a54e3,_0x24d425,_0x391677){if(_0x3a54e3){return _0x44d4da(_0x3a54e3);}return _0x23c79a(_0x24d425);});})[_0xae33('0xc')](function(_0x5805a0){var _0x1b2d9a=![];var _0x158794=_0x5805a0[_0xae33('0x14')](/\n/);for(var _0x555dcb=0x0,_0x24e072=_0x562a13['length'];_0x555dcb<_0x24e072,_0x1b2d9a===![];_0x555dcb+=0x1){if(_0x5805a0[_0xae33('0x15')](_0x562a13[_0x555dcb])>=0x0){_0x1b2d9a=!![];}}if(!_0x1b2d9a){throw new Error(util[_0xae33('0x12')](_0xae33('0x16'),_0x37ade9[_0xae33('0x17')][_0xae33('0x13')]));}process['kill'](_0x37ade9['params'][_0xae33('0x13')],'SIGINT');return _0x5112d2[_0xae33('0xf')](0xc8)[_0xae33('0xd')]({'message':util[_0xae33('0x12')](_0xae33('0x18'),_0x37ade9[_0xae33('0x17')][_0xae33('0x13')])});})[_0xae33('0xe')](handleError(_0x5112d2,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 2fb2196..b404314 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 _0xda28=['../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xda28,0xfd));var _0x8da2=function(_0x96b6bf,_0xa5a9cd){_0x96b6bf=_0x96b6bf-0x0;var _0x1bc323=_0xda28[_0x96b6bf];return _0x1bc323;};'use strict';var multer=require(_0x8da2('0x0'));var util=require(_0x8da2('0x1'));var path=require(_0x8da2('0x2'));var timeout=require(_0x8da2('0x3'));var express=require(_0x8da2('0x4'));var router=express['Router']();var fs_extra=require(_0x8da2('0x5'));var auth=require(_0x8da2('0x6'));var interaction=require(_0x8da2('0x7'));var config=require(_0x8da2('0x8'));var controller=require(_0x8da2('0x9'));router[_0x8da2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8da2('0xb')]);router['get'](_0x8da2('0xc'),auth[_0x8da2('0xd')](),controller['show']);router[_0x8da2('0xe')]('/',auth['isAuthenticated'](),controller[_0x8da2('0xf')]);router[_0x8da2('0x10')](_0x8da2('0xc'),auth[_0x8da2('0xd')](),controller['update']);router[_0x8da2('0x11')]('/:id',auth[_0x8da2('0xd')](),controller[_0x8da2('0x12')]);module[_0x8da2('0x13')]=router; \ No newline at end of file +var _0xae7e=['put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post'];(function(_0x2ba704,_0x3b6767){var _0x49a299=function(_0x39e002){while(--_0x39e002){_0x2ba704['push'](_0x2ba704['shift']());}};_0x49a299(++_0x3b6767);}(_0xae7e,0xf2));var _0xeae7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xae7e[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xeae7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeae7('0x1'));var express=require(_0xeae7('0x2'));var router=express[_0xeae7('0x3')]();var fs_extra=require(_0xeae7('0x4'));var auth=require(_0xeae7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeae7('0x6'));var controller=require(_0xeae7('0x7'));router[_0xeae7('0x8')]('/',auth[_0xeae7('0x9')](),controller[_0xeae7('0xa')]);router[_0xeae7('0x8')](_0xeae7('0xb'),auth[_0xeae7('0x9')](),controller['show']);router[_0xeae7('0xc')]('/',auth[_0xeae7('0x9')](),controller['create']);router[_0xeae7('0xd')](_0xeae7('0xb'),auth[_0xeae7('0x9')](),controller[_0xeae7('0xe')]);router['delete'](_0xeae7('0xb'),auth['isAuthenticated'](),controller[_0xeae7('0xf')]);module[_0xeae7('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index cf5b5ea..94a5be9 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 _0x3308=['name','#0091EA','sequelize','exports','STRING'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x3308,0x160));var _0x8330=function(_0x4959a8,_0x40fc27){_0x4959a8=_0x4959a8-0x0;var _0x2454a4=_0x3308[_0x4959a8];return _0x2454a4;};'use strict';var Sequelize=require(_0x8330('0x0'));module[_0x8330('0x1')]={'name':{'type':Sequelize[_0x8330('0x2')],'unique':_0x8330('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8330('0x2')],'defaultValue':_0x8330('0x4')},'description':{'type':Sequelize[_0x8330('0x2')]}}; \ No newline at end of file +var _0xf1f9=['name','sequelize','exports','STRING'];(function(_0x2ee084,_0x97f8fe){var _0x2e98b8=function(_0x488290){while(--_0x488290){_0x2ee084['push'](_0x2ee084['shift']());}};_0x2e98b8(++_0x97f8fe);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x4a7d6f,_0x4bfa6d){_0x4a7d6f=_0x4a7d6f-0x0;var _0x311d1a=_0xf1f9[_0x4a7d6f];return _0x311d1a;};'use strict';var Sequelize=require(_0x9f1f('0x0'));module[_0x9f1f('0x1')]={'name':{'type':Sequelize[_0x9f1f('0x2')],'unique':_0x9f1f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9f1f('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x9f1f('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index df234ae..fca5be0 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 _0xad8a=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','map','Tag','rawAttributes','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','fields','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection'];(function(_0x44caf4,_0x238750){var _0x117cad=function(_0x3e64c8){while(--_0x3e64c8){_0x44caf4['push'](_0x44caf4['shift']());}};_0x117cad(++_0x238750);}(_0xad8a,0xb0));var _0xaad8=function(_0x2bd6c4,_0x46e800){_0x2bd6c4=_0x2bd6c4-0x0;var _0x4ef8a5=_0xad8a[_0x2bd6c4];return _0x4ef8a5;};'use strict';var emlformat=require(_0xaad8('0x0'));var rimraf=require(_0xaad8('0x1'));var zipdir=require(_0xaad8('0x2'));var jsonpatch=require(_0xaad8('0x3'));var rp=require(_0xaad8('0x4'));var moment=require('moment');var BPromise=require(_0xaad8('0x5'));var Mustache=require(_0xaad8('0x6'));var util=require(_0xaad8('0x7'));var path=require('path');var sox=require(_0xaad8('0x8'));var csv=require(_0xaad8('0x9'));var ejs=require(_0xaad8('0xa'));var fs=require('fs');var fs_extra=require(_0xaad8('0xb'));var _=require(_0xaad8('0xc'));var squel=require(_0xaad8('0xd'));var crypto=require(_0xaad8('0xe'));var jsforce=require(_0xaad8('0xf'));var deskjs=require(_0xaad8('0x10'));var toCsv=require(_0xaad8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaad8('0x11'));var authService=require(_0xaad8('0x12'));var qs=require(_0xaad8('0x13'));var as=require(_0xaad8('0x14'));var hardwareService=require(_0xaad8('0x15'));var logger=require(_0xaad8('0x16'))(_0xaad8('0x17'));var utils=require(_0xaad8('0x18'));var config=require(_0xaad8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xaad8('0x1a'))['db'];function respondWithStatusCode(_0x2a13fb,_0xed6744){_0xed6744=_0xed6744||0xcc;return function(_0x456b77){if(_0x456b77){return _0x2a13fb[_0xaad8('0x1b')](_0xed6744);}return _0x2a13fb[_0xaad8('0x1c')](_0xed6744)[_0xaad8('0x1d')]();};}function respondWithResult(_0x357bf6,_0x1c70d3){_0x1c70d3=_0x1c70d3||0xc8;return function(_0x4372fc){if(_0x4372fc){return _0x357bf6[_0xaad8('0x1c')](_0x1c70d3)[_0xaad8('0x1e')](_0x4372fc);}};}function respondWithFilteredResult(_0x28bf95,_0x5e4fbb){return function(_0x334c4d){if(_0x334c4d){var _0xb63cb3=typeof _0x5e4fbb['offset']===_0xaad8('0x1f')&&typeof _0x5e4fbb[_0xaad8('0x20')]===_0xaad8('0x1f');var _0xc17ada=_0x334c4d[_0xaad8('0x21')];var _0x3895e2=_0xb63cb3?0x0:_0x5e4fbb['offset'];var _0xfd8b0a=_0xb63cb3?_0x334c4d[_0xaad8('0x21')]:_0x5e4fbb['offset']+_0x5e4fbb[_0xaad8('0x20')];var _0x4c681e;if(_0xfd8b0a>=_0xc17ada){_0xfd8b0a=_0xc17ada;_0x4c681e=0xc8;}else{_0x4c681e=0xce;}_0x28bf95[_0xaad8('0x1c')](_0x4c681e);return _0x28bf95[_0xaad8('0x22')](_0xaad8('0x23'),_0x3895e2+'-'+_0xfd8b0a+'/'+_0xc17ada)[_0xaad8('0x1e')](_0x334c4d);}return null;};}function patchUpdates(_0x5cb39b){return function(_0x18b856){try{jsonpatch[_0xaad8('0x24')](_0x18b856,_0x5cb39b,!![]);}catch(_0x594681){return BPromise[_0xaad8('0x25')](_0x594681);}return _0x18b856[_0xaad8('0x26')]();};}function saveUpdates(_0x262e57,_0x5b4b61){return function(_0x5ba0fb){if(_0x5ba0fb){return _0x5ba0fb[_0xaad8('0x27')](_0x262e57)[_0xaad8('0x28')](function(_0x3930f0){return _0x3930f0;});}return null;};}function removeEntity(_0x15e0c6,_0x29ba69){return function(_0x1daacf){if(_0x1daacf){return _0x1daacf[_0xaad8('0x29')]()[_0xaad8('0x28')](function(){var _0x477d29=_0x1daacf[_0xaad8('0x2a')]({'plain':!![]});var _0x1bbac4=_0xaad8('0x2b');return db[_0xaad8('0x2c')][_0xaad8('0x29')]({'where':{'type':_0x1bbac4,'resourceId':_0x477d29['id']}})[_0xaad8('0x28')](function(){return _0x1daacf;});})['then'](function(){_0x15e0c6[_0xaad8('0x1c')](0xcc)[_0xaad8('0x1d')]();});}};}function handleEntityNotFound(_0x3f066f,_0x47b7a2){return function(_0x237c67){if(!_0x237c67){_0x3f066f[_0xaad8('0x1b')](0x194);}return _0x237c67;};}function handleError(_0x36b180,_0x1ca776){_0x1ca776=_0x1ca776||0x1f4;return function(_0x24c01d){logger['error'](_0x24c01d[_0xaad8('0x2d')]);if(_0x24c01d[_0xaad8('0x2e')]){delete _0x24c01d[_0xaad8('0x2e')];}_0x36b180[_0xaad8('0x1c')](_0x1ca776)[_0xaad8('0x2f')](_0x24c01d);};}exports['index']=function(_0x78c862,_0x4030ea){var _0x20ea82={},_0x22f47a={},_0x47ffb7={'count':0x0,'rows':[]};var _0x30b0e2=_[_0xaad8('0x30')](db[_0xaad8('0x31')][_0xaad8('0x32')],function(_0x254ee5){return{'name':_0x254ee5['fieldName'],'type':_0x254ee5[_0xaad8('0x33')][_0xaad8('0x34')]};});_0x22f47a['model']=_['map'](_0x30b0e2,_0xaad8('0x2e'));_0x22f47a[_0xaad8('0x35')]=_[_0xaad8('0x36')](_0x78c862[_0xaad8('0x35')]);_0x22f47a['filters']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],_0x22f47a['query']);_0x20ea82['attributes']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],qs['fields'](_0x78c862[_0xaad8('0x35')]['fields']));_0x20ea82['attributes']=_0x20ea82[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x20ea82['attributes']:_0x22f47a[_0xaad8('0x38')];if(!_0x78c862[_0xaad8('0x35')][_0xaad8('0x3b')](_0xaad8('0x3c'))){_0x20ea82['limit']=qs[_0xaad8('0x20')](_0x78c862[_0xaad8('0x35')][_0xaad8('0x20')]);_0x20ea82[_0xaad8('0x3d')]=qs[_0xaad8('0x3d')](_0x78c862[_0xaad8('0x35')]['offset']);}_0x20ea82[_0xaad8('0x3e')]=qs[_0xaad8('0x3f')](_0x78c862[_0xaad8('0x35')]['sort']);_0x20ea82[_0xaad8('0x40')]=qs[_0xaad8('0x41')](_[_0xaad8('0x42')](_0x78c862[_0xaad8('0x35')],_0x22f47a[_0xaad8('0x41')]),_0x30b0e2);if(_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]){_0x20ea82['where']=_[_0xaad8('0x44')](_0x20ea82[_0xaad8('0x40')],{'$or':_[_0xaad8('0x30')](_0x30b0e2,function(_0x25c0a4){if(_0x25c0a4[_0xaad8('0x33')]!==_0xaad8('0x45')){var _0x4e4081={};_0x4e4081[_0x25c0a4[_0xaad8('0x2e')]]={'$like':'%'+_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]+'%'};return _0x4e4081;}})});}_0x20ea82=_[_0xaad8('0x44')]({},_0x20ea82,_0x78c862['options']);var _0x543761={'where':_0x20ea82['where']};return db[_0xaad8('0x31')][_0xaad8('0x21')](_0x543761)[_0xaad8('0x28')](function(_0x5bb668){_0x47ffb7[_0xaad8('0x21')]=_0x5bb668;if(_0x78c862[_0xaad8('0x35')]['includeAll']){_0x20ea82[_0xaad8('0x46')]=[{'all':!![]}];}return db[_0xaad8('0x31')][_0xaad8('0x47')](_0x20ea82);})[_0xaad8('0x28')](function(_0x3933ac){_0x47ffb7[_0xaad8('0x48')]=_0x3933ac;return _0x47ffb7;})[_0xaad8('0x28')](respondWithFilteredResult(_0x4030ea,_0x20ea82))[_0xaad8('0x49')](handleError(_0x4030ea,null));};exports[_0xaad8('0x4a')]=function(_0xbd5191,_0x29432a){var _0x241ceb={'raw':!![],'where':{'id':_0xbd5191['params']['id']}},_0x4b5b76={};_0x4b5b76['model']=_[_0xaad8('0x36')](db['Tag'][_0xaad8('0x32')]);_0x4b5b76['query']=_['keys'](_0xbd5191[_0xaad8('0x35')]);_0x4b5b76['filters']=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],_0x4b5b76[_0xaad8('0x35')]);_0x241ceb[_0xaad8('0x39')]=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],qs[_0xaad8('0x4b')](_0xbd5191[_0xaad8('0x35')][_0xaad8('0x4b')]));_0x241ceb[_0xaad8('0x39')]=_0x241ceb[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x241ceb[_0xaad8('0x39')]:_0x4b5b76[_0xaad8('0x38')];if(_0xbd5191[_0xaad8('0x35')]['includeAll']){_0x241ceb['include']=[{'all':!![]}];}_0x241ceb=_[_0xaad8('0x44')]({},_0x241ceb,_0xbd5191[_0xaad8('0x4c')]);return db[_0xaad8('0x31')]['find'](_0x241ceb)['then'](handleEntityNotFound(_0x29432a,null))[_0xaad8('0x28')](respondWithResult(_0x29432a,null))['catch'](handleError(_0x29432a,null));};exports[_0xaad8('0x4d')]=function(_0x1560ef,_0x313824){return db[_0xaad8('0x31')][_0xaad8('0x4d')](_0x1560ef[_0xaad8('0x4e')],{})[_0xaad8('0x28')](function(_0x23de0a){var _0xb19607=_0x1560ef['user'][_0xaad8('0x2a')]({'plain':!![]});if(!_0xb19607)throw new Error(_0xaad8('0x4f'));if(_0xb19607['role']===_0xaad8('0x50')){var _0x5e5ef1=_0x23de0a[_0xaad8('0x2a')]({'plain':!![]});var _0x15cb03=_0xaad8('0x2b');return db[_0xaad8('0x51')][_0xaad8('0x52')]({'where':{'name':_0x15cb03,'userProfileId':_0xb19607[_0xaad8('0x53')]},'raw':!![]})[_0xaad8('0x28')](function(_0x325a49){if(_0x325a49&&_0x325a49[_0xaad8('0x54')]===0x0){return db['UserProfileResource'][_0xaad8('0x4d')]({'name':_0x5e5ef1[_0xaad8('0x2e')],'resourceId':_0x5e5ef1['id'],'type':_0x325a49[_0xaad8('0x2e')],'sectionId':_0x325a49['id']},{})[_0xaad8('0x28')](function(){return _0x23de0a;});}else{return _0x23de0a;}})[_0xaad8('0x49')](function(_0x9bf893){logger['error'](_0xaad8('0x55'),_0x9bf893);throw _0x9bf893;});}return _0x23de0a;})[_0xaad8('0x28')](respondWithResult(_0x313824,0xc9))['catch'](handleError(_0x313824,null));};exports['update']=function(_0x33e743,_0x1202d4){if(_0x33e743[_0xaad8('0x4e')]['id']){delete _0x33e743[_0xaad8('0x4e')]['id'];}return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x33e743['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x1202d4,null))[_0xaad8('0x28')](saveUpdates(_0x33e743[_0xaad8('0x4e')],null))[_0xaad8('0x28')](respondWithResult(_0x1202d4,null))[_0xaad8('0x49')](handleError(_0x1202d4,null));};exports['destroy']=function(_0x5ddb77,_0x48edf6){return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x5ddb77['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x48edf6,null))[_0xaad8('0x28')](removeEntity(_0x48edf6,null))[_0xaad8('0x49')](handleError(_0x48edf6,null));}; \ No newline at end of file +var _0x867f=['../../config/logger','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','get','Tags','UserProfileResource','then','end','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','keys','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x59b876,_0x209a1e){var _0x4b4079=function(_0x1cb067){while(--_0x1cb067){_0x59b876['push'](_0x59b876['shift']());}};_0x4b4079(++_0x209a1e);}(_0x867f,0xe6));var _0xf867=function(_0x304655,_0x15b109){_0x304655=_0x304655-0x0;var _0x2fa58a=_0x867f[_0x304655];return _0x2fa58a;};'use strict';var emlformat=require(_0xf867('0x0'));var rimraf=require(_0xf867('0x1'));var zipdir=require(_0xf867('0x2'));var jsonpatch=require(_0xf867('0x3'));var rp=require(_0xf867('0x4'));var moment=require(_0xf867('0x5'));var BPromise=require(_0xf867('0x6'));var Mustache=require(_0xf867('0x7'));var util=require(_0xf867('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf867('0x9'));var ejs=require(_0xf867('0xa'));var fs=require('fs');var fs_extra=require(_0xf867('0xb'));var _=require(_0xf867('0xc'));var squel=require(_0xf867('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf867('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf867('0xf'));var Papa=require(_0xf867('0x10'));var Redis=require(_0xf867('0x11'));var authService=require(_0xf867('0x12'));var qs=require(_0xf867('0x13'));var as=require(_0xf867('0x14'));var hardwareService=require(_0xf867('0x15'));var logger=require(_0xf867('0x16'))('api');var utils=require(_0xf867('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf867('0x18'))['db'];function respondWithStatusCode(_0x1792ae,_0x20fe34){_0x20fe34=_0x20fe34||0xcc;return function(_0x56740c){if(_0x56740c){return _0x1792ae['sendStatus'](_0x20fe34);}return _0x1792ae[_0xf867('0x19')](_0x20fe34)['end']();};}function respondWithResult(_0x352f0b,_0x49ff40){_0x49ff40=_0x49ff40||0xc8;return function(_0x48ff28){if(_0x48ff28){return _0x352f0b[_0xf867('0x19')](_0x49ff40)[_0xf867('0x1a')](_0x48ff28);}};}function respondWithFilteredResult(_0x7a143e,_0x13973b){return function(_0x38fed9){if(_0x38fed9){var _0x1e5161=typeof _0x13973b[_0xf867('0x1b')]===_0xf867('0x1c')&&typeof _0x13973b[_0xf867('0x1d')]==='undefined';var _0x44f6f1=_0x38fed9['count'];var _0x39f9e8=_0x1e5161?0x0:_0x13973b['offset'];var _0x51bdb3=_0x1e5161?_0x38fed9[_0xf867('0x1e')]:_0x13973b['offset']+_0x13973b['limit'];var _0x2092af;if(_0x51bdb3>=_0x44f6f1){_0x51bdb3=_0x44f6f1;_0x2092af=0xc8;}else{_0x2092af=0xce;}_0x7a143e[_0xf867('0x19')](_0x2092af);return _0x7a143e['set']('Content-Range',_0x39f9e8+'-'+_0x51bdb3+'/'+_0x44f6f1)[_0xf867('0x1a')](_0x38fed9);}return null;};}function patchUpdates(_0x23e7dd){return function(_0x1456ce){try{jsonpatch[_0xf867('0x1f')](_0x1456ce,_0x23e7dd,!![]);}catch(_0x419f75){return BPromise[_0xf867('0x20')](_0x419f75);}return _0x1456ce[_0xf867('0x21')]();};}function saveUpdates(_0x34db74,_0x586a25){return function(_0x568aba){if(_0x568aba){return _0x568aba[_0xf867('0x22')](_0x34db74)['then'](function(_0x3072b7){return _0x3072b7;});}return null;};}function removeEntity(_0x3fc971,_0x4da34b){return function(_0x419b6f){if(_0x419b6f){return _0x419b6f[_0xf867('0x23')]()['then'](function(){var _0x231076=_0x419b6f[_0xf867('0x24')]({'plain':!![]});var _0x167e70=_0xf867('0x25');return db[_0xf867('0x26')][_0xf867('0x23')]({'where':{'type':_0x167e70,'resourceId':_0x231076['id']}})[_0xf867('0x27')](function(){return _0x419b6f;});})[_0xf867('0x27')](function(){_0x3fc971[_0xf867('0x19')](0xcc)[_0xf867('0x28')]();});}};}function handleEntityNotFound(_0x28b44a,_0x1f8aa1){return function(_0xa40271){if(!_0xa40271){_0x28b44a[_0xf867('0x29')](0x194);}return _0xa40271;};}function handleError(_0x327a13,_0x3ed616){_0x3ed616=_0x3ed616||0x1f4;return function(_0x57bf28){logger[_0xf867('0x2a')](_0x57bf28[_0xf867('0x2b')]);if(_0x57bf28[_0xf867('0x2c')]){delete _0x57bf28[_0xf867('0x2c')];}_0x327a13[_0xf867('0x19')](_0x3ed616)[_0xf867('0x2d')](_0x57bf28);};}exports[_0xf867('0x2e')]=function(_0x517b9c,_0x44ddd4){var _0x3e076c={},_0x216716={},_0x36ed62={'count':0x0,'rows':[]};var _0x40517f=_[_0xf867('0x2f')](db[_0xf867('0x30')][_0xf867('0x31')],function(_0x4ffce9){return{'name':_0x4ffce9[_0xf867('0x32')],'type':_0x4ffce9['type'][_0xf867('0x33')]};});_0x216716['model']=_[_0xf867('0x2f')](_0x40517f,_0xf867('0x2c'));_0x216716[_0xf867('0x34')]=_['keys'](_0x517b9c[_0xf867('0x34')]);_0x216716[_0xf867('0x35')]=_['intersection'](_0x216716['model'],_0x216716[_0xf867('0x34')]);_0x3e076c['attributes']=_[_0xf867('0x36')](_0x216716[_0xf867('0x37')],qs[_0xf867('0x38')](_0x517b9c[_0xf867('0x34')]['fields']));_0x3e076c['attributes']=_0x3e076c[_0xf867('0x39')][_0xf867('0x3a')]?_0x3e076c[_0xf867('0x39')]:_0x216716['model'];if(!_0x517b9c[_0xf867('0x34')][_0xf867('0x3b')]('nolimit')){_0x3e076c[_0xf867('0x1d')]=qs['limit'](_0x517b9c[_0xf867('0x34')][_0xf867('0x1d')]);_0x3e076c[_0xf867('0x1b')]=qs['offset'](_0x517b9c[_0xf867('0x34')]['offset']);}_0x3e076c[_0xf867('0x3c')]=qs[_0xf867('0x3d')](_0x517b9c[_0xf867('0x34')][_0xf867('0x3d')]);_0x3e076c[_0xf867('0x3e')]=qs[_0xf867('0x35')](_[_0xf867('0x3f')](_0x517b9c[_0xf867('0x34')],_0x216716['filters']),_0x40517f);if(_0x517b9c['query'][_0xf867('0x40')]){_0x3e076c[_0xf867('0x3e')]=_[_0xf867('0x41')](_0x3e076c[_0xf867('0x3e')],{'$or':_[_0xf867('0x2f')](_0x40517f,function(_0x462df6){if(_0x462df6[_0xf867('0x42')]!=='VIRTUAL'){var _0x4513e1={};_0x4513e1[_0x462df6[_0xf867('0x2c')]]={'$like':'%'+_0x517b9c[_0xf867('0x34')][_0xf867('0x40')]+'%'};return _0x4513e1;}})});}_0x3e076c=_[_0xf867('0x41')]({},_0x3e076c,_0x517b9c[_0xf867('0x43')]);var _0x419b34={'where':_0x3e076c[_0xf867('0x3e')]};return db[_0xf867('0x30')]['count'](_0x419b34)[_0xf867('0x27')](function(_0x4e31d8){_0x36ed62[_0xf867('0x1e')]=_0x4e31d8;if(_0x517b9c[_0xf867('0x34')][_0xf867('0x44')]){_0x3e076c['include']=[{'all':!![]}];}return db[_0xf867('0x30')][_0xf867('0x45')](_0x3e076c);})[_0xf867('0x27')](function(_0xed868d){_0x36ed62[_0xf867('0x46')]=_0xed868d;return _0x36ed62;})[_0xf867('0x27')](respondWithFilteredResult(_0x44ddd4,_0x3e076c))['catch'](handleError(_0x44ddd4,null));};exports[_0xf867('0x47')]=function(_0x2d02f8,_0x1d5dad){var _0x20ec01={'raw':!![],'where':{'id':_0x2d02f8['params']['id']}},_0x3b8929={};_0x3b8929[_0xf867('0x37')]=_['keys'](db[_0xf867('0x30')][_0xf867('0x31')]);_0x3b8929['query']=_[_0xf867('0x48')](_0x2d02f8[_0xf867('0x34')]);_0x3b8929[_0xf867('0x35')]=_[_0xf867('0x36')](_0x3b8929[_0xf867('0x37')],_0x3b8929[_0xf867('0x34')]);_0x20ec01['attributes']=_[_0xf867('0x36')](_0x3b8929['model'],qs[_0xf867('0x38')](_0x2d02f8[_0xf867('0x34')][_0xf867('0x38')]));_0x20ec01[_0xf867('0x39')]=_0x20ec01[_0xf867('0x39')][_0xf867('0x3a')]?_0x20ec01[_0xf867('0x39')]:_0x3b8929['model'];if(_0x2d02f8['query'][_0xf867('0x44')]){_0x20ec01[_0xf867('0x49')]=[{'all':!![]}];}_0x20ec01=_[_0xf867('0x41')]({},_0x20ec01,_0x2d02f8['options']);return db[_0xf867('0x30')][_0xf867('0x4a')](_0x20ec01)[_0xf867('0x27')](handleEntityNotFound(_0x1d5dad,null))['then'](respondWithResult(_0x1d5dad,null))[_0xf867('0x4b')](handleError(_0x1d5dad,null));};exports['create']=function(_0xc01c03,_0x2d56c0){return db[_0xf867('0x30')][_0xf867('0x4c')](_0xc01c03[_0xf867('0x4d')],{})[_0xf867('0x27')](function(_0x422b28){var _0x1b6253=_0xc01c03['user']['get']({'plain':!![]});if(!_0x1b6253)throw new Error(_0xf867('0x4e'));if(_0x1b6253[_0xf867('0x4f')]===_0xf867('0x50')){var _0x199ce0=_0x422b28[_0xf867('0x24')]({'plain':!![]});var _0x42990f=_0xf867('0x25');return db['UserProfileSection'][_0xf867('0x4a')]({'where':{'name':_0x42990f,'userProfileId':_0x1b6253[_0xf867('0x51')]},'raw':!![]})[_0xf867('0x27')](function(_0x357bc4){if(_0x357bc4&&_0x357bc4['autoAssociation']===0x0){return db[_0xf867('0x26')][_0xf867('0x4c')]({'name':_0x199ce0['name'],'resourceId':_0x199ce0['id'],'type':_0x357bc4['name'],'sectionId':_0x357bc4['id']},{})['then'](function(){return _0x422b28;});}else{return _0x422b28;}})[_0xf867('0x4b')](function(_0x347273){logger['error'](_0xf867('0x52'),_0x347273);throw _0x347273;});}return _0x422b28;})[_0xf867('0x27')](respondWithResult(_0x2d56c0,0xc9))['catch'](handleError(_0x2d56c0,null));};exports[_0xf867('0x22')]=function(_0x3041cf,_0x59d460){if(_0x3041cf[_0xf867('0x4d')]['id']){delete _0x3041cf[_0xf867('0x4d')]['id'];}return db[_0xf867('0x30')][_0xf867('0x4a')]({'where':{'id':_0x3041cf[_0xf867('0x53')]['id']}})['then'](handleEntityNotFound(_0x59d460,null))['then'](saveUpdates(_0x3041cf[_0xf867('0x4d')],null))[_0xf867('0x27')](respondWithResult(_0x59d460,null))[_0xf867('0x4b')](handleError(_0x59d460,null));};exports[_0xf867('0x23')]=function(_0x3afdc9,_0x44229e){return db['Tag'][_0xf867('0x4a')]({'where':{'id':_0x3afdc9[_0xf867('0x53')]['id']}})[_0xf867('0x27')](handleEntityNotFound(_0x44229e,null))[_0xf867('0x27')](removeEntity(_0x44229e,null))[_0xf867('0x4b')](handleError(_0x44229e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f9bcc5b..3280c7d 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 _0xca27=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','define','tools_tags'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0xca27,0xbe));var _0x7ca2=function(_0x157c23,_0x4ac9b8){_0x157c23=_0x157c23-0x0;var _0x243ff8=_0xca27[_0x157c23];return _0x243ff8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7ca2('0x0'))(_0x7ca2('0x1'));var moment=require(_0x7ca2('0x2'));var BPromise=require(_0x7ca2('0x3'));var rp=require(_0x7ca2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ca2('0x5'));var config=require(_0x7ca2('0x6'));var attributes=require(_0x7ca2('0x7'));module['exports']=function(_0x17de9d,_0x22bc5c){return _0x17de9d[_0x7ca2('0x8')]('Tag',attributes,{'tableName':_0x7ca2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3c8=['path','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x6dc4a5,_0x5cecec){var _0x4acd02=function(_0x898b5b){while(--_0x898b5b){_0x6dc4a5['push'](_0x6dc4a5['shift']());}};_0x4acd02(++_0x5cecec);}(_0xe3c8,0x145));var _0x8e3c=function(_0x5357cc,_0x490b53){_0x5357cc=_0x5357cc-0x0;var _0x4d5010=_0xe3c8[_0x5357cc];return _0x4d5010;};'use strict';var _=require(_0x8e3c('0x0'));var util=require(_0x8e3c('0x1'));var logger=require(_0x8e3c('0x2'))(_0x8e3c('0x3'));var moment=require(_0x8e3c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e3c('0x5'));var rimraf=require('rimraf');var config=require(_0x8e3c('0x6'));var attributes=require(_0x8e3c('0x7'));module[_0x8e3c('0x8')]=function(_0xa2522e,_0x338f7d){return _0xa2522e['define'](_0x8e3c('0x9'),attributes,{'tableName':_0x8e3c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 46eb46b..6346f76 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 _0xc3b5=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x27de02,_0x580898){var _0x411734=function(_0x42f473){while(--_0x42f473){_0x27de02['push'](_0x27de02['shift']());}};_0x411734(++_0x580898);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x368614,_0xbd1d1b){_0x368614=_0x368614-0x0;var _0x3c753f=_0xc3b5[_0x368614];return _0x3c753f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c3b('0x0'));var BPromise=require(_0x5c3b('0x1'));var rs=require(_0x5c3b('0x2'));var fs=require('fs');var Redis=require(_0x5c3b('0x3'));var db=require(_0x5c3b('0x4'))['db'];var utils=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c3b('0x8'));var client=jayson[_0x5c3b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568a28,_0x30a08f,_0x420839){return new BPromise(function(_0x3892ad,_0x5be9ee){return client[_0x5c3b('0xa')](_0x568a28,_0x420839)[_0x5c3b('0xb')](function(_0x159db5){logger[_0x5c3b('0xc')]('Tag,\x20%s,\x20%s',_0x30a08f,_0x5c3b('0xd'));logger[_0x5c3b('0xe')](_0x5c3b('0xf'),_0x30a08f,_0x5c3b('0xd'),JSON[_0x5c3b('0x10')](_0x159db5));if(_0x159db5['error']){if(_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x12')]===0x1f4){logger['error'](_0x5c3b('0x13'),_0x30a08f,_0x159db5[_0x5c3b('0x11')]['message']);return _0x5be9ee(_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x14')]);}logger[_0x5c3b('0x11')](_0x5c3b('0x13'),_0x30a08f,_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x14')]);return _0x3892ad(_0x159db5[_0x5c3b('0x11')]['message']);}else{logger[_0x5c3b('0xc')]('Tag,\x20%s,\x20%s',_0x30a08f,'request\x20sent');_0x3892ad(_0x159db5[_0x5c3b('0x15')][_0x5c3b('0x14')]);}})[_0x5c3b('0x16')](function(_0x589797){logger[_0x5c3b('0x11')](_0x5c3b('0x13'),_0x30a08f,_0x589797);_0x5be9ee(_0x589797);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x008c,0x188));var _0xc008=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0x008c[_0xa3fadc];return _0x23ecb8;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('Tag,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('Tag,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('Tag,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('Tag,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 07ff3ce..2ef6b6f 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 85bffe9..98c96cf 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(_0x3f64a1,_0x44ab3c){var _0x503147=function(_0x34029d){while(--_0x34029d){_0x3f64a1['push'](_0x3f64a1['shift']());}};_0x503147(++_0x44ab3c);}(_0x757a,0xde));var _0xa757=function(_0x3d0469,_0x17aa0d){_0x3d0469=_0x3d0469-0x0;var _0x8bbb54=_0x757a[_0x3d0469];return _0x8bbb54;};'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 _0xb7e7=['STRING','sequelize'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb7e7[_0x19e35c];return _0x3e1fe8;};'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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 037342d..dcd9a65 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 _0x590c=['Unknown\x20channel','capitalize','toLowerCase','Queue','get','Queues','addQueues','ValidationError','ids','remove','addAgents','isArray','Voice','Mail','Fax','Openchannel','Whatsapp','QueueId','TeamVoiceQueue','penalty','User','Queue:save','online','voicePause','upsert','format','SIP/%s','interface','all','spread','removeAgents','Queue:remove','UserVoiceQueueRt','getAgents','order','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','limit','Content-Range','json','reject','error','stack','name','send','map','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','Team','count','then','includeAll','include','findAll','catch','show','keys','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','UserProfileResource','destroy','params','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel'];(function(_0x5520c7,_0xbee449){var _0x3b0590=function(_0x1bb4f9){while(--_0x1bb4f9){_0x5520c7['push'](_0x5520c7['shift']());}};_0x3b0590(++_0xbee449);}(_0x590c,0x150));var _0xc590=function(_0x5be571,_0x46766a){_0x5be571=_0x5be571-0x0;var _0x4ac06c=_0x590c[_0x5be571];return _0x4ac06c;};'use strict';var emlformat=require(_0xc590('0x0'));var rimraf=require(_0xc590('0x1'));var zipdir=require(_0xc590('0x2'));var jsonpatch=require(_0xc590('0x3'));var rp=require(_0xc590('0x4'));var moment=require(_0xc590('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc590('0x6'));var util=require(_0xc590('0x7'));var path=require(_0xc590('0x8'));var sox=require(_0xc590('0x9'));var csv=require(_0xc590('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc590('0xb'));var _=require(_0xc590('0xc'));var squel=require(_0xc590('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc590('0xe'));var toCsv=require(_0xc590('0xa'));var querystring=require(_0xc590('0xf'));var Papa=require(_0xc590('0x10'));var Redis=require('ioredis');var authService=require(_0xc590('0x11'));var qs=require(_0xc590('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc590('0x13'))(_0xc590('0x14'));var utils=require(_0xc590('0x15'));var config=require(_0xc590('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc590('0x17'))['db'];config[_0xc590('0x18')]=_[_0xc590('0x19')](config[_0xc590('0x18')],{'host':_0xc590('0x1a'),'port':0x18eb});var socket=require(_0xc590('0x1b'))(new Redis(config[_0xc590('0x18')]));require(_0xc590('0x1c'))[_0xc590('0x1d')](socket);function respondWithStatusCode(_0x19965d,_0x59f4e7){_0x59f4e7=_0x59f4e7||0xcc;return function(_0x1fa9ca){if(_0x1fa9ca){return _0x19965d[_0xc590('0x1e')](_0x59f4e7);}return _0x19965d[_0xc590('0x1f')](_0x59f4e7)[_0xc590('0x20')]();};}function respondWithResult(_0x46544a,_0x336388){_0x336388=_0x336388||0xc8;return function(_0x50330e){if(_0x50330e){return _0x46544a['status'](_0x336388)['json'](_0x50330e);}};}function respondWithFilteredResult(_0x1d62c1,_0x3d0e04){return function(_0x7a779d){if(_0x7a779d){var _0x31daed=typeof _0x3d0e04['offset']==='undefined'&&typeof _0x3d0e04['limit']==='undefined';var _0x2381a3=_0x7a779d['count'];var _0x361d33=_0x31daed?0x0:_0x3d0e04[_0xc590('0x21')];var _0x3ce62c=_0x31daed?_0x7a779d['count']:_0x3d0e04[_0xc590('0x21')]+_0x3d0e04[_0xc590('0x22')];var _0x5516ae;if(_0x3ce62c>=_0x2381a3){_0x3ce62c=_0x2381a3;_0x5516ae=0xc8;}else{_0x5516ae=0xce;}_0x1d62c1[_0xc590('0x1f')](_0x5516ae);return _0x1d62c1['set'](_0xc590('0x23'),_0x361d33+'-'+_0x3ce62c+'/'+_0x2381a3)[_0xc590('0x24')](_0x7a779d);}return null;};}function patchUpdates(_0x5c5919){return function(_0x12c5eb){try{jsonpatch['apply'](_0x12c5eb,_0x5c5919,!![]);}catch(_0x571d5b){return BPromise[_0xc590('0x25')](_0x571d5b);}return _0x12c5eb['save']();};}function saveUpdates(_0x3fa9e8,_0x8a1124){return function(_0x1060b7){if(_0x1060b7){return _0x1060b7['update'](_0x3fa9e8)['then'](function(_0x1e3c2a){return _0x1e3c2a;});}return null;};}function handleEntityNotFound(_0x50ba8f,_0x391f42){return function(_0x27981c){if(!_0x27981c){_0x50ba8f['sendStatus'](0x194);}return _0x27981c;};}function handleError(_0x5720ee,_0x4bf73f){_0x4bf73f=_0x4bf73f||0x1f4;return function(_0x281851){logger[_0xc590('0x26')](_0x281851[_0xc590('0x27')]);if(_0x281851[_0xc590('0x28')]){delete _0x281851[_0xc590('0x28')];}_0x5720ee[_0xc590('0x1f')](_0x4bf73f)[_0xc590('0x29')](_0x281851);};}exports['index']=function(_0x557aea,_0x566f77){var _0x51dacf={},_0x7fc26c={},_0x2aee4c={'count':0x0,'rows':[]};var _0x224180=_[_0xc590('0x2a')](db['Team']['rawAttributes'],function(_0x4704ad){return{'name':_0x4704ad[_0xc590('0x2b')],'type':_0x4704ad[_0xc590('0x2c')][_0xc590('0x2d')]};});_0x7fc26c['model']=_[_0xc590('0x2a')](_0x224180,_0xc590('0x28'));_0x7fc26c[_0xc590('0x2e')]=_['keys'](_0x557aea[_0xc590('0x2e')]);_0x7fc26c['filters']=_[_0xc590('0x2f')](_0x7fc26c[_0xc590('0x30')],_0x7fc26c['query']);_0x51dacf[_0xc590('0x31')]=_[_0xc590('0x2f')](_0x7fc26c[_0xc590('0x30')],qs[_0xc590('0x32')](_0x557aea[_0xc590('0x2e')][_0xc590('0x32')]));_0x51dacf[_0xc590('0x31')]=_0x51dacf[_0xc590('0x31')][_0xc590('0x33')]?_0x51dacf['attributes']:_0x7fc26c[_0xc590('0x30')];if(!_0x557aea[_0xc590('0x2e')][_0xc590('0x34')]('nolimit')){_0x51dacf['limit']=qs[_0xc590('0x22')](_0x557aea['query'][_0xc590('0x22')]);_0x51dacf[_0xc590('0x21')]=qs['offset'](_0x557aea['query'][_0xc590('0x21')]);}_0x51dacf['order']=qs['sort'](_0x557aea['query'][_0xc590('0x35')]);_0x51dacf[_0xc590('0x36')]=qs[_0xc590('0x37')](_[_0xc590('0x38')](_0x557aea[_0xc590('0x2e')],_0x7fc26c[_0xc590('0x37')]),_0x224180);if(_0x557aea[_0xc590('0x2e')][_0xc590('0x39')]){_0x51dacf['where']=_['merge'](_0x51dacf[_0xc590('0x36')],{'$or':_[_0xc590('0x2a')](_0x224180,function(_0x31cdbd){if(_0x31cdbd[_0xc590('0x2c')]!==_0xc590('0x3a')){var _0x66ac9b={};_0x66ac9b[_0x31cdbd[_0xc590('0x28')]]={'$like':'%'+_0x557aea['query']['filter']+'%'};return _0x66ac9b;}})});}_0x51dacf=_[_0xc590('0x3b')]({},_0x51dacf,_0x557aea['options']);var _0x3c6803={'where':_0x51dacf[_0xc590('0x36')]};return db[_0xc590('0x3c')][_0xc590('0x3d')](_0x3c6803)[_0xc590('0x3e')](function(_0x5f37c3){_0x2aee4c[_0xc590('0x3d')]=_0x5f37c3;if(_0x557aea[_0xc590('0x2e')][_0xc590('0x3f')]){_0x51dacf[_0xc590('0x40')]=[{'all':!![]}];}return db[_0xc590('0x3c')][_0xc590('0x41')](_0x51dacf);})[_0xc590('0x3e')](function(_0x111014){_0x2aee4c['rows']=_0x111014;return _0x2aee4c;})[_0xc590('0x3e')](respondWithFilteredResult(_0x566f77,_0x51dacf))[_0xc590('0x42')](handleError(_0x566f77,null));};exports[_0xc590('0x43')]=function(_0x6c54b3,_0x79fa01){var _0x534389={'raw':![],'where':{'id':_0x6c54b3['params']['id']}},_0x43d32c={};_0x43d32c[_0xc590('0x30')]=_[_0xc590('0x44')](db[_0xc590('0x3c')][_0xc590('0x45')]);_0x43d32c[_0xc590('0x2e')]=_[_0xc590('0x44')](_0x6c54b3[_0xc590('0x2e')]);_0x43d32c['filters']=_['intersection'](_0x43d32c[_0xc590('0x30')],_0x43d32c[_0xc590('0x2e')]);_0x534389[_0xc590('0x31')]=_['intersection'](_0x43d32c['model'],qs['fields'](_0x6c54b3[_0xc590('0x2e')][_0xc590('0x32')]));_0x534389[_0xc590('0x31')]=_0x534389[_0xc590('0x31')]['length']?_0x534389['attributes']:_0x43d32c[_0xc590('0x30')];if(_0x6c54b3[_0xc590('0x2e')][_0xc590('0x3f')]){_0x534389[_0xc590('0x40')]=[{'all':!![]}];}_0x534389=_[_0xc590('0x3b')]({},_0x534389,_0x6c54b3[_0xc590('0x46')]);return db[_0xc590('0x3c')][_0xc590('0x47')](_0x534389)['then'](handleEntityNotFound(_0x79fa01,null))[_0xc590('0x3e')](respondWithResult(_0x79fa01,null))[_0xc590('0x42')](handleError(_0x79fa01,null));};exports['create']=function(_0x4926f7,_0x46d592){return db[_0xc590('0x3c')][_0xc590('0x48')](_0x4926f7[_0xc590('0x49')],{})['then'](function(_0x6dd652){var _0x19c644=_0x4926f7[_0xc590('0x4a')]['get']({'plain':!![]});if(!_0x19c644)throw new Error(_0xc590('0x4b'));if(_0x19c644[_0xc590('0x4c')]===_0xc590('0x4a')){var _0x46a9e5=_0x6dd652['get']({'plain':!![]});var _0x26eddb=_0xc590('0x4d');return db[_0xc590('0x4e')][_0xc590('0x47')]({'where':{'name':_0x26eddb,'userProfileId':_0x19c644[_0xc590('0x4f')]},'raw':!![]})['then'](function(_0x105868){if(_0x105868&&_0x105868['autoAssociation']===0x0){return db[_0xc590('0x50')]['create']({'name':_0x46a9e5[_0xc590('0x28')],'resourceId':_0x46a9e5['id'],'type':_0x105868[_0xc590('0x28')],'sectionId':_0x105868['id']},{})[_0xc590('0x3e')](function(){return _0x6dd652;});}else{return _0x6dd652;}})[_0xc590('0x42')](function(_0x4364bc){logger[_0xc590('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4364bc);throw _0x4364bc;});}return _0x6dd652;})[_0xc590('0x3e')](respondWithResult(_0x46d592,0xc9))['catch'](handleError(_0x46d592,null));};exports['update']=function(_0x220e3f,_0x2a11ae){if(_0x220e3f[_0xc590('0x49')]['id']){delete _0x220e3f['body']['id'];}return db[_0xc590('0x3c')][_0xc590('0x47')]({'where':{'id':_0x220e3f['params']['id']}})['then'](handleEntityNotFound(_0x2a11ae,null))['then'](saveUpdates(_0x220e3f[_0xc590('0x49')],null))[_0xc590('0x3e')](respondWithResult(_0x2a11ae,null))[_0xc590('0x42')](handleError(_0x2a11ae,null));};exports[_0xc590('0x51')]=function(_0x51713f,_0x444c87){var _0x38429d=_0x51713f[_0xc590('0x52')]['id'];var _0x1b6370=[];return db[_0xc590('0x53')][_0xc590('0x54')](function(_0x40be1f){var _0x4a0577=_0xc590('0x55')+_0x38429d;return db[_0xc590('0x53')]['query'](_0x4a0577,{'type':db[_0xc590('0x56')][_0xc590('0x57')]['SELECT'],'raw':!![],'transaction':_0x40be1f})[_0xc590('0x3e')](function(_0x5476d0){_0x1b6370=_[_0xc590('0x2a')](_0x5476d0,function(_0x22d441){return Number(_0x22d441[_0xc590('0x58')]);});})[_0xc590('0x3e')](function(){var _0x5355dc=_0xc590('0x59')+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x5355dc,{'type':db[_0xc590('0x56')][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x19943d){var _0x51cea7=_[_0xc590('0x2a')](_0x19943d,function(_0xb0a21b){return Number(_0xb0a21b[_0xc590('0x5b')]);});return db[_0xc590('0x5c')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'VoiceQueueId':{'$in':_0x51cea7}},'transaction':_0x40be1f});})['then'](function(){var _0x13e4a5=_0xc590('0x5d')+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x13e4a5,{'type':db[_0xc590('0x56')][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x25ccf1){var _0x978057=_[_0xc590('0x2a')](_0x25ccf1,function(_0x12bb5e){return Number(_0x12bb5e[_0xc590('0x5e')]);});return db[_0xc590('0x5f')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'MailQueueId':{'$in':_0x978057}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){var _0x582097=_0xc590('0x60')+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x582097,{'type':db[_0xc590('0x56')][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})['then'](function(_0xe4369d){var _0x4ca80d=_[_0xc590('0x2a')](_0xe4369d,function(_0x4144d7){return Number(_0x4144d7[_0xc590('0x61')]);});return db[_0xc590('0x62')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'SmsQueueId':{'$in':_0x4ca80d}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){var _0x3c21af='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x38429d;return db['sequelize']['query'](_0x3c21af,{'type':db['Sequelize'][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x1ad725){var _0x31f7c8=_[_0xc590('0x2a')](_0x1ad725,function(_0x439759){return Number(_0x439759['ChatQueueId']);});return db[_0xc590('0x63')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'ChatQueueId':{'$in':_0x31f7c8}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){var _0x46fc91=_0xc590('0x64')+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x46fc91,{'type':db[_0xc590('0x56')]['QueryTypes'][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x5d27c4){var _0x506dde=_[_0xc590('0x2a')](_0x5d27c4,function(_0x15868b){return Number(_0x15868b[_0xc590('0x65')]);});return db[_0xc590('0x66')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'FaxQueueId':{'$in':_0x506dde}},'transaction':_0x40be1f});})['then'](function(){var _0x292aae='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x292aae,{'type':db['Sequelize'][_0xc590('0x57')]['SELECT'],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x5f26b0){var _0x5bce5a=_[_0xc590('0x2a')](_0x5f26b0,function(_0x336f65){return Number(_0x336f65[_0xc590('0x67')]);});return db['UserOpenchannelQueue'][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'OpenchannelQueueId':{'$in':_0x5bce5a}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){var _0x1b4083=_0xc590('0x68')+_0x38429d;return db['sequelize'][_0xc590('0x2e')](_0x1b4083,{'type':db['Sequelize'][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})['then'](function(_0x22f2e0){var _0x2f0838=_[_0xc590('0x2a')](_0x22f2e0,function(_0x520e9b){return Number(_0x520e9b[_0xc590('0x69')]);});return db[_0xc590('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x1b6370},'WhatsappQueueId':{'$in':_0x2f0838}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){return db[_0xc590('0x6b')][_0xc590('0x47')]({'where':{'TeamId':_0x38429d}});})['then'](function(_0x4845ce){if(_0x4845ce===null){return;}return db[_0xc590('0x6c')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'VoicePrefixId':_0x4845ce[_0xc590('0x6d')]},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){return db[_0xc590('0x3c')][_0xc590('0x51')]({'where':{'id':_0x38429d},'cascade':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x2e0b96){if(_0x2e0b96===0x0){_0x444c87['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xc590('0x51')]({'where':{'type':'Teams','resourceId':_0x38429d},'cascade':!![],'transaction':_0x40be1f})[_0xc590('0x3e')](function(){_0x444c87['status'](0xcc)['end']();});}})[_0xc590('0x42')](function(_0x207df0){_0x444c87[_0xc590('0x1f')](0x1f4)['send'](_0x207df0);});});};exports[_0xc590('0x6e')]=function(_0x56b2fb,_0x48a20a,_0x207560){return db[_0xc590('0x3c')][_0xc590('0x6f')]({'where':{'id':_0x56b2fb[_0xc590('0x52')]['id']}})['then'](handleEntityNotFound(_0x48a20a,null))[_0xc590('0x3e')](function(_0x1d850e){if(!_0x56b2fb['query'][_0xc590('0x70')]||!utils[_0xc590('0x71')](_0x56b2fb[_0xc590('0x2e')][_0xc590('0x70')])){throw new db['Sequelize']['ValidationError'](_0xc590('0x72'));}var _0x5af2e8={};var _0x49860d={};_0x49860d[_0xc590('0x30')]=_[_0xc590('0x44')](db[_[_0xc590('0x73')](_0x56b2fb['query'][_0xc590('0x70')][_0xc590('0x74')]())+_0xc590('0x75')][_0xc590('0x45')]);_0x49860d[_0xc590('0x2e')]=_[_0xc590('0x44')](_0x56b2fb[_0xc590('0x2e')]);_0x49860d[_0xc590('0x37')]=_[_0xc590('0x2f')](_0x49860d[_0xc590('0x30')],_0x49860d['query']);_0x5af2e8[_0xc590('0x31')]=_[_0xc590('0x2f')](_0x49860d['model'],qs[_0xc590('0x32')](_0x56b2fb['query']['fields']));_0x5af2e8[_0xc590('0x31')]=_0x5af2e8[_0xc590('0x31')][_0xc590('0x33')]?_0x5af2e8[_0xc590('0x31')]:_0x49860d[_0xc590('0x30')];_0x5af2e8['limit']=qs[_0xc590('0x22')](_0x56b2fb[_0xc590('0x2e')][_0xc590('0x22')]);_0x5af2e8['offset']=qs[_0xc590('0x21')](_0x56b2fb['query']['offset']);_0x5af2e8['order']=qs[_0xc590('0x35')](_0x56b2fb[_0xc590('0x2e')][_0xc590('0x35')]);_0x5af2e8[_0xc590('0x36')]=qs['filters'](_[_0xc590('0x38')](_0x56b2fb[_0xc590('0x2e')],_0x49860d[_0xc590('0x37')]));_0x5af2e8=_['merge']({},_0x5af2e8,_0x56b2fb[_0xc590('0x46')]);return _0x1d850e[_0xc590('0x76')+_[_0xc590('0x73')](_0x56b2fb[_0xc590('0x2e')][_0xc590('0x70')][_0xc590('0x74')]())+_0xc590('0x77')](_0x5af2e8);})[_0xc590('0x3e')](respondWithResult(_0x48a20a,null))[_0xc590('0x42')](handleError(_0x48a20a,null));};exports[_0xc590('0x78')]=function(_0x2f76e3,_0xf52da4,_0x34a7fb){return db['Team'][_0xc590('0x6f')]({'where':{'id':_0x2f76e3[_0xc590('0x52')]['id']}})['then'](function(_0x2d1041){if(_0x2d1041){if(!_0x2f76e3[_0xc590('0x49')]['channel']||!utils[_0xc590('0x71')](_0x2f76e3[_0xc590('0x49')][_0xc590('0x70')])){throw new db[(_0xc590('0x56'))][(_0xc590('0x79'))](_0xc590('0x72'));}return _0x2d1041['add'+_[_0xc590('0x73')](_0x2f76e3[_0xc590('0x49')][_0xc590('0x70')][_0xc590('0x74')]())+'Queues'](_0x2f76e3[_0xc590('0x49')][_0xc590('0x7a')]);}return null;})[_0xc590('0x3e')](handleEntityNotFound(_0xf52da4,null))['then'](respondWithStatusCode(_0xf52da4,null))[_0xc590('0x42')](handleError(_0xf52da4,null));};exports['removeQueues']=function(_0x5bd4e1,_0x5c7a99,_0x54a72a){return db[_0xc590('0x3c')]['findOne']({'where':{'id':_0x5bd4e1[_0xc590('0x52')]['id']}})[_0xc590('0x3e')](function(_0x3bf800){if(_0x3bf800){if(!_0x5bd4e1['query'][_0xc590('0x70')]||!utils[_0xc590('0x71')](_0x5bd4e1[_0xc590('0x2e')][_0xc590('0x70')])){throw new db[(_0xc590('0x56'))][(_0xc590('0x79'))]('Unknown\x20channel');}return _0x3bf800[_0xc590('0x7b')+_['capitalize'](_0x5bd4e1[_0xc590('0x2e')]['channel']['toLowerCase']())+_0xc590('0x77')](_0x5bd4e1[_0xc590('0x2e')][_0xc590('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x5c7a99,null))[_0xc590('0x3e')](respondWithStatusCode(_0x5c7a99,null))['catch'](handleError(_0x5c7a99,null));};exports[_0xc590('0x7c')]=function(_0x381355,_0x4d1457){var _0x18ff89=_[_0xc590('0x7d')](_0x381355[_0xc590('0x49')][_0xc590('0x7a')])?_0x381355['body'][_0xc590('0x7a')]:[_0x381355[_0xc590('0x49')]['ids']];var _0x80a9af=_0x381355[_0xc590('0x52')]['id'];return db[_0xc590('0x3c')][_0xc590('0x47')]({'where':{'id':_0x80a9af}})[_0xc590('0x3e')](handleEntityNotFound(_0x4d1457,null))['then'](function(_0x3d86d3){if(_0x3d86d3){var _0x55de1c=[_0xc590('0x7e'),'Chat',_0xc590('0x7f'),'Sms',_0xc590('0x80'),_0xc590('0x81'),_0xc590('0x82')];return db['sequelize'][_0xc590('0x54')](function(_0xa19e99){var _0x3735e5=_['map'](_0x55de1c,function(_0x498143){var _0x9669c8={'attributes':['id',_0xc590('0x28')]};if(_0x498143===_0xc590('0x7e')){_0x9669c8['through']={'attributes':['penalty']};}return _0x3d86d3[_0xc590('0x76')+_0x498143+_0xc590('0x77')](_0x9669c8)[_0xc590('0x3e')](function(_0x245d91){var _0x2b42ec=_[_0xc590('0x2a')](_0x245d91,function(_0x40ade6){var _0x4de604=_[_0xc590('0x2a')](_0x18ff89,function(_0x2611b1){var _0x2103b5={'where':{'UserId':_0x2611b1,[_0x498143+_0xc590('0x83')]:_0x40ade6['id']},'transaction':_0xa19e99};if(_0x498143===_0xc590('0x7e')){_0x2103b5[_0xc590('0x19')]={'penalty':_0x40ade6[_0xc590('0x84')][_0xc590('0x85')]};}return db[_0xc590('0x86')+_0x498143+_0xc590('0x75')]['findOrCreate'](_0x2103b5)[_0xc590('0x3e')](function(){socket['emit'](_0xc590('0x4a')+_0x498143+_0xc590('0x87'),{'UserId':_0x2611b1,[_0x498143+'QueueId']:_0x40ade6['id']});if(_0x498143!==_0xc590('0x7e')){return;}return db['User'][_0xc590('0x41')]({'where':{'id':_0x18ff89,'online':0x1},'attributes':['id','name',_0xc590('0x88'),_0xc590('0x89'),'interface'],'raw':!![]})[_0xc590('0x3e')](function(_0x3abcae){var _0x4ed753=_[_0xc590('0x2a')](_0x3abcae,function(_0x83538d){return db['UserVoiceQueueRt'][_0xc590('0x8a')]({'membername':_0x83538d[_0xc590('0x28')],'UserId':_0x83538d['id'],'queue_name':_0x40ade6[_0xc590('0x28')],'VoiceQueueId':_0x40ade6['id'],'interface':_['isNil'](_0x83538d['interface'])?util[_0xc590('0x8b')](_0xc590('0x8c'),_0x83538d['name']):_0x83538d[_0xc590('0x8d')],'paused':_0x83538d[_0xc590('0x89')]||![],'penalty':_0x40ade6[_0xc590('0x84')][_0xc590('0x85')]},{'transaction':_0xa19e99});});return Promise[_0xc590('0x8e')](_0x4ed753);});});});return Promise['all'](_0x4de604);});return Promise[_0xc590('0x8e')](_0x2b42ec);})['then'](function(){return db[_0xc590('0x6b')][_0xc590('0x6f')]({'where':{'teamId':_0x80a9af}})[_0xc590('0x3e')](function(_0x494aeb){if(_0x494aeb){var _0xfd56d3=_[_0xc590('0x2a')](_0x18ff89,function(_0x4755df){db['UserVoicePrefix'][_0xc590('0x8a')]({'UserId':_0x4755df,'VoicePrefixId':_0x494aeb[_0xc590('0x6d')]});});return Promise[_0xc590('0x8e')](_0xfd56d3);}});});});return Promise[_0xc590('0x8e')](_0x3735e5)[_0xc590('0x3e')](function(){return _0x3d86d3[_0xc590('0x7c')](_0x18ff89,{'transaction':_0xa19e99})[_0xc590('0x8f')](function(_0x2d71f1){return _0x2d71f1;});});});}})[_0xc590('0x3e')](respondWithResult(_0x4d1457,null))[_0xc590('0x42')](handleError(_0x4d1457,null));};exports[_0xc590('0x90')]=function(_0x811163,_0x112e23){var _0x3129a4=_['isArray'](_0x811163[_0xc590('0x2e')][_0xc590('0x7a')])?_0x811163['query'][_0xc590('0x7a')]:[_0x811163[_0xc590('0x2e')]['ids']];var _0x395cf2=_0x811163[_0xc590('0x52')]['id'];return db[_0xc590('0x3c')][_0xc590('0x47')]({'where':{'id':_0x395cf2}})['then'](handleEntityNotFound(_0x112e23,null))['then'](function(_0x9ecd6c){if(_0x9ecd6c){var _0x490b65=[_0xc590('0x7e'),'Chat',_0xc590('0x7f'),'Sms',_0xc590('0x80'),_0xc590('0x81'),_0xc590('0x82')];return db['sequelize']['transaction'](function(_0x2aed41){var _0x40d924=_[_0xc590('0x2a')](_0x490b65,function(_0x4f3e05){var _0x582bc7={'attributes':['id',_0xc590('0x28')]};return _0x9ecd6c['get'+_0x4f3e05+_0xc590('0x77')](_0x582bc7)[_0xc590('0x3e')](function(_0x5bed29){var _0x1e0a78=_[_0xc590('0x2a')](_0x5bed29,function(_0x40c3e3){return _0x40c3e3[_0xc590('0x90')](_0x3129a4,{'transaction':_0x2aed41})[_0xc590('0x3e')](function(){var _0x8c2de=_['map'](_0x3129a4,function(_0x506d3e){socket['emit'](_0xc590('0x4a')+_0x4f3e05+_0xc590('0x91'),{'UserId':Number(_0x506d3e),[_0x4f3e05+_0xc590('0x83')]:_0x40c3e3['id']});if(_0x4f3e05!==_0xc590('0x7e')){return;}return db[_0xc590('0x92')][_0xc590('0x51')]({'where':{'VoiceQueueId':_0x40c3e3['id'],'UserId':_0x506d3e},'transaction':_0x2aed41});});return Promise[_0xc590('0x8e')](_0x8c2de);});});return Promise[_0xc590('0x8e')](_0x1e0a78);});});return Promise['all'](_0x40d924)[_0xc590('0x3e')](function(){return _0x9ecd6c[_0xc590('0x90')](_0x3129a4,{'transaction':_0x2aed41});})[_0xc590('0x3e')](function(){return db[_0xc590('0x6b')][_0xc590('0x6f')]({'where':{'teamId':_0x395cf2}})[_0xc590('0x3e')](function(_0x51a33f){if(_0x51a33f){var _0x5b9d44=_[_0xc590('0x2a')](_0x3129a4,function(_0x4dd8d6){db[_0xc590('0x6c')][_0xc590('0x51')]({'where':{'UserId':_0x4dd8d6,'VoicePrefixId':_0x51a33f['VoicePrefixId']}});});return Promise[_0xc590('0x8e')](_0x5b9d44);}});});});}})[_0xc590('0x3e')](respondWithStatusCode(_0x112e23,null))[_0xc590('0x42')](handleError(_0x112e23,null));};exports[_0xc590('0x93')]=function(_0x534d61,_0xb13392,_0x86890e){var _0x3c19f0={};var _0xe72274={};var _0x1f0987;var _0xa47262;return db[_0xc590('0x3c')]['findOne']({'where':{'id':_0x534d61['params']['id']}})[_0xc590('0x3e')](handleEntityNotFound(_0xb13392,null))[_0xc590('0x3e')](function(_0xad7653){if(_0xad7653){_0x1f0987=_0xad7653;_0xe72274[_0xc590('0x30')]=_[_0xc590('0x44')](db[_0xc590('0x86')][_0xc590('0x45')]);_0xe72274[_0xc590('0x2e')]=_[_0xc590('0x44')](_0x534d61[_0xc590('0x2e')]);_0xe72274['filters']=_[_0xc590('0x2f')](_0xe72274[_0xc590('0x30')],_0xe72274[_0xc590('0x2e')]);_0x3c19f0[_0xc590('0x31')]=_[_0xc590('0x2f')](_0xe72274['model'],qs[_0xc590('0x32')](_0x534d61[_0xc590('0x2e')][_0xc590('0x32')]));_0x3c19f0[_0xc590('0x31')]=_0x3c19f0['attributes'][_0xc590('0x33')]?_0x3c19f0[_0xc590('0x31')]:_0xe72274[_0xc590('0x30')];_0x3c19f0[_0xc590('0x94')]=qs[_0xc590('0x35')](_0x534d61['query'][_0xc590('0x35')]);_0x3c19f0[_0xc590('0x36')]=qs[_0xc590('0x37')](_[_0xc590('0x38')](_0x534d61[_0xc590('0x2e')],_0xe72274[_0xc590('0x37')]));if(_0x534d61[_0xc590('0x2e')][_0xc590('0x39')]){_0x3c19f0[_0xc590('0x36')]=_[_0xc590('0x3b')](_0x3c19f0[_0xc590('0x36')],{'$or':_[_0xc590('0x2a')](_0x3c19f0[_0xc590('0x31')],function(_0x165629){var _0x22dde1={};_0x22dde1[_0x165629]={'$like':'%'+_0x534d61[_0xc590('0x2e')][_0xc590('0x39')]+'%'};return _0x22dde1;})});}_0x3c19f0=_['merge']({},_0x3c19f0,_0x534d61[_0xc590('0x46')]);return _0x1f0987[_0xc590('0x93')](_0x3c19f0);}})[_0xc590('0x3e')](function(_0x4f4e5a){if(_0x4f4e5a){_0xa47262=_0x4f4e5a[_0xc590('0x33')];if(!_0x534d61[_0xc590('0x2e')][_0xc590('0x34')](_0xc590('0x95'))){_0x3c19f0[_0xc590('0x22')]=qs[_0xc590('0x22')](_0x534d61[_0xc590('0x2e')][_0xc590('0x22')]);_0x3c19f0[_0xc590('0x21')]=qs[_0xc590('0x21')](_0x534d61[_0xc590('0x2e')][_0xc590('0x21')]);}return _0x1f0987[_0xc590('0x93')](_0x3c19f0);}})[_0xc590('0x3e')](function(_0x22a7ea){if(_0x22a7ea){return _0x22a7ea?{'count':_0xa47262,'rows':_0x22a7ea}:null;}})[_0xc590('0x3e')](respondWithResult(_0xb13392,null))[_0xc590('0x42')](handleError(_0xb13392,null));}; \ No newline at end of file +var _0x103c=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','index','map','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SmsQueueId','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','channel','Unknown\x20channel','capitalize','toLowerCase','rawAttributes','pick','Queues','addQueues','findOne','isValidChannel','ValidationError','add','ids','remove','isArray','Chat','Mail','Fax','Openchannel','Whatsapp','Voice','through','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','all','upsert','addAgents','spread','removeAgents','Queue:remove','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','./team.socket','sendStatus','status'];(function(_0x48988b,_0x26bc0e){var _0xdda4a8=function(_0x3ecd32){while(--_0x3ecd32){_0x48988b['push'](_0x48988b['shift']());}};_0xdda4a8(++_0x26bc0e);}(_0x103c,0x1a2));var _0xc103=function(_0x511217,_0x43f18e){_0x511217=_0x511217-0x0;var _0x1879c6=_0x103c[_0x511217];return _0x1879c6;};'use strict';var emlformat=require(_0xc103('0x0'));var rimraf=require(_0xc103('0x1'));var zipdir=require(_0xc103('0x2'));var jsonpatch=require(_0xc103('0x3'));var rp=require('request-promise');var moment=require(_0xc103('0x4'));var BPromise=require(_0xc103('0x5'));var Mustache=require(_0xc103('0x6'));var util=require(_0xc103('0x7'));var path=require(_0xc103('0x8'));var sox=require(_0xc103('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc103('0xa'));var _=require(_0xc103('0xb'));var squel=require(_0xc103('0xc'));var crypto=require('crypto');var jsforce=require(_0xc103('0xd'));var deskjs=require(_0xc103('0xe'));var toCsv=require(_0xc103('0xf'));var querystring=require('querystring');var Papa=require(_0xc103('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc103('0x11'));var as=require(_0xc103('0x12'));var hardwareService=require(_0xc103('0x13'));var logger=require(_0xc103('0x14'))(_0xc103('0x15'));var utils=require(_0xc103('0x16'));var config=require(_0xc103('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xc103('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc103('0x19'))(new Redis(config['redis']));require(_0xc103('0x1a'))['register'](socket);function respondWithStatusCode(_0x1bcb5b,_0x31ef88){_0x31ef88=_0x31ef88||0xcc;return function(_0xcde114){if(_0xcde114){return _0x1bcb5b[_0xc103('0x1b')](_0x31ef88);}return _0x1bcb5b[_0xc103('0x1c')](_0x31ef88)[_0xc103('0x1d')]();};}function respondWithResult(_0x4fde7f,_0x1087a7){_0x1087a7=_0x1087a7||0xc8;return function(_0x10f5b0){if(_0x10f5b0){return _0x4fde7f[_0xc103('0x1c')](_0x1087a7)[_0xc103('0x1e')](_0x10f5b0);}};}function respondWithFilteredResult(_0x3c0c59,_0x52a38f){return function(_0x3773a3){if(_0x3773a3){var _0x22d726=typeof _0x52a38f[_0xc103('0x1f')]===_0xc103('0x20')&&typeof _0x52a38f[_0xc103('0x21')]===_0xc103('0x20');var _0x4212cb=_0x3773a3[_0xc103('0x22')];var _0x57241e=_0x22d726?0x0:_0x52a38f[_0xc103('0x1f')];var _0x42f250=_0x22d726?_0x3773a3[_0xc103('0x22')]:_0x52a38f[_0xc103('0x1f')]+_0x52a38f[_0xc103('0x21')];var _0x4096d0;if(_0x42f250>=_0x4212cb){_0x42f250=_0x4212cb;_0x4096d0=0xc8;}else{_0x4096d0=0xce;}_0x3c0c59[_0xc103('0x1c')](_0x4096d0);return _0x3c0c59[_0xc103('0x23')](_0xc103('0x24'),_0x57241e+'-'+_0x42f250+'/'+_0x4212cb)[_0xc103('0x1e')](_0x3773a3);}return null;};}function patchUpdates(_0x586ea8){return function(_0x46edf2){try{jsonpatch[_0xc103('0x25')](_0x46edf2,_0x586ea8,!![]);}catch(_0x14577f){return BPromise[_0xc103('0x26')](_0x14577f);}return _0x46edf2['save']();};}function saveUpdates(_0x1bbf60,_0x5891a8){return function(_0x10af53){if(_0x10af53){return _0x10af53[_0xc103('0x27')](_0x1bbf60)[_0xc103('0x28')](function(_0x31b151){return _0x31b151;});}return null;};}function handleEntityNotFound(_0x4f6bbc,_0x1c3436){return function(_0x5a63cf){if(!_0x5a63cf){_0x4f6bbc[_0xc103('0x1b')](0x194);}return _0x5a63cf;};}function handleError(_0x257d88,_0x3729c1){_0x3729c1=_0x3729c1||0x1f4;return function(_0x41e75f){logger['error'](_0x41e75f['stack']);if(_0x41e75f['name']){delete _0x41e75f['name'];}_0x257d88['status'](_0x3729c1)['send'](_0x41e75f);};}exports[_0xc103('0x29')]=function(_0x1fe4b1,_0x15ad75){var _0x1c9369={},_0x5b3306={},_0x2262b6={'count':0x0,'rows':[]};var _0x51e84e=_[_0xc103('0x2a')](db['Team']['rawAttributes'],function(_0x3e83ff){return{'name':_0x3e83ff[_0xc103('0x2b')],'type':_0x3e83ff[_0xc103('0x2c')][_0xc103('0x2d')]};});_0x5b3306['model']=_['map'](_0x51e84e,_0xc103('0x2e'));_0x5b3306[_0xc103('0x2f')]=_[_0xc103('0x30')](_0x1fe4b1[_0xc103('0x2f')]);_0x5b3306[_0xc103('0x31')]=_[_0xc103('0x32')](_0x5b3306[_0xc103('0x33')],_0x5b3306[_0xc103('0x2f')]);_0x1c9369['attributes']=_[_0xc103('0x32')](_0x5b3306[_0xc103('0x33')],qs[_0xc103('0x34')](_0x1fe4b1[_0xc103('0x2f')]['fields']));_0x1c9369[_0xc103('0x35')]=_0x1c9369[_0xc103('0x35')][_0xc103('0x36')]?_0x1c9369[_0xc103('0x35')]:_0x5b3306[_0xc103('0x33')];if(!_0x1fe4b1[_0xc103('0x2f')]['hasOwnProperty']('nolimit')){_0x1c9369['limit']=qs['limit'](_0x1fe4b1['query'][_0xc103('0x21')]);_0x1c9369[_0xc103('0x1f')]=qs[_0xc103('0x1f')](_0x1fe4b1['query'][_0xc103('0x1f')]);}_0x1c9369[_0xc103('0x37')]=qs[_0xc103('0x38')](_0x1fe4b1[_0xc103('0x2f')][_0xc103('0x38')]);_0x1c9369[_0xc103('0x39')]=qs['filters'](_['pick'](_0x1fe4b1[_0xc103('0x2f')],_0x5b3306[_0xc103('0x31')]),_0x51e84e);if(_0x1fe4b1['query'][_0xc103('0x3a')]){_0x1c9369[_0xc103('0x39')]=_[_0xc103('0x3b')](_0x1c9369[_0xc103('0x39')],{'$or':_[_0xc103('0x2a')](_0x51e84e,function(_0x2f5241){if(_0x2f5241[_0xc103('0x2c')]!==_0xc103('0x3c')){var _0x20d988={};_0x20d988[_0x2f5241[_0xc103('0x2e')]]={'$like':'%'+_0x1fe4b1['query'][_0xc103('0x3a')]+'%'};return _0x20d988;}})});}_0x1c9369=_[_0xc103('0x3b')]({},_0x1c9369,_0x1fe4b1[_0xc103('0x3d')]);var _0x1c7bb2={'where':_0x1c9369[_0xc103('0x39')]};return db[_0xc103('0x3e')][_0xc103('0x22')](_0x1c7bb2)[_0xc103('0x28')](function(_0x3ea2da){_0x2262b6[_0xc103('0x22')]=_0x3ea2da;if(_0x1fe4b1[_0xc103('0x2f')][_0xc103('0x3f')]){_0x1c9369[_0xc103('0x40')]=[{'all':!![]}];}return db[_0xc103('0x3e')][_0xc103('0x41')](_0x1c9369);})[_0xc103('0x28')](function(_0x43df05){_0x2262b6[_0xc103('0x42')]=_0x43df05;return _0x2262b6;})[_0xc103('0x28')](respondWithFilteredResult(_0x15ad75,_0x1c9369))[_0xc103('0x43')](handleError(_0x15ad75,null));};exports[_0xc103('0x44')]=function(_0x331ba6,_0x4cfd66){var _0x5bf43f={'raw':![],'where':{'id':_0x331ba6[_0xc103('0x45')]['id']}},_0x564169={};_0x564169[_0xc103('0x33')]=_[_0xc103('0x30')](db['Team']['rawAttributes']);_0x564169[_0xc103('0x2f')]=_[_0xc103('0x30')](_0x331ba6[_0xc103('0x2f')]);_0x564169[_0xc103('0x31')]=_[_0xc103('0x32')](_0x564169[_0xc103('0x33')],_0x564169[_0xc103('0x2f')]);_0x5bf43f[_0xc103('0x35')]=_['intersection'](_0x564169[_0xc103('0x33')],qs[_0xc103('0x34')](_0x331ba6[_0xc103('0x2f')][_0xc103('0x34')]));_0x5bf43f[_0xc103('0x35')]=_0x5bf43f[_0xc103('0x35')]['length']?_0x5bf43f[_0xc103('0x35')]:_0x564169['model'];if(_0x331ba6['query']['includeAll']){_0x5bf43f[_0xc103('0x40')]=[{'all':!![]}];}_0x5bf43f=_['merge']({},_0x5bf43f,_0x331ba6[_0xc103('0x3d')]);return db['Team'][_0xc103('0x46')](_0x5bf43f)[_0xc103('0x28')](handleEntityNotFound(_0x4cfd66,null))[_0xc103('0x28')](respondWithResult(_0x4cfd66,null))[_0xc103('0x43')](handleError(_0x4cfd66,null));};exports[_0xc103('0x47')]=function(_0x380c65,_0xb17da5){return db[_0xc103('0x3e')]['create'](_0x380c65[_0xc103('0x48')],{})[_0xc103('0x28')](function(_0x11ec34){var _0xd2b905=_0x380c65[_0xc103('0x49')][_0xc103('0x4a')]({'plain':!![]});if(!_0xd2b905)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd2b905['role']==='user'){var _0x2c143b=_0x11ec34[_0xc103('0x4a')]({'plain':!![]});var _0x5b2c12=_0xc103('0x4b');return db[_0xc103('0x4c')][_0xc103('0x46')]({'where':{'name':_0x5b2c12,'userProfileId':_0xd2b905[_0xc103('0x4d')]},'raw':!![]})[_0xc103('0x28')](function(_0x1a1638){if(_0x1a1638&&_0x1a1638[_0xc103('0x4e')]===0x0){return db[_0xc103('0x4f')][_0xc103('0x47')]({'name':_0x2c143b[_0xc103('0x2e')],'resourceId':_0x2c143b['id'],'type':_0x1a1638['name'],'sectionId':_0x1a1638['id']},{})[_0xc103('0x28')](function(){return _0x11ec34;});}else{return _0x11ec34;}})[_0xc103('0x43')](function(_0x66e3d){logger['error'](_0xc103('0x50'),_0x66e3d);throw _0x66e3d;});}return _0x11ec34;})[_0xc103('0x28')](respondWithResult(_0xb17da5,0xc9))[_0xc103('0x43')](handleError(_0xb17da5,null));};exports[_0xc103('0x27')]=function(_0x5a77b7,_0x219946){if(_0x5a77b7[_0xc103('0x48')]['id']){delete _0x5a77b7['body']['id'];}return db[_0xc103('0x3e')]['find']({'where':{'id':_0x5a77b7[_0xc103('0x45')]['id']}})[_0xc103('0x28')](handleEntityNotFound(_0x219946,null))[_0xc103('0x28')](saveUpdates(_0x5a77b7[_0xc103('0x48')],null))[_0xc103('0x28')](respondWithResult(_0x219946,null))['catch'](handleError(_0x219946,null));};exports[_0xc103('0x51')]=function(_0x2f90f5,_0x4a4f88){var _0x17d926=_0x2f90f5['params']['id'];var _0x1b0d2c=[];return db['sequelize'][_0xc103('0x52')](function(_0x3d3cce){var _0xe6a814=_0xc103('0x53')+_0x17d926;return db[_0xc103('0x54')][_0xc103('0x2f')](_0xe6a814,{'type':db[_0xc103('0x55')][_0xc103('0x56')][_0xc103('0x57')],'raw':!![],'transaction':_0x3d3cce})[_0xc103('0x28')](function(_0xdf9b19){_0x1b0d2c=_[_0xc103('0x2a')](_0xdf9b19,function(_0x3e086d){return Number(_0x3e086d[_0xc103('0x58')]);});})[_0xc103('0x28')](function(){var _0xde8b11=_0xc103('0x59')+_0x17d926;return db[_0xc103('0x54')][_0xc103('0x2f')](_0xde8b11,{'type':db[_0xc103('0x55')][_0xc103('0x56')]['SELECT'],'raw':!![],'transaction':_0x3d3cce});})[_0xc103('0x28')](function(_0x2aed92){var _0x370259=_['map'](_0x2aed92,function(_0x527c1c){return Number(_0x527c1c[_0xc103('0x5a')]);});return db[_0xc103('0x5b')][_0xc103('0x51')]({'where':{'UserId':{'$in':_0x1b0d2c},'VoiceQueueId':{'$in':_0x370259}},'transaction':_0x3d3cce});})[_0xc103('0x28')](function(){var _0x5eb38c='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17d926;return db[_0xc103('0x54')][_0xc103('0x2f')](_0x5eb38c,{'type':db['Sequelize'][_0xc103('0x56')]['SELECT'],'raw':!![],'transaction':_0x3d3cce});})[_0xc103('0x28')](function(_0x5a0912){var _0x1dff4b=_[_0xc103('0x2a')](_0x5a0912,function(_0x59debc){return Number(_0x59debc[_0xc103('0x5c')]);});return db[_0xc103('0x5d')][_0xc103('0x51')]({'where':{'UserId':{'$in':_0x1b0d2c},'MailQueueId':{'$in':_0x1dff4b}},'transaction':_0x3d3cce});})[_0xc103('0x28')](function(){var _0x97e468='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17d926;return db['sequelize'][_0xc103('0x2f')](_0x97e468,{'type':db[_0xc103('0x55')][_0xc103('0x56')][_0xc103('0x57')],'raw':!![],'transaction':_0x3d3cce});})['then'](function(_0x5064a4){var _0x377db4=_[_0xc103('0x2a')](_0x5064a4,function(_0xc1b8ec){return Number(_0xc1b8ec[_0xc103('0x5e')]);});return db['UserSmsQueue'][_0xc103('0x51')]({'where':{'UserId':{'$in':_0x1b0d2c},'SmsQueueId':{'$in':_0x377db4}},'transaction':_0x3d3cce});})[_0xc103('0x28')](function(){var _0x3b83dd='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17d926;return db[_0xc103('0x54')][_0xc103('0x2f')](_0x3b83dd,{'type':db[_0xc103('0x55')][_0xc103('0x56')][_0xc103('0x57')],'raw':!![],'transaction':_0x3d3cce});})[_0xc103('0x28')](function(_0x2f4cf6){var _0x349e0b=_[_0xc103('0x2a')](_0x2f4cf6,function(_0x2b2659){return Number(_0x2b2659[_0xc103('0x5f')]);});return db[_0xc103('0x60')][_0xc103('0x51')]({'where':{'UserId':{'$in':_0x1b0d2c},'ChatQueueId':{'$in':_0x349e0b}},'transaction':_0x3d3cce});})[_0xc103('0x28')](function(){var _0xb93ad4=_0xc103('0x61')+_0x17d926;return db[_0xc103('0x54')]['query'](_0xb93ad4,{'type':db[_0xc103('0x55')][_0xc103('0x56')]['SELECT'],'raw':!![],'transaction':_0x3d3cce});})[_0xc103('0x28')](function(_0x3d330c){var _0x3af86e=_[_0xc103('0x2a')](_0x3d330c,function(_0x4f3177){return Number(_0x4f3177['FaxQueueId']);});return db[_0xc103('0x62')][_0xc103('0x51')]({'where':{'UserId':{'$in':_0x1b0d2c},'FaxQueueId':{'$in':_0x3af86e}},'transaction':_0x3d3cce});})[_0xc103('0x28')](function(){var _0xe040ec='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17d926;return db[_0xc103('0x54')]['query'](_0xe040ec,{'type':db[_0xc103('0x55')][_0xc103('0x56')][_0xc103('0x57')],'raw':!![],'transaction':_0x3d3cce});})[_0xc103('0x28')](function(_0x1235e0){var _0xbb1c59=_[_0xc103('0x2a')](_0x1235e0,function(_0x1c0fdd){return Number(_0x1c0fdd[_0xc103('0x63')]);});return db['UserOpenchannelQueue'][_0xc103('0x51')]({'where':{'UserId':{'$in':_0x1b0d2c},'OpenchannelQueueId':{'$in':_0xbb1c59}},'transaction':_0x3d3cce});})[_0xc103('0x28')](function(){var _0x5edacd=_0xc103('0x64')+_0x17d926;return db['sequelize'][_0xc103('0x2f')](_0x5edacd,{'type':db[_0xc103('0x55')]['QueryTypes'][_0xc103('0x57')],'raw':!![],'transaction':_0x3d3cce});})['then'](function(_0x321847){var _0x59fd82=_[_0xc103('0x2a')](_0x321847,function(_0x34d7d9){return Number(_0x34d7d9[_0xc103('0x65')]);});return db[_0xc103('0x66')][_0xc103('0x51')]({'where':{'UserId':{'$in':_0x1b0d2c},'WhatsappQueueId':{'$in':_0x59fd82}},'transaction':_0x3d3cce});})[_0xc103('0x28')](function(){return db[_0xc103('0x67')][_0xc103('0x46')]({'where':{'TeamId':_0x17d926}});})['then'](function(_0x4c3698){if(_0x4c3698===null){return;}return db[_0xc103('0x68')][_0xc103('0x51')]({'where':{'UserId':{'$in':_0x1b0d2c},'VoicePrefixId':_0x4c3698[_0xc103('0x69')]},'transaction':_0x3d3cce});})['then'](function(){return db['Team'][_0xc103('0x51')]({'where':{'id':_0x17d926},'cascade':!![],'transaction':_0x3d3cce});})[_0xc103('0x28')](function(_0x1d9dd3){if(_0x1d9dd3===0x0){_0x4a4f88[_0xc103('0x1b')](0x194);}else{return db[_0xc103('0x4f')][_0xc103('0x51')]({'where':{'type':_0xc103('0x4b'),'resourceId':_0x17d926},'cascade':!![],'transaction':_0x3d3cce})[_0xc103('0x28')](function(){_0x4a4f88[_0xc103('0x1c')](0xcc)[_0xc103('0x1d')]();});}})[_0xc103('0x43')](function(_0x56712e){_0x4a4f88[_0xc103('0x1c')](0x1f4)[_0xc103('0x6a')](_0x56712e);});});};exports['getQueues']=function(_0x10b1a5,_0x1a2dcf,_0x1e71cc){return db[_0xc103('0x3e')]['findOne']({'where':{'id':_0x10b1a5[_0xc103('0x45')]['id']}})[_0xc103('0x28')](handleEntityNotFound(_0x1a2dcf,null))[_0xc103('0x28')](function(_0x4a6bb0){if(!_0x10b1a5['query']['channel']||!utils['isValidChannel'](_0x10b1a5[_0xc103('0x2f')][_0xc103('0x6b')])){throw new db[(_0xc103('0x55'))]['ValidationError'](_0xc103('0x6c'));}var _0x3562f2={};var _0x48c417={};_0x48c417[_0xc103('0x33')]=_[_0xc103('0x30')](db[_[_0xc103('0x6d')](_0x10b1a5['query']['channel'][_0xc103('0x6e')]())+'Queue'][_0xc103('0x6f')]);_0x48c417['query']=_[_0xc103('0x30')](_0x10b1a5[_0xc103('0x2f')]);_0x48c417[_0xc103('0x31')]=_['intersection'](_0x48c417[_0xc103('0x33')],_0x48c417[_0xc103('0x2f')]);_0x3562f2['attributes']=_['intersection'](_0x48c417[_0xc103('0x33')],qs[_0xc103('0x34')](_0x10b1a5[_0xc103('0x2f')][_0xc103('0x34')]));_0x3562f2[_0xc103('0x35')]=_0x3562f2[_0xc103('0x35')][_0xc103('0x36')]?_0x3562f2[_0xc103('0x35')]:_0x48c417['model'];_0x3562f2[_0xc103('0x21')]=qs[_0xc103('0x21')](_0x10b1a5[_0xc103('0x2f')]['limit']);_0x3562f2[_0xc103('0x1f')]=qs[_0xc103('0x1f')](_0x10b1a5[_0xc103('0x2f')][_0xc103('0x1f')]);_0x3562f2[_0xc103('0x37')]=qs[_0xc103('0x38')](_0x10b1a5[_0xc103('0x2f')][_0xc103('0x38')]);_0x3562f2[_0xc103('0x39')]=qs[_0xc103('0x31')](_[_0xc103('0x70')](_0x10b1a5['query'],_0x48c417[_0xc103('0x31')]));_0x3562f2=_['merge']({},_0x3562f2,_0x10b1a5[_0xc103('0x3d')]);return _0x4a6bb0[_0xc103('0x4a')+_[_0xc103('0x6d')](_0x10b1a5[_0xc103('0x2f')]['channel']['toLowerCase']())+_0xc103('0x71')](_0x3562f2);})['then'](respondWithResult(_0x1a2dcf,null))[_0xc103('0x43')](handleError(_0x1a2dcf,null));};exports[_0xc103('0x72')]=function(_0x11e922,_0x58938f,_0x48bb3a){return db[_0xc103('0x3e')][_0xc103('0x73')]({'where':{'id':_0x11e922['params']['id']}})['then'](function(_0x49c654){if(_0x49c654){if(!_0x11e922[_0xc103('0x48')][_0xc103('0x6b')]||!utils[_0xc103('0x74')](_0x11e922['body'][_0xc103('0x6b')])){throw new db[(_0xc103('0x55'))][(_0xc103('0x75'))](_0xc103('0x6c'));}return _0x49c654[_0xc103('0x76')+_[_0xc103('0x6d')](_0x11e922[_0xc103('0x48')][_0xc103('0x6b')][_0xc103('0x6e')]())+'Queues'](_0x11e922[_0xc103('0x48')][_0xc103('0x77')]);}return null;})[_0xc103('0x28')](handleEntityNotFound(_0x58938f,null))[_0xc103('0x28')](respondWithStatusCode(_0x58938f,null))[_0xc103('0x43')](handleError(_0x58938f,null));};exports['removeQueues']=function(_0x5ac6e6,_0x4f1ad0,_0x32f49d){return db[_0xc103('0x3e')]['findOne']({'where':{'id':_0x5ac6e6[_0xc103('0x45')]['id']}})[_0xc103('0x28')](function(_0xe0d410){if(_0xe0d410){if(!_0x5ac6e6[_0xc103('0x2f')]['channel']||!utils[_0xc103('0x74')](_0x5ac6e6[_0xc103('0x2f')][_0xc103('0x6b')])){throw new db[(_0xc103('0x55'))][(_0xc103('0x75'))]('Unknown\x20channel');}return _0xe0d410[_0xc103('0x78')+_[_0xc103('0x6d')](_0x5ac6e6['query']['channel'][_0xc103('0x6e')]())+_0xc103('0x71')](_0x5ac6e6[_0xc103('0x2f')][_0xc103('0x77')]);}return null;})['then'](handleEntityNotFound(_0x4f1ad0,null))[_0xc103('0x28')](respondWithStatusCode(_0x4f1ad0,null))[_0xc103('0x43')](handleError(_0x4f1ad0,null));};exports['addAgents']=function(_0x46111e,_0x2e9cef){var _0x39a1d1=_[_0xc103('0x79')](_0x46111e[_0xc103('0x48')]['ids'])?_0x46111e[_0xc103('0x48')][_0xc103('0x77')]:[_0x46111e[_0xc103('0x48')][_0xc103('0x77')]];var _0x3a92a8=_0x46111e['params']['id'];return db[_0xc103('0x3e')][_0xc103('0x46')]({'where':{'id':_0x3a92a8}})[_0xc103('0x28')](handleEntityNotFound(_0x2e9cef,null))['then'](function(_0x353efd){if(_0x353efd){var _0x583310=['Voice',_0xc103('0x7a'),_0xc103('0x7b'),'Sms',_0xc103('0x7c'),_0xc103('0x7d'),_0xc103('0x7e')];return db[_0xc103('0x54')][_0xc103('0x52')](function(_0x46b836){var _0x41de35=_[_0xc103('0x2a')](_0x583310,function(_0x24925a){var _0xd68254={'attributes':['id',_0xc103('0x2e')]};if(_0x24925a===_0xc103('0x7f')){_0xd68254[_0xc103('0x80')]={'attributes':['penalty']};}return _0x353efd[_0xc103('0x4a')+_0x24925a+_0xc103('0x71')](_0xd68254)[_0xc103('0x28')](function(_0x1912e8){var _0x251483=_[_0xc103('0x2a')](_0x1912e8,function(_0x480b6e){var _0x5ec088=_[_0xc103('0x2a')](_0x39a1d1,function(_0x417c32){var _0x5ee800={'where':{'UserId':_0x417c32,[_0x24925a+_0xc103('0x81')]:_0x480b6e['id']},'transaction':_0x46b836};if(_0x24925a===_0xc103('0x7f')){_0x5ee800['defaults']={'penalty':_0x480b6e[_0xc103('0x82')]['penalty']};}return db[_0xc103('0x83')+_0x24925a+_0xc103('0x84')][_0xc103('0x85')](_0x5ee800)[_0xc103('0x28')](function(){socket[_0xc103('0x86')](_0xc103('0x49')+_0x24925a+_0xc103('0x87'),{'UserId':_0x417c32,[_0x24925a+_0xc103('0x81')]:_0x480b6e['id']});if(_0x24925a!==_0xc103('0x7f')){return;}return db['User'][_0xc103('0x41')]({'where':{'id':_0x39a1d1,'online':0x1},'attributes':['id','name',_0xc103('0x88'),_0xc103('0x89'),_0xc103('0x8a')],'raw':!![]})['then'](function(_0x133e60){var _0x45c644=_[_0xc103('0x2a')](_0x133e60,function(_0x136cea){return db[_0xc103('0x8b')]['upsert']({'membername':_0x136cea[_0xc103('0x2e')],'UserId':_0x136cea['id'],'queue_name':_0x480b6e[_0xc103('0x2e')],'VoiceQueueId':_0x480b6e['id'],'interface':_['isNil'](_0x136cea[_0xc103('0x8a')])?util['format']('SIP/%s',_0x136cea[_0xc103('0x2e')]):_0x136cea[_0xc103('0x8a')],'paused':_0x136cea['voicePause']||![],'penalty':_0x480b6e[_0xc103('0x82')]['penalty']},{'transaction':_0x46b836});});return Promise[_0xc103('0x8c')](_0x45c644);});});});return Promise['all'](_0x5ec088);});return Promise[_0xc103('0x8c')](_0x251483);})[_0xc103('0x28')](function(){return db[_0xc103('0x67')][_0xc103('0x73')]({'where':{'teamId':_0x3a92a8}})[_0xc103('0x28')](function(_0x2cd47c){if(_0x2cd47c){var _0x235d55=_['map'](_0x39a1d1,function(_0x3122ce){db['UserVoicePrefix'][_0xc103('0x8d')]({'UserId':_0x3122ce,'VoicePrefixId':_0x2cd47c[_0xc103('0x69')]});});return Promise[_0xc103('0x8c')](_0x235d55);}});});});return Promise['all'](_0x41de35)[_0xc103('0x28')](function(){return _0x353efd[_0xc103('0x8e')](_0x39a1d1,{'transaction':_0x46b836})[_0xc103('0x8f')](function(_0x1c9e79){return _0x1c9e79;});});});}})['then'](respondWithResult(_0x2e9cef,null))['catch'](handleError(_0x2e9cef,null));};exports[_0xc103('0x90')]=function(_0x3fa6ce,_0x3134cf){var _0x33f967=_[_0xc103('0x79')](_0x3fa6ce[_0xc103('0x2f')][_0xc103('0x77')])?_0x3fa6ce[_0xc103('0x2f')][_0xc103('0x77')]:[_0x3fa6ce[_0xc103('0x2f')][_0xc103('0x77')]];var _0x4de180=_0x3fa6ce['params']['id'];return db[_0xc103('0x3e')][_0xc103('0x46')]({'where':{'id':_0x4de180}})[_0xc103('0x28')](handleEntityNotFound(_0x3134cf,null))[_0xc103('0x28')](function(_0x428944){if(_0x428944){var _0x96d1bb=[_0xc103('0x7f'),_0xc103('0x7a'),_0xc103('0x7b'),'Sms','Fax',_0xc103('0x7d'),_0xc103('0x7e')];return db[_0xc103('0x54')][_0xc103('0x52')](function(_0x2e6967){var _0x359eda=_['map'](_0x96d1bb,function(_0x43df6a){var _0x108ad4={'attributes':['id','name']};return _0x428944[_0xc103('0x4a')+_0x43df6a+'Queues'](_0x108ad4)['then'](function(_0x38bc4c){var _0x46cc44=_[_0xc103('0x2a')](_0x38bc4c,function(_0x28d218){return _0x28d218[_0xc103('0x90')](_0x33f967,{'transaction':_0x2e6967})['then'](function(){var _0x34e013=_[_0xc103('0x2a')](_0x33f967,function(_0x124d72){socket[_0xc103('0x86')]('user'+_0x43df6a+_0xc103('0x91'),{'UserId':Number(_0x124d72),[_0x43df6a+_0xc103('0x81')]:_0x28d218['id']});if(_0x43df6a!==_0xc103('0x7f')){return;}return db['UserVoiceQueueRt'][_0xc103('0x51')]({'where':{'VoiceQueueId':_0x28d218['id'],'UserId':_0x124d72},'transaction':_0x2e6967});});return Promise[_0xc103('0x8c')](_0x34e013);});});return Promise[_0xc103('0x8c')](_0x46cc44);});});return Promise[_0xc103('0x8c')](_0x359eda)[_0xc103('0x28')](function(){return _0x428944[_0xc103('0x90')](_0x33f967,{'transaction':_0x2e6967});})['then'](function(){return db[_0xc103('0x67')]['findOne']({'where':{'teamId':_0x4de180}})[_0xc103('0x28')](function(_0x272c2d){if(_0x272c2d){var _0x32ec4b=_['map'](_0x33f967,function(_0x3195e2){db[_0xc103('0x68')][_0xc103('0x51')]({'where':{'UserId':_0x3195e2,'VoicePrefixId':_0x272c2d[_0xc103('0x69')]}});});return Promise[_0xc103('0x8c')](_0x32ec4b);}});});});}})[_0xc103('0x28')](respondWithStatusCode(_0x3134cf,null))[_0xc103('0x43')](handleError(_0x3134cf,null));};exports[_0xc103('0x92')]=function(_0x5a3b31,_0x2f1a5c,_0xd84a0e){var _0x432ec5={};var _0x4dac89={};var _0x19a4bb;var _0x5216e0;return db[_0xc103('0x3e')][_0xc103('0x73')]({'where':{'id':_0x5a3b31['params']['id']}})[_0xc103('0x28')](handleEntityNotFound(_0x2f1a5c,null))[_0xc103('0x28')](function(_0x338202){if(_0x338202){_0x19a4bb=_0x338202;_0x4dac89[_0xc103('0x33')]=_[_0xc103('0x30')](db[_0xc103('0x83')][_0xc103('0x6f')]);_0x4dac89[_0xc103('0x2f')]=_[_0xc103('0x30')](_0x5a3b31[_0xc103('0x2f')]);_0x4dac89[_0xc103('0x31')]=_['intersection'](_0x4dac89[_0xc103('0x33')],_0x4dac89[_0xc103('0x2f')]);_0x432ec5[_0xc103('0x35')]=_['intersection'](_0x4dac89['model'],qs[_0xc103('0x34')](_0x5a3b31[_0xc103('0x2f')]['fields']));_0x432ec5[_0xc103('0x35')]=_0x432ec5['attributes'][_0xc103('0x36')]?_0x432ec5[_0xc103('0x35')]:_0x4dac89[_0xc103('0x33')];_0x432ec5[_0xc103('0x37')]=qs['sort'](_0x5a3b31[_0xc103('0x2f')][_0xc103('0x38')]);_0x432ec5[_0xc103('0x39')]=qs[_0xc103('0x31')](_['pick'](_0x5a3b31['query'],_0x4dac89[_0xc103('0x31')]));if(_0x5a3b31[_0xc103('0x2f')]['filter']){_0x432ec5[_0xc103('0x39')]=_[_0xc103('0x3b')](_0x432ec5[_0xc103('0x39')],{'$or':_[_0xc103('0x2a')](_0x432ec5[_0xc103('0x35')],function(_0x1841b8){var _0x526e41={};_0x526e41[_0x1841b8]={'$like':'%'+_0x5a3b31[_0xc103('0x2f')][_0xc103('0x3a')]+'%'};return _0x526e41;})});}_0x432ec5=_['merge']({},_0x432ec5,_0x5a3b31[_0xc103('0x3d')]);return _0x19a4bb[_0xc103('0x92')](_0x432ec5);}})[_0xc103('0x28')](function(_0x19eb21){if(_0x19eb21){_0x5216e0=_0x19eb21['length'];if(!_0x5a3b31[_0xc103('0x2f')][_0xc103('0x93')](_0xc103('0x94'))){_0x432ec5[_0xc103('0x21')]=qs[_0xc103('0x21')](_0x5a3b31[_0xc103('0x2f')][_0xc103('0x21')]);_0x432ec5[_0xc103('0x1f')]=qs[_0xc103('0x1f')](_0x5a3b31[_0xc103('0x2f')][_0xc103('0x1f')]);}return _0x19a4bb[_0xc103('0x92')](_0x432ec5);}})[_0xc103('0x28')](function(_0x165371){if(_0x165371){return _0x165371?{'count':_0x5216e0,'rows':_0x165371}:null;}})[_0xc103('0x28')](respondWithResult(_0x2f1a5c,null))[_0xc103('0x43')](handleError(_0x2f1a5c,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index cde9c69..95d4cc8 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 _0x6be1=['emit','hasOwnProperty','hook','exports','events','Team','setMaxListeners','update','remove'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x6be1,0x1c6));var _0x16be=function(_0x506339,_0x55a013){_0x506339=_0x506339-0x0;var _0xae1f30=_0x6be1[_0x506339];return _0xae1f30;};'use strict';var EventEmitter=require(_0x16be('0x0'));var Team=require('../../mysqldb')['db'][_0x16be('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x16be('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x16be('0x3'),'afterDestroy':_0x16be('0x4')};function emitEvent(_0x8542d9){return function(_0x850c92,_0x158858,_0x4dce1a){TeamEvents[_0x16be('0x5')](_0x8542d9+':'+_0x850c92['id'],_0x850c92);TeamEvents[_0x16be('0x5')](_0x8542d9,_0x850c92);_0x4dce1a(null);};}for(var e in events){if(events[_0x16be('0x6')](e)){var event=events[e];Team[_0x16be('0x7')](e,emitEvent(event));}}module[_0x16be('0x8')]=TeamEvents; \ No newline at end of file +var _0x0942=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','remove'];(function(_0xc9671e,_0x5ae235){var _0x54957a=function(_0x17b799){while(--_0x17b799){_0xc9671e['push'](_0xc9671e['shift']());}};_0x54957a(++_0x5ae235);}(_0x0942,0x8c));var _0x2094=function(_0x17698a,_0x1fe505){_0x17698a=_0x17698a-0x0;var _0x29f764=_0x0942[_0x17698a];return _0x29f764;};'use strict';var EventEmitter=require(_0x2094('0x0'));var Team=require(_0x2094('0x1'))['db'][_0x2094('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2094('0x3')};function emitEvent(_0x5ebd38){return function(_0x3d6d4e,_0x1bc515,_0x3db814){TeamEvents[_0x2094('0x4')](_0x5ebd38+':'+_0x3d6d4e['id'],_0x3d6d4e);TeamEvents[_0x2094('0x4')](_0x5ebd38,_0x3d6d4e);_0x3db814(null);};}for(var e in events){if(events[_0x2094('0x5')](e)){var event=events[e];Team[_0x2094('0x6')](e,emitEvent(event));}}module[_0x2094('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d91b31c..d203e8a 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 _0x212a=['../../config/environment','./team.attributes','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x384ca5,_0x37d802){var _0x1495f1=function(_0x54e8ae){while(--_0x54e8ae){_0x384ca5['push'](_0x384ca5['shift']());}};_0x1495f1(++_0x37d802);}(_0x212a,0xe8));var _0xa212=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x212a[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xa212('0x0'));var util=require(_0xa212('0x1'));var logger=require(_0xa212('0x2'))(_0xa212('0x3'));var moment=require(_0xa212('0x4'));var BPromise=require(_0xa212('0x5'));var rp=require(_0xa212('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa212('0x7'));var config=require(_0xa212('0x8'));var attributes=require(_0xa212('0x9'));module['exports']=function(_0x200b73,_0x3f4ff5){return _0x200b73['define'](_0xa212('0xa'),attributes,{'tableName':_0xa212('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbc8=['path','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf706c7,_0x6c9079){var _0x23894f=function(_0x40f21d){while(--_0x40f21d){_0xf706c7['push'](_0xf706c7['shift']());}};_0x23894f(++_0x6c9079);}(_0xdbc8,0xda));var _0x8dbc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdbc8[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x8dbc('0x0'));var logger=require(_0x8dbc('0x1'))(_0x8dbc('0x2'));var moment=require(_0x8dbc('0x3'));var BPromise=require(_0x8dbc('0x4'));var rp=require(_0x8dbc('0x5'));var fs=require('fs');var path=require(_0x8dbc('0x6'));var rimraf=require(_0x8dbc('0x7'));var config=require(_0x8dbc('0x8'));var attributes=require(_0x8dbc('0x9'));module[_0x8dbc('0xa')]=function(_0x575f02,_0x5dd412){return _0x575f02[_0x8dbc('0xb')](_0x8dbc('0xc'),attributes,{'tableName':_0x8dbc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 0e21279..5a2e723 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 _0xfd28=['code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4506ad,_0x247564){var _0x1d2252=function(_0x17349e){while(--_0x17349e){_0x4506ad['push'](_0x4506ad['shift']());}};_0x1d2252(++_0x247564);}(_0xfd28,0x112));var _0x8fd2=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xfd28[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0x8fd2('0x0'));var util=require(_0x8fd2('0x1'));var moment=require(_0x8fd2('0x2'));var BPromise=require(_0x8fd2('0x3'));var rs=require(_0x8fd2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x5'))['db'];var utils=require(_0x8fd2('0x6'));var logger=require(_0x8fd2('0x7'))(_0x8fd2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8fd2('0x9'));var client=jayson[_0x8fd2('0xa')][_0x8fd2('0xb')]({'port':0x232a});config[_0x8fd2('0xc')]=_[_0x8fd2('0xd')](config[_0x8fd2('0xc')],{'host':_0x8fd2('0xe'),'port':0x18eb});var socket=require(_0x8fd2('0xf'))(new Redis(config[_0x8fd2('0xc')]));require(_0x8fd2('0x10'))[_0x8fd2('0x11')](socket);function respondWithRpcPromise(_0x5e65f8,_0x5e5c1b,_0x50d562){return new BPromise(function(_0x50a246,_0x53bfbb){return client[_0x8fd2('0x12')](_0x5e65f8,_0x50d562)[_0x8fd2('0x13')](function(_0x433881){logger[_0x8fd2('0x14')](_0x8fd2('0x15'),_0x5e5c1b,'request\x20sent');logger[_0x8fd2('0x16')](_0x8fd2('0x17'),_0x5e5c1b,'request\x20sent',JSON[_0x8fd2('0x18')](_0x433881));if(_0x433881[_0x8fd2('0x19')]){if(_0x433881[_0x8fd2('0x19')][_0x8fd2('0x1a')]===0x1f4){logger[_0x8fd2('0x19')]('Team,\x20%s,\x20%s',_0x5e5c1b,_0x433881[_0x8fd2('0x19')][_0x8fd2('0x1b')]);return _0x53bfbb(_0x433881[_0x8fd2('0x19')]['message']);}logger[_0x8fd2('0x19')]('Team,\x20%s,\x20%s',_0x5e5c1b,_0x433881['error'][_0x8fd2('0x1b')]);return _0x50a246(_0x433881[_0x8fd2('0x19')][_0x8fd2('0x1b')]);}else{logger[_0x8fd2('0x14')](_0x8fd2('0x15'),_0x5e5c1b,_0x8fd2('0x1c'));_0x50a246(_0x433881[_0x8fd2('0x1d')][_0x8fd2('0x1b')]);}})['catch'](function(_0x26a8bd){logger['error'](_0x8fd2('0x15'),_0x5e5c1b,_0x26a8bd);_0x53bfbb(_0x26a8bd);});});} \ No newline at end of file +var _0x077f=['http','localhost','redis','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x262f2c,_0x3ea263){var _0x437433=function(_0x884037){while(--_0x884037){_0x262f2c['push'](_0x262f2c['shift']());}};_0x437433(++_0x3ea263);}(_0x077f,0x8c));var _0xf077=function(_0x30fe4b,_0x5742e5){_0x30fe4b=_0x30fe4b-0x0;var _0x89d370=_0x077f[_0x30fe4b];return _0x89d370;};'use strict';var _=require(_0xf077('0x0'));var util=require(_0xf077('0x1'));var moment=require(_0xf077('0x2'));var BPromise=require(_0xf077('0x3'));var rs=require(_0xf077('0x4'));var fs=require('fs');var Redis=require(_0xf077('0x5'));var db=require(_0xf077('0x6'))['db'];var utils=require(_0xf077('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf077('0x8'));var client=jayson[_0xf077('0x9')][_0xf077('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xf077('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf077('0xc')]));require(_0xf077('0xd'))[_0xf077('0xe')](socket);function respondWithRpcPromise(_0x5a6fa1,_0xf1cb1c,_0x5aed0c){return new BPromise(function(_0x5df14c,_0x10f4a3){return client[_0xf077('0xf')](_0x5a6fa1,_0x5aed0c)['then'](function(_0x2bfa29){logger[_0xf077('0x10')](_0xf077('0x11'),_0xf1cb1c,_0xf077('0x12'));logger[_0xf077('0x13')](_0xf077('0x14'),_0xf1cb1c,_0xf077('0x12'),JSON['stringify'](_0x2bfa29));if(_0x2bfa29[_0xf077('0x15')]){if(_0x2bfa29[_0xf077('0x15')]['code']===0x1f4){logger[_0xf077('0x15')](_0xf077('0x11'),_0xf1cb1c,_0x2bfa29[_0xf077('0x15')]['message']);return _0x10f4a3(_0x2bfa29['error'][_0xf077('0x16')]);}logger['error'](_0xf077('0x11'),_0xf1cb1c,_0x2bfa29[_0xf077('0x15')][_0xf077('0x16')]);return _0x5df14c(_0x2bfa29[_0xf077('0x15')][_0xf077('0x16')]);}else{logger[_0xf077('0x10')](_0xf077('0x11'),_0xf1cb1c,_0xf077('0x12'));_0x5df14c(_0x2bfa29[_0xf077('0x17')][_0xf077('0x16')]);}})[_0xf077('0x18')](function(_0x280e8e){logger[_0xf077('0x15')]('Team,\x20%s,\x20%s',_0xf1cb1c,_0x280e8e);_0x10f4a3(_0x280e8e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 9795b8d..e93edb1 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 _0x45d3=['save','remove','update','emit','removeListener','register','length','team:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45d3,0x148));var _0x345d=function(_0x2ad3e1,_0x1a75de){_0x2ad3e1=_0x2ad3e1-0x0;var _0x5630fc=_0x45d3[_0x2ad3e1];return _0x5630fc;};'use strict';var TeamEvents=require('./team.events');var events=[_0x345d('0x0'),_0x345d('0x1'),_0x345d('0x2')];function createListener(_0x25e275,_0x27e56c){return function(_0xb04cf2){_0x27e56c[_0x345d('0x3')](_0x25e275,_0xb04cf2);};}function removeListener(_0x153443,_0xaa7b7e){return function(){TeamEvents[_0x345d('0x4')](_0x153443,_0xaa7b7e);};}exports[_0x345d('0x5')]=function(_0x40f2ab){for(var _0x459be2=0x0,_0x15dfe2=events[_0x345d('0x6')];_0x459be2<_0x15dfe2;_0x459be2++){var _0x5404a9=events[_0x459be2];var _0x58a743=createListener(_0x345d('0x7')+_0x5404a9,_0x40f2ab);TeamEvents['on'](_0x5404a9,_0x58a743);}}; \ No newline at end of file +var _0xa3c2=['removeListener','register','length','team:','./team.events','save','remove','update','emit'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0xa3c2,0xf7));var _0x2a3c=function(_0x26a84c,_0x5724a7){_0x26a84c=_0x26a84c-0x0;var _0xa7793f=_0xa3c2[_0x26a84c];return _0xa7793f;};'use strict';var TeamEvents=require(_0x2a3c('0x0'));var events=[_0x2a3c('0x1'),_0x2a3c('0x2'),_0x2a3c('0x3')];function createListener(_0x28eb8f,_0x45ee64){return function(_0x164e65){_0x45ee64[_0x2a3c('0x4')](_0x28eb8f,_0x164e65);};}function removeListener(_0xda8b07,_0x2c00fe){return function(){TeamEvents[_0x2a3c('0x5')](_0xda8b07,_0x2c00fe);};}exports[_0x2a3c('0x6')]=function(_0x19dd74){for(var _0x2511db=0x0,_0x13fc68=events[_0x2a3c('0x7')];_0x2511db<_0x13fc68;_0x2511db++){var _0x446aa2=events[_0x2511db];var _0x1a8ebf=createListener(_0x2a3c('0x8')+_0x446aa2,_0x19dd74);TeamEvents['on'](_0x446aa2,_0x1a8ebf);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0eff6ce..d83ad2c 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 _0x6427=['exports','INTEGER'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x6427,0xbe));var _0x7642=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x6427[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require('sequelize');module[_0x7642('0x0')]={'TeamId':{'type':Sequelize[_0x7642('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7642('0x1')]}}; \ No newline at end of file +var _0x3dd5=['INTEGER','sequelize'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x3dd5,0x73));var _0x53dd=function(_0x44731a,_0x1a8abe){_0x44731a=_0x44731a-0x0;var _0x5b9d0c=_0x3dd5[_0x44731a];return _0x5b9d0c;};'use strict';var Sequelize=require(_0x53dd('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x53dd('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x53dd('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 1eb7b2f..ee0ae42 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 _0xea28=['../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19e754,_0x4aeb77){var _0x5504c8=function(_0x41db1a){while(--_0x41db1a){_0x19e754['push'](_0x19e754['shift']());}};_0x5504c8(++_0x4aeb77);}(_0xea28,0x13a));var _0x8ea2=function(_0xd90117,_0x196097){_0xd90117=_0xd90117-0x0;var _0x5e86f=_0xea28[_0xd90117];return _0x5e86f;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71f4=['api','moment','bluebird','request-promise','rimraf','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','../../config/logger'];(function(_0x17321d,_0x5831a6){var _0x69a804=function(_0x19c381){while(--_0x19c381){_0x17321d['push'](_0x17321d['shift']());}};_0x69a804(++_0x5831a6);}(_0x71f4,0xf9));var _0x471f=function(_0x29767c,_0x4fbfd0){_0x29767c=_0x29767c-0x0;var _0x5e0b9c=_0x71f4[_0x29767c];return _0x5e0b9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x471f('0x0'))(_0x471f('0x1'));var moment=require(_0x471f('0x2'));var BPromise=require(_0x471f('0x3'));var rp=require(_0x471f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x471f('0x5'));var config=require('../../config/environment');var attributes=require(_0x471f('0x6'));module['exports']=function(_0x1d0101,_0x3bdf82){return _0x1d0101[_0x471f('0x7')](_0x471f('0x8'),attributes,{'tableName':_0x471f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 9d7958d..adcdc61 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x507df9,_0x30a73b){var _0x42ddc9=function(_0x543377){while(--_0x543377){_0x507df9['push'](_0x507df9['shift']());}};_0x42ddc9(++_0x30a73b);}(_0xe706,0xa3));var _0x6e70=function(_0xd4d4aa,_0x5db1f0){_0xd4d4aa=_0xd4d4aa-0x0;var _0x3f2237=_0xe706[_0xd4d4aa];return _0x3f2237;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x34e06d,_0x550d26){var _0x448a6f=function(_0x31d489){while(--_0x31d489){_0x34e06d['push'](_0x34e06d['shift']());}};_0x448a6f(++_0x550d26);}(_0xedd9,0xfc));var _0x9edd=function(_0xaa8c33,_0x446794){_0xaa8c33=_0xaa8c33-0x0;var _0x4339ac=_0xedd9[_0xaa8c33];return _0x4339ac;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 26b095b..847118d 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 _0x5699=['sequelize','exports'];(function(_0x5b02e6,_0x368c90){var _0x321842=function(_0x3a7dff){while(--_0x3a7dff){_0x5b02e6['push'](_0x5b02e6['shift']());}};_0x321842(++_0x368c90);}(_0x5699,0x68));var _0x9569=function(_0x619b0c,_0x7255c7){_0x619b0c=_0x619b0c-0x0;var _0x20b83e=_0x5699[_0x619b0c];return _0x20b83e;};'use strict';var Sequelize=require(_0x9569('0x0'));module[_0x9569('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9b5f=['exports','INTEGER','sequelize'];(function(_0x1e0eeb,_0x5e38d7){var _0x57b6f1=function(_0x243103){while(--_0x243103){_0x1e0eeb['push'](_0x1e0eeb['shift']());}};_0x57b6f1(++_0x5e38d7);}(_0x9b5f,0x7a));var _0xf9b5=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x9b5f[_0x25d386];return _0x857f4a;};'use strict';var Sequelize=require(_0xf9b5('0x0'));module[_0xf9b5('0x1')]={'penalty':{'type':Sequelize[_0xf9b5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 23848bb..64cb10d 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 _0x5d70=['api','moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','team_has_voice_queues','lodash','util'];(function(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0x5d70,0x8d));var _0x05d7=function(_0x3d9ff6,_0x25619f){_0x3d9ff6=_0x3d9ff6-0x0;var _0x22e4bb=_0x5d70[_0x3d9ff6];return _0x22e4bb;};'use strict';var _=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var logger=require('../../config/logger')(_0x05d7('0x2'));var moment=require(_0x05d7('0x3'));var BPromise=require(_0x05d7('0x4'));var rp=require(_0x05d7('0x5'));var fs=require('fs');var path=require(_0x05d7('0x6'));var rimraf=require(_0x05d7('0x7'));var config=require('../../config/environment');var attributes=require(_0x05d7('0x8'));module[_0x05d7('0x9')]=function(_0x416de3,_0x2fe205){return _0x416de3['define']('TeamVoiceQueue',attributes,{'tableName':_0x05d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2ab=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','team_has_voice_queues','lodash'];(function(_0x47143f,_0x589310){var _0x49b5bd=function(_0x1f29a8){while(--_0x1f29a8){_0x47143f['push'](_0x47143f['shift']());}};_0x49b5bd(++_0x589310);}(_0xa2ab,0xa7));var _0xba2a=function(_0x12823d,_0x3502c0){_0x12823d=_0x12823d-0x0;var _0x2cfbdb=_0xa2ab[_0x12823d];return _0x2cfbdb;};'use strict';var _=require(_0xba2a('0x0'));var util=require(_0xba2a('0x1'));var logger=require(_0xba2a('0x2'))('api');var moment=require(_0xba2a('0x3'));var BPromise=require(_0xba2a('0x4'));var rp=require(_0xba2a('0x5'));var fs=require('fs');var path=require(_0xba2a('0x6'));var rimraf=require(_0xba2a('0x7'));var config=require(_0xba2a('0x8'));var attributes=require(_0xba2a('0x9'));module['exports']=function(_0x12f994,_0x42e864){return _0x12f994[_0xba2a('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0xba2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 6b54014..f7c890d 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 _0xfd2f=['error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x28836b,_0x389433){var _0x51f3f8=function(_0x503226){while(--_0x503226){_0x28836b['push'](_0x28836b['shift']());}};_0x51f3f8(++_0x389433);}(_0xfd2f,0x14a));var _0xffd2=function(_0x1d4674,_0x2371ae){_0x1d4674=_0x1d4674-0x0;var _0x3b9ed7=_0xfd2f[_0x1d4674];return _0x3b9ed7;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var moment=require(_0xffd2('0x2'));var BPromise=require('bluebird');var rs=require(_0xffd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd2('0x4'))['db'];var utils=require(_0xffd2('0x5'));var logger=require('../../config/logger')(_0xffd2('0x6'));var config=require(_0xffd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd5e752,_0x2074e0,_0x56a1e2){return new BPromise(function(_0x35d327,_0x5b24ca){return client['request'](_0xd5e752,_0x56a1e2)[_0xffd2('0x8')](function(_0x15e33f){logger[_0xffd2('0x9')](_0xffd2('0xa'),_0x2074e0,'request\x20sent');logger[_0xffd2('0xb')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2074e0,'request\x20sent',JSON['stringify'](_0x15e33f));if(_0x15e33f[_0xffd2('0xc')]){if(_0x15e33f[_0xffd2('0xc')][_0xffd2('0xd')]===0x1f4){logger[_0xffd2('0xc')](_0xffd2('0xa'),_0x2074e0,_0x15e33f[_0xffd2('0xc')][_0xffd2('0xe')]);return _0x5b24ca(_0x15e33f['error']['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x2074e0,_0x15e33f[_0xffd2('0xc')][_0xffd2('0xe')]);return _0x35d327(_0x15e33f['error'][_0xffd2('0xe')]);}else{logger[_0xffd2('0x9')](_0xffd2('0xa'),_0x2074e0,_0xffd2('0xf'));_0x35d327(_0x15e33f[_0xffd2('0x10')][_0xffd2('0xe')]);}})[_0xffd2('0x11')](function(_0x132d38){logger[_0xffd2('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2074e0,_0x132d38);_0x5b24ca(_0x132d38);});});} \ No newline at end of file +var _0xaf09=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5c4165,_0x264905){var _0x521e50=function(_0x10cb11){while(--_0x10cb11){_0x5c4165['push'](_0x5c4165['shift']());}};_0x521e50(++_0x264905);}(_0xaf09,0x10d));var _0x9af0=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0xaf09[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require(_0x9af0('0x0'));var util=require(_0x9af0('0x1'));var moment=require(_0x9af0('0x2'));var BPromise=require(_0x9af0('0x3'));var rs=require(_0x9af0('0x4'));var fs=require('fs');var Redis=require(_0x9af0('0x5'));var db=require(_0x9af0('0x6'))['db'];var utils=require(_0x9af0('0x7'));var logger=require(_0x9af0('0x8'))('rpc');var config=require(_0x9af0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9af0('0xa')][_0x9af0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52162e,_0xf7e92,_0x556d1a){return new BPromise(function(_0x51663a,_0xad63de){return client[_0x9af0('0xc')](_0x52162e,_0x556d1a)[_0x9af0('0xd')](function(_0x220f3c){logger[_0x9af0('0xe')](_0x9af0('0xf'),_0xf7e92,_0x9af0('0x10'));logger[_0x9af0('0x11')](_0x9af0('0x12'),_0xf7e92,_0x9af0('0x10'),JSON['stringify'](_0x220f3c));if(_0x220f3c['error']){if(_0x220f3c[_0x9af0('0x13')][_0x9af0('0x14')]===0x1f4){logger[_0x9af0('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0xf7e92,_0x220f3c[_0x9af0('0x13')][_0x9af0('0x15')]);return _0xad63de(_0x220f3c[_0x9af0('0x13')]['message']);}logger['error'](_0x9af0('0xf'),_0xf7e92,_0x220f3c[_0x9af0('0x13')][_0x9af0('0x15')]);return _0x51663a(_0x220f3c['error'][_0x9af0('0x15')]);}else{logger[_0x9af0('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0xf7e92,'request\x20sent');_0x51663a(_0x220f3c[_0x9af0('0x16')][_0x9af0('0x15')]);}})[_0x9af0('0x17')](function(_0x40ad66){logger[_0x9af0('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0xf7e92,_0x40ad66);_0xad63de(_0x40ad66);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 6b1c047..1db651b 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 _0xa3db=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x2e15c0,_0x1d4e79){var _0x385d1b=function(_0x1cc592){while(--_0x1cc592){_0x2e15c0['push'](_0x2e15c0['shift']());}};_0x385d1b(++_0x1d4e79);}(_0xa3db,0x10c));var _0xba3d=function(_0x291b8f,_0x3b8484){_0x291b8f=_0x291b8f-0x0;var _0x3b504b=_0xa3db[_0x291b8f];return _0x3b504b;};'use strict';var multer=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var path=require(_0xba3d('0x2'));var timeout=require(_0xba3d('0x3'));var express=require(_0xba3d('0x4'));var router=express[_0xba3d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba3d('0x6'));var config=require('../../config/environment');var controller=require(_0xba3d('0x7'));router['get']('/',auth[_0xba3d('0x8')](),controller[_0xba3d('0x9')]);router[_0xba3d('0xa')](_0xba3d('0xb'),auth[_0xba3d('0x8')](),controller[_0xba3d('0xc')]);router[_0xba3d('0xd')]('/',auth[_0xba3d('0x8')](),controller[_0xba3d('0xe')]);router[_0xba3d('0xf')](_0xba3d('0xb'),auth['isAuthenticated'](),controller[_0xba3d('0x10')]);router[_0xba3d('0x11')](_0xba3d('0xb'),auth[_0xba3d('0x8')](),controller[_0xba3d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9962=['express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0x9962,0xb8));var _0x2996=function(_0x356358,_0x172cf0){_0x356358=_0x356358-0x0;var _0x1092fa=_0x9962[_0x356358];return _0x1092fa;};'use strict';var multer=require(_0x2996('0x0'));var util=require('util');var path=require(_0x2996('0x1'));var timeout=require(_0x2996('0x2'));var express=require(_0x2996('0x3'));var router=express['Router']();var fs_extra=require(_0x2996('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2996('0x5'));var config=require(_0x2996('0x6'));var controller=require('./template.controller');router[_0x2996('0x7')]('/',auth[_0x2996('0x8')](),controller['index']);router[_0x2996('0x7')](_0x2996('0x9'),auth[_0x2996('0x8')](),controller[_0x2996('0xa')]);router[_0x2996('0xb')]('/',auth['isAuthenticated'](),controller[_0x2996('0xc')]);router['put'](_0x2996('0x9'),auth[_0x2996('0x8')](),controller[_0x2996('0xd')]);router[_0x2996('0xe')]('/:id',auth[_0x2996('0x8')](),controller[_0x2996('0xf')]);module[_0x2996('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 4468f2f..f757afa 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 _0x30e5=['TEXT','sequelize','exports'];(function(_0x2bad4e,_0x583a4f){var _0x43c1c1=function(_0x39af5d){while(--_0x39af5d){_0x2bad4e['push'](_0x2bad4e['shift']());}};_0x43c1c1(++_0x583a4f);}(_0x30e5,0x112));var _0x530e=function(_0x292550,_0x5047bf){_0x292550=_0x292550-0x0;var _0x5e789d=_0x30e5[_0x292550];return _0x5e789d;};'use strict';var Sequelize=require(_0x530e('0x0'));module[_0x530e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x530e('0x2')]}}; \ No newline at end of file +var _0x2330=['STRING','TEXT','sequelize','exports'];(function(_0x583473,_0x469bd9){var _0x216c3f=function(_0x425a12){while(--_0x425a12){_0x583473['push'](_0x583473['shift']());}};_0x216c3f(++_0x469bd9);}(_0x2330,0x1d2));var _0x0233=function(_0x3a67db,_0x4c0eaf){_0x3a67db=_0x3a67db-0x0;var _0x204991=_0x2330[_0x3a67db];return _0x204991;};'use strict';var Sequelize=require(_0x0233('0x0'));module[_0x0233('0x1')]={'name':{'type':Sequelize[_0x0233('0x2')]},'description':{'type':Sequelize[_0x0233('0x2')]},'html':{'type':Sequelize[_0x0233('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2a995e8..6fb9fa7 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 _0xafb8=['jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','error','name','send','index','map','Template','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x1fe8b9,_0xd87696){var _0x25d006=function(_0x35727f){while(--_0x35727f){_0x1fe8b9['push'](_0x1fe8b9['shift']());}};_0x25d006(++_0xd87696);}(_0xafb8,0x18e));var _0x8afb=function(_0x504ed7,_0x30a9bb){_0x504ed7=_0x504ed7-0x0;var _0x418ca0=_0xafb8[_0x504ed7];return _0x418ca0;};'use strict';var emlformat=require(_0x8afb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8afb('0x1'));var jsonpatch=require(_0x8afb('0x2'));var rp=require(_0x8afb('0x3'));var moment=require(_0x8afb('0x4'));var BPromise=require(_0x8afb('0x5'));var Mustache=require('mustache');var util=require(_0x8afb('0x6'));var path=require(_0x8afb('0x7'));var sox=require(_0x8afb('0x8'));var csv=require(_0x8afb('0x9'));var ejs=require(_0x8afb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8afb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8afb('0xc'));var deskjs=require(_0x8afb('0xd'));var toCsv=require(_0x8afb('0x9'));var querystring=require(_0x8afb('0xe'));var Papa=require(_0x8afb('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8afb('0x10'));var as=require(_0x8afb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8afb('0x12'))(_0x8afb('0x13'));var utils=require(_0x8afb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8afb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f68e0,_0x1f974b){_0x1f974b=_0x1f974b||0xcc;return function(_0x2f7fb3){if(_0x2f7fb3){return _0x3f68e0[_0x8afb('0x16')](_0x1f974b);}return _0x3f68e0[_0x8afb('0x17')](_0x1f974b)[_0x8afb('0x18')]();};}function respondWithResult(_0x301006,_0x1147c9){_0x1147c9=_0x1147c9||0xc8;return function(_0x202019){if(_0x202019){return _0x301006['status'](_0x1147c9)[_0x8afb('0x19')](_0x202019);}};}function respondWithFilteredResult(_0x56f518,_0x54b5b3){return function(_0x4ad7ad){if(_0x4ad7ad){var _0x112f20=typeof _0x54b5b3[_0x8afb('0x1a')]===_0x8afb('0x1b')&&typeof _0x54b5b3[_0x8afb('0x1c')]===_0x8afb('0x1b');var _0x10c57d=_0x4ad7ad[_0x8afb('0x1d')];var _0x44fd17=_0x112f20?0x0:_0x54b5b3[_0x8afb('0x1a')];var _0x473b08=_0x112f20?_0x4ad7ad[_0x8afb('0x1d')]:_0x54b5b3[_0x8afb('0x1a')]+_0x54b5b3[_0x8afb('0x1c')];var _0x591a82;if(_0x473b08>=_0x10c57d){_0x473b08=_0x10c57d;_0x591a82=0xc8;}else{_0x591a82=0xce;}_0x56f518[_0x8afb('0x17')](_0x591a82);return _0x56f518['set'](_0x8afb('0x1e'),_0x44fd17+'-'+_0x473b08+'/'+_0x10c57d)['json'](_0x4ad7ad);}return null;};}function patchUpdates(_0x295ed2){return function(_0x18132e){try{jsonpatch[_0x8afb('0x1f')](_0x18132e,_0x295ed2,!![]);}catch(_0x13a977){return BPromise[_0x8afb('0x20')](_0x13a977);}return _0x18132e['save']();};}function saveUpdates(_0x41e7a4,_0xae477d){return function(_0x470a35){if(_0x470a35){return _0x470a35[_0x8afb('0x21')](_0x41e7a4)[_0x8afb('0x22')](function(_0x57b0a9){return _0x57b0a9;});}return null;};}function removeEntity(_0x18dbd4,_0x2e285c){return function(_0x4804ae){if(_0x4804ae){return _0x4804ae[_0x8afb('0x23')]()['then'](function(){var _0x1460a7=_0x4804ae[_0x8afb('0x24')]({'plain':!![]});var _0xa76d1c='Templates';return db['UserProfileResource']['destroy']({'where':{'type':_0xa76d1c,'resourceId':_0x1460a7['id']}})[_0x8afb('0x22')](function(){return _0x4804ae;});})[_0x8afb('0x22')](function(){_0x18dbd4['status'](0xcc)[_0x8afb('0x18')]();});}};}function handleEntityNotFound(_0x552375,_0x5f2ec4){return function(_0x557781){if(!_0x557781){_0x552375[_0x8afb('0x16')](0x194);}return _0x557781;};}function handleError(_0xd0218e,_0x102c46){_0x102c46=_0x102c46||0x1f4;return function(_0x9ff304){logger[_0x8afb('0x25')](_0x9ff304['stack']);if(_0x9ff304[_0x8afb('0x26')]){delete _0x9ff304['name'];}_0xd0218e['status'](_0x102c46)[_0x8afb('0x27')](_0x9ff304);};}exports[_0x8afb('0x28')]=function(_0x26fea2,_0x4b3a27){var _0xd9b23={},_0x17676c={},_0x29c36c={'count':0x0,'rows':[]};var _0x514939=_[_0x8afb('0x29')](db[_0x8afb('0x2a')]['rawAttributes'],function(_0x546a36){return{'name':_0x546a36[_0x8afb('0x2b')],'type':_0x546a36['type'][_0x8afb('0x2c')]};});_0x17676c[_0x8afb('0x2d')]=_[_0x8afb('0x29')](_0x514939,'name');_0x17676c[_0x8afb('0x2e')]=_[_0x8afb('0x2f')](_0x26fea2[_0x8afb('0x2e')]);_0x17676c['filters']=_[_0x8afb('0x30')](_0x17676c[_0x8afb('0x2d')],_0x17676c[_0x8afb('0x2e')]);_0xd9b23[_0x8afb('0x31')]=_[_0x8afb('0x30')](_0x17676c[_0x8afb('0x2d')],qs['fields'](_0x26fea2['query'][_0x8afb('0x32')]));_0xd9b23[_0x8afb('0x31')]=_0xd9b23[_0x8afb('0x31')][_0x8afb('0x33')]?_0xd9b23[_0x8afb('0x31')]:_0x17676c['model'];if(!_0x26fea2['query'][_0x8afb('0x34')]('nolimit')){_0xd9b23[_0x8afb('0x1c')]=qs[_0x8afb('0x1c')](_0x26fea2['query'][_0x8afb('0x1c')]);_0xd9b23['offset']=qs[_0x8afb('0x1a')](_0x26fea2['query'][_0x8afb('0x1a')]);}_0xd9b23[_0x8afb('0x35')]=qs[_0x8afb('0x36')](_0x26fea2['query']['sort']);_0xd9b23['where']=qs[_0x8afb('0x37')](_[_0x8afb('0x38')](_0x26fea2['query'],_0x17676c[_0x8afb('0x37')]),_0x514939);if(_0x26fea2['query'][_0x8afb('0x39')]){_0xd9b23[_0x8afb('0x3a')]=_['merge'](_0xd9b23[_0x8afb('0x3a')],{'$or':_[_0x8afb('0x29')](_0x514939,function(_0x1f15b6){if(_0x1f15b6[_0x8afb('0x3b')]!==_0x8afb('0x3c')){var _0x43eb80={};_0x43eb80[_0x1f15b6[_0x8afb('0x26')]]={'$like':'%'+_0x26fea2[_0x8afb('0x2e')][_0x8afb('0x39')]+'%'};return _0x43eb80;}})});}_0xd9b23=_[_0x8afb('0x3d')]({},_0xd9b23,_0x26fea2[_0x8afb('0x3e')]);var _0x9bbd95={'where':_0xd9b23['where']};return db[_0x8afb('0x2a')][_0x8afb('0x1d')](_0x9bbd95)[_0x8afb('0x22')](function(_0x39363c){_0x29c36c[_0x8afb('0x1d')]=_0x39363c;if(_0x26fea2[_0x8afb('0x2e')][_0x8afb('0x3f')]){_0xd9b23[_0x8afb('0x40')]=[{'all':!![]}];}return db[_0x8afb('0x2a')][_0x8afb('0x41')](_0xd9b23);})[_0x8afb('0x22')](function(_0x36cb5d){_0x29c36c[_0x8afb('0x42')]=_0x36cb5d;return _0x29c36c;})[_0x8afb('0x22')](respondWithFilteredResult(_0x4b3a27,_0xd9b23))[_0x8afb('0x43')](handleError(_0x4b3a27,null));};exports[_0x8afb('0x44')]=function(_0xa64681,_0x4173c4){var _0x594924={'raw':!![],'where':{'id':_0xa64681['params']['id']}},_0x15538d={};_0x15538d['model']=_[_0x8afb('0x2f')](db[_0x8afb('0x2a')][_0x8afb('0x45')]);_0x15538d[_0x8afb('0x2e')]=_['keys'](_0xa64681[_0x8afb('0x2e')]);_0x15538d[_0x8afb('0x37')]=_[_0x8afb('0x30')](_0x15538d[_0x8afb('0x2d')],_0x15538d[_0x8afb('0x2e')]);_0x594924[_0x8afb('0x31')]=_[_0x8afb('0x30')](_0x15538d[_0x8afb('0x2d')],qs[_0x8afb('0x32')](_0xa64681[_0x8afb('0x2e')]['fields']));_0x594924['attributes']=_0x594924['attributes']['length']?_0x594924[_0x8afb('0x31')]:_0x15538d[_0x8afb('0x2d')];if(_0xa64681[_0x8afb('0x2e')][_0x8afb('0x3f')]){_0x594924[_0x8afb('0x40')]=[{'all':!![]}];}_0x594924=_['merge']({},_0x594924,_0xa64681[_0x8afb('0x3e')]);return db[_0x8afb('0x2a')]['find'](_0x594924)['then'](handleEntityNotFound(_0x4173c4,null))[_0x8afb('0x22')](respondWithResult(_0x4173c4,null))[_0x8afb('0x43')](handleError(_0x4173c4,null));};exports[_0x8afb('0x46')]=function(_0x1fa6a9,_0x53d49a){return db[_0x8afb('0x2a')][_0x8afb('0x46')](_0x1fa6a9[_0x8afb('0x47')],{})[_0x8afb('0x22')](function(_0x2255d6){var _0x26fb52=_0x1fa6a9[_0x8afb('0x48')][_0x8afb('0x24')]({'plain':!![]});if(!_0x26fb52)throw new Error(_0x8afb('0x49'));if(_0x26fb52[_0x8afb('0x4a')]===_0x8afb('0x48')){var _0x397547=_0x2255d6['get']({'plain':!![]});var _0x2b4dc='Templates';return db[_0x8afb('0x4b')][_0x8afb('0x4c')]({'where':{'name':_0x2b4dc,'userProfileId':_0x26fb52[_0x8afb('0x4d')]},'raw':!![]})[_0x8afb('0x22')](function(_0x3b79fa){if(_0x3b79fa&&_0x3b79fa[_0x8afb('0x4e')]===0x0){return db[_0x8afb('0x4f')][_0x8afb('0x46')]({'name':_0x397547[_0x8afb('0x26')],'resourceId':_0x397547['id'],'type':_0x3b79fa[_0x8afb('0x26')],'sectionId':_0x3b79fa['id']},{})[_0x8afb('0x22')](function(){return _0x2255d6;});}else{return _0x2255d6;}})[_0x8afb('0x43')](function(_0x12c025){logger['error'](_0x8afb('0x50'),_0x12c025);throw _0x12c025;});}return _0x2255d6;})[_0x8afb('0x22')](respondWithResult(_0x53d49a,0xc9))[_0x8afb('0x43')](handleError(_0x53d49a,null));};exports[_0x8afb('0x21')]=function(_0x5e08cd,_0x47b8c4){if(_0x5e08cd['body']['id']){delete _0x5e08cd[_0x8afb('0x47')]['id'];}return db[_0x8afb('0x2a')][_0x8afb('0x4c')]({'where':{'id':_0x5e08cd['params']['id']}})[_0x8afb('0x22')](handleEntityNotFound(_0x47b8c4,null))[_0x8afb('0x22')](saveUpdates(_0x5e08cd['body'],null))['then'](respondWithResult(_0x47b8c4,null))[_0x8afb('0x43')](handleError(_0x47b8c4,null));};exports['destroy']=function(_0x5ca2f8,_0x3a756f){return db[_0x8afb('0x2a')][_0x8afb('0x4c')]({'where':{'id':_0x5ca2f8[_0x8afb('0x51')]['id']}})[_0x8afb('0x22')](handleEntityNotFound(_0x3a756f,null))['then'](removeEntity(_0x3a756f,null))[_0x8afb('0x43')](handleError(_0x3a756f,null));}; \ No newline at end of file +var _0xae08=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','name','index','map','Template','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xae08,0x180));var _0x8ae0=function(_0xae6216,_0xb90fa0){_0xae6216=_0xae6216-0x0;var _0x2472ea=_0xae08[_0xae6216];return _0x2472ea;};'use strict';var emlformat=require(_0x8ae0('0x0'));var rimraf=require(_0x8ae0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8ae0('0x2'));var moment=require('moment');var BPromise=require(_0x8ae0('0x3'));var Mustache=require(_0x8ae0('0x4'));var util=require(_0x8ae0('0x5'));var path=require(_0x8ae0('0x6'));var sox=require(_0x8ae0('0x7'));var csv=require(_0x8ae0('0x8'));var ejs=require(_0x8ae0('0x9'));var fs=require('fs');var fs_extra=require(_0x8ae0('0xa'));var _=require(_0x8ae0('0xb'));var squel=require(_0x8ae0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ae0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8ae0('0xe'));var Papa=require(_0x8ae0('0xf'));var Redis=require(_0x8ae0('0x10'));var authService=require(_0x8ae0('0x11'));var qs=require(_0x8ae0('0x12'));var as=require(_0x8ae0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ae0('0x14'))(_0x8ae0('0x15'));var utils=require('../../config/utils');var config=require(_0x8ae0('0x16'));var licenseUtil=require(_0x8ae0('0x17'));var db=require(_0x8ae0('0x18'))['db'];function respondWithStatusCode(_0x176d61,_0x4873d1){_0x4873d1=_0x4873d1||0xcc;return function(_0x4457b4){if(_0x4457b4){return _0x176d61[_0x8ae0('0x19')](_0x4873d1);}return _0x176d61[_0x8ae0('0x1a')](_0x4873d1)['end']();};}function respondWithResult(_0x1e73d0,_0x3c479a){_0x3c479a=_0x3c479a||0xc8;return function(_0x2fc764){if(_0x2fc764){return _0x1e73d0['status'](_0x3c479a)['json'](_0x2fc764);}};}function respondWithFilteredResult(_0x3ede19,_0x33ce7c){return function(_0x3e45e2){if(_0x3e45e2){var _0x2e3846=typeof _0x33ce7c[_0x8ae0('0x1b')]===_0x8ae0('0x1c')&&typeof _0x33ce7c['limit']===_0x8ae0('0x1c');var _0x2fe459=_0x3e45e2['count'];var _0x3a4b34=_0x2e3846?0x0:_0x33ce7c[_0x8ae0('0x1b')];var _0x38a288=_0x2e3846?_0x3e45e2[_0x8ae0('0x1d')]:_0x33ce7c[_0x8ae0('0x1b')]+_0x33ce7c[_0x8ae0('0x1e')];var _0x474efd;if(_0x38a288>=_0x2fe459){_0x38a288=_0x2fe459;_0x474efd=0xc8;}else{_0x474efd=0xce;}_0x3ede19[_0x8ae0('0x1a')](_0x474efd);return _0x3ede19[_0x8ae0('0x1f')]('Content-Range',_0x3a4b34+'-'+_0x38a288+'/'+_0x2fe459)[_0x8ae0('0x20')](_0x3e45e2);}return null;};}function patchUpdates(_0x37a31c){return function(_0x12c8e4){try{jsonpatch[_0x8ae0('0x21')](_0x12c8e4,_0x37a31c,!![]);}catch(_0x28a380){return BPromise[_0x8ae0('0x22')](_0x28a380);}return _0x12c8e4[_0x8ae0('0x23')]();};}function saveUpdates(_0x9d6c89,_0x351ec){return function(_0x1d9f52){if(_0x1d9f52){return _0x1d9f52[_0x8ae0('0x24')](_0x9d6c89)[_0x8ae0('0x25')](function(_0x25a79e){return _0x25a79e;});}return null;};}function removeEntity(_0x537218,_0x5e86c4){return function(_0x2263b9){if(_0x2263b9){return _0x2263b9[_0x8ae0('0x26')]()[_0x8ae0('0x25')](function(){var _0x316c66=_0x2263b9[_0x8ae0('0x27')]({'plain':!![]});var _0x1f80cb=_0x8ae0('0x28');return db[_0x8ae0('0x29')][_0x8ae0('0x26')]({'where':{'type':_0x1f80cb,'resourceId':_0x316c66['id']}})[_0x8ae0('0x25')](function(){return _0x2263b9;});})['then'](function(){_0x537218[_0x8ae0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x558941,_0x1a80a7){return function(_0x341c6c){if(!_0x341c6c){_0x558941[_0x8ae0('0x19')](0x194);}return _0x341c6c;};}function handleError(_0x4fe0d1,_0x51076f){_0x51076f=_0x51076f||0x1f4;return function(_0x13b88f){logger['error'](_0x13b88f['stack']);if(_0x13b88f[_0x8ae0('0x2a')]){delete _0x13b88f[_0x8ae0('0x2a')];}_0x4fe0d1[_0x8ae0('0x1a')](_0x51076f)['send'](_0x13b88f);};}exports[_0x8ae0('0x2b')]=function(_0x239754,_0x45338e){var _0x266b6e={},_0x22b24d={},_0x4538bc={'count':0x0,'rows':[]};var _0x28d733=_[_0x8ae0('0x2c')](db[_0x8ae0('0x2d')]['rawAttributes'],function(_0xdd6f6d){return{'name':_0xdd6f6d[_0x8ae0('0x2e')],'type':_0xdd6f6d[_0x8ae0('0x2f')][_0x8ae0('0x30')]};});_0x22b24d[_0x8ae0('0x31')]=_['map'](_0x28d733,_0x8ae0('0x2a'));_0x22b24d[_0x8ae0('0x32')]=_[_0x8ae0('0x33')](_0x239754['query']);_0x22b24d[_0x8ae0('0x34')]=_['intersection'](_0x22b24d[_0x8ae0('0x31')],_0x22b24d[_0x8ae0('0x32')]);_0x266b6e[_0x8ae0('0x35')]=_[_0x8ae0('0x36')](_0x22b24d['model'],qs[_0x8ae0('0x37')](_0x239754[_0x8ae0('0x32')][_0x8ae0('0x37')]));_0x266b6e[_0x8ae0('0x35')]=_0x266b6e[_0x8ae0('0x35')][_0x8ae0('0x38')]?_0x266b6e[_0x8ae0('0x35')]:_0x22b24d[_0x8ae0('0x31')];if(!_0x239754['query'][_0x8ae0('0x39')](_0x8ae0('0x3a'))){_0x266b6e[_0x8ae0('0x1e')]=qs[_0x8ae0('0x1e')](_0x239754[_0x8ae0('0x32')][_0x8ae0('0x1e')]);_0x266b6e[_0x8ae0('0x1b')]=qs[_0x8ae0('0x1b')](_0x239754[_0x8ae0('0x32')][_0x8ae0('0x1b')]);}_0x266b6e[_0x8ae0('0x3b')]=qs[_0x8ae0('0x3c')](_0x239754[_0x8ae0('0x32')]['sort']);_0x266b6e['where']=qs[_0x8ae0('0x34')](_[_0x8ae0('0x3d')](_0x239754[_0x8ae0('0x32')],_0x22b24d['filters']),_0x28d733);if(_0x239754[_0x8ae0('0x32')]['filter']){_0x266b6e[_0x8ae0('0x3e')]=_['merge'](_0x266b6e[_0x8ae0('0x3e')],{'$or':_['map'](_0x28d733,function(_0x586e13){if(_0x586e13[_0x8ae0('0x2f')]!==_0x8ae0('0x3f')){var _0x4c5dc9={};_0x4c5dc9[_0x586e13[_0x8ae0('0x2a')]]={'$like':'%'+_0x239754['query'][_0x8ae0('0x40')]+'%'};return _0x4c5dc9;}})});}_0x266b6e=_[_0x8ae0('0x41')]({},_0x266b6e,_0x239754[_0x8ae0('0x42')]);var _0x304e5b={'where':_0x266b6e['where']};return db[_0x8ae0('0x2d')][_0x8ae0('0x1d')](_0x304e5b)[_0x8ae0('0x25')](function(_0x35e2d7){_0x4538bc[_0x8ae0('0x1d')]=_0x35e2d7;if(_0x239754[_0x8ae0('0x32')]['includeAll']){_0x266b6e[_0x8ae0('0x43')]=[{'all':!![]}];}return db[_0x8ae0('0x2d')][_0x8ae0('0x44')](_0x266b6e);})[_0x8ae0('0x25')](function(_0x55e86e){_0x4538bc[_0x8ae0('0x45')]=_0x55e86e;return _0x4538bc;})['then'](respondWithFilteredResult(_0x45338e,_0x266b6e))[_0x8ae0('0x46')](handleError(_0x45338e,null));};exports['show']=function(_0x9bd262,_0x52c5a8){var _0x50f589={'raw':!![],'where':{'id':_0x9bd262[_0x8ae0('0x47')]['id']}},_0xee1359={};_0xee1359[_0x8ae0('0x31')]=_[_0x8ae0('0x33')](db[_0x8ae0('0x2d')]['rawAttributes']);_0xee1359['query']=_[_0x8ae0('0x33')](_0x9bd262[_0x8ae0('0x32')]);_0xee1359[_0x8ae0('0x34')]=_[_0x8ae0('0x36')](_0xee1359['model'],_0xee1359['query']);_0x50f589[_0x8ae0('0x35')]=_[_0x8ae0('0x36')](_0xee1359['model'],qs[_0x8ae0('0x37')](_0x9bd262[_0x8ae0('0x32')]['fields']));_0x50f589[_0x8ae0('0x35')]=_0x50f589[_0x8ae0('0x35')]['length']?_0x50f589[_0x8ae0('0x35')]:_0xee1359[_0x8ae0('0x31')];if(_0x9bd262[_0x8ae0('0x32')][_0x8ae0('0x48')]){_0x50f589[_0x8ae0('0x43')]=[{'all':!![]}];}_0x50f589=_[_0x8ae0('0x41')]({},_0x50f589,_0x9bd262[_0x8ae0('0x42')]);return db[_0x8ae0('0x2d')][_0x8ae0('0x49')](_0x50f589)[_0x8ae0('0x25')](handleEntityNotFound(_0x52c5a8,null))[_0x8ae0('0x25')](respondWithResult(_0x52c5a8,null))[_0x8ae0('0x46')](handleError(_0x52c5a8,null));};exports[_0x8ae0('0x4a')]=function(_0x3545a2,_0x33675f){return db['Template'][_0x8ae0('0x4a')](_0x3545a2[_0x8ae0('0x4b')],{})['then'](function(_0x4a81a0){var _0x1e8ed4=_0x3545a2[_0x8ae0('0x4c')][_0x8ae0('0x27')]({'plain':!![]});if(!_0x1e8ed4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e8ed4['role']===_0x8ae0('0x4c')){var _0x40f924=_0x4a81a0[_0x8ae0('0x27')]({'plain':!![]});var _0x2ce611=_0x8ae0('0x28');return db['UserProfileSection'][_0x8ae0('0x49')]({'where':{'name':_0x2ce611,'userProfileId':_0x1e8ed4[_0x8ae0('0x4d')]},'raw':!![]})[_0x8ae0('0x25')](function(_0x25dc76){if(_0x25dc76&&_0x25dc76['autoAssociation']===0x0){return db['UserProfileResource'][_0x8ae0('0x4a')]({'name':_0x40f924[_0x8ae0('0x2a')],'resourceId':_0x40f924['id'],'type':_0x25dc76['name'],'sectionId':_0x25dc76['id']},{})[_0x8ae0('0x25')](function(){return _0x4a81a0;});}else{return _0x4a81a0;}})['catch'](function(_0x593bd5){logger[_0x8ae0('0x4e')](_0x8ae0('0x4f'),_0x593bd5);throw _0x593bd5;});}return _0x4a81a0;})[_0x8ae0('0x25')](respondWithResult(_0x33675f,0xc9))['catch'](handleError(_0x33675f,null));};exports[_0x8ae0('0x24')]=function(_0x3cf7d5,_0x49286a){if(_0x3cf7d5['body']['id']){delete _0x3cf7d5[_0x8ae0('0x4b')]['id'];}return db['Template']['find']({'where':{'id':_0x3cf7d5['params']['id']}})[_0x8ae0('0x25')](handleEntityNotFound(_0x49286a,null))[_0x8ae0('0x25')](saveUpdates(_0x3cf7d5[_0x8ae0('0x4b')],null))[_0x8ae0('0x25')](respondWithResult(_0x49286a,null))[_0x8ae0('0x46')](handleError(_0x49286a,null));};exports[_0x8ae0('0x26')]=function(_0x12ce98,_0x53755d){return db['Template']['find']({'where':{'id':_0x12ce98[_0x8ae0('0x47')]['id']}})[_0x8ae0('0x25')](handleEntityNotFound(_0x53755d,null))['then'](removeEntity(_0x53755d,null))[_0x8ae0('0x46')](handleError(_0x53755d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d779c66..5117842 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 _0x4033=['Template','tools_templates','lodash','../../config/logger','moment','request-promise','path','../../config/environment','exports'];(function(_0x1e4af8,_0x2cf263){var _0x28ce85=function(_0x40019c){while(--_0x40019c){_0x1e4af8['push'](_0x1e4af8['shift']());}};_0x28ce85(++_0x2cf263);}(_0x4033,0xfe));var _0x3403=function(_0x4ccf96,_0x34978e){_0x4ccf96=_0x4ccf96-0x0;var _0xd103b7=_0x4033[_0x4ccf96];return _0xd103b7;};'use strict';var _=require(_0x3403('0x0'));var util=require('util');var logger=require(_0x3403('0x1'))('api');var moment=require(_0x3403('0x2'));var BPromise=require('bluebird');var rp=require(_0x3403('0x3'));var fs=require('fs');var path=require(_0x3403('0x4'));var rimraf=require('rimraf');var config=require(_0x3403('0x5'));var attributes=require('./template.attributes');module[_0x3403('0x6')]=function(_0x2dda82,_0x381053){return _0x2dda82['define'](_0x3403('0x7'),attributes,{'tableName':_0x3403('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75b6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Template','tools_templates','lodash','util'];(function(_0x2a5042,_0x307d04){var _0x4bc22f=function(_0x2ef928){while(--_0x2ef928){_0x2a5042['push'](_0x2a5042['shift']());}};_0x4bc22f(++_0x307d04);}(_0x75b6,0x186));var _0x675b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x675b('0x0'));var util=require(_0x675b('0x1'));var logger=require(_0x675b('0x2'))(_0x675b('0x3'));var moment=require(_0x675b('0x4'));var BPromise=require(_0x675b('0x5'));var rp=require(_0x675b('0x6'));var fs=require('fs');var path=require(_0x675b('0x7'));var rimraf=require(_0x675b('0x8'));var config=require(_0x675b('0x9'));var attributes=require('./template.attributes');module[_0x675b('0xa')]=function(_0x1886c3,_0x1227d3){return _0x1886c3[_0x675b('0xb')](_0x675b('0xc'),attributes,{'tableName':_0x675b('0xd'),'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 6e99cc7..bcdd1fb 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 _0x3d55=['message','info','result','Template','findAll','options','raw','where','include','map','model','attributes','GetTemplate','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3ee882,_0x4e444f){var _0x118330=function(_0x2e92ec){while(--_0x2e92ec){_0x3ee882['push'](_0x3ee882['shift']());}};_0x118330(++_0x4e444f);}(_0x3d55,0x141));var _0x53d5=function(_0x4aa2ec,_0x3d552a){_0x4aa2ec=_0x4aa2ec-0x0;var _0x534708=_0x3d55[_0x4aa2ec];return _0x534708;};'use strict';var _=require(_0x53d5('0x0'));var util=require(_0x53d5('0x1'));var moment=require(_0x53d5('0x2'));var BPromise=require(_0x53d5('0x3'));var rs=require(_0x53d5('0x4'));var fs=require('fs');var Redis=require(_0x53d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x53d5('0x6'));var logger=require(_0x53d5('0x7'))(_0x53d5('0x8'));var config=require('../../config/environment');var jayson=require(_0x53d5('0x9'));var client=jayson[_0x53d5('0xa')][_0x53d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a7757,_0x508d0a,_0x3cb107){return new BPromise(function(_0x15a422,_0x50fbe7){return client[_0x53d5('0xc')](_0x4a7757,_0x3cb107)[_0x53d5('0xd')](function(_0x478e73){logger['info'](_0x53d5('0xe'),_0x508d0a,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x508d0a,_0x53d5('0xf'),JSON[_0x53d5('0x10')](_0x478e73));if(_0x478e73[_0x53d5('0x11')]){if(_0x478e73[_0x53d5('0x11')][_0x53d5('0x12')]===0x1f4){logger['error'](_0x53d5('0xe'),_0x508d0a,_0x478e73['error'][_0x53d5('0x13')]);return _0x50fbe7(_0x478e73[_0x53d5('0x11')][_0x53d5('0x13')]);}logger[_0x53d5('0x11')](_0x53d5('0xe'),_0x508d0a,_0x478e73[_0x53d5('0x11')][_0x53d5('0x13')]);return _0x15a422(_0x478e73[_0x53d5('0x11')]['message']);}else{logger[_0x53d5('0x14')](_0x53d5('0xe'),_0x508d0a,'request\x20sent');_0x15a422(_0x478e73[_0x53d5('0x15')]['message']);}})['catch'](function(_0x5c7049){logger[_0x53d5('0x11')](_0x53d5('0xe'),_0x508d0a,_0x5c7049);_0x50fbe7(_0x5c7049);});});}exports['GetTemplate']=function(_0x599eca){var _0x67739b=this;return new Promise(function(_0xbf905f,_0x87d85c){return db[_0x53d5('0x16')][_0x53d5('0x17')]({'raw':_0x599eca[_0x53d5('0x18')]?_0x599eca[_0x53d5('0x18')][_0x53d5('0x19')]===undefined?!![]:![]:!![],'where':_0x599eca['options']?_0x599eca[_0x53d5('0x18')][_0x53d5('0x1a')]||null:null,'attributes':_0x599eca['options']?_0x599eca[_0x53d5('0x18')]['attributes']||null:null,'limit':_0x599eca[_0x53d5('0x18')]?_0x599eca[_0x53d5('0x18')]['limit']||null:null,'include':_0x599eca[_0x53d5('0x18')]?_0x599eca[_0x53d5('0x18')][_0x53d5('0x1b')]?_[_0x53d5('0x1c')](_0x599eca[_0x53d5('0x18')][_0x53d5('0x1b')],function(_0x207eb3){return{'model':db[_0x207eb3[_0x53d5('0x1d')]],'as':_0x207eb3['as'],'attributes':_0x207eb3[_0x53d5('0x1e')],'include':_0x207eb3[_0x53d5('0x1b')]?_[_0x53d5('0x1c')](_0x207eb3['include'],function(_0x44a91e){return{'model':db[_0x44a91e['model']],'as':_0x44a91e['as'],'attributes':_0x44a91e[_0x53d5('0x1e')],'include':_0x44a91e[_0x53d5('0x1b')]?_[_0x53d5('0x1c')](_0x44a91e[_0x53d5('0x1b')],function(_0x2c0421){return{'model':db[_0x2c0421[_0x53d5('0x1d')]],'as':_0x2c0421['as'],'attributes':_0x2c0421[_0x53d5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x53d5('0xd')](function(_0x30f1b2){logger[_0x53d5('0x14')](_0x53d5('0x1f'),_0x599eca);logger[_0x53d5('0x20')]('GetTemplate',_0x599eca,JSON[_0x53d5('0x10')](_0x30f1b2));_0xbf905f(_0x30f1b2);})[_0x53d5('0x21')](function(_0x3a7c92){logger[_0x53d5('0x11')](_0x53d5('0x1f'),_0x3a7c92[_0x53d5('0x13')],_0x599eca);_0x87d85c(_0x67739b[_0x53d5('0x11')](0x1f4,_0x3a7c92[_0x53d5('0x13')]));});});}; \ No newline at end of file +var _0x34d1=['findAll','options','raw','where','attributes','limit','model','map','include','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTemplate','Template'];(function(_0x376eeb,_0x26b365){var _0x32a930=function(_0x4e27d2){while(--_0x4e27d2){_0x376eeb['push'](_0x376eeb['shift']());}};_0x32a930(++_0x26b365);}(_0x34d1,0x19d));var _0x134d=function(_0x90c039,_0xb75bb5){_0x90c039=_0x90c039-0x0;var _0x4b741c=_0x34d1[_0x90c039];return _0x4b741c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x134d('0x0'));var BPromise=require(_0x134d('0x1'));var rs=require(_0x134d('0x2'));var fs=require('fs');var Redis=require(_0x134d('0x3'));var db=require(_0x134d('0x4'))['db'];var utils=require(_0x134d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x134d('0x6'));var client=jayson[_0x134d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd1ca,_0x4f2bc3,_0xf2f9e1){return new BPromise(function(_0x206f41,_0x3ba90b){return client['request'](_0x2fd1ca,_0xf2f9e1)[_0x134d('0x8')](function(_0xb3a238){logger[_0x134d('0x9')](_0x134d('0xa'),_0x4f2bc3,_0x134d('0xb'));logger[_0x134d('0xc')](_0x134d('0xd'),_0x4f2bc3,_0x134d('0xb'),JSON[_0x134d('0xe')](_0xb3a238));if(_0xb3a238[_0x134d('0xf')]){if(_0xb3a238['error'][_0x134d('0x10')]===0x1f4){logger[_0x134d('0xf')](_0x134d('0xa'),_0x4f2bc3,_0xb3a238['error'][_0x134d('0x11')]);return _0x3ba90b(_0xb3a238[_0x134d('0xf')][_0x134d('0x11')]);}logger[_0x134d('0xf')]('Template,\x20%s,\x20%s',_0x4f2bc3,_0xb3a238[_0x134d('0xf')]['message']);return _0x206f41(_0xb3a238['error']['message']);}else{logger[_0x134d('0x9')](_0x134d('0xa'),_0x4f2bc3,'request\x20sent');_0x206f41(_0xb3a238[_0x134d('0x12')][_0x134d('0x11')]);}})['catch'](function(_0x26202b){logger[_0x134d('0xf')](_0x134d('0xa'),_0x4f2bc3,_0x26202b);_0x3ba90b(_0x26202b);});});}exports[_0x134d('0x13')]=function(_0x570052){var _0x4682e9=this;return new Promise(function(_0x19ab9d,_0x4df323){return db[_0x134d('0x14')][_0x134d('0x15')]({'raw':_0x570052['options']?_0x570052[_0x134d('0x16')][_0x134d('0x17')]===undefined?!![]:![]:!![],'where':_0x570052[_0x134d('0x16')]?_0x570052[_0x134d('0x16')][_0x134d('0x18')]||null:null,'attributes':_0x570052['options']?_0x570052[_0x134d('0x16')][_0x134d('0x19')]||null:null,'limit':_0x570052[_0x134d('0x16')]?_0x570052['options'][_0x134d('0x1a')]||null:null,'include':_0x570052[_0x134d('0x16')]?_0x570052['options']['include']?_['map'](_0x570052[_0x134d('0x16')]['include'],function(_0x274b6f){return{'model':db[_0x274b6f[_0x134d('0x1b')]],'as':_0x274b6f['as'],'attributes':_0x274b6f[_0x134d('0x19')],'include':_0x274b6f['include']?_[_0x134d('0x1c')](_0x274b6f['include'],function(_0x13497f){return{'model':db[_0x13497f[_0x134d('0x1b')]],'as':_0x13497f['as'],'attributes':_0x13497f['attributes'],'include':_0x13497f[_0x134d('0x1d')]?_['map'](_0x13497f[_0x134d('0x1d')],function(_0x1fe70f){return{'model':db[_0x1fe70f[_0x134d('0x1b')]],'as':_0x1fe70f['as'],'attributes':_0x1fe70f[_0x134d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25e544){logger[_0x134d('0x9')](_0x134d('0x13'),_0x570052);logger['debug'](_0x134d('0x13'),_0x570052,JSON[_0x134d('0xe')](_0x25e544));_0x19ab9d(_0x25e544);})[_0x134d('0x1e')](function(_0x5c9b58){logger[_0x134d('0xf')](_0x134d('0x13'),_0x5c9b58[_0x134d('0x11')],_0x570052);_0x4df323(_0x4682e9[_0x134d('0xf')](0x1f4,_0x5c9b58[_0x134d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 82f37cc..7a41ca1 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 _0xa38c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put','delete','destroy','multer','util','connect-timeout'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xa38c,0x1bd));var _0xca38=function(_0x35104c,_0x343f63){_0x35104c=_0x35104c-0x0;var _0x24e5a6=_0xa38c[_0x35104c];return _0x24e5a6;};'use strict';var multer=require(_0xca38('0x0'));var util=require(_0xca38('0x1'));var path=require('path');var timeout=require(_0xca38('0x2'));var express=require(_0xca38('0x3'));var router=express[_0xca38('0x4')]();var fs_extra=require(_0xca38('0x5'));var auth=require(_0xca38('0x6'));var interaction=require(_0xca38('0x7'));var config=require(_0xca38('0x8'));var controller=require(_0xca38('0x9'));router[_0xca38('0xa')]('/',auth[_0xca38('0xb')](),controller[_0xca38('0xc')]);router['get'](_0xca38('0xd'),auth[_0xca38('0xb')](),controller[_0xca38('0xe')]);router[_0xca38('0xa')](_0xca38('0xf'),auth[_0xca38('0xb')](),controller[_0xca38('0x10')]);router[_0xca38('0xa')]('/:id/any_conditions',auth[_0xca38('0xb')](),controller[_0xca38('0x11')]);router[_0xca38('0xa')]('/:id/actions',auth[_0xca38('0xb')](),controller[_0xca38('0x12')]);router[_0xca38('0x13')]('/',auth['isAuthenticated'](),controller[_0xca38('0x14')]);router[_0xca38('0x13')](_0xca38('0xf'),auth[_0xca38('0xb')](),controller[_0xca38('0x15')]);router[_0xca38('0x13')]('/:id/any_conditions',auth[_0xca38('0xb')](),controller[_0xca38('0x16')]);router[_0xca38('0x13')](_0xca38('0x17'),auth[_0xca38('0xb')](),controller[_0xca38('0x18')]);router[_0xca38('0x19')]('/:id',auth[_0xca38('0xb')](),controller['update']);router[_0xca38('0x1a')](_0xca38('0xd'),auth[_0xca38('0xb')](),controller[_0xca38('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xf422=['create','addAllCondition','addAnyCondition','/:id/actions','addAction','update','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','/:id','show','get','getAllConditions','/:id/any_conditions','getAnyConditions','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf422,0xc0));var _0x2f42=function(_0x583157,_0x556df4){_0x583157=_0x583157-0x0;var _0x176d22=_0xf422[_0x583157];return _0x176d22;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2f42('0x0'));var timeout=require(_0x2f42('0x1'));var express=require(_0x2f42('0x2'));var router=express[_0x2f42('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2f42('0x4'));var config=require(_0x2f42('0x5'));var controller=require(_0x2f42('0x6'));router['get']('/',auth[_0x2f42('0x7')](),controller['index']);router['get'](_0x2f42('0x8'),auth['isAuthenticated'](),controller[_0x2f42('0x9')]);router[_0x2f42('0xa')]('/:id/all_conditions',auth[_0x2f42('0x7')](),controller[_0x2f42('0xb')]);router[_0x2f42('0xa')](_0x2f42('0xc'),auth['isAuthenticated'](),controller[_0x2f42('0xd')]);router[_0x2f42('0xa')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x2f42('0xe')]('/',auth[_0x2f42('0x7')](),controller[_0x2f42('0xf')]);router[_0x2f42('0xe')]('/:id/all_conditions',auth[_0x2f42('0x7')](),controller[_0x2f42('0x10')]);router['post'](_0x2f42('0xc'),auth[_0x2f42('0x7')](),controller[_0x2f42('0x11')]);router[_0x2f42('0xe')](_0x2f42('0x12'),auth[_0x2f42('0x7')](),controller[_0x2f42('0x13')]);router['put'](_0x2f42('0x8'),auth[_0x2f42('0x7')](),controller[_0x2f42('0x14')]);router['delete']('/:id',auth[_0x2f42('0x7')](),controller[_0x2f42('0x15')]);module[_0x2f42('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 836ef49..1b964e5 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 _0xb8b3=['exports','STRING','sequelize'];(function(_0x49de12,_0x14458f){var _0x400593=function(_0x4f8054){while(--_0x4f8054){_0x49de12['push'](_0x49de12['shift']());}};_0x400593(++_0x14458f);}(_0xb8b3,0x1a0));var _0x3b8b=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0xb8b3[_0x11f226];return _0x30be77;};'use strict';var Sequelize=require(_0x3b8b('0x0'));module[_0x3b8b('0x1')]={'name':{'type':Sequelize[_0x3b8b('0x2')]},'channel':{'type':Sequelize[_0x3b8b('0x2')]},'description':{'type':Sequelize[_0x3b8b('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5f87=['STRING','sequelize','exports'];(function(_0xe51bf5,_0x535a33){var _0x4ec09c=function(_0x1cd503){while(--_0x1cd503){_0xe51bf5['push'](_0xe51bf5['shift']());}};_0x4ec09c(++_0x535a33);}(_0x5f87,0x1cf));var _0x75f8=function(_0x4db7a0,_0xfce0c9){_0x4db7a0=_0x4db7a0-0x0;var _0x234422=_0x5f87[_0x4db7a0];return _0x234422;};'use strict';var Sequelize=require(_0x75f8('0x0'));module[_0x75f8('0x1')]={'name':{'type':Sequelize[_0x75f8('0x2')]},'channel':{'type':Sequelize[_0x75f8('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index c4a674b..7f1590d 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 _0x56b1=['getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','rows','catch','show','params','keys','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','addAllCondition','body','Condition','addAnyCondition','TriggerAnyId'];(function(_0x1bd247,_0x14f195){var _0x54d8d5=function(_0x2aaf14){while(--_0x2aaf14){_0x1bd247['push'](_0x1bd247['shift']());}};_0x54d8d5(++_0x14f195);}(_0x56b1,0x12c));var _0x156b=function(_0x2c33fb,_0x3191c2){_0x2c33fb=_0x2c33fb-0x0;var _0x479094=_0x56b1[_0x2c33fb];return _0x479094;};'use strict';var emlformat=require(_0x156b('0x0'));var rimraf=require(_0x156b('0x1'));var zipdir=require(_0x156b('0x2'));var jsonpatch=require(_0x156b('0x3'));var rp=require(_0x156b('0x4'));var moment=require(_0x156b('0x5'));var BPromise=require(_0x156b('0x6'));var Mustache=require(_0x156b('0x7'));var util=require(_0x156b('0x8'));var path=require(_0x156b('0x9'));var sox=require('sox');var csv=require(_0x156b('0xa'));var ejs=require(_0x156b('0xb'));var fs=require('fs');var fs_extra=require(_0x156b('0xc'));var _=require('lodash');var squel=require(_0x156b('0xd'));var crypto=require(_0x156b('0xe'));var jsforce=require(_0x156b('0xf'));var deskjs=require(_0x156b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x156b('0x11'));var Papa=require('papaparse');var Redis=require(_0x156b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x156b('0x13'));var as=require(_0x156b('0x14'));var hardwareService=require(_0x156b('0x15'));var logger=require(_0x156b('0x16'))(_0x156b('0x17'));var utils=require(_0x156b('0x18'));var config=require(_0x156b('0x19'));var licenseUtil=require(_0x156b('0x1a'));var db=require(_0x156b('0x1b'))['db'];function respondWithStatusCode(_0x278e54,_0x58e1d9){_0x58e1d9=_0x58e1d9||0xcc;return function(_0x45d9b5){if(_0x45d9b5){return _0x278e54[_0x156b('0x1c')](_0x58e1d9);}return _0x278e54[_0x156b('0x1d')](_0x58e1d9)[_0x156b('0x1e')]();};}function respondWithResult(_0x1c0db0,_0x21c50a){_0x21c50a=_0x21c50a||0xc8;return function(_0x55b7b0){if(_0x55b7b0){return _0x1c0db0[_0x156b('0x1d')](_0x21c50a)[_0x156b('0x1f')](_0x55b7b0);}};}function respondWithFilteredResult(_0x31f7ff,_0x34b8ef){return function(_0x18ccc8){if(_0x18ccc8){var _0x3742f3=typeof _0x34b8ef[_0x156b('0x20')]===_0x156b('0x21')&&typeof _0x34b8ef[_0x156b('0x22')]===_0x156b('0x21');var _0x26b1f3=_0x18ccc8['count'];var _0x58586a=_0x3742f3?0x0:_0x34b8ef['offset'];var _0x545125=_0x3742f3?_0x18ccc8['count']:_0x34b8ef['offset']+_0x34b8ef[_0x156b('0x22')];var _0x565ba0;if(_0x545125>=_0x26b1f3){_0x545125=_0x26b1f3;_0x565ba0=0xc8;}else{_0x565ba0=0xce;}_0x31f7ff[_0x156b('0x1d')](_0x565ba0);return _0x31f7ff['set'](_0x156b('0x23'),_0x58586a+'-'+_0x545125+'/'+_0x26b1f3)['json'](_0x18ccc8);}return null;};}function patchUpdates(_0x127b01){return function(_0x3f0af0){try{jsonpatch['apply'](_0x3f0af0,_0x127b01,!![]);}catch(_0x2b93d5){return BPromise[_0x156b('0x24')](_0x2b93d5);}return _0x3f0af0[_0x156b('0x25')]();};}function saveUpdates(_0x206315,_0x4e00c4){return function(_0x1d7c5d){if(_0x1d7c5d){return _0x1d7c5d[_0x156b('0x26')](_0x206315)[_0x156b('0x27')](function(_0x492048){return _0x492048;});}return null;};}function removeEntity(_0xde8193,_0x2ab3d6){return function(_0xc733d0){if(_0xc733d0){return _0xc733d0[_0x156b('0x28')]()[_0x156b('0x27')](function(){var _0x241d6f=_0xc733d0[_0x156b('0x29')]({'plain':!![]});var _0x3f2464=_0x156b('0x2a');return db[_0x156b('0x2b')]['destroy']({'where':{'type':_0x3f2464,'resourceId':_0x241d6f['id']}})[_0x156b('0x27')](function(){return _0xc733d0;});})[_0x156b('0x27')](function(){_0xde8193[_0x156b('0x1d')](0xcc)[_0x156b('0x1e')]();});}};}function handleEntityNotFound(_0x4b4c84,_0x332749){return function(_0x1918d1){if(!_0x1918d1){_0x4b4c84[_0x156b('0x1c')](0x194);}return _0x1918d1;};}function handleError(_0x2c2d9e,_0x7816ed){_0x7816ed=_0x7816ed||0x1f4;return function(_0x218611){logger[_0x156b('0x2c')](_0x218611[_0x156b('0x2d')]);if(_0x218611[_0x156b('0x2e')]){delete _0x218611['name'];}_0x2c2d9e[_0x156b('0x1d')](_0x7816ed)[_0x156b('0x2f')](_0x218611);};}exports[_0x156b('0x30')]=function(_0x2a0515,_0x13183a){var _0x18732c={},_0x177168={},_0x3d9bf3={'count':0x0,'rows':[]};var _0x485c1d=_[_0x156b('0x31')](db[_0x156b('0x32')][_0x156b('0x33')],function(_0x593294){return{'name':_0x593294[_0x156b('0x34')],'type':_0x593294[_0x156b('0x35')][_0x156b('0x36')]};});_0x177168[_0x156b('0x37')]=_['map'](_0x485c1d,_0x156b('0x2e'));_0x177168[_0x156b('0x38')]=_['keys'](_0x2a0515[_0x156b('0x38')]);_0x177168[_0x156b('0x39')]=_['intersection'](_0x177168[_0x156b('0x37')],_0x177168[_0x156b('0x38')]);_0x18732c[_0x156b('0x3a')]=_[_0x156b('0x3b')](_0x177168[_0x156b('0x37')],qs[_0x156b('0x3c')](_0x2a0515[_0x156b('0x38')][_0x156b('0x3c')]));_0x18732c[_0x156b('0x3a')]=_0x18732c[_0x156b('0x3a')]['length']?_0x18732c['attributes']:_0x177168['model'];if(!_0x2a0515[_0x156b('0x38')][_0x156b('0x3d')](_0x156b('0x3e'))){_0x18732c['limit']=qs[_0x156b('0x22')](_0x2a0515[_0x156b('0x38')]['limit']);_0x18732c['offset']=qs[_0x156b('0x20')](_0x2a0515[_0x156b('0x38')][_0x156b('0x20')]);}_0x18732c[_0x156b('0x3f')]=qs[_0x156b('0x40')](_0x2a0515[_0x156b('0x38')]['sort']);_0x18732c[_0x156b('0x41')]=qs[_0x156b('0x39')](_[_0x156b('0x42')](_0x2a0515['query'],_0x177168[_0x156b('0x39')]),_0x485c1d);if(_0x2a0515[_0x156b('0x38')]['filter']){_0x18732c[_0x156b('0x41')]=_[_0x156b('0x43')](_0x18732c[_0x156b('0x41')],{'$or':_[_0x156b('0x31')](_0x485c1d,function(_0x2b63bd){if(_0x2b63bd['type']!==_0x156b('0x44')){var _0x40e9c6={};_0x40e9c6[_0x2b63bd[_0x156b('0x2e')]]={'$like':'%'+_0x2a0515[_0x156b('0x38')][_0x156b('0x45')]+'%'};return _0x40e9c6;}})});}_0x18732c=_[_0x156b('0x43')]({},_0x18732c,_0x2a0515[_0x156b('0x46')]);var _0x1cc4af={'where':_0x18732c[_0x156b('0x41')]};return db['Trigger'][_0x156b('0x47')](_0x1cc4af)[_0x156b('0x27')](function(_0xcc76b7){_0x3d9bf3[_0x156b('0x47')]=_0xcc76b7;if(_0x2a0515[_0x156b('0x38')][_0x156b('0x48')]){_0x18732c['include']=[{'all':!![]}];}return db[_0x156b('0x32')]['findAll'](_0x18732c);})['then'](function(_0x68000a){_0x3d9bf3[_0x156b('0x49')]=_0x68000a;return _0x3d9bf3;})[_0x156b('0x27')](respondWithFilteredResult(_0x13183a,_0x18732c))[_0x156b('0x4a')](handleError(_0x13183a,null));};exports[_0x156b('0x4b')]=function(_0x4fdaf8,_0x3d3e3b){var _0x2736da={'raw':![],'where':{'id':_0x4fdaf8[_0x156b('0x4c')]['id']}},_0xe537a5={};_0xe537a5[_0x156b('0x37')]=_[_0x156b('0x4d')](db[_0x156b('0x32')][_0x156b('0x33')]);_0xe537a5['query']=_[_0x156b('0x4d')](_0x4fdaf8[_0x156b('0x38')]);_0xe537a5[_0x156b('0x39')]=_[_0x156b('0x3b')](_0xe537a5['model'],_0xe537a5[_0x156b('0x38')]);_0x2736da['attributes']=_[_0x156b('0x3b')](_0xe537a5['model'],qs[_0x156b('0x3c')](_0x4fdaf8['query']['fields']));_0x2736da[_0x156b('0x3a')]=_0x2736da['attributes'][_0x156b('0x4e')]?_0x2736da['attributes']:_0xe537a5[_0x156b('0x37')];if(_0x4fdaf8[_0x156b('0x38')][_0x156b('0x48')]){_0x2736da[_0x156b('0x4f')]=[{'all':!![]}];}_0x2736da=_['merge']({},_0x2736da,_0x4fdaf8[_0x156b('0x46')]);return db['Trigger'][_0x156b('0x50')](_0x2736da)[_0x156b('0x27')](handleEntityNotFound(_0x3d3e3b,null))['then'](respondWithResult(_0x3d3e3b,null))['catch'](handleError(_0x3d3e3b,null));};exports[_0x156b('0x51')]=function(_0x1fbb03,_0x109442){return db[_0x156b('0x32')][_0x156b('0x51')](_0x1fbb03['body'],{})[_0x156b('0x27')](function(_0x61b293){var _0x40a9ce=_0x1fbb03[_0x156b('0x52')][_0x156b('0x29')]({'plain':!![]});if(!_0x40a9ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a9ce[_0x156b('0x53')]===_0x156b('0x52')){var _0x36902c=_0x61b293['get']({'plain':!![]});var _0x3217d5=_0x156b('0x2a');return db[_0x156b('0x54')][_0x156b('0x50')]({'where':{'name':_0x3217d5,'userProfileId':_0x40a9ce[_0x156b('0x55')]},'raw':!![]})[_0x156b('0x27')](function(_0x1a2000){if(_0x1a2000&&_0x1a2000[_0x156b('0x56')]===0x0){return db['UserProfileResource'][_0x156b('0x51')]({'name':_0x36902c[_0x156b('0x2e')],'resourceId':_0x36902c['id'],'type':_0x1a2000['name'],'sectionId':_0x1a2000['id']},{})[_0x156b('0x27')](function(){return _0x61b293;});}else{return _0x61b293;}})[_0x156b('0x4a')](function(_0x16f739){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16f739);throw _0x16f739;});}return _0x61b293;})[_0x156b('0x27')](respondWithResult(_0x109442,0xc9))[_0x156b('0x4a')](handleError(_0x109442,null));};exports[_0x156b('0x26')]=function(_0xf4fa27,_0x5080b1){if(_0xf4fa27['body']['id']){delete _0xf4fa27['body']['id'];}return db[_0x156b('0x32')]['find']({'where':{'id':_0xf4fa27[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x5080b1,null))[_0x156b('0x27')](saveUpdates(_0xf4fa27['body'],null))[_0x156b('0x27')](respondWithResult(_0x5080b1,null))[_0x156b('0x4a')](handleError(_0x5080b1,null));};exports[_0x156b('0x28')]=function(_0x517902,_0x315567){return db[_0x156b('0x32')][_0x156b('0x50')]({'where':{'id':_0x517902['params']['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x315567,null))[_0x156b('0x27')](removeEntity(_0x315567,null))[_0x156b('0x4a')](handleError(_0x315567,null));};exports[_0x156b('0x57')]=function(_0x16f5be,_0x349afa,_0x2de7b8){if(_0x16f5be[_0x156b('0x58')]['id']){delete _0x16f5be[_0x156b('0x58')]['id'];}return db['Trigger']['find']({'where':{'id':_0x16f5be[_0x156b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x349afa,null))[_0x156b('0x27')](function(_0x2ac66e){if(_0x2ac66e){_0x16f5be[_0x156b('0x58')]['TriggerAllId']=_0x2ac66e['id'];return db[_0x156b('0x59')][_0x156b('0x51')](_0x16f5be[_0x156b('0x58')]);}})[_0x156b('0x27')](respondWithResult(_0x349afa,null))['catch'](handleError(_0x349afa,null));};exports[_0x156b('0x5a')]=function(_0x304c51,_0x48cfd5,_0x581467){if(_0x304c51[_0x156b('0x58')]['id']){delete _0x304c51['body']['id'];}return db[_0x156b('0x32')][_0x156b('0x50')]({'where':{'id':_0x304c51[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x48cfd5,null))[_0x156b('0x27')](function(_0x51ef70){if(_0x51ef70){_0x304c51[_0x156b('0x58')][_0x156b('0x5b')]=_0x51ef70['id'];return db[_0x156b('0x59')][_0x156b('0x51')](_0x304c51[_0x156b('0x58')]);}})[_0x156b('0x27')](respondWithResult(_0x48cfd5,null))[_0x156b('0x4a')](handleError(_0x48cfd5,null));};exports[_0x156b('0x5c')]=function(_0x209f68,_0x32a402,_0x504b75){var _0xaacf1={};var _0x405291={};var _0x14902b;var _0x996318;return db[_0x156b('0x32')][_0x156b('0x5d')]({'where':{'id':_0x209f68['params']['id']}})['then'](handleEntityNotFound(_0x32a402,null))['then'](function(_0x11ebb4){if(_0x11ebb4){_0x14902b=_0x11ebb4;_0x405291[_0x156b('0x37')]=_['keys'](db[_0x156b('0x59')][_0x156b('0x33')]);_0x405291[_0x156b('0x38')]=_['keys'](_0x209f68[_0x156b('0x38')]);_0x405291[_0x156b('0x39')]=_['intersection'](_0x405291['model'],_0x405291[_0x156b('0x38')]);_0xaacf1[_0x156b('0x3a')]=_['intersection'](_0x405291['model'],qs[_0x156b('0x3c')](_0x209f68[_0x156b('0x38')]['fields']));_0xaacf1[_0x156b('0x3a')]=_0xaacf1['attributes'][_0x156b('0x4e')]?_0xaacf1[_0x156b('0x3a')]:_0x405291[_0x156b('0x37')];_0xaacf1[_0x156b('0x3f')]=qs[_0x156b('0x40')](_0x209f68[_0x156b('0x38')][_0x156b('0x40')]);_0xaacf1['where']=qs[_0x156b('0x39')](_[_0x156b('0x42')](_0x209f68[_0x156b('0x38')],_0x405291[_0x156b('0x39')]));if(_0x209f68[_0x156b('0x38')][_0x156b('0x45')]){_0xaacf1['where']=_[_0x156b('0x43')](_0xaacf1[_0x156b('0x41')],{'$or':_[_0x156b('0x31')](_0xaacf1[_0x156b('0x3a')],function(_0x3bd8ab){var _0x528d01={};_0x528d01[_0x3bd8ab]={'$like':'%'+_0x209f68[_0x156b('0x38')][_0x156b('0x45')]+'%'};return _0x528d01;})});}_0xaacf1=_[_0x156b('0x43')]({},_0xaacf1,_0x209f68[_0x156b('0x46')]);return _0x14902b['getAllConditions'](_0xaacf1);}})['then'](function(_0xddd60b){if(_0xddd60b){_0x996318=_0xddd60b[_0x156b('0x4e')];if(!_0x209f68[_0x156b('0x38')][_0x156b('0x3d')](_0x156b('0x3e'))){_0xaacf1[_0x156b('0x22')]=qs[_0x156b('0x22')](_0x209f68[_0x156b('0x38')][_0x156b('0x22')]);_0xaacf1['offset']=qs[_0x156b('0x20')](_0x209f68[_0x156b('0x38')]['offset']);}return _0x14902b[_0x156b('0x5c')](_0xaacf1);}})[_0x156b('0x27')](function(_0x3ea5b9){if(_0x3ea5b9){return _0x3ea5b9?{'count':_0x996318,'rows':_0x3ea5b9}:null;}})['then'](respondWithResult(_0x32a402,null))[_0x156b('0x4a')](handleError(_0x32a402,null));};exports[_0x156b('0x5e')]=function(_0xef7aca,_0x1321a8,_0x44b67b){var _0x3e1ac8={};var _0x363e4f={};var _0x58af88;var _0x3b74fe;return db[_0x156b('0x32')][_0x156b('0x5d')]({'where':{'id':_0xef7aca[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x1321a8,null))[_0x156b('0x27')](function(_0x48dfe4){if(_0x48dfe4){_0x58af88=_0x48dfe4;_0x363e4f[_0x156b('0x37')]=_['keys'](db[_0x156b('0x59')]['rawAttributes']);_0x363e4f[_0x156b('0x38')]=_['keys'](_0xef7aca[_0x156b('0x38')]);_0x363e4f[_0x156b('0x39')]=_[_0x156b('0x3b')](_0x363e4f[_0x156b('0x37')],_0x363e4f[_0x156b('0x38')]);_0x3e1ac8[_0x156b('0x3a')]=_[_0x156b('0x3b')](_0x363e4f[_0x156b('0x37')],qs['fields'](_0xef7aca[_0x156b('0x38')][_0x156b('0x3c')]));_0x3e1ac8[_0x156b('0x3a')]=_0x3e1ac8[_0x156b('0x3a')]['length']?_0x3e1ac8[_0x156b('0x3a')]:_0x363e4f['model'];_0x3e1ac8[_0x156b('0x3f')]=qs['sort'](_0xef7aca['query']['sort']);_0x3e1ac8[_0x156b('0x41')]=qs[_0x156b('0x39')](_[_0x156b('0x42')](_0xef7aca[_0x156b('0x38')],_0x363e4f[_0x156b('0x39')]));if(_0xef7aca[_0x156b('0x38')][_0x156b('0x45')]){_0x3e1ac8['where']=_[_0x156b('0x43')](_0x3e1ac8[_0x156b('0x41')],{'$or':_[_0x156b('0x31')](_0x3e1ac8[_0x156b('0x3a')],function(_0x302da6){var _0x7fe6ea={};_0x7fe6ea[_0x302da6]={'$like':'%'+_0xef7aca['query'][_0x156b('0x45')]+'%'};return _0x7fe6ea;})});}_0x3e1ac8=_[_0x156b('0x43')]({},_0x3e1ac8,_0xef7aca[_0x156b('0x46')]);return _0x58af88[_0x156b('0x5e')](_0x3e1ac8);}})['then'](function(_0x2d516f){if(_0x2d516f){_0x3b74fe=_0x2d516f[_0x156b('0x4e')];if(!_0xef7aca['query']['hasOwnProperty']('nolimit')){_0x3e1ac8[_0x156b('0x22')]=qs[_0x156b('0x22')](_0xef7aca[_0x156b('0x38')][_0x156b('0x22')]);_0x3e1ac8[_0x156b('0x20')]=qs[_0x156b('0x20')](_0xef7aca[_0x156b('0x38')][_0x156b('0x20')]);}return _0x58af88[_0x156b('0x5e')](_0x3e1ac8);}})[_0x156b('0x27')](function(_0x5dce2d){if(_0x5dce2d){return _0x5dce2d?{'count':_0x3b74fe,'rows':_0x5dce2d}:null;}})[_0x156b('0x27')](respondWithResult(_0x1321a8,null))[_0x156b('0x4a')](handleError(_0x1321a8,null));};exports['addAction']=function(_0x2a8201,_0x3300a7,_0x2bfea8){if(_0x2a8201[_0x156b('0x58')]['id']){delete _0x2a8201['body']['id'];}return db['Trigger'][_0x156b('0x50')]({'where':{'id':_0x2a8201[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x3300a7,null))[_0x156b('0x27')](function(_0x2a99c3){if(_0x2a99c3){_0x2a8201[_0x156b('0x58')][_0x156b('0x5f')]=_0x2a99c3['id'];return db[_0x156b('0x60')][_0x156b('0x51')](_0x2a8201[_0x156b('0x58')]);}})['then'](respondWithResult(_0x3300a7,null))[_0x156b('0x4a')](handleError(_0x3300a7,null));};exports[_0x156b('0x61')]=function(_0x24a7c2,_0x2c7ebb,_0x9fe9e9){var _0x12c95e={};var _0x361a3c={};var _0x307805;var _0x38c174;return db[_0x156b('0x32')][_0x156b('0x5d')]({'where':{'id':_0x24a7c2[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x2c7ebb,null))[_0x156b('0x27')](function(_0x1a8f66){if(_0x1a8f66){_0x307805=_0x1a8f66;_0x361a3c[_0x156b('0x37')]=_[_0x156b('0x4d')](db[_0x156b('0x60')][_0x156b('0x33')]);_0x361a3c[_0x156b('0x38')]=_[_0x156b('0x4d')](_0x24a7c2[_0x156b('0x38')]);_0x361a3c[_0x156b('0x39')]=_[_0x156b('0x3b')](_0x361a3c[_0x156b('0x37')],_0x361a3c[_0x156b('0x38')]);_0x12c95e[_0x156b('0x3a')]=_['intersection'](_0x361a3c[_0x156b('0x37')],qs[_0x156b('0x3c')](_0x24a7c2['query'][_0x156b('0x3c')]));_0x12c95e[_0x156b('0x3a')]=_0x12c95e[_0x156b('0x3a')][_0x156b('0x4e')]?_0x12c95e['attributes']:_0x361a3c[_0x156b('0x37')];_0x12c95e[_0x156b('0x3f')]=qs[_0x156b('0x40')](_0x24a7c2[_0x156b('0x38')][_0x156b('0x40')]);_0x12c95e[_0x156b('0x41')]=qs[_0x156b('0x39')](_['pick'](_0x24a7c2['query'],_0x361a3c[_0x156b('0x39')]));if(_0x24a7c2[_0x156b('0x38')]['filter']){_0x12c95e['where']=_[_0x156b('0x43')](_0x12c95e[_0x156b('0x41')],{'$or':_[_0x156b('0x31')](_0x12c95e['attributes'],function(_0x209d43){var _0x669ff={};_0x669ff[_0x209d43]={'$like':'%'+_0x24a7c2[_0x156b('0x38')]['filter']+'%'};return _0x669ff;})});}_0x12c95e=_[_0x156b('0x43')]({},_0x12c95e,_0x24a7c2[_0x156b('0x46')]);return _0x307805[_0x156b('0x61')](_0x12c95e);}})['then'](function(_0x17aa13){if(_0x17aa13){_0x38c174=_0x17aa13['length'];if(!_0x24a7c2[_0x156b('0x38')]['hasOwnProperty'](_0x156b('0x3e'))){_0x12c95e[_0x156b('0x22')]=qs[_0x156b('0x22')](_0x24a7c2[_0x156b('0x38')][_0x156b('0x22')]);_0x12c95e[_0x156b('0x20')]=qs[_0x156b('0x20')](_0x24a7c2[_0x156b('0x38')]['offset']);}return _0x307805[_0x156b('0x61')](_0x12c95e);}})[_0x156b('0x27')](function(_0x3f7e76){if(_0x3f7e76){return _0x3f7e76?{'count':_0x38c174,'rows':_0x3f7e76}:null;}})[_0x156b('0x27')](respondWithResult(_0x2c7ebb,null))['catch'](handleError(_0x2c7ebb,null));}; \ No newline at end of file +var _0x783a=['ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','then','get','Triggers','UserProfileResource','end','error','stack','name','send','index','Trigger','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv'];(function(_0x56203a,_0x4b02ba){var _0x3e6c83=function(_0x30c6b2){while(--_0x30c6b2){_0x56203a['push'](_0x56203a['shift']());}};_0x3e6c83(++_0x4b02ba);}(_0x783a,0x1c8));var _0xa783=function(_0xeb3ef,_0x1ef138){_0xeb3ef=_0xeb3ef-0x0;var _0x1ac7a0=_0x783a[_0xeb3ef];return _0x1ac7a0;};'use strict';var emlformat=require(_0xa783('0x0'));var rimraf=require(_0xa783('0x1'));var zipdir=require(_0xa783('0x2'));var jsonpatch=require(_0xa783('0x3'));var rp=require('request-promise');var moment=require(_0xa783('0x4'));var BPromise=require(_0xa783('0x5'));var Mustache=require('mustache');var util=require(_0xa783('0x6'));var path=require(_0xa783('0x7'));var sox=require('sox');var csv=require(_0xa783('0x8'));var ejs=require(_0xa783('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa783('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa783('0xb'));var deskjs=require(_0xa783('0xc'));var toCsv=require(_0xa783('0x8'));var querystring=require(_0xa783('0xd'));var Papa=require(_0xa783('0xe'));var Redis=require('ioredis');var authService=require(_0xa783('0xf'));var qs=require(_0xa783('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa783('0x11'));var logger=require(_0xa783('0x12'))(_0xa783('0x13'));var utils=require('../../config/utils');var config=require(_0xa783('0x14'));var licenseUtil=require(_0xa783('0x15'));var db=require(_0xa783('0x16'))['db'];function respondWithStatusCode(_0x6bfc1a,_0x4fd2bf){_0x4fd2bf=_0x4fd2bf||0xcc;return function(_0x37dde3){if(_0x37dde3){return _0x6bfc1a['sendStatus'](_0x4fd2bf);}return _0x6bfc1a[_0xa783('0x17')](_0x4fd2bf)['end']();};}function respondWithResult(_0x5ec733,_0x2ebfa5){_0x2ebfa5=_0x2ebfa5||0xc8;return function(_0x21af9e){if(_0x21af9e){return _0x5ec733['status'](_0x2ebfa5)['json'](_0x21af9e);}};}function respondWithFilteredResult(_0x34512a,_0x2e7421){return function(_0x3bdc18){if(_0x3bdc18){var _0x4a3af2=typeof _0x2e7421['offset']===_0xa783('0x18')&&typeof _0x2e7421[_0xa783('0x19')]==='undefined';var _0x2754fa=_0x3bdc18[_0xa783('0x1a')];var _0x293605=_0x4a3af2?0x0:_0x2e7421[_0xa783('0x1b')];var _0x16663d=_0x4a3af2?_0x3bdc18[_0xa783('0x1a')]:_0x2e7421[_0xa783('0x1b')]+_0x2e7421['limit'];var _0x4b88d4;if(_0x16663d>=_0x2754fa){_0x16663d=_0x2754fa;_0x4b88d4=0xc8;}else{_0x4b88d4=0xce;}_0x34512a[_0xa783('0x17')](_0x4b88d4);return _0x34512a[_0xa783('0x1c')](_0xa783('0x1d'),_0x293605+'-'+_0x16663d+'/'+_0x2754fa)['json'](_0x3bdc18);}return null;};}function patchUpdates(_0xc6889e){return function(_0x22008d){try{jsonpatch[_0xa783('0x1e')](_0x22008d,_0xc6889e,!![]);}catch(_0x414cf5){return BPromise['reject'](_0x414cf5);}return _0x22008d['save']();};}function saveUpdates(_0x2dd58a,_0x55cdff){return function(_0x2bb742){if(_0x2bb742){return _0x2bb742[_0xa783('0x1f')](_0x2dd58a)['then'](function(_0x3e59bc){return _0x3e59bc;});}return null;};}function removeEntity(_0x58e8fd,_0x31a05f){return function(_0x2d915e){if(_0x2d915e){return _0x2d915e[_0xa783('0x20')]()[_0xa783('0x21')](function(){var _0xadfb24=_0x2d915e[_0xa783('0x22')]({'plain':!![]});var _0x35d2f6=_0xa783('0x23');return db[_0xa783('0x24')]['destroy']({'where':{'type':_0x35d2f6,'resourceId':_0xadfb24['id']}})[_0xa783('0x21')](function(){return _0x2d915e;});})[_0xa783('0x21')](function(){_0x58e8fd[_0xa783('0x17')](0xcc)[_0xa783('0x25')]();});}};}function handleEntityNotFound(_0x2f5557,_0x1edd00){return function(_0x52e1b5){if(!_0x52e1b5){_0x2f5557['sendStatus'](0x194);}return _0x52e1b5;};}function handleError(_0x10d4d3,_0x2a77e9){_0x2a77e9=_0x2a77e9||0x1f4;return function(_0x6dbb51){logger[_0xa783('0x26')](_0x6dbb51[_0xa783('0x27')]);if(_0x6dbb51[_0xa783('0x28')]){delete _0x6dbb51['name'];}_0x10d4d3[_0xa783('0x17')](_0x2a77e9)[_0xa783('0x29')](_0x6dbb51);};}exports[_0xa783('0x2a')]=function(_0x137a11,_0x41d621){var _0x11ee13={},_0xe19ac8={},_0x51c1b8={'count':0x0,'rows':[]};var _0x487562=_['map'](db[_0xa783('0x2b')][_0xa783('0x2c')],function(_0x4470dd){return{'name':_0x4470dd[_0xa783('0x2d')],'type':_0x4470dd['type'][_0xa783('0x2e')]};});_0xe19ac8['model']=_[_0xa783('0x2f')](_0x487562,_0xa783('0x28'));_0xe19ac8['query']=_[_0xa783('0x30')](_0x137a11[_0xa783('0x31')]);_0xe19ac8[_0xa783('0x32')]=_[_0xa783('0x33')](_0xe19ac8['model'],_0xe19ac8['query']);_0x11ee13['attributes']=_['intersection'](_0xe19ac8[_0xa783('0x34')],qs['fields'](_0x137a11['query'][_0xa783('0x35')]));_0x11ee13[_0xa783('0x36')]=_0x11ee13['attributes'][_0xa783('0x37')]?_0x11ee13['attributes']:_0xe19ac8[_0xa783('0x34')];if(!_0x137a11['query'][_0xa783('0x38')](_0xa783('0x39'))){_0x11ee13[_0xa783('0x19')]=qs[_0xa783('0x19')](_0x137a11[_0xa783('0x31')]['limit']);_0x11ee13[_0xa783('0x1b')]=qs[_0xa783('0x1b')](_0x137a11[_0xa783('0x31')][_0xa783('0x1b')]);}_0x11ee13[_0xa783('0x3a')]=qs[_0xa783('0x3b')](_0x137a11['query'][_0xa783('0x3b')]);_0x11ee13['where']=qs[_0xa783('0x32')](_[_0xa783('0x3c')](_0x137a11[_0xa783('0x31')],_0xe19ac8[_0xa783('0x32')]),_0x487562);if(_0x137a11[_0xa783('0x31')][_0xa783('0x3d')]){_0x11ee13['where']=_[_0xa783('0x3e')](_0x11ee13[_0xa783('0x3f')],{'$or':_[_0xa783('0x2f')](_0x487562,function(_0x157ba5){if(_0x157ba5[_0xa783('0x40')]!==_0xa783('0x41')){var _0x337d84={};_0x337d84[_0x157ba5[_0xa783('0x28')]]={'$like':'%'+_0x137a11[_0xa783('0x31')]['filter']+'%'};return _0x337d84;}})});}_0x11ee13=_['merge']({},_0x11ee13,_0x137a11[_0xa783('0x42')]);var _0x324c87={'where':_0x11ee13[_0xa783('0x3f')]};return db[_0xa783('0x2b')][_0xa783('0x1a')](_0x324c87)[_0xa783('0x21')](function(_0x42f1bb){_0x51c1b8['count']=_0x42f1bb;if(_0x137a11['query'][_0xa783('0x43')]){_0x11ee13[_0xa783('0x44')]=[{'all':!![]}];}return db[_0xa783('0x2b')]['findAll'](_0x11ee13);})[_0xa783('0x21')](function(_0x993b6a){_0x51c1b8[_0xa783('0x45')]=_0x993b6a;return _0x51c1b8;})[_0xa783('0x21')](respondWithFilteredResult(_0x41d621,_0x11ee13))[_0xa783('0x46')](handleError(_0x41d621,null));};exports[_0xa783('0x47')]=function(_0x3f8368,_0x24b6ef){var _0x4c3520={'raw':![],'where':{'id':_0x3f8368['params']['id']}},_0x898052={};_0x898052[_0xa783('0x34')]=_[_0xa783('0x30')](db[_0xa783('0x2b')][_0xa783('0x2c')]);_0x898052[_0xa783('0x31')]=_[_0xa783('0x30')](_0x3f8368[_0xa783('0x31')]);_0x898052[_0xa783('0x32')]=_['intersection'](_0x898052[_0xa783('0x34')],_0x898052['query']);_0x4c3520[_0xa783('0x36')]=_[_0xa783('0x33')](_0x898052['model'],qs[_0xa783('0x35')](_0x3f8368[_0xa783('0x31')][_0xa783('0x35')]));_0x4c3520[_0xa783('0x36')]=_0x4c3520[_0xa783('0x36')][_0xa783('0x37')]?_0x4c3520[_0xa783('0x36')]:_0x898052[_0xa783('0x34')];if(_0x3f8368['query']['includeAll']){_0x4c3520[_0xa783('0x44')]=[{'all':!![]}];}_0x4c3520=_['merge']({},_0x4c3520,_0x3f8368[_0xa783('0x42')]);return db[_0xa783('0x2b')][_0xa783('0x48')](_0x4c3520)['then'](handleEntityNotFound(_0x24b6ef,null))['then'](respondWithResult(_0x24b6ef,null))['catch'](handleError(_0x24b6ef,null));};exports['create']=function(_0x51a5ef,_0x955a83){return db[_0xa783('0x2b')][_0xa783('0x49')](_0x51a5ef[_0xa783('0x4a')],{})[_0xa783('0x21')](function(_0x4b6910){var _0x2d0440=_0x51a5ef[_0xa783('0x4b')][_0xa783('0x22')]({'plain':!![]});if(!_0x2d0440)throw new Error(_0xa783('0x4c'));if(_0x2d0440[_0xa783('0x4d')]==='user'){var _0x1c3941=_0x4b6910[_0xa783('0x22')]({'plain':!![]});var _0x20afad='Triggers';return db[_0xa783('0x4e')][_0xa783('0x48')]({'where':{'name':_0x20afad,'userProfileId':_0x2d0440[_0xa783('0x4f')]},'raw':!![]})['then'](function(_0x2d709d){if(_0x2d709d&&_0x2d709d[_0xa783('0x50')]===0x0){return db[_0xa783('0x24')][_0xa783('0x49')]({'name':_0x1c3941[_0xa783('0x28')],'resourceId':_0x1c3941['id'],'type':_0x2d709d[_0xa783('0x28')],'sectionId':_0x2d709d['id']},{})[_0xa783('0x21')](function(){return _0x4b6910;});}else{return _0x4b6910;}})['catch'](function(_0x33237d){logger['error'](_0xa783('0x51'),_0x33237d);throw _0x33237d;});}return _0x4b6910;})[_0xa783('0x21')](respondWithResult(_0x955a83,0xc9))[_0xa783('0x46')](handleError(_0x955a83,null));};exports[_0xa783('0x1f')]=function(_0x41a054,_0x1fc523){if(_0x41a054[_0xa783('0x4a')]['id']){delete _0x41a054[_0xa783('0x4a')]['id'];}return db[_0xa783('0x2b')]['find']({'where':{'id':_0x41a054[_0xa783('0x52')]['id']}})[_0xa783('0x21')](handleEntityNotFound(_0x1fc523,null))['then'](saveUpdates(_0x41a054[_0xa783('0x4a')],null))[_0xa783('0x21')](respondWithResult(_0x1fc523,null))[_0xa783('0x46')](handleError(_0x1fc523,null));};exports['destroy']=function(_0x48ec9a,_0x329b86){return db[_0xa783('0x2b')]['find']({'where':{'id':_0x48ec9a[_0xa783('0x52')]['id']}})['then'](handleEntityNotFound(_0x329b86,null))[_0xa783('0x21')](removeEntity(_0x329b86,null))['catch'](handleError(_0x329b86,null));};exports[_0xa783('0x53')]=function(_0x125247,_0x5755fb,_0x3f19de){if(_0x125247['body']['id']){delete _0x125247[_0xa783('0x4a')]['id'];}return db[_0xa783('0x2b')][_0xa783('0x48')]({'where':{'id':_0x125247['params']['id']}})[_0xa783('0x21')](handleEntityNotFound(_0x5755fb,null))[_0xa783('0x21')](function(_0xcc8b74){if(_0xcc8b74){_0x125247[_0xa783('0x4a')]['TriggerAllId']=_0xcc8b74['id'];return db[_0xa783('0x54')][_0xa783('0x49')](_0x125247[_0xa783('0x4a')]);}})['then'](respondWithResult(_0x5755fb,null))['catch'](handleError(_0x5755fb,null));};exports[_0xa783('0x55')]=function(_0x4b3881,_0x2f16b0,_0x473f54){if(_0x4b3881[_0xa783('0x4a')]['id']){delete _0x4b3881['body']['id'];}return db[_0xa783('0x2b')][_0xa783('0x48')]({'where':{'id':_0x4b3881[_0xa783('0x52')]['id']}})[_0xa783('0x21')](handleEntityNotFound(_0x2f16b0,null))[_0xa783('0x21')](function(_0x5865d3){if(_0x5865d3){_0x4b3881[_0xa783('0x4a')][_0xa783('0x56')]=_0x5865d3['id'];return db[_0xa783('0x54')][_0xa783('0x49')](_0x4b3881['body']);}})[_0xa783('0x21')](respondWithResult(_0x2f16b0,null))[_0xa783('0x46')](handleError(_0x2f16b0,null));};exports['getAllConditions']=function(_0x438362,_0x31fe8e,_0xfb062d){var _0xf3c81e={};var _0x4b9563={};var _0x2cb5ef;var _0x641160;return db[_0xa783('0x2b')][_0xa783('0x57')]({'where':{'id':_0x438362[_0xa783('0x52')]['id']}})[_0xa783('0x21')](handleEntityNotFound(_0x31fe8e,null))[_0xa783('0x21')](function(_0x4a600c){if(_0x4a600c){_0x2cb5ef=_0x4a600c;_0x4b9563[_0xa783('0x34')]=_[_0xa783('0x30')](db[_0xa783('0x54')][_0xa783('0x2c')]);_0x4b9563[_0xa783('0x31')]=_[_0xa783('0x30')](_0x438362['query']);_0x4b9563[_0xa783('0x32')]=_[_0xa783('0x33')](_0x4b9563[_0xa783('0x34')],_0x4b9563[_0xa783('0x31')]);_0xf3c81e[_0xa783('0x36')]=_[_0xa783('0x33')](_0x4b9563[_0xa783('0x34')],qs[_0xa783('0x35')](_0x438362[_0xa783('0x31')][_0xa783('0x35')]));_0xf3c81e[_0xa783('0x36')]=_0xf3c81e[_0xa783('0x36')][_0xa783('0x37')]?_0xf3c81e[_0xa783('0x36')]:_0x4b9563['model'];_0xf3c81e[_0xa783('0x3a')]=qs[_0xa783('0x3b')](_0x438362['query'][_0xa783('0x3b')]);_0xf3c81e[_0xa783('0x3f')]=qs['filters'](_['pick'](_0x438362[_0xa783('0x31')],_0x4b9563[_0xa783('0x32')]));if(_0x438362['query'][_0xa783('0x3d')]){_0xf3c81e[_0xa783('0x3f')]=_[_0xa783('0x3e')](_0xf3c81e[_0xa783('0x3f')],{'$or':_[_0xa783('0x2f')](_0xf3c81e['attributes'],function(_0x27f20e){var _0xc571cd={};_0xc571cd[_0x27f20e]={'$like':'%'+_0x438362[_0xa783('0x31')][_0xa783('0x3d')]+'%'};return _0xc571cd;})});}_0xf3c81e=_[_0xa783('0x3e')]({},_0xf3c81e,_0x438362[_0xa783('0x42')]);return _0x2cb5ef[_0xa783('0x58')](_0xf3c81e);}})[_0xa783('0x21')](function(_0x53ea4c){if(_0x53ea4c){_0x641160=_0x53ea4c['length'];if(!_0x438362[_0xa783('0x31')][_0xa783('0x38')](_0xa783('0x39'))){_0xf3c81e[_0xa783('0x19')]=qs[_0xa783('0x19')](_0x438362[_0xa783('0x31')]['limit']);_0xf3c81e['offset']=qs['offset'](_0x438362['query'][_0xa783('0x1b')]);}return _0x2cb5ef[_0xa783('0x58')](_0xf3c81e);}})[_0xa783('0x21')](function(_0x25fc9a){if(_0x25fc9a){return _0x25fc9a?{'count':_0x641160,'rows':_0x25fc9a}:null;}})[_0xa783('0x21')](respondWithResult(_0x31fe8e,null))[_0xa783('0x46')](handleError(_0x31fe8e,null));};exports[_0xa783('0x59')]=function(_0x1836d7,_0x23c2f7,_0x5f2e13){var _0x14c5ac={};var _0x39a875={};var _0x19809f;var _0x2fe9c9;return db[_0xa783('0x2b')][_0xa783('0x57')]({'where':{'id':_0x1836d7['params']['id']}})[_0xa783('0x21')](handleEntityNotFound(_0x23c2f7,null))[_0xa783('0x21')](function(_0x483bc5){if(_0x483bc5){_0x19809f=_0x483bc5;_0x39a875[_0xa783('0x34')]=_[_0xa783('0x30')](db[_0xa783('0x54')][_0xa783('0x2c')]);_0x39a875[_0xa783('0x31')]=_['keys'](_0x1836d7[_0xa783('0x31')]);_0x39a875[_0xa783('0x32')]=_[_0xa783('0x33')](_0x39a875[_0xa783('0x34')],_0x39a875[_0xa783('0x31')]);_0x14c5ac['attributes']=_['intersection'](_0x39a875['model'],qs[_0xa783('0x35')](_0x1836d7[_0xa783('0x31')][_0xa783('0x35')]));_0x14c5ac[_0xa783('0x36')]=_0x14c5ac[_0xa783('0x36')][_0xa783('0x37')]?_0x14c5ac[_0xa783('0x36')]:_0x39a875[_0xa783('0x34')];_0x14c5ac[_0xa783('0x3a')]=qs[_0xa783('0x3b')](_0x1836d7[_0xa783('0x31')]['sort']);_0x14c5ac[_0xa783('0x3f')]=qs['filters'](_[_0xa783('0x3c')](_0x1836d7[_0xa783('0x31')],_0x39a875['filters']));if(_0x1836d7['query'][_0xa783('0x3d')]){_0x14c5ac[_0xa783('0x3f')]=_['merge'](_0x14c5ac['where'],{'$or':_[_0xa783('0x2f')](_0x14c5ac[_0xa783('0x36')],function(_0xd319f){var _0x4c6dc8={};_0x4c6dc8[_0xd319f]={'$like':'%'+_0x1836d7[_0xa783('0x31')][_0xa783('0x3d')]+'%'};return _0x4c6dc8;})});}_0x14c5ac=_[_0xa783('0x3e')]({},_0x14c5ac,_0x1836d7[_0xa783('0x42')]);return _0x19809f[_0xa783('0x59')](_0x14c5ac);}})[_0xa783('0x21')](function(_0x3fe42f){if(_0x3fe42f){_0x2fe9c9=_0x3fe42f[_0xa783('0x37')];if(!_0x1836d7['query'][_0xa783('0x38')](_0xa783('0x39'))){_0x14c5ac[_0xa783('0x19')]=qs[_0xa783('0x19')](_0x1836d7[_0xa783('0x31')][_0xa783('0x19')]);_0x14c5ac[_0xa783('0x1b')]=qs[_0xa783('0x1b')](_0x1836d7['query']['offset']);}return _0x19809f[_0xa783('0x59')](_0x14c5ac);}})[_0xa783('0x21')](function(_0x259135){if(_0x259135){return _0x259135?{'count':_0x2fe9c9,'rows':_0x259135}:null;}})['then'](respondWithResult(_0x23c2f7,null))['catch'](handleError(_0x23c2f7,null));};exports['addAction']=function(_0x30ad7d,_0x325329,_0x4c8e71){if(_0x30ad7d['body']['id']){delete _0x30ad7d[_0xa783('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x30ad7d[_0xa783('0x52')]['id']}})[_0xa783('0x21')](handleEntityNotFound(_0x325329,null))[_0xa783('0x21')](function(_0x594a3e){if(_0x594a3e){_0x30ad7d[_0xa783('0x4a')][_0xa783('0x5a')]=_0x594a3e['id'];return db['Action'][_0xa783('0x49')](_0x30ad7d[_0xa783('0x4a')]);}})[_0xa783('0x21')](respondWithResult(_0x325329,null))[_0xa783('0x46')](handleError(_0x325329,null));};exports[_0xa783('0x5b')]=function(_0x330821,_0x586738,_0x4f1c86){var _0x27bae5={};var _0x301b4c={};var _0x54a60b;var _0xbe3a3c;return db['Trigger'][_0xa783('0x57')]({'where':{'id':_0x330821[_0xa783('0x52')]['id']}})[_0xa783('0x21')](handleEntityNotFound(_0x586738,null))[_0xa783('0x21')](function(_0x33d42c){if(_0x33d42c){_0x54a60b=_0x33d42c;_0x301b4c['model']=_[_0xa783('0x30')](db[_0xa783('0x5c')][_0xa783('0x2c')]);_0x301b4c['query']=_[_0xa783('0x30')](_0x330821['query']);_0x301b4c[_0xa783('0x32')]=_['intersection'](_0x301b4c[_0xa783('0x34')],_0x301b4c[_0xa783('0x31')]);_0x27bae5[_0xa783('0x36')]=_[_0xa783('0x33')](_0x301b4c[_0xa783('0x34')],qs[_0xa783('0x35')](_0x330821['query']['fields']));_0x27bae5[_0xa783('0x36')]=_0x27bae5['attributes']['length']?_0x27bae5[_0xa783('0x36')]:_0x301b4c[_0xa783('0x34')];_0x27bae5[_0xa783('0x3a')]=qs[_0xa783('0x3b')](_0x330821[_0xa783('0x31')][_0xa783('0x3b')]);_0x27bae5['where']=qs[_0xa783('0x32')](_[_0xa783('0x3c')](_0x330821[_0xa783('0x31')],_0x301b4c['filters']));if(_0x330821['query'][_0xa783('0x3d')]){_0x27bae5[_0xa783('0x3f')]=_[_0xa783('0x3e')](_0x27bae5['where'],{'$or':_[_0xa783('0x2f')](_0x27bae5[_0xa783('0x36')],function(_0x389b93){var _0x2dd563={};_0x2dd563[_0x389b93]={'$like':'%'+_0x330821[_0xa783('0x31')][_0xa783('0x3d')]+'%'};return _0x2dd563;})});}_0x27bae5=_[_0xa783('0x3e')]({},_0x27bae5,_0x330821[_0xa783('0x42')]);return _0x54a60b[_0xa783('0x5b')](_0x27bae5);}})['then'](function(_0x14e0c5){if(_0x14e0c5){_0xbe3a3c=_0x14e0c5['length'];if(!_0x330821[_0xa783('0x31')][_0xa783('0x38')]('nolimit')){_0x27bae5[_0xa783('0x19')]=qs['limit'](_0x330821[_0xa783('0x31')][_0xa783('0x19')]);_0x27bae5['offset']=qs[_0xa783('0x1b')](_0x330821['query'][_0xa783('0x1b')]);}return _0x54a60b[_0xa783('0x5b')](_0x27bae5);}})[_0xa783('0x21')](function(_0x3648ad){if(_0x3648ad){return _0x3648ad?{'count':_0xbe3a3c,'rows':_0x3648ad}:null;}})[_0xa783('0x21')](respondWithResult(_0x586738,null))[_0xa783('0x46')](handleError(_0x586738,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 19effe6..e31c84c 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 _0xf874=['path','../../config/environment','./trigger.attributes','exports','define','tools_triggers','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf874,0xed));var _0x4f87=function(_0x25ec6c,_0x288a26){_0x25ec6c=_0x25ec6c-0x0;var _0x41a304=_0xf874[_0x25ec6c];return _0x41a304;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f87('0x0'))(_0x4f87('0x1'));var moment=require(_0x4f87('0x2'));var BPromise=require(_0x4f87('0x3'));var rp=require(_0x4f87('0x4'));var fs=require('fs');var path=require(_0x4f87('0x5'));var rimraf=require('rimraf');var config=require(_0x4f87('0x6'));var attributes=require(_0x4f87('0x7'));module[_0x4f87('0x8')]=function(_0xf0ffb3,_0x104682){return _0xf0ffb3[_0x4f87('0x9')]('Trigger',attributes,{'tableName':_0x4f87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a25=['path','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x4a25,0x1d4));var _0x54a2=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x4a25[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var logger=require(_0x54a2('0x1'))('api');var moment=require(_0x54a2('0x2'));var BPromise=require(_0x54a2('0x3'));var rp=require(_0x54a2('0x4'));var fs=require('fs');var path=require(_0x54a2('0x5'));var rimraf=require('rimraf');var config=require(_0x54a2('0x6'));var attributes=require(_0x54a2('0x7'));module[_0x54a2('0x8')]=function(_0x3ecde5,_0x472eed){return _0x3ecde5['define'](_0x54a2('0x9'),attributes,{'tableName':_0x54a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index a0dd4a1..40260df 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 _0x46b7=['rpc','../../config/environment','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowTrigger','lodash','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x46b7,0x10b));var _0x746b=function(_0x1ba08c,_0x3b8ca1){_0x1ba08c=_0x1ba08c-0x0;var _0x18719f=_0x46b7[_0x1ba08c];return _0x18719f;};'use strict';var _=require(_0x746b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x746b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x746b('0x2'));var db=require(_0x746b('0x3'))['db'];var utils=require(_0x746b('0x4'));var logger=require('../../config/logger')(_0x746b('0x5'));var config=require(_0x746b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x746b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x599605,_0x43d1a1,_0x5f34f5){return new BPromise(function(_0x3a11cc,_0x39990d){return client[_0x746b('0x8')](_0x599605,_0x5f34f5)[_0x746b('0x9')](function(_0x21e5a9){logger[_0x746b('0xa')](_0x746b('0xb'),_0x43d1a1,_0x746b('0xc'));logger[_0x746b('0xd')](_0x746b('0xe'),_0x43d1a1,_0x746b('0xc'),JSON[_0x746b('0xf')](_0x21e5a9));if(_0x21e5a9['error']){if(_0x21e5a9['error'][_0x746b('0x10')]===0x1f4){logger[_0x746b('0x11')](_0x746b('0xb'),_0x43d1a1,_0x21e5a9[_0x746b('0x11')]['message']);return _0x39990d(_0x21e5a9[_0x746b('0x11')][_0x746b('0x12')]);}logger[_0x746b('0x11')](_0x746b('0xb'),_0x43d1a1,_0x21e5a9[_0x746b('0x11')][_0x746b('0x12')]);return _0x3a11cc(_0x21e5a9[_0x746b('0x11')][_0x746b('0x12')]);}else{logger[_0x746b('0xa')](_0x746b('0xb'),_0x43d1a1,_0x746b('0xc'));_0x3a11cc(_0x21e5a9[_0x746b('0x13')][_0x746b('0x12')]);}})[_0x746b('0x14')](function(_0x3b5200){logger[_0x746b('0x11')](_0x746b('0xb'),_0x43d1a1,_0x3b5200);_0x39990d(_0x3b5200);});});}exports[_0x746b('0x15')]=function(_0x3de789){var _0x2a7ef2=this;return new Promise(function(_0x1ba971,_0x26a650){return db[_0x746b('0x16')][_0x746b('0x17')]({'raw':_0x3de789[_0x746b('0x18')]?_0x3de789[_0x746b('0x18')][_0x746b('0x19')]===undefined?!![]:![]:!![],'where':_0x3de789['options']?_0x3de789[_0x746b('0x18')][_0x746b('0x1a')]||null:null,'attributes':_0x3de789[_0x746b('0x18')]?_0x3de789[_0x746b('0x18')][_0x746b('0x1b')]||null:null,'limit':_0x3de789[_0x746b('0x18')]?_0x3de789[_0x746b('0x18')][_0x746b('0x1c')]||null:null,'include':_0x3de789[_0x746b('0x18')]?_0x3de789[_0x746b('0x18')][_0x746b('0x1d')]?_['map'](_0x3de789[_0x746b('0x18')][_0x746b('0x1d')],function(_0x196c2c){return{'model':db[_0x196c2c['model']],'as':_0x196c2c['as'],'attributes':_0x196c2c[_0x746b('0x1b')],'include':_0x196c2c[_0x746b('0x1d')]?_['map'](_0x196c2c[_0x746b('0x1d')],function(_0x4f0eae){return{'model':db[_0x4f0eae['model']],'as':_0x4f0eae['as'],'attributes':_0x4f0eae[_0x746b('0x1b')],'include':_0x4f0eae[_0x746b('0x1d')]?_[_0x746b('0x1e')](_0x4f0eae[_0x746b('0x1d')],function(_0xe91c7f){return{'model':db[_0xe91c7f[_0x746b('0x1f')]],'as':_0xe91c7f['as'],'attributes':_0xe91c7f[_0x746b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x746b('0x9')](function(_0x1d138f){logger[_0x746b('0xa')](_0x746b('0x15'),_0x3de789);logger['debug'](_0x746b('0x15'),_0x3de789,JSON[_0x746b('0xf')](_0x1d138f));_0x1ba971(_0x1d138f);})[_0x746b('0x14')](function(_0x585c13){logger[_0x746b('0x11')](_0x746b('0x15'),_0x585c13[_0x746b('0x12')],_0x3de789);_0x26a650(_0x2a7ef2[_0x746b('0x11')](0x1f4,_0x585c13[_0x746b('0x12')]));});});};exports['ShowTrigger']=function(_0x188901){var _0x590266=this;return new Promise(function(_0x52d16e,_0x353bbd){return db[_0x746b('0x16')][_0x746b('0x20')]({'raw':_0x188901[_0x746b('0x18')]?_0x188901[_0x746b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x188901[_0x746b('0x18')]?_0x188901['options'][_0x746b('0x1a')]||null:null,'attributes':_0x188901['options']?_0x188901[_0x746b('0x18')][_0x746b('0x1b')]||null:null,'include':_0x188901['options']?_0x188901[_0x746b('0x18')][_0x746b('0x1d')]?_[_0x746b('0x1e')](_0x188901[_0x746b('0x18')][_0x746b('0x1d')],function(_0xa4e115){return{'model':db[_0xa4e115[_0x746b('0x1f')]],'as':_0xa4e115['as'],'attributes':_0xa4e115[_0x746b('0x1b')],'include':_0xa4e115[_0x746b('0x1d')]?_[_0x746b('0x1e')](_0xa4e115[_0x746b('0x1d')],function(_0x5b8231){return{'model':db[_0x5b8231['model']],'as':_0x5b8231['as'],'attributes':_0x5b8231[_0x746b('0x1b')],'include':_0x5b8231[_0x746b('0x1d')]?_[_0x746b('0x1e')](_0x5b8231[_0x746b('0x1d')],function(_0x4615a4){return{'model':db[_0x4615a4[_0x746b('0x1f')]],'as':_0x4615a4['as'],'attributes':_0x4615a4[_0x746b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42c40e){logger[_0x746b('0xa')](_0x746b('0x21'),_0x188901);logger[_0x746b('0xd')]('ShowTrigger',_0x188901,JSON['stringify'](_0x42c40e));_0x52d16e(_0x42c40e);})['catch'](function(_0x2224a7){logger[_0x746b('0x11')](_0x746b('0x21'),_0x2224a7[_0x746b('0x12')],_0x188901);_0x353bbd(_0x590266[_0x746b('0x11')](0x1f4,_0x2224a7[_0x746b('0x12')]));});});}; \ No newline at end of file +var _0x6050=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','ShowTrigger','find','util','moment','bluebird'];(function(_0x4d230a,_0x1b9760){var _0x1a06c5=function(_0x305bd8){while(--_0x305bd8){_0x4d230a['push'](_0x4d230a['shift']());}};_0x1a06c5(++_0x1b9760);}(_0x6050,0x15b));var _0x0605=function(_0x4d1b27,_0x85a9b1){_0x4d1b27=_0x4d1b27-0x0;var _0xce8835=_0x6050[_0x4d1b27];return _0xce8835;};'use strict';var _=require('lodash');var util=require(_0x0605('0x0'));var moment=require(_0x0605('0x1'));var BPromise=require(_0x0605('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0605('0x3'));var db=require(_0x0605('0x4'))['db'];var utils=require(_0x0605('0x5'));var logger=require(_0x0605('0x6'))('rpc');var config=require(_0x0605('0x7'));var jayson=require(_0x0605('0x8'));var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13820d,_0x37d5c4,_0x110adc){return new BPromise(function(_0x10a59b,_0x1d7a6b){return client[_0x0605('0xa')](_0x13820d,_0x110adc)[_0x0605('0xb')](function(_0xcd88c5){logger[_0x0605('0xc')](_0x0605('0xd'),_0x37d5c4,'request\x20sent');logger[_0x0605('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x37d5c4,_0x0605('0xf'),JSON[_0x0605('0x10')](_0xcd88c5));if(_0xcd88c5[_0x0605('0x11')]){if(_0xcd88c5[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x37d5c4,_0xcd88c5[_0x0605('0x11')][_0x0605('0x13')]);return _0x1d7a6b(_0xcd88c5[_0x0605('0x11')]['message']);}logger[_0x0605('0x11')](_0x0605('0xd'),_0x37d5c4,_0xcd88c5[_0x0605('0x11')][_0x0605('0x13')]);return _0x10a59b(_0xcd88c5[_0x0605('0x11')][_0x0605('0x13')]);}else{logger[_0x0605('0xc')](_0x0605('0xd'),_0x37d5c4,_0x0605('0xf'));_0x10a59b(_0xcd88c5[_0x0605('0x14')][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0x301b2f){logger[_0x0605('0x11')](_0x0605('0xd'),_0x37d5c4,_0x301b2f);_0x1d7a6b(_0x301b2f);});});}exports[_0x0605('0x16')]=function(_0x93b67d){var _0x1b119f=this;return new Promise(function(_0x3ebb67,_0x76966e){return db[_0x0605('0x17')][_0x0605('0x18')]({'raw':_0x93b67d[_0x0605('0x19')]?_0x93b67d['options'][_0x0605('0x1a')]===undefined?!![]:![]:!![],'where':_0x93b67d[_0x0605('0x19')]?_0x93b67d[_0x0605('0x19')][_0x0605('0x1b')]||null:null,'attributes':_0x93b67d['options']?_0x93b67d[_0x0605('0x19')]['attributes']||null:null,'limit':_0x93b67d[_0x0605('0x19')]?_0x93b67d[_0x0605('0x19')][_0x0605('0x1c')]||null:null,'include':_0x93b67d[_0x0605('0x19')]?_0x93b67d[_0x0605('0x19')][_0x0605('0x1d')]?_[_0x0605('0x1e')](_0x93b67d['options']['include'],function(_0x33d825){return{'model':db[_0x33d825['model']],'as':_0x33d825['as'],'attributes':_0x33d825['attributes'],'include':_0x33d825['include']?_['map'](_0x33d825[_0x0605('0x1d')],function(_0xeaac2e){return{'model':db[_0xeaac2e[_0x0605('0x1f')]],'as':_0xeaac2e['as'],'attributes':_0xeaac2e[_0x0605('0x20')],'include':_0xeaac2e[_0x0605('0x1d')]?_[_0x0605('0x1e')](_0xeaac2e['include'],function(_0x204e3f){return{'model':db[_0x204e3f[_0x0605('0x1f')]],'as':_0x204e3f['as'],'attributes':_0x204e3f[_0x0605('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0605('0xb')](function(_0x6c5340){logger[_0x0605('0xc')]('GetTrigger',_0x93b67d);logger[_0x0605('0xe')](_0x0605('0x16'),_0x93b67d,JSON[_0x0605('0x10')](_0x6c5340));_0x3ebb67(_0x6c5340);})[_0x0605('0x15')](function(_0xae1228){logger[_0x0605('0x11')](_0x0605('0x16'),_0xae1228['message'],_0x93b67d);_0x76966e(_0x1b119f[_0x0605('0x11')](0x1f4,_0xae1228[_0x0605('0x13')]));});});};exports[_0x0605('0x21')]=function(_0x5a420c){var _0x19cb28=this;return new Promise(function(_0xce2593,_0x2debdb){return db[_0x0605('0x17')][_0x0605('0x22')]({'raw':_0x5a420c[_0x0605('0x19')]?_0x5a420c[_0x0605('0x19')][_0x0605('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a420c[_0x0605('0x19')]?_0x5a420c[_0x0605('0x19')][_0x0605('0x1b')]||null:null,'attributes':_0x5a420c[_0x0605('0x19')]?_0x5a420c[_0x0605('0x19')][_0x0605('0x20')]||null:null,'include':_0x5a420c['options']?_0x5a420c[_0x0605('0x19')][_0x0605('0x1d')]?_[_0x0605('0x1e')](_0x5a420c[_0x0605('0x19')][_0x0605('0x1d')],function(_0x491e04){return{'model':db[_0x491e04[_0x0605('0x1f')]],'as':_0x491e04['as'],'attributes':_0x491e04['attributes'],'include':_0x491e04[_0x0605('0x1d')]?_['map'](_0x491e04[_0x0605('0x1d')],function(_0x6df823){return{'model':db[_0x6df823[_0x0605('0x1f')]],'as':_0x6df823['as'],'attributes':_0x6df823[_0x0605('0x20')],'include':_0x6df823[_0x0605('0x1d')]?_[_0x0605('0x1e')](_0x6df823[_0x0605('0x1d')],function(_0x205c6b){return{'model':db[_0x205c6b[_0x0605('0x1f')]],'as':_0x205c6b['as'],'attributes':_0x205c6b[_0x0605('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31ef41){logger['info']('ShowTrigger',_0x5a420c);logger[_0x0605('0xe')](_0x0605('0x21'),_0x5a420c,JSON[_0x0605('0x10')](_0x31ef41));_0xce2593(_0x31ef41);})['catch'](function(_0x1f1a14){logger[_0x0605('0x11')](_0x0605('0x21'),_0x1f1a14['message'],_0x5a420c);_0x2debdb(_0x19cb28[_0x0605('0x11')](0x1f4,_0x1f1a14[_0x0605('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 54b0c21..9f82d61 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 _0x3031=['./trunk.controller','isAuthenticated','index','get','/:id','post','/:id/clone','clone','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0x3031,0x70));var _0x1303=function(_0x5e23d4,_0x54bf44){_0x5e23d4=_0x5e23d4-0x0;var _0x2b32a3=_0x3031[_0x5e23d4];return _0x2b32a3;};'use strict';var multer=require(_0x1303('0x0'));var util=require('util');var path=require(_0x1303('0x1'));var timeout=require(_0x1303('0x2'));var express=require(_0x1303('0x3'));var router=express[_0x1303('0x4')]();var fs_extra=require(_0x1303('0x5'));var auth=require(_0x1303('0x6'));var interaction=require(_0x1303('0x7'));var config=require('../../config/environment');var controller=require(_0x1303('0x8'));router['get']('/',auth[_0x1303('0x9')](),controller[_0x1303('0xa')]);router[_0x1303('0xb')](_0x1303('0xc'),auth[_0x1303('0x9')](),controller['show']);router[_0x1303('0xd')](_0x1303('0xe'),auth[_0x1303('0x9')](),controller[_0x1303('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1303('0x10')](_0x1303('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1303('0x11')](_0x1303('0xc'),auth[_0x1303('0x9')](),controller[_0x1303('0x12')]);module[_0x1303('0x13')]=router; \ No newline at end of file +var _0xbce6=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','post','clone','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbce6,0x1c8));var _0x6bce=function(_0x4255ed,_0x195ff6){_0x4255ed=_0x4255ed-0x0;var _0x1de65b=_0xbce6[_0x4255ed];return _0x1de65b;};'use strict';var multer=require(_0x6bce('0x0'));var util=require(_0x6bce('0x1'));var path=require(_0x6bce('0x2'));var timeout=require(_0x6bce('0x3'));var express=require('express');var router=express[_0x6bce('0x4')]();var fs_extra=require(_0x6bce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6bce('0x6'));var config=require(_0x6bce('0x7'));var controller=require(_0x6bce('0x8'));router[_0x6bce('0x9')]('/',auth[_0x6bce('0xa')](),controller[_0x6bce('0xb')]);router[_0x6bce('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6bce('0xc')]('/:id/clone',auth['isAuthenticated'](),controller[_0x6bce('0xd')]);router[_0x6bce('0xc')]('/',auth[_0x6bce('0xa')](),controller[_0x6bce('0xe')]);router[_0x6bce('0xf')](_0x6bce('0x10'),auth[_0x6bce('0xa')](),controller[_0x6bce('0x11')]);router[_0x6bce('0x12')](_0x6bce('0x10'),auth[_0x6bce('0xa')](),controller[_0x6bce('0x13')]);module[_0x6bce('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 44749e4..9f8fc2b 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 _0x00cb=['force_rport,comedia','setDataValue','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update','BOOLEAN','exports','name','ENUM','peer','friend','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x00cb,0x1ef));var _0xb00c=function(_0x403330,_0x2edc43){_0x403330=_0x403330-0x0;var _0x3f0afd=_0x00cb[_0x403330];return _0x3f0afd;};'use strict';var Sequelize=require('sequelize');module[_0xb00c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb00c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb00c('0x2')]('friend','user',_0xb00c('0x3')),'allowNull':![],'defaultValue':_0xb00c('0x4')},'context':{'type':Sequelize[_0xb00c('0x5')],'allowNull':![],'defaultValue':_0xb00c('0x6')},'callingpres':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x7'),_0xb00c('0x8'),_0xb00c('0x9'),_0xb00c('0xa'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xb00c('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xb00c('0x5')]},'permit':{'type':Sequelize[_0xb00c('0x5')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xb00c('0x5')]},'remotesecret':{'type':Sequelize[_0xb00c('0x5')]},'transport':{'type':Sequelize[_0xb00c('0x5')],'defaultValue':'udp','set':function(_0x24d067){this['setDataValue'](_0xb00c('0xc'),_0x24d067?_0x24d067[_0xb00c('0xd')](','):null);},'get':function(){return this['getDataValue'](_0xb00c('0xc'))?this[_0xb00c('0xe')](_0xb00c('0xc'))[_0xb00c('0xf')](','):null;},'comment':_0xb00c('0x10')},'dtmfmode':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x11'),_0xb00c('0x12'),_0xb00c('0x13'),_0xb00c('0x14'),_0xb00c('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no',_0xb00c('0x17'),'update',_0xb00c('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb00c('0x5')]},'directmediadeny':{'type':Sequelize[_0xb00c('0x5')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xb00c('0x19'),'set':function(_0x1034c6){this[_0xb00c('0x1a')](_0xb00c('0x1b'),_0x1034c6?_0x1034c6['join'](','):null);},'get':function(){return this[_0xb00c('0xe')]('nat')?this['getDataValue'](_0xb00c('0x1b'))[_0xb00c('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xb00c('0x5')]},'namedcallgroup':{'type':Sequelize[_0xb00c('0x5')]},'pickupgroup':{'type':Sequelize[_0xb00c('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xb00c('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xb00c('0x1c')},'allow':{'type':Sequelize[_0xb00c('0x5')],'allowNull':![],'defaultValue':_0xb00c('0x1d'),'set':function(_0x3a70f2){this[_0xb00c('0x1a')](_0xb00c('0x1e'),_0x3a70f2?_0x3a70f2['join'](';'):_0xb00c('0x1d'));},'get':function(){return this[_0xb00c('0xe')](_0xb00c('0x1e'))?this[_0xb00c('0xe')](_0xb00c('0x1e'))[_0xb00c('0xf')](';'):null;},'comment':_0xb00c('0x1f')},'autoframing':{'type':Sequelize[_0xb00c('0x2')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xb00c('0x20'),'set':function(_0x5db62d){this['setDataValue'](_0xb00c('0x21'),_0x5db62d?_0x5db62d[_0xb00c('0xd')](','):null);},'get':function(){return this[_0xb00c('0xe')](_0xb00c('0x21'))?this[_0xb00c('0xe')](_0xb00c('0x21'))[_0xb00c('0xf')](','):null;},'comment':_0xb00c('0x22')},'trustrpid':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no',_0xb00c('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'accountcode':{'type':Sequelize[_0xb00c('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xb00c('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':_0xb00c('0x16')},'busylevel':{'type':Sequelize[_0xb00c('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xb00c('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xb00c('0x5')]},'template':{'type':Sequelize[_0xb00c('0x5')]},'videosupport':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no',_0xb00c('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'mailbox':{'type':Sequelize[_0xb00c('0x5')]},'session_timers':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x27'),_0xb00c('0x28'),_0xb00c('0x29'))},'session_expires':{'type':Sequelize[_0xb00c('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xb00c('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x2a'),_0xb00c('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xb00c('0x5')]},'regexten':{'type':Sequelize[_0xb00c('0x5')]},'fromdomain':{'type':Sequelize[_0xb00c('0x5')]},'fromuser':{'type':Sequelize[_0xb00c('0x5')]},'port':{'type':Sequelize[_0xb00c('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no'),'defaultValue':_0xb00c('0x16')},'keepalive':{'type':Sequelize[_0xb00c('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xb00c('0x5')]},'defaultuser':{'type':Sequelize[_0xb00c('0x5')]},'rtptimeout':{'type':Sequelize[_0xb00c('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xb00c('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no',_0xb00c('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb00c('0x5')]},'callbackextension':{'type':Sequelize[_0xb00c('0x5')]},'timert1':{'type':Sequelize[_0xb00c('0x24')](0xb)},'timerb':{'type':Sequelize[_0xb00c('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xb00c('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xb00c('0x5')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xb00c('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0xb00c('0x5')]},'use_q850_reason':{'type':Sequelize[_0xb00c('0x5')]},'maxforwards':{'type':Sequelize[_0xb00c('0x24')](0xb)},'encryption':{'type':Sequelize[_0xb00c('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb00c('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0xb00c('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no',_0xb00c('0x2d'),_0xb00c('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xb00c('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xb00c('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0xb00c('0x5')]},'dtlscipher':{'type':Sequelize[_0xb00c('0x5')]},'dtlscafile':{'type':Sequelize[_0xb00c('0x5')]},'dtlscapath':{'type':Sequelize[_0xb00c('0x5')]},'dtlssetup':{'type':Sequelize[_0xb00c('0x2')]('active',_0xb00c('0x2f'),_0xb00c('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb00c('0x5')]},'usereqphone':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb00c('0x5')]},'recordofffeature':{'type':Sequelize[_0xb00c('0x5')]},'call_limit':{'type':Sequelize[_0xb00c('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xb00c('0x5')]},'mohsuggest':{'type':Sequelize[_0xb00c('0x5')]},'parkinglot':{'type':Sequelize[_0xb00c('0x5')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00c('0x5')],'defaultValue':_0xb00c('0x31')},'canreinvite':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no',_0xb00c('0x17'),_0xb00c('0x32'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb00c('0x5')]},'otherFields':{'type':Sequelize[_0xb00c('0x5')]},'active':{'type':Sequelize[_0xb00c('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xbd3a=['pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','rfc2833','info','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','split','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas'];(function(_0x27e7de,_0x34f1fe){var _0x62b85b=function(_0x532a97){while(--_0x532a97){_0x27e7de['push'](_0x27e7de['shift']());}};_0x62b85b(++_0x34f1fe);}(_0xbd3a,0x6c));var _0xabd3=function(_0x3cd451,_0x26e81a){_0x3cd451=_0x3cd451-0x0;var _0x571ce6=_0xbd3a[_0x3cd451];return _0x571ce6;};'use strict';var Sequelize=require(_0xabd3('0x0'));module[_0xabd3('0x1')]={'name':{'type':Sequelize[_0xabd3('0x2')],'allowNull':![],'unique':_0xabd3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xabd3('0x4')]('friend',_0xabd3('0x5'),'peer'),'allowNull':![],'defaultValue':_0xabd3('0x6')},'context':{'type':Sequelize[_0xabd3('0x2')],'allowNull':![],'defaultValue':_0xabd3('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xabd3('0x8'),'ALLOWED_PASSED_SCREEN',_0xabd3('0x9'),'ALLOWED',_0xabd3('0xa'),_0xabd3('0xb'),'PROHIB_FAILED_SCREEN',_0xabd3('0xc'))},'deny':{'type':Sequelize[_0xabd3('0x2')]},'permit':{'type':Sequelize[_0xabd3('0x2')]},'secret':{'type':Sequelize[_0xabd3('0x2')]},'md5secret':{'type':Sequelize[_0xabd3('0x2')]},'remotesecret':{'type':Sequelize[_0xabd3('0x2')]},'transport':{'type':Sequelize[_0xabd3('0x2')],'defaultValue':_0xabd3('0xd'),'set':function(_0x2c4ca2){this[_0xabd3('0xe')](_0xabd3('0xf'),_0x2c4ca2?_0x2c4ca2[_0xabd3('0x10')](','):null);},'get':function(){return this[_0xabd3('0x11')](_0xabd3('0xf'))?this[_0xabd3('0x11')](_0xabd3('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xabd3('0x12'),_0xabd3('0x13'),'shortinfo','inband',_0xabd3('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no','nonat',_0xabd3('0x16'),_0xabd3('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xabd3('0x2')]},'directmediadeny':{'type':Sequelize[_0xabd3('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xabd3('0x18'),'set':function(_0x4b5afd){this[_0xabd3('0xe')](_0xabd3('0x19'),_0x4b5afd?_0x4b5afd[_0xabd3('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xabd3('0x19'))?this[_0xabd3('0x11')](_0xabd3('0x19'))['split'](','):null;},'comment':_0xabd3('0x1a')},'callgroup':{'type':Sequelize[_0xabd3('0x2')]},'namedcallgroup':{'type':Sequelize[_0xabd3('0x2')]},'pickupgroup':{'type':Sequelize[_0xabd3('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xabd3('0x2')]},'language':{'type':Sequelize[_0xabd3('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xabd3('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xabd3('0x2')],'allowNull':![],'defaultValue':_0xabd3('0x1b'),'set':function(_0x120f09){this[_0xabd3('0xe')]('allow',_0x120f09?_0x120f09['join'](';'):_0xabd3('0x1b'));},'get':function(){return this['getDataValue'](_0xabd3('0x1c'))?this[_0xabd3('0x11')]('allow')[_0xabd3('0x1d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0xabd3('0x2')],'defaultValue':'port,invite','set':function(_0x91bab5){this[_0xabd3('0xe')](_0xabd3('0x1e'),_0x91bab5?_0x91bab5[_0xabd3('0x10')](','):null);},'get':function(){return this[_0xabd3('0x11')](_0xabd3('0x1e'))?this[_0xabd3('0x11')](_0xabd3('0x1e'))[_0xabd3('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xabd3('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no',_0xabd3('0x1f'))},'promiscredir':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'accountcode':{'type':Sequelize[_0xabd3('0x20')](0xb)},'setvar':{'type':Sequelize[_0xabd3('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xabd3('0x21')},'amaflags':{'type':Sequelize[_0xabd3('0x2')]},'callcounter':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no'),'defaultValue':_0xabd3('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xabd3('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0xabd3('0x2')]},'template':{'type':Sequelize[_0xabd3('0x2')]},'videosupport':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no',_0xabd3('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xabd3('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'mailbox':{'type':Sequelize[_0xabd3('0x2')]},'session_timers':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x23'),_0xabd3('0x24'),_0xabd3('0x25'))},'session_expires':{'type':Sequelize[_0xabd3('0x20')](0xb)},'session_minse':{'type':Sequelize[_0xabd3('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0xabd3('0x4')]('uac',_0xabd3('0x26')),'defaultValue':_0xabd3('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xabd3('0x2')]},'regexten':{'type':Sequelize[_0xabd3('0x2')]},'fromdomain':{'type':Sequelize[_0xabd3('0x2')]},'fromuser':{'type':Sequelize[_0xabd3('0x2')]},'port':{'type':Sequelize[_0xabd3('0x20')](0x5)},'qualify':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xabd3('0x2')]},'defaultuser':{'type':Sequelize[_0xabd3('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xabd3('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xabd3('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no',_0xabd3('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xabd3('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xabd3('0x20')](0xb)},'timerb':{'type':Sequelize[_0xabd3('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0xabd3('0x20')](0xb)},'contactpermit':{'type':Sequelize[_0xabd3('0x2')]},'contactdeny':{'type':Sequelize[_0xabd3('0x2')]},'contactacl':{'type':Sequelize[_0xabd3('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xabd3('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'force_avp':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'icesupport':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no',_0xabd3('0x28'),_0xabd3('0x29'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xabd3('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xabd3('0x2')]},'dtlssetup':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x2a'),_0xabd3('0x2b'),_0xabd3('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xabd3('0x2')]},'recordofffeature':{'type':Sequelize[_0xabd3('0x2')]},'call_limit':{'type':Sequelize[_0xabd3('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no')},'vmexten':{'type':Sequelize[_0xabd3('0x2')]},'mohinterpret':{'type':Sequelize[_0xabd3('0x2')]},'mohsuggest':{'type':Sequelize[_0xabd3('0x2')]},'parkinglot':{'type':Sequelize[_0xabd3('0x2')]},'description':{'type':Sequelize[_0xabd3('0x2')]},'host':{'type':Sequelize[_0xabd3('0x2')],'defaultValue':_0xabd3('0x2d')},'canreinvite':{'type':Sequelize[_0xabd3('0x4')](_0xabd3('0x15'),'no',_0xabd3('0x2e'),'update',_0xabd3('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xabd3('0x2')]},'otherFields':{'type':Sequelize[_0xabd3('0x2')]},'active':{'type':Sequelize[_0xabd3('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xabd3('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 0d1512f..c668703 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 _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x526dc2,_0x37ebb8){var _0x54e521=function(_0x186bfb){while(--_0x186bfb){_0x526dc2['push'](_0x526dc2['shift']());}};_0x54e521(++_0x37ebb8);}(_0x9f62,0x154));var _0x29f6=function(_0x588bf6,_0xb73af3){_0x588bf6=_0x588bf6-0x0;var _0x3327eb=_0x9f62[_0x588bf6];return _0x3327eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file +var _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0x5c731b,_0x5d2cac){var _0x2d8f36=function(_0x45dffa){while(--_0x45dffa){_0x5c731b['push'](_0x5c731b['shift']());}};_0x2d8f36(++_0x5d2cac);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x14d70f,_0x56b0dc){_0x14d70f=_0x14d70f-0x0;var _0xd610b4=_0x6f0d[_0x14d70f];return _0xd610b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 485ab93..b329c5b 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 _0x919d=['api','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','util'];(function(_0x7e8e4,_0x8a8600){var _0x1f09e2=function(_0xd57505){while(--_0xd57505){_0x7e8e4['push'](_0x7e8e4['shift']());}};_0x1f09e2(++_0x8a8600);}(_0x919d,0xd6));var _0xd919=function(_0x5502a7,_0x325618){_0x5502a7=_0x5502a7-0x0;var _0x3946fa=_0x919d[_0x5502a7];return _0x3946fa;};'use strict';var _=require(_0xd919('0x0'));var util=require(_0xd919('0x1'));var logger=require('../../config/logger')(_0xd919('0x2'));var moment=require(_0xd919('0x3'));var BPromise=require(_0xd919('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd919('0x5'));var rimraf=require(_0xd919('0x6'));var config=require(_0xd919('0x7'));var attributes=require(_0xd919('0x8'));module['exports']=function(_0x263b4f,_0x350e98){return _0x263b4f[_0xd919('0x9')](_0xd919('0xa'),attributes,{'tableName':_0xd919('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c28=['rimraf','./trunk.attributes','define','Trunk','tools_trunks','lodash','api','moment','path'];(function(_0x5ec256,_0x386647){var _0x48953d=function(_0x5c5491){while(--_0x5c5491){_0x5ec256['push'](_0x5ec256['shift']());}};_0x48953d(++_0x386647);}(_0x6c28,0x113));var _0x86c2=function(_0x400096,_0x2c31f0){_0x400096=_0x400096-0x0;var _0x2cf4fc=_0x6c28[_0x400096];return _0x2cf4fc;};'use strict';var _=require(_0x86c2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x86c2('0x1'));var moment=require(_0x86c2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x86c2('0x3'));var rimraf=require(_0x86c2('0x4'));var config=require('../../config/environment');var attributes=require(_0x86c2('0x5'));module['exports']=function(_0x5e885f,_0x376667){return _0x5e885f[_0x86c2('0x6')](_0x86c2('0x7'),attributes,{'tableName':_0x86c2('0x8'),'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 a5b1447..cc922cc 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 _0xf4a4=['Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','ShowTrunk','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf4a4,0x1f2));var _0x4f4a=function(_0x29a497,_0x20a68f){_0x29a497=_0x29a497-0x0;var _0x52897d=_0xf4a4[_0x29a497];return _0x52897d;};'use strict';var _=require('lodash');var util=require(_0x4f4a('0x0'));var moment=require(_0x4f4a('0x1'));var BPromise=require(_0x4f4a('0x2'));var rs=require(_0x4f4a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f4a('0x4'))['db'];var utils=require(_0x4f4a('0x5'));var logger=require(_0x4f4a('0x6'))('rpc');var config=require(_0x4f4a('0x7'));var jayson=require(_0x4f4a('0x8'));var client=jayson[_0x4f4a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27144f,_0x36b7d8,_0xc94a87){return new BPromise(function(_0x314944,_0x3701bd){return client[_0x4f4a('0xa')](_0x27144f,_0xc94a87)[_0x4f4a('0xb')](function(_0x3cfdf2){logger['info'](_0x4f4a('0xc'),_0x36b7d8,'request\x20sent');logger[_0x4f4a('0xd')](_0x4f4a('0xe'),_0x36b7d8,_0x4f4a('0xf'),JSON[_0x4f4a('0x10')](_0x3cfdf2));if(_0x3cfdf2[_0x4f4a('0x11')]){if(_0x3cfdf2[_0x4f4a('0x11')]['code']===0x1f4){logger['error'](_0x4f4a('0xc'),_0x36b7d8,_0x3cfdf2['error'][_0x4f4a('0x12')]);return _0x3701bd(_0x3cfdf2[_0x4f4a('0x11')][_0x4f4a('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x36b7d8,_0x3cfdf2[_0x4f4a('0x11')][_0x4f4a('0x12')]);return _0x314944(_0x3cfdf2[_0x4f4a('0x11')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x36b7d8,_0x4f4a('0xf'));_0x314944(_0x3cfdf2[_0x4f4a('0x13')][_0x4f4a('0x12')]);}})['catch'](function(_0x20a91d){logger[_0x4f4a('0x11')](_0x4f4a('0xc'),_0x36b7d8,_0x20a91d);_0x3701bd(_0x20a91d);});});}exports[_0x4f4a('0x14')]=function(_0x56e5d3){var _0x29792a=this;return new Promise(function(_0x19d6b8,_0x18a2b4){return db[_0x4f4a('0x15')][_0x4f4a('0x16')]({'raw':_0x56e5d3[_0x4f4a('0x17')]?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x18')]===undefined?!![]:![]:!![],'where':_0x56e5d3[_0x4f4a('0x17')]?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x19')]||null:null,'attributes':_0x56e5d3[_0x4f4a('0x17')]?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x1a')]||null:null,'limit':_0x56e5d3['options']?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x1b')]||null:null,'include':_0x56e5d3[_0x4f4a('0x17')]?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x1c')]?_[_0x4f4a('0x1d')](_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x1c')],function(_0x1945f5){return{'model':db[_0x1945f5[_0x4f4a('0x1e')]],'as':_0x1945f5['as'],'attributes':_0x1945f5[_0x4f4a('0x1a')],'include':_0x1945f5[_0x4f4a('0x1c')]?_[_0x4f4a('0x1d')](_0x1945f5['include'],function(_0x2b6e17){return{'model':db[_0x2b6e17[_0x4f4a('0x1e')]],'as':_0x2b6e17['as'],'attributes':_0x2b6e17[_0x4f4a('0x1a')],'include':_0x2b6e17[_0x4f4a('0x1c')]?_[_0x4f4a('0x1d')](_0x2b6e17[_0x4f4a('0x1c')],function(_0x5b6e10){return{'model':db[_0x5b6e10[_0x4f4a('0x1e')]],'as':_0x5b6e10['as'],'attributes':_0x5b6e10[_0x4f4a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f4a('0xb')](function(_0x23a2f6){logger[_0x4f4a('0x1f')](_0x4f4a('0x14'),_0x56e5d3);logger[_0x4f4a('0xd')](_0x4f4a('0x14'),_0x56e5d3,JSON[_0x4f4a('0x10')](_0x23a2f6));_0x19d6b8(_0x23a2f6);})[_0x4f4a('0x20')](function(_0x3ec7c6){logger[_0x4f4a('0x11')](_0x4f4a('0x14'),_0x3ec7c6['message'],_0x56e5d3);_0x18a2b4(_0x29792a[_0x4f4a('0x11')](0x1f4,_0x3ec7c6['message']));});});};exports[_0x4f4a('0x21')]=function(_0x1a746a){var _0x3a71ba=this;return new Promise(function(_0x278196,_0x584155){return db[_0x4f4a('0x15')]['find']({'raw':_0x1a746a[_0x4f4a('0x17')]?_0x1a746a[_0x4f4a('0x17')][_0x4f4a('0x18')]===undefined?!![]:![]:!![],'where':_0x1a746a[_0x4f4a('0x17')]?_0x1a746a[_0x4f4a('0x17')][_0x4f4a('0x19')]||null:null,'attributes':_0x1a746a['options']?_0x1a746a[_0x4f4a('0x17')][_0x4f4a('0x1a')]||null:null,'include':_0x1a746a[_0x4f4a('0x17')]?_0x1a746a[_0x4f4a('0x17')][_0x4f4a('0x1c')]?_[_0x4f4a('0x1d')](_0x1a746a[_0x4f4a('0x17')]['include'],function(_0x5ce5af){return{'model':db[_0x5ce5af['model']],'as':_0x5ce5af['as'],'attributes':_0x5ce5af[_0x4f4a('0x1a')],'include':_0x5ce5af['include']?_['map'](_0x5ce5af[_0x4f4a('0x1c')],function(_0x4b5e3d){return{'model':db[_0x4b5e3d[_0x4f4a('0x1e')]],'as':_0x4b5e3d['as'],'attributes':_0x4b5e3d['attributes'],'include':_0x4b5e3d[_0x4f4a('0x1c')]?_['map'](_0x4b5e3d['include'],function(_0x17f4e0){return{'model':db[_0x17f4e0[_0x4f4a('0x1e')]],'as':_0x17f4e0['as'],'attributes':_0x17f4e0[_0x4f4a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f4a('0xb')](function(_0x470509){logger[_0x4f4a('0x1f')](_0x4f4a('0x21'),_0x1a746a);logger['debug']('ShowTrunk',_0x1a746a,JSON[_0x4f4a('0x10')](_0x470509));_0x278196(_0x470509);})['catch'](function(_0x3564cb){logger[_0x4f4a('0x11')](_0x4f4a('0x21'),_0x3564cb[_0x4f4a('0x12')],_0x1a746a);_0x584155(_0x3a71ba['error'](0x1f4,_0x3564cb['message']));});});}; \ No newline at end of file +var _0xff26=['model','find','where','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetTrunk','findAll','options','attributes','limit','include','map'];(function(_0x1e9d6a,_0x3e5cab){var _0x222bd1=function(_0x3e9c8f){while(--_0x3e9c8f){_0x1e9d6a['push'](_0x1e9d6a['shift']());}};_0x222bd1(++_0x3e5cab);}(_0xff26,0x1b6));var _0x6ff2=function(_0x174202,_0x5c5292){_0x174202=_0x174202-0x0;var _0x4daa4a=_0xff26[_0x174202];return _0x4daa4a;};'use strict';var _=require('lodash');var util=require(_0x6ff2('0x0'));var moment=require(_0x6ff2('0x1'));var BPromise=require(_0x6ff2('0x2'));var rs=require(_0x6ff2('0x3'));var fs=require('fs');var Redis=require(_0x6ff2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ff2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ff2('0x6')][_0x6ff2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a8b5b,_0x4b1765,_0x1ae8c9){return new BPromise(function(_0x4a3f09,_0x1118e0){return client['request'](_0x5a8b5b,_0x1ae8c9)[_0x6ff2('0x8')](function(_0x26ff82){logger[_0x6ff2('0x9')](_0x6ff2('0xa'),_0x4b1765,_0x6ff2('0xb'));logger[_0x6ff2('0xc')](_0x6ff2('0xd'),_0x4b1765,_0x6ff2('0xb'),JSON[_0x6ff2('0xe')](_0x26ff82));if(_0x26ff82['error']){if(_0x26ff82['error'][_0x6ff2('0xf')]===0x1f4){logger[_0x6ff2('0x10')]('Trunk,\x20%s,\x20%s',_0x4b1765,_0x26ff82[_0x6ff2('0x10')][_0x6ff2('0x11')]);return _0x1118e0(_0x26ff82[_0x6ff2('0x10')]['message']);}logger[_0x6ff2('0x10')](_0x6ff2('0xa'),_0x4b1765,_0x26ff82[_0x6ff2('0x10')][_0x6ff2('0x11')]);return _0x4a3f09(_0x26ff82[_0x6ff2('0x10')][_0x6ff2('0x11')]);}else{logger['info'](_0x6ff2('0xa'),_0x4b1765,_0x6ff2('0xb'));_0x4a3f09(_0x26ff82[_0x6ff2('0x12')][_0x6ff2('0x11')]);}})[_0x6ff2('0x13')](function(_0x3d0049){logger[_0x6ff2('0x10')](_0x6ff2('0xa'),_0x4b1765,_0x3d0049);_0x1118e0(_0x3d0049);});});}exports[_0x6ff2('0x14')]=function(_0x50a9d8){var _0x585be5=this;return new Promise(function(_0x53377e,_0x5267b0){return db['Trunk'][_0x6ff2('0x15')]({'raw':_0x50a9d8[_0x6ff2('0x16')]?_0x50a9d8[_0x6ff2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x50a9d8[_0x6ff2('0x16')]?_0x50a9d8['options']['where']||null:null,'attributes':_0x50a9d8[_0x6ff2('0x16')]?_0x50a9d8[_0x6ff2('0x16')][_0x6ff2('0x17')]||null:null,'limit':_0x50a9d8[_0x6ff2('0x16')]?_0x50a9d8[_0x6ff2('0x16')][_0x6ff2('0x18')]||null:null,'include':_0x50a9d8[_0x6ff2('0x16')]?_0x50a9d8[_0x6ff2('0x16')][_0x6ff2('0x19')]?_[_0x6ff2('0x1a')](_0x50a9d8[_0x6ff2('0x16')][_0x6ff2('0x19')],function(_0x2ce554){return{'model':db[_0x2ce554['model']],'as':_0x2ce554['as'],'attributes':_0x2ce554['attributes'],'include':_0x2ce554['include']?_[_0x6ff2('0x1a')](_0x2ce554[_0x6ff2('0x19')],function(_0x3a1eee){return{'model':db[_0x3a1eee[_0x6ff2('0x1b')]],'as':_0x3a1eee['as'],'attributes':_0x3a1eee[_0x6ff2('0x17')],'include':_0x3a1eee[_0x6ff2('0x19')]?_[_0x6ff2('0x1a')](_0x3a1eee['include'],function(_0xdd4b8c){return{'model':db[_0xdd4b8c[_0x6ff2('0x1b')]],'as':_0xdd4b8c['as'],'attributes':_0xdd4b8c[_0x6ff2('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xef8dc1){logger[_0x6ff2('0x9')](_0x6ff2('0x14'),_0x50a9d8);logger['debug'](_0x6ff2('0x14'),_0x50a9d8,JSON['stringify'](_0xef8dc1));_0x53377e(_0xef8dc1);})[_0x6ff2('0x13')](function(_0x1040fd){logger[_0x6ff2('0x10')](_0x6ff2('0x14'),_0x1040fd[_0x6ff2('0x11')],_0x50a9d8);_0x5267b0(_0x585be5[_0x6ff2('0x10')](0x1f4,_0x1040fd['message']));});});};exports['ShowTrunk']=function(_0x55b67b){var _0x5f5b09=this;return new Promise(function(_0x546c56,_0x589c22){return db['Trunk'][_0x6ff2('0x1c')]({'raw':_0x55b67b['options']?_0x55b67b[_0x6ff2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x55b67b[_0x6ff2('0x16')]?_0x55b67b[_0x6ff2('0x16')][_0x6ff2('0x1d')]||null:null,'attributes':_0x55b67b[_0x6ff2('0x16')]?_0x55b67b[_0x6ff2('0x16')][_0x6ff2('0x17')]||null:null,'include':_0x55b67b['options']?_0x55b67b[_0x6ff2('0x16')][_0x6ff2('0x19')]?_[_0x6ff2('0x1a')](_0x55b67b[_0x6ff2('0x16')][_0x6ff2('0x19')],function(_0x33dc74){return{'model':db[_0x33dc74[_0x6ff2('0x1b')]],'as':_0x33dc74['as'],'attributes':_0x33dc74[_0x6ff2('0x17')],'include':_0x33dc74['include']?_['map'](_0x33dc74[_0x6ff2('0x19')],function(_0x484a1c){return{'model':db[_0x484a1c[_0x6ff2('0x1b')]],'as':_0x484a1c['as'],'attributes':_0x484a1c[_0x6ff2('0x17')],'include':_0x484a1c['include']?_[_0x6ff2('0x1a')](_0x484a1c[_0x6ff2('0x19')],function(_0x5f3248){return{'model':db[_0x5f3248[_0x6ff2('0x1b')]],'as':_0x5f3248['as'],'attributes':_0x5f3248['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ff2('0x8')](function(_0x1ca6ab){logger[_0x6ff2('0x9')]('ShowTrunk',_0x55b67b);logger[_0x6ff2('0xc')](_0x6ff2('0x1e'),_0x55b67b,JSON['stringify'](_0x1ca6ab));_0x546c56(_0x1ca6ab);})['catch'](function(_0x1ec444){logger[_0x6ff2('0x10')](_0x6ff2('0x1e'),_0x1ec444['message'],_0x55b67b);_0x589c22(_0x5f5b09[_0x6ff2('0x10')](0x1f4,_0x1ec444['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 19bddf5..a5890bb 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 _0x0f4c=['express','Router','./user-setting.controller','put','update'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x0f4c,0x18b));var _0xc0f4=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x0f4c[_0x37e845];return _0x59e55b;};'use strict';var express=require(_0xc0f4('0x0'));var router=express[_0xc0f4('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc0f4('0x2'));router[_0xc0f4('0x3')]('/:id',auth['isAuthenticated'](),controller[_0xc0f4('0x4')]);module['exports']=router; \ No newline at end of file +var _0x1f3a=['Router','./user-setting.controller','put','isAuthenticated','exports'];(function(_0x4ea00e,_0x22e245){var _0x2a4e7a=function(_0x5b8355){while(--_0x5b8355){_0x4ea00e['push'](_0x4ea00e['shift']());}};_0x2a4e7a(++_0x22e245);}(_0x1f3a,0x64));var _0xa1f3=function(_0x30dd79,_0x5863df){_0x30dd79=_0x30dd79-0x0;var _0x1c0152=_0x1f3a[_0x30dd79];return _0x1c0152;};'use strict';var express=require('express');var router=express[_0xa1f3('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xa1f3('0x1'));router[_0xa1f3('0x2')]('/:id',auth[_0xa1f3('0x3')](),controller['update']);module[_0xa1f3('0x4')]=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 a46d07b..dc76515 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 _0xfd72=['UserId','error','info','debug','exports','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x16b248,_0x5eba31){var _0x53105b=function(_0x4a6413){while(--_0x4a6413){_0x16b248['push'](_0x16b248['shift']());}};_0x53105b(++_0x5eba31);}(_0xfd72,0xac));var _0x2fd7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xfd72[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x2fd7('0x0'),'warning',_0x2fd7('0x1'),_0x2fd7('0x2')];module[_0x2fd7('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2fd7('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2fd7('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2fd7('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2fd7('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2fd7('0x7')],'unique':_0x2fd7('0x8')}}; \ No newline at end of file +var _0x5994=['DATE','UserId','sequelize','error','debug','exports','BOOLEAN'];(function(_0x484a50,_0xc41231){var _0x14324c=function(_0x165945){while(--_0x165945){_0x484a50['push'](_0x484a50['shift']());}};_0x14324c(++_0xc41231);}(_0x5994,0x113));var _0x4599=function(_0x4cd135,_0x272b52){_0x4cd135=_0x4cd135-0x0;var _0x645f98=_0x5994[_0x4cd135];return _0x645f98;};'use strict';var Sequelize=require(_0x4599('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x4599('0x1'),'warning','info',_0x4599('0x2')];module[_0x4599('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x4599('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x4599('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x4599('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x4599('0x6')}}; \ 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 a739c3b..69c0d5f 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 _0x2cc1=['find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','defaults','status','json','update','then','sendStatus','error','stack','name','send','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting'];(function(_0x166212,_0x2e9aec){var _0x4632b7=function(_0x277967){while(--_0x277967){_0x166212['push'](_0x166212['shift']());}};_0x4632b7(++_0x2e9aec);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x2c1101,_0x1909d9){_0x2c1101=_0x2c1101-0x0;var _0x56f52f=_0x2cc1[_0x2c1101];return _0x56f52f;};'use strict';var _=require(_0x12cc('0x0'));var Redis=require(_0x12cc('0x1'));var logger=require(_0x12cc('0x2'))(_0x12cc('0x3'));var config=require(_0x12cc('0x4'));var db=require(_0x12cc('0x5'))['db'];var socket=require(_0x12cc('0x6'))(new Redis(config[_0x12cc('0x7')]));require('./user-setting.socket')['register'](socket);config[_0x12cc('0x7')]=_[_0x12cc('0x8')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x3dee73,_0x132370){_0x132370=_0x132370||0xc8;return function(_0x21d042){if(_0x21d042){return _0x3dee73[_0x12cc('0x9')](_0x132370)[_0x12cc('0xa')](_0x21d042);}};}function saveUpdates(_0x1597c0){return function(_0x2dc401){if(_0x2dc401){return _0x2dc401[_0x12cc('0xb')](_0x1597c0)[_0x12cc('0xc')](function(_0x353689){return _0x353689;});}return null;};}function handleEntityNotFound(_0x1a4192){return function(_0x27adee){if(!_0x27adee){_0x1a4192[_0x12cc('0xd')](0x194);}return _0x27adee;};}function handleError(_0x4fcf41,_0x865d59){_0x865d59=_0x865d59||0x1f4;return function(_0x4cdc4c){logger[_0x12cc('0xe')](_0x4cdc4c[_0x12cc('0xf')]);if(_0x4cdc4c[_0x12cc('0x10')]){delete _0x4cdc4c[_0x12cc('0x10')];}_0x4fcf41[_0x12cc('0x9')](_0x865d59)[_0x12cc('0x11')](_0x4cdc4c);};}exports['update']=function(_0x5909d3,_0x45e5aa){if(_0x5909d3['user'][_0x12cc('0x12')]!=='admin')throw new Error(_0x12cc('0x13'));if(isNaN(Number(_0x5909d3[_0x12cc('0x14')]['id'])))throw new Error(_0x12cc('0x15'));return db[_0x12cc('0x16')][_0x12cc('0x17')]({'where':{'id':_0x5909d3[_0x12cc('0x14')]['id']}})['then'](handleEntityNotFound(_0x45e5aa,null))[_0x12cc('0xc')](saveUpdates(_0x5909d3[_0x12cc('0x18')],null))['then'](respondWithResult(_0x45e5aa,null))[_0x12cc('0x19')](handleError(_0x45e5aa,null));}; \ No newline at end of file +var _0x2060=['status','send','user','role','admin','params','UserSetting','find','body','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','localhost','json','update','then','sendStatus','stack','name'];(function(_0x36aa86,_0xd8faa6){var _0x3a4e7d=function(_0x2adf31){while(--_0x2adf31){_0x36aa86['push'](_0x36aa86['shift']());}};_0x3a4e7d(++_0xd8faa6);}(_0x2060,0x1be));var _0x0206=function(_0x2551cb,_0x47c37e){_0x2551cb=_0x2551cb-0x0;var _0xfe41b4=_0x2060[_0x2551cb];return _0xfe41b4;};'use strict';var _=require(_0x0206('0x0'));var Redis=require('ioredis');var logger=require(_0x0206('0x1'))(_0x0206('0x2'));var config=require(_0x0206('0x3'));var db=require(_0x0206('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0206('0x5')]));require(_0x0206('0x6'))['register'](socket);config[_0x0206('0x5')]=_['defaults'](config[_0x0206('0x5')],{'host':_0x0206('0x7'),'port':0x18eb});function respondWithResult(_0x529d59,_0x2eda0e){_0x2eda0e=_0x2eda0e||0xc8;return function(_0x5c8dbb){if(_0x5c8dbb){return _0x529d59['status'](_0x2eda0e)[_0x0206('0x8')](_0x5c8dbb);}};}function saveUpdates(_0x3b9cd7){return function(_0x3bc420){if(_0x3bc420){return _0x3bc420[_0x0206('0x9')](_0x3b9cd7)[_0x0206('0xa')](function(_0x3e20d1){return _0x3e20d1;});}return null;};}function handleEntityNotFound(_0x2cdca9){return function(_0x138f07){if(!_0x138f07){_0x2cdca9[_0x0206('0xb')](0x194);}return _0x138f07;};}function handleError(_0x4223da,_0x3cc292){_0x3cc292=_0x3cc292||0x1f4;return function(_0x521d23){logger['error'](_0x521d23[_0x0206('0xc')]);if(_0x521d23[_0x0206('0xd')]){delete _0x521d23['name'];}_0x4223da[_0x0206('0xe')](_0x3cc292)[_0x0206('0xf')](_0x521d23);};}exports[_0x0206('0x9')]=function(_0x4a7bac,_0x2217e8){if(_0x4a7bac[_0x0206('0x10')][_0x0206('0x11')]!==_0x0206('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x4a7bac[_0x0206('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x0206('0x14')][_0x0206('0x15')]({'where':{'id':_0x4a7bac[_0x0206('0x13')]['id']}})[_0x0206('0xa')](handleEntityNotFound(_0x2217e8,null))[_0x0206('0xa')](saveUpdates(_0x4a7bac[_0x0206('0x16')],null))['then'](respondWithResult(_0x2217e8,null))['catch'](handleError(_0x2217e8,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 5fe7fce..83e1858 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 _0x1a46=['setMaxListeners','save','update','remove','exports','../../mysqldb'];(function(_0x17de2c,_0x1e6708){var _0xbe6716=function(_0x347adc){while(--_0x347adc){_0x17de2c['push'](_0x17de2c['shift']());}};_0xbe6716(++_0x1e6708);}(_0x1a46,0x13d));var _0x61a4=function(_0x5f25d2,_0x3e6525){_0x5f25d2=_0x5f25d2-0x0;var _0x229197=_0x1a46[_0x5f25d2];return _0x229197;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x61a4('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x61a4('0x1')](0x0);var events={'afterCreate':_0x61a4('0x2'),'afterUpdate':_0x61a4('0x3'),'afterDestroy':_0x61a4('0x4')};function emitEvent(_0x57214c){return function(_0x169d56,_0x4d0343,_0x1bd8ff){UserSettingEvents['emit'](_0x57214c+':'+_0x169d56['id'],_0x169d56);UserSettingEvents['emit'](_0x57214c,_0x169d56);_0x1bd8ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x61a4('0x5')]=UserSettingEvents; \ No newline at end of file +var _0x112e=['setMaxListeners','save','update','emit','hook','exports','events','UserSetting'];(function(_0x2ae140,_0x576875){var _0x4649ea=function(_0x19fae6){while(--_0x19fae6){_0x2ae140['push'](_0x2ae140['shift']());}};_0x4649ea(++_0x576875);}(_0x112e,0x1d6));var _0xe112=function(_0x3c5f8d,_0x39891f){_0x3c5f8d=_0x3c5f8d-0x0;var _0x3b7beb=_0x112e[_0x3c5f8d];return _0x3b7beb;};'use strict';var EventEmitter=require(_0xe112('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xe112('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe112('0x2')](0x0);var events={'afterCreate':_0xe112('0x3'),'afterUpdate':_0xe112('0x4'),'afterDestroy':'remove'};function emitEvent(_0x204648){return function(_0x2e9f8e,_0x29750b,_0x544c69){UserSettingEvents['emit'](_0x204648+':'+_0x2e9f8e['id'],_0x2e9f8e);UserSettingEvents[_0xe112('0x5')](_0x204648,_0x2e9f8e);_0x544c69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xe112('0x6')](e,emitEvent(event));}}module[_0xe112('0x7')]=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 21bb7b4..808d327 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 _0xcffe=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x4ccf97,_0x37c63b){var _0x5a8af1=function(_0x48b3b2){while(--_0x48b3b2){_0x4ccf97['push'](_0x4ccf97['shift']());}};_0x5a8af1(++_0x37c63b);}(_0xcffe,0x1a1));var _0xecff=function(_0x481604,_0x276ff8){_0x481604=_0x481604-0x0;var _0x1ca4ed=_0xcffe[_0x481604];return _0x1ca4ed;};'use strict';var attributes=require(_0xecff('0x0'));module[_0xecff('0x1')]=function(_0x1946a1){return _0x1946a1[_0xecff('0x2')](_0xecff('0x3'),attributes,{'tableName':_0xecff('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xfe1d81){if(!_0xfe1d81[_0xecff('0x5')])_0xfe1d81[_0xecff('0x6')]=null;else if(_0xfe1d81[_0xecff('0x6')]===null)_0xfe1d81['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x76dc=['define','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x2f913f,_0x394f5d){var _0x4e7b83=function(_0x1ea253){while(--_0x1ea253){_0x2f913f['push'](_0x2f913f['shift']());}};_0x4e7b83(++_0x394f5d);}(_0x76dc,0x1f2));var _0xc76d=function(_0x4ffcdf,_0x25a43e){_0x4ffcdf=_0x4ffcdf-0x0;var _0x1b103c=_0x76dc[_0x4ffcdf];return _0x1b103c;};'use strict';var attributes=require(_0xc76d('0x0'));module[_0xc76d('0x1')]=function(_0x7e533b){return _0x7e533b[_0xc76d('0x2')]('UserSetting',attributes,{'tableName':_0xc76d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ba6a1){if(!_0x1ba6a1['clientSideLoggingEnabled'])_0x1ba6a1[_0xc76d('0x4')]=null;else if(_0x1ba6a1['clientSideLoggingEnabledSince']===null)_0x1ba6a1['clientSideLoggingEnabledSince']=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 5fafc1f..09dd808 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 _0xe0ab=['./user-setting.events','save','remove','user-setting:update','emit','UserId','register','length'];(function(_0x44d456,_0x21528a){var _0x2cf549=function(_0x2765dd){while(--_0x2765dd){_0x44d456['push'](_0x44d456['shift']());}};_0x2cf549(++_0x21528a);}(_0xe0ab,0x1d8));var _0xbe0a=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xe0ab[_0x4243a3];return _0x1b2a33;};'use strict';var UserSettingEvents=require(_0xbe0a('0x0'));var events=[_0xbe0a('0x1'),_0xbe0a('0x2'),'update'];function createListener(_0x215c59,_0x4fb6be){return function(_0x367f7d){_0x4fb6be['emit'](_0x215c59,_0x367f7d);if(_0x215c59===_0xbe0a('0x3')){_0x4fb6be[_0xbe0a('0x4')]('user-setting:update:user-'+_0x367f7d[_0xbe0a('0x5')],_0x367f7d);}};}exports[_0xbe0a('0x6')]=function(_0x26b510){for(var _0x339c69=0x0,_0xe08709=events[_0xbe0a('0x7')];_0x339c69<_0xe08709;_0x339c69++){var _0x1213ee=events[_0x339c69];var _0x9342a9=createListener('user-setting:'+_0x1213ee,_0x26b510);UserSettingEvents['on'](_0x1213ee,_0x9342a9);}}; \ No newline at end of file +var _0x97e9=['update','emit','length','user-setting:','./user-setting.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97e9,0x1cb));var _0x997e=function(_0x33e0a3,_0x2fdef5){_0x33e0a3=_0x33e0a3-0x0;var _0x40304a=_0x97e9[_0x33e0a3];return _0x40304a;};'use strict';var UserSettingEvents=require(_0x997e('0x0'));var events=[_0x997e('0x1'),_0x997e('0x2'),_0x997e('0x3')];function createListener(_0x323972,_0x59c2d4){return function(_0x2d77be){_0x59c2d4['emit'](_0x323972,_0x2d77be);if(_0x323972==='user-setting:update'){_0x59c2d4[_0x997e('0x4')]('user-setting:update:user-'+_0x2d77be['UserId'],_0x2d77be);}};}exports['register']=function(_0x262e41){for(var _0x4b64a1=0x0,_0x76ddd6=events[_0x997e('0x5')];_0x4b64a1<_0x76ddd6;_0x4b64a1++){var _0x5cc98c=events[_0x4b64a1];var _0x409e91=createListener(_0x997e('0x6')+_0x5cc98c,_0x262e41);UserSettingEvents['on'](_0x5cc98c,_0x409e91);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index b975e7f..40e47e4 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 _0x082e=['/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getSquareProjects','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','destroy','removeChatInteractions','removeFaxInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','describe','/whoami','whoami','isAuthenticated','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','/:id/contacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x082e,0x196));var _0xe082=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x082e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xe082('0x0'));var path=require(_0xe082('0x1'));var timeout=require(_0xe082('0x2'));var express=require(_0xe082('0x3'));var router=express['Router']();var fs_extra=require(_0xe082('0x4'));var auth=require(_0xe082('0x5'));var interaction=require(_0xe082('0x6'));var config=require('../../config/environment');var controller=require(_0xe082('0x7'));router[_0xe082('0x8')]('/',auth['isAuthenticated'](),controller[_0xe082('0x9')]);router[_0xe082('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe082('0xa')]);router['get'](_0xe082('0xb'),auth['isAuthenticated'](),controller[_0xe082('0xc')]);router['get']('/presence',auth[_0xe082('0xd')](),controller[_0xe082('0xe')]);router[_0xe082('0x8')](_0xe082('0xf'),auth['isAuthenticated'](),controller[_0xe082('0x10')]);router[_0xe082('0x8')](_0xe082('0x11'),controller['getAvatar']);router['get'](_0xe082('0x12'),auth[_0xe082('0xd')](),controller['getOpenTabs']);router['get'](_0xe082('0x13'),auth['isAuthenticated'](),controller['getContacts']);router[_0xe082('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0xe082('0x14')]);router[_0xe082('0x8')](_0xe082('0x15'),auth[_0xe082('0xd')](),controller[_0xe082('0x16')]);router['get']('/:id/groups',auth[_0xe082('0xd')](),controller['getGroups']);router['get'](_0xe082('0x17'),auth['isAuthenticated'](),controller[_0xe082('0x18')]);router[_0xe082('0x8')](_0xe082('0x19'),auth[_0xe082('0xd')](),controller['getScreenRecordings']);router[_0xe082('0x8')](_0xe082('0x1a'),auth[_0xe082('0xd')](),controller['getChatInteractions']);router['get'](_0xe082('0x1b'),auth[_0xe082('0xd')](),controller[_0xe082('0x1c')]);router[_0xe082('0x8')](_0xe082('0x1d'),auth[_0xe082('0xd')](),controller[_0xe082('0x1e')]);router['get'](_0xe082('0x1f'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xe082('0x8')](_0xe082('0x20'),auth[_0xe082('0xd')](),controller['getFaxInteractions']);router[_0xe082('0x8')](_0xe082('0x21'),auth[_0xe082('0xd')](),controller[_0xe082('0x22')]);router['get'](_0xe082('0x23'),auth[_0xe082('0xd')](),controller[_0xe082('0x24')]);router[_0xe082('0x8')](_0xe082('0x25'),auth['isAuthenticated'](),controller[_0xe082('0x26')]);router['get']('/:id/agents',auth[_0xe082('0xd')](),controller[_0xe082('0x27')]);router[_0xe082('0x8')](_0xe082('0x28'),auth[_0xe082('0xd')](),controller[_0xe082('0x29')]);router['get'](_0xe082('0x2a'),auth[_0xe082('0xd')](),controller['getFaxAccounts']);router[_0xe082('0x8')](_0xe082('0x2b'),auth[_0xe082('0xd')](),controller['getMailAccounts']);router[_0xe082('0x8')](_0xe082('0x2c'),auth[_0xe082('0xd')](),controller['getOpenchannelAccounts']);router['get'](_0xe082('0x2d'),auth[_0xe082('0xd')](),controller[_0xe082('0x2e')]);router[_0xe082('0x8')](_0xe082('0x2f'),auth['isAuthenticated'](),controller[_0xe082('0x30')]);router[_0xe082('0x8')]('/:id/whatsapp_accounts',auth[_0xe082('0xd')](),controller[_0xe082('0x31')]);router[_0xe082('0x8')]('/:id/square_projects',auth[_0xe082('0xd')](),controller[_0xe082('0x32')]);router[_0xe082('0x8')]('/:id/scheduled_calls',auth[_0xe082('0xd')](),controller[_0xe082('0x33')]);router[_0xe082('0x8')](_0xe082('0x34'),auth[_0xe082('0xd')](),controller['getApiKey']);router[_0xe082('0x35')](_0xe082('0x13'),auth[_0xe082('0xd')](),controller[_0xe082('0x36')]);router[_0xe082('0x35')]('/',auth[_0xe082('0xd')](),controller[_0xe082('0x37')]);router[_0xe082('0x35')](_0xe082('0x38'),auth[_0xe082('0xd')](),controller[_0xe082('0x39')]);router[_0xe082('0x35')](_0xe082('0x3a'),auth[_0xe082('0xd')](),controller[_0xe082('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15a8d3,_0x390d1c,_0x55dda){_0x55dda(null,path[_0xe082('0x3c')](config['root'],_0xe082('0x3d')));},'filename':function(_0x524bb4,_0x428a5e,_0x34e8dd){_0x34e8dd(null,util[_0xe082('0x3e')](_0xe082('0x3f'),Date[_0xe082('0x40')](),_0x428a5e[_0xe082('0x41')]));}})});router[_0xe082('0x35')](_0xe082('0x11'),upload[_0xe082('0x42')](_0xe082('0x43')),controller[_0xe082('0x44')]);router['post'](_0xe082('0x45'),auth['isAuthenticated'](),controller[_0xe082('0x46')]);router[_0xe082('0x35')]('/:id/logout',auth[_0xe082('0xd')](),controller['logout']);router[_0xe082('0x35')]('/:id/pause',auth[_0xe082('0xd')](),controller[_0xe082('0x47')]);router[_0xe082('0x35')](_0xe082('0x48'),auth[_0xe082('0xd')](),controller[_0xe082('0x49')]);router['post'](_0xe082('0x23'),auth['isAuthenticated'](),controller[_0xe082('0x4a')]);router[_0xe082('0x35')](_0xe082('0x4b'),auth[_0xe082('0xd')](),controller['addChatInteractions']);router[_0xe082('0x35')](_0xe082('0x4c'),auth[_0xe082('0xd')](),controller['addMailInteractions']);router[_0xe082('0x35')](_0xe082('0x4d'),auth[_0xe082('0xd')](),controller[_0xe082('0x4e')]);router[_0xe082('0x35')](_0xe082('0x4f'),auth[_0xe082('0xd')](),controller[_0xe082('0x50')]);router['post'](_0xe082('0x51'),auth[_0xe082('0xd')](),controller[_0xe082('0x52')]);router[_0xe082('0x35')](_0xe082('0x53'),auth['isAuthenticated'](),controller[_0xe082('0x54')]);router['post'](_0xe082('0x2a'),auth[_0xe082('0xd')](),controller[_0xe082('0x55')]);router[_0xe082('0x35')](_0xe082('0x2b'),auth[_0xe082('0xd')](),controller['addMailAccounts']);router[_0xe082('0x35')](_0xe082('0x2c'),auth[_0xe082('0xd')](),controller[_0xe082('0x56')]);router[_0xe082('0x35')]('/:id/sms_accounts',auth[_0xe082('0xd')](),controller[_0xe082('0x57')]);router[_0xe082('0x35')](_0xe082('0x2f'),auth[_0xe082('0xd')](),controller['addChatWebsites']);router[_0xe082('0x35')](_0xe082('0x58'),auth[_0xe082('0xd')](),controller[_0xe082('0x59')]);router[_0xe082('0x35')](_0xe082('0x5a'),auth['isAuthenticated'](),controller[_0xe082('0x5b')]);router[_0xe082('0x35')](_0xe082('0x34'),auth['isAuthenticated'](),controller[_0xe082('0x5c')]);router[_0xe082('0x5d')](_0xe082('0xf'),auth['isAuthenticated'](),controller[_0xe082('0x5e')]);router[_0xe082('0x5d')](_0xe082('0x5f'),auth[_0xe082('0xd')](),controller[_0xe082('0x60')]);router[_0xe082('0x61')](_0xe082('0x3a'),auth[_0xe082('0xd')](),controller['removeQueues']);router['delete'](_0xe082('0x23'),auth[_0xe082('0xd')](),controller['removeTeams']);router[_0xe082('0x61')](_0xe082('0xf'),auth[_0xe082('0xd')](),controller[_0xe082('0x62')]);router[_0xe082('0x61')](_0xe082('0x4b'),auth[_0xe082('0xd')](),controller[_0xe082('0x63')]);router[_0xe082('0x61')](_0xe082('0x4c'),auth[_0xe082('0xd')](),controller['removeMailInteractions']);router[_0xe082('0x61')](_0xe082('0x4d'),auth['isAuthenticated'](),controller[_0xe082('0x64')]);router[_0xe082('0x61')](_0xe082('0x4f'),auth[_0xe082('0xd')](),controller['removeSmsInteractions']);router[_0xe082('0x61')]('/:id/openchannel_interactions',auth[_0xe082('0xd')](),controller['removeOpenchannelInteractions']);router[_0xe082('0x61')](_0xe082('0x53'),auth[_0xe082('0xd')](),controller[_0xe082('0x65')]);router[_0xe082('0x61')](_0xe082('0x2a'),auth['isAuthenticated'](),controller[_0xe082('0x66')]);router['delete'](_0xe082('0x2b'),auth[_0xe082('0xd')](),controller[_0xe082('0x67')]);router[_0xe082('0x61')]('/:id/openchannel_accounts',auth[_0xe082('0xd')](),controller['removeOpenchannelAccounts']);router['delete'](_0xe082('0x2d'),auth[_0xe082('0xd')](),controller['removeSmsAccounts']);router[_0xe082('0x61')](_0xe082('0x2f'),auth['isAuthenticated'](),controller[_0xe082('0x68')]);router[_0xe082('0x61')]('/:id/whatsapp_accounts',auth[_0xe082('0xd')](),controller[_0xe082('0x69')]);router['delete'](_0xe082('0x5a'),auth[_0xe082('0xd')](),controller[_0xe082('0x6a')]);router['delete'](_0xe082('0x34'),auth[_0xe082('0xd')](),controller[_0xe082('0x6b')]);module['exports']=router; \ No newline at end of file +var _0xe18f=['/:id/fax_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','/:id/password','changePassword','delete','removeTeams','removeChatInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','/:id/queues','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions'];(function(_0x2247ab,_0x3f4162){var _0x430062=function(_0x591dd7){while(--_0x591dd7){_0x2247ab['push'](_0x2247ab['shift']());}};_0x430062(++_0x3f4162);}(_0xe18f,0x14d));var _0xfe18=function(_0x2fd818,_0x204f43){_0x2fd818=_0x2fd818-0x0;var _0x2cf4d6=_0xe18f[_0x2fd818];return _0x2cf4d6;};'use strict';var multer=require(_0xfe18('0x0'));var util=require(_0xfe18('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfe18('0x2'));var router=express[_0xfe18('0x3')]();var fs_extra=require(_0xfe18('0x4'));var auth=require(_0xfe18('0x5'));var interaction=require(_0xfe18('0x6'));var config=require(_0xfe18('0x7'));var controller=require('./user.controller');router[_0xfe18('0x8')]('/',auth['isAuthenticated'](),controller[_0xfe18('0x9')]);router[_0xfe18('0x8')](_0xfe18('0xa'),auth[_0xfe18('0xb')](),controller[_0xfe18('0xc')]);router[_0xfe18('0x8')]('/whoami',auth[_0xfe18('0xb')](),controller[_0xfe18('0xd')]);router['get']('/presence',auth[_0xfe18('0xb')](),controller['getPresence']);router['get'](_0xfe18('0xe'),auth[_0xfe18('0xb')](),controller[_0xfe18('0xf')]);router[_0xfe18('0x8')]('/:id/avatar',controller[_0xfe18('0x10')]);router['get']('/:id/open_tabs',auth[_0xfe18('0xb')](),controller['getOpenTabs']);router[_0xfe18('0x8')](_0xfe18('0x11'),auth['isAuthenticated'](),controller[_0xfe18('0x12')]);router[_0xfe18('0x8')]('/:id/queues',auth[_0xfe18('0xb')](),controller[_0xfe18('0x13')]);router[_0xfe18('0x8')](_0xfe18('0x14'),auth[_0xfe18('0xb')](),controller['getVoiceQueuesRt']);router['get'](_0xfe18('0x15'),auth['isAuthenticated'](),controller[_0xfe18('0x16')]);router[_0xfe18('0x8')](_0xfe18('0x17'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x18')]);router['get']('/:id/screen_recordings',auth[_0xfe18('0xb')](),controller['getScreenRecordings']);router[_0xfe18('0x8')]('/:id/chat/interactions',auth[_0xfe18('0xb')](),controller['getChatInteractions']);router[_0xfe18('0x8')](_0xfe18('0x19'),auth['isAuthenticated'](),controller[_0xfe18('0x1a')]);router[_0xfe18('0x8')](_0xfe18('0x1b'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0xfe18('0x8')](_0xfe18('0x1c'),auth['isAuthenticated'](),controller[_0xfe18('0x1d')]);router['get'](_0xfe18('0x1e'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x1f')]);router[_0xfe18('0x8')](_0xfe18('0x20'),auth['isAuthenticated'](),controller[_0xfe18('0x21')]);router[_0xfe18('0x8')](_0xfe18('0x22'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x23')]);router[_0xfe18('0x8')]('/:id/lists',auth[_0xfe18('0xb')](),controller[_0xfe18('0x24')]);router[_0xfe18('0x8')]('/:id/agents',auth[_0xfe18('0xb')](),controller['getAgents']);router[_0xfe18('0x8')]('/:id/prefixes',auth[_0xfe18('0xb')](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth[_0xfe18('0xb')](),controller[_0xfe18('0x25')]);router['get'](_0xfe18('0x26'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x27')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xfe18('0x28')]);router[_0xfe18('0x8')](_0xfe18('0x29'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x2a')]);router[_0xfe18('0x8')](_0xfe18('0x2b'),auth['isAuthenticated'](),controller[_0xfe18('0x2c')]);router[_0xfe18('0x8')](_0xfe18('0x2d'),auth[_0xfe18('0xb')](),controller['getWhatsappAccounts']);router[_0xfe18('0x8')](_0xfe18('0x2e'),auth[_0xfe18('0xb')](),controller['getSquareProjects']);router[_0xfe18('0x8')](_0xfe18('0x2f'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x30')]);router[_0xfe18('0x8')]('/:id/api_key',auth[_0xfe18('0xb')](),controller[_0xfe18('0x31')]);router[_0xfe18('0x32')](_0xfe18('0x11'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x33')]);router['post']('/',auth[_0xfe18('0xb')](),controller[_0xfe18('0x34')]);router[_0xfe18('0x32')](_0xfe18('0x35'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x36')]);router['post'](_0xfe18('0x37'),auth[_0xfe18('0xb')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39847e,_0x24edfc,_0x13e1e9){_0x13e1e9(null,path['join'](config['root'],_0xfe18('0x38')));},'filename':function(_0x19169f,_0x42c38c,_0x39d2fb){_0x39d2fb(null,util[_0xfe18('0x39')](_0xfe18('0x3a'),Date[_0xfe18('0x3b')](),_0x42c38c[_0xfe18('0x3c')]));}})});router['post'](_0xfe18('0x3d'),upload[_0xfe18('0x3e')](_0xfe18('0x3f')),controller[_0xfe18('0x40')]);router[_0xfe18('0x32')](_0xfe18('0x41'),auth[_0xfe18('0xb')](),controller['login']);router[_0xfe18('0x32')](_0xfe18('0x42'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x43')]);router['post'](_0xfe18('0x44'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x45')]);router[_0xfe18('0x32')]('/:id/unpause',auth['isAuthenticated'](),controller[_0xfe18('0x46')]);router[_0xfe18('0x32')](_0xfe18('0x22'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x47')]);router[_0xfe18('0x32')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xfe18('0x48')]);router[_0xfe18('0x32')](_0xfe18('0x49'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x4a')]);router[_0xfe18('0x32')]('/:id/fax_interactions',auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0xfe18('0x32')](_0xfe18('0x4b'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x4c')]);router['post'](_0xfe18('0x4d'),auth[_0xfe18('0xb')](),controller['addOpenchannelInteractions']);router['post'](_0xfe18('0x4e'),auth[_0xfe18('0xb')](),controller['addWhatsappInteractions']);router[_0xfe18('0x32')](_0xfe18('0x4f'),auth[_0xfe18('0xb')](),controller['addFaxAccounts']);router[_0xfe18('0x32')](_0xfe18('0x26'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x50')]);router[_0xfe18('0x32')]('/:id/openchannel_accounts',auth[_0xfe18('0xb')](),controller[_0xfe18('0x51')]);router[_0xfe18('0x32')](_0xfe18('0x29'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x52')]);router[_0xfe18('0x32')](_0xfe18('0x2b'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x53')]);router['post'](_0xfe18('0x2d'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x54')]);router[_0xfe18('0x32')](_0xfe18('0x2e'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x55')]);router[_0xfe18('0x32')](_0xfe18('0x56'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x57')]);router[_0xfe18('0x58')]('/:id',auth[_0xfe18('0xb')](),controller['update']);router['put'](_0xfe18('0x59'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x5a')]);router[_0xfe18('0x5b')]('/:id/queues',auth[_0xfe18('0xb')](),controller['removeQueues']);router['delete'](_0xfe18('0x22'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x5c')]);router[_0xfe18('0x5b')](_0xfe18('0xe'),auth[_0xfe18('0xb')](),controller['destroy']);router[_0xfe18('0x5b')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xfe18('0x5d')]);router[_0xfe18('0x5b')](_0xfe18('0x49'),auth[_0xfe18('0xb')](),controller['removeMailInteractions']);router[_0xfe18('0x5b')]('/:id/fax_interactions',auth[_0xfe18('0xb')](),controller[_0xfe18('0x5e')]);router[_0xfe18('0x5b')]('/:id/sms_interactions',auth[_0xfe18('0xb')](),controller['removeSmsInteractions']);router[_0xfe18('0x5b')](_0xfe18('0x4d'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x5f')]);router[_0xfe18('0x5b')](_0xfe18('0x4e'),auth[_0xfe18('0xb')](),controller['removeWhatsappInteractions']);router[_0xfe18('0x5b')](_0xfe18('0x4f'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x60')]);router[_0xfe18('0x5b')](_0xfe18('0x26'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x61')]);router[_0xfe18('0x5b')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xfe18('0x5b')]('/:id/sms_accounts',auth[_0xfe18('0xb')](),controller[_0xfe18('0x62')]);router[_0xfe18('0x5b')](_0xfe18('0x2b'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x63')]);router[_0xfe18('0x5b')](_0xfe18('0x2d'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x64')]);router[_0xfe18('0x5b')](_0xfe18('0x2e'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x65')]);router[_0xfe18('0x5b')](_0xfe18('0x56'),auth[_0xfe18('0xb')](),controller[_0xfe18('0x66')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 9db0cbf..d0a2621 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 _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(_0x36c232,_0x20dbe9){var _0x273c07=function(_0x4492bd){while(--_0x4492bd){_0x36c232['push'](_0x36c232['shift']());}};_0x273c07(++_0x20dbe9);}(_0x70e0,0x17b));var _0x070e=function(_0x4a1e4d,_0x57c765){_0x4a1e4d=_0x4a1e4d-0x0;var _0x5cbb17=_0x70e0[_0x4a1e4d];return _0x5cbb17;};'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 +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(_0x3ac2c7,_0x2fc40f){var _0x37f415=function(_0xfc21af){while(--_0xfc21af){_0x3ac2c7['push'](_0x3ac2c7['shift']());}};_0x37f415(++_0x2fc40f);}(_0x70e0,0x17b));var _0x070e=function(_0x27fec8,_0x36817a){_0x27fec8=_0x27fec8-0x0;var _0x1465ac=_0x70e0[_0x27fec8];return _0x1465ac;};'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 e5a62f9..ba5f018 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 _0x3750=['index','User','rawAttributes','fieldName','type','key','password','salt','where','query','includeAll','include','true','UserSetting','userSetting','attributes','push','findAll','openTabs','rows','length','chat','dataValues','mail','openchannel','whatsapp','all','show','model','differenceBy','filters','intersection','fields','options','sms','body','describe','addContacts','params','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','email','agent','permissions','101','102','103','113','110','105','108','109','111','114','115','user','Unauthorized','checkUserLimits','settingsEnabled','userProfileId','create','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','UserProfileSection','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','Queue:remove','userpic','file','filename','getAvatar','join','root','download','server/files/images/','getOpenTabs','fax','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','keys','order','sort','pick','merge','hasOwnProperty','CmList','List','Tag','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','getMailQueues','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction','online','getDataValue','TeamVoicePrefix','VoicePrefixId','removeTeams','Mail','Sms','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$in','$notIn','$iLike','$notILike','$like','$overlap','$contains','$contained','firstName','lastName','CmContact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','inbound','flatten','lower','col','toString','asc','desc','substring','uniqBy','orderBy','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unavailable','ringing','voiceStatus','busy','charAt','toUpperCase','slice','SELECT','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','util','path','lodash','squel','jayson/promise','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','socket.io-emitter','./user.socket','register','defaults','localhost','request','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','then','get','role','admin','Users','Agents','telephone','filter','ignore','map','value','includes','find','UserProfileResource','end','stack','name','send'];(function(_0x4ff015,_0x1b7337){var _0x3921a=function(_0x16b859){while(--_0x16b859){_0x4ff015['push'](_0x4ff015['shift']());}};_0x3921a(++_0x1b7337);}(_0x3750,0x168));var _0x0375=function(_0x3d2438,_0x2e7922){_0x3d2438=_0x3d2438-0x0;var _0xd18de5=_0x3750[_0x3d2438];return _0xd18de5;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0375('0x0'));var path=require(_0x0375('0x1'));var fs=require('fs');var _=require(_0x0375('0x2'));var squel=require(_0x0375('0x3'));var jayson=require(_0x0375('0x4'));var Redis=require(_0x0375('0x5'));var authService=require('../../components/auth/service');var qs=require(_0x0375('0x6'));var logger=require(_0x0375('0x7'))(_0x0375('0x8'));var utils=require('../../config/utils');var config=require(_0x0375('0x9'));var licenseUtil=require(_0x0375('0xa'));var db=require('../../mysqldb')['db'];var socket=require(_0x0375('0xb'))(new Redis(config['redis']));require(_0x0375('0xc'))[_0x0375('0xd')](socket);config['redis']=_[_0x0375('0xe')](config['redis'],{'host':_0x0375('0xf'),'port':0x18eb});var client=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x8970dd,_0x2f34f1,_0x54824f,_0x4231b7){return new BPromise(function(_0x4317b3,_0x3f602b){var _0x35190c=_0x4231b7||client;return _0x35190c[_0x0375('0x10')](_0x8970dd,_0x54824f)['then'](function(_0x2d400d){logger[_0x0375('0x11')]('User,\x20%s,\x20%s',_0x2f34f1,_0x0375('0x12'));logger[_0x0375('0x13')](_0x0375('0x14'),_0x2f34f1,'request\x20sent',JSON[_0x0375('0x15')](_0x2d400d));if(_0x2d400d[_0x0375('0x16')]){if(_0x2d400d['error'][_0x0375('0x17')]===0x1f4){logger[_0x0375('0x16')](_0x0375('0x18'),_0x2f34f1,_0x2d400d[_0x0375('0x16')][_0x0375('0x19')]);return _0x3f602b(_0x2d400d['error']['message']);}logger[_0x0375('0x16')](_0x0375('0x18'),_0x2f34f1,_0x2d400d['error'][_0x0375('0x19')]);return _0x4317b3(_0x2d400d[_0x0375('0x16')][_0x0375('0x19')]);}else{logger[_0x0375('0x11')]('User,\x20%s,\x20%s',_0x2f34f1,_0x0375('0x12'));_0x4317b3(_0x2d400d[_0x0375('0x1a')][_0x0375('0x19')]);}})[_0x0375('0x1b')](function(_0x5ec986){logger[_0x0375('0x16')](_0x0375('0x18'),_0x2f34f1,_0x5ec986);_0x3f602b(_0x5ec986);});});}function respondWithStatusCode(_0x1b1eee,_0xb630cb){_0xb630cb=_0xb630cb||0xcc;return function(_0x4ad1eb){if(_0x4ad1eb){return _0x1b1eee[_0x0375('0x1c')](_0xb630cb);}return _0x1b1eee[_0x0375('0x1d')](_0xb630cb)['end']();};}function respondWithResult(_0x195e00,_0x4f0d11){_0x4f0d11=_0x4f0d11||0xc8;return function(_0x3ad6a9){if(_0x3ad6a9){return _0x195e00[_0x0375('0x1d')](_0x4f0d11)[_0x0375('0x1e')](_0x3ad6a9);}};}function respondWithFilteredResult(_0x2746bf,_0x1d0557){return function(_0x1eb570){if(_0x1eb570){var _0x248955=typeof _0x1d0557[_0x0375('0x1f')]===_0x0375('0x20')&&typeof _0x1d0557[_0x0375('0x21')]===_0x0375('0x20');var _0x39f077=_0x1eb570['count'];var _0x144078=_0x248955?0x0:_0x1d0557['offset'];var _0x97d894=_0x248955?_0x1eb570[_0x0375('0x22')]:_0x1d0557[_0x0375('0x1f')]+_0x1d0557['limit'];var _0xe852f3;if(_0x97d894>=_0x39f077){_0x97d894=_0x39f077;_0xe852f3=0xc8;}else{_0xe852f3=0xce;}_0x2746bf[_0x0375('0x1d')](_0xe852f3);return _0x2746bf[_0x0375('0x23')]('Content-Range',_0x144078+'-'+_0x97d894+'/'+_0x39f077)[_0x0375('0x1e')](_0x1eb570);}return null;};}function saveUpdates(_0x56bfb3){return function(_0x3b702a){if(_0x3b702a){return _0x3b702a[_0x0375('0x24')](_0x56bfb3)['then'](function(_0xf2797a){return _0xf2797a;});}return null;};}function removeEntity(_0x10be8e){return function(_0x440fb8){if(_0x440fb8){return _0x440fb8[_0x0375('0x25')]()[_0x0375('0x26')](function(){var _0x3afbc6=_0x440fb8[_0x0375('0x27')]({'plain':!![]});if(_0x3afbc6[_0x0375('0x28')]===_0x0375('0x29'))return;var _0x421160=[{'name':_0x0375('0x2a'),'value':'user','ignore':!![]},{'name':_0x0375('0x2b'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x0375('0x2c'),'ignore':![]}];var _0x142f8c=_(_0x421160)[_0x0375('0x2d')](_0x0375('0x2e'))[_0x0375('0x2f')](_0x0375('0x30'))[_0x0375('0x30')]();if(_[_0x0375('0x31')](_0x142f8c,_0x3afbc6[_0x0375('0x28')])){return;}var _0x5b3027=_[_0x0375('0x32')](_0x421160,[_0x0375('0x30'),_0x3afbc6[_0x0375('0x28')]])['name'];return db[_0x0375('0x33')][_0x0375('0x25')]({'where':{'type':_0x5b3027,'resourceId':_0x3afbc6['id']}})[_0x0375('0x26')](function(){return _0x440fb8;});})[_0x0375('0x26')](function(){_0x10be8e['status'](0xcc)[_0x0375('0x34')]();});}};}function handleEntityNotFound(_0x47c7f9){return function(_0x104ac2){if(!_0x104ac2){_0x47c7f9[_0x0375('0x1c')](0x194);}return _0x104ac2;};}function handleError(_0x3b4395,_0x1bac8e){_0x1bac8e=_0x1bac8e||0x1f4;return function(_0x111de7){logger[_0x0375('0x16')](_0x111de7[_0x0375('0x35')]);if(_0x111de7[_0x0375('0x36')]){delete _0x111de7[_0x0375('0x36')];}_0x3b4395['status'](_0x1bac8e)[_0x0375('0x37')](_0x111de7);};}exports[_0x0375('0x38')]=function(_0x31cc26,_0x11da99){var _0x35dc56={},_0x564c60={'count':0x0,'rows':[]};var _0x1c482f=_(db[_0x0375('0x39')][_0x0375('0x3a')])[_0x0375('0x2f')](function(_0x2d3f83){return{'name':_0x2d3f83[_0x0375('0x3b')],'type':_0x2d3f83[_0x0375('0x3c')][_0x0375('0x3d')]};})[_0x0375('0x2d')](function(_0x5500d6){return!_[_0x0375('0x31')]([_0x0375('0x3e'),_0x0375('0x3f')],_0x5500d6['name']);})[_0x0375('0x30')]();_0x35dc56=qs['getOptions'](_0x1c482f,_0x31cc26);var _0x2cbc25={'where':_0x35dc56[_0x0375('0x40')]};return db[_0x0375('0x39')]['count'](_0x2cbc25)[_0x0375('0x26')](function(_0x10a1c8){_0x564c60[_0x0375('0x22')]=_0x10a1c8;if(_0x31cc26[_0x0375('0x41')][_0x0375('0x42')]){_0x35dc56[_0x0375('0x43')]=[{'all':!![]}];}if(_0x31cc26[_0x0375('0x41')]['userSetting']===_0x0375('0x44')){_0x35dc56[_0x0375('0x43')]=[{'model':db[_0x0375('0x45')],'as':_0x0375('0x46')}];}if(!_[_0x0375('0x31')](_0x35dc56[_0x0375('0x47')],'id')){_0x35dc56[_0x0375('0x47')][_0x0375('0x48')]('id');}return db['User'][_0x0375('0x49')](_0x35dc56);})[_0x0375('0x26')](function(_0x4bade1){_0x564c60['rows']=_0x4bade1;if(_0x31cc26[_0x0375('0x41')][_0x0375('0x4a')]===_0x0375('0x44')){var _0x5ac4fe=[];for(var _0x3df054=0x0;_0x3df054<_0x564c60[_0x0375('0x4b')][_0x0375('0x4c')];_0x3df054++){_0x5ac4fe['push'](get_open_tabs(_0x0375('0x4d'),_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));_0x5ac4fe[_0x0375('0x48')](get_open_tabs('sms',_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));_0x5ac4fe['push'](get_open_tabs('fax',_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));_0x5ac4fe[_0x0375('0x48')](get_open_tabs(_0x0375('0x4f'),_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));_0x5ac4fe[_0x0375('0x48')](get_open_tabs(_0x0375('0x50'),_0x564c60['rows'][_0x3df054]['dataValues']));_0x5ac4fe[_0x0375('0x48')](get_open_tabs(_0x0375('0x51'),_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));}return BPromise[_0x0375('0x52')](_0x5ac4fe)[_0x0375('0x26')](function(){return _0x564c60;});}else{return _0x564c60;}})['then'](respondWithFilteredResult(_0x11da99,_0x35dc56))[_0x0375('0x1b')](handleError(_0x11da99,null));};exports[_0x0375('0x53')]=function(_0x55d21f,_0x1e3cd9){var _0xd2066e={'raw':![],'where':{'id':_0x55d21f['params']['id']}},_0x4e03d8={};_0x4e03d8[_0x0375('0x54')]=_[_0x0375('0x55')](_['keys'](db[_0x0375('0x39')][_0x0375('0x3a')]),[_0x0375('0x3e'),_0x0375('0x3f')]);_0x4e03d8['query']=_['keys'](_0x55d21f[_0x0375('0x41')]);_0x4e03d8[_0x0375('0x56')]=_[_0x0375('0x57')](_0x4e03d8['model'],_0x4e03d8['query']);_0xd2066e[_0x0375('0x47')]=_[_0x0375('0x57')](_0x4e03d8[_0x0375('0x54')],qs['fields'](_0x55d21f[_0x0375('0x41')][_0x0375('0x58')]));_0xd2066e[_0x0375('0x47')]=_0xd2066e[_0x0375('0x47')][_0x0375('0x4c')]?_0xd2066e[_0x0375('0x47')]:_0x4e03d8[_0x0375('0x54')];if(_0x55d21f[_0x0375('0x41')][_0x0375('0x42')]){_0xd2066e[_0x0375('0x43')]=[{'all':!![]}];}if(_0x55d21f['query']['userSetting']===_0x0375('0x44')){_0xd2066e[_0x0375('0x43')]=[{'model':db[_0x0375('0x45')],'as':_0x0375('0x46')}];}_0xd2066e=_['merge']({},_0xd2066e,_0x55d21f[_0x0375('0x59')]);if(!_[_0x0375('0x31')](_0xd2066e[_0x0375('0x47')],'id')){_0xd2066e[_0x0375('0x47')]['push']('id');}return db[_0x0375('0x39')][_0x0375('0x32')](_0xd2066e)[_0x0375('0x26')](handleEntityNotFound(_0x1e3cd9,null))[_0x0375('0x26')](function(_0x37962d){var _0x3f0a20=[];values=_0x37962d;if(_0x55d21f[_0x0375('0x41')]['openTabs']===_0x0375('0x44')){_0x3f0a20[_0x0375('0x48')](get_open_tabs(_0x0375('0x4d'),_0x37962d[_0x0375('0x4e')]));_0x3f0a20[_0x0375('0x48')](get_open_tabs(_0x0375('0x5a'),_0x37962d['dataValues']));_0x3f0a20['push'](get_open_tabs('openchannel',_0x37962d['dataValues']));_0x3f0a20[_0x0375('0x48')](get_open_tabs(_0x0375('0x51'),_0x37962d[_0x0375('0x4e')]));_0x3f0a20[_0x0375('0x48')](get_open_tabs('fax',_0x37962d[_0x0375('0x4e')]));_0x3f0a20[_0x0375('0x48')](get_open_tabs(_0x0375('0x4f'),_0x37962d[_0x0375('0x4e')]));return BPromise[_0x0375('0x52')](_0x3f0a20);}else{return values;}})[_0x0375('0x26')](function(){return values;})['then'](respondWithResult(_0x1e3cd9,null))[_0x0375('0x1b')](handleError(_0x1e3cd9,null));};exports[_0x0375('0x24')]=function(_0x462cfe,_0x320b32){if(_0x462cfe[_0x0375('0x5b')]['id']){delete _0x462cfe[_0x0375('0x5b')]['id'];}delete _0x462cfe[_0x0375('0x5b')]['role'];return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x462cfe['params']['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x320b32,null))['then'](saveUpdates(_0x462cfe[_0x0375('0x5b')],null))['then'](respondWithResult(_0x320b32,null))[_0x0375('0x1b')](handleError(_0x320b32,null));};exports[_0x0375('0x5c')]=function(_0x566b61,_0x4c1229){return db[_0x0375('0x39')][_0x0375('0x5c')]()[_0x0375('0x26')](respondWithResult(_0x4c1229,null))[_0x0375('0x1b')](handleError(_0x4c1229,null));};exports[_0x0375('0x5d')]=function(_0x1129e6,_0xe88d18){return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x1129e6[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0xe88d18,null))[_0x0375('0x26')](function(_0x2ff912){if(_0x2ff912){return _0x2ff912[_0x0375('0x5d')](_0x1129e6['body'][_0x0375('0x5f')],_[_0x0375('0x60')](_0x1129e6[_0x0375('0x5b')],[_0x0375('0x5f'),'id'])||{});}})[_0x0375('0x26')](respondWithResult(_0xe88d18,null))['catch'](handleError(_0xe88d18,null));};function validateUser(_0x1e46d0){return new BPromise(function(_0x218166,_0x446d08){if(_0x1e46d0[_0x0375('0x61')])return _0x218166(_0x1e46d0);return db[_0x0375('0x62')][_0x0375('0x63')](0x1)[_0x0375('0x26')](function(_0x281168){if(_0x281168[_0x0375('0x64')])authService[_0x0375('0x65')](_0x1e46d0[_0x0375('0x3e')]);db['User'][_0x0375('0x66')]('internal')[_0x0375('0x26')](function(_0x50148a){if(_[_0x0375('0x67')](_0x50148a)){_0x1e46d0[_0x0375('0x61')]=_0x281168['min_internal']||0x1;return;}if(_[_0x0375('0x67')](_0x281168['min_internal'])||_0x281168[_0x0375('0x68')]===_0x50148a){_0x1e46d0[_0x0375('0x61')]=_0x50148a+0x1;return;}if(_0x281168[_0x0375('0x68')]>_0x50148a){_0x1e46d0[_0x0375('0x61')]=_0x281168[_0x0375('0x68')];return;}return db[_0x0375('0x69')][_0x0375('0x41')](_0x0375('0x6a'),{'type':db[_0x0375('0x69')][_0x0375('0x6b')]['SELECT']})['then'](function(_0x420020){if(_0x420020&&_0x420020[_0x0375('0x4c')]){for(var _0x3524e9=0x0,_0x1870b5=_0x420020[_0x0375('0x4c')];_0x3524e9<_0x1870b5&&_['isNil'](_0x1e46d0['internal']);_0x3524e9++){if(_0x281168[_0x0375('0x68')]<=_0x420020[_0x3524e9][_0x0375('0x6c')]){_0x1e46d0[_0x0375('0x61')]=_0x420020[_0x3524e9][_0x0375('0x6c')];}else if(_0x281168[_0x0375('0x68')]>_0x420020[_0x3524e9]['from']&&_0x281168[_0x0375('0x68')]<=_0x420020[_0x3524e9]['to']){_0x1e46d0[_0x0375('0x61')]=_0x281168['min_internal'];}}}if(_[_0x0375('0x67')](_0x1e46d0[_0x0375('0x61')])){_0x1e46d0[_0x0375('0x61')]=_0x50148a+0x1;}return _0x218166(_0x1e46d0);});});})[_0x0375('0x1b')](function(_0x5a2bc8){_0x446d08(_0x5a2bc8);});});}function updateUser(_0x123ee2){return new BPromise(function(_0x5d3a1d,_0xe524fb){try{if(_0x123ee2[_0x0375('0x6d')]){_0x123ee2[_0x0375('0x6e')]=_0x123ee2['internal'];_0x123ee2[_0x0375('0x6f')]={'mailbox':_0x123ee2[_0x0375('0x61')],'password':_0x123ee2[_0x0375('0x3e')],'fullname':_0x123ee2['fullname'],'email':_0x123ee2[_0x0375('0x70')]};}if(_0x123ee2[_0x0375('0x28')]===_0x0375('0x71')){if(!_0x123ee2['permissions'])_0x123ee2[_0x0375('0x72')]=[_0x0375('0x73'),_0x0375('0x74'),_0x0375('0x75'),_0x0375('0x76'),_0x0375('0x77'),'104',_0x0375('0x78'),'106','107',_0x0375('0x79'),_0x0375('0x7a'),'100',_0x0375('0x7b'),_0x0375('0x7c'),_0x0375('0x7d')];}_0x5d3a1d(_0x123ee2);}catch(_0x2027cf){_0xe524fb(_0x2027cf);}});}exports['create']=function(_0x2bba61,_0x383893){if(_0x2bba61[_0x0375('0x7e')]['role']===_0x0375('0x71'))throw new Error(_0x0375('0x7f'));if(_0x2bba61[_0x0375('0x5b')][_0x0375('0x28')]===_0x0375('0x7e')&&_0x2bba61[_0x0375('0x7e')][_0x0375('0x28')]!==_0x0375('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2bba61['body'][_0x0375('0x28')]===_0x0375('0x29')&&_0x2bba61['user'][_0x0375('0x28')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x0375('0x80')]([_0x2bba61['body']])[_0x0375('0x26')](function(){return validateUser(_0x2bba61[_0x0375('0x5b')]);})[_0x0375('0x26')](function(_0x3081b6){return updateUser(_0x3081b6)[_0x0375('0x26')](function(_0x283e5f){if(_0x283e5f[_0x0375('0x28')]===_0x0375('0x29')){_0x283e5f[_0x0375('0x81')]=_0x2bba61['user'][_0x0375('0x81')];delete _0x283e5f[_0x0375('0x82')];}return _0x283e5f;});})['then'](function(_0x589664){return db[_0x0375('0x39')][_0x0375('0x83')](_0x589664,{'include':[{'model':db[_0x0375('0x6f')],'as':_0x0375('0x6f')}]});})['then'](function(_0x16d5cc){if(_0x2bba61['body'][_0x0375('0x28')]===_0x0375('0x7e'))return _0x16d5cc;if(_0x2bba61[_0x0375('0x7e')][_0x0375('0x28')]!=='user')return _0x16d5cc;return db['UserProfileSection'][_0x0375('0x32')]({'where':{'name':_0x16d5cc['role']==='agent'?'Agents':_0x0375('0x84'),'userProfileId':_0x2bba61[_0x0375('0x7e')]['userProfileId']},'raw':!![]})[_0x0375('0x26')](function(_0x41ec85){if(!_0x41ec85||_0x41ec85[_0x0375('0x85')]!=0x0)return _0x16d5cc;return db['UserProfileResource'][_0x0375('0x83')]({'name':_0x16d5cc[_0x0375('0x36')],'resourceId':_0x16d5cc['id'],'type':_0x41ec85[_0x0375('0x36')],'sectionId':_0x41ec85['id']},{})[_0x0375('0x26')](function(){return _0x16d5cc;});})[_0x0375('0x1b')](function(_0x1915ea){logger[_0x0375('0x16')](_0x0375('0x86'),_0x1915ea);throw _0x1915ea;});})[_0x0375('0x26')](respondWithResult(_0x383893,0xc9))['catch'](handleError(_0x383893,null));};exports[_0x0375('0x87')]=function(_0x56c9f1,_0x514071){var _0x261c35=_0x56c9f1['body'];var _0x12dd70=[];if(_0x56c9f1[_0x0375('0x7e')]['role']==='agent')throw new Error('Unauthorized');if(_['some'](_0x261c35,[_0x0375('0x28'),_0x0375('0x7e')])&&_0x56c9f1[_0x0375('0x7e')][_0x0375('0x28')]!=='admin'){throw new Error(_0x0375('0x88'));}if(_[_0x0375('0x89')](_0x261c35,[_0x0375('0x28'),_0x0375('0x29')])&&_0x56c9f1[_0x0375('0x7e')]['role']!=='admin'){throw new Error(_0x0375('0x8a'));}return licenseUtil[_0x0375('0x80')](_0x261c35)[_0x0375('0x26')](function(){return validateUser(_0x261c35[0x0]);})[_0x0375('0x26')](function(){for(var _0x4209a2=0x1;_0x4209a2<_0x261c35[_0x0375('0x4c')];_0x4209a2++){var _0x2bdfe4=_0x261c35[_0x4209a2-0x1]['internal'];if(!_0x261c35[_0x4209a2][_0x0375('0x61')])_0x261c35[_0x4209a2][_0x0375('0x61')]=_0x2bdfe4+0x1;_0x12dd70[_0x0375('0x48')](validateUser(_0x261c35[_0x4209a2]));}return BPromise[_0x0375('0x52')](_0x12dd70);})[_0x0375('0x26')](function(){_0x12dd70=[];for(var _0xf6e95c=0x0;_0xf6e95c<_0x261c35[_0x0375('0x4c')];_0xf6e95c++){_0x12dd70[_0x0375('0x48')](updateUser(_0x261c35[_0xf6e95c]));}return BPromise[_0x0375('0x52')](_0x12dd70);})['then'](function(){return BPromise[_0x0375('0x8b')](_0x261c35,function(_0x57933d){return db[_0x0375('0x39')][_0x0375('0x83')](_0x57933d,{'include':[{'model':db[_0x0375('0x6f')],'as':_0x0375('0x6f')}]})[_0x0375('0x26')](function(_0x4b352c){_0x57933d['id']=_0x4b352c['id'];return _0x57933d;});});})[_0x0375('0x26')](function(_0xeddc46){if(_0x56c9f1[_0x0375('0x5b')]['role']===_0x0375('0x7e'))return _0xeddc46;if(_0x56c9f1[_0x0375('0x7e')][_0x0375('0x28')]!==_0x0375('0x7e'))return _0xeddc46;var _0x1815b5=_[_0x0375('0x89')](_0xeddc46,function(_0x319bc8){return _0x319bc8[_0x0375('0x28')]===_0x0375('0x71')||_0x319bc8[_0x0375('0x28')]===_0x0375('0x2c');});if(!_0x1815b5)return _0xeddc46;return db[_0x0375('0x8c')][_0x0375('0x49')]({'where':{'name':{'$or':[_0x0375('0x2b'),_0x0375('0x84')]},'userProfileId':_0x56c9f1[_0x0375('0x7e')]['userProfileId']},'raw':!![]})[_0x0375('0x26')](function(_0x5b2b6b){if(_[_0x0375('0x8d')](_0x5b2b6b)||!_[_0x0375('0x89')](_0x5b2b6b,[_0x0375('0x85'),0x0]))return _0xeddc46;_0x12dd70=[];var _0x45538f=_(_0x5b2b6b)[_0x0375('0x2f')](function(_0xdf45f5){if(_0xdf45f5['autoAssociation']===0x1)return;return _0xdf45f5[_0x0375('0x36')]===_0x0375('0x2b')?'agent':_0x0375('0x2c');})[_0x0375('0x8e')]()[_0x0375('0x30')]();for(var _0x4a48d9=0x0;_0x4a48d9<_0xeddc46[_0x0375('0x4c')];_0x4a48d9++){if(!_[_0x0375('0x31')](_0x45538f,_0xeddc46[_0x4a48d9][_0x0375('0x28')]))return;var _0x484f25=_0xeddc46[_0x4a48d9][_0x0375('0x28')]==='agent'?_0x0375('0x2b'):'Telephones';_0x12dd70[_0x0375('0x48')](db[_0x0375('0x33')][_0x0375('0x83')]({'name':_0xeddc46[_0x4a48d9][_0x0375('0x36')],'resourceId':_0xeddc46[_0x4a48d9]['id'],'type':_0x484f25,'sectionId':_[_0x0375('0x32')](_0x5b2b6b,[_0x0375('0x36'),_0x484f25])['id']},{}));}return BPromise[_0x0375('0x52')](_0x12dd70);});})[_0x0375('0x26')](respondWithResult(_0x514071,0xc9))[_0x0375('0x1b')](handleError(_0x514071,null));};exports[_0x0375('0x8f')]=function(_0x1ad731,_0x385d11){if(_0x1ad731[_0x0375('0x5b')]['id']){delete _0x1ad731[_0x0375('0x5b')]['id'];}return db[_0x0375('0x39')]['find']({'where':{'id':_0x1ad731[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](function(_0x45ee49){if(!_0x45ee49)return null;if(_0x45ee49['id']===_0x1ad731[_0x0375('0x7e')]['id']){if(!_0x1ad731[_0x0375('0x5b')][_0x0375('0x90')]||!_0x1ad731['body'][_0x0375('0x91')]){throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0x94'));}if(!_0x45ee49[_0x0375('0x95')](_0x1ad731['body'][_0x0375('0x90')])){throw new db['Sequelize'][(_0x0375('0x93'))](_0x0375('0x96'));}if(_0x1ad731[_0x0375('0x5b')][_0x0375('0x90')]===_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')]){throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0x97'));}}else if(_0x1ad731['user'][_0x0375('0x28')]==='admin'){if(!_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')]){throw new db['Sequelize'][(_0x0375('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1ad731[_0x0375('0x7e')][_0x0375('0x28')]===_0x0375('0x7e')){if(!_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')]){throw new db[(_0x0375('0x92'))]['ValidationError'](_0x0375('0x98'));}if(_0x45ee49['role']!==_0x0375('0x71')){throw new db[(_0x0375('0x92'))]['ValidationError'](_0x0375('0x7f'));}}else{throw new db['Sequelize']['ValidationError'](_0x0375('0x7f'));}return _0x45ee49;})[_0x0375('0x26')](handleEntityNotFound(_0x385d11,null))[_0x0375('0x26')](function(_0x34cbfa){return db['Setting'][_0x0375('0x99')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x0375('0x9a')]})[_0x0375('0x26')](function(_0x27558b){if(_0x27558b[_0x0375('0x64')])authService[_0x0375('0x65')](_0x1ad731['body'][_0x0375('0x91')]);if(!_0x27558b[_0x0375('0x9b')]||!_0x34cbfa[_0x0375('0x9c')])return _0x34cbfa;authService[_0x0375('0x9d')](_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')],_0x34cbfa[_0x0375('0x9c')],_0x27558b[_0x0375('0x9a')]);return _0x34cbfa;})[_0x0375('0x26')](saveUpdates({'password':_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')],'passwordResetAt':_0x1ad731[_0x0375('0x7e')]['id']==_0x1ad731['params']['id']?moment():null,'previousPasswords':authService[_0x0375('0x9e')](_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')],_0x34cbfa[_0x0375('0x9c')])},null));})[_0x0375('0x26')](respondWithResult(_0x385d11,null))['catch'](handleError(_0x385d11,null));};exports['addQueues']=function(_0x302540,_0x53a5ae){var _0x21d779=_0x302540[_0x0375('0x5b')][_0x0375('0x9f')];return db[_0x0375('0x39')]['find']({'where':{'id':_0x302540['params']['id']},'attributes':['id',_0x0375('0x36'),_0x0375('0x28'),'online',_0x0375('0xa0'),_0x0375('0xa1'),_0x0375('0xa2')]})['then'](handleEntityNotFound(_0x53a5ae,null))[_0x0375('0x26')](function(_0x2b8f4b){if(_0x2b8f4b){if(!utils[_0x0375('0xa3')](_0x21d779)){throw new db['Sequelize'][(_0x0375('0x93'))](_0x0375('0xa4'));}return _0x2b8f4b['add'+_[_0x0375('0xa5')](_0x21d779[_0x0375('0xa6')]())+_0x0375('0xa7')](_0x302540[_0x0375('0x5b')][_0x0375('0x5f')],{'penalty':_0x302540[_0x0375('0x5b')][_0x0375('0xa8')]||0x0})[_0x0375('0xa9')](function(_0x2eadff){for(var _0x3f082f=0x0;_0x3f082f<_0x302540[_0x0375('0x5b')][_0x0375('0x5f')]['length'];_0x3f082f+=0x1){var _0x1cb6f6={'UserId':Number(_0x302540[_0x0375('0x5e')]['id'])};_0x1cb6f6[_['capitalize'](_0x21d779['toLowerCase']())+_0x0375('0xaa')]=Number(_0x302540['body']['ids'][_0x3f082f]);socket[_0x0375('0xab')]('user'+_[_0x0375('0xa5')](_0x21d779[_0x0375('0xa6')]())+'Queue:save',_0x1cb6f6);}return _0x2eadff;})[_0x0375('0x26')](function(){if(_0x21d779===_0x0375('0xac')){return db[_0x0375('0xad')][_0x0375('0x49')]({'where':{'id':_0x302540[_0x0375('0x5b')]['ids']||[]},'raw':!![],'attributes':['id',_0x0375('0x36')]});}})[_0x0375('0x26')](function(_0x13fce8){var _0x1d83b3=_0x2b8f4b[_0x0375('0x27')]({'plain':!![]});var _0x391cdc=[];if(_0x21d779===_0x0375('0xac')&&_0x1d83b3[_0x0375('0x28')]===_0x0375('0x71')&&_0x1d83b3['online']){for(var _0x2f948e=0x0;_0x2f948e<_0x13fce8[_0x0375('0x4c')];_0x2f948e+=0x1){_0x391cdc['push']({'membername':_0x1d83b3['name'],'UserId':_0x1d83b3['id'],'queue_name':_0x13fce8[_0x2f948e][_0x0375('0x36')],'VoiceQueueId':_0x13fce8[_0x2f948e]['id'],'interface':_['isNil'](_0x1d83b3[_0x0375('0xa2')])?util[_0x0375('0xae')](_0x0375('0xaf'),_0x1d83b3[_0x0375('0x36')]):_0x1d83b3['interface'],'paused':_0x1d83b3[_0x0375('0xa1')]||![],'penalty':_0x302540[_0x0375('0x5b')][_0x0375('0xa8')]||0x0});}return BPromise[_0x0375('0x8b')](_0x391cdc,function(_0x2f34bc){return db[_0x0375('0xb0')][_0x0375('0xb1')](_0x2f34bc);});}return _0x2b8f4b;});}})[_0x0375('0x26')](respondWithStatusCode(_0x53a5ae,null))[_0x0375('0x1b')](handleError(_0x53a5ae,null));};exports[_0x0375('0xb2')]=function(_0x25701b,_0x13b913){var _0x8433e1,_0x3ea368;return db[_0x0375('0x39')]['find']({'where':{'id':_0x25701b['params']['id']},'attributes':['id',_0x0375('0x36'),_0x0375('0x28')]})[_0x0375('0x26')](handleEntityNotFound(_0x13b913,null))[_0x0375('0x26')](function(_0x3e2021){if(_0x3e2021){_0x8433e1=_0x3e2021;if(!_0x25701b[_0x0375('0x41')][_0x0375('0x9f')]||!utils[_0x0375('0xa3')](_0x25701b[_0x0375('0x41')][_0x0375('0x9f')])){throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0xa4'));}return _0x3e2021[_0x0375('0xb3')+_[_0x0375('0xa5')](_0x25701b[_0x0375('0x41')][_0x0375('0x9f')]['toLowerCase']())+'Queues'](_0x25701b[_0x0375('0x41')][_0x0375('0x5f')]);}})['then'](function(_0x2beb04){if(_[_0x0375('0xb4')](_0x25701b[_0x0375('0x41')][_0x0375('0x5f')])){for(var _0x7a6e9c=0x0;_0x7a6e9c<_0x25701b[_0x0375('0x41')][_0x0375('0x5f')]['length'];_0x7a6e9c+=0x1){_0x3ea368={'UserId':Number(_0x25701b['params']['id'])};_0x3ea368[_['capitalize'](_0x25701b[_0x0375('0x41')]['channel']['toLowerCase']())+'QueueId']=Number(_0x25701b[_0x0375('0x41')][_0x0375('0x5f')][_0x7a6e9c]);socket[_0x0375('0xab')](_0x0375('0x7e')+_[_0x0375('0xa5')](_0x25701b[_0x0375('0x41')]['channel'][_0x0375('0xa6')]())+_0x0375('0xb5'),_0x3ea368);}}else{_0x3ea368={'UserId':Number(_0x25701b[_0x0375('0x5e')]['id'])};_0x3ea368[_[_0x0375('0xa5')](_0x25701b[_0x0375('0x41')][_0x0375('0x9f')][_0x0375('0xa6')]())+_0x0375('0xaa')]=Number(_0x25701b[_0x0375('0x41')][_0x0375('0x5f')]);socket[_0x0375('0xab')]('user'+_[_0x0375('0xa5')](_0x25701b[_0x0375('0x41')][_0x0375('0x9f')][_0x0375('0xa6')]())+_0x0375('0xb5'),_0x3ea368);}return _0x2beb04;})[_0x0375('0x26')](function(){if(_0x25701b[_0x0375('0x41')][_0x0375('0x9f')]==='voice'){return db[_0x0375('0xb0')][_0x0375('0x25')]({'where':{'UserId':_0x25701b[_0x0375('0x5e')]['id'],'VoiceQueueId':_0x25701b[_0x0375('0x41')]['ids']},'individualHooks':!![]})[_0x0375('0x26')](function(){return _0x8433e1;});}return _0x8433e1;})[_0x0375('0x26')](respondWithStatusCode(_0x13b913,null))[_0x0375('0x1b')](handleError(_0x13b913,null));};exports['addAvatar']=function(_0x2fdd03,_0x512989){_0x2fdd03[_0x0375('0x5b')][_0x0375('0xb6')]=_0x2fdd03[_0x0375('0xb7')][_0x0375('0xb8')];return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x2fdd03[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x512989,null))['then'](saveUpdates(_0x2fdd03['body'],null))[_0x0375('0x26')](respondWithResult(_0x512989,null))[_0x0375('0x1b')](handleError(_0x512989,null));};exports[_0x0375('0xb9')]=function(_0x5472c5,_0x2472a1){var _0x1a83c7=path[_0x0375('0xba')](config[_0x0375('0xbb')],'server/files/images/logos/default_profile.png');return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x5472c5[_0x0375('0x5e')]['id']},'attributes':['id',_0x0375('0xb6')],'raw':!![]})[_0x0375('0x26')](handleEntityNotFound(_0x2472a1,null))[_0x0375('0x26')](function(_0x4326aa){if(_0x4326aa){if(_['isNil'](_0x4326aa['userpic'])){return _0x2472a1[_0x0375('0xbc')](_0x1a83c7);}else{if(!fs['existsSync'](path[_0x0375('0xba')](config[_0x0375('0xbb')],'server/files/images/',_0x4326aa['userpic']))){return _0x2472a1['download'](_0x1a83c7);}return _0x2472a1[_0x0375('0xbc')](path[_0x0375('0xba')](config[_0x0375('0xbb')],_0x0375('0xbd'),_0x4326aa[_0x0375('0xb6')]));}}})[_0x0375('0x1b')](handleError(_0x2472a1,null));};exports[_0x0375('0xbe')]=function(_0x219bac,_0x5dd8c0){return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x219bac['params']['id']},'attributes':['id']})[_0x0375('0x26')](handleEntityNotFound(_0x5dd8c0,null))['then'](function(_0x49485f){var _0x11a2d9=[];values=_0x49485f['dataValues'];_0x11a2d9[_0x0375('0x48')](get_open_tabs('chat',_0x49485f[_0x0375('0x4e')]));_0x11a2d9[_0x0375('0x48')](get_open_tabs('sms',_0x49485f[_0x0375('0x4e')]));_0x11a2d9[_0x0375('0x48')](get_open_tabs(_0x0375('0x50'),_0x49485f['dataValues']));_0x11a2d9[_0x0375('0x48')](get_open_tabs('whatsapp',_0x49485f[_0x0375('0x4e')]));_0x11a2d9[_0x0375('0x48')](get_open_tabs(_0x0375('0xbf'),_0x49485f['dataValues']));_0x11a2d9[_0x0375('0x48')](get_open_tabs(_0x0375('0x4f'),_0x49485f[_0x0375('0x4e')]));return BPromise[_0x0375('0x52')](_0x11a2d9);})[_0x0375('0x26')](function(_0x568b3f){if(_0x568b3f){var _0x5cc970=_[_0x0375('0x2f')](values[_0x0375('0xc0')],function(_0x1045bc){return{'channel':_0x0375('0xc1'),'id':_0x1045bc['id'],'createdAt':_0x1045bc[_0x0375('0xc2')]};});var _0x6fd7c1=_[_0x0375('0x2f')](values[_0x0375('0xc3')],function(_0x11e17b){return{'channel':_0x0375('0xc4'),'id':_0x11e17b['id'],'createdAt':_0x11e17b[_0x0375('0xc2')]};});var _0x36c744=_['map'](values[_0x0375('0xc5')],function(_0x8b6751){return{'channel':_0x0375('0xc6'),'id':_0x8b6751['id'],'createdAt':_0x8b6751[_0x0375('0xc2')]};});var _0xfe1ce0=_[_0x0375('0x2f')](values[_0x0375('0xc7')],function(_0x48a946){return{'channel':'MAIL','id':_0x48a946['id'],'createdAt':_0x48a946[_0x0375('0xc2')]};});var _0x37d488=_[_0x0375('0x2f')](values['SmsOpenTabs'],function(_0x1a0995){return{'channel':_0x0375('0xc8'),'id':_0x1a0995['id'],'createdAt':_0x1a0995['createdAt']};});var _0x214e73=_[_0x0375('0x2f')](values[_0x0375('0xc9')],function(_0x1caab4){return{'channel':_0x0375('0xca'),'id':_0x1caab4['id'],'createdAt':_0x1caab4[_0x0375('0xc2')]};});var _0x1d172a=_[_0x0375('0xcb')](_0x5cc970,_0x6fd7c1,_0x36c744,_0xfe1ce0,_0x37d488,_0x214e73);var _0x50618e={'count':_0x1d172a[_0x0375('0x4c')],'rows':_0x1d172a};return _0x50618e;}else return null;})[_0x0375('0x26')](respondWithResult(_0x5dd8c0,null))[_0x0375('0x1b')](handleError(_0x5dd8c0,null));};exports[_0x0375('0xcc')]=function(_0x422afc,_0x2c32d2){var _0xb833d4={};var _0x348920={};var _0x2d03ec;var _0x566e7b;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x422afc[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x2c32d2,null))[_0x0375('0x26')](function(_0x2138b1){if(_0x2138b1){_0x2d03ec=_0x2138b1;_0x348920[_0x0375('0x54')]=_[_0x0375('0xcd')](db['CmContact'][_0x0375('0x3a')]);_0x348920[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x422afc[_0x0375('0x41')]);_0x348920[_0x0375('0x56')]=_[_0x0375('0x57')](_0x348920[_0x0375('0x54')],_0x348920[_0x0375('0x41')]);_0xb833d4[_0x0375('0x47')]=_[_0x0375('0x57')](_0x348920[_0x0375('0x54')],qs[_0x0375('0x58')](_0x422afc[_0x0375('0x41')][_0x0375('0x58')]));_0xb833d4['attributes']=_0xb833d4[_0x0375('0x47')][_0x0375('0x4c')]?_0xb833d4[_0x0375('0x47')]:_0x348920['model'];_0xb833d4[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x422afc[_0x0375('0x41')][_0x0375('0xcf')]);_0xb833d4[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x422afc['query'],_0x348920['filters']));if(_0x422afc['query'][_0x0375('0x2d')]){_0xb833d4[_0x0375('0x40')]=_[_0x0375('0xd1')](_0xb833d4['where'],{'$or':_[_0x0375('0x2f')](_0xb833d4['attributes'],function(_0x3953ee){var _0x5dbd9d={};_0x5dbd9d[_0x3953ee]={'$like':'%'+_0x422afc[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x5dbd9d;})});}_0xb833d4=_[_0x0375('0xd1')]({},_0xb833d4,_0x422afc[_0x0375('0x59')]);return _0x2d03ec[_0x0375('0xcc')](_0xb833d4);}})[_0x0375('0x26')](function(_0x4cae8c){if(_0x4cae8c){_0x566e7b=_0x4cae8c[_0x0375('0x4c')];if(_0x422afc[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0x42'))){_0xb833d4[_0x0375('0x43')]=[{'model':db[_0x0375('0xd3')],'as':_0x0375('0xd4'),'required':![]},{'model':db[_0x0375('0xd5')],'as':'Tags','attributes':['id',_0x0375('0x36'),_0x0375('0xd6')],'where':_0x422afc[_0x0375('0x41')][_0x0375('0xd7')]?{'id':_0x422afc['query'][_0x0375('0xd7')]}:undefined,'required':_0x422afc[_0x0375('0x41')][_0x0375('0xd7')]?!![]:![]}];}if(!_0x422afc[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0xb833d4['limit']=qs['limit'](_0x422afc[_0x0375('0x41')][_0x0375('0x21')]);_0xb833d4[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x422afc[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x2d03ec[_0x0375('0xcc')](_0xb833d4);}})[_0x0375('0x26')](function(_0x343364){if(_0x343364){return _0x343364?{'count':_0x566e7b,'rows':_0x343364}:null;}})[_0x0375('0x26')](respondWithResult(_0x2c32d2,null))['catch'](handleError(_0x2c32d2,null));};exports[_0x0375('0xd9')]=function(_0x3ebab0,_0xe8d720){var _0x2cb491;var _0x3e091d={};var _0x27fb4e;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x3ebab0['params']['id']},'attributes':['id',_0x0375('0x36'),_0x0375('0x28')]})[_0x0375('0x26')](handleEntityNotFound(_0xe8d720,null))[_0x0375('0x26')](function(_0x34fdf5){if(!utils[_0x0375('0xa3')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])){throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0xa4'));}_0x2cb491=_0x34fdf5;var _0x75664a={};_0x75664a[_0x0375('0x54')]=_['keys'](db[_[_0x0375('0xa5')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])+_0x0375('0xda')][_0x0375('0x3a')]);_0x75664a[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x3ebab0['query']);_0x75664a[_0x0375('0x56')]=_[_0x0375('0x57')](_0x75664a[_0x0375('0x54')],_0x75664a['query']);_0x3e091d[_0x0375('0x47')]=_[_0x0375('0x57')](_0x75664a[_0x0375('0x54')],qs[_0x0375('0x58')](_0x3ebab0['query'][_0x0375('0x58')]));_0x3e091d[_0x0375('0x47')]=_0x3e091d[_0x0375('0x47')]['length']?_0x3e091d[_0x0375('0x47')]:_0x75664a[_0x0375('0x54')];_0x3e091d[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x3ebab0['query'][_0x0375('0xcf')]);_0x3e091d[_0x0375('0x40')]=qs['filters'](_['pick'](_0x3ebab0['query'],_0x75664a[_0x0375('0x56')]));if(_0x3ebab0[_0x0375('0x41')][_0x0375('0x2d')]){_0x3e091d['where']=_['merge'](_0x3e091d[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x3e091d[_0x0375('0x47')],function(_0x22fc88){var _0x6c257a={};_0x6c257a[_0x22fc88]={'$like':'%'+_0x3ebab0[_0x0375('0x41')]['filter']+'%'};return _0x6c257a;})});}_0x3e091d=_['merge']({},_0x3e091d,_0x3ebab0[_0x0375('0x59')]);switch(_0x2cb491[_0x0375('0x28')]){case _0x0375('0x29'):return db[_[_0x0375('0xa5')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])+_0x0375('0xda')]['findAll'](_0x3e091d);case _0x0375('0x7e'):case _0x0375('0x71'):return _0x2cb491[_0x0375('0x27')+_['capitalize'](_0x3ebab0['query'][_0x0375('0x9f')])+'Queues'](_0x3e091d);default:throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0xdb'));}})['then'](function(_0x7bfd6c){_0x27fb4e=_0x7bfd6c['length'];if(!_0x3ebab0[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x3e091d[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x21')]);_0x3e091d[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x3ebab0[_0x0375('0x41')]['offset']);}switch(_0x2cb491[_0x0375('0x28')]){case _0x0375('0x29'):return db[_['capitalize'](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])+'Queue'][_0x0375('0x49')](_0x3e091d);case _0x0375('0x7e'):case'agent':return _0x2cb491['get'+_[_0x0375('0xa5')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])+_0x0375('0xa7')](_0x3e091d);}})['then'](function(_0x42809b){return{'count':_0x27fb4e,'rows':_0x42809b};})[_0x0375('0x26')](respondWithResult(_0xe8d720,null))[_0x0375('0x1b')](handleError(_0xe8d720,null));};exports[_0x0375('0xdc')]=function(_0x10ae03,_0xdcc593){var _0x4439e7={};var _0x4f7b4f={};var _0x4a6fe0;var _0x2c0127;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x10ae03[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0xdcc593,null))[_0x0375('0x26')](function(_0x534f71){if(_0x534f71){_0x4a6fe0=_0x534f71;_0x4f7b4f[_0x0375('0x54')]=_['keys'](db['UserVoiceQueueRt'][_0x0375('0x3a')]);_0x4f7b4f[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x10ae03[_0x0375('0x41')]);_0x4f7b4f[_0x0375('0x56')]=_['intersection'](_0x4f7b4f[_0x0375('0x54')],_0x4f7b4f['query']);_0x4439e7[_0x0375('0x47')]=_[_0x0375('0x57')](_0x4f7b4f[_0x0375('0x54')],qs[_0x0375('0x58')](_0x10ae03['query'][_0x0375('0x58')]));_0x4439e7[_0x0375('0x47')]=_0x4439e7[_0x0375('0x47')][_0x0375('0x4c')]?_0x4439e7['attributes']:_0x4f7b4f[_0x0375('0x54')];_0x4439e7[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x10ae03[_0x0375('0x41')][_0x0375('0xcf')]);_0x4439e7[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x10ae03['query'],_0x4f7b4f[_0x0375('0x56')]));if(_0x10ae03[_0x0375('0x41')]['filter']){_0x4439e7['where']=_[_0x0375('0xd1')](_0x4439e7[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x4439e7[_0x0375('0x47')],function(_0x7165b){var _0x4eeef7={};_0x4eeef7[_0x7165b]={'$like':'%'+_0x10ae03[_0x0375('0x41')]['filter']+'%'};return _0x4eeef7;})});}_0x4439e7=_['merge']({},_0x4439e7,_0x10ae03[_0x0375('0x59')]);return _0x4a6fe0[_0x0375('0xdc')](_0x4439e7);}})[_0x0375('0x26')](function(_0x56a446){if(_0x56a446){_0x2c0127=_0x56a446[_0x0375('0x4c')];if(!_0x10ae03[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0x4439e7[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x10ae03[_0x0375('0x41')][_0x0375('0x21')]);_0x4439e7[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x10ae03[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x4a6fe0[_0x0375('0xdc')](_0x4439e7);}})[_0x0375('0x26')](function(_0x52986c){if(_0x52986c){return _0x52986c?{'count':_0x2c0127,'rows':_0x52986c}:null;}})[_0x0375('0x26')](respondWithResult(_0xdcc593,null))[_0x0375('0x1b')](handleError(_0xdcc593,null));};exports[_0x0375('0xdd')]=function(_0x273f82,_0x1a5985){var _0x22bd5f={};var _0x377923={};var _0x1911fc;var _0x47513e;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x273f82[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1a5985,null))[_0x0375('0x26')](function(_0x598002){if(_0x598002){_0x1911fc=_0x598002;_0x377923[_0x0375('0x54')]=_[_0x0375('0xcd')](db['ChatGroup'][_0x0375('0x3a')]);_0x377923[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x273f82[_0x0375('0x41')]);_0x377923[_0x0375('0x56')]=_['intersection'](_0x377923['model'],_0x377923[_0x0375('0x41')]);_0x22bd5f[_0x0375('0x47')]=_[_0x0375('0x57')](_0x377923[_0x0375('0x54')],qs['fields'](_0x273f82[_0x0375('0x41')][_0x0375('0x58')]));_0x22bd5f[_0x0375('0x47')]=_0x22bd5f[_0x0375('0x47')]['length']?_0x22bd5f['attributes']:_0x377923['model'];_0x22bd5f[_0x0375('0xce')]=qs['sort'](_0x273f82[_0x0375('0x41')][_0x0375('0xcf')]);_0x22bd5f[_0x0375('0x40')]=qs['filters'](_[_0x0375('0xd0')](_0x273f82[_0x0375('0x41')],_0x377923['filters']));if(_0x273f82[_0x0375('0x41')][_0x0375('0x2d')]){_0x22bd5f[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x22bd5f['where'],{'$or':_[_0x0375('0x2f')](_0x22bd5f[_0x0375('0x47')],function(_0x5f061e){var _0x11984c={};_0x11984c[_0x5f061e]={'$like':'%'+_0x273f82['query']['filter']+'%'};return _0x11984c;})});}_0x22bd5f=_[_0x0375('0xd1')]({},_0x22bd5f,_0x273f82[_0x0375('0x59')]);return _0x1911fc[_0x0375('0xdd')](_0x22bd5f);}})['then'](function(_0x41747d){if(_0x41747d){_0x47513e=_0x41747d[_0x0375('0x4c')];if(!_0x273f82[_0x0375('0x41')][_0x0375('0xd2')]('nolimit')){_0x22bd5f[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x273f82[_0x0375('0x41')]['limit']);_0x22bd5f[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x273f82[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x1911fc['getGroups'](_0x22bd5f);}})['then'](function(_0xd2862f){if(_0xd2862f){return _0xd2862f?{'count':_0x47513e,'rows':_0xd2862f}:null;}})[_0x0375('0x26')](respondWithResult(_0x1a5985,null))[_0x0375('0x1b')](handleError(_0x1a5985,null));};exports[_0x0375('0xde')]=function(_0x1e776d,_0x34c494){var _0x535e1c={'raw':!![],'where':{}};var _0x309916={};var _0x210306={'count':0x0,'rows':[]};return db[_0x0375('0x39')]['findOne']({'where':{'id':_0x1e776d['params']['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x34c494,null))['then'](function(_0x439926){if(_0x439926){_0x309916['model']=_['keys'](db[_0x0375('0xdf')][_0x0375('0x3a')]);_0x309916[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x1e776d[_0x0375('0x41')]);_0x309916['filters']=_[_0x0375('0x57')](_0x309916[_0x0375('0x54')],_0x309916['query']);_0x535e1c[_0x0375('0x47')]=_[_0x0375('0x57')](_0x309916[_0x0375('0x54')],qs['fields'](_0x1e776d['query'][_0x0375('0x58')]));_0x535e1c[_0x0375('0x47')]=_0x535e1c[_0x0375('0x47')]['length']?_0x535e1c[_0x0375('0x47')]:_0x309916[_0x0375('0x54')];if(!_0x1e776d[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x535e1c['limit']=qs[_0x0375('0x21')](_0x1e776d[_0x0375('0x41')]['limit']);_0x535e1c[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x1e776d[_0x0375('0x41')]['offset']);}_0x535e1c[_0x0375('0xce')]=qs['sort'](_0x1e776d['query'][_0x0375('0xcf')]);_0x535e1c['where']=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x1e776d[_0x0375('0x41')],_0x309916[_0x0375('0x56')]));_0x535e1c[_0x0375('0x40')][_0x0375('0xe0')]=_0x439926['id'];if(_0x1e776d[_0x0375('0x41')][_0x0375('0x2d')]){_0x535e1c[_0x0375('0x40')]=_['merge'](_0x535e1c[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x535e1c['attributes'],function(_0x5cdedf){var _0x180a45={};_0x180a45[_0x5cdedf]={'$like':'%'+_0x1e776d[_0x0375('0x41')]['filter']+'%'};return _0x180a45;})});}_0x535e1c=_[_0x0375('0xd1')]({},_0x535e1c,_0x1e776d[_0x0375('0x59')]);return db[_0x0375('0xdf')][_0x0375('0x22')]({'where':_0x535e1c[_0x0375('0x40')]})['then'](function(_0x1717df){_0x210306[_0x0375('0x22')]=_0x1717df;if(_0x1e776d[_0x0375('0x41')][_0x0375('0x42')]){_0x535e1c[_0x0375('0x43')]=[{'all':!![]}];}return db[_0x0375('0xdf')]['findAll'](_0x535e1c);})[_0x0375('0x26')](function(_0x11099e){_0x210306['rows']=_0x11099e;return _0x210306;});}})[_0x0375('0x26')](respondWithFilteredResult(_0x34c494,_0x535e1c))[_0x0375('0x1b')](handleError(_0x34c494,null));};exports[_0x0375('0xe1')]=function(_0x4d9383,_0x490cf1){var _0x30a845={'raw':!![],'where':{}};var _0x40acf7={};var _0x5bdf55={'count':0x0,'rows':[]};return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x4d9383[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x490cf1,null))[_0x0375('0x26')](function(_0x4a2c1f){if(_0x4a2c1f){_0x40acf7[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0xe2')]['rawAttributes']);_0x40acf7[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x4d9383[_0x0375('0x41')]);_0x40acf7[_0x0375('0x56')]=_[_0x0375('0x57')](_0x40acf7['model'],_0x40acf7[_0x0375('0x41')]);_0x30a845[_0x0375('0x47')]=_[_0x0375('0x57')](_0x40acf7['model'],qs[_0x0375('0x58')](_0x4d9383['query']['fields']));_0x30a845[_0x0375('0x47')]=_0x30a845[_0x0375('0x47')][_0x0375('0x4c')]?_0x30a845['attributes']:_0x40acf7[_0x0375('0x54')];if(!_0x4d9383[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x30a845[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x4d9383[_0x0375('0x41')][_0x0375('0x21')]);_0x30a845['offset']=qs[_0x0375('0x1f')](_0x4d9383[_0x0375('0x41')]['offset']);}_0x30a845[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x4d9383[_0x0375('0x41')]['sort']);_0x30a845[_0x0375('0x40')]=qs[_0x0375('0x56')](_['pick'](_0x4d9383[_0x0375('0x41')],_0x40acf7['filters']));_0x30a845[_0x0375('0x40')]['UserId']=_0x4a2c1f['id'];if(_0x4d9383[_0x0375('0x41')]['filter']){_0x30a845[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x30a845['where'],{'$or':_[_0x0375('0x2f')](_0x30a845['attributes'],function(_0x4d1cd6){var _0xa2f919={};_0xa2f919[_0x4d1cd6]={'$like':'%'+_0x4d9383['query']['filter']+'%'};return _0xa2f919;})});}_0x30a845=_[_0x0375('0xd1')]({},_0x30a845,_0x4d9383[_0x0375('0x59')]);return db[_0x0375('0xe2')][_0x0375('0x22')]({'where':_0x30a845[_0x0375('0x40')]})['then'](function(_0x5801a7){_0x5bdf55[_0x0375('0x22')]=_0x5801a7;if(_0x4d9383['query'][_0x0375('0x42')]){_0x30a845[_0x0375('0x43')]=[{'all':!![]}];}return db[_0x0375('0xe2')][_0x0375('0x49')](_0x30a845);})['then'](function(_0x274727){_0x5bdf55[_0x0375('0x4b')]=_0x274727;return _0x5bdf55;});}})['then'](respondWithFilteredResult(_0x490cf1,_0x30a845))[_0x0375('0x1b')](handleError(_0x490cf1,null));};exports[_0x0375('0xe3')]=function(_0x718a49,_0x55bcf6){var _0x36d200={};var _0x552d32={};var _0x12ddf6;var _0x2f036e;return db['User'][_0x0375('0x99')]({'where':{'id':_0x718a49[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0x55bcf6,null))[_0x0375('0x26')](function(_0x872d9){if(_0x872d9){_0x12ddf6=_0x872d9;_0x552d32[_0x0375('0x54')]=_['keys'](db[_0x0375('0xe4')][_0x0375('0x3a')]);_0x552d32[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x718a49[_0x0375('0x41')]);_0x552d32['filters']=_[_0x0375('0x57')](_0x552d32[_0x0375('0x54')],_0x552d32[_0x0375('0x41')]);_0x36d200[_0x0375('0x47')]=_['intersection'](_0x552d32[_0x0375('0x54')],qs[_0x0375('0x58')](_0x718a49[_0x0375('0x41')][_0x0375('0x58')]));_0x36d200['attributes']=_0x36d200['attributes'][_0x0375('0x4c')]?_0x36d200['attributes']:_0x552d32[_0x0375('0x54')];_0x36d200['order']=qs[_0x0375('0xcf')](_0x718a49[_0x0375('0x41')][_0x0375('0xcf')]);_0x36d200[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x718a49[_0x0375('0x41')],_0x552d32[_0x0375('0x56')]));if(_0x718a49[_0x0375('0x41')][_0x0375('0x2d')]){_0x36d200[_0x0375('0x40')]=_['merge'](_0x36d200[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x36d200[_0x0375('0x47')],function(_0x22b8ee){var _0xa0d89d={};_0xa0d89d[_0x22b8ee]={'$like':'%'+_0x718a49['query']['filter']+'%'};return _0xa0d89d;})});}_0x36d200=_['merge']({},_0x36d200,_0x718a49[_0x0375('0x59')]);return _0x12ddf6['getChatInteractions'](_0x36d200);}})[_0x0375('0x26')](function(_0x2b8180){if(_0x2b8180){_0x2f036e=_0x2b8180[_0x0375('0x4c')];if(!_0x718a49[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x36d200[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x718a49[_0x0375('0x41')][_0x0375('0x21')]);_0x36d200['offset']=qs[_0x0375('0x1f')](_0x718a49[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x12ddf6[_0x0375('0xe3')](_0x36d200);}})[_0x0375('0x26')](function(_0x17db3d){if(_0x17db3d){return _0x17db3d?{'count':_0x2f036e,'rows':_0x17db3d}:null;}})[_0x0375('0x26')](respondWithResult(_0x55bcf6,null))[_0x0375('0x1b')](handleError(_0x55bcf6,null));};exports[_0x0375('0xe5')]=function(_0x4a640e,_0x158b51){var _0x3e72c6={};var _0x38a66a={};var _0x4d1e9a;var _0x4b9710;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x4a640e[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x158b51,null))[_0x0375('0x26')](function(_0x3b7196){if(_0x3b7196){_0x4d1e9a=_0x3b7196;_0x38a66a[_0x0375('0x54')]=_[_0x0375('0xcd')](db['OpenchannelInteraction']['rawAttributes']);_0x38a66a[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x4a640e[_0x0375('0x41')]);_0x38a66a[_0x0375('0x56')]=_['intersection'](_0x38a66a[_0x0375('0x54')],_0x38a66a['query']);_0x3e72c6['attributes']=_[_0x0375('0x57')](_0x38a66a[_0x0375('0x54')],qs[_0x0375('0x58')](_0x4a640e[_0x0375('0x41')]['fields']));_0x3e72c6[_0x0375('0x47')]=_0x3e72c6[_0x0375('0x47')][_0x0375('0x4c')]?_0x3e72c6[_0x0375('0x47')]:_0x38a66a[_0x0375('0x54')];_0x3e72c6[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x4a640e[_0x0375('0x41')]['sort']);_0x3e72c6[_0x0375('0x40')]=qs[_0x0375('0x56')](_['pick'](_0x4a640e[_0x0375('0x41')],_0x38a66a[_0x0375('0x56')]));if(_0x4a640e[_0x0375('0x41')][_0x0375('0x2d')]){_0x3e72c6['where']=_[_0x0375('0xd1')](_0x3e72c6[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x3e72c6['attributes'],function(_0x3cfda7){var _0x4dbf88={};_0x4dbf88[_0x3cfda7]={'$like':'%'+_0x4a640e[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x4dbf88;})});}_0x3e72c6=_[_0x0375('0xd1')]({},_0x3e72c6,_0x4a640e[_0x0375('0x59')]);return _0x4d1e9a[_0x0375('0xe5')](_0x3e72c6);}})[_0x0375('0x26')](function(_0x577863){if(_0x577863){_0x4b9710=_0x577863[_0x0375('0x4c')];if(!_0x4a640e['query']['hasOwnProperty']('nolimit')){_0x3e72c6[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x4a640e[_0x0375('0x41')][_0x0375('0x21')]);_0x3e72c6[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x4a640e['query'][_0x0375('0x1f')]);}return _0x4d1e9a['getOpenchannelInteractions'](_0x3e72c6);}})[_0x0375('0x26')](function(_0x4f11eb){if(_0x4f11eb){return _0x4f11eb?{'count':_0x4b9710,'rows':_0x4f11eb}:null;}})['then'](respondWithResult(_0x158b51,null))[_0x0375('0x1b')](handleError(_0x158b51,null));};exports['getMailInteractions']=function(_0x240de0,_0x1db51f){var _0x58382a={'raw':!![],'where':{}};var _0x3355b3={};var _0x2e6e2e={'count':0x0,'rows':[]};return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x240de0[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x1db51f,null))[_0x0375('0x26')](function(_0x4cb60a){if(_0x4cb60a){_0x3355b3[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0xe6')]['rawAttributes']);_0x3355b3[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x240de0[_0x0375('0x41')]);_0x3355b3[_0x0375('0x56')]=_[_0x0375('0x57')](_0x3355b3[_0x0375('0x54')],_0x3355b3[_0x0375('0x41')]);_0x58382a['attributes']=_[_0x0375('0x57')](_0x3355b3[_0x0375('0x54')],qs[_0x0375('0x58')](_0x240de0[_0x0375('0x41')][_0x0375('0x58')]));_0x58382a[_0x0375('0x47')]=_0x58382a[_0x0375('0x47')][_0x0375('0x4c')]?_0x58382a[_0x0375('0x47')]:_0x3355b3[_0x0375('0x54')];if(!_0x240de0[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0x58382a['limit']=qs[_0x0375('0x21')](_0x240de0['query'][_0x0375('0x21')]);_0x58382a[_0x0375('0x1f')]=qs['offset'](_0x240de0[_0x0375('0x41')]['offset']);}_0x58382a[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x240de0[_0x0375('0x41')][_0x0375('0xcf')]);_0x58382a[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x240de0[_0x0375('0x41')],_0x3355b3[_0x0375('0x56')]));_0x58382a[_0x0375('0x40')][_0x0375('0xe0')]=_0x4cb60a['id'];if(_0x240de0['query'][_0x0375('0x2d')]){_0x58382a['where']=_[_0x0375('0xd1')](_0x58382a[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x58382a[_0x0375('0x47')],function(_0x15c6bc){var _0x225e34={};_0x225e34[_0x15c6bc]={'$like':'%'+_0x240de0[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x225e34;})});}_0x58382a=_[_0x0375('0xd1')]({},_0x58382a,_0x240de0['options']);return db[_0x0375('0xe6')][_0x0375('0x22')]({'where':_0x58382a['where']})[_0x0375('0x26')](function(_0x1e20d3){_0x2e6e2e[_0x0375('0x22')]=_0x1e20d3;if(_0x240de0['query'][_0x0375('0x42')]){_0x58382a[_0x0375('0x43')]=[{'all':!![]}];}return db[_0x0375('0xe6')]['findAll'](_0x58382a);})['then'](function(_0x3d1d2f){_0x2e6e2e['rows']=_0x3d1d2f;return _0x2e6e2e;});}})[_0x0375('0x26')](respondWithFilteredResult(_0x1db51f,_0x58382a))[_0x0375('0x1b')](handleError(_0x1db51f,null));};exports[_0x0375('0xe7')]=function(_0x2dd80a,_0x13aa74){var _0x1edc0b={};var _0x4fedad={};var _0x49a90d;var _0x57d38f;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x2dd80a[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x13aa74,null))[_0x0375('0x26')](function(_0x5f517f){if(_0x5f517f){_0x49a90d=_0x5f517f;_0x4fedad[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0xe8')][_0x0375('0x3a')]);_0x4fedad[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x2dd80a['query']);_0x4fedad[_0x0375('0x56')]=_['intersection'](_0x4fedad[_0x0375('0x54')],_0x4fedad[_0x0375('0x41')]);_0x1edc0b[_0x0375('0x47')]=_[_0x0375('0x57')](_0x4fedad[_0x0375('0x54')],qs[_0x0375('0x58')](_0x2dd80a[_0x0375('0x41')][_0x0375('0x58')]));_0x1edc0b[_0x0375('0x47')]=_0x1edc0b[_0x0375('0x47')][_0x0375('0x4c')]?_0x1edc0b['attributes']:_0x4fedad['model'];_0x1edc0b['order']=qs['sort'](_0x2dd80a[_0x0375('0x41')][_0x0375('0xcf')]);_0x1edc0b[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x2dd80a[_0x0375('0x41')],_0x4fedad[_0x0375('0x56')]));if(_0x2dd80a[_0x0375('0x41')]['filter']){_0x1edc0b[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x1edc0b[_0x0375('0x40')],{'$or':_['map'](_0x1edc0b['attributes'],function(_0x5b21be){var _0x364629={};_0x364629[_0x5b21be]={'$like':'%'+_0x2dd80a['query']['filter']+'%'};return _0x364629;})});}_0x1edc0b=_['merge']({},_0x1edc0b,_0x2dd80a[_0x0375('0x59')]);return _0x49a90d[_0x0375('0xe7')](_0x1edc0b);}})['then'](function(_0x5c12ba){if(_0x5c12ba){_0x57d38f=_0x5c12ba[_0x0375('0x4c')];if(!_0x2dd80a[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0x1edc0b[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x2dd80a[_0x0375('0x41')]['limit']);_0x1edc0b[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x2dd80a[_0x0375('0x41')]['offset']);}return _0x49a90d[_0x0375('0xe7')](_0x1edc0b);}})[_0x0375('0x26')](function(_0x58a4b8){if(_0x58a4b8){return _0x58a4b8?{'count':_0x57d38f,'rows':_0x58a4b8}:null;}})[_0x0375('0x26')](respondWithResult(_0x13aa74,null))[_0x0375('0x1b')](handleError(_0x13aa74,null));};exports[_0x0375('0xe9')]=function(_0x13f410,_0x15c7ae){var _0x12e59f={};var _0x594624={};var _0x4c0f6c;var _0x55fbbd;return db['User']['findOne']({'where':{'id':_0x13f410[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x15c7ae,null))[_0x0375('0x26')](function(_0x2197d5){if(_0x2197d5){_0x4c0f6c=_0x2197d5;_0x594624['model']=_[_0x0375('0xcd')](db[_0x0375('0xea')][_0x0375('0x3a')]);_0x594624['query']=_[_0x0375('0xcd')](_0x13f410[_0x0375('0x41')]);_0x594624['filters']=_[_0x0375('0x57')](_0x594624[_0x0375('0x54')],_0x594624['query']);_0x12e59f[_0x0375('0x47')]=_['intersection'](_0x594624[_0x0375('0x54')],qs[_0x0375('0x58')](_0x13f410[_0x0375('0x41')]['fields']));_0x12e59f[_0x0375('0x47')]=_0x12e59f[_0x0375('0x47')]['length']?_0x12e59f[_0x0375('0x47')]:_0x594624['model'];_0x12e59f[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x13f410[_0x0375('0x41')][_0x0375('0xcf')]);_0x12e59f[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x13f410[_0x0375('0x41')],_0x594624[_0x0375('0x56')]));if(_0x13f410[_0x0375('0x41')][_0x0375('0x2d')]){_0x12e59f[_0x0375('0x40')]=_['merge'](_0x12e59f['where'],{'$or':_[_0x0375('0x2f')](_0x12e59f[_0x0375('0x47')],function(_0x2a56ab){var _0x52c07c={};_0x52c07c[_0x2a56ab]={'$like':'%'+_0x13f410[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x52c07c;})});}_0x12e59f=_[_0x0375('0xd1')]({},_0x12e59f,_0x13f410[_0x0375('0x59')]);return _0x4c0f6c[_0x0375('0xe9')](_0x12e59f);}})[_0x0375('0x26')](function(_0x31bac8){if(_0x31bac8){_0x55fbbd=_0x31bac8['length'];if(!_0x13f410[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0x12e59f[_0x0375('0x21')]=qs['limit'](_0x13f410[_0x0375('0x41')]['limit']);_0x12e59f[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x13f410[_0x0375('0x41')]['offset']);}return _0x4c0f6c['getFaxInteractions'](_0x12e59f);}})[_0x0375('0x26')](function(_0x1b55d0){if(_0x1b55d0){return _0x1b55d0?{'count':_0x55fbbd,'rows':_0x1b55d0}:null;}})[_0x0375('0x26')](respondWithResult(_0x15c7ae,null))['catch'](handleError(_0x15c7ae,null));};exports[_0x0375('0xeb')]=function(_0x345d59,_0x55efbc){var _0x359ae8={};var _0x3ea733={};var _0x122ff8;var _0x5e6b4d;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x345d59[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x55efbc,null))[_0x0375('0x26')](function(_0x3637c8){if(_0x3637c8){_0x122ff8=_0x3637c8;_0x3ea733[_0x0375('0x54')]=_['keys'](db[_0x0375('0xec')][_0x0375('0x3a')]);_0x3ea733['query']=_['keys'](_0x345d59['query']);_0x3ea733['filters']=_[_0x0375('0x57')](_0x3ea733[_0x0375('0x54')],_0x3ea733['query']);_0x359ae8[_0x0375('0x47')]=_[_0x0375('0x57')](_0x3ea733[_0x0375('0x54')],qs[_0x0375('0x58')](_0x345d59[_0x0375('0x41')][_0x0375('0x58')]));_0x359ae8[_0x0375('0x47')]=_0x359ae8[_0x0375('0x47')][_0x0375('0x4c')]?_0x359ae8[_0x0375('0x47')]:_0x3ea733[_0x0375('0x54')];_0x359ae8[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x345d59[_0x0375('0x41')][_0x0375('0xcf')]);_0x359ae8[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x345d59[_0x0375('0x41')],_0x3ea733[_0x0375('0x56')]));if(_0x345d59[_0x0375('0x41')][_0x0375('0x2d')]){_0x359ae8[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x359ae8[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x359ae8['attributes'],function(_0xb550d5){var _0x49e9b9={};_0x49e9b9[_0xb550d5]={'$like':'%'+_0x345d59[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x49e9b9;})});}_0x359ae8=_[_0x0375('0xd1')]({},_0x359ae8,_0x345d59[_0x0375('0x59')]);return _0x122ff8[_0x0375('0xeb')](_0x359ae8);}})[_0x0375('0x26')](function(_0x406cf5){if(_0x406cf5){_0x5e6b4d=_0x406cf5[_0x0375('0x4c')];if(!_0x345d59['query'][_0x0375('0xd2')]('nolimit')){_0x359ae8[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x345d59['query']['limit']);_0x359ae8[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x345d59['query'][_0x0375('0x1f')]);}return _0x122ff8['getWhatsappInteractions'](_0x359ae8);}})[_0x0375('0x26')](function(_0xa5720f){if(_0xa5720f){return _0xa5720f?{'count':_0x5e6b4d,'rows':_0xa5720f}:null;}})[_0x0375('0x26')](respondWithResult(_0x55efbc,null))[_0x0375('0x1b')](handleError(_0x55efbc,null));};exports[_0x0375('0xed')]=function(_0xa5a731,_0x1a9299,_0x981312){var _0x3ab3f7;var _0x53e4a7;var _0x365c85;var _0x18eefa=!_['isNil'](_0xa5a731['params']['id'])?_0xa5a731[_0x0375('0x5e')]['id']:!_['isNil'](_0xa5a731[_0x0375('0x7e')]['id'])?_0xa5a731[_0x0375('0x7e')]['id']:null;return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x18eefa,'role':{'$or':[_0x0375('0x29'),_0x0375('0x7e'),_0x0375('0x71')]}},'attributes':['id',_0x0375('0x36'),_0x0375('0xee'),'mobile',_0x0375('0x28'),_0x0375('0x61'),_0x0375('0xa0')]})[_0x0375('0x26')](function(_0x4878d7){if(_0x4878d7){if(_0x4878d7['role']===_0x0375('0x71')){_0x3ab3f7=_0x4878d7;if(_0xa5a731[_0x0375('0x5b')]['interface']){_0x365c85=util['format'](_0x0375('0xef'),_0x3ab3f7[_0xa5a731[_0x0375('0x5b')]['interface']]);}else if(_0xa5a731[_0x0375('0x5b')]['intrf']){_0x365c85=util[_0x0375('0xae')]('SIP/%s',_0xa5a731[_0x0375('0x5b')][_0x0375('0xf0')]);}else{_0x365c85=util[_0x0375('0xae')](_0x0375('0xaf'),_0x3ab3f7[_0x0375('0x36')]);}socket['to'](util[_0x0375('0xae')](_0x0375('0xf1'),_0x3ab3f7[_0x0375('0x36')]))[_0x0375('0xab')](_0x0375('0xf2'),{'user':{'id':_0x3ab3f7['id'],'name':_0x3ab3f7[_0x0375('0x36')]},'ip':_0xa5a731[_0x0375('0xf3')][_0x0375('0xf4')]||_0xa5a731[_0x0375('0xf5')][_0x0375('0xf6')]||_0xa5a731[_0x0375('0xf7')][_0x0375('0xf6')]||_0xa5a731[_0x0375('0xf5')][_0x0375('0xf7')][_0x0375('0xf6')]});return db[_0x0375('0xb0')][_0x0375('0x25')]({'where':{'membername':_0x3ab3f7[_0x0375('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0xf8'));}})['then'](function(){if(_0x3ab3f7){return _0x3ab3f7[_0x0375('0xf9')]({'raw':!![]});}})['then'](function(_0x3c0f0c){if(_0x3ab3f7){var _0x30c50e=[];if(_0x3c0f0c){_0x53e4a7=_0x3c0f0c;if(_0x53e4a7['length']){for(var _0x27aaf9=0x0;_0x27aaf9<_0x53e4a7[_0x0375('0x4c')];_0x27aaf9++){_0x30c50e[_0x0375('0x48')]({'membername':_0x3ab3f7[_0x0375('0x36')],'UserId':_0x3ab3f7['id'],'queue_name':_0x53e4a7[_0x27aaf9]['name'],'VoiceQueueId':_0x53e4a7[_0x27aaf9]['id'],'interface':_0x365c85,'paused':_0x3ab3f7[_0x0375('0xa0')]||![],'penalty':_0x53e4a7[_0x27aaf9][_0x0375('0xfa')]||0x0});}return BPromise['each'](_0x30c50e,function(_0x2adfd5){return db['UserVoiceQueueRt']['upsert'](_0x2adfd5);});}}}})[_0x0375('0x26')](function(){if(_0x3ab3f7){return db[_0x0375('0xfb')][_0x0375('0x49')]({'where':{'membername':_0x3ab3f7[_0x0375('0x36')],'exitAt':null}});}})[_0x0375('0x26')](function(_0x585eaa){if(_0x3ab3f7){var _0x5f004c=[];_0x585eaa['forEach'](function(_0x13e90){_0x5f004c[_0x0375('0x48')](_0x13e90[_0x0375('0x24')]({'exitAt':moment()[_0x0375('0xae')](_0x0375('0xfc'))}));});return BPromise[_0x0375('0x52')](_0x5f004c);}})[_0x0375('0x26')](function(){if(_0x3ab3f7){var _0x344459=[];var _0x18bd2d=[];var _0x39e668=utils[_0x0375('0xfd')]();var _0x267549={'membername':_0x3ab3f7[_0x0375('0x36')],'interface':_0x365c85,'enterAt':moment()[_0x0375('0xae')](_0x0375('0xfc')),'role':_0x3ab3f7['role'],'internal':_0x3ab3f7[_0x0375('0x61')]};_0x39e668[_0x0375('0xfe')](function(_0x2ac9ee){_0x344459['push'](_[_0x0375('0xd1')]({'channel':_0x2ac9ee,'type':_0x0375('0xff'),'data1':_0xa5a731[_0x0375('0x5b')]['device'],'data2':_0x365c85},_0x267549));if(_0x3ab3f7[_0x0375('0xa0')]){_0x18bd2d[_0x0375('0x48')](_[_0x0375('0xd1')]({'channel':_0x2ac9ee,'type':_0x0375('0x100'),'data1':_0x0375('0x101')},_0x267549));}});return db['MemberReport'][_0x0375('0x87')](_0x344459['concat'](_0x18bd2d),{'individualHooks':!![]});}})[_0x0375('0x26')](function(){if(_0x3ab3f7){return _0x3ab3f7[_0x0375('0x24')]({'online':!![],'lastLoginAt':moment()['format'](_0x0375('0xfc')),'voicePause':_0x3ab3f7[_0x0375('0xa0')]||![],'mailPause':_0x3ab3f7[_0x0375('0xa0')]||![],'chatPause':_0x3ab3f7[_0x0375('0xa0')]||![],'faxPause':_0x3ab3f7[_0x0375('0xa0')]||![],'smsPause':_0x3ab3f7[_0x0375('0xa0')]||![],'openchannelPause':_0x3ab3f7[_0x0375('0xa0')]||![],'whatsappPause':_0x3ab3f7[_0x0375('0xa0')]||![],'pauseType':_0x3ab3f7[_0x0375('0xa0')]?_0x0375('0x101'):null,'interface':_0x365c85,'lastPauseAt':moment()[_0x0375('0xae')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x0375('0x26')](function(_0x5ae1a4){if(_0xa5a731[_0x0375('0x102')]){return _0x981312();}else{return BPromise[_0x0375('0x103')](_0x5ae1a4)['then'](respondWithResult(_0x1a9299,null));}})[_0x0375('0x1b')](handleError(_0x1a9299,null));};exports[_0x0375('0x104')]=function(_0x4a8e00,_0x150e9e){var _0x453afc;return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x4a8e00[_0x0375('0x5e')]['id'],'role':_0x0375('0x71')},'attributes':['id',_0x0375('0x36'),_0x0375('0x28')]})[_0x0375('0x26')](handleEntityNotFound(_0x150e9e,null))['then'](function(_0x221d72){if(_0x221d72){_0x453afc=_0x221d72;return db['UserVoiceQueueRt'][_0x0375('0x25')]({'where':{'membername':_0x453afc['name']},'individualHooks':!![]});}})[_0x0375('0x26')](function(){return db['MemberReport'][_0x0375('0x49')]({'where':{'membername':_0x453afc[_0x0375('0x36')],'exitAt':null}});})[_0x0375('0x26')](function(_0x49b082){var _0x15d6fe=[];_0x49b082[_0x0375('0xfe')](function(_0x110f1c){_0x15d6fe['push'](_0x110f1c[_0x0375('0x24')]({'exitAt':moment()[_0x0375('0xae')](_0x0375('0xfc'))}));});return BPromise[_0x0375('0x52')](_0x15d6fe);})[_0x0375('0x26')](function(){return _0x453afc[_0x0375('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0375('0x26')](respondWithResult(_0x150e9e,null))[_0x0375('0x1b')](handleError(_0x150e9e,null));};exports[_0x0375('0x105')]=function(_0x4f8a76,_0xb62755){var _0x1c5816;return db[_0x0375('0xb0')][_0x0375('0x24')]({'paused':0x1},{'where':{'UserId':_0x4f8a76[_0x0375('0x5e')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x4f8a76[_0x0375('0x5e')]['id'],'role':_0x0375('0x71')},'attributes':['id',_0x0375('0x36'),'role',_0x0375('0x61'),_0x0375('0xa2')]});})[_0x0375('0x26')](handleEntityNotFound(_0xb62755,null))['then'](function(_0x24dd39){if(_0x24dd39){_0x1c5816=_0x24dd39;return respondWithRpcPromise(_0x0375('0x106'),_0x0375('0x105'),{'id':_0x1c5816['id'],'name':_0x1c5816[_0x0375('0x36')],'pause':!![]});}})[_0x0375('0x26')](function(){if(_0x1c5816){return db[_0x0375('0xfb')][_0x0375('0x49')]({'where':{'membername':_0x1c5816[_0x0375('0x36')],'type':'PAUSE','exitAt':null}});}})[_0x0375('0x26')](function(_0x30bb75){if(_0x30bb75[_0x0375('0x4c')]){var _0x220ea6=moment()['format'](_0x0375('0xfc'));for(var _0x290479=0x0,_0x5d33c4=_0x30bb75[_0x0375('0x4c')];_0x290479<_0x5d33c4;_0x290479++){_0x30bb75[_0x290479][_0x0375('0x107')]({'exitAt':_0x220ea6});}}})[_0x0375('0x26')](function(){var _0x460333=[];var _0x15b1b5=utils[_0x0375('0xfd')]();_0x15b1b5[_0x0375('0xfe')](function(_0x3dc632){_0x460333[_0x0375('0x48')]({'channel':_0x3dc632,'membername':_0x1c5816[_0x0375('0x36')],'interface':_[_0x0375('0x67')](_0x1c5816[_0x0375('0xa2')])?util[_0x0375('0xae')]('SIP/%s',_0x1c5816[_0x0375('0x36')]):_0x1c5816[_0x0375('0xa2')],'type':_0x0375('0x100'),'enterAt':moment()['format'](_0x0375('0xfc')),'data1':_0x4f8a76[_0x0375('0x5b')][_0x0375('0x3c')]||_0x0375('0x108'),'role':_0x1c5816[_0x0375('0x28')],'internal':_0x1c5816[_0x0375('0x61')]});});return db[_0x0375('0xfb')][_0x0375('0x87')](_0x460333,{'individualHooks':!![]});})[_0x0375('0x26')](function(){return _0x1c5816[_0x0375('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4f8a76[_0x0375('0x5b')]['type']||_0x0375('0x108'),'lastPauseAt':moment()[_0x0375('0xae')](_0x0375('0xfc'))});})['then'](respondWithResult(_0xb62755,null))[_0x0375('0x1b')](handleError(_0xb62755,null));};exports[_0x0375('0x109')]=function(_0x12efac,_0x52c91b){var _0x1beebc;return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x12efac[_0x0375('0x5e')]['id']},'attributes':['id',_0x0375('0x36'),_0x0375('0x28'),'voicePause','mailPause',_0x0375('0x10a'),_0x0375('0x10b'),_0x0375('0x10c'),_0x0375('0x10d'),_0x0375('0x10e'),_0x0375('0x10f'),_0x0375('0x110')]})[_0x0375('0x26')](handleEntityNotFound(_0x52c91b,null))[_0x0375('0x26')](function(_0x4b50bd){if(_0x4b50bd){_0x1beebc=_0x4b50bd;if(_0x12efac[_0x0375('0x5b')]['channel']&&!utils['isValidChannel'](_0x12efac[_0x0375('0x5b')][_0x0375('0x9f')])){throw new db['Sequelize'][(_0x0375('0x93'))]('Unknown\x20channel');}switch(_0x12efac[_0x0375('0x5b')][_0x0375('0x9f')]){case _0x0375('0xac'):return respondWithRpcPromise(_0x0375('0x106'),'unpause',{'id':_0x1beebc['id'],'name':_0x1beebc['name'],'pause':![]})[_0x0375('0x26')](function(){return db[_0x0375('0xb0')][_0x0375('0x24')]({'paused':0x0},{'where':{'UserId':_0x1beebc['id']},'individualHooks':!![]});})[_0x0375('0x26')](function(){return db[_0x0375('0xfb')][_0x0375('0x32')]({'where':{'channel':_0x12efac['body'][_0x0375('0x9f')],'membername':_0x1beebc['name'],'type':_0x0375('0x100'),'exitAt':null}});})[_0x0375('0x26')](function(_0x338824){if(_0x338824){return _0x338824[_0x0375('0x24')]({'exitAt':moment()[_0x0375('0xae')](_0x0375('0xfc')),'data2':_0x0375('0x111')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x1beebc[_0x0375('0x24')]({'voicePause':![]});});case _0x0375('0x4f'):case'chat':case _0x0375('0xbf'):case _0x0375('0x5a'):case'whatsapp':case _0x0375('0x50'):return db[_0x0375('0xfb')][_0x0375('0x32')]({'where':{'channel':_0x12efac[_0x0375('0x5b')][_0x0375('0x9f')],'membername':_0x1beebc[_0x0375('0x36')],'type':_0x0375('0x100'),'exitAt':null}})[_0x0375('0x26')](function(_0x19007f){if(_0x19007f){return _0x19007f[_0x0375('0x24')]({'exitAt':moment()['format'](_0x0375('0xfc')),'data2':_0x0375('0x111')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x34408c={};_[_0x0375('0x23')](_0x34408c,util[_0x0375('0xae')]('%s%s',_0x12efac[_0x0375('0x5b')][_0x0375('0x9f')],_0x0375('0x112')),![]);return _0x1beebc['update'](_0x34408c);});default:return respondWithRpcPromise('QueuePause',_0x0375('0x109'),{'id':_0x1beebc['id'],'name':_0x1beebc[_0x0375('0x36')],'pause':![]})[_0x0375('0x26')](function(){return db[_0x0375('0xb0')][_0x0375('0x24')]({'paused':0x0},{'where':{'UserId':_0x1beebc['id']}});})['then'](function(){return db[_0x0375('0xfb')][_0x0375('0x49')]({'where':{'membername':_0x1beebc[_0x0375('0x36')],'type':_0x0375('0x100'),'exitAt':null}});})[_0x0375('0x26')](function(_0x183443){var _0x4c8d97=[];_0x183443[_0x0375('0xfe')](function(_0x5ed642){_0x4c8d97['push'](_0x5ed642['update']({'exitAt':moment()['format'](_0x0375('0xfc')),'data2':_0x0375('0x111')}));});return BPromise[_0x0375('0x52')](_0x4c8d97);})[_0x0375('0x26')](function(){return _0x1beebc['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0375('0x26')](respondWithResult(_0x52c91b,null))[_0x0375('0x1b')](handleError(_0x52c91b,null));};exports[_0x0375('0x113')]=function(_0xd88290,_0x4e1473){var _0x82bb53={};var _0x305f48={};var _0x2b15aa;var _0x4b6099;return db['User'][_0x0375('0x99')]({'where':{'id':_0xd88290[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x4e1473,null))['then'](function(_0x3898e2){if(_0x3898e2){_0x2b15aa=_0x3898e2;_0x305f48[_0x0375('0x54')]=_[_0x0375('0xcd')](db['Team'][_0x0375('0x3a')]);_0x305f48[_0x0375('0x41')]=_[_0x0375('0xcd')](_0xd88290[_0x0375('0x41')]);_0x305f48[_0x0375('0x56')]=_[_0x0375('0x57')](_0x305f48['model'],_0x305f48[_0x0375('0x41')]);_0x82bb53[_0x0375('0x47')]=_[_0x0375('0x57')](_0x305f48[_0x0375('0x54')],qs[_0x0375('0x58')](_0xd88290[_0x0375('0x41')]['fields']));_0x82bb53['attributes']=_0x82bb53[_0x0375('0x47')]['length']?_0x82bb53[_0x0375('0x47')]:_0x305f48[_0x0375('0x54')];_0x82bb53[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0xd88290[_0x0375('0x41')][_0x0375('0xcf')]);_0x82bb53[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0xd88290[_0x0375('0x41')],_0x305f48['filters']));if(_0xd88290[_0x0375('0x41')]['filter']){_0x82bb53[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x82bb53[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x82bb53[_0x0375('0x47')],function(_0x3bd35b){var _0x84ff3f={};_0x84ff3f[_0x3bd35b]={'$like':'%'+_0xd88290[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x84ff3f;})});}_0x82bb53=_[_0x0375('0xd1')]({},_0x82bb53,_0xd88290[_0x0375('0x59')]);return _0x2b15aa[_0x0375('0x113')](_0x82bb53);}})['then'](function(_0xf0649e){if(_0xf0649e){_0x4b6099=_0xf0649e[_0x0375('0x4c')];if(!_0xd88290[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x82bb53['limit']=qs[_0x0375('0x21')](_0xd88290[_0x0375('0x41')][_0x0375('0x21')]);_0x82bb53['offset']=qs[_0x0375('0x1f')](_0xd88290[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x2b15aa['getTeams'](_0x82bb53);}})[_0x0375('0x26')](function(_0x28e978){if(_0x28e978){return _0x28e978?{'count':_0x4b6099,'rows':_0x28e978}:null;}})['then'](respondWithResult(_0x4e1473,null))[_0x0375('0x1b')](handleError(_0x4e1473,null));};exports[_0x0375('0x114')]=function(_0x20eb94,_0x5f09d0){return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x20eb94[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x5f09d0,null))[_0x0375('0x26')](function(_0x4efa19){if(_0x4efa19){var _0x2f4190=_0x4efa19[_0x0375('0x27')]({'plain':!![]});return _0x4efa19[_0x0375('0x114')](_0x20eb94[_0x0375('0x5b')]['ids'],_[_0x0375('0x60')](_0x20eb94[_0x0375('0x5b')],[_0x0375('0x5f'),'id'])||{})[_0x0375('0x26')](function(){for(var _0x3b768d=0x0;_0x3b768d<_0x20eb94[_0x0375('0x5b')][_0x0375('0x5f')]['length'];_0x3b768d++){var _0x5ab980=[];var _0x4333f7={};db[_0x0375('0x115')][_0x0375('0x99')]({'where':{'id':_0x20eb94[_0x0375('0x5b')][_0x0375('0x5f')][_0x3b768d]}})[_0x0375('0x26')](function(_0x44c861){_0x4333f7=_0x44c861[_0x0375('0x4e')];_0x5ab980['push'](_0x44c861[_0x0375('0xf9')]()['then'](function(_0x1b36dd){for(var _0x24cc94=0x0;_0x24cc94<_0x1b36dd[_0x0375('0x4c')];_0x24cc94++){_0x1b36dd[_0x24cc94][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x117'));}return _0x1b36dd;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x118')]()['then'](function(_0x2315b9){for(var _0x4a4d45=0x0;_0x4a4d45<_0x2315b9['length'];_0x4a4d45++){_0x2315b9[_0x4a4d45][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x119'));}return _0x2315b9;}));_0x5ab980['push'](_0x44c861[_0x0375('0x11a')]()[_0x0375('0x26')](function(_0x4afac8){for(var _0x43e7c2=0x0;_0x43e7c2<_0x4afac8['length'];_0x43e7c2++){_0x4afac8[_0x43e7c2][_0x0375('0x116')](_0x0375('0x9f'),'Mail');}return _0x4afac8;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x11b')]()[_0x0375('0x26')](function(_0xed100){for(var _0x40600f=0x0;_0x40600f<_0xed100[_0x0375('0x4c')];_0x40600f++){_0xed100[_0x40600f][_0x0375('0x116')](_0x0375('0x9f'),'Sms');}return _0xed100;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x11c')]()[_0x0375('0x26')](function(_0x52bbcb){for(var _0x514445=0x0;_0x514445<_0x52bbcb[_0x0375('0x4c')];_0x514445++){_0x52bbcb[_0x514445][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x11d'));}return _0x52bbcb;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x11e')]()['then'](function(_0x2f66a5){for(var _0x4c6c6b=0x0;_0x4c6c6b<_0x2f66a5[_0x0375('0x4c')];_0x4c6c6b++){_0x2f66a5[_0x4c6c6b][_0x0375('0x116')]('channel',_0x0375('0x11f'));}return _0x2f66a5;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x120')]()[_0x0375('0x26')](function(_0x4b48a0){for(var _0xee2a93=0x0;_0xee2a93<_0x4b48a0['length'];_0xee2a93++){_0x4b48a0[_0xee2a93][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x121'));}return _0x4b48a0;}));return BPromise['all'](_0x5ab980);})[_0x0375('0x26')](function(_0x5c12dd){var _0x4127f7=_['flatten'](_0x5c12dd);_0x5ab980=[];return db[_0x0375('0x69')][_0x0375('0x122')](function(_0x1bd0a6){for(var _0x47d5f4=0x0;_0x47d5f4<_0x4127f7['length'];_0x47d5f4++){_0x5ab980[_0x0375('0x48')](_0x4127f7[_0x47d5f4]['addAgent'](_0x2f4190['id']),{'transaction':_0x1bd0a6});}return BPromise[_0x0375('0x52')](_0x5ab980)[_0x0375('0x26')](function(){if(_0x2f4190[_0x0375('0x123')]){return BPromise['each'](_[_0x0375('0x2d')](_0x4127f7,function(_0x27a406){return _0x27a406['getDataValue'](_0x0375('0x9f'))===_0x0375('0x117');}),function(_0x923519){return db[_0x0375('0xb0')][_0x0375('0xb1')]({'membername':_0x2f4190['name'],'UserId':_0x2f4190['id'],'queue_name':_0x923519['name'],'VoiceQueueId':_0x923519['id'],'interface':_['isNil'](_0x2f4190[_0x0375('0xa2')])?util[_0x0375('0xae')]('SIP/%s',_0x2f4190['name']):_0x2f4190['interface'],'paused':_0x2f4190[_0x0375('0xa1')]||![],'penalty':_0x2f4190[_0x0375('0xa8')]},{'transaction':_0x1bd0a6});});}else{return;}})[_0x0375('0x26')](function(){for(var _0x4ad9aa=0x0;_0x4ad9aa<_0x4127f7[_0x0375('0x4c')];_0x4ad9aa++){var _0x293b1d=_0x4127f7[_0x4ad9aa][_0x0375('0x124')](_0x0375('0x9f'));var _0x526c27=_0x293b1d+_0x0375('0xaa');socket[_0x0375('0xab')](_0x0375('0x7e')+_0x293b1d+'Queue:save',{'UserId':_0x2f4190['id'],['queueField']:_0x4127f7[_0x4ad9aa]['id']});}});});})['then'](function(){db[_0x0375('0x125')][_0x0375('0x99')]({'where':{'teamId':_0x4333f7['id']}})[_0x0375('0x26')](function(_0x371bc0){if(_0x371bc0){db['UserVoicePrefix']['create']({'UserId':_0x20eb94['params']['id'],'VoicePrefixId':_0x371bc0[_0x0375('0x126')]});}});});}});}})[_0x0375('0x26')](respondWithStatusCode(_0x5f09d0,null))[_0x0375('0x1b')](handleError(_0x5f09d0,null));};exports[_0x0375('0x127')]=function(_0x4b4ec4,_0x9e6e64){return db['User'][_0x0375('0x99')]({'where':{'id':_0x4b4ec4[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0x9e6e64,null))['then'](function(_0x1c35a5){if(_0x1c35a5){var _0x12c882=_0x1c35a5['get']({'plain':!![]});var _0xd14bb8=_0x4b4ec4[_0x0375('0x41')][_0x0375('0x5f')];return _0x1c35a5['removeTeams'](_0xd14bb8)[_0x0375('0x26')](function(){for(var _0x3ed865=0x0;_0x3ed865<_0xd14bb8[_0x0375('0x4c')];_0x3ed865++){var _0x53c0ed=[];var _0x10880d={};db[_0x0375('0x115')][_0x0375('0x99')]({'where':{'id':_0xd14bb8[_0x3ed865]}})[_0x0375('0x26')](function(_0x1a73ff){_0x10880d=_0x1a73ff['dataValues'];_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0xf9')]()[_0x0375('0x26')](function(_0x1777b1){for(var _0x1ac3c2=0x0;_0x1ac3c2<_0x1777b1['length'];_0x1ac3c2++){_0x1777b1[_0x1ac3c2][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x117'));}return _0x1777b1;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0x118')]()['then'](function(_0x26601d){for(var _0x35defa=0x0;_0x35defa<_0x26601d[_0x0375('0x4c')];_0x35defa++){_0x26601d[_0x35defa]['setDataValue'](_0x0375('0x9f'),_0x0375('0x119'));}return _0x26601d;}));_0x53c0ed['push'](_0x1a73ff['getMailQueues']()['then'](function(_0x42f90c){for(var _0x4383b0=0x0;_0x4383b0<_0x42f90c['length'];_0x4383b0++){_0x42f90c[_0x4383b0][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x128'));}return _0x42f90c;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0x11b')]()[_0x0375('0x26')](function(_0x11f03b){for(var _0x3d9309=0x0;_0x3d9309<_0x11f03b[_0x0375('0x4c')];_0x3d9309++){_0x11f03b[_0x3d9309][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x129'));}return _0x11f03b;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0x11c')]()['then'](function(_0x1e5640){for(var _0x257069=0x0;_0x257069<_0x1e5640['length'];_0x257069++){_0x1e5640[_0x257069][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x11d'));}return _0x1e5640;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0x11e')]()['then'](function(_0xb650ff){for(var _0x44d39f=0x0;_0x44d39f<_0xb650ff[_0x0375('0x4c')];_0x44d39f++){_0xb650ff[_0x44d39f][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x11f'));}return _0xb650ff;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff['getOpenchannelQueues']()[_0x0375('0x26')](function(_0x3ae15d){for(var _0x598c38=0x0;_0x598c38<_0x3ae15d[_0x0375('0x4c')];_0x598c38++){_0x3ae15d[_0x598c38][_0x0375('0x116')]('channel',_0x0375('0x121'));}return _0x3ae15d;}));return BPromise['all'](_0x53c0ed);})[_0x0375('0x26')](function(_0x40c21f){var _0x3a602a=_['flatten'](_0x40c21f);_0x53c0ed=[];return db[_0x0375('0x69')]['transaction'](function(_0x24c755){for(var _0x2d9777=0x0;_0x2d9777<_0x3a602a[_0x0375('0x4c')];_0x2d9777++){_0x53c0ed['push'](_0x3a602a[_0x2d9777][_0x0375('0x12a')](_0x12c882['id']),{'transaction':_0x24c755});}return BPromise['all'](_0x53c0ed)[_0x0375('0x26')](function(){if(_0x12c882[_0x0375('0x123')]){return BPromise[_0x0375('0x8b')](_[_0x0375('0x2d')](_0x3a602a,function(_0xda040a){return _0xda040a[_0x0375('0x124')]('channel')===_0x0375('0x117');}),function(_0xb8df41){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xb8df41['id'],'UserId':_0x12c882['id']},'transaction':_0x24c755});});}else{return;}})['then'](function(){db['TeamVoicePrefix'][_0x0375('0x99')]({'where':{'teamId':_0x10880d['id']}})[_0x0375('0x26')](function(_0x1fb594){if(_0x1fb594){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x12c882['id'],'VoicePrefixId':_0x1fb594[_0x0375('0x4e')][_0x0375('0x126')]}});}});})[_0x0375('0x26')](function(){for(var _0x13da38=0x0;_0x13da38<_0x3a602a['length'];_0x13da38++){var _0x32a22b=_0x3a602a[_0x13da38][_0x0375('0x124')](_0x0375('0x9f'));var _0x57dbba=_0x32a22b+_0x0375('0xaa');socket[_0x0375('0xab')](_0x0375('0x7e')+_0x32a22b+_0x0375('0xb5'),{'UserId':_0x12c882['id'],['queueField']:_0x3a602a[_0x13da38]['id']});}});});});}});}})[_0x0375('0x26')](respondWithStatusCode(_0x9e6e64,null))[_0x0375('0x1b')](handleError(_0x9e6e64,null));};exports[_0x0375('0x12b')]=function(_0x5cc0de,_0x3ed6df){var _0x2f4e20={};var _0x36caa6={};var _0x5403bd;var _0x2d68be;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x5cc0de[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x3ed6df,null))[_0x0375('0x26')](function(_0x499157){if(_0x499157){_0x5403bd=_0x499157;_0x36caa6[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0xd3')][_0x0375('0x3a')]);_0x36caa6[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x5cc0de[_0x0375('0x41')]);_0x36caa6['filters']=_[_0x0375('0x57')](_0x36caa6[_0x0375('0x54')],_0x36caa6[_0x0375('0x41')]);_0x2f4e20[_0x0375('0x47')]=_[_0x0375('0x57')](_0x36caa6['model'],qs[_0x0375('0x58')](_0x5cc0de['query']['fields']));_0x2f4e20[_0x0375('0x47')]=_0x2f4e20['attributes'][_0x0375('0x4c')]?_0x2f4e20[_0x0375('0x47')]:_0x36caa6[_0x0375('0x54')];_0x2f4e20[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x5cc0de[_0x0375('0x41')]['sort']);_0x2f4e20[_0x0375('0x40')]=qs['filters'](_['pick'](_0x5cc0de[_0x0375('0x41')],_0x36caa6[_0x0375('0x56')]));if(_0x5cc0de[_0x0375('0x41')][_0x0375('0x2d')]){_0x2f4e20[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x2f4e20[_0x0375('0x40')],{'$or':_['map'](_0x2f4e20[_0x0375('0x47')],function(_0xb1749b){var _0x290b80={};_0x290b80[_0xb1749b]={'$like':'%'+_0x5cc0de['query'][_0x0375('0x2d')]+'%'};return _0x290b80;})});}_0x2f4e20=_[_0x0375('0xd1')]({},_0x2f4e20,_0x5cc0de[_0x0375('0x59')]);return _0x5403bd[_0x0375('0x12b')](_0x2f4e20);}})[_0x0375('0x26')](function(_0x2f13b4){if(_0x2f13b4){_0x2d68be=_0x2f13b4[_0x0375('0x4c')];if(!_0x5cc0de[_0x0375('0x41')]['hasOwnProperty']('nolimit')){_0x2f4e20[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x5cc0de[_0x0375('0x41')][_0x0375('0x21')]);_0x2f4e20['offset']=qs[_0x0375('0x1f')](_0x5cc0de[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x5403bd[_0x0375('0x12b')](_0x2f4e20);}})[_0x0375('0x26')](function(_0x1b76df){if(_0x1b76df){return _0x1b76df?{'count':_0x2d68be,'rows':_0x1b76df}:null;}})[_0x0375('0x26')](respondWithResult(_0x3ed6df,null))[_0x0375('0x1b')](handleError(_0x3ed6df,null));};exports[_0x0375('0x12c')]=function(_0x109922,_0x15bd68){var _0x5e284c={};var _0xf64f61={};var _0x47fc6e;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x109922[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0x15bd68,null))[_0x0375('0x26')](function(_0x3eee34){if(_0x3eee34){_0x47fc6e=_0x3eee34;_0xf64f61[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0x39')]['rawAttributes']);_0xf64f61['query']=_['keys'](_0x109922[_0x0375('0x41')]);_0xf64f61['filters']=_[_0x0375('0x57')](_0xf64f61[_0x0375('0x54')],_0xf64f61[_0x0375('0x41')]);_0x5e284c[_0x0375('0x47')]=_[_0x0375('0x57')](_0xf64f61['model'],qs[_0x0375('0x58')](_0x109922[_0x0375('0x41')][_0x0375('0x58')]));_0x5e284c[_0x0375('0x47')]=_0x5e284c[_0x0375('0x47')][_0x0375('0x4c')]?_0x5e284c[_0x0375('0x47')]:_0xf64f61[_0x0375('0x54')];_0x5e284c[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x109922[_0x0375('0x41')][_0x0375('0xcf')]);_0x5e284c['where']=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x109922['query'],_0xf64f61[_0x0375('0x56')]));if(_0x109922[_0x0375('0x41')][_0x0375('0x2d')]){_0x5e284c[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x5e284c[_0x0375('0x40')],{'$or':_['map'](_0x5e284c[_0x0375('0x47')],function(_0x1e0fa4){var _0x921b0a={};_0x921b0a[_0x1e0fa4]={'$like':'%'+_0x109922[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x921b0a;})});}_0x5e284c['model']=db[_0x0375('0x39')];_0x5e284c['as']=_0x0375('0x2b');_0x5e284c=_[_0x0375('0xd1')]({},_0x5e284c,_0x109922['options']);return _0x47fc6e['getVoiceQueues']({'include':[_0x5e284c]});}})['then'](function(_0x7a8bfa){if(_0x7a8bfa){var _0x446f8={},_0x396675=[];for(var _0x29b060=0x0;_0x29b060<_0x7a8bfa[_0x0375('0x4c')];_0x29b060+=0x1){for(var _0x12211a=0x0,_0xa06dc2;_0x12211a<_0x7a8bfa[_0x29b060][_0x0375('0x2b')]['length'];_0x12211a+=0x1){_0xa06dc2=_0x7a8bfa[_0x29b060][_0x0375('0x2b')][_0x12211a][_0x0375('0x27')]({'plain':!![]});_0x446f8[_0xa06dc2['id']]=_0xa06dc2;}}_0x446f8=_['values'](_0x446f8);for(var _0x3da263=qs[_0x0375('0x1f')](_0x109922[_0x0375('0x41')][_0x0375('0x1f')]);_0x3da263<_0x446f8[_0x0375('0x4c')]&&_0x396675[_0x0375('0x4c')]=_0x366a67){_0x4c782b=_0x366a67;_0x4e9112=0xc8;}else{_0x4e9112=0xce;}_0x308597['status'](_0x4e9112);return _0x308597[_0x53f1('0x26')](_0x53f1('0x27'),_0x3fbce1+'-'+_0x4c782b+'/'+_0x366a67)[_0x53f1('0x21')](_0x50cb1d);}return null;};}function saveUpdates(_0x3b2c44){return function(_0x82a992){if(_0x82a992){return _0x82a992[_0x53f1('0x28')](_0x3b2c44)['then'](function(_0x1b6629){return _0x1b6629;});}return null;};}function removeEntity(_0xa99feb){return function(_0xb66959){if(_0xb66959){return _0xb66959[_0x53f1('0x29')]()[_0x53f1('0x14')](function(){var _0x12b666=_0xb66959[_0x53f1('0x2a')]({'plain':!![]});if(_0x12b666['role']==='admin')return;var _0x2c8bf8=[{'name':'Users','value':'user','ignore':!![]},{'name':'Agents','value':_0x53f1('0x2b'),'ignore':![]},{'name':_0x53f1('0x2c'),'value':_0x53f1('0x2d'),'ignore':![]}];var _0x5b4bbb=_(_0x2c8bf8)[_0x53f1('0x2e')](_0x53f1('0x2f'))[_0x53f1('0x30')]('value')[_0x53f1('0x31')]();if(_[_0x53f1('0x32')](_0x5b4bbb,_0x12b666['role'])){return;}var _0x48deaa=_[_0x53f1('0x33')](_0x2c8bf8,[_0x53f1('0x31'),_0x12b666[_0x53f1('0x34')]])[_0x53f1('0x35')];return db['UserProfileResource']['destroy']({'where':{'type':_0x48deaa,'resourceId':_0x12b666['id']}})[_0x53f1('0x14')](function(){return _0xb66959;});})[_0x53f1('0x14')](function(){_0xa99feb[_0x53f1('0x1f')](0xcc)[_0x53f1('0x20')]();});}};}function handleEntityNotFound(_0x441335){return function(_0x41119b){if(!_0x41119b){_0x441335[_0x53f1('0x1e')](0x194);}return _0x41119b;};}function handleError(_0x63bad6,_0x1a800f){_0x1a800f=_0x1a800f||0x1f4;return function(_0x226db9){logger[_0x53f1('0x19')](_0x226db9[_0x53f1('0x36')]);if(_0x226db9[_0x53f1('0x35')]){delete _0x226db9[_0x53f1('0x35')];}_0x63bad6[_0x53f1('0x1f')](_0x1a800f)[_0x53f1('0x37')](_0x226db9);};}exports[_0x53f1('0x38')]=function(_0x50bcaa,_0x5b76fd){var _0x5fa0f9={},_0x4fedc6={'count':0x0,'rows':[]};var _0x174567=_(db['User'][_0x53f1('0x39')])[_0x53f1('0x30')](function(_0x4a5a59){return{'name':_0x4a5a59[_0x53f1('0x3a')],'type':_0x4a5a59[_0x53f1('0x3b')][_0x53f1('0x3c')]};})[_0x53f1('0x2e')](function(_0x120cd6){return!_[_0x53f1('0x32')]([_0x53f1('0x3d'),_0x53f1('0x3e')],_0x120cd6['name']);})[_0x53f1('0x31')]();_0x5fa0f9=qs[_0x53f1('0x3f')](_0x174567,_0x50bcaa);var _0x2d5e1c={'where':_0x5fa0f9[_0x53f1('0x40')]};return db['User'][_0x53f1('0x25')](_0x2d5e1c)[_0x53f1('0x14')](function(_0x1030cc){_0x4fedc6[_0x53f1('0x25')]=_0x1030cc;if(_0x50bcaa[_0x53f1('0x41')][_0x53f1('0x42')]){_0x5fa0f9[_0x53f1('0x43')]=[{'all':!![]}];}if(_0x50bcaa[_0x53f1('0x41')][_0x53f1('0x44')]===_0x53f1('0x45')){_0x5fa0f9[_0x53f1('0x43')]=[{'model':db[_0x53f1('0x46')],'as':_0x53f1('0x44')}];}if(!_[_0x53f1('0x32')](_0x5fa0f9[_0x53f1('0x47')],'id')){_0x5fa0f9['attributes'][_0x53f1('0x48')]('id');}return db[_0x53f1('0x49')][_0x53f1('0x4a')](_0x5fa0f9);})[_0x53f1('0x14')](function(_0x1408c6){_0x4fedc6[_0x53f1('0x4b')]=_0x1408c6;if(_0x50bcaa[_0x53f1('0x41')]['openTabs']==='true'){var _0xce72c1=[];for(var _0x57de05=0x0;_0x57de05<_0x4fedc6[_0x53f1('0x4b')][_0x53f1('0x4c')];_0x57de05++){_0xce72c1['push'](get_open_tabs('chat',_0x4fedc6[_0x53f1('0x4b')][_0x57de05][_0x53f1('0x4d')]));_0xce72c1[_0x53f1('0x48')](get_open_tabs(_0x53f1('0x4e'),_0x4fedc6[_0x53f1('0x4b')][_0x57de05][_0x53f1('0x4d')]));_0xce72c1[_0x53f1('0x48')](get_open_tabs(_0x53f1('0x4f'),_0x4fedc6[_0x53f1('0x4b')][_0x57de05]['dataValues']));_0xce72c1[_0x53f1('0x48')](get_open_tabs('mail',_0x4fedc6[_0x53f1('0x4b')][_0x57de05]['dataValues']));_0xce72c1[_0x53f1('0x48')](get_open_tabs(_0x53f1('0x50'),_0x4fedc6[_0x53f1('0x4b')][_0x57de05][_0x53f1('0x4d')]));_0xce72c1[_0x53f1('0x48')](get_open_tabs('whatsapp',_0x4fedc6[_0x53f1('0x4b')][_0x57de05][_0x53f1('0x4d')]));}return BPromise[_0x53f1('0x51')](_0xce72c1)['then'](function(){return _0x4fedc6;});}else{return _0x4fedc6;}})[_0x53f1('0x14')](respondWithFilteredResult(_0x5b76fd,_0x5fa0f9))['catch'](handleError(_0x5b76fd,null));};exports[_0x53f1('0x52')]=function(_0x64609,_0x40238a){var _0x363fc8={'raw':![],'where':{'id':_0x64609[_0x53f1('0x53')]['id']}},_0x152052={};_0x152052[_0x53f1('0x54')]=_[_0x53f1('0x55')](_[_0x53f1('0x56')](db['User'][_0x53f1('0x39')]),['password',_0x53f1('0x3e')]);_0x152052['query']=_[_0x53f1('0x56')](_0x64609[_0x53f1('0x41')]);_0x152052[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x152052[_0x53f1('0x54')],_0x152052['query']);_0x363fc8['attributes']=_[_0x53f1('0x58')](_0x152052[_0x53f1('0x54')],qs['fields'](_0x64609[_0x53f1('0x41')]['fields']));_0x363fc8['attributes']=_0x363fc8['attributes'][_0x53f1('0x4c')]?_0x363fc8[_0x53f1('0x47')]:_0x152052[_0x53f1('0x54')];if(_0x64609[_0x53f1('0x41')]['includeAll']){_0x363fc8[_0x53f1('0x43')]=[{'all':!![]}];}if(_0x64609[_0x53f1('0x41')][_0x53f1('0x44')]==='true'){_0x363fc8['include']=[{'model':db[_0x53f1('0x46')],'as':_0x53f1('0x44')}];}_0x363fc8=_[_0x53f1('0x59')]({},_0x363fc8,_0x64609['options']);if(!_[_0x53f1('0x32')](_0x363fc8[_0x53f1('0x47')],'id')){_0x363fc8[_0x53f1('0x47')][_0x53f1('0x48')]('id');}return db[_0x53f1('0x49')][_0x53f1('0x33')](_0x363fc8)[_0x53f1('0x14')](handleEntityNotFound(_0x40238a,null))[_0x53f1('0x14')](function(_0x56f3a3){var _0x218654=[];values=_0x56f3a3;if(_0x64609[_0x53f1('0x41')][_0x53f1('0x5a')]===_0x53f1('0x45')){_0x218654['push'](get_open_tabs('chat',_0x56f3a3['dataValues']));_0x218654[_0x53f1('0x48')](get_open_tabs('sms',_0x56f3a3[_0x53f1('0x4d')]));_0x218654[_0x53f1('0x48')](get_open_tabs(_0x53f1('0x50'),_0x56f3a3[_0x53f1('0x4d')]));_0x218654['push'](get_open_tabs(_0x53f1('0x5b'),_0x56f3a3[_0x53f1('0x4d')]));_0x218654['push'](get_open_tabs('fax',_0x56f3a3[_0x53f1('0x4d')]));_0x218654[_0x53f1('0x48')](get_open_tabs(_0x53f1('0x5c'),_0x56f3a3[_0x53f1('0x4d')]));return BPromise[_0x53f1('0x51')](_0x218654);}else{return values;}})[_0x53f1('0x14')](function(){return values;})[_0x53f1('0x14')](respondWithResult(_0x40238a,null))[_0x53f1('0x1d')](handleError(_0x40238a,null));};exports['update']=function(_0x26ac37,_0x906f68){if(_0x26ac37[_0x53f1('0x5d')]['id']){delete _0x26ac37['body']['id'];}delete _0x26ac37[_0x53f1('0x5d')]['role'];return db[_0x53f1('0x49')][_0x53f1('0x33')]({'where':{'id':_0x26ac37[_0x53f1('0x53')]['id']}})['then'](handleEntityNotFound(_0x906f68,null))[_0x53f1('0x14')](saveUpdates(_0x26ac37[_0x53f1('0x5d')],null))[_0x53f1('0x14')](respondWithResult(_0x906f68,null))[_0x53f1('0x1d')](handleError(_0x906f68,null));};exports[_0x53f1('0x5e')]=function(_0x2f9153,_0x3f5cff){return db[_0x53f1('0x49')]['describe']()[_0x53f1('0x14')](respondWithResult(_0x3f5cff,null))[_0x53f1('0x1d')](handleError(_0x3f5cff,null));};exports[_0x53f1('0x5f')]=function(_0x3ba863,_0x304de8){return db[_0x53f1('0x49')][_0x53f1('0x33')]({'where':{'id':_0x3ba863[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x304de8,null))['then'](function(_0x1325ca){if(_0x1325ca){return _0x1325ca[_0x53f1('0x5f')](_0x3ba863[_0x53f1('0x5d')][_0x53f1('0x60')],_['omit'](_0x3ba863[_0x53f1('0x5d')],[_0x53f1('0x60'),'id'])||{});}})[_0x53f1('0x14')](respondWithResult(_0x304de8,null))[_0x53f1('0x1d')](handleError(_0x304de8,null));};function validateUser(_0xea4489){return new BPromise(function(_0x2e32d4,_0x33feb2){if(_0xea4489[_0x53f1('0x61')])return _0x2e32d4(_0xea4489);return db[_0x53f1('0x62')][_0x53f1('0x63')](0x1)[_0x53f1('0x14')](function(_0x143446){if(_0x143446[_0x53f1('0x64')])authService['validatePasswordPattern'](_0xea4489[_0x53f1('0x3d')]);db[_0x53f1('0x49')][_0x53f1('0x65')]('internal')['then'](function(_0xc85a7){if(_['isNil'](_0xc85a7)){_0xea4489[_0x53f1('0x61')]=_0x143446[_0x53f1('0x66')]||0x1;return;}if(_[_0x53f1('0x67')](_0x143446[_0x53f1('0x66')])||_0x143446[_0x53f1('0x66')]===_0xc85a7){_0xea4489['internal']=_0xc85a7+0x1;return;}if(_0x143446['min_internal']>_0xc85a7){_0xea4489[_0x53f1('0x61')]=_0x143446[_0x53f1('0x66')];return;}return db[_0x53f1('0x68')][_0x53f1('0x41')](_0x53f1('0x69'),{'type':db[_0x53f1('0x68')]['QueryTypes']['SELECT']})[_0x53f1('0x14')](function(_0x3b9b19){if(_0x3b9b19&&_0x3b9b19[_0x53f1('0x4c')]){for(var _0x1365fc=0x0,_0x18b28d=_0x3b9b19[_0x53f1('0x4c')];_0x1365fc<_0x18b28d&&_['isNil'](_0xea4489[_0x53f1('0x61')]);_0x1365fc++){if(_0x143446['min_internal']<=_0x3b9b19[_0x1365fc]['from']){_0xea4489['internal']=_0x3b9b19[_0x1365fc][_0x53f1('0x6a')];}else if(_0x143446[_0x53f1('0x66')]>_0x3b9b19[_0x1365fc][_0x53f1('0x6a')]&&_0x143446[_0x53f1('0x66')]<=_0x3b9b19[_0x1365fc]['to']){_0xea4489[_0x53f1('0x61')]=_0x143446[_0x53f1('0x66')];}}}if(_[_0x53f1('0x67')](_0xea4489[_0x53f1('0x61')])){_0xea4489[_0x53f1('0x61')]=_0xc85a7+0x1;}return _0x2e32d4(_0xea4489);});});})[_0x53f1('0x1d')](function(_0x181bac){_0x33feb2(_0x181bac);});});}function updateUser(_0x1023ad){return new BPromise(function(_0x283489,_0x22be00){try{if(_0x1023ad[_0x53f1('0x6b')]){_0x1023ad['mailbox']=_0x1023ad[_0x53f1('0x61')];_0x1023ad['VoiceMail']={'mailbox':_0x1023ad['internal'],'password':_0x1023ad[_0x53f1('0x3d')],'fullname':_0x1023ad[_0x53f1('0x6c')],'email':_0x1023ad[_0x53f1('0x6d')]};}if(_0x1023ad[_0x53f1('0x34')]===_0x53f1('0x2b')){if(!_0x1023ad[_0x53f1('0x6e')])_0x1023ad[_0x53f1('0x6e')]=[_0x53f1('0x6f'),_0x53f1('0x70'),_0x53f1('0x71'),'113',_0x53f1('0x72'),'104','105',_0x53f1('0x73'),_0x53f1('0x74'),_0x53f1('0x75'),'109',_0x53f1('0x76'),'111',_0x53f1('0x77'),_0x53f1('0x78')];}_0x283489(_0x1023ad);}catch(_0x4f2ee1){_0x22be00(_0x4f2ee1);}});}exports[_0x53f1('0x79')]=function(_0x5b798f,_0x6c7c56){if(_0x5b798f['user'][_0x53f1('0x34')]===_0x53f1('0x2b'))throw new Error(_0x53f1('0x7a'));if(_0x5b798f[_0x53f1('0x5d')][_0x53f1('0x34')]===_0x53f1('0x7b')&&_0x5b798f['user']['role']!==_0x53f1('0x7c')){throw new Error(_0x53f1('0x7d'));}if(_0x5b798f[_0x53f1('0x5d')]['role']===_0x53f1('0x7c')&&_0x5b798f[_0x53f1('0x7b')][_0x53f1('0x34')]!==_0x53f1('0x7c')){throw new Error(_0x53f1('0x7e'));}return licenseUtil[_0x53f1('0x7f')]([_0x5b798f['body']])[_0x53f1('0x14')](function(){return validateUser(_0x5b798f[_0x53f1('0x5d')]);})[_0x53f1('0x14')](function(_0x2195d8){return updateUser(_0x2195d8)[_0x53f1('0x14')](function(_0x4d381c){if(_0x4d381c[_0x53f1('0x34')]===_0x53f1('0x7c')){_0x4d381c[_0x53f1('0x80')]=_0x5b798f[_0x53f1('0x7b')]['settingsEnabled'];delete _0x4d381c['userProfileId'];}return _0x4d381c;});})[_0x53f1('0x14')](function(_0xfd6938){return db[_0x53f1('0x49')]['create'](_0xfd6938,{'include':[{'model':db[_0x53f1('0x81')],'as':_0x53f1('0x81')}]});})[_0x53f1('0x14')](function(_0x5f196b){if(_0x5b798f['body'][_0x53f1('0x34')]==='user')return _0x5f196b;if(_0x5b798f[_0x53f1('0x7b')][_0x53f1('0x34')]!==_0x53f1('0x7b'))return _0x5f196b;return db['UserProfileSection'][_0x53f1('0x33')]({'where':{'name':_0x5f196b[_0x53f1('0x34')]===_0x53f1('0x2b')?_0x53f1('0x82'):_0x53f1('0x2c'),'userProfileId':_0x5b798f[_0x53f1('0x7b')][_0x53f1('0x83')]},'raw':!![]})[_0x53f1('0x14')](function(_0x5623d0){if(!_0x5623d0||_0x5623d0[_0x53f1('0x84')]!=0x0)return _0x5f196b;return db[_0x53f1('0x85')][_0x53f1('0x79')]({'name':_0x5f196b[_0x53f1('0x35')],'resourceId':_0x5f196b['id'],'type':_0x5623d0[_0x53f1('0x35')],'sectionId':_0x5623d0['id']},{})[_0x53f1('0x14')](function(){return _0x5f196b;});})['catch'](function(_0x25646e){logger['error'](_0x53f1('0x86'),_0x25646e);throw _0x25646e;});})['then'](respondWithResult(_0x6c7c56,0xc9))[_0x53f1('0x1d')](handleError(_0x6c7c56,null));};exports[_0x53f1('0x87')]=function(_0x579bd6,_0x2b70b0){var _0x5c0cad=_0x579bd6[_0x53f1('0x5d')];var _0x2e5cea=[];if(_0x579bd6[_0x53f1('0x7b')]['role']==='agent')throw new Error('Unauthorized');if(_[_0x53f1('0x88')](_0x5c0cad,[_0x53f1('0x34'),_0x53f1('0x7b')])&&_0x579bd6[_0x53f1('0x7b')][_0x53f1('0x34')]!=='admin'){throw new Error(_0x53f1('0x7d'));}if(_['some'](_0x5c0cad,[_0x53f1('0x34'),_0x53f1('0x7c')])&&_0x579bd6[_0x53f1('0x7b')]['role']!=='admin'){throw new Error(_0x53f1('0x89'));}return licenseUtil['checkUserLimits'](_0x5c0cad)[_0x53f1('0x14')](function(){return validateUser(_0x5c0cad[0x0]);})[_0x53f1('0x14')](function(){for(var _0x469272=0x1;_0x469272<_0x5c0cad[_0x53f1('0x4c')];_0x469272++){var _0x585207=_0x5c0cad[_0x469272-0x1][_0x53f1('0x61')];if(!_0x5c0cad[_0x469272][_0x53f1('0x61')])_0x5c0cad[_0x469272][_0x53f1('0x61')]=_0x585207+0x1;_0x2e5cea[_0x53f1('0x48')](validateUser(_0x5c0cad[_0x469272]));}return BPromise[_0x53f1('0x51')](_0x2e5cea);})[_0x53f1('0x14')](function(){_0x2e5cea=[];for(var _0x39103c=0x0;_0x39103c<_0x5c0cad['length'];_0x39103c++){_0x2e5cea[_0x53f1('0x48')](updateUser(_0x5c0cad[_0x39103c]));}return BPromise[_0x53f1('0x51')](_0x2e5cea);})['then'](function(){return BPromise[_0x53f1('0x8a')](_0x5c0cad,function(_0x176066){return db[_0x53f1('0x49')]['create'](_0x176066,{'include':[{'model':db[_0x53f1('0x81')],'as':_0x53f1('0x81')}]})[_0x53f1('0x14')](function(_0x251bcd){_0x176066['id']=_0x251bcd['id'];return _0x176066;});});})[_0x53f1('0x14')](function(_0x5cba92){if(_0x579bd6['body'][_0x53f1('0x34')]===_0x53f1('0x7b'))return _0x5cba92;if(_0x579bd6['user']['role']!==_0x53f1('0x7b'))return _0x5cba92;var _0x15151e=_[_0x53f1('0x88')](_0x5cba92,function(_0x3741d4){return _0x3741d4[_0x53f1('0x34')]===_0x53f1('0x2b')||_0x3741d4[_0x53f1('0x34')]==='telephone';});if(!_0x15151e)return _0x5cba92;return db[_0x53f1('0x8b')]['findAll']({'where':{'name':{'$or':['Agents',_0x53f1('0x2c')]},'userProfileId':_0x579bd6[_0x53f1('0x7b')][_0x53f1('0x83')]},'raw':!![]})['then'](function(_0x2d4f64){if(_[_0x53f1('0x8c')](_0x2d4f64)||!_[_0x53f1('0x88')](_0x2d4f64,[_0x53f1('0x84'),0x0]))return _0x5cba92;_0x2e5cea=[];var _0x409b76=_(_0x2d4f64)[_0x53f1('0x30')](function(_0x198b96){if(_0x198b96[_0x53f1('0x84')]===0x1)return;return _0x198b96['name']===_0x53f1('0x82')?_0x53f1('0x2b'):_0x53f1('0x2d');})[_0x53f1('0x8d')]()[_0x53f1('0x31')]();for(var _0x1f4607=0x0;_0x1f4607<_0x5cba92[_0x53f1('0x4c')];_0x1f4607++){if(!_[_0x53f1('0x32')](_0x409b76,_0x5cba92[_0x1f4607][_0x53f1('0x34')]))return;var _0x592e5e=_0x5cba92[_0x1f4607][_0x53f1('0x34')]===_0x53f1('0x2b')?_0x53f1('0x82'):_0x53f1('0x2c');_0x2e5cea['push'](db[_0x53f1('0x85')][_0x53f1('0x79')]({'name':_0x5cba92[_0x1f4607][_0x53f1('0x35')],'resourceId':_0x5cba92[_0x1f4607]['id'],'type':_0x592e5e,'sectionId':_[_0x53f1('0x33')](_0x2d4f64,[_0x53f1('0x35'),_0x592e5e])['id']},{}));}return BPromise[_0x53f1('0x51')](_0x2e5cea);});})['then'](respondWithResult(_0x2b70b0,0xc9))[_0x53f1('0x1d')](handleError(_0x2b70b0,null));};exports[_0x53f1('0x8e')]=function(_0x37d95e,_0x421f41){if(_0x37d95e[_0x53f1('0x5d')]['id']){delete _0x37d95e['body']['id'];}return db[_0x53f1('0x49')]['find']({'where':{'id':_0x37d95e[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](function(_0xbb7a56){if(!_0xbb7a56)return null;if(_0xbb7a56['id']===_0x37d95e['user']['id']){if(!_0x37d95e[_0x53f1('0x5d')][_0x53f1('0x8f')]||!_0x37d95e[_0x53f1('0x5d')][_0x53f1('0x90')]){throw new db[(_0x53f1('0x91'))][(_0x53f1('0x92'))](_0x53f1('0x93'));}if(!_0xbb7a56['authenticate'](_0x37d95e['body'][_0x53f1('0x8f')])){throw new db['Sequelize']['ValidationError'](_0x53f1('0x94'));}if(_0x37d95e[_0x53f1('0x5d')][_0x53f1('0x8f')]===_0x37d95e[_0x53f1('0x5d')][_0x53f1('0x90')]){throw new db[(_0x53f1('0x91'))][(_0x53f1('0x92'))](_0x53f1('0x95'));}}else if(_0x37d95e[_0x53f1('0x7b')]['role']===_0x53f1('0x7c')){if(!_0x37d95e[_0x53f1('0x5d')][_0x53f1('0x90')]){throw new db['Sequelize'][(_0x53f1('0x92'))](_0x53f1('0x96'));}}else if(_0x37d95e['user'][_0x53f1('0x34')]===_0x53f1('0x7b')){if(!_0x37d95e[_0x53f1('0x5d')]['newPassword']){throw new db[(_0x53f1('0x91'))][(_0x53f1('0x92'))](_0x53f1('0x96'));}if(_0xbb7a56[_0x53f1('0x34')]!==_0x53f1('0x2b')){throw new db[(_0x53f1('0x91'))][(_0x53f1('0x92'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0x53f1('0x92'))]('Unauthorized');}return _0xbb7a56;})[_0x53f1('0x14')](handleEntityNotFound(_0x421f41,null))[_0x53f1('0x14')](function(_0x221367){return db[_0x53f1('0x62')]['findOne']({'attributes':['id','securePassword',_0x53f1('0x97'),_0x53f1('0x98')]})[_0x53f1('0x14')](function(_0x1b249f){if(_0x1b249f[_0x53f1('0x64')])authService[_0x53f1('0x99')](_0x37d95e[_0x53f1('0x5d')][_0x53f1('0x90')]);if(!_0x1b249f['enforcePasswordHistory']||!_0x221367[_0x53f1('0x9a')])return _0x221367;authService[_0x53f1('0x9b')](_0x37d95e[_0x53f1('0x5d')][_0x53f1('0x90')],_0x221367[_0x53f1('0x9a')],_0x1b249f[_0x53f1('0x98')]);return _0x221367;})[_0x53f1('0x14')](saveUpdates({'password':_0x37d95e[_0x53f1('0x5d')][_0x53f1('0x90')],'passwordResetAt':_0x37d95e[_0x53f1('0x7b')]['id']==_0x37d95e[_0x53f1('0x53')]['id']?moment():null,'previousPasswords':authService[_0x53f1('0x9c')](_0x37d95e[_0x53f1('0x5d')][_0x53f1('0x90')],_0x221367['previousPasswords'])},null));})[_0x53f1('0x14')](respondWithResult(_0x421f41,null))[_0x53f1('0x1d')](handleError(_0x421f41,null));};exports[_0x53f1('0x9d')]=function(_0x58d00a,_0x2fde15){var _0x38d793=_0x58d00a['body']['channel'];return db['User'][_0x53f1('0x33')]({'where':{'id':_0x58d00a[_0x53f1('0x53')]['id']},'attributes':['id',_0x53f1('0x35'),'role',_0x53f1('0x9e'),'loginInPause',_0x53f1('0x9f'),_0x53f1('0xa0')]})[_0x53f1('0x14')](handleEntityNotFound(_0x2fde15,null))[_0x53f1('0x14')](function(_0x10adf5){if(_0x10adf5){if(!utils[_0x53f1('0xa1')](_0x38d793)){throw new db[(_0x53f1('0x91'))][(_0x53f1('0x92'))](_0x53f1('0xa2'));}return _0x10adf5[_0x53f1('0xa3')+_[_0x53f1('0xa4')](_0x38d793[_0x53f1('0xa5')]())+_0x53f1('0xa6')](_0x58d00a[_0x53f1('0x5d')]['ids'],{'penalty':_0x58d00a[_0x53f1('0x5d')][_0x53f1('0xa7')]||0x0})['spread'](function(_0x44e787){for(var _0x5b50fc=0x0;_0x5b50fc<_0x58d00a[_0x53f1('0x5d')]['ids'][_0x53f1('0x4c')];_0x5b50fc+=0x1){var _0x4324b3={'UserId':Number(_0x58d00a[_0x53f1('0x53')]['id'])};_0x4324b3[_[_0x53f1('0xa4')](_0x38d793[_0x53f1('0xa5')]())+_0x53f1('0xa8')]=Number(_0x58d00a[_0x53f1('0x5d')][_0x53f1('0x60')][_0x5b50fc]);socket['emit'](_0x53f1('0x7b')+_[_0x53f1('0xa4')](_0x38d793[_0x53f1('0xa5')]())+'Queue:save',_0x4324b3);}return _0x44e787;})['then'](function(){if(_0x38d793===_0x53f1('0xa9')){return db[_0x53f1('0xaa')][_0x53f1('0x4a')]({'where':{'id':_0x58d00a['body'][_0x53f1('0x60')]||[]},'raw':!![],'attributes':['id',_0x53f1('0x35')]});}})['then'](function(_0x31f243){var _0x5ddff5=_0x10adf5[_0x53f1('0x2a')]({'plain':!![]});var _0x52a3db=[];if(_0x38d793===_0x53f1('0xa9')&&_0x5ddff5[_0x53f1('0x34')]==='agent'&&_0x5ddff5['online']){for(var _0x150870=0x0;_0x150870<_0x31f243[_0x53f1('0x4c')];_0x150870+=0x1){_0x52a3db['push']({'membername':_0x5ddff5[_0x53f1('0x35')],'UserId':_0x5ddff5['id'],'queue_name':_0x31f243[_0x150870][_0x53f1('0x35')],'VoiceQueueId':_0x31f243[_0x150870]['id'],'interface':_['isNil'](_0x5ddff5['interface'])?util[_0x53f1('0xab')](_0x53f1('0xac'),_0x5ddff5['name']):_0x5ddff5[_0x53f1('0xa0')],'paused':_0x5ddff5[_0x53f1('0x9f')]||![],'penalty':_0x58d00a['body']['penalty']||0x0});}return BPromise[_0x53f1('0x8a')](_0x52a3db,function(_0x9e627d){return db[_0x53f1('0xad')][_0x53f1('0xae')](_0x9e627d);});}return _0x10adf5;});}})[_0x53f1('0x14')](respondWithStatusCode(_0x2fde15,null))['catch'](handleError(_0x2fde15,null));};exports[_0x53f1('0xaf')]=function(_0xe41c59,_0x55d9ee){var _0x2351f5,_0x5551ad;return db[_0x53f1('0x49')]['find']({'where':{'id':_0xe41c59['params']['id']},'attributes':['id','name',_0x53f1('0x34')]})['then'](handleEntityNotFound(_0x55d9ee,null))[_0x53f1('0x14')](function(_0x2ee513){if(_0x2ee513){_0x2351f5=_0x2ee513;if(!_0xe41c59[_0x53f1('0x41')]['channel']||!utils['isValidChannel'](_0xe41c59['query'][_0x53f1('0xb0')])){throw new db[(_0x53f1('0x91'))][(_0x53f1('0x92'))](_0x53f1('0xa2'));}return _0x2ee513[_0x53f1('0xb1')+_[_0x53f1('0xa4')](_0xe41c59[_0x53f1('0x41')]['channel']['toLowerCase']())+'Queues'](_0xe41c59[_0x53f1('0x41')]['ids']);}})[_0x53f1('0x14')](function(_0x82ae31){if(_['isArray'](_0xe41c59[_0x53f1('0x41')][_0x53f1('0x60')])){for(var _0x4283ee=0x0;_0x4283ee<_0xe41c59[_0x53f1('0x41')]['ids'][_0x53f1('0x4c')];_0x4283ee+=0x1){_0x5551ad={'UserId':Number(_0xe41c59[_0x53f1('0x53')]['id'])};_0x5551ad[_[_0x53f1('0xa4')](_0xe41c59['query'][_0x53f1('0xb0')][_0x53f1('0xa5')]())+'QueueId']=Number(_0xe41c59[_0x53f1('0x41')][_0x53f1('0x60')][_0x4283ee]);socket[_0x53f1('0xb2')](_0x53f1('0x7b')+_[_0x53f1('0xa4')](_0xe41c59[_0x53f1('0x41')][_0x53f1('0xb0')][_0x53f1('0xa5')]())+_0x53f1('0xb3'),_0x5551ad);}}else{_0x5551ad={'UserId':Number(_0xe41c59[_0x53f1('0x53')]['id'])};_0x5551ad[_[_0x53f1('0xa4')](_0xe41c59[_0x53f1('0x41')][_0x53f1('0xb0')][_0x53f1('0xa5')]())+_0x53f1('0xa8')]=Number(_0xe41c59[_0x53f1('0x41')][_0x53f1('0x60')]);socket[_0x53f1('0xb2')](_0x53f1('0x7b')+_[_0x53f1('0xa4')](_0xe41c59[_0x53f1('0x41')]['channel'][_0x53f1('0xa5')]())+_0x53f1('0xb3'),_0x5551ad);}return _0x82ae31;})[_0x53f1('0x14')](function(){if(_0xe41c59[_0x53f1('0x41')][_0x53f1('0xb0')]===_0x53f1('0xa9')){return db[_0x53f1('0xad')]['destroy']({'where':{'UserId':_0xe41c59[_0x53f1('0x53')]['id'],'VoiceQueueId':_0xe41c59['query']['ids']},'individualHooks':!![]})['then'](function(){return _0x2351f5;});}return _0x2351f5;})[_0x53f1('0x14')](respondWithStatusCode(_0x55d9ee,null))[_0x53f1('0x1d')](handleError(_0x55d9ee,null));};exports[_0x53f1('0xb4')]=function(_0x4475bc,_0x4c6f5f){_0x4475bc[_0x53f1('0x5d')]['userpic']=_0x4475bc[_0x53f1('0xb5')]['filename'];return db['User'][_0x53f1('0x33')]({'where':{'id':_0x4475bc[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x4c6f5f,null))[_0x53f1('0x14')](saveUpdates(_0x4475bc[_0x53f1('0x5d')],null))['then'](respondWithResult(_0x4c6f5f,null))[_0x53f1('0x1d')](handleError(_0x4c6f5f,null));};exports[_0x53f1('0xb6')]=function(_0x32cafa,_0x5d1570){var _0x4e27b3=path[_0x53f1('0xb7')](config[_0x53f1('0xb8')],'server/files/images/logos/default_profile.png');return db[_0x53f1('0x49')][_0x53f1('0x33')]({'where':{'id':_0x32cafa[_0x53f1('0x53')]['id']},'attributes':['id',_0x53f1('0xb9')],'raw':!![]})[_0x53f1('0x14')](handleEntityNotFound(_0x5d1570,null))[_0x53f1('0x14')](function(_0x1519cb){if(_0x1519cb){if(_[_0x53f1('0x67')](_0x1519cb[_0x53f1('0xb9')])){return _0x5d1570[_0x53f1('0xba')](_0x4e27b3);}else{if(!fs[_0x53f1('0xbb')](path[_0x53f1('0xb7')](config[_0x53f1('0xb8')],_0x53f1('0xbc'),_0x1519cb['userpic']))){return _0x5d1570[_0x53f1('0xba')](_0x4e27b3);}return _0x5d1570[_0x53f1('0xba')](path[_0x53f1('0xb7')](config[_0x53f1('0xb8')],_0x53f1('0xbc'),_0x1519cb['userpic']));}}})[_0x53f1('0x1d')](handleError(_0x5d1570,null));};exports[_0x53f1('0xbd')]=function(_0x2c5e22,_0x3b042f){return db[_0x53f1('0x49')][_0x53f1('0x33')]({'where':{'id':_0x2c5e22[_0x53f1('0x53')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3b042f,null))[_0x53f1('0x14')](function(_0x716931){var _0x3c309b=[];values=_0x716931[_0x53f1('0x4d')];_0x3c309b[_0x53f1('0x48')](get_open_tabs(_0x53f1('0xbe'),_0x716931[_0x53f1('0x4d')]));_0x3c309b[_0x53f1('0x48')](get_open_tabs(_0x53f1('0x4e'),_0x716931[_0x53f1('0x4d')]));_0x3c309b[_0x53f1('0x48')](get_open_tabs(_0x53f1('0x50'),_0x716931['dataValues']));_0x3c309b[_0x53f1('0x48')](get_open_tabs('whatsapp',_0x716931[_0x53f1('0x4d')]));_0x3c309b[_0x53f1('0x48')](get_open_tabs(_0x53f1('0x4f'),_0x716931[_0x53f1('0x4d')]));_0x3c309b[_0x53f1('0x48')](get_open_tabs(_0x53f1('0x5c'),_0x716931[_0x53f1('0x4d')]));return BPromise[_0x53f1('0x51')](_0x3c309b);})[_0x53f1('0x14')](function(_0x52949c){if(_0x52949c){var _0x1fc4d7=_[_0x53f1('0x30')](values['ChatOpenTabs'],function(_0xe8e115){return{'channel':_0x53f1('0xbf'),'id':_0xe8e115['id'],'createdAt':_0xe8e115[_0x53f1('0xc0')]};});var _0x376e64=_[_0x53f1('0x30')](values[_0x53f1('0xc1')],function(_0x3c27fb){return{'channel':_0x53f1('0xc2'),'id':_0x3c27fb['id'],'createdAt':_0x3c27fb['createdAt']};});var _0x1b2675=_[_0x53f1('0x30')](values[_0x53f1('0xc3')],function(_0x2d9a06){return{'channel':_0x53f1('0xc4'),'id':_0x2d9a06['id'],'createdAt':_0x2d9a06['createdAt']};});var _0x35c7df=_[_0x53f1('0x30')](values['MailOpenTabs'],function(_0x13b8b7){return{'channel':'MAIL','id':_0x13b8b7['id'],'createdAt':_0x13b8b7['createdAt']};});var _0x242400=_['map'](values[_0x53f1('0xc5')],function(_0x3e0867){return{'channel':_0x53f1('0xc6'),'id':_0x3e0867['id'],'createdAt':_0x3e0867['createdAt']};});var _0x2283da=_['map'](values[_0x53f1('0xc7')],function(_0x4f9439){return{'channel':_0x53f1('0xc8'),'id':_0x4f9439['id'],'createdAt':_0x4f9439[_0x53f1('0xc0')]};});var _0x20162a=_['concat'](_0x1fc4d7,_0x376e64,_0x1b2675,_0x35c7df,_0x242400,_0x2283da);var _0x123a59={'count':_0x20162a[_0x53f1('0x4c')],'rows':_0x20162a};return _0x123a59;}else return null;})['then'](respondWithResult(_0x3b042f,null))[_0x53f1('0x1d')](handleError(_0x3b042f,null));};exports[_0x53f1('0xc9')]=function(_0x49fffe,_0x548ab5){var _0x4cbf55={};var _0x3631c2={};var _0xc85227;var _0x4400b2;return db[_0x53f1('0x49')][_0x53f1('0xca')]({'where':{'id':_0x49fffe[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x548ab5,null))['then'](function(_0x3f1cec){if(_0x3f1cec){_0xc85227=_0x3f1cec;_0x3631c2[_0x53f1('0x54')]=_['keys'](db[_0x53f1('0xcb')][_0x53f1('0x39')]);_0x3631c2[_0x53f1('0x41')]=_['keys'](_0x49fffe[_0x53f1('0x41')]);_0x3631c2[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x3631c2[_0x53f1('0x54')],_0x3631c2[_0x53f1('0x41')]);_0x4cbf55['attributes']=_['intersection'](_0x3631c2['model'],qs['fields'](_0x49fffe['query'][_0x53f1('0xcc')]));_0x4cbf55[_0x53f1('0x47')]=_0x4cbf55['attributes'][_0x53f1('0x4c')]?_0x4cbf55['attributes']:_0x3631c2['model'];_0x4cbf55[_0x53f1('0xcd')]=qs[_0x53f1('0xce')](_0x49fffe[_0x53f1('0x41')][_0x53f1('0xce')]);_0x4cbf55['where']=qs['filters'](_[_0x53f1('0xcf')](_0x49fffe['query'],_0x3631c2[_0x53f1('0x57')]));if(_0x49fffe[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x4cbf55[_0x53f1('0x40')]=_[_0x53f1('0x59')](_0x4cbf55[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x4cbf55[_0x53f1('0x47')],function(_0x495380){var _0x14cb0f={};_0x14cb0f[_0x495380]={'$like':'%'+_0x49fffe[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x14cb0f;})});}_0x4cbf55=_[_0x53f1('0x59')]({},_0x4cbf55,_0x49fffe[_0x53f1('0xd0')]);return _0xc85227[_0x53f1('0xc9')](_0x4cbf55);}})[_0x53f1('0x14')](function(_0x2e4b01){if(_0x2e4b01){_0x4400b2=_0x2e4b01[_0x53f1('0x4c')];if(_0x49fffe[_0x53f1('0x41')][_0x53f1('0xd1')](_0x53f1('0x42'))){_0x4cbf55['include']=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x53f1('0xd2')],'as':_0x53f1('0xd3'),'attributes':['id',_0x53f1('0x35'),_0x53f1('0xd4')],'where':_0x49fffe[_0x53f1('0x41')][_0x53f1('0xd5')]?{'id':_0x49fffe[_0x53f1('0x41')]['tag']}:undefined,'required':_0x49fffe[_0x53f1('0x41')][_0x53f1('0xd5')]?!![]:![]}];}if(!_0x49fffe['query'][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x4cbf55['limit']=qs[_0x53f1('0x23')](_0x49fffe[_0x53f1('0x41')][_0x53f1('0x23')]);_0x4cbf55['offset']=qs[_0x53f1('0x24')](_0x49fffe['query']['offset']);}return _0xc85227[_0x53f1('0xc9')](_0x4cbf55);}})[_0x53f1('0x14')](function(_0x5a2b97){if(_0x5a2b97){return _0x5a2b97?{'count':_0x4400b2,'rows':_0x5a2b97}:null;}})[_0x53f1('0x14')](respondWithResult(_0x548ab5,null))[_0x53f1('0x1d')](handleError(_0x548ab5,null));};exports[_0x53f1('0xd7')]=function(_0x53192c,_0x6c34f4){var _0x33159a;var _0x4c0fc9={};var _0x58863a;return db[_0x53f1('0x49')][_0x53f1('0xca')]({'where':{'id':_0x53192c[_0x53f1('0x53')]['id']},'attributes':['id',_0x53f1('0x35'),_0x53f1('0x34')]})[_0x53f1('0x14')](handleEntityNotFound(_0x6c34f4,null))[_0x53f1('0x14')](function(_0x451a3f){if(!utils[_0x53f1('0xa1')](_0x53192c[_0x53f1('0x41')][_0x53f1('0xb0')])){throw new db[(_0x53f1('0x91'))]['ValidationError'](_0x53f1('0xa2'));}_0x33159a=_0x451a3f;var _0x42bd99={};_0x42bd99[_0x53f1('0x54')]=_[_0x53f1('0x56')](db[_[_0x53f1('0xa4')](_0x53192c[_0x53f1('0x41')][_0x53f1('0xb0')])+'Queue']['rawAttributes']);_0x42bd99[_0x53f1('0x41')]=_[_0x53f1('0x56')](_0x53192c[_0x53f1('0x41')]);_0x42bd99[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x42bd99[_0x53f1('0x54')],_0x42bd99[_0x53f1('0x41')]);_0x4c0fc9[_0x53f1('0x47')]=_[_0x53f1('0x58')](_0x42bd99[_0x53f1('0x54')],qs[_0x53f1('0xcc')](_0x53192c[_0x53f1('0x41')][_0x53f1('0xcc')]));_0x4c0fc9[_0x53f1('0x47')]=_0x4c0fc9['attributes'][_0x53f1('0x4c')]?_0x4c0fc9['attributes']:_0x42bd99['model'];_0x4c0fc9[_0x53f1('0xcd')]=qs['sort'](_0x53192c['query'][_0x53f1('0xce')]);_0x4c0fc9[_0x53f1('0x40')]=qs['filters'](_[_0x53f1('0xcf')](_0x53192c[_0x53f1('0x41')],_0x42bd99[_0x53f1('0x57')]));if(_0x53192c['query']['filter']){_0x4c0fc9['where']=_[_0x53f1('0x59')](_0x4c0fc9['where'],{'$or':_['map'](_0x4c0fc9['attributes'],function(_0x11ee0c){var _0x319668={};_0x319668[_0x11ee0c]={'$like':'%'+_0x53192c[_0x53f1('0x41')]['filter']+'%'};return _0x319668;})});}_0x4c0fc9=_[_0x53f1('0x59')]({},_0x4c0fc9,_0x53192c[_0x53f1('0xd0')]);switch(_0x33159a[_0x53f1('0x34')]){case _0x53f1('0x7c'):return db[_[_0x53f1('0xa4')](_0x53192c['query'][_0x53f1('0xb0')])+_0x53f1('0xd8')][_0x53f1('0x4a')](_0x4c0fc9);case _0x53f1('0x7b'):case _0x53f1('0x2b'):return _0x33159a[_0x53f1('0x2a')+_[_0x53f1('0xa4')](_0x53192c[_0x53f1('0x41')]['channel'])+_0x53f1('0xa6')](_0x4c0fc9);default:throw new db['Sequelize'][(_0x53f1('0x92'))](_0x53f1('0xd9'));}})[_0x53f1('0x14')](function(_0x3d76c9){_0x58863a=_0x3d76c9[_0x53f1('0x4c')];if(!_0x53192c['query'][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x4c0fc9['limit']=qs['limit'](_0x53192c[_0x53f1('0x41')][_0x53f1('0x23')]);_0x4c0fc9[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x53192c['query'][_0x53f1('0x24')]);}switch(_0x33159a['role']){case _0x53f1('0x7c'):return db[_[_0x53f1('0xa4')](_0x53192c[_0x53f1('0x41')]['channel'])+_0x53f1('0xd8')][_0x53f1('0x4a')](_0x4c0fc9);case _0x53f1('0x7b'):case'agent':return _0x33159a['get'+_[_0x53f1('0xa4')](_0x53192c[_0x53f1('0x41')][_0x53f1('0xb0')])+_0x53f1('0xa6')](_0x4c0fc9);}})['then'](function(_0x5c6dd6){return{'count':_0x58863a,'rows':_0x5c6dd6};})[_0x53f1('0x14')](respondWithResult(_0x6c34f4,null))[_0x53f1('0x1d')](handleError(_0x6c34f4,null));};exports['getVoiceQueuesRt']=function(_0x312f24,_0x5f05e0){var _0x316a5={};var _0x3512cf={};var _0x30ca16;var _0x1fc9d2;return db[_0x53f1('0x49')][_0x53f1('0xca')]({'where':{'id':_0x312f24['params']['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x5f05e0,null))[_0x53f1('0x14')](function(_0x288a26){if(_0x288a26){_0x30ca16=_0x288a26;_0x3512cf['model']=_['keys'](db[_0x53f1('0xad')]['rawAttributes']);_0x3512cf[_0x53f1('0x41')]=_[_0x53f1('0x56')](_0x312f24['query']);_0x3512cf[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x3512cf[_0x53f1('0x54')],_0x3512cf[_0x53f1('0x41')]);_0x316a5['attributes']=_[_0x53f1('0x58')](_0x3512cf[_0x53f1('0x54')],qs[_0x53f1('0xcc')](_0x312f24[_0x53f1('0x41')]['fields']));_0x316a5[_0x53f1('0x47')]=_0x316a5[_0x53f1('0x47')][_0x53f1('0x4c')]?_0x316a5['attributes']:_0x3512cf[_0x53f1('0x54')];_0x316a5[_0x53f1('0xcd')]=qs[_0x53f1('0xce')](_0x312f24['query'][_0x53f1('0xce')]);_0x316a5[_0x53f1('0x40')]=qs[_0x53f1('0x57')](_[_0x53f1('0xcf')](_0x312f24['query'],_0x3512cf[_0x53f1('0x57')]));if(_0x312f24['query'][_0x53f1('0x2e')]){_0x316a5[_0x53f1('0x40')]=_[_0x53f1('0x59')](_0x316a5[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x316a5[_0x53f1('0x47')],function(_0xd6fdf0){var _0x5604df={};_0x5604df[_0xd6fdf0]={'$like':'%'+_0x312f24[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x5604df;})});}_0x316a5=_['merge']({},_0x316a5,_0x312f24[_0x53f1('0xd0')]);return _0x30ca16[_0x53f1('0xda')](_0x316a5);}})['then'](function(_0x29e9b2){if(_0x29e9b2){_0x1fc9d2=_0x29e9b2[_0x53f1('0x4c')];if(!_0x312f24[_0x53f1('0x41')][_0x53f1('0xd1')]('nolimit')){_0x316a5[_0x53f1('0x23')]=qs[_0x53f1('0x23')](_0x312f24['query'][_0x53f1('0x23')]);_0x316a5[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x312f24['query']['offset']);}return _0x30ca16[_0x53f1('0xda')](_0x316a5);}})[_0x53f1('0x14')](function(_0xccd2ac){if(_0xccd2ac){return _0xccd2ac?{'count':_0x1fc9d2,'rows':_0xccd2ac}:null;}})['then'](respondWithResult(_0x5f05e0,null))[_0x53f1('0x1d')](handleError(_0x5f05e0,null));};exports[_0x53f1('0xdb')]=function(_0x24f094,_0x4d71ca){var _0x4d00bb={};var _0x152389={};var _0x52a96e;var _0x3f579f;return db['User'][_0x53f1('0xca')]({'where':{'id':_0x24f094[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x4d71ca,null))['then'](function(_0x379922){if(_0x379922){_0x52a96e=_0x379922;_0x152389[_0x53f1('0x54')]=_[_0x53f1('0x56')](db[_0x53f1('0xdc')][_0x53f1('0x39')]);_0x152389['query']=_['keys'](_0x24f094['query']);_0x152389[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x152389['model'],_0x152389['query']);_0x4d00bb[_0x53f1('0x47')]=_['intersection'](_0x152389['model'],qs[_0x53f1('0xcc')](_0x24f094[_0x53f1('0x41')][_0x53f1('0xcc')]));_0x4d00bb[_0x53f1('0x47')]=_0x4d00bb[_0x53f1('0x47')][_0x53f1('0x4c')]?_0x4d00bb[_0x53f1('0x47')]:_0x152389[_0x53f1('0x54')];_0x4d00bb['order']=qs[_0x53f1('0xce')](_0x24f094['query']['sort']);_0x4d00bb[_0x53f1('0x40')]=qs[_0x53f1('0x57')](_[_0x53f1('0xcf')](_0x24f094[_0x53f1('0x41')],_0x152389[_0x53f1('0x57')]));if(_0x24f094[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x4d00bb[_0x53f1('0x40')]=_['merge'](_0x4d00bb[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x4d00bb[_0x53f1('0x47')],function(_0x5686b2){var _0xe06cfb={};_0xe06cfb[_0x5686b2]={'$like':'%'+_0x24f094['query'][_0x53f1('0x2e')]+'%'};return _0xe06cfb;})});}_0x4d00bb=_[_0x53f1('0x59')]({},_0x4d00bb,_0x24f094[_0x53f1('0xd0')]);return _0x52a96e[_0x53f1('0xdb')](_0x4d00bb);}})[_0x53f1('0x14')](function(_0x3b8c96){if(_0x3b8c96){_0x3f579f=_0x3b8c96['length'];if(!_0x24f094[_0x53f1('0x41')][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x4d00bb[_0x53f1('0x23')]=qs['limit'](_0x24f094[_0x53f1('0x41')][_0x53f1('0x23')]);_0x4d00bb['offset']=qs['offset'](_0x24f094[_0x53f1('0x41')][_0x53f1('0x24')]);}return _0x52a96e[_0x53f1('0xdb')](_0x4d00bb);}})[_0x53f1('0x14')](function(_0x3308f3){if(_0x3308f3){return _0x3308f3?{'count':_0x3f579f,'rows':_0x3308f3}:null;}})[_0x53f1('0x14')](respondWithResult(_0x4d71ca,null))['catch'](handleError(_0x4d71ca,null));};exports['getRecordings']=function(_0x473a93,_0x4083eb){var _0x4f732a={'raw':!![],'where':{}};var _0x1d4a56={};var _0x18a203={'count':0x0,'rows':[]};return db[_0x53f1('0x49')][_0x53f1('0xca')]({'where':{'id':_0x473a93[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x4083eb,null))[_0x53f1('0x14')](function(_0x430353){if(_0x430353){_0x1d4a56[_0x53f1('0x54')]=_['keys'](db[_0x53f1('0xdd')][_0x53f1('0x39')]);_0x1d4a56[_0x53f1('0x41')]=_[_0x53f1('0x56')](_0x473a93['query']);_0x1d4a56[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x1d4a56[_0x53f1('0x54')],_0x1d4a56['query']);_0x4f732a[_0x53f1('0x47')]=_['intersection'](_0x1d4a56[_0x53f1('0x54')],qs[_0x53f1('0xcc')](_0x473a93['query']['fields']));_0x4f732a['attributes']=_0x4f732a[_0x53f1('0x47')][_0x53f1('0x4c')]?_0x4f732a[_0x53f1('0x47')]:_0x1d4a56['model'];if(!_0x473a93['query'][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x4f732a['limit']=qs['limit'](_0x473a93['query'][_0x53f1('0x23')]);_0x4f732a[_0x53f1('0x24')]=qs['offset'](_0x473a93['query']['offset']);}_0x4f732a[_0x53f1('0xcd')]=qs[_0x53f1('0xce')](_0x473a93['query']['sort']);_0x4f732a[_0x53f1('0x40')]=qs['filters'](_[_0x53f1('0xcf')](_0x473a93[_0x53f1('0x41')],_0x1d4a56[_0x53f1('0x57')]));_0x4f732a[_0x53f1('0x40')][_0x53f1('0xde')]=_0x430353['id'];if(_0x473a93[_0x53f1('0x41')]['filter']){_0x4f732a[_0x53f1('0x40')]=_['merge'](_0x4f732a[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x4f732a[_0x53f1('0x47')],function(_0xf72016){var _0x9ae261={};_0x9ae261[_0xf72016]={'$like':'%'+_0x473a93[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x9ae261;})});}_0x4f732a=_[_0x53f1('0x59')]({},_0x4f732a,_0x473a93['options']);return db[_0x53f1('0xdd')][_0x53f1('0x25')]({'where':_0x4f732a[_0x53f1('0x40')]})[_0x53f1('0x14')](function(_0x6603f){_0x18a203['count']=_0x6603f;if(_0x473a93[_0x53f1('0x41')][_0x53f1('0x42')]){_0x4f732a[_0x53f1('0x43')]=[{'all':!![]}];}return db[_0x53f1('0xdd')][_0x53f1('0x4a')](_0x4f732a);})[_0x53f1('0x14')](function(_0x4106fa){_0x18a203[_0x53f1('0x4b')]=_0x4106fa;return _0x18a203;});}})[_0x53f1('0x14')](respondWithFilteredResult(_0x4083eb,_0x4f732a))[_0x53f1('0x1d')](handleError(_0x4083eb,null));};exports[_0x53f1('0xdf')]=function(_0x3312f5,_0xfba993){var _0x465bc1={'raw':!![],'where':{}};var _0x5ded4e={};var _0x1a4970={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3312f5[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0xfba993,null))[_0x53f1('0x14')](function(_0x5abc2b){if(_0x5abc2b){_0x5ded4e[_0x53f1('0x54')]=_[_0x53f1('0x56')](db['ScreenRecording'][_0x53f1('0x39')]);_0x5ded4e[_0x53f1('0x41')]=_[_0x53f1('0x56')](_0x3312f5[_0x53f1('0x41')]);_0x5ded4e[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x5ded4e[_0x53f1('0x54')],_0x5ded4e[_0x53f1('0x41')]);_0x465bc1[_0x53f1('0x47')]=_['intersection'](_0x5ded4e[_0x53f1('0x54')],qs[_0x53f1('0xcc')](_0x3312f5[_0x53f1('0x41')][_0x53f1('0xcc')]));_0x465bc1[_0x53f1('0x47')]=_0x465bc1[_0x53f1('0x47')]['length']?_0x465bc1[_0x53f1('0x47')]:_0x5ded4e['model'];if(!_0x3312f5[_0x53f1('0x41')][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x465bc1[_0x53f1('0x23')]=qs[_0x53f1('0x23')](_0x3312f5['query'][_0x53f1('0x23')]);_0x465bc1[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x3312f5[_0x53f1('0x41')][_0x53f1('0x24')]);}_0x465bc1[_0x53f1('0xcd')]=qs['sort'](_0x3312f5[_0x53f1('0x41')]['sort']);_0x465bc1[_0x53f1('0x40')]=qs[_0x53f1('0x57')](_[_0x53f1('0xcf')](_0x3312f5[_0x53f1('0x41')],_0x5ded4e[_0x53f1('0x57')]));_0x465bc1[_0x53f1('0x40')]['UserId']=_0x5abc2b['id'];if(_0x3312f5[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x465bc1[_0x53f1('0x40')]=_[_0x53f1('0x59')](_0x465bc1[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x465bc1[_0x53f1('0x47')],function(_0x53b45d){var _0x1c99c1={};_0x1c99c1[_0x53b45d]={'$like':'%'+_0x3312f5[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x1c99c1;})});}_0x465bc1=_[_0x53f1('0x59')]({},_0x465bc1,_0x3312f5[_0x53f1('0xd0')]);return db[_0x53f1('0xe0')][_0x53f1('0x25')]({'where':_0x465bc1[_0x53f1('0x40')]})[_0x53f1('0x14')](function(_0x1b84df){_0x1a4970[_0x53f1('0x25')]=_0x1b84df;if(_0x3312f5['query'][_0x53f1('0x42')]){_0x465bc1[_0x53f1('0x43')]=[{'all':!![]}];}return db[_0x53f1('0xe0')]['findAll'](_0x465bc1);})['then'](function(_0x6580f0){_0x1a4970[_0x53f1('0x4b')]=_0x6580f0;return _0x1a4970;});}})[_0x53f1('0x14')](respondWithFilteredResult(_0xfba993,_0x465bc1))[_0x53f1('0x1d')](handleError(_0xfba993,null));};exports[_0x53f1('0xe1')]=function(_0x528f28,_0x3a0a81){var _0x588e80={};var _0xfe92c5={};var _0x117f28;var _0x4358ef;return db['User']['findOne']({'where':{'id':_0x528f28['params']['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x3a0a81,null))[_0x53f1('0x14')](function(_0x59dd86){if(_0x59dd86){_0x117f28=_0x59dd86;_0xfe92c5['model']=_[_0x53f1('0x56')](db[_0x53f1('0xe2')]['rawAttributes']);_0xfe92c5[_0x53f1('0x41')]=_['keys'](_0x528f28[_0x53f1('0x41')]);_0xfe92c5[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0xfe92c5[_0x53f1('0x54')],_0xfe92c5[_0x53f1('0x41')]);_0x588e80[_0x53f1('0x47')]=_[_0x53f1('0x58')](_0xfe92c5[_0x53f1('0x54')],qs[_0x53f1('0xcc')](_0x528f28[_0x53f1('0x41')][_0x53f1('0xcc')]));_0x588e80[_0x53f1('0x47')]=_0x588e80[_0x53f1('0x47')][_0x53f1('0x4c')]?_0x588e80[_0x53f1('0x47')]:_0xfe92c5['model'];_0x588e80[_0x53f1('0xcd')]=qs['sort'](_0x528f28[_0x53f1('0x41')][_0x53f1('0xce')]);_0x588e80[_0x53f1('0x40')]=qs['filters'](_[_0x53f1('0xcf')](_0x528f28['query'],_0xfe92c5[_0x53f1('0x57')]));if(_0x528f28['query'][_0x53f1('0x2e')]){_0x588e80[_0x53f1('0x40')]=_['merge'](_0x588e80[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x588e80[_0x53f1('0x47')],function(_0x93dd02){var _0x5ee5b8={};_0x5ee5b8[_0x93dd02]={'$like':'%'+_0x528f28[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x5ee5b8;})});}_0x588e80=_['merge']({},_0x588e80,_0x528f28['options']);return _0x117f28['getChatInteractions'](_0x588e80);}})['then'](function(_0x3392e0){if(_0x3392e0){_0x4358ef=_0x3392e0[_0x53f1('0x4c')];if(!_0x528f28[_0x53f1('0x41')][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x588e80[_0x53f1('0x23')]=qs['limit'](_0x528f28[_0x53f1('0x41')]['limit']);_0x588e80[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x528f28[_0x53f1('0x41')][_0x53f1('0x24')]);}return _0x117f28[_0x53f1('0xe1')](_0x588e80);}})[_0x53f1('0x14')](function(_0x4c58b8){if(_0x4c58b8){return _0x4c58b8?{'count':_0x4358ef,'rows':_0x4c58b8}:null;}})[_0x53f1('0x14')](respondWithResult(_0x3a0a81,null))[_0x53f1('0x1d')](handleError(_0x3a0a81,null));};exports['getOpenchannelInteractions']=function(_0x4a2aa4,_0x56297b){var _0x1ebaec={};var _0x193678={};var _0x134f60;var _0x2482bf;return db[_0x53f1('0x49')][_0x53f1('0xca')]({'where':{'id':_0x4a2aa4[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x56297b,null))[_0x53f1('0x14')](function(_0x43ff8d){if(_0x43ff8d){_0x134f60=_0x43ff8d;_0x193678[_0x53f1('0x54')]=_[_0x53f1('0x56')](db['OpenchannelInteraction'][_0x53f1('0x39')]);_0x193678[_0x53f1('0x41')]=_[_0x53f1('0x56')](_0x4a2aa4[_0x53f1('0x41')]);_0x193678[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x193678[_0x53f1('0x54')],_0x193678[_0x53f1('0x41')]);_0x1ebaec[_0x53f1('0x47')]=_['intersection'](_0x193678['model'],qs['fields'](_0x4a2aa4['query']['fields']));_0x1ebaec[_0x53f1('0x47')]=_0x1ebaec[_0x53f1('0x47')][_0x53f1('0x4c')]?_0x1ebaec[_0x53f1('0x47')]:_0x193678[_0x53f1('0x54')];_0x1ebaec[_0x53f1('0xcd')]=qs[_0x53f1('0xce')](_0x4a2aa4[_0x53f1('0x41')][_0x53f1('0xce')]);_0x1ebaec[_0x53f1('0x40')]=qs[_0x53f1('0x57')](_['pick'](_0x4a2aa4[_0x53f1('0x41')],_0x193678['filters']));if(_0x4a2aa4[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x1ebaec['where']=_[_0x53f1('0x59')](_0x1ebaec[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x1ebaec[_0x53f1('0x47')],function(_0x180e4a){var _0x5d9662={};_0x5d9662[_0x180e4a]={'$like':'%'+_0x4a2aa4[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x5d9662;})});}_0x1ebaec=_[_0x53f1('0x59')]({},_0x1ebaec,_0x4a2aa4[_0x53f1('0xd0')]);return _0x134f60[_0x53f1('0xe3')](_0x1ebaec);}})[_0x53f1('0x14')](function(_0x281f4e){if(_0x281f4e){_0x2482bf=_0x281f4e[_0x53f1('0x4c')];if(!_0x4a2aa4[_0x53f1('0x41')][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x1ebaec[_0x53f1('0x23')]=qs[_0x53f1('0x23')](_0x4a2aa4[_0x53f1('0x41')][_0x53f1('0x23')]);_0x1ebaec[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x4a2aa4[_0x53f1('0x41')][_0x53f1('0x24')]);}return _0x134f60[_0x53f1('0xe3')](_0x1ebaec);}})['then'](function(_0x131b59){if(_0x131b59){return _0x131b59?{'count':_0x2482bf,'rows':_0x131b59}:null;}})['then'](respondWithResult(_0x56297b,null))[_0x53f1('0x1d')](handleError(_0x56297b,null));};exports[_0x53f1('0xe4')]=function(_0x313686,_0x51f4c6){var _0x1c6d56={'raw':!![],'where':{}};var _0x224ca9={};var _0x31776c={'count':0x0,'rows':[]};return db[_0x53f1('0x49')]['findOne']({'where':{'id':_0x313686['params']['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x51f4c6,null))['then'](function(_0x9c5b1d){if(_0x9c5b1d){_0x224ca9[_0x53f1('0x54')]=_[_0x53f1('0x56')](db[_0x53f1('0xe5')][_0x53f1('0x39')]);_0x224ca9[_0x53f1('0x41')]=_[_0x53f1('0x56')](_0x313686['query']);_0x224ca9[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x224ca9[_0x53f1('0x54')],_0x224ca9[_0x53f1('0x41')]);_0x1c6d56['attributes']=_[_0x53f1('0x58')](_0x224ca9['model'],qs[_0x53f1('0xcc')](_0x313686['query'][_0x53f1('0xcc')]));_0x1c6d56['attributes']=_0x1c6d56[_0x53f1('0x47')]['length']?_0x1c6d56[_0x53f1('0x47')]:_0x224ca9['model'];if(!_0x313686[_0x53f1('0x41')][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x1c6d56[_0x53f1('0x23')]=qs[_0x53f1('0x23')](_0x313686[_0x53f1('0x41')][_0x53f1('0x23')]);_0x1c6d56[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x313686[_0x53f1('0x41')][_0x53f1('0x24')]);}_0x1c6d56[_0x53f1('0xcd')]=qs['sort'](_0x313686[_0x53f1('0x41')][_0x53f1('0xce')]);_0x1c6d56[_0x53f1('0x40')]=qs[_0x53f1('0x57')](_[_0x53f1('0xcf')](_0x313686[_0x53f1('0x41')],_0x224ca9[_0x53f1('0x57')]));_0x1c6d56[_0x53f1('0x40')][_0x53f1('0xde')]=_0x9c5b1d['id'];if(_0x313686[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x1c6d56[_0x53f1('0x40')]=_[_0x53f1('0x59')](_0x1c6d56[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x1c6d56['attributes'],function(_0x2a4bc3){var _0x1ac4b8={};_0x1ac4b8[_0x2a4bc3]={'$like':'%'+_0x313686[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x1ac4b8;})});}_0x1c6d56=_['merge']({},_0x1c6d56,_0x313686[_0x53f1('0xd0')]);return db[_0x53f1('0xe5')][_0x53f1('0x25')]({'where':_0x1c6d56[_0x53f1('0x40')]})['then'](function(_0x294f5d){_0x31776c['count']=_0x294f5d;if(_0x313686[_0x53f1('0x41')][_0x53f1('0x42')]){_0x1c6d56[_0x53f1('0x43')]=[{'all':!![]}];}return db[_0x53f1('0xe5')]['findAll'](_0x1c6d56);})[_0x53f1('0x14')](function(_0x16e909){_0x31776c[_0x53f1('0x4b')]=_0x16e909;return _0x31776c;});}})[_0x53f1('0x14')](respondWithFilteredResult(_0x51f4c6,_0x1c6d56))['catch'](handleError(_0x51f4c6,null));};exports[_0x53f1('0xe6')]=function(_0x174db3,_0x342196){var _0x38e709={};var _0x15a7e9={};var _0x26fab4;var _0x377cf9;return db['User']['findOne']({'where':{'id':_0x174db3['params']['id']}})['then'](handleEntityNotFound(_0x342196,null))[_0x53f1('0x14')](function(_0x198fa9){if(_0x198fa9){_0x26fab4=_0x198fa9;_0x15a7e9[_0x53f1('0x54')]=_[_0x53f1('0x56')](db[_0x53f1('0xe7')][_0x53f1('0x39')]);_0x15a7e9[_0x53f1('0x41')]=_[_0x53f1('0x56')](_0x174db3[_0x53f1('0x41')]);_0x15a7e9[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x15a7e9['model'],_0x15a7e9[_0x53f1('0x41')]);_0x38e709[_0x53f1('0x47')]=_[_0x53f1('0x58')](_0x15a7e9['model'],qs[_0x53f1('0xcc')](_0x174db3[_0x53f1('0x41')][_0x53f1('0xcc')]));_0x38e709[_0x53f1('0x47')]=_0x38e709[_0x53f1('0x47')][_0x53f1('0x4c')]?_0x38e709[_0x53f1('0x47')]:_0x15a7e9[_0x53f1('0x54')];_0x38e709['order']=qs['sort'](_0x174db3[_0x53f1('0x41')]['sort']);_0x38e709[_0x53f1('0x40')]=qs[_0x53f1('0x57')](_[_0x53f1('0xcf')](_0x174db3[_0x53f1('0x41')],_0x15a7e9[_0x53f1('0x57')]));if(_0x174db3[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x38e709[_0x53f1('0x40')]=_['merge'](_0x38e709[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x38e709[_0x53f1('0x47')],function(_0x2592f2){var _0x4c78de={};_0x4c78de[_0x2592f2]={'$like':'%'+_0x174db3['query'][_0x53f1('0x2e')]+'%'};return _0x4c78de;})});}_0x38e709=_['merge']({},_0x38e709,_0x174db3[_0x53f1('0xd0')]);return _0x26fab4['getSmsInteractions'](_0x38e709);}})[_0x53f1('0x14')](function(_0x1c66bc){if(_0x1c66bc){_0x377cf9=_0x1c66bc['length'];if(!_0x174db3[_0x53f1('0x41')][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x38e709['limit']=qs[_0x53f1('0x23')](_0x174db3[_0x53f1('0x41')][_0x53f1('0x23')]);_0x38e709[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x174db3['query'][_0x53f1('0x24')]);}return _0x26fab4['getSmsInteractions'](_0x38e709);}})[_0x53f1('0x14')](function(_0x4c69e5){if(_0x4c69e5){return _0x4c69e5?{'count':_0x377cf9,'rows':_0x4c69e5}:null;}})['then'](respondWithResult(_0x342196,null))[_0x53f1('0x1d')](handleError(_0x342196,null));};exports['getFaxInteractions']=function(_0x1dab4a,_0x47c6b5){var _0x4aacdd={};var _0x5932e1={};var _0x34df43;var _0x39820c;return db['User'][_0x53f1('0xca')]({'where':{'id':_0x1dab4a[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x47c6b5,null))[_0x53f1('0x14')](function(_0x112933){if(_0x112933){_0x34df43=_0x112933;_0x5932e1[_0x53f1('0x54')]=_[_0x53f1('0x56')](db[_0x53f1('0xe8')][_0x53f1('0x39')]);_0x5932e1[_0x53f1('0x41')]=_[_0x53f1('0x56')](_0x1dab4a[_0x53f1('0x41')]);_0x5932e1[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x5932e1[_0x53f1('0x54')],_0x5932e1['query']);_0x4aacdd[_0x53f1('0x47')]=_[_0x53f1('0x58')](_0x5932e1[_0x53f1('0x54')],qs[_0x53f1('0xcc')](_0x1dab4a[_0x53f1('0x41')]['fields']));_0x4aacdd['attributes']=_0x4aacdd[_0x53f1('0x47')]['length']?_0x4aacdd[_0x53f1('0x47')]:_0x5932e1['model'];_0x4aacdd[_0x53f1('0xcd')]=qs[_0x53f1('0xce')](_0x1dab4a['query'][_0x53f1('0xce')]);_0x4aacdd[_0x53f1('0x40')]=qs[_0x53f1('0x57')](_[_0x53f1('0xcf')](_0x1dab4a['query'],_0x5932e1['filters']));if(_0x1dab4a['query'][_0x53f1('0x2e')]){_0x4aacdd['where']=_[_0x53f1('0x59')](_0x4aacdd[_0x53f1('0x40')],{'$or':_['map'](_0x4aacdd[_0x53f1('0x47')],function(_0x559796){var _0x41eb21={};_0x41eb21[_0x559796]={'$like':'%'+_0x1dab4a[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x41eb21;})});}_0x4aacdd=_[_0x53f1('0x59')]({},_0x4aacdd,_0x1dab4a[_0x53f1('0xd0')]);return _0x34df43[_0x53f1('0xe9')](_0x4aacdd);}})['then'](function(_0x177ae2){if(_0x177ae2){_0x39820c=_0x177ae2[_0x53f1('0x4c')];if(!_0x1dab4a['query'][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x4aacdd[_0x53f1('0x23')]=qs[_0x53f1('0x23')](_0x1dab4a[_0x53f1('0x41')][_0x53f1('0x23')]);_0x4aacdd[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x1dab4a[_0x53f1('0x41')][_0x53f1('0x24')]);}return _0x34df43[_0x53f1('0xe9')](_0x4aacdd);}})[_0x53f1('0x14')](function(_0x1a04d5){if(_0x1a04d5){return _0x1a04d5?{'count':_0x39820c,'rows':_0x1a04d5}:null;}})[_0x53f1('0x14')](respondWithResult(_0x47c6b5,null))[_0x53f1('0x1d')](handleError(_0x47c6b5,null));};exports['getWhatsappInteractions']=function(_0x44c7a4,_0x3a8778){var _0x1cc7bd={};var _0x4331b0={};var _0xd3440a;var _0x51e00a;return db[_0x53f1('0x49')][_0x53f1('0xca')]({'where':{'id':_0x44c7a4[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x3a8778,null))[_0x53f1('0x14')](function(_0x7ffc4e){if(_0x7ffc4e){_0xd3440a=_0x7ffc4e;_0x4331b0[_0x53f1('0x54')]=_['keys'](db['WhatsappInteraction'][_0x53f1('0x39')]);_0x4331b0[_0x53f1('0x41')]=_['keys'](_0x44c7a4[_0x53f1('0x41')]);_0x4331b0[_0x53f1('0x57')]=_['intersection'](_0x4331b0[_0x53f1('0x54')],_0x4331b0['query']);_0x1cc7bd['attributes']=_[_0x53f1('0x58')](_0x4331b0[_0x53f1('0x54')],qs[_0x53f1('0xcc')](_0x44c7a4[_0x53f1('0x41')][_0x53f1('0xcc')]));_0x1cc7bd[_0x53f1('0x47')]=_0x1cc7bd[_0x53f1('0x47')][_0x53f1('0x4c')]?_0x1cc7bd['attributes']:_0x4331b0[_0x53f1('0x54')];_0x1cc7bd[_0x53f1('0xcd')]=qs['sort'](_0x44c7a4[_0x53f1('0x41')][_0x53f1('0xce')]);_0x1cc7bd[_0x53f1('0x40')]=qs['filters'](_[_0x53f1('0xcf')](_0x44c7a4[_0x53f1('0x41')],_0x4331b0['filters']));if(_0x44c7a4[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x1cc7bd['where']=_[_0x53f1('0x59')](_0x1cc7bd[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x1cc7bd[_0x53f1('0x47')],function(_0x3f5616){var _0x3b2eb4={};_0x3b2eb4[_0x3f5616]={'$like':'%'+_0x44c7a4[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x3b2eb4;})});}_0x1cc7bd=_[_0x53f1('0x59')]({},_0x1cc7bd,_0x44c7a4[_0x53f1('0xd0')]);return _0xd3440a[_0x53f1('0xea')](_0x1cc7bd);}})[_0x53f1('0x14')](function(_0x267dde){if(_0x267dde){_0x51e00a=_0x267dde[_0x53f1('0x4c')];if(!_0x44c7a4['query'][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x1cc7bd[_0x53f1('0x23')]=qs[_0x53f1('0x23')](_0x44c7a4[_0x53f1('0x41')][_0x53f1('0x23')]);_0x1cc7bd[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x44c7a4[_0x53f1('0x41')][_0x53f1('0x24')]);}return _0xd3440a['getWhatsappInteractions'](_0x1cc7bd);}})['then'](function(_0x1b0b56){if(_0x1b0b56){return _0x1b0b56?{'count':_0x51e00a,'rows':_0x1b0b56}:null;}})[_0x53f1('0x14')](respondWithResult(_0x3a8778,null))['catch'](handleError(_0x3a8778,null));};exports[_0x53f1('0xeb')]=function(_0x1969b9,_0x1a353e,_0x5a6a2f){var _0x3eac09;var _0x49d033;var _0x3e9024;var _0x2502fa=!_['isNil'](_0x1969b9['params']['id'])?_0x1969b9[_0x53f1('0x53')]['id']:!_[_0x53f1('0x67')](_0x1969b9['user']['id'])?_0x1969b9[_0x53f1('0x7b')]['id']:null;return db[_0x53f1('0x49')][_0x53f1('0x33')]({'where':{'id':_0x2502fa,'role':{'$or':[_0x53f1('0x7c'),_0x53f1('0x7b'),_0x53f1('0x2b')]}},'attributes':['id',_0x53f1('0x35'),_0x53f1('0xec'),'mobile',_0x53f1('0x34'),'internal','loginInPause']})['then'](function(_0x4d48ea){if(_0x4d48ea){if(_0x4d48ea[_0x53f1('0x34')]===_0x53f1('0x2b')){_0x3eac09=_0x4d48ea;if(_0x1969b9['body'][_0x53f1('0xa0')]){_0x3e9024=util[_0x53f1('0xab')](_0x53f1('0xed'),_0x3eac09[_0x1969b9[_0x53f1('0x5d')][_0x53f1('0xa0')]]);}else if(_0x1969b9[_0x53f1('0x5d')][_0x53f1('0xee')]){_0x3e9024=util['format']('SIP/%s',_0x1969b9[_0x53f1('0x5d')]['intrf']);}else{_0x3e9024=util[_0x53f1('0xab')](_0x53f1('0xac'),_0x3eac09[_0x53f1('0x35')]);}socket['to'](util[_0x53f1('0xab')](_0x53f1('0xef'),_0x3eac09[_0x53f1('0x35')]))[_0x53f1('0xb2')](_0x53f1('0xf0'),{'user':{'id':_0x3eac09['id'],'name':_0x3eac09[_0x53f1('0x35')]},'ip':_0x1969b9[_0x53f1('0xf1')][_0x53f1('0xf2')]||_0x1969b9['connection'][_0x53f1('0xf3')]||_0x1969b9[_0x53f1('0xf4')][_0x53f1('0xf3')]||_0x1969b9[_0x53f1('0xf5')][_0x53f1('0xf4')][_0x53f1('0xf3')]});return db[_0x53f1('0xad')][_0x53f1('0x29')]({'where':{'membername':_0x3eac09[_0x53f1('0x35')]},'individualHooks':!![]});}}else{throw new db[(_0x53f1('0x91'))]['ValidationError'](_0x53f1('0xf6'));}})[_0x53f1('0x14')](function(){if(_0x3eac09){return _0x3eac09['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1961f4){if(_0x3eac09){var _0xb0e2d4=[];if(_0x1961f4){_0x49d033=_0x1961f4;if(_0x49d033['length']){for(var _0x1075ec=0x0;_0x1075ec<_0x49d033[_0x53f1('0x4c')];_0x1075ec++){_0xb0e2d4[_0x53f1('0x48')]({'membername':_0x3eac09[_0x53f1('0x35')],'UserId':_0x3eac09['id'],'queue_name':_0x49d033[_0x1075ec][_0x53f1('0x35')],'VoiceQueueId':_0x49d033[_0x1075ec]['id'],'interface':_0x3e9024,'paused':_0x3eac09[_0x53f1('0xf7')]||![],'penalty':_0x49d033[_0x1075ec][_0x53f1('0xf8')]||0x0});}return BPromise[_0x53f1('0x8a')](_0xb0e2d4,function(_0x4405aa){return db[_0x53f1('0xad')][_0x53f1('0xae')](_0x4405aa);});}}}})[_0x53f1('0x14')](function(){if(_0x3eac09){return db[_0x53f1('0xf9')][_0x53f1('0x4a')]({'where':{'membername':_0x3eac09[_0x53f1('0x35')],'exitAt':null}});}})[_0x53f1('0x14')](function(_0x1b72c7){if(_0x3eac09){var _0x44efa6=[];_0x1b72c7[_0x53f1('0xfa')](function(_0x26bd5f){_0x44efa6[_0x53f1('0x48')](_0x26bd5f[_0x53f1('0x28')]({'exitAt':moment()['format'](_0x53f1('0xfb'))}));});return BPromise[_0x53f1('0x51')](_0x44efa6);}})[_0x53f1('0x14')](function(){if(_0x3eac09){var _0xb8649d=[];var _0xc74f96=[];var _0x25b6a4=utils[_0x53f1('0xfc')]();var _0x565dad={'membername':_0x3eac09[_0x53f1('0x35')],'interface':_0x3e9024,'enterAt':moment()[_0x53f1('0xab')](_0x53f1('0xfb')),'role':_0x3eac09[_0x53f1('0x34')],'internal':_0x3eac09[_0x53f1('0x61')]};_0x25b6a4[_0x53f1('0xfa')](function(_0x105859){_0xb8649d[_0x53f1('0x48')](_[_0x53f1('0x59')]({'channel':_0x105859,'type':_0x53f1('0xfd'),'data1':_0x1969b9[_0x53f1('0x5d')][_0x53f1('0xfe')],'data2':_0x3e9024},_0x565dad));if(_0x3eac09[_0x53f1('0xf7')]){_0xc74f96[_0x53f1('0x48')](_[_0x53f1('0x59')]({'channel':_0x105859,'type':_0x53f1('0xff'),'data1':'LOGININPAUSE'},_0x565dad));}});return db[_0x53f1('0xf9')][_0x53f1('0x87')](_0xb8649d['concat'](_0xc74f96),{'individualHooks':!![]});}})['then'](function(){if(_0x3eac09){return _0x3eac09[_0x53f1('0x28')]({'online':!![],'lastLoginAt':moment()[_0x53f1('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3eac09['loginInPause']||![],'mailPause':_0x3eac09[_0x53f1('0xf7')]||![],'chatPause':_0x3eac09[_0x53f1('0xf7')]||![],'faxPause':_0x3eac09[_0x53f1('0xf7')]||![],'smsPause':_0x3eac09[_0x53f1('0xf7')]||![],'openchannelPause':_0x3eac09[_0x53f1('0xf7')]||![],'whatsappPause':_0x3eac09[_0x53f1('0xf7')]||![],'pauseType':_0x3eac09['loginInPause']?_0x53f1('0x100'):null,'interface':_0x3e9024,'lastPauseAt':moment()[_0x53f1('0xab')](_0x53f1('0xfb'))});}})['then'](function(_0x55f079){if(_0x1969b9[_0x53f1('0x101')]){return _0x5a6a2f();}else{return BPromise[_0x53f1('0x102')](_0x55f079)[_0x53f1('0x14')](respondWithResult(_0x1a353e,null));}})[_0x53f1('0x1d')](handleError(_0x1a353e,null));};exports['logout']=function(_0x2ff899,_0x308f37){var _0x3bce3f;return db['User'][_0x53f1('0x33')]({'where':{'id':_0x2ff899[_0x53f1('0x53')]['id'],'role':_0x53f1('0x2b')},'attributes':['id',_0x53f1('0x35'),'role']})[_0x53f1('0x14')](handleEntityNotFound(_0x308f37,null))[_0x53f1('0x14')](function(_0x6bf7d5){if(_0x6bf7d5){_0x3bce3f=_0x6bf7d5;return db[_0x53f1('0xad')][_0x53f1('0x29')]({'where':{'membername':_0x3bce3f[_0x53f1('0x35')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x3bce3f[_0x53f1('0x35')],'exitAt':null}});})[_0x53f1('0x14')](function(_0x55f3c9){var _0x4006cb=[];_0x55f3c9['forEach'](function(_0x111127){_0x4006cb[_0x53f1('0x48')](_0x111127[_0x53f1('0x28')]({'exitAt':moment()[_0x53f1('0xab')](_0x53f1('0xfb'))}));});return BPromise['all'](_0x4006cb);})[_0x53f1('0x14')](function(){return _0x3bce3f[_0x53f1('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x53f1('0x14')](respondWithResult(_0x308f37,null))[_0x53f1('0x1d')](handleError(_0x308f37,null));};exports[_0x53f1('0x103')]=function(_0xe39ed3,_0x482e22){var _0x2af287;return db[_0x53f1('0xad')]['update']({'paused':0x1},{'where':{'UserId':_0xe39ed3[_0x53f1('0x53')]['id']},'individualHooks':!![]})[_0x53f1('0x14')](function(){return db[_0x53f1('0x49')][_0x53f1('0x33')]({'where':{'id':_0xe39ed3[_0x53f1('0x53')]['id'],'role':_0x53f1('0x2b')},'attributes':['id',_0x53f1('0x35'),'role',_0x53f1('0x61'),'interface']});})['then'](handleEntityNotFound(_0x482e22,null))[_0x53f1('0x14')](function(_0x1db0e3){if(_0x1db0e3){_0x2af287=_0x1db0e3;return respondWithRpcPromise(_0x53f1('0x104'),_0x53f1('0x103'),{'id':_0x2af287['id'],'name':_0x2af287[_0x53f1('0x35')],'pause':!![]});}})[_0x53f1('0x14')](function(){if(_0x2af287){return db['MemberReport'][_0x53f1('0x4a')]({'where':{'membername':_0x2af287['name'],'type':_0x53f1('0xff'),'exitAt':null}});}})[_0x53f1('0x14')](function(_0x247ed5){if(_0x247ed5[_0x53f1('0x4c')]){var _0xeb1660=moment()[_0x53f1('0xab')](_0x53f1('0xfb'));for(var _0x19ca93=0x0,_0x4a5d74=_0x247ed5[_0x53f1('0x4c')];_0x19ca93<_0x4a5d74;_0x19ca93++){_0x247ed5[_0x19ca93][_0x53f1('0x105')]({'exitAt':_0xeb1660});}}})[_0x53f1('0x14')](function(){var _0x13040e=[];var _0x39e577=utils['getChannels']();_0x39e577[_0x53f1('0xfa')](function(_0x68583d){_0x13040e[_0x53f1('0x48')]({'channel':_0x68583d,'membername':_0x2af287['name'],'interface':_['isNil'](_0x2af287[_0x53f1('0xa0')])?util[_0x53f1('0xab')]('SIP/%s',_0x2af287[_0x53f1('0x35')]):_0x2af287[_0x53f1('0xa0')],'type':_0x53f1('0xff'),'enterAt':moment()[_0x53f1('0xab')](_0x53f1('0xfb')),'data1':_0xe39ed3[_0x53f1('0x5d')][_0x53f1('0x3b')]||_0x53f1('0x106'),'role':_0x2af287[_0x53f1('0x34')],'internal':_0x2af287[_0x53f1('0x61')]});});return db[_0x53f1('0xf9')]['bulkCreate'](_0x13040e,{'individualHooks':!![]});})[_0x53f1('0x14')](function(){return _0x2af287[_0x53f1('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xe39ed3[_0x53f1('0x5d')][_0x53f1('0x3b')]||_0x53f1('0x106'),'lastPauseAt':moment()[_0x53f1('0xab')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x53f1('0x14')](respondWithResult(_0x482e22,null))[_0x53f1('0x1d')](handleError(_0x482e22,null));};exports[_0x53f1('0x107')]=function(_0x544b8c,_0x2885eb){var _0x37879c;return db[_0x53f1('0x49')]['find']({'where':{'id':_0x544b8c['params']['id']},'attributes':['id','name',_0x53f1('0x34'),'voicePause',_0x53f1('0x108'),'chatPause',_0x53f1('0x109'),_0x53f1('0x10a'),'smsPause',_0x53f1('0x10b'),_0x53f1('0x10c'),_0x53f1('0x10d')]})['then'](handleEntityNotFound(_0x2885eb,null))['then'](function(_0x26f5ed){if(_0x26f5ed){_0x37879c=_0x26f5ed;if(_0x544b8c[_0x53f1('0x5d')]['channel']&&!utils[_0x53f1('0xa1')](_0x544b8c[_0x53f1('0x5d')][_0x53f1('0xb0')])){throw new db[(_0x53f1('0x91'))]['ValidationError'](_0x53f1('0xa2'));}switch(_0x544b8c[_0x53f1('0x5d')]['channel']){case _0x53f1('0xa9'):return respondWithRpcPromise(_0x53f1('0x104'),_0x53f1('0x107'),{'id':_0x37879c['id'],'name':_0x37879c[_0x53f1('0x35')],'pause':![]})[_0x53f1('0x14')](function(){return db['UserVoiceQueueRt'][_0x53f1('0x28')]({'paused':0x0},{'where':{'UserId':_0x37879c['id']},'individualHooks':!![]});})[_0x53f1('0x14')](function(){return db[_0x53f1('0xf9')][_0x53f1('0x33')]({'where':{'channel':_0x544b8c[_0x53f1('0x5d')][_0x53f1('0xb0')],'membername':_0x37879c['name'],'type':_0x53f1('0xff'),'exitAt':null}});})[_0x53f1('0x14')](function(_0x567c02){if(_0x567c02){return _0x567c02['update']({'exitAt':moment()[_0x53f1('0xab')](_0x53f1('0xfb')),'data2':_0x53f1('0x10e')},{'individualHooks':!![]});}return null;})[_0x53f1('0x14')](function(){return _0x37879c[_0x53f1('0x28')]({'voicePause':![]});});case _0x53f1('0x5c'):case _0x53f1('0xbe'):case _0x53f1('0x4f'):case'sms':case _0x53f1('0x5b'):case'openchannel':return db['MemberReport']['find']({'where':{'channel':_0x544b8c[_0x53f1('0x5d')][_0x53f1('0xb0')],'membername':_0x37879c['name'],'type':_0x53f1('0xff'),'exitAt':null}})[_0x53f1('0x14')](function(_0x598c38){if(_0x598c38){return _0x598c38['update']({'exitAt':moment()['format'](_0x53f1('0xfb')),'data2':_0x53f1('0x10e')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x14d84d={};_[_0x53f1('0x26')](_0x14d84d,util['format'](_0x53f1('0x10f'),_0x544b8c['body'][_0x53f1('0xb0')],_0x53f1('0x110')),![]);return _0x37879c[_0x53f1('0x28')](_0x14d84d);});default:return respondWithRpcPromise(_0x53f1('0x104'),_0x53f1('0x107'),{'id':_0x37879c['id'],'name':_0x37879c['name'],'pause':![]})[_0x53f1('0x14')](function(){return db['UserVoiceQueueRt'][_0x53f1('0x28')]({'paused':0x0},{'where':{'UserId':_0x37879c['id']}});})[_0x53f1('0x14')](function(){return db[_0x53f1('0xf9')][_0x53f1('0x4a')]({'where':{'membername':_0x37879c[_0x53f1('0x35')],'type':_0x53f1('0xff'),'exitAt':null}});})['then'](function(_0x48ce57){var _0x24b803=[];_0x48ce57[_0x53f1('0xfa')](function(_0xa68881){_0x24b803['push'](_0xa68881[_0x53f1('0x28')]({'exitAt':moment()[_0x53f1('0xab')](_0x53f1('0xfb')),'data2':_0x53f1('0x10e')}));});return BPromise[_0x53f1('0x51')](_0x24b803);})[_0x53f1('0x14')](function(){return _0x37879c[_0x53f1('0x28')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x53f1('0x14')](respondWithResult(_0x2885eb,null))[_0x53f1('0x1d')](handleError(_0x2885eb,null));};exports[_0x53f1('0x111')]=function(_0x1c8212,_0x2d5dc5){var _0x218b08={};var _0x3c60a9={};var _0x5d0e2a;var _0x484b72;return db['User'][_0x53f1('0xca')]({'where':{'id':_0x1c8212['params']['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x2d5dc5,null))[_0x53f1('0x14')](function(_0x3b9099){if(_0x3b9099){_0x5d0e2a=_0x3b9099;_0x3c60a9[_0x53f1('0x54')]=_['keys'](db['Team'][_0x53f1('0x39')]);_0x3c60a9['query']=_['keys'](_0x1c8212['query']);_0x3c60a9['filters']=_[_0x53f1('0x58')](_0x3c60a9['model'],_0x3c60a9[_0x53f1('0x41')]);_0x218b08[_0x53f1('0x47')]=_[_0x53f1('0x58')](_0x3c60a9[_0x53f1('0x54')],qs[_0x53f1('0xcc')](_0x1c8212[_0x53f1('0x41')]['fields']));_0x218b08['attributes']=_0x218b08[_0x53f1('0x47')][_0x53f1('0x4c')]?_0x218b08['attributes']:_0x3c60a9[_0x53f1('0x54')];_0x218b08[_0x53f1('0xcd')]=qs['sort'](_0x1c8212[_0x53f1('0x41')][_0x53f1('0xce')]);_0x218b08[_0x53f1('0x40')]=qs['filters'](_[_0x53f1('0xcf')](_0x1c8212[_0x53f1('0x41')],_0x3c60a9[_0x53f1('0x57')]));if(_0x1c8212[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x218b08[_0x53f1('0x40')]=_[_0x53f1('0x59')](_0x218b08[_0x53f1('0x40')],{'$or':_['map'](_0x218b08[_0x53f1('0x47')],function(_0xb8a261){var _0x9d66bf={};_0x9d66bf[_0xb8a261]={'$like':'%'+_0x1c8212[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x9d66bf;})});}_0x218b08=_[_0x53f1('0x59')]({},_0x218b08,_0x1c8212['options']);return _0x5d0e2a[_0x53f1('0x111')](_0x218b08);}})[_0x53f1('0x14')](function(_0x2c2706){if(_0x2c2706){_0x484b72=_0x2c2706['length'];if(!_0x1c8212['query'][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x218b08[_0x53f1('0x23')]=qs['limit'](_0x1c8212[_0x53f1('0x41')]['limit']);_0x218b08[_0x53f1('0x24')]=qs[_0x53f1('0x24')](_0x1c8212[_0x53f1('0x41')][_0x53f1('0x24')]);}return _0x5d0e2a[_0x53f1('0x111')](_0x218b08);}})[_0x53f1('0x14')](function(_0xf781fd){if(_0xf781fd){return _0xf781fd?{'count':_0x484b72,'rows':_0xf781fd}:null;}})[_0x53f1('0x14')](respondWithResult(_0x2d5dc5,null))[_0x53f1('0x1d')](handleError(_0x2d5dc5,null));};exports['addTeams']=function(_0x447c9f,_0x1f454d){return db[_0x53f1('0x49')][_0x53f1('0x33')]({'where':{'id':_0x447c9f[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x1f454d,null))['then'](function(_0x33b058){if(_0x33b058){var _0x481950=_0x33b058['get']({'plain':!![]});return _0x33b058[_0x53f1('0x112')](_0x447c9f[_0x53f1('0x5d')]['ids'],_[_0x53f1('0x113')](_0x447c9f[_0x53f1('0x5d')],[_0x53f1('0x60'),'id'])||{})[_0x53f1('0x14')](function(){for(var _0x282198=0x0;_0x282198<_0x447c9f[_0x53f1('0x5d')][_0x53f1('0x60')]['length'];_0x282198++){var _0x634497=[];var _0x475697={};db[_0x53f1('0x114')][_0x53f1('0xca')]({'where':{'id':_0x447c9f[_0x53f1('0x5d')][_0x53f1('0x60')][_0x282198]}})[_0x53f1('0x14')](function(_0x126613){_0x475697=_0x126613['dataValues'];_0x634497[_0x53f1('0x48')](_0x126613[_0x53f1('0x115')]()[_0x53f1('0x14')](function(_0x5eb8a9){for(var _0x52765c=0x0;_0x52765c<_0x5eb8a9['length'];_0x52765c++){_0x5eb8a9[_0x52765c]['setDataValue'](_0x53f1('0xb0'),_0x53f1('0x116'));}return _0x5eb8a9;}));_0x634497[_0x53f1('0x48')](_0x126613[_0x53f1('0x117')]()[_0x53f1('0x14')](function(_0xbae364){for(var _0x4cd1d0=0x0;_0x4cd1d0<_0xbae364[_0x53f1('0x4c')];_0x4cd1d0++){_0xbae364[_0x4cd1d0][_0x53f1('0x118')]('channel','Chat');}return _0xbae364;}));_0x634497[_0x53f1('0x48')](_0x126613['getMailQueues']()[_0x53f1('0x14')](function(_0x57aa3a){for(var _0x118fb7=0x0;_0x118fb7<_0x57aa3a[_0x53f1('0x4c')];_0x118fb7++){_0x57aa3a[_0x118fb7][_0x53f1('0x118')]('channel','Mail');}return _0x57aa3a;}));_0x634497[_0x53f1('0x48')](_0x126613[_0x53f1('0x119')]()[_0x53f1('0x14')](function(_0x156f11){for(var _0x486a04=0x0;_0x486a04<_0x156f11[_0x53f1('0x4c')];_0x486a04++){_0x156f11[_0x486a04][_0x53f1('0x118')](_0x53f1('0xb0'),'Sms');}return _0x156f11;}));_0x634497['push'](_0x126613[_0x53f1('0x11a')]()[_0x53f1('0x14')](function(_0x4bb306){for(var _0x4a4f27=0x0;_0x4a4f27<_0x4bb306[_0x53f1('0x4c')];_0x4a4f27++){_0x4bb306[_0x4a4f27][_0x53f1('0x118')](_0x53f1('0xb0'),_0x53f1('0x11b'));}return _0x4bb306;}));_0x634497[_0x53f1('0x48')](_0x126613[_0x53f1('0x11c')]()[_0x53f1('0x14')](function(_0x3821ac){for(var _0x425330=0x0;_0x425330<_0x3821ac[_0x53f1('0x4c')];_0x425330++){_0x3821ac[_0x425330][_0x53f1('0x118')](_0x53f1('0xb0'),_0x53f1('0x11d'));}return _0x3821ac;}));_0x634497['push'](_0x126613[_0x53f1('0x11e')]()[_0x53f1('0x14')](function(_0x127e9a){for(var _0x454ba4=0x0;_0x454ba4<_0x127e9a[_0x53f1('0x4c')];_0x454ba4++){_0x127e9a[_0x454ba4]['setDataValue'](_0x53f1('0xb0'),'Openchannel');}return _0x127e9a;}));return BPromise['all'](_0x634497);})['then'](function(_0x10313f){var _0x52d880=_[_0x53f1('0x11f')](_0x10313f);_0x634497=[];return db['sequelize'][_0x53f1('0x120')](function(_0x3084fe){for(var _0x3a58aa=0x0;_0x3a58aa<_0x52d880['length'];_0x3a58aa++){_0x634497[_0x53f1('0x48')](_0x52d880[_0x3a58aa][_0x53f1('0x121')](_0x481950['id']),{'transaction':_0x3084fe});}return BPromise[_0x53f1('0x51')](_0x634497)[_0x53f1('0x14')](function(){if(_0x481950[_0x53f1('0x9e')]){return BPromise[_0x53f1('0x8a')](_['filter'](_0x52d880,function(_0x3ea682){return _0x3ea682['getDataValue'](_0x53f1('0xb0'))==='Voice';}),function(_0x233ad9){return db[_0x53f1('0xad')][_0x53f1('0xae')]({'membername':_0x481950['name'],'UserId':_0x481950['id'],'queue_name':_0x233ad9[_0x53f1('0x35')],'VoiceQueueId':_0x233ad9['id'],'interface':_[_0x53f1('0x67')](_0x481950[_0x53f1('0xa0')])?util[_0x53f1('0xab')](_0x53f1('0xac'),_0x481950[_0x53f1('0x35')]):_0x481950[_0x53f1('0xa0')],'paused':_0x481950[_0x53f1('0x9f')]||![],'penalty':_0x481950['penalty']},{'transaction':_0x3084fe});});}else{return;}})['then'](function(){for(var _0x5a66c5=0x0;_0x5a66c5<_0x52d880[_0x53f1('0x4c')];_0x5a66c5++){var _0x193ad3=_0x52d880[_0x5a66c5][_0x53f1('0x122')](_0x53f1('0xb0'));var _0x184359=_0x193ad3+_0x53f1('0xa8');socket[_0x53f1('0xb2')]('user'+_0x193ad3+_0x53f1('0x123'),{'UserId':_0x481950['id'],['queueField']:_0x52d880[_0x5a66c5]['id']});}});});})['then'](function(){db['TeamVoicePrefix'][_0x53f1('0xca')]({'where':{'teamId':_0x475697['id']}})[_0x53f1('0x14')](function(_0x40a6b5){if(_0x40a6b5){db['UserVoicePrefix'][_0x53f1('0x79')]({'UserId':_0x447c9f[_0x53f1('0x53')]['id'],'VoicePrefixId':_0x40a6b5[_0x53f1('0x124')]});}});});}});}})[_0x53f1('0x14')](respondWithStatusCode(_0x1f454d,null))[_0x53f1('0x1d')](handleError(_0x1f454d,null));};exports['removeTeams']=function(_0x352047,_0x454cfa){return db['User']['findOne']({'where':{'id':_0x352047['params']['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x454cfa,null))['then'](function(_0x96c6e5){if(_0x96c6e5){var _0x39afe5=_0x96c6e5[_0x53f1('0x2a')]({'plain':!![]});var _0x2928b3=_0x352047['query']['ids'];return _0x96c6e5['removeTeams'](_0x2928b3)[_0x53f1('0x14')](function(){for(var _0x49e855=0x0;_0x49e855<_0x2928b3['length'];_0x49e855++){var _0xd8e972=[];var _0x5ceb83={};db[_0x53f1('0x114')][_0x53f1('0xca')]({'where':{'id':_0x2928b3[_0x49e855]}})['then'](function(_0x3f974e){_0x5ceb83=_0x3f974e[_0x53f1('0x4d')];_0xd8e972[_0x53f1('0x48')](_0x3f974e[_0x53f1('0x115')]()['then'](function(_0x26d3d3){for(var _0x54ef5a=0x0;_0x54ef5a<_0x26d3d3[_0x53f1('0x4c')];_0x54ef5a++){_0x26d3d3[_0x54ef5a][_0x53f1('0x118')]('channel',_0x53f1('0x116'));}return _0x26d3d3;}));_0xd8e972[_0x53f1('0x48')](_0x3f974e[_0x53f1('0x117')]()[_0x53f1('0x14')](function(_0x45a9b8){for(var _0x329365=0x0;_0x329365<_0x45a9b8[_0x53f1('0x4c')];_0x329365++){_0x45a9b8[_0x329365][_0x53f1('0x118')]('channel',_0x53f1('0x125'));}return _0x45a9b8;}));_0xd8e972[_0x53f1('0x48')](_0x3f974e['getMailQueues']()[_0x53f1('0x14')](function(_0x8a064e){for(var _0x5e5b40=0x0;_0x5e5b40<_0x8a064e['length'];_0x5e5b40++){_0x8a064e[_0x5e5b40][_0x53f1('0x118')](_0x53f1('0xb0'),_0x53f1('0x126'));}return _0x8a064e;}));_0xd8e972[_0x53f1('0x48')](_0x3f974e['getSmsQueues']()['then'](function(_0x52cd06){for(var _0x313cae=0x0;_0x313cae<_0x52cd06[_0x53f1('0x4c')];_0x313cae++){_0x52cd06[_0x313cae][_0x53f1('0x118')](_0x53f1('0xb0'),_0x53f1('0x127'));}return _0x52cd06;}));_0xd8e972['push'](_0x3f974e[_0x53f1('0x11a')]()[_0x53f1('0x14')](function(_0x52de27){for(var _0x2581d4=0x0;_0x2581d4<_0x52de27[_0x53f1('0x4c')];_0x2581d4++){_0x52de27[_0x2581d4][_0x53f1('0x118')](_0x53f1('0xb0'),_0x53f1('0x11b'));}return _0x52de27;}));_0xd8e972['push'](_0x3f974e['getFaxQueues']()['then'](function(_0x3063e1){for(var _0x38ace2=0x0;_0x38ace2<_0x3063e1[_0x53f1('0x4c')];_0x38ace2++){_0x3063e1[_0x38ace2]['setDataValue'](_0x53f1('0xb0'),_0x53f1('0x11d'));}return _0x3063e1;}));_0xd8e972['push'](_0x3f974e['getOpenchannelQueues']()[_0x53f1('0x14')](function(_0x5d832f){for(var _0xbc5fed=0x0;_0xbc5fed<_0x5d832f[_0x53f1('0x4c')];_0xbc5fed++){_0x5d832f[_0xbc5fed]['setDataValue'](_0x53f1('0xb0'),_0x53f1('0x128'));}return _0x5d832f;}));return BPromise[_0x53f1('0x51')](_0xd8e972);})[_0x53f1('0x14')](function(_0x5a690e){var _0xb302f6=_[_0x53f1('0x11f')](_0x5a690e);_0xd8e972=[];return db[_0x53f1('0x68')]['transaction'](function(_0xc35347){for(var _0x3262ce=0x0;_0x3262ce<_0xb302f6[_0x53f1('0x4c')];_0x3262ce++){_0xd8e972[_0x53f1('0x48')](_0xb302f6[_0x3262ce]['removeAgent'](_0x39afe5['id']),{'transaction':_0xc35347});}return BPromise[_0x53f1('0x51')](_0xd8e972)[_0x53f1('0x14')](function(){if(_0x39afe5[_0x53f1('0x9e')]){return BPromise[_0x53f1('0x8a')](_['filter'](_0xb302f6,function(_0x2dfd3c){return _0x2dfd3c[_0x53f1('0x122')]('channel')===_0x53f1('0x116');}),function(_0x55225d){return db[_0x53f1('0xad')][_0x53f1('0x29')]({'where':{'VoiceQueueId':_0x55225d['id'],'UserId':_0x39afe5['id']},'transaction':_0xc35347});});}else{return;}})['then'](function(){db[_0x53f1('0x129')][_0x53f1('0xca')]({'where':{'teamId':_0x5ceb83['id']}})[_0x53f1('0x14')](function(_0x56d32b){if(_0x56d32b){return db[_0x53f1('0x12a')][_0x53f1('0x29')]({'where':{'UserId':_0x39afe5['id'],'VoicePrefixId':_0x56d32b[_0x53f1('0x4d')][_0x53f1('0x124')]}});}});})[_0x53f1('0x14')](function(){for(var _0x143375=0x0;_0x143375<_0xb302f6[_0x53f1('0x4c')];_0x143375++){var _0x24a2eb=_0xb302f6[_0x143375][_0x53f1('0x122')](_0x53f1('0xb0'));var _0x55b42c=_0x24a2eb+_0x53f1('0xa8');socket[_0x53f1('0xb2')]('user'+_0x24a2eb+_0x53f1('0xb3'),{'UserId':_0x39afe5['id'],['queueField']:_0xb302f6[_0x143375]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x454cfa,null))[_0x53f1('0x1d')](handleError(_0x454cfa,null));};exports[_0x53f1('0x12b')]=function(_0x1bc542,_0x571ad2){var _0x15322f={};var _0x9ac3a={};var _0x2dfde6;var _0x44166e;return db[_0x53f1('0x49')][_0x53f1('0xca')]({'where':{'id':_0x1bc542['params']['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x571ad2,null))[_0x53f1('0x14')](function(_0xfc50b6){if(_0xfc50b6){_0x2dfde6=_0xfc50b6;_0x9ac3a['model']=_[_0x53f1('0x56')](db['CmList'][_0x53f1('0x39')]);_0x9ac3a['query']=_[_0x53f1('0x56')](_0x1bc542[_0x53f1('0x41')]);_0x9ac3a[_0x53f1('0x57')]=_[_0x53f1('0x58')](_0x9ac3a[_0x53f1('0x54')],_0x9ac3a[_0x53f1('0x41')]);_0x15322f[_0x53f1('0x47')]=_[_0x53f1('0x58')](_0x9ac3a['model'],qs[_0x53f1('0xcc')](_0x1bc542['query'][_0x53f1('0xcc')]));_0x15322f['attributes']=_0x15322f['attributes'][_0x53f1('0x4c')]?_0x15322f['attributes']:_0x9ac3a[_0x53f1('0x54')];_0x15322f[_0x53f1('0xcd')]=qs['sort'](_0x1bc542['query'][_0x53f1('0xce')]);_0x15322f[_0x53f1('0x40')]=qs[_0x53f1('0x57')](_['pick'](_0x1bc542['query'],_0x9ac3a['filters']));if(_0x1bc542[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x15322f[_0x53f1('0x40')]=_[_0x53f1('0x59')](_0x15322f[_0x53f1('0x40')],{'$or':_['map'](_0x15322f[_0x53f1('0x47')],function(_0x11af17){var _0x16a5f8={};_0x16a5f8[_0x11af17]={'$like':'%'+_0x1bc542[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x16a5f8;})});}_0x15322f=_['merge']({},_0x15322f,_0x1bc542[_0x53f1('0xd0')]);return _0x2dfde6[_0x53f1('0x12b')](_0x15322f);}})[_0x53f1('0x14')](function(_0x237be6){if(_0x237be6){_0x44166e=_0x237be6[_0x53f1('0x4c')];if(!_0x1bc542[_0x53f1('0x41')][_0x53f1('0xd1')](_0x53f1('0xd6'))){_0x15322f['limit']=qs[_0x53f1('0x23')](_0x1bc542[_0x53f1('0x41')][_0x53f1('0x23')]);_0x15322f['offset']=qs[_0x53f1('0x24')](_0x1bc542[_0x53f1('0x41')]['offset']);}return _0x2dfde6[_0x53f1('0x12b')](_0x15322f);}})[_0x53f1('0x14')](function(_0x30a205){if(_0x30a205){return _0x30a205?{'count':_0x44166e,'rows':_0x30a205}:null;}})[_0x53f1('0x14')](respondWithResult(_0x571ad2,null))[_0x53f1('0x1d')](handleError(_0x571ad2,null));};exports[_0x53f1('0x12c')]=function(_0x1f41f3,_0x48b4e6){var _0x5277eb={};var _0x50eb98={};var _0xb372e9;return db[_0x53f1('0x49')][_0x53f1('0xca')]({'where':{'id':_0x1f41f3[_0x53f1('0x53')]['id']}})[_0x53f1('0x14')](handleEntityNotFound(_0x48b4e6,null))['then'](function(_0x31a40a){if(_0x31a40a){_0xb372e9=_0x31a40a;_0x50eb98[_0x53f1('0x54')]=_[_0x53f1('0x56')](db[_0x53f1('0x49')][_0x53f1('0x39')]);_0x50eb98[_0x53f1('0x41')]=_[_0x53f1('0x56')](_0x1f41f3['query']);_0x50eb98[_0x53f1('0x57')]=_['intersection'](_0x50eb98[_0x53f1('0x54')],_0x50eb98['query']);_0x5277eb['attributes']=_[_0x53f1('0x58')](_0x50eb98[_0x53f1('0x54')],qs[_0x53f1('0xcc')](_0x1f41f3['query'][_0x53f1('0xcc')]));_0x5277eb[_0x53f1('0x47')]=_0x5277eb[_0x53f1('0x47')][_0x53f1('0x4c')]?_0x5277eb[_0x53f1('0x47')]:_0x50eb98[_0x53f1('0x54')];_0x5277eb[_0x53f1('0xcd')]=qs[_0x53f1('0xce')](_0x1f41f3[_0x53f1('0x41')][_0x53f1('0xce')]);_0x5277eb[_0x53f1('0x40')]=qs[_0x53f1('0x57')](_[_0x53f1('0xcf')](_0x1f41f3[_0x53f1('0x41')],_0x50eb98[_0x53f1('0x57')]));if(_0x1f41f3[_0x53f1('0x41')][_0x53f1('0x2e')]){_0x5277eb[_0x53f1('0x40')]=_[_0x53f1('0x59')](_0x5277eb[_0x53f1('0x40')],{'$or':_[_0x53f1('0x30')](_0x5277eb[_0x53f1('0x47')],function(_0x39e5b1){var _0x54c5dc={};_0x54c5dc[_0x39e5b1]={'$like':'%'+_0x1f41f3[_0x53f1('0x41')][_0x53f1('0x2e')]+'%'};return _0x54c5dc;})});}_0x5277eb[_0x53f1('0x54')]=db['User'];_0x5277eb['as']=_0x53f1('0x82');_0x5277eb=_['merge']({},_0x5277eb,_0x1f41f3[_0x53f1('0xd0')]);return _0xb372e9[_0x53f1('0x115')]({'include':[_0x5277eb]});}})[_0x53f1('0x14')](function(_0x1fbdf3){if(_0x1fbdf3){var _0x3448e2={},_0x7c61=[];for(var _0x11963d=0x0;_0x11963d<_0x1fbdf3[_0x53f1('0x4c')];_0x11963d+=0x1){for(var _0x3e85b3=0x0,_0x34753d;_0x3e85b3<_0x1fbdf3[_0x11963d][_0x53f1('0x82')]['length'];_0x3e85b3+=0x1){_0x34753d=_0x1fbdf3[_0x11963d][_0x53f1('0x82')][_0x3e85b3]['get']({'plain':!![]});_0x3448e2[_0x34753d['id']]=_0x34753d;}}_0x3448e2=_[_0x53f1('0x12d')](_0x3448e2);for(var _0x58b940=qs[_0x53f1('0x24')](_0x1f41f3[_0x53f1('0x41')]['offset']);_0x58b940<_0x3448e2['length']&&_0x7c61['length']=_0x36e87c[_0xf637('0x57')]){throw new Error(_0xf637('0x58'));}})[_0xf637('0x21')](function(){if(_0x45893b){return db[_0xf637('0x2a')]['destroy']({'where':{'membername':_0x45893b['name']},'individualHooks':!![]});}})[_0xf637('0x21')](function(){if(_0x45893b){return _0x45893b['getVoiceQueues']({'raw':!![]});}})[_0xf637('0x21')](function(_0x11ed30){if(_0x45893b){if(_0x11ed30){var _0x1dd7b1=[];_0x354905=_0x11ed30;if(_0x354905[_0xf637('0x2e')]){for(var _0x22e06f=0x0;_0x22e06f<_0x354905[_0xf637('0x2e')];_0x22e06f++){_0x1dd7b1['push'](db[_0xf637('0x2a')][_0xf637('0x59')]({'membername':_0x45893b['name'],'UserId':_0x45893b['id'],'queue_name':_0x354905[_0x22e06f]['name'],'VoiceQueueId':_0x354905[_0x22e06f]['id'],'interface':_0x46ba38,'paused':_0x45893b['loginInPause']||![],'penalty':_0x354905[_0x22e06f][_0xf637('0x5a')]||0x0}));}return BPromise[_0xf637('0x4e')](_0x1dd7b1);}}}})[_0xf637('0x21')](function(){if(_0x45893b){return db[_0xf637('0x2c')][_0xf637('0x19')]({'where':{'membername':_0x45893b['name'],'exitAt':null}});}})['then'](function(_0x6be900){if(_0x45893b){if(_0x6be900&&_0x6be900[_0xf637('0x2e')]){var _0x3c6908=[];_0x6be900['forEach'](function(_0x1d6fa2){_0x3c6908['push'](_0x1d6fa2[_0xf637('0x2b')]({'exitAt':moment()[_0xf637('0x2f')](_0xf637('0x37'))}));});return BPromise[_0xf637('0x4e')](_0x3c6908);}}})['then'](function(_0x29b538){if(_0x45893b){var _0x3e88aa=[];var _0x1e7fd9=[];var _0x2dfb4c=utils[_0xf637('0x31')]();var _0x51d3a1={'membername':_0x45893b['name'],'interface':_0x46ba38,'enterAt':moment()['format'](_0xf637('0x37')),'role':_0x45893b[_0xf637('0x29')],'internal':_0x45893b[_0xf637('0x3a')]};_0x2dfb4c[_0xf637('0x32')](function(_0x28cc8c){_0x3e88aa[_0xf637('0x33')](_['merge']({'channel':_0x28cc8c,'type':'LOGIN','data1':_0xf637('0x5b'),'data2':_0x46ba38},_0x51d3a1));if(_0x45893b['loginInPause']){_0x1e7fd9['push'](_[_0xf637('0x5c')]({'channel':_0x28cc8c,'type':_0xf637('0x2d'),'data1':'LOGININPAUSE'},_0x51d3a1));}});return db['MemberReport'][_0xf637('0x3c')](_0x3e88aa[_0xf637('0x5d')](_0x1e7fd9),{'individualHooks':!![]});}})[_0xf637('0x21')](function(){if(_0x45893b){return _0x45893b[_0xf637('0x2b')]({'online':!![],'lastLoginAt':moment()['format'](_0xf637('0x37')),'voicePause':_0x45893b[_0xf637('0x52')]||![],'mailPause':_0x45893b[_0xf637('0x52')]||![],'chatPause':_0x45893b['loginInPause']||![],'faxPause':_0x45893b[_0xf637('0x52')]||![],'smsPause':_0x45893b[_0xf637('0x52')]||![],'openchannelPause':_0x45893b[_0xf637('0x52')]||![],'pauseType':_0x45893b[_0xf637('0x52')]?_0xf637('0x5e'):null,'lastPauseAt':moment()['format'](_0xf637('0x37')),'interface':_0x46ba38});}})[_0xf637('0x21')](function(_0x281732){_0x534b9b(_0x281732);})['catch'](function(_0x3812fd){_0x50dec6(_0x6150ff[_0xf637('0x13')](0x1f4,_0x3812fd[_0xf637('0x15')]));});});}; \ No newline at end of file +var _0x5d58=['PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','fax','sms','whatsapp','set','%s%s','Pause','push','destroy','all','mobile','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetUser','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowUser','User','find','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport'];(function(_0x4d4ab7,_0x594b1f){var _0x130b32=function(_0x230ec7){while(--_0x230ec7){_0x4d4ab7['push'](_0x4d4ab7['shift']());}};_0x130b32(++_0x594b1f);}(_0x5d58,0x8b));var _0x85d5=function(_0x8c1d9f,_0x1b30ba){_0x8c1d9f=_0x8c1d9f-0x0;var _0xb055e0=_0x5d58[_0x8c1d9f];return _0xb055e0;};'use strict';var _=require(_0x85d5('0x0'));var util=require(_0x85d5('0x1'));var moment=require(_0x85d5('0x2'));var BPromise=require(_0x85d5('0x3'));var rs=require(_0x85d5('0x4'));var fs=require('fs');var Redis=require(_0x85d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x85d5('0x6'));var logger=require(_0x85d5('0x7'))(_0x85d5('0x8'));var config=require(_0x85d5('0x9'));var jayson=require(_0x85d5('0xa'));var client=jayson[_0x85d5('0xb')][_0x85d5('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x85d5('0xd')],{'host':_0x85d5('0xe'),'port':0x18eb});var socket=require(_0x85d5('0xf'))(new Redis(config[_0x85d5('0xd')]));require(_0x85d5('0x10'))[_0x85d5('0x11')](socket);function respondWithRpcPromise(_0x21bed6,_0x4a6ae8,_0x17c4b1){return new BPromise(function(_0x294549,_0x23e138){return client[_0x85d5('0x12')](_0x21bed6,_0x17c4b1)[_0x85d5('0x13')](function(_0x2f515e){logger[_0x85d5('0x14')](_0x85d5('0x15'),_0x4a6ae8,_0x85d5('0x16'));logger[_0x85d5('0x17')](_0x85d5('0x18'),_0x4a6ae8,_0x85d5('0x16'),JSON['stringify'](_0x2f515e));if(_0x2f515e[_0x85d5('0x19')]){if(_0x2f515e['error'][_0x85d5('0x1a')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x4a6ae8,_0x2f515e[_0x85d5('0x19')][_0x85d5('0x1b')]);return _0x23e138(_0x2f515e[_0x85d5('0x19')][_0x85d5('0x1b')]);}logger['error'](_0x85d5('0x15'),_0x4a6ae8,_0x2f515e[_0x85d5('0x19')]['message']);return _0x294549(_0x2f515e[_0x85d5('0x19')][_0x85d5('0x1b')]);}else{logger['info'](_0x85d5('0x15'),_0x4a6ae8,_0x85d5('0x16'));_0x294549(_0x2f515e['result']['message']);}})[_0x85d5('0x1c')](function(_0x400d62){logger[_0x85d5('0x19')](_0x85d5('0x15'),_0x4a6ae8,_0x400d62);_0x23e138(_0x400d62);});});}exports[_0x85d5('0x1d')]=function(_0x33c54c){var _0x53066a=this;return new Promise(function(_0x28b340,_0x333bba){return db['User'][_0x85d5('0x1e')]({'raw':_0x33c54c[_0x85d5('0x1f')]?_0x33c54c[_0x85d5('0x1f')][_0x85d5('0x20')]===undefined?!![]:![]:!![],'where':_0x33c54c[_0x85d5('0x1f')]?_0x33c54c['options'][_0x85d5('0x21')]||null:null,'attributes':_0x33c54c[_0x85d5('0x1f')]?_0x33c54c[_0x85d5('0x1f')]['attributes']||null:null,'limit':_0x33c54c[_0x85d5('0x1f')]?_0x33c54c[_0x85d5('0x1f')][_0x85d5('0x22')]||null:null,'include':_0x33c54c[_0x85d5('0x1f')]?_0x33c54c[_0x85d5('0x1f')][_0x85d5('0x23')]?_[_0x85d5('0x24')](_0x33c54c['options'][_0x85d5('0x23')],function(_0x4f3f1e){return{'model':db[_0x4f3f1e[_0x85d5('0x25')]],'as':_0x4f3f1e['as'],'attributes':_0x4f3f1e['attributes'],'include':_0x4f3f1e[_0x85d5('0x23')]?_[_0x85d5('0x24')](_0x4f3f1e[_0x85d5('0x23')],function(_0x14286e){return{'model':db[_0x14286e[_0x85d5('0x25')]],'as':_0x14286e['as'],'attributes':_0x14286e['attributes'],'include':_0x14286e[_0x85d5('0x23')]?_['map'](_0x14286e['include'],function(_0x577b01){return{'model':db[_0x577b01[_0x85d5('0x25')]],'as':_0x577b01['as'],'attributes':_0x577b01[_0x85d5('0x26')]};}):[]};}):[]};}):[]:[]})[_0x85d5('0x13')](function(_0x49e5d7){logger[_0x85d5('0x14')]('GetUser',_0x33c54c);logger['debug'](_0x85d5('0x1d'),_0x33c54c,JSON[_0x85d5('0x27')](_0x49e5d7));_0x28b340(_0x49e5d7);})[_0x85d5('0x1c')](function(_0xf59d96){logger[_0x85d5('0x19')](_0x85d5('0x1d'),_0xf59d96[_0x85d5('0x1b')],_0x33c54c);_0x333bba(_0x53066a[_0x85d5('0x19')](0x1f4,_0xf59d96[_0x85d5('0x1b')]));});});};exports[_0x85d5('0x28')]=function(_0x5cefed){var _0x4ae99b=this;return new Promise(function(_0x32a260,_0x14ba9f){return db[_0x85d5('0x29')][_0x85d5('0x2a')]({'raw':_0x5cefed[_0x85d5('0x1f')]?_0x5cefed[_0x85d5('0x1f')][_0x85d5('0x20')]===undefined?!![]:![]:!![],'where':_0x5cefed[_0x85d5('0x1f')]?_0x5cefed['options'][_0x85d5('0x21')]||null:null,'attributes':_0x5cefed[_0x85d5('0x1f')]?_0x5cefed['options'][_0x85d5('0x26')]||null:null,'include':_0x5cefed['options']?_0x5cefed['options']['include']?_['map'](_0x5cefed[_0x85d5('0x1f')][_0x85d5('0x23')],function(_0x39eee7){return{'model':db[_0x39eee7['model']],'as':_0x39eee7['as'],'attributes':_0x39eee7[_0x85d5('0x26')],'include':_0x39eee7[_0x85d5('0x23')]?_[_0x85d5('0x24')](_0x39eee7[_0x85d5('0x23')],function(_0x58b364){return{'model':db[_0x58b364[_0x85d5('0x25')]],'as':_0x58b364['as'],'attributes':_0x58b364['attributes'],'include':_0x58b364[_0x85d5('0x23')]?_[_0x85d5('0x24')](_0x58b364['include'],function(_0x2ffcf1){return{'model':db[_0x2ffcf1['model']],'as':_0x2ffcf1['as'],'attributes':_0x2ffcf1[_0x85d5('0x26')]};}):[]};}):[]};}):[]:[]})[_0x85d5('0x13')](function(_0x385ddf){logger[_0x85d5('0x14')](_0x85d5('0x28'),_0x5cefed);logger['debug']('ShowUser',_0x5cefed,JSON[_0x85d5('0x27')](_0x385ddf));_0x32a260(_0x385ddf);})[_0x85d5('0x1c')](function(_0x34ea63){logger[_0x85d5('0x19')](_0x85d5('0x28'),_0x34ea63[_0x85d5('0x1b')],_0x5cefed);_0x14ba9f(_0x4ae99b[_0x85d5('0x19')](0x1f4,_0x34ea63[_0x85d5('0x1b')]));});});};exports[_0x85d5('0x2b')]=function(_0x5ceede){var _0x304bd6=this;return new Promise(function(_0x11463d,_0x5d9cc7){var _0xff8e16;return db[_0x85d5('0x29')][_0x85d5('0x2a')]({'where':_0x5ceede[_0x85d5('0x1f')]['where']||{},'attributes':['id',_0x85d5('0x2c'),_0x85d5('0x2d'),_0x85d5('0x2e'),_0x85d5('0x2f')]})[_0x85d5('0x13')](function(_0x2a4735){if(_0x2a4735){_0xff8e16=_0x2a4735;return db[_0x85d5('0x30')][_0x85d5('0x31')]({'paused':0x1},{'where':{'UserId':_0xff8e16['id']},'individualHooks':!![]});}})[_0x85d5('0x13')](function(){if(_0xff8e16){return db[_0x85d5('0x32')][_0x85d5('0x1e')]({'where':{'membername':_0xff8e16['name'],'type':_0x85d5('0x33'),'exitAt':null}});}})['then'](function(_0x3abb94){if(_0xff8e16){if(_0x3abb94&&_0x3abb94[_0x85d5('0x34')]){var _0x346e2a=moment()[_0x85d5('0x35')](_0x85d5('0x36'));for(var _0x21ff1f=0x0,_0x3f6384=_0x3abb94[_0x85d5('0x34')];_0x21ff1f<_0x3f6384;_0x21ff1f++){_0x3abb94[_0x21ff1f][_0x85d5('0x37')]({'exitAt':_0x346e2a});}}}})[_0x85d5('0x13')](function(){if(_0xff8e16){var _0x24b68b=[];var _0x249192=utils[_0x85d5('0x38')]();_0x249192[_0x85d5('0x39')](function(_0x3a3c55){_0x24b68b['push']({'channel':_0x3a3c55,'membername':_0xff8e16[_0x85d5('0x2c')],'interface':_['isNil'](_0xff8e16[_0x85d5('0x2f')])?util[_0x85d5('0x35')](_0x85d5('0x3a'),_0xff8e16[_0x85d5('0x2c')]):_0xff8e16[_0x85d5('0x2f')],'type':_0x85d5('0x33'),'enterAt':moment()['format'](_0x85d5('0x36')),'data1':_0x5ceede[_0x85d5('0x3b')][_0x85d5('0x3c')]||_0x85d5('0x3d'),'role':_0xff8e16[_0x85d5('0x2d')],'internal':_0xff8e16[_0x85d5('0x2e')],'uniqueid':_0x5ceede[_0x85d5('0x3b')][_0x85d5('0x3e')]||null});});return db['MemberReport'][_0x85d5('0x3f')](_0x24b68b,{'individualHooks':!![]});}})[_0x85d5('0x13')](function(){if(_0xff8e16){return _0xff8e16[_0x85d5('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5ceede[_0x85d5('0x3b')][_0x85d5('0x3c')]||_0x85d5('0x3d'),'lastPauseAt':moment()[_0x85d5('0x35')](_0x85d5('0x36'))});}})['then'](function(_0x29a391){_0x11463d(_0x29a391);})[_0x85d5('0x1c')](function(_0x455860){_0x5d9cc7(_0x304bd6[_0x85d5('0x19')](0x1f4,_0x455860['message']));});});};exports[_0x85d5('0x40')]=function(_0x4665d6){var _0x4b31b6=this;return new Promise(function(_0x3ce91f,_0x276d99){var _0x3bfe27;return db[_0x85d5('0x29')][_0x85d5('0x41')]({'where':_0x4665d6[_0x85d5('0x1f')][_0x85d5('0x21')]||{},'attributes':['id',_0x85d5('0x2c')]})[_0x85d5('0x13')](function(_0x3f932d){if(_0x3f932d){_0x3bfe27=_0x3f932d;if(_0x4665d6[_0x85d5('0x3b')][_0x85d5('0x42')]&&!utils[_0x85d5('0x43')](_0x4665d6[_0x85d5('0x3b')][_0x85d5('0x42')])){throw new Error(_0x85d5('0x44'));}switch(_0x4665d6[_0x85d5('0x3b')][_0x85d5('0x42')]){case _0x85d5('0x45'):return db[_0x85d5('0x30')][_0x85d5('0x31')]({'paused':0x0},{'where':{'UserId':_0x3bfe27['id']}})['then'](function(){return db[_0x85d5('0x32')]['find']({'where':{'channel':_0x4665d6[_0x85d5('0x3b')][_0x85d5('0x42')],'membername':_0x3bfe27[_0x85d5('0x2c')],'type':_0x85d5('0x33'),'exitAt':null}});})[_0x85d5('0x13')](function(_0x2d2b03){if(_0x2d2b03){return _0x2d2b03['update']({'exitAt':moment()[_0x85d5('0x35')](_0x85d5('0x36')),'data2':_0x85d5('0x46')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3bfe27[_0x85d5('0x31')]({'voicePause':![]});});case _0x85d5('0x47'):case _0x85d5('0x48'):case _0x85d5('0x49'):case _0x85d5('0x4a'):case'openchannel':case _0x85d5('0x4b'):return db['MemberReport']['find']({'where':{'channel':_0x4665d6['body'][_0x85d5('0x42')],'membername':_0x3bfe27[_0x85d5('0x2c')],'type':'PAUSE','exitAt':null}})[_0x85d5('0x13')](function(_0x223cb4){return _0x223cb4[_0x85d5('0x31')]({'exitAt':moment()[_0x85d5('0x35')](_0x85d5('0x36')),'data2':'system'},{'individualHooks':!![]});})[_0x85d5('0x13')](function(){var _0x1ab4a0={};_[_0x85d5('0x4c')](_0x1ab4a0,util[_0x85d5('0x35')](_0x85d5('0x4d'),_0x4665d6[_0x85d5('0x3b')][_0x85d5('0x42')],_0x85d5('0x4e')),![]);return _0x3bfe27['update'](_0x1ab4a0);});default:return db[_0x85d5('0x30')][_0x85d5('0x31')]({'paused':0x0},{'where':{'UserId':_0x3bfe27['id']}})['then'](function(){return db[_0x85d5('0x32')]['findAll']({'where':{'membername':_0x3bfe27['name'],'type':_0x85d5('0x33'),'exitAt':null}});})['then'](function(_0x39dcc9){var _0x151acd=[];_0x39dcc9[_0x85d5('0x39')](function(_0x4e6c77){_0x151acd[_0x85d5('0x4f')](_0x4e6c77[_0x85d5('0x31')]({'exitAt':moment()[_0x85d5('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x85d5('0x46')}));});return BPromise['all'](_0x151acd);})[_0x85d5('0x13')](function(){return _0x3bfe27[_0x85d5('0x31')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x85d5('0x13')](function(_0x15b5a5){_0x3ce91f(_0x15b5a5);})[_0x85d5('0x1c')](function(_0x12ab4a){_0x276d99(_0x4b31b6['error'](0x1f4,_0x12ab4a[_0x85d5('0x1b')]));});});};exports['LogoutUser']=function(_0x26e671){var _0x5c9cec=this;return new Promise(function(_0x218dd5,_0x2daf53){var _0x2f668f;return db[_0x85d5('0x29')]['findOne']({'where':_0x26e671[_0x85d5('0x1f')][_0x85d5('0x21')]||{},'attributes':['id','name']})[_0x85d5('0x13')](function(_0x2d24d5){if(_0x2d24d5){_0x2f668f=_0x2d24d5;return db['UserVoiceQueueRt'][_0x85d5('0x50')]({'where':{'membername':_0x2f668f[_0x85d5('0x2c')]},'individualHooks':!![]});}})[_0x85d5('0x13')](function(){if(_0x2f668f){return db[_0x85d5('0x32')][_0x85d5('0x1e')]({'where':{'membername':_0x2f668f[_0x85d5('0x2c')],'exitAt':null}});}})[_0x85d5('0x13')](function(_0x49bbc0){if(_0x2f668f){if(_0x49bbc0&&_0x49bbc0['length']){var _0x310460=[];_0x49bbc0[_0x85d5('0x39')](function(_0x2cd199){_0x310460[_0x85d5('0x4f')](_0x2cd199[_0x85d5('0x31')]({'exitAt':moment()[_0x85d5('0x35')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x85d5('0x51')](_0x310460);}}})[_0x85d5('0x13')](function(){if(_0x2f668f){return _0x2f668f[_0x85d5('0x31')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x85d5('0x13')](function(_0x56ec7d){_0x218dd5(_0x56ec7d);})[_0x85d5('0x1c')](function(_0x42763b){_0x2daf53(_0x5c9cec['error'](0x1f4,_0x42763b[_0x85d5('0x1b')]));});});};exports['LoginUser']=function(_0x1f717b){var _0x557477=this;return new Promise(function(_0x158e6b,_0x21ba89){var _0x782cec;var _0x5628f9;var _0x2c2f8f;var _0x311c09;return db[_0x85d5('0x29')]['findOne']({'where':_0x1f717b['options']['where']||{},'attributes':['id',_0x85d5('0x2c'),_0x85d5('0x2d'),_0x85d5('0x52'),'phone',_0x85d5('0x2e'),_0x85d5('0x53'),'interface']})[_0x85d5('0x13')](function(_0x45585c){if(_0x45585c){_0x782cec=_0x45585c;_0x311c09=_0x1f717b[_0x85d5('0x3b')][_0x85d5('0x2f')]?_0x1f717b[_0x85d5('0x3b')][_0x85d5('0x2f')]:util['format']('SIP/%s',_0x782cec['name']);return db[_0x85d5('0x29')][_0x85d5('0x54')]({'where':{'role':_0x85d5('0x55'),'online':!![],'id':{'$ne':_0x782cec['id']}}});}})[_0x85d5('0x13')](function(_0x1d44a9){if(_0x1d44a9){_0x2c2f8f=_0x1d44a9;return require(_0x85d5('0x56'))[_0x85d5('0x57')]();}})[_0x85d5('0x13')](function(_0x23a807){if(_0x23a807&&_0x23a807[_0x85d5('0x58')]&&_0x2c2f8f>=_0x23a807['agents']){throw new Error(_0x85d5('0x59'));}})['then'](function(){if(_0x782cec){return db[_0x85d5('0x30')]['destroy']({'where':{'membername':_0x782cec['name']},'individualHooks':!![]});}})[_0x85d5('0x13')](function(){if(_0x782cec){return _0x782cec[_0x85d5('0x5a')]({'raw':!![]});}})[_0x85d5('0x13')](function(_0x514da6){if(_0x782cec){if(_0x514da6){var _0x586368=[];_0x5628f9=_0x514da6;if(_0x5628f9['length']){for(var _0x5889b9=0x0;_0x5889b9<_0x5628f9[_0x85d5('0x34')];_0x5889b9++){_0x586368['push'](db['UserVoiceQueueRt'][_0x85d5('0x5b')]({'membername':_0x782cec[_0x85d5('0x2c')],'UserId':_0x782cec['id'],'queue_name':_0x5628f9[_0x5889b9][_0x85d5('0x2c')],'VoiceQueueId':_0x5628f9[_0x5889b9]['id'],'interface':_0x311c09,'paused':_0x782cec['loginInPause']||![],'penalty':_0x5628f9[_0x5889b9][_0x85d5('0x5c')]||0x0}));}return BPromise[_0x85d5('0x51')](_0x586368);}}}})[_0x85d5('0x13')](function(){if(_0x782cec){return db[_0x85d5('0x32')][_0x85d5('0x1e')]({'where':{'membername':_0x782cec['name'],'exitAt':null}});}})[_0x85d5('0x13')](function(_0x432157){if(_0x782cec){if(_0x432157&&_0x432157[_0x85d5('0x34')]){var _0x17c921=[];_0x432157[_0x85d5('0x39')](function(_0x5cc341){_0x17c921['push'](_0x5cc341[_0x85d5('0x31')]({'exitAt':moment()[_0x85d5('0x35')](_0x85d5('0x36'))}));});return BPromise[_0x85d5('0x51')](_0x17c921);}}})[_0x85d5('0x13')](function(_0x210737){if(_0x782cec){var _0x4374c4=[];var _0x542453=[];var _0x132346=utils['getChannels']();var _0xf4f080={'membername':_0x782cec[_0x85d5('0x2c')],'interface':_0x311c09,'enterAt':moment()[_0x85d5('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x782cec[_0x85d5('0x2d')],'internal':_0x782cec[_0x85d5('0x2e')]};_0x132346[_0x85d5('0x39')](function(_0x1ac9b3){_0x4374c4[_0x85d5('0x4f')](_['merge']({'channel':_0x1ac9b3,'type':'LOGIN','data1':'callysquare','data2':_0x311c09},_0xf4f080));if(_0x782cec[_0x85d5('0x53')]){_0x542453[_0x85d5('0x4f')](_['merge']({'channel':_0x1ac9b3,'type':_0x85d5('0x33'),'data1':_0x85d5('0x5d')},_0xf4f080));}});return db[_0x85d5('0x32')][_0x85d5('0x3f')](_0x4374c4[_0x85d5('0x5e')](_0x542453),{'individualHooks':!![]});}})[_0x85d5('0x13')](function(){if(_0x782cec){return _0x782cec[_0x85d5('0x31')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x782cec['loginInPause']||![],'mailPause':_0x782cec['loginInPause']||![],'chatPause':_0x782cec[_0x85d5('0x53')]||![],'faxPause':_0x782cec['loginInPause']||![],'smsPause':_0x782cec[_0x85d5('0x53')]||![],'openchannelPause':_0x782cec[_0x85d5('0x53')]||![],'pauseType':_0x782cec[_0x85d5('0x53')]?_0x85d5('0x5d'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x311c09});}})[_0x85d5('0x13')](function(_0x1f3970){_0x158e6b(_0x1f3970);})[_0x85d5('0x1c')](function(_0x1072d4){_0x21ba89(_0x557477[_0x85d5('0x19')](0x1f4,_0x1072d4[_0x85d5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 867057b..bf5db03 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 _0x6f90=['save','remove','update','emit','removeListener','register','length','user:','./user.events'];(function(_0x24f974,_0x19f818){var _0x297896=function(_0x305e08){while(--_0x305e08){_0x24f974['push'](_0x24f974['shift']());}};_0x297896(++_0x19f818);}(_0x6f90,0x131));var _0x06f9=function(_0x1d04c4,_0x53978b){_0x1d04c4=_0x1d04c4-0x0;var _0x1ac3ed=_0x6f90[_0x1d04c4];return _0x1ac3ed;};'use strict';var UserEvents=require(_0x06f9('0x0'));var events=[_0x06f9('0x1'),_0x06f9('0x2'),_0x06f9('0x3')];function createListener(_0x16496f,_0x14eeb9){return function(_0x4ad675){_0x14eeb9[_0x06f9('0x4')](_0x16496f,_0x4ad675);};}function removeListener(_0x20926f,_0x151f08){return function(){UserEvents[_0x06f9('0x5')](_0x20926f,_0x151f08);};}exports[_0x06f9('0x6')]=function(_0x20c76e){for(var _0x372207=0x0,_0x48da4d=events[_0x06f9('0x7')];_0x372207<_0x48da4d;_0x372207++){var _0x1e24a3=events[_0x372207];var _0x28e578=createListener(_0x06f9('0x8')+_0x1e24a3,_0x20c76e);UserEvents['on'](_0x1e24a3,_0x28e578);}}; \ No newline at end of file +var _0xfc34=['removeListener','register','length','user:','./user.events','remove','emit'];(function(_0x43ab60,_0x5a33a8){var _0x18d2c6=function(_0x214be0){while(--_0x214be0){_0x43ab60['push'](_0x43ab60['shift']());}};_0x18d2c6(++_0x5a33a8);}(_0xfc34,0xe4));var _0x4fc3=function(_0x23c827,_0x37332a){_0x23c827=_0x23c827-0x0;var _0x3d7f1f=_0xfc34[_0x23c827];return _0x3d7f1f;};'use strict';var UserEvents=require(_0x4fc3('0x0'));var events=['save',_0x4fc3('0x1'),'update'];function createListener(_0x7867cb,_0x44187e){return function(_0x164f0e){_0x44187e[_0x4fc3('0x2')](_0x7867cb,_0x164f0e);};}function removeListener(_0x33b900,_0xeca59e){return function(){UserEvents[_0x4fc3('0x3')](_0x33b900,_0xeca59e);};}exports[_0x4fc3('0x4')]=function(_0x496d6b){for(var _0x4c23af=0x0,_0x47a669=events[_0x4fc3('0x5')];_0x4c23af<_0x47a669;_0x4c23af++){var _0x404b0d=events[_0x4c23af];var _0x460300=createListener(_0x4fc3('0x6')+_0x404b0d,_0x496d6b);UserEvents['on'](_0x404b0d,_0x460300);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e24b35d..2e3a1ce 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x36e583,_0x58368c){var _0x2c0880=function(_0x10cd4d){while(--_0x10cd4d){_0x36e583['push'](_0x36e583['shift']());}};_0x2c0880(++_0x58368c);}(_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(_0x5453cd,_0x383482){var _0x3b3fca=function(_0x5c73b3){while(--_0x5c73b3){_0x5453cd['push'](_0x5453cd['shift']());}};_0x3b3fca(++_0x383482);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xcb91[_0x264545];return _0x114d10;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 24b708c..1107f97 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 _0xd3f3=['sequelize','exports','INTEGER'];(function(_0x2fa9f8,_0x39e7eb){var _0x568ad7=function(_0x4222a4){while(--_0x4222a4){_0x2fa9f8['push'](_0x2fa9f8['shift']());}};_0x568ad7(++_0x39e7eb);}(_0xd3f3,0x72));var _0x3d3f=function(_0x21bfcd,_0x48e609){_0x21bfcd=_0x21bfcd-0x0;var _0xe9acb0=_0xd3f3[_0x21bfcd];return _0xe9acb0;};'use strict';var Sequelize=require(_0x3d3f('0x0'));module[_0x3d3f('0x1')]={'penalty':{'type':Sequelize[_0x3d3f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc815=['sequelize','exports'];(function(_0x6ad911,_0x377aca){var _0x5c0d29=function(_0x46c246){while(--_0x46c246){_0x6ad911['push'](_0x6ad911['shift']());}};_0x5c0d29(++_0x377aca);}(_0xc815,0x15a));var _0x5c81=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc815[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x5c81('0x0'));module[_0x5c81('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 908e025..d162593 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 _0x084a=['api','moment','bluebird','path','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger'];(function(_0x509ee7,_0x49440c){var _0x856347=function(_0x51ef03){while(--_0x51ef03){_0x509ee7['push'](_0x509ee7['shift']());}};_0x856347(++_0x49440c);}(_0x084a,0x6c));var _0xa084=function(_0x2c1ac1,_0x3dfb07){_0x2c1ac1=_0x2c1ac1-0x0;var _0x240e2d=_0x084a[_0x2c1ac1];return _0x240e2d;};'use strict';var _=require('lodash');var util=require(_0xa084('0x0'));var logger=require(_0xa084('0x1'))(_0xa084('0x2'));var moment=require(_0xa084('0x3'));var BPromise=require(_0xa084('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa084('0x5'));var rimraf=require('rimraf');var config=require(_0xa084('0x6'));var attributes=require('./userChatQueue.attributes');module[_0xa084('0x7')]=function(_0x4e0c67,_0x23b93c){return _0x4e0c67[_0xa084('0x8')](_0xa084('0x9'),attributes,{'tableName':_0xa084('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe75=['define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x37a00f,_0x5256f1){var _0x190c6d=function(_0x131e52){while(--_0x131e52){_0x37a00f['push'](_0x37a00f['shift']());}};_0x190c6d(++_0x5256f1);}(_0xfe75,0xdb));var _0x5fe7=function(_0x44eda8,_0x22f519){_0x44eda8=_0x44eda8-0x0;var _0x476ed2=_0xfe75[_0x44eda8];return _0x476ed2;};'use strict';var _=require(_0x5fe7('0x0'));var util=require(_0x5fe7('0x1'));var logger=require(_0x5fe7('0x2'))(_0x5fe7('0x3'));var moment=require(_0x5fe7('0x4'));var BPromise=require(_0x5fe7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5fe7('0x6'));var attributes=require(_0x5fe7('0x7'));module[_0x5fe7('0x8')]=function(_0x2dbc6d,_0x1ceedd){return _0x2dbc6d[_0x5fe7('0x9')](_0x5fe7('0xa'),attributes,{'tableName':_0x5fe7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 3b72f42..53c2f1a 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 _0x51e7=['stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x46be36,_0x5451a8){var _0x203d30=function(_0x5c5653){while(--_0x5c5653){_0x46be36['push'](_0x46be36['shift']());}};_0x203d30(++_0x5451a8);}(_0x51e7,0x1e7));var _0x751e=function(_0x2bbae5,_0x1f4626){_0x2bbae5=_0x2bbae5-0x0;var _0x90f6f=_0x51e7[_0x2bbae5];return _0x90f6f;};'use strict';var _=require(_0x751e('0x0'));var util=require(_0x751e('0x1'));var moment=require(_0x751e('0x2'));var BPromise=require(_0x751e('0x3'));var rs=require(_0x751e('0x4'));var fs=require('fs');var Redis=require(_0x751e('0x5'));var db=require(_0x751e('0x6'))['db'];var utils=require(_0x751e('0x7'));var logger=require(_0x751e('0x8'))(_0x751e('0x9'));var config=require(_0x751e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x751e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c422f,_0x2881ae,_0x59367b){return new BPromise(function(_0x585c03,_0x1c83b4){return client[_0x751e('0xc')](_0x4c422f,_0x59367b)['then'](function(_0x425612){logger[_0x751e('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x2881ae,_0x751e('0xe'));logger[_0x751e('0xf')](_0x751e('0x10'),_0x2881ae,_0x751e('0xe'),JSON[_0x751e('0x11')](_0x425612));if(_0x425612['error']){if(_0x425612[_0x751e('0x12')][_0x751e('0x13')]===0x1f4){logger['error'](_0x751e('0x14'),_0x2881ae,_0x425612[_0x751e('0x12')][_0x751e('0x15')]);return _0x1c83b4(_0x425612[_0x751e('0x12')][_0x751e('0x15')]);}logger[_0x751e('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x2881ae,_0x425612['error'][_0x751e('0x15')]);return _0x585c03(_0x425612[_0x751e('0x12')][_0x751e('0x15')]);}else{logger['info'](_0x751e('0x14'),_0x2881ae,_0x751e('0xe'));_0x585c03(_0x425612[_0x751e('0x16')]['message']);}})[_0x751e('0x17')](function(_0x2ed4cd){logger[_0x751e('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x2881ae,_0x2ed4cd);_0x1c83b4(_0x2ed4cd);});});} \ No newline at end of file +var _0x98a2=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../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'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x98a2,0x144));var _0x298a=function(_0x24b72c,_0x40591b){_0x24b72c=_0x24b72c-0x0;var _0x161705=_0x98a2[_0x24b72c];return _0x161705;};'use strict';var _=require(_0x298a('0x0'));var util=require('util');var moment=require(_0x298a('0x1'));var BPromise=require(_0x298a('0x2'));var rs=require(_0x298a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x298a('0x4'))['db'];var utils=require(_0x298a('0x5'));var logger=require(_0x298a('0x6'))('rpc');var config=require(_0x298a('0x7'));var jayson=require(_0x298a('0x8'));var client=jayson[_0x298a('0x9')][_0x298a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30c6d8,_0xd65f7a,_0x25b8e7){return new BPromise(function(_0x406731,_0x237080){return client[_0x298a('0xb')](_0x30c6d8,_0x25b8e7)[_0x298a('0xc')](function(_0x38b6ea){logger[_0x298a('0xd')]('UserChatQueue,\x20%s,\x20%s',_0xd65f7a,_0x298a('0xe'));logger['debug'](_0x298a('0xf'),_0xd65f7a,_0x298a('0xe'),JSON[_0x298a('0x10')](_0x38b6ea));if(_0x38b6ea[_0x298a('0x11')]){if(_0x38b6ea[_0x298a('0x11')][_0x298a('0x12')]===0x1f4){logger[_0x298a('0x11')](_0x298a('0x13'),_0xd65f7a,_0x38b6ea['error'][_0x298a('0x14')]);return _0x237080(_0x38b6ea[_0x298a('0x11')][_0x298a('0x14')]);}logger[_0x298a('0x11')](_0x298a('0x13'),_0xd65f7a,_0x38b6ea[_0x298a('0x11')]['message']);return _0x406731(_0x38b6ea[_0x298a('0x11')]['message']);}else{logger[_0x298a('0xd')]('UserChatQueue,\x20%s,\x20%s',_0xd65f7a,_0x298a('0xe'));_0x406731(_0x38b6ea[_0x298a('0x15')][_0x298a('0x14')]);}})[_0x298a('0x16')](function(_0x2bbb06){logger['error'](_0x298a('0x13'),_0xd65f7a,_0x2bbb06);_0x237080(_0x2bbb06);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index ca9f017..4f9bd0d 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x53a456,_0x1c3d73){var _0x19bf77=function(_0x252263){while(--_0x252263){_0x53a456['push'](_0x53a456['shift']());}};_0x19bf77(++_0x1c3d73);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x48d1d2,_0x7d7c81){var _0x3bea79=function(_0x293dda){while(--_0x293dda){_0x48d1d2['push'](_0x48d1d2['shift']());}};_0x3bea79(++_0x7d7c81);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ba98fbf..74c6ad2 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 _0xf5aa=['exports','INTEGER','sequelize'];(function(_0x367e7e,_0x564aa4){var _0x90036e=function(_0x45ec9e){while(--_0x45ec9e){_0x367e7e['push'](_0x367e7e['shift']());}};_0x90036e(++_0x564aa4);}(_0xf5aa,0x1a9));var _0xaf5a=function(_0x26f6b4,_0x160445){_0x26f6b4=_0x26f6b4-0x0;var _0x53a138=_0xf5aa[_0x26f6b4];return _0x53a138;};'use strict';var Sequelize=require(_0xaf5a('0x0'));module[_0xaf5a('0x1')]={'penalty':{'type':Sequelize[_0xaf5a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaf5a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc0c0=['INTEGER','STRING','sequelize','exports'];(function(_0x3b2cf7,_0x213933){var _0x5016f3=function(_0x513b40){while(--_0x513b40){_0x3b2cf7['push'](_0x3b2cf7['shift']());}};_0x5016f3(++_0x213933);}(_0xc0c0,0x92));var _0x0c0c=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xc0c0[_0x5a3cf0];return _0x5a64ee;};'use strict';var Sequelize=require(_0x0c0c('0x0'));module[_0x0c0c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0c0c('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0c0c('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ed25832..c7386db 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 _0x0d7d=['moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x2b73cb,_0x35754a){var _0x2fae69=function(_0x46262b){while(--_0x46262b){_0x2b73cb['push'](_0x2b73cb['shift']());}};_0x2fae69(++_0x35754a);}(_0x0d7d,0x111));var _0xd0d7=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x0d7d[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xd0d7('0x0'));var util=require(_0xd0d7('0x1'));var logger=require(_0xd0d7('0x2'))('api');var moment=require(_0xd0d7('0x3'));var BPromise=require(_0xd0d7('0x4'));var rp=require(_0xd0d7('0x5'));var fs=require('fs');var path=require(_0xd0d7('0x6'));var rimraf=require(_0xd0d7('0x7'));var config=require('../../config/environment');var attributes=require(_0xd0d7('0x8'));module['exports']=function(_0x71119a,_0x55ebca){return _0x71119a[_0xd0d7('0x9')](_0xd0d7('0xa'),attributes,{'tableName':_0xd0d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa628=['./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','util','../../config/logger','api','path','../../config/environment'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xa628,0x158));var _0x8a62=function(_0x425af8,_0x366c35){_0x425af8=_0x425af8-0x0;var _0x5c2eb1=_0xa628[_0x425af8];return _0x5c2eb1;};'use strict';var _=require(_0x8a62('0x0'));var util=require(_0x8a62('0x1'));var logger=require(_0x8a62('0x2'))(_0x8a62('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a62('0x4'));var rimraf=require('rimraf');var config=require(_0x8a62('0x5'));var attributes=require(_0x8a62('0x6'));module[_0x8a62('0x7')]=function(_0x2fcb35,_0x2f2e87){return _0x2fcb35[_0x8a62('0x8')]('UserFaxQueue',attributes,{'tableName':_0x8a62('0x9'),'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 93e19a3..85163b2 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 _0x4fcb=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserFaxQueue,\x20%s,\x20%s'];(function(_0x1b0dc7,_0x58b8c2){var _0x324d9b=function(_0x4a2f0e){while(--_0x4a2f0e){_0x1b0dc7['push'](_0x1b0dc7['shift']());}};_0x324d9b(++_0x58b8c2);}(_0x4fcb,0xa3));var _0xb4fc=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x4fcb[_0x3c4062];return _0x3f5bf3;};'use strict';var _=require(_0xb4fc('0x0'));var util=require(_0xb4fc('0x1'));var moment=require(_0xb4fc('0x2'));var BPromise=require(_0xb4fc('0x3'));var rs=require(_0xb4fc('0x4'));var fs=require('fs');var Redis=require(_0xb4fc('0x5'));var db=require(_0xb4fc('0x6'))['db'];var utils=require(_0xb4fc('0x7'));var logger=require(_0xb4fc('0x8'))(_0xb4fc('0x9'));var config=require(_0xb4fc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb4fc('0xb')][_0xb4fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd9d9e0,_0x3c4c69,_0x2a4911){return new BPromise(function(_0x5727c9,_0x1bc700){return client['request'](_0xd9d9e0,_0x2a4911)['then'](function(_0x550e2b){logger[_0xb4fc('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x3c4c69,_0xb4fc('0xe'));logger[_0xb4fc('0xf')](_0xb4fc('0x10'),_0x3c4c69,_0xb4fc('0xe'),JSON['stringify'](_0x550e2b));if(_0x550e2b[_0xb4fc('0x11')]){if(_0x550e2b[_0xb4fc('0x11')][_0xb4fc('0x12')]===0x1f4){logger[_0xb4fc('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x3c4c69,_0x550e2b[_0xb4fc('0x11')][_0xb4fc('0x13')]);return _0x1bc700(_0x550e2b[_0xb4fc('0x11')]['message']);}logger[_0xb4fc('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x3c4c69,_0x550e2b[_0xb4fc('0x11')]['message']);return _0x5727c9(_0x550e2b['error']['message']);}else{logger[_0xb4fc('0xd')](_0xb4fc('0x14'),_0x3c4c69,'request\x20sent');_0x5727c9(_0x550e2b[_0xb4fc('0x15')][_0xb4fc('0x13')]);}})[_0xb4fc('0x16')](function(_0x579598){logger[_0xb4fc('0x11')](_0xb4fc('0x14'),_0x3c4c69,_0x579598);_0x1bc700(_0x579598);});});} \ No newline at end of file +var _0xc233=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc233,0xf0));var _0x3c23=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0xc233[_0x32bb6b];return _0x58dcb4;};'use strict';var _=require(_0x3c23('0x0'));var util=require(_0x3c23('0x1'));var moment=require(_0x3c23('0x2'));var BPromise=require(_0x3c23('0x3'));var rs=require(_0x3c23('0x4'));var fs=require('fs');var Redis=require(_0x3c23('0x5'));var db=require(_0x3c23('0x6'))['db'];var utils=require(_0x3c23('0x7'));var logger=require(_0x3c23('0x8'))(_0x3c23('0x9'));var config=require(_0x3c23('0xa'));var jayson=require(_0x3c23('0xb'));var client=jayson[_0x3c23('0xc')][_0x3c23('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c389a,_0x5a04c2,_0x388171){return new BPromise(function(_0x1c2818,_0x47d540){return client[_0x3c23('0xe')](_0x4c389a,_0x388171)['then'](function(_0x592401){logger[_0x3c23('0xf')](_0x3c23('0x10'),_0x5a04c2,_0x3c23('0x11'));logger[_0x3c23('0x12')](_0x3c23('0x13'),_0x5a04c2,_0x3c23('0x11'),JSON['stringify'](_0x592401));if(_0x592401[_0x3c23('0x14')]){if(_0x592401['error'][_0x3c23('0x15')]===0x1f4){logger['error'](_0x3c23('0x10'),_0x5a04c2,_0x592401[_0x3c23('0x14')][_0x3c23('0x16')]);return _0x47d540(_0x592401['error'][_0x3c23('0x16')]);}logger[_0x3c23('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x5a04c2,_0x592401['error']['message']);return _0x1c2818(_0x592401[_0x3c23('0x14')][_0x3c23('0x16')]);}else{logger['info'](_0x3c23('0x10'),_0x5a04c2,_0x3c23('0x11'));_0x1c2818(_0x592401[_0x3c23('0x17')]['message']);}})['catch'](function(_0x1f5819){logger[_0x3c23('0x14')](_0x3c23('0x10'),_0x5a04c2,_0x1f5819);_0x47d540(_0x1f5819);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a22017b..b5a2633 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(_0x475c35,_0xbc5a8){var _0xdac2c2=function(_0x3c9ef3){while(--_0x3c9ef3){_0x475c35['push'](_0x475c35['shift']());}};_0xdac2c2(++_0xbc5a8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xcb91[_0x5774be];return _0x4914b4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5265a0,_0x3562b4){var _0x3e9c9e=function(_0x262c09){while(--_0x262c09){_0x5265a0['push'](_0x5265a0['shift']());}};_0x3e9c9e(++_0x3562b4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0fd4e7d..b354d97 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 _0xc777=['exports','sequelize'];(function(_0x12bdba,_0x49ea0d){var _0x2a756a=function(_0x4cfe22){while(--_0x4cfe22){_0x12bdba['push'](_0x12bdba['shift']());}};_0x2a756a(++_0x49ea0d);}(_0xc777,0x1b7));var _0x7c77=function(_0x4ac6e1,_0xe338c0){_0x4ac6e1=_0x4ac6e1-0x0;var _0xd9937a=_0xc777[_0x4ac6e1];return _0xd9937a;};'use strict';var Sequelize=require(_0x7c77('0x0'));module[_0x7c77('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc0bc=['exports'];(function(_0x13548e,_0x35ac21){var _0x46ea04=function(_0xabab9){while(--_0xabab9){_0x13548e['push'](_0x13548e['shift']());}};_0x46ea04(++_0x35ac21);}(_0xc0bc,0x136));var _0xcc0b=function(_0x5123ee,_0x43b226){_0x5123ee=_0x5123ee-0x0;var _0x258f19=_0xc0bc[_0x5123ee];return _0x258f19;};'use strict';var Sequelize=require('sequelize');module[_0xcc0b('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 2bd3c23..5ea9313 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 _0xa0d7=['rimraf','./userMailQueue.attributes','exports','define','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x7e19de,_0x368cce){var _0x3b06be=function(_0x5021eb){while(--_0x5021eb){_0x7e19de['push'](_0x7e19de['shift']());}};_0x3b06be(++_0x368cce);}(_0xa0d7,0x101));var _0x7a0d=function(_0x325cca,_0x1310a0){_0x325cca=_0x325cca-0x0;var _0x4005e1=_0xa0d7[_0x325cca];return _0x4005e1;};'use strict';var _=require('lodash');var util=require(_0x7a0d('0x0'));var logger=require(_0x7a0d('0x1'))(_0x7a0d('0x2'));var moment=require(_0x7a0d('0x3'));var BPromise=require(_0x7a0d('0x4'));var rp=require(_0x7a0d('0x5'));var fs=require('fs');var path=require(_0x7a0d('0x6'));var rimraf=require(_0x7a0d('0x7'));var config=require('../../config/environment');var attributes=require(_0x7a0d('0x8'));module[_0x7a0d('0x9')]=function(_0x315547,_0x56df4e){return _0x315547[_0x7a0d('0xa')]('UserMailQueue',attributes,{'tableName':_0x7a0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf047=['rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','util','../../config/logger','api','request-promise','path'];(function(_0x2a384c,_0xa73757){var _0x27418a=function(_0x3e413f){while(--_0x3e413f){_0x2a384c['push'](_0x2a384c['shift']());}};_0x27418a(++_0xa73757);}(_0xf047,0xcc));var _0x7f04=function(_0x5f1c73,_0x4f9432){_0x5f1c73=_0x5f1c73-0x0;var _0x3c1fa4=_0xf047[_0x5f1c73];return _0x3c1fa4;};'use strict';var _=require('lodash');var util=require(_0x7f04('0x0'));var logger=require(_0x7f04('0x1'))(_0x7f04('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7f04('0x3'));var fs=require('fs');var path=require(_0x7f04('0x4'));var rimraf=require(_0x7f04('0x5'));var config=require(_0x7f04('0x6'));var attributes=require(_0x7f04('0x7'));module[_0x7f04('0x8')]=function(_0x36e4bb,_0x246e61){return _0x36e4bb[_0x7f04('0x9')]('UserMailQueue',attributes,{'tableName':_0x7f04('0xa'),'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 704d0fd..7006cee 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 _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(_0x472c48,_0x268c55){var _0x346f36=function(_0x572fc6){while(--_0x572fc6){_0x472c48['push'](_0x472c48['shift']());}};_0x346f36(++_0x268c55);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4c894b,_0x54fa91){_0x4c894b=_0x4c894b-0x0;var _0x490258=_0x7fbe[_0x4c894b];return _0x490258;};'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 +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1072fc,_0x2accb2){var _0x52db7f=function(_0x5c999c){while(--_0x5c999c){_0x1072fc['push'](_0x1072fc['shift']());}};_0x52db7f(++_0x2accb2);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x00bb[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index dce7d7b..e0bfed0 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 _0x0924=['./userNotification.controller','isAuthenticated','sendUserNotification','multer','path','Router','fs-extra','../../config/environment'];(function(_0xc742da,_0x520607){var _0x18328c=function(_0x394875){while(--_0x394875){_0xc742da['push'](_0xc742da['shift']());}};_0x18328c(++_0x520607);}(_0x0924,0x17b));var _0x4092=function(_0x5b4a06,_0x2734e7){_0x5b4a06=_0x5b4a06-0x0;var _0x1cf5e5=_0x0924[_0x5b4a06];return _0x1cf5e5;};'use strict';var multer=require(_0x4092('0x0'));var util=require('util');var path=require(_0x4092('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4092('0x2')]();var fs_extra=require(_0x4092('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4092('0x4'));var controller=require(_0x4092('0x5'));router['post']('/',auth[_0x4092('0x6')](),controller[_0x4092('0x7')]);module['exports']=router; \ No newline at end of file +var _0x622f=['../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xe3b402,_0x362749){var _0x47ebef=function(_0xcc1d4c){while(--_0xcc1d4c){_0xe3b402['push'](_0xe3b402['shift']());}};_0x47ebef(++_0x362749);}(_0x622f,0x18c));var _0xf622=function(_0x599328,_0x45c28d){_0x599328=_0x599328-0x0;var _0x570dc2=_0x622f[_0x599328];return _0x570dc2;};'use strict';var multer=require(_0xf622('0x0'));var util=require('util');var path=require(_0xf622('0x1'));var timeout=require(_0xf622('0x2'));var express=require(_0xf622('0x3'));var router=express[_0xf622('0x4')]();var fs_extra=require(_0xf622('0x5'));var auth=require(_0xf622('0x6'));var interaction=require(_0xf622('0x7'));var config=require('../../config/environment');var controller=require(_0xf622('0x8'));router[_0xf622('0x9')]('/',auth[_0xf622('0xa')](),controller[_0xf622('0xb')]);module[_0xf622('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c9108ac..d99b7f8 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 _0x6073=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x6073,0xb2));var _0x3607=function(_0x396e8a,_0x39f47a){_0x396e8a=_0x396e8a-0x0;var _0x4b9fa5=_0x6073[_0x396e8a];return _0x4b9fa5;};'use strict';var Sequelize=require(_0x3607('0x0'));module[_0x3607('0x1')]={'body':{'type':Sequelize[_0x3607('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x3607('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3607('0x3')]},'beep':{'type':Sequelize[_0x3607('0x4')]}}; \ No newline at end of file +var _0xce08=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0xeb76d0,_0x36a3b0){var _0x22f589=function(_0x3b95a3){while(--_0x3b95a3){_0xeb76d0['push'](_0xeb76d0['shift']());}};_0x22f589(++_0x36a3b0);}(_0xce08,0x12e));var _0x8ce0=function(_0x4af381,_0x1017ee){_0x4af381=_0x4af381-0x0;var _0x130b17=_0xce08[_0x4af381];return _0x130b17;};'use strict';var Sequelize=require(_0x8ce0('0x0'));module[_0x8ce0('0x1')]={'body':{'type':Sequelize[_0x8ce0('0x2')]},'senderName':{'type':Sequelize[_0x8ce0('0x3')]},'recipientsId':{'type':Sequelize[_0x8ce0('0x2')]},'recipientsDescription':{'type':Sequelize[_0x8ce0('0x3')]},'beep':{'type':Sequelize[_0x8ce0('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 622ebbb..47ce544 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 _0x1bdb=['faxqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','forEach','recipient','emit','userNotification:send','catch','text','Template','Invalid\x20\x27TemplateId\x27\x20parameter','html','view','startCase','model','User','union','ids','queue','replace','push','all','findOne','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','json','offset','undefined','count','apply','reject','update','then','error','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue'];(function(_0x2d6c79,_0x40ef4b){var _0x432466=function(_0x590099){while(--_0x590099){_0x2d6c79['push'](_0x2d6c79['shift']());}};_0x432466(++_0x40ef4b);}(_0x1bdb,0xeb));var _0xb1bd=function(_0x1ae125,_0x1c2c5f){_0x1ae125=_0x1ae125-0x0;var _0x419783=_0x1bdb[_0x1ae125];return _0x419783;};'use strict';var emlformat=require(_0xb1bd('0x0'));var rimraf=require(_0xb1bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1bd('0x2'));var rp=require(_0xb1bd('0x3'));var moment=require('moment');var BPromise=require(_0xb1bd('0x4'));var Mustache=require(_0xb1bd('0x5'));var util=require(_0xb1bd('0x6'));var path=require(_0xb1bd('0x7'));var sox=require(_0xb1bd('0x8'));var csv=require('to-csv');var ejs=require(_0xb1bd('0x9'));var fs=require('fs');var fs_extra=require(_0xb1bd('0xa'));var _=require(_0xb1bd('0xb'));var squel=require(_0xb1bd('0xc'));var crypto=require(_0xb1bd('0xd'));var jsforce=require(_0xb1bd('0xe'));var deskjs=require(_0xb1bd('0xf'));var toCsv=require(_0xb1bd('0x10'));var querystring=require(_0xb1bd('0x11'));var Papa=require(_0xb1bd('0x12'));var Redis=require(_0xb1bd('0x13'));var authService=require(_0xb1bd('0x14'));var qs=require(_0xb1bd('0x15'));var as=require(_0xb1bd('0x16'));var hardwareService=require(_0xb1bd('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb1bd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb1bd('0x19'))['db'];config[_0xb1bd('0x1a')]=_[_0xb1bd('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb1bd('0x1c'))(new Redis(config[_0xb1bd('0x1a')]));require(_0xb1bd('0x1d'))[_0xb1bd('0x1e')](socket);function respondWithStatusCode(_0x745692,_0x2b1070){_0x2b1070=_0x2b1070||0xcc;return function(_0x3a9fd8){if(_0x3a9fd8){return _0x745692[_0xb1bd('0x1f')](_0x2b1070);}return _0x745692['status'](_0x2b1070)[_0xb1bd('0x20')]();};}function respondWithResult(_0x50cc15,_0x2eaa64){_0x2eaa64=_0x2eaa64||0xc8;return function(_0x2056fa){if(_0x2056fa){return _0x50cc15[_0xb1bd('0x21')](_0x2eaa64)[_0xb1bd('0x22')](_0x2056fa);}};}function respondWithFilteredResult(_0x1a0011,_0x23a575){return function(_0x259f47){if(_0x259f47){var _0x2f639d=typeof _0x23a575[_0xb1bd('0x23')]===_0xb1bd('0x24')&&typeof _0x23a575['limit']===_0xb1bd('0x24');var _0x2ce7f8=_0x259f47['count'];var _0x15d64f=_0x2f639d?0x0:_0x23a575['offset'];var _0xbbf3ed=_0x2f639d?_0x259f47[_0xb1bd('0x25')]:_0x23a575[_0xb1bd('0x23')]+_0x23a575['limit'];var _0x10e661;if(_0xbbf3ed>=_0x2ce7f8){_0xbbf3ed=_0x2ce7f8;_0x10e661=0xc8;}else{_0x10e661=0xce;}_0x1a0011[_0xb1bd('0x21')](_0x10e661);return _0x1a0011['set']('Content-Range',_0x15d64f+'-'+_0xbbf3ed+'/'+_0x2ce7f8)[_0xb1bd('0x22')](_0x259f47);}return null;};}function patchUpdates(_0x3b6c1d){return function(_0xe86fee){try{jsonpatch[_0xb1bd('0x26')](_0xe86fee,_0x3b6c1d,!![]);}catch(_0x278c2e){return BPromise[_0xb1bd('0x27')](_0x278c2e);}return _0xe86fee['save']();};}function saveUpdates(_0x16d253,_0x2ccb32){return function(_0x3ba67b){if(_0x3ba67b){return _0x3ba67b[_0xb1bd('0x28')](_0x16d253)[_0xb1bd('0x29')](function(_0x2357a1){return _0x2357a1;});}return null;};}function removeEntity(_0x3926fc,_0x36aea2){return function(_0x1dccb1){if(_0x1dccb1){return _0x1dccb1['destroy']()['then'](function(){_0x3926fc[_0xb1bd('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51544c,_0x466a47){return function(_0x59389a){if(!_0x59389a){_0x51544c[_0xb1bd('0x1f')](0x194);}return _0x59389a;};}function handleError(_0x5bfa4e,_0x52e271){_0x52e271=_0x52e271||0x1f4;return function(_0x5a72c8){logger[_0xb1bd('0x2a')](_0x5a72c8['stack']);if(_0x5a72c8[_0xb1bd('0x2b')]){delete _0x5a72c8['name'];}_0x5bfa4e[_0xb1bd('0x21')](_0x52e271)[_0xb1bd('0x2c')](_0x5a72c8);};}exports[_0xb1bd('0x2d')]=function(_0x31fc70,_0x142bf6,_0xa2edb1){if(!_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')]('text')&&!_0x31fc70['body'][_0xb1bd('0x2f')](_0xb1bd('0x30'))){throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')]('TemplateId')&&!_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')]('view')){throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')](_0xb1bd('0x33'))){throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))](_0xb1bd('0x34'));}else{try{var _0x589407=JSON[_0xb1bd('0x35')](_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x33')]);}catch(_0x1ec144){logger[_0xb1bd('0x2a')](_0x1ec144);throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))](_0xb1bd('0x36'));}var _0x266684=[_0xb1bd('0x37'),_0xb1bd('0x38'),'mailqueue','openchannelqueue',_0xb1bd('0x39'),_0xb1bd('0x3a'),_0xb1bd('0x3b'),'team',_0xb1bd('0x3c')];if(_[_0xb1bd('0x3d')](_0x589407,function(_0x2d99cf){return!_[_0xb1bd('0x3e')](_0x266684,_0x2d99cf['model'][_0xb1bd('0x3f')]());})){throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))](_0xb1bd('0x40'));}}}var _0x426752={};_0x426752[_0xb1bd('0x41')]=_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')](_0xb1bd('0x41'))?_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x41')]:_0x31fc70[_0xb1bd('0x3c')][_0xb1bd('0x42')];_0x426752[_0xb1bd('0x43')]=_[_0xb1bd('0x44')](_0x31fc70['body'][_0xb1bd('0x43')])?null:_0x31fc70['body'][_0xb1bd('0x43')];_0x426752[_0xb1bd('0x45')]=_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x45')]||![];_0x426752[_0xb1bd('0x46')]=_0x31fc70[_0xb1bd('0x3c')]['id'];return getContent(_0x31fc70['body'])[_0xb1bd('0x29')](function(_0x3626c5){_0x426752[_0xb1bd('0x2e')]=_0x3626c5;return getRecipients(_0x589407);})[_0xb1bd('0x29')](function(_0x1aebd8){_0x426752[_0xb1bd('0x47')]=_[_0xb1bd('0x48')](_0x1aebd8)[_0xb1bd('0x49')](',');return db[_0xb1bd('0x4a')]['transaction'](function(_0x34914e){return db['UserNotification']['create'](_0x426752,{'raw':!![],'transaction':_0x34914e})[_0xb1bd('0x29')](function(_0x4e42e7){var _0x442d0c={'sender':_0x426752['senderName'],'description':_0x426752[_0xb1bd('0x43')],'content':_0x426752[_0xb1bd('0x2e')],'beep':_0x426752[_0xb1bd('0x45')]};_0x1aebd8[_0xb1bd('0x4b')](function(_0x3a246d){_0x442d0c[_0xb1bd('0x4c')]=_0x3a246d;socket[_0xb1bd('0x4d')](_0xb1bd('0x4e'),_0x442d0c);});return _0x4e42e7;});});})[_0xb1bd('0x29')](respondWithResult(_0x142bf6,0xc9))[_0xb1bd('0x4f')](handleError(_0x142bf6,null));};function getContent(_0x2a8482){return new BPromise(function(_0x80e9cc,_0x772fa1){if(_0x2a8482[_0xb1bd('0x50')]){_0x80e9cc(_0x2a8482[_0xb1bd('0x50')]);return;}return db[_0xb1bd('0x51')]['findOne']({'attributes':['html'],'where':{'id':_0x2a8482['TemplateId']},'raw':!![]})[_0xb1bd('0x29')](function(_0x1c0d1e){if(!_0x1c0d1e)throw new db['Sequelize'][(_0xb1bd('0x32'))](_0xb1bd('0x52'));var _0x329638=Mustache['render'](_0x1c0d1e[_0xb1bd('0x53')],_0x2a8482[_0xb1bd('0x54')]);_0x80e9cc(_0x329638);})[_0xb1bd('0x4f')](function(_0x2f0cf2){_0x772fa1(_0x2f0cf2);});});}function getRecipients(_0x3390c9){return new BPromise(function(_0xa1abb4,_0x527793){var _0x468334=[];var _0x3e70b7=[];_0x3390c9['forEach'](function(_0x398b3b){var _0x32eb15=_[_0xb1bd('0x55')](_0x398b3b[_0xb1bd('0x56')][_0xb1bd('0x3f')]());if(_0x32eb15===_0xb1bd('0x57')){_0x468334=_[_0xb1bd('0x58')](_0x468334,_0x398b3b[_0xb1bd('0x59')]);}else{if(_[_0xb1bd('0x3e')](_0x32eb15,_0xb1bd('0x5a')))_0x32eb15=_0x32eb15[_0xb1bd('0x5b')]('queue','Queue');_0x398b3b[_0xb1bd('0x59')][_0xb1bd('0x4b')](function(_0x3708d5){_0x3e70b7[_0xb1bd('0x5c')](getAgents(_0x32eb15,_0x3708d5));});}});return BPromise[_0xb1bd('0x5d')](_0x3e70b7)['then'](function(_0x468901){_0x468334=_[_0xb1bd('0x58')](_0x468334,_['flatten'](_0x468901));_0xa1abb4(_0x468334);})['catch'](function(_0x2e547f){_0x527793(_0x2e547f);});});}function getAgents(_0x2988a0,_0x5a6fda){return new BPromise(function(_0x652f98,_0x2c2bc0){return db[_0x2988a0][_0xb1bd('0x5e')]({'where':{'id':_0x5a6fda}})[_0xb1bd('0x29')](function(_0x518977){return _0x518977[_0xb1bd('0x5f')]({'attributes':['id'],'raw':!![]})[_0xb1bd('0x29')](function(_0x453d41){var _0x463fc0=_[_0xb1bd('0x60')](_0x453d41,'id');_0x652f98(_0x463fc0);});})[_0xb1bd('0x4f')](function(_0x52e6aa){_0x2c2bc0(_0x52e6aa);});});} \ No newline at end of file +var _0x6809=['sequelize','transaction','UserNotification','create','forEach','recipient','emit','catch','text','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','toLowerCase','User','union','queue','replace','Queue','push','flatten','findOne','getAgents','rimraf','zip-dir','fast-json-patch','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','join'];(function(_0x127f6d,_0x55cce9){var _0x2246b2=function(_0x46c309){while(--_0x46c309){_0x127f6d['push'](_0x127f6d['shift']());}};_0x2246b2(++_0x55cce9);}(_0x6809,0x1ac));var _0x9680=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x6809[_0x4c184d];return _0x23d997;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9680('0x0'));var zipdir=require(_0x9680('0x1'));var jsonpatch=require(_0x9680('0x2'));var rp=require(_0x9680('0x3'));var moment=require(_0x9680('0x4'));var BPromise=require(_0x9680('0x5'));var Mustache=require('mustache');var util=require(_0x9680('0x6'));var path=require(_0x9680('0x7'));var sox=require('sox');var csv=require(_0x9680('0x8'));var ejs=require(_0x9680('0x9'));var fs=require('fs');var fs_extra=require(_0x9680('0xa'));var _=require(_0x9680('0xb'));var squel=require(_0x9680('0xc'));var crypto=require(_0x9680('0xd'));var jsforce=require(_0x9680('0xe'));var deskjs=require(_0x9680('0xf'));var toCsv=require(_0x9680('0x8'));var querystring=require(_0x9680('0x10'));var Papa=require(_0x9680('0x11'));var Redis=require(_0x9680('0x12'));var authService=require(_0x9680('0x13'));var qs=require(_0x9680('0x14'));var as=require(_0x9680('0x15'));var hardwareService=require(_0x9680('0x16'));var logger=require(_0x9680('0x17'))(_0x9680('0x18'));var utils=require(_0x9680('0x19'));var config=require(_0x9680('0x1a'));var licenseUtil=require(_0x9680('0x1b'));var db=require(_0x9680('0x1c'))['db'];config[_0x9680('0x1d')]=_[_0x9680('0x1e')](config[_0x9680('0x1d')],{'host':_0x9680('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9680('0x1d')]));require(_0x9680('0x20'))['register'](socket);function respondWithStatusCode(_0x3614c2,_0x413392){_0x413392=_0x413392||0xcc;return function(_0x43d7db){if(_0x43d7db){return _0x3614c2[_0x9680('0x21')](_0x413392);}return _0x3614c2[_0x9680('0x22')](_0x413392)[_0x9680('0x23')]();};}function respondWithResult(_0x96a794,_0x1645f7){_0x1645f7=_0x1645f7||0xc8;return function(_0x382b8e){if(_0x382b8e){return _0x96a794[_0x9680('0x22')](_0x1645f7)[_0x9680('0x24')](_0x382b8e);}};}function respondWithFilteredResult(_0x210037,_0x368ff5){return function(_0x2b6b28){if(_0x2b6b28){var _0x1176d4=typeof _0x368ff5[_0x9680('0x25')]===_0x9680('0x26')&&typeof _0x368ff5[_0x9680('0x27')]==='undefined';var _0x5d6479=_0x2b6b28['count'];var _0x123707=_0x1176d4?0x0:_0x368ff5['offset'];var _0x414711=_0x1176d4?_0x2b6b28['count']:_0x368ff5[_0x9680('0x25')]+_0x368ff5[_0x9680('0x27')];var _0x36f80c;if(_0x414711>=_0x5d6479){_0x414711=_0x5d6479;_0x36f80c=0xc8;}else{_0x36f80c=0xce;}_0x210037[_0x9680('0x22')](_0x36f80c);return _0x210037['set'](_0x9680('0x28'),_0x123707+'-'+_0x414711+'/'+_0x5d6479)[_0x9680('0x24')](_0x2b6b28);}return null;};}function patchUpdates(_0x101710){return function(_0x4f624a){try{jsonpatch[_0x9680('0x29')](_0x4f624a,_0x101710,!![]);}catch(_0x22ee9f){return BPromise[_0x9680('0x2a')](_0x22ee9f);}return _0x4f624a['save']();};}function saveUpdates(_0x335cb0,_0x5e95d0){return function(_0x597451){if(_0x597451){return _0x597451[_0x9680('0x2b')](_0x335cb0)[_0x9680('0x2c')](function(_0xe74a88){return _0xe74a88;});}return null;};}function removeEntity(_0x1ab2fa,_0x2042c5){return function(_0x5bcf03){if(_0x5bcf03){return _0x5bcf03[_0x9680('0x2d')]()[_0x9680('0x2c')](function(){_0x1ab2fa[_0x9680('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7aa1,_0x1a7a6e){return function(_0x54bf4f){if(!_0x54bf4f){_0x4a7aa1[_0x9680('0x21')](0x194);}return _0x54bf4f;};}function handleError(_0x1bd0c1,_0x4b38d8){_0x4b38d8=_0x4b38d8||0x1f4;return function(_0x41b56e){logger[_0x9680('0x2e')](_0x41b56e[_0x9680('0x2f')]);if(_0x41b56e[_0x9680('0x30')]){delete _0x41b56e[_0x9680('0x30')];}_0x1bd0c1[_0x9680('0x22')](_0x4b38d8)['send'](_0x41b56e);};}exports['sendUserNotification']=function(_0x5b4044,_0x12a85e,_0x282f5b){if(!_0x5b4044[_0x9680('0x31')]['hasOwnProperty']('text')&&!_0x5b4044['body'][_0x9680('0x32')](_0x9680('0x33'))){throw new db[(_0x9680('0x34'))][(_0x9680('0x35'))](_0x9680('0x36'));}else{if(_0x5b4044[_0x9680('0x31')][_0x9680('0x32')]('TemplateId')&&!_0x5b4044['body'][_0x9680('0x32')](_0x9680('0x37'))){throw new db[(_0x9680('0x34'))][(_0x9680('0x35'))](_0x9680('0x38'));}if(!_0x5b4044[_0x9680('0x31')][_0x9680('0x32')](_0x9680('0x39'))){throw new db[(_0x9680('0x34'))][(_0x9680('0x35'))](_0x9680('0x3a'));}else{try{var _0x256e91=JSON[_0x9680('0x3b')](_0x5b4044[_0x9680('0x31')][_0x9680('0x39')]);}catch(_0x50ec12){logger['error'](_0x50ec12);throw new db[(_0x9680('0x34'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x46a35e=['chatqueue',_0x9680('0x3c'),_0x9680('0x3d'),_0x9680('0x3e'),_0x9680('0x3f'),_0x9680('0x40'),'whatsappqueue',_0x9680('0x41'),_0x9680('0x42')];if(_[_0x9680('0x43')](_0x256e91,function(_0x5e5340){return!_[_0x9680('0x44')](_0x46a35e,_0x5e5340['model']['toLowerCase']());})){throw new db[(_0x9680('0x34'))]['ValidationError'](_0x9680('0x45'));}}}var _0x5b8be7={};_0x5b8be7[_0x9680('0x46')]=_0x5b4044[_0x9680('0x31')][_0x9680('0x32')](_0x9680('0x46'))?_0x5b4044[_0x9680('0x31')][_0x9680('0x46')]:_0x5b4044[_0x9680('0x42')][_0x9680('0x47')];_0x5b8be7[_0x9680('0x48')]=_['isEmpty'](_0x5b4044[_0x9680('0x31')]['recipientsDescription'])?null:_0x5b4044[_0x9680('0x31')][_0x9680('0x48')];_0x5b8be7['beep']=_0x5b4044['body'][_0x9680('0x49')]||![];_0x5b8be7[_0x9680('0x4a')]=_0x5b4044[_0x9680('0x42')]['id'];return getContent(_0x5b4044[_0x9680('0x31')])[_0x9680('0x2c')](function(_0x22c6e6){_0x5b8be7[_0x9680('0x31')]=_0x22c6e6;return getRecipients(_0x256e91);})['then'](function(_0x57e6fd){_0x5b8be7[_0x9680('0x4b')]=_['sortBy'](_0x57e6fd)[_0x9680('0x4c')](',');return db[_0x9680('0x4d')][_0x9680('0x4e')](function(_0x30d176){return db[_0x9680('0x4f')][_0x9680('0x50')](_0x5b8be7,{'raw':!![],'transaction':_0x30d176})[_0x9680('0x2c')](function(_0x3f06c6){var _0x3b89a9={'sender':_0x5b8be7[_0x9680('0x46')],'description':_0x5b8be7[_0x9680('0x48')],'content':_0x5b8be7[_0x9680('0x31')],'beep':_0x5b8be7[_0x9680('0x49')]};_0x57e6fd[_0x9680('0x51')](function(_0x38d5be){_0x3b89a9[_0x9680('0x52')]=_0x38d5be;socket[_0x9680('0x53')]('userNotification:send',_0x3b89a9);});return _0x3f06c6;});});})[_0x9680('0x2c')](respondWithResult(_0x12a85e,0xc9))[_0x9680('0x54')](handleError(_0x12a85e,null));};function getContent(_0x18de11){return new BPromise(function(_0x5a12bd,_0xa719df){if(_0x18de11['text']){_0x5a12bd(_0x18de11[_0x9680('0x55')]);return;}return db['Template']['findOne']({'attributes':[_0x9680('0x56')],'where':{'id':_0x18de11['TemplateId']},'raw':!![]})[_0x9680('0x2c')](function(_0x2ae227){if(!_0x2ae227)throw new db[(_0x9680('0x34'))][(_0x9680('0x35'))](_0x9680('0x57'));var _0xad5d1a=Mustache[_0x9680('0x58')](_0x2ae227[_0x9680('0x56')],_0x18de11[_0x9680('0x37')]);_0x5a12bd(_0xad5d1a);})['catch'](function(_0x1d4559){_0xa719df(_0x1d4559);});});}function getRecipients(_0x4ed750){return new BPromise(function(_0xab0fbb,_0x2969f1){var _0x1f428d=[];var _0x39976d=[];_0x4ed750[_0x9680('0x51')](function(_0x57f2e4){var _0x2b345d=_[_0x9680('0x59')](_0x57f2e4[_0x9680('0x5a')][_0x9680('0x5b')]());if(_0x2b345d===_0x9680('0x5c')){_0x1f428d=_[_0x9680('0x5d')](_0x1f428d,_0x57f2e4['ids']);}else{if(_[_0x9680('0x44')](_0x2b345d,_0x9680('0x5e')))_0x2b345d=_0x2b345d[_0x9680('0x5f')](_0x9680('0x5e'),_0x9680('0x60'));_0x57f2e4['ids']['forEach'](function(_0x32752b){_0x39976d[_0x9680('0x61')](getAgents(_0x2b345d,_0x32752b));});}});return BPromise['all'](_0x39976d)[_0x9680('0x2c')](function(_0x51f272){_0x1f428d=_[_0x9680('0x5d')](_0x1f428d,_[_0x9680('0x62')](_0x51f272));_0xab0fbb(_0x1f428d);})['catch'](function(_0x8392db){_0x2969f1(_0x8392db);});});}function getAgents(_0x8a0a74,_0x8fcf10){return new BPromise(function(_0x7c3601,_0x430950){return db[_0x8a0a74][_0x9680('0x63')]({'where':{'id':_0x8fcf10}})[_0x9680('0x2c')](function(_0x33d19d){return _0x33d19d[_0x9680('0x64')]({'attributes':['id'],'raw':!![]})[_0x9680('0x2c')](function(_0x4ed75d){var _0x424cda=_['map'](_0x4ed75d,'id');_0x7c3601(_0x424cda);});})[_0x9680('0x54')](function(_0x3d34f5){_0x430950(_0x3d34f5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 358adb4..3bd63a7 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 _0xc9c0=['remove','emit','hasOwnProperty','events','UserNotification','setMaxListeners','save'];(function(_0x32987d,_0x1cc727){var _0x35dbf1=function(_0x342404){while(--_0x342404){_0x32987d['push'](_0x32987d['shift']());}};_0x35dbf1(++_0x1cc727);}(_0xc9c0,0xf1));var _0x0c9c=function(_0x3b8912,_0x4c7f4d){_0x3b8912=_0x3b8912-0x0;var _0x15a943=_0xc9c0[_0x3b8912];return _0x15a943;};'use strict';var EventEmitter=require(_0x0c9c('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x0c9c('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0c9c('0x2')](0x0);var events={'afterCreate':_0x0c9c('0x3'),'afterUpdate':'update','afterDestroy':_0x0c9c('0x4')};function emitEvent(_0x2106e5){return function(_0xed637f,_0x4aac1e,_0x18f3c4){UserNotificationEvents['emit'](_0x2106e5+':'+_0xed637f['id'],_0xed637f);UserNotificationEvents[_0x0c9c('0x5')](_0x2106e5,_0xed637f);_0x18f3c4(null);};}for(var e in events){if(events[_0x0c9c('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x8380=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x21459e,_0x51d70b){var _0x5ae4cb=function(_0x12a0eb){while(--_0x12a0eb){_0x21459e['push'](_0x21459e['shift']());}};_0x5ae4cb(++_0x51d70b);}(_0x8380,0x140));var _0x0838=function(_0x3cbebb,_0x8ccd1c){_0x3cbebb=_0x3cbebb-0x0;var _0x357828=_0x8380[_0x3cbebb];return _0x357828;};'use strict';var EventEmitter=require(_0x0838('0x0'));var UserNotification=require(_0x0838('0x1'))['db'][_0x0838('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0838('0x3')](0x0);var events={'afterCreate':_0x0838('0x4'),'afterUpdate':'update','afterDestroy':_0x0838('0x5')};function emitEvent(_0x2ba1f0){return function(_0x4bf589,_0x54f912,_0x15ff52){UserNotificationEvents[_0x0838('0x6')](_0x2ba1f0+':'+_0x4bf589['id'],_0x4bf589);UserNotificationEvents['emit'](_0x2ba1f0,_0x4bf589);_0x15ff52(null);};}for(var e in events){if(events[_0x0838('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x0838('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 70313a9..58a641f 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 _0xbf22=['bluebird','path','rimraf','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0xbf22,0x10d));var _0x2bf2=function(_0x3b5a3a,_0x5b89e4){_0x3b5a3a=_0x3b5a3a-0x0;var _0xcb960c=_0xbf22[_0x3b5a3a];return _0xcb960c;};'use strict';var _=require(_0x2bf2('0x0'));var util=require(_0x2bf2('0x1'));var logger=require('../../config/logger')(_0x2bf2('0x2'));var moment=require(_0x2bf2('0x3'));var BPromise=require(_0x2bf2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bf2('0x5'));var rimraf=require(_0x2bf2('0x6'));var config=require('../../config/environment');var attributes=require(_0x2bf2('0x7'));module['exports']=function(_0x345a1f,_0x43215a){return _0x345a1f[_0x2bf2('0x8')](_0x2bf2('0x9'),attributes,{'tableName':_0x2bf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2bf2('0xb'),'collate':_0x2bf2('0xc')});}; \ No newline at end of file +var _0xc415=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications'];(function(_0x585a22,_0x1d37b7){var _0xb45593=function(_0x5cbee7){while(--_0x5cbee7){_0x585a22['push'](_0x585a22['shift']());}};_0xb45593(++_0x1d37b7);}(_0xc415,0x114));var _0x5c41=function(_0x1e7e7e,_0x361d31){_0x1e7e7e=_0x1e7e7e-0x0;var _0xaf5a11=_0xc415[_0x1e7e7e];return _0xaf5a11;};'use strict';var _=require(_0x5c41('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5c41('0x1'));var moment=require(_0x5c41('0x2'));var BPromise=require(_0x5c41('0x3'));var rp=require(_0x5c41('0x4'));var fs=require('fs');var path=require(_0x5c41('0x5'));var rimraf=require(_0x5c41('0x6'));var config=require(_0x5c41('0x7'));var attributes=require(_0x5c41('0x8'));module['exports']=function(_0x2e083b,_0x4de82a){return _0x2e083b[_0x5c41('0x9')](_0x5c41('0xa'),attributes,{'tableName':_0x5c41('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 c5d8c49..986fe49 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 _0x4eac=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','result','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4eac,0x1b9));var _0xc4ea=function(_0x6835c8,_0x15fd4d){_0x6835c8=_0x6835c8-0x0;var _0xbe7cc=_0x4eac[_0x6835c8];return _0xbe7cc;};'use strict';var _=require('lodash');var util=require(_0xc4ea('0x0'));var moment=require(_0xc4ea('0x1'));var BPromise=require(_0xc4ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4ea('0x3'));var db=require(_0xc4ea('0x4'))['db'];var utils=require(_0xc4ea('0x5'));var logger=require(_0xc4ea('0x6'))('rpc');var config=require(_0xc4ea('0x7'));var jayson=require(_0xc4ea('0x8'));var client=jayson[_0xc4ea('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc4ea('0xa')],{'host':_0xc4ea('0xb'),'port':0x18eb});var socket=require(_0xc4ea('0xc'))(new Redis(config['redis']));require(_0xc4ea('0xd'))[_0xc4ea('0xe')](socket);function respondWithRpcPromise(_0x43f36d,_0x37710a,_0x441683){return new BPromise(function(_0x430122,_0x4d6da0){return client[_0xc4ea('0xf')](_0x43f36d,_0x441683)['then'](function(_0x8428f7){logger['info']('UserNotification,\x20%s,\x20%s',_0x37710a,_0xc4ea('0x10'));logger[_0xc4ea('0x11')](_0xc4ea('0x12'),_0x37710a,_0xc4ea('0x10'),JSON[_0xc4ea('0x13')](_0x8428f7));if(_0x8428f7[_0xc4ea('0x14')]){if(_0x8428f7['error'][_0xc4ea('0x15')]===0x1f4){logger[_0xc4ea('0x14')](_0xc4ea('0x16'),_0x37710a,_0x8428f7[_0xc4ea('0x14')]['message']);return _0x4d6da0(_0x8428f7[_0xc4ea('0x14')][_0xc4ea('0x17')]);}logger[_0xc4ea('0x14')](_0xc4ea('0x16'),_0x37710a,_0x8428f7[_0xc4ea('0x14')]['message']);return _0x430122(_0x8428f7[_0xc4ea('0x14')][_0xc4ea('0x17')]);}else{logger[_0xc4ea('0x18')](_0xc4ea('0x16'),_0x37710a,_0xc4ea('0x10'));_0x430122(_0x8428f7[_0xc4ea('0x19')]['message']);}})['catch'](function(_0x236e9f){logger[_0xc4ea('0x14')](_0xc4ea('0x16'),_0x37710a,_0x236e9f);_0x4d6da0(_0x236e9f);});});} \ No newline at end of file +var _0x7bc2=['redis','localhost','socket.io-emitter','./userNotification.socket','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0x1d9f84,_0x14f190){var _0x148206=function(_0x37129b){while(--_0x37129b){_0x1d9f84['push'](_0x1d9f84['shift']());}};_0x148206(++_0x14f190);}(_0x7bc2,0x7e));var _0x27bc=function(_0x3b57a3,_0x4d7071){_0x3b57a3=_0x3b57a3-0x0;var _0x3e6391=_0x7bc2[_0x3b57a3];return _0x3e6391;};'use strict';var _=require(_0x27bc('0x0'));var util=require(_0x27bc('0x1'));var moment=require(_0x27bc('0x2'));var BPromise=require(_0x27bc('0x3'));var rs=require(_0x27bc('0x4'));var fs=require('fs');var Redis=require(_0x27bc('0x5'));var db=require(_0x27bc('0x6'))['db'];var utils=require(_0x27bc('0x7'));var logger=require(_0x27bc('0x8'))(_0x27bc('0x9'));var config=require(_0x27bc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x27bc('0xb')][_0x27bc('0xc')]({'port':0x232a});config['redis']=_[_0x27bc('0xd')](config[_0x27bc('0xe')],{'host':_0x27bc('0xf'),'port':0x18eb});var socket=require(_0x27bc('0x10'))(new Redis(config[_0x27bc('0xe')]));require(_0x27bc('0x11'))['register'](socket);function respondWithRpcPromise(_0x85cdfa,_0x3865d5,_0x1bb131){return new BPromise(function(_0x40f2a3,_0x5541cc){return client['request'](_0x85cdfa,_0x1bb131)['then'](function(_0x517cad){logger['info'](_0x27bc('0x12'),_0x3865d5,_0x27bc('0x13'));logger[_0x27bc('0x14')](_0x27bc('0x15'),_0x3865d5,_0x27bc('0x13'),JSON[_0x27bc('0x16')](_0x517cad));if(_0x517cad[_0x27bc('0x17')]){if(_0x517cad['error']['code']===0x1f4){logger[_0x27bc('0x17')](_0x27bc('0x12'),_0x3865d5,_0x517cad['error'][_0x27bc('0x18')]);return _0x5541cc(_0x517cad[_0x27bc('0x17')][_0x27bc('0x18')]);}logger[_0x27bc('0x17')](_0x27bc('0x12'),_0x3865d5,_0x517cad['error']['message']);return _0x40f2a3(_0x517cad['error']['message']);}else{logger[_0x27bc('0x19')](_0x27bc('0x12'),_0x3865d5,_0x27bc('0x13'));_0x40f2a3(_0x517cad[_0x27bc('0x1a')][_0x27bc('0x18')]);}})[_0x27bc('0x1b')](function(_0x12a83c){logger[_0x27bc('0x17')](_0x27bc('0x12'),_0x3865d5,_0x12a83c);_0x5541cc(_0x12a83c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 66565ac..3b4a7b6 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 _0x28bf=['register','length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener'];(function(_0x27bc12,_0x3c49e1){var _0x427d0f=function(_0x15f509){while(--_0x15f509){_0x27bc12['push'](_0x27bc12['shift']());}};_0x427d0f(++_0x3c49e1);}(_0x28bf,0x11a));var _0xf28b=function(_0x5c6465,_0x480958){_0x5c6465=_0x5c6465-0x0;var _0x28243e=_0x28bf[_0x5c6465];return _0x28243e;};'use strict';var UserNotificationEvents=require(_0xf28b('0x0'));var events=[_0xf28b('0x1'),_0xf28b('0x2'),_0xf28b('0x3')];function createListener(_0x2909aa,_0x13976d){return function(_0x211926){_0x13976d[_0xf28b('0x4')](_0x2909aa,_0x211926);};}function removeListener(_0x424461,_0x5d7506){return function(){UserNotificationEvents[_0xf28b('0x5')](_0x424461,_0x5d7506);};}exports[_0xf28b('0x6')]=function(_0x235a7c){for(var _0x4442cb=0x0,_0x1a5121=events[_0xf28b('0x7')];_0x4442cb<_0x1a5121;_0x4442cb++){var _0x44cf73=events[_0x4442cb];var _0x10b2db=createListener(_0xf28b('0x8')+_0x44cf73,_0x235a7c);UserNotificationEvents['on'](_0x44cf73,_0x10b2db);}}; \ No newline at end of file +var _0x41e9=['register','length','./userNotification.events','save','remove','emit'];(function(_0xcf569a,_0x328a49){var _0x48731c=function(_0x4aa5e1){while(--_0x4aa5e1){_0xcf569a['push'](_0xcf569a['shift']());}};_0x48731c(++_0x328a49);}(_0x41e9,0x17c));var _0x941e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x41e9[_0x4a9fb1];return _0x348672;};'use strict';var UserNotificationEvents=require(_0x941e('0x0'));var events=[_0x941e('0x1'),_0x941e('0x2'),'update'];function createListener(_0x1486e2,_0x2c0bd6){return function(_0x49a86c){_0x2c0bd6[_0x941e('0x3')](_0x1486e2,_0x49a86c);};}function removeListener(_0x420c4a,_0x457e4a){return function(){UserNotificationEvents['removeListener'](_0x420c4a,_0x457e4a);};}exports[_0x941e('0x4')]=function(_0xc9eee){for(var _0x584a3b=0x0,_0x28f555=events[_0x941e('0x5')];_0x584a3b<_0x28f555;_0x584a3b++){var _0x16606c=events[_0x584a3b];var _0xafc00c=createListener('userNotification:'+_0x16606c,_0xc9eee);UserNotificationEvents['on'](_0x16606c,_0xafc00c);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 180203f..11b7b7f 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2037f3,_0x20919c){var _0x3301cd=function(_0x4aee00){while(--_0x4aee00){_0x2037f3['push'](_0x2037f3['shift']());}};_0x3301cd(++_0x20919c);}(_0xe706,0xa3));var _0x6e70=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0xe706[_0x5bf420];return _0x1c5255;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f2f5e,_0x20b368){var _0x3afa81=function(_0x3562e2){while(--_0x3562e2){_0x2f2f5e['push'](_0x2f2f5e['shift']());}};_0x3afa81(++_0x20b368);}(_0x70e0,0x17b));var _0x070e=function(_0x4d3435,_0x50227d){_0x4d3435=_0x4d3435-0x0;var _0x463482=_0x70e0[_0x4d3435];return _0x463482;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 2bee6b0..f1804bc 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 _0x5024=['INTEGER','sequelize','exports'];(function(_0xf200b2,_0x59538b){var _0x34f028=function(_0x259eb6){while(--_0x259eb6){_0xf200b2['push'](_0xf200b2['shift']());}};_0x34f028(++_0x59538b);}(_0x5024,0xf7));var _0x4502=function(_0x229f1b,_0x1eca63){_0x229f1b=_0x229f1b-0x0;var _0x7e7505=_0x5024[_0x229f1b];return _0x7e7505;};'use strict';var Sequelize=require(_0x4502('0x0'));module[_0x4502('0x1')]={'penalty':{'type':Sequelize[_0x4502('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2059=['exports','INTEGER','sequelize'];(function(_0x33bbd3,_0x80a34c){var _0x13f45f=function(_0x4852d1){while(--_0x4852d1){_0x33bbd3['push'](_0x33bbd3['shift']());}};_0x13f45f(++_0x80a34c);}(_0x2059,0x1be));var _0x9205=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x2059[_0x5ee3d3];return _0x4b272f;};'use strict';var Sequelize=require(_0x9205('0x0'));module[_0x9205('0x1')]={'penalty':{'type':Sequelize[_0x9205('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 5a35d48..ca965d2 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 _0x96fe=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','path','rimraf','../../config/environment'];(function(_0x1217b7,_0x14dfbc){var _0x331ddc=function(_0x366d8b){while(--_0x366d8b){_0x1217b7['push'](_0x1217b7['shift']());}};_0x331ddc(++_0x14dfbc);}(_0x96fe,0xdb));var _0xe96f=function(_0x418e5e,_0x198904){_0x418e5e=_0x418e5e-0x0;var _0x1f5053=_0x96fe[_0x418e5e];return _0x1f5053;};'use strict';var _=require(_0xe96f('0x0'));var util=require(_0xe96f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe96f('0x2'));var rimraf=require(_0xe96f('0x3'));var config=require(_0xe96f('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x190d58,_0x2a3d2a){return _0x190d58[_0xe96f('0x5')](_0xe96f('0x6'),attributes,{'tableName':_0xe96f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8327=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','moment','bluebird','request-promise','rimraf','./userOpenchannelQueue.attributes','exports','define'];(function(_0x1f8cf7,_0xc62474){var _0x5ac9d4=function(_0x5a6cf0){while(--_0x5a6cf0){_0x1f8cf7['push'](_0x1f8cf7['shift']());}};_0x5ac9d4(++_0xc62474);}(_0x8327,0x14c));var _0x7832=function(_0x398b38,_0x382922){_0x398b38=_0x398b38-0x0;var _0x10b0ac=_0x8327[_0x398b38];return _0x10b0ac;};'use strict';var _=require(_0x7832('0x0'));var util=require(_0x7832('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7832('0x2'));var BPromise=require(_0x7832('0x3'));var rp=require(_0x7832('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7832('0x5'));var config=require('../../config/environment');var attributes=require(_0x7832('0x6'));module[_0x7832('0x7')]=function(_0x430eb3,_0x177447){return _0x430eb3[_0x7832('0x8')](_0x7832('0x9'),attributes,{'tableName':_0x7832('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 6d9e2be..92bd84d 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 _0x876e=['bluebird','randomstring','ioredis','../../mysqldb','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','lodash','moment'];(function(_0x3090bf,_0xb0c4c0){var _0x323bc8=function(_0x34ff64){while(--_0x34ff64){_0x3090bf['push'](_0x3090bf['shift']());}};_0x323bc8(++_0xb0c4c0);}(_0x876e,0x11c));var _0xe876=function(_0x501259,_0x978360){_0x501259=_0x501259-0x0;var _0x5c6b45=_0x876e[_0x501259];return _0x5c6b45;};'use strict';var _=require(_0xe876('0x0'));var util=require('util');var moment=require(_0xe876('0x1'));var BPromise=require(_0xe876('0x2'));var rs=require(_0xe876('0x3'));var fs=require('fs');var Redis=require(_0xe876('0x4'));var db=require(_0xe876('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe876('0x6'));var client=jayson[_0xe876('0x7')][_0xe876('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33aff2,_0x33a2d6,_0x1955d4){return new BPromise(function(_0x1c99ef,_0x126752){return client[_0xe876('0x9')](_0x33aff2,_0x1955d4)[_0xe876('0xa')](function(_0x11ef08){logger[_0xe876('0xb')](_0xe876('0xc'),_0x33a2d6,_0xe876('0xd'));logger[_0xe876('0xe')](_0xe876('0xf'),_0x33a2d6,_0xe876('0xd'),JSON[_0xe876('0x10')](_0x11ef08));if(_0x11ef08[_0xe876('0x11')]){if(_0x11ef08[_0xe876('0x11')][_0xe876('0x12')]===0x1f4){logger[_0xe876('0x11')](_0xe876('0xc'),_0x33a2d6,_0x11ef08['error']['message']);return _0x126752(_0x11ef08[_0xe876('0x11')]['message']);}logger[_0xe876('0x11')](_0xe876('0xc'),_0x33a2d6,_0x11ef08[_0xe876('0x11')][_0xe876('0x13')]);return _0x1c99ef(_0x11ef08[_0xe876('0x11')][_0xe876('0x13')]);}else{logger[_0xe876('0xb')](_0xe876('0xc'),_0x33a2d6,_0xe876('0xd'));_0x1c99ef(_0x11ef08[_0xe876('0x14')][_0xe876('0x13')]);}})[_0xe876('0x15')](function(_0x2d6843){logger[_0xe876('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x33a2d6,_0x2d6843);_0x126752(_0x2d6843);});});} \ No newline at end of file +var _0x696e=['UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','then','info'];(function(_0x8ce6f6,_0x11c4e2){var _0x30d5d7=function(_0x90a59c){while(--_0x90a59c){_0x8ce6f6['push'](_0x8ce6f6['shift']());}};_0x30d5d7(++_0x11c4e2);}(_0x696e,0x1d1));var _0xe696=function(_0x3831be,_0x2026ea){_0x3831be=_0x3831be-0x0;var _0x4e25e5=_0x696e[_0x3831be];return _0x4e25e5;};'use strict';var _=require(_0xe696('0x0'));var util=require('util');var moment=require(_0xe696('0x1'));var BPromise=require(_0xe696('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe696('0x3'));var db=require(_0xe696('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe696('0x5'));var config=require(_0xe696('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe696('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23a678,_0x38a060,_0x50a97e){return new BPromise(function(_0x2d8a7f,_0x3d41d4){return client['request'](_0x23a678,_0x50a97e)[_0xe696('0x8')](function(_0x2db6f9){logger[_0xe696('0x9')](_0xe696('0xa'),_0x38a060,'request\x20sent');logger[_0xe696('0xb')](_0xe696('0xc'),_0x38a060,'request\x20sent',JSON[_0xe696('0xd')](_0x2db6f9));if(_0x2db6f9[_0xe696('0xe')]){if(_0x2db6f9[_0xe696('0xe')][_0xe696('0xf')]===0x1f4){logger[_0xe696('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x38a060,_0x2db6f9[_0xe696('0xe')]['message']);return _0x3d41d4(_0x2db6f9[_0xe696('0xe')]['message']);}logger[_0xe696('0xe')](_0xe696('0xa'),_0x38a060,_0x2db6f9[_0xe696('0xe')]['message']);return _0x2d8a7f(_0x2db6f9[_0xe696('0xe')][_0xe696('0x10')]);}else{logger[_0xe696('0x9')](_0xe696('0xa'),_0x38a060,_0xe696('0x11'));_0x2d8a7f(_0x2db6f9['result'][_0xe696('0x10')]);}})[_0xe696('0x12')](function(_0x38dadc){logger[_0xe696('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x38a060,_0x38dadc);_0x3d41d4(_0x38dadc);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 753760e..86eca5f 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 _0x5458=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','/:id/resources','addResources','put','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0x5458,0x14c));var _0x8545=function(_0x18385f,_0x22e8c2){_0x18385f=_0x18385f-0x0;var _0x295156=_0x5458[_0x18385f];return _0x295156;};'use strict';var multer=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var path=require(_0x8545('0x2'));var timeout=require(_0x8545('0x3'));var express=require(_0x8545('0x4'));var router=express[_0x8545('0x5')]();var fs_extra=require(_0x8545('0x6'));var auth=require(_0x8545('0x7'));var interaction=require(_0x8545('0x8'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x8545('0x9')]('/',auth[_0x8545('0xa')](),controller[_0x8545('0xb')]);router['get'](_0x8545('0xc'),auth[_0x8545('0xa')](),controller[_0x8545('0xd')]);router[_0x8545('0x9')](_0x8545('0xe'),auth[_0x8545('0xa')](),controller[_0x8545('0xf')]);router[_0x8545('0x9')](_0x8545('0x10'),auth['isAuthenticated'](),controller[_0x8545('0x11')]);router[_0x8545('0x9')]('/:id/resources',auth[_0x8545('0xa')](),controller[_0x8545('0x12')]);router[_0x8545('0x13')]('/',auth['isAuthenticated'](),controller[_0x8545('0x14')]);router[_0x8545('0x13')](_0x8545('0x15'),auth[_0x8545('0xa')](),controller[_0x8545('0x16')]);router[_0x8545('0x13')](_0x8545('0x10'),auth[_0x8545('0xa')](),controller['addSections']);router[_0x8545('0x13')](_0x8545('0x17'),auth[_0x8545('0xa')](),controller[_0x8545('0x18')]);router[_0x8545('0x19')](_0x8545('0xe'),auth[_0x8545('0xa')](),controller[_0x8545('0x1a')]);router[_0x8545('0x1b')](_0x8545('0xe'),auth[_0x8545('0xa')](),controller[_0x8545('0x1c')]);router[_0x8545('0x1b')](_0x8545('0x10'),auth['isAuthenticated'](),controller[_0x8545('0x1d')]);router[_0x8545('0x1b')]('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module[_0x8545('0x1e')]=router; \ No newline at end of file +var _0x2d05=['delete','destroy','removeSections','removeResources','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0x2d05,0x144));var _0x52d0=function(_0x1736cc,_0x4ae81a){_0x1736cc=_0x1736cc-0x0;var _0x2148a0=_0x2d05[_0x1736cc];return _0x2148a0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x52d0('0x0'));var timeout=require(_0x52d0('0x1'));var express=require(_0x52d0('0x2'));var router=express[_0x52d0('0x3')]();var fs_extra=require(_0x52d0('0x4'));var auth=require(_0x52d0('0x5'));var interaction=require(_0x52d0('0x6'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x52d0('0x7')]('/',auth[_0x52d0('0x8')](),controller[_0x52d0('0x9')]);router[_0x52d0('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x52d0('0x7')](_0x52d0('0xa'),auth[_0x52d0('0x8')](),controller[_0x52d0('0xb')]);router[_0x52d0('0x7')](_0x52d0('0xc'),auth[_0x52d0('0x8')](),controller[_0x52d0('0xd')]);router['get'](_0x52d0('0xe'),auth[_0x52d0('0x8')](),controller[_0x52d0('0xf')]);router[_0x52d0('0x10')]('/',auth[_0x52d0('0x8')](),controller[_0x52d0('0x11')]);router[_0x52d0('0x10')](_0x52d0('0x12'),auth[_0x52d0('0x8')](),controller[_0x52d0('0x13')]);router[_0x52d0('0x10')]('/:id/sections',auth['isAuthenticated'](),controller[_0x52d0('0x14')]);router[_0x52d0('0x10')](_0x52d0('0xe'),auth[_0x52d0('0x8')](),controller[_0x52d0('0x15')]);router[_0x52d0('0x16')](_0x52d0('0xa'),auth[_0x52d0('0x8')](),controller[_0x52d0('0x17')]);router[_0x52d0('0x18')](_0x52d0('0xa'),auth[_0x52d0('0x8')](),controller[_0x52d0('0x19')]);router[_0x52d0('0x18')]('/:id/sections',auth[_0x52d0('0x8')](),controller[_0x52d0('0x1a')]);router[_0x52d0('0x18')]('/:id/resources',auth[_0x52d0('0x8')](),controller[_0x52d0('0x1b')]);module[_0x52d0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 39a042d..9752efb 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 _0x0a4a=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','exports','STRING'];(function(_0x1617c7,_0x36be81){var _0x353aa0=function(_0x90605c){while(--_0x90605c){_0x1617c7['push'](_0x1617c7['shift']());}};_0x353aa0(++_0x36be81);}(_0x0a4a,0x116));var _0xa0a4=function(_0x3dbefd,_0x445e26){_0x3dbefd=_0x3dbefd-0x0;var _0x890456=_0x0a4a[_0x3dbefd];return _0x890456;};'use strict';var Sequelize=require('sequelize');module[_0xa0a4('0x0')]={'name':{'type':Sequelize[_0xa0a4('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xa0a4('0x1')],'set':function(_0x473d75){this[_0xa0a4('0x2')](_0xa0a4('0x3'),_0x473d75?_0x473d75[_0xa0a4('0x4')](''):[]);},'get':function(){return this[_0xa0a4('0x5')]('crudPermissions')?this[_0xa0a4('0x5')](_0xa0a4('0x3'))[_0xa0a4('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa0a4('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x4ea1=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','exports','STRING'];(function(_0x3903b2,_0x52d0f6){var _0x263c6a=function(_0x2aa309){while(--_0x2aa309){_0x3903b2['push'](_0x3903b2['shift']());}};_0x263c6a(++_0x52d0f6);}(_0x4ea1,0x116));var _0x14ea=function(_0x289921,_0xb32038){_0x289921=_0x289921-0x0;var _0x4ac780=_0x4ea1[_0x289921];return _0x4ac780;};'use strict';var Sequelize=require('sequelize');module[_0x14ea('0x0')]={'name':{'type':Sequelize[_0x14ea('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x14ea('0x1')],'set':function(_0x47bcc5){this[_0x14ea('0x2')](_0x14ea('0x3'),_0x47bcc5?_0x47bcc5[_0x14ea('0x4')](''):[]);},'get':function(){return this[_0x14ea('0x5')](_0x14ea('0x3'))?this[_0x14ea('0x5')](_0x14ea('0x3'))[_0x14ea('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x14ea('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x14ea('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x14ea('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x14ea('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 d61449f..a00908f 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 _0xb2f3=['removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','sequelize','bulkCreate','removeResources','section','Missing\x20section\x20parameter','nolimit','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','UserProfile','includeAll','rows','catch','show','params','rawAttributes','include','find','create','clone','omit','createdAt','crudPermissions','body','updatedAt','get','findAll','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','update','describe','addSections','transaction','each'];(function(_0x41e75c,_0x58592e){var _0xd75e28=function(_0x1fbf1c){while(--_0x1fbf1c){_0x41e75c['push'](_0x41e75c['shift']());}};_0xd75e28(++_0x58592e);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xb2f3[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0x3b2f('0x0'));var rimraf=require(_0x3b2f('0x1'));var zipdir=require(_0x3b2f('0x2'));var jsonpatch=require(_0x3b2f('0x3'));var rp=require(_0x3b2f('0x4'));var moment=require(_0x3b2f('0x5'));var BPromise=require(_0x3b2f('0x6'));var Mustache=require('mustache');var util=require(_0x3b2f('0x7'));var path=require(_0x3b2f('0x8'));var sox=require(_0x3b2f('0x9'));var csv=require(_0x3b2f('0xa'));var ejs=require(_0x3b2f('0xb'));var fs=require('fs');var fs_extra=require(_0x3b2f('0xc'));var _=require(_0x3b2f('0xd'));var squel=require('squel');var crypto=require(_0x3b2f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3b2f('0xf'));var toCsv=require(_0x3b2f('0xa'));var querystring=require(_0x3b2f('0x10'));var Papa=require(_0x3b2f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b2f('0x12'));var as=require(_0x3b2f('0x13'));var hardwareService=require(_0x3b2f('0x14'));var logger=require(_0x3b2f('0x15'))(_0x3b2f('0x16'));var utils=require(_0x3b2f('0x17'));var config=require(_0x3b2f('0x18'));var licenseUtil=require(_0x3b2f('0x19'));var db=require(_0x3b2f('0x1a'))['db'];config[_0x3b2f('0x1b')]=_[_0x3b2f('0x1c')](config[_0x3b2f('0x1b')],{'host':_0x3b2f('0x1d'),'port':0x18eb});var socket=require(_0x3b2f('0x1e'))(new Redis(config[_0x3b2f('0x1b')]));require('./userProfile.socket')[_0x3b2f('0x1f')](socket);function respondWithStatusCode(_0x4da3bd,_0x2ef8ca){_0x2ef8ca=_0x2ef8ca||0xcc;return function(_0x42477c){if(_0x42477c){return _0x4da3bd['sendStatus'](_0x2ef8ca);}return _0x4da3bd[_0x3b2f('0x20')](_0x2ef8ca)['end']();};}function respondWithResult(_0x3c0b3f,_0x3aa3d6){_0x3aa3d6=_0x3aa3d6||0xc8;return function(_0xd5a583){if(_0xd5a583){return _0x3c0b3f[_0x3b2f('0x20')](_0x3aa3d6)['json'](_0xd5a583);}};}function respondWithFilteredResult(_0x52e91d,_0x4756f0){return function(_0x6d8948){if(_0x6d8948){var _0x3ff190=typeof _0x4756f0[_0x3b2f('0x21')]===_0x3b2f('0x22')&&typeof _0x4756f0[_0x3b2f('0x23')]===_0x3b2f('0x22');var _0x3d94c0=_0x6d8948[_0x3b2f('0x24')];var _0x22db91=_0x3ff190?0x0:_0x4756f0[_0x3b2f('0x21')];var _0x2116aa=_0x3ff190?_0x6d8948[_0x3b2f('0x24')]:_0x4756f0[_0x3b2f('0x21')]+_0x4756f0['limit'];var _0x6fdf3f;if(_0x2116aa>=_0x3d94c0){_0x2116aa=_0x3d94c0;_0x6fdf3f=0xc8;}else{_0x6fdf3f=0xce;}_0x52e91d[_0x3b2f('0x20')](_0x6fdf3f);return _0x52e91d[_0x3b2f('0x25')](_0x3b2f('0x26'),_0x22db91+'-'+_0x2116aa+'/'+_0x3d94c0)['json'](_0x6d8948);}return null;};}function patchUpdates(_0x1476a0){return function(_0x3d270b){try{jsonpatch['apply'](_0x3d270b,_0x1476a0,!![]);}catch(_0x429649){return BPromise['reject'](_0x429649);}return _0x3d270b[_0x3b2f('0x27')]();};}function saveUpdates(_0x94aced,_0x267fa5){return function(_0x409401){if(_0x409401){return _0x409401['update'](_0x94aced)[_0x3b2f('0x28')](function(_0x2ee755){return _0x2ee755;});}return null;};}function removeEntity(_0x48592c,_0x4db72f){return function(_0x11e9e7){if(_0x11e9e7){return _0x11e9e7[_0x3b2f('0x29')]()[_0x3b2f('0x28')](function(){_0x48592c[_0x3b2f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x511360,_0x14fac0){return function(_0x5a39f0){if(!_0x5a39f0){_0x511360[_0x3b2f('0x2a')](0x194);}return _0x5a39f0;};}function handleError(_0x2a9afe,_0x536323){_0x536323=_0x536323||0x1f4;return function(_0x39f342){logger['error'](_0x39f342[_0x3b2f('0x2b')]);if(_0x39f342[_0x3b2f('0x2c')]){delete _0x39f342[_0x3b2f('0x2c')];}_0x2a9afe[_0x3b2f('0x20')](_0x536323)[_0x3b2f('0x2d')](_0x39f342);};}exports[_0x3b2f('0x2e')]=function(_0x593f3d,_0x1fbcb6){var _0x335e75={},_0x5d247c={},_0x500e82={'count':0x0,'rows':[]};var _0x450080=_[_0x3b2f('0x2f')](db['UserProfile']['rawAttributes'],function(_0x158628){return{'name':_0x158628[_0x3b2f('0x30')],'type':_0x158628[_0x3b2f('0x31')][_0x3b2f('0x32')]};});_0x5d247c[_0x3b2f('0x33')]=_[_0x3b2f('0x2f')](_0x450080,'name');_0x5d247c[_0x3b2f('0x34')]=_[_0x3b2f('0x35')](_0x593f3d['query']);_0x5d247c[_0x3b2f('0x36')]=_[_0x3b2f('0x37')](_0x5d247c[_0x3b2f('0x33')],_0x5d247c[_0x3b2f('0x34')]);_0x335e75['attributes']=_[_0x3b2f('0x37')](_0x5d247c[_0x3b2f('0x33')],qs[_0x3b2f('0x38')](_0x593f3d[_0x3b2f('0x34')]['fields']));_0x335e75['attributes']=_0x335e75[_0x3b2f('0x39')][_0x3b2f('0x3a')]?_0x335e75[_0x3b2f('0x39')]:_0x5d247c[_0x3b2f('0x33')];if(!_0x593f3d[_0x3b2f('0x34')]['hasOwnProperty']('nolimit')){_0x335e75[_0x3b2f('0x23')]=qs[_0x3b2f('0x23')](_0x593f3d[_0x3b2f('0x34')]['limit']);_0x335e75[_0x3b2f('0x21')]=qs[_0x3b2f('0x21')](_0x593f3d[_0x3b2f('0x34')]['offset']);}_0x335e75[_0x3b2f('0x3b')]=qs[_0x3b2f('0x3c')](_0x593f3d[_0x3b2f('0x34')]['sort']);_0x335e75['where']=qs[_0x3b2f('0x36')](_['pick'](_0x593f3d['query'],_0x5d247c[_0x3b2f('0x36')]),_0x450080);if(_0x593f3d[_0x3b2f('0x34')]['filter']){_0x335e75[_0x3b2f('0x3d')]=_[_0x3b2f('0x3e')](_0x335e75[_0x3b2f('0x3d')],{'$or':_[_0x3b2f('0x2f')](_0x450080,function(_0x2b4a2b){if(_0x2b4a2b[_0x3b2f('0x31')]!==_0x3b2f('0x3f')){var _0x1b0e8e={};_0x1b0e8e[_0x2b4a2b['name']]={'$like':'%'+_0x593f3d[_0x3b2f('0x34')][_0x3b2f('0x40')]+'%'};return _0x1b0e8e;}})});}_0x335e75=_[_0x3b2f('0x3e')]({},_0x335e75,_0x593f3d[_0x3b2f('0x41')]);var _0x2f3691={'where':_0x335e75[_0x3b2f('0x3d')]};return db[_0x3b2f('0x42')][_0x3b2f('0x24')](_0x2f3691)[_0x3b2f('0x28')](function(_0x507813){_0x500e82[_0x3b2f('0x24')]=_0x507813;if(_0x593f3d[_0x3b2f('0x34')][_0x3b2f('0x43')]){_0x335e75['include']=[{'all':!![]}];}return db[_0x3b2f('0x42')]['findAll'](_0x335e75);})[_0x3b2f('0x28')](function(_0x23b747){_0x500e82[_0x3b2f('0x44')]=_0x23b747;return _0x500e82;})[_0x3b2f('0x28')](respondWithFilteredResult(_0x1fbcb6,_0x335e75))[_0x3b2f('0x45')](handleError(_0x1fbcb6,null));};exports[_0x3b2f('0x46')]=function(_0x4bc44c,_0x3417bc){var _0x4c6a74={'raw':![],'where':{'id':_0x4bc44c[_0x3b2f('0x47')]['id']}},_0x1e3fd4={};_0x1e3fd4['model']=_[_0x3b2f('0x35')](db[_0x3b2f('0x42')][_0x3b2f('0x48')]);_0x1e3fd4[_0x3b2f('0x34')]=_[_0x3b2f('0x35')](_0x4bc44c['query']);_0x1e3fd4['filters']=_[_0x3b2f('0x37')](_0x1e3fd4['model'],_0x1e3fd4[_0x3b2f('0x34')]);_0x4c6a74['attributes']=_[_0x3b2f('0x37')](_0x1e3fd4[_0x3b2f('0x33')],qs[_0x3b2f('0x38')](_0x4bc44c[_0x3b2f('0x34')]['fields']));_0x4c6a74[_0x3b2f('0x39')]=_0x4c6a74[_0x3b2f('0x39')][_0x3b2f('0x3a')]?_0x4c6a74['attributes']:_0x1e3fd4[_0x3b2f('0x33')];if(_0x4bc44c[_0x3b2f('0x34')][_0x3b2f('0x43')]){_0x4c6a74[_0x3b2f('0x49')]=[{'all':!![]}];}_0x4c6a74=_['merge']({},_0x4c6a74,_0x4bc44c[_0x3b2f('0x41')]);return db[_0x3b2f('0x42')][_0x3b2f('0x4a')](_0x4c6a74)[_0x3b2f('0x28')](handleEntityNotFound(_0x3417bc,null))[_0x3b2f('0x28')](respondWithResult(_0x3417bc,null))[_0x3b2f('0x45')](handleError(_0x3417bc,null));};exports[_0x3b2f('0x4b')]=function(_0x2e182e,_0x56be24){return db[_0x3b2f('0x42')][_0x3b2f('0x4b')](_0x2e182e['body'],{})['then'](respondWithResult(_0x56be24,0xc9))['catch'](handleError(_0x56be24,null));};exports[_0x3b2f('0x4c')]=function(_0x2ff96e,_0x38f615){var _0x2eabc2={'where':{'id':_0x2ff96e[_0x3b2f('0x47')]['id']}},_0x5cd3c0={};_0x5cd3c0[_0x3b2f('0x33')]=_['keys'](db['UserProfile']['rawAttributes']);_0x2eabc2[_0x3b2f('0x39')]=_[_0x3b2f('0x37')](_0x5cd3c0['model'],qs['fields'](_0x2ff96e['query']['fields']));_0x2eabc2[_0x3b2f('0x39')]=_0x2eabc2[_0x3b2f('0x39')][_0x3b2f('0x3a')]?_0x2eabc2[_0x3b2f('0x39')]:_0x5cd3c0['model'];if(_0x2ff96e[_0x3b2f('0x34')]['includeAll']){_0x2eabc2[_0x3b2f('0x49')]=[{'all':!![]}];}_0x2eabc2=_[_0x3b2f('0x3e')]({},_0x2eabc2,_0x2ff96e[_0x3b2f('0x41')]);return db[_0x3b2f('0x42')]['find'](_0x2eabc2)['then'](handleEntityNotFound(_0x38f615,null))['then'](function(_0x500f77){if(_0x500f77){var _0xa5f372=_0x500f77['get']({'plain':!![]});_0xa5f372=qs[_0x3b2f('0x4d')](_0xa5f372,['id',_0x3b2f('0x4e'),'updatedAt',_0x3b2f('0x4f')]);_0x2ff96e[_0x3b2f('0x50')]=_[_0x3b2f('0x4d')](_0x2ff96e['body'],['id',_0x3b2f('0x4e'),_0x3b2f('0x51')]);return db['sequelize']['transaction'](function(_0x2f83d6){return db[_0x3b2f('0x42')][_0x3b2f('0x4b')](_[_0x3b2f('0x3e')](_0xa5f372,_0x2ff96e['body']),{'include':_0x2ff96e[_0x3b2f('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2f83d6})[_0x3b2f('0x28')](function(_0x47951d){var _0x3daf82=_0x47951d[_0x3b2f('0x52')]({'plain':!![]});return db['UserProfileSection'][_0x3b2f('0x53')]({'where':{'userProfileId':_0x2ff96e[_0x3b2f('0x47')]['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x5710a3){if(_0x5710a3){return BPromise['each'](_0x5710a3,function(_0x27fcc4){return new BPromise(function(_0x145de5,_0x228534){if(_0x27fcc4[_0x3b2f('0x54')]===null||_0x27fcc4[_0x3b2f('0x54')]===0x1)_0x145de5(null);return db['UserProfileResource'][_0x3b2f('0x53')]({'where':{'sectionId':_0x27fcc4['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x300975){var _0x1ec965=_[_0x3b2f('0x2f')](_0x300975,function(_0x1871cc){return qs['omit'](_0x1871cc,['id',_0x3b2f('0x4e'),'updatedAt',_0x3b2f('0x55')]);});_0x145de5(_0x1ec965);})['catch'](function(_0x5e8b55){_0x228534(_0x5e8b55);});})['then'](function(_0x57d08b){var _0x2a183a=qs[_0x3b2f('0x4d')](_0x27fcc4,['id','createdAt',_0x3b2f('0x51')]);_0x2a183a[_0x3b2f('0x56')]=_0x3daf82['id'];if(_0x57d08b)_0x2a183a[_0x3b2f('0x57')]=_0x57d08b;return _0x2a183a;})['then'](function(_0x5c7f9c){return db[_0x3b2f('0x58')][_0x3b2f('0x4b')](_0x5c7f9c,{'include':[{'model':db[_0x3b2f('0x59')],'as':_0x3b2f('0x57')}],'raw':!![],'transaction':_0x2f83d6});});})[_0x3b2f('0x28')](function(){return _0x3daf82;});}});});});}})['then'](respondWithResult(_0x38f615,0xc9))[_0x3b2f('0x45')](handleError(_0x38f615,null));};exports[_0x3b2f('0x5a')]=function(_0x39538f,_0x1325fa){if(_0x39538f[_0x3b2f('0x50')]['id']){delete _0x39538f[_0x3b2f('0x50')]['id'];}return db[_0x3b2f('0x42')][_0x3b2f('0x4a')]({'where':{'id':_0x39538f[_0x3b2f('0x47')]['id']}})[_0x3b2f('0x28')](handleEntityNotFound(_0x1325fa,null))[_0x3b2f('0x28')](saveUpdates(_0x39538f[_0x3b2f('0x50')],null))[_0x3b2f('0x28')](respondWithResult(_0x1325fa,null))[_0x3b2f('0x45')](handleError(_0x1325fa,null));};exports['destroy']=function(_0x55bc41,_0xfd3e77){return db[_0x3b2f('0x42')]['find']({'where':{'id':_0x55bc41[_0x3b2f('0x47')]['id']}})[_0x3b2f('0x28')](handleEntityNotFound(_0xfd3e77,null))[_0x3b2f('0x28')](removeEntity(_0xfd3e77,null))[_0x3b2f('0x45')](handleError(_0xfd3e77,null));};exports[_0x3b2f('0x5b')]=function(_0x1ded44,_0x42e512){return db[_0x3b2f('0x42')][_0x3b2f('0x5b')]()['then'](respondWithResult(_0x42e512,null))[_0x3b2f('0x45')](handleError(_0x42e512,null));};exports[_0x3b2f('0x5c')]=function(_0x574e48,_0x37648b){var _0x3399e7=_0x574e48[_0x3b2f('0x50')];return db[_0x3b2f('0x42')][_0x3b2f('0x4a')]({'where':{'id':_0x574e48['params']['id']}})['then'](handleEntityNotFound(_0x37648b,null))[_0x3b2f('0x28')](function(_0x1efdb7){if(_0x1efdb7){return db['sequelize'][_0x3b2f('0x5d')](function(_0x16785b){return db[_0x3b2f('0x58')][_0x3b2f('0x29')]({'where':{'userProfileId':_0x574e48['params']['id'],'sectionId':_[_0x3b2f('0x2f')](_0x3399e7,function(_0x23087d){return _0x23087d[_0x3b2f('0x55')];})},'transaction':_0x16785b})[_0x3b2f('0x28')](function(){var _0xa932e8=_['map'](_0x3399e7,function(_0x4ef0be){_0x4ef0be[_0x3b2f('0x56')]=_0x574e48[_0x3b2f('0x47')]['id'];return _0x4ef0be;});var _0x11bbed=[];return BPromise[_0x3b2f('0x5e')](_0xa932e8,function(_0x171ba4){return db[_0x3b2f('0x58')]['create'](_0x171ba4,{'include':[{'model':db[_0x3b2f('0x59')],'as':_0x3b2f('0x57')}],'raw':!![],'transaction':_0x16785b})['then'](function(_0x4d433c){_0x11bbed['push'](_0x4d433c[_0x3b2f('0x52')]({'plain':!![]}));});})['then'](function(){return _0x11bbed;});});});}})['then'](function(_0x46ef22){return _0x46ef22;})[_0x3b2f('0x28')](respondWithResult(_0x37648b,null))[_0x3b2f('0x45')](handleError(_0x37648b,null));};exports[_0x3b2f('0x5f')]=function(_0xf1a384,_0x3c9de5){var _0x242389;return db['UserProfile'][_0x3b2f('0x4a')]({'where':{'id':_0xf1a384[_0x3b2f('0x47')]['id']},'attributes':['id','name']})[_0x3b2f('0x28')](handleEntityNotFound(_0x3c9de5,null))['then'](function(_0x50ddca){if(_0x50ddca){_0x242389=_0x50ddca;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0xf1a384[_0x3b2f('0x47')]['id'],'sectionId':_0xf1a384['query'][_0x3b2f('0x60')]}});}})[_0x3b2f('0x28')](function(){return _0x242389;})['then'](respondWithStatusCode(_0x3c9de5,null))[_0x3b2f('0x45')](handleError(_0x3c9de5,null));};exports[_0x3b2f('0x61')]=function(_0x1c25b2,_0x1f8c03){var _0x11199f=[];var _0x11f280=[];return db[_0x3b2f('0x58')]['findAll']({'where':{'userProfileId':_0x1c25b2['params']['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0xde8946){_0x11199f=_['filter'](_0xde8946,function(_0x5b5b91){return _0x5b5b91[_0x3b2f('0x62')]===0x1||_[_0x3b2f('0x63')]([0x3eb,0x709],_0x5b5b91[_0x3b2f('0x55')]);});if(!_[_0x3b2f('0x64')](_0x11199f)){return _[_0x3b2f('0x2f')](_0x11199f,function(_0x6732d7){return _0x6732d7[_0x3b2f('0x55')];});}else{return;}})[_0x3b2f('0x28')](function(_0x88576b){if(_0x88576b)_0x11f280=_0x88576b;if(_[_0x3b2f('0x63')](_0x11f280,0x64)){var _0x2b24b5=_[_0x3b2f('0x4a')](_0x11199f,{'sectionId':0x64});return hasDefaultDashboard(_0x2b24b5)['then'](function(_0x7b0ed3){return _['map'](_0x11199f,function(_0x500dcd){if(_0x500dcd[_0x3b2f('0x55')]===0x64){_0x500dcd['subsections']=_0x7b0ed3;}return _0x500dcd;});});}else{return;}})[_0x3b2f('0x28')](function(_0x4abe6a){if(_0x4abe6a)_0x11199f=_0x4abe6a;if(_[_0x3b2f('0x63')](_0x11f280,0x3eb)){var _0x1dd448=_[_0x3b2f('0x4a')](_0x11199f,{'sectionId':0x3eb});return getCustomDashboards(_0x1dd448)['then'](function(_0x54ecee){return _['map'](_0x11199f,function(_0x42b3b8){if(_0x1dd448['enabled']){if(_0x42b3b8[_0x3b2f('0x55')]===0x3eb){_0x42b3b8[_0x3b2f('0x65')]=_0x54ecee;}}else{if(_0x42b3b8[_0x3b2f('0x55')]===0x64){_0x42b3b8[_0x3b2f('0x65')]=_0x54ecee;}}return _0x42b3b8;});});}else{return;}})[_0x3b2f('0x28')](function(_0x16bcb8){if(_0x16bcb8)_0x11199f=_0x16bcb8;if(_[_0x3b2f('0x63')](_0x11f280,0x709)){var _0x57b5ae=_[_0x3b2f('0x4a')](_0x11199f,{'sectionId':0x709});return getPlugins(_0x57b5ae)['then'](function(_0x361d79){if(_0x57b5ae['enabled']){return _['map'](_0x11199f,function(_0x35232d){if(_0x35232d[_0x3b2f('0x55')]===0x709){_0x35232d[_0x3b2f('0x65')]=_0x361d79;}return _0x35232d;});}else{var _0x4d5dae={'sectionId':0x76c,'enabled':0x1,'subsections':_0x361d79};var _0x55746a=_['map'](_0x11199f);_0x55746a[_0x3b2f('0x66')](_0x4d5dae);return _0x55746a;}});}else{return;}})[_0x3b2f('0x28')](function(_0x1c2136){if(_0x1c2136)_0x11199f=_0x1c2136;return _[_0x3b2f('0x40')](_0x11199f,[_0x3b2f('0x62'),0x1]);})[_0x3b2f('0x28')](respondWithResult(_0x1f8c03,null))['catch'](handleError(_0x1f8c03,null));};function hasDefaultDashboard(_0x484d07){var _0x460d1f=[0x65];return new BPromise(function(_0x4dd272,_0x4496fe){try{if(_0x484d07[_0x3b2f('0x54')]){_0x4dd272(_0x460d1f);}else{return db['UserProfileResource'][_0x3b2f('0x67')]({'where':{'sectionId':_0x484d07['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x5c991b){_0x5c991b?_0x4dd272(_0x460d1f):_0x4dd272();});}}catch(_0xf5d8a9){_0x4496fe(_0xf5d8a9);}});}function getCustomDashboards(_0x35c056){var _0x172a09=[];return new BPromise(function(_0x5abc09,_0x3e5d8c){try{if(_0x35c056[_0x3b2f('0x54')]){return db[_0x3b2f('0x68')][_0x3b2f('0x53')]({'raw':!![]})[_0x3b2f('0x28')](function(_0x32f0d8){_0x32f0d8[_0x3b2f('0x69')](function(_0x20fd6a){_0x172a09[_0x3b2f('0x66')](_0x20fd6a['id']+0x1869f);});_0x5abc09(_0x172a09);});}else{return db['UserProfileResource'][_0x3b2f('0x53')]({'where':{'sectionId':_0x35c056['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x5adafe){_0x5adafe['forEach'](function(_0x2e3bf5){_0x172a09[_0x3b2f('0x66')](_0x2e3bf5[_0x3b2f('0x6a')]+0x1869f);});_0x5abc09(_0x172a09);});}}catch(_0x135dd1){_0x3e5d8c(_0x135dd1);}});}function getPlugins(_0x54873f){var _0x292991=[];return new BPromise(function(_0x484294,_0x450f1a){try{if(_0x54873f['autoAssociation']){return db[_0x3b2f('0x6b')][_0x3b2f('0x53')]({'raw':!![]})[_0x3b2f('0x28')](function(_0xc4839f){_0xc4839f['forEach'](function(_0x52f091){_0x292991[_0x3b2f('0x66')](_0x52f091['id']+0x15b38);});_0x484294(_0x292991);});}else{return db[_0x3b2f('0x59')]['findAll']({'where':{'sectionId':_0x54873f['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x295b7b){_0x295b7b[_0x3b2f('0x69')](function(_0x47557d){_0x292991[_0x3b2f('0x66')](_0x47557d['resourceId']+0x15b38);});_0x484294(_0x292991);});}}catch(_0x473b01){_0x450f1a(_0x473b01);}});}exports[_0x3b2f('0x6c')]=function(_0x3db90f,_0x431942){return db['UserProfile']['find']({'where':{'id':_0x3db90f[_0x3b2f('0x47')]['id']}})[_0x3b2f('0x28')](handleEntityNotFound(_0x431942,null))[_0x3b2f('0x28')](function(_0x3fb0f8){if(_0x3fb0f8){return db[_0x3b2f('0x6d')][_0x3b2f('0x5d')](function(_0x151a21){return db['UserProfileSection'][_0x3b2f('0x53')]({'where':{'userProfileId':_0x3db90f['params']['id']},'attributes':['id'],'raw':!![]})[_0x3b2f('0x28')](function(_0x464c15){if(_0x464c15){return db[_0x3b2f('0x58')][_0x3b2f('0x29')]({'where':{'userProfileId':_0x3db90f[_0x3b2f('0x47')]['id'],'id':_[_0x3b2f('0x2f')](_0x464c15,function(_0x338d00){return _0x338d00['id'];})},'transaction':_0x151a21});}})[_0x3b2f('0x28')](function(_0x5f1be9){var _0x2eeb26=_['map'](_0x3db90f[_0x3b2f('0x50')],function(_0x3b6d14){_0x3b6d14[_0x3b2f('0x56')]=_0x3db90f[_0x3b2f('0x47')]['id'];return _0x3b6d14;});return db['UserProfileSection'][_0x3b2f('0x6e')](_0x2eeb26,{'raw':!![],'transaction':_0x151a21});})['then'](function(_0x77e415){var _0x4e85ec=_[_0x3b2f('0x40')](_[_0x3b2f('0x2f')](_0x77e415,function(_0x459e3b){return _0x459e3b[_0x3b2f('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x4e85ec){return db[_0x3b2f('0x58')][_0x3b2f('0x53')]({'where':{'userProfileId':_0x3db90f['params']['id'],'sectionId':_[_0x3b2f('0x2f')](_0x4e85ec,function(_0x1a1978){return _0x1a1978['sectionId'];})},'attributes':['id',_0x3b2f('0x55')],'raw':!![]})[_0x3b2f('0x28')](function(_0x5a9ef5){var _0x26860b=_['map'](_0x3db90f[_0x3b2f('0x50')],function(_0x4908c4){_0x4908c4[_0x3b2f('0x56')]=_0x3db90f[_0x3b2f('0x47')]['id'];return _0x4908c4;});return db[_0x3b2f('0x59')][_0x3b2f('0x6e')](_0x26860b,{'raw':!![],'transaction':_0x151a21});});}})[_0x3b2f('0x45')](handleError(_0x431942,null));});}})['then'](function(_0x4415ff){var _0x2403f3=_[_0x3b2f('0x2f')](_0x4415ff,function(_0x3d6d78){return _0x3d6d78[_0x3b2f('0x52')]({'plain':!![]});});})[_0x3b2f('0x28')](respondWithResult(_0x431942,null))[_0x3b2f('0x45')](handleError(_0x431942,null));};exports[_0x3b2f('0x6f')]=function(_0xf2a343,_0x36cbb0,_0x5f2643){return db[_0x3b2f('0x42')][_0x3b2f('0x4a')]({'where':{'id':_0xf2a343[_0x3b2f('0x47')]['id']}})['then'](handleEntityNotFound(_0x36cbb0,null))[_0x3b2f('0x28')](function(_0x55dd1f){if(_0x55dd1f){return _0x55dd1f[_0x3b2f('0x6f')](_0xf2a343[_0x3b2f('0x34')][_0x3b2f('0x60')]);}})['then'](respondWithStatusCode(_0x36cbb0,null))['catch'](handleError(_0x36cbb0,null));};exports['getResources']=function(_0x5abd58,_0x99c604){var _0x4189ec={};if(!_0x5abd58[_0x3b2f('0x34')][_0x3b2f('0x70')])throw new Error(_0x3b2f('0x71'));if(!_0x5abd58[_0x3b2f('0x34')]['hasOwnProperty'](_0x3b2f('0x72'))){_0x4189ec[_0x3b2f('0x23')]=qs[_0x3b2f('0x23')](_0x5abd58[_0x3b2f('0x34')][_0x3b2f('0x23')]);_0x4189ec[_0x3b2f('0x21')]=qs[_0x3b2f('0x21')](_0x5abd58['query'][_0x3b2f('0x21')]);}return db[_0x3b2f('0x42')][_0x3b2f('0x4a')]({'where':{'id':_0x5abd58[_0x3b2f('0x47')]['id']}})[_0x3b2f('0x28')](function(_0x402db6){if(!_0x402db6)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5abd58[_0x3b2f('0x47')]['id']);return db[_0x3b2f('0x42')][_0x3b2f('0x73')](_0x5abd58);})[_0x3b2f('0x28')](respondWithFilteredResult(_0x99c604,_0x4189ec))['catch'](handleError(_0x99c604,null));}; \ No newline at end of file +var _0xc224=['../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','find','omit','createdAt','body','updatedAt','sequelize','transaction','get','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','UserProfileResource','removeSections','getSections','enabled','isEmpty','includes','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x342476,_0x57cb9f){var _0x27a83c=function(_0x3dd92f){while(--_0x3dd92f){_0x342476['push'](_0x342476['shift']());}};_0x27a83c(++_0x57cb9f);}(_0xc224,0x1af));var _0x4c22=function(_0x52386c,_0x32793d){_0x52386c=_0x52386c-0x0;var _0x1efe96=_0xc224[_0x52386c];return _0x1efe96;};'use strict';var emlformat=require(_0x4c22('0x0'));var rimraf=require(_0x4c22('0x1'));var zipdir=require(_0x4c22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c22('0x3'));var moment=require(_0x4c22('0x4'));var BPromise=require(_0x4c22('0x5'));var Mustache=require(_0x4c22('0x6'));var util=require(_0x4c22('0x7'));var path=require(_0x4c22('0x8'));var sox=require(_0x4c22('0x9'));var csv=require(_0x4c22('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4c22('0xb'));var crypto=require(_0x4c22('0xc'));var jsforce=require(_0x4c22('0xd'));var deskjs=require(_0x4c22('0xe'));var toCsv=require(_0x4c22('0xa'));var querystring=require(_0x4c22('0xf'));var Papa=require(_0x4c22('0x10'));var Redis=require('ioredis');var authService=require(_0x4c22('0x11'));var qs=require(_0x4c22('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c22('0x13'))(_0x4c22('0x14'));var utils=require(_0x4c22('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4c22('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x4c22('0x17')],{'host':_0x4c22('0x18'),'port':0x18eb});var socket=require(_0x4c22('0x19'))(new Redis(config[_0x4c22('0x17')]));require(_0x4c22('0x1a'))['register'](socket);function respondWithStatusCode(_0x284441,_0xcbc9cc){_0xcbc9cc=_0xcbc9cc||0xcc;return function(_0x373421){if(_0x373421){return _0x284441[_0x4c22('0x1b')](_0xcbc9cc);}return _0x284441[_0x4c22('0x1c')](_0xcbc9cc)['end']();};}function respondWithResult(_0x517d9a,_0xf562f8){_0xf562f8=_0xf562f8||0xc8;return function(_0x3617b2){if(_0x3617b2){return _0x517d9a[_0x4c22('0x1c')](_0xf562f8)[_0x4c22('0x1d')](_0x3617b2);}};}function respondWithFilteredResult(_0x32a9c4,_0x20b4db){return function(_0x408f6f){if(_0x408f6f){var _0x1577c6=typeof _0x20b4db[_0x4c22('0x1e')]==='undefined'&&typeof _0x20b4db[_0x4c22('0x1f')]==='undefined';var _0x5bce40=_0x408f6f[_0x4c22('0x20')];var _0x432f4d=_0x1577c6?0x0:_0x20b4db[_0x4c22('0x1e')];var _0x162502=_0x1577c6?_0x408f6f[_0x4c22('0x20')]:_0x20b4db[_0x4c22('0x1e')]+_0x20b4db['limit'];var _0x152923;if(_0x162502>=_0x5bce40){_0x162502=_0x5bce40;_0x152923=0xc8;}else{_0x152923=0xce;}_0x32a9c4['status'](_0x152923);return _0x32a9c4['set'](_0x4c22('0x21'),_0x432f4d+'-'+_0x162502+'/'+_0x5bce40)[_0x4c22('0x1d')](_0x408f6f);}return null;};}function patchUpdates(_0x3eda16){return function(_0xcdbded){try{jsonpatch[_0x4c22('0x22')](_0xcdbded,_0x3eda16,!![]);}catch(_0x45cba2){return BPromise[_0x4c22('0x23')](_0x45cba2);}return _0xcdbded[_0x4c22('0x24')]();};}function saveUpdates(_0x29aedf,_0x3ae915){return function(_0x33d48c){if(_0x33d48c){return _0x33d48c[_0x4c22('0x25')](_0x29aedf)[_0x4c22('0x26')](function(_0x2fa3d8){return _0x2fa3d8;});}return null;};}function removeEntity(_0x365856,_0x47ec7f){return function(_0x2a0607){if(_0x2a0607){return _0x2a0607[_0x4c22('0x27')]()['then'](function(){_0x365856[_0x4c22('0x1c')](0xcc)[_0x4c22('0x28')]();});}};}function handleEntityNotFound(_0x59091f,_0x3569a7){return function(_0x2d5d49){if(!_0x2d5d49){_0x59091f[_0x4c22('0x1b')](0x194);}return _0x2d5d49;};}function handleError(_0x39bbe4,_0x49193f){_0x49193f=_0x49193f||0x1f4;return function(_0x2de117){logger[_0x4c22('0x29')](_0x2de117[_0x4c22('0x2a')]);if(_0x2de117['name']){delete _0x2de117[_0x4c22('0x2b')];}_0x39bbe4[_0x4c22('0x1c')](_0x49193f)[_0x4c22('0x2c')](_0x2de117);};}exports[_0x4c22('0x2d')]=function(_0x2ec214,_0x875822){var _0x47fa82={},_0x1ad5e8={},_0x4d10bd={'count':0x0,'rows':[]};var _0x4f4d67=_['map'](db[_0x4c22('0x2e')][_0x4c22('0x2f')],function(_0x223d6a){return{'name':_0x223d6a[_0x4c22('0x30')],'type':_0x223d6a[_0x4c22('0x31')][_0x4c22('0x32')]};});_0x1ad5e8[_0x4c22('0x33')]=_[_0x4c22('0x34')](_0x4f4d67,_0x4c22('0x2b'));_0x1ad5e8[_0x4c22('0x35')]=_[_0x4c22('0x36')](_0x2ec214[_0x4c22('0x35')]);_0x1ad5e8['filters']=_['intersection'](_0x1ad5e8[_0x4c22('0x33')],_0x1ad5e8[_0x4c22('0x35')]);_0x47fa82[_0x4c22('0x37')]=_[_0x4c22('0x38')](_0x1ad5e8[_0x4c22('0x33')],qs[_0x4c22('0x39')](_0x2ec214[_0x4c22('0x35')][_0x4c22('0x39')]));_0x47fa82['attributes']=_0x47fa82['attributes']['length']?_0x47fa82['attributes']:_0x1ad5e8[_0x4c22('0x33')];if(!_0x2ec214[_0x4c22('0x35')][_0x4c22('0x3a')](_0x4c22('0x3b'))){_0x47fa82[_0x4c22('0x1f')]=qs['limit'](_0x2ec214[_0x4c22('0x35')]['limit']);_0x47fa82[_0x4c22('0x1e')]=qs[_0x4c22('0x1e')](_0x2ec214[_0x4c22('0x35')][_0x4c22('0x1e')]);}_0x47fa82[_0x4c22('0x3c')]=qs[_0x4c22('0x3d')](_0x2ec214[_0x4c22('0x35')][_0x4c22('0x3d')]);_0x47fa82[_0x4c22('0x3e')]=qs[_0x4c22('0x3f')](_['pick'](_0x2ec214[_0x4c22('0x35')],_0x1ad5e8[_0x4c22('0x3f')]),_0x4f4d67);if(_0x2ec214[_0x4c22('0x35')][_0x4c22('0x40')]){_0x47fa82[_0x4c22('0x3e')]=_[_0x4c22('0x41')](_0x47fa82[_0x4c22('0x3e')],{'$or':_[_0x4c22('0x34')](_0x4f4d67,function(_0x39f218){if(_0x39f218['type']!==_0x4c22('0x42')){var _0x243351={};_0x243351[_0x39f218[_0x4c22('0x2b')]]={'$like':'%'+_0x2ec214[_0x4c22('0x35')]['filter']+'%'};return _0x243351;}})});}_0x47fa82=_[_0x4c22('0x41')]({},_0x47fa82,_0x2ec214['options']);var _0x50be05={'where':_0x47fa82[_0x4c22('0x3e')]};return db[_0x4c22('0x2e')][_0x4c22('0x20')](_0x50be05)[_0x4c22('0x26')](function(_0x1afb4b){_0x4d10bd[_0x4c22('0x20')]=_0x1afb4b;if(_0x2ec214['query'][_0x4c22('0x43')]){_0x47fa82[_0x4c22('0x44')]=[{'all':!![]}];}return db[_0x4c22('0x2e')][_0x4c22('0x45')](_0x47fa82);})['then'](function(_0x575bbb){_0x4d10bd[_0x4c22('0x46')]=_0x575bbb;return _0x4d10bd;})['then'](respondWithFilteredResult(_0x875822,_0x47fa82))[_0x4c22('0x47')](handleError(_0x875822,null));};exports[_0x4c22('0x48')]=function(_0x5e1bde,_0x5c6a84){var _0x25f64a={'raw':![],'where':{'id':_0x5e1bde[_0x4c22('0x49')]['id']}},_0x531e84={};_0x531e84[_0x4c22('0x33')]=_['keys'](db[_0x4c22('0x2e')][_0x4c22('0x2f')]);_0x531e84[_0x4c22('0x35')]=_[_0x4c22('0x36')](_0x5e1bde['query']);_0x531e84[_0x4c22('0x3f')]=_['intersection'](_0x531e84[_0x4c22('0x33')],_0x531e84[_0x4c22('0x35')]);_0x25f64a[_0x4c22('0x37')]=_['intersection'](_0x531e84[_0x4c22('0x33')],qs[_0x4c22('0x39')](_0x5e1bde['query'][_0x4c22('0x39')]));_0x25f64a['attributes']=_0x25f64a[_0x4c22('0x37')][_0x4c22('0x4a')]?_0x25f64a[_0x4c22('0x37')]:_0x531e84[_0x4c22('0x33')];if(_0x5e1bde[_0x4c22('0x35')]['includeAll']){_0x25f64a[_0x4c22('0x44')]=[{'all':!![]}];}_0x25f64a=_[_0x4c22('0x41')]({},_0x25f64a,_0x5e1bde[_0x4c22('0x4b')]);return db['UserProfile']['find'](_0x25f64a)[_0x4c22('0x26')](handleEntityNotFound(_0x5c6a84,null))['then'](respondWithResult(_0x5c6a84,null))[_0x4c22('0x47')](handleError(_0x5c6a84,null));};exports[_0x4c22('0x4c')]=function(_0xcd0034,_0x5e4802){return db[_0x4c22('0x2e')]['create'](_0xcd0034['body'],{})[_0x4c22('0x26')](respondWithResult(_0x5e4802,0xc9))[_0x4c22('0x47')](handleError(_0x5e4802,null));};exports['clone']=function(_0x111a5f,_0x1f6b7f){var _0x85a458={'where':{'id':_0x111a5f['params']['id']}},_0xc56aee={};_0xc56aee[_0x4c22('0x33')]=_[_0x4c22('0x36')](db[_0x4c22('0x2e')][_0x4c22('0x2f')]);_0x85a458[_0x4c22('0x37')]=_[_0x4c22('0x38')](_0xc56aee[_0x4c22('0x33')],qs['fields'](_0x111a5f[_0x4c22('0x35')][_0x4c22('0x39')]));_0x85a458[_0x4c22('0x37')]=_0x85a458[_0x4c22('0x37')][_0x4c22('0x4a')]?_0x85a458['attributes']:_0xc56aee[_0x4c22('0x33')];if(_0x111a5f['query'][_0x4c22('0x43')]){_0x85a458['include']=[{'all':!![]}];}_0x85a458=_[_0x4c22('0x41')]({},_0x85a458,_0x111a5f[_0x4c22('0x4b')]);return db['UserProfile'][_0x4c22('0x4d')](_0x85a458)[_0x4c22('0x26')](handleEntityNotFound(_0x1f6b7f,null))[_0x4c22('0x26')](function(_0x3da1ce){if(_0x3da1ce){var _0x4e3e85=_0x3da1ce['get']({'plain':!![]});_0x4e3e85=qs[_0x4c22('0x4e')](_0x4e3e85,['id',_0x4c22('0x4f'),'updatedAt','crudPermissions']);_0x111a5f[_0x4c22('0x50')]=_[_0x4c22('0x4e')](_0x111a5f['body'],['id',_0x4c22('0x4f'),_0x4c22('0x51')]);return db[_0x4c22('0x52')][_0x4c22('0x53')](function(_0x18c7d0){return db[_0x4c22('0x2e')][_0x4c22('0x4c')](_['merge'](_0x4e3e85,_0x111a5f[_0x4c22('0x50')]),{'include':_0x111a5f[_0x4c22('0x35')][_0x4c22('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x18c7d0})[_0x4c22('0x26')](function(_0x58e18b){var _0x2bb2de=_0x58e18b[_0x4c22('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x4c22('0x45')]({'where':{'userProfileId':_0x111a5f[_0x4c22('0x49')]['id']},'raw':!![]})[_0x4c22('0x26')](function(_0x18d510){if(_0x18d510){return BPromise['each'](_0x18d510,function(_0x32fbdc){return new BPromise(function(_0x590b34,_0x2aaa1d){if(_0x32fbdc[_0x4c22('0x55')]===null||_0x32fbdc[_0x4c22('0x55')]===0x1)_0x590b34(null);return db['UserProfileResource'][_0x4c22('0x45')]({'where':{'sectionId':_0x32fbdc['id']},'raw':!![]})[_0x4c22('0x26')](function(_0x266005){var _0x389eb6=_[_0x4c22('0x34')](_0x266005,function(_0x592123){return qs[_0x4c22('0x4e')](_0x592123,['id',_0x4c22('0x4f'),'updatedAt',_0x4c22('0x56')]);});_0x590b34(_0x389eb6);})['catch'](function(_0x10aacd){_0x2aaa1d(_0x10aacd);});})[_0x4c22('0x26')](function(_0x30793f){var _0x384bfe=qs['omit'](_0x32fbdc,['id',_0x4c22('0x4f'),_0x4c22('0x51')]);_0x384bfe[_0x4c22('0x57')]=_0x2bb2de['id'];if(_0x30793f)_0x384bfe[_0x4c22('0x58')]=_0x30793f;return _0x384bfe;})[_0x4c22('0x26')](function(_0x3d6e10){return db[_0x4c22('0x59')][_0x4c22('0x4c')](_0x3d6e10,{'include':[{'model':db['UserProfileResource'],'as':_0x4c22('0x58')}],'raw':!![],'transaction':_0x18c7d0});});})['then'](function(){return _0x2bb2de;});}});});});}})['then'](respondWithResult(_0x1f6b7f,0xc9))[_0x4c22('0x47')](handleError(_0x1f6b7f,null));};exports[_0x4c22('0x25')]=function(_0xe26e6,_0x4f3b87){if(_0xe26e6['body']['id']){delete _0xe26e6[_0x4c22('0x50')]['id'];}return db[_0x4c22('0x2e')]['find']({'where':{'id':_0xe26e6[_0x4c22('0x49')]['id']}})[_0x4c22('0x26')](handleEntityNotFound(_0x4f3b87,null))['then'](saveUpdates(_0xe26e6['body'],null))[_0x4c22('0x26')](respondWithResult(_0x4f3b87,null))[_0x4c22('0x47')](handleError(_0x4f3b87,null));};exports[_0x4c22('0x27')]=function(_0x4abd0e,_0x4a4f3f){return db[_0x4c22('0x2e')][_0x4c22('0x4d')]({'where':{'id':_0x4abd0e[_0x4c22('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a4f3f,null))[_0x4c22('0x26')](removeEntity(_0x4a4f3f,null))[_0x4c22('0x47')](handleError(_0x4a4f3f,null));};exports[_0x4c22('0x5a')]=function(_0x41c32b,_0x2bbec3){return db[_0x4c22('0x2e')][_0x4c22('0x5a')]()[_0x4c22('0x26')](respondWithResult(_0x2bbec3,null))[_0x4c22('0x47')](handleError(_0x2bbec3,null));};exports[_0x4c22('0x5b')]=function(_0x46a3ed,_0x1a62b6){var _0x483528=_0x46a3ed[_0x4c22('0x50')];return db['UserProfile'][_0x4c22('0x4d')]({'where':{'id':_0x46a3ed[_0x4c22('0x49')]['id']}})[_0x4c22('0x26')](handleEntityNotFound(_0x1a62b6,null))['then'](function(_0x3b6b7f){if(_0x3b6b7f){return db[_0x4c22('0x52')][_0x4c22('0x53')](function(_0x526fe6){return db[_0x4c22('0x59')][_0x4c22('0x27')]({'where':{'userProfileId':_0x46a3ed[_0x4c22('0x49')]['id'],'sectionId':_[_0x4c22('0x34')](_0x483528,function(_0x125c81){return _0x125c81[_0x4c22('0x56')];})},'transaction':_0x526fe6})['then'](function(){var _0x1ff27d=_['map'](_0x483528,function(_0x4be5f3){_0x4be5f3[_0x4c22('0x57')]=_0x46a3ed[_0x4c22('0x49')]['id'];return _0x4be5f3;});var _0x4a1c94=[];return BPromise['each'](_0x1ff27d,function(_0x2bef03){return db[_0x4c22('0x59')]['create'](_0x2bef03,{'include':[{'model':db[_0x4c22('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x526fe6})[_0x4c22('0x26')](function(_0x5b61ca){_0x4a1c94['push'](_0x5b61ca['get']({'plain':!![]}));});})[_0x4c22('0x26')](function(){return _0x4a1c94;});});});}})['then'](function(_0x275c4e){return _0x275c4e;})['then'](respondWithResult(_0x1a62b6,null))[_0x4c22('0x47')](handleError(_0x1a62b6,null));};exports[_0x4c22('0x5d')]=function(_0x50b407,_0x95606a){var _0x345acc;return db[_0x4c22('0x2e')]['find']({'where':{'id':_0x50b407[_0x4c22('0x49')]['id']},'attributes':['id',_0x4c22('0x2b')]})[_0x4c22('0x26')](handleEntityNotFound(_0x95606a,null))[_0x4c22('0x26')](function(_0x4f118b){if(_0x4f118b){_0x345acc=_0x4f118b;return db['UserProfileSection'][_0x4c22('0x27')]({'where':{'userProfileId':_0x50b407['params']['id'],'sectionId':_0x50b407[_0x4c22('0x35')]['ids']}});}})[_0x4c22('0x26')](function(){return _0x345acc;})[_0x4c22('0x26')](respondWithStatusCode(_0x95606a,null))[_0x4c22('0x47')](handleError(_0x95606a,null));};exports[_0x4c22('0x5e')]=function(_0x64271b,_0x1058eb){var _0x5295e8=[];var _0x5073a7=[];return db[_0x4c22('0x59')]['findAll']({'where':{'userProfileId':_0x64271b['params']['id']},'raw':!![]})[_0x4c22('0x26')](function(_0x389e2a){_0x5295e8=_[_0x4c22('0x40')](_0x389e2a,function(_0x22c778){return _0x22c778[_0x4c22('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0x22c778[_0x4c22('0x56')]);});if(!_[_0x4c22('0x60')](_0x5295e8)){return _[_0x4c22('0x34')](_0x5295e8,function(_0x1db65f){return _0x1db65f[_0x4c22('0x56')];});}else{return;}})['then'](function(_0x461e4a){if(_0x461e4a)_0x5073a7=_0x461e4a;if(_[_0x4c22('0x61')](_0x5073a7,0x64)){var _0x2c77f2=_['find'](_0x5295e8,{'sectionId':0x64});return hasDefaultDashboard(_0x2c77f2)[_0x4c22('0x26')](function(_0x51be51){return _[_0x4c22('0x34')](_0x5295e8,function(_0x5a9306){if(_0x5a9306[_0x4c22('0x56')]===0x64){_0x5a9306[_0x4c22('0x62')]=_0x51be51;}return _0x5a9306;});});}else{return;}})[_0x4c22('0x26')](function(_0x2bbdc1){if(_0x2bbdc1)_0x5295e8=_0x2bbdc1;if(_[_0x4c22('0x61')](_0x5073a7,0x3eb)){var _0x55830d=_['find'](_0x5295e8,{'sectionId':0x3eb});return getCustomDashboards(_0x55830d)['then'](function(_0x100c59){return _[_0x4c22('0x34')](_0x5295e8,function(_0x33b945){if(_0x55830d['enabled']){if(_0x33b945['sectionId']===0x3eb){_0x33b945['subsections']=_0x100c59;}}else{if(_0x33b945[_0x4c22('0x56')]===0x64){_0x33b945[_0x4c22('0x62')]=_0x100c59;}}return _0x33b945;});});}else{return;}})['then'](function(_0x1c07a){if(_0x1c07a)_0x5295e8=_0x1c07a;if(_[_0x4c22('0x61')](_0x5073a7,0x709)){var _0x17621a=_[_0x4c22('0x4d')](_0x5295e8,{'sectionId':0x709});return getPlugins(_0x17621a)['then'](function(_0xa422b0){if(_0x17621a['enabled']){return _[_0x4c22('0x34')](_0x5295e8,function(_0x583e63){if(_0x583e63[_0x4c22('0x56')]===0x709){_0x583e63[_0x4c22('0x62')]=_0xa422b0;}return _0x583e63;});}else{var _0x2f0f94={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa422b0};var _0x1b5433=_['map'](_0x5295e8);_0x1b5433[_0x4c22('0x63')](_0x2f0f94);return _0x1b5433;}});}else{return;}})[_0x4c22('0x26')](function(_0x3611fb){if(_0x3611fb)_0x5295e8=_0x3611fb;return _[_0x4c22('0x40')](_0x5295e8,[_0x4c22('0x5f'),0x1]);})[_0x4c22('0x26')](respondWithResult(_0x1058eb,null))['catch'](handleError(_0x1058eb,null));};function hasDefaultDashboard(_0x4ce14e){var _0x2637c9=[0x65];return new BPromise(function(_0x23b6b4,_0x92a6e9){try{if(_0x4ce14e[_0x4c22('0x55')]){_0x23b6b4(_0x2637c9);}else{return db[_0x4c22('0x5c')][_0x4c22('0x64')]({'where':{'sectionId':_0x4ce14e['id']},'raw':!![]})[_0x4c22('0x26')](function(_0x5ba3f5){_0x5ba3f5?_0x23b6b4(_0x2637c9):_0x23b6b4();});}}catch(_0x35b00c){_0x92a6e9(_0x35b00c);}});}function getCustomDashboards(_0x50cc93){var _0x5d492e=[];return new BPromise(function(_0x4d19b4,_0x34492b){try{if(_0x50cc93[_0x4c22('0x55')]){return db[_0x4c22('0x65')][_0x4c22('0x45')]({'raw':!![]})[_0x4c22('0x26')](function(_0x183ba3){_0x183ba3[_0x4c22('0x66')](function(_0x541038){_0x5d492e['push'](_0x541038['id']+0x1869f);});_0x4d19b4(_0x5d492e);});}else{return db[_0x4c22('0x5c')][_0x4c22('0x45')]({'where':{'sectionId':_0x50cc93['id']},'raw':!![]})['then'](function(_0x3b7295){_0x3b7295[_0x4c22('0x66')](function(_0x213367){_0x5d492e[_0x4c22('0x63')](_0x213367[_0x4c22('0x67')]+0x1869f);});_0x4d19b4(_0x5d492e);});}}catch(_0x497ccb){_0x34492b(_0x497ccb);}});}function getPlugins(_0x81cd9c){var _0x48ff26=[];return new BPromise(function(_0x5b03e0,_0x10c1b5){try{if(_0x81cd9c[_0x4c22('0x55')]){return db[_0x4c22('0x68')][_0x4c22('0x45')]({'raw':!![]})[_0x4c22('0x26')](function(_0x320d60){_0x320d60[_0x4c22('0x66')](function(_0x14e459){_0x48ff26[_0x4c22('0x63')](_0x14e459['id']+0x15b38);});_0x5b03e0(_0x48ff26);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x81cd9c['id']},'raw':!![]})[_0x4c22('0x26')](function(_0x4a703c){_0x4a703c[_0x4c22('0x66')](function(_0x5e120a){_0x48ff26[_0x4c22('0x63')](_0x5e120a[_0x4c22('0x67')]+0x15b38);});_0x5b03e0(_0x48ff26);});}}catch(_0x2eb41f){_0x10c1b5(_0x2eb41f);}});}exports[_0x4c22('0x69')]=function(_0x6fe364,_0x1d1f4b){return db[_0x4c22('0x2e')][_0x4c22('0x4d')]({'where':{'id':_0x6fe364[_0x4c22('0x49')]['id']}})[_0x4c22('0x26')](handleEntityNotFound(_0x1d1f4b,null))[_0x4c22('0x26')](function(_0x2dd9c0){if(_0x2dd9c0){return db[_0x4c22('0x52')][_0x4c22('0x53')](function(_0xcc5315){return db[_0x4c22('0x59')][_0x4c22('0x45')]({'where':{'userProfileId':_0x6fe364[_0x4c22('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x4c22('0x26')](function(_0x36f199){if(_0x36f199){return db[_0x4c22('0x59')][_0x4c22('0x27')]({'where':{'userProfileId':_0x6fe364['params']['id'],'id':_[_0x4c22('0x34')](_0x36f199,function(_0x580c35){return _0x580c35['id'];})},'transaction':_0xcc5315});}})[_0x4c22('0x26')](function(_0x3c6767){var _0x3d2c16=_['map'](_0x6fe364['body'],function(_0x299f28){_0x299f28['userProfileId']=_0x6fe364[_0x4c22('0x49')]['id'];return _0x299f28;});return db[_0x4c22('0x59')][_0x4c22('0x6a')](_0x3d2c16,{'raw':!![],'transaction':_0xcc5315});})[_0x4c22('0x26')](function(_0x512314){var _0x82936a=_[_0x4c22('0x40')](_[_0x4c22('0x34')](_0x512314,function(_0x1211c6){return _0x1211c6['get']({'plain':!![]});}),{'includeAll':![]});if(_0x82936a){return db[_0x4c22('0x59')]['findAll']({'where':{'userProfileId':_0x6fe364[_0x4c22('0x49')]['id'],'sectionId':_[_0x4c22('0x34')](_0x82936a,function(_0x363d0e){return _0x363d0e[_0x4c22('0x56')];})},'attributes':['id',_0x4c22('0x56')],'raw':!![]})[_0x4c22('0x26')](function(_0x1e55a8){var _0x185cdd=_[_0x4c22('0x34')](_0x6fe364['body'],function(_0x294e62){_0x294e62[_0x4c22('0x57')]=_0x6fe364['params']['id'];return _0x294e62;});return db[_0x4c22('0x5c')][_0x4c22('0x6a')](_0x185cdd,{'raw':!![],'transaction':_0xcc5315});});}})[_0x4c22('0x47')](handleError(_0x1d1f4b,null));});}})['then'](function(_0x2c9f40){var _0x9e9d20=_['map'](_0x2c9f40,function(_0x6a4109){return _0x6a4109[_0x4c22('0x54')]({'plain':!![]});});})[_0x4c22('0x26')](respondWithResult(_0x1d1f4b,null))[_0x4c22('0x47')](handleError(_0x1d1f4b,null));};exports[_0x4c22('0x6b')]=function(_0x4b4077,_0x1e4274,_0x486f21){return db[_0x4c22('0x2e')]['find']({'where':{'id':_0x4b4077['params']['id']}})[_0x4c22('0x26')](handleEntityNotFound(_0x1e4274,null))[_0x4c22('0x26')](function(_0x4e2049){if(_0x4e2049){return _0x4e2049['removeResources'](_0x4b4077[_0x4c22('0x35')][_0x4c22('0x6c')]);}})['then'](respondWithStatusCode(_0x1e4274,null))[_0x4c22('0x47')](handleError(_0x1e4274,null));};exports[_0x4c22('0x6d')]=function(_0x1a6ff8,_0x42c56a){var _0x126c22={};if(!_0x1a6ff8[_0x4c22('0x35')][_0x4c22('0x6e')])throw new Error(_0x4c22('0x6f'));if(!_0x1a6ff8[_0x4c22('0x35')][_0x4c22('0x3a')]('nolimit')){_0x126c22[_0x4c22('0x1f')]=qs['limit'](_0x1a6ff8['query'][_0x4c22('0x1f')]);_0x126c22[_0x4c22('0x1e')]=qs[_0x4c22('0x1e')](_0x1a6ff8[_0x4c22('0x35')][_0x4c22('0x1e')]);}return db['UserProfile']['find']({'where':{'id':_0x1a6ff8['params']['id']}})['then'](function(_0x1abd7f){if(!_0x1abd7f)throw new Error(_0x4c22('0x70')+_0x1a6ff8[_0x4c22('0x49')]['id']);return db[_0x4c22('0x2e')][_0x4c22('0x6d')](_0x1a6ff8);})[_0x4c22('0x26')](respondWithFilteredResult(_0x42c56a,_0x126c22))[_0x4c22('0x47')](handleError(_0x42c56a,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index fcad484..f406a22 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 _0xa498=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserProfile'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0xa498,0x1d6));var _0x8a49=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0xa498[_0x1acc2d];return _0xabfa6d;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x8a49('0x0'))['db'][_0x8a49('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a49('0x2'),'afterDestroy':_0x8a49('0x3')};function emitEvent(_0x1d4dd2){return function(_0x65eb15,_0x2f362e,_0x5aaf52){UserProfileEvents[_0x8a49('0x4')](_0x1d4dd2+':'+_0x65eb15['id'],_0x65eb15);UserProfileEvents['emit'](_0x1d4dd2,_0x65eb15);_0x5aaf52(null);};}for(var e in events){if(events[_0x8a49('0x5')](e)){var event=events[e];UserProfile[_0x8a49('0x6')](e,emitEvent(event));}}module[_0x8a49('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xd046=['update','hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd046,0x129));var _0x6d04=function(_0x544561,_0x5005f8){_0x544561=_0x544561-0x0;var _0x36d845=_0xd046[_0x544561];return _0x36d845;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x6d04('0x0'))['db'][_0x6d04('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6d04('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d04('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4d3747){return function(_0x33720a,_0x4d2121,_0x174d65){UserProfileEvents['emit'](_0x4d3747+':'+_0x33720a['id'],_0x33720a);UserProfileEvents['emit'](_0x4d3747,_0x33720a);_0x174d65(null);};}for(var e in events){if(events[_0x6d04('0x4')](e)){var event=events[e];UserProfile[_0x6d04('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e1b96cc..87142f6 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 _0x1eba=['plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','user_has_','where','sequelize','query','define','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','params','all','ignore','union','length','push','autoAssociation','model','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','options','includeAll','default','DefaultReports','custom','CustomReports','count','rows','ids','include','ThroughTags','tag','openTabs','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','then','associatedResources','catch','findAll','map','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','JscriptyProject','CmContact','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables'];(function(_0x1d895d,_0x3e5c93){var _0x2dae23=function(_0x443cd0){while(--_0x443cd0){_0x1d895d['push'](_0x1d895d['shift']());}};_0x2dae23(++_0x3e5c93);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x1eba[_0x1fc84d];return _0x2658fa;};'use strict';var _=require(_0xa1eb('0x0'));var attributes=require(_0xa1eb('0x1'));var qs=require(_0xa1eb('0x2'));var squel=require(_0xa1eb('0x3'));module[_0xa1eb('0x4')]=function(_0x5865fc){var _0x56c5f2=_0x5865fc[_0xa1eb('0x5')];function _0x34be5a(_0x16a13a,_0xf9d704){return new Promise(function(_0x138789,_0x2933d0){if(!_0xf9d704)return _0x138789(null);var _0x1d0d67=_0xf9d704[_0xa1eb('0x6')]?{[_0xf9d704[_0xa1eb('0x6')][_0xa1eb('0x7')]]:_0xf9d704[_0xa1eb('0x6')][_0xa1eb('0x8')]}:undefined;return _0x56c5f2[_0x16a13a]['findAll']({'where':_0x1d0d67,'raw':!![]})[_0xa1eb('0x9')](function(_0x4d4aaf){_0xf9d704[_0xa1eb('0xa')]=_['map'](_0x4d4aaf,'id');_0x138789(_0xf9d704);})[_0xa1eb('0xb')](function(_0x5d7101){_0x2933d0(_0x5d7101);});});}function _0x41a7bc(_0x5502e4,_0xc23b2e){return new Promise(function(_0x325d13,_0x151580){var _0x5839d3=_0x5502e4[_0xa1eb('0x6')]?{[_0x5502e4[_0xa1eb('0x6')]['field']]:_0x5502e4[_0xa1eb('0x6')]['value']}:undefined;return _0x56c5f2[_0x5502e4['model']][_0xa1eb('0xc')]({'where':_0x5839d3,'raw':!![]})['then'](function(_0x25d058){_0xc23b2e[_0xa1eb('0xa')]=_[_0xa1eb('0xd')](_0x25d058,function(_0x2877cb){return _0x2877cb[_0xa1eb('0xe')];});_0x325d13(_0xc23b2e);})[_0xa1eb('0xb')](function(_0x1c858c){_0x151580(_0x1c858c);});});}function _0x45d6dd(_0x211e42,_0x4aa527,_0xbd6a6b){if(!_0x4aa527)return Promise['resolve'](null);return new Promise(function(_0x1401ef,_0x3dafcd){return _0x56c5f2[_0xa1eb('0xf')][_0xa1eb('0xc')]({'where':{'sectionId':_0x4aa527['id']},'raw':!![]})['then'](function(_0x1dd621){if(_0x211e42[_0xa1eb('0x7')]&&_0x211e42[_0xa1eb('0x7')]!=='id'){_0x4aa527[_0xa1eb('0xa')]=_[_0xa1eb('0xd')](_0x1dd621,function(_0x3b8607){return _0x3b8607[_0x211e42[_0xa1eb('0x7')]];});}else{if(_0xbd6a6b===_0xa1eb('0x10')){_0x4aa527['associatedResources']=_[_0xa1eb('0xd')](_0x1dd621,function(_0x56653c){return{'id':_0x56653c[_0xa1eb('0x11')],'type':_0x56653c[_0xa1eb('0x12')]};});}else{_0x4aa527[_0xa1eb('0xa')]=_[_0xa1eb('0xd')](_0x1dd621,function(_0x5e7a34){return _0x5e7a34['resourceId'];});}}_0x1401ef(_0x4aa527);})[_0xa1eb('0xb')](function(_0xc64cb9){_0x3dafcd(_0xc64cb9);});});}function _0x5b0903(_0x437b2a,_0x250728){var _0x258d3a={'parentSections':[]};switch(_0x437b2a[_0xa1eb('0x13')]()){case _0xa1eb('0x14'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x16');break;case _0xa1eb('0x17'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x18');break;case _0xa1eb('0x19'):_0x258d3a[_0xa1eb('0x15')]='SquareRecording';_0x258d3a[_0xa1eb('0x1a')]=[{'name':_0xa1eb('0x1b'),'field':'name','foreignKey':_0xa1eb('0x1c')}];break;case'projects':_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x1d');break;case'contacts':_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x1e');_0x258d3a[_0xa1eb('0x1a')]=[{'name':'Lists','field':'id','foreignKey':_0xa1eb('0x1f')}];break;case _0xa1eb('0x20'):_0x258d3a['childModel']=_0xa1eb('0x21');break;case _0xa1eb('0x22'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x23');break;case _0xa1eb('0x24'):_0x258d3a['childModel']=_0xa1eb('0x25');break;case _0xa1eb('0x26'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x27');break;case _0xa1eb('0x28'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x29');break;case _0xa1eb('0x2a'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x2b');break;case _0xa1eb('0x2c'):_0x258d3a['childModel']='FaxAccount';break;case _0xa1eb('0x2d'):case _0xa1eb('0x2e'):case _0xa1eb('0x2f'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x30');break;case'contexts':_0x258d3a['childModel']=_0xa1eb('0x31');break;case _0xa1eb('0x32'):_0x258d3a['childModel']='VoiceMail';break;case _0xa1eb('0x33'):_0x258d3a['childModel']=_0xa1eb('0x34');_0x258d3a['parentSections']=[{'name':_0xa1eb('0x35'),'field':_0xa1eb('0xe'),'foreignKey':_0xa1eb('0x36'),'model':'User','filter':{'field':_0xa1eb('0x37'),'value':[_0xa1eb('0x38')]}},{'name':_0xa1eb('0x39'),'field':'name','foreignKey':_0xa1eb('0x36'),'model':_0xa1eb('0x3a'),'filter':{'field':_0xa1eb('0x37'),'value':[_0xa1eb('0x3b')]}},{'name':_0xa1eb('0x3c'),'field':'name','foreignKey':_0xa1eb('0x3d'),'model':_0xa1eb('0x3e'),'filter':{'field':_0xa1eb('0x12'),'value':[_0xa1eb('0x3f')]}},{'name':_0xa1eb('0x40'),'field':_0xa1eb('0xe'),'foreignKey':_0xa1eb('0x3d'),'model':_0xa1eb('0x3e'),'filter':{'field':'type','value':[_0xa1eb('0x41')]}}];break;case _0xa1eb('0x42'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x43');break;case _0xa1eb('0x44'):_0x258d3a['childModel']=_0xa1eb('0x45');break;case _0xa1eb('0x46'):_0x258d3a[_0xa1eb('0x15')]='VoicePrefix';break;case _0xa1eb('0x47'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x48');break;case _0xa1eb('0x49'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x4a');break;case _0xa1eb('0x4b'):_0x258d3a['childModel']=_0xa1eb('0x4c');break;case _0xa1eb('0x4d'):_0x258d3a['childModel']=_0xa1eb('0x4e');break;case'openchannelqueues':_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x4f');break;case _0xa1eb('0x50'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x51');break;case _0xa1eb('0x52'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x53');break;case _0xa1eb('0x54'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x55');break;case _0xa1eb('0x56'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x57');break;case _0xa1eb('0x58'):_0x258d3a[_0xa1eb('0x15')]='WhatsappAccount';break;case _0xa1eb('0x59'):_0x258d3a['childModel']=_0xa1eb('0x5a');break;case _0xa1eb('0x5b'):case'queuecampaigns':_0x258d3a['childModel']=_0xa1eb('0x3e');if(_0x250728){_0x258d3a[_0xa1eb('0x1a')]=[{'name':_0xa1eb('0x3c')},{'name':'QueueCampaigns'}];}break;case _0xa1eb('0x5c'):case _0xa1eb('0x5d'):case _0xa1eb('0x5e'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x3a');if(_0x250728){_0x258d3a[_0xa1eb('0x1a')]=[{'name':_0xa1eb('0x5f'),'filter':{'field':_0xa1eb('0x37'),'value':[_0xa1eb('0x60'),_0xa1eb('0x61')]},'ignore':!![]},{'name':_0xa1eb('0x35')},{'name':_0xa1eb('0x39')}];}break;case _0xa1eb('0x62'):_0x258d3a[_0xa1eb('0x15')]='ZendeskAccount';break;case _0xa1eb('0x63'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x64');break;case _0xa1eb('0x65'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x66');break;case _0xa1eb('0x67'):_0x258d3a['childModel']=_0xa1eb('0x68');break;case _0xa1eb('0x69'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x6a');break;case _0xa1eb('0x6b'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x6c');break;case _0xa1eb('0x6d'):_0x258d3a[_0xa1eb('0x15')]='User';break;case _0xa1eb('0x6e'):_0x258d3a['childModel']=_0xa1eb('0x6f');break;case'dispositions':_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x70');break;case _0xa1eb('0x71'):_0x258d3a['childModel']=_0xa1eb('0x72');break;case _0xa1eb('0x73'):_0x258d3a['childModel']=_0xa1eb('0x74');break;case _0xa1eb('0x75'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x76');break;case _0xa1eb('0x77'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x78');break;case _0xa1eb('0x79'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x7a');break;case _0xa1eb('0x7b'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x7c');break;case _0xa1eb('0x7d'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x7e');break;case _0xa1eb('0x7f'):_0x258d3a['childModel']=_0xa1eb('0x80');break;case _0xa1eb('0x81'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x82');break;case _0xa1eb('0x83'):_0x258d3a[_0xa1eb('0x15')]='Variable';break;case _0xa1eb('0x84'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x85');break;case _0xa1eb('0x86'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x10');_0x258d3a[_0xa1eb('0x1a')]=[{'name':'Reports','field':'id','foreignKey':_0xa1eb('0x87')}];break;case _0xa1eb('0x88'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x89');break;}return _0x258d3a;}function _0x4c30ad(_0x5af1e6,_0x58ca4e){var _0x5673fa=_0x5af1e6[_0xa1eb('0x8a')](0x0)[_0xa1eb('0x8b')]()+_0x5af1e6['slice'](0x1);var _0x4643f3={'type':_0x56c5f2[_0xa1eb('0x8c')][_0xa1eb('0x8d')][_0xa1eb('0x8e')],'raw':!![]};return new Promise(function(_0x4edf8e,_0x481d19){var _0x201e6a=squel[_0xa1eb('0x8f')]()[_0xa1eb('0x7')](_0xa1eb('0x90')+_0x5673fa+_0xa1eb('0x91'),'id')[_0xa1eb('0x7')]('ui.createdAt')['from'](_0xa1eb('0x92')+_0x5af1e6+'_interactions','ui')[_0xa1eb('0x93')]('ui.UserId\x20=\x20?',_0x58ca4e['id']);return _0x56c5f2[_0xa1eb('0x94')][_0xa1eb('0x95')](_0x201e6a['toString'](),_0x4643f3)[_0xa1eb('0x9')](function(_0xf48372){_0x58ca4e[_0x5673fa+'OpenTabs']=_0xf48372;_0x4edf8e(_0xf48372);})[_0xa1eb('0xb')](function(_0x17feb5){_0x481d19(_0x17feb5);});});}return _0x5865fc[_0xa1eb('0x96')]('UserProfile',attributes,{'tableName':_0xa1eb('0x97'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x11e85f){var _0x4af59a={'raw':_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0x98')],'where':{}};var _0x139a37={};var _0x4a0545={'count':0x0,'rows':[]};var _0x3a43c3=_0x11e85f['query'][_0xa1eb('0x99')];var _0x1ea97b=_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0x9a')]||![];var _0x2df867=_0x5b0903(_0x3a43c3,_0x1ea97b);if(!_0x2df867['childModel'])throw new Error(_0xa1eb('0x9b')+_0x3a43c3+'\x27');var _0x401800=[{'name':_0x3a43c3}];if(!_[_0xa1eb('0x9c')](_0x2df867['parentSections']))_0x401800=_0x2df867[_0xa1eb('0x1a')];var _0x527921=[];for(var _0x4e582c=0x0;_0x4e582c<_0x401800['length'];_0x4e582c++){_0x527921['push'](_0x56c5f2[_0xa1eb('0x9d')][_0xa1eb('0x9e')]({'where':{'userProfileId':_0x11e85f[_0xa1eb('0x9f')]['id'],'name':_0x401800[_0x4e582c][_0xa1eb('0xe')]},'raw':!![]}));}return Promise[_0xa1eb('0xa0')](_0x527921)[_0xa1eb('0x9')](function(_0x11f031){var _0xc8cb66=_[_0xa1eb('0x6')](_0x11f031,function(_0x43d59b){return _0x43d59b?_0x43d59b:undefined;});var _0x5cf153=_[_0xa1eb('0x6')](_0x401800,[_0xa1eb('0xa1'),!![]]);var _0x46207c=_[_0xa1eb('0x9c')](_0xc8cb66)&&_[_0xa1eb('0x9c')](_0x5cf153)?null:_[_0xa1eb('0xa2')](_0x5cf153,_0xc8cb66);if(!_0x46207c)return null;var _0x4bf3c9=[];for(var _0x113a3a=0x0;_0x113a3a<_0x46207c[_0xa1eb('0xa3')];_0x113a3a++){var _0x16c5a3=_['find'](_0x401800,function(_0x1434a1){return _0x46207c[_0x113a3a]?_0x1434a1[_0xa1eb('0xe')]===_0x46207c[_0x113a3a][_0xa1eb('0xe')]:null;});if(_0x16c5a3){if(_0x46207c[_0x113a3a][_0xa1eb('0xa1')]){_0x4bf3c9[_0xa1eb('0xa4')](_0x34be5a(_0x2df867['childModel'],_0x46207c[_0x113a3a]));}else{if(!_0x46207c[_0x113a3a][_0xa1eb('0xa5')]){_0x4bf3c9['push'](_0x45d6dd(_0x16c5a3,_0x46207c[_0x113a3a],_0x2df867[_0xa1eb('0x15')]));}else{if(_0x16c5a3['model']){_0x4bf3c9[_0xa1eb('0xa4')](_0x41a7bc(_0x16c5a3,_0x46207c[_0x113a3a]));}}}}}return Promise[_0xa1eb('0xa0')](_0x4bf3c9);})[_0xa1eb('0x9')](function(_0x32cdfa){var _0x47c618=_0x32cdfa;var _0x3bc2e7=null;if(_0x47c618){_0x3bc2e7=_0x47c618[_0xa1eb('0xa3')]===0x1?_0x47c618[0x0]:null;}if(!_0x3bc2e7&&!_0x47c618)return _0x4a0545;var _0x2b8191=_0x56c5f2[_0x2df867[_0xa1eb('0x15')]]['rawAttributes'];_0x139a37[_0xa1eb('0xa6')]=_[_0xa1eb('0xa7')](_0x2b8191);_0x139a37[_0xa1eb('0x95')]=_[_0xa1eb('0xa7')](_0x11e85f[_0xa1eb('0x95')]);_0x139a37[_0xa1eb('0xa8')]=_[_0xa1eb('0xa9')](_0x139a37[_0xa1eb('0xa6')],_0x139a37[_0xa1eb('0x95')]);_0x4af59a['attributes']=_['intersection'](_0x139a37['model'],qs[_0xa1eb('0xaa')](_0x11e85f['query'][_0xa1eb('0xaa')]));_0x4af59a[_0xa1eb('0xab')]=_0x4af59a['attributes']['length']?_0x4af59a[_0xa1eb('0xab')]:_0x139a37[_0xa1eb('0xa6')];if(!_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xac')](_0xa1eb('0xad'))){_0x4af59a['limit']=qs['limit'](_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xae')]);_0x4af59a[_0xa1eb('0xaf')]=qs[_0xa1eb('0xaf')](_0x11e85f['query'][_0xa1eb('0xaf')]);}_0x4af59a[_0xa1eb('0xb0')]=qs[_0xa1eb('0xb1')](_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xb1')]);_0x4af59a[_0xa1eb('0x93')]=qs[_0xa1eb('0xa8')](_[_0xa1eb('0xb2')](_0x11e85f[_0xa1eb('0x95')],_0x139a37[_0xa1eb('0xa8')]));if(_0x11e85f[_0xa1eb('0x95')]['filter']){_0x4af59a[_0xa1eb('0x93')]=_[_0xa1eb('0xb3')](_0x4af59a[_0xa1eb('0x93')],{'$or':_[_0xa1eb('0xd')](_0x2b8191,function(_0x3fe7ef){if(_0x3fe7ef[_0xa1eb('0x12')]['key']!==_0xa1eb('0xb4')){var _0x36a94f={};_0x36a94f[_0x3fe7ef[_0xa1eb('0x7')]]={'$like':'%'+_0x11e85f[_0xa1eb('0x95')]['filter']+'%'};return _0x36a94f;}})});}var _0x4e24dc=[];var _0xff1843=null;var _0x5e0cd5={};if(_0x3bc2e7){_0xff1843=_[_0xa1eb('0x9e')](_0x401800,[_0xa1eb('0xe'),_0x3bc2e7['name']]);if(_0xff1843[_0xa1eb('0x7')]){_0x5e0cd5={};if(_0x2df867[_0xa1eb('0x15')]==='AnalyticExtractedReport'){_0x5e0cd5[_0xff1843[_0xa1eb('0xb5')]]=_[_0xa1eb('0xd')](_0x3bc2e7[_0xa1eb('0xa')],'id');}else{_0x5e0cd5[_0xff1843[_0xa1eb('0xb5')]]=_0x3bc2e7[_0xa1eb('0xa')];}_0x4e24dc[_0xa1eb('0xa4')](_0x5e0cd5);}else{_0x4af59a[_0xa1eb('0x93')]['id']=_0x3bc2e7[_0xa1eb('0xa')];}}else{for(var _0x3d32da=0x0;_0x3d32da<_0x47c618[_0xa1eb('0xa3')];_0x3d32da++){_0xff1843=_[_0xa1eb('0x9e')](_0x401800,['name',_0x47c618[_0x3d32da][_0xa1eb('0xe')]]);if(_0xff1843[_0xa1eb('0x7')]){_0x5e0cd5={};_0x5e0cd5[_0xff1843[_0xa1eb('0xb5')]]=_0x47c618[_0x3d32da][_0xa1eb('0xa')];_0x4e24dc['push'](_0x5e0cd5);}else{if(!_0x4af59a[_0xa1eb('0x93')]['id'])_0x4af59a[_0xa1eb('0x93')]['id']=[];_0x47c618[_0x3d32da][_0xa1eb('0xa')]['forEach'](function(_0x214913){_0x4af59a[_0xa1eb('0x93')]['id'][_0xa1eb('0xa4')](_0x214913);});}}}if(!_['isEmpty'](_0x4e24dc)){_0x4af59a[_0xa1eb('0x93')]=_['merge'](_0x4af59a[_0xa1eb('0x93')],{'$and':{'$or':_0x4e24dc}});}_0x4af59a=_[_0xa1eb('0xb3')]({},_0x4af59a,_0x11e85f[_0xa1eb('0xb6')]);if(_0x3bc2e7&&!_0x3bc2e7[_0xa1eb('0xa5')]&&_0x2df867[_0xa1eb('0x15')]===_0xa1eb('0x10')){if(_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xb7')]){_0x4af59a['include']=[{'all':!![]}];}return _0x56c5f2[_0x2df867[_0xa1eb('0x15')]][_0xa1eb('0xc')](_0x4af59a)[_0xa1eb('0x9')](function(_0x3ae7e1){var _0x454320=[];_0x3ae7e1['forEach'](function(_0x140475){var _0x2a9f79;switch(_0x140475['reportType']){case _0xa1eb('0xb8'):_0x2a9f79=_['find'](_0x3bc2e7['associatedResources'],function(_0x29f795){return _0x29f795['id']===_0x140475[_0xa1eb('0x87')]&&_0x29f795['type']===_0xa1eb('0xb9');});break;case _0xa1eb('0xba'):_0x2a9f79=_['find'](_0x3bc2e7[_0xa1eb('0xa')],function(_0x2c49d1){return _0x2c49d1['id']===_0x140475['reportId']&&_0x2c49d1['type']===_0xa1eb('0xbb');});break;}if(_0x2a9f79)_0x454320['push'](_0x140475);});_0x4a0545[_0xa1eb('0xbc')]=_0x454320[_0xa1eb('0xa3')];_0x4a0545[_0xa1eb('0xbd')]=_0x454320;return _0x4a0545;});}else{if(!_[_0xa1eb('0x9c')](_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xbe')])){_0x4af59a['where']['id']=_0x4af59a[_0xa1eb('0x93')]['id']?_['intersection'](_0x4af59a[_0xa1eb('0x93')]['id'],_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xbe')]):_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xbe')];}return _0x56c5f2[_0x2df867[_0xa1eb('0x15')]][_0xa1eb('0xbc')]({'where':_0x4af59a['where']})[_0xa1eb('0x9')](function(_0x4effc0){_0x4a0545['count']=_0x4effc0;if(_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xb7')]){if(_0x2df867[_0xa1eb('0x15')]===_0xa1eb('0x1e')){_0x4af59a[_0xa1eb('0xbf')]=[{'model':_0x56c5f2[_0xa1eb('0x7c')],'as':'Tags','attributes':['id',_0xa1eb('0xe'),'color'],'required':_0x11e85f[_0xa1eb('0x95')]['tag']?!![]:![]},{'model':_0x56c5f2[_0xa1eb('0x7c')],'as':_0xa1eb('0xc0'),'attributes':['id','name','color'],'through':_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xc1')]?{'attributes':[],'where':{'TagId':_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xc1')]||undefined}}:{},'required':_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xc1')]?!![]:![]}];}else{_0x4af59a[_0xa1eb('0xbf')]=[{'all':!![]}];}}return _0x56c5f2[_0x2df867[_0xa1eb('0x15')]][_0xa1eb('0xc')](_0x4af59a);})[_0xa1eb('0x9')](function(_0x2fc881){_0x4a0545[_0xa1eb('0xbd')]=_0x2fc881;if(_0x3a43c3===_0xa1eb('0x35')&&_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xc2')]==='true'){var _0x2593b5=[];for(var _0x34d84d=0x0;_0x34d84d<_0x4a0545['rows'][_0xa1eb('0xa3')];_0x34d84d++){_0x2593b5['push'](_0x4c30ad(_0xa1eb('0xc3'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));_0x2593b5['push'](_0x4c30ad(_0xa1eb('0xc5'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));_0x2593b5[_0xa1eb('0xa4')](_0x4c30ad('fax',_0x4a0545[_0xa1eb('0xbd')][_0x34d84d]['dataValues']));_0x2593b5[_0xa1eb('0xa4')](_0x4c30ad(_0xa1eb('0xc6'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));_0x2593b5[_0xa1eb('0xa4')](_0x4c30ad(_0xa1eb('0xc7'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));_0x2593b5['push'](_0x4c30ad(_0xa1eb('0xc8'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));}return Promise[_0xa1eb('0xa0')](_0x2593b5)[_0xa1eb('0x9')](function(){return _0x4a0545;});}return _0x4a0545;});}});}}});}; \ No newline at end of file +var _0xadb5=['childModel','SquareProject','SquareOdbc','SquareRecording','parentSections','name','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','agent','Telephones','role','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','User','admin','user','zendeskaccounts','ZendeskAccount','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','SELECT','ui.','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','isEmpty','length','params','ignore','union','find','push','autoAssociation','all','rawAttributes','filters','attributes','intersection','fields','hasOwnProperty','limit','offset','order','sort','merge','type','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','DefaultReports','custom','CustomReports','count','rows','ids','CmContact','Tags','color','tag','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','resolve','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects'];(function(_0x4f750b,_0x4e3e43){var _0x918b39=function(_0x106d8f){while(--_0x106d8f){_0x4f750b['push'](_0x4f750b['shift']());}};_0x918b39(++_0x4e3e43);}(_0xadb5,0xad));var _0x5adb=function(_0x2d9b88,_0x3647b3){_0x2d9b88=_0x2d9b88-0x0;var _0x4a1a89=_0xadb5[_0x2d9b88];return _0x4a1a89;};'use strict';var _=require('lodash');var attributes=require(_0x5adb('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0x5adb('0x1'));module[_0x5adb('0x2')]=function(_0x3129c3){var _0x4aecec=_0x3129c3[_0x5adb('0x3')];function _0x31457(_0x2e3ef4,_0x4cb1d1){return new Promise(function(_0x35a5d3,_0x168d89){if(!_0x4cb1d1)return _0x35a5d3(null);var _0x3e2555=_0x4cb1d1[_0x5adb('0x4')]?{[_0x4cb1d1[_0x5adb('0x4')][_0x5adb('0x5')]]:_0x4cb1d1[_0x5adb('0x4')][_0x5adb('0x6')]}:undefined;return _0x4aecec[_0x2e3ef4][_0x5adb('0x7')]({'where':_0x3e2555,'raw':!![]})[_0x5adb('0x8')](function(_0x34f59d){_0x4cb1d1[_0x5adb('0x9')]=_[_0x5adb('0xa')](_0x34f59d,'id');_0x35a5d3(_0x4cb1d1);})[_0x5adb('0xb')](function(_0x563d86){_0x168d89(_0x563d86);});});}function _0x4c268d(_0x1a8f66,_0x1ea238){return new Promise(function(_0x82e67e,_0x53b772){var _0x29f0d5=_0x1a8f66['filter']?{[_0x1a8f66[_0x5adb('0x4')]['field']]:_0x1a8f66[_0x5adb('0x4')][_0x5adb('0x6')]}:undefined;return _0x4aecec[_0x1a8f66[_0x5adb('0xc')]]['findAll']({'where':_0x29f0d5,'raw':!![]})[_0x5adb('0x8')](function(_0x34af2c){_0x1ea238[_0x5adb('0x9')]=_['map'](_0x34af2c,function(_0x2312de){return _0x2312de['name'];});_0x82e67e(_0x1ea238);})[_0x5adb('0xb')](function(_0x42a482){_0x53b772(_0x42a482);});});}function _0x30614e(_0x304784,_0x1c0f97,_0x39d24d){if(!_0x1c0f97)return Promise[_0x5adb('0xd')](null);return new Promise(function(_0x42f4c6,_0xb953a6){return _0x4aecec['UserProfileResource'][_0x5adb('0x7')]({'where':{'sectionId':_0x1c0f97['id']},'raw':!![]})['then'](function(_0x1d9e86){if(_0x304784['field']&&_0x304784[_0x5adb('0x5')]!=='id'){_0x1c0f97['associatedResources']=_['map'](_0x1d9e86,function(_0x1fbaa5){return _0x1fbaa5[_0x304784[_0x5adb('0x5')]];});}else{if(_0x39d24d===_0x5adb('0xe')){_0x1c0f97[_0x5adb('0x9')]=_[_0x5adb('0xa')](_0x1d9e86,function(_0x5af69d){return{'id':_0x5af69d[_0x5adb('0xf')],'type':_0x5af69d['type']};});}else{_0x1c0f97['associatedResources']=_[_0x5adb('0xa')](_0x1d9e86,function(_0x379b33){return _0x379b33[_0x5adb('0xf')];});}}_0x42f4c6(_0x1c0f97);})[_0x5adb('0xb')](function(_0x1e9ccf){_0xb953a6(_0x1e9ccf);});});}function _0x413911(_0xfd9bb9,_0x4ca150){var _0x4b1957={'parentSections':[]};switch(_0xfd9bb9[_0x5adb('0x10')]()){case _0x5adb('0x11'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x13');break;case'odbc':_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x14');break;case'squarerecordings':_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x15');_0x4b1957[_0x5adb('0x16')]=[{'name':'SquareProjects','field':_0x5adb('0x17'),'foreignKey':_0x5adb('0x18')}];break;case _0x5adb('0x19'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x1a');break;case _0x5adb('0x1b'):_0x4b1957['childModel']='CmContact';_0x4b1957['parentSections']=[{'name':_0x5adb('0x1c'),'field':'id','foreignKey':_0x5adb('0x1d')}];break;case _0x5adb('0x1e'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x1f');break;case'companies':_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x20');break;case _0x5adb('0x21'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x22');break;case _0x5adb('0x23'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x24');break;case _0x5adb('0x25'):_0x4b1957[_0x5adb('0x12')]='ChatWebsite';break;case _0x5adb('0x26'):_0x4b1957['childModel']=_0x5adb('0x27');break;case _0x5adb('0x28'):_0x4b1957['childModel']=_0x5adb('0x29');break;case _0x5adb('0x2a'):case _0x5adb('0x2b'):case'outboundroutes':_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x2c');break;case'contexts':_0x4b1957['childModel']=_0x5adb('0x2d');break;case'voicemails':_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x2e');break;case _0x5adb('0x2f'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x30');_0x4b1957['parentSections']=[{'name':_0x5adb('0x31'),'field':_0x5adb('0x17'),'foreignKey':_0x5adb('0x32'),'model':'User','filter':{'field':'role','value':[_0x5adb('0x33')]}},{'name':_0x5adb('0x34'),'field':'name','foreignKey':_0x5adb('0x32'),'model':'User','filter':{'field':_0x5adb('0x35'),'value':['telephone']}},{'name':_0x5adb('0x36'),'field':'name','foreignKey':_0x5adb('0x37'),'model':_0x5adb('0x38'),'filter':{'field':'type','value':[_0x5adb('0x39')]}},{'name':'QueueCampaigns','field':_0x5adb('0x17'),'foreignKey':_0x5adb('0x37'),'model':_0x5adb('0x38'),'filter':{'field':'type','value':[_0x5adb('0x3a')]}}];break;case _0x5adb('0x3b'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x3c');break;case _0x5adb('0x3d'):_0x4b1957['childModel']='VoiceChanSpy';break;case'voiceprefixes':_0x4b1957['childModel']=_0x5adb('0x3e');break;case _0x5adb('0x3f'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x40');break;case _0x5adb('0x41'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x42');break;case _0x5adb('0x43'):_0x4b1957['childModel']='MailAccount';break;case _0x5adb('0x44'):_0x4b1957['childModel']=_0x5adb('0x45');break;case _0x5adb('0x46'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x47');break;case _0x5adb('0x48'):_0x4b1957['childModel']=_0x5adb('0x49');break;case _0x5adb('0x4a'):_0x4b1957['childModel']=_0x5adb('0x4b');break;case _0x5adb('0x4c'):_0x4b1957['childModel']=_0x5adb('0x4d');break;case _0x5adb('0x4e'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x4f');break;case _0x5adb('0x50'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x51');break;case'teams':_0x4b1957['childModel']=_0x5adb('0x52');break;case _0x5adb('0x53'):case _0x5adb('0x54'):_0x4b1957[_0x5adb('0x12')]='VoiceQueue';if(_0x4ca150){_0x4b1957['parentSections']=[{'name':_0x5adb('0x36')},{'name':_0x5adb('0x55')}];}break;case _0x5adb('0x56'):case _0x5adb('0x57'):case _0x5adb('0x58'):_0x4b1957['childModel']=_0x5adb('0x59');if(_0x4ca150){_0x4b1957[_0x5adb('0x16')]=[{'name':'Users','filter':{'field':_0x5adb('0x35'),'value':[_0x5adb('0x5a'),_0x5adb('0x5b')]},'ignore':!![]},{'name':_0x5adb('0x31')},{'name':_0x5adb('0x34')}];}break;case _0x5adb('0x5c'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x5d');break;case'salesforceaccounts':_0x4b1957[_0x5adb('0x12')]='SalesforceAccount';break;case'freshdeskaccounts':_0x4b1957['childModel']=_0x5adb('0x5e');break;case _0x5adb('0x5f'):_0x4b1957[_0x5adb('0x12')]='SugarcrmAccount';break;case _0x5adb('0x60'):_0x4b1957['childModel']=_0x5adb('0x61');break;case _0x5adb('0x62'):_0x4b1957[_0x5adb('0x12')]='ZohoAccount';break;case _0x5adb('0x63'):_0x4b1957['childModel']=_0x5adb('0x59');break;case _0x5adb('0x64'):_0x4b1957['childModel']=_0x5adb('0x65');break;case _0x5adb('0x66'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x67');break;case _0x5adb('0x68'):_0x4b1957['childModel']=_0x5adb('0x69');break;case _0x5adb('0x6a'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x6b');break;case'pauses':_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x6c');break;case _0x5adb('0x6d'):_0x4b1957['childModel']=_0x5adb('0x6e');break;case _0x5adb('0x6f'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x70');break;case'tags':_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x71');break;case _0x5adb('0x72'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x73');break;case'triggers':_0x4b1957[_0x5adb('0x12')]='Trigger';break;case _0x5adb('0x74'):_0x4b1957['childModel']=_0x5adb('0x75');break;case _0x5adb('0x76'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x77');break;case'plugins':_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x78');break;case _0x5adb('0x79'):_0x4b1957['childModel']='AnalyticExtractedReport';_0x4b1957['parentSections']=[{'name':_0x5adb('0x7a'),'field':'id','foreignKey':_0x5adb('0x7b')}];break;case _0x5adb('0x7c'):_0x4b1957[_0x5adb('0x12')]=_0x5adb('0x7d');break;}return _0x4b1957;}function _0xb06bee(_0x204b9b,_0x8d7810){var _0xc880af=_0x204b9b[_0x5adb('0x7e')](0x0)[_0x5adb('0x7f')]()+_0x204b9b[_0x5adb('0x80')](0x1);var _0x2c2357={'type':_0x4aecec['Sequelize']['QueryTypes'][_0x5adb('0x81')],'raw':!![]};return new Promise(function(_0x27a8e4,_0x43cde9){var _0xdb7d8f=squel['select']()[_0x5adb('0x5')](_0x5adb('0x82')+_0xc880af+'InteractionId','id')[_0x5adb('0x5')](_0x5adb('0x83'))[_0x5adb('0x84')]('user_has_'+_0x204b9b+_0x5adb('0x85'),'ui')[_0x5adb('0x86')](_0x5adb('0x87'),_0x8d7810['id']);return _0x4aecec[_0x5adb('0x88')][_0x5adb('0x89')](_0xdb7d8f[_0x5adb('0x8a')](),_0x2c2357)['then'](function(_0x836b91){_0x8d7810[_0xc880af+_0x5adb('0x8b')]=_0x836b91;_0x27a8e4(_0x836b91);})[_0x5adb('0xb')](function(_0x4c8eed){_0x43cde9(_0x4c8eed);});});}return _0x3129c3[_0x5adb('0x8c')](_0x5adb('0x8d'),attributes,{'tableName':_0x5adb('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4f6107){var _0x7287ac={'raw':_0x4f6107['query'][_0x5adb('0x8f')],'where':{}};var _0x1e7e3a={};var _0x24e1ab={'count':0x0,'rows':[]};var _0x57f0a4=_0x4f6107[_0x5adb('0x89')][_0x5adb('0x90')];var _0x539814=_0x4f6107[_0x5adb('0x89')][_0x5adb('0x91')]||![];var _0x248739=_0x413911(_0x57f0a4,_0x539814);if(!_0x248739[_0x5adb('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0x57f0a4+'\x27');var _0x4290bb=[{'name':_0x57f0a4}];if(!_[_0x5adb('0x92')](_0x248739[_0x5adb('0x16')]))_0x4290bb=_0x248739[_0x5adb('0x16')];var _0x5b7556=[];for(var _0x53a4bc=0x0;_0x53a4bc<_0x4290bb[_0x5adb('0x93')];_0x53a4bc++){_0x5b7556['push'](_0x4aecec['UserProfileSection']['find']({'where':{'userProfileId':_0x4f6107[_0x5adb('0x94')]['id'],'name':_0x4290bb[_0x53a4bc][_0x5adb('0x17')]},'raw':!![]}));}return Promise['all'](_0x5b7556)[_0x5adb('0x8')](function(_0x91e023){var _0xcdde17=_[_0x5adb('0x4')](_0x91e023,function(_0x358a23){return _0x358a23?_0x358a23:undefined;});var _0x126e38=_[_0x5adb('0x4')](_0x4290bb,[_0x5adb('0x95'),!![]]);var _0x5240c1=_['isEmpty'](_0xcdde17)&&_['isEmpty'](_0x126e38)?null:_[_0x5adb('0x96')](_0x126e38,_0xcdde17);if(!_0x5240c1)return null;var _0x4357a6=[];for(var _0x3a0d1b=0x0;_0x3a0d1b<_0x5240c1[_0x5adb('0x93')];_0x3a0d1b++){var _0x1f59bb=_[_0x5adb('0x97')](_0x4290bb,function(_0x386c76){return _0x5240c1[_0x3a0d1b]?_0x386c76[_0x5adb('0x17')]===_0x5240c1[_0x3a0d1b]['name']:null;});if(_0x1f59bb){if(_0x5240c1[_0x3a0d1b]['ignore']){_0x4357a6[_0x5adb('0x98')](_0x31457(_0x248739[_0x5adb('0x12')],_0x5240c1[_0x3a0d1b]));}else{if(!_0x5240c1[_0x3a0d1b][_0x5adb('0x99')]){_0x4357a6[_0x5adb('0x98')](_0x30614e(_0x1f59bb,_0x5240c1[_0x3a0d1b],_0x248739[_0x5adb('0x12')]));}else{if(_0x1f59bb[_0x5adb('0xc')]){_0x4357a6[_0x5adb('0x98')](_0x4c268d(_0x1f59bb,_0x5240c1[_0x3a0d1b]));}}}}}return Promise[_0x5adb('0x9a')](_0x4357a6);})[_0x5adb('0x8')](function(_0x3b5ecf){var _0x484f3d=_0x3b5ecf;var _0xedde86=null;if(_0x484f3d){_0xedde86=_0x484f3d[_0x5adb('0x93')]===0x1?_0x484f3d[0x0]:null;}if(!_0xedde86&&!_0x484f3d)return _0x24e1ab;var _0x25ac26=_0x4aecec[_0x248739['childModel']][_0x5adb('0x9b')];_0x1e7e3a[_0x5adb('0xc')]=_['keys'](_0x25ac26);_0x1e7e3a[_0x5adb('0x89')]=_['keys'](_0x4f6107[_0x5adb('0x89')]);_0x1e7e3a[_0x5adb('0x9c')]=_['intersection'](_0x1e7e3a[_0x5adb('0xc')],_0x1e7e3a[_0x5adb('0x89')]);_0x7287ac[_0x5adb('0x9d')]=_[_0x5adb('0x9e')](_0x1e7e3a[_0x5adb('0xc')],qs[_0x5adb('0x9f')](_0x4f6107[_0x5adb('0x89')][_0x5adb('0x9f')]));_0x7287ac['attributes']=_0x7287ac[_0x5adb('0x9d')][_0x5adb('0x93')]?_0x7287ac[_0x5adb('0x9d')]:_0x1e7e3a['model'];if(!_0x4f6107['query'][_0x5adb('0xa0')]('nolimit')){_0x7287ac[_0x5adb('0xa1')]=qs[_0x5adb('0xa1')](_0x4f6107[_0x5adb('0x89')]['limit']);_0x7287ac[_0x5adb('0xa2')]=qs[_0x5adb('0xa2')](_0x4f6107[_0x5adb('0x89')][_0x5adb('0xa2')]);}_0x7287ac[_0x5adb('0xa3')]=qs['sort'](_0x4f6107[_0x5adb('0x89')][_0x5adb('0xa4')]);_0x7287ac[_0x5adb('0x86')]=qs[_0x5adb('0x9c')](_['pick'](_0x4f6107[_0x5adb('0x89')],_0x1e7e3a[_0x5adb('0x9c')]));if(_0x4f6107[_0x5adb('0x89')][_0x5adb('0x4')]){_0x7287ac[_0x5adb('0x86')]=_[_0x5adb('0xa5')](_0x7287ac[_0x5adb('0x86')],{'$or':_['map'](_0x25ac26,function(_0x2801f2){if(_0x2801f2[_0x5adb('0xa6')]['key']!==_0x5adb('0xa7')){var _0x2f8468={};_0x2f8468[_0x2801f2['field']]={'$like':'%'+_0x4f6107[_0x5adb('0x89')]['filter']+'%'};return _0x2f8468;}})});}var _0x372354=[];var _0x268df2=null;var _0x4a2ebc={};if(_0xedde86){_0x268df2=_[_0x5adb('0x97')](_0x4290bb,['name',_0xedde86[_0x5adb('0x17')]]);if(_0x268df2[_0x5adb('0x5')]){_0x4a2ebc={};if(_0x248739[_0x5adb('0x12')]===_0x5adb('0xe')){_0x4a2ebc[_0x268df2[_0x5adb('0xa8')]]=_['map'](_0xedde86[_0x5adb('0x9')],'id');}else{_0x4a2ebc[_0x268df2[_0x5adb('0xa8')]]=_0xedde86[_0x5adb('0x9')];}_0x372354[_0x5adb('0x98')](_0x4a2ebc);}else{_0x7287ac['where']['id']=_0xedde86['associatedResources'];}}else{for(var _0x3f3db9=0x0;_0x3f3db9<_0x484f3d[_0x5adb('0x93')];_0x3f3db9++){_0x268df2=_[_0x5adb('0x97')](_0x4290bb,[_0x5adb('0x17'),_0x484f3d[_0x3f3db9][_0x5adb('0x17')]]);if(_0x268df2[_0x5adb('0x5')]){_0x4a2ebc={};_0x4a2ebc[_0x268df2[_0x5adb('0xa8')]]=_0x484f3d[_0x3f3db9]['associatedResources'];_0x372354[_0x5adb('0x98')](_0x4a2ebc);}else{if(!_0x7287ac[_0x5adb('0x86')]['id'])_0x7287ac[_0x5adb('0x86')]['id']=[];_0x484f3d[_0x3f3db9][_0x5adb('0x9')]['forEach'](function(_0x450f90){_0x7287ac[_0x5adb('0x86')]['id'][_0x5adb('0x98')](_0x450f90);});}}}if(!_[_0x5adb('0x92')](_0x372354)){_0x7287ac[_0x5adb('0x86')]=_[_0x5adb('0xa5')](_0x7287ac[_0x5adb('0x86')],{'$and':{'$or':_0x372354}});}_0x7287ac=_[_0x5adb('0xa5')]({},_0x7287ac,_0x4f6107[_0x5adb('0xa9')]);if(_0xedde86&&!_0xedde86['autoAssociation']&&_0x248739[_0x5adb('0x12')]===_0x5adb('0xe')){if(_0x4f6107['query'][_0x5adb('0xaa')]){_0x7287ac[_0x5adb('0xab')]=[{'all':!![]}];}return _0x4aecec[_0x248739[_0x5adb('0x12')]][_0x5adb('0x7')](_0x7287ac)[_0x5adb('0x8')](function(_0x1bbc2e){var _0x450516=[];_0x1bbc2e[_0x5adb('0xac')](function(_0x57f557){var _0x11d9ce;switch(_0x57f557[_0x5adb('0xad')]){case'default':_0x11d9ce=_[_0x5adb('0x97')](_0xedde86[_0x5adb('0x9')],function(_0x14d4a7){return _0x14d4a7['id']===_0x57f557['reportId']&&_0x14d4a7['type']===_0x5adb('0xae');});break;case _0x5adb('0xaf'):_0x11d9ce=_[_0x5adb('0x97')](_0xedde86['associatedResources'],function(_0x14b36f){return _0x14b36f['id']===_0x57f557[_0x5adb('0x7b')]&&_0x14b36f[_0x5adb('0xa6')]===_0x5adb('0xb0');});break;}if(_0x11d9ce)_0x450516[_0x5adb('0x98')](_0x57f557);});_0x24e1ab[_0x5adb('0xb1')]=_0x450516[_0x5adb('0x93')];_0x24e1ab[_0x5adb('0xb2')]=_0x450516;return _0x24e1ab;});}else{if(!_[_0x5adb('0x92')](_0x4f6107[_0x5adb('0x89')][_0x5adb('0xb3')])){_0x7287ac[_0x5adb('0x86')]['id']=_0x7287ac['where']['id']?_['intersection'](_0x7287ac[_0x5adb('0x86')]['id'],_0x4f6107[_0x5adb('0x89')]['ids']):_0x4f6107[_0x5adb('0x89')][_0x5adb('0xb3')];}return _0x4aecec[_0x248739[_0x5adb('0x12')]][_0x5adb('0xb1')]({'where':_0x7287ac[_0x5adb('0x86')]})[_0x5adb('0x8')](function(_0x15626b){_0x24e1ab[_0x5adb('0xb1')]=_0x15626b;if(_0x4f6107[_0x5adb('0x89')]['includeAll']){if(_0x248739[_0x5adb('0x12')]===_0x5adb('0xb4')){_0x7287ac[_0x5adb('0xab')]=[{'model':_0x4aecec['Tag'],'as':_0x5adb('0xb5'),'attributes':['id',_0x5adb('0x17'),_0x5adb('0xb6')],'required':_0x4f6107[_0x5adb('0x89')][_0x5adb('0xb7')]?!![]:![]},{'model':_0x4aecec[_0x5adb('0x71')],'as':'ThroughTags','attributes':['id',_0x5adb('0x17'),_0x5adb('0xb6')],'through':_0x4f6107[_0x5adb('0x89')][_0x5adb('0xb7')]?{'attributes':[],'where':{'TagId':_0x4f6107[_0x5adb('0x89')][_0x5adb('0xb7')]||undefined}}:{},'required':_0x4f6107[_0x5adb('0x89')][_0x5adb('0xb7')]?!![]:![]}];}else{_0x7287ac[_0x5adb('0xab')]=[{'all':!![]}];}}return _0x4aecec[_0x248739[_0x5adb('0x12')]]['findAll'](_0x7287ac);})[_0x5adb('0x8')](function(_0x5b9565){_0x24e1ab[_0x5adb('0xb2')]=_0x5b9565;if(_0x57f0a4===_0x5adb('0x31')&&_0x4f6107[_0x5adb('0x89')][_0x5adb('0xb8')]===_0x5adb('0xb9')){var _0x5c7b1b=[];for(var _0x5b0fe2=0x0;_0x5b0fe2<_0x24e1ab[_0x5adb('0xb2')][_0x5adb('0x93')];_0x5b0fe2++){_0x5c7b1b[_0x5adb('0x98')](_0xb06bee(_0x5adb('0xba'),_0x24e1ab[_0x5adb('0xb2')][_0x5b0fe2][_0x5adb('0xbb')]));_0x5c7b1b['push'](_0xb06bee('sms',_0x24e1ab[_0x5adb('0xb2')][_0x5b0fe2][_0x5adb('0xbb')]));_0x5c7b1b[_0x5adb('0x98')](_0xb06bee('fax',_0x24e1ab['rows'][_0x5b0fe2][_0x5adb('0xbb')]));_0x5c7b1b['push'](_0xb06bee(_0x5adb('0xbc'),_0x24e1ab[_0x5adb('0xb2')][_0x5b0fe2]['dataValues']));_0x5c7b1b['push'](_0xb06bee(_0x5adb('0xbd'),_0x24e1ab['rows'][_0x5b0fe2]['dataValues']));_0x5c7b1b[_0x5adb('0x98')](_0xb06bee(_0x5adb('0xbe'),_0x24e1ab[_0x5adb('0xb2')][_0x5b0fe2][_0x5adb('0xbb')]));}return Promise[_0x5adb('0x9a')](_0x5c7b1b)[_0x5adb('0x8')](function(){return _0x24e1ab;});}return _0x24e1ab;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0099ef0..8e2c97b 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 _0x4813=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4813,0x14e));var _0x3481=function(_0x450a7e,_0x39ca8b){_0x450a7e=_0x450a7e-0x0;var _0x42c4c4=_0x4813[_0x450a7e];return _0x42c4c4;};'use strict';var _=require(_0x3481('0x0'));var util=require(_0x3481('0x1'));var moment=require(_0x3481('0x2'));var BPromise=require(_0x3481('0x3'));var rs=require(_0x3481('0x4'));var fs=require('fs');var Redis=require(_0x3481('0x5'));var db=require(_0x3481('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3481('0x7'))(_0x3481('0x8'));var config=require(_0x3481('0x9'));var jayson=require(_0x3481('0xa'));var client=jayson[_0x3481('0xb')]['http']({'port':0x232a});config['redis']=_[_0x3481('0xc')](config['redis'],{'host':_0x3481('0xd'),'port':0x18eb});var socket=require(_0x3481('0xe'))(new Redis(config[_0x3481('0xf')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x52e455,_0x3da272,_0x4ab043){return new BPromise(function(_0x4da46b,_0x2a079d){return client[_0x3481('0x10')](_0x52e455,_0x4ab043)[_0x3481('0x11')](function(_0x3aff58){logger[_0x3481('0x12')](_0x3481('0x13'),_0x3da272,_0x3481('0x14'));logger[_0x3481('0x15')](_0x3481('0x16'),_0x3da272,_0x3481('0x14'),JSON[_0x3481('0x17')](_0x3aff58));if(_0x3aff58[_0x3481('0x18')]){if(_0x3aff58['error'][_0x3481('0x19')]===0x1f4){logger[_0x3481('0x18')](_0x3481('0x13'),_0x3da272,_0x3aff58[_0x3481('0x18')][_0x3481('0x1a')]);return _0x2a079d(_0x3aff58[_0x3481('0x18')]['message']);}logger[_0x3481('0x18')](_0x3481('0x13'),_0x3da272,_0x3aff58['error']['message']);return _0x4da46b(_0x3aff58['error']['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x3da272,_0x3481('0x14'));_0x4da46b(_0x3aff58[_0x3481('0x1b')]['message']);}})['catch'](function(_0x11c6b3){logger[_0x3481('0x18')](_0x3481('0x13'),_0x3da272,_0x11c6b3);_0x2a079d(_0x11c6b3);});});} \ No newline at end of file +var _0x870d=['defaults','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x3db019,_0x48e135){var _0x351aad=function(_0x4b92aa){while(--_0x4b92aa){_0x3db019['push'](_0x3db019['shift']());}};_0x351aad(++_0x48e135);}(_0x870d,0xde));var _0xd870=function(_0x3c9206,_0x39edd1){_0x3c9206=_0x3c9206-0x0;var _0x5ec03f=_0x870d[_0x3c9206];return _0x5ec03f;};'use strict';var _=require('lodash');var util=require(_0xd870('0x0'));var moment=require(_0xd870('0x1'));var BPromise=require(_0xd870('0x2'));var rs=require(_0xd870('0x3'));var fs=require('fs');var Redis=require(_0xd870('0x4'));var db=require(_0xd870('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd870('0x6'))(_0xd870('0x7'));var config=require(_0xd870('0x8'));var jayson=require(_0xd870('0x9'));var client=jayson[_0xd870('0xa')]['http']({'port':0x232a});config[_0xd870('0xb')]=_[_0xd870('0xc')](config[_0xd870('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd870('0xb')]));require(_0xd870('0xd'))[_0xd870('0xe')](socket);function respondWithRpcPromise(_0x5aaee8,_0x2269e8,_0x123bbf){return new BPromise(function(_0x4e9745,_0x4f1952){return client[_0xd870('0xf')](_0x5aaee8,_0x123bbf)[_0xd870('0x10')](function(_0x434450){logger['info'](_0xd870('0x11'),_0x2269e8,_0xd870('0x12'));logger['debug'](_0xd870('0x13'),_0x2269e8,_0xd870('0x12'),JSON['stringify'](_0x434450));if(_0x434450[_0xd870('0x14')]){if(_0x434450['error'][_0xd870('0x15')]===0x1f4){logger[_0xd870('0x14')](_0xd870('0x11'),_0x2269e8,_0x434450[_0xd870('0x14')]['message']);return _0x4f1952(_0x434450[_0xd870('0x14')][_0xd870('0x16')]);}logger['error'](_0xd870('0x11'),_0x2269e8,_0x434450[_0xd870('0x14')][_0xd870('0x16')]);return _0x4e9745(_0x434450['error'][_0xd870('0x16')]);}else{logger[_0xd870('0x17')]('UserProfile,\x20%s,\x20%s',_0x2269e8,_0xd870('0x12'));_0x4e9745(_0x434450[_0xd870('0x18')]['message']);}})[_0xd870('0x19')](function(_0x28fd22){logger['error'](_0xd870('0x11'),_0x2269e8,_0x28fd22);_0x4f1952(_0x28fd22);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c47eb6c..6a4b31e 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 _0x09df=['update','removeListener','register','length','userProfile:','./userProfile.events','save','remove'];(function(_0x1ffb38,_0x4c3cd4){var _0x433b38=function(_0x4fc8e9){while(--_0x4fc8e9){_0x1ffb38['push'](_0x1ffb38['shift']());}};_0x433b38(++_0x4c3cd4);}(_0x09df,0x1d5));var _0xf09d=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x09df[_0x5a60ce];return _0x393e5e;};'use strict';var UserProfileEvents=require(_0xf09d('0x0'));var events=[_0xf09d('0x1'),_0xf09d('0x2'),_0xf09d('0x3')];function createListener(_0x1d9a05,_0x69858f){return function(_0x386b92){_0x69858f['emit'](_0x1d9a05,_0x386b92);};}function removeListener(_0x28789a,_0x13cbf2){return function(){UserProfileEvents[_0xf09d('0x4')](_0x28789a,_0x13cbf2);};}exports[_0xf09d('0x5')]=function(_0x286546){for(var _0x10be21=0x0,_0x5bbb1b=events[_0xf09d('0x6')];_0x10be21<_0x5bbb1b;_0x10be21++){var _0x372baa=events[_0x10be21];var _0xd8f745=createListener(_0xf09d('0x7')+_0x372baa,_0x286546);UserProfileEvents['on'](_0x372baa,_0xd8f745);}}; \ No newline at end of file +var _0xf50a=['removeListener','register','length','./userProfile.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf50a,0x103));var _0xaf50=function(_0x1c9b46,_0x507d41){_0x1c9b46=_0x1c9b46-0x0;var _0x2d199c=_0xf50a[_0x1c9b46];return _0x2d199c;};'use strict';var UserProfileEvents=require(_0xaf50('0x0'));var events=[_0xaf50('0x1'),_0xaf50('0x2'),_0xaf50('0x3')];function createListener(_0x31d27e,_0x5b1a18){return function(_0x307f89){_0x5b1a18[_0xaf50('0x4')](_0x31d27e,_0x307f89);};}function removeListener(_0x3e694a,_0x42dd40){return function(){UserProfileEvents[_0xaf50('0x5')](_0x3e694a,_0x42dd40);};}exports[_0xaf50('0x6')]=function(_0x2c8339){for(var _0x1e4665=0x0,_0x3d2469=events[_0xaf50('0x7')];_0x1e4665<_0x3d2469;_0x1e4665++){var _0x3c858f=events[_0x1e4665];var _0x5d500f=createListener('userProfile:'+_0x3c858f,_0x2c8339);UserProfileEvents['on'](_0x3c858f,_0x5d500f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d9d07ee..b255360 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 _0xfaae=['describe','get','/:id','post','create','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfaae,0x1aa));var _0xefaa=function(_0x1ef81b,_0x2e03e2){_0x1ef81b=_0x1ef81b-0x0;var _0x33349f=_0xfaae[_0x1ef81b];return _0x33349f;};'use strict';var multer=require(_0xefaa('0x0'));var util=require(_0xefaa('0x1'));var path=require(_0xefaa('0x2'));var timeout=require(_0xefaa('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xefaa('0x4'));var auth=require(_0xefaa('0x5'));var interaction=require(_0xefaa('0x6'));var config=require(_0xefaa('0x7'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xefaa('0x8')](),controller[_0xefaa('0x9')]);router['get'](_0xefaa('0xa'),auth[_0xefaa('0x8')](),controller[_0xefaa('0xb')]);router[_0xefaa('0xc')](_0xefaa('0xd'),auth[_0xefaa('0x8')](),controller['show']);router[_0xefaa('0xe')]('/',auth['isAuthenticated'](),controller[_0xefaa('0xf')]);router[_0xefaa('0x10')](_0xefaa('0xd'),auth[_0xefaa('0x8')](),controller[_0xefaa('0x11')]);router['delete'](_0xefaa('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xefaa('0x12')]=router; \ No newline at end of file +var _0x7763=['show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','/:id'];(function(_0x321d5e,_0x1ae4a9){var _0x3458cd=function(_0x120f19){while(--_0x120f19){_0x321d5e['push'](_0x321d5e['shift']());}};_0x3458cd(++_0x1ae4a9);}(_0x7763,0x15d));var _0x3776=function(_0x5eb56c,_0x5bcf89){_0x5eb56c=_0x5eb56c-0x0;var _0x7ce5=_0x7763[_0x5eb56c];return _0x7ce5;};'use strict';var multer=require(_0x3776('0x0'));var util=require(_0x3776('0x1'));var path=require('path');var timeout=require(_0x3776('0x2'));var express=require(_0x3776('0x3'));var router=express['Router']();var fs_extra=require(_0x3776('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3776('0x5'));var config=require(_0x3776('0x6'));var controller=require(_0x3776('0x7'));router[_0x3776('0x8')]('/',auth[_0x3776('0x9')](),controller['index']);router[_0x3776('0x8')](_0x3776('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x3776('0xb'),auth[_0x3776('0x9')](),controller[_0x3776('0xc')]);router[_0x3776('0xd')]('/',auth[_0x3776('0x9')](),controller[_0x3776('0xe')]);router[_0x3776('0xf')]('/:id',auth[_0x3776('0x9')](),controller[_0x3776('0x10')]);router['delete'](_0x3776('0xb'),auth[_0x3776('0x9')](),controller[_0x3776('0x11')]);module[_0x3776('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index ce344b3..d32880f 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 _0xeceb=['STRING','INTEGER','sequelize','exports'];(function(_0x2bd0d7,_0x158fb3){var _0x3f3d78=function(_0x204a96){while(--_0x204a96){_0x2bd0d7['push'](_0x2bd0d7['shift']());}};_0x3f3d78(++_0x158fb3);}(_0xeceb,0x136));var _0xbece=function(_0x1857ae,_0xfbc7e8){_0x1857ae=_0x1857ae-0x0;var _0x211f80=_0xeceb[_0x1857ae];return _0x211f80;};'use strict';var Sequelize=require(_0xbece('0x0'));module[_0xbece('0x1')]={'name':{'type':Sequelize[_0xbece('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xbece('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xde00=['STRING','INTEGER'];(function(_0xfb0bf9,_0x17b4a8){var _0x440f17=function(_0xf5282){while(--_0xf5282){_0xfb0bf9['push'](_0xfb0bf9['shift']());}};_0x440f17(++_0x17b4a8);}(_0xde00,0xd2));var _0x0de0=function(_0x3b601a,_0x1fcc08){_0x3b601a=_0x3b601a-0x0;var _0x3b4d2b=_0xde00[_0x3b601a];return _0x3b4d2b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0de0('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0de0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0de0('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index c011d52..0b3e11e 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 _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xacf4,0xe7));var _0x4acf=function(_0xcd03ed,_0x186cbb){_0xcd03ed=_0xcd03ed-0x0;var _0x567fb6=_0xacf4[_0xcd03ed];return _0x567fb6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['UserProfileResource'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['UserProfileResource']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file +var _0x8e3f=['save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','UserProfileResource','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=typeof _0x40c196['offset']===_0xf8e3('0x1d')&&typeof _0x40c196[_0xf8e3('0x1e')]===_0xf8e3('0x1d');var _0x3b01ac=_0x460629[_0xf8e3('0x1f')];var _0x11d4cc=_0x570ee3?0x0:_0x40c196[_0xf8e3('0x20')];var _0x2e27e3=_0x570ee3?_0x460629[_0xf8e3('0x1f')]:_0x40c196[_0xf8e3('0x20')]+_0x40c196['limit'];var _0x20cc64;if(_0x2e27e3>=_0x3b01ac){_0x2e27e3=_0x3b01ac;_0x20cc64=0xc8;}else{_0x20cc64=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x20cc64);return _0x1ec773[_0xf8e3('0x21')](_0xf8e3('0x22'),_0x11d4cc+'-'+_0x2e27e3+'/'+_0x3b01ac)[_0xf8e3('0x23')](_0x460629);}return null;};}function patchUpdates(_0x11c58e){return function(_0x1cae53){try{jsonpatch[_0xf8e3('0x24')](_0x1cae53,_0x11c58e,!![]);}catch(_0x5b99b1){return BPromise[_0xf8e3('0x25')](_0x5b99b1);}return _0x1cae53[_0xf8e3('0x26')]();};}function saveUpdates(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')](_0x3c636d)['then'](function(_0x286059){return _0x286059;});}return null;};}function removeEntity(_0x225a1b,_0x33d526){return function(_0x2dc856){if(_0x2dc856){return _0x2dc856[_0xf8e3('0x28')]()[_0xf8e3('0x29')](function(){_0x225a1b['status'](0xcc)[_0xf8e3('0x1b')]();});}};}function handleEntityNotFound(_0x2fc674,_0x3373ca){return function(_0x417b42){if(!_0x417b42){_0x2fc674[_0xf8e3('0x1a')](0x194);}return _0x417b42;};}function handleError(_0x3b41a1,_0x2963ed){_0x2963ed=_0x2963ed||0x1f4;return function(_0x157a2d){logger['error'](_0x157a2d[_0xf8e3('0x2a')]);if(_0x157a2d[_0xf8e3('0x2b')]){delete _0x157a2d[_0xf8e3('0x2b')];}_0x3b41a1[_0xf8e3('0x1c')](_0x2963ed)[_0xf8e3('0x2c')](_0x157a2d);};}exports[_0xf8e3('0x2d')]=function(_0x16485e,_0xfaf15d){var _0x4f2ae9={},_0x21e1c0={},_0x243e28={'count':0x0,'rows':[]};var _0x492694=_[_0xf8e3('0x2e')](db['UserProfileResource'][_0xf8e3('0x2f')],function(_0x10cf28){return{'name':_0x10cf28[_0xf8e3('0x30')],'type':_0x10cf28[_0xf8e3('0x31')][_0xf8e3('0x32')]};});_0x21e1c0[_0xf8e3('0x33')]=_[_0xf8e3('0x2e')](_0x492694,_0xf8e3('0x2b'));_0x21e1c0['query']=_[_0xf8e3('0x34')](_0x16485e[_0xf8e3('0x35')]);_0x21e1c0['filters']=_['intersection'](_0x21e1c0['model'],_0x21e1c0[_0xf8e3('0x35')]);_0x4f2ae9['attributes']=_[_0xf8e3('0x36')](_0x21e1c0[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x16485e[_0xf8e3('0x35')]['fields']));_0x4f2ae9['attributes']=_0x4f2ae9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0x4f2ae9[_0xf8e3('0x38')]:_0x21e1c0[_0xf8e3('0x33')];if(!_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x3a')]('nolimit')){_0x4f2ae9[_0xf8e3('0x1e')]=qs['limit'](_0x16485e['query'][_0xf8e3('0x1e')]);_0x4f2ae9[_0xf8e3('0x20')]=qs[_0xf8e3('0x20')](_0x16485e[_0xf8e3('0x35')]['offset']);}_0x4f2ae9['order']=qs[_0xf8e3('0x3b')](_0x16485e[_0xf8e3('0x35')]['sort']);_0x4f2ae9[_0xf8e3('0x3c')]=qs[_0xf8e3('0x3d')](_[_0xf8e3('0x3e')](_0x16485e[_0xf8e3('0x35')],_0x21e1c0['filters']),_0x492694);if(_0x16485e['query']['filter']){_0x4f2ae9[_0xf8e3('0x3c')]=_[_0xf8e3('0x3f')](_0x4f2ae9[_0xf8e3('0x3c')],{'$or':_[_0xf8e3('0x2e')](_0x492694,function(_0x53160a){if(_0x53160a[_0xf8e3('0x31')]!=='VIRTUAL'){var _0x20909b={};_0x20909b[_0x53160a[_0xf8e3('0x2b')]]={'$like':'%'+_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x40')]+'%'};return _0x20909b;}})});}_0x4f2ae9=_[_0xf8e3('0x3f')]({},_0x4f2ae9,_0x16485e[_0xf8e3('0x41')]);var _0x82e778={'where':_0x4f2ae9[_0xf8e3('0x3c')]};return db[_0xf8e3('0x42')]['count'](_0x82e778)[_0xf8e3('0x29')](function(_0x537089){_0x243e28[_0xf8e3('0x1f')]=_0x537089;if(_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x43')]){_0x4f2ae9[_0xf8e3('0x44')]=[{'all':!![]}];}return db[_0xf8e3('0x42')][_0xf8e3('0x45')](_0x4f2ae9);})[_0xf8e3('0x29')](function(_0x2f05b7){_0x243e28['rows']=_0x2f05b7;return _0x243e28;})[_0xf8e3('0x29')](respondWithFilteredResult(_0xfaf15d,_0x4f2ae9))[_0xf8e3('0x46')](handleError(_0xfaf15d,null));};exports[_0xf8e3('0x47')]=function(_0x382dbb,_0x6dd110){var _0xe7fcb9={'raw':![],'where':{'id':_0x382dbb[_0xf8e3('0x48')]['id']}},_0x792190={};_0x792190['model']=_['keys'](db['UserProfileResource'][_0xf8e3('0x2f')]);_0x792190[_0xf8e3('0x35')]=_['keys'](_0x382dbb[_0xf8e3('0x35')]);_0x792190['filters']=_[_0xf8e3('0x36')](_0x792190[_0xf8e3('0x33')],_0x792190['query']);_0xe7fcb9[_0xf8e3('0x38')]=_['intersection'](_0x792190[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x382dbb['query'][_0xf8e3('0x37')]));_0xe7fcb9[_0xf8e3('0x38')]=_0xe7fcb9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0xe7fcb9['attributes']:_0x792190['model'];if(_0x382dbb['query'][_0xf8e3('0x43')]){_0xe7fcb9[_0xf8e3('0x44')]=[{'all':!![]}];}_0xe7fcb9=_[_0xf8e3('0x3f')]({},_0xe7fcb9,_0x382dbb['options']);return db[_0xf8e3('0x42')]['find'](_0xe7fcb9)[_0xf8e3('0x29')](handleEntityNotFound(_0x6dd110,null))[_0xf8e3('0x29')](respondWithResult(_0x6dd110,null))['catch'](handleError(_0x6dd110,null));};exports['create']=function(_0x128234,_0x2939e6){return db[_0xf8e3('0x42')][_0xf8e3('0x49')](_0x128234[_0xf8e3('0x4a')],{})[_0xf8e3('0x29')](respondWithResult(_0x2939e6,0xc9))[_0xf8e3('0x46')](handleError(_0x2939e6,null));};exports[_0xf8e3('0x27')]=function(_0xdc2430,_0x81898e){if(_0xdc2430[_0xf8e3('0x4a')]['id']){delete _0xdc2430['body']['id'];}return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0xdc2430[_0xf8e3('0x48')]['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x81898e,null))[_0xf8e3('0x29')](saveUpdates(_0xdc2430[_0xf8e3('0x4a')],null))['then'](respondWithResult(_0x81898e,null))[_0xf8e3('0x46')](handleError(_0x81898e,null));};exports[_0xf8e3('0x28')]=function(_0x39caae,_0x3e60a6){return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0x39caae['params']['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x3e60a6,null))[_0xf8e3('0x29')](removeEntity(_0x3e60a6,null))[_0xf8e3('0x46')](handleError(_0x3e60a6,null));};exports[_0xf8e3('0x4c')]=function(_0x113404,_0x2fef16){return db['UserProfileResource'][_0xf8e3('0x4c')]()[_0xf8e3('0x29')](respondWithResult(_0x2fef16,null))[_0xf8e3('0x46')](handleError(_0x2fef16,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a920fac..1684851 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 _0x766c=['../../config/logger','api','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x766c,0xb5));var _0xc766=function(_0x314464,_0x32e9db){_0x314464=_0x314464-0x0;var _0x54f901=_0x766c[_0x314464];return _0x54f901;};'use strict';var _=require('lodash');var util=require(_0xc766('0x0'));var logger=require(_0xc766('0x1'))(_0xc766('0x2'));var moment=require('moment');var BPromise=require(_0xc766('0x3'));var rp=require(_0xc766('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc766('0x5'));var attributes=require(_0xc766('0x6'));module[_0xc766('0x7')]=function(_0x2b61ca,_0x126637){return _0x2b61ca[_0xc766('0x8')](_0xc766('0x9'),attributes,{'tableName':_0xc766('0xa'),'paranoid':![],'indexes':[{'name':_0xc766('0xb'),'fields':[_0xc766('0xc'),_0xc766('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe12c=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','../../config/logger'];(function(_0x3b19d5,_0x3d5bc5){var _0x37557e=function(_0x4bfa0e){while(--_0x4bfa0e){_0x3b19d5['push'](_0x3b19d5['shift']());}};_0x37557e(++_0x3d5bc5);}(_0xe12c,0x1cc));var _0xce12=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0xe12c[_0x142ec2];return _0x45ef4e;};'use strict';var _=require(_0xce12('0x0'));var util=require('util');var logger=require(_0xce12('0x1'))(_0xce12('0x2'));var moment=require(_0xce12('0x3'));var BPromise=require(_0xce12('0x4'));var rp=require(_0xce12('0x5'));var fs=require('fs');var path=require(_0xce12('0x6'));var rimraf=require('rimraf');var config=require(_0xce12('0x7'));var attributes=require('./userProfileResource.attributes');module[_0xce12('0x8')]=function(_0x3ce137,_0x4be94d){return _0x3ce137[_0xce12('0x9')](_0xce12('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xce12('0xb'),'fields':[_0xce12('0xc'),_0xce12('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 89b339b..a74057f 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 _0x4780=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4780,0x1d5));var _0x0478=function(_0x2b4722,_0x44a089){_0x2b4722=_0x2b4722-0x0;var _0x29c705=_0x4780[_0x2b4722];return _0x29c705;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0478('0x0'));var rs=require(_0x0478('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0478('0x2'))['db'];var utils=require(_0x0478('0x3'));var logger=require(_0x0478('0x4'))(_0x0478('0x5'));var config=require(_0x0478('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0478('0x7')][_0x0478('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bd105,_0x380956,_0x4fd0ec){return new BPromise(function(_0x3a9c97,_0x39d1f3){return client[_0x0478('0x9')](_0x4bd105,_0x4fd0ec)[_0x0478('0xa')](function(_0x3c3d66){logger[_0x0478('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x380956,_0x0478('0xc'));logger[_0x0478('0xd')](_0x0478('0xe'),_0x380956,'request\x20sent',JSON[_0x0478('0xf')](_0x3c3d66));if(_0x3c3d66[_0x0478('0x10')]){if(_0x3c3d66[_0x0478('0x10')][_0x0478('0x11')]===0x1f4){logger[_0x0478('0x10')](_0x0478('0x12'),_0x380956,_0x3c3d66[_0x0478('0x10')][_0x0478('0x13')]);return _0x39d1f3(_0x3c3d66[_0x0478('0x10')][_0x0478('0x13')]);}logger[_0x0478('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x380956,_0x3c3d66[_0x0478('0x10')][_0x0478('0x13')]);return _0x3a9c97(_0x3c3d66[_0x0478('0x10')]['message']);}else{logger['info'](_0x0478('0x12'),_0x380956,_0x0478('0xc'));_0x3a9c97(_0x3c3d66[_0x0478('0x14')][_0x0478('0x13')]);}})['catch'](function(_0x486f8e){logger[_0x0478('0x10')](_0x0478('0x12'),_0x380956,_0x486f8e);_0x39d1f3(_0x486f8e);});});} \ No newline at end of file +var _0xe35c=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird'];(function(_0x12db6f,_0x159040){var _0x329190=function(_0x3e95d6){while(--_0x3e95d6){_0x12db6f['push'](_0x12db6f['shift']());}};_0x329190(++_0x159040);}(_0xe35c,0x75));var _0xce35=function(_0x579faa,_0x279b7a){_0x579faa=_0x579faa-0x0;var _0x3f11f1=_0xe35c[_0x579faa];return _0x3f11f1;};'use strict';var _=require(_0xce35('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xce35('0x1'));var rs=require(_0xce35('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce35('0x3'));var logger=require(_0xce35('0x4'))(_0xce35('0x5'));var config=require('../../config/environment');var jayson=require(_0xce35('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4196df,_0x17ac48,_0x5c0972){return new BPromise(function(_0x3ad364,_0xa6a928){return client['request'](_0x4196df,_0x5c0972)[_0xce35('0x7')](function(_0x35c455){logger[_0xce35('0x8')](_0xce35('0x9'),_0x17ac48,_0xce35('0xa'));logger[_0xce35('0xb')](_0xce35('0xc'),_0x17ac48,'request\x20sent',JSON[_0xce35('0xd')](_0x35c455));if(_0x35c455[_0xce35('0xe')]){if(_0x35c455[_0xce35('0xe')]['code']===0x1f4){logger[_0xce35('0xe')](_0xce35('0x9'),_0x17ac48,_0x35c455['error'][_0xce35('0xf')]);return _0xa6a928(_0x35c455[_0xce35('0xe')][_0xce35('0xf')]);}logger[_0xce35('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x17ac48,_0x35c455['error'][_0xce35('0xf')]);return _0x3ad364(_0x35c455[_0xce35('0xe')][_0xce35('0xf')]);}else{logger[_0xce35('0x8')]('UserProfileResource,\x20%s,\x20%s',_0x17ac48,_0xce35('0xa'));_0x3ad364(_0x35c455[_0xce35('0x10')][_0xce35('0xf')]);}})['catch'](function(_0x391fe4){logger['error'](_0xce35('0x9'),_0x17ac48,_0x391fe4);_0xa6a928(_0x391fe4);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4e7e863..112bde8 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 _0x2350=['../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1bbb02,_0x4e7c03){var _0x52d18c=function(_0x19b6a9){while(--_0x19b6a9){_0x1bbb02['push'](_0x1bbb02['shift']());}};_0x52d18c(++_0x4e7c03);}(_0x2350,0xae));var _0x0235=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0x2350[_0x53f402];return _0x45a76d;};'use strict';var multer=require('multer');var util=require(_0x0235('0x0'));var path=require(_0x0235('0x1'));var timeout=require(_0x0235('0x2'));var express=require(_0x0235('0x3'));var router=express[_0x0235('0x4')]();var fs_extra=require(_0x0235('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0235('0x6'));var config=require(_0x0235('0x7'));var controller=require(_0x0235('0x8'));router['get']('/',auth[_0x0235('0x9')](),controller['index']);router[_0x0235('0xa')](_0x0235('0xb'),auth[_0x0235('0x9')](),controller['describe']);router[_0x0235('0xa')](_0x0235('0xc'),auth[_0x0235('0x9')](),controller[_0x0235('0xd')]);router[_0x0235('0xe')]('/',auth['isAuthenticated'](),controller[_0x0235('0xf')]);router[_0x0235('0x10')](_0x0235('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0235('0x11')](_0x0235('0xc'),auth[_0x0235('0x9')](),controller[_0x0235('0x12')]);module[_0x0235('0x13')]=router; \ No newline at end of file +var _0x40b8=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports'];(function(_0x5a596f,_0x776d83){var _0x23a0e9=function(_0x335e32){while(--_0x335e32){_0x5a596f['push'](_0x5a596f['shift']());}};_0x23a0e9(++_0x776d83);}(_0x40b8,0x72));var _0x840b=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x40b8[_0x40220a];return _0x3903cc;};'use strict';var multer=require('multer');var util=require(_0x840b('0x0'));var path=require(_0x840b('0x1'));var timeout=require(_0x840b('0x2'));var express=require(_0x840b('0x3'));var router=express[_0x840b('0x4')]();var fs_extra=require(_0x840b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x840b('0x6'));var controller=require('./userProfileSection.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x840b('0x7')]);router[_0x840b('0x8')](_0x840b('0x9'),auth[_0x840b('0xa')](),controller[_0x840b('0xb')]);router[_0x840b('0x8')](_0x840b('0xc'),auth[_0x840b('0xa')](),controller[_0x840b('0xd')]);router[_0x840b('0xe')]('/',auth[_0x840b('0xa')](),controller[_0x840b('0xf')]);router['put']('/:id',auth[_0x840b('0xa')](),controller['update']);router[_0x840b('0x10')]('/:id',auth[_0x840b('0xa')](),controller[_0x840b('0x11')]);module[_0x840b('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 4b5cc55..e165941 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 _0x9ffd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x29917f,_0x2b328a){var _0x41bc5f=function(_0x5f3f8a){while(--_0x5f3f8a){_0x29917f['push'](_0x29917f['shift']());}};_0x41bc5f(++_0x2b328a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0xccb522,_0x3893c4){_0xccb522=_0xccb522-0x0;var _0x27b24b=_0x9ffd[_0xccb522];return _0x27b24b;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd9ff('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd9ff('0x2')],'set':function(_0x53e962){this[_0xd9ff('0x5')](_0xd9ff('0x6'),_0x53e962?_0x53e962['join'](''):[]);},'get':function(){return this[_0xd9ff('0x7')](_0xd9ff('0x6'))?this[_0xd9ff('0x7')](_0xd9ff('0x6'))[_0xd9ff('0x8')](''):[];}}}; \ No newline at end of file +var _0xd4f4=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xee1324,_0x591816){_0xee1324=_0xee1324-0x0;var _0x13f597=_0xd4f4[_0xee1324];return _0x13f597;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d4f('0x2')],'set':function(_0x25087a){this[_0x4d4f('0x5')](_0x4d4f('0x6'),_0x25087a?_0x25087a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x4d4f('0x7')](_0x4d4f('0x6'))[_0x4d4f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 991adc4..7aa3b9e 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 _0x4a0a=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','update','then','destroy','error','name','send','UserProfileSection','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find'];(function(_0x3f760b,_0x7a0af7){var _0x5afcd2=function(_0x4dee59){while(--_0x4dee59){_0x3f760b['push'](_0x3f760b['shift']());}};_0x5afcd2(++_0x7a0af7);}(_0x4a0a,0x11f));var _0xa4a0=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x4a0a[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0xa4a0('0x0'));var rimraf=require(_0xa4a0('0x1'));var zipdir=require(_0xa4a0('0x2'));var jsonpatch=require(_0xa4a0('0x3'));var rp=require('request-promise');var moment=require(_0xa4a0('0x4'));var BPromise=require(_0xa4a0('0x5'));var Mustache=require(_0xa4a0('0x6'));var util=require(_0xa4a0('0x7'));var path=require('path');var sox=require(_0xa4a0('0x8'));var csv=require('to-csv');var ejs=require(_0xa4a0('0x9'));var fs=require('fs');var fs_extra=require(_0xa4a0('0xa'));var _=require(_0xa4a0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa4a0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa4a0('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa4a0('0xe'));var authService=require(_0xa4a0('0xf'));var qs=require(_0xa4a0('0x10'));var as=require(_0xa4a0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa4a0('0x12'));var utils=require('../../config/utils');var config=require(_0xa4a0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4a0('0x14'))['db'];function respondWithStatusCode(_0x29c646,_0x5d3759){_0x5d3759=_0x5d3759||0xcc;return function(_0x33ac0d){if(_0x33ac0d){return _0x29c646[_0xa4a0('0x15')](_0x5d3759);}return _0x29c646[_0xa4a0('0x16')](_0x5d3759)[_0xa4a0('0x17')]();};}function respondWithResult(_0x483d55,_0x4bf9e5){_0x4bf9e5=_0x4bf9e5||0xc8;return function(_0x511e9a){if(_0x511e9a){return _0x483d55['status'](_0x4bf9e5)[_0xa4a0('0x18')](_0x511e9a);}};}function respondWithFilteredResult(_0x34705d,_0x1213d7){return function(_0x4a8a42){if(_0x4a8a42){var _0x4d62d5=typeof _0x1213d7[_0xa4a0('0x19')]===_0xa4a0('0x1a')&&typeof _0x1213d7['limit']===_0xa4a0('0x1a');var _0x531b50=_0x4a8a42['count'];var _0x2de01b=_0x4d62d5?0x0:_0x1213d7[_0xa4a0('0x19')];var _0x4de65a=_0x4d62d5?_0x4a8a42['count']:_0x1213d7['offset']+_0x1213d7[_0xa4a0('0x1b')];var _0x2f0ad5;if(_0x4de65a>=_0x531b50){_0x4de65a=_0x531b50;_0x2f0ad5=0xc8;}else{_0x2f0ad5=0xce;}_0x34705d['status'](_0x2f0ad5);return _0x34705d[_0xa4a0('0x1c')]('Content-Range',_0x2de01b+'-'+_0x4de65a+'/'+_0x531b50)[_0xa4a0('0x18')](_0x4a8a42);}return null;};}function patchUpdates(_0x39e2c6){return function(_0x48ee73){try{jsonpatch[_0xa4a0('0x1d')](_0x48ee73,_0x39e2c6,!![]);}catch(_0x2ce4c3){return BPromise['reject'](_0x2ce4c3);}return _0x48ee73['save']();};}function saveUpdates(_0x58bb29,_0x1ce327){return function(_0x5c0eb){if(_0x5c0eb){return _0x5c0eb[_0xa4a0('0x1e')](_0x58bb29)[_0xa4a0('0x1f')](function(_0x4c6e4f){return _0x4c6e4f;});}return null;};}function removeEntity(_0x5294f9,_0x446ec7){return function(_0x11b737){if(_0x11b737){return _0x11b737[_0xa4a0('0x20')]()[_0xa4a0('0x1f')](function(){_0x5294f9[_0xa4a0('0x16')](0xcc)[_0xa4a0('0x17')]();});}};}function handleEntityNotFound(_0xe8f8b,_0x509192){return function(_0xdbbd63){if(!_0xdbbd63){_0xe8f8b[_0xa4a0('0x15')](0x194);}return _0xdbbd63;};}function handleError(_0x28181c,_0x73e44b){_0x73e44b=_0x73e44b||0x1f4;return function(_0x44a180){logger[_0xa4a0('0x21')](_0x44a180['stack']);if(_0x44a180[_0xa4a0('0x22')]){delete _0x44a180['name'];}_0x28181c['status'](_0x73e44b)[_0xa4a0('0x23')](_0x44a180);};}exports['index']=function(_0x41e27e,_0x38fd17){var _0x13f35f={},_0x2fcc6e={},_0x43b68b={'count':0x0,'rows':[]};var _0x3386e1=_['map'](db[_0xa4a0('0x24')]['rawAttributes'],function(_0x5ece45){return{'name':_0x5ece45[_0xa4a0('0x25')],'type':_0x5ece45[_0xa4a0('0x26')][_0xa4a0('0x27')]};});_0x2fcc6e[_0xa4a0('0x28')]=_[_0xa4a0('0x29')](_0x3386e1,_0xa4a0('0x22'));_0x2fcc6e[_0xa4a0('0x2a')]=_[_0xa4a0('0x2b')](_0x41e27e[_0xa4a0('0x2a')]);_0x2fcc6e['filters']=_['intersection'](_0x2fcc6e[_0xa4a0('0x28')],_0x2fcc6e[_0xa4a0('0x2a')]);_0x13f35f[_0xa4a0('0x2c')]=_['intersection'](_0x2fcc6e[_0xa4a0('0x28')],qs[_0xa4a0('0x2d')](_0x41e27e[_0xa4a0('0x2a')]['fields']));_0x13f35f['attributes']=_0x13f35f[_0xa4a0('0x2c')][_0xa4a0('0x2e')]?_0x13f35f[_0xa4a0('0x2c')]:_0x2fcc6e[_0xa4a0('0x28')];if(!_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x2f')]('nolimit')){_0x13f35f[_0xa4a0('0x1b')]=qs[_0xa4a0('0x1b')](_0x41e27e['query'][_0xa4a0('0x1b')]);_0x13f35f[_0xa4a0('0x19')]=qs['offset'](_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x19')]);}_0x13f35f[_0xa4a0('0x30')]=qs[_0xa4a0('0x31')](_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x31')]);_0x13f35f['where']=qs[_0xa4a0('0x32')](_[_0xa4a0('0x33')](_0x41e27e[_0xa4a0('0x2a')],_0x2fcc6e[_0xa4a0('0x32')]),_0x3386e1);if(_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x34')]){_0x13f35f[_0xa4a0('0x35')]=_[_0xa4a0('0x36')](_0x13f35f[_0xa4a0('0x35')],{'$or':_[_0xa4a0('0x29')](_0x3386e1,function(_0x34a4a5){if(_0x34a4a5['type']!==_0xa4a0('0x37')){var _0x2ac634={};_0x2ac634[_0x34a4a5[_0xa4a0('0x22')]]={'$like':'%'+_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x34')]+'%'};return _0x2ac634;}})});}_0x13f35f=_[_0xa4a0('0x36')]({},_0x13f35f,_0x41e27e[_0xa4a0('0x38')]);var _0x125136={'where':_0x13f35f[_0xa4a0('0x35')]};return db[_0xa4a0('0x24')][_0xa4a0('0x39')](_0x125136)[_0xa4a0('0x1f')](function(_0x5c8818){_0x43b68b['count']=_0x5c8818;if(_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x3a')]){_0x13f35f['include']=[{'all':!![]}];}return db[_0xa4a0('0x24')][_0xa4a0('0x3b')](_0x13f35f);})[_0xa4a0('0x1f')](function(_0x12e2cc){_0x43b68b[_0xa4a0('0x3c')]=_0x12e2cc;return _0x43b68b;})[_0xa4a0('0x1f')](respondWithFilteredResult(_0x38fd17,_0x13f35f))[_0xa4a0('0x3d')](handleError(_0x38fd17,null));};exports[_0xa4a0('0x3e')]=function(_0x53eca0,_0x2215c2){var _0x1047f8={'raw':![],'where':{'id':_0x53eca0[_0xa4a0('0x3f')]['id']}},_0x2b686e={};_0x2b686e['model']=_['keys'](db['UserProfileSection'][_0xa4a0('0x40')]);_0x2b686e[_0xa4a0('0x2a')]=_[_0xa4a0('0x2b')](_0x53eca0['query']);_0x2b686e[_0xa4a0('0x32')]=_[_0xa4a0('0x41')](_0x2b686e[_0xa4a0('0x28')],_0x2b686e[_0xa4a0('0x2a')]);_0x1047f8[_0xa4a0('0x2c')]=_[_0xa4a0('0x41')](_0x2b686e['model'],qs[_0xa4a0('0x2d')](_0x53eca0[_0xa4a0('0x2a')][_0xa4a0('0x2d')]));_0x1047f8['attributes']=_0x1047f8[_0xa4a0('0x2c')][_0xa4a0('0x2e')]?_0x1047f8[_0xa4a0('0x2c')]:_0x2b686e[_0xa4a0('0x28')];if(_0x53eca0['query']['includeAll']){_0x1047f8[_0xa4a0('0x42')]=[{'all':!![]}];}_0x1047f8=_[_0xa4a0('0x36')]({},_0x1047f8,_0x53eca0[_0xa4a0('0x38')]);return db[_0xa4a0('0x24')][_0xa4a0('0x43')](_0x1047f8)[_0xa4a0('0x1f')](handleEntityNotFound(_0x2215c2,null))[_0xa4a0('0x1f')](respondWithResult(_0x2215c2,null))[_0xa4a0('0x3d')](handleError(_0x2215c2,null));};exports[_0xa4a0('0x44')]=function(_0x4a2031,_0x3263a4){return db[_0xa4a0('0x24')][_0xa4a0('0x44')](_0x4a2031['body'],{})['then'](respondWithResult(_0x3263a4,0xc9))[_0xa4a0('0x3d')](handleError(_0x3263a4,null));};exports[_0xa4a0('0x1e')]=function(_0x118ab0,_0x44a9b7){if(_0x118ab0[_0xa4a0('0x45')]['id']){delete _0x118ab0[_0xa4a0('0x45')]['id'];}return db[_0xa4a0('0x24')][_0xa4a0('0x43')]({'where':{'id':_0x118ab0[_0xa4a0('0x3f')]['id']}})[_0xa4a0('0x1f')](handleEntityNotFound(_0x44a9b7,null))[_0xa4a0('0x1f')](saveUpdates(_0x118ab0[_0xa4a0('0x45')],null))[_0xa4a0('0x1f')](respondWithResult(_0x44a9b7,null))[_0xa4a0('0x3d')](handleError(_0x44a9b7,null));};exports[_0xa4a0('0x20')]=function(_0xa2d85b,_0x53be9d){return db['UserProfileSection'][_0xa4a0('0x43')]({'where':{'id':_0xa2d85b[_0xa4a0('0x3f')]['id']}})[_0xa4a0('0x1f')](handleEntityNotFound(_0x53be9d,null))[_0xa4a0('0x1f')](removeEntity(_0x53be9d,null))[_0xa4a0('0x3d')](handleError(_0x53be9d,null));};exports[_0xa4a0('0x46')]=function(_0x5b5647,_0x21050b){return db[_0xa4a0('0x24')]['describe']()[_0xa4a0('0x1f')](respondWithResult(_0x21050b,null))[_0xa4a0('0x3d')](handleError(_0x21050b,null));}; \ No newline at end of file +var _0xf36a=['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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','UserProfileSection','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xf36a,0xe5));var _0xaf36=function(_0x4379a5,_0xb149c3){_0x4379a5=_0x4379a5-0x0;var _0x14e57e=_0xf36a[_0x4379a5];return _0x14e57e;};'use strict';var emlformat=require(_0xaf36('0x0'));var rimraf=require(_0xaf36('0x1'));var zipdir=require(_0xaf36('0x2'));var jsonpatch=require(_0xaf36('0x3'));var rp=require('request-promise');var moment=require(_0xaf36('0x4'));var BPromise=require(_0xaf36('0x5'));var Mustache=require(_0xaf36('0x6'));var util=require(_0xaf36('0x7'));var path=require(_0xaf36('0x8'));var sox=require(_0xaf36('0x9'));var csv=require('to-csv');var ejs=require(_0xaf36('0xa'));var fs=require('fs');var fs_extra=require(_0xaf36('0xb'));var _=require(_0xaf36('0xc'));var squel=require(_0xaf36('0xd'));var crypto=require(_0xaf36('0xe'));var jsforce=require(_0xaf36('0xf'));var deskjs=require(_0xaf36('0x10'));var toCsv=require(_0xaf36('0x11'));var querystring=require(_0xaf36('0x12'));var Papa=require(_0xaf36('0x13'));var Redis=require(_0xaf36('0x14'));var authService=require(_0xaf36('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xaf36('0x16'));var hardwareService=require(_0xaf36('0x17'));var logger=require('../../config/logger')(_0xaf36('0x18'));var utils=require('../../config/utils');var config=require(_0xaf36('0x19'));var licenseUtil=require(_0xaf36('0x1a'));var db=require(_0xaf36('0x1b'))['db'];function respondWithStatusCode(_0x1ff94a,_0x43bcb3){_0x43bcb3=_0x43bcb3||0xcc;return function(_0x59b6ca){if(_0x59b6ca){return _0x1ff94a[_0xaf36('0x1c')](_0x43bcb3);}return _0x1ff94a[_0xaf36('0x1d')](_0x43bcb3)['end']();};}function respondWithResult(_0x5af241,_0x334c72){_0x334c72=_0x334c72||0xc8;return function(_0x113f60){if(_0x113f60){return _0x5af241['status'](_0x334c72)['json'](_0x113f60);}};}function respondWithFilteredResult(_0x3e61d4,_0x8e8c97){return function(_0x1d3b00){if(_0x1d3b00){var _0x5ccff0=typeof _0x8e8c97[_0xaf36('0x1e')]==='undefined'&&typeof _0x8e8c97['limit']===_0xaf36('0x1f');var _0x5f4ea3=_0x1d3b00[_0xaf36('0x20')];var _0xfa85bf=_0x5ccff0?0x0:_0x8e8c97[_0xaf36('0x1e')];var _0x157245=_0x5ccff0?_0x1d3b00[_0xaf36('0x20')]:_0x8e8c97[_0xaf36('0x1e')]+_0x8e8c97['limit'];var _0x5d48db;if(_0x157245>=_0x5f4ea3){_0x157245=_0x5f4ea3;_0x5d48db=0xc8;}else{_0x5d48db=0xce;}_0x3e61d4[_0xaf36('0x1d')](_0x5d48db);return _0x3e61d4[_0xaf36('0x21')](_0xaf36('0x22'),_0xfa85bf+'-'+_0x157245+'/'+_0x5f4ea3)[_0xaf36('0x23')](_0x1d3b00);}return null;};}function patchUpdates(_0x34611d){return function(_0xdc0b0b){try{jsonpatch[_0xaf36('0x24')](_0xdc0b0b,_0x34611d,!![]);}catch(_0x58c549){return BPromise[_0xaf36('0x25')](_0x58c549);}return _0xdc0b0b[_0xaf36('0x26')]();};}function saveUpdates(_0x3cc38d,_0x4c2ca6){return function(_0x4f9179){if(_0x4f9179){return _0x4f9179[_0xaf36('0x27')](_0x3cc38d)[_0xaf36('0x28')](function(_0x4e2e0f){return _0x4e2e0f;});}return null;};}function removeEntity(_0x578935,_0x20cdca){return function(_0x5b88ff){if(_0x5b88ff){return _0x5b88ff[_0xaf36('0x29')]()['then'](function(){_0x578935[_0xaf36('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4385d3,_0x5d7413){return function(_0x291787){if(!_0x291787){_0x4385d3[_0xaf36('0x1c')](0x194);}return _0x291787;};}function handleError(_0x13baca,_0x4872a1){_0x4872a1=_0x4872a1||0x1f4;return function(_0x5dc7d4){logger['error'](_0x5dc7d4['stack']);if(_0x5dc7d4[_0xaf36('0x2a')]){delete _0x5dc7d4[_0xaf36('0x2a')];}_0x13baca[_0xaf36('0x1d')](_0x4872a1)[_0xaf36('0x2b')](_0x5dc7d4);};}exports[_0xaf36('0x2c')]=function(_0x27fcbb,_0x2a3835){var _0x214562={},_0x43c74c={},_0x35a7bc={'count':0x0,'rows':[]};var _0x380546=_[_0xaf36('0x2d')](db[_0xaf36('0x2e')]['rawAttributes'],function(_0xb11bc9){return{'name':_0xb11bc9[_0xaf36('0x2f')],'type':_0xb11bc9[_0xaf36('0x30')][_0xaf36('0x31')]};});_0x43c74c[_0xaf36('0x32')]=_['map'](_0x380546,_0xaf36('0x2a'));_0x43c74c['query']=_['keys'](_0x27fcbb[_0xaf36('0x33')]);_0x43c74c[_0xaf36('0x34')]=_[_0xaf36('0x35')](_0x43c74c[_0xaf36('0x32')],_0x43c74c['query']);_0x214562['attributes']=_['intersection'](_0x43c74c[_0xaf36('0x32')],qs['fields'](_0x27fcbb[_0xaf36('0x33')][_0xaf36('0x36')]));_0x214562[_0xaf36('0x37')]=_0x214562[_0xaf36('0x37')]['length']?_0x214562[_0xaf36('0x37')]:_0x43c74c[_0xaf36('0x32')];if(!_0x27fcbb[_0xaf36('0x33')][_0xaf36('0x38')](_0xaf36('0x39'))){_0x214562[_0xaf36('0x3a')]=qs[_0xaf36('0x3a')](_0x27fcbb['query']['limit']);_0x214562[_0xaf36('0x1e')]=qs[_0xaf36('0x1e')](_0x27fcbb[_0xaf36('0x33')][_0xaf36('0x1e')]);}_0x214562[_0xaf36('0x3b')]=qs[_0xaf36('0x3c')](_0x27fcbb[_0xaf36('0x33')][_0xaf36('0x3c')]);_0x214562[_0xaf36('0x3d')]=qs[_0xaf36('0x34')](_['pick'](_0x27fcbb[_0xaf36('0x33')],_0x43c74c[_0xaf36('0x34')]),_0x380546);if(_0x27fcbb[_0xaf36('0x33')][_0xaf36('0x3e')]){_0x214562[_0xaf36('0x3d')]=_[_0xaf36('0x3f')](_0x214562[_0xaf36('0x3d')],{'$or':_[_0xaf36('0x2d')](_0x380546,function(_0x5123e5){if(_0x5123e5[_0xaf36('0x30')]!=='VIRTUAL'){var _0x1db7d2={};_0x1db7d2[_0x5123e5['name']]={'$like':'%'+_0x27fcbb[_0xaf36('0x33')][_0xaf36('0x3e')]+'%'};return _0x1db7d2;}})});}_0x214562=_['merge']({},_0x214562,_0x27fcbb[_0xaf36('0x40')]);var _0x29afe6={'where':_0x214562[_0xaf36('0x3d')]};return db['UserProfileSection'][_0xaf36('0x20')](_0x29afe6)[_0xaf36('0x28')](function(_0x2f620b){_0x35a7bc['count']=_0x2f620b;if(_0x27fcbb[_0xaf36('0x33')][_0xaf36('0x41')]){_0x214562[_0xaf36('0x42')]=[{'all':!![]}];}return db[_0xaf36('0x2e')][_0xaf36('0x43')](_0x214562);})['then'](function(_0x503730){_0x35a7bc[_0xaf36('0x44')]=_0x503730;return _0x35a7bc;})['then'](respondWithFilteredResult(_0x2a3835,_0x214562))[_0xaf36('0x45')](handleError(_0x2a3835,null));};exports[_0xaf36('0x46')]=function(_0xa8fa06,_0x57ac04){var _0x12a654={'raw':![],'where':{'id':_0xa8fa06[_0xaf36('0x47')]['id']}},_0x433e69={};_0x433e69[_0xaf36('0x32')]=_[_0xaf36('0x48')](db[_0xaf36('0x2e')][_0xaf36('0x49')]);_0x433e69[_0xaf36('0x33')]=_[_0xaf36('0x48')](_0xa8fa06[_0xaf36('0x33')]);_0x433e69[_0xaf36('0x34')]=_[_0xaf36('0x35')](_0x433e69[_0xaf36('0x32')],_0x433e69['query']);_0x12a654['attributes']=_[_0xaf36('0x35')](_0x433e69['model'],qs[_0xaf36('0x36')](_0xa8fa06['query'][_0xaf36('0x36')]));_0x12a654['attributes']=_0x12a654['attributes'][_0xaf36('0x4a')]?_0x12a654['attributes']:_0x433e69[_0xaf36('0x32')];if(_0xa8fa06[_0xaf36('0x33')][_0xaf36('0x41')]){_0x12a654[_0xaf36('0x42')]=[{'all':!![]}];}_0x12a654=_[_0xaf36('0x3f')]({},_0x12a654,_0xa8fa06['options']);return db[_0xaf36('0x2e')][_0xaf36('0x4b')](_0x12a654)[_0xaf36('0x28')](handleEntityNotFound(_0x57ac04,null))['then'](respondWithResult(_0x57ac04,null))[_0xaf36('0x45')](handleError(_0x57ac04,null));};exports[_0xaf36('0x4c')]=function(_0x3aeb2e,_0x3ffcee){return db['UserProfileSection'][_0xaf36('0x4c')](_0x3aeb2e[_0xaf36('0x4d')],{})[_0xaf36('0x28')](respondWithResult(_0x3ffcee,0xc9))[_0xaf36('0x45')](handleError(_0x3ffcee,null));};exports[_0xaf36('0x27')]=function(_0xa876ef,_0x540988){if(_0xa876ef['body']['id']){delete _0xa876ef[_0xaf36('0x4d')]['id'];}return db[_0xaf36('0x2e')][_0xaf36('0x4b')]({'where':{'id':_0xa876ef[_0xaf36('0x47')]['id']}})[_0xaf36('0x28')](handleEntityNotFound(_0x540988,null))[_0xaf36('0x28')](saveUpdates(_0xa876ef[_0xaf36('0x4d')],null))[_0xaf36('0x28')](respondWithResult(_0x540988,null))[_0xaf36('0x45')](handleError(_0x540988,null));};exports['destroy']=function(_0x21ccd4,_0x5c7db6){return db['UserProfileSection'][_0xaf36('0x4b')]({'where':{'id':_0x21ccd4[_0xaf36('0x47')]['id']}})[_0xaf36('0x28')](handleEntityNotFound(_0x5c7db6,null))[_0xaf36('0x28')](removeEntity(_0x5c7db6,null))[_0xaf36('0x45')](handleError(_0x5c7db6,null));};exports[_0xaf36('0x4e')]=function(_0x5eba55,_0x4c53da){return db[_0xaf36('0x2e')][_0xaf36('0x4e')]()['then'](respondWithResult(_0x4c53da,null))[_0xaf36('0x45')](handleError(_0x4c53da,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index fd137ca..5accb69 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 _0xbf23=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','lodash','util'];(function(_0x309a2f,_0x2b48a7){var _0x2a2698=function(_0x4b32e7){while(--_0x4b32e7){_0x309a2f['push'](_0x309a2f['shift']());}};_0x2a2698(++_0x2b48a7);}(_0xbf23,0x76));var _0x3bf2=function(_0x57c9c7,_0xb70a91){_0x57c9c7=_0x57c9c7-0x0;var _0x48ad8b=_0xbf23[_0x57c9c7];return _0x48ad8b;};'use strict';var _=require(_0x3bf2('0x0'));var util=require(_0x3bf2('0x1'));var logger=require(_0x3bf2('0x2'))('api');var moment=require(_0x3bf2('0x3'));var BPromise=require(_0x3bf2('0x4'));var rp=require(_0x3bf2('0x5'));var fs=require('fs');var path=require(_0x3bf2('0x6'));var rimraf=require('rimraf');var config=require(_0x3bf2('0x7'));var attributes=require(_0x3bf2('0x8'));module[_0x3bf2('0x9')]=function(_0x504b31,_0x598791){return _0x504b31['define'](_0x3bf2('0xa'),attributes,{'tableName':_0x3bf2('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7f6=['moment','request-promise','../../config/environment','exports','define','UserProfileSection','compositeIndex','sectionId','util','../../config/logger','api'];(function(_0x44c696,_0x5c9b22){var _0x224306=function(_0x17a088){while(--_0x17a088){_0x44c696['push'](_0x44c696['shift']());}};_0x224306(++_0x5c9b22);}(_0xd7f6,0xc3));var _0x6d7f=function(_0x45a96d,_0x5434b6){_0x45a96d=_0x45a96d-0x0;var _0x34460a=_0xd7f6[_0x45a96d];return _0x34460a;};'use strict';var _=require('lodash');var util=require(_0x6d7f('0x0'));var logger=require(_0x6d7f('0x1'))(_0x6d7f('0x2'));var moment=require(_0x6d7f('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6d7f('0x5'));var attributes=require('./userProfileSection.attributes');module[_0x6d7f('0x6')]=function(_0x227230,_0xc3788a){return _0x227230[_0x6d7f('0x7')](_0x6d7f('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x6d7f('0x9'),'fields':[_0x6d7f('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 80cdc8c..b0eae75 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 _0x64f5=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x581c1e,_0x210a09){var _0x341309=function(_0x136778){while(--_0x136778){_0x581c1e['push'](_0x581c1e['shift']());}};_0x341309(++_0x210a09);}(_0x64f5,0x6e));var _0x564f=function(_0x83a4d7,_0x5e1143){_0x83a4d7=_0x83a4d7-0x0;var _0x400408=_0x64f5[_0x83a4d7];return _0x400408;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var moment=require(_0x564f('0x1'));var BPromise=require(_0x564f('0x2'));var rs=require(_0x564f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x564f('0x4'))['db'];var utils=require(_0x564f('0x5'));var logger=require('../../config/logger')(_0x564f('0x6'));var config=require(_0x564f('0x7'));var jayson=require(_0x564f('0x8'));var client=jayson[_0x564f('0x9')][_0x564f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53b631,_0x2839a5,_0x52283a){return new BPromise(function(_0x1b4697,_0x2e3168){return client['request'](_0x53b631,_0x52283a)[_0x564f('0xb')](function(_0x1392a8){logger[_0x564f('0xc')](_0x564f('0xd'),_0x2839a5,_0x564f('0xe'));logger[_0x564f('0xf')](_0x564f('0x10'),_0x2839a5,'request\x20sent',JSON[_0x564f('0x11')](_0x1392a8));if(_0x1392a8[_0x564f('0x12')]){if(_0x1392a8[_0x564f('0x12')][_0x564f('0x13')]===0x1f4){logger[_0x564f('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x2839a5,_0x1392a8[_0x564f('0x12')]['message']);return _0x2e3168(_0x1392a8[_0x564f('0x12')][_0x564f('0x14')]);}logger[_0x564f('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x2839a5,_0x1392a8[_0x564f('0x12')]['message']);return _0x1b4697(_0x1392a8[_0x564f('0x12')][_0x564f('0x14')]);}else{logger[_0x564f('0xc')](_0x564f('0xd'),_0x2839a5,'request\x20sent');_0x1b4697(_0x1392a8[_0x564f('0x15')][_0x564f('0x14')]);}})[_0x564f('0x16')](function(_0x3138a3){logger[_0x564f('0x12')](_0x564f('0xd'),_0x2839a5,_0x3138a3);_0x2e3168(_0x3138a3);});});} \ No newline at end of file +var _0x9ebf=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0x9ebf,0x18f));var _0xf9eb=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9ebf[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xf9eb('0x0'));var util=require(_0xf9eb('0x1'));var moment=require(_0xf9eb('0x2'));var BPromise=require(_0xf9eb('0x3'));var rs=require(_0xf9eb('0x4'));var fs=require('fs');var Redis=require(_0xf9eb('0x5'));var db=require(_0xf9eb('0x6'))['db'];var utils=require(_0xf9eb('0x7'));var logger=require('../../config/logger')(_0xf9eb('0x8'));var config=require(_0xf9eb('0x9'));var jayson=require(_0xf9eb('0xa'));var client=jayson[_0xf9eb('0xb')][_0xf9eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2aa143,_0x2e99e9,_0x5473a9){return new BPromise(function(_0x4c98b1,_0x35470e){return client[_0xf9eb('0xd')](_0x2aa143,_0x5473a9)[_0xf9eb('0xe')](function(_0x2772be){logger['info'](_0xf9eb('0xf'),_0x2e99e9,_0xf9eb('0x10'));logger[_0xf9eb('0x11')](_0xf9eb('0x12'),_0x2e99e9,_0xf9eb('0x10'),JSON['stringify'](_0x2772be));if(_0x2772be[_0xf9eb('0x13')]){if(_0x2772be[_0xf9eb('0x13')][_0xf9eb('0x14')]===0x1f4){logger[_0xf9eb('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x2e99e9,_0x2772be[_0xf9eb('0x13')][_0xf9eb('0x15')]);return _0x35470e(_0x2772be[_0xf9eb('0x13')][_0xf9eb('0x15')]);}logger['error'](_0xf9eb('0xf'),_0x2e99e9,_0x2772be[_0xf9eb('0x13')]['message']);return _0x4c98b1(_0x2772be[_0xf9eb('0x13')][_0xf9eb('0x15')]);}else{logger[_0xf9eb('0x16')]('UserProfileSection,\x20%s,\x20%s',_0x2e99e9,_0xf9eb('0x10'));_0x4c98b1(_0x2772be[_0xf9eb('0x17')][_0xf9eb('0x15')]);}})[_0xf9eb('0x18')](function(_0xc59310){logger[_0xf9eb('0x13')](_0xf9eb('0xf'),_0x2e99e9,_0xc59310);_0x35470e(_0xc59310);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 88a6599..a477c75 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3aded5,_0xad452b){var _0x452db5=function(_0x54a585){while(--_0x54a585){_0x3aded5['push'](_0x3aded5['shift']());}};_0x452db5(++_0xad452b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x313ecd,_0x354d86){var _0x43d806=function(_0x19ac9a){while(--_0x19ac9a){_0x313ecd['push'](_0x313ecd['shift']());}};_0x43d806(++_0x354d86);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 5665a05..4fa813f 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 _0x8769=['sequelize','exports','INTEGER'];(function(_0x1d1716,_0x240282){var _0x247486=function(_0x309fdb){while(--_0x309fdb){_0x1d1716['push'](_0x1d1716['shift']());}};_0x247486(++_0x240282);}(_0x8769,0x189));var _0x9876=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x8769[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x9876('0x0'));module[_0x9876('0x1')]={'penalty':{'type':Sequelize[_0x9876('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46ae=['sequelize','exports'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0x46ae,0x1ae));var _0xe46a=function(_0x23cbb1,_0x170772){_0x23cbb1=_0x23cbb1-0x0;var _0x2e42d9=_0x46ae[_0x23cbb1];return _0x2e42d9;};'use strict';var Sequelize=require(_0xe46a('0x0'));module[_0xe46a('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 21741fc..3dc81e3 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 _0x9536=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x3b0250,_0xd6df8f){var _0x3fbc7f=function(_0x389cdb){while(--_0x389cdb){_0x3b0250['push'](_0x3b0250['shift']());}};_0x3fbc7f(++_0xd6df8f);}(_0x9536,0x179));var _0x6953=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x9536[_0x79b649];return _0x1af9b1;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7046=['path','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x46572b,_0x2bc9f2){var _0x2b9b80=function(_0x4ba30d){while(--_0x4ba30d){_0x46572b['push'](_0x46572b['shift']());}};_0x2b9b80(++_0x2bc9f2);}(_0x7046,0x144));var _0x6704=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7046[_0x4b055c];return _0x4b62bb;};'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':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 3f9e11d..838e55f 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 _0xebf8=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','code'];(function(_0x54886d,_0x37fbd7){var _0x270ce=function(_0x4bf370){while(--_0x4bf370){_0x54886d['push'](_0x54886d['shift']());}};_0x270ce(++_0x37fbd7);}(_0xebf8,0x12a));var _0x8ebf=function(_0x3ff710,_0x33b9cf){_0x3ff710=_0x3ff710-0x0;var _0x32d4c1=_0xebf8[_0x3ff710];return _0x32d4c1;};'use strict';var _=require(_0x8ebf('0x0'));var util=require(_0x8ebf('0x1'));var moment=require(_0x8ebf('0x2'));var BPromise=require(_0x8ebf('0x3'));var rs=require(_0x8ebf('0x4'));var fs=require('fs');var Redis=require(_0x8ebf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ebf('0x6'));var logger=require(_0x8ebf('0x7'))(_0x8ebf('0x8'));var config=require('../../config/environment');var jayson=require(_0x8ebf('0x9'));var client=jayson['client'][_0x8ebf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21c73b,_0x5963cd,_0x5af962){return new BPromise(function(_0x1896f1,_0xff16c9){return client['request'](_0x21c73b,_0x5af962)['then'](function(_0x593471){logger[_0x8ebf('0xb')](_0x8ebf('0xc'),_0x5963cd,_0x8ebf('0xd'));logger[_0x8ebf('0xe')](_0x8ebf('0xf'),_0x5963cd,_0x8ebf('0xd'),JSON['stringify'](_0x593471));if(_0x593471['error']){if(_0x593471['error'][_0x8ebf('0x10')]===0x1f4){logger['error'](_0x8ebf('0xc'),_0x5963cd,_0x593471[_0x8ebf('0x11')][_0x8ebf('0x12')]);return _0xff16c9(_0x593471['error']['message']);}logger[_0x8ebf('0x11')](_0x8ebf('0xc'),_0x5963cd,_0x593471[_0x8ebf('0x11')][_0x8ebf('0x12')]);return _0x1896f1(_0x593471['error'][_0x8ebf('0x12')]);}else{logger[_0x8ebf('0xb')](_0x8ebf('0xc'),_0x5963cd,_0x8ebf('0xd'));_0x1896f1(_0x593471[_0x8ebf('0x13')][_0x8ebf('0x12')]);}})[_0x8ebf('0x14')](function(_0x44ebc6){logger[_0x8ebf('0x11')](_0x8ebf('0xc'),_0x5963cd,_0x44ebc6);_0xff16c9(_0x44ebc6);});});} \ No newline at end of file +var _0x8d9d=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0x8d9d,0x137));var _0xd8d9=function(_0x26a19d,_0x41ff8b){_0x26a19d=_0x26a19d-0x0;var _0x3f2f2b=_0x8d9d[_0x26a19d];return _0x3f2f2b;};'use strict';var _=require(_0xd8d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd8d9('0x1'));var rs=require(_0xd8d9('0x2'));var fs=require('fs');var Redis=require(_0xd8d9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8d9('0x4'));var logger=require('../../config/logger')(_0xd8d9('0x5'));var config=require(_0xd8d9('0x6'));var jayson=require(_0xd8d9('0x7'));var client=jayson[_0xd8d9('0x8')][_0xd8d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e4864,_0x4600aa,_0x17f4c1){return new BPromise(function(_0x19986f,_0x2e3db9){return client[_0xd8d9('0xa')](_0x1e4864,_0x17f4c1)[_0xd8d9('0xb')](function(_0x3ac426){logger[_0xd8d9('0xc')](_0xd8d9('0xd'),_0x4600aa,_0xd8d9('0xe'));logger[_0xd8d9('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4600aa,'request\x20sent',JSON[_0xd8d9('0x10')](_0x3ac426));if(_0x3ac426[_0xd8d9('0x11')]){if(_0x3ac426[_0xd8d9('0x11')][_0xd8d9('0x12')]===0x1f4){logger[_0xd8d9('0x11')](_0xd8d9('0xd'),_0x4600aa,_0x3ac426['error'][_0xd8d9('0x13')]);return _0x2e3db9(_0x3ac426[_0xd8d9('0x11')][_0xd8d9('0x13')]);}logger[_0xd8d9('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x4600aa,_0x3ac426[_0xd8d9('0x11')][_0xd8d9('0x13')]);return _0x19986f(_0x3ac426[_0xd8d9('0x11')][_0xd8d9('0x13')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x4600aa,_0xd8d9('0xe'));_0x19986f(_0x3ac426['result']['message']);}})[_0xd8d9('0x14')](function(_0x494211){logger[_0xd8d9('0x11')](_0xd8d9('0xd'),_0x4600aa,_0x494211);_0x2e3db9(_0x494211);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 5990906..496a03d 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 _0x85a8=['INTEGER'];(function(_0x44d39d,_0x354b01){var _0x13729b=function(_0x2fd48f){while(--_0x2fd48f){_0x44d39d['push'](_0x44d39d['shift']());}};_0x13729b(++_0x354b01);}(_0x85a8,0x189));var _0x885a=function(_0x43a50b,_0xbb1e56){_0x43a50b=_0x43a50b-0x0;var _0x36b2bc=_0x85a8[_0x43a50b];return _0x36b2bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0x885a('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x885a('0x0')]}}; \ No newline at end of file +var _0xe8ab=['exports','INTEGER','sequelize'];(function(_0x43b833,_0x345a9e){var _0x5085d0=function(_0x3211b8){while(--_0x3211b8){_0x43b833['push'](_0x43b833['shift']());}};_0x5085d0(++_0x345a9e);}(_0xe8ab,0x110));var _0xbe8a=function(_0x3effb2,_0x548d6d){_0x3effb2=_0x3effb2-0x0;var _0x25fa6b=_0xe8ab[_0x3effb2];return _0x25fa6b;};'use strict';var Sequelize=require(_0xbe8a('0x0'));module[_0xbe8a('0x1')]={'UserId':{'type':Sequelize[_0xbe8a('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xbe8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index ff03699..ddcfc6c 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(_0x29b937,_0x4f26c0){var _0x59cbc8=function(_0x840f5f){while(--_0x840f5f){_0x29b937['push'](_0x29b937['shift']());}};_0x59cbc8(++_0x4f26c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2c71b7,_0xf8a888){var _0x1ef1b2=function(_0x72afea){while(--_0x72afea){_0x2c71b7['push'](_0x2c71b7['shift']());}};_0x1ef1b2(++_0xf8a888);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 3a18508..2de041a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4c57a2,_0x391ff2){var _0x16e869=function(_0x3211c7){while(--_0x3211c7){_0x4c57a2['push'](_0x4c57a2['shift']());}};_0x16e869(++_0x391ff2);}(_0xe706,0xa3));var _0x6e70=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0xe706[_0x30b0d8];return _0x459c09;};'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(_0x592307,_0x2b8719){var _0x244eb8=function(_0x3e7c78){while(--_0x3e7c78){_0x592307['push'](_0x592307['shift']());}};_0x244eb8(++_0x2b8719);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 3ddd4a0..0ff0b52 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 _0xdc03=['exports','INTEGER'];(function(_0x2c06b5,_0x3c6d9b){var _0x3ed622=function(_0x5b78cb){while(--_0x5b78cb){_0x2c06b5['push'](_0x2c06b5['shift']());}};_0x3ed622(++_0x3c6d9b);}(_0xdc03,0x122));var _0x3dc0=function(_0x509bd9,_0x2f012b){_0x509bd9=_0x509bd9-0x0;var _0x705a33=_0xdc03[_0x509bd9];return _0x705a33;};'use strict';var Sequelize=require('sequelize');module[_0x3dc0('0x0')]={'penalty':{'type':Sequelize[_0x3dc0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf71d=['sequelize','INTEGER'];(function(_0x2b9120,_0x4cba82){var _0x459db0=function(_0x5753b5){while(--_0x5753b5){_0x2b9120['push'](_0x2b9120['shift']());}};_0x459db0(++_0x4cba82);}(_0xf71d,0xda));var _0xdf71=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xf71d[_0x1bc0ae];return _0x501104;};'use strict';var Sequelize=require(_0xdf71('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdf71('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 9f1189c..a95d872 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 _0x8526=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','util','../../config/logger','moment'];(function(_0x46f541,_0x5002f1){var _0x5b23be=function(_0x59e45e){while(--_0x59e45e){_0x46f541['push'](_0x46f541['shift']());}};_0x5b23be(++_0x5002f1);}(_0x8526,0x197));var _0x6852=function(_0x370b59,_0x51c818){_0x370b59=_0x370b59-0x0;var _0x2d5c2c=_0x8526[_0x370b59];return _0x2d5c2c;};'use strict';var _=require('lodash');var util=require(_0x6852('0x0'));var logger=require(_0x6852('0x1'))('api');var moment=require(_0x6852('0x2'));var BPromise=require('bluebird');var rp=require(_0x6852('0x3'));var fs=require('fs');var path=require(_0x6852('0x4'));var rimraf=require(_0x6852('0x5'));var config=require(_0x6852('0x6'));var attributes=require(_0x6852('0x7'));module[_0x6852('0x8')]=function(_0xd262be,_0x3684dc){return _0xd262be[_0x6852('0x9')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0177=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x306970,_0x5adf6b){var _0x52b328=function(_0x354c27){while(--_0x354c27){_0x306970['push'](_0x306970['shift']());}};_0x52b328(++_0x5adf6b);}(_0x0177,0x150));var _0x7017=function(_0x4ad4f4,_0x3f074f){_0x4ad4f4=_0x4ad4f4-0x0;var _0x178261=_0x0177[_0x4ad4f4];return _0x178261;};'use strict';var _=require(_0x7017('0x0'));var util=require(_0x7017('0x1'));var logger=require(_0x7017('0x2'))(_0x7017('0x3'));var moment=require('moment');var BPromise=require(_0x7017('0x4'));var rp=require(_0x7017('0x5'));var fs=require('fs');var path=require(_0x7017('0x6'));var rimraf=require(_0x7017('0x7'));var config=require(_0x7017('0x8'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x5ecc65,_0x28fc7f){return _0x5ecc65[_0x7017('0x9')](_0x7017('0xa'),attributes,{'tableName':_0x7017('0xb'),'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 a749e1e..d7eb46b 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 _0x333e=['request','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4c845b,_0x3ebd28){var _0x4a3ce4=function(_0x339366){while(--_0x339366){_0x4c845b['push'](_0x4c845b['shift']());}};_0x4a3ce4(++_0x3ebd28);}(_0x333e,0x170));var _0xe333=function(_0x5dddc1,_0x15ff1f){_0x5dddc1=_0x5dddc1-0x0;var _0x20233e=_0x333e[_0x5dddc1];return _0x20233e;};'use strict';var _=require('lodash');var util=require(_0xe333('0x0'));var moment=require('moment');var BPromise=require(_0xe333('0x1'));var rs=require(_0xe333('0x2'));var fs=require('fs');var Redis=require(_0xe333('0x3'));var db=require(_0xe333('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe333('0x5'));var config=require(_0xe333('0x6'));var jayson=require(_0xe333('0x7'));var client=jayson[_0xe333('0x8')][_0xe333('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x960979,_0x7c072a,_0x24b25a){return new BPromise(function(_0x3e3338,_0x3ca9fa){return client[_0xe333('0xa')](_0x960979,_0x24b25a)['then'](function(_0x44e4b9){logger[_0xe333('0xb')](_0xe333('0xc'),_0x7c072a,'request\x20sent');logger[_0xe333('0xd')](_0xe333('0xe'),_0x7c072a,_0xe333('0xf'),JSON['stringify'](_0x44e4b9));if(_0x44e4b9[_0xe333('0x10')]){if(_0x44e4b9['error'][_0xe333('0x11')]===0x1f4){logger[_0xe333('0x10')](_0xe333('0xc'),_0x7c072a,_0x44e4b9[_0xe333('0x10')][_0xe333('0x12')]);return _0x3ca9fa(_0x44e4b9[_0xe333('0x10')]['message']);}logger[_0xe333('0x10')](_0xe333('0xc'),_0x7c072a,_0x44e4b9['error']['message']);return _0x3e3338(_0x44e4b9[_0xe333('0x10')]['message']);}else{logger[_0xe333('0xb')](_0xe333('0xc'),_0x7c072a,_0xe333('0xf'));_0x3e3338(_0x44e4b9[_0xe333('0x13')][_0xe333('0x12')]);}})[_0xe333('0x14')](function(_0x13dae0){logger[_0xe333('0x10')](_0xe333('0xc'),_0x7c072a,_0x13dae0);_0x3ca9fa(_0x13dae0);});});} \ No newline at end of file +var _0x062e=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x35f852,_0x5c0a47){var _0x7ff655=function(_0x4e90b8){while(--_0x4e90b8){_0x35f852['push'](_0x35f852['shift']());}};_0x7ff655(++_0x5c0a47);}(_0x062e,0x103));var _0xe062=function(_0x989fe,_0x3c9dc3){_0x989fe=_0x989fe-0x0;var _0x1cee1b=_0x062e[_0x989fe];return _0x1cee1b;};'use strict';var _=require(_0xe062('0x0'));var util=require('util');var moment=require(_0xe062('0x1'));var BPromise=require(_0xe062('0x2'));var rs=require(_0xe062('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe062('0x4'))['db'];var utils=require(_0xe062('0x5'));var logger=require('../../config/logger')(_0xe062('0x6'));var config=require(_0xe062('0x7'));var jayson=require(_0xe062('0x8'));var client=jayson[_0xe062('0x9')][_0xe062('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b984b,_0x2ec793,_0x1fa662){return new BPromise(function(_0x41c463,_0x1f30d4){return client[_0xe062('0xb')](_0x1b984b,_0x1fa662)[_0xe062('0xc')](function(_0xb8c4a9){logger[_0xe062('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x2ec793,_0xe062('0xe'));logger[_0xe062('0xf')](_0xe062('0x10'),_0x2ec793,'request\x20sent',JSON[_0xe062('0x11')](_0xb8c4a9));if(_0xb8c4a9[_0xe062('0x12')]){if(_0xb8c4a9[_0xe062('0x12')][_0xe062('0x13')]===0x1f4){logger['error'](_0xe062('0x14'),_0x2ec793,_0xb8c4a9['error'][_0xe062('0x15')]);return _0x1f30d4(_0xb8c4a9[_0xe062('0x12')][_0xe062('0x15')]);}logger[_0xe062('0x12')](_0xe062('0x14'),_0x2ec793,_0xb8c4a9[_0xe062('0x12')][_0xe062('0x15')]);return _0x41c463(_0xb8c4a9[_0xe062('0x12')]['message']);}else{logger[_0xe062('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x2ec793,_0xe062('0xe'));_0x41c463(_0xb8c4a9['result']['message']);}})['catch'](function(_0xdc9944){logger[_0xe062('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x2ec793,_0xdc9944);_0x1f30d4(_0xdc9944);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 1a885fb..c1a5a8d 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x326256,_0x5671bb){var _0x5c9209=function(_0x189f64){while(--_0x189f64){_0x326256['push'](_0x326256['shift']());}};_0x5c9209(++_0x5671bb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x472830,_0x3e8953){var _0x25db64=function(_0x51be39){while(--_0x51be39){_0x472830['push'](_0x472830['shift']());}};_0x25db64(++_0x3e8953);}(_0x70e0,0x17b));var _0x070e=function(_0x1414fa,_0x26d79a){_0x1414fa=_0x1414fa-0x0;var _0x3c55dd=_0x70e0[_0x1414fa];return _0x3c55dd;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 540f261..1ba0458 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 _0xa40d=['queue_interface','STRING','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x4cf4d3,_0x3a8713){var _0x19fee8=function(_0x5aef80){while(--_0x5aef80){_0x4cf4d3['push'](_0x4cf4d3['shift']());}};_0x19fee8(++_0x3a8713);}(_0xa40d,0x140));var _0xda40=function(_0x33f7b6,_0x8ce322){_0x33f7b6=_0x33f7b6-0x0;var _0x2cec9f=_0xa40d[_0x33f7b6];return _0x2cec9f;};'use strict';var Sequelize=require(_0xda40('0x0'));module[_0xda40('0x1')]={'uniqueid':{'type':Sequelize[_0xda40('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xda40('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xda40('0x3')},'UserId':{'type':Sequelize[_0xda40('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xda40('0x4'),'comment':_0xda40('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xda40('0x5')],'allowNull':![],'unique':_0xda40('0x4'),'comment':_0xda40('0x3')},'penalty':{'type':Sequelize[_0xda40('0x2')](0xb),'defaultValue':0x0,'comment':_0xda40('0x3')},'paused':{'type':Sequelize[_0xda40('0x2')](0xb),'defaultValue':0x0,'comment':_0xda40('0x3')}}; \ No newline at end of file +var _0x6994=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x9c8c83,_0x16ebdd){var _0x4636ac=function(_0x5bacfc){while(--_0x5bacfc){_0x9c8c83['push'](_0x9c8c83['shift']());}};_0x4636ac(++_0x16ebdd);}(_0x6994,0x14c));var _0x4699=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x6994[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require(_0x4699('0x0'));module[_0x4699('0x1')]={'uniqueid':{'type':Sequelize[_0x4699('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4699('0x3')},'membername':{'type':Sequelize[_0x4699('0x4')],'allowNull':![],'comment':_0x4699('0x3')},'UserId':{'type':Sequelize[_0x4699('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4699('0x4')],'allowNull':![],'unique':_0x4699('0x5'),'comment':_0x4699('0x3')},'VoiceQueueId':{'type':Sequelize[_0x4699('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x4699('0x4')],'allowNull':![],'unique':_0x4699('0x5'),'comment':_0x4699('0x3')},'penalty':{'type':Sequelize[_0x4699('0x2')](0xb),'defaultValue':0x0,'comment':_0x4699('0x3')},'paused':{'type':Sequelize[_0x4699('0x2')](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 2908047..898697b 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 _0x5701=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x257841,_0x389b4d){var _0x1b87ed=function(_0xceb19e){while(--_0xceb19e){_0x257841['push'](_0x257841['shift']());}};_0x1b87ed(++_0x389b4d);}(_0x5701,0x75));var _0x1570=function(_0x3e41eb,_0x17e99c){_0x3e41eb=_0x3e41eb-0x0;var _0x5976e9=_0x5701[_0x3e41eb];return _0x5976e9;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x1570('0x0'))['db'][_0x1570('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1570('0x2')](0x0);var events={'afterCreate':_0x1570('0x3'),'afterUpdate':_0x1570('0x4'),'afterDestroy':_0x1570('0x5')};function emitEvent(_0x4ae34c){return function(_0xe46004,_0x210558,_0x244598){UserVoiceQueueRtEvents['emit'](_0x4ae34c+':'+_0xe46004['id'],_0xe46004);UserVoiceQueueRtEvents[_0x1570('0x6')](_0x4ae34c,_0xe46004);_0x244598(null);};}for(var e in events){if(events[_0x1570('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x1570('0x8')](e,emitEvent(event));}}module[_0x1570('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7025=['hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0x7025,0xdf));var _0x5702=function(_0x493d68,_0x31fcd5){_0x493d68=_0x493d68-0x0;var _0x5e2151=_0x7025[_0x493d68];return _0x5e2151;};'use strict';var EventEmitter=require(_0x5702('0x0'));var UserVoiceQueueRt=require(_0x5702('0x1'))['db'][_0x5702('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5702('0x3')](0x0);var events={'afterCreate':_0x5702('0x4'),'afterUpdate':_0x5702('0x5'),'afterDestroy':_0x5702('0x6')};function emitEvent(_0x7f5952){return function(_0x3d3902,_0x3febf5,_0x583946){UserVoiceQueueRtEvents[_0x5702('0x7')](_0x7f5952+':'+_0x3d3902['id'],_0x3d3902);UserVoiceQueueRtEvents['emit'](_0x7f5952,_0x3d3902);_0x583946(null);};}for(var e in events){if(events[_0x5702('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x5702('0x9')](e,emitEvent(event));}}module[_0x5702('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index aa50cea..61708be 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 _0x20f2=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xae722c,_0x4f397c){var _0x52cdf4=function(_0x46c65d){while(--_0x46c65d){_0xae722c['push'](_0xae722c['shift']());}};_0x52cdf4(++_0x4f397c);}(_0x20f2,0xa0));var _0x220f=function(_0xef6100,_0x39cc3e){_0xef6100=_0xef6100-0x0;var _0x2173c7=_0x20f2[_0xef6100];return _0x2173c7;};'use strict';var _=require(_0x220f('0x0'));var util=require(_0x220f('0x1'));var logger=require(_0x220f('0x2'))(_0x220f('0x3'));var moment=require('moment');var BPromise=require(_0x220f('0x4'));var rp=require(_0x220f('0x5'));var fs=require('fs');var path=require(_0x220f('0x6'));var rimraf=require(_0x220f('0x7'));var config=require(_0x220f('0x8'));var attributes=require(_0x220f('0x9'));module['exports']=function(_0x3e584a,_0x532204){return _0x3e584a[_0x220f('0xa')](_0x220f('0xb'),attributes,{'tableName':_0x220f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8ee=['moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api'];(function(_0x263b35,_0x421508){var _0x48168e=function(_0x3bb3a6){while(--_0x3bb3a6){_0x263b35['push'](_0x263b35['shift']());}};_0x48168e(++_0x421508);}(_0xa8ee,0x1e9));var _0xea8e=function(_0x3044e4,_0x4073f9){_0x3044e4=_0x3044e4-0x0;var _0x5d07cd=_0xa8ee[_0x3044e4];return _0x5d07cd;};'use strict';var _=require(_0xea8e('0x0'));var util=require(_0xea8e('0x1'));var logger=require('../../config/logger')(_0xea8e('0x2'));var moment=require(_0xea8e('0x3'));var BPromise=require(_0xea8e('0x4'));var rp=require(_0xea8e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea8e('0x6'));var config=require(_0xea8e('0x7'));var attributes=require(_0xea8e('0x8'));module[_0xea8e('0x9')]=function(_0x4f29a5,_0x1ce481){return _0x4f29a5['define'](_0xea8e('0xa'),attributes,{'tableName':_0xea8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index c23ad34..7c17e7c 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 _0x2eea=['findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x2eea,0x170));var _0xa2ee=function(_0x1e04c7,_0x4c4f74){_0x1e04c7=_0x1e04c7-0x0;var _0x153969=_0x2eea[_0x1e04c7];return _0x153969;};'use strict';var _=require(_0xa2ee('0x0'));var util=require(_0xa2ee('0x1'));var moment=require(_0xa2ee('0x2'));var BPromise=require(_0xa2ee('0x3'));var rs=require(_0xa2ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2ee('0x5'));var logger=require(_0xa2ee('0x6'))('rpc');var config=require(_0xa2ee('0x7'));var jayson=require(_0xa2ee('0x8'));var client=jayson[_0xa2ee('0x9')][_0xa2ee('0xa')]({'port':0x232a});config[_0xa2ee('0xb')]=_[_0xa2ee('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa2ee('0xd'))(new Redis(config[_0xa2ee('0xb')]));require(_0xa2ee('0xe'))[_0xa2ee('0xf')](socket);function respondWithRpcPromise(_0x13f49e,_0x3123b1,_0x378fa3){return new BPromise(function(_0x487736,_0x58313e){return client[_0xa2ee('0x10')](_0x13f49e,_0x378fa3)[_0xa2ee('0x11')](function(_0x22f373){logger[_0xa2ee('0x12')](_0xa2ee('0x13'),_0x3123b1,_0xa2ee('0x14'));logger['debug'](_0xa2ee('0x15'),_0x3123b1,_0xa2ee('0x14'),JSON[_0xa2ee('0x16')](_0x22f373));if(_0x22f373[_0xa2ee('0x17')]){if(_0x22f373['error'][_0xa2ee('0x18')]===0x1f4){logger[_0xa2ee('0x17')](_0xa2ee('0x13'),_0x3123b1,_0x22f373['error']['message']);return _0x58313e(_0x22f373[_0xa2ee('0x17')]['message']);}logger['error'](_0xa2ee('0x13'),_0x3123b1,_0x22f373['error']['message']);return _0x487736(_0x22f373[_0xa2ee('0x17')][_0xa2ee('0x19')]);}else{logger[_0xa2ee('0x12')](_0xa2ee('0x13'),_0x3123b1,'request\x20sent');_0x487736(_0x22f373[_0xa2ee('0x1a')][_0xa2ee('0x19')]);}})['catch'](function(_0x28d1b4){logger[_0xa2ee('0x17')](_0xa2ee('0x13'),_0x3123b1,_0x28d1b4);_0x58313e(_0x28d1b4);});});}exports[_0xa2ee('0x1b')]=function(_0x573244){var _0x2de020=this;return new Promise(function(_0x3223cf,_0x27949e){return db['UserVoiceQueueRt'][_0xa2ee('0x1c')]({'raw':_0x573244[_0xa2ee('0x1d')]?_0x573244['options'][_0xa2ee('0x1e')]===undefined?!![]:![]:!![],'where':_0x573244['options']?_0x573244['options'][_0xa2ee('0x1f')]||null:null,'attributes':[[db[_0xa2ee('0x20')]['fn']('COUNT',db[_0xa2ee('0x20')]['fn']('IF',db[_0xa2ee('0x20')][_0xa2ee('0x21')](_0xa2ee('0x22')))),'outboundQueuePauses']]})[_0xa2ee('0x11')](function(_0x253cdd){logger[_0xa2ee('0x12')](_0xa2ee('0x1b'),_0x573244);logger[_0xa2ee('0x23')](_0xa2ee('0x1b'),_0x573244,JSON[_0xa2ee('0x16')](_0x253cdd));_0x3223cf(_0x253cdd);})['catch'](function(_0x1e19ab){logger['error'](_0xa2ee('0x1b'),_0x1e19ab[_0xa2ee('0x19')],_0x573244);_0x27949e(_0x2de020[_0xa2ee('0x17')](0x1f4,_0x1e19ab[_0xa2ee('0x19')]));});});}; \ No newline at end of file +var _0xe092=['literal','`paused`\x20=\x201,\x201,\x20null','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetVoiceQueueRtPauses','options','raw','where','sequelize','COUNT'];(function(_0x1a3001,_0x10f903){var _0x513dd1=function(_0x380881){while(--_0x380881){_0x1a3001['push'](_0x1a3001['shift']());}};_0x513dd1(++_0x10f903);}(_0xe092,0x1c3));var _0x2e09=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xe092[_0x2962d5];return _0x273406;};'use strict';var _=require('lodash');var util=require(_0x2e09('0x0'));var moment=require(_0x2e09('0x1'));var BPromise=require(_0x2e09('0x2'));var rs=require(_0x2e09('0x3'));var fs=require('fs');var Redis=require(_0x2e09('0x4'));var db=require(_0x2e09('0x5'))['db'];var utils=require(_0x2e09('0x6'));var logger=require(_0x2e09('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2e09('0x8'));var client=jayson[_0x2e09('0x9')]['http']({'port':0x232a});config[_0x2e09('0xa')]=_['defaults'](config['redis'],{'host':_0x2e09('0xb'),'port':0x18eb});var socket=require(_0x2e09('0xc'))(new Redis(config[_0x2e09('0xa')]));require(_0x2e09('0xd'))['register'](socket);function respondWithRpcPromise(_0x91f5aa,_0x40ddd4,_0x4ca0d0){return new BPromise(function(_0x240217,_0x1d3810){return client[_0x2e09('0xe')](_0x91f5aa,_0x4ca0d0)['then'](function(_0x12c87d){logger[_0x2e09('0xf')](_0x2e09('0x10'),_0x40ddd4,'request\x20sent');logger['debug'](_0x2e09('0x11'),_0x40ddd4,_0x2e09('0x12'),JSON['stringify'](_0x12c87d));if(_0x12c87d[_0x2e09('0x13')]){if(_0x12c87d[_0x2e09('0x13')][_0x2e09('0x14')]===0x1f4){logger[_0x2e09('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x40ddd4,_0x12c87d['error'][_0x2e09('0x15')]);return _0x1d3810(_0x12c87d[_0x2e09('0x13')][_0x2e09('0x15')]);}logger[_0x2e09('0x13')](_0x2e09('0x10'),_0x40ddd4,_0x12c87d[_0x2e09('0x13')]['message']);return _0x240217(_0x12c87d['error']['message']);}else{logger[_0x2e09('0xf')](_0x2e09('0x10'),_0x40ddd4,_0x2e09('0x12'));_0x240217(_0x12c87d[_0x2e09('0x16')][_0x2e09('0x15')]);}})['catch'](function(_0x3c41ad){logger[_0x2e09('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x40ddd4,_0x3c41ad);_0x1d3810(_0x3c41ad);});});}exports[_0x2e09('0x17')]=function(_0x294787){var _0x1f4454=this;return new Promise(function(_0x4d081a,_0x197e0b){return db['UserVoiceQueueRt']['findAll']({'raw':_0x294787[_0x2e09('0x18')]?_0x294787[_0x2e09('0x18')][_0x2e09('0x19')]===undefined?!![]:![]:!![],'where':_0x294787[_0x2e09('0x18')]?_0x294787[_0x2e09('0x18')][_0x2e09('0x1a')]||null:null,'attributes':[[db[_0x2e09('0x1b')]['fn'](_0x2e09('0x1c'),db[_0x2e09('0x1b')]['fn']('IF',db[_0x2e09('0x1b')][_0x2e09('0x1d')](_0x2e09('0x1e')))),'outboundQueuePauses']]})['then'](function(_0x49b9ea){logger[_0x2e09('0xf')]('GetVoiceQueueRtPauses',_0x294787);logger[_0x2e09('0x1f')](_0x2e09('0x17'),_0x294787,JSON['stringify'](_0x49b9ea));_0x4d081a(_0x49b9ea);})['catch'](function(_0x4bf5ac){logger[_0x2e09('0x13')]('GetVoiceQueueRtPauses',_0x4bf5ac['message'],_0x294787);_0x197e0b(_0x1f4454['error'](0x1f4,_0x4bf5ac[_0x2e09('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 4883f92..99c005d 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 _0x9300=['update','emit','removeListener','length','./userVoiceQueueRt.events'];(function(_0x5e8369,_0x12b4af){var _0x593a19=function(_0x2bf34e){while(--_0x2bf34e){_0x5e8369['push'](_0x5e8369['shift']());}};_0x593a19(++_0x12b4af);}(_0x9300,0x153));var _0x0930=function(_0x121737,_0x37e36b){_0x121737=_0x121737-0x0;var _0x5f4d4b=_0x9300[_0x121737];return _0x5f4d4b;};'use strict';var UserVoiceQueueRtEvents=require(_0x0930('0x0'));var events=['save','remove',_0x0930('0x1')];function createListener(_0x2034e2,_0x70a4ea){return function(_0x44657f){_0x70a4ea[_0x0930('0x2')](_0x2034e2,_0x44657f);};}function removeListener(_0x49d993,_0x298c01){return function(){UserVoiceQueueRtEvents[_0x0930('0x3')](_0x49d993,_0x298c01);};}exports['register']=function(_0x34c542){for(var _0x1c8175=0x0,_0x45705a=events[_0x0930('0x4')];_0x1c8175<_0x45705a;_0x1c8175++){var _0x2c0f94=events[_0x1c8175];var _0x1ec24f=createListener('userVoiceQueueRt:'+_0x2c0f94,_0x34c542);UserVoiceQueueRtEvents['on'](_0x2c0f94,_0x1ec24f);}}; \ No newline at end of file +var _0xed20=['register','length','./userVoiceQueueRt.events','save','remove','emit'];(function(_0x247cdd,_0x2f2a84){var _0x3f9339=function(_0x4677ca){while(--_0x4677ca){_0x247cdd['push'](_0x247cdd['shift']());}};_0x3f9339(++_0x2f2a84);}(_0xed20,0xce));var _0x0ed2=function(_0x30258a,_0x363597){_0x30258a=_0x30258a-0x0;var _0x28b347=_0xed20[_0x30258a];return _0x28b347;};'use strict';var UserVoiceQueueRtEvents=require(_0x0ed2('0x0'));var events=[_0x0ed2('0x1'),_0x0ed2('0x2'),'update'];function createListener(_0x2a9ed0,_0x380277){return function(_0x1d5c58){_0x380277[_0x0ed2('0x3')](_0x2a9ed0,_0x1d5c58);};}function removeListener(_0x395e2d,_0x20cac9){return function(){UserVoiceQueueRtEvents['removeListener'](_0x395e2d,_0x20cac9);};}exports[_0x0ed2('0x4')]=function(_0x88640a){for(var _0x5c686a=0x0,_0x114121=events[_0x0ed2('0x5')];_0x5c686a<_0x114121;_0x5c686a++){var _0x65848d=events[_0x5c686a];var _0x39498b=createListener('userVoiceQueueRt:'+_0x65848d,_0x88640a);UserVoiceQueueRtEvents['on'](_0x65848d,_0x39498b);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 261a9ae..bb62312 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(_0x5cf186,_0x35b3bd){var _0x3f3613=function(_0x4c411d){while(--_0x4c411d){_0x5cf186['push'](_0x5cf186['shift']());}};_0x3f3613(++_0x35b3bd);}(_0xe706,0xa3));var _0x6e70=function(_0x132990,_0x1370c9){_0x132990=_0x132990-0x0;var _0x2aa89d=_0xe706[_0x132990];return _0x2aa89d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3f127b,_0x986b51){var _0x23ed00=function(_0x305f37){while(--_0x305f37){_0x3f127b['push'](_0x3f127b['shift']());}};_0x23ed00(++_0x986b51);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index ddcae63..54941fb 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 _0xd730=['exports'];(function(_0x2e1d8b,_0x25d277){var _0x4a385e=function(_0x4f8286){while(--_0x4f8286){_0x2e1d8b['push'](_0x2e1d8b['shift']());}};_0x4a385e(++_0x25d277);}(_0xd730,0xfd));var _0x0d73=function(_0x2e574c,_0x21672f){_0x2e574c=_0x2e574c-0x0;var _0x3fa419=_0xd730[_0x2e574c];return _0x3fa419;};'use strict';var Sequelize=require('sequelize');module[_0x0d73('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf429=['sequelize','exports','INTEGER'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xf429,0xd5));var _0x9f42=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xf429[_0x17a32f];return _0x15a293;};'use strict';var Sequelize=require(_0x9f42('0x0'));module[_0x9f42('0x1')]={'penalty':{'type':Sequelize[_0x9f42('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b7a252e..e2b1dec 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 _0xd1ae=['bluebird','request-promise','path','rimraf','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment'];(function(_0x2ac416,_0x73241e){var _0x1b489d=function(_0x3ba138){while(--_0x3ba138){_0x2ac416['push'](_0x2ac416['shift']());}};_0x1b489d(++_0x73241e);}(_0xd1ae,0x134));var _0xed1a=function(_0x4713fb,_0x47295b){_0x4713fb=_0x4713fb-0x0;var _0x69ea7e=_0xd1ae[_0x4713fb];return _0x69ea7e;};'use strict';var _=require(_0xed1a('0x0'));var util=require(_0xed1a('0x1'));var logger=require('../../config/logger')(_0xed1a('0x2'));var moment=require(_0xed1a('0x3'));var BPromise=require(_0xed1a('0x4'));var rp=require(_0xed1a('0x5'));var fs=require('fs');var path=require(_0xed1a('0x6'));var rimraf=require(_0xed1a('0x7'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xed1a('0x8')]=function(_0x2e6534,_0x2320cf){return _0x2e6534[_0xed1a('0x9')](_0xed1a('0xa'),attributes,{'tableName':_0xed1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf5c=['../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x136290,_0x3e6b8f){var _0x290e92=function(_0x4095d6){while(--_0x4095d6){_0x136290['push'](_0x136290['shift']());}};_0x290e92(++_0x3e6b8f);}(_0xaf5c,0x122));var _0xcaf5=function(_0x5ba7e7,_0x102389){_0x5ba7e7=_0x5ba7e7-0x0;var _0x296b02=_0xaf5c[_0x5ba7e7];return _0x296b02;};'use strict';var _=require(_0xcaf5('0x0'));var util=require(_0xcaf5('0x1'));var logger=require(_0xcaf5('0x2'))(_0xcaf5('0x3'));var moment=require(_0xcaf5('0x4'));var BPromise=require('bluebird');var rp=require(_0xcaf5('0x5'));var fs=require('fs');var path=require(_0xcaf5('0x6'));var rimraf=require('rimraf');var config=require(_0xcaf5('0x7'));var attributes=require(_0xcaf5('0x8'));module['exports']=function(_0x4d718f,_0xffa33b){return _0x4d718f['define'](_0xcaf5('0x9'),attributes,{'tableName':_0xcaf5('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 efa1809..bc2cee2 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 _0x5f60=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x303bfc,_0x30a8ca){var _0x5cff92=function(_0x5b30b3){while(--_0x5b30b3){_0x303bfc['push'](_0x303bfc['shift']());}};_0x5cff92(++_0x30a8ca);}(_0x5f60,0x144));var _0x05f6=function(_0x44feb5,_0x3f7964){_0x44feb5=_0x44feb5-0x0;var _0x45e3b8=_0x5f60[_0x44feb5];return _0x45e3b8;};'use strict';var _=require(_0x05f6('0x0'));var util=require(_0x05f6('0x1'));var moment=require(_0x05f6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05f6('0x3'));var db=require(_0x05f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x05f6('0x5'))(_0x05f6('0x6'));var config=require(_0x05f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x05f6('0x8')][_0x05f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x95b6d8,_0x28386c,_0x3f53ff){return new BPromise(function(_0xada4ab,_0x3796e4){return client[_0x05f6('0xa')](_0x95b6d8,_0x3f53ff)['then'](function(_0x1f83d7){logger[_0x05f6('0xb')](_0x05f6('0xc'),_0x28386c,_0x05f6('0xd'));logger[_0x05f6('0xe')](_0x05f6('0xf'),_0x28386c,'request\x20sent',JSON[_0x05f6('0x10')](_0x1f83d7));if(_0x1f83d7[_0x05f6('0x11')]){if(_0x1f83d7[_0x05f6('0x11')]['code']===0x1f4){logger[_0x05f6('0x11')](_0x05f6('0xc'),_0x28386c,_0x1f83d7['error'][_0x05f6('0x12')]);return _0x3796e4(_0x1f83d7['error'][_0x05f6('0x12')]);}logger['error'](_0x05f6('0xc'),_0x28386c,_0x1f83d7[_0x05f6('0x11')][_0x05f6('0x12')]);return _0xada4ab(_0x1f83d7[_0x05f6('0x11')][_0x05f6('0x12')]);}else{logger[_0x05f6('0xb')](_0x05f6('0xc'),_0x28386c,_0x05f6('0xd'));_0xada4ab(_0x1f83d7[_0x05f6('0x13')][_0x05f6('0x12')]);}})[_0x05f6('0x14')](function(_0x381af9){logger['error'](_0x05f6('0xc'),_0x28386c,_0x381af9);_0x3796e4(_0x381af9);});});} \ No newline at end of file +var _0x1309=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message'];(function(_0x32f37c,_0x286c12){var _0x1c54bf=function(_0xce9178){while(--_0xce9178){_0x32f37c['push'](_0x32f37c['shift']());}};_0x1c54bf(++_0x286c12);}(_0x1309,0xf2));var _0x9130=function(_0x49b54b,_0x4fcd85){_0x49b54b=_0x49b54b-0x0;var _0x4abe47=_0x1309[_0x49b54b];return _0x4abe47;};'use strict';var _=require(_0x9130('0x0'));var util=require(_0x9130('0x1'));var moment=require(_0x9130('0x2'));var BPromise=require(_0x9130('0x3'));var rs=require(_0x9130('0x4'));var fs=require('fs');var Redis=require(_0x9130('0x5'));var db=require(_0x9130('0x6'))['db'];var utils=require(_0x9130('0x7'));var logger=require(_0x9130('0x8'))(_0x9130('0x9'));var config=require(_0x9130('0xa'));var jayson=require(_0x9130('0xb'));var client=jayson[_0x9130('0xc')][_0x9130('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c6915,_0xffd638,_0x179e16){return new BPromise(function(_0x53b081,_0x3a0deb){return client['request'](_0x3c6915,_0x179e16)['then'](function(_0x1dfaf3){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xffd638,'request\x20sent');logger[_0x9130('0xe')](_0x9130('0xf'),_0xffd638,_0x9130('0x10'),JSON[_0x9130('0x11')](_0x1dfaf3));if(_0x1dfaf3[_0x9130('0x12')]){if(_0x1dfaf3['error'][_0x9130('0x13')]===0x1f4){logger['error'](_0x9130('0x14'),_0xffd638,_0x1dfaf3[_0x9130('0x12')]['message']);return _0x3a0deb(_0x1dfaf3[_0x9130('0x12')][_0x9130('0x15')]);}logger[_0x9130('0x12')](_0x9130('0x14'),_0xffd638,_0x1dfaf3['error'][_0x9130('0x15')]);return _0x53b081(_0x1dfaf3[_0x9130('0x12')]['message']);}else{logger['info'](_0x9130('0x14'),_0xffd638,_0x9130('0x10'));_0x53b081(_0x1dfaf3[_0x9130('0x16')]['message']);}})[_0x9130('0x17')](function(_0x4e842a){logger['error'](_0x9130('0x14'),_0xffd638,_0x4e842a);_0x3a0deb(_0x4e842a);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index ffa0941..65dfd7b 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 _0x207d=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x4d6d82,_0x29ee30){var _0x11212c=function(_0x3b16ad){while(--_0x3b16ad){_0x4d6d82['push'](_0x4d6d82['shift']());}};_0x11212c(++_0x29ee30);}(_0x207d,0x10d));var _0xd207=function(_0x16bd24,_0x32436e){_0x16bd24=_0x16bd24-0x0;var _0x1b5572=_0x207d[_0x16bd24];return _0x1b5572;};'use strict';var multer=require(_0xd207('0x0'));var util=require(_0xd207('0x1'));var path=require(_0xd207('0x2'));var timeout=require(_0xd207('0x3'));var express=require('express');var router=express[_0xd207('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd207('0x5'));var interaction=require(_0xd207('0x6'));var config=require('../../config/environment');var controller=require(_0xd207('0x7'));router[_0xd207('0x8')]('/',auth[_0xd207('0x9')](),controller[_0xd207('0xa')]);router[_0xd207('0x8')](_0xd207('0xb'),auth[_0xd207('0x9')](),controller[_0xd207('0xc')]);router[_0xd207('0xd')]('/',auth[_0xd207('0x9')](),controller[_0xd207('0xe')]);router['put'](_0xd207('0xb'),auth[_0xd207('0x9')](),controller[_0xd207('0xf')]);router['delete']('/:id',auth[_0xd207('0x9')](),controller[_0xd207('0x10')]);module[_0xd207('0x11')]=router; \ No newline at end of file +var _0xfcbd=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x24e19c,_0x1eec14){var _0x188fac=function(_0xeac31d){while(--_0xeac31d){_0x24e19c['push'](_0x24e19c['shift']());}};_0x188fac(++_0x1eec14);}(_0xfcbd,0x160));var _0xdfcb=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0xfcbd[_0x502598];return _0xbdee21;};'use strict';var multer=require(_0xdfcb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdfcb('0x1'));var express=require(_0xdfcb('0x2'));var router=express[_0xdfcb('0x3')]();var fs_extra=require(_0xdfcb('0x4'));var auth=require(_0xdfcb('0x5'));var interaction=require(_0xdfcb('0x6'));var config=require(_0xdfcb('0x7'));var controller=require(_0xdfcb('0x8'));router[_0xdfcb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdfcb('0x9')](_0xdfcb('0xa'),auth[_0xdfcb('0xb')](),controller[_0xdfcb('0xc')]);router[_0xdfcb('0xd')]('/',auth[_0xdfcb('0xb')](),controller[_0xdfcb('0xe')]);router['put'](_0xdfcb('0xa'),auth[_0xdfcb('0xb')](),controller[_0xdfcb('0xf')]);router[_0xdfcb('0x10')](_0xdfcb('0xa'),auth[_0xdfcb('0xb')](),controller[_0xdfcb('0x11')]);module[_0xdfcb('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 34c8ee5..172eb72 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 _0x668b=['name','sequelize','exports','STRING'];(function(_0x2d99e9,_0x5b5af0){var _0x4b9d95=function(_0x3fdfc9){while(--_0x3fdfc9){_0x2d99e9['push'](_0x2d99e9['shift']());}};_0x4b9d95(++_0x5b5af0);}(_0x668b,0x8d));var _0xb668=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0x668b[_0x3f3f06];return _0x140feb;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize[_0xb668('0x2')],'unique':_0xb668('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file +var _0xfcda=['sequelize','exports','name'];(function(_0x59b31b,_0xc57804){var _0x4c789d=function(_0x3890eb){while(--_0x3890eb){_0x59b31b['push'](_0x59b31b['shift']());}};_0x4c789d(++_0xc57804);}(_0xfcda,0x198));var _0xafcd=function(_0x3a294e,_0x5770d2){_0x3a294e=_0x3a294e-0x0;var _0x40832f=_0xfcda[_0x3a294e];return _0x40832f;};'use strict';var Sequelize=require(_0xafcd('0x0'));module[_0xafcd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xafcd('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 41c5024..2b76b0b 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 _0xab39=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','Variable','findAll','catch','params','keys','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0xab39,0xf1));var _0x9ab3=function(_0x5bd233,_0x101d88){_0x5bd233=_0x5bd233-0x0;var _0x2febde=_0xab39[_0x5bd233];return _0x2febde;};'use strict';var emlformat=require(_0x9ab3('0x0'));var rimraf=require(_0x9ab3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9ab3('0x2'));var BPromise=require(_0x9ab3('0x3'));var Mustache=require(_0x9ab3('0x4'));var util=require('util');var path=require(_0x9ab3('0x5'));var sox=require(_0x9ab3('0x6'));var csv=require(_0x9ab3('0x7'));var ejs=require(_0x9ab3('0x8'));var fs=require('fs');var fs_extra=require(_0x9ab3('0x9'));var _=require(_0x9ab3('0xa'));var squel=require(_0x9ab3('0xb'));var crypto=require('crypto');var jsforce=require(_0x9ab3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ab3('0xd'));var Papa=require('papaparse');var Redis=require(_0x9ab3('0xe'));var authService=require(_0x9ab3('0xf'));var qs=require(_0x9ab3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ab3('0x11'));var logger=require('../../config/logger')(_0x9ab3('0x12'));var utils=require(_0x9ab3('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9ab3('0x14'))['db'];function respondWithStatusCode(_0x90d4d5,_0xa4eeae){_0xa4eeae=_0xa4eeae||0xcc;return function(_0x470274){if(_0x470274){return _0x90d4d5[_0x9ab3('0x15')](_0xa4eeae);}return _0x90d4d5[_0x9ab3('0x16')](_0xa4eeae)[_0x9ab3('0x17')]();};}function respondWithResult(_0x879e2a,_0x393d46){_0x393d46=_0x393d46||0xc8;return function(_0x212f01){if(_0x212f01){return _0x879e2a['status'](_0x393d46)[_0x9ab3('0x18')](_0x212f01);}};}function respondWithFilteredResult(_0x1276be,_0xc60689){return function(_0x37e6e1){if(_0x37e6e1){var _0x29b629=typeof _0xc60689['offset']===_0x9ab3('0x19')&&typeof _0xc60689[_0x9ab3('0x1a')]===_0x9ab3('0x19');var _0x51fc75=_0x37e6e1[_0x9ab3('0x1b')];var _0x1363f0=_0x29b629?0x0:_0xc60689[_0x9ab3('0x1c')];var _0x5db12e=_0x29b629?_0x37e6e1['count']:_0xc60689[_0x9ab3('0x1c')]+_0xc60689[_0x9ab3('0x1a')];var _0x520d86;if(_0x5db12e>=_0x51fc75){_0x5db12e=_0x51fc75;_0x520d86=0xc8;}else{_0x520d86=0xce;}_0x1276be[_0x9ab3('0x16')](_0x520d86);return _0x1276be['set'](_0x9ab3('0x1d'),_0x1363f0+'-'+_0x5db12e+'/'+_0x51fc75)[_0x9ab3('0x18')](_0x37e6e1);}return null;};}function patchUpdates(_0x5443fd){return function(_0x567c92){try{jsonpatch[_0x9ab3('0x1e')](_0x567c92,_0x5443fd,!![]);}catch(_0x20fcf2){return BPromise[_0x9ab3('0x1f')](_0x20fcf2);}return _0x567c92['save']();};}function saveUpdates(_0x5125a1,_0x445097){return function(_0x467d24){if(_0x467d24){return _0x467d24[_0x9ab3('0x20')](_0x5125a1)[_0x9ab3('0x21')](function(_0x56161e){return _0x56161e;});}return null;};}function removeEntity(_0x455e70,_0x51e730){return function(_0x4ac5b3){if(_0x4ac5b3){return _0x4ac5b3[_0x9ab3('0x22')]()[_0x9ab3('0x21')](function(){var _0x5d1a3c=_0x4ac5b3[_0x9ab3('0x23')]({'plain':!![]});var _0x3243f4=_0x9ab3('0x24');return db[_0x9ab3('0x25')][_0x9ab3('0x22')]({'where':{'type':_0x3243f4,'resourceId':_0x5d1a3c['id']}})['then'](function(){return _0x4ac5b3;});})[_0x9ab3('0x21')](function(){_0x455e70[_0x9ab3('0x16')](0xcc)[_0x9ab3('0x17')]();});}};}function handleEntityNotFound(_0x2dbd71,_0x4b485a){return function(_0x4ce5a4){if(!_0x4ce5a4){_0x2dbd71[_0x9ab3('0x15')](0x194);}return _0x4ce5a4;};}function handleError(_0x21b707,_0x49b9e3){_0x49b9e3=_0x49b9e3||0x1f4;return function(_0x213e72){logger['error'](_0x213e72[_0x9ab3('0x26')]);if(_0x213e72[_0x9ab3('0x27')]){delete _0x213e72[_0x9ab3('0x27')];}_0x21b707[_0x9ab3('0x16')](_0x49b9e3)[_0x9ab3('0x28')](_0x213e72);};}exports[_0x9ab3('0x29')]=function(_0x5c1734,_0x5322f2){var _0x112c6c={},_0x524981={},_0x5b26f1={'count':0x0,'rows':[]};var _0xb5662c=_['map'](db['Variable']['rawAttributes'],function(_0x36086f){return{'name':_0x36086f[_0x9ab3('0x2a')],'type':_0x36086f[_0x9ab3('0x2b')][_0x9ab3('0x2c')]};});_0x524981[_0x9ab3('0x2d')]=_[_0x9ab3('0x2e')](_0xb5662c,'name');_0x524981[_0x9ab3('0x2f')]=_['keys'](_0x5c1734[_0x9ab3('0x2f')]);_0x524981[_0x9ab3('0x30')]=_[_0x9ab3('0x31')](_0x524981[_0x9ab3('0x2d')],_0x524981[_0x9ab3('0x2f')]);_0x112c6c['attributes']=_[_0x9ab3('0x31')](_0x524981['model'],qs[_0x9ab3('0x32')](_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x32')]));_0x112c6c[_0x9ab3('0x33')]=_0x112c6c[_0x9ab3('0x33')][_0x9ab3('0x34')]?_0x112c6c[_0x9ab3('0x33')]:_0x524981[_0x9ab3('0x2d')];if(!_0x5c1734[_0x9ab3('0x2f')]['hasOwnProperty'](_0x9ab3('0x35'))){_0x112c6c[_0x9ab3('0x1a')]=qs[_0x9ab3('0x1a')](_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x1a')]);_0x112c6c[_0x9ab3('0x1c')]=qs[_0x9ab3('0x1c')](_0x5c1734['query'][_0x9ab3('0x1c')]);}_0x112c6c[_0x9ab3('0x36')]=qs['sort'](_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x37')]);_0x112c6c['where']=qs[_0x9ab3('0x30')](_[_0x9ab3('0x38')](_0x5c1734[_0x9ab3('0x2f')],_0x524981[_0x9ab3('0x30')]),_0xb5662c);if(_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x39')]){_0x112c6c[_0x9ab3('0x3a')]=_['merge'](_0x112c6c['where'],{'$or':_[_0x9ab3('0x2e')](_0xb5662c,function(_0x5969d1){if(_0x5969d1[_0x9ab3('0x2b')]!==_0x9ab3('0x3b')){var _0x7f6ab7={};_0x7f6ab7[_0x5969d1[_0x9ab3('0x27')]]={'$like':'%'+_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x39')]+'%'};return _0x7f6ab7;}})});}_0x112c6c=_[_0x9ab3('0x3c')]({},_0x112c6c,_0x5c1734[_0x9ab3('0x3d')]);var _0x216db8={'where':_0x112c6c[_0x9ab3('0x3a')]};return db['Variable'][_0x9ab3('0x1b')](_0x216db8)[_0x9ab3('0x21')](function(_0x1334f2){_0x5b26f1['count']=_0x1334f2;if(_0x5c1734['query'][_0x9ab3('0x3e')]){_0x112c6c[_0x9ab3('0x3f')]=[{'all':!![]}];}return db[_0x9ab3('0x40')][_0x9ab3('0x41')](_0x112c6c);})[_0x9ab3('0x21')](function(_0x3ececb){_0x5b26f1['rows']=_0x3ececb;return _0x5b26f1;})[_0x9ab3('0x21')](respondWithFilteredResult(_0x5322f2,_0x112c6c))[_0x9ab3('0x42')](handleError(_0x5322f2,null));};exports['show']=function(_0x17692b,_0x50a03e){var _0xf21bb2={'raw':!![],'where':{'id':_0x17692b[_0x9ab3('0x43')]['id']}},_0x4f557d={};_0x4f557d['model']=_[_0x9ab3('0x44')](db['Variable'][_0x9ab3('0x45')]);_0x4f557d['query']=_['keys'](_0x17692b['query']);_0x4f557d[_0x9ab3('0x30')]=_[_0x9ab3('0x31')](_0x4f557d[_0x9ab3('0x2d')],_0x4f557d['query']);_0xf21bb2[_0x9ab3('0x33')]=_['intersection'](_0x4f557d['model'],qs[_0x9ab3('0x32')](_0x17692b[_0x9ab3('0x2f')][_0x9ab3('0x32')]));_0xf21bb2['attributes']=_0xf21bb2['attributes']['length']?_0xf21bb2[_0x9ab3('0x33')]:_0x4f557d[_0x9ab3('0x2d')];if(_0x17692b[_0x9ab3('0x2f')][_0x9ab3('0x3e')]){_0xf21bb2[_0x9ab3('0x3f')]=[{'all':!![]}];}_0xf21bb2=_[_0x9ab3('0x3c')]({},_0xf21bb2,_0x17692b[_0x9ab3('0x3d')]);return db[_0x9ab3('0x40')]['find'](_0xf21bb2)[_0x9ab3('0x21')](handleEntityNotFound(_0x50a03e,null))[_0x9ab3('0x21')](respondWithResult(_0x50a03e,null))[_0x9ab3('0x42')](handleError(_0x50a03e,null));};exports[_0x9ab3('0x46')]=function(_0x38b3df,_0x12997e){return db[_0x9ab3('0x40')][_0x9ab3('0x46')](_0x38b3df['body'],{})[_0x9ab3('0x21')](function(_0x242f62){var _0x4b2b87=_0x38b3df[_0x9ab3('0x47')][_0x9ab3('0x23')]({'plain':!![]});if(!_0x4b2b87)throw new Error(_0x9ab3('0x48'));if(_0x4b2b87[_0x9ab3('0x49')]===_0x9ab3('0x47')){var _0x32b8c4=_0x242f62['get']({'plain':!![]});var _0x59b5a3='Variables';return db['UserProfileSection'][_0x9ab3('0x4a')]({'where':{'name':_0x59b5a3,'userProfileId':_0x4b2b87[_0x9ab3('0x4b')]},'raw':!![]})[_0x9ab3('0x21')](function(_0x24e4e7){if(_0x24e4e7&&_0x24e4e7[_0x9ab3('0x4c')]===0x0){return db[_0x9ab3('0x25')]['create']({'name':_0x32b8c4['name'],'resourceId':_0x32b8c4['id'],'type':_0x24e4e7[_0x9ab3('0x27')],'sectionId':_0x24e4e7['id']},{})[_0x9ab3('0x21')](function(){return _0x242f62;});}else{return _0x242f62;}})[_0x9ab3('0x42')](function(_0x445ec9){logger['error'](_0x9ab3('0x4d'),_0x445ec9);throw _0x445ec9;});}return _0x242f62;})[_0x9ab3('0x21')](respondWithResult(_0x12997e,0xc9))[_0x9ab3('0x42')](handleError(_0x12997e,null));};exports[_0x9ab3('0x20')]=function(_0x4c6492,_0x5f3d9f){if(_0x4c6492['body']['id']){delete _0x4c6492[_0x9ab3('0x4e')]['id'];}return db['Variable'][_0x9ab3('0x4a')]({'where':{'id':_0x4c6492['params']['id']}})[_0x9ab3('0x21')](handleEntityNotFound(_0x5f3d9f,null))[_0x9ab3('0x21')](saveUpdates(_0x4c6492[_0x9ab3('0x4e')],null))['then'](respondWithResult(_0x5f3d9f,null))[_0x9ab3('0x42')](handleError(_0x5f3d9f,null));};exports[_0x9ab3('0x22')]=function(_0x525a9d,_0x561086){return db[_0x9ab3('0x40')][_0x9ab3('0x4a')]({'where':{'id':_0x525a9d['params']['id']}})['then'](handleEntityNotFound(_0x561086,null))[_0x9ab3('0x21')](removeEntity(_0x561086,null))[_0x9ab3('0x42')](handleError(_0x561086,null));}; \ No newline at end of file +var _0x3210=['json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','get','Variables','then','name','send','index','map','Variable','rawAttributes','type','key','query','keys','model','intersection','fields','attributes','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4379d2,_0x47acb4){var _0x2a1d32=function(_0x74ed31){while(--_0x74ed31){_0x4379d2['push'](_0x4379d2['shift']());}};_0x2a1d32(++_0x47acb4);}(_0x3210,0x17c));var _0x0321=function(_0x4c5141,_0x56aecf){_0x4c5141=_0x4c5141-0x0;var _0x1bd4a3=_0x3210[_0x4c5141];return _0x1bd4a3;};'use strict';var emlformat=require(_0x0321('0x0'));var rimraf=require(_0x0321('0x1'));var zipdir=require(_0x0321('0x2'));var jsonpatch=require(_0x0321('0x3'));var rp=require(_0x0321('0x4'));var moment=require(_0x0321('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0321('0x6'));var util=require('util');var path=require(_0x0321('0x7'));var sox=require(_0x0321('0x8'));var csv=require(_0x0321('0x9'));var ejs=require(_0x0321('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0321('0xb'));var crypto=require(_0x0321('0xc'));var jsforce=require(_0x0321('0xd'));var deskjs=require(_0x0321('0xe'));var toCsv=require(_0x0321('0x9'));var querystring=require(_0x0321('0xf'));var Papa=require(_0x0321('0x10'));var Redis=require(_0x0321('0x11'));var authService=require(_0x0321('0x12'));var qs=require(_0x0321('0x13'));var as=require(_0x0321('0x14'));var hardwareService=require(_0x0321('0x15'));var logger=require(_0x0321('0x16'))(_0x0321('0x17'));var utils=require(_0x0321('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0321('0x19'));var db=require(_0x0321('0x1a'))['db'];function respondWithStatusCode(_0x533fc7,_0x17bfde){_0x17bfde=_0x17bfde||0xcc;return function(_0x4d5efc){if(_0x4d5efc){return _0x533fc7[_0x0321('0x1b')](_0x17bfde);}return _0x533fc7[_0x0321('0x1c')](_0x17bfde)[_0x0321('0x1d')]();};}function respondWithResult(_0x37cbe7,_0x112a08){_0x112a08=_0x112a08||0xc8;return function(_0x1b8658){if(_0x1b8658){return _0x37cbe7[_0x0321('0x1c')](_0x112a08)[_0x0321('0x1e')](_0x1b8658);}};}function respondWithFilteredResult(_0x816ad7,_0x1701c5){return function(_0x143254){if(_0x143254){var _0x31401e=typeof _0x1701c5[_0x0321('0x1f')]==='undefined'&&typeof _0x1701c5[_0x0321('0x20')]==='undefined';var _0x3fc6b5=_0x143254[_0x0321('0x21')];var _0x1e7fb7=_0x31401e?0x0:_0x1701c5[_0x0321('0x1f')];var _0x4c91d8=_0x31401e?_0x143254[_0x0321('0x21')]:_0x1701c5[_0x0321('0x1f')]+_0x1701c5['limit'];var _0x5734de;if(_0x4c91d8>=_0x3fc6b5){_0x4c91d8=_0x3fc6b5;_0x5734de=0xc8;}else{_0x5734de=0xce;}_0x816ad7['status'](_0x5734de);return _0x816ad7[_0x0321('0x22')](_0x0321('0x23'),_0x1e7fb7+'-'+_0x4c91d8+'/'+_0x3fc6b5)[_0x0321('0x1e')](_0x143254);}return null;};}function patchUpdates(_0x2df22f){return function(_0x144284){try{jsonpatch[_0x0321('0x24')](_0x144284,_0x2df22f,!![]);}catch(_0x315da6){return BPromise[_0x0321('0x25')](_0x315da6);}return _0x144284['save']();};}function saveUpdates(_0x3a8689,_0x38b014){return function(_0x5a2352){if(_0x5a2352){return _0x5a2352[_0x0321('0x26')](_0x3a8689)['then'](function(_0x45d608){return _0x45d608;});}return null;};}function removeEntity(_0x1f0882,_0x5585a8){return function(_0x6ff22a){if(_0x6ff22a){return _0x6ff22a[_0x0321('0x27')]()['then'](function(){var _0x4653d5=_0x6ff22a[_0x0321('0x28')]({'plain':!![]});var _0x31f69e=_0x0321('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x31f69e,'resourceId':_0x4653d5['id']}})[_0x0321('0x2a')](function(){return _0x6ff22a;});})[_0x0321('0x2a')](function(){_0x1f0882[_0x0321('0x1c')](0xcc)[_0x0321('0x1d')]();});}};}function handleEntityNotFound(_0x339bbf,_0x44a2bb){return function(_0x2e6a7f){if(!_0x2e6a7f){_0x339bbf['sendStatus'](0x194);}return _0x2e6a7f;};}function handleError(_0x2330a8,_0x16ff03){_0x16ff03=_0x16ff03||0x1f4;return function(_0x18a4b8){logger['error'](_0x18a4b8['stack']);if(_0x18a4b8[_0x0321('0x2b')]){delete _0x18a4b8[_0x0321('0x2b')];}_0x2330a8[_0x0321('0x1c')](_0x16ff03)[_0x0321('0x2c')](_0x18a4b8);};}exports[_0x0321('0x2d')]=function(_0x568000,_0x38fbd9){var _0x31d74a={},_0x5cfc07={},_0xafba8c={'count':0x0,'rows':[]};var _0x562526=_[_0x0321('0x2e')](db[_0x0321('0x2f')][_0x0321('0x30')],function(_0x5d8890){return{'name':_0x5d8890['fieldName'],'type':_0x5d8890[_0x0321('0x31')][_0x0321('0x32')]};});_0x5cfc07['model']=_['map'](_0x562526,_0x0321('0x2b'));_0x5cfc07[_0x0321('0x33')]=_[_0x0321('0x34')](_0x568000[_0x0321('0x33')]);_0x5cfc07['filters']=_['intersection'](_0x5cfc07[_0x0321('0x35')],_0x5cfc07[_0x0321('0x33')]);_0x31d74a['attributes']=_[_0x0321('0x36')](_0x5cfc07[_0x0321('0x35')],qs[_0x0321('0x37')](_0x568000[_0x0321('0x33')][_0x0321('0x37')]));_0x31d74a[_0x0321('0x38')]=_0x31d74a[_0x0321('0x38')]['length']?_0x31d74a['attributes']:_0x5cfc07[_0x0321('0x35')];if(!_0x568000[_0x0321('0x33')]['hasOwnProperty'](_0x0321('0x39'))){_0x31d74a['limit']=qs[_0x0321('0x20')](_0x568000[_0x0321('0x33')][_0x0321('0x20')]);_0x31d74a[_0x0321('0x1f')]=qs[_0x0321('0x1f')](_0x568000[_0x0321('0x33')][_0x0321('0x1f')]);}_0x31d74a['order']=qs[_0x0321('0x3a')](_0x568000[_0x0321('0x33')]['sort']);_0x31d74a[_0x0321('0x3b')]=qs[_0x0321('0x3c')](_['pick'](_0x568000[_0x0321('0x33')],_0x5cfc07[_0x0321('0x3c')]),_0x562526);if(_0x568000[_0x0321('0x33')][_0x0321('0x3d')]){_0x31d74a[_0x0321('0x3b')]=_[_0x0321('0x3e')](_0x31d74a[_0x0321('0x3b')],{'$or':_[_0x0321('0x2e')](_0x562526,function(_0x58ab35){if(_0x58ab35['type']!==_0x0321('0x3f')){var _0x18cb36={};_0x18cb36[_0x58ab35[_0x0321('0x2b')]]={'$like':'%'+_0x568000[_0x0321('0x33')]['filter']+'%'};return _0x18cb36;}})});}_0x31d74a=_[_0x0321('0x3e')]({},_0x31d74a,_0x568000[_0x0321('0x40')]);var _0x425878={'where':_0x31d74a[_0x0321('0x3b')]};return db[_0x0321('0x2f')][_0x0321('0x21')](_0x425878)[_0x0321('0x2a')](function(_0x5ddde3){_0xafba8c[_0x0321('0x21')]=_0x5ddde3;if(_0x568000[_0x0321('0x33')][_0x0321('0x41')]){_0x31d74a['include']=[{'all':!![]}];}return db[_0x0321('0x2f')][_0x0321('0x42')](_0x31d74a);})[_0x0321('0x2a')](function(_0x38ea19){_0xafba8c[_0x0321('0x43')]=_0x38ea19;return _0xafba8c;})[_0x0321('0x2a')](respondWithFilteredResult(_0x38fbd9,_0x31d74a))[_0x0321('0x44')](handleError(_0x38fbd9,null));};exports[_0x0321('0x45')]=function(_0x1068d2,_0x2b4fdc){var _0x23e130={'raw':!![],'where':{'id':_0x1068d2['params']['id']}},_0x47ce9a={};_0x47ce9a['model']=_['keys'](db[_0x0321('0x2f')]['rawAttributes']);_0x47ce9a[_0x0321('0x33')]=_[_0x0321('0x34')](_0x1068d2[_0x0321('0x33')]);_0x47ce9a[_0x0321('0x3c')]=_[_0x0321('0x36')](_0x47ce9a[_0x0321('0x35')],_0x47ce9a[_0x0321('0x33')]);_0x23e130[_0x0321('0x38')]=_['intersection'](_0x47ce9a[_0x0321('0x35')],qs[_0x0321('0x37')](_0x1068d2['query'][_0x0321('0x37')]));_0x23e130[_0x0321('0x38')]=_0x23e130[_0x0321('0x38')][_0x0321('0x46')]?_0x23e130[_0x0321('0x38')]:_0x47ce9a[_0x0321('0x35')];if(_0x1068d2[_0x0321('0x33')][_0x0321('0x41')]){_0x23e130['include']=[{'all':!![]}];}_0x23e130=_[_0x0321('0x3e')]({},_0x23e130,_0x1068d2['options']);return db[_0x0321('0x2f')][_0x0321('0x47')](_0x23e130)[_0x0321('0x2a')](handleEntityNotFound(_0x2b4fdc,null))[_0x0321('0x2a')](respondWithResult(_0x2b4fdc,null))['catch'](handleError(_0x2b4fdc,null));};exports[_0x0321('0x48')]=function(_0x28c896,_0x14c83f){return db[_0x0321('0x2f')]['create'](_0x28c896[_0x0321('0x49')],{})[_0x0321('0x2a')](function(_0x1bb088){var _0x5a1dc1=_0x28c896[_0x0321('0x4a')][_0x0321('0x28')]({'plain':!![]});if(!_0x5a1dc1)throw new Error(_0x0321('0x4b'));if(_0x5a1dc1[_0x0321('0x4c')]===_0x0321('0x4a')){var _0x2b69ca=_0x1bb088[_0x0321('0x28')]({'plain':!![]});var _0x422fd6=_0x0321('0x29');return db[_0x0321('0x4d')][_0x0321('0x47')]({'where':{'name':_0x422fd6,'userProfileId':_0x5a1dc1[_0x0321('0x4e')]},'raw':!![]})[_0x0321('0x2a')](function(_0xfbd183){if(_0xfbd183&&_0xfbd183['autoAssociation']===0x0){return db[_0x0321('0x4f')][_0x0321('0x48')]({'name':_0x2b69ca[_0x0321('0x2b')],'resourceId':_0x2b69ca['id'],'type':_0xfbd183[_0x0321('0x2b')],'sectionId':_0xfbd183['id']},{})[_0x0321('0x2a')](function(){return _0x1bb088;});}else{return _0x1bb088;}})['catch'](function(_0x267da3){logger['error'](_0x0321('0x50'),_0x267da3);throw _0x267da3;});}return _0x1bb088;})[_0x0321('0x2a')](respondWithResult(_0x14c83f,0xc9))[_0x0321('0x44')](handleError(_0x14c83f,null));};exports[_0x0321('0x26')]=function(_0x38a175,_0x55af3b){if(_0x38a175['body']['id']){delete _0x38a175[_0x0321('0x49')]['id'];}return db[_0x0321('0x2f')][_0x0321('0x47')]({'where':{'id':_0x38a175[_0x0321('0x51')]['id']}})[_0x0321('0x2a')](handleEntityNotFound(_0x55af3b,null))[_0x0321('0x2a')](saveUpdates(_0x38a175[_0x0321('0x49')],null))[_0x0321('0x2a')](respondWithResult(_0x55af3b,null))['catch'](handleError(_0x55af3b,null));};exports['destroy']=function(_0xb4e41d,_0x539d94){return db[_0x0321('0x2f')]['find']({'where':{'id':_0xb4e41d[_0x0321('0x51')]['id']}})[_0x0321('0x2a')](handleEntityNotFound(_0x539d94,null))['then'](removeEntity(_0x539d94,null))[_0x0321('0x44')](handleError(_0x539d94,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 94651ac..d97867e 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 _0x9779=['moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api'];(function(_0x5b00f9,_0x2b32e4){var _0x8041a4=function(_0x18419c){while(--_0x18419c){_0x5b00f9['push'](_0x5b00f9['shift']());}};_0x8041a4(++_0x2b32e4);}(_0x9779,0x1e6));var _0x9977=function(_0x3fa723,_0x59966a){_0x3fa723=_0x3fa723-0x0;var _0x395014=_0x9779[_0x3fa723];return _0x395014;};'use strict';var _=require(_0x9977('0x0'));var util=require(_0x9977('0x1'));var logger=require(_0x9977('0x2'))(_0x9977('0x3'));var moment=require(_0x9977('0x4'));var BPromise=require(_0x9977('0x5'));var rp=require(_0x9977('0x6'));var fs=require('fs');var path=require(_0x9977('0x7'));var rimraf=require('rimraf');var config=require(_0x9977('0x8'));var attributes=require(_0x9977('0x9'));module[_0x9977('0xa')]=function(_0x4a7fe4,_0x1edfa3){return _0x4a7fe4[_0x9977('0xb')](_0x9977('0xc'),attributes,{'tableName':_0x9977('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6311=['../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x192c48,_0x1dd16c){var _0x5c97ab=function(_0x2a6508){while(--_0x2a6508){_0x192c48['push'](_0x192c48['shift']());}};_0x5c97ab(++_0x1dd16c);}(_0x6311,0x1c6));var _0x1631=function(_0x2e6836,_0x123e76){_0x2e6836=_0x2e6836-0x0;var _0x4ab73d=_0x6311[_0x2e6836];return _0x4ab73d;};'use strict';var _=require(_0x1631('0x0'));var util=require(_0x1631('0x1'));var logger=require(_0x1631('0x2'))('api');var moment=require(_0x1631('0x3'));var BPromise=require(_0x1631('0x4'));var rp=require(_0x1631('0x5'));var fs=require('fs');var path=require(_0x1631('0x6'));var rimraf=require(_0x1631('0x7'));var config=require(_0x1631('0x8'));var attributes=require(_0x1631('0x9'));module[_0x1631('0xa')]=function(_0xdbd30,_0x2c7f7c){return _0xdbd30[_0x1631('0xb')](_0x1631('0xc'),attributes,{'tableName':_0x1631('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index f896a74..2f3850e 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x2ea14b,_0x3a2d8d){var _0x3236f2=function(_0x5da382){while(--_0x5da382){_0x2ea14b['push'](_0x2ea14b['shift']());}};_0x3236f2(++_0x3a2d8d);}(_0x814b,0x1a2));var _0xb814=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x814b[_0x3bd52b];return _0x1e5b89;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x450c09,_0x15c01a){var _0x51cbe3=function(_0x133bc2){while(--_0x133bc2){_0x450c09['push'](_0x450c09['shift']());}};_0x51cbe3(++_0x15c01a);}(_0xe14b,0x93));var _0xbe14=function(_0x1d7fdc,_0x2dc559){_0x1d7fdc=_0x1d7fdc-0x0;var _0x37a0a1=_0xe14b[_0x1d7fdc];return _0x37a0a1;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 14ef6e7..af879cf 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 _0xe604=['canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated'];(function(_0x18d081,_0x47e92e){var _0x1dbeb4=function(_0x15c2c5){while(--_0x15c2c5){_0x18d081['push'](_0x18d081['shift']());}};_0x1dbeb4(++_0x47e92e);}(_0xe604,0x106));var _0x4e60=function(_0x45ae48,_0x585e9c){_0x45ae48=_0x45ae48-0x0;var _0x39b5b0=_0xe604[_0x45ae48];return _0x39b5b0;};'use strict';var express=require(_0x4e60('0x0'));var router=express[_0x4e60('0x1')]();var auth=require(_0x4e60('0x2'));var controller=require(_0x4e60('0x3'));router[_0x4e60('0x4')]('/',controller[_0x4e60('0x5')]);router[_0x4e60('0x4')](_0x4e60('0x6'),auth[_0x4e60('0x7')](),auth[_0x4e60('0x8')](),controller[_0x4e60('0x9')]);router[_0x4e60('0x4')](_0x4e60('0xa'),auth[_0x4e60('0x7')](),auth[_0x4e60('0x8')](),controller[_0x4e60('0xb')]);router['get'](_0x4e60('0xc'),auth['isAuthenticated'](),auth[_0x4e60('0x8')](),controller[_0x4e60('0xd')]);router[_0x4e60('0x4')](_0x4e60('0xe'),auth[_0x4e60('0x7')](),controller[_0x4e60('0xf')]);router[_0x4e60('0x4')](_0x4e60('0x10'),controller['migrations']);module[_0x4e60('0x11')]=router; \ No newline at end of file +var _0x49eb=['/restart','/migrations','migrations','exports','Router','./version.controller','get','index','canUpdate','fetch','/reset','isAuthenticated','/pull'];(function(_0x3c78e7,_0x19a615){var _0x46c763=function(_0x5484a1){while(--_0x5484a1){_0x3c78e7['push'](_0x3c78e7['shift']());}};_0x46c763(++_0x19a615);}(_0x49eb,0x1cb));var _0xb49e=function(_0x32b129,_0x6071df){_0x32b129=_0x32b129-0x0;var _0x2dc8ff=_0x49eb[_0x32b129];return _0x2dc8ff;};'use strict';var express=require('express');var router=express[_0xb49e('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xb49e('0x1'));router[_0xb49e('0x2')]('/',controller[_0xb49e('0x3')]);router[_0xb49e('0x2')]('/fetch',auth['isAuthenticated'](),auth[_0xb49e('0x4')](),controller[_0xb49e('0x5')]);router[_0xb49e('0x2')](_0xb49e('0x6'),auth[_0xb49e('0x7')](),auth['canUpdate'](),controller['reset']);router[_0xb49e('0x2')](_0xb49e('0x8'),auth[_0xb49e('0x7')](),auth[_0xb49e('0x4')](),controller['pull']);router[_0xb49e('0x2')](_0xb49e('0x9'),auth['isAuthenticated'](),controller['restart']);router[_0xb49e('0x2')](_0xb49e('0xa'),controller[_0xb49e('0xb')]);module[_0xb49e('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 52f9039..57a364e 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 _0x3608=['pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','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','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process','exec','../../config/logger','simple-git','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x3608,0x14e));var _0x8360=function(_0x59314b,_0x2f0795){_0x59314b=_0x59314b-0x0;var _0x3a6413=_0x3608[_0x59314b];return _0x3a6413;};'use strict';var Umzug=require(_0x8360('0x0'));var path=require(_0x8360('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x8360('0x2'))(module,_0x8360('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x8360('0x4'))[_0x8360('0x5')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x8360('0x6'))('update');var git=require(_0x8360('0x7'))(config['root']);exports[_0x8360('0x8')]=function(_0x459357,_0x3cac50){var _0x525de7={'current':module[_0x8360('0x9')][_0x8360('0x3')],'phonebar':0x2};if(_0x459357[_0x8360('0xa')]&&_0x459357[_0x8360('0xa')][_0x8360('0xb')]){return git[_0x8360('0xc')]()['tags'](function(_0x32c33d,_0x553fbf){_0x525de7[_0x8360('0xb')]=(_0x32c33d?module[_0x8360('0x9')]['version']:_0x553fbf[_0x8360('0xb')])||_0x8360('0xd');return _0x3cac50[_0x8360('0xe')](0xc8)[_0x8360('0xf')](_0x525de7);});}else{return _0x3cac50[_0x8360('0xe')](0xc8)[_0x8360('0xf')](_0x525de7);}};exports[_0x8360('0xc')]=function(_0x51ec69,_0x48d809){return git[_0x8360('0xc')]([_0x8360('0x10'),_0x8360('0x11')],function(_0x2626c4){if(_0x2626c4){logger[_0x8360('0x12')](_0x2626c4);return _0x48d809['status'](0x1f4)[_0x8360('0xf')](_0x2626c4);}logger[_0x8360('0x13')]('git\x20fetch');return _0x48d809['status'](0xc8)[_0x8360('0xf')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x8360('0x14')]=function(_0x4a2376,_0x37c6b7){return git[_0x8360('0x14')]([_0x8360('0x15'),_0x8360('0x16')],function(_0x55b64b){if(_0x55b64b){logger['error'](_0x55b64b);return _0x37c6b7[_0x8360('0xe')](0x1f4)['json'](_0x55b64b);}logger['info'](_0x8360('0x17'));return _0x37c6b7[_0x8360('0xe')](0xc8)[_0x8360('0xf')]({'output':_0x8360('0x18')});});};exports[_0x8360('0x19')]=function(_0x1299c2,_0x2f975a){exec(_0x8360('0x1a'),function(_0x28057f,_0x177019,_0x1aeabc){logger[_0x8360('0x13')](_0x177019);logger[_0x8360('0x13')](_0x1aeabc);if(_0x28057f){logger['error'](_0x28057f);return _0x2f975a[_0x8360('0xe')](0x1f4)[_0x8360('0xf')](_0x28057f);}return _0x2f975a[_0x8360('0xe')](0xc8)['json']({'output':_0x177019});});};exports['restart']=function(_0x26087c,_0x987ef4){return pm2[_0x8360('0x1b')](_0x8360('0x1c'))[_0x8360('0x1d')](function(_0x2f604c){logger[_0x8360('0x13')](_0x8360('0x1e'),_0x2f604c);return _0x987ef4[_0x8360('0xe')](0xc8)[_0x8360('0xf')]({'output':_0x8360('0x1f')});})[_0x8360('0x20')](function(_0x36822f){logger[_0x8360('0x12')](_0x36822f);return _0x987ef4[_0x8360('0xe')](0x1f4)[_0x8360('0xf')](_0x36822f);});};exports[_0x8360('0x21')]=function(_0x37f0d1,_0x2461d8){var _0x49a956=fs[_0x8360('0x22')](path[_0x8360('0x23')](config[_0x8360('0x24')],_0x8360('0x25'),'migrations'));var _0x3faa34=[];for(var _0x15bd5d=0x0;_0x15bd5d<_0x49a956[_0x8360('0x26')];_0x15bd5d++){var _0x3ee2db=_0x49a956[_0x15bd5d][_0x8360('0x27')]('.js','');if(compareVersions(module[_0x8360('0x9')][_0x8360('0x3')],_0x3ee2db)===-0x1){_0x3faa34[_0x8360('0x28')](_0x3ee2db);}}if(_0x3faa34[_0x8360('0x26')]){var _0x2d05f3=_0x3faa34[_0x8360('0x29')](compareVersions);var _0x4f46ab=new Umzug({'storage':_0x8360('0x2a'),'storageOptions':{'model':db[_0x8360('0x2b')],'modelName':_0x8360('0x2b'),'columnName':_0x8360('0x3')},'migrations':{'params':[db[_0x8360('0x2a')][_0x8360('0x2c')](),db['sequelize'][_0x8360('0x2d')],function(){throw new Error(_0x8360('0x2e'));}],'path':path['join'](config[_0x8360('0x24')],_0x8360('0x25'),_0x8360('0x21')),'pattern':/\.js$/}});_0x4f46ab['up']({'migrations':_[_0x8360('0x2f')](_0x2d05f3,function(_0xce3ff6){return _0xce3ff6+_0x8360('0x30');})})['then'](function(){return _0x2461d8[_0x8360('0xe')](0xc8)['json']({'output':_0x8360('0x31')+module[_0x8360('0x9')][_0x8360('0x3')]+_0x8360('0x32')+_['last'](_0x2d05f3),'migrations':_[_0x8360('0x23')](_0x2d05f3)});})['catch'](function(_0x371b8d){if(_0x371b8d instanceof db[_0x8360('0x2a')]['UniqueConstraintError']){return _0x2461d8[_0x8360('0xe')](0xc8)['json']({'output':_0x8360('0x33')});}else{return _0x2461d8['status'](0x1f4)[_0x8360('0xf')](_0x371b8d);}});}else{return _0x2461d8[_0x8360('0xe')](0xc8)[_0x8360('0xf')]({'output':_0x8360('0x33')});}}; \ No newline at end of file +var _0xb2c5=['Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process','exec','../../mysqldb','../../config/pm2','update','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','origin','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','restart','motion2','catch','migrations','join','server','replace','push','length','sequelize','Migration','getQueryInterface','constructor'];(function(_0x3504a0,_0x3f770f){var _0x3dfca3=function(_0x5adf34){while(--_0x5adf34){_0x3504a0['push'](_0x3504a0['shift']());}};_0x3dfca3(++_0x3f770f);}(_0xb2c5,0x91));var _0x5b2c=function(_0x12f570,_0x2bdad1){_0x12f570=_0x12f570-0x0;var _0x820efc=_0xb2c5[_0x12f570];return _0x820efc;};'use strict';var Umzug=require(_0x5b2c('0x0'));var path=require(_0x5b2c('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x5b2c('0x2'))(module,_0x5b2c('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x5b2c('0x4'))[_0x5b2c('0x5')];var db=require(_0x5b2c('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x5b2c('0x7'));var logger=require('../../config/logger')(_0x5b2c('0x8'));var git=require('simple-git')(config[_0x5b2c('0x9')]);exports[_0x5b2c('0xa')]=function(_0x59fd1d,_0x524b5c){var _0x29a946={'current':module[_0x5b2c('0xb')][_0x5b2c('0x3')],'phonebar':0x2};if(_0x59fd1d[_0x5b2c('0xc')]&&_0x59fd1d[_0x5b2c('0xc')][_0x5b2c('0xd')]){return git['fetch']()[_0x5b2c('0xe')](function(_0x591603,_0x236d69){_0x29a946[_0x5b2c('0xd')]=(_0x591603?module[_0x5b2c('0xb')][_0x5b2c('0x3')]:_0x236d69[_0x5b2c('0xd')])||_0x5b2c('0xf');return _0x524b5c[_0x5b2c('0x10')](0xc8)[_0x5b2c('0x11')](_0x29a946);});}else{return _0x524b5c['status'](0xc8)[_0x5b2c('0x11')](_0x29a946);}};exports[_0x5b2c('0x12')]=function(_0x41bfa2,_0x518575){return git['fetch']([_0x5b2c('0x13'),'master'],function(_0x5d0acf){if(_0x5d0acf){logger[_0x5b2c('0x14')](_0x5d0acf);return _0x518575[_0x5b2c('0x10')](0x1f4)[_0x5b2c('0x11')](_0x5d0acf);}logger[_0x5b2c('0x15')]('git\x20fetch');return _0x518575['status'](0xc8)['json']({'output':_0x5b2c('0x16')});});};exports['reset']=function(_0x2719d0,_0x42f8b7){return git[_0x5b2c('0x17')]([_0x5b2c('0x18'),'FETCH_HEAD'],function(_0x1080f4){if(_0x1080f4){logger['error'](_0x1080f4);return _0x42f8b7[_0x5b2c('0x10')](0x1f4)[_0x5b2c('0x11')](_0x1080f4);}logger[_0x5b2c('0x15')](_0x5b2c('0x19'));return _0x42f8b7[_0x5b2c('0x10')](0xc8)[_0x5b2c('0x11')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x1d706e,_0x24c9f4){exec('npm\x20install\x20--production',function(_0x1d31a9,_0x5e437b,_0x5219da){logger[_0x5b2c('0x15')](_0x5e437b);logger['info'](_0x5219da);if(_0x1d31a9){logger[_0x5b2c('0x14')](_0x1d31a9);return _0x24c9f4[_0x5b2c('0x10')](0x1f4)[_0x5b2c('0x11')](_0x1d31a9);}return _0x24c9f4['status'](0xc8)['json']({'output':_0x5e437b});});};exports['restart']=function(_0x294a04,_0x128b9c){return pm2[_0x5b2c('0x1a')](_0x5b2c('0x1b'))['then'](function(_0x3f0967){logger['info']('pm2\x20restart\x20motion\x20%s',_0x3f0967);return _0x128b9c[_0x5b2c('0x10')](0xc8)[_0x5b2c('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x5b2c('0x1c')](function(_0x5ede79){logger[_0x5b2c('0x14')](_0x5ede79);return _0x128b9c['status'](0x1f4)['json'](_0x5ede79);});};exports[_0x5b2c('0x1d')]=function(_0x4c889a,_0x12ddcd){var _0x50561e=fs['readdirSync'](path[_0x5b2c('0x1e')](config['root'],_0x5b2c('0x1f'),'migrations'));var _0xb5095e=[];for(var _0x5c579c=0x0;_0x5c579c<_0x50561e['length'];_0x5c579c++){var _0x52d39e=_0x50561e[_0x5c579c][_0x5b2c('0x20')]('.js','');if(compareVersions(module[_0x5b2c('0xb')][_0x5b2c('0x3')],_0x52d39e)===-0x1){_0xb5095e[_0x5b2c('0x21')](_0x52d39e);}}if(_0xb5095e[_0x5b2c('0x22')]){var _0x46d67e=_0xb5095e['sort'](compareVersions);var _0x6aaee5=new Umzug({'storage':_0x5b2c('0x23'),'storageOptions':{'model':db[_0x5b2c('0x24')],'modelName':'Migration','columnName':_0x5b2c('0x3')},'migrations':{'params':[db['sequelize'][_0x5b2c('0x25')](),db[_0x5b2c('0x23')][_0x5b2c('0x26')],function(){throw new Error(_0x5b2c('0x27'));}],'path':path[_0x5b2c('0x1e')](config[_0x5b2c('0x9')],_0x5b2c('0x1f'),'migrations'),'pattern':/\.js$/}});_0x6aaee5['up']({'migrations':_[_0x5b2c('0x28')](_0x46d67e,function(_0x45fb49){return _0x45fb49+'.js';})})['then'](function(){return _0x12ddcd[_0x5b2c('0x10')](0xc8)[_0x5b2c('0x11')]({'output':_0x5b2c('0x29')+module['exports'][_0x5b2c('0x3')]+_0x5b2c('0x2a')+_[_0x5b2c('0x2b')](_0x46d67e),'migrations':_[_0x5b2c('0x1e')](_0x46d67e)});})[_0x5b2c('0x1c')](function(_0x4660ea){if(_0x4660ea instanceof db[_0x5b2c('0x23')][_0x5b2c('0x2c')]){return _0x12ddcd[_0x5b2c('0x10')](0xc8)['json']({'output':_0x5b2c('0x2d')});}else{return _0x12ddcd[_0x5b2c('0x10')](0x1f4)[_0x5b2c('0x11')](_0x4660ea);}});}else{return _0x12ddcd[_0x5b2c('0x10')](0xc8)[_0x5b2c('0x11')]({'output':_0x5b2c('0x2d')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1ad3d68..aeb01ab 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 _0x8a91=['../../components/auth/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x47529f,_0x6c7061){var _0x4505a9=function(_0x463eea){while(--_0x463eea){_0x47529f['push'](_0x47529f['shift']());}};_0x4505a9(++_0x6c7061);}(_0x8a91,0xb7));var _0x18a9=function(_0x251f37,_0x10e309){_0x251f37=_0x251f37-0x0;var _0x33e26f=_0x8a91[_0x251f37];return _0x33e26f;};'use strict';var multer=require(_0x18a9('0x0'));var util=require(_0x18a9('0x1'));var path=require(_0x18a9('0x2'));var timeout=require(_0x18a9('0x3'));var express=require(_0x18a9('0x4'));var router=express['Router']();var fs_extra=require(_0x18a9('0x5'));var auth=require(_0x18a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x18a9('0x7'));router[_0x18a9('0x8')]('/',auth[_0x18a9('0x9')](),controller[_0x18a9('0xa')]);router['get'](_0x18a9('0xb'),auth['isAuthenticated'](),controller[_0x18a9('0xc')]);router['get']('/:id',auth[_0x18a9('0x9')](),controller[_0x18a9('0xd')]);router[_0x18a9('0xe')]('/',auth[_0x18a9('0x9')](),controller[_0x18a9('0xf')]);router[_0x18a9('0x10')](_0x18a9('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x18a9('0x12')]('/:id',auth[_0x18a9('0x9')](),controller[_0x18a9('0x13')]);module[_0x18a9('0x14')]=router; \ No newline at end of file +var _0x1bdc=['create','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','index','isAuthenticated','describe','get','/:id','post'];(function(_0x4ecbe2,_0x21134b){var _0x5e564a=function(_0x3514d6){while(--_0x3514d6){_0x4ecbe2['push'](_0x4ecbe2['shift']());}};_0x5e564a(++_0x21134b);}(_0x1bdc,0x135));var _0xc1bd=function(_0x3488e0,_0x32ad11){_0x3488e0=_0x3488e0-0x0;var _0x3e1168=_0x1bdc[_0x3488e0];return _0x3e1168;};'use strict';var multer=require(_0xc1bd('0x0'));var util=require(_0xc1bd('0x1'));var path=require(_0xc1bd('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1bd('0x3'));var router=express[_0xc1bd('0x4')]();var fs_extra=require(_0xc1bd('0x5'));var auth=require(_0xc1bd('0x6'));var interaction=require(_0xc1bd('0x7'));var config=require('../../config/environment');var controller=require(_0xc1bd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1bd('0x9')]);router['get']('/describe',auth[_0xc1bd('0xa')](),controller[_0xc1bd('0xb')]);router[_0xc1bd('0xc')](_0xc1bd('0xd'),auth[_0xc1bd('0xa')](),controller['show']);router[_0xc1bd('0xe')]('/',auth[_0xc1bd('0xa')](),controller[_0xc1bd('0xf')]);router['put'](_0xc1bd('0xd'),auth[_0xc1bd('0xa')](),controller['update']);router[_0xc1bd('0x10')](_0xc1bd('0xd'),auth[_0xc1bd('0xa')](),controller['destroy']);module[_0xc1bd('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 123f95c..53318c9 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 _0xdc91=['INTEGER','sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xdc91,0x8b));var _0x1dc9=function(_0x1c2970,_0x5b0b36){_0x1c2970=_0x1c2970-0x0;var _0x40936a=_0xdc91[_0x1c2970];return _0x40936a;};'use strict';var Sequelize=require(_0x1dc9('0x0'));module[_0x1dc9('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1dc9('0x2')]},'interface':{'type':Sequelize[_0x1dc9('0x2')]},'membername':{'type':Sequelize[_0x1dc9('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1dc9('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1dc9('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x1dc9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x1dc9('0x3')]},'agentdumpAt':{'type':Sequelize[_0x1dc9('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1dc9('0x5')]},'agentacw':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1dc9('0x5')]},'reason':{'type':Sequelize[_0x1dc9('0x2')]},'lastevent':{'type':Sequelize[_0x1dc9('0x2')]},'channel':{'type':Sequelize[_0x1dc9('0x2')]},'channelstate':{'type':Sequelize[_0x1dc9('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1dc9('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1dc9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1dc9('0x2')]},'exten':{'type':Sequelize[_0x1dc9('0x2')]},'priority':{'type':Sequelize[_0x1dc9('0x2')]},'destchannel':{'type':Sequelize[_0x1dc9('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x1dc9('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1dc9('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x1dc9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1dc9('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1dc9('0x2')]},'destexten':{'type':Sequelize[_0x1dc9('0x2')]},'destpriority':{'type':Sequelize[_0x1dc9('0x2')]},'destuniqueid':{'type':Sequelize[_0x1dc9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1dc9('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1dc9('0x2')]},'transferuniqueid':{'type':Sequelize[_0x1dc9('0x2')]},'agententerreason':{'type':Sequelize[_0x1dc9('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xefe2=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefe2,0xd9));var _0x2efe=function(_0x439374,_0xd25aea){_0x439374=_0x439374-0x0;var _0x463626=_0xefe2[_0x439374];return _0x463626;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2efe('0x2')]},'calleridnum':{'type':Sequelize[_0x2efe('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2efe('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2efe('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2efe('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2efe('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x2efe('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2efe('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x2efe('0x4')]},'agentcomplete':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2efe('0x4')]},'reason':{'type':Sequelize[_0x2efe('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2efe('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2efe('0x2')]},'language':{'type':Sequelize[_0x2efe('0x2')]},'accountcode':{'type':Sequelize[_0x2efe('0x2')]},'context':{'type':Sequelize[_0x2efe('0x2')]},'exten':{'type':Sequelize[_0x2efe('0x2')]},'priority':{'type':Sequelize[_0x2efe('0x2')]},'destchannel':{'type':Sequelize[_0x2efe('0x2')]},'destchannelstate':{'type':Sequelize[_0x2efe('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2efe('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2efe('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2efe('0x2')]},'destlanguage':{'type':Sequelize[_0x2efe('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x2efe('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2efe('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2efe('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2efe('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2efe('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'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 ba959f6..c2e88fc 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(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 d575fd4..1722ddb 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 _0xbd50=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','VoiceAgentReport','report_agent','lodash'];(function(_0x66e6ba,_0x407437){var _0x12a6a2=function(_0x1e92e3){while(--_0x1e92e3){_0x66e6ba['push'](_0x66e6ba['shift']());}};_0x12a6a2(++_0x407437);}(_0xbd50,0x196));var _0x0bd5=function(_0x3667c4,_0x4b64bd){_0x3667c4=_0x3667c4-0x0;var _0x12a5a2=_0xbd50[_0x3667c4];return _0x12a5a2;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var logger=require(_0x0bd5('0x2'))('api');var moment=require(_0x0bd5('0x3'));var BPromise=require(_0x0bd5('0x4'));var rp=require(_0x0bd5('0x5'));var fs=require('fs');var path=require(_0x0bd5('0x6'));var rimraf=require(_0x0bd5('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x376024,_0x2ef1d0){return _0x376024[_0x0bd5('0x8')](_0x0bd5('0x9'),attributes,{'tableName':_0x0bd5('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3248=['VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceAgentReport.attributes','define'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x3248,0x1b0));var _0x8324=function(_0x4c84cd,_0x5856b4){_0x4c84cd=_0x4c84cd-0x0;var _0x1aaea3=_0x3248[_0x4c84cd];return _0x1aaea3;};'use strict';var _=require(_0x8324('0x0'));var util=require(_0x8324('0x1'));var logger=require(_0x8324('0x2'))(_0x8324('0x3'));var moment=require(_0x8324('0x4'));var BPromise=require(_0x8324('0x5'));var rp=require(_0x8324('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8324('0x7'));var attributes=require(_0x8324('0x8'));module['exports']=function(_0x18edd2,_0x283f5f){return _0x18edd2[_0x8324('0x9')](_0x8324('0xa'),attributes,{'tableName':_0x8324('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x8324('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ea112a3..b05c3b0 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 _0xf83e=['debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','then','UpdateVoiceAgentReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceAgentReport,\x20%s,\x20%s'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xf83e,0x1cd));var _0xef83=function(_0xf22dce,_0x46f799){_0xf22dce=_0xf22dce-0x0;var _0x55c4ba=_0xf83e[_0xf22dce];return _0x55c4ba;};'use strict';var _=require(_0xef83('0x0'));var util=require(_0xef83('0x1'));var moment=require(_0xef83('0x2'));var BPromise=require(_0xef83('0x3'));var rs=require(_0xef83('0x4'));var fs=require('fs');var Redis=require(_0xef83('0x5'));var db=require(_0xef83('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xef83('0x7'))(_0xef83('0x8'));var config=require(_0xef83('0x9'));var jayson=require(_0xef83('0xa'));var client=jayson['client'][_0xef83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a831b,_0x221d10,_0x575190){return new BPromise(function(_0x2f7851,_0x581b9f){return client[_0xef83('0xc')](_0x4a831b,_0x575190)['then'](function(_0x350e4f){logger[_0xef83('0xd')](_0xef83('0xe'),_0x221d10,'request\x20sent');logger[_0xef83('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x221d10,_0xef83('0x10'),JSON[_0xef83('0x11')](_0x350e4f));if(_0x350e4f[_0xef83('0x12')]){if(_0x350e4f[_0xef83('0x12')][_0xef83('0x13')]===0x1f4){logger[_0xef83('0x12')](_0xef83('0xe'),_0x221d10,_0x350e4f['error'][_0xef83('0x14')]);return _0x581b9f(_0x350e4f['error'][_0xef83('0x14')]);}logger[_0xef83('0x12')](_0xef83('0xe'),_0x221d10,_0x350e4f[_0xef83('0x12')][_0xef83('0x14')]);return _0x2f7851(_0x350e4f[_0xef83('0x12')][_0xef83('0x14')]);}else{logger[_0xef83('0xd')](_0xef83('0xe'),_0x221d10,_0xef83('0x10'));_0x2f7851(_0x350e4f[_0xef83('0x15')][_0xef83('0x14')]);}})[_0xef83('0x16')](function(_0x24c717){logger[_0xef83('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x221d10,_0x24c717);_0x581b9f(_0x24c717);});});}exports[_0xef83('0x17')]=function(_0x172680){var _0x372cf2=this;return new Promise(function(_0x5c9c87,_0x211c7b){return db[_0xef83('0x18')]['create'](_0x172680[_0xef83('0x19')],{'raw':_0x172680[_0xef83('0x1a')]?_0x172680['options']['raw']===undefined?!![]:![]:!![]})[_0xef83('0x1b')](function(_0x58f931){logger[_0xef83('0xd')](_0xef83('0x17'),_0x172680);logger[_0xef83('0xf')](_0xef83('0x17'),_0x172680,JSON[_0xef83('0x11')](_0x58f931));_0x5c9c87(_0x58f931);})[_0xef83('0x16')](function(_0x43ae88){logger[_0xef83('0x12')](_0xef83('0x17'),_0x43ae88['message'],_0x172680);_0x211c7b(_0x372cf2['error'](0x1f4,_0x43ae88[_0xef83('0x14')]));});});};exports[_0xef83('0x1c')]=function(_0x2e6ab2){var _0x125ba2=this;return new Promise(function(_0x1980df,_0x48ab20){return db[_0xef83('0x18')][_0xef83('0x1d')](_0x2e6ab2[_0xef83('0x19')],{'raw':_0x2e6ab2[_0xef83('0x1a')]?_0x2e6ab2[_0xef83('0x1a')][_0xef83('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6ab2['options']?_0x2e6ab2[_0xef83('0x1a')][_0xef83('0x1f')]||null:null,'attributes':_0x2e6ab2[_0xef83('0x1a')]?_0x2e6ab2[_0xef83('0x1a')][_0xef83('0x20')]||null:null,'limit':_0x2e6ab2[_0xef83('0x1a')]?_0x2e6ab2[_0xef83('0x1a')][_0xef83('0x21')]||null:null})[_0xef83('0x1b')](function(_0x28cc3b){logger[_0xef83('0xd')](_0xef83('0x1c'),_0x2e6ab2);logger['debug']('UpdateVoiceAgentReport',_0x2e6ab2,JSON[_0xef83('0x11')](_0x28cc3b));_0x1980df(_0x28cc3b);})['catch'](function(_0x101a58){logger[_0xef83('0x12')](_0xef83('0x1c'),_0x101a58[_0xef83('0x14')],_0x2e6ab2);_0x48ab20(_0x125ba2['error'](0x1f4,_0x101a58['message']));});});}; \ No newline at end of file +var _0x8f1f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','CreateVoiceAgentReport','create','body','options','stringify','catch','UpdateVoiceAgentReport','update','raw','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x8f1f,0x102));var _0xf8f1=function(_0x4f357d,_0x3dae2d){_0x4f357d=_0x4f357d-0x0;var _0x21af41=_0x8f1f[_0x4f357d];return _0x21af41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf8f1('0x0'));var BPromise=require(_0xf8f1('0x1'));var rs=require(_0xf8f1('0x2'));var fs=require('fs');var Redis=require(_0xf8f1('0x3'));var db=require(_0xf8f1('0x4'))['db'];var utils=require(_0xf8f1('0x5'));var logger=require(_0xf8f1('0x6'))(_0xf8f1('0x7'));var config=require(_0xf8f1('0x8'));var jayson=require(_0xf8f1('0x9'));var client=jayson[_0xf8f1('0xa')][_0xf8f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1efd7a,_0x139d43,_0x58d811){return new BPromise(function(_0x3ffe67,_0x161654){return client[_0xf8f1('0xc')](_0x1efd7a,_0x58d811)[_0xf8f1('0xd')](function(_0x4f5c89){logger[_0xf8f1('0xe')](_0xf8f1('0xf'),_0x139d43,'request\x20sent');logger[_0xf8f1('0x10')](_0xf8f1('0x11'),_0x139d43,_0xf8f1('0x12'),JSON['stringify'](_0x4f5c89));if(_0x4f5c89[_0xf8f1('0x13')]){if(_0x4f5c89['error']['code']===0x1f4){logger[_0xf8f1('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x139d43,_0x4f5c89[_0xf8f1('0x13')]['message']);return _0x161654(_0x4f5c89[_0xf8f1('0x13')][_0xf8f1('0x14')]);}logger[_0xf8f1('0x13')](_0xf8f1('0xf'),_0x139d43,_0x4f5c89[_0xf8f1('0x13')][_0xf8f1('0x14')]);return _0x3ffe67(_0x4f5c89['error'][_0xf8f1('0x14')]);}else{logger[_0xf8f1('0xe')](_0xf8f1('0xf'),_0x139d43,'request\x20sent');_0x3ffe67(_0x4f5c89[_0xf8f1('0x15')]['message']);}})['catch'](function(_0x2c5856){logger[_0xf8f1('0x13')](_0xf8f1('0xf'),_0x139d43,_0x2c5856);_0x161654(_0x2c5856);});});}exports[_0xf8f1('0x16')]=function(_0x4d248e){var _0x43736a=this;return new Promise(function(_0x2b2ea5,_0x3187c4){return db['VoiceAgentReport'][_0xf8f1('0x17')](_0x4d248e[_0xf8f1('0x18')],{'raw':_0x4d248e[_0xf8f1('0x19')]?_0x4d248e[_0xf8f1('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf8f1('0xd')](function(_0xd7870a){logger[_0xf8f1('0xe')]('CreateVoiceAgentReport',_0x4d248e);logger[_0xf8f1('0x10')]('CreateVoiceAgentReport',_0x4d248e,JSON[_0xf8f1('0x1a')](_0xd7870a));_0x2b2ea5(_0xd7870a);})[_0xf8f1('0x1b')](function(_0x359514){logger[_0xf8f1('0x13')]('CreateVoiceAgentReport',_0x359514[_0xf8f1('0x14')],_0x4d248e);_0x3187c4(_0x43736a[_0xf8f1('0x13')](0x1f4,_0x359514['message']));});});};exports[_0xf8f1('0x1c')]=function(_0x5cd617){var _0x529850=this;return new Promise(function(_0x2302a8,_0x16481a){return db['VoiceAgentReport'][_0xf8f1('0x1d')](_0x5cd617[_0xf8f1('0x18')],{'raw':_0x5cd617[_0xf8f1('0x19')]?_0x5cd617[_0xf8f1('0x19')][_0xf8f1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cd617[_0xf8f1('0x19')]?_0x5cd617['options'][_0xf8f1('0x1f')]||null:null,'attributes':_0x5cd617[_0xf8f1('0x19')]?_0x5cd617[_0xf8f1('0x19')]['attributes']||null:null,'limit':_0x5cd617[_0xf8f1('0x19')]?_0x5cd617[_0xf8f1('0x19')][_0xf8f1('0x20')]||null:null})[_0xf8f1('0xd')](function(_0x25a3fd){logger[_0xf8f1('0xe')]('UpdateVoiceAgentReport',_0x5cd617);logger['debug']('UpdateVoiceAgentReport',_0x5cd617,JSON[_0xf8f1('0x1a')](_0x25a3fd));_0x2302a8(_0x25a3fd);})[_0xf8f1('0x1b')](function(_0xad67d0){logger[_0xf8f1('0x13')]('UpdateVoiceAgentReport',_0xad67d0[_0xf8f1('0x14')],_0x5cd617);_0x16481a(_0x529850[_0xf8f1('0x13')](0x1f4,_0xad67d0[_0xf8f1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 1ee19e0..00d6be3 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 _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe'];(function(_0x2df0e1,_0x59d50c){var _0xd8d640=function(_0x519f35){while(--_0x519f35){_0x2df0e1['push'](_0x2df0e1['shift']());}};_0xd8d640(++_0x59d50c);}(_0xa630,0xbe));var _0x0a63=function(_0x3ade45,_0x5ea3a8){_0x3ade45=_0x3ade45-0x0;var _0x539c4c=_0xa630[_0x3ade45];return _0x539c4c;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file +var _0x6b8f=['destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x432bd3,_0x173894){var _0x4586d1=function(_0x49fe54){while(--_0x49fe54){_0x432bd3['push'](_0x432bd3['shift']());}};_0x4586d1(++_0x173894);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x1f071a,_0x381d61){_0x1f071a=_0x1f071a-0x0;var _0x525ed2=_0x6b8f[_0x1f071a];return _0x525ed2;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['describe']);router['get'](_0xf6b8('0xa'),auth['isAuthenticated'](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0xc')]('/',auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0xe')](_0xf6b8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf6b8('0xa'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f75c573..bb61d29 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 _0xc593=['sequelize','exports','inbound','internal','outbound','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0x5c4e59,_0x4119ac){var _0x58b87d=function(_0x407699){while(--_0x407699){_0x5c4e59['push'](_0x5c4e59['shift']());}};_0x58b87d(++_0x4119ac);}(_0xc593,0xfd));var _0x3c59=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc593[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x3c59('0x0'));module[_0x3c59('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x3c59('0x2'),_0x3c59('0x3'),_0x3c59('0x4'),'inbound-fax',_0x3c59('0x5'),_0x3c59('0x6'))},'tag':{'type':Sequelize[_0x3c59('0x7')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x3c59('0x7')]},'destination':{'type':Sequelize[_0x3c59('0x7')]},'destinationcontext':{'type':Sequelize[_0x3c59('0x7')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3c59('0x7')]},'destinationchannel':{'type':Sequelize[_0x3c59('0x7')]},'lastapplication':{'type':Sequelize[_0x3c59('0x7')]},'lastdata':{'type':Sequelize[_0x3c59('0x8')]},'starttime':{'type':Sequelize[_0x3c59('0x9')]},'systemanswertime':{'type':Sequelize[_0x3c59('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3c59('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x3c59('0xa')]},'mohtime':{'type':Sequelize[_0x3c59('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3c59('0x7')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x3c59('0x7')]},'userDisposition':{'type':Sequelize[_0x3c59('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x3c59('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x3c59('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x3c59('0xa')]},'sipcallid':{'type':Sequelize[_0x3c59('0x7')]}}; \ No newline at end of file +var _0xf7d9=['sequelize','exports','STRING','ENUM','outbound','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x4b4dcd,_0x15e1a7){var _0xfd3900=function(_0x1c136a){while(--_0x1c136a){_0x4b4dcd['push'](_0x4b4dcd['shift']());}};_0xfd3900(++_0x15e1a7);}(_0xf7d9,0x122));var _0x9f7d=function(_0x33a665,_0x1534e3){_0x33a665=_0x33a665-0x0;var _0x48841b=_0xf7d9[_0x33a665];return _0x48841b;};'use strict';var Sequelize=require(_0x9f7d('0x0'));module[_0x9f7d('0x1')]={'uniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'type':{'type':Sequelize[_0x9f7d('0x3')]('inbound','internal',_0x9f7d('0x4'),'inbound-fax',_0x9f7d('0x5'),_0x9f7d('0x6'))},'tag':{'type':Sequelize[_0x9f7d('0x2')]},'accountcode':{'type':Sequelize[_0x9f7d('0x2')]},'source':{'type':Sequelize[_0x9f7d('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9f7d('0x2')]},'channel':{'type':Sequelize[_0x9f7d('0x2')]},'destinationchannel':{'type':Sequelize[_0x9f7d('0x2')]},'lastapplication':{'type':Sequelize[_0x9f7d('0x2')]},'lastdata':{'type':Sequelize[_0x9f7d('0x7')]},'starttime':{'type':Sequelize[_0x9f7d('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9f7d('0x8')]},'endtime':{'type':Sequelize[_0x9f7d('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x9f7d('0x9')]},'mohtime':{'type':Sequelize[_0x9f7d('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9f7d('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9f7d('0x2')]},'userDisposition':{'type':Sequelize[_0x9f7d('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x9f7d('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x9f7d('0x2')]},'note':{'type':Sequelize[_0x9f7d('0x2')]},'prefix':{'type':Sequelize[_0x9f7d('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x9f7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 9f0290a..3cd7ebb 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0xadb5,0xad));var _0x5adb=function(_0x1ab434,_0xd8d5f2){_0x1ab434=_0x1ab434-0x0;var _0x39a7be=_0xadb5[_0x1ab434];return _0x39a7be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x3130ce,_0x436ef6){var _0x4022d0=function(_0x45973d){while(--_0x45973d){_0x3130ce['push'](_0x3130ce['shift']());}};_0x4022d0(++_0x436ef6);}(_0xdb28,0x106));var _0x8db2=function(_0x57463c,_0x37dc04){_0x57463c=_0x57463c-0x0;var _0x253254=_0xdb28[_0x57463c];return _0x253254;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 65da4cb..a12d11b 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 _0x50f0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api'];(function(_0x3cac55,_0x586499){var _0x3a598f=function(_0x61800){while(--_0x61800){_0x3cac55['push'](_0x3cac55['shift']());}};_0x3a598f(++_0x586499);}(_0x50f0,0x1cb));var _0x050f=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x50f0[_0x28e2cd];return _0x11fd46;};'use strict';var _=require(_0x050f('0x0'));var util=require(_0x050f('0x1'));var logger=require('../../config/logger')(_0x050f('0x2'));var moment=require(_0x050f('0x3'));var BPromise=require(_0x050f('0x4'));var rp=require(_0x050f('0x5'));var fs=require('fs');var path=require(_0x050f('0x6'));var rimraf=require(_0x050f('0x7'));var config=require(_0x050f('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0x050f('0x9')]=function(_0xed99e4,_0xdf8793){return _0xed99e4[_0x050f('0xa')](_0x050f('0xb'),attributes,{'tableName':_0x050f('0xc'),'paranoid':![],'indexes':[{'fields':[_0x050f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x550e=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','report_call'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x550e,0x9d));var _0xe550=function(_0x4e2c8a,_0x247ab8){_0x4e2c8a=_0x4e2c8a-0x0;var _0x45e320=_0x550e[_0x4e2c8a];return _0x45e320;};'use strict';var _=require(_0xe550('0x0'));var util=require(_0xe550('0x1'));var logger=require(_0xe550('0x2'))(_0xe550('0x3'));var moment=require('moment');var BPromise=require(_0xe550('0x4'));var rp=require(_0xe550('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe550('0x6'));var attributes=require(_0xe550('0x7'));module[_0xe550('0x8')]=function(_0x2674cb,_0x5f0d53){return _0x2674cb['define'](_0xe550('0x9'),attributes,{'tableName':_0xe550('0xa'),'paranoid':![],'indexes':[{'fields':[_0xe550('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c682b66..ad3d7e5 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 _0x1f7f=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x2585dd,_0x272265){var _0x373e8b=function(_0x1b0569){while(--_0x1b0569){_0x2585dd['push'](_0x2585dd['shift']());}};_0x373e8b(++_0x272265);}(_0x1f7f,0x17f));var _0xf1f7=function(_0x1dfef9,_0x2f9407){_0x1dfef9=_0x1dfef9-0x0;var _0x532254=_0x1f7f[_0x1dfef9];return _0x532254;};'use strict';var _=require(_0xf1f7('0x0'));var util=require(_0xf1f7('0x1'));var moment=require(_0xf1f7('0x2'));var BPromise=require(_0xf1f7('0x3'));var rs=require(_0xf1f7('0x4'));var fs=require('fs');var Redis=require(_0xf1f7('0x5'));var db=require(_0xf1f7('0x6'))['db'];var utils=require(_0xf1f7('0x7'));var logger=require('../../config/logger')(_0xf1f7('0x8'));var config=require(_0xf1f7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf1f7('0xa')][_0xf1f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe1181a,_0x74d260,_0x2f33fc){return new BPromise(function(_0x155c0d,_0x117fed){return client[_0xf1f7('0xc')](_0xe1181a,_0x2f33fc)[_0xf1f7('0xd')](function(_0x212925){logger[_0xf1f7('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x74d260,_0xf1f7('0xf'));logger[_0xf1f7('0x10')](_0xf1f7('0x11'),_0x74d260,_0xf1f7('0xf'),JSON[_0xf1f7('0x12')](_0x212925));if(_0x212925[_0xf1f7('0x13')]){if(_0x212925['error'][_0xf1f7('0x14')]===0x1f4){logger[_0xf1f7('0x13')](_0xf1f7('0x15'),_0x74d260,_0x212925['error']['message']);return _0x117fed(_0x212925[_0xf1f7('0x13')][_0xf1f7('0x16')]);}logger[_0xf1f7('0x13')](_0xf1f7('0x15'),_0x74d260,_0x212925[_0xf1f7('0x13')]['message']);return _0x155c0d(_0x212925['error'][_0xf1f7('0x16')]);}else{logger[_0xf1f7('0xe')](_0xf1f7('0x15'),_0x74d260,_0xf1f7('0xf'));_0x155c0d(_0x212925['result'][_0xf1f7('0x16')]);}})[_0xf1f7('0x17')](function(_0x1b2735){logger[_0xf1f7('0x13')](_0xf1f7('0x15'),_0x74d260,_0x1b2735);_0x117fed(_0x1b2735);});});}exports[_0xf1f7('0x18')]=function(_0x41e45b){var _0x56a8f1=this;return new Promise(function(_0x44f978,_0x513904){return db[_0xf1f7('0x19')][_0xf1f7('0x1a')]({'raw':_0x41e45b[_0xf1f7('0x1b')]?_0x41e45b[_0xf1f7('0x1b')][_0xf1f7('0x1c')]===undefined?!![]:![]:!![],'where':_0x41e45b[_0xf1f7('0x1b')]?_0x41e45b[_0xf1f7('0x1b')][_0xf1f7('0x1d')]||null:null,'attributes':_0x41e45b['options']?_0x41e45b['options'][_0xf1f7('0x1e')]||null:null,'limit':_0x41e45b['options']?_0x41e45b['options'][_0xf1f7('0x1f')]||null:null,'include':_0x41e45b[_0xf1f7('0x1b')]?_0x41e45b['options'][_0xf1f7('0x20')]?_['map'](_0x41e45b['options']['include'],function(_0x5a5b68){return{'model':db[_0x5a5b68[_0xf1f7('0x21')]],'as':_0x5a5b68['as'],'attributes':_0x5a5b68[_0xf1f7('0x1e')],'include':_0x5a5b68[_0xf1f7('0x20')]?_[_0xf1f7('0x22')](_0x5a5b68['include'],function(_0x2189a3){return{'model':db[_0x2189a3[_0xf1f7('0x21')]],'as':_0x2189a3['as'],'attributes':_0x2189a3['attributes'],'include':_0x2189a3[_0xf1f7('0x20')]?_['map'](_0x2189a3['include'],function(_0x182b34){return{'model':db[_0x182b34[_0xf1f7('0x21')]],'as':_0x182b34['as'],'attributes':_0x182b34[_0xf1f7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf1f7('0xd')](function(_0x363390){logger[_0xf1f7('0xe')]('GetVoiceCallReport',_0x41e45b);logger[_0xf1f7('0x10')](_0xf1f7('0x18'),_0x41e45b,JSON[_0xf1f7('0x12')](_0x363390));_0x44f978(_0x363390);})[_0xf1f7('0x17')](function(_0x26617b){logger[_0xf1f7('0x13')](_0xf1f7('0x18'),_0x26617b[_0xf1f7('0x16')],_0x41e45b);_0x513904(_0x56a8f1['error'](0x1f4,_0x26617b[_0xf1f7('0x16')]));});});};exports[_0xf1f7('0x23')]=function(_0xb2123e){var _0x25b122=this;return new Promise(function(_0x5d41df,_0x7a268f){return db[_0xf1f7('0x19')][_0xf1f7('0x24')](_0xb2123e[_0xf1f7('0x25')],{'raw':_0xb2123e['options']?_0xb2123e[_0xf1f7('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf1f7('0xd')](function(_0x47e731){logger[_0xf1f7('0xe')](_0xf1f7('0x23'),_0xb2123e);logger[_0xf1f7('0x10')](_0xf1f7('0x23'),_0xb2123e,JSON[_0xf1f7('0x12')](_0x47e731));_0x5d41df(_0x47e731);})[_0xf1f7('0x17')](function(_0x436a48){logger[_0xf1f7('0x13')](_0xf1f7('0x23'),_0x436a48[_0xf1f7('0x16')],_0xb2123e);_0x7a268f(_0x25b122[_0xf1f7('0x13')](0x1f4,_0x436a48[_0xf1f7('0x16')]));});});};exports[_0xf1f7('0x26')]=function(_0x4d669d){var _0x50779a=this;return new Promise(function(_0x18065d,_0x234ba9){return db[_0xf1f7('0x19')][_0xf1f7('0x27')](_0x4d669d[_0xf1f7('0x25')],{'raw':_0x4d669d[_0xf1f7('0x1b')]?_0x4d669d[_0xf1f7('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d669d[_0xf1f7('0x1b')]?_0x4d669d['options']['where']||null:null,'attributes':_0x4d669d[_0xf1f7('0x1b')]?_0x4d669d[_0xf1f7('0x1b')][_0xf1f7('0x1e')]||null:null,'limit':_0x4d669d[_0xf1f7('0x1b')]?_0x4d669d[_0xf1f7('0x1b')][_0xf1f7('0x1f')]||null:null})['then'](function(_0x5bcc7c){logger[_0xf1f7('0xe')]('UpdateVoiceCallReport',_0x4d669d);logger[_0xf1f7('0x10')](_0xf1f7('0x26'),_0x4d669d,JSON[_0xf1f7('0x12')](_0x5bcc7c));_0x18065d(_0x5bcc7c);})['catch'](function(_0x3e9826){logger[_0xf1f7('0x13')](_0xf1f7('0x26'),_0x3e9826[_0xf1f7('0x16')],_0x4d669d);_0x234ba9(_0x50779a[_0xf1f7('0x13')](0x1f4,_0x3e9826[_0xf1f7('0x16')]));});});}; \ No newline at end of file +var _0x6570=['VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','model','map','CreateVoiceCallReport','body','stringify','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x591f4b,_0xb6cec6){var _0x39a4bd=function(_0x3642f8){while(--_0x3642f8){_0x591f4b['push'](_0x591f4b['shift']());}};_0x39a4bd(++_0xb6cec6);}(_0x6570,0x158));var _0x0657=function(_0x1d3168,_0x43b8f9){_0x1d3168=_0x1d3168-0x0;var _0x497266=_0x6570[_0x1d3168];return _0x497266;};'use strict';var _=require(_0x0657('0x0'));var util=require(_0x0657('0x1'));var moment=require(_0x0657('0x2'));var BPromise=require(_0x0657('0x3'));var rs=require(_0x0657('0x4'));var fs=require('fs');var Redis=require(_0x0657('0x5'));var db=require(_0x0657('0x6'))['db'];var utils=require(_0x0657('0x7'));var logger=require(_0x0657('0x8'))(_0x0657('0x9'));var config=require(_0x0657('0xa'));var jayson=require(_0x0657('0xb'));var client=jayson['client'][_0x0657('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58fb0c,_0x1cdea3,_0x53b0e4){return new BPromise(function(_0x547fb7,_0x27de87){return client[_0x0657('0xd')](_0x58fb0c,_0x53b0e4)[_0x0657('0xe')](function(_0x271f4d){logger[_0x0657('0xf')](_0x0657('0x10'),_0x1cdea3,'request\x20sent');logger[_0x0657('0x11')](_0x0657('0x12'),_0x1cdea3,'request\x20sent',JSON['stringify'](_0x271f4d));if(_0x271f4d[_0x0657('0x13')]){if(_0x271f4d[_0x0657('0x13')][_0x0657('0x14')]===0x1f4){logger[_0x0657('0x13')](_0x0657('0x10'),_0x1cdea3,_0x271f4d[_0x0657('0x13')][_0x0657('0x15')]);return _0x27de87(_0x271f4d[_0x0657('0x13')][_0x0657('0x15')]);}logger['error'](_0x0657('0x10'),_0x1cdea3,_0x271f4d[_0x0657('0x13')][_0x0657('0x15')]);return _0x547fb7(_0x271f4d[_0x0657('0x13')][_0x0657('0x15')]);}else{logger[_0x0657('0xf')](_0x0657('0x10'),_0x1cdea3,_0x0657('0x16'));_0x547fb7(_0x271f4d[_0x0657('0x17')][_0x0657('0x15')]);}})[_0x0657('0x18')](function(_0x3af94b){logger[_0x0657('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x1cdea3,_0x3af94b);_0x27de87(_0x3af94b);});});}exports[_0x0657('0x19')]=function(_0x1f9ab8){var _0x15d75d=this;return new Promise(function(_0x2395b7,_0x39f749){return db[_0x0657('0x1a')]['findAll']({'raw':_0x1f9ab8['options']?_0x1f9ab8[_0x0657('0x1b')][_0x0657('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f9ab8[_0x0657('0x1b')]?_0x1f9ab8[_0x0657('0x1b')][_0x0657('0x1d')]||null:null,'attributes':_0x1f9ab8[_0x0657('0x1b')]?_0x1f9ab8[_0x0657('0x1b')][_0x0657('0x1e')]||null:null,'limit':_0x1f9ab8[_0x0657('0x1b')]?_0x1f9ab8[_0x0657('0x1b')][_0x0657('0x1f')]||null:null,'include':_0x1f9ab8[_0x0657('0x1b')]?_0x1f9ab8[_0x0657('0x1b')][_0x0657('0x20')]?_['map'](_0x1f9ab8[_0x0657('0x1b')]['include'],function(_0x312067){return{'model':db[_0x312067[_0x0657('0x21')]],'as':_0x312067['as'],'attributes':_0x312067[_0x0657('0x1e')],'include':_0x312067[_0x0657('0x20')]?_[_0x0657('0x22')](_0x312067[_0x0657('0x20')],function(_0x130430){return{'model':db[_0x130430[_0x0657('0x21')]],'as':_0x130430['as'],'attributes':_0x130430[_0x0657('0x1e')],'include':_0x130430[_0x0657('0x20')]?_[_0x0657('0x22')](_0x130430[_0x0657('0x20')],function(_0x2a9393){return{'model':db[_0x2a9393[_0x0657('0x21')]],'as':_0x2a9393['as'],'attributes':_0x2a9393['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27ae98){logger['info'](_0x0657('0x19'),_0x1f9ab8);logger[_0x0657('0x11')](_0x0657('0x19'),_0x1f9ab8,JSON['stringify'](_0x27ae98));_0x2395b7(_0x27ae98);})['catch'](function(_0x7a1bcc){logger[_0x0657('0x13')](_0x0657('0x19'),_0x7a1bcc['message'],_0x1f9ab8);_0x39f749(_0x15d75d[_0x0657('0x13')](0x1f4,_0x7a1bcc[_0x0657('0x15')]));});});};exports[_0x0657('0x23')]=function(_0x26c68a){var _0xbca07f=this;return new Promise(function(_0x5d99a9,_0x4868eb){return db[_0x0657('0x1a')]['create'](_0x26c68a[_0x0657('0x24')],{'raw':_0x26c68a['options']?_0x26c68a[_0x0657('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0657('0xe')](function(_0x174051){logger[_0x0657('0xf')](_0x0657('0x23'),_0x26c68a);logger[_0x0657('0x11')](_0x0657('0x23'),_0x26c68a,JSON[_0x0657('0x25')](_0x174051));_0x5d99a9(_0x174051);})['catch'](function(_0x48e780){logger[_0x0657('0x13')](_0x0657('0x23'),_0x48e780[_0x0657('0x15')],_0x26c68a);_0x4868eb(_0xbca07f[_0x0657('0x13')](0x1f4,_0x48e780[_0x0657('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x4821a3){var _0x3ad71a=this;return new Promise(function(_0x242b50,_0x599e49){return db[_0x0657('0x1a')][_0x0657('0x26')](_0x4821a3[_0x0657('0x24')],{'raw':_0x4821a3[_0x0657('0x1b')]?_0x4821a3[_0x0657('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4821a3[_0x0657('0x1b')]?_0x4821a3['options'][_0x0657('0x1d')]||null:null,'attributes':_0x4821a3[_0x0657('0x1b')]?_0x4821a3[_0x0657('0x1b')][_0x0657('0x1e')]||null:null,'limit':_0x4821a3[_0x0657('0x1b')]?_0x4821a3[_0x0657('0x1b')][_0x0657('0x1f')]||null:null})['then'](function(_0x15a916){logger[_0x0657('0xf')](_0x0657('0x27'),_0x4821a3);logger[_0x0657('0x11')]('UpdateVoiceCallReport',_0x4821a3,JSON['stringify'](_0x15a916));_0x242b50(_0x15a916);})[_0x0657('0x18')](function(_0x5bc91a){logger[_0x0657('0x13')](_0x0657('0x27'),_0x5bc91a[_0x0657('0x15')],_0x4821a3);_0x599e49(_0x3ad71a[_0x0657('0x13')](0x1f4,_0x5bc91a[_0x0657('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b10646f..a5cb29b 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 _0xf449=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0xf449,0x73));var _0x9f44=function(_0x31004c,_0x503c2e){_0x31004c=_0x31004c-0x0;var _0x399a98=_0xf449[_0x31004c];return _0x399a98;};'use strict';var multer=require(_0x9f44('0x0'));var util=require(_0x9f44('0x1'));var path=require('path');var timeout=require(_0x9f44('0x2'));var express=require(_0x9f44('0x3'));var router=express[_0x9f44('0x4')]();var fs_extra=require(_0x9f44('0x5'));var auth=require(_0x9f44('0x6'));var interaction=require(_0x9f44('0x7'));var config=require('../../config/environment');var controller=require(_0x9f44('0x8'));router[_0x9f44('0x9')]('/',auth[_0x9f44('0xa')](),controller[_0x9f44('0xb')]);router[_0x9f44('0x9')](_0x9f44('0xc'),auth[_0x9f44('0xa')](),controller[_0x9f44('0xd')]);router['post']('/',auth[_0x9f44('0xa')](),controller[_0x9f44('0xe')]);router[_0x9f44('0xf')]('/:id',auth[_0x9f44('0xa')](),controller[_0x9f44('0x10')]);router['delete']('/:id',auth[_0x9f44('0xa')](),controller[_0x9f44('0x11')]);module[_0x9f44('0x12')]=router; \ No newline at end of file +var _0x0c9d=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x316fa5,_0x3b39ce){var _0x4e32f8=function(_0x5f2537){while(--_0x5f2537){_0x316fa5['push'](_0x316fa5['shift']());}};_0x4e32f8(++_0x3b39ce);}(_0x0c9d,0x91));var _0xd0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd0c9('0x0'));var path=require(_0xd0c9('0x1'));var timeout=require(_0xd0c9('0x2'));var express=require(_0xd0c9('0x3'));var router=express[_0xd0c9('0x4')]();var fs_extra=require(_0xd0c9('0x5'));var auth=require(_0xd0c9('0x6'));var interaction=require(_0xd0c9('0x7'));var config=require('../../config/environment');var controller=require(_0xd0c9('0x8'));router[_0xd0c9('0x9')]('/',auth[_0xd0c9('0xa')](),controller[_0xd0c9('0xb')]);router[_0xd0c9('0x9')](_0xd0c9('0xc'),auth[_0xd0c9('0xa')](),controller[_0xd0c9('0xd')]);router['post']('/',auth[_0xd0c9('0xa')](),controller[_0xd0c9('0xe')]);router[_0xd0c9('0xf')]('/:id',auth[_0xd0c9('0xa')](),controller[_0xd0c9('0x10')]);router[_0xd0c9('0x11')](_0xd0c9('0xc'),auth[_0xd0c9('0xa')](),controller[_0xd0c9('0x12')]);module[_0xd0c9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 7bbba7b..33d66e6 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 _0x743b=['STRING','name','setDataValue','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0x5068cb,_0x372a2a){var _0x423559=function(_0x26a3e3){while(--_0x26a3e3){_0x5068cb['push'](_0x5068cb['shift']());}};_0x423559(++_0x372a2a);}(_0x743b,0xf7));var _0xb743=function(_0x111ac9,_0x5bd85d){_0x111ac9=_0x111ac9-0x0;var _0x12c620=_0x743b[_0x111ac9];return _0x12c620;};'use strict';var Sequelize=require(_0xb743('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xb743('0x1')],'unique':_0xb743('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xb743('0x1')],'set':function(_0xe3d427){this[_0xb743('0x3')]('options',_0xe3d427?_0xe3d427['join'](''):[]);},'get':function(){return this[_0xb743('0x4')](_0xb743('0x5'))?this[_0xb743('0x4')](_0xb743('0x5'))[_0xb743('0x6')](''):[];}},'auth':{'type':Sequelize[_0xb743('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xb743('0x1')]},'record':{'type':Sequelize[_0xb743('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb743('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x374b=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0xbd224f,_0x58f9b6){var _0x53bb3b=function(_0x58f675){while(--_0x58f675){_0xbd224f['push'](_0xbd224f['shift']());}};_0x53bb3b(++_0x58f9b6);}(_0x374b,0x12c));var _0xb374=function(_0x4a7593,_0x3e31a2){_0x4a7593=_0x4a7593-0x0;var _0x3e060a=_0x374b[_0x4a7593];return _0x3e060a;};'use strict';var Sequelize=require(_0xb374('0x0'));module[_0xb374('0x1')]={'name':{'type':Sequelize[_0xb374('0x2')]},'prefix':{'type':Sequelize[_0xb374('0x2')],'unique':_0xb374('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb374('0x2')],'set':function(_0x4d0e40){this[_0xb374('0x4')](_0xb374('0x5'),_0x4d0e40?_0x4d0e40['join'](''):[]);},'get':function(){return this[_0xb374('0x6')]('options')?this['getDataValue'](_0xb374('0x5'))[_0xb374('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xb374('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb374('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index bd281b7..caf4d9a 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 _0x8b7c=['stack','name','send','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','catch','show','params','rawAttributes','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','ChanSpies','UserProfileResource','sendStatus','error'];(function(_0x50f7e8,_0xe4a371){var _0x89f04b=function(_0x95e2f6){while(--_0x95e2f6){_0x50f7e8['push'](_0x50f7e8['shift']());}};_0x89f04b(++_0xe4a371);}(_0x8b7c,0x119));var _0xc8b7=function(_0x52660e,_0x4bae6b){_0x52660e=_0x52660e-0x0;var _0x2fd1a3=_0x8b7c[_0x52660e];return _0x2fd1a3;};'use strict';var emlformat=require(_0xc8b7('0x0'));var rimraf=require(_0xc8b7('0x1'));var zipdir=require(_0xc8b7('0x2'));var jsonpatch=require(_0xc8b7('0x3'));var rp=require(_0xc8b7('0x4'));var moment=require(_0xc8b7('0x5'));var BPromise=require(_0xc8b7('0x6'));var Mustache=require(_0xc8b7('0x7'));var util=require('util');var path=require(_0xc8b7('0x8'));var sox=require(_0xc8b7('0x9'));var csv=require(_0xc8b7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8b7('0xb'));var _=require(_0xc8b7('0xc'));var squel=require(_0xc8b7('0xd'));var crypto=require(_0xc8b7('0xe'));var jsforce=require(_0xc8b7('0xf'));var deskjs=require(_0xc8b7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc8b7('0x11'));var Papa=require('papaparse');var Redis=require(_0xc8b7('0x12'));var authService=require(_0xc8b7('0x13'));var qs=require(_0xc8b7('0x14'));var as=require(_0xc8b7('0x15'));var hardwareService=require(_0xc8b7('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc8b7('0x17'));var licenseUtil=require(_0xc8b7('0x18'));var db=require(_0xc8b7('0x19'))['db'];function respondWithStatusCode(_0x21ec4f,_0x5063ad){_0x5063ad=_0x5063ad||0xcc;return function(_0x5495e9){if(_0x5495e9){return _0x21ec4f['sendStatus'](_0x5063ad);}return _0x21ec4f[_0xc8b7('0x1a')](_0x5063ad)[_0xc8b7('0x1b')]();};}function respondWithResult(_0x38da92,_0x5c6e5b){_0x5c6e5b=_0x5c6e5b||0xc8;return function(_0x19d3ea){if(_0x19d3ea){return _0x38da92[_0xc8b7('0x1a')](_0x5c6e5b)[_0xc8b7('0x1c')](_0x19d3ea);}};}function respondWithFilteredResult(_0x1b7dc0,_0x3d189e){return function(_0x5d412e){if(_0x5d412e){var _0xb53183=typeof _0x3d189e[_0xc8b7('0x1d')]===_0xc8b7('0x1e')&&typeof _0x3d189e[_0xc8b7('0x1f')]===_0xc8b7('0x1e');var _0x186dbd=_0x5d412e[_0xc8b7('0x20')];var _0x485415=_0xb53183?0x0:_0x3d189e['offset'];var _0x1cf47c=_0xb53183?_0x5d412e[_0xc8b7('0x20')]:_0x3d189e[_0xc8b7('0x1d')]+_0x3d189e['limit'];var _0x5df9f7;if(_0x1cf47c>=_0x186dbd){_0x1cf47c=_0x186dbd;_0x5df9f7=0xc8;}else{_0x5df9f7=0xce;}_0x1b7dc0[_0xc8b7('0x1a')](_0x5df9f7);return _0x1b7dc0['set'](_0xc8b7('0x21'),_0x485415+'-'+_0x1cf47c+'/'+_0x186dbd)['json'](_0x5d412e);}return null;};}function patchUpdates(_0x462cce){return function(_0x3b39a3){try{jsonpatch['apply'](_0x3b39a3,_0x462cce,!![]);}catch(_0x298e69){return BPromise['reject'](_0x298e69);}return _0x3b39a3[_0xc8b7('0x22')]();};}function saveUpdates(_0x431163,_0x456eea){return function(_0x5e11cd){if(_0x5e11cd){return _0x5e11cd[_0xc8b7('0x23')](_0x431163)[_0xc8b7('0x24')](function(_0x4065d9){return _0x4065d9;});}return null;};}function removeEntity(_0x5b28ad,_0x3b0e47){return function(_0x191c12){if(_0x191c12){return _0x191c12[_0xc8b7('0x25')]()[_0xc8b7('0x24')](function(){var _0x2335cc=_0x191c12[_0xc8b7('0x26')]({'plain':!![]});var _0x2acda2=_0xc8b7('0x27');return db[_0xc8b7('0x28')][_0xc8b7('0x25')]({'where':{'type':_0x2acda2,'resourceId':_0x2335cc['id']}})[_0xc8b7('0x24')](function(){return _0x191c12;});})['then'](function(){_0x5b28ad[_0xc8b7('0x1a')](0xcc)[_0xc8b7('0x1b')]();});}};}function handleEntityNotFound(_0x3a9ce2,_0x3f92bd){return function(_0x2046f5){if(!_0x2046f5){_0x3a9ce2[_0xc8b7('0x29')](0x194);}return _0x2046f5;};}function handleError(_0x5629ce,_0x48682b){_0x48682b=_0x48682b||0x1f4;return function(_0x16cc83){logger[_0xc8b7('0x2a')](_0x16cc83[_0xc8b7('0x2b')]);if(_0x16cc83[_0xc8b7('0x2c')]){delete _0x16cc83[_0xc8b7('0x2c')];}_0x5629ce[_0xc8b7('0x1a')](_0x48682b)[_0xc8b7('0x2d')](_0x16cc83);};}exports['index']=function(_0x3a9658,_0x3d6f00){var _0x13000d={},_0x118574={},_0x27f4b7={'count':0x0,'rows':[]};var _0x340af1=_[_0xc8b7('0x2e')](db[_0xc8b7('0x2f')]['rawAttributes'],function(_0x247388){return{'name':_0x247388[_0xc8b7('0x30')],'type':_0x247388[_0xc8b7('0x31')][_0xc8b7('0x32')]};});_0x118574[_0xc8b7('0x33')]=_[_0xc8b7('0x2e')](_0x340af1,_0xc8b7('0x2c'));_0x118574[_0xc8b7('0x34')]=_[_0xc8b7('0x35')](_0x3a9658[_0xc8b7('0x34')]);_0x118574[_0xc8b7('0x36')]=_[_0xc8b7('0x37')](_0x118574[_0xc8b7('0x33')],_0x118574['query']);_0x13000d['attributes']=_[_0xc8b7('0x37')](_0x118574['model'],qs[_0xc8b7('0x38')](_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x38')]));_0x13000d[_0xc8b7('0x39')]=_0x13000d[_0xc8b7('0x39')]['length']?_0x13000d[_0xc8b7('0x39')]:_0x118574['model'];if(!_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x3a')](_0xc8b7('0x3b'))){_0x13000d[_0xc8b7('0x1f')]=qs[_0xc8b7('0x1f')](_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x1f')]);_0x13000d[_0xc8b7('0x1d')]=qs[_0xc8b7('0x1d')](_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x1d')]);}_0x13000d[_0xc8b7('0x3c')]=qs[_0xc8b7('0x3d')](_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x3d')]);_0x13000d[_0xc8b7('0x3e')]=qs['filters'](_[_0xc8b7('0x3f')](_0x3a9658[_0xc8b7('0x34')],_0x118574[_0xc8b7('0x36')]),_0x340af1);if(_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x40')]){_0x13000d[_0xc8b7('0x3e')]=_['merge'](_0x13000d[_0xc8b7('0x3e')],{'$or':_[_0xc8b7('0x2e')](_0x340af1,function(_0x1d208b){if(_0x1d208b[_0xc8b7('0x31')]!=='VIRTUAL'){var _0x5ae9a2={};_0x5ae9a2[_0x1d208b[_0xc8b7('0x2c')]]={'$like':'%'+_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x40')]+'%'};return _0x5ae9a2;}})});}_0x13000d=_['merge']({},_0x13000d,_0x3a9658['options']);var _0xec344f={'where':_0x13000d[_0xc8b7('0x3e')]};return db[_0xc8b7('0x2f')][_0xc8b7('0x20')](_0xec344f)[_0xc8b7('0x24')](function(_0x3ab722){_0x27f4b7[_0xc8b7('0x20')]=_0x3ab722;if(_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x41')]){_0x13000d[_0xc8b7('0x42')]=[{'all':!![]}];}return db[_0xc8b7('0x2f')]['findAll'](_0x13000d);})[_0xc8b7('0x24')](function(_0x3d86af){_0x27f4b7['rows']=_0x3d86af;return _0x27f4b7;})['then'](respondWithFilteredResult(_0x3d6f00,_0x13000d))[_0xc8b7('0x43')](handleError(_0x3d6f00,null));};exports[_0xc8b7('0x44')]=function(_0x507326,_0x3aa261){var _0x10a4ff={'raw':![],'where':{'id':_0x507326[_0xc8b7('0x45')]['id']}},_0x768ade={};_0x768ade[_0xc8b7('0x33')]=_[_0xc8b7('0x35')](db[_0xc8b7('0x2f')][_0xc8b7('0x46')]);_0x768ade[_0xc8b7('0x34')]=_[_0xc8b7('0x35')](_0x507326[_0xc8b7('0x34')]);_0x768ade['filters']=_['intersection'](_0x768ade[_0xc8b7('0x33')],_0x768ade['query']);_0x10a4ff[_0xc8b7('0x39')]=_[_0xc8b7('0x37')](_0x768ade[_0xc8b7('0x33')],qs[_0xc8b7('0x38')](_0x507326[_0xc8b7('0x34')][_0xc8b7('0x38')]));_0x10a4ff[_0xc8b7('0x39')]=_0x10a4ff['attributes'][_0xc8b7('0x47')]?_0x10a4ff[_0xc8b7('0x39')]:_0x768ade[_0xc8b7('0x33')];if(_0x507326[_0xc8b7('0x34')][_0xc8b7('0x41')]){_0x10a4ff[_0xc8b7('0x42')]=[{'all':!![]}];}_0x10a4ff=_[_0xc8b7('0x48')]({},_0x10a4ff,_0x507326[_0xc8b7('0x49')]);return db[_0xc8b7('0x2f')][_0xc8b7('0x4a')](_0x10a4ff)[_0xc8b7('0x24')](handleEntityNotFound(_0x3aa261,null))[_0xc8b7('0x24')](respondWithResult(_0x3aa261,null))[_0xc8b7('0x43')](handleError(_0x3aa261,null));};exports[_0xc8b7('0x4b')]=function(_0x493681,_0x3bd1c8){return db[_0xc8b7('0x2f')][_0xc8b7('0x4b')](_0x493681[_0xc8b7('0x4c')],{})[_0xc8b7('0x24')](function(_0x4aa959){var _0xe38e6=_0x493681[_0xc8b7('0x4d')]['get']({'plain':!![]});if(!_0xe38e6)throw new Error(_0xc8b7('0x4e'));if(_0xe38e6[_0xc8b7('0x4f')]===_0xc8b7('0x4d')){var _0x7941a1=_0x4aa959[_0xc8b7('0x26')]({'plain':!![]});var _0x34ee57='ChanSpies';return db[_0xc8b7('0x50')][_0xc8b7('0x4a')]({'where':{'name':_0x34ee57,'userProfileId':_0xe38e6['userProfileId']},'raw':!![]})[_0xc8b7('0x24')](function(_0x34d9bd){if(_0x34d9bd&&_0x34d9bd['autoAssociation']===0x0){return db['UserProfileResource'][_0xc8b7('0x4b')]({'name':_0x7941a1['name'],'resourceId':_0x7941a1['id'],'type':_0x34d9bd['name'],'sectionId':_0x34d9bd['id']},{})[_0xc8b7('0x24')](function(){return _0x4aa959;});}else{return _0x4aa959;}})[_0xc8b7('0x43')](function(_0xbbf03b){logger[_0xc8b7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbbf03b);throw _0xbbf03b;});}return _0x4aa959;})[_0xc8b7('0x24')](respondWithResult(_0x3bd1c8,0xc9))[_0xc8b7('0x43')](handleError(_0x3bd1c8,null));};exports[_0xc8b7('0x23')]=function(_0x2ece25,_0x525b64){if(_0x2ece25[_0xc8b7('0x4c')]['id']){delete _0x2ece25[_0xc8b7('0x4c')]['id'];}return db[_0xc8b7('0x2f')]['find']({'where':{'id':_0x2ece25[_0xc8b7('0x45')]['id']}})[_0xc8b7('0x24')](handleEntityNotFound(_0x525b64,null))['then'](saveUpdates(_0x2ece25[_0xc8b7('0x4c')],null))[_0xc8b7('0x24')](respondWithResult(_0x525b64,null))['catch'](handleError(_0x525b64,null));};exports[_0xc8b7('0x25')]=function(_0x264aac,_0x33769d){return db[_0xc8b7('0x2f')]['find']({'where':{'id':_0x264aac['params']['id']}})[_0xc8b7('0x24')](handleEntityNotFound(_0x33769d,null))[_0xc8b7('0x24')](removeEntity(_0x33769d,null))[_0xc8b7('0x43')](handleError(_0x33769d,null));}; \ No newline at end of file +var _0x57f8=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','error','name','send','index','map','VoiceChanSpy','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','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','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x44d6a7,_0x1a0f8a){var _0x1ee52a=function(_0x437f26){while(--_0x437f26){_0x44d6a7['push'](_0x44d6a7['shift']());}};_0x1ee52a(++_0x1a0f8a);}(_0x57f8,0x198));var _0x857f=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x57f8[_0x43a5c7];return _0x3b12a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){var _0x44ff23=_0x3bc543[_0x857f('0x29')]({'plain':!![]});var _0x3b23a7=_0x857f('0x2a');return db[_0x857f('0x2b')][_0x857f('0x27')]({'where':{'type':_0x3b23a7,'resourceId':_0x44ff23['id']}})[_0x857f('0x28')](function(){return _0x3bc543;});})[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x46761e,_0x570905){return function(_0x17e415){if(!_0x17e415){_0x46761e[_0x857f('0x1b')](0x194);}return _0x17e415;};}function handleError(_0x23afb8,_0x2c5792){_0x2c5792=_0x2c5792||0x1f4;return function(_0x58c2de){logger[_0x857f('0x2c')](_0x58c2de['stack']);if(_0x58c2de[_0x857f('0x2d')]){delete _0x58c2de[_0x857f('0x2d')];}_0x23afb8[_0x857f('0x1c')](_0x2c5792)[_0x857f('0x2e')](_0x58c2de);};}exports[_0x857f('0x2f')]=function(_0x464e8f,_0x1c4fff){var _0xe79241={},_0x17e7b6={},_0x41f832={'count':0x0,'rows':[]};var _0x24adc2=_[_0x857f('0x30')](db[_0x857f('0x31')]['rawAttributes'],function(_0x3078cf){return{'name':_0x3078cf[_0x857f('0x32')],'type':_0x3078cf['type'][_0x857f('0x33')]};});_0x17e7b6[_0x857f('0x34')]=_['map'](_0x24adc2,_0x857f('0x2d'));_0x17e7b6[_0x857f('0x35')]=_['keys'](_0x464e8f[_0x857f('0x35')]);_0x17e7b6[_0x857f('0x36')]=_[_0x857f('0x37')](_0x17e7b6[_0x857f('0x34')],_0x17e7b6['query']);_0xe79241['attributes']=_[_0x857f('0x37')](_0x17e7b6[_0x857f('0x34')],qs['fields'](_0x464e8f[_0x857f('0x35')]['fields']));_0xe79241[_0x857f('0x38')]=_0xe79241[_0x857f('0x38')][_0x857f('0x39')]?_0xe79241[_0x857f('0x38')]:_0x17e7b6[_0x857f('0x34')];if(!_0x464e8f['query']['hasOwnProperty'](_0x857f('0x3a'))){_0xe79241['limit']=qs[_0x857f('0x21')](_0x464e8f[_0x857f('0x35')][_0x857f('0x21')]);_0xe79241['offset']=qs[_0x857f('0x1f')](_0x464e8f[_0x857f('0x35')][_0x857f('0x1f')]);}_0xe79241[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x464e8f[_0x857f('0x35')][_0x857f('0x3c')]);_0xe79241['where']=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x464e8f[_0x857f('0x35')],_0x17e7b6[_0x857f('0x36')]),_0x24adc2);if(_0x464e8f[_0x857f('0x35')][_0x857f('0x3e')]){_0xe79241[_0x857f('0x3f')]=_['merge'](_0xe79241[_0x857f('0x3f')],{'$or':_[_0x857f('0x30')](_0x24adc2,function(_0xcd5959){if(_0xcd5959[_0x857f('0x40')]!==_0x857f('0x41')){var _0x1c119f={};_0x1c119f[_0xcd5959['name']]={'$like':'%'+_0x464e8f[_0x857f('0x35')][_0x857f('0x3e')]+'%'};return _0x1c119f;}})});}_0xe79241=_[_0x857f('0x42')]({},_0xe79241,_0x464e8f[_0x857f('0x43')]);var _0x3938ee={'where':_0xe79241[_0x857f('0x3f')]};return db[_0x857f('0x31')][_0x857f('0x22')](_0x3938ee)['then'](function(_0x40fb37){_0x41f832[_0x857f('0x22')]=_0x40fb37;if(_0x464e8f[_0x857f('0x35')][_0x857f('0x44')]){_0xe79241[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x31')][_0x857f('0x46')](_0xe79241);})[_0x857f('0x28')](function(_0xb4d7c2){_0x41f832[_0x857f('0x47')]=_0xb4d7c2;return _0x41f832;})[_0x857f('0x28')](respondWithFilteredResult(_0x1c4fff,_0xe79241))[_0x857f('0x48')](handleError(_0x1c4fff,null));};exports[_0x857f('0x49')]=function(_0x376f71,_0x5d4c2a){var _0xe0e078={'raw':![],'where':{'id':_0x376f71[_0x857f('0x4a')]['id']}},_0x5b2baa={};_0x5b2baa[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x31')][_0x857f('0x4c')]);_0x5b2baa[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x376f71[_0x857f('0x35')]);_0x5b2baa[_0x857f('0x36')]=_[_0x857f('0x37')](_0x5b2baa[_0x857f('0x34')],_0x5b2baa['query']);_0xe0e078['attributes']=_[_0x857f('0x37')](_0x5b2baa['model'],qs[_0x857f('0x4d')](_0x376f71['query'][_0x857f('0x4d')]));_0xe0e078[_0x857f('0x38')]=_0xe0e078[_0x857f('0x38')][_0x857f('0x39')]?_0xe0e078[_0x857f('0x38')]:_0x5b2baa[_0x857f('0x34')];if(_0x376f71[_0x857f('0x35')][_0x857f('0x44')]){_0xe0e078['include']=[{'all':!![]}];}_0xe0e078=_[_0x857f('0x42')]({},_0xe0e078,_0x376f71[_0x857f('0x43')]);return db[_0x857f('0x31')][_0x857f('0x4e')](_0xe0e078)['then'](handleEntityNotFound(_0x5d4c2a,null))[_0x857f('0x28')](respondWithResult(_0x5d4c2a,null))[_0x857f('0x48')](handleError(_0x5d4c2a,null));};exports[_0x857f('0x4f')]=function(_0x736ef6,_0x67563){return db['VoiceChanSpy'][_0x857f('0x4f')](_0x736ef6[_0x857f('0x50')],{})['then'](function(_0xfd1679){var _0x847879=_0x736ef6['user'][_0x857f('0x29')]({'plain':!![]});if(!_0x847879)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x847879[_0x857f('0x51')]===_0x857f('0x52')){var _0x446fe9=_0xfd1679[_0x857f('0x29')]({'plain':!![]});var _0x58bf27=_0x857f('0x2a');return db[_0x857f('0x53')][_0x857f('0x4e')]({'where':{'name':_0x58bf27,'userProfileId':_0x847879[_0x857f('0x54')]},'raw':!![]})[_0x857f('0x28')](function(_0x4f9d24){if(_0x4f9d24&&_0x4f9d24[_0x857f('0x55')]===0x0){return db[_0x857f('0x2b')][_0x857f('0x4f')]({'name':_0x446fe9[_0x857f('0x2d')],'resourceId':_0x446fe9['id'],'type':_0x4f9d24[_0x857f('0x2d')],'sectionId':_0x4f9d24['id']},{})[_0x857f('0x28')](function(){return _0xfd1679;});}else{return _0xfd1679;}})[_0x857f('0x48')](function(_0x59164a){logger[_0x857f('0x2c')](_0x857f('0x56'),_0x59164a);throw _0x59164a;});}return _0xfd1679;})[_0x857f('0x28')](respondWithResult(_0x67563,0xc9))[_0x857f('0x48')](handleError(_0x67563,null));};exports[_0x857f('0x26')]=function(_0x153e4e,_0x4bb5fc){if(_0x153e4e[_0x857f('0x50')]['id']){delete _0x153e4e[_0x857f('0x50')]['id'];}return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x153e4e[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x4bb5fc,null))[_0x857f('0x28')](saveUpdates(_0x153e4e[_0x857f('0x50')],null))['then'](respondWithResult(_0x4bb5fc,null))['catch'](handleError(_0x4bb5fc,null));};exports[_0x857f('0x27')]=function(_0x477653,_0x14b2ff){return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x477653[_0x857f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x14b2ff,null))[_0x857f('0x28')](removeEntity(_0x14b2ff,null))[_0x857f('0x48')](handleError(_0x14b2ff,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5937a5b..9191c34 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 _0xb413=['catch','destroy','lodash','bluebird','context','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','exports','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate'];(function(_0x10c4ed,_0x1c501c){var _0xa29467=function(_0x48da7f){while(--_0x48da7f){_0x10c4ed['push'](_0x10c4ed['shift']());}};_0xa29467(++_0x1c501c);}(_0xb413,0x178));var _0x3b41=function(_0x255737,_0x86f390){_0x255737=_0x255737-0x0;var _0x80deee=_0xb413[_0x255737];return _0x80deee;};'use strict';var _=require(_0x3b41('0x0'));var util=require('util');var BPromise=require(_0x3b41('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x308e50,_0x41c944,_0x24272d){var _0x2f1035=0x1;var _0x22459c=[];var _0x7844d9={'context':_0x41c944[_0x3b41('0x2')]||'from-sip','exten':util[_0x3b41('0x3')](_0x3b41('0x4'),_0x308e50[_0x3b41('0x5')],_0x24272d),'type':'system','isApp':![],'ChanSpyId':_0x308e50['id'],'UserId':_0x41c944['id']};_0x22459c[_0x3b41('0x6')](_[_0x3b41('0x7')]({'app':_0x3b41('0x8'),'appdata':util['format'](_0x3b41('0x9'),'chanspy'),'priority':_0x2f1035++},_0x7844d9));if(_0x308e50[_0x3b41('0xa')]){_0x22459c[_0x3b41('0x6')](_['merge']({'app':_0x3b41('0xb'),'appdata':util[_0x3b41('0x3')](_0x3b41('0xc'),_0x308e50['recordingFormat']),'priority':_0x2f1035++},_0x7844d9));}if(_0x308e50[_0x3b41('0xd')]){_0x22459c[_0x3b41('0x6')](_['merge']({'app':'Authenticate','appdata':_0x308e50[_0x3b41('0xe')],'priority':_0x2f1035++},_0x7844d9));}_0x22459c[_0x3b41('0x6')](_['merge']({'app':_0x3b41('0xf'),'appdata':util['format'](_0x3b41('0x10'),_0x41c944[_0x3b41('0x11')],_0x308e50[_0x3b41('0x12')]?_0x308e50[_0x3b41('0x12')][_0x3b41('0x13')](''):''),'priority':_0x2f1035++},_0x7844d9));if(_0x308e50['record']){_0x22459c[_0x3b41('0x6')](_[_0x3b41('0x7')]({'app':'StopMixMonitor','priority':_0x2f1035++},_0x7844d9));}return _0x22459c;};var getChanSpyApplications=function(_0x12d88b,_0x4fb826){var _0x45204f=[];for(var _0x4e0a64=0x0,_0x43aad6=0x1;_0x4e0a64<_0x4fb826[_0x3b41('0x14')];_0x4e0a64++,_0x43aad6=0x1){_0x45204f=_0x45204f[_0x3b41('0x15')](getUserApplications(_0x12d88b,_0x4fb826[_0x4e0a64],_0x4fb826[_0x4e0a64][_0x3b41('0x16')]));if(_0x4fb826[_0x4e0a64][_0x3b41('0x16')]!=_0x4fb826[_0x4e0a64][_0x3b41('0x11')]){_0x45204f=_0x45204f[_0x3b41('0x15')](getUserApplications(_0x12d88b,_0x4fb826[_0x4e0a64],_0x4fb826[_0x4e0a64][_0x3b41('0x11')]));}}return _0x45204f;};var getChanSpyPromise=function(_0x39a0a3,_0x28c882){return new BPromise(function(_0x53bda4,_0x2ad415){return _0x39a0a3[_0x3b41('0x17')][_0x3b41('0x18')]({'attributes':['id',_0x3b41('0x11'),_0x3b41('0x16')],'where':{'role':_0x3b41('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x57622c){if(_0x57622c){return _0x53bda4(getChanSpyApplications(_0x28c882,_0x57622c));}return _0x53bda4([]);})['catch'](function(_0x22cba8){_0x2ad415(_0x22cba8);});});};module[_0x3b41('0x1a')]=function(_0x1f0fd8,_0x426549){var _0x3e3a6f=_0x1f0fd8['models'];return _0x1f0fd8['define'](_0x3b41('0x1b'),attributes,{'tableName':_0x3b41('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x56fe8a,_0x12530c,_0x551d4b){return getChanSpyPromise(_0x3e3a6f,_0x56fe8a)[_0x3b41('0x1d')](function(_0x143ada){if(_0x143ada&&_0x143ada[_0x3b41('0x14')]){return _0x3e3a6f[_0x3b41('0x1e')][_0x3b41('0x1f')](_0x143ada);}})[_0x3b41('0x1d')](function(){_0x551d4b();})[_0x3b41('0x20')](function(_0x382808){_0x551d4b(_0x382808);});},'afterUpdate':function(_0x59ee2b,_0x1538cf,_0x40e8c1){return _0x3e3a6f[_0x3b41('0x1e')][_0x3b41('0x21')]({'where':{'ChanSpyId':_0x59ee2b['id']}})[_0x3b41('0x1d')](function(){return getChanSpyPromise(_0x3e3a6f,_0x59ee2b);})['then'](function(_0x50a392){if(_0x50a392&&_0x50a392[_0x3b41('0x14')]){return _0x3e3a6f[_0x3b41('0x1e')][_0x3b41('0x1f')](_0x50a392);}})[_0x3b41('0x1d')](function(){_0x40e8c1();})[_0x3b41('0x20')](function(_0x432c39){_0x40e8c1(_0x432c39);});},'afterDestroy':function(_0x10f784,_0x26e9fb,_0x4f8075){return _0x3e3a6f[_0x3b41('0x1e')]['destroy']({'where':{'ChanSpyId':_0x10f784['id']}})[_0x3b41('0x1d')](function(){_0x4f8075();})['catch'](function(_0x14ce34){_0x4f8075(_0x14ce34);});}}});}; \ No newline at end of file +var _0xdbbf=['chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','merge','Set','CDR(type)=%s'];(function(_0x2c1025,_0x144e80){var _0x5531d6=function(_0x2b0050){while(--_0x2b0050){_0x2c1025['push'](_0x2c1025['shift']());}};_0x5531d6(++_0x144e80);}(_0xdbbf,0x1c8));var _0xfdbb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xdbbf[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xfdbb('0x0'));var util=require(_0xfdbb('0x1'));var BPromise=require(_0xfdbb('0x2'));var attributes=require(_0xfdbb('0x3'));var getUserApplications=function(_0x1c419e,_0x4a046d,_0x343cb3){var _0x18f2f5=0x1;var _0x35f0a3=[];var _0x4bdd42={'context':_0x4a046d[_0xfdbb('0x4')]||_0xfdbb('0x5'),'exten':util[_0xfdbb('0x6')](_0xfdbb('0x7'),_0x1c419e['prefix'],_0x343cb3),'type':_0xfdbb('0x8'),'isApp':![],'ChanSpyId':_0x1c419e['id'],'UserId':_0x4a046d['id']};_0x35f0a3['push'](_[_0xfdbb('0x9')]({'app':_0xfdbb('0xa'),'appdata':util[_0xfdbb('0x6')](_0xfdbb('0xb'),_0xfdbb('0xc')),'priority':_0x18f2f5++},_0x4bdd42));if(_0x1c419e[_0xfdbb('0xd')]){_0x35f0a3[_0xfdbb('0xe')](_['merge']({'app':_0xfdbb('0xf'),'appdata':util[_0xfdbb('0x6')](_0xfdbb('0x10'),_0x1c419e[_0xfdbb('0x11')]),'priority':_0x18f2f5++},_0x4bdd42));}if(_0x1c419e[_0xfdbb('0x12')]){_0x35f0a3[_0xfdbb('0xe')](_[_0xfdbb('0x9')]({'app':_0xfdbb('0x13'),'appdata':_0x1c419e['password'],'priority':_0x18f2f5++},_0x4bdd42));}_0x35f0a3['push'](_[_0xfdbb('0x9')]({'app':_0xfdbb('0x14'),'appdata':util[_0xfdbb('0x6')]('SIP/%s,%s',_0x4a046d[_0xfdbb('0x15')],_0x1c419e['options']?_0x1c419e[_0xfdbb('0x16')][_0xfdbb('0x17')](''):''),'priority':_0x18f2f5++},_0x4bdd42));if(_0x1c419e[_0xfdbb('0xd')]){_0x35f0a3['push'](_[_0xfdbb('0x9')]({'app':_0xfdbb('0x18'),'priority':_0x18f2f5++},_0x4bdd42));}return _0x35f0a3;};var getChanSpyApplications=function(_0x154c43,_0x5b5b43){var _0xdfc36b=[];for(var _0x3eb3cd=0x0,_0x14a198=0x1;_0x3eb3cd<_0x5b5b43[_0xfdbb('0x19')];_0x3eb3cd++,_0x14a198=0x1){_0xdfc36b=_0xdfc36b['concat'](getUserApplications(_0x154c43,_0x5b5b43[_0x3eb3cd],_0x5b5b43[_0x3eb3cd]['internal']));if(_0x5b5b43[_0x3eb3cd][_0xfdbb('0x1a')]!=_0x5b5b43[_0x3eb3cd][_0xfdbb('0x15')]){_0xdfc36b=_0xdfc36b[_0xfdbb('0x1b')](getUserApplications(_0x154c43,_0x5b5b43[_0x3eb3cd],_0x5b5b43[_0x3eb3cd][_0xfdbb('0x15')]));}}return _0xdfc36b;};var getChanSpyPromise=function(_0x51190e,_0x243c9f){return new BPromise(function(_0x6d3cd9,_0x2b2476){return _0x51190e[_0xfdbb('0x1c')][_0xfdbb('0x1d')]({'attributes':['id',_0xfdbb('0x15'),_0xfdbb('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xfdbb('0x1e')](function(_0x18cb7b){if(_0x18cb7b){return _0x6d3cd9(getChanSpyApplications(_0x243c9f,_0x18cb7b));}return _0x6d3cd9([]);})[_0xfdbb('0x1f')](function(_0x5c181c){_0x2b2476(_0x5c181c);});});};module[_0xfdbb('0x20')]=function(_0x473dbb,_0x102019){var _0x2230d3=_0x473dbb['models'];return _0x473dbb[_0xfdbb('0x21')](_0xfdbb('0x22'),attributes,{'tableName':_0xfdbb('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bbed3,_0xc51c12,_0x5194d2){return getChanSpyPromise(_0x2230d3,_0x2bbed3)[_0xfdbb('0x1e')](function(_0x2b0507){if(_0x2b0507&&_0x2b0507[_0xfdbb('0x19')]){return _0x2230d3[_0xfdbb('0x24')]['bulkCreate'](_0x2b0507);}})[_0xfdbb('0x1e')](function(){_0x5194d2();})[_0xfdbb('0x1f')](function(_0x1a74a0){_0x5194d2(_0x1a74a0);});},'afterUpdate':function(_0x1af168,_0x1a09dc,_0x2a6865){return _0x2230d3['VoiceExtension'][_0xfdbb('0x25')]({'where':{'ChanSpyId':_0x1af168['id']}})[_0xfdbb('0x1e')](function(){return getChanSpyPromise(_0x2230d3,_0x1af168);})[_0xfdbb('0x1e')](function(_0x1ced37){if(_0x1ced37&&_0x1ced37[_0xfdbb('0x19')]){return _0x2230d3[_0xfdbb('0x24')][_0xfdbb('0x26')](_0x1ced37);}})['then'](function(){_0x2a6865();})[_0xfdbb('0x1f')](function(_0x59b1df){_0x2a6865(_0x59b1df);});},'afterDestroy':function(_0xc96c58,_0x26c285,_0xfe8ee4){return _0x2230d3['VoiceExtension'][_0xfdbb('0x25')]({'where':{'ChanSpyId':_0xc96c58['id']}})[_0xfdbb('0x1e')](function(){_0xfe8ee4();})[_0xfdbb('0x1f')](function(_0x34d27b){_0xfe8ee4(_0x34d27b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1304b26..4c831de 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 _0x0713=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1f39d5,_0x3fa93c){var _0xcf8861=function(_0x130cff){while(--_0x130cff){_0x1f39d5['push'](_0x1f39d5['shift']());}};_0xcf8861(++_0x3fa93c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xec56=['http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xec56,0x1bd));var _0x6ec5=function(_0x3dcaf3,_0x473191){_0x3dcaf3=_0x3dcaf3-0x0;var _0x12d576=_0xec56[_0x3dcaf3];return _0x12d576;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ec5('0x1'));var rs=require(_0x6ec5('0x2'));var fs=require('fs');var Redis=require(_0x6ec5('0x3'));var db=require(_0x6ec5('0x4'))['db'];var utils=require(_0x6ec5('0x5'));var logger=require(_0x6ec5('0x6'))(_0x6ec5('0x7'));var config=require(_0x6ec5('0x8'));var jayson=require(_0x6ec5('0x9'));var client=jayson[_0x6ec5('0xa')][_0x6ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb683,_0x35be4e,_0x1f59cd){return new BPromise(function(_0x3dd891,_0x225d2f){return client[_0x6ec5('0xc')](_0x3bb683,_0x1f59cd)[_0x6ec5('0xd')](function(_0x3ff17c){logger['info'](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));logger[_0x6ec5('0x10')](_0x6ec5('0x11'),_0x35be4e,_0x6ec5('0xf'),JSON[_0x6ec5('0x12')](_0x3ff17c));if(_0x3ff17c[_0x6ec5('0x13')]){if(_0x3ff17c['error'][_0x6ec5('0x14')]===0x1f4){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);return _0x225d2f(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}logger[_0x6ec5('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x35be4e,_0x3ff17c[_0x6ec5('0x13')]['message']);return _0x3dd891(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}else{logger[_0x6ec5('0x16')](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));_0x3dd891(_0x3ff17c['result'][_0x6ec5('0x15')]);}})[_0x6ec5('0x17')](function(_0x125ae6){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x125ae6);_0x225d2f(_0x125ae6);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 00ef17d..b9cff5a 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 _0x79f1=['fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','express','Router'];(function(_0x1983dc,_0x21194c){var _0x1d64e4=function(_0x5c8f02){while(--_0x5c8f02){_0x1983dc['push'](_0x1983dc['shift']());}};_0x1d64e4(++_0x21194c);}(_0x79f1,0xf8));var _0x179f=function(_0x12fcbd,_0x884804){_0x12fcbd=_0x12fcbd-0x0;var _0x28ec2a=_0x79f1[_0x12fcbd];return _0x28ec2a;};'use strict';var multer=require(_0x179f('0x0'));var util=require(_0x179f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x179f('0x2'));var router=express[_0x179f('0x3')]();var fs_extra=require(_0x179f('0x4'));var auth=require(_0x179f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x179f('0x6'));var controller=require(_0x179f('0x7'));router[_0x179f('0x8')]('/',auth[_0x179f('0x9')](),controller[_0x179f('0xa')]);router[_0x179f('0x8')](_0x179f('0xb'),auth[_0x179f('0x9')](),controller[_0x179f('0xc')]);router[_0x179f('0xd')]('/',auth[_0x179f('0x9')](),controller[_0x179f('0xe')]);router['put'](_0x179f('0xb'),auth[_0x179f('0x9')](),controller[_0x179f('0xf')]);router[_0x179f('0x10')](_0x179f('0xb'),auth[_0x179f('0x9')](),controller[_0x179f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9cc9=['express','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','show','put','/:id','update','delete','destroy','exports','path','connect-timeout'];(function(_0x3d75c0,_0x5af245){var _0x57bf02=function(_0x5658b1){while(--_0x5658b1){_0x3d75c0['push'](_0x3d75c0['shift']());}};_0x57bf02(++_0x5af245);}(_0x9cc9,0xb9));var _0x99cc=function(_0x36b6e4,_0x5bcfd0){_0x36b6e4=_0x36b6e4-0x0;var _0x376c80=_0x9cc9[_0x36b6e4];return _0x376c80;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x99cc('0x0'));var timeout=require(_0x99cc('0x1'));var express=require(_0x99cc('0x2'));var router=express['Router']();var fs_extra=require(_0x99cc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x99cc('0x4'));var config=require(_0x99cc('0x5'));var controller=require(_0x99cc('0x6'));router['get']('/',auth[_0x99cc('0x7')](),controller[_0x99cc('0x8')]);router[_0x99cc('0x9')]('/:id',auth[_0x99cc('0x7')](),controller[_0x99cc('0xa')]);router['post']('/',auth[_0x99cc('0x7')](),controller['create']);router[_0x99cc('0xb')](_0x99cc('0xc'),auth[_0x99cc('0x7')](),controller[_0x99cc('0xd')]);router[_0x99cc('0xe')]('/:id',auth[_0x99cc('0x7')](),controller[_0x99cc('0xf')]);module[_0x99cc('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 62d8872..2b51ece 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 _0xf24e=['BOOLEAN','STRING'];(function(_0xf069c8,_0x185662){var _0x545d14=function(_0x1edcad){while(--_0x1edcad){_0xf069c8['push'](_0xf069c8['shift']());}};_0x545d14(++_0x185662);}(_0xf24e,0x129));var _0xef24=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0xf24e[_0xb66df];return _0x42a702;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xef24('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xef24('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe1e4=['BOOLEAN','sequelize','exports','name','STRING'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0xe1e4,0x79));var _0x4e1e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe1e4[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x4e1e('0x0'));module[_0x4e1e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4e1e('0x2')},'description':{'type':Sequelize[_0x4e1e('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4e1e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 912724c..3d440e6 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 _0x2b26=['query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','intersection','find','create','join','root','utf8','render','writeFileSync','Reload','chan_sip.so','role','user','UserProfileSection','autoAssociation','UserProfileResource','readFileSync','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','sendStatus','stack','name','index','VoiceContext','type','key','model','map'];(function(_0x589f05,_0x1c5a16){var _0x3a11b4=function(_0x1ec7fb){while(--_0x1ec7fb){_0x589f05['push'](_0x589f05['shift']());}};_0x3a11b4(++_0x1c5a16);}(_0x2b26,0x91));var _0x62b2=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x2b26[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x62b2('0x0'));var rimraf=require(_0x62b2('0x1'));var zipdir=require(_0x62b2('0x2'));var jsonpatch=require(_0x62b2('0x3'));var rp=require(_0x62b2('0x4'));var moment=require(_0x62b2('0x5'));var BPromise=require(_0x62b2('0x6'));var Mustache=require(_0x62b2('0x7'));var util=require(_0x62b2('0x8'));var path=require('path');var sox=require(_0x62b2('0x9'));var csv=require(_0x62b2('0xa'));var ejs=require(_0x62b2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62b2('0xc'));var squel=require(_0x62b2('0xd'));var crypto=require(_0x62b2('0xe'));var jsforce=require(_0x62b2('0xf'));var deskjs=require(_0x62b2('0x10'));var toCsv=require(_0x62b2('0xa'));var querystring=require(_0x62b2('0x11'));var Papa=require(_0x62b2('0x12'));var Redis=require(_0x62b2('0x13'));var authService=require(_0x62b2('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62b2('0x15'));var logger=require(_0x62b2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x62b2('0x17'));var licenseUtil=require(_0x62b2('0x18'));var db=require(_0x62b2('0x19'))['db'];var jayson=require(_0x62b2('0x1a'));var client=jayson[_0x62b2('0x1b')][_0x62b2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x9eca5f,_0x4c82b2,_0x1d0c9b,_0x486dd7){return new BPromise(function(_0x1c02c5,_0x102dfc){var _0x1c1366=_0x486dd7||client;return _0x1c1366[_0x62b2('0x1d')](_0x9eca5f,_0x1d0c9b)['then'](function(_0x3d6bce){logger[_0x62b2('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x4c82b2,_0x62b2('0x1f'));logger[_0x62b2('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4c82b2,_0x62b2('0x1f'),JSON[_0x62b2('0x21')](_0x3d6bce));if(_0x3d6bce['error']){if(_0x3d6bce[_0x62b2('0x22')][_0x62b2('0x23')]===0x1f4){logger['error'](_0x62b2('0x24'),_0x4c82b2,_0x3d6bce[_0x62b2('0x22')]['message']);return _0x102dfc(_0x3d6bce['error']['message']);}logger['error'](_0x62b2('0x24'),_0x4c82b2,_0x3d6bce['error'][_0x62b2('0x25')]);return _0x1c02c5(_0x3d6bce[_0x62b2('0x22')][_0x62b2('0x25')]);}else{logger[_0x62b2('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x4c82b2,_0x62b2('0x1f'));_0x1c02c5(_0x3d6bce['result']['message']);}})[_0x62b2('0x26')](function(_0x2b07d5){logger[_0x62b2('0x22')](_0x62b2('0x24'),_0x4c82b2,_0x2b07d5);_0x102dfc(_0x2b07d5);});});}function respondWithStatusCode(_0xf48b7a,_0x57d0bf){_0x57d0bf=_0x57d0bf||0xcc;return function(_0x26db99){if(_0x26db99){return _0xf48b7a['sendStatus'](_0x57d0bf);}return _0xf48b7a[_0x62b2('0x27')](_0x57d0bf)[_0x62b2('0x28')]();};}function respondWithResult(_0x4fab79,_0x2b6c8d){_0x2b6c8d=_0x2b6c8d||0xc8;return function(_0x24d681){if(_0x24d681){return _0x4fab79[_0x62b2('0x27')](_0x2b6c8d)[_0x62b2('0x29')](_0x24d681);}};}function respondWithFilteredResult(_0x4becff,_0x47e5cf){return function(_0x1699b0){if(_0x1699b0){var _0x485fdc=typeof _0x47e5cf['offset']==='undefined'&&typeof _0x47e5cf[_0x62b2('0x2a')]===_0x62b2('0x2b');var _0x3293dc=_0x1699b0[_0x62b2('0x2c')];var _0x50459d=_0x485fdc?0x0:_0x47e5cf[_0x62b2('0x2d')];var _0x33a399=_0x485fdc?_0x1699b0[_0x62b2('0x2c')]:_0x47e5cf[_0x62b2('0x2d')]+_0x47e5cf['limit'];var _0x290565;if(_0x33a399>=_0x3293dc){_0x33a399=_0x3293dc;_0x290565=0xc8;}else{_0x290565=0xce;}_0x4becff[_0x62b2('0x27')](_0x290565);return _0x4becff[_0x62b2('0x2e')](_0x62b2('0x2f'),_0x50459d+'-'+_0x33a399+'/'+_0x3293dc)[_0x62b2('0x29')](_0x1699b0);}return null;};}function patchUpdates(_0xed83d4){return function(_0x2745ea){try{jsonpatch[_0x62b2('0x30')](_0x2745ea,_0xed83d4,!![]);}catch(_0x456773){return BPromise[_0x62b2('0x31')](_0x456773);}return _0x2745ea[_0x62b2('0x32')]();};}function saveUpdates(_0x1006e2,_0x4c067a){return function(_0x36cdf7){if(_0x36cdf7){return _0x36cdf7[_0x62b2('0x33')](_0x1006e2)[_0x62b2('0x34')](function(_0x43f72a){return _0x43f72a;});}return null;};}function removeEntity(_0x7573f0,_0x5f45ca){return function(_0xdc8fe3){if(_0xdc8fe3){return _0xdc8fe3[_0x62b2('0x35')]()[_0x62b2('0x34')](function(){var _0x4da3ca=_0xdc8fe3[_0x62b2('0x36')]({'plain':!![]});var _0xda51e4=_0x62b2('0x37');return db['UserProfileResource'][_0x62b2('0x35')]({'where':{'type':_0xda51e4,'resourceId':_0x4da3ca['id']}})[_0x62b2('0x34')](function(){return _0xdc8fe3;});})[_0x62b2('0x34')](function(){_0x7573f0[_0x62b2('0x27')](0xcc)[_0x62b2('0x28')]();});}};}function handleEntityNotFound(_0x1eae90,_0x430d18){return function(_0x47a0b){if(!_0x47a0b){_0x1eae90[_0x62b2('0x38')](0x194);}return _0x47a0b;};}function handleError(_0x18eafe,_0x2fbff2){_0x2fbff2=_0x2fbff2||0x1f4;return function(_0x385fb0){logger[_0x62b2('0x22')](_0x385fb0[_0x62b2('0x39')]);if(_0x385fb0['name']){delete _0x385fb0[_0x62b2('0x3a')];}_0x18eafe['status'](_0x2fbff2)['send'](_0x385fb0);};}exports[_0x62b2('0x3b')]=function(_0x5308a5,_0xa2f561){var _0x5d65d6={},_0x4dd334={},_0x1d6959={'count':0x0,'rows':[]};var _0x18df14=_['map'](db[_0x62b2('0x3c')]['rawAttributes'],function(_0xd22ed7){return{'name':_0xd22ed7['fieldName'],'type':_0xd22ed7[_0x62b2('0x3d')][_0x62b2('0x3e')]};});_0x4dd334[_0x62b2('0x3f')]=_[_0x62b2('0x40')](_0x18df14,_0x62b2('0x3a'));_0x4dd334['query']=_['keys'](_0x5308a5[_0x62b2('0x41')]);_0x4dd334[_0x62b2('0x42')]=_['intersection'](_0x4dd334['model'],_0x4dd334[_0x62b2('0x41')]);_0x5d65d6[_0x62b2('0x43')]=_['intersection'](_0x4dd334['model'],qs[_0x62b2('0x44')](_0x5308a5[_0x62b2('0x41')][_0x62b2('0x44')]));_0x5d65d6[_0x62b2('0x43')]=_0x5d65d6[_0x62b2('0x43')][_0x62b2('0x45')]?_0x5d65d6['attributes']:_0x4dd334[_0x62b2('0x3f')];if(!_0x5308a5[_0x62b2('0x41')][_0x62b2('0x46')](_0x62b2('0x47'))){_0x5d65d6['limit']=qs[_0x62b2('0x2a')](_0x5308a5[_0x62b2('0x41')]['limit']);_0x5d65d6[_0x62b2('0x2d')]=qs[_0x62b2('0x2d')](_0x5308a5[_0x62b2('0x41')][_0x62b2('0x2d')]);}_0x5d65d6[_0x62b2('0x48')]=qs[_0x62b2('0x49')](_0x5308a5[_0x62b2('0x41')][_0x62b2('0x49')]);_0x5d65d6['where']=qs[_0x62b2('0x42')](_[_0x62b2('0x4a')](_0x5308a5[_0x62b2('0x41')],_0x4dd334[_0x62b2('0x42')]),_0x18df14);if(_0x5308a5['query'][_0x62b2('0x4b')]){_0x5d65d6[_0x62b2('0x4c')]=_[_0x62b2('0x4d')](_0x5d65d6[_0x62b2('0x4c')],{'$or':_['map'](_0x18df14,function(_0x15995f){if(_0x15995f[_0x62b2('0x3d')]!==_0x62b2('0x4e')){var _0x38a014={};_0x38a014[_0x15995f[_0x62b2('0x3a')]]={'$like':'%'+_0x5308a5[_0x62b2('0x41')]['filter']+'%'};return _0x38a014;}})});}_0x5d65d6=_['merge']({},_0x5d65d6,_0x5308a5[_0x62b2('0x4f')]);var _0x5e66ca={'where':_0x5d65d6[_0x62b2('0x4c')]};return db[_0x62b2('0x3c')][_0x62b2('0x2c')](_0x5e66ca)[_0x62b2('0x34')](function(_0x3a2020){_0x1d6959[_0x62b2('0x2c')]=_0x3a2020;if(_0x5308a5[_0x62b2('0x41')][_0x62b2('0x50')]){_0x5d65d6[_0x62b2('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x62b2('0x52')](_0x5d65d6);})[_0x62b2('0x34')](function(_0x4a234f){_0x1d6959['rows']=_0x4a234f;return _0x1d6959;})[_0x62b2('0x34')](respondWithFilteredResult(_0xa2f561,_0x5d65d6))['catch'](handleError(_0xa2f561,null));};exports[_0x62b2('0x53')]=function(_0x4d716b,_0x41b196){var _0x3eae16={'raw':![],'where':{'id':_0x4d716b[_0x62b2('0x54')]['id']}},_0x58f19a={};_0x58f19a[_0x62b2('0x3f')]=_[_0x62b2('0x55')](db[_0x62b2('0x3c')][_0x62b2('0x56')]);_0x58f19a[_0x62b2('0x41')]=_['keys'](_0x4d716b[_0x62b2('0x41')]);_0x58f19a[_0x62b2('0x42')]=_[_0x62b2('0x57')](_0x58f19a[_0x62b2('0x3f')],_0x58f19a[_0x62b2('0x41')]);_0x3eae16[_0x62b2('0x43')]=_[_0x62b2('0x57')](_0x58f19a[_0x62b2('0x3f')],qs[_0x62b2('0x44')](_0x4d716b[_0x62b2('0x41')][_0x62b2('0x44')]));_0x3eae16[_0x62b2('0x43')]=_0x3eae16[_0x62b2('0x43')][_0x62b2('0x45')]?_0x3eae16['attributes']:_0x58f19a[_0x62b2('0x3f')];if(_0x4d716b['query'][_0x62b2('0x50')]){_0x3eae16[_0x62b2('0x51')]=[{'all':!![]}];}_0x3eae16=_['merge']({},_0x3eae16,_0x4d716b[_0x62b2('0x4f')]);return db[_0x62b2('0x3c')][_0x62b2('0x58')](_0x3eae16)[_0x62b2('0x34')](handleEntityNotFound(_0x41b196,null))['then'](respondWithResult(_0x41b196,null))['catch'](handleError(_0x41b196,null));};exports[_0x62b2('0x59')]=function(_0x53ddb0,_0x6d90ef,_0x6223c2){var _0x4418cd;return db[_0x62b2('0x3c')][_0x62b2('0x59')](_0x53ddb0['body'],{'raw':!![]})[_0x62b2('0x34')](function(_0x2ff441){_0x4418cd=_0x2ff441;return db[_0x62b2('0x3c')][_0x62b2('0x52')]({'raw':!![]});})[_0x62b2('0x34')](function(_0x4ca1ed){var _0x3153a4=fs['readFileSync'](path[_0x62b2('0x5a')](config[_0x62b2('0x5b')],'server/files/templates/context.ejs'),_0x62b2('0x5c'));var _0x1bc31f=ejs[_0x62b2('0x5d')](_0x3153a4,{'contexts':_0x4ca1ed||[]});fs[_0x62b2('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1bc31f);})[_0x62b2('0x34')](function(){return respondWithRpcPromise(_0x62b2('0x5f'),_0x62b2('0x59'),{'module':_0x62b2('0x60')});})['then'](function(){var _0x10012b=_0x53ddb0['user'][_0x62b2('0x36')]({'plain':!![]});if(!_0x10012b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10012b[_0x62b2('0x61')]===_0x62b2('0x62')){var _0xe2738c=_0x4418cd[_0x62b2('0x36')]({'plain':!![]});return db[_0x62b2('0x63')][_0x62b2('0x58')]({'where':{'name':_0x62b2('0x37'),'userProfileId':_0x10012b['userProfileId']},'raw':!![]})['then'](function(_0x19546b){if(_0x19546b&&_0x19546b[_0x62b2('0x64')]===0x0){return db[_0x62b2('0x65')][_0x62b2('0x59')]({'name':_0xe2738c[_0x62b2('0x3a')],'resourceId':_0xe2738c['id'],'type':_0x19546b['name'],'sectionId':_0x19546b['id']},{})[_0x62b2('0x34')](function(){return _0x4418cd;});}else{return _0x4418cd;}})[_0x62b2('0x26')](function(_0x4a6463){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a6463);throw _0x4a6463;});}return _0x4418cd;})[_0x62b2('0x34')](respondWithResult(_0x6d90ef,0xc9))[_0x62b2('0x26')](handleError(_0x6d90ef,null));};exports[_0x62b2('0x33')]=function(_0x355959,_0x20fce3,_0x5cf175){var _0x1cde8c;return db[_0x62b2('0x3c')]['find']({'where':{'id':_0x355959[_0x62b2('0x54')]['id']}})[_0x62b2('0x34')](handleEntityNotFound(_0x20fce3,null))['then'](saveUpdates(_0x355959['body'],null))[_0x62b2('0x34')](function(_0x4dfdeb){if(_0x4dfdeb){_0x1cde8c=_0x4dfdeb;return db[_0x62b2('0x3c')][_0x62b2('0x52')]({'raw':!![]});}})[_0x62b2('0x34')](function(_0x1270f1){var _0x63bdb0=fs[_0x62b2('0x66')](path[_0x62b2('0x5a')](config[_0x62b2('0x5b')],_0x62b2('0x67')),_0x62b2('0x5c'));var _0x7df9d1=ejs['render'](_0x63bdb0,{'contexts':_0x1270f1||[]});fs[_0x62b2('0x5e')](_0x62b2('0x68'),_0x7df9d1);})[_0x62b2('0x34')](function(){return respondWithRpcPromise('Reload',_0x62b2('0x33'),{'module':'chan_sip.so'});})['then'](function(){return _0x1cde8c;})['then'](respondWithResult(_0x20fce3,null))[_0x62b2('0x26')](handleError(_0x20fce3,null));};exports['destroy']=function(_0x590577,_0x1f1022,_0xe581b4){var _0x5123a9;return db['VoiceContext'][_0x62b2('0x58')]({'where':{'id':_0x590577[_0x62b2('0x54')]['id']}})[_0x62b2('0x34')](handleEntityNotFound(_0x1f1022,null))[_0x62b2('0x34')](removeEntity(_0x1f1022,null))[_0x62b2('0x34')](function(){return db[_0x62b2('0x3c')][_0x62b2('0x52')]({'raw':!![]});})[_0x62b2('0x34')](function(_0x2db3aa){var _0x2e642a=fs[_0x62b2('0x66')](path['join'](config[_0x62b2('0x5b')],_0x62b2('0x67')),_0x62b2('0x5c'));var _0x286bf0=ejs['render'](_0x2e642a,{'contexts':_0x2db3aa});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x286bf0);return respondWithRpcPromise(_0x62b2('0x5f'),'destroy',{'module':_0x62b2('0x60')});})[_0x62b2('0x26')](handleError(_0x1f1022,null));}; \ No newline at end of file +var _0x0c82=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','get','Contexts','UserProfileResource','end','stack','name','send','map','VoiceContext','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','params','rawAttributes','find','catch','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','utf8','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x0c82,0xbd));var _0x20c8=function(_0x136a23,_0x507cda){_0x136a23=_0x136a23-0x0;var _0x48e69b=_0x0c82[_0x136a23];return _0x48e69b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x20c8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20c8('0x1'));var moment=require(_0x20c8('0x2'));var BPromise=require(_0x20c8('0x3'));var Mustache=require(_0x20c8('0x4'));var util=require(_0x20c8('0x5'));var path=require(_0x20c8('0x6'));var sox=require(_0x20c8('0x7'));var csv=require(_0x20c8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20c8('0x9'));var _=require(_0x20c8('0xa'));var squel=require('squel');var crypto=require(_0x20c8('0xb'));var jsforce=require(_0x20c8('0xc'));var deskjs=require(_0x20c8('0xd'));var toCsv=require(_0x20c8('0x8'));var querystring=require(_0x20c8('0xe'));var Papa=require('papaparse');var Redis=require(_0x20c8('0xf'));var authService=require(_0x20c8('0x10'));var qs=require(_0x20c8('0x11'));var as=require(_0x20c8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20c8('0x13'))(_0x20c8('0x14'));var utils=require(_0x20c8('0x15'));var config=require(_0x20c8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x20c8('0x17'))['db'];var jayson=require(_0x20c8('0x18'));var client=jayson['client'][_0x20c8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x393ad0,_0x3a0120,_0x420ff6,_0x348a76){return new BPromise(function(_0x115ad3,_0x50efe9){var _0x6a76da=_0x348a76||client;return _0x6a76da[_0x20c8('0x1a')](_0x393ad0,_0x420ff6)[_0x20c8('0x1b')](function(_0x2a2ca8){logger[_0x20c8('0x1c')](_0x20c8('0x1d'),_0x3a0120,_0x20c8('0x1e'));logger[_0x20c8('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3a0120,'request\x20sent',JSON['stringify'](_0x2a2ca8));if(_0x2a2ca8[_0x20c8('0x20')]){if(_0x2a2ca8['error'][_0x20c8('0x21')]===0x1f4){logger[_0x20c8('0x20')](_0x20c8('0x1d'),_0x3a0120,_0x2a2ca8['error'][_0x20c8('0x22')]);return _0x50efe9(_0x2a2ca8[_0x20c8('0x20')][_0x20c8('0x22')]);}logger[_0x20c8('0x20')]('VoiceContext,\x20%s,\x20%s',_0x3a0120,_0x2a2ca8['error'][_0x20c8('0x22')]);return _0x115ad3(_0x2a2ca8[_0x20c8('0x20')][_0x20c8('0x22')]);}else{logger[_0x20c8('0x1c')](_0x20c8('0x1d'),_0x3a0120,_0x20c8('0x1e'));_0x115ad3(_0x2a2ca8[_0x20c8('0x23')]['message']);}})['catch'](function(_0x65727a){logger['error'](_0x20c8('0x1d'),_0x3a0120,_0x65727a);_0x50efe9(_0x65727a);});});}function respondWithStatusCode(_0xe1189b,_0x52bdc4){_0x52bdc4=_0x52bdc4||0xcc;return function(_0x3046aa){if(_0x3046aa){return _0xe1189b[_0x20c8('0x24')](_0x52bdc4);}return _0xe1189b[_0x20c8('0x25')](_0x52bdc4)['end']();};}function respondWithResult(_0xdd841e,_0x3ebc78){_0x3ebc78=_0x3ebc78||0xc8;return function(_0x17c7b7){if(_0x17c7b7){return _0xdd841e['status'](_0x3ebc78)[_0x20c8('0x26')](_0x17c7b7);}};}function respondWithFilteredResult(_0x2032fe,_0x2b8e17){return function(_0x3d70f9){if(_0x3d70f9){var _0x223e9e=typeof _0x2b8e17[_0x20c8('0x27')]===_0x20c8('0x28')&&typeof _0x2b8e17['limit']===_0x20c8('0x28');var _0x27ee89=_0x3d70f9[_0x20c8('0x29')];var _0xd4d00e=_0x223e9e?0x0:_0x2b8e17[_0x20c8('0x27')];var _0x1b732c=_0x223e9e?_0x3d70f9[_0x20c8('0x29')]:_0x2b8e17[_0x20c8('0x27')]+_0x2b8e17[_0x20c8('0x2a')];var _0x3c9097;if(_0x1b732c>=_0x27ee89){_0x1b732c=_0x27ee89;_0x3c9097=0xc8;}else{_0x3c9097=0xce;}_0x2032fe[_0x20c8('0x25')](_0x3c9097);return _0x2032fe[_0x20c8('0x2b')](_0x20c8('0x2c'),_0xd4d00e+'-'+_0x1b732c+'/'+_0x27ee89)['json'](_0x3d70f9);}return null;};}function patchUpdates(_0x529a11){return function(_0x160fcc){try{jsonpatch[_0x20c8('0x2d')](_0x160fcc,_0x529a11,!![]);}catch(_0x262213){return BPromise[_0x20c8('0x2e')](_0x262213);}return _0x160fcc['save']();};}function saveUpdates(_0x47cebd,_0x350b6e){return function(_0x384cbd){if(_0x384cbd){return _0x384cbd['update'](_0x47cebd)[_0x20c8('0x1b')](function(_0x92e19a){return _0x92e19a;});}return null;};}function removeEntity(_0x3534dd,_0x52aef4){return function(_0x18a7a9){if(_0x18a7a9){return _0x18a7a9[_0x20c8('0x2f')]()[_0x20c8('0x1b')](function(){var _0x3054f7=_0x18a7a9[_0x20c8('0x30')]({'plain':!![]});var _0x2f9f43=_0x20c8('0x31');return db[_0x20c8('0x32')]['destroy']({'where':{'type':_0x2f9f43,'resourceId':_0x3054f7['id']}})[_0x20c8('0x1b')](function(){return _0x18a7a9;});})[_0x20c8('0x1b')](function(){_0x3534dd[_0x20c8('0x25')](0xcc)[_0x20c8('0x33')]();});}};}function handleEntityNotFound(_0xe4c5c5,_0x54b95b){return function(_0x2f294c){if(!_0x2f294c){_0xe4c5c5[_0x20c8('0x24')](0x194);}return _0x2f294c;};}function handleError(_0x16a4de,_0x97366b){_0x97366b=_0x97366b||0x1f4;return function(_0x2262b8){logger[_0x20c8('0x20')](_0x2262b8[_0x20c8('0x34')]);if(_0x2262b8['name']){delete _0x2262b8[_0x20c8('0x35')];}_0x16a4de['status'](_0x97366b)[_0x20c8('0x36')](_0x2262b8);};}exports['index']=function(_0x1ec1a4,_0x2027bc){var _0x1a9c21={},_0x1007a1={},_0x38589e={'count':0x0,'rows':[]};var _0x517d47=_[_0x20c8('0x37')](db[_0x20c8('0x38')]['rawAttributes'],function(_0x5baf6b){return{'name':_0x5baf6b['fieldName'],'type':_0x5baf6b[_0x20c8('0x39')][_0x20c8('0x3a')]};});_0x1007a1[_0x20c8('0x3b')]=_[_0x20c8('0x37')](_0x517d47,_0x20c8('0x35'));_0x1007a1['query']=_[_0x20c8('0x3c')](_0x1ec1a4[_0x20c8('0x3d')]);_0x1007a1[_0x20c8('0x3e')]=_[_0x20c8('0x3f')](_0x1007a1['model'],_0x1007a1[_0x20c8('0x3d')]);_0x1a9c21['attributes']=_['intersection'](_0x1007a1[_0x20c8('0x3b')],qs[_0x20c8('0x40')](_0x1ec1a4['query'][_0x20c8('0x40')]));_0x1a9c21['attributes']=_0x1a9c21[_0x20c8('0x41')][_0x20c8('0x42')]?_0x1a9c21[_0x20c8('0x41')]:_0x1007a1[_0x20c8('0x3b')];if(!_0x1ec1a4['query']['hasOwnProperty'](_0x20c8('0x43'))){_0x1a9c21[_0x20c8('0x2a')]=qs[_0x20c8('0x2a')](_0x1ec1a4[_0x20c8('0x3d')][_0x20c8('0x2a')]);_0x1a9c21[_0x20c8('0x27')]=qs[_0x20c8('0x27')](_0x1ec1a4[_0x20c8('0x3d')][_0x20c8('0x27')]);}_0x1a9c21[_0x20c8('0x44')]=qs['sort'](_0x1ec1a4[_0x20c8('0x3d')][_0x20c8('0x45')]);_0x1a9c21['where']=qs[_0x20c8('0x3e')](_[_0x20c8('0x46')](_0x1ec1a4[_0x20c8('0x3d')],_0x1007a1[_0x20c8('0x3e')]),_0x517d47);if(_0x1ec1a4[_0x20c8('0x3d')][_0x20c8('0x47')]){_0x1a9c21['where']=_['merge'](_0x1a9c21[_0x20c8('0x48')],{'$or':_[_0x20c8('0x37')](_0x517d47,function(_0x4fbf2b){if(_0x4fbf2b['type']!==_0x20c8('0x49')){var _0x302fdc={};_0x302fdc[_0x4fbf2b[_0x20c8('0x35')]]={'$like':'%'+_0x1ec1a4['query'][_0x20c8('0x47')]+'%'};return _0x302fdc;}})});}_0x1a9c21=_[_0x20c8('0x4a')]({},_0x1a9c21,_0x1ec1a4['options']);var _0x389a14={'where':_0x1a9c21[_0x20c8('0x48')]};return db[_0x20c8('0x38')][_0x20c8('0x29')](_0x389a14)[_0x20c8('0x1b')](function(_0xb17023){_0x38589e['count']=_0xb17023;if(_0x1ec1a4['query'][_0x20c8('0x4b')]){_0x1a9c21['include']=[{'all':!![]}];}return db[_0x20c8('0x38')][_0x20c8('0x4c')](_0x1a9c21);})['then'](function(_0x47e074){_0x38589e[_0x20c8('0x4d')]=_0x47e074;return _0x38589e;})[_0x20c8('0x1b')](respondWithFilteredResult(_0x2027bc,_0x1a9c21))['catch'](handleError(_0x2027bc,null));};exports['show']=function(_0x51c3d5,_0x4f2e89){var _0x193afc={'raw':![],'where':{'id':_0x51c3d5[_0x20c8('0x4e')]['id']}},_0xbf147b={};_0xbf147b[_0x20c8('0x3b')]=_['keys'](db['VoiceContext'][_0x20c8('0x4f')]);_0xbf147b[_0x20c8('0x3d')]=_['keys'](_0x51c3d5['query']);_0xbf147b[_0x20c8('0x3e')]=_[_0x20c8('0x3f')](_0xbf147b[_0x20c8('0x3b')],_0xbf147b[_0x20c8('0x3d')]);_0x193afc['attributes']=_[_0x20c8('0x3f')](_0xbf147b[_0x20c8('0x3b')],qs[_0x20c8('0x40')](_0x51c3d5['query'][_0x20c8('0x40')]));_0x193afc[_0x20c8('0x41')]=_0x193afc[_0x20c8('0x41')][_0x20c8('0x42')]?_0x193afc[_0x20c8('0x41')]:_0xbf147b[_0x20c8('0x3b')];if(_0x51c3d5[_0x20c8('0x3d')][_0x20c8('0x4b')]){_0x193afc['include']=[{'all':!![]}];}_0x193afc=_['merge']({},_0x193afc,_0x51c3d5['options']);return db['VoiceContext'][_0x20c8('0x50')](_0x193afc)['then'](handleEntityNotFound(_0x4f2e89,null))[_0x20c8('0x1b')](respondWithResult(_0x4f2e89,null))[_0x20c8('0x51')](handleError(_0x4f2e89,null));};exports[_0x20c8('0x52')]=function(_0x32820b,_0x4499e9,_0x2e0ff4){var _0x189c8d;return db[_0x20c8('0x38')][_0x20c8('0x52')](_0x32820b[_0x20c8('0x53')],{'raw':!![]})['then'](function(_0x2d43de){_0x189c8d=_0x2d43de;return db[_0x20c8('0x38')][_0x20c8('0x4c')]({'raw':!![]});})[_0x20c8('0x1b')](function(_0x2357e4){var _0x5ab1fd=fs[_0x20c8('0x54')](path[_0x20c8('0x55')](config[_0x20c8('0x56')],_0x20c8('0x57')),'utf8');var _0xc470b2=ejs[_0x20c8('0x58')](_0x5ab1fd,{'contexts':_0x2357e4||[]});fs[_0x20c8('0x59')](_0x20c8('0x5a'),_0xc470b2);})['then'](function(){return respondWithRpcPromise(_0x20c8('0x5b'),_0x20c8('0x52'),{'module':_0x20c8('0x5c')});})[_0x20c8('0x1b')](function(){var _0x47af93=_0x32820b[_0x20c8('0x5d')][_0x20c8('0x30')]({'plain':!![]});if(!_0x47af93)throw new Error(_0x20c8('0x5e'));if(_0x47af93[_0x20c8('0x5f')]===_0x20c8('0x5d')){var _0xae516c=_0x189c8d['get']({'plain':!![]});return db[_0x20c8('0x60')][_0x20c8('0x50')]({'where':{'name':_0x20c8('0x31'),'userProfileId':_0x47af93[_0x20c8('0x61')]},'raw':!![]})[_0x20c8('0x1b')](function(_0x34172d){if(_0x34172d&&_0x34172d[_0x20c8('0x62')]===0x0){return db[_0x20c8('0x32')][_0x20c8('0x52')]({'name':_0xae516c[_0x20c8('0x35')],'resourceId':_0xae516c['id'],'type':_0x34172d[_0x20c8('0x35')],'sectionId':_0x34172d['id']},{})[_0x20c8('0x1b')](function(){return _0x189c8d;});}else{return _0x189c8d;}})[_0x20c8('0x51')](function(_0x2717fb){logger[_0x20c8('0x20')](_0x20c8('0x63'),_0x2717fb);throw _0x2717fb;});}return _0x189c8d;})['then'](respondWithResult(_0x4499e9,0xc9))[_0x20c8('0x51')](handleError(_0x4499e9,null));};exports[_0x20c8('0x64')]=function(_0xb4f079,_0x3ebbe6,_0x2fabe7){var _0x1170db;return db[_0x20c8('0x38')][_0x20c8('0x50')]({'where':{'id':_0xb4f079[_0x20c8('0x4e')]['id']}})[_0x20c8('0x1b')](handleEntityNotFound(_0x3ebbe6,null))[_0x20c8('0x1b')](saveUpdates(_0xb4f079['body'],null))[_0x20c8('0x1b')](function(_0x28b2aa){if(_0x28b2aa){_0x1170db=_0x28b2aa;return db[_0x20c8('0x38')][_0x20c8('0x4c')]({'raw':!![]});}})[_0x20c8('0x1b')](function(_0x11707e){var _0x136992=fs[_0x20c8('0x54')](path[_0x20c8('0x55')](config[_0x20c8('0x56')],_0x20c8('0x57')),_0x20c8('0x65'));var _0x5c1c8d=ejs[_0x20c8('0x58')](_0x136992,{'contexts':_0x11707e||[]});fs[_0x20c8('0x59')](_0x20c8('0x5a'),_0x5c1c8d);})['then'](function(){return respondWithRpcPromise('Reload',_0x20c8('0x64'),{'module':_0x20c8('0x5c')});})[_0x20c8('0x1b')](function(){return _0x1170db;})[_0x20c8('0x1b')](respondWithResult(_0x3ebbe6,null))[_0x20c8('0x51')](handleError(_0x3ebbe6,null));};exports[_0x20c8('0x2f')]=function(_0x252dd1,_0x4339d1,_0x425d2b){var _0x351951;return db['VoiceContext'][_0x20c8('0x50')]({'where':{'id':_0x252dd1[_0x20c8('0x4e')]['id']}})[_0x20c8('0x1b')](handleEntityNotFound(_0x4339d1,null))[_0x20c8('0x1b')](removeEntity(_0x4339d1,null))['then'](function(){return db[_0x20c8('0x38')][_0x20c8('0x4c')]({'raw':!![]});})[_0x20c8('0x1b')](function(_0x6f296f){var _0x50e3fb=fs[_0x20c8('0x54')](path[_0x20c8('0x55')](config[_0x20c8('0x56')],_0x20c8('0x57')),_0x20c8('0x65'));var _0x25a289=ejs['render'](_0x50e3fb,{'contexts':_0x6f296f});fs[_0x20c8('0x59')](_0x20c8('0x5a'),_0x25a289);return respondWithRpcPromise(_0x20c8('0x5b'),_0x20c8('0x2f'),{'module':_0x20c8('0x5c')});})[_0x20c8('0x51')](handleError(_0x4339d1,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5de1c4e..82fc79e 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 _0xd811=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x2fc844,_0x734f34){var _0x8cb657=function(_0x4b01fd){while(--_0x4b01fd){_0x2fc844['push'](_0x2fc844['shift']());}};_0x8cb657(++_0x734f34);}(_0xd811,0x165));var _0x1d81=function(_0x470f4b,_0x563ba2){_0x470f4b=_0x470f4b-0x0;var _0x359ae6=_0xd811[_0x470f4b];return _0x359ae6;};'use strict';var _=require(_0x1d81('0x0'));var util=require(_0x1d81('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d81('0x2'));var BPromise=require(_0x1d81('0x3'));var rp=require(_0x1d81('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d81('0x5'));var config=require('../../config/environment');var attributes=require(_0x1d81('0x6'));module[_0x1d81('0x7')]=function(_0x41d857,_0x3c0e8d){return _0x41d857[_0x1d81('0x8')](_0x1d81('0x9'),attributes,{'tableName':_0x1d81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0970=['api','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger'];(function(_0x51ab51,_0x26c873){var _0x4164c4=function(_0x102663){while(--_0x102663){_0x51ab51['push'](_0x51ab51['shift']());}};_0x4164c4(++_0x26c873);}(_0x0970,0x1a1));var _0x0097=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0970[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0097('0x0'));var util=require(_0x0097('0x1'));var logger=require(_0x0097('0x2'))(_0x0097('0x3'));var moment=require('moment');var BPromise=require(_0x0097('0x4'));var rp=require(_0x0097('0x5'));var fs=require('fs');var path=require(_0x0097('0x6'));var rimraf=require(_0x0097('0x7'));var config=require('../../config/environment');var attributes=require(_0x0097('0x8'));module[_0x0097('0x9')]=function(_0x365e00,_0x3aac78){return _0x365e00[_0x0097('0xa')](_0x0097('0xb'),attributes,{'tableName':'voice_contexts','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 61b6ad7..daf6470 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 _0x2964=['client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x2964,0x108));var _0x4296=function(_0x300850,_0x518b6c){_0x300850=_0x300850-0x0;var _0x3f324b=_0x2964[_0x300850];return _0x3f324b;};'use strict';var _=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var moment=require(_0x4296('0x2'));var BPromise=require(_0x4296('0x3'));var rs=require(_0x4296('0x4'));var fs=require('fs');var Redis=require(_0x4296('0x5'));var db=require(_0x4296('0x6'))['db'];var utils=require(_0x4296('0x7'));var logger=require(_0x4296('0x8'))('rpc');var config=require(_0x4296('0x9'));var jayson=require(_0x4296('0xa'));var client=jayson[_0x4296('0xb')][_0x4296('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15d705,_0x273d90,_0x50a6c5){return new BPromise(function(_0x20c967,_0x25019c){return client[_0x4296('0xd')](_0x15d705,_0x50a6c5)[_0x4296('0xe')](function(_0x35a29a){logger[_0x4296('0xf')](_0x4296('0x10'),_0x273d90,_0x4296('0x11'));logger[_0x4296('0x12')](_0x4296('0x13'),_0x273d90,_0x4296('0x11'),JSON[_0x4296('0x14')](_0x35a29a));if(_0x35a29a['error']){if(_0x35a29a[_0x4296('0x15')][_0x4296('0x16')]===0x1f4){logger[_0x4296('0x15')](_0x4296('0x10'),_0x273d90,_0x35a29a[_0x4296('0x15')][_0x4296('0x17')]);return _0x25019c(_0x35a29a[_0x4296('0x15')]['message']);}logger[_0x4296('0x15')](_0x4296('0x10'),_0x273d90,_0x35a29a[_0x4296('0x15')]['message']);return _0x20c967(_0x35a29a[_0x4296('0x15')][_0x4296('0x17')]);}else{logger[_0x4296('0xf')]('VoiceContext,\x20%s,\x20%s',_0x273d90,_0x4296('0x11'));_0x20c967(_0x35a29a[_0x4296('0x18')][_0x4296('0x17')]);}})['catch'](function(_0x3f5896){logger[_0x4296('0x15')](_0x4296('0x10'),_0x273d90,_0x3f5896);_0x25019c(_0x3f5896);});});} \ No newline at end of file +var _0xf24b=['VoiceContext,\x20%s,\x20%s','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf24b,0xad));var _0xbf24=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0xf24b[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var moment=require(_0xbf24('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf24('0x4'))['db'];var utils=require(_0xbf24('0x5'));var logger=require('../../config/logger')(_0xbf24('0x6'));var config=require(_0xbf24('0x7'));var jayson=require(_0xbf24('0x8'));var client=jayson[_0xbf24('0x9')][_0xbf24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd757,_0x10ae5f,_0x3e983e){return new BPromise(function(_0x455e1e,_0x519ad7){return client['request'](_0x4dd757,_0x3e983e)[_0xbf24('0xb')](function(_0x3a94e7){logger[_0xbf24('0xc')]('VoiceContext,\x20%s,\x20%s',_0x10ae5f,_0xbf24('0xd'));logger['debug'](_0xbf24('0xe'),_0x10ae5f,'request\x20sent',JSON['stringify'](_0x3a94e7));if(_0x3a94e7[_0xbf24('0xf')]){if(_0x3a94e7[_0xbf24('0xf')]['code']===0x1f4){logger[_0xbf24('0xf')]('VoiceContext,\x20%s,\x20%s',_0x10ae5f,_0x3a94e7[_0xbf24('0xf')][_0xbf24('0x10')]);return _0x519ad7(_0x3a94e7[_0xbf24('0xf')][_0xbf24('0x10')]);}logger['error'](_0xbf24('0x11'),_0x10ae5f,_0x3a94e7[_0xbf24('0xf')]['message']);return _0x455e1e(_0x3a94e7['error'][_0xbf24('0x10')]);}else{logger[_0xbf24('0xc')](_0xbf24('0x11'),_0x10ae5f,_0xbf24('0xd'));_0x455e1e(_0x3a94e7[_0xbf24('0x12')][_0xbf24('0x10')]);}})['catch'](function(_0x188217){logger['error'](_0xbf24('0x11'),_0x10ae5f,_0x188217);_0x519ad7(_0x188217);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 582f7c5..b67560d 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 _0xa1fd=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports'];(function(_0x4cfdfe,_0x55a62b){var _0x4eea9d=function(_0x32e668){while(--_0x32e668){_0x4cfdfe['push'](_0x4cfdfe['shift']());}};_0x4eea9d(++_0x55a62b);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x4baf36,_0x4e3e17){_0x4baf36=_0x4baf36-0x0;var _0x5a029f=_0xa1fd[_0x4baf36];return _0x5a029f;};'use strict';var multer=require(_0xda1f('0x0'));var util=require(_0xda1f('0x1'));var path=require(_0xda1f('0x2'));var timeout=require(_0xda1f('0x3'));var express=require('express');var router=express[_0xda1f('0x4')]();var fs_extra=require(_0xda1f('0x5'));var auth=require(_0xda1f('0x6'));var interaction=require(_0xda1f('0x7'));var config=require(_0xda1f('0x8'));var controller=require('./voiceDialReport.controller');router[_0xda1f('0x9')]('/',auth[_0xda1f('0xa')](),controller[_0xda1f('0xb')]);router['get'](_0xda1f('0xc'),auth[_0xda1f('0xa')](),controller[_0xda1f('0xd')]);router[_0xda1f('0x9')](_0xda1f('0xe'),auth[_0xda1f('0xa')](),controller[_0xda1f('0xf')]);router[_0xda1f('0x10')]('/',auth[_0xda1f('0xa')](),controller['create']);router[_0xda1f('0x11')](_0xda1f('0xe'),auth[_0xda1f('0xa')](),controller[_0xda1f('0x12')]);router['delete']('/:id',auth[_0xda1f('0xa')](),controller[_0xda1f('0x13')]);module[_0xda1f('0x14')]=router; \ No newline at end of file +var _0xa81e=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','express'];(function(_0x1701e9,_0x4d1112){var _0x4a0c77=function(_0x33c360){while(--_0x33c360){_0x1701e9['push'](_0x1701e9['shift']());}};_0x4a0c77(++_0x4d1112);}(_0xa81e,0x1a6));var _0xea81=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xa81e[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require(_0xea81('0x0'));var path=require(_0xea81('0x1'));var timeout=require('connect-timeout');var express=require(_0xea81('0x2'));var router=express[_0xea81('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xea81('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea81('0x5'));var controller=require('./voiceDialReport.controller');router[_0xea81('0x6')]('/',auth[_0xea81('0x7')](),controller['index']);router[_0xea81('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xea81('0x7')](),controller[_0xea81('0x8')]);router[_0xea81('0x9')]('/',auth[_0xea81('0x7')](),controller[_0xea81('0xa')]);router[_0xea81('0xb')](_0xea81('0xc'),auth[_0xea81('0x7')](),controller[_0xea81('0xd')]);router[_0xea81('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xea81('0xf')]);module[_0xea81('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 12fabcb..fe401f4 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 _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x2f568c,_0x43333b){var _0x133182=function(_0x388957){while(--_0x388957){_0x2f568c['push'](_0x2f568c['shift']());}};_0x133182(++_0x43333b);}(_0x6aa7,0x178));var _0x76aa=function(_0x1e2a3c,_0x5d5d13){_0x1e2a3c=_0x1e2a3c-0x0;var _0x5f2d16=_0x6aa7[_0x1e2a3c];return _0x5f2d16;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x5044e7,_0x2749b9){var _0x1826a2=function(_0x31c262){while(--_0x31c262){_0x5044e7['push'](_0x5044e7['shift']());}};_0x1826a2(++_0x2749b9);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x24ca[_0x4bfade];return _0x272465;};'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 386b598..84b1ebd 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 _0xacc5=['stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','keys','length','include','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','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','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacc5,0x15c));var _0x5acc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xacc5[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x5acc('0x0'));var rimraf=require(_0x5acc('0x1'));var zipdir=require(_0x5acc('0x2'));var jsonpatch=require(_0x5acc('0x3'));var rp=require(_0x5acc('0x4'));var moment=require(_0x5acc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5acc('0x6'));var util=require(_0x5acc('0x7'));var path=require(_0x5acc('0x8'));var sox=require(_0x5acc('0x9'));var csv=require(_0x5acc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5acc('0xb'));var _=require('lodash');var squel=require(_0x5acc('0xc'));var crypto=require(_0x5acc('0xd'));var jsforce=require(_0x5acc('0xe'));var deskjs=require(_0x5acc('0xf'));var toCsv=require(_0x5acc('0xa'));var querystring=require(_0x5acc('0x10'));var Papa=require(_0x5acc('0x11'));var Redis=require(_0x5acc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5acc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5acc('0x14'));var logger=require(_0x5acc('0x15'))(_0x5acc('0x16'));var utils=require(_0x5acc('0x17'));var config=require(_0x5acc('0x18'));var licenseUtil=require(_0x5acc('0x19'));var db=require(_0x5acc('0x1a'))['db'];function respondWithStatusCode(_0x52268c,_0x55e411){_0x55e411=_0x55e411||0xcc;return function(_0x3ed967){if(_0x3ed967){return _0x52268c[_0x5acc('0x1b')](_0x55e411);}return _0x52268c['status'](_0x55e411)[_0x5acc('0x1c')]();};}function respondWithResult(_0x36706b,_0x504d0b){_0x504d0b=_0x504d0b||0xc8;return function(_0x6a9b16){if(_0x6a9b16){return _0x36706b[_0x5acc('0x1d')](_0x504d0b)[_0x5acc('0x1e')](_0x6a9b16);}};}function respondWithFilteredResult(_0x2acf94,_0x1bd31a){return function(_0x1de419){if(_0x1de419){var _0x105c43=typeof _0x1bd31a[_0x5acc('0x1f')]===_0x5acc('0x20')&&typeof _0x1bd31a[_0x5acc('0x21')]===_0x5acc('0x20');var _0x39322b=_0x1de419[_0x5acc('0x22')];var _0x884a46=_0x105c43?0x0:_0x1bd31a[_0x5acc('0x1f')];var _0x3f5d13=_0x105c43?_0x1de419[_0x5acc('0x22')]:_0x1bd31a['offset']+_0x1bd31a[_0x5acc('0x21')];var _0x285fe5;if(_0x3f5d13>=_0x39322b){_0x3f5d13=_0x39322b;_0x285fe5=0xc8;}else{_0x285fe5=0xce;}_0x2acf94[_0x5acc('0x1d')](_0x285fe5);return _0x2acf94[_0x5acc('0x23')](_0x5acc('0x24'),_0x884a46+'-'+_0x3f5d13+'/'+_0x39322b)[_0x5acc('0x1e')](_0x1de419);}return null;};}function patchUpdates(_0xf9452a){return function(_0x2cb52d){try{jsonpatch['apply'](_0x2cb52d,_0xf9452a,!![]);}catch(_0x3a4b62){return BPromise['reject'](_0x3a4b62);}return _0x2cb52d[_0x5acc('0x25')]();};}function saveUpdates(_0x4ebb3a,_0x56f7c7){return function(_0x5cb301){if(_0x5cb301){return _0x5cb301[_0x5acc('0x26')](_0x4ebb3a)[_0x5acc('0x27')](function(_0x5dacab){return _0x5dacab;});}return null;};}function removeEntity(_0xd52649,_0x53b1e2){return function(_0x175237){if(_0x175237){return _0x175237[_0x5acc('0x28')]()['then'](function(){_0xd52649[_0x5acc('0x1d')](0xcc)[_0x5acc('0x1c')]();});}};}function handleEntityNotFound(_0x1f7faa,_0x21e08c){return function(_0x2ba7bf){if(!_0x2ba7bf){_0x1f7faa['sendStatus'](0x194);}return _0x2ba7bf;};}function handleError(_0x3dc0ee,_0x59cafe){_0x59cafe=_0x59cafe||0x1f4;return function(_0x472a3e){logger[_0x5acc('0x29')](_0x472a3e[_0x5acc('0x2a')]);if(_0x472a3e[_0x5acc('0x2b')]){delete _0x472a3e[_0x5acc('0x2b')];}_0x3dc0ee[_0x5acc('0x1d')](_0x59cafe)[_0x5acc('0x2c')](_0x472a3e);};}exports[_0x5acc('0x2d')]=function(_0x254785,_0x3ae70f){var _0x56d9ae={},_0xe51bdb={},_0x2f181b={'count':0x0,'rows':[]};var _0x28c187=_[_0x5acc('0x2e')](db[_0x5acc('0x2f')][_0x5acc('0x30')],function(_0x2b8d3e){return{'name':_0x2b8d3e[_0x5acc('0x31')],'type':_0x2b8d3e[_0x5acc('0x32')][_0x5acc('0x33')]};});_0xe51bdb[_0x5acc('0x34')]=_[_0x5acc('0x2e')](_0x28c187,'name');_0xe51bdb[_0x5acc('0x35')]=_['keys'](_0x254785[_0x5acc('0x35')]);_0xe51bdb[_0x5acc('0x36')]=_[_0x5acc('0x37')](_0xe51bdb[_0x5acc('0x34')],_0xe51bdb[_0x5acc('0x35')]);_0x56d9ae[_0x5acc('0x38')]=_[_0x5acc('0x37')](_0xe51bdb['model'],qs[_0x5acc('0x39')](_0x254785[_0x5acc('0x35')][_0x5acc('0x39')]));_0x56d9ae[_0x5acc('0x38')]=_0x56d9ae[_0x5acc('0x38')]['length']?_0x56d9ae[_0x5acc('0x38')]:_0xe51bdb[_0x5acc('0x34')];if(!_0x254785[_0x5acc('0x35')][_0x5acc('0x3a')]('nolimit')){_0x56d9ae[_0x5acc('0x21')]=qs[_0x5acc('0x21')](_0x254785['query'][_0x5acc('0x21')]);_0x56d9ae[_0x5acc('0x1f')]=qs[_0x5acc('0x1f')](_0x254785['query']['offset']);}_0x56d9ae['order']=qs['sort'](_0x254785['query'][_0x5acc('0x3b')]);_0x56d9ae['where']=qs[_0x5acc('0x36')](_[_0x5acc('0x3c')](_0x254785['query'],_0xe51bdb[_0x5acc('0x36')]),_0x28c187);if(_0x254785[_0x5acc('0x35')][_0x5acc('0x3d')]){_0x56d9ae[_0x5acc('0x3e')]=_[_0x5acc('0x3f')](_0x56d9ae[_0x5acc('0x3e')],{'$or':_[_0x5acc('0x2e')](_0x28c187,function(_0x3f4148){if(_0x3f4148['type']!==_0x5acc('0x40')){var _0x787ab0={};_0x787ab0[_0x3f4148[_0x5acc('0x2b')]]={'$like':'%'+_0x254785[_0x5acc('0x35')][_0x5acc('0x3d')]+'%'};return _0x787ab0;}})});}_0x56d9ae=_[_0x5acc('0x3f')]({},_0x56d9ae,_0x254785[_0x5acc('0x41')]);var _0x1c439b={'where':_0x56d9ae[_0x5acc('0x3e')]};return db[_0x5acc('0x2f')]['count'](_0x1c439b)[_0x5acc('0x27')](function(_0x3a798){_0x2f181b[_0x5acc('0x22')]=_0x3a798;if(_0x254785[_0x5acc('0x35')][_0x5acc('0x42')]){_0x56d9ae['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x56d9ae);})[_0x5acc('0x27')](function(_0x5ba337){_0x2f181b[_0x5acc('0x43')]=_0x5ba337;return _0x2f181b;})['then'](respondWithFilteredResult(_0x3ae70f,_0x56d9ae))['catch'](handleError(_0x3ae70f,null));};exports[_0x5acc('0x44')]=function(_0x419812,_0x475d26){var _0x34d288={'raw':!![],'where':{'id':_0x419812[_0x5acc('0x45')]['id']}},_0xe9fbea={};_0xe9fbea[_0x5acc('0x34')]=_['keys'](db[_0x5acc('0x2f')]['rawAttributes']);_0xe9fbea[_0x5acc('0x35')]=_[_0x5acc('0x46')](_0x419812[_0x5acc('0x35')]);_0xe9fbea[_0x5acc('0x36')]=_[_0x5acc('0x37')](_0xe9fbea[_0x5acc('0x34')],_0xe9fbea['query']);_0x34d288[_0x5acc('0x38')]=_[_0x5acc('0x37')](_0xe9fbea['model'],qs[_0x5acc('0x39')](_0x419812[_0x5acc('0x35')][_0x5acc('0x39')]));_0x34d288[_0x5acc('0x38')]=_0x34d288['attributes'][_0x5acc('0x47')]?_0x34d288[_0x5acc('0x38')]:_0xe9fbea[_0x5acc('0x34')];if(_0x419812['query'][_0x5acc('0x42')]){_0x34d288[_0x5acc('0x48')]=[{'all':!![]}];}_0x34d288=_[_0x5acc('0x3f')]({},_0x34d288,_0x419812['options']);return db['VoiceDialReport']['find'](_0x34d288)[_0x5acc('0x27')](handleEntityNotFound(_0x475d26,null))[_0x5acc('0x27')](respondWithResult(_0x475d26,null))[_0x5acc('0x49')](handleError(_0x475d26,null));};exports[_0x5acc('0x4a')]=function(_0x5e2812,_0x5cb0a4){return db[_0x5acc('0x2f')][_0x5acc('0x4a')](_0x5e2812[_0x5acc('0x4b')],{})[_0x5acc('0x27')](respondWithResult(_0x5cb0a4,0xc9))[_0x5acc('0x49')](handleError(_0x5cb0a4,null));};exports[_0x5acc('0x26')]=function(_0x4c9c4c,_0x4e64e3){if(_0x4c9c4c['body']['id']){delete _0x4c9c4c[_0x5acc('0x4b')]['id'];}return db[_0x5acc('0x2f')][_0x5acc('0x4c')]({'where':{'id':_0x4c9c4c[_0x5acc('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e64e3,null))[_0x5acc('0x27')](saveUpdates(_0x4c9c4c[_0x5acc('0x4b')],null))['then'](respondWithResult(_0x4e64e3,null))[_0x5acc('0x49')](handleError(_0x4e64e3,null));};exports['destroy']=function(_0x44b2bd,_0xba9491){return db['VoiceDialReport']['find']({'where':{'id':_0x44b2bd[_0x5acc('0x45')]['id']}})['then'](handleEntityNotFound(_0xba9491,null))[_0x5acc('0x27')](removeEntity(_0xba9491,null))[_0x5acc('0x49')](handleError(_0xba9491,null));};exports[_0x5acc('0x4d')]=function(_0x10bd20,_0x3020b8){return db[_0x5acc('0x2f')]['describe']()[_0x5acc('0x27')](respondWithResult(_0x3020b8,null))[_0x5acc('0x49')](handleError(_0x3020b8,null));}; \ No newline at end of file +var _0x1ce2=['VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','VoiceDialReport','rawAttributes','type','key','name','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge'];(function(_0x39c775,_0x607a3e){var _0x5822a9=function(_0x1fa7f9){while(--_0x1fa7f9){_0x39c775['push'](_0x39c775['shift']());}};_0x5822a9(++_0x607a3e);}(_0x1ce2,0x18f));var _0x21ce=function(_0x2f8656,_0x11f28e){_0x2f8656=_0x2f8656-0x0;var _0x15e99a=_0x1ce2[_0x2f8656];return _0x15e99a;};'use strict';var emlformat=require(_0x21ce('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x21ce('0x1'));var rp=require(_0x21ce('0x2'));var moment=require(_0x21ce('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x21ce('0x4'));var util=require(_0x21ce('0x5'));var path=require(_0x21ce('0x6'));var sox=require(_0x21ce('0x7'));var csv=require(_0x21ce('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21ce('0x9'));var _=require(_0x21ce('0xa'));var squel=require(_0x21ce('0xb'));var crypto=require('crypto');var jsforce=require(_0x21ce('0xc'));var deskjs=require(_0x21ce('0xd'));var toCsv=require(_0x21ce('0x8'));var querystring=require(_0x21ce('0xe'));var Papa=require(_0x21ce('0xf'));var Redis=require(_0x21ce('0x10'));var authService=require(_0x21ce('0x11'));var qs=require(_0x21ce('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21ce('0x13'));var logger=require(_0x21ce('0x14'))(_0x21ce('0x15'));var utils=require('../../config/utils');var config=require(_0x21ce('0x16'));var licenseUtil=require(_0x21ce('0x17'));var db=require(_0x21ce('0x18'))['db'];function respondWithStatusCode(_0x1e8bfd,_0x2f0722){_0x2f0722=_0x2f0722||0xcc;return function(_0x4a6037){if(_0x4a6037){return _0x1e8bfd[_0x21ce('0x19')](_0x2f0722);}return _0x1e8bfd['status'](_0x2f0722)['end']();};}function respondWithResult(_0x44f784,_0x5cdea7){_0x5cdea7=_0x5cdea7||0xc8;return function(_0x43dd06){if(_0x43dd06){return _0x44f784['status'](_0x5cdea7)[_0x21ce('0x1a')](_0x43dd06);}};}function respondWithFilteredResult(_0x1b60cf,_0x4a6f24){return function(_0x5b0ecc){if(_0x5b0ecc){var _0x212c76=typeof _0x4a6f24[_0x21ce('0x1b')]===_0x21ce('0x1c')&&typeof _0x4a6f24[_0x21ce('0x1d')]===_0x21ce('0x1c');var _0x57ba0f=_0x5b0ecc['count'];var _0x6d31b4=_0x212c76?0x0:_0x4a6f24[_0x21ce('0x1b')];var _0x56537e=_0x212c76?_0x5b0ecc[_0x21ce('0x1e')]:_0x4a6f24[_0x21ce('0x1b')]+_0x4a6f24[_0x21ce('0x1d')];var _0x37e51f;if(_0x56537e>=_0x57ba0f){_0x56537e=_0x57ba0f;_0x37e51f=0xc8;}else{_0x37e51f=0xce;}_0x1b60cf['status'](_0x37e51f);return _0x1b60cf[_0x21ce('0x1f')](_0x21ce('0x20'),_0x6d31b4+'-'+_0x56537e+'/'+_0x57ba0f)[_0x21ce('0x1a')](_0x5b0ecc);}return null;};}function patchUpdates(_0xd8c213){return function(_0x44d772){try{jsonpatch[_0x21ce('0x21')](_0x44d772,_0xd8c213,!![]);}catch(_0x2952ea){return BPromise[_0x21ce('0x22')](_0x2952ea);}return _0x44d772[_0x21ce('0x23')]();};}function saveUpdates(_0x5e8a61,_0x46df4d){return function(_0x251d13){if(_0x251d13){return _0x251d13[_0x21ce('0x24')](_0x5e8a61)[_0x21ce('0x25')](function(_0x488715){return _0x488715;});}return null;};}function removeEntity(_0xad591f,_0x4cfe71){return function(_0x1071ca){if(_0x1071ca){return _0x1071ca[_0x21ce('0x26')]()['then'](function(){_0xad591f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7fd2,_0x1ef1b2){return function(_0x474503){if(!_0x474503){_0x4b7fd2[_0x21ce('0x19')](0x194);}return _0x474503;};}function handleError(_0x485009,_0xe97349){_0xe97349=_0xe97349||0x1f4;return function(_0x29f78e){logger[_0x21ce('0x27')](_0x29f78e[_0x21ce('0x28')]);if(_0x29f78e['name']){delete _0x29f78e['name'];}_0x485009['status'](_0xe97349)[_0x21ce('0x29')](_0x29f78e);};}exports[_0x21ce('0x2a')]=function(_0x56b8f7,_0x5fe2e0){var _0x3f9149={},_0x48e67d={},_0x3a8ea4={'count':0x0,'rows':[]};var _0x106414=_[_0x21ce('0x2b')](db[_0x21ce('0x2c')][_0x21ce('0x2d')],function(_0x4d4b46){return{'name':_0x4d4b46['fieldName'],'type':_0x4d4b46[_0x21ce('0x2e')][_0x21ce('0x2f')]};});_0x48e67d['model']=_[_0x21ce('0x2b')](_0x106414,_0x21ce('0x30'));_0x48e67d[_0x21ce('0x31')]=_[_0x21ce('0x32')](_0x56b8f7[_0x21ce('0x31')]);_0x48e67d['filters']=_[_0x21ce('0x33')](_0x48e67d[_0x21ce('0x34')],_0x48e67d[_0x21ce('0x31')]);_0x3f9149['attributes']=_['intersection'](_0x48e67d['model'],qs[_0x21ce('0x35')](_0x56b8f7[_0x21ce('0x31')]['fields']));_0x3f9149[_0x21ce('0x36')]=_0x3f9149[_0x21ce('0x36')][_0x21ce('0x37')]?_0x3f9149[_0x21ce('0x36')]:_0x48e67d[_0x21ce('0x34')];if(!_0x56b8f7['query'][_0x21ce('0x38')](_0x21ce('0x39'))){_0x3f9149[_0x21ce('0x1d')]=qs[_0x21ce('0x1d')](_0x56b8f7[_0x21ce('0x31')][_0x21ce('0x1d')]);_0x3f9149[_0x21ce('0x1b')]=qs[_0x21ce('0x1b')](_0x56b8f7['query'][_0x21ce('0x1b')]);}_0x3f9149[_0x21ce('0x3a')]=qs['sort'](_0x56b8f7[_0x21ce('0x31')][_0x21ce('0x3b')]);_0x3f9149[_0x21ce('0x3c')]=qs['filters'](_['pick'](_0x56b8f7['query'],_0x48e67d[_0x21ce('0x3d')]),_0x106414);if(_0x56b8f7['query']['filter']){_0x3f9149[_0x21ce('0x3c')]=_[_0x21ce('0x3e')](_0x3f9149['where'],{'$or':_[_0x21ce('0x2b')](_0x106414,function(_0x56f261){if(_0x56f261[_0x21ce('0x2e')]!==_0x21ce('0x3f')){var _0x28eaa2={};_0x28eaa2[_0x56f261[_0x21ce('0x30')]]={'$like':'%'+_0x56b8f7[_0x21ce('0x31')][_0x21ce('0x40')]+'%'};return _0x28eaa2;}})});}_0x3f9149=_[_0x21ce('0x3e')]({},_0x3f9149,_0x56b8f7['options']);var _0x3a748f={'where':_0x3f9149[_0x21ce('0x3c')]};return db[_0x21ce('0x2c')][_0x21ce('0x1e')](_0x3a748f)[_0x21ce('0x25')](function(_0x59a9eb){_0x3a8ea4[_0x21ce('0x1e')]=_0x59a9eb;if(_0x56b8f7[_0x21ce('0x31')][_0x21ce('0x41')]){_0x3f9149[_0x21ce('0x42')]=[{'all':!![]}];}return db[_0x21ce('0x2c')][_0x21ce('0x43')](_0x3f9149);})['then'](function(_0xb05b30){_0x3a8ea4[_0x21ce('0x44')]=_0xb05b30;return _0x3a8ea4;})['then'](respondWithFilteredResult(_0x5fe2e0,_0x3f9149))[_0x21ce('0x45')](handleError(_0x5fe2e0,null));};exports[_0x21ce('0x46')]=function(_0x5c7287,_0x3a7ddc){var _0x2e8bfa={'raw':!![],'where':{'id':_0x5c7287[_0x21ce('0x47')]['id']}},_0xd30185={};_0xd30185['model']=_[_0x21ce('0x32')](db[_0x21ce('0x2c')][_0x21ce('0x2d')]);_0xd30185[_0x21ce('0x31')]=_['keys'](_0x5c7287[_0x21ce('0x31')]);_0xd30185[_0x21ce('0x3d')]=_['intersection'](_0xd30185[_0x21ce('0x34')],_0xd30185[_0x21ce('0x31')]);_0x2e8bfa[_0x21ce('0x36')]=_[_0x21ce('0x33')](_0xd30185[_0x21ce('0x34')],qs[_0x21ce('0x35')](_0x5c7287[_0x21ce('0x31')][_0x21ce('0x35')]));_0x2e8bfa[_0x21ce('0x36')]=_0x2e8bfa[_0x21ce('0x36')][_0x21ce('0x37')]?_0x2e8bfa['attributes']:_0xd30185[_0x21ce('0x34')];if(_0x5c7287['query'][_0x21ce('0x41')]){_0x2e8bfa['include']=[{'all':!![]}];}_0x2e8bfa=_[_0x21ce('0x3e')]({},_0x2e8bfa,_0x5c7287[_0x21ce('0x48')]);return db['VoiceDialReport'][_0x21ce('0x49')](_0x2e8bfa)[_0x21ce('0x25')](handleEntityNotFound(_0x3a7ddc,null))['then'](respondWithResult(_0x3a7ddc,null))['catch'](handleError(_0x3a7ddc,null));};exports[_0x21ce('0x4a')]=function(_0x559843,_0x518889){return db['VoiceDialReport'][_0x21ce('0x4a')](_0x559843[_0x21ce('0x4b')],{})[_0x21ce('0x25')](respondWithResult(_0x518889,0xc9))[_0x21ce('0x45')](handleError(_0x518889,null));};exports[_0x21ce('0x24')]=function(_0x1a9776,_0x2c78c8){if(_0x1a9776['body']['id']){delete _0x1a9776[_0x21ce('0x4b')]['id'];}return db['VoiceDialReport'][_0x21ce('0x49')]({'where':{'id':_0x1a9776[_0x21ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c78c8,null))['then'](saveUpdates(_0x1a9776[_0x21ce('0x4b')],null))[_0x21ce('0x25')](respondWithResult(_0x2c78c8,null))['catch'](handleError(_0x2c78c8,null));};exports['destroy']=function(_0x1703be,_0x22b2a4){return db[_0x21ce('0x2c')][_0x21ce('0x49')]({'where':{'id':_0x1703be[_0x21ce('0x47')]['id']}})[_0x21ce('0x25')](handleEntityNotFound(_0x22b2a4,null))['then'](removeEntity(_0x22b2a4,null))[_0x21ce('0x45')](handleError(_0x22b2a4,null));};exports[_0x21ce('0x4c')]=function(_0x16930e,_0x22da22){return db[_0x21ce('0x2c')][_0x21ce('0x4c')]()[_0x21ce('0x25')](respondWithResult(_0x22da22,null))[_0x21ce('0x45')](handleError(_0x22da22,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 591a79d..8bb0473 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 _0x96a2=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x522bc8,_0x3525bf){var _0x5c5ab4=function(_0x48cafe){while(--_0x48cafe){_0x522bc8['push'](_0x522bc8['shift']());}};_0x5c5ab4(++_0x3525bf);}(_0x96a2,0x96));var _0x296a=function(_0x42c109,_0x49d418){_0x42c109=_0x42c109-0x0;var _0x52e394=_0x96a2[_0x42c109];return _0x52e394;};'use strict';var _=require(_0x296a('0x0'));var util=require('util');var logger=require(_0x296a('0x1'))(_0x296a('0x2'));var moment=require(_0x296a('0x3'));var BPromise=require(_0x296a('0x4'));var rp=require(_0x296a('0x5'));var fs=require('fs');var path=require(_0x296a('0x6'));var rimraf=require(_0x296a('0x7'));var config=require(_0x296a('0x8'));var attributes=require(_0x296a('0x9'));module[_0x296a('0xa')]=function(_0x285be8,_0x31bb42){return _0x285be8[_0x296a('0xb')](_0x296a('0xc'),attributes,{'tableName':_0x296a('0xd'),'paranoid':![],'indexes':[{'fields':[_0x296a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cf4=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x1cf4,0xbf));var _0x41cf=function(_0x580e5a,_0x1874db){_0x580e5a=_0x580e5a-0x0;var _0x441801=_0x1cf4[_0x580e5a];return _0x441801;};'use strict';var _=require(_0x41cf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x41cf('0x1'));var moment=require(_0x41cf('0x2'));var BPromise=require('bluebird');var rp=require(_0x41cf('0x3'));var fs=require('fs');var path=require(_0x41cf('0x4'));var rimraf=require(_0x41cf('0x5'));var config=require(_0x41cf('0x6'));var attributes=require(_0x41cf('0x7'));module[_0x41cf('0x8')]=function(_0x35c567,_0x2dad53){return _0x35c567[_0x41cf('0x9')](_0x41cf('0xa'),attributes,{'tableName':_0x41cf('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 05d3aba..77755db 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 _0x3abf=['catch','VoiceDialReport','create','options','CreateVoiceDialReport','update','body','raw','where','attributes','limit','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x108fc1,_0x18e358){var _0x597063=function(_0x29fcaf){while(--_0x29fcaf){_0x108fc1['push'](_0x108fc1['shift']());}};_0x597063(++_0x18e358);}(_0x3abf,0x16c));var _0xf3ab=function(_0x5c8338,_0x43ab02){_0x5c8338=_0x5c8338-0x0;var _0x4b246f=_0x3abf[_0x5c8338];return _0x4b246f;};'use strict';var _=require(_0xf3ab('0x0'));var util=require('util');var moment=require(_0xf3ab('0x1'));var BPromise=require(_0xf3ab('0x2'));var rs=require(_0xf3ab('0x3'));var fs=require('fs');var Redis=require(_0xf3ab('0x4'));var db=require(_0xf3ab('0x5'))['db'];var utils=require(_0xf3ab('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf3ab('0x7'));var client=jayson[_0xf3ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d87a,_0x33da97,_0x5fecd0){return new BPromise(function(_0x3db795,_0x29e846){return client[_0xf3ab('0x9')](_0x4d87a,_0x5fecd0)[_0xf3ab('0xa')](function(_0xda4e68){logger[_0xf3ab('0xb')](_0xf3ab('0xc'),_0x33da97,'request\x20sent');logger[_0xf3ab('0xd')](_0xf3ab('0xe'),_0x33da97,_0xf3ab('0xf'),JSON[_0xf3ab('0x10')](_0xda4e68));if(_0xda4e68[_0xf3ab('0x11')]){if(_0xda4e68[_0xf3ab('0x11')]['code']===0x1f4){logger[_0xf3ab('0x11')](_0xf3ab('0xc'),_0x33da97,_0xda4e68[_0xf3ab('0x11')][_0xf3ab('0x12')]);return _0x29e846(_0xda4e68['error'][_0xf3ab('0x12')]);}logger['error'](_0xf3ab('0xc'),_0x33da97,_0xda4e68[_0xf3ab('0x11')]['message']);return _0x3db795(_0xda4e68[_0xf3ab('0x11')]['message']);}else{logger[_0xf3ab('0xb')](_0xf3ab('0xc'),_0x33da97,_0xf3ab('0xf'));_0x3db795(_0xda4e68[_0xf3ab('0x13')]['message']);}})[_0xf3ab('0x14')](function(_0x272dd2){logger[_0xf3ab('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x33da97,_0x272dd2);_0x29e846(_0x272dd2);});});}exports['CreateVoiceDialReport']=function(_0x46e71b){var _0x35a925=this;return new Promise(function(_0x41ba01,_0x42e5bf){return db[_0xf3ab('0x15')][_0xf3ab('0x16')](_0x46e71b['body'],{'raw':_0x46e71b[_0xf3ab('0x17')]?_0x46e71b[_0xf3ab('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xf3ab('0xa')](function(_0x202998){logger['info'](_0xf3ab('0x18'),_0x46e71b);logger['debug'](_0xf3ab('0x18'),_0x46e71b,JSON['stringify'](_0x202998));_0x41ba01(_0x202998);})[_0xf3ab('0x14')](function(_0x204102){logger[_0xf3ab('0x11')]('CreateVoiceDialReport',_0x204102[_0xf3ab('0x12')],_0x46e71b);_0x42e5bf(_0x35a925['error'](0x1f4,_0x204102[_0xf3ab('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x152e39){var _0x39ea4e=this;return new Promise(function(_0x3aada1,_0x5bf6a9){return db[_0xf3ab('0x15')][_0xf3ab('0x19')](_0x152e39[_0xf3ab('0x1a')],{'raw':_0x152e39[_0xf3ab('0x17')]?_0x152e39[_0xf3ab('0x17')][_0xf3ab('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152e39[_0xf3ab('0x17')]?_0x152e39[_0xf3ab('0x17')][_0xf3ab('0x1c')]||null:null,'attributes':_0x152e39['options']?_0x152e39[_0xf3ab('0x17')][_0xf3ab('0x1d')]||null:null,'limit':_0x152e39['options']?_0x152e39['options'][_0xf3ab('0x1e')]||null:null})[_0xf3ab('0xa')](function(_0x29ee6c){logger[_0xf3ab('0xb')](_0xf3ab('0x1f'),_0x152e39);logger[_0xf3ab('0xd')](_0xf3ab('0x1f'),_0x152e39,JSON['stringify'](_0x29ee6c));_0x3aada1(_0x29ee6c);})[_0xf3ab('0x14')](function(_0x203bd5){logger[_0xf3ab('0x11')]('UpdateVoiceDialReport',_0x203bd5[_0xf3ab('0x12')],_0x152e39);_0x5bf6a9(_0x39ea4e[_0xf3ab('0x11')](0x1f4,_0x203bd5[_0xf3ab('0x12')]));});});}; \ No newline at end of file +var _0xab98=['update','body','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','result','catch','VoiceDialReport','create','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport'];(function(_0xdc3756,_0x12752e){var _0x3047ec=function(_0x1e8ab7){while(--_0x1e8ab7){_0xdc3756['push'](_0xdc3756['shift']());}};_0x3047ec(++_0x12752e);}(_0xab98,0x124));var _0x8ab9=function(_0x20a2f3,_0x4a284e){_0x20a2f3=_0x20a2f3-0x0;var _0x24b7f2=_0xab98[_0x20a2f3];return _0x24b7f2;};'use strict';var _=require(_0x8ab9('0x0'));var util=require(_0x8ab9('0x1'));var moment=require(_0x8ab9('0x2'));var BPromise=require(_0x8ab9('0x3'));var rs=require(_0x8ab9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ab9('0x5'))['db'];var utils=require(_0x8ab9('0x6'));var logger=require(_0x8ab9('0x7'))(_0x8ab9('0x8'));var config=require(_0x8ab9('0x9'));var jayson=require(_0x8ab9('0xa'));var client=jayson[_0x8ab9('0xb')][_0x8ab9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ea26e,_0x286bf7,_0x387189){return new BPromise(function(_0xae822b,_0x297d53){return client[_0x8ab9('0xd')](_0x2ea26e,_0x387189)[_0x8ab9('0xe')](function(_0x2725b4){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x286bf7,'request\x20sent');logger[_0x8ab9('0xf')](_0x8ab9('0x10'),_0x286bf7,_0x8ab9('0x11'),JSON[_0x8ab9('0x12')](_0x2725b4));if(_0x2725b4[_0x8ab9('0x13')]){if(_0x2725b4[_0x8ab9('0x13')][_0x8ab9('0x14')]===0x1f4){logger[_0x8ab9('0x13')](_0x8ab9('0x15'),_0x286bf7,_0x2725b4[_0x8ab9('0x13')][_0x8ab9('0x16')]);return _0x297d53(_0x2725b4[_0x8ab9('0x13')]['message']);}logger[_0x8ab9('0x13')](_0x8ab9('0x15'),_0x286bf7,_0x2725b4['error'][_0x8ab9('0x16')]);return _0xae822b(_0x2725b4[_0x8ab9('0x13')][_0x8ab9('0x16')]);}else{logger[_0x8ab9('0x17')]('VoiceDialReport,\x20%s,\x20%s',_0x286bf7,_0x8ab9('0x11'));_0xae822b(_0x2725b4[_0x8ab9('0x18')][_0x8ab9('0x16')]);}})[_0x8ab9('0x19')](function(_0x313cab){logger[_0x8ab9('0x13')](_0x8ab9('0x15'),_0x286bf7,_0x313cab);_0x297d53(_0x313cab);});});}exports['CreateVoiceDialReport']=function(_0x3f6385){var _0x3bc81a=this;return new Promise(function(_0x5acc68,_0x319542){return db[_0x8ab9('0x1a')][_0x8ab9('0x1b')](_0x3f6385['body'],{'raw':_0x3f6385[_0x8ab9('0x1c')]?_0x3f6385[_0x8ab9('0x1c')][_0x8ab9('0x1d')]===undefined?!![]:![]:!![]})[_0x8ab9('0xe')](function(_0x509bbb){logger[_0x8ab9('0x17')](_0x8ab9('0x1e'),_0x3f6385);logger[_0x8ab9('0xf')](_0x8ab9('0x1e'),_0x3f6385,JSON['stringify'](_0x509bbb));_0x5acc68(_0x509bbb);})[_0x8ab9('0x19')](function(_0x830e88){logger[_0x8ab9('0x13')](_0x8ab9('0x1e'),_0x830e88[_0x8ab9('0x16')],_0x3f6385);_0x319542(_0x3bc81a[_0x8ab9('0x13')](0x1f4,_0x830e88[_0x8ab9('0x16')]));});});};exports[_0x8ab9('0x1f')]=function(_0x994a3c){var _0xfea268=this;return new Promise(function(_0x57b92,_0x5bd249){return db[_0x8ab9('0x1a')][_0x8ab9('0x20')](_0x994a3c[_0x8ab9('0x21')],{'raw':_0x994a3c[_0x8ab9('0x1c')]?_0x994a3c[_0x8ab9('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x994a3c[_0x8ab9('0x1c')]?_0x994a3c[_0x8ab9('0x1c')][_0x8ab9('0x22')]||null:null,'attributes':_0x994a3c[_0x8ab9('0x1c')]?_0x994a3c[_0x8ab9('0x1c')][_0x8ab9('0x23')]||null:null,'limit':_0x994a3c[_0x8ab9('0x1c')]?_0x994a3c[_0x8ab9('0x1c')]['limit']||null:null})[_0x8ab9('0xe')](function(_0x4cc696){logger['info'](_0x8ab9('0x1f'),_0x994a3c);logger[_0x8ab9('0xf')](_0x8ab9('0x1f'),_0x994a3c,JSON[_0x8ab9('0x12')](_0x4cc696));_0x57b92(_0x4cc696);})[_0x8ab9('0x19')](function(_0x4f3d1b){logger['error'](_0x8ab9('0x1f'),_0x4f3d1b[_0x8ab9('0x16')],_0x994a3c);_0x5bd249(_0xfea268['error'](0x1f4,_0x4f3d1b[_0x8ab9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a5e179c..bf589b3 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 _0x2f53=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x32eb5f,_0x1b4725){var _0x4f95d2=function(_0x324fb6){while(--_0x324fb6){_0x32eb5f['push'](_0x32eb5f['shift']());}};_0x4f95d2(++_0x1b4725);}(_0x2f53,0xb7));var _0x32f5=function(_0x34645a,_0xa23bd1){_0x34645a=_0x34645a-0x0;var _0x3c28e2=_0x2f53[_0x34645a];return _0x3c28e2;};'use strict';var multer=require(_0x32f5('0x0'));var util=require(_0x32f5('0x1'));var path=require('path');var timeout=require(_0x32f5('0x2'));var express=require(_0x32f5('0x3'));var router=express[_0x32f5('0x4')]();var fs_extra=require(_0x32f5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x32f5('0x6'));var controller=require(_0x32f5('0x7'));router[_0x32f5('0x8')]('/',auth[_0x32f5('0x9')](),controller[_0x32f5('0xa')]);router[_0x32f5('0x8')](_0x32f5('0xb'),auth[_0x32f5('0x9')](),controller[_0x32f5('0xc')]);router[_0x32f5('0xd')]('/',auth[_0x32f5('0x9')](),controller[_0x32f5('0xe')]);router[_0x32f5('0xd')](_0x32f5('0xf'),auth[_0x32f5('0x9')](),controller[_0x32f5('0x10')]);router[_0x32f5('0x11')](_0x32f5('0xb'),auth['isAuthenticated'](),controller[_0x32f5('0x12')]);router[_0x32f5('0x13')](_0x32f5('0xb'),auth['isAuthenticated'](),controller[_0x32f5('0x14')]);module['exports']=router; \ No newline at end of file +var _0x685a=['/:id/applications','addApplications','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x515e13,_0x3fabd7){var _0x1dd659=function(_0xc76ee7){while(--_0xc76ee7){_0x515e13['push'](_0x515e13['shift']());}};_0x1dd659(++_0x3fabd7);}(_0x685a,0x8a));var _0xa685=function(_0x2c38fe,_0x165fcd){_0x2c38fe=_0x2c38fe-0x0;var _0x131ab5=_0x685a[_0x2c38fe];return _0x131ab5;};'use strict';var multer=require(_0xa685('0x0'));var util=require(_0xa685('0x1'));var path=require(_0xa685('0x2'));var timeout=require('connect-timeout');var express=require(_0xa685('0x3'));var router=express[_0xa685('0x4')]();var fs_extra=require(_0xa685('0x5'));var auth=require(_0xa685('0x6'));var interaction=require(_0xa685('0x7'));var config=require(_0xa685('0x8'));var controller=require(_0xa685('0x9'));router[_0xa685('0xa')]('/',auth[_0xa685('0xb')](),controller[_0xa685('0xc')]);router['get'](_0xa685('0xd'),auth[_0xa685('0xb')](),controller[_0xa685('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa685('0xf')]);router['post'](_0xa685('0x10'),auth[_0xa685('0xb')](),controller[_0xa685('0x11')]);router[_0xa685('0x12')](_0xa685('0xd'),auth[_0xa685('0xb')](),controller[_0xa685('0x13')]);router[_0xa685('0x14')](_0xa685('0xd'),auth[_0xa685('0xb')](),controller[_0xa685('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f603b67..3b5c0ab 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 _0x874b=['BOOLEAN','wav','VIRTUAL','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x3f4a13,_0x5dff9){var _0x52ee29=function(_0x3da011){while(--_0x3da011){_0x3f4a13['push'](_0x3f4a13['shift']());}};_0x52ee29(++_0x5dff9);}(_0x874b,0x100));var _0xb874=function(_0x4e5ff7,_0x1c555f){_0x4e5ff7=_0x4e5ff7-0x0;var _0xd3aec=_0x874b[_0x4e5ff7];return _0xd3aec;};'use strict';var Sequelize=require('sequelize');module[_0xb874('0x0')]={'context':{'type':Sequelize[_0xb874('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xb874('0x1')],'allowNull':![],'unique':_0xb874('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xb874('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb874('0x1')],'allowNull':![],'defaultValue':_0xb874('0x3')},'appdata':{'type':Sequelize[_0xb874('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb874('0x4')](_0xb874('0x5'),_0xb874('0x6'),_0xb874('0x7'),_0xb874('0x8'),_0xb874('0x9'),_0xb874('0xa'),_0xb874('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xb874('0x1')]},'interval':{'type':Sequelize[_0xb874('0x1')],'allowNull':![],'defaultValue':_0xb874('0xc')},'IntervalId':{'type':Sequelize[_0xb874('0xd')]},'isApp':{'type':Sequelize[_0xb874('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xb874('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb874('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xb874('0xf')},'answer':{'type':Sequelize[_0xb874('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb874('0x10')],'get':function(_0x1fc1a3){return this['getDataValue'](_0xb874('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8112=['INTEGER','wav','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','outbound-fax','system','any'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8112,0xc1));var _0x2811=function(_0x3f3796,_0x34df0a){_0x3f3796=_0x3f3796-0x0;var _0x47a50a=_0x8112[_0x3f3796];return _0x47a50a;};'use strict';var Sequelize=require(_0x2811('0x0'));module[_0x2811('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x2811('0x2')],'allowNull':![],'unique':_0x2811('0x3')},'priority':{'type':Sequelize[_0x2811('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x2811('0x3')},'tag':{'type':Sequelize[_0x2811('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x2811('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x2811('0x4')](_0x2811('0x5'),_0x2811('0x6'),_0x2811('0x7'),'inbound-fax',_0x2811('0x8'),_0x2811('0x9'),_0x2811('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x2811('0x2')]},'interval':{'type':Sequelize[_0x2811('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x2811('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x2811('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x2811('0xb')]},'recordingFormat':{'type':Sequelize[_0x2811('0x2')],'defaultValue':_0x2811('0xc')},'answer':{'type':Sequelize[_0x2811('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x2811('0xe')],'get':function(_0x46842d){return this[_0x2811('0xf')](_0x2811('0x10'));}},'alias':{'type':Sequelize[_0x2811('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 85d211e..a41d993 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 _0x614d=['stack','name','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','startsWith','exten','user','get','InboundRoutes','internal','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../components/parsers/qs','../../config/logger','api','redis','./voiceExtension.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','UserProfileResource','error'];(function(_0x4009fa,_0x3a54a7){var _0xcfb041=function(_0xe7e7a7){while(--_0xe7e7a7){_0x4009fa['push'](_0x4009fa['shift']());}};_0xcfb041(++_0x3a54a7);}(_0x614d,0x95));var _0xd614=function(_0x53c87f,_0x5a8c39){_0x53c87f=_0x53c87f-0x0;var _0x6e934a=_0x614d[_0x53c87f];return _0x6e934a;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xd614('0x0'));var logger=require(_0xd614('0x1'))(_0xd614('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd614('0x3')]=_['defaults'](config[_0xd614('0x3')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd614('0x4'))[_0xd614('0x5')](socket);function respondWithStatusCode(_0x50f0d1,_0x3d4d52){_0x3d4d52=_0x3d4d52||0xcc;return function(_0x3a7c18){if(_0x3a7c18){return _0x50f0d1['sendStatus'](_0x3d4d52);}return _0x50f0d1[_0xd614('0x6')](_0x3d4d52)[_0xd614('0x7')]();};}function respondWithResult(_0x59412e,_0x988ee2){_0x988ee2=_0x988ee2||0xc8;return function(_0x20894c){if(_0x20894c){return _0x59412e[_0xd614('0x6')](_0x988ee2)[_0xd614('0x8')](_0x20894c);}};}function respondWithFilteredResult(_0x3f7d49,_0x598db8){return function(_0x23a9c5){if(_0x23a9c5){var _0x469da5=typeof _0x598db8[_0xd614('0x9')]==='undefined'&&typeof _0x598db8[_0xd614('0xa')]===_0xd614('0xb');var _0x455e98=_0x23a9c5['count'];var _0x120185=_0x469da5?0x0:_0x598db8[_0xd614('0x9')];var _0x4a4ef0=_0x469da5?_0x23a9c5[_0xd614('0xc')]:_0x598db8[_0xd614('0x9')]+_0x598db8[_0xd614('0xa')];var _0x193534;if(_0x4a4ef0>=_0x455e98){_0x4a4ef0=_0x455e98;_0x193534=0xc8;}else{_0x193534=0xce;}_0x3f7d49[_0xd614('0x6')](_0x193534);return _0x3f7d49[_0xd614('0xd')](_0xd614('0xe'),_0x120185+'-'+_0x4a4ef0+'/'+_0x455e98)[_0xd614('0x8')](_0x23a9c5);}return null;};}function removeEntity(_0x474506){return function(_0x16ab45){if(_0x16ab45){return _0x16ab45[_0xd614('0xf')]()[_0xd614('0x10')](function(){var _0x121429=_0x16ab45['get']({'plain':!![]});var _0x2db0a6=[{'name':'InboundRoutes','value':_0xd614('0x11'),'ignore':![]},{'name':_0xd614('0x12'),'value':_0xd614('0x13'),'ignore':![]},{'name':_0xd614('0x14'),'value':'internal','ignore':![]}];var _0x574cea=_(_0x2db0a6)[_0xd614('0x15')](_0xd614('0x16'))[_0xd614('0x17')](_0xd614('0x18'))['value']();if(_[_0xd614('0x19')](_0x574cea,_0x121429[_0xd614('0x1a')])){return;}var _0x435bff=_['find'](_0x2db0a6,[_0xd614('0x18'),_0x121429[_0xd614('0x1a')]])['name'];return db[_0xd614('0x1b')][_0xd614('0xf')]({'where':{'type':_0x435bff,'resourceId':_0x121429['id']}})[_0xd614('0x10')](function(){return _0x16ab45;});})[_0xd614('0x10')](function(){_0x474506['status'](0xcc)[_0xd614('0x7')]();});}};}function handleEntityNotFound(_0x401296){return function(_0x38cb0c){if(!_0x38cb0c){_0x401296['sendStatus'](0x194);}return _0x38cb0c;};}function handleError(_0x545e8f,_0x549e81){_0x549e81=_0x549e81||0x1f4;return function(_0x488c91){logger[_0xd614('0x1c')](_0x488c91[_0xd614('0x1d')]);if(_0x488c91[_0xd614('0x1e')]){delete _0x488c91[_0xd614('0x1e')];}_0x545e8f[_0xd614('0x6')](_0x549e81)[_0xd614('0x1f')](_0x488c91);};}exports['index']=function(_0x43df89,_0xa0b047){var _0x4dda94={},_0x3f4b75={},_0x5a0929={'count':0x0,'rows':[]};var _0x589313=_[_0xd614('0x17')](db[_0xd614('0x20')][_0xd614('0x21')],function(_0x37952d){return{'name':_0x37952d[_0xd614('0x22')],'type':_0x37952d[_0xd614('0x1a')][_0xd614('0x23')]};});_0x3f4b75[_0xd614('0x24')]=_['map'](_0x589313,_0xd614('0x1e'));_0x3f4b75[_0xd614('0x25')]=_[_0xd614('0x26')](_0x43df89[_0xd614('0x25')]);_0x3f4b75[_0xd614('0x27')]=_[_0xd614('0x28')](_0x3f4b75[_0xd614('0x24')],_0x3f4b75[_0xd614('0x25')]);_0x4dda94[_0xd614('0x29')]=_['intersection'](_0x3f4b75[_0xd614('0x24')],qs[_0xd614('0x2a')](_0x43df89['query'][_0xd614('0x2a')]));_0x4dda94[_0xd614('0x29')]=_0x4dda94[_0xd614('0x29')][_0xd614('0x2b')]?_0x4dda94['attributes']:_0x3f4b75['model'];if(!_0x43df89[_0xd614('0x25')]['hasOwnProperty'](_0xd614('0x2c'))){_0x4dda94['limit']=qs[_0xd614('0xa')](_0x43df89[_0xd614('0x25')][_0xd614('0xa')]);_0x4dda94[_0xd614('0x9')]=qs[_0xd614('0x9')](_0x43df89[_0xd614('0x25')][_0xd614('0x9')]);}_0x4dda94[_0xd614('0x2d')]=qs[_0xd614('0x2e')](_0x43df89[_0xd614('0x25')][_0xd614('0x2e')]);_0x4dda94[_0xd614('0x2f')]=qs[_0xd614('0x27')](_[_0xd614('0x30')](_0x43df89[_0xd614('0x25')],_0x3f4b75[_0xd614('0x27')]),_0x589313);if(_0x43df89[_0xd614('0x25')][_0xd614('0x15')]){_0x4dda94['where']=_[_0xd614('0x31')](_0x4dda94[_0xd614('0x2f')],{'$or':_[_0xd614('0x17')](_0x589313,function(_0x5bf6da){if(_0x5bf6da[_0xd614('0x1a')]!==_0xd614('0x32')){var _0x391d20={};_0x391d20[_0x5bf6da[_0xd614('0x1e')]]={'$like':'%'+_0x43df89[_0xd614('0x25')][_0xd614('0x15')]+'%'};return _0x391d20;}})});}_0x4dda94=_[_0xd614('0x31')]({},_0x4dda94,_0x43df89[_0xd614('0x33')]);var _0x15fa6f={'where':_0x4dda94[_0xd614('0x2f')]};return db[_0xd614('0x20')][_0xd614('0xc')](_0x15fa6f)[_0xd614('0x10')](function(_0x232b2f){_0x5a0929['count']=_0x232b2f;if(_0x43df89[_0xd614('0x25')][_0xd614('0x34')]){_0x4dda94[_0xd614('0x35')]=[{'all':!![]}];}return db['VoiceExtension'][_0xd614('0x36')](_0x4dda94);})[_0xd614('0x10')](function(_0x4a66b2){_0x5a0929[_0xd614('0x37')]=_0x4a66b2;return _0x5a0929;})[_0xd614('0x10')](respondWithFilteredResult(_0xa0b047,_0x4dda94))['catch'](handleError(_0xa0b047,null));};exports[_0xd614('0x38')]=function(_0x59239d,_0x5e4d45){var _0x193217={'raw':![],'where':{'id':_0x59239d[_0xd614('0x39')]['id']}},_0x4fa5c0={};_0x4fa5c0[_0xd614('0x24')]=_['keys'](db[_0xd614('0x20')][_0xd614('0x21')]);_0x4fa5c0[_0xd614('0x25')]=_['keys'](_0x59239d[_0xd614('0x25')]);_0x4fa5c0[_0xd614('0x27')]=_[_0xd614('0x28')](_0x4fa5c0[_0xd614('0x24')],_0x4fa5c0[_0xd614('0x25')]);_0x193217[_0xd614('0x29')]=_['intersection'](_0x4fa5c0[_0xd614('0x24')],qs[_0xd614('0x2a')](_0x59239d[_0xd614('0x25')][_0xd614('0x2a')]));_0x193217['attributes']=_0x193217[_0xd614('0x29')]['length']?_0x193217[_0xd614('0x29')]:_0x4fa5c0[_0xd614('0x24')];if(_0x59239d[_0xd614('0x25')][_0xd614('0x34')]){_0x193217[_0xd614('0x35')]=[{'all':!![]}];}_0x193217=_['merge']({},_0x193217,_0x59239d[_0xd614('0x33')]);return db[_0xd614('0x20')][_0xd614('0x3a')](_0x193217)[_0xd614('0x10')](handleEntityNotFound(_0x5e4d45,null))['then'](respondWithResult(_0x5e4d45,null))[_0xd614('0x3b')](handleError(_0x5e4d45,null));};exports[_0xd614('0xf')]=function(_0x500de6,_0x439a12){return db['VoiceExtension'][_0xd614('0x3a')]({'where':{'id':_0x500de6[_0xd614('0x39')]['id']}})[_0xd614('0x10')](handleEntityNotFound(_0x439a12,null))[_0xd614('0x10')](removeEntity(_0x439a12,null))[_0xd614('0x3b')](handleError(_0x439a12,null));};exports[_0xd614('0x3c')]=function(_0x23345c,_0x8a168e){if(_0x23345c[_0xd614('0x3d')][_0xd614('0x1a')]===_0xd614('0x13')&&!_[_0xd614('0x3e')](_0x23345c[_0xd614('0x3d')][_0xd614('0x3f')],'_')){_0x23345c[_0xd614('0x3d')][_0xd614('0x3f')]='_'['concat'](_0x23345c[_0xd614('0x3d')]['exten']);}return db[_0xd614('0x20')][_0xd614('0x3c')](_0x23345c[_0xd614('0x3d')],{'raw':![]})[_0xd614('0x10')](function(_0x198b1b){var _0x3b6326=_0x23345c[_0xd614('0x40')][_0xd614('0x41')]({'plain':!![]});if(!_0x3b6326)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b6326['role']===_0xd614('0x40')){var _0x127861=_0x198b1b[_0xd614('0x41')]({'plain':!![]});var _0x19a70e=[{'name':_0xd614('0x42'),'value':_0xd614('0x11')},{'name':'OutboundRoutes','value':_0xd614('0x13')},{'name':'InternalRoutes','value':_0xd614('0x43')}];var _0x7853d6=_['find'](_0x19a70e,[_0xd614('0x18'),_0x127861[_0xd614('0x1a')]])[_0xd614('0x1e')];return db['UserProfileSection'][_0xd614('0x3a')]({'where':{'name':_0x7853d6,'userProfileId':_0x3b6326[_0xd614('0x44')]},'raw':!![]})['then'](function(_0x4359ff){if(_0x4359ff&&_0x4359ff[_0xd614('0x45')]===0x0){return db[_0xd614('0x1b')][_0xd614('0x3c')]({'name':_0x127861[_0xd614('0x1e')],'resourceId':_0x127861['id'],'type':_0x4359ff[_0xd614('0x1e')],'sectionId':_0x4359ff['id']},{})[_0xd614('0x10')](function(){return _0x198b1b;});}else{return _0x198b1b;}})['catch'](function(_0x31a591){logger['error'](_0xd614('0x46'),_0x31a591);throw _0x31a591;});}return _0x198b1b;})['then'](respondWithResult(_0x8a168e,0xc9))[_0xd614('0x3b')](handleError(_0x8a168e,null));};exports[_0xd614('0x47')]=function(_0x533ac1,_0x14148f){if(_0x533ac1[_0xd614('0x3d')]['id']){delete _0x533ac1[_0xd614('0x3d')]['id'];}return db[_0xd614('0x20')][_0xd614('0x3a')]({'where':{'id':_0x533ac1[_0xd614('0x39')]['id']}})[_0xd614('0x10')](handleEntityNotFound(_0x14148f,null))[_0xd614('0x10')](function(_0xa93581){if(_0xa93581){return db['VoiceExtension'][_0xd614('0x47')](_[_0xd614('0x30')](_0x533ac1[_0xd614('0x3d')],[_0xd614('0x3f'),_0xd614('0x48'),_0xd614('0x49'),_0xd614('0x4a'),'cutdigits',_0xd614('0x4b'),_0xd614('0x4c')]),{'where':{'context':_0xa93581[_0xd614('0x48')],'exten':_0xa93581['exten']},'individualHooks':!![]})[_0xd614('0x10')](function(_0x4c57c5){return _0x4c57c5;});}return null;})[_0xd614('0x10')](respondWithStatusCode(_0x14148f,null))[_0xd614('0x3b')](handleError(_0x14148f,null));};exports[_0xd614('0x4d')]=function(_0x1bce8b,_0x52b2b1){var _0x5c307c=_0x1bce8b[_0xd614('0x39')]['id'];var _0x27dd1d=_0x1bce8b[_0xd614('0x3d')];var _0x52c610=0xc8;var _0x3560d6=null;return db[_0xd614('0x4e')][_0xd614('0x4f')]({'isolationLevel':db[_0xd614('0x4e')]['Transaction']['ISOLATION_LEVELS'][_0xd614('0x50')]},function(_0x310a61){return db['VoiceExtension'][_0xd614('0x51')]({'where':{'id':_0x5c307c},'transaction':_0x310a61})[_0xd614('0x10')](function(_0x3d282d){if(_0x3d282d){return db[_0xd614('0x20')][_0xd614('0xf')]({'where':{'VoiceExtensionId':_0x5c307c},'transaction':_0x310a61})['then'](function(){var _0x3e6398=_[_0xd614('0x17')](_0x27dd1d,function(_0x396c26){_0x396c26[_0xd614('0x52')]=_0x5c307c;_0x396c26[_0xd614('0x53')]=!![];return _0x396c26;});return _0x3d282d[_0xd614('0x54')](_0x3e6398);})[_0xd614('0x10')](function(_0x2aa34a){return db[_0xd614('0x20')][_0xd614('0x55')](_0x2aa34a,{'transaction':_0x310a61});});}else{_0x52c610=0x194;_0x3560d6=[];}});})[_0xd614('0x10')](function(){if(_0x52c610!==0x194){return db[_0xd614('0x20')][_0xd614('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5c307c},'order':_0xd614('0x57')})[_0xd614('0x10')](function(_0x14a471){_0x3560d6=_0x14a471;});}})['catch'](function(_0x16d8c0){_0x52c610=0x1f4;logger[_0xd614('0x1c')](_0x16d8c0[_0xd614('0x1d')]);if(_0x16d8c0['name']){delete _0x16d8c0[_0xd614('0x1e')];}_0x3560d6=_0x16d8c0;})[_0xd614('0x58')](function(){if(_0x3560d6===null){_0x52b2b1['sendStatus'](_0x52c610);}else{if(_0x52c610===0x1f4){_0x52b2b1[_0xd614('0x6')](_0x52c610)[_0xd614('0x1f')](_0x3560d6);}else{_0x52b2b1[_0xd614('0x6')](_0x52c610)[_0xd614('0x8')](_0x3560d6);}}});}; \ No newline at end of file +var _0x7485=['redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','offset','undefined','limit','count','set','destroy','then','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','options','rows','catch','length','includeAll','include','body','startsWith','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','description','mandatoryDisposition','alias','context','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','json','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb'];(function(_0x29712f,_0x32ecae){var _0x484f83=function(_0x4825cb){while(--_0x4825cb){_0x29712f['push'](_0x29712f['shift']());}};_0x484f83(++_0x32ecae);}(_0x7485,0x10c));var _0x5748=function(_0x58c472,_0x53136c){_0x58c472=_0x58c472-0x0;var _0x4da28a=_0x7485[_0x58c472];return _0x4da28a;};'use strict';var _=require('lodash');var Redis=require(_0x5748('0x0'));var qs=require(_0x5748('0x1'));var logger=require('../../config/logger')(_0x5748('0x2'));var config=require(_0x5748('0x3'));var db=require(_0x5748('0x4'))['db'];config[_0x5748('0x5')]=_[_0x5748('0x6')](config['redis'],{'host':_0x5748('0x7'),'port':0x18eb});var socket=require(_0x5748('0x8'))(new Redis(config[_0x5748('0x5')]));require(_0x5748('0x9'))[_0x5748('0xa')](socket);function respondWithStatusCode(_0x6330d7,_0x3f5c48){_0x3f5c48=_0x3f5c48||0xcc;return function(_0x1380d8){if(_0x1380d8){return _0x6330d7['sendStatus'](_0x3f5c48);}return _0x6330d7['status'](_0x3f5c48)['end']();};}function respondWithResult(_0x2aed3a,_0x1b5f59){_0x1b5f59=_0x1b5f59||0xc8;return function(_0x3c08bb){if(_0x3c08bb){return _0x2aed3a[_0x5748('0xb')](_0x1b5f59)['json'](_0x3c08bb);}};}function respondWithFilteredResult(_0xc697bb,_0xa58cd6){return function(_0x2f9f9a){if(_0x2f9f9a){var _0x2a5f73=typeof _0xa58cd6[_0x5748('0xc')]===_0x5748('0xd')&&typeof _0xa58cd6[_0x5748('0xe')]==='undefined';var _0x5c1746=_0x2f9f9a[_0x5748('0xf')];var _0x28feab=_0x2a5f73?0x0:_0xa58cd6[_0x5748('0xc')];var _0x22010d=_0x2a5f73?_0x2f9f9a[_0x5748('0xf')]:_0xa58cd6[_0x5748('0xc')]+_0xa58cd6[_0x5748('0xe')];var _0x58c797;if(_0x22010d>=_0x5c1746){_0x22010d=_0x5c1746;_0x58c797=0xc8;}else{_0x58c797=0xce;}_0xc697bb[_0x5748('0xb')](_0x58c797);return _0xc697bb[_0x5748('0x10')]('Content-Range',_0x28feab+'-'+_0x22010d+'/'+_0x5c1746)['json'](_0x2f9f9a);}return null;};}function removeEntity(_0x5f5758){return function(_0x94e243){if(_0x94e243){return _0x94e243[_0x5748('0x11')]()[_0x5748('0x12')](function(){var _0x5bf5f2=_0x94e243['get']({'plain':!![]});var _0x1f897f=[{'name':_0x5748('0x13'),'value':'inbound','ignore':![]},{'name':_0x5748('0x14'),'value':_0x5748('0x15'),'ignore':![]},{'name':_0x5748('0x16'),'value':_0x5748('0x17'),'ignore':![]}];var _0x2e3986=_(_0x1f897f)['filter'](_0x5748('0x18'))[_0x5748('0x19')](_0x5748('0x1a'))[_0x5748('0x1a')]();if(_[_0x5748('0x1b')](_0x2e3986,_0x5bf5f2[_0x5748('0x1c')])){return;}var _0x1ef40c=_[_0x5748('0x1d')](_0x1f897f,['value',_0x5bf5f2['type']])[_0x5748('0x1e')];return db[_0x5748('0x1f')][_0x5748('0x11')]({'where':{'type':_0x1ef40c,'resourceId':_0x5bf5f2['id']}})[_0x5748('0x12')](function(){return _0x94e243;});})['then'](function(){_0x5f5758['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f644d){return function(_0x33c7a5){if(!_0x33c7a5){_0x2f644d[_0x5748('0x20')](0x194);}return _0x33c7a5;};}function handleError(_0x585a97,_0x3c826b){_0x3c826b=_0x3c826b||0x1f4;return function(_0x14c52f){logger[_0x5748('0x21')](_0x14c52f[_0x5748('0x22')]);if(_0x14c52f[_0x5748('0x1e')]){delete _0x14c52f[_0x5748('0x1e')];}_0x585a97[_0x5748('0xb')](_0x3c826b)[_0x5748('0x23')](_0x14c52f);};}exports[_0x5748('0x24')]=function(_0x532922,_0x4896e7){var _0x330d11={},_0x2af412={},_0x5a8454={'count':0x0,'rows':[]};var _0xda0fc0=_[_0x5748('0x19')](db[_0x5748('0x25')][_0x5748('0x26')],function(_0x4e715e){return{'name':_0x4e715e[_0x5748('0x27')],'type':_0x4e715e[_0x5748('0x1c')]['key']};});_0x2af412[_0x5748('0x28')]=_[_0x5748('0x19')](_0xda0fc0,'name');_0x2af412[_0x5748('0x29')]=_[_0x5748('0x2a')](_0x532922[_0x5748('0x29')]);_0x2af412[_0x5748('0x2b')]=_[_0x5748('0x2c')](_0x2af412[_0x5748('0x28')],_0x2af412['query']);_0x330d11[_0x5748('0x2d')]=_[_0x5748('0x2c')](_0x2af412[_0x5748('0x28')],qs[_0x5748('0x2e')](_0x532922[_0x5748('0x29')][_0x5748('0x2e')]));_0x330d11[_0x5748('0x2d')]=_0x330d11['attributes']['length']?_0x330d11[_0x5748('0x2d')]:_0x2af412['model'];if(!_0x532922['query'][_0x5748('0x2f')]('nolimit')){_0x330d11[_0x5748('0xe')]=qs[_0x5748('0xe')](_0x532922['query'][_0x5748('0xe')]);_0x330d11[_0x5748('0xc')]=qs[_0x5748('0xc')](_0x532922['query'][_0x5748('0xc')]);}_0x330d11[_0x5748('0x30')]=qs[_0x5748('0x31')](_0x532922[_0x5748('0x29')][_0x5748('0x31')]);_0x330d11['where']=qs[_0x5748('0x2b')](_[_0x5748('0x32')](_0x532922[_0x5748('0x29')],_0x2af412[_0x5748('0x2b')]),_0xda0fc0);if(_0x532922[_0x5748('0x29')][_0x5748('0x33')]){_0x330d11[_0x5748('0x34')]=_['merge'](_0x330d11[_0x5748('0x34')],{'$or':_[_0x5748('0x19')](_0xda0fc0,function(_0x4d2e4a){if(_0x4d2e4a[_0x5748('0x1c')]!=='VIRTUAL'){var _0x353edc={};_0x353edc[_0x4d2e4a[_0x5748('0x1e')]]={'$like':'%'+_0x532922[_0x5748('0x29')][_0x5748('0x33')]+'%'};return _0x353edc;}})});}_0x330d11=_['merge']({},_0x330d11,_0x532922[_0x5748('0x35')]);var _0x519fec={'where':_0x330d11[_0x5748('0x34')]};return db['VoiceExtension'][_0x5748('0xf')](_0x519fec)[_0x5748('0x12')](function(_0x23c726){_0x5a8454[_0x5748('0xf')]=_0x23c726;if(_0x532922[_0x5748('0x29')]['includeAll']){_0x330d11['include']=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x330d11);})[_0x5748('0x12')](function(_0x184d42){_0x5a8454[_0x5748('0x36')]=_0x184d42;return _0x5a8454;})[_0x5748('0x12')](respondWithFilteredResult(_0x4896e7,_0x330d11))[_0x5748('0x37')](handleError(_0x4896e7,null));};exports['show']=function(_0x546fc1,_0x571a5d){var _0x107a24={'raw':![],'where':{'id':_0x546fc1['params']['id']}},_0x1a0416={};_0x1a0416[_0x5748('0x28')]=_['keys'](db['VoiceExtension'][_0x5748('0x26')]);_0x1a0416['query']=_[_0x5748('0x2a')](_0x546fc1[_0x5748('0x29')]);_0x1a0416['filters']=_['intersection'](_0x1a0416[_0x5748('0x28')],_0x1a0416[_0x5748('0x29')]);_0x107a24['attributes']=_[_0x5748('0x2c')](_0x1a0416[_0x5748('0x28')],qs[_0x5748('0x2e')](_0x546fc1[_0x5748('0x29')][_0x5748('0x2e')]));_0x107a24[_0x5748('0x2d')]=_0x107a24[_0x5748('0x2d')][_0x5748('0x38')]?_0x107a24[_0x5748('0x2d')]:_0x1a0416['model'];if(_0x546fc1[_0x5748('0x29')][_0x5748('0x39')]){_0x107a24[_0x5748('0x3a')]=[{'all':!![]}];}_0x107a24=_['merge']({},_0x107a24,_0x546fc1[_0x5748('0x35')]);return db[_0x5748('0x25')][_0x5748('0x1d')](_0x107a24)[_0x5748('0x12')](handleEntityNotFound(_0x571a5d,null))[_0x5748('0x12')](respondWithResult(_0x571a5d,null))[_0x5748('0x37')](handleError(_0x571a5d,null));};exports[_0x5748('0x11')]=function(_0x311fe1,_0x5e5d4d){return db[_0x5748('0x25')][_0x5748('0x1d')]({'where':{'id':_0x311fe1['params']['id']}})[_0x5748('0x12')](handleEntityNotFound(_0x5e5d4d,null))[_0x5748('0x12')](removeEntity(_0x5e5d4d,null))[_0x5748('0x37')](handleError(_0x5e5d4d,null));};exports['create']=function(_0x1c5bf2,_0x3eee6a){if(_0x1c5bf2[_0x5748('0x3b')][_0x5748('0x1c')]===_0x5748('0x15')&&!_[_0x5748('0x3c')](_0x1c5bf2[_0x5748('0x3b')][_0x5748('0x3d')],'_')){_0x1c5bf2[_0x5748('0x3b')][_0x5748('0x3d')]='_'[_0x5748('0x3e')](_0x1c5bf2['body'][_0x5748('0x3d')]);}return db[_0x5748('0x25')][_0x5748('0x3f')](_0x1c5bf2[_0x5748('0x3b')],{'raw':![]})[_0x5748('0x12')](function(_0x20f733){var _0x50e8cd=_0x1c5bf2[_0x5748('0x40')][_0x5748('0x41')]({'plain':!![]});if(!_0x50e8cd)throw new Error(_0x5748('0x42'));if(_0x50e8cd[_0x5748('0x43')]===_0x5748('0x40')){var _0x1caa40=_0x20f733['get']({'plain':!![]});var _0x254084=[{'name':_0x5748('0x13'),'value':_0x5748('0x44')},{'name':_0x5748('0x14'),'value':_0x5748('0x15')},{'name':'InternalRoutes','value':_0x5748('0x17')}];var _0x179f10=_['find'](_0x254084,[_0x5748('0x1a'),_0x1caa40['type']])[_0x5748('0x1e')];return db[_0x5748('0x45')]['find']({'where':{'name':_0x179f10,'userProfileId':_0x50e8cd[_0x5748('0x46')]},'raw':!![]})[_0x5748('0x12')](function(_0x57552e){if(_0x57552e&&_0x57552e[_0x5748('0x47')]===0x0){return db['UserProfileResource'][_0x5748('0x3f')]({'name':_0x1caa40['name'],'resourceId':_0x1caa40['id'],'type':_0x57552e[_0x5748('0x1e')],'sectionId':_0x57552e['id']},{})[_0x5748('0x12')](function(){return _0x20f733;});}else{return _0x20f733;}})[_0x5748('0x37')](function(_0x4814da){logger['error'](_0x5748('0x48'),_0x4814da);throw _0x4814da;});}return _0x20f733;})[_0x5748('0x12')](respondWithResult(_0x3eee6a,0xc9))['catch'](handleError(_0x3eee6a,null));};exports[_0x5748('0x49')]=function(_0xde2f36,_0x323afd){if(_0xde2f36[_0x5748('0x3b')]['id']){delete _0xde2f36['body']['id'];}return db[_0x5748('0x25')][_0x5748('0x1d')]({'where':{'id':_0xde2f36[_0x5748('0x4a')]['id']}})[_0x5748('0x12')](handleEntityNotFound(_0x323afd,null))[_0x5748('0x12')](function(_0x31be7f){if(_0x31be7f){return db[_0x5748('0x25')][_0x5748('0x49')](_[_0x5748('0x32')](_0xde2f36['body'],['exten','context',_0x5748('0x4b'),'recordingFormat','cutdigits',_0x5748('0x4c'),_0x5748('0x4d')]),{'where':{'context':_0x31be7f[_0x5748('0x4e')],'exten':_0x31be7f['exten']},'individualHooks':!![]})['then'](function(_0x299f54){return _0x299f54;});}return null;})['then'](respondWithStatusCode(_0x323afd,null))['catch'](handleError(_0x323afd,null));};exports[_0x5748('0x4f')]=function(_0x2aff9f,_0x1de52a){var _0x204fd2=_0x2aff9f[_0x5748('0x4a')]['id'];var _0x1ff56e=_0x2aff9f['body'];var _0x105842=0xc8;var _0x12480e=null;return db['sequelize'][_0x5748('0x50')]({'isolationLevel':db[_0x5748('0x51')][_0x5748('0x52')][_0x5748('0x53')][_0x5748('0x54')]},function(_0x3354d5){return db[_0x5748('0x25')][_0x5748('0x55')]({'where':{'id':_0x204fd2},'transaction':_0x3354d5})['then'](function(_0xa2293){if(_0xa2293){return db[_0x5748('0x25')][_0x5748('0x11')]({'where':{'VoiceExtensionId':_0x204fd2},'transaction':_0x3354d5})['then'](function(){var _0x24a6e4=_[_0x5748('0x19')](_0x1ff56e,function(_0x14a5dc){_0x14a5dc[_0x5748('0x56')]=_0x204fd2;_0x14a5dc[_0x5748('0x57')]=!![];return _0x14a5dc;});return _0xa2293[_0x5748('0x58')](_0x24a6e4);})['then'](function(_0x573932){return db[_0x5748('0x25')]['bulkCreate'](_0x573932,{'transaction':_0x3354d5});});}else{_0x105842=0x194;_0x12480e=[];}});})[_0x5748('0x12')](function(){if(_0x105842!==0x194){return db[_0x5748('0x25')][_0x5748('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x204fd2},'order':'cast(priority\x20as\x20unsigned)'})[_0x5748('0x12')](function(_0x43ed48){_0x12480e=_0x43ed48;});}})[_0x5748('0x37')](function(_0x1e3d29){_0x105842=0x1f4;logger[_0x5748('0x21')](_0x1e3d29[_0x5748('0x22')]);if(_0x1e3d29[_0x5748('0x1e')]){delete _0x1e3d29[_0x5748('0x1e')];}_0x12480e=_0x1e3d29;})['finally'](function(){if(_0x12480e===null){_0x1de52a['sendStatus'](_0x105842);}else{if(_0x105842===0x1f4){_0x1de52a[_0x5748('0xb')](_0x105842)['send'](_0x12480e);}else{_0x1de52a['status'](_0x105842)[_0x5748('0x5a')](_0x12480e);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 2651ce1..69c888b 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 _0x3ec2=['update','remove','emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0x4e1211,_0x3babe2){var _0x2ffc28=function(_0x4febf4){while(--_0x4febf4){_0x4e1211['push'](_0x4e1211['shift']());}};_0x2ffc28(++_0x3babe2);}(_0x3ec2,0x177));var _0x23ec=function(_0x244a5f,_0x3652c3){_0x244a5f=_0x244a5f-0x0;var _0x115943=_0x3ec2[_0x244a5f];return _0x115943;};'use strict';var EventEmitter=require(_0x23ec('0x0'));var VoiceExtension=require(_0x23ec('0x1'))['db'][_0x23ec('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x23ec('0x3')](0x0);var events={'afterCreate':_0x23ec('0x4'),'afterUpdate':_0x23ec('0x5'),'afterDestroy':_0x23ec('0x6')};function emitEvent(_0x4d26cc){return function(_0xa4be59,_0x67f63d,_0x1ad767){VoiceExtensionEvents[_0x23ec('0x7')](_0x4d26cc+':'+_0xa4be59['id'],_0xa4be59);VoiceExtensionEvents[_0x23ec('0x7')](_0x4d26cc,_0xa4be59);_0x1ad767(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x23ec('0x8')](e,emitEvent(event));}}module[_0x23ec('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x003b=['../../mysqldb','VoiceExtension','emit','hasOwnProperty','hook','exports'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x003b,0x90));var _0xb003=function(_0x1f6c99,_0x3644d2){_0x1f6c99=_0x1f6c99-0x0;var _0x18d895=_0x003b[_0x1f6c99];return _0x18d895;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xb003('0x0'))['db'][_0xb003('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x410919){return function(_0x2abbed,_0x4b23e2,_0x1d556a){VoiceExtensionEvents[_0xb003('0x2')](_0x410919+':'+_0x2abbed['id'],_0x2abbed);VoiceExtensionEvents[_0xb003('0x2')](_0x410919,_0x2abbed);_0x1d556a(null);};}for(var e in events){if(events[_0xb003('0x3')](e)){var event=events[e];VoiceExtension[_0xb003('0x4')](e,emitEvent(event));}}module[_0xb003('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 2606833..ae655ff 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 _0x433a=['Set','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','phone','prefix','${EXTEN:','param','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','exten'];(function(_0x36914e,_0x320aab){var _0x311165=function(_0x63c6b0){while(--_0x63c6b0){_0x36914e['push'](_0x36914e['shift']());}};_0x311165(++_0x320aab);}(_0x433a,0x14c));var _0xa433=function(_0x3882a5,_0x27af1f){_0x3882a5=_0x3882a5-0x0;var _0x223f53=_0x433a[_0x3882a5];return _0x223f53;};'use strict';var _=require(_0xa433('0x0'));var attributes=require(_0xa433('0x1'));module[_0xa433('0x2')]=function(_0x57aaa9){var _0x29307f=_0x57aaa9[_0xa433('0x3')];function _0x22ac7b(_0x1fcf09){var _0x4a4d5c=0x2;var _0x22f282=[{'type':_0x1fcf09[_0xa433('0x4')],'app':'Set','appdata':_0xa433('0x5')+_0x1fcf09[_0xa433('0x4')],'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']},{'type':_0x1fcf09[_0xa433('0x4')],'app':_0x1fcf09['alias']?_0xa433('0x8'):_0xa433('0x9'),'appdata':_0x1fcf09['alias']?_0xa433('0xa')+_0x1fcf09[_0xa433('0xb')]:_0xa433('0xc'),'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']}];if(_0x1fcf09[_0xa433('0x4')]===_0xa433('0xd')){_0x22f282[_0xa433('0xe')]({'type':_0xa433('0xd'),'app':_0xa433('0x8'),'appdata':'CDR(routeid)='+_0x1fcf09['id'],'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']});}_0x22f282[_0xa433('0xe')]({'type':_0x1fcf09[_0xa433('0x4')],'app':'Set','appdata':_0xa433('0xf'),'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']},{'type':_0x1fcf09[_0xa433('0x4')],'app':_0xa433('0x8'),'appdata':_0xa433('0x10'),'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']},{'type':_0x1fcf09['type'],'app':_0xa433('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']});return _0x22f282;}function _0x3b8323(_0x3a580e){var _0x3c5db6=0x2;var _0x1bc01f=[{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x12'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0x3a580e[_0xa433('0xb')]?_0xa433('0x8'):'NoOp','appdata':_0x3a580e['alias']?_0xa433('0xa')+_0x3a580e[_0xa433('0xb')]:_0xa433('0xc'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x13')+(_0x3a580e[_0xa433('0x14')]?'${EXTEN:'+_0x3a580e[_0xa433('0x14')]+'}':_0xa433('0x15')),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x16')+_0x3a580e['id'],'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e['exten'],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':'outbound','app':_0xa433('0x17'),'appdata':_0xa433('0x18')+(_0x3c5db6+0x2)+_0xa433('0x19')+(_0x3c5db6+0x1)+')','context':_0x3a580e['context'],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0x3a580e[_0xa433('0x14')]?_0xa433('0x1a')+_0x3a580e[_0xa433('0x14')]+'}':_0xa433('0x1b'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0xf'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x10'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':'outbound','app':_0xa433('0x8'),'appdata':_0xa433('0x1c'),'context':_0x3a580e['context'],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':'outboundrouteid='+_0x3a580e['id'],'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']}];if(_0x3a580e[_0xa433('0x1d')](_0xa433('0x1e'))&&_0x3a580e[_0xa433('0x1e')]!==_0xa433('0x1f')){_0x1bc01f[_0xa433('0xe')]({'type':_0xa433('0x11'),'app':'Set','appdata':_0xa433('0x20'),'context':_0x3a580e['context'],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x21')+_0x3a580e[_0xa433('0x1e')]||_0xa433('0x22'),'context':_0x3a580e['context'],'exten':_0x3a580e['exten'],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']});}return _0x1bc01f;}function _0x115f84(_0x560281,_0x32b9fb){var _0x138b60=[{'name':_0xa433('0x23'),'param':0x0},{'name':_0xa433('0x24'),'param':0x1},{'name':_0xa433('0x25'),'param':0x2},{'name':'url','param':0x3}];var _0x126223={};var _0x5a829c=_0x32b9fb[_0xa433('0x26')](',');var _0x48f571=[];for(var _0x47ce7d=0x0;_0x47ce7d<_0x138b60[_0xa433('0x27')];_0x47ce7d++){switch(_0x138b60[_0x47ce7d][_0xa433('0x28')]){case _0xa433('0x23'):_0x126223[_0xa433('0x23')]=_0x5a829c[_0x138b60[_0x47ce7d]['param']][_0xa433('0x26')]('/')[0x1];_0x126223[_0xa433('0x29')]=_0x5a829c[_0x138b60[_0x47ce7d]['param']]['split']('/')[0x2];_0x126223[_0xa433('0x2a')]=_0x126223[_0xa433('0x29')]?_0x126223['phone'][_0xa433('0x26')]('$')[0x0]:undefined;_0x126223[_0xa433('0x29')]=_0x560281[_0xa433('0x14')]?(_0x126223[_0xa433('0x2a')]||'')+_0xa433('0x2b')+_0x560281['cutdigits']+'}':(_0x126223[_0xa433('0x2a')]||'')+'${EXTEN}';_0x48f571[_0x138b60[_0x47ce7d][_0xa433('0x2c')]]=[_0xa433('0x2d'),_0x126223[_0xa433('0x23')],_0x126223[_0xa433('0x29')]][_0xa433('0x2e')]('/');break;case _0xa433('0x25'):_0x126223[_0xa433('0x25')]=_0x5a829c[_0x138b60[_0x47ce7d][_0xa433('0x2c')]];if(_0x560281[_0xa433('0x1e')]!==_0xa433('0x1f')){if(_0x126223[_0xa433('0x25')][_0xa433('0x2f')](_0xa433('0x30'))<0x0){_0x126223[_0xa433('0x25')]+=_0xa433('0x30');}}else{_0x126223['options']=_0x126223[_0xa433('0x25')][_0xa433('0x31')](_0xa433('0x30'),'');}_0x48f571[_0x138b60[_0x47ce7d][_0xa433('0x2c')]]=_0x126223['options'];break;default:_0x48f571[_0x138b60[_0x47ce7d][_0xa433('0x2c')]]=_0x5a829c[_0x138b60[_0x47ce7d][_0xa433('0x2c')]];}}return _0x48f571[_0xa433('0x2e')](',');}function _0x38aafe(_0x420c74,_0x1462b7,_0x35555c){return new Promise(function(_0x584506,_0x96c81c){var _0x45ff00=[];if(_[_0xa433('0x32')](_0x1462b7))return _0x584506(_0x45ff00);_0x29307f['Interval'][_0xa433('0x33')]({'attributes':['id',_0xa433('0x34'),_0xa433('0x35')],'raw':!![]})[_0xa433('0x36')](function(_0x2dba36){for(var _0x5ce562=0x0,_0xab35cc=0x0;_0x5ce562<_0x1462b7[_0xa433('0x27')];_0x5ce562++,_0xab35cc=0x0){var _0x3dbf4d=_0x1462b7[_0x5ce562];var _0x566815=[];var _0x5b2d04=[];delete _0x3dbf4d['id'];if(_0x3dbf4d[_0xa433('0x34')]!==_0xa433('0x37')){_0x3dbf4d[_0xa433('0x38')]=[_0x3dbf4d['interval']];}else{_0x3dbf4d['intervals']=_0x3dbf4d[_0xa433('0x35')]?_[_0xa433('0x39')](_[_0xa433('0x3a')](_0x2dba36,{'IntervalId':_0x3dbf4d['IntervalId']}),_0xa433('0x34')):[];}_0x3dbf4d['context']=_0x420c74[_0xa433('0x6')];_0x3dbf4d[_0xa433('0x7')]=_0x420c74[_0xa433('0x7')];if(_0x3dbf4d[_0xa433('0x4')])_0x3dbf4d[_0xa433('0x4')]=_0x3dbf4d[_0xa433('0x4')]['toLowerCase']();if(_0x420c74[_0xa433('0x4')]==='outbound'){if(_0x3dbf4d[_0xa433('0x1d')](_0xa433('0x3b'))&&_0x3dbf4d[_0xa433('0x3b')]&&_0x3dbf4d[_0xa433('0x3b')]!=='--'){_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d['type']['toLowerCase'](),'app':_0xa433('0x8'),'appdata':_0xa433('0x3c')+_0x3dbf4d[_0xa433('0x3b')],'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')][_0xa433('0x3d')](),'app':_0xa433('0x17'),'appdata':_0xa433('0x3e')+(_0x3dbf4d['callerID']?_0xa433('0x3f')+_0x3dbf4d['callerID']+')':_0xa433('0x40')),'context':_0x420c74['context'],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}else{if(_0x3dbf4d[_0xa433('0x1d')](_0xa433('0x41'))){if([_0xa433('0x42'),'playback'][_0xa433('0x43')](_0x3dbf4d[_0xa433('0x44')][_0xa433('0x3d')]())&&_0x3dbf4d[_0xa433('0x45')]!==_0xa433('0x46')){if(_0x3dbf4d[_0xa433('0x41')]){_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')][_0xa433('0x3d')](),'app':_0xa433('0x17'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74['exten'],'priority':_0x3dbf4d['intervals']['length']+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')][_0xa433('0x3d')](),'app':_0xa433('0x8'),'appdata':_0xa433('0x47'),'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d['intervals'][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}else{_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d['type'][_0xa433('0x3d')](),'app':'ExecIf','appdata':_0xa433('0x48'),'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')]['toLowerCase'](),'app':_0xa433('0x8'),'appdata':_0xa433('0x49'),'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74['exten'],'priority':_0x3dbf4d['intervals'][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}}}}for(var _0x3cbcdb=0x0;_0x3cbcdb<_0x3dbf4d['intervals'][_0xa433('0x27')];_0x3cbcdb++){var _0x5e5e89=_0x35555c+_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')];var _0x378b78=_0x3cbcdb===_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]-0x1?_0x35555c+_0x566815[_0xa433('0x27')]+_0x5b2d04[_0xa433('0x27')]+0x2:_0x35555c+_0x3cbcdb+0x1;_0x566815[_0xa433('0x4a')](_0x3cbcdb,0x0,{'type':_0x420c74[_0xa433('0x4')],'app':'GotoIfTime','appdata':_0x3dbf4d[_0xa433('0x38')][_0x3cbcdb]+'?'+_0x420c74[_0xa433('0x6')]+_0xa433('0x4b')+_0x5e5e89+':'+_0x420c74[_0xa433('0x6')]+_0xa433('0x4b')+_0x378b78,'exten':_0x420c74[_0xa433('0x7')],'context':_0x420c74[_0xa433('0x6')],'priority':_0x35555c+_0x3cbcdb,'VoiceExtensionId':_0x420c74['id']});}if(_0x3dbf4d[_0xa433('0x45')]===_0xa433('0x4c'))_0x3dbf4d[_0xa433('0x4d')]=_0x115f84(_0x420c74,_0x3dbf4d[_0xa433('0x4d')]);_0x3dbf4d['priority']=_0x566815[_0xa433('0x27')]?_[_0xa433('0x4e')](_0x566815)[_0xa433('0x4f')]+0x1:_0x35555c;_0x45ff00=_[_0xa433('0x50')](_0x45ff00,_0x566815,[_0x3dbf4d],_0x5b2d04);_0x35555c=_[_0xa433('0x4e')](_0x45ff00)[_0xa433('0x4f')]+0x1;}return _0x584506(_0x45ff00);})[_0xa433('0x51')](function(_0x27f74a){_0x96c81c(_0x27f74a);});});}return _0x57aaa9[_0xa433('0x52')](_0xa433('0x53'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x41ee8a){var _0x2dedf2=this['get']({'plain':!![]});var _0xa4aeec=_0x2dedf2[_0xa433('0x4')]===_0xa433('0x11')?_0x3b8323(_0x2dedf2):_0x22ac7b(_0x2dedf2);return _0x38aafe(_0x2dedf2,_0x41ee8a,_[_0xa433('0x4e')](_0xa4aeec)[_0xa433('0x4f')]+0x1)[_0xa433('0x36')](function(_0x132df4){var _0x1e29c4=_[_0xa433('0x50')](_0xa4aeec,_0x132df4);_0x1e29c4[_0xa433('0xe')]({'type':_0x2dedf2[_0xa433('0x4')],'app':_0xa433('0x54'),'exten':_0x2dedf2['exten'],'context':_0x2dedf2[_0xa433('0x6')],'priority':_[_0xa433('0x4e')](_0x1e29c4)[_0xa433('0x4f')]+0x1,'VoiceExtensionId':_0x2dedf2['id']});return _0x1e29c4;});}}});}; \ No newline at end of file +var _0xe5d5=['*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','hasOwnProperty','answer','playback','includes','app','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','concat','last','catch','voice_extensions','get','Hangup','exports','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','timeout','options','url','name','trunk','param','split','phone','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','then','length'];(function(_0x3689b7,_0x15e1de){var _0x48d0fc=function(_0x451981){while(--_0x451981){_0x3689b7['push'](_0x3689b7['shift']());}};_0x48d0fc(++_0x15e1de);}(_0xe5d5,0x156));var _0x5e5d=function(_0x474b91,_0x381587){_0x474b91=_0x474b91-0x0;var _0x165781=_0xe5d5[_0x474b91];return _0x165781;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x5e5d('0x0')]=function(_0x4f6845){var _0x9f47d6=_0x4f6845['models'];function _0x50afd3(_0x5127ee){var _0x3e2410=0x2;var _0x191980=[{'type':_0x5127ee[_0x5e5d('0x1')],'app':_0x5e5d('0x2'),'appdata':_0x5e5d('0x3')+_0x5127ee[_0x5e5d('0x1')],'context':_0x5127ee[_0x5e5d('0x4')],'exten':_0x5127ee[_0x5e5d('0x5')],'priority':_0x3e2410++,'VoiceExtensionId':_0x5127ee['id']},{'type':_0x5127ee[_0x5e5d('0x1')],'app':_0x5127ee[_0x5e5d('0x6')]?_0x5e5d('0x2'):_0x5e5d('0x7'),'appdata':_0x5127ee[_0x5e5d('0x6')]?_0x5e5d('0x8')+_0x5127ee['alias']:_0x5e5d('0x9'),'context':_0x5127ee['context'],'exten':_0x5127ee[_0x5e5d('0x5')],'priority':_0x3e2410++,'VoiceExtensionId':_0x5127ee['id']}];if(_0x5127ee[_0x5e5d('0x1')]==='inbound'){_0x191980[_0x5e5d('0xa')]({'type':_0x5e5d('0xb'),'app':_0x5e5d('0x2'),'appdata':_0x5e5d('0xc')+_0x5127ee['id'],'context':_0x5127ee['context'],'exten':_0x5127ee['exten'],'priority':_0x3e2410++,'VoiceExtensionId':_0x5127ee['id']});}_0x191980[_0x5e5d('0xa')]({'type':_0x5127ee[_0x5e5d('0x1')],'app':'Set','appdata':_0x5e5d('0xd'),'context':_0x5127ee[_0x5e5d('0x4')],'exten':_0x5127ee['exten'],'priority':_0x3e2410++,'VoiceExtensionId':_0x5127ee['id']},{'type':_0x5127ee[_0x5e5d('0x1')],'app':_0x5e5d('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5127ee['context'],'exten':_0x5127ee['exten'],'priority':_0x3e2410++,'VoiceExtensionId':_0x5127ee['id']},{'type':_0x5127ee[_0x5e5d('0x1')],'app':_0x5e5d('0x2'),'appdata':_0x5e5d('0xe'),'context':_0x5127ee[_0x5e5d('0x4')],'exten':_0x5127ee['exten'],'priority':_0x3e2410++,'VoiceExtensionId':_0x5127ee['id']});return _0x191980;}function _0x132532(_0x542faf){var _0x39964a=0x2;var _0xda3b8d=[{'type':_0x5e5d('0xf'),'app':_0x5e5d('0x2'),'appdata':_0x5e5d('0x10'),'context':_0x542faf[_0x5e5d('0x4')],'exten':_0x542faf['exten'],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':_0x5e5d('0xf'),'app':_0x542faf[_0x5e5d('0x6')]?_0x5e5d('0x2'):_0x5e5d('0x7'),'appdata':_0x542faf[_0x5e5d('0x6')]?_0x5e5d('0x8')+_0x542faf['alias']:_0x5e5d('0x9'),'context':_0x542faf['context'],'exten':_0x542faf[_0x5e5d('0x5')],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':_0x5e5d('0xf'),'app':_0x5e5d('0x2'),'appdata':'CDR(destination)='+(_0x542faf[_0x5e5d('0x11')]?'${EXTEN:'+_0x542faf[_0x5e5d('0x11')]+'}':_0x5e5d('0x12')),'context':_0x542faf[_0x5e5d('0x4')],'exten':_0x542faf['exten'],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':'outbound','app':_0x5e5d('0x2'),'appdata':_0x5e5d('0xc')+_0x542faf['id'],'context':_0x542faf['context'],'exten':_0x542faf['exten'],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':_0x5e5d('0xf'),'app':_0x5e5d('0x13'),'appdata':_0x5e5d('0x14')+(_0x39964a+0x2)+'):Goto('+(_0x39964a+0x1)+')','context':_0x542faf[_0x5e5d('0x4')],'exten':_0x542faf['exten'],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':_0x5e5d('0xf'),'app':'Set','appdata':_0x542faf[_0x5e5d('0x11')]?_0x5e5d('0x15')+_0x542faf[_0x5e5d('0x11')]+'}':_0x5e5d('0x16'),'context':_0x542faf[_0x5e5d('0x4')],'exten':_0x542faf[_0x5e5d('0x5')],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':_0x5e5d('0xf'),'app':'Set','appdata':_0x5e5d('0xd'),'context':_0x542faf[_0x5e5d('0x4')],'exten':_0x542faf[_0x5e5d('0x5')],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':_0x5e5d('0xf'),'app':_0x5e5d('0x2'),'appdata':_0x5e5d('0x17'),'context':_0x542faf[_0x5e5d('0x4')],'exten':_0x542faf[_0x5e5d('0x5')],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':_0x5e5d('0xf'),'app':'Set','appdata':_0x5e5d('0xe'),'context':_0x542faf['context'],'exten':_0x542faf['exten'],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':_0x5e5d('0xf'),'app':_0x5e5d('0x2'),'appdata':_0x5e5d('0x18')+_0x542faf['id'],'context':_0x542faf[_0x5e5d('0x4')],'exten':_0x542faf[_0x5e5d('0x5')],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']}];if(_0x542faf['hasOwnProperty'](_0x5e5d('0x19'))&&_0x542faf[_0x5e5d('0x19')]!==_0x5e5d('0x1a')){_0xda3b8d[_0x5e5d('0xa')]({'type':_0x5e5d('0xf'),'app':_0x5e5d('0x2'),'appdata':_0x5e5d('0x1b'),'context':_0x542faf['context'],'exten':_0x542faf[_0x5e5d('0x5')],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']},{'type':_0x5e5d('0xf'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x542faf[_0x5e5d('0x19')]||_0x5e5d('0x1c'),'context':_0x542faf[_0x5e5d('0x4')],'exten':_0x542faf[_0x5e5d('0x5')],'priority':_0x39964a++,'VoiceExtensionId':_0x542faf['id']});}return _0xda3b8d;}function _0xd220d1(_0x2a8fe8,_0x5a5696){var _0x2d5411=[{'name':'trunk','param':0x0},{'name':_0x5e5d('0x1d'),'param':0x1},{'name':_0x5e5d('0x1e'),'param':0x2},{'name':_0x5e5d('0x1f'),'param':0x3}];var _0x3f1721={};var _0x12d758=_0x5a5696['split'](',');var _0x1301ef=[];for(var _0xf68677=0x0;_0xf68677<_0x2d5411['length'];_0xf68677++){switch(_0x2d5411[_0xf68677][_0x5e5d('0x20')]){case'trunk':_0x3f1721[_0x5e5d('0x21')]=_0x12d758[_0x2d5411[_0xf68677][_0x5e5d('0x22')]][_0x5e5d('0x23')]('/')[0x1];_0x3f1721[_0x5e5d('0x24')]=_0x12d758[_0x2d5411[_0xf68677][_0x5e5d('0x22')]][_0x5e5d('0x23')]('/')[0x2];_0x3f1721[_0x5e5d('0x25')]=_0x3f1721[_0x5e5d('0x24')]?_0x3f1721[_0x5e5d('0x24')][_0x5e5d('0x23')]('$')[0x0]:undefined;_0x3f1721[_0x5e5d('0x24')]=_0x2a8fe8[_0x5e5d('0x11')]?(_0x3f1721['prefix']||'')+_0x5e5d('0x26')+_0x2a8fe8[_0x5e5d('0x11')]+'}':(_0x3f1721[_0x5e5d('0x25')]||'')+_0x5e5d('0x12');_0x1301ef[_0x2d5411[_0xf68677][_0x5e5d('0x22')]]=[_0x5e5d('0x27'),_0x3f1721['trunk'],_0x3f1721[_0x5e5d('0x24')]][_0x5e5d('0x28')]('/');break;case'options':_0x3f1721[_0x5e5d('0x1e')]=_0x12d758[_0x2d5411[_0xf68677][_0x5e5d('0x22')]];if(_0x2a8fe8[_0x5e5d('0x19')]!==_0x5e5d('0x1a')){if(_0x3f1721[_0x5e5d('0x1e')][_0x5e5d('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x3f1721['options']+=_0x5e5d('0x2a');}}else{_0x3f1721['options']=_0x3f1721[_0x5e5d('0x1e')]['replace']('U(xcally-mixmonitor-context)','');}_0x1301ef[_0x2d5411[_0xf68677][_0x5e5d('0x22')]]=_0x3f1721['options'];break;default:_0x1301ef[_0x2d5411[_0xf68677]['param']]=_0x12d758[_0x2d5411[_0xf68677][_0x5e5d('0x22')]];}}return _0x1301ef[_0x5e5d('0x28')](',');}function _0x177078(_0x91bd9b,_0x21a48b,_0x1eca09){return new Promise(function(_0x583e4f,_0x4bd727){var _0x5c5c4d=[];if(_[_0x5e5d('0x2b')](_0x21a48b))return _0x583e4f(_0x5c5c4d);_0x9f47d6['Interval'][_0x5e5d('0x2c')]({'attributes':['id',_0x5e5d('0x2d'),'IntervalId'],'raw':!![]})[_0x5e5d('0x2e')](function(_0x275b15){for(var _0x5469c0=0x0,_0x3f71d0=0x0;_0x5469c0<_0x21a48b[_0x5e5d('0x2f')];_0x5469c0++,_0x3f71d0=0x0){var _0x35858e=_0x21a48b[_0x5469c0];var _0x53cf72=[];var _0x3ba75f=[];delete _0x35858e['id'];if(_0x35858e['interval']!==_0x5e5d('0x30')){_0x35858e[_0x5e5d('0x31')]=[_0x35858e[_0x5e5d('0x2d')]];}else{_0x35858e[_0x5e5d('0x31')]=_0x35858e[_0x5e5d('0x32')]?_[_0x5e5d('0x33')](_[_0x5e5d('0x34')](_0x275b15,{'IntervalId':_0x35858e[_0x5e5d('0x32')]}),'interval'):[];}_0x35858e[_0x5e5d('0x4')]=_0x91bd9b[_0x5e5d('0x4')];_0x35858e[_0x5e5d('0x5')]=_0x91bd9b['exten'];if(_0x35858e[_0x5e5d('0x1')])_0x35858e[_0x5e5d('0x1')]=_0x35858e['type'][_0x5e5d('0x35')]();if(_0x91bd9b[_0x5e5d('0x1')]===_0x5e5d('0xf')){if(_0x35858e['hasOwnProperty'](_0x5e5d('0x36'))&&_0x35858e[_0x5e5d('0x36')]&&_0x35858e[_0x5e5d('0x36')]!=='--'){_0x53cf72[_0x5e5d('0xa')]({'type':_0x35858e[_0x5e5d('0x1')]['toLowerCase'](),'app':_0x5e5d('0x2'),'appdata':'CDR(tag)='+_0x35858e['tag'],'context':_0x91bd9b[_0x5e5d('0x4')],'exten':_0x91bd9b['exten'],'priority':_0x35858e[_0x5e5d('0x31')][_0x5e5d('0x2f')]+_0x1eca09+_0x3f71d0++,'VoiceExtensionId':_0x91bd9b['id']});}_0x53cf72['push']({'type':_0x35858e[_0x5e5d('0x1')][_0x5e5d('0x35')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x35858e[_0x5e5d('0x37')]?_0x5e5d('0x38')+_0x35858e['callerID']+')':_0x5e5d('0x39')),'context':_0x91bd9b[_0x5e5d('0x4')],'exten':_0x91bd9b[_0x5e5d('0x5')],'priority':_0x35858e['intervals'][_0x5e5d('0x2f')]+_0x1eca09+_0x3f71d0++,'VoiceExtensionId':_0x91bd9b['id']});}else{if(_0x35858e[_0x5e5d('0x3a')](_0x5e5d('0x3b'))){if(['queue',_0x5e5d('0x3c')][_0x5e5d('0x3d')](_0x35858e[_0x5e5d('0x3e')]['toLowerCase']())&&_0x35858e['appType']!=='custom'){if(_0x35858e[_0x5e5d('0x3b')]){_0x53cf72['push']({'type':_0x35858e[_0x5e5d('0x1')]['toLowerCase'](),'app':_0x5e5d('0x13'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x91bd9b[_0x5e5d('0x4')],'exten':_0x91bd9b[_0x5e5d('0x5')],'priority':_0x35858e['intervals'][_0x5e5d('0x2f')]+_0x1eca09+_0x3f71d0++,'VoiceExtensionId':_0x91bd9b['id']});_0x53cf72['push']({'type':_0x35858e['type']['toLowerCase'](),'app':_0x5e5d('0x2'),'appdata':_0x5e5d('0x3f'),'context':_0x91bd9b['context'],'exten':_0x91bd9b[_0x5e5d('0x5')],'priority':_0x35858e[_0x5e5d('0x31')][_0x5e5d('0x2f')]+_0x1eca09+_0x3f71d0++,'VoiceExtensionId':_0x91bd9b['id']});}else{_0x53cf72[_0x5e5d('0xa')]({'type':_0x35858e[_0x5e5d('0x1')][_0x5e5d('0x35')](),'app':'ExecIf','appdata':_0x5e5d('0x40'),'context':_0x91bd9b[_0x5e5d('0x4')],'exten':_0x91bd9b['exten'],'priority':_0x35858e['intervals'][_0x5e5d('0x2f')]+_0x1eca09+_0x3f71d0++,'VoiceExtensionId':_0x91bd9b['id']});_0x53cf72[_0x5e5d('0xa')]({'type':_0x35858e[_0x5e5d('0x1')][_0x5e5d('0x35')](),'app':_0x5e5d('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x91bd9b[_0x5e5d('0x4')],'exten':_0x91bd9b['exten'],'priority':_0x35858e[_0x5e5d('0x31')][_0x5e5d('0x2f')]+_0x1eca09+_0x3f71d0++,'VoiceExtensionId':_0x91bd9b['id']});}}}}for(var _0x1d128f=0x0;_0x1d128f<_0x35858e[_0x5e5d('0x31')][_0x5e5d('0x2f')];_0x1d128f++){var _0xf5ccbe=_0x1eca09+_0x35858e['intervals'][_0x5e5d('0x2f')];var _0x512648=_0x1d128f===_0x35858e['intervals'][_0x5e5d('0x2f')]-0x1?_0x1eca09+_0x53cf72[_0x5e5d('0x2f')]+_0x3ba75f[_0x5e5d('0x2f')]+0x2:_0x1eca09+_0x1d128f+0x1;_0x53cf72[_0x5e5d('0x41')](_0x1d128f,0x0,{'type':_0x91bd9b[_0x5e5d('0x1')],'app':_0x5e5d('0x42'),'appdata':_0x35858e['intervals'][_0x1d128f]+'?'+_0x91bd9b[_0x5e5d('0x4')]+_0x5e5d('0x43')+_0xf5ccbe+':'+_0x91bd9b[_0x5e5d('0x4')]+_0x5e5d('0x43')+_0x512648,'exten':_0x91bd9b[_0x5e5d('0x5')],'context':_0x91bd9b['context'],'priority':_0x1eca09+_0x1d128f,'VoiceExtensionId':_0x91bd9b['id']});}if(_0x35858e[_0x5e5d('0x44')]===_0x5e5d('0x45'))_0x35858e[_0x5e5d('0x46')]=_0xd220d1(_0x91bd9b,_0x35858e[_0x5e5d('0x46')]);_0x35858e[_0x5e5d('0x47')]=_0x53cf72[_0x5e5d('0x2f')]?_['last'](_0x53cf72)['priority']+0x1:_0x1eca09;_0x5c5c4d=_[_0x5e5d('0x48')](_0x5c5c4d,_0x53cf72,[_0x35858e],_0x3ba75f);_0x1eca09=_[_0x5e5d('0x49')](_0x5c5c4d)[_0x5e5d('0x47')]+0x1;}return _0x583e4f(_0x5c5c4d);})[_0x5e5d('0x4a')](function(_0x33c8b0){_0x4bd727(_0x33c8b0);});});}return _0x4f6845['define']('VoiceExtension',attributes,{'tableName':_0x5e5d('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x53989a){var _0x30a340=this[_0x5e5d('0x4c')]({'plain':!![]});var _0x589fea=_0x30a340[_0x5e5d('0x1')]===_0x5e5d('0xf')?_0x132532(_0x30a340):_0x50afd3(_0x30a340);return _0x177078(_0x30a340,_0x53989a,_['last'](_0x589fea)[_0x5e5d('0x47')]+0x1)[_0x5e5d('0x2e')](function(_0x29808b){var _0x463b39=_['concat'](_0x589fea,_0x29808b);_0x463b39['push']({'type':_0x30a340['type'],'app':_0x5e5d('0x4d'),'exten':_0x30a340[_0x5e5d('0x5')],'context':_0x30a340['context'],'priority':_['last'](_0x463b39)[_0x5e5d('0x47')]+0x1,'VoiceExtensionId':_0x30a340['id']});return _0x463b39;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c878224..abb7721 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 _0xd7c3=['result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x4486ac,_0x5d6ee1){_0x4486ac=_0x4486ac-0x0;var _0x1ac2b8=_0xd7c3[_0x4486ac];return _0x1ac2b8;};'use strict';var _=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var moment=require(_0x3d7c('0x2'));var BPromise=require(_0x3d7c('0x3'));var rs=require(_0x3d7c('0x4'));var fs=require('fs');var Redis=require(_0x3d7c('0x5'));var db=require(_0x3d7c('0x6'))['db'];var utils=require(_0x3d7c('0x7'));var logger=require(_0x3d7c('0x8'))('rpc');var config=require(_0x3d7c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3d7c('0xa')]=_[_0x3d7c('0xb')](config[_0x3d7c('0xa')],{'host':_0x3d7c('0xc'),'port':0x18eb});var socket=require(_0x3d7c('0xd'))(new Redis(config[_0x3d7c('0xa')]));require(_0x3d7c('0xe'))[_0x3d7c('0xf')](socket);function respondWithRpcPromise(_0x2e387e,_0x3a2d6c,_0x222e27){return new BPromise(function(_0x1aec45,_0x295fbb){return client[_0x3d7c('0x10')](_0x2e387e,_0x222e27)[_0x3d7c('0x11')](function(_0x25e2f9){logger[_0x3d7c('0x12')](_0x3d7c('0x13'),_0x3a2d6c,'request\x20sent');logger[_0x3d7c('0x14')](_0x3d7c('0x15'),_0x3a2d6c,_0x3d7c('0x16'),JSON[_0x3d7c('0x17')](_0x25e2f9));if(_0x25e2f9[_0x3d7c('0x18')]){if(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x19')]===0x1f4){logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);return _0x295fbb(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);}logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x25e2f9[_0x3d7c('0x18')]['message']);return _0x1aec45(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x3a2d6c,_0x3d7c('0x16'));_0x1aec45(_0x25e2f9[_0x3d7c('0x1b')][_0x3d7c('0x1a')]);}})[_0x3d7c('0x1c')](function(_0x591455){logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x591455);_0x295fbb(_0x591455);});});}exports[_0x3d7c('0x1d')]=function(_0x4f9ccb){var _0x1308ef=this;return new Promise(function(_0x38207e,_0x3a99fd){return db[_0x3d7c('0x1e')][_0x3d7c('0x1f')]({'raw':_0x4f9ccb[_0x3d7c('0x20')]?_0x4f9ccb[_0x3d7c('0x20')][_0x3d7c('0x21')]===undefined?!![]:![]:!![],'where':_0x4f9ccb[_0x3d7c('0x20')]?_0x4f9ccb['options'][_0x3d7c('0x22')]||null:null,'attributes':_0x4f9ccb[_0x3d7c('0x20')]?_0x4f9ccb[_0x3d7c('0x20')][_0x3d7c('0x23')]||null:null,'limit':_0x4f9ccb['options']?_0x4f9ccb['options'][_0x3d7c('0x24')]||null:null,'include':_0x4f9ccb[_0x3d7c('0x20')]?_0x4f9ccb[_0x3d7c('0x20')][_0x3d7c('0x25')]?_[_0x3d7c('0x26')](_0x4f9ccb[_0x3d7c('0x20')][_0x3d7c('0x25')],function(_0x2ac594){return{'model':db[_0x2ac594[_0x3d7c('0x27')]],'as':_0x2ac594['as'],'attributes':_0x2ac594[_0x3d7c('0x23')],'include':_0x2ac594[_0x3d7c('0x25')]?_['map'](_0x2ac594['include'],function(_0x316c7c){return{'model':db[_0x316c7c[_0x3d7c('0x27')]],'as':_0x316c7c['as'],'attributes':_0x316c7c['attributes'],'include':_0x316c7c[_0x3d7c('0x25')]?_[_0x3d7c('0x26')](_0x316c7c[_0x3d7c('0x25')],function(_0x53698b){return{'model':db[_0x53698b[_0x3d7c('0x27')]],'as':_0x53698b['as'],'attributes':_0x53698b[_0x3d7c('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3d7c('0x11')](function(_0x236440){logger[_0x3d7c('0x12')]('GetVoiceExtension',_0x4f9ccb);logger[_0x3d7c('0x14')](_0x3d7c('0x1d'),_0x4f9ccb,JSON[_0x3d7c('0x17')](_0x236440));_0x38207e(_0x236440);})['catch'](function(_0x77d399){logger[_0x3d7c('0x18')](_0x3d7c('0x1d'),_0x77d399[_0x3d7c('0x1a')],_0x4f9ccb);_0x3a99fd(_0x1308ef[_0x3d7c('0x18')](0x1f4,_0x77d399[_0x3d7c('0x1a')]));});});}; \ No newline at end of file +var _0x88b0=['request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','where','attributes','map','include','model','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','info','VoiceExtension,\x20%s,\x20%s'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x88b0,0x1cb));var _0x088b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x88b0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x088b('0x0'));var util=require(_0x088b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x088b('0x2'));var fs=require('fs');var Redis=require(_0x088b('0x3'));var db=require(_0x088b('0x4'))['db'];var utils=require(_0x088b('0x5'));var logger=require('../../config/logger')(_0x088b('0x6'));var config=require(_0x088b('0x7'));var jayson=require(_0x088b('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x088b('0x9')]=_[_0x088b('0xa')](config[_0x088b('0x9')],{'host':_0x088b('0xb'),'port':0x18eb});var socket=require(_0x088b('0xc'))(new Redis(config[_0x088b('0x9')]));require(_0x088b('0xd'))['register'](socket);function respondWithRpcPromise(_0x110508,_0x597a93,_0x2502df){return new BPromise(function(_0x4c50a6,_0x316f91){return client[_0x088b('0xe')](_0x110508,_0x2502df)['then'](function(_0x4b6d34){logger[_0x088b('0xf')](_0x088b('0x10'),_0x597a93,_0x088b('0x11'));logger['debug'](_0x088b('0x12'),_0x597a93,_0x088b('0x11'),JSON[_0x088b('0x13')](_0x4b6d34));if(_0x4b6d34['error']){if(_0x4b6d34[_0x088b('0x14')][_0x088b('0x15')]===0x1f4){logger[_0x088b('0x14')](_0x088b('0x10'),_0x597a93,_0x4b6d34[_0x088b('0x14')][_0x088b('0x16')]);return _0x316f91(_0x4b6d34[_0x088b('0x14')]['message']);}logger[_0x088b('0x14')](_0x088b('0x10'),_0x597a93,_0x4b6d34[_0x088b('0x14')][_0x088b('0x16')]);return _0x4c50a6(_0x4b6d34[_0x088b('0x14')][_0x088b('0x16')]);}else{logger['info'](_0x088b('0x10'),_0x597a93,_0x088b('0x11'));_0x4c50a6(_0x4b6d34[_0x088b('0x17')][_0x088b('0x16')]);}})[_0x088b('0x18')](function(_0x48a089){logger['error'](_0x088b('0x10'),_0x597a93,_0x48a089);_0x316f91(_0x48a089);});});}exports[_0x088b('0x19')]=function(_0x12e3ac){var _0x376c8c=this;return new Promise(function(_0x3c9c1d,_0x6ecfbe){return db['VoiceExtension'][_0x088b('0x1a')]({'raw':_0x12e3ac[_0x088b('0x1b')]?_0x12e3ac[_0x088b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x12e3ac['options']?_0x12e3ac[_0x088b('0x1b')][_0x088b('0x1c')]||null:null,'attributes':_0x12e3ac[_0x088b('0x1b')]?_0x12e3ac['options'][_0x088b('0x1d')]||null:null,'limit':_0x12e3ac[_0x088b('0x1b')]?_0x12e3ac['options']['limit']||null:null,'include':_0x12e3ac['options']?_0x12e3ac[_0x088b('0x1b')]['include']?_[_0x088b('0x1e')](_0x12e3ac[_0x088b('0x1b')][_0x088b('0x1f')],function(_0x2c551f){return{'model':db[_0x2c551f[_0x088b('0x20')]],'as':_0x2c551f['as'],'attributes':_0x2c551f[_0x088b('0x1d')],'include':_0x2c551f['include']?_[_0x088b('0x1e')](_0x2c551f[_0x088b('0x1f')],function(_0x3da9e1){return{'model':db[_0x3da9e1['model']],'as':_0x3da9e1['as'],'attributes':_0x3da9e1[_0x088b('0x1d')],'include':_0x3da9e1[_0x088b('0x1f')]?_[_0x088b('0x1e')](_0x3da9e1[_0x088b('0x1f')],function(_0x5e1449){return{'model':db[_0x5e1449['model']],'as':_0x5e1449['as'],'attributes':_0x5e1449[_0x088b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x088b('0x21')](function(_0x3921c8){logger[_0x088b('0xf')](_0x088b('0x19'),_0x12e3ac);logger['debug'](_0x088b('0x19'),_0x12e3ac,JSON[_0x088b('0x13')](_0x3921c8));_0x3c9c1d(_0x3921c8);})[_0x088b('0x18')](function(_0x6535be){logger[_0x088b('0x14')]('GetVoiceExtension',_0x6535be[_0x088b('0x16')],_0x12e3ac);_0x6ecfbe(_0x376c8c[_0x088b('0x14')](0x1f4,_0x6535be[_0x088b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index dd684ba..97f8bf3 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 _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x1d1f2c,_0x5349f5){var _0x18905c=function(_0x1d4278){while(--_0x1d4278){_0x1d1f2c['push'](_0x1d1f2c['shift']());}};_0x18905c(++_0x5349f5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x814b,0x1a2));var _0xb814=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x814b[_0x4d8666];return _0x37175b;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 3060255..fdfc9b2 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 _0x741c=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMail.controller'];(function(_0x50620b,_0x10bb13){var _0x3afc55=function(_0x56ca52){while(--_0x56ca52){_0x50620b['push'](_0x50620b['shift']());}};_0x3afc55(++_0x10bb13);}(_0x741c,0x196));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['show']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x11')](_0xc741('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3a6d=['/:id','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','post','create'];(function(_0xd11eab,_0x342335){var _0x4bc996=function(_0x4e7273){while(--_0x4e7273){_0xd11eab['push'](_0xd11eab['shift']());}};_0x4bc996(++_0x342335);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x3a6d[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var fs_extra=require(_0xd3a6('0x5'));var auth=require(_0xd3a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd3a6('0x7'));var controller=require(_0xd3a6('0x8'));router[_0xd3a6('0x9')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xb')]);router[_0xd3a6('0x9')]('/:id',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x9')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0xf')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x10')]);router['put'](_0xd3a6('0x11'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x12')]);router[_0xd3a6('0x13')](_0xd3a6('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index d89118e..280e602 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 _0xcaf8=['string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0xc3da99,_0x1b483c){var _0x246794=function(_0x2df4cc){while(--_0x2df4cc){_0xc3da99['push'](_0xc3da99['shift']());}};_0x246794(++_0x1b483c);}(_0xcaf8,0x1ba));var _0x8caf=function(_0x54fb32,_0xd7e960){_0x54fb32=_0x54fb32-0x0;var _0x3c1d46=_0xcaf8[_0x54fb32];return _0x3c1d46;};'use strict';var Sequelize=require(_0x8caf('0x0'));module[_0x8caf('0x1')]={'customer_id':{'type':Sequelize[_0x8caf('0x2')]},'context':{'type':Sequelize[_0x8caf('0x2')],'defaultValue':_0x8caf('0x3'),'unique':_0x8caf('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x8caf('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x8caf('0x2')]},'email':{'type':Sequelize[_0x8caf('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1a4024){this[_0x8caf('0x5')]('email',typeof _0x1a4024===_0x8caf('0x6')&&_0x1a4024[_0x8caf('0x7')]()?_0x1a4024['trim']():null);}},'pager':{'type':Sequelize[_0x8caf('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x8caf('0x8')},'attach':{'type':Sequelize['ENUM'](_0x8caf('0x9'),'no'),'defaultValue':_0x8caf('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8caf('0xa')]('yes','no'),'defaultValue':_0x8caf('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x8caf('0x2')]},'review':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8caf('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8caf('0xa')]('yes','no'),'defaultValue':_0x8caf('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8caf('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8caf('0x9'),'no'),'defaultValue':_0x8caf('0x9'),'allowNull':![]},'stamp':{'type':_0x8caf('0xb')},'emailsubject':{'type':Sequelize[_0x8caf('0x2')]},'emailbody':{'type':Sequelize[_0x8caf('0x2')]},'maxsecs':{'type':Sequelize[_0x8caf('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x8caf('0xd'))+_0x8caf('0xe')+this['getDataValue'](_0x8caf('0xf'));}}}; \ No newline at end of file +var _0x9368=['TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','sequelize','STRING','contest_mailbox','setDataValue','email','trim','ENUM','yes','TINYINT(4)'];(function(_0x156455,_0x46a4a9){var _0x46aa93=function(_0x5101c6){while(--_0x5101c6){_0x156455['push'](_0x156455['shift']());}};_0x46aa93(++_0x46a4a9);}(_0x9368,0x1b7));var _0x8936=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x9368[_0x5a6644];return _0x3a2a5d;};'use strict';var Sequelize=require(_0x8936('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x8936('0x1')]},'context':{'type':Sequelize[_0x8936('0x1')],'defaultValue':'from-voicemail','unique':_0x8936('0x2')},'mailbox':{'type':Sequelize[_0x8936('0x1')],'defaultValue':'','allowNull':![],'unique':_0x8936('0x2')},'password':{'type':Sequelize[_0x8936('0x1')]},'fullname':{'type':Sequelize[_0x8936('0x1')]},'email':{'type':Sequelize[_0x8936('0x1')],'validate':{'isEmail':!![]},'set':function(_0x368603){this[_0x8936('0x3')](_0x8936('0x4'),typeof _0x368603==='string'&&_0x368603[_0x8936('0x5')]()?_0x368603[_0x8936('0x5')]():null);}},'pager':{'type':Sequelize[_0x8936('0x1')]},'tz':{'type':Sequelize[_0x8936('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x8936('0x6')](_0x8936('0x7'),'no'),'defaultValue':_0x8936('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8936('0x6')]('yes','no'),'defaultValue':_0x8936('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8936('0x1')]},'callback':{'type':Sequelize[_0x8936('0x1')]},'review':{'type':Sequelize[_0x8936('0x6')](_0x8936('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8936('0x6')](_0x8936('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x8936('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x8936('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8936('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8936('0x6')](_0x8936('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8936('0x6')](_0x8936('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8936('0x6')](_0x8936('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x8936('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8936('0x6')](_0x8936('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8936('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x8936('0x9')},'emailsubject':{'type':Sequelize[_0x8936('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x8936('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8936('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8936('0xb')](_0x8936('0xc'))+_0x8936('0xd')+this[_0x8936('0xb')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2e7a9c2..0d5bf76 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 _0x373d=['count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','filter','VoiceMail','include','findAll','catch','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','nolimit','pick','mailbox','options','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x64ca31,_0x55d800){var _0x142d59=function(_0x4390da){while(--_0x4390da){_0x64ca31['push'](_0x64ca31['shift']());}};_0x142d59(++_0x55d800);}(_0x373d,0x1e2));var _0xd373=function(_0x2e17f0,_0xacc452){_0x2e17f0=_0x2e17f0-0x0;var _0x16b4e7=_0x373d[_0x2e17f0];return _0x16b4e7;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){var _0x1ab540=_0x238ffd[_0xd373('0x25')]({'plain':!![]});var _0x437110=_0xd373('0x26');return db[_0xd373('0x27')][_0xd373('0x24')]({'where':{'type':_0x437110,'resourceId':_0x1ab540['id']}})[_0xd373('0x23')](function(){return _0x238ffd;});})[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x3e657b,_0x470612){return function(_0x45ee58){if(!_0x45ee58){_0x3e657b[_0xd373('0x15')](0x194);}return _0x45ee58;};}function handleError(_0x71c5c,_0x3384a5){_0x3384a5=_0x3384a5||0x1f4;return function(_0xf85ca8){logger[_0xd373('0x28')](_0xf85ca8[_0xd373('0x29')]);if(_0xf85ca8[_0xd373('0x2a')]){delete _0xf85ca8[_0xd373('0x2a')];}_0x71c5c[_0xd373('0x17')](_0x3384a5)['send'](_0xf85ca8);};}exports[_0xd373('0x2b')]=function(_0x490842,_0x498aaa){var _0xedc8f3={},_0x15da6c={},_0x25e016={'count':0x0,'rows':[]};var _0x23024c=_[_0xd373('0x2c')](db['VoiceMail'][_0xd373('0x2d')],function(_0x104156){return{'name':_0x104156['fieldName'],'type':_0x104156[_0xd373('0x2e')][_0xd373('0x2f')]};});_0x15da6c[_0xd373('0x30')]=_[_0xd373('0x2c')](_0x23024c,_0xd373('0x2a'));_0x15da6c[_0xd373('0x31')]=_[_0xd373('0x32')](_0x490842[_0xd373('0x31')]);_0x15da6c[_0xd373('0x33')]=_['intersection'](_0x15da6c[_0xd373('0x30')],_0x15da6c[_0xd373('0x31')]);_0xedc8f3[_0xd373('0x34')]=_[_0xd373('0x35')](_0x15da6c[_0xd373('0x30')],qs[_0xd373('0x36')](_0x490842[_0xd373('0x31')][_0xd373('0x36')]));_0xedc8f3[_0xd373('0x34')]=_0xedc8f3[_0xd373('0x34')][_0xd373('0x37')]?_0xedc8f3[_0xd373('0x34')]:_0x15da6c[_0xd373('0x30')];if(!_0x490842[_0xd373('0x31')][_0xd373('0x38')]('nolimit')){_0xedc8f3[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x490842[_0xd373('0x31')][_0xd373('0x1b')]);_0xedc8f3['offset']=qs[_0xd373('0x19')](_0x490842[_0xd373('0x31')][_0xd373('0x19')]);}_0xedc8f3[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0x490842[_0xd373('0x31')]['sort']);_0xedc8f3['where']=qs[_0xd373('0x33')](_['pick'](_0x490842[_0xd373('0x31')],_0x15da6c[_0xd373('0x33')]),_0x23024c);if(_0x490842[_0xd373('0x31')]['filter']){_0xedc8f3[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0xedc8f3[_0xd373('0x3b')],{'$or':_[_0xd373('0x2c')](_0x23024c,function(_0x504450){if(_0x504450['type']!=='VIRTUAL'){var _0x11ec1b={};_0x11ec1b[_0x504450['name']]={'$like':'%'+_0x490842[_0xd373('0x31')][_0xd373('0x3d')]+'%'};return _0x11ec1b;}})});}_0xedc8f3=_['merge']({},_0xedc8f3,_0x490842['options']);var _0x5f3dd5={'where':_0xedc8f3[_0xd373('0x3b')]};return db[_0xd373('0x3e')][_0xd373('0x1c')](_0x5f3dd5)['then'](function(_0x5c3b22){_0x25e016[_0xd373('0x1c')]=_0x5c3b22;if(_0x490842[_0xd373('0x31')]['includeAll']){_0xedc8f3[_0xd373('0x3f')]=[{'all':!![]}];}return db[_0xd373('0x3e')][_0xd373('0x40')](_0xedc8f3);})[_0xd373('0x23')](function(_0x2d8c7d){_0x25e016['rows']=_0x2d8c7d;return _0x25e016;})['then'](respondWithFilteredResult(_0x498aaa,_0xedc8f3))[_0xd373('0x41')](handleError(_0x498aaa,null));};exports[_0xd373('0x42')]=function(_0x30b423,_0x302f65){var _0x5d4dd2={'raw':!![],'where':{'id':_0x30b423['params']['id']}},_0x29725c={};_0x29725c[_0xd373('0x30')]=_[_0xd373('0x32')](db[_0xd373('0x3e')][_0xd373('0x2d')]);_0x29725c[_0xd373('0x31')]=_['keys'](_0x30b423[_0xd373('0x31')]);_0x29725c[_0xd373('0x33')]=_['intersection'](_0x29725c[_0xd373('0x30')],_0x29725c[_0xd373('0x31')]);_0x5d4dd2[_0xd373('0x34')]=_[_0xd373('0x35')](_0x29725c[_0xd373('0x30')],qs[_0xd373('0x36')](_0x30b423[_0xd373('0x31')][_0xd373('0x36')]));_0x5d4dd2[_0xd373('0x34')]=_0x5d4dd2[_0xd373('0x34')]['length']?_0x5d4dd2['attributes']:_0x29725c[_0xd373('0x30')];if(_0x30b423['query'][_0xd373('0x43')]){_0x5d4dd2['include']=[{'all':!![]}];}_0x5d4dd2=_['merge']({},_0x5d4dd2,_0x30b423['options']);return db[_0xd373('0x3e')][_0xd373('0x44')](_0x5d4dd2)[_0xd373('0x23')](handleEntityNotFound(_0x302f65,null))[_0xd373('0x23')](respondWithResult(_0x302f65,null))[_0xd373('0x41')](handleError(_0x302f65,null));};exports[_0xd373('0x45')]=function(_0x1855aa,_0x4d1088){return db[_0xd373('0x3e')]['create'](_0x1855aa[_0xd373('0x46')],{})[_0xd373('0x23')](function(_0x5502e5){var _0x4517ab=_0x1855aa['user'][_0xd373('0x25')]({'plain':!![]});if(!_0x4517ab)throw new Error(_0xd373('0x47'));if(_0x4517ab[_0xd373('0x48')]===_0xd373('0x49')){var _0xe22cbd=_0x5502e5['get']({'plain':!![]});var _0x4971a0='Voicemails';return db[_0xd373('0x4a')][_0xd373('0x44')]({'where':{'name':_0x4971a0,'userProfileId':_0x4517ab['userProfileId']},'raw':!![]})[_0xd373('0x23')](function(_0x3e6766){if(_0x3e6766&&_0x3e6766['autoAssociation']===0x0){return db[_0xd373('0x27')][_0xd373('0x45')]({'name':_0xe22cbd[_0xd373('0x2a')],'resourceId':_0xe22cbd['id'],'type':_0x3e6766[_0xd373('0x2a')],'sectionId':_0x3e6766['id']},{})[_0xd373('0x23')](function(){return _0x5502e5;});}else{return _0x5502e5;}})[_0xd373('0x41')](function(_0xc255ec){logger[_0xd373('0x28')](_0xd373('0x4b'),_0xc255ec);throw _0xc255ec;});}return _0x5502e5;})[_0xd373('0x23')](respondWithResult(_0x4d1088,0xc9))[_0xd373('0x41')](handleError(_0x4d1088,null));};exports['update']=function(_0x4b2645,_0x51ca73){if(_0x4b2645['body']['id']){delete _0x4b2645['body']['id'];}return db['VoiceMail'][_0xd373('0x44')]({'where':{'id':_0x4b2645[_0xd373('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51ca73,null))['then'](saveUpdates(_0x4b2645['body'],null))[_0xd373('0x23')](respondWithResult(_0x51ca73,null))[_0xd373('0x41')](handleError(_0x51ca73,null));};exports['destroy']=function(_0x52fa5b,_0x2230d6){return db[_0xd373('0x3e')][_0xd373('0x44')]({'where':{'id':_0x52fa5b[_0xd373('0x4c')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x2230d6,null))['then'](removeEntity(_0x2230d6,null))[_0xd373('0x41')](handleError(_0x2230d6,null));};exports[_0xd373('0x4d')]=function(_0x386e4c,_0x213da6,_0xc607fb){return db[_0xd373('0x3e')][_0xd373('0x4e')]({'where':{'id':_0x386e4c[_0xd373('0x4c')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x213da6,null))[_0xd373('0x23')](function(_0x1c21d2){var _0x3ad1ec;var _0x213b3c={},_0x42e45d={};_0x42e45d[_0xd373('0x30')]=_['keys'](db[_0xd373('0x4f')][_0xd373('0x2d')]);_0x42e45d[_0xd373('0x31')]=_['keys'](_0x386e4c[_0xd373('0x31')]);_0x42e45d['filters']=_[_0xd373('0x35')](_0x42e45d['model'],_0x42e45d[_0xd373('0x31')]);_0x213b3c[_0xd373('0x34')]=_[_0xd373('0x35')](_0x42e45d[_0xd373('0x30')],qs[_0xd373('0x36')](_0x386e4c[_0xd373('0x31')][_0xd373('0x36')]));_0x213b3c[_0xd373('0x34')]=_0x213b3c[_0xd373('0x34')][_0xd373('0x37')]?_0x213b3c[_0xd373('0x34')]:_0x42e45d[_0xd373('0x30')];if(!_0x386e4c[_0xd373('0x31')][_0xd373('0x38')](_0xd373('0x50'))){_0x213b3c[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x386e4c[_0xd373('0x31')][_0xd373('0x1b')]);_0x213b3c[_0xd373('0x19')]=qs[_0xd373('0x19')](_0x386e4c[_0xd373('0x31')][_0xd373('0x19')]);}_0x213b3c[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0x386e4c[_0xd373('0x31')]['sort']);_0x213b3c[_0xd373('0x3b')]=qs[_0xd373('0x33')](_[_0xd373('0x51')](_0x386e4c['query'],_0x42e45d[_0xd373('0x33')]));if(_0x386e4c[_0xd373('0x31')][_0xd373('0x3d')]){_0x213b3c[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0x213b3c[_0xd373('0x3b')],{'$or':_[_0xd373('0x2c')](_0x213b3c['attributes'],function(_0x1afe12){var _0x356820={};_0x356820[_0x1afe12]={'$like':'%'+_0x386e4c[_0xd373('0x31')][_0xd373('0x3d')]+'%'};return _0x356820;})});}_0x213b3c[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0x213b3c[_0xd373('0x3b')],{'mailboxuser':_0x1c21d2[_0xd373('0x52')]});_0x213b3c=_['merge']({},_0x213b3c,_0x386e4c[_0xd373('0x53')]);return db['VoiceMailMessage'][_0xd373('0x54')](_0x213b3c)[_0xd373('0x23')](respondWithFilteredResult(_0x213da6,_0x213b3c));})[_0xd373('0x41')](handleError(_0x213da6,null));}; \ No newline at end of file +var _0xe5b5=['stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','filter','where','merge','options','VoiceMail','includeAll','include','findAll','catch','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0xe5b5[_0x559a80];return _0x42f555;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310f71,_0x18434e){_0x18434e=_0x18434e||0xcc;return function(_0x4559a0){if(_0x4559a0){return _0x310f71[_0x5e5b('0x1b')](_0x18434e);}return _0x310f71[_0x5e5b('0x1c')](_0x18434e)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x2e331d,_0x49edd0){_0x49edd0=_0x49edd0||0xc8;return function(_0x2b37fa){if(_0x2b37fa){return _0x2e331d[_0x5e5b('0x1c')](_0x49edd0)['json'](_0x2b37fa);}};}function respondWithFilteredResult(_0x227417,_0x578c14){return function(_0x4e9509){if(_0x4e9509){var _0x13a1cb=typeof _0x578c14[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x578c14['limit']===_0x5e5b('0x1f');var _0x4d490c=_0x4e9509[_0x5e5b('0x20')];var _0x45a091=_0x13a1cb?0x0:_0x578c14['offset'];var _0xe5aa6b=_0x13a1cb?_0x4e9509[_0x5e5b('0x20')]:_0x578c14[_0x5e5b('0x1e')]+_0x578c14['limit'];var _0x2bf0b7;if(_0xe5aa6b>=_0x4d490c){_0xe5aa6b=_0x4d490c;_0x2bf0b7=0xc8;}else{_0x2bf0b7=0xce;}_0x227417[_0x5e5b('0x1c')](_0x2bf0b7);return _0x227417['set'](_0x5e5b('0x21'),_0x45a091+'-'+_0xe5aa6b+'/'+_0x4d490c)[_0x5e5b('0x22')](_0x4e9509);}return null;};}function patchUpdates(_0x3c488e){return function(_0x2d8252){try{jsonpatch[_0x5e5b('0x23')](_0x2d8252,_0x3c488e,!![]);}catch(_0x33d61b){return BPromise[_0x5e5b('0x24')](_0x33d61b);}return _0x2d8252[_0x5e5b('0x25')]();};}function saveUpdates(_0x4a78e3,_0x512e46){return function(_0x256a00){if(_0x256a00){return _0x256a00[_0x5e5b('0x26')](_0x4a78e3)[_0x5e5b('0x27')](function(_0xe1c268){return _0xe1c268;});}return null;};}function removeEntity(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(_0x135c6c){return _0x135c6c[_0x5e5b('0x28')]()[_0x5e5b('0x27')](function(){var _0x26bc02=_0x135c6c[_0x5e5b('0x29')]({'plain':!![]});var _0x4da321=_0x5e5b('0x2a');return db[_0x5e5b('0x2b')][_0x5e5b('0x28')]({'where':{'type':_0x4da321,'resourceId':_0x26bc02['id']}})['then'](function(){return _0x135c6c;});})[_0x5e5b('0x27')](function(){_0x2e38ed[_0x5e5b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ff91,_0x21c74b){return function(_0x39ce16){if(!_0x39ce16){_0x13ff91[_0x5e5b('0x1b')](0x194);}return _0x39ce16;};}function handleError(_0x31af09,_0x250fbd){_0x250fbd=_0x250fbd||0x1f4;return function(_0x2cb695){logger[_0x5e5b('0x2c')](_0x2cb695[_0x5e5b('0x2d')]);if(_0x2cb695[_0x5e5b('0x2e')]){delete _0x2cb695[_0x5e5b('0x2e')];}_0x31af09[_0x5e5b('0x1c')](_0x250fbd)['send'](_0x2cb695);};}exports['index']=function(_0x365f6f,_0x289f54){var _0xb68419={},_0x3dcdab={},_0x12f1ee={'count':0x0,'rows':[]};var _0x4b9be8=_[_0x5e5b('0x2f')](db['VoiceMail'][_0x5e5b('0x30')],function(_0x384d8f){return{'name':_0x384d8f[_0x5e5b('0x31')],'type':_0x384d8f[_0x5e5b('0x32')]['key']};});_0x3dcdab[_0x5e5b('0x33')]=_[_0x5e5b('0x2f')](_0x4b9be8,'name');_0x3dcdab[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x365f6f[_0x5e5b('0x34')]);_0x3dcdab[_0x5e5b('0x36')]=_[_0x5e5b('0x37')](_0x3dcdab[_0x5e5b('0x33')],_0x3dcdab[_0x5e5b('0x34')]);_0xb68419[_0x5e5b('0x38')]=_['intersection'](_0x3dcdab[_0x5e5b('0x33')],qs[_0x5e5b('0x39')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x39')]));_0xb68419[_0x5e5b('0x38')]=_0xb68419[_0x5e5b('0x38')]['length']?_0xb68419['attributes']:_0x3dcdab[_0x5e5b('0x33')];if(!_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3a')]('nolimit')){_0xb68419[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3b')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3b')]);_0xb68419['offset']=qs[_0x5e5b('0x1e')](_0x365f6f[_0x5e5b('0x34')]['offset']);}_0xb68419['order']=qs[_0x5e5b('0x3c')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3c')]);_0xb68419['where']=qs[_0x5e5b('0x36')](_['pick'](_0x365f6f['query'],_0x3dcdab[_0x5e5b('0x36')]),_0x4b9be8);if(_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3d')]){_0xb68419[_0x5e5b('0x3e')]=_[_0x5e5b('0x3f')](_0xb68419[_0x5e5b('0x3e')],{'$or':_[_0x5e5b('0x2f')](_0x4b9be8,function(_0x14ac35){if(_0x14ac35[_0x5e5b('0x32')]!=='VIRTUAL'){var _0x1f1907={};_0x1f1907[_0x14ac35[_0x5e5b('0x2e')]]={'$like':'%'+_0x365f6f['query'][_0x5e5b('0x3d')]+'%'};return _0x1f1907;}})});}_0xb68419=_['merge']({},_0xb68419,_0x365f6f[_0x5e5b('0x40')]);var _0x14b152={'where':_0xb68419[_0x5e5b('0x3e')]};return db[_0x5e5b('0x41')][_0x5e5b('0x20')](_0x14b152)[_0x5e5b('0x27')](function(_0x371550){_0x12f1ee[_0x5e5b('0x20')]=_0x371550;if(_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x42')]){_0xb68419[_0x5e5b('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x5e5b('0x44')](_0xb68419);})[_0x5e5b('0x27')](function(_0x46fec9){_0x12f1ee['rows']=_0x46fec9;return _0x12f1ee;})[_0x5e5b('0x27')](respondWithFilteredResult(_0x289f54,_0xb68419))[_0x5e5b('0x45')](handleError(_0x289f54,null));};exports['show']=function(_0x6672d9,_0x44b7be){var _0x5d3135={'raw':!![],'where':{'id':_0x6672d9['params']['id']}},_0x257bb7={};_0x257bb7['model']=_['keys'](db[_0x5e5b('0x41')]['rawAttributes']);_0x257bb7[_0x5e5b('0x34')]=_['keys'](_0x6672d9[_0x5e5b('0x34')]);_0x257bb7[_0x5e5b('0x36')]=_[_0x5e5b('0x37')](_0x257bb7[_0x5e5b('0x33')],_0x257bb7[_0x5e5b('0x34')]);_0x5d3135[_0x5e5b('0x38')]=_[_0x5e5b('0x37')](_0x257bb7['model'],qs['fields'](_0x6672d9[_0x5e5b('0x34')]['fields']));_0x5d3135['attributes']=_0x5d3135['attributes'][_0x5e5b('0x46')]?_0x5d3135['attributes']:_0x257bb7[_0x5e5b('0x33')];if(_0x6672d9[_0x5e5b('0x34')][_0x5e5b('0x42')]){_0x5d3135[_0x5e5b('0x43')]=[{'all':!![]}];}_0x5d3135=_[_0x5e5b('0x3f')]({},_0x5d3135,_0x6672d9[_0x5e5b('0x40')]);return db['VoiceMail'][_0x5e5b('0x47')](_0x5d3135)[_0x5e5b('0x27')](handleEntityNotFound(_0x44b7be,null))['then'](respondWithResult(_0x44b7be,null))[_0x5e5b('0x45')](handleError(_0x44b7be,null));};exports['create']=function(_0x41e4b3,_0x36d8fa){return db[_0x5e5b('0x41')][_0x5e5b('0x48')](_0x41e4b3['body'],{})[_0x5e5b('0x27')](function(_0x1c4efe){var _0x4f4ea3=_0x41e4b3[_0x5e5b('0x49')][_0x5e5b('0x29')]({'plain':!![]});if(!_0x4f4ea3)throw new Error(_0x5e5b('0x4a'));if(_0x4f4ea3[_0x5e5b('0x4b')]===_0x5e5b('0x49')){var _0x5ae8d0=_0x1c4efe['get']({'plain':!![]});var _0x690f8c=_0x5e5b('0x2a');return db['UserProfileSection'][_0x5e5b('0x47')]({'where':{'name':_0x690f8c,'userProfileId':_0x4f4ea3[_0x5e5b('0x4c')]},'raw':!![]})[_0x5e5b('0x27')](function(_0x5a9eae){if(_0x5a9eae&&_0x5a9eae[_0x5e5b('0x4d')]===0x0){return db[_0x5e5b('0x2b')][_0x5e5b('0x48')]({'name':_0x5ae8d0['name'],'resourceId':_0x5ae8d0['id'],'type':_0x5a9eae[_0x5e5b('0x2e')],'sectionId':_0x5a9eae['id']},{})[_0x5e5b('0x27')](function(){return _0x1c4efe;});}else{return _0x1c4efe;}})[_0x5e5b('0x45')](function(_0x4a4e0f){logger['error'](_0x5e5b('0x4e'),_0x4a4e0f);throw _0x4a4e0f;});}return _0x1c4efe;})['then'](respondWithResult(_0x36d8fa,0xc9))['catch'](handleError(_0x36d8fa,null));};exports[_0x5e5b('0x26')]=function(_0x13eee9,_0x4774ee){if(_0x13eee9['body']['id']){delete _0x13eee9[_0x5e5b('0x4f')]['id'];}return db[_0x5e5b('0x41')][_0x5e5b('0x47')]({'where':{'id':_0x13eee9[_0x5e5b('0x50')]['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x4774ee,null))[_0x5e5b('0x27')](saveUpdates(_0x13eee9['body'],null))['then'](respondWithResult(_0x4774ee,null))[_0x5e5b('0x45')](handleError(_0x4774ee,null));};exports[_0x5e5b('0x28')]=function(_0x1cc741,_0x357e55){return db['VoiceMail'][_0x5e5b('0x47')]({'where':{'id':_0x1cc741['params']['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x357e55,null))[_0x5e5b('0x27')](removeEntity(_0x357e55,null))[_0x5e5b('0x45')](handleError(_0x357e55,null));};exports[_0x5e5b('0x51')]=function(_0x2d17b0,_0x30b010,_0x275930){return db[_0x5e5b('0x41')]['findOne']({'where':{'id':_0x2d17b0[_0x5e5b('0x50')]['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x30b010,null))[_0x5e5b('0x27')](function(_0x1aea38){var _0x129026;var _0x5543eb={},_0x2ccee2={};_0x2ccee2[_0x5e5b('0x33')]=_[_0x5e5b('0x35')](db[_0x5e5b('0x52')][_0x5e5b('0x30')]);_0x2ccee2['query']=_[_0x5e5b('0x35')](_0x2d17b0['query']);_0x2ccee2[_0x5e5b('0x36')]=_['intersection'](_0x2ccee2[_0x5e5b('0x33')],_0x2ccee2[_0x5e5b('0x34')]);_0x5543eb[_0x5e5b('0x38')]=_[_0x5e5b('0x37')](_0x2ccee2[_0x5e5b('0x33')],qs[_0x5e5b('0x39')](_0x2d17b0['query'][_0x5e5b('0x39')]));_0x5543eb[_0x5e5b('0x38')]=_0x5543eb[_0x5e5b('0x38')][_0x5e5b('0x46')]?_0x5543eb['attributes']:_0x2ccee2['model'];if(!_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3a')]('nolimit')){_0x5543eb[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3b')](_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3b')]);_0x5543eb[_0x5e5b('0x1e')]=qs['offset'](_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x1e')]);}_0x5543eb['order']=qs['sort'](_0x2d17b0['query'][_0x5e5b('0x3c')]);_0x5543eb[_0x5e5b('0x3e')]=qs[_0x5e5b('0x36')](_[_0x5e5b('0x53')](_0x2d17b0[_0x5e5b('0x34')],_0x2ccee2['filters']));if(_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3d')]){_0x5543eb['where']=_[_0x5e5b('0x3f')](_0x5543eb['where'],{'$or':_['map'](_0x5543eb[_0x5e5b('0x38')],function(_0x4fa0db){var _0x454026={};_0x454026[_0x4fa0db]={'$like':'%'+_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3d')]+'%'};return _0x454026;})});}_0x5543eb[_0x5e5b('0x3e')]=_[_0x5e5b('0x3f')](_0x5543eb['where'],{'mailboxuser':_0x1aea38[_0x5e5b('0x54')]});_0x5543eb=_[_0x5e5b('0x3f')]({},_0x5543eb,_0x2d17b0[_0x5e5b('0x40')]);return db[_0x5e5b('0x52')][_0x5e5b('0x55')](_0x5543eb)[_0x5e5b('0x27')](respondWithFilteredResult(_0x30b010,_0x5543eb));})[_0x5e5b('0x45')](handleError(_0x30b010,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5d5c0a3..bada4e2 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 _0x2349=['./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x48e3bc,_0x21b78d){var _0xc69b22=function(_0x1663e1){while(--_0x1663e1){_0x48e3bc['push'](_0x48e3bc['shift']());}};_0xc69b22(++_0x21b78d);}(_0x2349,0x133));var _0x9234=function(_0x27fe26,_0x3b8ca7){_0x27fe26=_0x27fe26-0x0;var _0x4fcb35=_0x2349[_0x27fe26];return _0x4fcb35;};'use strict';var _=require('lodash');var util=require(_0x9234('0x0'));var logger=require(_0x9234('0x1'))(_0x9234('0x2'));var moment=require(_0x9234('0x3'));var BPromise=require(_0x9234('0x4'));var rp=require(_0x9234('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9234('0x6'));var config=require(_0x9234('0x7'));var attributes=require(_0x9234('0x8'));module['exports']=function(_0x3cff60,_0x59dffd){return _0x3cff60[_0x9234('0x9')](_0x9234('0xa'),attributes,{'tableName':_0x9234('0xb'),'paranoid':![],'indexes':[{'name':_0x9234('0xc'),'fields':[_0x9234('0xd'),_0x9234('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x58bf=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','voice_voicemail','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x58bf,0x8f));var _0xf58b=function(_0x2393c0,_0x5d5d61){_0x2393c0=_0x2393c0-0x0;var _0x188aa9=_0x58bf[_0x2393c0];return _0x188aa9;};'use strict';var _=require('lodash');var util=require(_0xf58b('0x0'));var logger=require('../../config/logger')(_0xf58b('0x1'));var moment=require('moment');var BPromise=require(_0xf58b('0x2'));var rp=require(_0xf58b('0x3'));var fs=require('fs');var path=require(_0xf58b('0x4'));var rimraf=require(_0xf58b('0x5'));var config=require(_0xf58b('0x6'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x46b212,_0x5d29a7){return _0x46b212[_0xf58b('0x7')]('VoiceMail',attributes,{'tableName':_0xf58b('0x8'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5d88025..a40bbbd 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 _0xd42e=['VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x1493a6,_0x4b92af){var _0x3e9893=function(_0x48bca3){while(--_0x48bca3){_0x1493a6['push'](_0x1493a6['shift']());}};_0x3e9893(++_0x4b92af);}(_0xd42e,0x10b));var _0xed42=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xd42e[_0x585d81];return _0x1aca0d;};'use strict';var _=require(_0xed42('0x0'));var util=require(_0xed42('0x1'));var moment=require(_0xed42('0x2'));var BPromise=require(_0xed42('0x3'));var rs=require(_0xed42('0x4'));var fs=require('fs');var Redis=require(_0xed42('0x5'));var db=require(_0xed42('0x6'))['db'];var utils=require(_0xed42('0x7'));var logger=require(_0xed42('0x8'))(_0xed42('0x9'));var config=require(_0xed42('0xa'));var jayson=require(_0xed42('0xb'));var client=jayson[_0xed42('0xc')][_0xed42('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2c693c,_0x3796f1,_0x75be60){return new BPromise(function(_0x21e615,_0x5c84a8){return client[_0xed42('0xe')](_0x2c693c,_0x75be60)[_0xed42('0xf')](function(_0x4c3cc6){logger[_0xed42('0x10')]('VoiceMail,\x20%s,\x20%s',_0x3796f1,_0xed42('0x11'));logger[_0xed42('0x12')](_0xed42('0x13'),_0x3796f1,_0xed42('0x11'),JSON['stringify'](_0x4c3cc6));if(_0x4c3cc6[_0xed42('0x14')]){if(_0x4c3cc6[_0xed42('0x14')][_0xed42('0x15')]===0x1f4){logger[_0xed42('0x14')](_0xed42('0x16'),_0x3796f1,_0x4c3cc6[_0xed42('0x14')][_0xed42('0x17')]);return _0x5c84a8(_0x4c3cc6['error'][_0xed42('0x17')]);}logger[_0xed42('0x14')]('VoiceMail,\x20%s,\x20%s',_0x3796f1,_0x4c3cc6[_0xed42('0x14')][_0xed42('0x17')]);return _0x21e615(_0x4c3cc6[_0xed42('0x14')][_0xed42('0x17')]);}else{logger[_0xed42('0x10')](_0xed42('0x16'),_0x3796f1,'request\x20sent');_0x21e615(_0x4c3cc6[_0xed42('0x18')][_0xed42('0x17')]);}})[_0xed42('0x19')](function(_0x3609b8){logger[_0xed42('0x14')]('VoiceMail,\x20%s,\x20%s',_0x3796f1,_0x3609b8);_0x5c84a8(_0x3609b8);});});} \ No newline at end of file +var _0xbcbf=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbcbf,0xca));var _0xfbcb=function(_0x441f84,_0x2384be){_0x441f84=_0x441f84-0x0;var _0x9398d4=_0xbcbf[_0x441f84];return _0x9398d4;};'use strict';var _=require(_0xfbcb('0x0'));var util=require(_0xfbcb('0x1'));var moment=require(_0xfbcb('0x2'));var BPromise=require(_0xfbcb('0x3'));var rs=require(_0xfbcb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbcb('0x5'))['db'];var utils=require(_0xfbcb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfbcb('0x7'));var jayson=require(_0xfbcb('0x8'));var client=jayson[_0xfbcb('0x9')][_0xfbcb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ffc80,_0x2bbb03,_0x24316c){return new BPromise(function(_0x5ad70f,_0x552a97){return client[_0xfbcb('0xb')](_0x2ffc80,_0x24316c)[_0xfbcb('0xc')](function(_0x331aa6){logger[_0xfbcb('0xd')](_0xfbcb('0xe'),_0x2bbb03,_0xfbcb('0xf'));logger['debug'](_0xfbcb('0x10'),_0x2bbb03,_0xfbcb('0xf'),JSON[_0xfbcb('0x11')](_0x331aa6));if(_0x331aa6[_0xfbcb('0x12')]){if(_0x331aa6[_0xfbcb('0x12')][_0xfbcb('0x13')]===0x1f4){logger['error'](_0xfbcb('0xe'),_0x2bbb03,_0x331aa6[_0xfbcb('0x12')][_0xfbcb('0x14')]);return _0x552a97(_0x331aa6['error']['message']);}logger[_0xfbcb('0x12')](_0xfbcb('0xe'),_0x2bbb03,_0x331aa6[_0xfbcb('0x12')]['message']);return _0x5ad70f(_0x331aa6['error'][_0xfbcb('0x14')]);}else{logger[_0xfbcb('0xd')]('VoiceMail,\x20%s,\x20%s',_0x2bbb03,_0xfbcb('0xf'));_0x5ad70f(_0x331aa6[_0xfbcb('0x15')][_0xfbcb('0x14')]);}})[_0xfbcb('0x16')](function(_0xf1c5c6){logger['error']('VoiceMail,\x20%s,\x20%s',_0x2bbb03,_0xf1c5c6);_0x552a97(_0xf1c5c6);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 13e0811..5918fbd 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 _0xcc60=['download','post','create','put','/:id','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','/:id/download'];(function(_0x8fa072,_0x4d9ca6){var _0x1b5f89=function(_0x23c013){while(--_0x23c013){_0x8fa072['push'](_0x8fa072['shift']());}};_0x1b5f89(++_0x4d9ca6);}(_0xcc60,0x1a8));var _0x0cc6=function(_0x14e18e,_0x1cc1fb){_0x14e18e=_0x14e18e-0x0;var _0x3871ad=_0xcc60[_0x14e18e];return _0x3871ad;};'use strict';var multer=require(_0x0cc6('0x0'));var util=require(_0x0cc6('0x1'));var path=require('path');var timeout=require(_0x0cc6('0x2'));var express=require(_0x0cc6('0x3'));var router=express[_0x0cc6('0x4')]();var fs_extra=require(_0x0cc6('0x5'));var auth=require(_0x0cc6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0cc6('0x7'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x0cc6('0x8')](),controller[_0x0cc6('0x9')]);router[_0x0cc6('0xa')]('/:id',auth[_0x0cc6('0x8')](),controller[_0x0cc6('0xb')]);router[_0x0cc6('0xa')](_0x0cc6('0xc'),auth[_0x0cc6('0x8')](),controller[_0x0cc6('0xd')]);router[_0x0cc6('0xe')]('/',auth[_0x0cc6('0x8')](),controller[_0x0cc6('0xf')]);router[_0x0cc6('0x10')](_0x0cc6('0x11'),auth['isAuthenticated'](),controller[_0x0cc6('0x12')]);router['delete'](_0x0cc6('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2975=['isAuthenticated','index','/:id','show','/:id/download','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x3a54db,_0x5e5083){var _0x226d5b=function(_0x145a96){while(--_0x145a96){_0x3a54db['push'](_0x3a54db['shift']());}};_0x226d5b(++_0x5e5083);}(_0x2975,0xd2));var _0x5297=function(_0x535e91,_0x343755){_0x535e91=_0x535e91-0x0;var _0x39c568=_0x2975[_0x535e91];return _0x39c568;};'use strict';var multer=require(_0x5297('0x0'));var util=require(_0x5297('0x1'));var path=require('path');var timeout=require(_0x5297('0x2'));var express=require(_0x5297('0x3'));var router=express[_0x5297('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5297('0x5'));var interaction=require(_0x5297('0x6'));var config=require(_0x5297('0x7'));var controller=require(_0x5297('0x8'));router[_0x5297('0x9')]('/',auth[_0x5297('0xa')](),controller[_0x5297('0xb')]);router[_0x5297('0x9')](_0x5297('0xc'),auth[_0x5297('0xa')](),controller[_0x5297('0xd')]);router[_0x5297('0x9')](_0x5297('0xe'),auth[_0x5297('0xa')](),controller['download']);router['post']('/',auth[_0x5297('0xa')](),controller[_0x5297('0xf')]);router[_0x5297('0x10')](_0x5297('0xc'),auth[_0x5297('0xa')](),controller[_0x5297('0x11')]);router['delete'](_0x5297('0xc'),auth[_0x5297('0xa')](),controller[_0x5297('0x12')]);module[_0x5297('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 764f79a..4bedfa0 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 _0xdc40=['sequelize','exports','VIRTUAL','STRING','long','TIMESTAMP','literal'];(function(_0xfc2da6,_0x1206d9){var _0x3974d8=function(_0x1580e0){while(--_0x1580e0){_0xfc2da6['push'](_0xfc2da6['shift']());}};_0x3974d8(++_0x1206d9);}(_0xdc40,0x1b9));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0dc4('0x0'));module[_0x0dc4('0x1')]={'name':{'type':Sequelize[_0x0dc4('0x2')],'get':function(_0x39e26b){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x0dc4('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'stamp':{'type':_0x0dc4('0x5'),'defaultValue':Sequelize[_0x0dc4('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x0714=['exports','VIRTUAL','getDataValue','INTEGER','STRING','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x3a8661,_0x105248){var _0x569356=function(_0x25bb74){while(--_0x25bb74){_0x3a8661['push'](_0x3a8661['shift']());}};_0x569356(++_0x105248);}(_0x0714,0x15e));var _0x4071=function(_0x13461a,_0x316ce1){_0x13461a=_0x13461a-0x0;var _0x2551f5=_0x0714[_0x13461a];return _0x2551f5;};'use strict';var Sequelize=require(_0x4071('0x0'));module[_0x4071('0x1')]={'name':{'type':Sequelize[_0x4071('0x2')],'get':function(_0x32b9a2){return this[_0x4071('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x4071('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4071('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x4071('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4071('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x4071('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x4071('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x4071('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x4071('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x4071('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x4071('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4071('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x4071('0x7')](_0x4071('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c4831a3..9ab1905 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 _0xe590=['rawAttributes','fields','length','options','find','body','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','name','VoiceMailMessage','fieldName','type','model','map','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params'];(function(_0x11d7c9,_0x11549a){var _0x278e53=function(_0x427769){while(--_0x427769){_0x11d7c9['push'](_0x11d7c9['shift']());}};_0x278e53(++_0x11549a);}(_0xe590,0xaf));var _0x0e59=function(_0x40f52b,_0x522fd4){_0x40f52b=_0x40f52b-0x0;var _0x3afe11=_0xe590[_0x40f52b];return _0x3afe11;};'use strict';var emlformat=require(_0x0e59('0x0'));var rimraf=require(_0x0e59('0x1'));var zipdir=require(_0x0e59('0x2'));var jsonpatch=require(_0x0e59('0x3'));var rp=require(_0x0e59('0x4'));var moment=require('moment');var BPromise=require(_0x0e59('0x5'));var Mustache=require(_0x0e59('0x6'));var util=require(_0x0e59('0x7'));var path=require(_0x0e59('0x8'));var sox=require(_0x0e59('0x9'));var csv=require('to-csv');var ejs=require(_0x0e59('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0e59('0xb'));var crypto=require(_0x0e59('0xc'));var jsforce=require(_0x0e59('0xd'));var deskjs=require(_0x0e59('0xe'));var toCsv=require(_0x0e59('0xf'));var querystring=require(_0x0e59('0x10'));var Papa=require(_0x0e59('0x11'));var Redis=require(_0x0e59('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0e59('0x13'));var hardwareService=require(_0x0e59('0x14'));var logger=require('../../config/logger')(_0x0e59('0x15'));var utils=require('../../config/utils');var config=require(_0x0e59('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e59('0x17'))['db'];function respondWithStatusCode(_0x2c0482,_0x587b2e){_0x587b2e=_0x587b2e||0xcc;return function(_0x4c627d){if(_0x4c627d){return _0x2c0482[_0x0e59('0x18')](_0x587b2e);}return _0x2c0482['status'](_0x587b2e)[_0x0e59('0x19')]();};}function respondWithResult(_0x55b310,_0x259611){_0x259611=_0x259611||0xc8;return function(_0x102116){if(_0x102116){return _0x55b310[_0x0e59('0x1a')](_0x259611)[_0x0e59('0x1b')](_0x102116);}};}function respondWithFilteredResult(_0x12aa9d,_0x2f3c05){return function(_0x5054ad){if(_0x5054ad){var _0x4c490a=typeof _0x2f3c05[_0x0e59('0x1c')]===_0x0e59('0x1d')&&typeof _0x2f3c05[_0x0e59('0x1e')]===_0x0e59('0x1d');var _0x9fbbb5=_0x5054ad[_0x0e59('0x1f')];var _0xcc2daa=_0x4c490a?0x0:_0x2f3c05[_0x0e59('0x1c')];var _0xb4b188=_0x4c490a?_0x5054ad[_0x0e59('0x1f')]:_0x2f3c05[_0x0e59('0x1c')]+_0x2f3c05['limit'];var _0xf4fa93;if(_0xb4b188>=_0x9fbbb5){_0xb4b188=_0x9fbbb5;_0xf4fa93=0xc8;}else{_0xf4fa93=0xce;}_0x12aa9d[_0x0e59('0x1a')](_0xf4fa93);return _0x12aa9d['set']('Content-Range',_0xcc2daa+'-'+_0xb4b188+'/'+_0x9fbbb5)[_0x0e59('0x1b')](_0x5054ad);}return null;};}function patchUpdates(_0x11cdfd){return function(_0x4b5714){try{jsonpatch[_0x0e59('0x20')](_0x4b5714,_0x11cdfd,!![]);}catch(_0x1e4db7){return BPromise[_0x0e59('0x21')](_0x1e4db7);}return _0x4b5714[_0x0e59('0x22')]();};}function saveUpdates(_0x2ecd14,_0x2a4294){return function(_0x22c799){if(_0x22c799){return _0x22c799[_0x0e59('0x23')](_0x2ecd14)[_0x0e59('0x24')](function(_0x5d7a0b){return _0x5d7a0b;});}return null;};}function removeEntity(_0x556ef2,_0x1e58bb){return function(_0x5b41a2){if(_0x5b41a2){return _0x5b41a2[_0x0e59('0x25')]()[_0x0e59('0x24')](function(){_0x556ef2[_0x0e59('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42edbc,_0x23ff98){return function(_0x33b4d1){if(!_0x33b4d1){_0x42edbc[_0x0e59('0x18')](0x194);}return _0x33b4d1;};}function handleError(_0x31400c,_0x100916){_0x100916=_0x100916||0x1f4;return function(_0x22a843){logger['error'](_0x22a843['stack']);if(_0x22a843[_0x0e59('0x26')]){delete _0x22a843['name'];}_0x31400c[_0x0e59('0x1a')](_0x100916)['send'](_0x22a843);};}exports['index']=function(_0x45177e,_0x9682fa){var _0x59209e={},_0x3c9a61={},_0x200251={'count':0x0,'rows':[]};var _0x3a2fce=_['map'](db[_0x0e59('0x27')]['rawAttributes'],function(_0x51dbc1){return{'name':_0x51dbc1[_0x0e59('0x28')],'type':_0x51dbc1[_0x0e59('0x29')]['key']};});_0x3c9a61[_0x0e59('0x2a')]=_['differenceBy'](_[_0x0e59('0x2b')](_0x3a2fce,_0x0e59('0x26')),['name']);_0x3c9a61['query']=_[_0x0e59('0x2c')](_0x45177e[_0x0e59('0x2d')]);_0x3c9a61[_0x0e59('0x2e')]=_['intersection'](_0x3c9a61[_0x0e59('0x2a')],_0x3c9a61[_0x0e59('0x2d')]);_0x59209e[_0x0e59('0x2f')]=_[_0x0e59('0x30')](_0x3c9a61[_0x0e59('0x2a')],qs['fields'](_0x45177e['query']['fields']));_0x59209e[_0x0e59('0x2f')]=_0x59209e[_0x0e59('0x2f')]['length']?_0x59209e[_0x0e59('0x2f')]:_0x3c9a61[_0x0e59('0x2a')];if(!_0x45177e[_0x0e59('0x2d')][_0x0e59('0x31')](_0x0e59('0x32'))){_0x59209e[_0x0e59('0x1e')]=qs[_0x0e59('0x1e')](_0x45177e['query'][_0x0e59('0x1e')]);_0x59209e[_0x0e59('0x1c')]=qs[_0x0e59('0x1c')](_0x45177e[_0x0e59('0x2d')]['offset']);}_0x59209e['order']=qs['sort'](_0x45177e[_0x0e59('0x2d')][_0x0e59('0x33')]);_0x59209e[_0x0e59('0x34')]=qs[_0x0e59('0x2e')](_[_0x0e59('0x35')](_0x45177e[_0x0e59('0x2d')],_0x3c9a61[_0x0e59('0x2e')]),_0x3a2fce);if(_0x45177e[_0x0e59('0x2d')][_0x0e59('0x36')]){_0x59209e[_0x0e59('0x34')]=_[_0x0e59('0x37')](_0x59209e[_0x0e59('0x34')],{'$or':_[_0x0e59('0x2b')](_0x3a2fce,function(_0x4810d3){if(_0x4810d3[_0x0e59('0x29')]!==_0x0e59('0x38')){var _0x1fe9ca={};_0x1fe9ca[_0x4810d3[_0x0e59('0x26')]]={'$like':'%'+_0x45177e[_0x0e59('0x2d')][_0x0e59('0x36')]+'%'};return _0x1fe9ca;}})});}_0x59209e=_['merge']({},_0x59209e,_0x45177e['options']);var _0x33a645={'where':_0x59209e['where']};return db['VoiceMailMessage'][_0x0e59('0x1f')](_0x33a645)[_0x0e59('0x24')](function(_0x3cd13c){_0x200251['count']=_0x3cd13c;if(_0x45177e['query'][_0x0e59('0x39')]){_0x59209e[_0x0e59('0x3a')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x59209e);})[_0x0e59('0x24')](function(_0x5e2047){_0x200251[_0x0e59('0x3b')]=_0x5e2047;return _0x200251;})[_0x0e59('0x24')](respondWithFilteredResult(_0x9682fa,_0x59209e))[_0x0e59('0x3c')](handleError(_0x9682fa,null));};exports['show']=function(_0x599b7f,_0x5da923){var _0x3405d2={'raw':!![],'where':{'id':_0x599b7f[_0x0e59('0x3d')]['id']}},_0x5674d9={};_0x5674d9[_0x0e59('0x2a')]=_['keys'](db['VoiceMailMessage'][_0x0e59('0x3e')]);_0x5674d9[_0x0e59('0x2d')]=_[_0x0e59('0x2c')](_0x599b7f[_0x0e59('0x2d')]);_0x5674d9[_0x0e59('0x2e')]=_['intersection'](_0x5674d9[_0x0e59('0x2a')],_0x5674d9[_0x0e59('0x2d')]);_0x3405d2[_0x0e59('0x2f')]=_[_0x0e59('0x30')](_0x5674d9[_0x0e59('0x2a')],qs[_0x0e59('0x3f')](_0x599b7f[_0x0e59('0x2d')][_0x0e59('0x3f')]));_0x3405d2[_0x0e59('0x2f')]=_0x3405d2[_0x0e59('0x2f')][_0x0e59('0x40')]?_0x3405d2[_0x0e59('0x2f')]:_0x5674d9[_0x0e59('0x2a')];if(_0x599b7f[_0x0e59('0x2d')]['includeAll']){_0x3405d2[_0x0e59('0x3a')]=[{'all':!![]}];}_0x3405d2=_[_0x0e59('0x37')]({},_0x3405d2,_0x599b7f[_0x0e59('0x41')]);return db[_0x0e59('0x27')][_0x0e59('0x42')](_0x3405d2)[_0x0e59('0x24')](handleEntityNotFound(_0x5da923,null))[_0x0e59('0x24')](respondWithResult(_0x5da923,null))[_0x0e59('0x3c')](handleError(_0x5da923,null));};exports['create']=function(_0x5ceda3,_0x235fd0){return db[_0x0e59('0x27')]['create'](_0x5ceda3['body'],{})[_0x0e59('0x24')](respondWithResult(_0x235fd0,0xc9))['catch'](handleError(_0x235fd0,null));};exports[_0x0e59('0x23')]=function(_0x1299e7,_0x21116b){if(_0x1299e7['body']['id']){delete _0x1299e7[_0x0e59('0x43')]['id'];}return db[_0x0e59('0x27')][_0x0e59('0x42')]({'where':{'id':_0x1299e7[_0x0e59('0x3d')]['id']}})[_0x0e59('0x24')](handleEntityNotFound(_0x21116b,null))[_0x0e59('0x24')](saveUpdates(_0x1299e7[_0x0e59('0x43')],null))[_0x0e59('0x24')](respondWithResult(_0x21116b,null))['catch'](handleError(_0x21116b,null));};exports[_0x0e59('0x25')]=function(_0x301950,_0x5fcc12){return db[_0x0e59('0x27')][_0x0e59('0x42')]({'where':{'id':_0x301950[_0x0e59('0x3d')]['id']}})[_0x0e59('0x24')](handleEntityNotFound(_0x5fcc12,null))[_0x0e59('0x24')](removeEntity(_0x5fcc12,null))['catch'](handleError(_0x5fcc12,null));};exports['download']=function(_0x500191,_0x492975,_0x5a461f){return db[_0x0e59('0x27')][_0x0e59('0x42')]({'where':{'id':_0x500191['params']['id']},'attributes':['id',_0x0e59('0x44'),_0x0e59('0x45')]})[_0x0e59('0x24')](handleEntityNotFound(_0x492975,null))[_0x0e59('0x24')](function(_0x5b1583){if(_0x5b1583){if(!_0x5b1583[_0x0e59('0x44')]){throw new db['Sequelize'][(_0x0e59('0x46'))](_0x0e59('0x47'));}var _0x3dca09={'Content-Type':_0x0e59('0x48'),'Content-Disposition':_0x0e59('0x49')};if(_0x5b1583['msg_id']){_0x3dca09[_0x0e59('0x4a')]=_0x0e59('0x4b')+_0x5b1583[_0x0e59('0x45')]+_0x0e59('0x4c');}_0x492975[_0x0e59('0x4d')](_0x3dca09);return _0x492975[_0x0e59('0x4e')](new Buffer(_0x5b1583['recording']));}})[_0x0e59('0x3c')](handleError(_0x492975,null));}; \ No newline at end of file +var _0xca5b=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','key','differenceBy','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0xc0f0d6,_0x4f4015){var _0x40d7ee=function(_0x246eac){while(--_0x246eac){_0xc0f0d6['push'](_0xc0f0d6['shift']());}};_0x40d7ee(++_0x4f4015);}(_0xca5b,0xf8));var _0xbca5=function(_0x17cffd,_0x2e92ca){_0x17cffd=_0x17cffd-0x0;var _0x54b404=_0xca5b[_0x17cffd];return _0x54b404;};'use strict';var emlformat=require(_0xbca5('0x0'));var rimraf=require(_0xbca5('0x1'));var zipdir=require(_0xbca5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbca5('0x3'));var moment=require(_0xbca5('0x4'));var BPromise=require(_0xbca5('0x5'));var Mustache=require(_0xbca5('0x6'));var util=require(_0xbca5('0x7'));var path=require('path');var sox=require(_0xbca5('0x8'));var csv=require(_0xbca5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbca5('0xa'));var _=require(_0xbca5('0xb'));var squel=require(_0xbca5('0xc'));var crypto=require(_0xbca5('0xd'));var jsforce=require(_0xbca5('0xe'));var deskjs=require(_0xbca5('0xf'));var toCsv=require(_0xbca5('0x9'));var querystring=require(_0xbca5('0x10'));var Papa=require('papaparse');var Redis=require(_0xbca5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbca5('0x12'));var as=require(_0xbca5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbca5('0x14'))(_0xbca5('0x15'));var utils=require(_0xbca5('0x16'));var config=require(_0xbca5('0x17'));var licenseUtil=require(_0xbca5('0x18'));var db=require(_0xbca5('0x19'))['db'];function respondWithStatusCode(_0x1bd3e9,_0x36d80b){_0x36d80b=_0x36d80b||0xcc;return function(_0x443bdc){if(_0x443bdc){return _0x1bd3e9['sendStatus'](_0x36d80b);}return _0x1bd3e9['status'](_0x36d80b)[_0xbca5('0x1a')]();};}function respondWithResult(_0x10be06,_0x5b43e6){_0x5b43e6=_0x5b43e6||0xc8;return function(_0x1b1b0f){if(_0x1b1b0f){return _0x10be06[_0xbca5('0x1b')](_0x5b43e6)[_0xbca5('0x1c')](_0x1b1b0f);}};}function respondWithFilteredResult(_0xc504ee,_0x8c9825){return function(_0x3cb133){if(_0x3cb133){var _0x4e5940=typeof _0x8c9825[_0xbca5('0x1d')]===_0xbca5('0x1e')&&typeof _0x8c9825[_0xbca5('0x1f')]===_0xbca5('0x1e');var _0x42a865=_0x3cb133['count'];var _0x519711=_0x4e5940?0x0:_0x8c9825[_0xbca5('0x1d')];var _0x1d0075=_0x4e5940?_0x3cb133[_0xbca5('0x20')]:_0x8c9825[_0xbca5('0x1d')]+_0x8c9825[_0xbca5('0x1f')];var _0x2870d7;if(_0x1d0075>=_0x42a865){_0x1d0075=_0x42a865;_0x2870d7=0xc8;}else{_0x2870d7=0xce;}_0xc504ee[_0xbca5('0x1b')](_0x2870d7);return _0xc504ee['set'](_0xbca5('0x21'),_0x519711+'-'+_0x1d0075+'/'+_0x42a865)[_0xbca5('0x1c')](_0x3cb133);}return null;};}function patchUpdates(_0x206ad1){return function(_0x5415ee){try{jsonpatch[_0xbca5('0x22')](_0x5415ee,_0x206ad1,!![]);}catch(_0x2c6cdc){return BPromise['reject'](_0x2c6cdc);}return _0x5415ee[_0xbca5('0x23')]();};}function saveUpdates(_0x4449cf,_0x34b8b8){return function(_0x1922b5){if(_0x1922b5){return _0x1922b5['update'](_0x4449cf)['then'](function(_0xeef20c){return _0xeef20c;});}return null;};}function removeEntity(_0x408b54,_0x17e2dd){return function(_0x559244){if(_0x559244){return _0x559244[_0xbca5('0x24')]()[_0xbca5('0x25')](function(){_0x408b54['status'](0xcc)[_0xbca5('0x1a')]();});}};}function handleEntityNotFound(_0xbe1dd,_0xa46e5b){return function(_0x4614de){if(!_0x4614de){_0xbe1dd[_0xbca5('0x26')](0x194);}return _0x4614de;};}function handleError(_0x42fb29,_0x9fea58){_0x9fea58=_0x9fea58||0x1f4;return function(_0x14dce3){logger[_0xbca5('0x27')](_0x14dce3[_0xbca5('0x28')]);if(_0x14dce3[_0xbca5('0x29')]){delete _0x14dce3['name'];}_0x42fb29[_0xbca5('0x1b')](_0x9fea58)[_0xbca5('0x2a')](_0x14dce3);};}exports[_0xbca5('0x2b')]=function(_0x2509e8,_0x1d7707){var _0x135b6a={},_0x2aee7b={},_0x13db96={'count':0x0,'rows':[]};var _0x7a84ed=_[_0xbca5('0x2c')](db[_0xbca5('0x2d')][_0xbca5('0x2e')],function(_0x3b8bf5){return{'name':_0x3b8bf5['fieldName'],'type':_0x3b8bf5['type'][_0xbca5('0x2f')]};});_0x2aee7b['model']=_[_0xbca5('0x30')](_[_0xbca5('0x2c')](_0x7a84ed,_0xbca5('0x29')),[_0xbca5('0x29')]);_0x2aee7b['query']=_[_0xbca5('0x31')](_0x2509e8[_0xbca5('0x32')]);_0x2aee7b['filters']=_[_0xbca5('0x33')](_0x2aee7b[_0xbca5('0x34')],_0x2aee7b[_0xbca5('0x32')]);_0x135b6a[_0xbca5('0x35')]=_[_0xbca5('0x33')](_0x2aee7b[_0xbca5('0x34')],qs[_0xbca5('0x36')](_0x2509e8[_0xbca5('0x32')][_0xbca5('0x36')]));_0x135b6a[_0xbca5('0x35')]=_0x135b6a['attributes'][_0xbca5('0x37')]?_0x135b6a[_0xbca5('0x35')]:_0x2aee7b[_0xbca5('0x34')];if(!_0x2509e8[_0xbca5('0x32')]['hasOwnProperty'](_0xbca5('0x38'))){_0x135b6a[_0xbca5('0x1f')]=qs[_0xbca5('0x1f')](_0x2509e8[_0xbca5('0x32')][_0xbca5('0x1f')]);_0x135b6a[_0xbca5('0x1d')]=qs[_0xbca5('0x1d')](_0x2509e8[_0xbca5('0x32')][_0xbca5('0x1d')]);}_0x135b6a[_0xbca5('0x39')]=qs['sort'](_0x2509e8[_0xbca5('0x32')][_0xbca5('0x3a')]);_0x135b6a[_0xbca5('0x3b')]=qs[_0xbca5('0x3c')](_['pick'](_0x2509e8[_0xbca5('0x32')],_0x2aee7b[_0xbca5('0x3c')]),_0x7a84ed);if(_0x2509e8['query'][_0xbca5('0x3d')]){_0x135b6a[_0xbca5('0x3b')]=_[_0xbca5('0x3e')](_0x135b6a['where'],{'$or':_[_0xbca5('0x2c')](_0x7a84ed,function(_0x49a68f){if(_0x49a68f[_0xbca5('0x3f')]!==_0xbca5('0x40')){var _0x3d7659={};_0x3d7659[_0x49a68f[_0xbca5('0x29')]]={'$like':'%'+_0x2509e8[_0xbca5('0x32')]['filter']+'%'};return _0x3d7659;}})});}_0x135b6a=_[_0xbca5('0x3e')]({},_0x135b6a,_0x2509e8[_0xbca5('0x41')]);var _0x2aa4b7={'where':_0x135b6a[_0xbca5('0x3b')]};return db[_0xbca5('0x2d')][_0xbca5('0x20')](_0x2aa4b7)[_0xbca5('0x25')](function(_0x4c86d5){_0x13db96[_0xbca5('0x20')]=_0x4c86d5;if(_0x2509e8['query'][_0xbca5('0x42')]){_0x135b6a[_0xbca5('0x43')]=[{'all':!![]}];}return db[_0xbca5('0x2d')]['findAll'](_0x135b6a);})[_0xbca5('0x25')](function(_0x274ddf){_0x13db96[_0xbca5('0x44')]=_0x274ddf;return _0x13db96;})[_0xbca5('0x25')](respondWithFilteredResult(_0x1d7707,_0x135b6a))[_0xbca5('0x45')](handleError(_0x1d7707,null));};exports[_0xbca5('0x46')]=function(_0x432872,_0x10730f){var _0x8776d={'raw':!![],'where':{'id':_0x432872[_0xbca5('0x47')]['id']}},_0x2d3a80={};_0x2d3a80[_0xbca5('0x34')]=_[_0xbca5('0x31')](db[_0xbca5('0x2d')][_0xbca5('0x2e')]);_0x2d3a80[_0xbca5('0x32')]=_[_0xbca5('0x31')](_0x432872[_0xbca5('0x32')]);_0x2d3a80['filters']=_[_0xbca5('0x33')](_0x2d3a80['model'],_0x2d3a80['query']);_0x8776d[_0xbca5('0x35')]=_[_0xbca5('0x33')](_0x2d3a80[_0xbca5('0x34')],qs[_0xbca5('0x36')](_0x432872[_0xbca5('0x32')]['fields']));_0x8776d['attributes']=_0x8776d['attributes']['length']?_0x8776d[_0xbca5('0x35')]:_0x2d3a80[_0xbca5('0x34')];if(_0x432872[_0xbca5('0x32')][_0xbca5('0x42')]){_0x8776d[_0xbca5('0x43')]=[{'all':!![]}];}_0x8776d=_['merge']({},_0x8776d,_0x432872[_0xbca5('0x41')]);return db[_0xbca5('0x2d')][_0xbca5('0x48')](_0x8776d)['then'](handleEntityNotFound(_0x10730f,null))['then'](respondWithResult(_0x10730f,null))[_0xbca5('0x45')](handleError(_0x10730f,null));};exports['create']=function(_0x56a6fe,_0x514a84){return db['VoiceMailMessage'][_0xbca5('0x49')](_0x56a6fe[_0xbca5('0x4a')],{})[_0xbca5('0x25')](respondWithResult(_0x514a84,0xc9))[_0xbca5('0x45')](handleError(_0x514a84,null));};exports['update']=function(_0x1efaaa,_0x11aeea){if(_0x1efaaa[_0xbca5('0x4a')]['id']){delete _0x1efaaa['body']['id'];}return db[_0xbca5('0x2d')]['find']({'where':{'id':_0x1efaaa['params']['id']}})['then'](handleEntityNotFound(_0x11aeea,null))[_0xbca5('0x25')](saveUpdates(_0x1efaaa[_0xbca5('0x4a')],null))[_0xbca5('0x25')](respondWithResult(_0x11aeea,null))[_0xbca5('0x45')](handleError(_0x11aeea,null));};exports[_0xbca5('0x24')]=function(_0x48bc5e,_0x47b31e){return db[_0xbca5('0x2d')][_0xbca5('0x48')]({'where':{'id':_0x48bc5e[_0xbca5('0x47')]['id']}})[_0xbca5('0x25')](handleEntityNotFound(_0x47b31e,null))[_0xbca5('0x25')](removeEntity(_0x47b31e,null))['catch'](handleError(_0x47b31e,null));};exports[_0xbca5('0x4b')]=function(_0x235b77,_0x4948e0,_0x2056fe){return db[_0xbca5('0x2d')][_0xbca5('0x48')]({'where':{'id':_0x235b77[_0xbca5('0x47')]['id']},'attributes':['id',_0xbca5('0x4c'),_0xbca5('0x4d')]})[_0xbca5('0x25')](handleEntityNotFound(_0x4948e0,null))[_0xbca5('0x25')](function(_0x5d0e95){if(_0x5d0e95){if(!_0x5d0e95[_0xbca5('0x4c')]){throw new db[(_0xbca5('0x4e'))][(_0xbca5('0x4f'))]('VoiceMailMessage\x20not\x20found');}var _0x280d76={'Content-Type':_0xbca5('0x50'),'Content-Disposition':_0xbca5('0x51')};if(_0x5d0e95[_0xbca5('0x4d')]){_0x280d76[_0xbca5('0x52')]=_0xbca5('0x53')+_0x5d0e95['msg_id']+_0xbca5('0x54');}_0x4948e0[_0xbca5('0x55')](_0x280d76);return _0x4948e0[_0xbca5('0x2a')](new Buffer(_0x5d0e95['recording']));}})['catch'](handleError(_0x4948e0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 222bb5d..ffe308d 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 _0x52ba=['voice_voicemail_messages','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage'];(function(_0x4cb5d1,_0xab4936){var _0x2226ed=function(_0x5b0120){while(--_0x5b0120){_0x4cb5d1['push'](_0x4cb5d1['shift']());}};_0x2226ed(++_0xab4936);}(_0x52ba,0x121));var _0xa52b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x52ba[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xa52b('0x0'));var logger=require(_0xa52b('0x1'))('api');var moment=require(_0xa52b('0x2'));var BPromise=require(_0xa52b('0x3'));var rp=require(_0xa52b('0x4'));var fs=require('fs');var path=require(_0xa52b('0x5'));var rimraf=require(_0xa52b('0x6'));var config=require(_0xa52b('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0xa52b('0x8')]=function(_0x4185b0,_0x3a4cfa){return _0x4185b0[_0xa52b('0x9')](_0xa52b('0xa'),attributes,{'tableName':_0xa52b('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x6487=['rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','path'];(function(_0x2938b6,_0x47d89f){var _0x28f44f=function(_0x425dbc){while(--_0x425dbc){_0x2938b6['push'](_0x2938b6['shift']());}};_0x28f44f(++_0x47d89f);}(_0x6487,0x73));var _0x7648=function(_0x4478ba,_0x1f323a){_0x4478ba=_0x4478ba-0x0;var _0x42be93=_0x6487[_0x4478ba];return _0x42be93;};'use strict';var _=require(_0x7648('0x0'));var util=require('util');var logger=require(_0x7648('0x1'))(_0x7648('0x2'));var moment=require(_0x7648('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7648('0x4'));var rimraf=require(_0x7648('0x5'));var config=require(_0x7648('0x6'));var attributes=require('./voiceMailMessage.attributes');module[_0x7648('0x7')]=function(_0x2f88ad,_0x3200c9){return _0x2f88ad[_0x7648('0x8')](_0x7648('0x9'),attributes,{'tableName':_0x7648('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x7648('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ac5c337..9524461 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 _0xc7ee=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x152970,_0x535b63){var _0x3ea32d=function(_0x3a2abb){while(--_0x3a2abb){_0x152970['push'](_0x152970['shift']());}};_0x3ea32d(++_0x535b63);}(_0xc7ee,0xbc));var _0xec7e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc7ee[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xec7e('0x0'));var util=require(_0xec7e('0x1'));var moment=require(_0xec7e('0x2'));var BPromise=require(_0xec7e('0x3'));var rs=require(_0xec7e('0x4'));var fs=require('fs');var Redis=require(_0xec7e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec7e('0x6'))('rpc');var config=require(_0xec7e('0x7'));var jayson=require(_0xec7e('0x8'));var client=jayson[_0xec7e('0x9')][_0xec7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3f81,_0x506693,_0x99e6c5){return new BPromise(function(_0x56ddca,_0x2ae11b){return client[_0xec7e('0xb')](_0x1c3f81,_0x99e6c5)['then'](function(_0xf91c31){logger[_0xec7e('0xc')](_0xec7e('0xd'),_0x506693,_0xec7e('0xe'));logger[_0xec7e('0xf')](_0xec7e('0x10'),_0x506693,'request\x20sent',JSON[_0xec7e('0x11')](_0xf91c31));if(_0xf91c31[_0xec7e('0x12')]){if(_0xf91c31['error']['code']===0x1f4){logger['error'](_0xec7e('0xd'),_0x506693,_0xf91c31['error'][_0xec7e('0x13')]);return _0x2ae11b(_0xf91c31[_0xec7e('0x12')][_0xec7e('0x13')]);}logger[_0xec7e('0x12')](_0xec7e('0xd'),_0x506693,_0xf91c31['error'][_0xec7e('0x13')]);return _0x56ddca(_0xf91c31[_0xec7e('0x12')]['message']);}else{logger[_0xec7e('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x506693,'request\x20sent');_0x56ddca(_0xf91c31['result'][_0xec7e('0x13')]);}})['catch'](function(_0x59c7ce){logger[_0xec7e('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x506693,_0x59c7ce);_0x2ae11b(_0x59c7ce);});});} \ No newline at end of file +var _0xce19=['VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x96dbf,_0x42f48a){var _0x43ce02=function(_0x5471ab){while(--_0x5471ab){_0x96dbf['push'](_0x96dbf['shift']());}};_0x43ce02(++_0x42f48a);}(_0xce19,0x14b));var _0x9ce1=function(_0x2ef975,_0x3938dc){_0x2ef975=_0x2ef975-0x0;var _0x253397=_0xce19[_0x2ef975];return _0x253397;};'use strict';var _=require(_0x9ce1('0x0'));var util=require(_0x9ce1('0x1'));var moment=require(_0x9ce1('0x2'));var BPromise=require(_0x9ce1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ce1('0x4'));var db=require(_0x9ce1('0x5'))['db'];var utils=require(_0x9ce1('0x6'));var logger=require('../../config/logger')(_0x9ce1('0x7'));var config=require(_0x9ce1('0x8'));var jayson=require(_0x9ce1('0x9'));var client=jayson[_0x9ce1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c402d,_0x1604bc,_0x134eaf){return new BPromise(function(_0x448888,_0x345ea7){return client[_0x9ce1('0xb')](_0x5c402d,_0x134eaf)[_0x9ce1('0xc')](function(_0x38337a){logger[_0x9ce1('0xd')](_0x9ce1('0xe'),_0x1604bc,_0x9ce1('0xf'));logger[_0x9ce1('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1604bc,'request\x20sent',JSON[_0x9ce1('0x11')](_0x38337a));if(_0x38337a[_0x9ce1('0x12')]){if(_0x38337a[_0x9ce1('0x12')][_0x9ce1('0x13')]===0x1f4){logger[_0x9ce1('0x12')](_0x9ce1('0xe'),_0x1604bc,_0x38337a[_0x9ce1('0x12')][_0x9ce1('0x14')]);return _0x345ea7(_0x38337a[_0x9ce1('0x12')][_0x9ce1('0x14')]);}logger[_0x9ce1('0x12')](_0x9ce1('0xe'),_0x1604bc,_0x38337a[_0x9ce1('0x12')][_0x9ce1('0x14')]);return _0x448888(_0x38337a[_0x9ce1('0x12')][_0x9ce1('0x14')]);}else{logger[_0x9ce1('0xd')](_0x9ce1('0xe'),_0x1604bc,_0x9ce1('0xf'));_0x448888(_0x38337a[_0x9ce1('0x15')][_0x9ce1('0x14')]);}})[_0x9ce1('0x16')](function(_0x2428fe){logger[_0x9ce1('0x12')](_0x9ce1('0xe'),_0x1604bc,_0x2428fe);_0x345ea7(_0x2428fe);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1d1c145..99a81b7 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 _0x0d97=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/sounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports'];(function(_0x146125,_0x113d8a){var _0x79e75c=function(_0x45aff0){while(--_0x45aff0){_0x146125['push'](_0x146125['shift']());}};_0x79e75c(++_0x113d8a);}(_0x0d97,0xe6));var _0x70d9=function(_0x1ca680,_0xde255b){_0x1ca680=_0x1ca680-0x0;var _0x4577d4=_0x0d97[_0x1ca680];return _0x4577d4;};'use strict';var multer=require('multer');var util=require(_0x70d9('0x0'));var path=require(_0x70d9('0x1'));var timeout=require(_0x70d9('0x2'));var express=require(_0x70d9('0x3'));var router=express[_0x70d9('0x4')]();var fs_extra=require(_0x70d9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x70d9('0x6'));var config=require(_0x70d9('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x70d9('0x8')]('/',auth[_0x70d9('0x9')](),controller[_0x70d9('0xa')]);router['get'](_0x70d9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x70d9('0x8')](_0x70d9('0xc'),auth[_0x70d9('0x9')](),controller['getSounds']);router[_0x70d9('0xd')]('/',auth[_0x70d9('0x9')](),controller[_0x70d9('0xe')]);router[_0x70d9('0xd')](_0x70d9('0xc'),auth[_0x70d9('0x9')](),controller[_0x70d9('0xf')]);router[_0x70d9('0x10')]('/:id',auth[_0x70d9('0x9')](),controller[_0x70d9('0x11')]);router[_0x70d9('0x12')](_0x70d9('0xb'),auth[_0x70d9('0x9')](),controller[_0x70d9('0x13')]);router[_0x70d9('0x12')](_0x70d9('0x14'),auth['isAuthenticated'](),controller[_0x70d9('0x15')]);module[_0x70d9('0x16')]=router; \ No newline at end of file +var _0xede7=['getSounds','post','create','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sounds'];(function(_0x58d177,_0x138095){var _0x20ca05=function(_0x4e7b61){while(--_0x4e7b61){_0x58d177['push'](_0x58d177['shift']());}};_0x20ca05(++_0x138095);}(_0xede7,0x1ac));var _0x7ede=function(_0x3fb743,_0x2b6886){_0x3fb743=_0x3fb743-0x0;var _0x135901=_0xede7[_0x3fb743];return _0x135901;};'use strict';var multer=require('multer');var util=require(_0x7ede('0x0'));var path=require('path');var timeout=require(_0x7ede('0x1'));var express=require(_0x7ede('0x2'));var router=express[_0x7ede('0x3')]();var fs_extra=require(_0x7ede('0x4'));var auth=require(_0x7ede('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7ede('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x7ede('0x7')]('/',auth[_0x7ede('0x8')](),controller['index']);router['get'](_0x7ede('0x9'),auth[_0x7ede('0x8')](),controller[_0x7ede('0xa')]);router[_0x7ede('0x7')](_0x7ede('0xb'),auth['isAuthenticated'](),controller[_0x7ede('0xc')]);router[_0x7ede('0xd')]('/',auth[_0x7ede('0x8')](),controller[_0x7ede('0xe')]);router[_0x7ede('0xd')](_0x7ede('0xb'),auth['isAuthenticated'](),controller[_0x7ede('0xf')]);router['put']('/:id',auth[_0x7ede('0x8')](),controller[_0x7ede('0x10')]);router[_0x7ede('0x11')]('/:id',auth[_0x7ede('0x8')](),controller[_0x7ede('0x12')]);router[_0x7ede('0x11')](_0x7ede('0x13'),auth['isAuthenticated'](),controller[_0x7ede('0x14')]);module[_0x7ede('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5da1bcf..8997cc5 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 _0xe69c=['BOOLEAN','STRING','name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','alpha'];(function(_0x109c62,_0x4d46a4){var _0x1a2e26=function(_0x5db895){while(--_0x5db895){_0x109c62['push'](_0x109c62['shift']());}};_0x1a2e26(++_0x4d46a4);}(_0xe69c,0x19b));var _0xce69=function(_0x25512c,_0x37e3be){_0x25512c=_0x25512c-0x0;var _0x46c852=_0xe69c[_0x25512c];return _0x46c852;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xce69('0x0')],'allowNull':![],'unique':_0xce69('0x1')},'mode':{'type':Sequelize[_0xce69('0x2')](_0xce69('0x3'),'files',_0xce69('0x4'),_0xce69('0x5'),_0xce69('0x6'),_0xce69('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xce69('0x0')],'allowNull':!![]},'application':{'type':Sequelize[_0xce69('0x0')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xce69('0x0')],'allowNull':!![],'defaultValue':_0xce69('0x8')},'format':{'type':Sequelize[_0xce69('0x0')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xce69('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x38ae=['mp3nb','quietmp3','mp3','alpha','sequelize','exports','STRING','ENUM','custom','files'];(function(_0x5e0b35,_0x14b303){var _0x597a5c=function(_0x49ae43){while(--_0x49ae43){_0x5e0b35['push'](_0x5e0b35['shift']());}};_0x597a5c(++_0x14b303);}(_0x38ae,0xea));var _0xe38a=function(_0x5c0d9a,_0x15d908){_0x5c0d9a=_0x5c0d9a-0x0;var _0x35a6ed=_0x38ae[_0x5c0d9a];return _0x35a6ed;};'use strict';var Sequelize=require(_0xe38a('0x0'));module[_0xe38a('0x1')]={'name':{'type':Sequelize[_0xe38a('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xe38a('0x3')](_0xe38a('0x4'),_0xe38a('0x5'),_0xe38a('0x6'),'quietmp3nb',_0xe38a('0x7'),_0xe38a('0x8')),'allowNull':!![],'defaultValue':_0xe38a('0x5')},'directory':{'type':Sequelize[_0xe38a('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xe38a('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xe38a('0x2')],'allowNull':!![],'defaultValue':_0xe38a('0x9')},'format':{'type':Sequelize[_0xe38a('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 1283e57..d95c2d9 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 _0xc0bc=['addSound','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','symlinkSync','removeSound','id2','rawAttributes','getSounds','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','MusicOnHolds','UserProfileResource','error','name','index','map','VoiceMusicOnHold','fieldName','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','find','body','params','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message'];(function(_0x5cc6c1,_0x5e09db){var _0x4c8192=function(_0x1bc7ee){while(--_0x1bc7ee){_0x5cc6c1['push'](_0x5cc6c1['shift']());}};_0x4c8192(++_0x5e09db);}(_0xc0bc,0x1b9));var _0xcc0b=function(_0x1c5db9,_0x55e902){_0x1c5db9=_0x1c5db9-0x0;var _0x499a0b=_0xc0bc[_0x1c5db9];return _0x499a0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcc0b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc0b('0x1'));var moment=require('moment');var BPromise=require(_0xcc0b('0x2'));var Mustache=require('mustache');var util=require(_0xcc0b('0x3'));var path=require(_0xcc0b('0x4'));var sox=require('sox');var csv=require(_0xcc0b('0x5'));var ejs=require(_0xcc0b('0x6'));var fs=require('fs');var fs_extra=require(_0xcc0b('0x7'));var _=require(_0xcc0b('0x8'));var squel=require(_0xcc0b('0x9'));var crypto=require(_0xcc0b('0xa'));var jsforce=require(_0xcc0b('0xb'));var deskjs=require(_0xcc0b('0xc'));var toCsv=require(_0xcc0b('0x5'));var querystring=require(_0xcc0b('0xd'));var Papa=require(_0xcc0b('0xe'));var Redis=require(_0xcc0b('0xf'));var authService=require(_0xcc0b('0x10'));var qs=require(_0xcc0b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc0b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xcc0b('0x13'));var licenseUtil=require(_0xcc0b('0x14'));var db=require(_0xcc0b('0x15'))['db'];function respondWithStatusCode(_0x4adb5e,_0x34a5a7){_0x34a5a7=_0x34a5a7||0xcc;return function(_0x4d42ba){if(_0x4d42ba){return _0x4adb5e[_0xcc0b('0x16')](_0x34a5a7);}return _0x4adb5e['status'](_0x34a5a7)[_0xcc0b('0x17')]();};}function respondWithResult(_0x568b26,_0x4a704a){_0x4a704a=_0x4a704a||0xc8;return function(_0x21aeac){if(_0x21aeac){return _0x568b26[_0xcc0b('0x18')](_0x4a704a)[_0xcc0b('0x19')](_0x21aeac);}};}function respondWithFilteredResult(_0x37a83b,_0x5019cf){return function(_0x519cdd){if(_0x519cdd){var _0x244473=typeof _0x5019cf[_0xcc0b('0x1a')]===_0xcc0b('0x1b')&&typeof _0x5019cf['limit']===_0xcc0b('0x1b');var _0x449c80=_0x519cdd[_0xcc0b('0x1c')];var _0x88a482=_0x244473?0x0:_0x5019cf[_0xcc0b('0x1a')];var _0x3eb83b=_0x244473?_0x519cdd[_0xcc0b('0x1c')]:_0x5019cf['offset']+_0x5019cf[_0xcc0b('0x1d')];var _0xd77933;if(_0x3eb83b>=_0x449c80){_0x3eb83b=_0x449c80;_0xd77933=0xc8;}else{_0xd77933=0xce;}_0x37a83b[_0xcc0b('0x18')](_0xd77933);return _0x37a83b[_0xcc0b('0x1e')](_0xcc0b('0x1f'),_0x88a482+'-'+_0x3eb83b+'/'+_0x449c80)[_0xcc0b('0x19')](_0x519cdd);}return null;};}function patchUpdates(_0x521bc3){return function(_0x512bdc){try{jsonpatch['apply'](_0x512bdc,_0x521bc3,!![]);}catch(_0xb55ebb){return BPromise['reject'](_0xb55ebb);}return _0x512bdc['save']();};}function saveUpdates(_0xd04eeb,_0x3cb40e){return function(_0x391204){if(_0x391204){return _0x391204[_0xcc0b('0x20')](_0xd04eeb)[_0xcc0b('0x21')](function(_0x4fbb49){return _0x4fbb49;});}return null;};}function removeEntity(_0x281c52,_0x2728cd){return function(_0x76842a){if(_0x76842a){return _0x76842a[_0xcc0b('0x22')]()['then'](function(){var _0x12bad5=_0x76842a['get']({'plain':!![]});var _0x3320c3=_0xcc0b('0x23');return db[_0xcc0b('0x24')][_0xcc0b('0x22')]({'where':{'type':_0x3320c3,'resourceId':_0x12bad5['id']}})[_0xcc0b('0x21')](function(){return _0x76842a;});})[_0xcc0b('0x21')](function(){_0x281c52[_0xcc0b('0x18')](0xcc)[_0xcc0b('0x17')]();});}};}function handleEntityNotFound(_0x342d9b,_0x241095){return function(_0x36d633){if(!_0x36d633){_0x342d9b[_0xcc0b('0x16')](0x194);}return _0x36d633;};}function handleError(_0x50b362,_0x51afda){_0x51afda=_0x51afda||0x1f4;return function(_0x26857f){logger[_0xcc0b('0x25')](_0x26857f['stack']);if(_0x26857f[_0xcc0b('0x26')]){delete _0x26857f[_0xcc0b('0x26')];}_0x50b362[_0xcc0b('0x18')](_0x51afda)['send'](_0x26857f);};}exports[_0xcc0b('0x27')]=function(_0x16cac2,_0x3a7faa){var _0x42ad8f={},_0x15a63e={},_0x1d8474={'count':0x0,'rows':[]};var _0x4758cc=_[_0xcc0b('0x28')](db[_0xcc0b('0x29')]['rawAttributes'],function(_0x3eabb9){return{'name':_0x3eabb9[_0xcc0b('0x2a')],'type':_0x3eabb9['type']['key']};});_0x15a63e['model']=_[_0xcc0b('0x28')](_0x4758cc,_0xcc0b('0x26'));_0x15a63e[_0xcc0b('0x2b')]=_[_0xcc0b('0x2c')](_0x16cac2[_0xcc0b('0x2b')]);_0x15a63e['filters']=_['intersection'](_0x15a63e[_0xcc0b('0x2d')],_0x15a63e[_0xcc0b('0x2b')]);_0x42ad8f[_0xcc0b('0x2e')]=_[_0xcc0b('0x2f')](_0x15a63e[_0xcc0b('0x2d')],qs[_0xcc0b('0x30')](_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x30')]));_0x42ad8f['attributes']=_0x42ad8f[_0xcc0b('0x2e')]['length']?_0x42ad8f[_0xcc0b('0x2e')]:_0x15a63e[_0xcc0b('0x2d')];if(!_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x31')](_0xcc0b('0x32'))){_0x42ad8f['limit']=qs[_0xcc0b('0x1d')](_0x16cac2['query'][_0xcc0b('0x1d')]);_0x42ad8f[_0xcc0b('0x1a')]=qs['offset'](_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x1a')]);}_0x42ad8f[_0xcc0b('0x33')]=qs[_0xcc0b('0x34')](_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x34')]);delete _0x16cac2['query'][_0xcc0b('0x34')];_0x42ad8f[_0xcc0b('0x35')]=qs[_0xcc0b('0x36')](_[_0xcc0b('0x37')](_0x16cac2[_0xcc0b('0x2b')],_0x15a63e[_0xcc0b('0x36')]),_0x4758cc);if(_0x16cac2[_0xcc0b('0x2b')]['filter']){_0x42ad8f['where']=_[_0xcc0b('0x38')](_0x42ad8f[_0xcc0b('0x35')],{'$or':_['map'](_0x4758cc,function(_0x18adbe){if(_0x18adbe[_0xcc0b('0x39')]!==_0xcc0b('0x3a')){var _0x4c7cd5={};_0x4c7cd5[_0x18adbe[_0xcc0b('0x26')]]={'$like':'%'+_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x3b')]+'%'};return _0x4c7cd5;}})});}_0x42ad8f=_[_0xcc0b('0x38')]({},_0x42ad8f,_0x16cac2[_0xcc0b('0x3c')]);var _0x1db93d={'where':_0x42ad8f['where']};return db[_0xcc0b('0x29')][_0xcc0b('0x1c')](_0x1db93d)[_0xcc0b('0x21')](function(_0x239ced){_0x1d8474[_0xcc0b('0x1c')]=_0x239ced;if(_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x3d')]){_0x42ad8f[_0xcc0b('0x3e')]=[{'all':!![]}];}return db[_0xcc0b('0x29')]['findAll'](_0x42ad8f);})['then'](function(_0x2f4431){_0x1d8474[_0xcc0b('0x3f')]=_0x2f4431;return _0x1d8474;})[_0xcc0b('0x21')](respondWithFilteredResult(_0x3a7faa,_0x42ad8f))[_0xcc0b('0x40')](handleError(_0x3a7faa,null));};exports[_0xcc0b('0x41')]=function(_0x5c9dfd,_0x55695d){var _0x4a00a9={'raw':![],'where':{'id':_0x5c9dfd['params']['id']}},_0x20e267={};_0x20e267[_0xcc0b('0x2d')]=_[_0xcc0b('0x2c')](db[_0xcc0b('0x29')]['rawAttributes']);_0x20e267[_0xcc0b('0x2b')]=_[_0xcc0b('0x2c')](_0x5c9dfd[_0xcc0b('0x2b')]);_0x20e267[_0xcc0b('0x36')]=_[_0xcc0b('0x2f')](_0x20e267[_0xcc0b('0x2d')],_0x20e267[_0xcc0b('0x2b')]);_0x4a00a9[_0xcc0b('0x2e')]=_[_0xcc0b('0x2f')](_0x20e267[_0xcc0b('0x2d')],qs['fields'](_0x5c9dfd[_0xcc0b('0x2b')][_0xcc0b('0x30')]));_0x4a00a9['attributes']=_0x4a00a9[_0xcc0b('0x2e')][_0xcc0b('0x42')]?_0x4a00a9['attributes']:_0x20e267['model'];if(_0x5c9dfd[_0xcc0b('0x2b')][_0xcc0b('0x3d')]){_0x4a00a9['include']=[{'all':!![]}];}_0x4a00a9=_[_0xcc0b('0x38')]({},_0x4a00a9,_0x5c9dfd[_0xcc0b('0x3c')]);return db[_0xcc0b('0x29')][_0xcc0b('0x43')](_0x4a00a9)[_0xcc0b('0x21')](handleEntityNotFound(_0x55695d,null))[_0xcc0b('0x21')](respondWithResult(_0x55695d,null))['catch'](handleError(_0x55695d,null));};exports['update']=function(_0x1e69b2,_0x2e41f0){if(_0x1e69b2[_0xcc0b('0x44')]['id']){delete _0x1e69b2['body']['id'];}return db['VoiceMusicOnHold'][_0xcc0b('0x43')]({'where':{'id':_0x1e69b2[_0xcc0b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e41f0,null))[_0xcc0b('0x21')](saveUpdates(_0x1e69b2['body'],null))[_0xcc0b('0x21')](respondWithResult(_0x2e41f0,null))[_0xcc0b('0x40')](handleError(_0x2e41f0,null));};exports[_0xcc0b('0x46')]=function(_0x3bd510,_0x3f842d,_0x35404c){return db[_0xcc0b('0x47')][_0xcc0b('0x48')](function(_0x461815){if(_0x3bd510[_0xcc0b('0x44')][_0xcc0b('0x49')]===_0xcc0b('0x4a')){_0x3bd510[_0xcc0b('0x44')][_0xcc0b('0x4b')]=path[_0xcc0b('0x4c')](config[_0xcc0b('0x4d')],_0xcc0b('0x4e'),_0x3bd510['body'][_0xcc0b('0x26')]);}return db[_0xcc0b('0x29')][_0xcc0b('0x46')](_0x3bd510[_0xcc0b('0x44')],{'transaction':_0x461815})[_0xcc0b('0x21')](function(_0x554f46){if(_0x3bd510[_0xcc0b('0x44')][_0xcc0b('0x49')]===_0xcc0b('0x4a')){fs[_0xcc0b('0x4f')](_0x554f46[_0xcc0b('0x4b')],parseInt('0777',0x8));}var _0x3748fe=_0x3bd510['user'][_0xcc0b('0x50')]({'plain':!![]});if(!_0x3748fe)throw new Error(_0xcc0b('0x51'));if(_0x3748fe[_0xcc0b('0x52')]===_0xcc0b('0x53')){var _0x27a839=_0x554f46['get']({'plain':!![]});return db[_0xcc0b('0x54')][_0xcc0b('0x43')]({'where':{'name':'MusicOnHolds','userProfileId':_0x3748fe[_0xcc0b('0x55')]},'raw':!![]})[_0xcc0b('0x21')](function(_0x4270e3){if(_0x4270e3&&_0x4270e3[_0xcc0b('0x56')]===0x0){return db[_0xcc0b('0x24')][_0xcc0b('0x46')]({'name':_0x27a839['name'],'resourceId':_0x27a839['id'],'type':_0x4270e3[_0xcc0b('0x26')],'sectionId':_0x4270e3['id']},{})['then'](function(){return _0x554f46;});}else{return _0x554f46;}})[_0xcc0b('0x40')](function(_0x5aca99){logger[_0xcc0b('0x25')](_0xcc0b('0x57'),_0x5aca99);});}return _0x554f46;});})['then'](respondWithResult(_0x3f842d,0xc9))[_0xcc0b('0x40')](handleError(_0x3f842d,null));};exports['destroy']=function(_0xdb2ef,_0x112fa6,_0x425022){var _0x5688d8;return db[_0xcc0b('0x29')][_0xcc0b('0x43')]({'where':{'id':_0xdb2ef[_0xcc0b('0x45')]['id']}})[_0xcc0b('0x21')](function(_0x4ec2cb){if(_0x4ec2cb){return db[_0xcc0b('0x47')][_0xcc0b('0x48')](function(_0x48873d){return _0x4ec2cb['destroy']({'transaction':_0x48873d,'raw':!![]})[_0xcc0b('0x21')](function(_0x4ed274){if(_0x4ed274[_0xcc0b('0x4b')]){fs[_0xcc0b('0x58')](_0x4ed274[_0xcc0b('0x4b')])[_0xcc0b('0x59')](function(_0x1def44){fs['unlinkSync'](path[_0xcc0b('0x4c')](_0x4ed274['directory'],_0x1def44));});fs[_0xcc0b('0x5a')](_0x4ed274[_0xcc0b('0x4b')]);}return _0x4ed274;});})[_0xcc0b('0x40')](function(_0x50aa6c){throw new db[(_0xcc0b('0x5b'))][(_0xcc0b('0x5c'))](_0x50aa6c[_0xcc0b('0x5d')]);});}})[_0xcc0b('0x21')](handleEntityNotFound(_0x112fa6,null))['then'](removeEntity(_0x112fa6,null))['catch'](handleError(_0x112fa6,null));};exports[_0xcc0b('0x5e')]=function(_0x17a411,_0x56d854,_0x5f5cc7){return db[_0xcc0b('0x47')]['transaction'](function(_0x22b592){var _0x34045b;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x17a411[_0xcc0b('0x45')]['id']}})[_0xcc0b('0x21')](function(_0x579965){if(_0x579965){_0x34045b=_0x579965;return _0x579965['addSound'](_0x17a411['body']['id'],{'transaction':_0x22b592});}})['then'](function(_0x21b1a3){if(_0x21b1a3){return db[_0xcc0b('0x5f')][_0xcc0b('0x60')]({'where':{'id':_0x17a411[_0xcc0b('0x44')]['id']},'attributes':['id','name',_0xcc0b('0x61'),_0xcc0b('0x62'),_0xcc0b('0x63')],'raw':!![]});}})[_0xcc0b('0x21')](function(_0x28cd81){if(_0x28cd81){var _0x58a9ee=path['join'](config[_0xcc0b('0x4d')],'server/files/sounds/converted',util[_0xcc0b('0x64')](_0xcc0b('0x65'),path['basename'](_0x28cd81[_0xcc0b('0x61')],path['extname'](_0x28cd81['save_name'])),_0x28cd81[_0xcc0b('0x62')]));var _0x23a2e1=path[_0xcc0b('0x4c')](config[_0xcc0b('0x4d')],_0xcc0b('0x4e'),_0x34045b['name'],util[_0xcc0b('0x64')](_0xcc0b('0x65'),_0x28cd81['name'],_0x28cd81[_0xcc0b('0x62')]));fs[_0xcc0b('0x66')](_0x58a9ee,_0x23a2e1);return _0x28cd81;}})['catch'](function(_0x5ce986){throw new db['Sequelize'][(_0xcc0b('0x5c'))](_0x5ce986[_0xcc0b('0x5d')]);});})[_0xcc0b('0x21')](handleEntityNotFound(_0x56d854,null))[_0xcc0b('0x21')](respondWithResult(_0x56d854,0xc9))[_0xcc0b('0x40')](handleError(_0x56d854,null));};exports[_0xcc0b('0x67')]=function(_0x158e9a,_0x4fbe6a,_0x4c8ad2){return db[_0xcc0b('0x47')]['transaction'](function(_0xe28438){var _0x17ba1e;return db[_0xcc0b('0x29')][_0xcc0b('0x60')]({'where':{'id':_0x158e9a[_0xcc0b('0x45')]['id']}})[_0xcc0b('0x21')](handleEntityNotFound(_0x4fbe6a,null))[_0xcc0b('0x21')](function(_0x50bc96){if(_0x50bc96){_0x17ba1e=_0x50bc96;return _0x50bc96['removeSound'](_0x158e9a[_0xcc0b('0x45')][_0xcc0b('0x68')]);}})[_0xcc0b('0x21')](function(_0x21485a){if(_0x21485a){return db[_0xcc0b('0x5f')]['findOne']({'where':{'id':_0x158e9a[_0xcc0b('0x45')][_0xcc0b('0x68')]},'attributes':['id','name',_0xcc0b('0x61'),'converted_format',_0xcc0b('0x63')],'raw':!![]});}})[_0xcc0b('0x21')](function(_0x3858cb){if(_0x3858cb){fs['unlinkSync'](path[_0xcc0b('0x4c')](_0x17ba1e[_0xcc0b('0x4b')],util[_0xcc0b('0x64')](_0xcc0b('0x65'),_0x3858cb[_0xcc0b('0x26')],_0x3858cb[_0xcc0b('0x62')])));return _0x3858cb;}})[_0xcc0b('0x40')](function(_0x92c58b){throw new db[(_0xcc0b('0x5b'))][(_0xcc0b('0x5c'))](_0x92c58b[_0xcc0b('0x5d')]);});})[_0xcc0b('0x21')](handleEntityNotFound(_0x4fbe6a,null))[_0xcc0b('0x21')](respondWithStatusCode(_0x4fbe6a,0xcc))[_0xcc0b('0x40')](handleError(_0x4fbe6a,null));};exports['getSounds']=function(_0x12805b,_0x3d902a,_0x238931){var _0x1aed17={};var _0x421930={};var _0x35a371;var _0x3ec5cb;return db[_0xcc0b('0x29')][_0xcc0b('0x60')]({'where':{'id':_0x12805b['params']['id']}})['then'](handleEntityNotFound(_0x3d902a,null))[_0xcc0b('0x21')](function(_0x2c354e){if(_0x2c354e){_0x35a371=_0x2c354e;_0x421930[_0xcc0b('0x2d')]=_[_0xcc0b('0x2c')](db[_0xcc0b('0x5f')][_0xcc0b('0x69')]);_0x421930[_0xcc0b('0x2b')]=_[_0xcc0b('0x2c')](_0x12805b['query']);_0x421930[_0xcc0b('0x36')]=_[_0xcc0b('0x2f')](_0x421930[_0xcc0b('0x2d')],_0x421930['query']);_0x1aed17[_0xcc0b('0x2e')]=_[_0xcc0b('0x2f')](_0x421930[_0xcc0b('0x2d')],qs['fields'](_0x12805b['query']['fields']));_0x1aed17['attributes']=_0x1aed17['attributes'][_0xcc0b('0x42')]?_0x1aed17[_0xcc0b('0x2e')]:_0x421930[_0xcc0b('0x2d')];_0x1aed17[_0xcc0b('0x33')]=qs['sort'](_0x12805b['query'][_0xcc0b('0x34')]);_0x1aed17[_0xcc0b('0x35')]=qs[_0xcc0b('0x36')](_['pick'](_0x12805b[_0xcc0b('0x2b')],_0x421930[_0xcc0b('0x36')]));if(_0x12805b['query'][_0xcc0b('0x3b')]){_0x1aed17['where']=_[_0xcc0b('0x38')](_0x1aed17[_0xcc0b('0x35')],{'$or':_['map'](_0x1aed17[_0xcc0b('0x2e')],function(_0x55c191){var _0x5a62c0={};_0x5a62c0[_0x55c191]={'$like':'%'+_0x12805b['query'][_0xcc0b('0x3b')]+'%'};return _0x5a62c0;})});}_0x1aed17=_[_0xcc0b('0x38')]({},_0x1aed17,_0x12805b[_0xcc0b('0x3c')]);return _0x35a371[_0xcc0b('0x6a')](_0x1aed17);}})['then'](function(_0x65a3ae){if(_0x65a3ae){_0x3ec5cb=_0x65a3ae['length'];if(!_0x12805b['query'][_0xcc0b('0x31')](_0xcc0b('0x32'))){_0x1aed17[_0xcc0b('0x1d')]=qs[_0xcc0b('0x1d')](_0x12805b[_0xcc0b('0x2b')]['limit']);_0x1aed17[_0xcc0b('0x1a')]=qs[_0xcc0b('0x1a')](_0x12805b[_0xcc0b('0x2b')]['offset']);}return _0x35a371[_0xcc0b('0x6a')](_0x1aed17);}})[_0xcc0b('0x21')](function(_0x1a58b0){if(_0x1a58b0){return _0x1a58b0?{'count':_0x3ec5cb,'rows':_0x1a58b0}:null;}})['then'](respondWithResult(_0x3d902a,null))[_0xcc0b('0x40')](handleError(_0x3d902a,null));}; \ No newline at end of file +var _0x9868=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','catch','params','length','find','body','sequelize','mode','files','directory','join','root','server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MusicOnHolds','userProfileId','error','transaction','forEach','unlinkSync','Sequelize','ValidationError','addSound','Sound','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','message','findOne','removeSound','id2','createdAt','getSounds','hasOwnProperty','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x1abd48,_0x14f96c){var _0x5b2628=function(_0x5bd9d0){while(--_0x5bd9d0){_0x1abd48['push'](_0x1abd48['shift']());}};_0x5b2628(++_0x14f96c);}(_0x9868,0x1b0));var _0x8986=function(_0x4004f8,_0x5e055b){_0x4004f8=_0x4004f8-0x0;var _0x475fb5=_0x9868[_0x4004f8];return _0x475fb5;};'use strict';var emlformat=require(_0x8986('0x0'));var rimraf=require(_0x8986('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8986('0x2'));var rp=require(_0x8986('0x3'));var moment=require(_0x8986('0x4'));var BPromise=require(_0x8986('0x5'));var Mustache=require(_0x8986('0x6'));var util=require(_0x8986('0x7'));var path=require(_0x8986('0x8'));var sox=require(_0x8986('0x9'));var csv=require(_0x8986('0xa'));var ejs=require(_0x8986('0xb'));var fs=require('fs');var fs_extra=require(_0x8986('0xc'));var _=require('lodash');var squel=require(_0x8986('0xd'));var crypto=require(_0x8986('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8986('0xf'));var toCsv=require(_0x8986('0xa'));var querystring=require(_0x8986('0x10'));var Papa=require(_0x8986('0x11'));var Redis=require('ioredis');var authService=require(_0x8986('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8986('0x13'));var hardwareService=require(_0x8986('0x14'));var logger=require(_0x8986('0x15'))(_0x8986('0x16'));var utils=require(_0x8986('0x17'));var config=require(_0x8986('0x18'));var licenseUtil=require(_0x8986('0x19'));var db=require(_0x8986('0x1a'))['db'];function respondWithStatusCode(_0x16f09c,_0x516764){_0x516764=_0x516764||0xcc;return function(_0x3c492b){if(_0x3c492b){return _0x16f09c['sendStatus'](_0x516764);}return _0x16f09c[_0x8986('0x1b')](_0x516764)[_0x8986('0x1c')]();};}function respondWithResult(_0x308bb4,_0x371c7e){_0x371c7e=_0x371c7e||0xc8;return function(_0x1dd6c9){if(_0x1dd6c9){return _0x308bb4[_0x8986('0x1b')](_0x371c7e)[_0x8986('0x1d')](_0x1dd6c9);}};}function respondWithFilteredResult(_0x7812cc,_0x4b0be6){return function(_0x57c45d){if(_0x57c45d){var _0x2a4bff=typeof _0x4b0be6[_0x8986('0x1e')]===_0x8986('0x1f')&&typeof _0x4b0be6[_0x8986('0x20')]===_0x8986('0x1f');var _0x1c8e9e=_0x57c45d[_0x8986('0x21')];var _0x5a4cf4=_0x2a4bff?0x0:_0x4b0be6[_0x8986('0x1e')];var _0x3ea908=_0x2a4bff?_0x57c45d[_0x8986('0x21')]:_0x4b0be6[_0x8986('0x1e')]+_0x4b0be6[_0x8986('0x20')];var _0x18fc6b;if(_0x3ea908>=_0x1c8e9e){_0x3ea908=_0x1c8e9e;_0x18fc6b=0xc8;}else{_0x18fc6b=0xce;}_0x7812cc[_0x8986('0x1b')](_0x18fc6b);return _0x7812cc[_0x8986('0x22')](_0x8986('0x23'),_0x5a4cf4+'-'+_0x3ea908+'/'+_0x1c8e9e)[_0x8986('0x1d')](_0x57c45d);}return null;};}function patchUpdates(_0x433eb7){return function(_0x327dcb){try{jsonpatch[_0x8986('0x24')](_0x327dcb,_0x433eb7,!![]);}catch(_0x225758){return BPromise[_0x8986('0x25')](_0x225758);}return _0x327dcb[_0x8986('0x26')]();};}function saveUpdates(_0x28c1f2,_0x5a94a0){return function(_0x5d9e90){if(_0x5d9e90){return _0x5d9e90[_0x8986('0x27')](_0x28c1f2)[_0x8986('0x28')](function(_0x5cfb76){return _0x5cfb76;});}return null;};}function removeEntity(_0x558c80,_0x5c18aa){return function(_0x5372b5){if(_0x5372b5){return _0x5372b5['destroy']()[_0x8986('0x28')](function(){var _0x4836cd=_0x5372b5[_0x8986('0x29')]({'plain':!![]});var _0x1bf5ba='MusicOnHolds';return db[_0x8986('0x2a')][_0x8986('0x2b')]({'where':{'type':_0x1bf5ba,'resourceId':_0x4836cd['id']}})['then'](function(){return _0x5372b5;});})[_0x8986('0x28')](function(){_0x558c80[_0x8986('0x1b')](0xcc)[_0x8986('0x1c')]();});}};}function handleEntityNotFound(_0x21ab07,_0x2ec676){return function(_0x17a648){if(!_0x17a648){_0x21ab07[_0x8986('0x2c')](0x194);}return _0x17a648;};}function handleError(_0x103f16,_0x5ccda6){_0x5ccda6=_0x5ccda6||0x1f4;return function(_0x394ddf){logger['error'](_0x394ddf['stack']);if(_0x394ddf[_0x8986('0x2d')]){delete _0x394ddf['name'];}_0x103f16['status'](_0x5ccda6)[_0x8986('0x2e')](_0x394ddf);};}exports[_0x8986('0x2f')]=function(_0x118030,_0xa9ece5){var _0x413176={},_0x58dd03={},_0x88003c={'count':0x0,'rows':[]};var _0x43ccd9=_[_0x8986('0x30')](db[_0x8986('0x31')][_0x8986('0x32')],function(_0xb4e87d){return{'name':_0xb4e87d[_0x8986('0x33')],'type':_0xb4e87d['type']['key']};});_0x58dd03[_0x8986('0x34')]=_['map'](_0x43ccd9,'name');_0x58dd03[_0x8986('0x35')]=_[_0x8986('0x36')](_0x118030['query']);_0x58dd03[_0x8986('0x37')]=_[_0x8986('0x38')](_0x58dd03[_0x8986('0x34')],_0x58dd03[_0x8986('0x35')]);_0x413176[_0x8986('0x39')]=_[_0x8986('0x38')](_0x58dd03[_0x8986('0x34')],qs[_0x8986('0x3a')](_0x118030[_0x8986('0x35')]['fields']));_0x413176[_0x8986('0x39')]=_0x413176[_0x8986('0x39')]['length']?_0x413176[_0x8986('0x39')]:_0x58dd03[_0x8986('0x34')];if(!_0x118030['query']['hasOwnProperty']('nolimit')){_0x413176[_0x8986('0x20')]=qs[_0x8986('0x20')](_0x118030[_0x8986('0x35')][_0x8986('0x20')]);_0x413176[_0x8986('0x1e')]=qs[_0x8986('0x1e')](_0x118030[_0x8986('0x35')][_0x8986('0x1e')]);}_0x413176[_0x8986('0x3b')]=qs[_0x8986('0x3c')](_0x118030[_0x8986('0x35')][_0x8986('0x3c')]);delete _0x118030[_0x8986('0x35')][_0x8986('0x3c')];_0x413176[_0x8986('0x3d')]=qs['filters'](_[_0x8986('0x3e')](_0x118030['query'],_0x58dd03[_0x8986('0x37')]),_0x43ccd9);if(_0x118030[_0x8986('0x35')]['filter']){_0x413176['where']=_[_0x8986('0x3f')](_0x413176['where'],{'$or':_[_0x8986('0x30')](_0x43ccd9,function(_0x3f6806){if(_0x3f6806[_0x8986('0x40')]!=='VIRTUAL'){var _0x1fa2c2={};_0x1fa2c2[_0x3f6806[_0x8986('0x2d')]]={'$like':'%'+_0x118030[_0x8986('0x35')][_0x8986('0x41')]+'%'};return _0x1fa2c2;}})});}_0x413176=_[_0x8986('0x3f')]({},_0x413176,_0x118030[_0x8986('0x42')]);var _0x2ec745={'where':_0x413176['where']};return db[_0x8986('0x31')][_0x8986('0x21')](_0x2ec745)[_0x8986('0x28')](function(_0x2a1bc5){_0x88003c[_0x8986('0x21')]=_0x2a1bc5;if(_0x118030[_0x8986('0x35')][_0x8986('0x43')]){_0x413176[_0x8986('0x44')]=[{'all':!![]}];}return db[_0x8986('0x31')][_0x8986('0x45')](_0x413176);})[_0x8986('0x28')](function(_0x2398b0){_0x88003c['rows']=_0x2398b0;return _0x88003c;})[_0x8986('0x28')](respondWithFilteredResult(_0xa9ece5,_0x413176))[_0x8986('0x46')](handleError(_0xa9ece5,null));};exports['show']=function(_0xa7d9f,_0x469e3f){var _0x3b4052={'raw':![],'where':{'id':_0xa7d9f[_0x8986('0x47')]['id']}},_0x7fb48d={};_0x7fb48d[_0x8986('0x34')]=_[_0x8986('0x36')](db[_0x8986('0x31')][_0x8986('0x32')]);_0x7fb48d[_0x8986('0x35')]=_[_0x8986('0x36')](_0xa7d9f[_0x8986('0x35')]);_0x7fb48d[_0x8986('0x37')]=_[_0x8986('0x38')](_0x7fb48d[_0x8986('0x34')],_0x7fb48d[_0x8986('0x35')]);_0x3b4052[_0x8986('0x39')]=_[_0x8986('0x38')](_0x7fb48d[_0x8986('0x34')],qs[_0x8986('0x3a')](_0xa7d9f[_0x8986('0x35')][_0x8986('0x3a')]));_0x3b4052[_0x8986('0x39')]=_0x3b4052[_0x8986('0x39')][_0x8986('0x48')]?_0x3b4052[_0x8986('0x39')]:_0x7fb48d[_0x8986('0x34')];if(_0xa7d9f['query'][_0x8986('0x43')]){_0x3b4052[_0x8986('0x44')]=[{'all':!![]}];}_0x3b4052=_[_0x8986('0x3f')]({},_0x3b4052,_0xa7d9f[_0x8986('0x42')]);return db[_0x8986('0x31')][_0x8986('0x49')](_0x3b4052)[_0x8986('0x28')](handleEntityNotFound(_0x469e3f,null))[_0x8986('0x28')](respondWithResult(_0x469e3f,null))['catch'](handleError(_0x469e3f,null));};exports['update']=function(_0x2bc5b6,_0x4b4af4){if(_0x2bc5b6[_0x8986('0x4a')]['id']){delete _0x2bc5b6[_0x8986('0x4a')]['id'];}return db[_0x8986('0x31')]['find']({'where':{'id':_0x2bc5b6['params']['id']}})['then'](handleEntityNotFound(_0x4b4af4,null))[_0x8986('0x28')](saveUpdates(_0x2bc5b6[_0x8986('0x4a')],null))['then'](respondWithResult(_0x4b4af4,null))[_0x8986('0x46')](handleError(_0x4b4af4,null));};exports['create']=function(_0x2662ec,_0x4f0939,_0x33d498){return db[_0x8986('0x4b')]['transaction'](function(_0x4d1866){if(_0x2662ec[_0x8986('0x4a')][_0x8986('0x4c')]===_0x8986('0x4d')){_0x2662ec[_0x8986('0x4a')][_0x8986('0x4e')]=path[_0x8986('0x4f')](config[_0x8986('0x50')],_0x8986('0x51'),_0x2662ec[_0x8986('0x4a')]['name']);}return db['VoiceMusicOnHold'][_0x8986('0x52')](_0x2662ec[_0x8986('0x4a')],{'transaction':_0x4d1866})['then'](function(_0x2c6e6a){if(_0x2662ec[_0x8986('0x4a')]['mode']===_0x8986('0x4d')){fs[_0x8986('0x53')](_0x2c6e6a[_0x8986('0x4e')],parseInt(_0x8986('0x54'),0x8));}var _0x11f74a=_0x2662ec[_0x8986('0x55')][_0x8986('0x29')]({'plain':!![]});if(!_0x11f74a)throw new Error(_0x8986('0x56'));if(_0x11f74a['role']===_0x8986('0x55')){var _0x5d1797=_0x2c6e6a['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x8986('0x57'),'userProfileId':_0x11f74a[_0x8986('0x58')]},'raw':!![]})['then'](function(_0x20ff0c){if(_0x20ff0c&&_0x20ff0c['autoAssociation']===0x0){return db[_0x8986('0x2a')][_0x8986('0x52')]({'name':_0x5d1797['name'],'resourceId':_0x5d1797['id'],'type':_0x20ff0c['name'],'sectionId':_0x20ff0c['id']},{})[_0x8986('0x28')](function(){return _0x2c6e6a;});}else{return _0x2c6e6a;}})[_0x8986('0x46')](function(_0x3fbec7){logger[_0x8986('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fbec7);});}return _0x2c6e6a;});})[_0x8986('0x28')](respondWithResult(_0x4f0939,0xc9))['catch'](handleError(_0x4f0939,null));};exports[_0x8986('0x2b')]=function(_0x1ff206,_0x560b77,_0xd3aca3){var _0x1c215c;return db[_0x8986('0x31')][_0x8986('0x49')]({'where':{'id':_0x1ff206['params']['id']}})[_0x8986('0x28')](function(_0x4d0f1d){if(_0x4d0f1d){return db[_0x8986('0x4b')][_0x8986('0x5a')](function(_0x4d322c){return _0x4d0f1d[_0x8986('0x2b')]({'transaction':_0x4d322c,'raw':!![]})[_0x8986('0x28')](function(_0x5cb219){if(_0x5cb219[_0x8986('0x4e')]){fs['readdirSync'](_0x5cb219[_0x8986('0x4e')])[_0x8986('0x5b')](function(_0x29a628){fs[_0x8986('0x5c')](path[_0x8986('0x4f')](_0x5cb219[_0x8986('0x4e')],_0x29a628));});fs['rmdirSync'](_0x5cb219['directory']);}return _0x5cb219;});})['catch'](function(_0x5cd242){throw new db[(_0x8986('0x5d'))][(_0x8986('0x5e'))](_0x5cd242['message']);});}})[_0x8986('0x28')](handleEntityNotFound(_0x560b77,null))[_0x8986('0x28')](removeEntity(_0x560b77,null))['catch'](handleError(_0x560b77,null));};exports[_0x8986('0x5f')]=function(_0x586fb7,_0x3aa54f,_0xd63da4){return db['sequelize']['transaction'](function(_0x576a27){var _0x9d269b;return db[_0x8986('0x31')]['find']({'where':{'id':_0x586fb7['params']['id']}})[_0x8986('0x28')](function(_0x425554){if(_0x425554){_0x9d269b=_0x425554;return _0x425554['addSound'](_0x586fb7[_0x8986('0x4a')]['id'],{'transaction':_0x576a27});}})[_0x8986('0x28')](function(_0x4524a0){if(_0x4524a0){return db[_0x8986('0x60')]['findOne']({'where':{'id':_0x586fb7[_0x8986('0x4a')]['id']},'attributes':['id',_0x8986('0x2d'),_0x8986('0x61'),_0x8986('0x62'),'createdAt'],'raw':!![]});}})[_0x8986('0x28')](function(_0x56d54f){if(_0x56d54f){var _0x388a66=path[_0x8986('0x4f')](config['root'],_0x8986('0x63'),util[_0x8986('0x64')](_0x8986('0x65'),path[_0x8986('0x66')](_0x56d54f[_0x8986('0x61')],path['extname'](_0x56d54f[_0x8986('0x61')])),_0x56d54f[_0x8986('0x62')]));var _0x2e7e7a=path['join'](config[_0x8986('0x50')],_0x8986('0x51'),_0x9d269b[_0x8986('0x2d')],util[_0x8986('0x64')]('%s.%s',_0x56d54f[_0x8986('0x2d')],_0x56d54f[_0x8986('0x62')]));fs[_0x8986('0x67')](_0x388a66,_0x2e7e7a);return _0x56d54f;}})[_0x8986('0x46')](function(_0x15eed3){throw new db[(_0x8986('0x5d'))][(_0x8986('0x5e'))](_0x15eed3[_0x8986('0x68')]);});})[_0x8986('0x28')](handleEntityNotFound(_0x3aa54f,null))[_0x8986('0x28')](respondWithResult(_0x3aa54f,0xc9))['catch'](handleError(_0x3aa54f,null));};exports['removeSound']=function(_0x4b9deb,_0x3b885d,_0x4db274){return db['sequelize'][_0x8986('0x5a')](function(_0x110e8e){var _0x586f48;return db[_0x8986('0x31')][_0x8986('0x69')]({'where':{'id':_0x4b9deb[_0x8986('0x47')]['id']}})[_0x8986('0x28')](handleEntityNotFound(_0x3b885d,null))[_0x8986('0x28')](function(_0x4ae529){if(_0x4ae529){_0x586f48=_0x4ae529;return _0x4ae529[_0x8986('0x6a')](_0x4b9deb['params'][_0x8986('0x6b')]);}})[_0x8986('0x28')](function(_0x4c97d4){if(_0x4c97d4){return db[_0x8986('0x60')][_0x8986('0x69')]({'where':{'id':_0x4b9deb[_0x8986('0x47')][_0x8986('0x6b')]},'attributes':['id',_0x8986('0x2d'),_0x8986('0x61'),_0x8986('0x62'),_0x8986('0x6c')],'raw':!![]});}})['then'](function(_0x50fece){if(_0x50fece){fs[_0x8986('0x5c')](path[_0x8986('0x4f')](_0x586f48['directory'],util['format'](_0x8986('0x65'),_0x50fece[_0x8986('0x2d')],_0x50fece['converted_format'])));return _0x50fece;}})[_0x8986('0x46')](function(_0x2dbddb){throw new db[(_0x8986('0x5d'))][(_0x8986('0x5e'))](_0x2dbddb[_0x8986('0x68')]);});})[_0x8986('0x28')](handleEntityNotFound(_0x3b885d,null))[_0x8986('0x28')](respondWithStatusCode(_0x3b885d,0xcc))[_0x8986('0x46')](handleError(_0x3b885d,null));};exports['getSounds']=function(_0x40bff3,_0x32ff93,_0x594d39){var _0x4afed2={};var _0xce4221={};var _0x2addef;var _0x5bbab1;return db[_0x8986('0x31')][_0x8986('0x69')]({'where':{'id':_0x40bff3[_0x8986('0x47')]['id']}})[_0x8986('0x28')](handleEntityNotFound(_0x32ff93,null))[_0x8986('0x28')](function(_0x3cd5b8){if(_0x3cd5b8){_0x2addef=_0x3cd5b8;_0xce4221['model']=_[_0x8986('0x36')](db[_0x8986('0x60')]['rawAttributes']);_0xce4221[_0x8986('0x35')]=_[_0x8986('0x36')](_0x40bff3[_0x8986('0x35')]);_0xce4221[_0x8986('0x37')]=_[_0x8986('0x38')](_0xce4221[_0x8986('0x34')],_0xce4221[_0x8986('0x35')]);_0x4afed2[_0x8986('0x39')]=_['intersection'](_0xce4221[_0x8986('0x34')],qs[_0x8986('0x3a')](_0x40bff3[_0x8986('0x35')][_0x8986('0x3a')]));_0x4afed2['attributes']=_0x4afed2[_0x8986('0x39')]['length']?_0x4afed2[_0x8986('0x39')]:_0xce4221['model'];_0x4afed2['order']=qs[_0x8986('0x3c')](_0x40bff3[_0x8986('0x35')][_0x8986('0x3c')]);_0x4afed2[_0x8986('0x3d')]=qs[_0x8986('0x37')](_[_0x8986('0x3e')](_0x40bff3[_0x8986('0x35')],_0xce4221['filters']));if(_0x40bff3[_0x8986('0x35')][_0x8986('0x41')]){_0x4afed2[_0x8986('0x3d')]=_['merge'](_0x4afed2[_0x8986('0x3d')],{'$or':_[_0x8986('0x30')](_0x4afed2[_0x8986('0x39')],function(_0x212b6e){var _0x313b4b={};_0x313b4b[_0x212b6e]={'$like':'%'+_0x40bff3[_0x8986('0x35')][_0x8986('0x41')]+'%'};return _0x313b4b;})});}_0x4afed2=_[_0x8986('0x3f')]({},_0x4afed2,_0x40bff3[_0x8986('0x42')]);return _0x2addef[_0x8986('0x6d')](_0x4afed2);}})[_0x8986('0x28')](function(_0x47144a){if(_0x47144a){_0x5bbab1=_0x47144a['length'];if(!_0x40bff3[_0x8986('0x35')][_0x8986('0x6e')](_0x8986('0x6f'))){_0x4afed2[_0x8986('0x20')]=qs[_0x8986('0x20')](_0x40bff3[_0x8986('0x35')][_0x8986('0x20')]);_0x4afed2[_0x8986('0x1e')]=qs[_0x8986('0x1e')](_0x40bff3['query'][_0x8986('0x1e')]);}return _0x2addef['getSounds'](_0x4afed2);}})['then'](function(_0x345eae){if(_0x345eae){return _0x345eae?{'count':_0x5bbab1,'rows':_0x345eae}:null;}})[_0x8986('0x28')](respondWithResult(_0x32ff93,null))['catch'](handleError(_0x32ff93,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b372b6b..804addd 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 _0x06eb=['./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d34fa,_0x5bc7ac){var _0x326489=function(_0x594209){while(--_0x594209){_0x3d34fa['push'](_0x3d34fa['shift']());}};_0x326489(++_0x5bc7ac);}(_0x06eb,0x13c));var _0xb06e=function(_0x2a4729,_0x4e8097){_0x2a4729=_0x2a4729-0x0;var _0xcbac55=_0x06eb[_0x2a4729];return _0xcbac55;};'use strict';var _=require(_0xb06e('0x0'));var util=require(_0xb06e('0x1'));var logger=require('../../config/logger')(_0xb06e('0x2'));var moment=require('moment');var BPromise=require(_0xb06e('0x3'));var rp=require(_0xb06e('0x4'));var fs=require('fs');var path=require(_0xb06e('0x5'));var rimraf=require(_0xb06e('0x6'));var config=require(_0xb06e('0x7'));var attributes=require(_0xb06e('0x8'));module[_0xb06e('0x9')]=function(_0xcbd84e,_0x2a8aa5){return _0xcbd84e['define'](_0xb06e('0xa'),attributes,{'tableName':_0xb06e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e85=['rimraf','./voiceMusicOnHold.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ded8b,_0x56e874){var _0x7528ad=function(_0x5e4d30){while(--_0x5e4d30){_0x2ded8b['push'](_0x2ded8b['shift']());}};_0x7528ad(++_0x56e874);}(_0x1e85,0x1a6));var _0x51e8=function(_0x353ed8,_0x3d0cd8){_0x353ed8=_0x353ed8-0x0;var _0x2582cf=_0x1e85[_0x353ed8];return _0x2582cf;};'use strict';var _=require(_0x51e8('0x0'));var util=require(_0x51e8('0x1'));var logger=require(_0x51e8('0x2'))(_0x51e8('0x3'));var moment=require(_0x51e8('0x4'));var BPromise=require(_0x51e8('0x5'));var rp=require(_0x51e8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51e8('0x7'));var config=require('../../config/environment');var attributes=require(_0x51e8('0x8'));module[_0x51e8('0x9')]=function(_0x42f055,_0x43d087){return _0x42f055[_0x51e8('0xa')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','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 a2ac8ae..e16ae6a 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x411610,_0x26f8cb){var _0x3d6f03=function(_0x14218f){while(--_0x14218f){_0x411610['push'](_0x411610['shift']());}};_0x3d6f03(++_0x26f8cb);}(_0x70e0,0x17b));var _0x070e=function(_0xc2d811,_0x1677fb){_0xc2d811=_0xc2d811-0x0;var _0x5e254f=_0x70e0[_0xc2d811];return _0x5e254f;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +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(_0x289344,_0x5941e4){var _0x487f3e=function(_0x2e21bb){while(--_0x2e21bb){_0x289344['push'](_0x289344['shift']());}};_0x487f3e(++_0x5941e4);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'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 dad6876..933ca4e 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 _0x723e=['destroy','delete','removeAgents','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','put','update'];(function(_0x3f7454,_0x343109){var _0x12a8e7=function(_0x1aacaf){while(--_0x1aacaf){_0x3f7454['push'](_0x3f7454['shift']());}};_0x12a8e7(++_0x343109);}(_0x723e,0x179));var _0xe723=function(_0x4624c4,_0x2620c9){_0x4624c4=_0x4624c4-0x0;var _0x3c0d60=_0x723e[_0x4624c4];return _0x3c0d60;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xc')](_0xe723('0xf'),auth['isAuthenticated'](),controller[_0xe723('0x10')]);router[_0xe723('0xc')](_0xe723('0x11'),auth['isAuthenticated'](),controller[_0xe723('0x12')]);router[_0xe723('0xc')](_0xe723('0x13'),auth['isAuthenticated'](),controller[_0xe723('0x14')]);router[_0xe723('0x15')]('/',auth[_0xe723('0xa')](),controller[_0xe723('0x16')]);router[_0xe723('0x15')]('/:id/users',auth[_0xe723('0xa')](),controller['addAgents']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xe723('0x17')]);router[_0xe723('0x18')](_0xe723('0xf'),auth[_0xe723('0xa')](),controller[_0xe723('0x19')]);router['delete'](_0xe723('0xf'),auth[_0xe723('0xa')](),controller[_0xe723('0x1a')]);router[_0xe723('0x1b')](_0xe723('0x11'),auth[_0xe723('0xa')](),controller[_0xe723('0x1c')]);router[_0xe723('0x1b')](_0xe723('0x13'),auth[_0xe723('0xa')](),controller[_0xe723('0x1d')]);module[_0xe723('0x1e')]=router; \ No newline at end of file +var _0xae4a=['create','addAgents','addTeams','put','/:id','update','destroy','delete','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','/:id/teams','getTeams','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xae4a,0x68));var _0xaae4=function(_0x1518e6,_0x3a6599){_0x1518e6=_0x1518e6-0x0;var _0x3f4c83=_0xae4a[_0x1518e6];return _0x3f4c83;};'use strict';var multer=require(_0xaae4('0x0'));var util=require(_0xaae4('0x1'));var path=require('path');var timeout=require(_0xaae4('0x2'));var express=require(_0xaae4('0x3'));var router=express['Router']();var fs_extra=require(_0xaae4('0x4'));var auth=require(_0xaae4('0x5'));var interaction=require(_0xaae4('0x6'));var config=require(_0xaae4('0x7'));var controller=require(_0xaae4('0x8'));router[_0xaae4('0x9')]('/',auth[_0xaae4('0xa')](),controller[_0xaae4('0xb')]);router[_0xaae4('0x9')](_0xaae4('0xc'),auth[_0xaae4('0xa')](),controller[_0xaae4('0xd')]);router[_0xaae4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaae4('0xe')]);router[_0xaae4('0x9')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x10')]);router[_0xaae4('0x9')](_0xaae4('0x11'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x12')]);router[_0xaae4('0x13')]('/',auth[_0xaae4('0xa')](),controller[_0xaae4('0x14')]);router[_0xaae4('0x13')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x15')]);router[_0xaae4('0x13')](_0xaae4('0x11'),auth['isAuthenticated'](),controller[_0xaae4('0x16')]);router[_0xaae4('0x17')](_0xaae4('0x18'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x19')]);router['delete'](_0xaae4('0x18'),auth['isAuthenticated'](),controller[_0xaae4('0x1a')]);router[_0xaae4('0x1b')](_0xaae4('0xf'),auth[_0xaae4('0xa')](),controller[_0xaae4('0x1c')]);router[_0xaae4('0x1b')]('/:id/teams',auth[_0xaae4('0xa')](),controller[_0xaae4('0x1d')]);module[_0xaae4('0x1e')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index cad234f..8d8323e 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 _0x7565=['system-','getDataValue','name','INTEGER','sequelize','exports','STRING','VIRTUAL'];(function(_0x477d8f,_0x4e0e3c){var _0x17c560=function(_0x549209){while(--_0x549209){_0x477d8f['push'](_0x477d8f['shift']());}};_0x17c560(++_0x4e0e3c);}(_0x7565,0x7c));var _0x5756=function(_0x302f4a,_0x1f14d1){_0x302f4a=_0x302f4a-0x0;var _0x243d7b=_0x7565[_0x302f4a];return _0x243d7b;};'use strict';var Sequelize=require(_0x5756('0x0'));module[_0x5756('0x1')]={'name':{'type':Sequelize[_0x5756('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x5756('0x3')],'get':function(_0xb50ecd){return _0x5756('0x4')+this[_0x5756('0x5')](_0x5756('0x6'))+'-';}},'description':{'type':Sequelize[_0x5756('0x2')]},'callerIdAll':{'type':Sequelize[_0x5756('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x5756('0x7')]}}; \ No newline at end of file +var _0x738e=['name','INTEGER','sequelize','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x1706b4,_0x19fed6){var _0x42dcb5=function(_0x50946a){while(--_0x50946a){_0x1706b4['push'](_0x1706b4['shift']());}};_0x42dcb5(++_0x19fed6);}(_0x738e,0x122));var _0xe738=function(_0x3eb1c1,_0x1bb418){_0x3eb1c1=_0x3eb1c1-0x0;var _0x53645a=_0x738e[_0x3eb1c1];return _0x53645a;};'use strict';var Sequelize=require(_0xe738('0x0'));module[_0xe738('0x1')]={'name':{'type':Sequelize[_0xe738('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xe738('0x3')],'get':function(_0x520443){return _0xe738('0x4')+this[_0xe738('0x5')](_0xe738('0x6'))+'-';}},'description':{'type':Sequelize[_0xe738('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xe738('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 3375b74..cf9db9f 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 _0x0598=['bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','count','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','options','find','describe','sequelize','transaction','create','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension','priority','NoOp','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','eml-format','rimraf','fast-json-patch'];(function(_0x241fc6,_0x1ff659){var _0x2639ba=function(_0x3c6bdc){while(--_0x3c6bdc){_0x241fc6['push'](_0x241fc6['shift']());}};_0x2639ba(++_0x1ff659);}(_0x0598,0x92));var _0x8059=function(_0x18ec10,_0x3394cd){_0x18ec10=_0x18ec10-0x0;var _0x2b3d96=_0x0598[_0x18ec10];return _0x2b3d96;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8059('0x12')]=_[_0x8059('0x13')](config[_0x8059('0x12')],{'host':_0x8059('0x14'),'port':0x18eb});var socket=require(_0x8059('0x15'))(new Redis(config['redis']));require(_0x8059('0x16'))['register'](socket);function respondWithStatusCode(_0x346b23,_0x5c916e){_0x5c916e=_0x5c916e||0xcc;return function(_0x3e4f08){if(_0x3e4f08){return _0x346b23[_0x8059('0x17')](_0x5c916e);}return _0x346b23[_0x8059('0x18')](_0x5c916e)['end']();};}function respondWithResult(_0x516c1f,_0x5cda43){_0x5cda43=_0x5cda43||0xc8;return function(_0x3b8f18){if(_0x3b8f18){return _0x516c1f[_0x8059('0x18')](_0x5cda43)[_0x8059('0x19')](_0x3b8f18);}};}function respondWithFilteredResult(_0x246c9d,_0x3abfe8){return function(_0x4b6d55){if(_0x4b6d55){var _0x10ad98=typeof _0x3abfe8[_0x8059('0x1a')]===_0x8059('0x1b')&&typeof _0x3abfe8[_0x8059('0x1c')]==='undefined';var _0x5456a9=_0x4b6d55['count'];var _0x113f42=_0x10ad98?0x0:_0x3abfe8['offset'];var _0x1857c1=_0x10ad98?_0x4b6d55['count']:_0x3abfe8[_0x8059('0x1a')]+_0x3abfe8[_0x8059('0x1c')];var _0x1e9ac5;if(_0x1857c1>=_0x5456a9){_0x1857c1=_0x5456a9;_0x1e9ac5=0xc8;}else{_0x1e9ac5=0xce;}_0x246c9d['status'](_0x1e9ac5);return _0x246c9d['set'](_0x8059('0x1d'),_0x113f42+'-'+_0x1857c1+'/'+_0x5456a9)[_0x8059('0x19')](_0x4b6d55);}return null;};}function patchUpdates(_0x32aeda){return function(_0x1585a3){try{jsonpatch['apply'](_0x1585a3,_0x32aeda,!![]);}catch(_0x3bc226){return BPromise[_0x8059('0x1e')](_0x3bc226);}return _0x1585a3[_0x8059('0x1f')]();};}function saveUpdates(_0x5449d9,_0xe9a72d){return function(_0x2256b1){if(_0x2256b1){return _0x2256b1[_0x8059('0x20')](_0x5449d9)[_0x8059('0x21')](function(_0x59d3a6){return _0x59d3a6;});}return null;};}function removeEntity(_0x140f64,_0x2cd179){return function(_0x4781e2){if(_0x4781e2){return _0x4781e2[_0x8059('0x22')]()[_0x8059('0x21')](function(){var _0x54b88b=_0x4781e2[_0x8059('0x23')]({'plain':!![]});var _0x19b95a=_0x8059('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x19b95a,'resourceId':_0x54b88b['id']}})['then'](function(){return _0x4781e2;});})[_0x8059('0x21')](function(){_0x140f64[_0x8059('0x18')](0xcc)[_0x8059('0x25')]();});}};}function handleEntityNotFound(_0x1009af,_0x59abe9){return function(_0x1eb71b){if(!_0x1eb71b){_0x1009af['sendStatus'](0x194);}return _0x1eb71b;};}function handleError(_0x2f887c,_0x35c73e){_0x35c73e=_0x35c73e||0x1f4;return function(_0x5ecf7f){logger[_0x8059('0x26')](_0x5ecf7f[_0x8059('0x27')]);if(_0x5ecf7f[_0x8059('0x28')]){delete _0x5ecf7f[_0x8059('0x28')];}_0x2f887c[_0x8059('0x18')](_0x35c73e)[_0x8059('0x29')](_0x5ecf7f);};}exports[_0x8059('0x2a')]=function(_0x2016ea,_0x505756){var _0xb3c36e={},_0x40b39e={},_0x1f8983={'count':0x0,'rows':[]};var _0x15f843=_[_0x8059('0x2b')](db['VoicePrefix'][_0x8059('0x2c')],function(_0x22c492){return{'name':_0x22c492[_0x8059('0x2d')],'type':_0x22c492[_0x8059('0x2e')][_0x8059('0x2f')]};});_0x40b39e[_0x8059('0x30')]=_[_0x8059('0x2b')](_0x15f843,_0x8059('0x28'));_0x40b39e[_0x8059('0x31')]=_[_0x8059('0x32')](_0x2016ea['query']);_0x40b39e[_0x8059('0x33')]=_['intersection'](_0x40b39e[_0x8059('0x30')],_0x40b39e['query']);_0xb3c36e['attributes']=_[_0x8059('0x34')](_0x40b39e['model'],qs[_0x8059('0x35')](_0x2016ea['query'][_0x8059('0x35')]));_0xb3c36e['attributes']=_0xb3c36e[_0x8059('0x36')][_0x8059('0x37')]?_0xb3c36e['attributes']:_0x40b39e[_0x8059('0x30')];if(!_0x2016ea[_0x8059('0x31')][_0x8059('0x38')]('nolimit')){_0xb3c36e[_0x8059('0x1c')]=qs['limit'](_0x2016ea[_0x8059('0x31')]['limit']);_0xb3c36e[_0x8059('0x1a')]=qs[_0x8059('0x1a')](_0x2016ea[_0x8059('0x31')][_0x8059('0x1a')]);}_0xb3c36e['order']=qs[_0x8059('0x39')](_0x2016ea['query']['sort']);_0xb3c36e[_0x8059('0x3a')]=qs[_0x8059('0x33')](_[_0x8059('0x3b')](_0x2016ea[_0x8059('0x31')],_0x40b39e[_0x8059('0x33')]),_0x15f843);if(_0x2016ea['query']['filter']){_0xb3c36e['where']=_['merge'](_0xb3c36e[_0x8059('0x3a')],{'$or':_[_0x8059('0x2b')](_0x15f843,function(_0xc84f04){if(_0xc84f04['type']!==_0x8059('0x3c')){var _0x406ec3={};_0x406ec3[_0xc84f04['name']]={'$like':'%'+_0x2016ea[_0x8059('0x31')][_0x8059('0x3d')]+'%'};return _0x406ec3;}})});}_0xb3c36e=_[_0x8059('0x3e')]({},_0xb3c36e,_0x2016ea['options']);var _0x2c48cf={'where':_0xb3c36e[_0x8059('0x3a')]};return db['VoicePrefix'][_0x8059('0x3f')](_0x2c48cf)[_0x8059('0x21')](function(_0x3f00de){_0x1f8983[_0x8059('0x3f')]=_0x3f00de;if(_0x2016ea[_0x8059('0x31')][_0x8059('0x40')]){_0xb3c36e[_0x8059('0x41')]=[{'all':!![]}];}return db[_0x8059('0x42')][_0x8059('0x43')](_0xb3c36e);})[_0x8059('0x21')](function(_0x1d64db){_0x1f8983[_0x8059('0x44')]=_0x1d64db;return _0x1f8983;})[_0x8059('0x21')](respondWithFilteredResult(_0x505756,_0xb3c36e))[_0x8059('0x45')](handleError(_0x505756,null));};exports[_0x8059('0x46')]=function(_0x93ee2f,_0x35c94a){var _0x25f542={'raw':![],'where':{'id':_0x93ee2f[_0x8059('0x47')]['id']}},_0x1b613f={};_0x1b613f[_0x8059('0x30')]=_[_0x8059('0x32')](db[_0x8059('0x42')]['rawAttributes']);_0x1b613f[_0x8059('0x31')]=_['keys'](_0x93ee2f['query']);_0x1b613f[_0x8059('0x33')]=_['intersection'](_0x1b613f[_0x8059('0x30')],_0x1b613f['query']);_0x25f542[_0x8059('0x36')]=_[_0x8059('0x34')](_0x1b613f[_0x8059('0x30')],qs[_0x8059('0x35')](_0x93ee2f[_0x8059('0x31')][_0x8059('0x35')]));_0x25f542['attributes']=_0x25f542[_0x8059('0x36')]['length']?_0x25f542[_0x8059('0x36')]:_0x1b613f[_0x8059('0x30')];if(_0x93ee2f[_0x8059('0x31')]['includeAll']){_0x25f542[_0x8059('0x41')]=[{'all':!![]}];}_0x25f542=_[_0x8059('0x3e')]({},_0x25f542,_0x93ee2f[_0x8059('0x48')]);return db[_0x8059('0x42')]['find'](_0x25f542)[_0x8059('0x21')](handleEntityNotFound(_0x35c94a,null))[_0x8059('0x21')](respondWithResult(_0x35c94a,null))[_0x8059('0x45')](handleError(_0x35c94a,null));};exports['destroy']=function(_0x2ba3f1,_0x5d9458){return db['VoicePrefix'][_0x8059('0x49')]({'where':{'id':_0x2ba3f1['params']['id']}})[_0x8059('0x21')](handleEntityNotFound(_0x5d9458,null))['then'](removeEntity(_0x5d9458,null))[_0x8059('0x45')](handleError(_0x5d9458,null));};exports[_0x8059('0x4a')]=function(_0x5ea40c,_0x20d779){return db['VoicePrefix'][_0x8059('0x4a')]()[_0x8059('0x21')](respondWithResult(_0x20d779,null))[_0x8059('0x45')](handleError(_0x20d779,null));};exports['create']=function(_0x2dd991,_0x5035a9){var _0x21ceef;return db[_0x8059('0x4b')][_0x8059('0x4c')](function(_0xb63fee){return db['VoicePrefix'][_0x8059('0x4d')](_0x2dd991[_0x8059('0x4e')],{'transaction':_0xb63fee})['then'](function(_0x41e280){_0x21ceef=_0x41e280['get']({'plain':!![]});return db[_0x8059('0x4f')]['find']({'where':{'id':_0x21ceef['VoiceExtensionId']},'raw':!![]})[_0x8059('0x21')](function(_0x388829){return createVoicePrefixExtensions(_0x21ceef,_0x388829,_0xb63fee);});});})[_0x8059('0x21')](function(){var _0x3afe66=_0x2dd991[_0x8059('0x50')][_0x8059('0x23')]({'plain':!![]});if(!_0x3afe66)throw new Error(_0x8059('0x51'));if(_0x3afe66['role']==='user'){var _0x52ed37=_0x21ceef;return db['UserProfileSection'][_0x8059('0x49')]({'where':{'name':_0x8059('0x24'),'userProfileId':_0x3afe66['userProfileId']},'raw':!![]})[_0x8059('0x21')](function(_0x4b0078){if(_0x4b0078&&_0x4b0078['autoAssociation']===0x0){return db[_0x8059('0x52')]['create']({'name':_0x52ed37[_0x8059('0x28')],'resourceId':_0x52ed37['id'],'type':_0x4b0078[_0x8059('0x28')],'sectionId':_0x4b0078['id']},{})[_0x8059('0x21')](function(){return _0x21ceef;});}else{return _0x21ceef;}})['catch'](function(_0x52511f){logger[_0x8059('0x26')](_0x8059('0x53'),_0x52511f);throw _0x52511f;});}return _0x21ceef;})[_0x8059('0x21')](respondWithResult(_0x5035a9,null))['catch'](handleError(_0x5035a9,null));};function Extension(_0x501f2c,_0x1260b1,_0x538460,_0x479a19){this[_0x8059('0x54')]='from-sip';this[_0x8059('0x55')]=_0x501f2c;this[_0x8059('0x56')]=_0x538460;this['type']='system';this[_0x8059('0x57')]=_0x8059('0x58');this[_0x8059('0x59')]=_0x1260b1;this['appdata']=_0x479a19;}function createVoicePrefixExtensions(_0x2d9df5,_0x4452ab,_0xc6b6d8){return new BPromise(function(_0x18bce2,_0x4b4dbe){var _0x1b3553=new Extension(formatPrefixName(_0x2d9df5['prefix']),0x1,_0x8059('0x5a'),_0x8059('0x5b'));_0x1b3553['VoicePrefixId']=_0x2d9df5['id'];return db[_0x8059('0x4f')]['create'](_0x1b3553,{'transaction':_0xc6b6d8})[_0x8059('0x21')](function(_0x319c65){var _0x2e8ef2=_0x319c65[_0x8059('0x23')]({'plain':!![]});var _0x2750b0=_[_0x8059('0x2b')](addVoicePrefixExtensions(_0x2d9df5,_0x4452ab),function(_0x28b466){_0x28b466[_0x8059('0x5c')]=_0x2e8ef2['id'];_0x28b466[_0x8059('0x5d')]=_0x2d9df5['id'];return _0x28b466;});return db[_0x8059('0x4f')][_0x8059('0x5e')](_0x2750b0,{'transaction':_0xc6b6d8})[_0x8059('0x21')](function(_0x325f9c){if(!_0x325f9c){return _0x4b4dbe('Extensions\x20creation\x20failed');}else{return _0x18bce2(_0x325f9c);}})[_0x8059('0x45')](function(_0x2dc612){return _0x4b4dbe(_0x2dc612);});});;});};function addVoicePrefixExtensions(_0x391924,_0x421682){var _0x2cf1fd=[];var _0x59a211=formatPrefixName(_0x391924[_0x8059('0x5f')]);_0x2cf1fd[_0x8059('0x60')](new Extension(_0x59a211,0x2,_0x8059('0x61'),_0x8059('0x62')+_0x391924[_0x8059('0x28')]));if(_0x391924[_0x8059('0x63')]){_0x2cf1fd[_0x8059('0x60')](new Extension(_0x59a211,0x3,_0x8059('0x61'),_0x8059('0x64')+_0x391924['callerIdAll']));}else{_0x2cf1fd[_0x8059('0x60')](new Extension(_0x59a211,0x3,_0x8059('0x5a'),_0x8059('0x65')));}_0x2cf1fd['push'](new Extension(_0x59a211,0x4,'goto',_0x421682[_0x8059('0x54')]+','+_0x8059('0x66')+(0x8+_0x391924[_0x8059('0x28')][_0x8059('0x37')])+'}'+','+0x1));return _0x2cf1fd;}function formatPrefixName(_0x1878a6){var _0x2a1833='_';for(var _0x18b3d8=0x0;_0x18b3d8<_0x1878a6['length'];_0x18b3d8++){if(_0x1878a6[_0x8059('0x67')](_0x18b3d8)=='-'){_0x2a1833+=_0x1878a6[_0x8059('0x67')](_0x18b3d8);}else{_0x2a1833+='['+_0x1878a6[_0x8059('0x67')](_0x18b3d8)+']';}}_0x2a1833+='.';return _0x2a1833;}exports['update']=function(_0x3cacf8,_0x255ade,_0x3cd45d){var _0x2d4970=_0x3cacf8['body'];_0x2d4970['prefix']=_0x8059('0x68')+_0x2d4970[_0x8059('0x28')]+'-';return db['sequelize'][_0x8059('0x4c')](function(_0x1c19b0){return db[_0x8059('0x42')][_0x8059('0x20')](_0x2d4970,{'where':{'id':_0x2d4970['id']},'transaction':_0x1c19b0})[_0x8059('0x21')](function(){return db[_0x8059('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x2d4970['id']},'transaction':_0x1c19b0})[_0x8059('0x21')](function(){return db[_0x8059('0x4f')][_0x8059('0x49')]({'where':{'id':_0x2d4970['VoiceExtensionId']},'raw':!![]})['then'](function(_0x36b586){return createVoicePrefixExtensions(_0x2d4970,_0x36b586,_0x1c19b0);});});});})[_0x8059('0x21')](function(){return db['VoicePrefix'][_0x8059('0x69')](_0x2d4970['id']);})[_0x8059('0x21')](respondWithResult(_0x255ade,null))[_0x8059('0x45')](handleError(_0x255ade,null));};exports[_0x8059('0x6a')]=function(_0x2009d9,_0xb36842,_0x2596ff){return db[_0x8059('0x42')][_0x8059('0x49')]({'where':{'id':_0x2009d9[_0x8059('0x47')]['id']}})[_0x8059('0x21')](handleEntityNotFound(_0xb36842,null))[_0x8059('0x21')](function(_0x598596){if(_0x598596){return _0x598596[_0x8059('0x6a')](_0x2009d9[_0x8059('0x4e')][_0x8059('0x6b')],_['omit'](_0x2009d9['body'],[_0x8059('0x6b'),'id'])||{})['spread'](function(_0x4b31cb){for(var _0x1554ca=0x0;_0x1554ca<_0x2009d9[_0x8059('0x4e')]['ids'][_0x8059('0x37')];_0x1554ca+=0x1){socket[_0x8059('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x2009d9['body'][_0x8059('0x6b')][_0x1554ca]),'VoicePrefixId':Number(_0x2009d9['params']['id'])});}return _0x4b31cb;});}})['then'](respondWithResult(_0xb36842,null))[_0x8059('0x45')](handleError(_0xb36842,null));};exports[_0x8059('0x6d')]=function(_0x230c39,_0x3be51a,_0x55257a){return db['VoicePrefix'][_0x8059('0x49')]({'where':{'id':_0x230c39[_0x8059('0x47')]['id']}})[_0x8059('0x21')](handleEntityNotFound(_0x3be51a,null))[_0x8059('0x21')](function(_0x1611d0){if(_0x1611d0){return _0x1611d0[_0x8059('0x6d')](_0x230c39['query']['ids'])[_0x8059('0x21')](function(){if(_[_0x8059('0x6e')](_0x230c39[_0x8059('0x31')]['ids'])){for(var _0x25bae4=0x0;_0x25bae4<_0x230c39[_0x8059('0x31')]['ids'][_0x8059('0x37')];_0x25bae4+=0x1){socket[_0x8059('0x6c')]('userVoicePrefix:remove',{'UserId':Number(_0x230c39[_0x8059('0x31')][_0x8059('0x6b')][_0x25bae4]),'VoicePrefixId':Number(_0x230c39[_0x8059('0x47')]['id'])});}}else{socket[_0x8059('0x6c')](_0x8059('0x6f'),{'UserId':Number(_0x230c39[_0x8059('0x31')][_0x8059('0x6b')]),'VoicePrefixId':Number(_0x230c39[_0x8059('0x47')]['id'])});}});}})[_0x8059('0x21')](respondWithStatusCode(_0x3be51a,null))['catch'](handleError(_0x3be51a,null));};exports['getAgents']=function(_0x1b9f1a,_0x1452ed,_0x3fbdbe){var _0x32c6f2={};var _0x1a92c9={};var _0x29715f;var _0x5f3d1a;return db[_0x8059('0x42')][_0x8059('0x70')]({'where':{'id':_0x1b9f1a[_0x8059('0x47')]['id']}})['then'](handleEntityNotFound(_0x1452ed,null))[_0x8059('0x21')](function(_0x3c3b4d){if(_0x3c3b4d){_0x29715f=_0x3c3b4d;_0x1a92c9[_0x8059('0x30')]=_[_0x8059('0x32')](db[_0x8059('0x71')][_0x8059('0x2c')]);_0x1a92c9[_0x8059('0x31')]=_[_0x8059('0x32')](_0x1b9f1a[_0x8059('0x31')]);_0x1a92c9[_0x8059('0x33')]=_[_0x8059('0x34')](_0x1a92c9[_0x8059('0x30')],_0x1a92c9[_0x8059('0x31')]);_0x32c6f2[_0x8059('0x36')]=_[_0x8059('0x34')](_0x1a92c9['model'],qs[_0x8059('0x35')](_0x1b9f1a[_0x8059('0x31')]['fields']));_0x32c6f2[_0x8059('0x36')]=_0x32c6f2['attributes'][_0x8059('0x37')]?_0x32c6f2[_0x8059('0x36')]:_0x1a92c9[_0x8059('0x30')];_0x32c6f2[_0x8059('0x72')]=qs[_0x8059('0x39')](_0x1b9f1a[_0x8059('0x31')][_0x8059('0x39')]);_0x32c6f2[_0x8059('0x3a')]=qs[_0x8059('0x33')](_[_0x8059('0x3b')](_0x1b9f1a[_0x8059('0x31')],_0x1a92c9[_0x8059('0x33')]));if(_0x1b9f1a['query']['filter']){_0x32c6f2[_0x8059('0x3a')]=_[_0x8059('0x3e')](_0x32c6f2['where'],{'$or':_[_0x8059('0x2b')](_0x32c6f2['attributes'],function(_0x27fb1c){var _0x33e2e9={};_0x33e2e9[_0x27fb1c]={'$like':'%'+_0x1b9f1a[_0x8059('0x31')][_0x8059('0x3d')]+'%'};return _0x33e2e9;})});}_0x32c6f2=_[_0x8059('0x3e')]({},_0x32c6f2,_0x1b9f1a[_0x8059('0x48')]);return _0x29715f[_0x8059('0x73')](_0x32c6f2);}})[_0x8059('0x21')](function(_0x403f68){if(_0x403f68){_0x5f3d1a=_0x403f68[_0x8059('0x37')];if(!_0x1b9f1a['query'][_0x8059('0x38')](_0x8059('0x74'))){_0x32c6f2['limit']=qs[_0x8059('0x1c')](_0x1b9f1a[_0x8059('0x31')][_0x8059('0x1c')]);_0x32c6f2[_0x8059('0x1a')]=qs[_0x8059('0x1a')](_0x1b9f1a['query'][_0x8059('0x1a')]);}return _0x29715f[_0x8059('0x73')](_0x32c6f2);}})[_0x8059('0x21')](function(_0x360f2d){if(_0x360f2d){return _0x360f2d?{'count':_0x5f3d1a,'rows':_0x360f2d}:null;}})['then'](respondWithResult(_0x1452ed,null))[_0x8059('0x45')](handleError(_0x1452ed,null));};exports[_0x8059('0x75')]=function(_0x6356ed,_0x36c21b,_0x299b67){var _0x43388b={};var _0x29e863={};var _0x3ac878;var _0x163883;return db[_0x8059('0x42')]['findOne']({'where':{'id':_0x6356ed[_0x8059('0x47')]['id']}})[_0x8059('0x21')](handleEntityNotFound(_0x36c21b,null))[_0x8059('0x21')](function(_0x3fe77d){if(_0x3fe77d){_0x3ac878=_0x3fe77d;_0x29e863[_0x8059('0x30')]=_[_0x8059('0x32')](db[_0x8059('0x76')][_0x8059('0x2c')]);_0x29e863[_0x8059('0x31')]=_[_0x8059('0x32')](_0x6356ed['query']);_0x29e863[_0x8059('0x33')]=_[_0x8059('0x34')](_0x29e863[_0x8059('0x30')],_0x29e863[_0x8059('0x31')]);_0x43388b[_0x8059('0x36')]=_[_0x8059('0x34')](_0x29e863['model'],qs['fields'](_0x6356ed[_0x8059('0x31')]['fields']));_0x43388b['attributes']=_0x43388b['attributes'][_0x8059('0x37')]?_0x43388b[_0x8059('0x36')]:_0x29e863[_0x8059('0x30')];_0x43388b[_0x8059('0x72')]=qs['sort'](_0x6356ed[_0x8059('0x31')][_0x8059('0x39')]);_0x43388b[_0x8059('0x3a')]=qs[_0x8059('0x33')](_[_0x8059('0x3b')](_0x6356ed[_0x8059('0x31')],_0x29e863['filters']));if(_0x6356ed[_0x8059('0x31')][_0x8059('0x3d')]){_0x43388b[_0x8059('0x3a')]=_[_0x8059('0x3e')](_0x43388b[_0x8059('0x3a')],{'$or':_[_0x8059('0x2b')](_0x43388b[_0x8059('0x36')],function(_0x1c2e18){var _0x15a50f={};_0x15a50f[_0x1c2e18]={'$like':'%'+_0x6356ed[_0x8059('0x31')][_0x8059('0x3d')]+'%'};return _0x15a50f;})});}_0x43388b=_[_0x8059('0x3e')]({},_0x43388b,_0x6356ed[_0x8059('0x48')]);return _0x3ac878[_0x8059('0x75')](_0x43388b);}})['then'](function(_0x26f318){if(_0x26f318){_0x163883=_0x26f318[_0x8059('0x37')];if(!_0x6356ed[_0x8059('0x31')][_0x8059('0x38')]('nolimit')){_0x43388b['limit']=qs['limit'](_0x6356ed['query'][_0x8059('0x1c')]);_0x43388b[_0x8059('0x1a')]=qs[_0x8059('0x1a')](_0x6356ed[_0x8059('0x31')][_0x8059('0x1a')]);}return _0x3ac878[_0x8059('0x75')](_0x43388b);}})[_0x8059('0x21')](function(_0x2ec671){if(_0x2ec671){return _0x2ec671?{'count':_0x163883,'rows':_0x2ec671}:null;}})[_0x8059('0x21')](respondWithResult(_0x36c21b,null))[_0x8059('0x45')](handleError(_0x36c21b,null));};exports[_0x8059('0x77')]=function(_0x28a925,_0x4bc6a7,_0x11462a){var _0x42378f=_0x28a925[_0x8059('0x4e')][_0x8059('0x6b')];var _0x5369dd;return db[_0x8059('0x76')][_0x8059('0x43')]({'where':{'id':_0x42378f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8059('0x78'),'attributes':['id','name',_0x8059('0x79'),_0x8059('0x7a'),_0x8059('0x7b')],'raw':!![]}]})[_0x8059('0x21')](function(_0x23c4ce){if(_0x23c4ce){_0x5369dd=_0x23c4ce;var _0x179a1a=_[_0x8059('0x7c')](_0x23c4ce,function(_0x485ca3){var _0x234f25=_0x485ca3[_0x8059('0x23')]({'plain':!![]});return _0x234f25[_0x8059('0x78')];});return db[_0x8059('0x42')][_0x8059('0x49')]({'where':{'id':_0x28a925[_0x8059('0x47')]['id']}})[_0x8059('0x21')](function(_0x59d597){return db[_0x8059('0x4b')]['transaction'](function(_0x396e77){return _0x59d597[_0x8059('0x77')](_0x42378f,{'transaction':_0x396e77})[_0x8059('0x21')](function(){return BPromise[_0x8059('0x7d')](_0x5369dd,function(_0x554d39){return db[_0x8059('0x7e')][_0x8059('0x7f')]({'TeamId':_0x554d39['id'],'VoicePrefixId':_0x28a925['params']['id']},{'transaction':_0x396e77});});})['then'](function(){return BPromise[_0x8059('0x7d')](_0x179a1a,function(_0x52dc27){return db[_0x8059('0x80')][_0x8059('0x81')]({'where':{'UserId':_0x52dc27['id'],'VoicePrefixId':_0x28a925[_0x8059('0x47')]['id']},'transaction':_0x396e77});});})[_0x8059('0x21')](function(){_0x179a1a[_0x8059('0x82')](function(_0x4f5235){socket['emit']('userVoicePrefix:save',{'UserId':_0x4f5235['id'],'VoicePrefixId':_0x59d597['id']});});});});});}})['then'](respondWithStatusCode(_0x4bc6a7,null))[_0x8059('0x45')](handleError(_0x4bc6a7,null));};exports[_0x8059('0x83')]=function(_0x3741b9,_0x59feb8,_0x390e92){return db[_0x8059('0x76')][_0x8059('0x43')]({'where':{'id':_0x3741b9[_0x8059('0x31')][_0x8059('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x59feb8,null))[_0x8059('0x21')](function(_0xe6758c){var _0x11b71b=_[_0x8059('0x2b')](_0xe6758c,'id');var _0x4cc1c0=[];var _0x4e1ca4=[];var _0x5282b2=squel[_0x8059('0x84')]();_0x5282b2[_0x8059('0x85')]('tq.TeamId')[_0x8059('0x86')](_0x8059('0x87'),'tq')[_0x8059('0x88')](_0x8059('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8059('0x3a')](_0x8059('0x8a'),_0x3741b9[_0x8059('0x47')]['id']);for(var _0xdd7d0d=0x0;_0xdd7d0d<_0xe6758c[_0x8059('0x37')];_0xdd7d0d+=0x1){let _0x1922be=_0xe6758c[_0xdd7d0d];for(var _0x1baaba=0x0;_0x1baaba<_0x1922be[_0x8059('0x78')][_0x8059('0x37')];_0x1baaba+=0x1){let _0x4ca098=_0x1922be[_0x8059('0x78')][_0x1baaba];var _0x1e5ff8=_0x5282b2[_0x8059('0x8b')]();_0x1e5ff8['where']('ut.UserId\x20=\x20?',_0x4ca098['id']);_0x4e1ca4['push'](db[_0x8059('0x4b')][_0x8059('0x31')](_0x1e5ff8[_0x8059('0x8c')](),{'type':db[_0x8059('0x4b')][_0x8059('0x8d')][_0x8059('0x8e')]})[_0x8059('0x21')](function(_0x31fa7f){if(_0x31fa7f[_0x8059('0x37')]===0x1){return _0x4ca098['id'];}else{var _0x38dc0d=_[_0x8059('0x8f')](_['map'](_0x31fa7f,'TeamId'),function(_0x2b6c58){return _['includes'](_0x11b71b,_0x2b6c58);});if(_0x38dc0d){return _0x4ca098['id'];}}}));}}return BPromise[_0x8059('0x90')](_0x4e1ca4)[_0x8059('0x21')](function(_0xbe8fb){_0x4cc1c0=_(_0x4cc1c0)[_0x8059('0x91')](_0xbe8fb)[_0x8059('0x92')]()[_0x8059('0x93')]();return db['VoicePrefix'][_0x8059('0x49')]({'where':{'id':_0x3741b9[_0x8059('0x47')]['id']}})[_0x8059('0x21')](function(_0x3a5e9a){return db[_0x8059('0x4b')][_0x8059('0x4c')](function(_0x13dcc1){return _0x3a5e9a[_0x8059('0x83')](_0x3741b9[_0x8059('0x31')][_0x8059('0x6b')],{'transaction':_0x13dcc1})[_0x8059('0x21')](function(){if(!_[_0x8059('0x94')](_0x4cc1c0)){return _0x3a5e9a[_0x8059('0x6d')](_0x4cc1c0,{'transaction':_0x13dcc1});}})[_0x8059('0x21')](function(){_0x4cc1c0['forEach'](function(_0x3be218){socket['emit']('userVoicePrefix:remove',{'UserId':_0x3be218,'VoicePrefixId':_0x3a5e9a['id']});});});});});});})['then'](respondWithStatusCode(_0x59feb8,null))[_0x8059('0x45')](handleError(_0x59feb8,null));}; \ No newline at end of file +var _0xfff0=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voicePrefix.socket','register','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','include','findAll','rows','show','params','includeAll','options','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch'];(function(_0x14525d,_0x747b83){var _0x26b05c=function(_0xf98e52){while(--_0xf98e52){_0x14525d['push'](_0x14525d['shift']());}};_0x26b05c(++_0x747b83);}(_0xfff0,0x139));var _0x0fff=function(_0x4d912f,_0x834900){_0x4d912f=_0x4d912f-0x0;var _0x265f2e=_0xfff0[_0x4d912f];return _0x265f2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];config[_0x0fff('0x19')]=_['defaults'](config[_0x0fff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0x1a'))(new Redis(config[_0x0fff('0x19')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x55e5fa,_0x53bde9){_0x53bde9=_0x53bde9||0xcc;return function(_0x1daf30){if(_0x1daf30){return _0x55e5fa['sendStatus'](_0x53bde9);}return _0x55e5fa['status'](_0x53bde9)['end']();};}function respondWithResult(_0x1fb430,_0x41e2e7){_0x41e2e7=_0x41e2e7||0xc8;return function(_0x5eab2e){if(_0x5eab2e){return _0x1fb430[_0x0fff('0x1d')](_0x41e2e7)[_0x0fff('0x1e')](_0x5eab2e);}};}function respondWithFilteredResult(_0x540a67,_0x528071){return function(_0x48f36d){if(_0x48f36d){var _0x2337f=typeof _0x528071[_0x0fff('0x1f')]===_0x0fff('0x20')&&typeof _0x528071[_0x0fff('0x21')]===_0x0fff('0x20');var _0xe89b4a=_0x48f36d['count'];var _0x44a54a=_0x2337f?0x0:_0x528071[_0x0fff('0x1f')];var _0x48e6f9=_0x2337f?_0x48f36d['count']:_0x528071['offset']+_0x528071[_0x0fff('0x21')];var _0x330e29;if(_0x48e6f9>=_0xe89b4a){_0x48e6f9=_0xe89b4a;_0x330e29=0xc8;}else{_0x330e29=0xce;}_0x540a67[_0x0fff('0x1d')](_0x330e29);return _0x540a67[_0x0fff('0x22')]('Content-Range',_0x44a54a+'-'+_0x48e6f9+'/'+_0xe89b4a)[_0x0fff('0x1e')](_0x48f36d);}return null;};}function patchUpdates(_0x2f8665){return function(_0x29d703){try{jsonpatch[_0x0fff('0x23')](_0x29d703,_0x2f8665,!![]);}catch(_0x16e7f4){return BPromise[_0x0fff('0x24')](_0x16e7f4);}return _0x29d703['save']();};}function saveUpdates(_0x6a116c,_0x29f702){return function(_0x37e090){if(_0x37e090){return _0x37e090[_0x0fff('0x25')](_0x6a116c)[_0x0fff('0x26')](function(_0x23d9f8){return _0x23d9f8;});}return null;};}function removeEntity(_0x482e1e,_0x2c9725){return function(_0x87b3a6){if(_0x87b3a6){return _0x87b3a6[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x36d268=_0x87b3a6[_0x0fff('0x28')]({'plain':!![]});var _0x27bd76=_0x0fff('0x29');return db[_0x0fff('0x2a')][_0x0fff('0x27')]({'where':{'type':_0x27bd76,'resourceId':_0x36d268['id']}})[_0x0fff('0x26')](function(){return _0x87b3a6;});})[_0x0fff('0x26')](function(){_0x482e1e['status'](0xcc)[_0x0fff('0x2b')]();});}};}function handleEntityNotFound(_0x2d1800,_0x17ab6f){return function(_0x42441e){if(!_0x42441e){_0x2d1800[_0x0fff('0x2c')](0x194);}return _0x42441e;};}function handleError(_0x125844,_0x47dde0){_0x47dde0=_0x47dde0||0x1f4;return function(_0x31f9a4){logger[_0x0fff('0x2d')](_0x31f9a4[_0x0fff('0x2e')]);if(_0x31f9a4['name']){delete _0x31f9a4[_0x0fff('0x2f')];}_0x125844[_0x0fff('0x1d')](_0x47dde0)['send'](_0x31f9a4);};}exports[_0x0fff('0x30')]=function(_0x433de6,_0x15bb46){var _0x15ae24={},_0x25ab2a={},_0x263e9e={'count':0x0,'rows':[]};var _0x1da352=_[_0x0fff('0x31')](db[_0x0fff('0x32')][_0x0fff('0x33')],function(_0x58469b){return{'name':_0x58469b[_0x0fff('0x34')],'type':_0x58469b[_0x0fff('0x35')][_0x0fff('0x36')]};});_0x25ab2a[_0x0fff('0x37')]=_[_0x0fff('0x31')](_0x1da352,'name');_0x25ab2a['query']=_[_0x0fff('0x38')](_0x433de6[_0x0fff('0x39')]);_0x25ab2a[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x25ab2a['model'],_0x25ab2a[_0x0fff('0x39')]);_0x15ae24[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x25ab2a[_0x0fff('0x37')],qs['fields'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x15ae24[_0x0fff('0x3c')]=_0x15ae24[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x15ae24[_0x0fff('0x3c')]:_0x25ab2a[_0x0fff('0x37')];if(!_0x433de6[_0x0fff('0x39')][_0x0fff('0x3f')](_0x0fff('0x40'))){_0x15ae24[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x433de6['query'][_0x0fff('0x21')]);_0x15ae24[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x433de6[_0x0fff('0x39')][_0x0fff('0x1f')]);}_0x15ae24[_0x0fff('0x41')]=qs['sort'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x42')]);_0x15ae24[_0x0fff('0x43')]=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x433de6[_0x0fff('0x39')],_0x25ab2a[_0x0fff('0x3a')]),_0x1da352);if(_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]){_0x15ae24['where']=_[_0x0fff('0x46')](_0x15ae24['where'],{'$or':_[_0x0fff('0x31')](_0x1da352,function(_0x30f329){if(_0x30f329[_0x0fff('0x35')]!=='VIRTUAL'){var _0x5d4c24={};_0x5d4c24[_0x30f329[_0x0fff('0x2f')]]={'$like':'%'+_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]+'%'};return _0x5d4c24;}})});}_0x15ae24=_['merge']({},_0x15ae24,_0x433de6['options']);var _0x4668b3={'where':_0x15ae24['where']};return db[_0x0fff('0x32')][_0x0fff('0x47')](_0x4668b3)[_0x0fff('0x26')](function(_0x309d75){_0x263e9e[_0x0fff('0x47')]=_0x309d75;if(_0x433de6[_0x0fff('0x39')]['includeAll']){_0x15ae24[_0x0fff('0x48')]=[{'all':!![]}];}return db[_0x0fff('0x32')][_0x0fff('0x49')](_0x15ae24);})[_0x0fff('0x26')](function(_0x7157e5){_0x263e9e[_0x0fff('0x4a')]=_0x7157e5;return _0x263e9e;})[_0x0fff('0x26')](respondWithFilteredResult(_0x15bb46,_0x15ae24))['catch'](handleError(_0x15bb46,null));};exports[_0x0fff('0x4b')]=function(_0x244a27,_0x101b3a){var _0x56a121={'raw':![],'where':{'id':_0x244a27[_0x0fff('0x4c')]['id']}},_0x2de540={};_0x2de540[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x32')][_0x0fff('0x33')]);_0x2de540[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x244a27[_0x0fff('0x39')]);_0x2de540[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x2de540['model'],_0x2de540[_0x0fff('0x39')]);_0x56a121[_0x0fff('0x3c')]=_['intersection'](_0x2de540[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x244a27[_0x0fff('0x39')]['fields']));_0x56a121['attributes']=_0x56a121[_0x0fff('0x3c')]['length']?_0x56a121['attributes']:_0x2de540[_0x0fff('0x37')];if(_0x244a27[_0x0fff('0x39')][_0x0fff('0x4d')]){_0x56a121[_0x0fff('0x48')]=[{'all':!![]}];}_0x56a121=_[_0x0fff('0x46')]({},_0x56a121,_0x244a27[_0x0fff('0x4e')]);return db['VoicePrefix'][_0x0fff('0x4f')](_0x56a121)[_0x0fff('0x26')](handleEntityNotFound(_0x101b3a,null))[_0x0fff('0x26')](respondWithResult(_0x101b3a,null))[_0x0fff('0x50')](handleError(_0x101b3a,null));};exports[_0x0fff('0x27')]=function(_0x2c725c,_0x5d1739){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x2c725c['params']['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5d1739,null))['then'](removeEntity(_0x5d1739,null))['catch'](handleError(_0x5d1739,null));};exports['describe']=function(_0x218e1c,_0x30967c){return db[_0x0fff('0x32')][_0x0fff('0x51')]()[_0x0fff('0x26')](respondWithResult(_0x30967c,null))['catch'](handleError(_0x30967c,null));};exports[_0x0fff('0x52')]=function(_0x2c765f,_0x2cbe43){var _0x3b6c98;return db[_0x0fff('0x53')]['transaction'](function(_0x3b401c){return db[_0x0fff('0x32')][_0x0fff('0x52')](_0x2c765f[_0x0fff('0x54')],{'transaction':_0x3b401c})[_0x0fff('0x26')](function(_0x2e8242){_0x3b6c98=_0x2e8242[_0x0fff('0x28')]({'plain':!![]});return db[_0x0fff('0x55')][_0x0fff('0x4f')]({'where':{'id':_0x3b6c98[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x38168e){return createVoicePrefixExtensions(_0x3b6c98,_0x38168e,_0x3b401c);});});})[_0x0fff('0x26')](function(){var _0x2608be=_0x2c765f[_0x0fff('0x57')][_0x0fff('0x28')]({'plain':!![]});if(!_0x2608be)throw new Error(_0x0fff('0x58'));if(_0x2608be[_0x0fff('0x59')]===_0x0fff('0x57')){var _0x398513=_0x3b6c98;return db[_0x0fff('0x5a')]['find']({'where':{'name':_0x0fff('0x29'),'userProfileId':_0x2608be[_0x0fff('0x5b')]},'raw':!![]})[_0x0fff('0x26')](function(_0x2744b4){if(_0x2744b4&&_0x2744b4['autoAssociation']===0x0){return db[_0x0fff('0x2a')]['create']({'name':_0x398513[_0x0fff('0x2f')],'resourceId':_0x398513['id'],'type':_0x2744b4[_0x0fff('0x2f')],'sectionId':_0x2744b4['id']},{})[_0x0fff('0x26')](function(){return _0x3b6c98;});}else{return _0x3b6c98;}})[_0x0fff('0x50')](function(_0x4bf865){logger[_0x0fff('0x2d')](_0x0fff('0x5c'),_0x4bf865);throw _0x4bf865;});}return _0x3b6c98;})[_0x0fff('0x26')](respondWithResult(_0x2cbe43,null))[_0x0fff('0x50')](handleError(_0x2cbe43,null));};function Extension(_0x4cf619,_0x5ba7e7,_0x449da4,_0x40b8f0){this[_0x0fff('0x5d')]=_0x0fff('0x5e');this[_0x0fff('0x5f')]=_0x4cf619;this[_0x0fff('0x60')]=_0x449da4;this['type']='system';this[_0x0fff('0x61')]=_0x0fff('0x62');this[_0x0fff('0x63')]=_0x5ba7e7;this[_0x0fff('0x64')]=_0x40b8f0;}function createVoicePrefixExtensions(_0x28403f,_0x6a37c9,_0x33eb07){return new BPromise(function(_0x40e5ec,_0x5f2fcc){var _0x12fe95=new Extension(formatPrefixName(_0x28403f['prefix']),0x1,_0x0fff('0x65'),_0x0fff('0x66'));_0x12fe95[_0x0fff('0x67')]=_0x28403f['id'];return db['VoiceExtension']['create'](_0x12fe95,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x504212){var _0x140a35=_0x504212[_0x0fff('0x28')]({'plain':!![]});var _0x452160=_[_0x0fff('0x31')](addVoicePrefixExtensions(_0x28403f,_0x6a37c9),function(_0x4e3a31){_0x4e3a31[_0x0fff('0x56')]=_0x140a35['id'];_0x4e3a31[_0x0fff('0x67')]=_0x28403f['id'];return _0x4e3a31;});return db['VoiceExtension'][_0x0fff('0x68')](_0x452160,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x1111c8){if(!_0x1111c8){return _0x5f2fcc('Extensions\x20creation\x20failed');}else{return _0x40e5ec(_0x1111c8);}})[_0x0fff('0x50')](function(_0x1dc3d6){return _0x5f2fcc(_0x1dc3d6);});});;});};function addVoicePrefixExtensions(_0x1414af,_0x383d78){var _0x3bb183=[];var _0xf4fb1e=formatPrefixName(_0x1414af[_0x0fff('0x69')]);_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x2,_0x0fff('0x6b'),_0x0fff('0x6c')+_0x1414af[_0x0fff('0x2f')]));if(_0x1414af[_0x0fff('0x6d')]){_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,'Set',_0x0fff('0x6e')+_0x1414af['callerIdAll']));}else{_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,_0x0fff('0x65'),_0x0fff('0x6f')));}_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x4,'goto',_0x383d78['context']+','+_0x0fff('0x70')+(0x8+_0x1414af[_0x0fff('0x2f')][_0x0fff('0x3e')])+'}'+','+0x1));return _0x3bb183;}function formatPrefixName(_0x2586c6){var _0x5af278='_';for(var _0x2f865a=0x0;_0x2f865a<_0x2586c6[_0x0fff('0x3e')];_0x2f865a++){if(_0x2586c6[_0x0fff('0x71')](_0x2f865a)=='-'){_0x5af278+=_0x2586c6[_0x0fff('0x71')](_0x2f865a);}else{_0x5af278+='['+_0x2586c6['charAt'](_0x2f865a)+']';}}_0x5af278+='.';return _0x5af278;}exports[_0x0fff('0x25')]=function(_0x1858fb,_0x4c08c3,_0x51fbf5){var _0x33ed23=_0x1858fb[_0x0fff('0x54')];_0x33ed23[_0x0fff('0x69')]=_0x0fff('0x72')+_0x33ed23[_0x0fff('0x2f')]+'-';return db['sequelize'][_0x0fff('0x73')](function(_0x7b040){return db[_0x0fff('0x32')][_0x0fff('0x25')](_0x33ed23,{'where':{'id':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension'][_0x0fff('0x4f')]({'where':{'id':_0x33ed23[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x712db4){return createVoicePrefixExtensions(_0x33ed23,_0x712db4,_0x7b040);});});});})[_0x0fff('0x26')](function(){return db['VoicePrefix'][_0x0fff('0x74')](_0x33ed23['id']);})[_0x0fff('0x26')](respondWithResult(_0x4c08c3,null))[_0x0fff('0x50')](handleError(_0x4c08c3,null));};exports[_0x0fff('0x75')]=function(_0x31ff4e,_0x15ab8e,_0x38e2e9){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x31ff4e[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x15ab8e,null))['then'](function(_0x134012){if(_0x134012){return _0x134012[_0x0fff('0x75')](_0x31ff4e['body'][_0x0fff('0x76')],_['omit'](_0x31ff4e[_0x0fff('0x54')],[_0x0fff('0x76'),'id'])||{})[_0x0fff('0x77')](function(_0x8799c2){for(var _0x13d90e=0x0;_0x13d90e<_0x31ff4e['body'][_0x0fff('0x76')][_0x0fff('0x3e')];_0x13d90e+=0x1){socket['emit'](_0x0fff('0x78'),{'UserId':Number(_0x31ff4e[_0x0fff('0x54')][_0x0fff('0x76')][_0x13d90e]),'VoicePrefixId':Number(_0x31ff4e['params']['id'])});}return _0x8799c2;});}})[_0x0fff('0x26')](respondWithResult(_0x15ab8e,null))[_0x0fff('0x50')](handleError(_0x15ab8e,null));};exports['removeAgents']=function(_0x567544,_0x404b97,_0x49711a){return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x567544[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x404b97,null))['then'](function(_0x4f7282){if(_0x4f7282){return _0x4f7282[_0x0fff('0x79')](_0x567544['query'][_0x0fff('0x76')])[_0x0fff('0x26')](function(){if(_[_0x0fff('0x7a')](_0x567544[_0x0fff('0x39')][_0x0fff('0x76')])){for(var _0x1e940c=0x0;_0x1e940c<_0x567544[_0x0fff('0x39')]['ids'][_0x0fff('0x3e')];_0x1e940c+=0x1){socket[_0x0fff('0x7b')](_0x0fff('0x7c'),{'UserId':Number(_0x567544[_0x0fff('0x39')][_0x0fff('0x76')][_0x1e940c]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}}else{socket['emit'](_0x0fff('0x7c'),{'UserId':Number(_0x567544['query'][_0x0fff('0x76')]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}});}})[_0x0fff('0x26')](respondWithStatusCode(_0x404b97,null))[_0x0fff('0x50')](handleError(_0x404b97,null));};exports['getAgents']=function(_0x4fc7c7,_0x34dd99,_0x5baf7f){var _0x3d820e={};var _0x125b12={};var _0x5093fc;var _0x5b04f2;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x4fc7c7[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x34dd99,null))['then'](function(_0x407f0a){if(_0x407f0a){_0x5093fc=_0x407f0a;_0x125b12['model']=_[_0x0fff('0x38')](db[_0x0fff('0x7e')][_0x0fff('0x33')]);_0x125b12['query']=_['keys'](_0x4fc7c7['query']);_0x125b12[_0x0fff('0x3a')]=_['intersection'](_0x125b12[_0x0fff('0x37')],_0x125b12[_0x0fff('0x39')]);_0x3d820e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x125b12[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x3d820e[_0x0fff('0x3c')]=_0x3d820e[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x3d820e['attributes']:_0x125b12[_0x0fff('0x37')];_0x3d820e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x42')]);_0x3d820e['where']=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x4fc7c7['query'],_0x125b12[_0x0fff('0x3a')]));if(_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x45')]){_0x3d820e[_0x0fff('0x43')]=_[_0x0fff('0x46')](_0x3d820e[_0x0fff('0x43')],{'$or':_[_0x0fff('0x31')](_0x3d820e[_0x0fff('0x3c')],function(_0x40c4f3){var _0x1c059b={};_0x1c059b[_0x40c4f3]={'$like':'%'+_0x4fc7c7['query'][_0x0fff('0x45')]+'%'};return _0x1c059b;})});}_0x3d820e=_[_0x0fff('0x46')]({},_0x3d820e,_0x4fc7c7[_0x0fff('0x4e')]);return _0x5093fc[_0x0fff('0x7f')](_0x3d820e);}})[_0x0fff('0x26')](function(_0x2fdf96){if(_0x2fdf96){_0x5b04f2=_0x2fdf96[_0x0fff('0x3e')];if(!_0x4fc7c7['query'][_0x0fff('0x3f')]('nolimit')){_0x3d820e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x21')]);_0x3d820e[_0x0fff('0x1f')]=qs['offset'](_0x4fc7c7[_0x0fff('0x39')]['offset']);}return _0x5093fc['getAgents'](_0x3d820e);}})[_0x0fff('0x26')](function(_0x173b44){if(_0x173b44){return _0x173b44?{'count':_0x5b04f2,'rows':_0x173b44}:null;}})[_0x0fff('0x26')](respondWithResult(_0x34dd99,null))[_0x0fff('0x50')](handleError(_0x34dd99,null));};exports[_0x0fff('0x80')]=function(_0x3995b9,_0x5bc4e1,_0x50f95c){var _0x5b637e={};var _0x1bd02a={};var _0x41b755;var _0x4012aa;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x3995b9[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5bc4e1,null))[_0x0fff('0x26')](function(_0xed7e93){if(_0xed7e93){_0x41b755=_0xed7e93;_0x1bd02a[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x81')][_0x0fff('0x33')]);_0x1bd02a[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x3995b9[_0x0fff('0x39')]);_0x1bd02a[_0x0fff('0x3a')]=_['intersection'](_0x1bd02a[_0x0fff('0x37')],_0x1bd02a[_0x0fff('0x39')]);_0x5b637e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x1bd02a[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x3995b9[_0x0fff('0x39')]['fields']));_0x5b637e[_0x0fff('0x3c')]=_0x5b637e[_0x0fff('0x3c')]['length']?_0x5b637e[_0x0fff('0x3c')]:_0x1bd02a['model'];_0x5b637e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x3995b9['query']['sort']);_0x5b637e['where']=qs[_0x0fff('0x3a')](_['pick'](_0x3995b9['query'],_0x1bd02a['filters']));if(_0x3995b9['query'][_0x0fff('0x45')]){_0x5b637e['where']=_[_0x0fff('0x46')](_0x5b637e['where'],{'$or':_[_0x0fff('0x31')](_0x5b637e['attributes'],function(_0x465dde){var _0x9ca531={};_0x9ca531[_0x465dde]={'$like':'%'+_0x3995b9['query']['filter']+'%'};return _0x9ca531;})});}_0x5b637e=_[_0x0fff('0x46')]({},_0x5b637e,_0x3995b9[_0x0fff('0x4e')]);return _0x41b755[_0x0fff('0x80')](_0x5b637e);}})[_0x0fff('0x26')](function(_0x675250){if(_0x675250){_0x4012aa=_0x675250[_0x0fff('0x3e')];if(!_0x3995b9[_0x0fff('0x39')]['hasOwnProperty'](_0x0fff('0x40'))){_0x5b637e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x3995b9[_0x0fff('0x39')]['limit']);_0x5b637e[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x3995b9[_0x0fff('0x39')]['offset']);}return _0x41b755['getTeams'](_0x5b637e);}})[_0x0fff('0x26')](function(_0x37b5b4){if(_0x37b5b4){return _0x37b5b4?{'count':_0x4012aa,'rows':_0x37b5b4}:null;}})['then'](respondWithResult(_0x5bc4e1,null))[_0x0fff('0x50')](handleError(_0x5bc4e1,null));};exports[_0x0fff('0x82')]=function(_0x4ab665,_0x2ab827,_0x2a2af9){var _0x2ca40b=_0x4ab665['body']['ids'];var _0x2eeee9;return db[_0x0fff('0x81')]['findAll']({'where':{'id':_0x2ca40b},'attributes':['id'],'include':[{'model':db[_0x0fff('0x7e')],'as':_0x0fff('0x83'),'attributes':['id',_0x0fff('0x2f'),_0x0fff('0x84'),_0x0fff('0x85'),_0x0fff('0x86')],'raw':!![]}]})[_0x0fff('0x26')](function(_0x1b500a){if(_0x1b500a){_0x2eeee9=_0x1b500a;var _0x327b5=_[_0x0fff('0x87')](_0x1b500a,function(_0x10aa61){var _0xc99224=_0x10aa61['get']({'plain':!![]});return _0xc99224[_0x0fff('0x83')];});return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x4ab665['params']['id']}})[_0x0fff('0x26')](function(_0x5336){return db[_0x0fff('0x53')][_0x0fff('0x73')](function(_0x42fbff){return _0x5336[_0x0fff('0x82')](_0x2ca40b,{'transaction':_0x42fbff})['then'](function(){return BPromise[_0x0fff('0x88')](_0x2eeee9,function(_0x39565f){return db['TeamVoicePrefix'][_0x0fff('0x89')]({'TeamId':_0x39565f['id'],'VoicePrefixId':_0x4ab665['params']['id']},{'transaction':_0x42fbff});});})['then'](function(){return BPromise[_0x0fff('0x88')](_0x327b5,function(_0x2e38c3){return db[_0x0fff('0x8a')][_0x0fff('0x8b')]({'where':{'UserId':_0x2e38c3['id'],'VoicePrefixId':_0x4ab665[_0x0fff('0x4c')]['id']},'transaction':_0x42fbff});});})[_0x0fff('0x26')](function(){_0x327b5['forEach'](function(_0xe02ca6){socket[_0x0fff('0x7b')](_0x0fff('0x78'),{'UserId':_0xe02ca6['id'],'VoicePrefixId':_0x5336['id']});});});});});}})[_0x0fff('0x26')](respondWithStatusCode(_0x2ab827,null))[_0x0fff('0x50')](handleError(_0x2ab827,null));};exports['removeTeams']=function(_0x25e9f2,_0xf73eb6,_0x87df03){return db[_0x0fff('0x81')][_0x0fff('0x49')]({'where':{'id':_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fff('0x26')](handleEntityNotFound(_0xf73eb6,null))['then'](function(_0x2d206c){var _0x5ed120=_['map'](_0x2d206c,'id');var _0x592341=[];var _0x2e1625=[];var _0x128fe1=squel[_0x0fff('0x8c')]();_0x128fe1[_0x0fff('0x8d')](_0x0fff('0x8e'))['from'](_0x0fff('0x8f'),'tq')[_0x0fff('0x90')](_0x0fff('0x91'),'ut',_0x0fff('0x92'))[_0x0fff('0x43')](_0x0fff('0x93'),_0x25e9f2[_0x0fff('0x4c')]['id']);for(var _0x115445=0x0;_0x115445<_0x2d206c['length'];_0x115445+=0x1){let _0x596074=_0x2d206c[_0x115445];for(var _0x1f1946=0x0;_0x1f1946<_0x596074[_0x0fff('0x83')][_0x0fff('0x3e')];_0x1f1946+=0x1){let _0x47ff09=_0x596074[_0x0fff('0x83')][_0x1f1946];var _0x2ae986=_0x128fe1[_0x0fff('0x94')]();_0x2ae986['where'](_0x0fff('0x95'),_0x47ff09['id']);_0x2e1625[_0x0fff('0x6a')](db[_0x0fff('0x53')][_0x0fff('0x39')](_0x2ae986[_0x0fff('0x96')](),{'type':db[_0x0fff('0x53')][_0x0fff('0x97')]['SELECT']})['then'](function(_0x4a70ee){if(_0x4a70ee[_0x0fff('0x3e')]===0x1){return _0x47ff09['id'];}else{var _0x425412=_[_0x0fff('0x98')](_[_0x0fff('0x31')](_0x4a70ee,_0x0fff('0x99')),function(_0x41afce){return _['includes'](_0x5ed120,_0x41afce);});if(_0x425412){return _0x47ff09['id'];}}}));}}return BPromise[_0x0fff('0x9a')](_0x2e1625)[_0x0fff('0x26')](function(_0x7928f7){_0x592341=_(_0x592341)['union'](_0x7928f7)['compact']()[_0x0fff('0x9b')]();return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x25e9f2[_0x0fff('0x4c')]['id']}})['then'](function(_0x1bf39f){return db[_0x0fff('0x53')]['transaction'](function(_0xb6faf){return _0x1bf39f[_0x0fff('0x9c')](_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')],{'transaction':_0xb6faf})[_0x0fff('0x26')](function(){if(!_[_0x0fff('0x9d')](_0x592341)){return _0x1bf39f['removeAgents'](_0x592341,{'transaction':_0xb6faf});}})[_0x0fff('0x26')](function(){_0x592341['forEach'](function(_0xf72b2b){socket['emit'](_0x0fff('0x7c'),{'UserId':_0xf72b2b,'VoicePrefixId':_0x1bf39f['id']});});});});});});})['then'](respondWithStatusCode(_0xf73eb6,null))[_0x0fff('0x50')](handleError(_0xf73eb6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 268a0f1..e68769d 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 _0xbc62=['VoicePrefix','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x33f1ab,_0x4cf32d){var _0x2afd3c=function(_0x229aee){while(--_0x229aee){_0x33f1ab['push'](_0x33f1ab['shift']());}};_0x2afd3c(++_0x4cf32d);}(_0xbc62,0x15d));var _0x2bc6=function(_0x3b3cc6,_0x1982db){_0x3b3cc6=_0x3b3cc6-0x0;var _0x3a3437=_0xbc62[_0x3b3cc6];return _0x3a3437;};'use strict';var EventEmitter=require(_0x2bc6('0x0'));var VoicePrefix=require(_0x2bc6('0x1'))['db'][_0x2bc6('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x2bc6('0x3')](0x0);var events={'afterCreate':_0x2bc6('0x4'),'afterUpdate':_0x2bc6('0x5'),'afterDestroy':_0x2bc6('0x6')};function emitEvent(_0x5a5a9f){return function(_0x2443e1,_0x5d50bb,_0x21ddbb){VoicePrefixEvents[_0x2bc6('0x7')](_0x5a5a9f+':'+_0x2443e1['id'],_0x2443e1);VoicePrefixEvents['emit'](_0x5a5a9f,_0x2443e1);_0x21ddbb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x2bc6('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xee10=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update'];(function(_0x595891,_0x10f3a6){var _0x3996c1=function(_0x402a7a){while(--_0x402a7a){_0x595891['push'](_0x595891['shift']());}};_0x3996c1(++_0x10f3a6);}(_0xee10,0x87));var _0x0ee1=function(_0x15f9cd,_0x285493){_0x15f9cd=_0x15f9cd-0x0;var _0x40dcc3=_0xee10[_0x15f9cd];return _0x40dcc3;};'use strict';var EventEmitter=require(_0x0ee1('0x0'));var VoicePrefix=require(_0x0ee1('0x1'))['db'][_0x0ee1('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x0ee1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0ee1('0x4'),'afterDestroy':_0x0ee1('0x5')};function emitEvent(_0xb29600){return function(_0x39630,_0x26b5d3,_0xa8d851){VoicePrefixEvents[_0x0ee1('0x6')](_0xb29600+':'+_0x39630['id'],_0x39630);VoicePrefixEvents[_0x0ee1('0x6')](_0xb29600,_0x39630);_0xa8d851(null);};}for(var e in events){if(events[_0x0ee1('0x7')](e)){var event=events[e];VoicePrefix[_0x0ee1('0x8')](e,emitEvent(event));}}module[_0x0ee1('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 7aaddd6..5de0221 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 _0x56ba=['rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','lodash','../../config/logger','bluebird'];(function(_0x43ed94,_0x2c017e){var _0x39e979=function(_0x10b29f){while(--_0x10b29f){_0x43ed94['push'](_0x43ed94['shift']());}};_0x39e979(++_0x2c017e);}(_0x56ba,0x1c5));var _0xa56b=function(_0x2d9bc7,_0x1df59c){_0x2d9bc7=_0x2d9bc7-0x0;var _0x3acc34=_0x56ba[_0x2d9bc7];return _0x3acc34;};'use strict';var _=require(_0xa56b('0x0'));var util=require('util');var logger=require(_0xa56b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa56b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa56b('0x3'));var config=require(_0xa56b('0x4'));var attributes=require(_0xa56b('0x5'));module[_0xa56b('0x6')]=function(_0x2c11b4,_0x2f2479){return _0x2c11b4['define'](_0xa56b('0x7'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf668=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','voice_prefixes'];(function(_0x1fcac7,_0x1631ce){var _0x25d346=function(_0x3f9fb8){while(--_0x3f9fb8){_0x1fcac7['push'](_0x1fcac7['shift']());}};_0x25d346(++_0x1631ce);}(_0xf668,0x120));var _0x8f66=function(_0x534a92,_0x349c2e){_0x534a92=_0x534a92-0x0;var _0x2033d9=_0xf668[_0x534a92];return _0x2033d9;};'use strict';var _=require(_0x8f66('0x0'));var util=require(_0x8f66('0x1'));var logger=require(_0x8f66('0x2'))(_0x8f66('0x3'));var moment=require(_0x8f66('0x4'));var BPromise=require(_0x8f66('0x5'));var rp=require(_0x8f66('0x6'));var fs=require('fs');var path=require(_0x8f66('0x7'));var rimraf=require(_0x8f66('0x8'));var config=require('../../config/environment');var attributes=require(_0x8f66('0x9'));module[_0x8f66('0xa')]=function(_0x2afa11,_0x3b21c9){return _0x2afa11['define']('VoicePrefix',attributes,{'tableName':_0x8f66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 10de398..fc3a71b 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 _0xcaf2=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x58feab,_0xd0bfd8){var _0x1b87e6=function(_0x3d939f){while(--_0x3d939f){_0x58feab['push'](_0x58feab['shift']());}};_0x1b87e6(++_0xd0bfd8);}(_0xcaf2,0x8a));var _0x2caf=function(_0x37ef38,_0x2cfe4e){_0x37ef38=_0x37ef38-0x0;var _0x499daa=_0xcaf2[_0x37ef38];return _0x499daa;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});config[_0x2caf('0x9')]=_[_0x2caf('0xa')](config[_0x2caf('0x9')],{'host':_0x2caf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2caf('0x9')]));require(_0x2caf('0xc'))[_0x2caf('0xd')](socket);function respondWithRpcPromise(_0x1ff859,_0x219d0f,_0x438434){return new BPromise(function(_0x1b20e3,_0x3b5631){return client[_0x2caf('0xe')](_0x1ff859,_0x438434)['then'](function(_0xd56396){logger[_0x2caf('0xf')](_0x2caf('0x10'),_0x219d0f,_0x2caf('0x11'));logger[_0x2caf('0x12')](_0x2caf('0x13'),_0x219d0f,_0x2caf('0x11'),JSON[_0x2caf('0x14')](_0xd56396));if(_0xd56396['error']){if(_0xd56396[_0x2caf('0x15')][_0x2caf('0x16')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x219d0f,_0xd56396['error'][_0x2caf('0x17')]);return _0x3b5631(_0xd56396['error'][_0x2caf('0x17')]);}logger[_0x2caf('0x15')](_0x2caf('0x10'),_0x219d0f,_0xd56396[_0x2caf('0x15')]['message']);return _0x1b20e3(_0xd56396[_0x2caf('0x15')]['message']);}else{logger[_0x2caf('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x219d0f,'request\x20sent');_0x1b20e3(_0xd56396[_0x2caf('0x18')]['message']);}})[_0x2caf('0x19')](function(_0x9c7302){logger['error'](_0x2caf('0x10'),_0x219d0f,_0x9c7302);_0x3b5631(_0x9c7302);});});} \ No newline at end of file +var _0x0954=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','moment','bluebird'];(function(_0x4cdc7e,_0x5d2257){var _0x3718ea=function(_0x2ffcd9){while(--_0x2ffcd9){_0x4cdc7e['push'](_0x4cdc7e['shift']());}};_0x3718ea(++_0x5d2257);}(_0x0954,0x135));var _0x4095=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x0954[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x4095('0x0'));var util=require('util');var moment=require(_0x4095('0x1'));var BPromise=require(_0x4095('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4095('0x3'));var db=require(_0x4095('0x4'))['db'];var utils=require(_0x4095('0x5'));var logger=require(_0x4095('0x6'))(_0x4095('0x7'));var config=require(_0x4095('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4095('0x9')]=_[_0x4095('0xa')](config[_0x4095('0x9')],{'host':_0x4095('0xb'),'port':0x18eb});var socket=require(_0x4095('0xc'))(new Redis(config[_0x4095('0x9')]));require('./voicePrefix.socket')[_0x4095('0xd')](socket);function respondWithRpcPromise(_0xe32904,_0x9e1747,_0x5d3e09){return new BPromise(function(_0x296b6d,_0x33daa4){return client[_0x4095('0xe')](_0xe32904,_0x5d3e09)['then'](function(_0x1963eb){logger['info'](_0x4095('0xf'),_0x9e1747,'request\x20sent');logger[_0x4095('0x10')](_0x4095('0x11'),_0x9e1747,_0x4095('0x12'),JSON['stringify'](_0x1963eb));if(_0x1963eb['error']){if(_0x1963eb[_0x4095('0x13')][_0x4095('0x14')]===0x1f4){logger[_0x4095('0x13')](_0x4095('0xf'),_0x9e1747,_0x1963eb['error']['message']);return _0x33daa4(_0x1963eb[_0x4095('0x13')][_0x4095('0x15')]);}logger[_0x4095('0x13')](_0x4095('0xf'),_0x9e1747,_0x1963eb[_0x4095('0x13')][_0x4095('0x15')]);return _0x296b6d(_0x1963eb['error']['message']);}else{logger[_0x4095('0x16')](_0x4095('0xf'),_0x9e1747,'request\x20sent');_0x296b6d(_0x1963eb[_0x4095('0x17')]['message']);}})['catch'](function(_0x272010){logger['error'](_0x4095('0xf'),_0x9e1747,_0x272010);_0x33daa4(_0x272010);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c14fd51..9f9ba70 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 _0xffe1=['length','./voicePrefix.events','save','removeListener'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0xffe1,0x175));var _0x1ffe=function(_0xc04b24,_0x79b9c7){_0xc04b24=_0xc04b24-0x0;var _0xf7d2ed=_0xffe1[_0xc04b24];return _0xf7d2ed;};'use strict';var VoicePrefixEvents=require(_0x1ffe('0x0'));var events=[_0x1ffe('0x1'),'remove','update'];function createListener(_0x37f22a,_0x100207){return function(_0x38121){_0x100207['emit'](_0x37f22a,_0x38121);};}function removeListener(_0x2be98c,_0x21ba54){return function(){VoicePrefixEvents[_0x1ffe('0x2')](_0x2be98c,_0x21ba54);};}exports['register']=function(_0x219223){for(var _0x22d421=0x0,_0x6bc1ed=events[_0x1ffe('0x3')];_0x22d421<_0x6bc1ed;_0x22d421++){var _0xb34112=events[_0x22d421];var _0x8eee2b=createListener('voicePrefix:'+_0xb34112,_0x219223);VoicePrefixEvents['on'](_0xb34112,_0x8eee2b);}}; \ No newline at end of file +var _0x878f=['save','remove','update','emit','removeListener','register','length'];(function(_0x419a92,_0x396a4c){var _0x4dc191=function(_0x2a38c7){while(--_0x2a38c7){_0x419a92['push'](_0x419a92['shift']());}};_0x4dc191(++_0x396a4c);}(_0x878f,0x173));var _0xf878=function(_0x3a25e4,_0x450bcc){_0x3a25e4=_0x3a25e4-0x0;var _0x4be64b=_0x878f[_0x3a25e4];return _0x4be64b;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xf878('0x0'),_0xf878('0x1'),_0xf878('0x2')];function createListener(_0x12df2b,_0x1b3d0b){return function(_0x3d74cf){_0x1b3d0b[_0xf878('0x3')](_0x12df2b,_0x3d74cf);};}function removeListener(_0x45a37b,_0x240b48){return function(){VoicePrefixEvents[_0xf878('0x4')](_0x45a37b,_0x240b48);};}exports[_0xf878('0x5')]=function(_0x4bc9aa){for(var _0x4ac8d8=0x0,_0x3c5f5c=events[_0xf878('0x6')];_0x4ac8d8<_0x3c5f5c;_0x4ac8d8++){var _0x59e564=events[_0x4ac8d8];var _0x52851e=createListener('voicePrefix:'+_0x59e564,_0x4bc9aa);VoicePrefixEvents['on'](_0x59e564,_0x52851e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4ce6eb7..83f53bc 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0xb10b,0x12a));var _0xbb10=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0xb10b[_0x542f45];return _0x38c609;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0xdd14ac,_0x108a82){var _0x1dcce2=function(_0x25e0e0){while(--_0x25e0e0){_0xdd14ac['push'](_0xdd14ac['shift']());}};_0x1dcce2(++_0x108a82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 99f1120..7df2d06 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 _0xfbb7=['#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfbb7,0x103));var _0x7fbb=function(_0x29ba54,_0x2b62fb){_0x29ba54=_0x29ba54-0x0;var _0x18c153=_0xfbb7[_0x29ba54];return _0x18c153;};'use strict';var Sequelize=require(_0x7fbb('0x0'));module[_0x7fbb('0x1')]={'name':{'type':Sequelize[_0x7fbb('0x2')],'allowNull':![],'unique':_0x7fbb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x5'),_0x7fbb('0x6')),'allowNull':![],'defaultValue':_0x7fbb('0x5')},'musiconhold':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':_0x7fbb('0x7')},'announce':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7fbb('0x4')]('rr',_0x7fbb('0x8'),_0x7fbb('0x9'),_0x7fbb('0xa'),_0x7fbb('0xb'),_0x7fbb('0xc'),_0x7fbb('0xd'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x7fbb('0x8'),'set':function(_0x9a0e6d){this['setDataValue'](_0x7fbb('0xe'),_0x9a0e6d?_0x9a0e6d:_0x7fbb('0xc'));},'get':function(){var _0x5f02fc=this[_0x7fbb('0xf')](_0x7fbb('0x10'));var _0x1a1737=this[_0x7fbb('0xf')](_0x7fbb('0x11'));var _0x5c5e9a=this[_0x7fbb('0xf')]('strategy');if(_0x5f02fc===_0x7fbb('0x5')){return _0x5c5e9a;}if(_0x1a1737===_0x7fbb('0x12')&&_0x5c5e9a===_0x7fbb('0xc')||_0x1a1737==='booked'&&_0x5c5e9a===_0x7fbb('0x13')){return _0x5c5e9a;}if(_0x1a1737===_0x7fbb('0x14')||_0x1a1737===_0x7fbb('0x15')||_0x1a1737==='power'){return _0x5c5e9a;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7fbb('0x16')](0xb)},'timeout':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':_0x7fbb('0x17')},'autopause':{'type':Sequelize[_0x7fbb('0x4')]('yes','no',_0x7fbb('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7fbb('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7fbb('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7fbb('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x7fbb('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x7fbb('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7fbb('0x2')]},'queue_youarenext':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x7fbb('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x7fbb('0x2')]},'queue_less_than':{'type':Sequelize[_0x7fbb('0x2')]},'periodic_announce':{'type':Sequelize[_0x7fbb('0x19')],'set':function(_0x250f21){this[_0x7fbb('0x1a')](_0x7fbb('0x1b'),_0x250f21?_0x250f21[_0x7fbb('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0x7fbb('0x1b'))?this[_0x7fbb('0xf')](_0x7fbb('0x1b'))[_0x7fbb('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':'yes','set':function(_0x59244d){this[_0x7fbb('0x1a')]('joinempty',_0x59244d?_0x59244d[_0x7fbb('0x1c')](','):undefined);},'get':function(){return this[_0x7fbb('0xf')](_0x7fbb('0x1e'))?this[_0x7fbb('0xf')](_0x7fbb('0x1e'))[_0x7fbb('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':'no','set':function(_0x5f536b){this[_0x7fbb('0x1a')]('leavewhenempty',_0x5f536b?_0x5f536b[_0x7fbb('0x1c')](','):undefined);},'get':function(){return this[_0x7fbb('0xf')](_0x7fbb('0x1f'))?this['getDataValue'](_0x7fbb('0x1f'))[_0x7fbb('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7fbb('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7fbb('0x2')]},'description':{'type':Sequelize[_0x7fbb('0x2')]},'acw':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':0x0,'set':function(_0x1739ec){this[_0x7fbb('0x1a')](_0x7fbb('0x21'),_0x1739ec);if(_0x1739ec){if(this[_0x7fbb('0xf')](_0x7fbb('0x22'))<0x2){this[_0x7fbb('0x1a')](_0x7fbb('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':0x0,'comment':_0x7fbb('0x23')},'dialMethod':{'type':Sequelize[_0x7fbb('0x4')]('preview',_0x7fbb('0x14'),_0x7fbb('0x24'),_0x7fbb('0x15'),_0x7fbb('0x12')),'defaultValue':_0x7fbb('0x14'),'comment':_0x7fbb('0x25')},'dialLimitChannel':{'type':Sequelize[_0x7fbb('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7fbb('0x26')},'dialLimitQueue':{'type':Sequelize[_0x7fbb('0x16')](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[_0x7fbb('0x27')](0x2)[_0x7fbb('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7fbb('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x7fbb('0x4')]('agentBusyFactor','dropRate'),'defaultValue':_0x7fbb('0x2a'),'comment':_0x7fbb('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7fbb('0x27')](0x2)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7fbb('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7fbb('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x7fbb('0x2e'),'comment':_0x7fbb('0x2f')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x30')},'dialQueueProject':{'type':Sequelize[_0x7fbb('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x32')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':_0x7fbb('0x35')},'dialPrefix':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x7fbb('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7fbb('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x7fbb('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7fbb('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7fbb('0x16')](0x9)[_0x7fbb('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7fbb('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x7fbb('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7fbb('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7fbb('0x16')](0x9)[_0x7fbb('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7fbb('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7fbb('0x16')](0x9)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7fbb('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7fbb('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7fbb('0x16')](0x9)[_0x7fbb('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7fbb('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':0x0,'comment':_0x7fbb('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7fbb('0x4')]('DESC','ASC'),'defaultValue':_0x7fbb('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x7fbb('0x2')],'comment':_0x7fbb('0x40')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7fbb('0x41')},'dialCutDigit':{'type':Sequelize[_0x7fbb('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7fbb('0x16')],'allowNull':!![],'comment':_0x7fbb('0x49')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7fbb('0x4a'),'set':function(_0x2dfb9d){if(!_0x2dfb9d)this[_0x7fbb('0x1a')](_0x7fbb('0x4b'),null);this[_0x7fbb('0x1a')](_0x7fbb('0x4c'),_0x2dfb9d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7fbb('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0xb08a=['tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','outbound','leastrecent','fewestcalls','random','linear','wrandom','rrordered','ringall','setDataValue','getDataValue','type','dialMethod','strategy','inbound','booked','rrmemory','roundrobin','progressive','INTEGER','all','yes','once','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x1ab376,_0x5bd898){var _0x2e0bce=function(_0x397f9d){while(--_0x397f9d){_0x1ab376['push'](_0x1ab376['shift']());}};_0x2e0bce(++_0x5bd898);}(_0xb08a,0x1e0));var _0xab08=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0xb08a[_0x18afca];return _0x11603f;};'use strict';var Sequelize=require('sequelize');module[_0xab08('0x0')]={'name':{'type':Sequelize[_0xab08('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xab08('0x2')]('inbound',_0xab08('0x3')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xab08('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xab08('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xab08('0x2')]('rr','ringall',_0xab08('0x4'),_0xab08('0x5'),_0xab08('0x6'),'rrmemory',_0xab08('0x7'),_0xab08('0x8'),_0xab08('0x9')),'allowNull':![],'defaultValue':_0xab08('0xa'),'set':function(_0x2f1868){this[_0xab08('0xb')]('strategy',_0x2f1868?_0x2f1868:'rrmemory');},'get':function(){var _0xe7082f=this[_0xab08('0xc')](_0xab08('0xd'));var _0x37b84e=this['getDataValue'](_0xab08('0xe'));var _0xbf424e=this[_0xab08('0xc')](_0xab08('0xf'));if(_0xe7082f===_0xab08('0x10')){return _0xbf424e;}if(_0x37b84e===_0xab08('0x11')&&_0xbf424e===_0xab08('0x12')||_0x37b84e==='booked'&&_0xbf424e===_0xab08('0x13')){return _0xbf424e;}if(_0x37b84e===_0xab08('0x14')||_0x37b84e==='predictive'||_0x37b84e==='power'){return _0xbf424e;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xab08('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xab08('0x15')](0xb)},'timeout':{'type':Sequelize[_0xab08('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xab08('0x1')]},'weight':{'type':Sequelize[_0xab08('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xab08('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xab08('0x2')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no',_0xab08('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xab08('0x2')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xab08('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xab08('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xab08('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xab08('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x17'),'no'),'defaultValue':_0xab08('0x17')},'announce_holdtime':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x17'),'no',_0xab08('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xab08('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xab08('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xab08('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xab08('0x1')]},'queue_youarenext':{'type':Sequelize[_0xab08('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xab08('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xab08('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xab08('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xab08('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xab08('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xab08('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xab08('0x1')]},'queue_quantity1':{'type':Sequelize[_0xab08('0x1')]},'queue_quantity2':{'type':Sequelize[_0xab08('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xab08('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x54fbf){this[_0xab08('0xb')](_0xab08('0x19'),_0x54fbf?_0x54fbf['join'](','):[]);},'get':function(){return this[_0xab08('0xc')](_0xab08('0x19'))?this['getDataValue'](_0xab08('0x19'))[_0xab08('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0xab08('0x1')],'defaultValue':_0xab08('0x17'),'set':function(_0x2e7410){this[_0xab08('0xb')](_0xab08('0x1b'),_0x2e7410?_0x2e7410['join'](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0xab08('0xc')](_0xab08('0x1b'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x3752cd){this[_0xab08('0xb')](_0xab08('0x1c'),_0x3752cd?_0x3752cd[_0xab08('0x1d')](','):undefined);},'get':function(){return this[_0xab08('0xc')](_0xab08('0x1c'))?this[_0xab08('0xc')](_0xab08('0x1c'))[_0xab08('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xab08('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xab08('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xab08('0x1')]},'description':{'type':Sequelize[_0xab08('0x1')]},'acw':{'type':Sequelize[_0xab08('0x1e')],'defaultValue':0x0,'set':function(_0x47cf20){this[_0xab08('0xb')]('acw',_0x47cf20);if(_0x47cf20){if(this['getDataValue'](_0xab08('0x1f'))<0x2){this[_0xab08('0xb')](_0xab08('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xab08('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xab08('0x1e')],'defaultValue':0x0,'comment':_0xab08('0x20')},'dialMethod':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x21'),_0xab08('0x14'),_0xab08('0x22'),_0xab08('0x23'),_0xab08('0x11')),'defaultValue':_0xab08('0x14'),'comment':_0xab08('0x24')},'dialLimitChannel':{'type':Sequelize[_0xab08('0x15')](0x4)[_0xab08('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xab08('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['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xab08('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x28'),_0xab08('0x29')),'defaultValue':_0xab08('0x29'),'comment':_0xab08('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xab08('0x2b')](0x2)[_0xab08('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xab08('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xab08('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab08('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xab08('0x1')],'defaultValue':_0xab08('0x2d'),'comment':_0xab08('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xab08('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab08('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xab08('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab08('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab08('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab08('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0x3,'comment':_0xab08('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xab08('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab08('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xab08('0x34')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xab08('0x1')],'defaultValue':_0xab08('0x35')},'dialPrefix':{'type':Sequelize[_0xab08('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xab08('0x2')](_0xab08('0x36'),'never',_0xab08('0x37')),'defaultValue':_0xab08('0x36')},'dialAMDActive':{'type':Sequelize[_0xab08('0x1e')],'defaultValue':0x0,'comment':_0xab08('0x38')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xab08('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xab08('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xab08('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xab08('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xab08('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xab08('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xab08('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0xab08('0x15')](0x9)[_0xab08('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xab08('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xab08('0x15')](0x9)[_0xab08('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xab08('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xab08('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xab08('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xab08('0x15')](0x5)[_0xab08('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xab08('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xab08('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xab08('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xab08('0x40')},'dialRecallInQueue':{'type':Sequelize[_0xab08('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xab08('0x41'),'ASC'),'defaultValue':_0xab08('0x41')},'dialQueueProject2':{'type':Sequelize[_0xab08('0x1')],'comment':_0xab08('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xab08('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xab08('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xab08('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab08('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xab08('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab08('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xab08('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xab08('0x15')](0x5)[_0xab08('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab08('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xab08('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab08('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xab08('0x15')](0x5)[_0xab08('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab08('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xab08('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab08('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xab08('0x48')},'mandatoryDisposition':{'type':Sequelize[_0xab08('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xec192a){if(!_0xec192a)this[_0xab08('0xb')](_0xab08('0x49'),null);this['setDataValue'](_0xab08('0x4a'),_0xec192a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xab08('0x15')](0x3)[_0xab08('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xab08('0x1e')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xab08('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 50a55c4..490aff3 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 _0x0e9b=['util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','count','limit','set','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','name','UserProfileResource','error','stack','index','VoiceQueue','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','catch','show','params','keys','includeAll','include','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getHoppers','nolimit','pick','VoiceQueueId','CmHopper','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','User','online','format','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','NOW()','ContactId','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','ListId\x20=\x20?','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0x0e9b,0xb3));var _0xb0e9=function(_0x53e885,_0x49d504){_0x53e885=_0x53e885-0x0;var _0x40e126=_0x0e9b[_0x53e885];return _0x40e126;};'use strict';var emlformat=require(_0xb0e9('0x0'));var rimraf=require(_0xb0e9('0x1'));var zipdir=require(_0xb0e9('0x2'));var jsonpatch=require(_0xb0e9('0x3'));var rp=require(_0xb0e9('0x4'));var moment=require(_0xb0e9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb0e9('0x6'));var util=require(_0xb0e9('0x7'));var path=require(_0xb0e9('0x8'));var sox=require(_0xb0e9('0x9'));var csv=require(_0xb0e9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0e9('0xb'));var _=require('lodash');var squel=require(_0xb0e9('0xc'));var crypto=require('crypto');var jsforce=require(_0xb0e9('0xd'));var deskjs=require(_0xb0e9('0xe'));var toCsv=require(_0xb0e9('0xa'));var querystring=require(_0xb0e9('0xf'));var Papa=require('papaparse');var Redis=require(_0xb0e9('0x10'));var authService=require(_0xb0e9('0x11'));var qs=require(_0xb0e9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0e9('0x13'))(_0xb0e9('0x14'));var utils=require(_0xb0e9('0x15'));var config=require(_0xb0e9('0x16'));var licenseUtil=require(_0xb0e9('0x17'));var db=require(_0xb0e9('0x18'))['db'];config['redis']=_[_0xb0e9('0x19')](config['redis'],{'host':_0xb0e9('0x1a'),'port':0x18eb});var socket=require(_0xb0e9('0x1b'))(new Redis(config[_0xb0e9('0x1c')]));require('./voiceQueue.socket')[_0xb0e9('0x1d')](socket);function respondWithStatusCode(_0x20db9c,_0xa5927f){_0xa5927f=_0xa5927f||0xcc;return function(_0x142539){if(_0x142539){return _0x20db9c[_0xb0e9('0x1e')](_0xa5927f);}return _0x20db9c[_0xb0e9('0x1f')](_0xa5927f)[_0xb0e9('0x20')]();};}function respondWithResult(_0x480028,_0x43f181){_0x43f181=_0x43f181||0xc8;return function(_0x5efd29){if(_0x5efd29){return _0x480028[_0xb0e9('0x1f')](_0x43f181)[_0xb0e9('0x21')](_0x5efd29);}};}function respondWithFilteredResult(_0x20f038,_0xa5c04b){return function(_0x42674b){if(_0x42674b){var _0x4675ca=typeof _0xa5c04b[_0xb0e9('0x22')]===_0xb0e9('0x23')&&typeof _0xa5c04b['limit']===_0xb0e9('0x23');var _0x5431ce=_0x42674b[_0xb0e9('0x24')];var _0x8fabf5=_0x4675ca?0x0:_0xa5c04b['offset'];var _0x42353b=_0x4675ca?_0x42674b[_0xb0e9('0x24')]:_0xa5c04b['offset']+_0xa5c04b[_0xb0e9('0x25')];var _0x3847d3;if(_0x42353b>=_0x5431ce){_0x42353b=_0x5431ce;_0x3847d3=0xc8;}else{_0x3847d3=0xce;}_0x20f038[_0xb0e9('0x1f')](_0x3847d3);return _0x20f038[_0xb0e9('0x26')]('Content-Range',_0x8fabf5+'-'+_0x42353b+'/'+_0x5431ce)[_0xb0e9('0x21')](_0x42674b);}return null;};}function patchUpdates(_0x5035c4){return function(_0x1f144e){try{jsonpatch['apply'](_0x1f144e,_0x5035c4,!![]);}catch(_0x154c0b){return BPromise['reject'](_0x154c0b);}return _0x1f144e[_0xb0e9('0x27')]();};}function saveUpdates(_0x18a5a8,_0xb618ed){return function(_0x1b5215){if(_0x1b5215){return _0x1b5215[_0xb0e9('0x28')](_0x18a5a8)[_0xb0e9('0x29')](function(_0x4bd1df){return _0x4bd1df;});}return null;};}function removeEntity(_0x409e97,_0x4b16e5){return function(_0x3ac7cd){if(_0x3ac7cd){return _0x3ac7cd[_0xb0e9('0x2a')]()[_0xb0e9('0x29')](function(){var _0x30157d=_0x3ac7cd[_0xb0e9('0x2b')]({'plain':!![]});var _0x46a199=[{'name':_0xb0e9('0x2c'),'value':_0xb0e9('0x2d'),'ignore':![]},{'name':_0xb0e9('0x2e'),'value':_0xb0e9('0x2f'),'ignore':![]}];var _0x5a1024=_(_0x46a199)[_0xb0e9('0x30')]('ignore')[_0xb0e9('0x31')](_0xb0e9('0x32'))[_0xb0e9('0x32')]();if(_[_0xb0e9('0x33')](_0x5a1024,_0x30157d['type'])){return;}var _0x136685=_['find'](_0x46a199,[_0xb0e9('0x32'),_0x30157d[_0xb0e9('0x34')]])[_0xb0e9('0x35')];return db[_0xb0e9('0x36')]['destroy']({'where':{'type':_0x136685,'resourceId':_0x30157d['id']}})['then'](function(){return _0x3ac7cd;});})[_0xb0e9('0x29')](function(){_0x409e97[_0xb0e9('0x1f')](0xcc)[_0xb0e9('0x20')]();});}};}function handleEntityNotFound(_0x1e1b24,_0x5a3a00){return function(_0xf281d6){if(!_0xf281d6){_0x1e1b24[_0xb0e9('0x1e')](0x194);}return _0xf281d6;};}function handleError(_0x5a1231,_0x4edf59){_0x4edf59=_0x4edf59||0x1f4;return function(_0x201128){logger[_0xb0e9('0x37')](_0x201128[_0xb0e9('0x38')]);if(_0x201128[_0xb0e9('0x35')]){delete _0x201128[_0xb0e9('0x35')];}_0x5a1231[_0xb0e9('0x1f')](_0x4edf59)['send'](_0x201128);};}exports[_0xb0e9('0x39')]=function(_0x2510c1,_0x37e033){var _0x186e71={},_0x3dd8b3={},_0x965d08={'count':0x0,'rows':[]};var _0x39e934=_[_0xb0e9('0x31')](db[_0xb0e9('0x3a')][_0xb0e9('0x3b')],function(_0x2bdec8){return{'name':_0x2bdec8['fieldName'],'type':_0x2bdec8[_0xb0e9('0x34')][_0xb0e9('0x3c')]};});_0x3dd8b3['model']=_[_0xb0e9('0x31')](_0x39e934,_0xb0e9('0x35'));_0x3dd8b3[_0xb0e9('0x3d')]=_['keys'](_0x2510c1[_0xb0e9('0x3d')]);_0x3dd8b3[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x3dd8b3[_0xb0e9('0x40')],_0x3dd8b3[_0xb0e9('0x3d')]);_0x186e71['attributes']=_['intersection'](_0x3dd8b3['model'],qs[_0xb0e9('0x41')](_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x186e71[_0xb0e9('0x42')]=_0x186e71[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x186e71['attributes']:_0x3dd8b3[_0xb0e9('0x40')];if(!_0x2510c1['query'][_0xb0e9('0x44')]('nolimit')){_0x186e71[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x2510c1['query']['limit']);_0x186e71[_0xb0e9('0x22')]=qs['offset'](_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x22')]);}_0x186e71[_0xb0e9('0x45')]=qs[_0xb0e9('0x46')](_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x186e71[_0xb0e9('0x47')]=qs['filters'](_['pick'](_0x2510c1['query'],_0x3dd8b3[_0xb0e9('0x3e')]),_0x39e934);if(_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x186e71[_0xb0e9('0x47')]=_['merge'](_0x186e71[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x39e934,function(_0x54cc80){if(_0x54cc80[_0xb0e9('0x34')]!==_0xb0e9('0x48')){var _0x3d211b={};_0x3d211b[_0x54cc80[_0xb0e9('0x35')]]={'$like':'%'+_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x3d211b;}})});}_0x186e71=_[_0xb0e9('0x49')]({},_0x186e71,_0x2510c1[_0xb0e9('0x4a')]);var _0x2e77f3={'where':_0x186e71[_0xb0e9('0x47')]};return db['VoiceQueue'][_0xb0e9('0x24')](_0x2e77f3)[_0xb0e9('0x29')](function(_0x2819cd){_0x965d08[_0xb0e9('0x24')]=_0x2819cd;if(_0x2510c1[_0xb0e9('0x3d')]['includeAll']){_0x186e71['include']=[{'all':!![]}];}return db[_0xb0e9('0x3a')]['findAll'](_0x186e71);})[_0xb0e9('0x29')](function(_0x1e9b76){_0x965d08['rows']=_0x1e9b76;return _0x965d08;})[_0xb0e9('0x29')](respondWithFilteredResult(_0x37e033,_0x186e71))[_0xb0e9('0x4b')](handleError(_0x37e033,null));};exports[_0xb0e9('0x4c')]=function(_0xb3779c,_0x2b91bd){var _0x4b3af2={'raw':![],'where':{'id':_0xb3779c[_0xb0e9('0x4d')]['id']}},_0x20d4a4={};_0x20d4a4['model']=_[_0xb0e9('0x4e')](db['VoiceQueue'][_0xb0e9('0x3b')]);_0x20d4a4[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0xb3779c[_0xb0e9('0x3d')]);_0x20d4a4[_0xb0e9('0x3e')]=_['intersection'](_0x20d4a4['model'],_0x20d4a4[_0xb0e9('0x3d')]);_0x4b3af2[_0xb0e9('0x42')]=_[_0xb0e9('0x3f')](_0x20d4a4[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0xb3779c[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x4b3af2[_0xb0e9('0x42')]=_0x4b3af2[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x4b3af2[_0xb0e9('0x42')]:_0x20d4a4[_0xb0e9('0x40')];if(_0xb3779c[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x4b3af2[_0xb0e9('0x50')]=[{'all':!![]}];}_0x4b3af2=_[_0xb0e9('0x49')]({},_0x4b3af2,_0xb3779c['options']);return db[_0xb0e9('0x3a')][_0xb0e9('0x51')](_0x4b3af2)[_0xb0e9('0x29')](handleEntityNotFound(_0x2b91bd,null))[_0xb0e9('0x29')](respondWithResult(_0x2b91bd,null))[_0xb0e9('0x4b')](handleError(_0x2b91bd,null));};exports['create']=function(_0x3bb3de,_0x2e9d99){return db[_0xb0e9('0x3a')][_0xb0e9('0x52')](_0x3bb3de[_0xb0e9('0x53')],{})[_0xb0e9('0x29')](function(_0x2ba8e7){var _0x484ab3=_0x3bb3de[_0xb0e9('0x54')][_0xb0e9('0x2b')]({'plain':!![]});if(!_0x484ab3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x484ab3[_0xb0e9('0x55')]===_0xb0e9('0x54')){var _0x1398f1=_0x2ba8e7[_0xb0e9('0x2b')]({'plain':!![]});var _0x121873=[{'name':_0xb0e9('0x2c'),'value':_0xb0e9('0x2d')},{'name':_0xb0e9('0x2e'),'value':_0xb0e9('0x2f')}];var _0x3842af=_['find'](_0x121873,[_0xb0e9('0x32'),_0x1398f1[_0xb0e9('0x34')]])[_0xb0e9('0x35')];return db['UserProfileSection']['find']({'where':{'name':_0x3842af,'userProfileId':_0x484ab3[_0xb0e9('0x56')]},'raw':!![]})[_0xb0e9('0x29')](function(_0x34aa36){if(_0x34aa36&&_0x34aa36[_0xb0e9('0x57')]===0x0){return db[_0xb0e9('0x36')]['create']({'name':_0x1398f1[_0xb0e9('0x35')],'resourceId':_0x1398f1['id'],'type':_0x34aa36['name'],'sectionId':_0x34aa36['id']},{})[_0xb0e9('0x29')](function(){return _0x2ba8e7;});}else{return _0x2ba8e7;}})[_0xb0e9('0x4b')](function(_0x4a8ccf){logger[_0xb0e9('0x37')](_0xb0e9('0x58'),_0x4a8ccf);throw _0x4a8ccf;});}return _0x2ba8e7;})[_0xb0e9('0x29')](respondWithResult(_0x2e9d99,0xc9))[_0xb0e9('0x4b')](handleError(_0x2e9d99,null));};exports[_0xb0e9('0x59')]=function(_0x1c5c2b,_0x1ced50){var _0x23b839={'where':{'id':_0x1c5c2b[_0xb0e9('0x4d')]['id']}},_0x198d66={};_0x198d66[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db['VoiceQueue'][_0xb0e9('0x3b')]);_0x23b839[_0xb0e9('0x42')]=_[_0xb0e9('0x3f')](_0x198d66[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0x1c5c2b[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x23b839[_0xb0e9('0x42')]=_0x23b839[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x23b839[_0xb0e9('0x42')]:_0x198d66['model'];if(_0x1c5c2b[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x23b839[_0xb0e9('0x50')]=[{'all':!![]}];}_0x23b839=_[_0xb0e9('0x49')]({},_0x23b839,_0x1c5c2b['options']);return db['VoiceQueue'][_0xb0e9('0x51')](_0x23b839)[_0xb0e9('0x29')](handleEntityNotFound(_0x1ced50,null))['then'](function(_0x47eeb7){if(_0x47eeb7){var _0x3c0d02=_0x47eeb7[_0xb0e9('0x2b')]({'plain':!![]});_0x3c0d02=qs[_0xb0e9('0x5a')](_0x3c0d02,['id','createdAt',_0xb0e9('0x5b')]);_0x1c5c2b[_0xb0e9('0x53')]=_[_0xb0e9('0x5a')](_0x1c5c2b[_0xb0e9('0x53')],['id',_0xb0e9('0x5c'),_0xb0e9('0x5b')]);return db[_0xb0e9('0x3a')][_0xb0e9('0x52')](_[_0xb0e9('0x49')](_0x3c0d02,_0x1c5c2b[_0xb0e9('0x53')]),{'include':_0x1c5c2b[_0xb0e9('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xb0e9('0x29')](function(_0x4c476d){var _0x14bcb2=_0x1c5c2b[_0xb0e9('0x54')]['get']({'plain':!![]});if(!_0x14bcb2)throw new Error(_0xb0e9('0x5d'));if(_0x14bcb2[_0xb0e9('0x55')]===_0xb0e9('0x54')){var _0x306eb2=_0x4c476d[_0xb0e9('0x2b')]({'plain':!![]});var _0x5db9d1=[{'name':_0xb0e9('0x2c'),'value':'inbound'},{'name':_0xb0e9('0x2e'),'value':'outbound'}];var _0x54cdcf=_[_0xb0e9('0x51')](_0x5db9d1,[_0xb0e9('0x32'),_0x306eb2[_0xb0e9('0x34')]])[_0xb0e9('0x35')];return db[_0xb0e9('0x5e')][_0xb0e9('0x51')]({'where':{'name':_0x54cdcf,'userProfileId':_0x14bcb2[_0xb0e9('0x56')]},'raw':!![]})['then'](function(_0x3d0296){if(_0x3d0296&&_0x3d0296[_0xb0e9('0x57')]===0x0){return db[_0xb0e9('0x36')][_0xb0e9('0x52')]({'name':_0x306eb2[_0xb0e9('0x35')],'resourceId':_0x306eb2['id'],'type':_0x3d0296[_0xb0e9('0x35')],'sectionId':_0x3d0296['id']},{})[_0xb0e9('0x29')](function(){return _0x4c476d;});}else{return _0x4c476d;}})[_0xb0e9('0x4b')](function(_0x182b0e){logger[_0xb0e9('0x37')](_0xb0e9('0x58'),_0x182b0e);throw _0x182b0e;});}return _0x4c476d;});}})[_0xb0e9('0x29')](respondWithResult(_0x1ced50,0xc9))['catch'](handleError(_0x1ced50,null));};exports[_0xb0e9('0x28')]=function(_0x3e1ffd,_0x2712b1){if(_0x3e1ffd[_0xb0e9('0x53')]['id']){delete _0x3e1ffd[_0xb0e9('0x53')]['id'];}return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0x3e1ffd[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x2712b1,null))[_0xb0e9('0x29')](saveUpdates(_0x3e1ffd[_0xb0e9('0x53')],null))[_0xb0e9('0x29')](respondWithResult(_0x2712b1,null))['catch'](handleError(_0x2712b1,null));};exports[_0xb0e9('0x2a')]=function(_0x3b3fbc,_0x5855be){return db[_0xb0e9('0x3a')]['find']({'where':{'id':_0x3b3fbc[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x5855be,null))['then'](removeEntity(_0x5855be,null))['catch'](handleError(_0x5855be,null));};exports[_0xb0e9('0x5f')]=function(_0x5b67ba,_0x1030c0,_0xf5bce4){var _0x5a7368={'raw':![],'where':{}};var _0x261374={};var _0x5cc487={'count':0x0,'rows':[]};return db[_0xb0e9('0x3a')]['findOne']({'where':{'id':_0x5b67ba[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x1030c0,null))['then'](function(_0x459947){if(_0x459947){_0x261374[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db['CmHopper'][_0xb0e9('0x3b')]);_0x261374['query']=_['keys'](_0x5b67ba['query']);_0x261374[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x261374['model'],_0x261374[_0xb0e9('0x3d')]);_0x5a7368[_0xb0e9('0x42')]=_[_0xb0e9('0x3f')](_0x261374[_0xb0e9('0x40')],qs['fields'](_0x5b67ba[_0xb0e9('0x3d')]['fields']));_0x5a7368[_0xb0e9('0x42')]=_0x5a7368[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x5a7368['attributes']:_0x261374[_0xb0e9('0x40')];if(!_0x5b67ba[_0xb0e9('0x3d')]['hasOwnProperty'](_0xb0e9('0x60'))){_0x5a7368['limit']=qs['limit'](_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x5a7368['offset']=qs['offset'](_0x5b67ba['query'][_0xb0e9('0x22')]);}_0x5a7368[_0xb0e9('0x45')]=qs[_0xb0e9('0x46')](_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x5a7368[_0xb0e9('0x47')]=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x5b67ba[_0xb0e9('0x3d')],_0x261374[_0xb0e9('0x3e')]));_0x5a7368[_0xb0e9('0x47')][_0xb0e9('0x62')]=_0x459947['id'];if(_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x5a7368[_0xb0e9('0x47')]=_[_0xb0e9('0x49')](_0x5a7368[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x5a7368[_0xb0e9('0x42')],function(_0x419485){var _0x77272d={};_0x77272d[_0x419485]={'$like':'%'+_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x77272d;})});}_0x5a7368=_[_0xb0e9('0x49')]({},_0x5a7368,_0x5b67ba[_0xb0e9('0x4a')]);return db[_0xb0e9('0x63')]['count']({'where':_0x5a7368[_0xb0e9('0x47')]})[_0xb0e9('0x29')](function(_0x13114d){_0x5cc487[_0xb0e9('0x24')]=_0x13114d;if(_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x5a7368['include']=[{'all':!![]}];}return db['CmHopper'][_0xb0e9('0x64')](_0x5a7368);})[_0xb0e9('0x29')](function(_0x74b29a){_0x5cc487[_0xb0e9('0x65')]=_0x74b29a;return _0x5cc487;});}})[_0xb0e9('0x29')](respondWithFilteredResult(_0x1030c0,_0x5a7368))['catch'](handleError(_0x1030c0,null));};exports[_0xb0e9('0x66')]=function(_0x290eab,_0xa2c67e,_0x5b86f7){var _0x5a68b7={'raw':!![],'where':{}};var _0x21bdbb={};var _0x265a8c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb0e9('0x67')]({'where':{'id':_0x290eab[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0xa2c67e,null))[_0xb0e9('0x29')](function(_0x3e3038){if(_0x3e3038){_0x21bdbb[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db[_0xb0e9('0x68')][_0xb0e9('0x3b')]);_0x21bdbb[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x290eab[_0xb0e9('0x3d')]);_0x21bdbb[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x21bdbb[_0xb0e9('0x40')],_0x21bdbb[_0xb0e9('0x3d')]);_0x5a68b7['attributes']=_[_0xb0e9('0x3f')](_0x21bdbb['model'],qs[_0xb0e9('0x41')](_0x290eab['query'][_0xb0e9('0x41')]));_0x5a68b7[_0xb0e9('0x42')]=_0x5a68b7[_0xb0e9('0x42')]['length']?_0x5a68b7['attributes']:_0x21bdbb['model'];if(!_0x290eab[_0xb0e9('0x3d')][_0xb0e9('0x44')]('nolimit')){_0x5a68b7[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x290eab['query'][_0xb0e9('0x25')]);_0x5a68b7[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x290eab['query']['offset']);}_0x5a68b7['order']=qs[_0xb0e9('0x46')](_0x290eab[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x5a68b7[_0xb0e9('0x47')]=qs['filters'](_['pick'](_0x290eab[_0xb0e9('0x3d')],_0x21bdbb[_0xb0e9('0x3e')]));_0x5a68b7[_0xb0e9('0x47')][_0xb0e9('0x62')]=_0x3e3038['id'];if(_0x290eab[_0xb0e9('0x3d')]['filter']){_0x5a68b7[_0xb0e9('0x47')]=_['merge'](_0x5a68b7[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x5a68b7[_0xb0e9('0x42')],function(_0x3bf6a5){var _0x5c860e={};_0x5c860e[_0x3bf6a5]={'$like':'%'+_0x290eab[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x5c860e;})});}_0x5a68b7=_[_0xb0e9('0x49')]({},_0x5a68b7,_0x290eab[_0xb0e9('0x4a')]);return db['CmHopperHistory']['count']({'where':_0x5a68b7['where']})[_0xb0e9('0x29')](function(_0xf0b8ff){_0x265a8c[_0xb0e9('0x24')]=_0xf0b8ff;if(_0x290eab['query'][_0xb0e9('0x4f')]){_0x5a68b7[_0xb0e9('0x50')]=[{'all':!![]}];}return db[_0xb0e9('0x68')]['findAll'](_0x5a68b7);})[_0xb0e9('0x29')](function(_0xfd45d){_0x265a8c[_0xb0e9('0x65')]=_0xfd45d;return _0x265a8c;});}})[_0xb0e9('0x29')](respondWithFilteredResult(_0xa2c67e,_0x5a68b7))[_0xb0e9('0x4b')](handleError(_0xa2c67e,null));};exports[_0xb0e9('0x69')]=function(_0x42d3e8,_0x5ca2e7,_0x35f105){var _0x1a7a20={'raw':!![],'where':{}};var _0x5c075f={};var _0x1be8e4={'count':0x0,'rows':[]};return db[_0xb0e9('0x3a')][_0xb0e9('0x67')]({'where':{'id':_0x42d3e8[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ca2e7,null))[_0xb0e9('0x29')](function(_0x4f7dd1){if(_0x4f7dd1){_0x5c075f[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db[_0xb0e9('0x6a')][_0xb0e9('0x3b')]);_0x5c075f[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x42d3e8[_0xb0e9('0x3d')]);_0x5c075f['filters']=_[_0xb0e9('0x3f')](_0x5c075f['model'],_0x5c075f[_0xb0e9('0x3d')]);_0x1a7a20[_0xb0e9('0x42')]=_[_0xb0e9('0x3f')](_0x5c075f['model'],qs[_0xb0e9('0x41')](_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x1a7a20['attributes']=_0x1a7a20[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x1a7a20[_0xb0e9('0x42')]:_0x5c075f[_0xb0e9('0x40')];if(!_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x44')](_0xb0e9('0x60'))){_0x1a7a20[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x42d3e8[_0xb0e9('0x3d')]['limit']);_0x1a7a20[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x42d3e8[_0xb0e9('0x3d')]['offset']);}_0x1a7a20[_0xb0e9('0x45')]=qs['sort'](_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x1a7a20[_0xb0e9('0x47')]=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x42d3e8[_0xb0e9('0x3d')],_0x5c075f[_0xb0e9('0x3e')]));_0x1a7a20['where']['VoiceQueueId']=_0x4f7dd1['id'];if(_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x1a7a20[_0xb0e9('0x47')]=_['merge'](_0x1a7a20[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x1a7a20[_0xb0e9('0x42')],function(_0x42fa14){var _0x3c4c72={};_0x3c4c72[_0x42fa14]={'$like':'%'+_0x42d3e8['query']['filter']+'%'};return _0x3c4c72;})});}_0x1a7a20=_[_0xb0e9('0x49')]({},_0x1a7a20,_0x42d3e8[_0xb0e9('0x4a')]);return db['CmHopperFinal']['count']({'where':_0x1a7a20[_0xb0e9('0x47')]})[_0xb0e9('0x29')](function(_0x18f98b){_0x1be8e4[_0xb0e9('0x24')]=_0x18f98b;if(_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x1a7a20['include']=[{'all':!![]}];}return db[_0xb0e9('0x6a')][_0xb0e9('0x64')](_0x1a7a20);})[_0xb0e9('0x29')](function(_0x5c0068){_0x1be8e4[_0xb0e9('0x65')]=_0x5c0068;return _0x1be8e4;});}})[_0xb0e9('0x29')](respondWithFilteredResult(_0x5ca2e7,_0x1a7a20))[_0xb0e9('0x4b')](handleError(_0x5ca2e7,null));};exports[_0xb0e9('0x6b')]=function(_0x2b2a16,_0x47b266,_0x101608){var _0x34b532={'raw':!![],'where':{}};var _0x38ecd4={};var _0x26b8d4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb0e9('0x67')]({'where':{'id':_0x2b2a16[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x47b266,null))['then'](function(_0x14d815){if(_0x14d815){_0x38ecd4[_0xb0e9('0x40')]=_['keys'](db[_0xb0e9('0x6c')]['rawAttributes']);_0x38ecd4[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x2b2a16['query']);_0x38ecd4[_0xb0e9('0x3e')]=_['intersection'](_0x38ecd4[_0xb0e9('0x40')],_0x38ecd4[_0xb0e9('0x3d')]);_0x34b532['attributes']=_[_0xb0e9('0x3f')](_0x38ecd4[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0x2b2a16[_0xb0e9('0x3d')]['fields']));_0x34b532[_0xb0e9('0x42')]=_0x34b532[_0xb0e9('0x42')]['length']?_0x34b532[_0xb0e9('0x42')]:_0x38ecd4['model'];if(!_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x44')]('nolimit')){_0x34b532[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x34b532[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x2b2a16[_0xb0e9('0x3d')]['offset']);}_0x34b532[_0xb0e9('0x45')]=qs['sort'](_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x34b532['where']=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x2b2a16[_0xb0e9('0x3d')],_0x38ecd4[_0xb0e9('0x3e')]));_0x34b532['where'][_0xb0e9('0x62')]=_0x14d815['id'];if(_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x34b532['where']=_[_0xb0e9('0x49')](_0x34b532[_0xb0e9('0x47')],{'$or':_['map'](_0x34b532[_0xb0e9('0x42')],function(_0x5cc689){var _0x56bf7d={};_0x56bf7d[_0x5cc689]={'$like':'%'+_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x56bf7d;})});}_0x34b532=_['merge']({},_0x34b532,_0x2b2a16[_0xb0e9('0x4a')]);return db['CmHopperBlack'][_0xb0e9('0x24')]({'where':_0x34b532[_0xb0e9('0x47')]})[_0xb0e9('0x29')](function(_0x25cf13){_0x26b8d4[_0xb0e9('0x24')]=_0x25cf13;if(_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x34b532[_0xb0e9('0x50')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xb0e9('0x64')](_0x34b532);})[_0xb0e9('0x29')](function(_0x2fea86){_0x26b8d4[_0xb0e9('0x65')]=_0x2fea86;return _0x26b8d4;});}})['then'](respondWithFilteredResult(_0x47b266,_0x34b532))[_0xb0e9('0x4b')](handleError(_0x47b266,null));};exports[_0xb0e9('0x6d')]=function(_0x442543,_0x40e800,_0x5d215f){var _0x3a8400={};var _0x1d1bd5={};var _0x297a34;var _0x214127;return db['VoiceQueue']['findOne']({'where':{'id':_0x442543[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40e800,null))['then'](function(_0x52c7ef){if(_0x52c7ef){_0x297a34=_0x52c7ef;_0x1d1bd5[_0xb0e9('0x40')]=_['keys'](db['Team'][_0xb0e9('0x3b')]);_0x1d1bd5[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x442543[_0xb0e9('0x3d')]);_0x1d1bd5[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x1d1bd5['model'],_0x1d1bd5['query']);_0x3a8400['attributes']=_['intersection'](_0x1d1bd5[_0xb0e9('0x40')],qs['fields'](_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x3a8400[_0xb0e9('0x42')]=_0x3a8400[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x3a8400[_0xb0e9('0x42')]:_0x1d1bd5[_0xb0e9('0x40')];_0x3a8400[_0xb0e9('0x45')]=qs[_0xb0e9('0x46')](_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x3a8400['where']=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x442543[_0xb0e9('0x3d')],_0x1d1bd5['filters']));if(_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x3a8400[_0xb0e9('0x47')]=_[_0xb0e9('0x49')](_0x3a8400[_0xb0e9('0x47')],{'$or':_['map'](_0x3a8400['attributes'],function(_0x29c425){var _0x27d1b7={};_0x27d1b7[_0x29c425]={'$like':'%'+_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x27d1b7;})});}_0x3a8400=_[_0xb0e9('0x49')]({},_0x3a8400,_0x442543['options']);return _0x297a34['getTeams'](_0x3a8400);}})[_0xb0e9('0x29')](function(_0x5a6629){if(_0x5a6629){_0x214127=_0x5a6629['length'];if(!_0x442543['query'][_0xb0e9('0x44')]('nolimit')){_0x3a8400[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x3a8400[_0xb0e9('0x22')]=qs['offset'](_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x22')]);}return _0x297a34['getTeams'](_0x3a8400);}})[_0xb0e9('0x29')](function(_0x56e43b){if(_0x56e43b){return _0x56e43b?{'count':_0x214127,'rows':_0x56e43b}:null;}})[_0xb0e9('0x29')](respondWithResult(_0x40e800,null))[_0xb0e9('0x4b')](handleError(_0x40e800,null));};exports[_0xb0e9('0x6e')]=function(_0xfcfe5d,_0x4b479d,_0x3e52a8){var _0x3e5dab=_0xfcfe5d['body']['teams'];var _0x5cc7cd=_[_0xb0e9('0x31')](_0x3e5dab,'id');return db[_0xb0e9('0x6f')][_0xb0e9('0x64')]({'where':{'id':_0x5cc7cd},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0xb0e9('0x70'),_0xb0e9('0x71')],'raw':!![]}]})[_0xb0e9('0x29')](function(_0x4315bd){if(_0x4315bd){var _0x482c34=_[_0xb0e9('0x72')](_0x4315bd,function(_0x49f740){var _0xbc36cc=_0x49f740['get']({'plain':!![]});_0xbc36cc[_0xb0e9('0x73')][_0xb0e9('0x74')](function(_0x49e999){_0x49e999[_0xb0e9('0x75')]=_[_0xb0e9('0x51')](_0x3e5dab,{'id':_0xbc36cc['id']})[_0xb0e9('0x75')];});return _0xbc36cc[_0xb0e9('0x73')];});return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0xfcfe5d[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](function(_0x2f209c){return db[_0xb0e9('0x76')][_0xb0e9('0x77')](function(_0x386e92){return _0x2f209c[_0xb0e9('0x6e')](_0x5cc7cd,{'transaction':_0x386e92})[_0xb0e9('0x29')](function(){return BPromise[_0xb0e9('0x78')](_0x3e5dab,function(_0x8ee83d){return db['TeamVoiceQueue'][_0xb0e9('0x79')]({'TeamId':_0x8ee83d['id'],'VoiceQueueId':_0xfcfe5d[_0xb0e9('0x4d')]['id'],'penalty':_0x8ee83d[_0xb0e9('0x75')]},{'transaction':_0x386e92});});})[_0xb0e9('0x29')](function(){return BPromise[_0xb0e9('0x78')](_0x482c34,function(_0x119e8a){return db[_0xb0e9('0x7a')][_0xb0e9('0x7b')]({'where':{'UserId':_0x119e8a['id'],'VoiceQueueId':_0xfcfe5d['params']['id']},'defaults':{'penalty':_0x119e8a['penalty']},'transaction':_0x386e92});});})[_0xb0e9('0x29')](function(){return BPromise[_0xb0e9('0x78')](_['filter'](_0x482c34,{'online':!![]}),function(_0x9244cc){return db[_0xb0e9('0x7c')][_0xb0e9('0x79')]({'membername':_0x9244cc[_0xb0e9('0x35')],'UserId':_0x9244cc['id'],'queue_name':_0x2f209c[_0xb0e9('0x35')],'VoiceQueueId':_0x2f209c['id'],'interface':_[_0xb0e9('0x7d')](_0x9244cc['interface'])?util['format'](_0xb0e9('0x7e'),_0x9244cc[_0xb0e9('0x35')]):_0x9244cc['interface'],'paused':_0x9244cc['voicePause']||![],'penalty':_0x9244cc[_0xb0e9('0x75')]},{'transaction':_0x386e92});});})[_0xb0e9('0x29')](function(){_0x482c34[_0xb0e9('0x74')](function(_0x56580d){socket[_0xb0e9('0x7f')](_0xb0e9('0x80'),{'UserId':_0x56580d['id'],'VoiceQueueId':_0x2f209c['id']});});});});});}})[_0xb0e9('0x29')](respondWithStatusCode(_0x4b479d,null))['catch'](handleError(_0x4b479d,null));};exports['removeTeams']=function(_0xaac117,_0x4617ff,_0xa2c78e){return db[_0xb0e9('0x6f')][_0xb0e9('0x64')]({'where':{'id':_0xaac117[_0xb0e9('0x3d')][_0xb0e9('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb0e9('0x73'),'attributes':['id'],'raw':!![]}]})[_0xb0e9('0x29')](handleEntityNotFound(_0x4617ff,null))[_0xb0e9('0x29')](function(_0x9ee37){var _0x588e8f=_[_0xb0e9('0x31')](_0x9ee37,'id');var _0x5ed4d5=[];var _0x4379a7=[];var _0xde6e43=squel[_0xb0e9('0x82')]();_0xde6e43[_0xb0e9('0x83')](_0xb0e9('0x84'))[_0xb0e9('0x85')](_0xb0e9('0x86'),'tq')['join']('user_has_teams','ut',_0xb0e9('0x87'))[_0xb0e9('0x47')](_0xb0e9('0x88'),_0xaac117[_0xb0e9('0x4d')]['id']);for(var _0x2eb49a=0x0;_0x2eb49a<_0x9ee37[_0xb0e9('0x43')];_0x2eb49a+=0x1){let _0x3b4ccc=_0x9ee37[_0x2eb49a];for(var _0x2bb99d=0x0;_0x2bb99d<_0x3b4ccc['Agents'][_0xb0e9('0x43')];_0x2bb99d+=0x1){let _0x257650=_0x3b4ccc[_0xb0e9('0x73')][_0x2bb99d];var _0x40860b=_0xde6e43['clone']();_0x40860b['where'](_0xb0e9('0x89'),_0x257650['id']);_0x4379a7[_0xb0e9('0x8a')](db[_0xb0e9('0x76')][_0xb0e9('0x3d')](_0x40860b[_0xb0e9('0x8b')](),{'type':db[_0xb0e9('0x76')][_0xb0e9('0x8c')][_0xb0e9('0x8d')]})[_0xb0e9('0x29')](function(_0x121049){if(_0x121049[_0xb0e9('0x43')]===0x1){return _0x257650['id'];}else{var _0x2ee2c3=_[_0xb0e9('0x8e')](_[_0xb0e9('0x31')](_0x121049,_0xb0e9('0x8f')),function(_0x35ab73){return _[_0xb0e9('0x33')](_0x588e8f,_0x35ab73);});if(_0x2ee2c3){return _0x257650['id'];}}}));}}return BPromise[_0xb0e9('0x90')](_0x4379a7)['then'](function(_0xd9b620){_0x5ed4d5=_(_0x5ed4d5)[_0xb0e9('0x91')](_0xd9b620)['compact']()[_0xb0e9('0x32')]();return db['VoiceQueue'][_0xb0e9('0x51')]({'where':{'id':_0xaac117[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](function(_0x21a966){return db[_0xb0e9('0x76')][_0xb0e9('0x77')](function(_0x3bd9d2){return _0x21a966[_0xb0e9('0x92')](_0xaac117[_0xb0e9('0x3d')][_0xb0e9('0x81')],{'transaction':_0x3bd9d2})['then'](function(){if(!_[_0xb0e9('0x93')](_0x5ed4d5)){return _0x21a966[_0xb0e9('0x94')](_0x5ed4d5,{'transaction':_0x3bd9d2})[_0xb0e9('0x29')](function(){return db[_0xb0e9('0x7c')]['destroy']({'where':{'VoiceQueueId':_0xaac117[_0xb0e9('0x4d')]['id'],'UserId':_0x5ed4d5},'transaction':_0x3bd9d2});});}})['then'](function(){_0x5ed4d5[_0xb0e9('0x74')](function(_0x2e21aa){socket[_0xb0e9('0x7f')](_0xb0e9('0x95'),{'UserId':_0x2e21aa,'VoiceQueueId':_0x21a966['id']});});});});});});})['then'](respondWithStatusCode(_0x4617ff,null))[_0xb0e9('0x4b')](handleError(_0x4617ff,null));};exports['addAgents']=function(_0xe21957,_0x1a9dab,_0x590a83){var _0x2709c6,_0x14438b;return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0xe21957['params']['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x1a9dab,null))[_0xb0e9('0x29')](function(_0xa8e90e){if(_0xa8e90e){_0x14438b=_0xa8e90e;return _0xa8e90e[_0xb0e9('0x96')](_0xe21957[_0xb0e9('0x53')][_0xb0e9('0x81')],_[_0xb0e9('0x5a')](_0xe21957[_0xb0e9('0x53')],['ids','id'])||{})[_0xb0e9('0x97')](function(_0x49385a){for(var _0x65aa74=0x0;_0x65aa74<_0xe21957[_0xb0e9('0x53')][_0xb0e9('0x81')]['length'];_0x65aa74+=0x1){socket[_0xb0e9('0x7f')](_0xb0e9('0x80'),{'UserId':Number(_0xe21957[_0xb0e9('0x53')][_0xb0e9('0x81')][_0x65aa74]),'VoiceQueueId':Number(_0xe21957['params']['id'])});}return _0x49385a;});}})[_0xb0e9('0x29')](function(_0x4845a4){_0x2709c6=_0x4845a4||[];if(_0x14438b){return db[_0xb0e9('0x98')][_0xb0e9('0x64')]({'where':{'id':_0xe21957['body'][_0xb0e9('0x81')]},'attributes':['id','name',_0xb0e9('0x99'),_0xb0e9('0x70'),_0xb0e9('0x71')],'raw':!![]});}})['then'](function(_0x1c8b7d){if(!_[_0xb0e9('0x93')](_0x1c8b7d)){var _0x412943=[];for(var _0x2d2e60=0x0;_0x2d2e60<_0x1c8b7d[_0xb0e9('0x43')];_0x2d2e60++){if(_0x1c8b7d[_0x2d2e60][_0xb0e9('0x99')]){_0x412943['push'](db[_0xb0e9('0x7c')][_0xb0e9('0x79')]({'membername':_0x1c8b7d[_0x2d2e60][_0xb0e9('0x35')],'UserId':_0x1c8b7d[_0x2d2e60]['id'],'queue_name':_0x14438b[_0xb0e9('0x35')],'VoiceQueueId':_0x14438b['id'],'interface':_[_0xb0e9('0x7d')](_0x1c8b7d[_0x2d2e60][_0xb0e9('0x71')])?util[_0xb0e9('0x9a')]('SIP/%s',_0x1c8b7d[_0x2d2e60][_0xb0e9('0x35')]):_0x1c8b7d[_0x2d2e60]['interface'],'paused':_0x1c8b7d[_0x2d2e60][_0xb0e9('0x70')]||![],'penalty':_0xe21957[_0xb0e9('0x53')][_0xb0e9('0x75')]||0x0}));}}return BPromise[_0xb0e9('0x90')](_0x412943);}})['then'](function(){return _0x2709c6;})[_0xb0e9('0x29')](respondWithResult(_0x1a9dab,null))[_0xb0e9('0x4b')](handleError(_0x1a9dab,null));};exports['removeAgents']=function(_0x1561c7,_0xd7435d,_0x15b5c5){return db[_0xb0e9('0x3a')]['find']({'where':{'id':_0x1561c7[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0xd7435d,null))['then'](function(_0x39c750){if(_0x39c750){return _0x39c750[_0xb0e9('0x94')](_0x1561c7[_0xb0e9('0x3d')]['ids'])[_0xb0e9('0x29')](function(){if(_['isArray'](_0x1561c7[_0xb0e9('0x3d')][_0xb0e9('0x81')])){for(var _0x4dc3f7=0x0;_0x4dc3f7<_0x1561c7[_0xb0e9('0x3d')][_0xb0e9('0x81')]['length'];_0x4dc3f7+=0x1){socket[_0xb0e9('0x7f')](_0xb0e9('0x95'),{'UserId':Number(_0x1561c7[_0xb0e9('0x3d')][_0xb0e9('0x81')][_0x4dc3f7]),'VoiceQueueId':Number(_0x1561c7[_0xb0e9('0x4d')]['id'])});}}else{socket[_0xb0e9('0x7f')](_0xb0e9('0x95'),{'UserId':Number(_0x1561c7['query']['ids']),'VoiceQueueId':Number(_0x1561c7[_0xb0e9('0x4d')]['id'])});}});}})[_0xb0e9('0x29')](function(_0x59c6d8){return db[_0xb0e9('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x1561c7['params']['id'],'UserId':_0x1561c7[_0xb0e9('0x3d')][_0xb0e9('0x81')]}})['then'](function(){return _0x59c6d8;});})[_0xb0e9('0x29')](respondWithStatusCode(_0xd7435d,null))['catch'](handleError(_0xd7435d,null));};exports[_0xb0e9('0x9b')]=function(_0x9811b,_0x20539a,_0x33455b){var _0x227810={};var _0x13ee97={};var _0x2978c4;var _0x31266c;return db['VoiceQueue']['findOne']({'where':{'id':_0x9811b[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x20539a,null))['then'](function(_0xdbe506){if(_0xdbe506){_0x2978c4=_0xdbe506;_0x13ee97[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db[_0xb0e9('0x98')]['rawAttributes']);_0x13ee97['query']=_[_0xb0e9('0x4e')](_0x9811b[_0xb0e9('0x3d')]);_0x13ee97['filters']=_[_0xb0e9('0x3f')](_0x13ee97[_0xb0e9('0x40')],_0x13ee97[_0xb0e9('0x3d')]);_0x227810['attributes']=_[_0xb0e9('0x3f')](_0x13ee97[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0x9811b[_0xb0e9('0x3d')]['fields']));_0x227810['attributes']=_0x227810[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x227810[_0xb0e9('0x42')]:_0x13ee97[_0xb0e9('0x40')];_0x227810[_0xb0e9('0x45')]=qs['sort'](_0x9811b[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x227810['where']=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x9811b[_0xb0e9('0x3d')],_0x13ee97[_0xb0e9('0x3e')]));if(_0x9811b[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x227810[_0xb0e9('0x47')]=_[_0xb0e9('0x49')](_0x227810[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x227810[_0xb0e9('0x42')],function(_0x460886){var _0x4db17f={};_0x4db17f[_0x460886]={'$like':'%'+_0x9811b[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x4db17f;})});}_0x227810=_[_0xb0e9('0x49')]({},_0x227810,_0x9811b[_0xb0e9('0x4a')]);return _0x2978c4['getAgents'](_0x227810);}})['then'](function(_0x3983ff){if(_0x3983ff){_0x31266c=_0x3983ff['length'];if(!_0x9811b['query'][_0xb0e9('0x44')](_0xb0e9('0x60'))){_0x227810[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x9811b[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x227810[_0xb0e9('0x22')]=qs['offset'](_0x9811b[_0xb0e9('0x3d')]['offset']);}return _0x2978c4['getAgents'](_0x227810);}})['then'](function(_0x4cee91){if(_0x4cee91){return _0x4cee91?{'count':_0x31266c,'rows':_0x4cee91}:null;}})[_0xb0e9('0x29')](respondWithResult(_0x20539a,null))[_0xb0e9('0x4b')](handleError(_0x20539a,null));};exports['getMembers']=function(_0x4cc164,_0xd35758,_0x4076d2){var _0x13e45b={};var _0x517b98={};var _0xf8520a;var _0x3f4132;return db[_0xb0e9('0x3a')]['findOne']({'where':{'id':_0x4cc164[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd35758,null))['then'](function(_0x525226){if(_0x525226){_0xf8520a=_0x525226;_0x517b98[_0xb0e9('0x40')]=_['keys'](db[_0xb0e9('0x7c')][_0xb0e9('0x3b')]);_0x517b98[_0xb0e9('0x3d')]=_['keys'](_0x4cc164[_0xb0e9('0x3d')]);_0x517b98[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x517b98[_0xb0e9('0x40')],_0x517b98[_0xb0e9('0x3d')]);_0x13e45b['attributes']=_[_0xb0e9('0x3f')](_0x517b98['model'],qs[_0xb0e9('0x41')](_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x13e45b['attributes']=_0x13e45b[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x13e45b['attributes']:_0x517b98[_0xb0e9('0x40')];_0x13e45b[_0xb0e9('0x45')]=qs['sort'](_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x13e45b[_0xb0e9('0x47')]=qs['filters'](_[_0xb0e9('0x61')](_0x4cc164[_0xb0e9('0x3d')],_0x517b98[_0xb0e9('0x3e')]));if(_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x13e45b['where']=_[_0xb0e9('0x49')](_0x13e45b[_0xb0e9('0x47')],{'$or':_['map'](_0x13e45b[_0xb0e9('0x42')],function(_0x424c67){var _0x310857={};_0x310857[_0x424c67]={'$like':'%'+_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x310857;})});}_0x13e45b=_['merge']({},_0x13e45b,_0x4cc164[_0xb0e9('0x4a')]);return _0xf8520a['getMembers'](_0x13e45b);}})['then'](function(_0x36d14b){if(_0x36d14b){_0x3f4132=_0x36d14b[_0xb0e9('0x43')];if(!_0x4cc164[_0xb0e9('0x3d')]['hasOwnProperty'](_0xb0e9('0x60'))){_0x13e45b['limit']=qs['limit'](_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x13e45b[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x4cc164[_0xb0e9('0x3d')]['offset']);}return _0xf8520a[_0xb0e9('0x9c')](_0x13e45b);}})[_0xb0e9('0x29')](function(_0x51b71a){return _0x51b71a?{'count':_0x3f4132,'rows':_0x51b71a}:null;})[_0xb0e9('0x29')](respondWithResult(_0xd35758,null))[_0xb0e9('0x4b')](handleError(_0xd35758,null));};exports[_0xb0e9('0x9d')]=function(_0x48144a,_0x32a0c0,_0x3b84f9){var _0x5b26e9={};var _0x3613f3={};var _0x14e390;var _0xf46ec3;return db[_0xb0e9('0x3a')][_0xb0e9('0x67')]({'where':{'id':_0x48144a[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x32a0c0,null))['then'](function(_0x3f8bc8){if(_0x3f8bc8){_0x14e390=_0x3f8bc8;_0x3613f3[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db['CmList'][_0xb0e9('0x3b')]);_0x3613f3[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x48144a[_0xb0e9('0x3d')]);_0x3613f3[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x3613f3[_0xb0e9('0x40')],_0x3613f3[_0xb0e9('0x3d')]);_0x5b26e9['attributes']=_['intersection'](_0x3613f3[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0x48144a[_0xb0e9('0x3d')]['fields']));_0x5b26e9[_0xb0e9('0x42')]=_0x5b26e9[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x5b26e9[_0xb0e9('0x42')]:_0x3613f3['model'];_0x5b26e9['order']=qs[_0xb0e9('0x46')](_0x48144a['query'][_0xb0e9('0x46')]);_0x5b26e9[_0xb0e9('0x47')]=qs[_0xb0e9('0x3e')](_['pick'](_0x48144a[_0xb0e9('0x3d')],_0x3613f3['filters']));if(_0x48144a[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x5b26e9['where']=_[_0xb0e9('0x49')](_0x5b26e9[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x5b26e9[_0xb0e9('0x42')],function(_0x1ae9e1){var _0x33ce6b={};_0x33ce6b[_0x1ae9e1]={'$like':'%'+_0x48144a[_0xb0e9('0x3d')]['filter']+'%'};return _0x33ce6b;})});}_0x5b26e9=_[_0xb0e9('0x49')]({},_0x5b26e9,_0x48144a[_0xb0e9('0x4a')]);return _0x14e390[_0xb0e9('0x9d')](_0x5b26e9);}})[_0xb0e9('0x29')](function(_0x142e1c){if(_0x142e1c){_0xf46ec3=_0x142e1c['length'];if(!_0x48144a[_0xb0e9('0x3d')][_0xb0e9('0x44')](_0xb0e9('0x60'))){_0x5b26e9[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x48144a[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x5b26e9[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x48144a[_0xb0e9('0x3d')][_0xb0e9('0x22')]);}return _0x14e390['getLists'](_0x5b26e9);}})[_0xb0e9('0x29')](function(_0x35f7ac){if(_0x35f7ac){return _0x35f7ac?{'count':_0xf46ec3,'rows':_0x35f7ac}:null;}})['then'](respondWithResult(_0x32a0c0,null))[_0xb0e9('0x4b')](handleError(_0x32a0c0,null));};exports[_0xb0e9('0x9e')]=function(_0x1f43ca,_0x204954,_0x3a29d6){var _0x59bee3,_0x3cc232;return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0x1f43ca[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x204954,null))[_0xb0e9('0x29')](function(_0x5b691f){if(_0x5b691f){_0x3cc232=_0x5b691f;return _0x5b691f[_0xb0e9('0x9e')](_0x1f43ca[_0xb0e9('0x53')]['ids'],_['omit'](_0x1f43ca[_0xb0e9('0x53')],[_0xb0e9('0x81'),'id'])||{});}return null;})[_0xb0e9('0x97')](function(_0x2c81bc){var _0x20f18d;_0x59bee3=_0x2c81bc||[];var _0x4f6854=[];if(_0x2c81bc){for(var _0x7bb709=0x0;_0x7bb709<_0x2c81bc['length'];_0x7bb709+=0x1){var _0xc3543c=_0x2c81bc[_0x7bb709]['get']({'plain':!![]});_0x3cc232[_0xb0e9('0x9f')]=_0x1f43ca[_0xb0e9('0x53')][_0xb0e9('0x9f')]?_0x1f43ca[_0xb0e9('0x53')][_0xb0e9('0x9f')]:_0x3cc232[_0xb0e9('0x9f')];switch(_0x3cc232[_0xb0e9('0x9f')]){case _0xb0e9('0xa0'):_0x20f18d=squel[_0xb0e9('0xa1')]()['into']('cm_hopper')[_0xb0e9('0xa2')]([_0xb0e9('0xa3'),_0xb0e9('0xa4'),'ContactId','ListId','VoiceQueueId',_0xb0e9('0x5c'),'updatedAt'],squel['select']()[_0xb0e9('0x83')]('phone','phone')[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0xa4'))[_0xb0e9('0x83')]('id',_0xb0e9('0xa6'))[_0xb0e9('0x83')](_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')](),_0xb0e9('0xa8'))[_0xb0e9('0x83')](_0x1f43ca[_0xb0e9('0x4d')]['id'][_0xb0e9('0x8b')](),_0xb0e9('0x62'))[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0x5c'))[_0xb0e9('0x83')](_0xb0e9('0xa5'),'updatedAt')[_0xb0e9('0x85')](_0xb0e9('0xa9'))[_0xb0e9('0x47')](_0xb0e9('0xaa'))[_0xb0e9('0x47')]('ListId\x20=\x20?',_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')]())[_0xb0e9('0x47')](_0xb0e9('0xab'))[_0xb0e9('0x47')](_0xb0e9('0xac'),squel[_0xb0e9('0x82')]()[_0xb0e9('0x83')](_0xb0e9('0xad'))[_0xb0e9('0x85')](_0xb0e9('0xae'))[_0xb0e9('0x47')]('VoiceQueueId\x20=\x20?',_0x1f43ca[_0xb0e9('0x4d')]['id'][_0xb0e9('0x8b')]()))[_0xb0e9('0x47')](_0xb0e9('0xac'),squel[_0xb0e9('0x82')]()[_0xb0e9('0x83')](_0xb0e9('0xaf'))[_0xb0e9('0x85')](_0xb0e9('0xb0'))[_0xb0e9('0x47')](_0xb0e9('0x88'),_0x1f43ca[_0xb0e9('0x4d')]['id'][_0xb0e9('0x8b')]())))[_0xb0e9('0x8b')]();break;case _0xb0e9('0xb1'):_0x20f18d=squel['insert']()[_0xb0e9('0xb2')](_0xb0e9('0xb0'))[_0xb0e9('0xa2')]([_0xb0e9('0xa3'),_0xb0e9('0xa4'),_0xb0e9('0xa6'),_0xb0e9('0xa8'),_0xb0e9('0x62'),_0xb0e9('0x5c'),'updatedAt'],squel['select']()['field'](_0xb0e9('0xa3'),_0xb0e9('0xa3'))[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0xa4'))['field']('id',_0xb0e9('0xa6'))['field'](_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')](),_0xb0e9('0xa8'))[_0xb0e9('0x83')](_0x1f43ca['params']['id']['toString'](),_0xb0e9('0x62'))['field'](_0xb0e9('0xa5'),'createdAt')['field'](_0xb0e9('0xa5'),'updatedAt')['from'](_0xb0e9('0xa9'))[_0xb0e9('0x47')](_0xb0e9('0xaa'))[_0xb0e9('0x47')](_0xb0e9('0xb3'),_0xc3543c['CmListId'][_0xb0e9('0x8b')]())['where'](_0xb0e9('0xab'))[_0xb0e9('0x47')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xb0e9('0xaf'))[_0xb0e9('0x85')](_0xb0e9('0xb0'))[_0xb0e9('0x47')](_0xb0e9('0x88'),_0x1f43ca['params']['id']['toString']())))[_0xb0e9('0x8b')]();break;default:_0x20f18d=squel['insert']()[_0xb0e9('0xb2')](_0xb0e9('0xb0'))[_0xb0e9('0xa2')]([_0xb0e9('0xa3'),_0xb0e9('0xa4'),_0xb0e9('0xa6'),_0xb0e9('0xa8'),'VoiceQueueId',_0xb0e9('0x5c'),'updatedAt'],squel[_0xb0e9('0x82')]()[_0xb0e9('0x83')]('phone',_0xb0e9('0xa3'))[_0xb0e9('0x83')]('NOW()','scheduledAt')[_0xb0e9('0x83')]('id','ContactId')[_0xb0e9('0x83')](_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')](),_0xb0e9('0xa8'))[_0xb0e9('0x83')](_0x1f43ca[_0xb0e9('0x4d')]['id'][_0xb0e9('0x8b')](),_0xb0e9('0x62'))['field'](_0xb0e9('0xa5'),_0xb0e9('0x5c'))[_0xb0e9('0x83')]('NOW()',_0xb0e9('0x5b'))[_0xb0e9('0x85')](_0xb0e9('0xa9'))['where'](_0xb0e9('0xaa'))['where'](_0xb0e9('0xb3'),_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')]())[_0xb0e9('0x47')](_0xb0e9('0xab')))[_0xb0e9('0x8b')]();}_0x4f6854[_0xb0e9('0x8a')](db[_0xb0e9('0x76')]['query'](_0x20f18d));}return BPromise['all'](_0x4f6854);}})[_0xb0e9('0x29')](function(){return _0x59bee3;})['then'](respondWithResult(_0x204954,null))['catch'](handleError(_0x204954,null));};exports[_0xb0e9('0xb4')]=function(_0x4fa908,_0x385bac,_0x218e6d){return db['VoiceQueue']['find']({'where':{'id':_0x4fa908['params']['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x385bac,null))[_0xb0e9('0x29')](function(_0x549088){if(_0x549088){return _0x549088[_0xb0e9('0xb4')](_0x4fa908[_0xb0e9('0x3d')][_0xb0e9('0x81')]);}})[_0xb0e9('0x29')](function(_0x74850d){if(_0x74850d){return db['CmHopper'][_0xb0e9('0x2a')]({'where':{'ListId':_0x4fa908[_0xb0e9('0x3d')]['ids'],'VoiceQueueId':_0x4fa908[_0xb0e9('0x4d')]['id']}})['then'](function(){return _0x74850d;});}})[_0xb0e9('0x29')](respondWithStatusCode(_0x385bac,null))['catch'](handleError(_0x385bac,null));};exports[_0xb0e9('0xb5')]=function(_0x261978,_0xf94b1b,_0x771707){var _0x630dde={};var _0x5cc9c0={};var _0x3269d6;var _0x4821fa;return db['VoiceQueue'][_0xb0e9('0x67')]({'where':{'id':_0x261978[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf94b1b,null))[_0xb0e9('0x29')](function(_0x3cd1c6){if(_0x3cd1c6){_0x3269d6=_0x3cd1c6;_0x5cc9c0[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db[_0xb0e9('0xb6')][_0xb0e9('0x3b')]);_0x5cc9c0[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x261978[_0xb0e9('0x3d')]);_0x5cc9c0[_0xb0e9('0x3e')]=_['intersection'](_0x5cc9c0['model'],_0x5cc9c0['query']);_0x630dde['attributes']=_[_0xb0e9('0x3f')](_0x5cc9c0[_0xb0e9('0x40')],qs['fields'](_0x261978['query'][_0xb0e9('0x41')]));_0x630dde['attributes']=_0x630dde[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x630dde[_0xb0e9('0x42')]:_0x5cc9c0['model'];_0x630dde[_0xb0e9('0x45')]=qs[_0xb0e9('0x46')](_0x261978['query']['sort']);_0x630dde[_0xb0e9('0x47')]=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x261978[_0xb0e9('0x3d')],_0x5cc9c0['filters']));if(_0x261978[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x630dde[_0xb0e9('0x47')]=_[_0xb0e9('0x49')](_0x630dde['where'],{'$or':_[_0xb0e9('0x31')](_0x630dde[_0xb0e9('0x42')],function(_0x1327d3){var _0x8b6dc6={};_0x8b6dc6[_0x1327d3]={'$like':'%'+_0x261978[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x8b6dc6;})});}_0x630dde=_[_0xb0e9('0x49')]({},_0x630dde,_0x261978[_0xb0e9('0x4a')]);return _0x3269d6[_0xb0e9('0xb5')](_0x630dde);}})[_0xb0e9('0x29')](function(_0x5019b0){if(_0x5019b0){_0x4821fa=_0x5019b0[_0xb0e9('0x43')];if(!_0x261978['query']['hasOwnProperty']('nolimit')){_0x630dde[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x261978[_0xb0e9('0x3d')]['limit']);_0x630dde['offset']=qs['offset'](_0x261978[_0xb0e9('0x3d')][_0xb0e9('0x22')]);}return _0x3269d6[_0xb0e9('0xb5')](_0x630dde);}})[_0xb0e9('0x29')](function(_0x26d382){if(_0x26d382){return _0x26d382?{'count':_0x4821fa,'rows':_0x26d382}:null;}})['then'](respondWithResult(_0xf94b1b,null))[_0xb0e9('0x4b')](handleError(_0xf94b1b,null));};exports[_0xb0e9('0xb7')]=function(_0x258e43,_0xd7d02,_0x20a52a){var _0x753c81,_0x2f82a2;return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0x258e43['params']['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0xd7d02,null))[_0xb0e9('0x29')](function(_0x45d752){if(_0x45d752){_0x2f82a2=_0x45d752;return _0x45d752[_0xb0e9('0xb7')](_0x258e43[_0xb0e9('0x53')][_0xb0e9('0x81')],_[_0xb0e9('0x5a')](_0x258e43[_0xb0e9('0x53')],['ids','id'])||{});}return null;})[_0xb0e9('0x97')](function(_0x528f21){var _0x3d2096;_0x753c81=_0x528f21||[];var _0x4ddc6c=[];if(_0x528f21){for(var _0x5dfc79=0x0;_0x5dfc79<_0x528f21['length'];_0x5dfc79+=0x1){var _0x1bc2cd=_0x528f21[_0x5dfc79][_0xb0e9('0x2b')]({'plain':!![]});_0x3d2096=squel['insert']()[_0xb0e9('0xb2')](_0xb0e9('0xb8'))['fromQuery']([_0xb0e9('0xa3'),_0xb0e9('0xa6'),_0xb0e9('0xa8'),'VoiceQueueId',_0xb0e9('0x5c'),_0xb0e9('0x5b')],squel[_0xb0e9('0x82')]()[_0xb0e9('0x83')](_0xb0e9('0xa3'),_0xb0e9('0xa3'))['field']('id','ContactId')['field'](_0x1bc2cd['CmListId'][_0xb0e9('0x8b')](),_0xb0e9('0xa8'))[_0xb0e9('0x83')](_0x258e43['params']['id'][_0xb0e9('0x8b')](),'VoiceQueueId')[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0x5c'))[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0x5b'))[_0xb0e9('0x85')](_0xb0e9('0xa9'))[_0xb0e9('0x47')](_0xb0e9('0xaa'))['where'](_0xb0e9('0xb3'),_0x1bc2cd[_0xb0e9('0xa7')][_0xb0e9('0x8b')]())['where'](_0xb0e9('0xab')))[_0xb0e9('0x8b')]();_0x4ddc6c[_0xb0e9('0x8a')](db[_0xb0e9('0x76')][_0xb0e9('0x3d')](_0x3d2096));}return BPromise['all'](_0x4ddc6c);}})['then'](function(){return _0x753c81;})[_0xb0e9('0x29')](respondWithResult(_0xd7d02,null))['catch'](handleError(_0xd7d02,null));};exports[_0xb0e9('0xb9')]=function(_0x3b37a0,_0x1e8d20,_0x7d596e){return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0x3b37a0[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x1e8d20,null))['then'](function(_0x1d21a0){if(_0x1d21a0){return _0x1d21a0[_0xb0e9('0xb9')](_0x3b37a0[_0xb0e9('0x3d')][_0xb0e9('0x81')]);}})[_0xb0e9('0x29')](function(_0x5dc41a){if(_0x5dc41a){return db[_0xb0e9('0x6c')]['destroy']({'where':{'ListId':_0x3b37a0[_0xb0e9('0x3d')][_0xb0e9('0x81')],'VoiceQueueId':_0x3b37a0[_0xb0e9('0x4d')]['id']}})['then'](function(){return _0x5dc41a;});}})[_0xb0e9('0x29')](respondWithStatusCode(_0x1e8d20,null))[_0xb0e9('0x4b')](handleError(_0x1e8d20,null));}; \ No newline at end of file +var _0x2689=['fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','sendStatus','stack','name','send','VoiceQueue','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','role','userProfileId','findOne','CmHopper','nolimit','pick','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','online','voicePause','Agents','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','all','compact','removeAgents','userVoiceQueue:remove','addAgents','push','isArray','getAgents','getMembers','CmList','getLists','addLists','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','onlyIfOpen','insert','createdAt','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0x429d83,_0x988373){var _0x206410=function(_0x5e0067){while(--_0x5e0067){_0x429d83['push'](_0x429d83['shift']());}};_0x206410(++_0x988373);}(_0x2689,0xae));var _0x9268=function(_0xaae8e8,_0x35aa5c){_0xaae8e8=_0xaae8e8-0x0;var _0xcff5cf=_0x2689[_0xaae8e8];return _0xcff5cf;};'use strict';var emlformat=require(_0x9268('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9268('0x1'));var jsonpatch=require(_0x9268('0x2'));var rp=require(_0x9268('0x3'));var moment=require(_0x9268('0x4'));var BPromise=require(_0x9268('0x5'));var Mustache=require('mustache');var util=require(_0x9268('0x6'));var path=require(_0x9268('0x7'));var sox=require('sox');var csv=require(_0x9268('0x8'));var ejs=require(_0x9268('0x9'));var fs=require('fs');var fs_extra=require(_0x9268('0xa'));var _=require('lodash');var squel=require(_0x9268('0xb'));var crypto=require(_0x9268('0xc'));var jsforce=require(_0x9268('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9268('0x8'));var querystring=require(_0x9268('0xe'));var Papa=require(_0x9268('0xf'));var Redis=require(_0x9268('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9268('0x11'));var hardwareService=require(_0x9268('0x12'));var logger=require(_0x9268('0x13'))('api');var utils=require(_0x9268('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9268('0x15'));var db=require(_0x9268('0x16'))['db'];config['redis']=_[_0x9268('0x17')](config[_0x9268('0x18')],{'host':_0x9268('0x19'),'port':0x18eb});var socket=require(_0x9268('0x1a'))(new Redis(config['redis']));require(_0x9268('0x1b'))[_0x9268('0x1c')](socket);function respondWithStatusCode(_0x46136f,_0xdef076){_0xdef076=_0xdef076||0xcc;return function(_0x4c0c9d){if(_0x4c0c9d){return _0x46136f['sendStatus'](_0xdef076);}return _0x46136f[_0x9268('0x1d')](_0xdef076)[_0x9268('0x1e')]();};}function respondWithResult(_0x3293cd,_0x2bb201){_0x2bb201=_0x2bb201||0xc8;return function(_0x3d03e2){if(_0x3d03e2){return _0x3293cd['status'](_0x2bb201)[_0x9268('0x1f')](_0x3d03e2);}};}function respondWithFilteredResult(_0x4b65df,_0xa56f11){return function(_0x12f5d3){if(_0x12f5d3){var _0x13ddb9=typeof _0xa56f11[_0x9268('0x20')]==='undefined'&&typeof _0xa56f11['limit']===_0x9268('0x21');var _0x14588f=_0x12f5d3[_0x9268('0x22')];var _0x508a9c=_0x13ddb9?0x0:_0xa56f11[_0x9268('0x20')];var _0x40b1e0=_0x13ddb9?_0x12f5d3[_0x9268('0x22')]:_0xa56f11[_0x9268('0x20')]+_0xa56f11[_0x9268('0x23')];var _0x363962;if(_0x40b1e0>=_0x14588f){_0x40b1e0=_0x14588f;_0x363962=0xc8;}else{_0x363962=0xce;}_0x4b65df[_0x9268('0x1d')](_0x363962);return _0x4b65df[_0x9268('0x24')](_0x9268('0x25'),_0x508a9c+'-'+_0x40b1e0+'/'+_0x14588f)[_0x9268('0x1f')](_0x12f5d3);}return null;};}function patchUpdates(_0x4a7596){return function(_0x100ddb){try{jsonpatch[_0x9268('0x26')](_0x100ddb,_0x4a7596,!![]);}catch(_0x2d0b64){return BPromise[_0x9268('0x27')](_0x2d0b64);}return _0x100ddb[_0x9268('0x28')]();};}function saveUpdates(_0x5cbb17,_0x589dfe){return function(_0x59628a){if(_0x59628a){return _0x59628a[_0x9268('0x29')](_0x5cbb17)[_0x9268('0x2a')](function(_0x224d43){return _0x224d43;});}return null;};}function removeEntity(_0x35702f,_0x1b5f88){return function(_0x461675){if(_0x461675){return _0x461675[_0x9268('0x2b')]()[_0x9268('0x2a')](function(){var _0x267ce6=_0x461675['get']({'plain':!![]});var _0x5610a2=[{'name':_0x9268('0x2c'),'value':_0x9268('0x2d'),'ignore':![]},{'name':_0x9268('0x2e'),'value':_0x9268('0x2f'),'ignore':![]}];var _0x1d75d3=_(_0x5610a2)[_0x9268('0x30')](_0x9268('0x31'))[_0x9268('0x32')](_0x9268('0x33'))[_0x9268('0x33')]();if(_[_0x9268('0x34')](_0x1d75d3,_0x267ce6[_0x9268('0x35')])){return;}var _0x31fdb8=_[_0x9268('0x36')](_0x5610a2,[_0x9268('0x33'),_0x267ce6[_0x9268('0x35')]])['name'];return db[_0x9268('0x37')][_0x9268('0x2b')]({'where':{'type':_0x31fdb8,'resourceId':_0x267ce6['id']}})['then'](function(){return _0x461675;});})[_0x9268('0x2a')](function(){_0x35702f[_0x9268('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf0ecaf,_0x223884){return function(_0x227bbf){if(!_0x227bbf){_0xf0ecaf[_0x9268('0x38')](0x194);}return _0x227bbf;};}function handleError(_0x46f752,_0xd7b03a){_0xd7b03a=_0xd7b03a||0x1f4;return function(_0x22b130){logger['error'](_0x22b130[_0x9268('0x39')]);if(_0x22b130[_0x9268('0x3a')]){delete _0x22b130[_0x9268('0x3a')];}_0x46f752['status'](_0xd7b03a)[_0x9268('0x3b')](_0x22b130);};}exports['index']=function(_0x4deb36,_0x5c138e){var _0x1dd4da={},_0x5beccd={},_0x397201={'count':0x0,'rows':[]};var _0x157998=_['map'](db[_0x9268('0x3c')][_0x9268('0x3d')],function(_0x1df408){return{'name':_0x1df408[_0x9268('0x3e')],'type':_0x1df408[_0x9268('0x35')][_0x9268('0x3f')]};});_0x5beccd[_0x9268('0x40')]=_['map'](_0x157998,'name');_0x5beccd['query']=_['keys'](_0x4deb36[_0x9268('0x41')]);_0x5beccd['filters']=_['intersection'](_0x5beccd['model'],_0x5beccd['query']);_0x1dd4da[_0x9268('0x42')]=_[_0x9268('0x43')](_0x5beccd[_0x9268('0x40')],qs[_0x9268('0x44')](_0x4deb36[_0x9268('0x41')][_0x9268('0x44')]));_0x1dd4da[_0x9268('0x42')]=_0x1dd4da[_0x9268('0x42')][_0x9268('0x45')]?_0x1dd4da[_0x9268('0x42')]:_0x5beccd['model'];if(!_0x4deb36[_0x9268('0x41')][_0x9268('0x46')]('nolimit')){_0x1dd4da[_0x9268('0x23')]=qs[_0x9268('0x23')](_0x4deb36['query']['limit']);_0x1dd4da[_0x9268('0x20')]=qs[_0x9268('0x20')](_0x4deb36[_0x9268('0x41')][_0x9268('0x20')]);}_0x1dd4da[_0x9268('0x47')]=qs[_0x9268('0x48')](_0x4deb36[_0x9268('0x41')][_0x9268('0x48')]);_0x1dd4da['where']=qs['filters'](_['pick'](_0x4deb36[_0x9268('0x41')],_0x5beccd[_0x9268('0x49')]),_0x157998);if(_0x4deb36[_0x9268('0x41')][_0x9268('0x30')]){_0x1dd4da[_0x9268('0x4a')]=_[_0x9268('0x4b')](_0x1dd4da['where'],{'$or':_[_0x9268('0x32')](_0x157998,function(_0x6cd13d){if(_0x6cd13d['type']!==_0x9268('0x4c')){var _0x156f23={};_0x156f23[_0x6cd13d['name']]={'$like':'%'+_0x4deb36[_0x9268('0x41')][_0x9268('0x30')]+'%'};return _0x156f23;}})});}_0x1dd4da=_[_0x9268('0x4b')]({},_0x1dd4da,_0x4deb36[_0x9268('0x4d')]);var _0x1ed1e7={'where':_0x1dd4da[_0x9268('0x4a')]};return db[_0x9268('0x3c')]['count'](_0x1ed1e7)['then'](function(_0x23bafe){_0x397201[_0x9268('0x22')]=_0x23bafe;if(_0x4deb36[_0x9268('0x41')][_0x9268('0x4e')]){_0x1dd4da['include']=[{'all':!![]}];}return db[_0x9268('0x3c')]['findAll'](_0x1dd4da);})['then'](function(_0xf43496){_0x397201[_0x9268('0x4f')]=_0xf43496;return _0x397201;})[_0x9268('0x2a')](respondWithFilteredResult(_0x5c138e,_0x1dd4da))[_0x9268('0x50')](handleError(_0x5c138e,null));};exports[_0x9268('0x51')]=function(_0x543df1,_0x58ebd8){var _0x11932b={'raw':![],'where':{'id':_0x543df1[_0x9268('0x52')]['id']}},_0x355087={};_0x355087[_0x9268('0x40')]=_[_0x9268('0x53')](db[_0x9268('0x3c')]['rawAttributes']);_0x355087[_0x9268('0x41')]=_[_0x9268('0x53')](_0x543df1[_0x9268('0x41')]);_0x355087[_0x9268('0x49')]=_[_0x9268('0x43')](_0x355087[_0x9268('0x40')],_0x355087[_0x9268('0x41')]);_0x11932b[_0x9268('0x42')]=_['intersection'](_0x355087[_0x9268('0x40')],qs[_0x9268('0x44')](_0x543df1['query'][_0x9268('0x44')]));_0x11932b[_0x9268('0x42')]=_0x11932b[_0x9268('0x42')][_0x9268('0x45')]?_0x11932b[_0x9268('0x42')]:_0x355087[_0x9268('0x40')];if(_0x543df1['query'][_0x9268('0x4e')]){_0x11932b[_0x9268('0x54')]=[{'all':!![]}];}_0x11932b=_[_0x9268('0x4b')]({},_0x11932b,_0x543df1[_0x9268('0x4d')]);return db[_0x9268('0x3c')][_0x9268('0x36')](_0x11932b)['then'](handleEntityNotFound(_0x58ebd8,null))['then'](respondWithResult(_0x58ebd8,null))[_0x9268('0x50')](handleError(_0x58ebd8,null));};exports['create']=function(_0x56f846,_0x30789a){return db['VoiceQueue'][_0x9268('0x55')](_0x56f846['body'],{})[_0x9268('0x2a')](function(_0x28b240){var _0xf097d7=_0x56f846['user'][_0x9268('0x56')]({'plain':!![]});if(!_0xf097d7)throw new Error(_0x9268('0x57'));if(_0xf097d7['role']===_0x9268('0x58')){var _0x19f526=_0x28b240[_0x9268('0x56')]({'plain':!![]});var _0x329482=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x9268('0x2e'),'value':_0x9268('0x2f')}];var _0x5c1264=_[_0x9268('0x36')](_0x329482,[_0x9268('0x33'),_0x19f526[_0x9268('0x35')]])[_0x9268('0x3a')];return db[_0x9268('0x59')][_0x9268('0x36')]({'where':{'name':_0x5c1264,'userProfileId':_0xf097d7['userProfileId']},'raw':!![]})[_0x9268('0x2a')](function(_0x171d3b){if(_0x171d3b&&_0x171d3b['autoAssociation']===0x0){return db[_0x9268('0x37')]['create']({'name':_0x19f526[_0x9268('0x3a')],'resourceId':_0x19f526['id'],'type':_0x171d3b[_0x9268('0x3a')],'sectionId':_0x171d3b['id']},{})[_0x9268('0x2a')](function(){return _0x28b240;});}else{return _0x28b240;}})[_0x9268('0x50')](function(_0x298933){logger[_0x9268('0x5a')](_0x9268('0x5b'),_0x298933);throw _0x298933;});}return _0x28b240;})['then'](respondWithResult(_0x30789a,0xc9))['catch'](handleError(_0x30789a,null));};exports[_0x9268('0x5c')]=function(_0x225e4e,_0x4acf0a){var _0x41f407={'where':{'id':_0x225e4e[_0x9268('0x52')]['id']}},_0x4dcf20={};_0x4dcf20[_0x9268('0x40')]=_[_0x9268('0x53')](db[_0x9268('0x3c')][_0x9268('0x3d')]);_0x41f407['attributes']=_[_0x9268('0x43')](_0x4dcf20[_0x9268('0x40')],qs[_0x9268('0x44')](_0x225e4e[_0x9268('0x41')][_0x9268('0x44')]));_0x41f407['attributes']=_0x41f407['attributes'][_0x9268('0x45')]?_0x41f407[_0x9268('0x42')]:_0x4dcf20[_0x9268('0x40')];if(_0x225e4e[_0x9268('0x41')][_0x9268('0x4e')]){_0x41f407['include']=[{'all':!![]}];}_0x41f407=_[_0x9268('0x4b')]({},_0x41f407,_0x225e4e[_0x9268('0x4d')]);return db['VoiceQueue'][_0x9268('0x36')](_0x41f407)[_0x9268('0x2a')](handleEntityNotFound(_0x4acf0a,null))[_0x9268('0x2a')](function(_0x4f5e13){if(_0x4f5e13){var _0x5abc75=_0x4f5e13[_0x9268('0x56')]({'plain':!![]});_0x5abc75=qs['omit'](_0x5abc75,['id','createdAt',_0x9268('0x5d')]);_0x225e4e[_0x9268('0x5e')]=_[_0x9268('0x5f')](_0x225e4e[_0x9268('0x5e')],['id','createdAt',_0x9268('0x5d')]);return db[_0x9268('0x3c')]['create'](_[_0x9268('0x4b')](_0x5abc75,_0x225e4e[_0x9268('0x5e')]),{'include':_0x225e4e['query'][_0x9268('0x4e')]?[{'all':!![]}]:undefined})[_0x9268('0x2a')](function(_0x28f240){var _0x268606=_0x225e4e[_0x9268('0x58')][_0x9268('0x56')]({'plain':!![]});if(!_0x268606)throw new Error(_0x9268('0x57'));if(_0x268606[_0x9268('0x60')]===_0x9268('0x58')){var _0x12ffb8=_0x28f240[_0x9268('0x56')]({'plain':!![]});var _0x45c081=[{'name':_0x9268('0x2c'),'value':_0x9268('0x2d')},{'name':_0x9268('0x2e'),'value':_0x9268('0x2f')}];var _0x291328=_[_0x9268('0x36')](_0x45c081,['value',_0x12ffb8[_0x9268('0x35')]])[_0x9268('0x3a')];return db[_0x9268('0x59')][_0x9268('0x36')]({'where':{'name':_0x291328,'userProfileId':_0x268606[_0x9268('0x61')]},'raw':!![]})[_0x9268('0x2a')](function(_0x142cc9){if(_0x142cc9&&_0x142cc9['autoAssociation']===0x0){return db[_0x9268('0x37')]['create']({'name':_0x12ffb8[_0x9268('0x3a')],'resourceId':_0x12ffb8['id'],'type':_0x142cc9[_0x9268('0x3a')],'sectionId':_0x142cc9['id']},{})[_0x9268('0x2a')](function(){return _0x28f240;});}else{return _0x28f240;}})['catch'](function(_0x5f0beb){logger['error'](_0x9268('0x5b'),_0x5f0beb);throw _0x5f0beb;});}return _0x28f240;});}})['then'](respondWithResult(_0x4acf0a,0xc9))[_0x9268('0x50')](handleError(_0x4acf0a,null));};exports['update']=function(_0x26712b,_0x459bda){if(_0x26712b[_0x9268('0x5e')]['id']){delete _0x26712b['body']['id'];}return db[_0x9268('0x3c')][_0x9268('0x36')]({'where':{'id':_0x26712b[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x459bda,null))[_0x9268('0x2a')](saveUpdates(_0x26712b[_0x9268('0x5e')],null))[_0x9268('0x2a')](respondWithResult(_0x459bda,null))[_0x9268('0x50')](handleError(_0x459bda,null));};exports[_0x9268('0x2b')]=function(_0x5baf94,_0x5c5797){return db[_0x9268('0x3c')][_0x9268('0x36')]({'where':{'id':_0x5baf94[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x5c5797,null))[_0x9268('0x2a')](removeEntity(_0x5c5797,null))[_0x9268('0x50')](handleError(_0x5c5797,null));};exports['getHoppers']=function(_0x70a079,_0x3d6833,_0x409093){var _0x31435f={'raw':![],'where':{}};var _0x18848b={};var _0x4db4aa={'count':0x0,'rows':[]};return db[_0x9268('0x3c')][_0x9268('0x62')]({'where':{'id':_0x70a079['params']['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x3d6833,null))['then'](function(_0x1977ad){if(_0x1977ad){_0x18848b['model']=_[_0x9268('0x53')](db[_0x9268('0x63')][_0x9268('0x3d')]);_0x18848b[_0x9268('0x41')]=_[_0x9268('0x53')](_0x70a079[_0x9268('0x41')]);_0x18848b['filters']=_[_0x9268('0x43')](_0x18848b['model'],_0x18848b[_0x9268('0x41')]);_0x31435f[_0x9268('0x42')]=_['intersection'](_0x18848b[_0x9268('0x40')],qs['fields'](_0x70a079[_0x9268('0x41')][_0x9268('0x44')]));_0x31435f[_0x9268('0x42')]=_0x31435f[_0x9268('0x42')][_0x9268('0x45')]?_0x31435f[_0x9268('0x42')]:_0x18848b[_0x9268('0x40')];if(!_0x70a079[_0x9268('0x41')][_0x9268('0x46')](_0x9268('0x64'))){_0x31435f[_0x9268('0x23')]=qs[_0x9268('0x23')](_0x70a079[_0x9268('0x41')]['limit']);_0x31435f['offset']=qs[_0x9268('0x20')](_0x70a079[_0x9268('0x41')]['offset']);}_0x31435f[_0x9268('0x47')]=qs['sort'](_0x70a079[_0x9268('0x41')][_0x9268('0x48')]);_0x31435f[_0x9268('0x4a')]=qs[_0x9268('0x49')](_[_0x9268('0x65')](_0x70a079['query'],_0x18848b['filters']));_0x31435f[_0x9268('0x4a')][_0x9268('0x66')]=_0x1977ad['id'];if(_0x70a079[_0x9268('0x41')][_0x9268('0x30')]){_0x31435f['where']=_[_0x9268('0x4b')](_0x31435f[_0x9268('0x4a')],{'$or':_[_0x9268('0x32')](_0x31435f[_0x9268('0x42')],function(_0x59a753){var _0x5179f2={};_0x5179f2[_0x59a753]={'$like':'%'+_0x70a079[_0x9268('0x41')]['filter']+'%'};return _0x5179f2;})});}_0x31435f=_[_0x9268('0x4b')]({},_0x31435f,_0x70a079[_0x9268('0x4d')]);return db[_0x9268('0x63')]['count']({'where':_0x31435f[_0x9268('0x4a')]})['then'](function(_0xa047dd){_0x4db4aa[_0x9268('0x22')]=_0xa047dd;if(_0x70a079[_0x9268('0x41')]['includeAll']){_0x31435f[_0x9268('0x54')]=[{'all':!![]}];}return db['CmHopper'][_0x9268('0x67')](_0x31435f);})[_0x9268('0x2a')](function(_0x3f1d1f){_0x4db4aa[_0x9268('0x4f')]=_0x3f1d1f;return _0x4db4aa;});}})['then'](respondWithFilteredResult(_0x3d6833,_0x31435f))['catch'](handleError(_0x3d6833,null));};exports[_0x9268('0x68')]=function(_0x11175d,_0x1924af,_0x59a92b){var _0x377328={'raw':!![],'where':{}};var _0x32ca4e={};var _0x267d35={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9268('0x62')]({'where':{'id':_0x11175d[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x1924af,null))[_0x9268('0x2a')](function(_0x5e1ecb){if(_0x5e1ecb){_0x32ca4e[_0x9268('0x40')]=_['keys'](db[_0x9268('0x69')]['rawAttributes']);_0x32ca4e[_0x9268('0x41')]=_[_0x9268('0x53')](_0x11175d[_0x9268('0x41')]);_0x32ca4e[_0x9268('0x49')]=_['intersection'](_0x32ca4e[_0x9268('0x40')],_0x32ca4e[_0x9268('0x41')]);_0x377328[_0x9268('0x42')]=_['intersection'](_0x32ca4e[_0x9268('0x40')],qs[_0x9268('0x44')](_0x11175d['query'][_0x9268('0x44')]));_0x377328[_0x9268('0x42')]=_0x377328[_0x9268('0x42')][_0x9268('0x45')]?_0x377328[_0x9268('0x42')]:_0x32ca4e[_0x9268('0x40')];if(!_0x11175d[_0x9268('0x41')]['hasOwnProperty'](_0x9268('0x64'))){_0x377328[_0x9268('0x23')]=qs['limit'](_0x11175d[_0x9268('0x41')][_0x9268('0x23')]);_0x377328[_0x9268('0x20')]=qs[_0x9268('0x20')](_0x11175d['query'][_0x9268('0x20')]);}_0x377328[_0x9268('0x47')]=qs[_0x9268('0x48')](_0x11175d[_0x9268('0x41')][_0x9268('0x48')]);_0x377328['where']=qs['filters'](_[_0x9268('0x65')](_0x11175d[_0x9268('0x41')],_0x32ca4e[_0x9268('0x49')]));_0x377328[_0x9268('0x4a')]['VoiceQueueId']=_0x5e1ecb['id'];if(_0x11175d['query'][_0x9268('0x30')]){_0x377328[_0x9268('0x4a')]=_['merge'](_0x377328[_0x9268('0x4a')],{'$or':_['map'](_0x377328[_0x9268('0x42')],function(_0x5c4828){var _0x48e65f={};_0x48e65f[_0x5c4828]={'$like':'%'+_0x11175d[_0x9268('0x41')]['filter']+'%'};return _0x48e65f;})});}_0x377328=_[_0x9268('0x4b')]({},_0x377328,_0x11175d[_0x9268('0x4d')]);return db[_0x9268('0x69')]['count']({'where':_0x377328[_0x9268('0x4a')]})[_0x9268('0x2a')](function(_0x2297b6){_0x267d35[_0x9268('0x22')]=_0x2297b6;if(_0x11175d['query'][_0x9268('0x4e')]){_0x377328['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x9268('0x67')](_0x377328);})[_0x9268('0x2a')](function(_0x1ab881){_0x267d35[_0x9268('0x4f')]=_0x1ab881;return _0x267d35;});}})[_0x9268('0x2a')](respondWithFilteredResult(_0x1924af,_0x377328))[_0x9268('0x50')](handleError(_0x1924af,null));};exports[_0x9268('0x6a')]=function(_0x55beec,_0x34587d,_0x493c01){var _0x1347ef={'raw':!![],'where':{}};var _0x2bcefe={};var _0x36a99e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9268('0x62')]({'where':{'id':_0x55beec['params']['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x34587d,null))['then'](function(_0x2b0fd5){if(_0x2b0fd5){_0x2bcefe[_0x9268('0x40')]=_[_0x9268('0x53')](db['CmHopperFinal'][_0x9268('0x3d')]);_0x2bcefe[_0x9268('0x41')]=_['keys'](_0x55beec[_0x9268('0x41')]);_0x2bcefe[_0x9268('0x49')]=_['intersection'](_0x2bcefe['model'],_0x2bcefe[_0x9268('0x41')]);_0x1347ef['attributes']=_[_0x9268('0x43')](_0x2bcefe[_0x9268('0x40')],qs[_0x9268('0x44')](_0x55beec[_0x9268('0x41')][_0x9268('0x44')]));_0x1347ef['attributes']=_0x1347ef[_0x9268('0x42')][_0x9268('0x45')]?_0x1347ef[_0x9268('0x42')]:_0x2bcefe[_0x9268('0x40')];if(!_0x55beec[_0x9268('0x41')][_0x9268('0x46')]('nolimit')){_0x1347ef[_0x9268('0x23')]=qs[_0x9268('0x23')](_0x55beec[_0x9268('0x41')][_0x9268('0x23')]);_0x1347ef[_0x9268('0x20')]=qs['offset'](_0x55beec[_0x9268('0x41')][_0x9268('0x20')]);}_0x1347ef[_0x9268('0x47')]=qs['sort'](_0x55beec[_0x9268('0x41')][_0x9268('0x48')]);_0x1347ef['where']=qs['filters'](_['pick'](_0x55beec[_0x9268('0x41')],_0x2bcefe[_0x9268('0x49')]));_0x1347ef['where'][_0x9268('0x66')]=_0x2b0fd5['id'];if(_0x55beec[_0x9268('0x41')][_0x9268('0x30')]){_0x1347ef[_0x9268('0x4a')]=_['merge'](_0x1347ef['where'],{'$or':_[_0x9268('0x32')](_0x1347ef[_0x9268('0x42')],function(_0x5ad154){var _0x237d30={};_0x237d30[_0x5ad154]={'$like':'%'+_0x55beec[_0x9268('0x41')][_0x9268('0x30')]+'%'};return _0x237d30;})});}_0x1347ef=_[_0x9268('0x4b')]({},_0x1347ef,_0x55beec[_0x9268('0x4d')]);return db['CmHopperFinal'][_0x9268('0x22')]({'where':_0x1347ef[_0x9268('0x4a')]})[_0x9268('0x2a')](function(_0x19a919){_0x36a99e[_0x9268('0x22')]=_0x19a919;if(_0x55beec[_0x9268('0x41')]['includeAll']){_0x1347ef[_0x9268('0x54')]=[{'all':!![]}];}return db[_0x9268('0x6b')][_0x9268('0x67')](_0x1347ef);})[_0x9268('0x2a')](function(_0x24e02f){_0x36a99e[_0x9268('0x4f')]=_0x24e02f;return _0x36a99e;});}})[_0x9268('0x2a')](respondWithFilteredResult(_0x34587d,_0x1347ef))[_0x9268('0x50')](handleError(_0x34587d,null));};exports[_0x9268('0x6c')]=function(_0x31b01a,_0xa9b44c,_0x5e69f6){var _0x40cefe={'raw':!![],'where':{}};var _0x136261={};var _0x1ed862={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9268('0x62')]({'where':{'id':_0x31b01a[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0xa9b44c,null))[_0x9268('0x2a')](function(_0x14fcff){if(_0x14fcff){_0x136261[_0x9268('0x40')]=_[_0x9268('0x53')](db['CmHopperBlack'][_0x9268('0x3d')]);_0x136261[_0x9268('0x41')]=_[_0x9268('0x53')](_0x31b01a[_0x9268('0x41')]);_0x136261[_0x9268('0x49')]=_[_0x9268('0x43')](_0x136261[_0x9268('0x40')],_0x136261['query']);_0x40cefe[_0x9268('0x42')]=_[_0x9268('0x43')](_0x136261[_0x9268('0x40')],qs[_0x9268('0x44')](_0x31b01a[_0x9268('0x41')][_0x9268('0x44')]));_0x40cefe[_0x9268('0x42')]=_0x40cefe['attributes'][_0x9268('0x45')]?_0x40cefe[_0x9268('0x42')]:_0x136261[_0x9268('0x40')];if(!_0x31b01a[_0x9268('0x41')][_0x9268('0x46')](_0x9268('0x64'))){_0x40cefe[_0x9268('0x23')]=qs[_0x9268('0x23')](_0x31b01a[_0x9268('0x41')][_0x9268('0x23')]);_0x40cefe[_0x9268('0x20')]=qs['offset'](_0x31b01a[_0x9268('0x41')][_0x9268('0x20')]);}_0x40cefe['order']=qs[_0x9268('0x48')](_0x31b01a[_0x9268('0x41')]['sort']);_0x40cefe[_0x9268('0x4a')]=qs[_0x9268('0x49')](_['pick'](_0x31b01a[_0x9268('0x41')],_0x136261[_0x9268('0x49')]));_0x40cefe['where']['VoiceQueueId']=_0x14fcff['id'];if(_0x31b01a['query'][_0x9268('0x30')]){_0x40cefe[_0x9268('0x4a')]=_['merge'](_0x40cefe[_0x9268('0x4a')],{'$or':_['map'](_0x40cefe[_0x9268('0x42')],function(_0x4d603e){var _0x1347f8={};_0x1347f8[_0x4d603e]={'$like':'%'+_0x31b01a['query'][_0x9268('0x30')]+'%'};return _0x1347f8;})});}_0x40cefe=_[_0x9268('0x4b')]({},_0x40cefe,_0x31b01a[_0x9268('0x4d')]);return db[_0x9268('0x6d')]['count']({'where':_0x40cefe[_0x9268('0x4a')]})[_0x9268('0x2a')](function(_0x548fdd){_0x1ed862['count']=_0x548fdd;if(_0x31b01a[_0x9268('0x41')][_0x9268('0x4e')]){_0x40cefe[_0x9268('0x54')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9268('0x67')](_0x40cefe);})['then'](function(_0x4c5615){_0x1ed862[_0x9268('0x4f')]=_0x4c5615;return _0x1ed862;});}})[_0x9268('0x2a')](respondWithFilteredResult(_0xa9b44c,_0x40cefe))['catch'](handleError(_0xa9b44c,null));};exports[_0x9268('0x6e')]=function(_0x56bb57,_0x169847,_0x350474){var _0x230d9b={};var _0x304350={};var _0x24d4b4;var _0x2b37ba;return db[_0x9268('0x3c')]['findOne']({'where':{'id':_0x56bb57[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x169847,null))[_0x9268('0x2a')](function(_0x28174c){if(_0x28174c){_0x24d4b4=_0x28174c;_0x304350[_0x9268('0x40')]=_[_0x9268('0x53')](db[_0x9268('0x6f')][_0x9268('0x3d')]);_0x304350[_0x9268('0x41')]=_[_0x9268('0x53')](_0x56bb57[_0x9268('0x41')]);_0x304350['filters']=_['intersection'](_0x304350[_0x9268('0x40')],_0x304350[_0x9268('0x41')]);_0x230d9b[_0x9268('0x42')]=_[_0x9268('0x43')](_0x304350[_0x9268('0x40')],qs[_0x9268('0x44')](_0x56bb57[_0x9268('0x41')][_0x9268('0x44')]));_0x230d9b['attributes']=_0x230d9b[_0x9268('0x42')][_0x9268('0x45')]?_0x230d9b['attributes']:_0x304350['model'];_0x230d9b[_0x9268('0x47')]=qs[_0x9268('0x48')](_0x56bb57[_0x9268('0x41')][_0x9268('0x48')]);_0x230d9b[_0x9268('0x4a')]=qs[_0x9268('0x49')](_['pick'](_0x56bb57['query'],_0x304350[_0x9268('0x49')]));if(_0x56bb57[_0x9268('0x41')][_0x9268('0x30')]){_0x230d9b[_0x9268('0x4a')]=_[_0x9268('0x4b')](_0x230d9b['where'],{'$or':_[_0x9268('0x32')](_0x230d9b[_0x9268('0x42')],function(_0x2c790e){var _0x5f34c9={};_0x5f34c9[_0x2c790e]={'$like':'%'+_0x56bb57['query']['filter']+'%'};return _0x5f34c9;})});}_0x230d9b=_[_0x9268('0x4b')]({},_0x230d9b,_0x56bb57['options']);return _0x24d4b4[_0x9268('0x6e')](_0x230d9b);}})[_0x9268('0x2a')](function(_0x2a14b9){if(_0x2a14b9){_0x2b37ba=_0x2a14b9[_0x9268('0x45')];if(!_0x56bb57[_0x9268('0x41')][_0x9268('0x46')](_0x9268('0x64'))){_0x230d9b[_0x9268('0x23')]=qs[_0x9268('0x23')](_0x56bb57[_0x9268('0x41')][_0x9268('0x23')]);_0x230d9b['offset']=qs[_0x9268('0x20')](_0x56bb57['query']['offset']);}return _0x24d4b4[_0x9268('0x6e')](_0x230d9b);}})['then'](function(_0x382113){if(_0x382113){return _0x382113?{'count':_0x2b37ba,'rows':_0x382113}:null;}})['then'](respondWithResult(_0x169847,null))[_0x9268('0x50')](handleError(_0x169847,null));};exports['addTeams']=function(_0x30bcd3,_0x33ea21,_0xbc25b3){var _0x39eff7=_0x30bcd3[_0x9268('0x5e')][_0x9268('0x70')];var _0x820d02=_[_0x9268('0x32')](_0x39eff7,'id');return db[_0x9268('0x6f')][_0x9268('0x67')]({'where':{'id':_0x820d02},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x9268('0x3a'),_0x9268('0x71'),_0x9268('0x72'),'interface'],'raw':!![]}]})[_0x9268('0x2a')](function(_0x152c70){if(_0x152c70){var _0xcaef50=_['flatMap'](_0x152c70,function(_0x3c06e1){var _0x4dbcae=_0x3c06e1[_0x9268('0x56')]({'plain':!![]});_0x4dbcae[_0x9268('0x73')][_0x9268('0x74')](function(_0x4a863d){_0x4a863d[_0x9268('0x75')]=_[_0x9268('0x36')](_0x39eff7,{'id':_0x4dbcae['id']})[_0x9268('0x75')];});return _0x4dbcae[_0x9268('0x73')];});return db['VoiceQueue']['find']({'where':{'id':_0x30bcd3[_0x9268('0x52')]['id']}})['then'](function(_0x5b18bb){return db[_0x9268('0x76')][_0x9268('0x77')](function(_0x5a9fa8){return _0x5b18bb['addTeams'](_0x820d02,{'transaction':_0x5a9fa8})['then'](function(){return BPromise[_0x9268('0x78')](_0x39eff7,function(_0x251a8c){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x251a8c['id'],'VoiceQueueId':_0x30bcd3[_0x9268('0x52')]['id'],'penalty':_0x251a8c[_0x9268('0x75')]},{'transaction':_0x5a9fa8});});})[_0x9268('0x2a')](function(){return BPromise['each'](_0xcaef50,function(_0x40b09b){return db[_0x9268('0x79')]['findOrCreate']({'where':{'UserId':_0x40b09b['id'],'VoiceQueueId':_0x30bcd3[_0x9268('0x52')]['id']},'defaults':{'penalty':_0x40b09b['penalty']},'transaction':_0x5a9fa8});});})[_0x9268('0x2a')](function(){return BPromise[_0x9268('0x78')](_[_0x9268('0x30')](_0xcaef50,{'online':!![]}),function(_0x38f020){return db[_0x9268('0x7a')][_0x9268('0x7b')]({'membername':_0x38f020['name'],'UserId':_0x38f020['id'],'queue_name':_0x5b18bb[_0x9268('0x3a')],'VoiceQueueId':_0x5b18bb['id'],'interface':_[_0x9268('0x7c')](_0x38f020[_0x9268('0x7d')])?util[_0x9268('0x7e')](_0x9268('0x7f'),_0x38f020[_0x9268('0x3a')]):_0x38f020['interface'],'paused':_0x38f020[_0x9268('0x72')]||![],'penalty':_0x38f020[_0x9268('0x75')]},{'transaction':_0x5a9fa8});});})[_0x9268('0x2a')](function(){_0xcaef50['forEach'](function(_0x54ef3d){socket[_0x9268('0x80')](_0x9268('0x81'),{'UserId':_0x54ef3d['id'],'VoiceQueueId':_0x5b18bb['id']});});});});});}})[_0x9268('0x2a')](respondWithStatusCode(_0x33ea21,null))[_0x9268('0x50')](handleError(_0x33ea21,null));};exports[_0x9268('0x82')]=function(_0x1d72e8,_0x6096bc,_0x184e05){return db[_0x9268('0x6f')]['findAll']({'where':{'id':_0x1d72e8[_0x9268('0x41')][_0x9268('0x83')]},'attributes':['id'],'include':[{'model':db[_0x9268('0x84')],'as':_0x9268('0x73'),'attributes':['id'],'raw':!![]}]})[_0x9268('0x2a')](handleEntityNotFound(_0x6096bc,null))[_0x9268('0x2a')](function(_0x3f9214){var _0x4f1975=_[_0x9268('0x32')](_0x3f9214,'id');var _0x5675be=[];var _0x477497=[];var _0x55f6e6=squel[_0x9268('0x85')]();_0x55f6e6[_0x9268('0x86')](_0x9268('0x87'))[_0x9268('0x88')](_0x9268('0x89'),'tq')[_0x9268('0x8a')](_0x9268('0x8b'),'ut',_0x9268('0x8c'))['where'](_0x9268('0x8d'),_0x1d72e8[_0x9268('0x52')]['id']);for(var _0x5005c5=0x0;_0x5005c5<_0x3f9214['length'];_0x5005c5+=0x1){let _0x10c647=_0x3f9214[_0x5005c5];for(var _0x213117=0x0;_0x213117<_0x10c647[_0x9268('0x73')][_0x9268('0x45')];_0x213117+=0x1){let _0x5c9861=_0x10c647['Agents'][_0x213117];var _0x1a18db=_0x55f6e6['clone']();_0x1a18db['where'](_0x9268('0x8e'),_0x5c9861['id']);_0x477497['push'](db[_0x9268('0x76')][_0x9268('0x41')](_0x1a18db[_0x9268('0x8f')](),{'type':db[_0x9268('0x76')]['QueryTypes'][_0x9268('0x90')]})['then'](function(_0x1eef5c){if(_0x1eef5c[_0x9268('0x45')]===0x1){return _0x5c9861['id'];}else{var _0x4ac3f8=_[_0x9268('0x91')](_[_0x9268('0x32')](_0x1eef5c,'TeamId'),function(_0x1d4c58){return _[_0x9268('0x34')](_0x4f1975,_0x1d4c58);});if(_0x4ac3f8){return _0x5c9861['id'];}}}));}}return BPromise[_0x9268('0x92')](_0x477497)[_0x9268('0x2a')](function(_0x230802){_0x5675be=_(_0x5675be)['union'](_0x230802)[_0x9268('0x93')]()['value']();return db[_0x9268('0x3c')]['find']({'where':{'id':_0x1d72e8['params']['id']}})['then'](function(_0x295c48){return db[_0x9268('0x76')][_0x9268('0x77')](function(_0x8bfb39){return _0x295c48[_0x9268('0x82')](_0x1d72e8['query'][_0x9268('0x83')],{'transaction':_0x8bfb39})[_0x9268('0x2a')](function(){if(!_['isEmpty'](_0x5675be)){return _0x295c48[_0x9268('0x94')](_0x5675be,{'transaction':_0x8bfb39})['then'](function(){return db[_0x9268('0x7a')]['destroy']({'where':{'VoiceQueueId':_0x1d72e8[_0x9268('0x52')]['id'],'UserId':_0x5675be},'transaction':_0x8bfb39});});}})[_0x9268('0x2a')](function(){_0x5675be[_0x9268('0x74')](function(_0x582227){socket[_0x9268('0x80')](_0x9268('0x95'),{'UserId':_0x582227,'VoiceQueueId':_0x295c48['id']});});});});});});})[_0x9268('0x2a')](respondWithStatusCode(_0x6096bc,null))['catch'](handleError(_0x6096bc,null));};exports[_0x9268('0x96')]=function(_0x49646c,_0x19cd4a,_0x546be7){var _0x1092be,_0x4c8dd1;return db[_0x9268('0x3c')][_0x9268('0x36')]({'where':{'id':_0x49646c['params']['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x19cd4a,null))['then'](function(_0x359b32){if(_0x359b32){_0x4c8dd1=_0x359b32;return _0x359b32[_0x9268('0x96')](_0x49646c[_0x9268('0x5e')][_0x9268('0x83')],_['omit'](_0x49646c[_0x9268('0x5e')],[_0x9268('0x83'),'id'])||{})['spread'](function(_0x1a6624){for(var _0x412def=0x0;_0x412def<_0x49646c[_0x9268('0x5e')][_0x9268('0x83')][_0x9268('0x45')];_0x412def+=0x1){socket[_0x9268('0x80')]('userVoiceQueue:save',{'UserId':Number(_0x49646c['body'][_0x9268('0x83')][_0x412def]),'VoiceQueueId':Number(_0x49646c[_0x9268('0x52')]['id'])});}return _0x1a6624;});}})[_0x9268('0x2a')](function(_0x4850ba){_0x1092be=_0x4850ba||[];if(_0x4c8dd1){return db[_0x9268('0x84')]['findAll']({'where':{'id':_0x49646c['body']['ids']},'attributes':['id',_0x9268('0x3a'),_0x9268('0x71'),_0x9268('0x72'),'interface'],'raw':!![]});}})[_0x9268('0x2a')](function(_0x4b0b54){if(!_['isEmpty'](_0x4b0b54)){var _0x4c6a39=[];for(var _0x48a88b=0x0;_0x48a88b<_0x4b0b54['length'];_0x48a88b++){if(_0x4b0b54[_0x48a88b][_0x9268('0x71')]){_0x4c6a39[_0x9268('0x97')](db[_0x9268('0x7a')][_0x9268('0x7b')]({'membername':_0x4b0b54[_0x48a88b][_0x9268('0x3a')],'UserId':_0x4b0b54[_0x48a88b]['id'],'queue_name':_0x4c8dd1['name'],'VoiceQueueId':_0x4c8dd1['id'],'interface':_['isNil'](_0x4b0b54[_0x48a88b][_0x9268('0x7d')])?util[_0x9268('0x7e')](_0x9268('0x7f'),_0x4b0b54[_0x48a88b][_0x9268('0x3a')]):_0x4b0b54[_0x48a88b][_0x9268('0x7d')],'paused':_0x4b0b54[_0x48a88b][_0x9268('0x72')]||![],'penalty':_0x49646c[_0x9268('0x5e')][_0x9268('0x75')]||0x0}));}}return BPromise[_0x9268('0x92')](_0x4c6a39);}})[_0x9268('0x2a')](function(){return _0x1092be;})[_0x9268('0x2a')](respondWithResult(_0x19cd4a,null))['catch'](handleError(_0x19cd4a,null));};exports['removeAgents']=function(_0x21961f,_0x4a5d31,_0x23d661){return db[_0x9268('0x3c')][_0x9268('0x36')]({'where':{'id':_0x21961f[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x4a5d31,null))[_0x9268('0x2a')](function(_0x257009){if(_0x257009){return _0x257009[_0x9268('0x94')](_0x21961f[_0x9268('0x41')]['ids'])[_0x9268('0x2a')](function(){if(_[_0x9268('0x98')](_0x21961f[_0x9268('0x41')][_0x9268('0x83')])){for(var _0x1ae501=0x0;_0x1ae501<_0x21961f['query'][_0x9268('0x83')][_0x9268('0x45')];_0x1ae501+=0x1){socket['emit'](_0x9268('0x95'),{'UserId':Number(_0x21961f[_0x9268('0x41')][_0x9268('0x83')][_0x1ae501]),'VoiceQueueId':Number(_0x21961f[_0x9268('0x52')]['id'])});}}else{socket[_0x9268('0x80')]('userVoiceQueue:remove',{'UserId':Number(_0x21961f[_0x9268('0x41')]['ids']),'VoiceQueueId':Number(_0x21961f['params']['id'])});}});}})[_0x9268('0x2a')](function(_0x504bb6){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x21961f['params']['id'],'UserId':_0x21961f[_0x9268('0x41')][_0x9268('0x83')]}})[_0x9268('0x2a')](function(){return _0x504bb6;});})[_0x9268('0x2a')](respondWithStatusCode(_0x4a5d31,null))[_0x9268('0x50')](handleError(_0x4a5d31,null));};exports[_0x9268('0x99')]=function(_0x2062de,_0x3145dc,_0x227455){var _0x3cfaf0={};var _0x2dd42f={};var _0x403b05;var _0x3eea11;return db[_0x9268('0x3c')][_0x9268('0x62')]({'where':{'id':_0x2062de[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x3145dc,null))['then'](function(_0x274850){if(_0x274850){_0x403b05=_0x274850;_0x2dd42f['model']=_[_0x9268('0x53')](db[_0x9268('0x84')][_0x9268('0x3d')]);_0x2dd42f['query']=_['keys'](_0x2062de[_0x9268('0x41')]);_0x2dd42f['filters']=_[_0x9268('0x43')](_0x2dd42f[_0x9268('0x40')],_0x2dd42f[_0x9268('0x41')]);_0x3cfaf0[_0x9268('0x42')]=_[_0x9268('0x43')](_0x2dd42f[_0x9268('0x40')],qs[_0x9268('0x44')](_0x2062de[_0x9268('0x41')][_0x9268('0x44')]));_0x3cfaf0[_0x9268('0x42')]=_0x3cfaf0['attributes'][_0x9268('0x45')]?_0x3cfaf0[_0x9268('0x42')]:_0x2dd42f[_0x9268('0x40')];_0x3cfaf0['order']=qs[_0x9268('0x48')](_0x2062de[_0x9268('0x41')][_0x9268('0x48')]);_0x3cfaf0[_0x9268('0x4a')]=qs['filters'](_['pick'](_0x2062de[_0x9268('0x41')],_0x2dd42f[_0x9268('0x49')]));if(_0x2062de[_0x9268('0x41')]['filter']){_0x3cfaf0['where']=_[_0x9268('0x4b')](_0x3cfaf0['where'],{'$or':_['map'](_0x3cfaf0[_0x9268('0x42')],function(_0x29f4f8){var _0x183286={};_0x183286[_0x29f4f8]={'$like':'%'+_0x2062de['query'][_0x9268('0x30')]+'%'};return _0x183286;})});}_0x3cfaf0=_[_0x9268('0x4b')]({},_0x3cfaf0,_0x2062de[_0x9268('0x4d')]);return _0x403b05['getAgents'](_0x3cfaf0);}})[_0x9268('0x2a')](function(_0x3f1c80){if(_0x3f1c80){_0x3eea11=_0x3f1c80[_0x9268('0x45')];if(!_0x2062de[_0x9268('0x41')][_0x9268('0x46')]('nolimit')){_0x3cfaf0[_0x9268('0x23')]=qs[_0x9268('0x23')](_0x2062de[_0x9268('0x41')][_0x9268('0x23')]);_0x3cfaf0[_0x9268('0x20')]=qs[_0x9268('0x20')](_0x2062de[_0x9268('0x41')][_0x9268('0x20')]);}return _0x403b05['getAgents'](_0x3cfaf0);}})[_0x9268('0x2a')](function(_0x12afae){if(_0x12afae){return _0x12afae?{'count':_0x3eea11,'rows':_0x12afae}:null;}})[_0x9268('0x2a')](respondWithResult(_0x3145dc,null))[_0x9268('0x50')](handleError(_0x3145dc,null));};exports[_0x9268('0x9a')]=function(_0x5ce6d4,_0x4dca1c,_0x58e1ce){var _0x4e34dd={};var _0x2d5e5e={};var _0x38a419;var _0x5aa233;return db[_0x9268('0x3c')][_0x9268('0x62')]({'where':{'id':_0x5ce6d4[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x4dca1c,null))[_0x9268('0x2a')](function(_0x2b94f9){if(_0x2b94f9){_0x38a419=_0x2b94f9;_0x2d5e5e['model']=_[_0x9268('0x53')](db[_0x9268('0x7a')]['rawAttributes']);_0x2d5e5e[_0x9268('0x41')]=_[_0x9268('0x53')](_0x5ce6d4[_0x9268('0x41')]);_0x2d5e5e[_0x9268('0x49')]=_[_0x9268('0x43')](_0x2d5e5e['model'],_0x2d5e5e[_0x9268('0x41')]);_0x4e34dd['attributes']=_['intersection'](_0x2d5e5e[_0x9268('0x40')],qs[_0x9268('0x44')](_0x5ce6d4[_0x9268('0x41')][_0x9268('0x44')]));_0x4e34dd[_0x9268('0x42')]=_0x4e34dd[_0x9268('0x42')][_0x9268('0x45')]?_0x4e34dd[_0x9268('0x42')]:_0x2d5e5e[_0x9268('0x40')];_0x4e34dd['order']=qs[_0x9268('0x48')](_0x5ce6d4[_0x9268('0x41')][_0x9268('0x48')]);_0x4e34dd[_0x9268('0x4a')]=qs[_0x9268('0x49')](_['pick'](_0x5ce6d4[_0x9268('0x41')],_0x2d5e5e[_0x9268('0x49')]));if(_0x5ce6d4['query'][_0x9268('0x30')]){_0x4e34dd[_0x9268('0x4a')]=_[_0x9268('0x4b')](_0x4e34dd['where'],{'$or':_[_0x9268('0x32')](_0x4e34dd['attributes'],function(_0x4d2c6c){var _0x3bb016={};_0x3bb016[_0x4d2c6c]={'$like':'%'+_0x5ce6d4[_0x9268('0x41')][_0x9268('0x30')]+'%'};return _0x3bb016;})});}_0x4e34dd=_[_0x9268('0x4b')]({},_0x4e34dd,_0x5ce6d4[_0x9268('0x4d')]);return _0x38a419[_0x9268('0x9a')](_0x4e34dd);}})['then'](function(_0x53b5ab){if(_0x53b5ab){_0x5aa233=_0x53b5ab[_0x9268('0x45')];if(!_0x5ce6d4[_0x9268('0x41')][_0x9268('0x46')](_0x9268('0x64'))){_0x4e34dd[_0x9268('0x23')]=qs[_0x9268('0x23')](_0x5ce6d4[_0x9268('0x41')][_0x9268('0x23')]);_0x4e34dd[_0x9268('0x20')]=qs[_0x9268('0x20')](_0x5ce6d4[_0x9268('0x41')][_0x9268('0x20')]);}return _0x38a419[_0x9268('0x9a')](_0x4e34dd);}})[_0x9268('0x2a')](function(_0x50ea78){return _0x50ea78?{'count':_0x5aa233,'rows':_0x50ea78}:null;})[_0x9268('0x2a')](respondWithResult(_0x4dca1c,null))[_0x9268('0x50')](handleError(_0x4dca1c,null));};exports['getLists']=function(_0x5e8753,_0x3a1ef2,_0x18a139){var _0x14a23c={};var _0x42405e={};var _0x437218;var _0x40ad48;return db[_0x9268('0x3c')][_0x9268('0x62')]({'where':{'id':_0x5e8753['params']['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x3a1ef2,null))[_0x9268('0x2a')](function(_0x3a6aa5){if(_0x3a6aa5){_0x437218=_0x3a6aa5;_0x42405e[_0x9268('0x40')]=_[_0x9268('0x53')](db[_0x9268('0x9b')]['rawAttributes']);_0x42405e[_0x9268('0x41')]=_[_0x9268('0x53')](_0x5e8753[_0x9268('0x41')]);_0x42405e[_0x9268('0x49')]=_[_0x9268('0x43')](_0x42405e[_0x9268('0x40')],_0x42405e[_0x9268('0x41')]);_0x14a23c[_0x9268('0x42')]=_[_0x9268('0x43')](_0x42405e['model'],qs['fields'](_0x5e8753[_0x9268('0x41')][_0x9268('0x44')]));_0x14a23c[_0x9268('0x42')]=_0x14a23c[_0x9268('0x42')][_0x9268('0x45')]?_0x14a23c[_0x9268('0x42')]:_0x42405e[_0x9268('0x40')];_0x14a23c[_0x9268('0x47')]=qs['sort'](_0x5e8753['query'][_0x9268('0x48')]);_0x14a23c['where']=qs['filters'](_[_0x9268('0x65')](_0x5e8753['query'],_0x42405e[_0x9268('0x49')]));if(_0x5e8753[_0x9268('0x41')]['filter']){_0x14a23c[_0x9268('0x4a')]=_[_0x9268('0x4b')](_0x14a23c[_0x9268('0x4a')],{'$or':_['map'](_0x14a23c[_0x9268('0x42')],function(_0x10dafb){var _0x4dd656={};_0x4dd656[_0x10dafb]={'$like':'%'+_0x5e8753[_0x9268('0x41')][_0x9268('0x30')]+'%'};return _0x4dd656;})});}_0x14a23c=_[_0x9268('0x4b')]({},_0x14a23c,_0x5e8753[_0x9268('0x4d')]);return _0x437218[_0x9268('0x9c')](_0x14a23c);}})[_0x9268('0x2a')](function(_0x5b5c4b){if(_0x5b5c4b){_0x40ad48=_0x5b5c4b[_0x9268('0x45')];if(!_0x5e8753[_0x9268('0x41')][_0x9268('0x46')](_0x9268('0x64'))){_0x14a23c['limit']=qs[_0x9268('0x23')](_0x5e8753[_0x9268('0x41')][_0x9268('0x23')]);_0x14a23c[_0x9268('0x20')]=qs[_0x9268('0x20')](_0x5e8753['query'][_0x9268('0x20')]);}return _0x437218[_0x9268('0x9c')](_0x14a23c);}})[_0x9268('0x2a')](function(_0x80ebb3){if(_0x80ebb3){return _0x80ebb3?{'count':_0x40ad48,'rows':_0x80ebb3}:null;}})[_0x9268('0x2a')](respondWithResult(_0x3a1ef2,null))[_0x9268('0x50')](handleError(_0x3a1ef2,null));};exports[_0x9268('0x9d')]=function(_0x4ec6fd,_0x3d1d76,_0x556052){var _0x3172aa,_0x435251;return db[_0x9268('0x3c')][_0x9268('0x36')]({'where':{'id':_0x4ec6fd[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x3d1d76,null))['then'](function(_0x18df3e){if(_0x18df3e){_0x435251=_0x18df3e;return _0x18df3e[_0x9268('0x9d')](_0x4ec6fd['body']['ids'],_[_0x9268('0x5f')](_0x4ec6fd['body'],[_0x9268('0x83'),'id'])||{});}return null;})[_0x9268('0x9e')](function(_0x2460e6){var _0x1364d0;_0x3172aa=_0x2460e6||[];var _0x295785=[];if(_0x2460e6){for(var _0x2227d7=0x0;_0x2227d7<_0x2460e6['length'];_0x2227d7+=0x1){var _0x275b63=_0x2460e6[_0x2227d7][_0x9268('0x56')]({'plain':!![]});_0x435251[_0x9268('0x9f')]=_0x4ec6fd[_0x9268('0x5e')][_0x9268('0x9f')]?_0x4ec6fd[_0x9268('0x5e')][_0x9268('0x9f')]:_0x435251[_0x9268('0x9f')];switch(_0x435251[_0x9268('0x9f')]){case _0x9268('0xa0'):_0x1364d0=squel['insert']()[_0x9268('0xa1')](_0x9268('0xa2'))[_0x9268('0xa3')]([_0x9268('0xa4'),_0x9268('0xa5'),_0x9268('0xa6'),'ListId',_0x9268('0x66'),'createdAt','updatedAt'],squel[_0x9268('0x85')]()[_0x9268('0x86')](_0x9268('0xa4'),_0x9268('0xa4'))['field'](_0x9268('0xa7'),'scheduledAt')['field']('id',_0x9268('0xa6'))[_0x9268('0x86')](_0x275b63[_0x9268('0xa8')][_0x9268('0x8f')](),_0x9268('0xa9'))[_0x9268('0x86')](_0x4ec6fd[_0x9268('0x52')]['id'][_0x9268('0x8f')](),_0x9268('0x66'))[_0x9268('0x86')]('NOW()','createdAt')['field']('NOW()',_0x9268('0x5d'))[_0x9268('0x88')](_0x9268('0xaa'))[_0x9268('0x4a')](_0x9268('0xab'))[_0x9268('0x4a')](_0x9268('0xac'),_0x275b63[_0x9268('0xa8')][_0x9268('0x8f')]())[_0x9268('0x4a')](_0x9268('0xad'))[_0x9268('0x4a')](_0x9268('0xae'),squel[_0x9268('0x85')]()['field'](_0x9268('0xaf'))[_0x9268('0x88')]('cm_hopper_final')[_0x9268('0x4a')]('VoiceQueueId\x20=\x20?',_0x4ec6fd[_0x9268('0x52')]['id']['toString']()))[_0x9268('0x4a')](_0x9268('0xae'),squel[_0x9268('0x85')]()[_0x9268('0x86')]('COALESCE(phone,\x27\x27)')[_0x9268('0x88')](_0x9268('0xa2'))[_0x9268('0x4a')](_0x9268('0x8d'),_0x4ec6fd[_0x9268('0x52')]['id'][_0x9268('0x8f')]())))[_0x9268('0x8f')]();break;case _0x9268('0xb0'):_0x1364d0=squel[_0x9268('0xb1')]()[_0x9268('0xa1')](_0x9268('0xa2'))[_0x9268('0xa3')]([_0x9268('0xa4'),_0x9268('0xa5'),_0x9268('0xa6'),_0x9268('0xa9'),_0x9268('0x66'),_0x9268('0xb2'),_0x9268('0x5d')],squel[_0x9268('0x85')]()[_0x9268('0x86')](_0x9268('0xa4'),_0x9268('0xa4'))[_0x9268('0x86')]('NOW()',_0x9268('0xa5'))['field']('id','ContactId')['field'](_0x275b63['CmListId'][_0x9268('0x8f')](),_0x9268('0xa9'))[_0x9268('0x86')](_0x4ec6fd[_0x9268('0x52')]['id'][_0x9268('0x8f')](),_0x9268('0x66'))[_0x9268('0x86')](_0x9268('0xa7'),'createdAt')[_0x9268('0x86')](_0x9268('0xa7'),_0x9268('0x5d'))[_0x9268('0x88')](_0x9268('0xaa'))[_0x9268('0x4a')](_0x9268('0xab'))[_0x9268('0x4a')](_0x9268('0xac'),_0x275b63['CmListId']['toString']())['where'](_0x9268('0xad'))[_0x9268('0x4a')](_0x9268('0xae'),squel[_0x9268('0x85')]()['field'](_0x9268('0xb3'))[_0x9268('0x88')]('cm_hopper')['where'](_0x9268('0x8d'),_0x4ec6fd[_0x9268('0x52')]['id'][_0x9268('0x8f')]())))['toString']();break;default:_0x1364d0=squel[_0x9268('0xb1')]()['into'](_0x9268('0xa2'))['fromQuery']([_0x9268('0xa4'),_0x9268('0xa5'),'ContactId',_0x9268('0xa9'),'VoiceQueueId',_0x9268('0xb2'),_0x9268('0x5d')],squel[_0x9268('0x85')]()[_0x9268('0x86')](_0x9268('0xa4'),_0x9268('0xa4'))[_0x9268('0x86')](_0x9268('0xa7'),_0x9268('0xa5'))[_0x9268('0x86')]('id',_0x9268('0xa6'))[_0x9268('0x86')](_0x275b63[_0x9268('0xa8')][_0x9268('0x8f')](),'ListId')[_0x9268('0x86')](_0x4ec6fd[_0x9268('0x52')]['id'][_0x9268('0x8f')](),_0x9268('0x66'))[_0x9268('0x86')](_0x9268('0xa7'),'createdAt')['field'](_0x9268('0xa7'),_0x9268('0x5d'))[_0x9268('0x88')](_0x9268('0xaa'))[_0x9268('0x4a')](_0x9268('0xab'))['where'](_0x9268('0xac'),_0x275b63[_0x9268('0xa8')][_0x9268('0x8f')]())[_0x9268('0x4a')](_0x9268('0xad')))['toString']();}_0x295785[_0x9268('0x97')](db[_0x9268('0x76')][_0x9268('0x41')](_0x1364d0));}return BPromise['all'](_0x295785);}})[_0x9268('0x2a')](function(){return _0x3172aa;})[_0x9268('0x2a')](respondWithResult(_0x3d1d76,null))[_0x9268('0x50')](handleError(_0x3d1d76,null));};exports[_0x9268('0xb4')]=function(_0x3f2c54,_0xb08891,_0x27caa0){return db[_0x9268('0x3c')][_0x9268('0x36')]({'where':{'id':_0x3f2c54['params']['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0xb08891,null))[_0x9268('0x2a')](function(_0x5f5973){if(_0x5f5973){return _0x5f5973[_0x9268('0xb4')](_0x3f2c54['query']['ids']);}})[_0x9268('0x2a')](function(_0x2c014c){if(_0x2c014c){return db[_0x9268('0x63')][_0x9268('0x2b')]({'where':{'ListId':_0x3f2c54['query'][_0x9268('0x83')],'VoiceQueueId':_0x3f2c54[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](function(){return _0x2c014c;});}})['then'](respondWithStatusCode(_0xb08891,null))[_0x9268('0x50')](handleError(_0xb08891,null));};exports[_0x9268('0xb5')]=function(_0x39958d,_0x4e09e7,_0x228b02){var _0xdf4b07={};var _0x63e3cf={};var _0x187771;var _0x3771e1;return db[_0x9268('0x3c')]['findOne']({'where':{'id':_0x39958d[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x4e09e7,null))[_0x9268('0x2a')](function(_0x12edc2){if(_0x12edc2){_0x187771=_0x12edc2;_0x63e3cf[_0x9268('0x40')]=_[_0x9268('0x53')](db[_0x9268('0x9b')][_0x9268('0x3d')]);_0x63e3cf['query']=_[_0x9268('0x53')](_0x39958d[_0x9268('0x41')]);_0x63e3cf[_0x9268('0x49')]=_['intersection'](_0x63e3cf[_0x9268('0x40')],_0x63e3cf[_0x9268('0x41')]);_0xdf4b07[_0x9268('0x42')]=_['intersection'](_0x63e3cf[_0x9268('0x40')],qs[_0x9268('0x44')](_0x39958d[_0x9268('0x41')]['fields']));_0xdf4b07[_0x9268('0x42')]=_0xdf4b07[_0x9268('0x42')][_0x9268('0x45')]?_0xdf4b07['attributes']:_0x63e3cf[_0x9268('0x40')];_0xdf4b07[_0x9268('0x47')]=qs[_0x9268('0x48')](_0x39958d[_0x9268('0x41')]['sort']);_0xdf4b07[_0x9268('0x4a')]=qs[_0x9268('0x49')](_[_0x9268('0x65')](_0x39958d[_0x9268('0x41')],_0x63e3cf[_0x9268('0x49')]));if(_0x39958d[_0x9268('0x41')][_0x9268('0x30')]){_0xdf4b07['where']=_['merge'](_0xdf4b07[_0x9268('0x4a')],{'$or':_[_0x9268('0x32')](_0xdf4b07[_0x9268('0x42')],function(_0xe5853c){var _0x15fc31={};_0x15fc31[_0xe5853c]={'$like':'%'+_0x39958d['query'][_0x9268('0x30')]+'%'};return _0x15fc31;})});}_0xdf4b07=_['merge']({},_0xdf4b07,_0x39958d[_0x9268('0x4d')]);return _0x187771['getBlackLists'](_0xdf4b07);}})[_0x9268('0x2a')](function(_0x2b4869){if(_0x2b4869){_0x3771e1=_0x2b4869[_0x9268('0x45')];if(!_0x39958d['query']['hasOwnProperty']('nolimit')){_0xdf4b07[_0x9268('0x23')]=qs[_0x9268('0x23')](_0x39958d[_0x9268('0x41')][_0x9268('0x23')]);_0xdf4b07[_0x9268('0x20')]=qs[_0x9268('0x20')](_0x39958d[_0x9268('0x41')][_0x9268('0x20')]);}return _0x187771[_0x9268('0xb5')](_0xdf4b07);}})[_0x9268('0x2a')](function(_0x4a5c65){if(_0x4a5c65){return _0x4a5c65?{'count':_0x3771e1,'rows':_0x4a5c65}:null;}})[_0x9268('0x2a')](respondWithResult(_0x4e09e7,null))[_0x9268('0x50')](handleError(_0x4e09e7,null));};exports[_0x9268('0xb6')]=function(_0xf1694c,_0x543e63,_0x4ab7f5){var _0x40baf0,_0x3164bb;return db['VoiceQueue'][_0x9268('0x36')]({'where':{'id':_0xf1694c[_0x9268('0x52')]['id']}})['then'](handleEntityNotFound(_0x543e63,null))[_0x9268('0x2a')](function(_0x43e938){if(_0x43e938){_0x3164bb=_0x43e938;return _0x43e938[_0x9268('0xb6')](_0xf1694c[_0x9268('0x5e')]['ids'],_[_0x9268('0x5f')](_0xf1694c[_0x9268('0x5e')],[_0x9268('0x83'),'id'])||{});}return null;})[_0x9268('0x9e')](function(_0x35590b){var _0x401d3c;_0x40baf0=_0x35590b||[];var _0x5c64e7=[];if(_0x35590b){for(var _0x45d060=0x0;_0x45d060<_0x35590b[_0x9268('0x45')];_0x45d060+=0x1){var _0x5f4d81=_0x35590b[_0x45d060][_0x9268('0x56')]({'plain':!![]});_0x401d3c=squel[_0x9268('0xb1')]()[_0x9268('0xa1')]('cm_hopper_black')['fromQuery'](['phone',_0x9268('0xa6'),_0x9268('0xa9'),_0x9268('0x66'),_0x9268('0xb2'),_0x9268('0x5d')],squel[_0x9268('0x85')]()[_0x9268('0x86')]('phone',_0x9268('0xa4'))[_0x9268('0x86')]('id',_0x9268('0xa6'))[_0x9268('0x86')](_0x5f4d81[_0x9268('0xa8')]['toString'](),_0x9268('0xa9'))[_0x9268('0x86')](_0xf1694c[_0x9268('0x52')]['id'][_0x9268('0x8f')](),_0x9268('0x66'))['field']('NOW()',_0x9268('0xb2'))[_0x9268('0x86')](_0x9268('0xa7'),_0x9268('0x5d'))[_0x9268('0x88')](_0x9268('0xaa'))['where'](_0x9268('0xab'))[_0x9268('0x4a')](_0x9268('0xac'),_0x5f4d81[_0x9268('0xa8')][_0x9268('0x8f')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x9268('0x8f')]();_0x5c64e7[_0x9268('0x97')](db[_0x9268('0x76')][_0x9268('0x41')](_0x401d3c));}return BPromise['all'](_0x5c64e7);}})[_0x9268('0x2a')](function(){return _0x40baf0;})['then'](respondWithResult(_0x543e63,null))[_0x9268('0x50')](handleError(_0x543e63,null));};exports[_0x9268('0xb7')]=function(_0xfaa947,_0x3d26f2,_0x173992){return db[_0x9268('0x3c')]['find']({'where':{'id':_0xfaa947[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](handleEntityNotFound(_0x3d26f2,null))['then'](function(_0x152881){if(_0x152881){return _0x152881['removeBlackLists'](_0xfaa947[_0x9268('0x41')][_0x9268('0x83')]);}})[_0x9268('0x2a')](function(_0x1de925){if(_0x1de925){return db[_0x9268('0x6d')]['destroy']({'where':{'ListId':_0xfaa947[_0x9268('0x41')][_0x9268('0x83')],'VoiceQueueId':_0xfaa947[_0x9268('0x52')]['id']}})[_0x9268('0x2a')](function(){return _0x1de925;});}})['then'](respondWithStatusCode(_0x3d26f2,null))['catch'](handleError(_0x3d26f2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 018b3ff..fe5f52a 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 _0x0c5a=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x552252,_0xdb0d75){var _0x16ae8d=function(_0x1cebe2){while(--_0x1cebe2){_0x552252['push'](_0x552252['shift']());}};_0x16ae8d(++_0xdb0d75);}(_0x0c5a,0x157));var _0xa0c5=function(_0x32eb3f,_0x3cc610){_0x32eb3f=_0x32eb3f-0x0;var _0x372d5f=_0x0c5a[_0x32eb3f];return _0x372d5f;};'use strict';var EventEmitter=require(_0xa0c5('0x0'));var VoiceQueue=require(_0xa0c5('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa0c5('0x2')](0x0);var events={'afterCreate':_0xa0c5('0x3'),'afterUpdate':_0xa0c5('0x4'),'afterDestroy':_0xa0c5('0x5')};function emitEvent(_0x390d11){return function(_0xdfc78e,_0x2c5532,_0x4f0851){VoiceQueueEvents[_0xa0c5('0x6')](_0x390d11+':'+_0xdfc78e['id'],_0xdfc78e);VoiceQueueEvents[_0xa0c5('0x6')](_0x390d11,_0xdfc78e);_0x4f0851(null);};}for(var e in events){if(events[_0xa0c5('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa0c5('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x0c0f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue'];(function(_0x479037,_0x35dd00){var _0x544fa7=function(_0x387660){while(--_0x387660){_0x479037['push'](_0x479037['shift']());}};_0x544fa7(++_0x35dd00);}(_0x0c0f,0xbb));var _0xf0c0=function(_0x341c82,_0x1047b8){_0x341c82=_0x341c82-0x0;var _0x131333=_0x0c0f[_0x341c82];return _0x131333;};'use strict';var EventEmitter=require(_0xf0c0('0x0'));var VoiceQueue=require(_0xf0c0('0x1'))['db'][_0xf0c0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf0c0('0x3')](0x0);var events={'afterCreate':_0xf0c0('0x4'),'afterUpdate':_0xf0c0('0x5'),'afterDestroy':_0xf0c0('0x6')};function emitEvent(_0x1d833b){return function(_0x2ae17f,_0x348e28,_0x18a11d){VoiceQueueEvents[_0xf0c0('0x7')](_0x1d833b+':'+_0x2ae17f['id'],_0x2ae17f);VoiceQueueEvents[_0xf0c0('0x7')](_0x1d833b,_0x2ae17f);_0x18a11d(null);};}for(var e in events){if(events[_0xf0c0('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf0c0('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 2966aa1..10fdc4d 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x1f8f66,_0x5dc25a){var _0x3b992d=function(_0x25dadb){while(--_0x25dadb){_0x1f8f66['push'](_0x1f8f66['shift']());}};_0x3b992d(++_0x5dc25a);}(_0x70e0,0x17b));var _0x070e=function(_0x2a0929,_0x4abe7c){_0x2a0929=_0x2a0929-0x0;var _0x50e47b=_0x70e0[_0x2a0929];return _0x50e47b;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x3c8a6e,_0x51ff70){var _0x5f443a=function(_0x9e49a5){while(--_0x9e49a5){_0x3c8a6e['push'](_0x3c8a6e['shift']());}};_0x5f443a(++_0x51ff70);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index b1c178a..a34d729 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 _0x5d6a=['info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','model','include','map','catch','debug','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then'];(function(_0x34da94,_0x178b79){var _0x7ae05e=function(_0xa083ee){while(--_0xa083ee){_0x34da94['push'](_0x34da94['shift']());}};_0x7ae05e(++_0x178b79);}(_0x5d6a,0xbd));var _0xa5d6=function(_0x1512b5,_0x532fef){_0x1512b5=_0x1512b5-0x0;var _0x57baad=_0x5d6a[_0x1512b5];return _0x57baad;};'use strict';var _=require(_0xa5d6('0x0'));var util=require(_0xa5d6('0x1'));var moment=require(_0xa5d6('0x2'));var BPromise=require(_0xa5d6('0x3'));var rs=require(_0xa5d6('0x4'));var fs=require('fs');var Redis=require(_0xa5d6('0x5'));var db=require(_0xa5d6('0x6'))['db'];var utils=require(_0xa5d6('0x7'));var logger=require(_0xa5d6('0x8'))(_0xa5d6('0x9'));var config=require('../../config/environment');var jayson=require(_0xa5d6('0xa'));var client=jayson[_0xa5d6('0xb')][_0xa5d6('0xc')]({'port':0x232a});config[_0xa5d6('0xd')]=_[_0xa5d6('0xe')](config[_0xa5d6('0xd')],{'host':_0xa5d6('0xf'),'port':0x18eb});var socket=require(_0xa5d6('0x10'))(new Redis(config[_0xa5d6('0xd')]));require(_0xa5d6('0x11'))[_0xa5d6('0x12')](socket);function respondWithRpcPromise(_0x49c914,_0x488605,_0x2328a1){return new BPromise(function(_0x47a4dc,_0x111507){return client[_0xa5d6('0x13')](_0x49c914,_0x2328a1)[_0xa5d6('0x14')](function(_0x20d7f2){logger[_0xa5d6('0x15')](_0xa5d6('0x16'),_0x488605,_0xa5d6('0x17'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x488605,_0xa5d6('0x17'),JSON[_0xa5d6('0x18')](_0x20d7f2));if(_0x20d7f2[_0xa5d6('0x19')]){if(_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1a')]===0x1f4){logger['error'](_0xa5d6('0x16'),_0x488605,_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1b')]);return _0x111507(_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1b')]);}logger[_0xa5d6('0x19')](_0xa5d6('0x16'),_0x488605,_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1b')]);return _0x47a4dc(_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1b')]);}else{logger[_0xa5d6('0x15')](_0xa5d6('0x16'),_0x488605,_0xa5d6('0x17'));_0x47a4dc(_0x20d7f2[_0xa5d6('0x1c')][_0xa5d6('0x1b')]);}})['catch'](function(_0x4841cf){logger[_0xa5d6('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x488605,_0x4841cf);_0x111507(_0x4841cf);});});}exports[_0xa5d6('0x1d')]=function(_0x3546ac){var _0xdb17d5=this;return new Promise(function(_0x2368b7,_0x247e1a){return db[_0xa5d6('0x1e')]['findAll']({'raw':_0x3546ac[_0xa5d6('0x1f')]?_0x3546ac[_0xa5d6('0x1f')][_0xa5d6('0x20')]===undefined?!![]:![]:!![],'where':_0x3546ac[_0xa5d6('0x1f')]?_0x3546ac[_0xa5d6('0x1f')][_0xa5d6('0x21')]||null:null,'attributes':_0x3546ac['options']?_0x3546ac['options'][_0xa5d6('0x22')]||null:null,'limit':_0x3546ac[_0xa5d6('0x1f')]?_0x3546ac[_0xa5d6('0x1f')][_0xa5d6('0x23')]||null:null,'include':_0x3546ac[_0xa5d6('0x1f')]?_0x3546ac[_0xa5d6('0x1f')]['include']?_['map'](_0x3546ac['options']['include'],function(_0x5288c2){return{'model':db[_0x5288c2[_0xa5d6('0x24')]],'as':_0x5288c2['as'],'attributes':_0x5288c2[_0xa5d6('0x22')],'include':_0x5288c2[_0xa5d6('0x25')]?_['map'](_0x5288c2[_0xa5d6('0x25')],function(_0x334aee){return{'model':db[_0x334aee[_0xa5d6('0x24')]],'as':_0x334aee['as'],'attributes':_0x334aee[_0xa5d6('0x22')],'include':_0x334aee[_0xa5d6('0x25')]?_[_0xa5d6('0x26')](_0x334aee[_0xa5d6('0x25')],function(_0x6c898f){return{'model':db[_0x6c898f[_0xa5d6('0x24')]],'as':_0x6c898f['as'],'attributes':_0x6c898f[_0xa5d6('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa5d6('0x14')](function(_0x5087e8){logger[_0xa5d6('0x15')]('GetVoiceQueue',_0x3546ac);logger['debug'](_0xa5d6('0x1d'),_0x3546ac,JSON[_0xa5d6('0x18')](_0x5087e8));_0x2368b7(_0x5087e8);})[_0xa5d6('0x27')](function(_0x3b24c5){logger[_0xa5d6('0x19')](_0xa5d6('0x1d'),_0x3b24c5[_0xa5d6('0x1b')],_0x3546ac);_0x247e1a(_0xdb17d5['error'](0x1f4,_0x3b24c5[_0xa5d6('0x1b')]));});});};exports['ShowVoiceQueue']=function(_0x44b60e){var _0x3916df=this;return new Promise(function(_0x18949c,_0x3fb803){return db[_0xa5d6('0x1e')]['find']({'raw':_0x44b60e[_0xa5d6('0x1f')]?_0x44b60e[_0xa5d6('0x1f')][_0xa5d6('0x20')]===undefined?!![]:![]:!![],'where':_0x44b60e[_0xa5d6('0x1f')]?_0x44b60e[_0xa5d6('0x1f')][_0xa5d6('0x21')]||null:null,'attributes':_0x44b60e['options']?_0x44b60e[_0xa5d6('0x1f')]['attributes']||null:null,'include':_0x44b60e[_0xa5d6('0x1f')]?_0x44b60e[_0xa5d6('0x1f')]['include']?_[_0xa5d6('0x26')](_0x44b60e[_0xa5d6('0x1f')]['include'],function(_0x1753fc){return{'model':db[_0x1753fc['model']],'as':_0x1753fc['as'],'attributes':_0x1753fc['attributes'],'include':_0x1753fc[_0xa5d6('0x25')]?_[_0xa5d6('0x26')](_0x1753fc[_0xa5d6('0x25')],function(_0x38f703){return{'model':db[_0x38f703['model']],'as':_0x38f703['as'],'attributes':_0x38f703[_0xa5d6('0x22')],'include':_0x38f703[_0xa5d6('0x25')]?_['map'](_0x38f703[_0xa5d6('0x25')],function(_0xd37da6){return{'model':db[_0xd37da6[_0xa5d6('0x24')]],'as':_0xd37da6['as'],'attributes':_0xd37da6[_0xa5d6('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf2e8a8){logger['info']('ShowVoiceQueue',_0x44b60e);logger[_0xa5d6('0x28')](_0xa5d6('0x29'),_0x44b60e,JSON[_0xa5d6('0x18')](_0xf2e8a8));_0x18949c(_0xf2e8a8);})[_0xa5d6('0x27')](function(_0x3dfff7){logger['error'](_0xa5d6('0x29'),_0x3dfff7[_0xa5d6('0x1b')],_0x44b60e);_0x3fb803(_0x3916df['error'](0x1f4,_0x3dfff7[_0xa5d6('0x1b')]));});});}; \ No newline at end of file +var _0x4ffb=['info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceQueue','findAll','options','where','include','map','model','attributes','then','GetVoiceQueue','ShowVoiceQueue','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x58e9b8,_0x402cfa){var _0x5caa62=function(_0x4af6d0){while(--_0x4af6d0){_0x58e9b8['push'](_0x58e9b8['shift']());}};_0x5caa62(++_0x402cfa);}(_0x4ffb,0x16d));var _0xb4ff=function(_0x1a08ad,_0x21d209){_0x1a08ad=_0x1a08ad-0x0;var _0x521649=_0x4ffb[_0x1a08ad];return _0x521649;};'use strict';var _=require(_0xb4ff('0x0'));var util=require(_0xb4ff('0x1'));var moment=require('moment');var BPromise=require(_0xb4ff('0x2'));var rs=require(_0xb4ff('0x3'));var fs=require('fs');var Redis=require(_0xb4ff('0x4'));var db=require(_0xb4ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4ff('0x6'))(_0xb4ff('0x7'));var config=require(_0xb4ff('0x8'));var jayson=require(_0xb4ff('0x9'));var client=jayson[_0xb4ff('0xa')][_0xb4ff('0xb')]({'port':0x232a});config[_0xb4ff('0xc')]=_[_0xb4ff('0xd')](config[_0xb4ff('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb4ff('0xe'))(new Redis(config[_0xb4ff('0xc')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0xc20797,_0x34ed94,_0x5a6479){return new BPromise(function(_0xc75975,_0x30197e){return client['request'](_0xc20797,_0x5a6479)['then'](function(_0x58d555){logger[_0xb4ff('0xf')](_0xb4ff('0x10'),_0x34ed94,_0xb4ff('0x11'));logger[_0xb4ff('0x12')](_0xb4ff('0x13'),_0x34ed94,_0xb4ff('0x11'),JSON[_0xb4ff('0x14')](_0x58d555));if(_0x58d555['error']){if(_0x58d555[_0xb4ff('0x15')][_0xb4ff('0x16')]===0x1f4){logger['error'](_0xb4ff('0x10'),_0x34ed94,_0x58d555[_0xb4ff('0x15')]['message']);return _0x30197e(_0x58d555['error'][_0xb4ff('0x17')]);}logger[_0xb4ff('0x15')](_0xb4ff('0x10'),_0x34ed94,_0x58d555[_0xb4ff('0x15')][_0xb4ff('0x17')]);return _0xc75975(_0x58d555['error']['message']);}else{logger[_0xb4ff('0xf')](_0xb4ff('0x10'),_0x34ed94,_0xb4ff('0x11'));_0xc75975(_0x58d555['result'][_0xb4ff('0x17')]);}})[_0xb4ff('0x18')](function(_0x3f75f3){logger['error'](_0xb4ff('0x10'),_0x34ed94,_0x3f75f3);_0x30197e(_0x3f75f3);});});}exports['GetVoiceQueue']=function(_0x1c0a23){var _0x4a07f8=this;return new Promise(function(_0x5ad11b,_0x552c06){return db[_0xb4ff('0x19')][_0xb4ff('0x1a')]({'raw':_0x1c0a23['options']?_0x1c0a23[_0xb4ff('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1c0a23[_0xb4ff('0x1b')]?_0x1c0a23[_0xb4ff('0x1b')][_0xb4ff('0x1c')]||null:null,'attributes':_0x1c0a23[_0xb4ff('0x1b')]?_0x1c0a23[_0xb4ff('0x1b')]['attributes']||null:null,'limit':_0x1c0a23[_0xb4ff('0x1b')]?_0x1c0a23[_0xb4ff('0x1b')]['limit']||null:null,'include':_0x1c0a23['options']?_0x1c0a23['options'][_0xb4ff('0x1d')]?_[_0xb4ff('0x1e')](_0x1c0a23[_0xb4ff('0x1b')][_0xb4ff('0x1d')],function(_0x5bfddb){return{'model':db[_0x5bfddb[_0xb4ff('0x1f')]],'as':_0x5bfddb['as'],'attributes':_0x5bfddb['attributes'],'include':_0x5bfddb[_0xb4ff('0x1d')]?_[_0xb4ff('0x1e')](_0x5bfddb[_0xb4ff('0x1d')],function(_0x80926c){return{'model':db[_0x80926c['model']],'as':_0x80926c['as'],'attributes':_0x80926c[_0xb4ff('0x20')],'include':_0x80926c[_0xb4ff('0x1d')]?_['map'](_0x80926c['include'],function(_0x8e043a){return{'model':db[_0x8e043a[_0xb4ff('0x1f')]],'as':_0x8e043a['as'],'attributes':_0x8e043a[_0xb4ff('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb4ff('0x21')](function(_0x4153a0){logger[_0xb4ff('0xf')]('GetVoiceQueue',_0x1c0a23);logger[_0xb4ff('0x12')](_0xb4ff('0x22'),_0x1c0a23,JSON['stringify'](_0x4153a0));_0x5ad11b(_0x4153a0);})[_0xb4ff('0x18')](function(_0x4c5b5d){logger[_0xb4ff('0x15')](_0xb4ff('0x22'),_0x4c5b5d[_0xb4ff('0x17')],_0x1c0a23);_0x552c06(_0x4a07f8['error'](0x1f4,_0x4c5b5d[_0xb4ff('0x17')]));});});};exports[_0xb4ff('0x23')]=function(_0x4b8650){var _0x38df1d=this;return new Promise(function(_0x2bfb46,_0x555a23){return db[_0xb4ff('0x19')][_0xb4ff('0x24')]({'raw':_0x4b8650[_0xb4ff('0x1b')]?_0x4b8650['options'][_0xb4ff('0x25')]===undefined?!![]:![]:!![],'where':_0x4b8650[_0xb4ff('0x1b')]?_0x4b8650[_0xb4ff('0x1b')][_0xb4ff('0x1c')]||null:null,'attributes':_0x4b8650[_0xb4ff('0x1b')]?_0x4b8650[_0xb4ff('0x1b')]['attributes']||null:null,'include':_0x4b8650[_0xb4ff('0x1b')]?_0x4b8650[_0xb4ff('0x1b')]['include']?_[_0xb4ff('0x1e')](_0x4b8650[_0xb4ff('0x1b')]['include'],function(_0x2524eb){return{'model':db[_0x2524eb['model']],'as':_0x2524eb['as'],'attributes':_0x2524eb[_0xb4ff('0x20')],'include':_0x2524eb[_0xb4ff('0x1d')]?_[_0xb4ff('0x1e')](_0x2524eb['include'],function(_0x5e2e6d){return{'model':db[_0x5e2e6d['model']],'as':_0x5e2e6d['as'],'attributes':_0x5e2e6d[_0xb4ff('0x20')],'include':_0x5e2e6d['include']?_[_0xb4ff('0x1e')](_0x5e2e6d[_0xb4ff('0x1d')],function(_0x37fdd4){return{'model':db[_0x37fdd4['model']],'as':_0x37fdd4['as'],'attributes':_0x37fdd4[_0xb4ff('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb4ff('0x21')](function(_0x590c98){logger['info']('ShowVoiceQueue',_0x4b8650);logger[_0xb4ff('0x12')]('ShowVoiceQueue',_0x4b8650,JSON[_0xb4ff('0x14')](_0x590c98));_0x2bfb46(_0x590c98);})[_0xb4ff('0x18')](function(_0x20d7f4){logger[_0xb4ff('0x15')](_0xb4ff('0x23'),_0x20d7f4['message'],_0x4b8650);_0x555a23(_0x38df1d['error'](0x1f4,_0x20d7f4[_0xb4ff('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index feee47c..ef11b1d 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 _0x54a5=['removeListener','register','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x54a5,0x8b));var _0x554a=function(_0x24ac55,_0x4f1363){_0x24ac55=_0x24ac55-0x0;var _0x235a72=_0x54a5[_0x24ac55];return _0x235a72;};'use strict';var VoiceQueueEvents=require(_0x554a('0x0'));var events=[_0x554a('0x1'),_0x554a('0x2'),_0x554a('0x3')];function createListener(_0x524ef8,_0x17bdd4){return function(_0x3d838){_0x17bdd4[_0x554a('0x4')](_0x524ef8,_0x3d838);};}function removeListener(_0x125f53,_0x5171f8){return function(){VoiceQueueEvents[_0x554a('0x5')](_0x125f53,_0x5171f8);};}exports[_0x554a('0x6')]=function(_0x1c20ff){for(var _0x3ebcb6=0x0,_0x54c4e4=events['length'];_0x3ebcb6<_0x54c4e4;_0x3ebcb6++){var _0x59a31f=events[_0x3ebcb6];var _0x210c94=createListener(_0x554a('0x7')+_0x59a31f,_0x1c20ff);VoiceQueueEvents['on'](_0x59a31f,_0x210c94);}}; \ No newline at end of file +var _0x1088=['removeListener','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x1df2b0,_0x557e89){var _0x528da3=function(_0x266980){while(--_0x266980){_0x1df2b0['push'](_0x1df2b0['shift']());}};_0x528da3(++_0x557e89);}(_0x1088,0x120));var _0x8108=function(_0xe30817,_0x5975c6){_0xe30817=_0xe30817-0x0;var _0x1a50ae=_0x1088[_0xe30817];return _0x1a50ae;};'use strict';var VoiceQueueEvents=require(_0x8108('0x0'));var events=[_0x8108('0x1'),'remove','update'];function createListener(_0x153060,_0x87c763){return function(_0x5cb06f){_0x87c763['emit'](_0x153060,_0x5cb06f);};}function removeListener(_0x3bde21,_0x35ea26){return function(){VoiceQueueEvents[_0x8108('0x2')](_0x3bde21,_0x35ea26);};}exports['register']=function(_0x347efe){for(var _0x1181e4=0x0,_0xa82c1f=events[_0x8108('0x3')];_0x1181e4<_0xa82c1f;_0x1181e4++){var _0x5e030d=events[_0x1181e4];var _0xa3ebce=createListener(_0x8108('0x4')+_0x5e030d,_0x347efe);VoiceQueueEvents['on'](_0x5e030d,_0xa3ebce);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 448fb5a..bf650e8 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 _0xcd3a=['/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','describe','getVoiceQueuesReport','create','put'];(function(_0x24b959,_0x5a8890){var _0x5644a4=function(_0x700cdb){while(--_0x700cdb){_0x24b959['push'](_0x24b959['shift']());}};_0x5644a4(++_0x5a8890);}(_0xcd3a,0x9c));var _0xacd3=function(_0x3d8466,_0x30f91e){_0x3d8466=_0x3d8466-0x0;var _0x102407=_0xcd3a[_0x3d8466];return _0x102407;};'use strict';var multer=require(_0xacd3('0x0'));var util=require(_0xacd3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xacd3('0x2'));var router=express[_0xacd3('0x3')]();var fs_extra=require(_0xacd3('0x4'));var auth=require(_0xacd3('0x5'));var interaction=require(_0xacd3('0x6'));var config=require(_0xacd3('0x7'));var controller=require(_0xacd3('0x8'));router[_0xacd3('0x9')]('/',auth[_0xacd3('0xa')](),controller['index']);router[_0xacd3('0x9')]('/describe',auth[_0xacd3('0xa')](),controller[_0xacd3('0xb')]);router[_0xacd3('0x9')]('/index',auth[_0xacd3('0xa')](),controller[_0xacd3('0xc')]);router[_0xacd3('0x9')]('/:id',auth[_0xacd3('0xa')](),controller['show']);router['post']('/',auth[_0xacd3('0xa')](),controller[_0xacd3('0xd')]);router[_0xacd3('0xe')](_0xacd3('0xf'),auth[_0xacd3('0xa')](),controller[_0xacd3('0x10')]);router[_0xacd3('0x11')](_0xacd3('0xf'),auth[_0xacd3('0xa')](),controller['destroy']);module[_0xacd3('0x12')]=router; \ No newline at end of file +var _0xa8d1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x257806,_0xedbd1c){var _0x56401a=function(_0x5cdfda){while(--_0x5cdfda){_0x257806['push'](_0x257806['shift']());}};_0x56401a(++_0xedbd1c);}(_0xa8d1,0xd8));var _0x1a8d=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xa8d1[_0x5e6ea3];return _0x4048b5;};'use strict';var multer=require(_0x1a8d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1a8d('0x1'));var express=require(_0x1a8d('0x2'));var router=express[_0x1a8d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1a8d('0x4'));var interaction=require(_0x1a8d('0x5'));var config=require(_0x1a8d('0x6'));var controller=require(_0x1a8d('0x7'));router[_0x1a8d('0x8')]('/',auth[_0x1a8d('0x9')](),controller[_0x1a8d('0xa')]);router[_0x1a8d('0x8')](_0x1a8d('0xb'),auth[_0x1a8d('0x9')](),controller[_0x1a8d('0xc')]);router[_0x1a8d('0x8')](_0x1a8d('0xd'),auth[_0x1a8d('0x9')](),controller[_0x1a8d('0xe')]);router['get'](_0x1a8d('0xf'),auth[_0x1a8d('0x9')](),controller['show']);router['post']('/',auth[_0x1a8d('0x9')](),controller[_0x1a8d('0x10')]);router[_0x1a8d('0x11')](_0x1a8d('0xf'),auth[_0x1a8d('0x9')](),controller[_0x1a8d('0x12')]);router[_0x1a8d('0x13')](_0x1a8d('0xf'),auth[_0x1a8d('0x9')](),controller[_0x1a8d('0x14')]);module[_0x1a8d('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 1098f6c..5a1f57b 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 _0xfd4a=['INTEGER','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x51cbec,_0x279f70){var _0x5dde1c=function(_0x110f5e){while(--_0x110f5e){_0x51cbec['push'](_0x51cbec['shift']());}};_0x5dde1c(++_0x279f70);}(_0xfd4a,0x158));var _0xafd4=function(_0x466241,_0x42f815){_0x466241=_0x466241-0x0;var _0x51e0a9=_0xfd4a[_0x466241];return _0x51e0a9;};'use strict';var Sequelize=require(_0xafd4('0x0'));var moment=require(_0xafd4('0x1'));module[_0xafd4('0x2')]={'type':{'type':Sequelize[_0xafd4('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xafd4('0x3')]},'queue':{'type':Sequelize[_0xafd4('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xafd4('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xafd4('0x4')],'set':function(_0x39f71e){var _0x3d1dca=moment(_0x39f71e);var _0xd41b0a=moment(this['getDataValue'](_0xafd4('0x5')))[_0xafd4('0x6')](_0xafd4('0x7'));var _0x464b1e=_0x3d1dca[_0xafd4('0x8')](_0xd41b0a,_0xafd4('0x9'));this[_0xafd4('0xa')](_0xafd4('0xb'),_0x39f71e);this[_0xafd4('0xa')](_0xafd4('0xc'),_0x464b1e||null);}},'position':{'type':Sequelize[_0xafd4('0xd')]},'count':{'type':Sequelize[_0xafd4('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xafd4('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xafd4('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xafd4('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xafd4('0x3')],'comment':_0xafd4('0xe')},'originalposition':{'type':Sequelize[_0xafd4('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xafd4('0x3')]},'connectedlinename':{'type':Sequelize[_0xafd4('0x3')]},'accountcode':{'type':Sequelize[_0xafd4('0x3')]},'context':{'type':Sequelize[_0xafd4('0x3')]},'exten':{'type':Sequelize[_0xafd4('0x3')]},'priority':{'type':Sequelize[_0xafd4('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xafd4('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xafd4('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xafd4('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xafd4('0x3')],'comment':_0xafd4('0x10')},'transferexten':{'type':Sequelize[_0xafd4('0x3')]},'transferuniqueid':{'type':Sequelize[_0xafd4('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xafd4('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xafd4('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c2c=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x3c2c,0xf3));var _0xc3c2=function(_0x4d6714,_0x192d7e){_0x4d6714=_0x4d6714-0x0;var _0x49ac46=_0x3c2c[_0x4d6714];return _0x49ac46;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc3c2('0x0'));module[_0xc3c2('0x1')]={'type':{'type':Sequelize[_0xc3c2('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc3c2('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc3c2('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xc3c2('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xc3c2('0x3')],'set':function(_0x26092d){var _0x13120f=moment(_0x26092d);var _0x476650=moment(this[_0xc3c2('0x4')](_0xc3c2('0x5')))[_0xc3c2('0x6')](_0xc3c2('0x7'));var _0x112fab=_0x13120f['diff'](_0x476650,_0xc3c2('0x8'));this[_0xc3c2('0x9')](_0xc3c2('0xa'),_0x26092d);this[_0xc3c2('0x9')](_0xc3c2('0xb'),_0x112fab||null);}},'position':{'type':Sequelize[_0xc3c2('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xc3c2('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc3c2('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xc3c2('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc3c2('0x3')]},'queuecallerexit':{'type':Sequelize[_0xc3c2('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc3c2('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xc3c2('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xc3c2('0xc')]},'channel':{'type':Sequelize[_0xc3c2('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc3c2('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc3c2('0x2')]},'priority':{'type':Sequelize[_0xc3c2('0x2')]},'holdtime':{'type':Sequelize[_0xc3c2('0xc')]},'mohtime':{'type':Sequelize[_0xc3c2('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc3c2('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc3c2('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc3c2('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xc3c2('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc3c2('0x2')]},'disposition':{'type':Sequelize[_0xc3c2('0x2')]},'secondDisposition':{'type':Sequelize[_0xc3c2('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc3c2('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xc3c2('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index a13395d..3c46833 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 _0x3b2b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','destroy','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','include','VoiceQueueReport','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','options','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x19d1e1,_0x123555){var _0x4bfa93=function(_0x10daac){while(--_0x10daac){_0x19d1e1['push'](_0x19d1e1['shift']());}};_0x4bfa93(++_0x123555);}(_0x3b2b,0x136));var _0xb3b2=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x3b2b[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0xb3b2('0x0'));var rimraf=require(_0xb3b2('0x1'));var zipdir=require(_0xb3b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3b2('0x3'));var moment=require(_0xb3b2('0x4'));var BPromise=require(_0xb3b2('0x5'));var Mustache=require('mustache');var util=require(_0xb3b2('0x6'));var path=require('path');var sox=require(_0xb3b2('0x7'));var csv=require('to-csv');var ejs=require(_0xb3b2('0x8'));var fs=require('fs');var fs_extra=require(_0xb3b2('0x9'));var _=require(_0xb3b2('0xa'));var squel=require(_0xb3b2('0xb'));var crypto=require(_0xb3b2('0xc'));var jsforce=require(_0xb3b2('0xd'));var deskjs=require(_0xb3b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb3b2('0xf'));var Papa=require(_0xb3b2('0x10'));var Redis=require(_0xb3b2('0x11'));var authService=require(_0xb3b2('0x12'));var qs=require(_0xb3b2('0x13'));var as=require(_0xb3b2('0x14'));var hardwareService=require(_0xb3b2('0x15'));var logger=require(_0xb3b2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xb3b2('0x17'));var licenseUtil=require(_0xb3b2('0x18'));var db=require(_0xb3b2('0x19'))['db'];config[_0xb3b2('0x1a')]=_['defaults'](config[_0xb3b2('0x1a')],{'host':_0xb3b2('0x1b'),'port':0x18eb});var socket=require(_0xb3b2('0x1c'))(new Redis(config[_0xb3b2('0x1a')]));require(_0xb3b2('0x1d'))['register'](socket);function respondWithStatusCode(_0x50db1b,_0x228db2){_0x228db2=_0x228db2||0xcc;return function(_0x407e07){if(_0x407e07){return _0x50db1b[_0xb3b2('0x1e')](_0x228db2);}return _0x50db1b[_0xb3b2('0x1f')](_0x228db2)[_0xb3b2('0x20')]();};}function respondWithResult(_0x2791fa,_0x29d194){_0x29d194=_0x29d194||0xc8;return function(_0x34c503){if(_0x34c503){return _0x2791fa[_0xb3b2('0x1f')](_0x29d194)[_0xb3b2('0x21')](_0x34c503);}};}function respondWithFilteredResult(_0x43bca3,_0x1ee1b4){return function(_0x2254bd){if(_0x2254bd){var _0x34f3eb=typeof _0x1ee1b4[_0xb3b2('0x22')]==='undefined'&&typeof _0x1ee1b4['limit']===_0xb3b2('0x23');var _0x3e927a=_0x2254bd[_0xb3b2('0x24')];var _0x51632b=_0x34f3eb?0x0:_0x1ee1b4[_0xb3b2('0x22')];var _0x367d58=_0x34f3eb?_0x2254bd[_0xb3b2('0x24')]:_0x1ee1b4[_0xb3b2('0x22')]+_0x1ee1b4[_0xb3b2('0x25')];var _0x2e50c9;if(_0x367d58>=_0x3e927a){_0x367d58=_0x3e927a;_0x2e50c9=0xc8;}else{_0x2e50c9=0xce;}_0x43bca3['status'](_0x2e50c9);return _0x43bca3[_0xb3b2('0x26')](_0xb3b2('0x27'),_0x51632b+'-'+_0x367d58+'/'+_0x3e927a)[_0xb3b2('0x21')](_0x2254bd);}return null;};}function patchUpdates(_0xd37241){return function(_0x404bd1){try{jsonpatch['apply'](_0x404bd1,_0xd37241,!![]);}catch(_0x190996){return BPromise['reject'](_0x190996);}return _0x404bd1[_0xb3b2('0x28')]();};}function saveUpdates(_0x32b52c,_0x25dd59){return function(_0xd9f470){if(_0xd9f470){return _0xd9f470['update'](_0x32b52c)['then'](function(_0x212dfb){return _0x212dfb;});}return null;};}function removeEntity(_0x31ae68,_0x328f41){return function(_0x29eb77){if(_0x29eb77){return _0x29eb77[_0xb3b2('0x29')]()['then'](function(){_0x31ae68[_0xb3b2('0x1f')](0xcc)[_0xb3b2('0x20')]();});}};}function handleEntityNotFound(_0x2b5b9e,_0x2f633a){return function(_0x6a9ef1){if(!_0x6a9ef1){_0x2b5b9e[_0xb3b2('0x1e')](0x194);}return _0x6a9ef1;};}function handleError(_0x28821e,_0x102951){_0x102951=_0x102951||0x1f4;return function(_0x559bcc){logger['error'](_0x559bcc[_0xb3b2('0x2a')]);if(_0x559bcc[_0xb3b2('0x2b')]){delete _0x559bcc[_0xb3b2('0x2b')];}_0x28821e['status'](_0x102951)[_0xb3b2('0x2c')](_0x559bcc);};}exports[_0xb3b2('0x2d')]=function(_0x546f57,_0x3b3fab){var _0x419395={},_0x44a28d={},_0x216499={'count':0x0,'rows':[]};var _0x234be8=_[_0xb3b2('0x2e')](db['VoiceQueueReport']['rawAttributes'],function(_0x52dbc2){return{'name':_0x52dbc2['fieldName'],'type':_0x52dbc2[_0xb3b2('0x2f')][_0xb3b2('0x30')]};});_0x44a28d[_0xb3b2('0x31')]=_[_0xb3b2('0x2e')](_0x234be8,_0xb3b2('0x2b'));_0x44a28d[_0xb3b2('0x32')]=_['keys'](_0x546f57[_0xb3b2('0x32')]);_0x44a28d[_0xb3b2('0x33')]=_[_0xb3b2('0x34')](_0x44a28d[_0xb3b2('0x31')],_0x44a28d[_0xb3b2('0x32')]);_0x419395[_0xb3b2('0x35')]=_[_0xb3b2('0x34')](_0x44a28d[_0xb3b2('0x31')],qs['fields'](_0x546f57[_0xb3b2('0x32')][_0xb3b2('0x36')]));_0x419395[_0xb3b2('0x35')]=_0x419395[_0xb3b2('0x35')][_0xb3b2('0x37')]?_0x419395['attributes']:_0x44a28d[_0xb3b2('0x31')];if(!_0x546f57[_0xb3b2('0x32')]['hasOwnProperty'](_0xb3b2('0x38'))){_0x419395[_0xb3b2('0x25')]=qs['limit'](_0x546f57[_0xb3b2('0x32')]['limit']);_0x419395[_0xb3b2('0x22')]=qs['offset'](_0x546f57['query'][_0xb3b2('0x22')]);}_0x419395[_0xb3b2('0x39')]=qs[_0xb3b2('0x3a')](_0x546f57['query'][_0xb3b2('0x3a')]);_0x419395[_0xb3b2('0x3b')]=qs[_0xb3b2('0x33')](_[_0xb3b2('0x3c')](_0x546f57[_0xb3b2('0x32')],_0x44a28d['filters']),_0x234be8);if(_0x546f57[_0xb3b2('0x32')][_0xb3b2('0x3d')]){_0x419395[_0xb3b2('0x3b')]=_[_0xb3b2('0x3e')](_0x419395[_0xb3b2('0x3b')],{'$or':_[_0xb3b2('0x2e')](_0x234be8,function(_0x57a59c){if(_0x57a59c[_0xb3b2('0x2f')]!==_0xb3b2('0x3f')){var _0x229822={};_0x229822[_0x57a59c[_0xb3b2('0x2b')]]={'$like':'%'+_0x546f57[_0xb3b2('0x32')][_0xb3b2('0x3d')]+'%'};return _0x229822;}})});}_0x419395=_[_0xb3b2('0x3e')]({},_0x419395,_0x546f57['options']);var _0x39169d={'where':_0x419395[_0xb3b2('0x3b')]};return db['VoiceQueueReport'][_0xb3b2('0x24')](_0x39169d)[_0xb3b2('0x40')](function(_0x56af69){_0x216499['count']=_0x56af69;if(_0x546f57[_0xb3b2('0x32')]['includeAll']){_0x419395[_0xb3b2('0x41')]=[{'all':!![]}];}return db[_0xb3b2('0x42')][_0xb3b2('0x43')](_0x419395);})[_0xb3b2('0x40')](function(_0x3e9a2a){_0x216499[_0xb3b2('0x44')]=_0x3e9a2a;return _0x216499;})[_0xb3b2('0x40')](respondWithFilteredResult(_0x3b3fab,_0x419395))[_0xb3b2('0x45')](handleError(_0x3b3fab,null));};exports[_0xb3b2('0x46')]=function(_0x18901f,_0x3ba67b){var _0x30e1ee={'raw':![],'where':{'id':_0x18901f[_0xb3b2('0x47')]['id']}},_0x50f814={};_0x50f814[_0xb3b2('0x31')]=_[_0xb3b2('0x48')](db[_0xb3b2('0x42')][_0xb3b2('0x49')]);_0x50f814[_0xb3b2('0x32')]=_[_0xb3b2('0x48')](_0x18901f[_0xb3b2('0x32')]);_0x50f814['filters']=_[_0xb3b2('0x34')](_0x50f814[_0xb3b2('0x31')],_0x50f814[_0xb3b2('0x32')]);_0x30e1ee[_0xb3b2('0x35')]=_[_0xb3b2('0x34')](_0x50f814[_0xb3b2('0x31')],qs[_0xb3b2('0x36')](_0x18901f[_0xb3b2('0x32')][_0xb3b2('0x36')]));_0x30e1ee[_0xb3b2('0x35')]=_0x30e1ee[_0xb3b2('0x35')][_0xb3b2('0x37')]?_0x30e1ee[_0xb3b2('0x35')]:_0x50f814[_0xb3b2('0x31')];if(_0x18901f[_0xb3b2('0x32')]['includeAll']){_0x30e1ee[_0xb3b2('0x41')]=[{'all':!![]}];}_0x30e1ee=_['merge']({},_0x30e1ee,_0x18901f['options']);return db['VoiceQueueReport'][_0xb3b2('0x4a')](_0x30e1ee)['then'](handleEntityNotFound(_0x3ba67b,null))[_0xb3b2('0x40')](respondWithResult(_0x3ba67b,null))[_0xb3b2('0x45')](handleError(_0x3ba67b,null));};exports[_0xb3b2('0x4b')]=function(_0x3b9d47,_0x4fccfe){return db[_0xb3b2('0x42')][_0xb3b2('0x4b')](_0x3b9d47['body'],{})[_0xb3b2('0x40')](respondWithResult(_0x4fccfe,0xc9))[_0xb3b2('0x45')](handleError(_0x4fccfe,null));};exports['update']=function(_0x43803c,_0x19a82e){if(_0x43803c[_0xb3b2('0x4c')]['id']){delete _0x43803c[_0xb3b2('0x4c')]['id'];}return db['VoiceQueueReport'][_0xb3b2('0x4a')]({'where':{'id':_0x43803c[_0xb3b2('0x47')]['id']}})[_0xb3b2('0x40')](handleEntityNotFound(_0x19a82e,null))[_0xb3b2('0x40')](saveUpdates(_0x43803c['body'],null))[_0xb3b2('0x40')](respondWithResult(_0x19a82e,null))[_0xb3b2('0x45')](handleError(_0x19a82e,null));};exports[_0xb3b2('0x29')]=function(_0x1a6cff,_0x275ee4){return db['VoiceQueueReport'][_0xb3b2('0x4a')]({'where':{'id':_0x1a6cff[_0xb3b2('0x47')]['id']}})[_0xb3b2('0x40')](handleEntityNotFound(_0x275ee4,null))[_0xb3b2('0x40')](removeEntity(_0x275ee4,null))[_0xb3b2('0x45')](handleError(_0x275ee4,null));};exports['describe']=function(_0x207257,_0x2af88f){return db['VoiceQueueReport'][_0xb3b2('0x4d')]()['then'](respondWithResult(_0x2af88f,null))[_0xb3b2('0x45')](handleError(_0x2af88f,null));};exports[_0xb3b2('0x4e')]=function(_0x96ff72,_0x58f5c8){var _0x15da35={},_0x4be87d={},_0x20c421={'count':0x0,'rows':[]};_0x4be87d[_0xb3b2('0x31')]=_[_0xb3b2('0x48')](db[_0xb3b2('0x42')][_0xb3b2('0x49')]);_0x4be87d[_0xb3b2('0x32')]=_[_0xb3b2('0x48')](_0x96ff72[_0xb3b2('0x32')]);_0x4be87d[_0xb3b2('0x33')]=_[_0xb3b2('0x34')](_0x4be87d[_0xb3b2('0x31')],_0x4be87d['query']);_0x15da35[_0xb3b2('0x35')]=_[_0xb3b2('0x34')](_0x4be87d[_0xb3b2('0x31')],qs[_0xb3b2('0x36')](_0x96ff72[_0xb3b2('0x32')][_0xb3b2('0x36')]));_0x15da35[_0xb3b2('0x35')]=_0x15da35[_0xb3b2('0x35')][_0xb3b2('0x37')]?_0x15da35[_0xb3b2('0x35')]:_0x4be87d['model'];if(!_0x96ff72['query'][_0xb3b2('0x4f')](_0xb3b2('0x38'))){_0x15da35['limit']=qs[_0xb3b2('0x25')](_0x96ff72[_0xb3b2('0x32')][_0xb3b2('0x25')]);_0x15da35[_0xb3b2('0x22')]=qs[_0xb3b2('0x22')](_0x96ff72[_0xb3b2('0x32')][_0xb3b2('0x22')]);}_0x15da35[_0xb3b2('0x39')]=qs[_0xb3b2('0x3a')](_0x96ff72[_0xb3b2('0x32')][_0xb3b2('0x3a')]);_0x15da35['where']=qs[_0xb3b2('0x33')](_['pick'](_0x96ff72[_0xb3b2('0x32')],_0x4be87d[_0xb3b2('0x33')]));if(_0x96ff72['query'][_0xb3b2('0x3d')]){_0x15da35[_0xb3b2('0x3b')]=_[_0xb3b2('0x3e')](_0x15da35['where'],{'$or':_['map'](_0x15da35['attributes'],function(_0x594ede){var _0x4149dc={};_0x4149dc[_0x594ede]={'$like':'%'+_0x96ff72[_0xb3b2('0x32')]['filter']+'%'};return _0x4149dc;})});}_0x15da35=_[_0xb3b2('0x3e')]({},_0x15da35,_0x96ff72[_0xb3b2('0x50')]);var _0xb83744={'where':_0x15da35[_0xb3b2('0x3b')]};return db[_0xb3b2('0x42')][_0xb3b2('0x24')](_0xb83744)[_0xb3b2('0x40')](function(_0x41f2db){_0x20c421[_0xb3b2('0x24')]=_0x41f2db;if(_0x96ff72[_0xb3b2('0x32')]['includeAll']){_0x15da35['include']=[{'all':!![]}];}return db[_0xb3b2('0x42')][_0xb3b2('0x43')](_0x15da35);})['then'](function(_0x4b9826){_0x20c421[_0xb3b2('0x44')]=_0x4b9826;return _0x20c421;})['then'](respondWithFilteredResult(_0x58f5c8,_0x15da35,'getVoiceQueuesReport'))[_0xb3b2('0x45')](handleError(_0x58f5c8,null,_0xb3b2('0x4e')));}; \ No newline at end of file +var _0x9b25=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','update','destroy','describe','getVoiceQueuesReport','order','rows','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x830994,_0x4e0a64){var _0x52a8b=function(_0x415c2c){while(--_0x415c2c){_0x830994['push'](_0x830994['shift']());}};_0x52a8b(++_0x4e0a64);}(_0x9b25,0x1f1));var _0x59b2=function(_0x1df64e,_0x16aace){_0x1df64e=_0x1df64e-0x0;var _0x4459de=_0x9b25[_0x1df64e];return _0x4459de;};'use strict';var emlformat=require(_0x59b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59b2('0x1'));var jsonpatch=require(_0x59b2('0x2'));var rp=require('request-promise');var moment=require(_0x59b2('0x3'));var BPromise=require(_0x59b2('0x4'));var Mustache=require(_0x59b2('0x5'));var util=require(_0x59b2('0x6'));var path=require('path');var sox=require(_0x59b2('0x7'));var csv=require(_0x59b2('0x8'));var ejs=require(_0x59b2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59b2('0xa'));var squel=require(_0x59b2('0xb'));var crypto=require(_0x59b2('0xc'));var jsforce=require(_0x59b2('0xd'));var deskjs=require(_0x59b2('0xe'));var toCsv=require(_0x59b2('0x8'));var querystring=require(_0x59b2('0xf'));var Papa=require(_0x59b2('0x10'));var Redis=require('ioredis');var authService=require(_0x59b2('0x11'));var qs=require(_0x59b2('0x12'));var as=require(_0x59b2('0x13'));var hardwareService=require(_0x59b2('0x14'));var logger=require(_0x59b2('0x15'))('api');var utils=require(_0x59b2('0x16'));var config=require(_0x59b2('0x17'));var licenseUtil=require(_0x59b2('0x18'));var db=require('../../mysqldb')['db'];config[_0x59b2('0x19')]=_[_0x59b2('0x1a')](config[_0x59b2('0x19')],{'host':_0x59b2('0x1b'),'port':0x18eb});var socket=require(_0x59b2('0x1c'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x59b2('0x1d')](socket);function respondWithStatusCode(_0x2c717d,_0x3552ee){_0x3552ee=_0x3552ee||0xcc;return function(_0x447096){if(_0x447096){return _0x2c717d[_0x59b2('0x1e')](_0x3552ee);}return _0x2c717d['status'](_0x3552ee)[_0x59b2('0x1f')]();};}function respondWithResult(_0x5339e7,_0x578d38){_0x578d38=_0x578d38||0xc8;return function(_0xf4a873){if(_0xf4a873){return _0x5339e7[_0x59b2('0x20')](_0x578d38)['json'](_0xf4a873);}};}function respondWithFilteredResult(_0x52e66d,_0x440984){return function(_0x394167){if(_0x394167){var _0x5cf3e9=typeof _0x440984[_0x59b2('0x21')]==='undefined'&&typeof _0x440984['limit']===_0x59b2('0x22');var _0x4bd85b=_0x394167['count'];var _0x191c87=_0x5cf3e9?0x0:_0x440984[_0x59b2('0x21')];var _0x2805e9=_0x5cf3e9?_0x394167[_0x59b2('0x23')]:_0x440984[_0x59b2('0x21')]+_0x440984[_0x59b2('0x24')];var _0x30b76c;if(_0x2805e9>=_0x4bd85b){_0x2805e9=_0x4bd85b;_0x30b76c=0xc8;}else{_0x30b76c=0xce;}_0x52e66d[_0x59b2('0x20')](_0x30b76c);return _0x52e66d[_0x59b2('0x25')](_0x59b2('0x26'),_0x191c87+'-'+_0x2805e9+'/'+_0x4bd85b)[_0x59b2('0x27')](_0x394167);}return null;};}function patchUpdates(_0x23f1be){return function(_0x411eae){try{jsonpatch[_0x59b2('0x28')](_0x411eae,_0x23f1be,!![]);}catch(_0x106f55){return BPromise[_0x59b2('0x29')](_0x106f55);}return _0x411eae[_0x59b2('0x2a')]();};}function saveUpdates(_0x4f014a,_0x1c9b61){return function(_0x148386){if(_0x148386){return _0x148386['update'](_0x4f014a)['then'](function(_0x4aa7b5){return _0x4aa7b5;});}return null;};}function removeEntity(_0x1bfc11,_0x50d820){return function(_0x19a997){if(_0x19a997){return _0x19a997['destroy']()[_0x59b2('0x2b')](function(){_0x1bfc11['status'](0xcc)[_0x59b2('0x1f')]();});}};}function handleEntityNotFound(_0x252a86,_0x48f0ae){return function(_0x61456c){if(!_0x61456c){_0x252a86[_0x59b2('0x1e')](0x194);}return _0x61456c;};}function handleError(_0xfc43b9,_0x2cfe13){_0x2cfe13=_0x2cfe13||0x1f4;return function(_0x2c865c){logger[_0x59b2('0x2c')](_0x2c865c[_0x59b2('0x2d')]);if(_0x2c865c[_0x59b2('0x2e')]){delete _0x2c865c[_0x59b2('0x2e')];}_0xfc43b9[_0x59b2('0x20')](_0x2cfe13)[_0x59b2('0x2f')](_0x2c865c);};}exports[_0x59b2('0x30')]=function(_0x4900ee,_0x50d883){var _0x5f19f3={},_0x30e9b4={},_0x490909={'count':0x0,'rows':[]};var _0x403560=_[_0x59b2('0x31')](db[_0x59b2('0x32')][_0x59b2('0x33')],function(_0xef279f){return{'name':_0xef279f['fieldName'],'type':_0xef279f[_0x59b2('0x34')]['key']};});_0x30e9b4[_0x59b2('0x35')]=_[_0x59b2('0x31')](_0x403560,_0x59b2('0x2e'));_0x30e9b4[_0x59b2('0x36')]=_[_0x59b2('0x37')](_0x4900ee[_0x59b2('0x36')]);_0x30e9b4['filters']=_[_0x59b2('0x38')](_0x30e9b4[_0x59b2('0x35')],_0x30e9b4[_0x59b2('0x36')]);_0x5f19f3[_0x59b2('0x39')]=_[_0x59b2('0x38')](_0x30e9b4['model'],qs[_0x59b2('0x3a')](_0x4900ee[_0x59b2('0x36')]['fields']));_0x5f19f3[_0x59b2('0x39')]=_0x5f19f3[_0x59b2('0x39')][_0x59b2('0x3b')]?_0x5f19f3[_0x59b2('0x39')]:_0x30e9b4['model'];if(!_0x4900ee[_0x59b2('0x36')][_0x59b2('0x3c')](_0x59b2('0x3d'))){_0x5f19f3[_0x59b2('0x24')]=qs[_0x59b2('0x24')](_0x4900ee[_0x59b2('0x36')][_0x59b2('0x24')]);_0x5f19f3[_0x59b2('0x21')]=qs[_0x59b2('0x21')](_0x4900ee['query'][_0x59b2('0x21')]);}_0x5f19f3['order']=qs[_0x59b2('0x3e')](_0x4900ee[_0x59b2('0x36')][_0x59b2('0x3e')]);_0x5f19f3[_0x59b2('0x3f')]=qs['filters'](_[_0x59b2('0x40')](_0x4900ee[_0x59b2('0x36')],_0x30e9b4[_0x59b2('0x41')]),_0x403560);if(_0x4900ee[_0x59b2('0x36')][_0x59b2('0x42')]){_0x5f19f3['where']=_[_0x59b2('0x43')](_0x5f19f3[_0x59b2('0x3f')],{'$or':_['map'](_0x403560,function(_0x54a15f){if(_0x54a15f[_0x59b2('0x34')]!=='VIRTUAL'){var _0x25ff6a={};_0x25ff6a[_0x54a15f['name']]={'$like':'%'+_0x4900ee[_0x59b2('0x36')]['filter']+'%'};return _0x25ff6a;}})});}_0x5f19f3=_[_0x59b2('0x43')]({},_0x5f19f3,_0x4900ee[_0x59b2('0x44')]);var _0x18e5a6={'where':_0x5f19f3[_0x59b2('0x3f')]};return db[_0x59b2('0x32')]['count'](_0x18e5a6)[_0x59b2('0x2b')](function(_0x48dc3a){_0x490909['count']=_0x48dc3a;if(_0x4900ee[_0x59b2('0x36')][_0x59b2('0x45')]){_0x5f19f3['include']=[{'all':!![]}];}return db[_0x59b2('0x32')][_0x59b2('0x46')](_0x5f19f3);})[_0x59b2('0x2b')](function(_0x56b78b){_0x490909['rows']=_0x56b78b;return _0x490909;})[_0x59b2('0x2b')](respondWithFilteredResult(_0x50d883,_0x5f19f3))[_0x59b2('0x47')](handleError(_0x50d883,null));};exports[_0x59b2('0x48')]=function(_0x31ef7a,_0x241b49){var _0x3c590c={'raw':![],'where':{'id':_0x31ef7a[_0x59b2('0x49')]['id']}},_0x3f5e52={};_0x3f5e52['model']=_[_0x59b2('0x37')](db[_0x59b2('0x32')][_0x59b2('0x33')]);_0x3f5e52[_0x59b2('0x36')]=_[_0x59b2('0x37')](_0x31ef7a[_0x59b2('0x36')]);_0x3f5e52[_0x59b2('0x41')]=_['intersection'](_0x3f5e52['model'],_0x3f5e52['query']);_0x3c590c['attributes']=_[_0x59b2('0x38')](_0x3f5e52[_0x59b2('0x35')],qs[_0x59b2('0x3a')](_0x31ef7a[_0x59b2('0x36')][_0x59b2('0x3a')]));_0x3c590c['attributes']=_0x3c590c['attributes'][_0x59b2('0x3b')]?_0x3c590c['attributes']:_0x3f5e52[_0x59b2('0x35')];if(_0x31ef7a[_0x59b2('0x36')][_0x59b2('0x45')]){_0x3c590c[_0x59b2('0x4a')]=[{'all':!![]}];}_0x3c590c=_[_0x59b2('0x43')]({},_0x3c590c,_0x31ef7a[_0x59b2('0x44')]);return db[_0x59b2('0x32')][_0x59b2('0x4b')](_0x3c590c)[_0x59b2('0x2b')](handleEntityNotFound(_0x241b49,null))[_0x59b2('0x2b')](respondWithResult(_0x241b49,null))[_0x59b2('0x47')](handleError(_0x241b49,null));};exports[_0x59b2('0x4c')]=function(_0x3f3318,_0x21d0a6){return db[_0x59b2('0x32')][_0x59b2('0x4c')](_0x3f3318[_0x59b2('0x4d')],{})[_0x59b2('0x2b')](respondWithResult(_0x21d0a6,0xc9))['catch'](handleError(_0x21d0a6,null));};exports[_0x59b2('0x4e')]=function(_0x2d0b82,_0x3ede9a){if(_0x2d0b82[_0x59b2('0x4d')]['id']){delete _0x2d0b82[_0x59b2('0x4d')]['id'];}return db[_0x59b2('0x32')][_0x59b2('0x4b')]({'where':{'id':_0x2d0b82['params']['id']}})[_0x59b2('0x2b')](handleEntityNotFound(_0x3ede9a,null))[_0x59b2('0x2b')](saveUpdates(_0x2d0b82[_0x59b2('0x4d')],null))[_0x59b2('0x2b')](respondWithResult(_0x3ede9a,null))[_0x59b2('0x47')](handleError(_0x3ede9a,null));};exports[_0x59b2('0x4f')]=function(_0x26a882,_0x50f3ae){return db[_0x59b2('0x32')]['find']({'where':{'id':_0x26a882[_0x59b2('0x49')]['id']}})[_0x59b2('0x2b')](handleEntityNotFound(_0x50f3ae,null))[_0x59b2('0x2b')](removeEntity(_0x50f3ae,null))[_0x59b2('0x47')](handleError(_0x50f3ae,null));};exports['describe']=function(_0x5baac7,_0x2876fd){return db[_0x59b2('0x32')][_0x59b2('0x50')]()[_0x59b2('0x2b')](respondWithResult(_0x2876fd,null))['catch'](handleError(_0x2876fd,null));};exports[_0x59b2('0x51')]=function(_0x427810,_0x27a40d){var _0x237692={},_0x9e063d={},_0x220720={'count':0x0,'rows':[]};_0x9e063d[_0x59b2('0x35')]=_[_0x59b2('0x37')](db[_0x59b2('0x32')][_0x59b2('0x33')]);_0x9e063d[_0x59b2('0x36')]=_[_0x59b2('0x37')](_0x427810[_0x59b2('0x36')]);_0x9e063d['filters']=_['intersection'](_0x9e063d['model'],_0x9e063d[_0x59b2('0x36')]);_0x237692['attributes']=_[_0x59b2('0x38')](_0x9e063d[_0x59b2('0x35')],qs[_0x59b2('0x3a')](_0x427810[_0x59b2('0x36')]['fields']));_0x237692[_0x59b2('0x39')]=_0x237692['attributes'][_0x59b2('0x3b')]?_0x237692['attributes']:_0x9e063d[_0x59b2('0x35')];if(!_0x427810[_0x59b2('0x36')][_0x59b2('0x3c')]('nolimit')){_0x237692[_0x59b2('0x24')]=qs['limit'](_0x427810['query'][_0x59b2('0x24')]);_0x237692[_0x59b2('0x21')]=qs['offset'](_0x427810[_0x59b2('0x36')][_0x59b2('0x21')]);}_0x237692[_0x59b2('0x52')]=qs[_0x59b2('0x3e')](_0x427810['query'][_0x59b2('0x3e')]);_0x237692[_0x59b2('0x3f')]=qs[_0x59b2('0x41')](_[_0x59b2('0x40')](_0x427810[_0x59b2('0x36')],_0x9e063d['filters']));if(_0x427810[_0x59b2('0x36')][_0x59b2('0x42')]){_0x237692[_0x59b2('0x3f')]=_[_0x59b2('0x43')](_0x237692[_0x59b2('0x3f')],{'$or':_[_0x59b2('0x31')](_0x237692['attributes'],function(_0x5b6096){var _0x27ede2={};_0x27ede2[_0x5b6096]={'$like':'%'+_0x427810['query'][_0x59b2('0x42')]+'%'};return _0x27ede2;})});}_0x237692=_[_0x59b2('0x43')]({},_0x237692,_0x427810[_0x59b2('0x44')]);var _0x4e7041={'where':_0x237692[_0x59b2('0x3f')]};return db[_0x59b2('0x32')][_0x59b2('0x23')](_0x4e7041)[_0x59b2('0x2b')](function(_0x351ec1){_0x220720[_0x59b2('0x23')]=_0x351ec1;if(_0x427810[_0x59b2('0x36')][_0x59b2('0x45')]){_0x237692[_0x59b2('0x4a')]=[{'all':!![]}];}return db[_0x59b2('0x32')][_0x59b2('0x46')](_0x237692);})[_0x59b2('0x2b')](function(_0x31d974){_0x220720[_0x59b2('0x53')]=_0x31d974;return _0x220720;})[_0x59b2('0x2b')](respondWithFilteredResult(_0x27a40d,_0x237692,_0x59b2('0x51')))['catch'](handleError(_0x27a40d,null,_0x59b2('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 12434cc..6642168 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 _0xc864=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x34d57c,_0x114150){var _0x2b01ad=function(_0xd77311){while(--_0xd77311){_0x34d57c['push'](_0x34d57c['shift']());}};_0x2b01ad(++_0x114150);}(_0xc864,0x1a6));var _0x4c86=function(_0xc62010,_0x18db7d){_0xc62010=_0xc62010-0x0;var _0x5777bf=_0xc864[_0xc62010];return _0x5777bf;};'use strict';var EventEmitter=require(_0x4c86('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x4c86('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4c86('0x2')](0x0);var events={'afterCreate':_0x4c86('0x3'),'afterUpdate':_0x4c86('0x4'),'afterDestroy':_0x4c86('0x5')};function emitEvent(_0x57620d){return function(_0x103bf7,_0x277834,_0x239172){VoiceQueueReportEvents[_0x4c86('0x6')](_0x57620d+':'+_0x103bf7['id'],_0x103bf7);VoiceQueueReportEvents['emit'](_0x57620d,_0x103bf7);_0x239172(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x4c86('0x7')](e,emitEvent(event));}}module[_0x4c86('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x3b59=['events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x32060f,_0x1ad0fc){var _0x4e0ade=function(_0x223b7f){while(--_0x223b7f){_0x32060f['push'](_0x32060f['shift']());}};_0x4e0ade(++_0x1ad0fc);}(_0x3b59,0xf0));var _0x93b5=function(_0x4c0989,_0x6bc56d){_0x4c0989=_0x4c0989-0x0;var _0x3bcd00=_0x3b59[_0x4c0989];return _0x3bcd00;};'use strict';var EventEmitter=require(_0x93b5('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x93b5('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x93b5('0x2')](0x0);var events={'afterCreate':_0x93b5('0x3'),'afterUpdate':_0x93b5('0x4'),'afterDestroy':_0x93b5('0x5')};function emitEvent(_0x4d81fc){return function(_0x3f3bad,_0x46e16b,_0x55a7cb){VoiceQueueReportEvents[_0x93b5('0x6')](_0x4d81fc+':'+_0x3f3bad['id'],_0x3f3bad);VoiceQueueReportEvents['emit'](_0x4d81fc,_0x3f3bad);_0x55a7cb(null);};}for(var e in events){if(events[_0x93b5('0x7')](e)){var event=events[e];VoiceQueueReport[_0x93b5('0x8')](e,emitEvent(event));}}module[_0x93b5('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index dad5713..e71b100 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 _0xc616=['uniqueid','util','../../config/logger','request-promise','rimraf','./voiceQueueReport.attributes','exports','define'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0xc616,0x1f1));var _0x6c61=function(_0x31080a,_0x55b5cd){_0x31080a=_0x31080a-0x0;var _0x58d2fc=_0xc616[_0x31080a];return _0x58d2fc;};'use strict';var _=require('lodash');var util=require(_0x6c61('0x0'));var logger=require(_0x6c61('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6c61('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c61('0x3'));var config=require('../../config/environment');var attributes=require(_0x6c61('0x4'));module[_0x6c61('0x5')]=function(_0x1a9e70,_0x21cd39){return _0x1a9e70[_0x6c61('0x6')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x6c61('0x7')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6e8=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xd6e8,0x166));var _0x8d6e=function(_0x1c212f,_0x59d13f){_0x1c212f=_0x1c212f-0x0;var _0x212fee=_0xd6e8[_0x1c212f];return _0x212fee;};'use strict';var _=require(_0x8d6e('0x0'));var util=require(_0x8d6e('0x1'));var logger=require(_0x8d6e('0x2'))(_0x8d6e('0x3'));var moment=require('moment');var BPromise=require(_0x8d6e('0x4'));var rp=require(_0x8d6e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d6e('0x6'));var config=require(_0x8d6e('0x7'));var attributes=require(_0x8d6e('0x8'));module[_0x8d6e('0x9')]=function(_0x448ee1,_0x4b5506){return _0x448ee1['define']('VoiceQueueReport',attributes,{'tableName':_0x8d6e('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8d6e('0xb')]},{'fields':[_0x8d6e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 4477c4a..10f459c 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 _0x4802=['socket.io-emitter','register','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','debug','catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x4802,0xef));var _0x2480=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4802[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2480('0x0'));var BPromise=require(_0x2480('0x1'));var rs=require(_0x2480('0x2'));var fs=require('fs');var Redis=require(_0x2480('0x3'));var db=require(_0x2480('0x4'))['db'];var utils=require(_0x2480('0x5'));var logger=require(_0x2480('0x6'))(_0x2480('0x7'));var config=require(_0x2480('0x8'));var jayson=require(_0x2480('0x9'));var client=jayson[_0x2480('0xa')][_0x2480('0xb')]({'port':0x232a});config[_0x2480('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2480('0xd'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x2480('0xe')](socket);function respondWithRpcPromise(_0x399466,_0x21fb19,_0x4cbe13){return new BPromise(function(_0xc3492b,_0x3d47a3){return client['request'](_0x399466,_0x4cbe13)[_0x2480('0xf')](function(_0x5b9be3){logger[_0x2480('0x10')](_0x2480('0x11'),_0x21fb19,'request\x20sent');logger['debug'](_0x2480('0x12'),_0x21fb19,_0x2480('0x13'),JSON[_0x2480('0x14')](_0x5b9be3));if(_0x5b9be3[_0x2480('0x15')]){if(_0x5b9be3[_0x2480('0x15')][_0x2480('0x16')]===0x1f4){logger[_0x2480('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x21fb19,_0x5b9be3[_0x2480('0x15')]['message']);return _0x3d47a3(_0x5b9be3[_0x2480('0x15')][_0x2480('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x21fb19,_0x5b9be3[_0x2480('0x15')]['message']);return _0xc3492b(_0x5b9be3['error']['message']);}else{logger[_0x2480('0x10')](_0x2480('0x11'),_0x21fb19,_0x2480('0x13'));_0xc3492b(_0x5b9be3[_0x2480('0x18')]['message']);}})['catch'](function(_0x50a0cb){logger['error'](_0x2480('0x11'),_0x21fb19,_0x50a0cb);_0x3d47a3(_0x50a0cb);});});}exports[_0x2480('0x19')]=function(_0x5a460a){var _0x37aff6=this;return new Promise(function(_0x346163,_0x164c97){return db[_0x2480('0x1a')]['findAll']({'raw':_0x5a460a[_0x2480('0x1b')]?_0x5a460a['options'][_0x2480('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a460a[_0x2480('0x1b')]?_0x5a460a[_0x2480('0x1b')][_0x2480('0x1d')]||null:null,'attributes':_0x5a460a[_0x2480('0x1b')]?_0x5a460a[_0x2480('0x1b')][_0x2480('0x1e')]||null:null,'limit':_0x5a460a[_0x2480('0x1b')]?_0x5a460a[_0x2480('0x1b')][_0x2480('0x1f')]||null:null,'include':_0x5a460a['options']?_0x5a460a[_0x2480('0x1b')][_0x2480('0x20')]?_[_0x2480('0x21')](_0x5a460a[_0x2480('0x1b')][_0x2480('0x20')],function(_0x3375f3){return{'model':db[_0x3375f3[_0x2480('0x22')]],'as':_0x3375f3['as'],'attributes':_0x3375f3[_0x2480('0x1e')],'include':_0x3375f3[_0x2480('0x20')]?_[_0x2480('0x21')](_0x3375f3['include'],function(_0x316182){return{'model':db[_0x316182[_0x2480('0x22')]],'as':_0x316182['as'],'attributes':_0x316182['attributes'],'include':_0x316182[_0x2480('0x20')]?_[_0x2480('0x21')](_0x316182[_0x2480('0x20')],function(_0x494636){return{'model':db[_0x494636[_0x2480('0x22')]],'as':_0x494636['as'],'attributes':_0x494636[_0x2480('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2480('0xf')](function(_0x53b796){logger[_0x2480('0x10')](_0x2480('0x19'),_0x5a460a);logger[_0x2480('0x23')]('GetVoiceQueueReport',_0x5a460a,JSON['stringify'](_0x53b796));_0x346163(_0x53b796);})[_0x2480('0x24')](function(_0x5352e1){logger['error']('GetVoiceQueueReport',_0x5352e1[_0x2480('0x17')],_0x5a460a);_0x164c97(_0x37aff6[_0x2480('0x15')](0x1f4,_0x5352e1[_0x2480('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0xfeaf1d){var _0x4f718e=this;return new Promise(function(_0x2fde67,_0x555165){return db['VoiceQueueReport'][_0x2480('0x25')](_0xfeaf1d[_0x2480('0x26')],{'raw':_0xfeaf1d[_0x2480('0x1b')]?_0xfeaf1d['options'][_0x2480('0x1c')]===undefined?!![]:![]:!![]})[_0x2480('0xf')](function(_0x3d2d8a){logger[_0x2480('0x10')](_0x2480('0x27'),_0xfeaf1d);logger[_0x2480('0x23')](_0x2480('0x27'),_0xfeaf1d,JSON[_0x2480('0x14')](_0x3d2d8a));_0x2fde67(_0x3d2d8a);})['catch'](function(_0x1a2720){logger[_0x2480('0x15')](_0x2480('0x27'),_0x1a2720[_0x2480('0x17')],_0xfeaf1d);_0x555165(_0x4f718e[_0x2480('0x15')](0x1f4,_0x1a2720[_0x2480('0x17')]));});});};exports[_0x2480('0x28')]=function(_0xae8554){var _0x31819b=this;return new Promise(function(_0xcb032a,_0x5ac61a){return db['VoiceQueueReport'][_0x2480('0x29')](_0xae8554[_0x2480('0x26')],{'raw':_0xae8554[_0x2480('0x1b')]?_0xae8554[_0x2480('0x1b')][_0x2480('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xae8554[_0x2480('0x1b')]?_0xae8554['options']['where']||null:null,'attributes':_0xae8554[_0x2480('0x1b')]?_0xae8554['options']['attributes']||null:null,'limit':_0xae8554[_0x2480('0x1b')]?_0xae8554[_0x2480('0x1b')][_0x2480('0x1f')]||null:null})[_0x2480('0xf')](function(_0xe94ab7){logger[_0x2480('0x10')]('UpdateVoiceQueueReport',_0xae8554);logger[_0x2480('0x23')](_0x2480('0x28'),_0xae8554,JSON['stringify'](_0xe94ab7));_0xcb032a(_0xe94ab7);})[_0x2480('0x24')](function(_0x20b6f3){logger[_0x2480('0x15')](_0x2480('0x28'),_0x20b6f3[_0x2480('0x17')],_0xae8554);_0x5ac61a(_0x31819b[_0x2480('0x15')](0x1f4,_0x20b6f3[_0x2480('0x17')]));});});}; \ No newline at end of file +var _0xda94=['stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xda94,0xec));var _0x4da9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xda94[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x4da9('0x0'));var util=require(_0x4da9('0x1'));var moment=require(_0x4da9('0x2'));var BPromise=require(_0x4da9('0x3'));var rs=require(_0x4da9('0x4'));var fs=require('fs');var Redis=require(_0x4da9('0x5'));var db=require(_0x4da9('0x6'))['db'];var utils=require(_0x4da9('0x7'));var logger=require(_0x4da9('0x8'))(_0x4da9('0x9'));var config=require(_0x4da9('0xa'));var jayson=require(_0x4da9('0xb'));var client=jayson[_0x4da9('0xc')]['http']({'port':0x232a});config[_0x4da9('0xd')]=_[_0x4da9('0xe')](config[_0x4da9('0xd')],{'host':_0x4da9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4da9('0xd')]));require('./voiceQueueReport.socket')[_0x4da9('0x10')](socket);function respondWithRpcPromise(_0x4a9bfe,_0xdfff6e,_0x3ff9ab){return new BPromise(function(_0x24ceed,_0x217a0d){return client[_0x4da9('0x11')](_0x4a9bfe,_0x3ff9ab)[_0x4da9('0x12')](function(_0x414b09){logger[_0x4da9('0x13')](_0x4da9('0x14'),_0xdfff6e,_0x4da9('0x15'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0xdfff6e,'request\x20sent',JSON[_0x4da9('0x16')](_0x414b09));if(_0x414b09[_0x4da9('0x17')]){if(_0x414b09['error']['code']===0x1f4){logger[_0x4da9('0x17')](_0x4da9('0x14'),_0xdfff6e,_0x414b09['error'][_0x4da9('0x18')]);return _0x217a0d(_0x414b09[_0x4da9('0x17')][_0x4da9('0x18')]);}logger[_0x4da9('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0xdfff6e,_0x414b09['error'][_0x4da9('0x18')]);return _0x24ceed(_0x414b09[_0x4da9('0x17')][_0x4da9('0x18')]);}else{logger[_0x4da9('0x13')](_0x4da9('0x14'),_0xdfff6e,'request\x20sent');_0x24ceed(_0x414b09[_0x4da9('0x19')][_0x4da9('0x18')]);}})[_0x4da9('0x1a')](function(_0x218c66){logger[_0x4da9('0x17')](_0x4da9('0x14'),_0xdfff6e,_0x218c66);_0x217a0d(_0x218c66);});});}exports[_0x4da9('0x1b')]=function(_0x150fd7){var _0x39e976=this;return new Promise(function(_0x11c380,_0x21bdb6){return db[_0x4da9('0x1c')]['findAll']({'raw':_0x150fd7['options']?_0x150fd7[_0x4da9('0x1d')][_0x4da9('0x1e')]===undefined?!![]:![]:!![],'where':_0x150fd7[_0x4da9('0x1d')]?_0x150fd7['options'][_0x4da9('0x1f')]||null:null,'attributes':_0x150fd7[_0x4da9('0x1d')]?_0x150fd7[_0x4da9('0x1d')][_0x4da9('0x20')]||null:null,'limit':_0x150fd7[_0x4da9('0x1d')]?_0x150fd7[_0x4da9('0x1d')][_0x4da9('0x21')]||null:null,'include':_0x150fd7[_0x4da9('0x1d')]?_0x150fd7[_0x4da9('0x1d')][_0x4da9('0x22')]?_[_0x4da9('0x23')](_0x150fd7[_0x4da9('0x1d')][_0x4da9('0x22')],function(_0x5eabd6){return{'model':db[_0x5eabd6['model']],'as':_0x5eabd6['as'],'attributes':_0x5eabd6[_0x4da9('0x20')],'include':_0x5eabd6[_0x4da9('0x22')]?_[_0x4da9('0x23')](_0x5eabd6[_0x4da9('0x22')],function(_0x253d02){return{'model':db[_0x253d02[_0x4da9('0x24')]],'as':_0x253d02['as'],'attributes':_0x253d02[_0x4da9('0x20')],'include':_0x253d02[_0x4da9('0x22')]?_[_0x4da9('0x23')](_0x253d02['include'],function(_0xf8c86c){return{'model':db[_0xf8c86c[_0x4da9('0x24')]],'as':_0xf8c86c['as'],'attributes':_0xf8c86c[_0x4da9('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x504dd9){logger[_0x4da9('0x13')](_0x4da9('0x1b'),_0x150fd7);logger[_0x4da9('0x25')](_0x4da9('0x1b'),_0x150fd7,JSON['stringify'](_0x504dd9));_0x11c380(_0x504dd9);})[_0x4da9('0x1a')](function(_0x4808e2){logger[_0x4da9('0x17')](_0x4da9('0x1b'),_0x4808e2['message'],_0x150fd7);_0x21bdb6(_0x39e976['error'](0x1f4,_0x4808e2[_0x4da9('0x18')]));});});};exports[_0x4da9('0x26')]=function(_0x338bde){var _0x4d3f93=this;return new Promise(function(_0x539729,_0x29849a){return db['VoiceQueueReport'][_0x4da9('0x27')](_0x338bde['body'],{'raw':_0x338bde[_0x4da9('0x1d')]?_0x338bde['options'][_0x4da9('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x45b468){logger[_0x4da9('0x13')](_0x4da9('0x26'),_0x338bde);logger[_0x4da9('0x25')](_0x4da9('0x26'),_0x338bde,JSON[_0x4da9('0x16')](_0x45b468));_0x539729(_0x45b468);})[_0x4da9('0x1a')](function(_0x4dfdda){logger['error'](_0x4da9('0x26'),_0x4dfdda['message'],_0x338bde);_0x29849a(_0x4d3f93[_0x4da9('0x17')](0x1f4,_0x4dfdda[_0x4da9('0x18')]));});});};exports[_0x4da9('0x28')]=function(_0x45f52e){var _0x53acdf=this;return new Promise(function(_0x472cf1,_0x537eb5){return db[_0x4da9('0x1c')][_0x4da9('0x29')](_0x45f52e[_0x4da9('0x2a')],{'raw':_0x45f52e[_0x4da9('0x1d')]?_0x45f52e[_0x4da9('0x1d')][_0x4da9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f52e[_0x4da9('0x1d')]?_0x45f52e[_0x4da9('0x1d')]['where']||null:null,'attributes':_0x45f52e['options']?_0x45f52e[_0x4da9('0x1d')][_0x4da9('0x20')]||null:null,'limit':_0x45f52e['options']?_0x45f52e[_0x4da9('0x1d')]['limit']||null:null})[_0x4da9('0x12')](function(_0xd59223){logger[_0x4da9('0x13')](_0x4da9('0x28'),_0x45f52e);logger[_0x4da9('0x25')](_0x4da9('0x28'),_0x45f52e,JSON[_0x4da9('0x16')](_0xd59223));_0x472cf1(_0xd59223);})[_0x4da9('0x1a')](function(_0x23afcd){logger[_0x4da9('0x17')](_0x4da9('0x28'),_0x23afcd['message'],_0x45f52e);_0x537eb5(_0x53acdf['error'](0x1f4,_0x23afcd[_0x4da9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 24c6d03..0be150e 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 _0x60c2=['removeListener','register','length','save','remove','update','emit'];(function(_0x3c8af8,_0x4cd367){var _0x14fd3a=function(_0x10e297){while(--_0x10e297){_0x3c8af8['push'](_0x3c8af8['shift']());}};_0x14fd3a(++_0x4cd367);}(_0x60c2,0x8f));var _0x260c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60c2[_0x3947c9];return _0x2e7871;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x260c('0x0'),_0x260c('0x1'),_0x260c('0x2')];function createListener(_0x3ad4c5,_0x2f5bc8){return function(_0x759b92){_0x2f5bc8[_0x260c('0x3')](_0x3ad4c5,_0x759b92);};}function removeListener(_0x309bde,_0x17a599){return function(){VoiceQueueReportEvents[_0x260c('0x4')](_0x309bde,_0x17a599);};}exports[_0x260c('0x5')]=function(_0x13c7d0){for(var _0x558b0c=0x0,_0x14fab2=events[_0x260c('0x6')];_0x558b0c<_0x14fab2;_0x558b0c++){var _0x3b432d=events[_0x558b0c];var _0xf22c37=createListener('voiceQueueReport:'+_0x3b432d,_0x13c7d0);VoiceQueueReportEvents['on'](_0x3b432d,_0xf22c37);}}; \ No newline at end of file +var _0xe2af=['voiceQueueReport:','save','remove','update','emit','removeListener','length'];(function(_0x2d994d,_0x168a27){var _0xd54be4=function(_0x1db925){while(--_0x1db925){_0x2d994d['push'](_0x2d994d['shift']());}};_0xd54be4(++_0x168a27);}(_0xe2af,0x6a));var _0xfe2a=function(_0x356ba3,_0x2fd486){_0x356ba3=_0x356ba3-0x0;var _0x18be24=_0xe2af[_0x356ba3];return _0x18be24;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xfe2a('0x0'),_0xfe2a('0x1'),_0xfe2a('0x2')];function createListener(_0x4405eb,_0x1d8dd3){return function(_0x15d364){_0x1d8dd3[_0xfe2a('0x3')](_0x4405eb,_0x15d364);};}function removeListener(_0x4d6814,_0xd2c004){return function(){VoiceQueueReportEvents[_0xfe2a('0x4')](_0x4d6814,_0xd2c004);};}exports['register']=function(_0x58697e){for(var _0x578c66=0x0,_0x22acb4=events[_0xfe2a('0x5')];_0x578c66<_0x22acb4;_0x578c66++){var _0x4dbd94=events[_0x578c66];var _0x39e007=createListener(_0xfe2a('0x6')+_0x4dbd94,_0x58697e);VoiceQueueReportEvents['on'](_0x4dbd94,_0x39e007);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 9a6ccbe..559e737 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 _0x8ff3=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ff3,0x1bb));var _0x38ff=function(_0x2bbdc4,_0x2cb88e){_0x2bbdc4=_0x2bbdc4-0x0;var _0x482d0c=_0x8ff3[_0x2bbdc4];return _0x482d0c;};'use strict';var multer=require('multer');var util=require(_0x38ff('0x0'));var path=require('path');var timeout=require(_0x38ff('0x1'));var express=require(_0x38ff('0x2'));var router=express[_0x38ff('0x3')]();var fs_extra=require(_0x38ff('0x4'));var auth=require(_0x38ff('0x5'));var interaction=require(_0x38ff('0x6'));var config=require(_0x38ff('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x38ff('0x8')]('/',auth[_0x38ff('0x9')](),controller[_0x38ff('0xa')]);router[_0x38ff('0x8')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0xc')]);router[_0x38ff('0xd')]('/',auth[_0x38ff('0x9')](),controller[_0x38ff('0xe')]);router[_0x38ff('0xf')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller['update']);router[_0x38ff('0x10')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x11')]);module['exports']=router; \ No newline at end of file +var _0xaac5=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','update','/:id','destroy','exports','util','path','connect-timeout'];(function(_0x4bb5de,_0x1806d9){var _0x5bb0ff=function(_0x5e4676){while(--_0x5e4676){_0x4bb5de['push'](_0x4bb5de['shift']());}};_0x5bb0ff(++_0x1806d9);}(_0xaac5,0x1b5));var _0x5aac=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xaac5[_0x376b45];return _0x2341b3;};'use strict';var multer=require('multer');var util=require(_0x5aac('0x0'));var path=require(_0x5aac('0x1'));var timeout=require(_0x5aac('0x2'));var express=require(_0x5aac('0x3'));var router=express[_0x5aac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5aac('0x5'));var interaction=require(_0x5aac('0x6'));var config=require(_0x5aac('0x7'));var controller=require(_0x5aac('0x8'));router[_0x5aac('0x9')]('/',auth[_0x5aac('0xa')](),controller[_0x5aac('0xb')]);router[_0x5aac('0x9')]('/:id',auth[_0x5aac('0xa')](),controller[_0x5aac('0xc')]);router[_0x5aac('0xd')]('/',auth[_0x5aac('0xa')](),controller[_0x5aac('0xe')]);router[_0x5aac('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5aac('0x10')]);router['delete'](_0x5aac('0x11'),auth[_0x5aac('0xa')](),controller[_0x5aac('0x12')]);module[_0x5aac('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 5717a75..39c9d04 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 _0xb9e0=['sequelize','moment','exports','STRING','DATE','format'];(function(_0x36de4f,_0x350d30){var _0x1a91c2=function(_0x475034){while(--_0x475034){_0x36de4f['push'](_0x36de4f['shift']());}};_0x1a91c2(++_0x350d30);}(_0xb9e0,0x18c));var _0x0b9e=function(_0xf5e3ca,_0x46d54a){_0xf5e3ca=_0xf5e3ca-0x0;var _0xcb667=_0xb9e0[_0xf5e3ca];return _0xcb667;};'use strict';var Sequelize=require(_0x0b9e('0x0'));var moment=require(_0x0b9e('0x1'));module[_0x0b9e('0x2')]={'time':{'type':Sequelize[_0x0b9e('0x3')]},'callid':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0b9e('0x4')],'allowNull':![],'defaultValue':moment()[_0x0b9e('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xd26f=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x577fa5,_0x4fd400){var _0x14bc88=function(_0x4101c6){while(--_0x4101c6){_0x577fa5['push'](_0x577fa5['shift']());}};_0x14bc88(++_0x4fd400);}(_0xd26f,0x81));var _0xfd26=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xd26f[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xfd26('0x0'));var moment=require(_0xfd26('0x1'));module[_0xfd26('0x2')]={'time':{'type':Sequelize[_0xfd26('0x3')]},'callid':{'type':Sequelize[_0xfd26('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfd26('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xfd26('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfd26('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfd26('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfd26('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfd26('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfd26('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfd26('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0xfd26('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 19c9a86..fab8832 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 _0xc69b=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','VoiceQueuesLog','rawAttributes','fieldName','key','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','length','include','options','find','create','body','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1e5cb6,_0x1314d6){var _0x408f84=function(_0x120da5){while(--_0x120da5){_0x1e5cb6['push'](_0x1e5cb6['shift']());}};_0x408f84(++_0x1314d6);}(_0xc69b,0x8d));var _0xbc69=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xc69b[_0x20c9b2];return _0x2c6030;};'use strict';var emlformat=require(_0xbc69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc69('0x1'));var jsonpatch=require(_0xbc69('0x2'));var rp=require('request-promise');var moment=require(_0xbc69('0x3'));var BPromise=require(_0xbc69('0x4'));var Mustache=require(_0xbc69('0x5'));var util=require(_0xbc69('0x6'));var path=require(_0xbc69('0x7'));var sox=require(_0xbc69('0x8'));var csv=require(_0xbc69('0x9'));var ejs=require(_0xbc69('0xa'));var fs=require('fs');var fs_extra=require(_0xbc69('0xb'));var _=require(_0xbc69('0xc'));var squel=require(_0xbc69('0xd'));var crypto=require(_0xbc69('0xe'));var jsforce=require(_0xbc69('0xf'));var deskjs=require(_0xbc69('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbc69('0x11'));var Papa=require(_0xbc69('0x12'));var Redis=require(_0xbc69('0x13'));var authService=require(_0xbc69('0x14'));var qs=require(_0xbc69('0x15'));var as=require(_0xbc69('0x16'));var hardwareService=require(_0xbc69('0x17'));var logger=require('../../config/logger')(_0xbc69('0x18'));var utils=require(_0xbc69('0x19'));var config=require(_0xbc69('0x1a'));var licenseUtil=require(_0xbc69('0x1b'));var db=require(_0xbc69('0x1c'))['db'];function respondWithStatusCode(_0x29895a,_0x7e1023){_0x7e1023=_0x7e1023||0xcc;return function(_0x6efa7b){if(_0x6efa7b){return _0x29895a['sendStatus'](_0x7e1023);}return _0x29895a[_0xbc69('0x1d')](_0x7e1023)[_0xbc69('0x1e')]();};}function respondWithResult(_0xe8bff4,_0x58b346){_0x58b346=_0x58b346||0xc8;return function(_0x3b43f6){if(_0x3b43f6){return _0xe8bff4[_0xbc69('0x1d')](_0x58b346)[_0xbc69('0x1f')](_0x3b43f6);}};}function respondWithFilteredResult(_0x5e1049,_0x3fce0f){return function(_0x4b0927){if(_0x4b0927){var _0x1607fd=typeof _0x3fce0f['offset']===_0xbc69('0x20')&&typeof _0x3fce0f[_0xbc69('0x21')]==='undefined';var _0x414de9=_0x4b0927[_0xbc69('0x22')];var _0x444cfd=_0x1607fd?0x0:_0x3fce0f['offset'];var _0x26f17c=_0x1607fd?_0x4b0927[_0xbc69('0x22')]:_0x3fce0f[_0xbc69('0x23')]+_0x3fce0f[_0xbc69('0x21')];var _0x50680d;if(_0x26f17c>=_0x414de9){_0x26f17c=_0x414de9;_0x50680d=0xc8;}else{_0x50680d=0xce;}_0x5e1049[_0xbc69('0x1d')](_0x50680d);return _0x5e1049[_0xbc69('0x24')](_0xbc69('0x25'),_0x444cfd+'-'+_0x26f17c+'/'+_0x414de9)[_0xbc69('0x1f')](_0x4b0927);}return null;};}function patchUpdates(_0x48d323){return function(_0x5cc135){try{jsonpatch['apply'](_0x5cc135,_0x48d323,!![]);}catch(_0x3e3b1a){return BPromise[_0xbc69('0x26')](_0x3e3b1a);}return _0x5cc135[_0xbc69('0x27')]();};}function saveUpdates(_0x19654f,_0x31009c){return function(_0x46c026){if(_0x46c026){return _0x46c026[_0xbc69('0x28')](_0x19654f)[_0xbc69('0x29')](function(_0x2a7262){return _0x2a7262;});}return null;};}function removeEntity(_0x3bfd80,_0x3e562a){return function(_0x53629e){if(_0x53629e){return _0x53629e[_0xbc69('0x2a')]()['then'](function(){_0x3bfd80['status'](0xcc)[_0xbc69('0x1e')]();});}};}function handleEntityNotFound(_0x5caea9,_0x19be9c){return function(_0x3eda90){if(!_0x3eda90){_0x5caea9[_0xbc69('0x2b')](0x194);}return _0x3eda90;};}function handleError(_0x45a54b,_0x72147d){_0x72147d=_0x72147d||0x1f4;return function(_0x39b3e6){logger[_0xbc69('0x2c')](_0x39b3e6[_0xbc69('0x2d')]);if(_0x39b3e6['name']){delete _0x39b3e6['name'];}_0x45a54b[_0xbc69('0x1d')](_0x72147d)[_0xbc69('0x2e')](_0x39b3e6);};}exports[_0xbc69('0x2f')]=function(_0x523f77,_0x15dd41){var _0x4b77bd={},_0x55542e={},_0x3654d6={'count':0x0,'rows':[]};var _0x5ee9a8=_['map'](db[_0xbc69('0x30')][_0xbc69('0x31')],function(_0x3f92f1){return{'name':_0x3f92f1[_0xbc69('0x32')],'type':_0x3f92f1['type'][_0xbc69('0x33')]};});_0x55542e[_0xbc69('0x34')]=_[_0xbc69('0x35')](_0x5ee9a8,_0xbc69('0x36'));_0x55542e[_0xbc69('0x37')]=_[_0xbc69('0x38')](_0x523f77[_0xbc69('0x37')]);_0x55542e['filters']=_[_0xbc69('0x39')](_0x55542e[_0xbc69('0x34')],_0x55542e[_0xbc69('0x37')]);_0x4b77bd[_0xbc69('0x3a')]=_[_0xbc69('0x39')](_0x55542e['model'],qs['fields'](_0x523f77[_0xbc69('0x37')][_0xbc69('0x3b')]));_0x4b77bd['attributes']=_0x4b77bd[_0xbc69('0x3a')]['length']?_0x4b77bd[_0xbc69('0x3a')]:_0x55542e[_0xbc69('0x34')];if(!_0x523f77['query'][_0xbc69('0x3c')]('nolimit')){_0x4b77bd[_0xbc69('0x21')]=qs[_0xbc69('0x21')](_0x523f77[_0xbc69('0x37')][_0xbc69('0x21')]);_0x4b77bd[_0xbc69('0x23')]=qs['offset'](_0x523f77['query'][_0xbc69('0x23')]);}_0x4b77bd[_0xbc69('0x3d')]=qs[_0xbc69('0x3e')](_0x523f77[_0xbc69('0x37')][_0xbc69('0x3e')]);_0x4b77bd[_0xbc69('0x3f')]=qs[_0xbc69('0x40')](_[_0xbc69('0x41')](_0x523f77[_0xbc69('0x37')],_0x55542e[_0xbc69('0x40')]),_0x5ee9a8);if(_0x523f77['query'][_0xbc69('0x42')]){_0x4b77bd['where']=_[_0xbc69('0x43')](_0x4b77bd[_0xbc69('0x3f')],{'$or':_['map'](_0x5ee9a8,function(_0x6c64d6){if(_0x6c64d6[_0xbc69('0x44')]!==_0xbc69('0x45')){var _0xd345e8={};_0xd345e8[_0x6c64d6[_0xbc69('0x36')]]={'$like':'%'+_0x523f77[_0xbc69('0x37')][_0xbc69('0x42')]+'%'};return _0xd345e8;}})});}_0x4b77bd=_['merge']({},_0x4b77bd,_0x523f77['options']);var _0x86dff={'where':_0x4b77bd[_0xbc69('0x3f')]};return db[_0xbc69('0x30')][_0xbc69('0x22')](_0x86dff)[_0xbc69('0x29')](function(_0x1d16d8){_0x3654d6[_0xbc69('0x22')]=_0x1d16d8;if(_0x523f77[_0xbc69('0x37')][_0xbc69('0x46')]){_0x4b77bd['include']=[{'all':!![]}];}return db[_0xbc69('0x30')][_0xbc69('0x47')](_0x4b77bd);})['then'](function(_0x58f462){_0x3654d6[_0xbc69('0x48')]=_0x58f462;return _0x3654d6;})[_0xbc69('0x29')](respondWithFilteredResult(_0x15dd41,_0x4b77bd))['catch'](handleError(_0x15dd41,null));};exports[_0xbc69('0x49')]=function(_0x4288fc,_0x2d3df2){var _0x446111={'raw':!![],'where':{'id':_0x4288fc[_0xbc69('0x4a')]['id']}},_0x6282cd={};_0x6282cd[_0xbc69('0x34')]=_[_0xbc69('0x38')](db[_0xbc69('0x30')]['rawAttributes']);_0x6282cd['query']=_[_0xbc69('0x38')](_0x4288fc['query']);_0x6282cd[_0xbc69('0x40')]=_['intersection'](_0x6282cd[_0xbc69('0x34')],_0x6282cd[_0xbc69('0x37')]);_0x446111[_0xbc69('0x3a')]=_[_0xbc69('0x39')](_0x6282cd[_0xbc69('0x34')],qs['fields'](_0x4288fc[_0xbc69('0x37')][_0xbc69('0x3b')]));_0x446111[_0xbc69('0x3a')]=_0x446111[_0xbc69('0x3a')][_0xbc69('0x4b')]?_0x446111[_0xbc69('0x3a')]:_0x6282cd[_0xbc69('0x34')];if(_0x4288fc[_0xbc69('0x37')][_0xbc69('0x46')]){_0x446111[_0xbc69('0x4c')]=[{'all':!![]}];}_0x446111=_['merge']({},_0x446111,_0x4288fc[_0xbc69('0x4d')]);return db['VoiceQueuesLog'][_0xbc69('0x4e')](_0x446111)[_0xbc69('0x29')](handleEntityNotFound(_0x2d3df2,null))[_0xbc69('0x29')](respondWithResult(_0x2d3df2,null))['catch'](handleError(_0x2d3df2,null));};exports[_0xbc69('0x4f')]=function(_0x1f579d,_0x3d675a){return db['VoiceQueuesLog']['create'](_0x1f579d[_0xbc69('0x50')],{})['then'](respondWithResult(_0x3d675a,0xc9))[_0xbc69('0x51')](handleError(_0x3d675a,null));};exports[_0xbc69('0x28')]=function(_0x295789,_0x20296e){if(_0x295789['body']['id']){delete _0x295789['body']['id'];}return db[_0xbc69('0x30')]['find']({'where':{'id':_0x295789[_0xbc69('0x4a')]['id']}})[_0xbc69('0x29')](handleEntityNotFound(_0x20296e,null))[_0xbc69('0x29')](saveUpdates(_0x295789[_0xbc69('0x50')],null))[_0xbc69('0x29')](respondWithResult(_0x20296e,null))['catch'](handleError(_0x20296e,null));};exports[_0xbc69('0x2a')]=function(_0x2dcdef,_0x114a72){return db[_0xbc69('0x30')][_0xbc69('0x4e')]({'where':{'id':_0x2dcdef[_0xbc69('0x4a')]['id']}})[_0xbc69('0x29')](handleEntityNotFound(_0x114a72,null))[_0xbc69('0x29')](removeEntity(_0x114a72,null))['catch'](handleError(_0x114a72,null));}; \ No newline at end of file +var _0x6ed8=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','create','body','update','params','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0x6ed8,0x10c));var _0x86ed=function(_0x15cd58,_0x52b016){_0x15cd58=_0x15cd58-0x0;var _0x233c74=_0x6ed8[_0x15cd58];return _0x233c74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86ed('0x0'));var zipdir=require(_0x86ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86ed('0x2'));var BPromise=require(_0x86ed('0x3'));var Mustache=require(_0x86ed('0x4'));var util=require(_0x86ed('0x5'));var path=require(_0x86ed('0x6'));var sox=require('sox');var csv=require(_0x86ed('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86ed('0x8'));var _=require(_0x86ed('0x9'));var squel=require(_0x86ed('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86ed('0xb'));var toCsv=require(_0x86ed('0x7'));var querystring=require(_0x86ed('0xc'));var Papa=require(_0x86ed('0xd'));var Redis=require('ioredis');var authService=require(_0x86ed('0xe'));var qs=require(_0x86ed('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86ed('0x10'));var logger=require('../../config/logger')(_0x86ed('0x11'));var utils=require(_0x86ed('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x86ed('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5230a3,_0x12f485){_0x12f485=_0x12f485||0xcc;return function(_0x39bb9b){if(_0x39bb9b){return _0x5230a3[_0x86ed('0x14')](_0x12f485);}return _0x5230a3[_0x86ed('0x15')](_0x12f485)[_0x86ed('0x16')]();};}function respondWithResult(_0x10ca40,_0x2e9590){_0x2e9590=_0x2e9590||0xc8;return function(_0x363bf1){if(_0x363bf1){return _0x10ca40['status'](_0x2e9590)[_0x86ed('0x17')](_0x363bf1);}};}function respondWithFilteredResult(_0x40ad27,_0x20b237){return function(_0x4421e2){if(_0x4421e2){var _0x5375d5=typeof _0x20b237[_0x86ed('0x18')]===_0x86ed('0x19')&&typeof _0x20b237[_0x86ed('0x1a')]===_0x86ed('0x19');var _0x4426ca=_0x4421e2['count'];var _0xa0dae5=_0x5375d5?0x0:_0x20b237[_0x86ed('0x18')];var _0x30a63f=_0x5375d5?_0x4421e2[_0x86ed('0x1b')]:_0x20b237[_0x86ed('0x18')]+_0x20b237[_0x86ed('0x1a')];var _0x3e4980;if(_0x30a63f>=_0x4426ca){_0x30a63f=_0x4426ca;_0x3e4980=0xc8;}else{_0x3e4980=0xce;}_0x40ad27['status'](_0x3e4980);return _0x40ad27[_0x86ed('0x1c')]('Content-Range',_0xa0dae5+'-'+_0x30a63f+'/'+_0x4426ca)[_0x86ed('0x17')](_0x4421e2);}return null;};}function patchUpdates(_0x542f98){return function(_0xd3e4e){try{jsonpatch[_0x86ed('0x1d')](_0xd3e4e,_0x542f98,!![]);}catch(_0x5337b2){return BPromise[_0x86ed('0x1e')](_0x5337b2);}return _0xd3e4e[_0x86ed('0x1f')]();};}function saveUpdates(_0x5e7819,_0x338374){return function(_0x95d4){if(_0x95d4){return _0x95d4['update'](_0x5e7819)[_0x86ed('0x20')](function(_0x3f3771){return _0x3f3771;});}return null;};}function removeEntity(_0x5b58a1,_0x53d1c2){return function(_0x224a19){if(_0x224a19){return _0x224a19[_0x86ed('0x21')]()[_0x86ed('0x20')](function(){_0x5b58a1[_0x86ed('0x15')](0xcc)[_0x86ed('0x16')]();});}};}function handleEntityNotFound(_0x2448c0,_0x1b1267){return function(_0x56cfbe){if(!_0x56cfbe){_0x2448c0[_0x86ed('0x14')](0x194);}return _0x56cfbe;};}function handleError(_0x5dd6a5,_0x451e29){_0x451e29=_0x451e29||0x1f4;return function(_0x1c7687){logger[_0x86ed('0x22')](_0x1c7687['stack']);if(_0x1c7687['name']){delete _0x1c7687[_0x86ed('0x23')];}_0x5dd6a5[_0x86ed('0x15')](_0x451e29)[_0x86ed('0x24')](_0x1c7687);};}exports[_0x86ed('0x25')]=function(_0x3377fb,_0x3ebab2){var _0x3a901b={},_0x4189b1={},_0x13cd90={'count':0x0,'rows':[]};var _0x4148f5=_['map'](db[_0x86ed('0x26')][_0x86ed('0x27')],function(_0x45d076){return{'name':_0x45d076[_0x86ed('0x28')],'type':_0x45d076[_0x86ed('0x29')][_0x86ed('0x2a')]};});_0x4189b1[_0x86ed('0x2b')]=_[_0x86ed('0x2c')](_0x4148f5,_0x86ed('0x23'));_0x4189b1[_0x86ed('0x2d')]=_[_0x86ed('0x2e')](_0x3377fb[_0x86ed('0x2d')]);_0x4189b1[_0x86ed('0x2f')]=_[_0x86ed('0x30')](_0x4189b1[_0x86ed('0x2b')],_0x4189b1[_0x86ed('0x2d')]);_0x3a901b[_0x86ed('0x31')]=_['intersection'](_0x4189b1['model'],qs[_0x86ed('0x32')](_0x3377fb[_0x86ed('0x2d')][_0x86ed('0x32')]));_0x3a901b['attributes']=_0x3a901b[_0x86ed('0x31')][_0x86ed('0x33')]?_0x3a901b[_0x86ed('0x31')]:_0x4189b1['model'];if(!_0x3377fb[_0x86ed('0x2d')][_0x86ed('0x34')](_0x86ed('0x35'))){_0x3a901b[_0x86ed('0x1a')]=qs[_0x86ed('0x1a')](_0x3377fb['query'][_0x86ed('0x1a')]);_0x3a901b[_0x86ed('0x18')]=qs[_0x86ed('0x18')](_0x3377fb[_0x86ed('0x2d')][_0x86ed('0x18')]);}_0x3a901b[_0x86ed('0x36')]=qs[_0x86ed('0x37')](_0x3377fb[_0x86ed('0x2d')][_0x86ed('0x37')]);_0x3a901b[_0x86ed('0x38')]=qs[_0x86ed('0x2f')](_[_0x86ed('0x39')](_0x3377fb[_0x86ed('0x2d')],_0x4189b1['filters']),_0x4148f5);if(_0x3377fb['query'][_0x86ed('0x3a')]){_0x3a901b[_0x86ed('0x38')]=_[_0x86ed('0x3b')](_0x3a901b['where'],{'$or':_[_0x86ed('0x2c')](_0x4148f5,function(_0x1b5ad2){if(_0x1b5ad2[_0x86ed('0x29')]!=='VIRTUAL'){var _0x65d22a={};_0x65d22a[_0x1b5ad2[_0x86ed('0x23')]]={'$like':'%'+_0x3377fb['query'][_0x86ed('0x3a')]+'%'};return _0x65d22a;}})});}_0x3a901b=_[_0x86ed('0x3b')]({},_0x3a901b,_0x3377fb[_0x86ed('0x3c')]);var _0x5083be={'where':_0x3a901b[_0x86ed('0x38')]};return db['VoiceQueuesLog'][_0x86ed('0x1b')](_0x5083be)['then'](function(_0x28feac){_0x13cd90[_0x86ed('0x1b')]=_0x28feac;if(_0x3377fb[_0x86ed('0x2d')][_0x86ed('0x3d')]){_0x3a901b[_0x86ed('0x3e')]=[{'all':!![]}];}return db[_0x86ed('0x26')][_0x86ed('0x3f')](_0x3a901b);})[_0x86ed('0x20')](function(_0x4aac76){_0x13cd90['rows']=_0x4aac76;return _0x13cd90;})[_0x86ed('0x20')](respondWithFilteredResult(_0x3ebab2,_0x3a901b))[_0x86ed('0x40')](handleError(_0x3ebab2,null));};exports[_0x86ed('0x41')]=function(_0x19f307,_0x37e4ad){var _0x265a60={'raw':!![],'where':{'id':_0x19f307['params']['id']}},_0x335e37={};_0x335e37['model']=_[_0x86ed('0x2e')](db['VoiceQueuesLog']['rawAttributes']);_0x335e37[_0x86ed('0x2d')]=_[_0x86ed('0x2e')](_0x19f307[_0x86ed('0x2d')]);_0x335e37[_0x86ed('0x2f')]=_[_0x86ed('0x30')](_0x335e37[_0x86ed('0x2b')],_0x335e37[_0x86ed('0x2d')]);_0x265a60['attributes']=_['intersection'](_0x335e37['model'],qs[_0x86ed('0x32')](_0x19f307[_0x86ed('0x2d')][_0x86ed('0x32')]));_0x265a60['attributes']=_0x265a60[_0x86ed('0x31')][_0x86ed('0x33')]?_0x265a60[_0x86ed('0x31')]:_0x335e37[_0x86ed('0x2b')];if(_0x19f307[_0x86ed('0x2d')][_0x86ed('0x3d')]){_0x265a60[_0x86ed('0x3e')]=[{'all':!![]}];}_0x265a60=_[_0x86ed('0x3b')]({},_0x265a60,_0x19f307[_0x86ed('0x3c')]);return db[_0x86ed('0x26')]['find'](_0x265a60)[_0x86ed('0x20')](handleEntityNotFound(_0x37e4ad,null))[_0x86ed('0x20')](respondWithResult(_0x37e4ad,null))[_0x86ed('0x40')](handleError(_0x37e4ad,null));};exports[_0x86ed('0x42')]=function(_0x5c9926,_0x532337){return db[_0x86ed('0x26')][_0x86ed('0x42')](_0x5c9926[_0x86ed('0x43')],{})[_0x86ed('0x20')](respondWithResult(_0x532337,0xc9))[_0x86ed('0x40')](handleError(_0x532337,null));};exports[_0x86ed('0x44')]=function(_0x25e9e9,_0x5db890){if(_0x25e9e9[_0x86ed('0x43')]['id']){delete _0x25e9e9[_0x86ed('0x43')]['id'];}return db[_0x86ed('0x26')]['find']({'where':{'id':_0x25e9e9[_0x86ed('0x45')]['id']}})[_0x86ed('0x20')](handleEntityNotFound(_0x5db890,null))['then'](saveUpdates(_0x25e9e9[_0x86ed('0x43')],null))[_0x86ed('0x20')](respondWithResult(_0x5db890,null))[_0x86ed('0x40')](handleError(_0x5db890,null));};exports[_0x86ed('0x21')]=function(_0x4bb368,_0x120a67){return db['VoiceQueuesLog']['find']({'where':{'id':_0x4bb368[_0x86ed('0x45')]['id']}})[_0x86ed('0x20')](handleEntityNotFound(_0x120a67,null))['then'](removeEntity(_0x120a67,null))[_0x86ed('0x40')](handleError(_0x120a67,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 4d9759c..a12f7a3 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 _0x5580=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util'];(function(_0x264de4,_0x41f555){var _0x4e004e=function(_0x43f7c8){while(--_0x43f7c8){_0x264de4['push'](_0x264de4['shift']());}};_0x4e004e(++_0x41f555);}(_0x5580,0xa6));var _0x0558=function(_0x40b2bd,_0xc696ef){_0x40b2bd=_0x40b2bd-0x0;var _0x138cfc=_0x5580[_0x40b2bd];return _0x138cfc;};'use strict';var _=require(_0x0558('0x0'));var util=require(_0x0558('0x1'));var logger=require(_0x0558('0x2'))('api');var moment=require(_0x0558('0x3'));var BPromise=require(_0x0558('0x4'));var rp=require(_0x0558('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0558('0x6'));var config=require(_0x0558('0x7'));var attributes=require(_0x0558('0x8'));module[_0x0558('0x9')]=function(_0x147d9e,_0x1c49dd){return _0x147d9e['define'](_0x0558('0xa'),attributes,{'tableName':_0x0558('0xb'),'paranoid':![],'indexes':[{'name':_0x0558('0xc'),'fields':[_0x0558('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xd9de=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm'];(function(_0x4c953c,_0x2edbb8){var _0xfa0543=function(_0x2d2cb1){while(--_0x2d2cb1){_0x4c953c['push'](_0x4c953c['shift']());}};_0xfa0543(++_0x2edbb8);}(_0xd9de,0x160));var _0xed9d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd9de[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xed9d('0x0'));var logger=require(_0xed9d('0x1'))('api');var moment=require(_0xed9d('0x2'));var BPromise=require(_0xed9d('0x3'));var rp=require(_0xed9d('0x4'));var fs=require('fs');var path=require(_0xed9d('0x5'));var rimraf=require(_0xed9d('0x6'));var config=require(_0xed9d('0x7'));var attributes=require(_0xed9d('0x8'));module[_0xed9d('0x9')]=function(_0xcadc38,_0x4a1d46){return _0xcadc38[_0xed9d('0xa')](_0xed9d('0xb'),attributes,{'tableName':_0xed9d('0xc'),'paranoid':![],'indexes':[{'name':_0xed9d('0xd'),'fields':[_0xed9d('0xe'),_0xed9d('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b43304f..e3bc01e 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 _0x24db=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x3024e5,_0x3261ac){var _0x4d988a=function(_0x90d571){while(--_0x90d571){_0x3024e5['push'](_0x3024e5['shift']());}};_0x4d988a(++_0x3261ac);}(_0x24db,0x17d));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb24d('0x0'));var moment=require(_0xb24d('0x1'));var BPromise=require(_0xb24d('0x2'));var rs=require(_0xb24d('0x3'));var fs=require('fs');var Redis=require(_0xb24d('0x4'));var db=require(_0xb24d('0x5'))['db'];var utils=require(_0xb24d('0x6'));var logger=require(_0xb24d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb24d('0x8')][_0xb24d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37754f,_0x477ed8,_0x13158c){return new BPromise(function(_0x99799c,_0xd0ab81){return client['request'](_0x37754f,_0x13158c)[_0xb24d('0xa')](function(_0x3bdaeb){logger[_0xb24d('0xb')](_0xb24d('0xc'),_0x477ed8,_0xb24d('0xd'));logger[_0xb24d('0xe')](_0xb24d('0xf'),_0x477ed8,'request\x20sent',JSON['stringify'](_0x3bdaeb));if(_0x3bdaeb['error']){if(_0x3bdaeb[_0xb24d('0x10')]['code']===0x1f4){logger[_0xb24d('0x10')](_0xb24d('0xc'),_0x477ed8,_0x3bdaeb[_0xb24d('0x10')][_0xb24d('0x11')]);return _0xd0ab81(_0x3bdaeb[_0xb24d('0x10')]['message']);}logger[_0xb24d('0x10')](_0xb24d('0xc'),_0x477ed8,_0x3bdaeb[_0xb24d('0x10')]['message']);return _0x99799c(_0x3bdaeb['error']['message']);}else{logger[_0xb24d('0xb')](_0xb24d('0xc'),_0x477ed8,_0xb24d('0xd'));_0x99799c(_0x3bdaeb[_0xb24d('0x12')][_0xb24d('0x11')]);}})[_0xb24d('0x13')](function(_0x366390){logger[_0xb24d('0x10')](_0xb24d('0xc'),_0x477ed8,_0x366390);_0xd0ab81(_0x366390);});});} \ No newline at end of file +var _0x3f49=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x3f49,0x11f));var _0x93f4=function(_0x3027cf,_0x4a289d){_0x3027cf=_0x3027cf-0x0;var _0x49773a=_0x3f49[_0x3027cf];return _0x49773a;};'use strict';var _=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var moment=require('moment');var BPromise=require(_0x93f4('0x2'));var rs=require(_0x93f4('0x3'));var fs=require('fs');var Redis=require(_0x93f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93f4('0x5'));var logger=require(_0x93f4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93f4('0x7'));var client=jayson[_0x93f4('0x8')][_0x93f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a86ad,_0x956b50,_0x5d22d9){return new BPromise(function(_0x144f31,_0x5e5b4d){return client[_0x93f4('0xa')](_0x5a86ad,_0x5d22d9)[_0x93f4('0xb')](function(_0x325984){logger[_0x93f4('0xc')](_0x93f4('0xd'),_0x956b50,_0x93f4('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x956b50,_0x93f4('0xe'),JSON[_0x93f4('0xf')](_0x325984));if(_0x325984[_0x93f4('0x10')]){if(_0x325984[_0x93f4('0x10')][_0x93f4('0x11')]===0x1f4){logger[_0x93f4('0x10')](_0x93f4('0xd'),_0x956b50,_0x325984[_0x93f4('0x10')]['message']);return _0x5e5b4d(_0x325984[_0x93f4('0x10')]['message']);}logger['error'](_0x93f4('0xd'),_0x956b50,_0x325984[_0x93f4('0x10')][_0x93f4('0x12')]);return _0x144f31(_0x325984['error']['message']);}else{logger[_0x93f4('0xc')](_0x93f4('0xd'),_0x956b50,_0x93f4('0xe'));_0x144f31(_0x325984['result'][_0x93f4('0x12')]);}})[_0x93f4('0x13')](function(_0x53151e){logger[_0x93f4('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x956b50,_0x53151e);_0x5e5b4d(_0x53151e);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 046da1d..f603516 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 _0x9422=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','exports','multer','util'];(function(_0x5c13f8,_0x5d0bb3){var _0x5351db=function(_0x145d1c){while(--_0x145d1c){_0x5c13f8['push'](_0x5c13f8['shift']());}};_0x5351db(++_0x5d0bb3);}(_0x9422,0x16a));var _0x2942=function(_0x38d335,_0x5eeb3e){_0x38d335=_0x38d335-0x0;var _0x34b3ac=_0x9422[_0x38d335];return _0x34b3ac;};'use strict';var multer=require(_0x2942('0x0'));var util=require(_0x2942('0x1'));var path=require(_0x2942('0x2'));var timeout=require(_0x2942('0x3'));var express=require(_0x2942('0x4'));var router=express[_0x2942('0x5')]();var fs_extra=require(_0x2942('0x6'));var auth=require(_0x2942('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2942('0x8'));var controller=require(_0x2942('0x9'));router[_0x2942('0xa')]('/',auth[_0x2942('0xb')](),controller[_0x2942('0xc')]);router[_0x2942('0xa')](_0x2942('0xd'),auth[_0x2942('0xb')](),controller['describe']);router[_0x2942('0xa')](_0x2942('0xe'),auth[_0x2942('0xb')](),controller[_0x2942('0xf')]);router[_0x2942('0xa')](_0x2942('0x10'),auth[_0x2942('0xb')](),controller[_0x2942('0x11')]);router[_0x2942('0xa')]('/:id/downloads',controller[_0x2942('0x12')]);router['get'](_0x2942('0x13'),auth['isAuthenticated'](),controller[_0x2942('0x14')]);router[_0x2942('0x15')]('/',auth[_0x2942('0xb')](),controller[_0x2942('0x16')]);router[_0x2942('0x15')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x2942('0x17')]);router['put'](_0x2942('0xe'),auth[_0x2942('0xb')](),controller[_0x2942('0x18')]);router['delete'](_0x2942('0xe'),auth[_0x2942('0xb')](),controller['destroy']);module[_0x2942('0x19')]=router; \ No newline at end of file +var _0xb50d=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','runTranscribe','put','update','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download'];(function(_0x5b766e,_0x4fa94f){var _0x536a56=function(_0x13ccb5){while(--_0x13ccb5){_0x5b766e['push'](_0x5b766e['shift']());}};_0x536a56(++_0x4fa94f);}(_0xb50d,0xd9));var _0xdb50=function(_0x3a84bf,_0x21ee24){_0x3a84bf=_0x3a84bf-0x0;var _0x56c974=_0xb50d[_0x3a84bf];return _0x56c974;};'use strict';var multer=require(_0xdb50('0x0'));var util=require('util');var path=require(_0xdb50('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb50('0x2'));var router=express[_0xdb50('0x3')]();var fs_extra=require(_0xdb50('0x4'));var auth=require(_0xdb50('0x5'));var interaction=require(_0xdb50('0x6'));var config=require('../../config/environment');var controller=require(_0xdb50('0x7'));router[_0xdb50('0x8')]('/',auth[_0xdb50('0x9')](),controller[_0xdb50('0xa')]);router['get'](_0xdb50('0xb'),auth[_0xdb50('0x9')](),controller[_0xdb50('0xc')]);router[_0xdb50('0x8')](_0xdb50('0xd'),auth['isAuthenticated'](),controller[_0xdb50('0xe')]);router[_0xdb50('0x8')](_0xdb50('0xf'),auth['isAuthenticated'](),controller[_0xdb50('0x10')]);router['get'](_0xdb50('0x11'),controller[_0xdb50('0x12')]);router[_0xdb50('0x8')](_0xdb50('0x13'),auth[_0xdb50('0x9')](),controller[_0xdb50('0x14')]);router['post']('/',auth[_0xdb50('0x9')](),controller[_0xdb50('0x15')]);router['post'](_0xdb50('0x13'),auth[_0xdb50('0x9')](),controller[_0xdb50('0x16')]);router[_0xdb50('0x17')](_0xdb50('0xd'),auth[_0xdb50('0x9')](),controller[_0xdb50('0x18')]);router['delete'](_0xdb50('0xd'),auth['isAuthenticated'](),controller[_0xdb50('0x19')]);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 64155c9..d20d8d2 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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 d9c0f17..78096b1 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 _0x0fc5=['[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','count','offset','limit','set','apply','save','update','then','destroy','end','sendStatus','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','includeAll','include','catch','params','keys','create','body','describe','download','../../components/encryptor','uniqueid','find','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','Not\x20found','sequelize','MD5','col','token','$and','push','VoiceRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync'];(function(_0x582ccd,_0xa9ab43){var _0x11545d=function(_0x4010fa){while(--_0x4010fa){_0x582ccd['push'](_0x582ccd['shift']());}};_0x11545d(++_0xa9ab43);}(_0x0fc5,0xbd));var _0x50fc=function(_0x279df8,_0x58ac13){_0x279df8=_0x279df8-0x0;var _0x180824=_0x0fc5[_0x279df8];return _0x180824;};'use strict';var emlformat=require(_0x50fc('0x0'));var rimraf=require(_0x50fc('0x1'));var zipdir=require(_0x50fc('0x2'));var jsonpatch=require(_0x50fc('0x3'));var rp=require(_0x50fc('0x4'));var moment=require('moment');var BPromise=require(_0x50fc('0x5'));var Mustache=require('mustache');var util=require(_0x50fc('0x6'));var path=require(_0x50fc('0x7'));var sox=require(_0x50fc('0x8'));var csv=require(_0x50fc('0x9'));var ejs=require(_0x50fc('0xa'));var fs=require('fs');var fs_extra=require(_0x50fc('0xb'));var _=require(_0x50fc('0xc'));var squel=require('squel');var crypto=require(_0x50fc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x50fc('0xe'));var toCsv=require(_0x50fc('0x9'));var querystring=require(_0x50fc('0xf'));var Papa=require(_0x50fc('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x50fc('0x11'));var Redis=require('ioredis');var authService=require(_0x50fc('0x12'));var qs=require(_0x50fc('0x13'));var as=require(_0x50fc('0x14'));var hardwareService=require(_0x50fc('0x15'));var logger=require(_0x50fc('0x16'))('api');var utils=require(_0x50fc('0x17'));var config=require(_0x50fc('0x18'));var licenseUtil=require(_0x50fc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d21d,_0x1b2a15){_0x1b2a15=_0x1b2a15||0xcc;return function(_0x16e5f2){if(_0x16e5f2){return _0x58d21d['sendStatus'](_0x1b2a15);}return _0x58d21d[_0x50fc('0x1a')](_0x1b2a15)['end']();};}function respondWithResult(_0x3dbf3e,_0x3075fc){_0x3075fc=_0x3075fc||0xc8;return function(_0x2369fa){if(_0x2369fa){return _0x3dbf3e['status'](_0x3075fc)[_0x50fc('0x1b')](_0x2369fa);}};}function respondWithFilteredResult(_0x3512a9,_0xbf6599){return function(_0xf0e0ba){if(_0xf0e0ba){var _0x1da3fb=typeof _0xbf6599['offset']===_0x50fc('0x1c')&&typeof _0xbf6599['limit']===_0x50fc('0x1c');var _0x26e498=_0xf0e0ba[_0x50fc('0x1d')];var _0x2e892a=_0x1da3fb?0x0:_0xbf6599[_0x50fc('0x1e')];var _0x511874=_0x1da3fb?_0xf0e0ba['count']:_0xbf6599[_0x50fc('0x1e')]+_0xbf6599[_0x50fc('0x1f')];var _0x1a2d04;if(_0x511874>=_0x26e498){_0x511874=_0x26e498;_0x1a2d04=0xc8;}else{_0x1a2d04=0xce;}_0x3512a9[_0x50fc('0x1a')](_0x1a2d04);return _0x3512a9[_0x50fc('0x20')]('Content-Range',_0x2e892a+'-'+_0x511874+'/'+_0x26e498)['json'](_0xf0e0ba);}return null;};}function patchUpdates(_0x32c2be){return function(_0x343f14){try{jsonpatch[_0x50fc('0x21')](_0x343f14,_0x32c2be,!![]);}catch(_0x564b34){return BPromise['reject'](_0x564b34);}return _0x343f14[_0x50fc('0x22')]();};}function saveUpdates(_0xced0d9,_0x438a34){return function(_0x30b7a3){if(_0x30b7a3){return _0x30b7a3[_0x50fc('0x23')](_0xced0d9)[_0x50fc('0x24')](function(_0x37c94f){return _0x37c94f;});}return null;};}function removeEntity(_0x3b8348,_0x2149dc){return function(_0x12d6f2){if(_0x12d6f2){return _0x12d6f2[_0x50fc('0x25')]()[_0x50fc('0x24')](function(){_0x3b8348[_0x50fc('0x1a')](0xcc)[_0x50fc('0x26')]();});}};}function handleEntityNotFound(_0x2812ae,_0x4726db){return function(_0xb98671){if(!_0xb98671){_0x2812ae[_0x50fc('0x27')](0x194);}return _0xb98671;};}function handleError(_0x563a3e,_0x54fa9b){_0x54fa9b=_0x54fa9b||0x1f4;return function(_0x140c0f){logger['error'](_0x140c0f['stack']);if(_0x140c0f[_0x50fc('0x28')]){delete _0x140c0f[_0x50fc('0x28')];}_0x563a3e[_0x50fc('0x1a')](_0x54fa9b)[_0x50fc('0x29')](_0x140c0f);};}exports[_0x50fc('0x2a')]=function(_0x344c60,_0x39a44d){var _0x3b44da={},_0x2122b5={},_0xfbce23={'count':0x0,'rows':[]};var _0x1449b5=_[_0x50fc('0x2b')](db[_0x50fc('0x2c')][_0x50fc('0x2d')],function(_0x234bc1){return{'name':_0x234bc1[_0x50fc('0x2e')],'type':_0x234bc1[_0x50fc('0x2f')][_0x50fc('0x30')]};});_0x2122b5[_0x50fc('0x31')]=_[_0x50fc('0x32')](_['map'](_0x1449b5,_0x50fc('0x28')),[_0x50fc('0x33')]);_0x2122b5['query']=_['keys'](_0x344c60[_0x50fc('0x34')]);_0x2122b5[_0x50fc('0x35')]=_[_0x50fc('0x36')](_0x2122b5[_0x50fc('0x31')],_0x2122b5[_0x50fc('0x34')]);_0x3b44da['attributes']=_[_0x50fc('0x36')](_0x2122b5[_0x50fc('0x31')],qs[_0x50fc('0x37')](_0x344c60['query'][_0x50fc('0x37')]));_0x3b44da[_0x50fc('0x38')]=_0x3b44da[_0x50fc('0x38')][_0x50fc('0x39')]?_0x3b44da[_0x50fc('0x38')]:_0x2122b5['model'];if(!_0x344c60[_0x50fc('0x34')][_0x50fc('0x3a')](_0x50fc('0x3b'))){_0x3b44da[_0x50fc('0x1f')]=qs[_0x50fc('0x1f')](_0x344c60['query'][_0x50fc('0x1f')]);_0x3b44da[_0x50fc('0x1e')]=qs[_0x50fc('0x1e')](_0x344c60[_0x50fc('0x34')][_0x50fc('0x1e')]);}_0x3b44da[_0x50fc('0x3c')]=qs['sort'](_0x344c60[_0x50fc('0x34')][_0x50fc('0x3d')]);_0x3b44da['where']=qs[_0x50fc('0x35')](_[_0x50fc('0x3e')](_0x344c60[_0x50fc('0x34')],_0x2122b5[_0x50fc('0x35')]),_0x1449b5);if(_0x344c60[_0x50fc('0x34')][_0x50fc('0x3f')]){_0x3b44da['where']=_[_0x50fc('0x40')](_0x3b44da[_0x50fc('0x41')],{'$or':_[_0x50fc('0x2b')](_0x1449b5,function(_0x404c15){if(_0x404c15['type']!=='VIRTUAL'){var _0x3a2770={};_0x3a2770[_0x404c15['name']]={'$like':'%'+_0x344c60['query'][_0x50fc('0x3f')]+'%'};return _0x3a2770;}})});}_0x3b44da=_['merge']({},_0x3b44da,_0x344c60['options']);var _0x2e3887={'where':_0x3b44da[_0x50fc('0x41')]};return db[_0x50fc('0x2c')][_0x50fc('0x1d')](_0x2e3887)[_0x50fc('0x24')](function(_0xb204ef){_0xfbce23[_0x50fc('0x1d')]=_0xb204ef;if(_0x344c60['query'][_0x50fc('0x42')]){_0x3b44da[_0x50fc('0x43')]=[{'all':!![]}];}return db[_0x50fc('0x2c')]['findAll'](_0x3b44da);})[_0x50fc('0x24')](function(_0xc042eb){_0xfbce23['rows']=_0xc042eb;return _0xfbce23;})[_0x50fc('0x24')](respondWithFilteredResult(_0x39a44d,_0x3b44da))[_0x50fc('0x44')](handleError(_0x39a44d,null));};exports['show']=function(_0x40a72c,_0x5348a9){var _0x39118a={'raw':![],'where':{'id':_0x40a72c[_0x50fc('0x45')]['id']}},_0x31a082={};_0x31a082[_0x50fc('0x31')]=_[_0x50fc('0x46')](db[_0x50fc('0x2c')][_0x50fc('0x2d')]);_0x31a082[_0x50fc('0x34')]=_[_0x50fc('0x46')](_0x40a72c[_0x50fc('0x34')]);_0x31a082['filters']=_['intersection'](_0x31a082[_0x50fc('0x31')],_0x31a082[_0x50fc('0x34')]);_0x39118a[_0x50fc('0x38')]=_[_0x50fc('0x36')](_0x31a082['model'],qs[_0x50fc('0x37')](_0x40a72c[_0x50fc('0x34')][_0x50fc('0x37')]));_0x39118a[_0x50fc('0x38')]=_0x39118a['attributes'][_0x50fc('0x39')]?_0x39118a[_0x50fc('0x38')]:_0x31a082['model'];if(_0x40a72c[_0x50fc('0x34')][_0x50fc('0x42')]){_0x39118a[_0x50fc('0x43')]=[{'all':!![]}];}_0x39118a=_['merge']({},_0x39118a,_0x40a72c['options']);return db[_0x50fc('0x2c')]['find'](_0x39118a)[_0x50fc('0x24')](handleEntityNotFound(_0x5348a9,null))[_0x50fc('0x24')](respondWithResult(_0x5348a9,null))[_0x50fc('0x44')](handleError(_0x5348a9,null));};exports[_0x50fc('0x47')]=function(_0x27bba3,_0x339578){return db['VoiceRecording'][_0x50fc('0x47')](_0x27bba3['body'],{})[_0x50fc('0x24')](respondWithResult(_0x339578,0xc9))[_0x50fc('0x44')](handleError(_0x339578,null));};exports['update']=function(_0x4ab890,_0x282d36){if(_0x4ab890[_0x50fc('0x48')]['id']){delete _0x4ab890[_0x50fc('0x48')]['id'];}return db[_0x50fc('0x2c')]['find']({'where':{'id':_0x4ab890[_0x50fc('0x45')]['id']}})['then'](handleEntityNotFound(_0x282d36,null))[_0x50fc('0x24')](saveUpdates(_0x4ab890['body'],null))['then'](respondWithResult(_0x282d36,null))['catch'](handleError(_0x282d36,null));};exports[_0x50fc('0x49')]=function(_0x2cb24b,_0x7ce0c){return db[_0x50fc('0x2c')]['describe']()[_0x50fc('0x24')](respondWithResult(_0x7ce0c,null))[_0x50fc('0x44')](handleError(_0x7ce0c,null));};exports[_0x50fc('0x4a')]=function(_0x1d94c5,_0x3e47d7,_0x37339f){var _0x4e3764=require(_0x50fc('0x4b'));var _0x3b34e2=![];var _0x518682={};if(_0x1d94c5['query'][_0x50fc('0x2f')]&&_0x1d94c5['query']['type']===_0x50fc('0x4c')){_0x518682['uniqueid']=_0x1d94c5[_0x50fc('0x45')]['id'];}else{_0x518682['id']=_0x1d94c5[_0x50fc('0x45')]['id'];}return db[_0x50fc('0x2c')][_0x50fc('0x4d')]({'where':_0x518682,'attributes':['id','value'],'raw':!![]})[_0x50fc('0x24')](handleEntityNotFound(_0x3e47d7,null))['then'](function(_0x5bccaf){if(_0x5bccaf){var _0x1bc167=_0x5bccaf[_0x50fc('0x4e')];var _0x1af93a=util[_0x50fc('0x33')](_0x50fc('0x4f'),_0x1bc167);if(fs[_0x50fc('0x50')](_0x1af93a)){_0x3b34e2=!![];return _0x4e3764[_0x50fc('0x51')](_0x1af93a,_0x1bc167,config[_0x50fc('0x52')][_0x50fc('0x53')])['then'](function(){return _0x5bccaf;});}return _0x5bccaf;}})[_0x50fc('0x24')](function(_0x27f71a){if(_0x27f71a){var _0x3ea04a=_0x27f71a[_0x50fc('0x4e')];if(!fs[_0x50fc('0x50')](_0x3ea04a)){throw new db[(_0x50fc('0x54'))][(_0x50fc('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x27f71a[_0x50fc('0x56')]){return _0x3e47d7[_0x50fc('0x4a')](_0x3ea04a,_0x27f71a[_0x50fc('0x56')]+path[_0x50fc('0x57')](_0x3ea04a),function(){if(_0x3b34e2){fs[_0x50fc('0x58')](_0x3ea04a);}});}else{return _0x3e47d7[_0x50fc('0x4a')](_0x3ea04a,function(_0x2c75c0){if(_0x3b34e2){fs[_0x50fc('0x58')](_0x3ea04a);}});}}})[_0x50fc('0x44')](function(_0x322d8c){if(_0x322d8c['message']==='VoiceRecording\x20not\x20found'){_0x3e47d7[_0x50fc('0x1a')](0x194)[_0x50fc('0x29')](_0x50fc('0x59'));}else{return handleError(_0x3e47d7,null);}});};exports['downloads']=function(_0x5ee4b8,_0x1f5c40,_0x37aaf0){var _0x2889ce=require(_0x50fc('0x4b'));var _0x12118d=![];var _0x1bd282={'$and':[db[_0x50fc('0x5a')][_0x50fc('0x41')](db[_0x50fc('0x5a')]['fn'](_0x50fc('0x5b'),db[_0x50fc('0x5a')][_0x50fc('0x5c')](_0x50fc('0x4c'))),_0x5ee4b8[_0x50fc('0x34')][_0x50fc('0x5d')])]};if(_0x5ee4b8[_0x50fc('0x34')][_0x50fc('0x2f')]&&_0x5ee4b8[_0x50fc('0x34')][_0x50fc('0x2f')]===_0x50fc('0x4c')){_0x1bd282[_0x50fc('0x5e')][_0x50fc('0x5f')]({'uniqueid':_0x5ee4b8[_0x50fc('0x45')]['id']});}else{_0x1bd282[_0x50fc('0x5e')][_0x50fc('0x5f')]({'id':_0x5ee4b8['params']['id']});}return db[_0x50fc('0x2c')][_0x50fc('0x4d')]({'where':_0x1bd282,'attributes':['id',_0x50fc('0x4e')],'raw':!![]})[_0x50fc('0x24')](handleEntityNotFound(_0x1f5c40,null))[_0x50fc('0x24')](function(_0x587040){if(_0x587040){var _0x352ba2=util[_0x50fc('0x33')](_0x50fc('0x4f'),_0x587040[_0x50fc('0x4e')]);if(fs['existsSync'](_0x352ba2)){_0x12118d=!![];return _0x2889ce[_0x50fc('0x51')](_0x352ba2,_0x587040['value'],config[_0x50fc('0x52')][_0x50fc('0x53')])['then'](function(){return _0x587040;});}return _0x587040;}})[_0x50fc('0x24')](function(_0x51e9fe){if(_0x51e9fe){if(!fs[_0x50fc('0x50')](_0x51e9fe[_0x50fc('0x4e')])){throw new db[(_0x50fc('0x54'))]['ValidationError'](_0x50fc('0x60'));}if(_0x51e9fe[_0x50fc('0x56')]){return _0x1f5c40[_0x50fc('0x4a')](_0x51e9fe['value'],_0x51e9fe[_0x50fc('0x56')]+path[_0x50fc('0x57')](_0x51e9fe[_0x50fc('0x4e')]),function(){if(_0x12118d){fs['unlink'](_0x51e9fe[_0x50fc('0x4e')]);}});}else{return _0x1f5c40[_0x50fc('0x4a')](_0x51e9fe[_0x50fc('0x4e')],function(_0x269152){if(_0x12118d){fs[_0x50fc('0x58')](_0x51e9fe[_0x50fc('0x4e')]);}});}}})[_0x50fc('0x44')](handleError(_0x1f5c40,null));};exports[_0x50fc('0x25')]=function(_0x1834dd,_0xc97c77){return db[_0x50fc('0x2c')][_0x50fc('0x4d')]({'where':{'id':_0x1834dd[_0x50fc('0x45')]['id']}})[_0x50fc('0x24')](function(_0x284481){if(_['isNil'](_0x284481)){throw new ReferenceError(_0x50fc('0x61'));}return _0x284481;})[_0x50fc('0x24')](function(_0x5cfb3a){var _0x4f8f7=_0x5cfb3a[_0x50fc('0x4e')];logger[_0x50fc('0x62')](_0x50fc('0x63'),_0x4f8f7);if(!_[_0x50fc('0x64')](_0x5cfb3a[_0x50fc('0x4e')])&&fs['existsSync'](_0x4f8f7)){logger[_0x50fc('0x62')](_0x50fc('0x65')+_0x4f8f7+_0x50fc('0x66'));fs[_0x50fc('0x67')](_0x4f8f7);}_0x4f8f7=_0x4f8f7+_0x50fc('0x68');if(!_[_0x50fc('0x64')](_0x5cfb3a[_0x50fc('0x4e')])&&fs[_0x50fc('0x50')](_0x4f8f7)){logger['info'](_0x50fc('0x65')+_0x4f8f7+_0x50fc('0x66'));fs[_0x50fc('0x67')](_0x4f8f7);}return _0x5cfb3a;})[_0x50fc('0x24')](function(_0x204886){if(!_0x204886)throw new InternalError();return _0x204886[_0x50fc('0x25')]();})[_0x50fc('0x24')](function(){_0xc97c77[_0x50fc('0x1a')](0xcc)[_0x50fc('0x26')]();})[_0x50fc('0x44')](handleError(_0xc97c77,null));};function getBucketslist(_0x1205d3,_0x195746,_0x50c995){return new Promise(function(_0x5e3f81,_0x484d2b){var _0x47f4d9=new AWS['S3']({'accessKeyId':_0x195746,'secretAccessKey':_0x1205d3,'region':_0x50c995});_0x47f4d9[_0x50fc('0x69')]({},function(_0x296eba,_0x22072b){if(_0x296eba){return _0x484d2b(_0x296eba);}else{return _0x5e3f81(_0x22072b);}});});}function createBucket(_0x3b3e04,_0x5c1299,_0x40c7a3,_0x1cbcb8){return new Promise(function(_0x204033,_0x408808){var _0x3063c8=new AWS['S3']({'accessKeyId':_0x5c1299,'secretAccessKey':_0x3b3e04,'region':_0x40c7a3});_0x3063c8[_0x50fc('0x6a')]({'Bucket':_0x1cbcb8},function(_0x2a06b9,_0x189b2f){if(_0x2a06b9){return _0x408808(_0x2a06b9);}else{return _0x204033(_0x189b2f);}});});}function uploadFile(_0x50aa51,_0x115f5b,_0x31de38,_0x116c5d,_0x2c35a2,_0x1123b3){return new Promise(function(_0x181b31,_0x18b81f){var _0x3dd043=new AWS['S3']({'accessKeyId':_0x115f5b,'secretAccessKey':_0x50aa51,'region':_0x31de38});_0x3dd043['upload']({'Bucket':_0x116c5d,'Key':_0x2c35a2,'Body':_0x1123b3},function(_0x2b78b4,_0x4c6bd4){if(_0x2b78b4){return _0x18b81f(_0x2b78b4);}else{return _0x181b31(_0x4c6bd4);}});});}function startTranscribe(_0x8d1b8f,_0x203829,_0x3ecf18,_0x5ec359,_0x1ac9d2,_0x13b12a){return new Promise(function(_0x325aa7,_0x403541){var _0x1090d6=new AWS[(_0x50fc('0x6b'))]({'accessKeyId':_0x203829,'secretAccessKey':_0x8d1b8f,'region':_0x3ecf18});_0x1090d6[_0x50fc('0x6c')]({'TranscriptionJobName':_0x5ec359,'LanguageCode':_0x1ac9d2,'Media':{'MediaFileUri':_0x13b12a}},function(_0x473375,_0x10fd6b){if(_0x473375){return _0x403541(_0x473375);}else{return _0x325aa7(_0x10fd6b);}});});}function transcribe(_0x37945a,_0xbc923e,_0x18eb5e,_0x58a68d,_0x7f2dc,_0x3d6a9b,_0x6acb4d){return new Promise(function(_0x4ca4b8,_0x2b0c81){var _0x385890={};logger['info'](util['format'](_0x50fc('0x6d'),_0x37945a,_0x7f2dc));return uploadFile(_0xbc923e,_0x18eb5e,_0x58a68d,_0x7f2dc,path['basename'](_0x3d6a9b),fs[_0x50fc('0x6e')](_0x3d6a9b))[_0x50fc('0x24')](function(_0x5d6401){logger[_0x50fc('0x62')](util[_0x50fc('0x33')](_0x50fc('0x6f'),_0x37945a,_0x7f2dc,_0x5d6401[_0x50fc('0x70')]));_0x385890['bucket']=_0x5d6401[_0x50fc('0x71')];_0x385890[_0x50fc('0x72')]=_0x5d6401['Location'];logger[_0x50fc('0x62')](util['format'](_0x50fc('0x73'),_0x37945a));return startTranscribe(_0xbc923e,_0x18eb5e,_0x58a68d,uuidv4(),_0x6acb4d,_0x5d6401['Location']);})[_0x50fc('0x24')](function(_0x29248c){logger['info'](util[_0x50fc('0x33')](_0x50fc('0x74'),_0x37945a,_0x29248c[_0x50fc('0x75')]['TranscriptionJobName']));_0x385890[_0x50fc('0x76')]=_0x29248c[_0x50fc('0x75')][_0x50fc('0x77')];_0x385890[_0x50fc('0x78')]=_0x29248c[_0x50fc('0x75')][_0x50fc('0x79')];return _0x4ca4b8(_0x385890);})[_0x50fc('0x44')](function(_0x2822ce){return _0x2b0c81(_0x2822ce);});});}exports[_0x50fc('0x7a')]=function(_0x4f96dd,_0x4928a9,_0x4ad369){var _0x34306e;var _0x416919;var _0x2b7807;var _0x263904=require(_0x50fc('0x4b'));return db[_0x50fc('0x2c')][_0x50fc('0x7b')]({'where':{'id':_0x4f96dd[_0x50fc('0x45')]['id']}})['then'](function(_0x14ff98){if(_0x14ff98){var _0x3e8461=util[_0x50fc('0x33')](_0x50fc('0x4f'),_0x14ff98[_0x50fc('0x4e')]);if(fs['existsSync'](_0x3e8461)){cypher=!![];return _0x263904[_0x50fc('0x51')](_0x3e8461,_0x14ff98[_0x50fc('0x4e')],config[_0x50fc('0x52')]['recording'])[_0x50fc('0x24')](function(){return _0x14ff98;});}return _0x14ff98;}})['then'](function(_0x53f351){if(!_0x53f351){throw new db[(_0x50fc('0x54'))]['ValidationError'](_0x50fc('0x7c'));}_0x416919=_0x53f351;return db[_0x50fc('0x7d')][_0x50fc('0x7b')]({'where':{'id':0x1}});})[_0x50fc('0x24')](handleEntityNotFound(_0x4928a9,null))[_0x50fc('0x24')](function(_0x47dd24){if(_0x47dd24){_0x34306e=_0x47dd24;if(!_0x34306e['transcribe']||!_0x34306e[_0x50fc('0x7e')]||!_0x34306e[_0x50fc('0x7f')]||!_0x34306e[_0x50fc('0x80')]||!_0x34306e['bucket']){throw new db[(_0x50fc('0x54'))]['ValidationError'](_0x50fc('0x81'));}if(_0x4f96dd['body'][_0x50fc('0x82')]&&(!_0x34306e['sentiment']||!_0x34306e[_0x50fc('0x83')]||!_0x34306e[_0x50fc('0x84')]||!_0x34306e[_0x50fc('0x80')]||!_0x34306e['bucket'])){throw new db[(_0x50fc('0x54'))][(_0x50fc('0x55'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x50fc('0x85')][_0x50fc('0x7b')]({'where':{'id':_0x34306e[_0x50fc('0x7e')]}});}})[_0x50fc('0x24')](function(_0x3bca5b){if(!_0x3bca5b){throw new db['Sequelize'][(_0x50fc('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3bca5b[_0x50fc('0x86')]||!_0x3bca5b['data2']){throw new db[(_0x50fc('0x54'))]['ValidationError'](_0x50fc('0x87'));}_0x2b7807=_0x3bca5b;return getBucketslist(_0x2b7807[_0x50fc('0x86')],_0x2b7807[_0x50fc('0x88')],_0x34306e[_0x50fc('0x7f')]);})[_0x50fc('0x24')](function(_0x1f240c){if(_0x1f240c&&_0x1f240c[_0x50fc('0x89')]){var _0x52522e=_[_0x50fc('0x4d')](_0x1f240c['Buckets'],function(_0x210df6){return _0x210df6['Name']===_0x34306e[_0x50fc('0x8a')];});if(!_0x52522e){logger[_0x50fc('0x62')](util[_0x50fc('0x33')](_0x50fc('0x8b'),_0x4f96dd[_0x50fc('0x45')]['id'],_0x34306e[_0x50fc('0x8a')]));return createBucket(_0x2b7807[_0x50fc('0x86')],_0x2b7807['data2'],_0x34306e['transcribeRegion'],_0x34306e[_0x50fc('0x8a')]);}logger[_0x50fc('0x62')](util[_0x50fc('0x33')](_0x50fc('0x8c'),_0x4f96dd[_0x50fc('0x45')]['id'],_0x34306e[_0x50fc('0x8a')]));return;}})[_0x50fc('0x24')](function(_0x4f916c){if(_0x416919[_0x50fc('0x78')]===_0x50fc('0x8d')){return transcribe(_0x4f96dd['params']['id'],_0x2b7807['data1'],_0x2b7807[_0x50fc('0x88')],_0x34306e['transcribeRegion'],_0x34306e['bucket'],_0x416919['value'],_0x34306e[_0x50fc('0x80')]);}else{logger['info'](util[_0x50fc('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4f96dd[_0x50fc('0x45')]['id']));return{'transcribeStatus':_0x50fc('0x8e')};}})[_0x50fc('0x24')](function(_0x4f4558){if(_0x4f4558){_0x4f4558[_0x50fc('0x8f')]=_0x4f96dd['body']['runSentiment'];return _0x416919[_0x50fc('0x90')](_0x4f4558);}})[_0x50fc('0x24')](respondWithResult(_0x4928a9,null))[_0x50fc('0x44')](handleError(_0x4928a9,null));};function writeFile(_0xae351b,_0x156d80){return new Promise(function(_0x4926b5,_0x44e7f7){fs[_0x50fc('0x91')](_0x156d80,_0xae351b,function(_0x13fc04,_0x4e825d){if(_0x13fc04){return _0x44e7f7(_0x13fc04);}else{return _0x4926b5(_0x4e825d);}});});}exports[_0x50fc('0x92')]=function(_0xf7265b,_0x145cac,_0x2ca733){return db[_0x50fc('0x2c')]['findOne']({'where':{'id':_0xf7265b[_0x50fc('0x45')]['id']}})['then'](handleEntityNotFound(_0x145cac))['then'](function(_0x42f3ce){if(_0x42f3ce&&_0x42f3ce[_0x50fc('0x93')]){var _0x48098e=_0x42f3ce[_0x50fc('0x93')];var _0x44ef14=config['root']+_0x50fc('0x94')+_0x42f3ce['id']+_0x50fc('0x95');if(fs[_0x50fc('0x50')](_0x44ef14)){return _0x44ef14;}return writeFile(_0x48098e,_0x44ef14)[_0x50fc('0x24')](function(){return _0x44ef14;});}else{throw new db[(_0x50fc('0x54'))][(_0x50fc('0x55'))]('Transcript\x20not\x20available');}})[_0x50fc('0x24')](function(_0x381d92){return _0x145cac['download'](_0x381d92);})[_0x50fc('0x44')](handleError(_0x145cac));}; \ No newline at end of file +var _0x87ee=['basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','language','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','aws-sdk','uuid/v4','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','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','merge','where','filter','options','VoiceRecording','include','findAll','catch','params','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','Sequelize','ValidationError','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob'];(function(_0x51846c,_0x4bc6c9){var _0x43e5e7=function(_0x5beabc){while(--_0x5beabc){_0x51846c['push'](_0x51846c['shift']());}};_0x43e5e7(++_0x4bc6c9);}(_0x87ee,0xbf));var _0xe87e=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x87ee[_0x550d12];return _0x12103d;};'use strict';var emlformat=require(_0xe87e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe87e('0x1'));var jsonpatch=require(_0xe87e('0x2'));var rp=require(_0xe87e('0x3'));var moment=require(_0xe87e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe87e('0x5'));var util=require(_0xe87e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe87e('0x7'));var ejs=require(_0xe87e('0x8'));var fs=require('fs');var fs_extra=require(_0xe87e('0x9'));var _=require(_0xe87e('0xa'));var squel=require('squel');var crypto=require(_0xe87e('0xb'));var jsforce=require(_0xe87e('0xc'));var deskjs=require(_0xe87e('0xd'));var toCsv=require(_0xe87e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0xe87e('0xe'));var uuidv4=require(_0xe87e('0xf'));var Redis=require(_0xe87e('0x10'));var authService=require(_0xe87e('0x11'));var qs=require(_0xe87e('0x12'));var as=require(_0xe87e('0x13'));var hardwareService=require(_0xe87e('0x14'));var logger=require('../../config/logger')(_0xe87e('0x15'));var utils=require(_0xe87e('0x16'));var config=require(_0xe87e('0x17'));var licenseUtil=require(_0xe87e('0x18'));var db=require(_0xe87e('0x19'))['db'];function respondWithStatusCode(_0x5f1c2a,_0x34d36a){_0x34d36a=_0x34d36a||0xcc;return function(_0x44f719){if(_0x44f719){return _0x5f1c2a[_0xe87e('0x1a')](_0x34d36a);}return _0x5f1c2a[_0xe87e('0x1b')](_0x34d36a)[_0xe87e('0x1c')]();};}function respondWithResult(_0x359df9,_0x19cb59){_0x19cb59=_0x19cb59||0xc8;return function(_0x58fc76){if(_0x58fc76){return _0x359df9['status'](_0x19cb59)[_0xe87e('0x1d')](_0x58fc76);}};}function respondWithFilteredResult(_0x3ca73c,_0x31a6ff){return function(_0x2f0cf0){if(_0x2f0cf0){var _0x452f51=typeof _0x31a6ff['offset']===_0xe87e('0x1e')&&typeof _0x31a6ff[_0xe87e('0x1f')]==='undefined';var _0x23bc9d=_0x2f0cf0[_0xe87e('0x20')];var _0x5266fe=_0x452f51?0x0:_0x31a6ff[_0xe87e('0x21')];var _0x27b033=_0x452f51?_0x2f0cf0[_0xe87e('0x20')]:_0x31a6ff[_0xe87e('0x21')]+_0x31a6ff[_0xe87e('0x1f')];var _0x102fb1;if(_0x27b033>=_0x23bc9d){_0x27b033=_0x23bc9d;_0x102fb1=0xc8;}else{_0x102fb1=0xce;}_0x3ca73c[_0xe87e('0x1b')](_0x102fb1);return _0x3ca73c['set'](_0xe87e('0x22'),_0x5266fe+'-'+_0x27b033+'/'+_0x23bc9d)[_0xe87e('0x1d')](_0x2f0cf0);}return null;};}function patchUpdates(_0x4d0173){return function(_0x1515a7){try{jsonpatch[_0xe87e('0x23')](_0x1515a7,_0x4d0173,!![]);}catch(_0x20aade){return BPromise[_0xe87e('0x24')](_0x20aade);}return _0x1515a7['save']();};}function saveUpdates(_0x36cda5,_0x5dacb9){return function(_0x4066e6){if(_0x4066e6){return _0x4066e6[_0xe87e('0x25')](_0x36cda5)[_0xe87e('0x26')](function(_0xcc1a46){return _0xcc1a46;});}return null;};}function removeEntity(_0x1e8559,_0x23a5c9){return function(_0x437de3){if(_0x437de3){return _0x437de3[_0xe87e('0x27')]()['then'](function(){_0x1e8559['status'](0xcc)[_0xe87e('0x1c')]();});}};}function handleEntityNotFound(_0x1f7e34,_0x418b23){return function(_0x3eea36){if(!_0x3eea36){_0x1f7e34['sendStatus'](0x194);}return _0x3eea36;};}function handleError(_0x3f80a8,_0x334e53){_0x334e53=_0x334e53||0x1f4;return function(_0x506d5b){logger[_0xe87e('0x28')](_0x506d5b[_0xe87e('0x29')]);if(_0x506d5b[_0xe87e('0x2a')]){delete _0x506d5b['name'];}_0x3f80a8[_0xe87e('0x1b')](_0x334e53)[_0xe87e('0x2b')](_0x506d5b);};}exports['index']=function(_0x53f0b0,_0x3f1224){var _0x57ab31={},_0x7320a1={},_0x2c69be={'count':0x0,'rows':[]};var _0x45bb93=_['map'](db['VoiceRecording'][_0xe87e('0x2c')],function(_0x59c4e0){return{'name':_0x59c4e0[_0xe87e('0x2d')],'type':_0x59c4e0[_0xe87e('0x2e')][_0xe87e('0x2f')]};});_0x7320a1[_0xe87e('0x30')]=_[_0xe87e('0x31')](_[_0xe87e('0x32')](_0x45bb93,_0xe87e('0x2a')),[_0xe87e('0x33')]);_0x7320a1[_0xe87e('0x34')]=_[_0xe87e('0x35')](_0x53f0b0[_0xe87e('0x34')]);_0x7320a1[_0xe87e('0x36')]=_['intersection'](_0x7320a1[_0xe87e('0x30')],_0x7320a1[_0xe87e('0x34')]);_0x57ab31['attributes']=_[_0xe87e('0x37')](_0x7320a1[_0xe87e('0x30')],qs[_0xe87e('0x38')](_0x53f0b0[_0xe87e('0x34')]['fields']));_0x57ab31[_0xe87e('0x39')]=_0x57ab31['attributes'][_0xe87e('0x3a')]?_0x57ab31[_0xe87e('0x39')]:_0x7320a1[_0xe87e('0x30')];if(!_0x53f0b0[_0xe87e('0x34')][_0xe87e('0x3b')]('nolimit')){_0x57ab31[_0xe87e('0x1f')]=qs[_0xe87e('0x1f')](_0x53f0b0['query'][_0xe87e('0x1f')]);_0x57ab31[_0xe87e('0x21')]=qs[_0xe87e('0x21')](_0x53f0b0['query'][_0xe87e('0x21')]);}_0x57ab31[_0xe87e('0x3c')]=qs['sort'](_0x53f0b0[_0xe87e('0x34')][_0xe87e('0x3d')]);_0x57ab31['where']=qs['filters'](_[_0xe87e('0x3e')](_0x53f0b0[_0xe87e('0x34')],_0x7320a1['filters']),_0x45bb93);if(_0x53f0b0[_0xe87e('0x34')]['filter']){_0x57ab31['where']=_[_0xe87e('0x3f')](_0x57ab31[_0xe87e('0x40')],{'$or':_[_0xe87e('0x32')](_0x45bb93,function(_0x35ba2c){if(_0x35ba2c[_0xe87e('0x2e')]!=='VIRTUAL'){var _0xf1e9c9={};_0xf1e9c9[_0x35ba2c['name']]={'$like':'%'+_0x53f0b0[_0xe87e('0x34')][_0xe87e('0x41')]+'%'};return _0xf1e9c9;}})});}_0x57ab31=_[_0xe87e('0x3f')]({},_0x57ab31,_0x53f0b0[_0xe87e('0x42')]);var _0x299b5f={'where':_0x57ab31[_0xe87e('0x40')]};return db[_0xe87e('0x43')][_0xe87e('0x20')](_0x299b5f)[_0xe87e('0x26')](function(_0x3d2e3a){_0x2c69be[_0xe87e('0x20')]=_0x3d2e3a;if(_0x53f0b0['query']['includeAll']){_0x57ab31[_0xe87e('0x44')]=[{'all':!![]}];}return db['VoiceRecording'][_0xe87e('0x45')](_0x57ab31);})[_0xe87e('0x26')](function(_0xd394e3){_0x2c69be['rows']=_0xd394e3;return _0x2c69be;})[_0xe87e('0x26')](respondWithFilteredResult(_0x3f1224,_0x57ab31))[_0xe87e('0x46')](handleError(_0x3f1224,null));};exports['show']=function(_0x5ab9dd,_0x50a9a6){var _0x32a800={'raw':![],'where':{'id':_0x5ab9dd[_0xe87e('0x47')]['id']}},_0x126cab={};_0x126cab['model']=_[_0xe87e('0x35')](db[_0xe87e('0x43')][_0xe87e('0x2c')]);_0x126cab['query']=_['keys'](_0x5ab9dd['query']);_0x126cab['filters']=_[_0xe87e('0x37')](_0x126cab[_0xe87e('0x30')],_0x126cab['query']);_0x32a800[_0xe87e('0x39')]=_[_0xe87e('0x37')](_0x126cab[_0xe87e('0x30')],qs['fields'](_0x5ab9dd[_0xe87e('0x34')][_0xe87e('0x38')]));_0x32a800[_0xe87e('0x39')]=_0x32a800['attributes'][_0xe87e('0x3a')]?_0x32a800[_0xe87e('0x39')]:_0x126cab[_0xe87e('0x30')];if(_0x5ab9dd[_0xe87e('0x34')][_0xe87e('0x48')]){_0x32a800[_0xe87e('0x44')]=[{'all':!![]}];}_0x32a800=_[_0xe87e('0x3f')]({},_0x32a800,_0x5ab9dd['options']);return db['VoiceRecording'][_0xe87e('0x49')](_0x32a800)[_0xe87e('0x26')](handleEntityNotFound(_0x50a9a6,null))['then'](respondWithResult(_0x50a9a6,null))[_0xe87e('0x46')](handleError(_0x50a9a6,null));};exports[_0xe87e('0x4a')]=function(_0x3315e9,_0x251e09){return db[_0xe87e('0x43')][_0xe87e('0x4a')](_0x3315e9['body'],{})[_0xe87e('0x26')](respondWithResult(_0x251e09,0xc9))[_0xe87e('0x46')](handleError(_0x251e09,null));};exports[_0xe87e('0x25')]=function(_0x115532,_0x4eecba){if(_0x115532[_0xe87e('0x4b')]['id']){delete _0x115532['body']['id'];}return db[_0xe87e('0x43')][_0xe87e('0x49')]({'where':{'id':_0x115532['params']['id']}})['then'](handleEntityNotFound(_0x4eecba,null))[_0xe87e('0x26')](saveUpdates(_0x115532[_0xe87e('0x4b')],null))['then'](respondWithResult(_0x4eecba,null))[_0xe87e('0x46')](handleError(_0x4eecba,null));};exports[_0xe87e('0x4c')]=function(_0xdbc574,_0x33d6c9){return db[_0xe87e('0x43')][_0xe87e('0x4c')]()[_0xe87e('0x26')](respondWithResult(_0x33d6c9,null))[_0xe87e('0x46')](handleError(_0x33d6c9,null));};exports[_0xe87e('0x4d')]=function(_0x30f3c9,_0x1e05e6,_0x355e7e){var _0x520136=require(_0xe87e('0x4e'));var _0x5b039f=![];var _0x5e8fd9={};if(_0x30f3c9[_0xe87e('0x34')][_0xe87e('0x2e')]&&_0x30f3c9['query'][_0xe87e('0x2e')]===_0xe87e('0x4f')){_0x5e8fd9[_0xe87e('0x4f')]=_0x30f3c9['params']['id'];}else{_0x5e8fd9['id']=_0x30f3c9['params']['id'];}return db['VoiceRecording'][_0xe87e('0x49')]({'where':_0x5e8fd9,'attributes':['id',_0xe87e('0x50')],'raw':!![]})[_0xe87e('0x26')](handleEntityNotFound(_0x1e05e6,null))[_0xe87e('0x26')](function(_0x421e8b){if(_0x421e8b){var _0x5c011d=_0x421e8b[_0xe87e('0x50')];var _0x52f0fa=util['format'](_0xe87e('0x51'),_0x5c011d);if(fs[_0xe87e('0x52')](_0x52f0fa)){_0x5b039f=!![];return _0x520136[_0xe87e('0x53')](_0x52f0fa,_0x5c011d,config[_0xe87e('0x54')][_0xe87e('0x55')])[_0xe87e('0x26')](function(){return _0x421e8b;});}return _0x421e8b;}})['then'](function(_0x1d72f1){if(_0x1d72f1){var _0x182710=_0x1d72f1[_0xe87e('0x50')];if(!fs[_0xe87e('0x52')](_0x182710)){throw new db['Sequelize']['ValidationError'](_0xe87e('0x56'));}if(_0x1d72f1[_0xe87e('0x57')]){return _0x1e05e6[_0xe87e('0x4d')](_0x182710,_0x1d72f1[_0xe87e('0x57')]+path[_0xe87e('0x58')](_0x182710),function(){if(_0x5b039f){fs[_0xe87e('0x59')](_0x182710);}});}else{return _0x1e05e6[_0xe87e('0x4d')](_0x182710,function(_0x546749){if(_0x5b039f){fs[_0xe87e('0x59')](_0x182710);}});}}})[_0xe87e('0x46')](function(_0x233f93){if(_0x233f93[_0xe87e('0x5a')]===_0xe87e('0x56')){_0x1e05e6[_0xe87e('0x1b')](0x194)[_0xe87e('0x2b')](_0xe87e('0x5b'));}else{return handleError(_0x1e05e6,null);}});};exports['downloads']=function(_0x329fa9,_0x522e3d,_0x557a1a){var _0x2e4f5c=require('../../components/encryptor');var _0x478e8a=![];var _0x26db65={'$and':[db['sequelize']['where'](db[_0xe87e('0x5c')]['fn'](_0xe87e('0x5d'),db[_0xe87e('0x5c')][_0xe87e('0x5e')](_0xe87e('0x4f'))),_0x329fa9[_0xe87e('0x34')][_0xe87e('0x5f')])]};if(_0x329fa9['query']['type']&&_0x329fa9['query'][_0xe87e('0x2e')]==='uniqueid'){_0x26db65[_0xe87e('0x60')]['push']({'uniqueid':_0x329fa9[_0xe87e('0x47')]['id']});}else{_0x26db65[_0xe87e('0x60')][_0xe87e('0x61')]({'id':_0x329fa9[_0xe87e('0x47')]['id']});}return db[_0xe87e('0x43')][_0xe87e('0x49')]({'where':_0x26db65,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x522e3d,null))['then'](function(_0x2b3588){if(_0x2b3588){var _0x2e1e34=util[_0xe87e('0x33')](_0xe87e('0x51'),_0x2b3588['value']);if(fs[_0xe87e('0x52')](_0x2e1e34)){_0x478e8a=!![];return _0x2e4f5c['decryptFile'](_0x2e1e34,_0x2b3588[_0xe87e('0x50')],config['secrets'][_0xe87e('0x55')])[_0xe87e('0x26')](function(){return _0x2b3588;});}return _0x2b3588;}})[_0xe87e('0x26')](function(_0x21658e){if(_0x21658e){if(!fs[_0xe87e('0x52')](_0x21658e[_0xe87e('0x50')])){throw new db[(_0xe87e('0x62'))][(_0xe87e('0x63'))](_0xe87e('0x56'));}if(_0x21658e['filename']){return _0x522e3d['download'](_0x21658e['value'],_0x21658e[_0xe87e('0x57')]+path[_0xe87e('0x58')](_0x21658e[_0xe87e('0x50')]),function(){if(_0x478e8a){fs[_0xe87e('0x59')](_0x21658e['value']);}});}else{return _0x522e3d['download'](_0x21658e[_0xe87e('0x50')],function(_0x21e7d3){if(_0x478e8a){fs['unlink'](_0x21658e[_0xe87e('0x50')]);}});}}})[_0xe87e('0x46')](handleError(_0x522e3d,null));};exports[_0xe87e('0x27')]=function(_0x28b3c0,_0x2e57b7){return db[_0xe87e('0x43')]['find']({'where':{'id':_0x28b3c0['params']['id']}})[_0xe87e('0x26')](function(_0x394568){if(_[_0xe87e('0x64')](_0x394568)){throw new ReferenceError(_0xe87e('0x65'));}return _0x394568;})['then'](function(_0x2afe94){var _0x1b1d08=_0x2afe94['value'];logger[_0xe87e('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x1b1d08);if(!_['isNil'](_0x2afe94['value'])&&fs[_0xe87e('0x52')](_0x1b1d08)){logger[_0xe87e('0x66')](_0xe87e('0x67')+_0x1b1d08+_0xe87e('0x68'));fs[_0xe87e('0x69')](_0x1b1d08);}_0x1b1d08=_0x1b1d08+_0xe87e('0x6a');if(!_[_0xe87e('0x64')](_0x2afe94[_0xe87e('0x50')])&&fs[_0xe87e('0x52')](_0x1b1d08)){logger[_0xe87e('0x66')](_0xe87e('0x67')+_0x1b1d08+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe87e('0x69')](_0x1b1d08);}return _0x2afe94;})['then'](function(_0x3eb1a0){if(!_0x3eb1a0)throw new InternalError();return _0x3eb1a0[_0xe87e('0x27')]();})['then'](function(){_0x2e57b7[_0xe87e('0x1b')](0xcc)[_0xe87e('0x1c')]();})['catch'](handleError(_0x2e57b7,null));};function getBucketslist(_0x261b0e,_0x23797f,_0x3de423){return new Promise(function(_0x24565c,_0x3b82ff){var _0x155aae=new AWS['S3']({'accessKeyId':_0x23797f,'secretAccessKey':_0x261b0e,'region':_0x3de423});_0x155aae[_0xe87e('0x6b')]({},function(_0x41f1f3,_0x28fd28){if(_0x41f1f3){return _0x3b82ff(_0x41f1f3);}else{return _0x24565c(_0x28fd28);}});});}function createBucket(_0x2b05ba,_0xce6f7a,_0x3d7275,_0x416b54){return new Promise(function(_0x131393,_0x4dc8cf){var _0x2fc889=new AWS['S3']({'accessKeyId':_0xce6f7a,'secretAccessKey':_0x2b05ba,'region':_0x3d7275});_0x2fc889['createBucket']({'Bucket':_0x416b54},function(_0x3901d5,_0x36dc9a){if(_0x3901d5){return _0x4dc8cf(_0x3901d5);}else{return _0x131393(_0x36dc9a);}});});}function uploadFile(_0x355c0e,_0x58763d,_0x2922c5,_0x2fc7e0,_0x5b105,_0x1966cc){return new Promise(function(_0x43b74a,_0x145e12){var _0x3f9e7b=new AWS['S3']({'accessKeyId':_0x58763d,'secretAccessKey':_0x355c0e,'region':_0x2922c5});_0x3f9e7b[_0xe87e('0x6c')]({'Bucket':_0x2fc7e0,'Key':_0x5b105,'Body':_0x1966cc},function(_0x579b05,_0x8ed669){if(_0x579b05){return _0x145e12(_0x579b05);}else{return _0x43b74a(_0x8ed669);}});});}function startTranscribe(_0x556254,_0x54c6aa,_0x3bea7d,_0x17c668,_0x51dd13,_0x1c6300){return new Promise(function(_0x2c1b54,_0x372d9b){var _0x117807=new AWS[(_0xe87e('0x6d'))]({'accessKeyId':_0x54c6aa,'secretAccessKey':_0x556254,'region':_0x3bea7d});_0x117807[_0xe87e('0x6e')]({'TranscriptionJobName':_0x17c668,'LanguageCode':_0x51dd13,'Media':{'MediaFileUri':_0x1c6300}},function(_0x5952cd,_0x2e50ef){if(_0x5952cd){return _0x372d9b(_0x5952cd);}else{return _0x2c1b54(_0x2e50ef);}});});}function transcribe(_0x319590,_0xf4f7a1,_0x20f8ac,_0x380e24,_0x2a2c2c,_0xff4749,_0xc65d70){return new Promise(function(_0x1f5d4d,_0x429749){var _0x1259a8={};logger['info'](util[_0xe87e('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x319590,_0x2a2c2c));return uploadFile(_0xf4f7a1,_0x20f8ac,_0x380e24,_0x2a2c2c,path[_0xe87e('0x6f')](_0xff4749),fs[_0xe87e('0x70')](_0xff4749))[_0xe87e('0x26')](function(_0x29bd15){logger[_0xe87e('0x66')](util['format'](_0xe87e('0x71'),_0x319590,_0x2a2c2c,_0x29bd15[_0xe87e('0x72')]));_0x1259a8[_0xe87e('0x73')]=_0x29bd15[_0xe87e('0x74')];_0x1259a8[_0xe87e('0x75')]=_0x29bd15[_0xe87e('0x72')];logger[_0xe87e('0x66')](util[_0xe87e('0x33')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x319590));return startTranscribe(_0xf4f7a1,_0x20f8ac,_0x380e24,uuidv4(),_0xc65d70,_0x29bd15[_0xe87e('0x72')]);})[_0xe87e('0x26')](function(_0x508bf1){logger[_0xe87e('0x66')](util['format'](_0xe87e('0x76'),_0x319590,_0x508bf1['TranscriptionJob'][_0xe87e('0x77')]));_0x1259a8[_0xe87e('0x78')]=_0x508bf1[_0xe87e('0x79')][_0xe87e('0x77')];_0x1259a8[_0xe87e('0x7a')]=_0x508bf1[_0xe87e('0x79')]['TranscriptionJobStatus'];return _0x1f5d4d(_0x1259a8);})[_0xe87e('0x46')](function(_0x40a320){return _0x429749(_0x40a320);});});}exports['runTranscribe']=function(_0x4a9e77,_0x5d2244,_0x2c508d){var _0x57e2dc;var _0x324e35;var _0x3ecca3;var _0x2fbf85=require(_0xe87e('0x4e'));return db[_0xe87e('0x43')][_0xe87e('0x7b')]({'where':{'id':_0x4a9e77[_0xe87e('0x47')]['id']}})['then'](function(_0x164a08){if(_0x164a08){var _0x12af37=util['format'](_0xe87e('0x51'),_0x164a08[_0xe87e('0x50')]);if(fs[_0xe87e('0x52')](_0x12af37)){cypher=!![];return _0x2fbf85[_0xe87e('0x53')](_0x12af37,_0x164a08[_0xe87e('0x50')],config[_0xe87e('0x54')][_0xe87e('0x55')])[_0xe87e('0x26')](function(){return _0x164a08;});}return _0x164a08;}})[_0xe87e('0x26')](function(_0x275be2){if(!_0x275be2){throw new db['Sequelize'][(_0xe87e('0x63'))](_0xe87e('0x7c'));}_0x324e35=_0x275be2;return db['Setting'][_0xe87e('0x7b')]({'where':{'id':0x1}});})[_0xe87e('0x26')](handleEntityNotFound(_0x5d2244,null))[_0xe87e('0x26')](function(_0x589920){if(_0x589920){_0x57e2dc=_0x589920;if(!_0x57e2dc[_0xe87e('0x7d')]||!_0x57e2dc[_0xe87e('0x7e')]||!_0x57e2dc['transcribeRegion']||!_0x57e2dc[_0xe87e('0x7f')]||!_0x57e2dc[_0xe87e('0x73')]){throw new db['Sequelize'][(_0xe87e('0x63'))]('Transcribe\x20not\x20configured');}if(_0x4a9e77[_0xe87e('0x4b')]['runSentiment']&&(!_0x57e2dc['sentiment']||!_0x57e2dc[_0xe87e('0x80')]||!_0x57e2dc[_0xe87e('0x81')]||!_0x57e2dc[_0xe87e('0x7f')]||!_0x57e2dc[_0xe87e('0x73')])){throw new db[(_0xe87e('0x62'))]['ValidationError'](_0xe87e('0x82'));}return db[_0xe87e('0x83')]['findOne']({'where':{'id':_0x57e2dc[_0xe87e('0x7e')]}});}})[_0xe87e('0x26')](function(_0x192f48){if(!_0x192f48){throw new db['Sequelize'][(_0xe87e('0x63'))](_0xe87e('0x84'));}if(!_0x192f48[_0xe87e('0x85')]||!_0x192f48[_0xe87e('0x86')]){throw new db[(_0xe87e('0x62'))]['ValidationError'](_0xe87e('0x87'));}_0x3ecca3=_0x192f48;return getBucketslist(_0x3ecca3['data1'],_0x3ecca3[_0xe87e('0x86')],_0x57e2dc[_0xe87e('0x88')]);})[_0xe87e('0x26')](function(_0x3dfd64){if(_0x3dfd64&&_0x3dfd64[_0xe87e('0x89')]){var _0x5a16ea=_[_0xe87e('0x49')](_0x3dfd64[_0xe87e('0x89')],function(_0x5384be){return _0x5384be[_0xe87e('0x8a')]===_0x57e2dc[_0xe87e('0x73')];});if(!_0x5a16ea){logger[_0xe87e('0x66')](util[_0xe87e('0x33')](_0xe87e('0x8b'),_0x4a9e77[_0xe87e('0x47')]['id'],_0x57e2dc[_0xe87e('0x73')]));return createBucket(_0x3ecca3['data1'],_0x3ecca3[_0xe87e('0x86')],_0x57e2dc[_0xe87e('0x88')],_0x57e2dc[_0xe87e('0x73')]);}logger[_0xe87e('0x66')](util[_0xe87e('0x33')](_0xe87e('0x8c'),_0x4a9e77['params']['id'],_0x57e2dc['bucket']));return;}})[_0xe87e('0x26')](function(_0x25f25b){if(_0x324e35['transcribeStatus']==='NEW'){return transcribe(_0x4a9e77[_0xe87e('0x47')]['id'],_0x3ecca3[_0xe87e('0x85')],_0x3ecca3['data2'],_0x57e2dc[_0xe87e('0x88')],_0x57e2dc[_0xe87e('0x73')],_0x324e35[_0xe87e('0x50')],_0x57e2dc[_0xe87e('0x7f')]);}else{logger[_0xe87e('0x66')](util['format'](_0xe87e('0x8d'),_0x4a9e77[_0xe87e('0x47')]['id']));return{'transcribeStatus':_0xe87e('0x8e')};}})['then'](function(_0x1729d4){if(_0x1729d4){_0x1729d4['tempSentiment']=_0x4a9e77[_0xe87e('0x4b')][_0xe87e('0x8f')];return _0x324e35[_0xe87e('0x90')](_0x1729d4);}})[_0xe87e('0x26')](respondWithResult(_0x5d2244,null))[_0xe87e('0x46')](handleError(_0x5d2244,null));};function writeFile(_0x1554e5,_0x3a2a0b){return new Promise(function(_0x5386b5,_0x55f30d){fs[_0xe87e('0x91')](_0x3a2a0b,_0x1554e5,function(_0x4a2633,_0x1c5955){if(_0x4a2633){return _0x55f30d(_0x4a2633);}else{return _0x5386b5(_0x1c5955);}});});}exports[_0xe87e('0x92')]=function(_0x389c8c,_0x33e7d8,_0x1353c4){return db[_0xe87e('0x43')][_0xe87e('0x7b')]({'where':{'id':_0x389c8c['params']['id']}})[_0xe87e('0x26')](handleEntityNotFound(_0x33e7d8))[_0xe87e('0x26')](function(_0x4e6d4){if(_0x4e6d4&&_0x4e6d4[_0xe87e('0x93')]){var _0x40a7d2=_0x4e6d4[_0xe87e('0x93')];var _0x5d8a7c=config[_0xe87e('0x94')]+'/server/files/transcribes/transcribe_'+_0x4e6d4['id']+_0xe87e('0x95');if(fs[_0xe87e('0x52')](_0x5d8a7c)){return _0x5d8a7c;}return writeFile(_0x40a7d2,_0x5d8a7c)[_0xe87e('0x26')](function(){return _0x5d8a7c;});}else{throw new db[(_0xe87e('0x62'))][(_0xe87e('0x63'))](_0xe87e('0x96'));}})[_0xe87e('0x26')](function(_0x46870e){return _0x33e7d8[_0xe87e('0x4d')](_0x46870e);})['catch'](handleError(_0x33e7d8));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 33e1012..456f30d 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 _0x11e3=['VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x3a8ff0,_0x49fc6e){var _0x46d6ba=function(_0xc73be8){while(--_0xc73be8){_0x3a8ff0['push'](_0x3a8ff0['shift']());}};_0x46d6ba(++_0x49fc6e);}(_0x11e3,0x6f));var _0x311e=function(_0xe51299,_0x1f1a98){_0xe51299=_0xe51299-0x0;var _0x2efed7=_0x11e3[_0xe51299];return _0x2efed7;};'use strict';var _=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var logger=require(_0x311e('0x2'))(_0x311e('0x3'));var moment=require('moment');var BPromise=require(_0x311e('0x4'));var rp=require(_0x311e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x311e('0x6'));var config=require(_0x311e('0x7'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0xe46ee6,_0xd18f09){return _0xe46ee6[_0x311e('0x8')](_0x311e('0x9'),attributes,{'tableName':_0x311e('0xa'),'paranoid':![],'indexes':[{'name':_0x311e('0xb'),'fields':[_0x311e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x46b7=['uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x12347b,_0x38a042){var _0xf92513=function(_0xc66aaf){while(--_0xc66aaf){_0x12347b['push'](_0x12347b['shift']());}};_0xf92513(++_0x38a042);}(_0x46b7,0xa9));var _0x746b=function(_0xfda00,_0x33fe78){_0xfda00=_0xfda00-0x0;var _0x86314e=_0x46b7[_0xfda00];return _0x86314e;};'use strict';var _=require('lodash');var util=require(_0x746b('0x0'));var logger=require(_0x746b('0x1'))(_0x746b('0x2'));var moment=require(_0x746b('0x3'));var BPromise=require('bluebird');var rp=require(_0x746b('0x4'));var fs=require('fs');var path=require(_0x746b('0x5'));var rimraf=require(_0x746b('0x6'));var config=require('../../config/environment');var attributes=require(_0x746b('0x7'));module[_0x746b('0x8')]=function(_0x167839,_0x50b09e){return _0x167839[_0x746b('0x9')](_0x746b('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x746b('0xb'),'fields':[_0x746b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 0cb0197..d8a56f9 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 _0x8aad=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info'];(function(_0x27bc6d,_0x4ece2a){var _0x6c9f0=function(_0x1741b6){while(--_0x1741b6){_0x27bc6d['push'](_0x27bc6d['shift']());}};_0x6c9f0(++_0x4ece2a);}(_0x8aad,0x146));var _0xd8aa=function(_0x2cd584,_0x189ec4){_0x2cd584=_0x2cd584-0x0;var _0x12e780=_0x8aad[_0x2cd584];return _0x12e780;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});}exports[_0xd8aa('0x14')]=function(_0x32e2cd){var _0x3a29ca=this;return new Promise(function(_0x2d34ac,_0x4953be){return db[_0xd8aa('0x15')][_0xd8aa('0x16')](_0x32e2cd[_0xd8aa('0x17')],{'raw':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd['options'][_0xd8aa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd[_0xd8aa('0x18')][_0xd8aa('0x1a')]||null:null,'attributes':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd['options'][_0xd8aa('0x1b')]||null:null,'limit':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd[_0xd8aa('0x18')]['limit']||null:null})[_0xd8aa('0x1c')](function(_0x7a4ce7){logger[_0xd8aa('0x9')](_0xd8aa('0x14'),_0x32e2cd);logger[_0xd8aa('0xc')](_0xd8aa('0x14'),_0x32e2cd,JSON[_0xd8aa('0xe')](_0x7a4ce7));_0x2d34ac(_0x7a4ce7);})[_0xd8aa('0x13')](function(_0x375f64){logger[_0xd8aa('0xf')](_0xd8aa('0x14'),_0x375f64[_0xd8aa('0x11')],_0x32e2cd);_0x4953be(_0x3a29ca[_0xd8aa('0xf')](0x1f4,_0x375f64['message']));});});};exports[_0xd8aa('0x1d')]=function(_0x59eb3f){var _0xd4d204=this;return new Promise(function(_0x1f6ab2,_0x26cff3){var _0x3696fd=require(_0xd8aa('0x1e'));var _0x19edee;return db[_0xd8aa('0x1f')][_0xd8aa('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xd8aa('0x1c')](function(_0x34b792){_0x19edee=_0x34b792;return db[_0xd8aa('0x15')]['create'](_0x59eb3f[_0xd8aa('0x17')]);})['then'](function(_0x3052c6){if(_0x19edee[_0xd8aa('0x21')]&&fs[_0xd8aa('0x22')](_0x3052c6[_0xd8aa('0x23')])){var _0x44f783=util[_0xd8aa('0x24')](_0xd8aa('0x25'),_0x3052c6[_0xd8aa('0x23')]);return _0x3696fd['encryptFile'](_0x3052c6[_0xd8aa('0x23')],_0x44f783,config[_0xd8aa('0x26')][_0xd8aa('0x27')])[_0xd8aa('0x1c')](function(){fs[_0xd8aa('0x28')](_0x3052c6[_0xd8aa('0x23')]);logger[_0xd8aa('0x9')](_0xd8aa('0x29'));return _0x3052c6;});}return _0x3052c6;})['then'](function(_0x265217){logger[_0xd8aa('0x9')](_0xd8aa('0x1d'),_0x59eb3f);logger['debug'](_0xd8aa('0x1d'),_0x59eb3f,JSON[_0xd8aa('0xe')](_0x265217));_0x1f6ab2(_0x265217);})[_0xd8aa('0x13')](function(_0x45c216){logger[_0xd8aa('0xf')](_0xd8aa('0x1d'),_0x45c216[_0xd8aa('0x11')],_0x59eb3f);_0x26cff3(_0xd4d204[_0xd8aa('0xf')](0x1f4,_0x45c216[_0xd8aa('0x11')]));});});}; \ No newline at end of file +var _0x7880=['encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateVoiceRecording','update','body','options','where','attributes','then','stringify','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7880,0x1f4));var _0x0788=function(_0x11cbb5,_0x390441){_0x11cbb5=_0x11cbb5-0x0;var _0x54b8d3=_0x7880[_0x11cbb5];return _0x54b8d3;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});}exports[_0x0788('0x17')]=function(_0x5b2bdc){var _0x654e4b=this;return new Promise(function(_0x415f19,_0x17ae59){return db['VoiceRecording'][_0x0788('0x18')](_0x5b2bdc[_0x0788('0x19')],{'raw':_0x5b2bdc['options']?_0x5b2bdc[_0x0788('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b2bdc[_0x0788('0x1a')]?_0x5b2bdc['options'][_0x0788('0x1b')]||null:null,'attributes':_0x5b2bdc[_0x0788('0x1a')]?_0x5b2bdc[_0x0788('0x1a')][_0x0788('0x1c')]||null:null,'limit':_0x5b2bdc[_0x0788('0x1a')]?_0x5b2bdc['options']['limit']||null:null})[_0x0788('0x1d')](function(_0x2a1460){logger[_0x0788('0x14')](_0x0788('0x17'),_0x5b2bdc);logger['debug']('UpdateVoiceRecording',_0x5b2bdc,JSON[_0x0788('0x1e')](_0x2a1460));_0x415f19(_0x2a1460);})[_0x0788('0x16')](function(_0x40309d){logger['error']('UpdateVoiceRecording',_0x40309d[_0x0788('0x13')],_0x5b2bdc);_0x17ae59(_0x654e4b[_0x0788('0x11')](0x1f4,_0x40309d['message']));});});};exports['CreateVoiceRecording']=function(_0x5a54a5){var _0x44798c=this;return new Promise(function(_0x57fda1,_0x286730){var _0x40e7a6=require(_0x0788('0x1f'));var _0x18fc0e;return db[_0x0788('0x20')][_0x0788('0x21')]({'attributes':['id',_0x0788('0x22')],'where':{'id':0x1},'raw':!![]})[_0x0788('0x1d')](function(_0x5b7594){_0x18fc0e=_0x5b7594;return db['VoiceRecording'][_0x0788('0x23')](_0x5a54a5[_0x0788('0x19')]);})['then'](function(_0x4aa48b){if(_0x18fc0e[_0x0788('0x22')]&&fs[_0x0788('0x24')](_0x4aa48b[_0x0788('0x25')])){var _0x436031=util[_0x0788('0x26')](_0x0788('0x27'),_0x4aa48b[_0x0788('0x25')]);return _0x40e7a6[_0x0788('0x28')](_0x4aa48b[_0x0788('0x25')],_0x436031,config[_0x0788('0x29')]['recording'])[_0x0788('0x1d')](function(){fs[_0x0788('0x2a')](_0x4aa48b[_0x0788('0x25')]);logger[_0x0788('0x14')](_0x0788('0x2b'));return _0x4aa48b;});}return _0x4aa48b;})[_0x0788('0x1d')](function(_0x26f584){logger[_0x0788('0x14')](_0x0788('0x2c'),_0x5a54a5);logger[_0x0788('0xf')]('CreateVoiceRecording',_0x5a54a5,JSON['stringify'](_0x26f584));_0x57fda1(_0x26f584);})['catch'](function(_0x5633da){logger['error']('CreateVoiceRecording',_0x5633da[_0x0788('0x13')],_0x5a54a5);_0x286730(_0x44798c[_0x0788('0x11')](0x1f4,_0x5633da[_0x0788('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index b49412f..e1f418f 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 _0x25b0=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x3a2797,_0x1f905c){var _0x5c2d96=function(_0x3c7bd7){while(--_0x3c7bd7){_0x3a2797['push'](_0x3a2797['shift']());}};_0x5c2d96(++_0x1f905c);}(_0x25b0,0x17e));var _0x025b=function(_0x4fbaf9,_0x3b8190){_0x4fbaf9=_0x4fbaf9-0x0;var _0x1d89a0=_0x25b0[_0x4fbaf9];return _0x1d89a0;};'use strict';var multer=require(_0x025b('0x0'));var util=require(_0x025b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x025b('0x2'));var auth=require(_0x025b('0x3'));var interaction=require(_0x025b('0x4'));var config=require(_0x025b('0x5'));var controller=require(_0x025b('0x6'));router[_0x025b('0x7')]('/',auth[_0x025b('0x8')](),controller[_0x025b('0x9')]);router[_0x025b('0x7')](_0x025b('0xa'),auth[_0x025b('0x8')](),controller[_0x025b('0xb')]);router[_0x025b('0x7')](_0x025b('0xc'),auth[_0x025b('0x8')](),controller[_0x025b('0xd')]);router[_0x025b('0xe')]('/',auth[_0x025b('0x8')](),controller[_0x025b('0xf')]);router[_0x025b('0x10')](_0x025b('0xc'),auth[_0x025b('0x8')](),controller[_0x025b('0x11')]);router['delete'](_0x025b('0xc'),auth[_0x025b('0x8')](),controller[_0x025b('0x12')]);module[_0x025b('0x13')]=router; \ No newline at end of file +var _0xac27=['show','post','create','put','/:id','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x30080f,_0x55f038){var _0x2288c3=function(_0x1b86dd){while(--_0x1b86dd){_0x30080f['push'](_0x30080f['shift']());}};_0x2288c3(++_0x55f038);}(_0xac27,0xbc));var _0x7ac2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xac27[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x7ac2('0x0'));var path=require(_0x7ac2('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ac2('0x2'));var router=express['Router']();var fs_extra=require(_0x7ac2('0x3'));var auth=require(_0x7ac2('0x4'));var interaction=require(_0x7ac2('0x5'));var config=require(_0x7ac2('0x6'));var controller=require(_0x7ac2('0x7'));router[_0x7ac2('0x8')]('/',auth[_0x7ac2('0x9')](),controller['index']);router[_0x7ac2('0x8')](_0x7ac2('0xa'),auth[_0x7ac2('0x9')](),controller[_0x7ac2('0xb')]);router['get']('/:id',auth[_0x7ac2('0x9')](),controller[_0x7ac2('0xc')]);router[_0x7ac2('0xd')]('/',auth[_0x7ac2('0x9')](),controller[_0x7ac2('0xe')]);router[_0x7ac2('0xf')](_0x7ac2('0x10'),auth['isAuthenticated'](),controller[_0x7ac2('0x11')]);router['delete'](_0x7ac2('0x10'),auth['isAuthenticated'](),controller[_0x7ac2('0x12')]);module[_0x7ac2('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 4caee0a..e779486 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 _0xb046=['ENUM','blind','attended','STRING','sequelize','moment'];(function(_0x16142d,_0x518da9){var _0x4e2aeb=function(_0x20fc76){while(--_0x20fc76){_0x16142d['push'](_0x16142d['shift']());}};_0x4e2aeb(++_0x518da9);}(_0xb046,0x142));var _0x6b04=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xb046[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x6b04('0x0'));var moment=require(_0x6b04('0x1'));module['exports']={'type':{'type':Sequelize[_0x6b04('0x2')](_0x6b04('0x3'),_0x6b04('0x4'))},'result':{'type':Sequelize[_0x6b04('0x5')]},'transfererchannel':{'type':Sequelize[_0x6b04('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x6b04('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x6b04('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x6b04('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x6b04('0x5')]},'transferercontext':{'type':Sequelize[_0x6b04('0x5')]},'transfererexten':{'type':Sequelize[_0x6b04('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x6b04('0x5')]},'transfereechannel':{'type':Sequelize[_0x6b04('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x6b04('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x6b04('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6b04('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6b04('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x6b04('0x5')]},'transfereeexten':{'type':Sequelize[_0x6b04('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x6b04('0x5')]},'isexternal':{'type':Sequelize[_0x6b04('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x6b04('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x35a1=['sequelize','ENUM','attended','STRING','Yes'];(function(_0x22cd0c,_0x4040b6){var _0x439eba=function(_0x43c4a0){while(--_0x43c4a0){_0x22cd0c['push'](_0x22cd0c['shift']());}};_0x439eba(++_0x4040b6);}(_0x35a1,0xfa));var _0x135a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x35a1[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require(_0x135a('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x135a('0x1')]('blind',_0x135a('0x2'))},'result':{'type':Sequelize[_0x135a('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x135a('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x135a('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x135a('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x135a('0x3')]},'transferercontext':{'type':Sequelize[_0x135a('0x3')]},'transfererexten':{'type':Sequelize[_0x135a('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x135a('0x3')]},'transfereechannel':{'type':Sequelize[_0x135a('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x135a('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x135a('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x135a('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x135a('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x135a('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x135a('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0x135a('0x4'),'No')},'context':{'type':Sequelize[_0x135a('0x3')]},'extension':{'type':Sequelize[_0x135a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9057f6e..b76ac70 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 _0x2340=['catch','show','rawAttributes','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x485342,_0xe19f6f){var _0x54e30c=function(_0x5048a7){while(--_0x5048a7){_0x485342['push'](_0x485342['shift']());}};_0x54e30c(++_0xe19f6f);}(_0x2340,0x157));var _0x0234=function(_0x529aff,_0x7b99af){_0x529aff=_0x529aff-0x0;var _0x1a1e64=_0x2340[_0x529aff];return _0x1a1e64;};'use strict';var emlformat=require(_0x0234('0x0'));var rimraf=require(_0x0234('0x1'));var zipdir=require(_0x0234('0x2'));var jsonpatch=require(_0x0234('0x3'));var rp=require(_0x0234('0x4'));var moment=require(_0x0234('0x5'));var BPromise=require(_0x0234('0x6'));var Mustache=require(_0x0234('0x7'));var util=require(_0x0234('0x8'));var path=require(_0x0234('0x9'));var sox=require(_0x0234('0xa'));var csv=require('to-csv');var ejs=require(_0x0234('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0234('0xc'));var squel=require(_0x0234('0xd'));var crypto=require('crypto');var jsforce=require(_0x0234('0xe'));var deskjs=require(_0x0234('0xf'));var toCsv=require(_0x0234('0x10'));var querystring=require(_0x0234('0x11'));var Papa=require(_0x0234('0x12'));var Redis=require(_0x0234('0x13'));var authService=require(_0x0234('0x14'));var qs=require(_0x0234('0x15'));var as=require(_0x0234('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0234('0x17'))(_0x0234('0x18'));var utils=require(_0x0234('0x19'));var config=require(_0x0234('0x1a'));var licenseUtil=require(_0x0234('0x1b'));var db=require(_0x0234('0x1c'))['db'];function respondWithStatusCode(_0x472a1d,_0x724e5){_0x724e5=_0x724e5||0xcc;return function(_0x2757ff){if(_0x2757ff){return _0x472a1d[_0x0234('0x1d')](_0x724e5);}return _0x472a1d[_0x0234('0x1e')](_0x724e5)[_0x0234('0x1f')]();};}function respondWithResult(_0x543451,_0x1d5e34){_0x1d5e34=_0x1d5e34||0xc8;return function(_0x4e07aa){if(_0x4e07aa){return _0x543451[_0x0234('0x1e')](_0x1d5e34)['json'](_0x4e07aa);}};}function respondWithFilteredResult(_0xb65369,_0x5ba3cf){return function(_0x2c9933){if(_0x2c9933){var _0x234914=typeof _0x5ba3cf[_0x0234('0x20')]===_0x0234('0x21')&&typeof _0x5ba3cf[_0x0234('0x22')]===_0x0234('0x21');var _0x4477b6=_0x2c9933[_0x0234('0x23')];var _0x502faa=_0x234914?0x0:_0x5ba3cf[_0x0234('0x20')];var _0x7b944d=_0x234914?_0x2c9933[_0x0234('0x23')]:_0x5ba3cf['offset']+_0x5ba3cf[_0x0234('0x22')];var _0x28ec08;if(_0x7b944d>=_0x4477b6){_0x7b944d=_0x4477b6;_0x28ec08=0xc8;}else{_0x28ec08=0xce;}_0xb65369[_0x0234('0x1e')](_0x28ec08);return _0xb65369[_0x0234('0x24')](_0x0234('0x25'),_0x502faa+'-'+_0x7b944d+'/'+_0x4477b6)[_0x0234('0x26')](_0x2c9933);}return null;};}function patchUpdates(_0x1d9273){return function(_0x5ea19a){try{jsonpatch[_0x0234('0x27')](_0x5ea19a,_0x1d9273,!![]);}catch(_0x49359b){return BPromise[_0x0234('0x28')](_0x49359b);}return _0x5ea19a[_0x0234('0x29')]();};}function saveUpdates(_0x2216b2,_0xf04751){return function(_0x28ae3b){if(_0x28ae3b){return _0x28ae3b[_0x0234('0x2a')](_0x2216b2)[_0x0234('0x2b')](function(_0x1c0bbb){return _0x1c0bbb;});}return null;};}function removeEntity(_0x2bf55b,_0x50f829){return function(_0x3a3b78){if(_0x3a3b78){return _0x3a3b78[_0x0234('0x2c')]()['then'](function(){_0x2bf55b[_0x0234('0x1e')](0xcc)[_0x0234('0x1f')]();});}};}function handleEntityNotFound(_0x59fe79,_0x30d7de){return function(_0x48d5e0){if(!_0x48d5e0){_0x59fe79[_0x0234('0x1d')](0x194);}return _0x48d5e0;};}function handleError(_0x222dbd,_0x8e1362){_0x8e1362=_0x8e1362||0x1f4;return function(_0x5e46fa){logger[_0x0234('0x2d')](_0x5e46fa[_0x0234('0x2e')]);if(_0x5e46fa[_0x0234('0x2f')]){delete _0x5e46fa[_0x0234('0x2f')];}_0x222dbd[_0x0234('0x1e')](_0x8e1362)[_0x0234('0x30')](_0x5e46fa);};}exports[_0x0234('0x31')]=function(_0xf1371a,_0x415bf6){var _0x535e5d={},_0x1d7cdd={},_0x3130c0={'count':0x0,'rows':[]};var _0x2c7b3b=_[_0x0234('0x32')](db[_0x0234('0x33')]['rawAttributes'],function(_0x5568ef){return{'name':_0x5568ef[_0x0234('0x34')],'type':_0x5568ef[_0x0234('0x35')][_0x0234('0x36')]};});_0x1d7cdd[_0x0234('0x37')]=_[_0x0234('0x32')](_0x2c7b3b,_0x0234('0x2f'));_0x1d7cdd['query']=_[_0x0234('0x38')](_0xf1371a['query']);_0x1d7cdd[_0x0234('0x39')]=_['intersection'](_0x1d7cdd['model'],_0x1d7cdd[_0x0234('0x3a')]);_0x535e5d[_0x0234('0x3b')]=_[_0x0234('0x3c')](_0x1d7cdd['model'],qs[_0x0234('0x3d')](_0xf1371a[_0x0234('0x3a')]['fields']));_0x535e5d[_0x0234('0x3b')]=_0x535e5d['attributes'][_0x0234('0x3e')]?_0x535e5d[_0x0234('0x3b')]:_0x1d7cdd[_0x0234('0x37')];if(!_0xf1371a[_0x0234('0x3a')][_0x0234('0x3f')](_0x0234('0x40'))){_0x535e5d[_0x0234('0x22')]=qs[_0x0234('0x22')](_0xf1371a[_0x0234('0x3a')][_0x0234('0x22')]);_0x535e5d[_0x0234('0x20')]=qs['offset'](_0xf1371a[_0x0234('0x3a')][_0x0234('0x20')]);}_0x535e5d[_0x0234('0x41')]=qs[_0x0234('0x42')](_0xf1371a[_0x0234('0x3a')][_0x0234('0x42')]);_0x535e5d[_0x0234('0x43')]=qs[_0x0234('0x39')](_[_0x0234('0x44')](_0xf1371a[_0x0234('0x3a')],_0x1d7cdd[_0x0234('0x39')]),_0x2c7b3b);if(_0xf1371a['query']['filter']){_0x535e5d['where']=_['merge'](_0x535e5d[_0x0234('0x43')],{'$or':_[_0x0234('0x32')](_0x2c7b3b,function(_0x5c3e51){if(_0x5c3e51[_0x0234('0x35')]!==_0x0234('0x45')){var _0x2eecbc={};_0x2eecbc[_0x5c3e51[_0x0234('0x2f')]]={'$like':'%'+_0xf1371a[_0x0234('0x3a')][_0x0234('0x46')]+'%'};return _0x2eecbc;}})});}_0x535e5d=_[_0x0234('0x47')]({},_0x535e5d,_0xf1371a[_0x0234('0x48')]);var _0x3d45ce={'where':_0x535e5d[_0x0234('0x43')]};return db[_0x0234('0x33')][_0x0234('0x23')](_0x3d45ce)[_0x0234('0x2b')](function(_0x3432cb){_0x3130c0[_0x0234('0x23')]=_0x3432cb;if(_0xf1371a['query'][_0x0234('0x49')]){_0x535e5d[_0x0234('0x4a')]=[{'all':!![]}];}return db[_0x0234('0x33')][_0x0234('0x4b')](_0x535e5d);})[_0x0234('0x2b')](function(_0xfb5854){_0x3130c0[_0x0234('0x4c')]=_0xfb5854;return _0x3130c0;})['then'](respondWithFilteredResult(_0x415bf6,_0x535e5d))[_0x0234('0x4d')](handleError(_0x415bf6,null));};exports[_0x0234('0x4e')]=function(_0x7b92c8,_0x35774b){var _0x32452b={'raw':!![],'where':{'id':_0x7b92c8['params']['id']}},_0x3edceb={};_0x3edceb[_0x0234('0x37')]=_['keys'](db[_0x0234('0x33')][_0x0234('0x4f')]);_0x3edceb[_0x0234('0x3a')]=_['keys'](_0x7b92c8[_0x0234('0x3a')]);_0x3edceb[_0x0234('0x39')]=_[_0x0234('0x3c')](_0x3edceb[_0x0234('0x37')],_0x3edceb[_0x0234('0x3a')]);_0x32452b[_0x0234('0x3b')]=_[_0x0234('0x3c')](_0x3edceb[_0x0234('0x37')],qs[_0x0234('0x3d')](_0x7b92c8[_0x0234('0x3a')][_0x0234('0x3d')]));_0x32452b[_0x0234('0x3b')]=_0x32452b[_0x0234('0x3b')][_0x0234('0x3e')]?_0x32452b['attributes']:_0x3edceb[_0x0234('0x37')];if(_0x7b92c8[_0x0234('0x3a')][_0x0234('0x49')]){_0x32452b['include']=[{'all':!![]}];}_0x32452b=_[_0x0234('0x47')]({},_0x32452b,_0x7b92c8[_0x0234('0x48')]);return db[_0x0234('0x33')]['find'](_0x32452b)[_0x0234('0x2b')](handleEntityNotFound(_0x35774b,null))[_0x0234('0x2b')](respondWithResult(_0x35774b,null))[_0x0234('0x4d')](handleError(_0x35774b,null));};exports['create']=function(_0x3900d8,_0x2e6848){return db[_0x0234('0x33')]['create'](_0x3900d8[_0x0234('0x50')],{})['then'](respondWithResult(_0x2e6848,0xc9))['catch'](handleError(_0x2e6848,null));};exports['update']=function(_0x1bedd4,_0x1cb75f){if(_0x1bedd4['body']['id']){delete _0x1bedd4[_0x0234('0x50')]['id'];}return db[_0x0234('0x33')][_0x0234('0x51')]({'where':{'id':_0x1bedd4[_0x0234('0x52')]['id']}})[_0x0234('0x2b')](handleEntityNotFound(_0x1cb75f,null))[_0x0234('0x2b')](saveUpdates(_0x1bedd4[_0x0234('0x50')],null))[_0x0234('0x2b')](respondWithResult(_0x1cb75f,null))[_0x0234('0x4d')](handleError(_0x1cb75f,null));};exports['destroy']=function(_0x30e2,_0x16c835){return db[_0x0234('0x33')][_0x0234('0x51')]({'where':{'id':_0x30e2[_0x0234('0x52')]['id']}})['then'](handleEntityNotFound(_0x16c835,null))[_0x0234('0x2b')](removeEntity(_0x16c835,null))[_0x0234('0x4d')](handleError(_0x16c835,null));};exports[_0x0234('0x53')]=function(_0x4dd92f,_0x1b0636){return db[_0x0234('0x33')][_0x0234('0x53')]()[_0x0234('0x2b')](respondWithResult(_0x1b0636,null))[_0x0234('0x4d')](handleError(_0x1b0636,null));}; \ No newline at end of file +var _0x0774=['include','findAll','rows','show','params','keys','length','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','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','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll'];(function(_0x4d7a7d,_0x2ac6c9){var _0x50d66d=function(_0x3cdf41){while(--_0x3cdf41){_0x4d7a7d['push'](_0x4d7a7d['shift']());}};_0x50d66d(++_0x2ac6c9);}(_0x0774,0x1ac));var _0x4077=function(_0x314e8a,_0x430404){_0x314e8a=_0x314e8a-0x0;var _0x5ab7d4=_0x0774[_0x314e8a];return _0x5ab7d4;};'use strict';var emlformat=require(_0x4077('0x0'));var rimraf=require(_0x4077('0x1'));var zipdir=require(_0x4077('0x2'));var jsonpatch=require(_0x4077('0x3'));var rp=require(_0x4077('0x4'));var moment=require(_0x4077('0x5'));var BPromise=require(_0x4077('0x6'));var Mustache=require('mustache');var util=require(_0x4077('0x7'));var path=require(_0x4077('0x8'));var sox=require(_0x4077('0x9'));var csv=require(_0x4077('0xa'));var ejs=require(_0x4077('0xb'));var fs=require('fs');var fs_extra=require(_0x4077('0xc'));var _=require(_0x4077('0xd'));var squel=require('squel');var crypto=require(_0x4077('0xe'));var jsforce=require(_0x4077('0xf'));var deskjs=require(_0x4077('0x10'));var toCsv=require(_0x4077('0xa'));var querystring=require(_0x4077('0x11'));var Papa=require(_0x4077('0x12'));var Redis=require(_0x4077('0x13'));var authService=require(_0x4077('0x14'));var qs=require(_0x4077('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4077('0x16'));var logger=require('../../config/logger')(_0x4077('0x17'));var utils=require(_0x4077('0x18'));var config=require(_0x4077('0x19'));var licenseUtil=require(_0x4077('0x1a'));var db=require(_0x4077('0x1b'))['db'];function respondWithStatusCode(_0x5ae1ed,_0x476e79){_0x476e79=_0x476e79||0xcc;return function(_0x4e6c58){if(_0x4e6c58){return _0x5ae1ed[_0x4077('0x1c')](_0x476e79);}return _0x5ae1ed[_0x4077('0x1d')](_0x476e79)[_0x4077('0x1e')]();};}function respondWithResult(_0x47ba05,_0x5ce8f7){_0x5ce8f7=_0x5ce8f7||0xc8;return function(_0x393d83){if(_0x393d83){return _0x47ba05[_0x4077('0x1d')](_0x5ce8f7)[_0x4077('0x1f')](_0x393d83);}};}function respondWithFilteredResult(_0x4f6724,_0x242d38){return function(_0x5d7074){if(_0x5d7074){var _0x2d81d7=typeof _0x242d38[_0x4077('0x20')]===_0x4077('0x21')&&typeof _0x242d38[_0x4077('0x22')]===_0x4077('0x21');var _0x40e3f7=_0x5d7074['count'];var _0x5f5945=_0x2d81d7?0x0:_0x242d38[_0x4077('0x20')];var _0x2facbd=_0x2d81d7?_0x5d7074[_0x4077('0x23')]:_0x242d38['offset']+_0x242d38[_0x4077('0x22')];var _0x54ab15;if(_0x2facbd>=_0x40e3f7){_0x2facbd=_0x40e3f7;_0x54ab15=0xc8;}else{_0x54ab15=0xce;}_0x4f6724[_0x4077('0x1d')](_0x54ab15);return _0x4f6724[_0x4077('0x24')](_0x4077('0x25'),_0x5f5945+'-'+_0x2facbd+'/'+_0x40e3f7)[_0x4077('0x1f')](_0x5d7074);}return null;};}function patchUpdates(_0x587448){return function(_0x26d0e0){try{jsonpatch[_0x4077('0x26')](_0x26d0e0,_0x587448,!![]);}catch(_0x46b9a0){return BPromise[_0x4077('0x27')](_0x46b9a0);}return _0x26d0e0[_0x4077('0x28')]();};}function saveUpdates(_0x1aef96,_0x3a3d5e){return function(_0x4f696b){if(_0x4f696b){return _0x4f696b[_0x4077('0x29')](_0x1aef96)['then'](function(_0x33bffa){return _0x33bffa;});}return null;};}function removeEntity(_0x2fa958,_0x164b51){return function(_0x1d2a64){if(_0x1d2a64){return _0x1d2a64[_0x4077('0x2a')]()[_0x4077('0x2b')](function(){_0x2fa958[_0x4077('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b7b9,_0x1dc2e9){return function(_0x2b64ac){if(!_0x2b64ac){_0x18b7b9[_0x4077('0x1c')](0x194);}return _0x2b64ac;};}function handleError(_0x5f4e3b,_0x289bf7){_0x289bf7=_0x289bf7||0x1f4;return function(_0x21ecc7){logger[_0x4077('0x2c')](_0x21ecc7[_0x4077('0x2d')]);if(_0x21ecc7['name']){delete _0x21ecc7[_0x4077('0x2e')];}_0x5f4e3b[_0x4077('0x1d')](_0x289bf7)[_0x4077('0x2f')](_0x21ecc7);};}exports['index']=function(_0x3083b0,_0x5ece04){var _0x118dbe={},_0x41a48c={},_0x27ee33={'count':0x0,'rows':[]};var _0xddce52=_[_0x4077('0x30')](db[_0x4077('0x31')][_0x4077('0x32')],function(_0x4d1c1d){return{'name':_0x4d1c1d[_0x4077('0x33')],'type':_0x4d1c1d['type'][_0x4077('0x34')]};});_0x41a48c[_0x4077('0x35')]=_[_0x4077('0x30')](_0xddce52,_0x4077('0x2e'));_0x41a48c[_0x4077('0x36')]=_['keys'](_0x3083b0[_0x4077('0x36')]);_0x41a48c['filters']=_['intersection'](_0x41a48c[_0x4077('0x35')],_0x41a48c['query']);_0x118dbe[_0x4077('0x37')]=_[_0x4077('0x38')](_0x41a48c[_0x4077('0x35')],qs['fields'](_0x3083b0[_0x4077('0x36')][_0x4077('0x39')]));_0x118dbe['attributes']=_0x118dbe[_0x4077('0x37')]['length']?_0x118dbe[_0x4077('0x37')]:_0x41a48c[_0x4077('0x35')];if(!_0x3083b0['query'][_0x4077('0x3a')](_0x4077('0x3b'))){_0x118dbe[_0x4077('0x22')]=qs[_0x4077('0x22')](_0x3083b0[_0x4077('0x36')]['limit']);_0x118dbe[_0x4077('0x20')]=qs['offset'](_0x3083b0[_0x4077('0x36')][_0x4077('0x20')]);}_0x118dbe[_0x4077('0x3c')]=qs[_0x4077('0x3d')](_0x3083b0[_0x4077('0x36')][_0x4077('0x3d')]);_0x118dbe[_0x4077('0x3e')]=qs[_0x4077('0x3f')](_[_0x4077('0x40')](_0x3083b0['query'],_0x41a48c[_0x4077('0x3f')]),_0xddce52);if(_0x3083b0[_0x4077('0x36')][_0x4077('0x41')]){_0x118dbe['where']=_[_0x4077('0x42')](_0x118dbe[_0x4077('0x3e')],{'$or':_[_0x4077('0x30')](_0xddce52,function(_0x4a03ae){if(_0x4a03ae[_0x4077('0x43')]!==_0x4077('0x44')){var _0x454473={};_0x454473[_0x4a03ae['name']]={'$like':'%'+_0x3083b0[_0x4077('0x36')][_0x4077('0x41')]+'%'};return _0x454473;}})});}_0x118dbe=_['merge']({},_0x118dbe,_0x3083b0['options']);var _0x15729f={'where':_0x118dbe[_0x4077('0x3e')]};return db[_0x4077('0x31')][_0x4077('0x23')](_0x15729f)['then'](function(_0x194ef1){_0x27ee33['count']=_0x194ef1;if(_0x3083b0[_0x4077('0x36')][_0x4077('0x45')]){_0x118dbe[_0x4077('0x46')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x4077('0x47')](_0x118dbe);})['then'](function(_0x571770){_0x27ee33[_0x4077('0x48')]=_0x571770;return _0x27ee33;})[_0x4077('0x2b')](respondWithFilteredResult(_0x5ece04,_0x118dbe))['catch'](handleError(_0x5ece04,null));};exports[_0x4077('0x49')]=function(_0x3abb55,_0x313019){var _0x20be73={'raw':!![],'where':{'id':_0x3abb55[_0x4077('0x4a')]['id']}},_0x595c3b={};_0x595c3b[_0x4077('0x35')]=_[_0x4077('0x4b')](db[_0x4077('0x31')]['rawAttributes']);_0x595c3b[_0x4077('0x36')]=_[_0x4077('0x4b')](_0x3abb55['query']);_0x595c3b[_0x4077('0x3f')]=_[_0x4077('0x38')](_0x595c3b['model'],_0x595c3b[_0x4077('0x36')]);_0x20be73['attributes']=_['intersection'](_0x595c3b[_0x4077('0x35')],qs[_0x4077('0x39')](_0x3abb55['query']['fields']));_0x20be73[_0x4077('0x37')]=_0x20be73[_0x4077('0x37')][_0x4077('0x4c')]?_0x20be73[_0x4077('0x37')]:_0x595c3b[_0x4077('0x35')];if(_0x3abb55['query'][_0x4077('0x45')]){_0x20be73['include']=[{'all':!![]}];}_0x20be73=_[_0x4077('0x42')]({},_0x20be73,_0x3abb55[_0x4077('0x4d')]);return db[_0x4077('0x31')][_0x4077('0x4e')](_0x20be73)[_0x4077('0x2b')](handleEntityNotFound(_0x313019,null))[_0x4077('0x2b')](respondWithResult(_0x313019,null))['catch'](handleError(_0x313019,null));};exports[_0x4077('0x4f')]=function(_0x17cbb0,_0x17bddb){return db[_0x4077('0x31')][_0x4077('0x4f')](_0x17cbb0[_0x4077('0x50')],{})[_0x4077('0x2b')](respondWithResult(_0x17bddb,0xc9))[_0x4077('0x51')](handleError(_0x17bddb,null));};exports['update']=function(_0x26fb71,_0x44b8e4){if(_0x26fb71['body']['id']){delete _0x26fb71[_0x4077('0x50')]['id'];}return db['VoiceTransferReport'][_0x4077('0x4e')]({'where':{'id':_0x26fb71[_0x4077('0x4a')]['id']}})[_0x4077('0x2b')](handleEntityNotFound(_0x44b8e4,null))[_0x4077('0x2b')](saveUpdates(_0x26fb71[_0x4077('0x50')],null))['then'](respondWithResult(_0x44b8e4,null))[_0x4077('0x51')](handleError(_0x44b8e4,null));};exports[_0x4077('0x2a')]=function(_0x47363d,_0x486922){return db[_0x4077('0x31')][_0x4077('0x4e')]({'where':{'id':_0x47363d[_0x4077('0x4a')]['id']}})[_0x4077('0x2b')](handleEntityNotFound(_0x486922,null))[_0x4077('0x2b')](removeEntity(_0x486922,null))[_0x4077('0x51')](handleError(_0x486922,null));};exports['describe']=function(_0x2852b0,_0x587a9f){return db[_0x4077('0x31')][_0x4077('0x52')]()[_0x4077('0x2b')](respondWithResult(_0x587a9f,null))[_0x4077('0x51')](handleError(_0x587a9f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 51d80de..b322588 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 _0x9c5e=['api','moment','bluebird','path','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','util','../../config/logger'];(function(_0x570cdc,_0xc45524){var _0xbde795=function(_0x527f68){while(--_0x527f68){_0x570cdc['push'](_0x570cdc['shift']());}};_0xbde795(++_0xc45524);}(_0x9c5e,0x6c));var _0xe9c5=function(_0x37bf65,_0x220141){_0x37bf65=_0x37bf65-0x0;var _0x45a736=_0x9c5e[_0x37bf65];return _0x45a736;};'use strict';var _=require('lodash');var util=require(_0xe9c5('0x0'));var logger=require(_0xe9c5('0x1'))(_0xe9c5('0x2'));var moment=require(_0xe9c5('0x3'));var BPromise=require(_0xe9c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9c5('0x5'));var rimraf=require('rimraf');var config=require(_0xe9c5('0x6'));var attributes=require(_0xe9c5('0x7'));module['exports']=function(_0x1eb8fd,_0x472ec5){return _0x1eb8fd[_0xe9c5('0x8')](_0xe9c5('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10bb=['api','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x1d19b2,_0x330495){var _0x12d096=function(_0x406be8){while(--_0x406be8){_0x1d19b2['push'](_0x1d19b2['shift']());}};_0x12d096(++_0x330495);}(_0x10bb,0x188));var _0xb10b=function(_0x25c71b,_0xe683d){_0x25c71b=_0x25c71b-0x0;var _0x641659=_0x10bb[_0x25c71b];return _0x641659;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb10b('0x0'));var moment=require('moment');var BPromise=require(_0xb10b('0x1'));var rp=require(_0xb10b('0x2'));var fs=require('fs');var path=require(_0xb10b('0x3'));var rimraf=require('rimraf');var config=require(_0xb10b('0x4'));var attributes=require(_0xb10b('0x5'));module[_0xb10b('0x6')]=function(_0x4bc8fd,_0x26f7e3){return _0x4bc8fd[_0xb10b('0x7')]('VoiceTransferReport',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 43add72..a7d9759 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 _0x03f5=['body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','create'];(function(_0x3022a5,_0x10fa75){var _0x58264b=function(_0x5e734d){while(--_0x5e734d){_0x3022a5['push'](_0x3022a5['shift']());}};_0x58264b(++_0x10fa75);}(_0x03f5,0x177));var _0x503f=function(_0x47679f,_0x25950d){_0x47679f=_0x47679f-0x0;var _0x20ebe7=_0x03f5[_0x47679f];return _0x20ebe7;};'use strict';var _=require(_0x503f('0x0'));var util=require(_0x503f('0x1'));var moment=require(_0x503f('0x2'));var BPromise=require(_0x503f('0x3'));var rs=require(_0x503f('0x4'));var fs=require('fs');var Redis=require(_0x503f('0x5'));var db=require(_0x503f('0x6'))['db'];var utils=require(_0x503f('0x7'));var logger=require('../../config/logger')(_0x503f('0x8'));var config=require(_0x503f('0x9'));var jayson=require(_0x503f('0xa'));var client=jayson[_0x503f('0xb')][_0x503f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50f665,_0x236138,_0x9a6b89){return new BPromise(function(_0x45ca63,_0x543d4d){return client[_0x503f('0xd')](_0x50f665,_0x9a6b89)[_0x503f('0xe')](function(_0x73d632){logger[_0x503f('0xf')](_0x503f('0x10'),_0x236138,_0x503f('0x11'));logger[_0x503f('0x12')](_0x503f('0x13'),_0x236138,_0x503f('0x11'),JSON[_0x503f('0x14')](_0x73d632));if(_0x73d632[_0x503f('0x15')]){if(_0x73d632[_0x503f('0x15')][_0x503f('0x16')]===0x1f4){logger['error'](_0x503f('0x10'),_0x236138,_0x73d632['error'][_0x503f('0x17')]);return _0x543d4d(_0x73d632[_0x503f('0x15')][_0x503f('0x17')]);}logger[_0x503f('0x15')](_0x503f('0x10'),_0x236138,_0x73d632[_0x503f('0x15')]['message']);return _0x45ca63(_0x73d632['error'][_0x503f('0x17')]);}else{logger[_0x503f('0xf')](_0x503f('0x10'),_0x236138,_0x503f('0x11'));_0x45ca63(_0x73d632[_0x503f('0x18')][_0x503f('0x17')]);}})[_0x503f('0x19')](function(_0xb3f87c){logger[_0x503f('0x15')]('VoiceTransferReport,\x20%s,\x20%s',_0x236138,_0xb3f87c);_0x543d4d(_0xb3f87c);});});}exports[_0x503f('0x1a')]=function(_0x4865cf){var _0x2c3254=this;return new Promise(function(_0x3b7547,_0x14d143){return db['VoiceTransferReport'][_0x503f('0x1b')](_0x4865cf[_0x503f('0x1c')],{'raw':_0x4865cf[_0x503f('0x1d')]?_0x4865cf[_0x503f('0x1d')][_0x503f('0x1e')]===undefined?!![]:![]:!![]})[_0x503f('0xe')](function(_0x35b6f8){logger[_0x503f('0xf')]('CreateVoiceTransferReport',_0x4865cf);logger[_0x503f('0x12')](_0x503f('0x1a'),_0x4865cf,JSON['stringify'](_0x35b6f8));_0x3b7547(_0x35b6f8);})['catch'](function(_0x162fc9){logger[_0x503f('0x15')](_0x503f('0x1a'),_0x162fc9[_0x503f('0x17')],_0x4865cf);_0x14d143(_0x2c3254[_0x503f('0x15')](0x1f4,_0x162fc9[_0x503f('0x17')]));});});}; \ No newline at end of file +var _0x67e2=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util'];(function(_0x28ae24,_0x5741c0){var _0x4e22c5=function(_0x1256d6){while(--_0x1256d6){_0x28ae24['push'](_0x28ae24['shift']());}};_0x4e22c5(++_0x5741c0);}(_0x67e2,0x116));var _0x267e=function(_0x37d19b,_0x4cf238){_0x37d19b=_0x37d19b-0x0;var _0x5661ea=_0x67e2[_0x37d19b];return _0x5661ea;};'use strict';var _=require(_0x267e('0x0'));var util=require(_0x267e('0x1'));var moment=require(_0x267e('0x2'));var BPromise=require(_0x267e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x267e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x267e('0x5'))(_0x267e('0x6'));var config=require(_0x267e('0x7'));var jayson=require(_0x267e('0x8'));var client=jayson[_0x267e('0x9')][_0x267e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55accd,_0x492b01,_0x26a648){return new BPromise(function(_0x3baed9,_0x2459db){return client[_0x267e('0xb')](_0x55accd,_0x26a648)[_0x267e('0xc')](function(_0x4c7e7c){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x492b01,_0x267e('0xd'));logger[_0x267e('0xe')](_0x267e('0xf'),_0x492b01,_0x267e('0xd'),JSON[_0x267e('0x10')](_0x4c7e7c));if(_0x4c7e7c[_0x267e('0x11')]){if(_0x4c7e7c[_0x267e('0x11')]['code']===0x1f4){logger[_0x267e('0x11')](_0x267e('0x12'),_0x492b01,_0x4c7e7c[_0x267e('0x11')][_0x267e('0x13')]);return _0x2459db(_0x4c7e7c[_0x267e('0x11')][_0x267e('0x13')]);}logger[_0x267e('0x11')](_0x267e('0x12'),_0x492b01,_0x4c7e7c[_0x267e('0x11')]['message']);return _0x3baed9(_0x4c7e7c[_0x267e('0x11')][_0x267e('0x13')]);}else{logger[_0x267e('0x14')](_0x267e('0x12'),_0x492b01,_0x267e('0xd'));_0x3baed9(_0x4c7e7c[_0x267e('0x15')][_0x267e('0x13')]);}})[_0x267e('0x16')](function(_0x5e1133){logger[_0x267e('0x11')](_0x267e('0x12'),_0x492b01,_0x5e1133);_0x2459db(_0x5e1133);});});}exports[_0x267e('0x17')]=function(_0x1f31d5){var _0x1fb403=this;return new Promise(function(_0x48575d,_0x317e74){return db['VoiceTransferReport'][_0x267e('0x18')](_0x1f31d5[_0x267e('0x19')],{'raw':_0x1f31d5[_0x267e('0x1a')]?_0x1f31d5[_0x267e('0x1a')][_0x267e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x57c4d1){logger[_0x267e('0x14')]('CreateVoiceTransferReport',_0x1f31d5);logger[_0x267e('0xe')](_0x267e('0x17'),_0x1f31d5,JSON[_0x267e('0x10')](_0x57c4d1));_0x48575d(_0x57c4d1);})[_0x267e('0x16')](function(_0x3e7a15){logger[_0x267e('0x11')](_0x267e('0x17'),_0x3e7a15[_0x267e('0x13')],_0x1f31d5);_0x317e74(_0x1fb403[_0x267e('0x11')](0x1f4,_0x3e7a15[_0x267e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 1c650d9..215529c 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x70e0,0x17b));var _0x070e=function(_0x1f67a6,_0x1369cd){_0x1f67a6=_0x1f67a6-0x0;var _0x5c1dae=_0x70e0[_0x1f67a6];return _0x5c1dae;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe5b3=['transfer','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0xcb19ee,_0x291c41){var _0x243e4c=function(_0x3c8712){while(--_0x3c8712){_0xcb19ee['push'](_0xcb19ee['shift']());}};_0x243e4c(++_0x291c41);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5af391,_0x530b57){_0x5af391=_0x5af391-0x0;var _0x40d5b0=_0xe5b3[_0x5af391];return _0x40d5b0;};'use strict';var express=require('express');var router=express[_0x3e5b('0x0')]();var auth=require(_0x3e5b('0x1'));var controller=require(_0x3e5b('0x2'));router[_0x3e5b('0x3')](_0x3e5b('0x4'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0x7')]);router[_0x3e5b('0x3')](_0x3e5b('0x8'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x9')]);router[_0x3e5b('0x3')]('/answer',auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xa')]);router[_0x3e5b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0x3')](_0x3e5b('0xc'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0xd')]);router['post'](_0x3e5b('0xe'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x3')](_0x3e5b('0x10'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 5eee7d2..aa6afec 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 _0xedd9=['originate\x20executed!','hangup','hangup\x20fired:','status','webbar:hangup','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold\x20fired:','hold\x20executed!','unhold','webbar:unhold','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','handleError:','stack','name','send','NotFound','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate'];(function(_0x596b66,_0x45e85e){var _0x1a06ec=function(_0x337e3f){while(--_0x337e3f){_0x596b66['push'](_0x596b66['shift']());}};_0x1a06ec(++_0x45e85e);}(_0xedd9,0xfc));var _0x9edd=function(_0x395bbf,_0x13359b){_0x395bbf=_0x395bbf-0x0;var _0x150db2=_0xedd9[_0x395bbf];return _0x150db2;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x9edd('0x0'));var db=require(_0x9edd('0x1'))['db'];var config=require(_0x9edd('0x2'));var util=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var jayson=require(_0x9edd('0x5'));var amiClient=jayson[_0x9edd('0x6')][_0x9edd('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0x9edd('0x8'));var Redis=require(_0x9edd('0x9'));config[_0x9edd('0xa')]=_[_0x9edd('0xb')](config['redis'],{'host':_0x9edd('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0xa')]));var Schema=require(_0x9edd('0xd'));var originateValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]},'callNumber':{'type':'string','required':[!![],_0x9edd('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x9edd('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9edd('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9edd('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]},'sessionId':{'type':_0x9edd('0x11'),'required':[!![],_0x9edd('0x12')]},'transferNumber':{'type':_0x9edd('0x11'),'required':[!![],_0x9edd('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9edd('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]},'sessionId':{'type':_0x9edd('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]}});function emit(_0x4ea60f,_0x5f5bf4,_0x448996){logger[_0x9edd('0x14')](_0x4ea60f,_0x5f5bf4,JSON['stringify'](_0x448996));io['to'](_0x4ea60f)[_0x9edd('0x15')](_0x5f5bf4,_0x448996);}function handleError(_0x35f454){return function(_0x40ba32){console['log'](_0x9edd('0x16'),_0x40ba32,_0x40ba32 instanceof RangeError);logger['error'](_0x40ba32[_0x9edd('0x17')]);if(_0x40ba32 instanceof RangeError){if(_0x40ba32[_0x9edd('0x18')]){delete _0x40ba32['name'];}_0x35f454['status'](0x194)[_0x9edd('0x19')](_0x40ba32);}else{if(_0x40ba32['name']){delete _0x40ba32[_0x9edd('0x18')];}_0x35f454['status'](0x1f4)['send'](_0x40ba32);}};}function checkError(){return function(_0x356751){if(!_0x356751){throw new RangeError(_0x9edd('0x1a'));}return _0x356751;};}function respondWithRpcPromise(_0x4fb7bf,_0x5823bc){return new BPromise(function(_0x341d67,_0x186186){var _0x477878=amiClient;return _0x477878['request'](_0x4fb7bf,_0x5823bc)[_0x9edd('0x1b')](function(_0x1dca43){if(_0x1dca43[_0x9edd('0x1c')]){if(_0x1dca43[_0x9edd('0x1c')][_0x9edd('0x1d')]===0x1f4){return _0x186186(_0x1dca43['error'][_0x9edd('0x1e')]);}return _0x341d67(_0x1dca43[_0x9edd('0x1c')][_0x9edd('0x1e')]);}else{_0x341d67(_0x1dca43[_0x9edd('0x1f')]);}})[_0x9edd('0x20')](function(_0x4d507f){_0x186186(_0x4d507f);});});}function getAgent(_0x4b3d1b){return db[_0x9edd('0x21')][_0x9edd('0x22')]({'where':{'id':_0x4b3d1b,'role':_0x9edd('0x23')}})[_0x9edd('0x1b')](checkError());}function getAgentCheckSession(_0x3c2227,_0x4fe471){return new BPromise(function(_0x57a2cc,_0x214d0a){var _0x257a26=respondWithRpcPromise(_0x9edd('0x24'));var _0x52746a=getAgent(_0x3c2227);Promise[_0x9edd('0x25')]([_0x257a26,_0x52746a])[_0x9edd('0x1b')](function(_0x2ae8dd){var _0x41af53=_0x2ae8dd[0x0];var _0x5eccfb=_0x2ae8dd[0x1];var _0x2155a1=_[_0x9edd('0x26')](_0x41af53[_0x9edd('0x27')],function(_0x12c1bc){return _0x12c1bc[_0x9edd('0x28')]==_0x5eccfb['id']&&_0x12c1bc[_0x9edd('0x29')]==_0x4fe471;});if(_0x2155a1[_0x9edd('0x2a')]==0x1){_0x57a2cc(_0x5eccfb);}else{_0x214d0a(new RangeError(_0x9edd('0x2b')+_0x4fe471+_0x9edd('0x2c')));}});});}exports[_0x9edd('0x2d')]=function(_0x4fd03f,_0x138002){logger[_0x9edd('0x14')](_0x9edd('0x2e'),_0x4fd03f[_0x9edd('0x2f')]);var _0x5af178=originateValidation[_0x9edd('0xd')](_0x4fd03f[_0x9edd('0x2f')]);if(_0x5af178[_0x9edd('0x2a')]>0x0){return _0x138002['status'](0x190)[_0x9edd('0x30')](_0x5af178);}var _0x3990fb=_0x4fd03f[_0x9edd('0x2f')][_0x9edd('0x31')];var _0x21bc30=_0x4fd03f[_0x9edd('0x2f')][_0x9edd('0x32')];var _0x438a5d=_0x4fd03f[_0x9edd('0x2f')][_0x9edd('0x33')];var _0x29e789=_0x4fd03f[_0x9edd('0x2f')][_0x9edd('0x34')];return getAgent(_0x3990fb)[_0x9edd('0x1b')](function(_0x5757fc){logger[_0x9edd('0x14')]('entityFound:',_0x5757fc[_0x9edd('0x18')]);emit(util[_0x9edd('0x35')](_0x9edd('0x36'),_0x5757fc[_0x9edd('0x18')]),_0x9edd('0x37'),{'callNumber':_0x21bc30,'callerId':_0x438a5d,'callbackUrl':_0x29e789});return _0x138002['status'](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x38')});})[_0x9edd('0x20')](handleError(_0x138002));};exports[_0x9edd('0x39')]=function(_0x1be77f,_0x337e6c){logger[_0x9edd('0x14')](_0x9edd('0x3a'),_0x1be77f[_0x9edd('0x2f')]);var _0x35c16f=hangupValidation['validate'](_0x1be77f[_0x9edd('0x2f')]);if(_0x35c16f['length']>0x0){return _0x337e6c[_0x9edd('0x3b')](0x190)['json'](_0x35c16f);}var _0x30883e=_0x1be77f[_0x9edd('0x2f')][_0x9edd('0x31')];var _0x479661=_0x1be77f[_0x9edd('0x2f')][_0x9edd('0x29')];return getAgent(_0x30883e)[_0x9edd('0x1b')](function(_0x48958a){logger[_0x9edd('0x14')]('entityFound:',_0x48958a[_0x9edd('0x18')]);emit(util[_0x9edd('0x35')]('user:%s',_0x48958a[_0x9edd('0x18')]),_0x9edd('0x3c'),{'sessionId':_0x479661});return _0x337e6c[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':'hangup\x20executed!'});})[_0x9edd('0x20')](handleError(_0x337e6c));};exports['answer']=function(_0x2bdb3f,_0xc1e657){logger['info'](_0x9edd('0x3d'),_0x2bdb3f['body']);var _0x548299=answerValidation[_0x9edd('0xd')](_0x2bdb3f[_0x9edd('0x2f')]);if(_0x548299[_0x9edd('0x2a')]>0x0){return _0xc1e657[_0x9edd('0x3b')](0x190)[_0x9edd('0x30')](_0x548299);}var _0x4737ae=_0x2bdb3f[_0x9edd('0x2f')][_0x9edd('0x31')];var _0x18c149=_0x2bdb3f[_0x9edd('0x2f')][_0x9edd('0x29')];return getAgent(_0x4737ae)[_0x9edd('0x1b')](function(_0x3d5eba){logger[_0x9edd('0x14')](_0x9edd('0x3e'),_0x3d5eba['name']);emit(util[_0x9edd('0x35')](_0x9edd('0x36'),_0x3d5eba[_0x9edd('0x18')]),_0x9edd('0x3f'),{'sessionId':_0x18c149});return _0xc1e657[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x40')});})['catch'](handleError(_0xc1e657));};exports['hold']=function(_0x4bc7a1,_0x4a7dc9){logger['info'](_0x9edd('0x41'),_0x4bc7a1[_0x9edd('0x2f')]);var _0x2b06d3=holdValidation[_0x9edd('0xd')](_0x4bc7a1[_0x9edd('0x2f')]);if(_0x2b06d3['length']>0x0){return _0x4a7dc9[_0x9edd('0x3b')](0x190)[_0x9edd('0x30')](_0x2b06d3);}var _0x40e33d=_0x4bc7a1['body'][_0x9edd('0x31')];var _0xfd7bd1=_0x4bc7a1[_0x9edd('0x2f')][_0x9edd('0x29')];return getAgent(_0x40e33d)[_0x9edd('0x1b')](function(_0x35bdec){logger['info'](_0x9edd('0x3e'),_0x35bdec[_0x9edd('0x18')]);emit(util['format'](_0x9edd('0x36'),_0x35bdec[_0x9edd('0x18')]),'webbar:hold',{'sessionId':_0xfd7bd1});return _0x4a7dc9[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x42')});})['catch'](handleError(_0x4a7dc9));};exports[_0x9edd('0x43')]=function(_0x151157,_0x317a60){logger[_0x9edd('0x14')]('unhold\x20fired:',_0x151157[_0x9edd('0x2f')]);var _0x527727=unholdValidation[_0x9edd('0xd')](_0x151157['body']);if(_0x527727[_0x9edd('0x2a')]>0x0){return _0x317a60[_0x9edd('0x3b')](0x190)['json'](_0x527727);}var _0x8e59bd=_0x151157['body'][_0x9edd('0x31')];var _0xe6b20c=_0x151157[_0x9edd('0x2f')][_0x9edd('0x29')];return getAgent(_0x8e59bd)[_0x9edd('0x1b')](function(_0x18548e){logger[_0x9edd('0x14')](_0x9edd('0x3e'),_0x18548e[_0x9edd('0x18')]);emit(util[_0x9edd('0x35')](_0x9edd('0x36'),_0x18548e['name']),_0x9edd('0x44'),{'sessionId':_0xe6b20c});return _0x317a60[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x9edd('0x20')](handleError(_0x317a60));};exports['calls']=function(_0x54d83d,_0x54ecfa){logger[_0x9edd('0x14')](_0x9edd('0x45'),_0x54ecfa[_0x9edd('0x2f')]);var _0x35ddb3=callsValidation['validate'](_0x54d83d['body']);if(_0x35ddb3['length']>0x0){return _0x54ecfa[_0x9edd('0x3b')](0x190)[_0x9edd('0x30')](_0x35ddb3);}var _0xd5090a=_0x54d83d[_0x9edd('0x2f')][_0x9edd('0x31')];var _0x41ec97=respondWithRpcPromise(_0x9edd('0x24'));var _0x1e3087=getAgent(_0xd5090a);return Promise['all']([_0x41ec97,_0x1e3087])[_0x9edd('0x1b')](function(_0x49d0ce){var _0x421e82=_0x49d0ce[0x0];var _0x6a1cfc=_0x49d0ce[0x1];var _0x4b7e68=_[_0x9edd('0x26')](_0x421e82[_0x9edd('0x27')],function(_0x950e53){return _0x950e53['UserId']==_0x6a1cfc['id'];});return _0x54ecfa[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'count':_0x4b7e68[_0x9edd('0x2a')],'rows':_0x4b7e68});})[_0x9edd('0x20')](handleError(_0x54ecfa));};exports[_0x9edd('0x46')]=function(_0x2c3173,_0x53f55b){logger['info'](_0x9edd('0x47'),_0x2c3173['body']);var _0x173ec9=conferenceValidation[_0x9edd('0xd')](_0x2c3173[_0x9edd('0x2f')]);if(_0x173ec9[_0x9edd('0x2a')]>0x0){return _0x53f55b['status'](0x190)[_0x9edd('0x30')](_0x173ec9);}var _0x507cce=_0x2c3173[_0x9edd('0x2f')][_0x9edd('0x31')];return getAgent(_0x507cce)[_0x9edd('0x1b')](function(_0x5ca123){logger[_0x9edd('0x14')]('entityFound:',_0x5ca123[_0x9edd('0x18')]);emit(util[_0x9edd('0x35')]('user:%s',_0x5ca123[_0x9edd('0x18')]),'webbar:conference');return _0x53f55b[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x48')});})['catch'](handleError(_0x53f55b));};exports[_0x9edd('0x49')]=function(_0x321485,_0x45c17d){logger[_0x9edd('0x14')](_0x9edd('0x4a'),_0x321485['body']);var _0x48f017=transferValidation[_0x9edd('0xd')](_0x321485[_0x9edd('0x2f')]);if(_0x48f017['length']>0x0){return _0x45c17d['status'](0x190)['json'](_0x48f017);}var _0x1bc89b=_0x321485['body']['userId'];var _0x3ef9c9=_0x321485[_0x9edd('0x2f')]['sessionId'];var _0xb9ebeb=_0x321485[_0x9edd('0x2f')][_0x9edd('0x4b')];return getAgent(_0x1bc89b)['then'](function(_0x34b229){logger['info'](_0x9edd('0x3e'),_0x34b229[_0x9edd('0x18')]);emit(util['format'](_0x9edd('0x36'),_0x34b229[_0x9edd('0x18')]),'webbar:transfer',{'sessionId':_0x3ef9c9,'transferNumber':_0xb9ebeb});return _0x45c17d[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x4c')});})[_0x9edd('0x20')](handleError(_0x45c17d));}; \ No newline at end of file +var _0x303a=['answer','answer\x20fired:','webbar:answer','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','transferNumber','path','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','log','error','name','status','NotFound','then','code','message','findOne','agent','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callerId','callbackUrl','entityFound:','format','webbar:originate','catch','hangup','user:%s','webbar:hangup'];(function(_0xf4b0a4,_0x2682b8){var _0x2efe69=function(_0x55ad04){while(--_0x55ad04){_0xf4b0a4['push'](_0xf4b0a4['shift']());}};_0x2efe69(++_0x2682b8);}(_0x303a,0x1a0));var _0xa303=function(_0x41b4df,_0x15b067){_0x41b4df=_0x41b4df-0x0;var _0x55d4dc=_0x303a[_0x41b4df];return _0x55d4dc;};'use strict';var path=require(_0xa303('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xa303('0x1'))['db'];var config=require(_0xa303('0x2'));var util=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa303('0x5')][_0xa303('0x6')]({'port':0x232a});var logger=require(_0xa303('0x7'))(_0xa303('0x8'));var Redis=require(_0xa303('0x9'));config[_0xa303('0xa')]=_[_0xa303('0xb')](config[_0xa303('0xa')],{'host':_0xa303('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'callNumber':{'type':'string','required':[!![],_0xa303('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xa303('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa303('0xe')]},'sessionId':{'type':_0xa303('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa303('0x10'),'required':[!![],_0xa303('0x11')]},'transferNumber':{'type':_0xa303('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'sessionId':{'type':_0xa303('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'sessionId':{'type':_0xa303('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa303('0xe')]}});function emit(_0xd2e8ee,_0x1f3ede,_0x288596){logger[_0xa303('0x12')](_0xd2e8ee,_0x1f3ede,JSON[_0xa303('0x13')](_0x288596));io['to'](_0xd2e8ee)['emit'](_0x1f3ede,_0x288596);}function handleError(_0x28c164){return function(_0x54ca49){console[_0xa303('0x14')]('handleError:',_0x54ca49,_0x54ca49 instanceof RangeError);logger[_0xa303('0x15')](_0x54ca49['stack']);if(_0x54ca49 instanceof RangeError){if(_0x54ca49[_0xa303('0x16')]){delete _0x54ca49[_0xa303('0x16')];}_0x28c164[_0xa303('0x17')](0x194)['send'](_0x54ca49);}else{if(_0x54ca49[_0xa303('0x16')]){delete _0x54ca49[_0xa303('0x16')];}_0x28c164[_0xa303('0x17')](0x1f4)['send'](_0x54ca49);}};}function checkError(){return function(_0x282e25){if(!_0x282e25){throw new RangeError(_0xa303('0x18'));}return _0x282e25;};}function respondWithRpcPromise(_0x21deee,_0x904261){return new BPromise(function(_0x54b173,_0x14f9ab){var _0x2a2512=amiClient;return _0x2a2512['request'](_0x21deee,_0x904261)[_0xa303('0x19')](function(_0x27c1d7){if(_0x27c1d7[_0xa303('0x15')]){if(_0x27c1d7[_0xa303('0x15')][_0xa303('0x1a')]===0x1f4){return _0x14f9ab(_0x27c1d7[_0xa303('0x15')][_0xa303('0x1b')]);}return _0x54b173(_0x27c1d7[_0xa303('0x15')][_0xa303('0x1b')]);}else{_0x54b173(_0x27c1d7['result']);}})['catch'](function(_0x4dad5b){_0x14f9ab(_0x4dad5b);});});}function getAgent(_0x58922f){return db['User'][_0xa303('0x1c')]({'where':{'id':_0x58922f,'role':_0xa303('0x1d')}})[_0xa303('0x19')](checkError());}function getAgentCheckSession(_0xbb93f0,_0x94d3e4){return new BPromise(function(_0x48e79f,_0x2d1341){var _0xb35c22=respondWithRpcPromise('VoiceChannels');var _0x221f59=getAgent(_0xbb93f0);Promise[_0xa303('0x1e')]([_0xb35c22,_0x221f59])[_0xa303('0x19')](function(_0x32dcfb){var _0x3c85de=_0x32dcfb[0x0];var _0x221007=_0x32dcfb[0x1];var _0x11b175=_[_0xa303('0x1f')](_0x3c85de[_0xa303('0x20')],function(_0x3383f4){return _0x3383f4[_0xa303('0x21')]==_0x221007['id']&&_0x3383f4[_0xa303('0x22')]==_0x94d3e4;});if(_0x11b175[_0xa303('0x23')]==0x1){_0x48e79f(_0x221007);}else{_0x2d1341(new RangeError(_0xa303('0x24')+_0x94d3e4+_0xa303('0x25')));}});});}exports[_0xa303('0x26')]=function(_0x228ae7,_0x5de180){logger['info'](_0xa303('0x27'),_0x228ae7[_0xa303('0x28')]);var _0xa69c59=originateValidation[_0xa303('0x29')](_0x228ae7['body']);if(_0xa69c59[_0xa303('0x23')]>0x0){return _0x5de180[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0xa69c59);}var _0x1093e1=_0x228ae7['body'][_0xa303('0x2b')];var _0x37376d=_0x228ae7[_0xa303('0x28')]['callNumber'];var _0xd35249=_0x228ae7[_0xa303('0x28')][_0xa303('0x2c')];var _0x4a6328=_0x228ae7[_0xa303('0x28')][_0xa303('0x2d')];return getAgent(_0x1093e1)[_0xa303('0x19')](function(_0x5dea0a){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x5dea0a[_0xa303('0x16')]);emit(util[_0xa303('0x2f')]('user:%s',_0x5dea0a[_0xa303('0x16')]),_0xa303('0x30'),{'callNumber':_0x37376d,'callerId':_0xd35249,'callbackUrl':_0x4a6328});return _0x5de180[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':'originate\x20executed!'});})[_0xa303('0x31')](handleError(_0x5de180));};exports[_0xa303('0x32')]=function(_0x22da2d,_0x16c680){logger[_0xa303('0x12')]('hangup\x20fired:',_0x22da2d['body']);var _0x992eb9=hangupValidation[_0xa303('0x29')](_0x22da2d[_0xa303('0x28')]);if(_0x992eb9['length']>0x0){return _0x16c680['status'](0x190)[_0xa303('0x2a')](_0x992eb9);}var _0x8a16a3=_0x22da2d[_0xa303('0x28')][_0xa303('0x2b')];var _0x569158=_0x22da2d['body'][_0xa303('0x22')];return getAgent(_0x8a16a3)[_0xa303('0x19')](function(_0x1c99b4){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x1c99b4['name']);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0x1c99b4[_0xa303('0x16')]),_0xa303('0x34'),{'sessionId':_0x569158});return _0x16c680['status'](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0xa303('0x31')](handleError(_0x16c680));};exports[_0xa303('0x35')]=function(_0x3aece5,_0x411b69){logger[_0xa303('0x12')](_0xa303('0x36'),_0x3aece5[_0xa303('0x28')]);var _0x1f4352=answerValidation[_0xa303('0x29')](_0x3aece5[_0xa303('0x28')]);if(_0x1f4352[_0xa303('0x23')]>0x0){return _0x411b69['status'](0x190)['json'](_0x1f4352);}var _0x45fb2f=_0x3aece5['body'][_0xa303('0x2b')];var _0x564d59=_0x3aece5[_0xa303('0x28')][_0xa303('0x22')];return getAgent(_0x45fb2f)[_0xa303('0x19')](function(_0x2c03fa){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x2c03fa[_0xa303('0x16')]);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0x2c03fa[_0xa303('0x16')]),_0xa303('0x37'),{'sessionId':_0x564d59});return _0x411b69[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':'answer\x20executed!'});})[_0xa303('0x31')](handleError(_0x411b69));};exports['hold']=function(_0x32b439,_0x11440f){logger[_0xa303('0x12')]('hold\x20fired:',_0x32b439['body']);var _0x9240e1=holdValidation[_0xa303('0x29')](_0x32b439[_0xa303('0x28')]);if(_0x9240e1[_0xa303('0x23')]>0x0){return _0x11440f[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0x9240e1);}var _0x2f9f0b=_0x32b439[_0xa303('0x28')][_0xa303('0x2b')];var _0x4cbf30=_0x32b439['body'][_0xa303('0x22')];return getAgent(_0x2f9f0b)[_0xa303('0x19')](function(_0x532003){logger[_0xa303('0x12')]('entityFound:',_0x532003[_0xa303('0x16')]);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0x532003[_0xa303('0x16')]),'webbar:hold',{'sessionId':_0x4cbf30});return _0x11440f[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':_0xa303('0x38')});})[_0xa303('0x31')](handleError(_0x11440f));};exports[_0xa303('0x39')]=function(_0x16242c,_0x538ef4){logger[_0xa303('0x12')](_0xa303('0x3a'),_0x16242c[_0xa303('0x28')]);var _0xe4a907=unholdValidation['validate'](_0x16242c['body']);if(_0xe4a907[_0xa303('0x23')]>0x0){return _0x538ef4[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0xe4a907);}var _0x4bcee0=_0x16242c[_0xa303('0x28')]['userId'];var _0x5939ea=_0x16242c['body']['sessionId'];return getAgent(_0x4bcee0)[_0xa303('0x19')](function(_0xdc6eaf){logger['info'](_0xa303('0x2e'),_0xdc6eaf[_0xa303('0x16')]);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0xdc6eaf[_0xa303('0x16')]),'webbar:unhold',{'sessionId':_0x5939ea});return _0x538ef4[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':_0xa303('0x3b')});})[_0xa303('0x31')](handleError(_0x538ef4));};exports[_0xa303('0x3c')]=function(_0x53d9dc,_0x56bc98){logger[_0xa303('0x12')](_0xa303('0x3d'),_0x56bc98[_0xa303('0x28')]);var _0x87a096=callsValidation[_0xa303('0x29')](_0x53d9dc[_0xa303('0x28')]);if(_0x87a096[_0xa303('0x23')]>0x0){return _0x56bc98[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0x87a096);}var _0x5d4a72=_0x53d9dc[_0xa303('0x28')][_0xa303('0x2b')];var _0x27471c=respondWithRpcPromise(_0xa303('0x3e'));var _0x47da3a=getAgent(_0x5d4a72);return Promise['all']([_0x27471c,_0x47da3a])[_0xa303('0x19')](function(_0x4db2e2){var _0x14861e=_0x4db2e2[0x0];var _0x44c8d3=_0x4db2e2[0x1];var _0x5272d7=_['filter'](_0x14861e[_0xa303('0x20')],function(_0x249378){return _0x249378['UserId']==_0x44c8d3['id'];});return _0x56bc98['status'](0xc8)['json']({'count':_0x5272d7[_0xa303('0x23')],'rows':_0x5272d7});})[_0xa303('0x31')](handleError(_0x56bc98));};exports[_0xa303('0x3f')]=function(_0x15f4e6,_0x28cd01){logger[_0xa303('0x12')](_0xa303('0x40'),_0x15f4e6[_0xa303('0x28')]);var _0x8aecd7=conferenceValidation['validate'](_0x15f4e6[_0xa303('0x28')]);if(_0x8aecd7[_0xa303('0x23')]>0x0){return _0x28cd01[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0x8aecd7);}var _0x40e4b4=_0x15f4e6[_0xa303('0x28')]['userId'];return getAgent(_0x40e4b4)[_0xa303('0x19')](function(_0x558a2a){logger['info'](_0xa303('0x2e'),_0x558a2a[_0xa303('0x16')]);emit(util['format'](_0xa303('0x33'),_0x558a2a[_0xa303('0x16')]),_0xa303('0x41'));return _0x28cd01[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x28cd01));};exports['transfer']=function(_0x2e8100,_0x40550d){logger[_0xa303('0x12')]('transfer\x20fired:',_0x2e8100['body']);var _0x3b0f1e=transferValidation['validate'](_0x2e8100['body']);if(_0x3b0f1e['length']>0x0){return _0x40550d['status'](0x190)[_0xa303('0x2a')](_0x3b0f1e);}var _0x27474e=_0x2e8100[_0xa303('0x28')][_0xa303('0x2b')];var _0x3008ae=_0x2e8100[_0xa303('0x28')][_0xa303('0x22')];var _0x2e5a11=_0x2e8100['body'][_0xa303('0x42')];return getAgent(_0x27474e)[_0xa303('0x19')](function(_0x123d7f){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x123d7f[_0xa303('0x16')]);emit(util['format'](_0xa303('0x33'),_0x123d7f['name']),'webbar:transfer',{'sessionId':_0x3008ae,'transferNumber':_0x2e5a11});return _0x40550d[_0xa303('0x17')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x40550d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 1ebfb4d..2f39f4f 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 _0x8f4c=['create','addDisposition','/:id/canned_answers','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/users','getAgents','getApplications','post'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0x8f4c,0x113));var _0xc8f4=function(_0x543bd8,_0x1382c2){_0x543bd8=_0x543bd8-0x0;var _0x31ad82=_0x8f4c[_0x543bd8];return _0x31ad82;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./whatsappAccount.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x9')]('/:id/canned_answers',auth[_0xc8f4('0xd')](),controller['getAnswers']);router[_0xc8f4('0x9')](_0xc8f4('0x11'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x12')]);router[_0xc8f4('0x9')]('/:id/applications',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x14')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x15')]);router[_0xc8f4('0x14')]('/:id/dispositions',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x16')]);router[_0xc8f4('0x14')](_0xc8f4('0x17'),auth[_0xc8f4('0xd')](),controller['addAnswer']);router[_0xc8f4('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xc8f4('0x18')]);router[_0xc8f4('0x14')](_0xc8f4('0x19'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1a')]);router[_0xc8f4('0x14')](_0xc8f4('0x1b'),controller[_0xc8f4('0x1c')]);router[_0xc8f4('0x14')](_0xc8f4('0x1d'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1e')]);router[_0xc8f4('0x1f')]('/:id',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x20')]);router[_0xc8f4('0x21')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x22')]);router[_0xc8f4('0x21')](_0xc8f4('0xf'),auth['isAuthenticated'](),controller[_0xc8f4('0x23')]);router[_0xc8f4('0x21')](_0xc8f4('0x17'),auth[_0xc8f4('0xd')](),controller['removeAnswers']);router[_0xc8f4('0x21')]('/:id/users',auth[_0xc8f4('0xd')](),controller['removeAgents']);module[_0xc8f4('0x24')]=router; \ No newline at end of file +var _0x1a85=['removeAgents','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addAnswer','addApplications','/:id/notify','/:id/send','send','put','/:id','update','destroy','delete','removeAnswers'];(function(_0x312678,_0x57261f){var _0x1f2785=function(_0x549a8e){while(--_0x549a8e){_0x312678['push'](_0x312678['shift']());}};_0x1f2785(++_0x57261f);}(_0x1a85,0x178));var _0x51a8=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0x1a85[_0x3e91a9];return _0x25c9ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./whatsappAccount.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0x6')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0x6')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xe')]);router[_0x51a8('0x6')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x10')]);router[_0x51a8('0x6')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x12')]);router['post']('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0x13')]);router[_0x51a8('0x14')]('/:id/dispositions',auth[_0x51a8('0x9')](),controller['addDisposition']);router[_0x51a8('0x14')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x15')]);router[_0x51a8('0x14')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller['addAgents']);router[_0x51a8('0x14')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x16')]);router[_0x51a8('0x14')](_0x51a8('0x17'),controller['notify']);router[_0x51a8('0x14')](_0x51a8('0x18'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x19')]);router[_0x51a8('0x1a')](_0x51a8('0x1b'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x1c')]);router['delete'](_0x51a8('0x1b'),auth['isAuthenticated'](),controller[_0x51a8('0x1d')]);router[_0x51a8('0x1e')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller['removeDispositions']);router[_0x51a8('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x51a8('0x1f')]);router['delete'](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x20')]);module[_0x51a8('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 65459c5..28793cd 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 _0x3cdb=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x429e1,_0x3dcc52){var _0x4d01b0=function(_0xd04ffe){while(--_0xd04ffe){_0x429e1['push'](_0x429e1['shift']());}};_0x4d01b0(++_0x3dcc52);}(_0x3cdb,0xa1));var _0xb3cd=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0x3cdb[_0x14476b];return _0x24e2e8;};'use strict';var Sequelize=require(_0xb3cd('0x0'));var rs=require(_0xb3cd('0x1'));module[_0xb3cd('0x2')]={'name':{'type':Sequelize[_0xb3cd('0x3')],'unique':_0xb3cd('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb3cd('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb3cd('0x3')],'defaultValue':function(){return rs[_0xb3cd('0x5')]();}},'phone':{'type':Sequelize[_0xb3cd('0x3')]},'type':{'type':Sequelize[_0xb3cd('0x6')]('twilio',_0xb3cd('0x7'))},'accountSid':{'type':Sequelize[_0xb3cd('0x3')]},'baseUrl':{'type':Sequelize[_0xb3cd('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb3cd('0x8')],'defaultValue':function(){return _0xb3cd('0x9');}},'notificationSound':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![],'comment':_0xb3cd('0xc'),'set':function(_0x6ea0da){if(!_0x6ea0da){this[_0xb3cd('0xd')](_0xb3cd('0xe'),null);}this['setDataValue'](_0xb3cd('0xf'),_0x6ea0da);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7ffc=['exports','STRING','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x3beb54,_0x62b751){var _0x36ca79=function(_0x14d9f5){while(--_0x14d9f5){_0x3beb54['push'](_0x3beb54['shift']());}};_0x36ca79(++_0x62b751);}(_0x7ffc,0x73));var _0xc7ff=function(_0x4e4070,_0x699370){_0x4e4070=_0x4e4070-0x0;var _0x500ae2=_0x7ffc[_0x4e4070];return _0x500ae2;};'use strict';var Sequelize=require(_0xc7ff('0x0'));var rs=require(_0xc7ff('0x1'));module[_0xc7ff('0x2')]={'name':{'type':Sequelize[_0xc7ff('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xc7ff('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc7ff('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xc7ff('0x3')]},'type':{'type':Sequelize['ENUM'](_0xc7ff('0x4'),_0xc7ff('0x5'))},'accountSid':{'type':Sequelize[_0xc7ff('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xc7ff('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc7ff('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc7ff('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc7ff('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc7ff('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc7ff('0x7')],'defaultValue':![],'comment':_0xc7ff('0x9'),'set':function(_0x2cb70a){if(!_0x2cb70a){this['setDataValue'](_0xc7ff('0xa'),null);}this[_0xc7ff('0xb')](_0xc7ff('0xc'),_0x2cb70a);}},'description':{'type':Sequelize[_0xc7ff('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 28ef89c..2a9455e 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 _0x616c=['key','query','filters','model','attributes','intersection','fields','order','sort','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','length','find','create','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','pick','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','type','from','From','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','DESC','List','out','dataValues','Messages','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','map','WhatsappAccount','rawAttributes','fieldName'];(function(_0x105b02,_0x5bdbdd){var _0x36237c=function(_0x50541b){while(--_0x50541b){_0x105b02['push'](_0x105b02['shift']());}};_0x36237c(++_0x5bdbdd);}(_0x616c,0x14e));var _0xc616=function(_0x3224d7,_0x1e7c2a){_0x3224d7=_0x3224d7-0x0;var _0x46435f=_0x616c[_0x3224d7];return _0x46435f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc616('0x0'));var zipdir=require(_0xc616('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc616('0x2'));var moment=require(_0xc616('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc616('0x4'));var util=require(_0xc616('0x5'));var path=require(_0xc616('0x6'));var sox=require(_0xc616('0x7'));var csv=require('to-csv');var ejs=require(_0xc616('0x8'));var fs=require('fs');var fs_extra=require(_0xc616('0x9'));var _=require(_0xc616('0xa'));var squel=require(_0xc616('0xb'));var crypto=require('crypto');var jsforce=require(_0xc616('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc616('0xd'));var Papa=require(_0xc616('0xe'));var Redis=require(_0xc616('0xf'));var authService=require(_0xc616('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc616('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc616('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc616('0x13'));var licenseUtil=require(_0xc616('0x14'));var db=require(_0xc616('0x15'))['db'];config[_0xc616('0x16')]=_[_0xc616('0x17')](config['redis'],{'host':_0xc616('0x18'),'port':0x18eb});var socket=require(_0xc616('0x19'))(new Redis(config['redis']));require(_0xc616('0x1a'))[_0xc616('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc616('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5afda6,_0x1f1c3c,_0x4d3e77,_0x437c7a){return new BPromise(function(_0x1cf1c9,_0x5360c6){var _0x232d74=_0x437c7a||client;return _0x232d74['request'](_0x5afda6,_0x4d3e77)[_0xc616('0x1d')](function(_0x1cb668){logger[_0xc616('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x1f1c3c,_0xc616('0x1f'));logger['debug'](_0xc616('0x20'),_0x1f1c3c,_0xc616('0x1f'),JSON[_0xc616('0x21')](_0x1cb668));if(_0x1cb668[_0xc616('0x22')]){if(_0x1cb668['error']['code']===0x1f4){logger[_0xc616('0x22')](_0xc616('0x23'),_0x1f1c3c,_0x1cb668['error'][_0xc616('0x24')]);return _0x5360c6(_0x1cb668[_0xc616('0x22')]['message']);}logger[_0xc616('0x22')](_0xc616('0x23'),_0x1f1c3c,_0x1cb668['error'][_0xc616('0x24')]);return _0x1cf1c9(_0x1cb668[_0xc616('0x22')][_0xc616('0x24')]);}else{logger[_0xc616('0x1e')](_0xc616('0x23'),_0x1f1c3c,'request\x20sent');_0x1cf1c9(_0x1cb668[_0xc616('0x25')][_0xc616('0x24')]);}})[_0xc616('0x26')](function(_0x32a325){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1f1c3c,_0x32a325);_0x5360c6(_0x32a325);});});}function respondWithStatusCode(_0x220a67,_0x25e42e){_0x25e42e=_0x25e42e||0xcc;return function(_0xdc4745){if(_0xdc4745){return _0x220a67[_0xc616('0x27')](_0x25e42e);}return _0x220a67[_0xc616('0x28')](_0x25e42e)[_0xc616('0x29')]();};}function respondWithResult(_0xb11975,_0x28a37f){_0x28a37f=_0x28a37f||0xc8;return function(_0x18da71){if(_0x18da71){return _0xb11975[_0xc616('0x28')](_0x28a37f)[_0xc616('0x2a')](_0x18da71);}};}function respondWithFilteredResult(_0x244179,_0x153e1c){return function(_0x4e0e22){if(_0x4e0e22){var _0x1eaf15=typeof _0x153e1c[_0xc616('0x2b')]==='undefined'&&typeof _0x153e1c[_0xc616('0x2c')]===_0xc616('0x2d');var _0x3c0c53=_0x4e0e22['count'];var _0x5798cb=_0x1eaf15?0x0:_0x153e1c['offset'];var _0x23cbd0=_0x1eaf15?_0x4e0e22[_0xc616('0x2e')]:_0x153e1c[_0xc616('0x2b')]+_0x153e1c[_0xc616('0x2c')];var _0xb7723a;if(_0x23cbd0>=_0x3c0c53){_0x23cbd0=_0x3c0c53;_0xb7723a=0xc8;}else{_0xb7723a=0xce;}_0x244179['status'](_0xb7723a);return _0x244179[_0xc616('0x2f')](_0xc616('0x30'),_0x5798cb+'-'+_0x23cbd0+'/'+_0x3c0c53)['json'](_0x4e0e22);}return null;};}function patchUpdates(_0xa22e1e){return function(_0x4229c5){try{jsonpatch[_0xc616('0x31')](_0x4229c5,_0xa22e1e,!![]);}catch(_0xde3c76){return BPromise[_0xc616('0x32')](_0xde3c76);}return _0x4229c5[_0xc616('0x33')]();};}function saveUpdates(_0x510d02,_0x42fde3){return function(_0x401ad1){if(_0x401ad1){return _0x401ad1[_0xc616('0x34')](_0x510d02)['then'](function(_0x3a48f8){return _0x3a48f8;});}return null;};}function removeEntity(_0x3b4eaa,_0x14deb5){return function(_0x4b88b2){if(_0x4b88b2){return _0x4b88b2[_0xc616('0x35')]()[_0xc616('0x1d')](function(){var _0x4411c0=_0x4b88b2['get']({'plain':!![]});var _0x39b886=_0xc616('0x36');return db[_0xc616('0x37')]['destroy']({'where':{'type':_0x39b886,'resourceId':_0x4411c0['id']}})[_0xc616('0x1d')](function(){return _0x4b88b2;});})[_0xc616('0x1d')](function(){_0x3b4eaa[_0xc616('0x28')](0xcc)[_0xc616('0x29')]();});}};}function handleEntityNotFound(_0x2f6065,_0x59ff23){return function(_0x5619b0){if(!_0x5619b0){_0x2f6065['sendStatus'](0x194);}return _0x5619b0;};}function handleError(_0x50c27b,_0x41ba60){_0x41ba60=_0x41ba60||0x1f4;return function(_0x172b19){logger[_0xc616('0x22')](_0x172b19[_0xc616('0x38')]);if(_0x172b19[_0xc616('0x39')]){delete _0x172b19[_0xc616('0x39')];}_0x50c27b[_0xc616('0x28')](_0x41ba60)[_0xc616('0x3a')](_0x172b19);};}exports['index']=function(_0x4f23c4,_0x5f8542){var _0x219458={'include':[{'model':db[_0xc616('0x3b')],'as':'mandatoryDispositionPause'}]},_0x4b4ced={},_0x130c9a={'count':0x0,'rows':[]};var _0x565095=_[_0xc616('0x3c')](db[_0xc616('0x3d')][_0xc616('0x3e')],function(_0x2ab6c4){return{'name':_0x2ab6c4[_0xc616('0x3f')],'type':_0x2ab6c4['type'][_0xc616('0x40')]};});_0x4b4ced['model']=_[_0xc616('0x3c')](_0x565095,_0xc616('0x39'));_0x4b4ced['query']=_['keys'](_0x4f23c4[_0xc616('0x41')]);_0x4b4ced[_0xc616('0x42')]=_['intersection'](_0x4b4ced[_0xc616('0x43')],_0x4b4ced[_0xc616('0x41')]);_0x219458[_0xc616('0x44')]=_[_0xc616('0x45')](_0x4b4ced[_0xc616('0x43')],qs[_0xc616('0x46')](_0x4f23c4[_0xc616('0x41')][_0xc616('0x46')]));_0x219458[_0xc616('0x44')]=_0x219458[_0xc616('0x44')]['length']?_0x219458['attributes']:_0x4b4ced[_0xc616('0x43')];if(!_0x4f23c4[_0xc616('0x41')]['hasOwnProperty']('nolimit')){_0x219458['limit']=qs[_0xc616('0x2c')](_0x4f23c4[_0xc616('0x41')][_0xc616('0x2c')]);_0x219458['offset']=qs[_0xc616('0x2b')](_0x4f23c4['query'][_0xc616('0x2b')]);}_0x219458[_0xc616('0x47')]=qs[_0xc616('0x48')](_0x4f23c4[_0xc616('0x41')][_0xc616('0x48')]);_0x219458['where']=qs[_0xc616('0x42')](_['pick'](_0x4f23c4[_0xc616('0x41')],_0x4b4ced[_0xc616('0x42')]),_0x565095);if(_0x4f23c4[_0xc616('0x41')]['filter']){_0x219458['where']=_[_0xc616('0x49')](_0x219458['where'],{'$or':_[_0xc616('0x3c')](_0x565095,function(_0x52e58c){if(_0x52e58c['type']!==_0xc616('0x4a')){var _0x3f1481={};_0x3f1481[_0x52e58c[_0xc616('0x39')]]={'$like':'%'+_0x4f23c4[_0xc616('0x41')][_0xc616('0x4b')]+'%'};return _0x3f1481;}})});}_0x219458=_['merge']({},_0x219458,_0x4f23c4[_0xc616('0x4c')]);var _0x15f974={'where':_0x219458[_0xc616('0x4d')]};return db['WhatsappAccount']['count'](_0x15f974)[_0xc616('0x1d')](function(_0x40b7d1){_0x130c9a[_0xc616('0x2e')]=_0x40b7d1;if(_0x4f23c4['query'][_0xc616('0x4e')]){_0x219458[_0xc616('0x4f')]=[{'all':!![]}];}return db[_0xc616('0x3d')][_0xc616('0x50')](_0x219458);})[_0xc616('0x1d')](function(_0x1ed746){_0x130c9a[_0xc616('0x51')]=_0x1ed746;return _0x130c9a;})[_0xc616('0x1d')](respondWithFilteredResult(_0x5f8542,_0x219458))[_0xc616('0x26')](handleError(_0x5f8542,null));};exports[_0xc616('0x52')]=function(_0x464360,_0x5df040){var _0x18245a={'raw':![],'where':{'id':_0x464360[_0xc616('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0xc616('0x54')}]},_0x190e3e={};_0x190e3e[_0xc616('0x43')]=_[_0xc616('0x55')](db['WhatsappAccount'][_0xc616('0x3e')]);_0x190e3e[_0xc616('0x41')]=_[_0xc616('0x55')](_0x464360[_0xc616('0x41')]);_0x190e3e['filters']=_['intersection'](_0x190e3e['model'],_0x190e3e[_0xc616('0x41')]);_0x18245a['attributes']=_[_0xc616('0x45')](_0x190e3e[_0xc616('0x43')],qs[_0xc616('0x46')](_0x464360['query']['fields']));_0x18245a[_0xc616('0x44')]=_0x18245a[_0xc616('0x44')][_0xc616('0x56')]?_0x18245a[_0xc616('0x44')]:_0x190e3e[_0xc616('0x43')];if(_0x464360['query'][_0xc616('0x4e')]){_0x18245a['include']=[{'all':!![]}];}_0x18245a=_[_0xc616('0x49')]({},_0x18245a,_0x464360['options']);return db[_0xc616('0x3d')][_0xc616('0x57')](_0x18245a)['then'](handleEntityNotFound(_0x5df040,null))['then'](respondWithResult(_0x5df040,null))[_0xc616('0x26')](handleError(_0x5df040,null));};exports[_0xc616('0x58')]=function(_0xcfc781,_0x2a15ca){return db['WhatsappAccount'][_0xc616('0x58')](_0xcfc781['body'],{})['then'](function(_0x529b73){var _0xf70952=_0xcfc781['user'][_0xc616('0x59')]({'plain':!![]});if(!_0xf70952)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf70952[_0xc616('0x5a')]===_0xc616('0x5b')){var _0x2b8824=_0x529b73[_0xc616('0x59')]({'plain':!![]});var _0x4cf619=_0xc616('0x36');return db[_0xc616('0x5c')][_0xc616('0x57')]({'where':{'name':_0x4cf619,'userProfileId':_0xf70952[_0xc616('0x5d')]},'raw':!![]})[_0xc616('0x1d')](function(_0xec02d6){if(_0xec02d6&&_0xec02d6[_0xc616('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b8824[_0xc616('0x39')],'resourceId':_0x2b8824['id'],'type':_0xec02d6[_0xc616('0x39')],'sectionId':_0xec02d6['id']},{})['then'](function(){return _0x529b73;});}else{return _0x529b73;}})['catch'](function(_0x570234){logger[_0xc616('0x22')](_0xc616('0x5f'),_0x570234);throw _0x570234;});}return _0x529b73;})[_0xc616('0x1d')](respondWithResult(_0x2a15ca,0xc9))[_0xc616('0x26')](handleError(_0x2a15ca,null));};exports[_0xc616('0x34')]=function(_0x117547,_0x32e943){if(_0x117547[_0xc616('0x60')]['id']){delete _0x117547[_0xc616('0x60')]['id'];}return db[_0xc616('0x3d')][_0xc616('0x57')]({'where':{'id':_0x117547[_0xc616('0x53')]['id']},'include':[{'model':db[_0xc616('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xc616('0x1d')](handleEntityNotFound(_0x32e943,null))[_0xc616('0x1d')](saveUpdates(_0x117547[_0xc616('0x60')],null))[_0xc616('0x1d')](respondWithResult(_0x32e943,null))['catch'](handleError(_0x32e943,null));};exports[_0xc616('0x35')]=function(_0x1a6080,_0x47a004){return db['WhatsappAccount'][_0xc616('0x57')]({'where':{'id':_0x1a6080[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x47a004,null))[_0xc616('0x1d')](removeEntity(_0x47a004,null))['catch'](handleError(_0x47a004,null));};exports['describe']=function(_0x3c8602,_0x52f0da){return db[_0xc616('0x3d')][_0xc616('0x61')]()[_0xc616('0x1d')](respondWithResult(_0x52f0da,null))[_0xc616('0x26')](handleError(_0x52f0da,null));};exports[_0xc616('0x62')]=function(_0x4ea762,_0x19534d,_0x1802f8){if(_0x4ea762[_0xc616('0x60')]['id']){delete _0x4ea762[_0xc616('0x60')]['id'];}return db['WhatsappAccount'][_0xc616('0x57')]({'where':{'id':_0x4ea762[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x19534d,null))[_0xc616('0x1d')](function(_0x5d47da){if(_0x5d47da){_0x4ea762[_0xc616('0x60')][_0xc616('0x63')]=_0x5d47da['id'];return db[_0xc616('0x64')]['create'](_0x4ea762['body']);}})['then'](respondWithResult(_0x19534d,null))[_0xc616('0x26')](handleError(_0x19534d,null));};exports[_0xc616('0x65')]=function(_0x2adcf4,_0xf37a2b,_0x31205b){var _0x17105b={'raw':![],'where':{}};var _0x29547a={};var _0x21fa1f={'count':0x0,'rows':[]};return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x2adcf4[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0xf37a2b,null))[_0xc616('0x1d')](function(_0x33ed5c){if(_0x33ed5c){_0x29547a[_0xc616('0x43')]=_[_0xc616('0x55')](db[_0xc616('0x64')][_0xc616('0x3e')]);_0x29547a['query']=_[_0xc616('0x55')](_0x2adcf4['query']);_0x29547a[_0xc616('0x42')]=_['intersection'](_0x29547a[_0xc616('0x43')],_0x29547a[_0xc616('0x41')]);_0x17105b[_0xc616('0x44')]=_[_0xc616('0x45')](_0x29547a[_0xc616('0x43')],qs[_0xc616('0x46')](_0x2adcf4['query'][_0xc616('0x46')]));_0x17105b[_0xc616('0x44')]=_0x17105b['attributes'][_0xc616('0x56')]?_0x17105b[_0xc616('0x44')]:_0x29547a[_0xc616('0x43')];if(!_0x2adcf4[_0xc616('0x41')]['hasOwnProperty'](_0xc616('0x67'))){_0x17105b['limit']=qs[_0xc616('0x2c')](_0x2adcf4['query'][_0xc616('0x2c')]);_0x17105b[_0xc616('0x2b')]=qs[_0xc616('0x2b')](_0x2adcf4[_0xc616('0x41')][_0xc616('0x2b')]);}_0x17105b['order']=qs[_0xc616('0x48')](_0x2adcf4['query'][_0xc616('0x48')]);_0x17105b[_0xc616('0x4d')]=qs[_0xc616('0x42')](_['pick'](_0x2adcf4[_0xc616('0x41')],_0x29547a[_0xc616('0x42')]));_0x17105b[_0xc616('0x4d')]['WhatsappAccountId']=_0x33ed5c['id'];if(_0x2adcf4[_0xc616('0x41')][_0xc616('0x4b')]){_0x17105b[_0xc616('0x4d')]=_['merge'](_0x17105b['where'],{'$or':_['map'](_0x17105b[_0xc616('0x44')],function(_0x1aedd){var _0x23bd84={};_0x23bd84[_0x1aedd]={'$like':'%'+_0x2adcf4['query'][_0xc616('0x4b')]+'%'};return _0x23bd84;})});}_0x17105b=_[_0xc616('0x49')]({},_0x17105b,_0x2adcf4[_0xc616('0x4c')]);return db['Disposition']['count']({'where':_0x17105b['where']})[_0xc616('0x1d')](function(_0x2bfa98){_0x21fa1f[_0xc616('0x2e')]=_0x2bfa98;if(_0x2adcf4[_0xc616('0x41')]['includeAll']){_0x17105b[_0xc616('0x4f')]=[{'all':!![]}];}return db[_0xc616('0x64')]['findAll'](_0x17105b);})[_0xc616('0x1d')](function(_0x12c77b){_0x21fa1f['rows']=_0x12c77b;return _0x21fa1f;});}})[_0xc616('0x1d')](respondWithFilteredResult(_0xf37a2b,_0x17105b))[_0xc616('0x26')](handleError(_0xf37a2b,null));};exports[_0xc616('0x68')]=function(_0xa5778c,_0x59f878,_0x32fbce){return db['WhatsappAccount'][_0xc616('0x57')]({'where':{'id':_0xa5778c[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x59f878,null))[_0xc616('0x1d')](function(_0x2f3b28){if(_0x2f3b28){return _0x2f3b28['removeDispositions'](_0xa5778c[_0xc616('0x41')][_0xc616('0x69')]);}})['then'](respondWithStatusCode(_0x59f878,null))['catch'](handleError(_0x59f878,null));};exports[_0xc616('0x6a')]=function(_0x28c340,_0x533c72,_0xe79124){if(_0x28c340['body']['id']){delete _0x28c340[_0xc616('0x60')]['id'];}return db[_0xc616('0x3d')][_0xc616('0x57')]({'where':{'id':_0x28c340[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x533c72,null))['then'](function(_0xece723){if(_0xece723){_0x28c340['body'][_0xc616('0x63')]=_0xece723['id'];return db[_0xc616('0x6b')][_0xc616('0x58')](_0x28c340[_0xc616('0x60')]);}})[_0xc616('0x1d')](respondWithResult(_0x533c72,null))[_0xc616('0x26')](handleError(_0x533c72,null));};exports[_0xc616('0x6c')]=function(_0x5d3257,_0x210347,_0x46fa7b){var _0x3f93e6={'raw':![],'where':{}};var _0x1c4576={};var _0x1d8099={'count':0x0,'rows':[]};return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x5d3257[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x210347,null))[_0xc616('0x1d')](function(_0x26dfc8){if(_0x26dfc8){_0x1c4576[_0xc616('0x43')]=_[_0xc616('0x55')](db['CannedAnswer']['rawAttributes']);_0x1c4576['query']=_[_0xc616('0x55')](_0x5d3257['query']);_0x1c4576[_0xc616('0x42')]=_[_0xc616('0x45')](_0x1c4576[_0xc616('0x43')],_0x1c4576['query']);_0x3f93e6[_0xc616('0x44')]=_[_0xc616('0x45')](_0x1c4576[_0xc616('0x43')],qs[_0xc616('0x46')](_0x5d3257[_0xc616('0x41')][_0xc616('0x46')]));_0x3f93e6[_0xc616('0x44')]=_0x3f93e6[_0xc616('0x44')][_0xc616('0x56')]?_0x3f93e6[_0xc616('0x44')]:_0x1c4576[_0xc616('0x43')];if(!_0x5d3257[_0xc616('0x41')][_0xc616('0x6d')](_0xc616('0x67'))){_0x3f93e6['limit']=qs[_0xc616('0x2c')](_0x5d3257[_0xc616('0x41')]['limit']);_0x3f93e6[_0xc616('0x2b')]=qs[_0xc616('0x2b')](_0x5d3257[_0xc616('0x41')][_0xc616('0x2b')]);}_0x3f93e6[_0xc616('0x47')]=qs[_0xc616('0x48')](_0x5d3257['query'][_0xc616('0x48')]);_0x3f93e6['where']=qs['filters'](_[_0xc616('0x6e')](_0x5d3257['query'],_0x1c4576[_0xc616('0x42')]));_0x3f93e6[_0xc616('0x4d')][_0xc616('0x63')]=_0x26dfc8['id'];if(_0x5d3257[_0xc616('0x41')][_0xc616('0x4b')]){_0x3f93e6[_0xc616('0x4d')]=_[_0xc616('0x49')](_0x3f93e6[_0xc616('0x4d')],{'$or':_[_0xc616('0x3c')](_0x3f93e6[_0xc616('0x44')],function(_0x134c02){var _0x4b1e2b={};_0x4b1e2b[_0x134c02]={'$like':'%'+_0x5d3257['query'][_0xc616('0x4b')]+'%'};return _0x4b1e2b;})});}_0x3f93e6=_[_0xc616('0x49')]({},_0x3f93e6,_0x5d3257[_0xc616('0x4c')]);return db[_0xc616('0x6b')]['count']({'where':_0x3f93e6['where']})[_0xc616('0x1d')](function(_0x2530d6){_0x1d8099[_0xc616('0x2e')]=_0x2530d6;if(_0x5d3257['query'][_0xc616('0x4e')]){_0x3f93e6['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xc616('0x50')](_0x3f93e6);})[_0xc616('0x1d')](function(_0x574510){_0x1d8099['rows']=_0x574510;return _0x1d8099;});}})[_0xc616('0x1d')](respondWithFilteredResult(_0x210347,_0x3f93e6))[_0xc616('0x26')](handleError(_0x210347,null));};exports[_0xc616('0x6f')]=function(_0x525f22,_0x30c226,_0x1b397e){return db[_0xc616('0x3d')]['find']({'where':{'id':_0x525f22['params']['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x30c226,null))[_0xc616('0x1d')](function(_0x461fd0){if(_0x461fd0){return _0x461fd0[_0xc616('0x6f')](_0x525f22[_0xc616('0x41')][_0xc616('0x69')]);}})[_0xc616('0x1d')](respondWithStatusCode(_0x30c226,null))[_0xc616('0x26')](handleError(_0x30c226,null));};exports['addAgents']=function(_0x31c8bb,_0x8c5b72,_0xb8a9d8){return db[_0xc616('0x3d')][_0xc616('0x57')]({'where':{'id':_0x31c8bb[_0xc616('0x53')]['id']}})['then'](handleEntityNotFound(_0x8c5b72,null))[_0xc616('0x1d')](function(_0x4974ac){if(_0x4974ac){return _0x4974ac[_0xc616('0x70')](_0x31c8bb[_0xc616('0x60')]['ids'],_[_0xc616('0x71')](_0x31c8bb[_0xc616('0x60')],[_0xc616('0x69'),'id'])||{})[_0xc616('0x72')](function(_0x598bed){for(var _0x574abf=0x0;_0x574abf<_0x31c8bb['body'][_0xc616('0x69')][_0xc616('0x56')];_0x574abf+=0x1){socket[_0xc616('0x73')](_0xc616('0x74'),{'UserId':Number(_0x31c8bb[_0xc616('0x60')][_0xc616('0x69')][_0x574abf]),'WhatsappAccountId':Number(_0x31c8bb[_0xc616('0x53')]['id'])});}return _0x598bed;});}})['then'](respondWithResult(_0x8c5b72,null))['catch'](handleError(_0x8c5b72,null));};exports['removeAgents']=function(_0x26723f,_0x233ced,_0x568584){return db[_0xc616('0x3d')]['find']({'where':{'id':_0x26723f['params']['id']}})['then'](handleEntityNotFound(_0x233ced,null))['then'](function(_0x46f92b){if(_0x46f92b){return _0x46f92b[_0xc616('0x75')](_0x26723f[_0xc616('0x41')][_0xc616('0x69')])['then'](function(){if(_[_0xc616('0x76')](_0x26723f[_0xc616('0x41')][_0xc616('0x69')])){for(var _0x38e34a=0x0;_0x38e34a<_0x26723f[_0xc616('0x41')][_0xc616('0x69')][_0xc616('0x56')];_0x38e34a+=0x1){socket[_0xc616('0x73')](_0xc616('0x77'),{'UserId':Number(_0x26723f['query'][_0xc616('0x69')][_0x38e34a]),'WhatsappAccountId':Number(_0x26723f[_0xc616('0x53')]['id'])});}}else{socket['emit'](_0xc616('0x77'),{'UserId':Number(_0x26723f['query'][_0xc616('0x69')]),'WhatsappAccountId':Number(_0x26723f['params']['id'])});}});}})[_0xc616('0x1d')](respondWithStatusCode(_0x233ced,null))[_0xc616('0x26')](handleError(_0x233ced,null));};exports[_0xc616('0x78')]=function(_0x26ef30,_0x5f2aa3,_0x59f8d5){var _0x5f7b18={};var _0x2ca412={};var _0x305ffd;var _0x3a54c3;return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x26ef30[_0xc616('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f2aa3,null))[_0xc616('0x1d')](function(_0x115632){if(_0x115632){_0x305ffd=_0x115632;_0x2ca412[_0xc616('0x43')]=_[_0xc616('0x55')](db['User'][_0xc616('0x3e')]);_0x2ca412['query']=_[_0xc616('0x55')](_0x26ef30[_0xc616('0x41')]);_0x2ca412[_0xc616('0x42')]=_[_0xc616('0x45')](_0x2ca412[_0xc616('0x43')],_0x2ca412[_0xc616('0x41')]);_0x5f7b18[_0xc616('0x44')]=_[_0xc616('0x45')](_0x2ca412[_0xc616('0x43')],qs[_0xc616('0x46')](_0x26ef30[_0xc616('0x41')][_0xc616('0x46')]));_0x5f7b18[_0xc616('0x44')]=_0x5f7b18['attributes'][_0xc616('0x56')]?_0x5f7b18[_0xc616('0x44')]:_0x2ca412[_0xc616('0x43')];_0x5f7b18[_0xc616('0x47')]=qs[_0xc616('0x48')](_0x26ef30[_0xc616('0x41')][_0xc616('0x48')]);_0x5f7b18[_0xc616('0x4d')]=qs[_0xc616('0x42')](_[_0xc616('0x6e')](_0x26ef30[_0xc616('0x41')],_0x2ca412[_0xc616('0x42')]));if(_0x26ef30['query'][_0xc616('0x4b')]){_0x5f7b18[_0xc616('0x4d')]=_['merge'](_0x5f7b18['where'],{'$or':_[_0xc616('0x3c')](_0x5f7b18['attributes'],function(_0x3f3ae7){var _0x5e6ce3={};_0x5e6ce3[_0x3f3ae7]={'$like':'%'+_0x26ef30[_0xc616('0x41')][_0xc616('0x4b')]+'%'};return _0x5e6ce3;})});}_0x5f7b18=_['merge']({},_0x5f7b18,_0x26ef30[_0xc616('0x4c')]);return _0x305ffd[_0xc616('0x78')](_0x5f7b18);}})[_0xc616('0x1d')](function(_0x72153e){if(_0x72153e){_0x3a54c3=_0x72153e[_0xc616('0x56')];if(!_0x26ef30[_0xc616('0x41')][_0xc616('0x6d')](_0xc616('0x67'))){_0x5f7b18[_0xc616('0x2c')]=qs[_0xc616('0x2c')](_0x26ef30['query'][_0xc616('0x2c')]);_0x5f7b18[_0xc616('0x2b')]=qs[_0xc616('0x2b')](_0x26ef30[_0xc616('0x41')][_0xc616('0x2b')]);}return _0x305ffd[_0xc616('0x78')](_0x5f7b18);}})[_0xc616('0x1d')](function(_0x59cc2e){if(_0x59cc2e){return _0x59cc2e?{'count':_0x3a54c3,'rows':_0x59cc2e}:null;}})[_0xc616('0x1d')](respondWithResult(_0x5f2aa3,null))['catch'](handleError(_0x5f2aa3,null));};exports['addApplications']=function(_0x48fea5,_0x2b1343){var _0x475279=_0x48fea5[_0xc616('0x53')]['id'];var _0x241776=_0x48fea5[_0xc616('0x60')];var _0x356aae=0xc8;var _0x3ed9a4=null;return db[_0xc616('0x79')][_0xc616('0x7a')]({'isolationLevel':db[_0xc616('0x79')][_0xc616('0x7b')][_0xc616('0x7c')][_0xc616('0x7d')]},function(_0xd14a70){return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x475279},'transaction':_0xd14a70})[_0xc616('0x1d')](function(_0x3e047a){if(_0x3e047a){return db[_0xc616('0x7e')][_0xc616('0x35')]({'where':{'WhatsappAccountId':_0x475279},'transaction':_0xd14a70})[_0xc616('0x1d')](function(){var _0x278cf5=_[_0xc616('0x3c')](_0x241776,function(_0x54c4b0){_0x54c4b0[_0xc616('0x63')]=_0x475279;return _0x54c4b0;});return db[_0xc616('0x7e')][_0xc616('0x7f')](_0x278cf5,{'transaction':_0xd14a70});});}else{_0x356aae=0x194;_0x3ed9a4=[];}});})[_0xc616('0x1d')](function(){if(_0x356aae!==0x194){return db[_0xc616('0x7e')][_0xc616('0x80')]({'where':{'WhatsappAccountId':_0x475279},'order':_0xc616('0x81')})[_0xc616('0x1d')](function(_0x197664){_0x3ed9a4=_0x197664;});}})[_0xc616('0x26')](function(_0x250cc6){_0x356aae=0x1f4;logger[_0xc616('0x22')](_0x250cc6[_0xc616('0x38')]);if(_0x250cc6[_0xc616('0x39')]){delete _0x250cc6[_0xc616('0x39')];}_0x3ed9a4=_0x250cc6;})[_0xc616('0x82')](function(){if(_0x3ed9a4===null){_0x2b1343[_0xc616('0x27')](_0x356aae);}else{if(_0x356aae===0x1f4){_0x2b1343[_0xc616('0x28')](_0x356aae)[_0xc616('0x3a')](_0x3ed9a4);}else{_0x2b1343['status'](_0x356aae)[_0xc616('0x2a')](_0x3ed9a4);}}});};exports[_0xc616('0x83')]=function(_0x19a2bb,_0x51b437,_0x41d044){var _0x1e20c6={};var _0x42a0bb={};var _0x936432;var _0x19a1af;return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x19a2bb[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x51b437,null))[_0xc616('0x1d')](function(_0x5f325b){if(_0x5f325b){_0x936432=_0x5f325b;_0x42a0bb['model']=_['keys'](db[_0xc616('0x7e')]['rawAttributes']);_0x42a0bb['query']=_[_0xc616('0x55')](_0x19a2bb[_0xc616('0x41')]);_0x42a0bb['filters']=_[_0xc616('0x45')](_0x42a0bb[_0xc616('0x43')],_0x42a0bb[_0xc616('0x41')]);_0x1e20c6['attributes']=_[_0xc616('0x45')](_0x42a0bb[_0xc616('0x43')],qs[_0xc616('0x46')](_0x19a2bb['query'][_0xc616('0x46')]));_0x1e20c6[_0xc616('0x44')]=_0x1e20c6[_0xc616('0x44')][_0xc616('0x56')]?_0x1e20c6[_0xc616('0x44')]:_0x42a0bb[_0xc616('0x43')];_0x1e20c6[_0xc616('0x47')]=qs[_0xc616('0x48')](_0x19a2bb[_0xc616('0x41')]['sort']);_0x1e20c6[_0xc616('0x4d')]=qs[_0xc616('0x42')](_[_0xc616('0x6e')](_0x19a2bb['query'],_0x42a0bb[_0xc616('0x42')]));if(_0x19a2bb[_0xc616('0x41')]['filter']){_0x1e20c6[_0xc616('0x4d')]=_['merge'](_0x1e20c6[_0xc616('0x4d')],{'$or':_[_0xc616('0x3c')](_0x1e20c6[_0xc616('0x44')],function(_0x56cced){var _0x31e0c6={};_0x31e0c6[_0x56cced]={'$like':'%'+_0x19a2bb['query'][_0xc616('0x4b')]+'%'};return _0x31e0c6;})});}_0x1e20c6=_[_0xc616('0x49')]({},_0x1e20c6,_0x19a2bb['options']);return _0x936432[_0xc616('0x83')](_0x1e20c6);}})[_0xc616('0x1d')](function(_0x1bd1f4){if(_0x1bd1f4){_0x19a1af=_0x1bd1f4[_0xc616('0x56')];if(!_0x19a2bb[_0xc616('0x41')]['hasOwnProperty'](_0xc616('0x67'))){_0x1e20c6['limit']=qs[_0xc616('0x2c')](_0x19a2bb[_0xc616('0x41')][_0xc616('0x2c')]);_0x1e20c6[_0xc616('0x2b')]=qs[_0xc616('0x2b')](_0x19a2bb[_0xc616('0x41')][_0xc616('0x2b')]);}return _0x936432[_0xc616('0x83')](_0x1e20c6);}})[_0xc616('0x1d')](function(_0x2513ca){if(_0x2513ca){return _0x2513ca?{'count':_0x19a1af,'rows':_0x2513ca}:null;}})[_0xc616('0x1d')](respondWithResult(_0x51b437,null))[_0xc616('0x26')](handleError(_0x51b437,null));};exports[_0xc616('0x84')]=function(_0x564a95,_0x4af228,_0x22f895){var _0x138b54={'channel':_0xc616('0x85')};var _0x37e881=[];var _0x10d291=[];var _0x9c10f2={};return db[_0xc616('0x3d')]['find']({'where':{'id':_0x564a95[_0xc616('0x53')]['id']},'include':[{'model':db[_0xc616('0x7e')],'as':_0xc616('0x86')}]})[_0xc616('0x1d')](handleEntityNotFound(_0x4af228,null))[_0xc616('0x1d')](function(_0x5538fb){_0x138b54['account']=_0x5538fb;if(_0x138b54[_0xc616('0x87')]&&_0x138b54[_0xc616('0x87')]['type']===_0xc616('0x88')&&_0x564a95[_0xc616('0x60')]['statuses']){if(_0x564a95[_0xc616('0x60')][_0xc616('0x89')][_0xc616('0x56')]===0x0)return;if(_0x564a95[_0xc616('0x60')][_0xc616('0x89')][0x0]['state']!==_0xc616('0x8a'))return;return db[_0xc616('0x8b')][_0xc616('0x34')]({'read':!![],'readAt':_0x564a95[_0xc616('0x60')]['statuses'][0x0][_0xc616('0x8c')]},{'where':{'messageId':_0x564a95[_0xc616('0x60')]['statuses'][0x0][_0xc616('0x8d')]},'individualHooks':!![]})['then'](function(_0x58c611){return _0x4af228[_0xc616('0x28')](0xc8)[_0xc616('0x2a')](_0x58c611);});}_0x138b54[_0xc616('0x8e')]=_[_0xc616('0x8f')](_0x5538fb[_0xc616('0x86')],['priority'],[_0xc616('0x90')]);if(_0x138b54[_0xc616('0x87')][_0xc616('0x86')]){delete _0x138b54[_0xc616('0x87')]['Applications'];}return db[_0xc616('0x91')][_0xc616('0x61')]()[_0xc616('0x1d')](function(_0x84a0ad){if(!_0x84a0ad){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))](_0xc616('0x94'));}_0x37e881=_[_0xc616('0x95')](_['keys'](_0x84a0ad),['createdAt',_0xc616('0x96')]);_0x10d291=_[_0xc616('0x95')](_[_0xc616('0x55')](_0x84a0ad),['createdAt',_0xc616('0x96'),_0xc616('0x97'),_0xc616('0x98')]);_0x138b54[_0xc616('0x60')]={'mapKey':_0xc616('0x99')};if(_0x138b54['account']&&_0x138b54['account'][_0xc616('0x9a')]==='twilio'){_0x138b54[_0xc616('0x60')][_0xc616('0x9b')]=_0x564a95[_0xc616('0x60')][_0xc616('0x9c')]['replace'](_0xc616('0x9d'),'');_0x138b54[_0xc616('0x60')][_0xc616('0x60')]=_0x564a95[_0xc616('0x60')][_0xc616('0x9e')];_0x138b54['body'][_0xc616('0x9f')]=_0x564a95[_0xc616('0x60')][_0xc616('0xa0')];}if(_0x138b54['account']&&_0x138b54['account'][_0xc616('0x9a')]===_0xc616('0x88')){_0x138b54[_0xc616('0x60')]['from']=_0x564a95[_0xc616('0x60')]['notifications'][0x0]['from'];_0x138b54['body'][_0xc616('0x60')]=_0x564a95[_0xc616('0x60')][_0xc616('0xa1')][0x0][_0xc616('0x24')][_0xc616('0x60')];_0x138b54[_0xc616('0x60')]['messageId']=_0x564a95[_0xc616('0x60')][_0xc616('0xa1')][0x0][_0xc616('0x8d')];}if(_0x138b54[_0xc616('0x60')]['id']){delete _0x138b54['body']['id'];}if(_[_0xc616('0xa2')](_0x138b54[_0xc616('0x60')][_0xc616('0x9b')])){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))](_0xc616('0xa3'));}if(_[_0xc616('0xa2')](_0x138b54[_0xc616('0x60')][_0xc616('0x60')])||_0x138b54[_0xc616('0x60')][_0xc616('0x60')]===''){throw new db['Sequelize'][(_0xc616('0x93'))](_0xc616('0xa4'));}if(_[_0xc616('0xa2')](_0x138b54[_0xc616('0x60')][_0xc616('0xa5')])){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))](_0xc616('0xa6')+_0x10d291);}if(!_[_0xc616('0xa7')](_0x10d291,_0x138b54[_0xc616('0x60')]['mapKey'])){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))](_0xc616('0xa8')+_0x10d291);}_0x9c10f2[_0x138b54[_0xc616('0x60')][_0xc616('0xa5')]]=_0x138b54[_0xc616('0x60')][_0xc616('0x9b')];return db[_0xc616('0xa9')][_0xc616('0x57')]({'where':{'id':_0x138b54[_0xc616('0x87')]['ListId']},'include':[{'model':db[_0xc616('0x91')],'as':_0xc616('0xaa'),'where':_0x9c10f2,'limit':0x1,'order':[[_0xc616('0x96'),'DESC']]}]});})[_0xc616('0x1d')](handleEntityNotFound(_0x4af228,null))[_0xc616('0x1d')](function(_0x3033b3){if(_0x3033b3){_0x138b54[_0xc616('0xab')]=_[_0xc616('0x71')](_0x3033b3,[_0xc616('0xaa')]);if(_0x3033b3[_0xc616('0xaa')][_0xc616('0x56')]){return _0x3033b3[_0xc616('0xaa')][0x0];}var _0x3b4f6c=_['defaults'](_0x138b54['body'],{'firstName':_0x138b54['body'][_0xc616('0x9b')],'ListId':_0x3033b3['id']});_0x3b4f6c[_0x138b54[_0xc616('0x60')][_0xc616('0xa5')]]=_0x138b54[_0xc616('0x60')][_0xc616('0x9b')];return db[_0xc616('0x91')][_0xc616('0x58')](_0x3b4f6c,{'fields':_0x37e881,'raw':!![]});}})['then'](handleEntityNotFound(_0x4af228,null))[_0xc616('0x1d')](function(_0x295a11){if(_0x295a11){_0x138b54['contact']=_0x295a11;var _0x545899={'ContactId':_0x295a11['id'],'phone':_0x138b54['body'][_0xc616('0x9b')],'WhatsappAccountId':_0x564a95[_0xc616('0x53')]['id']};var _0x1ec575={'ContactId':_0x295a11['id'],'WhatsappAccountId':_0x564a95['params']['id'],'closed':![]};return db[_0xc616('0xac')]['find']({'where':_0x1ec575})['then'](function(_0x57d1d2){if(_0x57d1d2){return[_0x57d1d2,![]];}return db[_0xc616('0xac')][_0xc616('0x58')](_0x545899)[_0xc616('0x1d')](function(_0x1d401d){return[_0x1d401d,!![]];});});}})[_0xc616('0x72')](function(_0x196d11,_0x25a6ca){_0x138b54['interaction']=_0x196d11[_0xc616('0x59')]({'plain':!![]});_0x138b54[_0xc616('0xad')][_0xc616('0xae')]=![];if(_0x25a6ca){if(_0x138b54[_0xc616('0x87')][_0xc616('0xaf')]){_0x138b54[_0xc616('0x8e')][_0xc616('0xb0')]({'id':0x0,'priority':_0x138b54[_0xc616('0x8e')][_0xc616('0x56')]+0x1,'app':_0xc616('0xb1'),'appdata':_0xc616('0xb2'),'interval':_0xc616('0xb3')});}_0x138b54[_0xc616('0xad')][_0xc616('0xae')]=!![];}return db[_0xc616('0x8b')]['create']({'phone':_0x138b54['body'][_0xc616('0x9b')],'messageId':_0x138b54['body'][_0xc616('0x9f')],'body':_0x138b54[_0xc616('0x60')][_0xc616('0x60')],'WhatsappAccountId':_0x564a95[_0xc616('0x53')]['id'],'WhatsappInteractionId':_0x196d11['id'],'direction':'in','ContactId':_0x196d11[_0xc616('0xb4')],'AttachmentId':_0x138b54[_0xc616('0x60')][_0xc616('0xb5')]});})[_0xc616('0x1d')](function(_0x561f4b){_0x138b54[_0xc616('0x24')]=_0x561f4b;if(_0x138b54['interaction'][_0xc616('0xb6')]){return db[_0xc616('0xb7')][_0xc616('0x57')]({'attributes':['id',_0xc616('0x39')],'where':{'id':_0x138b54[_0xc616('0xad')]['UserId']}})[_0xc616('0x1d')](function(_0x25cbd3){if(_0x25cbd3){_0x138b54[_0xc616('0x8e')][_0xc616('0xb8')]({'id':0x0,'priority':0x0,'app':_0xc616('0xb9'),'appdata':_0x25cbd3[_0xc616('0x39')]+','+(_0x138b54['account'][_0xc616('0xba')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc616('0xbb'),_0xc616('0xbc'),_0x138b54);});}return respondWithRpcPromise(_0xc616('0xbb'),_0xc616('0xbc'),_0x138b54);})[_0xc616('0x1d')](function(_0x457017){if(_0x457017){var _0x540381=0xc8;var _0x9fa353='receiveMessage';logger[_0xc616('0x1e')](_0xc616('0x20'),_0x9fa353,_0x540381,_0xc616('0xbd'));logger['debug'](_0xc616('0xbe'),_0x9fa353,_0x540381,'entity\x20found',JSON[_0xc616('0x21')](_0x457017));if(_0x138b54[_0xc616('0x87')][_0xc616('0x9a')]===_0xc616('0xbf')){return _0x4af228[_0xc616('0x28')](_0x540381)['set'](_0xc616('0xc0'),'text/xml')[_0xc616('0x3a')](_0xc616('0xc1'));}else{return _0x4af228[_0xc616('0x28')](_0x540381)[_0xc616('0x2a')](_0x457017);}}});})['catch'](handleError(_0x4af228,null));};exports['send']=function(_0x13ae84,_0x4ffffa,_0x2355de){var _0x161db2,_0x43e2ec,_0x13968d;if(_[_0xc616('0xa2')](_0x13ae84[_0xc616('0x60')]['body'])||_0x13ae84[_0xc616('0x60')][_0xc616('0x60')]===''){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc616('0xa2')](_0x13ae84[_0xc616('0x60')]['to'])){throw new db['Sequelize'][(_0xc616('0x93'))]('to\x20is\x20mandatory');}_0x161db2=_0x13ae84[_0xc616('0x60')]['to'];return db[_0xc616('0x3d')][_0xc616('0x57')]({'where':{'id':_0x13ae84[_0xc616('0x53')]['id']},'include':[{'model':db[_0xc616('0xa9')],'as':'List','include':[{'model':db[_0xc616('0x91')],'as':_0xc616('0xaa'),'where':{'mobile':_0x161db2},'limit':0x1,'order':[[_0xc616('0x96'),_0xc616('0xc2')]]}]}]})[_0xc616('0x1d')](handleEntityNotFound(_0x4ffffa,null))[_0xc616('0x1d')](function(_0xff9f28){if(_0xff9f28&&_0xff9f28[_0xc616('0xc3')]){_0x43e2ec=_0xff9f28['get']({'plain':!![]});if(_0x43e2ec[_0xc616('0xc3')]&&_0x43e2ec['List'][_0xc616('0xaa')][_0xc616('0x56')]){return _0x43e2ec[_0xc616('0xc3')][_0xc616('0xaa')][0x0];}return db[_0xc616('0x91')]['create'](_[_0xc616('0x17')](_0x13ae84[_0xc616('0x60')],{'firstName':_0x161db2,'mobile':_0x161db2,'phone':_0x161db2,'ListId':_0x43e2ec[_0xc616('0x98')]}));}})[_0xc616('0x1d')](handleEntityNotFound(_0x4ffffa,null))[_0xc616('0x1d')](function(_0x47f0fc){if(_0x47f0fc){_0x13968d=_0x47f0fc;return db['WhatsappInteraction'][_0xc616('0x57')]({'where':{'ContactId':_0x13968d['id'],'closed':![],'WhatsappAccountId':_0x43e2ec['id']}})['then'](function(_0xd30c03){if(_0xd30c03){return[_0xd30c03,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x13ae84[_0xc616('0x5b')]['id'],'ContactId':_0x13968d['id'],'WhatsappAccountId':_0x43e2ec['id'],'phone':_0x161db2,'firstMsgDirection':_0xc616('0xc4'),'Messages':[_[_0xc616('0x49')](_0x13ae84['body'],{'read':![],'body':_0x13ae84[_0xc616('0x60')][_0xc616('0x60')],'phone':_0x161db2,'WhatsappAccountId':_0x43e2ec['id'],'UserId':_0x13ae84[_0xc616('0x5b')]['id'],'ContactId':_0x13968d['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x411bfc){return[_0x411bfc,!![]];});});}})[_0xc616('0x72')](function(_0x998f71,_0x234147){if(_0x234147){return _0x998f71;}return db[_0xc616('0x8b')][_0xc616('0x58')](_[_0xc616('0x49')](_0x13ae84[_0xc616('0x60')],{'read':![],'body':_0x13ae84[_0xc616('0x60')][_0xc616('0x60')],'phone':_0x161db2,'WhatsappAccountId':_0x43e2ec['id'],'WhatsappInteractionId':_0x998f71['id'],'UserId':_0x13ae84[_0xc616('0x5b')]['id'],'ContactId':_0x13968d['id']}))['then'](function(_0x49aa10){_0x998f71[_0xc616('0xc5')][_0xc616('0xc6')]=[];_0x998f71[_0xc616('0xc5')][_0xc616('0xc6')][_0xc616('0xb0')](_0x49aa10['dataValues']);return _0x998f71;});})[_0xc616('0x1d')](respondWithResult(_0x4ffffa,null))[_0xc616('0x26')](handleError(_0x4ffffa,null));}; \ No newline at end of file +var _0x690a=['CompanyId','ListId','mobile','twilio','From','replace','Body','messageId','MessageSid','from','notifications','isNil','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','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','applications','unmanaged','*,*,*,*','created','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','WhatsappAccount','include','findAll','rows','show','params','Pause','attributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','mandatoryDispositionPause','describe','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','stack','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','message_id','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt'];(function(_0x5962c4,_0x12ea35){var _0x15cb9d=function(_0xc46a1){while(--_0xc46a1){_0x5962c4['push'](_0x5962c4['shift']());}};_0x15cb9d(++_0x12ea35);}(_0x690a,0xfa));var _0xa690=function(_0x4d6963,_0x3a1dd8){_0x4d6963=_0x4d6963-0x0;var _0xdc3e1c=_0x690a[_0x4d6963];return _0xdc3e1c;};'use strict';var emlformat=require(_0xa690('0x0'));var rimraf=require(_0xa690('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa690('0x2'));var rp=require(_0xa690('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa690('0x4'));var path=require(_0xa690('0x5'));var sox=require(_0xa690('0x6'));var csv=require(_0xa690('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa690('0x8'));var _=require(_0xa690('0x9'));var squel=require(_0xa690('0xa'));var crypto=require(_0xa690('0xb'));var jsforce=require(_0xa690('0xc'));var deskjs=require(_0xa690('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa690('0xe'));var Papa=require(_0xa690('0xf'));var Redis=require(_0xa690('0x10'));var authService=require(_0xa690('0x11'));var qs=require(_0xa690('0x12'));var as=require(_0xa690('0x13'));var hardwareService=require(_0xa690('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa690('0x15'));var config=require(_0xa690('0x16'));var licenseUtil=require(_0xa690('0x17'));var db=require(_0xa690('0x18'))['db'];config[_0xa690('0x19')]=_[_0xa690('0x1a')](config[_0xa690('0x19')],{'host':_0xa690('0x1b'),'port':0x18eb});var socket=require(_0xa690('0x1c'))(new Redis(config[_0xa690('0x19')]));require(_0xa690('0x1d'))[_0xa690('0x1e')](socket);var jayson=require(_0xa690('0x1f'));var client=jayson[_0xa690('0x20')][_0xa690('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x5a45e2,_0x4945fd,_0x5afa1a,_0x2de817){return new BPromise(function(_0x13d10d,_0x1c8d40){var _0x15e90f=_0x2de817||client;return _0x15e90f[_0xa690('0x22')](_0x5a45e2,_0x5afa1a)[_0xa690('0x23')](function(_0x769d2f){logger[_0xa690('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x4945fd,'request\x20sent');logger[_0xa690('0x25')](_0xa690('0x26'),_0x4945fd,_0xa690('0x27'),JSON[_0xa690('0x28')](_0x769d2f));if(_0x769d2f['error']){if(_0x769d2f[_0xa690('0x29')][_0xa690('0x2a')]===0x1f4){logger[_0xa690('0x29')](_0xa690('0x2b'),_0x4945fd,_0x769d2f['error'][_0xa690('0x2c')]);return _0x1c8d40(_0x769d2f['error']['message']);}logger[_0xa690('0x29')](_0xa690('0x2b'),_0x4945fd,_0x769d2f[_0xa690('0x29')][_0xa690('0x2c')]);return _0x13d10d(_0x769d2f[_0xa690('0x29')][_0xa690('0x2c')]);}else{logger[_0xa690('0x24')](_0xa690('0x2b'),_0x4945fd,_0xa690('0x27'));_0x13d10d(_0x769d2f['result']['message']);}})[_0xa690('0x2d')](function(_0x4f8f59){logger[_0xa690('0x29')](_0xa690('0x2b'),_0x4945fd,_0x4f8f59);_0x1c8d40(_0x4f8f59);});});}function respondWithStatusCode(_0x2578af,_0x23e12c){_0x23e12c=_0x23e12c||0xcc;return function(_0x1a654a){if(_0x1a654a){return _0x2578af[_0xa690('0x2e')](_0x23e12c);}return _0x2578af[_0xa690('0x2f')](_0x23e12c)[_0xa690('0x30')]();};}function respondWithResult(_0x3dbf81,_0x4c6082){_0x4c6082=_0x4c6082||0xc8;return function(_0x2bc683){if(_0x2bc683){return _0x3dbf81[_0xa690('0x2f')](_0x4c6082)[_0xa690('0x31')](_0x2bc683);}};}function respondWithFilteredResult(_0x212335,_0x50b25e){return function(_0x46dcea){if(_0x46dcea){var _0x55a840=typeof _0x50b25e['offset']===_0xa690('0x32')&&typeof _0x50b25e[_0xa690('0x33')]===_0xa690('0x32');var _0x5437c3=_0x46dcea[_0xa690('0x34')];var _0x3c079d=_0x55a840?0x0:_0x50b25e[_0xa690('0x35')];var _0x27cb22=_0x55a840?_0x46dcea['count']:_0x50b25e[_0xa690('0x35')]+_0x50b25e[_0xa690('0x33')];var _0x2cdeef;if(_0x27cb22>=_0x5437c3){_0x27cb22=_0x5437c3;_0x2cdeef=0xc8;}else{_0x2cdeef=0xce;}_0x212335[_0xa690('0x2f')](_0x2cdeef);return _0x212335[_0xa690('0x36')](_0xa690('0x37'),_0x3c079d+'-'+_0x27cb22+'/'+_0x5437c3)[_0xa690('0x31')](_0x46dcea);}return null;};}function patchUpdates(_0x180d07){return function(_0xd3a6f9){try{jsonpatch[_0xa690('0x38')](_0xd3a6f9,_0x180d07,!![]);}catch(_0x16a80b){return BPromise[_0xa690('0x39')](_0x16a80b);}return _0xd3a6f9[_0xa690('0x3a')]();};}function saveUpdates(_0x162a1c,_0xb37dca){return function(_0x54d2be){if(_0x54d2be){return _0x54d2be['update'](_0x162a1c)[_0xa690('0x23')](function(_0x368e76){return _0x368e76;});}return null;};}function removeEntity(_0xbc9c46,_0x19de69){return function(_0x348197){if(_0x348197){return _0x348197[_0xa690('0x3b')]()[_0xa690('0x23')](function(){var _0xe746fe=_0x348197[_0xa690('0x3c')]({'plain':!![]});var _0x3cbed5=_0xa690('0x3d');return db[_0xa690('0x3e')][_0xa690('0x3b')]({'where':{'type':_0x3cbed5,'resourceId':_0xe746fe['id']}})[_0xa690('0x23')](function(){return _0x348197;});})['then'](function(){_0xbc9c46[_0xa690('0x2f')](0xcc)[_0xa690('0x30')]();});}};}function handleEntityNotFound(_0x1d54bb,_0x72ce04){return function(_0x4eb293){if(!_0x4eb293){_0x1d54bb[_0xa690('0x2e')](0x194);}return _0x4eb293;};}function handleError(_0x2570c4,_0x22afa9){_0x22afa9=_0x22afa9||0x1f4;return function(_0x2bb815){logger[_0xa690('0x29')](_0x2bb815['stack']);if(_0x2bb815[_0xa690('0x3f')]){delete _0x2bb815[_0xa690('0x3f')];}_0x2570c4[_0xa690('0x2f')](_0x22afa9)[_0xa690('0x40')](_0x2bb815);};}exports[_0xa690('0x41')]=function(_0x282f10,_0xa07540){var _0x82a1a8={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x123897={},_0x4411c8={'count':0x0,'rows':[]};var _0x3c1a39=_[_0xa690('0x42')](db['WhatsappAccount'][_0xa690('0x43')],function(_0x265caf){return{'name':_0x265caf[_0xa690('0x44')],'type':_0x265caf[_0xa690('0x45')][_0xa690('0x46')]};});_0x123897[_0xa690('0x47')]=_[_0xa690('0x42')](_0x3c1a39,'name');_0x123897[_0xa690('0x48')]=_[_0xa690('0x49')](_0x282f10[_0xa690('0x48')]);_0x123897[_0xa690('0x4a')]=_['intersection'](_0x123897['model'],_0x123897['query']);_0x82a1a8['attributes']=_[_0xa690('0x4b')](_0x123897[_0xa690('0x47')],qs[_0xa690('0x4c')](_0x282f10['query'][_0xa690('0x4c')]));_0x82a1a8['attributes']=_0x82a1a8['attributes'][_0xa690('0x4d')]?_0x82a1a8['attributes']:_0x123897[_0xa690('0x47')];if(!_0x282f10[_0xa690('0x48')][_0xa690('0x4e')](_0xa690('0x4f'))){_0x82a1a8[_0xa690('0x33')]=qs[_0xa690('0x33')](_0x282f10[_0xa690('0x48')]['limit']);_0x82a1a8[_0xa690('0x35')]=qs[_0xa690('0x35')](_0x282f10[_0xa690('0x48')][_0xa690('0x35')]);}_0x82a1a8[_0xa690('0x50')]=qs['sort'](_0x282f10[_0xa690('0x48')][_0xa690('0x51')]);_0x82a1a8['where']=qs[_0xa690('0x4a')](_['pick'](_0x282f10[_0xa690('0x48')],_0x123897[_0xa690('0x4a')]),_0x3c1a39);if(_0x282f10['query'][_0xa690('0x52')]){_0x82a1a8[_0xa690('0x53')]=_['merge'](_0x82a1a8[_0xa690('0x53')],{'$or':_[_0xa690('0x42')](_0x3c1a39,function(_0x3f62ac){if(_0x3f62ac['type']!==_0xa690('0x54')){var _0x561c57={};_0x561c57[_0x3f62ac['name']]={'$like':'%'+_0x282f10[_0xa690('0x48')][_0xa690('0x52')]+'%'};return _0x561c57;}})});}_0x82a1a8=_[_0xa690('0x55')]({},_0x82a1a8,_0x282f10[_0xa690('0x56')]);var _0xfdef74={'where':_0x82a1a8['where']};return db[_0xa690('0x57')][_0xa690('0x34')](_0xfdef74)[_0xa690('0x23')](function(_0x2bc229){_0x4411c8[_0xa690('0x34')]=_0x2bc229;if(_0x282f10[_0xa690('0x48')]['includeAll']){_0x82a1a8[_0xa690('0x58')]=[{'all':!![]}];}return db[_0xa690('0x57')][_0xa690('0x59')](_0x82a1a8);})[_0xa690('0x23')](function(_0x5d7dc5){_0x4411c8[_0xa690('0x5a')]=_0x5d7dc5;return _0x4411c8;})['then'](respondWithFilteredResult(_0xa07540,_0x82a1a8))[_0xa690('0x2d')](handleError(_0xa07540,null));};exports[_0xa690('0x5b')]=function(_0x11dea4,_0x567cb1){var _0x45f680={'raw':![],'where':{'id':_0x11dea4[_0xa690('0x5c')]['id']},'include':[{'model':db[_0xa690('0x5d')],'as':'mandatoryDispositionPause'}]},_0x295e82={};_0x295e82[_0xa690('0x47')]=_['keys'](db[_0xa690('0x57')][_0xa690('0x43')]);_0x295e82[_0xa690('0x48')]=_['keys'](_0x11dea4[_0xa690('0x48')]);_0x295e82[_0xa690('0x4a')]=_[_0xa690('0x4b')](_0x295e82[_0xa690('0x47')],_0x295e82[_0xa690('0x48')]);_0x45f680[_0xa690('0x5e')]=_['intersection'](_0x295e82['model'],qs[_0xa690('0x4c')](_0x11dea4[_0xa690('0x48')][_0xa690('0x4c')]));_0x45f680[_0xa690('0x5e')]=_0x45f680[_0xa690('0x5e')][_0xa690('0x4d')]?_0x45f680[_0xa690('0x5e')]:_0x295e82[_0xa690('0x47')];if(_0x11dea4['query'][_0xa690('0x5f')]){_0x45f680[_0xa690('0x58')]=[{'all':!![]}];}_0x45f680=_['merge']({},_0x45f680,_0x11dea4['options']);return db[_0xa690('0x57')][_0xa690('0x60')](_0x45f680)['then'](handleEntityNotFound(_0x567cb1,null))[_0xa690('0x23')](respondWithResult(_0x567cb1,null))[_0xa690('0x2d')](handleError(_0x567cb1,null));};exports[_0xa690('0x61')]=function(_0x3e8d71,_0x176370){return db[_0xa690('0x57')][_0xa690('0x61')](_0x3e8d71[_0xa690('0x62')],{})['then'](function(_0x5d8dcc){var _0x12f8e7=_0x3e8d71[_0xa690('0x63')][_0xa690('0x3c')]({'plain':!![]});if(!_0x12f8e7)throw new Error(_0xa690('0x64'));if(_0x12f8e7[_0xa690('0x65')]===_0xa690('0x63')){var _0x54d5f8=_0x5d8dcc[_0xa690('0x3c')]({'plain':!![]});var _0x13c7f6=_0xa690('0x3d');return db[_0xa690('0x66')][_0xa690('0x60')]({'where':{'name':_0x13c7f6,'userProfileId':_0x12f8e7['userProfileId']},'raw':!![]})[_0xa690('0x23')](function(_0x40d963){if(_0x40d963&&_0x40d963[_0xa690('0x67')]===0x0){return db[_0xa690('0x3e')][_0xa690('0x61')]({'name':_0x54d5f8[_0xa690('0x3f')],'resourceId':_0x54d5f8['id'],'type':_0x40d963['name'],'sectionId':_0x40d963['id']},{})['then'](function(){return _0x5d8dcc;});}else{return _0x5d8dcc;}})[_0xa690('0x2d')](function(_0x21fd7d){logger[_0xa690('0x29')](_0xa690('0x68'),_0x21fd7d);throw _0x21fd7d;});}return _0x5d8dcc;})['then'](respondWithResult(_0x176370,0xc9))[_0xa690('0x2d')](handleError(_0x176370,null));};exports[_0xa690('0x69')]=function(_0x2edea3,_0xb2364d){if(_0x2edea3[_0xa690('0x62')]['id']){delete _0x2edea3[_0xa690('0x62')]['id'];}return db[_0xa690('0x57')][_0xa690('0x60')]({'where':{'id':_0x2edea3[_0xa690('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xa690('0x6a')}]})[_0xa690('0x23')](handleEntityNotFound(_0xb2364d,null))['then'](saveUpdates(_0x2edea3[_0xa690('0x62')],null))['then'](respondWithResult(_0xb2364d,null))[_0xa690('0x2d')](handleError(_0xb2364d,null));};exports[_0xa690('0x3b')]=function(_0x2f1c9e,_0x3c1dd4){return db['WhatsappAccount']['find']({'where':{'id':_0x2f1c9e['params']['id']}})['then'](handleEntityNotFound(_0x3c1dd4,null))[_0xa690('0x23')](removeEntity(_0x3c1dd4,null))[_0xa690('0x2d')](handleError(_0x3c1dd4,null));};exports[_0xa690('0x6b')]=function(_0x54a151,_0xa00366){return db[_0xa690('0x57')][_0xa690('0x6b')]()[_0xa690('0x23')](respondWithResult(_0xa00366,null))['catch'](handleError(_0xa00366,null));};exports['addDisposition']=function(_0x4cdada,_0x22a411,_0x27127b){if(_0x4cdada[_0xa690('0x62')]['id']){delete _0x4cdada[_0xa690('0x62')]['id'];}return db[_0xa690('0x57')]['find']({'where':{'id':_0x4cdada['params']['id']}})[_0xa690('0x23')](handleEntityNotFound(_0x22a411,null))[_0xa690('0x23')](function(_0x23d46f){if(_0x23d46f){_0x4cdada[_0xa690('0x62')][_0xa690('0x6c')]=_0x23d46f['id'];return db[_0xa690('0x6d')][_0xa690('0x61')](_0x4cdada[_0xa690('0x62')]);}})[_0xa690('0x23')](respondWithResult(_0x22a411,null))[_0xa690('0x2d')](handleError(_0x22a411,null));};exports[_0xa690('0x6e')]=function(_0x51fe1e,_0x380658,_0x5bd288){var _0xaf87a0={'raw':![],'where':{}};var _0x287f5a={};var _0x34cf2e={'count':0x0,'rows':[]};return db[_0xa690('0x57')][_0xa690('0x6f')]({'where':{'id':_0x51fe1e[_0xa690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x380658,null))[_0xa690('0x23')](function(_0x3384e6){if(_0x3384e6){_0x287f5a[_0xa690('0x47')]=_['keys'](db[_0xa690('0x6d')]['rawAttributes']);_0x287f5a[_0xa690('0x48')]=_[_0xa690('0x49')](_0x51fe1e[_0xa690('0x48')]);_0x287f5a[_0xa690('0x4a')]=_[_0xa690('0x4b')](_0x287f5a['model'],_0x287f5a[_0xa690('0x48')]);_0xaf87a0[_0xa690('0x5e')]=_['intersection'](_0x287f5a['model'],qs[_0xa690('0x4c')](_0x51fe1e['query'][_0xa690('0x4c')]));_0xaf87a0['attributes']=_0xaf87a0[_0xa690('0x5e')][_0xa690('0x4d')]?_0xaf87a0[_0xa690('0x5e')]:_0x287f5a[_0xa690('0x47')];if(!_0x51fe1e[_0xa690('0x48')][_0xa690('0x4e')](_0xa690('0x4f'))){_0xaf87a0[_0xa690('0x33')]=qs[_0xa690('0x33')](_0x51fe1e['query'][_0xa690('0x33')]);_0xaf87a0[_0xa690('0x35')]=qs['offset'](_0x51fe1e[_0xa690('0x48')][_0xa690('0x35')]);}_0xaf87a0[_0xa690('0x50')]=qs[_0xa690('0x51')](_0x51fe1e[_0xa690('0x48')][_0xa690('0x51')]);_0xaf87a0[_0xa690('0x53')]=qs[_0xa690('0x4a')](_['pick'](_0x51fe1e[_0xa690('0x48')],_0x287f5a[_0xa690('0x4a')]));_0xaf87a0[_0xa690('0x53')]['WhatsappAccountId']=_0x3384e6['id'];if(_0x51fe1e[_0xa690('0x48')][_0xa690('0x52')]){_0xaf87a0['where']=_['merge'](_0xaf87a0[_0xa690('0x53')],{'$or':_[_0xa690('0x42')](_0xaf87a0[_0xa690('0x5e')],function(_0x157a54){var _0x449f1b={};_0x449f1b[_0x157a54]={'$like':'%'+_0x51fe1e[_0xa690('0x48')][_0xa690('0x52')]+'%'};return _0x449f1b;})});}_0xaf87a0=_[_0xa690('0x55')]({},_0xaf87a0,_0x51fe1e[_0xa690('0x56')]);return db[_0xa690('0x6d')][_0xa690('0x34')]({'where':_0xaf87a0[_0xa690('0x53')]})[_0xa690('0x23')](function(_0x31b2f0){_0x34cf2e['count']=_0x31b2f0;if(_0x51fe1e[_0xa690('0x48')]['includeAll']){_0xaf87a0[_0xa690('0x58')]=[{'all':!![]}];}return db[_0xa690('0x6d')][_0xa690('0x59')](_0xaf87a0);})[_0xa690('0x23')](function(_0xac1aa4){_0x34cf2e['rows']=_0xac1aa4;return _0x34cf2e;});}})[_0xa690('0x23')](respondWithFilteredResult(_0x380658,_0xaf87a0))[_0xa690('0x2d')](handleError(_0x380658,null));};exports[_0xa690('0x70')]=function(_0x500810,_0x56cc12,_0x2e3bff){return db['WhatsappAccount'][_0xa690('0x60')]({'where':{'id':_0x500810[_0xa690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x56cc12,null))[_0xa690('0x23')](function(_0x43bb5d){if(_0x43bb5d){return _0x43bb5d[_0xa690('0x70')](_0x500810[_0xa690('0x48')][_0xa690('0x71')]);}})[_0xa690('0x23')](respondWithStatusCode(_0x56cc12,null))[_0xa690('0x2d')](handleError(_0x56cc12,null));};exports[_0xa690('0x72')]=function(_0x1d6217,_0x60399a,_0x14aba4){if(_0x1d6217[_0xa690('0x62')]['id']){delete _0x1d6217[_0xa690('0x62')]['id'];}return db['WhatsappAccount'][_0xa690('0x60')]({'where':{'id':_0x1d6217[_0xa690('0x5c')]['id']}})[_0xa690('0x23')](handleEntityNotFound(_0x60399a,null))['then'](function(_0x259422){if(_0x259422){_0x1d6217[_0xa690('0x62')][_0xa690('0x6c')]=_0x259422['id'];return db[_0xa690('0x73')][_0xa690('0x61')](_0x1d6217[_0xa690('0x62')]);}})[_0xa690('0x23')](respondWithResult(_0x60399a,null))[_0xa690('0x2d')](handleError(_0x60399a,null));};exports[_0xa690('0x74')]=function(_0x4b4915,_0x2a4fde,_0x2fe250){var _0x2ee376={'raw':![],'where':{}};var _0x4cebf4={};var _0x1feac2={'count':0x0,'rows':[]};return db[_0xa690('0x57')][_0xa690('0x6f')]({'where':{'id':_0x4b4915['params']['id']}})[_0xa690('0x23')](handleEntityNotFound(_0x2a4fde,null))[_0xa690('0x23')](function(_0x177326){if(_0x177326){_0x4cebf4[_0xa690('0x47')]=_[_0xa690('0x49')](db['CannedAnswer'][_0xa690('0x43')]);_0x4cebf4[_0xa690('0x48')]=_[_0xa690('0x49')](_0x4b4915[_0xa690('0x48')]);_0x4cebf4[_0xa690('0x4a')]=_[_0xa690('0x4b')](_0x4cebf4['model'],_0x4cebf4[_0xa690('0x48')]);_0x2ee376[_0xa690('0x5e')]=_[_0xa690('0x4b')](_0x4cebf4[_0xa690('0x47')],qs['fields'](_0x4b4915[_0xa690('0x48')][_0xa690('0x4c')]));_0x2ee376[_0xa690('0x5e')]=_0x2ee376[_0xa690('0x5e')][_0xa690('0x4d')]?_0x2ee376[_0xa690('0x5e')]:_0x4cebf4[_0xa690('0x47')];if(!_0x4b4915[_0xa690('0x48')]['hasOwnProperty'](_0xa690('0x4f'))){_0x2ee376['limit']=qs[_0xa690('0x33')](_0x4b4915[_0xa690('0x48')][_0xa690('0x33')]);_0x2ee376[_0xa690('0x35')]=qs[_0xa690('0x35')](_0x4b4915['query']['offset']);}_0x2ee376[_0xa690('0x50')]=qs[_0xa690('0x51')](_0x4b4915[_0xa690('0x48')][_0xa690('0x51')]);_0x2ee376[_0xa690('0x53')]=qs['filters'](_[_0xa690('0x75')](_0x4b4915['query'],_0x4cebf4['filters']));_0x2ee376[_0xa690('0x53')]['WhatsappAccountId']=_0x177326['id'];if(_0x4b4915[_0xa690('0x48')][_0xa690('0x52')]){_0x2ee376[_0xa690('0x53')]=_[_0xa690('0x55')](_0x2ee376[_0xa690('0x53')],{'$or':_[_0xa690('0x42')](_0x2ee376[_0xa690('0x5e')],function(_0x15eb22){var _0x1075d5={};_0x1075d5[_0x15eb22]={'$like':'%'+_0x4b4915[_0xa690('0x48')][_0xa690('0x52')]+'%'};return _0x1075d5;})});}_0x2ee376=_[_0xa690('0x55')]({},_0x2ee376,_0x4b4915[_0xa690('0x56')]);return db['CannedAnswer']['count']({'where':_0x2ee376[_0xa690('0x53')]})[_0xa690('0x23')](function(_0x5c9224){_0x1feac2[_0xa690('0x34')]=_0x5c9224;if(_0x4b4915['query']['includeAll']){_0x2ee376[_0xa690('0x58')]=[{'all':!![]}];}return db[_0xa690('0x73')][_0xa690('0x59')](_0x2ee376);})[_0xa690('0x23')](function(_0x2df51b){_0x1feac2[_0xa690('0x5a')]=_0x2df51b;return _0x1feac2;});}})['then'](respondWithFilteredResult(_0x2a4fde,_0x2ee376))[_0xa690('0x2d')](handleError(_0x2a4fde,null));};exports['removeAnswers']=function(_0xbd9465,_0x504b33,_0x4ce522){return db[_0xa690('0x57')][_0xa690('0x60')]({'where':{'id':_0xbd9465[_0xa690('0x5c')]['id']}})[_0xa690('0x23')](handleEntityNotFound(_0x504b33,null))['then'](function(_0x2a27ea){if(_0x2a27ea){return _0x2a27ea[_0xa690('0x76')](_0xbd9465[_0xa690('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x504b33,null))[_0xa690('0x2d')](handleError(_0x504b33,null));};exports[_0xa690('0x77')]=function(_0x3ef802,_0x515da9,_0x3440ee){return db['WhatsappAccount'][_0xa690('0x60')]({'where':{'id':_0x3ef802[_0xa690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x515da9,null))[_0xa690('0x23')](function(_0x4e170a){if(_0x4e170a){return _0x4e170a[_0xa690('0x77')](_0x3ef802[_0xa690('0x62')][_0xa690('0x71')],_[_0xa690('0x78')](_0x3ef802[_0xa690('0x62')],[_0xa690('0x71'),'id'])||{})[_0xa690('0x79')](function(_0x3f9228){for(var _0x3c1223=0x0;_0x3c1223<_0x3ef802[_0xa690('0x62')][_0xa690('0x71')]['length'];_0x3c1223+=0x1){socket[_0xa690('0x7a')](_0xa690('0x7b'),{'UserId':Number(_0x3ef802[_0xa690('0x62')][_0xa690('0x71')][_0x3c1223]),'WhatsappAccountId':Number(_0x3ef802[_0xa690('0x5c')]['id'])});}return _0x3f9228;});}})[_0xa690('0x23')](respondWithResult(_0x515da9,null))[_0xa690('0x2d')](handleError(_0x515da9,null));};exports[_0xa690('0x7c')]=function(_0x53654e,_0x48ab05,_0x8e9b3b){return db[_0xa690('0x57')][_0xa690('0x60')]({'where':{'id':_0x53654e[_0xa690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x48ab05,null))['then'](function(_0x5c7250){if(_0x5c7250){return _0x5c7250[_0xa690('0x7c')](_0x53654e[_0xa690('0x48')][_0xa690('0x71')])[_0xa690('0x23')](function(){if(_[_0xa690('0x7d')](_0x53654e[_0xa690('0x48')][_0xa690('0x71')])){for(var _0x416fef=0x0;_0x416fef<_0x53654e[_0xa690('0x48')][_0xa690('0x71')]['length'];_0x416fef+=0x1){socket[_0xa690('0x7a')](_0xa690('0x7e'),{'UserId':Number(_0x53654e[_0xa690('0x48')]['ids'][_0x416fef]),'WhatsappAccountId':Number(_0x53654e['params']['id'])});}}else{socket['emit'](_0xa690('0x7e'),{'UserId':Number(_0x53654e[_0xa690('0x48')][_0xa690('0x71')]),'WhatsappAccountId':Number(_0x53654e[_0xa690('0x5c')]['id'])});}});}})[_0xa690('0x23')](respondWithStatusCode(_0x48ab05,null))[_0xa690('0x2d')](handleError(_0x48ab05,null));};exports['getAgents']=function(_0x5492d9,_0x18165e,_0xcaa364){var _0x4f0d38={};var _0x6bae96={};var _0x4ef669;var _0x45ca32;return db[_0xa690('0x57')][_0xa690('0x6f')]({'where':{'id':_0x5492d9['params']['id']}})[_0xa690('0x23')](handleEntityNotFound(_0x18165e,null))[_0xa690('0x23')](function(_0x2dd16e){if(_0x2dd16e){_0x4ef669=_0x2dd16e;_0x6bae96[_0xa690('0x47')]=_[_0xa690('0x49')](db[_0xa690('0x7f')][_0xa690('0x43')]);_0x6bae96[_0xa690('0x48')]=_[_0xa690('0x49')](_0x5492d9[_0xa690('0x48')]);_0x6bae96[_0xa690('0x4a')]=_['intersection'](_0x6bae96[_0xa690('0x47')],_0x6bae96[_0xa690('0x48')]);_0x4f0d38[_0xa690('0x5e')]=_[_0xa690('0x4b')](_0x6bae96[_0xa690('0x47')],qs['fields'](_0x5492d9[_0xa690('0x48')]['fields']));_0x4f0d38[_0xa690('0x5e')]=_0x4f0d38['attributes'][_0xa690('0x4d')]?_0x4f0d38[_0xa690('0x5e')]:_0x6bae96[_0xa690('0x47')];_0x4f0d38[_0xa690('0x50')]=qs[_0xa690('0x51')](_0x5492d9[_0xa690('0x48')][_0xa690('0x51')]);_0x4f0d38['where']=qs[_0xa690('0x4a')](_[_0xa690('0x75')](_0x5492d9['query'],_0x6bae96[_0xa690('0x4a')]));if(_0x5492d9[_0xa690('0x48')][_0xa690('0x52')]){_0x4f0d38[_0xa690('0x53')]=_['merge'](_0x4f0d38[_0xa690('0x53')],{'$or':_[_0xa690('0x42')](_0x4f0d38[_0xa690('0x5e')],function(_0x5c72a3){var _0x3b8e25={};_0x3b8e25[_0x5c72a3]={'$like':'%'+_0x5492d9[_0xa690('0x48')]['filter']+'%'};return _0x3b8e25;})});}_0x4f0d38=_[_0xa690('0x55')]({},_0x4f0d38,_0x5492d9[_0xa690('0x56')]);return _0x4ef669[_0xa690('0x80')](_0x4f0d38);}})[_0xa690('0x23')](function(_0x235b84){if(_0x235b84){_0x45ca32=_0x235b84['length'];if(!_0x5492d9[_0xa690('0x48')][_0xa690('0x4e')](_0xa690('0x4f'))){_0x4f0d38[_0xa690('0x33')]=qs[_0xa690('0x33')](_0x5492d9[_0xa690('0x48')][_0xa690('0x33')]);_0x4f0d38[_0xa690('0x35')]=qs[_0xa690('0x35')](_0x5492d9[_0xa690('0x48')][_0xa690('0x35')]);}return _0x4ef669[_0xa690('0x80')](_0x4f0d38);}})[_0xa690('0x23')](function(_0x4c39b9){if(_0x4c39b9){return _0x4c39b9?{'count':_0x45ca32,'rows':_0x4c39b9}:null;}})[_0xa690('0x23')](respondWithResult(_0x18165e,null))[_0xa690('0x2d')](handleError(_0x18165e,null));};exports[_0xa690('0x81')]=function(_0x44c3e3,_0x313bd9){var _0x5be526=_0x44c3e3[_0xa690('0x5c')]['id'];var _0x3125e8=_0x44c3e3[_0xa690('0x62')];var _0x395d37=0xc8;var _0x2e63fe=null;return db['sequelize'][_0xa690('0x82')]({'isolationLevel':db[_0xa690('0x83')][_0xa690('0x84')]['ISOLATION_LEVELS'][_0xa690('0x85')]},function(_0x1b0de2){return db[_0xa690('0x57')][_0xa690('0x6f')]({'where':{'id':_0x5be526},'transaction':_0x1b0de2})['then'](function(_0x257eb9){if(_0x257eb9){return db['WhatsappApplication'][_0xa690('0x3b')]({'where':{'WhatsappAccountId':_0x5be526},'transaction':_0x1b0de2})[_0xa690('0x23')](function(){var _0x38b482=_[_0xa690('0x42')](_0x3125e8,function(_0x287d2c){_0x287d2c[_0xa690('0x6c')]=_0x5be526;return _0x287d2c;});return db[_0xa690('0x86')]['bulkCreate'](_0x38b482,{'transaction':_0x1b0de2});});}else{_0x395d37=0x194;_0x2e63fe=[];}});})[_0xa690('0x23')](function(){if(_0x395d37!==0x194){return db[_0xa690('0x86')][_0xa690('0x87')]({'where':{'WhatsappAccountId':_0x5be526},'order':'priority'})['then'](function(_0xc462e4){_0x2e63fe=_0xc462e4;});}})[_0xa690('0x2d')](function(_0x40771a){_0x395d37=0x1f4;logger[_0xa690('0x29')](_0x40771a[_0xa690('0x88')]);if(_0x40771a[_0xa690('0x3f')]){delete _0x40771a['name'];}_0x2e63fe=_0x40771a;})[_0xa690('0x89')](function(){if(_0x2e63fe===null){_0x313bd9[_0xa690('0x2e')](_0x395d37);}else{if(_0x395d37===0x1f4){_0x313bd9[_0xa690('0x2f')](_0x395d37)[_0xa690('0x40')](_0x2e63fe);}else{_0x313bd9[_0xa690('0x2f')](_0x395d37)[_0xa690('0x31')](_0x2e63fe);}}});};exports[_0xa690('0x8a')]=function(_0x2c098d,_0x300a81,_0x5c7244){var _0x3daba2={};var _0x365e03={};var _0x39d5b5;var _0x3df952;return db[_0xa690('0x57')]['findOne']({'where':{'id':_0x2c098d[_0xa690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x300a81,null))['then'](function(_0x25b00f){if(_0x25b00f){_0x39d5b5=_0x25b00f;_0x365e03[_0xa690('0x47')]=_[_0xa690('0x49')](db['WhatsappApplication'][_0xa690('0x43')]);_0x365e03['query']=_[_0xa690('0x49')](_0x2c098d[_0xa690('0x48')]);_0x365e03[_0xa690('0x4a')]=_[_0xa690('0x4b')](_0x365e03['model'],_0x365e03[_0xa690('0x48')]);_0x3daba2[_0xa690('0x5e')]=_[_0xa690('0x4b')](_0x365e03[_0xa690('0x47')],qs[_0xa690('0x4c')](_0x2c098d[_0xa690('0x48')]['fields']));_0x3daba2[_0xa690('0x5e')]=_0x3daba2[_0xa690('0x5e')][_0xa690('0x4d')]?_0x3daba2['attributes']:_0x365e03[_0xa690('0x47')];_0x3daba2[_0xa690('0x50')]=qs[_0xa690('0x51')](_0x2c098d[_0xa690('0x48')][_0xa690('0x51')]);_0x3daba2['where']=qs['filters'](_[_0xa690('0x75')](_0x2c098d[_0xa690('0x48')],_0x365e03['filters']));if(_0x2c098d[_0xa690('0x48')][_0xa690('0x52')]){_0x3daba2[_0xa690('0x53')]=_[_0xa690('0x55')](_0x3daba2['where'],{'$or':_['map'](_0x3daba2[_0xa690('0x5e')],function(_0x3f2fa1){var _0x3482be={};_0x3482be[_0x3f2fa1]={'$like':'%'+_0x2c098d[_0xa690('0x48')][_0xa690('0x52')]+'%'};return _0x3482be;})});}_0x3daba2=_[_0xa690('0x55')]({},_0x3daba2,_0x2c098d['options']);return _0x39d5b5[_0xa690('0x8a')](_0x3daba2);}})[_0xa690('0x23')](function(_0x173736){if(_0x173736){_0x3df952=_0x173736[_0xa690('0x4d')];if(!_0x2c098d[_0xa690('0x48')]['hasOwnProperty'](_0xa690('0x4f'))){_0x3daba2[_0xa690('0x33')]=qs[_0xa690('0x33')](_0x2c098d[_0xa690('0x48')]['limit']);_0x3daba2[_0xa690('0x35')]=qs[_0xa690('0x35')](_0x2c098d[_0xa690('0x48')]['offset']);}return _0x39d5b5[_0xa690('0x8a')](_0x3daba2);}})[_0xa690('0x23')](function(_0x2ffcd9){if(_0x2ffcd9){return _0x2ffcd9?{'count':_0x3df952,'rows':_0x2ffcd9}:null;}})[_0xa690('0x23')](respondWithResult(_0x300a81,null))[_0xa690('0x2d')](handleError(_0x300a81,null));};exports[_0xa690('0x8b')]=function(_0x5327da,_0x3092f7,_0x89acea){var _0x3b728b={'channel':_0xa690('0x8c')};var _0x26b111=[];var _0x12be7f=[];var _0x49f6ff={};return db[_0xa690('0x57')]['find']({'where':{'id':_0x5327da[_0xa690('0x5c')]['id']},'include':[{'model':db[_0xa690('0x86')],'as':_0xa690('0x8d')}]})['then'](handleEntityNotFound(_0x3092f7,null))[_0xa690('0x23')](function(_0x401999){_0x3b728b[_0xa690('0x8e')]=_0x401999;if(_0x3b728b[_0xa690('0x8e')]&&_0x3b728b[_0xa690('0x8e')][_0xa690('0x45')]===_0xa690('0x8f')&&_0x5327da[_0xa690('0x62')][_0xa690('0x90')]){if(_0x5327da[_0xa690('0x62')][_0xa690('0x90')][_0xa690('0x4d')]===0x0)return;if(_0x5327da['body'][_0xa690('0x90')][0x0]['state']!==_0xa690('0x91'))return;return db[_0xa690('0x92')][_0xa690('0x69')]({'read':!![],'readAt':_0x5327da[_0xa690('0x62')][_0xa690('0x90')][0x0]['timestamp']},{'where':{'messageId':_0x5327da[_0xa690('0x62')][_0xa690('0x90')][0x0][_0xa690('0x93')]},'individualHooks':!![]})[_0xa690('0x23')](function(_0x2206fb){return _0x3092f7[_0xa690('0x2f')](0xc8)[_0xa690('0x31')](_0x2206fb);});}_0x3b728b['applications']=_[_0xa690('0x94')](_0x401999[_0xa690('0x8d')],['priority'],[_0xa690('0x95')]);if(_0x3b728b[_0xa690('0x8e')]['Applications']){delete _0x3b728b['account'][_0xa690('0x8d')];}return db['CmContact'][_0xa690('0x6b')]()[_0xa690('0x23')](function(_0x11f83c){if(!_0x11f83c){throw new db[(_0xa690('0x96'))][(_0xa690('0x97'))](_0xa690('0x98'));}_0x26b111=_[_0xa690('0x99')](_[_0xa690('0x49')](_0x11f83c),[_0xa690('0x9a'),_0xa690('0x9b')]);_0x12be7f=_['difference'](_['keys'](_0x11f83c),['createdAt',_0xa690('0x9b'),_0xa690('0x9c'),_0xa690('0x9d')]);_0x3b728b['body']={'mapKey':_0xa690('0x9e')};if(_0x3b728b[_0xa690('0x8e')]&&_0x3b728b[_0xa690('0x8e')]['type']===_0xa690('0x9f')){_0x3b728b[_0xa690('0x62')]['from']=_0x5327da[_0xa690('0x62')][_0xa690('0xa0')][_0xa690('0xa1')]('whatsapp:','');_0x3b728b[_0xa690('0x62')][_0xa690('0x62')]=_0x5327da[_0xa690('0x62')][_0xa690('0xa2')];_0x3b728b[_0xa690('0x62')][_0xa690('0xa3')]=_0x5327da[_0xa690('0x62')][_0xa690('0xa4')];}if(_0x3b728b[_0xa690('0x8e')]&&_0x3b728b['account'][_0xa690('0x45')]==='sinch'){_0x3b728b[_0xa690('0x62')][_0xa690('0xa5')]=_0x5327da[_0xa690('0x62')]['notifications'][0x0][_0xa690('0xa5')];_0x3b728b['body'][_0xa690('0x62')]=_0x5327da[_0xa690('0x62')][_0xa690('0xa6')][0x0][_0xa690('0x2c')][_0xa690('0x62')];_0x3b728b[_0xa690('0x62')][_0xa690('0xa3')]=_0x5327da[_0xa690('0x62')][_0xa690('0xa6')][0x0][_0xa690('0x93')];}if(_0x3b728b[_0xa690('0x62')]['id']){delete _0x3b728b[_0xa690('0x62')]['id'];}if(_[_0xa690('0xa7')](_0x3b728b[_0xa690('0x62')][_0xa690('0xa5')])){throw new db[(_0xa690('0x96'))]['ValidationError'](_0xa690('0xa8'));}if(_[_0xa690('0xa7')](_0x3b728b[_0xa690('0x62')]['body'])||_0x3b728b[_0xa690('0x62')][_0xa690('0x62')]===''){throw new db[(_0xa690('0x96'))][(_0xa690('0x97'))](_0xa690('0xa9'));}if(_[_0xa690('0xa7')](_0x3b728b[_0xa690('0x62')]['mapKey'])){throw new db[(_0xa690('0x96'))][(_0xa690('0x97'))](_0xa690('0xaa')+_0x12be7f);}if(!_[_0xa690('0xab')](_0x12be7f,_0x3b728b[_0xa690('0x62')][_0xa690('0xac')])){throw new db[(_0xa690('0x96'))]['ValidationError'](_0xa690('0xad')+_0x12be7f);}_0x49f6ff[_0x3b728b[_0xa690('0x62')][_0xa690('0xac')]]=_0x3b728b['body'][_0xa690('0xa5')];return db['CmList'][_0xa690('0x60')]({'where':{'id':_0x3b728b[_0xa690('0x8e')]['ListId']},'include':[{'model':db[_0xa690('0xae')],'as':_0xa690('0xaf'),'where':_0x49f6ff,'limit':0x1,'order':[[_0xa690('0x9b'),_0xa690('0xb0')]]}]});})[_0xa690('0x23')](handleEntityNotFound(_0x3092f7,null))['then'](function(_0x4c589b){if(_0x4c589b){_0x3b728b[_0xa690('0xb1')]=_[_0xa690('0x78')](_0x4c589b,[_0xa690('0xaf')]);if(_0x4c589b[_0xa690('0xaf')]['length']){return _0x4c589b[_0xa690('0xaf')][0x0];}var _0x49f445=_[_0xa690('0x1a')](_0x3b728b[_0xa690('0x62')],{'firstName':_0x3b728b['body'][_0xa690('0xa5')],'ListId':_0x4c589b['id']});_0x49f445[_0x3b728b[_0xa690('0x62')]['mapKey']]=_0x3b728b[_0xa690('0x62')][_0xa690('0xa5')];return db['CmContact'][_0xa690('0x61')](_0x49f445,{'fields':_0x26b111,'raw':!![]});}})['then'](handleEntityNotFound(_0x3092f7,null))['then'](function(_0x48e99f){if(_0x48e99f){_0x3b728b[_0xa690('0xb2')]=_0x48e99f;var _0x5ed83e={'ContactId':_0x48e99f['id'],'phone':_0x3b728b[_0xa690('0x62')][_0xa690('0xa5')],'WhatsappAccountId':_0x5327da[_0xa690('0x5c')]['id']};var _0x59a52f={'ContactId':_0x48e99f['id'],'WhatsappAccountId':_0x5327da['params']['id'],'closed':![]};return db[_0xa690('0xb3')][_0xa690('0x60')]({'where':_0x59a52f})[_0xa690('0x23')](function(_0x11a27a){if(_0x11a27a){return[_0x11a27a,![]];}return db[_0xa690('0xb3')][_0xa690('0x61')](_0x5ed83e)[_0xa690('0x23')](function(_0x852603){return[_0x852603,!![]];});});}})[_0xa690('0x79')](function(_0x10c514,_0x583787){_0x3b728b['interaction']=_0x10c514['get']({'plain':!![]});_0x3b728b[_0xa690('0xb4')]['created']=![];if(_0x583787){if(_0x3b728b[_0xa690('0x8e')][_0xa690('0xb5')]){_0x3b728b['applications'][_0xa690('0xb6')]({'id':0x0,'priority':_0x3b728b[_0xa690('0xb7')][_0xa690('0x4d')]+0x1,'app':'close','appdata':_0xa690('0xb8'),'interval':_0xa690('0xb9')});}_0x3b728b['interaction'][_0xa690('0xba')]=!![];}return db[_0xa690('0x92')][_0xa690('0x61')]({'phone':_0x3b728b[_0xa690('0x62')][_0xa690('0xa5')],'messageId':_0x3b728b[_0xa690('0x62')][_0xa690('0xa3')],'body':_0x3b728b['body'][_0xa690('0x62')],'WhatsappAccountId':_0x5327da[_0xa690('0x5c')]['id'],'WhatsappInteractionId':_0x10c514['id'],'direction':'in','ContactId':_0x10c514[_0xa690('0xbb')],'AttachmentId':_0x3b728b[_0xa690('0x62')]['AttachmentId']});})['then'](function(_0x156378){_0x3b728b[_0xa690('0x2c')]=_0x156378;if(_0x3b728b[_0xa690('0xb4')]['UserId']){return db['User'][_0xa690('0x60')]({'attributes':['id',_0xa690('0x3f')],'where':{'id':_0x3b728b[_0xa690('0xb4')][_0xa690('0xbc')]}})[_0xa690('0x23')](function(_0x3b3d2c){if(_0x3b3d2c){_0x3b728b[_0xa690('0xb7')][_0xa690('0xbd')]({'id':0x0,'priority':0x0,'app':_0xa690('0xbe'),'appdata':_0x3b3d2c['name']+','+(_0x3b728b[_0xa690('0x8e')][_0xa690('0xbf')]||0xa),'interval':_0xa690('0xb9')});}return respondWithRpcPromise('Start',_0xa690('0xc0'),_0x3b728b);});}return respondWithRpcPromise('Start',_0xa690('0xc0'),_0x3b728b);})[_0xa690('0x23')](function(_0x31991c){if(_0x31991c){var _0x423e04=0xc8;var _0x2618bd='receiveMessage';logger[_0xa690('0x24')](_0xa690('0x26'),_0x2618bd,_0x423e04,'entity\x20found');logger['debug'](_0xa690('0xc1'),_0x2618bd,_0x423e04,_0xa690('0xc2'),JSON['stringify'](_0x31991c));if(_0x3b728b[_0xa690('0x8e')]['type']===_0xa690('0x9f')){return _0x3092f7['status'](_0x423e04)[_0xa690('0x36')](_0xa690('0xc3'),'text/xml')['send'](_0xa690('0xc4'));}else{return _0x3092f7[_0xa690('0x2f')](_0x423e04)[_0xa690('0x31')](_0x31991c);}}});})[_0xa690('0x2d')](handleError(_0x3092f7,null));};exports[_0xa690('0x40')]=function(_0x5e1279,_0x2ad7f6,_0x4a5ce6){var _0x5aeda2,_0x1b46ec,_0x315360;if(_[_0xa690('0xa7')](_0x5e1279[_0xa690('0x62')]['body'])||_0x5e1279[_0xa690('0x62')]['body']===''){throw new db[(_0xa690('0x96'))][(_0xa690('0x97'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa690('0xa7')](_0x5e1279[_0xa690('0x62')]['to'])){throw new db[(_0xa690('0x96'))][(_0xa690('0x97'))](_0xa690('0xc5'));}_0x5aeda2=_0x5e1279[_0xa690('0x62')]['to'];return db[_0xa690('0x57')][_0xa690('0x60')]({'where':{'id':_0x5e1279['params']['id']},'include':[{'model':db[_0xa690('0xc6')],'as':'List','include':[{'model':db[_0xa690('0xae')],'as':'Contacts','where':{'mobile':_0x5aeda2},'limit':0x1,'order':[[_0xa690('0x9b'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2ad7f6,null))[_0xa690('0x23')](function(_0x54d699){if(_0x54d699&&_0x54d699[_0xa690('0xc7')]){_0x1b46ec=_0x54d699['get']({'plain':!![]});if(_0x1b46ec[_0xa690('0xc7')]&&_0x1b46ec['List'][_0xa690('0xaf')][_0xa690('0x4d')]){return _0x1b46ec[_0xa690('0xc7')][_0xa690('0xaf')][0x0];}return db[_0xa690('0xae')][_0xa690('0x61')](_[_0xa690('0x1a')](_0x5e1279[_0xa690('0x62')],{'firstName':_0x5aeda2,'mobile':_0x5aeda2,'phone':_0x5aeda2,'ListId':_0x1b46ec['ListId']}));}})[_0xa690('0x23')](handleEntityNotFound(_0x2ad7f6,null))[_0xa690('0x23')](function(_0x5cb5d2){if(_0x5cb5d2){_0x315360=_0x5cb5d2;return db[_0xa690('0xb3')][_0xa690('0x60')]({'where':{'ContactId':_0x315360['id'],'closed':![],'WhatsappAccountId':_0x1b46ec['id']}})[_0xa690('0x23')](function(_0x30cd46){if(_0x30cd46){return[_0x30cd46,![]];}return db['WhatsappInteraction'][_0xa690('0x61')]({'UserId':_0x5e1279[_0xa690('0x63')]['id'],'ContactId':_0x315360['id'],'WhatsappAccountId':_0x1b46ec['id'],'phone':_0x5aeda2,'firstMsgDirection':_0xa690('0xc8'),'Messages':[_['merge'](_0x5e1279['body'],{'read':![],'body':_0x5e1279[_0xa690('0x62')]['body'],'phone':_0x5aeda2,'WhatsappAccountId':_0x1b46ec['id'],'UserId':_0x5e1279[_0xa690('0x63')]['id'],'ContactId':_0x315360['id']})]},{'include':[{'model':db[_0xa690('0x92')],'as':_0xa690('0xc9')}]})['then'](function(_0x168991){return[_0x168991,!![]];});});}})[_0xa690('0x79')](function(_0x4c54e1,_0x30c956){if(_0x30c956){return _0x4c54e1;}return db[_0xa690('0x92')][_0xa690('0x61')](_[_0xa690('0x55')](_0x5e1279[_0xa690('0x62')],{'read':![],'body':_0x5e1279['body']['body'],'phone':_0x5aeda2,'WhatsappAccountId':_0x1b46ec['id'],'WhatsappInteractionId':_0x4c54e1['id'],'UserId':_0x5e1279[_0xa690('0x63')]['id'],'ContactId':_0x315360['id']}))[_0xa690('0x23')](function(_0x3b8085){_0x4c54e1['dataValues'][_0xa690('0xc9')]=[];_0x4c54e1[_0xa690('0xca')]['Messages'][_0xa690('0xb6')](_0x3b8085[_0xa690('0xca')]);return _0x4c54e1;});})[_0xa690('0x23')](respondWithResult(_0x2ad7f6,null))[_0xa690('0x2d')](handleError(_0x2ad7f6,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2f9a778..b7cf61f 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 _0x6f1f=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6f1f,0x1bc));var _0xf6f1=function(_0x21be2b,_0x3db162){_0x21be2b=_0x21be2b-0x0;var _0x10932e=_0x6f1f[_0x21be2b];return _0x10932e;};'use strict';var EventEmitter=require(_0xf6f1('0x0'));var WhatsappAccount=require(_0xf6f1('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf6f1('0x2'),'afterUpdate':_0xf6f1('0x3'),'afterDestroy':_0xf6f1('0x4')};function emitEvent(_0x77df6e){return function(_0x3842af,_0x4c7485,_0x2175ce){WhatsappAccountEvents['emit'](_0x77df6e+':'+_0x3842af['id'],_0x3842af);WhatsappAccountEvents[_0xf6f1('0x5')](_0x77df6e,_0x3842af);_0x2175ce(null);};}for(var e in events){if(events[_0xf6f1('0x6')](e)){var event=events[e];WhatsappAccount[_0xf6f1('0x7')](e,emitEvent(event));}}module[_0xf6f1('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xcaac=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0xcaac,0x1a3));var _0xccaa=function(_0x429e7b,_0x5d6014){_0x429e7b=_0x429e7b-0x0;var _0xc8c707=_0xcaac[_0x429e7b];return _0xc8c707;};'use strict';var EventEmitter=require(_0xccaa('0x0'));var WhatsappAccount=require(_0xccaa('0x1'))['db'][_0xccaa('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xccaa('0x3')](0x0);var events={'afterCreate':_0xccaa('0x4'),'afterUpdate':_0xccaa('0x5'),'afterDestroy':_0xccaa('0x6')};function emitEvent(_0x28cfb1){return function(_0x4f26cb,_0x2d9efa,_0x4d7269){WhatsappAccountEvents['emit'](_0x28cfb1+':'+_0x4f26cb['id'],_0x4f26cb);WhatsappAccountEvents[_0xccaa('0x7')](_0x28cfb1,_0x4f26cb);_0x4d7269(null);};}for(var e in events){if(events[_0xccaa('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2d83826..dad5853 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 _0x8cef=['../../config/environment','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x53cc80,_0x51492a){var _0x13e14d=function(_0x3d8335){while(--_0x3d8335){_0x53cc80['push'](_0x53cc80['shift']());}};_0x13e14d(++_0x51492a);}(_0x8cef,0x142));var _0xf8ce=function(_0x27b267,_0x3eba43){_0x27b267=_0x27b267-0x0;var _0x140266=_0x8cef[_0x27b267];return _0x140266;};'use strict';var _=require(_0xf8ce('0x0'));var util=require(_0xf8ce('0x1'));var logger=require(_0xf8ce('0x2'))(_0xf8ce('0x3'));var moment=require(_0xf8ce('0x4'));var BPromise=require(_0xf8ce('0x5'));var rp=require(_0xf8ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8ce('0x7'));var config=require(_0xf8ce('0x8'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x5e7d4d,_0x29ac73){return _0x5e7d4d[_0xf8ce('0x9')]('WhatsappAccount',attributes,{'tableName':_0xf8ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00c9=['rimraf','exports','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x510fad,_0x283c39){var _0x249cc9=function(_0x5a9740){while(--_0x5a9740){_0x510fad['push'](_0x510fad['shift']());}};_0x249cc9(++_0x283c39);}(_0x00c9,0xb8));var _0x900c=function(_0x331d92,_0x3153a1){_0x331d92=_0x331d92-0x0;var _0x391d72=_0x00c9[_0x331d92];return _0x391d72;};'use strict';var _=require(_0x900c('0x0'));var util=require('util');var logger=require(_0x900c('0x1'))('api');var moment=require(_0x900c('0x2'));var BPromise=require(_0x900c('0x3'));var rp=require(_0x900c('0x4'));var fs=require('fs');var path=require(_0x900c('0x5'));var rimraf=require(_0x900c('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x900c('0x7')]=function(_0x20b596,_0x394ef9){return _0x20b596['define'](_0x900c('0x8'),attributes,{'tableName':_0x900c('0x9'),'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 9a30a7d..c9e0fce 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 _0x5e02=['attributes','include','map','model','then','debug','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','stringify','error','code','message','ShowWhatsappAccount','WhatsappAccount','find','options','where'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x5e02,0x1c7));var _0x25e0=function(_0x4d9205,_0x8e02b2){_0x4d9205=_0x4d9205-0x0;var _0x2d6e01=_0x5e02[_0x4d9205];return _0x2d6e01;};'use strict';var _=require(_0x25e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25e0('0x1'));var fs=require('fs');var Redis=require(_0x25e0('0x2'));var db=require(_0x25e0('0x3'))['db'];var utils=require(_0x25e0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x25e0('0x5'));var jayson=require(_0x25e0('0x6'));var client=jayson['client'][_0x25e0('0x7')]({'port':0x232a});config[_0x25e0('0x8')]=_[_0x25e0('0x9')](config[_0x25e0('0x8')],{'host':_0x25e0('0xa'),'port':0x18eb});var socket=require(_0x25e0('0xb'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x25e0('0xc')](socket);function respondWithRpcPromise(_0x1ddcf0,_0x26c62f,_0x42e6e3){return new BPromise(function(_0x3039e6,_0x10dc96){return client[_0x25e0('0xd')](_0x1ddcf0,_0x42e6e3)['then'](function(_0xa4beeb){logger[_0x25e0('0xe')](_0x25e0('0xf'),_0x26c62f,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x26c62f,'request\x20sent',JSON[_0x25e0('0x10')](_0xa4beeb));if(_0xa4beeb[_0x25e0('0x11')]){if(_0xa4beeb['error'][_0x25e0('0x12')]===0x1f4){logger['error'](_0x25e0('0xf'),_0x26c62f,_0xa4beeb['error'][_0x25e0('0x13')]);return _0x10dc96(_0xa4beeb['error'][_0x25e0('0x13')]);}logger['error'](_0x25e0('0xf'),_0x26c62f,_0xa4beeb[_0x25e0('0x11')][_0x25e0('0x13')]);return _0x3039e6(_0xa4beeb[_0x25e0('0x11')][_0x25e0('0x13')]);}else{logger['info'](_0x25e0('0xf'),_0x26c62f,'request\x20sent');_0x3039e6(_0xa4beeb['result'][_0x25e0('0x13')]);}})['catch'](function(_0x39c631){logger[_0x25e0('0x11')](_0x25e0('0xf'),_0x26c62f,_0x39c631);_0x10dc96(_0x39c631);});});}exports[_0x25e0('0x14')]=function(_0xff9e95){var _0x5b7add=this;return new Promise(function(_0x3cd388,_0x600dff){return db[_0x25e0('0x15')][_0x25e0('0x16')]({'raw':_0xff9e95[_0x25e0('0x17')]?_0xff9e95['options']['raw']===undefined?!![]:![]:!![],'where':_0xff9e95['options']?_0xff9e95[_0x25e0('0x17')][_0x25e0('0x18')]||null:null,'attributes':_0xff9e95[_0x25e0('0x17')]?_0xff9e95[_0x25e0('0x17')][_0x25e0('0x19')]||null:null,'include':_0xff9e95[_0x25e0('0x17')]?_0xff9e95[_0x25e0('0x17')][_0x25e0('0x1a')]?_[_0x25e0('0x1b')](_0xff9e95[_0x25e0('0x17')][_0x25e0('0x1a')],function(_0x48fdfd){return{'model':db[_0x48fdfd[_0x25e0('0x1c')]],'as':_0x48fdfd['as'],'attributes':_0x48fdfd[_0x25e0('0x19')],'include':_0x48fdfd[_0x25e0('0x1a')]?_['map'](_0x48fdfd[_0x25e0('0x1a')],function(_0x129b6e){return{'model':db[_0x129b6e[_0x25e0('0x1c')]],'as':_0x129b6e['as'],'attributes':_0x129b6e['attributes'],'include':_0x129b6e['include']?_[_0x25e0('0x1b')](_0x129b6e[_0x25e0('0x1a')],function(_0x2a0392){return{'model':db[_0x2a0392['model']],'as':_0x2a0392['as'],'attributes':_0x2a0392[_0x25e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x25e0('0x1d')](function(_0x265813){logger[_0x25e0('0xe')](_0x25e0('0x14'),_0xff9e95);logger[_0x25e0('0x1e')]('ShowWhatsappAccount',_0xff9e95,JSON[_0x25e0('0x10')](_0x265813));_0x3cd388(_0x265813);})[_0x25e0('0x1f')](function(_0x4201cd){logger['error'](_0x25e0('0x14'),_0x4201cd['message'],_0xff9e95);_0x600dff(_0x5b7add[_0x25e0('0x11')](0x1f4,_0x4201cd[_0x25e0('0x13')]));});});}; \ No newline at end of file +var _0xeb94=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','info','WhatsappAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','map','include','model','util','moment'];(function(_0x31b435,_0x23fbe2){var _0x326305=function(_0x4b0961){while(--_0x4b0961){_0x31b435['push'](_0x31b435['shift']());}};_0x326305(++_0x23fbe2);}(_0xeb94,0x1d2));var _0x4eb9=function(_0xa69733,_0x2aa122){_0xa69733=_0xa69733-0x0;var _0xca5645=_0xeb94[_0xa69733];return _0xca5645;};'use strict';var _=require('lodash');var util=require(_0x4eb9('0x0'));var moment=require(_0x4eb9('0x1'));var BPromise=require(_0x4eb9('0x2'));var rs=require(_0x4eb9('0x3'));var fs=require('fs');var Redis=require(_0x4eb9('0x4'));var db=require(_0x4eb9('0x5'))['db'];var utils=require(_0x4eb9('0x6'));var logger=require('../../config/logger')(_0x4eb9('0x7'));var config=require(_0x4eb9('0x8'));var jayson=require(_0x4eb9('0x9'));var client=jayson[_0x4eb9('0xa')][_0x4eb9('0xb')]({'port':0x232a});config[_0x4eb9('0xc')]=_[_0x4eb9('0xd')](config[_0x4eb9('0xc')],{'host':_0x4eb9('0xe'),'port':0x18eb});var socket=require(_0x4eb9('0xf'))(new Redis(config[_0x4eb9('0xc')]));require(_0x4eb9('0x10'))[_0x4eb9('0x11')](socket);function respondWithRpcPromise(_0x239fbb,_0x595ffb,_0x57eda4){return new BPromise(function(_0x467515,_0x246b34){return client['request'](_0x239fbb,_0x57eda4)['then'](function(_0xb6a808){logger[_0x4eb9('0x12')](_0x4eb9('0x13'),_0x595ffb,'request\x20sent');logger[_0x4eb9('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x595ffb,'request\x20sent',JSON[_0x4eb9('0x15')](_0xb6a808));if(_0xb6a808['error']){if(_0xb6a808[_0x4eb9('0x16')][_0x4eb9('0x17')]===0x1f4){logger[_0x4eb9('0x16')](_0x4eb9('0x13'),_0x595ffb,_0xb6a808[_0x4eb9('0x16')][_0x4eb9('0x18')]);return _0x246b34(_0xb6a808['error'][_0x4eb9('0x18')]);}logger[_0x4eb9('0x16')](_0x4eb9('0x13'),_0x595ffb,_0xb6a808[_0x4eb9('0x16')][_0x4eb9('0x18')]);return _0x467515(_0xb6a808[_0x4eb9('0x16')][_0x4eb9('0x18')]);}else{logger[_0x4eb9('0x12')](_0x4eb9('0x13'),_0x595ffb,'request\x20sent');_0x467515(_0xb6a808[_0x4eb9('0x19')][_0x4eb9('0x18')]);}})[_0x4eb9('0x1a')](function(_0x42f4e0){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x595ffb,_0x42f4e0);_0x246b34(_0x42f4e0);});});}exports[_0x4eb9('0x1b')]=function(_0x1b41d7){var _0x31e07c=this;return new Promise(function(_0x443679,_0x13631d){return db[_0x4eb9('0x1c')][_0x4eb9('0x1d')]({'raw':_0x1b41d7[_0x4eb9('0x1e')]?_0x1b41d7[_0x4eb9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1b41d7[_0x4eb9('0x1e')]?_0x1b41d7[_0x4eb9('0x1e')][_0x4eb9('0x1f')]||null:null,'attributes':_0x1b41d7['options']?_0x1b41d7[_0x4eb9('0x1e')][_0x4eb9('0x20')]||null:null,'include':_0x1b41d7[_0x4eb9('0x1e')]?_0x1b41d7[_0x4eb9('0x1e')]['include']?_[_0x4eb9('0x21')](_0x1b41d7[_0x4eb9('0x1e')][_0x4eb9('0x22')],function(_0xbf7a9e){return{'model':db[_0xbf7a9e[_0x4eb9('0x23')]],'as':_0xbf7a9e['as'],'attributes':_0xbf7a9e[_0x4eb9('0x20')],'include':_0xbf7a9e[_0x4eb9('0x22')]?_[_0x4eb9('0x21')](_0xbf7a9e[_0x4eb9('0x22')],function(_0x325b2f){return{'model':db[_0x325b2f[_0x4eb9('0x23')]],'as':_0x325b2f['as'],'attributes':_0x325b2f[_0x4eb9('0x20')],'include':_0x325b2f['include']?_[_0x4eb9('0x21')](_0x325b2f[_0x4eb9('0x22')],function(_0x4222d1){return{'model':db[_0x4222d1[_0x4eb9('0x23')]],'as':_0x4222d1['as'],'attributes':_0x4222d1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c1c1c){logger[_0x4eb9('0x12')]('ShowWhatsappAccount',_0x1b41d7);logger[_0x4eb9('0x14')](_0x4eb9('0x1b'),_0x1b41d7,JSON[_0x4eb9('0x15')](_0x1c1c1c));_0x443679(_0x1c1c1c);})[_0x4eb9('0x1a')](function(_0x5039f1){logger[_0x4eb9('0x16')](_0x4eb9('0x1b'),_0x5039f1[_0x4eb9('0x18')],_0x1b41d7);_0x13631d(_0x31e07c['error'](0x1f4,_0x5039f1['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 43bad1e..b7a2834 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 _0x90a0=['./whatsappAccount.events','save','remove','update','emit','removeListener','length','whatsappAccount:'];(function(_0x259a2e,_0x36d780){var _0x24fcb0=function(_0x4b84fd){while(--_0x4b84fd){_0x259a2e['push'](_0x259a2e['shift']());}};_0x24fcb0(++_0x36d780);}(_0x90a0,0xd0));var _0x090a=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x90a0[_0x54d4fe];return _0x1ab5bb;};'use strict';var WhatsappAccountEvents=require(_0x090a('0x0'));var events=[_0x090a('0x1'),_0x090a('0x2'),_0x090a('0x3')];function createListener(_0x46ca10,_0x16a01f){return function(_0x599038){_0x16a01f[_0x090a('0x4')](_0x46ca10,_0x599038);};}function removeListener(_0x4b3d9b,_0x5001f8){return function(){WhatsappAccountEvents[_0x090a('0x5')](_0x4b3d9b,_0x5001f8);};}exports['register']=function(_0x1eac2f){for(var _0x1a2e02=0x0,_0x4f385f=events[_0x090a('0x6')];_0x1a2e02<_0x4f385f;_0x1a2e02++){var _0x571815=events[_0x1a2e02];var _0x3546d3=createListener(_0x090a('0x7')+_0x571815,_0x1eac2f);WhatsappAccountEvents['on'](_0x571815,_0x3546d3);}}; \ No newline at end of file +var _0x796f=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0xd2e51d,_0x1936d2){var _0x919ffc=function(_0x14c3a0){while(--_0x14c3a0){_0xd2e51d['push'](_0xd2e51d['shift']());}};_0x919ffc(++_0x1936d2);}(_0x796f,0xeb));var _0xf796=function(_0x5ea3f6,_0x595373){_0x5ea3f6=_0x5ea3f6-0x0;var _0x3fc5a2=_0x796f[_0x5ea3f6];return _0x3fc5a2;};'use strict';var WhatsappAccountEvents=require(_0xf796('0x0'));var events=[_0xf796('0x1'),_0xf796('0x2'),_0xf796('0x3')];function createListener(_0x12766a,_0x5f1420){return function(_0x4c1fa8){_0x5f1420[_0xf796('0x4')](_0x12766a,_0x4c1fa8);};}function removeListener(_0x2e1f9e,_0x3f4845){return function(){WhatsappAccountEvents[_0xf796('0x5')](_0x2e1f9e,_0x3f4845);};}exports[_0xf796('0x6')]=function(_0x45638b){for(var _0x520f47=0x0,_0x51744f=events[_0xf796('0x7')];_0x520f47<_0x51744f;_0x520f47++){var _0x579906=events[_0x520f47];var _0x4fea0f=createListener(_0xf796('0x8')+_0x579906,_0x45638b);WhatsappAccountEvents['on'](_0x579906,_0x4fea0f);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index d738bc8..67e2027 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 _0x00d0=['post','isAuthenticated','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','/:id','show'];(function(_0xeb4f99,_0x263cea){var _0x5723fc=function(_0x4f4e85){while(--_0x4f4e85){_0xeb4f99['push'](_0xeb4f99['shift']());}};_0x5723fc(++_0x263cea);}(_0x00d0,0x15b));var _0x000d=function(_0x214132,_0x203c94){_0x214132=_0x214132-0x0;var _0x272e5d=_0x00d0[_0x214132];return _0x272e5d;};'use strict';var multer=require('multer');var util=require(_0x000d('0x0'));var path=require(_0x000d('0x1'));var timeout=require(_0x000d('0x2'));var express=require(_0x000d('0x3'));var router=express[_0x000d('0x4')]();var fs_extra=require(_0x000d('0x5'));var auth=require(_0x000d('0x6'));var interaction=require(_0x000d('0x7'));var config=require(_0x000d('0x8'));var controller=require(_0x000d('0x9'));router[_0x000d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x000d('0xa')](_0x000d('0xb'),auth['isAuthenticated'](),controller[_0x000d('0xc')]);router[_0x000d('0xd')]('/',auth[_0x000d('0xe')](),controller[_0x000d('0xf')]);router[_0x000d('0x10')](_0x000d('0xb'),auth['isAuthenticated'](),controller[_0x000d('0x11')]);router[_0x000d('0x12')](_0x000d('0xb'),auth[_0x000d('0xe')](),controller[_0x000d('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc08e=['get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller'];(function(_0x21bbcf,_0x143a0f){var _0x414b87=function(_0x317dcb){while(--_0x317dcb){_0x21bbcf['push'](_0x21bbcf['shift']());}};_0x414b87(++_0x143a0f);}(_0xc08e,0x1e5));var _0xec08=function(_0x39673d,_0x4793fc){_0x39673d=_0x39673d-0x0;var _0x587f8b=_0xc08e[_0x39673d];return _0x587f8b;};'use strict';var multer=require(_0xec08('0x0'));var util=require(_0xec08('0x1'));var path=require(_0xec08('0x2'));var timeout=require('connect-timeout');var express=require(_0xec08('0x3'));var router=express[_0xec08('0x4')]();var fs_extra=require(_0xec08('0x5'));var auth=require(_0xec08('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xec08('0x7'));var controller=require(_0xec08('0x8'));router[_0xec08('0x9')]('/',auth[_0xec08('0xa')](),controller[_0xec08('0xb')]);router['get'](_0xec08('0xc'),auth['isAuthenticated'](),controller[_0xec08('0xd')]);router['post']('/',auth[_0xec08('0xa')](),controller[_0xec08('0xe')]);router[_0xec08('0xf')](_0xec08('0xc'),auth[_0xec08('0xa')](),controller['update']);router[_0xec08('0x10')](_0xec08('0xc'),auth[_0xec08('0xa')](),controller[_0xec08('0x11')]);module[_0xec08('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ca9a542..9d25576 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 _0x4aa8=['*,*,*,*','sequelize','INTEGER','noop','TEXT','STRING'];(function(_0x4a51b3,_0xa4ab0a){var _0x115620=function(_0x5dcda7){while(--_0x5dcda7){_0x4a51b3['push'](_0x4a51b3['shift']());}};_0x115620(++_0xa4ab0a);}(_0x4aa8,0x17b));var _0x84aa=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x4aa8[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0x84aa('0x0'));module['exports']={'priority':{'type':Sequelize[_0x84aa('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x84aa('0x2')},'appdata':{'type':Sequelize[_0x84aa('0x3')]()},'description':{'type':Sequelize[_0x84aa('0x4')]},'interval':{'type':Sequelize[_0x84aa('0x4')],'defaultValue':_0x84aa('0x5')}}; \ No newline at end of file +var _0x04ce=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x04ce,0x1c0));var _0xe04c=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x04ce[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0xe04c('0x0'));module[_0xe04c('0x1')]={'priority':{'type':Sequelize[_0xe04c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe04c('0x3')],'allowNull':![],'defaultValue':_0xe04c('0x4')},'appdata':{'type':Sequelize[_0xe04c('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe04c('0x3')],'defaultValue':_0xe04c('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index f1b1b49..a2bfc7e 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 _0x49fe=['set','json','apply','reject','save','update','then','destroy','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x49fe,0x75));var _0xe49f=function(_0x383523,_0x5d95d3){_0x383523=_0x383523-0x0;var _0x5b307e=_0x49fe[_0x383523];return _0x5b307e;};'use strict';var emlformat=require(_0xe49f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe49f('0x1'));var moment=require(_0xe49f('0x2'));var BPromise=require(_0xe49f('0x3'));var Mustache=require(_0xe49f('0x4'));var util=require(_0xe49f('0x5'));var path=require(_0xe49f('0x6'));var sox=require(_0xe49f('0x7'));var csv=require(_0xe49f('0x8'));var ejs=require(_0xe49f('0x9'));var fs=require('fs');var fs_extra=require(_0xe49f('0xa'));var _=require(_0xe49f('0xb'));var squel=require(_0xe49f('0xc'));var crypto=require(_0xe49f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe49f('0xe'));var toCsv=require(_0xe49f('0x8'));var querystring=require('querystring');var Papa=require(_0xe49f('0xf'));var Redis=require('ioredis');var authService=require(_0xe49f('0x10'));var qs=require(_0xe49f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe49f('0x12'));var logger=require(_0xe49f('0x13'))(_0xe49f('0x14'));var utils=require(_0xe49f('0x15'));var config=require(_0xe49f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe49f('0x17'))['db'];function respondWithStatusCode(_0x3958bd,_0x504081){_0x504081=_0x504081||0xcc;return function(_0x10517d){if(_0x10517d){return _0x3958bd[_0xe49f('0x18')](_0x504081);}return _0x3958bd[_0xe49f('0x19')](_0x504081)[_0xe49f('0x1a')]();};}function respondWithResult(_0x44c7fe,_0x5708d9){_0x5708d9=_0x5708d9||0xc8;return function(_0x3645e8){if(_0x3645e8){return _0x44c7fe[_0xe49f('0x19')](_0x5708d9)['json'](_0x3645e8);}};}function respondWithFilteredResult(_0x4f3550,_0xfe24b7){return function(_0x3e5fb3){if(_0x3e5fb3){var _0x1e8eb8=typeof _0xfe24b7[_0xe49f('0x1b')]===_0xe49f('0x1c')&&typeof _0xfe24b7[_0xe49f('0x1d')]==='undefined';var _0x7831f1=_0x3e5fb3['count'];var _0x6ab378=_0x1e8eb8?0x0:_0xfe24b7['offset'];var _0x58f852=_0x1e8eb8?_0x3e5fb3[_0xe49f('0x1e')]:_0xfe24b7[_0xe49f('0x1b')]+_0xfe24b7['limit'];var _0x7a5643;if(_0x58f852>=_0x7831f1){_0x58f852=_0x7831f1;_0x7a5643=0xc8;}else{_0x7a5643=0xce;}_0x4f3550['status'](_0x7a5643);return _0x4f3550[_0xe49f('0x1f')]('Content-Range',_0x6ab378+'-'+_0x58f852+'/'+_0x7831f1)[_0xe49f('0x20')](_0x3e5fb3);}return null;};}function patchUpdates(_0x47b09a){return function(_0x4c4dcf){try{jsonpatch[_0xe49f('0x21')](_0x4c4dcf,_0x47b09a,!![]);}catch(_0x5b50e0){return BPromise[_0xe49f('0x22')](_0x5b50e0);}return _0x4c4dcf[_0xe49f('0x23')]();};}function saveUpdates(_0x40129c,_0x1647d1){return function(_0x424927){if(_0x424927){return _0x424927[_0xe49f('0x24')](_0x40129c)[_0xe49f('0x25')](function(_0x3d4146){return _0x3d4146;});}return null;};}function removeEntity(_0x233646,_0x2a2926){return function(_0x2bc2b2){if(_0x2bc2b2){return _0x2bc2b2[_0xe49f('0x26')]()[_0xe49f('0x25')](function(){_0x233646['status'](0xcc)[_0xe49f('0x1a')]();});}};}function handleEntityNotFound(_0x298cba,_0xbe357){return function(_0x14d820){if(!_0x14d820){_0x298cba['sendStatus'](0x194);}return _0x14d820;};}function handleError(_0x4ca90a,_0x1ff78c){_0x1ff78c=_0x1ff78c||0x1f4;return function(_0x44b702){logger['error'](_0x44b702[_0xe49f('0x27')]);if(_0x44b702['name']){delete _0x44b702[_0xe49f('0x28')];}_0x4ca90a[_0xe49f('0x19')](_0x1ff78c)[_0xe49f('0x29')](_0x44b702);};}exports['index']=function(_0x557b4e,_0x1357f6){var _0x32406b={},_0x298248={},_0x268f6e={'count':0x0,'rows':[]};var _0x4be6fc=_[_0xe49f('0x2a')](db[_0xe49f('0x2b')][_0xe49f('0x2c')],function(_0x1b3280){return{'name':_0x1b3280[_0xe49f('0x2d')],'type':_0x1b3280[_0xe49f('0x2e')]['key']};});_0x298248[_0xe49f('0x2f')]=_[_0xe49f('0x2a')](_0x4be6fc,_0xe49f('0x28'));_0x298248[_0xe49f('0x30')]=_['keys'](_0x557b4e['query']);_0x298248[_0xe49f('0x31')]=_[_0xe49f('0x32')](_0x298248[_0xe49f('0x2f')],_0x298248['query']);_0x32406b['attributes']=_[_0xe49f('0x32')](_0x298248[_0xe49f('0x2f')],qs[_0xe49f('0x33')](_0x557b4e['query'][_0xe49f('0x33')]));_0x32406b['attributes']=_0x32406b['attributes'][_0xe49f('0x34')]?_0x32406b[_0xe49f('0x35')]:_0x298248[_0xe49f('0x2f')];if(!_0x557b4e['query'][_0xe49f('0x36')](_0xe49f('0x37'))){_0x32406b['limit']=qs['limit'](_0x557b4e[_0xe49f('0x30')][_0xe49f('0x1d')]);_0x32406b[_0xe49f('0x1b')]=qs[_0xe49f('0x1b')](_0x557b4e['query'][_0xe49f('0x1b')]);}_0x32406b[_0xe49f('0x38')]=qs[_0xe49f('0x39')](_0x557b4e[_0xe49f('0x30')][_0xe49f('0x39')]);_0x32406b[_0xe49f('0x3a')]=qs[_0xe49f('0x31')](_[_0xe49f('0x3b')](_0x557b4e[_0xe49f('0x30')],_0x298248[_0xe49f('0x31')]),_0x4be6fc);if(_0x557b4e[_0xe49f('0x30')][_0xe49f('0x3c')]){_0x32406b[_0xe49f('0x3a')]=_[_0xe49f('0x3d')](_0x32406b[_0xe49f('0x3a')],{'$or':_[_0xe49f('0x2a')](_0x4be6fc,function(_0x1edf31){if(_0x1edf31[_0xe49f('0x2e')]!==_0xe49f('0x3e')){var _0x3d1380={};_0x3d1380[_0x1edf31[_0xe49f('0x28')]]={'$like':'%'+_0x557b4e[_0xe49f('0x30')][_0xe49f('0x3c')]+'%'};return _0x3d1380;}})});}_0x32406b=_['merge']({},_0x32406b,_0x557b4e[_0xe49f('0x3f')]);var _0x2efd45={'where':_0x32406b[_0xe49f('0x3a')]};return db['WhatsappApplication'][_0xe49f('0x1e')](_0x2efd45)['then'](function(_0x5cdf86){_0x268f6e[_0xe49f('0x1e')]=_0x5cdf86;if(_0x557b4e[_0xe49f('0x30')]['includeAll']){_0x32406b[_0xe49f('0x40')]=[{'all':!![]}];}return db[_0xe49f('0x2b')][_0xe49f('0x41')](_0x32406b);})[_0xe49f('0x25')](function(_0x36422e){_0x268f6e[_0xe49f('0x42')]=_0x36422e;return _0x268f6e;})[_0xe49f('0x25')](respondWithFilteredResult(_0x1357f6,_0x32406b))['catch'](handleError(_0x1357f6,null));};exports[_0xe49f('0x43')]=function(_0xbe91d2,_0x370162){var _0x2fb5f4={'raw':!![],'where':{'id':_0xbe91d2[_0xe49f('0x44')]['id']}},_0xd4341f={};_0xd4341f['model']=_[_0xe49f('0x45')](db[_0xe49f('0x2b')][_0xe49f('0x2c')]);_0xd4341f[_0xe49f('0x30')]=_[_0xe49f('0x45')](_0xbe91d2[_0xe49f('0x30')]);_0xd4341f[_0xe49f('0x31')]=_[_0xe49f('0x32')](_0xd4341f['model'],_0xd4341f['query']);_0x2fb5f4[_0xe49f('0x35')]=_['intersection'](_0xd4341f[_0xe49f('0x2f')],qs[_0xe49f('0x33')](_0xbe91d2[_0xe49f('0x30')][_0xe49f('0x33')]));_0x2fb5f4['attributes']=_0x2fb5f4[_0xe49f('0x35')][_0xe49f('0x34')]?_0x2fb5f4[_0xe49f('0x35')]:_0xd4341f['model'];if(_0xbe91d2[_0xe49f('0x30')]['includeAll']){_0x2fb5f4[_0xe49f('0x40')]=[{'all':!![]}];}_0x2fb5f4=_['merge']({},_0x2fb5f4,_0xbe91d2[_0xe49f('0x3f')]);return db['WhatsappApplication'][_0xe49f('0x46')](_0x2fb5f4)[_0xe49f('0x25')](handleEntityNotFound(_0x370162,null))[_0xe49f('0x25')](respondWithResult(_0x370162,null))[_0xe49f('0x47')](handleError(_0x370162,null));};exports[_0xe49f('0x48')]=function(_0x21796d,_0x2f87aa){return db[_0xe49f('0x2b')][_0xe49f('0x48')](_0x21796d['body'],{})['then'](respondWithResult(_0x2f87aa,0xc9))[_0xe49f('0x47')](handleError(_0x2f87aa,null));};exports[_0xe49f('0x24')]=function(_0x3fa5ec,_0x2cd14d){if(_0x3fa5ec[_0xe49f('0x49')]['id']){delete _0x3fa5ec[_0xe49f('0x49')]['id'];}return db[_0xe49f('0x2b')][_0xe49f('0x46')]({'where':{'id':_0x3fa5ec[_0xe49f('0x44')]['id']}})[_0xe49f('0x25')](handleEntityNotFound(_0x2cd14d,null))[_0xe49f('0x25')](saveUpdates(_0x3fa5ec['body'],null))[_0xe49f('0x25')](respondWithResult(_0x2cd14d,null))['catch'](handleError(_0x2cd14d,null));};exports[_0xe49f('0x26')]=function(_0x1daf27,_0x416807){return db[_0xe49f('0x2b')][_0xe49f('0x46')]({'where':{'id':_0x1daf27[_0xe49f('0x44')]['id']}})[_0xe49f('0x25')](handleEntityNotFound(_0x416807,null))[_0xe49f('0x25')](removeEntity(_0x416807,null))[_0xe49f('0x47')](handleError(_0x416807,null));}; \ No newline at end of file +var _0xdeb3=['WhatsappApplication','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index'];(function(_0x90604a,_0x478069){var _0x5b517b=function(_0x475f05){while(--_0x475f05){_0x90604a['push'](_0x90604a['shift']());}};_0x5b517b(++_0x478069);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3deb('0x0'));var zipdir=require(_0x3deb('0x1'));var jsonpatch=require(_0x3deb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3deb('0x3'));var Mustache=require(_0x3deb('0x4'));var util=require(_0x3deb('0x5'));var path=require(_0x3deb('0x6'));var sox=require(_0x3deb('0x7'));var csv=require('to-csv');var ejs=require(_0x3deb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3deb('0x9'));var squel=require('squel');var crypto=require(_0x3deb('0xa'));var jsforce=require(_0x3deb('0xb'));var deskjs=require(_0x3deb('0xc'));var toCsv=require(_0x3deb('0xd'));var querystring=require(_0x3deb('0xe'));var Papa=require(_0x3deb('0xf'));var Redis=require(_0x3deb('0x10'));var authService=require(_0x3deb('0x11'));var qs=require(_0x3deb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3deb('0x13'))(_0x3deb('0x14'));var utils=require(_0x3deb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3deb('0x16'));var db=require(_0x3deb('0x17'))['db'];function respondWithStatusCode(_0xc65b64,_0x106ead){_0x106ead=_0x106ead||0xcc;return function(_0x555a07){if(_0x555a07){return _0xc65b64['sendStatus'](_0x106ead);}return _0xc65b64['status'](_0x106ead)[_0x3deb('0x18')]();};}function respondWithResult(_0x1260a4,_0x39f5e0){_0x39f5e0=_0x39f5e0||0xc8;return function(_0x5336c7){if(_0x5336c7){return _0x1260a4[_0x3deb('0x19')](_0x39f5e0)[_0x3deb('0x1a')](_0x5336c7);}};}function respondWithFilteredResult(_0x55c13c,_0x24b516){return function(_0x3210e7){if(_0x3210e7){var _0x5ddc06=typeof _0x24b516[_0x3deb('0x1b')]==='undefined'&&typeof _0x24b516[_0x3deb('0x1c')]==='undefined';var _0x4cce09=_0x3210e7[_0x3deb('0x1d')];var _0x23c4b9=_0x5ddc06?0x0:_0x24b516[_0x3deb('0x1b')];var _0x9ba4f=_0x5ddc06?_0x3210e7[_0x3deb('0x1d')]:_0x24b516[_0x3deb('0x1b')]+_0x24b516['limit'];var _0x311a48;if(_0x9ba4f>=_0x4cce09){_0x9ba4f=_0x4cce09;_0x311a48=0xc8;}else{_0x311a48=0xce;}_0x55c13c[_0x3deb('0x19')](_0x311a48);return _0x55c13c['set'](_0x3deb('0x1e'),_0x23c4b9+'-'+_0x9ba4f+'/'+_0x4cce09)[_0x3deb('0x1a')](_0x3210e7);}return null;};}function patchUpdates(_0x1c8641){return function(_0xedc588){try{jsonpatch[_0x3deb('0x1f')](_0xedc588,_0x1c8641,!![]);}catch(_0x583dce){return BPromise[_0x3deb('0x20')](_0x583dce);}return _0xedc588[_0x3deb('0x21')]();};}function saveUpdates(_0x2705e5,_0x1b81ff){return function(_0x3327e0){if(_0x3327e0){return _0x3327e0[_0x3deb('0x22')](_0x2705e5)[_0x3deb('0x23')](function(_0x1f535e){return _0x1f535e;});}return null;};}function removeEntity(_0x42a8d5,_0x487283){return function(_0x1f6120){if(_0x1f6120){return _0x1f6120['destroy']()[_0x3deb('0x23')](function(){_0x42a8d5[_0x3deb('0x19')](0xcc)[_0x3deb('0x18')]();});}};}function handleEntityNotFound(_0x392fec,_0x9fad49){return function(_0x245544){if(!_0x245544){_0x392fec[_0x3deb('0x24')](0x194);}return _0x245544;};}function handleError(_0x255fa5,_0x38af26){_0x38af26=_0x38af26||0x1f4;return function(_0x2789cd){logger[_0x3deb('0x25')](_0x2789cd[_0x3deb('0x26')]);if(_0x2789cd[_0x3deb('0x27')]){delete _0x2789cd[_0x3deb('0x27')];}_0x255fa5[_0x3deb('0x19')](_0x38af26)[_0x3deb('0x28')](_0x2789cd);};}exports[_0x3deb('0x29')]=function(_0x16b44e,_0x1b6d93){var _0x3e8b62={},_0x4c72c7={},_0x2e10ca={'count':0x0,'rows':[]};var _0x438e65=_['map'](db[_0x3deb('0x2a')]['rawAttributes'],function(_0x349f1b){return{'name':_0x349f1b[_0x3deb('0x2b')],'type':_0x349f1b[_0x3deb('0x2c')][_0x3deb('0x2d')]};});_0x4c72c7[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x438e65,'name');_0x4c72c7[_0x3deb('0x30')]=_[_0x3deb('0x31')](_0x16b44e[_0x3deb('0x30')]);_0x4c72c7[_0x3deb('0x32')]=_[_0x3deb('0x33')](_0x4c72c7[_0x3deb('0x2e')],_0x4c72c7[_0x3deb('0x30')]);_0x3e8b62[_0x3deb('0x34')]=_['intersection'](_0x4c72c7[_0x3deb('0x2e')],qs[_0x3deb('0x35')](_0x16b44e[_0x3deb('0x30')][_0x3deb('0x35')]));_0x3e8b62[_0x3deb('0x34')]=_0x3e8b62[_0x3deb('0x34')][_0x3deb('0x36')]?_0x3e8b62[_0x3deb('0x34')]:_0x4c72c7[_0x3deb('0x2e')];if(!_0x16b44e[_0x3deb('0x30')][_0x3deb('0x37')](_0x3deb('0x38'))){_0x3e8b62[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x16b44e[_0x3deb('0x30')][_0x3deb('0x1c')]);_0x3e8b62[_0x3deb('0x1b')]=qs[_0x3deb('0x1b')](_0x16b44e[_0x3deb('0x30')]['offset']);}_0x3e8b62[_0x3deb('0x39')]=qs[_0x3deb('0x3a')](_0x16b44e[_0x3deb('0x30')][_0x3deb('0x3a')]);_0x3e8b62['where']=qs[_0x3deb('0x32')](_[_0x3deb('0x3b')](_0x16b44e[_0x3deb('0x30')],_0x4c72c7[_0x3deb('0x32')]),_0x438e65);if(_0x16b44e[_0x3deb('0x30')]['filter']){_0x3e8b62['where']=_[_0x3deb('0x3c')](_0x3e8b62[_0x3deb('0x3d')],{'$or':_[_0x3deb('0x2f')](_0x438e65,function(_0x3412e1){if(_0x3412e1[_0x3deb('0x2c')]!==_0x3deb('0x3e')){var _0x27499b={};_0x27499b[_0x3412e1[_0x3deb('0x27')]]={'$like':'%'+_0x16b44e[_0x3deb('0x30')][_0x3deb('0x3f')]+'%'};return _0x27499b;}})});}_0x3e8b62=_[_0x3deb('0x3c')]({},_0x3e8b62,_0x16b44e['options']);var _0x597f89={'where':_0x3e8b62[_0x3deb('0x3d')]};return db[_0x3deb('0x2a')][_0x3deb('0x1d')](_0x597f89)[_0x3deb('0x23')](function(_0x3a4866){_0x2e10ca[_0x3deb('0x1d')]=_0x3a4866;if(_0x16b44e['query']['includeAll']){_0x3e8b62[_0x3deb('0x40')]=[{'all':!![]}];}return db[_0x3deb('0x2a')][_0x3deb('0x41')](_0x3e8b62);})[_0x3deb('0x23')](function(_0x4e6254){_0x2e10ca[_0x3deb('0x42')]=_0x4e6254;return _0x2e10ca;})[_0x3deb('0x23')](respondWithFilteredResult(_0x1b6d93,_0x3e8b62))[_0x3deb('0x43')](handleError(_0x1b6d93,null));};exports[_0x3deb('0x44')]=function(_0x4a81b2,_0x355594){var _0x5bd42c={'raw':!![],'where':{'id':_0x4a81b2[_0x3deb('0x45')]['id']}},_0x5e5763={};_0x5e5763[_0x3deb('0x2e')]=_['keys'](db[_0x3deb('0x2a')][_0x3deb('0x46')]);_0x5e5763[_0x3deb('0x30')]=_[_0x3deb('0x31')](_0x4a81b2[_0x3deb('0x30')]);_0x5e5763['filters']=_[_0x3deb('0x33')](_0x5e5763[_0x3deb('0x2e')],_0x5e5763['query']);_0x5bd42c['attributes']=_['intersection'](_0x5e5763[_0x3deb('0x2e')],qs[_0x3deb('0x35')](_0x4a81b2[_0x3deb('0x30')][_0x3deb('0x35')]));_0x5bd42c['attributes']=_0x5bd42c[_0x3deb('0x34')][_0x3deb('0x36')]?_0x5bd42c[_0x3deb('0x34')]:_0x5e5763[_0x3deb('0x2e')];if(_0x4a81b2['query']['includeAll']){_0x5bd42c[_0x3deb('0x40')]=[{'all':!![]}];}_0x5bd42c=_[_0x3deb('0x3c')]({},_0x5bd42c,_0x4a81b2['options']);return db['WhatsappApplication'][_0x3deb('0x47')](_0x5bd42c)['then'](handleEntityNotFound(_0x355594,null))[_0x3deb('0x23')](respondWithResult(_0x355594,null))[_0x3deb('0x43')](handleError(_0x355594,null));};exports['create']=function(_0x46fc80,_0x2fbdc3){return db[_0x3deb('0x2a')][_0x3deb('0x48')](_0x46fc80[_0x3deb('0x49')],{})[_0x3deb('0x23')](respondWithResult(_0x2fbdc3,0xc9))[_0x3deb('0x43')](handleError(_0x2fbdc3,null));};exports[_0x3deb('0x22')]=function(_0xcd0ba9,_0x24a040){if(_0xcd0ba9[_0x3deb('0x49')]['id']){delete _0xcd0ba9[_0x3deb('0x49')]['id'];}return db[_0x3deb('0x2a')]['find']({'where':{'id':_0xcd0ba9['params']['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x24a040,null))['then'](saveUpdates(_0xcd0ba9['body'],null))[_0x3deb('0x23')](respondWithResult(_0x24a040,null))[_0x3deb('0x43')](handleError(_0x24a040,null));};exports[_0x3deb('0x4a')]=function(_0x273054,_0x596ad4){return db[_0x3deb('0x2a')][_0x3deb('0x47')]({'where':{'id':_0x273054[_0x3deb('0x45')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x596ad4,null))['then'](removeEntity(_0x596ad4,null))[_0x3deb('0x43')](handleError(_0x596ad4,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index cb13c8c..13b7623 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 _0x885a=['./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x885a,0x180));var _0xa885=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x885a[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa885('0xc'),'collate':_0xa885('0xd')});}; \ No newline at end of file +var _0x008c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4_unicode_ci'];(function(_0x5359db,_0x1339c8){var _0x201dc1=function(_0x1d7cd7){while(--_0x1d7cd7){_0x5359db['push'](_0x5359db['shift']());}};_0x201dc1(++_0x1339c8);}(_0x008c,0x188));var _0xc008=function(_0x1e7382,_0x44937e){_0x1e7382=_0x1e7382-0x0;var _0x16debf=_0x008c[_0x1e7382];return _0x16debf;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('WhatsappApplication',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc008('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 028993a..0706aaf 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 _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x577225,_0x4213bc){var _0x34dca0=function(_0x474bd5){while(--_0x474bd5){_0x577225['push'](_0x577225['shift']());}};_0x34dca0(++_0x4213bc);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x1a422a,_0x3468fd){_0x1a422a=_0x1a422a-0x0;var _0x4dcab4=_0xd0bb[_0x1a422a];return _0x4dcab4;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x249253,_0x338ee8){var _0x2b8bf5=function(_0x2a9ec2){while(--_0x2a9ec2){_0x249253['push'](_0x249253['shift']());}};_0x2b8bf5(++_0x338ee8);}(_0x4b84,0x1cc));var _0x44b8=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0x4b84[_0x39ea42];return _0x33f5b7;};'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')]('WhatsappApplication,\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')]('WhatsappApplication,\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 diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f5ce441..495151b 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 _0xda19=['/:id/tags','removeTags','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','whatsappinteraction:addtags','put','/:id','tracked','whatsapp','update','delete'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xda19,0xd5));var _0x9da1=function(_0x4eaf56,_0x183b51){_0x4eaf56=_0x4eaf56-0x0;var _0x1e4eb0=_0xda19[_0x4eaf56];return _0x1e4eb0;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var fs_extra=require(_0x9da1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var controller=require(_0x9da1('0x6'));router[_0x9da1('0x7')]('/',auth[_0x9da1('0x8')](),controller[_0x9da1('0x9')]);router[_0x9da1('0x7')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router['get'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xe')]);router[_0x9da1('0x7')](_0x9da1('0xf'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9da1('0x11')]);router['post'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x12')]);router[_0x9da1('0x13')]('/:id/tags',auth[_0x9da1('0x8')](),interaction['tracked']('whatsapp',_0x9da1('0x14')),controller['addTags']);router[_0x9da1('0x15')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:update'),controller[_0x9da1('0x19')]);router[_0x9da1('0x1a')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x9da1('0x1a')](_0x9da1('0x1b'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x1c')]);module[_0x9da1('0x1d')]=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(_0x2abe67,_0x15094e){var _0x484b59=function(_0xb5f207){while(--_0xb5f207){_0x2abe67['push'](_0x2abe67['shift']());}};_0x484b59(++_0x15094e);}(_0xf494,0x1c6));var _0x4f49=function(_0x50528d,_0x5dd361){_0x50528d=_0x50528d-0x0;var _0x485462=_0xf494[_0x50528d];return _0x485462;};'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 cd29fc7..87ae3c6 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 _0xad78=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xad78,0x149));var _0x8ad7=function(_0x3ab4da,_0x51e0ef){_0x3ab4da=_0x3ab4da-0x0;var _0x125d3f=_0xad78[_0x3ab4da];return _0x125d3f;};'use strict';var Sequelize=require(_0x8ad7('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x8ad7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8ad7('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8ad7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8ad7('0x3')]},'note':{'type':Sequelize[_0x8ad7('0x3')]},'phone':{'type':Sequelize[_0x8ad7('0x3')]},'read1stAt':{'type':Sequelize[_0x8ad7('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8ad7('0x4')]('in',_0x8ad7('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8ad7('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8ad7('0x4')]('in',_0x8ad7('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3561=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3fdbdc,_0xca225c){var _0x51e831=function(_0x462da8){while(--_0x462da8){_0x3fdbdc['push'](_0x3fdbdc['shift']());}};_0x51e831(++_0xca225c);}(_0x3561,0x94));var _0x1356=function(_0x7fc7bc,_0x645e63){_0x7fc7bc=_0x7fc7bc-0x0;var _0x5e3894=_0x3561[_0x7fc7bc];return _0x5e3894;};'use strict';var Sequelize=require(_0x1356('0x0'));var moment=require('moment');module[_0x1356('0x1')]={'closed':{'type':Sequelize[_0x1356('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1356('0x3')]},'disposition':{'type':Sequelize[_0x1356('0x4')]},'secondDisposition':{'type':Sequelize[_0x1356('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1356('0x4')]},'note':{'type':Sequelize[_0x1356('0x4')]},'phone':{'type':Sequelize[_0x1356('0x4')]},'read1stAt':{'type':Sequelize[_0x1356('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1356('0x5')]('in',_0x1356('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1356('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1356('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1356('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 22b0d15..a04e4b0 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 _0x86dc=['Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','rawAttributes','include','options','create','body','params','destroy','describe','addMessage','ids','omit','findOne','WhatsappMessage','nolimit','order','sort','format','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','log','err','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','error','name','send','fullname','Tags','TagIds','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','WhatsappInteraction','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','where','pick','select','field','color','tools_tags','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','buildExpression','text','start','Tag','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','i.WhatsappAccountId\x20IS\x20NULL','user','sequelize','toString','merge','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile'];(function(_0x315b61,_0x4bb11e){var _0x3521e8=function(_0x5e6389){while(--_0x5e6389){_0x315b61['push'](_0x315b61['shift']());}};_0x3521e8(++_0x4bb11e);}(_0x86dc,0x13e));var _0xc86d=function(_0x56d591,_0x3191a3){_0x56d591=_0x56d591-0x0;var _0x4bf0ff=_0x86dc[_0x56d591];return _0x4bf0ff;};'use strict';var emlformat=require(_0xc86d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc86d('0x1'));var rp=require(_0xc86d('0x2'));var moment=require(_0xc86d('0x3'));var BPromise=require(_0xc86d('0x4'));var Mustache=require('mustache');var util=require(_0xc86d('0x5'));var path=require('path');var sox=require(_0xc86d('0x6'));var csv=require('to-csv');var ejs=require(_0xc86d('0x7'));var fs=require('fs');var fs_extra=require(_0xc86d('0x8'));var _=require(_0xc86d('0x9'));var squel=require('squel');var crypto=require(_0xc86d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc86d('0xb'));var toCsv=require(_0xc86d('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc86d('0xd'));var authService=require(_0xc86d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc86d('0xf'));var pdf=require(_0xc86d('0x10'));var hardwareService=require(_0xc86d('0x11'));var logger=require(_0xc86d('0x12'))(_0xc86d('0x13'));var utils=require(_0xc86d('0x14'));var config=require(_0xc86d('0x15'));var licenseUtil=require(_0xc86d('0x16'));var db=require(_0xc86d('0x17'))['db'];config[_0xc86d('0x18')]=_[_0xc86d('0x19')](config[_0xc86d('0x18')],{'host':_0xc86d('0x1a'),'port':0x18eb});var socket=require(_0xc86d('0x1b'))(new Redis(config[_0xc86d('0x18')]));require(_0xc86d('0x1c'))[_0xc86d('0x1d')](socket);function respondWithStatusCode(_0x313c16,_0x2bc469){_0x2bc469=_0x2bc469||0xcc;return function(_0x24c9c3){if(_0x24c9c3){return _0x313c16[_0xc86d('0x1e')](_0x2bc469);}return _0x313c16['status'](_0x2bc469)['end']();};}function respondWithResult(_0x49af1f,_0x3a253c){_0x3a253c=_0x3a253c||0xc8;return function(_0x376a90){if(_0x376a90){return _0x49af1f[_0xc86d('0x1f')](_0x3a253c)[_0xc86d('0x20')](_0x376a90);}};}function respondWithFilteredResult(_0x3a95c2,_0x3d7e72){return function(_0x279406){if(_0x279406){var _0x5f3ece=typeof _0x3d7e72['offset']===_0xc86d('0x21')&&typeof _0x3d7e72[_0xc86d('0x22')]===_0xc86d('0x21');var _0x56f510=_0x279406[_0xc86d('0x23')];var _0xb25b1b=_0x5f3ece?0x0:_0x3d7e72[_0xc86d('0x24')];var _0x4eb0e5=_0x5f3ece?_0x279406[_0xc86d('0x23')]:_0x3d7e72[_0xc86d('0x24')]+_0x3d7e72['limit'];var _0x34bb85;if(_0x4eb0e5>=_0x56f510){_0x4eb0e5=_0x56f510;_0x34bb85=0xc8;}else{_0x34bb85=0xce;}_0x3a95c2[_0xc86d('0x1f')](_0x34bb85);return _0x3a95c2[_0xc86d('0x25')](_0xc86d('0x26'),_0xb25b1b+'-'+_0x4eb0e5+'/'+_0x56f510)['json'](_0x279406);}return null;};}function patchUpdates(_0x2a0308){return function(_0x350cda){try{jsonpatch[_0xc86d('0x27')](_0x350cda,_0x2a0308,!![]);}catch(_0x1bb9ed){return BPromise[_0xc86d('0x28')](_0x1bb9ed);}return _0x350cda['save']();};}function saveUpdates(_0x38fb11,_0x419afa){return function(_0x41de64){if(_0x41de64){return _0x41de64[_0xc86d('0x29')](_0x38fb11)[_0xc86d('0x2a')](function(_0x5347f7){return _0x5347f7;});}return null;};}function removeEntity(_0x1458fe,_0x54303e){return function(_0x4e1312){if(_0x4e1312){return _0x4e1312['destroy']()[_0xc86d('0x2a')](function(){_0x1458fe[_0xc86d('0x1f')](0xcc)[_0xc86d('0x2b')]();});}};}function handleEntityNotFound(_0x1e29be,_0xd8b255){return function(_0x1ad978){if(!_0x1ad978){_0x1e29be[_0xc86d('0x1e')](0x194);}return _0x1ad978;};}function handleError(_0x2a35b3,_0x4db581){_0x4db581=_0x4db581||0x1f4;return function(_0x397a55){logger[_0xc86d('0x2c')](_0x397a55['stack']);if(_0x397a55['name']){delete _0x397a55[_0xc86d('0x2d')];}_0x2a35b3[_0xc86d('0x1f')](_0x4db581)[_0xc86d('0x2e')](_0x397a55);};}function getInteractionUsers(_0x271b23,_0x384bc9){return new BPromise(function(_0x217415,_0x27e478){try{if(_0x384bc9[_0x271b23['id']]){_0x271b23['Users']=_['map'](_0x384bc9[_0x271b23['id']],function(_0x205a2b){return{'id':_0x205a2b['id'],'fullname':_0x205a2b[_0xc86d('0x2f')]};});}}catch(_0x18e468){_0x27e478(_0x18e468);}_0x217415(_0x271b23);});}function getInteractionTags(_0x219673,_0x28dd82){return new BPromise(function(_0x5b80cb,_0x3ca99a){try{if(_0x219673['TagIds']){_0x219673[_0xc86d('0x30')]=[];_0x219673[_0xc86d('0x31')][_0xc86d('0x32')](',')[_0xc86d('0x33')](function(_0x3a469d){_0x219673[_0xc86d('0x30')][_0xc86d('0x34')](_0x28dd82[_0x3a469d]);});}delete _0x219673[_0xc86d('0x31')];}catch(_0x12ea63){_0x3ca99a(_0x12ea63);}_0x5b80cb(_0x219673);});}function updateWhatsappInteraction(_0x4e51bd,_0x557a73,_0x52c552){return new BPromise(function(_0x4ce856,_0x50d014){return getInteractionUsers(_0x4e51bd,_0x52c552)['then'](function(_0x412dd7){return getInteractionTags(_0x412dd7,_0x557a73);})[_0xc86d('0x2a')](function(_0x3fa1dd){return getStateInteraction(_0x3fa1dd);})[_0xc86d('0x2a')](function(_0x2cba68){_0x4ce856(_0x2cba68);})[_0xc86d('0x35')](function(_0x51924c){_0x50d014(_0x51924c);});});}function getStateInteraction(_0x3b0940){return new BPromise(function(_0x288c34){_0x3b0940[_0xc86d('0x36')]=0x0;_0x3b0940[_0xc86d('0x37')]=0x0;_0x3b0940[_0xc86d('0x38')]=0x0;_0x3b0940[_0xc86d('0x39')]=0x0;_0x3b0940[_0xc86d('0x3a')]=0x0;if(!_0x3b0940[_0xc86d('0x3b')]&&!_0x3b0940[_0xc86d('0x3c')]){_0x3b0940[_0xc86d('0x36')]+=0x1;}if(!_0x3b0940['closed']&&_0x3b0940[_0xc86d('0x3c')]){_0x3b0940['talking']+=0x1;if(_0x3b0940[_0xc86d('0x36')]){_0x3b0940[_0xc86d('0x36')]-=0x1;}}if(_0x3b0940[_0xc86d('0x3b')]&&_0x3b0940['UserId']){_0x3b0940[_0xc86d('0x38')]+=0x1;if(_0x3b0940[_0xc86d('0x37')]){_0x3b0940[_0xc86d('0x37')]-=0x1;}}if(_0x3b0940['closed']&&!_0x3b0940[_0xc86d('0x3c')]){_0x3b0940[_0xc86d('0x39')]+=0x1;if(_0x3b0940[_0xc86d('0x36')]){_0x3b0940[_0xc86d('0x36')]-=0x1;}}_0x3b0940[_0xc86d('0x3a')]+=0x1;_0x288c34(_0x3b0940);});}exports['index']=function(_0x25e94e,_0x30c566){var _0xdbe2c2={},_0x38d25e={},_0x3bd5ce={'count':0x0,'rows':[]};var _0x117d82=_['map'](db[_0xc86d('0x3d')]['rawAttributes'],function(_0x2023b5){return{'name':_0x2023b5[_0xc86d('0x3e')],'type':_0x2023b5[_0xc86d('0x3f')][_0xc86d('0x40')]};});_0x38d25e['model']=_['map'](_0x117d82,'name');_0x38d25e[_0xc86d('0x41')]=_[_0xc86d('0x42')](_0x25e94e[_0xc86d('0x41')]);_0x38d25e[_0xc86d('0x43')]=_['intersection'](_0x38d25e[_0xc86d('0x44')],_0x38d25e[_0xc86d('0x41')]);_0xdbe2c2[_0xc86d('0x45')]=_[_0xc86d('0x46')](_0x38d25e[_0xc86d('0x44')],qs['fields'](_0x25e94e[_0xc86d('0x41')][_0xc86d('0x47')]));_0xdbe2c2[_0xc86d('0x45')]=_0xdbe2c2[_0xc86d('0x45')]['length']?_0xdbe2c2[_0xc86d('0x45')]:_0x38d25e['model'];if(!_0x25e94e['query'][_0xc86d('0x48')]('nolimit')){_0xdbe2c2[_0xc86d('0x22')]=qs[_0xc86d('0x22')](_0x25e94e[_0xc86d('0x41')][_0xc86d('0x22')]);_0xdbe2c2['offset']=qs[_0xc86d('0x24')](_0x25e94e[_0xc86d('0x41')][_0xc86d('0x24')]);}_0xdbe2c2['order']=qs['sort'](_0x25e94e[_0xc86d('0x41')]['sort']);_0xdbe2c2[_0xc86d('0x49')]=qs[_0xc86d('0x43')](_[_0xc86d('0x4a')](_0x25e94e['query'],_0x38d25e['filters']),_0x117d82);var _0xe8a2aa=[];var _0x21b745=squel[_0xc86d('0x4b')]()['field']('id')[_0xc86d('0x4c')]('name')[_0xc86d('0x4c')](_0xc86d('0x4d'))['from'](_0xc86d('0x4e'));var _0x401ba4=squel['select']()[_0xc86d('0x4c')]('u.id')[_0xc86d('0x4c')](_0xc86d('0x4f'))[_0xc86d('0x4c')]('ui.WhatsappInteractionId')['from'](_0xc86d('0x50'),'ui')[_0xc86d('0x51')](_0xc86d('0x52'),'u',_0xc86d('0x53'));var _0x4fdeb8=squel[_0xc86d('0x4b')]()[_0xc86d('0x54')](_0xc86d('0x55'),'i')[_0xc86d('0x51')](_0xc86d('0x56'),'c',_0xc86d('0x57'))['left_join'](_0xc86d('0x52'),'o',_0xc86d('0x58'))[_0xc86d('0x51')](_0xc86d('0x59'),'a',_0xc86d('0x5a'))[_0xc86d('0x51')](_0xc86d('0x5b'),'me',_0xc86d('0x5c'))['left_join']('whatsapp_interaction_has_tags','it',_0xc86d('0x5d'))['left_join'](_0xc86d('0x4e'),'t',_0xc86d('0x5e'));var _0x52da8c=squel[_0xc86d('0x5f')]();var _0x64d4f7=[];var _0x2bf181=squel[_0xc86d('0x5f')]();var _0x2d8103;if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x60')]){_0x2d8103=as[_0xc86d('0x61')](_0x25e94e['query'][_0xc86d('0x60')]);var _0x28e7e3=_0x2d8103[_0xc86d('0x62')];for(var _0x345ae0=0x0;_0x345ae0<_0x2d8103['conditions'][_0xc86d('0x63')];_0x345ae0++){var _0x5cfb45=_0x2d8103[_0xc86d('0x64')][_0x345ae0];var _0x3a7900='i';var _0x1612d1=_['find'](_0x117d82,[_0xc86d('0x2d'),_0x5cfb45[_0xc86d('0x4c')]]);if(!_0x1612d1){switch(_0x5cfb45[_0xc86d('0x4c')]){case _0xc86d('0x65'):if(_0x5cfb45['value']==0x1){_0x4fdeb8['having']('`'+_0x5cfb45[_0xc86d('0x4c')]+'`\x20=\x200');}else{_0x4fdeb8[_0xc86d('0x66')]('`'+_0x5cfb45['field']+_0xc86d('0x67'));}break;case _0xc86d('0x68'):if(_0x5cfb45[_0xc86d('0x69')]==='$substring'){if(_0x5cfb45['value']['split']('\x20')[_0xc86d('0x63')]>0x1){_0x52da8c[_0x28e7e3](_0xc86d('0x6a'),qs[_0xc86d('0x6b')](_0x5cfb45[_0xc86d('0x6c')]),null);}else{var _0x7a5d0c='%'+_0x5cfb45[_0xc86d('0x6c')]+'%';_0x52da8c[_0x28e7e3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x7a5d0c,_0x7a5d0c,_0x7a5d0c);}}else{_0x1612d1=_['find'](_0x117d82,[_0xc86d('0x2d'),_0xc86d('0x6d')]);_0x5cfb45[_0xc86d('0x4c')]=_0xc86d('0x6d');_0x4cacd3=as[_0xc86d('0x6e')](_0x3a7900,_0x1612d1[_0xc86d('0x3f')],_0x5cfb45);_0x52da8c[_0x28e7e3](_0x4cacd3[_0xc86d('0x6f')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x70')],_0x4cacd3['value'][_0xc86d('0x2b')]);}break;case _0xc86d('0x71'):var _0x5aa7be=_0x5cfb45['value']['split'](',')[_0xc86d('0x72')](function(_0x1d92d8){return Number(_0x1d92d8);});_0x5aa7be[_0xc86d('0x33')](function(_0x1c96ca){_0x2bf181['or'](_0xc86d('0x73'),'%,'+_0x1c96ca+',%');});_0x64d4f7=_[_0xc86d('0x74')](_0x64d4f7,_0x5aa7be);break;case _0xc86d('0x75'):if(_0x5cfb45[_0xc86d('0x69')]==='$substring'){_0x52da8c[_0x28e7e3](_0xc86d('0x76'),'%'+_0x5cfb45['value']+'%',null);}else{_0x1612d1=_[_0xc86d('0x77')](_0x117d82,[_0xc86d('0x2d'),_0xc86d('0x3c')]);_0x5cfb45[_0xc86d('0x4c')]=_0xc86d('0x3c');_0x4cacd3=as[_0xc86d('0x6e')](_0x3a7900,_0x1612d1[_0xc86d('0x3f')],_0x5cfb45);_0x52da8c[_0x28e7e3](_0x4cacd3[_0xc86d('0x6f')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x70')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x2b')]);}break;case'body':_0x4cacd3=as[_0xc86d('0x6e')]('me',null,_0x5cfb45);_0x52da8c[_0x28e7e3](_0x4cacd3[_0xc86d('0x6f')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x70')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x2b')]);break;}}else{var _0x4cacd3=as['buildExpression'](_0x3a7900,_0x1612d1[_0xc86d('0x3f')],_0x5cfb45);_0x52da8c[_0x28e7e3](_0x4cacd3[_0xc86d('0x6f')],_0x4cacd3[_0xc86d('0x6c')]['start'],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x2b')]);}}}else{var _0x542d27=_(_0x25e94e['query'])[_0xc86d('0x42')]()[_0xc86d('0x72')](function(_0x332cae){return _[_0xc86d('0x78')](_0x117d82,[_0xc86d('0x2d'),_0x332cae])?_0x332cae:undefined;})[_0xc86d('0x79')]()[_0xc86d('0x6c')]();if(!_[_0xc86d('0x7a')](_0x542d27)){_0x542d27[_0xc86d('0x33')](function(_0xd550a3){if(_0xd550a3===_0xc86d('0x7b')){_0x4fdeb8[_0xc86d('0x49')](_0xc86d('0x7c'),[][_0xc86d('0x7d')](_0x25e94e[_0xc86d('0x41')][_0xd550a3]));}else if(_0xd550a3===_0xc86d('0x7e')){var _0x20ce5b=JSON[_0xc86d('0x7f')](_0x25e94e['query'][_0xd550a3])[_0xc86d('0x80')];var _0x29ec29=JSON['parse'](_0x25e94e['query'][_0xd550a3])[_0xc86d('0x81')];_0x4fdeb8['where'](_0xc86d('0x82'),_0x20ce5b,_0x29ec29);}else{if(_0x25e94e[_0xc86d('0x41')][_0xd550a3]===_0xc86d('0x83')){_0x4fdeb8['where']('i.'+_0xd550a3+_0xc86d('0x84'));}else{_0x4fdeb8[_0xc86d('0x49')]('i.'+_0xd550a3+_0xc86d('0x85'),_0x25e94e[_0xc86d('0x41')][_0xd550a3]);}}});}if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x86')]){if(_0x25e94e[_0xc86d('0x41')]['read']==0x1){_0x4fdeb8[_0xc86d('0x66')](_0xc86d('0x87'));}else{_0x4fdeb8[_0xc86d('0x66')](_0xc86d('0x88'));}}if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x89')]){_0x64d4f7=_[_0xc86d('0x8a')](_0x25e94e[_0xc86d('0x41')][_0xc86d('0x89')])?_0x25e94e[_0xc86d('0x41')][_0xc86d('0x89')]:new Array(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x89')]);_0x64d4f7[_0xc86d('0x33')](function(_0x13c6a5){_0x2bf181['or'](_0xc86d('0x73'),'%,'+_0x13c6a5+',%');});}if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x8b')]){var _0x46ba36=_0x25e94e['query'][_0xc86d('0x8b')][_0xc86d('0x8c')]('\x5c','\x5c\x5c')[_0xc86d('0x8c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x46ba36)){_0x52da8c['or'](_0xc86d('0x8d'),_0x46ba36+'%')['or'](_0xc86d('0x8e'),_0x46ba36+'%');}else{_0x52da8c['or'](_0xc86d('0x8f'),qs[_0xc86d('0x6b')](_0x46ba36))['or'](_0xc86d('0x90'),_0x46ba36+'%');}}}_0x4fdeb8[_0xc86d('0x49')](_0x52da8c);_0x4fdeb8['group'](_0xc86d('0x91'));var _0x45d52e={'type':db['Sequelize'][_0xc86d('0x92')][_0xc86d('0x93')],'raw':!![]};var _0x43a3bc=_0x4fdeb8['clone']();_0x43a3bc[_0xc86d('0x4c')](_0xc86d('0x91'));_0x43a3bc[_0xc86d('0x4c')](_0xc86d('0x94'),_0xc86d('0x65'));if(_0xdbe2c2['order']){_0xdbe2c2['order'][_0xc86d('0x33')](function(_0x512f2e){var _0x4bbac8=_0x512f2e[0x0]===_0xc86d('0x95')?_0x512f2e[0x0]:'i.'+_0x512f2e[0x0];_0x4fdeb8['order'](_0x4bbac8,_0x512f2e[0x1]===_0xc86d('0x96')?![]:!![]);});}if(!_[_0xc86d('0x7a')](_0x64d4f7)){_0x4fdeb8[_0xc86d('0x66')](_0x2bf181);_0x43a3bc[_0xc86d('0x49')](_0xc86d('0x97'),_0x64d4f7);}BPromise[_0xc86d('0x98')]()[_0xc86d('0x2a')](function(){if(!_0x2d8103){if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x7b')])return;_0x43a3bc[_0xc86d('0x49')](_0xc86d('0x99'));_0x4fdeb8[_0xc86d('0x49')](_0xc86d('0x99'));return;}if(_0x25e94e['user'][_0xc86d('0x9a')]!==_0xc86d('0x9b'))return;return _0x25e94e['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x2789ad){if(_[_0xc86d('0x7a')](_0x2789ad)){_0x43a3bc[_0xc86d('0x49')](_0xc86d('0x9c'));_0x4fdeb8[_0xc86d('0x49')](_0xc86d('0x9c'));}else{_0x43a3bc[_0xc86d('0x49')]('i.WhatsappAccountId\x20IN\x20?',_[_0xc86d('0x72')](_0x2789ad,'id'));_0x4fdeb8[_0xc86d('0x49')](_0xc86d('0x7c'),_['map'](_0x2789ad,'id'));}});})[_0xc86d('0x2a')](function(){if(_0x25e94e[_0xc86d('0x9d')]['role']===_0xc86d('0x9b')&&!_0x2d8103&&!_0x25e94e[_0xc86d('0x41')]['WhatsappAccountId'])return[];return db[_0xc86d('0x9e')]['query'](_0x43a3bc[_0xc86d('0x9f')](),_0x45d52e);})[_0xc86d('0x2a')](function(_0x449c2f){_0x3bd5ce['count']=_0x449c2f[_0xc86d('0x63')];if(_0x3bd5ce[_0xc86d('0x23')]===0x0)return[];return db[_0xc86d('0x9e')][_0xc86d('0x41')](_0x21b745[_0xc86d('0x9f')](),_0x45d52e)[_0xc86d('0x2a')](function(_0x576e56){_0xe8a2aa=_['keyBy'](_0x576e56,'id');_0x45d52e=_[_0xc86d('0xa0')](_0x45d52e,{'model':db[_0xc86d('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x25e94e[_0xc86d('0x41')]['fields']){_0xdbe2c2[_0xc86d('0x45')][_0xc86d('0x33')](function(_0xba3b4f){_0x4fdeb8[_0xc86d('0x4c')]('i.'+_0xba3b4f);});}else{_0x4fdeb8['field'](_0xc86d('0x94'),_0xc86d('0x65'));_0x4fdeb8['field']('a.key',_0xc86d('0xa1'));_0x4fdeb8[_0xc86d('0x4c')]('a.mandatoryDisposition',_0xc86d('0xa2'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xa3'),_0xc86d('0x95'));_0x4fdeb8['field'](_0xc86d('0xa4'));_0x4fdeb8['field'](_0xc86d('0xa5'),_0xc86d('0xa6'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xa7'),_0xc86d('0xa8'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xa9'),_0xc86d('0xaa'));_0x4fdeb8['field'](_0xc86d('0xab'),_0xc86d('0xac'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xad'),'Contact.mobile');_0x4fdeb8[_0xc86d('0x4c')]('c.fax',_0xc86d('0xae'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xaf'),_0xc86d('0xb0'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xb1'),_0xc86d('0xb2'));_0x4fdeb8['field'](_0xc86d('0xb3'),_0xc86d('0x31'));}if(_0xdbe2c2['limit'])_0x4fdeb8['limit'](_0xdbe2c2[_0xc86d('0x22')]);if(_0xdbe2c2[_0xc86d('0x24')])_0x4fdeb8['offset'](_0xdbe2c2[_0xc86d('0x24')]);return db[_0xc86d('0x9e')][_0xc86d('0x41')](_0x4fdeb8[_0xc86d('0x9f')](),_0x45d52e);})[_0xc86d('0x2a')](function(_0x1c14d6){if(_0x1c14d6[_0xc86d('0x63')]>0x0)_0x401ba4[_0xc86d('0x49')](_0xc86d('0xb4'),_['map'](_0x1c14d6,'id'));return db['sequelize'][_0xc86d('0x41')](_0x401ba4[_0xc86d('0x9f')](),_0x45d52e)[_0xc86d('0x2a')](function(_0x5a300b){var _0x389f19=_[_0xc86d('0xb5')](_0x5a300b,_0xc86d('0xb6'));var _0x5a1571=[];_0x1c14d6[_0xc86d('0x33')](function(_0x2820a5){_0x5a1571['push'](updateWhatsappInteraction(_0x2820a5,_0xe8a2aa,_0x389f19));});return BPromise[_0xc86d('0xb7')](_0x5a1571);});});})[_0xc86d('0x2a')](function(_0x345bae){_0x3bd5ce[_0xc86d('0xb8')]=_0x345bae;return _0x3bd5ce;})[_0xc86d('0x2a')](respondWithFilteredResult(_0x30c566,_0xdbe2c2))[_0xc86d('0x35')](handleError(_0x30c566,null));};exports[_0xc86d('0xb9')]=function(_0x553ab0,_0x2a09d9){var _0xd7ad53={'raw':![],'where':{'id':_0x553ab0['params']['id']}},_0x541c22={};_0x541c22[_0xc86d('0x44')]=_[_0xc86d('0x42')](db['WhatsappInteraction'][_0xc86d('0xba')]);_0x541c22[_0xc86d('0x41')]=_[_0xc86d('0x42')](_0x553ab0[_0xc86d('0x41')]);_0x541c22[_0xc86d('0x43')]=_['intersection'](_0x541c22['model'],_0x541c22[_0xc86d('0x41')]);_0xd7ad53['attributes']=_[_0xc86d('0x46')](_0x541c22[_0xc86d('0x44')],qs['fields'](_0x553ab0[_0xc86d('0x41')][_0xc86d('0x47')]));_0xd7ad53[_0xc86d('0x45')]=_0xd7ad53[_0xc86d('0x45')]['length']?_0xd7ad53[_0xc86d('0x45')]:_0x541c22['model'];if(_0x553ab0[_0xc86d('0x41')]['includeAll']){_0xd7ad53[_0xc86d('0xbb')]=[{'all':!![]}];}_0xd7ad53=_['merge']({},_0xd7ad53,_0x553ab0[_0xc86d('0xbc')]);return db[_0xc86d('0x3d')]['find'](_0xd7ad53)[_0xc86d('0x2a')](handleEntityNotFound(_0x2a09d9,null))['then'](respondWithResult(_0x2a09d9,null))['catch'](handleError(_0x2a09d9,null));};exports[_0xc86d('0xbd')]=function(_0x335719,_0x36a070){return db[_0xc86d('0x3d')]['create'](_0x335719[_0xc86d('0xbe')],{})['then'](respondWithResult(_0x36a070,0xc9))[_0xc86d('0x35')](handleError(_0x36a070,null));};exports[_0xc86d('0x29')]=function(_0x44c4a7,_0x11a158){if(_0x44c4a7[_0xc86d('0xbe')]['id']){delete _0x44c4a7[_0xc86d('0xbe')]['id'];}return db[_0xc86d('0x3d')]['find']({'where':{'id':_0x44c4a7[_0xc86d('0xbf')]['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x11a158,null))[_0xc86d('0x2a')](saveUpdates(_0x44c4a7[_0xc86d('0xbe')],null))[_0xc86d('0x2a')](respondWithResult(_0x11a158,null))['catch'](handleError(_0x11a158,null));};exports[_0xc86d('0xc0')]=function(_0x214525,_0x20dda3){return db[_0xc86d('0x3d')]['find']({'where':{'id':_0x214525[_0xc86d('0xbf')]['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x20dda3,null))[_0xc86d('0x2a')](removeEntity(_0x20dda3,null))[_0xc86d('0x35')](handleError(_0x20dda3,null));};exports[_0xc86d('0xc1')]=function(_0xd8d92e,_0x42e51f){return db[_0xc86d('0x3d')]['describe']()[_0xc86d('0x2a')](respondWithResult(_0x42e51f,null))[_0xc86d('0x35')](handleError(_0x42e51f,null));};exports['addMessage']=function(_0x4cd541,_0x15d9c3,_0x31ef20){return db['WhatsappMessage'][_0xc86d('0x77')]({'where':{'id':_0x4cd541['params']['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x15d9c3,null))[_0xc86d('0x2a')](function(_0xc53dbe){if(_0xc53dbe){return _0xc53dbe[_0xc86d('0xc2')](_0x4cd541['body'][_0xc86d('0xc3')],_[_0xc86d('0xc4')](_0x4cd541[_0xc86d('0xbe')],[_0xc86d('0xc3'),'id'])||{});}})['then'](respondWithResult(_0x15d9c3,null))[_0xc86d('0x35')](handleError(_0x15d9c3,null));};exports['getMessages']=function(_0x27a95a,_0x42dae8,_0x4aa98c){var _0x496258={'raw':![],'where':{}};var _0x4bca38={};var _0x4280f7={'count':0x0,'rows':[]};return db[_0xc86d('0x3d')][_0xc86d('0xc5')]({'where':{'id':_0x27a95a[_0xc86d('0xbf')]['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x42dae8,null))['then'](function(_0x3820aa){if(_0x3820aa){_0x4bca38[_0xc86d('0x44')]=_['keys'](db[_0xc86d('0xc6')][_0xc86d('0xba')]);_0x4bca38['query']=_[_0xc86d('0x42')](_0x27a95a[_0xc86d('0x41')]);_0x4bca38['filters']=_[_0xc86d('0x46')](_0x4bca38[_0xc86d('0x44')],_0x4bca38['query']);_0x496258[_0xc86d('0x45')]=_[_0xc86d('0x46')](_0x4bca38['model'],qs[_0xc86d('0x47')](_0x27a95a['query'][_0xc86d('0x47')]));_0x496258[_0xc86d('0x45')]=_0x496258[_0xc86d('0x45')][_0xc86d('0x63')]?_0x496258[_0xc86d('0x45')]:_0x4bca38['model'];if(!_0x27a95a[_0xc86d('0x41')][_0xc86d('0x48')](_0xc86d('0xc7'))){_0x496258[_0xc86d('0x22')]=qs[_0xc86d('0x22')](_0x27a95a[_0xc86d('0x41')]['limit']);_0x496258[_0xc86d('0x24')]=qs[_0xc86d('0x24')](_0x27a95a[_0xc86d('0x41')]['offset']);}_0x496258[_0xc86d('0xc8')]=qs[_0xc86d('0xc9')](_0x27a95a['query'][_0xc86d('0xc9')]);_0x496258[_0xc86d('0x49')]=qs[_0xc86d('0x43')](_['pick'](_0x27a95a[_0xc86d('0x41')],_0x4bca38[_0xc86d('0x43')]));_0x496258[_0xc86d('0x49')]['WhatsappInteractionId']=_0x3820aa['id'];if(_0x27a95a[_0xc86d('0x41')][_0xc86d('0x8b')]){_0x496258['where']=_[_0xc86d('0xa0')](_0x496258[_0xc86d('0x49')],{'$or':_[_0xc86d('0x72')](_0x496258['attributes'],function(_0x2f4a6b){var _0x4a2e17={};_0x4a2e17[_0x2f4a6b]={'$like':'%'+_0x27a95a[_0xc86d('0x41')][_0xc86d('0x8b')]+'%'};return _0x4a2e17;})});}if(_0x27a95a[_0xc86d('0x41')][_0xc86d('0x80')]){var _0x4437b3=_0x27a95a[_0xc86d('0x41')]['$gte']['split'](',');var _0x5de776={};_0x5de776[_0x4437b3[0x0]]={'$gte':moment(_0x4437b3[0x1])[_0xc86d('0xca')]('YYYY-MM-DD\x20HH:mm:ss')};_0x496258['where']=_[_0xc86d('0xa0')](_0x496258[_0xc86d('0x49')],_0x5de776);}_0x496258=_[_0xc86d('0xa0')]({},_0x496258,_0x27a95a['options']);return db['WhatsappMessage']['count']({'where':_0x496258['where']})[_0xc86d('0x2a')](function(_0x186c8a){_0x4280f7[_0xc86d('0x23')]=_0x186c8a;if(_0x27a95a['query']['includeAll']){_0x496258[_0xc86d('0xbb')]=[{'all':!![]}];}return db[_0xc86d('0xc6')][_0xc86d('0xcb')](_0x496258);})['then'](function(_0x1f6abb){_0x4280f7[_0xc86d('0xb8')]=_0x1f6abb;return _0x4280f7;});}})[_0xc86d('0x2a')](respondWithFilteredResult(_0x42dae8,_0x496258))[_0xc86d('0x35')](handleError(_0x42dae8,null));};exports[_0xc86d('0xcc')]=function(_0x538eac,_0x428b69,_0x2d63c5){return db['WhatsappInteraction']['find']({'where':{'id':_0x538eac[_0xc86d('0xbf')]['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x428b69,null))[_0xc86d('0x2a')](function(_0x230c63){if(_0x230c63){return _0x230c63[_0xc86d('0xcd')](_0x538eac[_0xc86d('0xbe')][_0xc86d('0xc3')],_[_0xc86d('0xc4')](_0x538eac[_0xc86d('0xbe')],[_0xc86d('0xc3'),'id'])||{})[_0xc86d('0xce')](function(){return db[_0xc86d('0x71')][_0xc86d('0xcb')]({'attributes':['id',_0xc86d('0x2d'),'color'],'where':{'id':_0x538eac[_0xc86d('0xbe')][_0xc86d('0xc3')]}});})['then'](function(_0x5bcd2a){socket[_0xc86d('0xcf')](_0xc86d('0xd0'),{'id':Number(_0x538eac[_0xc86d('0xbf')]['id']),'tags':_0x5bcd2a||[]});return{'id':Number(_0x538eac['params']['id']),'tags':_0x5bcd2a||[]};});}})[_0xc86d('0x2a')](respondWithResult(_0x428b69,null))[_0xc86d('0x35')](handleError(_0x428b69,null));};exports[_0xc86d('0xd1')]=function(_0x4be8b1,_0x2953ac,_0x405cbf){return db[_0xc86d('0x3d')][_0xc86d('0x77')]({'where':{'id':_0x4be8b1[_0xc86d('0xbf')]['id']}})['then'](handleEntityNotFound(_0x2953ac,null))[_0xc86d('0x2a')](function(_0x31ea6e){if(_0x31ea6e){return _0x31ea6e[_0xc86d('0xd1')](_0x4be8b1[_0xc86d('0x41')][_0xc86d('0xc3')]);}})[_0xc86d('0x2a')](respondWithStatusCode(_0x2953ac,null))[_0xc86d('0x35')](handleError(_0x2953ac,null));};exports['download']=function(_0x366d41,_0x367409){var _0x1fcbdc=moment()[_0xc86d('0xd2')]()['toString']();var _0x34adda=path[_0xc86d('0xd3')](config[_0xc86d('0xd4')],_0xc86d('0xd5'),'files',_0xc86d('0xd6'));var _0xda3c27=path[_0xc86d('0xd3')](config[_0xc86d('0xd4')],_0xc86d('0xd5'),_0xc86d('0xd7'),_0xc86d('0xd8'));var _0x5bfc62=path[_0xc86d('0xd3')](_0x34adda,_0x1fcbdc);var _0x6fefb1=util['format'](_0xc86d('0xd9'),_0x366d41[_0xc86d('0xbf')]['id'],_0x1fcbdc);var _0x170b62=path[_0xc86d('0xd3')](_0x34adda,_0x6fefb1);var _0x33c099=[];_0x33c099[_0xc86d('0x34')]({'model':db[_0xc86d('0x75')],'as':_0xc86d('0x75'),'attributes':['id',_0xc86d('0x2f')],'raw':!![]});_0x33c099[_0xc86d('0x34')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xc86d('0xda'),_0xc86d('0xdb')],'raw':!![]});if(_0x366d41[_0xc86d('0x41')][_0xc86d('0xd8')]){_0x33c099['push']({'model':db['Attachment'],'as':_0xc86d('0xdc'),'raw':!![]});}var _0x367c67=[{'model':db['WhatsappMessage'],'as':_0xc86d('0xdd'),'attributes':['id',_0xc86d('0xbe'),_0xc86d('0x7e'),_0xc86d('0xde'),_0xc86d('0xdf'),_0xc86d('0x86')],'include':_0x33c099}];_0x367c67[_0xc86d('0x34')]({'model':db[_0xc86d('0xe0')],'as':_0xc86d('0xe1'),'attributes':['id',_0xc86d('0x2d')]});_0x367c67[_0xc86d('0x34')]({'model':db['User'],'as':_0xc86d('0xe2'),'attributes':['id',_0xc86d('0x2f')]});return db[_0xc86d('0x3d')][_0xc86d('0x77')]({'where':{'id':_0x366d41['params']['id']},'include':_0x367c67})['then'](handleEntityNotFound(_0x367409,null))[_0xc86d('0x2a')](function(_0x10f0b8){if(_0x10f0b8){var _0xcaaa5d=_0x10f0b8[_0xc86d('0xe3')]({'plain':!![]});fs[_0xc86d('0xe4')](_0x5bfc62);var _0x18758a={'channel':'Whatsapp','account':_0xcaaa5d[_0xc86d('0xe1')][_0xc86d('0x2d')],'agent':_0xcaaa5d[_0xc86d('0xe2')]?_0xcaaa5d['Owner']['fullname']:_0xc86d('0xe5'),'createdAt':moment(_0xcaaa5d['createdAt'])[_0xc86d('0xca')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0xcaaa5d['closed']?moment(_0xcaaa5d['closedAt'])[_0xc86d('0xca')](_0xc86d('0xe6'))[_0xc86d('0x9f')]():'','disposition':_0xcaaa5d[_0xc86d('0xe7')],'messages':_(_0xcaaa5d[_0xc86d('0xdd')])['filter']({'secret':![]})[_0xc86d('0x72')](function(_0x1d931a){if(_0x1d931a[_0xc86d('0xdc')]){var _0x55cb12=path[_0xc86d('0xd3')](_0xda3c27,_0x1d931a[_0xc86d('0xdc')][_0xc86d('0xe8')]);if(fs['existsSync'](_0x55cb12)){fs[_0xc86d('0xe9')](_0x55cb12)[_0xc86d('0xea')](fs[_0xc86d('0xeb')](path[_0xc86d('0xd3')](_0x5bfc62,_0x1d931a[_0xc86d('0xdc')][_0xc86d('0xe8')])));}}return{'date':moment(_0x1d931a['createdAt'])[_0xc86d('0xca')](_0xc86d('0xe6'))['toString'](),'sender':_0x1d931a[_0xc86d('0xde')]===_0xc86d('0xec')?_0x1d931a[_0xc86d('0x75')]?_0x1d931a[_0xc86d('0x75')][_0xc86d('0x2f')]:_0xc86d('0xed'):_0x1d931a['Contact']['firstName']+(_0x1d931a['Contact']['lastName']?'\x20'+_0x1d931a[_0xc86d('0x68')][_0xc86d('0xdb')]:''),'body':_0x1d931a['Attachment']?_0x1d931a[_0xc86d('0xdc')][_0xc86d('0xe8')]:_0x1d931a[_0xc86d('0xbe')],'direction':_0x1d931a['direction']==='out'?'A':'C','secret':_0x1d931a['secret'],'read':_0x1d931a[_0xc86d('0x86')],'attachment':_0x1d931a[_0xc86d('0xdc')]};})['value']()};return ejs[_0xc86d('0xee')](path[_0xc86d('0xd3')](config[_0xc86d('0xd4')],_0xc86d('0xd5'),_0xc86d('0xef'),_0xc86d('0xf0')),{'interaction':_0x18758a})['then'](function(_0x2f79f5){var _0x2b02d0=path['join'](_0x5bfc62,_0xc86d('0xf1')+_0xcaaa5d['id']+'-'+_0x1fcbdc+'.pdf');var _0x12ff5a={'path':_0x2b02d0,'channel':'Whatsapp','interactionId':_0xcaaa5d['id']};return pdf[_0xc86d('0xf2')](_0x2f79f5,_0x12ff5a);})[_0xc86d('0x2a')](function(){return new BPromise(function(_0x30a3f8,_0x1b1b10){zipdir(_0x5bfc62,{'saveTo':_0x170b62},function(_0xf2a9c5,_0x35a1d2){if(_0xf2a9c5)return _0x1b1b10(_0xf2a9c5);return _0x30a3f8(_0x35a1d2);});})['then'](function(){return new BPromise(function(_0x14e246,_0x50b50c){rimraf(_0x5bfc62,function(_0x2b7a9e){if(_0x2b7a9e)_0x50b50c(_0x2b7a9e);return _0x14e246();});});})[_0xc86d('0x2a')](function(){return _0x367409[_0xc86d('0xf3')](_0x170b62,_0x6fefb1,function(_0x352450){if(_0x352450){console[_0xc86d('0xf4')](_0xc86d('0xf5'),_0x352450);}else{fs['unlinkSync'](_0x170b62);}});});});}else{return _0x367409['sendStatus'](0xc8);}})[_0xc86d('0x35')](handleError(_0x367409,null));}; \ No newline at end of file +var _0xa321=['whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','some','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','toString','count','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','merge','create','body','describe','addMessage','omit','findOne','WhatsappMessage','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','ids','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','direction','out','firstName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','save','update','end','error','stack','name','send','Users','map','split','forEach','Tags','push','then','catch','talking','answered','unmanaged','closed','UserId','waiting','total','index','WhatsappInteraction','rawAttributes','type','key','model','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages'];(function(_0x5906a5,_0x48af0a){var _0x1b9a31=function(_0x4b72ac){while(--_0x4b72ac){_0x5906a5['push'](_0x5906a5['shift']());}};_0x1b9a31(++_0x48af0a);}(_0xa321,0x9d));var _0x1a32=function(_0x40162a,_0x265b0c){_0x40162a=_0x40162a-0x0;var _0x488161=_0xa321[_0x40162a];return _0x488161;};'use strict';var emlformat=require(_0x1a32('0x0'));var rimraf=require(_0x1a32('0x1'));var zipdir=require(_0x1a32('0x2'));var jsonpatch=require(_0x1a32('0x3'));var rp=require('request-promise');var moment=require(_0x1a32('0x4'));var BPromise=require(_0x1a32('0x5'));var Mustache=require('mustache');var util=require(_0x1a32('0x6'));var path=require(_0x1a32('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a32('0x8'));var _=require('lodash');var squel=require(_0x1a32('0x9'));var crypto=require(_0x1a32('0xa'));var jsforce=require(_0x1a32('0xb'));var deskjs=require(_0x1a32('0xc'));var toCsv=require(_0x1a32('0xd'));var querystring=require('querystring');var Papa=require(_0x1a32('0xe'));var Redis=require(_0x1a32('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1a32('0x10'));var as=require(_0x1a32('0x11'));var pdf=require(_0x1a32('0x12'));var hardwareService=require(_0x1a32('0x13'));var logger=require(_0x1a32('0x14'))(_0x1a32('0x15'));var utils=require('../../config/utils');var config=require(_0x1a32('0x16'));var licenseUtil=require(_0x1a32('0x17'));var db=require(_0x1a32('0x18'))['db'];config['redis']=_[_0x1a32('0x19')](config[_0x1a32('0x1a')],{'host':_0x1a32('0x1b'),'port':0x18eb});var socket=require(_0x1a32('0x1c'))(new Redis(config[_0x1a32('0x1a')]));require('./whatsappInteraction.socket')[_0x1a32('0x1d')](socket);function respondWithStatusCode(_0x456e81,_0x1838d2){_0x1838d2=_0x1838d2||0xcc;return function(_0x268b0a){if(_0x268b0a){return _0x456e81[_0x1a32('0x1e')](_0x1838d2);}return _0x456e81[_0x1a32('0x1f')](_0x1838d2)['end']();};}function respondWithResult(_0x29c53d,_0x463763){_0x463763=_0x463763||0xc8;return function(_0x47bb8e){if(_0x47bb8e){return _0x29c53d[_0x1a32('0x1f')](_0x463763)[_0x1a32('0x20')](_0x47bb8e);}};}function respondWithFilteredResult(_0x2cac28,_0x3b2983){return function(_0x43404b){if(_0x43404b){var _0x303afb=typeof _0x3b2983[_0x1a32('0x21')]===_0x1a32('0x22')&&typeof _0x3b2983[_0x1a32('0x23')]===_0x1a32('0x22');var _0x2f6381=_0x43404b['count'];var _0x3231b2=_0x303afb?0x0:_0x3b2983[_0x1a32('0x21')];var _0x235fd0=_0x303afb?_0x43404b['count']:_0x3b2983[_0x1a32('0x21')]+_0x3b2983[_0x1a32('0x23')];var _0x4af60a;if(_0x235fd0>=_0x2f6381){_0x235fd0=_0x2f6381;_0x4af60a=0xc8;}else{_0x4af60a=0xce;}_0x2cac28[_0x1a32('0x1f')](_0x4af60a);return _0x2cac28['set'](_0x1a32('0x24'),_0x3231b2+'-'+_0x235fd0+'/'+_0x2f6381)[_0x1a32('0x20')](_0x43404b);}return null;};}function patchUpdates(_0x4bbf42){return function(_0x2765e2){try{jsonpatch[_0x1a32('0x25')](_0x2765e2,_0x4bbf42,!![]);}catch(_0x2c93b0){return BPromise['reject'](_0x2c93b0);}return _0x2765e2[_0x1a32('0x26')]();};}function saveUpdates(_0x1fe746,_0x4bf0a0){return function(_0x372b95){if(_0x372b95){return _0x372b95[_0x1a32('0x27')](_0x1fe746)['then'](function(_0x41c892){return _0x41c892;});}return null;};}function removeEntity(_0x4b3b33,_0x4c183c){return function(_0x5edf08){if(_0x5edf08){return _0x5edf08['destroy']()['then'](function(){_0x4b3b33[_0x1a32('0x1f')](0xcc)[_0x1a32('0x28')]();});}};}function handleEntityNotFound(_0x4771b7,_0x2094fa){return function(_0x382b3c){if(!_0x382b3c){_0x4771b7[_0x1a32('0x1e')](0x194);}return _0x382b3c;};}function handleError(_0x19e0e6,_0x2edc3e){_0x2edc3e=_0x2edc3e||0x1f4;return function(_0x48d69d){logger[_0x1a32('0x29')](_0x48d69d[_0x1a32('0x2a')]);if(_0x48d69d[_0x1a32('0x2b')]){delete _0x48d69d[_0x1a32('0x2b')];}_0x19e0e6[_0x1a32('0x1f')](_0x2edc3e)[_0x1a32('0x2c')](_0x48d69d);};}function getInteractionUsers(_0x821dbf,_0x1211e2){return new BPromise(function(_0x3bc28a,_0x54b122){try{if(_0x1211e2[_0x821dbf['id']]){_0x821dbf[_0x1a32('0x2d')]=_[_0x1a32('0x2e')](_0x1211e2[_0x821dbf['id']],function(_0x4f2dfc){return{'id':_0x4f2dfc['id'],'fullname':_0x4f2dfc['fullname']};});}}catch(_0xd3bf6e){_0x54b122(_0xd3bf6e);}_0x3bc28a(_0x821dbf);});}function getInteractionTags(_0x582606,_0x5b9f13){return new BPromise(function(_0x1d874e,_0x4ef9fd){try{if(_0x582606['TagIds']){_0x582606['Tags']=[];_0x582606['TagIds'][_0x1a32('0x2f')](',')[_0x1a32('0x30')](function(_0x7c255c){_0x582606[_0x1a32('0x31')][_0x1a32('0x32')](_0x5b9f13[_0x7c255c]);});}delete _0x582606['TagIds'];}catch(_0x53a6c7){_0x4ef9fd(_0x53a6c7);}_0x1d874e(_0x582606);});}function updateWhatsappInteraction(_0x3d6385,_0x4f430c,_0xd2455c){return new BPromise(function(_0x1b7d21,_0xfb0096){return getInteractionUsers(_0x3d6385,_0xd2455c)['then'](function(_0x24afda){return getInteractionTags(_0x24afda,_0x4f430c);})[_0x1a32('0x33')](function(_0x2121e2){return getStateInteraction(_0x2121e2);})[_0x1a32('0x33')](function(_0x3acb50){_0x1b7d21(_0x3acb50);})[_0x1a32('0x34')](function(_0x365ad9){_0xfb0096(_0x365ad9);});});}function getStateInteraction(_0x2e4b5c){return new BPromise(function(_0x1b0b1e){_0x2e4b5c['waiting']=0x0;_0x2e4b5c[_0x1a32('0x35')]=0x0;_0x2e4b5c[_0x1a32('0x36')]=0x0;_0x2e4b5c[_0x1a32('0x37')]=0x0;_0x2e4b5c['total']=0x0;if(!_0x2e4b5c[_0x1a32('0x38')]&&!_0x2e4b5c[_0x1a32('0x39')]){_0x2e4b5c[_0x1a32('0x3a')]+=0x1;}if(!_0x2e4b5c[_0x1a32('0x38')]&&_0x2e4b5c[_0x1a32('0x39')]){_0x2e4b5c[_0x1a32('0x35')]+=0x1;if(_0x2e4b5c[_0x1a32('0x3a')]){_0x2e4b5c[_0x1a32('0x3a')]-=0x1;}}if(_0x2e4b5c[_0x1a32('0x38')]&&_0x2e4b5c[_0x1a32('0x39')]){_0x2e4b5c[_0x1a32('0x36')]+=0x1;if(_0x2e4b5c[_0x1a32('0x35')]){_0x2e4b5c[_0x1a32('0x35')]-=0x1;}}if(_0x2e4b5c[_0x1a32('0x38')]&&!_0x2e4b5c[_0x1a32('0x39')]){_0x2e4b5c['unmanaged']+=0x1;if(_0x2e4b5c['waiting']){_0x2e4b5c['waiting']-=0x1;}}_0x2e4b5c[_0x1a32('0x3b')]+=0x1;_0x1b0b1e(_0x2e4b5c);});}exports[_0x1a32('0x3c')]=function(_0x1f1a98,_0x1745bd){var _0xeb42f7={},_0x54150d={},_0x14b8de={'count':0x0,'rows':[]};var _0x9638ff=_[_0x1a32('0x2e')](db[_0x1a32('0x3d')][_0x1a32('0x3e')],function(_0x466fab){return{'name':_0x466fab['fieldName'],'type':_0x466fab[_0x1a32('0x3f')][_0x1a32('0x40')]};});_0x54150d[_0x1a32('0x41')]=_[_0x1a32('0x2e')](_0x9638ff,_0x1a32('0x2b'));_0x54150d['query']=_['keys'](_0x1f1a98['query']);_0x54150d['filters']=_[_0x1a32('0x42')](_0x54150d[_0x1a32('0x41')],_0x54150d['query']);_0xeb42f7[_0x1a32('0x43')]=_[_0x1a32('0x42')](_0x54150d[_0x1a32('0x41')],qs[_0x1a32('0x44')](_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x44')]));_0xeb42f7[_0x1a32('0x43')]=_0xeb42f7[_0x1a32('0x43')][_0x1a32('0x46')]?_0xeb42f7[_0x1a32('0x43')]:_0x54150d[_0x1a32('0x41')];if(!_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x47')]('nolimit')){_0xeb42f7[_0x1a32('0x23')]=qs['limit'](_0x1f1a98['query'][_0x1a32('0x23')]);_0xeb42f7['offset']=qs[_0x1a32('0x21')](_0x1f1a98['query'][_0x1a32('0x21')]);}_0xeb42f7[_0x1a32('0x48')]=qs[_0x1a32('0x49')](_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x49')]);_0xeb42f7[_0x1a32('0x4a')]=qs[_0x1a32('0x4b')](_[_0x1a32('0x4c')](_0x1f1a98[_0x1a32('0x45')],_0x54150d['filters']),_0x9638ff);var _0x3e0bad=[];var _0x1514ef=squel[_0x1a32('0x4d')]()['field']('id')[_0x1a32('0x4e')](_0x1a32('0x2b'))[_0x1a32('0x4e')](_0x1a32('0x4f'))[_0x1a32('0x50')]('tools_tags');var _0x31e568=squel[_0x1a32('0x4d')]()[_0x1a32('0x4e')](_0x1a32('0x51'))[_0x1a32('0x4e')](_0x1a32('0x52'))[_0x1a32('0x4e')](_0x1a32('0x53'))[_0x1a32('0x50')]('user_has_whatsapp_interactions','ui')[_0x1a32('0x54')](_0x1a32('0x55'),'u',_0x1a32('0x56'));var _0x4a0042=squel[_0x1a32('0x4d')]()[_0x1a32('0x50')]('whatsapp_interactions','i')[_0x1a32('0x54')](_0x1a32('0x57'),'c',_0x1a32('0x58'))['left_join'](_0x1a32('0x55'),'o',_0x1a32('0x59'))['left_join'](_0x1a32('0x5a'),'a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0x1a32('0x5b'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x1a32('0x5c'),'it',_0x1a32('0x5d'))[_0x1a32('0x54')](_0x1a32('0x5e'),'t',_0x1a32('0x5f'));var _0x698ad2=squel[_0x1a32('0x60')]();var _0x484224=[];var _0x49ed24=squel[_0x1a32('0x60')]();var _0x572e54;if(_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x61')]){_0x572e54=as[_0x1a32('0x62')](_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x61')]);var _0x54566a=_0x572e54[_0x1a32('0x63')];for(var _0x2b77f9=0x0;_0x2b77f9<_0x572e54[_0x1a32('0x64')]['length'];_0x2b77f9++){var _0x5ea389=_0x572e54['conditions'][_0x2b77f9];var _0x29a0b9='i';var _0x41f088=_[_0x1a32('0x65')](_0x9638ff,[_0x1a32('0x2b'),_0x5ea389[_0x1a32('0x4e')]]);if(!_0x41f088){switch(_0x5ea389[_0x1a32('0x4e')]){case'unreadMessages':if(_0x5ea389['value']==0x1){_0x4a0042[_0x1a32('0x66')]('`'+_0x5ea389[_0x1a32('0x4e')]+_0x1a32('0x67'));}else{_0x4a0042[_0x1a32('0x66')]('`'+_0x5ea389[_0x1a32('0x4e')]+_0x1a32('0x68'));}break;case _0x1a32('0x69'):if(_0x5ea389['operator']===_0x1a32('0x6a')){if(_0x5ea389[_0x1a32('0x6b')][_0x1a32('0x2f')]('\x20')[_0x1a32('0x46')]>0x1){_0x698ad2[_0x54566a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1a32('0x6c')](_0x5ea389[_0x1a32('0x6b')]),null);}else{var _0x5c1cb6='%'+_0x5ea389[_0x1a32('0x6b')]+'%';_0x698ad2[_0x54566a](_0x1a32('0x6d'),_0x5c1cb6,_0x5c1cb6,_0x5c1cb6);}}else{_0x41f088=_[_0x1a32('0x65')](_0x9638ff,[_0x1a32('0x2b'),_0x1a32('0x6e')]);_0x5ea389[_0x1a32('0x4e')]=_0x1a32('0x6e');_0x557074=as[_0x1a32('0x6f')](_0x29a0b9,_0x41f088[_0x1a32('0x3f')],_0x5ea389);_0x698ad2[_0x54566a](_0x557074[_0x1a32('0x70')],_0x557074['value'][_0x1a32('0x71')],_0x557074[_0x1a32('0x6b')]['end']);}break;case _0x1a32('0x72'):var _0x6532b1=_0x5ea389['value']['split'](',')[_0x1a32('0x2e')](function(_0x3f0803){return Number(_0x3f0803);});_0x6532b1[_0x1a32('0x30')](function(_0x32b3cb){_0x49ed24['or'](_0x1a32('0x73'),'%,'+_0x32b3cb+',%');});_0x484224=_[_0x1a32('0x74')](_0x484224,_0x6532b1);break;case _0x1a32('0x75'):if(_0x5ea389['operator']===_0x1a32('0x6a')){_0x698ad2[_0x54566a](_0x1a32('0x76'),'%'+_0x5ea389['value']+'%',null);}else{_0x41f088=_[_0x1a32('0x65')](_0x9638ff,[_0x1a32('0x2b'),_0x1a32('0x39')]);_0x5ea389[_0x1a32('0x4e')]=_0x1a32('0x39');_0x557074=as[_0x1a32('0x6f')](_0x29a0b9,_0x41f088[_0x1a32('0x3f')],_0x5ea389);_0x698ad2[_0x54566a](_0x557074[_0x1a32('0x70')],_0x557074[_0x1a32('0x6b')][_0x1a32('0x71')],_0x557074[_0x1a32('0x6b')][_0x1a32('0x28')]);}break;case'body':_0x557074=as['buildExpression']('me',null,_0x5ea389);_0x698ad2[_0x54566a](_0x557074[_0x1a32('0x70')],_0x557074[_0x1a32('0x6b')][_0x1a32('0x71')],_0x557074[_0x1a32('0x6b')][_0x1a32('0x28')]);break;}}else{var _0x557074=as['buildExpression'](_0x29a0b9,_0x41f088[_0x1a32('0x3f')],_0x5ea389);_0x698ad2[_0x54566a](_0x557074[_0x1a32('0x70')],_0x557074['value'][_0x1a32('0x71')],_0x557074[_0x1a32('0x6b')][_0x1a32('0x28')]);}}}else{var _0x5d2de7=_(_0x1f1a98['query'])[_0x1a32('0x77')]()[_0x1a32('0x2e')](function(_0x1b7a9e){return _[_0x1a32('0x78')](_0x9638ff,[_0x1a32('0x2b'),_0x1b7a9e])?_0x1b7a9e:undefined;})['compact']()['value']();if(!_[_0x1a32('0x79')](_0x5d2de7)){_0x5d2de7[_0x1a32('0x30')](function(_0x297a79){if(_0x297a79==='WhatsappAccountId'){_0x4a0042[_0x1a32('0x4a')](_0x1a32('0x7a'),[][_0x1a32('0x7b')](_0x1f1a98['query'][_0x297a79]));}else if(_0x297a79==='createdAt'){var _0x53e980=JSON[_0x1a32('0x7c')](_0x1f1a98[_0x1a32('0x45')][_0x297a79])[_0x1a32('0x7d')];var _0x4c4b23=JSON[_0x1a32('0x7c')](_0x1f1a98[_0x1a32('0x45')][_0x297a79])[_0x1a32('0x7e')];_0x4a0042[_0x1a32('0x4a')](_0x1a32('0x7f'),_0x53e980,_0x4c4b23);}else{if(_0x1f1a98[_0x1a32('0x45')][_0x297a79]===_0x1a32('0x80')){_0x4a0042[_0x1a32('0x4a')]('i.'+_0x297a79+_0x1a32('0x81'));}else{_0x4a0042[_0x1a32('0x4a')]('i.'+_0x297a79+'\x20=\x20?',_0x1f1a98[_0x1a32('0x45')][_0x297a79]);}}});}if(_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x82')]){if(_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x82')]==0x1){_0x4a0042[_0x1a32('0x66')](_0x1a32('0x83'));}else{_0x4a0042[_0x1a32('0x66')](_0x1a32('0x84'));}}if(_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x85')]){_0x484224=_[_0x1a32('0x86')](_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x85')])?_0x1f1a98['query'][_0x1a32('0x85')]:new Array(_0x1f1a98[_0x1a32('0x45')]['tag']);_0x484224['forEach'](function(_0x104ddb){_0x49ed24['or'](_0x1a32('0x73'),'%,'+_0x104ddb+',%');});}if(_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x87')]){var _0x152d98=_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x87')][_0x1a32('0x88')]('\x5c','\x5c\x5c')[_0x1a32('0x88')](/'/g,'\x27\x27');if(qs[_0x1a32('0x89')](_0x152d98)){_0x698ad2['or'](_0x1a32('0x8a'),_0x152d98+'%')['or'](_0x1a32('0x8b'),_0x152d98+'%');}else{_0x698ad2['or'](_0x1a32('0x8c'),qs[_0x1a32('0x6c')](_0x152d98))['or'](_0x1a32('0x8d'),_0x152d98+'%');}}}_0x4a0042[_0x1a32('0x4a')](_0x698ad2);_0x4a0042[_0x1a32('0x8e')](_0x1a32('0x8f'));var _0x3b6d11={'type':db[_0x1a32('0x90')][_0x1a32('0x91')][_0x1a32('0x92')],'raw':!![]};var _0x38ec64=_0x4a0042[_0x1a32('0x93')]();_0x38ec64['field']('i.id');_0x38ec64[_0x1a32('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1a32('0x94'));if(_0xeb42f7[_0x1a32('0x48')]){_0xeb42f7[_0x1a32('0x48')][_0x1a32('0x30')](function(_0x17d6e9){var _0x33beff=_0x17d6e9[0x0]===_0x1a32('0x95')?_0x17d6e9[0x0]:'i.'+_0x17d6e9[0x0];_0x4a0042['order'](_0x33beff,_0x17d6e9[0x1]===_0x1a32('0x96')?![]:!![]);});}if(!_[_0x1a32('0x79')](_0x484224)){_0x4a0042[_0x1a32('0x66')](_0x49ed24);_0x38ec64[_0x1a32('0x4a')](_0x1a32('0x97'),_0x484224);}BPromise[_0x1a32('0x98')]()[_0x1a32('0x33')](function(){if(!_0x572e54){if(_0x1f1a98[_0x1a32('0x45')][_0x1a32('0x99')])return;_0x38ec64[_0x1a32('0x4a')](_0x1a32('0x9a'));_0x4a0042['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1f1a98[_0x1a32('0x9b')][_0x1a32('0x9c')]!==_0x1a32('0x9d'))return;return _0x1f1a98[_0x1a32('0x9b')][_0x1a32('0x9e')]({'attributes':['id'],'raw':!![]})[_0x1a32('0x33')](function(_0x346493){if(_[_0x1a32('0x79')](_0x346493)){_0x38ec64['where']('i.WhatsappAccountId\x20IS\x20NULL');_0x4a0042[_0x1a32('0x4a')](_0x1a32('0x9f'));}else{_0x38ec64[_0x1a32('0x4a')]('i.WhatsappAccountId\x20IN\x20?',_[_0x1a32('0x2e')](_0x346493,'id'));_0x4a0042['where'](_0x1a32('0x7a'),_['map'](_0x346493,'id'));}});})[_0x1a32('0x33')](function(){if(_0x1f1a98[_0x1a32('0x9b')][_0x1a32('0x9c')]===_0x1a32('0x9d')&&!_0x572e54&&!_0x1f1a98[_0x1a32('0x45')]['WhatsappAccountId'])return[];return db['sequelize'][_0x1a32('0x45')](_0x38ec64[_0x1a32('0xa0')](),_0x3b6d11);})[_0x1a32('0x33')](function(_0xbdd559){_0x14b8de[_0x1a32('0xa1')]=_0xbdd559[_0x1a32('0x46')];if(_0x14b8de[_0x1a32('0xa1')]===0x0)return[];return db[_0x1a32('0xa2')]['query'](_0x1514ef[_0x1a32('0xa0')](),_0x3b6d11)[_0x1a32('0x33')](function(_0x52b52b){_0x3e0bad=_[_0x1a32('0xa3')](_0x52b52b,'id');_0x3b6d11=_['merge'](_0x3b6d11,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f1a98[_0x1a32('0x45')]['fields']){_0xeb42f7[_0x1a32('0x43')][_0x1a32('0x30')](function(_0x510be6){_0x4a0042[_0x1a32('0x4e')]('i.'+_0x510be6);});}else{_0x4a0042[_0x1a32('0x4e')](_0x1a32('0xa4'),_0x1a32('0x94'));_0x4a0042[_0x1a32('0x4e')](_0x1a32('0xa5'),_0x1a32('0xa6'));_0x4a0042[_0x1a32('0x4e')]('a.mandatoryDisposition',_0x1a32('0xa7'));_0x4a0042[_0x1a32('0x4e')]('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',_0x1a32('0x95'));_0x4a0042['field'](_0x1a32('0xa8'));_0x4a0042[_0x1a32('0x4e')](_0x1a32('0xa9'),_0x1a32('0xaa'));_0x4a0042[_0x1a32('0x4e')](_0x1a32('0xab'),_0x1a32('0xac'));_0x4a0042['field'](_0x1a32('0xad'),_0x1a32('0xae'));_0x4a0042[_0x1a32('0x4e')](_0x1a32('0xaf'),_0x1a32('0xb0'));_0x4a0042[_0x1a32('0x4e')](_0x1a32('0xb1'),'Contact.mobile');_0x4a0042[_0x1a32('0x4e')]('c.fax','Contact.fax');_0x4a0042[_0x1a32('0x4e')](_0x1a32('0xb2'),_0x1a32('0xb3'));_0x4a0042[_0x1a32('0x4e')](_0x1a32('0xb4'),'Owner.internal');_0x4a0042[_0x1a32('0x4e')](_0x1a32('0xb5'),_0x1a32('0xb6'));}if(_0xeb42f7[_0x1a32('0x23')])_0x4a0042[_0x1a32('0x23')](_0xeb42f7[_0x1a32('0x23')]);if(_0xeb42f7['offset'])_0x4a0042['offset'](_0xeb42f7[_0x1a32('0x21')]);return db[_0x1a32('0xa2')][_0x1a32('0x45')](_0x4a0042[_0x1a32('0xa0')](),_0x3b6d11);})[_0x1a32('0x33')](function(_0x8fd415){if(_0x8fd415['length']>0x0)_0x31e568[_0x1a32('0x4a')](_0x1a32('0xb7'),_[_0x1a32('0x2e')](_0x8fd415,'id'));return db['sequelize'][_0x1a32('0x45')](_0x31e568['toString'](),_0x3b6d11)[_0x1a32('0x33')](function(_0x2c4ca7){var _0x48f101=_[_0x1a32('0xb8')](_0x2c4ca7,_0x1a32('0xb9'));var _0x536d69=[];_0x8fd415[_0x1a32('0x30')](function(_0x21adac){_0x536d69[_0x1a32('0x32')](updateWhatsappInteraction(_0x21adac,_0x3e0bad,_0x48f101));});return BPromise[_0x1a32('0xba')](_0x536d69);});});})[_0x1a32('0x33')](function(_0x27c971){_0x14b8de[_0x1a32('0xbb')]=_0x27c971;return _0x14b8de;})[_0x1a32('0x33')](respondWithFilteredResult(_0x1745bd,_0xeb42f7))[_0x1a32('0x34')](handleError(_0x1745bd,null));};exports[_0x1a32('0xbc')]=function(_0x2596ea,_0x5bee01){var _0x371964={'raw':![],'where':{'id':_0x2596ea[_0x1a32('0xbd')]['id']}},_0x3d67d1={};_0x3d67d1[_0x1a32('0x41')]=_[_0x1a32('0x77')](db[_0x1a32('0x3d')][_0x1a32('0x3e')]);_0x3d67d1[_0x1a32('0x45')]=_[_0x1a32('0x77')](_0x2596ea[_0x1a32('0x45')]);_0x3d67d1[_0x1a32('0x4b')]=_[_0x1a32('0x42')](_0x3d67d1['model'],_0x3d67d1['query']);_0x371964[_0x1a32('0x43')]=_[_0x1a32('0x42')](_0x3d67d1['model'],qs['fields'](_0x2596ea[_0x1a32('0x45')][_0x1a32('0x44')]));_0x371964[_0x1a32('0x43')]=_0x371964['attributes'][_0x1a32('0x46')]?_0x371964[_0x1a32('0x43')]:_0x3d67d1['model'];if(_0x2596ea['query'][_0x1a32('0xbe')]){_0x371964[_0x1a32('0xbf')]=[{'all':!![]}];}_0x371964=_[_0x1a32('0xc0')]({},_0x371964,_0x2596ea['options']);return db[_0x1a32('0x3d')][_0x1a32('0x65')](_0x371964)[_0x1a32('0x33')](handleEntityNotFound(_0x5bee01,null))['then'](respondWithResult(_0x5bee01,null))[_0x1a32('0x34')](handleError(_0x5bee01,null));};exports[_0x1a32('0xc1')]=function(_0x15ca3f,_0x329457){return db[_0x1a32('0x3d')][_0x1a32('0xc1')](_0x15ca3f[_0x1a32('0xc2')],{})[_0x1a32('0x33')](respondWithResult(_0x329457,0xc9))[_0x1a32('0x34')](handleError(_0x329457,null));};exports[_0x1a32('0x27')]=function(_0x2b02b1,_0x49100a){if(_0x2b02b1['body']['id']){delete _0x2b02b1['body']['id'];}return db[_0x1a32('0x3d')][_0x1a32('0x65')]({'where':{'id':_0x2b02b1['params']['id']}})[_0x1a32('0x33')](handleEntityNotFound(_0x49100a,null))[_0x1a32('0x33')](saveUpdates(_0x2b02b1['body'],null))[_0x1a32('0x33')](respondWithResult(_0x49100a,null))['catch'](handleError(_0x49100a,null));};exports['destroy']=function(_0xa1d6c7,_0x2f6182){return db[_0x1a32('0x3d')][_0x1a32('0x65')]({'where':{'id':_0xa1d6c7[_0x1a32('0xbd')]['id']}})[_0x1a32('0x33')](handleEntityNotFound(_0x2f6182,null))[_0x1a32('0x33')](removeEntity(_0x2f6182,null))[_0x1a32('0x34')](handleError(_0x2f6182,null));};exports[_0x1a32('0xc3')]=function(_0x4d9048,_0x539f6d){return db['WhatsappInteraction'][_0x1a32('0xc3')]()['then'](respondWithResult(_0x539f6d,null))[_0x1a32('0x34')](handleError(_0x539f6d,null));};exports[_0x1a32('0xc4')]=function(_0x47c2d5,_0x809276,_0x4e22c3){return db['WhatsappMessage']['find']({'where':{'id':_0x47c2d5[_0x1a32('0xbd')]['id']}})['then'](handleEntityNotFound(_0x809276,null))[_0x1a32('0x33')](function(_0x4bd898){if(_0x4bd898){return _0x4bd898[_0x1a32('0xc4')](_0x47c2d5['body']['ids'],_[_0x1a32('0xc5')](_0x47c2d5['body'],['ids','id'])||{});}})[_0x1a32('0x33')](respondWithResult(_0x809276,null))['catch'](handleError(_0x809276,null));};exports['getMessages']=function(_0x689c9f,_0x1faf0d,_0x23468d){var _0x2e3339={'raw':![],'where':{}};var _0x339ff4={};var _0x4ade0a={'count':0x0,'rows':[]};return db[_0x1a32('0x3d')][_0x1a32('0xc6')]({'where':{'id':_0x689c9f['params']['id']}})[_0x1a32('0x33')](handleEntityNotFound(_0x1faf0d,null))[_0x1a32('0x33')](function(_0x44383e){if(_0x44383e){_0x339ff4[_0x1a32('0x41')]=_[_0x1a32('0x77')](db[_0x1a32('0xc7')][_0x1a32('0x3e')]);_0x339ff4['query']=_[_0x1a32('0x77')](_0x689c9f[_0x1a32('0x45')]);_0x339ff4[_0x1a32('0x4b')]=_[_0x1a32('0x42')](_0x339ff4[_0x1a32('0x41')],_0x339ff4[_0x1a32('0x45')]);_0x2e3339[_0x1a32('0x43')]=_['intersection'](_0x339ff4[_0x1a32('0x41')],qs[_0x1a32('0x44')](_0x689c9f[_0x1a32('0x45')]['fields']));_0x2e3339[_0x1a32('0x43')]=_0x2e3339[_0x1a32('0x43')]['length']?_0x2e3339['attributes']:_0x339ff4[_0x1a32('0x41')];if(!_0x689c9f[_0x1a32('0x45')][_0x1a32('0x47')](_0x1a32('0xc8'))){_0x2e3339['limit']=qs['limit'](_0x689c9f['query'][_0x1a32('0x23')]);_0x2e3339[_0x1a32('0x21')]=qs[_0x1a32('0x21')](_0x689c9f[_0x1a32('0x45')][_0x1a32('0x21')]);}_0x2e3339[_0x1a32('0x48')]=qs[_0x1a32('0x49')](_0x689c9f[_0x1a32('0x45')][_0x1a32('0x49')]);_0x2e3339['where']=qs[_0x1a32('0x4b')](_['pick'](_0x689c9f['query'],_0x339ff4['filters']));_0x2e3339[_0x1a32('0x4a')][_0x1a32('0xb9')]=_0x44383e['id'];if(_0x689c9f['query'][_0x1a32('0x87')]){_0x2e3339[_0x1a32('0x4a')]=_[_0x1a32('0xc0')](_0x2e3339['where'],{'$or':_[_0x1a32('0x2e')](_0x2e3339[_0x1a32('0x43')],function(_0x318a38){var _0x49fc5f={};_0x49fc5f[_0x318a38]={'$like':'%'+_0x689c9f[_0x1a32('0x45')][_0x1a32('0x87')]+'%'};return _0x49fc5f;})});}if(_0x689c9f['query'][_0x1a32('0x7d')]){var _0x20a65b=_0x689c9f[_0x1a32('0x45')][_0x1a32('0x7d')]['split'](',');var _0xc1ceca={};_0xc1ceca[_0x20a65b[0x0]]={'$gte':moment(_0x20a65b[0x1])[_0x1a32('0xc9')](_0x1a32('0xca'))};_0x2e3339[_0x1a32('0x4a')]=_[_0x1a32('0xc0')](_0x2e3339[_0x1a32('0x4a')],_0xc1ceca);}_0x2e3339=_[_0x1a32('0xc0')]({},_0x2e3339,_0x689c9f[_0x1a32('0xcb')]);return db[_0x1a32('0xc7')][_0x1a32('0xa1')]({'where':_0x2e3339['where']})[_0x1a32('0x33')](function(_0x3b6648){_0x4ade0a[_0x1a32('0xa1')]=_0x3b6648;if(_0x689c9f[_0x1a32('0x45')][_0x1a32('0xbe')]){_0x2e3339[_0x1a32('0xbf')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x2e3339);})[_0x1a32('0x33')](function(_0x1a840b){_0x4ade0a['rows']=_0x1a840b;return _0x4ade0a;});}})[_0x1a32('0x33')](respondWithFilteredResult(_0x1faf0d,_0x2e3339))['catch'](handleError(_0x1faf0d,null));};exports[_0x1a32('0xcc')]=function(_0x235067,_0x4f06d5,_0x52069b){return db['WhatsappInteraction'][_0x1a32('0x65')]({'where':{'id':_0x235067[_0x1a32('0xbd')]['id']}})[_0x1a32('0x33')](handleEntityNotFound(_0x4f06d5,null))['then'](function(_0x21ee15){if(_0x21ee15){return _0x21ee15[_0x1a32('0xcd')](_0x235067['body'][_0x1a32('0xce')],_[_0x1a32('0xc5')](_0x235067[_0x1a32('0xc2')],[_0x1a32('0xce'),'id'])||{})[_0x1a32('0xcf')](function(){return db[_0x1a32('0x72')]['findAll']({'attributes':['id',_0x1a32('0x2b'),_0x1a32('0x4f')],'where':{'id':_0x235067['body'][_0x1a32('0xce')]}});})['then'](function(_0x42096e){socket[_0x1a32('0xd0')](_0x1a32('0xd1'),{'id':Number(_0x235067[_0x1a32('0xbd')]['id']),'tags':_0x42096e||[]});return{'id':Number(_0x235067['params']['id']),'tags':_0x42096e||[]};});}})[_0x1a32('0x33')](respondWithResult(_0x4f06d5,null))[_0x1a32('0x34')](handleError(_0x4f06d5,null));};exports[_0x1a32('0xd2')]=function(_0x4b3ad1,_0x285481,_0x41ecbc){return db[_0x1a32('0x3d')][_0x1a32('0x65')]({'where':{'id':_0x4b3ad1[_0x1a32('0xbd')]['id']}})[_0x1a32('0x33')](handleEntityNotFound(_0x285481,null))['then'](function(_0x28f562){if(_0x28f562){return _0x28f562['removeTags'](_0x4b3ad1[_0x1a32('0x45')][_0x1a32('0xce')]);}})[_0x1a32('0x33')](respondWithStatusCode(_0x285481,null))[_0x1a32('0x34')](handleError(_0x285481,null));};exports[_0x1a32('0xd3')]=function(_0x48ad34,_0x5229e4){var _0x353e57=moment()[_0x1a32('0xd4')]()[_0x1a32('0xa0')]();var _0x406141=path[_0x1a32('0xd5')](config[_0x1a32('0xd6')],_0x1a32('0xd7'),_0x1a32('0xd8'),_0x1a32('0xd9'));var _0xed6ca2=path['join'](config[_0x1a32('0xd6')],'server','files',_0x1a32('0xda'));var _0x30b6a4=path[_0x1a32('0xd5')](_0x406141,_0x353e57);var _0xc36f07=util[_0x1a32('0xc9')](_0x1a32('0xdb'),_0x48ad34[_0x1a32('0xbd')]['id'],_0x353e57);var _0x32c043=path[_0x1a32('0xd5')](_0x406141,_0xc36f07);var _0x3e9b7d=[];_0x3e9b7d[_0x1a32('0x32')]({'model':db[_0x1a32('0x75')],'as':_0x1a32('0x75'),'attributes':['id',_0x1a32('0xdc')],'raw':!![]});_0x3e9b7d['push']({'model':db[_0x1a32('0xdd')],'as':'Contact','attributes':['id','firstName',_0x1a32('0xde')],'raw':!![]});if(_0x48ad34[_0x1a32('0x45')][_0x1a32('0xda')]){_0x3e9b7d[_0x1a32('0x32')]({'model':db[_0x1a32('0xdf')],'as':_0x1a32('0xdf'),'raw':!![]});}var _0x5df506=[{'model':db[_0x1a32('0xc7')],'as':'Messages','attributes':['id',_0x1a32('0xc2'),_0x1a32('0xe0'),'direction',_0x1a32('0xe1'),_0x1a32('0x82')],'include':_0x3e9b7d}];_0x5df506[_0x1a32('0x32')]({'model':db[_0x1a32('0xe2')],'as':_0x1a32('0xe3'),'attributes':['id','name']});_0x5df506[_0x1a32('0x32')]({'model':db[_0x1a32('0x75')],'as':'Owner','attributes':['id',_0x1a32('0xdc')]});return db[_0x1a32('0x3d')][_0x1a32('0x65')]({'where':{'id':_0x48ad34[_0x1a32('0xbd')]['id']},'include':_0x5df506})[_0x1a32('0x33')](handleEntityNotFound(_0x5229e4,null))[_0x1a32('0x33')](function(_0xbbd6e1){if(_0xbbd6e1){var _0x3ebff3=_0xbbd6e1[_0x1a32('0xe4')]({'plain':!![]});fs[_0x1a32('0xe5')](_0x30b6a4);var _0x3a2c05={'channel':_0x1a32('0xe6'),'account':_0x3ebff3[_0x1a32('0xe3')][_0x1a32('0x2b')],'agent':_0x3ebff3[_0x1a32('0xe7')]?_0x3ebff3[_0x1a32('0xe7')]['fullname']:_0x1a32('0xe8'),'createdAt':moment(_0x3ebff3['createdAt'])['format'](_0x1a32('0xca'))[_0x1a32('0xa0')](),'closedAt':_0x3ebff3['closed']?moment(_0x3ebff3[_0x1a32('0xe9')])[_0x1a32('0xc9')](_0x1a32('0xca'))[_0x1a32('0xa0')]():'','disposition':_0x3ebff3[_0x1a32('0xea')],'messages':_(_0x3ebff3['Messages'])[_0x1a32('0x87')]({'secret':![]})['map'](function(_0x49557b){if(_0x49557b[_0x1a32('0xdf')]){var _0x2e841b=path[_0x1a32('0xd5')](_0xed6ca2,_0x49557b[_0x1a32('0xdf')][_0x1a32('0xeb')]);if(fs[_0x1a32('0xec')](_0x2e841b)){fs[_0x1a32('0xed')](_0x2e841b)['pipe'](fs[_0x1a32('0xee')](path[_0x1a32('0xd5')](_0x30b6a4,_0x49557b[_0x1a32('0xdf')][_0x1a32('0xeb')])));}}return{'date':moment(_0x49557b[_0x1a32('0xe0')])[_0x1a32('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1a32('0xa0')](),'sender':_0x49557b[_0x1a32('0xef')]===_0x1a32('0xf0')?_0x49557b[_0x1a32('0x75')]?_0x49557b[_0x1a32('0x75')][_0x1a32('0xdc')]:'System':_0x49557b[_0x1a32('0x69')][_0x1a32('0xf1')]+(_0x49557b[_0x1a32('0x69')]['lastName']?'\x20'+_0x49557b[_0x1a32('0x69')]['lastName']:''),'body':_0x49557b[_0x1a32('0xdf')]?_0x49557b[_0x1a32('0xdf')][_0x1a32('0xeb')]:_0x49557b['body'],'direction':_0x49557b[_0x1a32('0xef')]===_0x1a32('0xf0')?'A':'C','secret':_0x49557b[_0x1a32('0xe1')],'read':_0x49557b[_0x1a32('0x82')],'attachment':_0x49557b['Attachment']};})['value']()};return ejs['renderFile'](path[_0x1a32('0xd5')](config[_0x1a32('0xd6')],'server',_0x1a32('0xf2'),_0x1a32('0xf3')),{'interaction':_0x3a2c05})[_0x1a32('0x33')](function(_0x40b13b){var _0x49f417=path['join'](_0x30b6a4,_0x1a32('0xf4')+_0x3ebff3['id']+'-'+_0x353e57+_0x1a32('0xf5'));var _0xad17fd={'path':_0x49f417,'channel':_0x1a32('0xe6'),'interactionId':_0x3ebff3['id']};return pdf[_0x1a32('0xf6')](_0x40b13b,_0xad17fd);})['then'](function(){return new BPromise(function(_0x57f957,_0x51d19a){zipdir(_0x30b6a4,{'saveTo':_0x32c043},function(_0x4b7ae2,_0x4d3a3c){if(_0x4b7ae2)return _0x51d19a(_0x4b7ae2);return _0x57f957(_0x4d3a3c);});})[_0x1a32('0x33')](function(){return new BPromise(function(_0x33ca16,_0x4db394){rimraf(_0x30b6a4,function(_0x502c49){if(_0x502c49)_0x4db394(_0x502c49);return _0x33ca16();});});})[_0x1a32('0x33')](function(){return _0x5229e4[_0x1a32('0xd3')](_0x32c043,_0xc36f07,function(_0x4d46a8){if(_0x4d46a8){console['log'](_0x1a32('0xf7'),_0x4d46a8);}else{fs[_0x1a32('0xf8')](_0x32c043);}});});});}else{return _0x5229e4[_0x1a32('0x1e')](0xc8);}})[_0x1a32('0x34')](handleError(_0x5229e4,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index fbc3afb..0d08142 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 _0xf290=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x595e89,_0x4edaa9){var _0x48eaf4=function(_0x3d251b){while(--_0x3d251b){_0x595e89['push'](_0x595e89['shift']());}};_0x48eaf4(++_0x4edaa9);}(_0xf290,0xde));var _0x0f29=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xf290[_0x1ee351];return _0x245aaf;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x0f29('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x0f29('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0f29('0x1')](0x0);var events={'afterCreate':_0x0f29('0x2'),'afterUpdate':_0x0f29('0x3'),'afterDestroy':_0x0f29('0x4')};function emitEvent(_0xfdab92){return function(_0x5984ba,_0x45d37d,_0x4911fb){_0x5984ba[_0x0f29('0x5')]({'attributes':['id'],'raw':!![]})[_0x0f29('0x6')](function(_0x355e21){_0x5984ba[_0x0f29('0x7')](_0x0f29('0x8'),_0x355e21[_0x0f29('0x9')](function(_0x2be26e){return{'id':_0x2be26e['id']};}));return WhatsappMessage[_0x0f29('0xa')]({'where':{'WhatsappInteractionId':_0x5984ba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0f29('0x6')](function(_0x139c65){_0x5984ba[_0x0f29('0x7')](_0x0f29('0xb'),_0x139c65[_0x0f29('0xc')]);WhatsappInteractionEvents[_0x0f29('0xd')](_0xfdab92+':'+_0x5984ba['id'],_0x5984ba);WhatsappInteractionEvents[_0x0f29('0xd')](_0xfdab92,_0x5984ba);_0x4911fb(null);})['catch'](_0x4911fb(null));};}for(var e in events){if(events[_0x0f29('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x0f29('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1ab1=['length','emit','catch','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll','then','unreadMessages'];(function(_0x9e1d73,_0xcf6479){var _0x1ba603=function(_0x689c74){while(--_0x689c74){_0x9e1d73['push'](_0x9e1d73['shift']());}};_0x1ba603(++_0xcf6479);}(_0x1ab1,0x83));var _0x11ab=function(_0x5bc58a,_0x4164b0){_0x5bc58a=_0x5bc58a-0x0;var _0x3ba3c7=_0x1ab1[_0x5bc58a];return _0x3ba3c7;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x11ab('0x0'))['db'][_0x11ab('0x1')];var WhatsappMessage=require(_0x11ab('0x0'))['db'][_0x11ab('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x11ab('0x3')](0x0);var events={'afterCreate':_0x11ab('0x4'),'afterUpdate':_0x11ab('0x5'),'afterDestroy':'remove'};function emitEvent(_0xded89b){return function(_0x2689a2,_0x260c92,_0x173e17){_0x2689a2[_0x11ab('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xe4281a){_0x2689a2[_0x11ab('0x7')](_0x11ab('0x8'),_0xe4281a[_0x11ab('0x9')](function(_0x495619){return{'id':_0x495619['id']};}));return WhatsappMessage[_0x11ab('0xa')]({'where':{'WhatsappInteractionId':_0x2689a2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x11ab('0xb')](function(_0xf74671){_0x2689a2[_0x11ab('0x7')](_0x11ab('0xc'),_0xf74671[_0x11ab('0xd')]);WhatsappInteractionEvents[_0x11ab('0xe')](_0xded89b+':'+_0x2689a2['id'],_0x2689a2);WhatsappInteractionEvents['emit'](_0xded89b,_0x2689a2);_0x173e17(null);})[_0x11ab('0xf')](_0x173e17(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x11ab('0x10')](e,emitEvent(event));}}module[_0x11ab('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 90629df..633d4ad 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 _0x52db=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise'];(function(_0x867c03,_0x5f532d){var _0x760969=function(_0xd23675){while(--_0xd23675){_0x867c03['push'](_0x867c03['shift']());}};_0x760969(++_0x5f532d);}(_0x52db,0xe9));var _0xb52d=function(_0x494c47,_0x238d36){_0x494c47=_0x494c47-0x0;var _0x30db84=_0x52db[_0x494c47];return _0x30db84;};'use strict';var _=require(_0xb52d('0x0'));var util=require(_0xb52d('0x1'));var logger=require(_0xb52d('0x2'))(_0xb52d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb52d('0x4'));var fs=require('fs');var path=require(_0xb52d('0x5'));var rimraf=require(_0xb52d('0x6'));var config=require(_0xb52d('0x7'));var attributes=require(_0xb52d('0x8'));module[_0xb52d('0x9')]=function(_0x5e1250,_0x476ae9){return _0x5e1250['define'](_0xb52d('0xa'),attributes,{'tableName':_0xb52d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x474533,_0x33758c,_0x4b7178){if(_0x474533[_0xb52d('0xc')](_0xb52d('0xd'))){_0x474533[_0xb52d('0xe')]=moment()[_0xb52d('0xf')](_0xb52d('0x10'));}_0x4b7178(null,_0x474533);}}});}; \ No newline at end of file +var _0x1fed=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x51f48a,_0x54b9f3){var _0x5055ab=function(_0x31478f){while(--_0x31478f){_0x51f48a['push'](_0x51f48a['shift']());}};_0x5055ab(++_0x54b9f3);}(_0x1fed,0x1d3));var _0xd1fe=function(_0x23165a,_0x19d021){_0x23165a=_0x23165a-0x0;var _0x40c6c4=_0x1fed[_0x23165a];return _0x40c6c4;};'use strict';var _=require(_0xd1fe('0x0'));var util=require('util');var logger=require(_0xd1fe('0x1'))(_0xd1fe('0x2'));var moment=require(_0xd1fe('0x3'));var BPromise=require(_0xd1fe('0x4'));var rp=require(_0xd1fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd1fe('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0xd1fe('0x7')]=function(_0x352f93,_0x4f194d){return _0x352f93['define']('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x187285,_0xa14551,_0x3c6115){if(_0x187285[_0xd1fe('0x8')](_0xd1fe('0x9'))){_0x187285['closedAt']=moment()[_0xd1fe('0xa')](_0xd1fe('0xb'));}_0x3c6115(null,_0x187285);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 716809e..3eb3083 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 _0xd677=['attributes','AddTagsToWhatsappInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where'];(function(_0x333683,_0x2e51dc){var _0x570c76=function(_0x2b51a2){while(--_0x2b51a2){_0x333683['push'](_0x333683['shift']());}};_0x570c76(++_0x2e51dc);}(_0xd677,0x9b));var _0x7d67=function(_0xc49b87,_0x9b1222){_0xc49b87=_0xc49b87-0x0;var _0x3c72c7=_0xd677[_0xc49b87];return _0x3c72c7;};'use strict';var _=require(_0x7d67('0x0'));var util=require(_0x7d67('0x1'));var moment=require(_0x7d67('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(_0x7d67('0x3'));var logger=require(_0x7d67('0x4'))(_0x7d67('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d67('0x6')][_0x7d67('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7d67('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d67('0x9'))(new Redis(config[_0x7d67('0x8')]));require(_0x7d67('0xa'))[_0x7d67('0xb')](socket);function respondWithRpcPromise(_0x275f89,_0x373263,_0x578ec3){return new BPromise(function(_0x3e30eb,_0x173c31){return client[_0x7d67('0xc')](_0x275f89,_0x578ec3)[_0x7d67('0xd')](function(_0x3c03ce){logger['info'](_0x7d67('0xe'),_0x373263,_0x7d67('0xf'));logger[_0x7d67('0x10')](_0x7d67('0x11'),_0x373263,'request\x20sent',JSON[_0x7d67('0x12')](_0x3c03ce));if(_0x3c03ce[_0x7d67('0x13')]){if(_0x3c03ce[_0x7d67('0x13')][_0x7d67('0x14')]===0x1f4){logger[_0x7d67('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x373263,_0x3c03ce[_0x7d67('0x13')][_0x7d67('0x15')]);return _0x173c31(_0x3c03ce[_0x7d67('0x13')]['message']);}logger[_0x7d67('0x13')](_0x7d67('0xe'),_0x373263,_0x3c03ce[_0x7d67('0x13')][_0x7d67('0x15')]);return _0x3e30eb(_0x3c03ce[_0x7d67('0x13')][_0x7d67('0x15')]);}else{logger[_0x7d67('0x16')](_0x7d67('0xe'),_0x373263,_0x7d67('0xf'));_0x3e30eb(_0x3c03ce[_0x7d67('0x17')][_0x7d67('0x15')]);}})['catch'](function(_0x4d4606){logger[_0x7d67('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x373263,_0x4d4606);_0x173c31(_0x4d4606);});});}exports[_0x7d67('0x18')]=function(_0x587ac2){var _0x2fab09=this;return new Promise(function(_0x3ed15f,_0x54a8cf){return db[_0x7d67('0x19')][_0x7d67('0x1a')](_0x587ac2[_0x7d67('0x1b')],{'raw':_0x587ac2['options']?_0x587ac2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587ac2[_0x7d67('0x1c')]?_0x587ac2['options'][_0x7d67('0x1d')]||null:null,'attributes':_0x587ac2['options']?_0x587ac2[_0x7d67('0x1c')][_0x7d67('0x1e')]||null:null,'limit':_0x587ac2[_0x7d67('0x1c')]?_0x587ac2[_0x7d67('0x1c')]['limit']||null:null})['then'](function(_0x1bf766){logger[_0x7d67('0x16')](_0x7d67('0x18'),_0x587ac2);logger[_0x7d67('0x10')](_0x7d67('0x18'),_0x587ac2,JSON[_0x7d67('0x12')](_0x1bf766));_0x3ed15f(_0x1bf766);})['catch'](function(_0x463d0a){logger['error'](_0x7d67('0x18'),_0x463d0a[_0x7d67('0x15')],_0x587ac2);_0x54a8cf(_0x2fab09[_0x7d67('0x13')](0x1f4,_0x463d0a['message']));});});};exports[_0x7d67('0x1f')]=function(_0x127f4e){return new Promise(function(_0x2e2ea9,_0x19abca){return db[_0x7d67('0x19')][_0x7d67('0x20')]({'where':_0x127f4e[_0x7d67('0x1c')]?_0x127f4e['options']['where']||null:null})[_0x7d67('0xd')](function(_0x1d0795){if(_0x1d0795){return _0x1d0795[_0x7d67('0x21')](_0x127f4e['body']['ids'],_[_0x7d67('0x22')](_0x127f4e['body'],[_0x7d67('0x23'),'id'])||{});}})['spread'](function(_0x8cb99a){logger[_0x7d67('0x16')](_0x7d67('0x24'),_0x127f4e);logger[_0x7d67('0x10')](_0x7d67('0x24'),_0x127f4e,JSON['stringify'](_0x8cb99a));_0x2e2ea9(_0x8cb99a);})['catch'](function(_0xddad8d){logger['error'](_0x7d67('0x24'),_0xddad8d[_0x7d67('0x15')],_0x127f4e);_0x19abca(_this[_0x7d67('0x13')](0x1f4,_0xddad8d[_0x7d67('0x15')]));});});}; \ No newline at end of file +var _0xd76a=['spread','AddTags','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','then','info','AddTagsToWhatsappInteraction','omit'];(function(_0x3336eb,_0x4bfc84){var _0x59e358=function(_0x180127){while(--_0x180127){_0x3336eb['push'](_0x3336eb['shift']());}};_0x59e358(++_0x4bfc84);}(_0xd76a,0x146));var _0xad76=function(_0x680afe,_0x27f019){_0x680afe=_0x680afe-0x0;var _0x3cb94c=_0xd76a[_0x680afe];return _0x3cb94c;};'use strict';var _=require('lodash');var util=require(_0xad76('0x0'));var moment=require(_0xad76('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad76('0x2'))['db'];var utils=require(_0xad76('0x3'));var logger=require(_0xad76('0x4'))(_0xad76('0x5'));var config=require(_0xad76('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xad76('0x7')]({'port':0x232a});config[_0xad76('0x8')]=_['defaults'](config[_0xad76('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xad76('0x9'))(new Redis(config[_0xad76('0x8')]));require(_0xad76('0xa'))[_0xad76('0xb')](socket);function respondWithRpcPromise(_0x1c86d6,_0x19d6a2,_0x160db7){return new BPromise(function(_0x477f3f,_0x316a0e){return client['request'](_0x1c86d6,_0x160db7)['then'](function(_0x221941){logger['info'](_0xad76('0xc'),_0x19d6a2,_0xad76('0xd'));logger[_0xad76('0xe')](_0xad76('0xf'),_0x19d6a2,_0xad76('0xd'),JSON[_0xad76('0x10')](_0x221941));if(_0x221941[_0xad76('0x11')]){if(_0x221941[_0xad76('0x11')][_0xad76('0x12')]===0x1f4){logger[_0xad76('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x19d6a2,_0x221941[_0xad76('0x11')][_0xad76('0x13')]);return _0x316a0e(_0x221941[_0xad76('0x11')]['message']);}logger[_0xad76('0x11')](_0xad76('0xc'),_0x19d6a2,_0x221941[_0xad76('0x11')][_0xad76('0x13')]);return _0x477f3f(_0x221941[_0xad76('0x11')][_0xad76('0x13')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x19d6a2,_0xad76('0xd'));_0x477f3f(_0x221941[_0xad76('0x14')][_0xad76('0x13')]);}})[_0xad76('0x15')](function(_0x523804){logger[_0xad76('0x11')](_0xad76('0xc'),_0x19d6a2,_0x523804);_0x316a0e(_0x523804);});});}exports[_0xad76('0x16')]=function(_0x186c77){var _0x4549a1=this;return new Promise(function(_0x5ad865,_0xe47db1){return db[_0xad76('0x17')][_0xad76('0x18')](_0x186c77[_0xad76('0x19')],{'raw':_0x186c77['options']?_0x186c77[_0xad76('0x1a')][_0xad76('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x186c77[_0xad76('0x1a')]?_0x186c77[_0xad76('0x1a')][_0xad76('0x1c')]||null:null,'attributes':_0x186c77[_0xad76('0x1a')]?_0x186c77[_0xad76('0x1a')][_0xad76('0x1d')]||null:null,'limit':_0x186c77[_0xad76('0x1a')]?_0x186c77[_0xad76('0x1a')]['limit']||null:null})[_0xad76('0x1e')](function(_0x2914d7){logger[_0xad76('0x1f')](_0xad76('0x16'),_0x186c77);logger[_0xad76('0xe')](_0xad76('0x16'),_0x186c77,JSON[_0xad76('0x10')](_0x2914d7));_0x5ad865(_0x2914d7);})[_0xad76('0x15')](function(_0xe9f219){logger[_0xad76('0x11')]('UpdateWhatsappInteraction',_0xe9f219['message'],_0x186c77);_0xe47db1(_0x4549a1[_0xad76('0x11')](0x1f4,_0xe9f219[_0xad76('0x13')]));});});};exports[_0xad76('0x20')]=function(_0x1ff61d){return new Promise(function(_0x40bd87,_0x166b72){return db[_0xad76('0x17')]['find']({'where':_0x1ff61d[_0xad76('0x1a')]?_0x1ff61d[_0xad76('0x1a')][_0xad76('0x1c')]||null:null})[_0xad76('0x1e')](function(_0x161920){if(_0x161920){return _0x161920['addTags'](_0x1ff61d[_0xad76('0x19')]['ids'],_[_0xad76('0x21')](_0x1ff61d[_0xad76('0x19')],['ids','id'])||{});}})[_0xad76('0x22')](function(_0x4a9302){logger[_0xad76('0x1f')](_0xad76('0x23'),_0x1ff61d);logger[_0xad76('0xe')]('AddTags',_0x1ff61d,JSON[_0xad76('0x10')](_0x4a9302));_0x40bd87(_0x4a9302);})[_0xad76('0x15')](function(_0x26c4a5){logger['error']('AddTags',_0x26c4a5['message'],_0x1ff61d);_0x166b72(_this[_0xad76('0x11')](0x1f4,_0x26c4a5[_0xad76('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d4740a3..1808930 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 _0x1f59=['emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x246e98,_0x2fbb91){var _0x53721b=function(_0xa61a2d){while(--_0xa61a2d){_0x246e98['push'](_0x246e98['shift']());}};_0x53721b(++_0x2fbb91);}(_0x1f59,0x184));var _0x91f5=function(_0xbc38cd,_0x5c87d3){_0xbc38cd=_0xbc38cd-0x0;var _0x3f031f=_0x1f59[_0xbc38cd];return _0x3f031f;};'use strict';var WhatsappInteractionEvents=require(_0x91f5('0x0'));var events=[_0x91f5('0x1'),_0x91f5('0x2'),_0x91f5('0x3')];function createListener(_0x21f64c,_0xcfe8d2){return function(_0x482b38){_0xcfe8d2[_0x91f5('0x4')](_0x21f64c,_0x482b38);};}function removeListener(_0xdb2fe0,_0x141b6c){return function(){WhatsappInteractionEvents[_0x91f5('0x5')](_0xdb2fe0,_0x141b6c);};}exports[_0x91f5('0x6')]=function(_0x4b2fd0){for(var _0x140c3f=0x0,_0x39ebd3=events['length'];_0x140c3f<_0x39ebd3;_0x140c3f++){var _0x7cb509=events[_0x140c3f];var _0x135745=createListener(_0x91f5('0x7')+_0x7cb509,_0x4b2fd0);WhatsappInteractionEvents['on'](_0x7cb509,_0x135745);}}; \ No newline at end of file +var _0xadd2=['remove','update','emit','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xadd2,0xc5));var _0x2add=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xadd2[_0x4565bf];return _0x5610ba;};'use strict';var WhatsappInteractionEvents=require(_0x2add('0x0'));var events=['save',_0x2add('0x1'),_0x2add('0x2')];function createListener(_0x401300,_0x579ba3){return function(_0x134cbc){_0x579ba3[_0x2add('0x3')](_0x401300,_0x134cbc);};}function removeListener(_0x4d6df1,_0x520a7d){return function(){WhatsappInteractionEvents['removeListener'](_0x4d6df1,_0x520a7d);};}exports['register']=function(_0x1be19c){for(var _0x151fe6=0x0,_0x4f1922=events[_0x2add('0x4')];_0x151fe6<_0x4f1922;_0x151fe6++){var _0x458658=events[_0x151fe6];var _0x3da0de=createListener(_0x2add('0x5')+_0x458658,_0x1be19c);WhatsappInteractionEvents['on'](_0x458658,_0x3da0de);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 15cc3d5..1b9045f 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 _0xc60f=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put'];(function(_0x26af68,_0x4537b1){var _0x52c348=function(_0xf5fde2){while(--_0xf5fde2){_0x26af68['push'](_0x26af68['shift']());}};_0x52c348(++_0x4537b1);}(_0xc60f,0xfb));var _0xfc60=function(_0x1b00f1,_0x15ffa8){_0x1b00f1=_0x1b00f1-0x0;var _0x5c3dad=_0xc60f[_0x1b00f1];return _0x5c3dad;};'use strict';var multer=require(_0xfc60('0x0'));var util=require(_0xfc60('0x1'));var path=require(_0xfc60('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfc60('0x3'));var interaction=require(_0xfc60('0x4'));var config=require('../../config/environment');var controller=require(_0xfc60('0x5'));router[_0xfc60('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xfc60('0x7')](),controller[_0xfc60('0x8')]);router[_0xfc60('0x6')](_0xfc60('0x9'),auth[_0xfc60('0x7')](),controller[_0xfc60('0xa')]);router[_0xfc60('0xb')]('/',auth[_0xfc60('0x7')](),interaction[_0xfc60('0xc')](_0xfc60('0xd'),_0xfc60('0xe')),controller[_0xfc60('0xf')]);router['post'](_0xfc60('0x10'),controller[_0xfc60('0x11')]);router[_0xfc60('0x12')](_0xfc60('0x9'),auth['isAuthenticated'](),controller[_0xfc60('0x13')]);router[_0xfc60('0x12')](_0xfc60('0x14'),auth[_0xfc60('0x7')](),controller[_0xfc60('0x15')]);router[_0xfc60('0x12')](_0xfc60('0x16'),auth[_0xfc60('0x7')](),controller[_0xfc60('0x17')]);router[_0xfc60('0x18')](_0xfc60('0x9'),auth[_0xfc60('0x7')](),controller[_0xfc60('0x19')]);module[_0xfc60('0x1a')]=router; \ No newline at end of file +var _0xf890=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','whatsapp','/:id/status','status','put','update','/:id/accept','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x2f544e,_0x59c2a9){var _0x6f0b0e=function(_0x3825bf){while(--_0x3825bf){_0x2f544e['push'](_0x2f544e['shift']());}};_0x6f0b0e(++_0x59c2a9);}(_0xf890,0xbb));var _0x0f89=function(_0x1aae50,_0x159663){_0x1aae50=_0x1aae50-0x0;var _0x3cc485=_0xf890[_0x1aae50];return _0x3cc485;};'use strict';var multer=require('multer');var util=require(_0x0f89('0x0'));var path=require(_0x0f89('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f89('0x2'));var router=express[_0x0f89('0x3')]();var fs_extra=require(_0x0f89('0x4'));var auth=require(_0x0f89('0x5'));var interaction=require(_0x0f89('0x6'));var config=require(_0x0f89('0x7'));var controller=require(_0x0f89('0x8'));router[_0x0f89('0x9')]('/',auth[_0x0f89('0xa')](),controller['index']);router[_0x0f89('0x9')](_0x0f89('0xb'),auth[_0x0f89('0xa')](),controller[_0x0f89('0xc')]);router[_0x0f89('0x9')](_0x0f89('0xd'),auth[_0x0f89('0xa')](),controller[_0x0f89('0xe')]);router['post']('/',auth[_0x0f89('0xa')](),interaction['tracked'](_0x0f89('0xf'),'whatsappmessage:create'),controller['create']);router['post'](_0x0f89('0x10'),controller[_0x0f89('0x11')]);router[_0x0f89('0x12')]('/:id',auth[_0x0f89('0xa')](),controller[_0x0f89('0x13')]);router[_0x0f89('0x12')](_0x0f89('0x14'),auth[_0x0f89('0xa')](),controller['accept']);router[_0x0f89('0x12')]('/:id/reject',auth[_0x0f89('0xa')](),controller['reject']);router[_0x0f89('0x15')](_0x0f89('0xd'),auth['isAuthenticated'](),controller[_0x0f89('0x16')]);module[_0x0f89('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f17cdc9..b7ca151 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 _0xf52f=['out','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x4d4497,_0x344597){var _0x442b0b=function(_0x6ecd33){while(--_0x6ecd33){_0x4d4497['push'](_0x4d4497['shift']());}};_0x442b0b(++_0x344597);}(_0xf52f,0x113));var _0xff52=function(_0x228636,_0x51d570){_0x228636=_0x228636-0x0;var _0x327b9e=_0xf52f[_0x228636];return _0x327b9e;};'use strict';var Sequelize=require(_0xff52('0x0'));module[_0xff52('0x1')]={'body':{'type':Sequelize[_0xff52('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xff52('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xff52('0x4')]('in',_0xff52('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xff52('0x6')](0xbe)},'phone':{'type':Sequelize[_0xff52('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xff52('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xff52('0x6')]},'providerResponse':{'type':Sequelize[_0xff52('0x2')]}}; \ No newline at end of file +var _0x6510=['exports','TEXT','medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x6510,0x77));var _0x0651=function(_0xdfd5b3,_0x18eac2){_0xdfd5b3=_0xdfd5b3-0x0;var _0x5ea45e=_0x6510[_0xdfd5b3];return _0x5ea45e;};'use strict';var Sequelize=require(_0x0651('0x0'));module[_0x0651('0x1')]={'body':{'type':Sequelize[_0x0651('0x2')](_0x0651('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0651('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0651('0x5')),'defaultValue':_0x0651('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0651('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0651('0x6')]},'readAt':{'type':Sequelize[_0x0651('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0651('0x6')]},'providerResponse':{'type':Sequelize[_0x0651('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index d83830b..db32929 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 _0x9aa4=['VIRTUAL','options','include','findAll','show','params','intersection','find','create','body','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','EventManager','acceptmessage','whatsapp-interactions','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','internal','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','WhatsappMessage','rawAttributes','fieldName','map','query','keys','filters','fields','attributes','length','model','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge'];(function(_0x15bb39,_0x42bd41){var _0x88fadc=function(_0x177f6c){while(--_0x177f6c){_0x15bb39['push'](_0x15bb39['shift']());}};_0x88fadc(++_0x42bd41);}(_0x9aa4,0xce));var _0x49aa=function(_0x2dcc30,_0x427855){_0x2dcc30=_0x2dcc30-0x0;var _0xc9aa6c=_0x9aa4[_0x2dcc30];return _0xc9aa6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49aa('0x0'));var zipdir=require(_0x49aa('0x1'));var jsonpatch=require(_0x49aa('0x2'));var rp=require('request-promise');var moment=require(_0x49aa('0x3'));var BPromise=require(_0x49aa('0x4'));var Mustache=require(_0x49aa('0x5'));var util=require(_0x49aa('0x6'));var path=require(_0x49aa('0x7'));var sox=require(_0x49aa('0x8'));var csv=require(_0x49aa('0x9'));var ejs=require(_0x49aa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49aa('0xb'));var squel=require(_0x49aa('0xc'));var crypto=require(_0x49aa('0xd'));var jsforce=require(_0x49aa('0xe'));var deskjs=require(_0x49aa('0xf'));var toCsv=require(_0x49aa('0x9'));var querystring=require(_0x49aa('0x10'));var Papa=require(_0x49aa('0x11'));var Redis=require(_0x49aa('0x12'));var authService=require(_0x49aa('0x13'));var qs=require(_0x49aa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x49aa('0x15'))('api');var utils=require(_0x49aa('0x16'));var config=require(_0x49aa('0x17'));var licenseUtil=require(_0x49aa('0x18'));var db=require(_0x49aa('0x19'))['db'];config['redis']=_['defaults'](config[_0x49aa('0x1a')],{'host':_0x49aa('0x1b'),'port':0x18eb});var socket=require(_0x49aa('0x1c'))(new Redis(config[_0x49aa('0x1a')]));require(_0x49aa('0x1d'))[_0x49aa('0x1e')](socket);var jayson=require(_0x49aa('0x1f'));var client=jayson[_0x49aa('0x20')][_0x49aa('0x21')]({'port':0x232c});var client9002=jayson[_0x49aa('0x20')][_0x49aa('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x47298e,_0x4e0c34,_0x54e548,_0x3d322f){return new BPromise(function(_0x238ef3,_0x3e7d11){var _0x2ea354=_0x3d322f||client;return _0x2ea354['request'](_0x47298e,_0x54e548)['then'](function(_0xdc9d88){logger[_0x49aa('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x4e0c34,_0x49aa('0x23'));logger[_0x49aa('0x24')](_0x49aa('0x25'),_0x4e0c34,_0x49aa('0x23'),JSON['stringify'](_0xdc9d88));if(_0xdc9d88[_0x49aa('0x26')]){if(_0xdc9d88['error'][_0x49aa('0x27')]===0x1f4){logger[_0x49aa('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x4e0c34,_0xdc9d88['error']['message']);return _0x3e7d11(_0xdc9d88[_0x49aa('0x26')][_0x49aa('0x28')]);}logger[_0x49aa('0x26')](_0x49aa('0x29'),_0x4e0c34,_0xdc9d88[_0x49aa('0x26')]['message']);return _0x238ef3(_0xdc9d88[_0x49aa('0x26')][_0x49aa('0x28')]);}else{logger[_0x49aa('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x4e0c34,'request\x20sent');_0x238ef3(_0xdc9d88[_0x49aa('0x2a')]['message']);}})[_0x49aa('0x2b')](function(_0x3f4016){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4e0c34,_0x3f4016);_0x3e7d11(_0x3f4016);});});}function respondWithStatusCode(_0x373a2b,_0x24b092){_0x24b092=_0x24b092||0xcc;return function(_0x285b9e){if(_0x285b9e){return _0x373a2b['sendStatus'](_0x24b092);}return _0x373a2b['status'](_0x24b092)[_0x49aa('0x2c')]();};}function respondWithResult(_0x409839,_0x9c3fc4){_0x9c3fc4=_0x9c3fc4||0xc8;return function(_0x545c40){if(_0x545c40){return _0x409839[_0x49aa('0x2d')](_0x9c3fc4)[_0x49aa('0x2e')](_0x545c40);}};}function respondWithFilteredResult(_0x248906,_0x38ca35){return function(_0x2fda94){if(_0x2fda94){var _0x47cc0e=typeof _0x38ca35[_0x49aa('0x2f')]==='undefined'&&typeof _0x38ca35['limit']===_0x49aa('0x30');var _0x529ce5=_0x2fda94[_0x49aa('0x31')];var _0x122f35=_0x47cc0e?0x0:_0x38ca35[_0x49aa('0x2f')];var _0xea69b4=_0x47cc0e?_0x2fda94[_0x49aa('0x31')]:_0x38ca35[_0x49aa('0x2f')]+_0x38ca35['limit'];var _0x1a4a1e;if(_0xea69b4>=_0x529ce5){_0xea69b4=_0x529ce5;_0x1a4a1e=0xc8;}else{_0x1a4a1e=0xce;}_0x248906[_0x49aa('0x2d')](_0x1a4a1e);return _0x248906[_0x49aa('0x32')](_0x49aa('0x33'),_0x122f35+'-'+_0xea69b4+'/'+_0x529ce5)[_0x49aa('0x2e')](_0x2fda94);}return null;};}function patchUpdates(_0x40e283){return function(_0x201355){try{jsonpatch[_0x49aa('0x34')](_0x201355,_0x40e283,!![]);}catch(_0x4f1072){return BPromise['reject'](_0x4f1072);}return _0x201355[_0x49aa('0x35')]();};}function saveUpdates(_0x3bdb91,_0x37925b){return function(_0x4d0c3f){if(_0x4d0c3f){return _0x4d0c3f[_0x49aa('0x36')](_0x3bdb91)[_0x49aa('0x37')](function(_0x3fb320){return _0x3fb320;});}return null;};}function removeEntity(_0x5e7f2e,_0x1e9a35){return function(_0x1a8be4){if(_0x1a8be4){return _0x1a8be4[_0x49aa('0x38')]()['then'](function(){_0x5e7f2e[_0x49aa('0x2d')](0xcc)[_0x49aa('0x2c')]();});}};}function handleEntityNotFound(_0x2e9861,_0x1a8721){return function(_0x205c7e){if(!_0x205c7e){_0x2e9861['sendStatus'](0x194);}return _0x205c7e;};}function handleError(_0x356ca1,_0x54a132){_0x54a132=_0x54a132||0x1f4;return function(_0xf49f29){logger['error'](_0xf49f29[_0x49aa('0x39')]);if(_0xf49f29[_0x49aa('0x3a')]){delete _0xf49f29['name'];}_0x356ca1[_0x49aa('0x2d')](_0x54a132)[_0x49aa('0x3b')](_0xf49f29);};}exports['index']=function(_0x309d81,_0x182ca4){var _0x1617d8={},_0x5464cb={},_0x14aa20={'count':0x0,'rows':[]};var _0x246056=_['map'](db[_0x49aa('0x3c')][_0x49aa('0x3d')],function(_0x18d12e){return{'name':_0x18d12e[_0x49aa('0x3e')],'type':_0x18d12e['type']['key']};});_0x5464cb['model']=_[_0x49aa('0x3f')](_0x246056,_0x49aa('0x3a'));_0x5464cb[_0x49aa('0x40')]=_[_0x49aa('0x41')](_0x309d81['query']);_0x5464cb[_0x49aa('0x42')]=_['intersection'](_0x5464cb['model'],_0x5464cb[_0x49aa('0x40')]);_0x1617d8['attributes']=_['intersection'](_0x5464cb['model'],qs['fields'](_0x309d81[_0x49aa('0x40')][_0x49aa('0x43')]));_0x1617d8[_0x49aa('0x44')]=_0x1617d8[_0x49aa('0x44')][_0x49aa('0x45')]?_0x1617d8[_0x49aa('0x44')]:_0x5464cb[_0x49aa('0x46')];if(!_0x309d81[_0x49aa('0x40')][_0x49aa('0x47')](_0x49aa('0x48'))){_0x1617d8['limit']=qs[_0x49aa('0x49')](_0x309d81[_0x49aa('0x40')]['limit']);_0x1617d8[_0x49aa('0x2f')]=qs[_0x49aa('0x2f')](_0x309d81[_0x49aa('0x40')][_0x49aa('0x2f')]);}_0x1617d8[_0x49aa('0x4a')]=qs[_0x49aa('0x4b')](_0x309d81[_0x49aa('0x40')][_0x49aa('0x4b')]);_0x1617d8['where']=qs[_0x49aa('0x42')](_[_0x49aa('0x4c')](_0x309d81[_0x49aa('0x40')],_0x5464cb['filters']),_0x246056);if(_0x309d81['query'][_0x49aa('0x4d')]){_0x1617d8[_0x49aa('0x4e')]=_[_0x49aa('0x4f')](_0x1617d8[_0x49aa('0x4e')],{'$or':_[_0x49aa('0x3f')](_0x246056,function(_0x3a9622){if(_0x3a9622['type']!==_0x49aa('0x50')){var _0x16b691={};_0x16b691[_0x3a9622['name']]={'$like':'%'+_0x309d81[_0x49aa('0x40')]['filter']+'%'};return _0x16b691;}})});}_0x1617d8=_[_0x49aa('0x4f')]({},_0x1617d8,_0x309d81[_0x49aa('0x51')]);var _0x517c3d={'where':_0x1617d8['where']};return db[_0x49aa('0x3c')]['count'](_0x517c3d)[_0x49aa('0x37')](function(_0xaa926f){_0x14aa20['count']=_0xaa926f;if(_0x309d81[_0x49aa('0x40')]['includeAll']){_0x1617d8[_0x49aa('0x52')]=[{'all':!![]}];}return db[_0x49aa('0x3c')][_0x49aa('0x53')](_0x1617d8);})['then'](function(_0xf21920){_0x14aa20['rows']=_0xf21920;return _0x14aa20;})['then'](respondWithFilteredResult(_0x182ca4,_0x1617d8))[_0x49aa('0x2b')](handleError(_0x182ca4,null));};exports[_0x49aa('0x54')]=function(_0x3aea24,_0xdf3ff1){var _0x44f698={'raw':!![],'where':{'id':_0x3aea24[_0x49aa('0x55')]['id']}},_0x178172={};_0x178172['model']=_['keys'](db[_0x49aa('0x3c')]['rawAttributes']);_0x178172['query']=_[_0x49aa('0x41')](_0x3aea24['query']);_0x178172[_0x49aa('0x42')]=_[_0x49aa('0x56')](_0x178172[_0x49aa('0x46')],_0x178172[_0x49aa('0x40')]);_0x44f698[_0x49aa('0x44')]=_[_0x49aa('0x56')](_0x178172[_0x49aa('0x46')],qs['fields'](_0x3aea24[_0x49aa('0x40')][_0x49aa('0x43')]));_0x44f698[_0x49aa('0x44')]=_0x44f698[_0x49aa('0x44')]['length']?_0x44f698['attributes']:_0x178172[_0x49aa('0x46')];if(_0x3aea24[_0x49aa('0x40')]['includeAll']){_0x44f698[_0x49aa('0x52')]=[{'all':!![]}];}_0x44f698=_[_0x49aa('0x4f')]({},_0x44f698,_0x3aea24['options']);return db['WhatsappMessage'][_0x49aa('0x57')](_0x44f698)[_0x49aa('0x37')](handleEntityNotFound(_0xdf3ff1,null))[_0x49aa('0x37')](respondWithResult(_0xdf3ff1,null))[_0x49aa('0x2b')](handleError(_0xdf3ff1,null));};exports['create']=function(_0x87720,_0x4f5884){return db[_0x49aa('0x3c')][_0x49aa('0x58')](_0x87720['body'],{})[_0x49aa('0x37')](respondWithResult(_0x4f5884,0xc9))[_0x49aa('0x2b')](handleError(_0x4f5884,null));};exports[_0x49aa('0x36')]=function(_0x137a4f,_0x40da87){if(_0x137a4f[_0x49aa('0x59')]['id']){delete _0x137a4f[_0x49aa('0x59')]['id'];}return db[_0x49aa('0x3c')]['find']({'where':{'id':_0x137a4f[_0x49aa('0x55')]['id']}})[_0x49aa('0x37')](handleEntityNotFound(_0x40da87,null))[_0x49aa('0x37')](saveUpdates(_0x137a4f[_0x49aa('0x59')],null))[_0x49aa('0x37')](respondWithResult(_0x40da87,null))[_0x49aa('0x2b')](handleError(_0x40da87,null));};exports[_0x49aa('0x38')]=function(_0x1daf2e,_0x175cc5){return db['WhatsappMessage']['find']({'where':{'id':_0x1daf2e[_0x49aa('0x55')]['id']}})['then'](handleEntityNotFound(_0x175cc5,null))[_0x49aa('0x37')](removeEntity(_0x175cc5,null))[_0x49aa('0x2b')](handleError(_0x175cc5,null));};exports[_0x49aa('0x5a')]=function(_0x56c2cb,_0x2cbe60){return db['WhatsappMessage'][_0x49aa('0x5a')]()[_0x49aa('0x37')](respondWithResult(_0x2cbe60,null))[_0x49aa('0x2b')](handleError(_0x2cbe60,null));};var interaction_log=require(_0x49aa('0x15'))('whatsapp-interactions');exports[_0x49aa('0x5b')]=function(_0x5e360f,_0x151a7c,_0x5d453e){var _0x30d452={'agent':{},'channel':_0x49aa('0x5c')};if(_0x5e360f[_0x49aa('0x59')]['id']){delete _0x5e360f['body']['id'];}_0x5e360f[_0x49aa('0x59')][_0x49aa('0x5d')]=!![];_0x5e360f[_0x49aa('0x59')][_0x49aa('0x5e')]=moment()[_0x49aa('0x5f')](_0x49aa('0x60'));_0x5e360f['body'][_0x49aa('0x61')]=_0x5e360f[_0x49aa('0x59')]['UserId']||_0x5e360f[_0x49aa('0x62')]['id'];_0x30d452[_0x49aa('0x63')]['id']=_0x5e360f[_0x49aa('0x59')][_0x49aa('0x61')];return db[_0x49aa('0x3c')][_0x49aa('0x57')]({'where':{'id':_0x5e360f['params']['id'],'UserId':null}})[_0x49aa('0x37')](handleEntityNotFound(_0x151a7c,null))[_0x49aa('0x37')](saveUpdates(_0x5e360f[_0x49aa('0x59')],null))[_0x49aa('0x37')](function(_0x54caa0){if(_0x54caa0){_0x30d452[_0x49aa('0x28')]=_0x54caa0[_0x49aa('0x64')]({'plain':!![]});return db[_0x49aa('0x65')][_0x49aa('0x57')]({'where':{'id':_0x54caa0[_0x49aa('0x66')]}});}return null;})[_0x49aa('0x37')](handleEntityNotFound(_0x151a7c,null))['then'](function(_0x7de333){if(_0x7de333){return _0x7de333[_0x49aa('0x36')]({'UserId':_0x5e360f[_0x49aa('0x59')][_0x49aa('0x61')],'read1stAt':_[_0x49aa('0x67')](_0x7de333[_0x49aa('0x68')])?moment()[_0x49aa('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x49aa('0x37')](function(_0x545884){if(_0x545884){_0x30d452[_0x49aa('0x69')]=_0x545884[_0x49aa('0x64')]({'plain':!![]});interaction_log[_0x49aa('0x22')](_0x49aa('0x6a'),_0x5e360f['user']['id'],_0x5e360f[_0x49aa('0x62')][_0x49aa('0x3a')],_0x5e360f[_0x49aa('0x62')][_0x49aa('0x6b')],_0x30d452['interaction']['id'],_0x5e360f['body']?JSON[_0x49aa('0x6c')](_0x5e360f[_0x49aa('0x59')]):_0x49aa('0x6d'));return respondWithRpcPromise(_0x49aa('0x6e'),'acceptMessage',_0x30d452);}return null;})[_0x49aa('0x37')](function(_0x5537b8){var _0x1a300d=_0x49aa('0x6f')+_0x5537b8[_0x49aa('0x28')][_0x49aa('0x70')];return db[_0x49aa('0x71')][_0x49aa('0x40')](_0x1a300d,{'type':db['Sequelize'][_0x49aa('0x72')][_0x49aa('0x73')],'raw':!![]})['then'](function(_0x76abe3){return _0x76abe3;});})[_0x49aa('0x37')](function(_0x227ad5){if(_0x227ad5){_0x30d452[_0x49aa('0x28')]['contact']=_0x227ad5[0x0];if(!_0x5e360f[_0x49aa('0x59')][_0x49aa('0x61')])return;return db[_0x49aa('0x74')]['find']({'where':{'id':_0x5e360f[_0x49aa('0x59')][_0x49aa('0x61')],'role':'agent'},'attributes':['id',_0x49aa('0x3a'),_0x49aa('0x75'),_0x49aa('0x76'),'internal'],'raw':!![]});}return null;})[_0x49aa('0x37')](function(_0x1b1962){if(!_0x1b1962)return null;_0x30d452[_0x49aa('0x28')][_0x49aa('0x63')]=_0x1b1962;return _0x30d452;})['then'](function(_0x2ef808){if(_0x2ef808){if(_0x5e360f['body'][_0x49aa('0x77')]){_0x30d452['message'][_0x49aa('0x78')]=util[_0x49aa('0x5f')](_0x49aa('0x79'),_0x5e360f['user'][_0x49aa('0x3a')]);_0x30d452['message'][_0x49aa('0x7a')]=_0x30d452[_0x49aa('0x7a')];_0x30d452[_0x49aa('0x28')]['motionChannel']=_0x30d452['channel'];_0x30d452['message']['event']='accept';return respondWithRpcPromise('EventManager',_0x49aa('0x7b'),{'event':_0x49aa('0x7c'),'message':_0x30d452[_0x49aa('0x28')]},client9002)[_0x49aa('0x37')](function(){return _0x30d452;});}return _0x30d452;}return null;})['then'](respondWithResult(_0x151a7c,null))[_0x49aa('0x2b')](handleError(_0x151a7c,null));};var interaction_log=require(_0x49aa('0x15'))(_0x49aa('0x7d'));exports[_0x49aa('0x7e')]=function(_0x299525,_0x3dad36,_0xa3a2e4){var _0x5f2e0e={'agent':{},'channel':_0x49aa('0x5c')};if(_0x299525[_0x49aa('0x59')]['id']){delete _0x299525[_0x49aa('0x59')]['id'];}_0x299525[_0x49aa('0x59')][_0x49aa('0x61')]=_0x299525['body'][_0x49aa('0x61')]||_0x299525[_0x49aa('0x62')]['id'];_0x5f2e0e[_0x49aa('0x63')]['id']=_0x299525[_0x49aa('0x59')][_0x49aa('0x61')];return db[_0x49aa('0x3c')][_0x49aa('0x57')]({'where':{'id':_0x299525[_0x49aa('0x55')]['id'],'UserId':null}})[_0x49aa('0x37')](handleEntityNotFound(_0x3dad36,null))['then'](function(_0x5c4c79){if(_0x5c4c79){_0x5f2e0e[_0x49aa('0x28')]=_0x5c4c79[_0x49aa('0x64')]({'plain':!![]});return db[_0x49aa('0x65')][_0x49aa('0x57')]({'where':{'id':_0x5c4c79[_0x49aa('0x66')]}});}return null;})[_0x49aa('0x37')](handleEntityNotFound(_0x3dad36,null))[_0x49aa('0x37')](function(_0x2d555e){if(_0x2d555e){_0x5f2e0e[_0x49aa('0x69')]=_0x2d555e[_0x49aa('0x64')]({'plain':!![]});interaction_log[_0x49aa('0x22')](_0x49aa('0x7f'),_0x299525[_0x49aa('0x62')]['id'],_0x299525['user']['name'],_0x299525['user'][_0x49aa('0x6b')],_0x5f2e0e[_0x49aa('0x69')]['id'],_0x299525[_0x49aa('0x59')]?JSON[_0x49aa('0x6c')](_0x299525[_0x49aa('0x59')]):_0x49aa('0x6d'));return respondWithRpcPromise(_0x49aa('0x80'),_0x49aa('0x81'),_0x5f2e0e);}return null;})[_0x49aa('0x37')](function(_0x30f0e6){var _0x1b1c65=_0x49aa('0x6f')+_0x30f0e6['message'][_0x49aa('0x70')];return db[_0x49aa('0x71')][_0x49aa('0x40')](_0x1b1c65,{'type':db['Sequelize']['QueryTypes'][_0x49aa('0x73')],'raw':!![]})[_0x49aa('0x37')](function(_0x1e65d1){return _0x1e65d1;});})[_0x49aa('0x37')](function(_0x1c9778){if(_0x1c9778){_0x5f2e0e[_0x49aa('0x28')][_0x49aa('0x82')]=_0x1c9778[0x0];if(!_0x299525['body'][_0x49aa('0x61')])return;return db[_0x49aa('0x74')][_0x49aa('0x57')]({'where':{'id':_0x299525[_0x49aa('0x59')][_0x49aa('0x61')],'role':_0x49aa('0x63')},'attributes':['id','name',_0x49aa('0x75'),_0x49aa('0x76'),_0x49aa('0x83')],'raw':!![]});}return null;})[_0x49aa('0x37')](function(_0x1246cc){if(!_0x1246cc)return null;_0x5f2e0e[_0x49aa('0x28')][_0x49aa('0x63')]=_0x1246cc;return _0x5f2e0e;})[_0x49aa('0x37')](function(_0x3fc31c){if(_0x3fc31c){_0x3fc31c[_0x49aa('0x28')]['interface']=util['format'](_0x49aa('0x79'),_0x299525['user'][_0x49aa('0x3a')]);_0x3fc31c[_0x49aa('0x28')][_0x49aa('0x7a')]=_0x5f2e0e[_0x49aa('0x7a')];_0x3fc31c[_0x49aa('0x28')]['motionChannel']=_0x5f2e0e[_0x49aa('0x7a')];_0x3fc31c[_0x49aa('0x28')][_0x49aa('0x84')]=_0x49aa('0x7e');respondWithRpcPromise('EventManager',_0x49aa('0x7b'),{'event':_0x49aa('0x85'),'message':_0x3fc31c['message']},client9002);return _0x5f2e0e;}return null;})[_0x49aa('0x37')](respondWithResult(_0x3dad36,null))['catch'](handleError(_0x3dad36,null));};exports[_0x49aa('0x2d')]=function(_0x3fa9c4,_0x5c2e8c,_0x38edd8){if(_0x3fa9c4[_0x49aa('0x59')]['id']){delete _0x3fa9c4[_0x49aa('0x59')]['id'];}var _0x2aa432;return db[_0x49aa('0x3c')][_0x49aa('0x57')]({'where':{'id':_0x3fa9c4[_0x49aa('0x55')]['id']}})[_0x49aa('0x37')](handleEntityNotFound(_0x5c2e8c,null))[_0x49aa('0x37')](function(_0x5e3842){if(_0x5e3842){_0x2aa432=_0x5e3842;return db[_0x49aa('0x86')][_0x49aa('0x57')]({'where':{'id':_0x5e3842[_0x49aa('0x87')]}});}})[_0x49aa('0x37')](handleEntityNotFound(_0x5c2e8c,null))[_0x49aa('0x37')](function(_0x2d7c84){if(_0x2d7c84){logger[_0x49aa('0x24')](_0x49aa('0x88'),_0x49aa('0x2d'),_0x49aa('0x89'),_0x2d7c84[_0x49aa('0x8a')],util[_0x49aa('0x8b')](_0x3fa9c4[_0x49aa('0x59')],{'showHidden':![],'depth':null}));switch(_0x2d7c84[_0x49aa('0x8a')]){case _0x49aa('0x8c'):if(_0x3fa9c4['body'][_0x49aa('0x8d')]&&_0x3fa9c4['body']['MessageSid']===_0x2aa432['messageId']&&_0x3fa9c4[_0x49aa('0x59')]['MessageStatus']&&_0x3fa9c4['body']['MessageStatus']===_0x49aa('0x5d')){return _0x2aa432[_0x49aa('0x36')]({'read':!![]});}else{logger['error'](_0x49aa('0x8e'),'status','twilio',util[_0x49aa('0x8b')](_0x3fa9c4[_0x49aa('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2aa432;}})[_0x49aa('0x37')](respondWithResult(_0x5c2e8c,null))['catch'](handleError(_0x5c2e8c,null));}; \ No newline at end of file +var _0xcd81=['merge','options','WhatsappMessage','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','agent','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x7fb615,_0x3dacbb){var _0x31b0a0=function(_0x330df7){while(--_0x330df7){_0x7fb615['push'](_0x7fb615['shift']());}};_0x31b0a0(++_0x3dacbb);}(_0xcd81,0x149));var _0x1cd8=function(_0x5481cb,_0x59170e){_0x5481cb=_0x5481cb-0x0;var _0xee201a=_0xcd81[_0x5481cb];return _0xee201a;};'use strict';var emlformat=require(_0x1cd8('0x0'));var rimraf=require(_0x1cd8('0x1'));var zipdir=require(_0x1cd8('0x2'));var jsonpatch=require(_0x1cd8('0x3'));var rp=require(_0x1cd8('0x4'));var moment=require('moment');var BPromise=require(_0x1cd8('0x5'));var Mustache=require(_0x1cd8('0x6'));var util=require('util');var path=require(_0x1cd8('0x7'));var sox=require(_0x1cd8('0x8'));var csv=require(_0x1cd8('0x9'));var ejs=require(_0x1cd8('0xa'));var fs=require('fs');var fs_extra=require(_0x1cd8('0xb'));var _=require(_0x1cd8('0xc'));var squel=require('squel');var crypto=require(_0x1cd8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1cd8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1cd8('0xf'));var Redis=require(_0x1cd8('0x10'));var authService=require(_0x1cd8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1cd8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cd8('0x13'))(_0x1cd8('0x14'));var utils=require(_0x1cd8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1cd8('0x16')]=_[_0x1cd8('0x17')](config['redis'],{'host':_0x1cd8('0x18'),'port':0x18eb});var socket=require(_0x1cd8('0x19'))(new Redis(config[_0x1cd8('0x16')]));require(_0x1cd8('0x1a'))[_0x1cd8('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1cd8('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x1cd8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x318893,_0x5a0f8b,_0x21beab,_0x38e4ae){return new BPromise(function(_0x4d909b,_0x26286e){var _0x2d46ca=_0x38e4ae||client;return _0x2d46ca[_0x1cd8('0x1d')](_0x318893,_0x21beab)[_0x1cd8('0x1e')](function(_0x446581){logger[_0x1cd8('0x1f')](_0x1cd8('0x20'),_0x5a0f8b,_0x1cd8('0x21'));logger['debug'](_0x1cd8('0x22'),_0x5a0f8b,_0x1cd8('0x21'),JSON[_0x1cd8('0x23')](_0x446581));if(_0x446581[_0x1cd8('0x24')]){if(_0x446581[_0x1cd8('0x24')][_0x1cd8('0x25')]===0x1f4){logger[_0x1cd8('0x24')](_0x1cd8('0x20'),_0x5a0f8b,_0x446581[_0x1cd8('0x24')][_0x1cd8('0x26')]);return _0x26286e(_0x446581[_0x1cd8('0x24')][_0x1cd8('0x26')]);}logger[_0x1cd8('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x5a0f8b,_0x446581[_0x1cd8('0x24')][_0x1cd8('0x26')]);return _0x4d909b(_0x446581['error'][_0x1cd8('0x26')]);}else{logger['info'](_0x1cd8('0x20'),_0x5a0f8b,'request\x20sent');_0x4d909b(_0x446581[_0x1cd8('0x27')]['message']);}})[_0x1cd8('0x28')](function(_0x50dd8f){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5a0f8b,_0x50dd8f);_0x26286e(_0x50dd8f);});});}function respondWithStatusCode(_0x10fc2b,_0x5387ef){_0x5387ef=_0x5387ef||0xcc;return function(_0x8bc88f){if(_0x8bc88f){return _0x10fc2b[_0x1cd8('0x29')](_0x5387ef);}return _0x10fc2b[_0x1cd8('0x2a')](_0x5387ef)[_0x1cd8('0x2b')]();};}function respondWithResult(_0x23fa38,_0x3c6042){_0x3c6042=_0x3c6042||0xc8;return function(_0x203f01){if(_0x203f01){return _0x23fa38[_0x1cd8('0x2a')](_0x3c6042)[_0x1cd8('0x2c')](_0x203f01);}};}function respondWithFilteredResult(_0x215825,_0x5ce4fc){return function(_0x466803){if(_0x466803){var _0x281788=typeof _0x5ce4fc['offset']===_0x1cd8('0x2d')&&typeof _0x5ce4fc[_0x1cd8('0x2e')]===_0x1cd8('0x2d');var _0x4cf9ed=_0x466803[_0x1cd8('0x2f')];var _0x27cbe7=_0x281788?0x0:_0x5ce4fc['offset'];var _0x2def9d=_0x281788?_0x466803[_0x1cd8('0x2f')]:_0x5ce4fc[_0x1cd8('0x30')]+_0x5ce4fc[_0x1cd8('0x2e')];var _0x1e073d;if(_0x2def9d>=_0x4cf9ed){_0x2def9d=_0x4cf9ed;_0x1e073d=0xc8;}else{_0x1e073d=0xce;}_0x215825[_0x1cd8('0x2a')](_0x1e073d);return _0x215825[_0x1cd8('0x31')]('Content-Range',_0x27cbe7+'-'+_0x2def9d+'/'+_0x4cf9ed)[_0x1cd8('0x2c')](_0x466803);}return null;};}function patchUpdates(_0x3c9bbe){return function(_0x570dd2){try{jsonpatch[_0x1cd8('0x32')](_0x570dd2,_0x3c9bbe,!![]);}catch(_0x216323){return BPromise[_0x1cd8('0x33')](_0x216323);}return _0x570dd2[_0x1cd8('0x34')]();};}function saveUpdates(_0x561b6e,_0x54e355){return function(_0x4deed5){if(_0x4deed5){return _0x4deed5[_0x1cd8('0x35')](_0x561b6e)['then'](function(_0x427f90){return _0x427f90;});}return null;};}function removeEntity(_0x4be6de,_0x70c473){return function(_0x2e8e43){if(_0x2e8e43){return _0x2e8e43[_0x1cd8('0x36')]()[_0x1cd8('0x1e')](function(){_0x4be6de[_0x1cd8('0x2a')](0xcc)[_0x1cd8('0x2b')]();});}};}function handleEntityNotFound(_0x5ec8d7,_0x3de557){return function(_0x470dae){if(!_0x470dae){_0x5ec8d7['sendStatus'](0x194);}return _0x470dae;};}function handleError(_0x2191e9,_0x58427d){_0x58427d=_0x58427d||0x1f4;return function(_0x278ecc){logger[_0x1cd8('0x24')](_0x278ecc[_0x1cd8('0x37')]);if(_0x278ecc[_0x1cd8('0x38')]){delete _0x278ecc[_0x1cd8('0x38')];}_0x2191e9['status'](_0x58427d)['send'](_0x278ecc);};}exports[_0x1cd8('0x39')]=function(_0x10af04,_0x415481){var _0x10f3ae={},_0x4a5d6b={},_0x5a59cc={'count':0x0,'rows':[]};var _0x1a309e=_[_0x1cd8('0x3a')](db['WhatsappMessage']['rawAttributes'],function(_0x56f9df){return{'name':_0x56f9df[_0x1cd8('0x3b')],'type':_0x56f9df[_0x1cd8('0x3c')][_0x1cd8('0x3d')]};});_0x4a5d6b[_0x1cd8('0x3e')]=_['map'](_0x1a309e,_0x1cd8('0x38'));_0x4a5d6b['query']=_['keys'](_0x10af04[_0x1cd8('0x3f')]);_0x4a5d6b[_0x1cd8('0x40')]=_[_0x1cd8('0x41')](_0x4a5d6b[_0x1cd8('0x3e')],_0x4a5d6b[_0x1cd8('0x3f')]);_0x10f3ae[_0x1cd8('0x42')]=_['intersection'](_0x4a5d6b[_0x1cd8('0x3e')],qs[_0x1cd8('0x43')](_0x10af04['query'][_0x1cd8('0x43')]));_0x10f3ae[_0x1cd8('0x42')]=_0x10f3ae[_0x1cd8('0x42')][_0x1cd8('0x44')]?_0x10f3ae[_0x1cd8('0x42')]:_0x4a5d6b[_0x1cd8('0x3e')];if(!_0x10af04['query']['hasOwnProperty'](_0x1cd8('0x45'))){_0x10f3ae[_0x1cd8('0x2e')]=qs[_0x1cd8('0x2e')](_0x10af04[_0x1cd8('0x3f')]['limit']);_0x10f3ae[_0x1cd8('0x30')]=qs[_0x1cd8('0x30')](_0x10af04[_0x1cd8('0x3f')][_0x1cd8('0x30')]);}_0x10f3ae[_0x1cd8('0x46')]=qs[_0x1cd8('0x47')](_0x10af04[_0x1cd8('0x3f')]['sort']);_0x10f3ae[_0x1cd8('0x48')]=qs[_0x1cd8('0x40')](_['pick'](_0x10af04['query'],_0x4a5d6b[_0x1cd8('0x40')]),_0x1a309e);if(_0x10af04['query']['filter']){_0x10f3ae[_0x1cd8('0x48')]=_['merge'](_0x10f3ae[_0x1cd8('0x48')],{'$or':_[_0x1cd8('0x3a')](_0x1a309e,function(_0xeb9706){if(_0xeb9706[_0x1cd8('0x3c')]!=='VIRTUAL'){var _0x1b00a5={};_0x1b00a5[_0xeb9706[_0x1cd8('0x38')]]={'$like':'%'+_0x10af04[_0x1cd8('0x3f')]['filter']+'%'};return _0x1b00a5;}})});}_0x10f3ae=_[_0x1cd8('0x49')]({},_0x10f3ae,_0x10af04[_0x1cd8('0x4a')]);var _0x10fbcc={'where':_0x10f3ae[_0x1cd8('0x48')]};return db[_0x1cd8('0x4b')]['count'](_0x10fbcc)['then'](function(_0x24cddc){_0x5a59cc[_0x1cd8('0x2f')]=_0x24cddc;if(_0x10af04[_0x1cd8('0x3f')][_0x1cd8('0x4c')]){_0x10f3ae[_0x1cd8('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x1cd8('0x4e')](_0x10f3ae);})['then'](function(_0x273854){_0x5a59cc[_0x1cd8('0x4f')]=_0x273854;return _0x5a59cc;})[_0x1cd8('0x1e')](respondWithFilteredResult(_0x415481,_0x10f3ae))[_0x1cd8('0x28')](handleError(_0x415481,null));};exports[_0x1cd8('0x50')]=function(_0x10c403,_0xf83eac){var _0x463758={'raw':!![],'where':{'id':_0x10c403[_0x1cd8('0x51')]['id']}},_0xd21e5b={};_0xd21e5b[_0x1cd8('0x3e')]=_[_0x1cd8('0x52')](db[_0x1cd8('0x4b')]['rawAttributes']);_0xd21e5b[_0x1cd8('0x3f')]=_['keys'](_0x10c403['query']);_0xd21e5b['filters']=_[_0x1cd8('0x41')](_0xd21e5b[_0x1cd8('0x3e')],_0xd21e5b[_0x1cd8('0x3f')]);_0x463758[_0x1cd8('0x42')]=_['intersection'](_0xd21e5b[_0x1cd8('0x3e')],qs[_0x1cd8('0x43')](_0x10c403['query']['fields']));_0x463758[_0x1cd8('0x42')]=_0x463758['attributes'][_0x1cd8('0x44')]?_0x463758[_0x1cd8('0x42')]:_0xd21e5b[_0x1cd8('0x3e')];if(_0x10c403[_0x1cd8('0x3f')][_0x1cd8('0x4c')]){_0x463758['include']=[{'all':!![]}];}_0x463758=_['merge']({},_0x463758,_0x10c403[_0x1cd8('0x4a')]);return db['WhatsappMessage'][_0x1cd8('0x53')](_0x463758)['then'](handleEntityNotFound(_0xf83eac,null))['then'](respondWithResult(_0xf83eac,null))[_0x1cd8('0x28')](handleError(_0xf83eac,null));};exports['create']=function(_0x9faca,_0x47d140){return db[_0x1cd8('0x4b')][_0x1cd8('0x54')](_0x9faca[_0x1cd8('0x55')],{})[_0x1cd8('0x1e')](respondWithResult(_0x47d140,0xc9))['catch'](handleError(_0x47d140,null));};exports['update']=function(_0x50d355,_0x39fcaa){if(_0x50d355[_0x1cd8('0x55')]['id']){delete _0x50d355[_0x1cd8('0x55')]['id'];}return db['WhatsappMessage'][_0x1cd8('0x53')]({'where':{'id':_0x50d355['params']['id']}})['then'](handleEntityNotFound(_0x39fcaa,null))['then'](saveUpdates(_0x50d355[_0x1cd8('0x55')],null))['then'](respondWithResult(_0x39fcaa,null))[_0x1cd8('0x28')](handleError(_0x39fcaa,null));};exports[_0x1cd8('0x36')]=function(_0x20e3f9,_0x4d1877){return db[_0x1cd8('0x4b')][_0x1cd8('0x53')]({'where':{'id':_0x20e3f9[_0x1cd8('0x51')]['id']}})['then'](handleEntityNotFound(_0x4d1877,null))[_0x1cd8('0x1e')](removeEntity(_0x4d1877,null))[_0x1cd8('0x28')](handleError(_0x4d1877,null));};exports[_0x1cd8('0x56')]=function(_0x430292,_0x2e1366){return db['WhatsappMessage']['describe']()[_0x1cd8('0x1e')](respondWithResult(_0x2e1366,null))[_0x1cd8('0x28')](handleError(_0x2e1366,null));};var interaction_log=require(_0x1cd8('0x13'))(_0x1cd8('0x57'));exports[_0x1cd8('0x58')]=function(_0x539d6c,_0x4ccf9e,_0x26dfe8){var _0x380dcd={'agent':{},'channel':'whatsapp'};if(_0x539d6c[_0x1cd8('0x55')]['id']){delete _0x539d6c[_0x1cd8('0x55')]['id'];}_0x539d6c['body'][_0x1cd8('0x59')]=!![];_0x539d6c[_0x1cd8('0x55')][_0x1cd8('0x5a')]=moment()['format'](_0x1cd8('0x5b'));_0x539d6c['body'][_0x1cd8('0x5c')]=_0x539d6c['body'][_0x1cd8('0x5c')]||_0x539d6c[_0x1cd8('0x5d')]['id'];_0x380dcd['agent']['id']=_0x539d6c[_0x1cd8('0x55')][_0x1cd8('0x5c')];return db['WhatsappMessage']['find']({'where':{'id':_0x539d6c[_0x1cd8('0x51')]['id'],'UserId':null}})[_0x1cd8('0x1e')](handleEntityNotFound(_0x4ccf9e,null))['then'](saveUpdates(_0x539d6c[_0x1cd8('0x55')],null))['then'](function(_0x1ff313){if(_0x1ff313){_0x380dcd['message']=_0x1ff313[_0x1cd8('0x5e')]({'plain':!![]});return db[_0x1cd8('0x5f')]['find']({'where':{'id':_0x1ff313[_0x1cd8('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x4ccf9e,null))[_0x1cd8('0x1e')](function(_0x44678e){if(_0x44678e){return _0x44678e[_0x1cd8('0x35')]({'UserId':_0x539d6c[_0x1cd8('0x55')]['UserId'],'read1stAt':_[_0x1cd8('0x61')](_0x44678e['read1stAt'])?moment()[_0x1cd8('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x45b980){if(_0x45b980){_0x380dcd[_0x1cd8('0x63')]=_0x45b980[_0x1cd8('0x5e')]({'plain':!![]});interaction_log[_0x1cd8('0x1f')](_0x1cd8('0x64'),_0x539d6c[_0x1cd8('0x5d')]['id'],_0x539d6c[_0x1cd8('0x5d')][_0x1cd8('0x38')],_0x539d6c[_0x1cd8('0x5d')]['role'],_0x380dcd[_0x1cd8('0x63')]['id'],_0x539d6c['body']?JSON[_0x1cd8('0x23')](_0x539d6c[_0x1cd8('0x55')]):_0x1cd8('0x65'));return respondWithRpcPromise(_0x1cd8('0x66'),'acceptMessage',_0x380dcd);}return null;})['then'](function(_0x304844){var _0x45b9e3=_0x1cd8('0x67')+_0x304844[_0x1cd8('0x26')][_0x1cd8('0x68')];return db['sequelize'][_0x1cd8('0x3f')](_0x45b9e3,{'type':db[_0x1cd8('0x69')]['QueryTypes'][_0x1cd8('0x6a')],'raw':!![]})['then'](function(_0x49c616){return _0x49c616;});})['then'](function(_0x367be6){if(_0x367be6){_0x380dcd['message'][_0x1cd8('0x6b')]=_0x367be6[0x0];if(!_0x539d6c[_0x1cd8('0x55')][_0x1cd8('0x5c')])return;return db[_0x1cd8('0x6c')][_0x1cd8('0x53')]({'where':{'id':_0x539d6c[_0x1cd8('0x55')][_0x1cd8('0x5c')],'role':'agent'},'attributes':['id',_0x1cd8('0x38'),_0x1cd8('0x6d'),_0x1cd8('0x6e'),_0x1cd8('0x6f')],'raw':!![]});}return null;})[_0x1cd8('0x1e')](function(_0x535f3f){if(!_0x535f3f)return null;_0x380dcd['message']['agent']=_0x535f3f;return _0x380dcd;})['then'](function(_0xab3cee){if(_0xab3cee){if(_0x539d6c[_0x1cd8('0x55')]['manual']){_0x380dcd[_0x1cd8('0x26')][_0x1cd8('0x70')]=util[_0x1cd8('0x62')](_0x1cd8('0x71'),_0x539d6c[_0x1cd8('0x5d')][_0x1cd8('0x38')]);_0x380dcd[_0x1cd8('0x26')][_0x1cd8('0x72')]=_0x380dcd[_0x1cd8('0x72')];_0x380dcd['message'][_0x1cd8('0x73')]=_0x380dcd[_0x1cd8('0x72')];_0x380dcd[_0x1cd8('0x26')]['event']=_0x1cd8('0x58');return respondWithRpcPromise(_0x1cd8('0x74'),_0x1cd8('0x74'),{'event':_0x1cd8('0x75'),'message':_0x380dcd[_0x1cd8('0x26')]},client9002)[_0x1cd8('0x1e')](function(){return _0x380dcd;});}return _0x380dcd;}return null;})[_0x1cd8('0x1e')](respondWithResult(_0x4ccf9e,null))[_0x1cd8('0x28')](handleError(_0x4ccf9e,null));};var interaction_log=require('../../config/logger')(_0x1cd8('0x57'));exports[_0x1cd8('0x33')]=function(_0x52eadc,_0x2ff61e,_0x48cb60){var _0x477ba8={'agent':{},'channel':_0x1cd8('0x76')};if(_0x52eadc['body']['id']){delete _0x52eadc[_0x1cd8('0x55')]['id'];}_0x52eadc['body']['UserId']=_0x52eadc[_0x1cd8('0x55')][_0x1cd8('0x5c')]||_0x52eadc[_0x1cd8('0x5d')]['id'];_0x477ba8['agent']['id']=_0x52eadc[_0x1cd8('0x55')][_0x1cd8('0x5c')];return db[_0x1cd8('0x4b')]['find']({'where':{'id':_0x52eadc[_0x1cd8('0x51')]['id'],'UserId':null}})[_0x1cd8('0x1e')](handleEntityNotFound(_0x2ff61e,null))['then'](function(_0x4a098e){if(_0x4a098e){_0x477ba8[_0x1cd8('0x26')]=_0x4a098e[_0x1cd8('0x5e')]({'plain':!![]});return db[_0x1cd8('0x5f')][_0x1cd8('0x53')]({'where':{'id':_0x4a098e[_0x1cd8('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x2ff61e,null))[_0x1cd8('0x1e')](function(_0x16e441){if(_0x16e441){_0x477ba8[_0x1cd8('0x63')]=_0x16e441['get']({'plain':!![]});interaction_log['info'](_0x1cd8('0x77'),_0x52eadc['user']['id'],_0x52eadc[_0x1cd8('0x5d')][_0x1cd8('0x38')],_0x52eadc['user'][_0x1cd8('0x78')],_0x477ba8[_0x1cd8('0x63')]['id'],_0x52eadc[_0x1cd8('0x55')]?JSON[_0x1cd8('0x23')](_0x52eadc['body']):_0x1cd8('0x65'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x477ba8);}return null;})[_0x1cd8('0x1e')](function(_0x3f0363){var _0x49c0c4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f0363[_0x1cd8('0x26')][_0x1cd8('0x68')];return db['sequelize']['query'](_0x49c0c4,{'type':db[_0x1cd8('0x69')]['QueryTypes'][_0x1cd8('0x6a')],'raw':!![]})[_0x1cd8('0x1e')](function(_0x236044){return _0x236044;});})[_0x1cd8('0x1e')](function(_0x50c0a8){if(_0x50c0a8){_0x477ba8[_0x1cd8('0x26')][_0x1cd8('0x6b')]=_0x50c0a8[0x0];if(!_0x52eadc[_0x1cd8('0x55')][_0x1cd8('0x5c')])return;return db[_0x1cd8('0x6c')][_0x1cd8('0x53')]({'where':{'id':_0x52eadc['body'][_0x1cd8('0x5c')],'role':_0x1cd8('0x79')},'attributes':['id',_0x1cd8('0x38'),_0x1cd8('0x6d'),_0x1cd8('0x6e'),_0x1cd8('0x6f')],'raw':!![]});}return null;})[_0x1cd8('0x1e')](function(_0x3dcaa7){if(!_0x3dcaa7)return null;_0x477ba8['message'][_0x1cd8('0x79')]=_0x3dcaa7;return _0x477ba8;})[_0x1cd8('0x1e')](function(_0x2f5318){if(_0x2f5318){_0x2f5318[_0x1cd8('0x26')][_0x1cd8('0x70')]=util[_0x1cd8('0x62')]('SIP/%s',_0x52eadc[_0x1cd8('0x5d')][_0x1cd8('0x38')]);_0x2f5318['message'][_0x1cd8('0x72')]=_0x477ba8[_0x1cd8('0x72')];_0x2f5318[_0x1cd8('0x26')][_0x1cd8('0x73')]=_0x477ba8[_0x1cd8('0x72')];_0x2f5318[_0x1cd8('0x26')][_0x1cd8('0x7a')]=_0x1cd8('0x33');respondWithRpcPromise(_0x1cd8('0x74'),_0x1cd8('0x74'),{'event':_0x1cd8('0x7b'),'message':_0x2f5318[_0x1cd8('0x26')]},client9002);return _0x477ba8;}return null;})[_0x1cd8('0x1e')](respondWithResult(_0x2ff61e,null))[_0x1cd8('0x28')](handleError(_0x2ff61e,null));};exports[_0x1cd8('0x2a')]=function(_0x288b3b,_0x520dfd,_0x26ae3c){if(_0x288b3b[_0x1cd8('0x55')]['id']){delete _0x288b3b[_0x1cd8('0x55')]['id'];}var _0x16b9c9;return db[_0x1cd8('0x4b')]['find']({'where':{'id':_0x288b3b[_0x1cd8('0x51')]['id']}})[_0x1cd8('0x1e')](handleEntityNotFound(_0x520dfd,null))[_0x1cd8('0x1e')](function(_0x1723d3){if(_0x1723d3){_0x16b9c9=_0x1723d3;return db[_0x1cd8('0x7c')][_0x1cd8('0x53')]({'where':{'id':_0x1723d3[_0x1cd8('0x7d')]}});}})[_0x1cd8('0x1e')](handleEntityNotFound(_0x520dfd,null))['then'](function(_0x364032){if(_0x364032){logger['debug'](_0x1cd8('0x7e'),_0x1cd8('0x2a'),_0x1cd8('0x7f'),_0x364032['type'],util[_0x1cd8('0x80')](_0x288b3b[_0x1cd8('0x55')],{'showHidden':![],'depth':null}));switch(_0x364032['type']){case _0x1cd8('0x81'):if(_0x288b3b[_0x1cd8('0x55')][_0x1cd8('0x82')]&&_0x288b3b[_0x1cd8('0x55')][_0x1cd8('0x82')]===_0x16b9c9[_0x1cd8('0x83')]&&_0x288b3b['body'][_0x1cd8('0x84')]&&_0x288b3b['body'][_0x1cd8('0x84')]===_0x1cd8('0x59')){return _0x16b9c9[_0x1cd8('0x35')]({'read':!![]});}else{logger[_0x1cd8('0x24')](_0x1cd8('0x85'),'status','twilio',util[_0x1cd8('0x80')](_0x288b3b[_0x1cd8('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x16b9c9;}})['then'](respondWithResult(_0x520dfd,null))['catch'](handleError(_0x520dfd,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 88f29d0..3a89ac8 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 _0xd547=['hook','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xd547,0x1c1));var _0x7d54=function(_0x1ee41b,_0x1874af){_0x1ee41b=_0x1ee41b-0x0;var _0x1f5200=_0xd547[_0x1ee41b];return _0x1f5200;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x7d54('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7d54('0x1')](0x0);var events={'afterCreate':_0x7d54('0x2'),'afterUpdate':_0x7d54('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ab00b){return function(_0x21c23f,_0x5d21c1,_0x22ea09){WhatsappMessageEvents['emit'](_0x4ab00b+':'+_0x21c23f['id'],_0x21c23f);WhatsappMessageEvents[_0x7d54('0x4')](_0x4ab00b,_0x21c23f);_0x22ea09(null);};}for(var e in events){if(events[_0x7d54('0x5')](e)){var event=events[e];WhatsappMessage[_0x7d54('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xeffd=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners'];(function(_0x8e74c4,_0x4c3b72){var _0x50e53f=function(_0x2a4eef){while(--_0x2a4eef){_0x8e74c4['push'](_0x8e74c4['shift']());}};_0x50e53f(++_0x4c3b72);}(_0xeffd,0x6b));var _0xdeff=function(_0x47bcd3,_0x14c761){_0x47bcd3=_0x47bcd3-0x0;var _0x127ff8=_0xeffd[_0x47bcd3];return _0x127ff8;};'use strict';var EventEmitter=require(_0xdeff('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xdeff('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xdeff('0x2')](0x0);var events={'afterCreate':_0xdeff('0x3'),'afterUpdate':_0xdeff('0x4'),'afterDestroy':_0xdeff('0x5')};function emitEvent(_0x4dac0){return function(_0x298274,_0x2881fd,_0x8315d4){WhatsappMessageEvents[_0xdeff('0x6')](_0x4dac0+':'+_0x298274['id'],_0x298274);WhatsappMessageEvents[_0xdeff('0x6')](_0x4dac0,_0x298274);_0x8315d4(null);};}for(var e in events){if(events[_0xdeff('0x7')](e)){var event=events[e];WhatsappMessage[_0xdeff('0x8')](e,emitEvent(event));}}module[_0xdeff('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 62176d1..5aad5fd 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 _0x201c=['POST','application/json','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','node-fetch','path','../../config/environment','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','out','WhatsappInteraction','then','update','createdAt','toLowerCase','catch','error','find','WhatsappAccountId','type','accountSid','authToken','phone','messages','create','body','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text'];(function(_0x49eb4f,_0x197eb3){var _0x52c8fe=function(_0x28983d){while(--_0x28983d){_0x49eb4f['push'](_0x49eb4f['shift']());}};_0x52c8fe(++_0x197eb3);}(_0x201c,0x10b));var _0xc201=function(_0x3dae4f,_0x964e6e){_0x3dae4f=_0x3dae4f-0x0;var _0x38fc9b=_0x201c[_0x3dae4f];return _0x38fc9b;};'use strict';var _=require(_0xc201('0x0'));var util=require('util');var logger=require(_0xc201('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc201('0x2'));var rp=require(_0xc201('0x3'));var fetch=require(_0xc201('0x4'));var fs=require('fs');var path=require(_0xc201('0x5'));var rimraf=require('rimraf');var config=require(_0xc201('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xc201('0x7')]=function(_0x53a626,_0x269ec3){return _0x53a626[_0xc201('0x8')](_0xc201('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xc201('0xa'),'fields':[_0xc201('0xa')]},{'name':_0xc201('0xb'),'fields':['body'],'type':_0xc201('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7ede3c,_0x345d6c,_0x549e8e){var _0x2843d2=_0x53a626[_0xc201('0xd')];var _0x4c7ad9=_0x7ede3c[_0xc201('0xe')]({'plain':!![]});if(_0x4c7ad9[_0xc201('0xf')]['toLowerCase']()==='in'||_0x4c7ad9['direction']['toLowerCase']()===_0xc201('0x10')&&!_0x4c7ad9['secret']&&!_['isNil'](_0x4c7ad9['UserId'])){_0x2843d2[_0xc201('0x11')]['findOne']({'where':{'id':_0x4c7ad9['WhatsappInteractionId']}})[_0xc201('0x12')](function(_0x22ef2a){if(_0x22ef2a){_0x22ef2a[_0xc201('0x13')]({'lastMsgAt':_0x4c7ad9[_0xc201('0x14')],'lastMsgDirection':_0x4c7ad9['direction'][_0xc201('0x15')]()});}})[_0xc201('0x16')](function(_0x513ccd){console[_0xc201('0x17')](_0x513ccd);});}if(_0x4c7ad9[_0xc201('0xf')]===_0xc201('0x10')&&!_0x4c7ad9['secret']){var _0x5f3895;_0x2843d2['WhatsappAccount'][_0xc201('0x18')]({'where':{'id':_0x4c7ad9[_0xc201('0x19')]},'raw':!![]})[_0xc201('0x12')](function(_0x176aed){_0x5f3895=_0x176aed;if(_0x5f3895&&_0x5f3895[_0xc201('0x1a')]){switch(_0x5f3895[_0xc201('0x1a')]){case'twilio':var _0x3a1f56=require('twilio');if(_0x5f3895[_0xc201('0x1b')]&&_0x5f3895[_0xc201('0x1c')]&&_0x5f3895[_0xc201('0x1d')]){var _0x50e638=new _0x3a1f56(_0x5f3895[_0xc201('0x1b')],_0x5f3895['authToken']);_0x50e638[_0xc201('0x1e')][_0xc201('0x1f')]({'body':_0x4c7ad9[_0xc201('0x20')],'to':_0xc201('0x21')+_0x4c7ad9[_0xc201('0x1d')],'from':_0xc201('0x21')+_0x5f3895[_0xc201('0x1d')],'statusCallback':_0x5f3895['remote']+_0xc201('0x22')+_0x4c7ad9['id']+_0xc201('0x23')+_0x5f3895[_0xc201('0x24')]})['then'](function(_0x2cc3df){if(_0x2cc3df[_0xc201('0x25')]){return _0x7ede3c['update']({'messageId':_0x2cc3df['sid']});}})[_0xc201('0x16')](function(_0x56a2c0){logger[_0xc201('0x17')](_0xc201('0x26'),'afterCreate','twilio',util['inspect'](_0x56a2c0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc201('0x26'),_0xc201('0x27'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc201('0x28'):var _0x5efbb=_0x5f3895[_0xc201('0x1b')];var _0x291466=_0x5f3895[_0xc201('0x1c')];var _0x142e36=_0x5f3895[_0xc201('0x29')]+_0xc201('0x2a')+_0x5efbb+_0xc201('0x2b');var _0x2455c5={'to':[_0x4c7ad9[_0xc201('0x1d')]],'message':{'type':_0xc201('0x2c'),'text':_0x4c7ad9[_0xc201('0x20')]}};var _0x4a1897={'method':_0xc201('0x2d'),'uri':_0x142e36,'headers':{'Authorization':'Bearer\x20'+_0x291466,'Content-Type':_0xc201('0x2e')},'body':_0x2455c5,'json':!![]};rp(_0x4a1897)[_0xc201('0x12')](function(_0x2269a0){if(_0x2269a0[_0xc201('0x2f')][0x0][_0xc201('0x30')]){return _0x7ede3c[_0xc201('0x13')]({'messageId':_0x2269a0[_0xc201('0x2f')][0x0][_0xc201('0x30')]});}})[_0xc201('0x16')](function(_0x37b2d4){logger['err']('WhatsappMessage,\x20%s',_0x37b2d4);});break;}}})[_0xc201('0x31')](function(){_0x549e8e();});}else{_0x549e8e();}}},'charset':_0xc201('0x32'),'collate':_0xc201('0x33')});}; \ No newline at end of file +var _0x9b37=['afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/messages/','text','message_id','update','statuses','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','whatsapp_messages','messageId','body','models','get','toLowerCase','direction','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','catch','secret','WhatsappAccount','find','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b37,0x1c5));var _0x79b3=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9b37[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require(_0x79b3('0x0'));var logger=require(_0x79b3('0x1'))(_0x79b3('0x2'));var moment=require(_0x79b3('0x3'));var BPromise=require(_0x79b3('0x4'));var rp=require(_0x79b3('0x5'));var fetch=require(_0x79b3('0x6'));var fs=require('fs');var path=require(_0x79b3('0x7'));var rimraf=require(_0x79b3('0x8'));var config=require(_0x79b3('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0x79b3('0xa')]=function(_0x1396e5,_0x4f9609){return _0x1396e5[_0x79b3('0xb')]('WhatsappMessage',attributes,{'tableName':_0x79b3('0xc'),'paranoid':![],'indexes':[{'name':_0x79b3('0xd'),'fields':[_0x79b3('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x79b3('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f10f0,_0x3a2e69,_0x2d8af3){var _0x581378=_0x1396e5[_0x79b3('0xf')];var _0x48844d=_0x5f10f0[_0x79b3('0x10')]({'plain':!![]});if(_0x48844d['direction'][_0x79b3('0x11')]()==='in'||_0x48844d[_0x79b3('0x12')][_0x79b3('0x11')]()===_0x79b3('0x13')&&!_0x48844d['secret']&&!_[_0x79b3('0x14')](_0x48844d[_0x79b3('0x15')])){_0x581378[_0x79b3('0x16')][_0x79b3('0x17')]({'where':{'id':_0x48844d[_0x79b3('0x18')]}})[_0x79b3('0x19')](function(_0x4bf2ca){if(_0x4bf2ca){_0x4bf2ca['update']({'lastMsgAt':_0x48844d['createdAt'],'lastMsgDirection':_0x48844d[_0x79b3('0x12')][_0x79b3('0x11')]()});}})[_0x79b3('0x1a')](function(_0x1313eb){console['error'](_0x1313eb);});}if(_0x48844d[_0x79b3('0x12')]===_0x79b3('0x13')&&!_0x48844d[_0x79b3('0x1b')]){var _0x43f6f4;_0x581378[_0x79b3('0x1c')][_0x79b3('0x1d')]({'where':{'id':_0x48844d['WhatsappAccountId']},'raw':!![]})[_0x79b3('0x19')](function(_0x72606d){_0x43f6f4=_0x72606d;if(_0x43f6f4&&_0x43f6f4['type']){switch(_0x43f6f4[_0x79b3('0x1e')]){case _0x79b3('0x1f'):var _0x2ce6bc=require(_0x79b3('0x1f'));if(_0x43f6f4['accountSid']&&_0x43f6f4[_0x79b3('0x20')]&&_0x43f6f4[_0x79b3('0x21')]){var _0x41cee1=new _0x2ce6bc(_0x43f6f4[_0x79b3('0x22')],_0x43f6f4[_0x79b3('0x20')]);_0x41cee1[_0x79b3('0x23')]['create']({'body':_0x48844d[_0x79b3('0xe')],'to':_0x79b3('0x24')+_0x48844d[_0x79b3('0x21')],'from':'whatsapp:'+_0x43f6f4['phone'],'statusCallback':_0x43f6f4[_0x79b3('0x25')]+'/api/whatsapp/messages/'+_0x48844d['id']+_0x79b3('0x26')+_0x43f6f4[_0x79b3('0x27')]})[_0x79b3('0x19')](function(_0xd3a380){if(_0xd3a380[_0x79b3('0x28')]){return _0x5f10f0['update']({'messageId':_0xd3a380[_0x79b3('0x28')]});}})[_0x79b3('0x1a')](function(_0x2536c8){logger['error'](_0x79b3('0x29'),_0x79b3('0x2a'),_0x79b3('0x1f'),util[_0x79b3('0x2b')](_0x2536c8,{'showHidden':![],'depth':null}));});}else{logger[_0x79b3('0x2c')](_0x79b3('0x29'),_0x79b3('0x2a'),_0x79b3('0x1f'),_0x79b3('0x2d'));}break;case _0x79b3('0x2e'):var _0x5ca155=_0x43f6f4[_0x79b3('0x22')];var _0x527ff2=_0x43f6f4[_0x79b3('0x20')];var _0x36381b=_0x43f6f4['baseUrl']+'/whatsapp/v1/'+_0x5ca155+_0x79b3('0x2f');var _0xcda4e8={'to':[_0x48844d[_0x79b3('0x21')]],'message':{'type':_0x79b3('0x30'),'text':_0x48844d[_0x79b3('0xe')]}};var _0x50f14d={'method':'POST','uri':_0x36381b,'headers':{'Authorization':'Bearer\x20'+_0x527ff2,'Content-Type':'application/json'},'body':_0xcda4e8,'json':!![]};rp(_0x50f14d)[_0x79b3('0x19')](function(_0x57cfc6){if(_0x57cfc6['statuses'][0x0][_0x79b3('0x31')]){return _0x5f10f0[_0x79b3('0x32')]({'messageId':_0x57cfc6[_0x79b3('0x33')][0x0][_0x79b3('0x31')]});}})['catch'](function(_0x44318a){logger['err']('WhatsappMessage,\x20%s',_0x44318a);});break;}}})[_0x79b3('0x34')](function(){_0x2d8af3();});}else{_0x2d8af3();}}},'charset':_0x79b3('0x35'),'collate':_0x79b3('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e8df510..4aaab72 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 _0x4b4c=['../../config/environment','client','redis','localhost','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x4b4c,0x162));var _0xc4b4=function(_0x191485,_0x18a5ec){_0x191485=_0x191485-0x0;var _0x4e9c7a=_0x4b4c[_0x191485];return _0x4e9c7a;};'use strict';var _=require(_0xc4b4('0x0'));var util=require(_0xc4b4('0x1'));var moment=require(_0xc4b4('0x2'));var BPromise=require(_0xc4b4('0x3'));var rs=require(_0xc4b4('0x4'));var fs=require('fs');var Redis=require(_0xc4b4('0x5'));var db=require(_0xc4b4('0x6'))['db'];var utils=require(_0xc4b4('0x7'));var logger=require('../../config/logger')(_0xc4b4('0x8'));var config=require(_0xc4b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc4b4('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc4b4('0xb')],{'host':_0xc4b4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4b4('0xb')]));require(_0xc4b4('0xd'))[_0xc4b4('0xe')](socket);function respondWithRpcPromise(_0x29a01d,_0x4fee90,_0x13b8ce){return new BPromise(function(_0x14ade0,_0x6714cf){return client[_0xc4b4('0xf')](_0x29a01d,_0x13b8ce)[_0xc4b4('0x10')](function(_0x80499e){logger['info'](_0xc4b4('0x11'),_0x4fee90,_0xc4b4('0x12'));logger[_0xc4b4('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4fee90,_0xc4b4('0x12'),JSON[_0xc4b4('0x14')](_0x80499e));if(_0x80499e['error']){if(_0x80499e[_0xc4b4('0x15')][_0xc4b4('0x16')]===0x1f4){logger[_0xc4b4('0x15')](_0xc4b4('0x11'),_0x4fee90,_0x80499e[_0xc4b4('0x15')]['message']);return _0x6714cf(_0x80499e[_0xc4b4('0x15')][_0xc4b4('0x17')]);}logger[_0xc4b4('0x15')](_0xc4b4('0x11'),_0x4fee90,_0x80499e['error'][_0xc4b4('0x17')]);return _0x14ade0(_0x80499e[_0xc4b4('0x15')]['message']);}else{logger[_0xc4b4('0x18')](_0xc4b4('0x11'),_0x4fee90,_0xc4b4('0x12'));_0x14ade0(_0x80499e[_0xc4b4('0x19')][_0xc4b4('0x17')]);}})[_0xc4b4('0x1a')](function(_0x2b8c0a){logger[_0xc4b4('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x4fee90,_0x2b8c0a);_0x6714cf(_0x2b8c0a);});});}exports[_0xc4b4('0x1b')]=function(_0x514234){var _0x47be6a=this;return new Promise(function(_0x15ec3c,_0x6576b0){return db[_0xc4b4('0x1c')][_0xc4b4('0x1d')](_0x514234[_0xc4b4('0x1e')],{'raw':_0x514234[_0xc4b4('0x1f')]?_0x514234[_0xc4b4('0x1f')][_0xc4b4('0x20')]===undefined?!![]:![]:!![]})[_0xc4b4('0x10')](function(_0x162305){logger[_0xc4b4('0x18')](_0xc4b4('0x1b'),_0x514234);logger['debug']('CreateWhatsappMessage',_0x514234,JSON['stringify'](_0x162305));_0x15ec3c(_0x162305);})[_0xc4b4('0x1a')](function(_0x4be294){logger[_0xc4b4('0x15')]('CreateWhatsappMessage',_0x4be294['message'],_0x514234);_0x6576b0(_0x47be6a[_0xc4b4('0x15')](0x1f4,_0x4be294[_0xc4b4('0x17')]));});});}; \ No newline at end of file +var _0x51cd=['info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage','body','options','raw','then','CreateWhatsappMessage','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xb72117,_0x349096){var _0xeb1f7e=function(_0x4df89f){while(--_0x4df89f){_0xb72117['push'](_0xb72117['shift']());}};_0xeb1f7e(++_0x349096);}(_0x51cd,0x153));var _0xd51c=function(_0x5f5b4b,_0x3b6380){_0x5f5b4b=_0x5f5b4b-0x0;var _0x4d601e=_0x51cd[_0x5f5b4b];return _0x4d601e;};'use strict';var _=require(_0xd51c('0x0'));var util=require(_0xd51c('0x1'));var moment=require(_0xd51c('0x2'));var BPromise=require(_0xd51c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd51c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd51c('0x5'));var logger=require('../../config/logger')(_0xd51c('0x6'));var config=require(_0xd51c('0x7'));var jayson=require(_0xd51c('0x8'));var client=jayson[_0xd51c('0x9')][_0xd51c('0xa')]({'port':0x232a});config[_0xd51c('0xb')]=_[_0xd51c('0xc')](config[_0xd51c('0xb')],{'host':_0xd51c('0xd'),'port':0x18eb});var socket=require(_0xd51c('0xe'))(new Redis(config[_0xd51c('0xb')]));require('./whatsappMessage.socket')[_0xd51c('0xf')](socket);function respondWithRpcPromise(_0x1ec78b,_0xec30b,_0x5cdfb5){return new BPromise(function(_0x5a1fe8,_0x292e02){return client[_0xd51c('0x10')](_0x1ec78b,_0x5cdfb5)['then'](function(_0x840b34){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xec30b,_0xd51c('0x11'));logger[_0xd51c('0x12')](_0xd51c('0x13'),_0xec30b,_0xd51c('0x11'),JSON[_0xd51c('0x14')](_0x840b34));if(_0x840b34[_0xd51c('0x15')]){if(_0x840b34['error'][_0xd51c('0x16')]===0x1f4){logger[_0xd51c('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0xec30b,_0x840b34[_0xd51c('0x15')][_0xd51c('0x17')]);return _0x292e02(_0x840b34[_0xd51c('0x15')][_0xd51c('0x17')]);}logger[_0xd51c('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0xec30b,_0x840b34[_0xd51c('0x15')][_0xd51c('0x17')]);return _0x5a1fe8(_0x840b34[_0xd51c('0x15')][_0xd51c('0x17')]);}else{logger[_0xd51c('0x18')](_0xd51c('0x19'),_0xec30b,_0xd51c('0x11'));_0x5a1fe8(_0x840b34['result'][_0xd51c('0x17')]);}})['catch'](function(_0x1fc73f){logger[_0xd51c('0x15')](_0xd51c('0x19'),_0xec30b,_0x1fc73f);_0x292e02(_0x1fc73f);});});}exports['CreateWhatsappMessage']=function(_0x3cbdbb){var _0x2836eb=this;return new Promise(function(_0x4f4ec8,_0x36c19a){return db[_0xd51c('0x1a')]['create'](_0x3cbdbb[_0xd51c('0x1b')],{'raw':_0x3cbdbb[_0xd51c('0x1c')]?_0x3cbdbb[_0xd51c('0x1c')][_0xd51c('0x1d')]===undefined?!![]:![]:!![]})[_0xd51c('0x1e')](function(_0xfd88e5){logger['info']('CreateWhatsappMessage',_0x3cbdbb);logger[_0xd51c('0x12')](_0xd51c('0x1f'),_0x3cbdbb,JSON['stringify'](_0xfd88e5));_0x4f4ec8(_0xfd88e5);})[_0xd51c('0x20')](function(_0x4706ca){logger[_0xd51c('0x15')](_0xd51c('0x1f'),_0x4706ca['message'],_0x3cbdbb);_0x36c19a(_0x2836eb['error'](0x1f4,_0x4706ca[_0xd51c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e34080e..8d7cc9a 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 _0x6dee=['length','whatsappMessage:','save','remove','update','emit','removeListener'];(function(_0x100b85,_0x4997b5){var _0xf4f5aa=function(_0x5d0924){while(--_0x5d0924){_0x100b85['push'](_0x100b85['shift']());}};_0xf4f5aa(++_0x4997b5);}(_0x6dee,0x1c2));var _0xe6de=function(_0x5170ed,_0x591fb4){_0x5170ed=_0x5170ed-0x0;var _0x2829e6=_0x6dee[_0x5170ed];return _0x2829e6;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xe6de('0x0'),_0xe6de('0x1'),_0xe6de('0x2')];function createListener(_0x2d1325,_0xefec7e){return function(_0x3c35ad){_0xefec7e[_0xe6de('0x3')](_0x2d1325,_0x3c35ad);};}function removeListener(_0xae8bff,_0x20edf8){return function(){WhatsappMessageEvents[_0xe6de('0x4')](_0xae8bff,_0x20edf8);};}exports['register']=function(_0x46d07b){for(var _0x50ace2=0x0,_0x29fc21=events[_0xe6de('0x5')];_0x50ace2<_0x29fc21;_0x50ace2++){var _0x3647b6=events[_0x50ace2];var _0x3476ab=createListener(_0xe6de('0x6')+_0x3647b6,_0x46d07b);WhatsappMessageEvents['on'](_0x3647b6,_0x3476ab);}}; \ No newline at end of file +var _0x87ac=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x4821d9,_0xe56baa){var _0x479aed=function(_0x2283e7){while(--_0x2283e7){_0x4821d9['push'](_0x4821d9['shift']());}};_0x479aed(++_0xe56baa);}(_0x87ac,0x1e4));var _0xc87a=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x87ac[_0x4ded65];return _0x5864fb;};'use strict';var WhatsappMessageEvents=require(_0xc87a('0x0'));var events=[_0xc87a('0x1'),_0xc87a('0x2'),_0xc87a('0x3')];function createListener(_0x24a2a2,_0x57fd49){return function(_0x514f0c){_0x57fd49[_0xc87a('0x4')](_0x24a2a2,_0x514f0c);};}function removeListener(_0xab56b0,_0x44ebee){return function(){WhatsappMessageEvents[_0xc87a('0x5')](_0xab56b0,_0x44ebee);};}exports['register']=function(_0x4d1f20){for(var _0x44eb1f=0x0,_0x436604=events['length'];_0x44eb1f<_0x436604;_0x44eb1f++){var _0x5ea93a=events[_0x44eb1f];var _0x547e0f=createListener(_0xc87a('0x6')+_0x5ea93a,_0x4d1f20);WhatsappMessageEvents['on'](_0x5ea93a,_0x547e0f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ce98b93..f1cc751 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 _0x61ed=['util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','addAgents','put','update','delete','removeAgents','exports'];(function(_0x1e2a66,_0x1bbeed){var _0xde23fe=function(_0x65c7de){while(--_0x65c7de){_0x1e2a66['push'](_0x1e2a66['shift']());}};_0xde23fe(++_0x1bbeed);}(_0x61ed,0xf2));var _0xd61e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61ed[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xd61e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd61e('0x1'));var router=express[_0xd61e('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd61e('0x3'));var config=require(_0xd61e('0x4'));var controller=require('./whatsappQueue.controller');router[_0xd61e('0x5')]('/',auth[_0xd61e('0x6')](),controller['index']);router[_0xd61e('0x5')](_0xd61e('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xd61e('0x5')](_0xd61e('0x8'),auth['isAuthenticated'](),controller[_0xd61e('0x9')]);router[_0xd61e('0x5')](_0xd61e('0xa'),auth[_0xd61e('0x6')](),controller[_0xd61e('0xb')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xd61e('0x5')](_0xd61e('0xc'),auth[_0xd61e('0x6')](),controller[_0xd61e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd61e('0xe')](_0xd61e('0xf'),auth[_0xd61e('0x6')](),controller['addTeams']);router['post']('/:id/users',auth[_0xd61e('0x6')](),controller[_0xd61e('0x10')]);router[_0xd61e('0x11')]('/:id',auth[_0xd61e('0x6')](),controller[_0xd61e('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd61e('0x13')](_0xd61e('0xf'),auth[_0xd61e('0x6')](),controller['removeTeams']);router['delete'](_0xd61e('0xc'),auth['isAuthenticated'](),controller[_0xd61e('0x14')]);module[_0xd61e('0x15')]=router; \ No newline at end of file +var _0xd088=['post','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','describe','isAuthenticated','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create'];(function(_0x2cfd0b,_0x12c7b2){var _0x57906e=function(_0x3e2743){while(--_0x3e2743){_0x2cfd0b['push'](_0x2cfd0b['shift']());}};_0x57906e(++_0x12c7b2);}(_0xd088,0x16a));var _0x8d08=function(_0x388540,_0x5614a7){_0x388540=_0x388540-0x0;var _0x39fe8c=_0xd088[_0x388540];return _0x39fe8c;};'use strict';var multer=require(_0x8d08('0x0'));var util=require(_0x8d08('0x1'));var path=require(_0x8d08('0x2'));var timeout=require(_0x8d08('0x3'));var express=require(_0x8d08('0x4'));var router=express[_0x8d08('0x5')]();var fs_extra=require(_0x8d08('0x6'));var auth=require(_0x8d08('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8d08('0x8'));var controller=require(_0x8d08('0x9'));router[_0x8d08('0xa')]('/',auth['isAuthenticated'](),controller[_0x8d08('0xb')]);router['get'](_0x8d08('0xc'),auth['isAuthenticated'](),controller[_0x8d08('0xd')]);router[_0x8d08('0xa')]('/:id',auth[_0x8d08('0xe')](),controller[_0x8d08('0xf')]);router[_0x8d08('0xa')]('/:id/members',auth[_0x8d08('0xe')](),controller[_0x8d08('0x10')]);router[_0x8d08('0xa')](_0x8d08('0x11'),auth['isAuthenticated'](),controller[_0x8d08('0x12')]);router[_0x8d08('0xa')](_0x8d08('0x13'),auth[_0x8d08('0xe')](),controller[_0x8d08('0x14')]);router['post']('/',auth[_0x8d08('0xe')](),controller[_0x8d08('0x15')]);router[_0x8d08('0x16')](_0x8d08('0x11'),auth[_0x8d08('0xe')](),controller['addTeams']);router[_0x8d08('0x16')]('/:id/users',auth[_0x8d08('0xe')](),controller[_0x8d08('0x17')]);router[_0x8d08('0x18')](_0x8d08('0x19'),auth['isAuthenticated'](),controller[_0x8d08('0x1a')]);router[_0x8d08('0x1b')](_0x8d08('0x19'),auth[_0x8d08('0xe')](),controller[_0x8d08('0x1c')]);router[_0x8d08('0x1b')](_0x8d08('0x11'),auth[_0x8d08('0xe')](),controller[_0x8d08('0x1d')]);router[_0x8d08('0x1b')](_0x8d08('0x13'),auth[_0x8d08('0xe')](),controller[_0x8d08('0x1e')]);module[_0x8d08('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d46d5af..0587e85 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 _0xfa7c=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x573898,_0x17ee35){var _0x4a1528=function(_0x35169b){while(--_0x35169b){_0x573898['push'](_0x573898['shift']());}};_0x4a1528(++_0x17ee35);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x10cf32,_0x47abf4){_0x10cf32=_0x10cf32-0x0;var _0x4270da=_0xfa7c[_0x10cf32];return _0x4270da;};'use strict';var Sequelize=require(_0xcfa7('0x0'));module['exports']={'name':{'type':Sequelize[_0xcfa7('0x1')],'unique':_0xcfa7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcfa7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcfa7('0x4')](_0xcfa7('0x5'),_0xcfa7('0x6'),_0xcfa7('0x7'))},'description':{'type':Sequelize[_0xcfa7('0x1')]}}; \ No newline at end of file +var _0xfa12=['roundrobin','STRING','sequelize','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x5c1329,_0x44d752){_0x5c1329=_0x5c1329-0x0;var _0x282631=_0xfa12[_0x5c1329];return _0x282631;};'use strict';var Sequelize=require(_0x2fa1('0x0'));module[_0x2fa1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2fa1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2fa1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2fa1('0x4')](_0x2fa1('0x5'),'beepall',_0x2fa1('0x6'))},'description':{'type':Sequelize[_0x2fa1('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f3fb816..7798798 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 _0x9e11=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','hasOwnProperty','nolimit','ids','Agents','online','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','removeTeams','Team','select','field','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','map','WhatsappQueue','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9e11,0x1dd));var _0x19e1=function(_0x51d59a,_0x298939){_0x51d59a=_0x51d59a-0x0;var _0x193f56=_0x9e11[_0x51d59a];return _0x193f56;};'use strict';var emlformat=require(_0x19e1('0x0'));var rimraf=require(_0x19e1('0x1'));var zipdir=require(_0x19e1('0x2'));var jsonpatch=require(_0x19e1('0x3'));var rp=require(_0x19e1('0x4'));var moment=require(_0x19e1('0x5'));var BPromise=require(_0x19e1('0x6'));var Mustache=require(_0x19e1('0x7'));var util=require(_0x19e1('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x19e1('0x9'));var ejs=require(_0x19e1('0xa'));var fs=require('fs');var fs_extra=require(_0x19e1('0xb'));var _=require(_0x19e1('0xc'));var squel=require('squel');var crypto=require(_0x19e1('0xd'));var jsforce=require(_0x19e1('0xe'));var deskjs=require(_0x19e1('0xf'));var toCsv=require(_0x19e1('0x9'));var querystring=require(_0x19e1('0x10'));var Papa=require('papaparse');var Redis=require(_0x19e1('0x11'));var authService=require(_0x19e1('0x12'));var qs=require(_0x19e1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19e1('0x14'));var logger=require(_0x19e1('0x15'))(_0x19e1('0x16'));var utils=require('../../config/utils');var config=require(_0x19e1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x19e1('0x18'))['db'];config[_0x19e1('0x19')]=_['defaults'](config[_0x19e1('0x19')],{'host':_0x19e1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19e1('0x19')]));require(_0x19e1('0x1b'))[_0x19e1('0x1c')](socket);function respondWithStatusCode(_0x358287,_0x23932a){_0x23932a=_0x23932a||0xcc;return function(_0x213f45){if(_0x213f45){return _0x358287[_0x19e1('0x1d')](_0x23932a);}return _0x358287[_0x19e1('0x1e')](_0x23932a)[_0x19e1('0x1f')]();};}function respondWithResult(_0x308c25,_0x2bea86){_0x2bea86=_0x2bea86||0xc8;return function(_0x2654e2){if(_0x2654e2){return _0x308c25[_0x19e1('0x1e')](_0x2bea86)[_0x19e1('0x20')](_0x2654e2);}};}function respondWithFilteredResult(_0x30dfc2,_0x502737){return function(_0x4ed67b){if(_0x4ed67b){var _0x3336a3=typeof _0x502737[_0x19e1('0x21')]==='undefined'&&typeof _0x502737[_0x19e1('0x22')]==='undefined';var _0x1dd428=_0x4ed67b['count'];var _0xf61ba6=_0x3336a3?0x0:_0x502737['offset'];var _0x4c5db5=_0x3336a3?_0x4ed67b[_0x19e1('0x23')]:_0x502737['offset']+_0x502737['limit'];var _0x5b1dbd;if(_0x4c5db5>=_0x1dd428){_0x4c5db5=_0x1dd428;_0x5b1dbd=0xc8;}else{_0x5b1dbd=0xce;}_0x30dfc2[_0x19e1('0x1e')](_0x5b1dbd);return _0x30dfc2[_0x19e1('0x24')]('Content-Range',_0xf61ba6+'-'+_0x4c5db5+'/'+_0x1dd428)[_0x19e1('0x20')](_0x4ed67b);}return null;};}function patchUpdates(_0x3009d0){return function(_0x2816eb){try{jsonpatch[_0x19e1('0x25')](_0x2816eb,_0x3009d0,!![]);}catch(_0x22663a){return BPromise[_0x19e1('0x26')](_0x22663a);}return _0x2816eb[_0x19e1('0x27')]();};}function saveUpdates(_0xf43b0d,_0x5c16b8){return function(_0x48c4a8){if(_0x48c4a8){return _0x48c4a8[_0x19e1('0x28')](_0xf43b0d)[_0x19e1('0x29')](function(_0x18d7af){return _0x18d7af;});}return null;};}function removeEntity(_0xc61906,_0x4a0d84){return function(_0x476e6d){if(_0x476e6d){return _0x476e6d[_0x19e1('0x2a')]()['then'](function(){var _0xf930d9=_0x476e6d[_0x19e1('0x2b')]({'plain':!![]});var _0x3e80e8=_0x19e1('0x2c');return db[_0x19e1('0x2d')][_0x19e1('0x2a')]({'where':{'type':_0x3e80e8,'resourceId':_0xf930d9['id']}})[_0x19e1('0x29')](function(){return _0x476e6d;});})[_0x19e1('0x29')](function(){_0xc61906[_0x19e1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc5e6f0,_0x1f2c3b){return function(_0x296071){if(!_0x296071){_0xc5e6f0[_0x19e1('0x1d')](0x194);}return _0x296071;};}function handleError(_0x13247b,_0x562c23){_0x562c23=_0x562c23||0x1f4;return function(_0x53afcc){logger[_0x19e1('0x2e')](_0x53afcc[_0x19e1('0x2f')]);if(_0x53afcc[_0x19e1('0x30')]){delete _0x53afcc['name'];}_0x13247b['status'](_0x562c23)[_0x19e1('0x31')](_0x53afcc);};}exports['index']=function(_0x44573c,_0x55080a){var _0x17b539={},_0x206978={},_0x2e3751={'count':0x0,'rows':[]};var _0x37e85b=_[_0x19e1('0x32')](db[_0x19e1('0x33')]['rawAttributes'],function(_0x35ed5a){return{'name':_0x35ed5a[_0x19e1('0x34')],'type':_0x35ed5a[_0x19e1('0x35')][_0x19e1('0x36')]};});_0x206978[_0x19e1('0x37')]=_['map'](_0x37e85b,_0x19e1('0x30'));_0x206978[_0x19e1('0x38')]=_[_0x19e1('0x39')](_0x44573c[_0x19e1('0x38')]);_0x206978[_0x19e1('0x3a')]=_['intersection'](_0x206978['model'],_0x206978['query']);_0x17b539[_0x19e1('0x3b')]=_[_0x19e1('0x3c')](_0x206978['model'],qs[_0x19e1('0x3d')](_0x44573c[_0x19e1('0x38')]['fields']));_0x17b539[_0x19e1('0x3b')]=_0x17b539[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x17b539[_0x19e1('0x3b')]:_0x206978['model'];if(!_0x44573c[_0x19e1('0x38')]['hasOwnProperty']('nolimit')){_0x17b539[_0x19e1('0x22')]=qs[_0x19e1('0x22')](_0x44573c[_0x19e1('0x38')][_0x19e1('0x22')]);_0x17b539[_0x19e1('0x21')]=qs[_0x19e1('0x21')](_0x44573c['query']['offset']);}_0x17b539[_0x19e1('0x3f')]=qs[_0x19e1('0x40')](_0x44573c[_0x19e1('0x38')][_0x19e1('0x40')]);_0x17b539[_0x19e1('0x41')]=qs['filters'](_[_0x19e1('0x42')](_0x44573c['query'],_0x206978[_0x19e1('0x3a')]),_0x37e85b);if(_0x44573c['query'][_0x19e1('0x43')]){_0x17b539[_0x19e1('0x41')]=_[_0x19e1('0x44')](_0x17b539['where'],{'$or':_[_0x19e1('0x32')](_0x37e85b,function(_0x14128e){if(_0x14128e[_0x19e1('0x35')]!==_0x19e1('0x45')){var _0x1e111e={};_0x1e111e[_0x14128e[_0x19e1('0x30')]]={'$like':'%'+_0x44573c[_0x19e1('0x38')]['filter']+'%'};return _0x1e111e;}})});}_0x17b539=_[_0x19e1('0x44')]({},_0x17b539,_0x44573c[_0x19e1('0x46')]);var _0x593151={'where':_0x17b539[_0x19e1('0x41')]};return db[_0x19e1('0x33')][_0x19e1('0x23')](_0x593151)[_0x19e1('0x29')](function(_0x306df1){_0x2e3751[_0x19e1('0x23')]=_0x306df1;if(_0x44573c[_0x19e1('0x38')][_0x19e1('0x47')]){_0x17b539[_0x19e1('0x48')]=[{'all':!![]}];}return db[_0x19e1('0x33')][_0x19e1('0x49')](_0x17b539);})[_0x19e1('0x29')](function(_0x8eadcf){_0x2e3751[_0x19e1('0x4a')]=_0x8eadcf;return _0x2e3751;})[_0x19e1('0x29')](respondWithFilteredResult(_0x55080a,_0x17b539))[_0x19e1('0x4b')](handleError(_0x55080a,null));};exports[_0x19e1('0x4c')]=function(_0x4fbfd5,_0x5bc2b2){var _0x151940={'raw':!![],'where':{'id':_0x4fbfd5[_0x19e1('0x4d')]['id']}},_0xc2ae47={};_0xc2ae47[_0x19e1('0x37')]=_['keys'](db[_0x19e1('0x33')][_0x19e1('0x4e')]);_0xc2ae47[_0x19e1('0x38')]=_['keys'](_0x4fbfd5['query']);_0xc2ae47[_0x19e1('0x3a')]=_['intersection'](_0xc2ae47[_0x19e1('0x37')],_0xc2ae47['query']);_0x151940[_0x19e1('0x3b')]=_[_0x19e1('0x3c')](_0xc2ae47['model'],qs['fields'](_0x4fbfd5[_0x19e1('0x38')]['fields']));_0x151940[_0x19e1('0x3b')]=_0x151940[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x151940['attributes']:_0xc2ae47[_0x19e1('0x37')];if(_0x4fbfd5[_0x19e1('0x38')][_0x19e1('0x47')]){_0x151940[_0x19e1('0x48')]=[{'all':!![]}];}_0x151940=_[_0x19e1('0x44')]({},_0x151940,_0x4fbfd5[_0x19e1('0x46')]);return db['WhatsappQueue'][_0x19e1('0x4f')](_0x151940)[_0x19e1('0x29')](handleEntityNotFound(_0x5bc2b2,null))[_0x19e1('0x29')](respondWithResult(_0x5bc2b2,null))[_0x19e1('0x4b')](handleError(_0x5bc2b2,null));};exports[_0x19e1('0x50')]=function(_0x2e049d,_0x1f49f1){return db[_0x19e1('0x33')]['create'](_0x2e049d[_0x19e1('0x51')],{})[_0x19e1('0x29')](function(_0x29d93d){var _0x47bbde=_0x2e049d[_0x19e1('0x52')][_0x19e1('0x2b')]({'plain':!![]});if(!_0x47bbde)throw new Error(_0x19e1('0x53'));if(_0x47bbde[_0x19e1('0x54')]==='user'){var _0x3094da=_0x29d93d[_0x19e1('0x2b')]({'plain':!![]});var _0x2df62d=_0x19e1('0x2c');return db['UserProfileSection'][_0x19e1('0x4f')]({'where':{'name':_0x2df62d,'userProfileId':_0x47bbde['userProfileId']},'raw':!![]})[_0x19e1('0x29')](function(_0x414cf7){if(_0x414cf7&&_0x414cf7['autoAssociation']===0x0){return db[_0x19e1('0x2d')][_0x19e1('0x50')]({'name':_0x3094da['name'],'resourceId':_0x3094da['id'],'type':_0x414cf7[_0x19e1('0x30')],'sectionId':_0x414cf7['id']},{})[_0x19e1('0x29')](function(){return _0x29d93d;});}else{return _0x29d93d;}})['catch'](function(_0x1006e6){logger['error'](_0x19e1('0x55'),_0x1006e6);throw _0x1006e6;});}return _0x29d93d;})['then'](respondWithResult(_0x1f49f1,0xc9))[_0x19e1('0x4b')](handleError(_0x1f49f1,null));};exports[_0x19e1('0x28')]=function(_0x32e627,_0x54b0ec){if(_0x32e627[_0x19e1('0x51')]['id']){delete _0x32e627[_0x19e1('0x51')]['id'];}return db[_0x19e1('0x33')][_0x19e1('0x4f')]({'where':{'id':_0x32e627[_0x19e1('0x4d')]['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x54b0ec,null))[_0x19e1('0x29')](saveUpdates(_0x32e627[_0x19e1('0x51')],null))[_0x19e1('0x29')](respondWithResult(_0x54b0ec,null))[_0x19e1('0x4b')](handleError(_0x54b0ec,null));};exports['destroy']=function(_0x2a57bb,_0x40fd89){return db[_0x19e1('0x33')]['find']({'where':{'id':_0x2a57bb[_0x19e1('0x4d')]['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x40fd89,null))[_0x19e1('0x29')](removeEntity(_0x40fd89,null))[_0x19e1('0x4b')](handleError(_0x40fd89,null));};exports[_0x19e1('0x56')]=function(_0x3e41cf,_0x51852f){return db[_0x19e1('0x33')]['describe']()[_0x19e1('0x29')](respondWithResult(_0x51852f,null))['catch'](handleError(_0x51852f,null));};exports[_0x19e1('0x57')]=function(_0x28d82f,_0x5380b3,_0x1b9ad1){var _0x2a95d4={'raw':!![],'where':{}},_0x530732={},_0x19a815;return db[_0x19e1('0x33')][_0x19e1('0x58')]({'where':{'id':_0x28d82f['params']['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x5380b3,null))[_0x19e1('0x29')](function(_0x437309){if(_0x437309){_0x19a815=_0x437309[_0x19e1('0x2b')]({'plain':!![]});_0x530732[_0x19e1('0x37')]=_[_0x19e1('0x39')](db[_0x19e1('0x59')][_0x19e1('0x4e')]);_0x530732[_0x19e1('0x38')]=_['keys'](_0x28d82f[_0x19e1('0x38')]);_0x530732[_0x19e1('0x3a')]=_[_0x19e1('0x3c')](_0x530732[_0x19e1('0x37')],_0x530732[_0x19e1('0x38')]);_0x2a95d4[_0x19e1('0x3b')]=_['intersection'](_0x530732['model'],qs['fields'](_0x28d82f[_0x19e1('0x38')][_0x19e1('0x3d')]));_0x2a95d4['attributes']=_0x2a95d4[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x2a95d4[_0x19e1('0x3b')]:_0x530732['model'];if(!_0x28d82f[_0x19e1('0x38')]['hasOwnProperty']('nolimit')){_0x2a95d4[_0x19e1('0x22')]=qs['limit'](_0x28d82f[_0x19e1('0x38')][_0x19e1('0x22')]);_0x2a95d4[_0x19e1('0x21')]=qs[_0x19e1('0x21')](_0x28d82f['query'][_0x19e1('0x21')]);}_0x2a95d4[_0x19e1('0x3f')]=qs[_0x19e1('0x40')](_0x28d82f[_0x19e1('0x38')][_0x19e1('0x40')]);_0x2a95d4['where']=qs['filters'](_[_0x19e1('0x42')](_0x28d82f[_0x19e1('0x38')],_0x530732[_0x19e1('0x3a')]));_0x2a95d4[_0x19e1('0x41')][_0x19e1('0x5a')]=_0x437309['id'];if(_0x28d82f[_0x19e1('0x38')][_0x19e1('0x43')]){_0x2a95d4['where']=_[_0x19e1('0x44')](_0x2a95d4[_0x19e1('0x41')],{'$or':_[_0x19e1('0x32')](_0x2a95d4[_0x19e1('0x3b')],function(_0x412928){var _0x75670={};_0x75670[_0x412928]={'$like':'%'+_0x28d82f['query']['filter']+'%'};return _0x75670;})});}_0x2a95d4=_[_0x19e1('0x44')]({},_0x2a95d4,_0x28d82f['options']);return db[_0x19e1('0x59')][_0x19e1('0x49')](_0x2a95d4);}})[_0x19e1('0x29')](function(_0xc76b49){if(_0xc76b49){return db[_0x19e1('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0xc76b49,_0x19e1('0x5c')),'role':_0x19e1('0x5d')},'attributes':['id',_0x19e1('0x30'),_0x19e1('0x5e'),_0x19e1('0x5f'),_0x19e1('0x60')]});}})['then'](function(_0x190898){if(_0x190898){return{'count':_0x190898[_0x19e1('0x23')],'rows':_[_0x19e1('0x32')](_0x190898[_0x19e1('0x4a')],function(_0x157034){return{'membername':_0x157034[_0x19e1('0x30')],'UserId':_0x157034['id'],'queue_name':_0x19a815[_0x19e1('0x30')],'WhatsappQueueId':_0x19a815['id'],'interface':util['format'](_0x19e1('0x61'),_0x19e1('0x62'),_0x157034['name']),'penalty':0x0,'paused':_0x157034[_0x19e1('0x5e')],'createdAt':_0x157034[_0x19e1('0x60')],'updatedAt':_0x157034[_0x19e1('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x19e1('0x29')](respondWithFilteredResult(_0x5380b3,_0x2a95d4))['catch'](handleError(_0x5380b3,null));};exports['getTeams']=function(_0x35a4cb,_0xdfaff6,_0x160663){var _0x53d132={};var _0x36d3b9={};var _0x3cbbfe;var _0x295b8a;return db['WhatsappQueue'][_0x19e1('0x58')]({'where':{'id':_0x35a4cb[_0x19e1('0x4d')]['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0xdfaff6,null))[_0x19e1('0x29')](function(_0x2378f2){if(_0x2378f2){_0x3cbbfe=_0x2378f2;_0x36d3b9['model']=_[_0x19e1('0x39')](db['Team'][_0x19e1('0x4e')]);_0x36d3b9[_0x19e1('0x38')]=_[_0x19e1('0x39')](_0x35a4cb[_0x19e1('0x38')]);_0x36d3b9['filters']=_[_0x19e1('0x3c')](_0x36d3b9['model'],_0x36d3b9['query']);_0x53d132[_0x19e1('0x3b')]=_['intersection'](_0x36d3b9['model'],qs[_0x19e1('0x3d')](_0x35a4cb[_0x19e1('0x38')][_0x19e1('0x3d')]));_0x53d132[_0x19e1('0x3b')]=_0x53d132[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x53d132[_0x19e1('0x3b')]:_0x36d3b9[_0x19e1('0x37')];_0x53d132['order']=qs['sort'](_0x35a4cb[_0x19e1('0x38')]['sort']);_0x53d132[_0x19e1('0x41')]=qs[_0x19e1('0x3a')](_[_0x19e1('0x42')](_0x35a4cb['query'],_0x36d3b9['filters']));if(_0x35a4cb[_0x19e1('0x38')][_0x19e1('0x43')]){_0x53d132['where']=_['merge'](_0x53d132['where'],{'$or':_[_0x19e1('0x32')](_0x53d132['attributes'],function(_0xe37032){var _0x32561e={};_0x32561e[_0xe37032]={'$like':'%'+_0x35a4cb[_0x19e1('0x38')][_0x19e1('0x43')]+'%'};return _0x32561e;})});}_0x53d132=_['merge']({},_0x53d132,_0x35a4cb[_0x19e1('0x46')]);return _0x3cbbfe[_0x19e1('0x63')](_0x53d132);}})['then'](function(_0x422506){if(_0x422506){_0x295b8a=_0x422506[_0x19e1('0x3e')];if(!_0x35a4cb[_0x19e1('0x38')][_0x19e1('0x64')](_0x19e1('0x65'))){_0x53d132['limit']=qs[_0x19e1('0x22')](_0x35a4cb[_0x19e1('0x38')]['limit']);_0x53d132[_0x19e1('0x21')]=qs[_0x19e1('0x21')](_0x35a4cb[_0x19e1('0x38')]['offset']);}return _0x3cbbfe[_0x19e1('0x63')](_0x53d132);}})[_0x19e1('0x29')](function(_0x263032){if(_0x263032){return _0x263032?{'count':_0x295b8a,'rows':_0x263032}:null;}})[_0x19e1('0x29')](respondWithResult(_0xdfaff6,null))[_0x19e1('0x4b')](handleError(_0xdfaff6,null));};exports['addTeams']=function(_0x2555b9,_0x21b032,_0x48e3de){var _0x14d884=_0x2555b9[_0x19e1('0x51')][_0x19e1('0x66')];return db['Team']['findAll']({'where':{'id':_0x14d884},'attributes':['id'],'include':[{'model':db[_0x19e1('0x5b')],'as':_0x19e1('0x67'),'attributes':['id','name',_0x19e1('0x68'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x4afadf){if(_0x4afadf){var _0x35ccba=_[_0x19e1('0x69')](_0x4afadf,function(_0x39dd98){var _0x4a9777=_0x39dd98[_0x19e1('0x2b')]({'plain':!![]});return _0x4a9777[_0x19e1('0x67')];});return db[_0x19e1('0x33')][_0x19e1('0x4f')]({'where':{'id':_0x2555b9[_0x19e1('0x4d')]['id']}})['then'](function(_0x52f325){return db[_0x19e1('0x6a')]['transaction'](function(_0x23814b){return _0x52f325[_0x19e1('0x6b')](_0x14d884,{'transaction':_0x23814b})['then'](function(){return BPromise[_0x19e1('0x6c')](_0x35ccba,function(_0x1c6509){return db[_0x19e1('0x59')][_0x19e1('0x6d')]({'where':{'UserId':_0x1c6509['id'],'WhatsappQueueId':_0x2555b9[_0x19e1('0x4d')]['id']},'transaction':_0x23814b});});})['then'](function(){_0x35ccba[_0x19e1('0x6e')](function(_0x3bcd94){socket[_0x19e1('0x6f')]('userWhatsappQueue:save',{'UserId':_0x3bcd94['id'],'WhatsappQueueId':_0x52f325['id']});});});});});}})[_0x19e1('0x29')](respondWithStatusCode(_0x21b032,null))[_0x19e1('0x4b')](handleError(_0x21b032,null));};exports[_0x19e1('0x70')]=function(_0x2f6242,_0x1661e9,_0x13b31f){return db[_0x19e1('0x71')][_0x19e1('0x49')]({'where':{'id':_0x2f6242[_0x19e1('0x38')][_0x19e1('0x66')]},'attributes':['id'],'include':[{'model':db[_0x19e1('0x5b')],'as':_0x19e1('0x67'),'attributes':['id'],'raw':!![]}]})[_0x19e1('0x29')](handleEntityNotFound(_0x1661e9,null))['then'](function(_0x212e8c){var _0x409762=_[_0x19e1('0x32')](_0x212e8c,'id');var _0x39abdd=[];var _0x2bde2f=[];var _0x461878=squel[_0x19e1('0x72')]();_0x461878[_0x19e1('0x73')]('tq.TeamId')['from'](_0x19e1('0x74'),'tq')[_0x19e1('0x75')](_0x19e1('0x76'),'ut',_0x19e1('0x77'))[_0x19e1('0x41')](_0x19e1('0x78'),_0x2f6242[_0x19e1('0x4d')]['id']);for(var _0x4f6cd5=0x0;_0x4f6cd5<_0x212e8c['length'];_0x4f6cd5+=0x1){let _0x4df615=_0x212e8c[_0x4f6cd5];for(var _0x351fd3=0x0;_0x351fd3<_0x4df615[_0x19e1('0x67')][_0x19e1('0x3e')];_0x351fd3+=0x1){let _0x10cdb9=_0x4df615['Agents'][_0x351fd3];var _0x340a35=_0x461878['clone']();_0x340a35[_0x19e1('0x41')](_0x19e1('0x79'),_0x10cdb9['id']);_0x2bde2f[_0x19e1('0x7a')](db[_0x19e1('0x6a')]['query'](_0x340a35[_0x19e1('0x7b')](),{'type':db['sequelize'][_0x19e1('0x7c')][_0x19e1('0x7d')]})[_0x19e1('0x29')](function(_0x31810e){if(_0x31810e[_0x19e1('0x3e')]===0x1){return _0x10cdb9['id'];}else{var _0x423fe7=_[_0x19e1('0x7e')](_['map'](_0x31810e,_0x19e1('0x7f')),function(_0x3ff7a0){return _['includes'](_0x409762,_0x3ff7a0);});if(_0x423fe7){return _0x10cdb9['id'];}}}));}}return BPromise[_0x19e1('0x80')](_0x2bde2f)[_0x19e1('0x29')](function(_0x461573){_0x39abdd=_(_0x39abdd)['union'](_0x461573)['compact']()[_0x19e1('0x81')]();return db['WhatsappQueue'][_0x19e1('0x4f')]({'where':{'id':_0x2f6242[_0x19e1('0x4d')]['id']}})['then'](function(_0x350f23){return db[_0x19e1('0x6a')]['transaction'](function(_0x250641){return _0x350f23[_0x19e1('0x70')](_0x2f6242[_0x19e1('0x38')][_0x19e1('0x66')],{'transaction':_0x250641})['then'](function(){if(!_[_0x19e1('0x82')](_0x39abdd)){return _0x350f23[_0x19e1('0x83')](_0x39abdd,{'transaction':_0x250641});}})[_0x19e1('0x29')](function(){_0x39abdd[_0x19e1('0x6e')](function(_0x5d6577){socket['emit'](_0x19e1('0x84'),{'UserId':_0x5d6577,'WhatsappQueueId':_0x350f23['id']});});});});});});})[_0x19e1('0x29')](respondWithStatusCode(_0x1661e9,null))[_0x19e1('0x4b')](handleError(_0x1661e9,null));};exports['addAgents']=function(_0x24a15b,_0x18a91f,_0x181511){return db[_0x19e1('0x33')]['find']({'where':{'id':_0x24a15b['params']['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x18a91f,null))[_0x19e1('0x29')](function(_0x32293f){if(_0x32293f){return _0x32293f[_0x19e1('0x85')](_0x24a15b['body'][_0x19e1('0x66')],_[_0x19e1('0x86')](_0x24a15b[_0x19e1('0x51')],['ids','id'])||{})[_0x19e1('0x87')](function(_0x424de9){for(var _0x31def7=0x0;_0x31def7<_0x24a15b[_0x19e1('0x51')]['ids'][_0x19e1('0x3e')];_0x31def7+=0x1){socket[_0x19e1('0x6f')](_0x19e1('0x88'),{'UserId':Number(_0x24a15b['body'][_0x19e1('0x66')][_0x31def7]),'WhatsappQueueId':Number(_0x24a15b['params']['id'])});}return _0x424de9;});}})[_0x19e1('0x29')](respondWithResult(_0x18a91f,null))[_0x19e1('0x4b')](handleError(_0x18a91f,null));};exports[_0x19e1('0x83')]=function(_0x244f20,_0x3b029b,_0x210c7a){return db[_0x19e1('0x33')][_0x19e1('0x4f')]({'where':{'id':_0x244f20[_0x19e1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3b029b,null))[_0x19e1('0x29')](function(_0xd5c7f9){if(_0xd5c7f9){return _0xd5c7f9[_0x19e1('0x83')](_0x244f20['query'][_0x19e1('0x66')])[_0x19e1('0x29')](function(){if(_[_0x19e1('0x89')](_0x244f20[_0x19e1('0x38')][_0x19e1('0x66')])){for(var _0x5dbf03=0x0;_0x5dbf03<_0x244f20[_0x19e1('0x38')][_0x19e1('0x66')][_0x19e1('0x3e')];_0x5dbf03+=0x1){socket[_0x19e1('0x6f')](_0x19e1('0x84'),{'UserId':Number(_0x244f20['query'][_0x19e1('0x66')][_0x5dbf03]),'WhatsappQueueId':Number(_0x244f20['params']['id'])});}}else{socket['emit'](_0x19e1('0x84'),{'UserId':Number(_0x244f20[_0x19e1('0x38')][_0x19e1('0x66')]),'WhatsappQueueId':Number(_0x244f20['params']['id'])});}});}})[_0x19e1('0x29')](respondWithStatusCode(_0x3b029b,null))[_0x19e1('0x4b')](handleError(_0x3b029b,null));};exports[_0x19e1('0x8a')]=function(_0x4c74f4,_0x380e63,_0x3a1b2b){var _0x13edb0={};var _0x125e21={};var _0x205ae7;var _0x1b77a2;return db[_0x19e1('0x33')][_0x19e1('0x58')]({'where':{'id':_0x4c74f4[_0x19e1('0x4d')]['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x380e63,null))[_0x19e1('0x29')](function(_0x5b38a6){if(_0x5b38a6){_0x205ae7=_0x5b38a6;_0x125e21[_0x19e1('0x37')]=_['keys'](db[_0x19e1('0x5b')]['rawAttributes']);_0x125e21[_0x19e1('0x38')]=_['keys'](_0x4c74f4['query']);_0x125e21[_0x19e1('0x3a')]=_[_0x19e1('0x3c')](_0x125e21['model'],_0x125e21['query']);_0x13edb0['attributes']=_['intersection'](_0x125e21[_0x19e1('0x37')],qs[_0x19e1('0x3d')](_0x4c74f4[_0x19e1('0x38')]['fields']));_0x13edb0[_0x19e1('0x3b')]=_0x13edb0[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x13edb0[_0x19e1('0x3b')]:_0x125e21[_0x19e1('0x37')];_0x13edb0[_0x19e1('0x3f')]=qs[_0x19e1('0x40')](_0x4c74f4[_0x19e1('0x38')][_0x19e1('0x40')]);_0x13edb0[_0x19e1('0x41')]=qs[_0x19e1('0x3a')](_[_0x19e1('0x42')](_0x4c74f4['query'],_0x125e21[_0x19e1('0x3a')]));if(_0x4c74f4[_0x19e1('0x38')][_0x19e1('0x43')]){_0x13edb0[_0x19e1('0x41')]=_[_0x19e1('0x44')](_0x13edb0[_0x19e1('0x41')],{'$or':_[_0x19e1('0x32')](_0x13edb0[_0x19e1('0x3b')],function(_0x5f4f20){var _0x1c95f5={};_0x1c95f5[_0x5f4f20]={'$like':'%'+_0x4c74f4[_0x19e1('0x38')][_0x19e1('0x43')]+'%'};return _0x1c95f5;})});}_0x13edb0=_[_0x19e1('0x44')]({},_0x13edb0,_0x4c74f4[_0x19e1('0x46')]);return _0x205ae7['getAgents'](_0x13edb0);}})[_0x19e1('0x29')](function(_0xcd67fb){if(_0xcd67fb){_0x1b77a2=_0xcd67fb['length'];if(!_0x4c74f4[_0x19e1('0x38')]['hasOwnProperty'](_0x19e1('0x65'))){_0x13edb0[_0x19e1('0x22')]=qs[_0x19e1('0x22')](_0x4c74f4['query'][_0x19e1('0x22')]);_0x13edb0[_0x19e1('0x21')]=qs[_0x19e1('0x21')](_0x4c74f4[_0x19e1('0x38')]['offset']);}return _0x205ae7[_0x19e1('0x8a')](_0x13edb0);}})['then'](function(_0x4a7695){if(_0x4a7695){return _0x4a7695?{'count':_0x1b77a2,'rows':_0x4a7695}:null;}})[_0x19e1('0x29')](respondWithResult(_0x380e63,null))['catch'](handleError(_0x380e63,null));}; \ No newline at end of file +var _0xb505=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','error','name','send','index','map','WhatsappQueue','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserWhatsappQueue','hasOwnProperty','nolimit','WhatsappQueueId','options','findAll','User','UserId','agent','updatedAt','format','%s/%s','whatsappPause','createdAt','getTeams','rawAttributes','addTeams','online','voicePause','interface','flatMap','Agents','sequelize','findOrCreate','forEach','userWhatsappQueue:save','Team','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','transaction','removeTeams','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js'];(function(_0xed1ced,_0x8e5b90){var _0x32e089=function(_0x18d3bb){while(--_0x18d3bb){_0xed1ced['push'](_0xed1ced['shift']());}};_0x32e089(++_0x8e5b90);}(_0xb505,0x110));var _0x5b50=function(_0x4f8b6b,_0x27f4f2){_0x4f8b6b=_0x4f8b6b-0x0;var _0x5983b7=_0xb505[_0x4f8b6b];return _0x5983b7;};'use strict';var emlformat=require(_0x5b50('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b50('0x1'));var rp=require('request-promise');var moment=require(_0x5b50('0x2'));var BPromise=require(_0x5b50('0x3'));var Mustache=require(_0x5b50('0x4'));var util=require('util');var path=require(_0x5b50('0x5'));var sox=require(_0x5b50('0x6'));var csv=require(_0x5b50('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b50('0x8'));var squel=require(_0x5b50('0x9'));var crypto=require('crypto');var jsforce=require(_0x5b50('0xa'));var deskjs=require(_0x5b50('0xb'));var toCsv=require(_0x5b50('0x7'));var querystring=require('querystring');var Papa=require(_0x5b50('0xc'));var Redis=require(_0x5b50('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5b50('0xe'));var as=require(_0x5b50('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b50('0x10'))(_0x5b50('0x11'));var utils=require(_0x5b50('0x12'));var config=require(_0x5b50('0x13'));var licenseUtil=require(_0x5b50('0x14'));var db=require(_0x5b50('0x15'))['db'];config[_0x5b50('0x16')]=_[_0x5b50('0x17')](config[_0x5b50('0x16')],{'host':_0x5b50('0x18'),'port':0x18eb});var socket=require(_0x5b50('0x19'))(new Redis(config[_0x5b50('0x16')]));require(_0x5b50('0x1a'))['register'](socket);function respondWithStatusCode(_0x35ce6f,_0xeac293){_0xeac293=_0xeac293||0xcc;return function(_0x2ea06c){if(_0x2ea06c){return _0x35ce6f[_0x5b50('0x1b')](_0xeac293);}return _0x35ce6f[_0x5b50('0x1c')](_0xeac293)[_0x5b50('0x1d')]();};}function respondWithResult(_0x562fbf,_0xcd91f2){_0xcd91f2=_0xcd91f2||0xc8;return function(_0x182705){if(_0x182705){return _0x562fbf['status'](_0xcd91f2)[_0x5b50('0x1e')](_0x182705);}};}function respondWithFilteredResult(_0x1ab55d,_0x3d5b37){return function(_0xd2d948){if(_0xd2d948){var _0xb2213a=typeof _0x3d5b37[_0x5b50('0x1f')]==='undefined'&&typeof _0x3d5b37['limit']==='undefined';var _0x18f4e4=_0xd2d948[_0x5b50('0x20')];var _0x484a81=_0xb2213a?0x0:_0x3d5b37[_0x5b50('0x1f')];var _0x30caee=_0xb2213a?_0xd2d948[_0x5b50('0x20')]:_0x3d5b37[_0x5b50('0x1f')]+_0x3d5b37['limit'];var _0x5e1208;if(_0x30caee>=_0x18f4e4){_0x30caee=_0x18f4e4;_0x5e1208=0xc8;}else{_0x5e1208=0xce;}_0x1ab55d[_0x5b50('0x1c')](_0x5e1208);return _0x1ab55d[_0x5b50('0x21')](_0x5b50('0x22'),_0x484a81+'-'+_0x30caee+'/'+_0x18f4e4)[_0x5b50('0x1e')](_0xd2d948);}return null;};}function patchUpdates(_0x19659f){return function(_0x5c5f2d){try{jsonpatch[_0x5b50('0x23')](_0x5c5f2d,_0x19659f,!![]);}catch(_0x2ced4a){return BPromise[_0x5b50('0x24')](_0x2ced4a);}return _0x5c5f2d[_0x5b50('0x25')]();};}function saveUpdates(_0x5e5147,_0x19dd78){return function(_0x2cbdbf){if(_0x2cbdbf){return _0x2cbdbf[_0x5b50('0x26')](_0x5e5147)[_0x5b50('0x27')](function(_0x328b0d){return _0x328b0d;});}return null;};}function removeEntity(_0x59e855,_0x523455){return function(_0x4c15e1){if(_0x4c15e1){return _0x4c15e1[_0x5b50('0x28')]()[_0x5b50('0x27')](function(){var _0x115ec6=_0x4c15e1[_0x5b50('0x29')]({'plain':!![]});var _0x13138c=_0x5b50('0x2a');return db['UserProfileResource'][_0x5b50('0x28')]({'where':{'type':_0x13138c,'resourceId':_0x115ec6['id']}})[_0x5b50('0x27')](function(){return _0x4c15e1;});})[_0x5b50('0x27')](function(){_0x59e855[_0x5b50('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e47cd,_0x576e66){return function(_0x35a43e){if(!_0x35a43e){_0x3e47cd[_0x5b50('0x1b')](0x194);}return _0x35a43e;};}function handleError(_0x1db1cc,_0x17a50b){_0x17a50b=_0x17a50b||0x1f4;return function(_0x1b2fec){logger[_0x5b50('0x2b')](_0x1b2fec['stack']);if(_0x1b2fec[_0x5b50('0x2c')]){delete _0x1b2fec[_0x5b50('0x2c')];}_0x1db1cc[_0x5b50('0x1c')](_0x17a50b)[_0x5b50('0x2d')](_0x1b2fec);};}exports[_0x5b50('0x2e')]=function(_0x40d34a,_0x43f12f){var _0x112b35={},_0x295510={},_0x5aa3f2={'count':0x0,'rows':[]};var _0x3ab90c=_[_0x5b50('0x2f')](db[_0x5b50('0x30')]['rawAttributes'],function(_0x3d3785){return{'name':_0x3d3785[_0x5b50('0x31')],'type':_0x3d3785[_0x5b50('0x32')]['key']};});_0x295510[_0x5b50('0x33')]=_[_0x5b50('0x2f')](_0x3ab90c,_0x5b50('0x2c'));_0x295510[_0x5b50('0x34')]=_[_0x5b50('0x35')](_0x40d34a[_0x5b50('0x34')]);_0x295510[_0x5b50('0x36')]=_[_0x5b50('0x37')](_0x295510[_0x5b50('0x33')],_0x295510[_0x5b50('0x34')]);_0x112b35['attributes']=_[_0x5b50('0x37')](_0x295510[_0x5b50('0x33')],qs[_0x5b50('0x38')](_0x40d34a[_0x5b50('0x34')][_0x5b50('0x38')]));_0x112b35[_0x5b50('0x39')]=_0x112b35[_0x5b50('0x39')][_0x5b50('0x3a')]?_0x112b35[_0x5b50('0x39')]:_0x295510['model'];if(!_0x40d34a[_0x5b50('0x34')]['hasOwnProperty']('nolimit')){_0x112b35[_0x5b50('0x3b')]=qs[_0x5b50('0x3b')](_0x40d34a[_0x5b50('0x34')]['limit']);_0x112b35[_0x5b50('0x1f')]=qs[_0x5b50('0x1f')](_0x40d34a[_0x5b50('0x34')][_0x5b50('0x1f')]);}_0x112b35[_0x5b50('0x3c')]=qs[_0x5b50('0x3d')](_0x40d34a[_0x5b50('0x34')][_0x5b50('0x3d')]);_0x112b35[_0x5b50('0x3e')]=qs[_0x5b50('0x36')](_[_0x5b50('0x3f')](_0x40d34a['query'],_0x295510[_0x5b50('0x36')]),_0x3ab90c);if(_0x40d34a[_0x5b50('0x34')]['filter']){_0x112b35[_0x5b50('0x3e')]=_[_0x5b50('0x40')](_0x112b35[_0x5b50('0x3e')],{'$or':_['map'](_0x3ab90c,function(_0x87ee6){if(_0x87ee6[_0x5b50('0x32')]!==_0x5b50('0x41')){var _0x531572={};_0x531572[_0x87ee6[_0x5b50('0x2c')]]={'$like':'%'+_0x40d34a['query'][_0x5b50('0x42')]+'%'};return _0x531572;}})});}_0x112b35=_['merge']({},_0x112b35,_0x40d34a['options']);var _0x1afa18={'where':_0x112b35['where']};return db[_0x5b50('0x30')]['count'](_0x1afa18)[_0x5b50('0x27')](function(_0x114b5d){_0x5aa3f2[_0x5b50('0x20')]=_0x114b5d;if(_0x40d34a[_0x5b50('0x34')][_0x5b50('0x43')]){_0x112b35[_0x5b50('0x44')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x112b35);})['then'](function(_0x1a5cbb){_0x5aa3f2[_0x5b50('0x45')]=_0x1a5cbb;return _0x5aa3f2;})['then'](respondWithFilteredResult(_0x43f12f,_0x112b35))[_0x5b50('0x46')](handleError(_0x43f12f,null));};exports[_0x5b50('0x47')]=function(_0x120e24,_0x5916d9){var _0x4b902a={'raw':!![],'where':{'id':_0x120e24[_0x5b50('0x48')]['id']}},_0x3364e2={};_0x3364e2[_0x5b50('0x33')]=_[_0x5b50('0x35')](db[_0x5b50('0x30')]['rawAttributes']);_0x3364e2[_0x5b50('0x34')]=_[_0x5b50('0x35')](_0x120e24[_0x5b50('0x34')]);_0x3364e2[_0x5b50('0x36')]=_[_0x5b50('0x37')](_0x3364e2['model'],_0x3364e2[_0x5b50('0x34')]);_0x4b902a[_0x5b50('0x39')]=_[_0x5b50('0x37')](_0x3364e2[_0x5b50('0x33')],qs[_0x5b50('0x38')](_0x120e24[_0x5b50('0x34')][_0x5b50('0x38')]));_0x4b902a[_0x5b50('0x39')]=_0x4b902a[_0x5b50('0x39')]['length']?_0x4b902a[_0x5b50('0x39')]:_0x3364e2[_0x5b50('0x33')];if(_0x120e24[_0x5b50('0x34')]['includeAll']){_0x4b902a['include']=[{'all':!![]}];}_0x4b902a=_[_0x5b50('0x40')]({},_0x4b902a,_0x120e24['options']);return db[_0x5b50('0x30')][_0x5b50('0x49')](_0x4b902a)[_0x5b50('0x27')](handleEntityNotFound(_0x5916d9,null))[_0x5b50('0x27')](respondWithResult(_0x5916d9,null))[_0x5b50('0x46')](handleError(_0x5916d9,null));};exports['create']=function(_0x2a4126,_0x3d251d){return db[_0x5b50('0x30')]['create'](_0x2a4126[_0x5b50('0x4a')],{})[_0x5b50('0x27')](function(_0x18301e){var _0x59e9da=_0x2a4126[_0x5b50('0x4b')][_0x5b50('0x29')]({'plain':!![]});if(!_0x59e9da)throw new Error(_0x5b50('0x4c'));if(_0x59e9da[_0x5b50('0x4d')]==='user'){var _0x419aac=_0x18301e[_0x5b50('0x29')]({'plain':!![]});var _0x19412a=_0x5b50('0x2a');return db[_0x5b50('0x4e')]['find']({'where':{'name':_0x19412a,'userProfileId':_0x59e9da[_0x5b50('0x4f')]},'raw':!![]})[_0x5b50('0x27')](function(_0x36a50f){if(_0x36a50f&&_0x36a50f[_0x5b50('0x50')]===0x0){return db[_0x5b50('0x51')][_0x5b50('0x52')]({'name':_0x419aac[_0x5b50('0x2c')],'resourceId':_0x419aac['id'],'type':_0x36a50f[_0x5b50('0x2c')],'sectionId':_0x36a50f['id']},{})[_0x5b50('0x27')](function(){return _0x18301e;});}else{return _0x18301e;}})[_0x5b50('0x46')](function(_0x11217a){logger[_0x5b50('0x2b')](_0x5b50('0x53'),_0x11217a);throw _0x11217a;});}return _0x18301e;})[_0x5b50('0x27')](respondWithResult(_0x3d251d,0xc9))[_0x5b50('0x46')](handleError(_0x3d251d,null));};exports[_0x5b50('0x26')]=function(_0x296a80,_0x45873b){if(_0x296a80[_0x5b50('0x4a')]['id']){delete _0x296a80[_0x5b50('0x4a')]['id'];}return db[_0x5b50('0x30')][_0x5b50('0x49')]({'where':{'id':_0x296a80[_0x5b50('0x48')]['id']}})[_0x5b50('0x27')](handleEntityNotFound(_0x45873b,null))[_0x5b50('0x27')](saveUpdates(_0x296a80['body'],null))[_0x5b50('0x27')](respondWithResult(_0x45873b,null))[_0x5b50('0x46')](handleError(_0x45873b,null));};exports[_0x5b50('0x28')]=function(_0x3a0df3,_0x971c44){return db[_0x5b50('0x30')][_0x5b50('0x49')]({'where':{'id':_0x3a0df3[_0x5b50('0x48')]['id']}})[_0x5b50('0x27')](handleEntityNotFound(_0x971c44,null))[_0x5b50('0x27')](removeEntity(_0x971c44,null))[_0x5b50('0x46')](handleError(_0x971c44,null));};exports[_0x5b50('0x54')]=function(_0x5d37a8,_0xd26a0e){return db[_0x5b50('0x30')]['describe']()['then'](respondWithResult(_0xd26a0e,null))['catch'](handleError(_0xd26a0e,null));};exports['getMembers']=function(_0x55e40e,_0x9d2083,_0x5b2139){var _0x317b56={'raw':!![],'where':{}},_0x39e5d9={},_0x58d19c;return db[_0x5b50('0x30')]['findOne']({'where':{'id':_0x55e40e['params']['id']}})[_0x5b50('0x27')](handleEntityNotFound(_0x9d2083,null))[_0x5b50('0x27')](function(_0x3ba564){if(_0x3ba564){_0x58d19c=_0x3ba564[_0x5b50('0x29')]({'plain':!![]});_0x39e5d9[_0x5b50('0x33')]=_['keys'](db[_0x5b50('0x55')]['rawAttributes']);_0x39e5d9[_0x5b50('0x34')]=_['keys'](_0x55e40e[_0x5b50('0x34')]);_0x39e5d9[_0x5b50('0x36')]=_[_0x5b50('0x37')](_0x39e5d9['model'],_0x39e5d9[_0x5b50('0x34')]);_0x317b56[_0x5b50('0x39')]=_[_0x5b50('0x37')](_0x39e5d9[_0x5b50('0x33')],qs['fields'](_0x55e40e[_0x5b50('0x34')][_0x5b50('0x38')]));_0x317b56['attributes']=_0x317b56['attributes'][_0x5b50('0x3a')]?_0x317b56[_0x5b50('0x39')]:_0x39e5d9['model'];if(!_0x55e40e[_0x5b50('0x34')][_0x5b50('0x56')](_0x5b50('0x57'))){_0x317b56['limit']=qs[_0x5b50('0x3b')](_0x55e40e[_0x5b50('0x34')]['limit']);_0x317b56['offset']=qs[_0x5b50('0x1f')](_0x55e40e['query']['offset']);}_0x317b56[_0x5b50('0x3c')]=qs['sort'](_0x55e40e[_0x5b50('0x34')][_0x5b50('0x3d')]);_0x317b56[_0x5b50('0x3e')]=qs['filters'](_[_0x5b50('0x3f')](_0x55e40e[_0x5b50('0x34')],_0x39e5d9[_0x5b50('0x36')]));_0x317b56[_0x5b50('0x3e')][_0x5b50('0x58')]=_0x3ba564['id'];if(_0x55e40e[_0x5b50('0x34')]['filter']){_0x317b56['where']=_[_0x5b50('0x40')](_0x317b56[_0x5b50('0x3e')],{'$or':_[_0x5b50('0x2f')](_0x317b56[_0x5b50('0x39')],function(_0x2234a5){var _0x4a2077={};_0x4a2077[_0x2234a5]={'$like':'%'+_0x55e40e[_0x5b50('0x34')][_0x5b50('0x42')]+'%'};return _0x4a2077;})});}_0x317b56=_[_0x5b50('0x40')]({},_0x317b56,_0x55e40e[_0x5b50('0x59')]);return db[_0x5b50('0x55')][_0x5b50('0x5a')](_0x317b56);}})[_0x5b50('0x27')](function(_0x227fdd){if(_0x227fdd){return db[_0x5b50('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0x227fdd,_0x5b50('0x5c')),'role':_0x5b50('0x5d')},'attributes':['id',_0x5b50('0x2c'),'whatsappPause',_0x5b50('0x5e'),'createdAt']});}})[_0x5b50('0x27')](function(_0xa14322){if(_0xa14322){return{'count':_0xa14322['count'],'rows':_[_0x5b50('0x2f')](_0xa14322['rows'],function(_0x3a94d1){return{'membername':_0x3a94d1[_0x5b50('0x2c')],'UserId':_0x3a94d1['id'],'queue_name':_0x58d19c[_0x5b50('0x2c')],'WhatsappQueueId':_0x58d19c['id'],'interface':util[_0x5b50('0x5f')](_0x5b50('0x60'),'SIP',_0x3a94d1[_0x5b50('0x2c')]),'penalty':0x0,'paused':_0x3a94d1[_0x5b50('0x61')],'createdAt':_0x3a94d1[_0x5b50('0x62')],'updatedAt':_0x3a94d1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b50('0x27')](respondWithFilteredResult(_0x9d2083,_0x317b56))[_0x5b50('0x46')](handleError(_0x9d2083,null));};exports[_0x5b50('0x63')]=function(_0x4e4a17,_0x75186f,_0x56286e){var _0x22bcc9={};var _0x375258={};var _0xff2dcf;var _0xd10c3a;return db[_0x5b50('0x30')]['findOne']({'where':{'id':_0x4e4a17['params']['id']}})[_0x5b50('0x27')](handleEntityNotFound(_0x75186f,null))[_0x5b50('0x27')](function(_0x47c17c){if(_0x47c17c){_0xff2dcf=_0x47c17c;_0x375258['model']=_['keys'](db['Team'][_0x5b50('0x64')]);_0x375258[_0x5b50('0x34')]=_[_0x5b50('0x35')](_0x4e4a17[_0x5b50('0x34')]);_0x375258[_0x5b50('0x36')]=_[_0x5b50('0x37')](_0x375258['model'],_0x375258['query']);_0x22bcc9[_0x5b50('0x39')]=_['intersection'](_0x375258[_0x5b50('0x33')],qs[_0x5b50('0x38')](_0x4e4a17[_0x5b50('0x34')][_0x5b50('0x38')]));_0x22bcc9[_0x5b50('0x39')]=_0x22bcc9[_0x5b50('0x39')][_0x5b50('0x3a')]?_0x22bcc9[_0x5b50('0x39')]:_0x375258['model'];_0x22bcc9[_0x5b50('0x3c')]=qs[_0x5b50('0x3d')](_0x4e4a17[_0x5b50('0x34')][_0x5b50('0x3d')]);_0x22bcc9[_0x5b50('0x3e')]=qs[_0x5b50('0x36')](_[_0x5b50('0x3f')](_0x4e4a17[_0x5b50('0x34')],_0x375258[_0x5b50('0x36')]));if(_0x4e4a17['query'][_0x5b50('0x42')]){_0x22bcc9['where']=_['merge'](_0x22bcc9[_0x5b50('0x3e')],{'$or':_[_0x5b50('0x2f')](_0x22bcc9[_0x5b50('0x39')],function(_0x27f728){var _0x79935a={};_0x79935a[_0x27f728]={'$like':'%'+_0x4e4a17[_0x5b50('0x34')][_0x5b50('0x42')]+'%'};return _0x79935a;})});}_0x22bcc9=_[_0x5b50('0x40')]({},_0x22bcc9,_0x4e4a17[_0x5b50('0x59')]);return _0xff2dcf[_0x5b50('0x63')](_0x22bcc9);}})[_0x5b50('0x27')](function(_0x2c5114){if(_0x2c5114){_0xd10c3a=_0x2c5114['length'];if(!_0x4e4a17[_0x5b50('0x34')]['hasOwnProperty']('nolimit')){_0x22bcc9[_0x5b50('0x3b')]=qs[_0x5b50('0x3b')](_0x4e4a17[_0x5b50('0x34')][_0x5b50('0x3b')]);_0x22bcc9[_0x5b50('0x1f')]=qs['offset'](_0x4e4a17['query']['offset']);}return _0xff2dcf[_0x5b50('0x63')](_0x22bcc9);}})['then'](function(_0x3c93d8){if(_0x3c93d8){return _0x3c93d8?{'count':_0xd10c3a,'rows':_0x3c93d8}:null;}})['then'](respondWithResult(_0x75186f,null))[_0x5b50('0x46')](handleError(_0x75186f,null));};exports[_0x5b50('0x65')]=function(_0x56f7be,_0x9536f,_0x19b915){var _0x5d1e69=_0x56f7be['body']['ids'];return db['Team'][_0x5b50('0x5a')]({'where':{'id':_0x5d1e69},'attributes':['id'],'include':[{'model':db[_0x5b50('0x5b')],'as':'Agents','attributes':['id',_0x5b50('0x2c'),_0x5b50('0x66'),_0x5b50('0x67'),_0x5b50('0x68')],'raw':!![]}]})['then'](function(_0x5c6bde){if(_0x5c6bde){var _0x28a254=_[_0x5b50('0x69')](_0x5c6bde,function(_0x367897){var _0x2467e3=_0x367897[_0x5b50('0x29')]({'plain':!![]});return _0x2467e3[_0x5b50('0x6a')];});return db['WhatsappQueue']['find']({'where':{'id':_0x56f7be[_0x5b50('0x48')]['id']}})['then'](function(_0x4242a0){return db[_0x5b50('0x6b')]['transaction'](function(_0x401850){return _0x4242a0[_0x5b50('0x65')](_0x5d1e69,{'transaction':_0x401850})[_0x5b50('0x27')](function(){return BPromise['each'](_0x28a254,function(_0x2c7a6e){return db['UserWhatsappQueue'][_0x5b50('0x6c')]({'where':{'UserId':_0x2c7a6e['id'],'WhatsappQueueId':_0x56f7be[_0x5b50('0x48')]['id']},'transaction':_0x401850});});})[_0x5b50('0x27')](function(){_0x28a254[_0x5b50('0x6d')](function(_0x450d60){socket['emit'](_0x5b50('0x6e'),{'UserId':_0x450d60['id'],'WhatsappQueueId':_0x4242a0['id']});});});});});}})[_0x5b50('0x27')](respondWithStatusCode(_0x9536f,null))[_0x5b50('0x46')](handleError(_0x9536f,null));};exports['removeTeams']=function(_0x8bd442,_0x2f5f75,_0x4ff80d){return db[_0x5b50('0x6f')][_0x5b50('0x5a')]({'where':{'id':_0x8bd442[_0x5b50('0x34')][_0x5b50('0x70')]},'attributes':['id'],'include':[{'model':db[_0x5b50('0x5b')],'as':_0x5b50('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x5b50('0x27')](handleEntityNotFound(_0x2f5f75,null))[_0x5b50('0x27')](function(_0x311570){var _0x396068=_[_0x5b50('0x2f')](_0x311570,'id');var _0x22ab5f=[];var _0x46a5a9=[];var _0x405ee0=squel[_0x5b50('0x71')]();_0x405ee0[_0x5b50('0x72')](_0x5b50('0x73'))[_0x5b50('0x74')](_0x5b50('0x75'),'tq')[_0x5b50('0x76')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5b50('0x3e')](_0x5b50('0x77'),_0x8bd442['params']['id']);for(var _0x338e41=0x0;_0x338e41<_0x311570[_0x5b50('0x3a')];_0x338e41+=0x1){let _0x5600c5=_0x311570[_0x338e41];for(var _0x92145b=0x0;_0x92145b<_0x5600c5[_0x5b50('0x6a')][_0x5b50('0x3a')];_0x92145b+=0x1){let _0x50e9e0=_0x5600c5['Agents'][_0x92145b];var _0x3fe68e=_0x405ee0['clone']();_0x3fe68e['where'](_0x5b50('0x78'),_0x50e9e0['id']);_0x46a5a9[_0x5b50('0x79')](db['sequelize']['query'](_0x3fe68e[_0x5b50('0x7a')](),{'type':db[_0x5b50('0x6b')]['QueryTypes'][_0x5b50('0x7b')]})[_0x5b50('0x27')](function(_0x508fd2){if(_0x508fd2[_0x5b50('0x3a')]===0x1){return _0x50e9e0['id'];}else{var _0x289c16=_[_0x5b50('0x7c')](_[_0x5b50('0x2f')](_0x508fd2,_0x5b50('0x7d')),function(_0xc43b0d){return _[_0x5b50('0x7e')](_0x396068,_0xc43b0d);});if(_0x289c16){return _0x50e9e0['id'];}}}));}}return BPromise[_0x5b50('0x7f')](_0x46a5a9)[_0x5b50('0x27')](function(_0x16f56a){_0x22ab5f=_(_0x22ab5f)['union'](_0x16f56a)[_0x5b50('0x80')]()[_0x5b50('0x81')]();return db['WhatsappQueue']['find']({'where':{'id':_0x8bd442[_0x5b50('0x48')]['id']}})[_0x5b50('0x27')](function(_0x2deccb){return db[_0x5b50('0x6b')][_0x5b50('0x82')](function(_0x4d68d2){return _0x2deccb[_0x5b50('0x83')](_0x8bd442['query']['ids'],{'transaction':_0x4d68d2})['then'](function(){if(!_[_0x5b50('0x84')](_0x22ab5f)){return _0x2deccb[_0x5b50('0x85')](_0x22ab5f,{'transaction':_0x4d68d2});}})[_0x5b50('0x27')](function(){_0x22ab5f[_0x5b50('0x6d')](function(_0x5e1f24){socket[_0x5b50('0x86')](_0x5b50('0x87'),{'UserId':_0x5e1f24,'WhatsappQueueId':_0x2deccb['id']});});});});});});})['then'](respondWithStatusCode(_0x2f5f75,null))[_0x5b50('0x46')](handleError(_0x2f5f75,null));};exports[_0x5b50('0x88')]=function(_0x4e8874,_0xe5fed6,_0x3a3225){return db[_0x5b50('0x30')]['find']({'where':{'id':_0x4e8874[_0x5b50('0x48')]['id']}})[_0x5b50('0x27')](handleEntityNotFound(_0xe5fed6,null))[_0x5b50('0x27')](function(_0x130659){if(_0x130659){return _0x130659[_0x5b50('0x88')](_0x4e8874['body'][_0x5b50('0x70')],_[_0x5b50('0x89')](_0x4e8874[_0x5b50('0x4a')],['ids','id'])||{})[_0x5b50('0x8a')](function(_0x232411){for(var _0x34cf79=0x0;_0x34cf79<_0x4e8874[_0x5b50('0x4a')][_0x5b50('0x70')][_0x5b50('0x3a')];_0x34cf79+=0x1){socket[_0x5b50('0x86')](_0x5b50('0x6e'),{'UserId':Number(_0x4e8874[_0x5b50('0x4a')][_0x5b50('0x70')][_0x34cf79]),'WhatsappQueueId':Number(_0x4e8874[_0x5b50('0x48')]['id'])});}return _0x232411;});}})['then'](respondWithResult(_0xe5fed6,null))['catch'](handleError(_0xe5fed6,null));};exports[_0x5b50('0x85')]=function(_0x50700d,_0xf9cc0e,_0x406f0d){return db['WhatsappQueue'][_0x5b50('0x49')]({'where':{'id':_0x50700d[_0x5b50('0x48')]['id']}})['then'](handleEntityNotFound(_0xf9cc0e,null))[_0x5b50('0x27')](function(_0x5594cb){if(_0x5594cb){return _0x5594cb[_0x5b50('0x85')](_0x50700d[_0x5b50('0x34')][_0x5b50('0x70')])['then'](function(){if(_[_0x5b50('0x8b')](_0x50700d[_0x5b50('0x34')][_0x5b50('0x70')])){for(var _0x39615a=0x0;_0x39615a<_0x50700d[_0x5b50('0x34')][_0x5b50('0x70')][_0x5b50('0x3a')];_0x39615a+=0x1){socket[_0x5b50('0x86')](_0x5b50('0x87'),{'UserId':Number(_0x50700d['query']['ids'][_0x39615a]),'WhatsappQueueId':Number(_0x50700d[_0x5b50('0x48')]['id'])});}}else{socket[_0x5b50('0x86')](_0x5b50('0x87'),{'UserId':Number(_0x50700d['query']['ids']),'WhatsappQueueId':Number(_0x50700d[_0x5b50('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0xf9cc0e,null))['catch'](handleError(_0xf9cc0e,null));};exports[_0x5b50('0x8c')]=function(_0x162c36,_0x543020,_0x497a3d){var _0x58150e={};var _0x3c7761={};var _0xe80bbe;var _0x465785;return db['WhatsappQueue'][_0x5b50('0x8d')]({'where':{'id':_0x162c36[_0x5b50('0x48')]['id']}})[_0x5b50('0x27')](handleEntityNotFound(_0x543020,null))[_0x5b50('0x27')](function(_0x31cad3){if(_0x31cad3){_0xe80bbe=_0x31cad3;_0x3c7761['model']=_[_0x5b50('0x35')](db[_0x5b50('0x5b')][_0x5b50('0x64')]);_0x3c7761[_0x5b50('0x34')]=_[_0x5b50('0x35')](_0x162c36[_0x5b50('0x34')]);_0x3c7761[_0x5b50('0x36')]=_['intersection'](_0x3c7761[_0x5b50('0x33')],_0x3c7761[_0x5b50('0x34')]);_0x58150e[_0x5b50('0x39')]=_[_0x5b50('0x37')](_0x3c7761['model'],qs[_0x5b50('0x38')](_0x162c36[_0x5b50('0x34')][_0x5b50('0x38')]));_0x58150e[_0x5b50('0x39')]=_0x58150e[_0x5b50('0x39')][_0x5b50('0x3a')]?_0x58150e[_0x5b50('0x39')]:_0x3c7761[_0x5b50('0x33')];_0x58150e[_0x5b50('0x3c')]=qs[_0x5b50('0x3d')](_0x162c36['query'][_0x5b50('0x3d')]);_0x58150e[_0x5b50('0x3e')]=qs[_0x5b50('0x36')](_[_0x5b50('0x3f')](_0x162c36[_0x5b50('0x34')],_0x3c7761[_0x5b50('0x36')]));if(_0x162c36[_0x5b50('0x34')]['filter']){_0x58150e[_0x5b50('0x3e')]=_[_0x5b50('0x40')](_0x58150e['where'],{'$or':_[_0x5b50('0x2f')](_0x58150e[_0x5b50('0x39')],function(_0x3d909f){var _0x7ee5ac={};_0x7ee5ac[_0x3d909f]={'$like':'%'+_0x162c36['query']['filter']+'%'};return _0x7ee5ac;})});}_0x58150e=_[_0x5b50('0x40')]({},_0x58150e,_0x162c36[_0x5b50('0x59')]);return _0xe80bbe[_0x5b50('0x8c')](_0x58150e);}})[_0x5b50('0x27')](function(_0x258eb5){if(_0x258eb5){_0x465785=_0x258eb5[_0x5b50('0x3a')];if(!_0x162c36[_0x5b50('0x34')]['hasOwnProperty'](_0x5b50('0x57'))){_0x58150e[_0x5b50('0x3b')]=qs[_0x5b50('0x3b')](_0x162c36[_0x5b50('0x34')]['limit']);_0x58150e[_0x5b50('0x1f')]=qs[_0x5b50('0x1f')](_0x162c36[_0x5b50('0x34')][_0x5b50('0x1f')]);}return _0xe80bbe[_0x5b50('0x8c')](_0x58150e);}})[_0x5b50('0x27')](function(_0x59c316){if(_0x59c316){return _0x59c316?{'count':_0x465785,'rows':_0x59c316}:null;}})[_0x5b50('0x27')](respondWithResult(_0x543020,null))['catch'](handleError(_0x543020,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6103ce8..a1a4c6a 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 _0x42d1=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0x42d1,0x178));var _0x142d=function(_0x863e3,_0x45bb06){_0x863e3=_0x863e3-0x0;var _0x52faeb=_0x42d1[_0x863e3];return _0x52faeb;};'use strict';var EventEmitter=require(_0x142d('0x0'));var WhatsappQueue=require(_0x142d('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x142d('0x2')](0x0);var events={'afterCreate':_0x142d('0x3'),'afterUpdate':_0x142d('0x4'),'afterDestroy':_0x142d('0x5')};function emitEvent(_0x20e47c){return function(_0x1086d6,_0x348299,_0x1aba2b){WhatsappQueueEvents[_0x142d('0x6')](_0x20e47c+':'+_0x1086d6['id'],_0x1086d6);WhatsappQueueEvents[_0x142d('0x6')](_0x20e47c,_0x1086d6);_0x1aba2b(null);};}for(var e in events){if(events[_0x142d('0x7')](e)){var event=events[e];WhatsappQueue[_0x142d('0x8')](e,emitEvent(event));}}module[_0x142d('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x7ee4=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x11ff6a,_0x59c826){var _0x23989a=function(_0x4843cf){while(--_0x4843cf){_0x11ff6a['push'](_0x11ff6a['shift']());}};_0x23989a(++_0x59c826);}(_0x7ee4,0x1c7));var _0x47ee=function(_0x314ccb,_0x38886e){_0x314ccb=_0x314ccb-0x0;var _0x257b48=_0x7ee4[_0x314ccb];return _0x257b48;};'use strict';var EventEmitter=require(_0x47ee('0x0'));var WhatsappQueue=require(_0x47ee('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x47ee('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47ee('0x3'),'afterDestroy':_0x47ee('0x4')};function emitEvent(_0xabbaf4){return function(_0x190850,_0x2c6d6c,_0x15f7be){WhatsappQueueEvents[_0x47ee('0x5')](_0xabbaf4+':'+_0x190850['id'],_0x190850);WhatsappQueueEvents['emit'](_0xabbaf4,_0x190850);_0x15f7be(null);};}for(var e in events){if(events[_0x47ee('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x47ee('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index d5b3af7..040b2ad 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 _0xd3c2=['rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xd3c2,0x1e6));var _0x2d3c=function(_0x498dbc,_0x10b18a){_0x498dbc=_0x498dbc-0x0;var _0x176755=_0xd3c2[_0x498dbc];return _0x176755;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d3c('0x0'))(_0x2d3c('0x1'));var moment=require(_0x2d3c('0x2'));var BPromise=require(_0x2d3c('0x3'));var rp=require(_0x2d3c('0x4'));var fs=require('fs');var path=require(_0x2d3c('0x5'));var rimraf=require(_0x2d3c('0x6'));var config=require(_0x2d3c('0x7'));var attributes=require(_0x2d3c('0x8'));module['exports']=function(_0x5616d7,_0x1a3d41){return _0x5616d7[_0x2d3c('0x9')](_0x2d3c('0xa'),attributes,{'tableName':_0x2d3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db6=['../../config/environment','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x49518a,_0x219d60){var _0x250c06=function(_0x39e0c4){while(--_0x39e0c4){_0x49518a['push'](_0x49518a['shift']());}};_0x250c06(++_0x219d60);}(_0x1db6,0x18f));var _0x61db=function(_0x1d5310,_0x145a3b){_0x1d5310=_0x1d5310-0x0;var _0x567deb=_0x1db6[_0x1d5310];return _0x567deb;};'use strict';var _=require(_0x61db('0x0'));var util=require(_0x61db('0x1'));var logger=require(_0x61db('0x2'))(_0x61db('0x3'));var moment=require(_0x61db('0x4'));var BPromise=require(_0x61db('0x5'));var rp=require(_0x61db('0x6'));var fs=require('fs');var path=require(_0x61db('0x7'));var rimraf=require(_0x61db('0x8'));var config=require(_0x61db('0x9'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x47d14c,_0x1d97b7){return _0x47d14c['define'](_0x61db('0xa'),attributes,{'tableName':_0x61db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 710e86a..caeb35c 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 _0x9f52=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','model','map','ShowWhatsappQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1cc5cb,_0x32f79a){var _0x339a14=function(_0xde92eb){while(--_0xde92eb){_0x1cc5cb['push'](_0x1cc5cb['shift']());}};_0x339a14(++_0x32f79a);}(_0x9f52,0xb3));var _0x29f5=function(_0x1c20cc,_0x2f6860){_0x1c20cc=_0x1c20cc-0x0;var _0x2ed490=_0x9f52[_0x1c20cc];return _0x2ed490;};'use strict';var _=require(_0x29f5('0x0'));var util=require('util');var moment=require(_0x29f5('0x1'));var BPromise=require('bluebird');var rs=require(_0x29f5('0x2'));var fs=require('fs');var Redis=require(_0x29f5('0x3'));var db=require(_0x29f5('0x4'))['db'];var utils=require(_0x29f5('0x5'));var logger=require('../../config/logger')(_0x29f5('0x6'));var config=require(_0x29f5('0x7'));var jayson=require(_0x29f5('0x8'));var client=jayson[_0x29f5('0x9')][_0x29f5('0xa')]({'port':0x232a});config[_0x29f5('0xb')]=_[_0x29f5('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29f5('0xb')]));require(_0x29f5('0xd'))[_0x29f5('0xe')](socket);function respondWithRpcPromise(_0x26200c,_0x1f00a2,_0x4db1b6){return new BPromise(function(_0x584cd8,_0x4b71dd){return client[_0x29f5('0xf')](_0x26200c,_0x4db1b6)[_0x29f5('0x10')](function(_0x305768){logger[_0x29f5('0x11')](_0x29f5('0x12'),_0x1f00a2,'request\x20sent');logger[_0x29f5('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1f00a2,_0x29f5('0x14'),JSON[_0x29f5('0x15')](_0x305768));if(_0x305768[_0x29f5('0x16')]){if(_0x305768[_0x29f5('0x16')]['code']===0x1f4){logger[_0x29f5('0x16')](_0x29f5('0x12'),_0x1f00a2,_0x305768['error'][_0x29f5('0x17')]);return _0x4b71dd(_0x305768[_0x29f5('0x16')][_0x29f5('0x17')]);}logger[_0x29f5('0x16')](_0x29f5('0x12'),_0x1f00a2,_0x305768['error'][_0x29f5('0x17')]);return _0x584cd8(_0x305768[_0x29f5('0x16')][_0x29f5('0x17')]);}else{logger[_0x29f5('0x11')](_0x29f5('0x12'),_0x1f00a2,_0x29f5('0x14'));_0x584cd8(_0x305768['result'][_0x29f5('0x17')]);}})[_0x29f5('0x18')](function(_0x2b3028){logger[_0x29f5('0x16')](_0x29f5('0x12'),_0x1f00a2,_0x2b3028);_0x4b71dd(_0x2b3028);});});}exports[_0x29f5('0x19')]=function(_0x19d646){var _0x20c25c=this;return new Promise(function(_0x2e1b7c,_0x4d2caa){return db[_0x29f5('0x1a')][_0x29f5('0x1b')]({'raw':_0x19d646[_0x29f5('0x1c')]?_0x19d646[_0x29f5('0x1c')][_0x29f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x19d646[_0x29f5('0x1c')]?_0x19d646[_0x29f5('0x1c')][_0x29f5('0x1e')]||null:null,'attributes':_0x19d646['options']?_0x19d646[_0x29f5('0x1c')][_0x29f5('0x1f')]||null:null,'limit':_0x19d646[_0x29f5('0x1c')]?_0x19d646['options']['limit']||null:null,'include':_0x19d646[_0x29f5('0x1c')]?_0x19d646[_0x29f5('0x1c')]['include']?_['map'](_0x19d646['options'][_0x29f5('0x20')],function(_0x5b8a07){return{'model':db[_0x5b8a07['model']],'as':_0x5b8a07['as'],'attributes':_0x5b8a07['attributes'],'include':_0x5b8a07[_0x29f5('0x20')]?_['map'](_0x5b8a07['include'],function(_0x381836){return{'model':db[_0x381836[_0x29f5('0x21')]],'as':_0x381836['as'],'attributes':_0x381836[_0x29f5('0x1f')],'include':_0x381836['include']?_[_0x29f5('0x22')](_0x381836[_0x29f5('0x20')],function(_0x532330){return{'model':db[_0x532330['model']],'as':_0x532330['as'],'attributes':_0x532330['attributes']};}):[]};}):[]};}):[]:[]})[_0x29f5('0x10')](function(_0x2beb11){logger[_0x29f5('0x11')](_0x29f5('0x19'),_0x19d646);logger[_0x29f5('0x13')](_0x29f5('0x19'),_0x19d646,JSON[_0x29f5('0x15')](_0x2beb11));_0x2e1b7c(_0x2beb11);})[_0x29f5('0x18')](function(_0x21a570){logger[_0x29f5('0x16')](_0x29f5('0x19'),_0x21a570[_0x29f5('0x17')],_0x19d646);_0x4d2caa(_0x20c25c[_0x29f5('0x16')](0x1f4,_0x21a570[_0x29f5('0x17')]));});});};exports[_0x29f5('0x23')]=function(_0x1be222){var _0x2ebeb3=this;return new Promise(function(_0x4aef8e,_0x223b76){return db[_0x29f5('0x1a')][_0x29f5('0x24')]({'raw':_0x1be222[_0x29f5('0x1c')]?_0x1be222['options'][_0x29f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x1be222[_0x29f5('0x1c')]?_0x1be222[_0x29f5('0x1c')]['where']||null:null,'attributes':_0x1be222['options']?_0x1be222['options'][_0x29f5('0x1f')]||null:null,'include':_0x1be222[_0x29f5('0x1c')]?_0x1be222[_0x29f5('0x1c')]['include']?_['map'](_0x1be222['options']['include'],function(_0x169d22){return{'model':db[_0x169d22[_0x29f5('0x21')]],'as':_0x169d22['as'],'attributes':_0x169d22['attributes'],'include':_0x169d22['include']?_[_0x29f5('0x22')](_0x169d22['include'],function(_0x3b26b1){return{'model':db[_0x3b26b1[_0x29f5('0x21')]],'as':_0x3b26b1['as'],'attributes':_0x3b26b1[_0x29f5('0x1f')],'include':_0x3b26b1[_0x29f5('0x20')]?_[_0x29f5('0x22')](_0x3b26b1[_0x29f5('0x20')],function(_0x5f2b58){return{'model':db[_0x5f2b58[_0x29f5('0x21')]],'as':_0x5f2b58['as'],'attributes':_0x5f2b58[_0x29f5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x29f5('0x10')](function(_0x4b161d){logger[_0x29f5('0x11')](_0x29f5('0x23'),_0x1be222);logger[_0x29f5('0x13')]('ShowWhatsappQueue',_0x1be222,JSON[_0x29f5('0x15')](_0x4b161d));_0x4aef8e(_0x4b161d);})['catch'](function(_0x1b5c4c){logger[_0x29f5('0x16')]('ShowWhatsappQueue',_0x1b5c4c['message'],_0x1be222);_0x223b76(_0x2ebeb3[_0x29f5('0x16')](0x1f4,_0x1b5c4c[_0x29f5('0x17')]));});});}; \ No newline at end of file +var _0xb055=['jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetWhatsappQueue','findAll','options','where','attributes','limit','map','model','include','then','ShowWhatsappQueue','WhatsappQueue','find','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x4f2566,_0x2a6616){var _0x587bec=function(_0x59c4ec){while(--_0x59c4ec){_0x4f2566['push'](_0x4f2566['shift']());}};_0x587bec(++_0x2a6616);}(_0xb055,0x6e));var _0x5b05=function(_0x2bf1cc,_0x1c3c37){_0x2bf1cc=_0x2bf1cc-0x0;var _0x45bbd1=_0xb055[_0x2bf1cc];return _0x45bbd1;};'use strict';var _=require(_0x5b05('0x0'));var util=require('util');var moment=require(_0x5b05('0x1'));var BPromise=require(_0x5b05('0x2'));var rs=require(_0x5b05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b05('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b05('0x5'))('rpc');var config=require(_0x5b05('0x6'));var jayson=require(_0x5b05('0x7'));var client=jayson[_0x5b05('0x8')]['http']({'port':0x232a});config['redis']=_[_0x5b05('0x9')](config[_0x5b05('0xa')],{'host':_0x5b05('0xb'),'port':0x18eb});var socket=require(_0x5b05('0xc'))(new Redis(config['redis']));require(_0x5b05('0xd'))[_0x5b05('0xe')](socket);function respondWithRpcPromise(_0x38f9f5,_0x67dfe6,_0x5d783f){return new BPromise(function(_0x23a6e0,_0x95600c){return client['request'](_0x38f9f5,_0x5d783f)['then'](function(_0x1e9539){logger['info'](_0x5b05('0xf'),_0x67dfe6,_0x5b05('0x10'));logger[_0x5b05('0x11')](_0x5b05('0x12'),_0x67dfe6,'request\x20sent',JSON[_0x5b05('0x13')](_0x1e9539));if(_0x1e9539[_0x5b05('0x14')]){if(_0x1e9539['error'][_0x5b05('0x15')]===0x1f4){logger[_0x5b05('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x67dfe6,_0x1e9539[_0x5b05('0x14')][_0x5b05('0x16')]);return _0x95600c(_0x1e9539['error'][_0x5b05('0x16')]);}logger[_0x5b05('0x14')](_0x5b05('0xf'),_0x67dfe6,_0x1e9539['error'][_0x5b05('0x16')]);return _0x23a6e0(_0x1e9539[_0x5b05('0x14')][_0x5b05('0x16')]);}else{logger[_0x5b05('0x17')](_0x5b05('0xf'),_0x67dfe6,_0x5b05('0x10'));_0x23a6e0(_0x1e9539['result']['message']);}})[_0x5b05('0x18')](function(_0x4080a8){logger[_0x5b05('0x14')](_0x5b05('0xf'),_0x67dfe6,_0x4080a8);_0x95600c(_0x4080a8);});});}exports[_0x5b05('0x19')]=function(_0x5dc0a2){var _0x4edde4=this;return new Promise(function(_0x322432,_0x543f4c){return db['WhatsappQueue'][_0x5b05('0x1a')]({'raw':_0x5dc0a2['options']?_0x5dc0a2[_0x5b05('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5dc0a2[_0x5b05('0x1b')]?_0x5dc0a2[_0x5b05('0x1b')][_0x5b05('0x1c')]||null:null,'attributes':_0x5dc0a2['options']?_0x5dc0a2['options'][_0x5b05('0x1d')]||null:null,'limit':_0x5dc0a2[_0x5b05('0x1b')]?_0x5dc0a2[_0x5b05('0x1b')][_0x5b05('0x1e')]||null:null,'include':_0x5dc0a2['options']?_0x5dc0a2[_0x5b05('0x1b')]['include']?_[_0x5b05('0x1f')](_0x5dc0a2[_0x5b05('0x1b')]['include'],function(_0x21a0bc){return{'model':db[_0x21a0bc[_0x5b05('0x20')]],'as':_0x21a0bc['as'],'attributes':_0x21a0bc[_0x5b05('0x1d')],'include':_0x21a0bc['include']?_['map'](_0x21a0bc[_0x5b05('0x21')],function(_0x5ae2ff){return{'model':db[_0x5ae2ff[_0x5b05('0x20')]],'as':_0x5ae2ff['as'],'attributes':_0x5ae2ff[_0x5b05('0x1d')],'include':_0x5ae2ff['include']?_[_0x5b05('0x1f')](_0x5ae2ff[_0x5b05('0x21')],function(_0x5c9564){return{'model':db[_0x5c9564[_0x5b05('0x20')]],'as':_0x5c9564['as'],'attributes':_0x5c9564[_0x5b05('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5b05('0x22')](function(_0x2eeee1){logger['info'](_0x5b05('0x19'),_0x5dc0a2);logger[_0x5b05('0x11')](_0x5b05('0x19'),_0x5dc0a2,JSON[_0x5b05('0x13')](_0x2eeee1));_0x322432(_0x2eeee1);})[_0x5b05('0x18')](function(_0x2c23a4){logger[_0x5b05('0x14')](_0x5b05('0x19'),_0x2c23a4['message'],_0x5dc0a2);_0x543f4c(_0x4edde4['error'](0x1f4,_0x2c23a4[_0x5b05('0x16')]));});});};exports[_0x5b05('0x23')]=function(_0x4a81d4){var _0x348ad7=this;return new Promise(function(_0x18025a,_0x294839){return db[_0x5b05('0x24')][_0x5b05('0x25')]({'raw':_0x4a81d4['options']?_0x4a81d4[_0x5b05('0x1b')][_0x5b05('0x26')]===undefined?!![]:![]:!![],'where':_0x4a81d4[_0x5b05('0x1b')]?_0x4a81d4['options'][_0x5b05('0x1c')]||null:null,'attributes':_0x4a81d4[_0x5b05('0x1b')]?_0x4a81d4[_0x5b05('0x1b')]['attributes']||null:null,'include':_0x4a81d4[_0x5b05('0x1b')]?_0x4a81d4[_0x5b05('0x1b')][_0x5b05('0x21')]?_[_0x5b05('0x1f')](_0x4a81d4['options'][_0x5b05('0x21')],function(_0x40cdcc){return{'model':db[_0x40cdcc['model']],'as':_0x40cdcc['as'],'attributes':_0x40cdcc[_0x5b05('0x1d')],'include':_0x40cdcc[_0x5b05('0x21')]?_['map'](_0x40cdcc[_0x5b05('0x21')],function(_0x23ba04){return{'model':db[_0x23ba04[_0x5b05('0x20')]],'as':_0x23ba04['as'],'attributes':_0x23ba04[_0x5b05('0x1d')],'include':_0x23ba04[_0x5b05('0x21')]?_[_0x5b05('0x1f')](_0x23ba04[_0x5b05('0x21')],function(_0x4942d7){return{'model':db[_0x4942d7[_0x5b05('0x20')]],'as':_0x4942d7['as'],'attributes':_0x4942d7[_0x5b05('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5b05('0x22')](function(_0x1bc1f0){logger[_0x5b05('0x17')]('ShowWhatsappQueue',_0x4a81d4);logger[_0x5b05('0x11')](_0x5b05('0x23'),_0x4a81d4,JSON['stringify'](_0x1bc1f0));_0x18025a(_0x1bc1f0);})[_0x5b05('0x18')](function(_0x15a89e){logger[_0x5b05('0x14')]('ShowWhatsappQueue',_0x15a89e[_0x5b05('0x16')],_0x4a81d4);_0x294839(_0x348ad7[_0x5b05('0x14')](0x1f4,_0x15a89e[_0x5b05('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5903fd3..8b67422 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 _0xb6e7=['./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x273c83,_0x2b2100){var _0x1ade28=function(_0x242135){while(--_0x242135){_0x273c83['push'](_0x273c83['shift']());}};_0x1ade28(++_0x2b2100);}(_0xb6e7,0x165));var _0x7b6e=function(_0x2384b2,_0x4d6a25){_0x2384b2=_0x2384b2-0x0;var _0xf02d94=_0xb6e7[_0x2384b2];return _0xf02d94;};'use strict';var WhatsappQueueEvents=require(_0x7b6e('0x0'));var events=[_0x7b6e('0x1'),_0x7b6e('0x2'),_0x7b6e('0x3')];function createListener(_0x2be004,_0x313ec6){return function(_0x2dceb3){_0x313ec6[_0x7b6e('0x4')](_0x2be004,_0x2dceb3);};}function removeListener(_0x3ebb07,_0xcb5b0a){return function(){WhatsappQueueEvents[_0x7b6e('0x5')](_0x3ebb07,_0xcb5b0a);};}exports[_0x7b6e('0x6')]=function(_0x393101){for(var _0x2efe79=0x0,_0x236689=events['length'];_0x2efe79<_0x236689;_0x2efe79++){var _0x449f5a=events[_0x2efe79];var _0x1fe324=createListener('whatsappQueue:'+_0x449f5a,_0x393101);WhatsappQueueEvents['on'](_0x449f5a,_0x1fe324);}}; \ No newline at end of file +var _0x2c37=['update','emit','register','length','whatsappQueue:','save','remove'];(function(_0xcc48af,_0x3639cd){var _0x89d1ee=function(_0x470b89){while(--_0x470b89){_0xcc48af['push'](_0xcc48af['shift']());}};_0x89d1ee(++_0x3639cd);}(_0x2c37,0x1e1));var _0x72c3=function(_0x2fb552,_0x1f72de){_0x2fb552=_0x2fb552-0x0;var _0x15109f=_0x2c37[_0x2fb552];return _0x15109f;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x72c3('0x0'),_0x72c3('0x1'),_0x72c3('0x2')];function createListener(_0x2cc96f,_0x49bc32){return function(_0x31d0ea){_0x49bc32[_0x72c3('0x3')](_0x2cc96f,_0x31d0ea);};}function removeListener(_0x236503,_0x58d214){return function(){WhatsappQueueEvents['removeListener'](_0x236503,_0x58d214);};}exports[_0x72c3('0x4')]=function(_0x2fe10d){for(var _0x2894f6=0x0,_0x547210=events[_0x72c3('0x5')];_0x2894f6<_0x547210;_0x2894f6++){var _0x21c856=events[_0x2894f6];var _0x56a65c=createListener(_0x72c3('0x6')+_0x21c856,_0x2fe10d);WhatsappQueueEvents['on'](_0x21c856,_0x56a65c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index dbc1f67..117bcfe 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 _0xd3fd=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3fd,0xd7));var _0xdd3f=function(_0x133f52,_0x5b8c93){_0x133f52=_0x133f52-0x0;var _0x42fad9=_0xd3fd[_0x133f52];return _0x42fad9;};'use strict';var multer=require(_0xdd3f('0x0'));var util=require(_0xdd3f('0x1'));var path=require(_0xdd3f('0x2'));var timeout=require(_0xdd3f('0x3'));var express=require(_0xdd3f('0x4'));var router=express[_0xdd3f('0x5')]();var fs_extra=require(_0xdd3f('0x6'));var auth=require(_0xdd3f('0x7'));var interaction=require(_0xdd3f('0x8'));var config=require(_0xdd3f('0x9'));var controller=require(_0xdd3f('0xa'));router[_0xdd3f('0xb')]('/',auth[_0xdd3f('0xc')](),controller[_0xdd3f('0xd')]);router[_0xdd3f('0xb')](_0xdd3f('0xe'),auth[_0xdd3f('0xc')](),controller[_0xdd3f('0xf')]);router[_0xdd3f('0xb')](_0xdd3f('0x10'),auth['isAuthenticated'](),controller[_0xdd3f('0x11')]);router[_0xdd3f('0x12')]('/',auth[_0xdd3f('0xc')](),controller[_0xdd3f('0x13')]);router['put'](_0xdd3f('0x10'),auth[_0xdd3f('0xc')](),controller[_0xdd3f('0x14')]);router[_0xdd3f('0x15')](_0xdd3f('0x10'),auth[_0xdd3f('0xc')](),controller[_0xdd3f('0x16')]);module[_0xdd3f('0x17')]=router; \ No newline at end of file +var _0x3627=['fs-extra','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','show','post','put','/:id','update','delete','destroy','exports','connect-timeout','express'];(function(_0x1fb648,_0x3375f0){var _0xc44083=function(_0x3d1520){while(--_0x3d1520){_0x1fb648['push'](_0x1fb648['shift']());}};_0xc44083(++_0x3375f0);}(_0x3627,0x185));var _0x7362=function(_0xffad3e,_0x2941f8){_0xffad3e=_0xffad3e-0x0;var _0x5b2c58=_0x3627[_0xffad3e];return _0x5b2c58;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7362('0x0'));var express=require(_0x7362('0x1'));var router=express['Router']();var fs_extra=require(_0x7362('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7362('0x3'));var controller=require(_0x7362('0x4'));router[_0x7362('0x5')]('/',auth[_0x7362('0x6')](),controller[_0x7362('0x7')]);router['get'](_0x7362('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x7362('0x5')]('/:id',auth[_0x7362('0x6')](),controller[_0x7362('0x9')]);router[_0x7362('0xa')]('/',auth[_0x7362('0x6')](),controller['create']);router[_0x7362('0xb')](_0x7362('0xc'),auth['isAuthenticated'](),controller[_0x7362('0xd')]);router[_0x7362('0xe')](_0x7362('0xc'),auth[_0x7362('0x6')](),controller[_0x7362('0xf')]);module[_0x7362('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 9d1ac0f..d97e586 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(_0xab4108,_0x30e977){var _0x2138d7=function(_0x353f82){while(--_0x353f82){_0xab4108['push'](_0xab4108['shift']());}};_0x2138d7(++_0x30e977);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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(_0x30fd35,_0xbaf9b9){var _0x2f528b=function(_0x354514){while(--_0x354514){_0x30fd35['push'](_0x30fd35['shift']());}};_0x2f528b(++_0xbaf9b9);}(_0x7a54,0x106));var _0x47a5=function(_0x29c7e1,_0x5169e6){_0x29c7e1=_0x29c7e1-0x0;var _0x32a42b=_0x7a54[_0x29c7e1];return _0x32a42b;};'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 eea15dc..a359f60 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 _0xda3f=['fields','nolimit','sort','filter','where','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','map','key','model','query','keys','filters','intersection','attributes'];(function(_0x699aff,_0x29a314){var _0x37eb40=function(_0x70e349){while(--_0x70e349){_0x699aff['push'](_0x699aff['shift']());}};_0x37eb40(++_0x29a314);}(_0xda3f,0xec));var _0xfda3=function(_0x2b8b95,_0xe1e8c5){_0x2b8b95=_0x2b8b95-0x0;var _0x3a724f=_0xda3f[_0x2b8b95];return _0x3a724f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['index']=function(_0x3c1549,_0x4101b1){var _0x301509={},_0x474992={},_0xe21ec6={'count':0x0,'rows':[]};var _0x3cfeb2=_[_0xfda3('0x28')](db['WhatsappQueueReport']['rawAttributes'],function(_0x3aef3c){return{'name':_0x3aef3c['fieldName'],'type':_0x3aef3c['type'][_0xfda3('0x29')]};});_0x474992[_0xfda3('0x2a')]=_[_0xfda3('0x28')](_0x3cfeb2,_0xfda3('0x26'));_0x474992[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x3c1549[_0xfda3('0x2b')]);_0x474992[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x474992['model'],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2f')]=_[_0xfda3('0x2e')](_0x474992[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x301509[_0xfda3('0x2f')]=_0x301509[_0xfda3('0x2f')]['length']?_0x301509['attributes']:_0x474992[_0xfda3('0x2a')];if(!_0x3c1549[_0xfda3('0x2b')]['hasOwnProperty'](_0xfda3('0x31'))){_0x301509[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3c1549['query'][_0xfda3('0x1b')]);_0x301509[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x19')]);}_0x301509['order']=qs[_0xfda3('0x32')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x32')]);_0x301509['where']=qs[_0xfda3('0x2d')](_['pick'](_0x3c1549[_0xfda3('0x2b')],_0x474992[_0xfda3('0x2d')]),_0x3cfeb2);if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x33')]){_0x301509[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x301509[_0xfda3('0x34')],{'$or':_[_0xfda3('0x28')](_0x3cfeb2,function(_0x577be8){if(_0x577be8[_0xfda3('0x36')]!==_0xfda3('0x37')){var _0xd2dde0={};_0xd2dde0[_0x577be8[_0xfda3('0x26')]]={'$like':'%'+_0x3c1549['query'][_0xfda3('0x33')]+'%'};return _0xd2dde0;}})});}_0x301509=_[_0xfda3('0x35')]({},_0x301509,_0x3c1549[_0xfda3('0x38')]);var _0x5bad90={'where':_0x301509['where']};return db[_0xfda3('0x39')][_0xfda3('0x1c')](_0x5bad90)[_0xfda3('0x23')](function(_0x1aaa6c){_0xe21ec6[_0xfda3('0x1c')]=_0x1aaa6c;if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x301509[_0xfda3('0x3b')]=[{'all':!![]}];}return db[_0xfda3('0x39')][_0xfda3('0x3c')](_0x301509);})['then'](function(_0x27200f){_0xe21ec6[_0xfda3('0x3d')]=_0x27200f;return _0xe21ec6;})['then'](respondWithFilteredResult(_0x4101b1,_0x301509))[_0xfda3('0x3e')](handleError(_0x4101b1,null));};exports['show']=function(_0x51a314,_0x4e6886){var _0x2208bc={'raw':!![],'where':{'id':_0x51a314[_0xfda3('0x3f')]['id']}},_0x107fb1={};_0x107fb1[_0xfda3('0x2a')]=_['keys'](db[_0xfda3('0x39')][_0xfda3('0x40')]);_0x107fb1[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x51a314['query']);_0x107fb1[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],_0x107fb1['query']);_0x2208bc['attributes']=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x51a314[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x2208bc[_0xfda3('0x2f')]=_0x2208bc[_0xfda3('0x2f')][_0xfda3('0x41')]?_0x2208bc[_0xfda3('0x2f')]:_0x107fb1[_0xfda3('0x2a')];if(_0x51a314[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x2208bc[_0xfda3('0x3b')]=[{'all':!![]}];}_0x2208bc=_[_0xfda3('0x35')]({},_0x2208bc,_0x51a314['options']);return db['WhatsappQueueReport'][_0xfda3('0x42')](_0x2208bc)[_0xfda3('0x23')](handleEntityNotFound(_0x4e6886,null))[_0xfda3('0x23')](respondWithResult(_0x4e6886,null))[_0xfda3('0x3e')](handleError(_0x4e6886,null));};exports[_0xfda3('0x43')]=function(_0x60a89d,_0x192133){return db[_0xfda3('0x39')][_0xfda3('0x43')](_0x60a89d[_0xfda3('0x44')],{})['then'](respondWithResult(_0x192133,0xc9))[_0xfda3('0x3e')](handleError(_0x192133,null));};exports[_0xfda3('0x22')]=function(_0x481356,_0x36aa3a){if(_0x481356[_0xfda3('0x44')]['id']){delete _0x481356['body']['id'];}return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x481356[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x23')](saveUpdates(_0x481356[_0xfda3('0x44')],null))[_0xfda3('0x23')](respondWithResult(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x45')]=function(_0x33565d,_0x2f54eb){return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x33565d['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2f54eb,null))['then'](removeEntity(_0x2f54eb,null))[_0xfda3('0x3e')](handleError(_0x2f54eb,null));};exports['describe']=function(_0x1b5e89,_0x6447){return db[_0xfda3('0x39')][_0xfda3('0x46')]()['then'](respondWithResult(_0x6447,null))[_0xfda3('0x3e')](handleError(_0x6447,null));}; \ No newline at end of file +var _0xb58b=['save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','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','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject'];(function(_0x1a71b3,_0x43b728){var _0x3b3f5c=function(_0x2ea0e9){while(--_0x2ea0e9){_0x1a71b3['push'](_0x1a71b3['shift']());}};_0x3b3f5c(++_0x43b728);}(_0xb58b,0x1f1));var _0xbb58=function(_0x2769f7,_0x56cc0a){_0x2769f7=_0x2769f7-0x0;var _0x5ed29f=_0xb58b[_0x2769f7];return _0x5ed29f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe88799,_0x18810f){_0x18810f=_0x18810f||0xcc;return function(_0x4cda21){if(_0x4cda21){return _0xe88799[_0xbb58('0x18')](_0x18810f);}return _0xe88799[_0xbb58('0x19')](_0x18810f)[_0xbb58('0x1a')]();};}function respondWithResult(_0x3b9406,_0x19ceda){_0x19ceda=_0x19ceda||0xc8;return function(_0x58245f){if(_0x58245f){return _0x3b9406[_0xbb58('0x19')](_0x19ceda)[_0xbb58('0x1b')](_0x58245f);}};}function respondWithFilteredResult(_0x5f4751,_0x4ba30e){return function(_0x33c20f){if(_0x33c20f){var _0x445b1f=typeof _0x4ba30e[_0xbb58('0x1c')]==='undefined'&&typeof _0x4ba30e['limit']==='undefined';var _0x55156e=_0x33c20f[_0xbb58('0x1d')];var _0x3134ea=_0x445b1f?0x0:_0x4ba30e['offset'];var _0xbee66=_0x445b1f?_0x33c20f['count']:_0x4ba30e[_0xbb58('0x1c')]+_0x4ba30e[_0xbb58('0x1e')];var _0x3c33d9;if(_0xbee66>=_0x55156e){_0xbee66=_0x55156e;_0x3c33d9=0xc8;}else{_0x3c33d9=0xce;}_0x5f4751[_0xbb58('0x19')](_0x3c33d9);return _0x5f4751[_0xbb58('0x1f')](_0xbb58('0x20'),_0x3134ea+'-'+_0xbee66+'/'+_0x55156e)[_0xbb58('0x1b')](_0x33c20f);}return null;};}function patchUpdates(_0x497fd0){return function(_0x84f34){try{jsonpatch[_0xbb58('0x21')](_0x84f34,_0x497fd0,!![]);}catch(_0x3e64fe){return BPromise[_0xbb58('0x22')](_0x3e64fe);}return _0x84f34[_0xbb58('0x23')]();};}function saveUpdates(_0x5d4a91,_0x49453a){return function(_0x350be7){if(_0x350be7){return _0x350be7[_0xbb58('0x24')](_0x5d4a91)['then'](function(_0x27806d){return _0x27806d;});}return null;};}function removeEntity(_0x53b693,_0x21964d){return function(_0x287822){if(_0x287822){return _0x287822[_0xbb58('0x25')]()[_0xbb58('0x26')](function(){_0x53b693[_0xbb58('0x19')](0xcc)[_0xbb58('0x1a')]();});}};}function handleEntityNotFound(_0x2d556a,_0x15e4c5){return function(_0x4e0303){if(!_0x4e0303){_0x2d556a[_0xbb58('0x18')](0x194);}return _0x4e0303;};}function handleError(_0x3bd550,_0x1be0ae){_0x1be0ae=_0x1be0ae||0x1f4;return function(_0x129094){logger[_0xbb58('0x27')](_0x129094[_0xbb58('0x28')]);if(_0x129094[_0xbb58('0x29')]){delete _0x129094[_0xbb58('0x29')];}_0x3bd550[_0xbb58('0x19')](_0x1be0ae)[_0xbb58('0x2a')](_0x129094);};}exports[_0xbb58('0x2b')]=function(_0x28b3a3,_0x2a0481){var _0x4157c4={},_0x3559b6={},_0x573cca={'count':0x0,'rows':[]};var _0x2b0f73=_[_0xbb58('0x2c')](db[_0xbb58('0x2d')][_0xbb58('0x2e')],function(_0x3304b9){return{'name':_0x3304b9[_0xbb58('0x2f')],'type':_0x3304b9[_0xbb58('0x30')][_0xbb58('0x31')]};});_0x3559b6[_0xbb58('0x32')]=_['map'](_0x2b0f73,_0xbb58('0x29'));_0x3559b6[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x28b3a3[_0xbb58('0x33')]);_0x3559b6[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],_0x3559b6[_0xbb58('0x33')]);_0x4157c4[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x28b3a3[_0xbb58('0x33')]['fields']));_0x4157c4['attributes']=_0x4157c4['attributes'][_0xbb58('0x39')]?_0x4157c4[_0xbb58('0x37')]:_0x3559b6[_0xbb58('0x32')];if(!_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3a')](_0xbb58('0x3b'))){_0x4157c4[_0xbb58('0x1e')]=qs[_0xbb58('0x1e')](_0x28b3a3['query'][_0xbb58('0x1e')]);_0x4157c4[_0xbb58('0x1c')]=qs['offset'](_0x28b3a3[_0xbb58('0x33')]['offset']);}_0x4157c4[_0xbb58('0x3c')]=qs['sort'](_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3d')]);_0x4157c4['where']=qs[_0xbb58('0x35')](_[_0xbb58('0x3e')](_0x28b3a3[_0xbb58('0x33')],_0x3559b6[_0xbb58('0x35')]),_0x2b0f73);if(_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3f')]){_0x4157c4[_0xbb58('0x40')]=_[_0xbb58('0x41')](_0x4157c4['where'],{'$or':_[_0xbb58('0x2c')](_0x2b0f73,function(_0x31aa4b){if(_0x31aa4b[_0xbb58('0x30')]!=='VIRTUAL'){var _0x4dbd5e={};_0x4dbd5e[_0x31aa4b[_0xbb58('0x29')]]={'$like':'%'+_0x28b3a3['query'][_0xbb58('0x3f')]+'%'};return _0x4dbd5e;}})});}_0x4157c4=_[_0xbb58('0x41')]({},_0x4157c4,_0x28b3a3[_0xbb58('0x42')]);var _0x560911={'where':_0x4157c4['where']};return db[_0xbb58('0x2d')][_0xbb58('0x1d')](_0x560911)[_0xbb58('0x26')](function(_0x24d82d){_0x573cca[_0xbb58('0x1d')]=_0x24d82d;if(_0x28b3a3[_0xbb58('0x33')]['includeAll']){_0x4157c4[_0xbb58('0x43')]=[{'all':!![]}];}return db[_0xbb58('0x2d')][_0xbb58('0x44')](_0x4157c4);})[_0xbb58('0x26')](function(_0x1185b3){_0x573cca[_0xbb58('0x45')]=_0x1185b3;return _0x573cca;})['then'](respondWithFilteredResult(_0x2a0481,_0x4157c4))[_0xbb58('0x46')](handleError(_0x2a0481,null));};exports['show']=function(_0x22f1c3,_0x285ad4){var _0x29fb1c={'raw':!![],'where':{'id':_0x22f1c3['params']['id']}},_0x45817f={};_0x45817f[_0xbb58('0x32')]=_[_0xbb58('0x34')](db[_0xbb58('0x2d')][_0xbb58('0x2e')]);_0x45817f['query']=_[_0xbb58('0x34')](_0x22f1c3['query']);_0x45817f[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],_0x45817f[_0xbb58('0x33')]);_0x29fb1c[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x22f1c3[_0xbb58('0x33')][_0xbb58('0x38')]));_0x29fb1c[_0xbb58('0x37')]=_0x29fb1c[_0xbb58('0x37')][_0xbb58('0x39')]?_0x29fb1c['attributes']:_0x45817f[_0xbb58('0x32')];if(_0x22f1c3['query']['includeAll']){_0x29fb1c[_0xbb58('0x43')]=[{'all':!![]}];}_0x29fb1c=_[_0xbb58('0x41')]({},_0x29fb1c,_0x22f1c3[_0xbb58('0x42')]);return db[_0xbb58('0x2d')][_0xbb58('0x47')](_0x29fb1c)[_0xbb58('0x26')](handleEntityNotFound(_0x285ad4,null))[_0xbb58('0x26')](respondWithResult(_0x285ad4,null))[_0xbb58('0x46')](handleError(_0x285ad4,null));};exports[_0xbb58('0x48')]=function(_0x39995e,_0x440fb3){return db['WhatsappQueueReport'][_0xbb58('0x48')](_0x39995e[_0xbb58('0x49')],{})['then'](respondWithResult(_0x440fb3,0xc9))[_0xbb58('0x46')](handleError(_0x440fb3,null));};exports[_0xbb58('0x24')]=function(_0xf94897,_0xdb0ff7){if(_0xf94897['body']['id']){delete _0xf94897[_0xbb58('0x49')]['id'];}return db['WhatsappQueueReport'][_0xbb58('0x47')]({'where':{'id':_0xf94897[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0xdb0ff7,null))['then'](saveUpdates(_0xf94897[_0xbb58('0x49')],null))[_0xbb58('0x26')](respondWithResult(_0xdb0ff7,null))['catch'](handleError(_0xdb0ff7,null));};exports[_0xbb58('0x25')]=function(_0x4ca201,_0x28301d){return db[_0xbb58('0x2d')][_0xbb58('0x47')]({'where':{'id':_0x4ca201[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x28301d,null))[_0xbb58('0x26')](removeEntity(_0x28301d,null))[_0xbb58('0x46')](handleError(_0x28301d,null));};exports['describe']=function(_0x449088,_0x1fd892){return db['WhatsappQueueReport'][_0xbb58('0x4b')]()[_0xbb58('0x26')](respondWithResult(_0x1fd892,null))['catch'](handleError(_0x1fd892,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index cfe1a73..36913f8 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 _0x8a49=['../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a49,0xf0));var _0x98a4=function(_0x4da690,_0x12d136){_0x4da690=_0x4da690-0x0;var _0x263c53=_0x8a49[_0x4da690];return _0x263c53;};'use strict';var _=require(_0x98a4('0x0'));var util=require('util');var logger=require(_0x98a4('0x1'))('api');var moment=require(_0x98a4('0x2'));var BPromise=require(_0x98a4('0x3'));var rp=require(_0x98a4('0x4'));var fs=require('fs');var path=require(_0x98a4('0x5'));var rimraf=require(_0x98a4('0x6'));var config=require(_0x98a4('0x7'));var attributes=require(_0x98a4('0x8'));module[_0x98a4('0x9')]=function(_0x3d8ccc,_0x4e1444){return _0x3d8ccc['define'](_0x98a4('0xa'),attributes,{'tableName':_0x98a4('0xb'),'paranoid':![],'indexes':[{'name':_0x98a4('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9096=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','exports','define'];(function(_0x315d54,_0x333bec){var _0x21c13e=function(_0x320f9c){while(--_0x320f9c){_0x315d54['push'](_0x315d54['shift']());}};_0x21c13e(++_0x333bec);}(_0x9096,0x87));var _0x6909=function(_0x5b925c,_0x6c4a8){_0x5b925c=_0x5b925c-0x0;var _0x58516c=_0x9096[_0x5b925c];return _0x58516c;};'use strict';var _=require(_0x6909('0x0'));var util=require(_0x6909('0x1'));var logger=require('../../config/logger')(_0x6909('0x2'));var moment=require('moment');var BPromise=require(_0x6909('0x3'));var rp=require(_0x6909('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6909('0x5'));var attributes=require(_0x6909('0x6'));module[_0x6909('0x7')]=function(_0x469a1d,_0x582e5f){return _0x469a1d[_0x6909('0x8')](_0x6909('0x9'),attributes,{'tableName':_0x6909('0xa'),'paranoid':![],'indexes':[{'name':_0x6909('0xb'),'fields':[_0x6909('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 22ddf9d..fbe3207 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 _0xe57f=['options','raw','UpdateWhatsappQueueReport','update','attributes','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body'];(function(_0x1961b0,_0x236bee){var _0xedeecb=function(_0x3d3901){while(--_0x3d3901){_0x1961b0['push'](_0x1961b0['shift']());}};_0xedeecb(++_0x236bee);}(_0xe57f,0x1a6));var _0xfe57=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe57f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xfe57('0x0'));var util=require('util');var moment=require(_0xfe57('0x1'));var BPromise=require(_0xfe57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe57('0x3'));var db=require(_0xfe57('0x4'))['db'];var utils=require(_0xfe57('0x5'));var logger=require(_0xfe57('0x6'))(_0xfe57('0x7'));var config=require(_0xfe57('0x8'));var jayson=require(_0xfe57('0x9'));var client=jayson[_0xfe57('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8b07,_0x1d34ec,_0x3f235d){return new BPromise(function(_0x32cda5,_0x3298d8){return client[_0xfe57('0xb')](_0x1b8b07,_0x3f235d)[_0xfe57('0xc')](function(_0x163791){logger[_0xfe57('0xd')](_0xfe57('0xe'),_0x1d34ec,_0xfe57('0xf'));logger['debug'](_0xfe57('0x10'),_0x1d34ec,'request\x20sent',JSON[_0xfe57('0x11')](_0x163791));if(_0x163791['error']){if(_0x163791['error'][_0xfe57('0x12')]===0x1f4){logger['error'](_0xfe57('0xe'),_0x1d34ec,_0x163791[_0xfe57('0x13')][_0xfe57('0x14')]);return _0x3298d8(_0x163791['error'][_0xfe57('0x14')]);}logger[_0xfe57('0x13')](_0xfe57('0xe'),_0x1d34ec,_0x163791[_0xfe57('0x13')][_0xfe57('0x14')]);return _0x32cda5(_0x163791[_0xfe57('0x13')][_0xfe57('0x14')]);}else{logger[_0xfe57('0xd')](_0xfe57('0xe'),_0x1d34ec,'request\x20sent');_0x32cda5(_0x163791[_0xfe57('0x15')][_0xfe57('0x14')]);}})[_0xfe57('0x16')](function(_0x5ce253){logger['error'](_0xfe57('0xe'),_0x1d34ec,_0x5ce253);_0x3298d8(_0x5ce253);});});}exports[_0xfe57('0x17')]=function(_0x26a02c){var _0x1daf73=this;return new Promise(function(_0x1e1ec3,_0x2ed5c9){return db[_0xfe57('0x18')]['create'](_0x26a02c[_0xfe57('0x19')],{'raw':_0x26a02c[_0xfe57('0x1a')]?_0x26a02c[_0xfe57('0x1a')][_0xfe57('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x18410f){logger[_0xfe57('0xd')](_0xfe57('0x17'),_0x26a02c);logger['debug'](_0xfe57('0x17'),_0x26a02c,JSON['stringify'](_0x18410f));_0x1e1ec3(_0x18410f);})[_0xfe57('0x16')](function(_0x1ba9d3){logger[_0xfe57('0x13')](_0xfe57('0x17'),_0x1ba9d3['message'],_0x26a02c);_0x2ed5c9(_0x1daf73['error'](0x1f4,_0x1ba9d3[_0xfe57('0x14')]));});});};exports[_0xfe57('0x1c')]=function(_0x3fd149){var _0x412d56=this;return new Promise(function(_0x57c380,_0xdea752){return db[_0xfe57('0x18')][_0xfe57('0x1d')](_0x3fd149['body'],{'raw':_0x3fd149['options']?_0x3fd149['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd149[_0xfe57('0x1a')]?_0x3fd149[_0xfe57('0x1a')]['where']||null:null,'attributes':_0x3fd149[_0xfe57('0x1a')]?_0x3fd149[_0xfe57('0x1a')][_0xfe57('0x1e')]||null:null,'limit':_0x3fd149[_0xfe57('0x1a')]?_0x3fd149['options']['limit']||null:null})[_0xfe57('0xc')](function(_0x133bed){logger[_0xfe57('0xd')]('UpdateWhatsappQueueReport',_0x3fd149);logger[_0xfe57('0x1f')](_0xfe57('0x1c'),_0x3fd149,JSON[_0xfe57('0x11')](_0x133bed));_0x57c380(_0x133bed);})[_0xfe57('0x16')](function(_0x5023d0){logger[_0xfe57('0x13')](_0xfe57('0x1c'),_0x5023d0['message'],_0x3fd149);_0xdea752(_0x412d56[_0xfe57('0x13')](0x1f4,_0x5023d0[_0xfe57('0x14')]));});});}; \ No newline at end of file +var _0x17c2=['WhatsappQueueReport','body','options','raw','update','attributes','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappQueueReport'];(function(_0x872ec2,_0x22ee21){var _0x566774=function(_0x4db14e){while(--_0x4db14e){_0x872ec2['push'](_0x872ec2['shift']());}};_0x566774(++_0x22ee21);}(_0x17c2,0x128));var _0x217c=function(_0x4ee0ba,_0x340d2c){_0x4ee0ba=_0x4ee0ba-0x0;var _0x52917f=_0x17c2[_0x4ee0ba];return _0x52917f;};'use strict';var _=require(_0x217c('0x0'));var util=require('util');var moment=require(_0x217c('0x1'));var BPromise=require(_0x217c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x217c('0x3'));var db=require(_0x217c('0x4'))['db'];var utils=require(_0x217c('0x5'));var logger=require('../../config/logger')(_0x217c('0x6'));var config=require(_0x217c('0x7'));var jayson=require(_0x217c('0x8'));var client=jayson[_0x217c('0x9')][_0x217c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x432594,_0x8a6113,_0xb3cc8c){return new BPromise(function(_0x58dadf,_0x1d8e9f){return client[_0x217c('0xb')](_0x432594,_0xb3cc8c)[_0x217c('0xc')](function(_0x1b071c){logger[_0x217c('0xd')](_0x217c('0xe'),_0x8a6113,_0x217c('0xf'));logger[_0x217c('0x10')](_0x217c('0x11'),_0x8a6113,_0x217c('0xf'),JSON[_0x217c('0x12')](_0x1b071c));if(_0x1b071c['error']){if(_0x1b071c[_0x217c('0x13')]['code']===0x1f4){logger['error'](_0x217c('0xe'),_0x8a6113,_0x1b071c[_0x217c('0x13')]['message']);return _0x1d8e9f(_0x1b071c['error'][_0x217c('0x14')]);}logger[_0x217c('0x13')](_0x217c('0xe'),_0x8a6113,_0x1b071c['error'][_0x217c('0x14')]);return _0x58dadf(_0x1b071c[_0x217c('0x13')][_0x217c('0x14')]);}else{logger[_0x217c('0xd')](_0x217c('0xe'),_0x8a6113,'request\x20sent');_0x58dadf(_0x1b071c[_0x217c('0x15')][_0x217c('0x14')]);}})[_0x217c('0x16')](function(_0x76518a){logger[_0x217c('0x13')](_0x217c('0xe'),_0x8a6113,_0x76518a);_0x1d8e9f(_0x76518a);});});}exports[_0x217c('0x17')]=function(_0xd4bdce){var _0x2f68ba=this;return new Promise(function(_0xf2cba3,_0x1f7915){return db[_0x217c('0x18')]['create'](_0xd4bdce[_0x217c('0x19')],{'raw':_0xd4bdce['options']?_0xd4bdce[_0x217c('0x1a')][_0x217c('0x1b')]===undefined?!![]:![]:!![]})[_0x217c('0xc')](function(_0xe537d4){logger[_0x217c('0xd')](_0x217c('0x17'),_0xd4bdce);logger[_0x217c('0x10')]('CreateWhatsappQueueReport',_0xd4bdce,JSON[_0x217c('0x12')](_0xe537d4));_0xf2cba3(_0xe537d4);})['catch'](function(_0x426464){logger['error'](_0x217c('0x17'),_0x426464['message'],_0xd4bdce);_0x1f7915(_0x2f68ba[_0x217c('0x13')](0x1f4,_0x426464[_0x217c('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1f2449){var _0x36bd69=this;return new Promise(function(_0x1ecbd8,_0x3c07a0){return db['WhatsappQueueReport'][_0x217c('0x1c')](_0x1f2449['body'],{'raw':_0x1f2449[_0x217c('0x1a')]?_0x1f2449[_0x217c('0x1a')][_0x217c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f2449[_0x217c('0x1a')]?_0x1f2449['options']['where']||null:null,'attributes':_0x1f2449[_0x217c('0x1a')]?_0x1f2449['options'][_0x217c('0x1d')]||null:null,'limit':_0x1f2449['options']?_0x1f2449[_0x217c('0x1a')][_0x217c('0x1e')]||null:null})[_0x217c('0xc')](function(_0x52f6cd){logger[_0x217c('0xd')]('UpdateWhatsappQueueReport',_0x1f2449);logger[_0x217c('0x10')](_0x217c('0x1f'),_0x1f2449,JSON[_0x217c('0x12')](_0x52f6cd));_0x1ecbd8(_0x52f6cd);})[_0x217c('0x16')](function(_0x52c11b){logger[_0x217c('0x13')]('UpdateWhatsappQueueReport',_0x52c11b['message'],_0x1f2449);_0x3c07a0(_0x36bd69[_0x217c('0x13')](0x1f4,_0x52c11b[_0x217c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 71aec89..536ce9d 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 _0x2605=['fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','delete','/:id','destroy','exports','util','path','connect-timeout','express'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x2605,0x18b));var _0x5260=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x2605[_0xeff2c3];return _0x2cade6;};'use strict';var multer=require('multer');var util=require(_0x5260('0x0'));var path=require(_0x5260('0x1'));var timeout=require(_0x5260('0x2'));var express=require(_0x5260('0x3'));var router=express['Router']();var fs_extra=require(_0x5260('0x4'));var auth=require(_0x5260('0x5'));var interaction=require(_0x5260('0x6'));var config=require('../../config/environment');var controller=require(_0x5260('0x7'));router[_0x5260('0x8')]('/',auth[_0x5260('0x9')](),controller['index']);router[_0x5260('0x8')](_0x5260('0xa'),auth[_0x5260('0x9')](),controller[_0x5260('0xb')]);router['get']('/:id',auth[_0x5260('0x9')](),controller[_0x5260('0xc')]);router[_0x5260('0xd')]('/',auth['isAuthenticated'](),controller[_0x5260('0xe')]);router['put']('/:id',auth[_0x5260('0x9')](),controller['update']);router[_0x5260('0xf')](_0x5260('0x10'),auth[_0x5260('0x9')](),controller[_0x5260('0x11')]);module[_0x5260('0x12')]=router; \ No newline at end of file +var _0x7f34=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','index','get','/describe','/:id','show','isAuthenticated','create'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0x7f34,0x194));var _0x47f3=function(_0x49e6a9,_0x4213ce){_0x49e6a9=_0x49e6a9-0x0;var _0x32ce53=_0x7f34[_0x49e6a9];return _0x32ce53;};'use strict';var multer=require(_0x47f3('0x0'));var util=require(_0x47f3('0x1'));var path=require(_0x47f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x47f3('0x3'));var router=express['Router']();var fs_extra=require(_0x47f3('0x4'));var auth=require(_0x47f3('0x5'));var interaction=require(_0x47f3('0x6'));var config=require(_0x47f3('0x7'));var controller=require(_0x47f3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x47f3('0x9')]);router[_0x47f3('0xa')](_0x47f3('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x47f3('0xa')](_0x47f3('0xc'),auth['isAuthenticated'](),controller[_0x47f3('0xd')]);router['post']('/',auth[_0x47f3('0xe')](),controller[_0x47f3('0xf')]);router['put'](_0x47f3('0xc'),auth[_0x47f3('0xe')](),controller[_0x47f3('0x10')]);router[_0x47f3('0x11')](_0x47f3('0xc'),auth[_0x47f3('0xe')](),controller[_0x47f3('0x12')]);module[_0x47f3('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 54fa088..54b1c59 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 _0xd237=['exports','STRING','ENUM','agent','queue','DATE','sequelize'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xd237,0x14f));var _0x7d23=function(_0x5721d7,_0x3908cd){_0x5721d7=_0x5721d7-0x0;var _0x504bbe=_0xd237[_0x5721d7];return _0x504bbe;};'use strict';var Sequelize=require(_0x7d23('0x0'));module[_0x7d23('0x1')]={'uniqueid':{'type':Sequelize[_0x7d23('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7d23('0x3')]('account',_0x7d23('0x4'),_0x7d23('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7d23('0x6')]}}; \ No newline at end of file +var _0x9e63=['agent','queue','DATE','sequelize','exports','STRING','account'];(function(_0x1cf87d,_0x1db281){var _0x35ff98=function(_0x372feb){while(--_0x372feb){_0x1cf87d['push'](_0x1cf87d['shift']());}};_0x35ff98(++_0x1db281);}(_0x9e63,0x65));var _0x39e6=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x9e63[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require(_0x39e6('0x0'));module[_0x39e6('0x1')]={'uniqueid':{'type':Sequelize[_0x39e6('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x39e6('0x3'),_0x39e6('0x4'),_0x39e6('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x39e6('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 539bd51..d25c28e 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 _0x1fe1=['status','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit'];(function(_0x1d10ae,_0x23555b){var _0x4541fc=function(_0x9e1a36){while(--_0x9e1a36){_0x1d10ae['push'](_0x1d10ae['shift']());}};_0x4541fc(++_0x23555b);}(_0x1fe1,0xbd));var _0x11fe=function(_0x25ad0d,_0x1c13e6){_0x25ad0d=_0x25ad0d-0x0;var _0x12f2b7=_0x1fe1[_0x25ad0d];return _0x12f2b7;};'use strict';var emlformat=require(_0x11fe('0x0'));var rimraf=require(_0x11fe('0x1'));var zipdir=require(_0x11fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11fe('0x3'));var moment=require(_0x11fe('0x4'));var BPromise=require(_0x11fe('0x5'));var Mustache=require(_0x11fe('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x11fe('0x7'));var ejs=require(_0x11fe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11fe('0x9'));var crypto=require(_0x11fe('0xa'));var jsforce=require(_0x11fe('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x11fe('0x7'));var querystring=require(_0x11fe('0xc'));var Papa=require(_0x11fe('0xd'));var Redis=require(_0x11fe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x11fe('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11fe('0x10'));var utils=require(_0x11fe('0x11'));var config=require(_0x11fe('0x12'));var licenseUtil=require(_0x11fe('0x13'));var db=require(_0x11fe('0x14'))['db'];function respondWithStatusCode(_0x2b7fc7,_0x430d76){_0x430d76=_0x430d76||0xcc;return function(_0x389ab7){if(_0x389ab7){return _0x2b7fc7[_0x11fe('0x15')](_0x430d76);}return _0x2b7fc7['status'](_0x430d76)['end']();};}function respondWithResult(_0x514f10,_0x159fb7){_0x159fb7=_0x159fb7||0xc8;return function(_0x1318b3){if(_0x1318b3){return _0x514f10['status'](_0x159fb7)[_0x11fe('0x16')](_0x1318b3);}};}function respondWithFilteredResult(_0xcaccd5,_0x376748){return function(_0x39c8f3){if(_0x39c8f3){var _0x3bc5d8=typeof _0x376748[_0x11fe('0x17')]===_0x11fe('0x18')&&typeof _0x376748['limit']===_0x11fe('0x18');var _0x2ef394=_0x39c8f3['count'];var _0x5d4e0b=_0x3bc5d8?0x0:_0x376748[_0x11fe('0x17')];var _0x47f70b=_0x3bc5d8?_0x39c8f3[_0x11fe('0x19')]:_0x376748['offset']+_0x376748[_0x11fe('0x1a')];var _0x3dd272;if(_0x47f70b>=_0x2ef394){_0x47f70b=_0x2ef394;_0x3dd272=0xc8;}else{_0x3dd272=0xce;}_0xcaccd5[_0x11fe('0x1b')](_0x3dd272);return _0xcaccd5[_0x11fe('0x1c')](_0x11fe('0x1d'),_0x5d4e0b+'-'+_0x47f70b+'/'+_0x2ef394)['json'](_0x39c8f3);}return null;};}function patchUpdates(_0x37c309){return function(_0x112c2c){try{jsonpatch[_0x11fe('0x1e')](_0x112c2c,_0x37c309,!![]);}catch(_0xd37dae){return BPromise[_0x11fe('0x1f')](_0xd37dae);}return _0x112c2c[_0x11fe('0x20')]();};}function saveUpdates(_0x2c6795,_0x74fad4){return function(_0x1a1040){if(_0x1a1040){return _0x1a1040[_0x11fe('0x21')](_0x2c6795)[_0x11fe('0x22')](function(_0x197344){return _0x197344;});}return null;};}function removeEntity(_0xd5dd60,_0x1eda95){return function(_0x422969){if(_0x422969){return _0x422969['destroy']()[_0x11fe('0x22')](function(){_0xd5dd60[_0x11fe('0x1b')](0xcc)[_0x11fe('0x23')]();});}};}function handleEntityNotFound(_0x440ada,_0x51a4d3){return function(_0x322a4c){if(!_0x322a4c){_0x440ada[_0x11fe('0x15')](0x194);}return _0x322a4c;};}function handleError(_0x509036,_0x3731b2){_0x3731b2=_0x3731b2||0x1f4;return function(_0x315cd6){logger[_0x11fe('0x24')](_0x315cd6[_0x11fe('0x25')]);if(_0x315cd6['name']){delete _0x315cd6[_0x11fe('0x26')];}_0x509036[_0x11fe('0x1b')](_0x3731b2)['send'](_0x315cd6);};}exports[_0x11fe('0x27')]=function(_0x4e9016,_0x1f1953){var _0x3057e1={},_0x2436ad={},_0xeb4150={'count':0x0,'rows':[]};var _0x3ec437=_[_0x11fe('0x28')](db[_0x11fe('0x29')][_0x11fe('0x2a')],function(_0x5cda21){return{'name':_0x5cda21['fieldName'],'type':_0x5cda21[_0x11fe('0x2b')]['key']};});_0x2436ad[_0x11fe('0x2c')]=_['map'](_0x3ec437,_0x11fe('0x26'));_0x2436ad['query']=_[_0x11fe('0x2d')](_0x4e9016[_0x11fe('0x2e')]);_0x2436ad[_0x11fe('0x2f')]=_['intersection'](_0x2436ad['model'],_0x2436ad[_0x11fe('0x2e')]);_0x3057e1[_0x11fe('0x30')]=_[_0x11fe('0x31')](_0x2436ad[_0x11fe('0x2c')],qs[_0x11fe('0x32')](_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x32')]));_0x3057e1['attributes']=_0x3057e1['attributes'][_0x11fe('0x33')]?_0x3057e1['attributes']:_0x2436ad[_0x11fe('0x2c')];if(!_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x34')](_0x11fe('0x35'))){_0x3057e1[_0x11fe('0x1a')]=qs[_0x11fe('0x1a')](_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x1a')]);_0x3057e1[_0x11fe('0x17')]=qs['offset'](_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x17')]);}_0x3057e1[_0x11fe('0x36')]=qs['sort'](_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x37')]);_0x3057e1[_0x11fe('0x38')]=qs[_0x11fe('0x2f')](_['pick'](_0x4e9016[_0x11fe('0x2e')],_0x2436ad[_0x11fe('0x2f')]),_0x3ec437);if(_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x39')]){_0x3057e1[_0x11fe('0x38')]=_[_0x11fe('0x3a')](_0x3057e1[_0x11fe('0x38')],{'$or':_['map'](_0x3ec437,function(_0x415151){if(_0x415151[_0x11fe('0x2b')]!==_0x11fe('0x3b')){var _0x1758d0={};_0x1758d0[_0x415151[_0x11fe('0x26')]]={'$like':'%'+_0x4e9016[_0x11fe('0x2e')]['filter']+'%'};return _0x1758d0;}})});}_0x3057e1=_[_0x11fe('0x3a')]({},_0x3057e1,_0x4e9016[_0x11fe('0x3c')]);var _0x161c8d={'where':_0x3057e1['where']};return db['WhatsappTransferReport'][_0x11fe('0x19')](_0x161c8d)[_0x11fe('0x22')](function(_0x51607c){_0xeb4150[_0x11fe('0x19')]=_0x51607c;if(_0x4e9016['query']['includeAll']){_0x3057e1['include']=[{'all':!![]}];}return db[_0x11fe('0x29')][_0x11fe('0x3d')](_0x3057e1);})[_0x11fe('0x22')](function(_0x37ed92){_0xeb4150[_0x11fe('0x3e')]=_0x37ed92;return _0xeb4150;})[_0x11fe('0x22')](respondWithFilteredResult(_0x1f1953,_0x3057e1))[_0x11fe('0x3f')](handleError(_0x1f1953,null));};exports[_0x11fe('0x40')]=function(_0xa1c698,_0x2fe790){var _0x114a7d={'raw':!![],'where':{'id':_0xa1c698['params']['id']}},_0x1a6bcc={};_0x1a6bcc['model']=_['keys'](db[_0x11fe('0x29')][_0x11fe('0x2a')]);_0x1a6bcc[_0x11fe('0x2e')]=_[_0x11fe('0x2d')](_0xa1c698[_0x11fe('0x2e')]);_0x1a6bcc['filters']=_[_0x11fe('0x31')](_0x1a6bcc['model'],_0x1a6bcc[_0x11fe('0x2e')]);_0x114a7d[_0x11fe('0x30')]=_[_0x11fe('0x31')](_0x1a6bcc['model'],qs[_0x11fe('0x32')](_0xa1c698['query']['fields']));_0x114a7d['attributes']=_0x114a7d[_0x11fe('0x30')][_0x11fe('0x33')]?_0x114a7d[_0x11fe('0x30')]:_0x1a6bcc[_0x11fe('0x2c')];if(_0xa1c698[_0x11fe('0x2e')][_0x11fe('0x41')]){_0x114a7d['include']=[{'all':!![]}];}_0x114a7d=_[_0x11fe('0x3a')]({},_0x114a7d,_0xa1c698[_0x11fe('0x3c')]);return db[_0x11fe('0x29')]['find'](_0x114a7d)[_0x11fe('0x22')](handleEntityNotFound(_0x2fe790,null))[_0x11fe('0x22')](respondWithResult(_0x2fe790,null))['catch'](handleError(_0x2fe790,null));};exports[_0x11fe('0x42')]=function(_0x5567d4,_0x128066){return db[_0x11fe('0x29')][_0x11fe('0x42')](_0x5567d4[_0x11fe('0x43')],{})[_0x11fe('0x22')](respondWithResult(_0x128066,0xc9))[_0x11fe('0x3f')](handleError(_0x128066,null));};exports[_0x11fe('0x21')]=function(_0x36e31b,_0x215f38){if(_0x36e31b['body']['id']){delete _0x36e31b[_0x11fe('0x43')]['id'];}return db[_0x11fe('0x29')][_0x11fe('0x44')]({'where':{'id':_0x36e31b[_0x11fe('0x45')]['id']}})[_0x11fe('0x22')](handleEntityNotFound(_0x215f38,null))[_0x11fe('0x22')](saveUpdates(_0x36e31b['body'],null))[_0x11fe('0x22')](respondWithResult(_0x215f38,null))['catch'](handleError(_0x215f38,null));};exports[_0x11fe('0x46')]=function(_0x4ebd9c,_0x37acf2){return db[_0x11fe('0x29')][_0x11fe('0x44')]({'where':{'id':_0x4ebd9c[_0x11fe('0x45')]['id']}})[_0x11fe('0x22')](handleEntityNotFound(_0x37acf2,null))[_0x11fe('0x22')](removeEntity(_0x37acf2,null))[_0x11fe('0x3f')](handleError(_0x37acf2,null));};exports['describe']=function(_0x10a54f,_0xd7690c){return db['WhatsappTransferReport'][_0x11fe('0x47')]()['then'](respondWithResult(_0xd7690c,null))['catch'](handleError(_0xd7690c,null));}; \ No newline at end of file +var _0x4c8a=['where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','sort'];(function(_0x4f3c5d,_0x116ed0){var _0x753161=function(_0x395e35){while(--_0x395e35){_0x4f3c5d['push'](_0x4f3c5d['shift']());}};_0x753161(++_0x116ed0);}(_0x4c8a,0x1d9));var _0xa4c8=function(_0x532b02,_0x3577f0){_0x532b02=_0x532b02-0x0;var _0x5401dc=_0x4c8a[_0x532b02];return _0x5401dc;};'use strict';var emlformat=require(_0xa4c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4c8('0x1'));var jsonpatch=require(_0xa4c8('0x2'));var rp=require(_0xa4c8('0x3'));var moment=require(_0xa4c8('0x4'));var BPromise=require(_0xa4c8('0x5'));var Mustache=require(_0xa4c8('0x6'));var util=require(_0xa4c8('0x7'));var path=require(_0xa4c8('0x8'));var sox=require(_0xa4c8('0x9'));var csv=require(_0xa4c8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4c8('0xb'));var _=require(_0xa4c8('0xc'));var squel=require(_0xa4c8('0xd'));var crypto=require(_0xa4c8('0xe'));var jsforce=require(_0xa4c8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa4c8('0xa'));var querystring=require(_0xa4c8('0x10'));var Papa=require(_0xa4c8('0x11'));var Redis=require(_0xa4c8('0x12'));var authService=require(_0xa4c8('0x13'));var qs=require(_0xa4c8('0x14'));var as=require(_0xa4c8('0x15'));var hardwareService=require(_0xa4c8('0x16'));var logger=require('../../config/logger')(_0xa4c8('0x17'));var utils=require(_0xa4c8('0x18'));var config=require(_0xa4c8('0x19'));var licenseUtil=require(_0xa4c8('0x1a'));var db=require(_0xa4c8('0x1b'))['db'];function respondWithStatusCode(_0x6df97c,_0x45c02f){_0x45c02f=_0x45c02f||0xcc;return function(_0x488137){if(_0x488137){return _0x6df97c[_0xa4c8('0x1c')](_0x45c02f);}return _0x6df97c[_0xa4c8('0x1d')](_0x45c02f)['end']();};}function respondWithResult(_0x371ff0,_0x303861){_0x303861=_0x303861||0xc8;return function(_0xb5dc4c){if(_0xb5dc4c){return _0x371ff0[_0xa4c8('0x1d')](_0x303861)[_0xa4c8('0x1e')](_0xb5dc4c);}};}function respondWithFilteredResult(_0x1e89f2,_0x472c08){return function(_0x21b63b){if(_0x21b63b){var _0x175de5=typeof _0x472c08[_0xa4c8('0x1f')]==='undefined'&&typeof _0x472c08[_0xa4c8('0x20')]==='undefined';var _0x16af4b=_0x21b63b[_0xa4c8('0x21')];var _0x546a25=_0x175de5?0x0:_0x472c08[_0xa4c8('0x1f')];var _0x3780c3=_0x175de5?_0x21b63b[_0xa4c8('0x21')]:_0x472c08[_0xa4c8('0x1f')]+_0x472c08[_0xa4c8('0x20')];var _0xc7a468;if(_0x3780c3>=_0x16af4b){_0x3780c3=_0x16af4b;_0xc7a468=0xc8;}else{_0xc7a468=0xce;}_0x1e89f2[_0xa4c8('0x1d')](_0xc7a468);return _0x1e89f2[_0xa4c8('0x22')](_0xa4c8('0x23'),_0x546a25+'-'+_0x3780c3+'/'+_0x16af4b)['json'](_0x21b63b);}return null;};}function patchUpdates(_0x5db1bd){return function(_0x27bf95){try{jsonpatch[_0xa4c8('0x24')](_0x27bf95,_0x5db1bd,!![]);}catch(_0x105ca9){return BPromise[_0xa4c8('0x25')](_0x105ca9);}return _0x27bf95['save']();};}function saveUpdates(_0x4693a0,_0x54e7d8){return function(_0x24eaca){if(_0x24eaca){return _0x24eaca[_0xa4c8('0x26')](_0x4693a0)[_0xa4c8('0x27')](function(_0x27b279){return _0x27b279;});}return null;};}function removeEntity(_0x12b429,_0x2c6fe9){return function(_0x190707){if(_0x190707){return _0x190707[_0xa4c8('0x28')]()[_0xa4c8('0x27')](function(){_0x12b429[_0xa4c8('0x1d')](0xcc)[_0xa4c8('0x29')]();});}};}function handleEntityNotFound(_0x4ac814,_0x10a4a8){return function(_0x1076a7){if(!_0x1076a7){_0x4ac814[_0xa4c8('0x1c')](0x194);}return _0x1076a7;};}function handleError(_0x37c84b,_0x4f0c7b){_0x4f0c7b=_0x4f0c7b||0x1f4;return function(_0x31165a){logger['error'](_0x31165a[_0xa4c8('0x2a')]);if(_0x31165a[_0xa4c8('0x2b')]){delete _0x31165a['name'];}_0x37c84b[_0xa4c8('0x1d')](_0x4f0c7b)[_0xa4c8('0x2c')](_0x31165a);};}exports['index']=function(_0x51f4c5,_0x1c811b){var _0x7427c2={},_0x330cfd={},_0x3afc61={'count':0x0,'rows':[]};var _0x4cd39e=_[_0xa4c8('0x2d')](db[_0xa4c8('0x2e')][_0xa4c8('0x2f')],function(_0x32b6e7){return{'name':_0x32b6e7[_0xa4c8('0x30')],'type':_0x32b6e7[_0xa4c8('0x31')][_0xa4c8('0x32')]};});_0x330cfd[_0xa4c8('0x33')]=_[_0xa4c8('0x2d')](_0x4cd39e,_0xa4c8('0x2b'));_0x330cfd[_0xa4c8('0x34')]=_[_0xa4c8('0x35')](_0x51f4c5[_0xa4c8('0x34')]);_0x330cfd['filters']=_[_0xa4c8('0x36')](_0x330cfd[_0xa4c8('0x33')],_0x330cfd['query']);_0x7427c2['attributes']=_[_0xa4c8('0x36')](_0x330cfd[_0xa4c8('0x33')],qs[_0xa4c8('0x37')](_0x51f4c5[_0xa4c8('0x34')]['fields']));_0x7427c2[_0xa4c8('0x38')]=_0x7427c2[_0xa4c8('0x38')]['length']?_0x7427c2['attributes']:_0x330cfd[_0xa4c8('0x33')];if(!_0x51f4c5[_0xa4c8('0x34')]['hasOwnProperty'](_0xa4c8('0x39'))){_0x7427c2[_0xa4c8('0x20')]=qs['limit'](_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x20')]);_0x7427c2[_0xa4c8('0x1f')]=qs[_0xa4c8('0x1f')](_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x1f')]);}_0x7427c2['order']=qs[_0xa4c8('0x3a')](_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x3a')]);_0x7427c2[_0xa4c8('0x3b')]=qs[_0xa4c8('0x3c')](_[_0xa4c8('0x3d')](_0x51f4c5['query'],_0x330cfd[_0xa4c8('0x3c')]),_0x4cd39e);if(_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x3e')]){_0x7427c2[_0xa4c8('0x3b')]=_[_0xa4c8('0x3f')](_0x7427c2[_0xa4c8('0x3b')],{'$or':_[_0xa4c8('0x2d')](_0x4cd39e,function(_0x1d44b6){if(_0x1d44b6['type']!==_0xa4c8('0x40')){var _0x4f8132={};_0x4f8132[_0x1d44b6['name']]={'$like':'%'+_0x51f4c5[_0xa4c8('0x34')][_0xa4c8('0x3e')]+'%'};return _0x4f8132;}})});}_0x7427c2=_['merge']({},_0x7427c2,_0x51f4c5[_0xa4c8('0x41')]);var _0x255502={'where':_0x7427c2[_0xa4c8('0x3b')]};return db['WhatsappTransferReport']['count'](_0x255502)[_0xa4c8('0x27')](function(_0x4c32ac){_0x3afc61['count']=_0x4c32ac;if(_0x51f4c5[_0xa4c8('0x34')]['includeAll']){_0x7427c2[_0xa4c8('0x42')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xa4c8('0x43')](_0x7427c2);})[_0xa4c8('0x27')](function(_0x4ba153){_0x3afc61['rows']=_0x4ba153;return _0x3afc61;})[_0xa4c8('0x27')](respondWithFilteredResult(_0x1c811b,_0x7427c2))[_0xa4c8('0x44')](handleError(_0x1c811b,null));};exports[_0xa4c8('0x45')]=function(_0x2ec966,_0x5783f6){var _0x1db8a5={'raw':!![],'where':{'id':_0x2ec966[_0xa4c8('0x46')]['id']}},_0x28c6c6={};_0x28c6c6[_0xa4c8('0x33')]=_['keys'](db[_0xa4c8('0x2e')][_0xa4c8('0x2f')]);_0x28c6c6[_0xa4c8('0x34')]=_[_0xa4c8('0x35')](_0x2ec966[_0xa4c8('0x34')]);_0x28c6c6[_0xa4c8('0x3c')]=_['intersection'](_0x28c6c6['model'],_0x28c6c6[_0xa4c8('0x34')]);_0x1db8a5[_0xa4c8('0x38')]=_['intersection'](_0x28c6c6[_0xa4c8('0x33')],qs['fields'](_0x2ec966[_0xa4c8('0x34')][_0xa4c8('0x37')]));_0x1db8a5[_0xa4c8('0x38')]=_0x1db8a5[_0xa4c8('0x38')]['length']?_0x1db8a5[_0xa4c8('0x38')]:_0x28c6c6[_0xa4c8('0x33')];if(_0x2ec966[_0xa4c8('0x34')][_0xa4c8('0x47')]){_0x1db8a5['include']=[{'all':!![]}];}_0x1db8a5=_[_0xa4c8('0x3f')]({},_0x1db8a5,_0x2ec966[_0xa4c8('0x41')]);return db[_0xa4c8('0x2e')]['find'](_0x1db8a5)['then'](handleEntityNotFound(_0x5783f6,null))[_0xa4c8('0x27')](respondWithResult(_0x5783f6,null))[_0xa4c8('0x44')](handleError(_0x5783f6,null));};exports['create']=function(_0x23f059,_0xcde3e){return db[_0xa4c8('0x2e')][_0xa4c8('0x48')](_0x23f059[_0xa4c8('0x49')],{})[_0xa4c8('0x27')](respondWithResult(_0xcde3e,0xc9))['catch'](handleError(_0xcde3e,null));};exports['update']=function(_0x1f3569,_0x42aa37){if(_0x1f3569[_0xa4c8('0x49')]['id']){delete _0x1f3569['body']['id'];}return db[_0xa4c8('0x2e')]['find']({'where':{'id':_0x1f3569['params']['id']}})[_0xa4c8('0x27')](handleEntityNotFound(_0x42aa37,null))[_0xa4c8('0x27')](saveUpdates(_0x1f3569['body'],null))['then'](respondWithResult(_0x42aa37,null))[_0xa4c8('0x44')](handleError(_0x42aa37,null));};exports[_0xa4c8('0x28')]=function(_0x221a4f,_0x42b020){return db[_0xa4c8('0x2e')][_0xa4c8('0x4a')]({'where':{'id':_0x221a4f[_0xa4c8('0x46')]['id']}})[_0xa4c8('0x27')](handleEntityNotFound(_0x42b020,null))[_0xa4c8('0x27')](removeEntity(_0x42b020,null))[_0xa4c8('0x44')](handleError(_0x42b020,null));};exports[_0xa4c8('0x4b')]=function(_0xca38a0,_0x1a90ad){return db[_0xa4c8('0x2e')]['describe']()[_0xa4c8('0x27')](respondWithResult(_0x1a90ad,null))['catch'](handleError(_0x1a90ad,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3745182..b94529c 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 _0xc2cc=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','lodash','../../config/logger','api','bluebird','path','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xc2cc,0x1b1));var _0xcc2c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc2cc[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xcc2c('0x0'));var util=require('util');var logger=require(_0xcc2c('0x1'))(_0xcc2c('0x2'));var moment=require('moment');var BPromise=require(_0xcc2c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc2c('0x4'));var rimraf=require('rimraf');var config=require(_0xcc2c('0x5'));var attributes=require(_0xcc2c('0x6'));module[_0xcc2c('0x7')]=function(_0xb91e3c,_0x215116){return _0xb91e3c[_0xcc2c('0x8')](_0xcc2c('0x9'),attributes,{'tableName':_0xcc2c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcff=['report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xdcff,0x154));var _0xfdcf=function(_0x255498,_0x777339){_0x255498=_0x255498-0x0;var _0x1951c0=_0xdcff[_0x255498];return _0x1951c0;};'use strict';var _=require(_0xfdcf('0x0'));var util=require('util');var logger=require(_0xfdcf('0x1'))(_0xfdcf('0x2'));var moment=require(_0xfdcf('0x3'));var BPromise=require(_0xfdcf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfdcf('0x5'));var config=require(_0xfdcf('0x6'));var attributes=require(_0xfdcf('0x7'));module[_0xfdcf('0x8')]=function(_0x414681,_0xf658c2){return _0x414681[_0xfdcf('0x9')](_0xfdcf('0xa'),attributes,{'tableName':_0xfdcf('0xb'),'paranoid':![],'indexes':[{'name':_0xfdcf('0xc'),'fields':[_0xfdcf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1a966da..33dbee7 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 _0xfaa8=['message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1eff93,_0x54cce2){var _0x3dd75a=function(_0x191c0f){while(--_0x191c0f){_0x1eff93['push'](_0x1eff93['shift']());}};_0x3dd75a(++_0x54cce2);}(_0xfaa8,0x183));var _0x8faa=function(_0x2ef71a,_0x4b07af){_0x2ef71a=_0x2ef71a-0x0;var _0x579efe=_0xfaa8[_0x2ef71a];return _0x579efe;};'use strict';var _=require(_0x8faa('0x0'));var util=require('util');var moment=require(_0x8faa('0x1'));var BPromise=require(_0x8faa('0x2'));var rs=require(_0x8faa('0x3'));var fs=require('fs');var Redis=require(_0x8faa('0x4'));var db=require(_0x8faa('0x5'))['db'];var utils=require(_0x8faa('0x6'));var logger=require(_0x8faa('0x7'))(_0x8faa('0x8'));var config=require(_0x8faa('0x9'));var jayson=require(_0x8faa('0xa'));var client=jayson[_0x8faa('0xb')][_0x8faa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bfd7a,_0x201bd,_0x345ad9){return new BPromise(function(_0x4f6294,_0x52602f){return client[_0x8faa('0xd')](_0x5bfd7a,_0x345ad9)[_0x8faa('0xe')](function(_0x256071){logger['info'](_0x8faa('0xf'),_0x201bd,_0x8faa('0x10'));logger[_0x8faa('0x11')](_0x8faa('0x12'),_0x201bd,_0x8faa('0x10'),JSON['stringify'](_0x256071));if(_0x256071[_0x8faa('0x13')]){if(_0x256071['error'][_0x8faa('0x14')]===0x1f4){logger[_0x8faa('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x201bd,_0x256071[_0x8faa('0x13')]['message']);return _0x52602f(_0x256071[_0x8faa('0x13')][_0x8faa('0x15')]);}logger[_0x8faa('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x201bd,_0x256071[_0x8faa('0x13')][_0x8faa('0x15')]);return _0x4f6294(_0x256071[_0x8faa('0x13')]['message']);}else{logger[_0x8faa('0x16')](_0x8faa('0xf'),_0x201bd,'request\x20sent');_0x4f6294(_0x256071[_0x8faa('0x17')][_0x8faa('0x15')]);}})['catch'](function(_0x1492bf){logger[_0x8faa('0x13')](_0x8faa('0xf'),_0x201bd,_0x1492bf);_0x52602f(_0x1492bf);});});} \ No newline at end of file +var _0x62d3=['http','request','then','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x406f30,_0x404e0d){var _0x4a5872=function(_0x19e743){while(--_0x19e743){_0x406f30['push'](_0x406f30['shift']());}};_0x4a5872(++_0x404e0d);}(_0x62d3,0x174));var _0x362d=function(_0xd156e0,_0x4d9132){_0xd156e0=_0xd156e0-0x0;var _0x5daa77=_0x62d3[_0xd156e0];return _0x5daa77;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x362d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x362d('0x1'));var db=require(_0x362d('0x2'))['db'];var utils=require(_0x362d('0x3'));var logger=require(_0x362d('0x4'))(_0x362d('0x5'));var config=require('../../config/environment');var jayson=require(_0x362d('0x6'));var client=jayson[_0x362d('0x7')][_0x362d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41e2b5,_0x250b21,_0x557567){return new BPromise(function(_0xb5f59b,_0x1e8e2c){return client[_0x362d('0x9')](_0x41e2b5,_0x557567)[_0x362d('0xa')](function(_0x213964){logger['info'](_0x362d('0xb'),_0x250b21,'request\x20sent');logger[_0x362d('0xc')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x250b21,_0x362d('0xd'),JSON[_0x362d('0xe')](_0x213964));if(_0x213964[_0x362d('0xf')]){if(_0x213964['error']['code']===0x1f4){logger[_0x362d('0xf')](_0x362d('0xb'),_0x250b21,_0x213964[_0x362d('0xf')][_0x362d('0x10')]);return _0x1e8e2c(_0x213964[_0x362d('0xf')][_0x362d('0x10')]);}logger[_0x362d('0xf')](_0x362d('0xb'),_0x250b21,_0x213964['error'][_0x362d('0x10')]);return _0xb5f59b(_0x213964[_0x362d('0xf')][_0x362d('0x10')]);}else{logger[_0x362d('0x11')](_0x362d('0xb'),_0x250b21,_0x362d('0xd'));_0xb5f59b(_0x213964[_0x362d('0x12')][_0x362d('0x10')]);}})['catch'](function(_0x518236){logger[_0x362d('0xf')](_0x362d('0xb'),_0x250b21,_0x518236);_0x1e8e2c(_0x518236);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index c586690..af7f327 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8375=['./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','seedDB','default','listen','then','info','start','filter','exitCode','number','length','map','pm2_env','online','join','Offline\x20apps:','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app'];(function(_0x531125,_0x398535){var _0x529a09=function(_0x3e54b0){while(--_0x3e54b0){_0x531125['push'](_0x531125['shift']());}};_0x529a09(++_0x398535);}(_0x8375,0xa8));var _0x5837=function(_0x4808cd,_0x1522c2){_0x4808cd=_0x4808cd-0x0;var _0x560440=_0x8375[_0x4808cd];return _0x560440;};'use strict';var _=require(_0x5837('0x0'));var db=require(_0x5837('0x1'))['db'];var seedDb=require(_0x5837('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x5837('0x3'));var config=require(_0x5837('0x4'));var logger=require(_0x5837('0x5'))(_0x5837('0x6'));var pm2=require(_0x5837('0x7'));var pm2Config=require(_0x5837('0x8'));var schedule=require('./config/schedule');var chat=require(_0x5837('0x9'));var whatsapp=require(_0x5837('0xa'));var transcribe=require(_0x5837('0xb'));var provider=require(_0x5837('0xc'));function main(){return db[_0x5837('0xd')]['sync']()['then'](function(){if(config[_0x5837('0xe')]){return seedDb[_0x5837('0xf')]();}})['then'](function(){return checkLicense[_0x5837('0xf')]();})['then'](function(){return rpc[_0x5837('0x10')]();})[_0x5837('0x11')](function(_0x11cd29){logger[_0x5837('0x12')](_0x11cd29);return chat[_0x5837('0x13')]();})[_0x5837('0x11')](function(){return whatsapp['start']();})[_0x5837('0x11')](function(){return schedule[_0x5837('0x13')]();})[_0x5837('0x11')](function(){return transcribe[_0x5837('0x13')]();})[_0x5837('0x11')](function(){return provider['start']();})['then'](function(_0x5a23d2){logger[_0x5837('0x12')](_0x5a23d2);return pm2[_0x5837('0x13')](pm2Config);})[_0x5837('0x11')](function(_0xa5718d){var _0x17601e=_0xa5718d[_0x5837('0x14')](function(_0x206f02){return typeof _0x206f02[_0x5837('0x15')]===_0x5837('0x16')&&_0x206f02['exitCode']>=0x0;});if(_0x17601e[_0x5837('0x17')]>0x0){throw new Error(_0x17601e[_0x5837('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x5837('0x18')](_0x17601e,function(_0x2297b4){return'\x22'+_0x2297b4[_0x5837('0x19')]['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0x5837('0x18')](_[_0x5837('0x14')](_0xa5718d,{'status':_0x5837('0x1a')}),'name')[_0x5837('0x1b')]());logger[_0x5837('0x12')](_0x5837('0x1c'),_[_0x5837('0x18')](_['filter'](_0xa5718d,function(_0x4908c2){return _0x4908c2['status']!==_0x5837('0x1a');}),'name')[_0x5837('0x1b')]()||_0x5837('0x1d'));console[_0x5837('0x1e')](_0x5837('0x1f'));})['catch'](function(_0x5aa887){console[_0x5837('0x1e')](_0x5837('0x20'),_0x5aa887);logger[_0x5837('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5aa887);process[_0x5837('0x22')](0x1);});}main(); \ No newline at end of file +var _0xde81=['./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','default','then','listen','info','start','filter','exitCode','length','map','name','online','join','Offline\x20apps:','status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/pm2'];(function(_0x1e2083,_0x596fa0){var _0x20f9c2=function(_0x27053a){while(--_0x27053a){_0x1e2083['push'](_0x1e2083['shift']());}};_0x20f9c2(++_0x596fa0);}(_0xde81,0x109));var _0x1de8=function(_0x4a8d6e,_0x45b402){_0x4a8d6e=_0x4a8d6e-0x0;var _0x4d679b=_0xde81[_0x4a8d6e];return _0x4d679b;};'use strict';var _=require(_0x1de8('0x0'));var db=require(_0x1de8('0x1'))['db'];var seedDb=require(_0x1de8('0x2'));var checkLicense=require(_0x1de8('0x3'));var rpc=require(_0x1de8('0x4'));var config=require(_0x1de8('0x5'));var logger=require('./config/logger')('app');var pm2=require(_0x1de8('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x1de8('0x7'));var chat=require(_0x1de8('0x8'));var whatsapp=require(_0x1de8('0x9'));var transcribe=require(_0x1de8('0xa'));var provider=require(_0x1de8('0xb'));function main(){return db[_0x1de8('0xc')][_0x1de8('0xd')]()['then'](function(){if(config['seedDB']){return seedDb[_0x1de8('0xe')]();}})['then'](function(){return checkLicense[_0x1de8('0xe')]();})[_0x1de8('0xf')](function(){return rpc[_0x1de8('0x10')]();})['then'](function(_0x2c1bb5){logger[_0x1de8('0x11')](_0x2c1bb5);return chat[_0x1de8('0x12')]();})[_0x1de8('0xf')](function(){return whatsapp[_0x1de8('0x12')]();})[_0x1de8('0xf')](function(){return schedule[_0x1de8('0x12')]();})[_0x1de8('0xf')](function(){return transcribe[_0x1de8('0x12')]();})[_0x1de8('0xf')](function(){return provider['start']();})[_0x1de8('0xf')](function(_0x59cfba){logger[_0x1de8('0x11')](_0x59cfba);return pm2[_0x1de8('0x12')](pm2Config);})['then'](function(_0x547627){var _0xd1dc7=_0x547627[_0x1de8('0x13')](function(_0x17f089){return typeof _0x17f089[_0x1de8('0x14')]==='number'&&_0x17f089[_0x1de8('0x14')]>=0x0;});if(_0xd1dc7[_0x1de8('0x15')]>0x0){throw new Error(_0xd1dc7[_0x1de8('0x15')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x1de8('0x16')](_0xd1dc7,function(_0x197595){return'\x22'+_0x197595['pm2_env'][_0x1de8('0x17')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0x1de8('0x16')](_['filter'](_0x547627,{'status':_0x1de8('0x18')}),_0x1de8('0x17'))[_0x1de8('0x19')]());logger['info'](_0x1de8('0x1a'),_[_0x1de8('0x16')](_[_0x1de8('0x13')](_0x547627,function(_0x1e0dcf){return _0x1e0dcf[_0x1de8('0x1b')]!==_0x1de8('0x18');}),_0x1de8('0x17'))[_0x1de8('0x19')]()||'None');console[_0x1de8('0x1c')](_0x1de8('0x1d'));})[_0x1de8('0x1e')](function(_0x387889){console[_0x1de8('0x1c')](_0x1de8('0x1f'),_0x387889);logger[_0x1de8('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x387889);process[_0x1de8('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ead4cfd..3d1cdeb 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 _0xa9e0=['role','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','decryptString','length','unshift','encryptString','promisify','payload','options','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','authenticate','pass','status','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'];(function(_0x346442,_0x38f991){var _0x436e50=function(_0x3f9f47){while(--_0x3f9f47){_0x346442['push'](_0x346442['shift']());}};_0x436e50(++_0x38f991);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var db=require(_0x0a9e('0x0'))['db'];var config=require(_0x0a9e('0x1'));var hardwareConf=require(_0x0a9e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x0a9e('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x0a9e('0x4'));var compose=require(_0x0a9e('0x5'));var basicAuth=require(_0x0a9e('0x6'));var crypto=require(_0x0a9e('0x7'));var BPromise=require(_0x0a9e('0x8'));var util=require('util');var moment=require(_0x0a9e('0x9'));var validateJwt=expressJwt({'secret':config[_0x0a9e('0xa')][_0x0a9e('0xb')]});var userAttributes=['id','role','fullname',_0x0a9e('0xc'),'internal','email',_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),_0x0a9e('0x11'),_0x0a9e('0x12'),'faxPause','smsPause','openchannelPause','pauseType',_0x0a9e('0x13'),_0x0a9e('0x14'),_0x0a9e('0x15'),_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),'alias',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'phoneBarExpires',_0x0a9e('0x1f'),'phoneBarRemoteControl',_0x0a9e('0x20'),'hotdesk',_0x0a9e('0x21'),_0x0a9e('0x22'),'privacyEnabled',_0x0a9e('0x23'),'wssPort',_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28'),_0x0a9e('0x29'),_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x0a9e('0x2c'),_0x0a9e('0x2d'),_0x0a9e('0x2e'),_0x0a9e('0x2f'),'openchannelAutoanswerDelay',_0x0a9e('0x30'),_0x0a9e('0x31'),'whatsappAutoanswer',_0x0a9e('0x32')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x0a9e('0x33')](function(_0x432e56,_0x38e7c4,_0x30bae6){if(_0x432e56['user']){_0x30bae6();}else{return db[_0x0a9e('0x34')][_0x0a9e('0x35')]({'where':{'id':_0x432e56[_0x0a9e('0x36')]['id']},'attributes':['id',_0x0a9e('0x37'),_0x0a9e('0x38')],'raw':!![]})[_0x0a9e('0x39')](function(_0x16b1ca){if(_0x16b1ca&&_0x16b1ca['closed']){return _0x38e7c4['status'](_0x16b1ca[_0x0a9e('0x38')]===_0x0a9e('0x3a')?0x195:0x193)[_0x0a9e('0x3b')]({'message':_0x16b1ca[_0x0a9e('0x38')]==='unmanaged'?_0x0a9e('0x3c'):'Forbidden.'});}else{_0x30bae6();}})[_0x0a9e('0x3d')](function(_0x5bfb33){_0x30bae6(_0x5bfb33);});}});};exports[_0x0a9e('0x3e')]=function isAuthenticated(_0x34dc65){return compose()[_0x0a9e('0x33')](function(_0x14433c,_0x140511,_0x1538a4){var _0x11c3b6;if(_0x14433c[_0x0a9e('0x3f')]['authorization']){if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x42'))){var _0x5c877d=basicAuth(_0x14433c);db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'name':_0x5c877d[_0x0a9e('0xc')]}})[_0x0a9e('0x39')](function(_0x58b06f){if(!_0x58b06f||!_0x58b06f[_0x0a9e('0x45')](_0x5c877d[_0x0a9e('0x46')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Wrong\x20credentials.'});}_0x14433c[_0x0a9e('0x48')]={'id':_0x58b06f['id']};_0x1538a4();})['catch'](function(_0x2407f9){_0x1538a4(_0x2407f9);});}else if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x49'))){validateJwt(_0x14433c,_0x140511,_0x1538a4);}else{if(_0x34dc65){_0x1538a4();}else{return _0x140511['status'](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}}}else if(_0x14433c[_0x0a9e('0x4b')][_0x0a9e('0x4c')]){try{var _0x2b45ea={'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf[_0x0a9e('0x4d')]()};verifyJwt(_0x14433c[_0x0a9e('0x4b')]['apikey'],_0x2b45ea)[_0x0a9e('0x39')](function(_0x5e7238){return db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x5e7238[_0x0a9e('0x4e')]}})[_0x0a9e('0x39')](function(_0x567193){_0x11c3b6=_0x567193;return db[_0x0a9e('0x4f')][_0x0a9e('0x35')]({'where':{'id':0x1},'attributes':[_0x0a9e('0x50'),_0x0a9e('0x51')],'raw':!![]});})['then'](function(_0x54135e){if(!_0x11c3b6||!_[_0x0a9e('0x52')](_0x11c3b6['apiKeyNonce'],_0x5e7238[_0x0a9e('0x53')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x54')});}if(_0x11c3b6['disabled']){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}if(_0x11c3b6['blocked']){if(_0x54135e[_0x0a9e('0x51')]>0x0){if(moment(_0x11c3b6[_0x0a9e('0x56')])[_0x0a9e('0x57')](_0x54135e['blockDuration'],'minutes')>moment()){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}}_0x14433c[_0x0a9e('0x48')]={'id':_0x11c3b6['id']};_0x1538a4();});})['catch'](function(){return _0x140511['status'](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});});}catch(_0x53f3ee){_0x1538a4(_0x53f3ee);}}else if(_0x34dc65){_0x1538a4();}else{return _0x140511[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}})['use'](function(_0x316c8f,_0x2cfea9,_0x274e8e){if(_0x316c8f[_0x0a9e('0x48')]){db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x316c8f[_0x0a9e('0x48')]['id']},'attributes':userAttributes})[_0x0a9e('0x39')](function(_0x23b089){if(!_0x23b089){return _0x2cfea9[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x58')});}_0x316c8f[_0x0a9e('0x48')]=_0x23b089;_0x274e8e();})[_0x0a9e('0x3d')](function(_0x37f6cc){_0x274e8e(_0x37f6cc);});}else if(_0x34dc65){_0x274e8e();}else{return _0x2cfea9['status'](0x194)['json']({'message':_0x0a9e('0x59')});}});};exports[_0x0a9e('0x5a')]=function canUpdate(){return compose()[_0x0a9e('0x33')](function(_0x315881,_0x1a69dd,_0xc9a702){return licenseUtil[_0x0a9e('0x5b')]()[_0x0a9e('0x39')](function(_0x432fcc){if(_0x432fcc[_0x0a9e('0x5c')]){_0xc9a702();}else{return _0x1a69dd[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':'Forbidden'});}})[_0x0a9e('0x3d')](function(_0x138b8b){_0xc9a702(_0x138b8b);});});};exports[_0x0a9e('0x5d')]=function isWebrtcLicence(){return compose()[_0x0a9e('0x33')](function(_0x2e8caf,_0xbe9d19,_0x21eb86){return licenseUtil[_0x0a9e('0x5b')]()['then'](function(_0x2e9d90){if(_0x2e9d90['webrtc']){_0x21eb86();}else{return _0xbe9d19[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x5e')});}})['catch'](function(_0x14bec2){_0x21eb86(_0x14bec2);});});};exports[_0x0a9e('0x5f')]=function(_0x4774f4,_0x34aa5a,_0x45c845){_0x4774f4[_0x0a9e('0x5f')]=!![];return _0x45c845();};exports[_0x0a9e('0x60')]=function signToken(_0x5bbcde){return signJwt(_0x5bbcde);};exports[_0x0a9e('0x61')]=function(_0x1bde3c,_0x1b5e80){if(!_0x1bde3c[_0x0a9e('0x48')]){return _0x1b5e80[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x62')});}var _0x19383e={'payload':{'id':_0x1bde3c[_0x0a9e('0x48')]['id'],'role':_0x1bde3c['user'][_0x0a9e('0x63')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19383e)[_0x0a9e('0x39')](function(_0x4f7240){_0x1b5e80['cookie']('motion.token',_0x4f7240);_0x1b5e80[_0x0a9e('0x64')](_0x0a9e('0x65'));})[_0x0a9e('0x3d')](function(_0x11545a){return _0x1b5e80[_0x0a9e('0x47')](0x1f4)[_0x0a9e('0x66')](_0x11545a);});};exports[_0x0a9e('0x67')]=function(_0x375c18){if(_['isNil'](_0x375c18['apiKeyNonce'])||_['isNil'](_0x375c18[_0x0a9e('0x68')])){return null;}else{return createJwt(_0x375c18);}};exports[_0x0a9e('0x69')]=function(_0x14d602){_0x14d602['apiKeyNonce']=generateNonce();_0x14d602[_0x0a9e('0x68')]=generateIssuedAt();return createJwt(_0x14d602);};exports[_0x0a9e('0x6a')]=function(_0x53d113,_0x5a88da){var _0x2ef381=_0x53d113['query'][_0x0a9e('0x4c')];if(_0x2ef381){var _0x4c3845={'nonce':_0x5a88da[_0x0a9e('0x6b')],'iat':_0x5a88da[_0x0a9e('0x68')],'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2ef381,_0x4c3845)[_0x0a9e('0x39')](function(){return generateApiKey(_0x5a88da);});}else{throw{'message':_0x0a9e('0x6c')};}};exports['validatePasswordPattern']=function(_0x50f687){var _0x128aa6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x128aa6[_0x0a9e('0x6d')](_0x50f687))throw new db['Sequelize'][(_0x0a9e('0x6e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x0a9e('0x6f')]=function(_0x523cd2,_0xe22ccc,_0x4a6deb){var _0x5da27d=encryptor['decryptString'](_0xe22ccc)[_0x0a9e('0x70')](',');for(var _0x47de4c=0x0;_0x47de4c<_0x4a6deb;_0x47de4c++){if(!_0x5da27d[_0x47de4c])break;if(_0x523cd2[_0x0a9e('0x71')]()===_0x5da27d[_0x47de4c][_0x0a9e('0x71')]()){var _0x3cfd00=util[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x4a6deb);if(_0x4a6deb===0x1){_0x3cfd00=_0x0a9e('0x74');}throw new db[(_0x0a9e('0x75'))][(_0x0a9e('0x6e'))](_0x3cfd00);}}return;};exports['updatePasswordsHistory']=function(_0x1c693e,_0x121cef){var _0x2642bb=_0x121cef?encryptor[_0x0a9e('0x76')](_0x121cef)[_0x0a9e('0x70')](','):[];if(_0x2642bb[_0x0a9e('0x77')]===0x5){_0x2642bb['splice'](-0x1,0x1);}_0x2642bb[_0x0a9e('0x78')](_0x1c693e);return encryptor[_0x0a9e('0x79')](_0x2642bb['join'](','));};function signJwt(_0x3649cc){var _0x5cc8fb=BPromise[_0x0a9e('0x7a')](jwt['sign'],{'context':jwt});var _0x4b3c1a=_0x3649cc['secret']||config[_0x0a9e('0xa')]['session'];return new BPromise(function(_0x2244d6,_0x1fc70e){_0x5cc8fb(_0x3649cc[_0x0a9e('0x7b')],_0x4b3c1a,_0x3649cc[_0x0a9e('0x7c')])[_0x0a9e('0x39')](function(_0x26d7db){_0x2244d6(_0x26d7db);})['catch'](function(_0x1627a7){_0x1fc70e(_0x1627a7);});});}function verifyJwt(_0x5854cc,_0xca4ade,_0x1f07cb){var _0x51aaf7=BPromise['promisify'](jwt[_0x0a9e('0x7d')],{'context':jwt});var _0x156f1c=_0x1f07cb||config[_0x0a9e('0xa')][_0x0a9e('0xb')];return new BPromise(function(_0x497d91,_0x1d0dc8){_0x51aaf7(_0x5854cc,_0x156f1c,_0xca4ade)[_0x0a9e('0x39')](function(_0x54327c){_0x497d91(_0x54327c);})[_0x0a9e('0x3d')](function(_0x17e88c){_0x1d0dc8(_0x17e88c);});});}function generateNonce(){return crypto[_0x0a9e('0x7e')](0x10)[_0x0a9e('0x7f')](_0x0a9e('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0x0a9e('0x81')]()/0x3e8)[_0x0a9e('0x7f')]();}function createJwt(_0x281c7d){var _0x47bb43={'payload':{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x281c7d['id'][_0x0a9e('0x7f')](),'issuer':hardwareConf[_0x0a9e('0x4d')](),'audience':hardwareConf[_0x0a9e('0x4d')]()}};return signJwt(_0x47bb43)[_0x0a9e('0x39')](function(_0x186f39){return{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d[_0x0a9e('0x6b')],'token':_0x186f39};});} \ No newline at end of file +var _0x9bde=['whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','User','find','authenticate','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4ffe16,_0x173c4e){_0x4ffe16=_0x4ffe16-0x0;var _0x46f78b=_0x9bde[_0x4ffe16];return _0x46f78b;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xe9bd('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xe9bd('0x1'));var encryptor=require('../encryptor');var _=require(_0xe9bd('0x2'));var jwt=require(_0xe9bd('0x3'));var expressJwt=require(_0xe9bd('0x4'));var compose=require(_0xe9bd('0x5'));var basicAuth=require(_0xe9bd('0x6'));var crypto=require(_0xe9bd('0x7'));var BPromise=require(_0xe9bd('0x8'));var util=require('util');var moment=require(_0xe9bd('0x9'));var validateJwt=expressJwt({'secret':config[_0xe9bd('0xa')][_0xe9bd('0xb')]});var userAttributes=['id',_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf'),_0xe9bd('0x10'),_0xe9bd('0x11'),_0xe9bd('0x12'),'md5secret','voicePause',_0xe9bd('0x13'),_0xe9bd('0x14'),_0xe9bd('0x15'),'smsPause',_0xe9bd('0x16'),_0xe9bd('0x17'),_0xe9bd('0x18'),_0xe9bd('0x19'),'lastPauseAt',_0xe9bd('0x1a'),'allowmessenger',_0xe9bd('0x1b'),_0xe9bd('0x1c'),_0xe9bd('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xe9bd('0x1e'),_0xe9bd('0x1f'),_0xe9bd('0x20'),_0xe9bd('0x21'),_0xe9bd('0x22'),_0xe9bd('0x23'),_0xe9bd('0x24'),'hotdesk',_0xe9bd('0x25'),_0xe9bd('0x26'),_0xe9bd('0x27'),'settingsEnabled',_0xe9bd('0x28'),_0xe9bd('0x29'),_0xe9bd('0x2a'),_0xe9bd('0x2b'),'ignorePauseForPreviewCalls',_0xe9bd('0x2c'),'chatAutoanswer',_0xe9bd('0x2d'),'emailAutoanswer',_0xe9bd('0x2e'),_0xe9bd('0x2f'),_0xe9bd('0x30'),_0xe9bd('0x31'),_0xe9bd('0x32'),_0xe9bd('0x33'),_0xe9bd('0x34'),'whatsappAutoanswer',_0xe9bd('0x35')];exports[_0xe9bd('0x36')]=function(){return this['isAuthenticated'](!![])[_0xe9bd('0x37')](function(_0x505c23,_0x238ab1,_0x1b9cc9){if(_0x505c23[_0xe9bd('0x38')]){_0x1b9cc9();}else{return db[_0xe9bd('0x39')]['findOne']({'where':{'id':_0x505c23[_0xe9bd('0x3a')]['id']},'attributes':['id',_0xe9bd('0x3b'),_0xe9bd('0x3c')],'raw':!![]})[_0xe9bd('0x3d')](function(_0x2641be){if(_0x2641be&&_0x2641be[_0xe9bd('0x3b')]){return _0x238ab1[_0xe9bd('0x3e')](_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?0x195:0x193)['json']({'message':_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?'Unmanaged.':_0xe9bd('0x40')});}else{_0x1b9cc9();}})[_0xe9bd('0x41')](function(_0x119672){_0x1b9cc9(_0x119672);});}});};exports[_0xe9bd('0x42')]=function isAuthenticated(_0x141b95){return compose()[_0xe9bd('0x37')](function(_0x519f48,_0x5b7f1d,_0x1de54c){var _0x56e409;if(_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')]){if(_[_0xe9bd('0x45')](_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')],'Basic')){var _0x4b7bc2=basicAuth(_0x519f48);db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'name':_0x4b7bc2[_0xe9bd('0xe')]}})[_0xe9bd('0x3d')](function(_0xe2436){if(!_0xe2436||!_0xe2436[_0xe9bd('0x48')](_0x4b7bc2[_0xe9bd('0x49')])){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':'Wrong\x20credentials.'});}_0x519f48[_0xe9bd('0x38')]={'id':_0xe2436['id']};_0x1de54c();})[_0xe9bd('0x41')](function(_0x390a43){_0x1de54c(_0x390a43);});}else if(_['startsWith'](_0x519f48['headers'][_0xe9bd('0x44')],_0xe9bd('0x4b'))){validateJwt(_0x519f48,_0x5b7f1d,_0x1de54c);}else{if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}}}else if(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')]){try{var _0x1c6173={'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};verifyJwt(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')],_0x1c6173)[_0xe9bd('0x3d')](function(_0x199477){return db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'id':_0x199477[_0xe9bd('0x50')]}})[_0xe9bd('0x3d')](function(_0x4c689d){_0x56e409=_0x4c689d;return db[_0xe9bd('0x51')][_0xe9bd('0x52')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe9bd('0x53')],'raw':!![]});})[_0xe9bd('0x3d')](function(_0x4c7d47){if(!_0x56e409||!_['isEqual'](_0x56e409[_0xe9bd('0x54')],_0x199477[_0xe9bd('0x55')])){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x56')});}if(_0x56e409[_0xe9bd('0x57')]){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56e409[_0xe9bd('0x58')]){if(_0x4c7d47[_0xe9bd('0x53')]>0x0){if(moment(_0x56e409[_0xe9bd('0x59')])[_0xe9bd('0x5a')](_0x4c7d47['blockDuration'],_0xe9bd('0x5b'))>moment()){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}_0x519f48[_0xe9bd('0x38')]={'id':_0x56e409['id']};_0x1de54c();});})[_0xe9bd('0x41')](function(){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xcf9a0c){_0x1de54c(_0xcf9a0c);}}else if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d['status'](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}})[_0xe9bd('0x37')](function(_0x480797,_0x1ba613,_0x2923cf){if(_0x480797[_0xe9bd('0x38')]){db['User'][_0xe9bd('0x47')]({'where':{'id':_0x480797[_0xe9bd('0x38')]['id']},'attributes':userAttributes})[_0xe9bd('0x3d')](function(_0x388132){if(!_0x388132){return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5d')});}_0x480797[_0xe9bd('0x38')]=_0x388132;_0x2923cf();})[_0xe9bd('0x41')](function(_0x300e07){_0x2923cf(_0x300e07);});}else if(_0x141b95){_0x2923cf();}else{return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5e')});}});};exports[_0xe9bd('0x5f')]=function canUpdate(){return compose()[_0xe9bd('0x37')](function(_0x5b70d3,_0x5a86fd,_0x283e67){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x58828b){if(_0x58828b['update']){_0x283e67();}else{return _0x5a86fd[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0x39fb61){_0x283e67(_0x39fb61);});});};exports[_0xe9bd('0x62')]=function isWebrtcLicence(){return compose()[_0xe9bd('0x37')](function(_0x512899,_0x1e45fc,_0x4cc146){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x33ba69){if(_0x33ba69[_0xe9bd('0x63')]){_0x4cc146();}else{return _0x1e45fc[_0xe9bd('0x3e')](0x193)['json']({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0xe14fa4){_0x4cc146(_0xe14fa4);});});};exports['isMiddleware']=function(_0xff4e14,_0x476f23,_0x34f787){_0xff4e14['isMiddleware']=!![];return _0x34f787();};exports[_0xe9bd('0x64')]=function signToken(_0x27e7b0){return signJwt(_0x27e7b0);};exports[_0xe9bd('0x65')]=function(_0x10ec29,_0x1ee09c){if(!_0x10ec29['user']){return _0x1ee09c[_0xe9bd('0x3e')](0x194)['json']({'message':_0xe9bd('0x66')});}var _0x239be9={'payload':{'id':_0x10ec29[_0xe9bd('0x38')]['id'],'role':_0x10ec29[_0xe9bd('0x38')][_0xe9bd('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x239be9)['then'](function(_0x15d1d0){_0x1ee09c['cookie'](_0xe9bd('0x67'),_0x15d1d0);_0x1ee09c[_0xe9bd('0x68')]('/dashboards/general');})['catch'](function(_0x1ce539){return _0x1ee09c['status'](0x1f4)[_0xe9bd('0x69')](_0x1ce539);});};exports['retrieveApiKey']=function(_0x26b25a){if(_[_0xe9bd('0x6a')](_0x26b25a['apiKeyNonce'])||_[_0xe9bd('0x6a')](_0x26b25a['apiKeyIat'])){return null;}else{return createJwt(_0x26b25a);}};exports[_0xe9bd('0x6b')]=function(_0x2d9a94){_0x2d9a94[_0xe9bd('0x54')]=generateNonce();_0x2d9a94['apiKeyIat']=generateIssuedAt();return createJwt(_0x2d9a94);};exports[_0xe9bd('0x6c')]=function(_0x1d703f,_0x45b69e){var _0x232a36=_0x1d703f['query']['apikey'];if(_0x232a36){var _0x441f89={'nonce':_0x45b69e['apiKeyNonce'],'iat':_0x45b69e[_0xe9bd('0x6d')],'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};return verifyJwt(_0x232a36,_0x441f89)[_0xe9bd('0x3d')](function(){return generateApiKey(_0x45b69e);});}else{throw{'message':_0xe9bd('0x6e')};}};exports[_0xe9bd('0x6f')]=function(_0x373057){var _0x3381ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3381ee[_0xe9bd('0x70')](_0x373057))throw new db[(_0xe9bd('0x71'))][(_0xe9bd('0x72'))](_0xe9bd('0x73'));return;};exports['validatePasswordHistory']=function(_0x596a7d,_0x566dd8,_0x10e685){var _0x5a516e=encryptor[_0xe9bd('0x74')](_0x566dd8)[_0xe9bd('0x75')](',');for(var _0x90db01=0x0;_0x90db01<_0x10e685;_0x90db01++){if(!_0x5a516e[_0x90db01])break;if(_0x596a7d[_0xe9bd('0x76')]()===_0x5a516e[_0x90db01][_0xe9bd('0x76')]()){var _0xaf6ffd=util[_0xe9bd('0x77')](_0xe9bd('0x78'),_0x10e685);if(_0x10e685===0x1){_0xaf6ffd=_0xe9bd('0x79');}throw new db['Sequelize'][(_0xe9bd('0x72'))](_0xaf6ffd);}}return;};exports[_0xe9bd('0x7a')]=function(_0x3d3e74,_0x3f848d){var _0x4d58c1=_0x3f848d?encryptor[_0xe9bd('0x74')](_0x3f848d)[_0xe9bd('0x75')](','):[];if(_0x4d58c1[_0xe9bd('0x7b')]===0x5){_0x4d58c1['splice'](-0x1,0x1);}_0x4d58c1[_0xe9bd('0x7c')](_0x3d3e74);return encryptor[_0xe9bd('0x7d')](_0x4d58c1[_0xe9bd('0x7e')](','));};function signJwt(_0xfe82f7){var _0x4ee26a=BPromise['promisify'](jwt[_0xe9bd('0x7f')],{'context':jwt});var _0x188891=_0xfe82f7[_0xe9bd('0x80')]||config[_0xe9bd('0xa')]['session'];return new BPromise(function(_0x49add9,_0x305efa){_0x4ee26a(_0xfe82f7[_0xe9bd('0x81')],_0x188891,_0xfe82f7[_0xe9bd('0x82')])[_0xe9bd('0x3d')](function(_0x1fd2b5){_0x49add9(_0x1fd2b5);})[_0xe9bd('0x41')](function(_0x4870f8){_0x305efa(_0x4870f8);});});}function verifyJwt(_0x179c8d,_0x5681ab,_0x27e07c){var _0x28dd03=BPromise[_0xe9bd('0x83')](jwt[_0xe9bd('0x84')],{'context':jwt});var _0x5bc1f8=_0x27e07c||config[_0xe9bd('0xa')][_0xe9bd('0xb')];return new BPromise(function(_0x3b0190,_0x4f35c4){_0x28dd03(_0x179c8d,_0x5bc1f8,_0x5681ab)[_0xe9bd('0x3d')](function(_0x1a9d0c){_0x3b0190(_0x1a9d0c);})[_0xe9bd('0x41')](function(_0x3e3e05){_0x4f35c4(_0x3e3e05);});});}function generateNonce(){return crypto[_0xe9bd('0x85')](0x10)[_0xe9bd('0x86')](_0xe9bd('0x87'));}function generateIssuedAt(){return Math[_0xe9bd('0x88')](Date[_0xe9bd('0x89')]()/0x3e8)[_0xe9bd('0x86')]();}function createJwt(_0x14c599){var _0x37d07a={'payload':{'iat':_0x14c599['apiKeyIat'],'nonce':_0x14c599[_0xe9bd('0x54')]},'options':{'algorithm':_0xe9bd('0x8a'),'subject':_0x14c599['id']['toString'](),'issuer':hardwareConf[_0xe9bd('0x4f')](),'audience':hardwareConf[_0xe9bd('0x4f')]()}};return signJwt(_0x37d07a)['then'](function(_0x561165){return{'iat':_0x14c599[_0xe9bd('0x6d')],'nonce':_0x14c599[_0xe9bd('0x54')],'token':_0x561165};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 42e7518..1a7c481 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 _0x2abb=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','write','end','final','binary','unlink','createReadStream','createWriteStream','createDecipher','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error'];(function(_0x25f743,_0x765664){var _0x2ba165=function(_0xf13c61){while(--_0xf13c61){_0x25f743['push'](_0x25f743['shift']());}};_0x2ba165(++_0x765664);}(_0x2abb,0x7e));var _0xb2ab=function(_0x1f0159,_0x1939a9){_0x1f0159=_0x1f0159-0x0;var _0x3e145f=_0x2abb[_0x1f0159];return _0x3e145f;};'use strict';var crypto=require(_0xb2ab('0x0'));var fs=require('fs');var BPromise=require(_0xb2ab('0x1'));var _=require(_0xb2ab('0x2'));var config=require(_0xb2ab('0x3'));var logger=require(_0xb2ab('0x4'))(_0xb2ab('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb2ab('0x6')][_0xb2ab('0x7')],'algorithm':_0xb2ab('0x8')};const fileOptions={'algorithm':_0xb2ab('0x9')};if(config[_0xb2ab('0xa')]&&config[_0xb2ab('0xa')][_0xb2ab('0xb')]){var isSupported=isAlgorithmSupported(config[_0xb2ab('0xa')][_0xb2ab('0xb')]);if(isSupported){fileOptions[_0xb2ab('0xb')]=config[_0xb2ab('0xa')][_0xb2ab('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb2ab('0xc')](',\x20');logger[_0xb2ab('0xd')](config[_0xb2ab('0xa')][_0xb2ab('0xb')],_0xb2ab('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x8d4530){return AES_SUPPORTED_RX[_0xb2ab('0xf')](_0x8d4530);}function getSupportedCiphers(){return crypto[_0xb2ab('0x10')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x2a606b){return getSupportedCiphers()[_0xb2ab('0x11')](_0x2a606b)>-0x1;}function combineOptions(_0x510e35){var _0x1c6845={};for(var _0x16fde7 in fileOptions){if(fileOptions[_0xb2ab('0x12')](_0x16fde7)){_0x1c6845[_0x16fde7]=fileOptions[_0x16fde7];}}if(_0x510e35){for(var _0x14f13c in _0x510e35){if(_0x510e35[_0xb2ab('0x12')](_0x14f13c)){_0x1c6845[_0x14f13c]=_0x510e35[_0x14f13c];}}}return _0x1c6845;}exports[_0xb2ab('0x13')]=function(_0x95fb07,_0x1ebeaa,_0x308ee9,_0x38adfc){return new BPromise(function(_0x312784,_0xaebb08){_0x38adfc=combineOptions(_0x38adfc);var _0x5bb070=new Buffer(_0x308ee9);var _0x539dfd=fs['createReadStream'](_0x95fb07);var _0x9224ca=fs['createWriteStream'](_0x1ebeaa);var _0x2756a4=crypto[_0xb2ab('0x14')](_0x38adfc[_0xb2ab('0xb')],_0x5bb070);_0x539dfd['on'](_0xb2ab('0x15'),function(_0x1a1f84){var _0x3432ed=new Buffer(_0x2756a4[_0xb2ab('0x16')](_0x1a1f84),'binary');_0x9224ca[_0xb2ab('0x17')](_0x3432ed);});_0x539dfd['on'](_0xb2ab('0x18'),function(){try{var _0x41b200=new Buffer(_0x2756a4[_0xb2ab('0x19')](_0xb2ab('0x1a')),'binary');_0x9224ca[_0xb2ab('0x17')](_0x41b200);_0x9224ca[_0xb2ab('0x18')]();_0x9224ca['on']('close',function(){return _0x312784(_0x1ebeaa);});}catch(_0x435606){fs[_0xb2ab('0x1b')](_0x1ebeaa);return _0xaebb08(_0x435606);}});});};exports['decryptFile']=function(_0x1e8df8,_0x149417,_0x28d3a1,_0x1fe137){return new BPromise(function(_0x33e6be,_0x479cd7){_0x1fe137=combineOptions(_0x1fe137);var _0x277e37=new Buffer(_0x28d3a1);var _0x293281=fs[_0xb2ab('0x1c')](_0x1e8df8);var _0x47eb9e=fs[_0xb2ab('0x1d')](_0x149417);var _0x2c0241=crypto[_0xb2ab('0x1e')](_0x1fe137[_0xb2ab('0xb')],_0x277e37);_0x293281['on'](_0xb2ab('0x15'),function(_0x5d1c6f){var _0x2905f1=new Buffer(_0x2c0241[_0xb2ab('0x16')](_0x5d1c6f),_0xb2ab('0x1a'));_0x47eb9e[_0xb2ab('0x17')](_0x2905f1);});_0x293281['on'](_0xb2ab('0x18'),function(){try{var _0x2ee6d6=new Buffer(_0x2c0241['final']('binary'),_0xb2ab('0x1a'));_0x47eb9e['write'](_0x2ee6d6);_0x47eb9e[_0xb2ab('0x18')]();_0x47eb9e['on']('close',function(){return _0x33e6be(_0x149417);});}catch(_0x5aac88){fs[_0xb2ab('0x1b')](_0x149417);return _0x479cd7(_0x5aac88);}});});};exports['encryptString']=function(_0x4d5474,_0x24a69a,_0x187c83){var _0x1f95d6=_0x187c83||stringOptions['algorithm'];var _0x453ea1=_0x24a69a||stringOptions[_0xb2ab('0x1f')];var _0x3e2262=crypto['createCipher'](_0x1f95d6,_0x453ea1);var _0xe32594=_0x3e2262['update'](_0x4d5474,_0xb2ab('0x20'),_0xb2ab('0x21'));_0xe32594+=_0x3e2262['final'](_0xb2ab('0x21'));return _0xe32594;};exports[_0xb2ab('0x22')]=function(_0x571ee8,_0x5baeb1,_0x47848b){var _0x43d187=_0x47848b||stringOptions[_0xb2ab('0xb')];var _0x3b37ab=_0x5baeb1||stringOptions['secret'];var _0x519139=crypto['createDecipher'](_0x43d187,_0x3b37ab);var _0x4c2c0c=_0x519139[_0xb2ab('0x16')](_0x571ee8,_0xb2ab('0x21'),_0xb2ab('0x20'));_0x4c2c0c+=_0x519139[_0xb2ab('0x19')](_0xb2ab('0x20'));return _0x4c2c0c;}; \ No newline at end of file +var _0x7fcb=['data','final','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','hasOwnProperty','createReadStream','createCipher','update','binary','write','end','close','unlink','decryptFile','createWriteStream','createDecipher'];(function(_0x409972,_0x39bcde){var _0x5d9dfd=function(_0x4499c0){while(--_0x4499c0){_0x409972['push'](_0x409972['shift']());}};_0x5d9dfd(++_0x39bcde);}(_0x7fcb,0x17d));var _0xb7fc=function(_0x2fb534,_0x1d88a3){_0x2fb534=_0x2fb534-0x0;var _0x391369=_0x7fcb[_0x2fb534];return _0x391369;};'use strict';var crypto=require(_0xb7fc('0x0'));var fs=require('fs');var BPromise=require(_0xb7fc('0x1'));var _=require(_0xb7fc('0x2'));var config=require('../../config/environment');var logger=require(_0xb7fc('0x3'))(_0xb7fc('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xb7fc('0x5')],'algorithm':_0xb7fc('0x6')};const fileOptions={'algorithm':_0xb7fc('0x7')};if(config[_0xb7fc('0x8')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0xb7fc('0x8')][_0xb7fc('0x9')]);if(isSupported){fileOptions[_0xb7fc('0x9')]=config[_0xb7fc('0x8')][_0xb7fc('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb7fc('0xa')](',\x20');logger[_0xb7fc('0xb')](config[_0xb7fc('0x8')][_0xb7fc('0x9')],_0xb7fc('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x195978){return AES_SUPPORTED_RX['test'](_0x195978);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xb7fc('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x24e255){return getSupportedCiphers()[_0xb7fc('0xe')](_0x24e255)>-0x1;}function combineOptions(_0x4cdf34){var _0x5958db={};for(var _0x58c94b in fileOptions){if(fileOptions[_0xb7fc('0xf')](_0x58c94b)){_0x5958db[_0x58c94b]=fileOptions[_0x58c94b];}}if(_0x4cdf34){for(var _0x2593f5 in _0x4cdf34){if(_0x4cdf34[_0xb7fc('0xf')](_0x2593f5)){_0x5958db[_0x2593f5]=_0x4cdf34[_0x2593f5];}}}return _0x5958db;}exports['encryptFile']=function(_0x244c51,_0x212e4b,_0x22f123,_0xa757d5){return new BPromise(function(_0x33a42c,_0x36a1da){_0xa757d5=combineOptions(_0xa757d5);var _0x475f61=new Buffer(_0x22f123);var _0x87b276=fs[_0xb7fc('0x10')](_0x244c51);var _0x3bd6c3=fs['createWriteStream'](_0x212e4b);var _0x51979e=crypto[_0xb7fc('0x11')](_0xa757d5[_0xb7fc('0x9')],_0x475f61);_0x87b276['on']('data',function(_0x53b5f2){var _0x136f4e=new Buffer(_0x51979e[_0xb7fc('0x12')](_0x53b5f2),_0xb7fc('0x13'));_0x3bd6c3[_0xb7fc('0x14')](_0x136f4e);});_0x87b276['on'](_0xb7fc('0x15'),function(){try{var _0x18b921=new Buffer(_0x51979e['final'](_0xb7fc('0x13')),'binary');_0x3bd6c3[_0xb7fc('0x14')](_0x18b921);_0x3bd6c3[_0xb7fc('0x15')]();_0x3bd6c3['on'](_0xb7fc('0x16'),function(){return _0x33a42c(_0x212e4b);});}catch(_0x31eb8f){fs[_0xb7fc('0x17')](_0x212e4b);return _0x36a1da(_0x31eb8f);}});});};exports[_0xb7fc('0x18')]=function(_0x3561a5,_0x543acb,_0x4e0a92,_0x5cb4c6){return new BPromise(function(_0x531b72,_0x4f882a){_0x5cb4c6=combineOptions(_0x5cb4c6);var _0x573875=new Buffer(_0x4e0a92);var _0xa4424=fs[_0xb7fc('0x10')](_0x3561a5);var _0x517cbb=fs[_0xb7fc('0x19')](_0x543acb);var _0x3a0ef6=crypto[_0xb7fc('0x1a')](_0x5cb4c6[_0xb7fc('0x9')],_0x573875);_0xa4424['on'](_0xb7fc('0x1b'),function(_0x3b8e95){var _0x365353=new Buffer(_0x3a0ef6[_0xb7fc('0x12')](_0x3b8e95),_0xb7fc('0x13'));_0x517cbb[_0xb7fc('0x14')](_0x365353);});_0xa4424['on'](_0xb7fc('0x15'),function(){try{var _0x2f8729=new Buffer(_0x3a0ef6[_0xb7fc('0x1c')](_0xb7fc('0x13')),'binary');_0x517cbb[_0xb7fc('0x14')](_0x2f8729);_0x517cbb[_0xb7fc('0x15')]();_0x517cbb['on'](_0xb7fc('0x16'),function(){return _0x531b72(_0x543acb);});}catch(_0x4f647d){fs[_0xb7fc('0x17')](_0x543acb);return _0x4f882a(_0x4f647d);}});});};exports[_0xb7fc('0x1d')]=function(_0x28a68f,_0x31f7a5,_0x7795ff){var _0x197d73=_0x7795ff||stringOptions[_0xb7fc('0x9')];var _0xf8e162=_0x31f7a5||stringOptions[_0xb7fc('0x1e')];var _0x3ac1ce=crypto[_0xb7fc('0x11')](_0x197d73,_0xf8e162);var _0x4e955c=_0x3ac1ce['update'](_0x28a68f,_0xb7fc('0x1f'),_0xb7fc('0x20'));_0x4e955c+=_0x3ac1ce[_0xb7fc('0x1c')](_0xb7fc('0x20'));return _0x4e955c;};exports[_0xb7fc('0x21')]=function(_0x2bd2b1,_0x4a4aa8,_0x4bfc72){var _0x494bc9=_0x4bfc72||stringOptions['algorithm'];var _0x57f796=_0x4a4aa8||stringOptions[_0xb7fc('0x1e')];var _0x51915c=crypto['createDecipher'](_0x494bc9,_0x57f796);var _0x5e1ba9=_0x51915c[_0xb7fc('0x12')](_0x2bd2b1,_0xb7fc('0x20'),_0xb7fc('0x1f'));_0x5e1ba9+=_0x51915c['final'](_0xb7fc('0x1f'));return _0x5e1ba9;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 38553ce..472ed11 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 _0xb2b5=['then','join','%s%d.%s','%s.%s','csv','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','range','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync'];(function(_0x3f7796,_0x4f003b){var _0x3a4c76=function(_0x4246fc){while(--_0x4246fc){_0x3f7796['push'](_0x3f7796['shift']());}};_0x3a4c76(++_0x4f003b);}(_0xb2b5,0xa4));var _0x5b2b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xb2b5[_0x32f7d7];return _0x133d09;};'use strict';var util=require('util');var path=require(_0x5b2b('0x0'));var _=require(_0x5b2b('0x1'));var csv=require(_0x5b2b('0x2'));var fs=require('fs');var BPromise=require(_0x5b2b('0x3'));var zipdir=require(_0x5b2b('0x4'));var rimraf=require(_0x5b2b('0x5'));var db=require(_0x5b2b('0x6'))['db'];var dbH=require(_0x5b2b('0x6'))[_0x5b2b('0x7')];var logger=require('../../config/logger')(_0x5b2b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5b2b('0x9')][0x2]);var QUERY=process[_0x5b2b('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x32d2e6,_0xb74c42){var _0x1c0dab={'status':_0x32d2e6};var _0x322f14={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb74c42){_0x1c0dab[_0x5b2b('0xa')]=_0xb74c42;}return db['AnalyticExtractedReport'][_0x5b2b('0xb')](_0x1c0dab,_0x322f14);}function main(){var _0x2a823b=0x1388;var _0x4e56f4;logger['info'](util[_0x5b2b('0xc')](_0x5b2b('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x5b2b('0xe')][_0x5b2b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5b2b('0x10'),_0x5b2b('0x11')]})['then'](function(_0x1cee5c){if(_0x1cee5c){_0x4e56f4=_0x1cee5c;_0x2a823b=_0x4e56f4['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x5b2b('0x12')][_0x5b2b('0x13')](util[_0x5b2b('0xc')](_0x5b2b('0x14'),QUERY),{'type':dbH[_0x5b2b('0x12')][_0x5b2b('0x15')][_0x5b2b('0x16')]});})['then'](function(_0x5afb45){if(!_0x5afb45[0x0]['num']){return analyticExtractedReport('Empty');}var _0x20a306=[];var _0x327390=0x0;if(_0x4e56f4['split']){if(_0x5afb45&&_0x5afb45[_0x5b2b('0x17')]){var _0x56d207=_[_0x5b2b('0x18')](_0x5afb45[0x0]['num']/_0x2a823b);var _0x344162=Number['isInteger'](_0x5afb45[0x0]['num']/_0x2a823b)?_0x5afb45[0x0][_0x5b2b('0x19')]%_0x2a823b:0x0;_0x56d207['forEach'](function(_0x1a4a0f){if(_0x1a4a0f>0x0){_0x327390+=_0x2a823b;}_0x20a306[_0x5b2b('0x1a')](dbH[_0x5b2b('0x12')][_0x5b2b('0x13')](util[_0x5b2b('0xc')](_0x5b2b('0x1b'),QUERY,_0x2a823b,_0x327390),{'type':dbH[_0x5b2b('0x12')][_0x5b2b('0x15')][_0x5b2b('0x16')]}));});if(_0x344162>0x0){_0x327390+=_0x2a823b;_0x20a306[_0x5b2b('0x1a')](dbH[_0x5b2b('0x12')][_0x5b2b('0x13')](util['format'](_0x5b2b('0x1b'),QUERY,_0x344162,_0x327390),{'type':dbH[_0x5b2b('0x12')][_0x5b2b('0x15')][_0x5b2b('0x16')]}));}}}else{_0x20a306[_0x5b2b('0x1a')](dbH[_0x5b2b('0x12')][_0x5b2b('0x13')](QUERY,{'type':dbH[_0x5b2b('0x12')][_0x5b2b('0x15')][_0x5b2b('0x16')]}));}var _0x327915=path[_0x5b2b('0x1c')](PATH);var _0x303681=path['basename'](PATH,_0x5b2b('0x1d'));var _0x239922=_0x4e56f4[_0x5b2b('0x10')]&&_0x20a306[_0x5b2b('0x17')]>0x1;var _0x50c186=[];if(!fs[_0x5b2b('0x1e')](path['join'](_0x327915,_0x303681))&&_0x239922){fs[_0x5b2b('0x1f')](path['join'](_0x327915,_0x303681));}return BPromise['each'](_0x20a306,function(_0x21524){_0x50c186[_0x5b2b('0x1a')](_0x21524);})[_0x5b2b('0x20')](function(){for(var _0x3996ba=0x0;_0x3996ba<_0x50c186['length'];_0x3996ba+=0x1){var _0x61a95c;var _0x3851ad=_0x50c186[_0x3996ba];if(_0x239922){_0x61a95c=path[_0x5b2b('0x21')](_0x327915,_0x303681,util[_0x5b2b('0xc')](_0x5b2b('0x22'),_0x303681,_0x3996ba,'csv'));}else{_0x61a95c=path['join'](_0x327915,util[_0x5b2b('0xc')](_0x5b2b('0x23'),_0x303681,_0x5b2b('0x24')));}fs[_0x5b2b('0x25')](_0x61a95c,csv(_0x3851ad));}})['then'](function(){if(_0x239922){return new Promise(function(_0x369836){zipdir(path[_0x5b2b('0x21')](_0x327915,_0x303681),{'saveTo':path[_0x5b2b('0x21')](_0x327915,util[_0x5b2b('0xc')](_0x5b2b('0x23'),_0x303681,_0x5b2b('0x26')))},function(_0x2d49a7,_0x1aeabc){rimraf(path[_0x5b2b('0x21')](_0x327915,_0x303681),function(){});_0x369836('zip\x20finished');});});}})[_0x5b2b('0x20')](function(){logger[_0x5b2b('0x27')](util[_0x5b2b('0xc')](_0x5b2b('0x28'),EXTRACTED_REPORT_ID,_0x5b2b('0x29')));return analyticExtractedReport(_0x5b2b('0x2a'),_0x239922?util[_0x5b2b('0xc')](_0x5b2b('0x23'),_0x303681,_0x239922?_0x5b2b('0x26'):_0x5b2b('0x24')):null);});})[_0x5b2b('0x2b')](function(_0x4410a8){logger[_0x5b2b('0x27')](util[_0x5b2b('0xc')](_0x5b2b('0x2c'),EXTRACTED_REPORT_ID,_0x5b2b('0x29')),util[_0x5b2b('0x2d')](_0x4410a8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5b2b('0x2e'));})[_0x5b2b('0x2f')](function(){process[_0x5b2b('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xbf06=['QueryTypes','SELECT','length','isInteger','num','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize'];(function(_0x25777c,_0x45ec48){var _0x2afe3=function(_0x17bf07){while(--_0x17bf07){_0x25777c['push'](_0x25777c['shift']());}};_0x2afe3(++_0x45ec48);}(_0xbf06,0xa7));var _0x6bf0=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xbf06[_0xf50820];return _0x2a9b10;};'use strict';var util=require('util');var path=require(_0x6bf0('0x0'));var _=require(_0x6bf0('0x1'));var csv=require(_0x6bf0('0x2'));var fs=require('fs');var BPromise=require(_0x6bf0('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x6bf0('0x4'));var db=require(_0x6bf0('0x5'))['db'];var dbH=require(_0x6bf0('0x5'))[_0x6bf0('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6bf0('0x7')][0x2]);var QUERY=process[_0x6bf0('0x7')][0x3];var PATH=process[_0x6bf0('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x38d159,_0x29251f){var _0x39fc51={'status':_0x38d159};var _0x1f801e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x29251f){_0x39fc51[_0x6bf0('0x8')]=_0x29251f;}return db[_0x6bf0('0x9')][_0x6bf0('0xa')](_0x39fc51,_0x1f801e);}function main(){var _0x316ac6=0x1388;var _0x26fa95;logger[_0x6bf0('0xb')](util[_0x6bf0('0xc')](_0x6bf0('0xd'),EXTRACTED_REPORT_ID,_0x6bf0('0xe')));return db[_0x6bf0('0xf')][_0x6bf0('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6bf0('0x11'),'splitSizeCsv']})[_0x6bf0('0x12')](function(_0x14e8f9){if(_0x14e8f9){_0x26fa95=_0x14e8f9;_0x316ac6=_0x26fa95[_0x6bf0('0x13')]||0x1388;}})[_0x6bf0('0x12')](function(){return dbH['sequelize']['query'](util[_0x6bf0('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6bf0('0x14')][_0x6bf0('0x15')][_0x6bf0('0x16')]});})[_0x6bf0('0x12')](function(_0x52d69d){if(!_0x52d69d[0x0]['num']){return analyticExtractedReport('Empty');}var _0x5a4612=[];var _0x378af9=0x0;if(_0x26fa95[_0x6bf0('0x11')]){if(_0x52d69d&&_0x52d69d[_0x6bf0('0x17')]){var _0x27bf3e=_['range'](_0x52d69d[0x0]['num']/_0x316ac6);var _0x5873d6=Number[_0x6bf0('0x18')](_0x52d69d[0x0][_0x6bf0('0x19')]/_0x316ac6)?_0x52d69d[0x0][_0x6bf0('0x19')]%_0x316ac6:0x0;_0x27bf3e[_0x6bf0('0x1a')](function(_0x5e760d){if(_0x5e760d>0x0){_0x378af9+=_0x316ac6;}_0x5a4612[_0x6bf0('0x1b')](dbH[_0x6bf0('0x14')][_0x6bf0('0x1c')](util[_0x6bf0('0xc')](_0x6bf0('0x1d'),QUERY,_0x316ac6,_0x378af9),{'type':dbH[_0x6bf0('0x14')][_0x6bf0('0x15')][_0x6bf0('0x16')]}));});if(_0x5873d6>0x0){_0x378af9+=_0x316ac6;_0x5a4612[_0x6bf0('0x1b')](dbH[_0x6bf0('0x14')][_0x6bf0('0x1c')](util[_0x6bf0('0xc')](_0x6bf0('0x1d'),QUERY,_0x5873d6,_0x378af9),{'type':dbH[_0x6bf0('0x14')]['QueryTypes'][_0x6bf0('0x16')]}));}}}else{_0x5a4612[_0x6bf0('0x1b')](dbH[_0x6bf0('0x14')][_0x6bf0('0x1c')](QUERY,{'type':dbH[_0x6bf0('0x14')][_0x6bf0('0x15')][_0x6bf0('0x16')]}));}var _0x2635c7=path[_0x6bf0('0x1e')](PATH);var _0x3ee8a1=path['basename'](PATH,_0x6bf0('0x1f'));var _0x51d0f7=_0x26fa95[_0x6bf0('0x11')]&&_0x5a4612[_0x6bf0('0x17')]>0x1;var _0x1768d2=[];if(!fs[_0x6bf0('0x20')](path[_0x6bf0('0x21')](_0x2635c7,_0x3ee8a1))&&_0x51d0f7){fs[_0x6bf0('0x22')](path['join'](_0x2635c7,_0x3ee8a1));}return BPromise[_0x6bf0('0x23')](_0x5a4612,function(_0x89e371){_0x1768d2[_0x6bf0('0x1b')](_0x89e371);})[_0x6bf0('0x12')](function(){for(var _0x4ea552=0x0;_0x4ea552<_0x1768d2[_0x6bf0('0x17')];_0x4ea552+=0x1){var _0x59b00c;var _0x4a1b90=_0x1768d2[_0x4ea552];if(_0x51d0f7){_0x59b00c=path[_0x6bf0('0x21')](_0x2635c7,_0x3ee8a1,util[_0x6bf0('0xc')](_0x6bf0('0x24'),_0x3ee8a1,_0x4ea552,_0x6bf0('0x25')));}else{_0x59b00c=path[_0x6bf0('0x21')](_0x2635c7,util[_0x6bf0('0xc')](_0x6bf0('0x26'),_0x3ee8a1,_0x6bf0('0x25')));}fs[_0x6bf0('0x27')](_0x59b00c,csv(_0x4a1b90));}})[_0x6bf0('0x12')](function(){if(_0x51d0f7){return new Promise(function(_0x4d0128){zipdir(path['join'](_0x2635c7,_0x3ee8a1),{'saveTo':path['join'](_0x2635c7,util['format'](_0x6bf0('0x26'),_0x3ee8a1,_0x6bf0('0x28')))},function(_0x56606c,_0x2c8e47){rimraf(path[_0x6bf0('0x21')](_0x2635c7,_0x3ee8a1),function(){});_0x4d0128(_0x6bf0('0x29'));});});}})[_0x6bf0('0x12')](function(){logger[_0x6bf0('0xb')](util[_0x6bf0('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6bf0('0xe')));return analyticExtractedReport(_0x6bf0('0x2a'),_0x51d0f7?util[_0x6bf0('0xc')](_0x6bf0('0x26'),_0x3ee8a1,_0x51d0f7?'zip':_0x6bf0('0x25')):null);});})['catch'](function(_0x2ac4a2){logger[_0x6bf0('0xb')](util[_0x6bf0('0xc')](_0x6bf0('0x2b'),EXTRACTED_REPORT_ID,_0x6bf0('0xe')),util[_0x6bf0('0x2c')](_0x2ac4a2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x6bf0('0x2d')](function(){process[_0x6bf0('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7bdbeed..b0150eb 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 _0xae08=['chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','margin','landscape','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','.pdf','join','mkdirSync','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','info','findOne','PDF','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','path','catch','lodash','util','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','value','fill','length','auto','push','body'];(function(_0x48b5bc,_0xeaa079){var _0x1beb4d=function(_0x3999e6){while(--_0x3999e6){_0x48b5bc['push'](_0x48b5bc['shift']());}};_0x1beb4d(++_0xeaa079);}(_0xae08,0xdb));var _0x8ae0=function(_0x299b62,_0x1bea7c){_0x299b62=_0x299b62-0x0;var _0x198be9=_0xae08[_0x299b62];return _0x198be9;};'use strict';var _=require(_0x8ae0('0x0'));var fs=require('fs');var util=require(_0x8ae0('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x8ae0('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x8ae0('0x3'));var rimraf=require(_0x8ae0('0x4'));var JSDOM=require(_0x8ae0('0x5'))[_0x8ae0('0x6')];var window=new JSDOM('')[_0x8ae0('0x7')];var BPromise=require(_0x8ae0('0x8'));var db=require(_0x8ae0('0x9'))['db'];var dbH=require(_0x8ae0('0x9'))[_0x8ae0('0xa')];var logger=require(_0x8ae0('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8ae0('0xc')][0x2]);var QUERY=process[_0x8ae0('0xc')][0x3];var PATH=process[_0x8ae0('0xc')][0x4];var NAME=process[_0x8ae0('0xc')][0x5];var FORMAT=_0x8ae0('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d4ad6,_0x3c5b0d){var _0xb5f548={'status':_0x5d4ad6};var _0x3b51f6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c5b0d){_0xb5f548[_0x8ae0('0xe')]=_0x3c5b0d;}return db[_0x8ae0('0xf')]['update'](_0xb5f548,_0x3b51f6);}function getHeaders(_0x23738e){return _[_0x8ae0('0x10')](_0x23738e,function(_0x3f750a){return{'text':_0x3f750a,'style':_0x8ae0('0x11')};});}function getRows(_0x408179,_0x4893d4){return _[_0x8ae0('0x10')](_0x4893d4,function(_0x29cd69){return _(_0x29cd69)['pick'](_0x408179)['map'](function(_0x3391e9){return _0x3391e9?_['toString'](_0x3391e9):'';})[_0x8ae0('0x12')]();});}function createTable(_0x3bc5c6,_0x4baf31){var _0x16bcf9={'widths':_[_0x8ae0('0x13')](Array(_0x3bc5c6[_0x8ae0('0x14')]),0x91),'heights':function(_0xd6b5cc){return _0xd6b5cc===0x0?_0x8ae0('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x47fd93=getHeaders(_0x3bc5c6);_0x16bcf9['body'][_0x8ae0('0x16')](_0x47fd93);var _0x5c5e17=getRows(_0x3bc5c6,_0x4baf31);_0x16bcf9[_0x8ae0('0x17')]=_0x16bcf9[_0x8ae0('0x17')]['concat'](_0x5c5e17);return _0x16bcf9;}function createTables(_0x1c44fd){var _0x104085=[];var _0x2bf64a=_[_0x8ae0('0x18')](Object[_0x8ae0('0x19')](_0x1c44fd[0x0]),0x5);_0x2bf64a[_0x8ae0('0x1a')](function(_0xe1eb7){_0x104085[_0x8ae0('0x16')](createTable(_0xe1eb7,_0x1c44fd));});return _0x104085;}function getPDFDocDefinition(_0x3e5668){var _0x198322=util[_0x8ae0('0x1b')](_0x8ae0('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x8ae0('0x1d')])[_0x8ae0('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x8ae0('0x1e')])[_0x8ae0('0x1b')](FORMAT));var _0x51f591=[];for(var _0x52213d=0x0;_0x52213d<_0x3e5668[_0x8ae0('0x14')];_0x52213d++){var _0x53659e=[];if(_0x52213d===0x0){_0x53659e[_0x8ae0('0x16')]({'text':_0x198322,'style':'header'});}var _0x2e1200={'table':_0x3e5668[_0x52213d]};if(_0x52213d>0x0){_0x2e1200['pageBreak']='before';_0x2e1200[_0x8ae0('0x1f')]=[0x0,0x46,0x0,0x0];}_0x53659e['push'](_0x2e1200);_0x51f591[_0x8ae0('0x16')](_0x53659e);}return{'pageSize':'A4','pageOrientation':_0x8ae0('0x20'),'content':_0x51f591,'footer':function(_0x1057ef,_0x509006){return{'text':_0x1057ef[_0x8ae0('0x21')]()+_0x8ae0('0x22')+_0x509006,'style':_0x8ae0('0x23')};},'defaultStyle':{'font':_0x8ae0('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8ae0('0x25')},'footer':{'alignment':_0x8ae0('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5d189e){var _0x2f3def=0x1388;var _0x61dcae;if(!_0x5d189e[0x0][_0x8ae0('0x27')]){return analyticExtractedReport(_0x8ae0('0x28'));}return db[_0x8ae0('0x29')][_0x8ae0('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8ae0('0x2b'),_0x8ae0('0x2c')]})[_0x8ae0('0x2d')](function(_0x2d0b62){if(_0x2d0b62){_0x61dcae=_0x2d0b62;_0x2f3def=_0x61dcae[_0x8ae0('0x2c')]||0x3e8;}})[_0x8ae0('0x2d')](function(){var _0x2f827e=[];var _0xd8262a=0x0;if(_0x61dcae[_0x8ae0('0x2b')]){if(_0x5d189e&&_0x5d189e['length']){var _0x4346b3=_['range'](_0x5d189e[0x0][_0x8ae0('0x27')]/_0x2f3def);var _0x29cc5f=Number['isInteger'](_0x5d189e[0x0][_0x8ae0('0x27')]/_0x2f3def)?_0x5d189e[0x0][_0x8ae0('0x27')]%_0x2f3def:0x0;_0x4346b3[_0x8ae0('0x1a')](function(_0x2bb3e1){if(_0x2bb3e1>0x0){_0xd8262a+=_0x2f3def;}_0x2f827e['push'](dbH[_0x8ae0('0x2e')]['query'](util['format'](_0x8ae0('0x2f'),QUERY,_0x2f3def,_0xd8262a),{'type':dbH[_0x8ae0('0x2e')][_0x8ae0('0x30')][_0x8ae0('0x31')]}));});if(_0x29cc5f>0x0){_0xd8262a+=_0x2f3def;_0x2f827e[_0x8ae0('0x16')](dbH[_0x8ae0('0x2e')][_0x8ae0('0x32')](util[_0x8ae0('0x1b')](_0x8ae0('0x2f'),QUERY,_0x29cc5f,_0xd8262a),{'type':dbH[_0x8ae0('0x2e')][_0x8ae0('0x30')]['SELECT']}));}}}else{_0x2f827e['push'](dbH[_0x8ae0('0x2e')]['query'](QUERY,{'type':dbH['sequelize'][_0x8ae0('0x30')]['SELECT']}));}var _0xad2107=path['dirname'](PATH);var _0x4adc6b=path['basename'](PATH,_0x8ae0('0x33'));var _0x2e2b17=_0x61dcae[_0x8ae0('0x2b')]&&_0x2f827e['length']>0x1;var _0x5e19e4=[];if(!fs['existsSync'](path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b))&&_0x2e2b17){fs[_0x8ae0('0x35')](path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b));}return BPromise['each'](_0x2f827e,function(_0x109157){_0x5e19e4['push'](_0x109157);})['then'](function(){var _0x45c5a8=[];for(var _0x229b4d=0x0;_0x229b4d<_0x5e19e4[_0x8ae0('0x14')];_0x229b4d+=0x1){var _0x117780=_0x5e19e4[_0x229b4d];var _0x444d88=createTables(_[_0x8ae0('0x36')](_0x117780));var _0x403518;var _0x1ea91f=getPDFDocDefinition(_0x444d88);var _0x3d901d=getPDFPrinter();var _0x5c7f60=_0x3d901d[_0x8ae0('0x37')](_0x1ea91f);if(_0x2e2b17){_0x403518=path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b,util[_0x8ae0('0x1b')]('%s%d.%s',_0x4adc6b,_0x229b4d,_0x8ae0('0x38')));}else{_0x403518=path[_0x8ae0('0x34')](_0xad2107,util['format'](_0x8ae0('0x39'),_0x4adc6b,_0x8ae0('0x38')));}_0x45c5a8[_0x8ae0('0x16')](writePDFDocument(_0x5c7f60,_0x403518));}return Promise[_0x8ae0('0x3a')](_0x45c5a8);})[_0x8ae0('0x2d')](function(){if(_0x2e2b17){return new Promise(function(_0x7db760){zipdir(path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b),{'saveTo':path[_0x8ae0('0x34')](_0xad2107,util[_0x8ae0('0x1b')]('%s.%s',_0x4adc6b,_0x8ae0('0x3b')))},function(){rimraf(path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b),function(){});_0x7db760('zip\x20finished');});});}})[_0x8ae0('0x2d')](function(){if(!_0x2e2b17)return;rimraf(path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b),function(){});})[_0x8ae0('0x2d')](function(){logger[_0x8ae0('0x3c')](util[_0x8ae0('0x1b')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x2e2b17?util[_0x8ae0('0x1b')](_0x8ae0('0x39'),_0x4adc6b,_0x2e2b17?_0x8ae0('0x3b'):_0x8ae0('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x8ae0('0x1b')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x8ae0('0xf')][_0x8ae0('0x3d')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8ae0('0x2d')](function(_0x54f749){EXTRACTED_REPORT=_0x54f749;return dbH[_0x8ae0('0x2e')][_0x8ae0('0x32')](util[_0x8ae0('0x1b')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x8ae0('0x2e')]['QueryTypes'][_0x8ae0('0x31')]});})[_0x8ae0('0x2d')](extractReport)['catch'](function(_0x422262){logger['info'](util[_0x8ae0('0x1b')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8ae0('0x3e')),util['inspect'](_0x422262,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8ae0('0x3f'));})[_0x8ae0('0x40')](function(){process[_0x8ae0('0x41')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x18b466=new PdfPrinter({'Arial':{'normal':__dirname+_0x8ae0('0x42'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x8ae0('0x43'),'bolditalics':__dirname+_0x8ae0('0x44')}});return _0x18b466;}function getPDFDocDefinitionFromHTML(_0x1f2cc0,_0x4b4cc5){var _0x4d05c6=util['format'](_0x8ae0('0x45'),_0x4b4cc5[_0x8ae0('0x46')],_0x4b4cc5['interactionId']);var _0x2d4dcd=moment()[_0x8ae0('0x1b')]('YYYY-MM-DD')[_0x8ae0('0x21')]();var _0x383f08=htmlToPdfmake(_0x1f2cc0,{'window':window,'tableAutoSize':!![]});return{'content':[_0x383f08],'defaultStyle':{'font':_0x8ae0('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8ae0('0x47'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x8ae0('0x48'),'style':_0x8ae0('0x49')}];},'footer':function(_0x48c54f,_0x15adb4){return[{'text':util[_0x8ae0('0x1b')](_0x8ae0('0x4a'),_0x4d05c6,_0x48c54f,_0x15adb4,_0x2d4dcd),'style':_0x8ae0('0x23')}];}};}function writePDFDocument(_0x4e1b62,_0x1c7b5c){return new Promise(function(_0x3eade3,_0x3fa24f){var _0x517ebc=_0x4e1b62[_0x8ae0('0x4b')](fs[_0x8ae0('0x4c')](_0x1c7b5c));_0x517ebc['on'](_0x8ae0('0x4d'),function(){_0x3eade3(_0x8ae0('0x4d'));});_0x517ebc['on']('error',function(_0x338d02){_0x3fa24f(_0x338d02);});_0x4e1b62[_0x8ae0('0x4e')]();});}exports['createPdfFromHTML']=function(_0x2daabc,_0xe513ad){var _0x1bda3d=getPDFPrinter();var _0x1387c9=getPDFDocDefinitionFromHTML(_0x2daabc,_0xe513ad);var _0x54950d=_0x1bda3d['createPdfKitDocument'](_0x1387c9);return writePDFDocument(_0x54950d,_0xe513ad[_0x8ae0('0x4f')])[_0x8ae0('0x50')](function(_0x5c6961){throw _0x5c6961;});}; \ No newline at end of file +var _0x3ef3=['find','split','then','range','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','pipe','finish','end','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','map','tableHeader','pick','value','length','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','margin','landscape','toString','\x20/\x20','footer','Arial','black','right','Empty','Setting'];(function(_0x3dd09f,_0x540efe){var _0x1e897d=function(_0x10fb22){while(--_0x10fb22){_0x3dd09f['push'](_0x3dd09f['shift']());}};_0x1e897d(++_0x540efe);}(_0x3ef3,0x18d));var _0x33ef=function(_0x3e9bca,_0x28d703){_0x3e9bca=_0x3e9bca-0x0;var _0x1e2469=_0x3ef3[_0x3e9bca];return _0x1e2469;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x33ef('0x0'));var path=require(_0x33ef('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x33ef('0x2'));var PdfPrinter=require(_0x33ef('0x3'));var zipdir=require(_0x33ef('0x4'));var rimraf=require(_0x33ef('0x5'));var JSDOM=require(_0x33ef('0x6'))[_0x33ef('0x7')];var window=new JSDOM('')[_0x33ef('0x8')];var BPromise=require(_0x33ef('0x9'));var db=require(_0x33ef('0xa'))['db'];var dbH=require('../../mysqldb')[_0x33ef('0xb')];var logger=require(_0x33ef('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x33ef('0xd')][0x2]);var QUERY=process[_0x33ef('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x33ef('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x51af8d,_0x4c3027){var _0x550c1f={'status':_0x51af8d};var _0x2814ae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4c3027){_0x550c1f['savename']=_0x4c3027;}return db[_0x33ef('0xe')][_0x33ef('0xf')](_0x550c1f,_0x2814ae);}function getHeaders(_0x522b23){return _[_0x33ef('0x10')](_0x522b23,function(_0x14bb21){return{'text':_0x14bb21,'style':_0x33ef('0x11')};});}function getRows(_0x59f1c2,_0x194778){return _['map'](_0x194778,function(_0x519873){return _(_0x519873)[_0x33ef('0x12')](_0x59f1c2)[_0x33ef('0x10')](function(_0x17848f){return _0x17848f?_['toString'](_0x17848f):'';})[_0x33ef('0x13')]();});}function createTable(_0x500dfe,_0x578343){var _0x18ed78={'widths':_['fill'](Array(_0x500dfe[_0x33ef('0x14')]),0x91),'heights':function(_0x39cef0){return _0x39cef0===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4e81dc=getHeaders(_0x500dfe);_0x18ed78[_0x33ef('0x15')][_0x33ef('0x16')](_0x4e81dc);var _0x3643e2=getRows(_0x500dfe,_0x578343);_0x18ed78['body']=_0x18ed78[_0x33ef('0x15')][_0x33ef('0x17')](_0x3643e2);return _0x18ed78;}function createTables(_0xca04e1){var _0x2abebb=[];var _0x4d68aa=_[_0x33ef('0x18')](Object[_0x33ef('0x19')](_0xca04e1[0x0]),0x5);_0x4d68aa[_0x33ef('0x1a')](function(_0x1939b8){_0x2abebb[_0x33ef('0x16')](createTable(_0x1939b8,_0xca04e1));});return _0x2abebb;}function getPDFDocDefinition(_0x15f7b4){var _0x35b6e2=util['format'](_0x33ef('0x1b'),NAME,EXTRACTED_REPORT[_0x33ef('0x1c')],moment(EXTRACTED_REPORT[_0x33ef('0x1d')])[_0x33ef('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x33ef('0x1f')])[_0x33ef('0x1e')](FORMAT));var _0x5cf471=[];for(var _0x487339=0x0;_0x487339<_0x15f7b4[_0x33ef('0x14')];_0x487339++){var _0x1c24c6=[];if(_0x487339===0x0){_0x1c24c6[_0x33ef('0x16')]({'text':_0x35b6e2,'style':_0x33ef('0x20')});}var _0x581af2={'table':_0x15f7b4[_0x487339]};if(_0x487339>0x0){_0x581af2['pageBreak']='before';_0x581af2[_0x33ef('0x21')]=[0x0,0x46,0x0,0x0];}_0x1c24c6[_0x33ef('0x16')](_0x581af2);_0x5cf471['push'](_0x1c24c6);}return{'pageSize':'A4','pageOrientation':_0x33ef('0x22'),'content':_0x5cf471,'footer':function(_0x505b98,_0x5e7566){return{'text':_0x505b98[_0x33ef('0x23')]()+_0x33ef('0x24')+_0x5e7566,'style':_0x33ef('0x25')};},'defaultStyle':{'font':_0x33ef('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x33ef('0x27')},'footer':{'alignment':_0x33ef('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3f21e6){var _0x4b4772=0x1388;var _0x483323;if(!_0x3f21e6[0x0]['num']){return analyticExtractedReport(_0x33ef('0x29'));}return db[_0x33ef('0x2a')][_0x33ef('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x33ef('0x2c'),'splitSizePdf']})[_0x33ef('0x2d')](function(_0x2342a0){if(_0x2342a0){_0x483323=_0x2342a0;_0x4b4772=_0x483323['splitSizePdf']||0x3e8;}})[_0x33ef('0x2d')](function(){var _0x1b9be3=[];var _0x1d80a6=0x0;if(_0x483323[_0x33ef('0x2c')]){if(_0x3f21e6&&_0x3f21e6['length']){var _0x2eda99=_[_0x33ef('0x2e')](_0x3f21e6[0x0][_0x33ef('0x2f')]/_0x4b4772);var _0x57185b=Number['isInteger'](_0x3f21e6[0x0][_0x33ef('0x2f')]/_0x4b4772)?_0x3f21e6[0x0][_0x33ef('0x2f')]%_0x4b4772:0x0;_0x2eda99[_0x33ef('0x1a')](function(_0x1f53f2){if(_0x1f53f2>0x0){_0x1d80a6+=_0x4b4772;}_0x1b9be3[_0x33ef('0x16')](dbH[_0x33ef('0x30')][_0x33ef('0x31')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4b4772,_0x1d80a6),{'type':dbH[_0x33ef('0x30')]['QueryTypes']['SELECT']}));});if(_0x57185b>0x0){_0x1d80a6+=_0x4b4772;_0x1b9be3[_0x33ef('0x16')](dbH[_0x33ef('0x30')]['query'](util[_0x33ef('0x1e')](_0x33ef('0x32'),QUERY,_0x57185b,_0x1d80a6),{'type':dbH['sequelize']['QueryTypes'][_0x33ef('0x33')]}));}}}else{_0x1b9be3[_0x33ef('0x16')](dbH[_0x33ef('0x30')]['query'](QUERY,{'type':dbH['sequelize'][_0x33ef('0x34')]['SELECT']}));}var _0x522a71=path[_0x33ef('0x35')](PATH);var _0x54a1ae=path[_0x33ef('0x36')](PATH,'.pdf');var _0x4231b3=_0x483323[_0x33ef('0x2c')]&&_0x1b9be3[_0x33ef('0x14')]>0x1;var _0x10b813=[];if(!fs[_0x33ef('0x37')](path[_0x33ef('0x38')](_0x522a71,_0x54a1ae))&&_0x4231b3){fs[_0x33ef('0x39')](path[_0x33ef('0x38')](_0x522a71,_0x54a1ae));}return BPromise[_0x33ef('0x3a')](_0x1b9be3,function(_0x31573a){_0x10b813['push'](_0x31573a);})[_0x33ef('0x2d')](function(){var _0x57ad1d=[];for(var _0x408afa=0x0;_0x408afa<_0x10b813['length'];_0x408afa+=0x1){var _0x430616=_0x10b813[_0x408afa];var _0x5e6d38=createTables(_['flatten'](_0x430616));var _0x555ee2;var _0x5a138c=getPDFDocDefinition(_0x5e6d38);var _0x53cb76=getPDFPrinter();var _0x53fc09=_0x53cb76[_0x33ef('0x3b')](_0x5a138c);if(_0x4231b3){_0x555ee2=path[_0x33ef('0x38')](_0x522a71,_0x54a1ae,util[_0x33ef('0x1e')](_0x33ef('0x3c'),_0x54a1ae,_0x408afa,_0x33ef('0x3d')));}else{_0x555ee2=path['join'](_0x522a71,util['format'](_0x33ef('0x3e'),_0x54a1ae,_0x33ef('0x3d')));}_0x57ad1d[_0x33ef('0x16')](writePDFDocument(_0x53fc09,_0x555ee2));}return Promise[_0x33ef('0x3f')](_0x57ad1d);})[_0x33ef('0x2d')](function(){if(_0x4231b3){return new Promise(function(_0x8c93b5){zipdir(path['join'](_0x522a71,_0x54a1ae),{'saveTo':path['join'](_0x522a71,util[_0x33ef('0x1e')](_0x33ef('0x3e'),_0x54a1ae,'zip'))},function(){rimraf(path[_0x33ef('0x38')](_0x522a71,_0x54a1ae),function(){});_0x8c93b5('zip\x20finished');});});}})[_0x33ef('0x2d')](function(){if(!_0x4231b3)return;rimraf(path['join'](_0x522a71,_0x54a1ae),function(){});})[_0x33ef('0x2d')](function(){logger[_0x33ef('0x40')](util['format'](_0x33ef('0x41'),EXTRACTED_REPORT_ID,_0x33ef('0x42')));return analyticExtractedReport(_0x33ef('0x43'),_0x4231b3?util[_0x33ef('0x1e')](_0x33ef('0x3e'),_0x54a1ae,_0x4231b3?_0x33ef('0x44'):_0x33ef('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x33ef('0x40')](util[_0x33ef('0x1e')](_0x33ef('0x45'),EXTRACTED_REPORT_ID,_0x33ef('0x42')));return db[_0x33ef('0xe')][_0x33ef('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x33ef('0x2d')](function(_0x1ccff2){EXTRACTED_REPORT=_0x1ccff2;return dbH[_0x33ef('0x30')][_0x33ef('0x31')](util[_0x33ef('0x1e')](_0x33ef('0x47'),QUERY),{'type':dbH['sequelize'][_0x33ef('0x34')][_0x33ef('0x33')]});})['then'](extractReport)[_0x33ef('0x48')](function(_0x234cd6){logger[_0x33ef('0x40')](util['format'](_0x33ef('0x49'),EXTRACTED_REPORT_ID,_0x33ef('0x42')),util[_0x33ef('0x4a')](_0x234cd6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x33ef('0x4b'));})[_0x33ef('0x4c')](function(){process[_0x33ef('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x48c589=new PdfPrinter({'Arial':{'normal':__dirname+_0x33ef('0x4e'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x33ef('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x48c589;}function getPDFDocDefinitionFromHTML(_0x5bee08,_0x2135b5){var _0x2fe238=util[_0x33ef('0x1e')](_0x33ef('0x50'),_0x2135b5[_0x33ef('0x51')],_0x2135b5[_0x33ef('0x52')]);var _0x7e95a4=moment()[_0x33ef('0x1e')](_0x33ef('0x53'))['toString']();var _0x118988=htmlToPdfmake(_0x5bee08,{'window':window,'tableAutoSize':!![]});return{'content':[_0x118988],'defaultStyle':{'font':_0x33ef('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x33ef('0x54'),'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':_0x33ef('0x54')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x33ef('0x20')}];},'footer':function(_0x3256b8,_0x16f0d4){return[{'text':util[_0x33ef('0x1e')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2fe238,_0x3256b8,_0x16f0d4,_0x7e95a4),'style':_0x33ef('0x25')}];}};}function writePDFDocument(_0x4f78f3,_0x51c3de){return new Promise(function(_0x5ed036,_0x1b2ce2){var _0x475010=_0x4f78f3[_0x33ef('0x55')](fs['createWriteStream'](_0x51c3de));_0x475010['on']('finish',function(){_0x5ed036(_0x33ef('0x56'));});_0x475010['on']('error',function(_0x2ffc89){_0x1b2ce2(_0x2ffc89);});_0x4f78f3[_0x33ef('0x57')]();});}exports['createPdfFromHTML']=function(_0x491ed6,_0x93a3d9){var _0x1fb276=getPDFPrinter();var _0x5dae43=getPDFDocDefinitionFromHTML(_0x491ed6,_0x93a3d9);var _0x3d3ffe=_0x1fb276['createPdfKitDocument'](_0x5dae43);return writePDFDocument(_0x3d3ffe,_0x93a3d9[_0x33ef('0x1')])[_0x33ef('0x48')](function(_0x3bc4e9){throw _0x3bc4e9;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f635427..9bb087c 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 _0x7d31=['Completed','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','Empty','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d31,0x1e4));var _0x17d3=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0x7d31[_0x21c2c8];return _0x4dd745;};'use strict';var util=require(_0x17d3('0x0'));var path=require('path');var _=require(_0x17d3('0x1'));var fs=require('fs');var json2xls=require(_0x17d3('0x2'));var BPromise=require(_0x17d3('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x17d3('0x4'));var db=require(_0x17d3('0x5'))['db'];var dbH=require(_0x17d3('0x5'))[_0x17d3('0x6')];var logger=require(_0x17d3('0x7'))(_0x17d3('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x17d3('0x9')][0x2]);var QUERY=process[_0x17d3('0x9')][0x3];var PATH=process[_0x17d3('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x7e7376,_0x59589f){var _0x3d7936={'status':_0x7e7376};var _0x359c2e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59589f){_0x3d7936['savename']=_0x59589f;}return db[_0x17d3('0xa')][_0x17d3('0xb')](_0x3d7936,_0x359c2e);}function main(){var _0x2ec0bc=0x1388;var _0x557a6c;logger['info'](util[_0x17d3('0xc')](_0x17d3('0xd'),EXTRACTED_REPORT_ID,_0x17d3('0xe')));return db[_0x17d3('0xf')][_0x17d3('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x17d3('0x11'),_0x17d3('0x12')]})[_0x17d3('0x13')](function(_0x186824){if(_0x186824){_0x557a6c=_0x186824;_0x2ec0bc=_0x557a6c[_0x17d3('0x12')]||0x1388;}})[_0x17d3('0x13')](function(){return dbH[_0x17d3('0x14')][_0x17d3('0x15')](util[_0x17d3('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x17d3('0x14')]['QueryTypes']['SELECT']});})['then'](function(_0x32a77a){if(!_0x32a77a[0x0]['num']){return analyticExtractedReport(_0x17d3('0x16'));}var _0x2693c7=[];var _0x4ae72b=0x0;if(_0x557a6c['split']){if(_0x32a77a&&_0x32a77a['length']){var _0x215e5e=_[_0x17d3('0x17')](_0x32a77a[0x0][_0x17d3('0x18')]/_0x2ec0bc);var _0x430e3e=Number[_0x17d3('0x19')](_0x32a77a[0x0][_0x17d3('0x18')]/_0x2ec0bc)?_0x32a77a[0x0][_0x17d3('0x18')]%_0x2ec0bc:0x0;_0x215e5e[_0x17d3('0x1a')](function(_0x24f0f2){if(_0x24f0f2>0x0){_0x4ae72b+=_0x2ec0bc;}_0x2693c7[_0x17d3('0x1b')](dbH['sequelize'][_0x17d3('0x15')](util['format'](_0x17d3('0x1c'),QUERY,_0x2ec0bc,_0x4ae72b),{'type':dbH['sequelize']['QueryTypes'][_0x17d3('0x1d')]}));});if(_0x430e3e>0x0){_0x4ae72b+=_0x2ec0bc;_0x2693c7['push'](dbH[_0x17d3('0x14')][_0x17d3('0x15')](util[_0x17d3('0xc')](_0x17d3('0x1c'),QUERY,_0x430e3e,_0x4ae72b),{'type':dbH[_0x17d3('0x14')][_0x17d3('0x1e')]['SELECT']}));}}}else{_0x2693c7[_0x17d3('0x1b')](dbH[_0x17d3('0x14')][_0x17d3('0x15')](QUERY,{'type':dbH['sequelize'][_0x17d3('0x1e')][_0x17d3('0x1d')]}));}var _0x79887=path[_0x17d3('0x1f')](PATH);var _0x2ac50b=path[_0x17d3('0x20')](PATH,_0x17d3('0x21'));var _0x3e804b=_0x557a6c[_0x17d3('0x11')]&&_0x2693c7[_0x17d3('0x22')]>0x1;var _0x3c95d7=[];if(!fs[_0x17d3('0x23')](path[_0x17d3('0x24')](_0x79887,_0x2ac50b))&&_0x3e804b){fs[_0x17d3('0x25')](path[_0x17d3('0x24')](_0x79887,_0x2ac50b));}return BPromise['each'](_0x2693c7,function(_0x518950){_0x3c95d7[_0x17d3('0x1b')](_0x518950);})[_0x17d3('0x13')](function(){for(var _0xe95d36=0x0;_0xe95d36<_0x3c95d7['length'];_0xe95d36+=0x1){var _0x418535;var _0x204ed0=_0x3c95d7[_0xe95d36];if(_0x3e804b){_0x418535=path[_0x17d3('0x24')](_0x79887,_0x2ac50b,util[_0x17d3('0xc')](_0x17d3('0x26'),_0x2ac50b,_0xe95d36,_0x17d3('0x27')));}else{_0x418535=path[_0x17d3('0x24')](_0x79887,util[_0x17d3('0xc')](_0x17d3('0x28'),_0x2ac50b,_0x17d3('0x27')));}fs[_0x17d3('0x29')](_0x418535,json2xls(_0x204ed0),_0x17d3('0x2a'));}})[_0x17d3('0x13')](function(){if(_0x3e804b){return new Promise(function(_0x437d97){zipdir(path['join'](_0x79887,_0x2ac50b),{'saveTo':path[_0x17d3('0x24')](_0x79887,util[_0x17d3('0xc')]('%s.%s',_0x2ac50b,_0x17d3('0x2b')))},function(_0x41b649,_0x3c79fd){rimraf(path[_0x17d3('0x24')](_0x79887,_0x2ac50b),function(){});_0x437d97(_0x17d3('0x2c'));});});}})[_0x17d3('0x13')](function(){logger['info'](util[_0x17d3('0xc')](_0x17d3('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x17d3('0x2e'),_0x3e804b?util[_0x17d3('0xc')](_0x17d3('0x28'),_0x2ac50b,_0x3e804b?'zip':_0x17d3('0x27')):null);});})['catch'](function(_0x38401e){logger[_0x17d3('0x2f')](util[_0x17d3('0xc')](_0x17d3('0x30'),EXTRACTED_REPORT_ID,_0x17d3('0xe')),util[_0x17d3('0x31')](_0x38401e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x17d3('0x32'));})[_0x17d3('0x33')](function(){process[_0x17d3('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb077=['inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','Empty','length','range','num','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','existsSync','join','each','%s%d.%s','%s.%s','xlsx','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0xb077,0x1c6));var _0x7b07=function(_0x580451,_0x138171){_0x580451=_0x580451-0x0;var _0x2966ec=_0xb077[_0x580451];return _0x2966ec;};'use strict';var util=require(_0x7b07('0x0'));var path=require(_0x7b07('0x1'));var _=require(_0x7b07('0x2'));var fs=require('fs');var json2xls=require(_0x7b07('0x3'));var BPromise=require(_0x7b07('0x4'));var zipdir=require(_0x7b07('0x5'));var rimraf=require(_0x7b07('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x7b07('0x7')];var logger=require(_0x7b07('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x7b07('0x9')][0x2]);var QUERY=process[_0x7b07('0x9')][0x3];var PATH=process[_0x7b07('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x68e367,_0x26c5e2){var _0x57bf92={'status':_0x68e367};var _0x4c82c5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26c5e2){_0x57bf92[_0x7b07('0xa')]=_0x26c5e2;}return db[_0x7b07('0xb')]['update'](_0x57bf92,_0x4c82c5);}function main(){var _0x22f9f2=0x1388;var _0x46c104;logger[_0x7b07('0xc')](util['format'](_0x7b07('0xd'),EXTRACTED_REPORT_ID,_0x7b07('0xe')));return db[_0x7b07('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7b07('0x10'),_0x7b07('0x11')]})[_0x7b07('0x12')](function(_0x11c3c7){if(_0x11c3c7){_0x46c104=_0x11c3c7;_0x22f9f2=_0x46c104[_0x7b07('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0x7b07('0x13')](_0x7b07('0x14'),QUERY),{'type':dbH[_0x7b07('0x15')]['QueryTypes'][_0x7b07('0x16')]});})[_0x7b07('0x12')](function(_0x2bde66){if(!_0x2bde66[0x0]['num']){return analyticExtractedReport(_0x7b07('0x17'));}var _0x366910=[];var _0xf6d592=0x0;if(_0x46c104['split']){if(_0x2bde66&&_0x2bde66[_0x7b07('0x18')]){var _0x10b147=_[_0x7b07('0x19')](_0x2bde66[0x0][_0x7b07('0x1a')]/_0x22f9f2);var _0x1b09d7=Number['isInteger'](_0x2bde66[0x0][_0x7b07('0x1a')]/_0x22f9f2)?_0x2bde66[0x0][_0x7b07('0x1a')]%_0x22f9f2:0x0;_0x10b147[_0x7b07('0x1b')](function(_0x4ecf98){if(_0x4ecf98>0x0){_0xf6d592+=_0x22f9f2;}_0x366910[_0x7b07('0x1c')](dbH[_0x7b07('0x15')][_0x7b07('0x1d')](util[_0x7b07('0x13')](_0x7b07('0x1e'),QUERY,_0x22f9f2,_0xf6d592),{'type':dbH['sequelize']['QueryTypes'][_0x7b07('0x16')]}));});if(_0x1b09d7>0x0){_0xf6d592+=_0x22f9f2;_0x366910[_0x7b07('0x1c')](dbH['sequelize'][_0x7b07('0x1d')](util[_0x7b07('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1b09d7,_0xf6d592),{'type':dbH[_0x7b07('0x15')]['QueryTypes'][_0x7b07('0x16')]}));}}}else{_0x366910['push'](dbH[_0x7b07('0x15')][_0x7b07('0x1d')](QUERY,{'type':dbH[_0x7b07('0x15')][_0x7b07('0x1f')][_0x7b07('0x16')]}));}var _0x296f14=path[_0x7b07('0x20')](PATH);var _0x4b23a8=path[_0x7b07('0x21')](PATH,'.xlsx');var _0x2ac8a4=_0x46c104[_0x7b07('0x10')]&&_0x366910['length']>0x1;var _0x5f2fc0=[];if(!fs[_0x7b07('0x22')](path[_0x7b07('0x23')](_0x296f14,_0x4b23a8))&&_0x2ac8a4){fs['mkdirSync'](path[_0x7b07('0x23')](_0x296f14,_0x4b23a8));}return BPromise[_0x7b07('0x24')](_0x366910,function(_0x19a355){_0x5f2fc0[_0x7b07('0x1c')](_0x19a355);})[_0x7b07('0x12')](function(){for(var _0x172893=0x0;_0x172893<_0x5f2fc0[_0x7b07('0x18')];_0x172893+=0x1){var _0x17c593;var _0x180f26=_0x5f2fc0[_0x172893];if(_0x2ac8a4){_0x17c593=path['join'](_0x296f14,_0x4b23a8,util[_0x7b07('0x13')](_0x7b07('0x25'),_0x4b23a8,_0x172893,'xlsx'));}else{_0x17c593=path['join'](_0x296f14,util[_0x7b07('0x13')](_0x7b07('0x26'),_0x4b23a8,_0x7b07('0x27')));}fs['writeFileSync'](_0x17c593,json2xls(_0x180f26),_0x7b07('0x28'));}})[_0x7b07('0x12')](function(){if(_0x2ac8a4){return new Promise(function(_0x570df9){zipdir(path[_0x7b07('0x23')](_0x296f14,_0x4b23a8),{'saveTo':path['join'](_0x296f14,util[_0x7b07('0x13')](_0x7b07('0x26'),_0x4b23a8,_0x7b07('0x29')))},function(_0x213f1b,_0x536df7){rimraf(path[_0x7b07('0x23')](_0x296f14,_0x4b23a8),function(){});_0x570df9(_0x7b07('0x2a'));});});}})[_0x7b07('0x12')](function(){logger[_0x7b07('0xc')](util[_0x7b07('0x13')](_0x7b07('0x2b'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x7b07('0x2c'),_0x2ac8a4?util['format']('%s.%s',_0x4b23a8,_0x2ac8a4?_0x7b07('0x29'):_0x7b07('0x27')):null);});})[_0x7b07('0x2d')](function(_0x5430ee){logger[_0x7b07('0xc')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7b07('0xe')),util[_0x7b07('0x2e')](_0x5430ee,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7b07('0x2f'));})[_0x7b07('0x30')](function(){process[_0x7b07('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 0e87420..b232b7e 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 _0x189f=['callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','last','Hangup','concat','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','findAll','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','hasOwnProperty','priority','find','extensions','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','updatedAt','interval','intervals','tag','CDR(tag)='];(function(_0x18ce8c,_0xecedd2){var _0x4d1946=function(_0x3bb64e){while(--_0x3bb64e){_0x18ce8c['push'](_0x18ce8c['shift']());}};_0x4d1946(++_0xecedd2);}(_0x189f,0xd8));var _0xf189=function(_0x5fb9da,_0x1ac0d0){_0x5fb9da=_0x5fb9da-0x0;var _0x528081=_0x189f[_0x5fb9da];return _0x528081;};'use strict';var _=require(_0xf189('0x0'));var util=require(_0xf189('0x1'));function rewrite(_0x10a0d3,_0xdb9097){var _0x375bcc=this;return _0x10a0d3[_0xf189('0x2')][_0xf189('0x3')][_0xf189('0x4')]({'raw':!![]})['then'](function(_0x53dcf0){_0x375bcc['intervals']=_0x53dcf0;return _0x10a0d3['models']['VoiceExtension'][_0xf189('0x4')]({'where':{'IntervalId':_0xdb9097[_0xf189('0x5')]},'raw':!![]});})['then'](function(_0x4f40f4){return _0x10a0d3[_0xf189('0x2')][_0xf189('0x6')][_0xf189('0x4')]({'where':{'exten':{'$in':_[_0xf189('0x7')](_[_0xf189('0x8')](_0x4f40f4,_0xf189('0x9')))}},'order':[{'raw':_0xf189('0xa')}],'raw':!![]});})[_0xf189('0xb')](function(_0x5e4cbc){var _0xed8679=_[_0xf189('0xc')](_0x5e4cbc,{'priority':'1'});var _0x3de60b=_['filter'](_0x5e4cbc,{'isApp':0x1});var _0x105d4d=_[_0xf189('0xd')](_0x3de60b,_0xf189('0x9'));var _0x4da8be=['queue','playback'];var _0x2030d5=[];var _0x5cd328=[];for(var _0x4231bf in _0x105d4d){if(_0x105d4d[_0xf189('0xe')](_0x4231bf)){_0x375bcc[_0xf189('0xf')]=0x2;_0x375bcc['extensions']=[];_0x375bcc['extension']=_[_0xf189('0x10')](_0xed8679,{'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')]});_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':util[_0xf189('0x14')](_0xf189('0x15'),_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')]),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0]['exten'],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});if(_0x105d4d[_0x4231bf][0x0]['type']==='inbound'){_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x105d4d[_0x4231bf][0x0]['VoiceExtensionId'],'context':_0x105d4d[_0x4231bf][0x0]['context'],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}else if(_0x105d4d[_0x4231bf][0x0]['type']===_0xf189('0x19')){if(_0x375bcc[_0xf189('0x1a')]){_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':'Set','appdata':_0xf189('0x1b')+(_0x375bcc[_0xf189('0x1a')][_0xf189('0x1c')]?_0xf189('0x1d')+_0x375bcc['extension'][_0xf189('0x1c')]+'}':_0xf189('0x1e')),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc['priority']++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}_0x375bcc['extensions'][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':'Set','appdata':_0xf189('0x1f')+_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')],'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0]['exten'],'priority':_0x375bcc['priority']++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});var _0x2afce1=_0x375bcc[_0xf189('0xf')]++;_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2afce1+0x2)+'):Goto('+(_0x2afce1+0x1)+')','context':_0x105d4d[_0x4231bf][0x0]['context'],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x2afce1,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});if(_0x375bcc['extension']){_0x375bcc['extensions']['push']({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':_0x375bcc['extension'][_0xf189('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x375bcc[_0xf189('0x1a')][_0xf189('0x1c')]+'}':_0xf189('0x21'),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}_0x375bcc['extensions'][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':_0xf189('0x22')+_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')],'context':_0x105d4d[_0x4231bf][0x0]['context'],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc['priority']++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});if(_0x375bcc[_0xf189('0x1a')]&&_0x375bcc[_0xf189('0x1a')][_0xf189('0xe')](_0xf189('0x23'))&&_0x375bcc[_0xf189('0x1a')]['recordingFormat']!==_0xf189('0x24')){_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':'Set','appdata':_0xf189('0x25')+_0x375bcc[_0xf189('0x1a')]['recordingFormat']||_0xf189('0x26'),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}}_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':_0xf189('0x13'),'appdata':_0xf189('0x27'),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});_0x375bcc[_0xf189('0x11')]['push']({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x105d4d[_0x4231bf][0x0]['context'],'exten':_0x105d4d[_0x4231bf][0x0]['exten'],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0]['VoiceExtensionId']});for(var _0x2ec564=0x0,_0x268f40=0x0;_0x2ec564<_0x105d4d[_0x4231bf][_0xf189('0x28')];_0x2ec564+=0x1,_0x268f40=0x0){var _0x207e2a=_0x105d4d[_0x4231bf][_0x2ec564];if(_0x207e2a[_0xf189('0x16')]){_0x207e2a[_0xf189('0x16')]=_0x207e2a['type'][_0xf189('0x29')]();}var _0x3a6b54=[];var _0x172104=[];delete _0x207e2a['id'];delete _0x207e2a[_0xf189('0x2a')];delete _0x207e2a[_0xf189('0x2b')];var _0x97a380=_0x207e2a[_0xf189('0x2c')]!=='*,*,*,*'?[_0x207e2a['interval']]:_0x207e2a['IntervalId']?_['map'](_[_0xf189('0xc')](_0x375bcc[_0xf189('0x2d')],{'IntervalId':_0x207e2a['IntervalId']}),_0xf189('0x2c')):[];if(_0x207e2a[_0xf189('0xe')]('tag')){if(_0x207e2a[_0xf189('0x2e')]&&_0x207e2a[_0xf189('0x2e')]!=='--'){_0x3a6b54['push']({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x13'),'appdata':_0xf189('0x2f')+_0x207e2a['tag'],'context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc['priority']+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}}if(_0x207e2a['type']===_0xf189('0x19')&&_0x207e2a[_0xf189('0xe')](_0xf189('0x30'))){if(_0x207e2a[_0xf189('0x30')]){_0x3a6b54['push']({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x20'),'appdata':_0xf189('0x31')+_0x207e2a[_0xf189('0x30')]+')','context':_0x207e2a['context'],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}else{_0x3a6b54['push']({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}}if(_0x207e2a[_0xf189('0xe')](_0xf189('0x32'))){if(_0x4da8be[_0xf189('0x33')](_0x207e2a[_0xf189('0x34')]['toLowerCase']())>=0x0&&_0x207e2a[_0xf189('0x35')]!==_0xf189('0x36')){if(_0x207e2a[_0xf189('0x32')]){_0x3a6b54[_0xf189('0x12')]({'type':_0x207e2a['type'],'app':_0xf189('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});_0x3a6b54[_0xf189('0x12')]({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x13'),'appdata':_0xf189('0x37'),'context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a['exten'],'priority':_0x97a380['length']+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}else{_0x3a6b54[_0xf189('0x12')]({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x20'),'appdata':_0xf189('0x38'),'context':_0x207e2a['context'],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});_0x3a6b54[_0xf189('0x12')]({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380['length']+_0x375bcc['priority']+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}}}for(var _0x1c1ae9=0x0;_0x1c1ae9<_0x97a380[_0xf189('0x28')];_0x1c1ae9+=0x1){var _0x1d44bb=_0x375bcc[_0xf189('0xf')]+_0x97a380[_0xf189('0x28')];var _0x131577=_0x1c1ae9===_0x97a380[_0xf189('0x28')]-0x1?_0x375bcc[_0xf189('0xf')]+_0x3a6b54['length']+_0x172104[_0xf189('0x28')]+0x2:_0x375bcc[_0xf189('0xf')]+_0x1c1ae9+0x1;_0x3a6b54[_0xf189('0x39')](_0x1c1ae9,0x0,{'type':_0x207e2a[_0xf189('0x16')],'app':'GotoIfTime','appdata':_0x97a380[_0x1c1ae9]+'?'+_0x207e2a[_0xf189('0x17')]+',${EXTEN},'+_0x1d44bb+':'+_0x207e2a[_0xf189('0x17')]+',${EXTEN},'+_0x131577,'exten':_0x207e2a[_0xf189('0x9')],'context':_0x207e2a[_0xf189('0x17')],'priority':_0x375bcc[_0xf189('0xf')]+_0x1c1ae9,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}_0x207e2a['priority']=_0x3a6b54['length']?_[_0xf189('0x3a')](_0x3a6b54)[_0xf189('0xf')]+0x1:_0x375bcc[_0xf189('0xf')];_0x375bcc[_0xf189('0xf')]=(_0x172104[_0xf189('0x28')]?_[_0xf189('0x3a')](_0x172104)[_0xf189('0xf')]:_0x207e2a[_0xf189('0xf')])+0x1;_0x375bcc[_0xf189('0x11')]=_['concat'](_0x375bcc['extensions'],_0x3a6b54,[_0x207e2a],_0x172104);}_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':_0xf189('0x3b'),'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'context':_0x105d4d[_0x4231bf][0x0]['context'],'priority':_0x375bcc[_0xf189('0xf')],'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});_0x2030d5[_0xf189('0x12')](_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]);_0x5cd328=_[_0xf189('0x3c')](_0x5cd328,_0x375bcc[_0xf189('0x11')]);}}return _0x10a0d3['transaction'](function(_0x4f1579){return _0x10a0d3['models']['VoiceExtension'][_0xf189('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x2030d5}},'transaction':_0x4f1579})[_0xf189('0xb')](function(_0x4cc7ba){return _0x10a0d3[_0xf189('0x2')][_0xf189('0x6')][_0xf189('0x3e')](_['sortBy'](_0x5cd328,_0xf189('0xf')),{'transaction':_0x4f1579});});});})[_0xf189('0x3f')](function(_0x343553){console[_0xf189('0x40')](_0x343553);});}exports[_0xf189('0x41')]=rewrite; \ No newline at end of file +var _0x7394=['models','VoiceExtension','findAll','then','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extension','find','push','Set','format','CDR(type)=%s','type','context','priority','inbound','extensions','VoiceExtensionId','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','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','IntervalId','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','catch','error','rewrite','lodash','util','Interval','intervals'];(function(_0x46acdb,_0x1401ba){var _0x49c1b9=function(_0xc0821d){while(--_0xc0821d){_0x46acdb['push'](_0x46acdb['shift']());}};_0x49c1b9(++_0x1401ba);}(_0x7394,0x114));var _0x4739=function(_0x105212,_0x479629){_0x105212=_0x105212-0x0;var _0x16601e=_0x7394[_0x105212];return _0x16601e;};'use strict';var _=require(_0x4739('0x0'));var util=require(_0x4739('0x1'));function rewrite(_0xff53a8,_0x39b382){var _0x2fbb08=this;return _0xff53a8['models'][_0x4739('0x2')]['findAll']({'raw':!![]})['then'](function(_0x315965){_0x2fbb08[_0x4739('0x3')]=_0x315965;return _0xff53a8[_0x4739('0x4')][_0x4739('0x5')][_0x4739('0x6')]({'where':{'IntervalId':_0x39b382['IntervalId']},'raw':!![]});})[_0x4739('0x7')](function(_0x239943){return _0xff53a8[_0x4739('0x4')][_0x4739('0x5')][_0x4739('0x6')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x239943,_0x4739('0x8')))}},'order':[{'raw':_0x4739('0x9')}],'raw':!![]});})[_0x4739('0x7')](function(_0x5a790f){var _0x32e35d=_['filter'](_0x5a790f,{'priority':'1'});var _0x3b589b=_[_0x4739('0xa')](_0x5a790f,{'isApp':0x1});var _0x3f73b8=_[_0x4739('0xb')](_0x3b589b,_0x4739('0x8'));var _0x4bfce9=[_0x4739('0xc'),_0x4739('0xd')];var _0x2adc17=[];var _0x2e7cdf=[];for(var _0x393903 in _0x3f73b8){if(_0x3f73b8[_0x4739('0xe')](_0x393903)){_0x2fbb08['priority']=0x2;_0x2fbb08['extensions']=[];_0x2fbb08[_0x4739('0xf')]=_[_0x4739('0x10')](_0x32e35d,{'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')]});_0x2fbb08['extensions'][_0x4739('0x11')]({'type':_0x3f73b8[_0x393903][0x0]['type'],'app':_0x4739('0x12'),'appdata':util[_0x4739('0x13')](_0x4739('0x14'),_0x3f73b8[_0x393903][0x0][_0x4739('0x15')]),'context':_0x3f73b8[_0x393903][0x0][_0x4739('0x16')],'exten':_0x3f73b8[_0x393903][0x0]['exten'],'priority':_0x2fbb08[_0x4739('0x17')]++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0]['VoiceExtensionId']});if(_0x3f73b8[_0x393903][0x0][_0x4739('0x15')]===_0x4739('0x18')){_0x2fbb08[_0x4739('0x19')][_0x4739('0x11')]({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')],'context':_0x3f73b8[_0x393903][0x0][_0x4739('0x16')],'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')],'priority':_0x2fbb08['priority']++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});}else if(_0x3f73b8[_0x393903][0x0][_0x4739('0x15')]==='outbound'){if(_0x2fbb08[_0x4739('0xf')]){_0x2fbb08['extensions']['push']({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':'CDR(destination)='+(_0x2fbb08[_0x4739('0xf')]['cutdigits']?_0x4739('0x1b')+_0x2fbb08[_0x4739('0xf')][_0x4739('0x1c')]+'}':_0x4739('0x1d')),'context':_0x3f73b8[_0x393903][0x0][_0x4739('0x16')],'exten':_0x3f73b8[_0x393903][0x0]['exten'],'priority':_0x2fbb08[_0x4739('0x17')]++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});}_0x2fbb08[_0x4739('0x19')][_0x4739('0x11')]({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':_0x4739('0x1e')+_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')],'context':_0x3f73b8[_0x393903][0x0]['context'],'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')],'priority':_0x2fbb08[_0x4739('0x17')]++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});var _0x57f5c2=_0x2fbb08[_0x4739('0x17')]++;_0x2fbb08['extensions'][_0x4739('0x11')]({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x57f5c2+0x2)+'):Goto('+(_0x57f5c2+0x1)+')','context':_0x3f73b8[_0x393903][0x0][_0x4739('0x16')],'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')],'priority':_0x57f5c2,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});if(_0x2fbb08[_0x4739('0xf')]){_0x2fbb08['extensions']['push']({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':_0x2fbb08['extension'][_0x4739('0x1c')]?_0x4739('0x20')+_0x2fbb08['extension'][_0x4739('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x3f73b8[_0x393903][0x0][_0x4739('0x16')],'exten':_0x3f73b8[_0x393903][0x0]['exten'],'priority':_0x2fbb08[_0x4739('0x17')]++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});}_0x2fbb08[_0x4739('0x19')][_0x4739('0x11')]({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':_0x4739('0x21')+_0x3f73b8[_0x393903][0x0]['VoiceExtensionId'],'context':_0x3f73b8[_0x393903][0x0]['context'],'exten':_0x3f73b8[_0x393903][0x0]['exten'],'priority':_0x2fbb08[_0x4739('0x17')]++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});if(_0x2fbb08[_0x4739('0xf')]&&_0x2fbb08[_0x4739('0xf')]['hasOwnProperty'](_0x4739('0x22'))&&_0x2fbb08[_0x4739('0xf')][_0x4739('0x22')]!==_0x4739('0x23')){_0x2fbb08['extensions'][_0x4739('0x11')]({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':_0x4739('0x24'),'context':_0x3f73b8[_0x393903][0x0]['context'],'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')],'priority':_0x2fbb08['priority']++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});_0x2fbb08[_0x4739('0x19')][_0x4739('0x11')]({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':_0x4739('0x25')+_0x2fbb08[_0x4739('0xf')][_0x4739('0x22')]||_0x4739('0x26'),'context':_0x3f73b8[_0x393903][0x0]['context'],'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')],'priority':_0x2fbb08['priority']++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0]['VoiceExtensionId']});}}_0x2fbb08['extensions']['push']({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':_0x4739('0x27'),'context':_0x3f73b8[_0x393903][0x0]['context'],'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')],'priority':_0x2fbb08[_0x4739('0x17')]++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});_0x2fbb08['extensions'][_0x4739('0x11')]({'type':_0x3f73b8[_0x393903][0x0]['type'],'app':_0x4739('0x12'),'appdata':_0x4739('0x28'),'context':_0x3f73b8[_0x393903][0x0]['context'],'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')],'priority':_0x2fbb08[_0x4739('0x17')]++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});_0x2fbb08[_0x4739('0x19')]['push']({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':_0x4739('0x29'),'context':_0x3f73b8[_0x393903][0x0][_0x4739('0x16')],'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')],'priority':_0x2fbb08[_0x4739('0x17')]++,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]});for(var _0x1743dd=0x0,_0x52a118=0x0;_0x1743dd<_0x3f73b8[_0x393903][_0x4739('0x2a')];_0x1743dd+=0x1,_0x52a118=0x0){var _0x43c18b=_0x3f73b8[_0x393903][_0x1743dd];if(_0x43c18b[_0x4739('0x15')]){_0x43c18b[_0x4739('0x15')]=_0x43c18b[_0x4739('0x15')][_0x4739('0x2b')]();}var _0x17d55e=[];var _0x4ff782=[];delete _0x43c18b['id'];delete _0x43c18b[_0x4739('0x2c')];delete _0x43c18b[_0x4739('0x2d')];var _0x4c4893=_0x43c18b[_0x4739('0x2e')]!=='*,*,*,*'?[_0x43c18b[_0x4739('0x2e')]]:_0x43c18b[_0x4739('0x2f')]?_['map'](_[_0x4739('0xa')](_0x2fbb08[_0x4739('0x3')],{'IntervalId':_0x43c18b['IntervalId']}),_0x4739('0x2e')):[];if(_0x43c18b['hasOwnProperty']('tag')){if(_0x43c18b[_0x4739('0x30')]&&_0x43c18b[_0x4739('0x30')]!=='--'){_0x17d55e[_0x4739('0x11')]({'type':_0x43c18b[_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':_0x4739('0x31')+_0x43c18b[_0x4739('0x30')],'context':_0x43c18b['context'],'exten':_0x43c18b[_0x4739('0x8')],'priority':_0x4c4893[_0x4739('0x2a')]+_0x2fbb08[_0x4739('0x17')]+_0x52a118++,'VoiceExtensionId':_0x43c18b[_0x4739('0x1a')]});}}if(_0x43c18b[_0x4739('0x15')]===_0x4739('0x32')&&_0x43c18b[_0x4739('0xe')](_0x4739('0x33'))){if(_0x43c18b[_0x4739('0x33')]){_0x17d55e[_0x4739('0x11')]({'type':_0x43c18b[_0x4739('0x15')],'app':_0x4739('0x1f'),'appdata':_0x4739('0x34')+_0x43c18b[_0x4739('0x33')]+')','context':_0x43c18b[_0x4739('0x16')],'exten':_0x43c18b[_0x4739('0x8')],'priority':_0x4c4893[_0x4739('0x2a')]+_0x2fbb08['priority']+_0x52a118++,'VoiceExtensionId':_0x43c18b[_0x4739('0x1a')]});}else{_0x17d55e[_0x4739('0x11')]({'type':_0x43c18b['type'],'app':_0x4739('0x1f'),'appdata':_0x4739('0x35'),'context':_0x43c18b[_0x4739('0x16')],'exten':_0x43c18b[_0x4739('0x8')],'priority':_0x4c4893[_0x4739('0x2a')]+_0x2fbb08[_0x4739('0x17')]+_0x52a118++,'VoiceExtensionId':_0x43c18b[_0x4739('0x1a')]});}}if(_0x43c18b[_0x4739('0xe')](_0x4739('0x36'))){if(_0x4bfce9['indexOf'](_0x43c18b['app'][_0x4739('0x2b')]())>=0x0&&_0x43c18b['appType']!==_0x4739('0x37')){if(_0x43c18b['answer']){_0x17d55e[_0x4739('0x11')]({'type':_0x43c18b['type'],'app':_0x4739('0x1f'),'appdata':_0x4739('0x38'),'context':_0x43c18b['context'],'exten':_0x43c18b['exten'],'priority':_0x4c4893[_0x4739('0x2a')]+_0x2fbb08[_0x4739('0x17')]+_0x52a118++,'VoiceExtensionId':_0x43c18b[_0x4739('0x1a')]});_0x17d55e[_0x4739('0x11')]({'type':_0x43c18b[_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':_0x4739('0x39'),'context':_0x43c18b[_0x4739('0x16')],'exten':_0x43c18b['exten'],'priority':_0x4c4893[_0x4739('0x2a')]+_0x2fbb08[_0x4739('0x17')]+_0x52a118++,'VoiceExtensionId':_0x43c18b['VoiceExtensionId']});}else{_0x17d55e['push']({'type':_0x43c18b['type'],'app':_0x4739('0x1f'),'appdata':_0x4739('0x3a'),'context':_0x43c18b[_0x4739('0x16')],'exten':_0x43c18b[_0x4739('0x8')],'priority':_0x4c4893[_0x4739('0x2a')]+_0x2fbb08[_0x4739('0x17')]+_0x52a118++,'VoiceExtensionId':_0x43c18b['VoiceExtensionId']});_0x17d55e[_0x4739('0x11')]({'type':_0x43c18b[_0x4739('0x15')],'app':_0x4739('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x43c18b['context'],'exten':_0x43c18b[_0x4739('0x8')],'priority':_0x4c4893[_0x4739('0x2a')]+_0x2fbb08[_0x4739('0x17')]+_0x52a118++,'VoiceExtensionId':_0x43c18b['VoiceExtensionId']});}}}for(var _0x2db529=0x0;_0x2db529<_0x4c4893[_0x4739('0x2a')];_0x2db529+=0x1){var _0x18a354=_0x2fbb08[_0x4739('0x17')]+_0x4c4893[_0x4739('0x2a')];var _0x5674f6=_0x2db529===_0x4c4893[_0x4739('0x2a')]-0x1?_0x2fbb08[_0x4739('0x17')]+_0x17d55e[_0x4739('0x2a')]+_0x4ff782['length']+0x2:_0x2fbb08[_0x4739('0x17')]+_0x2db529+0x1;_0x17d55e[_0x4739('0x3b')](_0x2db529,0x0,{'type':_0x43c18b[_0x4739('0x15')],'app':_0x4739('0x3c'),'appdata':_0x4c4893[_0x2db529]+'?'+_0x43c18b[_0x4739('0x16')]+_0x4739('0x3d')+_0x18a354+':'+_0x43c18b[_0x4739('0x16')]+_0x4739('0x3d')+_0x5674f6,'exten':_0x43c18b['exten'],'context':_0x43c18b[_0x4739('0x16')],'priority':_0x2fbb08[_0x4739('0x17')]+_0x2db529,'VoiceExtensionId':_0x3f73b8[_0x393903][0x0]['VoiceExtensionId']});}_0x43c18b[_0x4739('0x17')]=_0x17d55e['length']?_['last'](_0x17d55e)['priority']+0x1:_0x2fbb08[_0x4739('0x17')];_0x2fbb08[_0x4739('0x17')]=(_0x4ff782[_0x4739('0x2a')]?_[_0x4739('0x3e')](_0x4ff782)['priority']:_0x43c18b[_0x4739('0x17')])+0x1;_0x2fbb08[_0x4739('0x19')]=_[_0x4739('0x3f')](_0x2fbb08[_0x4739('0x19')],_0x17d55e,[_0x43c18b],_0x4ff782);}_0x2fbb08['extensions'][_0x4739('0x11')]({'type':_0x3f73b8[_0x393903][0x0][_0x4739('0x15')],'app':_0x4739('0x40'),'exten':_0x3f73b8[_0x393903][0x0][_0x4739('0x8')],'context':_0x3f73b8[_0x393903][0x0]['context'],'priority':_0x2fbb08[_0x4739('0x17')],'VoiceExtensionId':_0x3f73b8[_0x393903][0x0]['VoiceExtensionId']});_0x2adc17[_0x4739('0x11')](_0x3f73b8[_0x393903][0x0][_0x4739('0x1a')]);_0x2e7cdf=_['concat'](_0x2e7cdf,_0x2fbb08[_0x4739('0x19')]);}}return _0xff53a8[_0x4739('0x41')](function(_0x38d413){return _0xff53a8[_0x4739('0x4')][_0x4739('0x5')][_0x4739('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x2adc17}},'transaction':_0x38d413})[_0x4739('0x7')](function(_0x4cba76){return _0xff53a8['models']['VoiceExtension']['bulkCreate'](_['sortBy'](_0x2e7cdf,_0x4739('0x17')),{'transaction':_0x38d413});});});})[_0x4739('0x43')](function(_0x5aed48){console[_0x4739('0x44')](_0x5aed48);});}exports[_0x4739('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2f18840..5c0dc8a 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 _0xa1d0=['Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','test','isNil','errors','length','join','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','CmList','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','info','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','zipObject','split'];(function(_0x2554a9,_0x466c5a){var _0x22b0df=function(_0xe96591){while(--_0xe96591){_0x2554a9['push'](_0x2554a9['shift']());}};_0x22b0df(++_0x466c5a);}(_0xa1d0,0x19f));var _0x0a1d=function(_0x2ba95a,_0x4f1647){_0x2ba95a=_0x2ba95a-0x0;var _0x37387c=_0xa1d0[_0x2ba95a];return _0x37387c;};'use strict';var BPromise=require(_0x0a1d('0x0'));var util=require(_0x0a1d('0x1'));var _=require(_0x0a1d('0x2'));var fs=require('fs');var squel=require(_0x0a1d('0x3'));var Papa=require(_0x0a1d('0x4'));var Redis=require(_0x0a1d('0x5'));var db=require(_0x0a1d('0x6'))['db'];var config=require(_0x0a1d('0x7'));var logger=require(_0x0a1d('0x8'))(_0x0a1d('0x9'));config[_0x0a1d('0xa')]=_[_0x0a1d('0xb')](config[_0x0a1d('0xa')],{'host':_0x0a1d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a1d('0xa')]));require(_0x0a1d('0xd'))[_0x0a1d('0xe')](socket);try{if(!process[_0x0a1d('0xf')][0x2]||process[_0x0a1d('0xf')][0x2]===_0x0a1d('0x10')||process[_0x0a1d('0xf')][0x2]==='null'){throw new Error(_0x0a1d('0x11'));}var FILEPATH=process[_0x0a1d('0xf')][0x2];if(!process[_0x0a1d('0xf')][0x3]||process[_0x0a1d('0xf')][0x3]==='undefined'||process[_0x0a1d('0xf')][0x3]===_0x0a1d('0x12')||!process[_0x0a1d('0xf')][0x4]||process['argv'][0x4]===_0x0a1d('0x10')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x0a1d('0x13')](process[_0x0a1d('0xf')][0x3][_0x0a1d('0x14')](','),process[_0x0a1d('0xf')][0x4][_0x0a1d('0x14')](','));if(!process[_0x0a1d('0xf')][0x5]||process[_0x0a1d('0xf')][0x5]===_0x0a1d('0x10')||process[_0x0a1d('0xf')][0x5]==='null'){throw new Error(_0x0a1d('0x15'));}var LISTID=process[_0x0a1d('0xf')][0x5];var COMPANYID=process[_0x0a1d('0xf')][0x6]&&process[_0x0a1d('0xf')][0x6]!==_0x0a1d('0x10')&&process[_0x0a1d('0xf')][0x6]!==_0x0a1d('0x12')?process[_0x0a1d('0xf')][0x6]:null;var DUPLICATES=process[_0x0a1d('0xf')][0x7]&&process[_0x0a1d('0xf')][0x7]!==_0x0a1d('0x10')&&process['argv'][0x7]!==_0x0a1d('0x12')?process[_0x0a1d('0xf')][0x7]:null;if(!process[_0x0a1d('0xf')][0x8]||process['argv'][0x8]===_0x0a1d('0x10')||process['argv'][0x8]===_0x0a1d('0x12')){throw new Error(_0x0a1d('0x16'));}var SOCKET_TIMESTAMP=process[_0x0a1d('0xf')][0x8];}catch(_0x119c57){logger[_0x0a1d('0x17')](_0x119c57);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(_0x14ef10,_0x555017,_0xab2456,_0x2977cb){var _0x4487a6={'message':_0x555017};_0x4487a6[_0x14ef10]=!![];if(_0xab2456){_0x4487a6['contact']=_0xab2456;}if(_0x2977cb){_0x4487a6['index']=_0x2977cb;}return _0x4487a6;}function isEmail(_0x11d2d4){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))*$/[_0x0a1d('0x18')](_0x11d2d4);}function checkRow(_0x1077c9,_0xbe19b2,_0x459d6d){return new BPromise(function(_0x5d3d09,_0x213eab){if(_[_0x0a1d('0x19')](_0x1077c9)){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x459d6d));}if(_0x1077c9[_0x0a1d('0x1a')]&&_0x1077c9[_0x0a1d('0x1a')][_0x0a1d('0x1b')]){var _0x405833=_['map'](_0x1077c9[_0x0a1d('0x1a')],'message')[_0x0a1d('0x1c')](';');return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),_0x405833,null,_0x459d6d));}var _0x5c1c9f={};for(var _0x255ab0 in FIELDS){if(FIELDS['hasOwnProperty'](_0x255ab0)&&FIELDS[_0x255ab0]){_0x5c1c9f[_0x255ab0]=_0x1077c9['data'][0x0][FIELDS[_0x255ab0]]||_0x1077c9['data'][0x0]['\ufeff'+FIELDS[_0x255ab0]];}}if(!_0x5c1c9f[_0x0a1d('0x1d')]){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),_0x0a1d('0x1e'),null,_0x459d6d));}if(!_0x5c1c9f[_0x0a1d('0x1f')]){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),_0x0a1d('0x20'),null,_0x459d6d));}if(_0x5c1c9f['birthDate']){var _0x4701bf=moment(_0x5c1c9f['birthDate'],_0x0a1d('0x21'));if(!_0x4701bf[_0x0a1d('0x22')]()){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x459d6d));}}if(_0x5c1c9f[_0x0a1d('0x23')]){if(!isEmail(_0x5c1c9f['email'])){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),_0x0a1d('0x24'),null,_0x459d6d));}}_0x5c1c9f['ListId']=LISTID;_0x5c1c9f[_0x0a1d('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0a1d('0x1b')]&&_0xbe19b2){var _0x62efef={};for(var _0x521eec=0x0,_0x5a96b7=DUPLICATES[_0x0a1d('0x1b')];_0x521eec<_0x5a96b7;_0x521eec+=0x1){_0x62efef[DUPLICATES[_0x521eec]]=_0x5c1c9f[DUPLICATES[_0x521eec]];}var _0x5331a9=_[_0x0a1d('0x26')](_0xbe19b2,_0x62efef);if(_0x5331a9){return _0x213eab(handleCheckRowError(_0x0a1d('0x27'),'Duplicate\x20Contact',_0x5331a9,_0x459d6d));}}return db['CmContact'][_0x0a1d('0x28')](_0x5c1c9f,{'raw':!![],'hooks':![],'fields':_[_0x0a1d('0x29')](_0x5c1c9f)})[_0x0a1d('0x2a')](function(_0xb8b43){if(DUPLICATES&&DUPLICATES[_0x0a1d('0x1b')]&&_0xbe19b2){_0xbe19b2[_0x0a1d('0x2b')](_[_0x0a1d('0x2c')](_0x5c1c9f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xb8b43['id'];return _0x5d3d09();})[_0x0a1d('0x2d')](function(_0x23058f){return _0x213eab(handleCheckRowError('error',_0x0a1d('0x2e')+(_0x23058f[_0x0a1d('0x2f')]||JSON[_0x0a1d('0x30')](_0x23058f)),null,_0x459d6d));});});}function checkHopper(){function _0x1d8052(){return function(_0x35177e){logger[_0x0a1d('0x17')](_0x0a1d('0x31'),_0x0a1d('0x32'),util[_0x0a1d('0x33')](_0x35177e,{'showHidden':![],'depth':null}));};}var _0xfa5836=function(_0x1a6581,_0x14c096){var _0x373e47=squel[_0x0a1d('0x34')]()[_0x0a1d('0x35')]('cm_hopper')[_0x0a1d('0x36')]([_0x0a1d('0x1f'),_0x0a1d('0x37'),_0x0a1d('0x38'),_0x0a1d('0x39'),_0x14c096,_0x0a1d('0x3a'),_0x0a1d('0x3b')],squel[_0x0a1d('0x3c')]()[_0x0a1d('0x3d')](_0x0a1d('0x1f'),_0x0a1d('0x1f'))['field']('NOW()',_0x0a1d('0x37'))[_0x0a1d('0x3d')]('id',_0x0a1d('0x38'))[_0x0a1d('0x3d')](LISTID[_0x0a1d('0x3e')](),'ListId')['field'](_0x1a6581['id'][_0x0a1d('0x3e')](),_0x14c096)[_0x0a1d('0x3d')](_0x0a1d('0x3f'),'createdAt')[_0x0a1d('0x3d')](_0x0a1d('0x3f'),'updatedAt')[_0x0a1d('0x40')](_0x0a1d('0x41'))[_0x0a1d('0x42')](_0x0a1d('0x43'))[_0x0a1d('0x42')](_0x0a1d('0x44'),LISTID['toString']())[_0x0a1d('0x42')](_0x0a1d('0x45'))[_0x0a1d('0x42')](_0x0a1d('0x46'),squel['select']()[_0x0a1d('0x3d')](_0x0a1d('0x1f'))[_0x0a1d('0x40')](_0x0a1d('0x47'))[_0x0a1d('0x42')](_0x14c096+_0x0a1d('0x48'),_0x1a6581['id'][_0x0a1d('0x3e')]())))[_0x0a1d('0x3e')]();return _0x373e47;};var _0x2b7742=function(_0x259917,_0x7a091e){var _0x5167de=squel[_0x0a1d('0x34')]()['into'](_0x0a1d('0x47'))[_0x0a1d('0x36')]([_0x0a1d('0x1f'),_0x0a1d('0x37'),_0x0a1d('0x38'),_0x0a1d('0x39'),_0x7a091e,_0x0a1d('0x3a'),'updatedAt'],squel[_0x0a1d('0x3c')]()['field']('phone',_0x0a1d('0x1f'))[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x37'))['field']('id','ContactId')[_0x0a1d('0x3d')](LISTID[_0x0a1d('0x3e')](),_0x0a1d('0x39'))[_0x0a1d('0x3d')](_0x259917['id']['toString'](),_0x7a091e)[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x3a'))[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x3b'))[_0x0a1d('0x40')]('cm_contacts')[_0x0a1d('0x42')](_0x0a1d('0x43'))['where'](_0x0a1d('0x44'),LISTID[_0x0a1d('0x3e')]())[_0x0a1d('0x42')](_0x0a1d('0x49'),squel[_0x0a1d('0x4a')](hopperContacts))[_0x0a1d('0x42')](_0x0a1d('0x45'))[_0x0a1d('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a1d('0x3c')]()[_0x0a1d('0x3d')](_0x0a1d('0x4b'))[_0x0a1d('0x40')](_0x0a1d('0x4c'))[_0x0a1d('0x42')](_0x7a091e+_0x0a1d('0x48'),_0x259917['id'][_0x0a1d('0x3e')]()))[_0x0a1d('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a1d('0x3c')]()[_0x0a1d('0x3d')]('phone')[_0x0a1d('0x40')](_0x0a1d('0x47'))[_0x0a1d('0x42')](_0x7a091e+'\x20=\x20?',_0x259917['id'][_0x0a1d('0x3e')]())))[_0x0a1d('0x3e')]();return _0x5167de;};function _0x13b1cf(_0x3b29b2,_0x1795e3){var _0xac9161=squel[_0x0a1d('0x34')]()[_0x0a1d('0x35')](_0x0a1d('0x47'))['fromQuery']([_0x0a1d('0x1f'),'scheduledAt',_0x0a1d('0x38'),_0x0a1d('0x39'),_0x1795e3,_0x0a1d('0x3a'),_0x0a1d('0x3b')],squel[_0x0a1d('0x3c')]()['field'](_0x0a1d('0x1f'),_0x0a1d('0x1f'))['field'](_0x0a1d('0x3f'),_0x0a1d('0x37'))[_0x0a1d('0x3d')]('id','ContactId')[_0x0a1d('0x3d')](LISTID['toString'](),_0x0a1d('0x39'))[_0x0a1d('0x3d')](_0x3b29b2['id'][_0x0a1d('0x3e')](),_0x1795e3)[_0x0a1d('0x3d')]('NOW()',_0x0a1d('0x3a'))[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x3b'))['from'](_0x0a1d('0x41'))[_0x0a1d('0x42')](_0x0a1d('0x43'))['where'](_0x0a1d('0x44'),LISTID[_0x0a1d('0x3e')]())[_0x0a1d('0x42')](_0x0a1d('0x49'),squel[_0x0a1d('0x4a')](hopperContacts))[_0x0a1d('0x42')](_0x0a1d('0x45')))[_0x0a1d('0x3e')]();return _0xac9161;}function _0x19fe09(_0x1e2dc5,_0x320953){var _0x281ba1=squel[_0x0a1d('0x34')]()[_0x0a1d('0x35')](_0x0a1d('0x4d'))['fromQuery']([_0x0a1d('0x1f'),_0x0a1d('0x38'),_0x0a1d('0x39'),_0x320953,_0x0a1d('0x3a'),_0x0a1d('0x3b')],squel[_0x0a1d('0x3c')]()['field'](_0x0a1d('0x1f'),_0x0a1d('0x1f'))[_0x0a1d('0x3d')]('id',_0x0a1d('0x38'))['field'](LISTID['toString'](),_0x0a1d('0x39'))[_0x0a1d('0x3d')](_0x1e2dc5['id'][_0x0a1d('0x3e')](),_0x320953)[_0x0a1d('0x3d')](_0x0a1d('0x3f'),'createdAt')[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x3b'))['from'](_0x0a1d('0x41'))[_0x0a1d('0x42')](_0x0a1d('0x43'))[_0x0a1d('0x42')]('ListId\x20=\x20?',LISTID[_0x0a1d('0x3e')]())[_0x0a1d('0x42')]('id\x20IN\x20?',squel[_0x0a1d('0x4a')](hopperContacts))[_0x0a1d('0x42')](_0x0a1d('0x45')))['toString']();return _0x281ba1;}return db[_0x0a1d('0x4e')][_0x0a1d('0x4f')]({'where':{'type':_0x0a1d('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0a1d('0x51'),'where':{'id':LISTID}}]})[_0x0a1d('0x2a')](function(_0x5421){var _0x1fb1e7=[];if(_0x5421){var _0x233a57;for(var _0x7d8094=0x0,_0x4530f8;_0x7d8094<_0x5421['length'];_0x7d8094+=0x1){_0x4530f8=_0x5421[_0x7d8094][_0x0a1d('0x52')]({'plain':!![]});switch(_0x4530f8['dialCheckDuplicateType']){case _0x0a1d('0x53'):_0x1fb1e7[_0x0a1d('0x2b')](db[_0x0a1d('0x54')]['query'](_0x2b7742(_0x4530f8,_0x0a1d('0x55')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));break;case _0x0a1d('0x56'):_0x1fb1e7[_0x0a1d('0x2b')](db[_0x0a1d('0x54')][_0x0a1d('0x57')](_0xfa5836(_0x4530f8,_0x0a1d('0x55')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));break;default:_0x1fb1e7[_0x0a1d('0x2b')](db[_0x0a1d('0x54')][_0x0a1d('0x57')](_0x13b1cf(_0x4530f8,'VoiceQueueId'))[_0x0a1d('0x2a')](function(){})['catch'](_0x1d8052()));}}}return _0x1fb1e7;})['all']()[_0x0a1d('0x2a')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x0a1d('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a1d('0x58')],'as':_0x0a1d('0x59'),'where':{'id':LISTID}}]})[_0x0a1d('0x2a')](function(_0x34c5dd){var _0x2dd549=[];if(_0x34c5dd){var _0x373163;for(var _0x322943=0x0,_0x346adf;_0x322943<_0x34c5dd[_0x0a1d('0x1b')];_0x322943+=0x1){_0x346adf=_0x34c5dd[_0x322943][_0x0a1d('0x52')]({'plain':!![]});_0x2dd549[_0x0a1d('0x2b')](db[_0x0a1d('0x54')]['query'](_0x19fe09(_0x346adf,_0x0a1d('0x55')))[_0x0a1d('0x2a')](function(){})['catch'](_0x1d8052()));}}return _0x2dd549;})[_0x0a1d('0x5a')]();})[_0x0a1d('0x2a')](function(){return db[_0x0a1d('0x5b')][_0x0a1d('0x4f')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0a1d('0x58')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a1d('0x2a')](function(_0x43bddd){var _0x3bc8b0=[];if(_0x43bddd){for(var _0x5aca44=0x0,_0x302a1a;_0x5aca44<_0x43bddd[_0x0a1d('0x1b')];_0x5aca44+=0x1){_0x302a1a=_0x43bddd[_0x5aca44][_0x0a1d('0x52')]({'plain':!![]});switch(_0x302a1a['dialCheckDuplicateType']){case _0x0a1d('0x53'):_0x3bc8b0[_0x0a1d('0x2b')](db['sequelize'][_0x0a1d('0x57')](_0x2b7742(_0x302a1a,'CampaignId'))[_0x0a1d('0x2a')](function(){})['catch'](_0x1d8052()));break;case _0x0a1d('0x56'):_0x3bc8b0['push'](db[_0x0a1d('0x54')]['query'](_0xfa5836(_0x302a1a,_0x0a1d('0x5c')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));break;default:_0x3bc8b0[_0x0a1d('0x2b')](db[_0x0a1d('0x54')]['query'](_0x13b1cf(_0x302a1a,_0x0a1d('0x5c')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));}}}return _0x3bc8b0;})[_0x0a1d('0x5a')]();})[_0x0a1d('0x2a')](function(){return db['Campaign'][_0x0a1d('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0a1d('0x58')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0a1d('0x2a')](function(_0x417863){var _0x2a088b=[];if(_0x417863){for(var _0x5247db=0x0,_0x5bdd9b;_0x5247db<_0x417863[_0x0a1d('0x1b')];_0x5247db+=0x1){_0x5bdd9b=_0x417863[_0x5247db][_0x0a1d('0x52')]({'plain':!![]});_0x2a088b[_0x0a1d('0x2b')](db['sequelize'][_0x0a1d('0x57')](_0x19fe09(_0x5bdd9b,_0x0a1d('0x5c')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));}}return _0x2a088b;})[_0x0a1d('0x5a')]();})['catch'](function(_0x5d8386){logger[_0x0a1d('0x17')](_0x0a1d('0x5d'),_0x0a1d('0x5e'),_0x5d8386[_0x0a1d('0x2f')]);});}var processPromises=function(_0x30a1d0){return BPromise[_0x0a1d('0x5a')](promises)[_0x0a1d('0x2a')](function(_0x1de868){})['catch'](function(_0x560df5){logger[_0x0a1d('0x17')](_0x0a1d('0x5f'),JSON[_0x0a1d('0x30')](_0x560df5));})[_0x0a1d('0x60')](function(){socket['emit'](_0x0a1d('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x30a1d0){return _0x30a1d0[_0x0a1d('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x0a1d('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x0a1d('0x2a')](function(){socket['emit'](_0x0a1d('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a1d('0x63')](FILEPATH);}catch(_0x21feab){logger['error'](_0x0a1d('0x64'),JSON[_0x0a1d('0x30')](_0x21feab));}finally{process[_0x0a1d('0x65')](0x0);}});};process['on'](_0x0a1d('0x66'),function(){logger['info'](_0x0a1d('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0x0a1d('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a1d('0x14')](',');return db[_0x0a1d('0x68')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0a1d('0x2a')](function(_0x56aeca){var _0x458175=fs[_0x0a1d('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a1d('0x6a')](_0x458175,{'header':!![],'skipEmptyLines':!![],'step':function(_0x11df5b,_0x4521de){total+=0x1;var _0x43c662=total;promises[_0x0a1d('0x2b')](checkRow(_0x11df5b,_0x56aeca,_0x43c662)['then'](function(){success+=0x1;})[_0x0a1d('0x2d')](function(_0x1ad142){if(_0x1ad142['error']){errors+=0x1;delete _0x1ad142[_0x0a1d('0x17')];}else if(_0x1ad142[_0x0a1d('0x27')]){duplicates+=0x1;delete _0x1ad142[_0x0a1d('0x27')];}rows[_0x0a1d('0x2b')](_0x1ad142);}));if(total%0xc8===0x0){_0x4521de['pause']();return processPromises(_0x4521de);}},'complete':function(){return processPromises()[_0x0a1d('0x2a')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x500094,_0x51c8bb){logger[_0x0a1d('0x6b')](_0x0a1d('0x6c'),JSON[_0x0a1d('0x30')](_0x500094));endCsv();}});})[_0x0a1d('0x2d')](function(_0x286b0e){logger[_0x0a1d('0x17')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x286b0e));});}main(); \ No newline at end of file +var _0xb538=['str','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','VoiceQueueId','query','all','BlackLists','get','Campaign','CampaignId','onlyIfOpen','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','util','lodash','squel','papaparse','ioredis','../../../config/environment','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','length','map','errors','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','duplicate','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','into','id\x20IN\x20?'];(function(_0x4fe8c3,_0x466667){var _0x50235b=function(_0x50b190){while(--_0x50b190){_0x4fe8c3['push'](_0x4fe8c3['shift']());}};_0x50235b(++_0x466667);}(_0xb538,0x15c));var _0x8b53=function(_0x2c89a8,_0x51750d){_0x2c89a8=_0x2c89a8-0x0;var _0x3d6e33=_0xb538[_0x2c89a8];return _0x3d6e33;};'use strict';var BPromise=require('bluebird');var util=require(_0x8b53('0x0'));var _=require(_0x8b53('0x1'));var fs=require('fs');var squel=require(_0x8b53('0x2'));var Papa=require(_0x8b53('0x3'));var Redis=require(_0x8b53('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x8b53('0x5'));var logger=require('../../../config/logger')('api');config[_0x8b53('0x6')]=_['defaults'](config['redis'],{'host':_0x8b53('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b53('0x6')]));require(_0x8b53('0x8'))['register'](socket);try{if(!process[_0x8b53('0x9')][0x2]||process[_0x8b53('0x9')][0x2]===_0x8b53('0xa')||process[_0x8b53('0x9')][0x2]===_0x8b53('0xb')){throw new Error(_0x8b53('0xc'));}var FILEPATH=process[_0x8b53('0x9')][0x2];if(!process[_0x8b53('0x9')][0x3]||process['argv'][0x3]==='undefined'||process[_0x8b53('0x9')][0x3]==='null'||!process['argv'][0x4]||process[_0x8b53('0x9')][0x4]==='undefined'||process[_0x8b53('0x9')][0x4]===_0x8b53('0xb')){throw new Error(_0x8b53('0xd'));}var FIELDS=_[_0x8b53('0xe')](process[_0x8b53('0x9')][0x3][_0x8b53('0xf')](','),process[_0x8b53('0x9')][0x4]['split'](','));if(!process[_0x8b53('0x9')][0x5]||process[_0x8b53('0x9')][0x5]===_0x8b53('0xa')||process[_0x8b53('0x9')][0x5]===_0x8b53('0xb')){throw new Error(_0x8b53('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x8b53('0x9')][0x6]&&process[_0x8b53('0x9')][0x6]!==_0x8b53('0xa')&&process[_0x8b53('0x9')][0x6]!=='null'?process[_0x8b53('0x9')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x8b53('0x9')][0x7]!=='undefined'&&process['argv'][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x8b53('0x9')][0x8]||process['argv'][0x8]===_0x8b53('0xa')||process[_0x8b53('0x9')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x8b53('0x9')][0x8];}catch(_0x478247){logger[_0x8b53('0x11')](_0x478247);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(_0x76e34,_0x55a3f5,_0x384190,_0x2c021c){var _0x4a3bad={'message':_0x55a3f5};_0x4a3bad[_0x76e34]=!![];if(_0x384190){_0x4a3bad[_0x8b53('0x12')]=_0x384190;}if(_0x2c021c){_0x4a3bad[_0x8b53('0x13')]=_0x2c021c;}return _0x4a3bad;}function isEmail(_0x5d6127){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'](_0x5d6127);}function checkRow(_0x5a4a5c,_0x376af6,_0x2dfb57){return new BPromise(function(_0x4dbdf6,_0x28abfe){if(_[_0x8b53('0x14')](_0x5a4a5c)){return _0x28abfe(handleCheckRowError(_0x8b53('0x11'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2dfb57));}if(_0x5a4a5c['errors']&&_0x5a4a5c['errors'][_0x8b53('0x15')]){var _0x3d2f73=_[_0x8b53('0x16')](_0x5a4a5c[_0x8b53('0x17')],_0x8b53('0x18'))[_0x8b53('0x19')](';');return _0x28abfe(handleCheckRowError(_0x8b53('0x11'),_0x3d2f73,null,_0x2dfb57));}var _0x2b3030={};for(var _0x552f62 in FIELDS){if(FIELDS[_0x8b53('0x1a')](_0x552f62)&&FIELDS[_0x552f62]){_0x2b3030[_0x552f62]=_0x5a4a5c[_0x8b53('0x1b')][0x0][FIELDS[_0x552f62]]||_0x5a4a5c[_0x8b53('0x1b')][0x0]['\ufeff'+FIELDS[_0x552f62]];}}if(!_0x2b3030[_0x8b53('0x1c')]){return _0x28abfe(handleCheckRowError(_0x8b53('0x11'),_0x8b53('0x1d'),null,_0x2dfb57));}if(!_0x2b3030[_0x8b53('0x1e')]){return _0x28abfe(handleCheckRowError(_0x8b53('0x11'),'phone\x20not\x20specified!',null,_0x2dfb57));}if(_0x2b3030[_0x8b53('0x1f')]){var _0xfd0b3f=moment(_0x2b3030[_0x8b53('0x1f')],'YYYY-MM-DD');if(!_0xfd0b3f['isValid']()){return _0x28abfe(handleCheckRowError(_0x8b53('0x11'),_0x8b53('0x20'),null,_0x2dfb57));}}if(_0x2b3030[_0x8b53('0x21')]){if(!isEmail(_0x2b3030[_0x8b53('0x21')])){return _0x28abfe(handleCheckRowError(_0x8b53('0x11'),'email\x20format\x20is\x20not\x20valid!',null,_0x2dfb57));}}_0x2b3030['ListId']=LISTID;_0x2b3030[_0x8b53('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x376af6){var _0x23bda6={};for(var _0x50b401=0x0,_0x3a14a5=DUPLICATES[_0x8b53('0x15')];_0x50b401<_0x3a14a5;_0x50b401+=0x1){_0x23bda6[DUPLICATES[_0x50b401]]=_0x2b3030[DUPLICATES[_0x50b401]];}var _0x26be37=_[_0x8b53('0x23')](_0x376af6,_0x23bda6);if(_0x26be37){return _0x28abfe(handleCheckRowError(_0x8b53('0x24'),'Duplicate\x20Contact',_0x26be37,_0x2dfb57));}}return db[_0x8b53('0x25')][_0x8b53('0x26')](_0x2b3030,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2b3030)})[_0x8b53('0x27')](function(_0x299cf3){if(DUPLICATES&&DUPLICATES[_0x8b53('0x15')]&&_0x376af6){_0x376af6[_0x8b53('0x28')](_[_0x8b53('0x29')](_0x2b3030,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x299cf3['id'];return _0x4dbdf6();})[_0x8b53('0x2a')](function(_0x5cc809){return _0x28abfe(handleCheckRowError(_0x8b53('0x11'),_0x8b53('0x2b')+(_0x5cc809[_0x8b53('0x18')]||JSON[_0x8b53('0x2c')](_0x5cc809)),null,_0x2dfb57));});});}function checkHopper(){function _0x9bef10(){return function(_0x323f0a){logger[_0x8b53('0x11')]('cmContact',_0x8b53('0x2d'),util[_0x8b53('0x2e')](_0x323f0a,{'showHidden':![],'depth':null}));};}var _0x4e7d2b=function(_0x302b85,_0x5ae1d5){var _0x20b99c=squel[_0x8b53('0x2f')]()['into'](_0x8b53('0x30'))[_0x8b53('0x31')]([_0x8b53('0x1e'),_0x8b53('0x32'),_0x8b53('0x33'),_0x8b53('0x34'),_0x5ae1d5,_0x8b53('0x35'),_0x8b53('0x36')],squel[_0x8b53('0x37')]()[_0x8b53('0x38')]('phone',_0x8b53('0x1e'))[_0x8b53('0x38')]('NOW()',_0x8b53('0x32'))['field']('id',_0x8b53('0x33'))[_0x8b53('0x38')](LISTID[_0x8b53('0x39')](),_0x8b53('0x34'))[_0x8b53('0x38')](_0x302b85['id']['toString'](),_0x5ae1d5)['field'](_0x8b53('0x3a'),_0x8b53('0x35'))[_0x8b53('0x38')](_0x8b53('0x3a'),_0x8b53('0x36'))[_0x8b53('0x3b')](_0x8b53('0x3c'))[_0x8b53('0x3d')](_0x8b53('0x3e'))[_0x8b53('0x3d')](_0x8b53('0x3f'),LISTID[_0x8b53('0x39')]())[_0x8b53('0x3d')](_0x8b53('0x40'))[_0x8b53('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x8b53('0x38')]('phone')['from'](_0x8b53('0x30'))[_0x8b53('0x3d')](_0x5ae1d5+_0x8b53('0x41'),_0x302b85['id'][_0x8b53('0x39')]())))[_0x8b53('0x39')]();return _0x20b99c;};var _0x2d8015=function(_0x3ba2f4,_0x4e57a0){var _0x394962=squel[_0x8b53('0x2f')]()[_0x8b53('0x42')](_0x8b53('0x30'))[_0x8b53('0x31')]([_0x8b53('0x1e'),_0x8b53('0x32'),_0x8b53('0x33'),_0x8b53('0x34'),_0x4e57a0,_0x8b53('0x35'),_0x8b53('0x36')],squel[_0x8b53('0x37')]()[_0x8b53('0x38')]('phone','phone')[_0x8b53('0x38')](_0x8b53('0x3a'),'scheduledAt')[_0x8b53('0x38')]('id',_0x8b53('0x33'))['field'](LISTID['toString'](),_0x8b53('0x34'))[_0x8b53('0x38')](_0x3ba2f4['id'][_0x8b53('0x39')](),_0x4e57a0)[_0x8b53('0x38')]('NOW()',_0x8b53('0x35'))[_0x8b53('0x38')](_0x8b53('0x3a'),_0x8b53('0x36'))[_0x8b53('0x3b')](_0x8b53('0x3c'))[_0x8b53('0x3d')](_0x8b53('0x3e'))[_0x8b53('0x3d')]('ListId\x20=\x20?',LISTID[_0x8b53('0x39')]())[_0x8b53('0x3d')](_0x8b53('0x43'),squel[_0x8b53('0x44')](hopperContacts))[_0x8b53('0x3d')](_0x8b53('0x40'))['where'](_0x8b53('0x45'),squel[_0x8b53('0x37')]()[_0x8b53('0x38')]('calleridnum')[_0x8b53('0x3b')](_0x8b53('0x46'))['where'](_0x4e57a0+_0x8b53('0x41'),_0x3ba2f4['id']['toString']()))[_0x8b53('0x3d')](_0x8b53('0x45'),squel['select']()['field'](_0x8b53('0x1e'))[_0x8b53('0x3b')]('cm_hopper')[_0x8b53('0x3d')](_0x4e57a0+_0x8b53('0x41'),_0x3ba2f4['id'][_0x8b53('0x39')]())))[_0x8b53('0x39')]();return _0x394962;};function _0x14965d(_0x4b7f68,_0x282cb2){var _0x1ea7b5=squel[_0x8b53('0x2f')]()[_0x8b53('0x42')]('cm_hopper')[_0x8b53('0x31')]([_0x8b53('0x1e'),_0x8b53('0x32'),_0x8b53('0x33'),_0x8b53('0x34'),_0x282cb2,'createdAt','updatedAt'],squel[_0x8b53('0x37')]()[_0x8b53('0x38')]('phone',_0x8b53('0x1e'))[_0x8b53('0x38')](_0x8b53('0x3a'),_0x8b53('0x32'))['field']('id','ContactId')[_0x8b53('0x38')](LISTID[_0x8b53('0x39')](),_0x8b53('0x34'))[_0x8b53('0x38')](_0x4b7f68['id'][_0x8b53('0x39')](),_0x282cb2)[_0x8b53('0x38')](_0x8b53('0x3a'),_0x8b53('0x35'))[_0x8b53('0x38')]('NOW()',_0x8b53('0x36'))['from']('cm_contacts')[_0x8b53('0x3d')](_0x8b53('0x3e'))[_0x8b53('0x3d')](_0x8b53('0x3f'),LISTID[_0x8b53('0x39')]())[_0x8b53('0x3d')](_0x8b53('0x43'),squel['str'](hopperContacts))[_0x8b53('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x1ea7b5;}function _0x3cec07(_0x145ee1,_0x84973d){var _0x33daaa=squel[_0x8b53('0x2f')]()[_0x8b53('0x42')](_0x8b53('0x47'))[_0x8b53('0x31')]([_0x8b53('0x1e'),_0x8b53('0x33'),'ListId',_0x84973d,_0x8b53('0x35'),_0x8b53('0x36')],squel[_0x8b53('0x37')]()[_0x8b53('0x38')]('phone','phone')[_0x8b53('0x38')]('id',_0x8b53('0x33'))[_0x8b53('0x38')](LISTID[_0x8b53('0x39')](),_0x8b53('0x34'))['field'](_0x145ee1['id']['toString'](),_0x84973d)[_0x8b53('0x38')](_0x8b53('0x3a'),'createdAt')[_0x8b53('0x38')]('NOW()','updatedAt')['from'](_0x8b53('0x3c'))[_0x8b53('0x3d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x8b53('0x39')]())[_0x8b53('0x3d')](_0x8b53('0x43'),squel[_0x8b53('0x44')](hopperContacts))[_0x8b53('0x3d')](_0x8b53('0x40')))[_0x8b53('0x39')]();return _0x33daaa;}return db[_0x8b53('0x48')][_0x8b53('0x49')]({'where':{'type':_0x8b53('0x4a')},'attributes':['id',_0x8b53('0x4b')],'include':[{'model':db[_0x8b53('0x4c')],'as':_0x8b53('0x4d'),'where':{'id':LISTID}}]})[_0x8b53('0x27')](function(_0x108f44){var _0x8eedd=[];if(_0x108f44){var _0x2f67bb;for(var _0x44a573=0x0,_0x41fc89;_0x44a573<_0x108f44[_0x8b53('0x15')];_0x44a573+=0x1){_0x41fc89=_0x108f44[_0x44a573]['get']({'plain':!![]});switch(_0x41fc89[_0x8b53('0x4b')]){case _0x8b53('0x4e'):_0x8eedd[_0x8b53('0x28')](db[_0x8b53('0x4f')]['query'](_0x2d8015(_0x41fc89,_0x8b53('0x50')))[_0x8b53('0x27')](function(){})[_0x8b53('0x2a')](_0x9bef10()));break;case'onlyIfOpen':_0x8eedd['push'](db['sequelize'][_0x8b53('0x51')](_0x4e7d2b(_0x41fc89,_0x8b53('0x50')))[_0x8b53('0x27')](function(){})[_0x8b53('0x2a')](_0x9bef10()));break;default:_0x8eedd[_0x8b53('0x28')](db['sequelize']['query'](_0x14965d(_0x41fc89,_0x8b53('0x50')))[_0x8b53('0x27')](function(){})[_0x8b53('0x2a')](_0x9bef10()));}}}return _0x8eedd;})[_0x8b53('0x52')]()[_0x8b53('0x27')](function(){return db[_0x8b53('0x48')][_0x8b53('0x49')]({'where':{'type':_0x8b53('0x4a')},'attributes':['id'],'include':[{'model':db[_0x8b53('0x4c')],'as':_0x8b53('0x53'),'where':{'id':LISTID}}]})[_0x8b53('0x27')](function(_0x18f91b){var _0x30f0af=[];if(_0x18f91b){var _0x22202c;for(var _0x4d46e4=0x0,_0x2c1c9c;_0x4d46e4<_0x18f91b[_0x8b53('0x15')];_0x4d46e4+=0x1){_0x2c1c9c=_0x18f91b[_0x4d46e4][_0x8b53('0x54')]({'plain':!![]});_0x30f0af[_0x8b53('0x28')](db['sequelize']['query'](_0x3cec07(_0x2c1c9c,_0x8b53('0x50')))[_0x8b53('0x27')](function(){})[_0x8b53('0x2a')](_0x9bef10()));}}return _0x30f0af;})[_0x8b53('0x52')]();})[_0x8b53('0x27')](function(){return db[_0x8b53('0x55')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8b53('0x4c')],'as':_0x8b53('0x4d'),'where':{'id':LISTID}}]})[_0x8b53('0x27')](function(_0x797863){var _0x2911b6=[];if(_0x797863){for(var _0xeaade7=0x0,_0x3d8162;_0xeaade7<_0x797863[_0x8b53('0x15')];_0xeaade7+=0x1){_0x3d8162=_0x797863[_0xeaade7]['get']({'plain':!![]});switch(_0x3d8162['dialCheckDuplicateType']){case _0x8b53('0x4e'):_0x2911b6['push'](db[_0x8b53('0x4f')][_0x8b53('0x51')](_0x2d8015(_0x3d8162,_0x8b53('0x56')))['then'](function(){})[_0x8b53('0x2a')](_0x9bef10()));break;case _0x8b53('0x57'):_0x2911b6['push'](db['sequelize'][_0x8b53('0x51')](_0x4e7d2b(_0x3d8162,_0x8b53('0x56')))[_0x8b53('0x27')](function(){})[_0x8b53('0x2a')](_0x9bef10()));break;default:_0x2911b6[_0x8b53('0x28')](db['sequelize']['query'](_0x14965d(_0x3d8162,_0x8b53('0x56')))[_0x8b53('0x27')](function(){})[_0x8b53('0x2a')](_0x9bef10()));}}}return _0x2911b6;})[_0x8b53('0x52')]();})[_0x8b53('0x27')](function(){return db['Campaign'][_0x8b53('0x49')]({'attributes':['id'],'include':[{'model':db[_0x8b53('0x4c')],'as':_0x8b53('0x53'),'where':{'id':LISTID}}]})[_0x8b53('0x27')](function(_0x1da88c){var _0x4220c9=[];if(_0x1da88c){for(var _0x3baf1a=0x0,_0x52ee40;_0x3baf1a<_0x1da88c['length'];_0x3baf1a+=0x1){_0x52ee40=_0x1da88c[_0x3baf1a][_0x8b53('0x54')]({'plain':!![]});_0x4220c9[_0x8b53('0x28')](db['sequelize'][_0x8b53('0x51')](_0x3cec07(_0x52ee40,_0x8b53('0x56')))[_0x8b53('0x27')](function(){})[_0x8b53('0x2a')](_0x9bef10()));}}return _0x4220c9;})[_0x8b53('0x52')]();})[_0x8b53('0x2a')](function(_0x29e05d){logger['error']('cmContact,\x20%s,\x20%s',_0x8b53('0x58'),_0x29e05d[_0x8b53('0x18')]);});}var processPromises=function(_0x106314){return BPromise['all'](promises)[_0x8b53('0x27')](function(_0x8341a5){})[_0x8b53('0x2a')](function(_0x384d89){logger['error'](_0x8b53('0x59'),JSON['stringify'](_0x384d89));})[_0x8b53('0x5a')](function(){socket['emit'](_0x8b53('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x106314){return _0x106314[_0x8b53('0x5c')]();}});};var endCsv=function(){return BPromise[_0x8b53('0x5d')]()[_0x8b53('0x27')](function(){if(hopperContacts){return checkHopper();}})[_0x8b53('0x27')](function(){socket[_0x8b53('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8b53('0x5f')](FILEPATH);}catch(_0x4ebd06){logger[_0x8b53('0x11')](_0x8b53('0x60'),JSON[_0x8b53('0x2c')](_0x4ebd06));}finally{process[_0x8b53('0x61')](0x0);}});};process['on'](_0x8b53('0x62'),function(){logger[_0x8b53('0x63')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x8b53('0x5d')]()[_0x8b53('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8b53('0xf')](',');return db[_0x8b53('0x25')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x41d491){var _0x18f4e4=fs[_0x8b53('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x18f4e4,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e81cd,_0x515a10){total+=0x1;var _0x11a28f=total;promises['push'](checkRow(_0x2e81cd,_0x41d491,_0x11a28f)[_0x8b53('0x27')](function(){success+=0x1;})['catch'](function(_0x3f149a){if(_0x3f149a[_0x8b53('0x11')]){errors+=0x1;delete _0x3f149a['error'];}else if(_0x3f149a[_0x8b53('0x24')]){duplicates+=0x1;delete _0x3f149a[_0x8b53('0x24')];}rows['push'](_0x3f149a);}));if(total%0xc8===0x0){_0x515a10[_0x8b53('0x65')]();return processPromises(_0x515a10);}},'complete':function(){return processPromises()[_0x8b53('0x27')](function(){logger[_0x8b53('0x63')](_0x8b53('0x66'));endCsv();});},'error':function(_0x98ed18,_0x29b038){logger[_0x8b53('0x63')](_0x8b53('0x67'),JSON[_0x8b53('0x2c')](_0x98ed18));endCsv();}});})['catch'](function(_0x16a49d){logger[_0x8b53('0x11')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x8b53('0x2c')](_0x16a49d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index c3c9f11..ff36c5e 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 _0xa66d=['voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','then','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','.csv','includes','header',',utcOffset','writeFileSync','parse','rows','errors','data','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','complete','argv','server/files/tmp','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','where','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','updatedAt','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(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','ContactId','.CmListId','.id\x20=\x20','cm_hopper_black','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','createdAt','ListId\x20=\x20?','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','push','code','message','sequelize','query','spread','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','length','all','catch','voice_queues.dialTimezone'];(function(_0x5522d4,_0x453448){var _0x23a3f9=function(_0x1a8cbc){while(--_0x1a8cbc){_0x5522d4['push'](_0x5522d4['shift']());}};_0x23a3f9(++_0x453448);}(_0xa66d,0xeb));var _0xda66=function(_0xa6603d,_0x374178){_0xa6603d=_0xa6603d-0x0;var _0x3500d8=_0xa66d[_0xa6603d];return _0x3500d8;};'use strict';var fs=require('fs');var path=require(_0xda66('0x0'));var _=require(_0xda66('0x1'));var Papa=require(_0xda66('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xda66('0x3'));var squel=require(_0xda66('0x4'));var Redis=require(_0xda66('0x5'));var db=require(_0xda66('0x6'))['db'];var config=require(_0xda66('0x7'));var shared=require(_0xda66('0x8'));var logger=require(_0xda66('0x9'))('import');config[_0xda66('0xa')]=_[_0xda66('0xb')](config[_0xda66('0xa')],{'host':_0xda66('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda66('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xda66('0xd')](_0xda66('0xe'));function isEmail(_0x3d7d41){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'](_0x3d7d41);}function selectNotIn(_0x407f96,_0x219417,_0x3c3ff8,_0x3690b5,_0x5c1238){return squel[_0xda66('0xf')]()[_0xda66('0x10')](_0xda66('0x11'))[_0xda66('0x12')](_0x3690b5)['join'](_0x219417,null,_0x219417+'.id\x20=\x20'+_0x3690b5+'.'+_0x3c3ff8)[_0xda66('0x13')](_0x3690b5+'.'+_0x3c3ff8+'\x20=\x20'+_0x407f96+'.'+_0x3c3ff8)[_0xda66('0x13')](_0x219417+'.dialCheckDuplicateType\x20IN\x20('+_0x5c1238[_0xda66('0x14')]()+')');}function insertCmHopper(_0x1aa462,_0x18c68c,_0x1e5905,_0x45c0c4,_0x2f745e){var _0x5a351b=[_0xda66('0x15'),_0xda66('0x16'),'cm_contacts.id',_0xda66('0x17'),_0x18c68c+'.'+_0x45c0c4,_0xda66('0x18'),'cm_contacts.updatedAt',_0xda66('0x19'),_0xda66('0x1a'),'\x22'+_0x2f745e+'\x22'];return squel[_0xda66('0x1b')]()[_0xda66('0x1c')](_0xda66('0x1d'))[_0xda66('0x1e')](['phone',_0xda66('0x1f'),'ContactId',_0xda66('0x20'),_0x45c0c4,'createdAt',_0xda66('0x21'),_0xda66('0x22'),_0xda66('0x23'),_0xda66('0x24')],squel[_0xda66('0xf')]()[_0xda66('0x25')](_0x5a351b)[_0xda66('0x12')](_0x18c68c)['join'](_0xda66('0x26'),null,_0xda66('0x27')+_0x18c68c+'.CmListId')['join'](_0x1e5905,null,_0x1e5905+'.id\x20=\x20'+_0x18c68c+'.'+_0x45c0c4)[_0xda66('0x13')](_0x18c68c+_0xda66('0x28'),_0x1aa462)['where'](_0xda66('0x29'),NOW)['where'](_0xda66('0x2a'),selectNotIn(_0x18c68c,_0x1e5905,_0x45c0c4,'cm_hopper',[_0xda66('0x2b'),_0xda66('0x2c')]))[_0xda66('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x18c68c,_0x1e5905,_0x45c0c4,'cm_hopper',['\x22always\x22'])))[_0xda66('0x2d')]();}function insertCmHopperBlack(_0x304921,_0x3e4f83,_0x4f1fdd,_0x52c387){var _0x4bd851=['cm_contacts.phone',_0xda66('0x2e'),_0xda66('0x17'),_0x3e4f83+'.'+_0x52c387,_0xda66('0x18'),'cm_contacts.updatedAt'];return squel[_0xda66('0x1b')]()[_0xda66('0x1c')]('cm_hopper_black')[_0xda66('0x1e')]([_0xda66('0x11'),_0xda66('0x2f'),'ListId',_0x52c387,'createdAt',_0xda66('0x21')],squel[_0xda66('0xf')]()[_0xda66('0x25')](_0x4bd851)[_0xda66('0x12')](_0x3e4f83)['join']('cm_contacts',null,_0xda66('0x27')+_0x3e4f83+_0xda66('0x30'))[_0xda66('0x14')](_0x4f1fdd,null,_0x4f1fdd+_0xda66('0x31')+_0x3e4f83+'.'+_0x52c387)[_0xda66('0x13')](_0x3e4f83+_0xda66('0x28'),_0x304921)[_0xda66('0x13')](_0xda66('0x29'),NOW)[_0xda66('0x13')](_0xda66('0x2a'),squel[_0xda66('0xf')]()[_0xda66('0x10')](_0xda66('0x11'))[_0xda66('0x12')](_0xda66('0x32'))['where']('ListId\x20=\x20?',_0x304921)[_0xda66('0x13')](_0x52c387+_0xda66('0x33'),_0x3e4f83+'.'+_0x52c387)))[_0xda66('0x2d')]();}function insertTzCmHopper(_0x307873,_0x22a9ca,_0x391e17,_0x29cfcf,_0x2da5b5,_0x26dfbd){var _0xd65d4c=[_0xda66('0x15'),_0xda66('0x34')+_0x26dfbd+_0xda66('0x35'),_0xda66('0x2e'),_0xda66('0x17'),_0x22a9ca+'.'+_0x29cfcf,_0xda66('0x18'),_0xda66('0x36'),_0xda66('0x19'),_0xda66('0x1a'),'\x22'+_0x2da5b5+'\x22'];var _0x800af2=squel[_0xda66('0x1b')]()[_0xda66('0x1c')](_0xda66('0x1d'))[_0xda66('0x1e')]([_0xda66('0x11'),'scheduledat',_0xda66('0x2f'),_0xda66('0x20'),_0x29cfcf,'createdAt',_0xda66('0x21'),'priority',_0xda66('0x23'),_0xda66('0x24')],squel[_0xda66('0xf')]()[_0xda66('0x25')](_0xd65d4c)['from'](_0x22a9ca)[_0xda66('0x14')](_0xda66('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x22a9ca+_0xda66('0x30'))[_0xda66('0x14')](_0x391e17,null,_0x391e17+_0xda66('0x31')+_0x22a9ca+'.'+_0x29cfcf)[_0xda66('0x14')](_0x26dfbd,null,_0x26dfbd+_0xda66('0x31')+_0x22a9ca+'.'+_0x29cfcf)['where'](_0x22a9ca+_0xda66('0x28'),_0x307873)['where'](_0xda66('0x29'),NOW)[_0xda66('0x13')](_0xda66('0x2a'),selectNotIn(_0x22a9ca,_0x391e17,_0x29cfcf,_0xda66('0x1d'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xda66('0x13')](_0xda66('0x2a'),selectNotIn(_0x22a9ca,_0x391e17,_0x29cfcf,_0xda66('0x1d'),[_0xda66('0x2b')])))['toString']();return _0x800af2;}function insertTzCmHopperBlack(_0x57e39b,_0x42c152,_0x17193e,_0x1cea17){var _0x2833be=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x42c152+'.'+_0x1cea17,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xda66('0x1b')]()[_0xda66('0x1c')](_0xda66('0x32'))[_0xda66('0x1e')]([_0xda66('0x11'),_0xda66('0x2f'),_0xda66('0x20'),_0x1cea17,_0xda66('0x37'),_0xda66('0x21')],squel[_0xda66('0xf')]()['fields'](_0x2833be)['from'](_0x42c152)[_0xda66('0x14')](_0xda66('0x26'),null,_0xda66('0x27')+_0x42c152+_0xda66('0x30'))[_0xda66('0x14')](_0x17193e,null,_0x17193e+_0xda66('0x31')+_0x42c152+'.'+_0x1cea17)[_0xda66('0x13')](_0x42c152+_0xda66('0x28'),_0x57e39b)[_0xda66('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xda66('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xda66('0xf')]()[_0xda66('0x10')](_0xda66('0x11'))[_0xda66('0x12')](_0xda66('0x32'))[_0xda66('0x13')](_0xda66('0x38'),_0x57e39b)[_0xda66('0x13')](_0x1cea17+_0xda66('0x33'),_0x42c152+'.'+_0x1cea17)))[_0xda66('0x2d')]();}function insertCmContact(_0x39765a,_0x1afe28,_0x2cff05,_0x436c5f){var _0x15fa08=_['concat'](_[_0xda66('0x39')](_0x436c5f),[_0xda66('0x20'),_0xda66('0x3a'),_0xda66('0x37'),_0xda66('0x21')]);return squel[_0xda66('0x1b')]()[_0xda66('0x1c')]('cm_contacts')[_0xda66('0x1e')](_0x15fa08,squel[_0xda66('0xf')]()['fields'](_0x15fa08)['from'](_0x1afe28)[_0xda66('0x13')]('('+_0x2cff05['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xda66('0xf')]()['fields'](_0x2cff05)[_0xda66('0x12')](_0xda66('0x26'))[_0xda66('0x13')](_0xda66('0x38'),_0x39765a)[_0xda66('0x13')]('deletedAt\x20IS\x20NULL'))[_0xda66('0x13')](_0xda66('0x3b'),squel['select']()[_0xda66('0x10')](_0xda66('0x3c'),_0xda66('0x3d'))[_0xda66('0x12')](_0x1afe28)[_0xda66('0x3e')](_0x2cff05['join'](','))))['toString']();}function handleStop(){logger[_0xda66('0x3f')](_0xda66('0x40'));stopped=!![];}function handleUncaughtException(_0x1cacea){logger[_0xda66('0x41')](_0x1cacea['message']);process[_0xda66('0x42')](0x1);}function handleError(_0xc7e10b,_0x572ef6){stats['errors'][_0xda66('0x43')]({'name':_0x572ef6[_0xda66('0x44')],'message':_0x572ef6[_0xda66('0x45')],'row':_0xc7e10b});}function handleQuery(_0x842529){logger[_0xda66('0x3f')](_0x842529);return db[_0xda66('0x46')][_0xda66('0x47')](_0x842529)[_0xda66('0x48')](function(_0x20ceaf){results[_0xda66('0x43')](_0x20ceaf);})['catch'](function(_0x39995b){logger[_0xda66('0x41')](_0x39995b[_0xda66('0x45')]);});}function updateTzCampaigns(_0xbc1d58){return new Promise(function(_0x54f7c3,_0x281fa9){var _0xdcc283=squel['select']()[_0xda66('0x25')](['campaigns.id',_0xda66('0x49')])[_0xda66('0x12')](_0xda66('0x4a'))[_0xda66('0x14')](_0xda66('0x4b'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0xda66('0x4c')+_0xbc1d58);db[_0xda66('0x46')]['query'](_0xdcc283[_0xda66('0x2d')]())[_0xda66('0x48')](function(_0x3490ee){var _0x5afd93=[];for(var _0x18234f=0x0;_0x18234f<_0x3490ee[_0xda66('0x4d')];_0x18234f++){_0x5afd93['push'](getTimezoneData(_0x3490ee[_0x18234f],tmp_campaigns));}BPromise[_0xda66('0x4e')](_0x5afd93)['then'](function(){_0x54f7c3({'val':0x1});});})[_0xda66('0x4f')](function(_0x15a155){logger[_0xda66('0x41')](_0x15a155[_0xda66('0x45')]);_0x54f7c3({'val':0x0});});});}function updateTzVoiceQueues(_0x2e1138){return new Promise(function(_0x4e8255,_0x4e1937){var _0x2ec57a=squel[_0xda66('0xf')]()[_0xda66('0x25')](['voice_queues.id',_0xda66('0x50')])[_0xda66('0x12')](_0xda66('0x51'))[_0xda66('0x14')](_0xda66('0x52'),null,_0xda66('0x53'))[_0xda66('0x13')](_0xda66('0x54')+_0x2e1138);db['sequelize']['query'](_0x2ec57a[_0xda66('0x2d')]())[_0xda66('0x48')](function(_0x2d84ef){var _0x200800=[];for(var _0x55ef28=0x0;_0x55ef28<_0x2d84ef[_0xda66('0x4d')];_0x55ef28++){_0x200800['push'](getTimezoneData(_0x2d84ef[_0x55ef28],tmp_voice_queues));}BPromise[_0xda66('0x4e')](_0x200800)[_0xda66('0x55')](function(){_0x4e8255({'val':0x1});});})[_0xda66('0x4f')](function(_0x48ac14){logger[_0xda66('0x41')](_0x48ac14[_0xda66('0x45')]);_0x4e8255({'val':0x0});});});}function getTimezoneData(_0x19781e,_0x1119bb){return new Promise(function(_0x4332ff,_0x314741){var _0x59487b=shared[_0xda66('0x56')];var _0x2aa37f=_0x59487b[_0x19781e[_0xda66('0x57')]];if(_[_0xda66('0x58')](_0x2aa37f)){_0x4332ff({'ret':0x1});}else{var _0x1db818=_0x2aa37f[_0xda66('0x59')];var _0x4457f8=squel['insert']()[_0xda66('0x1c')](_0x1119bb)[_0xda66('0x5a')]('id',_0x19781e['id'])[_0xda66('0x5a')](_0xda66('0x5b'),_0x1db818)[_0xda66('0x5a')](_0xda66('0x57'),_0x19781e[_0xda66('0x57')])[_0xda66('0x2d')]();return db[_0xda66('0x46')][_0xda66('0x47')](_0x4457f8)[_0xda66('0x48')](function(_0x13411a){_0x4332ff({'ret':0x1});})[_0xda66('0x4f')](function(_0x1aa11c){logger[_0xda66('0x41')](_0x1aa11c[_0xda66('0x45')]);_0x314741({'ret':0x1});});}});}function handleTZQuery(_0x26cdd7){logger[_0xda66('0x3f')](_0x26cdd7);return db[_0xda66('0x46')][_0xda66('0x47')](_0x26cdd7)[_0xda66('0x48')](function(_0x160f7d){})[_0xda66('0x4f')](function(_0x3156ad){logger[_0xda66('0x41')](_0x3156ad[_0xda66('0x45')]);});}function main(_0x1fed52,_0x2b73ac,_0x37b50f,_0x5a60ed){logger[_0xda66('0x3f')](_0xda66('0x5c'),_0x1fed52,JSON[_0xda66('0x5d')](_0x2b73ac));process[_0xda66('0x5e')](_0xda66('0x5f'));var _0x857ed0=_0x2b73ac[_0xda66('0x60')];var _0xe0c439=_0x2b73ac[_0xda66('0x61')];var _0x3cccd3=path[_0xda66('0x14')](config[_0xda66('0x62')],'server/files/tmp',_0xe0c439+_0xda66('0x63'));hasTZ=_[_0xda66('0x39')](_0x857ed0)[_0xda66('0x64')]('dialTimezone');var _0x46caf0=_[_0xda66('0x39')](_0x857ed0)['join']();logger[_0xda66('0x3f')](_0xda66('0x65'),_0x46caf0);if(hasTZ)_0x46caf0+=_0xda66('0x66');fs[_0xda66('0x67')](_0x3cccd3,_0x46caf0+'\x0a');Papa[_0xda66('0x68')](fs['createReadStream'](_0x1fed52),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5111be,_0x247895){try{for(var _0x408bfd=0x0,_0x4561d4=[];_0x408bfd<_0x5111be['data'][_0xda66('0x4d')];_0x408bfd++){stats[_0xda66('0x69')]+=0x1;if(_0x5111be[_0xda66('0x6a')][_0x408bfd]){handleError(_0x5111be[_0xda66('0x6b')][_0x408bfd],_0x5111be[_0xda66('0x6a')][_0x408bfd]);}else{var _0x4a9101=[];for(var _0x5ed874 in _0x857ed0){if(_0x857ed0[_0xda66('0x6c')](_0x5ed874)){if(_0x5111be[_0xda66('0x6b')][_0x408bfd][_0x857ed0[_0x5ed874]]){var _0x4bde1a=_[_0xda66('0x6d')](_0x5111be[_0xda66('0x6b')][_0x408bfd][_0x857ed0[_0x5ed874]][_0xda66('0x6e')](/"/g,'\x27'));switch(_0x5ed874){case _0xda66('0x1f'):var _0x47cc49=moment(_0x4bde1a,_0xda66('0xe'),!![]);if(_0x47cc49[_0xda66('0x6f')]()){_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');}else{_0x4a9101[_0xda66('0x43')](_0xda66('0x70'));}break;case _0xda66('0x22'):var _0x35d89c=parseInt(_0x4bde1a);_0x4bde1a=_[_0xda66('0x71')](_0x35d89c)||_0x35d89c<0x0||_0x35d89c>0x4?_0x5a60ed?0x3:0x2:_0x35d89c;_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');break;case _0xda66('0x23'):var _0x9badfa=parseInt(_0x4bde1a);if(_[_0xda66('0x72')](_0x9badfa)&&_[_0xda66('0x64')](_0x37b50f,_0x9badfa)){_0x4561d4[_0xda66('0x43')]('\x22'+_0x9badfa+'\x22');}else{_0x4a9101[_0xda66('0x43')](_0xda66('0x73'));}break;case _0xda66('0x74'):if(isEmail(_0x4bde1a)){_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');}else{_0x4a9101['push'](_0xda66('0x75'));}break;case _0xda66('0x76'):var _0x5231d0=moment(_0x4bde1a,_0xda66('0x77'),!![]);if(_0x5231d0[_0xda66('0x6f')]()){_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');}else{_0x4a9101[_0xda66('0x43')](_0xda66('0x78'));}break;case'dialTimezone':var _0x4d765d=shared[_0xda66('0x56')];var _0x3063bd=_0x4d765d[_0x4bde1a];if(!_[_0xda66('0x58')](_0x3063bd)){var _0x284957=_0x3063bd[_0xda66('0x59')];_0x4561d4['push']('\x22'+_0x4bde1a+'\x22');_0x4561d4[_0xda66('0x43')]('\x22'+_0x284957+'\x22');}break;default:_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');}}else{switch(_0x5ed874){case _0xda66('0x79'):case _0xda66('0x11'):_0x4a9101['push'](_0x5ed874+_0xda66('0x7a'));break;default:_0x4561d4[_0xda66('0x43')]('\x22\x22');}}}}if(_0x4a9101['length']){handleError(_0x5111be[_0xda66('0x6b')][_0x408bfd],{'code':_0xda66('0x7b'),'message':_0x4a9101['join']()});}else{fs[_0xda66('0x7c')](_0x3cccd3,_0x4561d4['join']()+'\x0a');}_0x4561d4=[];}if(!(stats[_0xda66('0x69')]%0xc8)){socket['emit'](_0xda66('0x7d')+_0xe0c439,stats);stats[_0xda66('0x6a')]=[];}}if(stopped){logger['info'](_0xda66('0x7e'));_0x247895['abort']();}}catch(_0xf0c894){handleError(_0x5111be[_0xda66('0x6b')][_0x408bfd],{'code':_0xda66('0x7f'),'message':_0xf0c894[_0xda66('0x45')]});logger['error'](_0xda66('0x80'),_0xf0c894['message']);}},'complete':function(){try{var _0x216c2c=[];var _0x149240=[];var _0x3857a2=_0xda66('0x26');if(_0x2b73ac['duplicates']&&_0x2b73ac[_0xda66('0x81')]['length']){_0x3857a2=_0xda66('0x82')+_0xe0c439;_0x216c2c['push'](_0xda66('0x83')+_0x3857a2+_0xda66('0x84'));}tmp_campaigns=_0xda66('0x85')+_0xe0c439;tmp_voice_queues='voice_queues_'+_0xe0c439;_0x149240[_0xda66('0x43')](_0xda66('0x83')+tmp_campaigns+_0xda66('0x86'));_0x149240[_0xda66('0x43')](_0xda66('0x83')+tmp_voice_queues+_0xda66('0x86'));BPromise[_0xda66('0x87')](_0x149240,handleTZQuery)['then'](function(_0x24cae2){updateTzCampaigns(_0x2b73ac['ListId'])[_0xda66('0x55')](function(_0x33e286){updateTzVoiceQueues(_0x2b73ac[_0xda66('0x20')])['then'](function(_0x32c228){var _0x5de96c=util['format'](_0xda66('0x88'),_0x3cccd3,_0x3857a2,_0x46caf0,_0x2b73ac[_0xda66('0x20')],_0x2b73ac[_0xda66('0x3a')]||null,NOW,NOW);if(_[_0xda66('0x58')](_0x857ed0[_0xda66('0x1f')])){_0x5de96c+=_0xda66('0x89');}_0x216c2c[_0xda66('0x43')](_0x5de96c);if(_0x2b73ac[_0xda66('0x81')]&&_0x2b73ac[_0xda66('0x81')]['length']){_0x216c2c['push'](insertCmContact(_0x2b73ac[_0xda66('0x20')],_0x3857a2,_0x2b73ac[_0xda66('0x81')],_0x857ed0));_0x216c2c[_0xda66('0x43')]('DROP\x20TABLE\x20'+_0x3857a2+';');}if(hasTZ){_0x216c2c[_0xda66('0x43')](insertTzCmHopper(_0x2b73ac[_0xda66('0x20')],'voice_queues_has_cm_lists','voice_queues','VoiceQueueId',_0x5a60ed,tmp_voice_queues));_0x216c2c[_0xda66('0x43')](insertTzCmHopperBlack(_0x2b73ac[_0xda66('0x20')],_0xda66('0x8a'),_0xda66('0x51'),_0xda66('0x8b')));_0x216c2c[_0xda66('0x43')](insertTzCmHopper(_0x2b73ac[_0xda66('0x20')],_0xda66('0x4b'),_0xda66('0x4a'),'CampaignId',_0x5a60ed,tmp_campaigns));_0x216c2c['push'](insertTzCmHopperBlack(_0x2b73ac[_0xda66('0x20')],_0xda66('0x8c'),_0xda66('0x4a'),'CampaignId'));}else{_0x216c2c[_0xda66('0x43')](insertCmHopper(_0x2b73ac['ListId'],_0xda66('0x52'),'voice_queues',_0xda66('0x8b'),_0x5a60ed));_0x216c2c[_0xda66('0x43')](insertCmHopperBlack(_0x2b73ac[_0xda66('0x20')],_0xda66('0x8a'),_0xda66('0x51'),_0xda66('0x8b')));_0x216c2c[_0xda66('0x43')](insertCmHopper(_0x2b73ac[_0xda66('0x20')],'campaigns_has_cm_lists',_0xda66('0x4a'),_0xda66('0x8d'),_0x5a60ed));_0x216c2c['push'](insertCmHopperBlack(_0x2b73ac[_0xda66('0x20')],'campaigns_has_cm_blacklists',_0xda66('0x4a'),_0xda66('0x8d')));}_0x216c2c[_0xda66('0x43')](_0xda66('0x8e')+tmp_campaigns+';');_0x216c2c[_0xda66('0x43')](_0xda66('0x8e')+tmp_voice_queues+';');BPromise['each'](_0x216c2c,handleQuery)['then'](function(_0x11f111){stats[_0xda66('0x8f')]=!![];stats[_0xda66('0x90')]=_0x2b73ac['duplicates']&&_0x2b73ac['duplicates'][_0xda66('0x4d')]?results[0x2][_0xda66('0x90')]:results[0x0][_0xda66('0x90')];socket[_0xda66('0x91')]('contact:import:'+_0xe0c439,stats);fs['unlink'](_0x1fed52);fs[_0xda66('0x92')](_0x3cccd3);process[_0xda66('0x42')](0x0);})['catch'](function(_0x9eee63){logger[_0xda66('0x41')](_0x9eee63['message']);process[_0xda66('0x42')](0x1);});});});});}catch(_0x225c42){logger[_0xda66('0x41')](_0xda66('0x93'),_0x225c42[_0xda66('0x45')]);process[_0xda66('0x42')](0x1);}},'error':function(_0x32e78d,_0x56d1d0,_0x59c931,_0x5a7ebd){throw new Error(_0x5a7ebd);}});}function validate(){if(process['argv']&&process[_0xda66('0x94')][_0xda66('0x4d')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x2e4f23=path[_0xda66('0x14')](config[_0xda66('0x62')],_0xda66('0x95'),process['argv'][0x2]);if(!fs['existsSync'](_0x2e4f23)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x62aacd={};try{_0x62aacd=JSON[_0xda66('0x68')](process[_0xda66('0x94')][0x3]);if(!_0x62aacd['binding']){throw new Error(_0xda66('0x96'));}if(!_0x62aacd[_0xda66('0x60')][_0xda66('0x11')]){throw new Error(_0xda66('0x97'));}if(!_0x62aacd['binding'][_0xda66('0x79')]){throw new Error(_0xda66('0x98'));}var _0x2c56e7=0x0;if(_0x62aacd[_0xda66('0x60')][_0xda66('0x23')]){_0x2c56e7=0x1;}if(!_0x62aacd['ListId']){throw new Error(_0xda66('0x99'));}}catch(_0x1b356a){throw new Error(_0xda66('0x9a'));}var _0x4dce2e=[];try{_0x4dce2e=_['map'](JSON[_0xda66('0x68')](process[_0xda66('0x94')][0x4]),'id');}catch(_0x4b6f4f){logger[_0xda66('0x3f')](_0xda66('0x9b'));}main(_0x2e4f23,_0x62aacd,_0x4dce2e,_0x2c56e7);}validate();process['on'](_0xda66('0x9c'),handleStop);process['on'](_0xda66('0x9d'),handleUncaughtException); \ No newline at end of file +var _0x57ab=['arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','localhost','socket.io-emitter','redis','format','select','field','from','join','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','insert','cm_hopper_black','updatedAt','cm_contacts','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','query','catch','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','sequelize','spread','timezones','dialTimezone','isNil','utcOffset','set','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isNumber','agent\x20not\x20exists','email','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','emit','Abort\x20parser','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns_has_cm_lists','finish','affectedRows','unlink','complete','argv'];(function(_0xd4f84,_0x247deb){var _0x49b98a=function(_0xd0c069){while(--_0xd0c069){_0xd4f84['push'](_0xd4f84['shift']());}};_0x49b98a(++_0x247deb);}(_0x57ab,0x140));var _0xb57a=function(_0x78d11b,_0x1c2611){_0x78d11b=_0x78d11b-0x0;var _0x5f2e27=_0x57ab[_0x78d11b];return _0x5f2e27;};'use strict';var fs=require('fs');var path=require(_0xb57a('0x0'));var _=require(_0xb57a('0x1'));var Papa=require(_0xb57a('0x2'));var util=require(_0xb57a('0x3'));var BPromise=require(_0xb57a('0x4'));var moment=require(_0xb57a('0x5'));var squel=require(_0xb57a('0x6'));var Redis=require(_0xb57a('0x7'));var db=require(_0xb57a('0x8'))['db'];var config=require(_0xb57a('0x9'));var shared=require(_0xb57a('0xa'));var logger=require(_0xb57a('0xb'))(_0xb57a('0xc'));config['redis']=_['defaults'](config['redis'],{'host':_0xb57a('0xd'),'port':0x18eb});var socket=require(_0xb57a('0xe'))(new Redis(config[_0xb57a('0xf')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xb57a('0x10')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x2c0f04){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'](_0x2c0f04);}function selectNotIn(_0x573a9d,_0x1f199c,_0x235c8e,_0x301912,_0x21898c){return squel[_0xb57a('0x11')]()[_0xb57a('0x12')]('phone')[_0xb57a('0x13')](_0x301912)[_0xb57a('0x14')](_0x1f199c,null,_0x1f199c+'.id\x20=\x20'+_0x301912+'.'+_0x235c8e)[_0xb57a('0x15')](_0x301912+'.'+_0x235c8e+'\x20=\x20'+_0x573a9d+'.'+_0x235c8e)[_0xb57a('0x15')](_0x1f199c+_0xb57a('0x16')+_0x21898c['join']()+')');}function insertCmHopper(_0xc421d7,_0x3937b4,_0x1feb30,_0x49d2e1,_0x401b31){var _0x19238f=[_0xb57a('0x17'),_0xb57a('0x18'),_0xb57a('0x19'),'cm_contacts.ListId',_0x3937b4+'.'+_0x49d2e1,_0xb57a('0x1a'),'cm_contacts.updatedAt',_0xb57a('0x1b'),_0xb57a('0x1c'),'\x22'+_0x401b31+'\x22'];return squel['insert']()[_0xb57a('0x1d')](_0xb57a('0x1e'))[_0xb57a('0x1f')]([_0xb57a('0x20'),_0xb57a('0x21'),_0xb57a('0x22'),_0xb57a('0x23'),_0x49d2e1,_0xb57a('0x24'),'updatedAt',_0xb57a('0x25'),_0xb57a('0x26'),_0xb57a('0x27')],squel[_0xb57a('0x11')]()[_0xb57a('0x28')](_0x19238f)[_0xb57a('0x13')](_0x3937b4)[_0xb57a('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x3937b4+_0xb57a('0x29'))['join'](_0x1feb30,null,_0x1feb30+_0xb57a('0x2a')+_0x3937b4+'.'+_0x49d2e1)[_0xb57a('0x15')](_0x3937b4+_0xb57a('0x2b'),_0xc421d7)[_0xb57a('0x15')](_0xb57a('0x2c'),NOW)['where'](_0xb57a('0x2d'),selectNotIn(_0x3937b4,_0x1feb30,_0x49d2e1,_0xb57a('0x1e'),['\x22always\x22',_0xb57a('0x2e')]))[_0xb57a('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3937b4,_0x1feb30,_0x49d2e1,_0xb57a('0x1e'),[_0xb57a('0x2f')])))[_0xb57a('0x30')]();}function insertCmHopperBlack(_0x452158,_0x23b590,_0x1d5a49,_0x3a3816){var _0x11ceec=[_0xb57a('0x17'),_0xb57a('0x19'),_0xb57a('0x31'),_0x23b590+'.'+_0x3a3816,'cm_contacts.createdAt',_0xb57a('0x32')];return squel[_0xb57a('0x33')]()[_0xb57a('0x1d')](_0xb57a('0x34'))[_0xb57a('0x1f')]([_0xb57a('0x20'),_0xb57a('0x22'),'ListId',_0x3a3816,_0xb57a('0x24'),_0xb57a('0x35')],squel[_0xb57a('0x11')]()['fields'](_0x11ceec)[_0xb57a('0x13')](_0x23b590)[_0xb57a('0x14')](_0xb57a('0x36'),null,_0xb57a('0x37')+_0x23b590+_0xb57a('0x29'))[_0xb57a('0x14')](_0x1d5a49,null,_0x1d5a49+_0xb57a('0x2a')+_0x23b590+'.'+_0x3a3816)[_0xb57a('0x15')](_0x23b590+_0xb57a('0x2b'),_0x452158)[_0xb57a('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb57a('0x15')](_0xb57a('0x2d'),squel[_0xb57a('0x11')]()[_0xb57a('0x12')](_0xb57a('0x20'))[_0xb57a('0x13')](_0xb57a('0x34'))[_0xb57a('0x15')](_0xb57a('0x38'),_0x452158)[_0xb57a('0x15')](_0x3a3816+_0xb57a('0x39'),_0x23b590+'.'+_0x3a3816)))[_0xb57a('0x30')]();}function insertTzCmHopper(_0x4fd859,_0x571e1d,_0x81ea3a,_0x5dc134,_0x37b5aa,_0x50c155){var _0xc1ccc4=[_0xb57a('0x17'),_0xb57a('0x3a')+_0x50c155+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0xb57a('0x31'),_0x571e1d+'.'+_0x5dc134,_0xb57a('0x1a'),_0xb57a('0x32'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x37b5aa+'\x22'];var _0x2d1bb5=squel[_0xb57a('0x33')]()['into'](_0xb57a('0x1e'))['fromQuery']([_0xb57a('0x20'),_0xb57a('0x21'),'ContactId','ListId',_0x5dc134,_0xb57a('0x24'),_0xb57a('0x35'),'priority',_0xb57a('0x26'),_0xb57a('0x27')],squel['select']()[_0xb57a('0x28')](_0xc1ccc4)[_0xb57a('0x13')](_0x571e1d)[_0xb57a('0x14')](_0xb57a('0x36'),null,_0xb57a('0x37')+_0x571e1d+_0xb57a('0x29'))[_0xb57a('0x14')](_0x81ea3a,null,_0x81ea3a+_0xb57a('0x2a')+_0x571e1d+'.'+_0x5dc134)[_0xb57a('0x14')](_0x50c155,null,_0x50c155+_0xb57a('0x2a')+_0x571e1d+'.'+_0x5dc134)['where'](_0x571e1d+'.CmListId\x20=\x20?',_0x4fd859)['where'](_0xb57a('0x2c'),NOW)[_0xb57a('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x571e1d,_0x81ea3a,_0x5dc134,_0xb57a('0x1e'),[_0xb57a('0x2f'),_0xb57a('0x2e')]))[_0xb57a('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x571e1d,_0x81ea3a,_0x5dc134,_0xb57a('0x1e'),[_0xb57a('0x2f')])))[_0xb57a('0x30')]();return _0x2d1bb5;}function insertTzCmHopperBlack(_0x2f9e4e,_0x431a62,_0x14351b,_0x51d588){var _0x9e25ad=[_0xb57a('0x17'),_0xb57a('0x19'),_0xb57a('0x31'),_0x431a62+'.'+_0x51d588,_0xb57a('0x1a'),_0xb57a('0x32')];return squel[_0xb57a('0x33')]()[_0xb57a('0x1d')](_0xb57a('0x34'))['fromQuery'](['phone','ContactId','ListId',_0x51d588,_0xb57a('0x24'),_0xb57a('0x35')],squel[_0xb57a('0x11')]()[_0xb57a('0x28')](_0x9e25ad)[_0xb57a('0x13')](_0x431a62)[_0xb57a('0x14')](_0xb57a('0x36'),null,_0xb57a('0x37')+_0x431a62+_0xb57a('0x29'))[_0xb57a('0x14')](_0x14351b,null,_0x14351b+_0xb57a('0x2a')+_0x431a62+'.'+_0x51d588)[_0xb57a('0x15')](_0x431a62+_0xb57a('0x2b'),_0x2f9e4e)[_0xb57a('0x15')](_0xb57a('0x2c'),NOW)['where'](_0xb57a('0x2d'),squel['select']()[_0xb57a('0x12')](_0xb57a('0x20'))['from'](_0xb57a('0x34'))[_0xb57a('0x15')](_0xb57a('0x38'),_0x2f9e4e)[_0xb57a('0x15')](_0x51d588+_0xb57a('0x39'),_0x431a62+'.'+_0x51d588)))['toString']();}function insertCmContact(_0xabac62,_0xbdb6c8,_0x55a654,_0xebb59c){var _0x1d5b0a=_[_0xb57a('0x3b')](_[_0xb57a('0x3c')](_0xebb59c),[_0xb57a('0x23'),_0xb57a('0x3d'),_0xb57a('0x24'),_0xb57a('0x35')]);return squel[_0xb57a('0x33')]()['into'](_0xb57a('0x36'))[_0xb57a('0x1f')](_0x1d5b0a,squel[_0xb57a('0x11')]()['fields'](_0x1d5b0a)[_0xb57a('0x13')](_0xbdb6c8)['where']('('+_0x55a654[_0xb57a('0x14')](',')+_0xb57a('0x3e'),squel[_0xb57a('0x11')]()['fields'](_0x55a654)[_0xb57a('0x13')](_0xb57a('0x36'))[_0xb57a('0x15')](_0xb57a('0x38'),_0xabac62)[_0xb57a('0x15')](_0xb57a('0x3f')))[_0xb57a('0x15')](_0xb57a('0x40'),squel[_0xb57a('0x11')]()[_0xb57a('0x12')](_0xb57a('0x41'),_0xb57a('0x42'))[_0xb57a('0x13')](_0xbdb6c8)[_0xb57a('0x43')](_0x55a654['join'](','))))[_0xb57a('0x30')]();}function handleStop(){logger[_0xb57a('0x44')](_0xb57a('0x45'));stopped=!![];}function handleUncaughtException(_0x3614df){logger[_0xb57a('0x46')](_0x3614df[_0xb57a('0x47')]);process[_0xb57a('0x48')](0x1);}function handleError(_0x3a0278,_0x397e96){stats[_0xb57a('0x49')][_0xb57a('0x4a')]({'name':_0x397e96['code'],'message':_0x397e96[_0xb57a('0x47')],'row':_0x3a0278});}function handleQuery(_0x467895){logger[_0xb57a('0x44')](_0x467895);return db['sequelize'][_0xb57a('0x4b')](_0x467895)['spread'](function(_0x4d1160){results[_0xb57a('0x4a')](_0x4d1160);})[_0xb57a('0x4c')](function(_0x46d0a5){logger[_0xb57a('0x46')](_0x46d0a5[_0xb57a('0x47')]);});}function updateTzCampaigns(_0x4c6b29){return new Promise(function(_0x103052,_0x26af35){var _0x2134bf=squel[_0xb57a('0x11')]()['fields']([_0xb57a('0x4d'),'campaigns.dialTimezone'])[_0xb57a('0x13')](_0xb57a('0x4e'))[_0xb57a('0x14')]('campaigns_has_cm_lists',null,_0xb57a('0x4f'))['where']('campaigns_has_cm_lists.CmListId='+_0x4c6b29);db['sequelize'][_0xb57a('0x4b')](_0x2134bf[_0xb57a('0x30')]())['spread'](function(_0x2791d5){var _0x1ffe3b=[];for(var _0x263401=0x0;_0x263401<_0x2791d5[_0xb57a('0x50')];_0x263401++){_0x1ffe3b[_0xb57a('0x4a')](getTimezoneData(_0x2791d5[_0x263401],tmp_campaigns));}BPromise[_0xb57a('0x51')](_0x1ffe3b)[_0xb57a('0x52')](function(){_0x103052({'val':0x1});});})['catch'](function(_0x17bd3){logger[_0xb57a('0x46')](_0x17bd3[_0xb57a('0x47')]);_0x103052({'val':0x0});});});}function updateTzVoiceQueues(_0x1673d9){return new Promise(function(_0x44f003,_0x3d0919){var _0x381b2e=squel[_0xb57a('0x11')]()['fields'](['voice_queues.id',_0xb57a('0x53')])[_0xb57a('0x13')](_0xb57a('0x54'))['join'](_0xb57a('0x55'),null,_0xb57a('0x56'))['where']('voice_queues_has_cm_lists.CmListId='+_0x1673d9);db[_0xb57a('0x57')][_0xb57a('0x4b')](_0x381b2e['toString']())[_0xb57a('0x58')](function(_0x381dd7){var _0xe9cfeb=[];for(var _0x26dfb4=0x0;_0x26dfb4<_0x381dd7['length'];_0x26dfb4++){_0xe9cfeb[_0xb57a('0x4a')](getTimezoneData(_0x381dd7[_0x26dfb4],tmp_voice_queues));}BPromise[_0xb57a('0x51')](_0xe9cfeb)[_0xb57a('0x52')](function(){_0x44f003({'val':0x1});});})[_0xb57a('0x4c')](function(_0x201f62){logger[_0xb57a('0x46')](_0x201f62[_0xb57a('0x47')]);_0x44f003({'val':0x0});});});}function getTimezoneData(_0x1b2f2d,_0x29e8ba){return new Promise(function(_0x2e171f,_0xac914e){var _0x769cd2=shared[_0xb57a('0x59')];var _0x3cca69=_0x769cd2[_0x1b2f2d[_0xb57a('0x5a')]];if(_[_0xb57a('0x5b')](_0x3cca69)){_0x2e171f({'ret':0x1});}else{var _0x43728b=_0x3cca69[_0xb57a('0x5c')];var _0x29410a=squel[_0xb57a('0x33')]()['into'](_0x29e8ba)['set']('id',_0x1b2f2d['id'])[_0xb57a('0x5d')]('offset',_0x43728b)['set'](_0xb57a('0x5a'),_0x1b2f2d['dialTimezone'])[_0xb57a('0x30')]();return db['sequelize'][_0xb57a('0x4b')](_0x29410a)[_0xb57a('0x58')](function(_0x3a65e6){_0x2e171f({'ret':0x1});})['catch'](function(_0x2d6fb1){logger[_0xb57a('0x46')](_0x2d6fb1[_0xb57a('0x47')]);_0xac914e({'ret':0x1});});}});}function handleTZQuery(_0x1d9903){logger[_0xb57a('0x44')](_0x1d9903);return db[_0xb57a('0x57')][_0xb57a('0x4b')](_0x1d9903)['spread'](function(_0x4d75ad){})['catch'](function(_0x93abe1){logger[_0xb57a('0x46')](_0x93abe1[_0xb57a('0x47')]);});}function main(_0x13f944,_0xffc10c,_0x1f4c60,_0x10f307){logger[_0xb57a('0x44')]('main',_0x13f944,JSON[_0xb57a('0x5e')](_0xffc10c));process[_0xb57a('0x5f')]('start');var _0x23eece=_0xffc10c[_0xb57a('0x60')];var _0x52844a=_0xffc10c[_0xb57a('0x61')];var _0x5d6896=path[_0xb57a('0x14')](config[_0xb57a('0x62')],_0xb57a('0x63'),_0x52844a+_0xb57a('0x64'));hasTZ=_[_0xb57a('0x3c')](_0x23eece)[_0xb57a('0x65')](_0xb57a('0x5a'));var _0x1f64e6=_[_0xb57a('0x3c')](_0x23eece)[_0xb57a('0x14')]();logger[_0xb57a('0x44')](_0xb57a('0x66'),_0x1f64e6);if(hasTZ)_0x1f64e6+=_0xb57a('0x67');fs[_0xb57a('0x68')](_0x5d6896,_0x1f64e6+'\x0a');Papa[_0xb57a('0x69')](fs[_0xb57a('0x6a')](_0x13f944),{'header':!![],'skipEmptyLines':!![],'step':function(_0x7c3f39,_0x1e7b44){try{for(var _0x14f931=0x0,_0x22b733=[];_0x14f931<_0x7c3f39[_0xb57a('0x6b')][_0xb57a('0x50')];_0x14f931++){stats[_0xb57a('0x6c')]+=0x1;if(_0x7c3f39[_0xb57a('0x49')][_0x14f931]){handleError(_0x7c3f39[_0xb57a('0x6b')][_0x14f931],_0x7c3f39[_0xb57a('0x49')][_0x14f931]);}else{var _0x4af704=[];for(var _0x34a90a in _0x23eece){if(_0x23eece[_0xb57a('0x6d')](_0x34a90a)){if(_0x7c3f39[_0xb57a('0x6b')][_0x14f931][_0x23eece[_0x34a90a]]){var _0x4dd490=_[_0xb57a('0x6e')](_0x7c3f39[_0xb57a('0x6b')][_0x14f931][_0x23eece[_0x34a90a]]['replace'](/"/g,'\x27'));switch(_0x34a90a){case'scheduledat':var _0x3739cc=moment(_0x4dd490,_0xb57a('0x6f'),!![]);if(_0x3739cc['isValid']()){_0x22b733[_0xb57a('0x4a')]('\x22'+_0x4dd490+'\x22');}else{_0x4af704['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb57a('0x25'):var _0x4cd497=parseInt(_0x4dd490);_0x4dd490=_['isNaN'](_0x4cd497)||_0x4cd497<0x0||_0x4cd497>0x4?_0x10f307?0x3:0x2:_0x4cd497;_0x22b733[_0xb57a('0x4a')]('\x22'+_0x4dd490+'\x22');break;case _0xb57a('0x26'):var _0x197e5d=parseInt(_0x4dd490);if(_[_0xb57a('0x70')](_0x197e5d)&&_[_0xb57a('0x65')](_0x1f4c60,_0x197e5d)){_0x22b733[_0xb57a('0x4a')]('\x22'+_0x197e5d+'\x22');}else{_0x4af704['push'](_0xb57a('0x71'));}break;case _0xb57a('0x72'):if(isEmail(_0x4dd490)){_0x22b733[_0xb57a('0x4a')]('\x22'+_0x4dd490+'\x22');}else{_0x4af704[_0xb57a('0x4a')]('email\x20wrong\x20format');}break;case _0xb57a('0x73'):var _0x4b9370=moment(_0x4dd490,'YYYY-MM-DD',!![]);if(_0x4b9370[_0xb57a('0x74')]()){_0x22b733[_0xb57a('0x4a')]('\x22'+_0x4dd490+'\x22');}else{_0x4af704[_0xb57a('0x4a')](_0xb57a('0x75'));}break;case _0xb57a('0x5a'):var _0x15cf67=shared[_0xb57a('0x59')];var _0x428f00=_0x15cf67[_0x4dd490];if(!_[_0xb57a('0x5b')](_0x428f00)){var _0x1e99ca=_0x428f00['utcOffset'];_0x22b733['push']('\x22'+_0x4dd490+'\x22');_0x22b733[_0xb57a('0x4a')]('\x22'+_0x1e99ca+'\x22');}break;default:_0x22b733['push']('\x22'+_0x4dd490+'\x22');}}else{switch(_0x34a90a){case'firstName':case _0xb57a('0x20'):_0x4af704[_0xb57a('0x4a')](_0x34a90a+_0xb57a('0x76'));break;default:_0x22b733[_0xb57a('0x4a')]('\x22\x22');}}}}if(_0x4af704[_0xb57a('0x50')]){handleError(_0x7c3f39[_0xb57a('0x6b')][_0x14f931],{'code':_0xb57a('0x77'),'message':_0x4af704[_0xb57a('0x14')]()});}else{fs['appendFileSync'](_0x5d6896,_0x22b733[_0xb57a('0x14')]()+'\x0a');}_0x22b733=[];}if(!(stats[_0xb57a('0x6c')]%0xc8)){socket[_0xb57a('0x78')]('contact:import:'+_0x52844a,stats);stats[_0xb57a('0x49')]=[];}}if(stopped){logger[_0xb57a('0x44')](_0xb57a('0x79'));_0x1e7b44['abort']();}}catch(_0x4c31a7){handleError(_0x7c3f39[_0xb57a('0x6b')][_0x14f931],{'code':_0xb57a('0x7a'),'message':_0x4c31a7['message']});logger[_0xb57a('0x46')](_0xb57a('0x7b'),_0x4c31a7[_0xb57a('0x47')]);}},'complete':function(){try{var _0x4781a8=[];var _0x3e85a8=[];var _0x5d1107=_0xb57a('0x36');if(_0xffc10c[_0xb57a('0x7c')]&&_0xffc10c[_0xb57a('0x7c')]['length']){_0x5d1107='cm_contacts_'+_0x52844a;_0x4781a8[_0xb57a('0x4a')](_0xb57a('0x7d')+_0x5d1107+_0xb57a('0x7e'));}tmp_campaigns=_0xb57a('0x7f')+_0x52844a;tmp_voice_queues=_0xb57a('0x80')+_0x52844a;_0x3e85a8['push'](_0xb57a('0x7d')+tmp_campaigns+_0xb57a('0x81'));_0x3e85a8[_0xb57a('0x4a')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xb57a('0x81'));BPromise[_0xb57a('0x82')](_0x3e85a8,handleTZQuery)[_0xb57a('0x52')](function(_0x4251d0){updateTzCampaigns(_0xffc10c['ListId'])[_0xb57a('0x52')](function(_0x1bc87b){updateTzVoiceQueues(_0xffc10c[_0xb57a('0x23')])[_0xb57a('0x52')](function(_0x208a12){var _0x44fe49=util[_0xb57a('0x10')]('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',_0x5d6896,_0x5d1107,_0x1f64e6,_0xffc10c[_0xb57a('0x23')],_0xffc10c[_0xb57a('0x3d')]||null,NOW,NOW);if(_['isNil'](_0x23eece[_0xb57a('0x21')])){_0x44fe49+=',\x20scheduledAt\x20=\x20NOW()';}_0x4781a8['push'](_0x44fe49);if(_0xffc10c[_0xb57a('0x7c')]&&_0xffc10c['duplicates']['length']){_0x4781a8[_0xb57a('0x4a')](insertCmContact(_0xffc10c[_0xb57a('0x23')],_0x5d1107,_0xffc10c[_0xb57a('0x7c')],_0x23eece));_0x4781a8['push'](_0xb57a('0x83')+_0x5d1107+';');}if(hasTZ){_0x4781a8[_0xb57a('0x4a')](insertTzCmHopper(_0xffc10c[_0xb57a('0x23')],_0xb57a('0x55'),_0xb57a('0x54'),_0xb57a('0x84'),_0x10f307,tmp_voice_queues));_0x4781a8['push'](insertTzCmHopperBlack(_0xffc10c['ListId'],_0xb57a('0x85'),_0xb57a('0x54'),_0xb57a('0x84')));_0x4781a8[_0xb57a('0x4a')](insertTzCmHopper(_0xffc10c[_0xb57a('0x23')],'campaigns_has_cm_lists',_0xb57a('0x4e'),_0xb57a('0x86'),_0x10f307,tmp_campaigns));_0x4781a8[_0xb57a('0x4a')](insertTzCmHopperBlack(_0xffc10c[_0xb57a('0x23')],_0xb57a('0x87'),_0xb57a('0x4e'),_0xb57a('0x86')));}else{_0x4781a8['push'](insertCmHopper(_0xffc10c[_0xb57a('0x23')],_0xb57a('0x55'),_0xb57a('0x54'),'VoiceQueueId',_0x10f307));_0x4781a8[_0xb57a('0x4a')](insertCmHopperBlack(_0xffc10c[_0xb57a('0x23')],'voice_queues_has_cm_blacklists',_0xb57a('0x54'),_0xb57a('0x84')));_0x4781a8[_0xb57a('0x4a')](insertCmHopper(_0xffc10c['ListId'],_0xb57a('0x88'),_0xb57a('0x4e'),_0xb57a('0x86'),_0x10f307));_0x4781a8[_0xb57a('0x4a')](insertCmHopperBlack(_0xffc10c[_0xb57a('0x23')],'campaigns_has_cm_blacklists',_0xb57a('0x4e'),_0xb57a('0x86')));}_0x4781a8[_0xb57a('0x4a')](_0xb57a('0x83')+tmp_campaigns+';');_0x4781a8[_0xb57a('0x4a')](_0xb57a('0x83')+tmp_voice_queues+';');BPromise['each'](_0x4781a8,handleQuery)['then'](function(_0x5f1340){stats[_0xb57a('0x89')]=!![];stats['affectedRows']=_0xffc10c[_0xb57a('0x7c')]&&_0xffc10c[_0xb57a('0x7c')][_0xb57a('0x50')]?results[0x2][_0xb57a('0x8a')]:results[0x0][_0xb57a('0x8a')];socket[_0xb57a('0x78')]('contact:import:'+_0x52844a,stats);fs['unlink'](_0x13f944);fs[_0xb57a('0x8b')](_0x5d6896);process[_0xb57a('0x48')](0x0);})[_0xb57a('0x4c')](function(_0x3690b4){logger[_0xb57a('0x46')](_0x3690b4['message']);process[_0xb57a('0x48')](0x1);});});});});}catch(_0x33169c){logger[_0xb57a('0x46')](_0xb57a('0x8c'),_0x33169c[_0xb57a('0x47')]);process[_0xb57a('0x48')](0x1);}},'error':function(_0xc35eac,_0x43bdeb,_0x3bcc3b,_0x353403){throw new Error(_0x353403);}});}function validate(){if(process['argv']&&process[_0xb57a('0x8d')][_0xb57a('0x50')]<0x4){throw new Error(_0xb57a('0x8e'));}var _0x5ab0ad=path[_0xb57a('0x14')](config[_0xb57a('0x62')],_0xb57a('0x63'),process[_0xb57a('0x8d')][0x2]);if(!fs[_0xb57a('0x8f')](_0x5ab0ad)){throw new Error(_0xb57a('0x90'));}var _0x16d03e={};try{_0x16d03e=JSON[_0xb57a('0x69')](process[_0xb57a('0x8d')][0x3]);if(!_0x16d03e['binding']){throw new Error(_0xb57a('0x91'));}if(!_0x16d03e['binding']['phone']){throw new Error(_0xb57a('0x92'));}if(!_0x16d03e[_0xb57a('0x60')][_0xb57a('0x93')]){throw new Error(_0xb57a('0x94'));}var _0x5abe09=0x0;if(_0x16d03e[_0xb57a('0x60')][_0xb57a('0x26')]){_0x5abe09=0x1;}if(!_0x16d03e[_0xb57a('0x23')]){throw new Error(_0xb57a('0x95'));}}catch(_0x2080f7){throw new Error(_0xb57a('0x96'));}var _0x419ee5=[];try{_0x419ee5=_[_0xb57a('0x97')](JSON[_0xb57a('0x69')](process['argv'][0x4]),'id');}catch(_0x4fd7dc){logger[_0xb57a('0x44')](_0xb57a('0x98'));}main(_0x5ab0ad,_0x16d03e,_0x419ee5,_0x5abe09);}validate();process['on'](_0xb57a('0x99'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index ae62715..28f761d 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb6e=['Called\x20Number','Member\x20Name','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','holdtime','talktime'];(function(_0x1aebde,_0x548787){var _0x2cec9c=function(_0x194e9e){while(--_0x194e9e){_0x1aebde['push'](_0x1aebde['shift']());}};_0x2cec9c(++_0x548787);}(_0xdb6e,0x137));var _0xedb6=function(_0x3b9aa6,_0x3f0c03){_0x3b9aa6=_0x3b9aa6-0x0;var _0x12a0a9=_0xdb6e[_0x3b9aa6];return _0x12a0a9;};'use strict';exports[_0xedb6('0x0')]=function(_0x3aee2b,_0x3991e8){var _0x5dbd8f=[{'type':_0xedb6('0x1'),'content':_0xedb6('0x2'),'variableName':null}];switch(_0x3aee2b['toLowerCase']()){case _0xedb6('0x3'):switch(_0x3991e8[_0xedb6('0x4')]()){case _0xedb6('0x5'):_0x5dbd8f[_0xedb6('0x6')]({'type':_0xedb6('0x7'),'content':'','variableName':_0xedb6('0x8')});_0x5dbd8f['push']({'type':'variable','content':'','variableName':_0xedb6('0x9')});break;case _0xedb6('0xa'):_0x5dbd8f[_0xedb6('0x6')]({'type':_0xedb6('0x1'),'content':'Outbound\x20Call','variableName':null});_0x5dbd8f[_0xedb6('0x6')]({'type':_0xedb6('0x7'),'content':'','variableName':_0xedb6('0xb')});break;}}return _0x5dbd8f;};exports[_0xedb6('0xc')]=function(_0x42e2f6,_0x538fde){var _0x58e342=[];switch(_0x42e2f6['toLowerCase']()){case _0xedb6('0x3'):switch(_0x538fde[_0xedb6('0x4')]()){case _0xedb6('0x5'):_0x58e342=[{'type':'string','content':_0xedb6('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0xf'),'keyType':_0xedb6('0x7'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0xedb6('0x10'),'keyType':'variable','variableName':_0xedb6('0x11')},{'type':'keyValue','content':'','key':_0xedb6('0x12'),'keyType':_0xedb6('0x7'),'variableName':_0xedb6('0x13')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x14'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':_0xedb6('0x15'),'keyType':'variable','variableName':_0xedb6('0x16')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x17'),'keyType':_0xedb6('0x7'),'variableName':_0xedb6('0x18')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xedb6('0xe'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0xedb6('0x19')},{'type':'keyValue','content':'','key':_0xedb6('0x1a'),'keyType':_0xedb6('0x7'),'variableName':_0xedb6('0xb')},{'type':_0xedb6('0x1'),'content':_0xedb6('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x1c'),'keyType':_0xedb6('0x7'),'variableName':_0xedb6('0x18')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x1d'),'keyType':_0xedb6('0x7'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0xedb6('0x1e'),'keyType':_0xedb6('0x7'),'variableName':'agentcompleteAt'},{'type':_0xedb6('0xe'),'content':'','key':'Hold\x20Time','keyType':'variable','variableName':_0xedb6('0x1f')},{'type':_0xedb6('0xe'),'content':'','key':'Talk\x20Time','keyType':_0xedb6('0x7'),'variableName':_0xedb6('0x20')}];break;case _0xedb6('0xa'):_0x58e342=[{'type':_0xedb6('0x1'),'content':_0xedb6('0xd'),'variableName':null},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x21'),'keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0xb')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x22'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x15'),'keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0x16')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x17'),'keyType':'variable','keyContent':'','variableName':_0xedb6('0x23')},{'type':_0xedb6('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x24'),'keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0x25')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x26'),'keyType':'variable','keyContent':'','variableName':_0xedb6('0x27')},{'type':'keyValue','content':'','key':'Duration','keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0x28')},{'type':'keyValue','content':'','key':_0xedb6('0x29'),'keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0x2a')}];break;}}return _0x58e342;}; \ No newline at end of file +var _0xa638=['answertime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','keyValue','Caller\x20Name','calleridname','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','starttime','***\x20Time\x20Info\x20***','Answer\x20Time'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xa638,0xd2));var _0x8a63=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xa638[_0x53ccf2];return _0x5a2964;};'use strict';exports[_0x8a63('0x0')]=function(_0x38cb19,_0x159ce0){var _0x51efdd=[{'type':_0x8a63('0x1'),'content':_0x8a63('0x2'),'variableName':null}];switch(_0x38cb19['toLowerCase']()){case _0x8a63('0x3'):switch(_0x159ce0[_0x8a63('0x4')]()){case _0x8a63('0x5'):_0x51efdd[_0x8a63('0x6')]({'type':_0x8a63('0x7'),'content':'','variableName':_0x8a63('0x8')});_0x51efdd['push']({'type':_0x8a63('0x7'),'content':'','variableName':_0x8a63('0x9')});break;case _0x8a63('0xa'):_0x51efdd[_0x8a63('0x6')]({'type':'string','content':_0x8a63('0xb'),'variableName':null});_0x51efdd[_0x8a63('0x6')]({'type':'variable','content':'','variableName':_0x8a63('0xc')});break;}}return _0x51efdd;};exports[_0x8a63('0xd')]=function(_0x4eff62,_0x23d828){var _0x1ceab7=[];switch(_0x4eff62['toLowerCase']()){case _0x8a63('0x3'):switch(_0x23d828[_0x8a63('0x4')]()){case _0x8a63('0x5'):_0x1ceab7=[{'type':_0x8a63('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x8a63('0xe'),'content':'','key':'Caller\x20Number','keyType':_0x8a63('0x7'),'variableName':'calleridnum'},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0xf'),'keyType':_0x8a63('0x7'),'variableName':_0x8a63('0x10')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x8a63('0x7'),'variableName':'destexten'},{'type':_0x8a63('0xe'),'content':'','key':'Queue','keyType':'variable','variableName':_0x8a63('0x8')},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x11'),'keyType':'variable','variableName':_0x8a63('0x12')},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x13'),'keyType':'variable','variableName':_0x8a63('0x14')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x15'),'keyType':_0x8a63('0x7'),'variableName':_0x8a63('0x16')},{'type':'keyValue','content':'','key':_0x8a63('0x17'),'keyType':_0x8a63('0x7'),'variableName':_0x8a63('0xc')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x18'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x8a63('0xe'),'content':'','key':'Agent\x20Connect','keyType':_0x8a63('0x7'),'variableName':_0x8a63('0x19')},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x1a'),'keyType':_0x8a63('0x7'),'variableName':_0x8a63('0x1b')},{'type':'keyValue','content':'','key':_0x8a63('0x1c'),'keyType':_0x8a63('0x7'),'variableName':_0x8a63('0x1d')},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x1e'),'keyType':'variable','variableName':_0x8a63('0x1f')}];break;case'outbound':_0x1ceab7=[{'type':_0x8a63('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x20'),'keyType':_0x8a63('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x8a63('0xe'),'content':'','key':'Member\x20Name','keyType':_0x8a63('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x8a63('0xe'),'content':'','key':'UniqueId','keyType':_0x8a63('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x13'),'keyType':_0x8a63('0x7'),'keyContent':'','variableName':_0x8a63('0x21')},{'type':_0x8a63('0x1'),'content':_0x8a63('0x22')},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x23'),'keyType':'variable','keyContent':'','variableName':_0x8a63('0x24')},{'type':_0x8a63('0xe'),'content':'','key':'Complete\x20Time','keyType':_0x8a63('0x7'),'keyContent':'','variableName':'endtime'},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x25'),'keyType':_0x8a63('0x7'),'keyContent':'','variableName':_0x8a63('0x26')},{'type':_0x8a63('0xe'),'content':'','key':_0x8a63('0x27'),'keyType':_0x8a63('0x7'),'keyContent':'','variableName':_0x8a63('0x28')}];break;}}return _0x1ceab7;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 989cfe8..348b664 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3280=['fax-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','null','Interaction','findOne','info','catch','error','tracked','user','query','clone','body','html','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x204575,_0x4011a6){var _0x44825f=function(_0x2bff5a){while(--_0x2bff5a){_0x204575['push'](_0x204575['shift']());}};_0x44825f(++_0x4011a6);}(_0x3280,0x83));var _0x0328=function(_0x234732,_0x2dc38b){_0x234732=_0x234732-0x0;var _0xed5bc7=_0x3280[_0x234732];return _0xed5bc7;};'use strict';var _=require(_0x0328('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x0328('0x1'))(_0x0328('0x2')),'mail':require('../../config/logger')(_0x0328('0x3')),'fax':require(_0x0328('0x1'))(_0x0328('0x4')),'sms':require(_0x0328('0x1'))('sms-interactions'),'chat':require(_0x0328('0x1'))(_0x0328('0x5')),'whatsapp':require('../../config/logger')(_0x0328('0x6'))};function getInteractionId(_0x108e1f,_0x2379df,_0x36e11e){if(_0x108e1f&&_0x108e1f[_[_0x0328('0x7')](_0x36e11e)+_0x0328('0x8')]){return _0x108e1f[_[_0x0328('0x7')](_0x36e11e)+_0x0328('0x8')];}else if(_0x108e1f&&_0x108e1f['id']){return _0x108e1f['id'];}else if(_0x2379df&&_0x2379df['id']){return _0x2379df['id'];}else{return'unknown';}}function log(_0xdd8d36,_0x274a02,_0x2335a9,_0x348558,_0x233d18,_0x5a80a0){loggers[_0x233d18[_0x0328('0x9')]()][_0xdd8d36](_0x0328('0xa'),_0x5a80a0['toUpperCase'](),_0x274a02?_0x274a02['id']:null,_0x274a02?_0x274a02[_0x0328('0xb')]:null,_0x274a02?_0x274a02['role']:null,getInteractionId(_0x2335a9,_0x348558,_0x233d18),_0x2335a9?JSON[_0x0328('0xc')](_0x2335a9):_0x0328('0xd'));}function updateUser(_0x1f0f29,_0x1adcc8,_0x44ce6b,_0x39f542,_0x3e6910){db[_[_0x0328('0x7')](_0x39f542)+_0x0328('0xe')][_0x0328('0xf')]({'where':{'id':getInteractionId(_0x1adcc8,_0x44ce6b,_0x39f542)}})['then'](function(_0x2b9f03){if(_0x2b9f03){return _0x2b9f03['update']({'UserId':_0x1f0f29?_0x1f0f29['id']:null});}})['then'](function(_0x21a897){if(_0x21a897){log(_0x0328('0x10'),_0x1f0f29,_0x1adcc8,_0x44ce6b,_0x39f542,_0x3e6910);}})[_0x0328('0x11')](function(){log(_0x0328('0x12'),_0x1f0f29,_0x1adcc8,_0x44ce6b,_0x39f542,_0x3e6910);});}exports[_0x0328('0x13')]=function(_0x490d00,_0x2bbba5){return function(_0xfcef53,_0x3d8c37,_0x257940){var _0x52c85e=_0xfcef53[_0x0328('0x14')];var _0x52312d={};var _0x689fc0=_0xfcef53[_0x0328('0x15')];if(_0x52312d){_0x52312d=_[_0x0328('0x16')](_0xfcef53[_0x0328('0x17')]);_0x52312d=_['omit'](_0x52312d,['body',_0x0328('0x18'),'phone',_0x0328('0x19'),_0x0328('0x1a')]);}updateUser(_0x52c85e,_0x52312d,_0x689fc0,_0x490d00,_0x2bbba5);_0x257940(null);};}; \ No newline at end of file +var _0x56c6=['../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','findOne','then','update','catch','error','user','query','body','omit','html','fax','mobile','lodash','../../mysqldb'];(function(_0x271c11,_0x3a34d){var _0x473748=function(_0x8988f9){while(--_0x8988f9){_0x271c11['push'](_0x271c11['shift']());}};_0x473748(++_0x3a34d);}(_0x56c6,0x116));var _0x656c=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x56c6[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x656c('0x0'));var db=require(_0x656c('0x1'))['db'];var loggers={'openchannel':require(_0x656c('0x2'))(_0x656c('0x3')),'mail':require(_0x656c('0x2'))('mail-interactions'),'fax':require(_0x656c('0x2'))(_0x656c('0x4')),'sms':require(_0x656c('0x2'))(_0x656c('0x5')),'chat':require('../../config/logger')(_0x656c('0x6')),'whatsapp':require('../../config/logger')(_0x656c('0x7'))};function getInteractionId(_0x556cba,_0x5e8d83,_0x131ec4){if(_0x556cba&&_0x556cba[_['upperFirst'](_0x131ec4)+_0x656c('0x8')]){return _0x556cba[_[_0x656c('0x9')](_0x131ec4)+_0x656c('0x8')];}else if(_0x556cba&&_0x556cba['id']){return _0x556cba['id'];}else if(_0x5e8d83&&_0x5e8d83['id']){return _0x5e8d83['id'];}else{return _0x656c('0xa');}}function log(_0x1d2541,_0x556de6,_0xe8351d,_0x18a9a2,_0xd2d77c,_0x3fc738){loggers[_0xd2d77c[_0x656c('0xb')]()][_0x1d2541](_0x656c('0xc'),_0x3fc738['toUpperCase'](),_0x556de6?_0x556de6['id']:null,_0x556de6?_0x556de6[_0x656c('0xd')]:null,_0x556de6?_0x556de6[_0x656c('0xe')]:null,getInteractionId(_0xe8351d,_0x18a9a2,_0xd2d77c),_0xe8351d?JSON['stringify'](_0xe8351d):_0x656c('0xf'));}function updateUser(_0x5a79a9,_0x30687b,_0x45e9b0,_0x2b36ee,_0x5a04ad){db[_[_0x656c('0x9')](_0x2b36ee)+'Interaction'][_0x656c('0x10')]({'where':{'id':getInteractionId(_0x30687b,_0x45e9b0,_0x2b36ee)}})[_0x656c('0x11')](function(_0xbd3fa0){if(_0xbd3fa0){return _0xbd3fa0[_0x656c('0x12')]({'UserId':_0x5a79a9?_0x5a79a9['id']:null});}})[_0x656c('0x11')](function(_0x476371){if(_0x476371){log('info',_0x5a79a9,_0x30687b,_0x45e9b0,_0x2b36ee,_0x5a04ad);}})[_0x656c('0x13')](function(){log(_0x656c('0x14'),_0x5a79a9,_0x30687b,_0x45e9b0,_0x2b36ee,_0x5a04ad);});}exports['tracked']=function(_0xe2243b,_0x4fd8f7){return function(_0x2a9fee,_0x38c7ff,_0x4c80cd){var _0x1a8227=_0x2a9fee[_0x656c('0x15')];var _0x4962bb={};var _0x2704a4=_0x2a9fee[_0x656c('0x16')];if(_0x4962bb){_0x4962bb=_['clone'](_0x2a9fee[_0x656c('0x17')]);_0x4962bb=_[_0x656c('0x18')](_0x4962bb,[_0x656c('0x17'),_0x656c('0x19'),'phone',_0x656c('0x1a'),_0x656c('0x1b')]);}updateUser(_0x1a8227,_0x4962bb,_0x2704a4,_0xe2243b,_0x4fd8f7);_0x4c80cd(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 971f1c3..acd7e3b 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 _0x7e3a=['User','admin','user','isUserLimit','crypto','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users'];(function(_0x2715cf,_0x517bb2){var _0x1bdcb8=function(_0x5dec7b){while(--_0x5dec7b){_0x2715cf['push'](_0x2715cf['shift']());}};_0x1bdcb8(++_0x517bb2);}(_0x7e3a,0xee));var _0xa7e3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7e3a[_0x397e5f];return _0x5302b8;};'use strict';var crypto=require(_0xa7e3('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xa7e3('0x1'));function getValueFromLicense(_0x2d4f79,_0x9e8f43){if(_0x2d4f79&&_0x9e8f43){if(_0x9e8f43[_0xa7e3('0x2')]&&_0x9e8f43[_0xa7e3('0x3')]){var _0x540023=_0x9e8f43[_0xa7e3('0x2')];var _0x87d3fc=_0x9e8f43['license'];var _0x3d74dc=_0x540023[_0xa7e3('0x4')]('-')[0x4];var _0x19f7f9=_0x540023[_0xa7e3('0x4')]('-')[0x0];var _0x2db722=crypto[_0xa7e3('0x5')](_0xa7e3('0x6'),util['format'](_0xa7e3('0x7'),_0x3d74dc,_0x540023,_0x19f7f9));var _0x527781=_0x2db722[_0xa7e3('0x8')](_0x87d3fc,_0xa7e3('0x9'),_0xa7e3('0xa'));_0x527781+=_0x2db722[_0xa7e3('0xb')](_0xa7e3('0xa'));var _0x347a07=JSON[_0xa7e3('0xc')](_0x527781);return _0x347a07[_0xa7e3('0xd')](_0x2d4f79)?_0x347a07[_0x2d4f79]:null;}}return null;}function isLimit(_0x533264,_0x411458,_0x612127,_0x40694d){var _0x3582cb=_0x411458;return compose()[_0xa7e3('0xe')](function(_0x40e2ef,_0x345448,_0xc53a94){return db[_0xa7e3('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xa7e3('0x10')](function(_0x1a27e1){var _0x35646b=getValueFromLicense(_0x533264,_0x1a27e1);return _0x35646b?_0x35646b:_0x3582cb;})[_0xa7e3('0x10')](function(_0x1a49c9){_0x3582cb=_0x1a49c9;return _0x612127[_0xa7e3('0x11')](_0x40694d);})[_0xa7e3('0x10')](function(_0x2e77c5){if(_0x2e77c5>=_0x3582cb){return _0x345448[_0xa7e3('0x12')](0x193)['json']({'message':util[_0xa7e3('0x13')](_0xa7e3('0x14'),_0x533264)});}_0xc53a94();})['catch'](function(_0xfe422b){_0xc53a94(_0xfe422b);});});}function isUserLimit(){return isLimit(_0xa7e3('0x15'),0x1,db[_0xa7e3('0x16')],{'where':{'$or':[{'role':_0xa7e3('0x17')},{'role':_0xa7e3('0x18')}]}});}exports[_0xa7e3('0x19')]=isUserLimit; \ No newline at end of file +var _0x5fc8=['user','isUserLimit','crypto','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','parse','hasOwnProperty','use','License','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin'];(function(_0x485b5d,_0x5692b6){var _0xa90291=function(_0x57ea35){while(--_0x57ea35){_0x485b5d['push'](_0x485b5d['shift']());}};_0xa90291(++_0x5692b6);}(_0x5fc8,0x16e));var _0x85fc=function(_0xe9ff32,_0x29317b){_0xe9ff32=_0xe9ff32-0x0;var _0x533663=_0x5fc8[_0xe9ff32];return _0x533663;};'use strict';var crypto=require(_0x85fc('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x85fc('0x1'))['db'];var config=require(_0x85fc('0x2'));function getValueFromLicense(_0x39d537,_0x387168){if(_0x39d537&&_0x387168){if(_0x387168[_0x85fc('0x3')]&&_0x387168[_0x85fc('0x4')]){var _0x2a8005=_0x387168[_0x85fc('0x3')];var _0x1d4a38=_0x387168['license'];var _0x4592d3=_0x2a8005[_0x85fc('0x5')]('-')[0x4];var _0x1204c9=_0x2a8005[_0x85fc('0x5')]('-')[0x0];var _0x5a7e68=crypto[_0x85fc('0x6')](_0x85fc('0x7'),util[_0x85fc('0x8')](_0x85fc('0x9'),_0x4592d3,_0x2a8005,_0x1204c9));var _0x324fe8=_0x5a7e68[_0x85fc('0xa')](_0x1d4a38,_0x85fc('0xb'),'utf8');_0x324fe8+=_0x5a7e68['final']('utf8');var _0x27c614=JSON[_0x85fc('0xc')](_0x324fe8);return _0x27c614[_0x85fc('0xd')](_0x39d537)?_0x27c614[_0x39d537]:null;}}return null;}function isLimit(_0x3f6e35,_0x5112ab,_0x1ed96e,_0x312205){var _0x46cf02=_0x5112ab;return compose()[_0x85fc('0xe')](function(_0x16ff87,_0x5c9932,_0x31cbfa){return db[_0x85fc('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x85fc('0x10')](function(_0x4ec5bd){var _0x5cddfe=getValueFromLicense(_0x3f6e35,_0x4ec5bd);return _0x5cddfe?_0x5cddfe:_0x46cf02;})[_0x85fc('0x10')](function(_0x322d15){_0x46cf02=_0x322d15;return _0x1ed96e[_0x85fc('0x11')](_0x312205);})[_0x85fc('0x10')](function(_0x183cd6){if(_0x183cd6>=_0x46cf02){return _0x5c9932[_0x85fc('0x12')](0x193)['json']({'message':util[_0x85fc('0x8')](_0x85fc('0x13'),_0x3f6e35)});}_0x31cbfa();})[_0x85fc('0x14')](function(_0x4e1c4a){_0x31cbfa(_0x4e1c4a);});});}function isUserLimit(){return isLimit(_0x85fc('0x15'),0x1,db[_0x85fc('0x16')],{'where':{'$or':[{'role':_0x85fc('0x17')},{'role':_0x85fc('0x18')}]}});}exports[_0x85fc('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ab1c3a0..89d3392 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 _0xa044=['sqlOperator','and','replace','[$and]','split','length','slice','forEach','shift','indexOf','map','conditions','buildExpression','$eq','operator','$between','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','text','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','NOT\x20IN\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch'];(function(_0x582c64,_0xadba12){var _0x3c906b=function(_0x4a3a82){while(--_0x4a3a82){_0x582c64['push'](_0x582c64['shift']());}};_0x3c906b(++_0xadba12);}(_0xa044,0x1d2));var _0x4a04=function(_0x5ae509,_0x30c3c4){_0x5ae509=_0x5ae509-0x0;var _0x2d6892=_0xa044[_0x5ae509];return _0x2d6892;};'use strict';var _=require(_0x4a04('0x0'));var moment=require('moment');exports[_0x4a04('0x1')]=function(_0x2814b7){var _0x4bd134={'conditions':[]};_0x4bd134[_0x4a04('0x2')]=_['startsWith'](_0x2814b7,'[$or]')?'or':_0x4a04('0x3');var _0x433160=_0x2814b7[_0x4a04('0x4')](_0x4a04('0x5'),'')['replace']('[$or]','')[_0x4a04('0x6')]('||');for(var _0x48fdf3=0x0;_0x48fdf3<_0x433160[_0x4a04('0x7')];_0x48fdf3++){var _0x2427d1=_0x433160[_0x48fdf3][_0x4a04('0x6')](':=');var _0x400ab1=_0x2427d1[0x0];var _0x4c72ea=_0x2427d1[_0x4a04('0x8')](0x1);_0x4c72ea[_0x4a04('0x9')](function(_0xce639c){var _0x44a287=_0xce639c[_0x4a04('0x6')]('[')[_0x4a04('0xa')]();var _0x1b4ab0=_0xce639c['match'](/\[(.*?)\]/g);_0x1b4ab0[_0x4a04('0x9')](function(_0x577143){var _0x184038=_0x577143[_0x4a04('0x6')]('[')['filter'](function(_0x3ae869){return _0x3ae869[_0x4a04('0xb')](']')>-0x1;})[_0x4a04('0xc')](function(_0x3cf8bd){return _0x3cf8bd['split'](']')[0x0];})[0x0];_0x4bd134[_0x4a04('0xd')]['push']({'field':_0x400ab1,'operator':_0x44a287,'value':_0x184038});});});}return _0x4bd134;};exports[_0x4a04('0xe')]=function(_0x23b5bc,_0x3d919b,_0x2e2d24){var _0x437aa4={};if(_0x3d919b==='DATE'){if(_0x2e2d24['operator']===_0x4a04('0xf')){_0x2e2d24[_0x4a04('0x10')]=_0x4a04('0x11');_0x2e2d24[_0x4a04('0x12')]+=','+_0x2e2d24[_0x4a04('0x12')];}else if(_[_0x4a04('0x13')]([_0x4a04('0x14'),'$lte'],_0x2e2d24['operator'])){_0x2e2d24['value']=moment(_0x2e2d24[_0x4a04('0x12')])[_0x4a04('0x15')](0x1,_0x4a04('0x16'))[_0x4a04('0x17')](_0x4a04('0x18'));}}if(_0x2e2d24[_0x4a04('0x19')]){_0x3d919b=_0x2e2d24[_0x4a04('0x19')];_0x437aa4[_0x4a04('0x1a')]='CAST('+_0x23b5bc+'.'+_0x2e2d24['field']+_0x4a04('0x1b')+_0x2e2d24[_0x4a04('0x19')]+')\x20'+parseOperator(_0x2e2d24[_0x4a04('0x10')]);}else{_0x437aa4[_0x4a04('0x1a')]=_0x23b5bc+'.'+_0x2e2d24[_0x4a04('0x1c')]+'\x20'+parseOperator(_0x2e2d24[_0x4a04('0x10')]);}if(_[_0x4a04('0x13')]([_0x4a04('0x1d'),_0x4a04('0x1e')],_0x2e2d24[_0x4a04('0x10')]))_0x437aa4[_0x4a04('0x1a')]='('+_0x437aa4[_0x4a04('0x1a')]+_0x4a04('0x1f')+_0x23b5bc+'.'+_0x2e2d24[_0x4a04('0x1c')]+_0x4a04('0x20');_0x437aa4[_0x4a04('0x12')]=parseValue(_0x3d919b,_0x2e2d24[_0x4a04('0x10')],_0x2e2d24['value']);return _0x437aa4;};function parseOperator(_0x5467b3){var _0x1d21b2;switch(_0x5467b3){case'$in':_0x1d21b2='IN\x20?';break;case _0x4a04('0x1e'):_0x1d21b2=_0x4a04('0x21');break;case _0x4a04('0xf'):_0x1d21b2='=\x20?';break;case _0x4a04('0x1d'):_0x1d21b2=_0x4a04('0x22');break;case _0x4a04('0x23'):case'$startsWith':case _0x4a04('0x24'):_0x1d21b2=_0x4a04('0x25');break;case _0x4a04('0x26'):_0x1d21b2=_0x4a04('0x27');break;case'$gt':_0x1d21b2=_0x4a04('0x28');break;case'$lte':_0x1d21b2='<=\x20?';break;case _0x4a04('0x29'):_0x1d21b2=_0x4a04('0x2a');break;case _0x4a04('0x11'):_0x1d21b2=_0x4a04('0x2b');break;}return _0x1d21b2;}function parseValue(_0x5eb638,_0x50ca60,_0x141fb1){var _0x365727={'start':undefined,'end':undefined};switch(_0x50ca60){case _0x4a04('0x2c'):case'$notIn':_0x365727[_0x4a04('0x2d')]=_0x141fb1[_0x4a04('0x6')](',');break;case _0x4a04('0x23'):_0x365727['start']='%'+_0x141fb1+'%';break;case _0x4a04('0x2e'):_0x365727[_0x4a04('0x2d')]=_0x141fb1+'%';break;case _0x4a04('0x24'):_0x365727[_0x4a04('0x2d')]='%'+_0x141fb1;break;case _0x4a04('0x11'):var _0x8aa7a2=_0x141fb1['split'](',');var _0x141fb1=_0x8aa7a2['shift']();var _0x4e94b3=_0x8aa7a2[_0x4a04('0x2f')]();if(_0x5eb638==='DATE'){_0x141fb1=moment(_0x141fb1)[_0x4a04('0x30')](0x0,!![])[_0x4a04('0x17')]();_0x4e94b3=moment(_0x4e94b3)[_0x4a04('0x30')](0x0,!![])[_0x4a04('0x15')](0x17,_0x4a04('0x31'))[_0x4a04('0x15')](0x3b,_0x4a04('0x32'))[_0x4a04('0x15')](0x3b,_0x4a04('0x33'))[_0x4a04('0x17')]();}_0x365727={'start':_0x141fb1,'end':_0x4e94b3};break;default:_0x365727[_0x4a04('0x2d')]=_0x141fb1;break;}return _0x365727;} \ No newline at end of file +var _0x5481=['YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','slice','forEach','split','match','map','conditions','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format'];(function(_0x32215e,_0x192fab){var _0x4377f8=function(_0x1b59e2){while(--_0x1b59e2){_0x32215e['push'](_0x32215e['shift']());}};_0x4377f8(++_0x192fab);}(_0x5481,0xf5));var _0x1548=function(_0x48df6e,_0xd49de5){_0x48df6e=_0x48df6e-0x0;var _0x2f9610=_0x5481[_0x48df6e];return _0x2f9610;};'use strict';var _=require('lodash');var moment=require(_0x1548('0x0'));exports[_0x1548('0x1')]=function(_0x59d227){var _0x38634b={'conditions':[]};_0x38634b[_0x1548('0x2')]=_[_0x1548('0x3')](_0x59d227,_0x1548('0x4'))?'or':'and';var _0x420af9=_0x59d227[_0x1548('0x5')](_0x1548('0x6'),'')[_0x1548('0x5')]('[$or]','')['split']('||');for(var _0x503e4b=0x0;_0x503e4b<_0x420af9[_0x1548('0x7')];_0x503e4b++){var _0x3955f6=_0x420af9[_0x503e4b]['split'](':=');var _0x231b31=_0x3955f6[0x0];var _0x549989=_0x3955f6[_0x1548('0x8')](0x1);_0x549989[_0x1548('0x9')](function(_0x4d520a){var _0x2979f8=_0x4d520a[_0x1548('0xa')]('[')['shift']();var _0xf2a0eb=_0x4d520a[_0x1548('0xb')](/\[(.*?)\]/g);_0xf2a0eb[_0x1548('0x9')](function(_0xab116d){var _0x219f54=_0xab116d[_0x1548('0xa')]('[')['filter'](function(_0x3d4512){return _0x3d4512['indexOf'](']')>-0x1;})[_0x1548('0xc')](function(_0x3f9e3f){return _0x3f9e3f['split'](']')[0x0];})[0x0];_0x38634b[_0x1548('0xd')]['push']({'field':_0x231b31,'operator':_0x2979f8,'value':_0x219f54});});});}return _0x38634b;};exports['buildExpression']=function(_0x233461,_0x58ee68,_0x5b69db){var _0x5dd7b4={};if(_0x58ee68===_0x1548('0xe')){if(_0x5b69db[_0x1548('0xf')]===_0x1548('0x10')){_0x5b69db[_0x1548('0xf')]=_0x1548('0x11');_0x5b69db['value']+=','+_0x5b69db[_0x1548('0x12')];}else if(_[_0x1548('0x13')]([_0x1548('0x14'),_0x1548('0x15')],_0x5b69db['operator'])){_0x5b69db[_0x1548('0x12')]=moment(_0x5b69db[_0x1548('0x12')])[_0x1548('0x16')](0x1,_0x1548('0x17'))[_0x1548('0x18')](_0x1548('0x19'));}}if(_0x5b69db[_0x1548('0x1a')]){_0x58ee68=_0x5b69db['castTo'];_0x5dd7b4['text']=_0x1548('0x1b')+_0x233461+'.'+_0x5b69db[_0x1548('0x1c')]+'\x20AS\x20'+_0x5b69db[_0x1548('0x1a')]+')\x20'+parseOperator(_0x5b69db['operator']);}else{_0x5dd7b4[_0x1548('0x1d')]=_0x233461+'.'+_0x5b69db['field']+'\x20'+parseOperator(_0x5b69db[_0x1548('0xf')]);}if(_[_0x1548('0x13')]([_0x1548('0x1e'),_0x1548('0x1f')],_0x5b69db['operator']))_0x5dd7b4[_0x1548('0x1d')]='('+_0x5dd7b4[_0x1548('0x1d')]+_0x1548('0x20')+_0x233461+'.'+_0x5b69db['field']+_0x1548('0x21');_0x5dd7b4[_0x1548('0x12')]=parseValue(_0x58ee68,_0x5b69db['operator'],_0x5b69db[_0x1548('0x12')]);return _0x5dd7b4;};function parseOperator(_0x48f940){var _0xd76313;switch(_0x48f940){case _0x1548('0x22'):_0xd76313=_0x1548('0x23');break;case'$notIn':_0xd76313=_0x1548('0x24');break;case _0x1548('0x10'):_0xd76313='=\x20?';break;case'$ne':_0xd76313=_0x1548('0x25');break;case _0x1548('0x26'):case _0x1548('0x27'):case _0x1548('0x28'):_0xd76313=_0x1548('0x29');break;case _0x1548('0x2a'):_0xd76313=_0x1548('0x2b');break;case _0x1548('0x14'):_0xd76313=_0x1548('0x2c');break;case _0x1548('0x15'):_0xd76313=_0x1548('0x2d');break;case'$gte':_0xd76313=_0x1548('0x2e');break;case _0x1548('0x11'):_0xd76313=_0x1548('0x2f');break;}return _0xd76313;}function parseValue(_0x2299b5,_0x37d65e,_0x3be19c){var _0x5a2623={'start':undefined,'end':undefined};switch(_0x37d65e){case _0x1548('0x22'):case _0x1548('0x1f'):_0x5a2623[_0x1548('0x30')]=_0x3be19c[_0x1548('0xa')](',');break;case _0x1548('0x26'):_0x5a2623[_0x1548('0x30')]='%'+_0x3be19c+'%';break;case'$startsWith':_0x5a2623['start']=_0x3be19c+'%';break;case'$endsWith':_0x5a2623[_0x1548('0x30')]='%'+_0x3be19c;break;case _0x1548('0x11'):var _0x1ee763=_0x3be19c['split'](',');var _0x3be19c=_0x1ee763[_0x1548('0x31')]();var _0x1de2a8=_0x1ee763[_0x1548('0x32')]();if(_0x2299b5===_0x1548('0xe')){_0x3be19c=moment(_0x3be19c)[_0x1548('0x33')](0x0,!![])['format']();_0x1de2a8=moment(_0x1de2a8)[_0x1548('0x33')](0x0,!![])['add'](0x17,_0x1548('0x34'))[_0x1548('0x16')](0x3b,'minutes')['add'](0x3b,_0x1548('0x35'))[_0x1548('0x18')]();}_0x5a2623={'start':_0x3be19c,'end':_0x1de2a8};break;default:_0x5a2623['start']=_0x3be19c;break;}return _0x5a2623;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d36ff90..9932346 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(_0x4f3242,_0x391954){var _0x49844f=function(_0x5ee033){while(--_0x5ee033){_0x4f3242['push'](_0x4f3242['shift']());}};_0x49844f(++_0x391954);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1a43a5,_0x4d1b4c){_0x1a43a5=_0x1a43a5-0x0;var _0x3ff971=_0xcca7[_0x1a43a5];return _0x3ff971;};'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 _0xac9d=['VIRTUAL','lower','options','lodash','sequelize','moment','parse','includes','keys','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','offset','sort','map','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','unset','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','pick','filter','object','columns','value','where','merge'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xac9d,0x14d));var _0xdac9=function(_0x5533b1,_0x7f4a9a){_0x5533b1=_0x5533b1-0x0;var _0x1009f3=_0xac9d[_0x5533b1];return _0x1009f3;};'use strict';var _=require(_0xdac9('0x0'));var sequelize=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1e6d33){var _0x12390c=['ne'];try{var _0x27eb7c=JSON[_0xdac9('0x3')](_0x1e6d33);var _0x1b967e=Object['keys'](_0x27eb7c)[0x0];return _0x12390c[_0xdac9('0x4')](_0x1b967e);}catch(_0x5a984a){return![];}}function getOperatorValue(_0x3d56ae){var _0x1f8ff3=JSON[_0xdac9('0x3')](_0x3d56ae);var _0x776b6c=Object[_0xdac9('0x5')](_0x1f8ff3)[0x0];var _0x39f560=_0x1f8ff3[_0x776b6c];return{['$'+_0x776b6c]:_0x39f560};}exports['fields']=function(_0x2b1d6f){var _0x47d9fd=null;if(_0x2b1d6f){_0x47d9fd=_0x2b1d6f[_0xdac9('0x6')](',');}return _0x47d9fd;};exports[_0xdac9('0x7')]=function(_0x39c92c,_0x1a4674){var _0x23ec14={};if(!_[_0xdac9('0x8')](_0x39c92c)){_[_0xdac9('0x9')](_0x39c92c,function(_0x1b604a,_0xbb5615){try{if(_0x1a4674){var _0x5514c5=_[_0xdac9('0xa')](_0x1a4674,{'name':_0xbb5615})||{};if(hasSequelizeOperator(_0x1b604a)){_0x23ec14[_0xbb5615]=getOperatorValue(_0x1b604a);}else if(_0x5514c5[_0xdac9('0xb')]==='DATE'&&_[_0xdac9('0xc')](_0x1b604a)){var _0xeddbc1=JSON[_0xdac9('0x3')](_0x1b604a);var _0x4b2436={'$gte':moment(moment(_0xeddbc1[_0xdac9('0xd')])[_0xdac9('0xe')](_0xdac9('0xf')))['utc']()['format'](),'$lte':moment(moment(_0xeddbc1[_0xdac9('0x10')])[_0xdac9('0xe')]('YYYY-MM-DD'))[_0xdac9('0x11')]()[_0xdac9('0x12')](0x1,'s')[_0xdac9('0xe')]()};_0x23ec14[_0xbb5615]=_0x4b2436;}else if(_0x5514c5[_0xdac9('0x13')]===_0xdac9('0x14')){_0x23ec14[_0xbb5615]=_0x1b604a;}else{_0x23ec14[_0xbb5615]=_[_0xdac9('0x15')](_0x1b604a)?_0x1b604a:JSON[_0xdac9('0x3')](_0x1b604a);}}else{_0x23ec14[_0xbb5615]=_[_0xdac9('0x15')](_0x1b604a)?_0x1b604a:JSON['parse'](_0x1b604a);}}catch(_0x283343){_0x23ec14[_0xbb5615]=_0x1b604a[_0xdac9('0x6')](',');}});}return _0x23ec14;};exports['limit']=function(_0x1cd239){_0x1cd239=parseInt(_0x1cd239,0xa);if(!_0x1cd239||_0x1cd239<0x0){_0x1cd239=LIMIT_VALUE;}return _0x1cd239;};exports[_0xdac9('0x16')]=function(_0x171df1){_0x171df1=parseInt(_0x171df1,0xa);if(!_0x171df1||_0x171df1<0x0){_0x171df1=0x0;}return _0x171df1;};exports[_0xdac9('0x17')]=function(_0x522dc3){var _0x520369,_0x4029fc=null;if(_0x522dc3){_0x520369=_0x522dc3[_0xdac9('0x6')](',');_0x4029fc=_[_0xdac9('0x18')](_0x520369,function(_0x395ec7){if(_0x395ec7['indexOf']('-')===0x0){return[_0x395ec7===_0xdac9('0x19')?sequelize[_0xdac9('0x1a')](sequelize[_0xdac9('0x1b')](_0xdac9('0x19')),_0xdac9('0x1c')):_0x395ec7[_0xdac9('0x1d')](0x1),_0xdac9('0x1e')];}else{return[_0x395ec7===_0xdac9('0x19')?sequelize[_0xdac9('0x1a')](sequelize[_0xdac9('0x1b')]('priority'),_0xdac9('0x1c')):_0x395ec7,_0xdac9('0x1f')];}});}return _0x4029fc;};exports[_0xdac9('0x20')]=function(_0x34a255,_0x5ca076){if(_[_0xdac9('0x8')](_0x34a255)){return _0x34a255;}if(_['isArray'](_0x34a255)){for(var _0x3ce475=0x0;_0x3ce475<_0x34a255[_0xdac9('0x21')];_0x3ce475+=0x1){_0x34a255[_0x3ce475]=this['omit'](_0x34a255[_0x3ce475],_0x5ca076);}return _0x34a255;}if(!_[_0xdac9('0x22')](_0x34a255)){return _0x34a255;}if(_['isString'](_0x5ca076)){_0x5ca076=[_0x5ca076];}if(!_[_0xdac9('0x15')](_0x5ca076)){return _0x34a255;}for(var _0x3743f7=0x0;_0x3743f7<_0x5ca076[_0xdac9('0x21')];_0x3743f7+=0x1){_[_0xdac9('0x23')](_0x34a255,_0x5ca076[_0x3743f7]);}for(var _0x57d76a in _0x34a255){if(_0x34a255['hasOwnProperty'](_0x57d76a)){_0x34a255[_0x57d76a]=this[_0xdac9('0x20')](_0x34a255[_0x57d76a],_0x5ca076);}}return _0x34a255;};exports[_0xdac9('0x24')]=function(_0x4fe3bd){return _0x4fe3bd['match'](RegExp(_0xdac9('0x25')))?!![]:![];};exports[_0xdac9('0x26')]=function(_0x13efba){return _0x13efba[_0xdac9('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xdac9('0x28')]=function(_0x2247f8){var _0xed99f9=[];_0x2247f8[_0xdac9('0x6')](/[ ,]+/)[_0xdac9('0x29')](function(_0x2f36f4){_0x2f36f4=_0x2f36f4[_0xdac9('0x2a')](/([^:]")"+/g,'$1');_0x2f36f4='+'+_0x2f36f4+'*';var _0x42c276=/[ `!@#$%^&*()_\-?~]/;if(_0x2f36f4[_0xdac9('0x27')](_0x42c276))_0x2f36f4='\x22'+_0x2f36f4+'\x22';_0xed99f9[_0xdac9('0x2b')](_0x2f36f4);});return _0xed99f9[_0xdac9('0x2c')]('\x20');};exports[_0xdac9('0x2d')]=function(_0x372f02,_0x44eff2,_0x339f31){var _0x20397e={},_0x92c891={};if(_0x44eff2['query']['$id']){_0x44eff2[_0xdac9('0x2e')]['id']=_0x44eff2[_0xdac9('0x2e')][_0xdac9('0x2f')];delete _0x44eff2[_0xdac9('0x2e')][_0xdac9('0x2f')];}_0x20397e['model']=_[_0xdac9('0x18')](_0x372f02,'name');_0x20397e[_0xdac9('0x2e')]=_[_0xdac9('0x5')](_0x44eff2['query']);_0x20397e[_0xdac9('0x7')]=_['intersection'](_0x20397e['model'],_0x20397e[_0xdac9('0x2e')]);_0x92c891[_0xdac9('0x30')]=_[_0xdac9('0x31')](_0x20397e[_0xdac9('0x32')],this[_0xdac9('0x33')](_0x44eff2[_0xdac9('0x2e')]['fields']));_0x92c891[_0xdac9('0x30')]=_0x92c891[_0xdac9('0x30')]['length']?_0x92c891[_0xdac9('0x30')]:_0x20397e[_0xdac9('0x32')];if(!_0x44eff2[_0xdac9('0x2e')][_0xdac9('0x34')](_0xdac9('0x35'))){_0x92c891[_0xdac9('0x36')]=this[_0xdac9('0x36')](_0x44eff2['query'][_0xdac9('0x36')]);_0x92c891[_0xdac9('0x16')]=this[_0xdac9('0x16')](_0x44eff2['query'][_0xdac9('0x16')]);}_0x92c891[_0xdac9('0x37')]=this[_0xdac9('0x17')](_0x44eff2[_0xdac9('0x2e')]['sort']);_0x92c891['where']=this[_0xdac9('0x7')](_[_0xdac9('0x38')](_0x44eff2[_0xdac9('0x2e')],_0x20397e[_0xdac9('0x7')]),_0x372f02);if(_0x44eff2[_0xdac9('0x2e')]['filter']){var _0x8435e8=_0x372f02;var _0x482f4a=_0x44eff2[_0xdac9('0x2e')][_0xdac9('0x39')];if(typeof _0x482f4a===_0xdac9('0x3a')){_0x8435e8=_[_0xdac9('0x39')](_0x372f02,function(_0x2a50f0){return _[_0xdac9('0x4')](_0x482f4a[_0xdac9('0x3b')],_0x2a50f0[_0xdac9('0x13')]);});_0x482f4a=_0x482f4a[_0xdac9('0x3c')];}_0x92c891[_0xdac9('0x3d')]=_[_0xdac9('0x3e')](_0x92c891[_0xdac9('0x3d')],{'$or':_[_0xdac9('0x18')](_0x8435e8,function(_0x441676){if(_0x441676['type']!==_0xdac9('0x3f')){if(_0x339f31){return sequelize[_0xdac9('0x3d')](sequelize['fn']('lower',sequelize[_0xdac9('0x1b')](_0x441676[_0xdac9('0x13')])),{'$like':sequelize['fn'](_0xdac9('0x40'),'%'+_0x44eff2[_0xdac9('0x2e')][_0xdac9('0x39')]+'%')});}else{var _0xf97b9a={};_0xf97b9a[_0x441676['name']]={'$like':'%'+_0x44eff2[_0xdac9('0x2e')]['filter']+'%'};return _0xf97b9a;}}})});}_0x92c891=_[_0xdac9('0x3e')]({},_0x92c891,_0x44eff2[_0xdac9('0x41')]);return _0x92c891;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 2e3a157..bc219f6 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(_0x11bd02,_0x2d91d1){var _0x262863=function(_0x80104){while(--_0x80104){_0x11bd02['push'](_0x11bd02['shift']());}};_0x262863(++_0x2d91d1);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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(_0x1c83f1,_0x48fccb){var _0x8797f8=function(_0x3a1f76){while(--_0x3a1f76){_0x1c83f1['push'](_0x1c83f1['shift']());}};_0x8797f8(++_0x48fccb);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 d7acf9c..8b497f4 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 _0xc763=['model','join','update','digest','hex','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','createHash','md5','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','map'];(function(_0x52c1e0,_0x1d7896){var _0x39acfc=function(_0x4529fb){while(--_0x4529fb){_0x52c1e0['push'](_0x52c1e0['shift']());}};_0x39acfc(++_0x1d7896);}(_0xc763,0x107));var _0x3c76=function(_0x3ab0ea,_0x56dfec){_0x3ab0ea=_0x3ab0ea-0x0;var _0x554187=_0xc763[_0x3ab0ea];return _0x554187;};'use strict';var _=require(_0x3c76('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x3c76('0x1'));var exec=require(_0x3c76('0x2'))[_0x3c76('0x3')];var config=require(_0x3c76('0x4'));function getInterfaces(){var _0x39caf3=[];var _0x1fc0c3=os['networkInterfaces']();var _0x814a95=_[_0x3c76('0x5')](_['keys'](_0x1fc0c3));for(var _0x4f0f10=0x0;_0x4f0f10<_0x814a95['length'];_0x4f0f10++){var _0xae78c7=_0x1fc0c3[_0x814a95[_0x4f0f10]][_0x3c76('0x6')](function(_0x40974f){return _0x40974f[_0x3c76('0x7')]==='IPv4'&&_0x40974f[_0x3c76('0x8')]===![];});_0x39caf3=_0x39caf3[_0x3c76('0x9')](_0xae78c7);}return _0x39caf3;}function getFirstInterface(){var _0xc45dbc=_[_0x3c76('0xa')](getInterfaces());return{'macAddress':_0xc45dbc&&_0xc45dbc[_0x3c76('0xb')]?_0xc45dbc[_0x3c76('0xb')]:_0x3c76('0xc'),'ipAddress':_0xc45dbc&&_0xc45dbc[_0x3c76('0xd')]?_0xc45dbc[_0x3c76('0xd')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x132ca4=_[_0x3c76('0x5')](os[_0x3c76('0xe')]()[_0x3c76('0xf')](function(_0x21a763){return _0x21a763[_0x3c76('0x10')];}))[_0x3c76('0x11')](':');return crypto['createHash']('md5')[_0x3c76('0x12')](_0x132ca4)[_0x3c76('0x13')](_0x3c76('0x14'));}exports['getUuid']=function(){var _0x40cd21=os['platform']();var _0x33da9d=/[0-9a-f-]{36}/;if(config[_0x3c76('0x15')]&&_0x33da9d[_0x3c76('0x16')](config['licenseToken'])){return config['licenseToken'];}else if(_0x40cd21===_0x3c76('0x17')){return exec(_0x3c76('0x18'),{'encoding':'utf8'})[_0x3c76('0x19')]('\x0d\x0a','');}else{var _0x295475=getFirstInterface();var _0x14c3cf=getCPUhash();var _0x53d019=_0x14c3cf+'|'+os[_0x3c76('0x1a')]()+'|'+_0x295475['macAddress']+'|'+_0x295475[_0x3c76('0x1b')];var _0xba90=crypto[_0x3c76('0x1c')](_0x3c76('0x1d'))[_0x3c76('0x12')](_0x53d019)[_0x3c76('0x13')](_0x3c76('0x14'));return _0xba90[_0x3c76('0x1e')](0x0,0x8)+'-'+_0xba90[_0x3c76('0x1e')](0x8,0xc)+'-'+_0xba90[_0x3c76('0x1e')](0xc,0x10)+'-'+_0xba90['substring'](0x10,0x14)+'-'+_0xba90['substring'](0x14);}}; \ No newline at end of file +var _0x8aad=['../environment','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','getUuid','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','update','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process'];(function(_0x3d7e16,_0x41cda0){var _0x1d7fb2=function(_0x4ab0e1){while(--_0x4ab0e1){_0x3d7e16['push'](_0x3d7e16['shift']());}};_0x1d7fb2(++_0x41cda0);}(_0x8aad,0xb0));var _0xd8aa=function(_0x1be098,_0x3e6dfe){_0x1be098=_0x1be098-0x0;var _0x5ebbe5=_0x8aad[_0x1be098];return _0x5ebbe5;};'use strict';var _=require(_0xd8aa('0x0'));var os=require('os');var crypto=require(_0xd8aa('0x1'));var machine=require(_0xd8aa('0x2'));var exec=require(_0xd8aa('0x3'))['execSync'];var config=require(_0xd8aa('0x4'));function getInterfaces(){var _0x1c5088=[];var _0x439138=os[_0xd8aa('0x5')]();var _0x521789=_[_0xd8aa('0x6')](_['keys'](_0x439138));for(var _0x5ac0f3=0x0;_0x5ac0f3<_0x521789[_0xd8aa('0x7')];_0x5ac0f3++){var _0x2f6211=_0x439138[_0x521789[_0x5ac0f3]][_0xd8aa('0x8')](function(_0x50511f){return _0x50511f[_0xd8aa('0x9')]===_0xd8aa('0xa')&&_0x50511f[_0xd8aa('0xb')]===![];});_0x1c5088=_0x1c5088[_0xd8aa('0xc')](_0x2f6211);}return _0x1c5088;}function getFirstInterface(){var _0x414ba4=_['head'](getInterfaces());return{'macAddress':_0x414ba4&&_0x414ba4[_0xd8aa('0xd')]?_0x414ba4[_0xd8aa('0xd')]:_0xd8aa('0xe'),'ipAddress':_0x414ba4&&_0x414ba4[_0xd8aa('0xf')]?_0x414ba4[_0xd8aa('0xf')]:_0xd8aa('0x10')};}exports[_0xd8aa('0x11')]=getFirstInterface;function getCPUhash(){var _0x574692=_[_0xd8aa('0x6')](os[_0xd8aa('0x12')]()[_0xd8aa('0x13')](function(_0x350b58){return _0x350b58[_0xd8aa('0x14')];}))[_0xd8aa('0x15')](':');return crypto[_0xd8aa('0x16')](_0xd8aa('0x17'))['update'](_0x574692)['digest']('hex');}exports[_0xd8aa('0x18')]=function(){var _0x34cf3e=os[_0xd8aa('0x19')]();var _0x2f81b4=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x2f81b4[_0xd8aa('0x1a')](config[_0xd8aa('0x1b')])){return config[_0xd8aa('0x1b')];}else if(_0x34cf3e==='win32'){return exec(_0xd8aa('0x1c'),{'encoding':_0xd8aa('0x1d')})['replace']('\x0d\x0a','');}else{var _0xd9e94b=getFirstInterface();var _0x305b69=getCPUhash();var _0x1386c1=_0x305b69+'|'+os[_0xd8aa('0x1e')]()+'|'+_0xd9e94b[_0xd8aa('0x1f')]+'|'+_0xd9e94b[_0xd8aa('0x20')];var _0x140251=crypto[_0xd8aa('0x16')]('md5')[_0xd8aa('0x21')](_0x1386c1)[_0xd8aa('0x22')]('hex');return _0x140251[_0xd8aa('0x23')](0x0,0x8)+'-'+_0x140251['substring'](0x8,0xc)+'-'+_0x140251['substring'](0xc,0x10)+'-'+_0x140251['substring'](0x10,0x14)+'-'+_0x140251[_0xd8aa('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ba62dd4..81f4e03 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 _0x712e=['DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','bluebird','pkginfo','../../components/encryptor','./hardware','license','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','get','data1','active','data2','info','update','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','encryptString','diff','decryptString','days'];(function(_0x4855b9,_0x3e5fc4){var _0x2ee04a=function(_0xd81ff5){while(--_0xd81ff5){_0x4855b9['push'](_0x4855b9['shift']());}};_0x2ee04a(++_0x3e5fc4);}(_0x712e,0x184));var _0xe712=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x712e[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xe712('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xe712('0x1'));var pkginfo=require(_0xe712('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xe712('0x3'));var hardware=require(_0xe712('0x4'));var logger=require('../logger')(_0xe712('0x5'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x453dba){return new BPromise(function(_0x3e9b56,_0x2a3f8c){var _0x3dc282=util[_0xe712('0x6')](_0xe712('0x7'),HOST,_0x453dba,module[_0xe712('0x8')][_0xe712('0x9')]);if(oldToken){_0x3dc282=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x453dba,module['exports']['version'],oldToken);}var _0x4e4135={'uri':_0x3dc282,'method':_0xe712('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x4e4135)[_0xe712('0xb')](function(_0x12ae7f){_0x3e9b56(_0x12ae7f);})[_0xe712('0xc')](function(_0x2d2883){_0x2a3f8c(_0x2d2883);});});}function manageLicense(_0x271adf,_0x2e8c13){var _0x3b45e7=_0x2e8c13[_0xe712('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x3b45e7[_0xe712('0xe')]!==_0x271adf&&!_0x3b45e7['data2']){oldToken=_0x3b45e7['data1'];}httpRequest(_0x271adf)[_0xe712('0xb')](function(_0x167824){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x167824[_0xe712('0xf')]){isOldTokenSent=![];if(!_0x3b45e7[_0xe712('0x5')]&&_0x3b45e7[_0xe712('0x5')]!=_0x167824[_0xe712('0x5')]||_0x3b45e7[_0xe712('0x5')]&&_0x3b45e7[_0xe712('0x10')]){logger[_0xe712('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3b45e7['license']&&!_0x3b45e7[_0xe712('0x10')]&&_0x3b45e7[_0xe712('0x5')]!=_0x167824[_0xe712('0x5')]){logger[_0xe712('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3b45e7['license']&&!_0x3b45e7['data2']&&_0x3b45e7[_0xe712('0x5')]==_0x167824[_0xe712('0x5')]){return _0x2e8c13;}return _0x2e8c13[_0xe712('0x12')]({'data1':_0x271adf,'data2':null,'license':_0x167824[_0xe712('0x5')]});}else{if(_0x167824[_0xe712('0x5')]||_0x3b45e7['license']){if(!_0x3b45e7['data2']){if(_0x3b45e7['data1']==_0x271adf){GRAY_PERIOD_REASON=_0xe712('0x13');logger[_0xe712('0x11')](_0xe712('0x14'));}else{GRAY_PERIOD_REASON=_0xe712('0x15');logger['info'](_0xe712('0x16'),_0x3b45e7[_0xe712('0xe')],_0x271adf);}logger['info'](_0xe712('0x17'),GRAY_PERIOD_REASON[_0xe712('0x18')](),moment()[_0xe712('0x6')](_0xe712('0x19')));return _0x2e8c13[_0xe712('0x12')]({'data2':encryptor[_0xe712('0x1a')](moment()[_0xe712('0x6')](_0xe712('0x19')))});}else{if(moment()[_0xe712('0x1b')](encryptor[_0xe712('0x1c')](_0x3b45e7['data2']),_0xe712('0x1d'))>DAYS){logger['info'](_0xe712('0x1e'),moment()['format'](_0xe712('0x19')));isOldTokenSent=![];return _0x2e8c13[_0xe712('0x12')]({'data1':_0x271adf,'data2':null,'license':null});}}}else{if(_0x3b45e7[_0xe712('0xe')]!=_0x271adf){logger[_0xe712('0x11')](_0xe712('0x16'),_0x3b45e7[_0xe712('0xe')],_0x271adf);return _0x2e8c13[_0xe712('0x12')]({'data1':_0x271adf,'data2':null,'license':null});}}}return _0x2e8c13;})['then'](function(_0x2e6a65){_0x2e8c13=_0x2e6a65;})[_0xe712('0xc')](function(_0x2e588e){logger['error'](_0x2e588e[_0xe712('0x1f')]);})[_0xe712('0x20')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2e8c13);},TIME);});}function defaultLicense(){var _0xdbda6d=hardware[_0xe712('0x21')]();if(_0xdbda6d){return db[_0xe712('0x22')][_0xe712('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0xdbda6d}})['spread'](function(_0x509066,_0x52ab83){logger[_0xe712('0x11')](_0xe712('0x24'),_0xdbda6d);manageLicense(_0xdbda6d,_0x509066);})[_0xe712('0xc')](function(_0x1e2dd7){logger[_0xe712('0x25')](_0x1e2dd7['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x5aef=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','update','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','default','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x5b24a1,_0x5c816b){var _0xe5bd71=function(_0x4e3632){while(--_0x4e3632){_0x5b24a1['push'](_0x5b24a1['shift']());}};_0xe5bd71(++_0x5c816b);}(_0x5aef,0x131));var _0xf5ae=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x5aef[_0xac0de1];return _0x1c1995;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0xf5ae('0x0'));var BPromise=require(_0xf5ae('0x1'));var pkginfo=require(_0xf5ae('0x2'))(module,_0xf5ae('0x3'));var db=require(_0xf5ae('0x4'))['db'];var encryptor=require(_0xf5ae('0x5'));var hardware=require('./hardware');var logger=require(_0xf5ae('0x6'))(_0xf5ae('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2694ff){return new BPromise(function(_0x24c7e8,_0x303018){var _0x3d4f27=util[_0xf5ae('0x8')](_0xf5ae('0x9'),HOST,_0x2694ff,module[_0xf5ae('0xa')][_0xf5ae('0x3')]);if(oldToken){_0x3d4f27=util[_0xf5ae('0x8')](_0xf5ae('0xb'),HOST,_0x2694ff,module['exports']['version'],oldToken);}var _0x16b980={'uri':_0x3d4f27,'method':_0xf5ae('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x16b980)[_0xf5ae('0xd')](function(_0x2267a9){_0x24c7e8(_0x2267a9);})['catch'](function(_0x119a8e){_0x303018(_0x119a8e);});});}function manageLicense(_0x1e1972,_0x15507f){var _0x272731=_0x15507f[_0xf5ae('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x272731[_0xf5ae('0xf')]!==_0x1e1972&&!_0x272731['data2']){oldToken=_0x272731[_0xf5ae('0xf')];}httpRequest(_0x1e1972)[_0xf5ae('0xd')](function(_0x26a4ef){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x26a4ef[_0xf5ae('0x10')]){isOldTokenSent=![];if(!_0x272731[_0xf5ae('0x7')]&&_0x272731['license']!=_0x26a4ef[_0xf5ae('0x7')]||_0x272731[_0xf5ae('0x7')]&&_0x272731[_0xf5ae('0x11')]){logger[_0xf5ae('0x12')](_0xf5ae('0x13'));}if(_0x272731['license']&&!_0x272731[_0xf5ae('0x11')]&&_0x272731[_0xf5ae('0x7')]!=_0x26a4ef[_0xf5ae('0x7')]){logger[_0xf5ae('0x12')](_0xf5ae('0x14'));}if(_0x272731[_0xf5ae('0x7')]&&!_0x272731[_0xf5ae('0x11')]&&_0x272731['license']==_0x26a4ef[_0xf5ae('0x7')]){return _0x15507f;}return _0x15507f['update']({'data1':_0x1e1972,'data2':null,'license':_0x26a4ef['license']});}else{if(_0x26a4ef[_0xf5ae('0x7')]||_0x272731[_0xf5ae('0x7')]){if(!_0x272731[_0xf5ae('0x11')]){if(_0x272731[_0xf5ae('0xf')]==_0x1e1972){GRAY_PERIOD_REASON=_0xf5ae('0x15');logger['info'](_0xf5ae('0x16'));}else{GRAY_PERIOD_REASON=_0xf5ae('0x17');logger[_0xf5ae('0x12')](_0xf5ae('0x18'),_0x272731[_0xf5ae('0xf')],_0x1e1972);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xf5ae('0x19')](),moment()[_0xf5ae('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x15507f[_0xf5ae('0x1a')]({'data2':encryptor['encryptString'](moment()[_0xf5ae('0x8')](_0xf5ae('0x1b')))});}else{if(moment()[_0xf5ae('0x1c')](encryptor[_0xf5ae('0x1d')](_0x272731[_0xf5ae('0x11')]),_0xf5ae('0x1e'))>DAYS){logger[_0xf5ae('0x12')](_0xf5ae('0x1f'),moment()[_0xf5ae('0x8')](_0xf5ae('0x1b')));isOldTokenSent=![];return _0x15507f[_0xf5ae('0x1a')]({'data1':_0x1e1972,'data2':null,'license':null});}}}else{if(_0x272731[_0xf5ae('0xf')]!=_0x1e1972){logger[_0xf5ae('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x272731[_0xf5ae('0xf')],_0x1e1972);return _0x15507f[_0xf5ae('0x1a')]({'data1':_0x1e1972,'data2':null,'license':null});}}}return _0x15507f;})['then'](function(_0x1d49ae){_0x15507f=_0x1d49ae;})['catch'](function(_0x49ffb3){logger[_0xf5ae('0x20')](_0x49ffb3[_0xf5ae('0x21')]);})[_0xf5ae('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xf5ae('0x23')](),_0x15507f);},TIME);});}function defaultLicense(){var _0x307339=hardware[_0xf5ae('0x23')]();if(_0x307339){return db[_0xf5ae('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x307339}})[_0xf5ae('0x25')](function(_0x55e1e6,_0x2908b5){logger[_0xf5ae('0x12')](_0xf5ae('0x26'),_0x307339);manageLicense(_0x307339,_0x55e1e6);})[_0xf5ae('0x27')](function(_0x5dcad0){logger[_0xf5ae('0x20')](_0x5dcad0[_0xf5ae('0x21')]);});}}exports[_0xf5ae('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 99bea71..be0f7e2 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 _0xf3bc=['telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','catch','uuid','license','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','admin','user','telephone','users'];(function(_0xbf61e,_0x75f898){var _0x380a49=function(_0x2f619e){while(--_0x2f619e){_0xbf61e['push'](_0xbf61e['shift']());}};_0x380a49(++_0x75f898);}(_0xf3bc,0x108));var _0xcf3b=function(_0x4d7cfa,_0x5673a0){_0x4d7cfa=_0x4d7cfa-0x0;var _0x8c7be9=_0xf3bc[_0x4d7cfa];return _0x8c7be9;};'use strict';var util=require(_0xcf3b('0x0'));var _=require(_0xcf3b('0x1'));var moment=require(_0xcf3b('0x2'));var BPromise=require(_0xcf3b('0x3'));var hardware=require(_0xcf3b('0x4'));var encryptor=require(_0xcf3b('0x5'));var db=require(_0xcf3b('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcf3b('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcf3b('0x8'),'machineUuid':hardware[_0xcf3b('0x9')](),'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':_0xcf3b('0xa'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1b0a0b){return new BPromise(function(_0x53594f,_0xa67296){return db[_0xcf3b('0xb')]['find'](_['defaults'](_0x1b0a0b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x42eedd){return checkLicense(_0x42eedd,null);})[_0xcf3b('0xc')](function(_0x1b6fcc){_0x53594f(_0x1b6fcc);return;})[_0xcf3b('0xd')](function(_0x1ed7e8){_0xa67296(_0x1ed7e8);});});}function checkLicense(_0x2ccb40,_0x5020b1){if(!_0x2ccb40){demoLicense[_0xcf3b('0xe')]=_0x2ccb40['data1'];return demoLicense;}try{var _0x4d678b=_0x5020b1||_0x2ccb40[_0xcf3b('0xf')];if(_['isEmpty'](_0x4d678b)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x47aa0f=_0x2ccb40['data1'];var _0x3c19ba=_0x2ccb40['data2'];var _0x4dcd87=_0x47aa0f['split']('-')[0x4];var _0x37d173=_0x47aa0f[_0xcf3b('0x10')]('-')[0x0];var _0x1b361=encryptor[_0xcf3b('0x11')](_0x4d678b,util[_0xcf3b('0x12')](_0xcf3b('0x13'),_0x4dcd87,_0x47aa0f,_0x37d173));var _0x1a51c6=JSON[_0xcf3b('0x14')](_0x1b361);_0x1a51c6[_0xcf3b('0x15')]=![];_0x1a51c6[_0xcf3b('0xe')]=_0x47aa0f;_0x1a51c6[_0xcf3b('0x16')]=hardware[_0xcf3b('0x9')]();if(_0x3c19ba){var _0x2468f0=encryptor[_0xcf3b('0x11')](_0x3c19ba);_0x1a51c6[_0xcf3b('0x17')]=_0x2468f0;_0x1a51c6['deadline']=moment(_0x2468f0)['add'](0x7,_0xcf3b('0x18'))[_0xcf3b('0x12')]();_0x1a51c6['grayReason']=_0x1a51c6['uuid']!=_0x1a51c6[_0xcf3b('0x16')]?_0xcf3b('0x19'):_0xcf3b('0x1a');}return _0x1a51c6;}catch(_0xb85666){breakingLicense['uuid']=_0x2ccb40['data1'];breakingLicense[_0xcf3b('0x1b')]=_0xb85666['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x19d440,_0x15557f){getLicense()[_0xcf3b('0xc')](function(_0x627f5d){return db[_0xcf3b('0x1c')][_0xcf3b('0x1d')]({'attributes':[_0xcf3b('0x1e'),[db[_0xcf3b('0x1f')]['fn'](_0xcf3b('0x20'),db[_0xcf3b('0x1f')]['col'](_0xcf3b('0x1e'))),'count']],'group':_0xcf3b('0x1e'),'where':{'role':{'$or':[_0xcf3b('0x21'),_0xcf3b('0x22'),_0xcf3b('0x23')]}},'raw':!![]})['then'](function(_0x88b7bb){var _0x3e7809={'user':_0x627f5d[_0xcf3b('0x24')]||0x0,'telephone':_0x627f5d[_0xcf3b('0x25')]||0x0};_0x88b7bb[_0xcf3b('0x26')](function(_0x16d2b0){var _0x1b0697=_0x16d2b0[_0xcf3b('0x1e')]===_0xcf3b('0x21')?'user':_0x16d2b0[_0xcf3b('0x1e')];_0x3e7809[_0x1b0697]-=_0x16d2b0['count'];if(_0x3e7809[_0x1b0697]<0x0)_0x3e7809[_0x1b0697]=0x0;});_0x19d440(_0x3e7809);return;});})['catch'](function(_0x9ba366){_0x15557f(_0x9ba366);});});}function checkUserLimits(_0xcc8c3){return new BPromise(function(_0x20f8ed,_0x20c7ed){getLimits()['then'](function(_0x43c218){var _0x1baf4f=_['pick'](_[_0xcf3b('0x27')](_0xcc8c3,'role'),['admin',_0xcf3b('0x22'),_0xcf3b('0x23')]);var _0x10135b=(_0x1baf4f['admin']||0x0)+(_0x1baf4f[_0xcf3b('0x22')]||0x0);var _0x113149=_0x1baf4f['telephone']||0x0;if(_0x10135b>_0x43c218[_0xcf3b('0x22')])return _0x20c7ed(_0xcf3b('0x28'));if(_0x113149>_0x43c218[_0xcf3b('0x23')])return _0x20c7ed(_0xcf3b('0x29'));return _0x20f8ed();})['catch'](function(_0xa66011){_0x20c7ed(_0xa66011);});});}module[_0xcf3b('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3a7e=['grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','telephone','telephones','pick','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','defaults','then','catch','data1','license','License\x20key\x20value\x20not\x20found','split','decryptString','format','demo','uuid','machineUuid','gray','deadline','add','days'];(function(_0x2628a2,_0xcae6f2){var _0x17c4df=function(_0xed713b){while(--_0xed713b){_0x2628a2['push'](_0x2628a2['shift']());}};_0x17c4df(++_0xcae6f2);}(_0x3a7e,0x172));var _0xe3a7=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0x3a7e[_0x41cfd4];return _0x190f48;};'use strict';var util=require(_0xe3a7('0x0'));var _=require(_0xe3a7('0x1'));var moment=require(_0xe3a7('0x2'));var BPromise=require('bluebird');var hardware=require(_0xe3a7('0x3'));var encryptor=require(_0xe3a7('0x4'));var db=require(_0xe3a7('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe3a7('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xe3a7('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe3a7('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe3a7('0x8'),'machineUuid':hardware[_0xe3a7('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4da7fe){return new BPromise(function(_0x21bae2,_0x1f8f05){return db['License'][_0xe3a7('0x9')](_[_0xe3a7('0xa')](_0x4da7fe,{'raw':!![],'where':{'id':0x1}}))[_0xe3a7('0xb')](function(_0x1af0f){return checkLicense(_0x1af0f,null);})[_0xe3a7('0xb')](function(_0x29866a){_0x21bae2(_0x29866a);return;})[_0xe3a7('0xc')](function(_0x1df8e1){_0x1f8f05(_0x1df8e1);});});}function checkLicense(_0x1fbc3f,_0x2314b0){if(!_0x1fbc3f){demoLicense['uuid']=_0x1fbc3f[_0xe3a7('0xd')];return demoLicense;}try{var _0x1e7b44=_0x2314b0||_0x1fbc3f[_0xe3a7('0xe')];if(_['isEmpty'](_0x1e7b44)){throw new Error(_0xe3a7('0xf'));}var _0x31bb78=_0x1fbc3f[_0xe3a7('0xd')];var _0x4cf533=_0x1fbc3f['data2'];var _0x217bb0=_0x31bb78[_0xe3a7('0x10')]('-')[0x4];var _0x19bff4=_0x31bb78[_0xe3a7('0x10')]('-')[0x0];var _0xfae66a=encryptor[_0xe3a7('0x11')](_0x1e7b44,util[_0xe3a7('0x12')]('%s:%s:%s',_0x217bb0,_0x31bb78,_0x19bff4));var _0x23ac3d=JSON['parse'](_0xfae66a);_0x23ac3d[_0xe3a7('0x13')]=![];_0x23ac3d[_0xe3a7('0x14')]=_0x31bb78;_0x23ac3d[_0xe3a7('0x15')]=hardware['getUuid']();if(_0x4cf533){var _0x29008a=encryptor[_0xe3a7('0x11')](_0x4cf533);_0x23ac3d[_0xe3a7('0x16')]=_0x29008a;_0x23ac3d[_0xe3a7('0x17')]=moment(_0x29008a)[_0xe3a7('0x18')](0x7,_0xe3a7('0x19'))[_0xe3a7('0x12')]();_0x23ac3d[_0xe3a7('0x1a')]=_0x23ac3d['uuid']!=_0x23ac3d['machineUuid']?_0xe3a7('0x1b'):_0xe3a7('0x1c');}return _0x23ac3d;}catch(_0x1f58b9){breakingLicense[_0xe3a7('0x14')]=_0x1fbc3f[_0xe3a7('0xd')];breakingLicense[_0xe3a7('0x1d')]=_0x1f58b9['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xbd75d,_0x5bfd1f){getLicense()[_0xe3a7('0xb')](function(_0x21048e){return db[_0xe3a7('0x1e')][_0xe3a7('0x1f')]({'attributes':[_0xe3a7('0x20'),[db[_0xe3a7('0x21')]['fn'](_0xe3a7('0x22'),db[_0xe3a7('0x21')]['col'](_0xe3a7('0x20'))),_0xe3a7('0x23')]],'group':'role','where':{'role':{'$or':[_0xe3a7('0x24'),'user',_0xe3a7('0x25')]}},'raw':!![]})[_0xe3a7('0xb')](function(_0x105581){var _0xcb9310={'user':_0x21048e['users']||0x0,'telephone':_0x21048e[_0xe3a7('0x26')]||0x0};_0x105581['forEach'](function(_0x2427ed){var _0x504a8d=_0x2427ed[_0xe3a7('0x20')]===_0xe3a7('0x24')?'user':_0x2427ed[_0xe3a7('0x20')];_0xcb9310[_0x504a8d]-=_0x2427ed[_0xe3a7('0x23')];if(_0xcb9310[_0x504a8d]<0x0)_0xcb9310[_0x504a8d]=0x0;});_0xbd75d(_0xcb9310);return;});})[_0xe3a7('0xc')](function(_0x32e5eb){_0x5bfd1f(_0x32e5eb);});});}function checkUserLimits(_0x368903){return new BPromise(function(_0x5eae67,_0x57fe79){getLimits()[_0xe3a7('0xb')](function(_0x385d34){var _0x48b676=_[_0xe3a7('0x27')](_['countBy'](_0x368903,'role'),[_0xe3a7('0x24'),_0xe3a7('0x28'),_0xe3a7('0x25')]);var _0x4cdde1=(_0x48b676[_0xe3a7('0x24')]||0x0)+(_0x48b676[_0xe3a7('0x28')]||0x0);var _0x55539e=_0x48b676[_0xe3a7('0x25')]||0x0;if(_0x4cdde1>_0x385d34['user'])return _0x57fe79(_0xe3a7('0x29'));if(_0x55539e>_0x385d34[_0xe3a7('0x25')])return _0x57fe79(_0xe3a7('0x2a'));return _0x5eae67();})[_0xe3a7('0xc')](function(_0x546a2d){_0x57fe79(_0x546a2d);});});}module[_0xe3a7('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 69ec251..cce3c55 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 _0x1893=['myappanuglar-secret','app-id','secret'];(function(_0x41b3d6,_0x21daa8){var _0x3e60ca=function(_0xee2395){while(--_0xee2395){_0x41b3d6['push'](_0x41b3d6['shift']());}};_0x3e60ca(++_0x21daa8);}(_0x1893,0xa2));var _0x3189=function(_0x743701,_0x3e67bb){_0x743701=_0x743701-0x0;var _0x5a141d=_0x1893[_0x743701];return _0x5a141d;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3189('0x0'),'GOOGLE_ID':_0x3189('0x1'),'GOOGLE_SECRET':_0x3189('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x2272=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';module[_0x2227('0x0')]={'DOMAIN':_0x2227('0x1'),'SESSION_SECRET':_0x2227('0x2'),'GOOGLE_ID':_0x2227('0x3'),'GOOGLE_SECRET':_0x2227('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index fa0cd7b..fb5c301 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b16=['exports'];(function(_0x2df643,_0x364578){var _0x3b3414=function(_0x5cf1d3){while(--_0x5cf1d3){_0x2df643['push'](_0x2df643['shift']());}};_0x3b3414(++_0x364578);}(_0x1b16,0x18f));var _0x61b1=function(_0xa2fd67,_0x219feb){_0xa2fd67=_0xa2fd67-0x0;var _0x7e1739=_0x1b16[_0xa2fd67];return _0x7e1739;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0x61b1('0x0')]=fileLogger; \ No newline at end of file +var _0xd602=['../utils/loggers','exports'];(function(_0x3c1be2,_0x3529e2){var _0x423850=function(_0x5ecfcd){while(--_0x5ecfcd){_0x3c1be2['push'](_0x3c1be2['shift']());}};_0x423850(++_0x3529e2);}(_0xd602,0x194));var _0x2d60=function(_0x41af74,_0x1b659a){_0x41af74=_0x41af74-0x0;var _0x18a777=_0xd602[_0x41af74];return _0x18a777;};'use strict';var fileLogger=require(_0x2d60('0x0'))['fileLogger'];module[_0x2d60('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 875ea86..c2c11a3 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 _0xc838=['email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','express','join','ami','../../services/ami/index.js','../../services/agi/index.js'];(function(_0x415996,_0x96fe6f){var _0x1a245f=function(_0x5f3602){while(--_0x5f3602){_0x415996['push'](_0x415996['shift']());}};_0x1a245f(++_0x96fe6f);}(_0xc838,0x8a));var _0x8c83=function(_0x533966,_0x193c81){_0x533966=_0x533966-0x0;var _0x4abd82=_0xc838[_0x533966];return _0x4abd82;};'use strict';var path=require(_0x8c83('0x0'));var os=require('os');var config={'apps':[{'name':_0x8c83('0x1'),'script':path[_0x8c83('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x8c83('0x3'),'script':path[_0x8c83('0x2')](__dirname,_0x8c83('0x4'))},{'name':'agi','script':path['join'](__dirname,_0x8c83('0x5'))},{'name':_0x8c83('0x6'),'script':path[_0x8c83('0x2')](__dirname,_0x8c83('0x7'))},{'name':_0x8c83('0x8'),'script':path[_0x8c83('0x2')](__dirname,_0x8c83('0x9'))},{'name':_0x8c83('0xa'),'script':path[_0x8c83('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x8c83('0xb')]=config; \ No newline at end of file +var _0x0ade=['ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','exports','path','express','join'];(function(_0x2e2b4d,_0x3b9647){var _0x5ba6f6=function(_0x3f090d){while(--_0x3f090d){_0x2e2b4d['push'](_0x2e2b4d['shift']());}};_0x5ba6f6(++_0x3b9647);}(_0x0ade,0x147));var _0xe0ad=function(_0x365de2,_0x3af517){_0x365de2=_0x365de2-0x0;var _0x49c144=_0x0ade[_0x365de2];return _0x49c144;};'use strict';var path=require(_0xe0ad('0x0'));var os=require('os');var config={'apps':[{'name':_0xe0ad('0x1'),'script':path[_0xe0ad('0x2')](__dirname,'../../services/express/index.js')},{'name':_0xe0ad('0x3'),'script':path[_0xe0ad('0x2')](__dirname,_0xe0ad('0x4'))},{'name':'agi','script':path[_0xe0ad('0x2')](__dirname,_0xe0ad('0x5'))},{'name':_0xe0ad('0x6'),'script':path['join'](__dirname,_0xe0ad('0x7'))},{'name':_0xe0ad('0x8'),'script':path[_0xe0ad('0x2')](__dirname,_0xe0ad('0x9'))},{'name':'xdr','script':path[_0xe0ad('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xe0ad('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6359258..ebe2976 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 _0x54ed=['delete','dump','saved','pm2','bluebird','./config','connected','then','disconnect','stop','restart','describe'];(function(_0xdcc822,_0x13c856){var _0x47dceb=function(_0x23dfc7){while(--_0x23dfc7){_0xdcc822['push'](_0xdcc822['shift']());}};_0x47dceb(++_0x13c856);}(_0x54ed,0x1bf));var _0xd54e=function(_0x595775,_0x1d5665){_0x595775=_0x595775-0x0;var _0x5ad30f=_0x54ed[_0x595775];return _0x5ad30f;};'use strict';var pm2=require(_0xd54e('0x0'));var BPromise=require(_0xd54e('0x1'));var config=require(_0xd54e('0x2'));function connect(){return new BPromise(function(_0x59e522,_0x55e5ce){return pm2['connect'](function(_0xde89f1){if(_0xde89f1){return _0x55e5ce(_0xde89f1);}return _0x59e522(_0xd54e('0x3'));});});};exports['start']=function(_0x5a47ac){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0xeb1113,_0xceffe4){return pm2['start'](_0x5a47ac,function(_0x3647d0,_0x349a67){if(_0x3647d0){return _0xceffe4(_0x3647d0);}pm2[_0xd54e('0x5')]();return _0xeb1113(_0x349a67);});});});};exports[_0xd54e('0x6')]=function(_0x2d4b38){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x2f9460,_0x1c1a54){return pm2[_0xd54e('0x6')](_0x2d4b38,function(_0x3646b7,_0x4e9744){if(_0x3646b7){return _0x1c1a54(_0x3646b7);}pm2[_0xd54e('0x5')]();return _0x2f9460(_0x4e9744);});});});};exports[_0xd54e('0x7')]=function(_0x3bd8bf){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x5d1054,_0x2b0dda){return pm2[_0xd54e('0x7')](_0x3bd8bf,function(_0x27ec05,_0x33c0f0){if(_0x27ec05){return _0x2b0dda(_0x27ec05);}pm2[_0xd54e('0x5')]();return _0x5d1054(_0x33c0f0);});});});};exports['list']=function(){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x161d30,_0x24c49b){return pm2['list'](function(_0x36c6e2,_0x5a2d67){if(_0x36c6e2){return _0x24c49b(_0x36c6e2);}pm2[_0xd54e('0x5')]();return _0x161d30(_0x5a2d67);});});});};exports[_0xd54e('0x8')]=function(_0x251e9f){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x418e94,_0xc51d5c){return pm2[_0xd54e('0x8')](_0x251e9f,function(_0x5ea46c,_0x12ff6f){if(_0x5ea46c){return _0xc51d5c(_0x5ea46c);}pm2[_0xd54e('0x5')]();return _0x418e94(_0x12ff6f);});});});};exports[_0xd54e('0x9')]=function(_0x14647c){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x285aaf,_0x4c815d){return pm2[_0xd54e('0x9')](_0x14647c,function(_0x2844f8,_0xbe5bae){if(_0x2844f8){return _0x4c815d(_0x2844f8);}pm2['disconnect']();return _0x285aaf(_0xbe5bae);});});});};exports[_0xd54e('0xa')]=function(){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x578230,_0x1f3ca4){return pm2[_0xd54e('0xa')](function(_0x177b1a){if(_0x177b1a){return _0x1f3ca4(_0x177b1a);}return _0x578230(_0xd54e('0xb'));});});});}; \ No newline at end of file +var _0x6bca=['restart','list','describe','delete','dump','pm2','bluebird','./config','connect','start','then','disconnect','stop'];(function(_0x86440f,_0x10eabb){var _0x5f0779=function(_0x503c63){while(--_0x503c63){_0x86440f['push'](_0x86440f['shift']());}};_0x5f0779(++_0x10eabb);}(_0x6bca,0x1e6));var _0xa6bc=function(_0x2042ae,_0x3be4ba){_0x2042ae=_0x2042ae-0x0;var _0x59cc86=_0x6bca[_0x2042ae];return _0x59cc86;};'use strict';var pm2=require(_0xa6bc('0x0'));var BPromise=require(_0xa6bc('0x1'));var config=require(_0xa6bc('0x2'));function connect(){return new BPromise(function(_0x258523,_0x533dfd){return pm2[_0xa6bc('0x3')](function(_0x269212){if(_0x269212){return _0x533dfd(_0x269212);}return _0x258523('connected');});});};exports[_0xa6bc('0x4')]=function(_0x376b1a){return connect()[_0xa6bc('0x5')](function(){return new BPromise(function(_0x3e15a1,_0x11cca1){return pm2[_0xa6bc('0x4')](_0x376b1a,function(_0x13c280,_0x3160fd){if(_0x13c280){return _0x11cca1(_0x13c280);}pm2[_0xa6bc('0x6')]();return _0x3e15a1(_0x3160fd);});});});};exports[_0xa6bc('0x7')]=function(_0x7f07e0){return connect()[_0xa6bc('0x5')](function(){return new BPromise(function(_0x40a432,_0x3f80dc){return pm2[_0xa6bc('0x7')](_0x7f07e0,function(_0x2a37b4,_0x230803){if(_0x2a37b4){return _0x3f80dc(_0x2a37b4);}pm2[_0xa6bc('0x6')]();return _0x40a432(_0x230803);});});});};exports[_0xa6bc('0x8')]=function(_0x3e7881){return connect()[_0xa6bc('0x5')](function(){return new BPromise(function(_0x379763,_0x44ecdd){return pm2[_0xa6bc('0x8')](_0x3e7881,function(_0x1c0ca1,_0x474a98){if(_0x1c0ca1){return _0x44ecdd(_0x1c0ca1);}pm2[_0xa6bc('0x6')]();return _0x379763(_0x474a98);});});});};exports[_0xa6bc('0x9')]=function(){return connect()[_0xa6bc('0x5')](function(){return new BPromise(function(_0x1764e1,_0x2d6f01){return pm2[_0xa6bc('0x9')](function(_0x1bdd33,_0x3646ea){if(_0x1bdd33){return _0x2d6f01(_0x1bdd33);}pm2['disconnect']();return _0x1764e1(_0x3646ea);});});});};exports[_0xa6bc('0xa')]=function(_0x254d1f){return connect()[_0xa6bc('0x5')](function(){return new BPromise(function(_0x12a0d2,_0x2cc5b3){return pm2['describe'](_0x254d1f,function(_0x5a7870,_0x3e2954){if(_0x5a7870){return _0x2cc5b3(_0x5a7870);}pm2[_0xa6bc('0x6')]();return _0x12a0d2(_0x3e2954);});});});};exports[_0xa6bc('0xb')]=function(_0xf1b329){return connect()[_0xa6bc('0x5')](function(){return new BPromise(function(_0x32d81f,_0x3ccf34){return pm2[_0xa6bc('0xb')](_0xf1b329,function(_0x1ad8f5,_0x5be759){if(_0x1ad8f5){return _0x3ccf34(_0x1ad8f5);}pm2[_0xa6bc('0x6')]();return _0x32d81f(_0x5be759);});});});};exports[_0xa6bc('0xc')]=function(){return connect()[_0xa6bc('0x5')](function(){return new BPromise(function(_0xa69ac0,_0x4a6658){return pm2[_0xa6bc('0xc')](function(_0x44d66a){if(_0x44d66a){return _0x4a6658(_0x44d66a);}return _0xa69ac0('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index f4ddf97..a336c47 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 _0x8b79=['chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','socket.io-emitter','Setting','find'];(function(_0x570c8a,_0x4a11cc){var _0x25dc12=function(_0x4585d9){while(--_0x4585d9){_0x570c8a['push'](_0x570c8a['shift']());}};_0x25dc12(++_0x4a11cc);}(_0x8b79,0x78));var _0x98b7=function(_0x368933,_0x1add51){_0x368933=_0x368933-0x0;var _0x346847=_0x8b79[_0x368933];return _0x346847;};'use strict';var _=require(_0x98b7('0x0'));var moment=require(_0x98b7('0x1'));var Redis=require(_0x98b7('0x2'));var util=require(_0x98b7('0x3'));var config=require(_0x98b7('0x4'));var db=require(_0x98b7('0x5'))['db'];var logger=require(_0x98b7('0x6'))('schedule');config[_0x98b7('0x7')]=_['defaults'](config[_0x98b7('0x7')],{'host':_0x98b7('0x8'),'port':0x18eb});var io=require(_0x98b7('0x9'))(new Redis(config[_0x98b7('0x7')]));function closeInteractions(){var _0x5355cd=0x0;var _0x528dd5=[];return db[_0x98b7('0xa')][_0x98b7('0xb')]({'raw':!![],'attributes':['id',_0x98b7('0xc')],'where':{'id':0x1}})['then'](function(_0xcf2d3f){_0x5355cd=_0xcf2d3f['chatTimeout'];if(_0x5355cd){return db[_0x98b7('0xd')][_0x98b7('0xe')]({'raw':!![],'attributes':['id',_0x98b7('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x98b7('0x10')](_0xcf2d3f[_0x98b7('0xc')],_0x98b7('0x11'))}}});}else{return[];}})[_0x98b7('0x12')](function(_0x2aa561){if(_0x2aa561&&_0x2aa561['length']){_0x528dd5=_[_0x98b7('0x13')](_0x2aa561||[],'id');logger['info'](_0x98b7('0x14'),_0x528dd5[_0x98b7('0x15')]());return db[_0x98b7('0xd')][_0x98b7('0x16')]({'closeReason':_0x98b7('0x17'),'disposition':_0x98b7('0x18'),'closed':!![],'closedAt':moment()['format'](_0x98b7('0x19'))},{'where':{'id':_0x528dd5}});}})[_0x98b7('0x12')](function(){if(_0x528dd5&&_0x528dd5['length']){logger[_0x98b7('0x1a')](_0x98b7('0x1b'),_0x528dd5[_0x98b7('0x15')]());for(var _0x3953d2=0x0;_0x3953d2<_0x528dd5[_0x98b7('0x1c')];_0x3953d2++){io['emit'](_0x98b7('0x1d'),{'id':_0x528dd5[_0x3953d2],'closed':!![]});}}})[_0x98b7('0x1e')](function(_0x407d62){logger[_0x98b7('0x1f')](_0x98b7('0x20'),_0x407d62?util['inspect'](_0x407d62,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7305=['subtract','minutes','then','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','../../config/environment','../logger','redis','defaults','Setting','find','chatTimeout','ChatInteraction','lastMsgAt'];(function(_0x5a8b19,_0x295b75){var _0x3acc13=function(_0x1ade4b){while(--_0x1ade4b){_0x5a8b19['push'](_0x5a8b19['shift']());}};_0x3acc13(++_0x295b75);}(_0x7305,0x66));var _0x5730=function(_0x544e5f,_0x11bfde){_0x544e5f=_0x544e5f-0x0;var _0x5e3fec=_0x7305[_0x544e5f];return _0x5e3fec;};'use strict';var _=require('lodash');var moment=require(_0x5730('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0x5730('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x5730('0x2'))('schedule');config[_0x5730('0x3')]=_[_0x5730('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5730('0x3')]));function closeInteractions(){var _0x2af47d=0x0;var _0x369263=[];return db[_0x5730('0x5')][_0x5730('0x6')]({'raw':!![],'attributes':['id',_0x5730('0x7')],'where':{'id':0x1}})['then'](function(_0x5c80b4){_0x2af47d=_0x5c80b4[_0x5730('0x7')];if(_0x2af47d){return db[_0x5730('0x8')]['findAll']({'raw':!![],'attributes':['id',_0x5730('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5730('0xa')](_0x5c80b4[_0x5730('0x7')],_0x5730('0xb'))}}});}else{return[];}})[_0x5730('0xc')](function(_0x251d8e){if(_0x251d8e&&_0x251d8e['length']){_0x369263=_[_0x5730('0xd')](_0x251d8e||[],'id');logger[_0x5730('0xe')](_0x5730('0xf'),_0x369263['join']());return db[_0x5730('0x8')][_0x5730('0x10')]({'closeReason':_0x5730('0x11'),'disposition':_0x5730('0x12'),'closed':!![],'closedAt':moment()[_0x5730('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x369263}});}})[_0x5730('0xc')](function(){if(_0x369263&&_0x369263['length']){logger[_0x5730('0xe')](_0x5730('0x14'),_0x369263['join']());for(var _0x484f79=0x0;_0x484f79<_0x369263[_0x5730('0x15')];_0x484f79++){io[_0x5730('0x16')](_0x5730('0x17'),{'id':_0x369263[_0x484f79],'closed':!![]});}}})[_0x5730('0x18')](function(_0x574b55){logger[_0x5730('0x19')](_0x5730('0x1a'),_0x574b55?util[_0x5730('0x1b')](_0x574b55,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 3e5fcc7..3635728 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 _0x4d28=['startAllRefreshIntervals','exports'];(function(_0x50bc23,_0x11e425){var _0x2571fd=function(_0x6412e0){while(--_0x6412e0){_0x50bc23['push'](_0x50bc23['shift']());}};_0x2571fd(++_0x11e425);}(_0x4d28,0x116));var _0x84d2=function(_0x4145a8,_0x55e817){_0x4145a8=_0x4145a8-0x0;var _0x155db0=_0x4d28[_0x4145a8];return _0x155db0;};'use strict';function start(){var _0xa68c12=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0xa68c12[_0x84d2('0x0')]();}module[_0x84d2('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x0fbd=['exports'];(function(_0x13163f,_0x1bf609){var _0x909dae=function(_0x203705){while(--_0x203705){_0x13163f['push'](_0x13163f['shift']());}};_0x909dae(++_0x1bf609);}(_0x0fbd,0x1b8));var _0xd0fb=function(_0x2247fb,_0x2690c4){_0x2247fb=_0x2247fb-0x0;var _0x428383=_0x0fbd[_0x2247fb];return _0x428383;};'use strict';function start(){var _0x558b6b=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x558b6b['startAllRefreshIntervals']();}module[_0xd0fb('0x0')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index cd863a7..cb55dbe 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 _0x94bc=['endAt','start','add\x20cron','stop','stop\x20cron','update','update\x20cron','run','util','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','jobs','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt'];(function(_0x51db58,_0x44d00c){var _0x3eeec5=function(_0x362fa6){while(--_0x362fa6){_0x51db58['push'](_0x51db58['shift']());}};_0x3eeec5(++_0x44d00c);}(_0x94bc,0x1bb));var _0xc94b=function(_0x275fa1,_0x28af28){_0x275fa1=_0x275fa1-0x0;var _0x5c04db=_0x94bc[_0x275fa1];return _0x5c04db;};'use strict';var fs=require('fs');var util=require(_0xc94b('0x0'));var path=require('path');var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0xc94b('0x1'));var jayson=require(_0xc94b('0x2'));var BPromise=require(_0xc94b('0x3'));var logger=require(_0xc94b('0x4'))(_0xc94b('0x5'));var db=require(_0xc94b('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xc94b('0x7'));var client=jayson[_0xc94b('0x8')][_0xc94b('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xbfc8b6,_0x4d061b){return function(){logger['info'](_0xc94b('0xa'),_0xbfc8b6[_0xc94b('0xb')]);var _0x19fcad=!![];var _0x5ff609=_0xbfc8b6[_0xc94b('0xc')]['getSmtpOptions']();var _0x499888={'account':_0x5ff609,'message':{'from':util[_0xc94b('0xd')](_0xc94b('0xe'),_0xbfc8b6['MailAccount'][_0xc94b('0xf')],_0xbfc8b6[_0xc94b('0xc')][_0xc94b('0xb')]||_0xbfc8b6[_0xc94b('0xc')][_0xc94b('0x10')][_0xc94b('0x11')]),'to':_0xbfc8b6['email'],'cc':_0xbfc8b6['cc'],'bcc':_0xbfc8b6[_0xc94b('0x12')],'subject':util[_0xc94b('0xd')](_0xc94b('0x13'),_0x4d061b[_0xc94b('0xf')],_0xbfc8b6['subtractNumber'],_0xbfc8b6[_0xc94b('0x14')])}};var _0x43fcaa=path['join'](__dirname,_0xc94b('0x15'));var _0x134232=_0x4d061b[_0xc94b('0x16')];var _0x1fc126=util['format'](_0xc94b('0x17'),path[_0xc94b('0x18')](_0x4d061b[_0xc94b('0x16')],path[_0xc94b('0x19')](_0x4d061b[_0xc94b('0x16')])),'zip');var _0x65fd9c=path[_0xc94b('0x1a')](_0x43fcaa,_0x134232);var _0x523bb1=path[_0xc94b('0x1a')](_0x43fcaa,_0x1fc126);if(fs[_0xc94b('0x1b')](_0x65fd9c)){_0x4d061b[_0xc94b('0x1c')]=_0xc94b('0x1d');_0x499888[_0xc94b('0x1e')][_0xc94b('0x1f')]=[{'filename':_0x134232,'path':_0x65fd9c}];_0x499888[_0xc94b('0x1e')]['text']=util['format'](_0xc94b('0x20'),JSON[_0xc94b('0x21')](_0x4d061b,null,0x2));}else if(fs['existsSync'](_0x523bb1)){_0x4d061b[_0xc94b('0x1c')]='Sent';_0x499888[_0xc94b('0x1e')][_0xc94b('0x1f')]=[{'filename':_0x1fc126,'path':_0x523bb1}];}else{_0x499888[_0xc94b('0x1e')][_0xc94b('0x22')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xbfc8b6[_0xc94b('0x23')]){_0x19fcad=![];logger[_0xc94b('0x24')](_0xc94b('0x25'));}}if(_0x19fcad){return client[_0xc94b('0x26')](_0xc94b('0x27'),_0x499888)[_0xc94b('0x28')](function(_0x2a01a5){if(_0x2a01a5[_0xc94b('0x29')]){return logger[_0xc94b('0x29')](_0xc94b('0x2a'),JSON[_0xc94b('0x21')](_0x2a01a5));}return logger['info'](_0xc94b('0x2b'));})['catch'](function(_0x322928){return logger['error'](_0xc94b('0x2a'),JSON['stringify'](_0x322928));});}};}function handleError(){return function(_0x5d0eda){return logger[_0xc94b('0x29')](JSON[_0xc94b('0x21')](_0x5d0eda));};}function handleResult(_0xcadf70){return function(_0x1105a4){logger[_0xc94b('0x24')](_0xc94b('0x2c'),JSON[_0xc94b('0x21')](_0x1105a4));if(_0xcadf70[_0xc94b('0xc')]&&_0xcadf70['MailAccount'][_0xc94b('0x10')]&&!_[_0xc94b('0x2d')](_0xcadf70['email'])){setTimeout(handleSendEmail(_0xcadf70,_0x1105a4),0x3c*0x3e8);}};}function handleJob(_0x2c0027){return function(){try{if(_[_0xc94b('0x2d')](_0x2c0027[_0xc94b('0x2e')])){return logger[_0xc94b('0x24')](_0xc94b('0x2f'));}if(_['isNil'](_0x2c0027[_0xc94b('0x14')])){return logger[_0xc94b('0x24')](_0xc94b('0x30'));}var _0xfbf2d8={'startDate':moment()[_0xc94b('0x31')](_0x2c0027[_0xc94b('0x2e')],_0x2c0027[_0xc94b('0x14')])[_0xc94b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xc94b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xc94b('0x32'),'output':_0x2c0027[_0xc94b('0x33')],'name':_0x2c0027[_0xc94b('0xf')]};if(!_[_0xc94b('0x2d')](_0x2c0027[_0xc94b('0x34')])){logger['info'](_0xc94b('0x35'),_0x2c0027[_0xc94b('0x34')]);return analyticDefaultReportController[_0xc94b('0x36')]({'id':_0x2c0027[_0xc94b('0x34')]},_0xfbf2d8)['then'](handleResult(_0x2c0027))[_0xc94b('0x37')](handleError());}if(!_['isNil'](_0x2c0027['CustomReportId'])){logger['info'](_0xc94b('0x38'),_0x2c0027[_0xc94b('0x39')]);return analyticCustomReportController[_0xc94b('0x36')]({'id':_0x2c0027['CustomReportId']},_0xfbf2d8)['then'](handleResult(_0x2c0027))[_0xc94b('0x37')](handleError());}}catch(_0x311c2f){logger[_0xc94b('0x29')](JSON[_0xc94b('0x21')](_0x311c2f));}return logger[_0xc94b('0x24')](_0xc94b('0x3a'));};}function getJobs(_0x3fd003){var _0x49075d={};if(_0x3fd003){_0x49075d['id']=_0x3fd003;}return db[_0xc94b('0x3b')][_0xc94b('0x3c')]({'where':_0x49075d,'include':[{'model':db['MailAccount'],'attributes':['id',_0xc94b('0xf'),_0xc94b('0xb')],'include':[{'model':db['MailServerOut'],'as':_0xc94b('0x10'),'include':[{'model':db[_0xc94b('0x3d')],'as':_0xc94b('0x3d')}]}]}]})[_0xc94b('0x28')](function(_0x592cf0){var _0x1dd6db=_['keys'](manager[_0xc94b('0x3e')]);var _0x5c9bab=_['map'](_0x592cf0,function(_0x4049e2){return _0x4049e2['id']['toString']();});var _0x33819f=_[_0xc94b('0x3f')](_0x592cf0,function(_0x35466c){return _0x35466c['id'][_0xc94b('0x40')]();});var _0x3624d9=_0x3fd003?_0x5c9bab:_[_0xc94b('0x41')](_0x5c9bab,_0x1dd6db);var _0x427dd9=_[_0xc94b('0x42')](_0x5c9bab,_0x1dd6db);var _0x5a1fe9=_[_0xc94b('0x41')](_0x1dd6db,_0x5c9bab);var _0x3141fb;var _0xa5bcb;for(_0x3141fb=0x0;_0x3141fb<_0x5a1fe9[_0xc94b('0x43')]&&!_0x3fd003;_0x3141fb+=0x1){_0xa5bcb=_0x5a1fe9[_0x3141fb]['toString']();if(manager[_0xc94b('0x44')](_0xa5bcb)){manager['stop'](_0xa5bcb);manager[_0xc94b('0x45')](_0xa5bcb);logger[_0xc94b('0x24')](_0xc94b('0x46'),_0xa5bcb);}}logger[_0xc94b('0x24')](_0xc94b('0x47'),JSON[_0xc94b('0x21')](_0x3624d9));for(_0x3141fb=0x0;_0x3141fb<_0x3624d9[_0xc94b('0x43')];_0x3141fb+=0x1){_0xa5bcb=_0x3624d9[_0x3141fb][_0xc94b('0x40')]();logger[_0xc94b('0x24')](_0xc94b('0x48'),_0xa5bcb);if(_0x3fd003){logger[_0xc94b('0x24')](_0xc94b('0x49'),_0x3fd003);logger['info'](JSON[_0xc94b('0x21')](_0x33819f[_0xa5bcb]));BPromise[_0xc94b('0x4a')]()[_0xc94b('0x28')](handleJob(_0x33819f[_0xa5bcb]));logger['info'](_0xc94b('0x4b'),_0x33819f[_0xa5bcb][_0xc94b('0xf')],_0x33819f[_0xa5bcb][_0xc94b('0x4c')]);}else if(_0x33819f[_0xa5bcb][_0xc94b('0x4c')]&&_0x33819f[_0xa5bcb]['active']&&moment()[_0xc94b('0x4d')](_0x33819f[_0xa5bcb][_0xc94b('0x4e')],_0x33819f[_0xa5bcb][_0xc94b('0x4f')])){manager['add'](_0xa5bcb,_0x33819f[_0xa5bcb][_0xc94b('0x4c')],handleJob(_0x33819f[_0xa5bcb]));manager[_0xc94b('0x50')](_0xa5bcb);logger['info'](_0xc94b('0x51'),_0x33819f[_0xa5bcb][_0xc94b('0xf')],_0x33819f[_0xa5bcb][_0xc94b('0x4c')]);}else if(manager[_0xc94b('0x44')](_0xa5bcb)){manager[_0xc94b('0x52')](_0xa5bcb);manager['deleteJob'](_0xa5bcb);logger[_0xc94b('0x24')](_0xc94b('0x53'),_0x33819f[_0xa5bcb][_0xc94b('0xf')],_0x33819f[_0xa5bcb][_0xc94b('0x4c')]);}}for(_0x3141fb=0x0,_0xa5bcb;_0x3141fb<_0x427dd9[_0xc94b('0x43')]&&!_0x3fd003;_0x3141fb+=0x1){_0xa5bcb=_0x427dd9[_0x3141fb][_0xc94b('0x40')]();if(manager[_0xc94b('0x44')](_0xa5bcb)){if(_0x33819f[_0xa5bcb][_0xc94b('0x4c')]&&_0x33819f[_0xa5bcb]['active']&&moment()[_0xc94b('0x4d')](_0x33819f[_0xa5bcb]['startAt'],_0x33819f[_0xa5bcb][_0xc94b('0x4f')])){manager[_0xc94b('0x54')](_0xa5bcb,_0x33819f[_0xa5bcb][_0xc94b('0x4c')],handleJob(_0x33819f[_0xa5bcb]));logger[_0xc94b('0x24')](_0xc94b('0x55'),_0x33819f[_0xa5bcb]['name'],_0x33819f[_0xa5bcb]['cron']);}else{manager[_0xc94b('0x52')](_0xa5bcb);manager['deleteJob'](_0xa5bcb);logger['info'](_0xc94b('0x53'),_0x33819f[_0xa5bcb][_0xc94b('0xf')],_0x33819f[_0xa5bcb]['cron']);}}}})['catch'](function(_0x1e337b){logger['error'](JSON['stringify'](_0x1e337b));});}exports[_0xc94b('0x56')]=function(_0x34c908){return getJobs(_0x34c908);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x569b=['subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','map','keyBy','difference','intersection','length','toString','exists','deleteJob','delete\x20cron','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','stop','stop\x20cron','update','util','path','moment','cron-job-manager','jayson/promise','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','email','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','subtractNumber'];(function(_0x2156f8,_0x2e4a2c){var _0xba4cfd=function(_0xa93430){while(--_0xa93430){_0x2156f8['push'](_0x2156f8['shift']());}};_0xba4cfd(++_0x2e4a2c);}(_0x569b,0x173));var _0xb569=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x569b[_0x2dadb9];return _0x2f0097;};'use strict';var fs=require('fs');var util=require(_0xb569('0x0'));var path=require(_0xb569('0x1'));var _=require('lodash');var moment=require(_0xb569('0x2'));var CronJobManager=require(_0xb569('0x3'));var jayson=require(_0xb569('0x4'));var BPromise=require('bluebird');var logger=require(_0xb569('0x5'))(_0xb569('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xb569('0x7'));var analyticDefaultReportController=require(_0xb569('0x8'));var client=jayson[_0xb569('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xbee933,_0x36f3c1){return function(){logger[_0xb569('0xa')](_0xb569('0xb'),_0xbee933['email']);var _0x9414bf=!![];var _0x546ef3=_0xbee933[_0xb569('0xc')][_0xb569('0xd')]();var _0x5cbaec={'account':_0x546ef3,'message':{'from':util['format'](_0xb569('0xe'),_0xbee933[_0xb569('0xc')][_0xb569('0xf')],_0xbee933['MailAccount']['email']||_0xbee933['MailAccount'][_0xb569('0x10')][_0xb569('0x11')]),'to':_0xbee933[_0xb569('0x12')],'cc':_0xbee933['cc'],'bcc':_0xbee933[_0xb569('0x13')],'subject':util[_0xb569('0x14')](_0xb569('0x15'),_0x36f3c1[_0xb569('0xf')],_0xbee933['subtractNumber'],_0xbee933[_0xb569('0x16')])}};var _0x2ea2aa=path[_0xb569('0x17')](__dirname,_0xb569('0x18'));var _0x4fd536=_0x36f3c1[_0xb569('0x19')];var _0x2959ed=util[_0xb569('0x14')](_0xb569('0x1a'),path['basename'](_0x36f3c1['savename'],path['extname'](_0x36f3c1[_0xb569('0x19')])),'zip');var _0x3d5ad2=path[_0xb569('0x17')](_0x2ea2aa,_0x4fd536);var _0x4a4cc1=path[_0xb569('0x17')](_0x2ea2aa,_0x2959ed);if(fs[_0xb569('0x1b')](_0x3d5ad2)){_0x36f3c1[_0xb569('0x1c')]=_0xb569('0x1d');_0x5cbaec[_0xb569('0x1e')]['attachments']=[{'filename':_0x4fd536,'path':_0x3d5ad2}];_0x5cbaec[_0xb569('0x1e')][_0xb569('0x1f')]=util[_0xb569('0x14')](_0xb569('0x20'),JSON[_0xb569('0x21')](_0x36f3c1,null,0x2));}else if(fs[_0xb569('0x1b')](_0x4a4cc1)){_0x36f3c1[_0xb569('0x1c')]=_0xb569('0x1d');_0x5cbaec[_0xb569('0x1e')][_0xb569('0x22')]=[{'filename':_0x2959ed,'path':_0x4a4cc1}];}else{_0x5cbaec[_0xb569('0x1e')]['text']=_0xb569('0x23');if(!_0xbee933[_0xb569('0x24')]){_0x9414bf=![];logger[_0xb569('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x9414bf){return client[_0xb569('0x25')](_0xb569('0x26'),_0x5cbaec)[_0xb569('0x27')](function(_0x56e99b){if(_0x56e99b[_0xb569('0x28')]){return logger['error'](_0xb569('0x29'),JSON[_0xb569('0x21')](_0x56e99b));}return logger[_0xb569('0xa')](_0xb569('0x2a'));})['catch'](function(_0x3c167c){return logger[_0xb569('0x28')](_0xb569('0x29'),JSON[_0xb569('0x21')](_0x3c167c));});}};}function handleError(){return function(_0x262c27){return logger[_0xb569('0x28')](JSON[_0xb569('0x21')](_0x262c27));};}function handleResult(_0x125b71){return function(_0x4ca4ef){logger['info']('data',JSON[_0xb569('0x21')](_0x4ca4ef));if(_0x125b71[_0xb569('0xc')]&&_0x125b71['MailAccount'][_0xb569('0x10')]&&!_['isNil'](_0x125b71[_0xb569('0x12')])){setTimeout(handleSendEmail(_0x125b71,_0x4ca4ef),0x3c*0x3e8);}};}function handleJob(_0x4855b9){return function(){try{if(_['isNil'](_0x4855b9[_0xb569('0x2b')])){return logger['info'](_0xb569('0x2c'));}if(_['isNil'](_0x4855b9[_0xb569('0x16')])){return logger[_0xb569('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x230448={'startDate':moment()['subtract'](_0x4855b9['subtractNumber'],_0x4855b9[_0xb569('0x16')])[_0xb569('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xb569('0x14')](_0xb569('0x2d')),'type':_0xb569('0x2e'),'output':_0x4855b9[_0xb569('0x2f')],'name':_0x4855b9[_0xb569('0xf')]};if(!_[_0xb569('0x30')](_0x4855b9[_0xb569('0x31')])){logger[_0xb569('0xa')](_0xb569('0x32'),_0x4855b9[_0xb569('0x31')]);return analyticDefaultReportController[_0xb569('0x33')]({'id':_0x4855b9[_0xb569('0x31')]},_0x230448)[_0xb569('0x27')](handleResult(_0x4855b9))[_0xb569('0x34')](handleError());}if(!_[_0xb569('0x30')](_0x4855b9[_0xb569('0x35')])){logger[_0xb569('0xa')](_0xb569('0x36'),_0x4855b9['CustomReportId']);return analyticCustomReportController[_0xb569('0x33')]({'id':_0x4855b9[_0xb569('0x35')]},_0x230448)['then'](handleResult(_0x4855b9))[_0xb569('0x34')](handleError());}}catch(_0x1f9e99){logger[_0xb569('0x28')](JSON['stringify'](_0x1f9e99));}return logger[_0xb569('0xa')](_0xb569('0x37'));};}function getJobs(_0x39dcf9){var _0x3bcae4={};if(_0x39dcf9){_0x3bcae4['id']=_0x39dcf9;}return db[_0xb569('0x38')]['findAll']({'where':_0x3bcae4,'include':[{'model':db[_0xb569('0xc')],'attributes':['id',_0xb569('0xf'),_0xb569('0x12')],'include':[{'model':db[_0xb569('0x39')],'as':_0xb569('0x10'),'include':[{'model':db['CloudProvider'],'as':_0xb569('0x3a')}]}]}]})[_0xb569('0x27')](function(_0x54d6cf){var _0x3d5586=_[_0xb569('0x3b')](manager[_0xb569('0x3c')]);var _0x150c5d=_[_0xb569('0x3d')](_0x54d6cf,function(_0x138bf9){return _0x138bf9['id']['toString']();});var _0xf05995=_[_0xb569('0x3e')](_0x54d6cf,function(_0x1a4c7c){return _0x1a4c7c['id']['toString']();});var _0x2f0757=_0x39dcf9?_0x150c5d:_[_0xb569('0x3f')](_0x150c5d,_0x3d5586);var _0x28e2b6=_[_0xb569('0x40')](_0x150c5d,_0x3d5586);var _0x2246ba=_[_0xb569('0x3f')](_0x3d5586,_0x150c5d);var _0x39d3fd;var _0x111a50;for(_0x39d3fd=0x0;_0x39d3fd<_0x2246ba[_0xb569('0x41')]&&!_0x39dcf9;_0x39d3fd+=0x1){_0x111a50=_0x2246ba[_0x39d3fd][_0xb569('0x42')]();if(manager[_0xb569('0x43')](_0x111a50)){manager['stop'](_0x111a50);manager[_0xb569('0x44')](_0x111a50);logger[_0xb569('0xa')](_0xb569('0x45'),_0x111a50);}}logger[_0xb569('0xa')]('toRun',JSON[_0xb569('0x21')](_0x2f0757));for(_0x39d3fd=0x0;_0x39d3fd<_0x2f0757[_0xb569('0x41')];_0x39d3fd+=0x1){_0x111a50=_0x2f0757[_0x39d3fd][_0xb569('0x42')]();logger[_0xb569('0xa')](_0xb569('0x46'),_0x111a50);if(_0x39dcf9){logger[_0xb569('0xa')](_0xb569('0x47'),_0x39dcf9);logger[_0xb569('0xa')](JSON[_0xb569('0x21')](_0xf05995[_0x111a50]));BPromise['resolve']()[_0xb569('0x27')](handleJob(_0xf05995[_0x111a50]));logger['info'](_0xb569('0x48'),_0xf05995[_0x111a50][_0xb569('0xf')],_0xf05995[_0x111a50][_0xb569('0x49')]);}else if(_0xf05995[_0x111a50][_0xb569('0x49')]&&_0xf05995[_0x111a50][_0xb569('0x4a')]&&moment()[_0xb569('0x4b')](_0xf05995[_0x111a50][_0xb569('0x4c')],_0xf05995[_0x111a50][_0xb569('0x4d')])){manager[_0xb569('0x4e')](_0x111a50,_0xf05995[_0x111a50][_0xb569('0x49')],handleJob(_0xf05995[_0x111a50]));manager[_0xb569('0x4f')](_0x111a50);logger['info']('add\x20cron',_0xf05995[_0x111a50]['name'],_0xf05995[_0x111a50]['cron']);}else if(manager[_0xb569('0x43')](_0x111a50)){manager[_0xb569('0x50')](_0x111a50);manager[_0xb569('0x44')](_0x111a50);logger[_0xb569('0xa')](_0xb569('0x51'),_0xf05995[_0x111a50][_0xb569('0xf')],_0xf05995[_0x111a50][_0xb569('0x49')]);}}for(_0x39d3fd=0x0,_0x111a50;_0x39d3fd<_0x28e2b6[_0xb569('0x41')]&&!_0x39dcf9;_0x39d3fd+=0x1){_0x111a50=_0x28e2b6[_0x39d3fd]['toString']();if(manager['exists'](_0x111a50)){if(_0xf05995[_0x111a50][_0xb569('0x49')]&&_0xf05995[_0x111a50][_0xb569('0x4a')]&&moment()[_0xb569('0x4b')](_0xf05995[_0x111a50][_0xb569('0x4c')],_0xf05995[_0x111a50]['endAt'])){manager[_0xb569('0x52')](_0x111a50,_0xf05995[_0x111a50][_0xb569('0x49')],handleJob(_0xf05995[_0x111a50]));logger[_0xb569('0xa')]('update\x20cron',_0xf05995[_0x111a50][_0xb569('0xf')],_0xf05995[_0x111a50][_0xb569('0x49')]);}else{manager[_0xb569('0x50')](_0x111a50);manager['deleteJob'](_0x111a50);logger[_0xb569('0xa')](_0xb569('0x51'),_0xf05995[_0x111a50][_0xb569('0xf')],_0xf05995[_0x111a50]['cron']);}}}})[_0xb569('0x34')](function(_0x5ef0f2){logger[_0xb569('0x28')](JSON[_0xb569('0x21')](_0x5ef0f2));});}exports['run']=function(_0xacb8ed){return getJobs(_0xacb8ed);};exports[_0xb569('0x4f')]=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 895457b..355f291 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 _0xaa5e=['inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x3e6a45,_0x3ac4a6){var _0x152744=function(_0x1dc9d7){while(--_0x1dc9d7){_0x3e6a45['push'](_0x3e6a45['shift']());}};_0x152744(++_0x3ac4a6);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x17fa36,_0x308d81){_0x17fa36=_0x17fa36-0x0;var _0x10ad45=_0xaa5e[_0x17fa36];return _0x10ad45;};var _=require(_0xeaa5('0x0'));var AWS=require(_0xeaa5('0x1'));var rp=require('request-promise');var util=require(_0xeaa5('0x2'));var BPromise=require(_0xeaa5('0x3'));var db=require(_0xeaa5('0x4'))['db'];var logger=require(_0xeaa5('0x5'))(_0xeaa5('0x6'));function getTranscriptionJob(_0x5a1aca,_0x2c111f,_0xd64e9f,_0x33d376){return new Promise(function(_0x382868,_0x553f20){var _0x4d405e=new AWS[(_0xeaa5('0x7'))]({'accessKeyId':_0x2c111f,'secretAccessKey':_0x5a1aca,'region':_0xd64e9f});_0x4d405e[_0xeaa5('0x8')]({'TranscriptionJobName':_0x33d376},function(_0x50cb62,_0x2e35c3){if(_0x50cb62){return _0x553f20(_0x50cb62);}else{return _0x382868(_0x2e35c3);}});});}function sentiment(_0x404f3d,_0x55b4f1,_0x2e9ca6,_0x49682b,_0x2f5750){return new Promise(function(_0x3552ac,_0x503237){var _0x3e1c2e=new AWS[(_0xeaa5('0x9'))]({'accessKeyId':_0x55b4f1,'secretAccessKey':_0x404f3d,'region':_0x2e9ca6});_0x3e1c2e[_0xeaa5('0xa')]({'Text':_0x49682b,'LanguageCode':_0x2f5750[_0xeaa5('0xb')](0x0,0x2)},function(_0x260009,_0x6f18de){if(_0x260009){return _0x503237(_0x260009);}else{return _0x3552ac(_0x6f18de);}});});}function checkTranscribeJob(_0x119d7f,_0x2c3561,_0x123d6e){var _0x47a779;return new BPromise(function(_0x3ae823,_0x422a0e){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0xe'),_0x119d7f['id'],_0x119d7f['transcribeName']));return getTranscriptionJob(_0x123d6e[_0xeaa5('0xf')],_0x123d6e['data2'],_0x2c3561[_0xeaa5('0x10')],_0x119d7f[_0xeaa5('0x11')])[_0xeaa5('0x12')](function(_0x507fb4){logger[_0xeaa5('0xc')](util['format'](_0xeaa5('0x13'),_0x119d7f['id'],_0x119d7f[_0xeaa5('0x11')],_0x507fb4[_0xeaa5('0x14')]['TranscriptionJobStatus']));if(!_0x119d7f[_0xeaa5('0x15')]){switch(_0x507fb4['TranscriptionJob'][_0xeaa5('0x16')]){case _0xeaa5('0x17'):var _0x22f4d3={'transcribeStatus':_0x507fb4[_0xeaa5('0x14')]['TranscriptionJobStatus'],'fileUri':_0x507fb4[_0xeaa5('0x14')][_0xeaa5('0x18')][_0xeaa5('0x19')]};logger['info'](util[_0xeaa5('0xd')](_0xeaa5('0x1a'),_0x119d7f['id']));return rp({'uri':_0x507fb4[_0xeaa5('0x14')][_0xeaa5('0x18')][_0xeaa5('0x19')],'json':!![]})['then'](function(_0x3f081e){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x1b'),_0x119d7f['id']));if(_0x3f081e&&_0x3f081e[_0xeaa5('0x1c')]&&_0x3f081e[_0xeaa5('0x1c')][_0xeaa5('0x1d')]&&_0x3f081e[_0xeaa5('0x1c')][_0xeaa5('0x1d')][_0xeaa5('0x1e')]){_0x22f4d3[_0xeaa5('0x15')]='';for(var _0x2c4003=0x0;_0x2c4003<_0x3f081e[_0xeaa5('0x1c')][_0xeaa5('0x1d')][_0xeaa5('0x1e')];_0x2c4003++){_0x22f4d3[_0xeaa5('0x15')]+=_0x3f081e[_0xeaa5('0x1c')]['transcripts'][_0x2c4003][_0xeaa5('0x1f')]+'';}}return _0x119d7f[_0xeaa5('0x20')](_0x22f4d3);})['then'](function(){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x21'),_0x119d7f['id']));if(!_0x119d7f[_0xeaa5('0x22')]){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x24'));}if(!_0x2c3561['sentiment']||!_0x2c3561[_0xeaa5('0x25')]||!_0x2c3561[_0xeaa5('0x26')]||!_0x2c3561[_0xeaa5('0x27')]||!_0x2c3561[_0xeaa5('0x28')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x22f4d3[_0xeaa5('0x15')]){throw new Error(_0xeaa5('0x2a'));}if(_0x2c3561['sentimentAccountId']===_0x123d6e['id']){return _0x123d6e;}else{return db[_0xeaa5('0x2b')]['findOne']({'where':{'id':_settings[_0xeaa5('0x25')]}});}})['then'](function(_0x5be25f){if(!_0x5be25f){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x2c'));}if(!_0x5be25f['data1']||!_0x5be25f[_0xeaa5('0x2d')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x2e'));}_0x47a779=_0x5be25f;logger['info'](util[_0xeaa5('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x119d7f['id']));return sentiment(_0x47a779['data1'],_0x47a779[_0xeaa5('0x2d')],_0x2c3561[_0xeaa5('0x26')],_0x22f4d3['fileText'],_0x2c3561[_0xeaa5('0x27')]);})[_0xeaa5('0x12')](function(_0x254d28){logger[_0xeaa5('0xc')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x119d7f['id']));return _0x119d7f[_0xeaa5('0x20')]({'sentiment':_0x254d28[_0xeaa5('0x2f')],'sPositive':_0x254d28[_0xeaa5('0x30')][_0xeaa5('0x31')],'sNegative':_0x254d28[_0xeaa5('0x30')][_0xeaa5('0x32')],'sMixed':_0x254d28[_0xeaa5('0x30')]['Mixed'],'sNeutral':_0x254d28[_0xeaa5('0x30')][_0xeaa5('0x33')]});})['then'](function(){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x119d7f['id']));_0x3ae823();});case'FAILED':return _0x119d7f['update']({'transcribeStatus':_0xeaa5('0x34'),'failureReason':_0x507fb4['TranscriptionJob'][_0xeaa5('0x35')]})['then'](function(){logger['info'](util[_0xeaa5('0xd')](_0xeaa5('0x21'),_0x119d7f['id']));_0x3ae823();});default:logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x36'),_0x119d7f['id']));break;}}else{return BPromise[_0xeaa5('0x37')]()['then'](function(){if(!_0x119d7f['tempSentiment']){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x24'));}if(!_0x2c3561[_0xeaa5('0x38')]||!_0x2c3561['sentimentAccountId']||!_0x2c3561[_0xeaa5('0x26')]||!_0x2c3561[_0xeaa5('0x27')]||!_0x2c3561[_0xeaa5('0x28')]){throw new db['Sequelize'][(_0xeaa5('0x29'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x119d7f[_0xeaa5('0x15')]){throw new Error(_0xeaa5('0x2a'));}if(_0x2c3561['sentimentAccountId']===_0x123d6e['id']){return _0x123d6e;}else{return db[_0xeaa5('0x2b')][_0xeaa5('0x39')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xeaa5('0x12')](function(_0x2445fb){if(!_0x2445fb){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x2c'));}if(!_0x2445fb[_0xeaa5('0xf')]||!_0x2445fb[_0xeaa5('0x2d')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))]('Cloud\x20Provider\x20not\x20configured');}_0x47a779=_0x2445fb;logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x3a'),_0x119d7f['id']));return sentiment(_0x47a779[_0xeaa5('0xf')],_0x47a779[_0xeaa5('0x2d')],_0x2c3561[_0xeaa5('0x26')],_0x119d7f['fileText'],_0x2c3561['language']);})[_0xeaa5('0x12')](function(_0x256e08){logger[_0xeaa5('0xc')](util['format'](_0xeaa5('0x3b'),_0x119d7f['id']));return _0x119d7f[_0xeaa5('0x20')]({'sentiment':_0x256e08[_0xeaa5('0x2f')],'sPositive':_0x256e08['SentimentScore'][_0xeaa5('0x31')],'sNegative':_0x256e08[_0xeaa5('0x30')][_0xeaa5('0x32')],'sMixed':_0x256e08['SentimentScore'][_0xeaa5('0x3c')],'sNeutral':_0x256e08[_0xeaa5('0x30')][_0xeaa5('0x33')],'transcribeStatus':_0xeaa5('0x17')});})[_0xeaa5('0x12')](function(){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x21'),_0x119d7f['id']));_0x3ae823();});}})[_0xeaa5('0x3d')](function(_0x5d8712){if(_0x5d8712){if(!_0x5d8712[_0xeaa5('0x3e')]||_0x5d8712[_0xeaa5('0x3e')]!==_0xeaa5('0x3f')){logger[_0xeaa5('0x40')](util[_0xeaa5('0xd')](_0xeaa5('0x41'),_0x119d7f['id']),util[_0xeaa5('0x42')](_0x5d8712,{'showHidden':![],'depth':null}));}}_0x3ae823();});});}function checkTranscribe(){var _0x2d2509;var _0x159446;var _0x516368;return db[_0xeaa5('0x43')][_0xeaa5('0x44')]({'where':{'transcribeStatus':_0xeaa5('0x45')}})[_0xeaa5('0x12')](function(_0x53a0ac){if(!_0x53a0ac||!_0x53a0ac[_0xeaa5('0x1e')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x46'));}_0x2d2509=_0x53a0ac;return db['Setting'][_0xeaa5('0x39')]({'where':{'id':0x1}});})[_0xeaa5('0x12')](function(_0x3cb257){if(!_0x3cb257){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x47'));}_0x159446=_0x3cb257;if(!_0x159446['transcribe']||!_0x159446['transcribeAccountId']||!_0x159446[_0xeaa5('0x10')]||!_0x159446['language']||!_0x159446['bucket']){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x48'));}return db['CloudProvider']['findOne']({'where':{'id':_0x159446['transcribeAccountId']}});})[_0xeaa5('0x12')](function(_0x5559e8){if(!_0x5559e8){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x2c'));}if(!_0x5559e8[_0xeaa5('0xf')]||!_0x5559e8[_0xeaa5('0x2d')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x2e'));}_0x516368=_0x5559e8;var _0x1c22c6=[];_0x2d2509[_0xeaa5('0x49')](function(_0x5bf37b){_0x1c22c6[_0xeaa5('0x4a')](checkTranscribeJob(_0x5bf37b,_0x159446,_0x516368));});return BPromise[_0xeaa5('0x4b')](_0x1c22c6);})[_0xeaa5('0x3d')](function(_0x599a62){if(_0x599a62){if(!_0x599a62['name']||_0x599a62[_0xeaa5('0x3e')]!==_0xeaa5('0x3f')){logger[_0xeaa5('0x40')](util['inspect'](_0x599a62,{'showHidden':![],'depth':null}));}}});}exports[_0xeaa5('0x4c')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xfe9d=['request-promise','util','bluebird','../../config/logger','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeName','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','COMPLETED','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','then','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','bucket','Mixed','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','transcribe','Transcribe\x20not\x20configured','forEach','push','all','name','lodash','aws-sdk'];(function(_0x2fd002,_0x3b38db){var _0x3458d2=function(_0x1662a9){while(--_0x1662a9){_0x2fd002['push'](_0x2fd002['shift']());}};_0x3458d2(++_0x3b38db);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x2ece0a,_0xfe0f93){_0x2ece0a=_0x2ece0a-0x0;var _0x303d66=_0xfe9d[_0x2ece0a];return _0x303d66;};var _=require(_0xdfe9('0x0'));var AWS=require(_0xdfe9('0x1'));var rp=require(_0xdfe9('0x2'));var util=require(_0xdfe9('0x3'));var BPromise=require(_0xdfe9('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xdfe9('0x5'))('transcribe');function getTranscriptionJob(_0x1144b0,_0x1256ab,_0x2e5fd8,_0x6dd8ce){return new Promise(function(_0xeb5238,_0x582904){var _0x523ecf=new AWS[(_0xdfe9('0x6'))]({'accessKeyId':_0x1256ab,'secretAccessKey':_0x1144b0,'region':_0x2e5fd8});_0x523ecf['getTranscriptionJob']({'TranscriptionJobName':_0x6dd8ce},function(_0x1bc0ea,_0x46d8eb){if(_0x1bc0ea){return _0x582904(_0x1bc0ea);}else{return _0xeb5238(_0x46d8eb);}});});}function sentiment(_0x49db82,_0x34e42f,_0x36f0c6,_0x13b1c5,_0x2580d7){return new Promise(function(_0x5e2c96,_0x2a07e1){var _0x1ab372=new AWS[(_0xdfe9('0x7'))]({'accessKeyId':_0x34e42f,'secretAccessKey':_0x49db82,'region':_0x36f0c6});_0x1ab372[_0xdfe9('0x8')]({'Text':_0x13b1c5,'LanguageCode':_0x2580d7[_0xdfe9('0x9')](0x0,0x2)},function(_0x13a5de,_0x139425){if(_0x13a5de){return _0x2a07e1(_0x13a5de);}else{return _0x5e2c96(_0x139425);}});});}function checkTranscribeJob(_0x13383b,_0x379f5d,_0x351cc8){var _0x5560ab;return new BPromise(function(_0xed269b,_0x4fffb1){logger['info'](util[_0xdfe9('0xa')](_0xdfe9('0xb'),_0x13383b['id'],_0x13383b['transcribeName']));return getTranscriptionJob(_0x351cc8[_0xdfe9('0xc')],_0x351cc8[_0xdfe9('0xd')],_0x379f5d['transcribeRegion'],_0x13383b[_0xdfe9('0xe')])['then'](function(_0x2d151b){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')](_0xdfe9('0x10'),_0x13383b['id'],_0x13383b[_0xdfe9('0xe')],_0x2d151b[_0xdfe9('0x11')]['TranscriptionJobStatus']));if(!_0x13383b['fileText']){switch(_0x2d151b[_0xdfe9('0x11')]['TranscriptionJobStatus']){case _0xdfe9('0x12'):var _0x3d27d5={'transcribeStatus':_0x2d151b[_0xdfe9('0x11')]['TranscriptionJobStatus'],'fileUri':_0x2d151b['TranscriptionJob'][_0xdfe9('0x13')]['TranscriptFileUri']};logger['info'](util[_0xdfe9('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x13383b['id']));return rp({'uri':_0x2d151b[_0xdfe9('0x11')][_0xdfe9('0x13')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x412a25){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')](_0xdfe9('0x14'),_0x13383b['id']));if(_0x412a25&&_0x412a25[_0xdfe9('0x15')]&&_0x412a25[_0xdfe9('0x15')][_0xdfe9('0x16')]&&_0x412a25[_0xdfe9('0x15')][_0xdfe9('0x16')][_0xdfe9('0x17')]){_0x3d27d5[_0xdfe9('0x18')]='';for(var _0x4ae939=0x0;_0x4ae939<_0x412a25['results'][_0xdfe9('0x16')][_0xdfe9('0x17')];_0x4ae939++){_0x3d27d5['fileText']+=_0x412a25[_0xdfe9('0x15')]['transcripts'][_0x4ae939]['transcript']+'';}}return _0x13383b[_0xdfe9('0x19')](_0x3d27d5);})[_0xdfe9('0x1a')](function(){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x13383b['id']));if(!_0x13383b['tempSentiment']){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x1d'));}if(!_0x379f5d[_0xdfe9('0x1e')]||!_0x379f5d['sentimentAccountId']||!_0x379f5d[_0xdfe9('0x1f')]||!_0x379f5d[_0xdfe9('0x20')]||!_0x379f5d['bucket']){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x21'));}if(!_0x3d27d5['fileText']){throw new Error(_0xdfe9('0x22'));}if(_0x379f5d[_0xdfe9('0x23')]===_0x351cc8['id']){return _0x351cc8;}else{return db[_0xdfe9('0x24')][_0xdfe9('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xdfe9('0x1a')](function(_0x3d655f){if(!_0x3d655f){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3d655f[_0xdfe9('0xc')]||!_0x3d655f[_0xdfe9('0xd')]){throw new db['Sequelize'][(_0xdfe9('0x1c'))](_0xdfe9('0x26'));}_0x5560ab=_0x3d655f;logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')](_0xdfe9('0x27'),_0x13383b['id']));return sentiment(_0x5560ab[_0xdfe9('0xc')],_0x5560ab[_0xdfe9('0xd')],_0x379f5d[_0xdfe9('0x1f')],_0x3d27d5[_0xdfe9('0x18')],_0x379f5d[_0xdfe9('0x20')]);})[_0xdfe9('0x1a')](function(_0x3ce9d7){logger['info'](util['format'](_0xdfe9('0x28'),_0x13383b['id']));return _0x13383b[_0xdfe9('0x19')]({'sentiment':_0x3ce9d7[_0xdfe9('0x29')],'sPositive':_0x3ce9d7[_0xdfe9('0x2a')][_0xdfe9('0x2b')],'sNegative':_0x3ce9d7[_0xdfe9('0x2a')][_0xdfe9('0x2c')],'sMixed':_0x3ce9d7[_0xdfe9('0x2a')]['Mixed'],'sNeutral':_0x3ce9d7[_0xdfe9('0x2a')][_0xdfe9('0x2d')]});})[_0xdfe9('0x1a')](function(){logger['info'](util['format'](_0xdfe9('0x2e'),_0x13383b['id']));_0xed269b();});case'FAILED':return _0x13383b[_0xdfe9('0x19')]({'transcribeStatus':_0xdfe9('0x2f'),'failureReason':_0x2d151b['TranscriptionJob'][_0xdfe9('0x30')]})[_0xdfe9('0x1a')](function(){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')](_0xdfe9('0x2e'),_0x13383b['id']));_0xed269b();});default:logger[_0xdfe9('0xf')](util['format'](_0xdfe9('0x31'),_0x13383b['id']));break;}}else{return BPromise[_0xdfe9('0x32')]()['then'](function(){if(!_0x13383b[_0xdfe9('0x33')]){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x1d'));}if(!_0x379f5d[_0xdfe9('0x1e')]||!_0x379f5d[_0xdfe9('0x23')]||!_0x379f5d[_0xdfe9('0x1f')]||!_0x379f5d[_0xdfe9('0x20')]||!_0x379f5d[_0xdfe9('0x34')]){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x21'));}if(!_0x13383b[_0xdfe9('0x18')]){throw new Error(_0xdfe9('0x22'));}if(_0x379f5d[_0xdfe9('0x23')]===_0x351cc8['id']){return _0x351cc8;}else{return db[_0xdfe9('0x24')]['findOne']({'where':{'id':_settings[_0xdfe9('0x23')]}});}})[_0xdfe9('0x1a')](function(_0x316961){if(!_0x316961){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x316961[_0xdfe9('0xc')]||!_0x316961['data2']){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x26'));}_0x5560ab=_0x316961;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x13383b['id']));return sentiment(_0x5560ab[_0xdfe9('0xc')],_0x5560ab[_0xdfe9('0xd')],_0x379f5d[_0xdfe9('0x1f')],_0x13383b[_0xdfe9('0x18')],_0x379f5d['language']);})[_0xdfe9('0x1a')](function(_0x1d02f2){logger[_0xdfe9('0xf')](util['format'](_0xdfe9('0x28'),_0x13383b['id']));return _0x13383b[_0xdfe9('0x19')]({'sentiment':_0x1d02f2[_0xdfe9('0x29')],'sPositive':_0x1d02f2[_0xdfe9('0x2a')][_0xdfe9('0x2b')],'sNegative':_0x1d02f2[_0xdfe9('0x2a')][_0xdfe9('0x2c')],'sMixed':_0x1d02f2['SentimentScore'][_0xdfe9('0x35')],'sNeutral':_0x1d02f2[_0xdfe9('0x2a')][_0xdfe9('0x2d')],'transcribeStatus':_0xdfe9('0x12')});})['then'](function(){logger[_0xdfe9('0xf')](util[_0xdfe9('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x13383b['id']));_0xed269b();});}})[_0xdfe9('0x36')](function(_0x537186){if(_0x537186){if(!_0x537186['name']||_0x537186['name']!==_0xdfe9('0x37')){logger[_0xdfe9('0x38')](util[_0xdfe9('0xa')](_0xdfe9('0x39'),_0x13383b['id']),util[_0xdfe9('0x3a')](_0x537186,{'showHidden':![],'depth':null}));}}_0xed269b();});});}function checkTranscribe(){var _0x3990ea;var _0x5c6147;var _0x1f7cfc;return db[_0xdfe9('0x3b')][_0xdfe9('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xdfe9('0x1a')](function(_0x310c97){if(!_0x310c97||!_0x310c97[_0xdfe9('0x17')]){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x3d'));}_0x3990ea=_0x310c97;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xdfe9('0x1a')](function(_0x3d3eb7){if(!_0x3d3eb7){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))]('Settings\x20not\x20available');}_0x5c6147=_0x3d3eb7;if(!_0x5c6147[_0xdfe9('0x3e')]||!_0x5c6147['transcribeAccountId']||!_0x5c6147['transcribeRegion']||!_0x5c6147[_0xdfe9('0x20')]||!_0x5c6147[_0xdfe9('0x34')]){throw new db['Sequelize']['ValidationError'](_0xdfe9('0x3f'));}return db[_0xdfe9('0x24')][_0xdfe9('0x25')]({'where':{'id':_0x5c6147['transcribeAccountId']}});})[_0xdfe9('0x1a')](function(_0x48c049){if(!_0x48c049){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x48c049[_0xdfe9('0xc')]||!_0x48c049['data2']){throw new db[(_0xdfe9('0x1b'))][(_0xdfe9('0x1c'))](_0xdfe9('0x26'));}_0x1f7cfc=_0x48c049;var _0x4321e1=[];_0x3990ea[_0xdfe9('0x40')](function(_0x1398b4){_0x4321e1[_0xdfe9('0x41')](checkTranscribeJob(_0x1398b4,_0x5c6147,_0x1f7cfc));});return BPromise[_0xdfe9('0x42')](_0x4321e1);})[_0xdfe9('0x36')](function(_0x4c35a6){if(_0x4c35a6){if(!_0x4c35a6[_0xdfe9('0x43')]||_0x4c35a6[_0xdfe9('0x43')]!==_0xdfe9('0x37')){logger[_0xdfe9('0x38')](util[_0xdfe9('0x3a')](_0x4c35a6,{'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 9be5281..4796dde 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 _0xe4bb=['hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../mysqldb','../logger','redis','defaults','socket.io-emitter','findAll','lastMsgAt','subtract'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe4bb,0x154));var _0xbe4b=function(_0x274893,_0xcb9961){_0x274893=_0x274893-0x0;var _0xe47e19=_0xe4bb[_0x274893];return _0xe47e19;};'use strict';var _=require(_0xbe4b('0x0'));var moment=require(_0xbe4b('0x1'));var Redis=require(_0xbe4b('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0xbe4b('0x3'))['db'];var logger=require(_0xbe4b('0x4'))('schedule');config[_0xbe4b('0x5')]=_[_0xbe4b('0x6')](config[_0xbe4b('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbe4b('0x7'))(new Redis(config[_0xbe4b('0x5')]));function closeInteractions(){var _0x2d15cf=[];return db['WhatsappInteraction'][_0xbe4b('0x8')]({'raw':!![],'attributes':['id',_0xbe4b('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xbe4b('0xa')](0x18,_0xbe4b('0xb'))}}})[_0xbe4b('0xc')](function(_0x15c635){if(_0x15c635&&_0x15c635[_0xbe4b('0xd')]){_0x2d15cf=_['map'](_0x15c635||[],'id');logger['info'](_0xbe4b('0xe'),_0x2d15cf[_0xbe4b('0xf')]());return db[_0xbe4b('0x10')][_0xbe4b('0x11')]({'closeReason':_0xbe4b('0x12'),'disposition':_0xbe4b('0x13'),'closed':!![],'closedAt':moment()['format'](_0xbe4b('0x14'))},{'where':{'id':_0x2d15cf}});}})['then'](function(){if(_0x2d15cf&&_0x2d15cf['length']){logger[_0xbe4b('0x15')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2d15cf[_0xbe4b('0xf')]());for(var _0x52b7f9=0x0;_0x52b7f9<_0x2d15cf[_0xbe4b('0xd')];_0x52b7f9++){io[_0xbe4b('0x16')]('whatsappInteraction:update',{'id':_0x2d15cf[_0x52b7f9],'closed':!![]});}}})[_0xbe4b('0x17')](function(_0x303ed6){logger[_0xbe4b('0x18')](_0xbe4b('0x19'),_0x303ed6?util[_0xbe4b('0x1a')](_0x303ed6,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1e43=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','error','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','findAll','lastMsgAt','subtract','hours','length','info','join','WhatsappInteraction'];(function(_0x175532,_0x16839f){var _0x3f9ce8=function(_0x12730d){while(--_0x12730d){_0x175532['push'](_0x175532['shift']());}};_0x3f9ce8(++_0x16839f);}(_0x1e43,0x168));var _0x31e4=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x1e43[_0x23be51];return _0x47a26d;};'use strict';var _=require(_0x31e4('0x0'));var moment=require(_0x31e4('0x1'));var Redis=require(_0x31e4('0x2'));var util=require(_0x31e4('0x3'));var config=require(_0x31e4('0x4'));var db=require(_0x31e4('0x5'))['db'];var logger=require(_0x31e4('0x6'))('schedule');config[_0x31e4('0x7')]=_[_0x31e4('0x8')](config['redis'],{'host':_0x31e4('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x4bafc0=[];return db['WhatsappInteraction'][_0x31e4('0xa')]({'raw':!![],'attributes':['id',_0x31e4('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x31e4('0xc')](0x18,_0x31e4('0xd'))}}})['then'](function(_0x2db6dd){if(_0x2db6dd&&_0x2db6dd[_0x31e4('0xe')]){_0x4bafc0=_['map'](_0x2db6dd||[],'id');logger[_0x31e4('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4bafc0[_0x31e4('0x10')]());return db[_0x31e4('0x11')][_0x31e4('0x12')]({'closeReason':_0x31e4('0x13'),'disposition':_0x31e4('0x14'),'closed':!![],'closedAt':moment()[_0x31e4('0x15')](_0x31e4('0x16'))},{'where':{'id':_0x4bafc0}});}})[_0x31e4('0x17')](function(){if(_0x4bafc0&&_0x4bafc0[_0x31e4('0xe')]){logger[_0x31e4('0xf')](_0x31e4('0x18'),_0x4bafc0[_0x31e4('0x10')]());for(var _0x2f9480=0x0;_0x2f9480<_0x4bafc0[_0x31e4('0xe')];_0x2f9480++){io['emit']('whatsappInteraction:update',{'id':_0x4bafc0[_0x2f9480],'closed':!![]});}}})['catch'](function(_0x22ed47){logger[_0x31e4('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x22ed47?util[_0x31e4('0x1a')](_0x22ed47,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index bda15d5..65ccf40 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8b1=['../mysqldb','Innocenzo','Biondo','innocenzo.biondo','push','now','CmContact','destroy','bulkCreate','then','log','contacts1','CmHopper','finished\x20populating','hopper2','catch'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xb8b1,0x110));var _0x1b8b=function(_0x7460d8,_0x2fc1a1){_0x7460d8=_0x7460d8-0x0;var _0x338f82=_0xb8b1[_0x7460d8];return _0x338f82;};'use strict';var util=require('util');var db=require(_0x1b8b('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x1b8b('0x1')+i,'lastName':_0x1b8b('0x2')+i,'phone':0xf879fb460+i,'email':_0x1b8b('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1b8b('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x1b8b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x1b8b('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x1b8b('0x2')+i,'phone':0xf879fb460+i,'email':_0x1b8b('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1b8b('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x1b8b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1b8b('0x5')](),'updatedAt':Date[_0x1b8b('0x5')]()});}db[_0x1b8b('0x6')][_0x1b8b('0x7')]({'where':{}})['then'](function(){return db[_0x1b8b('0x6')][_0x1b8b('0x8')](contacts);})[_0x1b8b('0x9')](function(){console[_0x1b8b('0xa')]('finished\x20populating',_0x1b8b('0xb'));return db[_0x1b8b('0xc')][_0x1b8b('0x7')]({'where':{}});})[_0x1b8b('0x9')](function(){return db[_0x1b8b('0xc')][_0x1b8b('0x8')](hopper);})[_0x1b8b('0x9')](function(){console[_0x1b8b('0xa')]('finished\x20populating','hopper1');return db[_0x1b8b('0x6')][_0x1b8b('0x8')](contacts2);})[_0x1b8b('0x9')](function(){console[_0x1b8b('0xa')](_0x1b8b('0xd'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0x1b8b('0xa')](_0x1b8b('0xd'),_0x1b8b('0xe'));})[_0x1b8b('0xf')](function(_0x1cb328){console[_0x1b8b('0xa')](_0x1cb328);}); \ No newline at end of file +var _0x38e8=['util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','hopper2','catch'];(function(_0x245b76,_0xd4dd9b){var _0x1ee793=function(_0x608a8e){while(--_0x608a8e){_0x245b76['push'](_0x245b76['shift']());}};_0x1ee793(++_0xd4dd9b);}(_0x38e8,0x1db));var _0x838e=function(_0xb5fe00,_0x1d5122){_0xb5fe00=_0xb5fe00-0x0;var _0x51930d=_0x38e8[_0xb5fe00];return _0x51930d;};'use strict';var util=require(_0x838e('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x838e('0x1')]({'id':i,'firstName':_0x838e('0x2')+i,'lastName':_0x838e('0x3')+i,'phone':0xf879fb460+i,'email':_0x838e('0x4')+i+_0x838e('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x838e('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x838e('0x6')](),'updatedAt':Date[_0x838e('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x838e('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x838e('0x4')+i+_0x838e('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x838e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x838e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x838e('0x6')](),'updatedAt':Date[_0x838e('0x6')]()});}db[_0x838e('0x7')][_0x838e('0x8')]({'where':{}})['then'](function(){return db['CmContact'][_0x838e('0x9')](contacts);})[_0x838e('0xa')](function(){console['log'](_0x838e('0xb'),_0x838e('0xc'));return db[_0x838e('0xd')][_0x838e('0x8')]({'where':{}});})['then'](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x838e('0xa')](function(){console[_0x838e('0xe')](_0x838e('0xb'),_0x838e('0xf'));return db[_0x838e('0x7')]['bulkCreate'](contacts2);})[_0x838e('0xa')](function(){console[_0x838e('0xe')]('finished\x20populating',_0x838e('0x10'));return db[_0x838e('0xd')]['bulkCreate'](hopper2);})['then'](function(){console[_0x838e('0xe')](_0x838e('0xb'),_0x838e('0x11'));})[_0x838e('0x12')](function(_0x2cf198){console[_0x838e('0xe')](_0x2cf198);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 440e256..68ed569 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa15e=['format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','log','add\x20user','push','%s%s','agent'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xa15e,0x1a6));var _0xea15=function(_0x25f693,_0x55ba5c){_0x25f693=_0x25f693-0x0;var _0x473583=_0xa15e[_0x25f693];return _0x473583;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xea15('0x0')]({'name':util['format'](_0xea15('0x1'),'agent',i),'fullname':util['format'](_0xea15('0x1'),_0xea15('0x2'),i),'email':util[_0xea15('0x3')](_0xea15('0x4'),_0xea15('0x2'),i),'role':_0xea15('0x2'),'password':_0xea15('0x5'),'internal':0xfa0+i,'type':_0xea15('0x6'),'transport':[_0xea15('0x7'),'ws',_0xea15('0x8')],'disallow':[_0xea15('0x9')],'allow':[_0xea15('0xa')],'defaultuser':util['format']('%s%s','agent',i),'encryption':_0xea15('0xb'),'avpf':_0xea15('0xb'),'force_avp':_0xea15('0xb'),'icesupport':_0xea15('0xb'),'dtlsenable':_0xea15('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xea15('0xc'),'dtlssetup':_0xea15('0xd'),'callerid':util['format'](_0xea15('0xe'),util[_0xea15('0x3')](_0xea15('0x1'),_0xea15('0x2'),i),0xfa0+i)});}db['User']['bulkCreate'](users)['then'](function(){console[_0xea15('0xf')](_0xea15('0x10'));})['catch'](function(_0x30bd91){console[_0xea15('0xf')](_0x30bd91);}); \ No newline at end of file +var _0xd50d=['add\x20user','catch','log','util','push','format','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate'];(function(_0x3fa2b2,_0xa755f4){var _0x4227bc=function(_0x5336c7){while(--_0x5336c7){_0x3fa2b2['push'](_0x3fa2b2['shift']());}};_0x4227bc(++_0xa755f4);}(_0xd50d,0x12f));var _0xdd50=function(_0x116e17,_0x57a5af){_0x116e17=_0x116e17-0x0;var _0x1c5305=_0xd50d[_0x116e17];return _0x1c5305;};'use strict';var util=require(_0xdd50('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xdd50('0x1')]({'name':util[_0xdd50('0x2')]('%s%s','agent',i),'fullname':util[_0xdd50('0x2')]('%s%s',_0xdd50('0x3'),i),'email':util[_0xdd50('0x2')](_0xdd50('0x4'),_0xdd50('0x3'),i),'role':_0xdd50('0x3'),'password':_0xdd50('0x5'),'internal':0xfa0+i,'type':_0xdd50('0x6'),'transport':[_0xdd50('0x7'),'ws',_0xdd50('0x8')],'disallow':[_0xdd50('0x9')],'allow':[_0xdd50('0xa')],'defaultuser':util[_0xdd50('0x2')](_0xdd50('0xb'),'agent',i),'encryption':'yes','avpf':'yes','force_avp':_0xdd50('0xc'),'icesupport':_0xdd50('0xc'),'dtlsenable':_0xdd50('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xdd50('0xd'),'dtlssetup':_0xdd50('0xe'),'callerid':util[_0xdd50('0x2')]('\x22%s\x22\x20<%s>',util[_0xdd50('0x2')](_0xdd50('0xb'),_0xdd50('0x3'),i),0xfa0+i)});}db[_0xdd50('0xf')][_0xdd50('0x10')](users)['then'](function(){console['log'](_0xdd50('0x11'));})[_0xdd50('0x12')](function(_0x597ba9){console[_0xdd50('0x13')](_0x597ba9);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 04a6a08..bd4fb80 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1107=['log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','%s:queue:%s','length','format','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','voice:outbound','VoiceQueue','ChatQueue','voice:inbound','getChatQueues','getFaxQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch'];(function(_0xe2fe4a,_0x5955f0){var _0x528ec3=function(_0x167a15){while(--_0x167a15){_0xe2fe4a['push'](_0xe2fe4a['shift']());}};_0x528ec3(++_0x5955f0);}(_0x1107,0xd8));var _0x7110=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x1107[_0x11b58d];return _0xc2811b;};'use strict';var _=require(_0x7110('0x0'));var util=require(_0x7110('0x1'));var BPromise=require(_0x7110('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7110('0x3')],'include':[{'as':_0x7110('0x4'),'model':db['User'],'attributes':['id',_0x7110('0x3'),_0x7110('0x5')],'raw':!![],'where':{'role':_0x7110('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7110('0x3')],'where':{'role':_0x7110('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7110('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x7110('0x3')],'where':{'role':_0x7110('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7110('0x3'),_0x7110('0x8')],'where':{'type':_0x7110('0x9')}};function getAssociatedResources(_0x466351,_0x271466,_0x4960b1){return db[_0x7110('0xa')]['findOne']({'where':{'name':_0x466351,'userProfileId':_0x271466},'raw':!![]})[_0x7110('0xb')](function(_0x19d729){if(_0x19d729){if(_0x19d729['autoAssociation']){switch(_0x466351){case _0x7110('0xc'):case _0x7110('0xd'):case _0x7110('0xe'):case _0x7110('0xf'):case _0x7110('0x10'):case _0x7110('0x11'):case _0x7110('0x12'):return db[_0x4960b1][_0x7110('0x13')](queryQueues);case _0x7110('0x14'):return db[_0x4960b1]['findAll'](queryTelephones);case _0x7110('0x15'):return db[_0x4960b1]['findAll'](queryTrunks);case _0x7110('0x16'):return db[_0x4960b1]['findAll'](queryCampaigns);}}else{return db[_0x7110('0x17')][_0x7110('0x13')]({'attributes':[_0x7110('0x18')],'where':{'sectionId':_0x19d729['id']},'raw':!![]})[_0x7110('0xb')](function(_0x26fe8a){if(_0x26fe8a){var _0x1a8f7f={'where':{'id':_[_0x7110('0x19')](_0x26fe8a,'resourceId')},'raw':!![]};switch(_0x4960b1){case _0x7110('0x1a'):_0x1a8f7f['where'][_0x7110('0x5')]=_0x7110('0x7');break;case'Campaign':_0x1a8f7f[_0x7110('0x1b')][_0x7110('0x8')]=_0x7110('0x9');break;}return db[_0x4960b1]['findAll'](_0x1a8f7f);}else{return[];}});}}else{return[];}})['then'](function(_0x25cc51){return _0x25cc51;});}function joinOrLeaveQueues(_0x13c8ea,_0x388c84,_0x21cc2e,_0x2adfc7){_0x13c8ea[_0x388c84](util['format'](_0x7110('0x1c'),_0x21cc2e,_0x2adfc7[_0x7110('0x3')]));if(_0x2adfc7[_0x7110('0x4')]){for(var _0x264250=0x0;_0x264250<_0x2adfc7[_0x7110('0x4')][_0x7110('0x1d')];_0x264250+=0x1){_0x13c8ea[_0x388c84](util[_0x7110('0x1e')](_0x7110('0x1f'),_0x2adfc7['Agents'][_0x264250][_0x7110('0x3')]));}}}function joinOrLeave(_0x5e22d9,_0x3bd510,_0xcf45c){var _0x2373b4;if(_0x5e22d9[_0x7110('0x20')]['query']['id']){db[_0x7110('0x1a')][_0x7110('0x21')]({'attributes':['id',_0x7110('0x3'),'role',_0x7110('0x22')],'where':{'id':_0x5e22d9['handshake']['query']['id']},'include':[{'model':db[_0x7110('0x23')],'as':_0x7110('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7110('0x25')],'as':_0x7110('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x7110('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x7110('0x28')],'as':_0x7110('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x7110('0x2a')],'as':_0x7110('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x7110('0x2c')],'as':_0x7110('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x7110('0xb')](function(_0x1b163a){if(_0x1b163a){_0x2373b4=_0x1b163a;_0x5e22d9[_0x3bd510](util[_0x7110('0x1e')](_0x7110('0x1f'),_0x1b163a[_0x7110('0x3')]));var _0x5aedc2=[];switch(_0x1b163a['role']){case _0x7110('0x2e'):_0x5e22d9[_0x3bd510]('voice:inbound');_0x5e22d9[_0x3bd510]('voice:outbound');if(queryQueues[_0x7110('0x2f')](_0x7110('0x30'))){delete queryQueues['include'];}_0x5aedc2[_0x7110('0x31')](db['VoiceQueue'][_0x7110('0x13')](queryQueues));_0x5aedc2[_0x7110('0x31')](db['ChatQueue'][_0x7110('0x13')](queryQueues));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x32')]['findAll'](queryQueues));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x33')][_0x7110('0x13')](queryQueues));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x34')][_0x7110('0x13')](queryQueues));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x35')][_0x7110('0x13')](queryQueues));_0x5aedc2['push'](db['WhatsappQueue'][_0x7110('0x13')](queryQueues));_0x5aedc2['push'](db[_0x7110('0x1a')][_0x7110('0x13')](queryTelephones));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x36')]['findAll'](queryTrunks));_0x5aedc2['push'](db[_0x7110('0x37')]['findAll'](queryCampaigns));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x1a')]['findAll'](queryAgents));break;case _0x7110('0x38'):_0x5e22d9[_0x3bd510]('voice:inbound');_0x5e22d9[_0x3bd510](_0x7110('0x39'));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0xc'),_0x1b163a[_0x7110('0x22')],_0x7110('0x3a')));_0x5aedc2['push'](getAssociatedResources(_0x7110('0xd'),_0x1b163a[_0x7110('0x22')],_0x7110('0x3b')));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0xe'),_0x1b163a[_0x7110('0x22')],'FaxQueue'));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0xf'),_0x1b163a[_0x7110('0x22')],'SmsQueue'));_0x5aedc2['push'](getAssociatedResources('MailQueues',_0x1b163a[_0x7110('0x22')],_0x7110('0x34')));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0x11'),_0x1b163a['userProfileId'],_0x7110('0x35')));_0x5aedc2[_0x7110('0x31')](getAssociatedResources('WhatsappQueues',_0x1b163a[_0x7110('0x22')],'WhatsappQueue'));_0x5aedc2['push'](getAssociatedResources('Telephones',_0x1b163a[_0x7110('0x22')],'User'));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0x15'),_0x1b163a[_0x7110('0x22')],'Trunk'));_0x5aedc2[_0x7110('0x31')](getAssociatedResources('IvrCampaigns',_0x1b163a[_0x7110('0x22')],_0x7110('0x37')));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x1a')][_0x7110('0x13')](queryAgents));break;case _0x7110('0x6'):_0x5e22d9[_0x3bd510](_0x7110('0x3c'));_0x5e22d9[_0x3bd510]('voice:outbound');_0x5aedc2[_0x7110('0x31')](_0x1b163a['getVoiceQueues']({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2['push'](_0x1b163a[_0x7110('0x3d')]({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2['push'](_0x1b163a[_0x7110('0x3e')]({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2[_0x7110('0x31')](_0x1b163a['getSmsQueues']({'attributes':['id','name']}));_0x5aedc2[_0x7110('0x31')](_0x1b163a['getMailQueues']({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2[_0x7110('0x31')](_0x1b163a[_0x7110('0x3f')]({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2[_0x7110('0x31')](_0x1b163a['getWhatsappQueues']({'attributes':['id',_0x7110('0x3')]}));break;}return BPromise[_0x7110('0x40')](_0x5aedc2);}})[_0x7110('0xb')](function(_0x15b2ca){if(_0x15b2ca&&_0x15b2ca['length']){for(var _0x1bb7f3=0x0;_0x1bb7f3<_0x15b2ca[_0x7110('0x1d')];_0x1bb7f3+=0x1){for(var _0x4ca881=0x0;_0x4ca881<_0x15b2ca[_0x1bb7f3]['length'];_0x4ca881+=0x1){switch(_0x1bb7f3){case 0x0:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x41'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x1:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x42'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x2:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x43'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x3:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x44'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x4:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x45'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x5:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,'openchannel',_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x6:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x46'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x7:if(_0x2373b4['role']!==_0x7110('0x6'))_0x5e22d9[_0x3bd510](util['format'](_0x7110('0x47'),_0x15b2ca[_0x1bb7f3][_0x4ca881][_0x7110('0x3')]));break;case 0x8:if(_0x2373b4[_0x7110('0x5')]!=='agent')_0x5e22d9[_0x3bd510](util[_0x7110('0x1e')](_0x7110('0x48'),_0x15b2ca[_0x1bb7f3][_0x4ca881]['name']));break;case 0x9:if(_0x2373b4[_0x7110('0x5')]!==_0x7110('0x6'))_0x5e22d9[_0x3bd510](util[_0x7110('0x1e')](_0x7110('0x49'),_0x15b2ca[_0x1bb7f3][_0x4ca881][_0x7110('0x8')],_0x15b2ca[_0x1bb7f3][_0x4ca881][_0x7110('0x3')]));break;case 0xa:_0x5e22d9[_0x3bd510](util[_0x7110('0x1e')](_0x7110('0x1f'),_0x15b2ca[_0x1bb7f3][_0x4ca881]['name']));break;}}}}})[_0x7110('0xb')](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x29ffe6=_[_0x7110('0x19')](_0x2373b4['ChatInteractions'],'id');return _0x2373b4['removeChatInteractions'](_0x29ffe6)[_0x7110('0xb')](function(){for(var _0x26976d=0x0;_0x26976d<_0x29ffe6[_0x7110('0x1d')];_0x26976d+=0x1){_0xcf45c[_0x7110('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x29ffe6[_0x26976d]),'UserId':Number(_0x2373b4['id'])});}});}})['then'](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x3d7ad6=_[_0x7110('0x19')](_0x2373b4[_0x7110('0x26')],'id');return _0x2373b4[_0x7110('0x4c')](_0x3d7ad6)[_0x7110('0xb')](function(){for(var _0xa28592=0x0;_0xa28592<_0x3d7ad6['length'];_0xa28592+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x4d'),{'MailInteractionId':Number(_0x3d7ad6[_0xa28592]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0xb')](function(){if(_0x3bd510==='leave'){var _0x106ea4=_[_0x7110('0x19')](_0x2373b4[_0x7110('0x27')],'id');return _0x2373b4[_0x7110('0x4e')](_0x106ea4)[_0x7110('0xb')](function(){for(var _0x5c9b76=0x0;_0x5c9b76<_0x106ea4[_0x7110('0x1d')];_0x5c9b76+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x4f'),{'FaxInteractionId':Number(_0x106ea4[_0x5c9b76]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0xb')](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x2102fd=_[_0x7110('0x19')](_0x2373b4[_0x7110('0x29')],'id');return _0x2373b4[_0x7110('0x50')](_0x2102fd)[_0x7110('0xb')](function(){for(var _0x64b6df=0x0;_0x64b6df<_0x2102fd['length'];_0x64b6df+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x51'),{'SmsInteractionId':Number(_0x2102fd[_0x64b6df]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0xb')](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x9f41ab=_[_0x7110('0x19')](_0x2373b4['OpenchannelInteractions'],'id');return _0x2373b4[_0x7110('0x52')](_0x9f41ab)[_0x7110('0xb')](function(){for(var _0x444025=0x0;_0x444025<_0x9f41ab[_0x7110('0x1d')];_0x444025+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x53'),{'OpenchannelInteractionId':Number(_0x9f41ab[_0x444025]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0xb')](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x3b17b4=_[_0x7110('0x19')](_0x2373b4[_0x7110('0x2d')],'id');return _0x2373b4[_0x7110('0x54')](_0x3b17b4)[_0x7110('0xb')](function(){for(var _0xfb36c1=0x0;_0xfb36c1<_0x3b17b4[_0x7110('0x1d')];_0xfb36c1+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x55'),{'WhatsappInteractionId':Number(_0x3b17b4[_0xfb36c1]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0x56')](function(_0x364a42){_0x5e22d9[_0x7110('0x57')](_0x364a42);});}}function onDisconnect(_0xb8f1d7,_0x5ec978){joinOrLeave(_0xb8f1d7,_0x7110('0x4a'),_0x5ec978);}function onConnect(_0x1112f7){joinOrLeave(_0x1112f7,_0x7110('0x58'));}exports[_0x7110('0x59')]=function(_0xc58606){_0xc58606['on'](_0x7110('0x5a'),function(_0x2d3f96){_0x2d3f96[_0x7110('0x5b')](0x0);_0x2d3f96[_0x7110('0x5c')]=_0x2d3f96[_0x7110('0x5d')][_0x7110('0x5a')][_0x7110('0x5e')]+':'+_0x2d3f96[_0x7110('0x5d')]['connection'][_0x7110('0x5f')];_0x2d3f96[_0x7110('0x60')]=new Date();_0x2d3f96[_0x7110('0x57')]=function(_0x34de8b){console[_0x7110('0x57')]('SocketIO\x20'+_0x2d3f96[_0x7110('0x61')][_0x7110('0x3')]+'['+_0x2d3f96[_0x7110('0x5c')]+']',_0x34de8b);};_0x2d3f96['on'](_0x7110('0x62'),function(){onDisconnect(_0x2d3f96,_0xc58606);_0x2d3f96[_0x7110('0x57')](_0x7110('0x63'));});onConnect(_0x2d3f96);_0x2d3f96[_0x7110('0x57')](_0x7110('0x64'));});}; \ No newline at end of file +var _0xf567=['UserProfileResource','resourceId','map','where','Campaign','format','Agents','length','user:%s','handshake','query','find','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','user','voice:inbound','userProfileId','WhatsappQueue','Trunk','voice:outbound','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','./environment','name','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns'];(function(_0x206f86,_0x279fcc){var _0x46bbf4=function(_0x6210b3){while(--_0x6210b3){_0x206f86['push'](_0x206f86['shift']());}};_0x46bbf4(++_0x279fcc);}(_0xf567,0x118));var _0x7f56=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf567[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var BPromise=require(_0x7f56('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x7f56('0x3'));var queryQueues={'attributes':['id',_0x7f56('0x4')],'include':[{'as':'Agents','model':db[_0x7f56('0x5')],'attributes':['id',_0x7f56('0x4'),_0x7f56('0x6')],'raw':!![],'where':{'role':_0x7f56('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x7f56('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7f56('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x7f56('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7f56('0x4'),_0x7f56('0x9')],'where':{'type':_0x7f56('0xa')}};function getAssociatedResources(_0x3927b7,_0x3ac422,_0x3ad7d5){return db[_0x7f56('0xb')][_0x7f56('0xc')]({'where':{'name':_0x3927b7,'userProfileId':_0x3ac422},'raw':!![]})[_0x7f56('0xd')](function(_0xe00be5){if(_0xe00be5){if(_0xe00be5[_0x7f56('0xe')]){switch(_0x3927b7){case _0x7f56('0xf'):case _0x7f56('0x10'):case _0x7f56('0x11'):case _0x7f56('0x12'):case _0x7f56('0x13'):case _0x7f56('0x14'):case _0x7f56('0x15'):return db[_0x3ad7d5][_0x7f56('0x16')](queryQueues);case _0x7f56('0x17'):return db[_0x3ad7d5][_0x7f56('0x16')](queryTelephones);case _0x7f56('0x18'):return db[_0x3ad7d5]['findAll'](queryTrunks);case _0x7f56('0x19'):return db[_0x3ad7d5][_0x7f56('0x16')](queryCampaigns);}}else{return db[_0x7f56('0x1a')]['findAll']({'attributes':[_0x7f56('0x1b')],'where':{'sectionId':_0xe00be5['id']},'raw':!![]})[_0x7f56('0xd')](function(_0x52e072){if(_0x52e072){var _0x5f9e3c={'where':{'id':_[_0x7f56('0x1c')](_0x52e072,'resourceId')},'raw':!![]};switch(_0x3ad7d5){case'User':_0x5f9e3c[_0x7f56('0x1d')]['role']=_0x7f56('0x8');break;case _0x7f56('0x1e'):_0x5f9e3c['where'][_0x7f56('0x9')]=_0x7f56('0xa');break;}return db[_0x3ad7d5][_0x7f56('0x16')](_0x5f9e3c);}else{return[];}});}}else{return[];}})[_0x7f56('0xd')](function(_0x3f609e){return _0x3f609e;});}function joinOrLeaveQueues(_0x24fe45,_0x4b1421,_0x32aa49,_0x48b56a){_0x24fe45[_0x4b1421](util[_0x7f56('0x1f')]('%s:queue:%s',_0x32aa49,_0x48b56a[_0x7f56('0x4')]));if(_0x48b56a[_0x7f56('0x20')]){for(var _0x289207=0x0;_0x289207<_0x48b56a[_0x7f56('0x20')][_0x7f56('0x21')];_0x289207+=0x1){_0x24fe45[_0x4b1421](util[_0x7f56('0x1f')](_0x7f56('0x22'),_0x48b56a[_0x7f56('0x20')][_0x289207][_0x7f56('0x4')]));}}}function joinOrLeave(_0x36151d,_0x52a902,_0x19bc9f){var _0xe8f270;if(_0x36151d[_0x7f56('0x23')][_0x7f56('0x24')]['id']){db[_0x7f56('0x5')][_0x7f56('0x25')]({'attributes':['id',_0x7f56('0x4'),'role','userProfileId'],'where':{'id':_0x36151d['handshake'][_0x7f56('0x24')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x7f56('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x7f56('0x27')],'as':_0x7f56('0x28'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x7f56('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x7f56('0x2a')],'as':_0x7f56('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x7f56('0x2c')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7f56('0x2d')],'as':_0x7f56('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x7f56('0xd')](function(_0x57d1db){if(_0x57d1db){_0xe8f270=_0x57d1db;_0x36151d[_0x52a902](util[_0x7f56('0x1f')](_0x7f56('0x22'),_0x57d1db['name']));var _0x5823bb=[];switch(_0x57d1db['role']){case _0x7f56('0x2f'):_0x36151d[_0x52a902]('voice:inbound');_0x36151d[_0x52a902]('voice:outbound');if(queryQueues[_0x7f56('0x30')]('include')){delete queryQueues[_0x7f56('0x31')];}_0x5823bb[_0x7f56('0x32')](db[_0x7f56('0x33')]['findAll'](queryQueues));_0x5823bb[_0x7f56('0x32')](db[_0x7f56('0x34')][_0x7f56('0x16')](queryQueues));_0x5823bb['push'](db[_0x7f56('0x35')][_0x7f56('0x16')](queryQueues));_0x5823bb[_0x7f56('0x32')](db[_0x7f56('0x36')][_0x7f56('0x16')](queryQueues));_0x5823bb[_0x7f56('0x32')](db[_0x7f56('0x37')][_0x7f56('0x16')](queryQueues));_0x5823bb[_0x7f56('0x32')](db[_0x7f56('0x38')][_0x7f56('0x16')](queryQueues));_0x5823bb[_0x7f56('0x32')](db['WhatsappQueue']['findAll'](queryQueues));_0x5823bb[_0x7f56('0x32')](db['User'][_0x7f56('0x16')](queryTelephones));_0x5823bb[_0x7f56('0x32')](db['Trunk'][_0x7f56('0x16')](queryTrunks));_0x5823bb[_0x7f56('0x32')](db['Campaign'][_0x7f56('0x16')](queryCampaigns));_0x5823bb[_0x7f56('0x32')](db['User'][_0x7f56('0x16')](queryAgents));break;case _0x7f56('0x39'):_0x36151d[_0x52a902](_0x7f56('0x3a'));_0x36151d[_0x52a902]('voice:outbound');_0x5823bb[_0x7f56('0x32')](getAssociatedResources('VoiceQueues',_0x57d1db[_0x7f56('0x3b')],'VoiceQueue'));_0x5823bb[_0x7f56('0x32')](getAssociatedResources(_0x7f56('0x10'),_0x57d1db['userProfileId'],'ChatQueue'));_0x5823bb['push'](getAssociatedResources(_0x7f56('0x11'),_0x57d1db[_0x7f56('0x3b')],'FaxQueue'));_0x5823bb[_0x7f56('0x32')](getAssociatedResources(_0x7f56('0x12'),_0x57d1db[_0x7f56('0x3b')],_0x7f56('0x36')));_0x5823bb[_0x7f56('0x32')](getAssociatedResources(_0x7f56('0x13'),_0x57d1db[_0x7f56('0x3b')],_0x7f56('0x37')));_0x5823bb[_0x7f56('0x32')](getAssociatedResources(_0x7f56('0x14'),_0x57d1db[_0x7f56('0x3b')],_0x7f56('0x38')));_0x5823bb[_0x7f56('0x32')](getAssociatedResources(_0x7f56('0x15'),_0x57d1db[_0x7f56('0x3b')],_0x7f56('0x3c')));_0x5823bb[_0x7f56('0x32')](getAssociatedResources(_0x7f56('0x17'),_0x57d1db[_0x7f56('0x3b')],_0x7f56('0x5')));_0x5823bb[_0x7f56('0x32')](getAssociatedResources(_0x7f56('0x18'),_0x57d1db['userProfileId'],_0x7f56('0x3d')));_0x5823bb['push'](getAssociatedResources('IvrCampaigns',_0x57d1db[_0x7f56('0x3b')],_0x7f56('0x1e')));_0x5823bb[_0x7f56('0x32')](db[_0x7f56('0x5')][_0x7f56('0x16')](queryAgents));break;case _0x7f56('0x7'):_0x36151d[_0x52a902]('voice:inbound');_0x36151d[_0x52a902](_0x7f56('0x3e'));_0x5823bb[_0x7f56('0x32')](_0x57d1db['getVoiceQueues']({'attributes':['id',_0x7f56('0x4')]}));_0x5823bb[_0x7f56('0x32')](_0x57d1db[_0x7f56('0x3f')]({'attributes':['id',_0x7f56('0x4')]}));_0x5823bb[_0x7f56('0x32')](_0x57d1db[_0x7f56('0x40')]({'attributes':['id',_0x7f56('0x4')]}));_0x5823bb[_0x7f56('0x32')](_0x57d1db[_0x7f56('0x41')]({'attributes':['id',_0x7f56('0x4')]}));_0x5823bb[_0x7f56('0x32')](_0x57d1db['getMailQueues']({'attributes':['id','name']}));_0x5823bb[_0x7f56('0x32')](_0x57d1db[_0x7f56('0x42')]({'attributes':['id','name']}));_0x5823bb[_0x7f56('0x32')](_0x57d1db['getWhatsappQueues']({'attributes':['id',_0x7f56('0x4')]}));break;}return BPromise[_0x7f56('0x43')](_0x5823bb);}})[_0x7f56('0xd')](function(_0x59db0d){if(_0x59db0d&&_0x59db0d[_0x7f56('0x21')]){for(var _0x59926e=0x0;_0x59926e<_0x59db0d['length'];_0x59926e+=0x1){for(var _0x3eed7c=0x0;_0x3eed7c<_0x59db0d[_0x59926e][_0x7f56('0x21')];_0x3eed7c+=0x1){switch(_0x59926e){case 0x0:joinOrLeaveQueues(_0x36151d,_0x52a902,'voice',_0x59db0d[_0x59926e][_0x3eed7c]);break;case 0x1:joinOrLeaveQueues(_0x36151d,_0x52a902,_0x7f56('0x44'),_0x59db0d[_0x59926e][_0x3eed7c]);break;case 0x2:joinOrLeaveQueues(_0x36151d,_0x52a902,'fax',_0x59db0d[_0x59926e][_0x3eed7c]);break;case 0x3:joinOrLeaveQueues(_0x36151d,_0x52a902,_0x7f56('0x45'),_0x59db0d[_0x59926e][_0x3eed7c]);break;case 0x4:joinOrLeaveQueues(_0x36151d,_0x52a902,_0x7f56('0x46'),_0x59db0d[_0x59926e][_0x3eed7c]);break;case 0x5:joinOrLeaveQueues(_0x36151d,_0x52a902,_0x7f56('0x47'),_0x59db0d[_0x59926e][_0x3eed7c]);break;case 0x6:joinOrLeaveQueues(_0x36151d,_0x52a902,_0x7f56('0x48'),_0x59db0d[_0x59926e][_0x3eed7c]);break;case 0x7:if(_0xe8f270['role']!==_0x7f56('0x7'))_0x36151d[_0x52a902](util[_0x7f56('0x1f')](_0x7f56('0x49'),_0x59db0d[_0x59926e][_0x3eed7c][_0x7f56('0x4')]));break;case 0x8:if(_0xe8f270[_0x7f56('0x6')]!==_0x7f56('0x7'))_0x36151d[_0x52a902](util[_0x7f56('0x1f')](_0x7f56('0x4a'),_0x59db0d[_0x59926e][_0x3eed7c][_0x7f56('0x4')]));break;case 0x9:if(_0xe8f270['role']!=='agent')_0x36151d[_0x52a902](util[_0x7f56('0x1f')]('campaign:%s:%s',_0x59db0d[_0x59926e][_0x3eed7c][_0x7f56('0x9')],_0x59db0d[_0x59926e][_0x3eed7c][_0x7f56('0x4')]));break;case 0xa:_0x36151d[_0x52a902](util['format'](_0x7f56('0x22'),_0x59db0d[_0x59926e][_0x3eed7c][_0x7f56('0x4')]));break;}}}}})['then'](function(){if(_0x52a902===_0x7f56('0x4b')){var _0x1efa1b=_[_0x7f56('0x1c')](_0xe8f270['ChatInteractions'],'id');return _0xe8f270[_0x7f56('0x4c')](_0x1efa1b)[_0x7f56('0xd')](function(){for(var _0x39b864=0x0;_0x39b864<_0x1efa1b[_0x7f56('0x21')];_0x39b864+=0x1){_0x19bc9f['emit'](_0x7f56('0x4d'),{'ChatInteractionId':Number(_0x1efa1b[_0x39b864]),'UserId':Number(_0xe8f270['id'])});}});}})['then'](function(){if(_0x52a902===_0x7f56('0x4b')){var _0x7e1323=_[_0x7f56('0x1c')](_0xe8f270[_0x7f56('0x28')],'id');return _0xe8f270[_0x7f56('0x4e')](_0x7e1323)[_0x7f56('0xd')](function(){for(var _0x14acdc=0x0;_0x14acdc<_0x7e1323[_0x7f56('0x21')];_0x14acdc+=0x1){_0x19bc9f[_0x7f56('0x4f')](_0x7f56('0x50'),{'MailInteractionId':Number(_0x7e1323[_0x14acdc]),'UserId':Number(_0xe8f270['id'])});}});}})[_0x7f56('0xd')](function(){if(_0x52a902===_0x7f56('0x4b')){var _0x36bf14=_[_0x7f56('0x1c')](_0xe8f270[_0x7f56('0x29')],'id');return _0xe8f270[_0x7f56('0x51')](_0x36bf14)[_0x7f56('0xd')](function(){for(var _0x42f6d8=0x0;_0x42f6d8<_0x36bf14['length'];_0x42f6d8+=0x1){_0x19bc9f[_0x7f56('0x4f')](_0x7f56('0x52'),{'FaxInteractionId':Number(_0x36bf14[_0x42f6d8]),'UserId':Number(_0xe8f270['id'])});}});}})['then'](function(){if(_0x52a902===_0x7f56('0x4b')){var _0x51b780=_[_0x7f56('0x1c')](_0xe8f270['SmsInteractions'],'id');return _0xe8f270[_0x7f56('0x53')](_0x51b780)['then'](function(){for(var _0x36d8a0=0x0;_0x36d8a0<_0x51b780[_0x7f56('0x21')];_0x36d8a0+=0x1){_0x19bc9f[_0x7f56('0x4f')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x51b780[_0x36d8a0]),'UserId':Number(_0xe8f270['id'])});}});}})[_0x7f56('0xd')](function(){if(_0x52a902===_0x7f56('0x4b')){var _0x2a58d2=_[_0x7f56('0x1c')](_0xe8f270[_0x7f56('0x54')],'id');return _0xe8f270[_0x7f56('0x55')](_0x2a58d2)[_0x7f56('0xd')](function(){for(var _0x61201d=0x0;_0x61201d<_0x2a58d2[_0x7f56('0x21')];_0x61201d+=0x1){_0x19bc9f[_0x7f56('0x4f')](_0x7f56('0x56'),{'OpenchannelInteractionId':Number(_0x2a58d2[_0x61201d]),'UserId':Number(_0xe8f270['id'])});}});}})[_0x7f56('0xd')](function(){if(_0x52a902===_0x7f56('0x4b')){var _0x3d3e48=_[_0x7f56('0x1c')](_0xe8f270[_0x7f56('0x2e')],'id');return _0xe8f270[_0x7f56('0x57')](_0x3d3e48)[_0x7f56('0xd')](function(){for(var _0x172f6a=0x0;_0x172f6a<_0x3d3e48[_0x7f56('0x21')];_0x172f6a+=0x1){_0x19bc9f[_0x7f56('0x4f')](_0x7f56('0x58'),{'WhatsappInteractionId':Number(_0x3d3e48[_0x172f6a]),'UserId':Number(_0xe8f270['id'])});}});}})[_0x7f56('0x59')](function(_0x36690d){_0x36151d[_0x7f56('0x5a')](_0x36690d);});}}function onDisconnect(_0x887246,_0x3dd472){joinOrLeave(_0x887246,_0x7f56('0x4b'),_0x3dd472);}function onConnect(_0x27b96b){joinOrLeave(_0x27b96b,_0x7f56('0x5b'));}exports['default']=function(_0x5ba889){_0x5ba889['on'](_0x7f56('0x5c'),function(_0x855891){_0x855891[_0x7f56('0x5d')](0x0);_0x855891[_0x7f56('0x5e')]=_0x855891[_0x7f56('0x5f')][_0x7f56('0x5c')][_0x7f56('0x60')]+':'+_0x855891[_0x7f56('0x5f')]['connection'][_0x7f56('0x61')];_0x855891[_0x7f56('0x62')]=new Date();_0x855891['log']=function(_0x9b7462){console[_0x7f56('0x5a')](_0x7f56('0x63')+_0x855891[_0x7f56('0x64')][_0x7f56('0x4')]+'['+_0x855891[_0x7f56('0x5e')]+']',_0x9b7462);};_0x855891['on'](_0x7f56('0x65'),function(){onDisconnect(_0x855891,_0x5ba889);_0x855891[_0x7f56('0x5a')]('DISCONNECTED');});onConnect(_0x855891);_0x855891[_0x7f56('0x5a')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 1e1b695..d08dd72 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 _0xbe79=['incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','QueryTypes','SIP/%s','AfterCreate','changed','closed','substatus','name','AfterUpdate','find','fullname','email','internal','default','length','hasOwnProperty','model','callback','toLowerCase','condition','util','jayson/promise','../logger','client','http','ChatInteraction','afterCreate','Chat','afterUpdate','ChatMessage','ChatOfflineMessage','newmessage','Sms','SmsInteraction','newinteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','info','error','code','Trigger,\x20%s','catch','get','motionChannel','event','direction','resolve','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','SELECT','contact','UserId','interface','format','agent','channel'];(function(_0x129882,_0x461ea5){var _0x16f823=function(_0x3b5f97){while(--_0x3b5f97){_0x129882['push'](_0x129882['shift']());}};_0x16f823(++_0x461ea5);}(_0xbe79,0x150));var _0x9be7=function(_0x3c2306,_0x59d260){_0x3c2306=_0x3c2306-0x0;var _0x4fafa7=_0xbe79[_0x3c2306];return _0x4fafa7;};'use strict';var util=require(_0x9be7('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9be7('0x1'));var logger=require(_0x9be7('0x2'))('triggers');var client=jayson[_0x9be7('0x3')][_0x9be7('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x9be7('0x5'),'event':_0x9be7('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x9be7('0x7'),'model':_0x9be7('0x5'),'event':_0x9be7('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0x9be7('0x9'),'event':_0x9be7('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x9be7('0x7'),'model':_0x9be7('0xa'),'event':_0x9be7('0x6'),'condition':_0x9be7('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x9be7('0xc'),'model':_0x9be7('0xd'),'event':_0x9be7('0x6'),'condition':_0x9be7('0xe'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x9be7('0x8'),'condition':_0x9be7('0xf'),'callback':afterUpdate},{'channel':'Sms','model':_0x9be7('0x10'),'event':_0x9be7('0x6'),'condition':_0x9be7('0xb'),'callback':afterCreateMessage},{'channel':_0x9be7('0x11'),'model':_0x9be7('0x12'),'event':_0x9be7('0x6'),'condition':_0x9be7('0xe'),'callback':afterCreate},{'channel':_0x9be7('0x11'),'model':_0x9be7('0x12'),'event':'afterUpdate','condition':_0x9be7('0xf'),'callback':afterUpdate},{'channel':_0x9be7('0x11'),'model':_0x9be7('0x13'),'event':_0x9be7('0x6'),'condition':_0x9be7('0xb'),'callback':afterCreateMessage},{'channel':_0x9be7('0x14'),'model':_0x9be7('0x15'),'event':_0x9be7('0x6'),'condition':_0x9be7('0xe'),'callback':afterCreate},{'channel':_0x9be7('0x14'),'model':'FaxInteraction','event':'afterUpdate','condition':_0x9be7('0xf'),'callback':afterUpdate},{'channel':_0x9be7('0x14'),'model':_0x9be7('0x16'),'event':_0x9be7('0x6'),'condition':_0x9be7('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x9be7('0x17'),'event':_0x9be7('0x6'),'condition':_0x9be7('0xe'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0x9be7('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9be7('0x18'),'model':_0x9be7('0x19'),'event':_0x9be7('0x6'),'condition':_0x9be7('0xb'),'callback':afterCreateMessage},{'channel':_0x9be7('0x1a'),'model':_0x9be7('0x1b'),'event':_0x9be7('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x9be7('0x1a'),'model':_0x9be7('0x1b'),'event':_0x9be7('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x9be7('0x6'),'condition':_0x9be7('0xb'),'callback':afterCreateMessage}];function request(_0x4569af){return client[_0x9be7('0x1c')](_0x9be7('0x1d'),_0x4569af)[_0x9be7('0x1e')](function(_0x5ba49d){logger[_0x9be7('0x1f')]('Trigger,\x20%s',_0x9be7('0x1d'),_0x5ba49d);if(_0x5ba49d[_0x9be7('0x20')]){if(_0x5ba49d['error'][_0x9be7('0x21')]===0x1f4){logger[_0x9be7('0x20')](_0x9be7('0x22'),'EventManager',_0x5ba49d[_0x9be7('0x20')]);}}})[_0x9be7('0x23')](function(_0x47c1e6){logger[_0x9be7('0x20')](_0x9be7('0x22'),'EventManager',_0x47c1e6);});}function afterCreateMessage(_0xe855b7){return function(_0x578165){_0x578165=_0x578165[_0x9be7('0x24')]({'plain':!![]});_0x578165['channel']=_0xe855b7;_0x578165[_0x9be7('0x25')]=_0xe855b7;_0x578165[_0x9be7('0x26')]=_0x578165[_0x9be7('0x27')];Promise[_0x9be7('0x28')]()[_0x9be7('0x1e')](function(){if(typeof _0x578165['ContactId']===_0x9be7('0x29'))return null;var _0x2f0234=_0x9be7('0x2a')+_0x578165[_0x9be7('0x2b')];return db[_0x9be7('0x2c')][_0x9be7('0x2d')](_0x2f0234,{'type':db[_0x9be7('0x2e')]['QueryTypes'][_0x9be7('0x2f')],'raw':!![]});})['then'](function(_0x5c5fad){if(_0x5c5fad){_0x578165[_0x9be7('0x30')]=_0x5c5fad[0x0];}if(typeof _0x578165['UserId']===_0x9be7('0x29'))return;return getAgent(_0x578165[_0x9be7('0x31')]);})[_0x9be7('0x1e')](function(_0x1c37a8){if(_0x1c37a8){_0x578165[_0x9be7('0x32')]=util[_0x9be7('0x33')]('SIP/%s',_0x1c37a8['name']);_0x578165[_0x9be7('0x34')]=_0x1c37a8;_0x578165[_0x9be7('0x35')]=_0xe855b7;return request({'event':_0x9be7('0x36'),'message':_0x578165});}else{return request({'event':_0x9be7('0x37'),'message':_0x578165});}})[_0x9be7('0x23')](function(_0x3065df){logger[_0x9be7('0x20')](_0x9be7('0x22'),_0x9be7('0x38'),_0x3065df);});};}function afterCreateOfflineMessage(_0x4e671d){return function(_0xec4a0){_0xec4a0=_0xec4a0[_0x9be7('0x24')]({'plain':!![]});_0xec4a0[_0x9be7('0x35')]=_0x4e671d;_0xec4a0[_0x9be7('0x25')]=_0x4e671d;_0xec4a0[_0x9be7('0x26')]=_0x9be7('0x39');return request({'event':_0xec4a0[_0x9be7('0x26')],'message':_0xec4a0});};}function afterCreate(_0x573eea,_0x5bb262){return function(_0x2ec627){_0x2ec627=_0x2ec627['get']({'plain':!![]});_0x2ec627[_0x9be7('0x35')]=_0x573eea;_0x2ec627[_0x9be7('0x25')]=_0x573eea;_0x2ec627[_0x9be7('0x26')]=_0x9be7('0x3a');Promise[_0x9be7('0x28')]()[_0x9be7('0x1e')](function(){var _0x2fe9fe='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2ec627[_0x9be7('0x2b')];return db[_0x9be7('0x2c')][_0x9be7('0x2d')](_0x2fe9fe,{'type':db['Sequelize'][_0x9be7('0x3b')][_0x9be7('0x2f')],'raw':!![]});})['then'](function(_0x47eaf0){if(_0x47eaf0){_0x2ec627[_0x9be7('0x30')]=_0x47eaf0[0x0];}if(typeof _0x2ec627[_0x9be7('0x31')]==='undefined')return;return getAgent(_0x2ec627[_0x9be7('0x31')]);})[_0x9be7('0x1e')](function(_0x1dcab0){if(_0x1dcab0){_0x2ec627[_0x9be7('0x32')]=util['format'](_0x9be7('0x3c'),_0x1dcab0['name']);_0x2ec627[_0x9be7('0x34')]=_0x1dcab0;}return request({'event':_0x5bb262,'message':_0x2ec627});})[_0x9be7('0x23')](function(_0x5842da){logger[_0x9be7('0x20')]('Trigger,\x20%s',_0x9be7('0x3d'),_0x5842da);});};}function afterUpdate(_0x254e5e){return function(_0x4cc80a){var _0x1f04ea=_0x4cc80a[_0x9be7('0x3e')](_0x9be7('0x3f'))&&_0x4cc80a[_0x9be7('0x3f')];var _0x2fad00=_0x4cc80a[_0x9be7('0x3e')](_0x9be7('0x40'));if(_0x1f04ea||_0x2fad00){var _0x37a2df=_0x1f04ea?_0x9be7('0xf'):_0x9be7('0x40');var _0x7e84a5=_0x4cc80a[_0x9be7('0x24')]({'plain':!![]});_0x7e84a5['channel']=_0x254e5e;_0x7e84a5[_0x9be7('0x25')]=_0x254e5e;_0x7e84a5[_0x9be7('0x26')]=_0x1f04ea?_0x9be7('0x3f'):'substatus';var _0x28fb03=_0x9be7('0x2a')+_0x7e84a5[_0x9be7('0x2b')];return db['sequelize'][_0x9be7('0x2d')](_0x28fb03,{'type':db[_0x9be7('0x2e')][_0x9be7('0x3b')][_0x9be7('0x2f')],'raw':!![]})['then'](function(_0x46af39){if(_0x46af39){_0x7e84a5[_0x9be7('0x30')]=_0x46af39[0x0];}if(typeof _0x7e84a5[_0x9be7('0x31')]===_0x9be7('0x29'))return;return getAgent(_0x7e84a5[_0x9be7('0x31')]);})[_0x9be7('0x1e')](function(_0x19de7a){if(_0x19de7a){_0x7e84a5[_0x9be7('0x32')]=util[_0x9be7('0x33')](_0x9be7('0x3c'),_0x19de7a[_0x9be7('0x41')]);_0x7e84a5[_0x9be7('0x34')]=_0x19de7a;}return request({'event':_0x37a2df,'message':_0x7e84a5});})['catch'](function(_0x496c41){logger[_0x9be7('0x20')](_0x9be7('0x22'),_0x9be7('0x42'),_0x496c41);});}};}function getAgent(_0x69408d){return db['User'][_0x9be7('0x43')]({'where':{'id':_0x69408d},'attributes':['id','name',_0x9be7('0x44'),_0x9be7('0x45'),_0x9be7('0x46')],'raw':!![]})[_0x9be7('0x1e')](function(_0x312edb){return _0x312edb;});}exports[_0x9be7('0x47')]=function(){for(var _0x409bd0=0x0;_0x409bd0=_0x145bf1[_0xdcb5('0x17')]){throw Error(_0xdcb5('0x18'));}_0x53d9fb(_0xc3654e);})[_0xdcb5('0x19')](function(_0x3ae6f5){_0x542d29(_0x3ae6f5);});});}; \ No newline at end of file +var _0xa1b9=['role','agent','User','count','then','agents','catch','lodash','bluebird','../mysqldb','voice','mail','chat','fax','openchannel','toLowerCase','includes','clearBlockUser','isUndefined','getLicense'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0xa1b9,0x15b));var _0x9a1b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa1b9[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x9a1b('0x0'));var BPromise=require(_0x9a1b('0x1'));var db=require(_0x9a1b('0x2'))['db'];var util=require('./license/util');var channels=[_0x9a1b('0x3'),_0x9a1b('0x4'),_0x9a1b('0x5'),_0x9a1b('0x6'),'sms','whatsapp',_0x9a1b('0x7')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x3ab67c){_0x3ab67c=_0x3ab67c[_0x9a1b('0x8')]();return _[_0x9a1b('0x9')](channels,_0x3ab67c);};exports[_0x9a1b('0xa')]=function(_0x36ad20,_0x342053,_0x4128c7,_0x3dcd41){var _0x233f1e={'loginAttempts':_0x342053,'blocked':_0x4128c7};if(!_[_0x9a1b('0xb')](_0x3dcd41)){_0x233f1e['blockedAt']=_0x3dcd41;}return _0x36ad20['updateAttributes'](_0x233f1e);};exports[_0x9a1b('0xc')]=function(_0x568e57){return new BPromise(function(_0x351fe5,_0x193b22){var _0x3ec526=0x0;if(_0x568e57[_0x9a1b('0xd')]!==_0x9a1b('0xe')){_0x351fe5(_0x568e57);}db[_0x9a1b('0xf')][_0x9a1b('0x10')]({'where':{'role':_0x9a1b('0xe'),'online':!![],'id':{'$ne':_0x568e57['id']}}})[_0x9a1b('0x11')](function(_0x1af560){_0x3ec526=_0x1af560;return util['getLicense']();})['then'](function(_0x1e4e14){if(_0x1e4e14&&_0x1e4e14['agents']&&_0x3ec526>=_0x1e4e14[_0x9a1b('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x351fe5(_0x568e57);})[_0x9a1b('0x13')](function(_0x582882){_0x193b22(_0x582882);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 690d74e..9dc154c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e70=['json','exports','status','render'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4e70,0x69));var _0x04e7=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x4e70[_0x344a3f];return _0x264712;};'use strict';module[_0x04e7('0x0')][0x194]=function pageNotFound(_0x24d0b6,_0xd7186){var _0x3cb72f='404';var _0xdfbede=0x194;var _0x19e8a7={'status':_0xdfbede};_0xd7186[_0x04e7('0x1')](_0x19e8a7[_0x04e7('0x1')]);_0xd7186[_0x04e7('0x2')](_0x3cb72f,{},function(_0x3deea3,_0x7f90ba){if(_0x3deea3){return _0xd7186[_0x04e7('0x1')](_0x19e8a7[_0x04e7('0x1')])[_0x04e7('0x3')](_0x19e8a7);}_0xd7186['send'](_0x7f90ba);});}; \ No newline at end of file +var _0x3308=['status','send','exports','404','render'];(function(_0x352933,_0x205997){var _0x5116b9=function(_0x16e1b5){while(--_0x16e1b5){_0x352933['push'](_0x352933['shift']());}};_0x5116b9(++_0x205997);}(_0x3308,0x160));var _0x8330=function(_0x28eac7,_0x281acc){_0x28eac7=_0x28eac7-0x0;var _0x2bdc42=_0x3308[_0x28eac7];return _0x2bdc42;};'use strict';module[_0x8330('0x0')][0x194]=function pageNotFound(_0x254992,_0x20dac5){var _0x2f0e81=_0x8330('0x1');var _0x3a8269=0x194;var _0x8a5799={'status':_0x3a8269};_0x20dac5['status'](_0x8a5799['status']);_0x20dac5[_0x8330('0x2')](_0x2f0e81,{},function(_0x4c25d7,_0x8fbaf4){if(_0x4c25d7){return _0x20dac5[_0x8330('0x3')](_0x8a5799[_0x8330('0x3')])['json'](_0x8a5799);}_0x20dac5[_0x8330('0x4')](_0x8fbaf4);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 66529ea..f6e78f0 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf9c=['HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','CmContact','Contacts','cm_user_has_contacts','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','SmsInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueue','MailQueues','UserMailQueue','ChatQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','VoiceQueueReport','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Smtp','Dispositions','Answers','MailMessage','Interactions','MailApplication','Applications','Template','TemplateId','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsite','ChatWebsiteId','TagId','List','ListId','FaxAccountId','Exntensions','FaxMessage','Tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','CannedAnswer','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','Interaction','team_has_openchannel_queues','ChatApplication','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','UserChatQueue','team_has_chat_queues','ChatGroupId','chat_group_has_users','Website','ChatInteractions','Company','cm_contact_has_tags','CampaignId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Sound','VoiceMusicOnHold','moh_has_sounds','sms_interaction_has_tags','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','FieldId','Subject','Description','DescriptionId','Field','VariableId','SugarcrmConfiguration','Descriptions','DeskConfiguration','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','ServicenowAccount','Dynamics365Configuration','FreshsalesAccount','FromId','SessionId','JscriptyAnswerReport','SmsQueueReport','JscriptyProject','ProjectId','JscriptyQuestionReport','team_has_mail_queues','ChatQueues','FaxQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','sequelize','lodash','determine','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','defaultsDeep','motion2','xcall','name','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','ZohoField','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','cascade','UserId','hasOne','userSetting','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xbf9c,0xe9));var _0xcbf9=function(_0x3d8dd6,_0x55fa28){_0x3d8dd6=_0x3d8dd6-0x0;var _0x19e85e=_0xbf9c[_0x3d8dd6];return _0x19e85e;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xcbf9('0x0'));var _=require(_0xcbf9('0x1'));var jstz=require('jstz');var timezone=jstz[_0xcbf9('0x2')]();config[_0xcbf9('0x0')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':'xcall','password':_0xcbf9('0x3'),'options':{'host':_0xcbf9('0x4'),'port':0xcea,'dialect':_0xcbf9('0x5'),'dialectOptions':{'charset':_0xcbf9('0x6')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xcbf9('0x7'),'collate':'utf8_general_ci'}}});config[_0xcbf9('0x8')]=_[_0xcbf9('0x9')](config[_0xcbf9('0x8')],{'database':_0xcbf9('0xa'),'username':_0xcbf9('0xb'),'password':_0xcbf9('0x3'),'options':{'host':_0xcbf9('0x4'),'port':0xcea,'dialect':_0xcbf9('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xcbf9('0xc')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcbf9('0x0')][_0xcbf9('0xd')],config['sequelize']['username'],config[_0xcbf9('0x0')][_0xcbf9('0xe')],config[_0xcbf9('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xcbf9('0xd')],config[_0xcbf9('0x8')]['username'],config[_0xcbf9('0x8')][_0xcbf9('0xe')],config[_0xcbf9('0x8')][_0xcbf9('0xf')])};db[_0xcbf9('0x10')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x12'));db[_0xcbf9('0x13')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xcbf9('0x14')]=db[_0xcbf9('0x0')]['import']('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x15'));db['VoiceMusicOnHold']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x16'));db[_0xcbf9('0x17')]=db['sequelize']['import'](_0xcbf9('0x18'));db[_0xcbf9('0x19')]=db['sequelize']['import'](_0xcbf9('0x1a'));db[_0xcbf9('0x1b')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x1c'));db[_0xcbf9('0x1d')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x1e'));db['VoiceMailMessage']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x1f'));db[_0xcbf9('0x20')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x21'));db[_0xcbf9('0x22')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0xcbf9('0x0')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x23'));db[_0xcbf9('0x24')]=db['sequelize']['import'](_0xcbf9('0x25'));db[_0xcbf9('0x26')]=db['sequelize'][_0xcbf9('0x11')]('../api/trunk/trunk.model');db[_0xcbf9('0x27')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x28'));db[_0xcbf9('0x29')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x2a'));db[_0xcbf9('0x2b')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x2c'));db['UserChatQueue']=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x2d'));db[_0xcbf9('0x2e')]=db[_0xcbf9('0x0')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xcbf9('0x2f')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x30'));db[_0xcbf9('0x31')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x32'));db[_0xcbf9('0x33')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x34'));db[_0xcbf9('0x35')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x36'));db[_0xcbf9('0x37')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x38'));db['MailQueue']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x39'));db[_0xcbf9('0x3a')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0xcbf9('0x3b')]=db['sequelize']['import'](_0xcbf9('0x3c'));db['MailMessage']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x3d'));db['MailApplication']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x3e'));db[_0xcbf9('0x3f')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/mailQueueReport/mailQueueReport.model');db[_0xcbf9('0x40')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x41'));db[_0xcbf9('0x42')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x43'));db['FaxAccount']=db[_0xcbf9('0x0')]['import']('../api/faxAccount/faxAccount.model');db[_0xcbf9('0x44')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x45'));db[_0xcbf9('0x46')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x47'));db[_0xcbf9('0x48')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x49'));db[_0xcbf9('0x4a')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x4b'));db[_0xcbf9('0x4c')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x4d'));db[_0xcbf9('0x4e')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x4f'));db[_0xcbf9('0x50')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x51'));db[_0xcbf9('0x52')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x53'));db[_0xcbf9('0x54')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x55'));db['OpenchannelApplication']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x56'));db[_0xcbf9('0x57')]=db['sequelize'][_0xcbf9('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x58'));db[_0xcbf9('0x59')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x5a'));db['ChatWebsite']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x5b'));db[_0xcbf9('0x5c')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x5d'));db['ChatApplication']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x5e'));db['ChatInteraction']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x5f'));db[_0xcbf9('0x60')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x61'));db[_0xcbf9('0x62')]=db['sequelize']['import'](_0xcbf9('0x63'));db['ChatQueue']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x64'));db['ChatGroup']=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/chatGroup/chatGroup.model');db[_0xcbf9('0x65')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x66'));db[_0xcbf9('0x67')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x68'));db['CmContact']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x69'));db['CmHopper']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x6a'));db[_0xcbf9('0x6b')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x6c'));db[_0xcbf9('0x6d')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x6e'));db[_0xcbf9('0x6f')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x70'));db[_0xcbf9('0x71')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x72'));db[_0xcbf9('0x73')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x74'));db[_0xcbf9('0x75')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/action/action.model');db[_0xcbf9('0x76')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x77'));db['CannedAnswer']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x78'));db[_0xcbf9('0x79')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/disposition/disposition.model');db[_0xcbf9('0x7a')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x7b'));db[_0xcbf9('0x7c')]=db['sequelize'][_0xcbf9('0x11')]('../api/interval/interval.model');db[_0xcbf9('0x7d')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x7e'));db['Cdr']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x7f'));db[_0xcbf9('0x80')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x81'));db[_0xcbf9('0x82')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/schedule/schedule.model');db['Sound']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x83'));db[_0xcbf9('0x84')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/tag/tag.model');db['Template']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x85'));db[_0xcbf9('0x86')]=db['sequelize'][_0xcbf9('0x11')]('../api/trigger/trigger.model');db[_0xcbf9('0x87')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x88'));db[_0xcbf9('0x89')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x8a'));db[_0xcbf9('0x8b')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/integrationReport/integrationReport.model');db[_0xcbf9('0x8c')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xcbf9('0x8d')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x8e'));db[_0xcbf9('0x8f')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x90'));db[_0xcbf9('0x91')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x92'));db[_0xcbf9('0x93')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x94'));db[_0xcbf9('0x95')]=db['sequelize']['import'](_0xcbf9('0x96'));db[_0xcbf9('0x97')]=db[_0xcbf9('0x0')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x98'));db[_0xcbf9('0x99')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x9a'));db[_0xcbf9('0x9b')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x9c'));db['SugarcrmConfiguration']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x9d'));db[_0xcbf9('0x9e')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x9f'));db[_0xcbf9('0xa0')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xa1'));db['DeskConfiguration']=db['sequelize']['import'](_0xcbf9('0xa2'));db[_0xcbf9('0xa3')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/intDeskField/intDeskField.model');db[_0xcbf9('0xa4')]=db['sequelize'][_0xcbf9('0x11')]('../api/intZohoAccount/intZohoAccount.model');db[_0xcbf9('0xa5')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xcbf9('0xa6')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0xcbf9('0x0')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xcbf9('0xa7')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xa8'));db[_0xcbf9('0xa9')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xaa'));db[_0xcbf9('0xab')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xac'));db[_0xcbf9('0xad')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xae'));db[_0xcbf9('0xaf')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb0'));db['VtigerAccount']=db['sequelize'][_0xcbf9('0x11')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xcbf9('0xb1')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb2'));db['VtigerField']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb3'));db['ServicenowAccount']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xb4'));db[_0xcbf9('0xb5')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb6'));db[_0xcbf9('0xb7')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb8'));db[_0xcbf9('0xb9')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xba'));db['Dynamics365Configuration']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xbb'));db[_0xcbf9('0xbc')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xbd'));db['FreshsalesAccount']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xbe'));db[_0xcbf9('0xbf')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xc0'));db[_0xcbf9('0xc1')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xc2'));db[_0xcbf9('0x89')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x8a'));db['Network']=db['sequelize']['import'](_0xcbf9('0xc3'));db[_0xcbf9('0xc4')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xc5'));db[_0xcbf9('0xc6')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xc7'));db['JscriptyAnswerReport']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xc8'));db['JscriptyQuestionReport']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xc9'));db[_0xcbf9('0xca')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xcb'));db['SmsQueueReport']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xcc'));db[_0xcbf9('0xcd')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/squareReport/squareReport.model');db[_0xcbf9('0xce')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xcf'));db['JscriptyProject']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xd0'));db[_0xcbf9('0xd1')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xd2'));db[_0xcbf9('0xd3')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xd4'));db[_0xcbf9('0xd5')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xd6'));db[_0xcbf9('0xd7')]=db[_0xcbf9('0x0')]['import']('../api/squareRecording/squareRecording.model');db[_0xcbf9('0xd8')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xd9'));db[_0xcbf9('0xda')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xdb'));db['License']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xdc'));db[_0xcbf9('0xdd')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/campaign/campaign.model');db[_0xcbf9('0xde')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xdf'));db[_0xcbf9('0xe0')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xe1'));db[_0xcbf9('0xe2')]=db['sequelize'][_0xcbf9('0x11')]('../api/plugin/plugin.model');db[_0xcbf9('0xe3')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xe4'));db[_0xcbf9('0xe5')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xe6'));db[_0xcbf9('0xe7')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xe8'));db[_0xcbf9('0xe9')]=db['sequelize']['import'](_0xcbf9('0xea'));db[_0xcbf9('0xeb')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xec'));db[_0xcbf9('0xed')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xee'));db[_0xcbf9('0xef')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xf0'));db[_0xcbf9('0xf1')]=db['sequelize'][_0xcbf9('0x11')]('../api/userProfile/userProfile.model');db[_0xcbf9('0xf2')]=db['sequelize']['import'](_0xcbf9('0xf3'));db[_0xcbf9('0xf4')]=db['sequelize']['import'](_0xcbf9('0xf5'));db[_0xcbf9('0xf6')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/userNotification/userNotification.model');db[_0xcbf9('0xf7')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xf8'));db['WhatsappInteraction']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xf9'));db[_0xcbf9('0xfa')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xfb'));db[_0xcbf9('0xfc')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xfd'));db[_0xcbf9('0xfe')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xcbf9('0xff')]=db['sequelize']['import'](_0xcbf9('0x100'));db[_0xcbf9('0x101')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x102'));db[_0xcbf9('0x103')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x104'));db[_0xcbf9('0x105')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x106'));db['UserVoicePrefix']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x107'));db[_0xcbf9('0x108')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db['User']['hasOne'](db[_0xcbf9('0x1d')],{'as':'VoiceMail','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10b')](db['UserSetting'],{'as':_0xcbf9('0x10c'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x19')],{'as':_0xcbf9('0x10e'),'foreignKey':'UserId'});db[_0xcbf9('0x10')]['hasMany'](db[_0xcbf9('0x29')],{'as':_0xcbf9('0x10f'),'foreignKey':_0xcbf9('0x10a')});db['User']['hasMany'](db[_0xcbf9('0x110')],{'as':_0xcbf9('0x111'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db[_0xcbf9('0x10')]['hasMany'](db[_0xcbf9('0x6d')],{'as':_0xcbf9('0x112'),'foreignKey':_0xcbf9('0x10a')});db['User'][_0xcbf9('0x10d')](db[_0xcbf9('0x6f')],{'as':_0xcbf9('0x113'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x71')],{'as':_0xcbf9('0x71'),'foreignKey':'UserId'});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x57')],{'as':_0xcbf9('0x114'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x115')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x50')],{'as':'SmsInteractions','foreignKey':_0xcbf9('0x10a')});db['User'][_0xcbf9('0x10d')](db['FaxInteraction'],{'as':_0xcbf9('0x116'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x3b')],{'as':_0xcbf9('0x117'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')]['hasMany'](db[_0xcbf9('0x118')],{'as':_0xcbf9('0x119'),'foreignKey':_0xcbf9('0x10a')});db['User'][_0xcbf9('0x10d')](db[_0xcbf9('0xf6')],{'as':_0xcbf9('0x11a'),'foreignKey':_0xcbf9('0x11b')});db[_0xcbf9('0x10')][_0xcbf9('0x11c')](db[_0xcbf9('0xf1')],{'as':_0xcbf9('0xf1'),'foreignKey':_0xcbf9('0x11d')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x11f')],{'as':_0xcbf9('0x120'),'through':'chat_group_has_users'});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x122'),'through':_0xcbf9('0x123')});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0xed')],{'as':'Lists','through':'cm_user_has_lists'});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x124')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db['MailInteraction'],{'as':'MailInteractions','through':_0xcbf9('0x125')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x115')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0x46')],{'as':_0xcbf9('0x116'),'through':_0xcbf9('0x126')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x50')],{'as':_0xcbf9('0x127'),'through':'user_has_sms_interactions'});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':_0xcbf9('0x114'),'through':'user_has_openchannel_interactions'});db[_0xcbf9('0x10')]['belongsToMany'](db[_0xcbf9('0x118')],{'as':_0xcbf9('0x119'),'through':_0xcbf9('0x128')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x17')],{'as':_0xcbf9('0x129'),'through':'UserVoiceQueue','required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xef')],{'as':_0xcbf9('0x12a'),'through':_0xcbf9('0x12b'),'required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x12c')],{'as':_0xcbf9('0x12d'),'through':_0xcbf9('0x12e'),'required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x12f')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0x48')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x54')],{'as':_0xcbf9('0x130'),'through':_0xcbf9('0x2f'),'required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x59')],{'as':_0xcbf9('0x131'),'through':_0xcbf9('0x31'),'required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xff')],{'as':_0xcbf9('0x132'),'through':'UserWhatsappQueue','required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xed')],{'through':_0xcbf9('0x133')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db['ChatWebsite'],{'as':_0xcbf9('0x134'),'through':_0xcbf9('0x135')});db['User']['belongsToMany'](db[_0xcbf9('0x136')],{'as':'FaxAccounts','through':_0xcbf9('0x137')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x138')],{'as':_0xcbf9('0x139'),'through':_0xcbf9('0x13a')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x13b')],{'as':_0xcbf9('0x13c'),'through':_0xcbf9('0x13d')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x4c')],{'as':_0xcbf9('0x13e'),'through':_0xcbf9('0x13f')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xf7')],{'as':_0xcbf9('0x140'),'through':_0xcbf9('0x141')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xd5')],{'as':_0xcbf9('0x142'),'through':_0xcbf9('0x143')});db[_0xcbf9('0x13')][_0xcbf9('0x10d')](db['VoiceExtension'],{'as':_0xcbf9('0x144'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x145')});db[_0xcbf9('0x14')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x110')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'as':'Applications','onDelete':'cascade'});db['VoiceMusicOnHold'][_0xcbf9('0x11e')](db['Sound'],{'as':_0xcbf9('0x146'),'through':'moh_has_sounds'});db[_0xcbf9('0x17')]['hasMany'](db[_0xcbf9('0x29')],{'as':_0xcbf9('0x147'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')][_0xcbf9('0x10d')](db[_0xcbf9('0x149')],{'as':_0xcbf9('0x14a'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')]['hasMany'](db[_0xcbf9('0x6d')],{'as':_0xcbf9('0x112'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')][_0xcbf9('0x10d')](db[_0xcbf9('0x6f')],{'as':_0xcbf9('0x14b'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')][_0xcbf9('0x10d')](db['ReportAgentPreview'],{'as':_0xcbf9('0x71'),'foreignKey':'VoiceQueueId'});db[_0xcbf9('0x17')][_0xcbf9('0x10d')](db['CmHopperBlack'],{'as':_0xcbf9('0x14c'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')]['hasMany'](db[_0xcbf9('0xca')],{'as':_0xcbf9('0x14d'),'foreignKey':_0xcbf9('0x148')});db['VoiceQueue'][_0xcbf9('0x11c')](db['Trunk'],{'as':_0xcbf9('0x26'),'foreignKey':_0xcbf9('0x14e')});db[_0xcbf9('0x17')][_0xcbf9('0x11c')](db[_0xcbf9('0x26')],{'as':_0xcbf9('0x14f'),'foreignKey':_0xcbf9('0x150')});db['VoiceQueue']['belongsTo'](db[_0xcbf9('0x7c')],{'as':_0xcbf9('0x7c'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x17')][_0xcbf9('0x11c')](db['Pause'],{'as':_0xcbf9('0x152'),'foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x17')][_0xcbf9('0x11e')](db['CmList'],{'as':_0xcbf9('0x154'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue']['belongsToMany'](db['User'],{'as':_0xcbf9('0x155'),'through':'UserVoiceQueue'});db[_0xcbf9('0x17')][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'as':_0xcbf9('0x156'),'through':'TeamVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0xcbf9('0xed')],{'as':'BlackLists','through':_0xcbf9('0x157')});db[_0xcbf9('0x19')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x10'),'foreignKey':_0xcbf9('0x10a')});db['ScreenRecording'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':'User','foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x1d')][_0xcbf9('0x10d')](db['VoiceMailMessage'],{'as':_0xcbf9('0x158'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x159'),'sourceKey':_0xcbf9('0x15a')});db[_0xcbf9('0x15b')][_0xcbf9('0x11c')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xcbf9('0x15a')});db[_0xcbf9('0x20')][_0xcbf9('0x10d')](db[_0xcbf9('0x15c')],{'as':_0xcbf9('0x15d'),'foreignKey':'uniqueid','constraints':![]});db[_0xcbf9('0x20')]['hasMany'](db[_0xcbf9('0x15e')],{'as':_0xcbf9('0x15f'),'foreignKey':_0xcbf9('0x160'),'constraints':![]});db[_0xcbf9('0x20')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x10'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x20')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':'Contact','foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x35')][_0xcbf9('0x11c')](db['MailAccount'],{'as':_0xcbf9('0x138'),'foreignKey':_0xcbf9('0x162')});db['MailServerIn'][_0xcbf9('0x11c')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x37')][_0xcbf9('0x11c')](db[_0xcbf9('0x138')],{'as':_0xcbf9('0x138'),'foreignKey':'MailAccountId'});db[_0xcbf9('0x37')]['belongsTo'](db['CloudProvider'],{'as':_0xcbf9('0x101'),'foreignKey':_0xcbf9('0x164'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x138')][_0xcbf9('0x10b')](db[_0xcbf9('0x35')],{'as':_0xcbf9('0x165'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x138')][_0xcbf9('0x10b')](db['MailServerOut'],{'as':_0xcbf9('0x166'),'onDelete':_0xcbf9('0x109')});db['MailAccount'][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x162'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x138')][_0xcbf9('0x10d')](db['CannedAnswer'],{'as':_0xcbf9('0x168'),'foreignKey':_0xcbf9('0x162')});db[_0xcbf9('0x138')][_0xcbf9('0x10d')](db[_0xcbf9('0x169')],{'as':'Messages','foreignKey':_0xcbf9('0x162')});db[_0xcbf9('0x138')]['hasMany'](db[_0xcbf9('0x3b')],{'as':_0xcbf9('0x16a')});db[_0xcbf9('0x138')][_0xcbf9('0x10d')](db[_0xcbf9('0x16b')],{'as':_0xcbf9('0x16c')});db[_0xcbf9('0x138')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db['MailAccount'][_0xcbf9('0x11c')](db[_0xcbf9('0x16d')],{'as':_0xcbf9('0x16d'),'foreignKey':_0xcbf9('0x16e')});db[_0xcbf9('0x138')][_0xcbf9('0x11c')](db[_0xcbf9('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x138')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x13a')});db[_0xcbf9('0x12c')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':'Agents','through':_0xcbf9('0x12e')});db[_0xcbf9('0x12c')][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':'team_has_mail_queues','as':_0xcbf9('0x156')});db[_0xcbf9('0x3b')]['hasMany'](db[_0xcbf9('0x169')],{'as':_0xcbf9('0x158'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x16f')});db[_0xcbf9('0x3b')]['belongsTo'](db[_0xcbf9('0x138')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x162')});db['MailInteraction'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x3b')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x172'),'foreignKey':'UserId'});db[_0xcbf9('0x3b')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x173'),'as':'Tags'});db[_0xcbf9('0x3b')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x173'),'as':_0xcbf9('0x174')});db['MailInteraction']['belongsToMany'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x125'),'foreignKey':_0xcbf9('0x16f')});db[_0xcbf9('0x169')][_0xcbf9('0x10d')](db['Attachment'],{'as':_0xcbf9('0x176'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x169')]['belongsTo'](db['User'],{'as':_0xcbf9('0x10')});db[_0xcbf9('0x169')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x171')});db[_0xcbf9('0x169')][_0xcbf9('0x11c')](db[_0xcbf9('0x3b')],{'as':'Interaction','foreignKey':'MailInteractionId'});db['MailMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x138')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x162')});db[_0xcbf9('0x169')]['belongsTo'](db[_0xcbf9('0x177')],{'as':_0xcbf9('0x177'),'foreignKey':_0xcbf9('0x178')});db[_0xcbf9('0x169')][_0xcbf9('0x11c')](db['ChatOfflineMessage'],{'as':_0xcbf9('0x62'),'foreignKey':'ChatOfflineMessageId'});db[_0xcbf9('0x16b')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x16b')]['belongsTo'](db[_0xcbf9('0x12c')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x16b')][_0xcbf9('0x11c')](db[_0xcbf9('0x138')],{'onDelete':'restrict'});db[_0xcbf9('0x16b')][_0xcbf9('0x11c')](db['Interval'],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x16b')][_0xcbf9('0x11c')](db['Tag'],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x179')});db[_0xcbf9('0x3f')]['belongsTo'](db[_0xcbf9('0x138')],{});db[_0xcbf9('0x3f')][_0xcbf9('0x11c')](db['CmList'],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0x3f')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x3f')][_0xcbf9('0x11c')](db['MailInteraction'],{});db['MailQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x169')],{});db['MailQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{});db[_0xcbf9('0x3f')]['belongsTo'](db[_0xcbf9('0x12c')],{});db[_0xcbf9('0x40')][_0xcbf9('0x10d')](db['DashboardItem'],{'as':'Items','onDelete':'cascade'});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':'Dispositions','foreignKey':_0xcbf9('0x17c'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db['CannedAnswer'],{'as':_0xcbf9('0x168'),'foreignKey':_0xcbf9('0x17c')});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db['FaxInteraction'],{'as':_0xcbf9('0x16a')});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db[_0xcbf9('0x44')],{'as':'Applications'});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'as':_0xcbf9('0x17d'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db[_0xcbf9('0x17e')],{'as':_0xcbf9('0x158')});db[_0xcbf9('0x136')]['belongsTo'](db[_0xcbf9('0x26')],{'as':_0xcbf9('0x26')});db['FaxAccount'][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':'List','foreignKey':'ListId'});db['FaxAccount'][_0xcbf9('0x11c')](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x136')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0xcbf9('0x44')][_0xcbf9('0x11c')](db['User'],{'onDelete':'restrict'});db[_0xcbf9('0x44')][_0xcbf9('0x11c')](db[_0xcbf9('0x48')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x44')][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{'onDelete':'restrict'});db[_0xcbf9('0x44')][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':'restrict','foreignKey':_0xcbf9('0x179')});db['FaxInteraction'][_0xcbf9('0x10d')](db[_0xcbf9('0x17e')],{'as':_0xcbf9('0x158'),'onDelete':_0xcbf9('0x109'),'foreignKey':'FaxInteractionId'});db[_0xcbf9('0x46')][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x17c')});db[_0xcbf9('0x46')][_0xcbf9('0x11c')](db['CmContact'],{'as':'Contact','foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x46')][_0xcbf9('0x11c')](db['User'],{'as':_0xcbf9('0x172'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x46')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':'fax_interaction_has_tags','as':_0xcbf9('0x17f')});db['FaxInteraction'][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xcbf9('0x46')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xcbf9('0x180')});db[_0xcbf9('0x17e')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x10')});db[_0xcbf9('0x17e')][_0xcbf9('0x11c')](db[_0xcbf9('0x46')],{'as':'Interaction','foreignKey':_0xcbf9('0x180')});db[_0xcbf9('0x17e')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x171')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0xcbf9('0x181')});db[_0xcbf9('0x17e')]['belongsTo'](db[_0xcbf9('0x136')],{'as':'Account','foreignKey':_0xcbf9('0x17c')});db[_0xcbf9('0x48')]['belongsToMany'](db['User'],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x2e')});db['FaxQueue'][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x182'),'as':_0xcbf9('0x156')});db[_0xcbf9('0x4a')][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{});db[_0xcbf9('0x4a')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db['FaxQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x4a')][_0xcbf9('0x11c')](db[_0xcbf9('0x46')],{});db[_0xcbf9('0x4a')][_0xcbf9('0x11c')](db['FaxMessage'],{});db[_0xcbf9('0x4a')]['belongsTo'](db[_0xcbf9('0x10')],{});db[_0xcbf9('0x4a')][_0xcbf9('0x11c')](db[_0xcbf9('0x48')],{});db[_0xcbf9('0x4c')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x183'),'onDelete':'cascade'});db[_0xcbf9('0x4c')][_0xcbf9('0x10d')](db[_0xcbf9('0x184')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xcbf9('0x4c')][_0xcbf9('0x10d')](db[_0xcbf9('0x52')],{'as':_0xcbf9('0x158'),'foreignKey':_0xcbf9('0x183')});db[_0xcbf9('0x4c')]['hasMany'](db[_0xcbf9('0x50')],{'as':_0xcbf9('0x16a')});db[_0xcbf9('0x4c')]['hasMany'](db[_0xcbf9('0x4e')],{'as':_0xcbf9('0x16c')});db[_0xcbf9('0x4c')][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':'List','foreignKey':_0xcbf9('0x17b')});db['SmsAccount'][_0xcbf9('0x11c')](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x4c')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':'Agents','through':_0xcbf9('0x13f')});db['SmsApplication'][_0xcbf9('0x11c')](db['User'],{'onDelete':'restrict'});db[_0xcbf9('0x4e')]['belongsTo'](db[_0xcbf9('0x54')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x4e')][_0xcbf9('0x11c')](db[_0xcbf9('0x4c')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x4e')][_0xcbf9('0x11c')](db[_0xcbf9('0x7c')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x4e')][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x179')});db['SmsInteraction'][_0xcbf9('0x10d')](db[_0xcbf9('0x52')],{'as':'Messages','onDelete':_0xcbf9('0x109'),'foreignKey':'SmsInteractionId'});db['SmsInteraction']['belongsTo'](db[_0xcbf9('0x4c')],{'as':'Account','foreignKey':_0xcbf9('0x183')});db[_0xcbf9('0x50')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x50')]['belongsTo'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x172'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x50')]['belongsToMany'](db[_0xcbf9('0x84')],{'through':'sms_interaction_has_tags','as':_0xcbf9('0x17f')});db['SmsInteraction'][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':'sms_interaction_has_tags','as':_0xcbf9('0x174')});db[_0xcbf9('0x50')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':'user_has_sms_interactions','foreignKey':_0xcbf9('0x185')});db[_0xcbf9('0x52')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x10')});db['SmsMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x171')});db[_0xcbf9('0x52')][_0xcbf9('0x11c')](db[_0xcbf9('0x50')],{'onDelete':_0xcbf9('0x109'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0xcbf9('0x52')]['belongsTo'](db[_0xcbf9('0x4c')],{'as':'Account','foreignKey':_0xcbf9('0x183')});db[_0xcbf9('0x54')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':'Agents','through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0xcbf9('0x54')][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x186'),'as':_0xcbf9('0x156')});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x187'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x184')],{'as':'Answers','foreignKey':_0xcbf9('0x187')});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x57')],{'as':_0xcbf9('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x188')],{'as':_0xcbf9('0x158'),'foreignKey':_0xcbf9('0x187')});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x189')],{'as':_0xcbf9('0x16c'),'foreignKey':_0xcbf9('0x187')});db[_0xcbf9('0x13b')][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0x13b')][_0xcbf9('0x11c')](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x13b')][_0xcbf9('0x11e')](db['User'],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x13d')});db[_0xcbf9('0x189')]['belongsTo'](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x189')][_0xcbf9('0x11c')](db['OpenchannelQueue'],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x18a')});db[_0xcbf9('0x189')]['belongsTo'](db[_0xcbf9('0x13b')],{'onDelete':_0xcbf9('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xcbf9('0x189')][_0xcbf9('0x11c')](db['Interval'],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x151')});db['OpenchannelApplication'][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xcbf9('0x57')][_0xcbf9('0x10d')](db[_0xcbf9('0x188')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xcbf9('0x18b')});db[_0xcbf9('0x57')][_0xcbf9('0x11c')](db[_0xcbf9('0x13b')],{'as':_0xcbf9('0x170'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db[_0xcbf9('0x121')],{'as':'Contact','foreignKey':_0xcbf9('0x161')});db['OpenchannelInteraction'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':'Owner','foreignKey':'UserId'});db[_0xcbf9('0x57')]['belongsToMany'](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x18c'),'as':_0xcbf9('0x17f')});db['OpenchannelInteraction']['belongsToMany'](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x18c'),'as':_0xcbf9('0x174')});db['OpenchannelInteraction']['belongsToMany'](db['User'],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x18d'),'foreignKey':_0xcbf9('0x18b')});db[_0xcbf9('0x188')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x10')});db[_0xcbf9('0x188')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':'cascade','as':_0xcbf9('0x171')});db['OpenchannelMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x57')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x18e'),'foreignKey':_0xcbf9('0x18b')});db[_0xcbf9('0x188')][_0xcbf9('0x11c')](db['Attachment'],{'as':'Attachment','foreignKey':_0xcbf9('0x181')});db['OpenchannelMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x13b')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x187')});db[_0xcbf9('0x59')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x31'),'foreignKey':_0xcbf9('0x18a')});db[_0xcbf9('0x59')]['belongsToMany'](db['Team'],{'through':_0xcbf9('0x18f'),'as':'Teams'});db[_0xcbf9('0x177')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':'Dispositions','foreignKey':_0xcbf9('0x178'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x177')][_0xcbf9('0x10d')](db[_0xcbf9('0x184')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xcbf9('0x10d')](db[_0xcbf9('0x65')],{'as':'ProactiveActions'});db[_0xcbf9('0x177')][_0xcbf9('0x10d')](db[_0xcbf9('0x115')],{'as':_0xcbf9('0x16a')});db[_0xcbf9('0x177')]['hasMany'](db[_0xcbf9('0x190')],{'as':'Applications'});db[_0xcbf9('0x177')][_0xcbf9('0x10d')](db[_0xcbf9('0x60')],{'as':'Messages'});db[_0xcbf9('0x177')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db['ChatWebsite'][_0xcbf9('0x11c')](db[_0xcbf9('0x7c')],{'as':_0xcbf9('0x7c'),'foreignKey':'IntervalId'});db[_0xcbf9('0x177')][_0xcbf9('0x11c')](db['MailAccount'],{'as':_0xcbf9('0x138'),'foreignKey':_0xcbf9('0x162')});db[_0xcbf9('0x177')]['belongsTo'](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0xcbf9('0x11e')](db['User'],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x135')});db[_0xcbf9('0x5c')][_0xcbf9('0x11c')](db['OpenchannelAccount'],{});db[_0xcbf9('0x5c')][_0xcbf9('0x11c')](db['CmList'],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db['OpenchannelQueueReport'][_0xcbf9('0x11c')](db['CmContact'],{'as':_0xcbf9('0x171'),'foreignKey':'ContactId'});db[_0xcbf9('0x5c')][_0xcbf9('0x11c')](db[_0xcbf9('0x57')],{});db['OpenchannelQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x188')],{});db['OpenchannelQueueReport'][_0xcbf9('0x11c')](db['User'],{});db[_0xcbf9('0x5c')][_0xcbf9('0x11c')](db[_0xcbf9('0x59')],{});db[_0xcbf9('0x190')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x191'),'foreignKey':_0xcbf9('0x10a'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x190')]['belongsTo'](db['ChatQueue'],{'as':_0xcbf9('0x192'),'foreignKey':_0xcbf9('0x193'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x190')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'as':'Website','foreignKey':_0xcbf9('0x178'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x190')][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x179')});db[_0xcbf9('0x115')][_0xcbf9('0x10d')](db[_0xcbf9('0x60')],{'as':_0xcbf9('0x158'),'onDelete':'cascade','foreignKey':_0xcbf9('0x194')});db[_0xcbf9('0x115')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x178')});db[_0xcbf9('0x115')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':'Contact','foreignKey':'ContactId'});db[_0xcbf9('0x115')][_0xcbf9('0x11c')](db['User'],{'as':_0xcbf9('0x172'),'foreignKey':'UserId'});db[_0xcbf9('0x115')]['belongsToMany'](db['Tag'],{'through':_0xcbf9('0x195'),'as':'Tags'});db[_0xcbf9('0x115')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x195'),'as':'ThroughTags'});db[_0xcbf9('0x115')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':'Users','through':_0xcbf9('0x196'),'foreignKey':_0xcbf9('0x194')});db[_0xcbf9('0x60')]['belongsTo'](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x10')});db[_0xcbf9('0x60')][_0xcbf9('0x11c')](db['CmContact'],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db['ChatMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x115')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x18e'),'foreignKey':_0xcbf9('0x194')});db[_0xcbf9('0x60')][_0xcbf9('0x11c')](db[_0xcbf9('0xe0')],{'as':'Attachment','foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x178')});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':_0xcbf9('0x176'),'foreignKey':_0xcbf9('0x197'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db['ChatOfflineMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xcbf9('0x161')});db['ChatOfflineMessage']['belongsTo'](db[_0xcbf9('0x177')],{'as':_0xcbf9('0x170'),'foreignKey':'ChatWebsiteId'});db[_0xcbf9('0x12f')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':'Agents','through':_0xcbf9('0x198'),'hooks':!![]});db[_0xcbf9('0x12f')]['belongsToMany'](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x199'),'as':_0xcbf9('0x156')});db['ChatGroup']['hasMany'](db[_0xcbf9('0xc6')],{'as':_0xcbf9('0x158'),'foreignKey':_0xcbf9('0x19a'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x11f')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x147'),'through':_0xcbf9('0x19b')});db[_0xcbf9('0x65')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'as':_0xcbf9('0x19c'),'foreignKey':'ChatWebsiteId'});db[_0xcbf9('0x67')][_0xcbf9('0x10d')](db[_0xcbf9('0x121')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x149')],{'as':_0xcbf9('0x14a'),'foreignKey':'ContactId'});db['CmContact'][_0xcbf9('0x10d')](db[_0xcbf9('0x6d')],{'as':_0xcbf9('0x112'),'foreignKey':_0xcbf9('0x161')});db['CmContact'][_0xcbf9('0x10d')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x71')],{'as':_0xcbf9('0x71'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x121')]['hasMany'](db[_0xcbf9('0xca')],{'as':'JscriptySessions','foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x121')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xcbf9('0x161'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x115')],{'as':_0xcbf9('0x19d'),'foreignKey':_0xcbf9('0x161'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x50')],{'as':_0xcbf9('0x127'),'foreignKey':'ContactId','onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x46')],{'as':'FaxInteractions','foreignKey':_0xcbf9('0x161'),'onDelete':'restrict'});db[_0xcbf9('0x121')]['hasMany'](db[_0xcbf9('0x3b')],{'as':_0xcbf9('0x117'),'foreignKey':_0xcbf9('0x161'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x121')]['belongsTo'](db[_0xcbf9('0x67')],{'as':_0xcbf9('0x19e'),'foreignKey':'CompanyId'});db[_0xcbf9('0x121')][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':'List','foreignKey':_0xcbf9('0x17b'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x121')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x123')});db[_0xcbf9('0x121')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'as':_0xcbf9('0x17f'),'through':'cm_contact_has_tags'});db['CmContact'][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x19f'),'as':'ThroughTags'});db[_0xcbf9('0x149')][_0xcbf9('0x11c')](db['CmContact'],{'as':'Contact','foreignKey':_0xcbf9('0x161'),'onDelete':'cascade'});db['CmHopper'][_0xcbf9('0x11c')](db['CmList'],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x149')]['belongsTo'](db['User'],{'as':_0xcbf9('0x191'),'foreignKey':'UserId'});db['CmHopper'][_0xcbf9('0x11c')](db[_0xcbf9('0x17')],{'as':_0xcbf9('0x192'),'foreignKey':_0xcbf9('0x148'),'onDelete':_0xcbf9('0x109')});db['CmHopper'][_0xcbf9('0x11c')](db['Campaign'],{'as':'Campaign','foreignKey':_0xcbf9('0x1a0'),'onDelete':_0xcbf9('0x109')});db['CmHopper'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x172'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0xcbf9('0x11c')](db['CmContact'],{'as':'Contact','foreignKey':_0xcbf9('0x161'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x6b')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b'),'onDelete':_0xcbf9('0x109')});db['CmHopperBlack'][_0xcbf9('0x11c')](db['VoiceQueue'],{'as':_0xcbf9('0x192'),'foreignKey':'VoiceQueueId','onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x6b')][_0xcbf9('0x11c')](db['Campaign'],{'as':_0xcbf9('0xdd'),'foreignKey':_0xcbf9('0x1a0'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x76')][_0xcbf9('0x10d')](db[_0xcbf9('0x7a')],{'as':{'plural':_0xcbf9('0x1a1'),'singular':_0xcbf9('0x1a2')},'foreignKey':_0xcbf9('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0xcbf9('0x76')][_0xcbf9('0x10d')](db[_0xcbf9('0x7a')],{'as':{'plural':'Any','singular':_0xcbf9('0x1a4')},'foreignKey':_0xcbf9('0x1a5'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xcbf9('0x10d')](db[_0xcbf9('0x75')],{'as':'Actions','foreignKey':_0xcbf9('0x1a6'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db[_0xcbf9('0x79')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x1a7'),'onDelete':_0xcbf9('0x109')});db['Interval'][_0xcbf9('0x10d')](db['Interval'],{'as':'Intervals','foreignKey':_0xcbf9('0x151'),'onDelete':_0xcbf9('0x109'),'hooks':!![],'required':![]});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'as':_0xcbf9('0x111'),'foreignKey':_0xcbf9('0x151'),'onDelete':'restrict'});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db[_0xcbf9('0x16b')],{'as':_0xcbf9('0x1a8'),'foreignKey':'IntervalId'});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db['ChatApplication'],{'as':_0xcbf9('0x1a9'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db[_0xcbf9('0x44')],{'as':_0xcbf9('0x1aa'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db['SmsApplication'],{'as':_0xcbf9('0x1ab'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x82')]['belongsTo'](db['MailAccount'],{});db[_0xcbf9('0x82')]['belongsTo'](db[_0xcbf9('0x8d')],{'foreignKey':_0xcbf9('0x1ac')});db['Schedule']['belongsTo'](db[_0xcbf9('0x8c')],{'foreignKey':_0xcbf9('0x1ad')});db[_0xcbf9('0x1ae')][_0xcbf9('0x11e')](db[_0xcbf9('0x1af')],{'as':'Mohs','through':_0xcbf9('0x1b0'),'onDelete':'restrict'});db[_0xcbf9('0x84')][_0xcbf9('0x11e')](db[_0xcbf9('0x121')],{'through':'cm_contact_has_tags'});db[_0xcbf9('0x84')][_0xcbf9('0x11e')](db[_0xcbf9('0x115')],{'through':'chat_interaction_has_tags'});db[_0xcbf9('0x84')][_0xcbf9('0x11e')](db[_0xcbf9('0x3b')],{'through':_0xcbf9('0x173')});db[_0xcbf9('0x84')]['belongsToMany'](db[_0xcbf9('0x50')],{'through':_0xcbf9('0x1b1')});db[_0xcbf9('0x84')][_0xcbf9('0x11e')](db[_0xcbf9('0x46')],{'through':_0xcbf9('0x1b2')});db['Tag'][_0xcbf9('0x11e')](db[_0xcbf9('0x57')],{'through':_0xcbf9('0x18c')});db['Tag'][_0xcbf9('0x11e')](db['WhatsappInteraction'],{'through':_0xcbf9('0x1b3')});db[_0xcbf9('0x86')]['hasMany'](db[_0xcbf9('0x7a')],{'as':{'plural':'AllConditions','singular':_0xcbf9('0x1b4')},'foreignKey':_0xcbf9('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0xcbf9('0x86')][_0xcbf9('0x10d')](db[_0xcbf9('0x7a')],{'as':{'plural':_0xcbf9('0x1b6'),'singular':_0xcbf9('0x1b7')},'foreignKey':'TriggerAnyId','onDelete':_0xcbf9('0x109'),'hooks':!![]});db[_0xcbf9('0x86')][_0xcbf9('0x10d')](db['Action'],{'as':'Actions','foreignKey':_0xcbf9('0x1b8'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db[_0xcbf9('0x8c')][_0xcbf9('0x10d')](db[_0xcbf9('0x93')],{'as':_0xcbf9('0x1b9'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0xcbf9('0x8d')][_0xcbf9('0x10d')](db['AnalyticFieldReport'],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1ac')});db['AnalyticMetric'][_0xcbf9('0x10d')](db[_0xcbf9('0x93')],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':'MetricId'});db[_0xcbf9('0x93')][_0xcbf9('0x11c')](db[_0xcbf9('0x91')],{'foreignKey':_0xcbf9('0x1ba')});db[_0xcbf9('0x97')]['hasMany'](db[_0xcbf9('0x1bb')],{'as':_0xcbf9('0x1bc'),'onDelete':'cascade','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0x1bb')][_0xcbf9('0x10d')](db[_0xcbf9('0x99')],{'as':_0xcbf9('0x1be'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x1bb')][_0xcbf9('0x10d')](db[_0xcbf9('0x99')],{'as':'Descriptions','onDelete':_0xcbf9('0x109'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xcbf9('0x10d')](db['SalesforceField'],{'as':'Fields','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0x1bb')][_0xcbf9('0x11c')](db[_0xcbf9('0x97')],{'as':_0xcbf9('0x170'),'foreignKey':'AccountId'});db[_0xcbf9('0x99')][_0xcbf9('0x10d')](db[_0xcbf9('0x99')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x99')]['hasMany'](db[_0xcbf9('0x99')],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0x99')][_0xcbf9('0x10d')](db['SalesforceField'],{'as':_0xcbf9('0x1c4'),'foreignKey':'FieldId'});db[_0xcbf9('0x99')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db[_0xcbf9('0x9b')][_0xcbf9('0x10d')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0x1c6')]['hasMany'](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1be'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x1c6')][_0xcbf9('0x10d')](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1c7'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0x1c6')][_0xcbf9('0x10d')](db['SugarcrmField'],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c0')});db['SugarcrmConfiguration'][_0xcbf9('0x11c')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db['SugarcrmField'][_0xcbf9('0x10d')](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db['SugarcrmField'][_0xcbf9('0x10d')](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1c2'),'foreignKey':'DescriptionId'});db[_0xcbf9('0x9e')][_0xcbf9('0x10d')](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0x9e')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db['DeskAccount']['hasMany'](db[_0xcbf9('0x1c8')],{'as':_0xcbf9('0x1bc'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0x1c8')][_0xcbf9('0x10d')](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1be'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x1c8')]['hasMany'](db[_0xcbf9('0xa3')],{'as':'Descriptions','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0x1c8')]['hasMany'](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0xcbf9('0x11c')](db[_0xcbf9('0xa0')],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db['DeskConfiguration']['belongsToMany'](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x1c9')});db[_0xcbf9('0xa3')][_0xcbf9('0x10d')](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db['DeskField']['hasMany'](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1c2'),'foreignKey':'DescriptionId'});db['DeskField'][_0xcbf9('0x10d')](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xa3')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db['ZohoAccount'][_0xcbf9('0x10d')](db['ZohoConfiguration'],{'as':_0xcbf9('0x1bc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xcbf9('0xa5')][_0xcbf9('0x10d')](db['ZohoField'],{'as':_0xcbf9('0x1be'),'onDelete':'cascade','foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xa5')][_0xcbf9('0x10d')](db[_0xcbf9('0xa6')],{'as':_0xcbf9('0x1c7'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xa5')][_0xcbf9('0x10d')](db[_0xcbf9('0xa6')],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':'FieldId'});db[_0xcbf9('0xa5')]['belongsTo'](db[_0xcbf9('0xa4')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xa6')][_0xcbf9('0x10d')](db[_0xcbf9('0xa6')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db['ZohoField'][_0xcbf9('0x10d')](db['ZohoField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xcbf9('0xa6')][_0xcbf9('0x10d')](db['ZohoField'],{'as':'Field','foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xa6')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db['ZendeskAccount'][_0xcbf9('0x10d')](db[_0xcbf9('0xa7')],{'as':_0xcbf9('0x1bc'),'onDelete':'cascade','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xa7')][_0xcbf9('0x10d')](db[_0xcbf9('0xa9')],{'as':'Subjects','foreignKey':_0xcbf9('0x1bf')});db['ZendeskConfiguration']['hasMany'](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1c7'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xa7')][_0xcbf9('0x10d')](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1b9'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xa7')]['belongsTo'](db[_0xcbf9('0x1ca')],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xa7')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x1cb')});db[_0xcbf9('0xa9')][_0xcbf9('0x10d')](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xa9')][_0xcbf9('0x10d')](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xa9')]['hasMany'](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xa9')]['belongsTo'](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':'VariableId'});db[_0xcbf9('0xab')][_0xcbf9('0x10d')](db[_0xcbf9('0xad')],{'as':'Configurations','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xad')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0xcbf9('0xad')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':_0xcbf9('0x1c7'),'onDelete':_0xcbf9('0x109'),'foreignKey':'DescriptionId'});db[_0xcbf9('0xad')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xad')][_0xcbf9('0x11c')](db[_0xcbf9('0xab')],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xad')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x1cc')});db[_0xcbf9('0xaf')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xaf')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db['FreshdeskField'][_0xcbf9('0x10d')](db['FreshdeskField'],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xaf')][_0xcbf9('0x11c')](db['Variable'],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db[_0xcbf9('0x1cd')][_0xcbf9('0x10d')](db[_0xcbf9('0xb1')],{'as':'Configurations','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db['VtigerConfiguration'][_0xcbf9('0x10d')](db[_0xcbf9('0x1ce')],{'as':'Subjects','foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xb1')][_0xcbf9('0x10d')](db[_0xcbf9('0x1ce')],{'as':_0xcbf9('0x1c7'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xb1')][_0xcbf9('0x10d')](db['VtigerField'],{'as':_0xcbf9('0x1b9'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xb1')][_0xcbf9('0x11c')](db[_0xcbf9('0x1cd')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1bd')});db['VtigerField']['hasMany'](db[_0xcbf9('0x1ce')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x1ce')][_0xcbf9('0x10d')](db['VtigerField'],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0x1ce')][_0xcbf9('0x10d')](db[_0xcbf9('0x1ce')],{'as':'Field','foreignKey':'FieldId'});db[_0xcbf9('0x1ce')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xcbf9('0x1cf')][_0xcbf9('0x10d')](db[_0xcbf9('0xb5')],{'as':_0xcbf9('0x1bc'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db['ServicenowConfiguration'][_0xcbf9('0x10d')](db[_0xcbf9('0xb7')],{'as':_0xcbf9('0x1be'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xcbf9('0x10d')](db[_0xcbf9('0xb7')],{'as':_0xcbf9('0x1c7'),'foreignKey':'DescriptionId'});db[_0xcbf9('0xb5')][_0xcbf9('0x10d')](db['ServicenowField'],{'as':_0xcbf9('0x1b9'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xb5')][_0xcbf9('0x11c')](db['ServicenowAccount'],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xb7')][_0xcbf9('0x10d')](db[_0xcbf9('0xb7')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xb7')]['hasMany'](db['ServicenowField'],{'as':_0xcbf9('0x1c2'),'foreignKey':'DescriptionId'});db[_0xcbf9('0xb7')][_0xcbf9('0x10d')](db[_0xcbf9('0xb7')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xb7')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db[_0xcbf9('0xb9')]['hasMany'](db[_0xcbf9('0x1d0')],{'as':_0xcbf9('0x1bc'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xb9')][_0xcbf9('0x11c')](db[_0xcbf9('0x101')],{'as':'CloudProvider','foreignKey':_0xcbf9('0x164')});db[_0xcbf9('0x1d0')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':'Subjects','onDelete':_0xcbf9('0x109'),'foreignKey':'SubjectId'});db[_0xcbf9('0x1d0')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':'Descriptions','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c3')});db['Dynamics365Configuration'][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':'Fields','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0x1d0')][_0xcbf9('0x11c')](db[_0xcbf9('0xb9')],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xbc')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':'Subject','foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xbc')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':_0xcbf9('0x1c2'),'foreignKey':'DescriptionId'});db[_0xcbf9('0xbc')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xbc')][_0xcbf9('0x11c')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xcbf9('0x1d1')][_0xcbf9('0x10d')](db['FreshsalesConfiguration'],{'as':_0xcbf9('0x1bc'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xbf')][_0xcbf9('0x10d')](db[_0xcbf9('0xc1')],{'as':_0xcbf9('0x1be'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xbf')]['hasMany'](db[_0xcbf9('0xc1')],{'as':'Descriptions','foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xbf')]['hasMany'](db['FreshsalesField'],{'as':_0xcbf9('0x1b9'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xbf')][_0xcbf9('0x11c')](db[_0xcbf9('0x1d1')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xc1')][_0xcbf9('0x10d')](db[_0xcbf9('0xc1')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xc1')][_0xcbf9('0x10d')](db[_0xcbf9('0xc1')],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xc1')][_0xcbf9('0x10d')](db[_0xcbf9('0xc1')],{'as':_0xcbf9('0x1c4'),'foreignKey':'FieldId'});db[_0xcbf9('0xc1')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':'Variable','foreignKey':'VariableId'});db[_0xcbf9('0xc4')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{});db[_0xcbf9('0xc4')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xc4')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':'Contact','foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0xc4')][_0xcbf9('0x11c')](db[_0xcbf9('0x115')],{});db[_0xcbf9('0xc4')][_0xcbf9('0x11c')](db[_0xcbf9('0x60')],{});db['ChatQueueReport']['belongsTo'](db['User'],{});db['ChatQueueReport'][_0xcbf9('0x11c')](db['ChatQueue'],{});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1d2')});db[_0xcbf9('0xc6')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x109'),'foreignKey':'ToId'});db[_0xcbf9('0xca')][_0xcbf9('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0xcbf9('0x1d3'),'onDelete':'cascade'});db[_0xcbf9('0xca')][_0xcbf9('0x10d')](db[_0xcbf9('0x1d4')],{'foreignKey':_0xcbf9('0x1d3'),'onDelete':'cascade'});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db[_0xcbf9('0x4c')],{});db[_0xcbf9('0x1d5')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':'ListId'});db['SmsQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db['SmsInteraction'],{});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db[_0xcbf9('0x52')],{});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db[_0xcbf9('0x54')],{});db[_0xcbf9('0x1d6')][_0xcbf9('0x10d')](db[_0xcbf9('0xca')],{'foreignKey':_0xcbf9('0x1d7')});db[_0xcbf9('0x1d6')][_0xcbf9('0x10d')](db[_0xcbf9('0x1d8')],{'foreignKey':'ProjectId'});db[_0xcbf9('0x1d6')][_0xcbf9('0x10d')](db[_0xcbf9('0x1d4')],{'foreignKey':_0xcbf9('0x1d7')});db[_0xcbf9('0xd5')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x143')});db[_0xcbf9('0xda')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x124')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0x17')],{'through':_0xcbf9('0x103'),'as':'VoiceQueues'});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0x12c')],{'through':_0xcbf9('0x1d9'),'as':_0xcbf9('0x12d')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xcbf9('0x1da')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0x48')],{'through':'team_has_fax_queues','as':_0xcbf9('0x1db')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0x54')],{'through':_0xcbf9('0x186'),'as':_0xcbf9('0x130')});db['Team'][_0xcbf9('0x11e')](db[_0xcbf9('0x59')],{'through':_0xcbf9('0x18f'),'as':_0xcbf9('0x131')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0xff')],{'through':_0xcbf9('0x1dc'),'as':'WhatsappQueues'});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0xef')],{'through':_0xcbf9('0x105'),'as':_0xcbf9('0x12a')});db[_0xcbf9('0xdd')][_0xcbf9('0x10d')](db[_0xcbf9('0x149')],{'as':_0xcbf9('0x14a'),'foreignKey':_0xcbf9('0x1a0')});db[_0xcbf9('0xdd')][_0xcbf9('0x10d')](db[_0xcbf9('0x6d')],{'as':'HopperFinals','foreignKey':_0xcbf9('0x1a0')});db[_0xcbf9('0xdd')][_0xcbf9('0x10d')](db[_0xcbf9('0x6f')],{'as':_0xcbf9('0x14b'),'foreignKey':_0xcbf9('0x1a0')});db[_0xcbf9('0xdd')][_0xcbf9('0x10d')](db[_0xcbf9('0x6b')],{'as':'HopperBlacks','foreignKey':_0xcbf9('0x1a0')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0xcbf9('0x26'),'foreignKey':_0xcbf9('0x14e')});db[_0xcbf9('0xdd')]['belongsTo'](db[_0xcbf9('0x26')],{'as':'TrunkBackup','foreignKey':_0xcbf9('0x150')});db[_0xcbf9('0xdd')][_0xcbf9('0x11c')](db[_0xcbf9('0x7c')],{'as':_0xcbf9('0x7c'),'foreignKey':_0xcbf9('0x151')});db['Campaign'][_0xcbf9('0x11c')](db[_0xcbf9('0xd5')],{'as':_0xcbf9('0xd5'),'foreignKey':_0xcbf9('0x1dd')});db[_0xcbf9('0xdd')][_0xcbf9('0x11e')](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x154'),'through':'campaigns_has_cm_lists'});db[_0xcbf9('0xdd')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0xcbf9('0x1de')});db[_0xcbf9('0xe0')][_0xcbf9('0x11c')](db[_0xcbf9('0x62')],{'as':_0xcbf9('0x62'),'foreignKey':_0xcbf9('0x197')});db[_0xcbf9('0xe3')][_0xcbf9('0x11c')](db['MailMessage'],{});db[_0xcbf9('0xe3')][_0xcbf9('0x11c')](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db[_0xcbf9('0x138')],{'foreignKey':_0xcbf9('0x1df'),'as':_0xcbf9('0x1e0')});db[_0xcbf9('0xe3')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':_0xcbf9('0x1e2')});db[_0xcbf9('0xe3')][_0xcbf9('0x11c')](db['User'],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db['MailTransferReport']['belongsTo'](db['MailQueue'],{'foreignKey':_0xcbf9('0x1e5'),'as':_0xcbf9('0x1e6')});db[_0xcbf9('0xe3')]['belongsTo'](db[_0xcbf9('0x138')],{'foreignKey':_0xcbf9('0x1e7'),'as':_0xcbf9('0x1e8')});db[_0xcbf9('0xe5')]['belongsTo'](db[_0xcbf9('0x60')],{});db[_0xcbf9('0xe5')]['belongsTo'](db[_0xcbf9('0x115')],{});db['ChatTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'foreignKey':_0xcbf9('0x1e9'),'as':_0xcbf9('0x1e0')});db['ChatTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':_0xcbf9('0x1e2')});db[_0xcbf9('0xe5')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db[_0xcbf9('0xe5')][_0xcbf9('0x11c')](db[_0xcbf9('0x12f')],{'foreignKey':'ToChatQueueId','as':_0xcbf9('0x1e6')});db[_0xcbf9('0xe5')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0xcbf9('0xe7')][_0xcbf9('0x11c')](db['FaxMessage'],{});db[_0xcbf9('0xe7')]['belongsTo'](db[_0xcbf9('0x46')],{});db['FaxTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{'foreignKey':'FromFaxAccountId','as':_0xcbf9('0x1e0')});db[_0xcbf9('0xe7')]['belongsTo'](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':'FromAgent'});db[_0xcbf9('0xe7')]['belongsTo'](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db['FaxTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x48')],{'foreignKey':_0xcbf9('0x1ea'),'as':_0xcbf9('0x1e6')});db['FaxTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{'foreignKey':_0xcbf9('0x1eb'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x188')],{});db['OpenchannelTransferReport'][_0xcbf9('0x11c')](db['OpenchannelInteraction'],{});db[_0xcbf9('0xe9')][_0xcbf9('0x11c')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0xcbf9('0x1e0')});db[_0xcbf9('0xe9')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db[_0xcbf9('0xe9')]['belongsTo'](db[_0xcbf9('0x59')],{'foreignKey':'ToOpenchannelQueueId','as':_0xcbf9('0x1e6')});db['OpenchannelTransferReport']['belongsTo'](db[_0xcbf9('0x13b')],{'foreignKey':'ToOpenchannelAccountId','as':_0xcbf9('0x1e8')});db['SmsTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x52')],{});db[_0xcbf9('0xeb')][_0xcbf9('0x11c')](db[_0xcbf9('0x50')],{});db['SmsTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x4c')],{'foreignKey':_0xcbf9('0x1ec'),'as':_0xcbf9('0x1e0')});db[_0xcbf9('0xeb')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':'FromAgent'});db['SmsTransferReport']['belongsTo'](db[_0xcbf9('0x10')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xcbf9('0xeb')][_0xcbf9('0x11c')](db[_0xcbf9('0x54')],{'foreignKey':_0xcbf9('0x1ed'),'as':_0xcbf9('0x1e6')});db[_0xcbf9('0xeb')][_0xcbf9('0x11c')](db[_0xcbf9('0x4c')],{'foreignKey':_0xcbf9('0x1ee'),'as':_0xcbf9('0x1e8')});db[_0xcbf9('0xed')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':'ListId','onDelete':_0xcbf9('0x109')});db[_0xcbf9('0xed')][_0xcbf9('0x10d')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xed')][_0xcbf9('0x10d')](db['CmContact'],{'as':_0xcbf9('0x122'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xed')][_0xcbf9('0x10d')](db[_0xcbf9('0x6d')],{'as':_0xcbf9('0x112'),'foreignKey':_0xcbf9('0x17b')});db['CmList']['hasMany'](db[_0xcbf9('0x6f')],{'as':_0xcbf9('0x113'),'foreignKey':_0xcbf9('0x17b')});db['CmList'][_0xcbf9('0x10d')](db[_0xcbf9('0x71')],{'as':_0xcbf9('0x71'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xed')][_0xcbf9('0x11e')](db[_0xcbf9('0x17')],{'as':_0xcbf9('0x1ef'),'through':_0xcbf9('0x1f0')});db[_0xcbf9('0xed')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':'cm_user_has_lists'});db[_0xcbf9('0xef')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'as':_0xcbf9('0x111'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0xef')][_0xcbf9('0x11e')](db['User'],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x12b')});db[_0xcbf9('0xef')][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x105'),'as':_0xcbf9('0x156')});db['UserProfile']['hasMany'](db['User'],{'as':'Users','foreignKey':_0xcbf9('0x11d')});db[_0xcbf9('0xf1')][_0xcbf9('0x10d')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0xcbf9('0x11d'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0xf2')][_0xcbf9('0x10d')](db[_0xcbf9('0xf4')],{'as':_0xcbf9('0x1f1'),'foreignKey':_0xcbf9('0x1f2'),'onDelete':_0xcbf9('0x109')});db['WhatsappAccount'][_0xcbf9('0x10d')](db['Disposition'],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x1f3'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0xf7')][_0xcbf9('0x10d')](db[_0xcbf9('0x184')],{'as':_0xcbf9('0x168'),'foreignKey':_0xcbf9('0x1f3')});db[_0xcbf9('0xf7')][_0xcbf9('0x10d')](db['WhatsappMessage'],{'as':_0xcbf9('0x158'),'foreignKey':_0xcbf9('0x1f3')});db[_0xcbf9('0xf7')][_0xcbf9('0x10d')](db[_0xcbf9('0x118')],{'as':'Interactions'});db['WhatsappAccount'][_0xcbf9('0x10d')](db[_0xcbf9('0x1f4')],{'as':_0xcbf9('0x16c')});db[_0xcbf9('0xf7')][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xf7')]['belongsTo'](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcbf9('0xf7')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x141')});db[_0xcbf9('0x1f4')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x1f4')][_0xcbf9('0x11c')](db['WhatsappQueue'],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x1f4')]['belongsTo'](db[_0xcbf9('0xf7')],{'onDelete':'restrict'});db[_0xcbf9('0x1f4')][_0xcbf9('0x11c')](db[_0xcbf9('0x7c')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x1f4')][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x179')});db[_0xcbf9('0x118')][_0xcbf9('0x10d')](db[_0xcbf9('0xfa')],{'as':_0xcbf9('0x158'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1f5')});db[_0xcbf9('0x118')][_0xcbf9('0x11c')](db[_0xcbf9('0xf7')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1f3')});db[_0xcbf9('0x118')]['belongsTo'](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':'ContactId'});db[_0xcbf9('0x118')]['belongsTo'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x172'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x118')]['belongsToMany'](db[_0xcbf9('0x84')],{'through':'whatsapp_interaction_has_tags','as':_0xcbf9('0x17f')});db[_0xcbf9('0x118')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xcbf9('0x118')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x128'),'foreignKey':_0xcbf9('0x1f5')});db['WhatsappMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':'User'});db[_0xcbf9('0xfa')]['belongsTo'](db['CmContact'],{'onDelete':_0xcbf9('0x109'),'as':'Contact'});db[_0xcbf9('0xfa')][_0xcbf9('0x11c')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xcbf9('0x18e'),'foreignKey':_0xcbf9('0x1f5')});db[_0xcbf9('0xfa')][_0xcbf9('0x11c')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xcbf9('0x1f3')});db[_0xcbf9('0xfc')][_0xcbf9('0x11c')](db[_0xcbf9('0xf7')],{});db['WhatsappQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db['WhatsappQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':'ContactId'});db[_0xcbf9('0xfc')][_0xcbf9('0x11c')](db[_0xcbf9('0x118')],{});db[_0xcbf9('0xfc')]['belongsTo'](db[_0xcbf9('0xff')],{});db[_0xcbf9('0xfc')][_0xcbf9('0x11c')](db[_0xcbf9('0xfa')],{});db[_0xcbf9('0xfc')][_0xcbf9('0x11c')](db['User'],{});db[_0xcbf9('0xfe')][_0xcbf9('0x11c')](db[_0xcbf9('0xfa')],{});db['WhatsappTransferReport'][_0xcbf9('0x11c')](db['WhatsappInteraction'],{});db[_0xcbf9('0xfe')][_0xcbf9('0x11c')](db['WhatsappAccount'],{'foreignKey':_0xcbf9('0x1f6'),'as':'FromAccount'});db[_0xcbf9('0xfe')][_0xcbf9('0x11c')](db[_0xcbf9('0xf7')],{'foreignKey':_0xcbf9('0x1f7'),'as':_0xcbf9('0x1e8')});db['WhatsappTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0xff')],{'foreignKey':_0xcbf9('0x1f8'),'as':'ToQueue'});db['WhatsappTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':_0xcbf9('0x1e2')});db[_0xcbf9('0xfe')]['belongsTo'](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db[_0xcbf9('0xff')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x33'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0xcbf9('0x11e')](db['Team'],{'through':_0xcbf9('0x1dc'),'as':'Teams'});db[_0xcbf9('0x108')][_0xcbf9('0x11c')](db['User'],{'as':_0xcbf9('0x1f9'),'foreignKey':_0xcbf9('0x10a'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db['CloudProvider'][_0xcbf9('0x10b')](db[_0xcbf9('0xb9')],{'as':_0xcbf9('0xb9'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x101')][_0xcbf9('0x10b')](db[_0xcbf9('0x35')],{'as':_0xcbf9('0x165'),'onDelete':'restrict'});db[_0xcbf9('0x101')][_0xcbf9('0x10b')](db[_0xcbf9('0x37')],{'as':_0xcbf9('0x166'),'onDelete':_0xcbf9('0x163')});module[_0xcbf9('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x01c9=['AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','UserProfile','UserProfileSection','UserProfileResource','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','UserVoicePrefix','hasOne','VoiceMail','UserId','userSetting','Recordings','hasMany','VoiceQueuesRt','Extensions','cascade','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','MailInteraction','MailInteractions','WhatsappInteraction','UserNotification','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueue','cm_user_has_lists','ChatWebsites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceExtension','Sounds','Members','Hoppers','VoiceQueueId','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','TeamVoiceQueue','Messages','mailboxuser','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','Applications','List','ListId','Template','Agents','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','ThroughTags','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','Dashboard','FaxAccountId','Exntensions','user_has_fax_accounts','FaxApplication','FaxMessage','FaxInteractionId','fax_interaction_has_tags','Tags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','user_has_chat_websites','OpenchannelQueueReport','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','chat_group_has_users','CmCompany','CompanyId','FaxInteractions','Company','cm_contact_has_tags','Agent','Queue','Campaign','CampaignId','OwnerId','AutomationAllId','Any','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','CustomReportId','MetricId','SalesforceConfiguration','Configurations','AccountId','SalesforceField','DescriptionId','FieldId','Subject','SubjectId','Description','VariableId','SugarcrmAccount','Descriptions','SugarcrmField','Field','Subjects','DeskConfiguration','int_desk_configuration_has_tags','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowConfiguration','Dynamics365Field','FreshsalesField','ChatQueueReport','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','SmsQueues','team_has_openchannel_queues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','TeamVoicePrefix','HopperBlacks','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToChatQueueId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','HopperHistory','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','UserSetting','exports','../config/environment','sequelize','jstz','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','xC@LL1234','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','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','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','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','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model'];(function(_0x3a75a1,_0x18842d){var _0x1f9f87=function(_0x1f21c2){while(--_0x1f21c2){_0x3a75a1['push'](_0x3a75a1['shift']());}};_0x1f9f87(++_0x18842d);}(_0x01c9,0x158));var _0x901c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01c9[_0x20a584];return _0x4b41a8;};'use strict';var config=require(_0x901c('0x0'));var Sequelize=require(_0x901c('0x1'));var _=require('lodash');var jstz=require(_0x901c('0x2'));var timezone=jstz['determine']();config['sequelize']=_['defaultsDeep'](config[_0x901c('0x1')],{'database':_0x901c('0x3'),'username':_0x901c('0x4'),'password':'xC@LL1234','options':{'host':_0x901c('0x5'),'port':0xcea,'dialect':_0x901c('0x6'),'dialectOptions':{'charset':_0x901c('0x7')},'logging':![],'timezone':timezone[_0x901c('0x8')](),'define':{'charset':_0x901c('0x9'),'collate':_0x901c('0xa')}}});config[_0x901c('0xb')]=_[_0x901c('0xc')](config[_0x901c('0xb')],{'database':_0x901c('0x3'),'username':_0x901c('0x4'),'password':_0x901c('0xd'),'options':{'host':_0x901c('0x5'),'port':0xcea,'dialect':_0x901c('0x6'),'dialectOptions':{'charset':_0x901c('0x7')},'logging':![],'timezone':timezone[_0x901c('0x8')](),'define':{'charset':_0x901c('0x9'),'collate':_0x901c('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x901c('0x1')][_0x901c('0xe')],config['sequelize'][_0x901c('0xf')],config[_0x901c('0x1')][_0x901c('0x10')],config[_0x901c('0x1')][_0x901c('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x901c('0xb')][_0x901c('0xf')],config[_0x901c('0xb')][_0x901c('0x10')],config[_0x901c('0xb')][_0x901c('0x11')])};db[_0x901c('0x12')]=db['sequelize'][_0x901c('0x13')]('../api/user/user.model');db[_0x901c('0x14')]=db[_0x901c('0x1')]['import'](_0x901c('0x15'));db[_0x901c('0x16')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x17'));db['VoiceExtension']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x18'));db[_0x901c('0x19')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x1a'));db[_0x901c('0x1b')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x1c'));db[_0x901c('0x1d')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x1e'));db['ScreenRecording']=db[_0x901c('0x1')]['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x1f'));db[_0x901c('0x20')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x21'));db[_0x901c('0x22')]=db[_0x901c('0x1')]['import'](_0x901c('0x23'));db[_0x901c('0x24')]=db[_0x901c('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x901c('0x25')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x26'));db[_0x901c('0x27')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x28'));db[_0x901c('0x29')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x2a'));db[_0x901c('0x2b')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x2c'));db[_0x901c('0x2d')]=db['sequelize']['import'](_0x901c('0x2e'));db[_0x901c('0x2f')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x30'));db[_0x901c('0x31')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x32'));db[_0x901c('0x33')]=db['sequelize']['import'](_0x901c('0x34'));db[_0x901c('0x35')]=db[_0x901c('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x901c('0x36')]=db[_0x901c('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x901c('0x37')]=db[_0x901c('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x901c('0x38')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x901c('0x39')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x3a'));db[_0x901c('0x3b')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x901c('0x3c')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x3d'));db[_0x901c('0x3e')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x3f'));db[_0x901c('0x40')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x41'));db[_0x901c('0x42')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x43'));db[_0x901c('0x44')]=db[_0x901c('0x1')]['import']('../api/mailApplication/mailApplication.model');db[_0x901c('0x45')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x46'));db['Dashboard']=db['sequelize'][_0x901c('0x13')](_0x901c('0x47'));db[_0x901c('0x48')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x901c('0x49')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x4a'));db['FaxApplication']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x4b'));db[_0x901c('0x4c')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x4d'));db['FaxMessage']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x4e'));db[_0x901c('0x4f')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x50'));db['FaxQueueReport']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x51'));db[_0x901c('0x52')]=db['sequelize']['import'](_0x901c('0x53'));db[_0x901c('0x54')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x55'));db[_0x901c('0x56')]=db['sequelize'][_0x901c('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0x901c('0x57')]=db['sequelize']['import'](_0x901c('0x58'));db['SmsQueue']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x59'));db[_0x901c('0x5a')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x5b'));db[_0x901c('0x5c')]=db['sequelize']['import'](_0x901c('0x5d'));db[_0x901c('0x5e')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x5f'));db['OpenchannelMessage']=db['sequelize'][_0x901c('0x13')](_0x901c('0x60'));db[_0x901c('0x61')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x62'));db[_0x901c('0x63')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x64'));db['OpenchannelQueueReport']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x65'));db[_0x901c('0x66')]=db[_0x901c('0x1')]['import'](_0x901c('0x67'));db['ChatInteraction']=db[_0x901c('0x1')]['import'](_0x901c('0x68'));db[_0x901c('0x69')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x6a'));db['ChatOfflineMessage']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x6b'));db[_0x901c('0x6c')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x6d'));db[_0x901c('0x6e')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x6f'));db[_0x901c('0x70')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x71'));db['CmCompany']=db[_0x901c('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0x901c('0x72')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/cmContact/cmContact.model');db[_0x901c('0x73')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x74'));db[_0x901c('0x75')]=db['sequelize'][_0x901c('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x901c('0x76')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x77'));db['CmHopperHistory']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x78'));db[_0x901c('0x79')]=db[_0x901c('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x7a'));db[_0x901c('0x7b')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x7c'));db[_0x901c('0x7d')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x7e'));db[_0x901c('0x7f')]=db['sequelize']['import'](_0x901c('0x80'));db[_0x901c('0x81')]=db[_0x901c('0x1')]['import'](_0x901c('0x82'));db[_0x901c('0x83')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x84'));db['Interval']=db['sequelize']['import']('../api/interval/interval.model');db[_0x901c('0x85')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/pause/pause.model');db['Cdr']=db['sequelize'][_0x901c('0x13')](_0x901c('0x86'));db[_0x901c('0x87')]=db['sequelize']['import'](_0x901c('0x88'));db[_0x901c('0x89')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x8a'));db[_0x901c('0x8b')]=db[_0x901c('0x1')]['import'](_0x901c('0x8c'));db[_0x901c('0x8d')]=db['sequelize'][_0x901c('0x13')]('../api/tag/tag.model');db['Template']=db[_0x901c('0x1')]['import']('../api/template/template.model');db[_0x901c('0x8e')]=db[_0x901c('0x1')]['import'](_0x901c('0x8f'));db[_0x901c('0x90')]=db['sequelize']['import'](_0x901c('0x91'));db[_0x901c('0x92')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x93'));db[_0x901c('0x94')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x95'));db[_0x901c('0x96')]=db[_0x901c('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x901c('0x97')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x98'));db[_0x901c('0x99')]=db['sequelize'][_0x901c('0x13')](_0x901c('0x9a'));db[_0x901c('0x9b')]=db['sequelize'][_0x901c('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x901c('0x9c')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x9d'));db[_0x901c('0x9e')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0x9f'));db[_0x901c('0xa0')]=db['sequelize']['import'](_0x901c('0xa1'));db['SalesforceConfiguration']=db[_0x901c('0x1')][_0x901c('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x901c('0x1')][_0x901c('0x13')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db['sequelize'][_0x901c('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x901c('0xa2')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xa3'));db['SugarcrmField']=db['sequelize'][_0x901c('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x901c('0xa4')]=db[_0x901c('0x1')]['import'](_0x901c('0xa5'));db['DeskConfiguration']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xa6'));db[_0x901c('0xa7')]=db['sequelize'][_0x901c('0x13')]('../api/intDeskField/intDeskField.model');db[_0x901c('0xa8')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xa9'));db[_0x901c('0xaa')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xab'));db[_0x901c('0xac')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xad'));db[_0x901c('0xae')]=db[_0x901c('0x1')]['import'](_0x901c('0xaf'));db['ZendeskConfiguration']=db['sequelize'][_0x901c('0x13')](_0x901c('0xb0'));db['ZendeskField']=db['sequelize'][_0x901c('0x13')](_0x901c('0xb1'));db[_0x901c('0xb2')]=db['sequelize'][_0x901c('0x13')](_0x901c('0xb3'));db[_0x901c('0xb4')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xb5'));db[_0x901c('0xb6')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xb7'));db[_0x901c('0xb8')]=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x901c('0xb9')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xba'));db['VtigerField']=db['sequelize']['import']('../api/intVtigerField/intVtigerField.model');db[_0x901c('0xbb')]=db[_0x901c('0x1')]['import'](_0x901c('0xbc'));db['ServicenowConfiguration']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xbd'));db[_0x901c('0xbe')]=db[_0x901c('0x1')]['import'](_0x901c('0xbf'));db[_0x901c('0xc0')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xc1'));db[_0x901c('0xc2')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0x901c('0x1')]['import'](_0x901c('0xc3'));db[_0x901c('0xc4')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xc5'));db[_0x901c('0xc6')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xc7'));db['FreshsalesField']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xc8'));db[_0x901c('0x92')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/integration/integration.model');db[_0x901c('0xc9')]=db['sequelize'][_0x901c('0x13')](_0x901c('0xca'));db['ChatQueueReport']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xcb'));db[_0x901c('0xcc')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xcd'));db[_0x901c('0xce')]=db['sequelize'][_0x901c('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0x901c('0x1')]['import'](_0x901c('0xcf'));db['JscriptySessionReport']=db['sequelize'][_0x901c('0x13')](_0x901c('0xd0'));db['SmsQueueReport']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xd1'));db[_0x901c('0xd2')]=db[_0x901c('0x1')]['import'](_0x901c('0xd3'));db[_0x901c('0xd4')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xd5'));db[_0x901c('0xd6')]=db[_0x901c('0x1')]['import'](_0x901c('0xd7'));db[_0x901c('0xd8')]=db['sequelize'][_0x901c('0x13')](_0x901c('0xd9'));db['SquareOdbc']=db[_0x901c('0x1')][_0x901c('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x901c('0xda')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xdb'));db['SquareRecording']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xdc'));db[_0x901c('0xdd')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xde'));db['Team']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xdf'));db['License']=db[_0x901c('0x1')][_0x901c('0x13')]('../api/license/license.model');db['Campaign']=db[_0x901c('0x1')][_0x901c('0x13')]('../api/campaign/campaign.model');db['Migration']=db[_0x901c('0x1')]['import'](_0x901c('0xe0'));db[_0x901c('0xe1')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xe2'));db[_0x901c('0xe3')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xe4'));db[_0x901c('0xe5')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xe6'));db[_0x901c('0xe7')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x901c('0x1')][_0x901c('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x901c('0xe8')]=db[_0x901c('0x1')]['import'](_0x901c('0xe9'));db[_0x901c('0xea')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xeb'));db[_0x901c('0xec')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x901c('0x1')][_0x901c('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x901c('0xed')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/userProfile/userProfile.model');db[_0x901c('0xee')]=db['sequelize'][_0x901c('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0x901c('0xef')]=db['sequelize'][_0x901c('0x13')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db[_0x901c('0x1')][_0x901c('0x13')]('../api/userNotification/userNotification.model');db[_0x901c('0xf0')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/whatsappAccount/whatsappAccount.model');db[_0x901c('0xf1')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xf2'));db['WhatsappInteraction']=db[_0x901c('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x901c('0xf3')]=db['sequelize'][_0x901c('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x901c('0xf4')]=db[_0x901c('0x1')][_0x901c('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x901c('0xf5')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xf6'));db[_0x901c('0xf7')]=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xf8'));db[_0x901c('0xf9')]=db[_0x901c('0x1')]['import'](_0x901c('0xfa'));db['TeamVoiceQueue']=db[_0x901c('0x1')][_0x901c('0x13')](_0x901c('0xfb'));db['TeamVoicePrefix']=db[_0x901c('0x1')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x901c('0xfc')]=db['sequelize'][_0x901c('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0x901c('0x1')][_0x901c('0x13')]('../api/user-setting/user-setting.model');db[_0x901c('0x12')][_0x901c('0xfd')](db[_0x901c('0xfe')],{'as':_0x901c('0xfe'),'onDelete':'cascade','foreignKey':_0x901c('0xff')});db[_0x901c('0x12')][_0x901c('0xfd')](db['UserSetting'],{'as':_0x901c('0x100'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x901c('0x12')]['hasMany'](db[_0x901c('0x1d')],{'as':_0x901c('0x101'),'foreignKey':_0x901c('0xff')});db[_0x901c('0x12')][_0x901c('0x102')](db[_0x901c('0x2d')],{'as':_0x901c('0x103'),'foreignKey':_0x901c('0xff')});db[_0x901c('0x12')]['hasMany'](db['VoiceExtension'],{'as':_0x901c('0x104'),'onDelete':_0x901c('0x105'),'hooks':!![]});db[_0x901c('0x12')]['hasMany'](db[_0x901c('0x76')],{'as':_0x901c('0x106'),'foreignKey':'UserId'});db[_0x901c('0x12')][_0x901c('0x102')](db[_0x901c('0x107')],{'as':'HopperHistory','foreignKey':_0x901c('0xff')});db[_0x901c('0x12')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x901c('0xff')});db[_0x901c('0x12')][_0x901c('0x102')](db[_0x901c('0x5e')],{'as':_0x901c('0x108'),'foreignKey':_0x901c('0xff')});db['User'][_0x901c('0x102')](db[_0x901c('0x109')],{'as':_0x901c('0x10a'),'foreignKey':'UserId'});db['User'][_0x901c('0x102')](db[_0x901c('0x56')],{'as':_0x901c('0x10b'),'foreignKey':_0x901c('0xff')});db[_0x901c('0x12')][_0x901c('0x102')](db[_0x901c('0x4c')],{'as':'FaxInteractions','foreignKey':_0x901c('0xff')});db[_0x901c('0x12')]['hasMany'](db[_0x901c('0x10c')],{'as':_0x901c('0x10d'),'foreignKey':_0x901c('0xff')});db[_0x901c('0x12')][_0x901c('0x102')](db[_0x901c('0x10e')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x901c('0x12')][_0x901c('0x102')](db[_0x901c('0x10f')],{'as':_0x901c('0x110'),'foreignKey':_0x901c('0x111')});db['User'][_0x901c('0x112')](db['UserProfile'],{'as':_0x901c('0xed'),'foreignKey':'userProfileId'});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x6e')],{'as':_0x901c('0x114'),'through':'chat_group_has_users'});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x72')],{'as':_0x901c('0x115'),'through':_0x901c('0x116')});db['User'][_0x901c('0x113')](db[_0x901c('0xec')],{'as':_0x901c('0x117'),'through':'cm_user_has_lists'});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x118')],{'through':_0x901c('0x119')});db[_0x901c('0x12')]['belongsToMany'](db[_0x901c('0x10c')],{'as':'MailInteractions','through':_0x901c('0x11a')});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x109')],{'as':'ChatInteractions','through':_0x901c('0x11b')});db['User']['belongsToMany'](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x901c('0x11c')});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x56')],{'as':_0x901c('0x10b'),'through':'user_has_sms_interactions'});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x5e')],{'as':_0x901c('0x108'),'through':_0x901c('0x11d')});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x10e')],{'as':_0x901c('0x11e'),'through':_0x901c('0x11f')});db[_0x901c('0x12')]['belongsToMany'](db[_0x901c('0x1b')],{'as':_0x901c('0x120'),'through':_0x901c('0x2f'),'required':![]});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x121')],{'as':_0x901c('0x122'),'through':_0x901c('0xfc'),'required':![]});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x3e')],{'as':_0x901c('0x123'),'through':_0x901c('0x33'),'required':![]});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x6c')],{'as':_0x901c('0x124'),'through':_0x901c('0x31'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0x901c('0x4f')],{'as':_0x901c('0x125'),'through':_0x901c('0x35'),'required':![]});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x126')],{'as':'SmsQueues','through':_0x901c('0x36'),'required':![]});db['User'][_0x901c('0x113')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x901c('0x37'),'required':![]});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0xf7')],{'as':'WhatsappQueues','through':_0x901c('0x38'),'required':![]});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0xec')],{'through':_0x901c('0x127')});db['User'][_0x901c('0x113')](db[_0x901c('0x63')],{'as':_0x901c('0x128'),'through':'user_has_chat_websites'});db['User'][_0x901c('0x113')](db[_0x901c('0x49')],{'as':_0x901c('0x129'),'through':'user_has_fax_accounts'});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x3c')],{'as':_0x901c('0x12a'),'through':_0x901c('0x12b')});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x5a')],{'as':_0x901c('0x12c'),'through':_0x901c('0x12d')});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0x52')],{'as':_0x901c('0x12e'),'through':'user_has_sms_accounts'});db[_0x901c('0x12')][_0x901c('0x113')](db[_0x901c('0xf0')],{'as':_0x901c('0x12f'),'through':_0x901c('0x130')});db[_0x901c('0x12')][_0x901c('0x113')](db['SquareProject'],{'as':_0x901c('0x131'),'through':_0x901c('0x132')});db['VoiceChanSpy'][_0x901c('0x102')](db[_0x901c('0x133')],{'as':'SpiedAgents','onDelete':_0x901c('0x105'),'foreignKey':'ChanSpyId'});db[_0x901c('0x16')][_0x901c('0x102')](db[_0x901c('0x133')],{'onDelete':_0x901c('0x105')});db[_0x901c('0x133')][_0x901c('0x102')](db[_0x901c('0x133')],{'as':'Applications','onDelete':_0x901c('0x105')});db['VoiceMusicOnHold'][_0x901c('0x113')](db[_0x901c('0x8b')],{'as':_0x901c('0x134'),'through':'moh_has_sounds'});db[_0x901c('0x1b')][_0x901c('0x102')](db[_0x901c('0x2d')],{'as':_0x901c('0x135'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x901c('0x102')](db[_0x901c('0x73')],{'as':_0x901c('0x136'),'foreignKey':'VoiceQueueId'});db[_0x901c('0x1b')][_0x901c('0x102')](db['CmHopperFinal'],{'as':_0x901c('0x106'),'foreignKey':_0x901c('0x137')});db[_0x901c('0x1b')][_0x901c('0x102')](db[_0x901c('0x107')],{'as':_0x901c('0x138'),'foreignKey':'VoiceQueueId'});db[_0x901c('0x1b')][_0x901c('0x102')](db['ReportAgentPreview'],{'as':_0x901c('0x79'),'foreignKey':_0x901c('0x137')});db[_0x901c('0x1b')][_0x901c('0x102')](db[_0x901c('0x75')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x901c('0x1b')][_0x901c('0x102')](db[_0x901c('0x139')],{'as':_0x901c('0x13a'),'foreignKey':_0x901c('0x137')});db[_0x901c('0x1b')][_0x901c('0x112')](db[_0x901c('0x29')],{'as':_0x901c('0x29'),'foreignKey':_0x901c('0x13b')});db[_0x901c('0x1b')]['belongsTo'](db[_0x901c('0x29')],{'as':_0x901c('0x13c'),'foreignKey':'TrunkBackupId'});db[_0x901c('0x1b')][_0x901c('0x112')](db[_0x901c('0x13d')],{'as':_0x901c('0x13d'),'foreignKey':_0x901c('0x13e')});db[_0x901c('0x1b')][_0x901c('0x112')](db[_0x901c('0x85')],{'as':_0x901c('0x13f'),'foreignKey':_0x901c('0x140')});db[_0x901c('0x1b')][_0x901c('0x113')](db[_0x901c('0xec')],{'as':_0x901c('0x117'),'through':_0x901c('0x141')});db[_0x901c('0x1b')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':'Agents','through':_0x901c('0x2f')});db['VoiceQueue']['belongsToMany'](db[_0x901c('0x118')],{'as':_0x901c('0x142'),'through':_0x901c('0x143')});db['VoiceQueue']['belongsToMany'](db[_0x901c('0xec')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x901c('0x1d')][_0x901c('0x112')](db['User'],{'as':_0x901c('0x12'),'foreignKey':_0x901c('0xff')});db['ScreenRecording'][_0x901c('0x112')](db[_0x901c('0x12')],{'as':'User','foreignKey':_0x901c('0xff')});db[_0x901c('0xfe')][_0x901c('0x102')](db['VoiceMailMessage'],{'as':_0x901c('0x144'),'onDelete':_0x901c('0x105'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db[_0x901c('0xfe')],{'foreignKey':_0x901c('0x145'),'targetKey':'mailbox'});db[_0x901c('0x22')]['hasMany'](db[_0x901c('0x146')],{'as':_0x901c('0x147'),'foreignKey':_0x901c('0x148'),'constraints':![]});db[_0x901c('0x22')]['hasMany'](db[_0x901c('0x25')],{'as':_0x901c('0x149'),'foreignKey':'uniqueid','constraints':![]});db[_0x901c('0x22')][_0x901c('0x112')](db['User'],{'as':'User','foreignKey':'UserId'});db[_0x901c('0x22')][_0x901c('0x112')](db[_0x901c('0x72')],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db['MailServerIn'][_0x901c('0x112')](db[_0x901c('0x3c')],{'as':_0x901c('0x3c'),'foreignKey':_0x901c('0x14c')});db[_0x901c('0x39')][_0x901c('0x112')](db[_0x901c('0xf9')],{'as':_0x901c('0xf9'),'foreignKey':_0x901c('0x14d'),'onDelete':_0x901c('0x14e')});db[_0x901c('0x3b')][_0x901c('0x112')](db[_0x901c('0x3c')],{'as':_0x901c('0x3c'),'foreignKey':'MailAccountId'});db[_0x901c('0x3b')][_0x901c('0x112')](db[_0x901c('0xf9')],{'as':_0x901c('0xf9'),'foreignKey':_0x901c('0x14d'),'onDelete':_0x901c('0x14e')});db[_0x901c('0x3c')][_0x901c('0xfd')](db[_0x901c('0x39')],{'as':_0x901c('0x14f'),'onDelete':_0x901c('0x105')});db[_0x901c('0x3c')]['hasOne'](db[_0x901c('0x3b')],{'as':_0x901c('0x150'),'onDelete':_0x901c('0x105')});db[_0x901c('0x3c')][_0x901c('0x102')](db[_0x901c('0x81')],{'as':_0x901c('0x151'),'foreignKey':_0x901c('0x14c'),'onDelete':_0x901c('0x105')});db[_0x901c('0x3c')]['hasMany'](db[_0x901c('0x7f')],{'as':_0x901c('0x152'),'foreignKey':_0x901c('0x14c')});db['MailAccount']['hasMany'](db[_0x901c('0x42')],{'as':_0x901c('0x144'),'foreignKey':_0x901c('0x14c')});db[_0x901c('0x3c')][_0x901c('0x102')](db[_0x901c('0x10c')],{'as':_0x901c('0x153')});db[_0x901c('0x3c')][_0x901c('0x102')](db[_0x901c('0x44')],{'as':_0x901c('0x154')});db[_0x901c('0x3c')][_0x901c('0x112')](db[_0x901c('0xec')],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156')});db[_0x901c('0x3c')][_0x901c('0x112')](db[_0x901c('0x157')],{'as':'Template','foreignKey':'TemplateId'});db[_0x901c('0x3c')][_0x901c('0x112')](db[_0x901c('0x85')],{'as':_0x901c('0x13f'),'foreignKey':_0x901c('0x140')});db[_0x901c('0x3c')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':'Agents','through':_0x901c('0x12b')});db[_0x901c('0x3e')]['belongsToMany'](db[_0x901c('0x12')],{'as':_0x901c('0x158'),'through':_0x901c('0x33')});db[_0x901c('0x3e')][_0x901c('0x113')](db[_0x901c('0x118')],{'through':_0x901c('0x159'),'as':_0x901c('0x142')});db[_0x901c('0x10c')][_0x901c('0x102')](db[_0x901c('0x42')],{'as':'Messages','onDelete':_0x901c('0x105'),'foreignKey':'MailInteractionId'});db[_0x901c('0x10c')][_0x901c('0x112')](db[_0x901c('0x3c')],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x14c')});db['MailInteraction']['belongsTo'](db[_0x901c('0x72')],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db[_0x901c('0x10c')][_0x901c('0x112')](db[_0x901c('0x12')],{'as':_0x901c('0x15b'),'foreignKey':_0x901c('0xff')});db['MailInteraction'][_0x901c('0x113')](db['Tag'],{'through':_0x901c('0x15c'),'as':'Tags'});db[_0x901c('0x10c')][_0x901c('0x113')](db[_0x901c('0x8d')],{'through':'mail_interaction_has_tags','as':_0x901c('0x15d')});db[_0x901c('0x10c')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':'Users','through':_0x901c('0x11a'),'foreignKey':_0x901c('0x15e')});db[_0x901c('0x42')][_0x901c('0x102')](db[_0x901c('0xe1')],{'as':_0x901c('0x15f'),'onDelete':_0x901c('0x105')});db[_0x901c('0x42')][_0x901c('0x112')](db[_0x901c('0x12')],{'as':_0x901c('0x12')});db[_0x901c('0x42')][_0x901c('0x112')](db[_0x901c('0x72')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x14a')});db[_0x901c('0x42')]['belongsTo'](db[_0x901c('0x10c')],{'as':_0x901c('0x160'),'foreignKey':_0x901c('0x15e')});db[_0x901c('0x42')]['belongsTo'](db['MailAccount'],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x14c')});db[_0x901c('0x42')][_0x901c('0x112')](db[_0x901c('0x63')],{'as':_0x901c('0x63'),'foreignKey':_0x901c('0x161')});db[_0x901c('0x42')][_0x901c('0x112')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x901c('0x162')});db[_0x901c('0x44')][_0x901c('0x112')](db[_0x901c('0x12')],{'onDelete':_0x901c('0x14e')});db['MailApplication'][_0x901c('0x112')](db[_0x901c('0x3e')],{'onDelete':'restrict'});db[_0x901c('0x44')][_0x901c('0x112')](db[_0x901c('0x3c')],{'onDelete':_0x901c('0x14e')});db['MailApplication'][_0x901c('0x112')](db[_0x901c('0x13d')],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x13e')});db[_0x901c('0x44')][_0x901c('0x112')](db[_0x901c('0x8d')],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x163')});db['MailQueueReport'][_0x901c('0x112')](db[_0x901c('0x3c')],{});db[_0x901c('0x45')]['belongsTo'](db['CmList'],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156')});db[_0x901c('0x45')]['belongsTo'](db['CmContact'],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db['MailQueueReport'][_0x901c('0x112')](db[_0x901c('0x10c')],{});db[_0x901c('0x45')][_0x901c('0x112')](db[_0x901c('0x42')],{});db[_0x901c('0x45')]['belongsTo'](db[_0x901c('0x12')],{});db[_0x901c('0x45')][_0x901c('0x112')](db['MailQueue'],{});db[_0x901c('0x164')][_0x901c('0x102')](db[_0x901c('0x48')],{'as':'Items','onDelete':_0x901c('0x105')});db[_0x901c('0x49')][_0x901c('0x102')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x901c('0x165'),'onDelete':'cascade'});db[_0x901c('0x49')][_0x901c('0x102')](db[_0x901c('0x7f')],{'as':'Answers','foreignKey':_0x901c('0x165')});db[_0x901c('0x49')][_0x901c('0x102')](db[_0x901c('0x4c')],{'as':_0x901c('0x153')});db['FaxAccount'][_0x901c('0x102')](db['FaxApplication'],{'as':_0x901c('0x154')});db[_0x901c('0x49')][_0x901c('0x102')](db[_0x901c('0x133')],{'as':_0x901c('0x166'),'onDelete':_0x901c('0x105')});db[_0x901c('0x49')][_0x901c('0x102')](db['FaxMessage'],{'as':_0x901c('0x144')});db[_0x901c('0x49')]['belongsTo'](db['Trunk'],{'as':_0x901c('0x29')});db[_0x901c('0x49')][_0x901c('0x112')](db[_0x901c('0xec')],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156')});db[_0x901c('0x49')][_0x901c('0x112')](db[_0x901c('0x85')],{'as':_0x901c('0x13f'),'foreignKey':_0x901c('0x140')});db[_0x901c('0x49')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':_0x901c('0x158'),'through':_0x901c('0x167')});db['FaxApplication'][_0x901c('0x112')](db[_0x901c('0x12')],{'onDelete':_0x901c('0x14e')});db['FaxApplication'][_0x901c('0x112')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x901c('0x168')][_0x901c('0x112')](db[_0x901c('0x49')],{'onDelete':_0x901c('0x14e')});db['FaxApplication'][_0x901c('0x112')](db['Tag'],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x163')});db['FaxInteraction'][_0x901c('0x102')](db[_0x901c('0x169')],{'as':_0x901c('0x144'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x16a')});db[_0x901c('0x4c')][_0x901c('0x112')](db[_0x901c('0x49')],{'as':_0x901c('0x15a'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x901c('0x112')](db['CmContact'],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db[_0x901c('0x4c')][_0x901c('0x112')](db['User'],{'as':'Owner','foreignKey':_0x901c('0xff')});db[_0x901c('0x4c')][_0x901c('0x113')](db['Tag'],{'through':_0x901c('0x16b'),'as':_0x901c('0x16c')});db[_0x901c('0x4c')]['belongsToMany'](db[_0x901c('0x8d')],{'through':_0x901c('0x16b'),'as':_0x901c('0x15d')});db[_0x901c('0x4c')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':_0x901c('0x16d'),'through':_0x901c('0x11c'),'foreignKey':_0x901c('0x16a')});db[_0x901c('0x169')][_0x901c('0x112')](db[_0x901c('0x12')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x12')});db[_0x901c('0x169')][_0x901c('0x112')](db[_0x901c('0x4c')],{'as':_0x901c('0x160'),'foreignKey':_0x901c('0x16a')});db[_0x901c('0x169')][_0x901c('0x112')](db[_0x901c('0x72')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x14a')});db[_0x901c('0x169')][_0x901c('0x112')](db[_0x901c('0xe1')],{'as':_0x901c('0xe1'),'foreignKey':_0x901c('0x16e')});db[_0x901c('0x169')]['belongsTo'](db[_0x901c('0x49')],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x165')});db[_0x901c('0x4f')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':_0x901c('0x158'),'through':_0x901c('0x35')});db[_0x901c('0x4f')][_0x901c('0x113')](db['Team'],{'through':_0x901c('0x16f'),'as':'Teams'});db[_0x901c('0x170')][_0x901c('0x112')](db[_0x901c('0x49')],{});db[_0x901c('0x170')]['belongsTo'](db[_0x901c('0xec')],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156')});db['FaxQueueReport'][_0x901c('0x112')](db[_0x901c('0x72')],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db[_0x901c('0x170')][_0x901c('0x112')](db[_0x901c('0x4c')],{});db['FaxQueueReport'][_0x901c('0x112')](db[_0x901c('0x169')],{});db[_0x901c('0x170')][_0x901c('0x112')](db[_0x901c('0x12')],{});db['FaxQueueReport'][_0x901c('0x112')](db[_0x901c('0x4f')],{});db[_0x901c('0x52')]['hasMany'](db[_0x901c('0x81')],{'as':_0x901c('0x151'),'foreignKey':'SmsAccountId','onDelete':_0x901c('0x105')});db[_0x901c('0x52')][_0x901c('0x102')](db['CannedAnswer'],{'as':_0x901c('0x152'),'foreignKey':'SmsAccountId'});db[_0x901c('0x52')][_0x901c('0x102')](db[_0x901c('0x57')],{'as':_0x901c('0x144'),'foreignKey':_0x901c('0x171')});db[_0x901c('0x52')][_0x901c('0x102')](db[_0x901c('0x56')],{'as':'Interactions'});db[_0x901c('0x52')]['hasMany'](db[_0x901c('0x54')],{'as':_0x901c('0x154')});db[_0x901c('0x52')][_0x901c('0x112')](db[_0x901c('0xec')],{'as':_0x901c('0x155'),'foreignKey':'ListId'});db[_0x901c('0x52')][_0x901c('0x112')](db[_0x901c('0x85')],{'as':_0x901c('0x13f'),'foreignKey':_0x901c('0x140')});db[_0x901c('0x52')]['belongsToMany'](db[_0x901c('0x12')],{'as':_0x901c('0x158'),'through':_0x901c('0x172')});db[_0x901c('0x54')][_0x901c('0x112')](db[_0x901c('0x12')],{'onDelete':_0x901c('0x14e')});db[_0x901c('0x54')][_0x901c('0x112')](db[_0x901c('0x126')],{'onDelete':_0x901c('0x14e')});db[_0x901c('0x54')][_0x901c('0x112')](db[_0x901c('0x52')],{'onDelete':_0x901c('0x14e')});db[_0x901c('0x54')][_0x901c('0x112')](db['Interval'],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x13e')});db['SmsApplication'][_0x901c('0x112')](db['Tag'],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x163')});db[_0x901c('0x56')][_0x901c('0x102')](db[_0x901c('0x57')],{'as':_0x901c('0x144'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x173')});db[_0x901c('0x56')][_0x901c('0x112')](db[_0x901c('0x52')],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x171')});db[_0x901c('0x56')][_0x901c('0x112')](db[_0x901c('0x72')],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db[_0x901c('0x56')][_0x901c('0x112')](db[_0x901c('0x12')],{'as':'Owner','foreignKey':_0x901c('0xff')});db[_0x901c('0x56')]['belongsToMany'](db[_0x901c('0x8d')],{'through':_0x901c('0x174'),'as':_0x901c('0x16c')});db[_0x901c('0x56')][_0x901c('0x113')](db[_0x901c('0x8d')],{'through':'sms_interaction_has_tags','as':_0x901c('0x15d')});db[_0x901c('0x56')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':'Users','through':_0x901c('0x175'),'foreignKey':_0x901c('0x173')});db[_0x901c('0x57')]['belongsTo'](db[_0x901c('0x12')],{'as':_0x901c('0x12')});db[_0x901c('0x57')][_0x901c('0x112')](db[_0x901c('0x72')],{'onDelete':_0x901c('0x105'),'as':'Contact'});db[_0x901c('0x57')][_0x901c('0x112')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x901c('0x160'),'foreignKey':_0x901c('0x173')});db['SmsMessage']['belongsTo'](db[_0x901c('0x52')],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x171')});db[_0x901c('0x126')]['belongsToMany'](db[_0x901c('0x12')],{'as':'Agents','through':_0x901c('0x36'),'foreignKey':_0x901c('0x176')});db[_0x901c('0x126')][_0x901c('0x113')](db[_0x901c('0x118')],{'through':_0x901c('0x177'),'as':_0x901c('0x142')});db[_0x901c('0x5a')]['hasMany'](db[_0x901c('0x81')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0x901c('0x105')});db[_0x901c('0x5a')][_0x901c('0x102')](db[_0x901c('0x7f')],{'as':_0x901c('0x152'),'foreignKey':_0x901c('0x178')});db['OpenchannelAccount'][_0x901c('0x102')](db[_0x901c('0x5e')],{'as':_0x901c('0x153'),'foreignKey':_0x901c('0x178')});db[_0x901c('0x5a')][_0x901c('0x102')](db[_0x901c('0x179')],{'as':_0x901c('0x144'),'foreignKey':_0x901c('0x178')});db['OpenchannelAccount'][_0x901c('0x102')](db[_0x901c('0x5c')],{'as':_0x901c('0x154'),'foreignKey':_0x901c('0x178')});db[_0x901c('0x5a')][_0x901c('0x112')](db['CmList'],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156')});db[_0x901c('0x5a')][_0x901c('0x112')](db[_0x901c('0x85')],{'as':_0x901c('0x13f'),'foreignKey':_0x901c('0x140')});db[_0x901c('0x5a')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':_0x901c('0x158'),'through':_0x901c('0x12d')});db[_0x901c('0x5c')]['belongsTo'](db[_0x901c('0x12')],{'onDelete':_0x901c('0x14e')});db[_0x901c('0x5c')][_0x901c('0x112')](db[_0x901c('0x61')],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x17a')});db[_0x901c('0x5c')][_0x901c('0x112')](db['OpenchannelAccount'],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x178')});db[_0x901c('0x5c')]['belongsTo'](db['Interval'],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x13e')});db['OpenchannelApplication'][_0x901c('0x112')](db['Tag'],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x163')});db['OpenchannelInteraction'][_0x901c('0x102')](db[_0x901c('0x179')],{'as':_0x901c('0x144'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x901c('0x5e')][_0x901c('0x112')](db[_0x901c('0x5a')],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x178')});db[_0x901c('0x5e')]['belongsTo'](db[_0x901c('0x72')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x901c('0xff')});db[_0x901c('0x5e')][_0x901c('0x113')](db[_0x901c('0x8d')],{'through':_0x901c('0x17b'),'as':_0x901c('0x16c')});db[_0x901c('0x5e')][_0x901c('0x113')](db[_0x901c('0x8d')],{'through':_0x901c('0x17b'),'as':_0x901c('0x15d')});db['OpenchannelInteraction']['belongsToMany'](db[_0x901c('0x12')],{'as':'Users','through':_0x901c('0x11d'),'foreignKey':_0x901c('0x17c')});db[_0x901c('0x179')][_0x901c('0x112')](db[_0x901c('0x12')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x12')});db[_0x901c('0x179')][_0x901c('0x112')](db[_0x901c('0x72')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x14a')});db[_0x901c('0x179')]['belongsTo'](db[_0x901c('0x5e')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x160'),'foreignKey':_0x901c('0x17c')});db[_0x901c('0x179')]['belongsTo'](db['Attachment'],{'as':_0x901c('0xe1'),'foreignKey':_0x901c('0x16e')});db[_0x901c('0x179')][_0x901c('0x112')](db[_0x901c('0x5a')],{'as':_0x901c('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0x901c('0x61')][_0x901c('0x113')](db['User'],{'as':'Agents','through':_0x901c('0x37'),'foreignKey':_0x901c('0x17a')});db[_0x901c('0x61')][_0x901c('0x113')](db[_0x901c('0x118')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x901c('0x63')]['hasMany'](db['Disposition'],{'as':_0x901c('0x151'),'foreignKey':_0x901c('0x161'),'onDelete':'cascade'});db[_0x901c('0x63')][_0x901c('0x102')](db[_0x901c('0x7f')],{'as':'Answers','foreignKey':_0x901c('0x161')});db[_0x901c('0x63')][_0x901c('0x102')](db[_0x901c('0x70')],{'as':'ProactiveActions'});db[_0x901c('0x63')][_0x901c('0x102')](db['ChatInteraction'],{'as':_0x901c('0x153')});db[_0x901c('0x63')][_0x901c('0x102')](db[_0x901c('0x66')],{'as':_0x901c('0x154')});db[_0x901c('0x63')][_0x901c('0x102')](db['ChatMessage'],{'as':_0x901c('0x144')});db['ChatWebsite'][_0x901c('0x112')](db['CmList'],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156')});db[_0x901c('0x63')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0x901c('0x13e')});db[_0x901c('0x63')][_0x901c('0x112')](db[_0x901c('0x3c')],{'as':_0x901c('0x3c'),'foreignKey':_0x901c('0x14c')});db['ChatWebsite'][_0x901c('0x112')](db[_0x901c('0x85')],{'as':_0x901c('0x13f'),'foreignKey':_0x901c('0x140')});db[_0x901c('0x63')]['belongsToMany'](db['User'],{'as':_0x901c('0x158'),'through':_0x901c('0x17d')});db[_0x901c('0x17e')][_0x901c('0x112')](db[_0x901c('0x5a')],{});db[_0x901c('0x17e')][_0x901c('0x112')](db[_0x901c('0xec')],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156')});db[_0x901c('0x17e')][_0x901c('0x112')](db['CmContact'],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db[_0x901c('0x17e')][_0x901c('0x112')](db['OpenchannelInteraction'],{});db[_0x901c('0x17e')][_0x901c('0x112')](db[_0x901c('0x179')],{});db[_0x901c('0x17e')][_0x901c('0x112')](db[_0x901c('0x12')],{});db[_0x901c('0x17e')][_0x901c('0x112')](db[_0x901c('0x61')],{});db[_0x901c('0x66')][_0x901c('0x112')](db[_0x901c('0x12')],{'as':'Agent','foreignKey':'UserId','onDelete':_0x901c('0x14e')});db[_0x901c('0x66')][_0x901c('0x112')](db[_0x901c('0x6c')],{'as':'Queue','foreignKey':_0x901c('0x17f'),'onDelete':'restrict'});db[_0x901c('0x66')][_0x901c('0x112')](db[_0x901c('0x63')],{'as':'Website','foreignKey':_0x901c('0x161'),'onDelete':_0x901c('0x14e')});db['ChatApplication'][_0x901c('0x112')](db[_0x901c('0x8d')],{'onDelete':'restrict','foreignKey':_0x901c('0x163')});db[_0x901c('0x109')][_0x901c('0x102')](db[_0x901c('0x69')],{'as':_0x901c('0x144'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x180')});db[_0x901c('0x109')][_0x901c('0x112')](db[_0x901c('0x63')],{'as':_0x901c('0x15a'),'foreignKey':'ChatWebsiteId'});db[_0x901c('0x109')][_0x901c('0x112')](db[_0x901c('0x72')],{'as':'Contact','foreignKey':_0x901c('0x14b')});db[_0x901c('0x109')][_0x901c('0x112')](db[_0x901c('0x12')],{'as':_0x901c('0x15b'),'foreignKey':_0x901c('0xff')});db[_0x901c('0x109')]['belongsToMany'](db['Tag'],{'through':_0x901c('0x181'),'as':_0x901c('0x16c')});db[_0x901c('0x109')]['belongsToMany'](db[_0x901c('0x8d')],{'through':_0x901c('0x181'),'as':_0x901c('0x15d')});db[_0x901c('0x109')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':_0x901c('0x16d'),'through':_0x901c('0x11b'),'foreignKey':'ChatInteractionId'});db[_0x901c('0x69')][_0x901c('0x112')](db[_0x901c('0x12')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x12')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db[_0x901c('0x69')][_0x901c('0x112')](db[_0x901c('0x109')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x160'),'foreignKey':'ChatInteractionId'});db[_0x901c('0x69')]['belongsTo'](db['Attachment'],{'as':_0x901c('0xe1'),'foreignKey':'AttachmentId'});db[_0x901c('0x69')][_0x901c('0x112')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x901c('0x161')});db[_0x901c('0x182')]['hasMany'](db[_0x901c('0xe1')],{'as':_0x901c('0x15f'),'foreignKey':_0x901c('0x162'),'onDelete':_0x901c('0x105'),'hooks':!![]});db[_0x901c('0x182')][_0x901c('0x112')](db[_0x901c('0x72')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db[_0x901c('0x182')][_0x901c('0x112')](db[_0x901c('0x63')],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x161')});db[_0x901c('0x6c')]['belongsToMany'](db[_0x901c('0x12')],{'as':_0x901c('0x158'),'through':_0x901c('0x31'),'hooks':!![]});db['ChatQueue'][_0x901c('0x113')](db[_0x901c('0x118')],{'through':_0x901c('0x183'),'as':_0x901c('0x142')});db[_0x901c('0x6e')][_0x901c('0x102')](db[_0x901c('0xcc')],{'as':_0x901c('0x144'),'foreignKey':_0x901c('0x184'),'onDelete':'cascade'});db[_0x901c('0x6e')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':'Members','through':_0x901c('0x185')});db['ChatProactiveAction'][_0x901c('0x112')](db[_0x901c('0x63')],{'as':'Website','foreignKey':_0x901c('0x161')});db[_0x901c('0x186')]['hasMany'](db[_0x901c('0x72')],{'as':_0x901c('0x115'),'foreignKey':_0x901c('0x187')});db[_0x901c('0x72')][_0x901c('0x102')](db[_0x901c('0x73')],{'as':_0x901c('0x136'),'foreignKey':_0x901c('0x14b')});db[_0x901c('0x72')][_0x901c('0x102')](db[_0x901c('0x76')],{'as':'HopperFinals','foreignKey':_0x901c('0x14b')});db[_0x901c('0x72')][_0x901c('0x102')](db[_0x901c('0x107')],{'as':_0x901c('0x138'),'foreignKey':_0x901c('0x14b')});db[_0x901c('0x72')][_0x901c('0x102')](db['ReportAgentPreview'],{'as':_0x901c('0x79'),'foreignKey':'ContactId'});db[_0x901c('0x72')]['hasMany'](db[_0x901c('0x139')],{'as':_0x901c('0x13a'),'foreignKey':_0x901c('0x14b')});db['CmContact'][_0x901c('0x102')](db[_0x901c('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0x901c('0x14b'),'onDelete':_0x901c('0x14e')});db[_0x901c('0x72')][_0x901c('0x102')](db['ChatInteraction'],{'as':_0x901c('0x10a'),'foreignKey':_0x901c('0x14b'),'onDelete':_0x901c('0x14e')});db['CmContact']['hasMany'](db[_0x901c('0x56')],{'as':_0x901c('0x10b'),'foreignKey':'ContactId','onDelete':_0x901c('0x14e')});db[_0x901c('0x72')][_0x901c('0x102')](db[_0x901c('0x4c')],{'as':_0x901c('0x188'),'foreignKey':_0x901c('0x14b'),'onDelete':'restrict'});db['CmContact'][_0x901c('0x102')](db[_0x901c('0x10c')],{'as':_0x901c('0x10d'),'foreignKey':_0x901c('0x14b'),'onDelete':_0x901c('0x14e')});db[_0x901c('0x72')]['belongsTo'](db[_0x901c('0x186')],{'as':_0x901c('0x189'),'foreignKey':'CompanyId'});db['CmContact'][_0x901c('0x112')](db[_0x901c('0xec')],{'as':'List','foreignKey':_0x901c('0x156'),'onDelete':_0x901c('0x105')});db[_0x901c('0x72')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':_0x901c('0x16d'),'through':'cm_user_has_contacts'});db[_0x901c('0x72')]['belongsToMany'](db[_0x901c('0x8d')],{'as':_0x901c('0x16c'),'through':_0x901c('0x18a')});db[_0x901c('0x72')][_0x901c('0x113')](db['Tag'],{'through':_0x901c('0x18a'),'as':_0x901c('0x15d')});db[_0x901c('0x73')]['belongsTo'](db[_0x901c('0x72')],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b'),'onDelete':_0x901c('0x105')});db[_0x901c('0x73')][_0x901c('0x112')](db[_0x901c('0xec')],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156'),'onDelete':_0x901c('0x105')});db[_0x901c('0x73')][_0x901c('0x112')](db[_0x901c('0x12')],{'as':_0x901c('0x18b'),'foreignKey':_0x901c('0xff')});db['CmHopper']['belongsTo'](db['VoiceQueue'],{'as':_0x901c('0x18c'),'foreignKey':_0x901c('0x137'),'onDelete':'cascade'});db[_0x901c('0x73')]['belongsTo'](db[_0x901c('0x18d')],{'as':_0x901c('0x18d'),'foreignKey':_0x901c('0x18e'),'onDelete':_0x901c('0x105')});db[_0x901c('0x73')]['belongsTo'](db[_0x901c('0x12')],{'as':_0x901c('0x15b'),'foreignKey':_0x901c('0x18f')});db[_0x901c('0x75')][_0x901c('0x112')](db['CmContact'],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b'),'onDelete':_0x901c('0x105')});db[_0x901c('0x75')][_0x901c('0x112')](db[_0x901c('0xec')],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156'),'onDelete':_0x901c('0x105')});db['CmHopperBlack']['belongsTo'](db[_0x901c('0x1b')],{'as':_0x901c('0x18c'),'foreignKey':'VoiceQueueId','onDelete':_0x901c('0x105')});db['CmHopperBlack'][_0x901c('0x112')](db['Campaign'],{'as':_0x901c('0x18d'),'foreignKey':_0x901c('0x18e'),'onDelete':_0x901c('0x105')});db['Automation'][_0x901c('0x102')](db['Condition'],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x901c('0x190'),'onDelete':_0x901c('0x105'),'hooks':!![]});db[_0x901c('0x7d')][_0x901c('0x102')](db['Condition'],{'as':{'plural':_0x901c('0x191'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x901c('0x105'),'hooks':!![]});db[_0x901c('0x7d')][_0x901c('0x102')](db[_0x901c('0x7b')],{'as':'Actions','foreignKey':_0x901c('0x192'),'onDelete':_0x901c('0x105'),'hooks':!![]});db['Disposition'][_0x901c('0x102')](db[_0x901c('0x81')],{'as':_0x901c('0x151'),'foreignKey':_0x901c('0x193'),'onDelete':_0x901c('0x105')});db[_0x901c('0x13d')][_0x901c('0x102')](db[_0x901c('0x13d')],{'as':_0x901c('0x194'),'foreignKey':_0x901c('0x13e'),'onDelete':_0x901c('0x105'),'hooks':!![],'required':![]});db[_0x901c('0x13d')][_0x901c('0x102')](db[_0x901c('0x133')],{'as':_0x901c('0x104'),'foreignKey':_0x901c('0x13e'),'onDelete':_0x901c('0x14e')});db[_0x901c('0x13d')]['hasMany'](db[_0x901c('0x44')],{'as':_0x901c('0x195'),'foreignKey':_0x901c('0x13e')});db[_0x901c('0x13d')][_0x901c('0x102')](db[_0x901c('0x66')],{'as':_0x901c('0x196'),'foreignKey':'IntervalId'});db[_0x901c('0x13d')][_0x901c('0x102')](db[_0x901c('0x168')],{'as':_0x901c('0x197'),'foreignKey':_0x901c('0x13e')});db[_0x901c('0x13d')][_0x901c('0x102')](db[_0x901c('0x54')],{'as':_0x901c('0x198'),'foreignKey':_0x901c('0x13e')});db[_0x901c('0x89')][_0x901c('0x112')](db[_0x901c('0x3c')],{});db[_0x901c('0x89')][_0x901c('0x112')](db[_0x901c('0x97')],{'foreignKey':_0x901c('0x199')});db[_0x901c('0x89')]['belongsTo'](db[_0x901c('0x96')],{'foreignKey':'CustomReportId'});db[_0x901c('0x8b')][_0x901c('0x113')](db[_0x901c('0x19')],{'as':_0x901c('0x19a'),'through':_0x901c('0x19b'),'onDelete':_0x901c('0x14e')});db[_0x901c('0x8d')][_0x901c('0x113')](db[_0x901c('0x72')],{'through':_0x901c('0x18a')});db[_0x901c('0x8d')][_0x901c('0x113')](db['ChatInteraction'],{'through':_0x901c('0x181')});db[_0x901c('0x8d')][_0x901c('0x113')](db['MailInteraction'],{'through':_0x901c('0x15c')});db[_0x901c('0x8d')][_0x901c('0x113')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x901c('0x8d')][_0x901c('0x113')](db[_0x901c('0x4c')],{'through':_0x901c('0x16b')});db[_0x901c('0x8d')]['belongsToMany'](db[_0x901c('0x5e')],{'through':_0x901c('0x17b')});db[_0x901c('0x8d')][_0x901c('0x113')](db[_0x901c('0x10e')],{'through':_0x901c('0x19c')});db['Trigger'][_0x901c('0x102')](db[_0x901c('0x83')],{'as':{'plural':_0x901c('0x19d'),'singular':_0x901c('0x19e')},'foreignKey':'TriggerAllId','onDelete':_0x901c('0x105'),'hooks':!![]});db[_0x901c('0x8e')][_0x901c('0x102')](db[_0x901c('0x83')],{'as':{'plural':_0x901c('0x19f'),'singular':_0x901c('0x1a0')},'foreignKey':_0x901c('0x1a1'),'onDelete':_0x901c('0x105'),'hooks':!![]});db['Trigger'][_0x901c('0x102')](db[_0x901c('0x7b')],{'as':_0x901c('0x1a2'),'foreignKey':_0x901c('0x1a3'),'onDelete':_0x901c('0x105'),'hooks':!![]});db[_0x901c('0x96')][_0x901c('0x102')](db[_0x901c('0x9c')],{'as':_0x901c('0x1a4'),'onDelete':'cascade','foreignKey':_0x901c('0x1a5'),'hooks':!![]});db['AnalyticDefaultReport'][_0x901c('0x102')](db[_0x901c('0x9c')],{'as':_0x901c('0x1a4'),'onDelete':'cascade','foreignKey':_0x901c('0x199')});db[_0x901c('0x9b')][_0x901c('0x102')](db['AnalyticFieldReport'],{'as':_0x901c('0x1a4'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1a6')});db[_0x901c('0x9c')][_0x901c('0x112')](db[_0x901c('0x9b')],{'foreignKey':_0x901c('0x1a6')});db['SalesforceAccount'][_0x901c('0x102')](db[_0x901c('0x1a7')],{'as':_0x901c('0x1a8'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1a9')});db[_0x901c('0x1a7')][_0x901c('0x102')](db['SalesforceField'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x901c('0x1a7')][_0x901c('0x102')](db[_0x901c('0x1aa')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x901c('0x1ab')});db[_0x901c('0x1a7')][_0x901c('0x102')](db[_0x901c('0x1aa')],{'as':_0x901c('0x1a4'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1ac')});db[_0x901c('0x1a7')]['belongsTo'](db['SalesforceAccount'],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x1a9')});db[_0x901c('0x1aa')][_0x901c('0x102')](db['SalesforceField'],{'as':_0x901c('0x1ad'),'foreignKey':_0x901c('0x1ae')});db[_0x901c('0x1aa')][_0x901c('0x102')](db[_0x901c('0x1aa')],{'as':_0x901c('0x1af'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0x1aa')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':_0x901c('0x1ac')});db[_0x901c('0x1aa')][_0x901c('0x112')](db[_0x901c('0x90')],{'as':_0x901c('0x90'),'foreignKey':_0x901c('0x1b0')});db[_0x901c('0x1b1')][_0x901c('0x102')](db[_0x901c('0xa2')],{'as':_0x901c('0x1a8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x901c('0xa2')][_0x901c('0x102')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1ae')});db[_0x901c('0xa2')][_0x901c('0x102')](db['SugarcrmField'],{'as':_0x901c('0x1b2'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0xa2')][_0x901c('0x102')](db['SugarcrmField'],{'as':_0x901c('0x1a4'),'onDelete':_0x901c('0x105'),'foreignKey':'FieldId'});db[_0x901c('0xa2')][_0x901c('0x112')](db[_0x901c('0x1b1')],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x1a9')});db['SugarcrmField'][_0x901c('0x102')](db[_0x901c('0x1b3')],{'as':'Subject','foreignKey':'SubjectId'});db['SugarcrmField'][_0x901c('0x102')](db[_0x901c('0x1b3')],{'as':'Description','foreignKey':_0x901c('0x1ab')});db['SugarcrmField'][_0x901c('0x102')](db['SugarcrmField'],{'as':_0x901c('0x1b4'),'foreignKey':_0x901c('0x1ac')});db[_0x901c('0x1b3')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x901c('0x1b0')});db[_0x901c('0xa4')][_0x901c('0x102')](db['DeskConfiguration'],{'as':_0x901c('0x1a8'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1a9')});db['DeskConfiguration'][_0x901c('0x102')](db[_0x901c('0xa7')],{'as':_0x901c('0x1b5'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x901c('0x1b6')][_0x901c('0x102')](db['DeskField'],{'as':'Descriptions','onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0x1b6')][_0x901c('0x102')](db[_0x901c('0xa7')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x901c('0x1b6')][_0x901c('0x112')](db['DeskAccount'],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x1a9')});db[_0x901c('0x1b6')][_0x901c('0x113')](db[_0x901c('0x8d')],{'through':_0x901c('0x1b7')});db[_0x901c('0xa7')][_0x901c('0x102')](db[_0x901c('0xa7')],{'as':'Subject','foreignKey':_0x901c('0x1ae')});db[_0x901c('0xa7')][_0x901c('0x102')](db[_0x901c('0xa7')],{'as':_0x901c('0x1af'),'foreignKey':'DescriptionId'});db[_0x901c('0xa7')][_0x901c('0x102')](db[_0x901c('0xa7')],{'as':_0x901c('0x1b4'),'foreignKey':_0x901c('0x1ac')});db[_0x901c('0xa7')][_0x901c('0x112')](db[_0x901c('0x90')],{'as':_0x901c('0x90'),'foreignKey':_0x901c('0x1b0')});db[_0x901c('0xa8')][_0x901c('0x102')](db['ZohoConfiguration'],{'as':_0x901c('0x1a8'),'onDelete':'cascade','foreignKey':_0x901c('0x1a9')});db[_0x901c('0xaa')][_0x901c('0x102')](db['ZohoField'],{'as':_0x901c('0x1b5'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1ae')});db[_0x901c('0xaa')][_0x901c('0x102')](db[_0x901c('0xac')],{'as':_0x901c('0x1b2'),'onDelete':_0x901c('0x105'),'foreignKey':'DescriptionId'});db[_0x901c('0xaa')]['hasMany'](db[_0x901c('0xac')],{'as':_0x901c('0x1a4'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1ac')});db['ZohoConfiguration'][_0x901c('0x112')](db[_0x901c('0xa8')],{'as':_0x901c('0x15a'),'foreignKey':'AccountId'});db[_0x901c('0xac')][_0x901c('0x102')](db[_0x901c('0xac')],{'as':_0x901c('0x1ad'),'foreignKey':_0x901c('0x1ae')});db[_0x901c('0xac')][_0x901c('0x102')](db['ZohoField'],{'as':_0x901c('0x1af'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0xac')][_0x901c('0x102')](db[_0x901c('0xac')],{'as':_0x901c('0x1b4'),'foreignKey':_0x901c('0x1ac')});db[_0x901c('0xac')]['belongsTo'](db[_0x901c('0x90')],{'as':_0x901c('0x90'),'foreignKey':'VariableId'});db[_0x901c('0xae')]['hasMany'](db[_0x901c('0x1b8')],{'as':_0x901c('0x1a8'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1a9')});db['ZendeskConfiguration'][_0x901c('0x102')](db[_0x901c('0x1b9')],{'as':'Subjects','foreignKey':_0x901c('0x1ae')});db['ZendeskConfiguration'][_0x901c('0x102')](db['ZendeskField'],{'as':_0x901c('0x1b2'),'foreignKey':'DescriptionId'});db[_0x901c('0x1b8')][_0x901c('0x102')](db[_0x901c('0x1b9')],{'as':_0x901c('0x1a4'),'foreignKey':_0x901c('0x1ac')});db[_0x901c('0x1b8')][_0x901c('0x112')](db[_0x901c('0xae')],{'as':_0x901c('0x15a'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['belongsToMany'](db[_0x901c('0x8d')],{'through':_0x901c('0x1ba')});db[_0x901c('0x1b9')][_0x901c('0x102')](db[_0x901c('0x1b9')],{'as':_0x901c('0x1ad'),'foreignKey':_0x901c('0x1ae')});db[_0x901c('0x1b9')][_0x901c('0x102')](db[_0x901c('0x1b9')],{'as':_0x901c('0x1af'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0x1b9')][_0x901c('0x102')](db[_0x901c('0x1b9')],{'as':'Field','foreignKey':_0x901c('0x1ac')});db[_0x901c('0x1b9')][_0x901c('0x112')](db[_0x901c('0x90')],{'as':'Variable','foreignKey':_0x901c('0x1b0')});db[_0x901c('0xb2')][_0x901c('0x102')](db[_0x901c('0xb4')],{'as':_0x901c('0x1a8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x901c('0xb4')]['hasMany'](db[_0x901c('0xb6')],{'as':_0x901c('0x1b5'),'onDelete':_0x901c('0x105'),'foreignKey':'SubjectId'});db[_0x901c('0xb4')][_0x901c('0x102')](db[_0x901c('0xb6')],{'as':_0x901c('0x1b2'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0xb4')][_0x901c('0x102')](db[_0x901c('0xb6')],{'as':'Fields','onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1ac')});db['FreshdeskConfiguration'][_0x901c('0x112')](db[_0x901c('0xb2')],{'as':'Account','foreignKey':_0x901c('0x1a9')});db[_0x901c('0xb4')]['belongsToMany'](db[_0x901c('0x8d')],{'through':_0x901c('0x1bb')});db['FreshdeskField'][_0x901c('0x102')](db['FreshdeskField'],{'as':_0x901c('0x1ad'),'foreignKey':_0x901c('0x1ae')});db[_0x901c('0xb6')][_0x901c('0x102')](db[_0x901c('0xb6')],{'as':_0x901c('0x1af'),'foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db['FreshdeskField'][_0x901c('0x112')](db[_0x901c('0x90')],{'as':_0x901c('0x90'),'foreignKey':_0x901c('0x1b0')});db['VtigerAccount']['hasMany'](db[_0x901c('0xb9')],{'as':_0x901c('0x1a8'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1a9')});db['VtigerConfiguration'][_0x901c('0x102')](db[_0x901c('0x1bc')],{'as':_0x901c('0x1b5'),'foreignKey':_0x901c('0x1ae')});db[_0x901c('0xb9')]['hasMany'](db[_0x901c('0x1bc')],{'as':_0x901c('0x1b2'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0xb9')][_0x901c('0x102')](db[_0x901c('0x1bc')],{'as':_0x901c('0x1a4'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0x901c('0x112')](db[_0x901c('0xb8')],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x1a9')});db[_0x901c('0x1bc')][_0x901c('0x102')](db['VtigerField'],{'as':_0x901c('0x1ad'),'foreignKey':_0x901c('0x1ae')});db['VtigerField'][_0x901c('0x102')](db['VtigerField'],{'as':'Description','foreignKey':_0x901c('0x1ab')});db[_0x901c('0x1bc')][_0x901c('0x102')](db[_0x901c('0x1bc')],{'as':_0x901c('0x1b4'),'foreignKey':_0x901c('0x1ac')});db[_0x901c('0x1bc')][_0x901c('0x112')](db[_0x901c('0x90')],{'as':_0x901c('0x90'),'foreignKey':_0x901c('0x1b0')});db[_0x901c('0xbb')][_0x901c('0x102')](db[_0x901c('0x1bd')],{'as':_0x901c('0x1a8'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1a9')});db[_0x901c('0x1bd')][_0x901c('0x102')](db[_0x901c('0xbe')],{'as':_0x901c('0x1b5'),'foreignKey':_0x901c('0x1ae')});db[_0x901c('0x1bd')][_0x901c('0x102')](db[_0x901c('0xbe')],{'as':_0x901c('0x1b2'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0x1bd')][_0x901c('0x102')](db[_0x901c('0xbe')],{'as':'Fields','foreignKey':_0x901c('0x1ac')});db[_0x901c('0x1bd')][_0x901c('0x112')](db[_0x901c('0xbb')],{'as':_0x901c('0x15a'),'foreignKey':'AccountId'});db[_0x901c('0xbe')]['hasMany'](db[_0x901c('0xbe')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x901c('0xbe')][_0x901c('0x102')](db[_0x901c('0xbe')],{'as':_0x901c('0x1af'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0xbe')][_0x901c('0x102')](db[_0x901c('0xbe')],{'as':_0x901c('0x1b4'),'foreignKey':_0x901c('0x1ac')});db[_0x901c('0xbe')]['belongsTo'](db[_0x901c('0x90')],{'as':_0x901c('0x90'),'foreignKey':_0x901c('0x1b0')});db['Dynamics365Account'][_0x901c('0x102')](db[_0x901c('0xc2')],{'as':'Configurations','onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1a9')});db[_0x901c('0xc0')][_0x901c('0x112')](db['CloudProvider'],{'as':_0x901c('0xf9'),'foreignKey':_0x901c('0x14d')});db[_0x901c('0xc2')][_0x901c('0x102')](db['Dynamics365Field'],{'as':_0x901c('0x1b5'),'onDelete':_0x901c('0x105'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x901c('0x102')](db[_0x901c('0x1be')],{'as':_0x901c('0x1b2'),'onDelete':_0x901c('0x105'),'foreignKey':'DescriptionId'});db[_0x901c('0xc2')]['hasMany'](db[_0x901c('0x1be')],{'as':_0x901c('0x1a4'),'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1ac')});db[_0x901c('0xc2')][_0x901c('0x112')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0x901c('0x1a9')});db[_0x901c('0x1be')][_0x901c('0x102')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x901c('0x1ae')});db[_0x901c('0x1be')]['hasMany'](db[_0x901c('0x1be')],{'as':_0x901c('0x1af'),'foreignKey':_0x901c('0x1ab')});db[_0x901c('0x1be')][_0x901c('0x102')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x901c('0x1ac')});db['Dynamics365Field'][_0x901c('0x112')](db[_0x901c('0x90')],{'as':_0x901c('0x90'),'foreignKey':_0x901c('0x1b0')});db[_0x901c('0xc4')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x901c('0x1a8'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x901c('0x102')](db[_0x901c('0x1bf')],{'as':_0x901c('0x1b5'),'foreignKey':_0x901c('0x1ae')});db[_0x901c('0xc6')][_0x901c('0x102')](db['FreshsalesField'],{'as':_0x901c('0x1b2'),'foreignKey':_0x901c('0x1ab')});db['FreshsalesConfiguration'][_0x901c('0x102')](db[_0x901c('0x1bf')],{'as':_0x901c('0x1a4'),'foreignKey':_0x901c('0x1ac')});db['FreshsalesConfiguration'][_0x901c('0x112')](db[_0x901c('0xc4')],{'as':'Account','foreignKey':_0x901c('0x1a9')});db['FreshsalesField'][_0x901c('0x102')](db[_0x901c('0x1bf')],{'as':'Subject','foreignKey':_0x901c('0x1ae')});db[_0x901c('0x1bf')][_0x901c('0x102')](db[_0x901c('0x1bf')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x901c('0x1bf')][_0x901c('0x102')](db['FreshsalesField'],{'as':_0x901c('0x1b4'),'foreignKey':_0x901c('0x1ac')});db[_0x901c('0x1bf')][_0x901c('0x112')](db[_0x901c('0x90')],{'as':_0x901c('0x90'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x901c('0x112')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x901c('0x112')](db[_0x901c('0xec')],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156')});db[_0x901c('0x1c0')][_0x901c('0x112')](db[_0x901c('0x72')],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db['ChatQueueReport']['belongsTo'](db[_0x901c('0x109')],{});db['ChatQueueReport']['belongsTo'](db[_0x901c('0x69')],{});db[_0x901c('0x1c0')][_0x901c('0x112')](db['User'],{});db[_0x901c('0x1c0')]['belongsTo'](db[_0x901c('0x6c')],{});db[_0x901c('0xcc')][_0x901c('0x112')](db[_0x901c('0x12')],{'onDelete':_0x901c('0x105'),'foreignKey':'FromId'});db[_0x901c('0xcc')]['belongsTo'](db[_0x901c('0x12')],{'onDelete':_0x901c('0x105'),'foreignKey':_0x901c('0x1c1')});db[_0x901c('0x139')][_0x901c('0x102')](db[_0x901c('0x1c2')],{'foreignKey':'SessionId','onDelete':_0x901c('0x105')});db[_0x901c('0x139')][_0x901c('0x102')](db[_0x901c('0xce')],{'foreignKey':_0x901c('0x1c3'),'onDelete':_0x901c('0x105')});db['SmsQueueReport'][_0x901c('0x112')](db[_0x901c('0x52')],{});db[_0x901c('0x1c4')]['belongsTo'](db[_0x901c('0xec')],{'as':_0x901c('0x155'),'foreignKey':_0x901c('0x156')});db[_0x901c('0x1c4')][_0x901c('0x112')](db[_0x901c('0x72')],{'as':'Contact','foreignKey':_0x901c('0x14b')});db[_0x901c('0x1c4')][_0x901c('0x112')](db[_0x901c('0x56')],{});db[_0x901c('0x1c4')][_0x901c('0x112')](db[_0x901c('0x57')],{});db[_0x901c('0x1c4')][_0x901c('0x112')](db['User'],{});db['SmsQueueReport'][_0x901c('0x112')](db[_0x901c('0x126')],{});db[_0x901c('0xd6')][_0x901c('0x102')](db[_0x901c('0x139')],{'foreignKey':_0x901c('0x1c5')});db['JscriptyProject']['hasMany'](db[_0x901c('0x1c2')],{'foreignKey':_0x901c('0x1c5')});db[_0x901c('0xd6')][_0x901c('0x102')](db[_0x901c('0xce')],{'foreignKey':_0x901c('0x1c5')});db[_0x901c('0xda')][_0x901c('0x113')](db['User'],{'as':'Users','through':'user_has_square_projects'});db['Team'][_0x901c('0x113')](db['User'],{'as':_0x901c('0x158'),'through':'user_has_teams'});db[_0x901c('0x118')][_0x901c('0x113')](db['VoiceQueue'],{'through':_0x901c('0x143'),'as':_0x901c('0x120')});db['Team'][_0x901c('0x113')](db['MailQueue'],{'through':_0x901c('0x159'),'as':'MailQueues'});db[_0x901c('0x118')]['belongsToMany'](db['ChatQueue'],{'through':_0x901c('0x183'),'as':'ChatQueues'});db[_0x901c('0x118')][_0x901c('0x113')](db[_0x901c('0x4f')],{'through':_0x901c('0x16f'),'as':_0x901c('0x125')});db[_0x901c('0x118')][_0x901c('0x113')](db[_0x901c('0x126')],{'through':_0x901c('0x177'),'as':_0x901c('0x1c6')});db[_0x901c('0x118')][_0x901c('0x113')](db[_0x901c('0x61')],{'through':_0x901c('0x1c7'),'as':_0x901c('0x1c8')});db[_0x901c('0x118')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x901c('0x1c9'),'as':_0x901c('0x1ca')});db[_0x901c('0x118')][_0x901c('0x113')](db[_0x901c('0x121')],{'through':_0x901c('0x1cb'),'as':_0x901c('0x122')});db[_0x901c('0x18d')][_0x901c('0x102')](db[_0x901c('0x73')],{'as':_0x901c('0x136'),'foreignKey':'CampaignId'});db[_0x901c('0x18d')][_0x901c('0x102')](db[_0x901c('0x76')],{'as':_0x901c('0x106'),'foreignKey':_0x901c('0x18e')});db[_0x901c('0x18d')][_0x901c('0x102')](db[_0x901c('0x107')],{'as':_0x901c('0x138'),'foreignKey':_0x901c('0x18e')});db[_0x901c('0x18d')][_0x901c('0x102')](db[_0x901c('0x75')],{'as':_0x901c('0x1cc'),'foreignKey':_0x901c('0x18e')});db[_0x901c('0x18d')][_0x901c('0x112')](db[_0x901c('0x29')],{'as':_0x901c('0x29'),'foreignKey':_0x901c('0x13b')});db['Campaign'][_0x901c('0x112')](db[_0x901c('0x29')],{'as':'TrunkBackup','foreignKey':_0x901c('0x1cd')});db[_0x901c('0x18d')][_0x901c('0x112')](db[_0x901c('0x13d')],{'as':_0x901c('0x13d'),'foreignKey':_0x901c('0x13e')});db['Campaign']['belongsTo'](db[_0x901c('0xda')],{'as':_0x901c('0xda'),'foreignKey':_0x901c('0x1ce')});db[_0x901c('0x18d')]['belongsToMany'](db[_0x901c('0xec')],{'as':_0x901c('0x117'),'through':_0x901c('0x1cf')});db[_0x901c('0x18d')][_0x901c('0x113')](db[_0x901c('0xec')],{'as':_0x901c('0x1d0'),'through':'campaigns_has_cm_blacklists'});db[_0x901c('0xe1')][_0x901c('0x112')](db[_0x901c('0x182')],{'as':_0x901c('0x182'),'foreignKey':_0x901c('0x162')});db[_0x901c('0xe5')][_0x901c('0x112')](db['MailMessage'],{});db[_0x901c('0xe5')][_0x901c('0x112')](db[_0x901c('0x10c')],{});db[_0x901c('0xe5')][_0x901c('0x112')](db[_0x901c('0x3c')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x901c('0xe5')][_0x901c('0x112')](db[_0x901c('0x12')],{'foreignKey':_0x901c('0x1d1'),'as':_0x901c('0x1d2')});db[_0x901c('0xe5')][_0x901c('0x112')](db[_0x901c('0x12')],{'foreignKey':_0x901c('0x1d3'),'as':_0x901c('0x1d4')});db[_0x901c('0xe5')]['belongsTo'](db[_0x901c('0x3e')],{'foreignKey':_0x901c('0x1d5'),'as':_0x901c('0x1d6')});db[_0x901c('0xe5')][_0x901c('0x112')](db[_0x901c('0x3c')],{'foreignKey':_0x901c('0x1d7'),'as':_0x901c('0x1d8')});db['ChatTransferReport']['belongsTo'](db[_0x901c('0x69')],{});db[_0x901c('0xe7')][_0x901c('0x112')](db[_0x901c('0x109')],{});db[_0x901c('0xe7')][_0x901c('0x112')](db['ChatWebsite'],{'foreignKey':_0x901c('0x1d9'),'as':_0x901c('0x1da')});db[_0x901c('0xe7')][_0x901c('0x112')](db['User'],{'foreignKey':_0x901c('0x1d1'),'as':_0x901c('0x1d2')});db[_0x901c('0xe7')][_0x901c('0x112')](db[_0x901c('0x12')],{'foreignKey':_0x901c('0x1d3'),'as':_0x901c('0x1d4')});db['ChatTransferReport'][_0x901c('0x112')](db[_0x901c('0x6c')],{'foreignKey':_0x901c('0x1db'),'as':_0x901c('0x1d6')});db[_0x901c('0xe7')]['belongsTo'](db[_0x901c('0x63')],{'foreignKey':'ToChatWebsiteId','as':_0x901c('0x1d8')});db['FaxTransferReport'][_0x901c('0x112')](db['FaxMessage'],{});db[_0x901c('0x1dc')]['belongsTo'](db[_0x901c('0x4c')],{});db[_0x901c('0x1dc')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x901c('0x1dd'),'as':'FromAccount'});db[_0x901c('0x1dc')][_0x901c('0x112')](db[_0x901c('0x12')],{'foreignKey':_0x901c('0x1d1'),'as':_0x901c('0x1d2')});db[_0x901c('0x1dc')]['belongsTo'](db[_0x901c('0x12')],{'foreignKey':'ToUserId','as':_0x901c('0x1d4')});db['FaxTransferReport'][_0x901c('0x112')](db[_0x901c('0x4f')],{'foreignKey':_0x901c('0x1de'),'as':_0x901c('0x1d6')});db['FaxTransferReport'][_0x901c('0x112')](db[_0x901c('0x49')],{'foreignKey':_0x901c('0x1df'),'as':_0x901c('0x1d8')});db['OpenchannelTransferReport'][_0x901c('0x112')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x901c('0x112')](db['OpenchannelInteraction'],{});db[_0x901c('0xe8')][_0x901c('0x112')](db['OpenchannelAccount'],{'foreignKey':_0x901c('0x1e0'),'as':_0x901c('0x1da')});db[_0x901c('0xe8')]['belongsTo'](db[_0x901c('0x12')],{'foreignKey':_0x901c('0x1d1'),'as':_0x901c('0x1d2')});db[_0x901c('0xe8')][_0x901c('0x112')](db['User'],{'foreignKey':_0x901c('0x1d3'),'as':_0x901c('0x1d4')});db[_0x901c('0xe8')]['belongsTo'](db[_0x901c('0x61')],{'foreignKey':'ToOpenchannelQueueId','as':_0x901c('0x1d6')});db['OpenchannelTransferReport']['belongsTo'](db[_0x901c('0x5a')],{'foreignKey':_0x901c('0x1e1'),'as':_0x901c('0x1d8')});db[_0x901c('0xea')][_0x901c('0x112')](db[_0x901c('0x57')],{});db[_0x901c('0xea')][_0x901c('0x112')](db[_0x901c('0x56')],{});db[_0x901c('0xea')][_0x901c('0x112')](db[_0x901c('0x52')],{'foreignKey':_0x901c('0x1e2'),'as':'FromAccount'});db['SmsTransferReport'][_0x901c('0x112')](db[_0x901c('0x12')],{'foreignKey':_0x901c('0x1d1'),'as':'FromAgent'});db[_0x901c('0xea')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x901c('0x1d4')});db['SmsTransferReport'][_0x901c('0x112')](db[_0x901c('0x126')],{'foreignKey':_0x901c('0x1e3'),'as':_0x901c('0x1d6')});db[_0x901c('0xea')][_0x901c('0x112')](db[_0x901c('0x52')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList'][_0x901c('0x102')](db[_0x901c('0x81')],{'as':_0x901c('0x151'),'foreignKey':'ListId','onDelete':_0x901c('0x105')});db[_0x901c('0xec')][_0x901c('0x102')](db[_0x901c('0x1e4')],{'as':'CustomFields','foreignKey':_0x901c('0x156')});db[_0x901c('0xec')][_0x901c('0x102')](db[_0x901c('0x72')],{'as':'Contacts','onDelete':_0x901c('0x105'),'foreignKey':'ListId'});db[_0x901c('0xec')][_0x901c('0x102')](db[_0x901c('0x76')],{'as':'HopperFinals','foreignKey':_0x901c('0x156')});db[_0x901c('0xec')]['hasMany'](db[_0x901c('0x107')],{'as':_0x901c('0x1e5'),'foreignKey':'ListId'});db[_0x901c('0xec')][_0x901c('0x102')](db['ReportAgentPreview'],{'as':_0x901c('0x79'),'foreignKey':'ListId'});db['CmList']['belongsToMany'](db[_0x901c('0x1b')],{'as':'Queues','through':_0x901c('0x141')});db[_0x901c('0xec')]['belongsToMany'](db[_0x901c('0x12')],{'as':_0x901c('0x158'),'through':'cm_user_has_lists'});db[_0x901c('0x121')][_0x901c('0x102')](db[_0x901c('0x133')],{'as':_0x901c('0x104'),'onDelete':_0x901c('0x105')});db[_0x901c('0x121')]['belongsToMany'](db[_0x901c('0x12')],{'as':_0x901c('0x158'),'through':_0x901c('0xfc')});db[_0x901c('0x121')]['belongsToMany'](db[_0x901c('0x118')],{'through':_0x901c('0x1cb'),'as':_0x901c('0x142')});db['UserProfile']['hasMany'](db[_0x901c('0x12')],{'as':_0x901c('0x16d'),'foreignKey':_0x901c('0x1e6')});db[_0x901c('0xed')][_0x901c('0x102')](db[_0x901c('0xee')],{'as':'UserProfileSections','foreignKey':_0x901c('0x1e6'),'onDelete':_0x901c('0x105')});db[_0x901c('0xee')][_0x901c('0x102')](db[_0x901c('0xef')],{'as':_0x901c('0x1e7'),'foreignKey':_0x901c('0x1e8'),'onDelete':_0x901c('0x105')});db['WhatsappAccount']['hasMany'](db['Disposition'],{'as':_0x901c('0x151'),'foreignKey':_0x901c('0x1e9'),'onDelete':_0x901c('0x105')});db[_0x901c('0xf0')]['hasMany'](db[_0x901c('0x7f')],{'as':'Answers','foreignKey':_0x901c('0x1e9')});db[_0x901c('0xf0')][_0x901c('0x102')](db[_0x901c('0xf3')],{'as':_0x901c('0x144'),'foreignKey':'WhatsappAccountId'});db[_0x901c('0xf0')]['hasMany'](db['WhatsappInteraction'],{'as':_0x901c('0x153')});db[_0x901c('0xf0')][_0x901c('0x102')](db[_0x901c('0xf1')],{'as':_0x901c('0x154')});db['WhatsappAccount']['belongsTo'](db[_0x901c('0xec')],{'as':'List','foreignKey':'ListId'});db[_0x901c('0xf0')]['belongsTo'](db[_0x901c('0x85')],{'as':_0x901c('0x13f'),'foreignKey':_0x901c('0x140')});db[_0x901c('0xf0')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':_0x901c('0x158'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x901c('0x112')](db['User'],{'onDelete':_0x901c('0x14e')});db[_0x901c('0xf1')][_0x901c('0x112')](db[_0x901c('0xf7')],{'onDelete':_0x901c('0x14e')});db[_0x901c('0xf1')][_0x901c('0x112')](db[_0x901c('0xf0')],{'onDelete':_0x901c('0x14e')});db[_0x901c('0xf1')][_0x901c('0x112')](db[_0x901c('0x13d')],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x13e')});db[_0x901c('0xf1')][_0x901c('0x112')](db['Tag'],{'onDelete':_0x901c('0x14e'),'foreignKey':_0x901c('0x163')});db['WhatsappInteraction'][_0x901c('0x102')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x901c('0x1ea')});db[_0x901c('0x10e')][_0x901c('0x112')](db[_0x901c('0xf0')],{'as':_0x901c('0x15a'),'foreignKey':_0x901c('0x1e9')});db[_0x901c('0x10e')][_0x901c('0x112')](db['CmContact'],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db['WhatsappInteraction'][_0x901c('0x112')](db[_0x901c('0x12')],{'as':_0x901c('0x15b'),'foreignKey':_0x901c('0xff')});db[_0x901c('0x10e')][_0x901c('0x113')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x901c('0x16c')});db[_0x901c('0x10e')][_0x901c('0x113')](db[_0x901c('0x8d')],{'through':_0x901c('0x19c'),'as':_0x901c('0x15d')});db[_0x901c('0x10e')]['belongsToMany'](db[_0x901c('0x12')],{'as':_0x901c('0x16d'),'through':_0x901c('0x11f'),'foreignKey':_0x901c('0x1ea')});db['WhatsappMessage']['belongsTo'](db['User'],{'as':_0x901c('0x12')});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x14a')});db[_0x901c('0xf3')]['belongsTo'](db[_0x901c('0x10e')],{'onDelete':_0x901c('0x105'),'as':_0x901c('0x160'),'foreignKey':_0x901c('0x1ea')});db['WhatsappMessage'][_0x901c('0x112')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x901c('0x1e9')});db[_0x901c('0xf4')][_0x901c('0x112')](db[_0x901c('0xf0')],{});db[_0x901c('0xf4')][_0x901c('0x112')](db[_0x901c('0xec')],{'as':'List','foreignKey':_0x901c('0x156')});db[_0x901c('0xf4')][_0x901c('0x112')](db[_0x901c('0x72')],{'as':_0x901c('0x14a'),'foreignKey':_0x901c('0x14b')});db['WhatsappQueueReport']['belongsTo'](db[_0x901c('0x10e')],{});db[_0x901c('0xf4')]['belongsTo'](db[_0x901c('0xf7')],{});db[_0x901c('0xf4')][_0x901c('0x112')](db[_0x901c('0xf3')],{});db['WhatsappQueueReport'][_0x901c('0x112')](db['User'],{});db[_0x901c('0xf5')][_0x901c('0x112')](db[_0x901c('0xf3')],{});db[_0x901c('0xf5')]['belongsTo'](db[_0x901c('0x10e')],{});db[_0x901c('0xf5')][_0x901c('0x112')](db[_0x901c('0xf0')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x901c('0xf5')][_0x901c('0x112')](db[_0x901c('0xf0')],{'foreignKey':_0x901c('0x1eb'),'as':_0x901c('0x1d8')});db[_0x901c('0xf5')][_0x901c('0x112')](db[_0x901c('0xf7')],{'foreignKey':'ToQueueId','as':_0x901c('0x1d6')});db[_0x901c('0xf5')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x901c('0x1d2')});db['WhatsappTransferReport'][_0x901c('0x112')](db[_0x901c('0x12')],{'foreignKey':_0x901c('0x1d3'),'as':_0x901c('0x1d4')});db[_0x901c('0xf7')][_0x901c('0x113')](db[_0x901c('0x12')],{'as':'Agents','through':_0x901c('0x38'),'foreignKey':'WhatsappQueueId'});db[_0x901c('0xf7')][_0x901c('0x113')](db[_0x901c('0x118')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0x901c('0x1ec')]['belongsTo'](db[_0x901c('0x12')],{'as':'user','foreignKey':_0x901c('0xff'),'onDelete':'cascade','hooks':!![]});db[_0x901c('0xf9')][_0x901c('0xfd')](db[_0x901c('0xc0')],{'as':_0x901c('0xc0'),'onDelete':'restrict'});db[_0x901c('0xf9')][_0x901c('0xfd')](db['MailServerIn'],{'as':'Imap','onDelete':_0x901c('0x14e')});db[_0x901c('0xf9')][_0x901c('0xfd')](db['MailServerOut'],{'as':_0x901c('0x150'),'onDelete':_0x901c('0x14e')});module[_0x901c('0x1ed')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 510689d..4bcff73 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b3=['/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/queues/reports','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/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/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections'];(function(_0x57d671,_0x1a101c){var _0x450dfe=function(_0x53c457){while(--_0x53c457){_0x57d671['push'](_0x57d671['shift']());}};_0x450dfe(++_0x1a101c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3c1ca7,_0x264ab5){_0x3c1ca7=_0x3c1ca7-0x0;var _0x2f7e2f=_0xe5b3[_0x3c1ca7];return _0x2f7e2f;};'use strict';var path=require('path');var express=require(_0x3e5b('0x0'));var errors=require(_0x3e5b('0x1'));var config=require(_0x3e5b('0x2'));var setupLoggers=require(_0x3e5b('0x3'))[_0x3e5b('0x4')];var clientSideLogs=require(_0x3e5b('0x5'));exports[_0x3e5b('0x6')]=function(_0x1e58ed){return setupLoggers(_0x1e58ed)[_0x3e5b('0x7')](function(){_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x9'),require('./api/user'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa'),require('./api/voiceChanSpy'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb'),require(_0x3e5b('0xc')));_0x1e58ed[_0x3e5b('0x8')]('/api/voice/extensions',require('./api/voiceExtension'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xd'),require(_0x3e5b('0xe')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf'),require('./api/voiceQueue'));_0x1e58ed[_0x3e5b('0x8')]('/api/voice/recordings',require(_0x3e5b('0x10')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x11'),require(_0x3e5b('0x12')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x13'),require(_0x3e5b('0x14')));_0x1e58ed['use'](_0x3e5b('0x15'),require('./api/voiceMailMessage'));_0x1e58ed['use']('/api/voice/calls/reports',require(_0x3e5b('0x16')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x17'),require('./api/voiceDialReport'));_0x1e58ed[_0x3e5b('0x8')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x18'),require('./api/voiceQueueReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x19'),require('./api/memberReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x1a'),require('./api/trunk'));_0x1e58ed['use'](_0x3e5b('0x1b'),require(_0x3e5b('0x1c')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x1d'),require(_0x3e5b('0x1e')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x1f'),require(_0x3e5b('0x20')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x21'),require(_0x3e5b('0x22')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x23'),require(_0x3e5b('0x24')));_0x1e58ed['use'](_0x3e5b('0x25'),require(_0x3e5b('0x26')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x27'),require('./api/mailMessage'));_0x1e58ed[_0x3e5b('0x8')]('/api/mail/applications',require(_0x3e5b('0x28')));_0x1e58ed[_0x3e5b('0x8')]('/api/mail/reports/queue',require(_0x3e5b('0x29')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x2a'),require(_0x3e5b('0x2b')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x2c'),require(_0x3e5b('0x2d')));_0x1e58ed[_0x3e5b('0x8')]('/api/fax/accounts',require(_0x3e5b('0x2e')));_0x1e58ed['use'](_0x3e5b('0x2f'),require('./api/faxApplication'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x30'),require(_0x3e5b('0x31')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x32'),require(_0x3e5b('0x33')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x34'),require(_0x3e5b('0x35')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x36'),require('./api/faxQueueReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x37'),require(_0x3e5b('0x38')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x39'),require(_0x3e5b('0x3a')));_0x1e58ed[_0x3e5b('0x8')]('/api/sms/interactions',require(_0x3e5b('0x3b')));_0x1e58ed['use']('/api/sms/messages',require(_0x3e5b('0x3c')));_0x1e58ed[_0x3e5b('0x8')]('/api/sms/queues',require(_0x3e5b('0x3d')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x3e'),require(_0x3e5b('0x3f')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x40'),require(_0x3e5b('0x41')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x42'),require(_0x3e5b('0x43')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x44'),require('./api/openchannelMessage'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x45'),require('./api/openchannelQueue'));_0x1e58ed['use'](_0x3e5b('0x46'),require('./api/chatWebsite'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x47'),require(_0x3e5b('0x48')));_0x1e58ed[_0x3e5b('0x8')]('/api/chat/applications',require(_0x3e5b('0x49')));_0x1e58ed['use'](_0x3e5b('0x4a'),require('./api/chatInteraction'));_0x1e58ed['use']('/api/chat/messages',require(_0x3e5b('0x4b')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x4c'),require(_0x3e5b('0x4d')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x4e'),require('./api/chatQueue'));_0x1e58ed['use']('/api/chat/groups',require('./api/chatGroup'));_0x1e58ed['use']('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x4f'),require(_0x3e5b('0x50')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x51'),require(_0x3e5b('0x52')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x53'),require(_0x3e5b('0x54')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x55'),require('./api/cmHopperBlack'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x56'),require(_0x3e5b('0x57')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x58'),require(_0x3e5b('0x59')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x5a'),require(_0x3e5b('0x5b')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x5c'),require('./api/action'));_0x1e58ed['use']('/api/automations',require('./api/automation'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x5d'),require(_0x3e5b('0x5e')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x5f'),require(_0x3e5b('0x60')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x61'),require(_0x3e5b('0x62')));_0x1e58ed[_0x3e5b('0x8')]('/api/intervals',require(_0x3e5b('0x63')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x64'),require(_0x3e5b('0x65')));_0x1e58ed[_0x3e5b('0x8')]('/api/cdr',require('./api/cdr'));_0x1e58ed['use'](_0x3e5b('0x66'),require(_0x3e5b('0x67')));_0x1e58ed[_0x3e5b('0x8')]('/api/schedules',require('./api/schedule'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x68'),require(_0x3e5b('0x69')));_0x1e58ed['use']('/api/tags',require(_0x3e5b('0x6a')));_0x1e58ed['use'](_0x3e5b('0x6b'),require(_0x3e5b('0x6c')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x6d'),require(_0x3e5b('0x6e')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x6f'),require(_0x3e5b('0x70')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations',require(_0x3e5b('0x71')));_0x1e58ed['use'](_0x3e5b('0x72'),require(_0x3e5b('0x73')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x74'),require(_0x3e5b('0x75')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x76'),require(_0x3e5b('0x77')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x78'),require(_0x3e5b('0x79')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x7a'),require('./api/analyticMetric'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x7b'),require(_0x3e5b('0x7c')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x7d'),require(_0x3e5b('0x7e')));_0x1e58ed['use'](_0x3e5b('0x7f'),require(_0x3e5b('0x80')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x81'),require(_0x3e5b('0x82')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x83'),require(_0x3e5b('0x84')));_0x1e58ed['use'](_0x3e5b('0x85'),require('./api/intSugarcrmAccount'));_0x1e58ed['use'](_0x3e5b('0x86'),require('./api/intSugarcrmConfiguration'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x87'),require(_0x3e5b('0x88')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x1e58ed['use']('/api/integrations/desk/configurations',require(_0x3e5b('0x89')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x8a'),require(_0x3e5b('0x8b')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x8c'),require(_0x3e5b('0x8d')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x8e'),require('./api/intZohoField'));_0x1e58ed['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x8f'),require(_0x3e5b('0x90')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x91'),require(_0x3e5b('0x92')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x93'),require('./api/intFreshdeskAccount'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x94'),require(_0x3e5b('0x95')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x96'),require('./api/intFreshdeskField'));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/vtiger/accounts',require(_0x3e5b('0x97')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1e58ed['use'](_0x3e5b('0x98'),require('./api/intVtigerField'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x99'),require(_0x3e5b('0x9a')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x9b'),require('./api/intServicenowConfiguration'));_0x1e58ed['use'](_0x3e5b('0x9c'),require(_0x3e5b('0x9d')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/dynamics365/accounts',require(_0x3e5b('0x9e')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x9f'),require(_0x3e5b('0xa0')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa1'),require(_0x3e5b('0xa2')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa3'),require(_0x3e5b('0xa4')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa5'),require(_0x3e5b('0xa6')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa7'),require(_0x3e5b('0xa8')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa9'),require('./api/network'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xaa'),require('./api/chatQueueReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xab'),require('./api/chatInternalMessage'));_0x1e58ed['use']('/api/jscripty/answers/reports',require(_0x3e5b('0xac')));_0x1e58ed[_0x3e5b('0x8')]('/api/jscripty/questions/reports',require(_0x3e5b('0xad')));_0x1e58ed[_0x3e5b('0x8')]('/api/jscripty/sessions/reports',require(_0x3e5b('0xae')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xaf'),require(_0x3e5b('0xb0')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb1'),require(_0x3e5b('0xb2')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb3'),require('./api/squareReportDetail'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb4'),require(_0x3e5b('0xb5')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb6'),require(_0x3e5b('0xb7')));_0x1e58ed[_0x3e5b('0x8')]('/api/square/odbc',require('./api/squareOdbc'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb8'),require('./api/squareProject'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb9'),require(_0x3e5b('0xba')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xbb'),require(_0x3e5b('0xbc')));_0x1e58ed[_0x3e5b('0x8')]('/api/teams',require(_0x3e5b('0xbd')));_0x1e58ed[_0x3e5b('0x8')]('/api/license',require('./api/license'));_0x1e58ed['use'](_0x3e5b('0xbe'),require(_0x3e5b('0xbf')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xc0'),require(_0x3e5b('0xc1')));_0x1e58ed[_0x3e5b('0x8')]('/api/attachments',require(_0x3e5b('0xc2')));_0x1e58ed[_0x3e5b('0x8')]('/api/plugins',require(_0x3e5b('0xc3')));_0x1e58ed['use']('/api/mail/reports/transfer',require(_0x3e5b('0xc4')));_0x1e58ed[_0x3e5b('0x8')]('/api/chat/reports/transfer',require(_0x3e5b('0xc5')));_0x1e58ed[_0x3e5b('0x8')]('/api/fax/reports/transfer',require(_0x3e5b('0xc6')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xc7'),require(_0x3e5b('0xc8')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xc9'),require('./api/smsTransferReport'));_0x1e58ed['use'](_0x3e5b('0xca'),require('./api/cmList'));_0x1e58ed['use'](_0x3e5b('0xcb'),require(_0x3e5b('0xcc')));_0x1e58ed[_0x3e5b('0x8')]('/api/userProfiles',require(_0x3e5b('0xcd')));_0x1e58ed['use'](_0x3e5b('0xce'),require('./api/userProfileSection'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xcf'),require(_0x3e5b('0xd0')));_0x1e58ed[_0x3e5b('0x8')]('/api/userNotifications',require(_0x3e5b('0xd1')));_0x1e58ed['use'](_0x3e5b('0xd2'),require(_0x3e5b('0xd3')));_0x1e58ed['use'](_0x3e5b('0xd4'),require(_0x3e5b('0xd5')));_0x1e58ed[_0x3e5b('0x8')]('/api/whatsapp/interactions',require(_0x3e5b('0xd6')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xd7'),require('./api/whatsappMessage'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xd8'),require('./api/whatsappQueueReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xd9'),require(_0x3e5b('0xda')));_0x1e58ed['use'](_0x3e5b('0xdb'),require(_0x3e5b('0xdc')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xdd'),require('./api/cloudProvider'));_0x1e58ed[_0x3e5b('0x8')]('/api/realtime',require(_0x3e5b('0xde')));_0x1e58ed['use'](_0x3e5b('0xdf'),require(_0x3e5b('0xe0')));_0x1e58ed['use'](_0x3e5b('0xe1'),require(_0x3e5b('0xe2')));_0x1e58ed['use'](_0x3e5b('0xe3'),require(_0x3e5b('0xe4')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xe5'),require('./api/authActiveDirectory'));_0x1e58ed['use'](_0x3e5b('0xe6'),require(_0x3e5b('0xe7')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xe8'),require(_0x3e5b('0xe9')));_0x1e58ed[_0x3e5b('0x8')]('/api/version',require('./api/version'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xea'),require(_0x3e5b('0xeb')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xec'),require(_0x3e5b('0xed')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xee'),require('./api/webbar'));_0x1e58ed['use'](_0x3e5b('0xef'),clientSideLogs);_0x1e58ed['use'](_0x3e5b('0xf0'),express[_0x3e5b('0xf1')](path[_0x3e5b('0xf2')](config[_0x3e5b('0xf3')],_0x3e5b('0xf0'))));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf4'),express[_0x3e5b('0xf1')](path[_0x3e5b('0xf2')](config[_0x3e5b('0xf3')],_0x3e5b('0xf4'))));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf5'),express['static'](path['join'](config[_0x3e5b('0xf3')],_0x3e5b('0xf5'))));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf6'),express['static'](path[_0x3e5b('0xf2')](config['root'],_0x3e5b('0xf7'),'3.0.0')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf8'),express[_0x3e5b('0xf1')](path[_0x3e5b('0xf2')](config[_0x3e5b('0xf3')],_0x3e5b('0xf9'))));_0x1e58ed[_0x3e5b('0xfa')](_0x3e5b('0xfb'))[_0x3e5b('0xfc')](errors[0x194]);_0x1e58ed['route']('/*')[_0x3e5b('0xfc')](function(_0x2ee814,_0x4c81dc){_0x4c81dc[_0x3e5b('0xfd')](path[_0x3e5b('0xfe')](_0x1e58ed[_0x3e5b('0xfc')](_0x3e5b('0xff'))+_0x3e5b('0x100')));});return _0x1e58ed;});}; \ No newline at end of file +var _0xeec6=['/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./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/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','appPath','path','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog'];(function(_0x139c24,_0x498380){var _0x21e02c=function(_0x55e54a){while(--_0x55e54a){_0x139c24['push'](_0x139c24['shift']());}};_0x21e02c(++_0x498380);}(_0xeec6,0x1c2));var _0x6eec=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xeec6[_0x587fb5];return _0x551105;};'use strict';var path=require(_0x6eec('0x0'));var express=require(_0x6eec('0x1'));var errors=require(_0x6eec('0x2'));var config=require(_0x6eec('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0x6eec('0x4')];var clientSideLogs=require(_0x6eec('0x5'));exports[_0x6eec('0x6')]=function(_0x2d7a15){return setupLoggers(_0x2d7a15)[_0x6eec('0x7')](function(){_0x2d7a15[_0x6eec('0x8')]('/api/users',require(_0x6eec('0x9')));_0x2d7a15[_0x6eec('0x8')]('/api/voice/chanspy',require(_0x6eec('0xa')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb'),require(_0x6eec('0xc')));_0x2d7a15['use'](_0x6eec('0xd'),require(_0x6eec('0xe')));_0x2d7a15[_0x6eec('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x2d7a15['use'](_0x6eec('0xf'),require(_0x6eec('0x10')));_0x2d7a15['use']('/api/voice/recordings',require(_0x6eec('0x11')));_0x2d7a15['use'](_0x6eec('0x12'),require(_0x6eec('0x13')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x14'),require(_0x6eec('0x15')));_0x2d7a15['use'](_0x6eec('0x16'),require(_0x6eec('0x17')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x18'),require(_0x6eec('0x19')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x1a'),require(_0x6eec('0x1b')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x1c'),require('./api/voiceAgentReport'));_0x2d7a15[_0x6eec('0x8')]('/api/voice/queues/reports',require(_0x6eec('0x1d')));_0x2d7a15[_0x6eec('0x8')]('/api/members/reports',require(_0x6eec('0x1e')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x1f'),require('./api/trunk'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x20'),require(_0x6eec('0x21')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x22'),require(_0x6eec('0x23')));_0x2d7a15['use'](_0x6eec('0x24'),require(_0x6eec('0x25')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x26'),require(_0x6eec('0x27')));_0x2d7a15[_0x6eec('0x8')]('/api/mail/substatuses',require(_0x6eec('0x28')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x29'),require(_0x6eec('0x2a')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x2b'),require('./api/mailMessage'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x2c'),require(_0x6eec('0x2d')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x2e'),require(_0x6eec('0x2f')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x30'),require(_0x6eec('0x31')));_0x2d7a15['use'](_0x6eec('0x32'),require(_0x6eec('0x33')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x34'),require('./api/faxAccount'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x35'),require('./api/faxApplication'));_0x2d7a15['use'](_0x6eec('0x36'),require('./api/faxInteraction'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x37'),require(_0x6eec('0x38')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x39'),require(_0x6eec('0x3a')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x3b'),require(_0x6eec('0x3c')));_0x2d7a15[_0x6eec('0x8')]('/api/sms/accounts',require(_0x6eec('0x3d')));_0x2d7a15['use'](_0x6eec('0x3e'),require(_0x6eec('0x3f')));_0x2d7a15[_0x6eec('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x2d7a15['use'](_0x6eec('0x40'),require(_0x6eec('0x41')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x42'),require(_0x6eec('0x43')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x44'),require(_0x6eec('0x45')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x46'),require(_0x6eec('0x47')));_0x2d7a15[_0x6eec('0x8')]('/api/openchannel/interactions',require(_0x6eec('0x48')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x49'),require('./api/openchannelMessage'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x4a'),require(_0x6eec('0x4b')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x4c'),require(_0x6eec('0x4d')));_0x2d7a15['use'](_0x6eec('0x4e'),require(_0x6eec('0x4f')));_0x2d7a15[_0x6eec('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x50'),require(_0x6eec('0x51')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x52'),require('./api/chatMessage'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x53'),require(_0x6eec('0x54')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x55'),require(_0x6eec('0x56')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x57'),require('./api/chatGroup'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x58'),require('./api/chatProactiveAction'));_0x2d7a15['use'](_0x6eec('0x59'),require(_0x6eec('0x5a')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x5b'),require('./api/cmContact'));_0x2d7a15['use'](_0x6eec('0x5c'),require('./api/cmHopper'));_0x2d7a15['use'](_0x6eec('0x5d'),require(_0x6eec('0x5e')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x5f'),require(_0x6eec('0x60')));_0x2d7a15['use'](_0x6eec('0x61'),require(_0x6eec('0x62')));_0x2d7a15['use'](_0x6eec('0x63'),require(_0x6eec('0x64')));_0x2d7a15['use'](_0x6eec('0x65'),require(_0x6eec('0x66')));_0x2d7a15['use'](_0x6eec('0x67'),require(_0x6eec('0x68')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x69'),require('./api/cannedAnswer'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x6a'),require(_0x6eec('0x6b')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x6c'),require('./api/condition'));_0x2d7a15['use'](_0x6eec('0x6d'),require(_0x6eec('0x6e')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x6f'),require(_0x6eec('0x70')));_0x2d7a15['use'](_0x6eec('0x71'),require('./api/cdr'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x72'),require(_0x6eec('0x73')));_0x2d7a15['use'](_0x6eec('0x74'),require(_0x6eec('0x75')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x76'),require(_0x6eec('0x77')));_0x2d7a15['use'](_0x6eec('0x78'),require('./api/tag'));_0x2d7a15['use'](_0x6eec('0x79'),require('./api/template'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x7a'),require(_0x6eec('0x7b')));_0x2d7a15['use']('/api/variables',require(_0x6eec('0x7c')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x7d'),require(_0x6eec('0x7e')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x7f'),require(_0x6eec('0x80')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x81'),require(_0x6eec('0x82')));_0x2d7a15['use']('/api/analytics/default_reports',require(_0x6eec('0x83')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x84'),require('./api/analyticExtractedReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x85'),require(_0x6eec('0x86')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x87'),require(_0x6eec('0x88')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x89'),require('./api/analyticTreeReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x8a'),require(_0x6eec('0x8b')));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x2d7a15['use'](_0x6eec('0x8c'),require(_0x6eec('0x8d')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x8e'),require('./api/intSugarcrmAccount'));_0x2d7a15['use'](_0x6eec('0x8f'),require(_0x6eec('0x90')));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/sugarcrm/fields',require(_0x6eec('0x91')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x92'),require(_0x6eec('0x93')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x94'),require(_0x6eec('0x95')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x96'),require('./api/intDeskField'));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/zoho/accounts',require(_0x6eec('0x97')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x98'),require(_0x6eec('0x99')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x9a'),require(_0x6eec('0x9b')));_0x2d7a15['use'](_0x6eec('0x9c'),require('./api/intZendeskAccount'));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/zendesk/configurations',require(_0x6eec('0x9d')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x9e'),require(_0x6eec('0x9f')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xa0'),require(_0x6eec('0xa1')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xa2'),require(_0x6eec('0xa3')));_0x2d7a15['use']('/api/integrations/freshdesk/fields',require(_0x6eec('0xa4')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xa5'),require(_0x6eec('0xa6')));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/vtiger/configurations',require(_0x6eec('0xa7')));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x2d7a15['use'](_0x6eec('0xa8'),require(_0x6eec('0xa9')));_0x2d7a15['use'](_0x6eec('0xaa'),require(_0x6eec('0xab')));_0x2d7a15['use'](_0x6eec('0xac'),require(_0x6eec('0xad')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xae'),require('./api/intDynamics365Account'));_0x2d7a15['use'](_0x6eec('0xaf'),require(_0x6eec('0xb0')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb1'),require(_0x6eec('0xb2')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb3'),require(_0x6eec('0xb4')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb5'),require(_0x6eec('0xb6')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb7'),require(_0x6eec('0xb8')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb9'),require(_0x6eec('0xba')));_0x2d7a15['use'](_0x6eec('0xbb'),require(_0x6eec('0xbc')));_0x2d7a15['use'](_0x6eec('0xbd'),require(_0x6eec('0xbe')));_0x2d7a15['use'](_0x6eec('0xbf'),require(_0x6eec('0xc0')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc1'),require('./api/jscriptyQuestionReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc2'),require(_0x6eec('0xc3')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc4'),require(_0x6eec('0xc5')));_0x2d7a15['use'](_0x6eec('0xc6'),require('./api/squareReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc7'),require(_0x6eec('0xc8')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc9'),require(_0x6eec('0xca')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xcb'),require(_0x6eec('0xcc')));_0x2d7a15['use'](_0x6eec('0xcd'),require(_0x6eec('0xce')));_0x2d7a15[_0x6eec('0x8')]('/api/square/projects',require(_0x6eec('0xcf')));_0x2d7a15[_0x6eec('0x8')]('/api/square/recordings',require(_0x6eec('0xd0')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xd1'),require(_0x6eec('0xd2')));_0x2d7a15[_0x6eec('0x8')]('/api/teams',require(_0x6eec('0xd3')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xd4'),require(_0x6eec('0xd5')));_0x2d7a15[_0x6eec('0x8')]('/api/campaigns',require(_0x6eec('0xd6')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xd7'),require(_0x6eec('0xd8')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xd9'),require(_0x6eec('0xda')));_0x2d7a15[_0x6eec('0x8')]('/api/plugins',require(_0x6eec('0xdb')));_0x2d7a15['use'](_0x6eec('0xdc'),require(_0x6eec('0xdd')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xde'),require('./api/chatTransferReport'));_0x2d7a15[_0x6eec('0x8')]('/api/fax/reports/transfer',require(_0x6eec('0xdf')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xe0'),require(_0x6eec('0xe1')));_0x2d7a15['use']('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xe2'),require(_0x6eec('0xe3')));_0x2d7a15[_0x6eec('0x8')]('/api/voice/prefixes',require(_0x6eec('0xe4')));_0x2d7a15['use'](_0x6eec('0xe5'),require(_0x6eec('0xe6')));_0x2d7a15['use'](_0x6eec('0xe7'),require(_0x6eec('0xe8')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xe9'),require(_0x6eec('0xea')));_0x2d7a15[_0x6eec('0x8')]('/api/userNotifications',require(_0x6eec('0xeb')));_0x2d7a15['use'](_0x6eec('0xec'),require(_0x6eec('0xed')));_0x2d7a15['use'](_0x6eec('0xee'),require('./api/whatsappApplication'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xef'),require(_0x6eec('0xf0')));_0x2d7a15[_0x6eec('0x8')]('/api/whatsapp/messages',require(_0x6eec('0xf1')));_0x2d7a15['use'](_0x6eec('0xf2'),require(_0x6eec('0xf3')));_0x2d7a15['use'](_0x6eec('0xf4'),require(_0x6eec('0xf5')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xf6'),require(_0x6eec('0xf7')));_0x2d7a15['use'](_0x6eec('0xf8'),require(_0x6eec('0xf9')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xfa'),require(_0x6eec('0xfb')));_0x2d7a15[_0x6eec('0x8')]('/api/user-settings',require('./api/user-setting'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xfc'),require('./api/authLocal'));_0x2d7a15['use'](_0x6eec('0xfd'),require(_0x6eec('0xfe')));_0x2d7a15['use'](_0x6eec('0xff'),require(_0x6eec('0x100')));_0x2d7a15[_0x6eec('0x8')]('/api/jira',require(_0x6eec('0x101')));_0x2d7a15['use'](_0x6eec('0x102'),require(_0x6eec('0x103')));_0x2d7a15['use'](_0x6eec('0x104'),require(_0x6eec('0x105')));_0x2d7a15[_0x6eec('0x8')]('/api/system',require(_0x6eec('0x106')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x107'),require(_0x6eec('0x108')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x109'),require('./api/webbar'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x10a'),clientSideLogs);_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x10b'),express[_0x6eec('0x10c')](path[_0x6eec('0x10d')](config[_0x6eec('0x10e')],_0x6eec('0x10b'))));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x10f'),express[_0x6eec('0x10c')](path[_0x6eec('0x10d')](config['root'],_0x6eec('0x10f'))));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x110'),express[_0x6eec('0x10c')](path[_0x6eec('0x10d')](config[_0x6eec('0x10e')],_0x6eec('0x110'))));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x111'),express[_0x6eec('0x10c')](path[_0x6eec('0x10d')](config[_0x6eec('0x10e')],_0x6eec('0x112'),_0x6eec('0x113'))));_0x2d7a15[_0x6eec('0x8')]('/plugins',express[_0x6eec('0x10c')](path['join'](config[_0x6eec('0x10e')],_0x6eec('0x114'))));_0x2d7a15[_0x6eec('0x115')](_0x6eec('0x116'))['get'](errors[0x194]);_0x2d7a15[_0x6eec('0x115')]('/*')['get'](function(_0x205310,_0x340f8c){_0x340f8c[_0x6eec('0x117')](path[_0x6eec('0x118')](_0x2d7a15[_0x6eec('0x119')](_0x6eec('0x11a'))+'/index.html'));});return _0x2d7a15;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 97b2545..c7e02d1 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe118=['port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0xe118,0x7b));var _0x8e11=function(_0x221eb2,_0x2d65bc){_0x221eb2=_0x221eb2-0x0;var _0x3760ee=_0xe118[_0x221eb2];return _0x3760ee;};'use strict';var jayson=require(_0x8e11('0x0'));var _=require(_0x8e11('0x1'));var config=require('../config/environment');exports[_0x8e11('0x2')]=function(){return new Promise(function(_0x3f4f12,_0x2f1a9e){var _0x283c7e={};_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x4')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x5')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x6')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/voiceRecording/voiceRecording.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x7')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x8')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x9')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0xa')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0xb')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/trunk/trunk.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/mailServerIn/mailServerIn.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0xc')));_0x283c7e=_['merge'](_0x283c7e,require('../api/mailQueue/mailQueue.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0xd')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0xe')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/mailApplication/mailApplication.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0xf')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/faxAccount/faxAccount.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x10')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x11')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/faxMessage/faxMessage.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x12')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x13')));_0x283c7e=_['merge'](_0x283c7e,require('../api/smsAccount/smsAccount.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x14')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/smsMessage/smsMessage.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x15')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x16')));_0x283c7e=_['merge'](_0x283c7e,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x17')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x18')));_0x283c7e=_['merge'](_0x283c7e,require('../api/chatInteraction/chatInteraction.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x19')));_0x283c7e=_['merge'](_0x283c7e,require('../api/chatQueue/chatQueue.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x1a')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x1b')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x1c')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x1d')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x1e')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x1f')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/template/template.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/trigger/trigger.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x20')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x21')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x22')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x23')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x283c7e=_['merge'](_0x283c7e,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x24')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x283c7e=_['merge'](_0x283c7e,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x25')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x26')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x27')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x28')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x29')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/squareOdbc/squareOdbc.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2a')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2b')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x2c')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/campaign/campaign.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2d')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2e')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2f')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x30')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x31')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x32')));var _0x44f6d3=jayson[_0x8e11('0x33')](_0x283c7e)[_0x8e11('0x34')]();var _0x5b44d3=config[_0x8e11('0x35')][_0x8e11('0x36')]||config[_0x8e11('0x36')]+0x1;var _0xee352c=config['rpc']['ip']||'localhost';_0x44f6d3['on'](_0x8e11('0x37'),function(_0x2968c9){return _0x2f1a9e(_0x2968c9);});_0x44f6d3[_0x8e11('0x2')](_0x5b44d3,_0xee352c,function(){console[_0x8e11('0x38')](_0x8e11('0x39'),_0xee352c,_0x5b44d3);require('../config/triggers')[_0x8e11('0x3a')]();return _0x3f4f12('RPC\x20listening\x20on\x20'+_0xee352c+':'+_0x5b44d3);});});}; \ No newline at end of file +var _0x7d2e=['../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/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc'];(function(_0x266043,_0x4e51cb){var _0x5d6f62=function(_0x21af4e){while(--_0x21af4e){_0x266043['push'](_0x266043['shift']());}};_0x5d6f62(++_0x4e51cb);}(_0x7d2e,0x1b2));var _0xe7d2=function(_0x5300b6,_0x4a5846){_0x5300b6=_0x5300b6-0x0;var _0x58980e=_0x7d2e[_0x5300b6];return _0x58980e;};'use strict';var jayson=require(_0xe7d2('0x0'));var _=require(_0xe7d2('0x1'));var config=require(_0xe7d2('0x2'));exports[_0xe7d2('0x3')]=function(){return new Promise(function(_0xce8482,_0xe5f4d3){var _0x2aac25={};_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x5')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x6')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x7')));_0x2aac25=_['merge'](_0x2aac25,require('../api/voiceRecording/voiceRecording.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x8')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x9')));_0x2aac25=_['merge'](_0x2aac25,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0xa')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0xb')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0xc')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0xd')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require('../api/mailServerIn/mailServerIn.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0xe')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require('../api/mailQueue/mailQueue.rpc'));_0x2aac25=_['merge'](_0x2aac25,require('../api/mailInteraction/mailInteraction.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0xf')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x10')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x11')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x12')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x13')));_0x2aac25=_['merge'](_0x2aac25,require(_0xe7d2('0x14')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x15')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require('../api/faxQueue/faxQueue.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x16')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x17')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x18')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x19')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x1a')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x1b')));_0x2aac25=_['merge'](_0x2aac25,require(_0xe7d2('0x1c')));_0x2aac25=_['merge'](_0x2aac25,require(_0xe7d2('0x1d')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x1e')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x1f')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x20')));_0x2aac25=_['merge'](_0x2aac25,require(_0xe7d2('0x21')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x22')));_0x2aac25=_['merge'](_0x2aac25,require(_0xe7d2('0x23')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x24')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x25')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x26')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x27')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x28')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require('../api/interval/interval.rpc'));_0x2aac25=_['merge'](_0x2aac25,require(_0xe7d2('0x29')));_0x2aac25=_['merge'](_0x2aac25,require('../api/sound/sound.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x2a')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x2b')));_0x2aac25=_['merge'](_0x2aac25,require(_0xe7d2('0x2c')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x2d')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x2e')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x2f')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x30')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x31')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x32')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x33')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x34')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x35')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x36')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require('../api/squareReport/squareReport.rpc'));_0x2aac25=_['merge'](_0x2aac25,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x37')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x38')));_0x2aac25=_['merge'](_0x2aac25,require('../api/squareProject/squareProject.rpc'));_0x2aac25=_['merge'](_0x2aac25,require(_0xe7d2('0x39')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x3a')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x3b')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x3c')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x3d')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x3e')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x3f')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x40')));_0x2aac25=_[_0xe7d2('0x4')](_0x2aac25,require(_0xe7d2('0x41')));_0x2aac25=_['merge'](_0x2aac25,require(_0xe7d2('0x42')));var _0x57fca5=jayson[_0xe7d2('0x43')](_0x2aac25)[_0xe7d2('0x44')]();var _0x5cfa3a=config[_0xe7d2('0x45')][_0xe7d2('0x46')]||config[_0xe7d2('0x46')]+0x1;var _0x579c37=config[_0xe7d2('0x45')]['ip']||_0xe7d2('0x47');_0x57fca5['on'](_0xe7d2('0x48'),function(_0x2470c0){return _0xe5f4d3(_0x2470c0);});_0x57fca5[_0xe7d2('0x3')](_0x5cfa3a,_0x579c37,function(){console['log'](_0xe7d2('0x49'),_0x579c37,_0x5cfa3a);require(_0xe7d2('0x4a'))['default']();return _0xce8482(_0xe7d2('0x4b')+_0x579c37+':'+_0x5cfa3a);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 0986c7f..962ef21 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 _0xacf5=['toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','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','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','replace','result=','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','function','write','prototype','sendRequest','command','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber'];(function(_0x9f93d1,_0x2ed4ec){var _0x271751=function(_0x3b9a33){while(--_0x3b9a33){_0x9f93d1['push'](_0x9f93d1['shift']());}};_0x271751(++_0x2ed4ec);}(_0xacf5,0x110));var _0x5acf=function(_0x138188,_0x1f4c40){_0x138188=_0x138188-0x0;var _0x3b10a1=_0xacf5[_0x138188];return _0x3b10a1;};'use strict';var util=require(_0x5acf('0x0'));var _=require(_0x5acf('0x1'));var EventEmitter=require(_0x5acf('0x2'))[_0x5acf('0x3')];var AGIReply=require(_0x5acf('0x4'));var AGIError=require(_0x5acf('0x5'));function AGIChannel(_0x2ba0dd){var _0x17bf56=this,_0xe57842=new AGIReply(),_0x40302f=![],_0x58e205={};EventEmitter[_0x5acf('0x6')](_0x17bf56);_0x2ba0dd[_0x5acf('0x7')](_0x5acf('0x8'));_0x2ba0dd[_0x5acf('0x9')](0x8*0x3c*0x3c*0x3e8);_0xe57842[_0x5acf('0x7')]('utf8');_0xe57842['on'](_0x5acf('0xa'),function(_0x5f12f0){for(var _0x64e6b7 in _0x5f12f0){_0x17bf56[_0x64e6b7]=_0x5f12f0[_0x64e6b7];}_0x17bf56[_0x5acf('0xb')]('ready');});_0xe57842['on'](_0x5acf('0xc'),function(_0x36c207){if(_0x36c207[_0x5acf('0xd')]()==_0x5acf('0xe')){_0x17bf56[_0x5acf('0xb')](_0x5acf('0xe'));return;}if(_0x36c207[_0x5acf('0xf')](0x0,0xb)==_0x5acf('0x10')){_0x40302f=!![];}if(_0x40302f){_0x58e205['rx']+=_0x36c207+'\x0a';if(_0x36c207[_0x5acf('0x11')](_0x5acf('0x12'))!=-0x1){_0x40302f=![];}}else{_0x58e205['rx']=_0x36c207;}if(_0x40302f){return;}if(typeof _0x58e205['cb']=='function'){var _0x572e1a=_0x58e205['rx'][_0x5acf('0xf')](0x0,0x3),_0x53afd8=null,_0x322294=null;_0x572e1a=parseInt(_0x572e1a);if(isNaN(_0x572e1a)){_0x58e205['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x572e1a!=0xc8){_0x58e205['cb'](null,{'code':_0x572e1a,'result':-0x1,'extra':'KO'});return;}_0x53afd8=_0x58e205['rx']['substring'](0x4)[_0x5acf('0x13')](_0x5acf('0x14'),'');if(_0x53afd8[_0x5acf('0x15')]('\x20')!=-0x1){_0x53afd8=_0x53afd8['substr'](0x0,_0x53afd8[_0x5acf('0x15')]('\x20'));}if(_[_0x5acf('0x16')](_0x53afd8,'-1')){_0x53afd8=parseInt(_0x53afd8);}_0x322294=_0x58e205['rx']['split']('\x20');if(_0x322294[_0x5acf('0x17')]==0x3){_0x322294=_0x322294[0x2]['substring'](0x1,_0x322294[0x2][_0x5acf('0x17')]-0x1);}else if(_0x322294[_0x5acf('0x17')]>0x3){var _0x27373f=/\((.+)\)/;var _0x195748=_0x58e205['rx'][_0x5acf('0x18')](_0x27373f);if(_0x195748){_0x322294=_0x195748[0x1];}else{_0x322294=null;}}else{_0x322294=null;}_0x58e205['cb'](null,{'code':_0x572e1a,'result':_0x53afd8,'extra':_0x322294});}});_0x2ba0dd['on'](_0x5acf('0x19'),function(_0x2987c4){_0x17bf56[_0x5acf('0xb')](_0x5acf('0x19'),new AGIError(_0x5acf('0x1a'),_0x2987c4[_0x5acf('0x1b')]));});_0x2ba0dd['on'](_0x5acf('0x1c'),function(){_0x17bf56['emit'](_0x5acf('0x1c'),new AGIError(_0x5acf('0x1d')));});_0x2ba0dd['on']('timeout',function(){_0x17bf56[_0x5acf('0xb')](_0x5acf('0x1e'),new AGIError(_0x5acf('0x1f')));_0x2ba0dd[_0x5acf('0x20')]();});_0x2ba0dd[_0x5acf('0x21')](_0xe57842);this['command']=function(_0x459fda,_0x329d65){var _0x459fda=_0x459fda||'',_0x329d65=typeof _0x329d65==_0x5acf('0x22')?_0x329d65:new Function();_0x58e205={'tx':_0x459fda,'rx':'','cb':_0x329d65};_0x2ba0dd[_0x5acf('0x23')](_0x459fda+'\x0a');},this[_0x5acf('0x1c')]=function(){_0x2ba0dd[_0x5acf('0x20')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x5acf('0x24')][_0x5acf('0x25')]=function(_0x910cd5){return this[_0x5acf('0x26')]['sync'](this,_0x910cd5);};AGIChannel[_0x5acf('0x24')][_0x5acf('0x27')]=function(){return this[_0x5acf('0x25')]('ANSWER');};AGIChannel[_0x5acf('0x24')][_0x5acf('0x28')]=function(_0xc40536,_0x445537,_0x85c8b5){_0xc40536=_0xc40536===undefined?_0x5acf('0x29'):_0xc40536;_0x445537=_0x445537===undefined?'5':_0x445537;_0x85c8b5=_0x85c8b5===undefined?'1':_0x85c8b5;return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x2b'),_0xc40536,_0x445537*0x3e8,_0x85c8b5));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x2c')]=function(_0x52d304){_0x52d304=_0x52d304||_0x5acf('0x2d');return this['sendRequest'](util[_0x5acf('0x2a')](_0x5acf('0x2e'),_0x52d304));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x2f')]=function(_0x9102f3,_0x5ddd31){if(_[_0x5acf('0x30')](_0x5ddd31)){return this[_0x5acf('0x25')](util['format'](_0x5acf('0x31'),_0x9102f3,_0x5ddd31[_0x5acf('0x32')](',')));}return this[_0x5acf('0x25')](util['format'](_0x5acf('0x31'),_0x9102f3,_0x5ddd31));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x33')]=function(_0xfc7ee1){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x34'),_0xfc7ee1));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x35')]=function(_0x30f54f){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x36'),_0x30f54f));};AGIChannel['prototype']['setPriority']=function(_0x4ce14d){return this['sendRequest'](util[_0x5acf('0x2a')](_0x5acf('0x37'),_0x4ce14d));};AGIChannel[_0x5acf('0x24')][_0x5acf('0xe')]=function(){return this['sendRequest'](_0x5acf('0x38'));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x39')]=function(_0x9e5e4e,_0xe6ad98){var _0x53f097=_[_0x5acf('0x3a')](_0xe6ad98)||_[_0x5acf('0x3b')](_0xe6ad98)?_0xe6ad98[_0x5acf('0x3c')]():_0xe6ad98;return this['sendRequest'](util[_0x5acf('0x2a')](_0x5acf('0x3d'),_0x9e5e4e,_0x53f097?_0x53f097[_0x5acf('0x3c')]()[_0x5acf('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x3e')]=function(_0x4c258b,_0x161446){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x3f'),_0x4c258b,_0x161446));};AGIChannel[_0x5acf('0x24')]['sayDigits']=function(_0x2038bc,_0x511447){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x40'),_0x2038bc,_0x511447));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x41')]=function(_0x39e19d,_0x18e21c){return this['sendRequest'](util[_0x5acf('0x2a')](_0x5acf('0x42'),_0x39e19d,_0x18e21c));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x43')]=function(_0x549f47,_0x5a0c4c,_0x257a03){_0x5a0c4c=_0x5a0c4c||this[_0x5acf('0x44')];_0x257a03=_0x257a03||0x1;this[_0x5acf('0x33')](_0x549f47);this[_0x5acf('0x35')](_0x5a0c4c);this[_0x5acf('0x45')](_0x257a03);return this[_0x5acf('0x2c')](util['format'](_0x5acf('0x46'),_0x549f47,_0x5a0c4c,_0x257a03));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x47')]=function(_0x1d5aa8){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x1d5aa8));};AGIChannel['prototype'][_0x5acf('0x48')]=function(_0x17e9ad,_0xdc43bc,_0x3fd927,_0x15e0cf,_0xc6c804,_0xb213e6){_0xdc43bc=_0xdc43bc||_0x5acf('0x49');_0x3fd927=_0x3fd927||'';_0x15e0cf=_0x15e0cf===undefined?-0x1:_0x15e0cf==='-1'?-0x1:_0x15e0cf*0x3e8;_0xc6c804=_0xc6c804===undefined?'':'s='+_0xc6c804;_0xb213e6=_0xb213e6?_0x5acf('0x4a'):'';return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x4b'),_0x17e9ad,_0xdc43bc,_0x3fd927,_0x15e0cf,_0xb213e6,_0xc6c804));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x4c')]=function(_0x679e76,_0x52ee91){_0x52ee91=_0x52ee91||'';return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x4d'),_0x679e76,_0x52ee91));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x4e')]=function(_0x2e2062){return this[_0x5acf('0x2f')]('AGI',_0x2e2062);};AGIChannel[_0x5acf('0x24')][_0x5acf('0x4f')]=function(_0x2e028f){return this['exec'](_0x5acf('0x50'),_0x2e028f);};AGIChannel[_0x5acf('0x24')][_0x5acf('0x19')]=function(_0x5c0329,_0x48d303){this[_0x5acf('0x2c')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5c0329['id'],_0x5c0329[_0x5acf('0x51')],_0x48d303));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5acf('0x52')]=AGIChannel; \ No newline at end of file +var _0x27cb=['destroy','command','write','prototype','sendRequest','sync','answer','ANSWER','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','format','VERBOSE\x20\x22%s\x22','isArray','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout'];(function(_0x126f42,_0x57f1ad){var _0x219119=function(_0xc6b727){while(--_0xc6b727){_0x126f42['push'](_0x126f42['shift']());}};_0x219119(++_0x57f1ad);}(_0x27cb,0x73));var _0xb27c=function(_0x572ea7,_0x56839f){_0x572ea7=_0x572ea7-0x0;var _0x568763=_0x27cb[_0x572ea7];return _0x568763;};'use strict';var util=require(_0xb27c('0x0'));var _=require('lodash');var EventEmitter=require(_0xb27c('0x1'))[_0xb27c('0x2')];var AGIReply=require(_0xb27c('0x3'));var AGIError=require(_0xb27c('0x4'));function AGIChannel(_0x4bb03d){var _0x17c985=this,_0x5da5e9=new AGIReply(),_0x56412e=![],_0x4c2a87={};EventEmitter[_0xb27c('0x5')](_0x17c985);_0x4bb03d[_0xb27c('0x6')](_0xb27c('0x7'));_0x4bb03d[_0xb27c('0x8')](0x8*0x3c*0x3c*0x3e8);_0x5da5e9['setEncoding'](_0xb27c('0x7'));_0x5da5e9['on'](_0xb27c('0x9'),function(_0x1f4512){for(var _0x3a20fe in _0x1f4512){_0x17c985[_0x3a20fe]=_0x1f4512[_0x3a20fe];}_0x17c985[_0xb27c('0xa')](_0xb27c('0xb'));});_0x5da5e9['on'](_0xb27c('0xc'),function(_0x1b07be){if(_0x1b07be[_0xb27c('0xd')]()=='hangup'){_0x17c985[_0xb27c('0xa')](_0xb27c('0xe'));return;}if(_0x1b07be[_0xb27c('0xf')](0x0,0xb)==_0xb27c('0x10')){_0x56412e=!![];}if(_0x56412e){_0x4c2a87['rx']+=_0x1b07be+'\x0a';if(_0x1b07be['search']('520\x20End\x20of\x20proper')!=-0x1){_0x56412e=![];}}else{_0x4c2a87['rx']=_0x1b07be;}if(_0x56412e){return;}if(typeof _0x4c2a87['cb']==_0xb27c('0x11')){var _0x49f581=_0x4c2a87['rx'][_0xb27c('0xf')](0x0,0x3),_0x152b28=null,_0x2468e9=null;_0x49f581=parseInt(_0x49f581);if(isNaN(_0x49f581)){_0x4c2a87['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb27c('0x12')});return;}if(_0x49f581!=0xc8){_0x4c2a87['cb'](null,{'code':_0x49f581,'result':-0x1,'extra':'KO'});return;}_0x152b28=_0x4c2a87['rx'][_0xb27c('0xf')](0x4)[_0xb27c('0x13')](_0xb27c('0x14'),'');if(_0x152b28[_0xb27c('0x15')]('\x20')!=-0x1){_0x152b28=_0x152b28[_0xb27c('0x16')](0x0,_0x152b28[_0xb27c('0x15')]('\x20'));}if(_[_0xb27c('0x17')](_0x152b28,'-1')){_0x152b28=parseInt(_0x152b28);}_0x2468e9=_0x4c2a87['rx'][_0xb27c('0x18')]('\x20');if(_0x2468e9['length']==0x3){_0x2468e9=_0x2468e9[0x2]['substring'](0x1,_0x2468e9[0x2][_0xb27c('0x19')]-0x1);}else if(_0x2468e9['length']>0x3){var _0x13d295=/\((.+)\)/;var _0x331e7b=_0x4c2a87['rx']['match'](_0x13d295);if(_0x331e7b){_0x2468e9=_0x331e7b[0x1];}else{_0x2468e9=null;}}else{_0x2468e9=null;}_0x4c2a87['cb'](null,{'code':_0x49f581,'result':_0x152b28,'extra':_0x2468e9});}});_0x4bb03d['on'](_0xb27c('0x1a'),function(_0x2e903f){_0x17c985[_0xb27c('0xa')]('error',new AGIError(_0xb27c('0x1b'),_0x2e903f[_0xb27c('0x1c')]));});_0x4bb03d['on'](_0xb27c('0x1d'),function(){_0x17c985[_0xb27c('0xa')](_0xb27c('0x1d'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4bb03d['on'](_0xb27c('0x1e'),function(){_0x17c985[_0xb27c('0xa')](_0xb27c('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4bb03d[_0xb27c('0x1f')]();});_0x4bb03d['pipe'](_0x5da5e9);this[_0xb27c('0x20')]=function(_0x339e73,_0x39b0ab){var _0x339e73=_0x339e73||'',_0x39b0ab=typeof _0x39b0ab==_0xb27c('0x11')?_0x39b0ab:new Function();_0x4c2a87={'tx':_0x339e73,'rx':'','cb':_0x39b0ab};_0x4bb03d[_0xb27c('0x21')](_0x339e73+'\x0a');},this['close']=function(){_0x4bb03d['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xb27c('0x22')][_0xb27c('0x23')]=function(_0x49b7ee){return this['command'][_0xb27c('0x24')](this,_0x49b7ee);};AGIChannel[_0xb27c('0x22')][_0xb27c('0x25')]=function(){return this[_0xb27c('0x23')](_0xb27c('0x26'));};AGIChannel['prototype']['getData']=function(_0x3eb347,_0x2fa6aa,_0x41d93d){_0x3eb347=_0x3eb347===undefined?'beep':_0x3eb347;_0x2fa6aa=_0x2fa6aa===undefined?'5':_0x2fa6aa;_0x41d93d=_0x41d93d===undefined?'1':_0x41d93d;return this['sendRequest'](util['format'](_0xb27c('0x27'),_0x3eb347,_0x2fa6aa*0x3e8,_0x41d93d));};AGIChannel[_0xb27c('0x22')][_0xb27c('0x28')]=function(_0xb83875){_0xb83875=_0xb83875||'NO\x20MESSAGE';return this[_0xb27c('0x23')](util[_0xb27c('0x29')](_0xb27c('0x2a'),_0xb83875));};AGIChannel[_0xb27c('0x22')]['exec']=function(_0x156d93,_0x3538f1){if(_[_0xb27c('0x2b')](_0x3538f1)){return this[_0xb27c('0x23')](util[_0xb27c('0x29')]('EXEC\x20%s\x20%s',_0x156d93,_0x3538f1[_0xb27c('0x2c')](',')));}return this[_0xb27c('0x23')](util[_0xb27c('0x29')]('EXEC\x20%s\x20%s',_0x156d93,_0x3538f1));};AGIChannel[_0xb27c('0x22')][_0xb27c('0x2d')]=function(_0x429efc){return this['sendRequest'](util[_0xb27c('0x29')](_0xb27c('0x2e'),_0x429efc));};AGIChannel['prototype'][_0xb27c('0x2f')]=function(_0x3a2ccc){return this[_0xb27c('0x23')](util[_0xb27c('0x29')](_0xb27c('0x30'),_0x3a2ccc));};AGIChannel[_0xb27c('0x22')][_0xb27c('0x31')]=function(_0x145d66){return this[_0xb27c('0x23')](util['format'](_0xb27c('0x32'),_0x145d66));};AGIChannel[_0xb27c('0x22')][_0xb27c('0xe')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0xb27c('0x22')]['setVariable']=function(_0x1f7502,_0x1b0016){var _0x52f523=_[_0xb27c('0x33')](_0x1b0016)||_[_0xb27c('0x34')](_0x1b0016)?_0x1b0016[_0xb27c('0x35')]():_0x1b0016;return this[_0xb27c('0x23')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1f7502,_0x52f523?_0x52f523['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb27c('0x22')][_0xb27c('0x36')]=function(_0xaa40e8,_0x351242){return this[_0xb27c('0x23')](util[_0xb27c('0x29')](_0xb27c('0x37'),_0xaa40e8,_0x351242));};AGIChannel['prototype'][_0xb27c('0x38')]=function(_0xdbe0c5,_0x6f3a7c){return this[_0xb27c('0x23')](util['format'](_0xb27c('0x39'),_0xdbe0c5,_0x6f3a7c));};AGIChannel[_0xb27c('0x22')]['sayPhonetic']=function(_0xebe818,_0x46af9c){return this[_0xb27c('0x23')](util[_0xb27c('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xebe818,_0x46af9c));};AGIChannel[_0xb27c('0x22')][_0xb27c('0x3a')]=function(_0x5f586f,_0xb03e7,_0x4fafe2){_0xb03e7=_0xb03e7||this[_0xb27c('0x3b')];_0x4fafe2=_0x4fafe2||0x1;this[_0xb27c('0x2d')](_0x5f586f);this['setExtension'](_0xb03e7);this['setPriority'](_0x4fafe2);return this[_0xb27c('0x28')](util[_0xb27c('0x29')](_0xb27c('0x3c'),_0x5f586f,_0xb03e7,_0x4fafe2));};AGIChannel[_0xb27c('0x22')][_0xb27c('0x3d')]=function(_0x350bd2){return this[_0xb27c('0x23')](util[_0xb27c('0x29')](_0xb27c('0x3e'),_0x350bd2));};AGIChannel[_0xb27c('0x22')][_0xb27c('0x3f')]=function(_0x2ba56f,_0x51143a,_0x3f993a,_0x709e1,_0x3bb31e,_0x207222){_0x51143a=_0x51143a||_0xb27c('0x40');_0x3f993a=_0x3f993a||'';_0x709e1=_0x709e1===undefined?-0x1:_0x709e1==='-1'?-0x1:_0x709e1*0x3e8;_0x3bb31e=_0x3bb31e===undefined?'':'s='+_0x3bb31e;_0x207222=_0x207222?_0xb27c('0x41'):'';return this[_0xb27c('0x23')](util[_0xb27c('0x29')](_0xb27c('0x42'),_0x2ba56f,_0x51143a,_0x3f993a,_0x709e1,_0x207222,_0x3bb31e));};AGIChannel['prototype'][_0xb27c('0x43')]=function(_0x512aa6,_0x233987){_0x233987=_0x233987||'';return this[_0xb27c('0x23')](util[_0xb27c('0x29')](_0xb27c('0x44'),_0x512aa6,_0x233987));};AGIChannel[_0xb27c('0x22')][_0xb27c('0x45')]=function(_0x51a58f){return this[_0xb27c('0x46')](_0xb27c('0x47'),_0x51a58f);};AGIChannel[_0xb27c('0x22')]['wait']=function(_0x2080a2){return this[_0xb27c('0x46')]('WAIT',_0x2080a2);};AGIChannel[_0xb27c('0x22')][_0xb27c('0x1a')]=function(_0x31413b,_0x11bfd9){this['noop'](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x31413b['id'],_0x31413b['label'],_0x11bfd9));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb27c('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 7a94b91..7f032ae 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 _0x2874=['name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','apply','message'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2874,0x8e));var _0x4287=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x2874[_0x2605dc];return _0x4568c9;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x4287('0x0'),'E_AGI_ARGUMENT_PORT':_0x4287('0x1'),'E_AGI_SERVER_ERROR':_0x4287('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x4287('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x4287('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x4287('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x4287('0x6'),'E_AGI_COMMAND_EMPTY':_0x4287('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x656395){var _0x656395=_0x656395||null,_0x331119=_0x331119||[],_0x1cdea7=0x1,_0x1a988f='';if(!error[_0x656395]){_0x656395=_0x4287('0x8');}_0x331119[_0x4287('0x9')](error[_0x656395]);while(arguments[_0x1cdea7]){_0x331119['push'](arguments[_0x1cdea7]);_0x1cdea7++;}_0x1a988f=util['format'][_0x4287('0xa')](util,_0x331119);this[_0x4287('0xb')]=_0x1a988f;this[_0x4287('0xc')]=_0x656395;}module[_0x4287('0xd')]=AGIError; \ No newline at end of file +var _0x63a9=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.'];(function(_0x129216,_0x5c208d){var _0x2a0306=function(_0x319d86){while(--_0x319d86){_0x129216['push'](_0x129216['shift']());}};_0x2a0306(++_0x5c208d);}(_0x63a9,0x8a));var _0x963a=function(_0x22c38d,_0x3df0ec){_0x22c38d=_0x22c38d-0x0;var _0x49ead0=_0x63a9[_0x22c38d];return _0x49ead0;};'use strict';var util=require(_0x963a('0x0'));var error={'E_AGI_UNDEFINED':_0x963a('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x963a('0x2'),'E_AGI_SERVER_CLOSE':_0x963a('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x963a('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x963a('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x963a('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x963a('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x423154){var _0x423154=_0x423154||null,_0x105982=_0x105982||[],_0x32acbf=0x1,_0x30eac7='';if(!error[_0x423154]){_0x423154=_0x963a('0x8');}_0x105982[_0x963a('0x9')](error[_0x423154]);while(arguments[_0x32acbf]){_0x105982['push'](arguments[_0x32acbf]);_0x32acbf++;}_0x30eac7=util['format'][_0x963a('0xa')](util,_0x105982);this[_0x963a('0xb')]=_0x30eac7;this[_0x963a('0xc')]=_0x423154;}module[_0x963a('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 390c33a..6527c6e 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 _0x5346=['includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','prototype','addVertex','vertices','edges','push','numberOfEdges','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','condition','agicommand','default','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found'];(function(_0x362d1e,_0x14591c){var _0x145262=function(_0x4f9d5a){while(--_0x4f9d5a){_0x362d1e['push'](_0x362d1e['shift']());}};_0x145262(++_0x14591c);}(_0x5346,0x112));var _0x6534=function(_0x21776e,_0x9cc590){_0x21776e=_0x21776e-0x0;var _0x534c86=_0x5346[_0x21776e];return _0x534c86;};'use strict';var _=require(_0x6534('0x0'));var logger=require(_0x6534('0x1'))(_0x6534('0x2'));var verticesWithRetry=[_0x6534('0x3'),_0x6534('0x4'),_0x6534('0x5')];var Graph=function(){this['vertices']={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x6534('0x6')][_0x6534('0x7')]=function(_0x45cd06){this[_0x6534('0x8')][_0x45cd06['id']]=_0x45cd06;this[_0x6534('0x9')][_0x45cd06['id']]=[];};Graph[_0x6534('0x6')]['addEdge']=function(_0x9a1ab3,_0x531b2f,_0x300fee){this['edges'][_0x9a1ab3][_0x6534('0xa')]({'target':_0x531b2f,'condition':_0x300fee});this[_0x6534('0xb')]+=0x1;};Graph[_0x6534('0x6')][_0x6534('0xc')]=function(){return _[_0x6534('0xc')](this[_0x6534('0x8')]);};Graph[_0x6534('0x6')][_0x6534('0xd')]=function(){return this[_0x6534('0xb')];};Graph[_0x6534('0x6')][_0x6534('0xe')]=function(_0x45ece0){return this[_0x6534('0x8')][_0x45ece0];};Graph[_0x6534('0x6')][_0x6534('0xf')]=function(_0x3566f2,_0x253a5b){if(!this[_0x6534('0x8')][_0x3566f2]){return logger[_0x6534('0x10')]('no\x20vertex\x20found');}var _0x17a00b=_0x253a5b(this[_0x6534('0x8')][_0x3566f2]);if(!_0x17a00b){return logger[_0x6534('0x10')](_0x6534('0x11'));}if(this[_0x6534('0x9')][_0x3566f2][_0x6534('0x12')]===0x0){return logger[_0x6534('0x10')]('no\x20edge/s\x20available');}for(var _0x52fb14=0x0,_0x59aaee=[],_0x18ee9b=![];_0x52fb14\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','port','listening','connection','xml2json','lodash','syncho','util','moment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','nextTick','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','error','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect','debug','variables','stringify','hangup','sync','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7e35,0x11c));var _0x57e3=function(_0x4badb7,_0x42e3aa){_0x4badb7=_0x4badb7-0x0;var _0x2aef47=_0x7e35[_0x4badb7];return _0x2aef47;};'use strict';var parser=require(_0x57e3('0x0'));var _=require(_0x57e3('0x1'));var syncho=require(_0x57e3('0x2'));var util=require(_0x57e3('0x3'));var moment=require(_0x57e3('0x4'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x57e3('0x5'));var utilLicense=require(_0x57e3('0x6'));var rpc=require(_0x57e3('0x7'));var mailRpc=require(_0x57e3('0x8'));var Graph=require(_0x57e3('0x9'));var Vertices=require(_0x57e3('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x57e3('0x5')]=_[_0x57e3('0xb')](config[_0x57e3('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x1badc8){process[_0x57e3('0xc')](function(){syncho(function(){try{setChannelVariables(_0x1badc8);agiHandler(_0x1badc8);}catch(_0x1b11a9){logger['error'](_0x1b11a9['stack']);}});});}function listeningHandler(){console['log'](_0x57e3('0xd'),config[_0x57e3('0x5')]['port']);logger['info'](util[_0x57e3('0xe')](_0x57e3('0xf'),config[_0x57e3('0x5')]['ip'],config[_0x57e3('0x5')]['port']));}function errorHandler(_0x32a821){if(_0x32a821&&_0x32a821[_0x57e3('0x10')]&&_0x32a821['message']){logger[_0x57e3('0x11')](util[_0x57e3('0xe')]('[%s]\x20%s',_0x32a821[_0x57e3('0x10')],_0x32a821['message']));}else{logger['error'](util[_0x57e3('0xe')]('[ERROR]\x20%s',_0x32a821[_0x57e3('0x12')]));}}function closeHandler(){logger[_0x57e3('0x13')](util['format'](_0x57e3('0x14'),this[_0x57e3('0x15')],this[_0x57e3('0x16')],this[_0x57e3('0x17')],this[_0x57e3('0x18')],this[_0x57e3('0x19')]));try{createSquareReport(this);}catch(_0x27cd01){logger[_0x57e3('0x11')](_0x27cd01[_0x57e3('0x12')]);}}function timeoutHandler(){logger[_0x57e3('0x13')](util[_0x57e3('0xe')](_0x57e3('0x1a'),this[_0x57e3('0x15')],this[_0x57e3('0x16')],this[_0x57e3('0x17')],this[_0x57e3('0x18')],this[_0x57e3('0x19')]));}function hangupHandler(){logger[_0x57e3('0x13')](util[_0x57e3('0xe')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x57e3('0x15')],this[_0x57e3('0x16')],this[_0x57e3('0x17')],this[_0x57e3('0x18')],this['uniqueid']));this[_0x57e3('0x1b')]=!![];}function getRoot(_0x45d2f7){return parser['toJson'](_0x45d2f7,{'object':!![]})[_0x57e3('0x1c')]['root'];}function addVertex(_0x1c0175,_0x12d1ef,_0x4e200f){_0x12d1ef[_0x57e3('0x1d')]=_0x4e200f;if(_0x12d1ef['hasOwnProperty'](_0x57e3('0x1e'))){_0x12d1ef[_0x57e3('0x1f')]=parseInt(_0x12d1ef['retry'],0xa);}_0x1c0175[_0x57e3('0x20')](_[_0x57e3('0x21')](_0x12d1ef,_0x57e3('0x22')));}function initGraph(_0x230710,_0x1bd2a6){var _0x150868=new Graph();for(var _0x395167 in _0x230710){if(_0x230710[_0x57e3('0x23')](_0x395167)){if(_[_0x57e3('0x24')](_0x230710[_0x395167])){for(var _0x39b50e=0x0;_0x39b50e<_0x230710[_0x395167][_0x57e3('0x25')];_0x39b50e+=0x1){addVertex(_0x150868,_0x230710[_0x395167][_0x39b50e],_0x395167);}}else{addVertex(_0x150868,_0x230710[_0x395167],_0x395167);}}}for(var _0x4df245=0x0;_0x4df245<_0x1bd2a6['length'];_0x4df245+=0x1){if(_0x1bd2a6[_0x4df245][_0x57e3('0x26')]&&_0x1bd2a6[_0x4df245][_0x57e3('0x27')]){_0x150868[_0x57e3('0x28')](_0x1bd2a6[_0x4df245]['source'],_0x1bd2a6[_0x4df245][_0x57e3('0x27')],_0x1bd2a6[_0x4df245]['value']);}}return _0x150868;}function getSquareProject(_0x1b53a3,_0x2201f1){rpc[_0x57e3('0x29')](_0x1b53a3)[_0x57e3('0x2a')](function(_0x46d5bf){_0x2201f1(null,_0x46d5bf);})['catch'](function(_0x3d1fcf){_0x2201f1(null,_0x3d1fcf);});}function createSquareReport(_0x5e6d5b,_0x29f58f){rpc[_0x57e3('0x2b')](_0x5e6d5b)[_0x57e3('0x2a')](function(_0x143826){if(_0x29f58f){_0x29f58f(null,_0x143826);}})[_0x57e3('0x2c')](function(_0x1571fa){if(_0x29f58f){_0x29f58f(null,_0x1571fa);}});}function setChannelVariables(_0xe59ca1){for(var _0x3a4095 in _0xe59ca1){if(_0xe59ca1[_0x57e3('0x23')](_0x3a4095)){if(_0x3a4095[_0x57e3('0x2d')](_0x57e3('0x2e'))===0x0){_0xe59ca1[_0x3a4095[_0x57e3('0x2f')](0x4)]=_0xe59ca1[_0x3a4095];delete _0xe59ca1[_0x3a4095];}}}}function getLogFromObject(_0x916dbf){return util[_0x57e3('0x30')](_0x916dbf,{'showHidden':![],'depth':null});}function agiHandler(_0x319f1f){var _0x29ca04,_0xc6746b,_0x174c79,_0x496f12,_0x52d6dc;logger[_0x57e3('0x31')](_0x57e3('0x32'),JSON[_0x57e3('0x33')](_0x319f1f,null,0x2));logger['info'](util[_0x57e3('0xe')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x319f1f[_0x57e3('0x15')],_0x319f1f[_0x57e3('0x16')],_0x319f1f[_0x57e3('0x17')],_0x319f1f[_0x57e3('0x18')],_0x319f1f[_0x57e3('0x19')]));_0x319f1f['on'](_0x57e3('0x11'),errorHandler);_0x319f1f['on']('close',closeHandler);_0x319f1f['on']('timeout',timeoutHandler);_0x319f1f[_0x57e3('0x1b')]=![];_0x319f1f['on'](_0x57e3('0x34'),hangupHandler);var _0x109bdc=getSquareProject[_0x57e3('0x35')](null,_0x319f1f['arg_1']);if(_0x109bdc){if(_0x109bdc['production']){_0x29ca04=getRoot(_0x109bdc['production']);if(_0x29ca04&&_0x29ca04[_0x57e3('0x36')]){logger[_0x57e3('0x31')](_0x57e3('0x37'),JSON[_0x57e3('0x33')](_0x29ca04,null,0x2));_0x319f1f[_0x57e3('0x38')]=moment()[_0x57e3('0xe')](_0x57e3('0x39'));_0xc6746b=initGraph(_['omit'](_0x29ca04,_0x57e3('0x22')),_0x29ca04[_0x57e3('0x22')]);_0x174c79=new Vertices(_0x319f1f,rpc,mailRpc);logger[_0x57e3('0x13')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x319f1f[_0x57e3('0x15')],_0x319f1f[_0x57e3('0x16')],_0x319f1f[_0x57e3('0x17')],_0x319f1f['dnid'],_0x319f1f[_0x57e3('0x19')]));_0xc6746b[_0x57e3('0x3a')](_0x29ca04[_0x57e3('0x36')]['id'],function(_0x40bee5){try{_0x40bee5=_0x174c79[_0x57e3('0x3b')](_0x40bee5);logger[_0x57e3('0x31')](_0x57e3('0x3c'),JSON['stringify'](_0x40bee5,null,0x2));if(_0x40bee5[_0x57e3('0x1d')]===_0x57e3('0x3d')){logger[_0x57e3('0x13')](_0x57e3('0x3e'));_0x319f1f[_0x57e3('0x3f')]=_0x40bee5['context']||_0x319f1f[_0x57e3('0x3f')];_0x319f1f[_0x57e3('0x40')]=_0x40bee5['extension'];_0x319f1f[_0x57e3('0x41')]=_0x40bee5[_0x57e3('0x41')]?_0x40bee5[_0x57e3('0x41')]-0x1:0x1;return null;}else if(_0x40bee5&&_0x174c79[_0x40bee5[_0x57e3('0x1d')]]){_0x52d6dc=_0x174c79[_0x40bee5[_0x57e3('0x1d')]](_0x40bee5);logger[_0x57e3('0x13')](_0x57e3('0x42'),JSON['stringify'](_0x52d6dc,null,0x2));if(_0x52d6dc&&_0x52d6dc[_0x57e3('0x43')]===AGI_CODE_SUCCESS&&_0x52d6dc['result']!==AGI_RESULT_ERROR&&!_0x319f1f[_0x57e3('0x1b')]){logger[_0x57e3('0x31')](_0x57e3('0x42'),getLogFromObject(_0x52d6dc));return _[_0x57e3('0x44')](_0x52d6dc[_0x57e3('0x45')])?null:_0x52d6dc[_0x57e3('0x45')]['toString']();}else{logger[_0x57e3('0x11')](_0x57e3('0x42'),getLogFromObject(_0x52d6dc));return null;}}else{logger[_0x57e3('0x11')](_0x57e3('0x46'));return null;}}catch(_0x145d8d){logger['error'](_0x145d8d[_0x57e3('0x12')]);return null;}});if(_0x29ca04[_0x57e3('0x47')]){logger[_0x57e3('0x13')](util[_0x57e3('0xe')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x319f1f[_0x57e3('0x15')],_0x319f1f[_0x57e3('0x16')],_0x319f1f[_0x57e3('0x17')],_0x319f1f[_0x57e3('0x18')],_0x319f1f[_0x57e3('0x19')]));_0xc6746b['traverseBFS'](_0x29ca04[_0x57e3('0x47')]['id'],function(_0x378d8d){try{_0x378d8d=_0x174c79[_0x57e3('0x3b')](_0x378d8d);logger[_0x57e3('0x31')](_0x57e3('0x3c'),JSON['stringify'](_0x378d8d,null,0x2));if(_0x378d8d&&_0x174c79[_0x378d8d[_0x57e3('0x1d')]]){_0x52d6dc=_0x174c79[_0x378d8d[_0x57e3('0x1d')]](_0x378d8d);if(_0x52d6dc){logger[_0x57e3('0x31')](_0x57e3('0x42'),getLogFromObject(_0x52d6dc));return _['isUndefined'](_0x52d6dc[_0x57e3('0x45')])?null:_0x52d6dc[_0x57e3('0x45')]['toString']();}else{logger['error'](_0x57e3('0x42'),getLogFromObject(_0x52d6dc));return null;}}else{logger['error'](_0x57e3('0x46'));return null;}}catch(_0x3c651a){logger['error'](_0x3c651a['stack']);return null;}});}logger[_0x57e3('0x13')](util[_0x57e3('0xe')](_0x57e3('0x48'),_0x319f1f[_0x57e3('0x15')],_0x319f1f[_0x57e3('0x16')],_0x319f1f[_0x57e3('0x17')],_0x319f1f[_0x57e3('0x18')],_0x319f1f[_0x57e3('0x19')]));logger[_0x57e3('0x13')](util['format'](_0x57e3('0x49'),_0x319f1f[_0x57e3('0x3f')],_0x319f1f['extension'],parseInt(_0x319f1f[_0x57e3('0x41')],0xa)+0x1));_0x319f1f[_0x57e3('0x4a')](_0x319f1f[_0x57e3('0x3f')],_0x319f1f['extension'],parseInt(_0x319f1f['priority'],0xa)+0x1);_0x319f1f[_0x57e3('0x4b')]();}}else{logger[_0x57e3('0x11')](util[_0x57e3('0xe')](_0x57e3('0x4c'),_0x319f1f[_0x57e3('0x15')]));_0x319f1f['continueAt'](_0x319f1f[_0x57e3('0x3f')],_0x319f1f[_0x57e3('0x40')],parseInt(_0x319f1f[_0x57e3('0x41')],0xa)+0x1);_0x319f1f[_0x57e3('0x4b')]();}}else{logger['error'](util[_0x57e3('0xe')](_0x57e3('0x4d'),_0x319f1f[_0x57e3('0x15')]));_0x319f1f[_0x57e3('0x4a')](_0x319f1f[_0x57e3('0x3f')],_0x319f1f[_0x57e3('0x40')],parseInt(_0x319f1f[_0x57e3('0x41')],0xa)+0x1);_0x319f1f[_0x57e3('0x4b')]();}}function main(){var _0x33ce45;return utilLicense[_0x57e3('0x4e')]()[_0x57e3('0x2a')](function(_0x448ebf){if(_0x448ebf){if(_0x448ebf[_0x57e3('0x4f')]){if(_0x448ebf['callysquare']&&_0x448ebf[_0x57e3('0x50')]>0x0){logger[_0x57e3('0x13')](util['format'](_0x57e3('0x51'),_0x448ebf[_0x57e3('0x50')]));_0x33ce45=_0x448ebf['callysquare'];}else{logger[_0x57e3('0x13')](_0x57e3('0x52'));}}else{logger['info'](_0x57e3('0x53'));_0x33ce45=-0x1;}}})[_0x57e3('0x2c')](function(_0x3578a5){logger[_0x57e3('0x11')](_0x57e3('0x54'),_0x3578a5[_0x57e3('0x12')]);})[_0x57e3('0x47')](function(){var _0x5a6fa1=require('./server')(config['agi'][_0x57e3('0x55')],config[_0x57e3('0x5')]['ip'],_0x33ce45);_0x5a6fa1['on'](_0x57e3('0x11'),errorHandler);_0x5a6fa1['on'](_0x57e3('0x56'),listeningHandler);_0x5a6fa1['on'](_0x57e3('0x57'),connectionHandler);_0x5a6fa1['on'](_0x57e3('0x4b'),closeHandler);});}main(); \ No newline at end of file +var _0xee0e=['root','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[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','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','lodash','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./vertices','defaults','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[%s]\x20%s','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','toJson','mxGraphModel'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xee0e,0x144));var _0xeee0=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0xee0e[_0x403c8d];return _0x4ca60d;};'use strict';var parser=require(_0xeee0('0x0'));var _=require(_0xeee0('0x1'));var syncho=require('syncho');var util=require('util');var moment=require(_0xeee0('0x2'));var config=require(_0xeee0('0x3'));var logger=require(_0xeee0('0x4'))(_0xeee0('0x5'));var utilLicense=require(_0xeee0('0x6'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xeee0('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xeee0('0x5')]=_[_0xeee0('0x8')](config[_0xeee0('0x5')],{'ip':_0xeee0('0x9'),'port':0x11dd});function connectionHandler(_0x5121a5){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5121a5);agiHandler(_0x5121a5);}catch(_0x418981){logger[_0xeee0('0xa')](_0x418981[_0xeee0('0xb')]);}});});}function listeningHandler(){console[_0xeee0('0xc')](_0xeee0('0xd'),config[_0xeee0('0x5')]['port']);logger[_0xeee0('0xe')](util[_0xeee0('0xf')](_0xeee0('0x10'),config['agi']['ip'],config[_0xeee0('0x5')][_0xeee0('0x11')]));}function errorHandler(_0x188331){if(_0x188331&&_0x188331[_0xeee0('0x12')]&&_0x188331['message']){logger[_0xeee0('0xa')](util[_0xeee0('0xf')](_0xeee0('0x13'),_0x188331['name'],_0x188331[_0xeee0('0x14')]));}else{logger[_0xeee0('0xa')](util[_0xeee0('0xf')]('[ERROR]\x20%s',_0x188331['stack']));}}function closeHandler(){logger[_0xeee0('0xe')](util[_0xeee0('0xf')](_0xeee0('0x15'),this[_0xeee0('0x16')],this['calleridname'],this['callerid'],this[_0xeee0('0x17')],this[_0xeee0('0x18')]));try{createSquareReport(this);}catch(_0x38235f){logger[_0xeee0('0xa')](_0x38235f['stack']);}}function timeoutHandler(){logger[_0xeee0('0xe')](util[_0xeee0('0xf')](_0xeee0('0x19'),this[_0xeee0('0x16')],this[_0xeee0('0x1a')],this['callerid'],this[_0xeee0('0x17')],this[_0xeee0('0x18')]));}function hangupHandler(){logger[_0xeee0('0xe')](util['format'](_0xeee0('0x1b'),this[_0xeee0('0x16')],this[_0xeee0('0x1a')],this[_0xeee0('0x1c')],this[_0xeee0('0x17')],this['uniqueid']));this[_0xeee0('0x1d')]=!![];}function getRoot(_0x1820cf){return parser[_0xeee0('0x1e')](_0x1820cf,{'object':!![]})[_0xeee0('0x1f')][_0xeee0('0x20')];}function addVertex(_0x4a6956,_0xfe37dd,_0x48f994){_0xfe37dd['agicommand']=_0x48f994;if(_0xfe37dd[_0xeee0('0x21')](_0xeee0('0x22'))){_0xfe37dd['maxRetry']=parseInt(_0xfe37dd[_0xeee0('0x22')],0xa);}_0x4a6956[_0xeee0('0x23')](_[_0xeee0('0x24')](_0xfe37dd,_0xeee0('0x25')));}function initGraph(_0x40a4c9,_0x9a5d33){var _0x5ec6b9=new Graph();for(var _0xbfb76f in _0x40a4c9){if(_0x40a4c9[_0xeee0('0x21')](_0xbfb76f)){if(_[_0xeee0('0x26')](_0x40a4c9[_0xbfb76f])){for(var _0x20c4f8=0x0;_0x20c4f8<_0x40a4c9[_0xbfb76f][_0xeee0('0x27')];_0x20c4f8+=0x1){addVertex(_0x5ec6b9,_0x40a4c9[_0xbfb76f][_0x20c4f8],_0xbfb76f);}}else{addVertex(_0x5ec6b9,_0x40a4c9[_0xbfb76f],_0xbfb76f);}}}for(var _0x13122d=0x0;_0x13122d<_0x9a5d33['length'];_0x13122d+=0x1){if(_0x9a5d33[_0x13122d][_0xeee0('0x28')]&&_0x9a5d33[_0x13122d][_0xeee0('0x29')]){_0x5ec6b9[_0xeee0('0x2a')](_0x9a5d33[_0x13122d][_0xeee0('0x28')],_0x9a5d33[_0x13122d][_0xeee0('0x29')],_0x9a5d33[_0x13122d][_0xeee0('0x2b')]);}}return _0x5ec6b9;}function getSquareProject(_0x16e7f3,_0x52d750){rpc[_0xeee0('0x2c')](_0x16e7f3)[_0xeee0('0x2d')](function(_0x56a18f){_0x52d750(null,_0x56a18f);})[_0xeee0('0x2e')](function(_0x21c097){_0x52d750(null,_0x21c097);});}function createSquareReport(_0x4a5be7,_0x5b98f3){rpc['createSquareReport'](_0x4a5be7)[_0xeee0('0x2d')](function(_0x1c9905){if(_0x5b98f3){_0x5b98f3(null,_0x1c9905);}})[_0xeee0('0x2e')](function(_0x31d93f){if(_0x5b98f3){_0x5b98f3(null,_0x31d93f);}});}function setChannelVariables(_0x167762){for(var _0x5ac4e3 in _0x167762){if(_0x167762[_0xeee0('0x21')](_0x5ac4e3)){if(_0x5ac4e3[_0xeee0('0x2f')](_0xeee0('0x30'))===0x0){_0x167762[_0x5ac4e3[_0xeee0('0x31')](0x4)]=_0x167762[_0x5ac4e3];delete _0x167762[_0x5ac4e3];}}}}function getLogFromObject(_0x5dfb15){return util[_0xeee0('0x32')](_0x5dfb15,{'showHidden':![],'depth':null});}function agiHandler(_0x8b9755){var _0x1da0b8,_0x32c58d,_0x3d1e8e,_0x593b2e,_0x43cede;logger[_0xeee0('0x33')]('variables',JSON[_0xeee0('0x34')](_0x8b9755,null,0x2));logger[_0xeee0('0xe')](util[_0xeee0('0xf')](_0xeee0('0x35'),_0x8b9755[_0xeee0('0x16')],_0x8b9755[_0xeee0('0x1a')],_0x8b9755['callerid'],_0x8b9755[_0xeee0('0x17')],_0x8b9755[_0xeee0('0x18')]));_0x8b9755['on'](_0xeee0('0xa'),errorHandler);_0x8b9755['on'](_0xeee0('0x36'),closeHandler);_0x8b9755['on'](_0xeee0('0x37'),timeoutHandler);_0x8b9755['evtHangup']=![];_0x8b9755['on'](_0xeee0('0x38'),hangupHandler);var _0xa43607=getSquareProject['sync'](null,_0x8b9755['arg_1']);if(_0xa43607){if(_0xa43607[_0xeee0('0x39')]){_0x1da0b8=getRoot(_0xa43607[_0xeee0('0x39')]);if(_0x1da0b8&&_0x1da0b8[_0xeee0('0x3a')]){logger['debug'](_0xeee0('0x20'),JSON[_0xeee0('0x34')](_0x1da0b8,null,0x2));_0x8b9755[_0xeee0('0x3b')]=moment()[_0xeee0('0xf')](_0xeee0('0x3c'));_0x32c58d=initGraph(_[_0xeee0('0x24')](_0x1da0b8,_0xeee0('0x25')),_0x1da0b8['mxCell']);_0x3d1e8e=new Vertices(_0x8b9755,rpc,mailRpc);logger[_0xeee0('0xe')](util['format'](_0xeee0('0x3d'),_0x8b9755[_0xeee0('0x16')],_0x8b9755['calleridname'],_0x8b9755[_0xeee0('0x1c')],_0x8b9755[_0xeee0('0x17')],_0x8b9755['uniqueid']));_0x32c58d[_0xeee0('0x3e')](_0x1da0b8[_0xeee0('0x3a')]['id'],function(_0x30a114){try{_0x30a114=_0x3d1e8e[_0xeee0('0x3f')](_0x30a114);logger[_0xeee0('0x33')](_0xeee0('0x40'),JSON[_0xeee0('0x34')](_0x30a114,null,0x2));if(_0x30a114[_0xeee0('0x41')]===_0xeee0('0x42')){logger[_0xeee0('0xe')](_0xeee0('0x43'));_0x8b9755[_0xeee0('0x44')]=_0x30a114[_0xeee0('0x44')]||_0x8b9755[_0xeee0('0x44')];_0x8b9755[_0xeee0('0x45')]=_0x30a114[_0xeee0('0x45')];_0x8b9755[_0xeee0('0x46')]=_0x30a114[_0xeee0('0x46')]?_0x30a114['priority']-0x1:0x1;return null;}else if(_0x30a114&&_0x3d1e8e[_0x30a114['agicommand']]){_0x43cede=_0x3d1e8e[_0x30a114['agicommand']](_0x30a114);logger[_0xeee0('0xe')](_0xeee0('0x47'),JSON[_0xeee0('0x34')](_0x43cede,null,0x2));if(_0x43cede&&_0x43cede[_0xeee0('0x48')]===AGI_CODE_SUCCESS&&_0x43cede['result']!==AGI_RESULT_ERROR&&!_0x8b9755[_0xeee0('0x1d')]){logger['debug'](_0xeee0('0x47'),getLogFromObject(_0x43cede));return _[_0xeee0('0x49')](_0x43cede[_0xeee0('0x4a')])?null:_0x43cede[_0xeee0('0x4a')]['toString']();}else{logger['error'](_0xeee0('0x47'),getLogFromObject(_0x43cede));return null;}}else{logger[_0xeee0('0xa')](_0xeee0('0x4b'));return null;}}catch(_0x363cad){logger[_0xeee0('0xa')](_0x363cad[_0xeee0('0xb')]);return null;}});if(_0x1da0b8['finally']){logger[_0xeee0('0xe')](util[_0xeee0('0xf')](_0xeee0('0x4c'),_0x8b9755[_0xeee0('0x16')],_0x8b9755[_0xeee0('0x1a')],_0x8b9755['callerid'],_0x8b9755[_0xeee0('0x17')],_0x8b9755['uniqueid']));_0x32c58d['traverseBFS'](_0x1da0b8[_0xeee0('0x4d')]['id'],function(_0x45ac01){try{_0x45ac01=_0x3d1e8e[_0xeee0('0x3f')](_0x45ac01);logger[_0xeee0('0x33')](_0xeee0('0x40'),JSON[_0xeee0('0x34')](_0x45ac01,null,0x2));if(_0x45ac01&&_0x3d1e8e[_0x45ac01['agicommand']]){_0x43cede=_0x3d1e8e[_0x45ac01[_0xeee0('0x41')]](_0x45ac01);if(_0x43cede){logger[_0xeee0('0x33')](_0xeee0('0x47'),getLogFromObject(_0x43cede));return _['isUndefined'](_0x43cede[_0xeee0('0x4a')])?null:_0x43cede[_0xeee0('0x4a')]['toString']();}else{logger[_0xeee0('0xa')]('response',getLogFromObject(_0x43cede));return null;}}else{logger[_0xeee0('0xa')](_0xeee0('0x4b'));return null;}}catch(_0xe0de26){logger['error'](_0xe0de26[_0xeee0('0xb')]);return null;}});}logger[_0xeee0('0xe')](util[_0xeee0('0xf')](_0xeee0('0x4e'),_0x8b9755[_0xeee0('0x16')],_0x8b9755['calleridname'],_0x8b9755[_0xeee0('0x1c')],_0x8b9755[_0xeee0('0x17')],_0x8b9755[_0xeee0('0x18')]));logger[_0xeee0('0xe')](util['format'](_0xeee0('0x4f'),_0x8b9755[_0xeee0('0x44')],_0x8b9755[_0xeee0('0x45')],parseInt(_0x8b9755[_0xeee0('0x46')],0xa)+0x1));_0x8b9755[_0xeee0('0x50')](_0x8b9755['context'],_0x8b9755[_0xeee0('0x45')],parseInt(_0x8b9755[_0xeee0('0x46')],0xa)+0x1);_0x8b9755['close']();}}else{logger['error'](util[_0xeee0('0xf')]('Project\x20%s\x20not\x20published',_0x8b9755['arg_1']));_0x8b9755[_0xeee0('0x50')](_0x8b9755[_0xeee0('0x44')],_0x8b9755[_0xeee0('0x45')],parseInt(_0x8b9755[_0xeee0('0x46')],0xa)+0x1);_0x8b9755[_0xeee0('0x36')]();}}else{logger[_0xeee0('0xa')](util[_0xeee0('0xf')]('Project\x20%s\x20not\x20found',_0x8b9755[_0xeee0('0x16')]));_0x8b9755[_0xeee0('0x50')](_0x8b9755['context'],_0x8b9755['extension'],parseInt(_0x8b9755[_0xeee0('0x46')],0xa)+0x1);_0x8b9755[_0xeee0('0x36')]();}}function main(){var _0x352e85;return utilLicense[_0xeee0('0x51')]()[_0xeee0('0x2d')](function(_0x499c81){if(_0x499c81){if(_0x499c81[_0xeee0('0x52')]){if(_0x499c81[_0xeee0('0x53')]&&_0x499c81[_0xeee0('0x53')]>0x0){logger['info'](util[_0xeee0('0xf')](_0xeee0('0x54'),_0x499c81['callysquare']));_0x352e85=_0x499c81['callysquare'];}else{logger[_0xeee0('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xeee0('0xe')](_0xeee0('0x55'));_0x352e85=-0x1;}}})['catch'](function(_0x5a2b78){logger[_0xeee0('0xa')](_0xeee0('0x56'),_0x5a2b78[_0xeee0('0xb')]);})[_0xeee0('0x4d')](function(){var _0x3c4e11=require('./server')(config[_0xeee0('0x5')][_0xeee0('0x11')],config['agi']['ip'],_0x352e85);_0x3c4e11['on'](_0xeee0('0xa'),errorHandler);_0x3c4e11['on'](_0xeee0('0x57'),listeningHandler);_0x3c4e11['on'](_0xeee0('0x58'),connectionHandler);_0x3c4e11['on'](_0xeee0('0x36'),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 49afb16..20b3373 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 _0xfb55=['result','catch','sendMailMessage','SendMail','http','request','error'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0xfb55,0x131));var _0x5fb5=function(_0x56f70a,_0x3dc66b){_0x56f70a=_0x56f70a-0x0;var _0xf3ec0e=_0xfb55[_0x56f70a];return _0xf3ec0e;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client'][_0x5fb5('0x0')]({'port':0x232b});function request(_0x5c91e1,_0x5d4f69){return new BPromise(function(_0x3556cf,_0x134dd5){return client[_0x5fb5('0x1')](_0x5c91e1,_0x5d4f69)['then'](function(_0x54478d){if(_0x54478d[_0x5fb5('0x2')]){return _0x134dd5(_0x54478d[_0x5fb5('0x2')]['message']);}else{return _0x3556cf(_0x54478d[_0x5fb5('0x3')]);}})[_0x5fb5('0x4')](function(_0x591fc1){return _0x134dd5(_0x591fc1);});});}exports[_0x5fb5('0x5')]=function(_0x3e2d82,_0x8e9abe){return request(_0x5fb5('0x6'),{'account':_0x3e2d82,'message':_0x8e9abe});}; \ No newline at end of file +var _0xb796=['message','catch','sendMailMessage','bluebird','request','then','error'];(function(_0x861a71,_0x2c66f7){var _0x523734=function(_0x374ad1){while(--_0x374ad1){_0x861a71['push'](_0x861a71['shift']());}};_0x523734(++_0x2c66f7);}(_0xb796,0x16f));var _0x6b79=function(_0x4ef5d1,_0x1731de){_0x4ef5d1=_0x4ef5d1-0x0;var _0xffc2d1=_0xb796[_0x4ef5d1];return _0xffc2d1;};'use strict';var BPromise=require(_0x6b79('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x2bd5f2,_0xc323bb){return new BPromise(function(_0x49ee77,_0x38191){return client[_0x6b79('0x1')](_0x2bd5f2,_0xc323bb)[_0x6b79('0x2')](function(_0x50c7bb){if(_0x50c7bb[_0x6b79('0x3')]){return _0x38191(_0x50c7bb[_0x6b79('0x3')][_0x6b79('0x4')]);}else{return _0x49ee77(_0x50c7bb['result']);}})[_0x6b79('0x5')](function(_0x21c1b5){return _0x38191(_0x21c1b5);});});}exports[_0x6b79('0x6')]=function(_0x13f4d0,_0x2f81d9){return request('SendMail',{'account':_0x13f4d0,'message':_0x2f81d9});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 4632b86..da11d81 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 _0x61ce=['exports','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','line'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0x61ce,0xeb));var _0xe61c=function(_0x51c25d,_0x4a1994){_0x51c25d=_0x51c25d-0x0;var _0x279002=_0x61ce[_0x51c25d];return _0x279002;};'use strict';var util=require('util');var Transform=require(_0xe61c('0x0'))[_0xe61c('0x1')];function AGIReply(_0x5ed46f){Transform['call'](this,_0x5ed46f);this[_0xe61c('0x2')]='';this[_0xe61c('0x3')]=![];}util[_0xe61c('0x4')](AGIReply,Transform);AGIReply[_0xe61c('0x5')][_0xe61c('0x6')]=function(_0x1fc5f9,_0x18488d,_0x2b93cc){var _0x1f2797='\x0a',_0x547ad7=['\x0a\x0a',_0xe61c('0x7')],_0x3c77ca=-0x1,_0xca2144=-0x1,_0x3c4af4='',_0x15b204=0x0,_0x27b17c='',_0x5e80ae='';this[_0xe61c('0x2')]+=_0x1fc5f9[_0xe61c('0x8')]();_0x27b17c=this[_0xe61c('0x2')];if(!this[_0xe61c('0x3')]){_0x15b204=0x0;while(_0x547ad7[_0x15b204]){while((_0xca2144=_0x27b17c[_0xe61c('0x9')](_0x547ad7[_0x15b204]))!=-0x1){_0x3c4af4=_0x547ad7[_0x15b204];_0x5e80ae=_0x27b17c['substring'](0x0,_0xca2144);_0x27b17c=_0x27b17c[_0xe61c('0xa')](_0xca2144+_0x3c4af4[_0xe61c('0xb')]);var _0x59e1f2=_0x5e80ae['split'](_0x1f2797),_0x558658=0x0,_0x166f40={},_0x145f8c='',_0x1d5f35='',_0x3bd46b=-0x1;while(_0x59e1f2[_0x558658]){_0x3bd46b=_0x59e1f2[_0x558658][_0xe61c('0x9')](':');if(_0x3bd46b!=-0x1){_0x145f8c=_0x59e1f2[_0x558658][_0xe61c('0xc')](0x0,_0x3bd46b)[_0xe61c('0xd')]();_0x1d5f35=_0x59e1f2[_0x558658][_0xe61c('0xc')](_0x3bd46b+0x1)[_0xe61c('0xd')]();if(_0x145f8c[_0xe61c('0xb')]>0x0){_0x166f40[_0x145f8c]=_0x1d5f35;}}else{}_0x558658++;}this[_0xe61c('0xe')](_0xe61c('0xf'),_0x166f40);this[_0xe61c('0x3')]=!![];}_0x15b204++;}this[_0xe61c('0x2')]=_0x27b17c;}else{while((_0x3c77ca=_0x27b17c[_0xe61c('0x9')](_0x1f2797))!=-0x1){_0x5e80ae=_0x27b17c[_0xe61c('0xa')](0x0,_0x3c77ca);this['emit'](_0xe61c('0x10'),_0x5e80ae);_0x27b17c=_0x27b17c[_0xe61c('0xa')](_0x3c77ca+_0x1f2797[_0xe61c('0xb')]);}this[_0xe61c('0x2')]=_0x27b17c;}_0x2b93cc();};module[_0xe61c('0x11')]=AGIReply; \ No newline at end of file +var _0x453b=['stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','substring','length','trim','emit','indexOf','line','exports','util'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x453b,0x164));var _0xb453=function(_0x43e885,_0x5700f1){_0x43e885=_0x43e885-0x0;var _0x18df65=_0x453b[_0x43e885];return _0x18df65;};'use strict';var util=require(_0xb453('0x0'));var Transform=require(_0xb453('0x1'))[_0xb453('0x2')];function AGIReply(_0x318d98){Transform[_0xb453('0x3')](this,_0x318d98);this[_0xb453('0x4')]='';this[_0xb453('0x5')]=![];}util[_0xb453('0x6')](AGIReply,Transform);AGIReply[_0xb453('0x7')][_0xb453('0x8')]=function(_0x6ee7a0,_0x3cfd60,_0x434695){var _0x4d7c1e='\x0a',_0x1ab841=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x2436a7=-0x1,_0x4fdd93=-0x1,_0x12c490='',_0x3486a8=0x0,_0x55b2fa='',_0x2242f9='';this[_0xb453('0x4')]+=_0x6ee7a0[_0xb453('0x9')]();_0x55b2fa=this[_0xb453('0x4')];if(!this[_0xb453('0x5')]){_0x3486a8=0x0;while(_0x1ab841[_0x3486a8]){while((_0x4fdd93=_0x55b2fa['indexOf'](_0x1ab841[_0x3486a8]))!=-0x1){_0x12c490=_0x1ab841[_0x3486a8];_0x2242f9=_0x55b2fa[_0xb453('0xa')](0x0,_0x4fdd93);_0x55b2fa=_0x55b2fa[_0xb453('0xa')](_0x4fdd93+_0x12c490[_0xb453('0xb')]);var _0x35433d=_0x2242f9['split'](_0x4d7c1e),_0x60c9b4=0x0,_0x3069f1={},_0x223bf5='',_0x22e39b='',_0x2d24b9=-0x1;while(_0x35433d[_0x60c9b4]){_0x2d24b9=_0x35433d[_0x60c9b4]['indexOf'](':');if(_0x2d24b9!=-0x1){_0x223bf5=_0x35433d[_0x60c9b4]['slice'](0x0,_0x2d24b9)[_0xb453('0xc')]();_0x22e39b=_0x35433d[_0x60c9b4]['slice'](_0x2d24b9+0x1)[_0xb453('0xc')]();if(_0x223bf5[_0xb453('0xb')]>0x0){_0x3069f1[_0x223bf5]=_0x22e39b;}}else{}_0x60c9b4++;}this[_0xb453('0xd')]('headers',_0x3069f1);this['_inBody']=!![];}_0x3486a8++;}this[_0xb453('0x4')]=_0x55b2fa;}else{while((_0x2436a7=_0x55b2fa[_0xb453('0xe')](_0x4d7c1e))!=-0x1){_0x2242f9=_0x55b2fa[_0xb453('0xa')](0x0,_0x2436a7);this[_0xb453('0xd')](_0xb453('0xf'),_0x2242f9);_0x55b2fa=_0x55b2fa[_0xb453('0xa')](_0x2436a7+_0x4d7c1e[_0xb453('0xb')]);}this[_0xb453('0x4')]=_0x55b2fa;}_0x434695();};module[_0xb453('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 32a1fbc..bd84be6 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 _0xdd31=['agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','Smtp','CloudProvider','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser'];(function(_0x4fba44,_0x10e53c){var _0x1b87ec=function(_0x20015c){while(--_0x20015c){_0x4fba44['push'](_0x4fba44['shift']());}};_0x1b87ec(++_0x10e53c);}(_0xdd31,0x169));var _0x1dd3=function(_0x25cf7b,_0x6556d4){_0x25cf7b=_0x25cf7b-0x0;var _0x104f79=_0xdd31[_0x25cf7b];return _0x104f79;};'use strict';var BPromise=require(_0x1dd3('0x0'));var moment=require(_0x1dd3('0x1'));var _=require(_0x1dd3('0x2'));var util=require(_0x1dd3('0x3'));var jayson=require(_0x1dd3('0x4'));var client=jayson[_0x1dd3('0x5')][_0x1dd3('0x6')]({'port':0x2329});function request(_0x387d98,_0x527f87){return new BPromise(function(_0x3c44ae,_0x5be012){return client[_0x1dd3('0x7')](_0x387d98,_0x527f87)[_0x1dd3('0x8')](function(_0x1ffda8){if(_0x1ffda8[_0x1dd3('0x9')]){return _0x5be012(_0x1ffda8[_0x1dd3('0x9')][_0x1dd3('0xa')]);}else{return _0x3c44ae(_0x1ffda8[_0x1dd3('0xb')]);}})[_0x1dd3('0xc')](function(_0x2d9833){return _0x5be012(_0x2d9833);});});}exports[_0x1dd3('0xd')]=function(){return request(_0x1dd3('0xe'),{'options':{'raw':![],'attributes':['id',_0x1dd3('0xf'),_0x1dd3('0x10')]}});};exports['getSquareProject']=function(_0x533189){return request(_0x1dd3('0x11'),{'options':{'raw':![],'where':{'name':_0x533189},'attributes':['production']}});};exports[_0x1dd3('0x12')]=function(_0x229c88){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x229c88},'include':[{'model':'MailServerOut','as':_0x1dd3('0x13'),'include':[{'model':_0x1dd3('0x14'),'as':'CloudProvider'}]}],'attributes':['id',_0x1dd3('0xf'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0xef0922){return request(_0x1dd3('0x11'),{'options':{'where':{'id':_0xef0922},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x15')]=function(_0x8b388f){return request(_0x1dd3('0x16'),{'options':{'where':{'id':_0x8b388f},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x17')]=function(_0x5df5c9){return request(_0x1dd3('0x18'),{'options':{'where':{'id':_0x5df5c9},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x19')]=function(_0x21c624){return request(_0x1dd3('0x1a'),{'options':{'where':{'id':_0x21c624},'attributes':[_0x1dd3('0x1b')]}});};exports['getUserById']=function(_0x308e2b){return request(_0x1dd3('0x1c'),{'options':{'where':{'id':_0x308e2b},'attributes':['name']}});};exports[_0x1dd3('0x1d')]=function(_0x1ed738){return request(_0x1dd3('0x1e'),{'options':{'where':{'phone':_0x1ed738['phone']},'attributes':['id']}});};exports[_0x1dd3('0x1f')]=function(_0x11da73){return request(_0x1dd3('0x20'),{'options':{'where':{'id':_0x11da73},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x21')]=function(_0x33a763){return request(_0x1dd3('0x22'),{'options':{'where':{'id':_0x33a763},'attributes':[_0x1dd3('0x23')]}});};exports[_0x1dd3('0x24')]=function(_0x3264c8){return request(_0x1dd3('0x25'),{'options':{'raw':![],'where':{'id':_0x3264c8},'include':[{'model':_0x1dd3('0x26'),'as':_0x1dd3('0x27')}]}});};exports[_0x1dd3('0x28')]=function(_0x3454fc){return request(_0x1dd3('0x29'),{'options':{'where':{'id':_0x3454fc},'attributes':['id',_0x1dd3('0xf')]}});};exports[_0x1dd3('0x2a')]=function(_0xed19e1){return request(_0x1dd3('0x2b'),{'body':_0xed19e1});};exports[_0x1dd3('0x2c')]=function(_0x1ac0a5){return request(_0x1dd3('0x2d'),{'body':_0x1ac0a5});};exports[_0x1dd3('0x2e')]=function(_0x4d960d){return request(_0x1dd3('0x2f'),{'body':_[_0x1dd3('0x30')](_0x4d960d,{'project_name':_0x4d960d[_0x1dd3('0x31')],'prev_project_name':_0x4d960d[_0x1dd3('0x32')]||'','is_subproject':_0x4d960d[_0x1dd3('0x32')]?!![]:![],'leaveAt':moment()[_0x1dd3('0x33')](_0x1dd3('0x34'))})});};exports[_0x1dd3('0x35')]=function(_0x5ec0d2){return request(_0x1dd3('0x36'),{'body':_0x5ec0d2});};exports[_0x1dd3('0x37')]=function(_0x50d46e){return request(_0x1dd3('0x38'),{'body':_0x50d46e});};exports[_0x1dd3('0x39')]=function(_0x5c0fd8){return request(_0x1dd3('0x3a'),{'options':{'raw':![],'where':{'phone':_0x5c0fd8['phone'],'ListId':_0x5c0fd8[_0x1dd3('0x3b')]}}})[_0x1dd3('0x8')](function(_0x4b043b){if(_0x4b043b){return _0x4b043b;}return request(_0x1dd3('0x3c'),{'body':_0x5c0fd8});});};exports[_0x1dd3('0x3d')]=function(_0xf27cdc){return request(_0x1dd3('0x3e'),{'options':{'where':{'id':_0xf27cdc},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x3f')]=function(_0x35f9d7,_0x51e264){return request(_0x1dd3('0x40'),{'body':{'interface':_0x51e264},'options':{'where':_0x35f9d7}});};exports[_0x1dd3('0x41')]=function(_0x4d2b56,_0x59fbdf,_0x5e3720){return request(_0x1dd3('0x42'),{'body':{'type':_0x59fbdf,'uniqueid':_0x5e3720},'options':{'where':_0x4d2b56}});};exports[_0x1dd3('0x43')]=function(_0x2db64f){return request(_0x1dd3('0x44'),{'body':{},'options':{'where':_0x2db64f}});};exports[_0x1dd3('0x45')]=function(_0x3f3546){return request(_0x1dd3('0x46'),{'body':{},'options':{'where':_0x3f3546}});}; \ No newline at end of file +var _0xd945=['PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ListId','agentLogin'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xd945,0x1af));var _0x5d94=function(_0x308edd,_0x32dffe){_0x308edd=_0x308edd-0x0;var _0x22380b=_0xd945[_0x308edd];return _0x22380b;};'use strict';var BPromise=require(_0x5d94('0x0'));var moment=require(_0x5d94('0x1'));var _=require(_0x5d94('0x2'));var util=require(_0x5d94('0x3'));var jayson=require(_0x5d94('0x4'));var client=jayson[_0x5d94('0x5')]['http']({'port':0x2329});function request(_0x1c700f,_0x174638){return new BPromise(function(_0x59fd16,_0x5baeeb){return client[_0x5d94('0x6')](_0x1c700f,_0x174638)[_0x5d94('0x7')](function(_0x3f6b7f){if(_0x3f6b7f[_0x5d94('0x8')]){return _0x5baeeb(_0x3f6b7f['error'][_0x5d94('0x9')]);}else{return _0x59fd16(_0x3f6b7f[_0x5d94('0xa')]);}})[_0x5d94('0xb')](function(_0x53fe87){return _0x5baeeb(_0x53fe87);});});}exports[_0x5d94('0xc')]=function(){return request(_0x5d94('0xd'),{'options':{'raw':![],'attributes':['id',_0x5d94('0xe'),'production']}});};exports[_0x5d94('0xf')]=function(_0x151eb2){return request(_0x5d94('0x10'),{'options':{'raw':![],'where':{'name':_0x151eb2},'attributes':[_0x5d94('0x11')]}});};exports[_0x5d94('0x12')]=function(_0x2e2add){return request(_0x5d94('0x13'),{'options':{'raw':![],'where':{'id':_0x2e2add},'include':[{'model':_0x5d94('0x14'),'as':'Smtp','include':[{'model':_0x5d94('0x15'),'as':'CloudProvider'}]}],'attributes':['id','name',_0x5d94('0x16')],'smtp':!![]}});};exports[_0x5d94('0x17')]=function(_0x949e3){return request(_0x5d94('0x10'),{'options':{'where':{'id':_0x949e3},'attributes':[_0x5d94('0xe')]}});};exports[_0x5d94('0x18')]=function(_0x199ef3){return request(_0x5d94('0x19'),{'options':{'where':{'id':_0x199ef3},'attributes':[_0x5d94('0xe')]}});};exports[_0x5d94('0x1a')]=function(_0x1d6b1a){return request(_0x5d94('0x1b'),{'options':{'where':{'id':_0x1d6b1a},'attributes':[_0x5d94('0xe')]}});};exports[_0x5d94('0x1c')]=function(_0x4b39d3){return request(_0x5d94('0x1d'),{'options':{'where':{'id':_0x4b39d3},'attributes':[_0x5d94('0x1e')]}});};exports[_0x5d94('0x1f')]=function(_0x1eec5c){return request(_0x5d94('0x20'),{'options':{'where':{'id':_0x1eec5c},'attributes':[_0x5d94('0xe')]}});};exports[_0x5d94('0x21')]=function(_0x291963){return request(_0x5d94('0x22'),{'options':{'where':{'phone':_0x291963[_0x5d94('0x23')]},'attributes':['id']}});};exports[_0x5d94('0x24')]=function(_0x2494f4){return request('ShowTrunk',{'options':{'where':{'id':_0x2494f4},'attributes':[_0x5d94('0xe')]}});};exports[_0x5d94('0x25')]=function(_0xf2697d){return request(_0x5d94('0x26'),{'options':{'where':{'id':_0xf2697d},'attributes':[_0x5d94('0x27')]}});};exports['getIntervalById']=function(_0x1dfcaa){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1dfcaa},'include':[{'model':'Interval','as':_0x5d94('0x28')}]}});};exports[_0x5d94('0x29')]=function(_0x3d1e46){return request(_0x5d94('0x2a'),{'options':{'where':{'id':_0x3d1e46},'attributes':['id',_0x5d94('0xe')]}});};exports[_0x5d94('0x2b')]=function(_0x2b9e00){return request('CreateSmsMessage',{'body':_0x2b9e00});};exports['createSquareDetailsReport']=function(_0x4f975d){return request(_0x5d94('0x2c'),{'body':_0x4f975d});};exports['createSquareReport']=function(_0x56916a){return request(_0x5d94('0x2d'),{'body':_[_0x5d94('0x2e')](_0x56916a,{'project_name':_0x56916a[_0x5d94('0x2f')],'prev_project_name':_0x56916a['arg_2']||'','is_subproject':_0x56916a[_0x5d94('0x30')]?!![]:![],'leaveAt':moment()[_0x5d94('0x31')](_0x5d94('0x32'))})});};exports[_0x5d94('0x33')]=function(_0x28f30){return request(_0x5d94('0x34'),{'body':_0x28f30});};exports['createSquareMessage']=function(_0x172901){return request(_0x5d94('0x35'),{'body':_0x172901});};exports[_0x5d94('0x36')]=function(_0x35ff0a){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x35ff0a['phone'],'ListId':_0x35ff0a[_0x5d94('0x37')]}}})[_0x5d94('0x7')](function(_0x3bc471){if(_0x3bc471){return _0x3bc471;}return request('CreateCmContact',{'body':_0x35ff0a});});};exports['getPauseById']=function(_0x18fd90){return request('ShowPause',{'options':{'where':{'id':_0x18fd90},'attributes':[_0x5d94('0xe')]}});};exports[_0x5d94('0x38')]=function(_0x3e8f29,_0x2d2fc){return request('LoginUser',{'body':{'interface':_0x2d2fc},'options':{'where':_0x3e8f29}});};exports['agentPause']=function(_0x201522,_0x2f3d1b,_0x42ad74){return request(_0x5d94('0x39'),{'body':{'type':_0x2f3d1b,'uniqueid':_0x42ad74},'options':{'where':_0x201522}});};exports[_0x5d94('0x3a')]=function(_0x4f16d1){return request(_0x5d94('0x3b'),{'body':{},'options':{'where':_0x4f16d1}});};exports['agentLogout']=function(_0x1b9a07){return request(_0x5d94('0x3c'),{'body':{},'options':{'where':_0x1b9a07}});}; \ 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 b231056..7ece023 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 _0x565f=['./lex','exports'];(function(_0x48dbb4,_0x3ef00f){var _0x1b34a3=function(_0x2295b0){while(--_0x2295b0){_0x48dbb4['push'](_0x48dbb4['shift']());}};_0x1b34a3(++_0x3ef00f);}(_0x565f,0x68));var _0xf565=function(_0x49d222,_0x373c22){_0x49d222=_0x49d222-0x0;var _0x4c0d5f=_0x565f[_0x49d222];return _0x4c0d5f;};var polly=require('./polly');var lex=require(_0xf565('0x0'));module[_0xf565('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x444e=['./polly','exports'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x444e,0xe8));var _0xe444=function(_0x32e35d,_0x297a17){_0x32e35d=_0x32e35d-0x0;var _0xb20ae5=_0x444e[_0x32e35d];return _0xb20ae5;};var polly=require(_0xe444('0x0'));var lex=require('./lex');module[_0xe444('0x1')]={'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 927e522..bd1d655 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 _0x750a=['exports'];(function(_0x1d857d,_0x457c94){var _0x2e2164=function(_0x6177cf){while(--_0x6177cf){_0x1d857d['push'](_0x1d857d['shift']());}};_0x2e2164(++_0x457c94);}(_0x750a,0x140));var _0xa750=function(_0x561580,_0xe513c6){_0x561580=_0x561580-0x0;var _0x189310=_0x750a[_0x561580];return _0x189310;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ No newline at end of file +var _0x6f7a=['./lib/api','exports'];(function(_0x4fdcf2,_0x1f0f06){var _0x43ec28=function(_0x3d80f7){while(--_0x3d80f7){_0x4fdcf2['push'](_0x4fdcf2['shift']());}};_0x43ec28(++_0x1f0f06);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x423981,_0x1bea49){_0x423981=_0x423981-0x0;var _0x25163c=_0x6f7a[_0x423981];return _0x25163c;};'use strict';var lex=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]=function(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8){return lex(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8);}; \ 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 2331c99..aa51999 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(_0x2c68b7,_0x4d5475){var _0x54616f=function(_0xd05753){while(--_0xd05753){_0x2c68b7['push'](_0x2c68b7['shift']());}};_0x54616f(++_0x4d5475);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0xaad2f3,_0x540107){var _0x8eea56=function(_0x7d347b){while(--_0x7d347b){_0xaad2f3['push'](_0xaad2f3['shift']());}};_0x8eea56(++_0x540107);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 4c9d949..50de19a 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 _0xda2c=['exports'];(function(_0x305d3a,_0x1e5a37){var _0x587f68=function(_0x26ebe2){while(--_0x26ebe2){_0x305d3a['push'](_0x305d3a['shift']());}};_0x587f68(++_0x1e5a37);}(_0xda2c,0xe1));var _0xcda2=function(_0xa69b5,_0x18ff44){_0xa69b5=_0xa69b5-0x0;var _0x1ca183=_0xda2c[_0xa69b5];return _0x1ca183;};'use strict';var polly=require('./lib/api');module[_0xcda2('0x0')]=function(_0x294cfb,_0x271350,_0x4b0523,_0x57189d,_0x4284c8,_0x3dcd05,_0x2bc92b){return polly(_0x294cfb,_0x271350,_0x4b0523,_0x57189d,_0x4284c8,_0x3dcd05,_0x2bc92b);}; \ No newline at end of file +var _0x70b7=['exports','./lib/api'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x70b7,0x167));var _0x770b=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x70b7[_0x3ce2c4];return _0x4047c1;};'use strict';var polly=require(_0x770b('0x0'));module[_0x770b('0x1')]=function(_0x5851b7,_0x10082d,_0x504b84,_0x2d786d,_0x236f92,_0x96f9a6,_0x3add31){return polly(_0x5851b7,_0x10082d,_0x504b84,_0x2d786d,_0x236f92,_0x96f9a6,_0x3add31);}; \ 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 91e443c..580d2e4 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 _0xb4c2=['aws-sdk','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','bluebird','randomstring'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0xb4c2,0x69));var _0x2b4c=function(_0xaad061,_0x49cbd0){_0xaad061=_0xaad061-0x0;var _0x22c207=_0xb4c2[_0xaad061];return _0x22c207;};'use strict';var fs=require('fs');var path=require(_0x2b4c('0x0'));var BPromise=require(_0x2b4c('0x1'));var rs=require(_0x2b4c('0x2'));var AWS=require(_0x2b4c('0x3'));function pollyResult(_0x4a9dd2,_0xf48d6b,_0x523456){return new BPromise(function(_0x394bc7,_0x581e9e){_0x4a9dd2['synthesizeSpeech'](_0xf48d6b,function(_0x56fa2c,_0x3473a6){if(_0x56fa2c){_0x581e9e(_0x56fa2c);}else if(_0x3473a6){if(_0x3473a6[_0x2b4c('0x4')]instanceof Buffer){fs[_0x2b4c('0x5')](_0x523456,_0x3473a6[_0x2b4c('0x4')],function(_0x3a94ee){if(_0x3a94ee){_0x581e9e(_0x3a94ee);}else{_0x394bc7();}});}else{_0x581e9e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x581e9e(new Error(_0x2b4c('0x6')));}});});}module['exports']=function(_0x49541d,_0x2acc0d,_0x43e355,_0x4cd404,_0x497137,_0x2bffda,_0x823e7c){var _0x4abc17=new AWS[(_0x2b4c('0x7'))]({'accessKeyId':_0x49541d,'secretAccessKey':_0x2acc0d,'region':_0x43e355});var _0x359a8b={'Text':_0x497137,'TextType':_0x2bffda||'text','OutputFormat':_0x2b4c('0x8'),'VoiceId':_0x4cd404};return pollyResult(_0x4abc17,_0x359a8b,_0x823e7c);}; \ No newline at end of file +var _0x9847=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x516f52,_0x210b10){var _0x5d06db=function(_0x26ceab){while(--_0x26ceab){_0x516f52['push'](_0x516f52['shift']());}};_0x5d06db(++_0x210b10);}(_0x9847,0xb1));var _0x7984=function(_0x41f252,_0x36bc6e){_0x41f252=_0x41f252-0x0;var _0x2c08e4=_0x9847[_0x41f252];return _0x2c08e4;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x7984('0x0'));var AWS=require(_0x7984('0x1'));function pollyResult(_0x1e8761,_0x83ae23,_0xe6078f){return new BPromise(function(_0x4155e4,_0x3f17c5){_0x1e8761[_0x7984('0x2')](_0x83ae23,function(_0x5e24c9,_0x2184ea){if(_0x5e24c9){_0x3f17c5(_0x5e24c9);}else if(_0x2184ea){if(_0x2184ea[_0x7984('0x3')]instanceof Buffer){fs[_0x7984('0x4')](_0xe6078f,_0x2184ea['AudioStream'],function(_0xed02f3){if(_0xed02f3){_0x3f17c5(_0xed02f3);}else{_0x4155e4();}});}else{_0x3f17c5(new Error(_0x7984('0x5')));}}else{_0x3f17c5(new Error(_0x7984('0x6')));}});});}module[_0x7984('0x7')]=function(_0x4a3c9c,_0x568cb1,_0x458bc6,_0x545394,_0x6b18bc,_0x2da30c,_0x521e84){var _0x1bfc46=new AWS[(_0x7984('0x8'))]({'accessKeyId':_0x4a3c9c,'secretAccessKey':_0x568cb1,'region':_0x458bc6});var _0xea011={'Text':_0x6b18bc,'TextType':_0x2da30c||_0x7984('0x9'),'OutputFormat':'mp3','VoiceId':_0x545394};return pollyResult(_0x1bfc46,_0xea011,_0x521e84);}; \ 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 c5be228..bfecaa5 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 _0x3e81=['exports'];(function(_0x2adb3d,_0x53b434){var _0x3c0694=function(_0xda6175){while(--_0xda6175){_0x2adb3d['push'](_0x2adb3d['shift']());}};_0x3c0694(++_0x53b434);}(_0x3e81,0x1ee));var _0x13e8=function(_0x4823e2,_0xe74585){_0x4823e2=_0x4823e2-0x0;var _0x5dc63d=_0x3e81[_0x4823e2];return _0x5dc63d;};'use strict';var asr=require('./lib/api');module[_0x13e8('0x0')]=function(_0x5e618b,_0x1998ca,_0x2716fb,_0x420f96){return asr(_0x5e618b,_0x1998ca,_0x2716fb);}; \ No newline at end of file +var _0x6cef=['exports'];(function(_0x41ab68,_0x3e806f){var _0x134b6c=function(_0x4c3a80){while(--_0x4c3a80){_0x41ab68['push'](_0x41ab68['shift']());}};_0x134b6c(++_0x3e806f);}(_0x6cef,0xfb));var _0xf6ce=function(_0x50be19,_0x3ea1d0){_0x50be19=_0x50be19-0x0;var _0x54fa7b=_0x6cef[_0x50be19];return _0x54fa7b;};'use strict';var asr=require('./lib/api');module[_0xf6ce('0x0')]=function(_0x168d9a,_0x26c6e5,_0x405d3a,_0x1652c4){return asr(_0x168d9a,_0x26c6e5,_0x405d3a);}; \ 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 f907068..4bdad11 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 _0xcb91=['lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','LINEAR16','https://speech.googleapis.com','exports','string','length','undefined'];(function(_0x5af4ce,_0x4374bf){var _0x581b03=function(_0x190db7){while(--_0x190db7){_0x5af4ce['push'](_0x5af4ce['shift']());}};_0x581b03(++_0x4374bf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xcb91[_0x17a32f];return _0x15a293;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x1cb9('0x0');module[_0x1cb9('0x1')]=function(_0x17d4ec,_0x22c4b8,_0x4c37e8){return new BPromise(function(_0x8c392f,_0x2c17b8){var _0x545a34;if(typeof _0x17d4ec!==_0x1cb9('0x2')||_0x17d4ec[_0x1cb9('0x3')]===0x0){return _0x2c17b8('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x22c4b8!==_0x1cb9('0x2')||_0x22c4b8[_0x1cb9('0x3')]===0x0){return _0x2c17b8('key\x20should\x20be\x20a\x20string');}if(typeof _0x4c37e8!==_0x1cb9('0x4')&&(typeof _0x4c37e8!==_0x1cb9('0x2')||_0x4c37e8['length']===0x0)){return _0x2c17b8(_0x1cb9('0x5'));}try{_0x545a34=fs['readFileSync'](_0x17d4ec)['toString'](_0x1cb9('0x6'));}catch(_0x2fa15c){return _0x2c17b8(_0x2fa15c);}return _0x8c392f({'method':_0x1cb9('0x7'),'uri':host+_0x1cb9('0x8')+_0x22c4b8,'body':{'config':{'encoding':_0x1cb9('0x9'),'sampleRateHertz':'8000','languageCode':_0x4c37e8},'audio':{'content':_0x545a34}},'json':!![]});});}; \ No newline at end of file +var _0x91a7=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x91a7,0xe7));var _0x791a=function(_0x429ddd,_0x52bdf9){_0x429ddd=_0x429ddd-0x0;var _0x1225f7=_0x91a7[_0x429ddd];return _0x1225f7;};'use strict';var url=require('url');var BPromise=require(_0x791a('0x0'));var fs=require('fs');var host=_0x791a('0x1');module[_0x791a('0x2')]=function(_0x5d2796,_0x415994,_0x5b6f78){return new BPromise(function(_0x2f6392,_0x535640){var _0x50ab29;if(typeof _0x5d2796!==_0x791a('0x3')||_0x5d2796[_0x791a('0x4')]===0x0){return _0x535640('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x415994!==_0x791a('0x3')||_0x415994['length']===0x0){return _0x535640(_0x791a('0x5'));}if(typeof _0x5b6f78!==_0x791a('0x6')&&(typeof _0x5b6f78!=='string'||_0x5b6f78[_0x791a('0x4')]===0x0)){return _0x535640(_0x791a('0x7'));}try{_0x50ab29=fs[_0x791a('0x8')](_0x5d2796)[_0x791a('0x9')](_0x791a('0xa'));}catch(_0x5249d5){return _0x535640(_0x5249d5);}return _0x2f6392({'method':_0x791a('0xb'),'uri':host+_0x791a('0xc')+_0x415994,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x791a('0xd'),'languageCode':_0x5b6f78},'audio':{'content':_0x50ab29}},'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 2f7cdaf..5158d84 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 _0x22e4=['./asr','exports'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x22e4,0x80));var _0x422e=function(_0xb225a3,_0x5b8e23){_0xb225a3=_0xb225a3-0x0;var _0x59274c=_0x22e4[_0xb225a3];return _0x59274c;};var asr=require(_0x422e('0x0'));module[_0x422e('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1f6d=['exports','./asr'];(function(_0x42c61f,_0x1fc47){var _0x21ab60=function(_0x353cc9){while(--_0x353cc9){_0x42c61f['push'](_0x42c61f['shift']());}};_0x21ab60(++_0x1fc47);}(_0x1f6d,0x1c7));var _0xd1f6=function(_0x3e3e86,_0x12dc19){_0x3e3e86=_0x3e3e86-0x0;var _0x4bfbd6=_0x1f6d[_0x3e3e86];return _0x4bfbd6;};var asr=require(_0xd1f6('0x0'));module[_0xd1f6('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 d2fd740..c1064e8 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 _0x0b06=['finish\x20download\x20file','close','unlink','pipe','end','get','data','wav','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','chmodSync','777','split','readFileSync','toString','base64','?key=','ssml','input','POST','resolve','.mp3','from','audioContent','writeFile','then','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','fulfillmentText','Tilde\x20ASR\x20transcription','awsPolly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','AudioFromTts','Data','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info'];(function(_0x3b6cb5,_0x337346){var _0x277e53=function(_0x4f78b4){while(--_0x4f78b4){_0x3b6cb5['push'](_0x3b6cb5['shift']());}};_0x277e53(++_0x337346);}(_0x0b06,0xe5));var _0x60b0=function(_0x58fa5d,_0x3a7145){_0x58fa5d=_0x58fa5d-0x0;var _0xacfcc1=_0x0b06[_0x58fa5d];return _0xacfcc1;};'use strict';var apiai=require(_0x60b0('0x0'));var BPromise=require(_0x60b0('0x1'));var dialogflow=require(_0x60b0('0x2'));var fs=require('fs');var http=require(_0x60b0('0x3'));var https=require('https');var md5=require(_0x60b0('0x4'));var path=require(_0x60b0('0x5'));var querystring=require(_0x60b0('0x6'));var rp=require('request-promise');var rs=require('randomstring');var sox=require('sox');var tts=require(_0x60b0('0x7'));var urlParse=require(_0x60b0('0x8'))[_0x60b0('0x9')];var util=require(_0x60b0('0xa'));var aws=require(_0x60b0('0xb'));var google=require(_0x60b0('0xc'));var sestek=require(_0x60b0('0xd'));var tilde=require('./tilde');var logger=require(_0x60b0('0xe'))(_0x60b0('0xf'));var ISPEECH_API=_0x60b0('0x10');function downloadFile(_0x35665b,_0x590438){return new BPromise(function(_0x2aefc4,_0x952fb4){var _0x4c3a0e=urlParse(_0x35665b);var _0x262b65=_0x4c3a0e[_0x60b0('0x11')]===_0x60b0('0x12')?https:http;var _0x392a68={'host':_0x4c3a0e[_0x60b0('0x13')],'path':_0x4c3a0e[_0x60b0('0x5')],'headers':{'user-agent':_0x60b0('0x14')}};_0x262b65['get'](_0x392a68,function(_0x40625a){if(_0x40625a['statusCode']!==0xc8){logger[_0x60b0('0x15')](_0x60b0('0x16')+_0x35665b+_0x60b0('0x17')+_0x40625a[_0x60b0('0x18')]+'\x20('+_0x40625a[_0x60b0('0x19')]+')');_0x952fb4(new Error(_0x60b0('0x16')+_0x35665b+_0x60b0('0x17')+_0x40625a[_0x60b0('0x18')]+'\x20('+_0x40625a[_0x60b0('0x19')]+')'));return;}var _0x93d62c=fs[_0x60b0('0x1a')](_0x590438);_0x93d62c['on'](_0x60b0('0x1b'),function(){logger[_0x60b0('0x1c')](_0x60b0('0x1d'));_0x93d62c[_0x60b0('0x1e')](_0x2aefc4);});_0x93d62c['on'](_0x60b0('0x15'),function(_0x582d80){fs[_0x60b0('0x1f')](_0x590438);logger[_0x60b0('0x15')]('download\x20error',_0x582d80);_0x952fb4(_0x582d80);});_0x40625a[_0x60b0('0x20')](_0x93d62c);})['on'](_0x60b0('0x15'),function(_0x35ef37){logger[_0x60b0('0x15')](_0x35ef37);_0x952fb4(_0x35ef37);})[_0x60b0('0x21')]();});}function uploadFile(_0x257c18){return new BPromise(function(_0x5ed48e,_0x246951){var _0x365d98=urlParse(_0x257c18);var _0x25f6c8=_0x365d98[_0x60b0('0x11')]===_0x60b0('0x12')?https:http;var _0x438cfa={'host':_0x365d98[_0x60b0('0x13')],'path':_0x365d98[_0x60b0('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x25f6c8[_0x60b0('0x22')](_0x438cfa,function(_0x273274){if(_0x273274[_0x60b0('0x18')]!==0xc8){_0x246951(new Error(_0x60b0('0x16')+_0x257c18+_0x60b0('0x17')+_0x273274['statusCode']+'\x20('+_0x273274[_0x60b0('0x19')]+')'));return;}var _0x50ac23='';_0x273274['on'](_0x60b0('0x23'),function(_0x1a85dd){_0x50ac23+=_0x1a85dd;});_0x273274['on'](_0x60b0('0x21'),function(){_0x5ed48e(_0x50ac23);});})['on'](_0x60b0('0x15'),function(_0x5389f8){_0x246951(_0x5389f8);})['end']();});}function convertFile(_0x1d52b9,_0x27fb3c){return new BPromise(function(_0x3243af,_0xf8c404){var _0x4c63c4=sox['transcode'](_0x1d52b9,_0x27fb3c,{'sampleRate':0x1f40,'format':_0x60b0('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4c63c4['on'](_0x60b0('0x15'),function(_0x5d1dd5){logger[_0x60b0('0x15')](_0x60b0('0x25'),_0x5d1dd5);_0xf8c404(_0x5d1dd5);});_0x4c63c4['on'](_0x60b0('0x21'),function(){logger[_0x60b0('0x1c')](_0x60b0('0x26'));_0x3243af();});_0x4c63c4['start']();});}function base64Decode(_0x13bf94,_0x200bbe){var _0x2ff11a=path['resolve'](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+_0x60b0('0x29'));fs['writeFileSync'](_0x2ff11a,_0x13bf94,'base64');return convertFile(_0x2ff11a,_0x200bbe)['then'](function(){try{fs[_0x60b0('0x1f')](_0x2ff11a);fs[_0x60b0('0x2a')](_0x200bbe,_0x60b0('0x2b'));}catch(_0x280e30){logger[_0x60b0('0x15')](_0x280e30);}return _0x200bbe[_0x60b0('0x2c')]('.')[0x0];});}function base64Encode(_0x4b1648){var _0x33bb30=fs[_0x60b0('0x2d')](_0x4b1648);return new Buffer(_0x33bb30)[_0x60b0('0x2e')](_0x60b0('0x2f'));}exports['googleCloudTTS']=function(_0x28ae86,_0x29e1e2,_0x4d6f25,_0x3c7198,_0x1a510e,_0xe9938e){var _0x55c70a,_0x3019fe;var _0x36ff24='https://texttospeech.googleapis.com/v1/';var _0x134b26=_0x60b0('0x30')+_0x28ae86;var _0x3f1d56={};if(_0x29e1e2===_0x60b0('0x31')){_0x3f1d56[_0x60b0('0x32')]={'ssml':_0x4d6f25};}else{_0x3f1d56[_0x60b0('0x32')]={'text':_0x4d6f25};};_0x3f1d56['voice']={'languageCode':_0x3c7198,'ssmlGender':_0x1a510e};_0x3f1d56['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4d56d3={'url':_0x36ff24+'text:synthesize'+_0x134b26,'method':_0x60b0('0x33'),'json':!![],'body':_0x3f1d56};return rp(_0x4d56d3)['then'](function(_0x391559){return new BPromise(function(_0x753317,_0x32a773){_0x55c70a=path[_0x60b0('0x34')](__dirname,'tmp',rs[_0x60b0('0x28')](0x4)+_0x60b0('0x35'));var _0x10d5e8=Buffer[_0x60b0('0x36')](_0x391559[_0x60b0('0x37')],'base64');return fs[_0x60b0('0x38')](_0x55c70a,_0x10d5e8,function(_0x97e89c){_0x32a773(_0x97e89c);},function(_0x270444){fs[_0x60b0('0x2a')](_0x55c70a,'777');_0x753317(_0x270444);});});})[_0x60b0('0x39')](function(_0x5627be){_0x3019fe=path['resolve'](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+'.wav');return convertFile(_0x55c70a,_0x3019fe);})[_0x60b0('0x39')](function(){try{fs[_0x60b0('0x1f')](_0x55c70a);fs[_0x60b0('0x2a')](_0x3019fe,'777');}catch(_0xd186fa){logger[_0x60b0('0x15')](_0xd186fa);}logger[_0x60b0('0x1c')](_0x60b0('0x3a'),_0x3019fe[_0x60b0('0x2c')]('.')[0x0]);return _0x3019fe['split']('.')[0x0];});};exports[_0x60b0('0x3b')]=function(_0x5c5001,_0x28098f){var _0x2ba8b7=_0x60b0('0x3c');var _0x2d76a1,_0x4490db;var _0x4775cf;var _0x3c33d2={'encoding':_0x60b0('0x3d'),'method':_0x60b0('0x33'),'timeout':0x2710,'url':_0x2ba8b7,'headers':{'Content-Type':_0x60b0('0x3e')},'body':_0x60b0('0x3f')+encodeURIComponent(JSON[_0x60b0('0x40')]([[[_0x60b0('0x41'),JSON[_0x60b0('0x40')]([_0x5c5001,_0x28098f||'en',![],'null']),null,_0x60b0('0x42')]]]))};return rp(_0x3c33d2)[_0x60b0('0x39')](function(_0x847eb6){try{_0x4775cf=eval(_0x847eb6['slice'](0x5))[0x0][0x2];}catch(_0x18e8cc){throw new Error('parse\x20response\x20failed:\x0a'+_0x847eb6[_0x60b0('0x23')]);}if(!_0x4775cf){if(_0x5c5001[_0x60b0('0x43')]>0xc8){throw new Error(_0x60b0('0x44'));}else{throw new Error('lang\x20\x22'+_0x28098f+_0x60b0('0x45'));}}try{_0x4775cf=eval(_0x4775cf)[0x0];}catch(_0x3b4480){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x60b0('0x23')]);}const _0xb38f46=_0x4775cf;_0x2d76a1=path[_0x60b0('0x34')](__dirname,'tmp',rs[_0x60b0('0x28')](0x4)+_0x60b0('0x35'));fs[_0x60b0('0x46')](_0x2d76a1,_0x4775cf,{'encoding':_0x60b0('0x2f')});_0x4490db=path[_0x60b0('0x34')](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+'.wav');return convertFile(_0x2d76a1,_0x4490db);})[_0x60b0('0x39')](function(){try{fs[_0x60b0('0x1f')](_0x2d76a1);fs[_0x60b0('0x2a')](_0x4490db,_0x60b0('0x2b'));}catch(_0x126eb1){logger['error'](_0x126eb1);}logger[_0x60b0('0x1c')](_0x60b0('0x47'),_0x4490db[_0x60b0('0x2c')]('.')[0x0]);return _0x4490db[_0x60b0('0x2c')]('.')[0x0];});};exports[_0x60b0('0x48')]=function(_0x3004dc,_0x371743,_0x301e4d){return google[_0x60b0('0x49')](_0x3004dc,_0x371743,_0x301e4d)['then'](function(_0x2b7fbe){logger[_0x60b0('0x1c')](_0x2b7fbe['uri']);return rp(_0x2b7fbe);})[_0x60b0('0x39')](function(_0x45cc2c){var _0x14845a='';var _0x469114=0x0;try{fs['unlink'](_0x3004dc);}catch(_0x4d79a8){logger['error'](_0x4d79a8);}if(_0x45cc2c&&_0x45cc2c[_0x60b0('0x4a')]){_0x14845a=_0x45cc2c[_0x60b0('0x4a')]['map'](function(_0x57061f){return _0x57061f&&_0x57061f[_0x60b0('0x4b')][0x0]&&_0x57061f[_0x60b0('0x4b')][0x0][_0x60b0('0x4c')]?_0x57061f[_0x60b0('0x4b')][0x0]['transcript']:'';})[_0x60b0('0x4d')]('\x0a');_0x469114=_0x45cc2c[_0x60b0('0x4a')]['map'](function(_0x4a1d08){return _0x4a1d08&&_0x4a1d08[_0x60b0('0x4b')][0x0]&&_0x4a1d08[_0x60b0('0x4b')][0x0]['confidence']?_0x4a1d08[_0x60b0('0x4b')][0x0][_0x60b0('0x4e')]:0x0;})[_0x60b0('0x4d')]('\x0a');}logger[_0x60b0('0x1c')](_0x60b0('0x4f'),_0x14845a);logger[_0x60b0('0x1c')](_0x60b0('0x50'),_0x469114);return{'transcript':_0x14845a,'confidence':_0x469114};})[_0x60b0('0x51')](function(_0x433f16){logger[_0x60b0('0x15')](_0x60b0('0x52'),_0x433f16[_0x60b0('0x18')],_0x433f16['name'],_0x433f16[_0x60b0('0x53')]);});};exports[_0x60b0('0x54')]=function(_0x32921c,_0x228bb6,_0x2e6dda,_0x5d08d2){var _0x218c12=apiai(_0x228bb6,{'language':_0x5d08d2||'en'});return _0x218c12['textRequest'](_0x2e6dda,{'sessionId':md5(_0x32921c)})['then'](function(_0x1d2ab4){logger[_0x60b0('0x1c')](JSON[_0x60b0('0x40')](_0x1d2ab4));return{'source':_0x1d2ab4['result'][_0x60b0('0x55')],'resolvedQuery':_0x1d2ab4['result'][_0x60b0('0x56')],'action':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x58')],'actionIncomplete':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x59')],'speech':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x5a')][_0x60b0('0x5b')],'score':_0x1d2ab4[_0x60b0('0x57')]['score'],'statusCode':_0x1d2ab4[_0x60b0('0x5c')][_0x60b0('0x5d')],'endConversation':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x5e')][_0x60b0('0x5f')]||![],'isFallbackIntent':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x5e')][_0x60b0('0x60')]};});};exports[_0x60b0('0x61')]=function(_0x25e303,_0x1617e3,_0x3338b7,_0x33ba10,_0x306006,_0x1c4757){var _0x1960d6=_0x33ba10['replace'](/\\n/g,'\x0a');var _0x90a6ba={'credentials':{'private_key':_0x1960d6,'client_email':_0x3338b7}};var _0x3f4e44=new dialogflow[(_0x60b0('0x62'))](_0x90a6ba);var _0x18b946=_0x3f4e44['sessionPath'](_0x1617e3,md5(_0x25e303));var _0x3c5ca0={'session':_0x18b946,'queryInput':{'text':{'text':_0x306006,'languageCode':_0x1c4757}}};return _0x3f4e44[_0x60b0('0x63')](_0x3c5ca0)[_0x60b0('0x39')](function(_0x5c7851){if(_0x5c7851&&_0x5c7851[_0x60b0('0x43')]){logger[_0x60b0('0x1c')](_0x60b0('0x64'),JSON[_0x60b0('0x40')](_0x5c7851));var _0x1d9cb5=_0x5c7851[0x0];if(_0x1d9cb5){var _0xfedbd8={'action':_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x58')],'allRequiredParamsPresent':_0x1d9cb5[_0x60b0('0x65')]['allRequiredParamsPresent'],'endConversation':_0x1d9cb5[_0x60b0('0x65')]['diagnosticInfo']&&_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x66')]['fields']?_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x66')][_0x60b0('0x67')][_0x60b0('0x68')][_0x60b0('0x69')]:![],'fulfillmentText':_0x1d9cb5[_0x60b0('0x65')]['fulfillmentText'],'intentName':_0x1d9cb5['queryResult']['intent']['name'],'intentDisplayName':_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x6a')][_0x60b0('0x6b')],'isFallbackIntent':_0x1d9cb5['queryResult'][_0x60b0('0x6a')][_0x60b0('0x6c')],'languageCode':_0x1d9cb5[_0x60b0('0x65')]['languageCode'],'queryText':_0x1d9cb5['queryResult'][_0x60b0('0x6d')],'responseId':_0x1d9cb5[_0x60b0('0x6e')],'score':_0x1d9cb5['queryResult'][_0x60b0('0x6f')],'speech':_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x70')],'providerResponse':JSON[_0x60b0('0x40')](_0x5c7851)};return _0xfedbd8;}}});};exports['tildeASR']=function(_0x1dc05a,_0x2083f1,_0x95dd54,_0x565ca8){return tilde[_0x60b0('0x49')](_0x1dc05a,_0x2083f1,_0x95dd54,_0x565ca8)[_0x60b0('0x39')](function(_0x1e1e50){try{fs[_0x60b0('0x1f')](_0x1dc05a);}catch(_0x3fee49){logger[_0x60b0('0x15')](_0x3fee49);}logger[_0x60b0('0x1c')](_0x60b0('0x71'),_0x1e1e50[_0x60b0('0x4c')]);logger[_0x60b0('0x1c')]('Tilde\x20ASR\x20confidence',_0x1e1e50[_0x60b0('0x4e')]);return _0x1e1e50;});};exports[_0x60b0('0x72')]=function(_0x30258a,_0x7639bb,_0x574da4,_0x1c316f,_0x33088e,_0x31f569){var _0x44e7e6=path[_0x60b0('0x34')](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+_0x60b0('0x35'));var _0x1a90bc;return aws['polly'](_0x30258a,_0x7639bb,_0x574da4,_0x1c316f,_0x33088e,_0x31f569,_0x44e7e6)['then'](function(){_0x1a90bc=path[_0x60b0('0x34')](__dirname,'tmp',rs['generate'](0x4)+_0x60b0('0x29'));return convertFile(_0x44e7e6,_0x1a90bc);})[_0x60b0('0x39')](function(){try{fs[_0x60b0('0x1f')](_0x44e7e6);fs[_0x60b0('0x2a')](_0x1a90bc,_0x60b0('0x2b'));}catch(_0x1737d8){logger[_0x60b0('0x15')](_0x1737d8);}return _0x1a90bc['split']('.')[0x0];});};exports[_0x60b0('0x73')]=function(_0x3d30cd,_0x54706f,_0xce3a09,_0x572ae9,_0x397809,_0x5938e1){return aws[_0x60b0('0x74')](_0x3d30cd,_0x54706f,_0xce3a09,_0x572ae9,_0x397809,_0x5938e1)[_0x60b0('0x39')](function(_0x386568){logger[_0x60b0('0x1c')](JSON[_0x60b0('0x40')](_0x386568));return _0x386568;});};exports['ispeechTTS']=function(_0x336892,_0x4118e5,_0x14c369,_0x368d78){var _0x4a30d9=util[_0x60b0('0x75')](_0x60b0('0x76'),ISPEECH_API,_0x336892,encodeURIComponent(_0x4118e5),_0x14c369,_0x368d78);var _0x2229f4=path['resolve'](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+_0x60b0('0x35'));var _0x3ba818;return downloadFile(_0x4a30d9,_0x2229f4)[_0x60b0('0x39')](function(){_0x3ba818=path[_0x60b0('0x34')](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+'.wav');return convertFile(_0x2229f4,_0x3ba818);})[_0x60b0('0x39')](function(){try{fs[_0x60b0('0x1f')](_0x2229f4);fs['chmodSync'](_0x3ba818,_0x60b0('0x2b'));}catch(_0x4adbbf){logger['error'](_0x4adbbf);}return _0x3ba818['split']('.')[0x0];});};exports[_0x60b0('0x77')]=function(_0x327939,_0x185b5f,_0x45acf9,_0xce825d){var _0x10d41b=util['format'](_0x60b0('0x78'),ISPEECH_API,_0x185b5f,_0x45acf9,base64Encode(_0x327939),_0xce825d?util['format'](_0x60b0('0x79'),encodeURIComponent(_0xce825d)):_0x60b0('0x7a'));return uploadFile(_0x10d41b)['then'](function(_0x1e78e3){return querystring[_0x60b0('0x9')](_0x1e78e3);});};exports[_0x60b0('0x7b')]=function(_0x53457b,_0x41979a){return sestek[_0x60b0('0x7c')](_0x53457b,_0x41979a)[_0x60b0('0x39')](function(_0x3d2f9e){logger[_0x60b0('0x1c')](JSON[_0x60b0('0x40')](_0x3d2f9e));var _0x581c3d={'speech':_0x3d2f9e[_0x60b0('0x7d')],'action':_0x3d2f9e[_0x60b0('0x7e')]?_0x3d2f9e[_0x60b0('0x7e')]['CustomAction']:undefined,'actiondata':_0x3d2f9e[_0x60b0('0x7e')]?_0x3d2f9e[_0x60b0('0x7e')]['CustomActionData']:undefined};if(_0x3d2f9e[_0x60b0('0x7e')]&&_0x3d2f9e['channelData'][_0x60b0('0x7f')]){return base64Decode(_0x3d2f9e[_0x60b0('0x7e')][_0x60b0('0x7f')][_0x60b0('0x80')],path[_0x60b0('0x34')](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+_0x60b0('0x29')))[_0x60b0('0x39')](function(_0x2237a3){_0x581c3d['audiofile']=_0x2237a3;return _0x581c3d;});}return _0x581c3d;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xcb4c=['application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','resolvedQuery','action','actionIncomplete','score','status','code','metadata','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','queryText','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','sox','url','parse','util','./aws','./google','./sestek','./tilde','https://api.ispeech.org/api/rest','https:','path','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','finish\x20download\x20file','unlink','error','download\x20error','pipe','host','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','chmodSync','777','split','toString','base64','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','from','audioContent','then','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST'];(function(_0x3df5e9,_0x26dee){var _0x55eb5b=function(_0x4630c3){while(--_0x4630c3){_0x3df5e9['push'](_0x3df5e9['shift']());}};_0x55eb5b(++_0x26dee);}(_0xcb4c,0x15d));var _0xccb4=function(_0x1899f3,_0x3ff140){_0x1899f3=_0x1899f3-0x0;var _0x43d6be=_0xcb4c[_0x1899f3];return _0x43d6be;};'use strict';var apiai=require(_0xccb4('0x0'));var BPromise=require(_0xccb4('0x1'));var dialogflow=require(_0xccb4('0x2'));var fs=require('fs');var http=require(_0xccb4('0x3'));var https=require(_0xccb4('0x4'));var md5=require(_0xccb4('0x5'));var path=require('path');var querystring=require(_0xccb4('0x6'));var rp=require(_0xccb4('0x7'));var rs=require('randomstring');var sox=require(_0xccb4('0x8'));var tts=require('google-tts-api');var urlParse=require(_0xccb4('0x9'))[_0xccb4('0xa')];var util=require(_0xccb4('0xb'));var aws=require(_0xccb4('0xc'));var google=require(_0xccb4('0xd'));var sestek=require(_0xccb4('0xe'));var tilde=require(_0xccb4('0xf'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xccb4('0x10');function downloadFile(_0x15acff,_0x4ea029){return new BPromise(function(_0x4516f2,_0x55765a){var _0x5547da=urlParse(_0x15acff);var _0x4c7119=_0x5547da['protocol']===_0xccb4('0x11')?https:http;var _0x28598d={'host':_0x5547da['host'],'path':_0x5547da[_0xccb4('0x12')],'headers':{'user-agent':_0xccb4('0x13')}};_0x4c7119[_0xccb4('0x14')](_0x28598d,function(_0x1fe0e0){if(_0x1fe0e0[_0xccb4('0x15')]!==0xc8){logger['error'](_0xccb4('0x16')+_0x15acff+'\x20failed,\x20status\x20code\x20=\x20'+_0x1fe0e0[_0xccb4('0x15')]+'\x20('+_0x1fe0e0[_0xccb4('0x17')]+')');_0x55765a(new Error(_0xccb4('0x16')+_0x15acff+_0xccb4('0x18')+_0x1fe0e0[_0xccb4('0x15')]+'\x20('+_0x1fe0e0['statusMessage']+')'));return;}var _0x5c1478=fs[_0xccb4('0x19')](_0x4ea029);_0x5c1478['on'](_0xccb4('0x1a'),function(){logger['info'](_0xccb4('0x1b'));_0x5c1478['close'](_0x4516f2);});_0x5c1478['on']('error',function(_0x3c68f3){fs[_0xccb4('0x1c')](_0x4ea029);logger[_0xccb4('0x1d')](_0xccb4('0x1e'),_0x3c68f3);_0x55765a(_0x3c68f3);});_0x1fe0e0[_0xccb4('0x1f')](_0x5c1478);})['on']('error',function(_0x5ab6c8){logger[_0xccb4('0x1d')](_0x5ab6c8);_0x55765a(_0x5ab6c8);})['end']();});}function uploadFile(_0x3408a1){return new BPromise(function(_0x438166,_0x357124){var _0x2e5ae5=urlParse(_0x3408a1);var _0x4454eb=_0x2e5ae5['protocol']===_0xccb4('0x11')?https:http;var _0x510e95={'host':_0x2e5ae5[_0xccb4('0x20')],'path':_0x2e5ae5[_0xccb4('0x12')],'headers':{'user-agent':'WHAT_EVER'}};_0x4454eb['get'](_0x510e95,function(_0x3e1aea){if(_0x3e1aea[_0xccb4('0x15')]!==0xc8){_0x357124(new Error(_0xccb4('0x16')+_0x3408a1+_0xccb4('0x18')+_0x3e1aea[_0xccb4('0x15')]+'\x20('+_0x3e1aea['statusMessage']+')'));return;}var _0x41080d='';_0x3e1aea['on'](_0xccb4('0x21'),function(_0x211250){_0x41080d+=_0x211250;});_0x3e1aea['on']('end',function(){_0x438166(_0x41080d);});})['on']('error',function(_0x29fc40){_0x357124(_0x29fc40);})[_0xccb4('0x22')]();});}function convertFile(_0x25a023,_0x53f164){return new BPromise(function(_0x2324ec,_0x4205f0){var _0x334e4f=sox[_0xccb4('0x23')](_0x25a023,_0x53f164,{'sampleRate':0x1f40,'format':_0xccb4('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x334e4f['on'](_0xccb4('0x1d'),function(_0x2651e5){logger['error'](_0xccb4('0x25'),_0x2651e5);_0x4205f0(_0x2651e5);});_0x334e4f['on'](_0xccb4('0x22'),function(){logger[_0xccb4('0x26')](_0xccb4('0x27'));_0x2324ec();});_0x334e4f[_0xccb4('0x28')]();});}function base64Decode(_0x5ed9c2,_0x3d232e){var _0x331f68=path[_0xccb4('0x29')](__dirname,_0xccb4('0x2a'),rs[_0xccb4('0x2b')](0x4)+_0xccb4('0x2c'));fs[_0xccb4('0x2d')](_0x331f68,_0x5ed9c2,'base64');return convertFile(_0x331f68,_0x3d232e)['then'](function(){try{fs[_0xccb4('0x1c')](_0x331f68);fs[_0xccb4('0x2e')](_0x3d232e,_0xccb4('0x2f'));}catch(_0x2d29f){logger[_0xccb4('0x1d')](_0x2d29f);}return _0x3d232e[_0xccb4('0x30')]('.')[0x0];});}function base64Encode(_0x48e583){var _0x515020=fs['readFileSync'](_0x48e583);return new Buffer(_0x515020)[_0xccb4('0x31')](_0xccb4('0x32'));}exports['googleCloudTTS']=function(_0x1aacd4,_0x4bbbf0,_0x5c668f,_0x3090be,_0xb958ad,_0x4407ee){var _0x3e471c,_0x1b03c5;var _0x335db7=_0xccb4('0x33');var _0x387dc9=_0xccb4('0x34')+_0x1aacd4;var _0x24a265={};if(_0x4bbbf0===_0xccb4('0x35')){_0x24a265[_0xccb4('0x36')]={'ssml':_0x5c668f};}else{_0x24a265[_0xccb4('0x36')]={'text':_0x5c668f};};_0x24a265['voice']={'languageCode':_0x3090be,'ssmlGender':_0xb958ad};_0x24a265[_0xccb4('0x37')]={'audioEncoding':_0xccb4('0x38'),'sampleRateHertz':0x1f40};var _0x2dd1a6={'url':_0x335db7+_0xccb4('0x39')+_0x387dc9,'method':'POST','json':!![],'body':_0x24a265};return rp(_0x2dd1a6)['then'](function(_0x34a1b9){return new BPromise(function(_0x40d71c,_0x2ce089){_0x3e471c=path[_0xccb4('0x29')](__dirname,_0xccb4('0x2a'),rs[_0xccb4('0x2b')](0x4)+'.mp3');var _0x2febf6=Buffer[_0xccb4('0x3a')](_0x34a1b9[_0xccb4('0x3b')],'base64');return fs['writeFile'](_0x3e471c,_0x2febf6,function(_0xf53ff6){_0x2ce089(_0xf53ff6);},function(_0x314d46){fs['chmodSync'](_0x3e471c,_0xccb4('0x2f'));_0x40d71c(_0x314d46);});});})[_0xccb4('0x3c')](function(_0x4c5437){_0x1b03c5=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xccb4('0x2c'));return convertFile(_0x3e471c,_0x1b03c5);})['then'](function(){try{fs[_0xccb4('0x1c')](_0x3e471c);fs['chmodSync'](_0x1b03c5,_0xccb4('0x2f'));}catch(_0x154883){logger['error'](_0x154883);}logger[_0xccb4('0x26')](_0xccb4('0x3d'),_0x1b03c5[_0xccb4('0x30')]('.')[0x0]);return _0x1b03c5['split']('.')[0x0];});};exports['googleTTS']=function(_0x5db1ef,_0x239e72){var _0x3d5daf=_0xccb4('0x3e');var _0x329343,_0x98047d;var _0x225e69;var _0x1ae9c4={'encoding':_0xccb4('0x3f'),'method':_0xccb4('0x40'),'timeout':0x2710,'url':_0x3d5daf,'headers':{'Content-Type':_0xccb4('0x41')},'body':_0xccb4('0x42')+encodeURIComponent(JSON['stringify']([[[_0xccb4('0x43'),JSON[_0xccb4('0x44')]([_0x5db1ef,_0x239e72||'en',![],_0xccb4('0x45')]),null,_0xccb4('0x46')]]]))};return rp(_0x1ae9c4)['then'](function(_0x175521){try{_0x225e69=eval(_0x175521['slice'](0x5))[0x0][0x2];}catch(_0x43247f){throw new Error(_0xccb4('0x47')+_0x175521[_0xccb4('0x21')]);}if(!_0x225e69){if(_0x5db1ef[_0xccb4('0x48')]>0xc8){throw new Error(_0xccb4('0x49'));}else{throw new Error(_0xccb4('0x4a')+_0x239e72+_0xccb4('0x4b'));}}try{_0x225e69=eval(_0x225e69)[0x0];}catch(_0x48d337){throw new Error(_0xccb4('0x47')+res['data']);}const _0x3a4b50=_0x225e69;_0x329343=path[_0xccb4('0x29')](__dirname,_0xccb4('0x2a'),rs['generate'](0x4)+_0xccb4('0x4c'));fs['writeFileSync'](_0x329343,_0x225e69,{'encoding':_0xccb4('0x32')});_0x98047d=path[_0xccb4('0x29')](__dirname,_0xccb4('0x2a'),rs['generate'](0x4)+'.wav');return convertFile(_0x329343,_0x98047d);})['then'](function(){try{fs['unlink'](_0x329343);fs['chmodSync'](_0x98047d,_0xccb4('0x2f'));}catch(_0x4485a2){logger[_0xccb4('0x1d')](_0x4485a2);}logger[_0xccb4('0x26')](_0xccb4('0x4d'),_0x98047d[_0xccb4('0x30')]('.')[0x0]);return _0x98047d[_0xccb4('0x30')]('.')[0x0];});};exports[_0xccb4('0x4e')]=function(_0x49aafb,_0x39bff0,_0x5686cd){return google['asr'](_0x49aafb,_0x39bff0,_0x5686cd)['then'](function(_0x2cf3cd){logger[_0xccb4('0x26')](_0x2cf3cd[_0xccb4('0x4f')]);return rp(_0x2cf3cd);})[_0xccb4('0x3c')](function(_0x2f08e6){var _0x5bd480='';var _0x180075=0x0;try{fs['unlink'](_0x49aafb);}catch(_0x4e8b92){logger[_0xccb4('0x1d')](_0x4e8b92);}if(_0x2f08e6&&_0x2f08e6[_0xccb4('0x50')]){_0x5bd480=_0x2f08e6['results'][_0xccb4('0x51')](function(_0x2f2f26){return _0x2f2f26&&_0x2f2f26[_0xccb4('0x52')][0x0]&&_0x2f2f26[_0xccb4('0x52')][0x0][_0xccb4('0x53')]?_0x2f2f26[_0xccb4('0x52')][0x0][_0xccb4('0x53')]:'';})[_0xccb4('0x54')]('\x0a');_0x180075=_0x2f08e6[_0xccb4('0x50')]['map'](function(_0x1ad6c9){return _0x1ad6c9&&_0x1ad6c9[_0xccb4('0x52')][0x0]&&_0x1ad6c9[_0xccb4('0x52')][0x0][_0xccb4('0x55')]?_0x1ad6c9['alternatives'][0x0][_0xccb4('0x55')]:0x0;})['join']('\x0a');}logger['info'](_0xccb4('0x56'),_0x5bd480);logger['info'](_0xccb4('0x57'),_0x180075);return{'transcript':_0x5bd480,'confidence':_0x180075};})[_0xccb4('0x58')](function(_0x1c8974){logger[_0xccb4('0x1d')](_0xccb4('0x59'),_0x1c8974[_0xccb4('0x15')],_0x1c8974[_0xccb4('0x5a')],_0x1c8974[_0xccb4('0x5b')]);});};exports['googleDialogflow']=function(_0x2205c4,_0x292f1b,_0x262f74,_0x440de4){var _0x204286=apiai(_0x292f1b,{'language':_0x440de4||'en'});return _0x204286[_0xccb4('0x5c')](_0x262f74,{'sessionId':md5(_0x2205c4)})[_0xccb4('0x3c')](function(_0x3c15bd){logger[_0xccb4('0x26')](JSON['stringify'](_0x3c15bd));return{'source':_0x3c15bd[_0xccb4('0x5d')]['source'],'resolvedQuery':_0x3c15bd[_0xccb4('0x5d')][_0xccb4('0x5e')],'action':_0x3c15bd['result'][_0xccb4('0x5f')],'actionIncomplete':_0x3c15bd[_0xccb4('0x5d')][_0xccb4('0x60')],'speech':_0x3c15bd[_0xccb4('0x5d')]['fulfillment']['speech'],'score':_0x3c15bd[_0xccb4('0x5d')][_0xccb4('0x61')],'statusCode':_0x3c15bd[_0xccb4('0x62')][_0xccb4('0x63')],'endConversation':_0x3c15bd[_0xccb4('0x5d')][_0xccb4('0x64')]['endConversation']||![],'isFallbackIntent':_0x3c15bd['result'][_0xccb4('0x64')]['isFallbackIntent']};});};exports[_0xccb4('0x65')]=function(_0x2ea909,_0x1d063f,_0x148436,_0x4d4a3b,_0x57f647,_0x5e53a9){var _0x2ad3d3=_0x4d4a3b[_0xccb4('0x66')](/\\n/g,'\x0a');var _0x27bd3e={'credentials':{'private_key':_0x2ad3d3,'client_email':_0x148436}};var _0xa5ac6a=new dialogflow['SessionsClient'](_0x27bd3e);var _0x1f58d8=_0xa5ac6a[_0xccb4('0x67')](_0x1d063f,md5(_0x2ea909));var _0x1d5e14={'session':_0x1f58d8,'queryInput':{'text':{'text':_0x57f647,'languageCode':_0x5e53a9}}};return _0xa5ac6a[_0xccb4('0x68')](_0x1d5e14)['then'](function(_0x5ce897){if(_0x5ce897&&_0x5ce897[_0xccb4('0x48')]){logger[_0xccb4('0x26')](_0xccb4('0x69'),JSON[_0xccb4('0x44')](_0x5ce897));var _0x331c39=_0x5ce897[0x0];if(_0x331c39){var _0x1c2ce7={'action':_0x331c39[_0xccb4('0x6a')][_0xccb4('0x5f')],'allRequiredParamsPresent':_0x331c39[_0xccb4('0x6a')]['allRequiredParamsPresent'],'endConversation':_0x331c39[_0xccb4('0x6a')][_0xccb4('0x6b')]&&_0x331c39[_0xccb4('0x6a')][_0xccb4('0x6b')][_0xccb4('0x6c')]?_0x331c39['queryResult'][_0xccb4('0x6b')][_0xccb4('0x6c')][_0xccb4('0x6d')][_0xccb4('0x6e')]:![],'fulfillmentText':_0x331c39[_0xccb4('0x6a')][_0xccb4('0x6f')],'intentName':_0x331c39[_0xccb4('0x6a')][_0xccb4('0x70')][_0xccb4('0x5a')],'intentDisplayName':_0x331c39[_0xccb4('0x6a')][_0xccb4('0x70')][_0xccb4('0x71')],'isFallbackIntent':_0x331c39[_0xccb4('0x6a')][_0xccb4('0x70')]['isFallback'],'languageCode':_0x331c39[_0xccb4('0x6a')]['languageCode'],'queryText':_0x331c39[_0xccb4('0x6a')][_0xccb4('0x72')],'responseId':_0x331c39['responseId'],'score':_0x331c39[_0xccb4('0x6a')][_0xccb4('0x73')],'speech':_0x331c39['queryResult'][_0xccb4('0x6f')],'providerResponse':JSON[_0xccb4('0x44')](_0x5ce897)};return _0x1c2ce7;}}});};exports[_0xccb4('0x74')]=function(_0x1a9e83,_0x426f01,_0x58fb65,_0x9660a1){return tilde[_0xccb4('0x75')](_0x1a9e83,_0x426f01,_0x58fb65,_0x9660a1)[_0xccb4('0x3c')](function(_0x180f69){try{fs['unlink'](_0x1a9e83);}catch(_0x30319c){logger[_0xccb4('0x1d')](_0x30319c);}logger[_0xccb4('0x26')](_0xccb4('0x76'),_0x180f69['transcript']);logger[_0xccb4('0x26')](_0xccb4('0x77'),_0x180f69['confidence']);return _0x180f69;});};exports[_0xccb4('0x78')]=function(_0x38cf10,_0x24fa08,_0x45fbd1,_0x40c870,_0x214a36,_0x462f75){var _0x5904f3=path[_0xccb4('0x29')](__dirname,_0xccb4('0x2a'),rs[_0xccb4('0x2b')](0x4)+'.mp3');var _0xe6995d;return aws['polly'](_0x38cf10,_0x24fa08,_0x45fbd1,_0x40c870,_0x214a36,_0x462f75,_0x5904f3)['then'](function(){_0xe6995d=path[_0xccb4('0x29')](__dirname,'tmp',rs[_0xccb4('0x2b')](0x4)+'.wav');return convertFile(_0x5904f3,_0xe6995d);})['then'](function(){try{fs['unlink'](_0x5904f3);fs[_0xccb4('0x2e')](_0xe6995d,_0xccb4('0x2f'));}catch(_0x20ba9d){logger[_0xccb4('0x1d')](_0x20ba9d);}return _0xe6995d[_0xccb4('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x4861e8,_0x383308,_0x224c87,_0x143341,_0x1dfe05,_0x5b03ad){return aws[_0xccb4('0x79')](_0x4861e8,_0x383308,_0x224c87,_0x143341,_0x1dfe05,_0x5b03ad)[_0xccb4('0x3c')](function(_0x5bf9fe){logger[_0xccb4('0x26')](JSON[_0xccb4('0x44')](_0x5bf9fe));return _0x5bf9fe;});};exports[_0xccb4('0x7a')]=function(_0x47650b,_0xf6b323,_0x5ccf85,_0x11bc54){var _0x1ed86a=util[_0xccb4('0x7b')](_0xccb4('0x7c'),ISPEECH_API,_0x47650b,encodeURIComponent(_0xf6b323),_0x5ccf85,_0x11bc54);var _0x52f1cb=path[_0xccb4('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0xccb4('0x4c'));var _0xf89c89;return downloadFile(_0x1ed86a,_0x52f1cb)[_0xccb4('0x3c')](function(){_0xf89c89=path[_0xccb4('0x29')](__dirname,_0xccb4('0x2a'),rs['generate'](0x4)+_0xccb4('0x2c'));return convertFile(_0x52f1cb,_0xf89c89);})['then'](function(){try{fs[_0xccb4('0x1c')](_0x52f1cb);fs['chmodSync'](_0xf89c89,_0xccb4('0x2f'));}catch(_0x22f267){logger[_0xccb4('0x1d')](_0x22f267);}return _0xf89c89[_0xccb4('0x30')]('.')[0x0];});};exports[_0xccb4('0x7d')]=function(_0x1cdb42,_0x3723cb,_0x585b97,_0xed63df){var _0x378714=util[_0xccb4('0x7b')](_0xccb4('0x7e'),ISPEECH_API,_0x3723cb,_0x585b97,base64Encode(_0x1cdb42),_0xed63df?util[_0xccb4('0x7b')](_0xccb4('0x7f'),encodeURIComponent(_0xed63df)):_0xccb4('0x80'));return uploadFile(_0x378714)[_0xccb4('0x3c')](function(_0x3137c6){return querystring['parse'](_0x3137c6);});};exports[_0xccb4('0x81')]=function(_0xdc0f0a,_0x5f08fa){return sestek[_0xccb4('0x82')](_0xdc0f0a,_0x5f08fa)[_0xccb4('0x3c')](function(_0x55089c){logger[_0xccb4('0x26')](JSON[_0xccb4('0x44')](_0x55089c));var _0x24b354={'speech':_0x55089c[_0xccb4('0x83')],'action':_0x55089c[_0xccb4('0x84')]?_0x55089c['channelData'][_0xccb4('0x85')]:undefined,'actiondata':_0x55089c[_0xccb4('0x84')]?_0x55089c[_0xccb4('0x84')]['CustomActionData']:undefined};if(_0x55089c['channelData']&&_0x55089c[_0xccb4('0x84')][_0xccb4('0x86')]){return base64Decode(_0x55089c[_0xccb4('0x84')]['AudioFromTts'][_0xccb4('0x87')],path[_0xccb4('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0xccb4('0x2c')))[_0xccb4('0x3c')](function(_0x6d9241){_0x24b354[_0xccb4('0x88')]=_0x6d9241;return _0x24b354;});}return _0x24b354;});};exports[_0xccb4('0x89')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 7970aab..537a0f5 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 _0x6b76=['./nda'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6b76,0x146));var _0x66b7=function(_0x6520ad,_0x39a470){_0x6520ad=_0x6520ad-0x0;var _0x35d9f1=_0x6b76[_0x6520ad];return _0x35d9f1;};var nda=require(_0x66b7('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xe80c=['exports'];(function(_0x16952e,_0x3fcc68){var _0x9d6f8b=function(_0x39e877){while(--_0x39e877){_0x16952e['push'](_0x16952e['shift']());}};_0x9d6f8b(++_0x3fcc68);}(_0xe80c,0xd7));var _0xce80=function(_0x12c24c,_0x1c615e){_0x12c24c=_0x12c24c-0x0;var _0x32e988=_0xe80c[_0x12c24c];return _0x32e988;};var nda=require('./nda');module[_0xce80('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 0bd8c79..84988c1 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 _0xc7a7=['custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings'];(function(_0x6d8765,_0x18f49a){var _0x385d34=function(_0x22ece8){while(--_0x22ece8){_0x6d8765['push'](_0x6d8765['shift']());}};_0x385d34(++_0x18f49a);}(_0xc7a7,0x171));var _0x7c7a=function(_0x495e46,_0x4bc819){_0x495e46=_0x495e46-0x0;var _0xab9d43=_0xc7a7[_0x495e46];return _0xab9d43;};'use strict';var rp=require(_0x7c7a('0x0'));var url=require(_0x7c7a('0x1'));var logger=require(_0x7c7a('0x2'))('agi');module[_0x7c7a('0x3')]=function(_0x243925,_0x5c030a){var _0x2614cf={'method':_0x7c7a('0x4'),'uri':url[_0x7c7a('0x5')](_0x5c030a[_0x7c7a('0x6')],_0x7c7a('0x7')),'form':{'grant_type':_0x7c7a('0x8'),'username':_0x5c030a[_0x7c7a('0x9')],'password':_0x5c030a[_0x7c7a('0x8')]},'json':!![]};return rp(_0x2614cf)['then'](function(_0x361567){var _0x43e2af={'method':_0x7c7a('0x4'),'uri':url['resolve'](_0x5c030a[_0x7c7a('0xa')],_0x7c7a('0xb')),'body':{'type':_0x5c030a[_0x7c7a('0xc')]||_0x7c7a('0xd'),'channelId':_0x7c7a('0xe'),'conversation':{'id':_0x243925[_0x7c7a('0xf')]},'from':{'id':_0x243925[_0x7c7a('0x10')],'name':_0x243925[_0x7c7a('0x11')]},'recipient':{'id':_0x243925['dnid'],'name':_0x243925[_0x7c7a('0x12')]},'text':_0x5c030a[_0x7c7a('0x13')],'channelData':{}},'headers':{'Authorization':_0x7c7a('0x14')+_0x361567[_0x7c7a('0x15')]},'json':!![]};if(_0x5c030a[_0x7c7a('0x16')]){_0x43e2af[_0x7c7a('0x17')][_0x7c7a('0x18')]['ProjectName']=_0x5c030a[_0x7c7a('0x16')];}if(_0x5c030a[_0x7c7a('0x19')]=='1'){_0x43e2af[_0x7c7a('0x17')][_0x7c7a('0x18')][_0x7c7a('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5c030a[_0x7c7a('0x1b')]){_0x43e2af['body'][_0x7c7a('0x18')][_0x7c7a('0x1c')]=_0x5c030a[_0x7c7a('0x1b')];if(_0x5c030a[_0x7c7a('0x1d')]){_0x43e2af[_0x7c7a('0x17')][_0x7c7a('0x18')][_0x7c7a('0x1e')]=_0x5c030a[_0x7c7a('0x1d')];}}logger[_0x7c7a('0x1f')](JSON[_0x7c7a('0x20')](_0x43e2af));return rp(_0x43e2af);});}; \ No newline at end of file +var _0xcd31=['dnid','extension','text','Bearer\x20','project','channelData','ProjectName','AudioOutputSettings','audio/wav','body','CustomAction','custom_action','stringify','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid'];(function(_0x2bca15,_0x23fc22){var _0xed9bda=function(_0xf65cc6){while(--_0xf65cc6){_0x2bca15['push'](_0x2bca15['shift']());}};_0xed9bda(++_0x23fc22);}(_0xcd31,0x15d));var _0x1cd3=function(_0x1c9d5f,_0x5ee458){_0x1c9d5f=_0x1c9d5f-0x0;var _0x2bf1ff=_0xcd31[_0x1c9d5f];return _0x2bf1ff;};'use strict';var rp=require('request-promise');var url=require(_0x1cd3('0x0'));var logger=require(_0x1cd3('0x1'))(_0x1cd3('0x2'));module['exports']=function(_0x3da1e3,_0x19dd0c){var _0x2526ea={'method':_0x1cd3('0x3'),'uri':url[_0x1cd3('0x4')](_0x19dd0c[_0x1cd3('0x5')],'/token'),'form':{'grant_type':_0x1cd3('0x6'),'username':_0x19dd0c[_0x1cd3('0x7')],'password':_0x19dd0c[_0x1cd3('0x6')]},'json':!![]};return rp(_0x2526ea)['then'](function(_0x45cc24){var _0x11b139={'method':_0x1cd3('0x3'),'uri':url['resolve'](_0x19dd0c[_0x1cd3('0x8')],_0x1cd3('0x9')),'body':{'type':_0x19dd0c[_0x1cd3('0xa')]||_0x1cd3('0xb'),'channelId':_0x1cd3('0xc'),'conversation':{'id':_0x3da1e3[_0x1cd3('0xd')]},'from':{'id':_0x3da1e3[_0x1cd3('0xe')],'name':_0x3da1e3['calleridname']},'recipient':{'id':_0x3da1e3[_0x1cd3('0xf')],'name':_0x3da1e3[_0x1cd3('0x10')]},'text':_0x19dd0c[_0x1cd3('0x11')],'channelData':{}},'headers':{'Authorization':_0x1cd3('0x12')+_0x45cc24['access_token']},'json':!![]};if(_0x19dd0c[_0x1cd3('0x13')]){_0x11b139['body'][_0x1cd3('0x14')][_0x1cd3('0x15')]=_0x19dd0c[_0x1cd3('0x13')];}if(_0x19dd0c['ndagenerate_audio']=='1'){_0x11b139['body'][_0x1cd3('0x14')][_0x1cd3('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1cd3('0x17')};}if(_0x19dd0c['custom_action']){_0x11b139[_0x1cd3('0x18')][_0x1cd3('0x14')][_0x1cd3('0x19')]=_0x19dd0c[_0x1cd3('0x1a')];if(_0x19dd0c['custom_action_data']){_0x11b139['body']['channelData']['CustomActionData']=_0x19dd0c['custom_action_data'];}}logger['info'](JSON[_0x1cd3('0x1b')](_0x11b139));return rp(_0x11b139);});}; \ 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 c49ec18..3ae1c3b 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x151c30,_0x16f9bb,_0x4d6b8a,_0x456b66){return asr(_0x151c30,_0x16f9bb,_0x4d6b8a,_0x456b66);}; \ No newline at end of file +var _0xfc19=['exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xfc19,0xbc));var _0x9fc1=function(_0x28a0fe,_0x193dad){_0x28a0fe=_0x28a0fe-0x0;var _0x403025=_0xfc19[_0x28a0fe];return _0x403025;};'use strict';var asr=require('./lib/api');module[_0x9fc1('0x0')]=function(_0x424308,_0x3ec16e,_0x5b58fc,_0x9b1654){return asr(_0x424308,_0x3ec16e,_0x5b58fc,_0x9b1654);}; \ 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 2e30166..09936b0 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 _0x5d7e=['createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','moment','../../../../../../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','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send'];(function(_0x3f5584,_0x3edcf1){var _0x179661=function(_0x2d29e7){while(--_0x2d29e7){_0x3f5584['push'](_0x3f5584['shift']());}};_0x179661(++_0x3edcf1);}(_0x5d7e,0x13f));var _0xe5d7=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x5d7e[_0x2e3107];return _0x833d69;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe5d7('0x0'));var crypto=require('crypto');var logger=require(_0xe5d7('0x1'))('agi');module[_0xe5d7('0x2')]=function(_0x3c272d,_0xbdff7a,_0x1a157d,_0x2c5ad8){return new BPromise(function(_0x4a7439,_0x446218){logger[_0xe5d7('0x3')]('Tilde\x20URI',_0x2c5ad8||_0xe5d7('0x4'));var _0x4cd1a6=new WebSocket(_0x2c5ad8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5cfc7f='';var _0x4b84a9='0';var _0x1c899d='1';var _0x4c875a=_0xe5d7('0x5');function _0x2fdef0(_0x50442d){var _0x31631b=crypto['createHash']('sha1');_0x31631b[_0xe5d7('0x6')](_0x50442d);return _0x31631b['digest'](_0xe5d7('0x7'));}function _0x323bfd(){try{logger[_0xe5d7('0x3')](_0xe5d7('0x8'));var _0x4711ee=moment()[_0xe5d7('0x9')]();var _0x2ef7e8=_0x2fdef0(_0x4711ee+_0xbdff7a+_0x1a157d);_0x4cd1a6[_0xe5d7('0xa')](JSON['stringify']({'appID':_0xbdff7a,'timestamp':_0x4711ee,'appKey':_0x2ef7e8}));var _0x39d00e=fs[_0xe5d7('0xb')](_0x3c272d);_0x39d00e['on']('data',function(_0x3c15c4){_0x4cd1a6[_0xe5d7('0xa')](_0x3c15c4);});_0x39d00e['on'](_0xe5d7('0xc'),function(){_0x4cd1a6[_0xe5d7('0xa')](_0xe5d7('0xd'));});}catch(_0x136d7d){logger[_0xe5d7('0xe')](_0xe5d7('0xf'),JSON[_0xe5d7('0x10')](_0x136d7d));_0x4cd1a6[_0xe5d7('0x11')]();}}function _0x11f6d3(_0x3cd0a2){try{if(_0x3cd0a2){var _0x63112c=JSON['parse'](_0x3cd0a2);switch(_0x63112c[_0xe5d7('0x12')]){case 0x0:if(_0x63112c[_0xe5d7('0x13')]){if(_0x63112c[_0xe5d7('0x13')][_0xe5d7('0x14')]){logger[_0xe5d7('0x3')]('Tilde\x20ASR\x20hypoteses',JSON[_0xe5d7('0x10')](_0x63112c[_0xe5d7('0x13')][_0xe5d7('0x15')]));_0x5cfc7f=_0x63112c[_0xe5d7('0x13')][_0xe5d7('0x15')][0x0][_0xe5d7('0x16')];_0x4b84a9=_0x63112c[_0xe5d7('0x13')][_0xe5d7('0x15')][0x0][_0xe5d7('0x17')];_0x1c899d='0';_0x4c875a=_0xe5d7('0x18');_0x4cd1a6[_0xe5d7('0x11')]();}}break;case 0x1:logger[_0xe5d7('0x3')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1c899d='1';_0x4c875a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xe5d7('0x3')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1c899d='2';_0x4c875a=_0xe5d7('0x19');break;case 0x9:logger[_0xe5d7('0x3')](_0xe5d7('0x1a'));_0x1c899d='9';_0x4c875a=_0xe5d7('0x1a');break;case 0xa:logger[_0xe5d7('0x3')]('Authentication\x20failed.');_0x1c899d='10';_0x4c875a='Authentication\x20failed.';break;case 0xb:logger['info'](_0xe5d7('0x1b'));_0x1c899d='11';_0x4c875a=_0xe5d7('0x1b');}}}catch(_0x4f685e){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x4f685e));_0x4cd1a6['terminate']();}}function _0x945fdc(){logger['info'](_0xe5d7('0x1c'));_0x4a7439({'transcript':_0x5cfc7f,'confidence':_0x4b84a9,'status':_0x1c899d,'status_message':_0x4c875a});}function _0xe9c8f9(_0x71114a){logger['error'](_0xe5d7('0x1d'));if(!_[_0xe5d7('0x1e')](_0x71114a)){logger['error'](_['isObject'](_0x71114a)?JSON[_0xe5d7('0x10')](_0x71114a):_0x71114a);}}_0x4cd1a6['on'](_0xe5d7('0x1f'),_0x323bfd);_0x4cd1a6['on'](_0xe5d7('0x20'),_0x11f6d3);_0x4cd1a6['on']('close',_0x945fdc);_0x4cd1a6['on'](_0xe5d7('0xe'),_0xe9c8f9);});}; \ No newline at end of file +var _0x87d9=['result','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','update','digest','hex','unix','send','data','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x87d9,0x127));var _0x987d=function(_0x548eae,_0xad69de){_0x548eae=_0x548eae-0x0;var _0x5b1a01=_0x87d9[_0x548eae];return _0x5b1a01;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x987d('0x0'));var crypto=require(_0x987d('0x1'));var logger=require(_0x987d('0x2'))(_0x987d('0x3'));module[_0x987d('0x4')]=function(_0x4eeda4,_0x3e4f55,_0x4ce97c,_0x433a55){return new BPromise(function(_0x2970f4,_0x14297e){logger[_0x987d('0x5')](_0x987d('0x6'),_0x433a55||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x5ac197=new WebSocket(_0x433a55||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x597657='';var _0x20dc8c='0';var _0x4ae0bd='1';var _0x22b7d6='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x4b48e0(_0x304a41){var _0xaca8e9=crypto['createHash']('sha1');_0xaca8e9[_0x987d('0x7')](_0x304a41);return _0xaca8e9[_0x987d('0x8')](_0x987d('0x9'));}function _0x448280(){try{logger[_0x987d('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x5b1c07=moment()[_0x987d('0xa')]();var _0x2a2003=_0x4b48e0(_0x5b1c07+_0x3e4f55+_0x4ce97c);_0x5ac197[_0x987d('0xb')](JSON['stringify']({'appID':_0x3e4f55,'timestamp':_0x5b1c07,'appKey':_0x2a2003}));var _0x4586cd=fs['createReadStream'](_0x4eeda4);_0x4586cd['on'](_0x987d('0xc'),function(_0x2a175a){_0x5ac197[_0x987d('0xb')](_0x2a175a);});_0x4586cd['on']('close',function(){_0x5ac197[_0x987d('0xb')](_0x987d('0xd'));});}catch(_0xa89e4){logger[_0x987d('0xe')](_0x987d('0xf'),JSON[_0x987d('0x10')](_0xa89e4));_0x5ac197[_0x987d('0x11')]();}}function _0x536161(_0x1e1ad6){try{if(_0x1e1ad6){var _0x5e0a6e=JSON[_0x987d('0x12')](_0x1e1ad6);switch(_0x5e0a6e[_0x987d('0x13')]){case 0x0:if(_0x5e0a6e[_0x987d('0x14')]){if(_0x5e0a6e[_0x987d('0x14')]['final']){logger[_0x987d('0x5')](_0x987d('0x15'),JSON[_0x987d('0x10')](_0x5e0a6e[_0x987d('0x14')]['hypotheses']));_0x597657=_0x5e0a6e['result'][_0x987d('0x16')][0x0]['transcript'];_0x20dc8c=_0x5e0a6e['result'][_0x987d('0x16')][0x0]['likelihood'];_0x4ae0bd='0';_0x22b7d6=_0x987d('0x17');_0x5ac197['terminate']();}}break;case 0x1:logger[_0x987d('0x5')](_0x987d('0x18'));_0x4ae0bd='1';_0x22b7d6=_0x987d('0x18');break;case 0x2:logger[_0x987d('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4ae0bd='2';_0x22b7d6='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x987d('0x5')](_0x987d('0x19'));_0x4ae0bd='9';_0x22b7d6=_0x987d('0x19');break;case 0xa:logger['info']('Authentication\x20failed.');_0x4ae0bd='10';_0x22b7d6=_0x987d('0x1a');break;case 0xb:logger['info'](_0x987d('0x1b'));_0x4ae0bd='11';_0x22b7d6=_0x987d('0x1b');}}}catch(_0x239abc){logger[_0x987d('0xe')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x239abc));_0x5ac197['terminate']();}}function _0x4c7fa5(){logger[_0x987d('0x5')](_0x987d('0x1c'));_0x2970f4({'transcript':_0x597657,'confidence':_0x20dc8c,'status':_0x4ae0bd,'status_message':_0x22b7d6});}function _0x54fff2(_0x2f8010){logger[_0x987d('0xe')](_0x987d('0x1d'));if(!_[_0x987d('0x1e')](_0x2f8010)){logger[_0x987d('0xe')](_[_0x987d('0x1f')](_0x2f8010)?JSON[_0x987d('0x10')](_0x2f8010):_0x2f8010);}}_0x5ac197['on'](_0x987d('0x20'),_0x448280);_0x5ac197['on'](_0x987d('0x21'),_0x536161);_0x5ac197['on'](_0x987d('0x22'),_0x4c7fa5);_0x5ac197['on'](_0x987d('0xe'),_0x54fff2);});}; \ 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 995d373..0f38603 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 _0xc693=['./asr','exports'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0xc693,0x186));var _0x3c69=function(_0x377c42,_0x3aa8a4){_0x377c42=_0x377c42-0x0;var _0x3fa1f8=_0xc693[_0x377c42];return _0x3fa1f8;};var asr=require(_0x3c69('0x0'));module[_0x3c69('0x1')]={'asr':asr}; \ No newline at end of file +var _0xaf12=['./asr','exports'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xaf12,0xe4));var _0x2af1=function(_0x48c601,_0x448535){_0x48c601=_0x48c601-0x0;var _0x41423e=_0xaf12[_0x48c601];return _0x41423e;};var asr=require(_0x2af1('0x0'));module[_0x2af1('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e03b775..37f711c 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e05=['./error','./channel','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','error','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events'];(function(_0x490dbd,_0x5e4c05){var _0x23a4b9=function(_0x371127){while(--_0x371127){_0x490dbd['push'](_0x490dbd['shift']());}};_0x23a4b9(++_0x5e4c05);}(_0x5e05,0x132));var _0x55e0=function(_0x331ac5,_0x33b3b0){_0x331ac5=_0x331ac5-0x0;var _0x229961=_0x5e05[_0x331ac5];return _0x229961;};'use strict';var util=require('util');var net=require(_0x55e0('0x0'));var EventEmitter=require(_0x55e0('0x1'))['EventEmitter'];var AGIError=require(_0x55e0('0x2'));var AGIChannel=require(_0x55e0('0x3'));var AGIServer=function(_0x4c5a65,_0x2b1493,_0x7cb21a){var _0x415bc5=this,_0x4c5a65=_0x4c5a65||0x11dd,_0x2b1493=_0x2b1493||'127.0.0.1',_0x496a50=null,_0x32d216=0x0;EventEmitter['call'](_0x415bc5);function _0x2d6ebf(){if(!_0x4c5a65){_0x415bc5[_0x55e0('0x4')]('error',new AGIError(_0x55e0('0x5')));return![];}_0x496a50=net[_0x55e0('0x6')]();_0x496a50[_0x55e0('0x7')](_0x4c5a65,_0x2b1493);_0x496a50['on'](_0x55e0('0x8'),function(){_0x415bc5['emit'](_0x55e0('0x8'));});_0x496a50['on'](_0x55e0('0x9'),function(_0x20efcb){_0x496a50[_0x55e0('0xa')](function(_0x4b2947,_0x5da8a3){if(_0x4b2947){_0x415bc5[_0x55e0('0x4')](_0x55e0('0xb'),new AGIError(_0x55e0('0xc'),_0x4b2947));}else if(_0x7cb21a&&_0x7cb21a<0x0){_0x415bc5[_0x55e0('0x4')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x20efcb[_0x55e0('0xd')]();}else if(_0x7cb21a&&_0x7cb21a>0x0&&_0x7cb21a<_0x5da8a3){_0x32d216+=0x1;_0x415bc5[_0x55e0('0x4')](_0x55e0('0xb'),new AGIError(_0x55e0('0xe'),_0x32d216));_0x20efcb[_0x55e0('0xd')]();}else{var _0x24bd8f=new AGIChannel(_0x20efcb);_0x24bd8f['on'](_0x55e0('0xf'),function(){_0x415bc5['emit']('connection',_0x24bd8f);});}});});_0x496a50['on'](_0x55e0('0xb'),function(_0x7cd5d4){_0x415bc5['emit'](_0x55e0('0xb'),new AGIError(_0x55e0('0xc'),_0x7cd5d4[_0x55e0('0x10')]));});_0x496a50['on'](_0x55e0('0x11'),function(){_0x415bc5['emit'](_0x55e0('0x11'),new AGIError(_0x55e0('0x12')));});}process[_0x55e0('0x13')](function(){_0x2d6ebf();});};util[_0x55e0('0x14')](AGIServer,EventEmitter);module[_0x55e0('0x15')]=function(_0x54cdad,_0x518f26,_0x3ca67b){return new AGIServer(_0x54cdad,_0x518f26,_0x3ca67b);}; \ No newline at end of file +var _0x3121=['E_AGI_SERVER_MAXCONNECTION','destroy','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','EventEmitter','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x2f2a56,_0x1a650a){var _0x5409e5=function(_0x506a51){while(--_0x506a51){_0x2f2a56['push'](_0x2f2a56['shift']());}};_0x5409e5(++_0x1a650a);}(_0x3121,0xd2));var _0x1312=function(_0x318df3,_0x120952){_0x318df3=_0x318df3-0x0;var _0x2f3bb1=_0x3121[_0x318df3];return _0x2f3bb1;};'use strict';var util=require(_0x1312('0x0'));var net=require(_0x1312('0x1'));var EventEmitter=require('events')[_0x1312('0x2')];var AGIError=require(_0x1312('0x3'));var AGIChannel=require(_0x1312('0x4'));var AGIServer=function(_0x10dfd9,_0x18d0d1,_0x23b6f9){var _0x2a5499=this,_0x10dfd9=_0x10dfd9||0x11dd,_0x18d0d1=_0x18d0d1||_0x1312('0x5'),_0x5799d7=null,_0xef9385=0x0;EventEmitter[_0x1312('0x6')](_0x2a5499);function _0xf3519d(){if(!_0x10dfd9){_0x2a5499['emit'](_0x1312('0x7'),new AGIError(_0x1312('0x8')));return![];}_0x5799d7=net['createServer']();_0x5799d7[_0x1312('0x9')](_0x10dfd9,_0x18d0d1);_0x5799d7['on'](_0x1312('0xa'),function(){_0x2a5499[_0x1312('0xb')](_0x1312('0xa'));});_0x5799d7['on'](_0x1312('0xc'),function(_0x25d4b0){_0x5799d7[_0x1312('0xd')](function(_0x448e8c,_0x25b585){if(_0x448e8c){_0x2a5499[_0x1312('0xb')](_0x1312('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x448e8c));}else if(_0x23b6f9&&_0x23b6f9<0x0){_0x2a5499[_0x1312('0xb')](_0x1312('0x7'),new AGIError(_0x1312('0xe')));_0x25d4b0['destroy']();}else if(_0x23b6f9&&_0x23b6f9>0x0&&_0x23b6f9<_0x25b585){_0xef9385+=0x1;_0x2a5499[_0x1312('0xb')](_0x1312('0x7'),new AGIError(_0x1312('0xf'),_0xef9385));_0x25d4b0[_0x1312('0x10')]();}else{var _0x2dfe08=new AGIChannel(_0x25d4b0);_0x2dfe08['on'](_0x1312('0x11'),function(){_0x2a5499[_0x1312('0xb')](_0x1312('0xc'),_0x2dfe08);});}});});_0x5799d7['on'](_0x1312('0x7'),function(_0x575595){_0x2a5499[_0x1312('0xb')](_0x1312('0x7'),new AGIError(_0x1312('0x12'),_0x575595[_0x1312('0x13')]));});_0x5799d7['on'](_0x1312('0x14'),function(){_0x2a5499[_0x1312('0xb')](_0x1312('0x14'),new AGIError(_0x1312('0x15')));});}process[_0x1312('0x16')](function(){_0xf3519d();});};util[_0x1312('0x17')](AGIServer,EventEmitter);module[_0x1312('0x18')]=function(_0x364103,_0x37ebbd,_0x42cb4f){return new AGIServer(_0x364103,_0x37ebbd,_0x42cb4f);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 1587cb2..50dbf49 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 _0x9efc=['error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','body','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','client_email','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','stringify','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','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','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','awsLex','AWS_LEX_%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','%s/recordings/%s','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','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20operation\x20configured','operation','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','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','util','lodash','shelljs','odbc','randomstring','request-promise','agi','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','map','Intervals','interval','%s/sounds/converted/%s','getQueryOdbc','open'];(function(_0x2c59f1,_0x1c7052){var _0x4b1e8c=function(_0xccda50){while(--_0xccda50){_0x2c59f1['push'](_0x2c59f1['shift']());}};_0x4b1e8c(++_0x1c7052);}(_0x9efc,0x19c));var _0xc9ef=function(_0x2053aa,_0x3df40e){_0x2053aa=_0x2053aa-0x0;var _0x30f5bb=_0x9efc[_0x2053aa];return _0x30f5bb;};'use strict';var fs=require('fs');var util=require(_0xc9ef('0x0'));var _=require(_0xc9ef('0x1'));var sh=require(_0xc9ef('0x2'));var odbc=require(_0xc9ef('0x3'))();var rs=require(_0xc9ef('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0xc9ef('0x5'));var logger=require('../../config/logger')(_0xc9ef('0x6'));var config=require('../../config/environment');var shared=require(_0xc9ef('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xc9ef('0x8');var recursiveMapAttributes=[_0xc9ef('0x9'),_0xc9ef('0xa')];var verticesWithRetry=[_0xc9ef('0xb'),_0xc9ef('0xc'),_0xc9ef('0xd')];var AGIVertices=function(_0x2795e4,_0xf37f26,_0x418b6b){this[_0xc9ef('0xe')]=_0x2795e4;this[_0xc9ef('0xf')]=_0xf37f26;this['mailRpc']=_0x418b6b;};AGIVertices['prototype'][_0xc9ef('0x10')]=function(_0x502913,_0xe8aa1f){this['rpc'][_0xc9ef('0x11')](_0x502913)['then'](function(_0x56c2c0){_0xe8aa1f(null,_0x56c2c0?_0x56c2c0[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x2ce47b){_0xe8aa1f(_0x2ce47b);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x15')]=function(_0x233017,_0x17eed6){this[_0xc9ef('0xf')][_0xc9ef('0x16')](_0x233017)[_0xc9ef('0x17')](function(_0x624d74){_0x17eed6(null,_0x624d74?_0x624d74['name']:![]);})[_0xc9ef('0x13')](function(_0x181c2b){_0x17eed6(_0x181c2b);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x18')]=function(_0xaea0df,_0x54e2c3){this[_0xc9ef('0xf')][_0xc9ef('0x19')](_0xaea0df)[_0xc9ef('0x17')](function(_0x122fb8){_0x54e2c3(null,_0x122fb8?_0x122fb8[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x1a2519){_0x54e2c3(_0x1a2519);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1a')]=function(_0xcc0fd8,_0x2fc01a){this[_0xc9ef('0xf')][_0xc9ef('0x1b')](_0xcc0fd8)[_0xc9ef('0x17')](function(_0x572f83){_0x2fc01a(null,_0x572f83?_0x572f83[_0xc9ef('0x1c')]:![]);})[_0xc9ef('0x13')](function(_0x32999b){_0x2fc01a(_0x32999b);});};AGIVertices['prototype'][_0xc9ef('0x1d')]=function(_0x23a402,_0x1ffff8){this[_0xc9ef('0xf')]['getUserById'](_0x23a402)[_0xc9ef('0x17')](function(_0x27df1f){_0x1ffff8(null,_0x27df1f?_0x27df1f['name']:![]);})[_0xc9ef('0x13')](function(_0xcd720a){_0x1ffff8(_0xcd720a);});};AGIVertices['prototype'][_0xc9ef('0x1e')]=function(_0x394a40,_0x3e336a){this[_0xc9ef('0xf')]['getTrunkById'](_0x394a40)[_0xc9ef('0x17')](function(_0x3b425f){_0x3e336a(null,_0x3b425f?_0x3b425f[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x53bf57){_0x3e336a(_0x53bf57);});};AGIVertices['prototype'][_0xc9ef('0x1f')]=function(_0x40c51b,_0x6dc9ee){var _0x53e1fe=this;this[_0xc9ef('0xf')][_0xc9ef('0x20')](_0x40c51b)[_0xc9ef('0x17')](function(_0x4042fc){_0x6dc9ee(null,_0x4042fc?_0x53e1fe[_0xc9ef('0x21')](_0x4042fc['save_name']):![]);})['catch'](function(_0x458546){_0x6dc9ee(_0x458546);});};AGIVertices[_0xc9ef('0x14')]['getMailAccount']=function(_0x5987c1,_0x123005){this['rpc'][_0xc9ef('0x22')](_0x5987c1)['then'](function(_0x2bf9be){_0x123005(null,_0x2bf9be?_0x2bf9be:![]);})[_0xc9ef('0x13')](function(_0x178a50){_0x123005(_0x178a50);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x23')]=function(_0x148190,_0x5210ac,_0x2f957b){this[_0xc9ef('0x24')]['sendMailMessage'](_0x148190,_0x5210ac)[_0xc9ef('0x17')](function(){_0x2f957b(null);})[_0xc9ef('0x13')](function(_0xe040e){_0x2f957b(_0xe040e);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x25')]=function(_0x56f2e0,_0x239c18){this[_0xc9ef('0xf')][_0xc9ef('0x26')](_0x56f2e0)[_0xc9ef('0x17')](function(_0x1abd64){if(_0x1abd64){if(_0x1abd64['IntervalId']){_0x239c18(null,[_0x1abd64['interval']]);}else{_0x239c18(null,_[_0xc9ef('0x27')](_0x1abd64[_0xc9ef('0x28')],_0xc9ef('0x29')));}}else{_0x239c18(null,![]);}})['catch'](function(_0x5f2393){_0x239c18(_0x5f2393);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x21')]=function(_0x49aa7f){return util['format'](_0xc9ef('0x2a'),FILES_PATH,_0x49aa7f);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x2b')]=function(_0x50ece6,_0x1b77d5,_0x434296){odbc[_0xc9ef('0x2c')](_0x50ece6,function(_0x4ef921){if(_0x4ef921){logger[_0xc9ef('0x2d')](_0xc9ef('0x2e'),_0x4ef921);_0x434296(_0x4ef921);}else{logger[_0xc9ef('0x2f')]('ODBC\x20connection\x20successfully');odbc['query'](_0x1b77d5,function(_0x44f3e5,_0x43a177){if(_0x44f3e5){logger['info'](_0xc9ef('0x30'),_0x1b77d5);_0x434296(_0x44f3e5);}else{logger['info'](_0xc9ef('0x31'),_0x1b77d5);odbc[_0xc9ef('0x32')](function(_0x3904ba){if(_0x3904ba){logger['error'](_0xc9ef('0x33'),_0x3904ba);}_0x434296(null,_0x43a177);});}});}});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x34')]=function(_0x115422,_0x35da4a){this[_0xc9ef('0xf')][_0xc9ef('0x35')](_0x115422)[_0xc9ef('0x17')](function(_0x33678d){_0x35da4a(null,_0x33678d?_0x33678d:![]);})['catch'](function(_0xe2b221){_0x35da4a(_0xe2b221);});};AGIVertices[_0xc9ef('0x14')]['createSmsMessage']=function(_0x39d2b0,_0x1fd1f0){this[_0xc9ef('0xf')][_0xc9ef('0x36')](_0x39d2b0)[_0xc9ef('0x17')](function(_0x2d0a9d){_0x1fd1f0(null,_0x2d0a9d);})[_0xc9ef('0x13')](function(_0x57bdbb){_0x1fd1f0(_0x57bdbb);});};AGIVertices[_0xc9ef('0x14')]['createSquareDetailsReport']=function(_0x42e7c0,_0x5f2b8c,_0x4ef754){this[_0xc9ef('0xf')][_0xc9ef('0x37')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'node':_0x42e7c0[_0xc9ef('0x39')],'application':_0x42e7c0[_0xc9ef('0x3a')],'data':_0x5f2b8c||null,'project_name':this[_0xc9ef('0xe')][_0xc9ef('0x3b')],'callerid':this['channel'][_0xc9ef('0x3c')]})['then'](function(_0x459ceb){if(_0x4ef754){_0x4ef754(null,_0x459ceb);}})[_0xc9ef('0x13')](function(_0x260677){if(_0x4ef754){_0x4ef754(_0x260677);}});};AGIVertices[_0xc9ef('0x14')]['createSquareRecording']=function(_0x32fb2d,_0x1d25f0,_0xb25053,_0x10e9f2){this['rpc'][_0xc9ef('0x3d')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'callerid':this['channel']['callerid'],'calleridname':this[_0xc9ef('0xe')][_0xc9ef('0x3e')],'context':this[_0xc9ef('0xe')]['context'],'extension':this[_0xc9ef('0xe')]['extension'],'priority':this[_0xc9ef('0xe')][_0xc9ef('0x3f')],'accountcode':this[_0xc9ef('0xe')][_0xc9ef('0x40')],'dnid':this[_0xc9ef('0xe')]['dnid'],'projectName':this[_0xc9ef('0xe')]['arg_1'],'saveName':_0x1d25f0,'filename':_0x32fb2d[_0xc9ef('0x41')]||_0x1d25f0,'savePath':_0xb25053})[_0xc9ef('0x17')](function(_0x3c635b){_0x10e9f2(null,_0x3c635b);})[_0xc9ef('0x13')](function(_0x2ff065){_0x10e9f2(_0x2ff065);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x42')]=function(_0x24553f,_0x216b74,_0x281cf5,_0x4028e8,_0x160633){this[_0xc9ef('0xf')][_0xc9ef('0x42')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'body':_0x24553f,'direction':_0x216b74,'providerName':_0x281cf5,'providerResponse':_0x4028e8})[_0xc9ef('0x17')](function(_0x8c3874){if(_0x160633){_0x160633(null,_0x8c3874);}})[_0xc9ef('0x13')](function(_0x2f8f19){if(_0x160633){_0x160633(_0x2f8f19);}});};AGIVertices[_0xc9ef('0x14')]['createCmContact']=function(_0x4a12c9,_0x66a935){this['rpc'][_0xc9ef('0x43')]({'firstName':_['isEmpty'](_0x4a12c9[_0xc9ef('0x12')])||_[_0xc9ef('0x44')](_0x4a12c9[_0xc9ef('0x12')])?_0xc9ef('0x45')+Math[_0xc9ef('0x46')]():_0x4a12c9[_0xc9ef('0x12')],'lastName':_[_0xc9ef('0x47')](_0x4a12c9[_0xc9ef('0x48')])||_[_0xc9ef('0x44')](_0x4a12c9[_0xc9ef('0x48')])?null:_0x4a12c9[_0xc9ef('0x48')],'phone':_0x4a12c9[_0xc9ef('0x49')],'ListId':_0x4a12c9[_0xc9ef('0x4a')],'scheduledat':_0x4a12c9[_0xc9ef('0x4b')],'callbackUniqueid':this['channel']['uniqueid'],'tags':'callback','description':_0xc9ef('0x4c')+_0x4a12c9['scheduledAt']['toString'](),'priority':_0x4a12c9[_0xc9ef('0x4d')]})[_0xc9ef('0x17')](function(_0x4f9d27){_0x66a935(null,_0x4f9d27);})[_0xc9ef('0x13')](function(_0x38dccb){_0x66a935(_0x38dccb);});};AGIVertices['prototype'][_0xc9ef('0x4e')]=function(_0x137555,_0x31908c){this[_0xc9ef('0xf')][_0xc9ef('0x4f')](_0x137555)[_0xc9ef('0x17')](function(_0xb9265a){_0x31908c(null,_0xb9265a?_0xb9265a[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x462a19){_0x31908c(_0x462a19);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x50')]=function(_0x21e997,_0x250ad3,_0x18eda2){var _0x51a55f={'role':_0xc9ef('0x51')};_0x51a55f[_0x21e997]=this[_0xc9ef('0xe')][_0xc9ef('0x3c')];this[_0xc9ef('0xf')]['agentPause'](_0x51a55f,_0x250ad3,this[_0xc9ef('0xe')][_0xc9ef('0x38')])[_0xc9ef('0x17')](function(_0xe1baf4){_0x18eda2(null,_[_0xc9ef('0x44')](_0xe1baf4)?![]:!![]);})['catch'](function(_0x5f57cc){logger[_0xc9ef('0x2d')](_0x5f57cc);_0x18eda2(null,![]);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x52')]=function(_0x54cc55,_0x1c8379){var _0x2a0c25={'role':'agent'};_0x2a0c25[_0x54cc55]=this[_0xc9ef('0xe')]['callerid'];this[_0xc9ef('0xf')]['agentUnpause'](_0x2a0c25)[_0xc9ef('0x17')](function(_0x32d0a7){_0x1c8379(null,_[_0xc9ef('0x44')](_0x32d0a7)?![]:!![]);})[_0xc9ef('0x13')](function(_0x5b678e){logger[_0xc9ef('0x2d')](_0x5b678e);_0x1c8379(null,![]);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x53')]=function(_0x85757f,_0x448177){var _0x437930={'role':_0xc9ef('0x51')};_0x437930[_0x85757f]=this['channel'][_0xc9ef('0x3c')];this[_0xc9ef('0xf')][_0xc9ef('0x53')](_0x437930)[_0xc9ef('0x17')](function(_0x5e38d4){_0x448177(null,_[_0xc9ef('0x44')](_0x5e38d4)?![]:!![]);})[_0xc9ef('0x13')](function(_0x349a10){logger[_0xc9ef('0x2d')](_0x349a10);_0x448177(null,![]);});};AGIVertices['prototype'][_0xc9ef('0x54')]=function(_0x3efc9a,_0x593fd3){var _0x26990f={'role':_0xc9ef('0x51')};_0x26990f[_0x3efc9a]=this['channel'][_0xc9ef('0x3c')];var _0x5235d9=_0x3efc9a!=_0xc9ef('0x55')?util[_0xc9ef('0x56')]('%s/%s@from-sip/n','LOCAL',this[_0xc9ef('0xe')][_0xc9ef('0x3c')]):undefined;this[_0xc9ef('0xf')][_0xc9ef('0x54')](_0x26990f,_0x5235d9)['then'](function(_0x151944){_0x593fd3(null,_['isNil'](_0x151944)?![]:!![]);})[_0xc9ef('0x13')](function(_0x553717){logger[_0xc9ef('0x2d')](_0x553717);_0x593fd3(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x14d108,_0x338df8){sh['exec'](_['trim'](_0x14d108),function(_0x254e77,_0x5162cf){var _0x22847b=_0x5162cf[_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'');_0x338df8(null,_0x22847b);});};AGIVertices['prototype'][_0xc9ef('0x58')]=function(_0x52269e,_0x213a79){scripts['googleCloudTTS'](_0x52269e[_0xc9ef('0x59')],_0x52269e[_0xc9ef('0x5a')]||_0xc9ef('0x5b'),_0x52269e[_0xc9ef('0x5b')],_0x52269e[_0xc9ef('0x5c')]||'en-US',_0x52269e[_0xc9ef('0x5d')]||_0xc9ef('0x5e'),_0x52269e['audioEncoding']||_0xc9ef('0x5f'))[_0xc9ef('0x17')](function(_0x1398d9){_0x213a79(null,_0x1398d9);})[_0xc9ef('0x13')](function(_0xc1049){_0x213a79(_0xc1049);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x60')]=function(_0x11dc8b,_0x42ad4){scripts[_0xc9ef('0x60')](_0x11dc8b[_0xc9ef('0x5b')],_0x11dc8b['google_tts_language']||'en',0x1)[_0xc9ef('0x17')](function(_0x2d8855){_0x42ad4(null,_0x2d8855);})[_0xc9ef('0x13')](function(_0x4b4620){_0x42ad4(_0x4b4620);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x61')]=function(_0x363032,_0x4e5f47){var _0x2ca308={'uri':_0x363032[_0xc9ef('0x62')],'method':_0x363032[_0xc9ef('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x363032[_0xc9ef('0x64')])===_0xc9ef('0x65')&&parseInt(_0x363032[_0xc9ef('0x64')])>=0x1?parseInt(_0x363032[_0xc9ef('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xc9ef('0x66')]([_0xc9ef('0x67'),'PUT'],_0x2ca308[_0xc9ef('0x63')][_0xc9ef('0x68')]())){try{_0x2ca308['body']=_0x363032[_0xc9ef('0xa')]?JSON['parse'](_0x363032[_0xc9ef('0xa')]):{};}catch(_0x19e3c7){logger[_0xc9ef('0x2d')](_0xc9ef('0x69'),_0x19e3c7);}}try{_0x2ca308[_0xc9ef('0x6a')]=_0x363032[_0xc9ef('0x9')]?JSON[_0xc9ef('0x6b')](_0x363032['rawHeaders']):{};}catch(_0x2bfe4d){logger[_0xc9ef('0x2d')](_0xc9ef('0x6c'),_0x2bfe4d);}if(_0x363032[_0xc9ef('0x6d')]){try{var _0x4be265=require(_0x363032['computedVariables'])[_0xc9ef('0x6e')](this,_0x2ca308);_0x2ca308[_0xc9ef('0x6f')]=Mustache[_0xc9ef('0x70')](_0x363032[_0xc9ef('0x62')],_0x4be265,{},['$$','$$']);if(_0x2ca308[_0xc9ef('0x6a')]){_0x2ca308[_0xc9ef('0x6a')]=JSON['parse'](Mustache[_0xc9ef('0x70')](JSON['stringify'](_0x2ca308[_0xc9ef('0x6a')]),_0x4be265,{},['$$','$$']));}if(_0x2ca308[_0xc9ef('0x71')]){_0x2ca308[_0xc9ef('0x71')]=JSON[_0xc9ef('0x6b')](Mustache[_0xc9ef('0x70')](JSON['stringify'](_0x2ca308[_0xc9ef('0x71')]),_0x4be265,{},['$$','$$']));}}catch(_0x656c29){logger[_0xc9ef('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x656c29);}}rp(_0x2ca308)['then'](function(_0x525c6c){var _0x17fffd={'statusCode':_0x525c6c['statusCode']||0xc8,'statusMessage':_0x525c6c[_0xc9ef('0x72')]||'OK','headers':_0x525c6c['headers']||{},'body':_0x525c6c['body']||{}};_0x4e5f47(null,_0x17fffd);})[_0xc9ef('0x13')](function(_0xbc5168){var _0x54ca4e={'statusCode':_0xbc5168['statusCode']||0x1f4,'statusMessage':_0xbc5168['message']||_0xc9ef('0x73'),'headers':_0xbc5168[_0xc9ef('0x74')][_0xc9ef('0x6a')]||{},'body':_0xbc5168[_0xc9ef('0x74')][_0xc9ef('0x71')]||{}};_0x4e5f47(null,_0x54ca4e);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x75')]=function(_0x282026,_0x57d44b){scripts['googleDialogflow'](this[_0xc9ef('0xe')]['uniqueid'],_0x282026['key'],_0x282026['text'],_0x282026['dialogflow_language']||'en')[_0xc9ef('0x17')](function(_0x4f034c){_0x57d44b(null,_0x4f034c);})[_0xc9ef('0x13')](function(_0xfa2a57){_0x57d44b(_0xfa2a57);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x76')]=function(_0xb6329f,_0x26237b){scripts[_0xc9ef('0x76')](this[_0xc9ef('0xe')]['uniqueid'],_0xb6329f['dialogflowV2_project_id'],_0xb6329f[_0xc9ef('0x77')],_0xb6329f[_0xc9ef('0x78')],_0xb6329f['text'],_0xb6329f[_0xc9ef('0x79')]||'en')['then'](function(_0x1493e3){_0x26237b(null,_0x1493e3);})[_0xc9ef('0x13')](function(_0x5586dd){_0x26237b(_0x5586dd);});};AGIVertices[_0xc9ef('0x14')]['sestekNDA']=function(_0x4f5dbd,_0x1a47e4){scripts['sestekNDA'](this[_0xc9ef('0xe')],_0x4f5dbd)['then'](function(_0x9fb1b6){_0x1a47e4(null,_0x9fb1b6);})['catch'](function(_0x5a1fe2){_0x1a47e4(_0x5a1fe2);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x7a')]=function(_0x27e2d4,_0x91704c){scripts[_0xc9ef('0x7a')](_0x27e2d4['key'],_0x27e2d4[_0xc9ef('0x5b')],_0x27e2d4[_0xc9ef('0x7b')]||_0xc9ef('0x7c'),_0x27e2d4[_0xc9ef('0x7d')])[_0xc9ef('0x17')](function(_0x28f440){_0x91704c(null,_0x28f440);})[_0xc9ef('0x13')](function(_0x25ff57){_0x91704c(_0x25ff57);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x7e')]=function(_0x494bfe,_0x3ed381,_0x4fe532){scripts[_0xc9ef('0x7e')](_0x3ed381,_0x494bfe[_0xc9ef('0x7f')],_0x494bfe[_0xc9ef('0x80')]||_0xc9ef('0x7c'),this[_0xc9ef('0x81')](_0x494bfe[_0xc9ef('0x82')])?_0x494bfe['model']:undefined)[_0xc9ef('0x17')](function(_0x56ffdc){_0x4fe532(null,_0x56ffdc);})['catch'](function(_0x3112f3){_0x4fe532(_0x3112f3);});};AGIVertices['prototype'][_0xc9ef('0x83')]=function(_0x57b8ef,_0x36efc5){scripts[_0xc9ef('0x83')](_0x57b8ef[_0xc9ef('0x84')],_0x57b8ef[_0xc9ef('0x85')],_0x57b8ef[_0xc9ef('0x86')],_0x57b8ef[_0xc9ef('0x87')]||'Amy',_0x57b8ef[_0xc9ef('0x5b')],_0x57b8ef[_0xc9ef('0x88')]||_0xc9ef('0x5b'))['then'](function(_0x306546){_0x36efc5(null,_0x306546);})[_0xc9ef('0x13')](function(_0xf33e35){_0x36efc5(_0xf33e35);});};AGIVertices[_0xc9ef('0x14')]['awsLex']=function(_0x40a09c,_0x58089c){scripts['awsLex'](this[_0xc9ef('0xe')][_0xc9ef('0x38')],_0x40a09c[_0xc9ef('0x84')],_0x40a09c['aws_secret_access_key'],_0x40a09c[_0xc9ef('0x89')],_0x40a09c['text'],_0x40a09c[_0xc9ef('0x8a')])['then'](function(_0x29f821){_0x58089c(null,_0x29f821);})['catch'](function(_0x3862bd){_0x58089c(_0x3862bd);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x8b')]=function(_0x429d75,_0x299b3e,_0x58742f){scripts[_0xc9ef('0x8b')](_0x299b3e,_0x429d75[_0xc9ef('0x7f')],_0x429d75[_0xc9ef('0x8c')]||'en-US')[_0xc9ef('0x17')](function(_0xc3c1cd){_0x58742f(null,_0xc3c1cd);})[_0xc9ef('0x13')](function(_0x246af1){_0x58742f(_0x246af1);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x8d')]=function(_0x17fc35,_0x31b5b3,_0x1a0be7){scripts['tildeASR'](_0x31b5b3,_0x17fc35[_0xc9ef('0x8e')],_0x17fc35[_0xc9ef('0x8f')],_0x17fc35[_0xc9ef('0x6f')])['then'](function(_0x2566de){_0x1a0be7(null,_0x2566de);})[_0xc9ef('0x13')](function(_0x89b157){_0x1a0be7(_0x89b157);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x90')]=function(_0x350677){var _0x53596a=_['includes'](verticesWithRetry,_0x350677['agicommand'])?_0x350677:_[_0xc9ef('0x91')](_0x350677);for(var _0x34253a in _0x53596a){if(_0x53596a[_0xc9ef('0x92')](_0x34253a)){if(_0x53596a[_0x34253a]&&_[_0xc9ef('0x93')](_0x53596a[_0x34253a])){if(_[_0xc9ef('0x66')](recursiveMapAttributes,_0x34253a)){_0x53596a[_0x34253a]=this[_0xc9ef('0x94')](_0x53596a[_0x34253a]);}else{_0x53596a[_0x34253a]=this[_0xc9ef('0x95')](_0x53596a[_0x34253a]);}}}}return _0x53596a;};AGIVertices[_0xc9ef('0x14')]['recursiveNodeIndex']=function(_0x3fc804){for(var _0x507544 in _0x3fc804){if(_0x3fc804['hasOwnProperty'](_0x507544)){if(_[_0xc9ef('0x96')](_0x3fc804[_0x507544])){this[_0xc9ef('0x97')](_0x3fc804[_0x507544]);}else if(_[_0xc9ef('0x98')](_0x3fc804[_0x507544])){for(var _0x4e5ebd=0x0;_0x4e5ebd<_0x3fc804[_0x507544][_0xc9ef('0x99')];_0x4e5ebd++){this[_0xc9ef('0x97')](_0x3fc804[_0x507544][_0x4e5ebd]);}}else if(_['isString'](_0x3fc804[_0x507544])){_0x3fc804[_0x507544]=this[_0xc9ef('0x95')](_0x3fc804[_0x507544]);}}}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x9a')]=function(_0x553c4a,_0x948bc9){for(var _0x5be3c4 in _0x553c4a){if(_0x553c4a[_0xc9ef('0x92')](_0x5be3c4)){if(_['isPlainObject'](_0x553c4a[_0x5be3c4])){if(!_[_0xc9ef('0x47')](_0x553c4a[_0x5be3c4])){this[_0xc9ef('0x9a')](_0x553c4a[_0x5be3c4],util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x948bc9,_0x5be3c4));}}else if(_['isArray'](_0x553c4a[_0x5be3c4])){for(var _0x25a37c=0x0;_0x25a37c<_0x553c4a[_0x5be3c4][_0xc9ef('0x99')];_0x25a37c++){this['saveRestApiResult'](_0x553c4a[_0x5be3c4][_0x25a37c],util[_0xc9ef('0x56')]('%s.%s',_0x948bc9,_0x5be3c4+'['+_0x25a37c+']'));}}else{if(!_[_0xc9ef('0x44')](_0x553c4a[_0x5be3c4])){this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')]('%s.%s',_0x948bc9,_0x5be3c4),_0x553c4a[_0x5be3c4]);}}}}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x94')]=function(_0x9edcf1){try{var _0x29044a=JSON[_0xc9ef('0x6b')](_0x9edcf1);this['recursiveNodeIndex'](_0x29044a);return JSON[_0xc9ef('0x9d')](_0x29044a);}catch(_0xd7b599){return this[_0xc9ef('0x95')](_0x9edcf1);}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x95')]=function(_0x33a442){var _0x42ac7d=_0x33a442[_0xc9ef('0x9e')]('{');for(var _0x39df1f=0x1;_0x39df1f<_0x42ac7d[_0xc9ef('0x99')];_0x39df1f+=0x1){var _0x2727b9=_0x42ac7d[_0x39df1f][_0xc9ef('0x9e')]('}');if(_0x2727b9[_0xc9ef('0x99')]>0x1){_0x33a442=_0x33a442['replaceAll']('{'+_0x2727b9[0x0]+'}',this[_0xc9ef('0xe')][_0xc9ef('0x10')](_0x2727b9[0x0])[_0xc9ef('0x9f')]||_0x2727b9[0x0]);}}if(_0x42ac7d['length']===0x1){return _0x33a442[_0xc9ef('0xa0')]();}return this[_0xc9ef('0x95')](_0x33a442);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xa1')]=function(_0x49983a,_0x1703d7){var _0x3a03d5=this[_0xc9ef('0xe')]['getVariable'](_0x49983a);if(_0x3a03d5[_0xc9ef('0xa2')]===-0x1){return _0x3a03d5;}logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xa3'),_0x1703d7,_0x3a03d5['extra']));return this[_0xc9ef('0xe')]['setVariable'](_0x1703d7,_0x3a03d5['extra']);};AGIVertices[_0xc9ef('0x14')]['isConfigured']=function(_0x3d2ae1){return _0x3d2ae1&&_0x3d2ae1!=='0'&&_0x3d2ae1!=='-1'&&_0x3d2ae1!=='';};AGIVertices['prototype'][_0xc9ef('0xa4')]=function(_0x4bdd5c){this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x4bdd5c,'-');_0x4bdd5c[_0xc9ef('0xa5')]=_0x4bdd5c[_0xc9ef('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xa6')]=function(_0x359e53){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xa7'),_0x359e53[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x359e53[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}var _0x3947ab='\x22'+_0x359e53[_0xc9ef('0x5b')]+'\x22';if(this[_0xc9ef('0x81')](_0x359e53[_0xc9ef('0x74')])){_0x3947ab+=','+_0x359e53[_0xc9ef('0x74')];}var _0x2d4776=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xaa'),_0x3947ab);if(_0x2d4776['result']===-0x1){return _0x2d4776;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3947ab));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xab')]=function(_0x536f2e){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x536f2e[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x536f2e['grammar'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x2a0bda=_0x536f2e[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x536f2e['options'])){_0x2a0bda+=','+_0x536f2e[_0xc9ef('0x74')];}var _0x565c32=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x2a0bda);if(_0x565c32[_0xc9ef('0xa2')]===-0x1){return _0x565c32;}var _0x1da388=this[_0xc9ef('0xa1')]('RECOG_CONFIDENCE()',_0xc9ef('0xaf'));if(_0x1da388[_0xc9ef('0xa2')]===-0x1){return _0x1da388;}var _0x36d1fb=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xb0'));if(_0x36d1fb[_0xc9ef('0xa2')]===-0x1){return _0x36d1fb;}var _0x55fd73=this[_0xc9ef('0xa1')]('RECOG_INSTANCE()',_0xc9ef('0xb1'));if(_0x55fd73['result']===-0x1){return _0x55fd73;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xb2'),_0x2a0bda));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x6')]=function(_0x22231a){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xb3'),_0x22231a[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x6')]([_0x22231a[_0xc9ef('0xb4')],_0x22231a['args']]);};AGIVertices[_0xc9ef('0x14')]['answer']=function(_0x189711){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb5'),_0x189711[_0xc9ef('0x39')]));if(this[_0xc9ef('0x81')](_0x189711[_0xc9ef('0x64')])){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb6'),_0x189711[_0xc9ef('0x64')]));var _0x375ba=this[_0xc9ef('0xe')]['wait'](_0x189711[_0xc9ef('0x64')]);if(_0x375ba[_0xc9ef('0xa2')]===-0x1){return _0x375ba;}}return this[_0xc9ef('0xe')][_0xc9ef('0xb7')]();};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xb8')]=function(_0x56a2d3){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb9'),_0x56a2d3['label']));if(!this[_0xc9ef('0x81')](_0x56a2d3[_0xc9ef('0x4a')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x56a2d3,'no\x20list\x20selected');}_0x56a2d3[_0xc9ef('0x4b')]=moment();if(this['isConfigured'](_0x56a2d3[_0xc9ef('0xba')])){_0x56a2d3[_0xc9ef('0x4b')]=moment()[_0xc9ef('0xbb')](_0x56a2d3[_0xc9ef('0xba')],'minutes');}if(!this[_0xc9ef('0x81')](_0x56a2d3[_0xc9ef('0x4d')])){_0x56a2d3[_0xc9ef('0x4d')]=0x2;}this[_0xc9ef('0x43')][_0xc9ef('0x6e')](this,_0x56a2d3);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbc'),_0x56a2d3[_0xc9ef('0x49')],_0x56a2d3[_0xc9ef('0x4a')],_0x56a2d3['scheduledAt']));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xbd')]=function(_0x546e34){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x546e34[_0xc9ef('0x39')]));var _0x41700b=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0x546e34[_0xc9ef('0xbe')],_0x546e34[_0xc9ef('0x74')]);if(_0x41700b['result']===-0x1){return _0x41700b;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),_0x546e34['application'],_0x546e34['options']));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc0')]=function(_0x34b1a5){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xc1'),_0x34b1a5[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x34b1a5[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}var _0x3de43b='\x22'+_0x34b1a5[_0xc9ef('0x5b')]+'\x22';if(this[_0xc9ef('0x81')](_0x34b1a5['options'])){_0x3de43b+=','+_0x34b1a5[_0xc9ef('0x74')];}var _0x5589b5=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xaa'),_0x3de43b);if(_0x5589b5[_0xc9ef('0xa2')]===-0x1){return _0x5589b5;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xc3'),_0x3de43b));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc4')]=function(_0x1c52e2){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x1c52e2[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x1c52e2[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}var _0x1e5207='\x22'+_0x1c52e2['text']+'\x22';if(this[_0xc9ef('0x81')](_0x1c52e2[_0xc9ef('0x74')])){_0x1e5207+=','+_0x1c52e2['options'];}var _0x41720f=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0xaa'),_0x1e5207);if(_0x41720f[_0xc9ef('0xa2')]===-0x1){return _0x41720f;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xc3'),_0x1e5207));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc5')]=function(_0x3056b9){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xc6'),_0x3056b9[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x3056b9[_0xc9ef('0xad')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x206e1f=_0x3056b9[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x3056b9[_0xc9ef('0x74')])){_0x206e1f+=','+_0x3056b9[_0xc9ef('0x74')];}var _0x45e067=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x206e1f);if(_0x45e067['result']===-0x1){return _0x45e067;}var _0x56f487=this[_0xc9ef('0xa1')]('RECOG_CONFIDENCE()',_0xc9ef('0xc7'));if(_0x56f487[_0xc9ef('0xa2')]===-0x1){return _0x56f487;}var _0x5cf085=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xc8'));if(_0x5cf085[_0xc9ef('0xa2')]===-0x1){return _0x5cf085;}var _0x147271=this[_0xc9ef('0xa1')](_0xc9ef('0xc9'),'LUMENVOX_ASR_INSTANCE');if(_0x147271['result']===-0x1){return _0x147271;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xb2'),_0x206e1f));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xca')]=function(_0x9fd023){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xcb'),_0x9fd023[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x9fd023[_0xc9ef('0xad')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x561d03=_0x9fd023[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x9fd023[_0xc9ef('0x74')])){_0x561d03+=','+_0x9fd023[_0xc9ef('0x74')];}var _0x1b00ff=this['channel'][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x561d03);if(_0x1b00ff[_0xc9ef('0xa2')]===-0x1){return _0x1b00ff;}var _0x5e7635=this[_0xc9ef('0xa1')](_0xc9ef('0xcc'),_0xc9ef('0xcd'));if(_0x5e7635[_0xc9ef('0xa2')]===-0x1){return _0x5e7635;}var _0xb06252=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xce'));if(_0xb06252[_0xc9ef('0xa2')]===-0x1){return _0xb06252;}var _0x59bd93=this[_0xc9ef('0xa1')](_0xc9ef('0xc9'),_0xc9ef('0xcf'));if(_0x59bd93[_0xc9ef('0xa2')]===-0x1){return _0x59bd93;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xb2'),_0x561d03));};AGIVertices['prototype'][_0xc9ef('0xd0')]=function(_0x423d31){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xd1'),_0x423d31[_0xc9ef('0x39')]));if(!this['isConfigured'](_0x423d31[_0xc9ef('0xd2')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x423d31,_0xc9ef('0xd3'));}var _0x733fa5=this['getSquareOdbc'][_0xc9ef('0x6e')](this,_0x423d31[_0xc9ef('0xd2')]);if(!_0x733fa5){return this[_0xc9ef('0xe')]['error'](_0x423d31,_0xc9ef('0xd4'));}if(!this[_0xc9ef('0x81')](_0x423d31['query'])){return this['channel'][_0xc9ef('0x2d')](_0x423d31,_0xc9ef('0xd5'));}var _0x3cd3ed=_0x423d31[_0xc9ef('0xd6')][_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xd7'),_0x3cd3ed));var _0x1463c3=this['getQueryOdbc'][_0xc9ef('0x6e')](this,_0x733fa5,_0x3cd3ed);this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x423d31,_0x3cd3ed);if(!this[_0xc9ef('0x81')](_0x423d31[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}var _0x343a68=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x423d31[_0xc9ef('0xd8')]);if(!_0x343a68){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x423d31,'no\x20variable\x20found');}var _0x4ccab=this;_0x1463c3[_0xc9ef('0xda')](function(_0x213717,_0xc577e3){Object[_0xc9ef('0xdb')](_0x213717)[_0xc9ef('0xda')](function(_0x3ce224){_0x4ccab[_0xc9ef('0xe')][_0xc9ef('0x9c')](util['format'](_0xc9ef('0xdc'),_0x343a68,_0xc577e3,_0x3ce224),_0x213717[_0x3ce224]);});});this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')](_0xc9ef('0xdd'),_0x343a68),_0x1463c3[_0xc9ef('0x99')]);return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xde'),_0x343a68));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xdf')]=function(_0x426dcc){logger[_0xc9ef('0xe0')](util[_0xc9ef('0x56')](_0xc9ef('0xe1'),_0x426dcc['label']));if(!this[_0xc9ef('0x81')](_0x426dcc['sip_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x426dcc,_0xc9ef('0xe2'));}var _0xd36d8a=this[_0xc9ef('0x1d')][_0xc9ef('0x6e')](this,_0x426dcc['sip_id']);if(!_0xd36d8a){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x426dcc,_0xc9ef('0xe3'));}var _0x3fa98e=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0xe4'),[util[_0xc9ef('0x56')]('SIP/%s',_0xd36d8a),_0x426dcc[_0xc9ef('0x64')],_0x426dcc[_0xc9ef('0xe5')],_0x426dcc[_0xc9ef('0x62')]]);if(_0x3fa98e[_0xc9ef('0xa2')]===-0x1){return _0x3fa98e;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xe6'),_0xc9ef('0xe4')));};AGIVertices[_0xc9ef('0x14')]['dialogflow']=function(_0x321e5c){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xe7'),_0x321e5c[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x321e5c[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xe8'));}if(!this[_0xc9ef('0x81')](_0x321e5c[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x321e5c);this[_0xc9ef('0x42')](_0x321e5c[_0xc9ef('0x5b')],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('Trying\x20Dialogflow:\x20%s',_0x321e5c[_0xc9ef('0x5b')]));var _0x5c2090=this[_0xc9ef('0x75')][_0xc9ef('0x6e')](this,_0x321e5c);if(_0x5c2090){for(var _0x594371 in _0x5c2090){if(_0x5c2090['hasOwnProperty'](_0x594371)){this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('DIALOGFLOW_%s',_0x594371[_0xc9ef('0x68')]()),_0x5c2090[_0x594371]);}}this[_0xc9ef('0x42')](_0x5c2090[_0xc9ef('0xea')],_0xc9ef('0xeb'),_0xc9ef('0xec'),'');return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xed'),_0x5c2090['speech']));}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x321e5c,_0xc9ef('0xee'));};AGIVertices['prototype']['dialogflowV2']=function(_0x13d5fa){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x13d5fa[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0xef')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf0'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x77')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf1'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x78')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf2'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x79')])){return this['channel'][_0xc9ef('0xa8')]('no\x20anguage\x20configured');}if(!this[_0xc9ef('0x81')](_0x13d5fa['text'])){return this[_0xc9ef('0xe')]['noop']('no\x20text\x20configured');}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this['createSquareDetailsReport'](_0x13d5fa);this['createSquareMessage'](_0x13d5fa['text'],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xf3'),_0x13d5fa['text']));var _0x37e239=this[_0xc9ef('0x76')][_0xc9ef('0x6e')](this,_0x13d5fa);if(_0x37e239){for(var _0x21ead5 in _0x37e239){if(_0x37e239[_0xc9ef('0x92')](_0x21ead5)){if(_0x21ead5!==_0xc9ef('0xf4')){this['channel']['setVariable'](util[_0xc9ef('0x56')](_0xc9ef('0xf5'),_0x21ead5[_0xc9ef('0x68')]()),_0x37e239[_0x21ead5]);}}}this[_0xc9ef('0x42')](_0x37e239[_0xc9ef('0xea')],_0xc9ef('0xeb'),_0xc9ef('0xf6'),_0x37e239[_0xc9ef('0xf4')]);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xf7'),_0x37e239[_0xc9ef('0xea')]));}return this['channel'][_0xc9ef('0x2d')](_0x13d5fa,_0xc9ef('0xf8'));};AGIVertices[_0xc9ef('0x14')]['sesteknda']=function(_0x4812cf){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xf9'),_0x4812cf[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfa')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xfb'));}if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfc')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xfd'));}if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfe')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xff'));}if(!this[_0xc9ef('0x81')](_0x4812cf['ndassistant_url'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this['channel'][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x4812cf);this[_0xc9ef('0x42')](_0x4812cf[_0xc9ef('0x5b')],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x100'),_0x4812cf[_0xc9ef('0x5b')]));var _0x1ea210=this[_0xc9ef('0x101')][_0xc9ef('0x6e')](this,_0x4812cf);if(_0x1ea210){for(var _0x3c1c92 in _0x1ea210){if(_0x1ea210['hasOwnProperty'](_0x3c1c92)){this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x102'),_0x3c1c92[_0xc9ef('0x68')]()),_0x1ea210[_0x3c1c92]);}}this[_0xc9ef('0x42')](_0x1ea210[_0xc9ef('0xea')],'out',_0xc9ef('0x103'),'');if(_0x1ea210['audiofile']){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x104'),_0x1ea210['audiofile']));var _0x4249f4=this['channel'][_0xc9ef('0x105')](_0x1ea210[_0xc9ef('0x106')]);try{fs[_0xc9ef('0x107')](_0x1ea210[_0xc9ef('0x106')]+_0xc9ef('0x108'));}catch(_0x486127){logger[_0xc9ef('0x2d')](_0x486127);}return _0x4249f4;}else{return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x109'),_0x1ea210[_0xc9ef('0xea')]));}}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4812cf,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x10a')]=function(_0x5a06d6){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x10b'),_0x5a06d6[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('end');};AGIVertices['prototype'][_0xc9ef('0x10c')]=function(_0x184eac){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x184eac[_0xc9ef('0x39')]));var _0x444fe0='';if(_0x184eac[_0xc9ef('0x10d')]){if(!this[_0xc9ef('0x81')](_0x184eac[_0xc9ef('0x10d')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x184eac,'no\x20trunk\x20selected');}else{var _0x4a84f0=parseInt(_0x184eac[_0xc9ef('0x10d')],0xa);if(isNaN(_0x4a84f0)){_0x444fe0=_0x184eac['trunk_id'];}else{_0x444fe0=this[_0xc9ef('0x1e')][_0xc9ef('0x6e')](this,_0x184eac[_0xc9ef('0x10d')]);if(!_0x444fe0){return this['channel'][_0xc9ef('0x2d')](_0x184eac,'no\x20trunk\x20found');}}}}else if(_0x184eac[_0xc9ef('0x10e')]){_0x444fe0=_0x184eac['trunk_name'];}else{return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x184eac,_0xc9ef('0x10f'));}var _0x35c5c2=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xe4'),[util[_0xc9ef('0x56')](_0xc9ef('0x110'),_0x444fe0,_0x184eac[_0xc9ef('0x49')]),_0x184eac[_0xc9ef('0x64')],_0x184eac[_0xc9ef('0xe5')],_0x184eac[_0xc9ef('0x62')]]);if(_0x35c5c2[_0xc9ef('0xa2')]===-0x1){return _0x35c5c2;}return this['channel'][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xe6'),_0xc9ef('0xe4')));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x111')]=function(_0x9409c0){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x112'),_0x9409c0[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('finally');};AGIVertices['prototype'][_0xc9ef('0xc')]=function(_0x264b9e){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x113'),_0x264b9e[_0xc9ef('0x39')]));if(_0x264b9e[_0xc9ef('0xa5')]===0x0){return this[_0xc9ef('0xa4')](_0x264b9e);}_0x264b9e[_0xc9ef('0xa5')]-=0x1;if(!this[_0xc9ef('0x81')](_0x264b9e['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x114'));}var _0x3e2a87=this[_0xc9ef('0x1f')]['sync'](this,_0x264b9e[_0xc9ef('0x115')]);if(!_0x3e2a87){return this['channel'][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x116'));}if(!this[_0xc9ef('0x81')](_0x264b9e[_0xc9ef('0xd8')])){return this['channel']['error'](_0xc9ef('0xd9'));}var _0x3b416f=this[_0xc9ef('0xe')][_0xc9ef('0x117')](_0x3e2a87,_0x264b9e[_0xc9ef('0x118')],_0x264b9e[_0xc9ef('0x119')]);var _0x3216a9=_0x3b416f[_0xc9ef('0xa2')]?_0x3b416f[_0xc9ef('0xa2')][_0xc9ef('0xa0')]():'';logger[_0xc9ef('0x2f')](_0xc9ef('0x11a'),JSON[_0xc9ef('0x9d')](_0x3b416f));if(_0x3b416f[_0xc9ef('0xa2')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x264b9e,_0x3216a9);return _0x3b416f;}else if(_0x3b416f[_0xc9ef('0x9f')]===_0xc9ef('0x64')){_0x3b416f[_0xc9ef('0xa2')]=_0x3216a9['length']>=parseInt(_0x264b9e[_0xc9ef('0x11b')])?'x':'i';}else{_0x3b416f[_0xc9ef('0xa2')]=_0x3216a9[_0xc9ef('0x99')]>=parseInt(_0x264b9e['mindigit'])&&_0x3216a9[_0xc9ef('0x99')]<=parseInt(_0x264b9e['maxdigit'])?'x':'i';}var _0x126ea5=this['getVariable']['sync'](this,_0x264b9e[_0xc9ef('0xd8')]);if(!_0x126ea5){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](_0x126ea5,_0x3216a9);if(this[_0xc9ef('0x81')](_0x264b9e[_0xc9ef('0x11d')])){var _0x2aeadd=parseInt(_0x264b9e[_0xc9ef('0x11d')],0xa);var _0x3d4e76=rs[_0xc9ef('0x11e')]({'charset':'*','length':_0x2aeadd});var _0x890848=_0x3216a9[_0xc9ef('0x99')];if(_0x890848>0x0){if(_0x890848>_0x2aeadd){this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x264b9e,_0x264b9e[_0xc9ef('0x11f')]===_0xc9ef('0x120')?_0x3d4e76+_0x3216a9[_0xc9ef('0x121')](_0x2aeadd):_0x3216a9[_0xc9ef('0x121')](0x0,_0x890848-_0x2aeadd)+_0x3d4e76);}else{this[_0xc9ef('0x37')]['sync'](this,_0x264b9e,rs[_0xc9ef('0x11e')]({'charset':'*','length':_0x890848}));}}else{this['createSquareDetailsReport']['sync'](this,_0x264b9e,'');}}else{this[_0xc9ef('0x37')]['sync'](this,_0x264b9e,_0x3216a9);}return _0x3b416f;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xd')]=function(_0x8dcb07){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x122'),_0x8dcb07[_0xc9ef('0x39')]));return this['getdigits'](_0x8dcb07);};AGIVertices[_0xc9ef('0x14')]['goal']=function(_0x3a05c0){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x123'),_0x3a05c0[_0xc9ef('0x39')]));this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x3a05c0,_0x3a05c0[_0xc9ef('0x124')]);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x125'),_0x3a05c0['goalname']));};AGIVertices['prototype'][_0xc9ef('0x126')]=function(_0xd048e9){logger['info'](util[_0xc9ef('0x56')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xd048e9['label']));if(!this[_0xc9ef('0x81')](_0xd048e9[_0xc9ef('0x84')])||!this['isConfigured'](_0xd048e9[_0xc9ef('0x85')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x127'));}if(!this[_0xc9ef('0x81')](_0xd048e9[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x128'),_0xd048e9[_0xc9ef('0x5b')]));var _0x453081=this['awsPolly']['sync'](this,_0xd048e9);if(_0x453081){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x129'),_0x453081));var _0x566248=this['channel'][_0xc9ef('0x105')](_0x453081);try{fs[_0xc9ef('0x107')](_0x453081+_0xc9ef('0x108'));}catch(_0x43c2a2){logger['error'](_0x43c2a2);}return _0x566248;}return this['channel'][_0xc9ef('0x2d')](_0xd048e9,_0xc9ef('0x12a'));};AGIVertices[_0xc9ef('0x14')]['awslex']=function(_0x202c96){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x12b'),_0x202c96[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x202c96['aws_access_key_id'])||!this[_0xc9ef('0x81')](_0x202c96['aws_secret_access_key'])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x127'));}if(!this[_0xc9ef('0x81')](_0x202c96[_0xc9ef('0x8a')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x12c'));}if(!this[_0xc9ef('0x81')](_0x202c96[_0xc9ef('0x5b')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x202c96);this[_0xc9ef('0x42')](_0x202c96['text'],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x202c96[_0xc9ef('0x5b')]));var _0x281bdf=this[_0xc9ef('0x12d')][_0xc9ef('0x6e')](this,_0x202c96);if(_0x281bdf){for(var _0x10f1f8 in _0x281bdf){if(_0x281bdf['hasOwnProperty'](_0x10f1f8)&&_[_0xc9ef('0x93')](_0x281bdf[_0x10f1f8])){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x12e'),_0x10f1f8[_0xc9ef('0x68')]()),_0x281bdf[_0x10f1f8]);}}if(_[_0xc9ef('0x44')](_0x281bdf[_0xc9ef('0x12f')])){return this['channel'][_0xc9ef('0xa8')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xc9ef('0x42')](_0x281bdf[_0xc9ef('0x12f')],_0xc9ef('0xeb'),_0xc9ef('0x130'),'');return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x131'),_0x281bdf[_0xc9ef('0x12f')]));}}return this['channel'][_0xc9ef('0x2d')](_0x202c96,_0xc9ef('0x132'));};AGIVertices['prototype'][_0xc9ef('0x133')]=function(_0x1166bd){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x134'),_0x1166bd[_0xc9ef('0x39')],_0x1166bd[_0xc9ef('0x64')]));if(!this['isConfigured'](_0x1166bd[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20key\x20configured');}var _0x453ac3='wav';var _0x240f6e=util[_0xc9ef('0x56')]('%s/recordings/%s',FILES_PATH,rs[_0xc9ef('0x11e')](0x4));var _0x418f41=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x240f6e,_0x453ac3);var _0x4caae4=!![];if(_0x1166bd[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x4caae4=![];}var _0x319b5a=this['channel'][_0xc9ef('0x137')](_0x240f6e,_0x453ac3,_0x1166bd[_0xc9ef('0x138')],_0x1166bd[_0xc9ef('0x64')],undefined,_0x4caae4);if(_0x319b5a[_0xc9ef('0xa2')]!==-0x1){this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x139'),_0x418f41));var _0x10f14d=this[_0xc9ef('0x8b')][_0xc9ef('0x6e')](this,_0x1166bd,_0x418f41);if(_0x10f14d){for(var _0x228ead in _0x10f14d){if(_0x10f14d[_0xc9ef('0x92')](_0x228ead)){this['channel'][_0xc9ef('0x9c')](util['format']('GOOGLE_ASR_%s',_0x228ead[_0xc9ef('0x68')]()),_0x10f14d[_0x228ead]);}}return this['channel']['noop'](util['format'](_0xc9ef('0x13a'),JSON[_0xc9ef('0x9d')](_0x10f14d)));}}return _0x319b5a;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x13b')]=function(_0x112996){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x13c'),_0x112996['label']));if(!this[_0xc9ef('0x81')](_0x112996['appid'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x13d'));}if(!this[_0xc9ef('0x81')](_0x112996[_0xc9ef('0x8f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20appsecret\x20configured');}var _0x5102d9='wav';var _0x129cb7=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xc9ef('0x11e')](0x4));var _0x48f5f7=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x129cb7,_0x5102d9);var _0x220ecc=!![];if(_0x112996[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x220ecc=![];}var _0x547e2a=this[_0xc9ef('0xe')]['recordFile'](_0x129cb7,_0x5102d9,_0x112996[_0xc9ef('0x138')],_0x112996['timeout'],undefined,_0x220ecc);if(_0x547e2a[_0xc9ef('0xa2')]!==-0x1){this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('tilde\x20%s\x20file\x20created',_0x48f5f7));var _0x433bdf=this['tildeASR'][_0xc9ef('0x6e')](this,_0x112996,_0x48f5f7);if(_0x433bdf){for(var _0x4902d7 in _0x433bdf){if(_0x433bdf[_0xc9ef('0x92')](_0x4902d7)){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util['format'](_0xc9ef('0x13e'),_0x4902d7[_0xc9ef('0x68')]()),_0x433bdf[_0x4902d7]);}}return this['channel']['noop'](util[_0xc9ef('0x56')]('TildeASR\x20Result\x20%s',JSON[_0xc9ef('0x9d')](_0x433bdf)));}}return _0x547e2a;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x13f')]=function(_0x5cbe53){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x140'),_0x5cbe53[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x141')](_0x5cbe53['context'],_0x5cbe53[_0xc9ef('0x142')],_0x5cbe53[_0xc9ef('0x3f')]);};AGIVertices[_0xc9ef('0x14')]['gotoif']=function(_0x5c5dad){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x143'),_0x5c5dad[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x5c5dad[_0xc9ef('0x144')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x5c5dad,'no\x20condition\x20configured');}try{var _0x2e4760=eval(_0x5c5dad[_0xc9ef('0x144')])?_0xc9ef('0x145'):_0xc9ef('0x146');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x147'),_0x5c5dad[_0xc9ef('0x144')],_0x2e4760));return{'code':0xc8,'result':_0x2e4760};}catch(_0x1c99c1){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x148')]=function(_0x1f7304){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x149'),_0x1f7304[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x1f7304[_0xc9ef('0x14a')])){return this[_0xc9ef('0xe')]['error'](_0x1f7304,'no\x20interval\x20configured');}var _0x196386=this['getIntervals']['sync'](this,_0x1f7304[_0xc9ef('0x14a')]);if(!_0x196386){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x1f7304,_0xc9ef('0x14b'));}for(var _0x543c28=0x0;_0x543c28<_0x196386['length'];_0x543c28+=0x1){var _0x279bd9=this[_0xc9ef('0xe')][_0xc9ef('0x10')](util['format']('IFTIME(%s?true:false)',_0x196386[_0x543c28]));if(_0x279bd9['result']===-0x1){return _0x279bd9;}logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0x279bd9[_0xc9ef('0x9f')]));if(_0x279bd9[_0xc9ef('0x9f')]===_0xc9ef('0x145')){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x145')));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x145')));return{'code':0xc8,'result':'true'};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x146')));this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('IFTIME\x20%s\x20%s',_0x196386[_0x543c28],'false'));}}return{'code':0xc8,'result':_0xc9ef('0x146')};};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x14d')]=function(_0xf6e8bd){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x14e'),_0xf6e8bd[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x14d')]();};AGIVertices[_0xc9ef('0x14')]['ispeechasr']=function(_0x41e07f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14f'),_0x41e07f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x41e07f[_0xc9ef('0x7f')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xe8'));}var _0x1adb5a=_0xc9ef('0x150');var _0x8b6352=util['format'](_0xc9ef('0x151'),FILES_PATH,rs['generate'](0x4));var _0xa6a933=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x8b6352,_0x1adb5a);var _0x12a58a=!![];if(_0x41e07f[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x12a58a=![];}var _0x32383f=this[_0xc9ef('0xe')][_0xc9ef('0x137')](_0x8b6352,_0x1adb5a,_0x41e07f[_0xc9ef('0x138')],_0x41e07f[_0xc9ef('0x64')],undefined,_0x12a58a);if(_0x32383f[_0xc9ef('0xa2')]!==-0x1){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x152'),_0xa6a933));var _0x3a97c8=this[_0xc9ef('0x7e')][_0xc9ef('0x6e')](this,_0x41e07f,_0xa6a933);if(_0x3a97c8){for(var _0x4bc2a6 in _0x3a97c8){if(_0x3a97c8[_0xc9ef('0x92')](_0x4bc2a6)){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x153'),_0x4bc2a6[_0xc9ef('0x68')]()),_0x3a97c8[_0x4bc2a6]);}}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x154'),JSON[_0xc9ef('0x9d')](_0x3a97c8)));}}return _0x32383f;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x155')]=function(_0x148f5c){logger['info'](util['format'](_0xc9ef('0x156'),_0x148f5c[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x148f5c[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0xe8'));}if(!this[_0xc9ef('0x81')](_0x148f5c['text'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x157'),_0x148f5c[_0xc9ef('0x5b')]));var _0x37ef76=this['ispeechTTS'][_0xc9ef('0x6e')](this,_0x148f5c);if(_0x37ef76){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('ispeech\x20%s\x20file\x20created',_0x37ef76));var _0x36f978=this[_0xc9ef('0xe')][_0xc9ef('0x105')](_0x37ef76,_0x148f5c[_0xc9ef('0x138')]);try{fs[_0xc9ef('0x107')](_0x37ef76+'.wav');}catch(_0x17654c){logger[_0xc9ef('0x2d')](_0x17654c);}return _0x36f978;}return this[_0xc9ef('0xe')]['error'](_0x148f5c,_0xc9ef('0x158'));};AGIVertices['prototype']['login']=function(_0x29814d){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x29814d[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x29814d['findBy'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x29814d,_0xc9ef('0x159'));}logger['info'](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d[_0xc9ef('0x15b')]));var _0x47977d=this['agentLogin'][_0xc9ef('0x6e')](this,_0x29814d[_0xc9ef('0x15b')]);if(_0x47977d){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')]['callerid'],_0x29814d[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this['channel']['callerid'],_0x29814d[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')]['logout']=function(_0x5e5d2b){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x160'),_0x5e5d2b[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x5e5d2b['findBy'])){return this[_0xc9ef('0xe')]['error'](_0x5e5d2b,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x5e5d2b[_0xc9ef('0x15b')]));var _0x7c08e6=this[_0xc9ef('0x53')][_0xc9ef('0x6e')](this,_0x5e5d2b[_0xc9ef('0x15b')]);if(_0x7c08e6){logger['info'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5e5d2b[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xc9ef('0x3c')],_0x5e5d2b['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc9ef('0xe')]['callerid'],_0x5e5d2b[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this[_0xc9ef('0xe')]['callerid'],_0x5e5d2b['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')]['math']=function(_0x447d4e){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x447d4e[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x447d4e['operation'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x447d4e,_0xc9ef('0x161'));}this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('math\x20%s',_0x447d4e[_0xc9ef('0x162')]));var _0x2f08ae=eval(_0x447d4e[_0xc9ef('0x162')]);if(!this[_0xc9ef('0x81')](_0x447d4e['variable_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}var _0x1c71d0=this['getVariable']['sync'](this,_0x447d4e[_0xc9ef('0xd8')]);if(!_0x1c71d0){return this[_0xc9ef('0xe')]['error'](_0x447d4e,_0xc9ef('0x11c'));}if(_[_0xc9ef('0x98')](_0x2f08ae)){var _0x48ddc5=this;_0x2f08ae[_0xc9ef('0xda')](function(_0x565bd9,_0x11a6f9){_0x48ddc5[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('%s[%s]',_0x1c71d0,_0x11a6f9),_0x565bd9);});return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x163'),_0x1c71d0));}else{return this['channel'][_0xc9ef('0x9c')](_0x1c71d0,_0x2f08ae);}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xb')]=function(_0x41a2c1){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x164'),_0x41a2c1[_0xc9ef('0x39')]));if(_0x41a2c1['retry']===0x0){return this[_0xc9ef('0xa4')](_0x41a2c1);}_0x41a2c1[_0xc9ef('0xa5')]-=0x1;if(!this[_0xc9ef('0x81')](_0x41a2c1['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x41a2c1,_0xc9ef('0x114'));}var _0x15c874=this[_0xc9ef('0x1f')][_0xc9ef('0x6e')](this,_0x41a2c1[_0xc9ef('0x115')]);if(!_0x15c874){return this[_0xc9ef('0xe')]['error'](_0x41a2c1,_0xc9ef('0x116'));}var _0x1cbb53=this[_0xc9ef('0xe')][_0xc9ef('0x117')](_0x15c874,_0x41a2c1['response'],_0x41a2c1[_0xc9ef('0x165')]);var _0x391aa6=_0x1cbb53['result'];if(_0x1cbb53[_0xc9ef('0xa2')]===-0x1){this[_0xc9ef('0x37')]['sync'](this,_0x41a2c1,'-1');return _0x1cbb53;}else if(_0x1cbb53['extra']===_0xc9ef('0x64')){_0x1cbb53['result']=_0x1cbb53[_0xc9ef('0xa2')]['length']>0x0?_0x1cbb53['result']:'t';}else if(_[_0xc9ef('0x47')](_0x1cbb53[_0xc9ef('0xa2')])){_0x1cbb53[_0xc9ef('0xa2')]='#';_0x391aa6='#';}if(!this[_0xc9ef('0x81')](_0x41a2c1[_0xc9ef('0xd8')])){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}else{var _0x3bd069=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x41a2c1['variable_id']);if(!_0x3bd069){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x41a2c1,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](_0x3bd069,_0x391aa6);}this['createSquareDetailsReport']['sync'](this,_0x41a2c1,_0x391aa6);return _0x1cbb53;};AGIVertices['prototype']['noop']=function(_0x14f9b3){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x166'),_0x14f9b3['label']));return this[_0xc9ef('0xe')]['noop'](_0x14f9b3[_0xc9ef('0x167')]||_0x14f9b3[_0xc9ef('0x39')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x168')]=function(_0x495221){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x169'),_0x495221[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x495221['findBy'])){return this['channel'][_0xc9ef('0x2d')](_0x495221,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')]['callerid'],_0x495221[_0xc9ef('0x15b')]));var _0x2d2281=this['getPause'][_0xc9ef('0x6e')](this,_0x495221[_0xc9ef('0x16a')]);var _0x3c4d22=this[_0xc9ef('0x50')][_0xc9ef('0x6e')](this,_0x495221['findBy'],_0x2d2281);if(_0x3c4d22){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x495221[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x495221['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger['info'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xc9ef('0x3c')],_0x495221['findBy']));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')]['callerid'],_0x495221['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x16b')]=function(_0x3df1fd){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x16c'),_0x3df1fd['label']));if(!this['isConfigured'](_0x3df1fd['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x3df1fd,_0xc9ef('0x114'));}var _0x3697ef=this[_0xc9ef('0x1f')][_0xc9ef('0x6e')](this,_0x3df1fd[_0xc9ef('0x115')]);if(!_0x3697ef){return this[_0xc9ef('0xe')]['error'](_0x3df1fd,'no\x20file\x20audio\x20found');}var _0x392f10=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x16d'),[_0x3697ef,_0x3df1fd['opts']]);if(_0x392f10[_0xc9ef('0xa2')]===-0x1){return _0x392f10;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),_0xc9ef('0x16d'),_0x3697ef));};AGIVertices['prototype'][_0xc9ef('0x16e')]=function(_0x15e7de){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x16f'),_0x15e7de[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x15e7de[_0xc9ef('0x170')])){return this[_0xc9ef('0xe')]['error'](_0x15e7de,'no\x20queue\x20selected');}var _0x11072f='';var _0x51f7dc=parseInt(_0x15e7de[_0xc9ef('0x170')],0xa);if(isNaN(_0x51f7dc)){_0x11072f=_0x15e7de['queue_id'];}else{_0x11072f=this['getVoiceQueue'][_0xc9ef('0x6e')](this,_0x15e7de[_0xc9ef('0x170')]);if(!_0x11072f){return this['channel']['error'](_0x15e7de,_0xc9ef('0x171'));}}var _0x2a7f9b='';if(this[_0xc9ef('0x81')](_0x15e7de[_0xc9ef('0x115')])){var _0xe40fc5=this['getSound'][_0xc9ef('0x6e')](this,_0x15e7de['file_id']);if(_0xe40fc5){_0x2a7f9b=_0xe40fc5;}}this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x15e7de,_0x11072f);if(_0x15e7de[_0xc9ef('0xe5')]['indexOf']('x')<0x0){_0x15e7de[_0xc9ef('0xe5')]+='x';}if(_0x15e7de['opts'][_0xc9ef('0x172')]('X')<0x0){_0x15e7de[_0xc9ef('0xe5')]+='X';}this[_0xc9ef('0xe')][_0xc9ef('0x9c')](_0xc9ef('0x173'),_0x11072f?_0x11072f[_0xc9ef('0x174')]():'');var _0x6d9adc=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0x175'),[_0x11072f,_0x15e7de['opts'],_0x15e7de[_0xc9ef('0x62')],_0x2a7f9b,_0x15e7de[_0xc9ef('0x64')],_0x15e7de[_0xc9ef('0x6')],_0x15e7de[_0xc9ef('0x176')],_0x15e7de[_0xc9ef('0x177')],'',_0x15e7de[_0xc9ef('0x178')]]);if(_0x6d9adc['result']===-0x1){return _0x6d9adc;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x11072f));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x179')]=function(_0x17d573){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x17a'),_0x17d573[_0xc9ef('0x39')]));var _0x1c7140=_0x17d573['recordingFormat']||_0xc9ef('0x150');var _0x5f3c28=util[_0xc9ef('0x56')](_0xc9ef('0x17b'),this['channel'][_0xc9ef('0x38')],rs[_0xc9ef('0x11e')](0x5));var _0x5c8771=util['format'](_0xc9ef('0x17c'),FILES_PATH,_0x5f3c28,_0x1c7140);var _0x16f7b1=util['format'](_0xc9ef('0x151'),FILES_PATH,_0x5f3c28);this[_0xc9ef('0x3d')][_0xc9ef('0x6e')](this,_0x17d573,_0x5f3c28,_0x5c8771);this[_0xc9ef('0xe')][_0xc9ef('0x9c')](_0xc9ef('0x17d'),_0x5f3c28);logger[_0xc9ef('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x16f7b1,_0x1c7140,_0x17d573[_0xc9ef('0x17e')],_0x17d573[_0xc9ef('0x64')]);return this[_0xc9ef('0xe')][_0xc9ef('0x137')](_0x16f7b1,_0x1c7140,_0x17d573[_0xc9ef('0x17e')],_0x17d573[_0xc9ef('0x64')],undefined,!![]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x17f')]=function(_0x3b4ae1){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x180'),_0x3b4ae1[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x3b4ae1[_0xc9ef('0x62')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x181'));}var _0x24de27=this[_0xc9ef('0x61')][_0xc9ef('0x6e')](this,_0x3b4ae1);logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x182'),util[_0xc9ef('0x183')](_0x24de27,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3b4ae1[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x184'));}var _0x18125a=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x3b4ae1['variable_id']);if(!_0x18125a){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x3b4ae1,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x185'),_0x18125a),_0x24de27['statusCode']?_0x24de27[_0xc9ef('0x186')]:_0xc9ef('0x187'));this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('%s_STATUS_MESSAGE',_0x18125a),_0x24de27['statusMessage']?_0x24de27[_0xc9ef('0x72')]:'OK');if(_0x24de27['body']){try{this['saveRestApiResult'](_0x24de27[_0xc9ef('0x71')],_0x18125a);}catch(_0x128b5f){logger[_0xc9ef('0x2d')](util[_0xc9ef('0x56')](_0xc9ef('0x188'),_0x18125a));}}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('variable\x20%s\x20set',_0x18125a));};AGIVertices['prototype']['saydigits']=function(_0x2c7900){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2c7900[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')]['sayDigits'](_0x2c7900[_0xc9ef('0x189')][_0xc9ef('0x57')](/\s+/g,''),_0x2c7900[_0xc9ef('0x17e')]);};AGIVertices['prototype'][_0xc9ef('0x18a')]=function(_0x21222b){logger['info'](util['format'](_0xc9ef('0x18b'),_0x21222b[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x18c')](_0x21222b[_0xc9ef('0x65')][_0xc9ef('0x57')](/\s+/g,''),_0x21222b[_0xc9ef('0x17e')]);};AGIVertices[_0xc9ef('0x14')]['sayphonetic']=function(_0x308d03){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x18d'),_0x308d03[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x18e')](_0x308d03[_0xc9ef('0x5b')],_0x308d03[_0xc9ef('0x17e')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x18f')]=function(_0x3d5d0c){logger['info'](util[_0xc9ef('0x56')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3d5d0c['label']));if(!this['isConfigured'](_0x3d5d0c[_0xc9ef('0x190')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x191'));}var _0x1fe881=this[_0xc9ef('0x192')][_0xc9ef('0x6e')](this,_0x3d5d0c[_0xc9ef('0x190')]);if(!_0x1fe881||!_0x1fe881[_0xc9ef('0x193')]){return this[_0xc9ef('0xe')]['error'](_0x3d5d0c,_0xc9ef('0x194'));}var _0x5e9a88={'from':util[_0xc9ef('0x56')]('\x22%s\x22\x20<%s>',_0x1fe881[_0xc9ef('0x12')],_0x1fe881['email']||_0x1fe881[_0xc9ef('0x193')][_0xc9ef('0x195')]),'to':_0x3d5d0c['to']||'','cc':_0x3d5d0c['cc']||'','bcc':_0x3d5d0c[_0xc9ef('0x196')]||'','subject':_0x3d5d0c['subject'],'html':_0x3d5d0c[_0xc9ef('0x5b')],'text':_0x3d5d0c['text']};if(this['isConfigured'](_0x3d5d0c[_0xc9ef('0x197')])){}logger[_0xc9ef('0xe0')](_0xc9ef('0x198'),JSON[_0xc9ef('0x9d')](_0x5e9a88));this[_0xc9ef('0x37')]['sync'](this,_0x3d5d0c,_0x3d5d0c[_0xc9ef('0x190')]);this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x199'),_0x1fe881[_0xc9ef('0x12')]));this[_0xc9ef('0x23')][_0xc9ef('0x6e')](this,_0x1fe881[_0xc9ef('0x19a')],_0x5e9a88);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x19b'));};AGIVertices['prototype'][_0xc9ef('0x19c')]=function(_0x1226b9){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x19d'),_0x1226b9[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x19e'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x19f')]=function(_0x9a621f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1a0'),_0x9a621f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x9a621f[_0xc9ef('0x1a1')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1a2'));}var _0x34e0d1=this['getSmsAccount'][_0xc9ef('0x6e')](this,_0x9a621f[_0xc9ef('0x1a1')]);if(!_0x34e0d1){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x9a621f,_0xc9ef('0x1a3'));}var _0x1216ea={'body':_0x9a621f[_0xc9ef('0x1a4')],'phone':_0x9a621f['to']||'','SmsAccountId':_0x34e0d1['id']};logger['debug']('sendSMS\x20message',JSON[_0xc9ef('0x9d')](_0x1216ea));this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x9a621f,_0x9a621f[_0xc9ef('0x1a1')]);this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x1a5'),_0x34e0d1[_0xc9ef('0x12')]));this[_0xc9ef('0x36')]['sync'](this,_0x1216ea);return this['channel']['noop'](_0xc9ef('0x1a6'));};AGIVertices['prototype'][_0xc9ef('0x1a7')]=function(_0x1abe8b){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1abe8b['label']));if(!this[_0xc9ef('0x81')](_0x1abe8b['variable_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x1abe8b,_0xc9ef('0x1a8'));}var _0x25cabc=this['getVariable'][_0xc9ef('0x6e')](this,_0x1abe8b[_0xc9ef('0xd8')]);if(!_0x25cabc){return this['channel'][_0xc9ef('0x2d')](_0x1abe8b,_0xc9ef('0x11c'));}return this['channel'][_0xc9ef('0x9c')](_0x25cabc,_0x1abe8b[_0xc9ef('0x1a9')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1aa')]=function(_0x1f6149){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x1ab'),_0x1f6149[_0xc9ef('0x39')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1ac'));if(_0x1f6149[_0xc9ef('0xb7')]===_0xc9ef('0x1ad')){this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x1ae'));return this[_0xc9ef('0xe')][_0xc9ef('0xb7')]();}return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x1af'));};AGIVertices[_0xc9ef('0x14')]['subproject']=function(_0x4f4070){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1b0'),_0x4f4070[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x4f4070[_0xc9ef('0x1b1')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4f4070,'no\x20subproject\x20selected');}var _0x48ce45=this[_0xc9ef('0x18')][_0xc9ef('0x6e')](this,_0x4f4070['project_id']);if(!this['isConfigured'](_0x48ce45)){return this[_0xc9ef('0xe')]['error'](_0x4f4070,util[_0xc9ef('0x56')](_0xc9ef('0x1b2'),_0x4f4070[_0xc9ef('0x1b1')]));}if(_0x48ce45===this[_0xc9ef('0xe')]['arg_1']){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4f4070,_0xc9ef('0x1b3'));}this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x4f4070,_0x48ce45);var _0x3dd088=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x1b4'),util[_0xc9ef('0x56')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xc9ef('0x6')]['host']||_0xc9ef('0x1b5'),_0x48ce45,this[_0xc9ef('0xe')]['arg_1']));if(_0x3dd088[_0xc9ef('0xa2')]===-0x1){return _0x3dd088;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('Executed\x20command\x20%s\x20%s',_0xc9ef('0x1b4'),_0x48ce45));};AGIVertices[_0xc9ef('0x14')]['system']=function(_0xe8fc97){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1b6'),_0xe8fc97['label']));var _0x218904=this[_0xc9ef('0x1b7')][_0xc9ef('0x6e')](this,_0xe8fc97[_0xc9ef('0xb4')]);this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0xe8fc97,_0xe8fc97[_0xc9ef('0xb4')]);if(this[_0xc9ef('0x81')](_0xe8fc97[_0xc9ef('0xd8')])){var _0x3c170c=this[_0xc9ef('0x10')]['sync'](this,_0xe8fc97[_0xc9ef('0xd8')]);if(_0x3c170c){this[_0xc9ef('0xe')]['setVariable'](_0x3c170c,_0x218904);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x1b8'),_0xe8fc97[_0xc9ef('0xb4')],_0x3c170c));}}return this['channel']['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x1b9'),_0xe8fc97[_0xc9ef('0xb4')]));};AGIVertices[_0xc9ef('0x14')]['google_cloud_tts']=function(_0xca4789){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x1ba'),_0xca4789[_0xc9ef('0x39')]));_0xca4789[_0xc9ef('0x5b')]=_0xca4789[_0xc9ef('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc9ef('0x81')](_0xca4789['apiKey'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1bb'));}if(!this['isConfigured'](_0xca4789['text'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x1bc'),_0xca4789[_0xc9ef('0x5b')]));var _0x227998=this[_0xc9ef('0x58')][_0xc9ef('0x6e')](this,_0xca4789);if(_0x227998){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x1bd'),_0x227998));var _0xaf53a2=this[_0xc9ef('0xe')][_0xc9ef('0x105')](_0x227998);try{fs[_0xc9ef('0x107')](_0x227998+_0xc9ef('0x108'));}catch(_0x39167d){logger[_0xc9ef('0x2d')](_0x39167d);}return _0xaf53a2;}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0xca4789,_0xc9ef('0x1be'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1bf')]=function(_0x524a04){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x524a04[_0xc9ef('0x39')]));_0x524a04['text']=_0x524a04['text'][_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc9ef('0x81')](_0x524a04[_0xc9ef('0x5b')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this['channel'][_0xc9ef('0xa8')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x524a04['text']));var _0x1861b1=this[_0xc9ef('0x60')][_0xc9ef('0x6e')](this,_0x524a04);if(_0x1861b1){this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Google\x20TTS\x20%s\x20file\x20created',_0x1861b1));var _0x1f93e9=this['channel'][_0xc9ef('0x105')](_0x1861b1);try{fs[_0xc9ef('0x107')](_0x1861b1+_0xc9ef('0x108'));}catch(_0x4a72a6){logger[_0xc9ef('0x2d')](_0x4a72a6);}return _0x1f93e9;}return this['channel'][_0xc9ef('0x2d')](_0x524a04,_0xc9ef('0x1c0'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c1')]=function(_0x490e87){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1c2'),_0x490e87[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x490e87[_0xc9ef('0x15b')])){return this[_0xc9ef('0xe')]['error'](_0x490e87,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));var _0x2e2e8c=this[_0xc9ef('0x52')]['sync'](this,_0x490e87[_0xc9ef('0x15b')]);if(_0x2e2e8c){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this['channel'][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c3')]=function(_0x4534d8){logger['info'](util['format'](_0xc9ef('0x1c4'),_0x4534d8[_0xc9ef('0x39')]));var _0x1251fc=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x1c5'),[_0x4534d8[_0xc9ef('0x1c6')],_0x4534d8['options']]);if(_0x1251fc[_0xc9ef('0xa2')]===-0x1){return _0x1251fc;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),'VOICEMAIL',_0x4534d8[_0xc9ef('0x1c6')]));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c7')]=function(_0x54b78f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x54b78f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x54b78f[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x54b78f,'no\x20variable\x20selected');}var _0x1145fa=this[_0xc9ef('0x10')]['sync'](this,_0x54b78f['variable_id']);if(!_0x1145fa){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x54b78f,_0xc9ef('0x11c'));}var _0x58b245=this['channel']['getVariable'](_0x1145fa);return{'code':0xc8,'result':_0x58b245[_0xc9ef('0x9f')]?_0x58b245['extra']:'-'};};String[_0xc9ef('0x14')]['replaceAll']=function(_0x5c1410,_0x2e42bd){return this[_0xc9ef('0x9e')](_0x5c1410)[_0xc9ef('0x1c8')](_0x2e42bd);};module['exports']=AGIVertices; \ No newline at end of file +var _0x486e=['getData','response','maxdigit','hiddendigitsnum','hiddendigitspos','first','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','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','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','prototype','getVariable','rpc','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProjectById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundPath','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','parse','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','render','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','isEmpty','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','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','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','retry','file_id','no\x20file\x20audio\x20found'];(function(_0x670ebb,_0x58a706){var _0x1065f3=function(_0x5383a1){while(--_0x5383a1){_0x670ebb['push'](_0x670ebb['shift']());}};_0x1065f3(++_0x58a706);}(_0x486e,0xb2));var _0xe486=function(_0x5c1353,_0x1cdbaa){_0x5c1353=_0x5c1353-0x0;var _0x5cceca=_0x486e[_0x5c1353];return _0x5cceca;};'use strict';var fs=require('fs');var util=require(_0xe486('0x0'));var _=require(_0xe486('0x1'));var sh=require('shelljs');var odbc=require(_0xe486('0x2'))();var rs=require(_0xe486('0x3'));var moment=require(_0xe486('0x4'));var Mustache=require(_0xe486('0x5'));var rp=require(_0xe486('0x6'));var logger=require(_0xe486('0x7'))(_0xe486('0x8'));var config=require(_0xe486('0x9'));var shared=require(_0xe486('0xa'));var scripts=require(_0xe486('0xb'));var FILES_PATH=_0xe486('0xc');var recursiveMapAttributes=['rawHeaders',_0xe486('0xd')];var verticesWithRetry=[_0xe486('0xe'),_0xe486('0xf'),_0xe486('0x10')];var AGIVertices=function(_0x369290,_0x3ab1f1,_0x42c4b3){this[_0xe486('0x11')]=_0x369290;this['rpc']=_0x3ab1f1;this['mailRpc']=_0x42c4b3;};AGIVertices[_0xe486('0x12')][_0xe486('0x13')]=function(_0x942207,_0xdd950){this[_0xe486('0x14')][_0xe486('0x15')](_0x942207)[_0xe486('0x16')](function(_0x11a0cf){_0xdd950(null,_0x11a0cf?_0x11a0cf[_0xe486('0x17')]:![]);})['catch'](function(_0x5a1aad){_0xdd950(_0x5a1aad);});};AGIVertices[_0xe486('0x12')][_0xe486('0x18')]=function(_0x15eb45,_0x564a6f){this['rpc'][_0xe486('0x19')](_0x15eb45)['then'](function(_0x32d056){_0x564a6f(null,_0x32d056?_0x32d056[_0xe486('0x17')]:![]);})[_0xe486('0x1a')](function(_0x355002){_0x564a6f(_0x355002);});};AGIVertices['prototype']['getSquareProject']=function(_0x41f593,_0x21fca9){this['rpc'][_0xe486('0x1b')](_0x41f593)['then'](function(_0x25e946){_0x21fca9(null,_0x25e946?_0x25e946[_0xe486('0x17')]:![]);})['catch'](function(_0xf57047){_0x21fca9(_0xf57047);});};AGIVertices[_0xe486('0x12')]['getSquareOdbc']=function(_0xf0697f,_0x32afde){this[_0xe486('0x14')]['getSquareOdbcById'](_0xf0697f)[_0xe486('0x16')](function(_0x301344){_0x32afde(null,_0x301344?_0x301344[_0xe486('0x1c')]:![]);})[_0xe486('0x1a')](function(_0x4650bf){_0x32afde(_0x4650bf);});};AGIVertices[_0xe486('0x12')][_0xe486('0x1d')]=function(_0xdc43f0,_0x5b61cc){this[_0xe486('0x14')]['getUserById'](_0xdc43f0)[_0xe486('0x16')](function(_0x50ae4c){_0x5b61cc(null,_0x50ae4c?_0x50ae4c[_0xe486('0x17')]:![]);})['catch'](function(_0x39113f){_0x5b61cc(_0x39113f);});};AGIVertices[_0xe486('0x12')][_0xe486('0x1e')]=function(_0x9f77fc,_0x54199a){this[_0xe486('0x14')][_0xe486('0x1f')](_0x9f77fc)[_0xe486('0x16')](function(_0x2a92b7){_0x54199a(null,_0x2a92b7?_0x2a92b7[_0xe486('0x17')]:![]);})[_0xe486('0x1a')](function(_0x5dca61){_0x54199a(_0x5dca61);});};AGIVertices[_0xe486('0x12')][_0xe486('0x20')]=function(_0x502b4c,_0x87ece6){var _0x49891a=this;this[_0xe486('0x14')]['getSoundById'](_0x502b4c)[_0xe486('0x16')](function(_0x360ab7){_0x87ece6(null,_0x360ab7?_0x49891a[_0xe486('0x21')](_0x360ab7['save_name']):![]);})[_0xe486('0x1a')](function(_0x576888){_0x87ece6(_0x576888);});};AGIVertices['prototype'][_0xe486('0x22')]=function(_0x1c6d22,_0x22a1c9){this[_0xe486('0x14')][_0xe486('0x23')](_0x1c6d22)[_0xe486('0x16')](function(_0x39b179){_0x22a1c9(null,_0x39b179?_0x39b179:![]);})['catch'](function(_0x5d6f76){_0x22a1c9(_0x5d6f76);});};AGIVertices[_0xe486('0x12')]['sendMailMessage']=function(_0x2cda47,_0x50c8d,_0x3e8152){this[_0xe486('0x24')][_0xe486('0x25')](_0x2cda47,_0x50c8d)['then'](function(){_0x3e8152(null);})[_0xe486('0x1a')](function(_0x60a03){_0x3e8152(_0x60a03);});};AGIVertices[_0xe486('0x12')][_0xe486('0x26')]=function(_0x565658,_0xf4e6d4){this[_0xe486('0x14')][_0xe486('0x27')](_0x565658)['then'](function(_0x19779f){if(_0x19779f){if(_0x19779f[_0xe486('0x28')]){_0xf4e6d4(null,[_0x19779f[_0xe486('0x29')]]);}else{_0xf4e6d4(null,_[_0xe486('0x2a')](_0x19779f['Intervals'],_0xe486('0x29')));}}else{_0xf4e6d4(null,![]);}})[_0xe486('0x1a')](function(_0x3602ad){_0xf4e6d4(_0x3602ad);});};AGIVertices[_0xe486('0x12')]['getSoundPath']=function(_0x5944f3){return util[_0xe486('0x2b')](_0xe486('0x2c'),FILES_PATH,_0x5944f3);};AGIVertices[_0xe486('0x12')][_0xe486('0x2d')]=function(_0x4f9425,_0x1f2094,_0x30612e){odbc[_0xe486('0x2e')](_0x4f9425,function(_0x5dc441){if(_0x5dc441){logger[_0xe486('0x2f')](_0xe486('0x30'),_0x5dc441);_0x30612e(_0x5dc441);}else{logger[_0xe486('0x31')](_0xe486('0x32'));odbc['query'](_0x1f2094,function(_0x4f2f78,_0x312b17){if(_0x4f2f78){logger[_0xe486('0x31')](_0xe486('0x33'),_0x1f2094);_0x30612e(_0x4f2f78);}else{logger[_0xe486('0x31')]('Query\x20executed\x20correctly\x20%s',_0x1f2094);odbc[_0xe486('0x34')](function(_0x5c6fde){if(_0x5c6fde){logger[_0xe486('0x2f')](_0xe486('0x35'),_0x5c6fde);}_0x30612e(null,_0x312b17);});}});}});};AGIVertices[_0xe486('0x12')][_0xe486('0x36')]=function(_0x429974,_0x178fcc){this['rpc'][_0xe486('0x37')](_0x429974)['then'](function(_0x28899d){_0x178fcc(null,_0x28899d?_0x28899d:![]);})[_0xe486('0x1a')](function(_0x1ba5e3){_0x178fcc(_0x1ba5e3);});};AGIVertices['prototype'][_0xe486('0x38')]=function(_0x4e846c,_0x3dfeb2){this[_0xe486('0x14')][_0xe486('0x38')](_0x4e846c)['then'](function(_0x36ec31){_0x3dfeb2(null,_0x36ec31);})['catch'](function(_0x16fbe0){_0x3dfeb2(_0x16fbe0);});};AGIVertices[_0xe486('0x12')]['createSquareDetailsReport']=function(_0x312a3a,_0x23762a,_0x1f2c56){this[_0xe486('0x14')][_0xe486('0x39')]({'uniqueid':this[_0xe486('0x11')]['uniqueid'],'node':_0x312a3a[_0xe486('0x3a')],'application':_0x312a3a[_0xe486('0x3b')],'data':_0x23762a||null,'project_name':this['channel'][_0xe486('0x3c')],'callerid':this['channel'][_0xe486('0x3d')]})[_0xe486('0x16')](function(_0x49dcb8){if(_0x1f2c56){_0x1f2c56(null,_0x49dcb8);}})[_0xe486('0x1a')](function(_0x160881){if(_0x1f2c56){_0x1f2c56(_0x160881);}});};AGIVertices[_0xe486('0x12')]['createSquareRecording']=function(_0x204a3e,_0x226b4d,_0x2cd11c,_0x9eea1e){this['rpc'][_0xe486('0x3e')]({'uniqueid':this[_0xe486('0x11')][_0xe486('0x3f')],'callerid':this[_0xe486('0x11')][_0xe486('0x3d')],'calleridname':this[_0xe486('0x11')][_0xe486('0x40')],'context':this['channel'][_0xe486('0x41')],'extension':this[_0xe486('0x11')]['extension'],'priority':this[_0xe486('0x11')][_0xe486('0x42')],'accountcode':this['channel'][_0xe486('0x43')],'dnid':this[_0xe486('0x11')][_0xe486('0x44')],'projectName':this[_0xe486('0x11')][_0xe486('0x3c')],'saveName':_0x226b4d,'filename':_0x204a3e[_0xe486('0x45')]||_0x226b4d,'savePath':_0x2cd11c})[_0xe486('0x16')](function(_0x4cded5){_0x9eea1e(null,_0x4cded5);})[_0xe486('0x1a')](function(_0x216161){_0x9eea1e(_0x216161);});};AGIVertices['prototype'][_0xe486('0x46')]=function(_0x26e8c5,_0x442b16,_0x2dde37,_0x3f1676,_0x441d77){this['rpc'][_0xe486('0x46')]({'uniqueid':this[_0xe486('0x11')]['uniqueid'],'body':_0x26e8c5,'direction':_0x442b16,'providerName':_0x2dde37,'providerResponse':_0x3f1676})[_0xe486('0x16')](function(_0x1e40e1){if(_0x441d77){_0x441d77(null,_0x1e40e1);}})[_0xe486('0x1a')](function(_0x1161d2){if(_0x441d77){_0x441d77(_0x1161d2);}});};AGIVertices[_0xe486('0x12')][_0xe486('0x47')]=function(_0x200478,_0x3f23c3){this[_0xe486('0x14')][_0xe486('0x47')]({'firstName':_['isEmpty'](_0x200478[_0xe486('0x17')])||_[_0xe486('0x48')](_0x200478[_0xe486('0x17')])?_0xe486('0x49')+Math[_0xe486('0x4a')]():_0x200478[_0xe486('0x17')],'lastName':_['isEmpty'](_0x200478[_0xe486('0x4b')])||_[_0xe486('0x48')](_0x200478['lastName'])?null:_0x200478[_0xe486('0x4b')],'phone':_0x200478['phone'],'ListId':_0x200478['list_id'],'scheduledat':_0x200478[_0xe486('0x4c')],'callbackUniqueid':this[_0xe486('0x11')][_0xe486('0x3f')],'tags':'callback','description':_0xe486('0x4d')+_0x200478['scheduledAt'][_0xe486('0x4e')](),'priority':_0x200478['callback_priority']})[_0xe486('0x16')](function(_0x564408){_0x3f23c3(null,_0x564408);})['catch'](function(_0x5c05be){_0x3f23c3(_0x5c05be);});};AGIVertices[_0xe486('0x12')][_0xe486('0x4f')]=function(_0x216de0,_0x2d6948){this[_0xe486('0x14')][_0xe486('0x50')](_0x216de0)['then'](function(_0x54ef31){_0x2d6948(null,_0x54ef31?_0x54ef31[_0xe486('0x17')]:![]);})['catch'](function(_0x34da2b){_0x2d6948(_0x34da2b);});};AGIVertices[_0xe486('0x12')][_0xe486('0x51')]=function(_0x50732c,_0x589d6a,_0x17cf02){var _0xf9ad81={'role':_0xe486('0x52')};_0xf9ad81[_0x50732c]=this[_0xe486('0x11')][_0xe486('0x3d')];this[_0xe486('0x14')][_0xe486('0x51')](_0xf9ad81,_0x589d6a,this[_0xe486('0x11')][_0xe486('0x3f')])['then'](function(_0x483b7b){_0x17cf02(null,_[_0xe486('0x48')](_0x483b7b)?![]:!![]);})[_0xe486('0x1a')](function(_0x1ce720){logger[_0xe486('0x2f')](_0x1ce720);_0x17cf02(null,![]);});};AGIVertices[_0xe486('0x12')][_0xe486('0x53')]=function(_0x532923,_0x5c25ea){var _0x13929b={'role':_0xe486('0x52')};_0x13929b[_0x532923]=this[_0xe486('0x11')][_0xe486('0x3d')];this[_0xe486('0x14')][_0xe486('0x53')](_0x13929b)['then'](function(_0x2b4ea4){_0x5c25ea(null,_[_0xe486('0x48')](_0x2b4ea4)?![]:!![]);})[_0xe486('0x1a')](function(_0x2c98b7){logger['error'](_0x2c98b7);_0x5c25ea(null,![]);});};AGIVertices[_0xe486('0x12')][_0xe486('0x54')]=function(_0x4bb6fb,_0x29d6e8){var _0x2e329f={'role':_0xe486('0x52')};_0x2e329f[_0x4bb6fb]=this[_0xe486('0x11')]['callerid'];this[_0xe486('0x14')][_0xe486('0x54')](_0x2e329f)[_0xe486('0x16')](function(_0x1f5eae){_0x29d6e8(null,_['isNil'](_0x1f5eae)?![]:!![]);})[_0xe486('0x1a')](function(_0x290dc1){logger[_0xe486('0x2f')](_0x290dc1);_0x29d6e8(null,![]);});};AGIVertices[_0xe486('0x12')][_0xe486('0x55')]=function(_0x32b1f2,_0x448ce3){var _0x38fa48={'role':'agent'};_0x38fa48[_0x32b1f2]=this[_0xe486('0x11')][_0xe486('0x3d')];var _0x1a9aa6=_0x32b1f2!=_0xe486('0x56')?util[_0xe486('0x2b')](_0xe486('0x57'),'LOCAL',this['channel'][_0xe486('0x3d')]):undefined;this['rpc'][_0xe486('0x55')](_0x38fa48,_0x1a9aa6)[_0xe486('0x16')](function(_0x340476){_0x448ce3(null,_[_0xe486('0x48')](_0x340476)?![]:!![]);})[_0xe486('0x1a')](function(_0x22b50d){logger[_0xe486('0x2f')](_0x22b50d);_0x448ce3(null,![]);});};AGIVertices[_0xe486('0x12')][_0xe486('0x58')]=function(_0x16bed8,_0x3964fb){sh[_0xe486('0x59')](_[_0xe486('0x5a')](_0x16bed8),function(_0x1eb87a,_0x333a1f){var _0x4b2c50=_0x333a1f['replace'](/(\r\n|\n|\r)/gm,'');_0x3964fb(null,_0x4b2c50);});};AGIVertices['prototype'][_0xe486('0x5b')]=function(_0x2b3be3,_0x52af18){scripts[_0xe486('0x5b')](_0x2b3be3[_0xe486('0x5c')],_0x2b3be3['google_cloud_tts_text_type']||'text',_0x2b3be3[_0xe486('0x5d')],_0x2b3be3[_0xe486('0x5e')]||'en-US',_0x2b3be3['ssmlGender']||_0xe486('0x5f'),_0x2b3be3[_0xe486('0x60')]||_0xe486('0x61'))[_0xe486('0x16')](function(_0x4ff42b){_0x52af18(null,_0x4ff42b);})[_0xe486('0x1a')](function(_0x1df3c9){_0x52af18(_0x1df3c9);});};AGIVertices[_0xe486('0x12')][_0xe486('0x62')]=function(_0x3fa8f5,_0x565377){scripts[_0xe486('0x62')](_0x3fa8f5[_0xe486('0x5d')],_0x3fa8f5[_0xe486('0x63')]||'en',0x1)['then'](function(_0x3ce3f3){_0x565377(null,_0x3ce3f3);})[_0xe486('0x1a')](function(_0x5b61ef){_0x565377(_0x5b61ef);});};AGIVertices[_0xe486('0x12')][_0xe486('0x64')]=function(_0x4ebe94,_0x4a515d){var _0x3af59b={'uri':_0x4ebe94[_0xe486('0x65')],'method':_0x4ebe94[_0xe486('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4ebe94[_0xe486('0x67')])===_0xe486('0x68')&&parseInt(_0x4ebe94[_0xe486('0x67')])>=0x1?parseInt(_0x4ebe94[_0xe486('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xe486('0x69')](['POST',_0xe486('0x6a')],_0x3af59b['method'][_0xe486('0x6b')]())){try{_0x3af59b['body']=_0x4ebe94[_0xe486('0xd')]?JSON[_0xe486('0x6c')](_0x4ebe94[_0xe486('0xd')]):{};}catch(_0x403cb1){logger[_0xe486('0x2f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x403cb1);}}try{_0x3af59b[_0xe486('0x6d')]=_0x4ebe94[_0xe486('0x6e')]?JSON[_0xe486('0x6c')](_0x4ebe94[_0xe486('0x6e')]):{};}catch(_0x5d2e4f){logger[_0xe486('0x2f')](_0xe486('0x6f'),_0x5d2e4f);}if(_0x4ebe94['computedVariables']){try{var _0x4e1b7f=require(_0x4ebe94['computedVariables'])[_0xe486('0x70')](this,_0x3af59b);_0x3af59b['uri']=Mustache[_0xe486('0x71')](_0x4ebe94[_0xe486('0x65')],_0x4e1b7f,{},['$$','$$']);if(_0x3af59b[_0xe486('0x6d')]){_0x3af59b['headers']=JSON[_0xe486('0x6c')](Mustache[_0xe486('0x71')](JSON[_0xe486('0x72')](_0x3af59b[_0xe486('0x6d')]),_0x4e1b7f,{},['$$','$$']));}if(_0x3af59b['body']){_0x3af59b[_0xe486('0x73')]=JSON[_0xe486('0x6c')](Mustache[_0xe486('0x71')](JSON[_0xe486('0x72')](_0x3af59b[_0xe486('0x73')]),_0x4e1b7f,{},['$$','$$']));}}catch(_0x6479c1){logger[_0xe486('0x2f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x6479c1);}}rp(_0x3af59b)[_0xe486('0x16')](function(_0x3603d2){var _0x189b36={'statusCode':_0x3603d2[_0xe486('0x74')]||0xc8,'statusMessage':_0x3603d2[_0xe486('0x75')]||'OK','headers':_0x3603d2['headers']||{},'body':_0x3603d2['body']||{}};_0x4a515d(null,_0x189b36);})[_0xe486('0x1a')](function(_0xd91161){var _0x171aaf={'statusCode':_0xd91161[_0xe486('0x74')]||0x1f4,'statusMessage':_0xd91161[_0xe486('0x76')]||_0xe486('0x77'),'headers':_0xd91161[_0xe486('0x78')]['headers']||{},'body':_0xd91161[_0xe486('0x78')][_0xe486('0x73')]||{}};_0x4a515d(null,_0x171aaf);});};AGIVertices[_0xe486('0x12')]['googleDialogflow']=function(_0x826b2e,_0x4664fe){scripts[_0xe486('0x79')](this[_0xe486('0x11')][_0xe486('0x3f')],_0x826b2e[_0xe486('0x7a')],_0x826b2e[_0xe486('0x5d')],_0x826b2e[_0xe486('0x7b')]||'en')[_0xe486('0x16')](function(_0x1d89e6){_0x4664fe(null,_0x1d89e6);})[_0xe486('0x1a')](function(_0x1f008f){_0x4664fe(_0x1f008f);});};AGIVertices[_0xe486('0x12')][_0xe486('0x7c')]=function(_0x26f824,_0x5e3600){scripts[_0xe486('0x7c')](this[_0xe486('0x11')][_0xe486('0x3f')],_0x26f824[_0xe486('0x7d')],_0x26f824[_0xe486('0x7e')],_0x26f824[_0xe486('0x7f')],_0x26f824[_0xe486('0x5d')],_0x26f824[_0xe486('0x80')]||'en')[_0xe486('0x16')](function(_0x27c805){_0x5e3600(null,_0x27c805);})[_0xe486('0x1a')](function(_0x19104e){_0x5e3600(_0x19104e);});};AGIVertices[_0xe486('0x12')][_0xe486('0x81')]=function(_0x8e419c,_0x257332){scripts[_0xe486('0x81')](this['channel'],_0x8e419c)['then'](function(_0x540206){_0x257332(null,_0x540206);})[_0xe486('0x1a')](function(_0x1f7cb5){_0x257332(_0x1f7cb5);});};AGIVertices['prototype'][_0xe486('0x82')]=function(_0x3d0a3f,_0x56f4cc){scripts[_0xe486('0x82')](_0x3d0a3f[_0xe486('0x7a')],_0x3d0a3f[_0xe486('0x5d')],_0x3d0a3f[_0xe486('0x83')]||_0xe486('0x84'),_0x3d0a3f[_0xe486('0x85')])[_0xe486('0x16')](function(_0x5d5364){_0x56f4cc(null,_0x5d5364);})[_0xe486('0x1a')](function(_0x397ed6){_0x56f4cc(_0x397ed6);});};AGIVertices[_0xe486('0x12')]['ispeechASR']=function(_0x13e53f,_0x36e7b6,_0x363ba2){scripts[_0xe486('0x86')](_0x36e7b6,_0x13e53f['key'],_0x13e53f[_0xe486('0x87')]||_0xe486('0x84'),this[_0xe486('0x88')](_0x13e53f[_0xe486('0x89')])?_0x13e53f[_0xe486('0x89')]:undefined)[_0xe486('0x16')](function(_0x3b199a){_0x363ba2(null,_0x3b199a);})[_0xe486('0x1a')](function(_0x3c1e01){_0x363ba2(_0x3c1e01);});};AGIVertices[_0xe486('0x12')][_0xe486('0x8a')]=function(_0x6df042,_0x565485){scripts[_0xe486('0x8a')](_0x6df042[_0xe486('0x8b')],_0x6df042[_0xe486('0x8c')],_0x6df042['aws_polly_region'],_0x6df042[_0xe486('0x8d')]||_0xe486('0x8e'),_0x6df042['text'],_0x6df042[_0xe486('0x8f')]||_0xe486('0x5d'))[_0xe486('0x16')](function(_0x9c36){_0x565485(null,_0x9c36);})[_0xe486('0x1a')](function(_0x123f0e){_0x565485(_0x123f0e);});};AGIVertices['prototype'][_0xe486('0x90')]=function(_0x4e7029,_0x4161d4){scripts[_0xe486('0x90')](this[_0xe486('0x11')]['uniqueid'],_0x4e7029[_0xe486('0x8b')],_0x4e7029[_0xe486('0x8c')],_0x4e7029[_0xe486('0x91')],_0x4e7029[_0xe486('0x5d')],_0x4e7029[_0xe486('0x92')])[_0xe486('0x16')](function(_0x1c1602){_0x4161d4(null,_0x1c1602);})[_0xe486('0x1a')](function(_0x39bb93){_0x4161d4(_0x39bb93);});};AGIVertices[_0xe486('0x12')][_0xe486('0x93')]=function(_0x168469,_0x13ceae,_0x252b68){scripts[_0xe486('0x93')](_0x13ceae,_0x168469[_0xe486('0x7a')],_0x168469[_0xe486('0x94')]||_0xe486('0x84'))['then'](function(_0x22d5e6){_0x252b68(null,_0x22d5e6);})[_0xe486('0x1a')](function(_0x47c86c){_0x252b68(_0x47c86c);});};AGIVertices[_0xe486('0x12')][_0xe486('0x95')]=function(_0x46c347,_0x4e6560,_0x82b446){scripts['tildeASR'](_0x4e6560,_0x46c347[_0xe486('0x96')],_0x46c347[_0xe486('0x97')],_0x46c347['uri'])[_0xe486('0x16')](function(_0x3fcd3d){_0x82b446(null,_0x3fcd3d);})['catch'](function(_0x193e63){_0x82b446(_0x193e63);});};AGIVertices[_0xe486('0x12')]['clear']=function(_0x1394e5){var _0x20e28c=_['includes'](verticesWithRetry,_0x1394e5[_0xe486('0x3b')])?_0x1394e5:_[_0xe486('0x98')](_0x1394e5);for(var _0x2c172e in _0x20e28c){if(_0x20e28c['hasOwnProperty'](_0x2c172e)){if(_0x20e28c[_0x2c172e]&&_[_0xe486('0x99')](_0x20e28c[_0x2c172e])){if(_[_0xe486('0x69')](recursiveMapAttributes,_0x2c172e)){_0x20e28c[_0x2c172e]=this[_0xe486('0x9a')](_0x20e28c[_0x2c172e]);}else{_0x20e28c[_0x2c172e]=this['replaceAllVariables'](_0x20e28c[_0x2c172e]);}}}}return _0x20e28c;};AGIVertices[_0xe486('0x12')][_0xe486('0x9b')]=function(_0x18b517){for(var _0x31f489 in _0x18b517){if(_0x18b517[_0xe486('0x9c')](_0x31f489)){if(_[_0xe486('0x9d')](_0x18b517[_0x31f489])){this['recursiveNodeIndex'](_0x18b517[_0x31f489]);}else if(_[_0xe486('0x9e')](_0x18b517[_0x31f489])){for(var _0x57fe91=0x0;_0x57fe91<_0x18b517[_0x31f489][_0xe486('0x9f')];_0x57fe91++){this['recursiveNodeIndex'](_0x18b517[_0x31f489][_0x57fe91]);}}else if(_['isString'](_0x18b517[_0x31f489])){_0x18b517[_0x31f489]=this[_0xe486('0xa0')](_0x18b517[_0x31f489]);}}}};AGIVertices['prototype'][_0xe486('0xa1')]=function(_0x2561ae,_0x20031f){for(var _0x237f55 in _0x2561ae){if(_0x2561ae[_0xe486('0x9c')](_0x237f55)){if(_[_0xe486('0x9d')](_0x2561ae[_0x237f55])){if(!_[_0xe486('0xa2')](_0x2561ae[_0x237f55])){this[_0xe486('0xa1')](_0x2561ae[_0x237f55],util[_0xe486('0x2b')]('%s.%s',_0x20031f,_0x237f55));}}else if(_[_0xe486('0x9e')](_0x2561ae[_0x237f55])){for(var _0x5b6e98=0x0;_0x5b6e98<_0x2561ae[_0x237f55][_0xe486('0x9f')];_0x5b6e98++){this[_0xe486('0xa1')](_0x2561ae[_0x237f55][_0x5b6e98],util[_0xe486('0x2b')](_0xe486('0xa3'),_0x20031f,_0x237f55+'['+_0x5b6e98+']'));}}else{if(!_[_0xe486('0x48')](_0x2561ae[_0x237f55])){this[_0xe486('0x11')][_0xe486('0xa4')](util['format'](_0xe486('0xa3'),_0x20031f,_0x237f55),_0x2561ae[_0x237f55]);}}}}};AGIVertices[_0xe486('0x12')][_0xe486('0x9a')]=function(_0x24736e){try{var _0x5571b4=JSON[_0xe486('0x6c')](_0x24736e);this[_0xe486('0x9b')](_0x5571b4);return JSON['stringify'](_0x5571b4);}catch(_0x1fb61a){return this[_0xe486('0xa0')](_0x24736e);}};AGIVertices[_0xe486('0x12')][_0xe486('0xa0')]=function(_0x4d306b){var _0x4ae6a8=_0x4d306b[_0xe486('0xa5')]('{');for(var _0x223b12=0x1;_0x223b12<_0x4ae6a8[_0xe486('0x9f')];_0x223b12+=0x1){var _0x5dd9eb=_0x4ae6a8[_0x223b12]['split']('}');if(_0x5dd9eb['length']>0x1){_0x4d306b=_0x4d306b[_0xe486('0xa6')]('{'+_0x5dd9eb[0x0]+'}',this['channel'][_0xe486('0x13')](_0x5dd9eb[0x0])[_0xe486('0xa7')]||_0x5dd9eb[0x0]);}}if(_0x4ae6a8[_0xe486('0x9f')]===0x1){return _0x4d306b[_0xe486('0x4e')]();}return this[_0xe486('0xa0')](_0x4d306b);};AGIVertices[_0xe486('0x12')][_0xe486('0xa8')]=function(_0x193786,_0x24492f){var _0x562651=this['channel'][_0xe486('0x13')](_0x193786);if(_0x562651[_0xe486('0xa9')]===-0x1){return _0x562651;}logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0xaa'),_0x24492f,_0x562651[_0xe486('0xa7')]));return this[_0xe486('0x11')][_0xe486('0xa4')](_0x24492f,_0x562651['extra']);};AGIVertices[_0xe486('0x12')][_0xe486('0x88')]=function(_0x5b4fc1){return _0x5b4fc1&&_0x5b4fc1!=='0'&&_0x5b4fc1!=='-1'&&_0x5b4fc1!=='';};AGIVertices[_0xe486('0x12')][_0xe486('0xab')]=function(_0x3617f2){this[_0xe486('0x39')]['sync'](this,_0x3617f2,'-');_0x3617f2['retry']=_0x3617f2[_0xe486('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe486('0x12')][_0xe486('0xac')]=function(_0x2f4e07){logger[_0xe486('0x31')](util[_0xe486('0x2b')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2f4e07['label']));if(!this[_0xe486('0x88')](_0x2f4e07[_0xe486('0x5d')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xae'));}var _0x4a0e77='\x22'+_0x2f4e07[_0xe486('0x5d')]+'\x22';if(this[_0xe486('0x88')](_0x2f4e07['options'])){_0x4a0e77+=','+_0x2f4e07[_0xe486('0x78')];}var _0x402d0e=this[_0xe486('0x11')][_0xe486('0x59')](_0xe486('0xaf'),_0x4a0e77);if(_0x402d0e[_0xe486('0xa9')]===-0x1){return _0x402d0e;}return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0xb0'),_0x4a0e77));};AGIVertices[_0xe486('0x12')][_0xe486('0xb1')]=function(_0x1dbd7f){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0xb2'),_0x1dbd7f[_0xe486('0x3a')]));if(!this['isConfigured'](_0x1dbd7f[_0xe486('0xb3')])){return this[_0xe486('0x11')]['noop'](_0xe486('0xb4'));}var _0xe0edad=_0x1dbd7f['grammar'];if(this[_0xe486('0x88')](_0x1dbd7f[_0xe486('0x78')])){_0xe0edad+=','+_0x1dbd7f['options'];}var _0x4e2c40=this[_0xe486('0x11')][_0xe486('0x59')](_0xe486('0xb5'),_0xe0edad);if(_0x4e2c40[_0xe486('0xa9')]===-0x1){return _0x4e2c40;}var _0x13bc1a=this[_0xe486('0xa8')]('RECOG_CONFIDENCE()',_0xe486('0xb6'));if(_0x13bc1a[_0xe486('0xa9')]===-0x1){return _0x13bc1a;}var _0x282230=this[_0xe486('0xa8')](_0xe486('0xb7'),'MRCP_RECOG_TRANSCRIPT');if(_0x282230['result']===-0x1){return _0x282230;}var _0x789415=this[_0xe486('0xa8')]('RECOG_INSTANCE()',_0xe486('0xb8'));if(_0x789415[_0xe486('0xa9')]===-0x1){return _0x789415;}return this[_0xe486('0x11')][_0xe486('0xad')](util['format'](_0xe486('0xb9'),_0xe0edad));};AGIVertices[_0xe486('0x12')][_0xe486('0x8')]=function(_0x23779e){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0xba'),_0x23779e[_0xe486('0x3a')]));return this[_0xe486('0x11')][_0xe486('0x8')]([_0x23779e[_0xe486('0xbb')],_0x23779e[_0xe486('0xbc')]]);};AGIVertices[_0xe486('0x12')][_0xe486('0xbd')]=function(_0x5beb15){logger['info'](util['format'](_0xe486('0xbe'),_0x5beb15[_0xe486('0x3a')]));if(this[_0xe486('0x88')](_0x5beb15['timeout'])){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0xbf'),_0x5beb15[_0xe486('0x67')]));var _0x1f278a=this[_0xe486('0x11')][_0xe486('0xc0')](_0x5beb15[_0xe486('0x67')]);if(_0x1f278a[_0xe486('0xa9')]===-0x1){return _0x1f278a;}}return this['channel']['answer']();};AGIVertices[_0xe486('0x12')][_0xe486('0xc1')]=function(_0x25d0df){logger[_0xe486('0x31')](util['format'](_0xe486('0xc2'),_0x25d0df[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x25d0df[_0xe486('0xc3')])){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x25d0df,_0xe486('0xc4'));}_0x25d0df[_0xe486('0x4c')]=moment();if(this['isConfigured'](_0x25d0df[_0xe486('0xc5')])){_0x25d0df['scheduledAt']=moment()[_0xe486('0xc6')](_0x25d0df['delay'],_0xe486('0xc7'));}if(!this['isConfigured'](_0x25d0df[_0xe486('0xc8')])){_0x25d0df[_0xe486('0xc8')]=0x2;}this['createCmContact'][_0xe486('0x70')](this,_0x25d0df);return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0xc9'),_0x25d0df[_0xe486('0xca')],_0x25d0df[_0xe486('0xc3')],_0x25d0df[_0xe486('0x4c')]));};AGIVertices['prototype']['custom_app']=function(_0x342882){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0xcb'),_0x342882[_0xe486('0x3a')]));var _0x38ebac=this[_0xe486('0x11')][_0xe486('0x59')](_0x342882['application'],_0x342882[_0xe486('0x78')]);if(_0x38ebac['result']===-0x1){return _0x38ebac;}return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')]('Executed\x20command\x20%s\x20%s',_0x342882['application'],_0x342882['options']));};AGIVertices[_0xe486('0x12')][_0xe486('0xcc')]=function(_0x20eed0){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0xcd'),_0x20eed0['label']));if(!this['isConfigured'](_0x20eed0['text'])){return this[_0xe486('0x11')][_0xe486('0xad')]('no\x20text\x20configured');}var _0x5b3ef4='\x22'+_0x20eed0[_0xe486('0x5d')]+'\x22';if(this[_0xe486('0x88')](_0x20eed0[_0xe486('0x78')])){_0x5b3ef4+=','+_0x20eed0[_0xe486('0x78')];}var _0x28f551=this[_0xe486('0x11')][_0xe486('0x59')](_0xe486('0xaf'),_0x5b3ef4);if(_0x28f551[_0xe486('0xa9')]===-0x1){return _0x28f551;}return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0xb0'),_0x5b3ef4));};AGIVertices[_0xe486('0x12')][_0xe486('0xce')]=function(_0x3222af){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0xcf'),_0x3222af[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x3222af['text'])){return this[_0xe486('0x11')][_0xe486('0xad')]('no\x20text\x20configured');}var _0x44e0b0='\x22'+_0x3222af[_0xe486('0x5d')]+'\x22';if(this[_0xe486('0x88')](_0x3222af[_0xe486('0x78')])){_0x44e0b0+=','+_0x3222af['options'];}var _0x595ef6=this['channel']['exec'](_0xe486('0xaf'),_0x44e0b0);if(_0x595ef6[_0xe486('0xa9')]===-0x1){return _0x595ef6;}return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0xb0'),_0x44e0b0));};AGIVertices[_0xe486('0x12')]['lumenvoxasr']=function(_0x372335){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0xd0'),_0x372335[_0xe486('0x3a')]));if(!this['isConfigured'](_0x372335[_0xe486('0xb3')])){return this['channel']['noop'](_0xe486('0xb4'));}var _0x9a56fb=_0x372335[_0xe486('0xb3')];if(this[_0xe486('0x88')](_0x372335[_0xe486('0x78')])){_0x9a56fb+=','+_0x372335[_0xe486('0x78')];}var _0x32cbcc=this[_0xe486('0x11')][_0xe486('0x59')](_0xe486('0xb5'),_0x9a56fb);if(_0x32cbcc[_0xe486('0xa9')]===-0x1){return _0x32cbcc;}var _0x5282ba=this[_0xe486('0xa8')](_0xe486('0xd1'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5282ba[_0xe486('0xa9')]===-0x1){return _0x5282ba;}var _0x55a64b=this[_0xe486('0xa8')](_0xe486('0xb7'),_0xe486('0xd2'));if(_0x55a64b['result']===-0x1){return _0x55a64b;}var _0x30cf3c=this[_0xe486('0xa8')]('RECOG_INSTANCE()',_0xe486('0xd3'));if(_0x30cf3c[_0xe486('0xa9')]===-0x1){return _0x30cf3c;}return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0xb9'),_0x9a56fb));};AGIVertices['prototype'][_0xe486('0xd4')]=function(_0x5943ba){logger[_0xe486('0x31')](util[_0xe486('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5943ba[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x5943ba[_0xe486('0xb3')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xb4'));}var _0x4ecd0c=_0x5943ba[_0xe486('0xb3')];if(this[_0xe486('0x88')](_0x5943ba[_0xe486('0x78')])){_0x4ecd0c+=','+_0x5943ba['options'];}var _0x1da8e9=this[_0xe486('0x11')][_0xe486('0x59')]('MRCPRecog',_0x4ecd0c);if(_0x1da8e9[_0xe486('0xa9')]===-0x1){return _0x1da8e9;}var _0x1d6939=this[_0xe486('0xa8')](_0xe486('0xd1'),_0xe486('0xd5'));if(_0x1d6939[_0xe486('0xa9')]===-0x1){return _0x1d6939;}var _0x40c735=this[_0xe486('0xa8')](_0xe486('0xb7'),_0xe486('0xd6'));if(_0x40c735['result']===-0x1){return _0x40c735;}var _0x5ce9d0=this['getAndSetVariable'](_0xe486('0xd7'),_0xe486('0xd8'));if(_0x5ce9d0[_0xe486('0xa9')]===-0x1){return _0x5ce9d0;}return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0xb9'),_0x4ecd0c));};AGIVertices[_0xe486('0x12')][_0xe486('0xd9')]=function(_0x3ffc27){logger[_0xe486('0x31')](util['format'](_0xe486('0xda'),_0x3ffc27[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x3ffc27[_0xe486('0xdb')])){return this[_0xe486('0x11')]['error'](_0x3ffc27,_0xe486('0xdc'));}var _0x5f29e5=this[_0xe486('0xdd')]['sync'](this,_0x3ffc27['odbc_id']);if(!_0x5f29e5){return this[_0xe486('0x11')]['error'](_0x3ffc27,_0xe486('0xde'));}if(!this[_0xe486('0x88')](_0x3ffc27[_0xe486('0xdf')])){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x3ffc27,'no\x20query\x20configured');}var _0x3a1f39=_0x3ffc27['query'][_0xe486('0xe0')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xe486('0xad')](util['format'](_0xe486('0xe1'),_0x3a1f39));var _0x5acd6=this['getQueryOdbc'][_0xe486('0x70')](this,_0x5f29e5,_0x3a1f39);this['createSquareDetailsReport'][_0xe486('0x70')](this,_0x3ffc27,_0x3a1f39);if(!this[_0xe486('0x88')](_0x3ffc27[_0xe486('0xe2')])){return this[_0xe486('0x11')]['noop'](_0xe486('0xe3'));}var _0x4ada2d=this[_0xe486('0x13')][_0xe486('0x70')](this,_0x3ffc27[_0xe486('0xe2')]);if(!_0x4ada2d){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x3ffc27,_0xe486('0xe4'));}var _0x33e4cc=this;_0x5acd6[_0xe486('0xe5')](function(_0x1682a9,_0x439bd1){Object[_0xe486('0xe6')](_0x1682a9)[_0xe486('0xe5')](function(_0x11e7f0){_0x33e4cc[_0xe486('0x11')][_0xe486('0xa4')](util[_0xe486('0x2b')](_0xe486('0xe7'),_0x4ada2d,_0x439bd1,_0x11e7f0),_0x1682a9[_0x11e7f0]);});});this[_0xe486('0x11')]['setVariable'](util[_0xe486('0x2b')](_0xe486('0xe8'),_0x4ada2d),_0x5acd6[_0xe486('0x9f')]);return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')]('variable\x20%s\x20set',_0x4ada2d));};AGIVertices['prototype'][_0xe486('0xe9')]=function(_0x535274){logger[_0xe486('0xea')](util[_0xe486('0x2b')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x535274['label']));if(!this[_0xe486('0x88')](_0x535274['sip_id'])){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x535274,'no\x20user\x20selected');}var _0x1a804d=this[_0xe486('0x1d')][_0xe486('0x70')](this,_0x535274[_0xe486('0xeb')]);if(!_0x1a804d){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x535274,_0xe486('0xec'));}var _0x271294=this['channel']['exec'](_0xe486('0xed'),[util['format'](_0xe486('0xee'),_0x1a804d),_0x535274[_0xe486('0x67')],_0x535274['opts'],_0x535274[_0xe486('0x65')]]);if(_0x271294[_0xe486('0xa9')]===-0x1){return _0x271294;}return this['channel'][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0xef'),_0xe486('0xed')));};AGIVertices[_0xe486('0x12')][_0xe486('0xf0')]=function(_0x27fdb2){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0xf1'),_0x27fdb2[_0xe486('0x3a')]));if(!this['isConfigured'](_0x27fdb2['key'])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xf2'));}if(!this[_0xe486('0x88')](_0x27fdb2[_0xe486('0x5d')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xae'));}this['channel'][_0xe486('0xf3')]=!![];this[_0xe486('0x39')](_0x27fdb2);this[_0xe486('0x46')](_0x27fdb2[_0xe486('0x5d')],'in','','');this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0xf4'),_0x27fdb2[_0xe486('0x5d')]));var _0x2e8d19=this[_0xe486('0x79')][_0xe486('0x70')](this,_0x27fdb2);if(_0x2e8d19){for(var _0x51ec6a in _0x2e8d19){if(_0x2e8d19[_0xe486('0x9c')](_0x51ec6a)){this['channel']['setVariable'](util[_0xe486('0x2b')](_0xe486('0xf5'),_0x51ec6a['toUpperCase']()),_0x2e8d19[_0x51ec6a]);}}this[_0xe486('0x46')](_0x2e8d19[_0xe486('0xf6')],_0xe486('0xf7'),_0xe486('0xf0'),'');return this['channel'][_0xe486('0xad')](util['format'](_0xe486('0xf8'),_0x2e8d19[_0xe486('0xf6')]));}return this[_0xe486('0x11')][_0xe486('0x2f')](_0x27fdb2,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xe486('0x12')][_0xe486('0xf9')]=function(_0x3914de){logger[_0xe486('0x31')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3914de[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x3914de[_0xe486('0x7d')])){return this[_0xe486('0x11')][_0xe486('0xad')]('no\x20project_id\x20configured');}if(!this[_0xe486('0x88')](_0x3914de['client_email'])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xfa'));}if(!this[_0xe486('0x88')](_0x3914de['private_key'])){return this[_0xe486('0x11')]['noop'](_0xe486('0xfb'));}if(!this['isConfigured'](_0x3914de[_0xe486('0x80')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xfc'));}if(!this['isConfigured'](_0x3914de[_0xe486('0x5d')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xae'));}this[_0xe486('0x11')][_0xe486('0xf3')]=!![];this['createSquareDetailsReport'](_0x3914de);this['createSquareMessage'](_0x3914de[_0xe486('0x5d')],'in','','');this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0xfd'),_0x3914de[_0xe486('0x5d')]));var _0x271d32=this[_0xe486('0x7c')][_0xe486('0x70')](this,_0x3914de);if(_0x271d32){for(var _0x4c8b8a in _0x271d32){if(_0x271d32[_0xe486('0x9c')](_0x4c8b8a)){if(_0x4c8b8a!==_0xe486('0xfe')){this[_0xe486('0x11')]['setVariable'](util['format'](_0xe486('0xf5'),_0x4c8b8a[_0xe486('0x6b')]()),_0x271d32[_0x4c8b8a]);}}}this[_0xe486('0x46')](_0x271d32['speech'],'out','dialogflowV2',_0x271d32['providerResponse']);return this[_0xe486('0x11')]['noop'](util[_0xe486('0x2b')]('DialogflowV2\x20Result\x20%s',_0x271d32[_0xe486('0xf6')]));}return this[_0xe486('0x11')][_0xe486('0x2f')](_0x3914de,_0xe486('0xff'));};AGIVertices[_0xe486('0x12')]['sesteknda']=function(_0x3bfe28){logger[_0xe486('0x31')](util['format'](_0xe486('0x100'),_0x3bfe28[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x3bfe28[_0xe486('0x101')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0x102'));}if(!this[_0xe486('0x88')](_0x3bfe28[_0xe486('0x103')])){return this[_0xe486('0x11')][_0xe486('0xad')]('no\x20username\x20configured');}if(!this[_0xe486('0x88')](_0x3bfe28['password'])){return this['channel'][_0xe486('0xad')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x3bfe28[_0xe486('0x104')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xae'));}this[_0xe486('0x11')][_0xe486('0xf3')]=!![];this[_0xe486('0x39')](_0x3bfe28);this[_0xe486('0x46')](_0x3bfe28[_0xe486('0x5d')],'in','','');this[_0xe486('0x11')]['noop'](util[_0xe486('0x2b')]('Trying\x20SestekNDA:\x20%s',_0x3bfe28[_0xe486('0x5d')]));var _0x578692=this[_0xe486('0x81')][_0xe486('0x70')](this,_0x3bfe28);if(_0x578692){for(var _0x171327 in _0x578692){if(_0x578692[_0xe486('0x9c')](_0x171327)){this['channel'][_0xe486('0xa4')](util['format'](_0xe486('0x105'),_0x171327[_0xe486('0x6b')]()),_0x578692[_0x171327]);}}this[_0xe486('0x46')](_0x578692[_0xe486('0xf6')],'out','sesteknda','');if(_0x578692[_0xe486('0x106')]){this[_0xe486('0x11')]['noop'](util['format'](_0xe486('0x107'),_0x578692['audiofile']));var _0xb7e9c3=this[_0xe486('0x11')][_0xe486('0x108')](_0x578692[_0xe486('0x106')]);try{fs[_0xe486('0x109')](_0x578692[_0xe486('0x106')]+_0xe486('0x10a'));}catch(_0x5947be){logger[_0xe486('0x2f')](_0x5947be);}return _0xb7e9c3;}else{return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')]('SestekNDA\x20Result\x20%s',_0x578692['speech']));}}return this['channel'][_0xe486('0x2f')](_0x3bfe28,_0xe486('0x10b'));};AGIVertices['prototype']['end']=function(_0x13d3fe){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x10c'),_0x13d3fe[_0xe486('0x3a')]));return this[_0xe486('0x11')]['noop'](_0xe486('0x10d'));};AGIVertices[_0xe486('0x12')][_0xe486('0x10e')]=function(_0x734b11){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x734b11[_0xe486('0x3a')]));var _0x2c8924='';if(_0x734b11[_0xe486('0x10f')]){if(!this[_0xe486('0x88')](_0x734b11['trunk_id'])){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x734b11,'no\x20trunk\x20selected');}else{var _0x3b7300=parseInt(_0x734b11[_0xe486('0x10f')],0xa);if(isNaN(_0x3b7300)){_0x2c8924=_0x734b11[_0xe486('0x10f')];}else{_0x2c8924=this[_0xe486('0x1e')][_0xe486('0x70')](this,_0x734b11[_0xe486('0x10f')]);if(!_0x2c8924){return this['channel'][_0xe486('0x2f')](_0x734b11,_0xe486('0x110'));}}}}else if(_0x734b11[_0xe486('0x111')]){_0x2c8924=_0x734b11['trunk_name'];}else{return this[_0xe486('0x11')][_0xe486('0x2f')](_0x734b11,_0xe486('0x112'));}var _0x62cb1d=this[_0xe486('0x11')][_0xe486('0x59')]('DIAL',[util['format'](_0xe486('0x113'),_0x2c8924,_0x734b11[_0xe486('0xca')]),_0x734b11['timeout'],_0x734b11[_0xe486('0x114')],_0x734b11[_0xe486('0x65')]]);if(_0x62cb1d[_0xe486('0xa9')]===-0x1){return _0x62cb1d;}return this['channel'][_0xe486('0xad')](util[_0xe486('0x2b')]('Executed\x20command\x20%s',_0xe486('0xed')));};AGIVertices[_0xe486('0x12')]['finally']=function(_0x5f5203){logger[_0xe486('0x31')](util['format'](_0xe486('0x115'),_0x5f5203[_0xe486('0x3a')]));return this[_0xe486('0x11')]['noop'](_0xe486('0x116'));};AGIVertices['prototype']['getdigits']=function(_0x452b27){logger[_0xe486('0x31')](util[_0xe486('0x2b')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x452b27[_0xe486('0x3a')]));if(_0x452b27[_0xe486('0x117')]===0x0){return this['maxRetry'](_0x452b27);}_0x452b27[_0xe486('0x117')]-=0x1;if(!this['isConfigured'](_0x452b27[_0xe486('0x118')])){return this[_0xe486('0x11')]['error'](_0x452b27,'no\x20file\x20audio\x20selected');}var _0x1f8c67=this[_0xe486('0x20')][_0xe486('0x70')](this,_0x452b27[_0xe486('0x118')]);if(!_0x1f8c67){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x452b27,_0xe486('0x119'));}if(!this[_0xe486('0x88')](_0x452b27[_0xe486('0xe2')])){return this[_0xe486('0x11')][_0xe486('0x2f')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x184e2c=this[_0xe486('0x11')][_0xe486('0x11a')](_0x1f8c67,_0x452b27[_0xe486('0x11b')],_0x452b27['maxdigit']);var _0x4c3b6b=_0x184e2c['result']?_0x184e2c[_0xe486('0xa9')][_0xe486('0x4e')]():'';logger[_0xe486('0x31')]('test',JSON[_0xe486('0x72')](_0x184e2c));if(_0x184e2c['result']===-0x1){this[_0xe486('0x39')]['sync'](this,_0x452b27,_0x4c3b6b);return _0x184e2c;}else if(_0x184e2c['extra']===_0xe486('0x67')){_0x184e2c[_0xe486('0xa9')]=_0x4c3b6b[_0xe486('0x9f')]>=parseInt(_0x452b27['mindigit'])?'x':'i';}else{_0x184e2c[_0xe486('0xa9')]=_0x4c3b6b[_0xe486('0x9f')]>=parseInt(_0x452b27['mindigit'])&&_0x4c3b6b[_0xe486('0x9f')]<=parseInt(_0x452b27[_0xe486('0x11c')])?'x':'i';}var _0x5bd83d=this[_0xe486('0x13')][_0xe486('0x70')](this,_0x452b27[_0xe486('0xe2')]);if(!_0x5bd83d){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x452b27,_0xe486('0xe4'));}this[_0xe486('0x11')]['setVariable'](_0x5bd83d,_0x4c3b6b);if(this['isConfigured'](_0x452b27[_0xe486('0x11d')])){var _0x31aebe=parseInt(_0x452b27[_0xe486('0x11d')],0xa);var _0x5c3f37=rs['generate']({'charset':'*','length':_0x31aebe});var _0x2f33df=_0x4c3b6b['length'];if(_0x2f33df>0x0){if(_0x2f33df>_0x31aebe){this[_0xe486('0x39')][_0xe486('0x70')](this,_0x452b27,_0x452b27[_0xe486('0x11e')]===_0xe486('0x11f')?_0x5c3f37+_0x4c3b6b['substr'](_0x31aebe):_0x4c3b6b['substr'](0x0,_0x2f33df-_0x31aebe)+_0x5c3f37);}else{this[_0xe486('0x39')][_0xe486('0x70')](this,_0x452b27,rs[_0xe486('0x120')]({'charset':'*','length':_0x2f33df}));}}else{this[_0xe486('0x39')][_0xe486('0x70')](this,_0x452b27,'');}}else{this['createSquareDetailsReport'][_0xe486('0x70')](this,_0x452b27,_0x4c3b6b);}return _0x184e2c;};AGIVertices[_0xe486('0x12')][_0xe486('0x10')]=function(_0x2c3561){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x121'),_0x2c3561[_0xe486('0x3a')]));return this['getdigits'](_0x2c3561);};AGIVertices[_0xe486('0x12')]['goal']=function(_0x34a155){logger['info'](util[_0xe486('0x2b')](_0xe486('0x122'),_0x34a155[_0xe486('0x3a')]));this[_0xe486('0x39')][_0xe486('0x70')](this,_0x34a155,_0x34a155[_0xe486('0x123')]);return this['channel']['noop'](util[_0xe486('0x2b')](_0xe486('0x124'),_0x34a155[_0xe486('0x123')]));};AGIVertices[_0xe486('0x12')][_0xe486('0x125')]=function(_0x349f62){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x126'),_0x349f62['label']));if(!this['isConfigured'](_0x349f62['aws_access_key_id'])||!this[_0xe486('0x88')](_0x349f62[_0xe486('0x8c')])){return this['channel'][_0xe486('0xad')](_0xe486('0x127'));}if(!this[_0xe486('0x88')](_0x349f62[_0xe486('0x5d')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xae'));}this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x128'),_0x349f62['text']));var _0x31c376=this[_0xe486('0x8a')][_0xe486('0x70')](this,_0x349f62);if(_0x31c376){this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x129'),_0x31c376));var _0x58fa63=this[_0xe486('0x11')][_0xe486('0x108')](_0x31c376);try{fs['unlink'](_0x31c376+_0xe486('0x10a'));}catch(_0x5bdb93){logger[_0xe486('0x2f')](_0x5bdb93);}return _0x58fa63;}return this[_0xe486('0x11')][_0xe486('0x2f')](_0x349f62,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0xe486('0x12a')]=function(_0x7ab94f){logger['info'](util[_0xe486('0x2b')](_0xe486('0x12b'),_0x7ab94f[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x7ab94f[_0xe486('0x8b')])||!this['isConfigured'](_0x7ab94f[_0xe486('0x8c')])){return this['channel']['noop'](_0xe486('0x127'));}if(!this[_0xe486('0x88')](_0x7ab94f['aws_bot_name'])){return this[_0xe486('0x11')]['noop'](_0xe486('0x12c'));}if(!this['isConfigured'](_0x7ab94f[_0xe486('0x5d')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xae'));}this[_0xe486('0x11')][_0xe486('0xf3')]=!![];this[_0xe486('0x39')](_0x7ab94f);this[_0xe486('0x46')](_0x7ab94f[_0xe486('0x5d')],'in','','');this[_0xe486('0x11')]['noop'](util[_0xe486('0x2b')](_0xe486('0x12d'),_0x7ab94f[_0xe486('0x5d')]));var _0x5b10d7=this[_0xe486('0x90')][_0xe486('0x70')](this,_0x7ab94f);if(_0x5b10d7){for(var _0x135324 in _0x5b10d7){if(_0x5b10d7[_0xe486('0x9c')](_0x135324)&&_['isString'](_0x5b10d7[_0x135324])){this[_0xe486('0x11')][_0xe486('0xa4')](util['format'](_0xe486('0x12e'),_0x135324['toUpperCase']()),_0x5b10d7[_0x135324]);}}if(_[_0xe486('0x48')](_0x5b10d7['message'])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0x12f'));}else{this[_0xe486('0x46')](_0x5b10d7[_0xe486('0x76')],_0xe486('0xf7'),_0xe486('0x130'),'');return this['channel'][_0xe486('0xad')](util['format'](_0xe486('0x131'),_0x5b10d7[_0xe486('0x76')]));}}return this[_0xe486('0x11')][_0xe486('0x2f')](_0x7ab94f,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xe486('0x12')]['googleasr']=function(_0x4142bd){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x132'),_0x4142bd[_0xe486('0x3a')],_0x4142bd['timeout']));if(!this[_0xe486('0x88')](_0x4142bd[_0xe486('0x7a')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xf2'));}var _0x344de0=_0xe486('0x133');var _0x89af3a=util[_0xe486('0x2b')](_0xe486('0x134'),FILES_PATH,rs[_0xe486('0x120')](0x4));var _0x48c0d4=util[_0xe486('0x2b')]('%s.%s',_0x89af3a,_0x344de0);var _0x46a388=!![];if(_0x4142bd[_0xe486('0x135')]===_0xe486('0x136')){_0x46a388=![];}var _0x42c10a=this[_0xe486('0x11')][_0xe486('0x137')](_0x89af3a,_0x344de0,_0x4142bd[_0xe486('0x138')],_0x4142bd[_0xe486('0x67')],undefined,_0x46a388);if(_0x42c10a[_0xe486('0xa9')]!==-0x1){this['channel'][_0xe486('0xad')](util['format'](_0xe486('0x139'),_0x48c0d4));var _0x20cc39=this[_0xe486('0x93')][_0xe486('0x70')](this,_0x4142bd,_0x48c0d4);if(_0x20cc39){for(var _0x57782f in _0x20cc39){if(_0x20cc39[_0xe486('0x9c')](_0x57782f)){this['channel'][_0xe486('0xa4')](util['format'](_0xe486('0x13a'),_0x57782f[_0xe486('0x6b')]()),_0x20cc39[_0x57782f]);}}return this['channel']['noop'](util[_0xe486('0x2b')]('GoogleASR\x20Result\x20%s',JSON[_0xe486('0x72')](_0x20cc39)));}}return _0x42c10a;};AGIVertices['prototype'][_0xe486('0x13b')]=function(_0x21a602){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x13c'),_0x21a602[_0xe486('0x3a')]));if(!this['isConfigured'](_0x21a602[_0xe486('0x96')])){return this['channel'][_0xe486('0xad')](_0xe486('0x13d'));}if(!this[_0xe486('0x88')](_0x21a602[_0xe486('0x97')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0x13e'));}var _0xf403cd=_0xe486('0x133');var _0x45a190=util[_0xe486('0x2b')](_0xe486('0x134'),FILES_PATH,rs['generate'](0x4));var _0x15e75b=util[_0xe486('0x2b')](_0xe486('0xa3'),_0x45a190,_0xf403cd);var _0x2e0cdb=!![];if(_0x21a602['beep']===_0xe486('0x136')){_0x2e0cdb=![];}var _0x2e80b7=this[_0xe486('0x11')][_0xe486('0x137')](_0x45a190,_0xf403cd,_0x21a602['intKey'],_0x21a602[_0xe486('0x67')],undefined,_0x2e0cdb);if(_0x2e80b7[_0xe486('0xa9')]!==-0x1){this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x13f'),_0x15e75b));var _0x56627f=this[_0xe486('0x95')][_0xe486('0x70')](this,_0x21a602,_0x15e75b);if(_0x56627f){for(var _0x258c02 in _0x56627f){if(_0x56627f[_0xe486('0x9c')](_0x258c02)){this[_0xe486('0x11')][_0xe486('0xa4')](util['format'](_0xe486('0x140'),_0x258c02[_0xe486('0x6b')]()),_0x56627f[_0x258c02]);}}return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x56627f)));}}return _0x2e80b7;};AGIVertices[_0xe486('0x12')][_0xe486('0x141')]=function(_0x35bfd6){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x142'),_0x35bfd6['label']));return this[_0xe486('0x11')][_0xe486('0x143')](_0x35bfd6['context'],_0x35bfd6['extension'],_0x35bfd6[_0xe486('0x42')]);};AGIVertices[_0xe486('0x12')]['gotoif']=function(_0x29b168){logger[_0xe486('0x31')](util['format'](_0xe486('0x144'),_0x29b168['label']));if(!this[_0xe486('0x88')](_0x29b168[_0xe486('0x145')])){return this[_0xe486('0x11')]['error'](_0x29b168,_0xe486('0x146'));}try{var _0xd511b7=eval(_0x29b168[_0xe486('0x145')])?_0xe486('0x147'):_0xe486('0x148');this[_0xe486('0x11')]['noop'](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x29b168[_0xe486('0x145')],_0xd511b7));return{'code':0xc8,'result':_0xd511b7};}catch(_0xde4e73){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xe486('0x12')][_0xe486('0x149')]=function(_0x2addd7){logger['info'](util['format'](_0xe486('0x14a'),_0x2addd7['label']));if(!this[_0xe486('0x88')](_0x2addd7[_0xe486('0x14b')])){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x2addd7,'no\x20interval\x20configured');}var _0x1fd549=this[_0xe486('0x26')]['sync'](this,_0x2addd7[_0xe486('0x14b')]);if(!_0x1fd549){return this['channel'][_0xe486('0x2f')](_0x2addd7,'no\x20intervals\x20found');}for(var _0x147568=0x0;_0x147568<_0x1fd549[_0xe486('0x9f')];_0x147568+=0x1){var _0xbab138=this[_0xe486('0x11')][_0xe486('0x13')](util[_0xe486('0x2b')](_0xe486('0x14c'),_0x1fd549[_0x147568]));if(_0xbab138[_0xe486('0xa9')]===-0x1){return _0xbab138;}logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x14d'),_0x1fd549[_0x147568],_0xbab138[_0xe486('0xa7')]));if(_0xbab138[_0xe486('0xa7')]===_0xe486('0x147')){logger['info'](util['format'](_0xe486('0x14d'),_0x1fd549[_0x147568],_0xe486('0x147')));this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x14d'),_0x1fd549[_0x147568],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x14d'),_0x1fd549[_0x147568],_0xe486('0x148')));this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x14d'),_0x1fd549[_0x147568],'false'));}}return{'code':0xc8,'result':_0xe486('0x148')};};AGIVertices['prototype'][_0xe486('0x14e')]=function(_0xfcad0f){logger['info'](util[_0xe486('0x2b')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xfcad0f['label']));return this['channel'][_0xe486('0x14e')]();};AGIVertices[_0xe486('0x12')][_0xe486('0x14f')]=function(_0x2d8296){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x150'),_0x2d8296['label']));if(!this[_0xe486('0x88')](_0x2d8296[_0xe486('0x7a')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xf2'));}var _0x3a998a=_0xe486('0x133');var _0x6b45d5=util[_0xe486('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0xe486('0x120')](0x4));var _0x26896c=util['format'](_0xe486('0xa3'),_0x6b45d5,_0x3a998a);var _0x586f03=!![];if(_0x2d8296[_0xe486('0x135')]===_0xe486('0x136')){_0x586f03=![];}var _0xa80627=this[_0xe486('0x11')][_0xe486('0x137')](_0x6b45d5,_0x3a998a,_0x2d8296[_0xe486('0x138')],_0x2d8296[_0xe486('0x67')],undefined,_0x586f03);if(_0xa80627[_0xe486('0xa9')]!==-0x1){this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x151'),_0x26896c));var _0x146ebc=this['ispeechASR'][_0xe486('0x70')](this,_0x2d8296,_0x26896c);if(_0x146ebc){for(var _0x334876 in _0x146ebc){if(_0x146ebc[_0xe486('0x9c')](_0x334876)){this['channel'][_0xe486('0xa4')](util[_0xe486('0x2b')](_0xe486('0x152'),_0x334876[_0xe486('0x6b')]()),_0x146ebc[_0x334876]);}}return this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x153'),JSON[_0xe486('0x72')](_0x146ebc)));}}return _0xa80627;};AGIVertices[_0xe486('0x12')]['ispeechtts']=function(_0x3f469c){logger[_0xe486('0x31')](util['format'](_0xe486('0x154'),_0x3f469c['label']));if(!this['isConfigured'](_0x3f469c[_0xe486('0x7a')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xf2'));}if(!this[_0xe486('0x88')](_0x3f469c[_0xe486('0x5d')])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xae'));}this['channel']['noop'](util[_0xe486('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x3f469c[_0xe486('0x5d')]));var _0x1d43db=this[_0xe486('0x82')][_0xe486('0x70')](this,_0x3f469c);if(_0x1d43db){this['channel'][_0xe486('0xad')](util['format'](_0xe486('0x151'),_0x1d43db));var _0x100536=this[_0xe486('0x11')]['streamFile'](_0x1d43db,_0x3f469c[_0xe486('0x138')]);try{fs['unlink'](_0x1d43db+_0xe486('0x10a'));}catch(_0x55a6ae){logger[_0xe486('0x2f')](_0x55a6ae);}return _0x100536;}return this[_0xe486('0x11')][_0xe486('0x2f')](_0x3f469c,_0xe486('0x155'));};AGIVertices[_0xe486('0x12')][_0xe486('0x156')]=function(_0x394ec9){logger[_0xe486('0x31')](util['format'](_0xe486('0x157'),_0x394ec9['label']));if(!this[_0xe486('0x88')](_0x394ec9[_0xe486('0x158')])){return this['channel'][_0xe486('0x2f')](_0x394ec9,_0xe486('0x159'));}logger[_0xe486('0x31')](util['format'](_0xe486('0x15a'),this[_0xe486('0x11')]['callerid'],_0x394ec9[_0xe486('0x158')]));var _0x15ff1b=this[_0xe486('0x55')][_0xe486('0x70')](this,_0x394ec9[_0xe486('0x158')]);if(_0x15ff1b){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x15b'),this[_0xe486('0x11')][_0xe486('0x3d')],_0x394ec9[_0xe486('0x158')]));this[_0xe486('0x11')]['noop'](util[_0xe486('0x2b')](_0xe486('0x15b'),this[_0xe486('0x11')][_0xe486('0x3d')],_0x394ec9[_0xe486('0x158')]));return{'code':0xc8,'result':_0xe486('0x15c')};}else{logger[_0xe486('0x31')](util[_0xe486('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe486('0x11')][_0xe486('0x3d')],_0x394ec9['findBy']));this[_0xe486('0x11')]['noop'](util[_0xe486('0x2b')](_0xe486('0x15d'),this[_0xe486('0x11')]['callerid'],_0x394ec9[_0xe486('0x158')]));return{'code':0xc8,'result':_0xe486('0x15e')};}};AGIVertices['prototype']['logout']=function(_0x33f7d7){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x15f'),_0x33f7d7['label']));if(!this[_0xe486('0x88')](_0x33f7d7[_0xe486('0x158')])){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x33f7d7,'no\x20find\x20by\x20configured');}logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x15a'),this[_0xe486('0x11')][_0xe486('0x3d')],_0x33f7d7[_0xe486('0x158')]));var _0x28300a=this['agentLogout'][_0xe486('0x70')](this,_0x33f7d7['findBy']);if(_0x28300a){logger['info'](util[_0xe486('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe486('0x11')]['callerid'],_0x33f7d7[_0xe486('0x158')]));this[_0xe486('0x11')]['noop'](util['format'](_0xe486('0x15b'),this[_0xe486('0x11')][_0xe486('0x3d')],_0x33f7d7[_0xe486('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x15d'),this[_0xe486('0x11')][_0xe486('0x3d')],_0x33f7d7[_0xe486('0x158')]));this[_0xe486('0x11')][_0xe486('0xad')](util['format'](_0xe486('0x15d'),this[_0xe486('0x11')]['callerid'],_0x33f7d7['findBy']));return{'code':0xc8,'result':_0xe486('0x15e')};}};AGIVertices[_0xe486('0x12')][_0xe486('0x160')]=function(_0x1cc99c){logger['info'](util[_0xe486('0x2b')](_0xe486('0x161'),_0x1cc99c['label']));if(!this[_0xe486('0x88')](_0x1cc99c[_0xe486('0x162')])){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x1cc99c,'no\x20operation\x20configured');}this['channel']['noop'](util[_0xe486('0x2b')](_0xe486('0x163'),_0x1cc99c['operation']));var _0x19afcd=eval(_0x1cc99c[_0xe486('0x162')]);if(!this['isConfigured'](_0x1cc99c['variable_id'])){return this[_0xe486('0x11')][_0xe486('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3f5c2f=this[_0xe486('0x13')][_0xe486('0x70')](this,_0x1cc99c[_0xe486('0xe2')]);if(!_0x3f5c2f){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x1cc99c,_0xe486('0xe4'));}if(_[_0xe486('0x9e')](_0x19afcd)){var _0x3453fe=this;_0x19afcd[_0xe486('0xe5')](function(_0x3a5854,_0x2d3577){_0x3453fe[_0xe486('0x11')][_0xe486('0xa4')](util[_0xe486('0x2b')](_0xe486('0x164'),_0x3f5c2f,_0x2d3577),_0x3a5854);});return this['channel']['noop'](util[_0xe486('0x2b')]('variable\x20%s[key]\x20set',_0x3f5c2f));}else{return this[_0xe486('0x11')][_0xe486('0xa4')](_0x3f5c2f,_0x19afcd);}};AGIVertices[_0xe486('0x12')]['menu']=function(_0x3fbc80){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x165'),_0x3fbc80['label']));if(_0x3fbc80[_0xe486('0x117')]===0x0){return this['maxRetry'](_0x3fbc80);}_0x3fbc80[_0xe486('0x117')]-=0x1;if(!this[_0xe486('0x88')](_0x3fbc80['file_id'])){return this[_0xe486('0x11')]['error'](_0x3fbc80,_0xe486('0x166'));}var _0x3ebd41=this[_0xe486('0x20')][_0xe486('0x70')](this,_0x3fbc80[_0xe486('0x118')]);if(!_0x3ebd41){return this['channel'][_0xe486('0x2f')](_0x3fbc80,'no\x20file\x20audio\x20found');}var _0x35c4d2=this[_0xe486('0x11')][_0xe486('0x11a')](_0x3ebd41,_0x3fbc80[_0xe486('0x11b')],_0x3fbc80[_0xe486('0x167')]);var _0x4150c2=_0x35c4d2[_0xe486('0xa9')];if(_0x35c4d2['result']===-0x1){this[_0xe486('0x39')][_0xe486('0x70')](this,_0x3fbc80,'-1');return _0x35c4d2;}else if(_0x35c4d2[_0xe486('0xa7')]==='timeout'){_0x35c4d2[_0xe486('0xa9')]=_0x35c4d2['result'][_0xe486('0x9f')]>0x0?_0x35c4d2['result']:'t';}else if(_['isEmpty'](_0x35c4d2['result'])){_0x35c4d2[_0xe486('0xa9')]='#';_0x4150c2='#';}if(!this[_0xe486('0x88')](_0x3fbc80['variable_id'])){this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0xe3'));}else{var _0x185f00=this[_0xe486('0x13')]['sync'](this,_0x3fbc80['variable_id']);if(!_0x185f00){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x3fbc80,_0xe486('0xe4'));}this[_0xe486('0x11')]['setVariable'](_0x185f00,_0x4150c2);}this[_0xe486('0x39')][_0xe486('0x70')](this,_0x3fbc80,_0x4150c2);return _0x35c4d2;};AGIVertices[_0xe486('0x12')]['noop']=function(_0x1331e7){logger[_0xe486('0x31')](util['format'](_0xe486('0x168'),_0x1331e7['label']));return this[_0xe486('0x11')][_0xe486('0xad')](_0x1331e7[_0xe486('0x169')]||_0x1331e7[_0xe486('0x3a')]);};AGIVertices['prototype'][_0xe486('0x16a')]=function(_0x587d7d){logger['info'](util[_0xe486('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x587d7d[_0xe486('0x3a')]));if(!this['isConfigured'](_0x587d7d[_0xe486('0x158')])){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x587d7d,_0xe486('0x159'));}logger['info'](util[_0xe486('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe486('0x11')][_0xe486('0x3d')],_0x587d7d[_0xe486('0x158')]));var _0x59c300=this[_0xe486('0x4f')][_0xe486('0x70')](this,_0x587d7d[_0xe486('0x16b')]);var _0x1f1338=this[_0xe486('0x51')]['sync'](this,_0x587d7d[_0xe486('0x158')],_0x59c300);if(_0x1f1338){logger[_0xe486('0x31')](util[_0xe486('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xe486('0x3d')],_0x587d7d[_0xe486('0x158')]));this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x15b'),this[_0xe486('0x11')][_0xe486('0x3d')],_0x587d7d[_0xe486('0x158')]));return{'code':0xc8,'result':_0xe486('0x15c')};}else{logger['info'](util[_0xe486('0x2b')](_0xe486('0x15d'),this[_0xe486('0x11')]['callerid'],_0x587d7d['findBy']));this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x15b'),this['channel']['callerid'],_0x587d7d[_0xe486('0x158')]));return{'code':0xc8,'result':_0xe486('0x15e')};}};AGIVertices[_0xe486('0x12')][_0xe486('0x16c')]=function(_0x520e19){logger['info'](util['format'](_0xe486('0x16d'),_0x520e19['label']));if(!this[_0xe486('0x88')](_0x520e19[_0xe486('0x118')])){return this['channel'][_0xe486('0x2f')](_0x520e19,'no\x20file\x20audio\x20selected');}var _0x30cde5=this[_0xe486('0x20')]['sync'](this,_0x520e19['file_id']);if(!_0x30cde5){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x520e19,_0xe486('0x119'));}var _0x4b0116=this['channel'][_0xe486('0x59')](_0xe486('0x16e'),[_0x30cde5,_0x520e19['opts']]);if(_0x4b0116['result']===-0x1){return _0x4b0116;}return this[_0xe486('0x11')]['noop'](util[_0xe486('0x2b')](_0xe486('0x16f'),_0xe486('0x16e'),_0x30cde5));};AGIVertices[_0xe486('0x12')][_0xe486('0x170')]=function(_0x2ad647){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x171'),_0x2ad647[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x2ad647['queue_id'])){return this[_0xe486('0x11')]['error'](_0x2ad647,_0xe486('0x172'));}var _0x420532='';var _0x4fea74=parseInt(_0x2ad647['queue_id'],0xa);if(isNaN(_0x4fea74)){_0x420532=_0x2ad647[_0xe486('0x173')];}else{_0x420532=this['getVoiceQueue'][_0xe486('0x70')](this,_0x2ad647[_0xe486('0x173')]);if(!_0x420532){return this[_0xe486('0x11')]['error'](_0x2ad647,'no\x20queue\x20found');}}var _0x4496cb='';if(this[_0xe486('0x88')](_0x2ad647[_0xe486('0x118')])){var _0x3b614f=this[_0xe486('0x20')]['sync'](this,_0x2ad647[_0xe486('0x118')]);if(_0x3b614f){_0x4496cb=_0x3b614f;}}this[_0xe486('0x39')]['sync'](this,_0x2ad647,_0x420532);if(_0x2ad647[_0xe486('0x114')][_0xe486('0x174')]('x')<0x0){_0x2ad647[_0xe486('0x114')]+='x';}if(_0x2ad647[_0xe486('0x114')]['indexOf']('X')<0x0){_0x2ad647[_0xe486('0x114')]+='X';}this[_0xe486('0x11')][_0xe486('0xa4')](_0xe486('0x175'),_0x420532?_0x420532['toLowerCase']():'');var _0x32590c=this['channel'][_0xe486('0x59')](_0xe486('0x176'),[_0x420532,_0x2ad647[_0xe486('0x114')],_0x2ad647[_0xe486('0x65')],_0x4496cb,_0x2ad647[_0xe486('0x67')],_0x2ad647['agi'],_0x2ad647[_0xe486('0x177')],_0x2ad647[_0xe486('0x178')],'',_0x2ad647[_0xe486('0x179')]]);if(_0x32590c['result']===-0x1){return _0x32590c;}return this[_0xe486('0x11')]['noop'](util[_0xe486('0x2b')](_0xe486('0x16f'),_0xe486('0x176'),_0x420532));};AGIVertices[_0xe486('0x12')]['record']=function(_0x3c3d62){logger['info'](util[_0xe486('0x2b')](_0xe486('0x17a'),_0x3c3d62[_0xe486('0x3a')]));var _0x5467c1=_0x3c3d62[_0xe486('0x17b')]||_0xe486('0x133');var _0x2d5022=util[_0xe486('0x2b')](_0xe486('0x17c'),this[_0xe486('0x11')][_0xe486('0x3f')],rs['generate'](0x5));var _0x433aba=util[_0xe486('0x2b')](_0xe486('0x17d'),FILES_PATH,_0x2d5022,_0x5467c1);var _0x2de93d=util[_0xe486('0x2b')](_0xe486('0x134'),FILES_PATH,_0x2d5022);this[_0xe486('0x3e')][_0xe486('0x70')](this,_0x3c3d62,_0x2d5022,_0x433aba);this[_0xe486('0x11')]['setVariable'](_0xe486('0x17e'),_0x2d5022);logger[_0xe486('0x31')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x2de93d,_0x5467c1,_0x3c3d62[_0xe486('0x17f')],_0x3c3d62['timeout']);return this['channel'][_0xe486('0x137')](_0x2de93d,_0x5467c1,_0x3c3d62[_0xe486('0x17f')],_0x3c3d62[_0xe486('0x67')],undefined,!![]);};AGIVertices['prototype'][_0xe486('0x180')]=function(_0x35adbe){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x181'),_0x35adbe[_0xe486('0x3a')]));if(!this['isConfigured'](_0x35adbe['url'])){return this[_0xe486('0x11')][_0xe486('0xad')](_0xe486('0x182'));}var _0x32d6f0=this[_0xe486('0x64')]['sync'](this,_0x35adbe);logger[_0xe486('0x31')](util[_0xe486('0x2b')]('Response:',util[_0xe486('0x183')](_0x32d6f0,{'showHidden':![],'depth':null})));if(!this[_0xe486('0x88')](_0x35adbe[_0xe486('0xe2')])){return this[_0xe486('0x11')]['noop'](_0xe486('0x184'));}var _0x28c862=this[_0xe486('0x13')][_0xe486('0x70')](this,_0x35adbe[_0xe486('0xe2')]);if(!_0x28c862){return this[_0xe486('0x11')]['error'](_0x35adbe,_0xe486('0xe4'));}this[_0xe486('0x11')][_0xe486('0xa4')](util[_0xe486('0x2b')](_0xe486('0x185'),_0x28c862),_0x32d6f0[_0xe486('0x74')]?_0x32d6f0[_0xe486('0x74')]:_0xe486('0x186'));this['channel'][_0xe486('0xa4')](util[_0xe486('0x2b')](_0xe486('0x187'),_0x28c862),_0x32d6f0['statusMessage']?_0x32d6f0[_0xe486('0x75')]:'OK');if(_0x32d6f0['body']){try{this[_0xe486('0xa1')](_0x32d6f0[_0xe486('0x73')],_0x28c862);}catch(_0x558fe2){logger[_0xe486('0x2f')](util['format'](_0xe486('0x188'),_0x28c862));}}return this['channel']['noop'](util[_0xe486('0x2b')](_0xe486('0x189'),_0x28c862));};AGIVertices[_0xe486('0x12')]['saydigits']=function(_0x460ff9){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x18a'),_0x460ff9[_0xe486('0x3a')]));return this[_0xe486('0x11')][_0xe486('0x18b')](_0x460ff9['digits'][_0xe486('0xe0')](/\s+/g,''),_0x460ff9[_0xe486('0x17f')]);};AGIVertices[_0xe486('0x12')]['saynumber']=function(_0x58c5c6){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x18c'),_0x58c5c6[_0xe486('0x3a')]));return this[_0xe486('0x11')]['sayNumber'](_0x58c5c6[_0xe486('0x68')]['replace'](/\s+/g,''),_0x58c5c6[_0xe486('0x17f')]);};AGIVertices[_0xe486('0x12')][_0xe486('0x18d')]=function(_0x35f96d){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x18e'),_0x35f96d[_0xe486('0x3a')]));return this[_0xe486('0x11')][_0xe486('0x18f')](_0x35f96d['text'],_0x35f96d['escape_digits']);};AGIVertices[_0xe486('0x12')][_0xe486('0x190')]=function(_0x291d1f){logger[_0xe486('0x31')](util[_0xe486('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x291d1f[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x291d1f[_0xe486('0x191')])){return this['channel'][_0xe486('0xad')](_0xe486('0x192'));}var _0x32a8b4=this[_0xe486('0x22')][_0xe486('0x70')](this,_0x291d1f['account_id']);if(!_0x32a8b4||!_0x32a8b4[_0xe486('0x193')]){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x291d1f,_0xe486('0x194'));}var _0x50cc24={'from':util['format'](_0xe486('0x195'),_0x32a8b4['name'],_0x32a8b4[_0xe486('0x196')]||_0x32a8b4[_0xe486('0x193')]['user']),'to':_0x291d1f['to']||'','cc':_0x291d1f['cc']||'','bcc':_0x291d1f['bcc']||'','subject':_0x291d1f[_0xe486('0x197')],'html':_0x291d1f[_0xe486('0x5d')],'text':_0x291d1f[_0xe486('0x5d')]};if(this[_0xe486('0x88')](_0x291d1f[_0xe486('0x198')])){}logger[_0xe486('0xea')](_0xe486('0x199'),JSON[_0xe486('0x72')](_0x50cc24));this[_0xe486('0x39')][_0xe486('0x70')](this,_0x291d1f,_0x291d1f[_0xe486('0x191')]);this['channel']['noop'](util[_0xe486('0x2b')](_0xe486('0x19a'),_0x32a8b4[_0xe486('0x17')]));this[_0xe486('0x25')]['sync'](this,_0x32a8b4[_0xe486('0x19b')],_0x50cc24);return this['channel'][_0xe486('0xad')](_0xe486('0x19c'));};AGIVertices['prototype']['sendFax']=function(_0x42171b){logger[_0xe486('0x31')](util[_0xe486('0x2b')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x42171b[_0xe486('0x3a')]));return this[_0xe486('0x11')]['noop'](_0xe486('0x19d'));};AGIVertices[_0xe486('0x12')][_0xe486('0x19e')]=function(_0x1b5231){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x19f'),_0x1b5231[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x1b5231[_0xe486('0x1a0')])){return this['channel'][_0xe486('0xad')]('no\x20sms\x20account\x20configured');}var _0x2d2114=this['getSmsAccount'][_0xe486('0x70')](this,_0x1b5231[_0xe486('0x1a0')]);if(!_0x2d2114){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x1b5231,_0xe486('0x1a1'));}var _0x1eaad0={'body':_0x1b5231['sms_text'],'phone':_0x1b5231['to']||'','SmsAccountId':_0x2d2114['id']};logger[_0xe486('0xea')](_0xe486('0x1a2'),JSON[_0xe486('0x72')](_0x1eaad0));this[_0xe486('0x39')]['sync'](this,_0x1b5231,_0x1b5231[_0xe486('0x1a0')]);this[_0xe486('0x11')]['noop'](util[_0xe486('0x2b')](_0xe486('0x1a3'),_0x2d2114[_0xe486('0x17')]));this['createSmsMessage'][_0xe486('0x70')](this,_0x1eaad0);return this[_0xe486('0x11')]['noop'](_0xe486('0x1a4'));};AGIVertices['prototype'][_0xe486('0x1a5')]=function(_0x48a6ec){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x1a6'),_0x48a6ec[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x48a6ec[_0xe486('0xe2')])){return this['channel'][_0xe486('0x2f')](_0x48a6ec,_0xe486('0x1a7'));}var _0x2660ef=this['getVariable']['sync'](this,_0x48a6ec[_0xe486('0xe2')]);if(!_0x2660ef){return this['channel'][_0xe486('0x2f')](_0x48a6ec,_0xe486('0xe4'));}return this[_0xe486('0x11')]['setVariable'](_0x2660ef,_0x48a6ec[_0xe486('0x1a8')]);};AGIVertices[_0xe486('0x12')][_0xe486('0x1a9')]=function(_0x21e578){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x1aa'),_0x21e578[_0xe486('0x3a')]));this['channel'][_0xe486('0xad')](_0xe486('0x1ab'));if(_0x21e578[_0xe486('0xbd')]===_0xe486('0x1ac')){this[_0xe486('0x11')]['noop']('Answer');return this[_0xe486('0x11')][_0xe486('0xbd')]();}return this[_0xe486('0x11')][_0xe486('0xad')]('Skipped\x20Answer');};AGIVertices[_0xe486('0x12')]['subproject']=function(_0x42833d){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x1ad'),_0x42833d[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x42833d[_0xe486('0x1ae')])){return this[_0xe486('0x11')]['error'](_0x42833d,_0xe486('0x1af'));}var _0x33a1da=this[_0xe486('0x1b0')][_0xe486('0x70')](this,_0x42833d[_0xe486('0x1ae')]);if(!this[_0xe486('0x88')](_0x33a1da)){return this['channel'][_0xe486('0x2f')](_0x42833d,util[_0xe486('0x2b')](_0xe486('0x1b1'),_0x42833d[_0xe486('0x1ae')]));}if(_0x33a1da===this[_0xe486('0x11')]['arg_1']){return this[_0xe486('0x11')][_0xe486('0x2f')](_0x42833d,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xe486('0x39')][_0xe486('0x70')](this,_0x42833d,_0x33a1da);var _0x2aa8bc=this[_0xe486('0x11')][_0xe486('0x59')](_0xe486('0x1b2'),util[_0xe486('0x2b')](_0xe486('0x1b3'),config[_0xe486('0x8')][_0xe486('0x1b4')]||_0xe486('0x1b5'),_0x33a1da,this['channel']['arg_1']));if(_0x2aa8bc[_0xe486('0xa9')]===-0x1){return _0x2aa8bc;}return this['channel'][_0xe486('0xad')](util['format'](_0xe486('0x16f'),_0xe486('0x1b2'),_0x33a1da));};AGIVertices['prototype'][_0xe486('0x1b6')]=function(_0x4caba6){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x1b7'),_0x4caba6['label']));var _0x2d3c1=this[_0xe486('0x58')]['sync'](this,_0x4caba6[_0xe486('0xbb')]);this[_0xe486('0x39')][_0xe486('0x70')](this,_0x4caba6,_0x4caba6['command']);if(this[_0xe486('0x88')](_0x4caba6[_0xe486('0xe2')])){var _0x5c40f7=this[_0xe486('0x13')]['sync'](this,_0x4caba6['variable_id']);if(_0x5c40f7){this['channel'][_0xe486('0xa4')](_0x5c40f7,_0x2d3c1);return this['channel'][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x1b8'),_0x4caba6[_0xe486('0xbb')],_0x5c40f7));}}return this[_0xe486('0x11')][_0xe486('0xad')](util['format'](_0xe486('0x1b9'),_0x4caba6[_0xe486('0xbb')]));};AGIVertices[_0xe486('0x12')][_0xe486('0x1ba')]=function(_0x3e6017){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x1bb'),_0x3e6017['label']));_0x3e6017[_0xe486('0x5d')]=_0x3e6017[_0xe486('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe486('0x88')](_0x3e6017[_0xe486('0x5c')])){return this[_0xe486('0x11')]['noop'](_0xe486('0x1bc'));}if(!this[_0xe486('0x88')](_0x3e6017['text'])){return this['channel'][_0xe486('0xad')](_0xe486('0xae'));}this[_0xe486('0x11')][_0xe486('0xad')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3e6017[_0xe486('0x5d')]));var _0x530fdd=this['googleCloudTTS'][_0xe486('0x70')](this,_0x3e6017);if(_0x530fdd){this[_0xe486('0x11')]['noop'](util[_0xe486('0x2b')](_0xe486('0x1bd'),_0x530fdd));var _0x4a1007=this['channel'][_0xe486('0x108')](_0x530fdd);try{fs[_0xe486('0x109')](_0x530fdd+'.wav');}catch(_0xedf566){logger[_0xe486('0x2f')](_0xedf566);}return _0x4a1007;}return this[_0xe486('0x11')]['error'](_0x3e6017,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xe486('0x12')][_0xe486('0x1be')]=function(_0x25cafa){logger[_0xe486('0x31')](util['format'](_0xe486('0x1bf'),_0x25cafa[_0xe486('0x3a')]));_0x25cafa[_0xe486('0x5d')]=_0x25cafa['text'][_0xe486('0xe0')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe486('0x88')](_0x25cafa[_0xe486('0x5d')])){return this['channel']['noop'](_0xe486('0xae'));}this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x1c0'),_0x25cafa[_0xe486('0x5d')]));var _0x54b067=this['googleTTS']['sync'](this,_0x25cafa);if(_0x54b067){this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')]('Google\x20TTS\x20%s\x20file\x20created',_0x54b067));var _0x1eae50=this['channel'][_0xe486('0x108')](_0x54b067);try{fs['unlink'](_0x54b067+'.wav');}catch(_0x29024c){logger['error'](_0x29024c);}return _0x1eae50;}return this[_0xe486('0x11')][_0xe486('0x2f')](_0x25cafa,_0xe486('0x1c1'));};AGIVertices[_0xe486('0x12')][_0xe486('0x1c2')]=function(_0x458759){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x1c3'),_0x458759[_0xe486('0x3a')]));if(!this[_0xe486('0x88')](_0x458759[_0xe486('0x158')])){return this['channel'][_0xe486('0x2f')](_0x458759,_0xe486('0x159'));}logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x15a'),this[_0xe486('0x11')][_0xe486('0x3d')],_0x458759['findBy']));var _0x4cd8e7=this[_0xe486('0x53')][_0xe486('0x70')](this,_0x458759[_0xe486('0x158')]);if(_0x4cd8e7){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x15b'),this[_0xe486('0x11')][_0xe486('0x3d')],_0x458759['findBy']));this['channel'][_0xe486('0xad')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe486('0x11')][_0xe486('0x3d')],_0x458759[_0xe486('0x158')]));return{'code':0xc8,'result':_0xe486('0x15c')};}else{logger['info'](util['format'](_0xe486('0x15d'),this[_0xe486('0x11')]['callerid'],_0x458759[_0xe486('0x158')]));this[_0xe486('0x11')][_0xe486('0xad')](util[_0xe486('0x2b')](_0xe486('0x15d'),this['channel'][_0xe486('0x3d')],_0x458759[_0xe486('0x158')]));return{'code':0xc8,'result':_0xe486('0x15e')};}};AGIVertices['prototype'][_0xe486('0x1c4')]=function(_0x56c71a){logger[_0xe486('0x31')](util['format'](_0xe486('0x1c5'),_0x56c71a[_0xe486('0x3a')]));var _0x50a2f2=this[_0xe486('0x11')]['exec'](_0xe486('0x1c6'),[_0x56c71a[_0xe486('0x1c7')],_0x56c71a[_0xe486('0x78')]]);if(_0x50a2f2['result']===-0x1){return _0x50a2f2;}return this['channel']['noop'](util[_0xe486('0x2b')](_0xe486('0x16f'),_0xe486('0x1c6'),_0x56c71a[_0xe486('0x1c7')]));};AGIVertices[_0xe486('0x12')][_0xe486('0x1c8')]=function(_0x20d845){logger[_0xe486('0x31')](util[_0xe486('0x2b')](_0xe486('0x1c9'),_0x20d845[_0xe486('0x3a')]));if(!this['isConfigured'](_0x20d845['variable_id'])){return this[_0xe486('0x11')]['error'](_0x20d845,_0xe486('0x1a7'));}var _0x878eb4=this[_0xe486('0x13')][_0xe486('0x70')](this,_0x20d845[_0xe486('0xe2')]);if(!_0x878eb4){return this['channel'][_0xe486('0x2f')](_0x20d845,_0xe486('0xe4'));}var _0x56bce6=this[_0xe486('0x11')][_0xe486('0x13')](_0x878eb4);return{'code':0xc8,'result':_0x56bce6[_0xe486('0xa7')]?_0x56bce6[_0xe486('0xa7')]:'-'};};String[_0xe486('0x12')][_0xe486('0xa6')]=function(_0x136373,_0x51442e){return this[_0xe486('0xa5')](_0x136373)[_0xe486('0x1ca')](_0x51442e);};module[_0xe486('0x1cb')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 0c11a7b..d1ccfa2 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 _0xe753=['Action','QueuePause','then','getAgent','voicePause','info','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name'];(function(_0xb6408d,_0x5add08){var _0x406b0d=function(_0x225b3e){while(--_0x225b3e){_0xb6408d['push'](_0xb6408d['shift']());}};_0x406b0d(++_0x5add08);}(_0xe753,0x13f));var _0x3e75=function(_0x1a8e9d,_0x34808a){_0x1a8e9d=_0x1a8e9d-0x0;var _0x5a9810=_0xe753[_0x1a8e9d];return _0x5a9810;};'use strict';var util=require(_0x3e75('0x0'));var _=require(_0x3e75('0x1'));var moment=require(_0x3e75('0x2'));var ami=require(_0x3e75('0x3'));var logger=require('../../../config/logger')(_0x3e75('0x4'));var RpcUser=require(_0x3e75('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x341739){this[_0x3e75('0x6')]=_0x341739['voiceQueues'];this[_0x3e75('0x7')]=_0x341739[_0x3e75('0x7')];this[_0x3e75('0x8')]=_0x341739[_0x3e75('0x8')];this['channels']={};ami['on'](_0x3e75('0x9'),this[_0x3e75('0xa')]['bind'](this));ami['on'](_0x3e75('0xb'),this['syncHangupRequest'][_0x3e75('0xc')](this));ami['on']('hangup',this[_0x3e75('0xd')]['bind'](this));ami['on'](_0x3e75('0xe'),this[_0x3e75('0xf')][_0x3e75('0xc')](this));ami['on'](_0x3e75('0x10'),this[_0x3e75('0x11')]['bind'](this));ami['on'](_0x3e75('0x12'),this[_0x3e75('0x13')][_0x3e75('0xc')](this));ami['on'](_0x3e75('0x14'),this[_0x3e75('0x15')]['bind'](this));}function getDiff(_0x4e55b2){var _0x381c99=moment()[_0x3e75('0x16')](0x0);var _0x44be26=moment(_0x4e55b2)[_0x3e75('0x16')](0x0);return _0x381c99[_0x3e75('0x17')](_0x44be26,'seconds');}Acw[_0x3e75('0x18')][_0x3e75('0x19')]=function(_0x45ca39){try{var _0xedf93b=this;var _0x4351a9=this[_0x3e75('0x1a')][_0x45ca39][_0x3e75('0x1b')];var _0x27c8ab=this[_0x3e75('0x1a')][_0x45ca39][_0x3e75('0x1c')];var _0x259a18=this[_0x3e75('0x6')][_0x27c8ab];var _0x2f1c62=![];var _0x8981d4=_0x3e75('0x1d');if(_0x259a18[_0x3e75('0x1e')]){if(_0x259a18[_0x3e75('0x1f')][_0x3e75('0x20')]){_0x2f1c62=!![];_0x8981d4=_0x259a18['mandatoryDispositionPause'][_0x3e75('0x20')];}}ami[_0x3e75('0x21')]({'action':_0x3e75('0x22'),'interface':_0x4351a9,'paused':!![],'reason':_0x8981d4})[_0x3e75('0x23')](function(_0x506b39){if(_0xedf93b[_0x3e75('0x7')][_0x4351a9]){return RpcUser[_0x3e75('0x24')](_0xedf93b[_0x3e75('0x7')][_0x4351a9]['id'])['then'](function(_0x344db2){if(_0x344db2&&!_0x344db2[_0x3e75('0x25')]){logger[_0x3e75('0x26')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x45ca39,_0x4351a9,_0x27c8ab);var _0x1c4122=_0xedf93b['channels'][_0x45ca39]['attended']&&_0xedf93b[_0x3e75('0x1a')][_0x45ca39][_0x3e75('0x27')]?_0xedf93b[_0x3e75('0x1a')][_0x45ca39][_0x3e75('0x27')]:_0x45ca39;return RpcUser[_0x3e75('0x28')](_0xedf93b[_0x3e75('0x7')][_0x4351a9],_0x8981d4,_0x1c4122)[_0x3e75('0x23')](function(_0xb8ee23){if(!_0x2f1c62){_0xedf93b[_0x3e75('0x8')][_0x4351a9]={};logger[_0x3e75('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x45ca39,_0xedf93b['voiceQueues'][_0x27c8ab][_0x3e75('0x29')],_0x4351a9,_0x27c8ab);_0xedf93b['timers'][_0x4351a9][_0x3e75('0x2a')]=setTimeout(_0xedf93b[_0x3e75('0x2b')]['bind'](_0xedf93b,_0x4351a9),_0xedf93b[_0x3e75('0x6')][_0x27c8ab][_0x3e75('0x29')]*0x3e8);_0xedf93b[_0x3e75('0x8')][_0x4351a9][_0x3e75('0x2c')]=moment()[_0x3e75('0x2d')](_0x3e75('0x2e'));_0xedf93b[_0x3e75('0x8')][_0x4351a9][_0x3e75('0x2f')]=_0x45ca39;_0xedf93b['timers'][_0x4351a9]['queue']=_0x27c8ab;_0xedf93b[_0x3e75('0x8')][_0x4351a9][_0x3e75('0x30')]=function(){var _0x3b7fc5=getDiff(_0xedf93b['timers'][_0x4351a9][_0x3e75('0x2c')]);clearTimeout(_0xedf93b[_0x3e75('0x8')][_0x4351a9]['timer']);_0xedf93b['timers'][_0x4351a9][_0x3e75('0x2a')]=![];RpcVoiceAgentReport[_0x3e75('0x31')]({'acwtime':_0x3b7fc5},_0xedf93b[_0x3e75('0x8')][_0x4351a9][_0x3e75('0x2f')],_0x4351a9)[_0x3e75('0x23')](function(_0x294da9){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x45ca39,_0x3b7fc5,_0x294da9);})[_0x3e75('0x32')](function(_0x26ef85){logger[_0x3e75('0x33')](_0x3e75('0x34'),_0x45ca39,_0x26ef85);});delete _0xedf93b[_0x3e75('0x8')][_0x4351a9];};}});}else{logger[_0x3e75('0x26')](_0x3e75('0x35'),_0x45ca39,_0x4351a9,_0x27c8ab);}});}})[_0x3e75('0x32')](function(_0x239138){logger[_0x3e75('0x33')](_0x3e75('0x36'),_0x45ca39,_0xedf93b[_0x3e75('0x6')][_0x27c8ab]['acwTimeout'],_0x4351a9,_0x27c8ab);})[_0x3e75('0x37')](function(){delete _0xedf93b[_0x3e75('0x1a')][_0x45ca39];});}catch(_0x43dcb7){logger['error']('[ACW][START]\x20%s',_0x43dcb7[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')]['stopAcw']=function(_0x53cf0d){try{var _0x58d18a=this;if(_0x58d18a[_0x3e75('0x8')][_0x53cf0d]){_0x58d18a[_0x3e75('0x8')][_0x53cf0d][_0x3e75('0x2a')]=![];var _0x46e222=_0x58d18a[_0x3e75('0x8')][_0x53cf0d][_0x3e75('0x2f')];var _0x5555e7=_0x58d18a[_0x3e75('0x8')][_0x53cf0d][_0x3e75('0x1c')];var _0x2e955e=_0x58d18a[_0x3e75('0x6')][_0x5555e7]['acwTimeout'];logger[_0x3e75('0x26')]('[%s][TIMER][STOP][AGENT:%s]',_0x46e222,_0x53cf0d);RpcUser[_0x3e75('0x39')](this['agents'][_0x53cf0d]);RpcVoiceAgentReport['update']({'acwtime':_0x2e955e,'agentacw':!![]},_0x46e222,_0x53cf0d)[_0x3e75('0x23')](function(_0xd95d26){logger[_0x3e75('0x26')](_0x3e75('0x3a'),_0x46e222,_0x2e955e,_0xd95d26);})[_0x3e75('0x32')](function(_0x113898){logger[_0x3e75('0x33')](_0x3e75('0x34'),_0x46e222,_0x113898);});}else{logger[_0x3e75('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x53cf0d);if(_0x58d18a[_0x3e75('0x8')]){logger['info'](_0x3e75('0x3b'),JSON['stringify'](_0x58d18a[_0x3e75('0x8')]));}}}catch(_0x579f0e){logger['error'](_0x3e75('0x3c'),_0x579f0e[_0x3e75('0x38')]);}};Acw['prototype']['syncAgentConnect']=function(_0x26819e){try{if(this['voiceQueues'][_0x26819e[_0x3e75('0x1c')]]&&(this[_0x3e75('0x6')][_0x26819e[_0x3e75('0x1c')]][_0x3e75('0x4')]||this['voiceQueues'][_0x26819e['queue']][_0x3e75('0x1e')])){if(this[_0x3e75('0x7')][_0x26819e[_0x3e75('0x1b')]]){this[_0x3e75('0x1a')][_0x26819e[_0x3e75('0x2f')]]={'queue':_0x26819e['queue'],'interface':_0x26819e[_0x3e75('0x1b')],'destlinkedid':_0x26819e[_0x3e75('0x27')]};}}}catch(_0x3664c3){logger['error'](_0x3e75('0x3d'),_0x3664c3['message']);}};Acw[_0x3e75('0x18')]['syncAgentConnectPreview']=function(_0x3ec2e2){try{if(this[_0x3e75('0x6')][_0x3ec2e2[_0x3e75('0x1c')]]&&(this[_0x3e75('0x6')][_0x3ec2e2[_0x3e75('0x1c')]]['acw']||this[_0x3e75('0x6')][_0x3ec2e2[_0x3e75('0x1c')]]['mandatoryDisposition'])){if(this['agents'][_0x3ec2e2[_0x3e75('0x1b')]]){this[_0x3e75('0x1a')][_0x3ec2e2[_0x3e75('0x2f')]]={'queue':_0x3ec2e2[_0x3e75('0x1c')],'interface':_0x3ec2e2[_0x3e75('0x1b')]};}}}catch(_0x88812d){logger['error'](_0x3e75('0x3e'),_0x88812d[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')]['syncHangupRequest']=function(_0x54672c){try{if(this[_0x3e75('0x1a')][_0x54672c[_0x3e75('0x2f')]]&&_[_0x3e75('0x3f')](this[_0x3e75('0x1a')][_0x54672c[_0x3e75('0x2f')]][_0x3e75('0x40')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x54672c[_0x3e75('0x2f')]);this[_0x3e75('0x19')](_0x54672c[_0x3e75('0x2f')]);}else if(this[_0x3e75('0x1a')][_0x54672c[_0x3e75('0x41')]]&&_[_0x3e75('0x3f')](this[_0x3e75('0x1a')][_0x54672c[_0x3e75('0x41')]][_0x3e75('0x40')])){logger[_0x3e75('0x26')](_0x3e75('0x42'),_0x54672c[_0x3e75('0x41')]);this[_0x3e75('0x19')](_0x54672c[_0x3e75('0x41')]);}}catch(_0x4214f2){logger[_0x3e75('0x33')](_0x3e75('0x43'),_0x4214f2[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')]['syncHangup']=function(_0x28033c){try{if(this[_0x3e75('0x1a')][_0x28033c[_0x3e75('0x2f')]]&&this[_0x3e75('0x1a')][_0x28033c[_0x3e75('0x2f')]]['attended']){logger['info'](_0x3e75('0x44'),_0x28033c[_0x3e75('0x2f')]);this['startAcw'](_0x28033c[_0x3e75('0x2f')]);}else if(this[_0x3e75('0x1a')][_0x28033c[_0x3e75('0x41')]]&&this['channels'][_0x28033c[_0x3e75('0x41')]][_0x3e75('0x40')]){logger['info'](_0x3e75('0x45'),_0x28033c[_0x3e75('0x41')]);this[_0x3e75('0x19')](_0x28033c[_0x3e75('0x41')]);}}catch(_0x5be5f9){logger['error'](_0x3e75('0x46'),_0x5be5f9[_0x3e75('0x38')]);}};Acw['prototype'][_0x3e75('0x11')]=function(_0x3275e4){try{if(!_[_0x3e75('0x47')](this[_0x3e75('0x1a')][_0x3275e4[_0x3e75('0x48')]])){this[_0x3e75('0x19')](_0x3275e4[_0x3e75('0x48')]);if(this[_0x3e75('0x1a')][_0x3275e4['secondtransfereruniqueid']]){this[_0x3e75('0x1a')][_0x3275e4[_0x3e75('0x49')]][_0x3e75('0x40')]=!![];this['channels'][_0x3275e4[_0x3e75('0x4a')]]=this['channels'][_0x3275e4['secondtransfereruniqueid']];delete this[_0x3e75('0x1a')][_0x3275e4[_0x3e75('0x49')]];}}else if(!_[_0x3e75('0x47')](this[_0x3e75('0x1a')][_0x3275e4[_0x3e75('0x4a')]])){this[_0x3e75('0x19')](_0x3275e4[_0x3e75('0x4a')]);if(this['channels'][_0x3275e4[_0x3e75('0x4b')]]){this['channels'][_0x3275e4[_0x3e75('0x4b')]][_0x3e75('0x40')]=!![];this['channels'][_0x3275e4[_0x3e75('0x48')]]=this['channels'][_0x3275e4['origtransfereruniqueid']];delete this['channels'][_0x3275e4[_0x3e75('0x4b')]];}}}catch(_0x473bcd){logger[_0x3e75('0x33')](_0x3e75('0x4c'),_0x473bcd[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')][_0x3e75('0x13')]=function(_0x3a42ef){try{if(this['channels'][_0x3a42ef[_0x3e75('0x4d')]]){logger[_0x3e75('0x26')](_0x3e75('0x4e'),JSON[_0x3e75('0x4f')](_0x3a42ef['transfereruniqueid']));this[_0x3e75('0x19')](_0x3a42ef[_0x3e75('0x4d')]);}else if(this[_0x3e75('0x1a')][_0x3a42ef[_0x3e75('0x50')]]){logger['info'](_0x3e75('0x51'),JSON[_0x3e75('0x4f')](_0x3a42ef[_0x3e75('0x50')]));this[_0x3e75('0x19')](_0x3a42ef[_0x3e75('0x50')]);}}catch(_0x2d0100){logger[_0x3e75('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x2d0100[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')]['syncAgentRingNoAnswer']=function(_0xf6c7a){try{if(this['voiceQueues'][_0xf6c7a[_0x3e75('0x1c')]]&&this[_0x3e75('0x6')][_0xf6c7a[_0x3e75('0x1c')]][_0x3e75('0x52')]===_0x3e75('0x53')){if(this[_0x3e75('0x7')][_0xf6c7a[_0x3e75('0x1b')]]){logger[_0x3e75('0x26')](_0x3e75('0x54'),_0xf6c7a['uniqueid'],_0xf6c7a[_0x3e75('0x1b')],_0xf6c7a[_0x3e75('0x1c')]);return RpcUser[_0x3e75('0x28')](this['agents'][_0xf6c7a['interface']],_0x3e75('0x55'),_0xf6c7a['uniqueid']);}}}catch(_0xb0811){logger['error'](_0x3e75('0x56'),_0xb0811[_0x3e75('0x38')]);}};module[_0x3e75('0x57')]=Acw; \ No newline at end of file +var _0xd9e4=['attended','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','linkedid','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','savePause','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','syncAgentConnect','[ACW][syncAgentConnectPreview]\x20%s','isUndefined'];(function(_0x48a7fa,_0x5ae3bb){var _0x2b3a62=function(_0x169839){while(--_0x169839){_0x48a7fa['push'](_0x48a7fa['shift']());}};_0x2b3a62(++_0x5ae3bb);}(_0xd9e4,0xc4));var _0x4d9e=function(_0xe44b1,_0x242100){_0xe44b1=_0xe44b1-0x0;var _0x368147=_0xd9e4[_0xe44b1];return _0x368147;};'use strict';var util=require(_0x4d9e('0x0'));var _=require('lodash');var moment=require(_0x4d9e('0x1'));var ami=require(_0x4d9e('0x2'));var logger=require('../../../config/logger')(_0x4d9e('0x3'));var RpcUser=require(_0x4d9e('0x4'));var RpcVoiceAgentReport=require(_0x4d9e('0x5'));function Acw(_0x36a57d){this[_0x4d9e('0x6')]=_0x36a57d[_0x4d9e('0x6')];this[_0x4d9e('0x7')]=_0x36a57d[_0x4d9e('0x7')];this['timers']=_0x36a57d[_0x4d9e('0x8')];this['channels']={};ami['on'](_0x4d9e('0x9'),this['syncAgentConnect'][_0x4d9e('0xa')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x4d9e('0xa')](this));ami['on'](_0x4d9e('0xb'),this[_0x4d9e('0xc')][_0x4d9e('0xa')](this));ami['on'](_0x4d9e('0xd'),this[_0x4d9e('0xe')][_0x4d9e('0xa')](this));ami['on'](_0x4d9e('0xf'),this[_0x4d9e('0x10')][_0x4d9e('0xa')](this));ami['on'](_0x4d9e('0x11'),this['syncBlindTransfer'][_0x4d9e('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0x4d9e('0x12')]['bind'](this));}function getDiff(_0x4c0e92){var _0x323c0f=moment()[_0x4d9e('0x13')](0x0);var _0x2a0d4f=moment(_0x4c0e92)[_0x4d9e('0x13')](0x0);return _0x323c0f[_0x4d9e('0x14')](_0x2a0d4f,_0x4d9e('0x15'));}Acw[_0x4d9e('0x16')][_0x4d9e('0x17')]=function(_0x3de0cc){try{var _0x43e953=this;var _0x25412c=this[_0x4d9e('0x18')][_0x3de0cc][_0x4d9e('0x19')];var _0x1d45f4=this[_0x4d9e('0x18')][_0x3de0cc][_0x4d9e('0x1a')];var _0x38a8a3=this['voiceQueues'][_0x1d45f4];var _0x494bb9=![];var _0x4ee28e=_0x4d9e('0x1b');if(_0x38a8a3[_0x4d9e('0x1c')]){if(_0x38a8a3[_0x4d9e('0x1d')][_0x4d9e('0x1e')]){_0x494bb9=!![];_0x4ee28e=_0x38a8a3[_0x4d9e('0x1d')][_0x4d9e('0x1e')];}}ami[_0x4d9e('0x1f')]({'action':_0x4d9e('0x20'),'interface':_0x25412c,'paused':!![],'reason':_0x4ee28e})[_0x4d9e('0x21')](function(_0x32ff1f){if(_0x43e953[_0x4d9e('0x7')][_0x25412c]){return RpcUser['getAgent'](_0x43e953['agents'][_0x25412c]['id'])[_0x4d9e('0x21')](function(_0x3964c8){if(_0x3964c8&&!_0x3964c8['voicePause']){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x3de0cc,_0x25412c,_0x1d45f4);var _0xe1b9ee=_0x43e953['channels'][_0x3de0cc]['attended']&&_0x43e953[_0x4d9e('0x18')][_0x3de0cc]['destlinkedid']?_0x43e953[_0x4d9e('0x18')][_0x3de0cc]['destlinkedid']:_0x3de0cc;return RpcUser[_0x4d9e('0x22')](_0x43e953[_0x4d9e('0x7')][_0x25412c],_0x4ee28e,_0xe1b9ee)['then'](function(_0x4aaa86){if(!_0x494bb9){_0x43e953[_0x4d9e('0x8')][_0x25412c]={};logger[_0x4d9e('0x23')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3de0cc,_0x43e953[_0x4d9e('0x6')][_0x1d45f4][_0x4d9e('0x24')],_0x25412c,_0x1d45f4);_0x43e953[_0x4d9e('0x8')][_0x25412c][_0x4d9e('0x25')]=setTimeout(_0x43e953[_0x4d9e('0x26')][_0x4d9e('0xa')](_0x43e953,_0x25412c),_0x43e953[_0x4d9e('0x6')][_0x1d45f4][_0x4d9e('0x24')]*0x3e8);_0x43e953[_0x4d9e('0x8')][_0x25412c][_0x4d9e('0x27')]=moment()[_0x4d9e('0x28')](_0x4d9e('0x29'));_0x43e953[_0x4d9e('0x8')][_0x25412c]['uniqueid']=_0x3de0cc;_0x43e953[_0x4d9e('0x8')][_0x25412c]['queue']=_0x1d45f4;_0x43e953['timers'][_0x25412c][_0x4d9e('0x2a')]=function(){var _0xe740b5=getDiff(_0x43e953[_0x4d9e('0x8')][_0x25412c]['lastPauseAt']);clearTimeout(_0x43e953[_0x4d9e('0x8')][_0x25412c][_0x4d9e('0x25')]);_0x43e953[_0x4d9e('0x8')][_0x25412c][_0x4d9e('0x25')]=![];RpcVoiceAgentReport[_0x4d9e('0x2b')]({'acwtime':_0xe740b5},_0x43e953['timers'][_0x25412c][_0x4d9e('0x2c')],_0x25412c)['then'](function(_0x48e8aa){logger[_0x4d9e('0x23')](_0x4d9e('0x2d'),_0x3de0cc,_0xe740b5,_0x48e8aa);})[_0x4d9e('0x2e')](function(_0x474df6){logger[_0x4d9e('0x2f')](_0x4d9e('0x30'),_0x3de0cc,_0x474df6);});delete _0x43e953[_0x4d9e('0x8')][_0x25412c];};}});}else{logger['info'](_0x4d9e('0x31'),_0x3de0cc,_0x25412c,_0x1d45f4);}});}})[_0x4d9e('0x2e')](function(_0x32e327){logger['error'](_0x4d9e('0x32'),_0x3de0cc,_0x43e953['voiceQueues'][_0x1d45f4][_0x4d9e('0x24')],_0x25412c,_0x1d45f4);})[_0x4d9e('0x33')](function(){delete _0x43e953[_0x4d9e('0x18')][_0x3de0cc];});}catch(_0x4513f9){logger['error'](_0x4d9e('0x34'),_0x4513f9[_0x4d9e('0x35')]);}};Acw[_0x4d9e('0x16')][_0x4d9e('0x26')]=function(_0xd4ff8a){try{var _0x48c12b=this;if(_0x48c12b[_0x4d9e('0x8')][_0xd4ff8a]){_0x48c12b[_0x4d9e('0x8')][_0xd4ff8a][_0x4d9e('0x25')]=![];var _0x15c8c4=_0x48c12b[_0x4d9e('0x8')][_0xd4ff8a]['uniqueid'];var _0x14bf65=_0x48c12b[_0x4d9e('0x8')][_0xd4ff8a][_0x4d9e('0x1a')];var _0x779ab5=_0x48c12b[_0x4d9e('0x6')][_0x14bf65][_0x4d9e('0x24')];logger['info'](_0x4d9e('0x36'),_0x15c8c4,_0xd4ff8a);RpcUser[_0x4d9e('0x37')](this['agents'][_0xd4ff8a]);RpcVoiceAgentReport[_0x4d9e('0x2b')]({'acwtime':_0x779ab5,'agentacw':!![]},_0x15c8c4,_0xd4ff8a)[_0x4d9e('0x21')](function(_0x388c66){logger[_0x4d9e('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x15c8c4,_0x779ab5,_0x388c66);})[_0x4d9e('0x2e')](function(_0xb5d37b){logger[_0x4d9e('0x2f')](_0x4d9e('0x30'),_0x15c8c4,_0xb5d37b);});}else{logger[_0x4d9e('0x2f')](_0x4d9e('0x38'),_0xd4ff8a);if(_0x48c12b[_0x4d9e('0x8')]){logger['info'](_0x4d9e('0x39'),JSON[_0x4d9e('0x3a')](_0x48c12b[_0x4d9e('0x8')]));}}}catch(_0x5d97f7){logger[_0x4d9e('0x2f')]('[ACW][STOP]\x20%s',_0x5d97f7[_0x4d9e('0x35')]);}};Acw['prototype'][_0x4d9e('0x3b')]=function(_0x317b7c){try{if(this[_0x4d9e('0x6')][_0x317b7c[_0x4d9e('0x1a')]]&&(this[_0x4d9e('0x6')][_0x317b7c[_0x4d9e('0x1a')]]['acw']||this[_0x4d9e('0x6')][_0x317b7c[_0x4d9e('0x1a')]][_0x4d9e('0x1c')])){if(this['agents'][_0x317b7c[_0x4d9e('0x19')]]){this[_0x4d9e('0x18')][_0x317b7c[_0x4d9e('0x2c')]]={'queue':_0x317b7c[_0x4d9e('0x1a')],'interface':_0x317b7c[_0x4d9e('0x19')],'destlinkedid':_0x317b7c['destlinkedid']};}}}catch(_0x52da8e){logger[_0x4d9e('0x2f')]('[ACW][syncAgentConnect]\x20%s',_0x52da8e[_0x4d9e('0x35')]);}};Acw[_0x4d9e('0x16')]['syncAgentConnectPreview']=function(_0x4f11aa){try{if(this[_0x4d9e('0x6')][_0x4f11aa['queue']]&&(this['voiceQueues'][_0x4f11aa[_0x4d9e('0x1a')]][_0x4d9e('0x3')]||this[_0x4d9e('0x6')][_0x4f11aa['queue']]['mandatoryDisposition'])){if(this[_0x4d9e('0x7')][_0x4f11aa[_0x4d9e('0x19')]]){this[_0x4d9e('0x18')][_0x4f11aa[_0x4d9e('0x2c')]]={'queue':_0x4f11aa[_0x4d9e('0x1a')],'interface':_0x4f11aa['interface']};}}}catch(_0x4da298){logger[_0x4d9e('0x2f')](_0x4d9e('0x3c'),_0x4da298['message']);}};Acw[_0x4d9e('0x16')]['syncHangupRequest']=function(_0x13d546){try{if(this[_0x4d9e('0x18')][_0x13d546[_0x4d9e('0x2c')]]&&_[_0x4d9e('0x3d')](this[_0x4d9e('0x18')][_0x13d546['uniqueid']][_0x4d9e('0x3e')])){logger[_0x4d9e('0x23')](_0x4d9e('0x3f'),_0x13d546[_0x4d9e('0x2c')]);this['startAcw'](_0x13d546[_0x4d9e('0x2c')]);}else if(this[_0x4d9e('0x18')][_0x13d546['linkedid']]&&_[_0x4d9e('0x3d')](this[_0x4d9e('0x18')][_0x13d546['linkedid']]['attended'])){logger[_0x4d9e('0x23')](_0x4d9e('0x40'),_0x13d546['linkedid']);this[_0x4d9e('0x17')](_0x13d546['linkedid']);}}catch(_0x417a10){logger[_0x4d9e('0x2f')](_0x4d9e('0x41'),_0x417a10['message']);}};Acw[_0x4d9e('0x16')][_0x4d9e('0xc')]=function(_0x413cb7){try{if(this['channels'][_0x413cb7['uniqueid']]&&this[_0x4d9e('0x18')][_0x413cb7[_0x4d9e('0x2c')]][_0x4d9e('0x3e')]){logger[_0x4d9e('0x23')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x413cb7['uniqueid']);this[_0x4d9e('0x17')](_0x413cb7['uniqueid']);}else if(this['channels'][_0x413cb7['linkedid']]&&this[_0x4d9e('0x18')][_0x413cb7[_0x4d9e('0x42')]][_0x4d9e('0x3e')]){logger[_0x4d9e('0x23')](_0x4d9e('0x43'),_0x413cb7[_0x4d9e('0x42')]);this[_0x4d9e('0x17')](_0x413cb7[_0x4d9e('0x42')]);}}catch(_0x496b86){logger[_0x4d9e('0x2f')](_0x4d9e('0x44'),_0x496b86[_0x4d9e('0x35')]);}};Acw['prototype'][_0x4d9e('0x10')]=function(_0x560e26){try{if(!_[_0x4d9e('0x45')](this[_0x4d9e('0x18')][_0x560e26[_0x4d9e('0x46')]])){this[_0x4d9e('0x17')](_0x560e26[_0x4d9e('0x46')]);if(this[_0x4d9e('0x18')][_0x560e26[_0x4d9e('0x47')]]){this[_0x4d9e('0x18')][_0x560e26[_0x4d9e('0x47')]]['attended']=!![];this[_0x4d9e('0x18')][_0x560e26[_0x4d9e('0x48')]]=this['channels'][_0x560e26[_0x4d9e('0x47')]];delete this[_0x4d9e('0x18')][_0x560e26[_0x4d9e('0x47')]];}}else if(!_[_0x4d9e('0x45')](this['channels'][_0x560e26[_0x4d9e('0x48')]])){this[_0x4d9e('0x17')](_0x560e26[_0x4d9e('0x48')]);if(this[_0x4d9e('0x18')][_0x560e26[_0x4d9e('0x49')]]){this[_0x4d9e('0x18')][_0x560e26[_0x4d9e('0x49')]][_0x4d9e('0x3e')]=!![];this[_0x4d9e('0x18')][_0x560e26[_0x4d9e('0x46')]]=this[_0x4d9e('0x18')][_0x560e26['origtransfereruniqueid']];delete this['channels'][_0x560e26['origtransfereruniqueid']];}}}catch(_0x577200){logger[_0x4d9e('0x2f')](_0x4d9e('0x4a'),_0x577200['message']);}};Acw[_0x4d9e('0x16')][_0x4d9e('0x4b')]=function(_0x5b3cfc){try{if(this[_0x4d9e('0x18')][_0x5b3cfc[_0x4d9e('0x4c')]]){logger['info'](_0x4d9e('0x4d'),JSON[_0x4d9e('0x3a')](_0x5b3cfc[_0x4d9e('0x4c')]));this[_0x4d9e('0x17')](_0x5b3cfc[_0x4d9e('0x4c')]);}else if(this[_0x4d9e('0x18')][_0x5b3cfc[_0x4d9e('0x4e')]]){logger[_0x4d9e('0x23')](_0x4d9e('0x4f'),JSON[_0x4d9e('0x3a')](_0x5b3cfc[_0x4d9e('0x4e')]));this[_0x4d9e('0x17')](_0x5b3cfc[_0x4d9e('0x4e')]);}}catch(_0xe9f77b){logger[_0x4d9e('0x2f')](_0x4d9e('0x50'),_0xe9f77b[_0x4d9e('0x35')]);}};Acw['prototype'][_0x4d9e('0xe')]=function(_0x3d5bcc){try{if(this['voiceQueues'][_0x3d5bcc['queue']]&&this[_0x4d9e('0x6')][_0x3d5bcc[_0x4d9e('0x1a')]][_0x4d9e('0x51')]==='all'){if(this[_0x4d9e('0x7')][_0x3d5bcc[_0x4d9e('0x19')]]){logger['info'](_0x4d9e('0x52'),_0x3d5bcc[_0x4d9e('0x2c')],_0x3d5bcc[_0x4d9e('0x19')],_0x3d5bcc['queue']);return RpcUser[_0x4d9e('0x22')](this[_0x4d9e('0x7')][_0x3d5bcc[_0x4d9e('0x19')]],_0x4d9e('0x53'),_0x3d5bcc[_0x4d9e('0x2c')]);}}}catch(_0x340466){logger[_0x4d9e('0x2f')](_0x4d9e('0x54'),_0x340466[_0x4d9e('0x35')]);}};module[_0x4d9e('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 41ac62b..afb3f94 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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x11cba3,_0x573392){_0x11cba3=_0x11cba3-0x0;var _0x2ecac3=_0x2032[_0x11cba3];return _0x2ecac3;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x47fcb5,_0xe186b4){var _0x50d416=function(_0x37004b){while(--_0x37004b){_0x47fcb5['push'](_0x47fcb5['shift']());}};_0x50d416(++_0xe186b4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb7e7[_0x13b8f3];return _0x1a6d06;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0f35e24..f420dc1 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0xe706,0xa3));var _0x6e70=function(_0x50408f,_0x92ffac){_0x50408f=_0x50408f-0x0;var _0xb02957=_0xe706[_0x50408f];return _0xb02957;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index c660e4c..cdb36c6 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc39f=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','queue','exports','util','lodash','moment','string','uniqueid','Contact','firstName','number','phone','name','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x54ac56,_0x5149c9){var _0x4ae038=function(_0x4124d6){while(--_0x4124d6){_0x54ac56['push'](_0x54ac56['shift']());}};_0x4ae038(++_0x5149c9);}(_0xc39f,0x144));var _0xfc39=function(_0x53dba8,_0x4c8665){_0x53dba8=_0x53dba8-0x0;var _0x3a39e7=_0xc39f[_0x53dba8];return _0x3a39e7;};'use strict';var util=require(_0xfc39('0x0'));var _=require(_0xfc39('0x1'));var moment=require(_0xfc39('0x2'));function checkNameSurname(_0x304dd8,_0x1924a1,_0x3bddda){var _0x20ca81='';if(!_['isNil'](_0x1924a1)&&'string'===typeof _0x1924a1){_0x20ca81+=_0x1924a1;}if(!_['isNil'](_0x3bddda)&&_0xfc39('0x3')===typeof _0x3bddda){_0x20ca81+='\x20'+_0x3bddda;}if(_0x20ca81!==''){return _0x20ca81;}return _0x304dd8;}function Action(_0x547f56,_0x4e3a23,_0x23006b){this['voiceQueue']=_0x547f56;this[_0xfc39('0x4')]=_0x23006b||undefined;this['name']=checkNameSurname(_0x4e3a23['Contact']['phone'],_0x4e3a23[_0xfc39('0x5')][_0xfc39('0x6')],_0x4e3a23[_0xfc39('0x5')]['lastName']);this[_0xfc39('0x7')]=_0x4e3a23['Contact'][_0xfc39('0x8')];this['queue']=_0x547f56[_0xfc39('0x9')];this[_0xfc39('0xa')]=_0x4e3a23['active']||![];this['type']=_0x547f56['type'];this[_0xfc39('0xb')]=_0x547f56[_0xfc39('0xb')]||0x3;this[_0xfc39('0xc')]=_0x4e3a23[_0xfc39('0xc')];this[_0xfc39('0xd')]=_0x4e3a23[_0xfc39('0xd')];this['countcongestionretry']=_0x4e3a23[_0xfc39('0xe')];this['countnoanswerretry']=_0x4e3a23[_0xfc39('0xf')];this[_0xfc39('0x10')]=_0x4e3a23[_0xfc39('0x10')];this[_0xfc39('0x11')]=_0x4e3a23[_0xfc39('0x11')];this[_0xfc39('0x12')]=_0x4e3a23['countabandonedretry'];this['countmachineretry']=_0x4e3a23[_0xfc39('0x13')];this[_0xfc39('0x14')]=_0x4e3a23['countagentrejectretry'];this[_0xfc39('0x15')]=_0x4e3a23[_0xfc39('0x15')];this[_0xfc39('0x16')]=_0x4e3a23[_0xfc39('0x16')];this['UserId']=_0x4e3a23[_0xfc39('0x17')];this[_0xfc39('0x18')]=_0x4e3a23['VoiceQueueId'];this[_0xfc39('0x19')]=_0x4e3a23['CampaignId'];this['idHopper']=_0x4e3a23['id'];this[_0xfc39('0x1a')]=_0x4e3a23['Contact']['firstName']||'';this['starttime']=moment()[_0xfc39('0x1b')](_0xfc39('0x1c'));this[_0xfc39('0x1d')]=_0x4e3a23[_0xfc39('0x1d')];this[_0xfc39('0x1e')]=_0x4e3a23[_0xfc39('0x1e')];this[_0xfc39('0x1f')]=_0x4e3a23[_0xfc39('0x1f')];this[_0xfc39('0x20')]=_0x4e3a23[_0xfc39('0x20')];this[_0xfc39('0x21')]='';this['originatecalleridname']='';}Action[_0xfc39('0x22')][_0xfc39('0x23')]=function(){return util[_0xfc39('0x1b')](_0xfc39('0x24'),this[_0xfc39('0x9')],this[_0xfc39('0x25')][_0xfc39('0x26')]>0x0?this[_0xfc39('0x7')][_0xfc39('0x27')](this[_0xfc39('0x25')][_0xfc39('0x26')]):this[_0xfc39('0x7')]);};Action[_0xfc39('0x22')][_0xfc39('0x28')]=function(){return this[_0xfc39('0x29')];};module[_0xfc39('0x2a')]=Action; \ No newline at end of file +var _0x4fc9=['idHopper','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','exports','util','lodash','moment','string','isNil','uniqueid','name','Contact','phone','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','UserId','VoiceQueueId','CampaignId'];(function(_0x2365db,_0x1389eb){var _0xc516f4=function(_0x936ab6){while(--_0x936ab6){_0x2365db['push'](_0x2365db['shift']());}};_0xc516f4(++_0x1389eb);}(_0x4fc9,0x156));var _0x94fc=function(_0x16c85d,_0x5e4a05){_0x16c85d=_0x16c85d-0x0;var _0x7c77eb=_0x4fc9[_0x16c85d];return _0x7c77eb;};'use strict';var util=require(_0x94fc('0x0'));var _=require(_0x94fc('0x1'));var moment=require(_0x94fc('0x2'));function checkNameSurname(_0x3339da,_0x3535f4,_0x244223){var _0x449833='';if(!_['isNil'](_0x3535f4)&&_0x94fc('0x3')===typeof _0x3535f4){_0x449833+=_0x3535f4;}if(!_[_0x94fc('0x4')](_0x244223)&&_0x94fc('0x3')===typeof _0x244223){_0x449833+='\x20'+_0x244223;}if(_0x449833!==''){return _0x449833;}return _0x3339da;}function Action(_0x491904,_0x433a9a,_0x948e11){this['voiceQueue']=_0x491904;this[_0x94fc('0x5')]=_0x948e11||undefined;this[_0x94fc('0x6')]=checkNameSurname(_0x433a9a[_0x94fc('0x7')][_0x94fc('0x8')],_0x433a9a[_0x94fc('0x7')]['firstName'],_0x433a9a['Contact'][_0x94fc('0x9')]);this['number']=_0x433a9a[_0x94fc('0x7')][_0x94fc('0x8')];this[_0x94fc('0xa')]=_0x491904[_0x94fc('0x6')];this[_0x94fc('0xb')]=_0x433a9a[_0x94fc('0xb')]||![];this[_0x94fc('0xc')]=_0x491904[_0x94fc('0xc')];this[_0x94fc('0xd')]=_0x491904[_0x94fc('0xd')]||0x3;this[_0x94fc('0xe')]=_0x433a9a[_0x94fc('0xe')];this['countbusyretry']=_0x433a9a[_0x94fc('0xf')];this[_0x94fc('0x10')]=_0x433a9a[_0x94fc('0x10')];this[_0x94fc('0x11')]=_0x433a9a['countnoanswerretry'];this[_0x94fc('0x12')]=_0x433a9a[_0x94fc('0x12')];this[_0x94fc('0x13')]=_0x433a9a[_0x94fc('0x13')];this[_0x94fc('0x14')]=_0x433a9a[_0x94fc('0x14')];this['countmachineretry']=_0x433a9a[_0x94fc('0x15')];this['countagentrejectretry']=_0x433a9a[_0x94fc('0x16')];this['ContactId']=_0x433a9a['ContactId'];this['ListId']=_0x433a9a['ListId'];this[_0x94fc('0x17')]=_0x433a9a[_0x94fc('0x17')];this[_0x94fc('0x18')]=_0x433a9a[_0x94fc('0x18')];this[_0x94fc('0x19')]=_0x433a9a[_0x94fc('0x19')];this[_0x94fc('0x1a')]=_0x433a9a['id'];this[_0x94fc('0x1b')]=_0x433a9a[_0x94fc('0x7')][_0x94fc('0x1c')]||'';this['starttime']=moment()[_0x94fc('0x1d')](_0x94fc('0x1e'));this['callback']=_0x433a9a[_0x94fc('0x1f')];this[_0x94fc('0x20')]=_0x433a9a['callbackuniqueid'];this['callbackat']=_0x433a9a[_0x94fc('0x21')];this['recallme']=_0x433a9a[_0x94fc('0x22')];this[_0x94fc('0x23')]='';this[_0x94fc('0x24')]='';}Action[_0x94fc('0x25')][_0x94fc('0x26')]=function(){return util[_0x94fc('0x1d')](_0x94fc('0x27'),this[_0x94fc('0x6')],this[_0x94fc('0x28')][_0x94fc('0x29')]>0x0?this[_0x94fc('0x2a')][_0x94fc('0x2b')](this[_0x94fc('0x28')][_0x94fc('0x29')]):this[_0x94fc('0x2a')]);};Action['prototype'][_0x94fc('0x2c')]=function(){return this[_0x94fc('0xa')];};module[_0x94fc('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 355d53d..8635dab 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x991a=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','countbusyretry'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x991a,0x1c1));var _0xa991=function(_0x2a341e,_0x515d38){_0x2a341e=_0x2a341e-0x0;var _0x211412=_0x991a[_0x2a341e];return _0x211412;};'use strict';var util=require(_0xa991('0x0'));var _=require(_0xa991('0x1'));var moment=require(_0xa991('0x2'));function getSeconds(_0x4ee072,_0xee3a50){var _0x59cd57=moment(_0x4ee072)[_0xa991('0x3')](0x0);var _0x48052f=moment(_0xee3a50)[_0xa991('0x3')](0x0);return _0x59cd57[_0xa991('0x4')](_0x48052f,_0xa991('0x5'));}function AgentComplete(_0x15029e,_0x5ca732){this[_0xa991('0x6')]=0x4;this['statedesc']='Answer';this[_0xa991('0x7')]=_0x15029e['scheduledat'];this[_0xa991('0x8')]=_0x15029e['type'];this[_0xa991('0x9')]=_0x15029e[_0xa991('0x8')]==='outbound'?'queue':_0x15029e[_0xa991('0x8')];this[_0xa991('0xa')]=_0x15029e[_0xa991('0xa')];this[_0xa991('0xb')]=_0x15029e['countcongestionretry'];this[_0xa991('0xc')]=_0x15029e[_0xa991('0xc')];this[_0xa991('0xd')]=_0x15029e[_0xa991('0xa')]+_0x15029e[_0xa991('0xb')]+_0x15029e[_0xa991('0xc')]+_0x15029e[_0xa991('0xe')]+_0x15029e['countdropretry']+_0x15029e[_0xa991('0xf')]+_0x15029e[_0xa991('0x10')]+_0x15029e[_0xa991('0x11')];this[_0xa991('0xe')]=_0x15029e[_0xa991('0xe')];this[_0xa991('0x12')]=_0x15029e[_0xa991('0x12')];this[_0xa991('0xf')]=_0x15029e[_0xa991('0xf')];this[_0xa991('0x10')]=_0x15029e[_0xa991('0x10')];this[_0xa991('0x11')]=_0x15029e[_0xa991('0x11')];this['uniqueid']=_0x5ca732[_0xa991('0x13')];this[_0xa991('0x14')]=_0x15029e[_0xa991('0x15')];this[_0xa991('0x16')]=_0x15029e[_0xa991('0x17')];this[_0xa991('0x18')]=_0x15029e[_0xa991('0x18')];this[_0xa991('0x19')]=_0x15029e[_0xa991('0x19')];this[_0xa991('0x1a')]=_0x15029e['answertime'];this['endtime']=moment()[_0xa991('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa991('0x1c')]=getSeconds(_0x15029e['responsetime'],_0x15029e['starttime']);this[_0xa991('0x1d')]=getSeconds(_0x15029e['answertime'],_0x15029e['responsetime']);this[_0xa991('0x1e')]=getSeconds(this['endtime'],_0x15029e[_0xa991('0x1a')]);this[_0xa991('0x1f')]=_0x5ca732['queue'];this[_0xa991('0x20')]=_0x5ca732[_0xa991('0x20')];this['reason']=_0x5ca732[_0xa991('0x21')];this['callback']=_0x15029e[_0xa991('0x22')];this[_0xa991('0x23')]=_0x15029e[_0xa991('0x23')];this[_0xa991('0x24')]=_0x15029e[_0xa991('0x24')];this[_0xa991('0x25')]=_0x15029e[_0xa991('0x25')];this[_0xa991('0x26')]=_0x15029e[_0xa991('0x26')];this[_0xa991('0x27')]=_0x15029e[_0xa991('0x27')];this[_0xa991('0x28')]=_0x15029e[_0xa991('0x28')];this[_0xa991('0x29')]=_0x15029e['VoiceQueueId'];this[_0xa991('0x2a')]=_0x15029e[_0xa991('0x2a')];this[_0xa991('0x2b')]=_0x15029e[_0xa991('0x2b')]||'';this[_0xa991('0x2c')]=_0x15029e[_0xa991('0x2c')]||'';}module[_0xa991('0x2d')]=AgentComplete; \ No newline at end of file +var _0xfdb4=['countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry'];(function(_0x240c65,_0x2e9f3a){var _0x96af50=function(_0xbb6030){while(--_0xbb6030){_0x240c65['push'](_0x240c65['shift']());}};_0x96af50(++_0x2e9f3a);}(_0xfdb4,0xf8));var _0x4fdb=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xfdb4[_0x494d1f];return _0x457b6e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4fdb('0x0'));function getSeconds(_0x4b429a,_0x932357){var _0x31427a=moment(_0x4b429a)[_0x4fdb('0x1')](0x0);var _0x110d31=moment(_0x932357)[_0x4fdb('0x1')](0x0);return _0x31427a[_0x4fdb('0x2')](_0x110d31,_0x4fdb('0x3'));}function AgentComplete(_0x14df78,_0x27b7ea){this[_0x4fdb('0x4')]=0x4;this['statedesc']=_0x4fdb('0x5');this[_0x4fdb('0x6')]=_0x14df78[_0x4fdb('0x6')];this[_0x4fdb('0x7')]=_0x14df78[_0x4fdb('0x7')];this[_0x4fdb('0x8')]=_0x14df78[_0x4fdb('0x7')]===_0x4fdb('0x9')?'queue':_0x14df78[_0x4fdb('0x7')];this[_0x4fdb('0xa')]=_0x14df78[_0x4fdb('0xa')];this['countcongestionretry']=_0x14df78[_0x4fdb('0xb')];this[_0x4fdb('0xc')]=_0x14df78['countnoanswerretry'];this[_0x4fdb('0xd')]=_0x14df78[_0x4fdb('0xa')]+_0x14df78[_0x4fdb('0xb')]+_0x14df78[_0x4fdb('0xc')]+_0x14df78[_0x4fdb('0xe')]+_0x14df78['countdropretry']+_0x14df78[_0x4fdb('0xf')]+_0x14df78['countmachineretry']+_0x14df78[_0x4fdb('0x10')];this[_0x4fdb('0xe')]=_0x14df78[_0x4fdb('0xe')];this[_0x4fdb('0x11')]=_0x14df78[_0x4fdb('0x11')];this[_0x4fdb('0xf')]=_0x14df78[_0x4fdb('0xf')];this['countmachineretry']=_0x14df78[_0x4fdb('0x12')];this[_0x4fdb('0x10')]=_0x14df78[_0x4fdb('0x10')];this[_0x4fdb('0x13')]=_0x27b7ea['uniqueid'];this[_0x4fdb('0x14')]=_0x14df78[_0x4fdb('0x15')];this[_0x4fdb('0x16')]=_0x14df78[_0x4fdb('0x17')];this[_0x4fdb('0x18')]=_0x14df78['starttime'];this[_0x4fdb('0x19')]=_0x14df78[_0x4fdb('0x19')];this[_0x4fdb('0x1a')]=_0x14df78[_0x4fdb('0x1a')];this[_0x4fdb('0x1b')]=moment()[_0x4fdb('0x1c')](_0x4fdb('0x1d'));this[_0x4fdb('0x1e')]=getSeconds(_0x14df78[_0x4fdb('0x19')],_0x14df78[_0x4fdb('0x18')]);this[_0x4fdb('0x1f')]=getSeconds(_0x14df78['answertime'],_0x14df78[_0x4fdb('0x19')]);this[_0x4fdb('0x20')]=getSeconds(this['endtime'],_0x14df78[_0x4fdb('0x1a')]);this[_0x4fdb('0x21')]=_0x27b7ea[_0x4fdb('0x21')];this[_0x4fdb('0x22')]=_0x27b7ea['membername'];this[_0x4fdb('0x23')]=_0x27b7ea['reason'];this['callback']=_0x14df78['callback'];this[_0x4fdb('0x24')]=_0x14df78[_0x4fdb('0x24')];this['callbackat']=_0x14df78['callbackat'];this[_0x4fdb('0x25')]=_0x14df78[_0x4fdb('0x25')];this[_0x4fdb('0x26')]=_0x14df78[_0x4fdb('0x26')];this[_0x4fdb('0x27')]=_0x14df78[_0x4fdb('0x27')];this['UserId']=_0x14df78[_0x4fdb('0x28')];this['VoiceQueueId']=_0x14df78[_0x4fdb('0x29')];this['CampaignId']=_0x14df78['CampaignId'];this[_0x4fdb('0x2a')]=_0x14df78[_0x4fdb('0x2a')]||'';this[_0x4fdb('0x2b')]=_0x14df78[_0x4fdb('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 839fe3c..ad2e9d7 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c9a=['type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x278364,_0x1a81ec){_0x278364=_0x278364-0x0;var _0x58de78=_0x1c9a[_0x278364];return _0x58de78;};'use strict';var util=require(_0xa1c9('0x0'));var _=require(_0xa1c9('0x1'));var moment=require('moment');function getSeconds(_0x6084bf,_0x867bbb){var _0x38c48f=moment(_0x6084bf)[_0xa1c9('0x2')](0x0);var _0x3d8576=moment(_0x867bbb)['milliseconds'](0x0);return _0x38c48f[_0xa1c9('0x3')](_0x3d8576,'seconds');}function Final(_0x1716cb){this[_0xa1c9('0x4')]=_0x1716cb[_0xa1c9('0x4')];this[_0xa1c9('0x5')]=_0x1716cb[_0xa1c9('0x5')];this[_0xa1c9('0x6')]=_0x1716cb[_0xa1c9('0x6')];this[_0xa1c9('0x7')]=_0x1716cb[_0xa1c9('0x6')]===_0xa1c9('0x8')?_0xa1c9('0x9'):_0x1716cb[_0xa1c9('0x6')];this['countbusyretry']=_0x1716cb['countbusyretry'];this[_0xa1c9('0xa')]=_0x1716cb['countcongestionretry'];this[_0xa1c9('0xb')]=_0x1716cb[_0xa1c9('0xb')];this[_0xa1c9('0xc')]=_0x1716cb[_0xa1c9('0xd')]+_0x1716cb[_0xa1c9('0xa')]+_0x1716cb[_0xa1c9('0xb')]+_0x1716cb[_0xa1c9('0xe')]+_0x1716cb[_0xa1c9('0xf')]+_0x1716cb[_0xa1c9('0x10')]+_0x1716cb[_0xa1c9('0x11')]+_0x1716cb[_0xa1c9('0x12')];this[_0xa1c9('0xe')]=_0x1716cb[_0xa1c9('0xe')];this[_0xa1c9('0xf')]=_0x1716cb[_0xa1c9('0xf')];this[_0xa1c9('0x10')]=_0x1716cb[_0xa1c9('0x10')];this[_0xa1c9('0x11')]=_0x1716cb[_0xa1c9('0x11')];this[_0xa1c9('0x12')]=_0x1716cb['countagentrejectretry'];this[_0xa1c9('0x9')]=_0x1716cb['queue'];this[_0xa1c9('0x13')]=_0x1716cb[_0xa1c9('0x13')];this[_0xa1c9('0x14')]=_0x1716cb[_0xa1c9('0x14')];this[_0xa1c9('0x15')]=_0x1716cb[_0xa1c9('0x15')];this[_0xa1c9('0x16')]=_0x1716cb[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x1716cb[_0xa1c9('0x16')];this[_0xa1c9('0x18')]=_0x1716cb[_0xa1c9('0x18')]||0x0;this['holdtime']=_0x1716cb[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x1a')]=_0x1716cb[_0xa1c9('0x1a')]||0x0;this[_0xa1c9('0x1b')]=_0x1716cb[_0xa1c9('0x1b')];this[_0xa1c9('0x1c')]=_0x1716cb[_0xa1c9('0x1c')];this[_0xa1c9('0x1d')]=_0x1716cb['callbackat'];this[_0xa1c9('0x1e')]=_0x1716cb[_0xa1c9('0x1e')];this['ContactId']=_0x1716cb[_0xa1c9('0x1f')];this[_0xa1c9('0x20')]=_0x1716cb[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x1716cb[_0xa1c9('0x21')];this['VoiceQueueId']=_0x1716cb[_0xa1c9('0x22')];this[_0xa1c9('0x23')]=_0x1716cb[_0xa1c9('0x23')];this['originatecalleridnum']=_0x1716cb[_0xa1c9('0x24')]||'';this[_0xa1c9('0x25')]=_0x1716cb[_0xa1c9('0x25')]||'';}module[_0xa1c9('0x26')]=Final; \ No newline at end of file +var _0x1af3=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x1af3,0x1ca));var _0x31af=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0x1af3[_0x4cfa2e];return _0x279b50;};'use strict';var util=require(_0x31af('0x0'));var _=require(_0x31af('0x1'));var moment=require(_0x31af('0x2'));function getSeconds(_0x1f7c8f,_0x450506){var _0xf27e22=moment(_0x1f7c8f)[_0x31af('0x3')](0x0);var _0x1a6ea6=moment(_0x450506)[_0x31af('0x3')](0x0);return _0xf27e22[_0x31af('0x4')](_0x1a6ea6,'seconds');}function Final(_0x19acd1){this[_0x31af('0x5')]=_0x19acd1[_0x31af('0x5')];this[_0x31af('0x6')]=_0x19acd1['scheduledat'];this[_0x31af('0x7')]=_0x19acd1[_0x31af('0x7')];this[_0x31af('0x8')]=_0x19acd1['type']===_0x31af('0x9')?_0x31af('0xa'):_0x19acd1[_0x31af('0x7')];this[_0x31af('0xb')]=_0x19acd1[_0x31af('0xb')];this[_0x31af('0xc')]=_0x19acd1[_0x31af('0xc')];this[_0x31af('0xd')]=_0x19acd1['countnoanswerretry'];this[_0x31af('0xe')]=_0x19acd1[_0x31af('0xb')]+_0x19acd1[_0x31af('0xc')]+_0x19acd1[_0x31af('0xd')]+_0x19acd1[_0x31af('0xf')]+_0x19acd1['countdropretry']+_0x19acd1[_0x31af('0x10')]+_0x19acd1[_0x31af('0x11')]+_0x19acd1['countagentrejectretry'];this['countnosuchnumberretry']=_0x19acd1[_0x31af('0xf')];this[_0x31af('0x12')]=_0x19acd1[_0x31af('0x12')];this[_0x31af('0x10')]=_0x19acd1[_0x31af('0x10')];this[_0x31af('0x11')]=_0x19acd1[_0x31af('0x11')];this[_0x31af('0x13')]=_0x19acd1[_0x31af('0x13')];this[_0x31af('0xa')]=_0x19acd1[_0x31af('0xa')];this['calleridname']=_0x19acd1[_0x31af('0x14')];this[_0x31af('0x15')]=_0x19acd1[_0x31af('0x15')];this[_0x31af('0x16')]=_0x19acd1[_0x31af('0x16')];this[_0x31af('0x17')]=_0x19acd1[_0x31af('0x17')];this[_0x31af('0x18')]=_0x19acd1[_0x31af('0x17')];this['ringtime']=_0x19acd1[_0x31af('0x19')]||0x0;this[_0x31af('0x1a')]=_0x19acd1[_0x31af('0x1a')]||0x0;this[_0x31af('0x1b')]=_0x19acd1[_0x31af('0x1b')]||0x0;this['callback']=_0x19acd1[_0x31af('0x1c')];this[_0x31af('0x1d')]=_0x19acd1[_0x31af('0x1d')];this[_0x31af('0x1e')]=_0x19acd1[_0x31af('0x1e')];this[_0x31af('0x1f')]=_0x19acd1[_0x31af('0x1f')];this[_0x31af('0x20')]=_0x19acd1[_0x31af('0x20')];this[_0x31af('0x21')]=_0x19acd1[_0x31af('0x21')];this[_0x31af('0x22')]=_0x19acd1[_0x31af('0x22')];this[_0x31af('0x23')]=_0x19acd1[_0x31af('0x23')];this['CampaignId']=_0x19acd1['CampaignId'];this['originatecalleridnum']=_0x19acd1[_0x31af('0x24')]||'';this[_0x31af('0x25')]=_0x19acd1['originatecalleridname']||'';}module[_0x31af('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9dc31f2..e3b348d 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82ee=['moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash'];(function(_0x3e3483,_0x348b06){var _0x314cf2=function(_0x492859){while(--_0x492859){_0x3e3483['push'](_0x3e3483['shift']());}};_0x314cf2(++_0x348b06);}(_0x82ee,0x1cb));var _0xe82e=function(_0x3ce652,_0x58bc59){_0x3ce652=_0x3ce652-0x0;var _0x5e02b6=_0x82ee[_0x3ce652];return _0x5e02b6;};'use strict';var util=require('util');var _=require(_0xe82e('0x0'));var moment=require(_0xe82e('0x1'));function getSeconds(_0x3bbcba,_0xf4fecd){var _0x3b6d6f=moment(_0x3bbcba)['milliseconds'](0x0);var _0x9f14bb=moment(_0xf4fecd)[_0xe82e('0x2')](0x0);return _0x3b6d6f[_0xe82e('0x3')](_0x9f14bb,_0xe82e('0x4'));}function Hangup(_0x5c9d22,_0x14a2c1){this[_0xe82e('0x5')]=0x4;this[_0xe82e('0x6')]=_0xe82e('0x7');this['scheduledat']=_0x5c9d22[_0xe82e('0x8')];this[_0xe82e('0x9')]=_0x5c9d22[_0xe82e('0x9')];this[_0xe82e('0xa')]=_0x5c9d22[_0xe82e('0x9')]===_0xe82e('0xb')?_0xe82e('0xc'):_0x5c9d22[_0xe82e('0x9')];this[_0xe82e('0xd')]=_0x5c9d22[_0xe82e('0xd')];this[_0xe82e('0xe')]=_0x5c9d22['countcongestionretry'];this[_0xe82e('0xf')]=_0x5c9d22['countnoanswerretry'];this[_0xe82e('0x10')]=_0x5c9d22[_0xe82e('0xd')]+_0x5c9d22[_0xe82e('0xe')]+_0x5c9d22[_0xe82e('0xf')]+_0x5c9d22['countnosuchnumberretry']+_0x5c9d22[_0xe82e('0x11')]+_0x5c9d22[_0xe82e('0x12')]+_0x5c9d22['countmachineretry']+_0x5c9d22['countagentrejectretry'];this['countnosuchnumberretry']=_0x5c9d22[_0xe82e('0x13')];this['countdropretry']=_0x5c9d22[_0xe82e('0x11')];this[_0xe82e('0x12')]=_0x5c9d22[_0xe82e('0x12')];this[_0xe82e('0x14')]=_0x5c9d22[_0xe82e('0x14')];this[_0xe82e('0x15')]=_0x5c9d22['countagentrejectretry'];this[_0xe82e('0x16')]=_0x14a2c1['uniqueid'];this[_0xe82e('0x17')]=_0x5c9d22[_0xe82e('0x18')];this[_0xe82e('0x19')]=_0x5c9d22[_0xe82e('0x1a')];this[_0xe82e('0x1b')]=_0x5c9d22[_0xe82e('0x1b')];this[_0xe82e('0x1c')]=_0x5c9d22[_0xe82e('0x1c')];this[_0xe82e('0x1d')]=moment()[_0xe82e('0x1e')](_0xe82e('0x1f'));this[_0xe82e('0x20')]=getSeconds(_0x5c9d22[_0xe82e('0x1c')],_0x5c9d22[_0xe82e('0x1b')]);this[_0xe82e('0x21')]=0x0;this['talktime']=getSeconds(this[_0xe82e('0x1d')],_0x5c9d22[_0xe82e('0x1c')]);this[_0xe82e('0xc')]=_0x5c9d22[_0xe82e('0xc')];this[_0xe82e('0x22')]=_0xe82e('0x23');this['reason']=_0x14a2c1[_0xe82e('0x24')];this[_0xe82e('0x25')]=_0x5c9d22[_0xe82e('0x25')];this['callbackuniqueid']=_0x5c9d22['callbackuniqueid'];this[_0xe82e('0x26')]=_0x5c9d22[_0xe82e('0x26')];this[_0xe82e('0x27')]=_0x5c9d22[_0xe82e('0x27')];this[_0xe82e('0x28')]=_0x5c9d22[_0xe82e('0x28')];this[_0xe82e('0x29')]=_0x5c9d22[_0xe82e('0x29')];this[_0xe82e('0x2a')]=_0x5c9d22[_0xe82e('0x2a')];this[_0xe82e('0x2b')]=_0x5c9d22[_0xe82e('0x2b')];this[_0xe82e('0x2c')]=_0x5c9d22[_0xe82e('0x2c')];}module[_0xe82e('0x2d')]=Hangup; \ No newline at end of file +var _0xb156=['starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x409dfe,_0x521b38){var _0x2cf771=function(_0x2231a5){while(--_0x2231a5){_0x409dfe['push'](_0x409dfe['shift']());}};_0x2cf771(++_0x521b38);}(_0xb156,0xc8));var _0x6b15=function(_0x1ee358,_0x42fdfb){_0x1ee358=_0x1ee358-0x0;var _0x4d01b9=_0xb156[_0x1ee358];return _0x4d01b9;};'use strict';var util=require(_0x6b15('0x0'));var _=require(_0x6b15('0x1'));var moment=require('moment');function getSeconds(_0x906a77,_0x24a863){var _0x300c0e=moment(_0x906a77)[_0x6b15('0x2')](0x0);var _0x35175c=moment(_0x24a863)['milliseconds'](0x0);return _0x300c0e['diff'](_0x35175c,_0x6b15('0x3'));}function Hangup(_0xd1ef44,_0x540602){this[_0x6b15('0x4')]=0x4;this['statedesc']=_0x6b15('0x5');this[_0x6b15('0x6')]=_0xd1ef44[_0x6b15('0x6')];this[_0x6b15('0x7')]=_0xd1ef44[_0x6b15('0x7')];this[_0x6b15('0x8')]=_0xd1ef44[_0x6b15('0x7')]===_0x6b15('0x9')?_0x6b15('0xa'):_0xd1ef44['type'];this[_0x6b15('0xb')]=_0xd1ef44[_0x6b15('0xb')];this[_0x6b15('0xc')]=_0xd1ef44['countcongestionretry'];this[_0x6b15('0xd')]=_0xd1ef44[_0x6b15('0xd')];this[_0x6b15('0xe')]=_0xd1ef44['countbusyretry']+_0xd1ef44['countcongestionretry']+_0xd1ef44[_0x6b15('0xd')]+_0xd1ef44[_0x6b15('0xf')]+_0xd1ef44[_0x6b15('0x10')]+_0xd1ef44['countabandonedretry']+_0xd1ef44[_0x6b15('0x11')]+_0xd1ef44[_0x6b15('0x12')];this[_0x6b15('0xf')]=_0xd1ef44[_0x6b15('0xf')];this[_0x6b15('0x10')]=_0xd1ef44[_0x6b15('0x10')];this[_0x6b15('0x13')]=_0xd1ef44[_0x6b15('0x13')];this[_0x6b15('0x11')]=_0xd1ef44[_0x6b15('0x11')];this[_0x6b15('0x12')]=_0xd1ef44[_0x6b15('0x12')];this['uniqueid']=_0x540602[_0x6b15('0x14')];this[_0x6b15('0x15')]=_0xd1ef44[_0x6b15('0x16')];this[_0x6b15('0x17')]=_0xd1ef44[_0x6b15('0x18')];this[_0x6b15('0x19')]=_0xd1ef44[_0x6b15('0x19')];this[_0x6b15('0x1a')]=_0xd1ef44[_0x6b15('0x1a')];this[_0x6b15('0x1b')]=moment()[_0x6b15('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6b15('0x1d')]=getSeconds(_0xd1ef44[_0x6b15('0x1a')],_0xd1ef44['starttime']);this[_0x6b15('0x1e')]=0x0;this[_0x6b15('0x1f')]=getSeconds(this[_0x6b15('0x1b')],_0xd1ef44[_0x6b15('0x1a')]);this[_0x6b15('0xa')]=_0xd1ef44[_0x6b15('0xa')];this[_0x6b15('0x20')]=_0x6b15('0x21');this[_0x6b15('0x22')]=_0x540602[_0x6b15('0x23')];this[_0x6b15('0x24')]=_0xd1ef44[_0x6b15('0x24')];this[_0x6b15('0x25')]=_0xd1ef44['callbackuniqueid'];this[_0x6b15('0x26')]=_0xd1ef44[_0x6b15('0x26')];this['recallme']=_0xd1ef44['recallme'];this[_0x6b15('0x27')]=_0xd1ef44[_0x6b15('0x27')];this['ListId']=_0xd1ef44[_0x6b15('0x28')];this[_0x6b15('0x29')]=_0xd1ef44[_0x6b15('0x29')];this['VoiceQueueId']=_0xd1ef44[_0x6b15('0x2a')];this['CampaignId']=_0xd1ef44[_0x6b15('0x2b')];}module[_0x6b15('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 16c049e..acf9076 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fe3=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x2fe3,0x187));var _0x32fe=function(_0x12fabf,_0xa88f60){_0x12fabf=_0x12fabf-0x0;var _0x288936=_0x2fe3[_0x12fabf];return _0x288936;};'use strict';var util=require(_0x32fe('0x0'));var _=require(_0x32fe('0x1'));var moment=require(_0x32fe('0x2'));function getSeconds(_0x2cd019,_0x42a438){var _0x28ee01=moment(_0x2cd019)[_0x32fe('0x3')](0x0);var _0x2552aa=moment(_0x42a438)[_0x32fe('0x3')](0x0);return _0x28ee01[_0x32fe('0x4')](_0x2552aa,_0x32fe('0x5'));}function History(_0x294ce8){this[_0x32fe('0x6')]=_0x294ce8[_0x32fe('0x6')];this[_0x32fe('0x7')]=_0x294ce8[_0x32fe('0x7')]||undefined;this[_0x32fe('0x8')]=_0x294ce8['type'];this['campaigntype']=_0x294ce8[_0x32fe('0x8')]===_0x32fe('0x9')?_0x32fe('0xa'):_0x294ce8[_0x32fe('0x8')];this[_0x32fe('0xb')]=_0x294ce8['countbusyretry'];this[_0x32fe('0xc')]=_0x294ce8[_0x32fe('0xc')];this[_0x32fe('0xd')]=_0x294ce8[_0x32fe('0xd')];this[_0x32fe('0xe')]=_0x294ce8[_0x32fe('0xb')]+_0x294ce8[_0x32fe('0xc')]+_0x294ce8['countnoanswerretry']+_0x294ce8[_0x32fe('0xf')]+_0x294ce8[_0x32fe('0x10')]+_0x294ce8['countabandonedretry']+_0x294ce8['countmachineretry']+_0x294ce8[_0x32fe('0x11')];this[_0x32fe('0xf')]=_0x294ce8[_0x32fe('0xf')];this[_0x32fe('0x10')]=_0x294ce8[_0x32fe('0x10')];this[_0x32fe('0x12')]=_0x294ce8[_0x32fe('0x12')];this[_0x32fe('0x13')]=_0x294ce8[_0x32fe('0x13')];this['countagentrejectretry']=_0x294ce8[_0x32fe('0x11')];this[_0x32fe('0xa')]=_0x294ce8[_0x32fe('0xa')];this[_0x32fe('0x14')]=_0x294ce8[_0x32fe('0x15')];this[_0x32fe('0x16')]=_0x294ce8[_0x32fe('0x17')];this[_0x32fe('0x18')]=_0x294ce8[_0x32fe('0x18')];this[_0x32fe('0x19')]=_0x294ce8['responsetime'];this[_0x32fe('0x1a')]=_0x294ce8[_0x32fe('0x19')];this[_0x32fe('0x1b')]=getSeconds(_0x294ce8['responsetime'],_0x294ce8[_0x32fe('0x18')]);this[_0x32fe('0x1c')]=0x0;this[_0x32fe('0x1d')]=0x0;this['callback']=_0x294ce8[_0x32fe('0x1e')];this['callbackuniqueid']=_0x294ce8[_0x32fe('0x1f')];this[_0x32fe('0x20')]=_0x294ce8[_0x32fe('0x20')];this[_0x32fe('0x21')]=_0x294ce8['recallme'];this[_0x32fe('0x22')]=_0x294ce8[_0x32fe('0x22')];this[_0x32fe('0x23')]=_0x294ce8[_0x32fe('0x23')];this[_0x32fe('0x24')]=_0x294ce8[_0x32fe('0x24')];this[_0x32fe('0x25')]=_0x294ce8[_0x32fe('0x25')];this[_0x32fe('0x26')]=_0x294ce8[_0x32fe('0x26')];this[_0x32fe('0x27')]=_0x294ce8['originatecalleridnum']||'';this[_0x32fe('0x28')]=_0x294ce8[_0x32fe('0x28')]||'';}module[_0x32fe('0x29')]=History; \ No newline at end of file +var _0xd950=['name','calleridnum','number','responsetime','endtime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xd950,0x67));var _0x0d95=function(_0x491916,_0x227ab4){_0x491916=_0x491916-0x0;var _0x3d4149=_0xd950[_0x491916];return _0x3d4149;};'use strict';var util=require(_0x0d95('0x0'));var _=require(_0x0d95('0x1'));var moment=require(_0x0d95('0x2'));function getSeconds(_0x1b49c4,_0x15b83f){var _0x6481f4=moment(_0x1b49c4)['milliseconds'](0x0);var _0x1baafa=moment(_0x15b83f)[_0x0d95('0x3')](0x0);return _0x6481f4[_0x0d95('0x4')](_0x1baafa,_0x0d95('0x5'));}function History(_0x431fb6){this['uniqueid']=_0x431fb6['uniqueid'];this[_0x0d95('0x6')]=_0x431fb6[_0x0d95('0x6')]||undefined;this[_0x0d95('0x7')]=_0x431fb6['type'];this[_0x0d95('0x8')]=_0x431fb6[_0x0d95('0x7')]==='outbound'?_0x0d95('0x9'):_0x431fb6['type'];this[_0x0d95('0xa')]=_0x431fb6[_0x0d95('0xa')];this[_0x0d95('0xb')]=_0x431fb6[_0x0d95('0xb')];this['countnoanswerretry']=_0x431fb6['countnoanswerretry'];this[_0x0d95('0xc')]=_0x431fb6['countbusyretry']+_0x431fb6['countcongestionretry']+_0x431fb6[_0x0d95('0xd')]+_0x431fb6[_0x0d95('0xe')]+_0x431fb6['countdropretry']+_0x431fb6['countabandonedretry']+_0x431fb6[_0x0d95('0xf')]+_0x431fb6[_0x0d95('0x10')];this[_0x0d95('0xe')]=_0x431fb6['countnosuchnumberretry'];this[_0x0d95('0x11')]=_0x431fb6[_0x0d95('0x11')];this[_0x0d95('0x12')]=_0x431fb6[_0x0d95('0x12')];this[_0x0d95('0xf')]=_0x431fb6['countmachineretry'];this['countagentrejectretry']=_0x431fb6[_0x0d95('0x10')];this[_0x0d95('0x9')]=_0x431fb6[_0x0d95('0x9')];this[_0x0d95('0x13')]=_0x431fb6[_0x0d95('0x14')];this[_0x0d95('0x15')]=_0x431fb6[_0x0d95('0x16')];this['starttime']=_0x431fb6['starttime'];this[_0x0d95('0x17')]=_0x431fb6[_0x0d95('0x17')];this[_0x0d95('0x18')]=_0x431fb6['responsetime'];this[_0x0d95('0x19')]=getSeconds(_0x431fb6[_0x0d95('0x17')],_0x431fb6[_0x0d95('0x1a')]);this[_0x0d95('0x1b')]=0x0;this[_0x0d95('0x1c')]=0x0;this[_0x0d95('0x1d')]=_0x431fb6[_0x0d95('0x1d')];this[_0x0d95('0x1e')]=_0x431fb6[_0x0d95('0x1e')];this['callbackat']=_0x431fb6[_0x0d95('0x1f')];this[_0x0d95('0x20')]=_0x431fb6['recallme'];this[_0x0d95('0x21')]=_0x431fb6[_0x0d95('0x21')];this['ListId']=_0x431fb6[_0x0d95('0x22')];this[_0x0d95('0x23')]=_0x431fb6[_0x0d95('0x23')];this[_0x0d95('0x24')]=_0x431fb6[_0x0d95('0x24')];this[_0x0d95('0x25')]=_0x431fb6[_0x0d95('0x25')];this['originatecalleridnum']=_0x431fb6[_0x0d95('0x26')]||'';this[_0x0d95('0x27')]=_0x431fb6[_0x0d95('0x27')]||'';}module[_0x0d95('0x28')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 4c3fc4e..75f5f16 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 _0x8f91=['pTalking','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','Scheduled\x20Calls:\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','---------------------------','merge','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','[uniqueid]','actions','[actions]','clearZombieChannels','isNil','Action','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','HANGUP','HangupInAMD','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','dialAMDActive','MACHINE','Machine','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','minutes','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr][createHistory]','countnosuchnumberretry','countabandonedretry','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','CampaignId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','outboundUnknownCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','endtime','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','calleridname','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','rrmemory','queueBooked','push','pick','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','iftime\x20%s,%s','interval','indexOf','content','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','dialMethod','handlePower','power','method\x20not\x20recognized','handlePreviewRecallNotifications','Agent','user:%s','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','dialPreviewRecallmeReminder','checkPreviewRecallReminder','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueTimeout','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','createdAt','updatedAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\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','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','startProgressive','ivrOriginated','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Intervals','\x20INTERVAL_IS_NULL','isEmpty','Interval','INTERVAL_IS_NULL','Error','stringify','milliseconds','diff','emit','outbound','strategy','available','loggedIn'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x8f91,0x1c6));var _0x18f9=function(_0x58e330,_0x3fe9d0){_0x58e330=_0x58e330-0x0;var _0x152dc3=_0x8f91[_0x58e330];return _0x152dc3;};'use strict';var util=require(_0x18f9('0x0'));var _=require(_0x18f9('0x1'));var BPromise=require(_0x18f9('0x2'));var uuid=require(_0x18f9('0x3'));var moment=require(_0x18f9('0x4'));var rr=require('rr');var md5=require(_0x18f9('0x5'));var Redis=require(_0x18f9('0x6'));var ut=require('../preview/util/util');var config=require(_0x18f9('0x7'));var logger=require(_0x18f9('0x8'))(_0x18f9('0x9'));var loggerBooked=require(_0x18f9('0x8'))(_0x18f9('0xa'));var loggerPredictive=require(_0x18f9('0x8'))(_0x18f9('0xb'));var loggerPredictiveCalls=require(_0x18f9('0x8'))(_0x18f9('0xc'));var loggerSyncQueueSummary=require(_0x18f9('0x8'))(_0x18f9('0xd'));var ami=require(_0x18f9('0xe'));config[_0x18f9('0xf')]=_['defaults'](config[_0x18f9('0xf')],{'host':_0x18f9('0x10'),'port':0x18eb});var io=require(_0x18f9('0x11'))(new Redis(config[_0x18f9('0xf')]));var cmHopper=require(_0x18f9('0x12'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Action=require(_0x18f9('0x13'));var History=require(_0x18f9('0x14'));var Final=require(_0x18f9('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x18f9('0x16'));var Hangup=require(_0x18f9('0x17'));var ipAgi=process[_0x18f9('0x18')][_0x18f9('0x19')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x18f9('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x18f9('0x1b')][_0x18f9('0x1c')]=function(_0xec3304){this[_0x18f9('0x1d')]=this['tail']?this['tail']['finally'](_0xec3304):_0xec3304();};function Dialer(_0x479aae,_0x398ac2){this[_0x18f9('0x1e')]=new Sequence();this[_0x18f9('0x1f')]=_0x398ac2;this[_0x18f9('0x20')]=_0x479aae[_0x18f9('0x20')];this[_0x18f9('0x21')]=_0x479aae[_0x18f9('0x21')];this[_0x18f9('0x22')]=_0x479aae[_0x18f9('0x22')];this[_0x18f9('0x23')]=_0x479aae[_0x18f9('0x23')];this[_0x18f9('0x24')]=config[_0x18f9('0x24')]||0x2;this[_0x18f9('0x25')]={};this['actions']={};this['contactsId']={};this[_0x18f9('0x26')]={};this['optionPredictive']={};this['startPredictive']={};this[_0x18f9('0x27')]={};this[_0x18f9('0x28')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x18f9('0x29'),this[_0x18f9('0x2a')]['bind'](this));ami['on'](_0x18f9('0x2b'),this[_0x18f9('0x2c')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x2e'),this[_0x18f9('0x2f')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x30'),this['syncAgentComplete'][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x31'),this['syncQueueSummary'][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x32'),this['syncHangup'][_0x18f9('0x2d')](this));ami['on']('newexten',this[_0x18f9('0x33')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x34'),this[_0x18f9('0x35')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x36'),this[_0x18f9('0x37')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x38'),this[_0x18f9('0x39')][_0x18f9('0x2d')](this));this[_0x18f9('0x3a')]();this[_0x18f9('0x3b')]();RpcSetting[_0x18f9('0x3c')]()['then'](function(_0x7e0eb2){previewRecallmeReminderInterval=_0x7e0eb2[_0x18f9('0x3d')];});}function isNotNull(_0x1ffc3e){return _0x1ffc3e!==null&&!_[_0x18f9('0x3e')](_0x1ffc3e);}function checkIsLoggedIn(_0xac5bb2,_0x1e3b99){return function(){if(_0x1e3b99<=0x0){_0xac5bb2[_0x18f9('0x3f')]='AGENTS_NOT_LOGGED';throw _0xac5bb2[_0x18f9('0x40')]+_0x18f9('0x41');}};}function isActive(_0x4c3698){return _0x4c3698;}function checkIsActive(_0x5bf603,_0xc17ad){return function(){if(!isActive(_0xc17ad)){_0x5bf603[_0x18f9('0x3f')]=_0x18f9('0x42');throw _0x5bf603[_0x18f9('0x40')]+_0x18f9('0x43');}};}function checkInterval(_0x37e8a2){return function(){if(!isNotNull(_0x37e8a2['Interval'])){_0x37e8a2['message']='INTERVAL_IS_NULL';throw _0x37e8a2['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x37e8a2['Interval'][_0x18f9('0x44')])){_0x37e8a2[_0x18f9('0x3f')]='INTERVAL_IS_NULL';throw _0x37e8a2['name']+_0x18f9('0x45');}if(!isNotNull(_[_0x18f9('0x46')](_0x37e8a2[_0x18f9('0x47')][_0x18f9('0x44')]))){_0x37e8a2['message']=_0x18f9('0x48');throw _0x37e8a2[_0x18f9('0x40')]+_0x18f9('0x45');}};}function msgResponse(_0x927f6b,_0x5200c2,_0x344ce1){return{'action':_0x927f6b,'response':_0x5200c2,'message':_0x344ce1,'stack':_0x344ce1};}function myreject(_0x5a5203){return function(_0x51dd10){return _0x5a5203(msgResponse('[ifTime][Action]',_0x18f9('0x49'),JSON[_0x18f9('0x4a')](_0x51dd10)));};}function getSeconds(_0x518800,_0x17f0fa){var _0x5c8f9c=moment(_0x518800)[_0x18f9('0x4b')](0x0);var _0x185d9d=moment(_0x17f0fa)[_0x18f9('0x4b')](0x0);return _0x5c8f9c[_0x18f9('0x4c')](_0x185d9d,'seconds');}function emit(_0x5c9110,_0x5d2b54,_0x394e86){io['to'](_0x5c9110)[_0x18f9('0x4d')](_0x5d2b54,_0x394e86);}function emitVoiceQueueSummary(_0x174417){if(_0x174417['type']===_0x18f9('0x4e')){var _0x25b9d3={'id':_0x174417['id'],'name':_0x174417[_0x18f9('0x40')],'strategy':_0x174417[_0x18f9('0x4f')],'answered':_0x174417['answered'],'available':_0x174417[_0x18f9('0x50')],'loggedIn':_0x174417[_0x18f9('0x51')],'pTalking':_0x174417[_0x18f9('0x52')],'sumBillable':_0x174417[_0x18f9('0x53')],'sumDuration':_0x174417['sumDuration'],'sumHoldTime':_0x174417[_0x18f9('0x54')]||0x0,'talking':_0x174417[_0x18f9('0x55')],'total':_0x174417[_0x18f9('0x56')],'type':_0x174417[_0x18f9('0x57')],'unmanaged':_0x174417['unmanaged'],'abandoned':_0x174417[_0x18f9('0x58')],'waiting':_0x174417[_0x18f9('0x59')],'loggedInDb':_0x174417[_0x18f9('0x5a')],'dialActive':_0x174417[_0x18f9('0x5b')],'dialMethod':_0x174417['dialMethod'],'dialOriginateCallerIdName':_0x174417['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x174417[_0x18f9('0x5c')],'dialOriginateTimeout':_0x174417[_0x18f9('0x5d')],'dialPrefix':_0x174417[_0x18f9('0x5e')],'outboundAnswerAgiCallsDay':_0x174417[_0x18f9('0x5f')],'outboundAnswerCallsDay':_0x174417[_0x18f9('0x60')],'outboundBlacklistCallsDay':_0x174417['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x174417[_0x18f9('0x61')],'outboundCongestionCallsDay':_0x174417[_0x18f9('0x62')],'outboundDropCallsDayACS':_0x174417[_0x18f9('0x63')],'outboundDropCallsDayCallersExit':_0x174417[_0x18f9('0x64')],'outboundDropCallsDayTimeout':_0x174417[_0x18f9('0x65')],'outboundNoAnswerCallsDay':_0x174417[_0x18f9('0x66')],'outboundNoSuchCallsDay':_0x174417[_0x18f9('0x67')],'outboundOriginateFailureCallsDay':_0x174417[_0x18f9('0x68')],'outboundReCallsDay':_0x174417['outboundReCallsDay'],'outboundRejectCallsDay':_0x174417['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x174417['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x174417[_0x18f9('0x69')],'predictiveIntervalAvgHoldtime':_0x174417[_0x18f9('0x6a')],'predictiveIntervalAvgTalktime':_0x174417[_0x18f9('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x174417[_0x18f9('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x174417['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x174417['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x174417[_0x18f9('0x6d')],'predictiveIntervalHitRate':_0x174417[_0x18f9('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x174417['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x174417[_0x18f9('0x6f')],'predictiveIntervalAvailable':_0x174417[_0x18f9('0x70')],'predictiveIntervalTotalCalls':_0x174417[_0x18f9('0x71')],'message':_0x174417['message'],'originated':_0x174417[_0x18f9('0x72')],'erlangCalls':_0x174417[_0x18f9('0x73')],'erlangCallToSecond':_0x174417[_0x18f9('0x74')],'erlangAbandonmentRate':_0x174417[_0x18f9('0x75')],'erlangBusyFactor':_0x174417[_0x18f9('0x76')],'startPredictive':_0x174417[_0x18f9('0x77')],'startProgressive':_0x174417[_0x18f9('0x27')]};if(_0x174417[_0x18f9('0x78')]){_0x25b9d3['Trunk']={'id':_0x174417[_0x18f9('0x78')]['id'],'name':_0x174417['Trunk'][_0x18f9('0x40')],'active':_0x174417[_0x18f9('0x78')]['active'],'callerid':_0x174417[_0x18f9('0x78')][_0x18f9('0x79')]};}if(_0x174417[_0x18f9('0x47')]){_0x25b9d3[_0x18f9('0x47')]={'id':_0x174417[_0x18f9('0x47')]['id'],'name':_0x174417['Interval']['name']};}var _0xb6b330=md5(JSON[_0x18f9('0x4a')](_0x25b9d3));if(_0x174417[_0x18f9('0x5')]!==_0xb6b330){_0x174417[_0x18f9('0x5')]=_0xb6b330;emit(util['format'](_0x18f9('0x7a'),_0x25b9d3[_0x18f9('0x40')]),_0x18f9('0x7b'),_0x25b9d3);}}}function emitCampaignSummary(_0x3a79e3){if(_0x3a79e3['type']===_0x18f9('0x7c')){emit(util[_0x18f9('0x7d')](_0x18f9('0x7e'),_0x3a79e3[_0x18f9('0x40')]),_0x18f9('0x7f'),_0x3a79e3);}}function checkGetDataPredictive(_0x1e433e){if(isNotNull(_0x1e433e)&&!_[_0x18f9('0x46')](_0x1e433e)){loggerPredictive[_0x18f9('0x80')](_0x18f9('0x81'));loggerPredictive[_0x18f9('0x80')](_0x18f9('0x82'),_0x1e433e['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x18f9('0x83'),_0x1e433e['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x18f9('0x84'),_0x1e433e[_0x18f9('0x85')]);loggerPredictive[_0x18f9('0x80')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e433e['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x86'),_0x1e433e['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x87'),_0x1e433e[_0x18f9('0x6b')]);loggerPredictive[_0x18f9('0x80')]('---------------------------');if(_0x1e433e[_0x18f9('0x71')]>0x0){if(!_[_0x18f9('0x3e')](_0x1e433e[_0x18f9('0x6b')])&&_0x1e433e[_0x18f9('0x6b')]>0x0){return!![];}loggerPredictive[_0x18f9('0x80')](_0x18f9('0x88'));if(!_[_0x18f9('0x3e')](_0x1e433e[_0x18f9('0x6a')])&&_0x1e433e[_0x18f9('0x6a')]>0x0){return!![];}loggerPredictive[_0x18f9('0x80')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x18f9('0x80')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x342112){return function(_0x36d2ce){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x18f9('0x80')](_0x18f9('0x89'),_0x36d2ce[_0x18f9('0x73')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36d2ce[_0x18f9('0x74')]);loggerPredictive['info'](_0x18f9('0x8a'),_0x36d2ce[_0x18f9('0x75')]);loggerPredictive[_0x18f9('0x80')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36d2ce[_0x18f9('0x76')]);loggerPredictive['info'](_0x18f9('0x8a'),_0x36d2ce['erlangAbandonmentRate']);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x8b'));_[_0x18f9('0x8c')](_0x342112,_0x36d2ce);};}function getDiff(_0x111290){var _0x416b32=moment()[_0x18f9('0x4b')](0x0);var _0x1fa623=moment(_0x111290)['milliseconds'](0x0);return _0x416b32['diff'](_0x1fa623,_0x18f9('0x8d'));}function ifInterval(_0x595d3c,_0x5bde3b){if(_[_0x18f9('0x3e')](_0x5bde3b)){return![];}return getDiff(_0x5bde3b)<_0x595d3c*0x3c;}function freeVariablesPredictive(_0xf1c04c){if(isNotNull(_0xf1c04c)){if(!_['isUndefined'](_0xf1c04c[_0x18f9('0x27')])){_0xf1c04c[_0x18f9('0x27')]=undefined;loggerPredictive['info'](_0xf1c04c[_0x18f9('0x40')],_0x18f9('0x8e'));}if(!_[_0x18f9('0x3e')](_0xf1c04c[_0x18f9('0x77')])){_0xf1c04c[_0x18f9('0x77')]=undefined;loggerPredictive[_0x18f9('0x80')](_0xf1c04c[_0x18f9('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x18f9('0x3e')](_0xf1c04c[_0x18f9('0x8f')])){clearInterval(_0xf1c04c[_0x18f9('0x8f')]);_0xf1c04c[_0x18f9('0x8f')]=undefined;loggerPredictive[_0x18f9('0x80')](_0xf1c04c[_0x18f9('0x40')],_0x18f9('0x90'));}}}function erlangb(_0x3e9bd4,_0x154c86){if(_0x154c86===0x0){return 0x0;}var _0xb4450b=0x1;for(var _0x3db838=0x1;_0x3db838<=_0x154c86;_0x3db838+=0x1){_0xb4450b=0x1+_0xb4450b*_0x3db838/_0x3e9bd4;}return 0x1/_0xb4450b;}function isVoiceQueueOutbound(_0x532e4f){return _0x532e4f==='outbound';}function isNotPreview(_0x1ac7c1){return _0x1ac7c1!=='preview';}function isCampaignIvr(_0x261159){return _0x261159===_0x18f9('0x7c');}function getCallerId(_0x5c6ecf,_0x26b3f6,_0x4de6f7){if(!_[_0x18f9('0x3e')](_0x4de6f7)&&typeof _0x4de6f7===_0x18f9('0x91')&&!_[_0x18f9('0x46')](_0x4de6f7)){if(!_[_0x18f9('0x3e')](_0x26b3f6)&&typeof _0x26b3f6===_0x18f9('0x91')&&!_[_0x18f9('0x46')](_0x26b3f6)){return util[_0x18f9('0x7d')](_0x18f9('0x92'),_0x26b3f6,_0x4de6f7);}return util[_0x18f9('0x7d')](_0x18f9('0x92'),_0x4de6f7,_0x4de6f7);}if(!_[_0x18f9('0x3e')](_0x5c6ecf)&&typeof _0x5c6ecf===_0x18f9('0x91')&&!_[_0x18f9('0x46')](_0x5c6ecf)){return _0x5c6ecf;}return _0x18f9('0x93');}function loggerCatchQueueSummary(_0x14bea6,_0x4ad02d){return function(_0x28f1c4){freeVariablesPredictive(_0x4ad02d);emitVoiceQueueSummary(_0x4ad02d);emitCampaignSummary(_0x4ad02d);loggerSyncQueueSummary['error'](_0x14bea6,util['inspect'](_0x28f1c4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x266d4c,_0x486f13){return function(_0xf91c4b){loggerPredictive[_0x18f9('0x94')](_0x486f13[_0x18f9('0x40')],_0x266d4c);loggerPredictive[_0x18f9('0x94')](_0xf91c4b[_0x18f9('0x95')]);freeVariablesPredictive(_0x486f13);};}function loggerCatch(_0x5b6b12){return function(_0x5356e4){logger['error'](_0x5b6b12,util['inspect'](_0x5356e4,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x833a0c){return _0x833a0c&&!_['isUndefined'](_0x833a0c)&&_0x833a0c[_0x18f9('0x96')]>0x0;}function decremetOriginate(_0x173944){if(!_[_0x18f9('0x3e')](_0x173944)&&_0x173944!==null){if(typeof _0x173944[_0x18f9('0x72')]!==_0x18f9('0x97')){if(_0x173944[_0x18f9('0x72')]>0x0){_0x173944[_0x18f9('0x72')]-=0x1;}else{logger['error'](_0x18f9('0x98'));}}}else{logger[_0x18f9('0x94')](_0x18f9('0x99'));}}function checkContactLowerLimitOriginate(_0x237d83,_0x47fc5e,_0x210feb){if(_0x47fc5e>_0x210feb){for(var _0x3786cc=0x0;_0x3786cc<_0x47fc5e-_0x210feb;_0x3786cc+=0x1){decremetOriginate(_0x237d83);}}}function loggerGetContactDialer(_0x107aac,_0x3c73da,_0x259ada){return function(_0x188f0c){checkContactLowerLimitOriginate(_0x3c73da,_0x259ada,0x0);logger[_0x18f9('0x94')](_0x107aac,util[_0x18f9('0x9a')](_0x188f0c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x124d2c){return function(_0x420e68){if(isNotNull(_0x420e68)&&isNotNull(_0x420e68[0x0])){if(_0x420e68[0x0][_0x18f9('0x9b')]>0x0){_0x124d2c[_0x18f9('0x3f')]=_0x18f9('0x9c');logger['info'](_0x18f9('0x9d')+_0x124d2c[_0x18f9('0x40')],_0x420e68[0x0]['contactsRescheduled'],'contacts');}else{_0x124d2c[_0x18f9('0x3f')]=_0x18f9('0x9e');logger['info'](_0x18f9('0x9f')+_0x124d2c['name']);}}};}function notSendMessagesQueue(_0x2cce3a){if(_0x2cce3a['sendMessageOneNotActive']){freeVariablesPredictive(_0x2cce3a);if(_0x2cce3a[_0x18f9('0x72')]===0x0&&_0x2cce3a['talking']===0x0&&_0x2cce3a[_0x18f9('0x59')]===0x0&&(_0x2cce3a[_0x18f9('0x52')]||0x0)===0x0){_0x2cce3a[_0x18f9('0xa0')]=![];_0x2cce3a[_0x18f9('0x50')]=0x0;_0x2cce3a[_0x18f9('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x18f9('0x94')](_0x18f9('0xa1'),_0x2cce3a[_0x18f9('0x40')],_0x18f9('0xa2'));}else{_0x2cce3a[_0x18f9('0x3f')]=_0x18f9('0xa3');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2cce3a[_0x18f9('0x40')],_0x18f9('0xa4'));}emitVoiceQueueSummary(_0x2cce3a);}}function notSendMessagesCampaign(_0x44191f){if(_0x44191f['sendMessageOneNotActive']){if(_0x44191f[_0x18f9('0x72')]===0x0){_0x44191f[_0x18f9('0xa0')]=![];_0x44191f['message']=_0x18f9('0x42');loggerSyncQueueSummary[_0x18f9('0x94')](_0x18f9('0xa5'),_0x44191f[_0x18f9('0x40')],_0x18f9('0xa2'));}else{_0x44191f['message']=_0x18f9('0xa3');loggerSyncQueueSummary[_0x18f9('0x94')](_0x18f9('0xa5'),_0x44191f[_0x18f9('0x40')],'is\x20disactive');}emitCampaignSummary(_0x44191f);}}function createObjHistory(_0x435c9c,_0x19a00d,_0x5098d9,_0x12b06c,_0x22d148){_0x435c9c['message']=_0x5098d9;var _0x13d7c1=new Action(_0x435c9c,_0x19a00d);var _0x45c3b6=new History(_0x13d7c1);_0x45c3b6[_0x18f9('0xa6')]=_0x12b06c;_0x45c3b6[_0x18f9('0xa7')]=_0x22d148;_0x45c3b6['endtime']=_0x13d7c1['starttime'];return _0x45c3b6;}Dialer[_0x18f9('0x1b')][_0x18f9('0x3b')]=function(){var _0x55e4e1=this;setInterval(function(){_0x55e4e1['clearZombieChannels'](_0x55e4e1['uniqueId'],_0x18f9('0xa8'));_0x55e4e1['clearZombieChannels'](_0x55e4e1[_0x18f9('0xa9')],_0x18f9('0xaa'));},0x32c8);};Dialer[_0x18f9('0x1b')][_0x18f9('0xab')]=function(_0x1ac820,_0x173ef8){var _0x2a12a7=this;for(var _0x31a4fe in _0x1ac820){if(typeof _0x1ac820[_0x31a4fe]!==_0x18f9('0x97')){this['sequence']['enqueue'](function(){if(!_[_0x18f9('0xac')](_0x1ac820[_0x31a4fe])){return ami[_0x18f9('0xad')]({'action':'status','channel':_0x1ac820[_0x31a4fe][_0x18f9('0xae')]})[_0x18f9('0xaf')](function(_0x5128e8){if(_0x5128e8[_0x18f9('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1ac820[_0x31a4fe]&&_0x1ac820[_0x31a4fe][_0x18f9('0x57')]!==_0x18f9('0x7c')){_0x2a12a7[_0x18f9('0xb0')](_0x2a12a7['voiceQueues'][_0x1ac820[_0x31a4fe]['queue']]);logger['error']('[Dialer][checkChannel]',_0x173ef8,_0x31a4fe,_0x1ac820[_0x31a4fe][_0x18f9('0xb1')]);delete _0x1ac820[_0x31a4fe];}if(_0x1ac820[_0x31a4fe]&&_0x1ac820[_0x31a4fe][_0x18f9('0x57')]===_0x18f9('0x7c')){_0x2a12a7[_0x18f9('0xb0')](_0x2a12a7[_0x18f9('0x21')][_0x1ac820[_0x31a4fe][_0x18f9('0xb1')]]);logger[_0x18f9('0x94')](_0x18f9('0xb2'),_0x173ef8,_0x31a4fe,_0x1ac820[_0x31a4fe][_0x18f9('0xb1')]);delete _0x1ac820[_0x31a4fe];}},0x2328);}});}});}}};Dialer[_0x18f9('0x1b')][_0x18f9('0xb3')]=function(_0x2a4f13){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopper['countReScheduled'](_0x2a4f13))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xb6')));};Dialer[_0x18f9('0x1b')][_0x18f9('0xb7')]=function(_0x38545b){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopperBlack[_0x18f9('0xb7')](_0x38545b))[_0x18f9('0xaf')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x18f9('0x1b')][_0x18f9('0xb8')]=function(_0x2f5d8b){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopperBlack[_0x18f9('0xb8')](_0x2f5d8b))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xb9')));};Dialer[_0x18f9('0x1b')][_0x18f9('0xba')]=function(_0x34635c){return BPromise['resolve']()[_0x18f9('0xb5')](cmHopperHistory[_0x18f9('0xbb')](_0x34635c))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xbc')));};Dialer['prototype'][_0x18f9('0xbd')]=function(_0xe94bd4){return BPromise[_0x18f9('0xb4')]()['then'](cmHopper[_0x18f9('0xbd')](_0xe94bd4))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xbe')));};Dialer[_0x18f9('0x1b')][_0x18f9('0xbf')]=function(_0x67f216,_0x4c7e5b,_0x5f0b3e){return BPromise[_0x18f9('0xb4')]()['then'](cmHopper[_0x18f9('0xbf')](_0x67f216,_0x4c7e5b,_0x5f0b3e))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xc0')));};Dialer['prototype'][_0x18f9('0xc1')]=function(_0x12de95,_0x341b7b,_0x101e2d,_0x1e9749,_0x4aae49){return BPromise['resolve']()['then'](cmHopper[_0x18f9('0xc1')](_0x12de95,_0x341b7b,_0x101e2d,_0x1e9749))[_0x18f9('0xaf')](function(_0x34b5ab){_0x4aae49[_0x18f9('0xc2')]-=_0x101e2d;_0x4aae49['temp']=_0x4aae49['temp']>0x0?_0x4aae49[_0x18f9('0xc2')]:0x0;loggerCatch(_0x18f9('0xc3'))(_0x34b5ab);});};Dialer[_0x18f9('0x1b')][_0x18f9('0xc4')]=function(_0x35307a,_0xefa8c9,_0x4e3484,_0x39b536){return BPromise['resolve']()['then'](cmHopper[_0x18f9('0xc4')](_0x35307a,_0xefa8c9,_0x4e3484))[_0x18f9('0xaf')](function(_0x494c27){_0x39b536[_0x18f9('0xc2')]-=_0xefa8c9;_0x39b536[_0x18f9('0xc2')]=_0x39b536[_0x18f9('0xc2')]>0x0?_0x39b536[_0x18f9('0xc2')]:0x0;loggerCatch(_0x18f9('0xc5'))(_0x494c27);});};Dialer[_0x18f9('0x1b')][_0x18f9('0xc6')]=function(_0x296ce1){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](voiceQueueRt['getVoiceQueueRtPauses'](_0x296ce1))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xc7')));};Dialer[_0x18f9('0x1b')]['moveContactManagedDialer']=function(_0x2ffbaa){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopper[_0x18f9('0xc8')](_0x2ffbaa))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xc9')));};Dialer[_0x18f9('0x1b')][_0x18f9('0xca')]=function(_0x43dd34){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopperHistory[_0x18f9('0xca')](_0x43dd34))['catch'](loggerCatch(_0x18f9('0xcb')));};Dialer['prototype'][_0x18f9('0xb0')]=function(_0x281a7d){if(!_[_0x18f9('0x3e')](_0x281a7d)&&_0x281a7d!==null){if(typeof _0x281a7d[_0x18f9('0x72')]!==_0x18f9('0x97')){if(_0x281a7d[_0x18f9('0x72')]>0x0){_0x281a7d[_0x18f9('0x72')]-=0x1;}else{logger[_0x18f9('0x94')](_0x18f9('0xcc'));}}}else{logger[_0x18f9('0x94')](_0x18f9('0xcd'));}};Dialer[_0x18f9('0x1b')][_0x18f9('0xce')]=function(_0x351f4f,_0xe39f8a){var _0x45258d=this;return function(_0x5bb0de){_0x45258d[_0x18f9('0xb0')](_0xe39f8a);logger['error'](_0x351f4f,util[_0x18f9('0x9a')](_0x5bb0de,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x26cdb4,_0x4596f3,_0x1f6939){var _0x1f4368={'state':0x19,'statedesc':_0x18f9('0xcf')};this[_0x18f9('0xb0')](_0x4596f3);this['saveInDb'](_['merge'](_0x1f4368,_['pick'](_0x1f6939,[_0x18f9('0xd0'),_0x18f9('0xd1'),_0x18f9('0xd2'),_0x18f9('0xd3'),'CampaignId'])),_0x18f9('0xd4'),_0x18f9('0xd5'));logger[_0x18f9('0x94')](_0x26cdb4);};Dialer['prototype'][_0x18f9('0xd6')]=function(_0x37d7d8){return _0x37d7d8===_0x18f9('0xd7');};Dialer['prototype'][_0x18f9('0xd8')]=function(_0x36449b){return!_[_0x18f9('0x3e')](_0x36449b)&&_0x36449b&&!_[_0x18f9('0x3e')](_0x36449b['name'])&&!_[_0x18f9('0x3e')](_0x36449b[_0x18f9('0xd9')])&&_0x36449b[_0x18f9('0xd9')]&&(this['trunks'][util[_0x18f9('0x7d')](_0x18f9('0xda'),_0x36449b[_0x18f9('0x40')])][_0x18f9('0xdb')]===_0x18f9('0xdc')||this[_0x18f9('0x23')][util[_0x18f9('0x7d')](_0x18f9('0xda'),_0x36449b[_0x18f9('0x40')])][_0x18f9('0xdb')]===_0x18f9('0xdd'));};Dialer[_0x18f9('0x1b')][_0x18f9('0xde')]=function(_0x34bc55,_0x5464b8,_0x1b9613){this[_0x18f9('0xca')](_0x34bc55)[_0x18f9('0xaf')](loggerCatch(_0x5464b8));this[_0x18f9('0xc8')](_0x34bc55)[_0x18f9('0xaf')](loggerCatch(_0x1b9613));};Dialer[_0x18f9('0x1b')][_0x18f9('0x35')]=function(_0x4e79ad){var _0x422656=this[_0x18f9('0x26')][_0x4e79ad[_0x18f9('0xdf')]];var _0x2a95ea;if(!_[_0x18f9('0xac')](_0x4e79ad)&&!_[_0x18f9('0xac')](_0x4e79ad[_0x18f9('0xe0')])&&!_[_0x18f9('0xac')](_0x4e79ad[_0x18f9('0xe0')][_0x18f9('0xe1')])&&_0x4e79ad['exten']==='xcally-motion-dialer'&&_0x422656){if(_0x422656[_0x18f9('0x57')]!==_0x18f9('0x7c')&&this[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]]['dialAMDActive']&&_0x4e79ad['value']===_0x18f9('0xe2')){delete this[_0x18f9('0x26')][_0x4e79ad['uniqueid']];this[_0x18f9('0xb0')](this[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]]);this[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x422656[_0x18f9('0xb1')]][_0x18f9('0x5f')]+=0x1;_0x2a95ea=new Hangup(_0x422656,_0x4e79ad);_0x2a95ea[_0x18f9('0xa6')]=0x12;_0x2a95ea[_0x18f9('0xa7')]=_0x18f9('0xe3');_0x2a95ea['membername']=_0x18f9('0xe4');ami[_0x18f9('0x4d')](_0x18f9('0xe5'),ut[_0x18f9('0xe6')](_0x2a95ea,'amd'));this[_0x18f9('0xde')](_0x2a95ea,_0x18f9('0xe7'),'[syncHangupInAMD]');}if(_0x422656[_0x18f9('0x57')]!==_0x18f9('0x7c')&&this[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]][_0x18f9('0xe8')]&&_0x4e79ad['value']===_0x18f9('0xe9')){var _0x3df167=this;return new BPromise(function(_0x1d5cb7,_0x54e08f){delete _0x3df167[_0x18f9('0x26')][_0x4e79ad['uniqueid']];_0x3df167['updateOriginated'](_0x3df167[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]]);_0x3df167[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]][_0x18f9('0x60')]+=0x1;_0x3df167[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]][_0x18f9('0x5f')]+=0x1;var _0x451b74=_0x3df167[_0x18f9('0x20')][_0x422656['queue']];var _0x2532d3=new Hangup(_0x422656,_0x4e79ad);_0x2532d3[_0x18f9('0xa6')]=0x13;_0x2532d3[_0x18f9('0xa7')]=_0x18f9('0xea');_0x2532d3[_0x18f9('0xeb')]='AMD';_0x2532d3[_0x18f9('0xec')]+=0x1;_0x2532d3[_0x18f9('0xed')]+=0x1;_0x2532d3[_0x18f9('0xee')]=!![];ami[_0x18f9('0x4d')](_0x18f9('0xe5'),ut[_0x18f9('0xe6')](_0x2532d3,_0x18f9('0xee')));_0x3df167[_0x18f9('0xca')](_0x2532d3)['catch'](loggerCatch(_0x18f9('0xef')));if(_0x2532d3[_0x18f9('0xf0')]+_0x2532d3[_0x18f9('0xf1')]+_0x2532d3[_0x18f9('0xf2')]+_0x2532d3['countnosuchnumberretry']+_0x2532d3[_0x18f9('0xf3')]+_0x2532d3['countabandonedretry']+_0x2532d3[_0x18f9('0xec')]+_0x2532d3[_0x18f9('0xf4')]>=_0x451b74[_0x18f9('0xf5')]){_0x3df167[_0x18f9('0xf6')](_0x2532d3,_0x1d5cb7,_0x54e08f,_0x18f9('0xf7'));}else{if(_0x2532d3[_0x18f9('0xec')]>=_0x451b74[_0x18f9('0xf8')]){_0x3df167[_0x18f9('0xf9')](_0x2532d3,_0x1d5cb7,_0x54e08f,'reason\x2019\x20machine....');}else{_0x3df167[_0x18f9('0xbd')]({'active':![],'countmachineretry':_0x2532d3[_0x18f9('0xec')],'scheduledat':moment()[_0x18f9('0xfa')](_0x451b74['dialMachineRetryFrequency'],_0x18f9('0xfb'))[_0x18f9('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2532d3[_0x18f9('0xd0')],'ListId':_0x2532d3['ListId'],'VoiceQueueId':_0x2532d3[_0x18f9('0xd3')]||undefined,'CampaignId':_0x2532d3['CampaignId']||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xfc')));_0x1d5cb7({'reschedule':0x1});}}});}if(_0x422656['type']===_0x18f9('0x7c')&&this[_0x18f9('0x21')][_0x422656['queue']]['dialAMDActive']&&_0x4e79ad[_0x18f9('0xfd')]===_0x18f9('0xe2')){delete this[_0x18f9('0x26')][_0x4e79ad[_0x18f9('0xdf')]];this[_0x18f9('0xb0')](this['campaigns'][_0x422656[_0x18f9('0xb1')]]);_0x2a95ea=new Hangup(_0x422656,_0x4e79ad);_0x2a95ea[_0x18f9('0xa6')]=0x12;_0x2a95ea[_0x18f9('0xa7')]=_0x18f9('0xe3');_0x2a95ea[_0x18f9('0xeb')]=_0x18f9('0xe4');ami['emit'](_0x18f9('0xe5'),ut[_0x18f9('0xe6')](_0x2a95ea,_0x18f9('0xee')));this[_0x18f9('0xde')](_0x2a95ea,_0x18f9('0xfe'),'[syncHangupInAMDIvr]');}if(_0x422656[_0x18f9('0x57')]===_0x18f9('0x7c')&&this['campaigns'][_0x422656[_0x18f9('0xb1')]]['dialAMDActive']&&_0x4e79ad[_0x18f9('0xfd')]===_0x18f9('0xe9')){var _0x3df167=this;return new BPromise(function(_0x259a33,_0x35c086){delete _0x3df167[_0x18f9('0x26')][_0x4e79ad[_0x18f9('0xdf')]];_0x3df167['updateOriginated'](_0x3df167[_0x18f9('0x21')][_0x422656[_0x18f9('0xb1')]]);_0x3df167[_0x18f9('0x21')][_0x422656['queue']]['outboundAnswerCallsDay']+=0x1;_0x3df167[_0x18f9('0x21')][_0x422656[_0x18f9('0xb1')]][_0x18f9('0x5f')]+=0x1;var _0x363d8d=_0x3df167[_0x18f9('0x21')][_0x422656[_0x18f9('0xb1')]];var _0x3dc5e6=new Hangup(_0x422656,_0x4e79ad);_0x3dc5e6['state']=0x13;_0x3dc5e6[_0x18f9('0xa7')]=_0x18f9('0xea');_0x3dc5e6[_0x18f9('0xeb')]=_0x18f9('0xe4');_0x3dc5e6[_0x18f9('0xec')]+=0x1;_0x3dc5e6[_0x18f9('0xed')]+=0x1;_0x3dc5e6[_0x18f9('0xee')]=!![];ami[_0x18f9('0x4d')]('custom:amd',ut[_0x18f9('0xe6')](_0x3dc5e6,'amd'));_0x3df167['createHistory'](_0x3dc5e6)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xef')));if(_0x3dc5e6['countbusyretry']+_0x3dc5e6[_0x18f9('0xf1')]+_0x3dc5e6[_0x18f9('0xf2')]+_0x3dc5e6[_0x18f9('0xff')]+_0x3dc5e6[_0x18f9('0xf3')]+_0x3dc5e6[_0x18f9('0x100')]+_0x3dc5e6['countmachineretry']+_0x3dc5e6[_0x18f9('0xf4')]>=_0x363d8d[_0x18f9('0xf5')]){_0x3df167[_0x18f9('0xf6')](_0x3dc5e6,_0x259a33,_0x35c086,'reason19\x20machine....');}else{if(_0x3dc5e6[_0x18f9('0xec')]>=_0x363d8d['dialMachineMaxRetry']){_0x3df167[_0x18f9('0xf9')](_0x3dc5e6,_0x259a33,_0x35c086,_0x18f9('0x101'));}else{_0x3df167['rescheduleContact']({'active':![],'countmachineretry':_0x3dc5e6['countmachineretry'],'scheduledat':moment()[_0x18f9('0xfa')](_0x363d8d[_0x18f9('0x102')],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x3dc5e6['ContactId'],'ListId':_0x3dc5e6['ListId'],'VoiceQueueId':_0x3dc5e6['VoiceQueueId']||undefined,'CampaignId':_0x3dc5e6[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xfc')));_0x259a33({'reschedule':0x1});}}});}}};Dialer[_0x18f9('0x1b')]['syncHangup']=function(_0x6746c5){var _0x277f94=this['uniqueId'][_0x6746c5[_0x18f9('0xdf')]];var _0x42b580=this;var _0x5aed9e;if(_0x277f94&&_0x277f94[_0x18f9('0x57')]===_0x18f9('0x7c')){delete this[_0x18f9('0x26')][_0x6746c5[_0x18f9('0xdf')]];this['updateOriginated'](this[_0x18f9('0x21')][_0x277f94[_0x18f9('0xb1')]]);this[_0x18f9('0x21')][_0x277f94[_0x18f9('0xb1')]][_0x18f9('0x105')]+=0x1;_0x5aed9e=new Hangup(_0x277f94,_0x6746c5);this[_0x18f9('0xca')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x106')));this[_0x18f9('0xc8')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x107')));}if(_0x277f94&&_0x277f94['type']!==_0x18f9('0x7c')&&isNotNull(this['voiceQueues'][_0x277f94[_0x18f9('0xb1')]]['dialQueueProject'])){delete this[_0x18f9('0x26')][_0x6746c5[_0x18f9('0xdf')]];this[_0x18f9('0xb0')](this['voiceQueues'][_0x277f94[_0x18f9('0xb1')]]);this['voiceQueues'][_0x277f94[_0x18f9('0xb1')]][_0x18f9('0x60')]+=0x1;this['voiceQueues'][_0x277f94[_0x18f9('0xb1')]][_0x18f9('0x5f')]+=0x1;_0x5aed9e=new Hangup(_0x277f94,_0x6746c5);_0x5aed9e[_0x18f9('0xa6')]=0x10;_0x5aed9e[_0x18f9('0xa7')]='AnswerAGI';_0x5aed9e[_0x18f9('0xeb')]='AGI';this[_0x18f9('0xca')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x106')));this[_0x18f9('0xc8')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x107')));}if(_0x277f94&&_0x277f94[_0x18f9('0x57')]!==_0x18f9('0x7c')&&!isNotNull(this[_0x18f9('0x20')][_0x277f94['queue']][_0x18f9('0x108')])){delete this[_0x18f9('0x26')][_0x6746c5[_0x18f9('0xdf')]];this[_0x18f9('0xb0')](this[_0x18f9('0x20')][_0x277f94[_0x18f9('0xb1')]]);this[_0x18f9('0x20')][_0x277f94[_0x18f9('0xb1')]][_0x18f9('0x109')]+=0x1;_0x5aed9e=new Hangup(_0x277f94,_0x6746c5);_0x5aed9e[_0x18f9('0xa6')]=0xc;_0x5aed9e[_0x18f9('0xa7')]=_0x6746c5['cause-txt'];_0x5aed9e[_0x18f9('0xeb')]='Unknow';this[_0x18f9('0xca')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x106')));this['moveContactManagedDialer'](_0x5aed9e)['catch'](loggerCatch(_0x18f9('0x107')));}};Dialer[_0x18f9('0x1b')]['syncAgentComplete']=function(_0x489cfe){var _0x555302=this[_0x18f9('0x26')][_0x489cfe[_0x18f9('0xdf')]];var _0x59ffa1=this;if(this['voiceQueues'][_0x489cfe[_0x18f9('0xb1')]]){if(_0x555302&&_0x555302['type']!==_0x18f9('0x7c')){delete this[_0x18f9('0x26')][_0x489cfe['uniqueid']];this[_0x18f9('0x20')][_0x489cfe['queue']][_0x18f9('0x60')]+=0x1;var _0x37600b=new AgentComplete(_0x555302,_0x489cfe);if(_0x489cfe[_0x18f9('0x10a')]===_0x18f9('0x10b')){_0x37600b[_0x18f9('0x10c')]=this[_0x18f9('0x20')][_0x489cfe[_0x18f9('0xb1')]][_0x18f9('0x10d')]&&this[_0x18f9('0x20')][_0x489cfe[_0x18f9('0xb1')]][_0x18f9('0x10e')]?moment()[_0x18f9('0x7d')](_0x18f9('0x103')):undefined;}this[_0x18f9('0xca')](_0x37600b)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x10f')));this['moveContactManagedDialer'](_0x37600b)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x110')));}}};Dialer[_0x18f9('0x1b')][_0x18f9('0x2a')]=function(_0x156716){if(this[_0x18f9('0x20')][_0x156716[_0x18f9('0xb1')]]){if(this[_0x18f9('0x26')][_0x156716[_0x18f9('0xdf')]]&&this[_0x18f9('0x26')][_0x156716[_0x18f9('0xdf')]][_0x18f9('0x57')]!==_0x18f9('0x7c')){this[_0x18f9('0xb0')](this[_0x18f9('0x20')][_0x156716[_0x18f9('0xb1')]]);this[_0x18f9('0x26')][_0x156716[_0x18f9('0xdf')]][_0x18f9('0x111')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));}}};Dialer['prototype'][_0x18f9('0x112')]=function(_0x1ea864){this[_0x18f9('0xca')](_0x1ea864)['catch'](loggerCatch(_0x18f9('0x10f')));this[_0x18f9('0xc8')](_0x1ea864)['catch'](loggerCatch(_0x18f9('0x113')));};Dialer[_0x18f9('0x1b')]['syncQueueCallerAbandon']=function(_0xa13520){var _0x4a6ca1=this[_0x18f9('0x26')][_0xa13520[_0x18f9('0xdf')]];var _0x3bfe99=this;if(this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]]){if(_0x4a6ca1&&_0x4a6ca1[_0x18f9('0x57')]!==_0x18f9('0x7c')){delete this[_0x18f9('0x26')][_0xa13520[_0x18f9('0xdf')]];this[_0x18f9('0xb0')](this[_0x18f9('0x20')][_0xa13520['queue']]);_0x4a6ca1[_0x18f9('0x114')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));var _0x3020aa=new QueueCallerAbandon(_0x4a6ca1,_0xa13520);if(getSeconds(_0x4a6ca1[_0x18f9('0x114')],_0x4a6ca1[_0x18f9('0x115')])>=_0x4a6ca1['dialQueueTimeout']){this[_0x18f9('0x20')][_0xa13520['queue']][_0x18f9('0x85')]+=0x1;this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]][_0x18f9('0x65')]+=0x1;this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]][_0x18f9('0x6d')]+=0x1;_0x3020aa['state']=0xa;_0x3020aa[_0x18f9('0xa7')]=_0x18f9('0x116');_0x3020aa['dropreason']=_0x18f9('0x117');_0x3020aa[_0x18f9('0x10c')]=this[_0x18f9('0x20')][_0xa13520['queue']]['dialQueueProject2']?moment()[_0x18f9('0x7d')](_0x18f9('0x103')):undefined;_0x3020aa['countdropretry']+=0x1;_0x3020aa['countglobal']+=0x1;if(_0x3020aa['countdropretry']>=this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]][_0x18f9('0x118')]){this[_0x18f9('0x112')](_0x3020aa);}else{this[_0x18f9('0xbd')]({'active':![],'countdropretry':_0x3020aa[_0x18f9('0xf3')],'scheduledat':moment()['add'](this['voiceQueues'][_0xa13520[_0x18f9('0xb1')]]['dialDropRetryFrequency'],'minutes')[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x4a6ca1['ContactId'],'ListId':_0x4a6ca1['ListId'],'VoiceQueueId':_0x4a6ca1[_0x18f9('0xd3')]||undefined,'CampaignId':_0x4a6ca1[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x119')));var _0x228792=new History(_0x3020aa);_0x228792['state']=0xa;_0x228792[_0x18f9('0xa7')]='Drop';_0x228792[_0x18f9('0x11a')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));_0x228792[_0x18f9('0x11b')]=_0x228792['starttime'];_0x228792['calleridname']=_0x3020aa['calleridname'];_0x228792[_0x18f9('0x11c')]=_0x3020aa[_0x18f9('0x11c')];this[_0x18f9('0xca')](_0x228792)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x11d')));}}else{this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3020aa[_0x18f9('0xa6')]=0xb;_0x3020aa['statedesc']=_0x18f9('0x11e');_0x3020aa[_0x18f9('0x11f')]='CALLEREXIT';_0x3020aa['countabandonedretry']+=0x1;_0x3020aa['countglobal']+=0x1;if(_0x3020aa[_0x18f9('0x100')]>=this['voiceQueues'][_0xa13520[_0x18f9('0xb1')]][_0x18f9('0x120')]){this[_0x18f9('0x112')](_0x3020aa);}else{this[_0x18f9('0xbd')]({'active':![],'countabandonedretry':_0x3020aa[_0x18f9('0x100')],'scheduledat':moment()[_0x18f9('0xfa')](this[_0x18f9('0x20')][_0xa13520['queue']][_0x18f9('0x121')],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x4a6ca1[_0x18f9('0xd0')],'ListId':_0x4a6ca1['ListId'],'VoiceQueueId':_0x4a6ca1[_0x18f9('0xd3')]||undefined,'CampaignId':_0x4a6ca1['CampaignId']||undefined})[_0x18f9('0xaf')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x228792=new History(_0x3020aa);_0x228792[_0x18f9('0xa6')]=0xb;_0x228792[_0x18f9('0xa7')]=_0x18f9('0x11e');_0x228792[_0x18f9('0x11a')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));_0x228792[_0x18f9('0x11b')]=_0x228792['starttime'];_0x228792[_0x18f9('0x122')]=_0x3020aa[_0x18f9('0x122')];_0x228792[_0x18f9('0x11c')]=_0x3020aa[_0x18f9('0x11c')];this[_0x18f9('0xca')](_0x228792)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x123')));}}}}};Dialer['prototype'][_0x18f9('0x33')]=function(_0x33032d){if(this[_0x18f9('0xa9')][_0x33032d[_0x18f9('0xdf')]]){this[_0x18f9('0xa9')][_0x33032d[_0x18f9('0xdf')]]['channel']=_0x33032d[_0x18f9('0xae')];}if(this[_0x18f9('0x26')][_0x33032d[_0x18f9('0xdf')]]){this[_0x18f9('0x26')][_0x33032d[_0x18f9('0xdf')]][_0x18f9('0xae')]=_0x33032d['channel'];}};Dialer[_0x18f9('0x1b')]['syncQueueMember']=function(_0x250888){if(strategy[this['voiceQueues'][this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]][_0x18f9('0xb1')]][_0x18f9('0x4f')]]===_0x18f9('0x1a')){if(this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]&&_['isNil'](this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]['locked'])&&_0x250888[_0x18f9('0xdb')]==='1'&&_0x250888[_0x18f9('0x125')]==='0'){if(this['agents'][_0x250888[_0x18f9('0x126')]]){if(!this['agents'][_0x250888[_0x18f9('0x126')]][_0x18f9('0x127')]){this[_0x18f9('0x22')][_0x250888['stateinterface']][_0x18f9('0x127')]=!![];this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]['locked']=!![];this['actions'][_0x250888[_0x18f9('0x124')]][_0x18f9('0x126')]=_0x250888[_0x18f9('0x126')];}}}}else if((strategy[this['voiceQueues'][this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]['queue']][_0x18f9('0x4f')]]||_0x18f9('0x128'))==='rrmemory'){if(this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]){if(this[_0x18f9('0x22')][_0x250888[_0x18f9('0x126')]]){this['actions'][_0x250888[_0x18f9('0x124')]][_0x18f9('0x126')]=_0x250888[_0x18f9('0x126')];if(_['isNil'](this['queueBooked'][this[_0x18f9('0xa9')][_0x250888['actionid']]['queue']])){this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]][_0x18f9('0xb1')]]=[];}this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]][_0x18f9('0xb1')]][_0x18f9('0x12a')](_[_0x18f9('0x8c')](_[_0x18f9('0x12b')](this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]],[_0x18f9('0x12c'),_0x18f9('0x126')]),{'status':_0x250888['status'],'paused':_0x250888['paused']}));}}}};function unlockQueueStatus(_0x22d7bc,_0x27e620){setTimeout(function(){if(_[_0x18f9('0x3e')](_0x22d7bc['queueStatusComplete'])){loggerBooked[_0x18f9('0x94')]('[unlockQueueStatus][undefined]',_0x27e620);}_0x22d7bc[_0x18f9('0x12d')]=!![];loggerBooked[_0x18f9('0x80')](_0x18f9('0x12e'),_0x27e620,JSON['stringify'](_[_0x18f9('0x12b')](_0x22d7bc,[_0x18f9('0x40'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x18f9('0x1b')]['syncQueueStatusComplete']=function(_0x4a0dbb){var _0x4c949=this;var _0x1d28b4=_0x4c949[_0x18f9('0x20')][_0x4c949['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]];if(strategy[this['voiceQueues'][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]][_0x18f9('0x4f')]]===_0x18f9('0x1a')){if(this['actions'][_0x4a0dbb[_0x18f9('0x124')]]&&this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0x126')]){this['preview'][_0x18f9('0x12f')](this['actions'][_0x4a0dbb[_0x18f9('0x124')]]['idHopper'],this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0x126')])['catch'](function(_0x2aa96b){logger['error'](_0x18f9('0x130'),util['inspect'](_0x2aa96b,{'showHidden':![],'depth':null}));})[_0x18f9('0x131')](function(){_0x4c949[_0x18f9('0xb0')](_0x4c949['voiceQueues'][_0x4c949[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]]['queue']]);_0x4c949[_0x18f9('0x22')][_0x4c949[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0x126')]][_0x18f9('0x127')]=![];delete _0x4c949[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]];unlockQueueStatus(_0x1d28b4);});}else{this[_0x18f9('0xb0')](this[_0x18f9('0x20')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xd0')],'ListId':this['actions'][_0x4a0dbb['actionid']][_0x18f9('0xd1')],'VoiceQueueId':this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xd3')]||undefined,'CampaignId':this['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0x104')]||undefined})['catch'](loggerCatch(_0x18f9('0x132')));delete this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]];unlockQueueStatus(_0x1d28b4);}}else if((strategy[this[_0x18f9('0x20')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]][_0x18f9('0x4f')]]||'rrmemory')===_0x18f9('0x128')){var _0x264400;if(this['actions'][_0x4a0dbb[_0x18f9('0x124')]]&&!_[_0x18f9('0x46')](this[_0x18f9('0x129')][this['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]])){if(this[_0x18f9('0x133')][_0x4c949[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]){this[_0x18f9('0x133')][_0x4c949['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]=this[_0x18f9('0x133')][this[_0x18f9('0xa9')][_0x4a0dbb['actionid']][_0x18f9('0xb1')]]?this[_0x18f9('0x133')][this[_0x18f9('0xa9')][_0x4a0dbb['actionid']][_0x18f9('0xb1')]]:this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]?this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]['_rr']||0x0:0x0;}this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]['_rr']=this[_0x18f9('0x133')][this['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]];for(var _0x35ae9d=0x0;_0x35ae9d=0x0;})[_0x18f9('0xaf')](myreject(_0x4f3374)));}}else{_0x44d49d[_0x18f9('0x12a')](ami[_0x18f9('0xad')]({'action':'command','command':util[_0x18f9('0x7d')](_0x18f9('0x148'),_0x5c6535,!_['isUndefined'](config[_0x18f9('0x145')][_0x4010e9])?_0x4010e9:'')})[_0x18f9('0xb5')](function(_0x30b14c){return _0x30b14c[_0x18f9('0x14b')][_0x18f9('0x14a')](_0x18f9('0x14c'))>=0x0;})[_0x18f9('0xaf')](myreject(_0x4f3374)));}BPromise['all'](_0x44d49d)[_0x18f9('0xb5')](function(_0x38ef2a){var _0x2cbb38=_[_0x18f9('0x14d')](_0x38ef2a);if(_0x2cbb38){return _0x4097ea(_0x2cbb38);}else{_0x1f96db[_0x18f9('0x3f')]=_0xa63762?_0x18f9('0x14e'):_0x18f9('0x14f');return _0x4f3374(msgResponse(_0x18f9('0x150'),'Failure',_0x18f9('0x151')+_0xa63762+'\x20'+_0x1ad6bc+'\x20Interval\x20is\x20overtime:\x20'+util[_0x18f9('0x9a')](_0x5c6535,{'showHidden':![],'depth':null})+_0x18f9('0x152')+_0x4010e9));}})['catch'](function(_0x340a8e){return _0x4f3374(msgResponse(_0x18f9('0x140'),'Failure',JSON[_0x18f9('0x4a')](_0x340a8e)));});});};Dialer['prototype']['checkDialMethod']=function(_0x2b2e98){var _0x115c67=this;return function(){switch(_0x2b2e98[_0x18f9('0x153')]){case'progressive':freeVariablesPredictive(_0x2b2e98);_0x115c67[_0x18f9('0x154')](_0x2b2e98,0x1);break;case _0x18f9('0x155'):freeVariablesPredictive(_0x2b2e98);_0x115c67[_0x18f9('0x154')](_0x2b2e98,_0x2b2e98['dialPowerLevel']);break;case _0x18f9('0xb'):_0x115c67[_0x18f9('0xb')](_0x2b2e98);break;case _0x18f9('0xa'):freeVariablesPredictive(_0x2b2e98);_0x115c67[_0x18f9('0x154')](_0x2b2e98,0x1);break;default:freeVariablesPredictive(_0x2b2e98);logger[_0x18f9('0x94')]('Queue',_0x2b2e98[_0x18f9('0x40')],_0x18f9('0x156'));}};};Dialer[_0x18f9('0x1b')]['checkPreviewRecallReminder']=function(_0x5d9c4a){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopper[_0x18f9('0x157')](_0x5d9c4a['id'],previewRecallmeReminderInterval))[_0x18f9('0xb5')](function(_0xc0fa47){for(var _0x19619f=0x0;_0x19619f<_0xc0fa47['length'];_0x19619f++){var _0x5986f6=_0xc0fa47[_0x19619f][_0x18f9('0x158')][_0x18f9('0x40')];if(_0x5986f6)io['to'](util[_0x18f9('0x7d')](_0x18f9('0x159'),_0x5986f6))[_0x18f9('0x4d')]('user:dialPreviewRecallReminder',{'hopper':_0xc0fa47[_0x19619f]});}})[_0x18f9('0xaf')](function(_0x19f316){});};Dialer[_0x18f9('0x1b')]['launchHandleIvr']=function(_0x12f645){var _0x3c4345=this;return function(){_0x3c4345[_0x18f9('0x15a')](_0x12f645);};};Dialer[_0x18f9('0x1b')][_0x18f9('0xd')]=function(_0xfe6f82){var _0x13e085=this;if(isNotPreview(_0xfe6f82[_0x18f9('0x153')])){if(isVoiceQueueOutbound(_0xfe6f82[_0x18f9('0x57')])&&isActive(_0xfe6f82[_0x18f9('0x5b')])){_0xfe6f82[_0x18f9('0xa0')]=!![];BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](checkIsLoggedIn(_0xfe6f82,_0xfe6f82[_0x18f9('0x51')]))[_0x18f9('0xb5')](checkIsActive(_0xfe6f82,_0xfe6f82[_0x18f9('0x5b')]))['then'](checkInterval(_0xfe6f82))[_0x18f9('0xb5')](_0x13e085[_0x18f9('0x13c')](_0xfe6f82))[_0x18f9('0xb5')](_0x13e085[_0x18f9('0x15b')](_0xfe6f82[_0x18f9('0x15c')],_0xfe6f82[_0x18f9('0x15d')],_0xfe6f82[_0x18f9('0x40')],_0xfe6f82))[_0x18f9('0xb5')](_0x13e085['checkIfTimeIntervals'](_0xfe6f82['Interval'],_0xfe6f82['dialTimezone'],_0xfe6f82[_0x18f9('0x40')],_0xfe6f82))[_0x18f9('0xb5')](_0x13e085['checkDialMethod'](_0xfe6f82))[_0x18f9('0xaf')](loggerCatchQueueSummary('[syncQueueSummary]',_0xfe6f82));}else{notSendMessagesQueue(_0xfe6f82);}}else{freeVariablesPredictive(_0xfe6f82);if(_0xfe6f82[_0x18f9('0x15e')]){_0x13e085[_0x18f9('0x15f')](_0xfe6f82);}}};Dialer['prototype'][_0x18f9('0x13b')]=function(){var _0x25894b=this;var _0x5c3cfa;for(var _0x197b92 in this[_0x18f9('0x21')]){if(typeof this[_0x18f9('0x21')][_0x197b92]!==_0x18f9('0x97')){_0x5c3cfa=this['campaigns'][_0x197b92];if(isCampaignIvr(_0x5c3cfa[_0x18f9('0x57')])&&isActive(_0x5c3cfa['active'])){_0x5c3cfa['sendMessageOneNotActive']=!![];BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](checkIsActive(_0x5c3cfa,_0x5c3cfa[_0x18f9('0xd9')]))[_0x18f9('0xb5')](checkInterval(_0x5c3cfa))[_0x18f9('0xb5')](_0x25894b[_0x18f9('0x13c')](_0x5c3cfa))[_0x18f9('0xb5')](_0x25894b['checkIfTime'](_0x5c3cfa[_0x18f9('0x15c')],_0x5c3cfa[_0x18f9('0x15d')],_0x5c3cfa['name'],_0x5c3cfa))[_0x18f9('0xb5')](_0x25894b[_0x18f9('0x13f')](_0x5c3cfa[_0x18f9('0x47')],_0x5c3cfa['dialTimezone'],_0x5c3cfa[_0x18f9('0x40')],_0x5c3cfa))[_0x18f9('0xb5')](_0x25894b[_0x18f9('0x160')](_0x5c3cfa))['catch'](loggerCatchQueueSummary(_0x18f9('0x161'),_0x5c3cfa));}else{notSendMessagesCampaign(_0x5c3cfa);}}}};function getCallerIdRandom(_0x1fc34e,_0x1e9f0c){var _0x500af1;var _0x273fc4;var _0xd0e840;if(_0x1e9f0c<=0x0){_0x1e9f0c=0x1;}_0x500af1=new RegExp(_0x18f9('0x162')+_0x1e9f0c+'}$');_0x273fc4=Math[_0x18f9('0x163')](0xa,_0x1e9f0c-0x1);_0xd0e840=Math[_0x18f9('0x163')](0xa,_0x1e9f0c)-0x1;return util[_0x18f9('0x7d')]('%s',_[_0x18f9('0x164')](_0x1fc34e,_0x500af1,_[_0x18f9('0x165')](_0x273fc4,_0xd0e840)));}function extractCalleridName(_0x14fc39){var _0xf7f47b=_0x14fc39[_0x18f9('0x166')](/"(.*?)"/);return _0xf7f47b?_0xf7f47b[0x1]:_0x14fc39;}function extractCalleridNumber(_0x5d13f3){var _0x4cfb60=_0x5d13f3[_0x18f9('0x166')](/<(.*?)>/);return _0x4cfb60?_0x4cfb60[0x1]:_0x5d13f3;}Dialer[_0x18f9('0x1b')][_0x18f9('0x167')]=function(_0x3c2985,_0x4a9f6e){var _0x17d204=this;var _0x66dbf8=uuid['v4']();this['actions'][_0x66dbf8]=new Action(_0x3c2985,_0x4a9f6e,_0x66dbf8);return new BPromise(function(_0x5b0aff,_0xbe3115){if(_[_0x18f9('0x3e')](_0x3c2985)&&typeof _0x3c2985!==_0x18f9('0x168')){return _0xbe3115(msgResponse('originate',_0x18f9('0x143'),_0x18f9('0x169')));}if(_['isUndefined'](_0x4a9f6e[_0x18f9('0x16a')][_0x18f9('0x16b')])||_0x4a9f6e[_0x18f9('0x16a')]['phone']===null){return _0xbe3115(msgResponse(_0x18f9('0x16c'),_0x18f9('0x143'),_0x18f9('0x16d')));}var _0x3bd6a0={'XMD-CALLERID':_0x17d204[_0x18f9('0xa9')][_0x66dbf8][_0x18f9('0x16e')](),'XMD-AGI':_0x3c2985['dialQueueProject']?util[_0x18f9('0x7d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c2985[_0x18f9('0x108')]):'NONE','XMD-AGIAFTER':_0x3c2985[_0x18f9('0x10d')]?util['format'](_0x18f9('0x16f'),ipAgi,_0x3c2985[_0x18f9('0x10d')]):_0x18f9('0x170'),'XMD-QUEUE':_0x3c2985[_0x18f9('0x57')]==='outbound'?util[_0x18f9('0x7d')]('\x22%s,%s%s,,,%s\x22',_0x3c2985[_0x18f9('0x40')],_0x3c2985['dialQueueOptions']||'',_0x3c2985[_0x18f9('0x10e')]?'c':'',_0x3c2985[_0x18f9('0x171')]||0x3):_0x18f9('0x170'),'XMD-CONTACTID':_0x4a9f6e['ContactId'],'XMD-CDRTYPE':_0x18f9('0x9'),'CALLERID(all)':_0x17d204['actions'][_0x66dbf8]['getCaller'](),'XMD-AMD':_0x3c2985[_0x18f9('0xe8')]?_0x18f9('0x172'):_0x18f9('0x170'),'XMD-DESTINATION':_0x18f9('0x173')};if(_0x3c2985[_0x18f9('0xe8')]){_0x3bd6a0[_0x18f9('0x174')]=_0x3c2985[_0x18f9('0x175')]||0x9c4;_0x3bd6a0['XMD-AMDGREETING']=_0x3c2985['dialAMDGreeting']||0x5dc;_0x3bd6a0['XMD-AMDAFTERGREETINGSILENCE']=_0x3c2985['dialAMDAfterGreetingSilence']||0x320;_0x3bd6a0[_0x18f9('0x176')]=_0x3c2985[_0x18f9('0x177')]||0x1388;_0x3bd6a0[_0x18f9('0x178')]=_0x3c2985[_0x18f9('0x179')]||0x64;_0x3bd6a0['XMD-AMDBETWEENWORDSSILENCE']=_0x3c2985[_0x18f9('0x17a')]||0x32;_0x3bd6a0[_0x18f9('0x17b')]=_0x3c2985[_0x18f9('0x17c')]||0x3;_0x3bd6a0[_0x18f9('0x17d')]=_0x3c2985[_0x18f9('0x17e')]||0x100;_0x3bd6a0[_0x18f9('0x17f')]=_0x3c2985[_0x18f9('0x180')]||0x1388;}if(_0x3c2985[_0x18f9('0x57')]===_0x18f9('0x4e')){_0x3bd6a0['XMD-VOICEQUEUEID']=_0x4a9f6e[_0x18f9('0xd3')];}else{_0x3bd6a0[_0x18f9('0x181')]=_0x4a9f6e[_0x18f9('0x104')];}for(var _0x8a2e06 in _0x4a9f6e[_0x18f9('0x16a')]){if(typeof _0x4a9f6e[_0x18f9('0x16a')][_0x8a2e06]!==_0x18f9('0x97')){if(isNotNull(_0x4a9f6e[_0x18f9('0x16a')][_0x8a2e06])&&_0x8a2e06!=='id'&&_0x8a2e06!=='tags'&&_0x8a2e06!==_0x18f9('0x182')&&_0x8a2e06!==_0x18f9('0x183')){_0x3bd6a0[util[_0x18f9('0x7d')]('%s%s',_0x18f9('0x184'),_[_0x18f9('0x185')](_0x8a2e06))]=_0x4a9f6e[_0x18f9('0x16a')][_0x8a2e06];}}}var _0x534975=_0x17d204[_0x18f9('0xd8')](_0x3c2985[_0x18f9('0x78')])?getCallerId(_0x3c2985[_0x18f9('0x78')]['callerid'],_0x3c2985[_0x18f9('0x186')],_0x3c2985[_0x18f9('0x187')]>0x0?getCallerIdRandom(_0x3c2985[_0x18f9('0x5c')],_0x3c2985['dialRandomLastDigitCallerIdNumber']):_0x3c2985[_0x18f9('0x5c')]):getCallerId(_[_0x18f9('0xac')](_0x3c2985[_0x18f9('0x13d')])?_0x3c2985['Trunk'][_0x18f9('0x79')]:_0x3c2985[_0x18f9('0x13d')][_0x18f9('0x79')],_0x3c2985[_0x18f9('0x186')],_0x3c2985['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3c2985[_0x18f9('0x5c')],_0x3c2985[_0x18f9('0x187')]):_0x3c2985['dialOriginateCallerIdNumber']);if(_0x534975){_0x3bd6a0['XMD-ORIGINATECALLERIDNAME']=_0x17d204[_0x18f9('0xa9')][_0x66dbf8][_0x18f9('0x188')]=extractCalleridName(_0x534975);_0x3bd6a0['XMD-ORIGINATECALLERIDNUM']=_0x17d204[_0x18f9('0xa9')][_0x66dbf8][_0x18f9('0x189')]=extractCalleridNumber(_0x534975);}return ami[_0x18f9('0xad')]({'actionid':_0x66dbf8,'action':_0x18f9('0x16c'),'channel':_0x17d204[_0x18f9('0xd8')](_0x3c2985[_0x18f9('0x78')])?util['format'](_0x18f9('0x18a'),_0x3c2985['Trunk'][_0x18f9('0x40')],isNotNull(_0x3c2985[_0x18f9('0x5e')])?_0x3c2985[_0x18f9('0x5e')][_0x18f9('0x18b')]()||'':'',_0x3c2985[_0x18f9('0x18c')]>0x0?_0x4a9f6e[_0x18f9('0x16a')][_0x18f9('0x16b')][_0x18f9('0x18d')](_0x3c2985[_0x18f9('0x18c')]):_0x4a9f6e[_0x18f9('0x16a')]['phone']):util[_0x18f9('0x7d')](_0x18f9('0x18a'),_[_0x18f9('0xac')](_0x3c2985[_0x18f9('0x13d')])?_0x3c2985[_0x18f9('0x78')][_0x18f9('0x40')]:_0x3c2985[_0x18f9('0x13d')][_0x18f9('0x40')],isNotNull(_0x3c2985[_0x18f9('0x5e')])?_0x3c2985[_0x18f9('0x5e')][_0x18f9('0x18b')]()||'':'',_0x3c2985[_0x18f9('0x18c')]>0x0?_0x4a9f6e[_0x18f9('0x16a')][_0x18f9('0x16b')]['substring'](_0x3c2985[_0x18f9('0x18c')]):_0x4a9f6e['Contact']['phone']),'callerid':_0x534975,'Exten':_0x18f9('0x173'),'Context':_0x18f9('0x18e'),'Priority':'1','variable':_0x3bd6a0,'timeout':(_0x3c2985['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x66dbf8})[_0x18f9('0xb5')](function(_0x14414c){return _0x5b0aff(_0x14414c);})[_0x18f9('0xaf')](function(_0x435438){_0x3c2985[_0x18f9('0x68')]+=0x1;var _0x165a7c=new History(_0x17d204[_0x18f9('0xa9')][_0x66dbf8]);logger[_0x18f9('0x94')](util[_0x18f9('0x7d')](_0x18f9('0x18f'),JSON[_0x18f9('0x4a')](_0x435438)));_0x165a7c[_0x18f9('0xa6')]=0xe;_0x165a7c[_0x18f9('0xa7')]=_0x18f9('0x190');_0x165a7c[_0x18f9('0x11a')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));_0x165a7c[_0x18f9('0x11b')]=_0x165a7c[_0x18f9('0x11a')];_0x17d204[_0x18f9('0xca')](_0x165a7c)['catch'](loggerCatch(_0x18f9('0x191')));_0x17d204[_0x18f9('0xc8')](_0x165a7c)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x191')))[_0x18f9('0x131')](function(){delete _0x17d204[_0x18f9('0xa9')][_0x66dbf8];return _0xbe3115(msgResponse(_0x18f9('0x16c'),'Error',_0x18f9('0x192')));});});});};Dialer[_0x18f9('0x1b')][_0x18f9('0x2f')]=function(_0x2702f4){var _0x438e30=this[_0x18f9('0xa9')][_0x2702f4[_0x18f9('0x124')]];if(_0x438e30){delete this['actions'][_0x2702f4[_0x18f9('0x124')]];_0x438e30[_0x18f9('0x115')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));var _0x33b091=_0x438e30[_0x18f9('0x57')]===_0x18f9('0x7c')?this['campaigns'][_0x438e30['queue']]:this[_0x18f9('0x20')][_0x438e30[_0x18f9('0x193')]()];if(!this['isSuccess'](_0x2702f4[_0x18f9('0x194')])){this['updateOriginated'](_0x33b091);return this[_0x18f9('0x195')](_0x438e30,_0x33b091,_0x2702f4)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x196')));}this[_0x18f9('0x26')][_0x2702f4[_0x18f9('0xdf')]]=_0x438e30;}};Dialer[_0x18f9('0x1b')]['checkRetriveMax']=function(_0x4b188e,_0x27c5b9,_0x4f9472){var _0x5919c0=new History(_0x27c5b9);if(_0x5919c0[_0x18f9('0xf0')]+_0x5919c0['countcongestionretry']+_0x5919c0['countnoanswerretry']+_0x5919c0[_0x18f9('0xff')]+_0x5919c0[_0x18f9('0xf3')]+_0x5919c0[_0x18f9('0x100')]+_0x5919c0[_0x18f9('0xec')]+_0x5919c0[_0x18f9('0xf4')]>=_0x4f9472[_0x18f9('0xf5')]-0x1){return!![];}switch(_0x4b188e){case 0x3:if(_0x5919c0[_0x18f9('0xf2')]>=_0x4f9472[_0x18f9('0x197')]-0x1){return!![];}this[_0x18f9('0xbd')]({'active':![],'countnoanswerretry':_0x5919c0['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x198')],_0x18f9('0xfb'))[_0x18f9('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0['VoiceQueueId']||undefined,'CampaignId':_0x5919c0['CampaignId']||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x199')));break;case 0x5:if(_0x5919c0['countbusyretry']>=_0x4f9472[_0x18f9('0x19a')]-0x1){return!![];}this[_0x18f9('0xbd')]({'active':![],'countbusyretry':_0x5919c0[_0x18f9('0xf0')]+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x19b')],'minutes')[_0x18f9('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0['ListId'],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x5919c0[_0x18f9('0xf1')]>=_0x4f9472[_0x18f9('0x19c')]-0x1){return!![];}this[_0x18f9('0xbd')]({'active':![],'countcongestionretry':_0x5919c0[_0x18f9('0xf1')]+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x19d')],'minutes')[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})['catch'](loggerCatch(_0x18f9('0x19e')));break;case 0x0:if(_0x5919c0[_0x18f9('0xff')]>=_0x4f9472[_0x18f9('0x19f')]-0x1){return!![];}else{this[_0x18f9('0xbd')]({'active':![],'countnosuchnumberretry':_0x5919c0['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472['dialNoSuchNumberRetryFrequency'],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0['ListId'],'VoiceQueueId':_0x5919c0['VoiceQueueId']||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1a0')));}break;case 0xa:if(_0x5919c0[_0x18f9('0xf3')]>=_0x4f9472[_0x18f9('0x118')]-0x1){return!![];}this[_0x18f9('0xbd')]({'active':![],'countdropretry':_0x5919c0['countdropretry']+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x1a1')],_0x18f9('0xfb'))[_0x18f9('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0['CampaignId']||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x119')));break;case 0xb:if(_0x5919c0['countabandonedretry']>=_0x4f9472[_0x18f9('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x5919c0[_0x18f9('0x100')]+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472['dialAbandonedRetryFrequency'],'minutes')[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0['ContactId'],'ListId':_0x5919c0['ListId'],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1a2')));break;case 0x13:if(_0x5919c0['countmachineretry']>=_0x4f9472['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x5919c0[_0x18f9('0xec')]+=0x1,'scheduledat':moment()['add'](_0x4f9472[_0x18f9('0x102')],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xfc')));break;case 0x14:if(_0x5919c0[_0x18f9('0xf4')]>=_0x4f9472[_0x18f9('0x1a3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x5919c0['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x1a4')],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1a5')));break;default:return!![];}};Dialer[_0x18f9('0x1b')][_0x18f9('0x195')]=function(_0x5d9ef8,_0x397a39,_0x40709c){var _0x485b3a=this;var _0x132d02=new History(_0x5d9ef8);return new BPromise(function(_0x54868a,_0x5dd119){if(_[_0x18f9('0x3e')](_0x397a39)&&typeof _0x397a39!=='object'){return _0x5dd119(msgResponse('[callProgressDetecting]',_0x18f9('0x143'),'entity\x20is\x20undefine'));}if(_[_0x18f9('0x3e')](_0x40709c)&&typeof _0x40709c!==_0x18f9('0x168')){return _0x5dd119(msgResponse('[callProgressDetecting]','Failure',_0x18f9('0x1a6')));}switch(_0x40709c['reason']){case'0':_0x397a39[_0x18f9('0x67')]+=0x1;_0x132d02[_0x18f9('0xa6')]=0x0;_0x132d02[_0x18f9('0xa7')]=_0x18f9('0x1a7');_0x132d02[_0x18f9('0xff')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami['emit'](_0x18f9('0x1a8'),ut[_0x18f9('0xe6')](_0x5d9ef8,_0x18f9('0x1a9')));_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x485b3a[_0x18f9('0x1aa')](0x0,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xff')]>=_0x397a39[_0x18f9('0x19f')]){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1ab'));}else{_0x485b3a['stateGlobal'](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1ab'));}}break;case'3':_0x397a39[_0x18f9('0x66')]+=0x1;_0x132d02['state']=0x3;_0x132d02['statedesc']=_0x18f9('0x1ac');_0x132d02[_0x18f9('0xf2')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami[_0x18f9('0x4d')]('custom:agentnoanswer',ut['buildObj'](_0x5d9ef8,_0x18f9('0x1ad')));_0x485b3a[_0x18f9('0xca')](_0x132d02)['catch'](loggerCatch(_0x18f9('0x1ae')));if(_0x485b3a[_0x18f9('0x1aa')](0x3,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xf2')]>=_0x397a39[_0x18f9('0x197')]){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1af'));}else{_0x485b3a['stateGlobal'](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1af'));}}break;case'5':_0x397a39[_0x18f9('0x61')]+=0x1;_0x132d02[_0x18f9('0xa6')]=0x5;_0x132d02[_0x18f9('0xa7')]=_0x18f9('0x1b0');_0x132d02[_0x18f9('0xf0')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami[_0x18f9('0x4d')](_0x18f9('0x1b1'),ut['buildObj'](_0x5d9ef8,_0x18f9('0x1b2')));_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1b3')));if(_0x485b3a[_0x18f9('0x1aa')](0x5,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xf0')]>=_0x397a39[_0x18f9('0x19a')]){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b4'));}else{_0x485b3a['stateGlobal'](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b4'));}}break;case'8':_0x397a39['outboundCongestionCallsDay']+=0x1;_0x132d02[_0x18f9('0xa6')]=0x8;_0x132d02['statedesc']=_0x18f9('0x1b5');_0x132d02[_0x18f9('0xf1')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami['emit']('custom:agentcongestion',ut[_0x18f9('0xe6')](_0x5d9ef8,'congestion'));_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1b6')));if(_0x485b3a[_0x18f9('0x1aa')](0x8,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xf1')]>=_0x397a39[_0x18f9('0x19c')]){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b7'));}else{_0x485b3a[_0x18f9('0xf6')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b7'));}}break;case'11':_0x397a39[_0x18f9('0x1b8')]+=0x1;_0x132d02[_0x18f9('0xa6')]=0xb;_0x132d02[_0x18f9('0xa7')]='Abandoned';_0x132d02[_0x18f9('0x100')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;_0x485b3a[_0x18f9('0xca')](_0x132d02)['catch'](loggerCatch(_0x18f9('0x123')));if(_0x485b3a[_0x18f9('0x1aa')](0xb,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0x100')]>=_0x397a39['dialAbandonedMaxRetry']){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b9'));}else{_0x485b3a[_0x18f9('0xf6')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b9'));}}break;case'20':_0x397a39[_0x18f9('0x1ba')]+=0x1;_0x132d02[_0x18f9('0xa6')]=0x14;_0x132d02[_0x18f9('0xa7')]='AgentReject';_0x132d02['countagentrejectretry']+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami['emit'](_0x18f9('0x1bb'),ut[_0x18f9('0xe6')](_0x5d9ef8,'agentreject'));_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1bc')));if(_0x485b3a[_0x18f9('0x1aa')](0x14,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xf4')]>=_0x397a39[_0x18f9('0x1a3')]){_0x485b3a['createStateFinal'](_0x132d02,_0x54868a,_0x5dd119,'reason\x2020\x20agentreject');}else{_0x485b3a[_0x18f9('0xf6')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1bd'));}}break;default:_0x397a39[_0x18f9('0x109')]+=0x1;_0x132d02['state']=0xc;_0x132d02['statedesc']=_0x40709c['reason'];_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1be')));if(_0x485b3a[_0x18f9('0x1aa')](_0x40709c[_0x18f9('0x10a')],_0x5d9ef8,_0x397a39)){if(_0x132d02['countbusyretry']+_0x132d02[_0x18f9('0xf1')]+_0x132d02[_0x18f9('0xf2')]+_0x132d02['countnosuchnumberretry']+_0x132d02[_0x18f9('0xf3')]+_0x132d02[_0x18f9('0x100')]+_0x132d02[_0x18f9('0xec')]+_0x132d02['countagentrejectretry']>=_0x397a39[_0x18f9('0xf5')]){_0x485b3a[_0x18f9('0xf6')](_0x132d02,_0x54868a,_0x5dd119,_0x40709c['reason']);}else{_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x40709c[_0x18f9('0x10a')]);}}}});};Dialer[_0x18f9('0x1b')][_0x18f9('0xf6')]=function(_0x320a45,_0x455dae,_0x20a2a9,_0x1475f2){var _0x4bd633=new Final(_0x320a45);_0x4bd633['state']=0xf;_0x4bd633[_0x18f9('0xa7')]='Global';this[_0x18f9('0xf9')](_0x4bd633,_0x455dae,_0x20a2a9,_0x1475f2);};Dialer[_0x18f9('0x1b')][_0x18f9('0xf9')]=function(_0x30eaee,_0x1b1469,_0x3b1312,_0x411b4b){this[_0x18f9('0xc8')](_0x30eaee)['then'](function(){return _0x1b1469(msgResponse(_0x18f9('0x1bf'),'Success',_0x411b4b));})[_0x18f9('0xaf')](function(){return _0x3b1312(msgResponse(_0x18f9('0x1c0'),_0x18f9('0x143'),_0x18f9('0x1c1')));});};Dialer[_0x18f9('0x1b')]['predictive']=function(_0x28aa4a){var _0x41e4a6=_0x28aa4a['dialPredictiveOptimizationPercentage']/0x64;var _0x2ac0ef=_0x28aa4a[_0x18f9('0x65')]/(_0x28aa4a[_0x18f9('0x65')]+_0x28aa4a[_0x18f9('0x60')]);var _0x425a47=Math[_0x18f9('0x1c2')](_0x28aa4a[_0x18f9('0x70')]*(_0x28aa4a['predictiveIntervalMaxThreshold']/0x64));var _0x26250b=Math[_0x18f9('0x1c2')](_0x28aa4a[_0x18f9('0x70')]*(_0x28aa4a[_0x18f9('0x1c3')]/0x64));var _0x55b287=_0x28aa4a[_0x18f9('0x50')]+_0x28aa4a['talking'];var _0x3d809d=Math[_0x18f9('0x1c4')](_0x28aa4a['erlangCalls']*_0x28aa4a[_0x18f9('0x75')]*_0x28aa4a[_0x18f9('0x6e')]*_0x28aa4a[_0x18f9('0x1c5')]);if(_[_0x18f9('0x3e')](_0x28aa4a[_0x18f9('0x27')])){if(!_[_0x18f9('0x3e')](_0x28aa4a['startPredictive'])){_0x28aa4a[_0x18f9('0x77')]=undefined;loggerPredictive[_0x18f9('0x94')](_0x18f9('0x1c6'),_0x18f9('0x1c7'));}if(!_['isUndefined'](_0x28aa4a[_0x18f9('0x8f')])){loggerPredictive['error'](_0x18f9('0x1c6'),_0x18f9('0x1c8'));clearInterval(_0x28aa4a[_0x18f9('0x8f')]);_0x28aa4a[_0x18f9('0x8f')]=undefined;}_0x28aa4a[_0x18f9('0x27')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));loggerPredictive[_0x18f9('0x80')](_0x28aa4a['name'],_0x18f9('0x1c9'),_0x28aa4a['startProgressive']);this[_0x18f9('0x154')](_0x28aa4a,0x1);}else if(ifInterval(_0x28aa4a[_0x18f9('0x1ca')],_0x28aa4a[_0x18f9('0x27')])){this[_0x18f9('0x154')](_0x28aa4a,0x1);loggerPredictiveCalls[_0x18f9('0x80')]('[startMethodPredictive][StartProgressive][Loop]',_0x28aa4a[_0x18f9('0x27')],_0x28aa4a[_0x18f9('0x40')]);_0x28aa4a[_0x18f9('0x73')]=0x0;_0x28aa4a['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x41e4a6<_0x2ac0ef&&_0x28aa4a[_0x18f9('0x1cb')]==='dropRate'){freeVariablesPredictive(_0x28aa4a);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x1cc'),_0x18f9('0x1cd'),_0x2ac0ef,_0x18f9('0x27'),_0x28aa4a[_0x18f9('0x40')]);}else if(_0x3d809d<_0x28aa4a['predictiveIntervalErlangCallsDroppedCalls']&&_0x28aa4a['dialPredictiveOptimization']===_0x18f9('0x1ce')){freeVariablesPredictive(_0x28aa4a);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x1cf'),_0x18f9('0x1d0'),_0x3d809d,_0x18f9('0x1d1'),_0x28aa4a['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x28aa4a[_0x18f9('0x40')]);}else if(!ifInterval(_0x28aa4a['dialPredictiveInterval'],_0x28aa4a['startProgressive'])&&_[_0x18f9('0x3e')](_0x28aa4a[_0x18f9('0x77')])&&!_[_0x18f9('0x3e')](_0x28aa4a[_0x18f9('0x27')])){_0x28aa4a['startPredictive']=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));loggerPredictive[_0x18f9('0x80')](_0x28aa4a[_0x18f9('0x40')],_0x18f9('0x1d2'),_0x28aa4a[_0x18f9('0x77')]);this[_0x18f9('0xba')](_0x28aa4a[_0x18f9('0x1ca')])[_0x18f9('0xb5')](this[_0x18f9('0x1d3')](_0x28aa4a))['then'](mergeDataErlangB(_0x28aa4a))[_0x18f9('0xb5')](this[_0x18f9('0x1d4')](_0x28aa4a))[_0x18f9('0xaf')](loggerCatchPredictive(_0x18f9('0x1d5'),_0x28aa4a));}else if(!ifInterval(_0x28aa4a[_0x18f9('0x1ca')],_0x28aa4a[_0x18f9('0x77')])){_0x28aa4a[_0x18f9('0x6d')]=0x0;_0x28aa4a[_0x18f9('0x77')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));loggerPredictive[_0x18f9('0x80')](_0x28aa4a[_0x18f9('0x40')],_0x18f9('0x1d6'),_0x28aa4a[_0x18f9('0x77')]);clearInterval(_0x28aa4a[_0x18f9('0x8f')]);_0x28aa4a['handlePredictive']=undefined;this[_0x18f9('0xba')](_0x28aa4a[_0x18f9('0x1ca')])[_0x18f9('0xb5')](this[_0x18f9('0x1d3')](_0x28aa4a))['then'](mergeDataErlangB(_0x28aa4a))[_0x18f9('0xb5')](this[_0x18f9('0x1d4')](_0x28aa4a))['catch'](loggerCatchPredictive(_0x18f9('0x1d7'),_0x28aa4a));}else if(_0x28aa4a['predictiveIntervalAvailable']&&_0x55b287<_0x28aa4a[_0x18f9('0x70')]-_0x26250b){freeVariablesPredictive(_0x28aa4a);loggerPredictive['info'](_0x28aa4a['name'],_0x18f9('0x1d8'),_0x55b287,_0x18f9('0x1d9'),_0x28aa4a[_0x18f9('0x70')],'-',_0x26250b,'=',_0x28aa4a['predictiveIntervalAvailable']-_0x26250b,')');}else if(_0x28aa4a['predictiveIntervalAvailable']&&_0x55b287>_0x28aa4a[_0x18f9('0x70')]+_0x425a47){freeVariablesPredictive(_0x28aa4a);loggerPredictive[_0x18f9('0x80')](_0x28aa4a[_0x18f9('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x55b287,_0x18f9('0x1da'),_0x28aa4a[_0x18f9('0x70')],'+',_0x425a47,'=',_0x28aa4a[_0x18f9('0x70')]+_0x425a47,')');}};Dialer[_0x18f9('0x1b')][_0x18f9('0x1d3')]=function(_0x446771){var _0x1d5370=this;return function(_0x2e2f51){return new BPromise(function(_0x30c6fe,_0x17250d){_[_0x18f9('0x8c')](_0x446771,_0x2e2f51[0x0]);if(checkGetDataPredictive(_0x2e2f51[0x0])){var _0x796501=_0x446771[_0x18f9('0x70')]=_0x446771[_0x18f9('0x55')]+_0x446771[_0x18f9('0x50')];var _0x44dad4=_0x446771[_0x18f9('0x1ca')]*0x3c;var _0x573cee=_0x2e2f51[0x0][_0x18f9('0x6b')]+_0x2e2f51[0x0][_0x18f9('0x6a')];var _0x4c9258=(_0x2e2f51[0x0]['predictiveIntervalAnsweredCalls']+_0x2e2f51[0x0][_0x18f9('0x85')]+_0x2e2f51[0x0][_0x18f9('0x6c')])/_0x2e2f51[0x0]['predictiveIntervalTotalCalls'];_0x446771['predictiveIntervalHitRate']=_0x4c9258>0x0?_0x4c9258:0x1;switch(_0x446771[_0x18f9('0x1cb')]){case _0x18f9('0x1ce'):var _0x6c16fc=_0x446771[_0x18f9('0x1db')]/0x64;return _0x1d5370[_0x18f9('0x1dc')](_0x796501,_0x44dad4,_0x573cee,_0x4c9258,_0x6c16fc)[_0x18f9('0xb5')](function(_0x569ed){return _0x30c6fe(_0x569ed);});case _0x18f9('0x1dd'):var _0x3e851d=_0x446771['dialPredictiveOptimizationPercentage']/0x64;return _0x1d5370['busyFactor'](_0x796501,_0x44dad4,_0x573cee,_0x4c9258,_0x3e851d)[_0x18f9('0xb5')](function(_0x16a179){return _0x30c6fe(_0x16a179);});default:return _0x17250d(msgResponse('[getDataPredictive]',_0x18f9('0x143'),'Unknown\x20Predictive'));}}else{return _0x17250d(msgResponse(_0x18f9('0x1de'),_0x18f9('0x143'),_0x18f9('0x1df')));}});};};Dialer[_0x18f9('0x1b')][_0x18f9('0x1e0')]=function(_0x2fef90){var _0x6a33a=this;return function(_0x164e5d){return new BPromise(function(_0x4bbf9e,_0x2258b9){_[_0x18f9('0x8c')](_0x2fef90,_0x164e5d[0x0]);if(checkGetDataPredictive(_0x164e5d[0x0])){loggerPredictive[_0x18f9('0x80')](JSON[_0x18f9('0x4a')](_0x164e5d[0x0]));if(_0x2fef90[_0x18f9('0x1cb')]===_0x18f9('0x1ce')){return _0x6a33a[_0x18f9('0xc6')](_0x2fef90['id'])['then'](function(_0x218e08){var _0x467f61=_0x2fef90[_0x18f9('0x51')]-_0x218e08[0x0]['outboundQueuePauses'];var _0x484d79=_0x2fef90['dialPredictiveInterval']*0x3c;var _0x4a4b61=_0x164e5d[0x0][_0x18f9('0x6b')]+_0x164e5d[0x0][_0x18f9('0x6a')];var _0x2f6023=(_0x164e5d[0x0]['predictiveIntervalAnsweredCalls']+_0x164e5d[0x0][_0x18f9('0x85')]+_0x164e5d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x164e5d[0x0][_0x18f9('0x71')];var _0x5d37da=_0x2fef90[_0x18f9('0x1db')]/0x64;_0x2fef90[_0x18f9('0x6f')]=_0x218e08[0x0][_0x18f9('0x1e1')]||0x0;_0x2fef90[_0x18f9('0x6e')]=_0x2f6023>0x0?_0x2f6023:0x1;return _0x6a33a[_0x18f9('0x1dc')](_0x467f61,_0x484d79,_0x4a4b61,_0x2f6023,_0x5d37da);})[_0x18f9('0xb5')](function(_0x2fa13e){return _0x4bbf9e(_0x2fa13e);})[_0x18f9('0xaf')](function(_0x15f2db){return _0x2258b9(msgResponse(_0x18f9('0x1e2'),_0x18f9('0x143'),JSON['stringify'](_0x15f2db)));});}if(_0x2fef90['dialPredictiveOptimization']===_0x18f9('0x1dd')){return _0x6a33a[_0x18f9('0xc6')](_0x2fef90['id'])[_0x18f9('0xb5')](function(_0x4f3d76){var _0x1da4f2=_0x2fef90[_0x18f9('0x51')]-_0x4f3d76[0x0][_0x18f9('0x1e1')];var _0x4e0da4=_0x2fef90[_0x18f9('0x1ca')]*0x3c;var _0x565bbf=_0x164e5d[0x0][_0x18f9('0x6b')]+_0x164e5d[0x0][_0x18f9('0x6a')];var _0x1a9f4a=(_0x164e5d[0x0][_0x18f9('0x69')]+_0x164e5d[0x0][_0x18f9('0x85')]+_0x164e5d[0x0][_0x18f9('0x6c')])/_0x164e5d[0x0][_0x18f9('0x71')];var _0x407b1a=_0x2fef90[_0x18f9('0x1db')]/0x64;_0x2fef90[_0x18f9('0x6f')]=_0x4f3d76[0x0][_0x18f9('0x1e1')]||0x0;_0x2fef90[_0x18f9('0x6e')]=_0x1a9f4a>0x0?_0x1a9f4a:0x1;return _0x6a33a['busyFactor'](_0x1da4f2,_0x4e0da4,_0x565bbf,_0x1a9f4a,_0x407b1a);})[_0x18f9('0xb5')](function(_0x349a31){return _0x4bbf9e(_0x349a31);})[_0x18f9('0xaf')](function(_0x3e271d){return _0x2258b9(msgResponse(_0x18f9('0x1e2'),_0x18f9('0x143'),JSON[_0x18f9('0x4a')](_0x3e271d)));});}}else{return _0x2258b9(msgResponse(_0x18f9('0x1de'),_0x18f9('0x143'),'check\x20failure'));}});};};Dialer[_0x18f9('0x1b')][_0x18f9('0x1d4')]=function(_0x558d49){var _0x3b8136=this;return function(){var _0x25ffc9=0x0;var _0x5f5431=Math['floor'](_0x558d49['erlangCallToSecond']*0x3e8);if(_0x5f5431>0x0){_0x5f5431=_0x5f5431<0x64?0x64:_0x5f5431;loggerPredictive[_0x18f9('0x80')](_0x558d49['name'],'one\x20call\x20every:',_0x5f5431,_0x18f9('0x4b'));_0x558d49[_0x18f9('0x8f')]=setInterval(function(){_0x3b8136[_0x18f9('0x8f')](_0x558d49);loggerPredictiveCalls[_0x18f9('0x80')]('[handlePredictive]',_0x25ffc9+=0x1);},_0x5f5431);}else{loggerPredictive[_0x18f9('0x80')](_0x558d49[_0x18f9('0x40')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x18f9('0x1e3')]=function(_0x462173,_0x4e4d41){var _0x3eaae2=this;return function(_0x4101c6){if(_[_0x18f9('0x46')](_0x4101c6)){if(_[_0x18f9('0xac')](_0x4e4d41[_0x18f9('0xd2')])||!_0x4e4d41[_0x18f9('0x1e4')]){if(_0x462173[_0x18f9('0x153')]===_0x18f9('0xa')){_0x462173[_0x18f9('0x12d')]=_['isUndefined'](_0x462173[_0x18f9('0x12d')])?!![]:_0x462173[_0x18f9('0x12d')];var _0x5d6eb5=uuid['v4']();_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5]=new Action(_0x462173,_0x4e4d41,_0x5d6eb5);loggerBooked[_0x18f9('0x80')]('[booked][checkContactBlack]',_0x5d6eb5,_0x18f9('0x1e5'),JSON[_0x18f9('0x4a')](_0x462173[_0x18f9('0x12d')]),_0x18f9('0x1e6'),_0x462173[_0x18f9('0x40')]);if(_0x462173[_0x18f9('0x12d')]){_0x462173['queueStatusComplete']=![];_0x3eaae2[_0x18f9('0x129')][_0x3eaae2['actions'][_0x5d6eb5]['queue']]=[];ami[_0x18f9('0xad')]({'actionid':_0x5d6eb5,'action':_0x18f9('0x1e7'),'queue':_0x462173[_0x18f9('0x40')]})[_0x18f9('0xaf')](function(){_0x3eaae2[_0x18f9('0xb0')](_0x462173);_0x3eaae2['rescheduleContact']({'active':![],'ContactId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd0')],'ListId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd1')],'VoiceQueueId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd3')]||undefined,'CampaignId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1e8')));delete _0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5];});}else{loggerBooked[_0x18f9('0x80')](_0x18f9('0x1e9'),JSON[_0x18f9('0x4a')](_0x462173[_0x18f9('0x12d')]),_0x18f9('0x1e6'),_0x462173['name']);_0x3eaae2[_0x18f9('0xb0')](_0x462173);_0x3eaae2['rescheduleContact']({'active':![],'ContactId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd0')],'ListId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd1')],'VoiceQueueId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd3')]||undefined,'CampaignId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1e8')));delete _0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5];}}else{return _0x3eaae2['actionOriginate'](_0x462173,_0x4e4d41);}}else{if(getDiff(_0x4e4d41[_0x18f9('0x1ea')])<_0x462173[_0x18f9('0x1eb')]*0x3c){if(_0x4e4d41[_0x18f9('0x158')]&&!_0x4e4d41[_0x18f9('0x158')][_0x18f9('0x1ec')]){_0x3eaae2[_0x18f9('0x1f')][_0x18f9('0x12f')](_0x4e4d41['id'])[_0x18f9('0x131')](function(){_0x3eaae2['updateOriginated'](_0x462173);});}else{_0x3eaae2[_0x18f9('0xbf')]({'active':![]},_0x4e4d41['id'],0x1)[_0x18f9('0x131')](function(){_0x3eaae2['updateOriginated'](_0x462173);});}}else{_0x462173['outboundReCallsDay']+=0x1;_0x3eaae2['updateOriginated'](_0x462173);if(_0x462173['dialRecallInQueue']){_0x3eaae2[_0x18f9('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e4d41[_0x18f9('0xd0')],'ListId':_0x4e4d41[_0x18f9('0xd1')],'VoiceQueueId':_0x4e4d41[_0x18f9('0xd3')]||undefined,'CampaignId':_0x4e4d41[_0x18f9('0x104')]||undefined})['catch'](loggerCatch(_0x18f9('0x1ed')));_0x3eaae2[_0x18f9('0xca')](createObjHistory(_0x462173,_0x4e4d41,_0x18f9('0x1ee'),0x17,_0x18f9('0x1ef')))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1f0')));}else{_0x3eaae2[_0x18f9('0xde')](createObjHistory(_0x462173,_0x4e4d41,_0x18f9('0x1f1'),0x16,_0x18f9('0x1f2')),_0x18f9('0x1f3'),_0x18f9('0x1f4'));}}}}else{_0x462173[_0x18f9('0x1f5')]+=0x1;_0x3eaae2[_0x18f9('0xde')](createObjHistory(_0x462173,_0x4e4d41,_0x18f9('0x1f6'),0xd,_0x18f9('0x1f7')),_0x18f9('0x1f8'),'[Originate][MoveBlacklist]');throw _0x18f9('0x1f9');}};};Dialer[_0x18f9('0x1b')]['handleIvr']=function(_0x362948){var _0x1b1948=this;var _0x2601b0=_0x362948[_0x18f9('0x1fa')]-_0x362948['originated']-_0x362948[_0x18f9('0xc2')];emitCampaignSummary(_0x362948);if(_0x2601b0>0x0){if(_0x2601b0>this[_0x18f9('0x24')]){_0x2601b0=this[_0x18f9('0x24')];}_0x362948[_0x18f9('0xc2')]+=_0x2601b0;this[_0x18f9('0xc4')](_0x362948['id'],_0x2601b0,_0x362948[_0x18f9('0x1fb')],_0x362948)['then'](function(_0x31d98b){_0x362948[_0x18f9('0xc2')]-=_0x2601b0;_0x362948[_0x18f9('0xc2')]=_0x362948[_0x18f9('0xc2')]>0x0?_0x362948[_0x18f9('0xc2')]:0x0;if(!checkContactEmpty(_0x31d98b)){_0x362948[_0x18f9('0x3f')]=_0x18f9('0x9e');logger[_0x18f9('0x80')](_0x18f9('0x1fc')+_0x362948[_0x18f9('0x40')]);}else{_0x362948['originated']+=_0x31d98b[_0x18f9('0x96')];_0x362948[_0x18f9('0x3f')]=_0x18f9('0x1fd');for(var _0x165847=0x0;_0x165847<_0x31d98b[_0x18f9('0x96')];_0x165847+=0x1){_0x362948[_0x18f9('0x1fe')]+=0x1;if(_['isNil'](_0x31d98b[_0x165847])||_[_0x18f9('0xac')](_0x31d98b[_0x165847][_0x18f9('0x16a')])||_['isNil'](_0x31d98b[_0x165847][_0x18f9('0x16a')]['phone'])){_0x1b1948[_0x18f9('0x1ff')](_0x18f9('0x200'),_0x362948,_0x31d98b[_0x165847]);}else{_0x1b1948['checkIsBlackListIvr'](_[_0x18f9('0x12b')](_0x31d98b[_0x165847],[_0x18f9('0x104'),'Contact.phone']))[_0x18f9('0xb5')](_0x1b1948[_0x18f9('0x1e3')](_0x362948,_0x31d98b[_0x165847]))['catch'](_0x1b1948[_0x18f9('0xce')](_0x18f9('0x201'),_0x362948));}}}})['catch'](loggerGetContactDialer(_0x18f9('0x202'),_0x362948,_0x2601b0));}};Dialer[_0x18f9('0x1b')][_0x18f9('0x154')]=function(_0x45fac0,_0x44158d){var _0x3aeaef=this;var _0x3fc492=[];var _0x4f5fdd=_0x44158d>=0x1?_0x44158d:0x1;if(_0x45fac0[_0x18f9('0x153')]===_0x18f9('0xa')){_0x4f5fdd=0x1;}var _0x424c06=Math[_0x18f9('0x1c4')](_0x45fac0['available']*_0x4f5fdd)-_0x45fac0[_0x18f9('0x72')]-_0x45fac0[_0x18f9('0xc2')];emitVoiceQueueSummary(_0x45fac0);if(_0x45fac0[_0x18f9('0x203')]>0x0){var _0x2c164f=_0x45fac0[_0x18f9('0x203')]-_0x45fac0['originated']-_0x45fac0[_0x18f9('0x55')]-_0x45fac0[_0x18f9('0xc2')]-_0x45fac0[_0x18f9('0x52')];if(_0x424c06>_0x2c164f){_0x424c06=_0x2c164f;}}if(_0x424c06>0x0){if(_0x45fac0[_0x18f9('0x153')]===_0x18f9('0xa')){_0x424c06=0x1;}if(_0x424c06>this[_0x18f9('0x24')]){_0x424c06=this['maxNumberOriginate'];}_0x45fac0[_0x18f9('0xc2')]+=_0x424c06;for(var _0x504456 in this[_0x18f9('0x22')]){if(typeof this[_0x18f9('0x22')][_0x504456]!==_0x18f9('0x97')){if(this['agents'][_0x504456][_0x18f9('0xa6')]===_0x18f9('0x204')&&this['agents'][_0x504456][_0x18f9('0xdb')]===_0x18f9('0xdc')){_0x3fc492['push'](this[_0x18f9('0x22')][_0x504456]['id']);}}}this[_0x18f9('0xc1')](_0x45fac0['id'],_0x3fc492,_0x424c06,_0x45fac0[_0x18f9('0x1fb')],_0x45fac0)[_0x18f9('0xb5')](function(_0x398625){_0x45fac0['temp']-=_0x424c06;_0x45fac0[_0x18f9('0xc2')]=_0x45fac0[_0x18f9('0xc2')]>0x0?_0x45fac0[_0x18f9('0xc2')]:0x0;if(!checkContactEmpty(_0x398625)){_0x3aeaef[_0x18f9('0xb3')](_0x45fac0)['then'](sendMessageReschedule(_0x45fac0))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x45fac0[_0x18f9('0x72')]+=_0x398625[_0x18f9('0x96')];_0x45fac0[_0x18f9('0x3f')]=_0x45fac0[_0x18f9('0x153')]===_0x18f9('0xa')?_0x18f9('0x172'):_0x18f9('0x1fd');for(var _0x1f1434=0x0;_0x1f1434<_0x398625[_0x18f9('0x96')];_0x1f1434+=0x1){if(_['isNil'](_0x398625[_0x1f1434])||_[_0x18f9('0xac')](_0x398625[_0x1f1434][_0x18f9('0x16a')])||_[_0x18f9('0xac')](_0x398625[_0x1f1434][_0x18f9('0x16a')][_0x18f9('0x16b')])){_0x3aeaef[_0x18f9('0x1ff')](_0x18f9('0x200'),_0x45fac0,_0x398625[_0x1f1434]);}else{_0x3aeaef['checkIsBlackList'](_[_0x18f9('0x12b')](_0x398625[_0x1f1434],[_0x18f9('0xd3'),_0x18f9('0x205')]))[_0x18f9('0xb5')](_0x3aeaef[_0x18f9('0x1e3')](_0x45fac0,_0x398625[_0x1f1434]))['catch'](_0x3aeaef[_0x18f9('0xce')]('[actionOriginate]\x20',_0x45fac0));}}}})['catch'](loggerGetContactDialer(_0x18f9('0x206'),_0x45fac0,_0x424c06));}};Dialer[_0x18f9('0x1b')][_0x18f9('0x8f')]=function(_0x5cf5b0){if(_0x5cf5b0[_0x18f9('0x203')]>0x0){var _0x423e4b=_0x5cf5b0['dialLimitQueue']-_0x5cf5b0[_0x18f9('0x72')]-_0x5cf5b0['talking'];if(_0x423e4b>0x0){this[_0x18f9('0x207')](_0x5cf5b0);}else{loggerPredictiveCalls[_0x18f9('0x80')](_0x18f9('0x208'));}}else{this[_0x18f9('0x207')](_0x5cf5b0);}};Dialer[_0x18f9('0x1b')]['tryOriginatePredictive']=function(_0x4b30ac){var _0x387f38=this;var _0x218f01=[];_0x4b30ac['originated']+=0x1;for(var _0x4afda9 in this[_0x18f9('0x22')]){if(typeof this[_0x18f9('0x22')][_0x4afda9]!==_0x18f9('0x97')){if(this['agents'][_0x4afda9][_0x18f9('0xa6')]===_0x18f9('0x204')&&this[_0x18f9('0x22')][_0x4afda9]['status']==='reachable'){_0x218f01['push'](this[_0x18f9('0x22')][_0x4afda9]['id']);}}}this['getContactDialer'](_0x4b30ac['id'],_0x218f01,0x1,_0x4b30ac[_0x18f9('0x1fb')],_0x4b30ac)[_0x18f9('0xb5')](function(_0x4ec09e){if(!checkContactEmpty(_0x4ec09e)){checkContactLowerLimitOriginate(_0x4b30ac,0x1,0x0);_0x387f38['countReScheduled'](_0x4b30ac)['then'](sendMessageReschedule(_0x4b30ac))['catch'](loggerCatch(_0x18f9('0xb6')));}else{_0x4b30ac[_0x18f9('0x3f')]=_0x18f9('0x1fd');if(_[_0x18f9('0xac')](_0x4ec09e[0x0])||_['isNil'](_0x4ec09e[0x0][_0x18f9('0x16a')])||_[_0x18f9('0xac')](_0x4ec09e[0x0][_0x18f9('0x16a')][_0x18f9('0x16b')])){_0x387f38['emptyContact']('[actionOriginate]\x20',_0x4b30ac,_0x4ec09e[0x0]);}else{_0x387f38['checkIsBlackList'](_[_0x18f9('0x12b')](_0x4ec09e[0x0],['VoiceQueueId','Contact.phone']))[_0x18f9('0xb5')](_0x387f38[_0x18f9('0x1e3')](_0x4b30ac,_0x4ec09e[0x0]))['catch'](_0x387f38[_0x18f9('0xce')](_0x18f9('0x209'),_0x4b30ac));}}})['catch'](loggerGetContactDialer(_0x18f9('0x20a'),_0x4b30ac,0x1));emitVoiceQueueSummary(_0x4b30ac);};Dialer[_0x18f9('0x1b')][_0x18f9('0x1dc')]=function(_0x1f672d,_0x2e1438,_0x4657e4,_0x291b7f,_0x1f9333,_0x3af799){loggerPredictive['info'](_0x18f9('0x20b'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f672d);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x20c'),_0x2e1438);loggerPredictive[_0x18f9('0x80')]('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',_0x4657e4);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x20d'),_0x291b7f);loggerPredictive[_0x18f9('0x80')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f9333);loggerPredictive['info'](_0x18f9('0x8b'));return new BPromise(function(_0x41d71d,_0xb3e0ec){if(_0x1f672d<=0x0||isNaN(_0x1f672d)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),_0x18f9('0x49'),_0x18f9('0x20f')+_0x1f672d));}if(_0x4657e4<=0x0||isNaN(_0x4657e4)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),_0x18f9('0x49'),_0x18f9('0x210')+_0x4657e4));}if(_0x291b7f<=0x0||isNaN(_0x291b7f)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),_0x18f9('0x49'),_0x18f9('0x211')+_0x291b7f));}if(_0x2e1438<=0x0||isNaN(_0x2e1438)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),_0x18f9('0x49'),'interval\x20=\x20'+_0x2e1438));}if(_0x1f9333<=0x0||isNaN(_0x1f9333)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),'Error',_0x18f9('0x212')+_0x1f9333));}_0x3af799=_0x3af799||0x0;var _0x15fb8d=0x1/_0x4657e4;var _0x107b48=0x0;var _0x9deff2=0x0;var _0x26d4a8=0x0;var _0x5a0ad0=0x0;for(var _0x2a4b8b=0x0;_0x26d4a8<_0x1f9333;_0x2a4b8b+=0x1){_0x9deff2=_0x2a4b8b/_0x2e1438;_0x107b48=(_0x291b7f*_0x9deff2+_0x3af799)/_0x15fb8d;_0x26d4a8=erlangb(_0x107b48,_0x1f672d);_0x5a0ad0=_0x107b48/_0x1f672d*(0x1-erlangb(_0x107b48,_0x1f672d));}return _0x41d71d({'erlangCalls':_0x2a4b8b,'erlangCallToSecond':_0x2e1438/_0x2a4b8b,'erlangAbandonmentRate':_0x26d4a8,'erlangBusyFactor':_0x5a0ad0});});};Dialer[_0x18f9('0x1b')]['busyFactor']=function(_0xc91b4d,_0x828b94,_0x130766,_0x5ac2c9,_0x327028,_0x162499){loggerPredictive[_0x18f9('0x80')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x18f9('0x80')]('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',_0xc91b4d);loggerPredictive['info'](_0x18f9('0x20c'),_0x828b94);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x213'),_0x130766);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x20d'),_0x5ac2c9);loggerPredictive[_0x18f9('0x80')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x327028);loggerPredictive[_0x18f9('0x80')]('---------------------------');return new BPromise(function(_0x3defea,_0x4589dd){if(_0xc91b4d<=0x0||isNaN(_0xc91b4d)){return _0x4589dd(msgResponse(_0x18f9('0x214'),_0x18f9('0x49'),'m\x20=\x20'+_0xc91b4d));}if(_0x130766<=0x0||isNaN(_0x130766)){return _0x4589dd(msgResponse('[busyFactor]','Error',_0x18f9('0x210')+_0x130766));}if(_0x5ac2c9<=0x0||isNaN(_0x5ac2c9)){return _0x4589dd(msgResponse(_0x18f9('0x214'),_0x18f9('0x49'),_0x18f9('0x211')+_0x5ac2c9));}if(_0x828b94<=0x0||isNaN(_0x828b94)){return _0x4589dd(msgResponse(_0x18f9('0x214'),_0x18f9('0x49'),_0x18f9('0x215')+_0x828b94));}if(_0x327028<=0x0||isNaN(_0x327028)){return _0x4589dd(msgResponse('[busyFactor]',_0x18f9('0x49'),_0x18f9('0x216')+_0x327028));}_0x162499=_0x162499||0x0;var _0x58902f=0x1/_0x130766;var _0x52376f=0x0;var _0x3b86ca=0x0;var _0x56bff1=0x0;var _0x1a312f=0x0;for(var _0x5c3319=0x0;_0x1a312f<_0x327028;_0x5c3319+=0x1){_0x3b86ca=_0x5c3319/_0x828b94;_0x52376f=(_0x5ac2c9*_0x3b86ca+_0x162499)/_0x58902f;_0x56bff1=erlangb(_0x52376f,_0xc91b4d);_0x1a312f=_0x52376f/_0xc91b4d*(0x1-erlangb(_0x52376f,_0xc91b4d));}return _0x3defea({'erlangCalls':_0x5c3319,'erlangCallToSecond':_0x828b94/_0x5c3319,'erlangAbandonmentRate':_0x56bff1,'erlangBusyFactor':_0x1a312f});});};module[_0x18f9('0x217')]=Dialer; \ No newline at end of file +var _0x1f30=['clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','error','inspect','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','undefined','enqueue','channel','type','[Dialer][checkChannel]','queue','updateOriginated','campaigns','[Dialer][checkChannel][ivr]','countReScheduled','resolve','catch','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','active','SIP/%s','status','unmonitored','uniqueid','isNil','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','state','membername','emit','[syncHangupInAMD][createHistory]','MACHINE','Machine','AMD','countmachineretry','countglobal','custom:amd','buildObj','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','amd','countbusyretry','countdropretry','minutes','[syncHangupIvr][createHistory]','AnswerAGI','AGI','[syncHangupIvr]','dialQueueProject','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','CALLEREXIT','dialAbandonedRetryFrequency','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','paused','stateinterface','push','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','content','indexOf','true','Action','iftime\x20%s,%s','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','handleIvr','dialTimezone','dialPreviewRecallmeReminder','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','Contact','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originate','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','predictiveIntervalHitRate','busyFactor','erlangCallToSecond','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','reachable','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\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','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','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/setting','./action','./final','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvailable','erlangCalls','Trunk','callerid','format','voice:queue:%s','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x1f30,0x194));var _0x01f3=function(_0x217fa6,_0x487f4a){_0x217fa6=_0x217fa6-0x0;var _0x1da1d9=_0x1f30[_0x217fa6];return _0x1da1d9;};'use strict';var util=require(_0x01f3('0x0'));var _=require(_0x01f3('0x1'));var BPromise=require(_0x01f3('0x2'));var uuid=require(_0x01f3('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0x01f3('0x4'));var Redis=require(_0x01f3('0x5'));var ut=require('../preview/util/util');var config=require(_0x01f3('0x6'));var logger=require(_0x01f3('0x7'))(_0x01f3('0x8'));var loggerBooked=require(_0x01f3('0x7'))(_0x01f3('0x9'));var loggerPredictive=require(_0x01f3('0x7'))(_0x01f3('0xa'));var loggerPredictiveCalls=require(_0x01f3('0x7'))(_0x01f3('0xb'));var loggerSyncQueueSummary=require(_0x01f3('0x7'))(_0x01f3('0xc'));var ami=require(_0x01f3('0xd'));config['redis']=_['defaults'](config[_0x01f3('0xe')],{'host':_0x01f3('0xf'),'port':0x18eb});var io=require(_0x01f3('0x10'))(new Redis(config[_0x01f3('0xe')]));var cmHopper=require(_0x01f3('0x11'));var cmHopperHistory=require(_0x01f3('0x12'));var cmHopperBlack=require(_0x01f3('0x13'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x01f3('0x14'));var Action=require(_0x01f3('0x15'));var History=require('./history');var Final=require(_0x01f3('0x16'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x01f3('0x17'));var Hangup=require(_0x01f3('0x18'));var ipAgi=process[_0x01f3('0x19')]['XCALLY_IP_AGI']||_0x01f3('0x1a');var strategy={'rrmemory':_0x01f3('0x1b'),'roundrobin':_0x01f3('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x01f3('0x1d')]['enqueue']=function(_0x1976e0){this[_0x01f3('0x1e')]=this[_0x01f3('0x1e')]?this[_0x01f3('0x1e')][_0x01f3('0x1f')](_0x1976e0):_0x1976e0();};function Dialer(_0x45a9f6,_0x54257b){this[_0x01f3('0x20')]=new Sequence();this[_0x01f3('0x21')]=_0x54257b;this[_0x01f3('0x22')]=_0x45a9f6[_0x01f3('0x22')];this['campaigns']=_0x45a9f6['campaigns'];this[_0x01f3('0x23')]=_0x45a9f6[_0x01f3('0x23')];this[_0x01f3('0x24')]=_0x45a9f6[_0x01f3('0x24')];this['maxNumberOriginate']=config[_0x01f3('0x25')]||0x2;this[_0x01f3('0x26')]={};this['actions']={};this['contactsId']={};this[_0x01f3('0x27')]={};this[_0x01f3('0x28')]={};this[_0x01f3('0x29')]={};this[_0x01f3('0x2a')]={};this['ivrOriginated']={};this[_0x01f3('0x2b')]={};this[_0x01f3('0x2c')]={};ami['on'](_0x01f3('0x2d'),this[_0x01f3('0x2e')][_0x01f3('0x2f')](this));ami['on'](_0x01f3('0x30'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x01f3('0x31'),this[_0x01f3('0x32')][_0x01f3('0x2f')](this));ami['on'](_0x01f3('0x33'),this[_0x01f3('0x34')][_0x01f3('0x2f')](this));ami['on']('custom:queuesummary',this[_0x01f3('0xc')]['bind'](this));ami['on'](_0x01f3('0x35'),this[_0x01f3('0x36')][_0x01f3('0x2f')](this));ami['on']('newexten',this['syncNewExten'][_0x01f3('0x2f')](this));ami['on'](_0x01f3('0x37'),this[_0x01f3('0x38')][_0x01f3('0x2f')](this));ami['on'](_0x01f3('0x39'),this[_0x01f3('0x3a')][_0x01f3('0x2f')](this));ami['on'](_0x01f3('0x3b'),this['syncQueueStatusComplete']['bind'](this));this[_0x01f3('0x3c')]();this[_0x01f3('0x3d')]();RpcSetting[_0x01f3('0x3e')]()[_0x01f3('0x3f')](function(_0x1e4410){previewRecallmeReminderInterval=_0x1e4410[_0x01f3('0x40')];});}function isNotNull(_0x2f56a7){return _0x2f56a7!==null&&!_[_0x01f3('0x41')](_0x2f56a7);}function checkIsLoggedIn(_0x4335a8,_0x272363){return function(){if(_0x272363<=0x0){_0x4335a8[_0x01f3('0x42')]=_0x01f3('0x43');throw _0x4335a8[_0x01f3('0x44')]+_0x01f3('0x45');}};}function isActive(_0x484973){return _0x484973;}function checkIsActive(_0x1e5a99,_0x2f25fa){return function(){if(!isActive(_0x2f25fa)){_0x1e5a99[_0x01f3('0x42')]=_0x01f3('0x46');throw _0x1e5a99['name']+_0x01f3('0x47');}};}function checkInterval(_0x43d0ce){return function(){if(!isNotNull(_0x43d0ce[_0x01f3('0x48')])){_0x43d0ce[_0x01f3('0x42')]=_0x01f3('0x49');throw _0x43d0ce[_0x01f3('0x44')]+_0x01f3('0x4a');}if(!isNotNull(_0x43d0ce[_0x01f3('0x48')]['Intervals'])){_0x43d0ce[_0x01f3('0x42')]=_0x01f3('0x49');throw _0x43d0ce[_0x01f3('0x44')]+_0x01f3('0x4a');}if(!isNotNull(_[_0x01f3('0x4b')](_0x43d0ce['Interval'][_0x01f3('0x4c')]))){_0x43d0ce[_0x01f3('0x42')]=_0x01f3('0x49');throw _0x43d0ce[_0x01f3('0x44')]+_0x01f3('0x4a');}};}function msgResponse(_0x14b681,_0x581710,_0x4b4268){return{'action':_0x14b681,'response':_0x581710,'message':_0x4b4268,'stack':_0x4b4268};}function myreject(_0x43fd17){return function(_0x4f66c2){return _0x43fd17(msgResponse(_0x01f3('0x4d'),_0x01f3('0x4e'),JSON[_0x01f3('0x4f')](_0x4f66c2)));};}function getSeconds(_0x1cab59,_0x3082fe){var _0x35816d=moment(_0x1cab59)[_0x01f3('0x50')](0x0);var _0x4fd97b=moment(_0x3082fe)[_0x01f3('0x50')](0x0);return _0x35816d[_0x01f3('0x51')](_0x4fd97b,_0x01f3('0x52'));}function emit(_0x1e20ed,_0x3bdd31,_0x464420){io['to'](_0x1e20ed)['emit'](_0x3bdd31,_0x464420);}function emitVoiceQueueSummary(_0x462801){if(_0x462801['type']===_0x01f3('0x53')){var _0x54dad0={'id':_0x462801['id'],'name':_0x462801[_0x01f3('0x44')],'strategy':_0x462801[_0x01f3('0x54')],'answered':_0x462801[_0x01f3('0x55')],'available':_0x462801[_0x01f3('0x56')],'loggedIn':_0x462801[_0x01f3('0x57')],'pTalking':_0x462801[_0x01f3('0x58')],'sumBillable':_0x462801[_0x01f3('0x59')],'sumDuration':_0x462801['sumDuration'],'sumHoldTime':_0x462801[_0x01f3('0x5a')]||0x0,'talking':_0x462801[_0x01f3('0x5b')],'total':_0x462801[_0x01f3('0x5c')],'type':_0x462801['type'],'unmanaged':_0x462801[_0x01f3('0x5d')],'abandoned':_0x462801[_0x01f3('0x5e')],'waiting':_0x462801[_0x01f3('0x5f')],'loggedInDb':_0x462801[_0x01f3('0x60')],'dialActive':_0x462801[_0x01f3('0x61')],'dialMethod':_0x462801[_0x01f3('0x62')],'dialOriginateCallerIdName':_0x462801[_0x01f3('0x63')],'dialOriginateCallerIdNumber':_0x462801['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x462801[_0x01f3('0x64')],'dialPrefix':_0x462801[_0x01f3('0x65')],'outboundAnswerAgiCallsDay':_0x462801['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x462801[_0x01f3('0x66')],'outboundBlacklistCallsDay':_0x462801[_0x01f3('0x67')],'outboundBusyCallsDay':_0x462801[_0x01f3('0x68')],'outboundCongestionCallsDay':_0x462801[_0x01f3('0x69')],'outboundDropCallsDayACS':_0x462801[_0x01f3('0x6a')],'outboundDropCallsDayCallersExit':_0x462801[_0x01f3('0x6b')],'outboundDropCallsDayTimeout':_0x462801[_0x01f3('0x6c')],'outboundNoAnswerCallsDay':_0x462801['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x462801[_0x01f3('0x6d')],'outboundOriginateFailureCallsDay':_0x462801['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x462801['outboundReCallsDay'],'outboundRejectCallsDay':_0x462801[_0x01f3('0x6e')],'outboundUnknownCallsDay':_0x462801[_0x01f3('0x6f')],'predictiveIntervalAnsweredCalls':_0x462801['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x462801[_0x01f3('0x70')],'predictiveIntervalAvgTalktime':_0x462801[_0x01f3('0x71')],'predictiveIntervalDroppedCallsCallersExit':_0x462801[_0x01f3('0x72')],'predictiveIntervalDroppedCallsTimeout':_0x462801[_0x01f3('0x73')],'predictiveIntervalErlangCalls':_0x462801['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x462801['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x462801['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x462801['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x462801['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x462801[_0x01f3('0x74')],'predictiveIntervalTotalCalls':_0x462801['predictiveIntervalTotalCalls'],'message':_0x462801[_0x01f3('0x42')],'originated':_0x462801['originated'],'erlangCalls':_0x462801[_0x01f3('0x75')],'erlangCallToSecond':_0x462801['erlangCallToSecond'],'erlangAbandonmentRate':_0x462801['erlangAbandonmentRate'],'erlangBusyFactor':_0x462801['erlangBusyFactor'],'startPredictive':_0x462801[_0x01f3('0x29')],'startProgressive':_0x462801['startProgressive']};if(_0x462801['Trunk']){_0x54dad0[_0x01f3('0x76')]={'id':_0x462801['Trunk']['id'],'name':_0x462801[_0x01f3('0x76')][_0x01f3('0x44')],'active':_0x462801[_0x01f3('0x76')]['active'],'callerid':_0x462801[_0x01f3('0x76')][_0x01f3('0x77')]};}if(_0x462801[_0x01f3('0x48')]){_0x54dad0[_0x01f3('0x48')]={'id':_0x462801[_0x01f3('0x48')]['id'],'name':_0x462801[_0x01f3('0x48')][_0x01f3('0x44')]};}var _0x46eafc=md5(JSON[_0x01f3('0x4f')](_0x54dad0));if(_0x462801[_0x01f3('0x4')]!==_0x46eafc){_0x462801[_0x01f3('0x4')]=_0x46eafc;emit(util[_0x01f3('0x78')](_0x01f3('0x79'),_0x54dad0[_0x01f3('0x44')]),'voice_queue:save',_0x54dad0);}}}function emitCampaignSummary(_0x4b2b59){if(_0x4b2b59['type']==='ivr'){emit(util[_0x01f3('0x78')](_0x01f3('0x7a'),_0x4b2b59['name']),'campaign:save',_0x4b2b59);}}function checkGetDataPredictive(_0x2f5f3d){if(isNotNull(_0x2f5f3d)&&!_['isEmpty'](_0x2f5f3d)){loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x7c'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2f5f3d[_0x01f3('0x7d')]);loggerPredictive['info'](_0x01f3('0x7e'),_0x2f5f3d[_0x01f3('0x7f')]);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x80'),_0x2f5f3d['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x01f3('0x81'),_0x2f5f3d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x82'),_0x2f5f3d[_0x01f3('0x70')]);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x83'),_0x2f5f3d[_0x01f3('0x71')]);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x84'));if(_0x2f5f3d[_0x01f3('0x7d')]>0x0){if(!_[_0x01f3('0x41')](_0x2f5f3d[_0x01f3('0x71')])&&_0x2f5f3d[_0x01f3('0x71')]>0x0){return!![];}loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x85'));if(!_[_0x01f3('0x41')](_0x2f5f3d[_0x01f3('0x70')])&&_0x2f5f3d[_0x01f3('0x70')]>0x0){return!![];}loggerPredictive[_0x01f3('0x7b')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x86'));}}else{loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x87'));}return![];}function mergeDataErlangB(_0x1e1d9b){return function(_0x320b43){loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x88'));loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x89'),_0x320b43[_0x01f3('0x75')]);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x8a'),_0x320b43['erlangCallToSecond']);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x8b'),_0x320b43[_0x01f3('0x8c')]);loggerPredictive['info'](_0x01f3('0x8d'),_0x320b43[_0x01f3('0x8e')]);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x8b'),_0x320b43[_0x01f3('0x8c')]);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x84'));_[_0x01f3('0x8f')](_0x1e1d9b,_0x320b43);};}function getDiff(_0x13aeb3){var _0x520449=moment()['milliseconds'](0x0);var _0x3a8304=moment(_0x13aeb3)[_0x01f3('0x50')](0x0);return _0x520449[_0x01f3('0x51')](_0x3a8304,_0x01f3('0x52'));}function ifInterval(_0x41ccc7,_0xb29977){if(_[_0x01f3('0x41')](_0xb29977)){return![];}return getDiff(_0xb29977)<_0x41ccc7*0x3c;}function freeVariablesPredictive(_0x53cc90){if(isNotNull(_0x53cc90)){if(!_['isUndefined'](_0x53cc90['startProgressive'])){_0x53cc90[_0x01f3('0x2a')]=undefined;loggerPredictive[_0x01f3('0x7b')](_0x53cc90[_0x01f3('0x44')],_0x01f3('0x90'));}if(!_[_0x01f3('0x41')](_0x53cc90[_0x01f3('0x29')])){_0x53cc90[_0x01f3('0x29')]=undefined;loggerPredictive[_0x01f3('0x7b')](_0x53cc90[_0x01f3('0x44')],_0x01f3('0x91'));}if(!_['isUndefined'](_0x53cc90['handlePredictive'])){clearInterval(_0x53cc90[_0x01f3('0x92')]);_0x53cc90['handlePredictive']=undefined;loggerPredictive[_0x01f3('0x7b')](_0x53cc90[_0x01f3('0x44')],_0x01f3('0x93'));}}}function erlangb(_0x22eee2,_0x3fa71a){if(_0x3fa71a===0x0){return 0x0;}var _0x45ed02=0x1;for(var _0x3a0176=0x1;_0x3a0176<=_0x3fa71a;_0x3a0176+=0x1){_0x45ed02=0x1+_0x45ed02*_0x3a0176/_0x22eee2;}return 0x1/_0x45ed02;}function isVoiceQueueOutbound(_0x244a95){return _0x244a95===_0x01f3('0x53');}function isNotPreview(_0xfcbf5b){return _0xfcbf5b!=='preview';}function isCampaignIvr(_0x1435d0){return _0x1435d0===_0x01f3('0x94');}function getCallerId(_0x395143,_0x41ff74,_0x1c68dd){if(!_['isUndefined'](_0x1c68dd)&&typeof _0x1c68dd===_0x01f3('0x95')&&!_[_0x01f3('0x4b')](_0x1c68dd)){if(!_['isUndefined'](_0x41ff74)&&typeof _0x41ff74===_0x01f3('0x95')&&!_[_0x01f3('0x4b')](_0x41ff74)){return util[_0x01f3('0x78')](_0x01f3('0x96'),_0x41ff74,_0x1c68dd);}return util['format'](_0x01f3('0x96'),_0x1c68dd,_0x1c68dd);}if(!_[_0x01f3('0x41')](_0x395143)&&typeof _0x395143===_0x01f3('0x95')&&!_[_0x01f3('0x4b')](_0x395143)){return _0x395143;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1f8383,_0x2322b1){return function(_0x145ca7){freeVariablesPredictive(_0x2322b1);emitVoiceQueueSummary(_0x2322b1);emitCampaignSummary(_0x2322b1);loggerSyncQueueSummary[_0x01f3('0x97')](_0x1f8383,util[_0x01f3('0x98')](_0x145ca7,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3beeed,_0x2dc0e3){return function(_0x560193){loggerPredictive['error'](_0x2dc0e3[_0x01f3('0x44')],_0x3beeed);loggerPredictive[_0x01f3('0x97')](_0x560193['stack']);freeVariablesPredictive(_0x2dc0e3);};}function loggerCatch(_0x5b3430){return function(_0x13dba4){logger['error'](_0x5b3430,util[_0x01f3('0x98')](_0x13dba4,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2abb84){return _0x2abb84&&!_[_0x01f3('0x41')](_0x2abb84)&&_0x2abb84['length']>0x0;}function decremetOriginate(_0x469e91){if(!_[_0x01f3('0x41')](_0x469e91)&&_0x469e91!==null){if(typeof _0x469e91[_0x01f3('0x99')]!=='undefined'){if(_0x469e91[_0x01f3('0x99')]>0x0){_0x469e91[_0x01f3('0x99')]-=0x1;}else{logger[_0x01f3('0x97')](_0x01f3('0x9a'));}}}else{logger[_0x01f3('0x97')](_0x01f3('0x9b'));}}function checkContactLowerLimitOriginate(_0x39df9d,_0x4a79c2,_0x531ec6){if(_0x4a79c2>_0x531ec6){for(var _0x3cbbe6=0x0;_0x3cbbe6<_0x4a79c2-_0x531ec6;_0x3cbbe6+=0x1){decremetOriginate(_0x39df9d);}}}function loggerGetContactDialer(_0xa1b787,_0x46b9ee,_0x1b803a){return function(_0x37caf9){checkContactLowerLimitOriginate(_0x46b9ee,_0x1b803a,0x0);logger[_0x01f3('0x97')](_0xa1b787,util[_0x01f3('0x98')](_0x37caf9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2555cc){return function(_0x279694){if(isNotNull(_0x279694)&&isNotNull(_0x279694[0x0])){if(_0x279694[0x0][_0x01f3('0x9c')]>0x0){_0x2555cc[_0x01f3('0x42')]=_0x01f3('0x9d');logger[_0x01f3('0x7b')](_0x01f3('0x9e')+_0x2555cc[_0x01f3('0x44')],_0x279694[0x0][_0x01f3('0x9c')],_0x01f3('0x9f'));}else{_0x2555cc[_0x01f3('0x42')]=_0x01f3('0xa0');logger[_0x01f3('0x7b')](_0x01f3('0xa1')+_0x2555cc[_0x01f3('0x44')]);}}};}function notSendMessagesQueue(_0x326141){if(_0x326141[_0x01f3('0xa2')]){freeVariablesPredictive(_0x326141);if(_0x326141[_0x01f3('0x99')]===0x0&&_0x326141[_0x01f3('0x5b')]===0x0&&_0x326141[_0x01f3('0x5f')]===0x0&&(_0x326141['pTalking']||0x0)===0x0){_0x326141[_0x01f3('0xa2')]=![];_0x326141[_0x01f3('0x56')]=0x0;_0x326141[_0x01f3('0x42')]=_0x01f3('0x46');loggerSyncQueueSummary[_0x01f3('0x97')](_0x01f3('0xa3'),_0x326141[_0x01f3('0x44')],_0x01f3('0xa4'));}else{_0x326141[_0x01f3('0x42')]=_0x01f3('0xa5');loggerSyncQueueSummary['error'](_0x01f3('0xa3'),_0x326141[_0x01f3('0x44')],_0x01f3('0xa6'));}emitVoiceQueueSummary(_0x326141);}}function notSendMessagesCampaign(_0x3ec6b5){if(_0x3ec6b5[_0x01f3('0xa2')]){if(_0x3ec6b5['originated']===0x0){_0x3ec6b5[_0x01f3('0xa2')]=![];_0x3ec6b5[_0x01f3('0x42')]=_0x01f3('0x46');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3ec6b5[_0x01f3('0x44')],_0x01f3('0xa4'));}else{_0x3ec6b5['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x01f3('0x97')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3ec6b5['name'],_0x01f3('0xa6'));}emitCampaignSummary(_0x3ec6b5);}}function createObjHistory(_0x459a63,_0x57127d,_0x1f225b,_0x30bc64,_0x57afbd){_0x459a63['message']=_0x1f225b;var _0xcae306=new Action(_0x459a63,_0x57127d);var _0x3094f4=new History(_0xcae306);_0x3094f4['state']=_0x30bc64;_0x3094f4[_0x01f3('0xa7')]=_0x57afbd;_0x3094f4[_0x01f3('0xa8')]=_0xcae306[_0x01f3('0xa9')];return _0x3094f4;}Dialer[_0x01f3('0x1d')][_0x01f3('0x3d')]=function(){var _0x210487=this;setInterval(function(){_0x210487[_0x01f3('0xaa')](_0x210487[_0x01f3('0x27')],_0x01f3('0xab'));_0x210487[_0x01f3('0xaa')](_0x210487[_0x01f3('0xac')],'[actions]');},0x32c8);};Dialer[_0x01f3('0x1d')][_0x01f3('0xaa')]=function(_0x31f59f,_0x1b6a63){var _0x2cb8a1=this;for(var _0x2b5258 in _0x31f59f){if(typeof _0x31f59f[_0x2b5258]!==_0x01f3('0xad')){this[_0x01f3('0x20')][_0x01f3('0xae')](function(){if(!_['isNil'](_0x31f59f[_0x2b5258])){return ami['Action']({'action':'status','channel':_0x31f59f[_0x2b5258][_0x01f3('0xaf')]})['catch'](function(_0x40ec5f){if(_0x40ec5f[_0x01f3('0x42')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x31f59f[_0x2b5258]&&_0x31f59f[_0x2b5258][_0x01f3('0xb0')]!==_0x01f3('0x94')){_0x2cb8a1['updateOriginated'](_0x2cb8a1[_0x01f3('0x22')][_0x31f59f[_0x2b5258]['queue']]);logger[_0x01f3('0x97')](_0x01f3('0xb1'),_0x1b6a63,_0x2b5258,_0x31f59f[_0x2b5258][_0x01f3('0xb2')]);delete _0x31f59f[_0x2b5258];}if(_0x31f59f[_0x2b5258]&&_0x31f59f[_0x2b5258][_0x01f3('0xb0')]===_0x01f3('0x94')){_0x2cb8a1[_0x01f3('0xb3')](_0x2cb8a1[_0x01f3('0xb4')][_0x31f59f[_0x2b5258][_0x01f3('0xb2')]]);logger[_0x01f3('0x97')](_0x01f3('0xb5'),_0x1b6a63,_0x2b5258,_0x31f59f[_0x2b5258][_0x01f3('0xb2')]);delete _0x31f59f[_0x2b5258];}},0x2328);}});}});}}};Dialer['prototype'][_0x01f3('0xb6')]=function(_0x29fce4){return BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](cmHopper['countReScheduled'](_0x29fce4))[_0x01f3('0xb8')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x01f3('0x1d')][_0x01f3('0xb9')]=function(_0x47d4fa){return BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](cmHopperBlack[_0x01f3('0xb9')](_0x47d4fa))[_0x01f3('0xb8')](loggerCatch(_0x01f3('0xba')));};Dialer[_0x01f3('0x1d')][_0x01f3('0xbb')]=function(_0x407f2e){return BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](cmHopperBlack['checkIsBlackListIvr'](_0x407f2e))['catch'](loggerCatch(_0x01f3('0xbc')));};Dialer[_0x01f3('0x1d')][_0x01f3('0xbd')]=function(_0xfdbbbc){return BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](cmHopperHistory[_0x01f3('0xbe')](_0xfdbbbc))['catch'](loggerCatch(_0x01f3('0xbf')));};Dialer['prototype'][_0x01f3('0xc0')]=function(_0x195ab5){return BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](cmHopper[_0x01f3('0xc0')](_0x195ab5))[_0x01f3('0xb8')](loggerCatch(_0x01f3('0xc1')));};Dialer[_0x01f3('0x1d')]['unlockContact']=function(_0x3843f0,_0x15463a,_0x179d56){return BPromise['resolve']()[_0x01f3('0x3f')](cmHopper['unlockContact'](_0x3843f0,_0x15463a,_0x179d56))[_0x01f3('0xb8')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x01f3('0x1d')][_0x01f3('0xc2')]=function(_0x1bce96,_0x2192c9,_0x2e43c1,_0xf4331b,_0x4e6364){return BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](cmHopper[_0x01f3('0xc2')](_0x1bce96,_0x2192c9,_0x2e43c1,_0xf4331b))[_0x01f3('0xb8')](function(_0x19d257){_0x4e6364[_0x01f3('0xc3')]-=_0x2e43c1;_0x4e6364[_0x01f3('0xc3')]=_0x4e6364[_0x01f3('0xc3')]>0x0?_0x4e6364['temp']:0x0;loggerCatch(_0x01f3('0xc4'))(_0x19d257);});};Dialer['prototype'][_0x01f3('0xc5')]=function(_0x3eb6fb,_0xdf7ff6,_0x29a8ba,_0x3500fe){return BPromise['resolve']()['then'](cmHopper[_0x01f3('0xc5')](_0x3eb6fb,_0xdf7ff6,_0x29a8ba))[_0x01f3('0xb8')](function(_0x3b55a6){_0x3500fe[_0x01f3('0xc3')]-=_0xdf7ff6;_0x3500fe['temp']=_0x3500fe[_0x01f3('0xc3')]>0x0?_0x3500fe[_0x01f3('0xc3')]:0x0;loggerCatch(_0x01f3('0xc6'))(_0x3b55a6);});};Dialer[_0x01f3('0x1d')][_0x01f3('0xc7')]=function(_0x558412){return BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](voiceQueueRt[_0x01f3('0xc7')](_0x558412))[_0x01f3('0xb8')](loggerCatch(_0x01f3('0xc8')));};Dialer[_0x01f3('0x1d')][_0x01f3('0xc9')]=function(_0x599cdc){return BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](cmHopper[_0x01f3('0xc9')](_0x599cdc))[_0x01f3('0xb8')](loggerCatch(_0x01f3('0xca')));};Dialer[_0x01f3('0x1d')][_0x01f3('0xcb')]=function(_0x3ca916){return BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](cmHopperHistory[_0x01f3('0xcb')](_0x3ca916))[_0x01f3('0xb8')](loggerCatch(_0x01f3('0xcc')));};Dialer[_0x01f3('0x1d')][_0x01f3('0xb3')]=function(_0x4686a8){if(!_[_0x01f3('0x41')](_0x4686a8)&&_0x4686a8!==null){if(typeof _0x4686a8[_0x01f3('0x99')]!==_0x01f3('0xad')){if(_0x4686a8[_0x01f3('0x99')]>0x0){_0x4686a8['originated']-=0x1;}else{logger['error'](_0x01f3('0xcd'));}}}else{logger[_0x01f3('0x97')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x01f3('0x1d')][_0x01f3('0xce')]=function(_0x2eab86,_0x3bdbe7){var _0x38bfdd=this;return function(_0x336176){_0x38bfdd[_0x01f3('0xb3')](_0x3bdbe7);logger[_0x01f3('0x97')](_0x2eab86,util[_0x01f3('0x98')](_0x336176,{'showHidden':![],'depth':null}));};};Dialer[_0x01f3('0x1d')][_0x01f3('0xcf')]=function(_0x38e361,_0x51ba49,_0x163ed4){var _0x3c12be={'state':0x19,'statedesc':_0x01f3('0xd0')};this[_0x01f3('0xb3')](_0x51ba49);this[_0x01f3('0xd1')](_[_0x01f3('0x8f')](_0x3c12be,_[_0x01f3('0xd2')](_0x163ed4,[_0x01f3('0xd3'),_0x01f3('0xd4'),'UserId',_0x01f3('0xd5'),_0x01f3('0xd6')])),_0x01f3('0xd7'),'[emptyContact]');logger[_0x01f3('0x97')](_0x38e361);};Dialer[_0x01f3('0x1d')][_0x01f3('0xd8')]=function(_0xa2daa2){return _0xa2daa2===_0x01f3('0xd9');};Dialer[_0x01f3('0x1d')]['isTrunkReachable']=function(_0x14d533){return!_[_0x01f3('0x41')](_0x14d533)&&_0x14d533&&!_[_0x01f3('0x41')](_0x14d533[_0x01f3('0x44')])&&!_[_0x01f3('0x41')](_0x14d533['active'])&&_0x14d533[_0x01f3('0xda')]&&(this[_0x01f3('0x24')][util[_0x01f3('0x78')](_0x01f3('0xdb'),_0x14d533[_0x01f3('0x44')])][_0x01f3('0xdc')]==='reachable'||this[_0x01f3('0x24')][util[_0x01f3('0x78')](_0x01f3('0xdb'),_0x14d533['name'])][_0x01f3('0xdc')]===_0x01f3('0xdd'));};Dialer[_0x01f3('0x1d')][_0x01f3('0xd1')]=function(_0x399241,_0x4c3d18,_0x3da920){this['createHistory'](_0x399241)['catch'](loggerCatch(_0x4c3d18));this[_0x01f3('0xc9')](_0x399241)[_0x01f3('0xb8')](loggerCatch(_0x3da920));};Dialer[_0x01f3('0x1d')]['syncVarSet']=function(_0x5a1c30){var _0x346e86=this[_0x01f3('0x27')][_0x5a1c30[_0x01f3('0xde')]];var _0x221fd1;if(!_[_0x01f3('0xdf')](_0x5a1c30)&&!_[_0x01f3('0xdf')](_0x5a1c30['variable'])&&!_[_0x01f3('0xdf')](_0x5a1c30['variable'][_0x01f3('0xe0')])&&_0x5a1c30[_0x01f3('0xe1')]===_0x01f3('0xe2')&&_0x346e86){if(_0x346e86[_0x01f3('0xb0')]!=='ivr'&&this[_0x01f3('0x22')][_0x346e86[_0x01f3('0xb2')]][_0x01f3('0xe3')]&&_0x5a1c30[_0x01f3('0xe4')]==='HANGUP'){delete this[_0x01f3('0x27')][_0x5a1c30['uniqueid']];this[_0x01f3('0xb3')](this['voiceQueues'][_0x346e86[_0x01f3('0xb2')]]);this['voiceQueues'][_0x346e86[_0x01f3('0xb2')]][_0x01f3('0x66')]+=0x1;this[_0x01f3('0x22')][_0x346e86[_0x01f3('0xb2')]][_0x01f3('0xe5')]+=0x1;_0x221fd1=new Hangup(_0x346e86,_0x5a1c30);_0x221fd1[_0x01f3('0xe6')]=0x12;_0x221fd1[_0x01f3('0xa7')]='HangupInAMD';_0x221fd1[_0x01f3('0xe7')]='AMD';ami[_0x01f3('0xe8')]('custom:amd',ut['buildObj'](_0x221fd1,'amd'));this[_0x01f3('0xd1')](_0x221fd1,_0x01f3('0xe9'),'[syncHangupInAMD]');}if(_0x346e86['type']!==_0x01f3('0x94')&&this[_0x01f3('0x22')][_0x346e86['queue']][_0x01f3('0xe3')]&&_0x5a1c30[_0x01f3('0xe4')]===_0x01f3('0xea')){var _0x40a968=this;return new BPromise(function(_0x3da0c5,_0x5f2a76){delete _0x40a968[_0x01f3('0x27')][_0x5a1c30['uniqueid']];_0x40a968[_0x01f3('0xb3')](_0x40a968[_0x01f3('0x22')][_0x346e86[_0x01f3('0xb2')]]);_0x40a968[_0x01f3('0x22')][_0x346e86[_0x01f3('0xb2')]][_0x01f3('0x66')]+=0x1;_0x40a968[_0x01f3('0x22')][_0x346e86[_0x01f3('0xb2')]][_0x01f3('0xe5')]+=0x1;var _0x2f6c24=_0x40a968[_0x01f3('0x22')][_0x346e86[_0x01f3('0xb2')]];var _0x230483=new Hangup(_0x346e86,_0x5a1c30);_0x230483['state']=0x13;_0x230483['statedesc']=_0x01f3('0xeb');_0x230483[_0x01f3('0xe7')]=_0x01f3('0xec');_0x230483[_0x01f3('0xed')]+=0x1;_0x230483[_0x01f3('0xee')]+=0x1;_0x230483['amd']=!![];ami[_0x01f3('0xe8')](_0x01f3('0xef'),ut[_0x01f3('0xf0')](_0x230483,'amd'));_0x40a968[_0x01f3('0xcb')](_0x230483)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0xf1')));if(_0x230483['countbusyretry']+_0x230483[_0x01f3('0xf2')]+_0x230483[_0x01f3('0xf3')]+_0x230483[_0x01f3('0xf4')]+_0x230483['countdropretry']+_0x230483[_0x01f3('0xf5')]+_0x230483[_0x01f3('0xed')]+_0x230483[_0x01f3('0xf6')]>=_0x2f6c24[_0x01f3('0xf7')]){_0x40a968[_0x01f3('0xf8')](_0x230483,_0x3da0c5,_0x5f2a76,_0x01f3('0xf9'));}else{if(_0x230483[_0x01f3('0xed')]>=_0x2f6c24[_0x01f3('0xfa')]){_0x40a968[_0x01f3('0xfb')](_0x230483,_0x3da0c5,_0x5f2a76,_0x01f3('0xfc'));}else{_0x40a968[_0x01f3('0xc0')]({'active':![],'countmachineretry':_0x230483[_0x01f3('0xed')],'scheduledat':moment()[_0x01f3('0xfd')](_0x2f6c24[_0x01f3('0xfe')],'minutes')[_0x01f3('0x78')](_0x01f3('0xff')),'ContactId':_0x230483[_0x01f3('0xd3')],'ListId':_0x230483['ListId'],'VoiceQueueId':_0x230483[_0x01f3('0xd5')]||undefined,'CampaignId':_0x230483[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x100')));_0x3da0c5({'reschedule':0x1});}}});}if(_0x346e86[_0x01f3('0xb0')]==='ivr'&&this[_0x01f3('0xb4')][_0x346e86['queue']][_0x01f3('0xe3')]&&_0x5a1c30[_0x01f3('0xe4')]==='HANGUP'){delete this['uniqueId'][_0x5a1c30[_0x01f3('0xde')]];this[_0x01f3('0xb3')](this[_0x01f3('0xb4')][_0x346e86[_0x01f3('0xb2')]]);_0x221fd1=new Hangup(_0x346e86,_0x5a1c30);_0x221fd1['state']=0x12;_0x221fd1[_0x01f3('0xa7')]='HangupInAMD';_0x221fd1['membername']=_0x01f3('0xec');ami[_0x01f3('0xe8')](_0x01f3('0xef'),ut[_0x01f3('0xf0')](_0x221fd1,'amd'));this[_0x01f3('0xd1')](_0x221fd1,_0x01f3('0x101'),'[syncHangupInAMDIvr]');}if(_0x346e86[_0x01f3('0xb0')]===_0x01f3('0x94')&&this[_0x01f3('0xb4')][_0x346e86[_0x01f3('0xb2')]][_0x01f3('0xe3')]&&_0x5a1c30[_0x01f3('0xe4')]===_0x01f3('0xea')){var _0x40a968=this;return new BPromise(function(_0x358901,_0x3b49b2){delete _0x40a968['uniqueId'][_0x5a1c30['uniqueid']];_0x40a968[_0x01f3('0xb3')](_0x40a968[_0x01f3('0xb4')][_0x346e86[_0x01f3('0xb2')]]);_0x40a968[_0x01f3('0xb4')][_0x346e86[_0x01f3('0xb2')]][_0x01f3('0x66')]+=0x1;_0x40a968['campaigns'][_0x346e86[_0x01f3('0xb2')]][_0x01f3('0xe5')]+=0x1;var _0x36b74d=_0x40a968['campaigns'][_0x346e86[_0x01f3('0xb2')]];var _0x26ce7f=new Hangup(_0x346e86,_0x5a1c30);_0x26ce7f[_0x01f3('0xe6')]=0x13;_0x26ce7f[_0x01f3('0xa7')]='Machine';_0x26ce7f[_0x01f3('0xe7')]=_0x01f3('0xec');_0x26ce7f[_0x01f3('0xed')]+=0x1;_0x26ce7f[_0x01f3('0xee')]+=0x1;_0x26ce7f[_0x01f3('0x102')]=!![];ami[_0x01f3('0xe8')]('custom:amd',ut['buildObj'](_0x26ce7f,_0x01f3('0x102')));_0x40a968[_0x01f3('0xcb')](_0x26ce7f)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0xf1')));if(_0x26ce7f[_0x01f3('0x103')]+_0x26ce7f[_0x01f3('0xf2')]+_0x26ce7f[_0x01f3('0xf3')]+_0x26ce7f[_0x01f3('0xf4')]+_0x26ce7f[_0x01f3('0x104')]+_0x26ce7f['countabandonedretry']+_0x26ce7f[_0x01f3('0xed')]+_0x26ce7f[_0x01f3('0xf6')]>=_0x36b74d[_0x01f3('0xf7')]){_0x40a968[_0x01f3('0xf8')](_0x26ce7f,_0x358901,_0x3b49b2,_0x01f3('0xf9'));}else{if(_0x26ce7f['countmachineretry']>=_0x36b74d[_0x01f3('0xfa')]){_0x40a968[_0x01f3('0xfb')](_0x26ce7f,_0x358901,_0x3b49b2,_0x01f3('0xfc'));}else{_0x40a968[_0x01f3('0xc0')]({'active':![],'countmachineretry':_0x26ce7f['countmachineretry'],'scheduledat':moment()[_0x01f3('0xfd')](_0x36b74d[_0x01f3('0xfe')],_0x01f3('0x105'))[_0x01f3('0x78')](_0x01f3('0xff')),'ContactId':_0x26ce7f['ContactId'],'ListId':_0x26ce7f[_0x01f3('0xd4')],'VoiceQueueId':_0x26ce7f[_0x01f3('0xd5')]||undefined,'CampaignId':_0x26ce7f[_0x01f3('0xd6')]||undefined})['catch'](loggerCatch(_0x01f3('0x100')));_0x358901({'reschedule':0x1});}}});}}};Dialer[_0x01f3('0x1d')][_0x01f3('0x36')]=function(_0x670b48){var _0x3bbdb8=this['uniqueId'][_0x670b48['uniqueid']];var _0x1f67be=this;var _0x1f6ffd;if(_0x3bbdb8&&_0x3bbdb8[_0x01f3('0xb0')]===_0x01f3('0x94')){delete this[_0x01f3('0x27')][_0x670b48[_0x01f3('0xde')]];this[_0x01f3('0xb3')](this[_0x01f3('0xb4')][_0x3bbdb8[_0x01f3('0xb2')]]);this['campaigns'][_0x3bbdb8[_0x01f3('0xb2')]]['ivrAnswerCallsDay']+=0x1;_0x1f6ffd=new Hangup(_0x3bbdb8,_0x670b48);this['createHistory'](_0x1f6ffd)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x106')));this[_0x01f3('0xc9')](_0x1f6ffd)[_0x01f3('0xb8')](loggerCatch('[syncHangupIvr]'));}if(_0x3bbdb8&&_0x3bbdb8['type']!==_0x01f3('0x94')&&isNotNull(this[_0x01f3('0x22')][_0x3bbdb8[_0x01f3('0xb2')]]['dialQueueProject'])){delete this[_0x01f3('0x27')][_0x670b48[_0x01f3('0xde')]];this[_0x01f3('0xb3')](this[_0x01f3('0x22')][_0x3bbdb8['queue']]);this[_0x01f3('0x22')][_0x3bbdb8['queue']][_0x01f3('0x66')]+=0x1;this['voiceQueues'][_0x3bbdb8[_0x01f3('0xb2')]][_0x01f3('0xe5')]+=0x1;_0x1f6ffd=new Hangup(_0x3bbdb8,_0x670b48);_0x1f6ffd[_0x01f3('0xe6')]=0x10;_0x1f6ffd['statedesc']=_0x01f3('0x107');_0x1f6ffd[_0x01f3('0xe7')]=_0x01f3('0x108');this['createHistory'](_0x1f6ffd)['catch'](loggerCatch(_0x01f3('0x106')));this[_0x01f3('0xc9')](_0x1f6ffd)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x109')));}if(_0x3bbdb8&&_0x3bbdb8[_0x01f3('0xb0')]!==_0x01f3('0x94')&&!isNotNull(this['voiceQueues'][_0x3bbdb8['queue']][_0x01f3('0x10a')])){delete this[_0x01f3('0x27')][_0x670b48[_0x01f3('0xde')]];this['updateOriginated'](this[_0x01f3('0x22')][_0x3bbdb8['queue']]);this['voiceQueues'][_0x3bbdb8['queue']][_0x01f3('0x6f')]+=0x1;_0x1f6ffd=new Hangup(_0x3bbdb8,_0x670b48);_0x1f6ffd['state']=0xc;_0x1f6ffd[_0x01f3('0xa7')]=_0x670b48['cause-txt'];_0x1f6ffd['membername']=_0x01f3('0x10b');this[_0x01f3('0xcb')](_0x1f6ffd)['catch'](loggerCatch(_0x01f3('0x106')));this[_0x01f3('0xc9')](_0x1f6ffd)['catch'](loggerCatch(_0x01f3('0x109')));}};Dialer['prototype'][_0x01f3('0x34')]=function(_0x3d5e79){var _0x4dda46=this[_0x01f3('0x27')][_0x3d5e79[_0x01f3('0xde')]];var _0x355773=this;if(this[_0x01f3('0x22')][_0x3d5e79[_0x01f3('0xb2')]]){if(_0x4dda46&&_0x4dda46[_0x01f3('0xb0')]!=='ivr'){delete this[_0x01f3('0x27')][_0x3d5e79[_0x01f3('0xde')]];this['voiceQueues'][_0x3d5e79[_0x01f3('0xb2')]][_0x01f3('0x66')]+=0x1;var _0x535611=new AgentComplete(_0x4dda46,_0x3d5e79);if(_0x3d5e79[_0x01f3('0x10c')]===_0x01f3('0x10d')){_0x535611[_0x01f3('0x10e')]=this[_0x01f3('0x22')][_0x3d5e79[_0x01f3('0xb2')]][_0x01f3('0x10f')]&&this[_0x01f3('0x22')][_0x3d5e79['queue']][_0x01f3('0x110')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x01f3('0xcb')](_0x535611)['catch'](loggerCatch(_0x01f3('0x111')));this[_0x01f3('0xc9')](_0x535611)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x112')));}}};Dialer['prototype'][_0x01f3('0x2e')]=function(_0x2b3602){if(this[_0x01f3('0x22')][_0x2b3602['queue']]){if(this['uniqueId'][_0x2b3602['uniqueid']]&&this[_0x01f3('0x27')][_0x2b3602[_0x01f3('0xde')]]['type']!==_0x01f3('0x94')){this[_0x01f3('0xb3')](this[_0x01f3('0x22')][_0x2b3602[_0x01f3('0xb2')]]);this[_0x01f3('0x27')][_0x2b3602['uniqueid']][_0x01f3('0x113')]=moment()[_0x01f3('0x78')](_0x01f3('0xff'));}}};Dialer[_0x01f3('0x1d')][_0x01f3('0x114')]=function(_0x361b54){this[_0x01f3('0xcb')](_0x361b54)[_0x01f3('0xb8')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x01f3('0xc9')](_0x361b54)['catch'](loggerCatch(_0x01f3('0x115')));};Dialer[_0x01f3('0x1d')]['syncQueueCallerAbandon']=function(_0x1e6780){var _0x22a463=this[_0x01f3('0x27')][_0x1e6780[_0x01f3('0xde')]];var _0x30d1e2=this;if(this[_0x01f3('0x22')][_0x1e6780[_0x01f3('0xb2')]]){if(_0x22a463&&_0x22a463[_0x01f3('0xb0')]!=='ivr'){delete this[_0x01f3('0x27')][_0x1e6780['uniqueid']];this[_0x01f3('0xb3')](this[_0x01f3('0x22')][_0x1e6780[_0x01f3('0xb2')]]);_0x22a463[_0x01f3('0x116')]=moment()['format'](_0x01f3('0xff'));var _0x4fccfc=new QueueCallerAbandon(_0x22a463,_0x1e6780);if(getSeconds(_0x22a463[_0x01f3('0x116')],_0x22a463[_0x01f3('0x117')])>=_0x22a463[_0x01f3('0x118')]){this[_0x01f3('0x22')][_0x1e6780[_0x01f3('0xb2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x01f3('0x22')][_0x1e6780[_0x01f3('0xb2')]][_0x01f3('0x6c')]+=0x1;this['voiceQueues'][_0x1e6780[_0x01f3('0xb2')]][_0x01f3('0x119')]+=0x1;_0x4fccfc[_0x01f3('0xe6')]=0xa;_0x4fccfc[_0x01f3('0xa7')]=_0x01f3('0x11a');_0x4fccfc[_0x01f3('0x11b')]=_0x01f3('0x11c');_0x4fccfc[_0x01f3('0x10e')]=this[_0x01f3('0x22')][_0x1e6780[_0x01f3('0xb2')]][_0x01f3('0x10f')]?moment()['format'](_0x01f3('0xff')):undefined;_0x4fccfc[_0x01f3('0x104')]+=0x1;_0x4fccfc[_0x01f3('0xee')]+=0x1;if(_0x4fccfc['countdropretry']>=this['voiceQueues'][_0x1e6780[_0x01f3('0xb2')]][_0x01f3('0x11d')]){this[_0x01f3('0x114')](_0x4fccfc);}else{this[_0x01f3('0xc0')]({'active':![],'countdropretry':_0x4fccfc[_0x01f3('0x104')],'scheduledat':moment()[_0x01f3('0xfd')](this[_0x01f3('0x22')][_0x1e6780[_0x01f3('0xb2')]]['dialDropRetryFrequency'],_0x01f3('0x105'))['format'](_0x01f3('0xff')),'ContactId':_0x22a463[_0x01f3('0xd3')],'ListId':_0x22a463[_0x01f3('0xd4')],'VoiceQueueId':_0x22a463[_0x01f3('0xd5')]||undefined,'CampaignId':_0x22a463[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x11e')));var _0x432f7b=new History(_0x4fccfc);_0x432f7b[_0x01f3('0xe6')]=0xa;_0x432f7b[_0x01f3('0xa7')]=_0x01f3('0x11a');_0x432f7b[_0x01f3('0xa9')]=moment()[_0x01f3('0x78')](_0x01f3('0xff'));_0x432f7b['endtime']=_0x432f7b['starttime'];_0x432f7b[_0x01f3('0x11f')]=_0x4fccfc[_0x01f3('0x11f')];_0x432f7b[_0x01f3('0x120')]=_0x4fccfc[_0x01f3('0x120')];this[_0x01f3('0xcb')](_0x432f7b)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x01f3('0x22')][_0x1e6780[_0x01f3('0xb2')]][_0x01f3('0x72')]+=0x1;this[_0x01f3('0x22')][_0x1e6780[_0x01f3('0xb2')]][_0x01f3('0x6b')]+=0x1;_0x4fccfc[_0x01f3('0xe6')]=0xb;_0x4fccfc['statedesc']='Abandoned';_0x4fccfc['dropreason']=_0x01f3('0x121');_0x4fccfc['countabandonedretry']+=0x1;_0x4fccfc[_0x01f3('0xee')]+=0x1;if(_0x4fccfc[_0x01f3('0xf5')]>=this['voiceQueues'][_0x1e6780[_0x01f3('0xb2')]]['dialAbandonedMaxRetry']){this[_0x01f3('0x114')](_0x4fccfc);}else{this[_0x01f3('0xc0')]({'active':![],'countabandonedretry':_0x4fccfc[_0x01f3('0xf5')],'scheduledat':moment()[_0x01f3('0xfd')](this[_0x01f3('0x22')][_0x1e6780['queue']][_0x01f3('0x122')],'minutes')[_0x01f3('0x78')](_0x01f3('0xff')),'ContactId':_0x22a463['ContactId'],'ListId':_0x22a463[_0x01f3('0xd4')],'VoiceQueueId':_0x22a463[_0x01f3('0xd5')]||undefined,'CampaignId':_0x22a463[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x432f7b=new History(_0x4fccfc);_0x432f7b[_0x01f3('0xe6')]=0xb;_0x432f7b[_0x01f3('0xa7')]=_0x01f3('0x123');_0x432f7b['starttime']=moment()[_0x01f3('0x78')](_0x01f3('0xff'));_0x432f7b[_0x01f3('0xa8')]=_0x432f7b['starttime'];_0x432f7b[_0x01f3('0x11f')]=_0x4fccfc['calleridname'];_0x432f7b[_0x01f3('0x120')]=_0x4fccfc['calleridnum'];this[_0x01f3('0xcb')](_0x432f7b)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x124')));}}}}};Dialer[_0x01f3('0x1d')][_0x01f3('0x125')]=function(_0x5e1698){if(this['actions'][_0x5e1698[_0x01f3('0xde')]]){this[_0x01f3('0xac')][_0x5e1698[_0x01f3('0xde')]][_0x01f3('0xaf')]=_0x5e1698[_0x01f3('0xaf')];}if(this[_0x01f3('0x27')][_0x5e1698['uniqueid']]){this[_0x01f3('0x27')][_0x5e1698[_0x01f3('0xde')]][_0x01f3('0xaf')]=_0x5e1698[_0x01f3('0xaf')];}};Dialer[_0x01f3('0x1d')][_0x01f3('0x3a')]=function(_0x5e190e){if(strategy[this['voiceQueues'][this[_0x01f3('0xac')][_0x5e190e[_0x01f3('0x126')]][_0x01f3('0xb2')]][_0x01f3('0x54')]]===_0x01f3('0x1c')){if(this[_0x01f3('0xac')][_0x5e190e[_0x01f3('0x126')]]&&_[_0x01f3('0xdf')](this[_0x01f3('0xac')][_0x5e190e['actionid']][_0x01f3('0x127')])&&_0x5e190e['status']==='1'&&_0x5e190e[_0x01f3('0x128')]==='0'){if(this[_0x01f3('0x23')][_0x5e190e[_0x01f3('0x129')]]){if(!this['agents'][_0x5e190e[_0x01f3('0x129')]]['locked']){this[_0x01f3('0x23')][_0x5e190e['stateinterface']][_0x01f3('0x127')]=!![];this[_0x01f3('0xac')][_0x5e190e['actionid']][_0x01f3('0x127')]=!![];this['actions'][_0x5e190e[_0x01f3('0x126')]][_0x01f3('0x129')]=_0x5e190e[_0x01f3('0x129')];}}}}else if((strategy[this[_0x01f3('0x22')][this[_0x01f3('0xac')][_0x5e190e[_0x01f3('0x126')]][_0x01f3('0xb2')]]['strategy']]||_0x01f3('0x1b'))===_0x01f3('0x1b')){if(this[_0x01f3('0xac')][_0x5e190e[_0x01f3('0x126')]]){if(this['agents'][_0x5e190e[_0x01f3('0x129')]]){this[_0x01f3('0xac')][_0x5e190e[_0x01f3('0x126')]][_0x01f3('0x129')]=_0x5e190e[_0x01f3('0x129')];if(_[_0x01f3('0xdf')](this[_0x01f3('0x2b')][this['actions'][_0x5e190e[_0x01f3('0x126')]][_0x01f3('0xb2')]])){this[_0x01f3('0x2b')][this[_0x01f3('0xac')][_0x5e190e[_0x01f3('0x126')]]['queue']]=[];}this['queueBooked'][this[_0x01f3('0xac')][_0x5e190e[_0x01f3('0x126')]]['queue']][_0x01f3('0x12a')](_[_0x01f3('0x8f')](_[_0x01f3('0xd2')](this[_0x01f3('0xac')][_0x5e190e['actionid']],['idHopper',_0x01f3('0x129')]),{'status':_0x5e190e[_0x01f3('0xdc')],'paused':_0x5e190e[_0x01f3('0x128')]}));}}}};function unlockQueueStatus(_0x52657c,_0x4d3c1b){setTimeout(function(){if(_[_0x01f3('0x41')](_0x52657c[_0x01f3('0x12b')])){loggerBooked[_0x01f3('0x97')]('[unlockQueueStatus][undefined]',_0x4d3c1b);}_0x52657c['queueStatusComplete']=!![];loggerBooked['info'](_0x01f3('0x12c'),_0x4d3c1b,JSON['stringify'](_[_0x01f3('0xd2')](_0x52657c,[_0x01f3('0x44'),_0x01f3('0x12b')])));},0x1f3);}Dialer[_0x01f3('0x1d')][_0x01f3('0x12d')]=function(_0x486336){var _0xbcc817=this;var _0x1b1b23=_0xbcc817['voiceQueues'][_0xbcc817['actions'][_0x486336[_0x01f3('0x126')]]['queue']];if(strategy[this[_0x01f3('0x22')][this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]]['queue']][_0x01f3('0x54')]]===_0x01f3('0x1c')){if(this[_0x01f3('0xac')][_0x486336['actionid']]&&this['actions'][_0x486336['actionid']][_0x01f3('0x129')]){this[_0x01f3('0x21')][_0x01f3('0x12e')](this[_0x01f3('0xac')][_0x486336['actionid']]['idHopper'],this[_0x01f3('0xac')][_0x486336['actionid']][_0x01f3('0x129')])[_0x01f3('0xb8')](function(_0x21d441){logger[_0x01f3('0x97')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x21d441,{'showHidden':![],'depth':null}));})[_0x01f3('0x1f')](function(){_0xbcc817[_0x01f3('0xb3')](_0xbcc817[_0x01f3('0x22')][_0xbcc817[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]][_0x01f3('0xb2')]]);_0xbcc817[_0x01f3('0x23')][_0xbcc817[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]][_0x01f3('0x129')]][_0x01f3('0x127')]=![];delete _0xbcc817[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]];unlockQueueStatus(_0x1b1b23);});}else{this[_0x01f3('0xb3')](this[_0x01f3('0x22')][this[_0x01f3('0xac')][_0x486336['actionid']]['queue']]);this[_0x01f3('0xc0')]({'active':![],'ContactId':this['actions'][_0x486336[_0x01f3('0x126')]]['ContactId'],'ListId':this['actions'][_0x486336[_0x01f3('0x126')]][_0x01f3('0xd4')],'VoiceQueueId':this['actions'][_0x486336['actionid']][_0x01f3('0xd5')]||undefined,'CampaignId':this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]][_0x01f3('0xd6')]||undefined})['catch'](loggerCatch(_0x01f3('0x12f')));delete this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]];unlockQueueStatus(_0x1b1b23);}}else if((strategy[this['voiceQueues'][this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]]['queue']][_0x01f3('0x54')]]||'rrmemory')===_0x01f3('0x1b')){var _0x1ffbe5;if(this[_0x01f3('0xac')][_0x486336['actionid']]&&!_[_0x01f3('0x4b')](this['queueBooked'][this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]][_0x01f3('0xb2')]])){if(this[_0x01f3('0x2c')][_0xbcc817['actions'][_0x486336[_0x01f3('0x126')]][_0x01f3('0xb2')]]){this[_0x01f3('0x2c')][_0xbcc817[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]][_0x01f3('0xb2')]]=this[_0x01f3('0x2c')][this[_0x01f3('0xac')][_0x486336['actionid']]['queue']]?this[_0x01f3('0x2c')][this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]][_0x01f3('0xb2')]]:this[_0x01f3('0x2b')][this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]][_0x01f3('0xb2')]]?this['queueBooked'][this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]][_0x01f3('0xb2')]]['_rr']||0x0:0x0;}this[_0x01f3('0x2b')][this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]]['queue']][_0x01f3('0x130')]=this['queueBookedRR'][this[_0x01f3('0xac')][_0x486336[_0x01f3('0x126')]][_0x01f3('0xb2')]];for(var _0x2d3c49=0x0;_0x2d3c49=0x0;})[_0x01f3('0xb8')](myreject(_0x51e10f)));}}else{_0x249310[_0x01f3('0x12a')](ami[_0x01f3('0x150')]({'action':_0x01f3('0x14b'),'command':util[_0x01f3('0x78')](_0x01f3('0x151'),_0x4f8adf,!_[_0x01f3('0x41')](config[_0x01f3('0x148')][_0x5c19a0])?_0x5c19a0:'')})['then'](function(_0x902f57){return _0x902f57[_0x01f3('0x14d')][_0x01f3('0x14e')]('true')>=0x0;})[_0x01f3('0xb8')](myreject(_0x51e10f)));}BPromise[_0x01f3('0x152')](_0x249310)[_0x01f3('0x3f')](function(_0x59824c){var _0xad2dfd=_['some'](_0x59824c);if(_0xad2dfd){return _0x2318d7(_0xad2dfd);}else{_0x5f45d6[_0x01f3('0x42')]=_0x26523a?_0x01f3('0x153'):_0x01f3('0x154');return _0x51e10f(msgResponse(_0x01f3('0x155'),_0x01f3('0x144'),_0x01f3('0x156')+_0x26523a+'\x20'+_0x316d1f+_0x01f3('0x157')+util['inspect'](_0x4f8adf,{'showHidden':![],'depth':null})+_0x01f3('0x158')+_0x5c19a0));}})[_0x01f3('0xb8')](function(_0x4c0219){return _0x51e10f(msgResponse(_0x01f3('0x142'),_0x01f3('0x144'),JSON[_0x01f3('0x4f')](_0x4c0219)));});});};Dialer[_0x01f3('0x1d')][_0x01f3('0x159')]=function(_0x1e12a2){var _0x2e8b57=this;return function(){switch(_0x1e12a2[_0x01f3('0x62')]){case _0x01f3('0x15a'):freeVariablesPredictive(_0x1e12a2);_0x2e8b57[_0x01f3('0x15b')](_0x1e12a2,0x1);break;case _0x01f3('0x15c'):freeVariablesPredictive(_0x1e12a2);_0x2e8b57[_0x01f3('0x15b')](_0x1e12a2,_0x1e12a2[_0x01f3('0x15d')]);break;case _0x01f3('0xa'):_0x2e8b57[_0x01f3('0xa')](_0x1e12a2);break;case _0x01f3('0x9'):freeVariablesPredictive(_0x1e12a2);_0x2e8b57['handlePower'](_0x1e12a2,0x1);break;default:freeVariablesPredictive(_0x1e12a2);logger[_0x01f3('0x97')]('Queue',_0x1e12a2['name'],'method\x20not\x20recognized');}};};Dialer[_0x01f3('0x1d')][_0x01f3('0x15e')]=function(_0x4a478e){return BPromise[_0x01f3('0xb7')]()['then'](cmHopper[_0x01f3('0x15f')](_0x4a478e['id'],previewRecallmeReminderInterval))[_0x01f3('0x3f')](function(_0x515b80){for(var _0x1bd21b=0x0;_0x1bd21b<_0x515b80[_0x01f3('0x131')];_0x1bd21b++){var _0x1e14b6=_0x515b80[_0x1bd21b][_0x01f3('0x160')][_0x01f3('0x44')];if(_0x1e14b6)io['to'](util[_0x01f3('0x78')]('user:%s',_0x1e14b6))[_0x01f3('0xe8')]('user:dialPreviewRecallReminder',{'hopper':_0x515b80[_0x1bd21b]});}})[_0x01f3('0xb8')](function(_0x4b0bb9){});};Dialer[_0x01f3('0x1d')]['launchHandleIvr']=function(_0x39fc8c){var _0x3a688f=this;return function(){_0x3a688f[_0x01f3('0x161')](_0x39fc8c);};};Dialer['prototype'][_0x01f3('0xc')]=function(_0x333e1a){var _0x4b823b=this;if(isNotPreview(_0x333e1a[_0x01f3('0x62')])){if(isVoiceQueueOutbound(_0x333e1a[_0x01f3('0xb0')])&&isActive(_0x333e1a['dialActive'])){_0x333e1a['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x01f3('0x3f')](checkIsLoggedIn(_0x333e1a,_0x333e1a[_0x01f3('0x57')]))['then'](checkIsActive(_0x333e1a,_0x333e1a[_0x01f3('0x61')]))[_0x01f3('0x3f')](checkInterval(_0x333e1a))[_0x01f3('0x3f')](_0x4b823b[_0x01f3('0x13d')](_0x333e1a))['then'](_0x4b823b['checkIfTime'](_0x333e1a['dialGlobalInterval'],_0x333e1a[_0x01f3('0x162')],_0x333e1a[_0x01f3('0x44')],_0x333e1a))['then'](_0x4b823b[_0x01f3('0x143')](_0x333e1a[_0x01f3('0x48')],_0x333e1a[_0x01f3('0x162')],_0x333e1a['name'],_0x333e1a))[_0x01f3('0x3f')](_0x4b823b[_0x01f3('0x159')](_0x333e1a))[_0x01f3('0xb8')](loggerCatchQueueSummary('[syncQueueSummary]',_0x333e1a));}else{notSendMessagesQueue(_0x333e1a);}}else{freeVariablesPredictive(_0x333e1a);if(_0x333e1a[_0x01f3('0x163')]){_0x4b823b['checkPreviewRecallReminder'](_0x333e1a);}}};Dialer[_0x01f3('0x1d')][_0x01f3('0x13c')]=function(){var _0x24070e=this;var _0x333cf0;for(var _0x496614 in this[_0x01f3('0xb4')]){if(typeof this[_0x01f3('0xb4')][_0x496614]!==_0x01f3('0xad')){_0x333cf0=this['campaigns'][_0x496614];if(isCampaignIvr(_0x333cf0[_0x01f3('0xb0')])&&isActive(_0x333cf0[_0x01f3('0xda')])){_0x333cf0[_0x01f3('0xa2')]=!![];BPromise[_0x01f3('0xb7')]()[_0x01f3('0x3f')](checkIsActive(_0x333cf0,_0x333cf0[_0x01f3('0xda')]))[_0x01f3('0x3f')](checkInterval(_0x333cf0))['then'](_0x24070e[_0x01f3('0x13d')](_0x333cf0))[_0x01f3('0x3f')](_0x24070e[_0x01f3('0x141')](_0x333cf0[_0x01f3('0x164')],_0x333cf0[_0x01f3('0x162')],_0x333cf0[_0x01f3('0x44')],_0x333cf0))[_0x01f3('0x3f')](_0x24070e[_0x01f3('0x143')](_0x333cf0[_0x01f3('0x48')],_0x333cf0['dialTimezone'],_0x333cf0['name'],_0x333cf0))[_0x01f3('0x3f')](_0x24070e[_0x01f3('0x165')](_0x333cf0))[_0x01f3('0xb8')](loggerCatchQueueSummary(_0x01f3('0x166'),_0x333cf0));}else{notSendMessagesCampaign(_0x333cf0);}}}};function getCallerIdRandom(_0x43080a,_0x54bbb6){var _0x1d8950;var _0x2a1220;var _0x23ddb9;if(_0x54bbb6<=0x0){_0x54bbb6=0x1;}_0x1d8950=new RegExp(_0x01f3('0x167')+_0x54bbb6+'}$');_0x2a1220=Math['pow'](0xa,_0x54bbb6-0x1);_0x23ddb9=Math[_0x01f3('0x168')](0xa,_0x54bbb6)-0x1;return util[_0x01f3('0x78')]('%s',_[_0x01f3('0x169')](_0x43080a,_0x1d8950,_[_0x01f3('0x16a')](_0x2a1220,_0x23ddb9)));}function extractCalleridName(_0x20062d){var _0xb8df81=_0x20062d['match'](/"(.*?)"/);return _0xb8df81?_0xb8df81[0x1]:_0x20062d;}function extractCalleridNumber(_0x8ae7fe){var _0x2c93ae=_0x8ae7fe[_0x01f3('0x16b')](/<(.*?)>/);return _0x2c93ae?_0x2c93ae[0x1]:_0x8ae7fe;}Dialer['prototype'][_0x01f3('0x16c')]=function(_0x278cd6,_0x2d3e23){var _0x5cfe68=this;var _0x354f56=uuid['v4']();this['actions'][_0x354f56]=new Action(_0x278cd6,_0x2d3e23,_0x354f56);return new BPromise(function(_0x1f3144,_0x275ee0){if(_[_0x01f3('0x41')](_0x278cd6)&&typeof _0x278cd6!==_0x01f3('0x16d')){return _0x275ee0(msgResponse('originate',_0x01f3('0x144'),'voiceQueue\x20is\x20undefine'));}if(_[_0x01f3('0x41')](_0x2d3e23[_0x01f3('0x16e')]['phone'])||_0x2d3e23[_0x01f3('0x16e')][_0x01f3('0x16f')]===null){return _0x275ee0(msgResponse('originate',_0x01f3('0x144'),_0x01f3('0x170')));}var _0x1d19bd={'XMD-CALLERID':_0x5cfe68[_0x01f3('0xac')][_0x354f56][_0x01f3('0x171')](),'XMD-AGI':_0x278cd6[_0x01f3('0x10a')]?util[_0x01f3('0x78')]('\x22agi://%s/square,%s\x22',ipAgi,_0x278cd6['dialQueueProject']):_0x01f3('0x172'),'XMD-AGIAFTER':_0x278cd6[_0x01f3('0x10f')]?util[_0x01f3('0x78')](_0x01f3('0x173'),ipAgi,_0x278cd6[_0x01f3('0x10f')]):'NONE','XMD-QUEUE':_0x278cd6[_0x01f3('0xb0')]==='outbound'?util[_0x01f3('0x78')](_0x01f3('0x174'),_0x278cd6[_0x01f3('0x44')],_0x278cd6[_0x01f3('0x175')]||'',_0x278cd6[_0x01f3('0x110')]?'c':'',_0x278cd6[_0x01f3('0x118')]||0x3):'NONE','XMD-CONTACTID':_0x2d3e23[_0x01f3('0xd3')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5cfe68[_0x01f3('0xac')][_0x354f56][_0x01f3('0x171')](),'XMD-AMD':_0x278cd6[_0x01f3('0xe3')]?_0x01f3('0x176'):_0x01f3('0x172'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x278cd6[_0x01f3('0xe3')]){_0x1d19bd['XMD-AMDINITIALSILENCE']=_0x278cd6[_0x01f3('0x177')]||0x9c4;_0x1d19bd[_0x01f3('0x178')]=_0x278cd6[_0x01f3('0x179')]||0x5dc;_0x1d19bd['XMD-AMDAFTERGREETINGSILENCE']=_0x278cd6[_0x01f3('0x17a')]||0x320;_0x1d19bd[_0x01f3('0x17b')]=_0x278cd6[_0x01f3('0x17c')]||0x1388;_0x1d19bd[_0x01f3('0x17d')]=_0x278cd6[_0x01f3('0x17e')]||0x64;_0x1d19bd[_0x01f3('0x17f')]=_0x278cd6['dialAMDBetweenWordsSilence']||0x32;_0x1d19bd[_0x01f3('0x180')]=_0x278cd6[_0x01f3('0x181')]||0x3;_0x1d19bd[_0x01f3('0x182')]=_0x278cd6[_0x01f3('0x183')]||0x100;_0x1d19bd[_0x01f3('0x184')]=_0x278cd6[_0x01f3('0x185')]||0x1388;}if(_0x278cd6[_0x01f3('0xb0')]===_0x01f3('0x53')){_0x1d19bd[_0x01f3('0x186')]=_0x2d3e23['VoiceQueueId'];}else{_0x1d19bd[_0x01f3('0x187')]=_0x2d3e23[_0x01f3('0xd6')];}for(var _0x679e37 in _0x2d3e23[_0x01f3('0x16e')]){if(typeof _0x2d3e23['Contact'][_0x679e37]!==_0x01f3('0xad')){if(isNotNull(_0x2d3e23[_0x01f3('0x16e')][_0x679e37])&&_0x679e37!=='id'&&_0x679e37!==_0x01f3('0x188')&&_0x679e37!==_0x01f3('0x189')&&_0x679e37!==_0x01f3('0x18a')){_0x1d19bd[util[_0x01f3('0x78')]('%s%s',_0x01f3('0x18b'),_[_0x01f3('0x18c')](_0x679e37))]=_0x2d3e23['Contact'][_0x679e37];}}}var _0x5110a1=_0x5cfe68[_0x01f3('0x13e')](_0x278cd6['Trunk'])?getCallerId(_0x278cd6[_0x01f3('0x76')]['callerid'],_0x278cd6[_0x01f3('0x63')],_0x278cd6[_0x01f3('0x18d')]>0x0?getCallerIdRandom(_0x278cd6[_0x01f3('0x18e')],_0x278cd6[_0x01f3('0x18d')]):_0x278cd6[_0x01f3('0x18e')]):getCallerId(_[_0x01f3('0xdf')](_0x278cd6['TrunkBackup'])?_0x278cd6['Trunk'][_0x01f3('0x77')]:_0x278cd6[_0x01f3('0x13f')][_0x01f3('0x77')],_0x278cd6['dialOriginateCallerIdName'],_0x278cd6[_0x01f3('0x18d')]>0x0?getCallerIdRandom(_0x278cd6[_0x01f3('0x18e')],_0x278cd6[_0x01f3('0x18d')]):_0x278cd6[_0x01f3('0x18e')]);if(_0x5110a1){_0x1d19bd[_0x01f3('0x18f')]=_0x5cfe68[_0x01f3('0xac')][_0x354f56][_0x01f3('0x190')]=extractCalleridName(_0x5110a1);_0x1d19bd[_0x01f3('0x191')]=_0x5cfe68[_0x01f3('0xac')][_0x354f56]['originatecalleridnum']=extractCalleridNumber(_0x5110a1);}return ami[_0x01f3('0x150')]({'actionid':_0x354f56,'action':_0x01f3('0x192'),'channel':_0x5cfe68['isTrunkReachable'](_0x278cd6[_0x01f3('0x76')])?util[_0x01f3('0x78')](_0x01f3('0x193'),_0x278cd6[_0x01f3('0x76')][_0x01f3('0x44')],isNotNull(_0x278cd6['dialPrefix'])?_0x278cd6[_0x01f3('0x65')][_0x01f3('0x194')]()||'':'',_0x278cd6[_0x01f3('0x195')]>0x0?_0x2d3e23[_0x01f3('0x16e')][_0x01f3('0x16f')][_0x01f3('0x196')](_0x278cd6[_0x01f3('0x195')]):_0x2d3e23['Contact']['phone']):util[_0x01f3('0x78')]('SIP/%s/%s%s',_[_0x01f3('0xdf')](_0x278cd6[_0x01f3('0x13f')])?_0x278cd6[_0x01f3('0x76')]['name']:_0x278cd6[_0x01f3('0x13f')][_0x01f3('0x44')],isNotNull(_0x278cd6[_0x01f3('0x65')])?_0x278cd6[_0x01f3('0x65')][_0x01f3('0x194')]()||'':'',_0x278cd6['dialCutDigit']>0x0?_0x2d3e23[_0x01f3('0x16e')][_0x01f3('0x16f')]['substring'](_0x278cd6[_0x01f3('0x195')]):_0x2d3e23[_0x01f3('0x16e')][_0x01f3('0x16f')]),'callerid':_0x5110a1,'Exten':_0x01f3('0xe2'),'Context':_0x01f3('0x197'),'Priority':'1','variable':_0x1d19bd,'timeout':(_0x278cd6[_0x01f3('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x354f56})[_0x01f3('0x3f')](function(_0x184441){return _0x1f3144(_0x184441);})[_0x01f3('0xb8')](function(_0x30a9be){_0x278cd6[_0x01f3('0x198')]+=0x1;var _0x3b9093=new History(_0x5cfe68[_0x01f3('0xac')][_0x354f56]);logger[_0x01f3('0x97')](util[_0x01f3('0x78')](_0x01f3('0x199'),JSON[_0x01f3('0x4f')](_0x30a9be)));_0x3b9093[_0x01f3('0xe6')]=0xe;_0x3b9093[_0x01f3('0xa7')]=_0x01f3('0x19a');_0x3b9093[_0x01f3('0xa9')]=moment()[_0x01f3('0x78')](_0x01f3('0xff'));_0x3b9093[_0x01f3('0xa8')]=_0x3b9093[_0x01f3('0xa9')];_0x5cfe68[_0x01f3('0xcb')](_0x3b9093)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x19b')));_0x5cfe68[_0x01f3('0xc9')](_0x3b9093)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x19b')))['finally'](function(){delete _0x5cfe68[_0x01f3('0xac')][_0x354f56];return _0x275ee0(msgResponse('originate','Error','originate\x20action\x20Error'));});});});};Dialer[_0x01f3('0x1d')][_0x01f3('0x32')]=function(_0x7be9b1){var _0x336b38=this['actions'][_0x7be9b1['actionid']];if(_0x336b38){delete this[_0x01f3('0xac')][_0x7be9b1[_0x01f3('0x126')]];_0x336b38[_0x01f3('0x117')]=moment()[_0x01f3('0x78')](_0x01f3('0xff'));var _0x72831f=_0x336b38['type']===_0x01f3('0x94')?this[_0x01f3('0xb4')][_0x336b38[_0x01f3('0xb2')]]:this[_0x01f3('0x22')][_0x336b38[_0x01f3('0x19c')]()];if(!this['isSuccess'](_0x7be9b1[_0x01f3('0x19d')])){this['updateOriginated'](_0x72831f);return this[_0x01f3('0x19e')](_0x336b38,_0x72831f,_0x7be9b1)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x19f')));}this['uniqueId'][_0x7be9b1['uniqueid']]=_0x336b38;}};Dialer[_0x01f3('0x1d')]['checkRetriveMax']=function(_0x4f9d40,_0x218155,_0x1473eb){var _0x2ea853=new History(_0x218155);if(_0x2ea853[_0x01f3('0x103')]+_0x2ea853[_0x01f3('0xf2')]+_0x2ea853['countnoanswerretry']+_0x2ea853[_0x01f3('0xf4')]+_0x2ea853[_0x01f3('0x104')]+_0x2ea853[_0x01f3('0xf5')]+_0x2ea853[_0x01f3('0xed')]+_0x2ea853['countagentrejectretry']>=_0x1473eb['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4f9d40){case 0x3:if(_0x2ea853[_0x01f3('0xf3')]>=_0x1473eb[_0x01f3('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x2ea853[_0x01f3('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x1473eb[_0x01f3('0x1a1')],'minutes')[_0x01f3('0x78')](_0x01f3('0xff')),'ContactId':_0x2ea853[_0x01f3('0xd3')],'ListId':_0x2ea853[_0x01f3('0xd4')],'VoiceQueueId':_0x2ea853[_0x01f3('0xd5')]||undefined,'CampaignId':_0x2ea853[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1a2')));break;case 0x5:if(_0x2ea853['countbusyretry']>=_0x1473eb[_0x01f3('0x1a3')]-0x1){return!![];}this[_0x01f3('0xc0')]({'active':![],'countbusyretry':_0x2ea853['countbusyretry']+=0x1,'scheduledat':moment()[_0x01f3('0xfd')](_0x1473eb[_0x01f3('0x1a4')],_0x01f3('0x105'))[_0x01f3('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2ea853['ContactId'],'ListId':_0x2ea853[_0x01f3('0xd4')],'VoiceQueueId':_0x2ea853[_0x01f3('0xd5')]||undefined,'CampaignId':_0x2ea853[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2ea853[_0x01f3('0xf2')]>=_0x1473eb[_0x01f3('0x1a5')]-0x1){return!![];}this[_0x01f3('0xc0')]({'active':![],'countcongestionretry':_0x2ea853[_0x01f3('0xf2')]+=0x1,'scheduledat':moment()[_0x01f3('0xfd')](_0x1473eb[_0x01f3('0x1a6')],'minutes')[_0x01f3('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2ea853['ContactId'],'ListId':_0x2ea853[_0x01f3('0xd4')],'VoiceQueueId':_0x2ea853[_0x01f3('0xd5')]||undefined,'CampaignId':_0x2ea853['CampaignId']||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1a7')));break;case 0x0:if(_0x2ea853[_0x01f3('0xf4')]>=_0x1473eb[_0x01f3('0x1a8')]-0x1){return!![];}else{this[_0x01f3('0xc0')]({'active':![],'countnosuchnumberretry':_0x2ea853[_0x01f3('0xf4')]+=0x1,'scheduledat':moment()[_0x01f3('0xfd')](_0x1473eb[_0x01f3('0x1a9')],'minutes')['format'](_0x01f3('0xff')),'ContactId':_0x2ea853[_0x01f3('0xd3')],'ListId':_0x2ea853[_0x01f3('0xd4')],'VoiceQueueId':_0x2ea853[_0x01f3('0xd5')]||undefined,'CampaignId':_0x2ea853[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1aa')));}break;case 0xa:if(_0x2ea853[_0x01f3('0x104')]>=_0x1473eb[_0x01f3('0x11d')]-0x1){return!![];}this[_0x01f3('0xc0')]({'active':![],'countdropretry':_0x2ea853['countdropretry']+=0x1,'scheduledat':moment()[_0x01f3('0xfd')](_0x1473eb[_0x01f3('0x1ab')],_0x01f3('0x105'))[_0x01f3('0x78')](_0x01f3('0xff')),'ContactId':_0x2ea853[_0x01f3('0xd3')],'ListId':_0x2ea853[_0x01f3('0xd4')],'VoiceQueueId':_0x2ea853[_0x01f3('0xd5')]||undefined,'CampaignId':_0x2ea853[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x11e')));break;case 0xb:if(_0x2ea853[_0x01f3('0xf5')]>=_0x1473eb['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x2ea853[_0x01f3('0xf5')]+=0x1,'scheduledat':moment()[_0x01f3('0xfd')](_0x1473eb[_0x01f3('0x122')],_0x01f3('0x105'))[_0x01f3('0x78')](_0x01f3('0xff')),'ContactId':_0x2ea853['ContactId'],'ListId':_0x2ea853[_0x01f3('0xd4')],'VoiceQueueId':_0x2ea853[_0x01f3('0xd5')]||undefined,'CampaignId':_0x2ea853[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1ac')));break;case 0x13:if(_0x2ea853[_0x01f3('0xed')]>=_0x1473eb[_0x01f3('0xfa')]-0x1){return!![];}this[_0x01f3('0xc0')]({'active':![],'countmachineretry':_0x2ea853[_0x01f3('0xed')]+=0x1,'scheduledat':moment()['add'](_0x1473eb[_0x01f3('0xfe')],'minutes')[_0x01f3('0x78')](_0x01f3('0xff')),'ContactId':_0x2ea853[_0x01f3('0xd3')],'ListId':_0x2ea853[_0x01f3('0xd4')],'VoiceQueueId':_0x2ea853[_0x01f3('0xd5')]||undefined,'CampaignId':_0x2ea853[_0x01f3('0xd6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2ea853[_0x01f3('0xf6')]>=_0x1473eb[_0x01f3('0x1ad')]-0x1){return!![];}this[_0x01f3('0xc0')]({'active':![],'countagentrejectretry':_0x2ea853[_0x01f3('0xf6')]+=0x1,'scheduledat':moment()[_0x01f3('0xfd')](_0x1473eb[_0x01f3('0x1ae')],_0x01f3('0x105'))[_0x01f3('0x78')](_0x01f3('0xff')),'ContactId':_0x2ea853[_0x01f3('0xd3')],'ListId':_0x2ea853[_0x01f3('0xd4')],'VoiceQueueId':_0x2ea853[_0x01f3('0xd5')]||undefined,'CampaignId':_0x2ea853[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1af')));break;default:return!![];}};Dialer[_0x01f3('0x1d')][_0x01f3('0x19e')]=function(_0x5569e5,_0x363505,_0x5936a7){var _0x1047ed=this;var _0x935c01=new History(_0x5569e5);return new BPromise(function(_0x45cfe6,_0x51d4cf){if(_['isUndefined'](_0x363505)&&typeof _0x363505!=='object'){return _0x51d4cf(msgResponse('[callProgressDetecting]',_0x01f3('0x144'),_0x01f3('0x1b0')));}if(_[_0x01f3('0x41')](_0x5936a7)&&typeof _0x5936a7!=='object'){return _0x51d4cf(msgResponse(_0x01f3('0x1b1'),_0x01f3('0x144'),_0x01f3('0x1b2')));}switch(_0x5936a7[_0x01f3('0x10c')]){case'0':_0x363505[_0x01f3('0x6d')]+=0x1;_0x935c01['state']=0x0;_0x935c01[_0x01f3('0xa7')]=_0x01f3('0x1b3');_0x935c01[_0x01f3('0xf4')]+=0x1;_0x935c01['countglobal']+=0x1;ami['emit'](_0x01f3('0x1b4'),ut[_0x01f3('0xf0')](_0x5569e5,_0x01f3('0x1b5')));_0x1047ed['createHistory'](_0x935c01)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0xf1')));if(_0x1047ed[_0x01f3('0x1b6')](0x0,_0x5569e5,_0x363505)){if(_0x935c01[_0x01f3('0xf4')]>=_0x363505[_0x01f3('0x1a8')]){_0x1047ed[_0x01f3('0xfb')](_0x935c01,_0x45cfe6,_0x51d4cf,'reason\x200\x20no\x20such\x20number....');}else{_0x1047ed['stateGlobal'](_0x935c01,_0x45cfe6,_0x51d4cf,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x363505['outboundNoAnswerCallsDay']+=0x1;_0x935c01['state']=0x3;_0x935c01[_0x01f3('0xa7')]=_0x01f3('0x1b7');_0x935c01[_0x01f3('0xf3')]+=0x1;_0x935c01['countglobal']+=0x1;ami['emit'](_0x01f3('0x1b8'),ut[_0x01f3('0xf0')](_0x5569e5,_0x01f3('0x1b9')));_0x1047ed[_0x01f3('0xcb')](_0x935c01)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1ba')));if(_0x1047ed[_0x01f3('0x1b6')](0x3,_0x5569e5,_0x363505)){if(_0x935c01[_0x01f3('0xf3')]>=_0x363505[_0x01f3('0x1a0')]){_0x1047ed[_0x01f3('0xfb')](_0x935c01,_0x45cfe6,_0x51d4cf,_0x01f3('0x1bb'));}else{_0x1047ed[_0x01f3('0xf8')](_0x935c01,_0x45cfe6,_0x51d4cf,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x363505[_0x01f3('0x68')]+=0x1;_0x935c01[_0x01f3('0xe6')]=0x5;_0x935c01['statedesc']=_0x01f3('0x1bc');_0x935c01[_0x01f3('0x103')]+=0x1;_0x935c01[_0x01f3('0xee')]+=0x1;ami[_0x01f3('0xe8')](_0x01f3('0x1bd'),ut[_0x01f3('0xf0')](_0x5569e5,_0x01f3('0x1be')));_0x1047ed[_0x01f3('0xcb')](_0x935c01)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1bf')));if(_0x1047ed['checkRetriveMax'](0x5,_0x5569e5,_0x363505)){if(_0x935c01['countbusyretry']>=_0x363505[_0x01f3('0x1a3')]){_0x1047ed[_0x01f3('0xfb')](_0x935c01,_0x45cfe6,_0x51d4cf,_0x01f3('0x1c0'));}else{_0x1047ed['stateGlobal'](_0x935c01,_0x45cfe6,_0x51d4cf,'reason\x205\x20busy');}}break;case'8':_0x363505[_0x01f3('0x69')]+=0x1;_0x935c01[_0x01f3('0xe6')]=0x8;_0x935c01[_0x01f3('0xa7')]=_0x01f3('0x1c1');_0x935c01[_0x01f3('0xf2')]+=0x1;_0x935c01[_0x01f3('0xee')]+=0x1;ami[_0x01f3('0xe8')]('custom:agentcongestion',ut[_0x01f3('0xf0')](_0x5569e5,_0x01f3('0x1c2')));_0x1047ed[_0x01f3('0xcb')](_0x935c01)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1c3')));if(_0x1047ed[_0x01f3('0x1b6')](0x8,_0x5569e5,_0x363505)){if(_0x935c01[_0x01f3('0xf2')]>=_0x363505['dialCongestionMaxRetry']){_0x1047ed[_0x01f3('0xfb')](_0x935c01,_0x45cfe6,_0x51d4cf,_0x01f3('0x1c4'));}else{_0x1047ed[_0x01f3('0xf8')](_0x935c01,_0x45cfe6,_0x51d4cf,_0x01f3('0x1c4'));}}break;case'11':_0x363505[_0x01f3('0x1c5')]+=0x1;_0x935c01[_0x01f3('0xe6')]=0xb;_0x935c01['statedesc']='Abandoned';_0x935c01[_0x01f3('0xf5')]+=0x1;_0x935c01[_0x01f3('0xee')]+=0x1;_0x1047ed['createHistory'](_0x935c01)[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x124')));if(_0x1047ed[_0x01f3('0x1b6')](0xb,_0x5569e5,_0x363505)){if(_0x935c01['countabandonedretry']>=_0x363505[_0x01f3('0x1c6')]){_0x1047ed[_0x01f3('0xfb')](_0x935c01,_0x45cfe6,_0x51d4cf,_0x01f3('0x1c7'));}else{_0x1047ed['stateGlobal'](_0x935c01,_0x45cfe6,_0x51d4cf,_0x01f3('0x1c7'));}}break;case'20':_0x363505[_0x01f3('0x6e')]+=0x1;_0x935c01[_0x01f3('0xe6')]=0x14;_0x935c01[_0x01f3('0xa7')]=_0x01f3('0x1c8');_0x935c01['countagentrejectretry']+=0x1;_0x935c01[_0x01f3('0xee')]+=0x1;ami['emit'](_0x01f3('0x1c9'),ut[_0x01f3('0xf0')](_0x5569e5,'agentreject'));_0x1047ed[_0x01f3('0xcb')](_0x935c01)['catch'](loggerCatch(_0x01f3('0x1ca')));if(_0x1047ed['checkRetriveMax'](0x14,_0x5569e5,_0x363505)){if(_0x935c01[_0x01f3('0xf6')]>=_0x363505[_0x01f3('0x1ad')]){_0x1047ed['createStateFinal'](_0x935c01,_0x45cfe6,_0x51d4cf,_0x01f3('0x1cb'));}else{_0x1047ed['stateGlobal'](_0x935c01,_0x45cfe6,_0x51d4cf,_0x01f3('0x1cb'));}}break;default:_0x363505[_0x01f3('0x6f')]+=0x1;_0x935c01[_0x01f3('0xe6')]=0xc;_0x935c01[_0x01f3('0xa7')]=_0x5936a7[_0x01f3('0x10c')];_0x1047ed['createHistory'](_0x935c01)[_0x01f3('0xb8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1047ed['checkRetriveMax'](_0x5936a7['reason'],_0x5569e5,_0x363505)){if(_0x935c01[_0x01f3('0x103')]+_0x935c01['countcongestionretry']+_0x935c01[_0x01f3('0xf3')]+_0x935c01[_0x01f3('0xf4')]+_0x935c01[_0x01f3('0x104')]+_0x935c01['countabandonedretry']+_0x935c01[_0x01f3('0xed')]+_0x935c01[_0x01f3('0xf6')]>=_0x363505[_0x01f3('0xf7')]){_0x1047ed[_0x01f3('0xf8')](_0x935c01,_0x45cfe6,_0x51d4cf,_0x5936a7[_0x01f3('0x10c')]);}else{_0x1047ed['createStateFinal'](_0x935c01,_0x45cfe6,_0x51d4cf,_0x5936a7[_0x01f3('0x10c')]);}}}});};Dialer[_0x01f3('0x1d')][_0x01f3('0xf8')]=function(_0x2f9459,_0x1c8659,_0x57c8f7,_0x674bee){var _0x10c60f=new Final(_0x2f9459);_0x10c60f[_0x01f3('0xe6')]=0xf;_0x10c60f[_0x01f3('0xa7')]=_0x01f3('0x1cc');this[_0x01f3('0xfb')](_0x10c60f,_0x1c8659,_0x57c8f7,_0x674bee);};Dialer['prototype'][_0x01f3('0xfb')]=function(_0x3ea4ff,_0x4e53ee,_0x39c5cb,_0x51888b){this[_0x01f3('0xc9')](_0x3ea4ff)[_0x01f3('0x3f')](function(){return _0x4e53ee(msgResponse(_0x01f3('0x1b1'),'Success',_0x51888b));})[_0x01f3('0xb8')](function(){return _0x39c5cb(msgResponse(_0x01f3('0x1cd'),_0x01f3('0x144'),_0x01f3('0x1ce')));});};Dialer[_0x01f3('0x1d')]['predictive']=function(_0x28ffc7){var _0x4ca78f=_0x28ffc7['dialPredictiveOptimizationPercentage']/0x64;var _0x57c7f1=_0x28ffc7[_0x01f3('0x6c')]/(_0x28ffc7[_0x01f3('0x6c')]+_0x28ffc7[_0x01f3('0x66')]);var _0x1580e2=Math[_0x01f3('0x1cf')](_0x28ffc7[_0x01f3('0x74')]*(_0x28ffc7[_0x01f3('0x1d0')]/0x64));var _0x4d60c4=Math[_0x01f3('0x1cf')](_0x28ffc7[_0x01f3('0x74')]*(_0x28ffc7[_0x01f3('0x1d1')]/0x64));var _0x1aa0a3=_0x28ffc7[_0x01f3('0x56')]+_0x28ffc7[_0x01f3('0x5b')];var _0x3f71e2=Math[_0x01f3('0x1d2')](_0x28ffc7[_0x01f3('0x75')]*_0x28ffc7[_0x01f3('0x8c')]*_0x28ffc7['predictiveIntervalHitRate']*_0x28ffc7[_0x01f3('0x1d3')]);if(_[_0x01f3('0x41')](_0x28ffc7[_0x01f3('0x2a')])){if(!_[_0x01f3('0x41')](_0x28ffc7['startPredictive'])){_0x28ffc7[_0x01f3('0x29')]=undefined;loggerPredictive['error'](_0x01f3('0x1d4'),_0x01f3('0x1d5'));}if(!_['isUndefined'](_0x28ffc7[_0x01f3('0x92')])){loggerPredictive['error'](_0x01f3('0x1d4'),_0x01f3('0x1d6'));clearInterval(_0x28ffc7[_0x01f3('0x92')]);_0x28ffc7[_0x01f3('0x92')]=undefined;}_0x28ffc7[_0x01f3('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x01f3('0x7b')](_0x28ffc7[_0x01f3('0x44')],_0x01f3('0x1d7'),_0x28ffc7[_0x01f3('0x2a')]);this['handlePower'](_0x28ffc7,0x1);}else if(ifInterval(_0x28ffc7[_0x01f3('0x1d8')],_0x28ffc7[_0x01f3('0x2a')])){this[_0x01f3('0x15b')](_0x28ffc7,0x1);loggerPredictiveCalls['info'](_0x01f3('0x1d9'),_0x28ffc7[_0x01f3('0x2a')],_0x28ffc7[_0x01f3('0x44')]);_0x28ffc7[_0x01f3('0x75')]=0x0;_0x28ffc7[_0x01f3('0x119')]=0x0;}else if(_0x4ca78f<_0x57c7f1&&_0x28ffc7[_0x01f3('0x1da')]===_0x01f3('0x1db')){freeVariablesPredictive(_0x28ffc7);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x57c7f1,_0x01f3('0x2a'),_0x28ffc7['name']);}else if(_0x3f71e2<_0x28ffc7[_0x01f3('0x119')]&&_0x28ffc7[_0x01f3('0x1da')]==='dropRate'){freeVariablesPredictive(_0x28ffc7);loggerPredictive[_0x01f3('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x01f3('0x1dc'),_0x3f71e2,_0x01f3('0x1dd'),_0x28ffc7['predictiveIntervalErlangCallsDroppedCalls'],_0x01f3('0x2a'),_0x28ffc7[_0x01f3('0x44')]);}else if(!ifInterval(_0x28ffc7[_0x01f3('0x1d8')],_0x28ffc7[_0x01f3('0x2a')])&&_[_0x01f3('0x41')](_0x28ffc7['startPredictive'])&&!_[_0x01f3('0x41')](_0x28ffc7[_0x01f3('0x2a')])){_0x28ffc7[_0x01f3('0x29')]=moment()[_0x01f3('0x78')](_0x01f3('0xff'));loggerPredictive[_0x01f3('0x7b')](_0x28ffc7[_0x01f3('0x44')],_0x01f3('0x1de'),_0x28ffc7[_0x01f3('0x29')]);this[_0x01f3('0xbd')](_0x28ffc7['dialPredictiveInterval'])[_0x01f3('0x3f')](this[_0x01f3('0x1df')](_0x28ffc7))[_0x01f3('0x3f')](mergeDataErlangB(_0x28ffc7))['then'](this['startMethodPredictive'](_0x28ffc7))[_0x01f3('0xb8')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x28ffc7));}else if(!ifInterval(_0x28ffc7['dialPredictiveInterval'],_0x28ffc7[_0x01f3('0x29')])){_0x28ffc7['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x28ffc7['startPredictive']=moment()[_0x01f3('0x78')](_0x01f3('0xff'));loggerPredictive['info'](_0x28ffc7[_0x01f3('0x44')],_0x01f3('0x1e0'),_0x28ffc7[_0x01f3('0x29')]);clearInterval(_0x28ffc7[_0x01f3('0x92')]);_0x28ffc7[_0x01f3('0x92')]=undefined;this['averageHandleTime'](_0x28ffc7[_0x01f3('0x1d8')])['then'](this[_0x01f3('0x1df')](_0x28ffc7))['then'](mergeDataErlangB(_0x28ffc7))[_0x01f3('0x3f')](this[_0x01f3('0x1e1')](_0x28ffc7))[_0x01f3('0xb8')](loggerCatchPredictive(_0x01f3('0x1e2'),_0x28ffc7));}else if(_0x28ffc7[_0x01f3('0x74')]&&_0x1aa0a3<_0x28ffc7[_0x01f3('0x74')]-_0x4d60c4){freeVariablesPredictive(_0x28ffc7);loggerPredictive[_0x01f3('0x7b')](_0x28ffc7[_0x01f3('0x44')],_0x01f3('0x1e3'),_0x1aa0a3,_0x01f3('0x1e4'),_0x28ffc7['predictiveIntervalAvailable'],'-',_0x4d60c4,'=',_0x28ffc7['predictiveIntervalAvailable']-_0x4d60c4,')');}else if(_0x28ffc7[_0x01f3('0x74')]&&_0x1aa0a3>_0x28ffc7['predictiveIntervalAvailable']+_0x1580e2){freeVariablesPredictive(_0x28ffc7);loggerPredictive[_0x01f3('0x7b')](_0x28ffc7[_0x01f3('0x44')],_0x01f3('0x1e3'),_0x1aa0a3,_0x01f3('0x1e5'),_0x28ffc7[_0x01f3('0x74')],'+',_0x1580e2,'=',_0x28ffc7[_0x01f3('0x74')]+_0x1580e2,')');}};Dialer[_0x01f3('0x1d')][_0x01f3('0x1df')]=function(_0x2185fd){var _0x4ba30c=this;return function(_0x4953bf){return new BPromise(function(_0x5848f2,_0x5ee019){_[_0x01f3('0x8f')](_0x2185fd,_0x4953bf[0x0]);if(checkGetDataPredictive(_0x4953bf[0x0])){var _0x9fd5ec=_0x2185fd[_0x01f3('0x74')]=_0x2185fd[_0x01f3('0x5b')]+_0x2185fd[_0x01f3('0x56')];var _0x1e8d10=_0x2185fd[_0x01f3('0x1d8')]*0x3c;var _0x3fe86a=_0x4953bf[0x0]['predictiveIntervalAvgTalktime']+_0x4953bf[0x0]['predictiveIntervalAvgHoldtime'];var _0x4c8a41=(_0x4953bf[0x0]['predictiveIntervalAnsweredCalls']+_0x4953bf[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4953bf[0x0][_0x01f3('0x72')])/_0x4953bf[0x0][_0x01f3('0x7d')];_0x2185fd['predictiveIntervalHitRate']=_0x4c8a41>0x0?_0x4c8a41:0x1;switch(_0x2185fd['dialPredictiveOptimization']){case _0x01f3('0x1db'):var _0x47bf0d=_0x2185fd['dialPredictiveOptimizationPercentage']/0x64;return _0x4ba30c[_0x01f3('0x1e6')](_0x9fd5ec,_0x1e8d10,_0x3fe86a,_0x4c8a41,_0x47bf0d)[_0x01f3('0x3f')](function(_0x448976){return _0x5848f2(_0x448976);});case _0x01f3('0x1e7'):var _0xe90198=_0x2185fd[_0x01f3('0x1e8')]/0x64;return _0x4ba30c['busyFactor'](_0x9fd5ec,_0x1e8d10,_0x3fe86a,_0x4c8a41,_0xe90198)['then'](function(_0x1b7f06){return _0x5848f2(_0x1b7f06);});default:return _0x5ee019(msgResponse('[getDataPredictive]',_0x01f3('0x144'),'Unknown\x20Predictive'));}}else{return _0x5ee019(msgResponse(_0x01f3('0x1e9'),'Failure',_0x01f3('0x1ea')));}});};};Dialer['prototype'][_0x01f3('0x1eb')]=function(_0x5e3980){var _0x235734=this;return function(_0x293c92){return new BPromise(function(_0x5b2076,_0x74f8c){_[_0x01f3('0x8f')](_0x5e3980,_0x293c92[0x0]);if(checkGetDataPredictive(_0x293c92[0x0])){loggerPredictive[_0x01f3('0x7b')](JSON[_0x01f3('0x4f')](_0x293c92[0x0]));if(_0x5e3980[_0x01f3('0x1da')]==='dropRate'){return _0x235734[_0x01f3('0xc7')](_0x5e3980['id'])[_0x01f3('0x3f')](function(_0x44fd0b){var _0x3d3b22=_0x5e3980['loggedIn']-_0x44fd0b[0x0][_0x01f3('0x1ec')];var _0x17bee9=_0x5e3980[_0x01f3('0x1d8')]*0x3c;var _0x3b2bb3=_0x293c92[0x0][_0x01f3('0x71')]+_0x293c92[0x0]['predictiveIntervalAvgHoldtime'];var _0x47ce08=(_0x293c92[0x0][_0x01f3('0x7f')]+_0x293c92[0x0][_0x01f3('0x73')]+_0x293c92[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x293c92[0x0][_0x01f3('0x7d')];var _0xa4a8ce=_0x5e3980[_0x01f3('0x1e8')]/0x64;_0x5e3980[_0x01f3('0x1ed')]=_0x44fd0b[0x0][_0x01f3('0x1ec')]||0x0;_0x5e3980[_0x01f3('0x1ee')]=_0x47ce08>0x0?_0x47ce08:0x1;return _0x235734[_0x01f3('0x1e6')](_0x3d3b22,_0x17bee9,_0x3b2bb3,_0x47ce08,_0xa4a8ce);})[_0x01f3('0x3f')](function(_0x44c521){return _0x5b2076(_0x44c521);})[_0x01f3('0xb8')](function(_0x46794d){return _0x74f8c(msgResponse('[CatchErlangB]',_0x01f3('0x144'),JSON['stringify'](_0x46794d)));});}if(_0x5e3980['dialPredictiveOptimization']==='agentBusyFactor'){return _0x235734[_0x01f3('0xc7')](_0x5e3980['id'])[_0x01f3('0x3f')](function(_0x491fe5){var _0x1d14f0=_0x5e3980[_0x01f3('0x57')]-_0x491fe5[0x0][_0x01f3('0x1ec')];var _0x497c29=_0x5e3980[_0x01f3('0x1d8')]*0x3c;var _0x309dc6=_0x293c92[0x0]['predictiveIntervalAvgTalktime']+_0x293c92[0x0][_0x01f3('0x70')];var _0xb82864=(_0x293c92[0x0][_0x01f3('0x7f')]+_0x293c92[0x0][_0x01f3('0x73')]+_0x293c92[0x0][_0x01f3('0x72')])/_0x293c92[0x0][_0x01f3('0x7d')];var _0x5196fb=_0x5e3980['dialPredictiveOptimizationPercentage']/0x64;_0x5e3980[_0x01f3('0x1ed')]=_0x491fe5[0x0]['outboundQueuePauses']||0x0;_0x5e3980[_0x01f3('0x1ee')]=_0xb82864>0x0?_0xb82864:0x1;return _0x235734[_0x01f3('0x1ef')](_0x1d14f0,_0x497c29,_0x309dc6,_0xb82864,_0x5196fb);})[_0x01f3('0x3f')](function(_0x4f86f0){return _0x5b2076(_0x4f86f0);})['catch'](function(_0x5a7d0c){return _0x74f8c(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x5a7d0c)));});}}else{return _0x74f8c(msgResponse('[getDataPredictive]',_0x01f3('0x144'),_0x01f3('0x1ea')));}});};};Dialer[_0x01f3('0x1d')]['startMethodPredictive']=function(_0x162348){var _0x5b0af0=this;return function(){var _0x39d8d4=0x0;var _0x42999b=Math[_0x01f3('0x1d2')](_0x162348[_0x01f3('0x1f0')]*0x3e8);if(_0x42999b>0x0){_0x42999b=_0x42999b<0x64?0x64:_0x42999b;loggerPredictive['info'](_0x162348['name'],'one\x20call\x20every:',_0x42999b,'milliseconds');_0x162348[_0x01f3('0x92')]=setInterval(function(){_0x5b0af0[_0x01f3('0x92')](_0x162348);loggerPredictiveCalls[_0x01f3('0x7b')]('[handlePredictive]',_0x39d8d4+=0x1);},_0x42999b);}else{loggerPredictive['info'](_0x162348[_0x01f3('0x44')],_0x01f3('0x1f1'));}};};Dialer[_0x01f3('0x1d')]['checkContactBlack']=function(_0x3ba2a6,_0x4c486a){var _0x2cc6d6=this;return function(_0x17f947){if(_[_0x01f3('0x4b')](_0x17f947)){if(_['isNil'](_0x4c486a['UserId'])||!_0x4c486a[_0x01f3('0x1f2')]){if(_0x3ba2a6[_0x01f3('0x62')]==='booked'){_0x3ba2a6[_0x01f3('0x12b')]=_[_0x01f3('0x41')](_0x3ba2a6['queueStatusComplete'])?!![]:_0x3ba2a6['queueStatusComplete'];var _0x2173f1=uuid['v4']();_0x2cc6d6[_0x01f3('0xac')][_0x2173f1]=new Action(_0x3ba2a6,_0x4c486a,_0x2173f1);loggerBooked['info'](_0x01f3('0x1f3'),_0x2173f1,_0x01f3('0x1f4'),JSON[_0x01f3('0x4f')](_0x3ba2a6[_0x01f3('0x12b')]),'Queue:\x20',_0x3ba2a6[_0x01f3('0x44')]);if(_0x3ba2a6[_0x01f3('0x12b')]){_0x3ba2a6[_0x01f3('0x12b')]=![];_0x2cc6d6[_0x01f3('0x2b')][_0x2cc6d6[_0x01f3('0xac')][_0x2173f1]['queue']]=[];ami[_0x01f3('0x150')]({'actionid':_0x2173f1,'action':_0x01f3('0x1f5'),'queue':_0x3ba2a6[_0x01f3('0x44')]})['catch'](function(){_0x2cc6d6['updateOriginated'](_0x3ba2a6);_0x2cc6d6[_0x01f3('0xc0')]({'active':![],'ContactId':_0x2cc6d6[_0x01f3('0xac')][_0x2173f1][_0x01f3('0xd3')],'ListId':_0x2cc6d6[_0x01f3('0xac')][_0x2173f1]['ListId'],'VoiceQueueId':_0x2cc6d6[_0x01f3('0xac')][_0x2173f1][_0x01f3('0xd5')]||undefined,'CampaignId':_0x2cc6d6[_0x01f3('0xac')][_0x2173f1][_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1f6')));delete _0x2cc6d6['actions'][_0x2173f1];});}else{loggerBooked[_0x01f3('0x7b')]('[booked][checkContactBlack][else]',JSON[_0x01f3('0x4f')](_0x3ba2a6[_0x01f3('0x12b')]),_0x01f3('0x1f7'),_0x3ba2a6[_0x01f3('0x44')]);_0x2cc6d6[_0x01f3('0xb3')](_0x3ba2a6);_0x2cc6d6['rescheduleContact']({'active':![],'ContactId':_0x2cc6d6[_0x01f3('0xac')][_0x2173f1][_0x01f3('0xd3')],'ListId':_0x2cc6d6[_0x01f3('0xac')][_0x2173f1][_0x01f3('0xd4')],'VoiceQueueId':_0x2cc6d6[_0x01f3('0xac')][_0x2173f1][_0x01f3('0xd5')]||undefined,'CampaignId':_0x2cc6d6[_0x01f3('0xac')][_0x2173f1]['CampaignId']||undefined})[_0x01f3('0xb8')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2cc6d6['actions'][_0x2173f1];}}else{return _0x2cc6d6['actionOriginate'](_0x3ba2a6,_0x4c486a);}}else{if(getDiff(_0x4c486a[_0x01f3('0x1f8')])<_0x3ba2a6[_0x01f3('0x1f9')]*0x3c){if(_0x4c486a[_0x01f3('0x160')]&&!_0x4c486a[_0x01f3('0x160')][_0x01f3('0x1fa')]){_0x2cc6d6[_0x01f3('0x21')][_0x01f3('0x12e')](_0x4c486a['id'])[_0x01f3('0x1f')](function(){_0x2cc6d6[_0x01f3('0xb3')](_0x3ba2a6);});}else{_0x2cc6d6[_0x01f3('0x1fb')]({'active':![]},_0x4c486a['id'],0x1)[_0x01f3('0x1f')](function(){_0x2cc6d6[_0x01f3('0xb3')](_0x3ba2a6);});}}else{_0x3ba2a6[_0x01f3('0x1fc')]+=0x1;_0x2cc6d6[_0x01f3('0xb3')](_0x3ba2a6);if(_0x3ba2a6[_0x01f3('0x1fd')]){_0x2cc6d6[_0x01f3('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4c486a[_0x01f3('0xd3')],'ListId':_0x4c486a['ListId'],'VoiceQueueId':_0x4c486a[_0x01f3('0xd5')]||undefined,'CampaignId':_0x4c486a[_0x01f3('0xd6')]||undefined})[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x1fe')));_0x2cc6d6['createHistory'](createObjHistory(_0x3ba2a6,_0x4c486a,'RECALLINQUEUE',0x17,_0x01f3('0x1ff')))[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x200')));}else{_0x2cc6d6[_0x01f3('0xd1')](createObjHistory(_0x3ba2a6,_0x4c486a,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),_0x01f3('0x201'),_0x01f3('0x202'));}}}}else{_0x3ba2a6['outboundBlacklistCallsDay']+=0x1;_0x2cc6d6[_0x01f3('0xd1')](createObjHistory(_0x3ba2a6,_0x4c486a,_0x01f3('0x203'),0xd,_0x01f3('0x204')),'[Originate][historyBlacklist]',_0x01f3('0x205'));throw _0x01f3('0x206');}};};Dialer['prototype'][_0x01f3('0x161')]=function(_0x4b67ab){var _0x43fce6=this;var _0x100402=_0x4b67ab[_0x01f3('0x207')]-_0x4b67ab[_0x01f3('0x99')]-_0x4b67ab['temp'];emitCampaignSummary(_0x4b67ab);if(_0x100402>0x0){if(_0x100402>this[_0x01f3('0x25')]){_0x100402=this[_0x01f3('0x25')];}_0x4b67ab[_0x01f3('0xc3')]+=_0x100402;this[_0x01f3('0xc5')](_0x4b67ab['id'],_0x100402,_0x4b67ab[_0x01f3('0x208')],_0x4b67ab)[_0x01f3('0x3f')](function(_0x422ac6){_0x4b67ab[_0x01f3('0xc3')]-=_0x100402;_0x4b67ab[_0x01f3('0xc3')]=_0x4b67ab[_0x01f3('0xc3')]>0x0?_0x4b67ab[_0x01f3('0xc3')]:0x0;if(!checkContactEmpty(_0x422ac6)){_0x4b67ab[_0x01f3('0x42')]=_0x01f3('0xa0');logger['info'](_0x01f3('0x209')+_0x4b67ab['name']);}else{_0x4b67ab[_0x01f3('0x99')]+=_0x422ac6['length'];_0x4b67ab[_0x01f3('0x42')]=_0x01f3('0x20a');for(var _0x1a9d20=0x0;_0x1a9d20<_0x422ac6[_0x01f3('0x131')];_0x1a9d20+=0x1){_0x4b67ab[_0x01f3('0x20b')]+=0x1;if(_[_0x01f3('0xdf')](_0x422ac6[_0x1a9d20])||_[_0x01f3('0xdf')](_0x422ac6[_0x1a9d20][_0x01f3('0x16e')])||_[_0x01f3('0xdf')](_0x422ac6[_0x1a9d20][_0x01f3('0x16e')][_0x01f3('0x16f')])){_0x43fce6[_0x01f3('0xcf')](_0x01f3('0x20c'),_0x4b67ab,_0x422ac6[_0x1a9d20]);}else{_0x43fce6[_0x01f3('0xbb')](_['pick'](_0x422ac6[_0x1a9d20],[_0x01f3('0xd6'),_0x01f3('0x20d')]))['then'](_0x43fce6[_0x01f3('0x20e')](_0x4b67ab,_0x422ac6[_0x1a9d20]))['catch'](_0x43fce6[_0x01f3('0xce')]('[actionOriginateIvr]\x20',_0x4b67ab));}}}})[_0x01f3('0xb8')](loggerGetContactDialer(_0x01f3('0x20f'),_0x4b67ab,_0x100402));}};Dialer[_0x01f3('0x1d')][_0x01f3('0x15b')]=function(_0x2f3552,_0x1f9cea){var _0x72ef56=this;var _0x4a3f26=[];var _0x189cc0=_0x1f9cea>=0x1?_0x1f9cea:0x1;if(_0x2f3552['dialMethod']===_0x01f3('0x9')){_0x189cc0=0x1;}var _0x43989d=Math[_0x01f3('0x1d2')](_0x2f3552[_0x01f3('0x56')]*_0x189cc0)-_0x2f3552[_0x01f3('0x99')]-_0x2f3552[_0x01f3('0xc3')];emitVoiceQueueSummary(_0x2f3552);if(_0x2f3552[_0x01f3('0x210')]>0x0){var _0x16730c=_0x2f3552[_0x01f3('0x210')]-_0x2f3552['originated']-_0x2f3552['talking']-_0x2f3552[_0x01f3('0xc3')]-_0x2f3552[_0x01f3('0x58')];if(_0x43989d>_0x16730c){_0x43989d=_0x16730c;}}if(_0x43989d>0x0){if(_0x2f3552[_0x01f3('0x62')]==='booked'){_0x43989d=0x1;}if(_0x43989d>this[_0x01f3('0x25')]){_0x43989d=this['maxNumberOriginate'];}_0x2f3552['temp']+=_0x43989d;for(var _0x254eb8 in this[_0x01f3('0x23')]){if(typeof this[_0x01f3('0x23')][_0x254eb8]!==_0x01f3('0xad')){if(this[_0x01f3('0x23')][_0x254eb8]['state']===_0x01f3('0x211')&&this[_0x01f3('0x23')][_0x254eb8][_0x01f3('0xdc')]==='reachable'){_0x4a3f26[_0x01f3('0x12a')](this[_0x01f3('0x23')][_0x254eb8]['id']);}}}this[_0x01f3('0xc2')](_0x2f3552['id'],_0x4a3f26,_0x43989d,_0x2f3552[_0x01f3('0x208')],_0x2f3552)[_0x01f3('0x3f')](function(_0x270d3f){_0x2f3552[_0x01f3('0xc3')]-=_0x43989d;_0x2f3552['temp']=_0x2f3552[_0x01f3('0xc3')]>0x0?_0x2f3552['temp']:0x0;if(!checkContactEmpty(_0x270d3f)){_0x72ef56[_0x01f3('0xb6')](_0x2f3552)[_0x01f3('0x3f')](sendMessageReschedule(_0x2f3552))[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x212')));}else{_0x2f3552[_0x01f3('0x99')]+=_0x270d3f[_0x01f3('0x131')];_0x2f3552[_0x01f3('0x42')]=_0x2f3552[_0x01f3('0x62')]===_0x01f3('0x9')?_0x01f3('0x176'):_0x01f3('0x20a');for(var _0x3dc309=0x0;_0x3dc309<_0x270d3f[_0x01f3('0x131')];_0x3dc309+=0x1){if(_[_0x01f3('0xdf')](_0x270d3f[_0x3dc309])||_[_0x01f3('0xdf')](_0x270d3f[_0x3dc309]['Contact'])||_[_0x01f3('0xdf')](_0x270d3f[_0x3dc309][_0x01f3('0x16e')][_0x01f3('0x16f')])){_0x72ef56['emptyContact'](_0x01f3('0x20c'),_0x2f3552,_0x270d3f[_0x3dc309]);}else{_0x72ef56['checkIsBlackList'](_[_0x01f3('0xd2')](_0x270d3f[_0x3dc309],[_0x01f3('0xd5'),_0x01f3('0x20d')]))[_0x01f3('0x3f')](_0x72ef56[_0x01f3('0x20e')](_0x2f3552,_0x270d3f[_0x3dc309]))['catch'](_0x72ef56[_0x01f3('0xce')]('[actionOriginate]\x20',_0x2f3552));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x2f3552,_0x43989d));}};Dialer[_0x01f3('0x1d')][_0x01f3('0x92')]=function(_0x1bc942){if(_0x1bc942[_0x01f3('0x210')]>0x0){var _0x2f81bd=_0x1bc942[_0x01f3('0x210')]-_0x1bc942[_0x01f3('0x99')]-_0x1bc942[_0x01f3('0x5b')];if(_0x2f81bd>0x0){this[_0x01f3('0x213')](_0x1bc942);}else{loggerPredictiveCalls[_0x01f3('0x7b')](_0x01f3('0x214'));}}else{this[_0x01f3('0x213')](_0x1bc942);}};Dialer[_0x01f3('0x1d')]['tryOriginatePredictive']=function(_0x3f9989){var _0x4398ea=this;var _0x300992=[];_0x3f9989[_0x01f3('0x99')]+=0x1;for(var _0x5579a2 in this['agents']){if(typeof this['agents'][_0x5579a2]!==_0x01f3('0xad')){if(this[_0x01f3('0x23')][_0x5579a2][_0x01f3('0xe6')]===_0x01f3('0x211')&&this[_0x01f3('0x23')][_0x5579a2][_0x01f3('0xdc')]===_0x01f3('0x215')){_0x300992['push'](this[_0x01f3('0x23')][_0x5579a2]['id']);}}}this[_0x01f3('0xc2')](_0x3f9989['id'],_0x300992,0x1,_0x3f9989[_0x01f3('0x208')],_0x3f9989)[_0x01f3('0x3f')](function(_0x382510){if(!checkContactEmpty(_0x382510)){checkContactLowerLimitOriginate(_0x3f9989,0x1,0x0);_0x4398ea[_0x01f3('0xb6')](_0x3f9989)['then'](sendMessageReschedule(_0x3f9989))[_0x01f3('0xb8')](loggerCatch(_0x01f3('0x212')));}else{_0x3f9989[_0x01f3('0x42')]=_0x01f3('0x20a');if(_[_0x01f3('0xdf')](_0x382510[0x0])||_[_0x01f3('0xdf')](_0x382510[0x0][_0x01f3('0x16e')])||_[_0x01f3('0xdf')](_0x382510[0x0][_0x01f3('0x16e')]['phone'])){_0x4398ea[_0x01f3('0xcf')](_0x01f3('0x20c'),_0x3f9989,_0x382510[0x0]);}else{_0x4398ea[_0x01f3('0xb9')](_[_0x01f3('0xd2')](_0x382510[0x0],[_0x01f3('0xd5'),_0x01f3('0x20d')]))[_0x01f3('0x3f')](_0x4398ea[_0x01f3('0x20e')](_0x3f9989,_0x382510[0x0]))['catch'](_0x4398ea[_0x01f3('0xce')]('[actionOriginatePredictive]\x20',_0x3f9989));}}})[_0x01f3('0xb8')](loggerGetContactDialer(_0x01f3('0x216'),_0x3f9989,0x1));emitVoiceQueueSummary(_0x3f9989);};Dialer['prototype'][_0x01f3('0x1e6')]=function(_0x3ba112,_0x3d7349,_0x2d7e1f,_0x793c8b,_0xe30ede,_0x3dfd09){loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x217'));loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x218'),_0x3ba112);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x219'),_0x3d7349);loggerPredictive[_0x01f3('0x7b')]('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',_0x2d7e1f);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x21a'),_0x793c8b);loggerPredictive['info'](_0x01f3('0x21b'),_0xe30ede);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x84'));return new BPromise(function(_0x2975b9,_0x13ccc1){if(_0x3ba112<=0x0||isNaN(_0x3ba112)){return _0x13ccc1(msgResponse(_0x01f3('0x21c'),_0x01f3('0x4e'),'m\x20=\x20'+_0x3ba112));}if(_0x2d7e1f<=0x0||isNaN(_0x2d7e1f)){return _0x13ccc1(msgResponse(_0x01f3('0x21c'),_0x01f3('0x4e'),_0x01f3('0x21d')+_0x2d7e1f));}if(_0x793c8b<=0x0||isNaN(_0x793c8b)){return _0x13ccc1(msgResponse(_0x01f3('0x21c'),_0x01f3('0x4e'),_0x01f3('0x21e')+_0x793c8b));}if(_0x3d7349<=0x0||isNaN(_0x3d7349)){return _0x13ccc1(msgResponse(_0x01f3('0x21c'),_0x01f3('0x4e'),_0x01f3('0x21f')+_0x3d7349));}if(_0xe30ede<=0x0||isNaN(_0xe30ede)){return _0x13ccc1(msgResponse(_0x01f3('0x21c'),_0x01f3('0x4e'),_0x01f3('0x220')+_0xe30ede));}_0x3dfd09=_0x3dfd09||0x0;var _0x948e70=0x1/_0x2d7e1f;var _0x9d24b4=0x0;var _0x18c4e9=0x0;var _0x493da2=0x0;var _0x52e653=0x0;for(var _0x7c459c=0x0;_0x493da2<_0xe30ede;_0x7c459c+=0x1){_0x18c4e9=_0x7c459c/_0x3d7349;_0x9d24b4=(_0x793c8b*_0x18c4e9+_0x3dfd09)/_0x948e70;_0x493da2=erlangb(_0x9d24b4,_0x3ba112);_0x52e653=_0x9d24b4/_0x3ba112*(0x1-erlangb(_0x9d24b4,_0x3ba112));}return _0x2975b9({'erlangCalls':_0x7c459c,'erlangCallToSecond':_0x3d7349/_0x7c459c,'erlangAbandonmentRate':_0x493da2,'erlangBusyFactor':_0x52e653});});};Dialer[_0x01f3('0x1d')][_0x01f3('0x1ef')]=function(_0x162bf8,_0x4c89df,_0x58a5d0,_0x139aa8,_0xf9a1b8,_0x1e5eb1){loggerPredictive[_0x01f3('0x7b')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x218'),_0x162bf8);loggerPredictive[_0x01f3('0x7b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c89df);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x221'),_0x58a5d0);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x21a'),_0x139aa8);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x222'),_0xf9a1b8);loggerPredictive[_0x01f3('0x7b')](_0x01f3('0x84'));return new BPromise(function(_0x290cb8,_0x4b47c7){if(_0x162bf8<=0x0||isNaN(_0x162bf8)){return _0x4b47c7(msgResponse(_0x01f3('0x223'),_0x01f3('0x4e'),_0x01f3('0x224')+_0x162bf8));}if(_0x58a5d0<=0x0||isNaN(_0x58a5d0)){return _0x4b47c7(msgResponse(_0x01f3('0x223'),'Error',_0x01f3('0x21d')+_0x58a5d0));}if(_0x139aa8<=0x0||isNaN(_0x139aa8)){return _0x4b47c7(msgResponse(_0x01f3('0x223'),_0x01f3('0x4e'),'p\x20=\x20'+_0x139aa8));}if(_0x4c89df<=0x0||isNaN(_0x4c89df)){return _0x4b47c7(msgResponse(_0x01f3('0x223'),_0x01f3('0x4e'),_0x01f3('0x21f')+_0x4c89df));}if(_0xf9a1b8<=0x0||isNaN(_0xf9a1b8)){return _0x4b47c7(msgResponse(_0x01f3('0x223'),_0x01f3('0x4e'),_0x01f3('0x225')+_0xf9a1b8));}_0x1e5eb1=_0x1e5eb1||0x0;var _0x5b5ff5=0x1/_0x58a5d0;var _0x3dda8b=0x0;var _0x26dccf=0x0;var _0x20d7d2=0x0;var _0x446b91=0x0;for(var _0x5c5801=0x0;_0x446b91<_0xf9a1b8;_0x5c5801+=0x1){_0x26dccf=_0x5c5801/_0x4c89df;_0x3dda8b=(_0x139aa8*_0x26dccf+_0x1e5eb1)/_0x5b5ff5;_0x20d7d2=erlangb(_0x3dda8b,_0x162bf8);_0x446b91=_0x3dda8b/_0x162bf8*(0x1-erlangb(_0x3dda8b,_0x162bf8));}return _0x290cb8({'erlangCalls':_0x5c5801,'erlangCallToSecond':_0x4c89df/_0x5c5801,'erlangAbandonmentRate':_0x20d7d2,'erlangBusyFactor':_0x446b91});});};module[_0x01f3('0x226')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index ad357a9..3577374 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa413=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','droptime','talktime','queue','reason','callback'];(function(_0x12592d,_0xd6f9e2){var _0x11219c=function(_0x1374af){while(--_0x1374af){_0x12592d['push'](_0x12592d['shift']());}};_0x11219c(++_0xd6f9e2);}(_0xa413,0x184));var _0x3a41=function(_0x57f0e5,_0x40efbe){_0x57f0e5=_0x57f0e5-0x0;var _0x489c51=_0xa413[_0x57f0e5];return _0x489c51;};'use strict';var util=require(_0x3a41('0x0'));var _=require(_0x3a41('0x1'));var moment=require(_0x3a41('0x2'));function getSeconds(_0x54ef90,_0x72782){var _0x2d0aff=moment(_0x54ef90)['milliseconds'](0x0);var _0x1fe7d2=moment(_0x72782)[_0x3a41('0x3')](0x0);return _0x2d0aff[_0x3a41('0x4')](_0x1fe7d2,_0x3a41('0x5'));}function QueueCallerAbandon(_0x1333f2,_0x4123a6){this[_0x3a41('0x6')]=_0x1333f2[_0x3a41('0x6')];this['type']=_0x1333f2[_0x3a41('0x7')];this[_0x3a41('0x8')]=_0x1333f2[_0x3a41('0x7')]===_0x3a41('0x9')?'queue':_0x1333f2[_0x3a41('0x7')];this[_0x3a41('0xa')]=_0x1333f2[_0x3a41('0xa')];this[_0x3a41('0xb')]=_0x1333f2[_0x3a41('0xb')];this[_0x3a41('0xc')]=_0x1333f2[_0x3a41('0xc')];this[_0x3a41('0xd')]=_0x1333f2[_0x3a41('0xa')]+_0x1333f2[_0x3a41('0xb')]+_0x1333f2['countnoanswerretry']+_0x1333f2[_0x3a41('0xe')]+_0x1333f2['countdropretry']+_0x1333f2[_0x3a41('0xf')]+_0x1333f2[_0x3a41('0x10')]+_0x1333f2[_0x3a41('0x11')];this[_0x3a41('0xe')]=_0x1333f2[_0x3a41('0xe')];this[_0x3a41('0x12')]=_0x1333f2[_0x3a41('0x12')];this[_0x3a41('0xf')]=_0x1333f2[_0x3a41('0xf')];this[_0x3a41('0x10')]=_0x1333f2[_0x3a41('0x10')];this['countagentrejectretry']=_0x1333f2[_0x3a41('0x11')];this['uniqueid']=_0x4123a6[_0x3a41('0x13')];this[_0x3a41('0x14')]=_0x1333f2[_0x3a41('0x15')];this[_0x3a41('0x16')]=_0x1333f2[_0x3a41('0x17')];this['starttime']=_0x1333f2[_0x3a41('0x18')];this['responsetime']=_0x1333f2[_0x3a41('0x19')];this['droptime']=_0x1333f2['droptime'];this[_0x3a41('0x1a')]=this[_0x3a41('0x1b')];this['ringtime']=getSeconds(_0x1333f2[_0x3a41('0x19')],_0x1333f2['starttime']);this['holdtime']=getSeconds(this[_0x3a41('0x1b')],_0x1333f2[_0x3a41('0x19')]);this[_0x3a41('0x1c')]=0x0;this[_0x3a41('0x1d')]=_0x4123a6[_0x3a41('0x1d')];this['membername']=_0x4123a6['connectedlinename'];this['reason']=_0x4123a6[_0x3a41('0x1e')];this[_0x3a41('0x1f')]=_0x1333f2['callback'];this[_0x3a41('0x20')]=_0x1333f2[_0x3a41('0x20')];this['callbackat']=_0x1333f2[_0x3a41('0x21')];this[_0x3a41('0x22')]=_0x1333f2['recallme'];this[_0x3a41('0x23')]=_0x1333f2[_0x3a41('0x23')];this[_0x3a41('0x24')]=_0x1333f2[_0x3a41('0x24')];this[_0x3a41('0x25')]=_0x1333f2[_0x3a41('0x25')];this[_0x3a41('0x26')]=_0x1333f2[_0x3a41('0x26')];this['CampaignId']=_0x1333f2[_0x3a41('0x27')];this[_0x3a41('0x28')]=_0x1333f2[_0x3a41('0x28')]||'';this[_0x3a41('0x29')]=_0x1333f2[_0x3a41('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x1930=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','droptime','ringtime','holdtime','responsetime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1930,0xcc));var _0x0193=function(_0x682919,_0xf05f18){_0x682919=_0x682919-0x0;var _0x3d859a=_0x1930[_0x682919];return _0x3d859a;};'use strict';var util=require('util');var _=require(_0x0193('0x0'));var moment=require(_0x0193('0x1'));function getSeconds(_0x196f0a,_0x40a2e7){var _0x3188b0=moment(_0x196f0a)[_0x0193('0x2')](0x0);var _0x7b4c5b=moment(_0x40a2e7)[_0x0193('0x2')](0x0);return _0x3188b0[_0x0193('0x3')](_0x7b4c5b,_0x0193('0x4'));}function QueueCallerAbandon(_0x5c7c7d,_0x5daa7d){this[_0x0193('0x5')]=_0x5c7c7d[_0x0193('0x5')];this['type']=_0x5c7c7d[_0x0193('0x6')];this['campaigntype']=_0x5c7c7d[_0x0193('0x6')]===_0x0193('0x7')?_0x0193('0x8'):_0x5c7c7d[_0x0193('0x6')];this[_0x0193('0x9')]=_0x5c7c7d['countbusyretry'];this['countcongestionretry']=_0x5c7c7d['countcongestionretry'];this[_0x0193('0xa')]=_0x5c7c7d[_0x0193('0xa')];this[_0x0193('0xb')]=_0x5c7c7d[_0x0193('0x9')]+_0x5c7c7d['countcongestionretry']+_0x5c7c7d[_0x0193('0xa')]+_0x5c7c7d[_0x0193('0xc')]+_0x5c7c7d[_0x0193('0xd')]+_0x5c7c7d[_0x0193('0xe')]+_0x5c7c7d[_0x0193('0xf')]+_0x5c7c7d[_0x0193('0x10')];this[_0x0193('0xc')]=_0x5c7c7d[_0x0193('0xc')];this[_0x0193('0xd')]=_0x5c7c7d[_0x0193('0xd')];this[_0x0193('0xe')]=_0x5c7c7d[_0x0193('0xe')];this[_0x0193('0xf')]=_0x5c7c7d[_0x0193('0xf')];this[_0x0193('0x10')]=_0x5c7c7d['countagentrejectretry'];this[_0x0193('0x11')]=_0x5daa7d[_0x0193('0x11')];this[_0x0193('0x12')]=_0x5c7c7d[_0x0193('0x13')];this[_0x0193('0x14')]=_0x5c7c7d[_0x0193('0x15')];this['starttime']=_0x5c7c7d[_0x0193('0x16')];this['responsetime']=_0x5c7c7d['responsetime'];this['droptime']=_0x5c7c7d[_0x0193('0x17')];this['endtime']=this[_0x0193('0x17')];this[_0x0193('0x18')]=getSeconds(_0x5c7c7d['responsetime'],_0x5c7c7d[_0x0193('0x16')]);this[_0x0193('0x19')]=getSeconds(this['droptime'],_0x5c7c7d[_0x0193('0x1a')]);this[_0x0193('0x1b')]=0x0;this[_0x0193('0x8')]=_0x5daa7d['queue'];this[_0x0193('0x1c')]=_0x5daa7d[_0x0193('0x1d')];this[_0x0193('0x1e')]=_0x5daa7d[_0x0193('0x1e')];this[_0x0193('0x1f')]=_0x5c7c7d[_0x0193('0x1f')];this[_0x0193('0x20')]=_0x5c7c7d[_0x0193('0x20')];this[_0x0193('0x21')]=_0x5c7c7d[_0x0193('0x21')];this[_0x0193('0x22')]=_0x5c7c7d[_0x0193('0x22')];this[_0x0193('0x23')]=_0x5c7c7d[_0x0193('0x23')];this[_0x0193('0x24')]=_0x5c7c7d['ListId'];this['UserId']=_0x5c7c7d[_0x0193('0x25')];this[_0x0193('0x26')]=_0x5c7c7d[_0x0193('0x26')];this[_0x0193('0x27')]=_0x5c7c7d['CampaignId'];this[_0x0193('0x28')]=_0x5c7c7d[_0x0193('0x28')]||'';this['originatecalleridname']=_0x5c7c7d[_0x0193('0x29')]||'';}module[_0x0193('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 402272e..d5082bf 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(_0x37ba3b,_0x9d415b){var _0x2368a5=function(_0x30dcda){while(--_0x30dcda){_0x37ba3b['push'](_0x37ba3b['shift']());}};_0x2368a5(++_0x9d415b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x4b1f07,_0x141ecd){var _0x5698cf=function(_0x342883){while(--_0x342883){_0x4b1f07['push'](_0x4b1f07['shift']());}};_0x5698cf(++_0x141ecd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 d55b549..2813485 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 _0x4024=['Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','tiff2pdf','../../../config/logger','fax','./channel','./util/util','./action','../rpc/attachment','channels','trunks','actions','syncNewchannel','varset','syncVarSet','newstate','syncNewState','bind','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','faxAccounts','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','Fax\x20failed','checkTrunk','Trunk','isValid','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','dir','XMF-PATH'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0x4024,0x89));var _0x4402=function(_0x58bf75,_0x296b1c){_0x58bf75=_0x58bf75-0x0;var _0x4f8cb7=_0x4024[_0x58bf75];return _0x4f8cb7;};'use strict';var util=require(_0x4402('0x0'));var _=require(_0x4402('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var path=require('path');var tiff2pdf=require(_0x4402('0x4'));var gs=require('./util/gs');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x4402('0x7'));var ut=require(_0x4402('0x8'));var Action=require(_0x4402('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x4402('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5c0b70){this[_0x4402('0xb')]={};this['faxAccounts']=_0x5c0b70['faxAccounts'];this[_0x4402('0xc')]=_0x5c0b70['trunks'];this[_0x4402('0xd')]={};ami['on']('newchannel',this[_0x4402('0xe')]['bind'](this));ami['on'](_0x4402('0xf'),this[_0x4402('0x10')]['bind'](this));ami['on'](_0x4402('0x11'),this[_0x4402('0x12')][_0x4402('0x13')](this));ami['on']('newexten',this[_0x4402('0x14')][_0x4402('0x13')](this));ami['on'](_0x4402('0x15'),this[_0x4402('0x16')][_0x4402('0x13')](this));ami['on'](_0x4402('0x17'),this[_0x4402('0x18')][_0x4402('0x13')](this));ami['on'](_0x4402('0x19'),this[_0x4402('0x1a')][_0x4402('0x13')](this));ami['on'](_0x4402('0x1b'),this[_0x4402('0x1c')][_0x4402('0x13')](this));}Fax[_0x4402('0x1d')][_0x4402('0xe')]=function(_0x399c24){if(_0x399c24[_0x4402('0x1e')]===_0x4402('0x1f')){for(var _0x231382 in this['faxAccounts']){if(this['faxAccounts'][_0x4402('0x20')](_0x231382)){if(_0x399c24[_0x4402('0x21')]===this['faxAccounts'][_0x231382][_0x4402('0x22')]){this[_0x4402('0xb')][_0x399c24['uniqueid']]={};this[_0x4402('0xb')][_0x399c24['uniqueid']]['channel']=_0x399c24[_0x4402('0x23')];this[_0x4402('0xb')][_0x399c24[_0x4402('0x24')]]['id']=this['faxAccounts'][_0x231382]['id'];this[_0x4402('0xb')][_0x399c24['uniqueid']]['name']=this[_0x4402('0x25')][_0x231382][_0x4402('0x26')];logger[_0x4402('0x27')](_0x399c24[_0x4402('0x24')],_0x4402('0x28'));}}}}if(this[_0x4402('0xd')][_0x399c24[_0x4402('0x24')]]){this[_0x4402('0xb')][_0x399c24[_0x4402('0x24')]]={};this['channels'][_0x399c24[_0x4402('0x24')]]['channel']=_0x399c24[_0x4402('0x23')];logger[_0x4402('0x27')](_0x399c24[_0x4402('0x24')],_0x4402('0x28'));}};Fax['prototype'][_0x4402('0x10')]=function(_0x4e9cb5){if(this['channels'][_0x4e9cb5[_0x4402('0x24')]]){for(var _0x395e49 in _0x4e9cb5[_0x4402('0x29')]){if(_0x4e9cb5[_0x4402('0x29')][_0x4402('0x20')](_0x395e49)){this['channels'][_0x4e9cb5[_0x4402('0x24')]][_0x395e49]=_0x4e9cb5['value'];}}}};Fax[_0x4402('0x1d')][_0x4402('0x12')]=function(_0x42dd32){if(this['channels'][_0x42dd32[_0x4402('0x24')]]){this[_0x4402('0xb')][_0x42dd32[_0x4402('0x24')]][_0x4402('0x2a')]=_0x42dd32[_0x4402('0x2a')];this[_0x4402('0xb')][_0x42dd32[_0x4402('0x24')]][_0x4402('0x2b')]=_0x42dd32[_0x4402('0x2b')];}};Fax[_0x4402('0x1d')][_0x4402('0x14')]=function(_0x50748c){if(this[_0x4402('0xb')][_0x50748c['uniqueid']]){for(var _0x336168 in _0x50748c['variable']){if(_0x50748c[_0x4402('0x29')][_0x4402('0x20')](_0x336168)){this[_0x4402('0xb')][_0x50748c[_0x4402('0x24')]][_0x336168]=_0x50748c[_0x4402('0x2c')];}}}};Fax['prototype'][_0x4402('0x16')]=function(_0x3fa7ae){if(this[_0x4402('0xb')][_0x3fa7ae['uniqueid']]){this[_0x4402('0xb')][_0x3fa7ae[_0x4402('0x24')]]['operation']=_0x3fa7ae[_0x4402('0x2d')];this[_0x4402('0xb')][_0x3fa7ae[_0x4402('0x24')]][_0x4402('0x2e')]=_0x3fa7ae[_0x4402('0x2e')];this[_0x4402('0xb')][_0x3fa7ae[_0x4402('0x24')]][_0x4402('0x22')]=_0x3fa7ae[_0x4402('0x22')];this['channels'][_0x3fa7ae[_0x4402('0x24')]][_0x4402('0x2f')]=_0x3fa7ae[_0x4402('0x2f')];logger['info'](_0x3fa7ae[_0x4402('0x24')],_0x4402('0x30'));}};Fax['prototype']['syncReceiveFax']=function(_0x2b9d51){var _0x5b7c2e=this;if(this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]]){var _0x5569a2=this['channels'][_0x2b9d51['uniqueid']]['id'];this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]][_0x4402('0x31')]=_0x2b9d51[_0x4402('0x31')];this['channels'][_0x2b9d51[_0x4402('0x24')]][_0x4402('0x32')]=_0x2b9d51[_0x4402('0x32')];this['channels'][_0x2b9d51[_0x4402('0x24')]]['localstationid']=_0x2b9d51[_0x4402('0x22')];this[_0x4402('0xb')][_0x2b9d51['uniqueid']][_0x4402('0x33')]=_0x2b9d51['resolution'];this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]]['transferrate']=_0x2b9d51[_0x4402('0x34')];this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]][_0x4402('0x2f')]=_0x2b9d51['filename'];this['channels'][_0x2b9d51[_0x4402('0x24')]]['calleridnum']=_0x2b9d51[_0x4402('0x35')];if(this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]][_0x4402('0x32')]>0x0){tiff2pdf(_0x2b9d51[_0x4402('0x2f')],_0x4402('0x36'),function(_0x173040){logger[_0x4402('0x27')](_0x2b9d51[_0x4402('0x24')],_0x4402('0x37'),_0x173040['message']);attachment[_0x4402('0x38')]({'name':path[_0x4402('0x39')](_0x2b9d51['filename'])[_0x4402('0x26')],'basename':path[_0x4402('0x39')](_0x2b9d51['filename'])[_0x4402('0x26')]+_0x4402('0x3a'),'type':_0x4402('0x3b')})[_0x4402('0x3c')](function(_0x13a3a4){faxAccount['notify'](_0x5569a2,{'from':_0x2b9d51[_0x4402('0x35')],'mapKey':_0x4402('0x6'),'body':path[_0x4402('0x39')](_0x2b9d51[_0x4402('0x2f')])[_0x4402('0x26')]+_0x4402('0x3a'),'AttachmentId':_0x13a3a4['id']})[_0x4402('0x3d')](function(_0x136c9c){logger[_0x4402('0x3e')](_0x2b9d51[_0x4402('0x24')],_0x4402('0x3f'),JSON['stringify'](_0x136c9c));});})[_0x4402('0x3d')](function(_0x4ff240){logger[_0x4402('0x3e')](_0x2b9d51[_0x4402('0x24')],'\x20receiveFax\x20',JSON[_0x4402('0x40')](_0x4ff240));});});}logger[_0x4402('0x27')](_0x2b9d51[_0x4402('0x24')],_0x4402('0x41'));}};Fax[_0x4402('0x1d')][_0x4402('0x1c')]=function(_0x5b094b){if(this[_0x4402('0xd')][_0x5b094b[_0x4402('0x24')]]){_[_0x4402('0x42')](this[_0x4402('0xb')][_0x5b094b[_0x4402('0x24')]],_[_0x4402('0x43')](_0x5b094b,[_0x4402('0x44'),_0x4402('0x45')]));}};function updateStatus(_0x216488){if(_0x216488['AttachmentId']){faxMessage['update'](_0x216488['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x4402('0x3c')](function(_0x29e67b){ut[_0x4402('0x46')](_0x4402('0x47'),_0x29e67b);})['catch'](function(_0x169bb2){ut[_0x4402('0x46')](_0x4402('0x48'),_0x169bb2);});}else{ut[_0x4402('0x46')](_0x4402('0x49'));}}Fax[_0x4402('0x1d')][_0x4402('0x4a')]=function(_0x53d306,_0x325b20,_0x2a8085){var _0x38e6d1=this;var _0x11c162={};if(_0x325b20){_0x11c162={'read':_0x325b20};}else{_0x11c162={'failMessage':_0x2a8085};}if(this[_0x4402('0xd')][_0x53d306][_0x4402('0x4b')]){faxMessage['update'](this[_0x4402('0xd')][_0x53d306][_0x4402('0x4b')],_0x11c162)[_0x4402('0x3c')](function(_0x295c9b){ut[_0x4402('0x46')](_0x4402('0x4c'),_0x295c9b);})[_0x4402('0x3d')](function(_0x5dbf62){ut['logger'](_0x4402('0x4d'),_0x5dbf62);})[_0x4402('0x4e')](function(){delete _0x38e6d1[_0x4402('0xb')][_0x53d306];delete _0x38e6d1['actions'][_0x53d306];});}else{ut['logger'](_0x4402('0x4f'));delete this[_0x4402('0xb')][_0x53d306];delete this[_0x4402('0xd')][_0x53d306];}};Fax[_0x4402('0x1d')][_0x4402('0x1a')]=function(_0x37ba14){var _0x248104=this;if(this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]]){if(this[_0x4402('0xd')][_0x37ba14[_0x4402('0x24')]]){this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]]['id']=this['actions'][_0x37ba14[_0x4402('0x24')]]['id'];this['channels'][_0x37ba14[_0x4402('0x24')]]['name']=this[_0x4402('0xd')][_0x37ba14[_0x4402('0x24')]][_0x4402('0x26')];}logger[_0x4402('0x27')](_0x37ba14[_0x4402('0x24')],this[_0x4402('0xd')][_0x37ba14['uniqueid']]?_0x4402('0x50'):_0x4402('0x51'),JSON[_0x4402('0x40')](this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]]));if(this['actions'][_0x37ba14[_0x4402('0x24')]]){if(this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]][_0x4402('0x52')]>0x0&&this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]][_0x4402('0x15')]===_0x4402('0x53')){this['updateStatus'](_0x37ba14[_0x4402('0x24')],!![]);}else{this[_0x4402('0x4a')](_0x37ba14['uniqueid'],![],this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]][_0x4402('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x4402('0x1d')][_0x4402('0x55')]=function(_0x30e49b){var _0x55f261=this;return new BPromise(function(_0x2fe275,_0x41a2c6){_0x55f261[_0x4402('0x56')](_0x30e49b,_0x55f261['faxAccounts'][_0x30e49b[_0x4402('0x57')]])[_0x4402('0x3c')](function(_0x4f9865){ut['logger'](_0x4402('0x58'),_0x4f9865);_0x2fe275(ut['message'](_0x4402('0x59')));})[_0x4402('0x3d')](function(_0x4a83ac){ut['logger'](_0x4402('0x5a'),_0x4a83ac);updateStatus(_0x30e49b);_0x41a2c6(ut[_0x4402('0x5b')](_0x4402('0x5c')));});});};Fax[_0x4402('0x1d')]['checkAfterSend']=function(_0x1ee8a9){var _0x30e5d5=this;return new BPromise(function(_0x22ed41,_0x168095){var _0x2b2b40=_0x30e5d5[_0x4402('0x5d')](_0x30e5d5[_0x4402('0x25')][_0x1ee8a9['FaxAccountId']][_0x4402('0x5e')],_0x1ee8a9);if(_0x2b2b40[_0x4402('0x5f')]){_0x22ed41(ut['message']('Trunk\x20Reachable'));}else{_0x168095(ut[_0x4402('0x5b')](_0x2b2b40['message']));}});};function originate(_0x30569e,_0x586689,_0xc2ac06){return new BPromise(function(_0x10b89a,_0x22260b){if(_0xc2ac06){var _0x3f196a=util[_0x4402('0x60')](_0x4402('0x61'),path[_0x4402('0x39')](_0x30569e[_0x4402('0x62')])[_0x4402('0x26')],_0x30569e[_0x4402('0x62')]);gs[_0x4402('0x63')](_0x3f196a)[_0x4402('0x3c')](function(){_0x30569e[_0x4402('0x62')]=util[_0x4402('0x60')](_0x4402('0x64'),path[_0x4402('0x39')](_0x30569e['path'])[_0x4402('0x65')],path[_0x4402('0x39')](_0x30569e[_0x4402('0x62')])['name']);_0x586689[_0x4402('0x66')]=_0x30569e['path'];ut[_0x4402('0x46')](_0x4402('0x67'),'');ami[_0x4402('0x68')](ut[_0x4402('0x69')](_0x30569e,_0x586689))['then'](function(_0xac8513){_0x10b89a(_0xac8513);})['catch'](function(_0x127d47){_0x22260b(_0x127d47);});})[_0x4402('0x3d')](function(_0x24ee20){_0x22260b(_0x24ee20);});}else{ami['Action'](ut[_0x4402('0x69')](_0x30569e,_0x586689))['then'](function(_0x349ad1){_0x10b89a(_0x349ad1);})[_0x4402('0x3d')](function(_0x1be905){_0x22260b(_0x1be905);});}});}Fax[_0x4402('0x1d')][_0x4402('0x56')]=function(_0x1d0bf4,_0x19b427){var _0x2bed7c=this;return new BPromise(function(_0x438048,_0x5054f9){var _0x44d806=uuid['v4']();var _0x55a767=ut[_0x4402('0x6a')](_0x1d0bf4,_0x19b427);_0x2bed7c[_0x4402('0xd')][_0x44d806]=new Action(_0x44d806,_0x19b427,_0x1d0bf4);var _0x4734ef=_0x2bed7c[_0x4402('0xd')][_0x44d806];if(path[_0x4402('0x39')](_0x1d0bf4[_0x4402('0x62')])[_0x4402('0x6b')]==='.pdf'){originate(_0x4734ef,_0x55a767,!![])[_0x4402('0x3c')](function(_0x2a6dc1){_0x438048(_0x2a6dc1);})[_0x4402('0x3d')](function(_0x4c4845){_0x5054f9(_0x4c4845);});}else{originate(_0x4734ef,_0x55a767,![])[_0x4402('0x3c')](function(_0x59fc06){_0x438048(_0x59fc06);})[_0x4402('0x3d')](function(_0x4f3d70){_0x5054f9(_0x4f3d70);});}});};Fax[_0x4402('0x1d')][_0x4402('0x6c')]=function(_0x552962){return!_[_0x4402('0x6d')](_0x552962)&&!_['isNil'](_0x552962[_0x4402('0x26')])&&!_[_0x4402('0x6d')](_0x552962['active'])&&_0x552962[_0x4402('0x6e')]&&!_[_0x4402('0x6d')](this['trunks'][util[_0x4402('0x60')](_0x4402('0x6f'),_0x552962['name'])])&&!_[_0x4402('0x6d')](this[_0x4402('0xc')][util[_0x4402('0x60')](_0x4402('0x6f'),_0x552962[_0x4402('0x26')])][_0x4402('0x2e')])&&(this[_0x4402('0xc')][util[_0x4402('0x60')](_0x4402('0x6f'),_0x552962[_0x4402('0x26')])][_0x4402('0x2e')]===_0x4402('0x70')||this[_0x4402('0xc')][util[_0x4402('0x60')]('SIP/%s',_0x552962[_0x4402('0x26')])][_0x4402('0x2e')]==='unmonitored');};Fax[_0x4402('0x1d')]['checkTrunk']=function(_0x2c7ff5,_0x778945){if(!this[_0x4402('0x6c')](_0x2c7ff5)){ut['logger'](_0x4402('0x71'),_[_0x4402('0x6d')](_0x2c7ff5)?'':_0x2c7ff5[_0x4402('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4402('0x72')};}if(_[_0x4402('0x6d')](_0x778945[_0x4402('0x6')])){ut[_0x4402('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4402('0x40')](_0x778945));return{'isValid':![],'message':_0x4402('0x73')};}if(_[_0x4402('0x6d')](_0x778945[_0x4402('0x62')])){ut[_0x4402('0x46')](_0x4402('0x74'),JSON[_0x4402('0x40')](_0x778945));return{'isValid':![],'message':_0x4402('0x75')};}return{'isValid':!![],'message':_0x4402('0x76')};};module[_0x4402('0x77')]=Fax; \ No newline at end of file +var _0x7072=['operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','localstationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','.pdf','application/pdf','then','fax','parse','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','status','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','prototype','context','from-voip-provider','faxAccounts','hasOwnProperty','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','syncNewExten'];(function(_0x13f5a2,_0x435893){var _0x1c2719=function(_0x2e9974){while(--_0x2e9974){_0x13f5a2['push'](_0x13f5a2['shift']());}};_0x1c2719(++_0x435893);}(_0x7072,0x138));var _0x2707=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x7072[_0x279d37];return _0x530173;};'use strict';var util=require('util');var _=require(_0x2707('0x0'));var BPromise=require(_0x2707('0x1'));var uuid=require(_0x2707('0x2'));var moment=require(_0x2707('0x3'));var path=require(_0x2707('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x2707('0x5'))('fax');var ami=require(_0x2707('0x6'));var rpcDb=require(_0x2707('0x7'));var Channel=require(_0x2707('0x8'));var ut=require(_0x2707('0x9'));var Action=require(_0x2707('0xa'));var faxAccount=require(_0x2707('0xb'));var attachment=require(_0x2707('0xc'));var faxMessage=require(_0x2707('0xd'));function Fax(_0x4062b6){this[_0x2707('0xe')]={};this['faxAccounts']=_0x4062b6['faxAccounts'];this[_0x2707('0xf')]=_0x4062b6[_0x2707('0xf')];this[_0x2707('0x10')]={};ami['on'](_0x2707('0x11'),this[_0x2707('0x12')][_0x2707('0x13')](this));ami['on'](_0x2707('0x14'),this[_0x2707('0x15')][_0x2707('0x13')](this));ami['on'](_0x2707('0x16'),this[_0x2707('0x17')][_0x2707('0x13')](this));ami['on'](_0x2707('0x18'),this['syncNewExten'][_0x2707('0x13')](this));ami['on']('faxstatus',this[_0x2707('0x19')][_0x2707('0x13')](this));ami['on'](_0x2707('0x1a'),this[_0x2707('0x1b')][_0x2707('0x13')](this));ami['on']('hangup',this[_0x2707('0x1c')][_0x2707('0x13')](this));ami['on'](_0x2707('0x1d'),this['syncOriginateResponse'][_0x2707('0x13')](this));}Fax[_0x2707('0x1e')][_0x2707('0x12')]=function(_0x80dfc6){if(_0x80dfc6[_0x2707('0x1f')]===_0x2707('0x20')){for(var _0x4a8b7f in this[_0x2707('0x21')]){if(this[_0x2707('0x21')][_0x2707('0x22')](_0x4a8b7f)){if(_0x80dfc6['exten']===this['faxAccounts'][_0x4a8b7f]['localstationid']){this[_0x2707('0xe')][_0x80dfc6[_0x2707('0x23')]]={};this[_0x2707('0xe')][_0x80dfc6[_0x2707('0x23')]][_0x2707('0x24')]=_0x80dfc6[_0x2707('0x24')];this[_0x2707('0xe')][_0x80dfc6[_0x2707('0x23')]]['id']=this[_0x2707('0x21')][_0x4a8b7f]['id'];this[_0x2707('0xe')][_0x80dfc6[_0x2707('0x23')]][_0x2707('0x25')]=this[_0x2707('0x21')][_0x4a8b7f][_0x2707('0x25')];logger['info'](_0x80dfc6[_0x2707('0x23')],_0x2707('0x26'));}}}}if(this[_0x2707('0x10')][_0x80dfc6[_0x2707('0x23')]]){this[_0x2707('0xe')][_0x80dfc6[_0x2707('0x23')]]={};this['channels'][_0x80dfc6[_0x2707('0x23')]][_0x2707('0x24')]=_0x80dfc6[_0x2707('0x24')];logger[_0x2707('0x27')](_0x80dfc6[_0x2707('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x2707('0x1e')]['syncVarSet']=function(_0x29dad2){if(this[_0x2707('0xe')][_0x29dad2[_0x2707('0x23')]]){for(var _0x57da26 in _0x29dad2[_0x2707('0x28')]){if(_0x29dad2[_0x2707('0x28')][_0x2707('0x22')](_0x57da26)){this['channels'][_0x29dad2[_0x2707('0x23')]][_0x57da26]=_0x29dad2[_0x2707('0x29')];}}}};Fax['prototype'][_0x2707('0x17')]=function(_0x497c92){if(this['channels'][_0x497c92[_0x2707('0x23')]]){this['channels'][_0x497c92[_0x2707('0x23')]][_0x2707('0x2a')]=_0x497c92[_0x2707('0x2a')];this[_0x2707('0xe')][_0x497c92['uniqueid']][_0x2707('0x2b')]=_0x497c92[_0x2707('0x2b')];}};Fax[_0x2707('0x1e')][_0x2707('0x2c')]=function(_0x12ec96){if(this[_0x2707('0xe')][_0x12ec96[_0x2707('0x23')]]){for(var _0xd4b117 in _0x12ec96[_0x2707('0x28')]){if(_0x12ec96['variable'][_0x2707('0x22')](_0xd4b117)){this[_0x2707('0xe')][_0x12ec96['uniqueid']][_0xd4b117]=_0x12ec96['value'];}}}};Fax['prototype']['syncFaxStatus']=function(_0x4bd001){if(this[_0x2707('0xe')][_0x4bd001['uniqueid']]){this['channels'][_0x4bd001[_0x2707('0x23')]][_0x2707('0x2d')]=_0x4bd001['operation'];this[_0x2707('0xe')][_0x4bd001[_0x2707('0x23')]]['status']=_0x4bd001['status'];this[_0x2707('0xe')][_0x4bd001[_0x2707('0x23')]]['localstationid']=_0x4bd001['localstationid'];this[_0x2707('0xe')][_0x4bd001[_0x2707('0x23')]]['filename']=_0x4bd001[_0x2707('0x2e')];logger[_0x2707('0x27')](_0x4bd001[_0x2707('0x23')],_0x2707('0x2f'));}};Fax[_0x2707('0x1e')][_0x2707('0x1b')]=function(_0x5bd2e5){var _0x15a953=this;if(this[_0x2707('0xe')][_0x5bd2e5[_0x2707('0x23')]]){var _0x33612f=this[_0x2707('0xe')][_0x5bd2e5[_0x2707('0x23')]]['id'];this[_0x2707('0xe')][_0x5bd2e5['uniqueid']][_0x2707('0x30')]=_0x5bd2e5[_0x2707('0x30')];this[_0x2707('0xe')][_0x5bd2e5[_0x2707('0x23')]][_0x2707('0x31')]=_0x5bd2e5[_0x2707('0x31')];this[_0x2707('0xe')][_0x5bd2e5[_0x2707('0x23')]][_0x2707('0x32')]=_0x5bd2e5[_0x2707('0x32')];this[_0x2707('0xe')][_0x5bd2e5[_0x2707('0x23')]][_0x2707('0x33')]=_0x5bd2e5[_0x2707('0x33')];this[_0x2707('0xe')][_0x5bd2e5[_0x2707('0x23')]]['transferrate']=_0x5bd2e5[_0x2707('0x34')];this[_0x2707('0xe')][_0x5bd2e5['uniqueid']][_0x2707('0x2e')]=_0x5bd2e5['filename'];this[_0x2707('0xe')][_0x5bd2e5[_0x2707('0x23')]][_0x2707('0x35')]=_0x5bd2e5[_0x2707('0x35')];if(this[_0x2707('0xe')][_0x5bd2e5[_0x2707('0x23')]][_0x2707('0x31')]>0x0){tiff2pdf(_0x5bd2e5['filename'],_0x2707('0x36'),function(_0x4398bf){logger['info'](_0x5bd2e5[_0x2707('0x23')],_0x2707('0x37'),_0x4398bf[_0x2707('0x38')]);attachment['create']({'name':path['parse'](_0x5bd2e5[_0x2707('0x2e')])[_0x2707('0x25')],'basename':path['parse'](_0x5bd2e5[_0x2707('0x2e')])['name']+_0x2707('0x39'),'type':_0x2707('0x3a')})[_0x2707('0x3b')](function(_0x6947fa){faxAccount['notify'](_0x33612f,{'from':_0x5bd2e5[_0x2707('0x35')],'mapKey':_0x2707('0x3c'),'body':path[_0x2707('0x3d')](_0x5bd2e5[_0x2707('0x2e')])[_0x2707('0x25')]+_0x2707('0x39'),'AttachmentId':_0x6947fa['id']})[_0x2707('0x3e')](function(_0x59a86f){logger[_0x2707('0x3f')](_0x5bd2e5[_0x2707('0x23')],_0x2707('0x40'),JSON[_0x2707('0x41')](_0x59a86f));});})[_0x2707('0x3e')](function(_0x5df851){logger[_0x2707('0x3f')](_0x5bd2e5['uniqueid'],_0x2707('0x42'),JSON[_0x2707('0x41')](_0x5df851));});});}logger['info'](_0x5bd2e5[_0x2707('0x23')],_0x2707('0x42'));}};Fax[_0x2707('0x1e')]['syncOriginateResponse']=function(_0x1a8034){if(this['actions'][_0x1a8034[_0x2707('0x23')]]){_[_0x2707('0x43')](this['channels'][_0x1a8034[_0x2707('0x23')]],_[_0x2707('0x44')](_0x1a8034,[_0x2707('0x45'),'reason']));}};function updateStatus(_0x54f920){if(_0x54f920[_0x2707('0x46')]){faxMessage[_0x2707('0x47')](_0x54f920[_0x2707('0x46')],{'failMessage':_0x2707('0x48')})[_0x2707('0x3b')](function(_0x5c0d86){ut['logger']('[Fax][Message][Error][Updated]',_0x5c0d86);})[_0x2707('0x3e')](function(_0x262b89){ut[_0x2707('0x49')](_0x2707('0x4a'),_0x262b89);});}else{ut[_0x2707('0x49')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x2707('0x1e')][_0x2707('0x4b')]=function(_0x5c99fd,_0x482ed1,_0x3b41b2){var _0x1f7d77=this;var _0x3a8cf9={};if(_0x482ed1){_0x3a8cf9={'read':_0x482ed1};}else{_0x3a8cf9={'failMessage':_0x3b41b2};}if(this['actions'][_0x5c99fd][_0x2707('0x46')]){faxMessage[_0x2707('0x47')](this[_0x2707('0x10')][_0x5c99fd][_0x2707('0x46')],_0x3a8cf9)['then'](function(_0x1251cf){ut[_0x2707('0x49')](_0x2707('0x4c'),_0x1251cf);})[_0x2707('0x3e')](function(_0x3d6ac9){ut[_0x2707('0x49')](_0x2707('0x4d'),_0x3d6ac9);})[_0x2707('0x4e')](function(){delete _0x1f7d77[_0x2707('0xe')][_0x5c99fd];delete _0x1f7d77[_0x2707('0x10')][_0x5c99fd];});}else{ut['logger'](_0x2707('0x4f'));delete this['channels'][_0x5c99fd];delete this['actions'][_0x5c99fd];}};Fax[_0x2707('0x1e')]['syncHangup']=function(_0x556648){var _0x15bf2e=this;if(this[_0x2707('0xe')][_0x556648[_0x2707('0x23')]]){if(this[_0x2707('0x10')][_0x556648[_0x2707('0x23')]]){this[_0x2707('0xe')][_0x556648[_0x2707('0x23')]]['id']=this[_0x2707('0x10')][_0x556648[_0x2707('0x23')]]['id'];this[_0x2707('0xe')][_0x556648[_0x2707('0x23')]]['name']=this['actions'][_0x556648['uniqueid']][_0x2707('0x25')];}logger[_0x2707('0x27')](_0x556648[_0x2707('0x23')],this['actions'][_0x556648['uniqueid']]?_0x2707('0x50'):_0x2707('0x51'),JSON[_0x2707('0x41')](this[_0x2707('0xe')][_0x556648[_0x2707('0x23')]]));if(this['actions'][_0x556648['uniqueid']]){if(this[_0x2707('0xe')][_0x556648[_0x2707('0x23')]][_0x2707('0x52')]>0x0&&this[_0x2707('0xe')][_0x556648[_0x2707('0x23')]][_0x2707('0x53')]===_0x2707('0x54')){this[_0x2707('0x4b')](_0x556648[_0x2707('0x23')],!![]);}else{this['updateStatus'](_0x556648[_0x2707('0x23')],![],this[_0x2707('0xe')][_0x556648[_0x2707('0x23')]][_0x2707('0x55')]?_0x2707('0x56')+this[_0x2707('0xe')][_0x556648['uniqueid']]['faxstatusstring']:_0x2707('0x57'));}}}};Fax[_0x2707('0x1e')]['send']=function(_0x58fefc){var _0x4f14e0=this;return new BPromise(function(_0x491d15,_0x1aafc3){_0x4f14e0[_0x2707('0x58')](_0x58fefc,_0x4f14e0['faxAccounts'][_0x58fefc[_0x2707('0x59')]])[_0x2707('0x3b')](function(_0x3e50d7){ut['logger']('[Fax][execOriginate][success]',_0x3e50d7);_0x491d15(ut[_0x2707('0x38')](_0x2707('0x5a')));})[_0x2707('0x3e')](function(_0x278b7a){ut[_0x2707('0x49')](_0x2707('0x5b'),_0x278b7a);updateStatus(_0x58fefc);_0x1aafc3(ut[_0x2707('0x38')]('Fax\x20failed'));});});};Fax[_0x2707('0x1e')][_0x2707('0x5c')]=function(_0x319a1e){var _0xe1074b=this;return new BPromise(function(_0xb63b72,_0x3dd5e6){var _0x5a1175=_0xe1074b[_0x2707('0x5d')](_0xe1074b[_0x2707('0x21')][_0x319a1e[_0x2707('0x59')]][_0x2707('0x5e')],_0x319a1e);if(_0x5a1175[_0x2707('0x5f')]){_0xb63b72(ut[_0x2707('0x38')]('Trunk\x20Reachable'));}else{_0x3dd5e6(ut['message'](_0x5a1175[_0x2707('0x38')]));}});};function originate(_0x2b0df0,_0x354322,_0x42da4e){return new BPromise(function(_0x3ae5c6,_0x2af149){if(_0x42da4e){var _0x5ef9a6=util['format'](_0x2707('0x60'),path['parse'](_0x2b0df0[_0x2707('0x4')])[_0x2707('0x25')],_0x2b0df0[_0x2707('0x4')]);gs[_0x2707('0x61')](_0x5ef9a6)[_0x2707('0x3b')](function(){_0x2b0df0[_0x2707('0x4')]=util['format'](_0x2707('0x62'),path['parse'](_0x2b0df0[_0x2707('0x4')])[_0x2707('0x63')],path['parse'](_0x2b0df0[_0x2707('0x4')])[_0x2707('0x25')]);_0x354322[_0x2707('0x64')]=_0x2b0df0[_0x2707('0x4')];ut[_0x2707('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0x2707('0x65')](ut[_0x2707('0x66')](_0x2b0df0,_0x354322))[_0x2707('0x3b')](function(_0x44f340){_0x3ae5c6(_0x44f340);})[_0x2707('0x3e')](function(_0x1fb9d2){_0x2af149(_0x1fb9d2);});})[_0x2707('0x3e')](function(_0x339bb9){_0x2af149(_0x339bb9);});}else{ami[_0x2707('0x65')](ut[_0x2707('0x66')](_0x2b0df0,_0x354322))[_0x2707('0x3b')](function(_0x26feed){_0x3ae5c6(_0x26feed);})[_0x2707('0x3e')](function(_0x18863b){_0x2af149(_0x18863b);});}});}Fax[_0x2707('0x1e')][_0x2707('0x58')]=function(_0x2b43be,_0x43830c){var _0x5d2abb=this;return new BPromise(function(_0x44906f,_0x5dc3a4){var _0x4c6dc1=uuid['v4']();var _0x1f0e85=ut[_0x2707('0x67')](_0x2b43be,_0x43830c);_0x5d2abb[_0x2707('0x10')][_0x4c6dc1]=new Action(_0x4c6dc1,_0x43830c,_0x2b43be);var _0x11ac13=_0x5d2abb[_0x2707('0x10')][_0x4c6dc1];if(path[_0x2707('0x3d')](_0x2b43be['path'])[_0x2707('0x68')]===_0x2707('0x39')){originate(_0x11ac13,_0x1f0e85,!![])[_0x2707('0x3b')](function(_0x54009a){_0x44906f(_0x54009a);})[_0x2707('0x3e')](function(_0x378f14){_0x5dc3a4(_0x378f14);});}else{originate(_0x11ac13,_0x1f0e85,![])[_0x2707('0x3b')](function(_0x381382){_0x44906f(_0x381382);})['catch'](function(_0xc091da){_0x5dc3a4(_0xc091da);});}});};Fax['prototype'][_0x2707('0x69')]=function(_0x19a980){return!_[_0x2707('0x6a')](_0x19a980)&&!_[_0x2707('0x6a')](_0x19a980[_0x2707('0x25')])&&!_[_0x2707('0x6a')](_0x19a980[_0x2707('0x6b')])&&_0x19a980[_0x2707('0x6b')]&&!_[_0x2707('0x6a')](this['trunks'][util[_0x2707('0x6c')]('SIP/%s',_0x19a980[_0x2707('0x25')])])&&!_[_0x2707('0x6a')](this[_0x2707('0xf')][util[_0x2707('0x6c')](_0x2707('0x6d'),_0x19a980[_0x2707('0x25')])]['status'])&&(this['trunks'][util[_0x2707('0x6c')]('SIP/%s',_0x19a980[_0x2707('0x25')])][_0x2707('0x6e')]===_0x2707('0x6f')||this[_0x2707('0xf')][util['format'](_0x2707('0x6d'),_0x19a980[_0x2707('0x25')])][_0x2707('0x6e')]==='unmonitored');};Fax[_0x2707('0x1e')][_0x2707('0x5d')]=function(_0x455d71,_0x51c297){if(!this[_0x2707('0x69')](_0x455d71)){ut['logger'](_0x2707('0x70'),_[_0x2707('0x6a')](_0x455d71)?'':_0x455d71[_0x2707('0x25')]+_0x2707('0x71'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x51c297[_0x2707('0x3c')])){ut[_0x2707('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x2707('0x41')](_0x51c297));return{'isValid':![],'message':_0x2707('0x72')};}if(_[_0x2707('0x6a')](_0x51c297[_0x2707('0x4')])){ut[_0x2707('0x49')](_0x2707('0x73'),JSON['stringify'](_0x51c297));return{'isValid':![],'message':_0x2707('0x74')};}return{'isValid':!![],'message':_0x2707('0x75')};};module[_0x2707('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 48f594a..069c7c4 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 _0xc20a=['[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc20a,0x161));var _0xac20=function(_0x37205b,_0x332146){_0x37205b=_0x37205b-0x0;var _0x2757f3=_0xc20a[_0x37205b];return _0x2757f3;};'use strict';var util=require(_0xac20('0x0'));var BPromise=require('bluebird');var logger=require(_0xac20('0x1'))(_0xac20('0x2'));var _=require(_0xac20('0x3'));var faxAccount=require(_0xac20('0x4'));function loggerCatch(_0x4a8b56){return function(_0x13ec33){logger[_0xac20('0x5')](_0x4a8b56,util[_0xac20('0x6')](_0x13ec33,{'showHidden':![],'depth':null}));};}exports[_0xac20('0x7')]=function(_0x43df9b,_0x5e39b8){return BPromise[_0xac20('0x8')]()[_0xac20('0x9')](faxAccount[_0xac20('0x7')](_0x43df9b,_0x5e39b8))['catch'](loggerCatch(_0xac20('0xa')));}; \ No newline at end of file +var _0x2eb8=['inspect','notify','then','catch','[Notify]\x20','util','bluebird','preview','lodash','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2eb8,0xe1));var _0x82eb=function(_0x51ad19,_0x3e8325){_0x51ad19=_0x51ad19-0x0;var _0x3dc6a7=_0x2eb8[_0x51ad19];return _0x3dc6a7;};'use strict';var util=require(_0x82eb('0x0'));var BPromise=require(_0x82eb('0x1'));var logger=require('../../../config/logger')(_0x82eb('0x2'));var _=require(_0x82eb('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x21c6ad){return function(_0xa68b43){logger[_0x82eb('0x4')](_0x21c6ad,util[_0x82eb('0x5')](_0xa68b43,{'showHidden':![],'depth':null}));};}exports[_0x82eb('0x6')]=function(_0x972d02,_0x477c48){return BPromise['resolve']()[_0x82eb('0x7')](faxAccount[_0x82eb('0x6')](_0x972d02,_0x477c48))[_0x82eb('0x8')](loggerCatch(_0x82eb('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 6a902cb..d3ea125 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 _0xd747=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0xe4ce33,_0x3ed33f){var _0x556572=function(_0x502635){while(--_0x502635){_0xe4ce33['push'](_0xe4ce33['shift']());}};_0x556572(++_0x3ed33f);}(_0xd747,0x169));var _0x7d74=function(_0x242345,_0x37f974){_0x242345=_0x242345-0x0;var _0x29cb44=_0xd747[_0x242345];return _0x29cb44;};'use strict';var util=require(_0x7d74('0x0'));var logger=require(_0x7d74('0x1'))(_0x7d74('0x2'));var BPromise=require(_0x7d74('0x3'));var exec=require(_0x7d74('0x4'))[_0x7d74('0x5')];exports[_0x7d74('0x6')]=function(_0xfe3952){return new BPromise(function(_0xf4b241,_0x4fbad2){exec(_0xfe3952,function(_0x4dab2b,_0x8a5d68,_0x39631a){logger[_0x7d74('0x7')](_0x7d74('0x8'),_0x8a5d68);if(_0x4dab2b){logger[_0x7d74('0x7')](_0x7d74('0x8'),_0x7d74('0x9'),util[_0x7d74('0xa')](_0x4dab2b,{'showHidden':![],'depth':null}),_0x8a5d68,_0x39631a);_0x4fbad2(_0x4dab2b);}_0xf4b241(_0x8a5d68);});});}; \ No newline at end of file +var _0x8d8b=['fax','bluebird','exec','info','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x8d8b,0xcf));var _0xb8d8=function(_0x2be6ff,_0x43ebd5){_0x2be6ff=_0x2be6ff-0x0;var _0x1d871b=_0x8d8b[_0x2be6ff];return _0x1d871b;};'use strict';var util=require(_0xb8d8('0x0'));var logger=require('../../../../config/logger')(_0xb8d8('0x1'));var BPromise=require(_0xb8d8('0x2'));var exec=require('child_process')[_0xb8d8('0x3')];exports['execute']=function(_0x41f396){return new BPromise(function(_0x18d308,_0x1532ad){exec(_0x41f396,function(_0x21b279,_0x33ca05,_0x52edd0){logger['info']('Exec\x20gs',_0x33ca05);if(_0x21b279){logger[_0xb8d8('0x4')](_0xb8d8('0x5'),_0xb8d8('0x6'),util[_0xb8d8('0x7')](_0x21b279,{'showHidden':![],'depth':null}),_0x33ca05,_0x52edd0);_0x1532ad(_0x21b279);}_0x18d308(_0x33ca05);});});}; \ 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 f6cf33f..91d83e9 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 _0xac7f=['inspect','addVariables','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','fax','message','logger'];(function(_0x3e744,_0x27129){var _0xdbf4b=function(_0x2aee99){while(--_0x2aee99){_0x3e744['push'](_0x3e744['shift']());}};_0xdbf4b(++_0x27129);}(_0xac7f,0x15c));var _0xfac7=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xac7f[_0xc4001c];return _0x49f7bc;};'use strict';var util=require(_0xfac7('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0xfac7('0x1'));exports[_0xfac7('0x2')]=function(_0x1bda10){return{'message':_0x1bda10};};exports[_0xfac7('0x3')]=function(_0x2d7b84,_0x19b0a4){logger['info'](_0x2d7b84,util[_0xfac7('0x4')](_0x19b0a4,{'showHidden':![],'depth':null}));};exports[_0xfac7('0x5')]=function(_0x381d9e,_0x40bd30){var _0x138a07={'XMF-ECM':_0x40bd30['ecm'],'XMF-HEADERINFO':_0x40bd30[_0xfac7('0x6')],'XMF-MINRATE':_0x40bd30['minrate'],'XMF-MAXRATE':_0x40bd30[_0xfac7('0x7')],'XMF-MODEM':util[_0xfac7('0x8')](_0xfac7('0x9'),_0x40bd30[_0xfac7('0xa')]),'XMF-GATEWAY':_0x40bd30[_0xfac7('0xb')],'XMF-FAXDETECT':_0x40bd30[_0xfac7('0xc')],'XMF-T38TIMEOUT':_0x40bd30[_0xfac7('0xd')],'XMF-LOCALSTATIONID':_0x40bd30[_0xfac7('0xe')],'XMF-PATH':_0x381d9e[_0xfac7('0xf')]};return _0x138a07;};exports[_0xfac7('0x10')]=function(_0x44bbd3,_0x4acc3b){return{'actionid':_0x44bbd3[_0xfac7('0x11')],'action':_0xfac7('0x12'),'channel':_0x44bbd3[_0xfac7('0x13')],'Exten':'xcally-motion-fax','Context':_0xfac7('0x14'),'Priority':'1','callerid':util['format'](_0xfac7('0x15'),_0x44bbd3[_0xfac7('0x6')]?_0x44bbd3[_0xfac7('0x6')]:'',_0x44bbd3['localstationid']),'variable':_0x4acc3b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x44bbd3[_0xfac7('0x11')]};}; \ No newline at end of file +var _0x280f=['\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x280f,0x17b));var _0xf280=function(_0x3de4f8,_0x336c7d){_0x3de4f8=_0x3de4f8-0x0;var _0x3d81fc=_0x280f[_0x3de4f8];return _0x3d81fc;};'use strict';var util=require(_0xf280('0x0'));var _=require('lodash');var moment=require(_0xf280('0x1'));var logger=require(_0xf280('0x2'))(_0xf280('0x3'));exports[_0xf280('0x4')]=function(_0x513d76){return{'message':_0x513d76};};exports[_0xf280('0x5')]=function(_0x35b86e,_0x123034){logger[_0xf280('0x6')](_0x35b86e,util[_0xf280('0x7')](_0x123034,{'showHidden':![],'depth':null}));};exports[_0xf280('0x8')]=function(_0x3949ce,_0x145fa6){var _0x168d7a={'XMF-ECM':_0x145fa6[_0xf280('0x9')],'XMF-HEADERINFO':_0x145fa6['headerinfo'],'XMF-MINRATE':_0x145fa6[_0xf280('0xa')],'XMF-MAXRATE':_0x145fa6[_0xf280('0xb')],'XMF-MODEM':util[_0xf280('0xc')](_0xf280('0xd'),_0x145fa6[_0xf280('0xe')]),'XMF-GATEWAY':_0x145fa6[_0xf280('0xf')],'XMF-FAXDETECT':_0x145fa6[_0xf280('0x10')],'XMF-T38TIMEOUT':_0x145fa6[_0xf280('0x11')],'XMF-LOCALSTATIONID':_0x145fa6[_0xf280('0x12')],'XMF-PATH':_0x3949ce[_0xf280('0x13')]};return _0x168d7a;};exports[_0xf280('0x14')]=function(_0x586a9a,_0x336782){return{'actionid':_0x586a9a[_0xf280('0x15')],'action':_0xf280('0x16'),'channel':_0x586a9a[_0xf280('0x17')],'Exten':_0xf280('0x18'),'Context':_0xf280('0x19'),'Priority':'1','callerid':util[_0xf280('0xc')](_0xf280('0x1a'),_0x586a9a[_0xf280('0x1b')]?_0x586a9a[_0xf280('0x1b')]:'',_0x586a9a[_0xf280('0x12')]),'variable':_0x336782,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x586a9a[_0xf280('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 46799c2..2426e9f 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 _0x72ac=['bluebird','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]'];(function(_0x45f6e2,_0xe72d77){var _0x573b09=function(_0x3aa398){while(--_0x3aa398){_0x45f6e2['push'](_0x45f6e2['shift']());}};_0x573b09(++_0xe72d77);}(_0x72ac,0xd5));var _0xc72a=function(_0x17c648,_0x3185b0){_0x17c648=_0x17c648-0x0;var _0x22dc52=_0x72ac[_0x17c648];return _0x22dc52;};'use strict';var BPromise=require(_0xc72a('0x0'));var util=require(_0xc72a('0x1'));var moment=require(_0xc72a('0x2'));var server=require('./server');var Realtime=require(_0xc72a('0x3'));var Report=require(_0xc72a('0x4'));var Acw=require(_0xc72a('0x5'));var Trigger=require(_0xc72a('0x6'));var Dialer=require(_0xc72a('0x7'));var Preview=require(_0xc72a('0x8'));var Fax=require(_0xc72a('0x9'));var user=require(_0xc72a('0xa'));var voiceQueue=require(_0xc72a('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc72a('0xc'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xc72a('0xd'));var cmHopperHistory=require(_0xc72a('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xc72a('0xf'));var faxAccount=require(_0xc72a('0x10'));var zendesk=require(_0xc72a('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xc72a('0x12'));var freshdesk=require(_0xc72a('0x13'));var desk=require(_0xc72a('0x14'));var zoho=require(_0xc72a('0x15'));var vtiger=require(_0xc72a('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xc72a('0x17'));var dynamics365=require(_0xc72a('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xc72a('0x19'))(_0xc72a('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc72a('0x1b')](_0xc72a('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc72a('0x1b')](_0xc72a('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc72a('0x1d')]()[_0xc72a('0x1e')](user[_0xc72a('0x1f')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x20')]())[_0xc72a('0x1e')](user[_0xc72a('0x21')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x22')]())[_0xc72a('0x1e')](trunk[_0xc72a('0x23')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x24')]())[_0xc72a('0x1e')](voiceQueue['getVoiceQueues']())[_0xc72a('0x1e')](realtime[_0xc72a('0x25')]())[_0xc72a('0x1e')](trigger['getTriggers']())[_0xc72a('0x1e')](realtime['initTriggers']())[_0xc72a('0x1e')](template[_0xc72a('0x26')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x27')]())['then'](zendesk[_0xc72a('0x28')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x29')]())[_0xc72a('0x1e')](salesforce[_0xc72a('0x2a')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x2b')]())[_0xc72a('0x1e')](sugarcrm[_0xc72a('0x2c')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x2d')]())[_0xc72a('0x1e')](freshdesk[_0xc72a('0x2e')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x2f')]())[_0xc72a('0x1e')](desk[_0xc72a('0x30')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x31')]())['then'](zoho[_0xc72a('0x32')]())[_0xc72a('0x1e')](realtime['initZohoAccounts']())[_0xc72a('0x1e')](vtiger['getVtigerAccounts']())[_0xc72a('0x1e')](realtime[_0xc72a('0x33')]())['then'](freshsales[_0xc72a('0x34')]())['then'](realtime['initFreshsalesAccounts']())[_0xc72a('0x1e')](servicenow[_0xc72a('0x35')]())[_0xc72a('0x1e')](realtime['initServicenowAccounts']())['then'](dynamics365[_0xc72a('0x36')]())[_0xc72a('0x1e')](realtime['initDynamics365Accounts']())[_0xc72a('0x1e')](campaign[_0xc72a('0x37')]())[_0xc72a('0x1e')](realtime['initCampaigns']())[_0xc72a('0x1e')](voiceExtension[_0xc72a('0x38')]())[_0xc72a('0x1e')](realtime['initVoiceExtensions']())['then'](faxAccount[_0xc72a('0x39')]())['then'](realtime[_0xc72a('0x3a')]())[_0xc72a('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0xc72a('0x1d')]()[_0xc72a('0x1e')](voiceQueueReport['getVoiceQueueReports']())[_0xc72a('0x1e')](realtime[_0xc72a('0x3b')]())[_0xc72a('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xc72a('0x3c')]())[_0xc72a('0x1e')](cmHopperHistory[_0xc72a('0x3d')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x3e')]())[_0xc72a('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xc72a('0x1e')](realtime[_0xc72a('0x3f')]())[_0xc72a('0x40')](function(_0x5e785e){logger[_0xc72a('0x41')](_0xc72a('0x42'),util[_0xc72a('0x43')](_0x5e785e,{'showHidden':![],'depth':null}));});}function main(){return server[_0xc72a('0x44')](realtime,preview,fax)[_0xc72a('0x1e')](function(_0x37daad){return initRealtime();})['then'](function(){return initParams();})[_0xc72a('0x1e')](function(){report[_0xc72a('0x45')]();setInterval(initRealtime,0x1388);})[_0xc72a('0x40')](function(_0x1fbe04){logger[_0xc72a('0x41')](_0xc72a('0x46'),util[_0xc72a('0x43')](_0x1fbe04,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x8882=['./report','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','[index.js][initParams]','listen','sync','catch','error','[index.js][main]','inspect','bluebird','util','moment','./server'];(function(_0x217385,_0x2184ca){var _0x314713=function(_0x575629){while(--_0x575629){_0x217385['push'](_0x217385['shift']());}};_0x314713(++_0x2184ca);}(_0x8882,0x169));var _0x2888=function(_0xb05abe,_0x45d607){_0xb05abe=_0xb05abe-0x0;var _0x595ea9=_0x8882[_0xb05abe];return _0x595ea9;};'use strict';var BPromise=require(_0x2888('0x0'));var util=require(_0x2888('0x1'));var moment=require(_0x2888('0x2'));var server=require(_0x2888('0x3'));var Realtime=require('./realtime');var Report=require(_0x2888('0x4'));var Acw=require('./acw');var Trigger=require(_0x2888('0x5'));var Dialer=require(_0x2888('0x6'));var Preview=require(_0x2888('0x7'));var Fax=require(_0x2888('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x2888('0x9'));var voiceQueueReport=require(_0x2888('0xa'));var voiceCallReport=require(_0x2888('0xb'));var trunk=require(_0x2888('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x2888('0xd'));var cmHopperHistory=require(_0x2888('0xe'));var campaign=require(_0x2888('0xf'));var voiceExtension=require(_0x2888('0x10'));var faxAccount=require(_0x2888('0x11'));var zendesk=require(_0x2888('0x12'));var salesforce=require(_0x2888('0x13'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x2888('0x14'));var desk=require(_0x2888('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x2888('0x16'));var freshsales=require(_0x2888('0x17'));var servicenow=require(_0x2888('0x18'));var dynamics365=require(_0x2888('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x2888('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2888('0x1b')](_0x2888('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x2888('0x1d')]()[_0x2888('0x1e')](user['getAgents']())[_0x2888('0x1e')](realtime[_0x2888('0x1f')]())[_0x2888('0x1e')](user[_0x2888('0x20')]())[_0x2888('0x1e')](realtime[_0x2888('0x21')]())['then'](trunk[_0x2888('0x22')]())[_0x2888('0x1e')](realtime['initTrunks']())[_0x2888('0x1e')](voiceQueue[_0x2888('0x23')]())['then'](realtime[_0x2888('0x24')]())[_0x2888('0x1e')](trigger[_0x2888('0x25')]())[_0x2888('0x1e')](realtime[_0x2888('0x26')]())[_0x2888('0x1e')](template['getTemplates']())['then'](realtime[_0x2888('0x27')]())['then'](zendesk[_0x2888('0x28')]())[_0x2888('0x1e')](realtime['initZendeskAccounts']())['then'](salesforce[_0x2888('0x29')]())[_0x2888('0x1e')](realtime[_0x2888('0x2a')]())['then'](sugarcrm[_0x2888('0x2b')]())[_0x2888('0x1e')](realtime[_0x2888('0x2c')]())[_0x2888('0x1e')](freshdesk[_0x2888('0x2d')]())[_0x2888('0x1e')](realtime[_0x2888('0x2e')]())['then'](desk[_0x2888('0x2f')]())[_0x2888('0x1e')](realtime[_0x2888('0x30')]())[_0x2888('0x1e')](zoho[_0x2888('0x31')]())['then'](realtime[_0x2888('0x32')]())[_0x2888('0x1e')](vtiger[_0x2888('0x33')]())['then'](realtime[_0x2888('0x34')]())['then'](freshsales[_0x2888('0x35')]())['then'](realtime['initFreshsalesAccounts']())[_0x2888('0x1e')](servicenow[_0x2888('0x36')]())[_0x2888('0x1e')](realtime[_0x2888('0x37')]())[_0x2888('0x1e')](dynamics365[_0x2888('0x38')]())[_0x2888('0x1e')](realtime['initDynamics365Accounts']())[_0x2888('0x1e')](campaign[_0x2888('0x39')]())[_0x2888('0x1e')](realtime[_0x2888('0x3a')]())[_0x2888('0x1e')](voiceExtension[_0x2888('0x3b')]())[_0x2888('0x1e')](realtime[_0x2888('0x3c')]())[_0x2888('0x1e')](faxAccount[_0x2888('0x3d')]())[_0x2888('0x1e')](realtime['initFaxAccounts']())[_0x2888('0x1e')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x2888('0x1e')](voiceQueueReport['getVoiceQueueReports']())[_0x2888('0x1e')](realtime['initVoiceQueueReports']())[_0x2888('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x2888('0x1e')](realtime[_0x2888('0x3e')]())['then'](cmHopperHistory[_0x2888('0x3f')]())[_0x2888('0x1e')](realtime[_0x2888('0x40')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x2888('0x1e')](realtime[_0x2888('0x41')]())['catch'](function(_0x2092b3){logger['error'](_0x2888('0x42'),util['inspect'](_0x2092b3,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2888('0x43')](realtime,preview,fax)[_0x2888('0x1e')](function(_0x12e3ef){return initRealtime();})[_0x2888('0x1e')](function(){return initParams();})[_0x2888('0x1e')](function(){report[_0x2888('0x44')]();setInterval(initRealtime,0x1388);})[_0x2888('0x45')](function(_0x4ec4ca){logger[_0x2888('0x46')](_0x2888('0x47'),util[_0x2888('0x48')](_0x4ec4ca,{'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 3d83e5b..5ce4017 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 _0x34e8=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile'];(function(_0x57eef5,_0x293b3b){var _0x4e3233=function(_0x18229b){while(--_0x18229b){_0x57eef5['push'](_0x57eef5['shift']());}};_0x4e3233(++_0x293b3b);}(_0x34e8,0x12c));var _0x834e=function(_0x399f8d,_0x4e77ce){_0x399f8d=_0x399f8d-0x0;var _0x223874=_0x34e8[_0x399f8d];return _0x223874;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));config[_0x834e('0x5')]=_[_0x834e('0x6')](config[_0x834e('0x5')],{'host':_0x834e('0x7'),'port':0x18eb});var io=require(_0x834e('0x8'))(new Redis(config[_0x834e('0x5')]));function Agent(_0x4a2018){this['id']=_0x4a2018['id']||0x0;this[_0x834e('0x9')]=_0x4a2018['name']||'';this[_0x834e('0xa')]=_0x4a2018[_0x834e('0xa')]||'';this[_0x834e('0xb')]=_0x4a2018[_0x834e('0xb')]||'';this[_0x834e('0xc')]=_0x4a2018[_0x834e('0xc')]||'';this[_0x834e('0xd')]=_0x834e('0xe');this[_0x834e('0xf')]=0x0;this[_0x834e('0x10')]=_0x834e('0xe');this[_0x834e('0x11')]='';this[_0x834e('0x12')]='';this[_0x834e('0x13')]='';this[_0x834e('0x14')]='';this[_0x834e('0x15')]=_0x4a2018[_0x834e('0x15')]||![];this['voiceStatus']=_0x834e('0xe');this[_0x834e('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x834e('0x17')]='';this[_0x834e('0x18')]=![];this[_0x834e('0x19')]=![];this[_0x834e('0x3')]='';}Agent['prototype'][_0x834e('0x1a')]=function(_0x302cbd){var _0x57274a;if(_0x302cbd&&_0x302cbd[_0x834e('0xd')]){_0x57274a=_0x302cbd['state'][_0x834e('0x1b')]();switch(_0x57274a){case _0x834e('0x1c'):_0x57274a='idle';break;case _0x834e('0x1d'):_0x57274a=_0x834e('0x1e');break;}}if(_0x57274a&&this[_0x834e('0x1f')]!==_0x57274a||_0x302cbd['statePause']){this[_0x834e('0x16')]=_[_0x834e('0x20')](moment()[_0x834e('0x21')]('x'));}if(_0x57274a){this[_0x834e('0x1f')]=_0x57274a;}var _0x237947={'id':this['id'],'name':this[_0x834e('0x9')],'email':this[_0x834e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x834e('0xc')],'state':this[_0x834e('0xd')],'stateTime':this[_0x834e('0xf')],'status':this[_0x834e('0x10')],'address':this['address'],'online':this[_0x834e('0x15')],'voiceStatus':this[_0x834e('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x834e('0x22')],'voiceStatusQueue':this[_0x834e('0x17')],'interface':this[_0x834e('0x14')],'onhold':this['onhold']};var _0x4e3f48=md5(JSON[_0x834e('0x23')](_0x237947));if(this[_0x834e('0x3')]!==_0x4e3f48){this['md5']=_0x4e3f48;io['to'](util[_0x834e('0x21')](_0x834e('0x24'),_0x237947['name']))[_0x834e('0x25')](_0x834e('0x26'),_0x237947);io[_0x834e('0x25')]('user:presence',_0x237947);}};module[_0x834e('0x27')]=Agent; \ No newline at end of file +var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x154584,_0x421e12){var _0x969074=function(_0x17303b){while(--_0x17303b){_0x154584['push'](_0x154584['shift']());}};_0x969074(++_0x421e12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index e405b70..2e494b8 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 _0x6d8b=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0x6d8b,0xb8));var _0xb6d8=function(_0x352833,_0x348f7f){_0x352833=_0x352833-0x0;var _0x29c92b=_0x6d8b[_0x352833];return _0x29c92b;};'use strict';function Campaign(_0x1e83fb){this['id']=_0x1e83fb['id']||0x0;this[_0xb6d8('0x0')]=_0x1e83fb[_0xb6d8('0x0')]||'';this[_0xb6d8('0x1')]=_0x1e83fb[_0xb6d8('0x1')]||_0xb6d8('0x2');this[_0xb6d8('0x3')]=0x0;this[_0xb6d8('0x4')]=0x0;this[_0xb6d8('0x5')]=0x0;this[_0xb6d8('0x6')]=0x0;this['message']='';this[_0xb6d8('0x7')]=!![];this[_0xb6d8('0x8')]=_0x1e83fb[_0xb6d8('0x8')];this[_0xb6d8('0x9')]=_0x1e83fb[_0xb6d8('0x9')];this[_0xb6d8('0xa')]=_0x1e83fb[_0xb6d8('0xa')]||null;this[_0xb6d8('0xb')]=_0x1e83fb[_0xb6d8('0xb')]?_0x1e83fb['dialGlobalInterval']:null;this[_0xb6d8('0xc')]=_0x1e83fb[_0xb6d8('0xc')];this['dialOriginateCallerIdNumber']=_0x1e83fb[_0xb6d8('0xd')];this[_0xb6d8('0xe')]=_0x1e83fb[_0xb6d8('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x1e83fb[_0xb6d8('0xf')];this[_0xb6d8('0x10')]=_0x1e83fb[_0xb6d8('0x10')];this[_0xb6d8('0x11')]=_0x1e83fb[_0xb6d8('0x11')];this[_0xb6d8('0x12')]=_0x1e83fb[_0xb6d8('0x12')];this[_0xb6d8('0x13')]=_0x1e83fb[_0xb6d8('0x13')];this[_0xb6d8('0x14')]=_0x1e83fb['dialNoAnswerRetryFrequency'];this[_0xb6d8('0x15')]=_0x1e83fb[_0xb6d8('0x15')];this[_0xb6d8('0x16')]=_0x1e83fb[_0xb6d8('0x16')]||0x3;this[_0xb6d8('0x17')]=_0x1e83fb['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x1e83fb[_0xb6d8('0x18')]||0x3;this[_0xb6d8('0x19')]=_0x1e83fb[_0xb6d8('0x19')]||0x96;this[_0xb6d8('0x1a')]=_0x1e83fb[_0xb6d8('0x1a')]||0x3;this[_0xb6d8('0x1b')]=_0x1e83fb['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x1e83fb[_0xb6d8('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x1e83fb[_0xb6d8('0x1d')]||0x96;this[_0xb6d8('0x1e')]=_0x1e83fb[_0xb6d8('0x1e')]||0x3;this[_0xb6d8('0x1f')]=_0x1e83fb[_0xb6d8('0x1f')]||0x96;this[_0xb6d8('0x20')]=_0x1e83fb[_0xb6d8('0x20')]||_0xb6d8('0x21');this[_0xb6d8('0x22')]=_0x1e83fb[_0xb6d8('0x22')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1e83fb['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x1e83fb[_0xb6d8('0x23')]||undefined;this['TrunkBackup']=_0x1e83fb[_0xb6d8('0x24')]?_0x1e83fb[_0xb6d8('0x24')]:undefined;this[_0xb6d8('0x25')]=_0x1e83fb[_0xb6d8('0x25')]?_0x1e83fb[_0xb6d8('0x25')]:undefined;this[_0xb6d8('0x26')]=_0x1e83fb[_0xb6d8('0x26')]?_0x1e83fb[_0xb6d8('0x26')]:undefined;this[_0xb6d8('0x27')]=_0x1e83fb[_0xb6d8('0x27')]?_0x1e83fb[_0xb6d8('0x27')]:undefined;this['dialQueueProject']=_0x1e83fb[_0xb6d8('0x27')]?_0x1e83fb['SquareProject']['name']:undefined;this[_0xb6d8('0x28')]=_0x1e83fb['dialAMDActive']||![];this[_0xb6d8('0x29')]=_0x1e83fb[_0xb6d8('0x29')];this[_0xb6d8('0x2a')]=_0x1e83fb[_0xb6d8('0x2a')];this['dialAMDAfterGreetingSilence']=_0x1e83fb['dialAMDAfterGreetingSilence'];this[_0xb6d8('0x2b')]=_0x1e83fb[_0xb6d8('0x2b')];this[_0xb6d8('0x2c')]=_0x1e83fb[_0xb6d8('0x2c')];this['dialAMDBetweenWordsSilence']=_0x1e83fb[_0xb6d8('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x1e83fb[_0xb6d8('0x2e')];this['dialAMDSilenceThreshold']=_0x1e83fb[_0xb6d8('0x2f')];this[_0xb6d8('0x30')]=_0x1e83fb['dialAMDMaximumWordLength'];}module[_0xb6d8('0x31')]=Campaign; \ No newline at end of file +var _0x2152=['type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name'];(function(_0x321413,_0xb44e1e){var _0x402614=function(_0x2cadf9){while(--_0x2cadf9){_0x321413['push'](_0x321413['shift']());}};_0x402614(++_0xb44e1e);}(_0x2152,0x1b8));var _0x2215=function(_0x33db98,_0x57c298){_0x33db98=_0x33db98-0x0;var _0x16412d=_0x2152[_0x33db98];return _0x16412d;};'use strict';function Campaign(_0xfecdd3){this['id']=_0xfecdd3['id']||0x0;this[_0x2215('0x0')]=_0xfecdd3[_0x2215('0x0')]||'';this[_0x2215('0x1')]=_0xfecdd3[_0x2215('0x1')]||_0x2215('0x2');this['originated']=0x0;this[_0x2215('0x3')]=0x0;this[_0x2215('0x4')]=0x0;this[_0x2215('0x5')]=0x0;this[_0x2215('0x6')]='';this[_0x2215('0x7')]=!![];this[_0x2215('0x8')]=_0xfecdd3[_0x2215('0x8')];this[_0x2215('0x9')]=_0xfecdd3[_0x2215('0x9')];this['dialTimezone']=_0xfecdd3['dialTimezone']||null;this[_0x2215('0xa')]=_0xfecdd3['dialGlobalInterval']?_0xfecdd3[_0x2215('0xa')]:null;this[_0x2215('0xb')]=_0xfecdd3[_0x2215('0xb')];this[_0x2215('0xc')]=_0xfecdd3['dialOriginateCallerIdNumber'];this[_0x2215('0xd')]=_0xfecdd3['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0xfecdd3[_0x2215('0xe')];this['dialCongestionRetryFrequency']=_0xfecdd3[_0x2215('0xf')];this[_0x2215('0x10')]=_0xfecdd3['dialBusyMaxRetry'];this[_0x2215('0x11')]=_0xfecdd3[_0x2215('0x11')];this['dialNoAnswerMaxRetry']=_0xfecdd3[_0x2215('0x12')];this[_0x2215('0x13')]=_0xfecdd3[_0x2215('0x13')];this['dialGlobalMaxRetry']=_0xfecdd3[_0x2215('0x14')];this['dialNoSuchNumberMaxRetry']=_0xfecdd3[_0x2215('0x15')]||0x3;this[_0x2215('0x16')]=_0xfecdd3['dialNoSuchNumberRetryFrequency']||0x96;this[_0x2215('0x17')]=_0xfecdd3[_0x2215('0x17')]||0x3;this[_0x2215('0x18')]=_0xfecdd3[_0x2215('0x18')]||0x96;this[_0x2215('0x19')]=_0xfecdd3[_0x2215('0x19')]||0x3;this[_0x2215('0x1a')]=_0xfecdd3[_0x2215('0x1a')]||0x96;this['dialMachineMaxRetry']=_0xfecdd3['dialMachineMaxRetry']||0x3;this[_0x2215('0x1b')]=_0xfecdd3[_0x2215('0x1b')]||0x96;this[_0x2215('0x1c')]=_0xfecdd3[_0x2215('0x1c')]||0x3;this[_0x2215('0x1d')]=_0xfecdd3[_0x2215('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0xfecdd3['dialOrderByScheduledAt']||_0x2215('0x1e');this[_0x2215('0x1f')]=_0xfecdd3['dialPrefix']||undefined;this[_0x2215('0x20')]=_0xfecdd3[_0x2215('0x20')]||undefined;this[_0x2215('0x21')]=_0xfecdd3['dialCutDigit']||undefined;this[_0x2215('0x22')]=_0xfecdd3[_0x2215('0x22')]?_0xfecdd3[_0x2215('0x22')]:undefined;this[_0x2215('0x23')]=_0xfecdd3[_0x2215('0x23')]?_0xfecdd3[_0x2215('0x23')]:undefined;this[_0x2215('0x24')]=_0xfecdd3[_0x2215('0x24')]?_0xfecdd3[_0x2215('0x24')]:undefined;this['SquareProject']=_0xfecdd3[_0x2215('0x25')]?_0xfecdd3[_0x2215('0x25')]:undefined;this['dialQueueProject']=_0xfecdd3['SquareProject']?_0xfecdd3[_0x2215('0x25')][_0x2215('0x0')]:undefined;this[_0x2215('0x26')]=_0xfecdd3[_0x2215('0x26')]||![];this[_0x2215('0x27')]=_0xfecdd3[_0x2215('0x27')];this[_0x2215('0x28')]=_0xfecdd3[_0x2215('0x28')];this[_0x2215('0x29')]=_0xfecdd3[_0x2215('0x29')];this[_0x2215('0x2a')]=_0xfecdd3[_0x2215('0x2a')];this[_0x2215('0x2b')]=_0xfecdd3[_0x2215('0x2b')];this[_0x2215('0x2c')]=_0xfecdd3['dialAMDBetweenWordsSilence'];this[_0x2215('0x2d')]=_0xfecdd3[_0x2215('0x2d')];this[_0x2215('0x2e')]=_0xfecdd3['dialAMDSilenceThreshold'];this[_0x2215('0x2f')]=_0xfecdd3['dialAMDMaximumWordLength'];}module[_0x2215('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 097c87c..15afb98 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 _0xc306=['unmanaged','abandoned','lastdata','duration','billableseconds','type','monitor','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','linkedid','exten','answered','answertime','endtime'];(function(_0x49d340,_0x5dd793){var _0x33a20c=function(_0x4780a2){while(--_0x4780a2){_0x49d340['push'](_0x49d340['shift']());}};_0x33a20c(++_0x5dd793);}(_0xc306,0x1a9));var _0x6c30=function(_0x82fc46,_0x3381e9){_0x82fc46=_0x82fc46-0x0;var _0x3c31d4=_0xc306[_0x82fc46];return _0x3c31d4;};'use strict';function Channel(){this[_0x6c30('0x0')]=null;this['channel']='';this[_0x6c30('0x1')]='';this[_0x6c30('0x2')]=0x0;this[_0x6c30('0x3')]='';this[_0x6c30('0x4')]=undefined;this[_0x6c30('0x5')]=undefined;this['accountcode']=0x0;this[_0x6c30('0x6')]='';this['uniqueid']=0x0;this[_0x6c30('0x7')]=0x0;this[_0x6c30('0x8')]=0x0;this[_0x6c30('0x9')]=![];this[_0x6c30('0xa')]=null;this[_0x6c30('0xb')]=null;this[_0x6c30('0xc')]=![];this[_0x6c30('0xd')]=![];this['lastapplication']='';this[_0x6c30('0xe')]='';this[_0x6c30('0xf')]=0x0;this[_0x6c30('0x10')]=0x0;this['holdtime']=0x0;this[_0x6c30('0x11')]=null;this['tag']=null;this['disposition']=null;this[_0x6c30('0x12')]=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this[_0x6c30('0x13')]=undefined;this[_0x6c30('0x14')]=undefined;this[_0x6c30('0x15')]=undefined;this['mohtime']=0x0;}module[_0x6c30('0x16')]=Channel; \ No newline at end of file +var _0xfbbb=['lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','exten','answertime','endtime','unmanaged'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x310000,_0x243af6){_0x310000=_0x310000-0x0;var _0x4cf475=_0xfbbb[_0x310000];return _0x4cf475;};'use strict';function Channel(){this[_0xbfbb('0x0')]=null;this[_0xbfbb('0x1')]='';this[_0xbfbb('0x2')]='';this[_0xbfbb('0x3')]=0x0;this[_0xbfbb('0x4')]='';this[_0xbfbb('0x5')]=undefined;this[_0xbfbb('0x6')]=undefined;this[_0xbfbb('0x7')]=0x0;this[_0xbfbb('0x8')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0xbfbb('0x9')]=0x0;this['answered']=![];this[_0xbfbb('0xa')]=null;this[_0xbfbb('0xb')]=null;this[_0xbfbb('0xc')]=![];this['abandoned']=![];this[_0xbfbb('0xd')]='';this[_0xbfbb('0xe')]='';this[_0xbfbb('0xf')]=0x0;this[_0xbfbb('0x10')]=0x0;this[_0xbfbb('0x11')]=0x0;this[_0xbfbb('0x12')]=null;this['tag']=null;this[_0xbfbb('0x13')]=null;this[_0xbfbb('0x14')]=![];this[_0xbfbb('0x15')]=null;this[_0xbfbb('0x16')]=null;this['monitors']=[];this[_0xbfbb('0x17')]=undefined;this[_0xbfbb('0x18')]=undefined;this[_0xbfbb('0x19')]=undefined;this[_0xbfbb('0x1a')]=0x0;}module[_0xbfbb('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 42bcb8f..a4d40b0 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 _0x54b9=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x54b9,0x192));var _0x954b=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x54b9[_0x15bc81];return _0x59440e;};'use strict';function DeskAccount(_0x379e0f){this['id']=_0x379e0f['id']||0x0;this[_0x954b('0x0')]=_0x379e0f[_0x954b('0x0')]||'';this[_0x954b('0x1')]=_0x379e0f[_0x954b('0x1')]||'';this['remoteUri']=_0x379e0f[_0x954b('0x2')]||'';this['authType']=_0x379e0f[_0x954b('0x3')]||'';this['password']=_0x379e0f[_0x954b('0x4')]||'';this['consumerKey']=_0x379e0f[_0x954b('0x5')]||'';this[_0x954b('0x6')]=_0x379e0f['consumerSecret']||'';this[_0x954b('0x7')]=_0x379e0f[_0x954b('0x7')]||'';this[_0x954b('0x8')]=_0x379e0f[_0x954b('0x8')]||'';this[_0x954b('0x9')]=_0x379e0f[_0x954b('0x9')]||'';this[_0x954b('0xa')]=_0x379e0f[_0x954b('0xa')]||'';this[_0x954b('0xb')]=_0x379e0f[_0x954b('0xb')]||{};}module[_0x954b('0xc')]=DeskAccount; \ No newline at end of file +var _0x0e37=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x294cf1,_0x5d6a40){var _0x334402=function(_0x5b07f0){while(--_0x5b07f0){_0x294cf1['push'](_0x294cf1['shift']());}};_0x334402(++_0x5d6a40);}(_0x0e37,0x91));var _0x70e3=function(_0x4698d5,_0x210f61){_0x4698d5=_0x4698d5-0x0;var _0x58de76=_0x0e37[_0x4698d5];return _0x58de76;};'use strict';function DeskAccount(_0x4df7d3){this['id']=_0x4df7d3['id']||0x0;this[_0x70e3('0x0')]=_0x4df7d3[_0x70e3('0x0')]||'';this[_0x70e3('0x1')]=_0x4df7d3[_0x70e3('0x1')]||'';this[_0x70e3('0x2')]=_0x4df7d3[_0x70e3('0x2')]||'';this[_0x70e3('0x3')]=_0x4df7d3[_0x70e3('0x3')]||'';this[_0x70e3('0x4')]=_0x4df7d3[_0x70e3('0x4')]||'';this[_0x70e3('0x5')]=_0x4df7d3['consumerKey']||'';this[_0x70e3('0x6')]=_0x4df7d3[_0x70e3('0x6')]||'';this[_0x70e3('0x7')]=_0x4df7d3['token']||'';this[_0x70e3('0x8')]=_0x4df7d3[_0x70e3('0x8')]||'';this[_0x70e3('0x9')]=_0x4df7d3[_0x70e3('0x9')]||'';this[_0x70e3('0xa')]=_0x4df7d3['serverUrl']||'';this[_0x70e3('0xb')]=_0x4df7d3[_0x70e3('0xb')]||{};}module[_0x70e3('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index b58ac46..fd4d9e8 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 _0xa1d3=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','name'];(function(_0x4797a3,_0x1fdb72){var _0x560fe6=function(_0x2479ab){while(--_0x2479ab){_0x4797a3['push'](_0x4797a3['shift']());}};_0x560fe6(++_0x1fdb72);}(_0xa1d3,0x77));var _0x3a1d=function(_0x2ce08c,_0x58ce90){_0x2ce08c=_0x2ce08c-0x0;var _0x3db6bd=_0xa1d3[_0x2ce08c];return _0x3db6bd;};'use strict';function Dynamics365Account(_0x43b8f9){this['id']=_0x43b8f9['id']||0x0;this[_0x3a1d('0x0')]=_0x43b8f9[_0x3a1d('0x0')]||'';this[_0x3a1d('0x1')]=_0x43b8f9[_0x3a1d('0x1')]||'';this[_0x3a1d('0x2')]=_0x43b8f9[_0x3a1d('0x2')]||'';this[_0x3a1d('0x3')]=_0x43b8f9[_0x3a1d('0x3')]||'';this[_0x3a1d('0x4')]=_0x43b8f9[_0x3a1d('0x4')]||'';this[_0x3a1d('0x5')]=_0x43b8f9[_0x3a1d('0x5')]||'';this[_0x3a1d('0x6')]=_0x43b8f9[_0x3a1d('0x6')]||{};this[_0x3a1d('0x7')]=_0x43b8f9['serverUrl']||'';this['modernAuthentication']=_0x43b8f9[_0x3a1d('0x8')]||![];this[_0x3a1d('0x9')]=_0x43b8f9[_0x3a1d('0x9')]||{};this['CloudProvider']=_0x43b8f9['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xed41=['CloudProvider','exports','name','username','password','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x3acb38,_0x2659ea){var _0x432750=function(_0x2fb773){while(--_0x2fb773){_0x3acb38['push'](_0x3acb38['shift']());}};_0x432750(++_0x2659ea);}(_0xed41,0x70));var _0x1ed4=function(_0x9a358b,_0xfef999){_0x9a358b=_0x9a358b-0x0;var _0x3d89e6=_0xed41[_0x9a358b];return _0x3d89e6;};'use strict';function Dynamics365Account(_0x19a415){this['id']=_0x19a415['id']||0x0;this[_0x1ed4('0x0')]=_0x19a415[_0x1ed4('0x0')]||'';this[_0x1ed4('0x1')]=_0x19a415[_0x1ed4('0x1')]||'';this[_0x1ed4('0x2')]=_0x19a415[_0x1ed4('0x2')]||'';this['remoteUri']=_0x19a415['remoteUri']||'';this[_0x1ed4('0x3')]=_0x19a415['tenantId']||'';this['clientId']=_0x19a415[_0x1ed4('0x4')]||'';this[_0x1ed4('0x5')]=_0x19a415[_0x1ed4('0x5')]||{};this[_0x1ed4('0x6')]=_0x19a415['serverUrl']||'';this[_0x1ed4('0x7')]=_0x19a415[_0x1ed4('0x7')]||![];this['Configurations']=_0x19a415[_0x1ed4('0x8')]||{};this['CloudProvider']=_0x19a415[_0x1ed4('0x9')]||{};}module[_0x1ed4('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 0f644b3..c995a70 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 _0x4700=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x2b7440,_0x2f6e35){var _0x4829fa=function(_0x412f53){while(--_0x412f53){_0x2b7440['push'](_0x2b7440['shift']());}};_0x4829fa(++_0x2f6e35);}(_0x4700,0x15d));var _0x0470=function(_0x102a8f,_0x435e0a){_0x102a8f=_0x102a8f-0x0;var _0x5170d6=_0x4700[_0x102a8f];return _0x5170d6;};'use strict';function FaxAccount(_0x4fdc8d){this['id']=_0x4fdc8d['id']||0x0;this[_0x0470('0x0')]=_0x4fdc8d[_0x0470('0x0')]||'';this['description']=_0x4fdc8d[_0x0470('0x1')];this[_0x0470('0x2')]=_0x4fdc8d[_0x0470('0x2')];this[_0x0470('0x3')]=_0x4fdc8d[_0x0470('0x3')];this['localstationid']=_0x4fdc8d[_0x0470('0x4')];this[_0x0470('0x5')]=_0x4fdc8d[_0x0470('0x5')]||0x960;this['maxrate']=_0x4fdc8d[_0x0470('0x6')]||0x3840;this[_0x0470('0x7')]=_0x4fdc8d[_0x0470('0x7')]||_0x0470('0x8');this[_0x0470('0x9')]=_0x4fdc8d[_0x0470('0x9')]||'no';this[_0x0470('0xa')]=_0x4fdc8d[_0x0470('0xa')]||'no';this[_0x0470('0xb')]=_0x4fdc8d[_0x0470('0xb')]||0x1388;this[_0x0470('0xc')]=_0x4fdc8d[_0x0470('0xc')]||_0x0470('0xd');this[_0x0470('0xe')]=_0x4fdc8d[_0x0470('0xe')]?_0x4fdc8d[_0x0470('0xe')]:undefined;this[_0x0470('0xf')]=_0x4fdc8d['ListId'];this['key']=_0x4fdc8d['key'];}module[_0x0470('0x10')]=FaxAccount; \ No newline at end of file +var _0x6149=['v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','key','exports','description','ecm','headerinfo','localstationid','minrate','modem'];(function(_0x235ad6,_0x5e4437){var _0x2885d9=function(_0x3e55ba){while(--_0x3e55ba){_0x235ad6['push'](_0x235ad6['shift']());}};_0x2885d9(++_0x5e4437);}(_0x6149,0x112));var _0x9614=function(_0x309413,_0x3dab56){_0x309413=_0x309413-0x0;var _0x160d62=_0x6149[_0x309413];return _0x160d62;};'use strict';function FaxAccount(_0x3f6374){this['id']=_0x3f6374['id']||0x0;this['name']=_0x3f6374['name']||'';this[_0x9614('0x0')]=_0x3f6374[_0x9614('0x0')];this['ecm']=_0x3f6374[_0x9614('0x1')];this[_0x9614('0x2')]=_0x3f6374[_0x9614('0x2')];this[_0x9614('0x3')]=_0x3f6374['localstationid'];this[_0x9614('0x4')]=_0x3f6374[_0x9614('0x4')]||0x960;this['maxrate']=_0x3f6374['maxrate']||0x3840;this[_0x9614('0x5')]=_0x3f6374['modem']||_0x9614('0x6');this[_0x9614('0x7')]=_0x3f6374[_0x9614('0x7')]||'no';this[_0x9614('0x8')]=_0x3f6374[_0x9614('0x8')]||'no';this['t38timeout']=_0x3f6374[_0x9614('0x9')]||0x1388;this['tech']=_0x3f6374['tech']||_0x9614('0xa');this[_0x9614('0xb')]=_0x3f6374[_0x9614('0xb')]?_0x3f6374[_0x9614('0xb')]:undefined;this['ListId']=_0x3f6374['ListId'];this[_0x9614('0xc')]=_0x3f6374[_0x9614('0xc')];}module[_0x9614('0xd')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 1d87a2e..3bb1832 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 _0xd99d=['Configurations','exports','name','username','remoteUri'];(function(_0x572323,_0x22a96d){var _0x27fe0a=function(_0x55641b){while(--_0x55641b){_0x572323['push'](_0x572323['shift']());}};_0x27fe0a(++_0x22a96d);}(_0xd99d,0xcf));var _0xdd99=function(_0x440c21,_0x8ee17){_0x440c21=_0x440c21-0x0;var _0x1584aa=_0xd99d[_0x440c21];return _0x1584aa;};'use strict';function FreshdeskAccount(_0x441f07){this['id']=_0x441f07['id']||0x0;this[_0xdd99('0x0')]=_0x441f07[_0xdd99('0x0')]||'';this['username']=_0x441f07[_0xdd99('0x1')]||'';this['apiKey']=_0x441f07['token']||'';this[_0xdd99('0x2')]=_0x441f07[_0xdd99('0x2')]||'';this['serverUrl']=_0x441f07['serverUrl']||'';this[_0xdd99('0x3')]=_0x441f07[_0xdd99('0x3')]||{};}module[_0xdd99('0x4')]=FreshdeskAccount; \ No newline at end of file +var _0xbea6=['username','apiKey','token','remoteUri','serverUrl','exports','name'];(function(_0x548ccb,_0x1fab15){var _0x2f7701=function(_0x92da09){while(--_0x92da09){_0x548ccb['push'](_0x548ccb['shift']());}};_0x2f7701(++_0x1fab15);}(_0xbea6,0xd8));var _0x6bea=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xbea6[_0x40a825];return _0x273a54;};'use strict';function FreshdeskAccount(_0x5ddc0d){this['id']=_0x5ddc0d['id']||0x0;this[_0x6bea('0x0')]=_0x5ddc0d[_0x6bea('0x0')]||'';this[_0x6bea('0x1')]=_0x5ddc0d[_0x6bea('0x1')]||'';this[_0x6bea('0x2')]=_0x5ddc0d[_0x6bea('0x3')]||'';this[_0x6bea('0x4')]=_0x5ddc0d[_0x6bea('0x4')]||'';this[_0x6bea('0x5')]=_0x5ddc0d[_0x6bea('0x5')]||'';this['Configurations']=_0x5ddc0d['Configurations']||{};}module[_0x6bea('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index ddc9a2e..4c56d25 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 _0x4cc7=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x468d12,_0x10ef66){_0x468d12=_0x468d12-0x0;var _0x176a61=_0x4cc7[_0x468d12];return _0x176a61;};'use strict';function FreshsalesAccount(_0x13d27d){this['id']=_0x13d27d['id']||0x0;this[_0x74cc('0x0')]=_0x13d27d[_0x74cc('0x0')]||'';this[_0x74cc('0x1')]=_0x13d27d[_0x74cc('0x1')]||'';this[_0x74cc('0x2')]=_0x13d27d[_0x74cc('0x3')]||'';this[_0x74cc('0x4')]=_0x13d27d['remoteUri']||'';this[_0x74cc('0x5')]=_0x13d27d[_0x74cc('0x5')]||'';this[_0x74cc('0x6')]=_0x13d27d[_0x74cc('0x6')]||{};}module[_0x74cc('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xdc0d=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x2c59d9,_0x9b0a4b){var _0x1dbc30=function(_0x33f765){while(--_0x33f765){_0x2c59d9['push'](_0x2c59d9['shift']());}};_0x1dbc30(++_0x9b0a4b);}(_0xdc0d,0x1db));var _0xddc0=function(_0x442635,_0x5b32c4){_0x442635=_0x442635-0x0;var _0x1ca98a=_0xdc0d[_0x442635];return _0x1ca98a;};'use strict';function FreshsalesAccount(_0x91809d){this['id']=_0x91809d['id']||0x0;this[_0xddc0('0x0')]=_0x91809d['name']||'';this[_0xddc0('0x1')]=_0x91809d['username']||'';this[_0xddc0('0x2')]=_0x91809d[_0xddc0('0x3')]||'';this[_0xddc0('0x4')]=_0x91809d[_0xddc0('0x4')]||'';this[_0xddc0('0x5')]=_0x91809d[_0xddc0('0x5')]||'';this[_0xddc0('0x6')]=_0x91809d[_0xddc0('0x6')]||{};}module[_0xddc0('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 7af8f0b..5ec81e5 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 _0x70b1=['priority','holdtime','motionChannel','voice','variables','exports','inbound','calleridname','queue','position','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','context'];(function(_0x1edf2a,_0x55c423){var _0x5698f0=function(_0x237e51){while(--_0x237e51){_0x1edf2a['push'](_0x1edf2a['shift']());}};_0x5698f0(++_0x55c423);}(_0x70b1,0x195));var _0x170b=function(_0x527bd6,_0x541763){_0x527bd6=_0x527bd6-0x0;var _0xd1aa5b=_0x70b1[_0x527bd6];return _0xd1aa5b;};'use strict';function QueueReport(){this['type']=_0x170b('0x0');this['uniqueid']='';this['calleridnum']='';this[_0x170b('0x1')]='';this[_0x170b('0x2')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x170b('0x3')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x170b('0x4')]=null;this[_0x170b('0x5')]=![];this[_0x170b('0x6')]=null;this[_0x170b('0x7')]=![];this[_0x170b('0x8')]=null;this[_0x170b('0x9')]=0x1;this['channel']='';this[_0x170b('0xa')]='';this[_0x170b('0xb')]='';this['accountcode']='';this[_0x170b('0xc')]='';this['exten']='';this[_0x170b('0xd')]='';this[_0x170b('0xe')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x170b('0xf')]=_0x170b('0x10');this['mohtime']=0x0;this[_0x170b('0x11')]={};}module[_0x170b('0x12')]=QueueReport; \ No newline at end of file +var _0x8eac=['queue','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','voice','mohtime','variables','exports','type','calleridnum','calleridname'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8eac,0x1c5));var _0xc8ea=function(_0x2ac2de,_0x109a1e){_0x2ac2de=_0x2ac2de-0x0;var _0xf453a1=_0x8eac[_0x2ac2de];return _0xf453a1;};'use strict';function QueueReport(){this[_0xc8ea('0x0')]='inbound';this['uniqueid']='';this[_0xc8ea('0x1')]='';this[_0xc8ea('0x2')]='';this[_0xc8ea('0x3')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xc8ea('0x4')]=0x1;this[_0xc8ea('0x5')]=0x1;this[_0xc8ea('0x6')]=![];this[_0xc8ea('0x7')]=null;this['queuecallercomplete']=![];this[_0xc8ea('0x8')]=null;this[_0xc8ea('0x9')]=![];this[_0xc8ea('0xa')]=null;this[_0xc8ea('0xb')]=0x1;this[_0xc8ea('0xc')]='';this[_0xc8ea('0xd')]='';this[_0xc8ea('0xe')]='';this[_0xc8ea('0xf')]='';this['context']='';this[_0xc8ea('0x10')]='';this[_0xc8ea('0x11')]='';this[_0xc8ea('0x12')]=0x0;this[_0xc8ea('0x13')]=![];this['lastAssignedTo']='';this['motionChannel']=_0xc8ea('0x14');this[_0xc8ea('0x15')]=0x0;this[_0xc8ea('0x16')]={};}module[_0xc8ea('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 417e844..2c8a7f3 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 _0x4744=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri'];(function(_0x5b1d45,_0x1bc88f){var _0x2b8d39=function(_0x3542d6){while(--_0x3542d6){_0x5b1d45['push'](_0x5b1d45['shift']());}};_0x2b8d39(++_0x1bc88f);}(_0x4744,0x152));var _0x4474=function(_0x5c65a9,_0x5411f9){_0x5c65a9=_0x5c65a9-0x0;var _0x1436bb=_0x4744[_0x5c65a9];return _0x1436bb;};'use strict';function SalesforceAccount(_0x160043){this['id']=_0x160043['id']||0x0;this[_0x4474('0x0')]=_0x160043[_0x4474('0x0')]||'';this[_0x4474('0x1')]=_0x160043[_0x4474('0x1')]||'';this[_0x4474('0x2')]=_0x160043[_0x4474('0x2')]||'';this['password']=_0x160043[_0x4474('0x3')]||'';this[_0x4474('0x4')]=_0x160043[_0x4474('0x4')]||'';this[_0x4474('0x5')]=_0x160043[_0x4474('0x5')]||'';this[_0x4474('0x6')]=_0x160043[_0x4474('0x6')]||'';this[_0x4474('0x7')]=_0x160043['type']||_0x4474('0x8');this[_0x4474('0x9')]=_0x160043['serverUrl']||'';this[_0x4474('0xa')]=_0x160043[_0x4474('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xb9f4=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','securityToken','type'];(function(_0x4498a2,_0x143689){var _0x411aa8=function(_0x1a85dc){while(--_0x1a85dc){_0x4498a2['push'](_0x4498a2['shift']());}};_0x411aa8(++_0x143689);}(_0xb9f4,0x101));var _0x4b9f=function(_0x2f5afc,_0x3abe62){_0x2f5afc=_0x2f5afc-0x0;var _0x455890=_0xb9f4[_0x2f5afc];return _0x455890;};'use strict';function SalesforceAccount(_0x35f5a6){this['id']=_0x35f5a6['id']||0x0;this['name']=_0x35f5a6[_0x4b9f('0x0')]||'';this[_0x4b9f('0x1')]=_0x35f5a6['username']||'';this[_0x4b9f('0x2')]=_0x35f5a6[_0x4b9f('0x2')]||'';this[_0x4b9f('0x3')]=_0x35f5a6[_0x4b9f('0x3')]||'';this[_0x4b9f('0x4')]=_0x35f5a6[_0x4b9f('0x4')]||'';this['clientSecret']=_0x35f5a6['clientSecret']||'';this[_0x4b9f('0x5')]=_0x35f5a6[_0x4b9f('0x5')]||'';this[_0x4b9f('0x6')]=_0x35f5a6[_0x4b9f('0x6')]||_0x4b9f('0x7');this['serverUrl']=_0x35f5a6[_0x4b9f('0x8')]||'';this[_0x4b9f('0x9')]=_0x35f5a6[_0x4b9f('0x9')]||{};}module[_0x4b9f('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 6f9843e..22b6e01 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 _0xa7f0=['password','serverUrl','Configurations','name'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0xa7f0,0x1c7));var _0x0a7f=function(_0x1fd838,_0x584cc8){_0x1fd838=_0x1fd838-0x0;var _0x313172=_0xa7f0[_0x1fd838];return _0x313172;};'use strict';function ServicenowAccount(_0x2a68b0){this['id']=_0x2a68b0['id']||0x0;this[_0x0a7f('0x0')]=_0x2a68b0[_0x0a7f('0x0')]||'';this['username']=_0x2a68b0['username']||'';this[_0x0a7f('0x1')]=_0x2a68b0[_0x0a7f('0x1')]||'';this['remoteUri']=_0x2a68b0['remoteUri']||'';this[_0x0a7f('0x2')]=_0x2a68b0[_0x0a7f('0x2')]||'';this[_0x0a7f('0x3')]=_0x2a68b0[_0x0a7f('0x3')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x5848=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4a8b72,_0xb54e90){var _0x217237=function(_0x1d8f76){while(--_0x1d8f76){_0x4a8b72['push'](_0x4a8b72['shift']());}};_0x217237(++_0xb54e90);}(_0x5848,0x102));var _0x8584=function(_0x100f09,_0x296c63){_0x100f09=_0x100f09-0x0;var _0x4e25dc=_0x5848[_0x100f09];return _0x4e25dc;};'use strict';function ServicenowAccount(_0x7847e1){this['id']=_0x7847e1['id']||0x0;this[_0x8584('0x0')]=_0x7847e1[_0x8584('0x0')]||'';this[_0x8584('0x1')]=_0x7847e1[_0x8584('0x1')]||'';this['password']=_0x7847e1[_0x8584('0x2')]||'';this[_0x8584('0x3')]=_0x7847e1[_0x8584('0x3')]||'';this[_0x8584('0x4')]=_0x7847e1[_0x8584('0x4')]||'';this[_0x8584('0x5')]=_0x7847e1['Configurations']||{};}module[_0x8584('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 f1fa85d..667429f 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 _0x5336=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x107afe,_0x1f22f2){var _0x119487=function(_0x96327b){while(--_0x96327b){_0x107afe['push'](_0x107afe['shift']());}};_0x119487(++_0x1f22f2);}(_0x5336,0x190));var _0x6533=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5336[_0x17d9e3];return _0x14192d;};'use strict';function SugarcrmAccount(_0x58dac3){this['id']=_0x58dac3['id']||0x0;this[_0x6533('0x0')]=_0x58dac3['name']||'';this['username']=_0x58dac3['username']||'';this[_0x6533('0x1')]=_0x58dac3[_0x6533('0x1')]||'';this[_0x6533('0x2')]=_0x58dac3[_0x6533('0x2')]||'';this[_0x6533('0x3')]=_0x58dac3[_0x6533('0x3')]||'';this[_0x6533('0x4')]=_0x58dac3[_0x6533('0x4')]||{};}module[_0x6533('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xf168=['serverUrl','Configurations','username','password','remoteUri'];(function(_0xd9e788,_0x479b3e){var _0x23071e=function(_0x59bfcc){while(--_0x59bfcc){_0xd9e788['push'](_0xd9e788['shift']());}};_0x23071e(++_0x479b3e);}(_0xf168,0x1ce));var _0x8f16=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xf168[_0x4fc9e6];return _0x551d28;};'use strict';function SugarcrmAccount(_0x480444){this['id']=_0x480444['id']||0x0;this['name']=_0x480444['name']||'';this[_0x8f16('0x0')]=_0x480444['username']||'';this[_0x8f16('0x1')]=_0x480444[_0x8f16('0x1')]||'';this[_0x8f16('0x2')]=_0x480444[_0x8f16('0x2')]||'';this[_0x8f16('0x3')]=_0x480444[_0x8f16('0x3')]||'';this['Configurations']=_0x480444[_0x8f16('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index a501152..a099254 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 _0x119c=['status','unknown','exports','name','accountcode','state','stateTime'];(function(_0x275c28,_0x480425){var _0x29c07d=function(_0x2012d0){while(--_0x2012d0){_0x275c28['push'](_0x275c28['shift']());}};_0x29c07d(++_0x480425);}(_0x119c,0xea));var _0xc119=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x119c[_0x467488];return _0x56107f;};'use strict';function Telephone(_0x1a596d){this['id']=_0x1a596d['id']||0x0;this[_0xc119('0x0')]=_0x1a596d['name']||'';this[_0xc119('0x1')]=_0x1a596d[_0xc119('0x1')]||'';this[_0xc119('0x2')]='unknown';this[_0xc119('0x3')]=0x0;this[_0xc119('0x4')]=_0xc119('0x5');this['address']='';}module[_0xc119('0x6')]=Telephone; \ No newline at end of file +var _0x8228=['accountcode','state','unknown','status','address','exports'];(function(_0x268396,_0x864c1c){var _0x2d7b5d=function(_0x4a3a6a){while(--_0x4a3a6a){_0x268396['push'](_0x268396['shift']());}};_0x2d7b5d(++_0x864c1c);}(_0x8228,0xae));var _0x8822=function(_0x391d73,_0x5a211e){_0x391d73=_0x391d73-0x0;var _0x3ce614=_0x8228[_0x391d73];return _0x3ce614;};'use strict';function Telephone(_0x5bef17){this['id']=_0x5bef17['id']||0x0;this['name']=_0x5bef17['name']||'';this['accountcode']=_0x5bef17[_0x8822('0x0')]||'';this[_0x8822('0x1')]=_0x8822('0x2');this['stateTime']=0x0;this[_0x8822('0x3')]='unknown';this[_0x8822('0x4')]='';}module[_0x8822('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 7f8ff0f..9c7f8cd 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(_0x240ca0,_0x3ea2b4){var _0x1ce1e9=function(_0x2c228b){while(--_0x2c228b){_0x240ca0['push'](_0x240ca0['shift']());}};_0x1ce1e9(++_0x3ea2b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x35d8da,_0x4a20c3){var _0x162d7a=function(_0x52cd17){while(--_0x52cd17){_0x35d8da['push'](_0x35d8da['shift']());}};_0x162d7a(++_0x4a20c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x7ba032,_0x19c3ae){_0x7ba032=_0x7ba032-0x0;var _0x255dee=_0xb10b[_0x7ba032];return _0x255dee;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index c410611..80d992f 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x3556db,_0x1c1c4b){var _0x510337=function(_0x587010){while(--_0x587010){_0x3556db['push'](_0x3556db['shift']());}};_0x510337(++_0x1c1c4b);}(_0x8603,0x190));var _0x3860=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x8603[_0x516927];return _0x30749b;};'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 +var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0x5eb8,0xb0));var _0x85eb=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x5eb8[_0x163040];return _0x364667;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 21185cf..76b54a0 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 _0x11c7=['stateRegistry','registrationtime','address','defaultuser','active','name','state','stateTime','status','unknown','registry','indexOf','port','domain','domainport','refresh'];(function(_0x40da2f,_0x37e0cb){var _0x416bba=function(_0x39580a){while(--_0x39580a){_0x40da2f['push'](_0x40da2f['shift']());}};_0x416bba(++_0x37e0cb);}(_0x11c7,0x184));var _0x711c=function(_0x5ab4c6,_0x22d226){_0x5ab4c6=_0x5ab4c6-0x0;var _0x26495f=_0x11c7[_0x5ab4c6];return _0x26495f;};'use strict';function Trunk(_0x179750){this['id']=_0x179750['id']||0x0;this[_0x711c('0x0')]=_0x179750[_0x711c('0x0')]||![];this[_0x711c('0x1')]=_0x179750[_0x711c('0x1')]||'';this[_0x711c('0x2')]='unknown';this[_0x711c('0x3')]=0x0;this[_0x711c('0x4')]=_0x711c('0x5');this[_0x711c('0x6')]=_0x179750[_0x711c('0x6')]&&_0x179750['registry'][_0x711c('0x7')](':')?_0x179750[_0x711c('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0x711c('0x8')]='';this[_0x711c('0x9')]='';this[_0x711c('0xa')]='';this[_0x711c('0xb')]='';this[_0x711c('0xc')]='unknown';this[_0x711c('0xd')]='';this[_0x711c('0xe')]='';this[_0x711c('0xf')]=_0x179750[_0x711c('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xd130=['domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port'];(function(_0x2e32ef,_0x42a592){var _0x228911=function(_0x39ccbe){while(--_0x39ccbe){_0x2e32ef['push'](_0x2e32ef['shift']());}};_0x228911(++_0x42a592);}(_0xd130,0x127));var _0x0d13=function(_0x55eb48,_0x2df049){_0x55eb48=_0x55eb48-0x0;var _0x434f97=_0xd130[_0x55eb48];return _0x434f97;};'use strict';function Trunk(_0x429967){this['id']=_0x429967['id']||0x0;this['active']=_0x429967[_0x0d13('0x0')]||![];this[_0x0d13('0x1')]=_0x429967[_0x0d13('0x1')]||'';this[_0x0d13('0x2')]=_0x0d13('0x3');this[_0x0d13('0x4')]=0x0;this[_0x0d13('0x5')]=_0x0d13('0x3');this[_0x0d13('0x6')]=_0x429967[_0x0d13('0x6')]&&_0x429967[_0x0d13('0x6')][_0x0d13('0x7')](':')?_0x429967['registry'][_0x0d13('0x8')](':')[0x0]:'';this[_0x0d13('0x9')]='';this[_0x0d13('0xa')]='';this[_0x0d13('0xb')]='';this[_0x0d13('0xc')]='';this[_0x0d13('0xd')]='';this[_0x0d13('0xe')]=_0x0d13('0x3');this[_0x0d13('0xf')]='';this[_0x0d13('0x10')]='';this[_0x0d13('0x11')]=_0x429967[_0x0d13('0x11')]||'';}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 82b4ecf..400647f 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 _0xcbf4=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x1798cb,_0xafe39f){var _0x4a68ed=function(_0x2e9265){while(--_0x2e9265){_0x1798cb['push'](_0x1798cb['shift']());}};_0x4a68ed(++_0xafe39f);}(_0xcbf4,0xc2));var _0x4cbf=function(_0x1d9362,_0x358c28){_0x1d9362=_0x1d9362-0x0;var _0x3abf6c=_0xcbf4[_0x1d9362];return _0x3abf6c;};'use strict';function voiceExtension(_0x5dddfc){this['id']=_0x5dddfc['id']||0x0;this[_0x4cbf('0x0')]=_0x5dddfc[_0x4cbf('0x0')]||'';this['recordingFormat']=_0x5dddfc[_0x4cbf('0x1')]||_0x4cbf('0x2');this[_0x4cbf('0x3')]=_0x5dddfc[_0x4cbf('0x3')]||![];}module[_0x4cbf('0x4')]=voiceExtension; \ No newline at end of file +var _0x7297=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0x7297,0x8d));var _0x7729=function(_0x10e42a,_0x3d64d1){_0x10e42a=_0x10e42a-0x0;var _0x54a9b7=_0x7297[_0x10e42a];return _0x54a9b7;};'use strict';function voiceExtension(_0x5e88df){this['id']=_0x5e88df['id']||0x0;this[_0x7729('0x0')]=_0x5e88df[_0x7729('0x0')]||'';this['recordingFormat']=_0x5e88df[_0x7729('0x1')]||_0x7729('0x2');this[_0x7729('0x3')]=_0x5e88df[_0x7729('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 56e60e6..ccef015 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 _0x0dbc=['dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0xb79b5f,_0x1097ec){var _0x461681=function(_0x2c2661){while(--_0x2c2661){_0xb79b5f['push'](_0xb79b5f['shift']());}};_0x461681(++_0x1097ec);}(_0x0dbc,0x1a1));var _0xc0db=function(_0x14b1e9,_0xdef18c){_0x14b1e9=_0x14b1e9-0x0;var _0x132088=_0x0dbc[_0x14b1e9];return _0x132088;};'use strict';var statusDesc=[_0xc0db('0x0'),_0xc0db('0x1'),'inuse',_0xc0db('0x2'),'invalid','unavailable',_0xc0db('0x3'),_0xc0db('0x4'),_0xc0db('0x5')];var monitorFormat={'wav':_0xc0db('0x6'),'wav49':_0xc0db('0x7'),'gsm':_0xc0db('0x8')};var strategy={'rrmemory':_0xc0db('0x9'),'roundrobin':_0xc0db('0xa')};function VoiceQueue(_0x9cfd61){this['id']=_0x9cfd61['id']||0x0;this[_0xc0db('0xb')]=_0x9cfd61[_0xc0db('0xb')]||'';this[_0xc0db('0xc')]=_0x9cfd61[_0xc0db('0xc')]||'';this[_0xc0db('0xd')]=_0x9cfd61[_0xc0db('0xd')]||_0xc0db('0xe');this[_0xc0db('0xf')]=0x0;this['talking']=0x0;this[_0xc0db('0x10')]=0x0;this[_0xc0db('0x11')]=0x0;this[_0xc0db('0x12')]=0x0;this[_0xc0db('0x13')]=0x0;this[_0xc0db('0x14')]=0x0;this['unmanaged']=0x0;this[_0xc0db('0x15')]=0x0;this[_0xc0db('0x16')]=0x0;this[_0xc0db('0x17')]=0x0;this['acw']=_0x9cfd61[_0xc0db('0x18')]||![];this[_0xc0db('0x19')]=_0x9cfd61[_0xc0db('0x19')]||0xa;this[_0xc0db('0x1a')]=_0x9cfd61['autopause']||'no';this[_0xc0db('0x1b')]=!![];this['message']='';this[_0xc0db('0x1c')]=0x0;this['temp']=0x0;this[_0xc0db('0x1d')]=_0x9cfd61[_0xc0db('0x1d')]||null;this[_0xc0db('0x1e')]=_0x9cfd61['dialGlobalInterval']?_0x9cfd61['dialGlobalInterval']:null;this[_0xc0db('0x1f')]=_0x9cfd61[_0xc0db('0x1f')];this[_0xc0db('0x20')]=_0x9cfd61[_0xc0db('0x20')]||_0xc0db('0x21');this[_0xc0db('0x22')]=_0x9cfd61[_0xc0db('0x22')]||0x0;this['dialLimitQueue']=_0x9cfd61[_0xc0db('0x23')]||0x0;this['dialPowerLevel']=_0x9cfd61[_0xc0db('0x24')]||0x1;this[_0xc0db('0x25')]=_0x9cfd61[_0xc0db('0x25')]||_0xc0db('0x26');this[_0xc0db('0x27')]=_0x9cfd61[_0xc0db('0x27')]||0.03;this[_0xc0db('0x28')]=_0x9cfd61[_0xc0db('0x28')]||0x258;this['dialOriginateCallerIdName']=_0x9cfd61[_0xc0db('0x29')]||_0xc0db('0x2a');this['dialOriginateCallerIdNumber']=_0x9cfd61[_0xc0db('0x2b')]||_0xc0db('0x2a');this['dialOriginateTimeout']=_0x9cfd61[_0xc0db('0x2c')]||0x1e;this[_0xc0db('0x2d')]=_0x9cfd61[_0xc0db('0x2d')]||_0xc0db('0x2e');this['dialQueueTimeout']=_0x9cfd61['dialQueueTimeout']||0x3;this[_0xc0db('0x2f')]=_0x9cfd61[_0xc0db('0x2f')]||undefined;this['dialCongestionMaxRetry']=_0x9cfd61[_0xc0db('0x30')]||0x3;this[_0xc0db('0x31')]=_0x9cfd61[_0xc0db('0x31')]||0x96;this[_0xc0db('0x32')]=_0x9cfd61['dialBusyMaxRetry']||0x3;this[_0xc0db('0x33')]=_0x9cfd61[_0xc0db('0x33')]||0x96;this[_0xc0db('0x34')]=_0x9cfd61['dialNoAnswerMaxRetry']||0x3;this[_0xc0db('0x35')]=_0x9cfd61[_0xc0db('0x35')]||0x96;this[_0xc0db('0x36')]=_0x9cfd61['dialNoSuchNumberMaxRetry']||0x3;this[_0xc0db('0x37')]=_0x9cfd61[_0xc0db('0x37')]||0x96;this['dialDropMaxRetry']=_0x9cfd61[_0xc0db('0x38')]||0x3;this[_0xc0db('0x39')]=_0x9cfd61[_0xc0db('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x9cfd61[_0xc0db('0x3a')]||0x3;this[_0xc0db('0x3b')]=_0x9cfd61['dialAbandonedRetryFrequency']||0x96;this[_0xc0db('0x3c')]=_0x9cfd61[_0xc0db('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x9cfd61[_0xc0db('0x3d')]||0x96;this['dialAgentRejectMaxRetry']=_0x9cfd61[_0xc0db('0x3e')]||0x3;this[_0xc0db('0x3f')]=_0x9cfd61[_0xc0db('0x3f')]||0x96;this['dialGlobalMaxRetry']=_0x9cfd61[_0xc0db('0x40')]||0x4;this[_0xc0db('0x41')]=_0x9cfd61['Trunk']?_0x9cfd61[_0xc0db('0x41')]:undefined;this[_0xc0db('0x42')]=_0x9cfd61['TrunkBackup']?_0x9cfd61[_0xc0db('0x42')]:undefined;this[_0xc0db('0x43')]=_0x9cfd61[_0xc0db('0x43')]||undefined;this[_0xc0db('0x44')]=_0x9cfd61[_0xc0db('0x44')]?_0x9cfd61[_0xc0db('0x44')]:undefined;this['dialOrderByScheduledAt']=_0x9cfd61['dialOrderByScheduledAt']||_0xc0db('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x9cfd61[_0xc0db('0x46')]||undefined;this[_0xc0db('0x47')]=_0x9cfd61[_0xc0db('0x47')]||undefined;this['strategy']=strategy[_0x9cfd61[_0xc0db('0x48')]]||_0xc0db('0x9');this['queueStatusComplete']=!![];this[_0xc0db('0x49')]=_0x9cfd61[_0xc0db('0x49')]||![];this[_0xc0db('0x4a')]=_0x9cfd61[_0xc0db('0x4a')];this[_0xc0db('0x4b')]=_0x9cfd61[_0xc0db('0x4b')];this['dialAMDAfterGreetingSilence']=_0x9cfd61[_0xc0db('0x4c')];this[_0xc0db('0x4d')]=_0x9cfd61[_0xc0db('0x4d')];this['dialAMDMinWordLength']=_0x9cfd61[_0xc0db('0x4e')];this['dialAMDBetweenWordsSilence']=_0x9cfd61[_0xc0db('0x4f')];this[_0xc0db('0x50')]=_0x9cfd61['dialAMDMaximumNumberOfWords'];this[_0xc0db('0x51')]=_0x9cfd61[_0xc0db('0x51')];this['dialAMDMaximumWordLength']=_0x9cfd61['dialAMDMaximumWordLength'];this[_0xc0db('0x52')]=0x0;this[_0xc0db('0x53')]=0x0;this[_0xc0db('0x54')]=_0x9cfd61[_0xc0db('0x54')];this['outboundAnswerCallsDay']=0x0;this[_0xc0db('0x55')]=0x0;this[_0xc0db('0x56')]=0x0;this[_0xc0db('0x57')]=0x0;this[_0xc0db('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xc0db('0x59')]=0x0;this[_0xc0db('0x5a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xc0db('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0xc0db('0x5c')]=0x0;this[_0xc0db('0x5d')]=undefined;this['startPredictive']=undefined;this[_0xc0db('0x5e')]=undefined;this[_0xc0db('0x5f')]=1.05;this[_0xc0db('0x60')]=0x0;this[_0xc0db('0x61')]=0x0;this[_0xc0db('0x62')]=0x0;this[_0xc0db('0x63')]=0x0;this[_0xc0db('0x64')]=0x0;this[_0xc0db('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x9cfd61[_0xc0db('0x66')]||0x14;this['predictiveIntervalMinThreshold']=_0x9cfd61['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xc0db('0x67')]=0x0;this[_0xc0db('0x68')]=0x0;this[_0xc0db('0x69')]=0x1;this[_0xc0db('0x6a')]=0x0;this[_0xc0db('0x6b')]=0x0;this[_0xc0db('0x6c')]=0x0;this[_0xc0db('0x6d')]=0x0;this['dialRecallMeTimeout']=_0x9cfd61[_0xc0db('0x6e')]||0x1e;this[_0xc0db('0x6f')]=_0x9cfd61[_0xc0db('0x6f')]||![];this[_0xc0db('0x70')]=!!_0x9cfd61[_0xc0db('0x70')]||![];this['dialPreviewRecallmeReminder']=!!_0x9cfd61[_0xc0db('0x71')]||![];this['dialQueueProject2']=_0x9cfd61[_0xc0db('0x72')]||undefined;this[_0xc0db('0x73')]=_0x9cfd61['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x9cfd61[_0xc0db('0x74')]||![];this[_0xc0db('0xc')]=monitorFormat[_0x9cfd61[_0xc0db('0xc')]]?monitorFormat[_0x9cfd61[_0xc0db('0xc')]]:undefined;this[_0xc0db('0x75')]=_0x9cfd61[_0xc0db('0x75')]||![];this[_0xc0db('0x76')]=_0x9cfd61[_0xc0db('0x76')]?_0x9cfd61[_0xc0db('0x76')]:undefined;}module[_0xc0db('0x77')]=VoiceQueue; \ No newline at end of file +var _0x0d12=['mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent'];(function(_0x3b6460,_0x526adb){var _0x9b73c4=function(_0x3407e1){while(--_0x3407e1){_0x3b6460['push'](_0x3b6460['shift']());}};_0x9b73c4(++_0x526adb);}(_0x0d12,0x177));var _0x20d1=function(_0xe7560b,_0x53f052){_0xe7560b=_0xe7560b-0x0;var _0x34d379=_0x0d12[_0xe7560b];return _0x34d379;};'use strict';var statusDesc=[_0x20d1('0x0'),_0x20d1('0x1'),'inuse',_0x20d1('0x2'),_0x20d1('0x3'),_0x20d1('0x4'),_0x20d1('0x5'),_0x20d1('0x6'),_0x20d1('0x7')];var monitorFormat={'wav':_0x20d1('0x8'),'wav49':'wav49','gsm':_0x20d1('0x9')};var strategy={'rrmemory':_0x20d1('0xa'),'roundrobin':_0x20d1('0xb')};function VoiceQueue(_0xcd7bcb){this['id']=_0xcd7bcb['id']||0x0;this[_0x20d1('0xc')]=_0xcd7bcb[_0x20d1('0xc')]||'';this[_0x20d1('0xd')]=_0xcd7bcb[_0x20d1('0xd')]||'';this[_0x20d1('0xe')]=_0xcd7bcb[_0x20d1('0xe')]||_0x20d1('0xf');this[_0x20d1('0x10')]=0x0;this[_0x20d1('0x11')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x20d1('0x12')]=0x0;this[_0x20d1('0x13')]=0x0;this[_0x20d1('0x14')]=0x0;this[_0x20d1('0x15')]=0x0;this['abandoned']=0x0;this[_0x20d1('0x16')]=0x0;this[_0x20d1('0x17')]=0x0;this[_0x20d1('0x18')]=_0xcd7bcb[_0x20d1('0x18')]||![];this[_0x20d1('0x19')]=_0xcd7bcb[_0x20d1('0x19')]||0xa;this['autopause']=_0xcd7bcb[_0x20d1('0x1a')]||'no';this[_0x20d1('0x1b')]=!![];this[_0x20d1('0x1c')]='';this[_0x20d1('0x1d')]=0x0;this[_0x20d1('0x1e')]=0x0;this[_0x20d1('0x1f')]=_0xcd7bcb[_0x20d1('0x1f')]||null;this[_0x20d1('0x20')]=_0xcd7bcb[_0x20d1('0x20')]?_0xcd7bcb[_0x20d1('0x20')]:null;this['dialActive']=_0xcd7bcb[_0x20d1('0x21')];this[_0x20d1('0x22')]=_0xcd7bcb['dialMethod']||_0x20d1('0x23');this[_0x20d1('0x24')]=_0xcd7bcb[_0x20d1('0x24')]||0x0;this[_0x20d1('0x25')]=_0xcd7bcb[_0x20d1('0x25')]||0x0;this[_0x20d1('0x26')]=_0xcd7bcb['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0xcd7bcb[_0x20d1('0x27')]||_0x20d1('0x28');this[_0x20d1('0x29')]=_0xcd7bcb[_0x20d1('0x29')]||0.03;this[_0x20d1('0x2a')]=_0xcd7bcb['dialPredictiveInterval']||0x258;this[_0x20d1('0x2b')]=_0xcd7bcb['dialOriginateCallerIdName']||_0x20d1('0x2c');this['dialOriginateCallerIdNumber']=_0xcd7bcb['dialOriginateCallerIdNumber']||_0x20d1('0x2c');this[_0x20d1('0x2d')]=_0xcd7bcb[_0x20d1('0x2d')]||0x1e;this[_0x20d1('0x2e')]=_0xcd7bcb[_0x20d1('0x2e')]||_0x20d1('0x2f');this[_0x20d1('0x30')]=_0xcd7bcb['dialQueueTimeout']||0x3;this[_0x20d1('0x31')]=_0xcd7bcb[_0x20d1('0x31')]||undefined;this['dialCongestionMaxRetry']=_0xcd7bcb[_0x20d1('0x32')]||0x3;this[_0x20d1('0x33')]=_0xcd7bcb[_0x20d1('0x33')]||0x96;this['dialBusyMaxRetry']=_0xcd7bcb[_0x20d1('0x34')]||0x3;this[_0x20d1('0x35')]=_0xcd7bcb[_0x20d1('0x35')]||0x96;this['dialNoAnswerMaxRetry']=_0xcd7bcb[_0x20d1('0x36')]||0x3;this[_0x20d1('0x37')]=_0xcd7bcb['dialNoAnswerRetryFrequency']||0x96;this[_0x20d1('0x38')]=_0xcd7bcb[_0x20d1('0x38')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xcd7bcb[_0x20d1('0x39')]||0x96;this[_0x20d1('0x3a')]=_0xcd7bcb[_0x20d1('0x3a')]||0x3;this[_0x20d1('0x3b')]=_0xcd7bcb[_0x20d1('0x3b')]||0x96;this[_0x20d1('0x3c')]=_0xcd7bcb[_0x20d1('0x3c')]||0x3;this[_0x20d1('0x3d')]=_0xcd7bcb[_0x20d1('0x3d')]||0x96;this[_0x20d1('0x3e')]=_0xcd7bcb['dialMachineMaxRetry']||0x3;this[_0x20d1('0x3f')]=_0xcd7bcb['dialMachineRetryFrequency']||0x96;this[_0x20d1('0x40')]=_0xcd7bcb[_0x20d1('0x40')]||0x3;this[_0x20d1('0x41')]=_0xcd7bcb[_0x20d1('0x41')]||0x96;this[_0x20d1('0x42')]=_0xcd7bcb[_0x20d1('0x42')]||0x4;this[_0x20d1('0x43')]=_0xcd7bcb[_0x20d1('0x43')]?_0xcd7bcb[_0x20d1('0x43')]:undefined;this[_0x20d1('0x44')]=_0xcd7bcb[_0x20d1('0x44')]?_0xcd7bcb['TrunkBackup']:undefined;this[_0x20d1('0x45')]=_0xcd7bcb[_0x20d1('0x45')]||undefined;this[_0x20d1('0x46')]=_0xcd7bcb['Interval']?_0xcd7bcb[_0x20d1('0x46')]:undefined;this[_0x20d1('0x47')]=_0xcd7bcb[_0x20d1('0x47')]||_0x20d1('0x48');this['dialRandomLastDigitCallerIdNumber']=_0xcd7bcb[_0x20d1('0x49')]||undefined;this['dialCutDigit']=_0xcd7bcb['dialCutDigit']||undefined;this['strategy']=strategy[_0xcd7bcb[_0x20d1('0x4a')]]||_0x20d1('0xa');this[_0x20d1('0x4b')]=!![];this[_0x20d1('0x4c')]=_0xcd7bcb[_0x20d1('0x4c')]||![];this[_0x20d1('0x4d')]=_0xcd7bcb[_0x20d1('0x4d')];this[_0x20d1('0x4e')]=_0xcd7bcb[_0x20d1('0x4e')];this[_0x20d1('0x4f')]=_0xcd7bcb[_0x20d1('0x4f')];this['dialAMDTotalAnalysisTime']=_0xcd7bcb[_0x20d1('0x50')];this[_0x20d1('0x51')]=_0xcd7bcb[_0x20d1('0x51')];this[_0x20d1('0x52')]=_0xcd7bcb[_0x20d1('0x52')];this[_0x20d1('0x53')]=_0xcd7bcb[_0x20d1('0x53')];this['dialAMDSilenceThreshold']=_0xcd7bcb[_0x20d1('0x54')];this['dialAMDMaximumWordLength']=_0xcd7bcb[_0x20d1('0x55')];this[_0x20d1('0x56')]=0x0;this[_0x20d1('0x57')]=0x0;this['timeout']=_0xcd7bcb['timeout'];this[_0x20d1('0x58')]=0x0;this[_0x20d1('0x59')]=0x0;this[_0x20d1('0x5a')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x20d1('0x5b')]=0x0;this[_0x20d1('0x5c')]=0x0;this[_0x20d1('0x5d')]=0x0;this[_0x20d1('0x5e')]=0x0;this[_0x20d1('0x5f')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x20d1('0x60')]=0x0;this[_0x20d1('0x61')]=0x0;this['outboundReCallsDay']=0x0;this[_0x20d1('0x62')]=0x0;this['startProgressive']=undefined;this[_0x20d1('0x63')]=undefined;this[_0x20d1('0x64')]=undefined;this[_0x20d1('0x65')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x20d1('0x66')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x20d1('0x67')]=0x0;this[_0x20d1('0x68')]=0x0;this[_0x20d1('0x69')]=0x0;this[_0x20d1('0x6a')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x20d1('0x6b')]=_0xcd7bcb[_0x20d1('0x6c')]||0x14;this[_0x20d1('0x6d')]=_0xcd7bcb[_0x20d1('0x6c')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x20d1('0x6e')]=0x0;this[_0x20d1('0x6f')]=0x1;this[_0x20d1('0x70')]=0x0;this[_0x20d1('0x71')]=0x0;this[_0x20d1('0x72')]=0x0;this['erlangBusyFactor']=0x0;this[_0x20d1('0x73')]=_0xcd7bcb[_0x20d1('0x73')]||0x1e;this[_0x20d1('0x74')]=_0xcd7bcb['dialRecallInQueue']||![];this[_0x20d1('0x75')]=!!_0xcd7bcb['dialPreviewAutoRecallMe']||![];this[_0x20d1('0x76')]=!!_0xcd7bcb['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0xcd7bcb['dialQueueProject2']||undefined;this[_0x20d1('0x77')]=_0xcd7bcb[_0x20d1('0x77')]||![];this[_0x20d1('0x78')]=_0xcd7bcb[_0x20d1('0x78')]||![];this[_0x20d1('0xd')]=monitorFormat[_0xcd7bcb[_0x20d1('0xd')]]?monitorFormat[_0xcd7bcb[_0x20d1('0xd')]]:undefined;this[_0x20d1('0x79')]=_0xcd7bcb['mandatoryDisposition']||![];this[_0x20d1('0x7a')]=_0xcd7bcb[_0x20d1('0x7a')]?_0xcd7bcb[_0x20d1('0x7a')]:undefined;}module[_0x20d1('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 92dce99..2d438a6 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 _0xf0f4=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xf0f4,0x1b4));var _0x4f0f=function(_0x224e23,_0x56ab5e){_0x224e23=_0x224e23-0x0;var _0x137faa=_0xf0f4[_0x224e23];return _0x137faa;};'use strict';function VtigerAccount(_0x150fc0){this['id']=_0x150fc0['id']||0x0;this[_0x4f0f('0x0')]=_0x150fc0[_0x4f0f('0x0')]||'';this[_0x4f0f('0x1')]=_0x150fc0[_0x4f0f('0x1')]||'';this['accessKey']=_0x150fc0['accessKey']||'';this[_0x4f0f('0x2')]=_0x150fc0[_0x4f0f('0x2')]||'';this[_0x4f0f('0x3')]=_0x150fc0[_0x4f0f('0x3')]||'';this['Configurations']=_0x150fc0[_0x4f0f('0x4')]||{};}module[_0x4f0f('0x5')]=VtigerAccount; \ No newline at end of file +var _0x5b4e=['accessKey','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x57c104,_0x315186){var _0x1e5b69=function(_0x56f798){while(--_0x56f798){_0x57c104['push'](_0x57c104['shift']());}};_0x1e5b69(++_0x315186);}(_0x5b4e,0xd7));var _0xe5b4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5b4e[_0x57b54c];return _0x59cc19;};'use strict';function VtigerAccount(_0x26d9ca){this['id']=_0x26d9ca['id']||0x0;this['name']=_0x26d9ca['name']||'';this[_0xe5b4('0x0')]=_0x26d9ca[_0xe5b4('0x0')]||'';this[_0xe5b4('0x1')]=_0x26d9ca['accessKey']||'';this[_0xe5b4('0x2')]=_0x26d9ca[_0xe5b4('0x2')]||'';this[_0xe5b4('0x3')]=_0x26d9ca[_0xe5b4('0x3')]||'';this[_0xe5b4('0x4')]=_0x26d9ca[_0xe5b4('0x4')]||{};}module[_0xe5b4('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 793c3de..6242181 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 _0x2250=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x102446,_0x304dcf){var _0x35a364=function(_0x573f34){while(--_0x573f34){_0x102446['push'](_0x102446['shift']());}};_0x35a364(++_0x304dcf);}(_0x2250,0x8e));var _0x0225=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x2250[_0x40bffc];return _0x3007e9;};'use strict';function ZendeskAccount(_0x176e92){this['id']=_0x176e92['id']||0x0;this[_0x0225('0x0')]=_0x176e92['name']||'';this[_0x0225('0x1')]=_0x176e92[_0x0225('0x1')]||'';this['password']=_0x176e92[_0x0225('0x2')]||'';this['token']=_0x176e92[_0x0225('0x3')]||'';this[_0x0225('0x4')]=_0x176e92[_0x0225('0x4')]||'';this[_0x0225('0x5')]=_0x176e92[_0x0225('0x5')]||'';this[_0x0225('0x6')]=_0x176e92[_0x0225('0x6')]||_0x0225('0x7');this['serverUrl']=_0x176e92[_0x0225('0x8')]||'';this[_0x0225('0x9')]=_0x176e92[_0x0225('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x690d=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x4f1f2f,_0x5b0d04){var _0x3021c4=function(_0x426b30){while(--_0x426b30){_0x4f1f2f['push'](_0x4f1f2f['shift']());}};_0x3021c4(++_0x5b0d04);}(_0x690d,0x112));var _0xd690=function(_0x1b81e4,_0x4594e2){_0x1b81e4=_0x1b81e4-0x0;var _0x20dcd8=_0x690d[_0x1b81e4];return _0x20dcd8;};'use strict';function ZendeskAccount(_0x12e711){this['id']=_0x12e711['id']||0x0;this['name']=_0x12e711[_0xd690('0x0')]||'';this[_0xd690('0x1')]=_0x12e711[_0xd690('0x1')]||'';this[_0xd690('0x2')]=_0x12e711[_0xd690('0x2')]||'';this[_0xd690('0x3')]=_0x12e711[_0xd690('0x3')]||'';this[_0xd690('0x4')]=_0x12e711['remoteUri']||'';this['authType']=_0x12e711[_0xd690('0x5')]||'';this['type']=_0x12e711[_0xd690('0x6')]||_0xd690('0x7');this[_0xd690('0x8')]=_0x12e711[_0xd690('0x8')]||'';this[_0xd690('0x9')]=_0x12e711[_0xd690('0x9')]||{};}module[_0xd690('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 0df86d6..84e3811 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 _0xfa4d=['refreshToken','Configurations','exports','name','host','zone','clientId','clientSecret','code'];(function(_0x2b0fec,_0x564d17){var _0x374f6b=function(_0x349a88){while(--_0x349a88){_0x2b0fec['push'](_0x2b0fec['shift']());}};_0x374f6b(++_0x564d17);}(_0xfa4d,0x17d));var _0xdfa4=function(_0x2fe92d,_0x35452f){_0x2fe92d=_0x2fe92d-0x0;var _0x51b146=_0xfa4d[_0x2fe92d];return _0x51b146;};'use strict';function ZohoAccount(_0x5866cc){this['id']=_0x5866cc['id']||0x0;this[_0xdfa4('0x0')]=_0x5866cc[_0xdfa4('0x0')]||'';this['description']=_0x5866cc['description']||'';this[_0xdfa4('0x1')]=_0x5866cc[_0xdfa4('0x1')]||'';this['zone']=_0x5866cc[_0xdfa4('0x2')]||'';this[_0xdfa4('0x3')]=_0x5866cc[_0xdfa4('0x3')]||'';this[_0xdfa4('0x4')]=_0x5866cc[_0xdfa4('0x4')]||'';this['serverUrl']=_0x5866cc['serverUrl']||'';this[_0xdfa4('0x5')]=_0x5866cc['code']||'';this[_0xdfa4('0x6')]=_0x5866cc[_0xdfa4('0x6')]||'';this['Configurations']=_0x5866cc[_0xdfa4('0x7')]||{};}module[_0xdfa4('0x8')]=ZohoAccount; \ No newline at end of file +var _0x3a3a=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x5721d7,_0x3908cd){var _0x504bbe=function(_0x5a7c32){while(--_0x5a7c32){_0x5721d7['push'](_0x5721d7['shift']());}};_0x504bbe(++_0x3908cd);}(_0x3a3a,0x1e2));var _0xa3a3=function(_0x157275,_0x58af4c){_0x157275=_0x157275-0x0;var _0x59cd0f=_0x3a3a[_0x157275];return _0x59cd0f;};'use strict';function ZohoAccount(_0x50beb7){this['id']=_0x50beb7['id']||0x0;this['name']=_0x50beb7[_0xa3a3('0x0')]||'';this[_0xa3a3('0x1')]=_0x50beb7['description']||'';this[_0xa3a3('0x2')]=_0x50beb7['host']||'';this[_0xa3a3('0x3')]=_0x50beb7[_0xa3a3('0x3')]||'';this[_0xa3a3('0x4')]=_0x50beb7[_0xa3a3('0x4')]||'';this[_0xa3a3('0x5')]=_0x50beb7[_0xa3a3('0x5')]||'';this[_0xa3a3('0x6')]=_0x50beb7[_0xa3a3('0x6')]||'';this['code']=_0x50beb7[_0xa3a3('0x7')]||'';this['refreshToken']=_0x50beb7['refreshToken']||'';this[_0xa3a3('0x8')]=_0x50beb7[_0xa3a3('0x8')]||{};}module[_0xa3a3('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 129b086..83883e8 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 _0xcc8f=['string','uniqueid','idContact','queue','name','type','dialAnswer','Agent','channelAgent','membername','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','isNil'];(function(_0x5546d5,_0x35060d){var _0x29c539=function(_0xc9b23e){while(--_0xc9b23e){_0x5546d5['push'](_0x5546d5['shift']());}};_0x29c539(++_0x35060d);}(_0xcc8f,0x100));var _0xfcc8=function(_0x2dc979,_0xc3b9e7){_0x2dc979=_0x2dc979-0x0;var _0x412b9f=_0xcc8f[_0x2dc979];return _0x412b9f;};'use strict';var util=require(_0xfcc8('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x2a53b5,_0xe29639,_0x2e5516){var _0x5c45b7='';if(!_['isNil'](_0xe29639)&&'string'===typeof _0xe29639){_0x5c45b7+=_0xe29639;}if(!_[_0xfcc8('0x1')](_0x2e5516)&&_0xfcc8('0x2')===typeof _0x2e5516){_0x5c45b7+='\x20'+_0x2e5516;}if(_0x5c45b7!==''){return _0x5c45b7;}return _0x2a53b5;}function Action(_0x2a64c8,_0x330548,_0x46a5ca,_0x3d17da,_0x48d637){this[_0xfcc8('0x3')]=_0x46a5ca||undefined;this[_0xfcc8('0x4')]=_0x2a64c8['id'];this[_0xfcc8('0x5')]=_0x330548[_0xfcc8('0x6')];this[_0xfcc8('0x7')]=_0x330548['type'];this['campaigntype']=_0xfcc8('0x5');this[_0xfcc8('0x8')]=![];this['membername']=_['isNil'](_0x2a64c8[_0xfcc8('0x9')])?undefined:_0x2a64c8[_0xfcc8('0x9')][_0xfcc8('0x6')];this[_0xfcc8('0xa')]=this[_0xfcc8('0xb')]?util[_0xfcc8('0xc')]('SIP/%s',this[_0xfcc8('0xb')]):_0x3d17da||undefined;this[_0xfcc8('0xd')]=checkNameSurname(_0x2a64c8[_0xfcc8('0xe')][_0xfcc8('0xf')],_0x2a64c8[_0xfcc8('0xe')][_0xfcc8('0x10')],_0x2a64c8[_0xfcc8('0xe')][_0xfcc8('0x11')]);this[_0xfcc8('0x12')]=_0x2a64c8[_0xfcc8('0x12')]||![];this[_0xfcc8('0x13')]=_0x2a64c8[_0xfcc8('0xe')][_0xfcc8('0xf')];this['scheduledat']=_0x2a64c8['scheduledat'];this['countbusyretry']=_0x2a64c8['countbusyretry']||0x0;this[_0xfcc8('0x14')]=_0x2a64c8[_0xfcc8('0x14')]||0x0;this[_0xfcc8('0x15')]=_0x2a64c8[_0xfcc8('0x15')]||0x0;this[_0xfcc8('0x16')]=(_0x2a64c8[_0xfcc8('0x17')]||0x0)+(_0x2a64c8[_0xfcc8('0x14')]||0x0)+(_0x2a64c8[_0xfcc8('0x15')]||0x0)+(_0x2a64c8[_0xfcc8('0x18')]||0x0)+(_0x2a64c8['countdropretry']||0x0)+(_0x2a64c8[_0xfcc8('0x19')]||0x0)+(_0x2a64c8[_0xfcc8('0x1a')]||0x0)+(_0x2a64c8[_0xfcc8('0x1b')]||0x0);this[_0xfcc8('0x18')]=_0x2a64c8[_0xfcc8('0x18')]||0x0;this[_0xfcc8('0x1c')]=_0x2a64c8[_0xfcc8('0x1c')]||0x0;this[_0xfcc8('0x19')]=_0x2a64c8[_0xfcc8('0x19')]||0x0;this[_0xfcc8('0x1a')]=_0x2a64c8[_0xfcc8('0x1a')]||0x0;this['countagentrejectretry']=_0x2a64c8[_0xfcc8('0x1b')]||0x0;this['callback']=_0x2a64c8['callback'];this[_0xfcc8('0x1d')]=_0x2a64c8[_0xfcc8('0x1d')];this[_0xfcc8('0x1e')]=_0x2a64c8[_0xfcc8('0x1e')];this[_0xfcc8('0x1f')]=_0x2a64c8[_0xfcc8('0x1f')];this[_0xfcc8('0x20')]=_0x2a64c8[_0xfcc8('0x20')];this[_0xfcc8('0x21')]=_0x2a64c8[_0xfcc8('0x21')];this['UserId']=_[_0xfcc8('0x1')](_0x2a64c8[_0xfcc8('0x9')])?_0x2a64c8[_0xfcc8('0x22')]:_0x2a64c8['Agent']['id'];this[_0xfcc8('0x23')]=_0x2a64c8[_0xfcc8('0x23')];this[_0xfcc8('0x24')]='';this[_0xfcc8('0x25')]='';}Action[_0xfcc8('0x26')][_0xfcc8('0x27')]=function(){return util['format'](_0xfcc8('0x28'),this[_0xfcc8('0xd')],this[_0xfcc8('0x29')]);};module[_0xfcc8('0x2a')]=Action; \ No newline at end of file +var _0x55c4=['queue','name','type','campaigntype','dialAnswer','membername','isNil','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','number','exports','string','idContact'];(function(_0xa3b9a3,_0x458e6f){var _0x2593b4=function(_0x3650f2){while(--_0x3650f2){_0xa3b9a3['push'](_0xa3b9a3['shift']());}};_0x2593b4(++_0x458e6f);}(_0x55c4,0xa2));var _0x455c=function(_0x28e746,_0x25357f){_0x28e746=_0x28e746-0x0;var _0x1cd18c=_0x55c4[_0x28e746];return _0x1cd18c;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x778a1f,_0x2dcc89,_0x4376c4){var _0x2f0e40='';if(!_['isNil'](_0x2dcc89)&&_0x455c('0x0')===typeof _0x2dcc89){_0x2f0e40+=_0x2dcc89;}if(!_['isNil'](_0x4376c4)&&_0x455c('0x0')===typeof _0x4376c4){_0x2f0e40+='\x20'+_0x4376c4;}if(_0x2f0e40!==''){return _0x2f0e40;}return _0x778a1f;}function Action(_0x5f5510,_0x3bc931,_0x46bc82,_0x2387bd,_0x5d575d){this['uniqueid']=_0x46bc82||undefined;this[_0x455c('0x1')]=_0x5f5510['id'];this[_0x455c('0x2')]=_0x3bc931[_0x455c('0x3')];this['type']=_0x3bc931[_0x455c('0x4')];this[_0x455c('0x5')]=_0x455c('0x2');this[_0x455c('0x6')]=![];this[_0x455c('0x7')]=_[_0x455c('0x8')](_0x5f5510[_0x455c('0x9')])?undefined:_0x5f5510[_0x455c('0x9')][_0x455c('0x3')];this[_0x455c('0xa')]=this[_0x455c('0x7')]?util[_0x455c('0xb')]('SIP/%s',this[_0x455c('0x7')]):_0x2387bd||undefined;this[_0x455c('0xc')]=checkNameSurname(_0x5f5510[_0x455c('0xd')][_0x455c('0xe')],_0x5f5510[_0x455c('0xd')][_0x455c('0xf')],_0x5f5510[_0x455c('0xd')][_0x455c('0x10')]);this[_0x455c('0x11')]=_0x5f5510[_0x455c('0x11')]||![];this[_0x455c('0x12')]=_0x5f5510['Contact'][_0x455c('0xe')];this['scheduledat']=_0x5f5510[_0x455c('0x13')];this[_0x455c('0x14')]=_0x5f5510[_0x455c('0x14')]||0x0;this['countcongestionretry']=_0x5f5510['countcongestionretry']||0x0;this[_0x455c('0x15')]=_0x5f5510['countnoanswerretry']||0x0;this['countglobal']=(_0x5f5510[_0x455c('0x14')]||0x0)+(_0x5f5510[_0x455c('0x16')]||0x0)+(_0x5f5510['countnoanswerretry']||0x0)+(_0x5f5510['countnosuchnumberretry']||0x0)+(_0x5f5510[_0x455c('0x17')]||0x0)+(_0x5f5510[_0x455c('0x18')]||0x0)+(_0x5f5510[_0x455c('0x19')]||0x0)+(_0x5f5510[_0x455c('0x1a')]||0x0);this['countnosuchnumberretry']=_0x5f5510[_0x455c('0x1b')]||0x0;this['countdropretry']=_0x5f5510['countdropretry']||0x0;this[_0x455c('0x18')]=_0x5f5510[_0x455c('0x18')]||0x0;this[_0x455c('0x19')]=_0x5f5510[_0x455c('0x19')]||0x0;this['countagentrejectretry']=_0x5f5510[_0x455c('0x1a')]||0x0;this['callback']=_0x5f5510[_0x455c('0x1c')];this[_0x455c('0x1d')]=_0x5f5510['callbackuniqueid'];this[_0x455c('0x1e')]=_0x5f5510[_0x455c('0x1e')];this[_0x455c('0x1f')]=_0x5f5510[_0x455c('0x1f')];this['ContactId']=_0x5f5510[_0x455c('0x20')];this[_0x455c('0x21')]=_0x5f5510[_0x455c('0x21')];this['UserId']=_['isNil'](_0x5f5510[_0x455c('0x9')])?_0x5f5510[_0x455c('0x22')]:_0x5f5510[_0x455c('0x9')]['id'];this['VoiceQueueId']=_0x5f5510[_0x455c('0x23')];this[_0x455c('0x24')]='';this[_0x455c('0x25')]='';}Action['prototype']['getCaller']=function(){return util[_0x455c('0xb')](_0x455c('0x26'),this[_0x455c('0xc')],this[_0x455c('0x27')]);};module[_0x455c('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 6151192..b1d4f54 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 _0x8958=['Busy','custom:agentbusy','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countglobal','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','phone','trim','getCallerId','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridnum','extractCalleridNumber','addVariables','variablesAction','[originated][increment]','OriginateError','syncOriginateResponse','actionid','logLookAgent','responsetime','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','filterKey','addVariable','keys','value','[syncVarSet][Preview]','inspect','transfererlinkedid','exports','lodash','ioredis','../../../config/logger','preview','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','bind','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','hasOwnProperty','dialMethod','booked','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','actions','queue','pick','UserId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','buildObj','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry'];(function(_0x20311e,_0x8dbfe0){var _0x16281b=function(_0x230cfc){while(--_0x230cfc){_0x20311e['push'](_0x20311e['shift']());}};_0x16281b(++_0x8dbfe0);}(_0x8958,0x93));var _0x8895=function(_0x11e7c1,_0x56077c){_0x11e7c1=_0x11e7c1-0x0;var _0x4e4b69=_0x8958[_0x11e7c1];return _0x4e4b69;};'use strict';var util=require('util');var _=require(_0x8895('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require('md5');var Redis=require(_0x8895('0x1'));var config=require('../../../config/environment');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var loggerAction=require(_0x8895('0x2'))('actionPreview');var ami=require(_0x8895('0x4'));var rpcDb=require(_0x8895('0x5'));var Action=require(_0x8895('0x6'));var ut=require(_0x8895('0x7'));config[_0x8895('0x8')]=_['defaults'](config[_0x8895('0x8')],{'host':_0x8895('0x9'),'port':0x18eb});var io=require(_0x8895('0xa'))(new Redis(config[_0x8895('0x8')]));var Sequence=function(){};Sequence[_0x8895('0xb')][_0x8895('0xc')]=function(_0x22a12b){this[_0x8895('0xd')]=this[_0x8895('0xd')]?this[_0x8895('0xd')]['finally'](_0x22a12b):_0x22a12b();};function Preview(_0x1cf600){this[_0x8895('0xe')]=new Sequence();this[_0x8895('0xf')]=_0x1cf600[_0x8895('0x10')];this[_0x8895('0x11')]=_0x1cf600[_0x8895('0x11')];this['actions']={};this[_0x8895('0x12')]=_0x1cf600[_0x8895('0x12')];this[_0x8895('0x13')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x8895('0x14')](this));ami['on']('hangup',this[_0x8895('0x15')][_0x8895('0x14')](this));ami['on'](_0x8895('0x16'),this[_0x8895('0x17')][_0x8895('0x14')](this));ami['on']('dialend',this[_0x8895('0x18')][_0x8895('0x14')](this));ami['on'](_0x8895('0x19'),this[_0x8895('0x1a')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1b'),this[_0x8895('0x1c')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1d'),this[_0x8895('0x1e')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1f'),this[_0x8895('0x20')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x3daf43,_0x456282,_0x2d189c){io['to'](_0x3daf43)[_0x8895('0x21')](_0x456282,_0x2d189c);}function emitCampaignPreview(_0x3f7d5a){if(_0x3f7d5a[_0x8895('0x22')]===_0x8895('0x23')){var _0xc1ce17={'id':_0x3f7d5a['id'],'name':_0x3f7d5a['name'],'strategy':_0x3f7d5a[_0x8895('0x24')],'answered':_0x3f7d5a[_0x8895('0x25')],'available':_0x3f7d5a[_0x8895('0x26')],'loggedIn':_0x3f7d5a[_0x8895('0x27')],'pTalking':_0x3f7d5a[_0x8895('0x28')],'sumBillable':_0x3f7d5a['sumBillable'],'sumDuration':_0x3f7d5a['sumDuration'],'sumHoldTime':_0x3f7d5a[_0x8895('0x29')]||0x0,'talking':_0x3f7d5a[_0x8895('0x2a')],'total':_0x3f7d5a[_0x8895('0x2b')],'type':_0x3f7d5a[_0x8895('0x22')],'unmanaged':_0x3f7d5a['unmanaged'],'abandoned':_0x3f7d5a[_0x8895('0x2c')],'waiting':_0x3f7d5a[_0x8895('0x2d')],'loggedInDb':_0x3f7d5a[_0x8895('0x2e')],'dialActive':_0x3f7d5a['dialActive'],'dialMethod':_0x3f7d5a['dialMethod'],'dialOriginateCallerIdName':_0x3f7d5a[_0x8895('0x2f')],'dialOriginateCallerIdNumber':_0x3f7d5a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3f7d5a[_0x8895('0x30')],'dialPrefix':_0x3f7d5a[_0x8895('0x31')],'outboundAnswerAgiCallsDay':_0x3f7d5a[_0x8895('0x32')],'outboundAnswerCallsDay':_0x3f7d5a[_0x8895('0x33')],'outboundBlacklistCallsDay':_0x3f7d5a[_0x8895('0x34')],'outboundBusyCallsDay':_0x3f7d5a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3f7d5a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3f7d5a[_0x8895('0x35')],'outboundDropCallsDayCallersExit':_0x3f7d5a[_0x8895('0x36')],'outboundDropCallsDayTimeout':_0x3f7d5a[_0x8895('0x37')],'outboundNoAnswerCallsDay':_0x3f7d5a[_0x8895('0x38')],'outboundNoSuchCallsDay':_0x3f7d5a[_0x8895('0x39')],'outboundOriginateFailureCallsDay':_0x3f7d5a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3f7d5a['outboundReCallsDay'],'outboundRejectCallsDay':_0x3f7d5a[_0x8895('0x3a')],'outboundUnknownCallsDay':_0x3f7d5a[_0x8895('0x3b')],'outboundAbandonedCallsDay':_0x3f7d5a[_0x8895('0x3c')],'predictiveIntervalAnsweredCalls':_0x3f7d5a[_0x8895('0x3d')],'predictiveIntervalAvgHoldtime':_0x3f7d5a[_0x8895('0x3e')],'predictiveIntervalAvgTalktime':_0x3f7d5a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3f7d5a[_0x8895('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x3f7d5a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3f7d5a[_0x8895('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f7d5a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3f7d5a[_0x8895('0x41')],'predictiveIntervalMultiplicativeFactor':_0x3f7d5a[_0x8895('0x42')],'predictiveIntervalPauses':_0x3f7d5a[_0x8895('0x43')],'predictiveIntervalAvailable':_0x3f7d5a[_0x8895('0x44')],'predictiveIntervalTotalCalls':_0x3f7d5a[_0x8895('0x45')],'message':_0x3f7d5a['message'],'originated':_0x3f7d5a[_0x8895('0x46')],'erlangCalls':_0x3f7d5a[_0x8895('0x47')],'erlangCallToSecond':_0x3f7d5a[_0x8895('0x48')],'erlangAbandonmentRate':_0x3f7d5a[_0x8895('0x49')],'erlangBusyFactor':_0x3f7d5a[_0x8895('0x4a')],'startPredictive':_0x3f7d5a['startPredictive'],'startProgressive':_0x3f7d5a[_0x8895('0x4b')]};if(_0x3f7d5a['Trunk']){_0xc1ce17[_0x8895('0x4c')]={'id':_0x3f7d5a['Trunk']['id'],'name':_0x3f7d5a[_0x8895('0x4c')][_0x8895('0x4d')],'active':_0x3f7d5a[_0x8895('0x4c')][_0x8895('0x4e')],'callerid':_0x3f7d5a[_0x8895('0x4c')]['callerid']};}if(_0x3f7d5a[_0x8895('0x4f')]){_0xc1ce17['Interval']={'id':_0x3f7d5a[_0x8895('0x4f')]['id'],'name':_0x3f7d5a[_0x8895('0x4f')][_0x8895('0x4d')]};}var _0x9297ea=md5(JSON[_0x8895('0x50')](_0xc1ce17));if(_0x3f7d5a[_0x8895('0x51')]!==_0x9297ea){_0x3f7d5a['md5']=_0x9297ea;emit(util[_0x8895('0x52')](_0x8895('0x53'),_0xc1ce17['name']),_0x8895('0x54'),_0xc1ce17);}}}function emitVoiceQueueChannelRemove(_0x54ca09){logger[_0x8895('0x55')](_0x8895('0x56'),JSON['stringify'](_0x54ca09));emit(util[_0x8895('0x52')](_0x8895('0x53'),_0x54ca09['name']),'voice_queue_channel:remove',_0x54ca09);io[_0x8895('0x21')](_0x8895('0x57'),_0x54ca09);}function notSendMessagesQueue(_0x55aacc){if(_0x55aacc[_0x8895('0x58')]){if(_0x55aacc[_0x8895('0x46')]===0x0&&_0x55aacc['pTalking']===0x0){_0x55aacc[_0x8895('0x58')]=![];_0x55aacc[_0x8895('0x26')]=0x0;_0x55aacc[_0x8895('0x59')]=0x0;_0x55aacc[_0x8895('0x5a')]=_0x8895('0x5b');ut[_0x8895('0x5c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x55aacc[_0x8895('0x4d')]+'\x20is\x20not\x20active');}else{_0x55aacc[_0x8895('0x5a')]=_0x8895('0x5d');ut['logger'](_0x8895('0x5e'),_0x55aacc['name']+_0x8895('0x5f'));}emitCampaignPreview(_0x55aacc);}}Preview['prototype']['loopCampaigns']=function(){var _0x51277b=this;setInterval(function(){_0x51277b['syncCampaigns']();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x447ed6=this[_0x8895('0xf')];this['clockClearZombieChannels']+=0x1;for(var _0x4835d7 in _0x447ed6){if(_0x447ed6[_0x8895('0x60')](_0x4835d7)&&(_0x447ed6[_0x4835d7][_0x8895('0x61')]==='preview'||_0x447ed6[_0x4835d7][_0x8895('0x61')]===_0x8895('0x62'))&&_0x447ed6[_0x4835d7][_0x8895('0x22')]===_0x8895('0x23')){if(this[_0x8895('0x13')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x447ed6['hasOwnProperty'](_0x4835d7)&&_0x447ed6[_0x4835d7][_0x8895('0x61')]==='preview'&&_0x447ed6[_0x4835d7][_0x8895('0x22')]===_0x8895('0x23')){if(_0x447ed6[_0x4835d7][_0x8895('0x63')]){this[_0x8895('0x64')](_0x447ed6[_0x4835d7]);if(_0x447ed6[_0x4835d7]['dialPreviewAutoRecallMe'])this[_0x8895('0x65')](_0x447ed6[_0x4835d7]);}else{notSendMessagesQueue(_0x447ed6[_0x4835d7]);}}}};Preview[_0x8895('0xb')][_0x8895('0x66')]=function(_0x167302){var _0x2d585c=this;this[_0x8895('0xe')][_0x8895('0xc')](function(){if(!_[_0x8895('0x67')](_0x2d585c['actions'][_0x167302])){loggerAction[_0x8895('0x55')](_0x8895('0x68'),_0x167302,'Queue',_0x2d585c[_0x8895('0x69')][_0x167302]['queue'],'originated:\x20',JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302]['queue']][_0x8895('0x46')]),'pTalking:\x20',JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]][_0x8895('0x28')]),JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0x69')][_0x167302]['dialAnswer']),JSON['stringify'](_[_0x8895('0x6b')](_0x2d585c[_0x8895('0x69')][_0x167302],['contactId',_0x8895('0x6c'),'VoiceQueueId','ListId'])));return ami[_0x8895('0x6d')]({'action':'status','channel':_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6e')]})[_0x8895('0x6f')](function(_0x459e1a){if(_0x459e1a[_0x8895('0x5a')]===_0x8895('0x70')){setTimeout(function(){if(_0x2d585c[_0x8895('0x69')][_0x167302]){ut[_0x8895('0x71')](_0x2d585c['campaignsPreview'][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]],_0x8895('0x72'));if(_0x2d585c['actions'][_0x167302][_0x8895('0x73')]===!![]){ut[_0x8895('0x74')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]],_0x8895('0x72'));ut[_0x8895('0x75')](_0x8895('0x76')+_0x167302,_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]);}ut['loggerError'](_0x8895('0x77')+_0x167302,_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]);delete _0x2d585c[_0x8895('0x69')][_0x167302];}},0x2328);}});}});};Preview[_0x8895('0xb')]['clearZombieChannels']=function(){var _0x1b3c99=this;loggerAction[_0x8895('0x55')](_0x8895('0x78'),_[_0x8895('0x79')](this[_0x8895('0x69')]));for(var _0x58dd6c in this[_0x8895('0x69')]){if(_0x1b3c99[_0x8895('0x69')][_0x8895('0x60')](_0x58dd6c)){_0x1b3c99['clearZombieChannel'](_0x58dd6c);}}};Preview[_0x8895('0xb')][_0x8895('0x65')]=function(_0x2c777b){var _0x4ec8eb=this;rpcDb[_0x8895('0x7a')](_0x2c777b['id'],ut[_0x8895('0x7b')](this['agents']))[_0x8895('0x7c')](function(_0x26f68c){if(!_['isNil'](_0x26f68c)){for(var _0x2f990a=0x0;_0x2f990a<_0x26f68c[_0x8895('0x7d')];_0x2f990a+=0x1){if(ut[_0x8895('0x7e')](_0x26f68c[_0x2f990a][_0x8895('0x7f')])<_0x2c777b['dialRecallMeTimeout']*0x3c){if(_0x26f68c[_0x2f990a]['Agent']&&!_0x26f68c[_0x2f990a][_0x8895('0x80')][_0x8895('0x81')]){_0x4ec8eb[_0x8895('0x82')](_0x26f68c[_0x2f990a]['id'])['then'](ut[_0x8895('0x83')](_0x8895('0x84')))['catch'](ut[_0x8895('0x83')]('[RecallMe]'));}else{rpcDb[_0x8895('0x85')](_0x26f68c[_0x2f990a]['id']);}}else{var _0x2bd955=new Action(_0x26f68c[_0x2f990a],_0x2c777b);_0x2bd955[_0x8895('0x86')]=moment()[_0x8895('0x52')](_0x8895('0x87'));_0x2c777b['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x2bd955,0x17,_0x8895('0x88'));if(_0x2c777b[_0x8895('0x89')]){rpcDb['rescheduleContactInQueue'](ut[_0x8895('0x8a')](_0x26f68c[_0x2f990a]));rpcDb[_0x8895('0x8b')](_0x2bd955,_0x8895('0x8c'));}else{ut[_0x8895('0x8d')](_0x2bd955,0x16,'RecallFailedTimeout');rpcDb[_0x8895('0x8b')](_0x2bd955,_0x8895('0x8e'));rpcDb[_0x8895('0x8f')](_0x2bd955,_0x8895('0x8e'));}}}}})[_0x8895('0x6f')](ut[_0x8895('0x83')](_0x8895('0x90')));};Preview[_0x8895('0xb')][_0x8895('0x64')]=function(_0x21c7bb){_0x21c7bb[_0x8895('0x58')]=!![];if(ut[_0x8895('0x91')](_0x21c7bb[_0x8895('0x27')])){_0x21c7bb[_0x8895('0x5a')]=_0x8895('0x92');}else if(!ut['isActive'](_0x21c7bb['dialActive'])){_0x21c7bb['message']=_0x8895('0x5b');}else if(!this[_0x8895('0x93')](_0x21c7bb[_0x8895('0x4c')])){if(!this[_0x8895('0x93')](_0x21c7bb[_0x8895('0x94')])){_0x21c7bb['message']=_0x8895('0x95');}else{_0x21c7bb[_0x8895('0x5a')]='ACTIVE';}}else{_0x21c7bb[_0x8895('0x5a')]=_0x8895('0x96');}emitCampaignPreview(_0x21c7bb);};Preview[_0x8895('0xb')][_0x8895('0x97')]=function(_0x3ee89e,_0x526ac9,_0x6440ea){var _0x3c318c=this;var _0x119624=this[_0x8895('0x69')][_0x526ac9];var _0x113ac4=this[_0x8895('0xf')][_0x119624[_0x8895('0x6a')]];var _0x5e7048;if(_0x113ac4){switch(_0x6440ea){case'1':_0x113ac4[_0x8895('0x39')]+=0x1;_0x119624[_0x8895('0x98')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x0,_0x8895('0x9a'));ami[_0x8895('0x21')](_0x8895('0x9b'),ut['buildObj'](_0x119624,_0x8895('0x9c')));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0x9d'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xa0'));}else{if(_0x119624['countnosuchnumberretry']>=_0x113ac4[_0x8895('0xa1')]){rpcDb['createCustomerFinal'](_0x119624,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0x98'),_0x113ac4['dialNoSuchNumberRetryFrequency']),_0x119624[_0x8895('0xa4')],_0x119624['activeContact']);}}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;case _0x8895('0xa6'):var _0x42d342=moment()[_0x8895('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x119624['responsetime']=_0x42d342;_0x119624[_0x8895('0xa7')]=_0x42d342;_0x119624['dialAnswer']=!![];_0x113ac4[_0x8895('0x28')]+=0x1;logger[_0x8895('0x55')]('[syncHangup][talking][increment]',_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],_0x8895('0xaa'),_0x113ac4[_0x8895('0x28')]);ami['emit'](_0x8895('0xab'),ut['buildObj'](_0x119624,'connect',this[_0x8895('0xf')][_0x119624['queue']]));if(_0x113ac4[_0x8895('0xac')]){ami[_0x8895('0x21')](_0x8895('0xad'),ut[_0x8895('0xae')](_0x119624));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x119624,_0x8895('0xaf'),this[_0x8895('0xf')][_0x119624[_0x8895('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x8895('0xb0')](_0x119624,_0x8895('0xaf')));_0x113ac4[_0x8895('0x33')]+=0x1;_0x113ac4['total']+=0x1;_0x113ac4[_0x8895('0x25')]+=0x1;ut[_0x8895('0x74')](_0x113ac4,_0x8895('0xb1'));_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut['logCustomer'](_0x119624,0x4,_0x8895('0xb2'));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0xb3'));rpcDb[_0x8895('0x8f')](_0x119624,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x8895('0xb4')](_0x119624);_0x113ac4[_0x8895('0xb5')]+=_0x119624['talktime'];_0x113ac4[_0x8895('0xb6')]+=_0x119624[_0x8895('0xb7')];logger[_0x8895('0x55')](_0x8895('0xb8'),_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],'pTalking:\x20',_0x113ac4[_0x8895('0x28')]);delete this['actions'][_0x3ee89e[_0x8895('0xa5')]];break;case _0x8895('0xb9'):_0x113ac4[_0x8895('0xba')]+=0x1;_0x119624[_0x8895('0xbb')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x5,_0x8895('0xbc'));ami[_0x8895('0x21')](_0x8895('0xbd'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xbe')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0xf,'Global');rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xc0'));}else{if(_0x119624[_0x8895('0xbb')]>=_0x113ac4[_0x8895('0xc1')]){rpcDb['createCustomerFinal'](_0x119624,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xbb'),_0x113ac4[_0x8895('0xc2')]),_0x119624[_0x8895('0xa4')],_0x119624['activeContact']);}}break;case _0x8895('0xc3'):_0x113ac4[_0x8895('0x38')]+=0x1;_0x119624['countnoanswerretry']+=0x1;_0x119624[_0x8895('0xc4')]=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x3,_0x8895('0xc5'));ami[_0x8895('0x21')](_0x8895('0xc6'),ut['buildObj'](_0x119624,_0x8895('0xc7')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xc8'));}else{if(_0x119624['countnoanswerretry']>=_0x113ac4['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xc9'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xca'),_0x113ac4[_0x8895('0xcb')]),_0x119624['unlockAgent'],_0x119624[_0x8895('0xcc')]);}}break;case _0x8895('0xcd'):_0x113ac4[_0x8895('0xce')]+=0x1;_0x119624['countcongestionretry']+=0x1;_0x119624['countglobal']=ut['totalGlobal'](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x8,_0x8895('0xcf'));ami[_0x8895('0x21')](_0x8895('0xd0'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xd1')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,'Global');rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xd2'));}else{if(_0x119624[_0x8895('0xd3')]>=_0x113ac4[_0x8895('0xd4')]){rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xd5'));}else{rpcDb[_0x8895('0xa2')](ut['scheduledAt'](_0x119624,_0x8895('0xd3'),_0x113ac4[_0x8895('0xc2')]),_0x119624[_0x8895('0xa4')],_0x119624[_0x8895('0xcc')]);}}break;case _0x8895('0xd6'):_0x113ac4['outboundRejectCallsDay']+=0x1;_0x119624[_0x8895('0xd7')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x14,_0x8895('0xd8'));ami[_0x8895('0x21')](_0x8895('0xd9'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xda')));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xdb'));if(ut['totalGlobal'](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0x14,_0x8895('0xd8'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xdc'));}else{if(_0x119624['countagentrejectretry']>=_0x113ac4[_0x8895('0xdd')]){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xdc'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xd7'),_0x113ac4['dialAgentRejectRetryFrequency']),_0x119624['unlockAgent'],_0x119624[_0x8895('0xcc')]);}}break;case'ABANDONED':_0x113ac4['outboundAbandonedCallsDay']+=0x1;_0x119624[_0x8895('0xde')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0xb,_0x8895('0xdf'));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xe0'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xe0'));}else{if(_0x119624[_0x8895('0xe1')]>=_0x113ac4[_0x8895('0xe2')]){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xe0'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,'countabandonedretry',_0x113ac4[_0x8895('0xe3')]),_0x119624[_0x8895('0xa4')],_0x119624[_0x8895('0xcc')]);}}break;case'18':_0x113ac4[_0x8895('0x3b')]+=0x1;_0x119624[_0x8895('0xe4')]+=0x1;_0x119624[_0x8895('0xc4')]=ut[_0x8895('0x99')](_0x119624);ut['logCustomer'](_0x119624,0x12,_0x3ee89e[_0x8895('0xe5')]||_0x3ee89e[_0x8895('0xe6')]);ami[_0x8895('0x21')](_0x8895('0xe7'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xe8')));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0xe9'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut['cloneAction'](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xe9'));}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;case'19':_0x113ac4[_0x8895('0x3b')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x13,_0x3ee89e[_0x8895('0xe5')]||_0x3ee89e[_0x8895('0xe6')]);ami[_0x8895('0x21')](_0x8895('0xe7'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xe8')));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xea'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xea'));}else{rpcDb[_0x8895('0x8f')](_0x119624,'[callProgressDetectingCustomer][machine]');}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;default:if(_0x119624['dialAnswer']){ut['decrementTalkink'](_0x113ac4,_0x8895('0xeb'));ut['loggerError'](_0x8895('0xec')+_0x113ac4['name'],_0x3ee89e);}_0x113ac4['outboundUnknownCallsDay']+=0x1;_0x119624[_0x8895('0xc4')]=ut['totalGlobal'](_0x119624);ut[_0x8895('0x8d')](_0x119624,0xc,_0x3ee89e['cause-txt']||_0x3ee89e[_0x8895('0xe6')]);rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,'Global');rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xed'));}else{rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xed'));}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];}if(!(_0x119624[_0x8895('0x73')]&&_0x6440ea==='16')){ut[_0x8895('0x71')](_0x113ac4,_0x8895('0xee'));logger[_0x8895('0x55')](_0x8895('0xef'),_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],_0x8895('0xf0'),_0x113ac4['originated']);}if(_0x6440ea!==_0x8895('0xa6')){delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];delete this[_0x8895('0x69')][_0x3ee89e['destlinkedid']];}}};Preview[_0x8895('0xb')][_0x8895('0xf1')]=function(_0xf3b3e5,_0x20752d,_0x124e1b){if(_[_0x8895('0xf2')](_0x20752d)&&_0x8895('0xf3')!==typeof _0x20752d){return;}if(_[_0x8895('0xf2')](_0x124e1b)&&_0x8895('0xf3')!==typeof _0x124e1b){return;}switch(_0x124e1b[_0x8895('0xf4')]){case'0':ut[_0x8895('0xf5')](_0xf3b3e5,0x0,_0x8895('0x9a'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xf7'));break;case'3':ut[_0x8895('0xf5')](_0xf3b3e5,0x3,_0x8895('0xc5'));rpcDb['createAgentHistory'](_0xf3b3e5,_0x8895('0xf8'));break;case'5':ut['logAgent'](_0xf3b3e5,0x5,_0x8895('0xbc'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xf9'));break;case'8':ut['logAgent'](_0xf3b3e5,0x8,_0x8895('0xcf'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8895('0xf5')](_0xf3b3e5,0x16,'AnswerAGI');rpcDb[_0x8895('0xf6')](_0xf3b3e5,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xf3b3e5,0xc,_0x124e1b[_0x8895('0xf4')]);rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xfa'));}ut[_0x8895('0x71')](_0x20752d,_0x8895('0xfb'));logger['info'](_0x8895('0xfc'),_0xf3b3e5['uniqueid'],'\x20Queue',_0x20752d[_0x8895('0x4d')],_0x8895('0xf0'),_0x20752d['originated']);delete this[_0x8895('0x69')][_0xf3b3e5[_0x8895('0xa8')]];};Preview[_0x8895('0xb')]['checkInBlack']=function(_0x3816b4,_0x431b18,_0x114200,_0x54e1b5,_0x465c2b){var _0x34a3c9=this;return new BPromise(function(_0x87bfe4,_0x3a1882){if(_[_0x8895('0x67')](_0x431b18)||_[_0x8895('0x67')](_0x431b18[_0x8895('0xfd')])||_[_0x8895('0x67')](_0x431b18['Contact']['phone'])||_[_0x8895('0x67')](_0x431b18['VoiceQueueId'])){_0x3a1882(ut[_0x8895('0x5a')](_0x8895('0xfe'),_0x54e1b5,_0x465c2b));return;}var _0x270a6e=uuid['v4']();var _0x21d14b=_0x34a3c9[_0x8895('0xf')][_0x431b18[_0x8895('0xff')][_0x8895('0x4d')]];var _0x44951a=_0x114200?_0x34a3c9[_0x8895('0x12')][_0x114200]['id']:undefined;_0x34a3c9[_0x8895('0x69')][_0x270a6e]=new Action(_0x431b18,_0x21d14b,_0x270a6e,_0x114200,_0x44951a);var _0x119bf3=_0x34a3c9[_0x8895('0x69')][_0x270a6e];_0x119bf3['unlockAgent']=_0x54e1b5;_0x119bf3[_0x8895('0xcc')]=_0x465c2b;_0x119bf3[_0x8895('0x100')]=_0x114200;if(_[_0x8895('0x101')](_0x3816b4)){_0x34a3c9[_0x8895('0x102')](_0x119bf3,_0x21d14b,_0x431b18,_0x114200)[_0x8895('0x7c')](function(_0x3c68a9){logger[_0x8895('0x55')](_0x8895('0x103'),_0x8895('0x104')+_0x119bf3[_0x8895('0x6a')]+_0x8895('0x105')+_0x119bf3[_0x8895('0x106')],JSON[_0x8895('0x50')](_0x3c68a9));ami[_0x8895('0x21')]('custom:agentcalled',ut[_0x8895('0xb0')](_0x119bf3,'called',_0x34a3c9['campaignsPreview'][_0x119bf3['queue']]));_0x87bfe4(ut[_0x8895('0x5a')](_0x8895('0x107')));})[_0x8895('0x6f')](function(_0x560732){ut[_0x8895('0x5c')](_0x8895('0x108'),_0x560732);_0x3a1882(ut[_0x8895('0x5a')]('Call\x20failed',_0x54e1b5,_0x465c2b));});}else{_0x21d14b[_0x8895('0x34')]+=0x1;ut[_0x8895('0x109')](_0x119bf3);rpcDb[_0x8895('0x10a')](_0x119bf3,'[Blacklist][error]');delete _0x34a3c9[_0x8895('0x69')][_0x270a6e];_0x3a1882(ut[_0x8895('0x5a')](_0x8895('0x10b'),_0x54e1b5,_0x465c2b));}});};Preview[_0x8895('0xb')][_0x8895('0x93')]=function(_0x3273c1){return!_['isNil'](_0x3273c1)&&!_[_0x8895('0x67')](_0x3273c1[_0x8895('0x4d')])&&!_['isNil'](_0x3273c1[_0x8895('0x4e')])&&_0x3273c1[_0x8895('0x4e')]&&!_[_0x8895('0x67')](this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1[_0x8895('0x4d')])])&&!_[_0x8895('0x67')](this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1['name'])]['status'])&&(this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1[_0x8895('0x4d')])][_0x8895('0x10d')]===_0x8895('0x10e')||this[_0x8895('0x11')][util['format']('SIP/%s',_0x3273c1[_0x8895('0x4d')])][_0x8895('0x10d')]===_0x8895('0x10f'));};Preview[_0x8895('0xb')][_0x8895('0x82')]=function(_0x3b465c,_0x28aeb9){var _0x2ff7e6=this;return new BPromise(function(_0x1be275,_0x8f1f00){_0x2ff7e6['execRun'](_0x3b465c,_0x28aeb9)[_0x8895('0x7c')](function(_0x5033d6){_0x1be275(_[_0x8895('0x6b')](_0x5033d6,[_0x8895('0x5a')]));})[_0x8895('0x6f')](function(_0x5e109c){if(_0x5e109c['unlock']){rpcDb['unlockContact'](_0x3b465c);}if(_0x5e109c[_0x8895('0x4e')]){rpcDb['disableContact'](_0x3b465c);}_0x8f1f00(_[_0x8895('0x6b')](_0x5e109c,[_0x8895('0x5a')]));});});};Preview[_0x8895('0xb')]['execRun']=function(_0x3ccf2a,_0x3a348d){var _0x50136b=this;return new BPromise(function(_0x2bd804,_0x564234){var _0x9ce4f5,_0xa87a01;rpcDb[_0x8895('0x110')](_0x3ccf2a)[_0x8895('0x7c')](function(_0x1d5fd7){if(!_['isNil'](_0x1d5fd7[0x0])){_0xa87a01=_0x1d5fd7[0x0]['recallme']?![]:!![];_0x9ce4f5=_0x1d5fd7[0x0][_0x8895('0x111')]?!![]:![];_0x9ce4f5=_0x3a348d?!![]:_0x9ce4f5;}var _0x41d7f9=_0x50136b[_0x8895('0x112')](_0x1d5fd7);if(_0x41d7f9[_0x8895('0x113')]){rpcDb[_0x8895('0x114')](_[_0x8895('0x6b')](_0x1d5fd7[0x0],['VoiceQueueId','Contact.phone']))[_0x8895('0x7c')](function(_0x3a6226){_0x50136b[_0x8895('0x115')](_0x3a6226,_0x1d5fd7[0x0],_0x3a348d,_0xa87a01,_0x9ce4f5)[_0x8895('0x7c')](function(_0x448496){_0x2bd804(_0x448496);})['catch'](function(_0x50baed){_0x564234(_0x50baed);});})[_0x8895('0x6f')](function(_0x4f0a55){ut['logger'](_0x8895('0x116'),_0x4f0a55);_0x564234(ut[_0x8895('0x5a')]('Call\x20unsuccessful',_0xa87a01,_0x9ce4f5));});}else{_0x564234(ut[_0x8895('0x5a')](_0x41d7f9['message'],_0xa87a01,_0x9ce4f5));}})[_0x8895('0x6f')](function(_0x242a19){ut[_0x8895('0x5c')](_0x8895('0x117'),_0x242a19);_0x564234(ut[_0x8895('0x5a')](_0x8895('0x118'),![],!![]));});});};Preview['prototype'][_0x8895('0x112')]=function(_0x3ecc83){if(_[_0x8895('0x67')](_0x3ecc83)||_[_0x8895('0x101')](_0x3ecc83)||!_[_0x8895('0x67')](_0x3ecc83[0x0][_0x8895('0x80')])&&_['isNil'](_0x3ecc83[0x0][_0x8895('0x80')][_0x8895('0x4d')])){ut[_0x8895('0x5c')](_0x8895('0x119'),_0x3ecc83);return{'isValid':![],'message':_0x8895('0x11a')};}var _0x57230f=this['campaignsPreview'][_0x3ecc83[0x0]['Queue'][_0x8895('0x4d')]];_0x57230f[_0x8895('0x5a')]=_0x8895('0x96');if(_['isNil'](_0x57230f)){ut['logger'](_0x8895('0x11b'),_0x57230f);return{'isValid':![],'message':_0x8895('0x11c')};}if(!this[_0x8895('0x93')](_0x57230f[_0x8895('0x4c')])){ut[_0x8895('0x5c')](_0x8895('0x11d'),'campaign\x20Name:\x20'+_0x57230f['name']+_0x8895('0x11e'));if(!this[_0x8895('0x93')](_0x57230f['TrunkBackup'])){ut[_0x8895('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x57230f['name']+_0x8895('0x11f'));return{'isValid':![],'message':_0x8895('0x120')};}}if(!ut[_0x8895('0x121')](_0x57230f['dialActive'])){ut[_0x8895('0x5c')]('[Preview][validateContact][Campaign\x20Active]',_0x57230f[_0x8895('0x4d')]+_0x8895('0x122'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x57230f[_0x8895('0x4d')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x8895('0x123')};};Preview[_0x8895('0xb')][_0x8895('0x102')]=function(_0x20f05c,_0x5eca7f,_0x4036ab,_0x4bf06a){var _0x2f2490=this;return new BPromise(function(_0x28506a,_0x30baea){var _0x2ecc8b=_0x20f05c[_0x8895('0xa8')];var _0x1f5eb7=_0x2f2490[_0x8895('0x93')](_0x5eca7f[_0x8895('0x4c')])?util[_0x8895('0x52')](_0x8895('0x124'),_0x5eca7f[_0x8895('0x4c')]['name'],_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x31')])?'':_0x5eca7f[_0x8895('0x31')]['trim']()||'',_0x5eca7f[_0x8895('0x125')]>0x0?_0x4036ab[_0x8895('0xfd')]['phone'][_0x8895('0x126')](_0x5eca7f[_0x8895('0x125')]):_0x4036ab[_0x8895('0xfd')][_0x8895('0x127')]):util[_0x8895('0x52')](_0x8895('0x124'),_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x94')])?_0x5eca7f[_0x8895('0x4c')]['name']:_0x5eca7f['TrunkBackup'][_0x8895('0x4d')],_['isNil'](_0x5eca7f[_0x8895('0x31')])?'':_0x5eca7f[_0x8895('0x31')][_0x8895('0x128')]()||'',_0x5eca7f['dialCutDigit']>0x0?_0x4036ab[_0x8895('0xfd')]['phone'][_0x8895('0x126')](_0x5eca7f[_0x8895('0x125')]):_0x4036ab['Contact'][_0x8895('0x127')]);var _0x30e5a2=_0x2f2490[_0x8895('0x93')](_0x5eca7f[_0x8895('0x4c')])?ut[_0x8895('0x129')](_0x5eca7f['Trunk'][_0x8895('0x12a')],_0x5eca7f[_0x8895('0x2f')],_0x5eca7f['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x5eca7f[_0x8895('0x12b')],_0x5eca7f['dialRandomLastDigitCallerIdNumber']):_0x5eca7f[_0x8895('0x12b')]):ut[_0x8895('0x129')](_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x94')])?_0x5eca7f[_0x8895('0x4c')][_0x8895('0x12a')]:_0x5eca7f['TrunkBackup'][_0x8895('0x12a')],_0x5eca7f[_0x8895('0x2f')],_0x5eca7f[_0x8895('0x12c')]>0x0?ut[_0x8895('0x12d')](_0x5eca7f[_0x8895('0x12b')],_0x5eca7f[_0x8895('0x12c')]):_0x5eca7f[_0x8895('0x12b')]);if(_0x30e5a2){_0x20f05c['originatecalleridname']=ut['extractCalleridName'](_0x30e5a2);_0x20f05c[_0x8895('0x12e')]=ut[_0x8895('0x12f')](_0x30e5a2);}var _0x43523c=ut[_0x8895('0x130')](_0x5eca7f,_0x4036ab,_0x1f5eb7,_0x30e5a2,_0x2ecc8b,_0x20f05c);_['merge'](_0x20f05c,ut['toLowerVariables'](_0x43523c));_0x20f05c[_0x8895('0x86')]=moment()[_0x8895('0x52')](_0x8895('0x87'));ami[_0x8895('0x6d')](ut[_0x8895('0x131')](_0x20f05c,_0x5eca7f,_0x43523c,_0x20f05c[_0x8895('0xcc')],_0x4bf06a))['then'](function(_0x4c4148){_0x5eca7f[_0x8895('0x46')]+=0x1;logger[_0x8895('0x55')](_0x8895('0x132'),_0x2ecc8b,_0x8895('0xa9'),_0x5eca7f[_0x8895('0x4d')],_0x8895('0xf0'),_0x5eca7f[_0x8895('0x46')]);_0x28506a(_0x4c4148);})[_0x8895('0x6f')](function(_0x18a523){ut['logAgent'](_0x20f05c,0xe,_0x8895('0x133'));rpcDb[_0x8895('0xf6')](_0x20f05c,'[originateFailure][logOriginateFailure]');_0x30baea(_0x18a523);});});};Preview[_0x8895('0xb')][_0x8895('0x1a')]=function(_0x3ff7fa){if(this[_0x8895('0x69')][_0x3ff7fa[_0x8895('0xa5')]]){this[_0x8895('0x69')][_0x3ff7fa[_0x8895('0xa5')]][_0x8895('0x6e')]=_0x3ff7fa['channel'];}};Preview['prototype'][_0x8895('0x134')]=function(_0xc93e09){var _0x398041=this;var _0xc35be9=this[_0x8895('0x69')][_0xc93e09[_0x8895('0x135')]];if(_0xc35be9){if(_0xc35be9['lookAgent']&&this[_0x8895('0x12')][_0xc35be9[_0x8895('0x100')]]){ut[_0x8895('0x136')](_0xc35be9,this['agents'][_0xc35be9[_0x8895('0x100')]][_0x8895('0x4d')],this[_0x8895('0x12')][_0xc35be9['lookAgent']]['id']);}var _0x1a62b4=_['clone'](_0xc35be9);_0x1a62b4[_0x8895('0x137')]=moment()[_0x8895('0x52')](_0x8895('0x87'));var _0x447dc0=_0x398041[_0x8895('0xf')][_0xc35be9['queue']];if(ut['isFailure'](_0xc93e09[_0x8895('0x138')])){if(_0xc35be9['unlockAgent']){rpcDb[_0x8895('0x139')](_0xc35be9[_0x8895('0x106')]);}if(_0xc35be9[_0x8895('0xcc')]){rpcDb[_0x8895('0x85')](_0xc35be9[_0x8895('0x106')]);}ami[_0x8895('0x21')](_0x8895('0x13a'),ut[_0x8895('0xb0')](_0xc35be9,'rejected',this[_0x8895('0xf')][_0xc35be9[_0x8895('0x6a')]]));this[_0x8895('0xf1')](_0x1a62b4,_0x447dc0,_0xc93e09);}else{_0xc35be9['starttime']=moment()[_0x8895('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x8895('0xf5')](_0x1a62b4,0x4,_0x8895('0xb2'));rpcDb[_0x8895('0xf6')](_0x1a62b4,_0x8895('0x13b'));}}};Preview[_0x8895('0xb')][_0x8895('0x15')]=function(_0x55d290){var _0x1186fa=this;var _0x466d3a=this[_0x8895('0x69')][_0x55d290['linkedid']];var _0x268d3c;if(_0x466d3a){_0x268d3c=this['campaignsPreview'][_0x466d3a[_0x8895('0x6a')]];logger[_0x8895('0x55')](_0x8895('0x13c'),_0x55d290[_0x8895('0xa5')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],_0x8895('0xaa'),_0x268d3c[_0x8895('0x28')]);}if(this[_0x8895('0x69')][_0x55d290[_0x8895('0xa5')]]&&_0x55d290[_0x8895('0xa5')]!==_0x55d290['uniqueid']){if(_0x55d290['cause']==='16'&&this[_0x8895('0x69')][_0x55d290[_0x8895('0xa5')]][_0x8895('0x73')]){this['callProgressDetectingCustomer'](_0x55d290,_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')]);}else if(this['actions'][_0x55d290[_0x8895('0xa5')]]['dialAnswer']){logger[_0x8895('0x55')](_0x8895('0x13e'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],'pTalking:\x20',_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')]);}}else if(_0x466d3a&&_[_0x8895('0x67')](_0x466d3a[_0x8895('0x13f')])&&_0x268d3c[_0x8895('0x140')]&&_0x55d290[_0x8895('0xa5')]===_0x55d290['uniqueid']&&_[_0x8895('0x67')](_0x55d290[_0x8895('0xf4')])&&_0x55d290[_0x8895('0x13d')]==='16'&&_0x55d290[_0x8895('0x141')]==='6'&&_[_0x8895('0xf2')](_0x466d3a[_0x8895('0x142')])){if(_0x466d3a['unlockAgent']){rpcDb['unlockContact'](_0x466d3a[_0x8895('0x106')]);}if(_0x466d3a[_0x8895('0xcc')]){rpcDb[_0x8895('0x85')](_0x466d3a[_0x8895('0x106')]);}_0x55d290[_0x8895('0xf4')]='22';this[_0x8895('0xf1')](_0x466d3a,_0x268d3c,_0x55d290);}else if(_0x466d3a&&_0x466d3a[_0x8895('0x142')]){if(_0x55d290['cause']==='16'&&this['actions'][_0x55d290[_0x8895('0xa5')]]['dialAnswer']){logger[_0x8895('0x55')](_0x8895('0x143'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],'\x20Queue',_0x268d3c[_0x8895('0x4d')],_0x8895('0xaa'),_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290['linkedid'],_0x55d290[_0x8895('0x13d')]);}else if(this[_0x8895('0x69')][_0x55d290['linkedid']][_0x8895('0x73')]){logger[_0x8895('0x55')](_0x8895('0x13e'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],'pTalking:\x20',_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290['linkedid'],_0x55d290[_0x8895('0x13d')]);}}};Preview[_0x8895('0xb')]['syncDialEnd']=function(_0x4c4240){if(this[_0x8895('0x69')][_0x4c4240[_0x8895('0x144')]]&&_0x4c4240[_0x8895('0x144')]!==_0x4c4240[_0x8895('0x145')]){this[_0x8895('0x97')](_0x4c4240,_0x4c4240[_0x8895('0x144')],_0x4c4240[_0x8895('0xe6')]);}};Preview[_0x8895('0xb')]['syncHangupRequest']=function(_0x28ec87){if(this['actions'][_0x28ec87[_0x8895('0xa5')]]&&_0x28ec87[_0x8895('0xa5')]!==_0x28ec87[_0x8895('0xa8')]&&!this[_0x8895('0x69')][_0x28ec87[_0x8895('0xa5')]]['dialAnswer']){if(_0x28ec87[_0x8895('0x13d')]==='1'){this[_0x8895('0x97')](_0x28ec87,_0x28ec87[_0x8895('0xa5')],_0x28ec87[_0x8895('0x13d')]);}}};Preview[_0x8895('0xb')]['addVariable']=function(_0x419702,_0x3a7d70,_0x4b937f){if(this['actions'][_0x419702]){if(_[_0x8895('0x67')](this[_0x8895('0x69')][_0x419702][_0x8895('0x146')])){this[_0x8895('0x69')][_0x419702][_0x8895('0x146')]={};}this[_0x8895('0x69')][_0x419702][_0x8895('0x146')][_0x3a7d70]=_0x4b937f;}};Preview['prototype'][_0x8895('0x1c')]=function(_0x49928b){try{if(!_[_0x8895('0x67')](_0x49928b)){if(ut[_0x8895('0x147')](_['keys'](_0x49928b['variable'])[0x0])){this[_0x8895('0x148')](_0x49928b[_0x8895('0xa8')],_[_0x8895('0x149')](_0x49928b['variable'])[0x0],_0x49928b[_0x8895('0x14a')]);}}}catch(_0x47837c){logger['error'](_0x8895('0x14b'),util[_0x8895('0x14c')](_0x47837c,{'showHidden':![],'depth':null}));}};Preview[_0x8895('0xb')][_0x8895('0x1e')]=function(_0x592e3b){if(_0x592e3b){if(this[_0x8895('0x69')][_0x592e3b['transfertargetlinkedid']]){this[_0x8895('0x69')][_0x592e3b['transfertargetlinkedid']][_0x8895('0x142')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0xe5a83a){if(_0xe5a83a){if(this[_0x8895('0x69')][_0xe5a83a[_0x8895('0x14d')]]){this[_0x8895('0x69')][_0xe5a83a[_0x8895('0x14d')]][_0x8895('0x142')]=!![];}}};module[_0x8895('0x14e')]=Preview; \ No newline at end of file +var _0xee14=['syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','enqueue','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','Action','catch','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','logger2','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','total','answered','decrementTalkink','[16]','Answer','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','\x20Queue','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','dialGlobalMaxRetry','[callProgressDetectingCustomer][logAgentReject]','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','run','execRun','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','channel','clone','isFailure','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','error','inspect','transfertargetlinkedid','transfererlinkedid','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./action','./util/util','redis','defaults','localhost','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee14,0x13a));var _0x4ee1=function(_0x3d54f3,_0x411a0a){_0x3d54f3=_0x3d54f3-0x0;var _0x44640f=_0xee14[_0x3d54f3];return _0x44640f;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x4ee1('0x0'));var uuid=require(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var md5=require(_0x4ee1('0x3'));var Redis=require(_0x4ee1('0x4'));var config=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var loggerAction=require(_0x4ee1('0x6'))('actionPreview');var ami=require(_0x4ee1('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0x4ee1('0x9'));var ut=require(_0x4ee1('0xa'));config[_0x4ee1('0xb')]=_[_0x4ee1('0xc')](config[_0x4ee1('0xb')],{'host':_0x4ee1('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4ee1('0xb')]));var Sequence=function(){};Sequence[_0x4ee1('0xe')]['enqueue']=function(_0x3fa61b){this[_0x4ee1('0xf')]=this[_0x4ee1('0xf')]?this[_0x4ee1('0xf')]['finally'](_0x3fa61b):_0x3fa61b();};function Preview(_0x1b3737){this[_0x4ee1('0x10')]=new Sequence();this[_0x4ee1('0x11')]=_0x1b3737[_0x4ee1('0x12')];this[_0x4ee1('0x13')]=_0x1b3737[_0x4ee1('0x13')];this['actions']={};this[_0x4ee1('0x14')]=_0x1b3737[_0x4ee1('0x14')];this[_0x4ee1('0x15')]=0x0;ami['on'](_0x4ee1('0x16'),this[_0x4ee1('0x17')][_0x4ee1('0x18')](this));ami['on'](_0x4ee1('0x19'),this[_0x4ee1('0x1a')][_0x4ee1('0x18')](this));ami['on']('hanguprequest',this[_0x4ee1('0x1b')][_0x4ee1('0x18')](this));ami['on'](_0x4ee1('0x1c'),this[_0x4ee1('0x1d')][_0x4ee1('0x18')](this));ami['on'](_0x4ee1('0x1e'),this[_0x4ee1('0x1f')][_0x4ee1('0x18')](this));ami['on'](_0x4ee1('0x20'),this[_0x4ee1('0x21')][_0x4ee1('0x18')](this));ami['on']('attendedtransfer',this[_0x4ee1('0x22')][_0x4ee1('0x18')](this));ami['on'](_0x4ee1('0x23'),this[_0x4ee1('0x24')][_0x4ee1('0x18')](this));this[_0x4ee1('0x25')](this['campaignsPreview']);}function emit(_0x8a631f,_0x333e96,_0x46611a){io['to'](_0x8a631f)[_0x4ee1('0x26')](_0x333e96,_0x46611a);}function emitCampaignPreview(_0x160a26){if(_0x160a26[_0x4ee1('0x27')]===_0x4ee1('0x28')){var _0x40fd98={'id':_0x160a26['id'],'name':_0x160a26[_0x4ee1('0x29')],'strategy':_0x160a26[_0x4ee1('0x2a')],'answered':_0x160a26['answered'],'available':_0x160a26['available'],'loggedIn':_0x160a26[_0x4ee1('0x2b')],'pTalking':_0x160a26[_0x4ee1('0x2c')],'sumBillable':_0x160a26[_0x4ee1('0x2d')],'sumDuration':_0x160a26[_0x4ee1('0x2e')],'sumHoldTime':_0x160a26[_0x4ee1('0x2f')]||0x0,'talking':_0x160a26[_0x4ee1('0x30')],'total':_0x160a26['total'],'type':_0x160a26['type'],'unmanaged':_0x160a26[_0x4ee1('0x31')],'abandoned':_0x160a26[_0x4ee1('0x32')],'waiting':_0x160a26['waiting'],'loggedInDb':_0x160a26[_0x4ee1('0x33')],'dialActive':_0x160a26[_0x4ee1('0x34')],'dialMethod':_0x160a26[_0x4ee1('0x35')],'dialOriginateCallerIdName':_0x160a26[_0x4ee1('0x36')],'dialOriginateCallerIdNumber':_0x160a26[_0x4ee1('0x37')],'dialOriginateTimeout':_0x160a26[_0x4ee1('0x38')],'dialPrefix':_0x160a26[_0x4ee1('0x39')],'outboundAnswerAgiCallsDay':_0x160a26['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x160a26[_0x4ee1('0x3a')],'outboundBlacklistCallsDay':_0x160a26['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x160a26[_0x4ee1('0x3b')],'outboundCongestionCallsDay':_0x160a26['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x160a26[_0x4ee1('0x3c')],'outboundDropCallsDayCallersExit':_0x160a26[_0x4ee1('0x3d')],'outboundDropCallsDayTimeout':_0x160a26[_0x4ee1('0x3e')],'outboundNoAnswerCallsDay':_0x160a26[_0x4ee1('0x3f')],'outboundNoSuchCallsDay':_0x160a26[_0x4ee1('0x40')],'outboundOriginateFailureCallsDay':_0x160a26['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x160a26[_0x4ee1('0x41')],'outboundRejectCallsDay':_0x160a26['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x160a26[_0x4ee1('0x42')],'outboundAbandonedCallsDay':_0x160a26[_0x4ee1('0x43')],'predictiveIntervalAnsweredCalls':_0x160a26[_0x4ee1('0x44')],'predictiveIntervalAvgHoldtime':_0x160a26[_0x4ee1('0x45')],'predictiveIntervalAvgTalktime':_0x160a26[_0x4ee1('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x160a26['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x160a26[_0x4ee1('0x47')],'predictiveIntervalErlangCalls':_0x160a26[_0x4ee1('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x160a26[_0x4ee1('0x49')],'predictiveIntervalHitRate':_0x160a26[_0x4ee1('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x160a26[_0x4ee1('0x4b')],'predictiveIntervalPauses':_0x160a26[_0x4ee1('0x4c')],'predictiveIntervalAvailable':_0x160a26['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x160a26['predictiveIntervalTotalCalls'],'message':_0x160a26[_0x4ee1('0x4d')],'originated':_0x160a26[_0x4ee1('0x4e')],'erlangCalls':_0x160a26[_0x4ee1('0x4f')],'erlangCallToSecond':_0x160a26['erlangCallToSecond'],'erlangAbandonmentRate':_0x160a26[_0x4ee1('0x50')],'erlangBusyFactor':_0x160a26[_0x4ee1('0x51')],'startPredictive':_0x160a26[_0x4ee1('0x52')],'startProgressive':_0x160a26[_0x4ee1('0x53')]};if(_0x160a26[_0x4ee1('0x54')]){_0x40fd98[_0x4ee1('0x54')]={'id':_0x160a26[_0x4ee1('0x54')]['id'],'name':_0x160a26[_0x4ee1('0x54')][_0x4ee1('0x29')],'active':_0x160a26[_0x4ee1('0x54')][_0x4ee1('0x55')],'callerid':_0x160a26[_0x4ee1('0x54')][_0x4ee1('0x56')]};}if(_0x160a26['Interval']){_0x40fd98[_0x4ee1('0x57')]={'id':_0x160a26[_0x4ee1('0x57')]['id'],'name':_0x160a26[_0x4ee1('0x57')]['name']};}var _0x4858f9=md5(JSON[_0x4ee1('0x58')](_0x40fd98));if(_0x160a26[_0x4ee1('0x3')]!==_0x4858f9){_0x160a26[_0x4ee1('0x3')]=_0x4858f9;emit(util[_0x4ee1('0x59')]('voice:queue:%s',_0x40fd98[_0x4ee1('0x29')]),_0x4ee1('0x5a'),_0x40fd98);}}}function emitVoiceQueueChannelRemove(_0x11721a){logger[_0x4ee1('0x5b')](_0x4ee1('0x5c'),JSON[_0x4ee1('0x58')](_0x11721a));emit(util[_0x4ee1('0x59')](_0x4ee1('0x5d'),_0x11721a['name']),_0x4ee1('0x5e'),_0x11721a);io[_0x4ee1('0x26')](_0x4ee1('0x5f'),_0x11721a);}function notSendMessagesQueue(_0x2950a9){if(_0x2950a9[_0x4ee1('0x60')]){if(_0x2950a9[_0x4ee1('0x4e')]===0x0&&_0x2950a9['pTalking']===0x0){_0x2950a9[_0x4ee1('0x60')]=![];_0x2950a9[_0x4ee1('0x61')]=0x0;_0x2950a9[_0x4ee1('0x62')]=0x0;_0x2950a9[_0x4ee1('0x4d')]=_0x4ee1('0x63');ut[_0x4ee1('0x64')](_0x4ee1('0x65'),_0x2950a9[_0x4ee1('0x29')]+_0x4ee1('0x66'));}else{_0x2950a9[_0x4ee1('0x4d')]=_0x4ee1('0x67');ut[_0x4ee1('0x64')](_0x4ee1('0x65'),_0x2950a9['name']+_0x4ee1('0x68'));}emitCampaignPreview(_0x2950a9);}}Preview[_0x4ee1('0xe')]['loopCampaigns']=function(){var _0x3c759f=this;setInterval(function(){_0x3c759f['syncCampaigns']();},0x7cf);};Preview[_0x4ee1('0xe')]['syncCampaigns']=function(){var _0x14c333=this[_0x4ee1('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0x25d683 in _0x14c333){if(_0x14c333[_0x4ee1('0x69')](_0x25d683)&&(_0x14c333[_0x25d683][_0x4ee1('0x35')]===_0x4ee1('0x7')||_0x14c333[_0x25d683]['dialMethod']===_0x4ee1('0x6a'))&&_0x14c333[_0x25d683][_0x4ee1('0x27')]===_0x4ee1('0x28')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0x4ee1('0x6b')]();}}if(_0x14c333[_0x4ee1('0x69')](_0x25d683)&&_0x14c333[_0x25d683][_0x4ee1('0x35')]===_0x4ee1('0x7')&&_0x14c333[_0x25d683][_0x4ee1('0x27')]==='outbound'){if(_0x14c333[_0x25d683]['dialActive']){this[_0x4ee1('0x6c')](_0x14c333[_0x25d683]);if(_0x14c333[_0x25d683][_0x4ee1('0x6d')])this[_0x4ee1('0x6e')](_0x14c333[_0x25d683]);}else{notSendMessagesQueue(_0x14c333[_0x25d683]);}}}};Preview[_0x4ee1('0xe')]['clearZombieChannel']=function(_0x3d6bf4){var _0x32cc34=this;this['sequence'][_0x4ee1('0x6f')](function(){if(!_[_0x4ee1('0x70')](_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4])){loggerAction[_0x4ee1('0x5b')](_0x4ee1('0x72'),_0x3d6bf4,_0x4ee1('0x73'),_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4][_0x4ee1('0x74')],_0x4ee1('0x75'),JSON['stringify'](_0x32cc34['campaignsPreview'][_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4][_0x4ee1('0x74')]][_0x4ee1('0x4e')]),_0x4ee1('0x76'),JSON['stringify'](_0x32cc34[_0x4ee1('0x11')][_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4][_0x4ee1('0x74')]][_0x4ee1('0x2c')]),JSON[_0x4ee1('0x58')](_0x32cc34['actions'][_0x3d6bf4][_0x4ee1('0x77')]),JSON[_0x4ee1('0x58')](_[_0x4ee1('0x78')](_0x32cc34['actions'][_0x3d6bf4],[_0x4ee1('0x79'),'UserId',_0x4ee1('0x7a'),'ListId'])));return ami[_0x4ee1('0x7b')]({'action':'status','channel':_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4]['channel']})[_0x4ee1('0x7c')](function(_0x12e0f1){if(_0x12e0f1[_0x4ee1('0x4d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4]){ut[_0x4ee1('0x7d')](_0x32cc34[_0x4ee1('0x11')][_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4][_0x4ee1('0x74')]],_0x4ee1('0x7e'));if(_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4]['dialAnswer']===!![]){ut['decrementTalkink'](_0x32cc34[_0x4ee1('0x11')][_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4][_0x4ee1('0x74')]],_0x4ee1('0x7e'));ut[_0x4ee1('0x7f')](_0x4ee1('0x80')+_0x3d6bf4,_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4][_0x4ee1('0x74')]);}ut[_0x4ee1('0x7f')](_0x4ee1('0x81')+_0x3d6bf4,_0x32cc34[_0x4ee1('0x71')][_0x3d6bf4][_0x4ee1('0x74')]);delete _0x32cc34[_0x4ee1('0x71')][_0x3d6bf4];}},0x2328);}});}});};Preview['prototype'][_0x4ee1('0x6b')]=function(){var _0x547c6c=this;loggerAction[_0x4ee1('0x5b')](_0x4ee1('0x82'),_['size'](this[_0x4ee1('0x71')]));for(var _0x184e36 in this['actions']){if(_0x547c6c['actions'][_0x4ee1('0x69')](_0x184e36)){_0x547c6c['clearZombieChannel'](_0x184e36);}}};Preview[_0x4ee1('0xe')][_0x4ee1('0x6e')]=function(_0x59ba70){var _0x43489c=this;rpcDb[_0x4ee1('0x83')](_0x59ba70['id'],ut[_0x4ee1('0x84')](this[_0x4ee1('0x14')]))[_0x4ee1('0x85')](function(_0x433b9c){if(!_[_0x4ee1('0x70')](_0x433b9c)){for(var _0x5f5694=0x0;_0x5f5694<_0x433b9c['length'];_0x5f5694+=0x1){if(ut[_0x4ee1('0x86')](_0x433b9c[_0x5f5694][_0x4ee1('0x87')])<_0x59ba70['dialRecallMeTimeout']*0x3c){if(_0x433b9c[_0x5f5694][_0x4ee1('0x88')]&&!_0x433b9c[_0x5f5694][_0x4ee1('0x88')][_0x4ee1('0x89')]){_0x43489c['run'](_0x433b9c[_0x5f5694]['id'])[_0x4ee1('0x85')](ut['logger2'](_0x4ee1('0x8a')))['catch'](ut['logger2'](_0x4ee1('0x8a')));}else{rpcDb[_0x4ee1('0x8b')](_0x433b9c[_0x5f5694]['id']);}}else{var _0x290451=new Action(_0x433b9c[_0x5f5694],_0x59ba70);_0x290451[_0x4ee1('0x8c')]=moment()[_0x4ee1('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x59ba70[_0x4ee1('0x41')]+=0x1;ut[_0x4ee1('0x8d')](_0x290451,0x17,_0x4ee1('0x8e'));if(_0x59ba70['dialRecallInQueue']){rpcDb[_0x4ee1('0x8f')](ut[_0x4ee1('0x90')](_0x433b9c[_0x5f5694]));rpcDb[_0x4ee1('0x91')](_0x290451,_0x4ee1('0x92'));}else{ut[_0x4ee1('0x8d')](_0x290451,0x16,_0x4ee1('0x93'));rpcDb[_0x4ee1('0x91')](_0x290451,_0x4ee1('0x94'));rpcDb[_0x4ee1('0x95')](_0x290451,_0x4ee1('0x94'));}}}}})[_0x4ee1('0x7c')](ut[_0x4ee1('0x96')]('[getContactRecallMe]'));};Preview[_0x4ee1('0xe')]['setMessage']=function(_0x25cfc3){_0x25cfc3['sendMessageOneNotActive']=!![];if(ut[_0x4ee1('0x97')](_0x25cfc3[_0x4ee1('0x2b')])){_0x25cfc3[_0x4ee1('0x4d')]=_0x4ee1('0x98');}else if(!ut[_0x4ee1('0x99')](_0x25cfc3[_0x4ee1('0x34')])){_0x25cfc3[_0x4ee1('0x4d')]=_0x4ee1('0x63');}else if(!this[_0x4ee1('0x9a')](_0x25cfc3[_0x4ee1('0x54')])){if(!this[_0x4ee1('0x9a')](_0x25cfc3[_0x4ee1('0x9b')])){_0x25cfc3['message']=_0x4ee1('0x9c');}else{_0x25cfc3[_0x4ee1('0x4d')]=_0x4ee1('0x9d');}}else{_0x25cfc3['message']='ACTIVE';}emitCampaignPreview(_0x25cfc3);};Preview[_0x4ee1('0xe')][_0x4ee1('0x9e')]=function(_0x5ac164,_0x318e43,_0x431dfa){var _0x3f8f94=this;var _0x216925=this[_0x4ee1('0x71')][_0x318e43];var _0x1e6d5d=this[_0x4ee1('0x11')][_0x216925[_0x4ee1('0x74')]];var _0x28e11c;if(_0x1e6d5d){switch(_0x431dfa){case'1':_0x1e6d5d[_0x4ee1('0x40')]+=0x1;_0x216925['countnosuchnumberretry']+=0x1;_0x216925[_0x4ee1('0x9f')]=ut[_0x4ee1('0xa0')](_0x216925);ut['logCustomer'](_0x216925,0x0,'NoSuchNumber');ami[_0x4ee1('0x26')](_0x4ee1('0xa1'),ut[_0x4ee1('0xa2')](_0x216925,_0x4ee1('0xa3')));rpcDb[_0x4ee1('0x91')](_0x216925,_0x4ee1('0xa4'));if(ut[_0x4ee1('0xa0')](_0x216925)>=_0x1e6d5d['dialGlobalMaxRetry']){_0x28e11c=ut[_0x4ee1('0xa5')](_0x216925,0xf,_0x4ee1('0xa6'));rpcDb[_0x4ee1('0x95')](_0x28e11c,_0x4ee1('0xa7'));}else{if(_0x216925[_0x4ee1('0xa8')]>=_0x1e6d5d['dialNoSuchNumberMaxRetry']){rpcDb[_0x4ee1('0x95')](_0x216925,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x4ee1('0xa9')](ut[_0x4ee1('0xaa')](_0x216925,'countnosuchnumberretry',_0x1e6d5d['dialNoSuchNumberRetryFrequency']),_0x216925[_0x4ee1('0xab')],_0x216925[_0x4ee1('0xac')]);}}delete this['actions'][_0x5ac164[_0x4ee1('0xad')]];break;case'ANSWER':var _0x58dd6c=moment()[_0x4ee1('0x59')](_0x4ee1('0xae'));_0x216925[_0x4ee1('0xaf')]=_0x58dd6c;_0x216925[_0x4ee1('0xb0')]=_0x58dd6c;_0x216925[_0x4ee1('0x77')]=!![];_0x1e6d5d[_0x4ee1('0x2c')]+=0x1;logger['info'](_0x4ee1('0xb1'),_0x216925['uniqueid'],'\x20Queue',_0x1e6d5d[_0x4ee1('0x29')],_0x4ee1('0x76'),_0x1e6d5d[_0x4ee1('0x2c')]);ami[_0x4ee1('0x26')](_0x4ee1('0xb2'),ut[_0x4ee1('0xa2')](_0x216925,_0x4ee1('0xb3'),this[_0x4ee1('0x11')][_0x216925['queue']]));if(_0x1e6d5d[_0x4ee1('0xb4')]){ami[_0x4ee1('0x26')]('custom:agentConnectPreview',ut[_0x4ee1('0xb5')](_0x216925));}break;case'16':ami[_0x4ee1('0x26')](_0x4ee1('0xb6'),ut[_0x4ee1('0xa2')](_0x216925,_0x4ee1('0xb7'),this[_0x4ee1('0x11')][_0x216925[_0x4ee1('0x74')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x216925,_0x4ee1('0xb7')));_0x1e6d5d['outboundAnswerCallsDay']+=0x1;_0x1e6d5d[_0x4ee1('0xb8')]+=0x1;_0x1e6d5d[_0x4ee1('0xb9')]+=0x1;ut[_0x4ee1('0xba')](_0x1e6d5d,_0x4ee1('0xbb'));_0x216925['countglobal']=ut[_0x4ee1('0xa0')](_0x216925);ut[_0x4ee1('0x8d')](_0x216925,0x4,_0x4ee1('0xbc'));rpcDb['createCustomerHistory'](_0x216925,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x4ee1('0x95')](_0x216925,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x4ee1('0xbd')](_0x216925);_0x1e6d5d[_0x4ee1('0x2e')]+=_0x216925[_0x4ee1('0xbe')];_0x1e6d5d['sumBillable']+=_0x216925['talktime'];logger[_0x4ee1('0x5b')](_0x4ee1('0xbf'),_0x216925[_0x4ee1('0xc0')],_0x4ee1('0xc1'),_0x1e6d5d[_0x4ee1('0x29')],_0x4ee1('0x76'),_0x1e6d5d[_0x4ee1('0x2c')]);delete this['actions'][_0x5ac164['linkedid']];break;case'BUSY':_0x1e6d5d[_0x4ee1('0x3b')]+=0x1;_0x216925[_0x4ee1('0xc2')]+=0x1;_0x216925[_0x4ee1('0x9f')]=ut[_0x4ee1('0xa0')](_0x216925);ut['logCustomer'](_0x216925,0x5,_0x4ee1('0xc3'));ami['emit'](_0x4ee1('0xc4'),ut[_0x4ee1('0xa2')](_0x216925,_0x4ee1('0xc5')));rpcDb[_0x4ee1('0x91')](_0x216925,_0x4ee1('0xc6'));if(ut[_0x4ee1('0xa0')](_0x216925)>=_0x1e6d5d['dialGlobalMaxRetry']){_0x28e11c=ut[_0x4ee1('0xa5')](_0x216925,0xf,_0x4ee1('0xa6'));rpcDb[_0x4ee1('0x95')](_0x28e11c,_0x4ee1('0xc7'));}else{if(_0x216925[_0x4ee1('0xc2')]>=_0x1e6d5d[_0x4ee1('0xc8')]){rpcDb[_0x4ee1('0x95')](_0x216925,_0x4ee1('0xc6'));}else{rpcDb[_0x4ee1('0xa9')](ut[_0x4ee1('0xaa')](_0x216925,_0x4ee1('0xc2'),_0x1e6d5d['dialBusyRetryFrequency']),_0x216925[_0x4ee1('0xab')],_0x216925[_0x4ee1('0xac')]);}}break;case _0x4ee1('0xc9'):_0x1e6d5d[_0x4ee1('0x3f')]+=0x1;_0x216925[_0x4ee1('0xca')]+=0x1;_0x216925[_0x4ee1('0x9f')]=ut[_0x4ee1('0xa0')](_0x216925);ut[_0x4ee1('0x8d')](_0x216925,0x3,_0x4ee1('0xcb'));ami[_0x4ee1('0x26')](_0x4ee1('0xcc'),ut[_0x4ee1('0xa2')](_0x216925,_0x4ee1('0xcd')));rpcDb[_0x4ee1('0x91')](_0x216925,_0x4ee1('0xce'));if(ut[_0x4ee1('0xa0')](_0x216925)>=_0x1e6d5d['dialGlobalMaxRetry']){_0x28e11c=ut[_0x4ee1('0xa5')](_0x216925,0xf,_0x4ee1('0xa6'));rpcDb['createCustomerFinal'](_0x28e11c,_0x4ee1('0xcf'));}else{if(_0x216925[_0x4ee1('0xca')]>=_0x1e6d5d['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x216925,_0x4ee1('0xce'));}else{rpcDb['rescheduleContact'](ut[_0x4ee1('0xaa')](_0x216925,_0x4ee1('0xca'),_0x1e6d5d['dialNoAnswerRetryFrequency']),_0x216925[_0x4ee1('0xab')],_0x216925[_0x4ee1('0xac')]);}}break;case _0x4ee1('0xd0'):_0x1e6d5d[_0x4ee1('0xd1')]+=0x1;_0x216925['countcongestionretry']+=0x1;_0x216925[_0x4ee1('0x9f')]=ut[_0x4ee1('0xa0')](_0x216925);ut[_0x4ee1('0x8d')](_0x216925,0x8,_0x4ee1('0xd2'));ami[_0x4ee1('0x26')](_0x4ee1('0xd3'),ut[_0x4ee1('0xa2')](_0x216925,_0x4ee1('0xd4')));rpcDb['createCustomerHistory'](_0x216925,_0x4ee1('0xd5'));if(ut[_0x4ee1('0xa0')](_0x216925)>=_0x1e6d5d['dialGlobalMaxRetry']){_0x28e11c=ut[_0x4ee1('0xa5')](_0x216925,0xf,'Global');rpcDb['createCustomerFinal'](_0x28e11c,_0x4ee1('0xd6'));}else{if(_0x216925[_0x4ee1('0xd7')]>=_0x1e6d5d[_0x4ee1('0xd8')]){rpcDb[_0x4ee1('0x95')](_0x216925,_0x4ee1('0xd5'));}else{rpcDb[_0x4ee1('0xa9')](ut['scheduledAt'](_0x216925,_0x4ee1('0xd7'),_0x1e6d5d[_0x4ee1('0xd9')]),_0x216925[_0x4ee1('0xab')],_0x216925[_0x4ee1('0xac')]);}}break;case _0x4ee1('0xda'):_0x1e6d5d[_0x4ee1('0xdb')]+=0x1;_0x216925[_0x4ee1('0xdc')]+=0x1;_0x216925[_0x4ee1('0x9f')]=ut['totalGlobal'](_0x216925);ut[_0x4ee1('0x8d')](_0x216925,0x14,_0x4ee1('0xdd'));ami[_0x4ee1('0x26')](_0x4ee1('0xde'),ut[_0x4ee1('0xa2')](_0x216925,'agentreject'));rpcDb[_0x4ee1('0x91')](_0x216925,'[syncHangupRequest][logAgentReject]');if(ut[_0x4ee1('0xa0')](_0x216925)>=_0x1e6d5d[_0x4ee1('0xdf')]){_0x28e11c=ut[_0x4ee1('0xa5')](_0x216925,0x14,_0x4ee1('0xdd'));rpcDb['createCustomerFinal'](_0x28e11c,_0x4ee1('0xe0'));}else{if(_0x216925[_0x4ee1('0xdc')]>=_0x1e6d5d['dialAgentRejectMaxRetry']){rpcDb[_0x4ee1('0x95')](_0x216925,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x4ee1('0xa9')](ut[_0x4ee1('0xaa')](_0x216925,'countagentrejectretry',_0x1e6d5d['dialAgentRejectRetryFrequency']),_0x216925[_0x4ee1('0xab')],_0x216925[_0x4ee1('0xac')]);}}break;case'ABANDONED':_0x1e6d5d['outboundAbandonedCallsDay']+=0x1;_0x216925['countabandonedretry']+=0x1;_0x216925[_0x4ee1('0x9f')]=ut['totalGlobal'](_0x216925);ut[_0x4ee1('0x8d')](_0x216925,0xb,_0x4ee1('0xe1'));rpcDb[_0x4ee1('0x91')](_0x216925,_0x4ee1('0xe2'));if(ut['totalGlobal'](_0x216925)>=_0x1e6d5d[_0x4ee1('0xdf')]){_0x28e11c=ut[_0x4ee1('0xa5')](_0x216925,0xf,'Global');rpcDb[_0x4ee1('0x95')](_0x28e11c,_0x4ee1('0xe2'));}else{if(_0x216925[_0x4ee1('0xe3')]>=_0x1e6d5d['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x216925,_0x4ee1('0xe2'));}else{rpcDb[_0x4ee1('0xa9')](ut[_0x4ee1('0xaa')](_0x216925,_0x4ee1('0xe4'),_0x1e6d5d[_0x4ee1('0xe5')]),_0x216925[_0x4ee1('0xab')],_0x216925[_0x4ee1('0xac')]);}}break;case'18':_0x1e6d5d[_0x4ee1('0x42')]+=0x1;_0x216925[_0x4ee1('0xe6')]+=0x1;_0x216925[_0x4ee1('0x9f')]=ut[_0x4ee1('0xa0')](_0x216925);ut[_0x4ee1('0x8d')](_0x216925,0x12,_0x5ac164['cause-txt']||_0x5ac164[_0x4ee1('0xe7')]);ami[_0x4ee1('0x26')](_0x4ee1('0xe8'),ut[_0x4ee1('0xa2')](_0x216925,_0x4ee1('0xe9')));rpcDb[_0x4ee1('0x91')](_0x216925,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x4ee1('0xa0')](_0x216925)>=_0x1e6d5d['dialGlobalMaxRetry']){_0x28e11c=ut[_0x4ee1('0xa5')](_0x216925,0xf,'Global');rpcDb[_0x4ee1('0x95')](_0x28e11c,_0x4ee1('0xea'));}else{rpcDb[_0x4ee1('0x95')](_0x216925,_0x4ee1('0xea'));}delete this[_0x4ee1('0x71')][_0x5ac164[_0x4ee1('0xad')]];break;case'19':_0x1e6d5d[_0x4ee1('0x42')]+=0x1;_0x216925[_0x4ee1('0x9f')]=ut[_0x4ee1('0xa0')](_0x216925);ut['logCustomer'](_0x216925,0x13,_0x5ac164[_0x4ee1('0xeb')]||_0x5ac164[_0x4ee1('0xe7')]);ami['emit'](_0x4ee1('0xe8'),ut[_0x4ee1('0xa2')](_0x216925,_0x4ee1('0xe9')));rpcDb[_0x4ee1('0x91')](_0x216925,_0x4ee1('0xec'));if(ut[_0x4ee1('0xa0')](_0x216925)>=_0x1e6d5d[_0x4ee1('0xdf')]){_0x28e11c=ut['cloneAction'](_0x216925,0xf,_0x4ee1('0xa6'));rpcDb[_0x4ee1('0x95')](_0x28e11c,_0x4ee1('0xec'));}else{rpcDb['createCustomerFinal'](_0x216925,_0x4ee1('0xec'));}delete this[_0x4ee1('0x71')][_0x5ac164[_0x4ee1('0xad')]];break;default:if(_0x216925['dialAnswer']){ut['decrementTalkink'](_0x1e6d5d,_0x4ee1('0xed'));ut['loggerError'](_0x4ee1('0xee')+_0x1e6d5d[_0x4ee1('0x29')],_0x5ac164);}_0x1e6d5d[_0x4ee1('0x42')]+=0x1;_0x216925['countglobal']=ut[_0x4ee1('0xa0')](_0x216925);ut[_0x4ee1('0x8d')](_0x216925,0xc,_0x5ac164[_0x4ee1('0xeb')]||_0x5ac164[_0x4ee1('0xe7')]);rpcDb[_0x4ee1('0x91')](_0x216925,_0x4ee1('0xef'));if(ut[_0x4ee1('0xa0')](_0x216925)>=_0x1e6d5d[_0x4ee1('0xdf')]){_0x28e11c=ut['cloneAction'](_0x216925,0xf,_0x4ee1('0xa6'));rpcDb[_0x4ee1('0x95')](_0x28e11c,_0x4ee1('0xf0'));}else{rpcDb[_0x4ee1('0x95')](_0x216925,_0x4ee1('0xf0'));}delete this[_0x4ee1('0x71')][_0x5ac164[_0x4ee1('0xad')]];}if(!(_0x216925['dialAnswer']&&_0x431dfa==='16')){ut[_0x4ee1('0x7d')](_0x1e6d5d,'[callProgressDetectingCustomer]');logger[_0x4ee1('0x5b')]('[originated][decrement][callProgressDetectingCustomer]',_0x216925[_0x4ee1('0xc0')],_0x4ee1('0xc1'),_0x1e6d5d[_0x4ee1('0x29')],_0x4ee1('0x75'),_0x1e6d5d['originated']);}if(_0x431dfa!=='ANSWER'){delete this[_0x4ee1('0x71')][_0x5ac164[_0x4ee1('0xad')]];delete this['actions'][_0x5ac164[_0x4ee1('0xf1')]];}}};Preview[_0x4ee1('0xe')][_0x4ee1('0xf2')]=function(_0x51f937,_0x9ea41c,_0x2e2dad){if(_[_0x4ee1('0xf3')](_0x9ea41c)&&'object'!==typeof _0x9ea41c){return;}if(_[_0x4ee1('0xf3')](_0x2e2dad)&&'object'!==typeof _0x2e2dad){return;}switch(_0x2e2dad[_0x4ee1('0xf4')]){case'0':ut['logAgent'](_0x51f937,0x0,_0x4ee1('0xf5'));rpcDb[_0x4ee1('0xf6')](_0x51f937,_0x4ee1('0xf7'));break;case'3':ut[_0x4ee1('0xf8')](_0x51f937,0x3,_0x4ee1('0xcb'));rpcDb[_0x4ee1('0xf6')](_0x51f937,_0x4ee1('0xf9'));break;case'5':ut['logAgent'](_0x51f937,0x5,_0x4ee1('0xc3'));rpcDb[_0x4ee1('0xf6')](_0x51f937,_0x4ee1('0xfa'));break;case'8':ut[_0x4ee1('0xf8')](_0x51f937,0x8,_0x4ee1('0xd2'));rpcDb[_0x4ee1('0xf6')](_0x51f937,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x4ee1('0xf8')](_0x51f937,0x16,_0x4ee1('0xfb'));rpcDb['createAgentHistory'](_0x51f937,_0x4ee1('0xfc'));break;default:ut[_0x4ee1('0xf8')](_0x51f937,0xc,_0x2e2dad['reason']);rpcDb[_0x4ee1('0xf6')](_0x51f937,_0x4ee1('0xfd'));}ut[_0x4ee1('0x7d')](_0x9ea41c,_0x4ee1('0xfe'));logger[_0x4ee1('0x5b')](_0x4ee1('0xff'),_0x51f937[_0x4ee1('0xc0')],_0x4ee1('0xc1'),_0x9ea41c[_0x4ee1('0x29')],_0x4ee1('0x75'),_0x9ea41c[_0x4ee1('0x4e')]);delete this['actions'][_0x51f937[_0x4ee1('0xc0')]];};Preview[_0x4ee1('0xe')][_0x4ee1('0x100')]=function(_0x1fdf4c,_0x58da3b,_0x383e36,_0x38595b,_0x15374f){var _0x733d26=this;return new BPromise(function(_0x29d7e0,_0x205189){if(_[_0x4ee1('0x70')](_0x58da3b)||_[_0x4ee1('0x70')](_0x58da3b[_0x4ee1('0x101')])||_[_0x4ee1('0x70')](_0x58da3b['Contact'][_0x4ee1('0x102')])||_['isNil'](_0x58da3b[_0x4ee1('0x7a')])){_0x205189(ut[_0x4ee1('0x4d')](_0x4ee1('0x103'),_0x38595b,_0x15374f));return;}var _0x4acf94=uuid['v4']();var _0x2c97a0=_0x733d26[_0x4ee1('0x11')][_0x58da3b[_0x4ee1('0x73')][_0x4ee1('0x29')]];var _0x172b4e=_0x383e36?_0x733d26[_0x4ee1('0x14')][_0x383e36]['id']:undefined;_0x733d26[_0x4ee1('0x71')][_0x4acf94]=new Action(_0x58da3b,_0x2c97a0,_0x4acf94,_0x383e36,_0x172b4e);var _0x5d0972=_0x733d26['actions'][_0x4acf94];_0x5d0972[_0x4ee1('0xab')]=_0x38595b;_0x5d0972['activeContact']=_0x15374f;_0x5d0972[_0x4ee1('0x104')]=_0x383e36;if(_[_0x4ee1('0x105')](_0x1fdf4c)){_0x733d26[_0x4ee1('0x106')](_0x5d0972,_0x2c97a0,_0x58da3b,_0x383e36)[_0x4ee1('0x85')](function(_0x419be9){logger[_0x4ee1('0x5b')](_0x4ee1('0x107'),'Queue:\x20'+_0x5d0972[_0x4ee1('0x74')]+_0x4ee1('0x108')+_0x5d0972['idContact'],JSON['stringify'](_0x419be9));ami[_0x4ee1('0x26')](_0x4ee1('0x109'),ut[_0x4ee1('0xa2')](_0x5d0972,_0x4ee1('0x10a'),_0x733d26['campaignsPreview'][_0x5d0972[_0x4ee1('0x74')]]));_0x29d7e0(ut[_0x4ee1('0x4d')](_0x4ee1('0x10b')));})['catch'](function(_0x18d85d){ut[_0x4ee1('0x64')](_0x4ee1('0x10c'),_0x18d85d);_0x205189(ut[_0x4ee1('0x4d')](_0x4ee1('0x10d'),_0x38595b,_0x15374f));});}else{_0x2c97a0[_0x4ee1('0x10e')]+=0x1;ut[_0x4ee1('0x10f')](_0x5d0972);rpcDb[_0x4ee1('0x110')](_0x5d0972,_0x4ee1('0x111'));delete _0x733d26[_0x4ee1('0x71')][_0x4acf94];_0x205189(ut[_0x4ee1('0x4d')](_0x4ee1('0x112'),_0x38595b,_0x15374f));}});};Preview['prototype'][_0x4ee1('0x9a')]=function(_0x260fad){return!_[_0x4ee1('0x70')](_0x260fad)&&!_[_0x4ee1('0x70')](_0x260fad[_0x4ee1('0x29')])&&!_[_0x4ee1('0x70')](_0x260fad[_0x4ee1('0x55')])&&_0x260fad[_0x4ee1('0x55')]&&!_[_0x4ee1('0x70')](this[_0x4ee1('0x13')][util['format'](_0x4ee1('0x113'),_0x260fad[_0x4ee1('0x29')])])&&!_[_0x4ee1('0x70')](this['trunks'][util[_0x4ee1('0x59')]('SIP/%s',_0x260fad[_0x4ee1('0x29')])][_0x4ee1('0x114')])&&(this[_0x4ee1('0x13')][util[_0x4ee1('0x59')](_0x4ee1('0x113'),_0x260fad[_0x4ee1('0x29')])]['status']===_0x4ee1('0x115')||this[_0x4ee1('0x13')][util['format'](_0x4ee1('0x113'),_0x260fad[_0x4ee1('0x29')])][_0x4ee1('0x114')]===_0x4ee1('0x116'));};Preview[_0x4ee1('0xe')][_0x4ee1('0x117')]=function(_0x20e130,_0xe1f4bf){var _0x39c46e=this;return new BPromise(function(_0x428bf4,_0x4b3cbc){_0x39c46e[_0x4ee1('0x118')](_0x20e130,_0xe1f4bf)[_0x4ee1('0x85')](function(_0xb1ff45){_0x428bf4(_[_0x4ee1('0x78')](_0xb1ff45,[_0x4ee1('0x4d')]));})[_0x4ee1('0x7c')](function(_0x57154d){if(_0x57154d['unlock']){rpcDb[_0x4ee1('0x119')](_0x20e130);}if(_0x57154d[_0x4ee1('0x55')]){rpcDb['disableContact'](_0x20e130);}_0x4b3cbc(_[_0x4ee1('0x78')](_0x57154d,[_0x4ee1('0x4d')]));});});};Preview[_0x4ee1('0xe')][_0x4ee1('0x118')]=function(_0x59f710,_0x381b0b){var _0x350fa0=this;return new BPromise(function(_0x1921db,_0x35db5f){var _0x5c555d,_0x33d924;rpcDb[_0x4ee1('0x11a')](_0x59f710)[_0x4ee1('0x85')](function(_0x1e0872){if(!_[_0x4ee1('0x70')](_0x1e0872[0x0])){_0x33d924=_0x1e0872[0x0][_0x4ee1('0x11b')]?![]:!![];_0x5c555d=_0x1e0872[0x0][_0x4ee1('0x11b')]?!![]:![];_0x5c555d=_0x381b0b?!![]:_0x5c555d;}var _0x5805a3=_0x350fa0['validateContact'](_0x1e0872);if(_0x5805a3[_0x4ee1('0x11c')]){rpcDb[_0x4ee1('0x11d')](_['pick'](_0x1e0872[0x0],[_0x4ee1('0x7a'),_0x4ee1('0x11e')]))[_0x4ee1('0x85')](function(_0x2c1016){_0x350fa0['checkInBlack'](_0x2c1016,_0x1e0872[0x0],_0x381b0b,_0x33d924,_0x5c555d)[_0x4ee1('0x85')](function(_0x47c159){_0x1921db(_0x47c159);})[_0x4ee1('0x7c')](function(_0x5e74b2){_0x35db5f(_0x5e74b2);});})[_0x4ee1('0x7c')](function(_0x248c58){ut[_0x4ee1('0x64')](_0x4ee1('0x11f'),_0x248c58);_0x35db5f(ut[_0x4ee1('0x4d')](_0x4ee1('0x120'),_0x33d924,_0x5c555d));});}else{_0x35db5f(ut[_0x4ee1('0x4d')](_0x5805a3[_0x4ee1('0x4d')],_0x33d924,_0x5c555d));}})[_0x4ee1('0x7c')](function(_0x12f795){ut['logger'](_0x4ee1('0x121'),_0x12f795);_0x35db5f(ut['message'](_0x4ee1('0x120'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x3baee2){if(_[_0x4ee1('0x70')](_0x3baee2)||_[_0x4ee1('0x105')](_0x3baee2)||!_[_0x4ee1('0x70')](_0x3baee2[0x0][_0x4ee1('0x88')])&&_[_0x4ee1('0x70')](_0x3baee2[0x0][_0x4ee1('0x88')][_0x4ee1('0x29')])){ut[_0x4ee1('0x64')]('[Preview][validateContact][Empty\x20Contact]',_0x3baee2);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x31ce12=this['campaignsPreview'][_0x3baee2[0x0][_0x4ee1('0x73')][_0x4ee1('0x29')]];_0x31ce12[_0x4ee1('0x4d')]=_0x4ee1('0x9d');if(_[_0x4ee1('0x70')](_0x31ce12)){ut[_0x4ee1('0x64')](_0x4ee1('0x122'),_0x31ce12);return{'isValid':![],'message':_0x4ee1('0x123')};}if(!this[_0x4ee1('0x9a')](_0x31ce12[_0x4ee1('0x54')])){ut[_0x4ee1('0x64')](_0x4ee1('0x124'),_0x4ee1('0x125')+_0x31ce12[_0x4ee1('0x29')]+_0x4ee1('0x126'));if(!this['isTrunkReachable'](_0x31ce12[_0x4ee1('0x9b')])){ut[_0x4ee1('0x64')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x31ce12[_0x4ee1('0x29')]+_0x4ee1('0x127'));return{'isValid':![],'message':_0x4ee1('0x128')};}}if(!ut[_0x4ee1('0x99')](_0x31ce12['dialActive'])){ut[_0x4ee1('0x64')](_0x4ee1('0x129'),_0x31ce12['name']+_0x4ee1('0x12a'));return{'isValid':![],'message':_0x4ee1('0x125')+_0x31ce12['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x4ee1('0x12b')};};Preview['prototype'][_0x4ee1('0x106')]=function(_0x10c29f,_0x2b19d4,_0x13978a,_0x56b7cd){var _0xcb32a2=this;return new BPromise(function(_0x5d15ed,_0x27acc8){var _0x3047b9=_0x10c29f[_0x4ee1('0xc0')];var _0x512da2=_0xcb32a2[_0x4ee1('0x9a')](_0x2b19d4[_0x4ee1('0x54')])?util[_0x4ee1('0x59')](_0x4ee1('0x12c'),_0x2b19d4[_0x4ee1('0x54')][_0x4ee1('0x29')],_['isNil'](_0x2b19d4[_0x4ee1('0x39')])?'':_0x2b19d4[_0x4ee1('0x39')]['trim']()||'',_0x2b19d4[_0x4ee1('0x12d')]>0x0?_0x13978a[_0x4ee1('0x101')]['phone'][_0x4ee1('0x12e')](_0x2b19d4[_0x4ee1('0x12d')]):_0x13978a['Contact'][_0x4ee1('0x102')]):util['format'](_0x4ee1('0x12c'),_['isNil'](_0x2b19d4[_0x4ee1('0x9b')])?_0x2b19d4['Trunk']['name']:_0x2b19d4['TrunkBackup']['name'],_[_0x4ee1('0x70')](_0x2b19d4['dialPrefix'])?'':_0x2b19d4[_0x4ee1('0x39')][_0x4ee1('0x12f')]()||'',_0x2b19d4[_0x4ee1('0x12d')]>0x0?_0x13978a[_0x4ee1('0x101')][_0x4ee1('0x102')][_0x4ee1('0x12e')](_0x2b19d4[_0x4ee1('0x12d')]):_0x13978a[_0x4ee1('0x101')][_0x4ee1('0x102')]);var _0x43507a=_0xcb32a2[_0x4ee1('0x9a')](_0x2b19d4[_0x4ee1('0x54')])?ut[_0x4ee1('0x130')](_0x2b19d4[_0x4ee1('0x54')][_0x4ee1('0x56')],_0x2b19d4[_0x4ee1('0x36')],_0x2b19d4[_0x4ee1('0x131')]>0x0?ut[_0x4ee1('0x132')](_0x2b19d4[_0x4ee1('0x37')],_0x2b19d4[_0x4ee1('0x131')]):_0x2b19d4[_0x4ee1('0x37')]):ut[_0x4ee1('0x130')](_[_0x4ee1('0x70')](_0x2b19d4[_0x4ee1('0x9b')])?_0x2b19d4[_0x4ee1('0x54')][_0x4ee1('0x56')]:_0x2b19d4[_0x4ee1('0x9b')][_0x4ee1('0x56')],_0x2b19d4[_0x4ee1('0x36')],_0x2b19d4[_0x4ee1('0x131')]>0x0?ut['getCallerIdRandom'](_0x2b19d4['dialOriginateCallerIdNumber'],_0x2b19d4['dialRandomLastDigitCallerIdNumber']):_0x2b19d4[_0x4ee1('0x37')]);if(_0x43507a){_0x10c29f[_0x4ee1('0x133')]=ut[_0x4ee1('0x134')](_0x43507a);_0x10c29f['originatecalleridnum']=ut[_0x4ee1('0x135')](_0x43507a);}var _0x14139e=ut[_0x4ee1('0x136')](_0x2b19d4,_0x13978a,_0x512da2,_0x43507a,_0x3047b9,_0x10c29f);_[_0x4ee1('0x137')](_0x10c29f,ut[_0x4ee1('0x138')](_0x14139e));_0x10c29f[_0x4ee1('0x8c')]=moment()[_0x4ee1('0x59')](_0x4ee1('0xae'));ami[_0x4ee1('0x7b')](ut[_0x4ee1('0x139')](_0x10c29f,_0x2b19d4,_0x14139e,_0x10c29f['activeContact'],_0x56b7cd))[_0x4ee1('0x85')](function(_0x4d5868){_0x2b19d4[_0x4ee1('0x4e')]+=0x1;logger[_0x4ee1('0x5b')](_0x4ee1('0x13a'),_0x3047b9,_0x4ee1('0xc1'),_0x2b19d4['name'],_0x4ee1('0x75'),_0x2b19d4['originated']);_0x5d15ed(_0x4d5868);})[_0x4ee1('0x7c')](function(_0x1df16e){ut[_0x4ee1('0xf8')](_0x10c29f,0xe,_0x4ee1('0x13b'));rpcDb[_0x4ee1('0xf6')](_0x10c29f,'[originateFailure][logOriginateFailure]');_0x27acc8(_0x1df16e);});});};Preview[_0x4ee1('0xe')][_0x4ee1('0x1f')]=function(_0x6557c2){if(this[_0x4ee1('0x71')][_0x6557c2[_0x4ee1('0xad')]]){this[_0x4ee1('0x71')][_0x6557c2['linkedid']][_0x4ee1('0x13c')]=_0x6557c2['channel'];}};Preview[_0x4ee1('0xe')][_0x4ee1('0x17')]=function(_0x53c584){var _0x5a4829=this;var _0x580b17=this[_0x4ee1('0x71')][_0x53c584['actionid']];if(_0x580b17){if(_0x580b17['lookAgent']&&this[_0x4ee1('0x14')][_0x580b17[_0x4ee1('0x104')]]){ut['logLookAgent'](_0x580b17,this[_0x4ee1('0x14')][_0x580b17[_0x4ee1('0x104')]][_0x4ee1('0x29')],this['agents'][_0x580b17[_0x4ee1('0x104')]]['id']);}var _0x37b6c0=_[_0x4ee1('0x13d')](_0x580b17);_0x37b6c0[_0x4ee1('0xaf')]=moment()[_0x4ee1('0x59')](_0x4ee1('0xae'));var _0x10d099=_0x5a4829['campaignsPreview'][_0x580b17[_0x4ee1('0x74')]];if(ut[_0x4ee1('0x13e')](_0x53c584['response'])){if(_0x580b17['unlockAgent']){rpcDb['unlockContact'](_0x580b17[_0x4ee1('0x13f')]);}if(_0x580b17[_0x4ee1('0xac')]){rpcDb[_0x4ee1('0x8b')](_0x580b17['idContact']);}ami['emit'](_0x4ee1('0x140'),ut['buildObj'](_0x580b17,_0x4ee1('0x141'),this[_0x4ee1('0x11')][_0x580b17[_0x4ee1('0x74')]]));this['callProgressDetectingAgent'](_0x37b6c0,_0x10d099,_0x53c584);}else{_0x580b17[_0x4ee1('0x8c')]=moment()[_0x4ee1('0x59')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x4ee1('0xf8')](_0x37b6c0,0x4,_0x4ee1('0xbc'));rpcDb[_0x4ee1('0xf6')](_0x37b6c0,_0x4ee1('0x142'));}}};Preview[_0x4ee1('0xe')][_0x4ee1('0x1a')]=function(_0x2d4bcd){var _0x5e2e11=this;var _0x479ae9=this[_0x4ee1('0x71')][_0x2d4bcd['linkedid']];var _0x100e44;if(_0x479ae9){_0x100e44=this[_0x4ee1('0x11')][_0x479ae9[_0x4ee1('0x74')]];logger['info'](_0x4ee1('0x143'),_0x2d4bcd[_0x4ee1('0xad')],_0x4ee1('0xc1'),_0x100e44[_0x4ee1('0x29')],_0x4ee1('0x76'),_0x100e44['pTalking']);}if(this[_0x4ee1('0x71')][_0x2d4bcd['linkedid']]&&_0x2d4bcd[_0x4ee1('0xad')]!==_0x2d4bcd[_0x4ee1('0xc0')]){if(_0x2d4bcd['cause']==='16'&&this[_0x4ee1('0x71')][_0x2d4bcd[_0x4ee1('0xad')]][_0x4ee1('0x77')]){this[_0x4ee1('0x9e')](_0x2d4bcd,_0x2d4bcd['linkedid'],_0x2d4bcd[_0x4ee1('0x144')]);}else if(this[_0x4ee1('0x71')][_0x2d4bcd['linkedid']]['dialAnswer']){logger[_0x4ee1('0x5b')](_0x4ee1('0x145'),_0x2d4bcd[_0x4ee1('0xad')],_0x2d4bcd[_0x4ee1('0x144')],_0x4ee1('0xc1'),_0x100e44[_0x4ee1('0x29')],_0x4ee1('0x76'),_0x100e44[_0x4ee1('0x2c')]);this[_0x4ee1('0x9e')](_0x2d4bcd,_0x2d4bcd['linkedid'],_0x2d4bcd['cause']);}}else if(_0x479ae9&&_[_0x4ee1('0x70')](_0x479ae9[_0x4ee1('0x146')])&&_0x100e44[_0x4ee1('0x147')]&&_0x2d4bcd[_0x4ee1('0xad')]===_0x2d4bcd[_0x4ee1('0xc0')]&&_['isNil'](_0x2d4bcd['reason'])&&_0x2d4bcd[_0x4ee1('0x144')]==='16'&&_0x2d4bcd[_0x4ee1('0x148')]==='6'&&_[_0x4ee1('0xf3')](_0x479ae9[_0x4ee1('0x149')])){if(_0x479ae9[_0x4ee1('0xab')]){rpcDb[_0x4ee1('0x119')](_0x479ae9[_0x4ee1('0x13f')]);}if(_0x479ae9[_0x4ee1('0xac')]){rpcDb['disableContact'](_0x479ae9[_0x4ee1('0x13f')]);}_0x2d4bcd[_0x4ee1('0xf4')]='22';this[_0x4ee1('0xf2')](_0x479ae9,_0x100e44,_0x2d4bcd);}else if(_0x479ae9&&_0x479ae9[_0x4ee1('0x149')]){if(_0x2d4bcd['cause']==='16'&&this[_0x4ee1('0x71')][_0x2d4bcd[_0x4ee1('0xad')]][_0x4ee1('0x77')]){logger[_0x4ee1('0x5b')]('[syncHangup][talking][transfer]',_0x2d4bcd[_0x4ee1('0xad')],_0x2d4bcd[_0x4ee1('0x144')],'\x20Queue',_0x100e44[_0x4ee1('0x29')],'pTalking:\x20',_0x100e44['pTalking']);this[_0x4ee1('0x9e')](_0x2d4bcd,_0x2d4bcd['linkedid'],_0x2d4bcd[_0x4ee1('0x144')]);}else if(this[_0x4ee1('0x71')][_0x2d4bcd[_0x4ee1('0xad')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x2d4bcd[_0x4ee1('0xad')],_0x2d4bcd[_0x4ee1('0x144')],_0x4ee1('0xc1'),_0x100e44[_0x4ee1('0x29')],'pTalking:\x20',_0x100e44['pTalking']);this[_0x4ee1('0x9e')](_0x2d4bcd,_0x2d4bcd[_0x4ee1('0xad')],_0x2d4bcd[_0x4ee1('0x144')]);}}};Preview['prototype'][_0x4ee1('0x1d')]=function(_0x27afad){if(this[_0x4ee1('0x71')][_0x27afad[_0x4ee1('0xf1')]]&&_0x27afad[_0x4ee1('0xf1')]!==_0x27afad[_0x4ee1('0x14a')]){this[_0x4ee1('0x9e')](_0x27afad,_0x27afad[_0x4ee1('0xf1')],_0x27afad[_0x4ee1('0xe7')]);}};Preview['prototype'][_0x4ee1('0x1b')]=function(_0x50b3ac){if(this[_0x4ee1('0x71')][_0x50b3ac['linkedid']]&&_0x50b3ac[_0x4ee1('0xad')]!==_0x50b3ac[_0x4ee1('0xc0')]&&!this[_0x4ee1('0x71')][_0x50b3ac[_0x4ee1('0xad')]][_0x4ee1('0x77')]){if(_0x50b3ac[_0x4ee1('0x144')]==='1'){this[_0x4ee1('0x9e')](_0x50b3ac,_0x50b3ac[_0x4ee1('0xad')],_0x50b3ac[_0x4ee1('0x144')]);}}};Preview[_0x4ee1('0xe')][_0x4ee1('0x14b')]=function(_0x2a52d,_0x11afb1,_0x565e63){if(this['actions'][_0x2a52d]){if(_['isNil'](this[_0x4ee1('0x71')][_0x2a52d][_0x4ee1('0x14c')])){this[_0x4ee1('0x71')][_0x2a52d][_0x4ee1('0x14c')]={};}this[_0x4ee1('0x71')][_0x2a52d][_0x4ee1('0x14c')][_0x11afb1]=_0x565e63;}};Preview[_0x4ee1('0xe')]['syncVarSet']=function(_0x3cfa61){try{if(!_['isNil'](_0x3cfa61)){if(ut[_0x4ee1('0x14d')](_[_0x4ee1('0x14e')](_0x3cfa61[_0x4ee1('0x14f')])[0x0])){this[_0x4ee1('0x14b')](_0x3cfa61[_0x4ee1('0xc0')],_['keys'](_0x3cfa61[_0x4ee1('0x14f')])[0x0],_0x3cfa61['value']);}}}catch(_0x225ad4){logger[_0x4ee1('0x150')]('[syncVarSet][Preview]',util[_0x4ee1('0x151')](_0x225ad4,{'showHidden':![],'depth':null}));}};Preview[_0x4ee1('0xe')][_0x4ee1('0x22')]=function(_0x265391){if(_0x265391){if(this[_0x4ee1('0x71')][_0x265391[_0x4ee1('0x152')]]){this['actions'][_0x265391[_0x4ee1('0x152')]]['transfer']=!![];}}};Preview[_0x4ee1('0xe')]['syncBlindTransfer']=function(_0x5162dd){if(_0x5162dd){if(this[_0x4ee1('0x71')][_0x5162dd[_0x4ee1('0x153')]]){this['actions'][_0x5162dd[_0x4ee1('0x153')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 5f88ea5..b1be201 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 _0x2731=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','endtime','connectedlinename','context','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0xb77d35,_0x291854){var _0x5389a8=function(_0x52b4d2){while(--_0x52b4d2){_0xb77d35['push'](_0xb77d35['shift']());}};_0x5389a8(++_0x291854);}(_0x2731,0x1cf));var _0x1273=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2731[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x1273('0x0'));var BPromise=require(_0x1273('0x1'));var logger=require(_0x1273('0x2'))(_0x1273('0x3'));var _=require('lodash');var cmHopper=require(_0x1273('0x4'));var cmHopperFinal=require(_0x1273('0x5'));var cmHopperHistory=require(_0x1273('0x6'));var cmHopperBlack=require(_0x1273('0x7'));var voiceQueueRt=require(_0x1273('0x8'));var agentReportPreview=require(_0x1273('0x9'));var voiceQueueReport=require(_0x1273('0xa'));function loggerCatch(_0x5431de){return function(_0x73484b){logger[_0x1273('0xb')](_0x5431de,util['inspect'](_0x73484b,{'showHidden':![],'depth':null}));};}function create(_0x3910f1){return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopperHistory[_0x1273('0xe')](_0x3910f1))[_0x1273('0xf')](loggerCatch(_0x1273('0x10')));}function createAgent(_0x59b1e9){return BPromise['resolve']()[_0x1273('0xd')](agentReportPreview[_0x1273('0xe')](_0x59b1e9))[_0x1273('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4717ea){return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopper[_0x1273('0x11')](_0x4717ea,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x260e43){return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopperBlack[_0x1273('0x12')](_0x260e43))['catch'](loggerCatch(_0x1273('0x13')));};exports[_0x1273('0x14')]=function(_0x12a5ff){return BPromise[_0x1273('0xc')]()['then'](cmHopper[_0x1273('0x14')](_0x12a5ff))[_0x1273('0xf')](loggerCatch(_0x1273('0x15')));};exports['createHistory']=function(_0x10400c,_0x344b09){create(_0x10400c)[_0x1273('0xf')](loggerCatch(_0x344b09));moveContact(_0x10400c)[_0x1273('0xf')](loggerCatch(_0x344b09));};exports[_0x1273('0x16')]=function(_0x1a45a7,_0x3711df){createAgent(_0x1a45a7)[_0x1273('0xf')](loggerCatch(_0x3711df));};exports[_0x1273('0x17')]=function(_0x55687f,_0x586c1a){create(_0x55687f)[_0x1273('0xf')](loggerCatch(_0x586c1a));};exports[_0x1273('0x18')]=function(_0x525967,_0x465a86){moveContact(_0x525967)['catch'](loggerCatch(_0x465a86));};exports[_0x1273('0x19')]=function(_0x260778,_0x3a7ae7,_0x4597c0){if(_0x3a7ae7){_0x260778[_0x1273('0x1a')]=null;}if(_0x4597c0){_0x260778[_0x1273('0x1b')]=![];}return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopper[_0x1273('0x19')](_0x260778))[_0x1273('0xf')](loggerCatch(_0x1273('0x1c')));};exports[_0x1273('0x1d')]=function(_0xb8b809){return BPromise[_0x1273('0xc')]()['then'](cmHopper[_0x1273('0x1d')](_0xb8b809))[_0x1273('0xf')](loggerCatch(_0x1273('0x1e')));};exports[_0x1273('0x1f')]=function(_0x13df56){return BPromise[_0x1273('0xc')]()['then'](cmHopper[_0x1273('0x1f')]({'UserId':null},_0x13df56,0x1))[_0x1273('0xf')](loggerCatch(_0x1273('0x20')));};exports[_0x1273('0x21')]=function(_0x374611){return BPromise[_0x1273('0xc')]()['then'](cmHopper['unlockContact']({'active':![]},_0x374611,0x1))[_0x1273('0xf')](loggerCatch(_0x1273('0x22')));};exports[_0x1273('0x23')]=function(_0x924e84){var _0x5bc1f8={};_0x5bc1f8[_0x1273('0x24')]=_0x924e84['type'];_0x5bc1f8['uniqueid']=_0x924e84[_0x1273('0x25')];_0x5bc1f8['calleridnum']=_0x924e84[_0x1273('0x26')];_0x5bc1f8['calleridname']=_0x924e84[_0x1273('0x27')];_0x5bc1f8[_0x1273('0x28')]=_0x924e84[_0x1273('0x28')];_0x5bc1f8['queuecallerjoinAt']=_0x924e84[_0x1273('0x29')];_0x5bc1f8['queuecallerleaveAt']=_0x924e84[_0x1273('0x29')];_0x5bc1f8['queuecallercomplete']=0x1;_0x5bc1f8['queuecallercompleteAt']=_0x924e84[_0x1273('0x2a')];_0x5bc1f8[_0x1273('0x2b')]=_0x924e84['membername'];_0x5bc1f8[_0x1273('0x2c')]=_0x1273('0x2d');_0x5bc1f8[_0x1273('0x2e')]='xcally-motion-preview';_0x5bc1f8[_0x1273('0x2f')]=0x0;_0x5bc1f8[_0x1273('0x30')]=0x1;_0x5bc1f8['lastAssignedTo']=_0x924e84['membername'];_0x5bc1f8[_0x1273('0x31')]=_0x1273('0x32');return BPromise['resolve']()[_0x1273('0xd')](voiceQueueReport[_0x1273('0x33')](_0x5bc1f8))[_0x1273('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x23d63d,_0x10edcc){return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopper['getContactRecallMe'](_0x23d63d,_0x10edcc))['catch'](loggerCatch(_0x1273('0x34')));};exports[_0x1273('0x35')]=function(_0x42d269){return BPromise[_0x1273('0xc')]()['then'](cmHopper['rescheduleContact'](_0x42d269,!![],!![]))[_0x1273('0xf')](loggerCatch(_0x1273('0x36')));}; \ No newline at end of file +var _0x801f=['resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x801f,0x1ae));var _0xf801=function(_0x5c151d,_0x5c603b){_0x5c151d=_0x5c151d-0x0;var _0x53e0fc=_0x801f[_0x5c151d];return _0x53e0fc;};'use strict';var util=require(_0xf801('0x0'));var BPromise=require(_0xf801('0x1'));var logger=require(_0xf801('0x2'))(_0xf801('0x3'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xf801('0x4'));var cmHopperBlack=require(_0xf801('0x5'));var voiceQueueRt=require(_0xf801('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xf801('0x7'));function loggerCatch(_0x213143){return function(_0x568ad4){logger[_0xf801('0x8')](_0x213143,util[_0xf801('0x9')](_0x568ad4,{'showHidden':![],'depth':null}));};}function create(_0x28b102){return BPromise[_0xf801('0xa')]()[_0xf801('0xb')](cmHopperHistory[_0xf801('0xc')](_0x28b102))[_0xf801('0xd')](loggerCatch(_0xf801('0xe')));}function createAgent(_0x8cd460){return BPromise[_0xf801('0xa')]()[_0xf801('0xb')](agentReportPreview[_0xf801('0xc')](_0x8cd460))[_0xf801('0xd')](loggerCatch(_0xf801('0xe')));}function moveContact(_0x3c3506){return BPromise['resolve']()[_0xf801('0xb')](cmHopper[_0xf801('0xf')](_0x3c3506,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xf801('0x10')]=function(_0x1d8d77){return BPromise[_0xf801('0xa')]()[_0xf801('0xb')](cmHopperBlack[_0xf801('0x10')](_0x1d8d77))[_0xf801('0xd')](loggerCatch(_0xf801('0x11')));};exports[_0xf801('0x12')]=function(_0x43ad68){return BPromise['resolve']()[_0xf801('0xb')](cmHopper[_0xf801('0x12')](_0x43ad68))['catch'](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x384fc0,_0x55e657){create(_0x384fc0)[_0xf801('0xd')](loggerCatch(_0x55e657));moveContact(_0x384fc0)['catch'](loggerCatch(_0x55e657));};exports['createAgentHistory']=function(_0x48574a,_0x930021){createAgent(_0x48574a)[_0xf801('0xd')](loggerCatch(_0x930021));};exports[_0xf801('0x13')]=function(_0x15f43a,_0x444aab){create(_0x15f43a)[_0xf801('0xd')](loggerCatch(_0x444aab));};exports[_0xf801('0x14')]=function(_0x5a7711,_0x1ada5e){moveContact(_0x5a7711)[_0xf801('0xd')](loggerCatch(_0x1ada5e));};exports[_0xf801('0x15')]=function(_0x385c04,_0x32cce4,_0x3e4ead){if(_0x32cce4){_0x385c04[_0xf801('0x16')]=null;}if(_0x3e4ead){_0x385c04[_0xf801('0x17')]=![];}return BPromise[_0xf801('0xa')]()['then'](cmHopper[_0xf801('0x15')](_0x385c04))[_0xf801('0xd')](loggerCatch(_0xf801('0x18')));};exports[_0xf801('0x19')]=function(_0x27c5a6){return BPromise[_0xf801('0xa')]()['then'](cmHopper[_0xf801('0x19')](_0x27c5a6))[_0xf801('0xd')](loggerCatch(_0xf801('0x1a')));};exports[_0xf801('0x1b')]=function(_0x4e7cd9){return BPromise[_0xf801('0xa')]()[_0xf801('0xb')](cmHopper[_0xf801('0x1b')]({'UserId':null},_0x4e7cd9,0x1))[_0xf801('0xd')](loggerCatch(_0xf801('0x1c')));};exports[_0xf801('0x1d')]=function(_0x44d5ce){return BPromise['resolve']()[_0xf801('0xb')](cmHopper[_0xf801('0x1b')]({'active':![]},_0x44d5ce,0x1))[_0xf801('0xd')](loggerCatch(_0xf801('0x1e')));};exports['crateCustomerReportQueue']=function(_0x549d6c){var _0x1c029d={};_0x1c029d[_0xf801('0x1f')]=_0x549d6c[_0xf801('0x1f')];_0x1c029d[_0xf801('0x20')]=_0x549d6c[_0xf801('0x20')];_0x1c029d[_0xf801('0x21')]=_0x549d6c['calleridnum'];_0x1c029d['calleridname']=_0x549d6c['calleridname'];_0x1c029d[_0xf801('0x22')]=_0x549d6c[_0xf801('0x22')];_0x1c029d[_0xf801('0x23')]=_0x549d6c[_0xf801('0x24')];_0x1c029d['queuecallerleaveAt']=_0x549d6c['answertime'];_0x1c029d[_0xf801('0x25')]=0x1;_0x1c029d[_0xf801('0x26')]=_0x549d6c['endtime'];_0x1c029d[_0xf801('0x27')]=_0x549d6c[_0xf801('0x28')];_0x1c029d[_0xf801('0x29')]=_0xf801('0x2a');_0x1c029d[_0xf801('0x2b')]=_0xf801('0x2c');_0x1c029d[_0xf801('0x2d')]=0x0;_0x1c029d[_0xf801('0x2e')]=0x1;_0x1c029d[_0xf801('0x2f')]=_0x549d6c['membername'];_0x1c029d[_0xf801('0x30')]=_0xf801('0x31');return BPromise[_0xf801('0xa')]()['then'](voiceQueueReport[_0xf801('0x32')](_0x1c029d))[_0xf801('0xd')](loggerCatch(_0xf801('0x33')));};exports['getContactRecallMe']=function(_0x236c2b,_0x5c868e){return BPromise[_0xf801('0xa')]()[_0xf801('0xb')](cmHopper[_0xf801('0x34')](_0x236c2b,_0x5c868e))[_0xf801('0xd')](loggerCatch(_0xf801('0x35')));};exports[_0xf801('0x36')]=function(_0x5ec48d){return BPromise['resolve']()[_0xf801('0xb')](cmHopper[_0xf801('0x15')](_0x5ec48d,!![],!![]))[_0xf801('0xd')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index ea73d16..0751c92 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 _0x61ab=['NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','Contact','hasOwnProperty','tags','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','active','add','minutes','ListId','pTalking','buildObj','lastevent','queue','motionChannel','voice','mandatoryDisposition','reachable','push','getDiff','milliseconds','CampaignId','filterKey','type','campaigntype','dialAnswer','membername','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','lodash','moment','preview','env','127.0.0.1','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x61ab,0x1db));var _0xb61a=function(_0xbbe973,_0x481cbb){_0xbbe973=_0xbbe973-0x0;var _0x13b770=_0x61ab[_0xbbe973];return _0x13b770;};'use strict';var util=require('util');var _=require(_0xb61a('0x0'));var moment=require(_0xb61a('0x1'));var logger=require('../../../../config/logger')(_0xb61a('0x2'));var ipAgi=process[_0xb61a('0x3')]['XCALLY_IP_AGI']||_0xb61a('0x4');function getSeconds(_0x4661f2,_0x20056e){var _0x514374=moment(_0x4661f2)['milliseconds'](0x0);var _0x334edb=moment(_0x20056e)['milliseconds'](0x0);return _0x514374[_0xb61a('0x5')](_0x334edb,_0xb61a('0x6'));}exports[_0xb61a('0x7')]=function(_0x3a78ef){return function(_0x174a1a){logger[_0xb61a('0x8')](_0x3a78ef,util[_0xb61a('0x9')](_0x174a1a,{'showHidden':![],'depth':null}));};};exports[_0xb61a('0xa')]=function(_0x8a6d41,_0x5a7733){logger[_0xb61a('0xb')](_0x8a6d41,util[_0xb61a('0x9')](_0x5a7733,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3ad300,_0x15fb06){logger[_0xb61a('0x8')](_0x3ad300,util[_0xb61a('0x9')](_0x15fb06,{'showHidden':![],'depth':null}));};exports[_0xb61a('0xc')]=function(_0x52fa5d){return function(_0x2c835e){logger[_0xb61a('0xb')](_0x52fa5d,util[_0xb61a('0x9')](_0x2c835e,{'showHidden':![],'depth':null}));};};exports[_0xb61a('0xd')]=function(_0x59c8b5,_0x5bf234,_0x24b37e){return{'message':_0x59c8b5,'unlock':_0x5bf234,'active':_0x24b37e};};exports[_0xb61a('0xe')]=function(_0x3f0b9e,_0x2bd8e9,_0x49441f){if(!_['isUndefined'](_0x49441f)&&'string'===typeof _0x49441f&&!_[_0xb61a('0xf')](_0x49441f)){if(!_[_0xb61a('0x10')](_0x2bd8e9)&&_0xb61a('0x11')===typeof _0x2bd8e9&&!_['isEmpty'](_0x2bd8e9)){return util[_0xb61a('0x12')]('\x22%s\x22\x20<%s>',_0x2bd8e9,_0x49441f);}return util[_0xb61a('0x12')](_0xb61a('0x13'),_0x49441f,_0x49441f);}if(!_[_0xb61a('0x10')](_0x3f0b9e)&&'string'===typeof _0x3f0b9e&&!_[_0xb61a('0xf')](_0x3f0b9e)){return _0x3f0b9e;}return _0xb61a('0x14');};exports['isActive']=function(_0xe260d6){if(_[_0xb61a('0x15')](_0xe260d6)){return![];}return _0xe260d6;};exports['addVariables']=function(_0xc26cbe,_0x4f33f8,_0x37efec,_0x30adc3,_0x120dd1,_0x41a7de){var _0x59fa7b={'XMD-QUEUE':_0x4f33f8[_0xb61a('0x16')]?_0x4f33f8[_0xb61a('0x16')][_0xb61a('0x17')]:'','XMD-CALLERID':_0x30adc3,'XMD-CALLERID-PREVIEW':_0x41a7de?util[_0xb61a('0x12')](_0xb61a('0x13'),_0x41a7de[_0xb61a('0x18')],_0x41a7de[_0xb61a('0x19')]):_0x30adc3,'XMD-DIALID':_0x120dd1,'XMD-CONTACTID':_0x4f33f8[_0xb61a('0x1a')],'XMD-CDRTYPE':_0xb61a('0x1b'),'CALLERID(all)':_0x30adc3,'XMD-VOICEQUEUEID':_0x4f33f8[_0xb61a('0x1c')],'XMD-DIALCHANNEL':_0x37efec,'XMD-DIALTIMEOUT':_0xc26cbe[_0xb61a('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xb61a('0x12')]('\x22rtTxX%s%s\x22',_0xc26cbe[_0xb61a('0x1e')]?'g':'',_[_0xb61a('0xf')](_0xc26cbe['monitor_format'])?'':_0xb61a('0x1f')),'XMD-DIALURL':_0xc26cbe[_0xb61a('0x20')]||'','XMD-AGI':_0xc26cbe['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0xc26cbe['dialQueueProject']):_0xb61a('0x21'),'XMD-AGIAFTER':_0xc26cbe[_0xb61a('0x1e')]?util[_0xb61a('0x12')](_0xb61a('0x22'),ipAgi,_0xc26cbe['dialQueueProject2']):_0xb61a('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x41a7de?_0x41a7de[_0xb61a('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x41a7de?_0x41a7de[_0xb61a('0x24')]:'','XMD-DESTINATION':_0xb61a('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xb61a('0xf')](_0xc26cbe[_0xb61a('0x26')])){_0x59fa7b[util[_0xb61a('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0xc26cbe[_0xb61a('0x26')];_0x59fa7b[util[_0xb61a('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x120dd1;}if(_0x4f33f8&&_0x4f33f8[_0xb61a('0x27')]){for(var _0x37f274 in _0x4f33f8['Contact']){if(_0x4f33f8['Contact'][_0xb61a('0x28')](_0x37f274)){if(!_[_0xb61a('0x15')](_0x4f33f8[_0xb61a('0x27')][_0x37f274])&&_0x37f274!=='id'&&_0x37f274!==_0xb61a('0x29')&&_0x37f274!=='createdAt'&&_0x37f274!=='updatedAt'){_0x59fa7b[util[_0xb61a('0x12')]('%s%s','XMD-',_['toUpper'](_0x37f274))]=_0x4f33f8['Contact'][_0x37f274];}}}}return _0x59fa7b;};exports[_0xb61a('0x2a')]=function(_0x22cdf2){var _0x849121={};for(var _0x1d24b4 in _0x22cdf2){if(_0x22cdf2[_0xb61a('0x28')](_0x1d24b4)){_0x849121[util[_0xb61a('0x12')]('%s',_[_0xb61a('0x2b')](_0x1d24b4))]=_0x22cdf2[_0x1d24b4];}}return{'variables':_0x849121};};exports['updateOriginated']=function(_0xdb1c35,_0x4c6281){if(!_[_0xb61a('0x15')](_0xdb1c35)){if(_0xdb1c35[_0xb61a('0x28')](_0xb61a('0x2c'))){if(_0xdb1c35['originated']>0x0){_0xdb1c35[_0xb61a('0x2c')]-=0x1;}else{logger[_0xb61a('0x8')](_0xb61a('0x2d'),_0x4c6281);}}}else{logger['error'](_0xb61a('0x2e'),_0x4c6281);}};exports['logBlacklist']=function(_0x581f92){var _0x45d662=moment()[_0xb61a('0x12')](_0xb61a('0x2f'));_0x581f92[_0xb61a('0x30')]=0xd;_0x581f92[_0xb61a('0x31')]=_0xb61a('0x32');_0x581f92[_0xb61a('0x33')]=_0x45d662;_0x581f92['responsetime']=_0x45d662;_0x581f92[_0xb61a('0x34')]=_0x45d662;};exports[_0xb61a('0x35')]=function(_0x2759b9,_0x10d4fe,_0x14e9d8){var _0x348ac1=moment()[_0xb61a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2759b9[_0xb61a('0x30')]=_0x10d4fe;_0x2759b9['statedesc']=_0x14e9d8;_0x2759b9['responsetime']=_0x348ac1;_0x2759b9['ringtime']=getSeconds(_0x2759b9[_0xb61a('0x36')],_0x2759b9[_0xb61a('0x33')]);};exports['logLookAgent']=function(_0x5280b4,_0x44f883,_0x43a4e7){_0x5280b4['membername']=_0x44f883;_0x5280b4[_0xb61a('0x37')]=_0x43a4e7;};exports[_0xb61a('0x38')]=function(_0x49d82c,_0x5eaa68,_0x546e09){var _0x303de4=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x49d82c[_0xb61a('0x30')]=_0x5eaa68;_0x49d82c[_0xb61a('0x31')]=_0x546e09;_0x49d82c[_0xb61a('0x36')]=_0x49d82c[_0xb61a('0x36')]?_0x49d82c[_0xb61a('0x36')]:_0x303de4;_0x49d82c[_0xb61a('0x34')]=_0x49d82c[_0xb61a('0x34')]?_0x49d82c[_0xb61a('0x34')]:_0x303de4;_0x49d82c[_0xb61a('0x39')]=getSeconds(_0x49d82c[_0xb61a('0x36')]||0x0,_0x49d82c[_0xb61a('0x33')]||0x0);_0x49d82c[_0xb61a('0x3a')]=_0x49d82c[_0xb61a('0x3b')]?getSeconds(_0x49d82c[_0xb61a('0x34')],_0x49d82c[_0xb61a('0x3b')]):0x0;};exports[_0xb61a('0x3c')]=function(_0x5b0a81){return _0x5b0a81===_0xb61a('0x3d');};exports['variablesAction']=function(_0x328598,_0x431164,_0x365b37,_0x176eac,_0x461aa2){var _0x472f1b=_0x176eac?_0xb61a('0x3e'):_0x328598[_0xb61a('0x18')];_0x472f1b=_0x461aa2?_0xb61a('0x3f'):_0x472f1b;return{'actionid':_0x328598[_0xb61a('0x40')],'action':_0xb61a('0x41'),'channel':_0x328598[_0xb61a('0x42')],'callerid':util[_0xb61a('0x12')](_0xb61a('0x13'),_0x472f1b,_0x328598[_0xb61a('0x19')]),'Exten':_0xb61a('0x25'),'Context':_0xb61a('0x43'),'Priority':'1','variable':_0x365b37,'timeout':(_0x431164[_0xb61a('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x328598[_0xb61a('0x40')]};};exports['totalGlobal']=function(_0x1e32b4){return _0x1e32b4[_0xb61a('0x45')]+_0x1e32b4[_0xb61a('0x46')]+_0x1e32b4[_0xb61a('0x47')]+_0x1e32b4[_0xb61a('0x48')]+_0x1e32b4[_0xb61a('0x49')];};exports['cloneAction']=function(_0x1cbcee){var _0x160a09=_['clone'](_0x1cbcee);_0x160a09[_0xb61a('0x30')]=0xf;_0x160a09[_0xb61a('0x31')]=_0xb61a('0x4a');return _0x160a09;};exports[_0xb61a('0x4b')]=function(_0x54baa4,_0x7d567d,_0x354b2d){var _0x53ffb3={};_0x53ffb3[_0x7d567d]=_0x54baa4[_0x7d567d];_0x53ffb3[_0xb61a('0x4c')]=![];_0x53ffb3['scheduledat']=moment()[_0xb61a('0x4d')](_0x354b2d,_0xb61a('0x4e'))[_0xb61a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x53ffb3[_0xb61a('0x1a')]=_0x54baa4[_0xb61a('0x1a')];_0x53ffb3[_0xb61a('0x4f')]=_0x54baa4[_0xb61a('0x4f')];_0x53ffb3[_0xb61a('0x1c')]=_0x54baa4[_0xb61a('0x1c')]||undefined;return _0x53ffb3;};exports['decrementTalkink']=function(_0x341054,_0x28c937){if(!_[_0xb61a('0x15')](_0x341054)){if(_0x341054[_0xb61a('0x50')]>0x0){_0x341054[_0xb61a('0x50')]-=0x1;}else{logger['error'](_0x28c937,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xb61a('0x8')](_0x28c937,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x5bbcc5){if(_0x5bbcc5<=0x0){return!![];}return![];};exports[_0xb61a('0x51')]=function(_0x115565,_0x41ddad,_0xd8e473){_0x115565[_0xb61a('0x52')]=_0x41ddad;_0x115565[_0xb61a('0x17')]=_0x115565[_0xb61a('0x53')];_0x115565['interface']=_0x115565['channelAgent'];_0x115565[_0xb61a('0x54')]=_0xb61a('0x55');if(_0xd8e473){_0x115565[_0xb61a('0x56')]=_0xd8e473[_0xb61a('0x56')];}return _0x115565;};exports['buildAcw']=function(_0x202c49){var _0x209c51={};_0x209c51[_0xb61a('0x53')]=_0x202c49[_0xb61a('0x53')];_0x209c51['interface']=_0x202c49['channelAgent'];_0x209c51[_0xb61a('0x40')]=_0x202c49[_0xb61a('0x40')];return _0x209c51;};exports['agentReadyId']=function(_0x3d5a00){var _0x383fd9=[];for(var _0x12102e in _0x3d5a00){if(_0x3d5a00[_0xb61a('0x28')](_0x12102e)){if(!_['isNil'](_0x3d5a00[_0x12102e])&&_0x3d5a00[_0x12102e][_0xb61a('0x30')]==='not_inuse'&&_0x3d5a00[_0x12102e]['status']===_0xb61a('0x57')){_0x383fd9[_0xb61a('0x58')](_0x3d5a00[_0x12102e]['id']);}}}return _0x383fd9;};exports[_0xb61a('0x59')]=function(_0x2e8415){var _0x5cc433=moment()[_0xb61a('0x5a')](0x0);var _0xbe4fbb=moment(_0x2e8415)['milliseconds'](0x0);return _0x5cc433['diff'](_0xbe4fbb,_0xb61a('0x6'));};exports['createBody']=function(_0x32672f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x32672f[_0xb61a('0x1a')],'ListId':_0x32672f[_0xb61a('0x4f')],'VoiceQueueId':_0x32672f['VoiceQueueId']||undefined,'CampaignId':_0x32672f[_0xb61a('0x5b')]||undefined};};exports[_0xb61a('0x5c')]=function(_0x288969){if(_0x288969==='uniqueid'||_0x288969==='idContact'||_0x288969==='queue'||_0x288969===_0xb61a('0x5d')||_0x288969===_0xb61a('0x5e')||_0x288969===_0xb61a('0x5f')||_0x288969===_0xb61a('0x60')||_0x288969==='channelAgent'||_0x288969==='calleridname'||_0x288969===_0xb61a('0x4c')||_0x288969==='calleridnum'||_0x288969==='scheduledat'||_0x288969===_0xb61a('0x45')||_0x288969===_0xb61a('0x46')||_0x288969===_0xb61a('0x47')||_0x288969==='countglobal'||_0x288969==='callback'||_0x288969===_0xb61a('0x61')||_0x288969===_0xb61a('0x62')||_0x288969===_0xb61a('0x63')||_0x288969===_0xb61a('0x1a')||_0x288969===_0xb61a('0x4f')||_0x288969===_0xb61a('0x37')||_0x288969===_0xb61a('0x1c')||_0x288969===_0xb61a('0x64')||_0x288969===_0xb61a('0x65')||_0x288969===_0xb61a('0x66')||_0x288969===_0xb61a('0x67')||_0x288969===_0xb61a('0x68')||_0x288969===_0xb61a('0x69')||_0x288969===_0xb61a('0x6a')||_0x288969===_0xb61a('0x6b')||_0x288969===_0xb61a('0x6c')||_0x288969===_0xb61a('0x6d')||_0x288969===_0xb61a('0x6e')||_0x288969==='xmd-cdrtype'||_0x288969===_0xb61a('0x6f')||_0x288969===_0xb61a('0x70')||_0x288969==='xmd-agi'||_0x288969==='rtpaudioqos'||_0x288969===_0xb61a('0x71')||_0x288969===_0xb61a('0x72')||_0x288969===_0xb61a('0x73')||_0x288969===_0xb61a('0x74')||_0x288969===_0xb61a('0x75')||_0x288969===_0xb61a('0x76')||_0x288969==='rtpaudioqosrttbridged'||_0x288969===_0xb61a('0x77')||_0x288969===_0xb61a('0x71')||_0x288969===_0xb61a('0x72')||_0x288969==='rtpaudioqosjitterbridged'||_0x288969===_0xb61a('0x74')||_0x288969===_0xb61a('0x75')||_0x288969==='rtpaudioqosrtt'||_0x288969===_0xb61a('0x78')||_0x288969===_0xb61a('0x79')||_0x288969===_0xb61a('0x7a')||_0x288969==='state'||_0x288969===_0xb61a('0x31')){return![];}return!![];};exports[_0xb61a('0x7b')]=function(_0x427403,_0x2a7f2c){var _0x33f1bf,_0x3e4cc3,_0x2907ed;if(_0x2a7f2c<=0x0){_0x2a7f2c=0x1;}_0x33f1bf=new RegExp('\x5cw{0,'+_0x2a7f2c+'}$');_0x3e4cc3=Math[_0xb61a('0x7c')](0xa,_0x2a7f2c-0x1);_0x2907ed=Math['pow'](0xa,_0x2a7f2c)-0x1;return util[_0xb61a('0x12')]('%s',_['replace'](_0x427403,_0x33f1bf,_[_0xb61a('0x7d')](_0x3e4cc3,_0x2907ed)));};exports[_0xb61a('0x7e')]=function(_0x276512){var _0x1681fc=_0x276512['match'](/"(.*?)"/);return _0x1681fc?_0x1681fc[0x1]:_0x276512;};exports['extractCalleridNumber']=function(_0x51c0c9){var _0x2df697=_0x51c0c9['match'](/<(.*?)>/);return _0x2df697?_0x2df697[0x1]:_0x51c0c9;}; \ No newline at end of file +var _0x9f5e=['rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','loggerError','info','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','Contact','hasOwnProperty','tags','updatedAt','%s%s','toLowerVariables','toLower','updateOriginated','originated','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','ListId','decrementTalkink','pTalking','IsNotLoggedIn','buildObj','queue','interface','motionChannel','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','CampaignId','filterKey','idContact','type','dialAnswer','active','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos'];(function(_0xd53443,_0x4b82fd){var _0x397096=function(_0x368567){while(--_0x368567){_0xd53443['push'](_0xd53443['shift']());}};_0x397096(++_0x4b82fd);}(_0x9f5e,0x9d));var _0xe9f5=function(_0x165585,_0x4ef95d){_0x165585=_0x165585-0x0;var _0x219347=_0x9f5e[_0x165585];return _0x219347;};'use strict';var util=require('util');var _=require(_0xe9f5('0x0'));var moment=require('moment');var logger=require(_0xe9f5('0x1'))('preview');var ipAgi=process[_0xe9f5('0x2')][_0xe9f5('0x3')]||_0xe9f5('0x4');function getSeconds(_0x4626d0,_0x1d1985){var _0x8c7fa6=moment(_0x4626d0)['milliseconds'](0x0);var _0x10beab=moment(_0x1d1985)[_0xe9f5('0x5')](0x0);return _0x8c7fa6[_0xe9f5('0x6')](_0x10beab,'seconds');}exports[_0xe9f5('0x7')]=function(_0x15e413){return function(_0xdaf4de){logger[_0xe9f5('0x8')](_0x15e413,util[_0xe9f5('0x9')](_0xdaf4de,{'showHidden':![],'depth':null}));};};exports[_0xe9f5('0xa')]=function(_0x51f0a3,_0x445ade){logger['info'](_0x51f0a3,util[_0xe9f5('0x9')](_0x445ade,{'showHidden':![],'depth':null}));};exports[_0xe9f5('0xb')]=function(_0x1bb71a,_0x567157){logger['error'](_0x1bb71a,util['inspect'](_0x567157,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x428bad){return function(_0x514907){logger[_0xe9f5('0xc')](_0x428bad,util[_0xe9f5('0x9')](_0x514907,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x565c03,_0x35c31c,_0xa3aa09){return{'message':_0x565c03,'unlock':_0x35c31c,'active':_0xa3aa09};};exports[_0xe9f5('0xd')]=function(_0x5bdd45,_0x21ba93,_0x1d0bf6){if(!_[_0xe9f5('0xe')](_0x1d0bf6)&&'string'===typeof _0x1d0bf6&&!_[_0xe9f5('0xf')](_0x1d0bf6)){if(!_[_0xe9f5('0xe')](_0x21ba93)&&_0xe9f5('0x10')===typeof _0x21ba93&&!_[_0xe9f5('0xf')](_0x21ba93)){return util[_0xe9f5('0x11')](_0xe9f5('0x12'),_0x21ba93,_0x1d0bf6);}return util['format'](_0xe9f5('0x12'),_0x1d0bf6,_0x1d0bf6);}if(!_['isUndefined'](_0x5bdd45)&&_0xe9f5('0x10')===typeof _0x5bdd45&&!_[_0xe9f5('0xf')](_0x5bdd45)){return _0x5bdd45;}return _0xe9f5('0x13');};exports[_0xe9f5('0x14')]=function(_0x37f757){if(_[_0xe9f5('0x15')](_0x37f757)){return![];}return _0x37f757;};exports[_0xe9f5('0x16')]=function(_0x42cfad,_0x1ce68f,_0x3d8209,_0x282ba7,_0x593c55,_0x2b79f5){var _0x19116f={'XMD-QUEUE':_0x1ce68f[_0xe9f5('0x17')]?_0x1ce68f[_0xe9f5('0x17')][_0xe9f5('0x18')]:'','XMD-CALLERID':_0x282ba7,'XMD-CALLERID-PREVIEW':_0x2b79f5?util[_0xe9f5('0x11')](_0xe9f5('0x12'),_0x2b79f5[_0xe9f5('0x19')],_0x2b79f5['calleridnum']):_0x282ba7,'XMD-DIALID':_0x593c55,'XMD-CONTACTID':_0x1ce68f[_0xe9f5('0x1a')],'XMD-CDRTYPE':_0xe9f5('0x1b'),'CALLERID(all)':_0x282ba7,'XMD-VOICEQUEUEID':_0x1ce68f[_0xe9f5('0x1c')],'XMD-DIALCHANNEL':_0x3d8209,'XMD-DIALTIMEOUT':_0x42cfad[_0xe9f5('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xe9f5('0x11')]('\x22rtTxX%s%s\x22',_0x42cfad[_0xe9f5('0x1e')]?'g':'',_[_0xe9f5('0xf')](_0x42cfad['monitor_format'])?'':_0xe9f5('0x1f')),'XMD-DIALURL':_0x42cfad[_0xe9f5('0x20')]||'','XMD-AGI':_0x42cfad[_0xe9f5('0x21')]?util[_0xe9f5('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x42cfad['dialQueueProject']):_0xe9f5('0x22'),'XMD-AGIAFTER':_0x42cfad[_0xe9f5('0x1e')]?util[_0xe9f5('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x42cfad['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x2b79f5?_0x2b79f5[_0xe9f5('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x2b79f5?_0x2b79f5[_0xe9f5('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xe9f5('0x25')};if(!_[_0xe9f5('0xf')](_0x42cfad['monitor_format'])){_0x19116f[util['format']('%s',_0xe9f5('0x26'))]=_0x42cfad[_0xe9f5('0x27')];_0x19116f[util[_0xe9f5('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x593c55;}if(_0x1ce68f&&_0x1ce68f[_0xe9f5('0x28')]){for(var _0x4cc4aa in _0x1ce68f[_0xe9f5('0x28')]){if(_0x1ce68f[_0xe9f5('0x28')][_0xe9f5('0x29')](_0x4cc4aa)){if(!_[_0xe9f5('0x15')](_0x1ce68f[_0xe9f5('0x28')][_0x4cc4aa])&&_0x4cc4aa!=='id'&&_0x4cc4aa!==_0xe9f5('0x2a')&&_0x4cc4aa!=='createdAt'&&_0x4cc4aa!==_0xe9f5('0x2b')){_0x19116f[util[_0xe9f5('0x11')](_0xe9f5('0x2c'),'XMD-',_['toUpper'](_0x4cc4aa))]=_0x1ce68f['Contact'][_0x4cc4aa];}}}}return _0x19116f;};exports[_0xe9f5('0x2d')]=function(_0x2e07fc){var _0x2b618c={};for(var _0x200ad0 in _0x2e07fc){if(_0x2e07fc[_0xe9f5('0x29')](_0x200ad0)){_0x2b618c[util[_0xe9f5('0x11')]('%s',_[_0xe9f5('0x2e')](_0x200ad0))]=_0x2e07fc[_0x200ad0];}}return{'variables':_0x2b618c};};exports[_0xe9f5('0x2f')]=function(_0x21c80a,_0x15d6f1){if(!_[_0xe9f5('0x15')](_0x21c80a)){if(_0x21c80a[_0xe9f5('0x29')](_0xe9f5('0x30'))){if(_0x21c80a['originated']>0x0){_0x21c80a[_0xe9f5('0x30')]-=0x1;}else{logger[_0xe9f5('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x15d6f1);}}}else{logger[_0xe9f5('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x15d6f1);}};exports[_0xe9f5('0x31')]=function(_0xa27156){var _0x429e95=moment()[_0xe9f5('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0xa27156[_0xe9f5('0x32')]=0xd;_0xa27156[_0xe9f5('0x33')]=_0xe9f5('0x34');_0xa27156[_0xe9f5('0x35')]=_0x429e95;_0xa27156[_0xe9f5('0x36')]=_0x429e95;_0xa27156['endtime']=_0x429e95;};exports[_0xe9f5('0x37')]=function(_0x185112,_0x3df28a,_0x34149e){var _0x629b6=moment()['format'](_0xe9f5('0x38'));_0x185112[_0xe9f5('0x32')]=_0x3df28a;_0x185112['statedesc']=_0x34149e;_0x185112[_0xe9f5('0x36')]=_0x629b6;_0x185112[_0xe9f5('0x39')]=getSeconds(_0x185112[_0xe9f5('0x36')],_0x185112[_0xe9f5('0x35')]);};exports[_0xe9f5('0x3a')]=function(_0x36d71b,_0x4e39ce,_0x56eba8){_0x36d71b[_0xe9f5('0x3b')]=_0x4e39ce;_0x36d71b[_0xe9f5('0x3c')]=_0x56eba8;};exports[_0xe9f5('0x3d')]=function(_0x4965c6,_0x5b12b1,_0x5556a8){var _0x25a4ae=moment()[_0xe9f5('0x11')](_0xe9f5('0x38'));_0x4965c6[_0xe9f5('0x32')]=_0x5b12b1;_0x4965c6[_0xe9f5('0x33')]=_0x5556a8;_0x4965c6[_0xe9f5('0x36')]=_0x4965c6[_0xe9f5('0x36')]?_0x4965c6['responsetime']:_0x25a4ae;_0x4965c6['endtime']=_0x4965c6[_0xe9f5('0x3e')]?_0x4965c6[_0xe9f5('0x3e')]:_0x25a4ae;_0x4965c6[_0xe9f5('0x39')]=getSeconds(_0x4965c6[_0xe9f5('0x36')]||0x0,_0x4965c6[_0xe9f5('0x35')]||0x0);_0x4965c6[_0xe9f5('0x3f')]=_0x4965c6[_0xe9f5('0x40')]?getSeconds(_0x4965c6[_0xe9f5('0x3e')],_0x4965c6['answertime']):0x0;};exports[_0xe9f5('0x41')]=function(_0x3cc5c0){return _0x3cc5c0===_0xe9f5('0x42');};exports[_0xe9f5('0x43')]=function(_0x1491d8,_0x4c4cce,_0x4aa726,_0x37aec8,_0x261c13){var _0x24cca7=_0x37aec8?'RECALL':_0x1491d8[_0xe9f5('0x19')];_0x24cca7=_0x261c13?_0xe9f5('0x44'):_0x24cca7;return{'actionid':_0x1491d8['uniqueid'],'action':_0xe9f5('0x45'),'channel':_0x1491d8[_0xe9f5('0x46')],'callerid':util[_0xe9f5('0x11')](_0xe9f5('0x12'),_0x24cca7,_0x1491d8[_0xe9f5('0x47')]),'Exten':_0xe9f5('0x48'),'Context':_0xe9f5('0x49'),'Priority':'1','variable':_0x4aa726,'timeout':(_0x4c4cce['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1491d8[_0xe9f5('0x4a')]};};exports[_0xe9f5('0x4b')]=function(_0x56a51a){return _0x56a51a[_0xe9f5('0x4c')]+_0x56a51a[_0xe9f5('0x4d')]+_0x56a51a['countnoanswerretry']+_0x56a51a[_0xe9f5('0x4e')]+_0x56a51a[_0xe9f5('0x4f')];};exports[_0xe9f5('0x50')]=function(_0x28b3f2){var _0xd0b00d=_['clone'](_0x28b3f2);_0xd0b00d[_0xe9f5('0x32')]=0xf;_0xd0b00d['statedesc']=_0xe9f5('0x51');return _0xd0b00d;};exports[_0xe9f5('0x52')]=function(_0x134b75,_0x110111,_0x2405fd){var _0x27f650={};_0x27f650[_0x110111]=_0x134b75[_0x110111];_0x27f650['active']=![];_0x27f650[_0xe9f5('0x53')]=moment()['add'](_0x2405fd,'minutes')['format'](_0xe9f5('0x38'));_0x27f650[_0xe9f5('0x1a')]=_0x134b75[_0xe9f5('0x1a')];_0x27f650[_0xe9f5('0x54')]=_0x134b75[_0xe9f5('0x54')];_0x27f650[_0xe9f5('0x1c')]=_0x134b75['VoiceQueueId']||undefined;return _0x27f650;};exports[_0xe9f5('0x55')]=function(_0x17f9ec,_0x2a1609){if(!_[_0xe9f5('0x15')](_0x17f9ec)){if(_0x17f9ec[_0xe9f5('0x56')]>0x0){_0x17f9ec[_0xe9f5('0x56')]-=0x1;}else{logger[_0xe9f5('0x8')](_0x2a1609,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xe9f5('0x8')](_0x2a1609,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xe9f5('0x57')]=function(_0x402ce0){if(_0x402ce0<=0x0){return!![];}return![];};exports[_0xe9f5('0x58')]=function(_0xaa5851,_0x468f6e,_0x2b7ecf){_0xaa5851['lastevent']=_0x468f6e;_0xaa5851[_0xe9f5('0x18')]=_0xaa5851[_0xe9f5('0x59')];_0xaa5851[_0xe9f5('0x5a')]=_0xaa5851[_0xe9f5('0x46')];_0xaa5851[_0xe9f5('0x5b')]='voice';if(_0x2b7ecf){_0xaa5851['mandatoryDisposition']=_0x2b7ecf[_0xe9f5('0x5c')];}return _0xaa5851;};exports[_0xe9f5('0x5d')]=function(_0x55829c){var _0x155e89={};_0x155e89[_0xe9f5('0x59')]=_0x55829c[_0xe9f5('0x59')];_0x155e89[_0xe9f5('0x5a')]=_0x55829c['channelAgent'];_0x155e89['uniqueid']=_0x55829c[_0xe9f5('0x4a')];return _0x155e89;};exports[_0xe9f5('0x5e')]=function(_0x31fa24){var _0x568929=[];for(var _0x478487 in _0x31fa24){if(_0x31fa24[_0xe9f5('0x29')](_0x478487)){if(!_['isNil'](_0x31fa24[_0x478487])&&_0x31fa24[_0x478487]['state']===_0xe9f5('0x5f')&&_0x31fa24[_0x478487][_0xe9f5('0x60')]===_0xe9f5('0x61')){_0x568929[_0xe9f5('0x62')](_0x31fa24[_0x478487]['id']);}}}return _0x568929;};exports[_0xe9f5('0x63')]=function(_0x3943d9){var _0x21fc1d=moment()[_0xe9f5('0x5')](0x0);var _0x1a80f4=moment(_0x3943d9)[_0xe9f5('0x5')](0x0);return _0x21fc1d[_0xe9f5('0x6')](_0x1a80f4,_0xe9f5('0x64'));};exports['createBody']=function(_0x2551f9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2551f9[_0xe9f5('0x1a')],'ListId':_0x2551f9[_0xe9f5('0x54')],'VoiceQueueId':_0x2551f9[_0xe9f5('0x1c')]||undefined,'CampaignId':_0x2551f9[_0xe9f5('0x65')]||undefined};};exports[_0xe9f5('0x66')]=function(_0x4ad4e9){if(_0x4ad4e9===_0xe9f5('0x4a')||_0x4ad4e9===_0xe9f5('0x67')||_0x4ad4e9===_0xe9f5('0x59')||_0x4ad4e9===_0xe9f5('0x68')||_0x4ad4e9==='campaigntype'||_0x4ad4e9===_0xe9f5('0x69')||_0x4ad4e9===_0xe9f5('0x3b')||_0x4ad4e9==='channelAgent'||_0x4ad4e9===_0xe9f5('0x19')||_0x4ad4e9===_0xe9f5('0x6a')||_0x4ad4e9===_0xe9f5('0x47')||_0x4ad4e9===_0xe9f5('0x53')||_0x4ad4e9===_0xe9f5('0x4c')||_0x4ad4e9==='countcongestionretry'||_0x4ad4e9===_0xe9f5('0x6b')||_0x4ad4e9===_0xe9f5('0x6c')||_0x4ad4e9===_0xe9f5('0x6d')||_0x4ad4e9===_0xe9f5('0x6e')||_0x4ad4e9===_0xe9f5('0x6f')||_0x4ad4e9===_0xe9f5('0x70')||_0x4ad4e9===_0xe9f5('0x1a')||_0x4ad4e9===_0xe9f5('0x54')||_0x4ad4e9===_0xe9f5('0x3c')||_0x4ad4e9==='VoiceQueueId'||_0x4ad4e9===_0xe9f5('0x71')||_0x4ad4e9==='xmd-voicequeueid'||_0x4ad4e9==='xmd-queue'||_0x4ad4e9===_0xe9f5('0x72')||_0x4ad4e9===_0xe9f5('0x73')||_0x4ad4e9===_0xe9f5('0x74')||_0x4ad4e9===_0xe9f5('0x75')||_0x4ad4e9===_0xe9f5('0x76')||_0x4ad4e9===_0xe9f5('0x77')||_0x4ad4e9==='xmd-dialchannel'||_0x4ad4e9===_0xe9f5('0x78')||_0x4ad4e9==='xmd-cdrtype'||_0x4ad4e9===_0xe9f5('0x79')||_0x4ad4e9===_0xe9f5('0x7a')||_0x4ad4e9===_0xe9f5('0x7b')||_0x4ad4e9===_0xe9f5('0x7c')||_0x4ad4e9===_0xe9f5('0x7d')||_0x4ad4e9===_0xe9f5('0x7e')||_0x4ad4e9===_0xe9f5('0x7f')||_0x4ad4e9==='rtpaudioqosloss'||_0x4ad4e9===_0xe9f5('0x80')||_0x4ad4e9==='rtpaudioqosrtt'||_0x4ad4e9===_0xe9f5('0x81')||_0x4ad4e9===_0xe9f5('0x7c')||_0x4ad4e9===_0xe9f5('0x7d')||_0x4ad4e9===_0xe9f5('0x7e')||_0x4ad4e9==='rtpaudioqosjitterbridged'||_0x4ad4e9==='rtpaudioqosloss'||_0x4ad4e9===_0xe9f5('0x80')||_0x4ad4e9===_0xe9f5('0x82')||_0x4ad4e9===_0xe9f5('0x81')||_0x4ad4e9===_0xe9f5('0x83')||_0x4ad4e9===_0xe9f5('0x84')||_0x4ad4e9===_0xe9f5('0x32')||_0x4ad4e9===_0xe9f5('0x33')){return![];}return!![];};exports[_0xe9f5('0x85')]=function(_0x24e679,_0xa7570e){var _0x4ed078,_0x3c96eb,_0x159c56;if(_0xa7570e<=0x0){_0xa7570e=0x1;}_0x4ed078=new RegExp(_0xe9f5('0x86')+_0xa7570e+'}$');_0x3c96eb=Math[_0xe9f5('0x87')](0xa,_0xa7570e-0x1);_0x159c56=Math[_0xe9f5('0x87')](0xa,_0xa7570e)-0x1;return util[_0xe9f5('0x11')]('%s',_[_0xe9f5('0x88')](_0x24e679,_0x4ed078,_[_0xe9f5('0x89')](_0x3c96eb,_0x159c56)));};exports[_0xe9f5('0x8a')]=function(_0x1822bb){var _0x3562c0=_0x1822bb[_0xe9f5('0x8b')](/"(.*?)"/);return _0x3562c0?_0x3562c0[0x1]:_0x1822bb;};exports[_0xe9f5('0x8c')]=function(_0x4df9af){var _0x8416e6=_0x4df9af['match'](/<(.*?)>/);return _0x8416e6?_0x8416e6[0x1]:_0x4df9af;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2507e7c..f94385d 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 _0xcbdc=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xcbdc,0xb0));var _0xccbd=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcbdc[_0x2c91e9];return _0x13f0ff;};'use strict';exports[_0xccbd('0x0')]={'queue':{'type':_0xccbd('0x1'),'required':!![]},'interface':{'type':_0xccbd('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xccbd('0x2'),'required':![]},'paused':{'type':_0xccbd('0x3'),'required':![]}};exports[_0xccbd('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xccbd('0x1'),'required':!![]}};exports[_0xccbd('0x5')]={'interface':{'type':_0xccbd('0x1'),'required':!![]},'paused':{'type':_0xccbd('0x3')},'reason':{'type':_0xccbd('0x1'),'required':![]}};exports[_0xccbd('0x6')]={'module':{'type':'string','required':![]}};exports[_0xccbd('0x7')]={'uniqueid':{'type':_0xccbd('0x1'),'required':!![]}};exports[_0xccbd('0x8')]={'uniqueid':{'type':_0xccbd('0x1'),'required':!![]},'filename':{'type':_0xccbd('0x1')},'format':{'type':_0xccbd('0x1')},'mixmonitorid':{'type':_0xccbd('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xccbd('0x1'),'required':!![]}};exports[_0xccbd('0x9')]={'uniqueid':{'type':_0xccbd('0x1'),'required':!![]},'exten':{'type':_0xccbd('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xef1e=['string','number','boolean','queueremove','reload','voicechannel','queueadd'];(function(_0x492c1b,_0x3ef68e){var _0x46498a=function(_0x19d6aa){while(--_0x19d6aa){_0x492c1b['push'](_0x492c1b['shift']());}};_0x46498a(++_0x3ef68e);}(_0xef1e,0xa0));var _0xeef1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xef1e[_0xa464c9];return _0x3d73c4;};'use strict';exports[_0xeef1('0x0')]={'queue':{'type':_0xeef1('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xeef1('0x1'),'required':!![]},'penalty':{'type':_0xeef1('0x2'),'required':![]},'paused':{'type':_0xeef1('0x3'),'required':![]}};exports[_0xeef1('0x4')]={'queue':{'type':_0xeef1('0x1'),'required':!![]},'interface':{'type':_0xeef1('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xeef1('0x1'),'required':!![]},'paused':{'type':_0xeef1('0x3')},'reason':{'type':_0xeef1('0x1'),'required':![]}};exports[_0xeef1('0x5')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xeef1('0x1'),'required':!![]}};exports[_0xeef1('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xeef1('0x1')},'format':{'type':_0xeef1('0x1')},'mixmonitorid':{'type':_0xeef1('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xeef1('0x1'),'required':!![]},'exten':{'type':_0xeef1('0x1'),'required':!![]},'context':{'type':_0xeef1('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index e5eadfb..531fa23 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 _0x2f5b=['templates','voiceExtensions','channels','queueChannels','outboundChannels','sugarcrmAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','total','answered','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initVoiceQueues','voiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initVtigerAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','sumDuration','initVoiceCallReports','outbound','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','util','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2f5b,0xc6));var _0xb2f5=function(_0x487c25,_0x4530e5){_0x487c25=_0x487c25-0x0;var _0x1fe915=_0x2f5b[_0x487c25];return _0x1fe915;};'use strict';var BPromise=require('bluebird');var util=require(_0xb2f5('0x0'));var _=require('lodash');var moment=require(_0xb2f5('0x1'));var Agent=require(_0xb2f5('0x2'));var Telephone=require(_0xb2f5('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xb2f5('0x4'));var Trigger=require('../model/trigger');var Template=require(_0xb2f5('0x5'));var Campaign=require(_0xb2f5('0x6'));var VoiceExtension=require(_0xb2f5('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xb2f5('0x8'));var FreshdeskAccount=require(_0xb2f5('0x9'));var SugarcrmAccount=require(_0xb2f5('0xa'));var ZohoAccount=require(_0xb2f5('0xb'));var DeskAccount=require(_0xb2f5('0xc'));var VtigerAccount=require(_0xb2f5('0xd'));var ServicenowAccount=require(_0xb2f5('0xe'));var Dynamics365Account=require(_0xb2f5('0xf'));var FreshsalesAccount=require(_0xb2f5('0x10'));var FaxAccount=require(_0xb2f5('0x11'));var Realtime=function(){this[_0xb2f5('0x12')]={};this[_0xb2f5('0x13')]={};this[_0xb2f5('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0xb2f5('0x15')]={};this[_0xb2f5('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xb2f5('0x17')]={};this[_0xb2f5('0x18')]={};this[_0xb2f5('0x19')]={};this[_0xb2f5('0x1a')]={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0xb2f5('0x1b')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xb2f5('0x1c')]={};this[_0xb2f5('0x1d')]={};this['dynamics365Accounts']={};this[_0xb2f5('0x1e')]={};this['faxAccounts']={};};function freeIsNotKey(_0x494770,_0x195cba,_0x8dc24a){var _0x5b76b9=_['mapKeys'](_0x494770,function(_0x204854,_0x5d8d98){return _0x204854[_0x8dc24a];});for(var _0x2dc398 in _0x195cba){if(_0x195cba[_0xb2f5('0x1f')](_0x2dc398)){if(!_0x5b76b9[_0x2dc398]){delete _0x195cba[_0x2dc398];}}}}function freeIsNotKeySip(_0x1fffb2,_0x1de846){var _0x165df4=_[_0xb2f5('0x20')](_0x1fffb2,function(_0x272c59,_0x489eee){return util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x272c59[_0xb2f5('0x23')]);});for(var _0x43a0eb in _0x1de846){if(_0x1de846[_0xb2f5('0x1f')](_0x43a0eb)){if(!_0x165df4[_0x43a0eb]){delete _0x1de846[_0x43a0eb];}}}}function freeIsNotKeyAgent(_0x2164fa,_0x5829da){var _0x4cefcd=_[_0xb2f5('0x20')](_0x2164fa,function(_0x5ce6f5,_0x2efe6e){var _0x2a24d8=_[_0xb2f5('0x24')](_0x5ce6f5['interface'])?util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x5ce6f5['name']):_0x5ce6f5[_0xb2f5('0x25')];return _0x2a24d8;});for(var _0x40af04 in _0x5829da){if(_0x5829da['hasOwnProperty'](_0x40af04)){if(!_0x4cefcd[_0x40af04]){delete _0x5829da[_0x40af04];}}}}function clearVoiceCallReports(_0x39a607){_0x39a607[_0xb2f5('0x26')]=0x0;_0x39a607[_0xb2f5('0x27')]=0x0;_0x39a607['sumHoldTime']=0x0;_0x39a607['sumDuration']=0x0;_0x39a607[_0xb2f5('0x28')]=0x0;}function clearCampaigns(_0x295c3a){if(!_['isEmpty'](_0x295c3a)){for(var _0x2d4ae3 in _0x295c3a){if(_0x295c3a[_0xb2f5('0x1f')](_0x2d4ae3)){_0x295c3a[_0x2d4ae3][_0xb2f5('0x29')]=0x0;_0x295c3a[_0x2d4ae3][_0xb2f5('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x53e4a1){if(!_[_0xb2f5('0x2b')](_0x53e4a1)){for(var _0x527670 in _0x53e4a1){if(_0x53e4a1[_0xb2f5('0x1f')](_0x527670)){_0x53e4a1[_0x527670][_0xb2f5('0x26')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x27')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2c')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2d')]=0x0;_0x53e4a1[_0x527670]['sumHoldTime']=0x0;_0x53e4a1[_0x527670]['sumDuration']=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x28')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2e')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2f')]=0x0;_0x53e4a1[_0x527670]['outboundBusyCallsDay']=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x30')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x31')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x32')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x33')]=0x0;_0x53e4a1[_0x527670]['outboundDropCallsDayCallersExit']=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x34')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x35')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x36')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x37')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2e')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x38')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x39')]=!![];}}}}Realtime[_0xb2f5('0x3a')][_0xb2f5('0x3b')]=function(_0x4e2511,_0x3008e7){for(var _0x1a98ca in _0x3008e7){if(_0x4e2511[_0xb2f5('0x1f')](_0x1a98ca)){_0x4e2511[_0x1a98ca]=_0x3008e7[_0x1a98ca];}}};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x3c')]=function(){var _0x13ea46=this;return function(_0x37909c){if(_0x37909c){freeIsNotKeyAgent(_0x37909c,_0x13ea46['agents']);for(var _0xcd1d3a=0x0,_0x56bbd7={},_0x4624ba={};_0xcd1d3a<_0x37909c[_0xb2f5('0x3d')];_0xcd1d3a+=0x1){_0x56bbd7=_0x37909c[_0xcd1d3a];var _0x18e73e=_[_0xb2f5('0x24')](_0x56bbd7[_0xb2f5('0x25')])?util[_0xb2f5('0x21')]('SIP/%s',_0x56bbd7[_0xb2f5('0x23')]):_0x56bbd7[_0xb2f5('0x25')];if(_[_0xb2f5('0x3e')](_0x13ea46[_0xb2f5('0x12')][_0x18e73e])){_0x13ea46[_0xb2f5('0x12')][_0x18e73e]=new Agent(_0x56bbd7);}else{_0x13ea46[_0xb2f5('0x3b')](_0x13ea46[_0xb2f5('0x12')][_0x18e73e],_0x56bbd7);}}}return _0x13ea46[_0xb2f5('0x12')];};};Realtime['prototype'][_0xb2f5('0x3f')]=function(){var _0x26e24a=this;return function(_0x101375){if(_0x101375){freeIsNotKeySip(_0x101375,_0x26e24a[_0xb2f5('0x13')]);for(var _0x4638d8=0x0,_0x466c8a={},_0x59a0cd={};_0x4638d8<_0x101375[_0xb2f5('0x3d')];_0x4638d8+=0x1){_0x466c8a=_0x101375[_0x4638d8];if(_[_0xb2f5('0x3e')](_0x26e24a['telephones'][util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x466c8a[_0xb2f5('0x23')])])){_0x26e24a['telephones'][util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x466c8a['name'])]=new Telephone(_0x466c8a);}else{_0x26e24a[_0xb2f5('0x3b')](_0x26e24a['telephones'][util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x466c8a[_0xb2f5('0x23')])],_0x466c8a);}}}return _0x26e24a['telephones'];};};Realtime[_0xb2f5('0x3a')]['initTrunks']=function(){var _0x5290fb=this;return function(_0x32471d){if(_0x32471d){freeIsNotKeySip(_0x32471d,_0x5290fb[_0xb2f5('0x14')]);for(var _0x12c71d=0x0,_0x2ae3bd={},_0x4a659e={};_0x12c71d<_0x32471d[_0xb2f5('0x3d')];_0x12c71d+=0x1){_0x2ae3bd=_0x32471d[_0x12c71d];if(_['isUndefined'](_0x5290fb['trunks'][util['format'](_0xb2f5('0x22'),_0x2ae3bd[_0xb2f5('0x23')])])){_0x5290fb['trunks'][util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x2ae3bd[_0xb2f5('0x23')])]=new Trunk(_0x2ae3bd);}else{_0x5290fb[_0xb2f5('0x3b')](_0x5290fb[_0xb2f5('0x14')][util['format'](_0xb2f5('0x22'),_0x2ae3bd[_0xb2f5('0x23')])],_0x2ae3bd);}}}return _0x5290fb['trunks'];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x40')]=function(){var _0x1c6119=this;return function(_0x3de53b){if(_0x3de53b){freeIsNotKey(_0x3de53b,_0x1c6119[_0xb2f5('0x41')],_0xb2f5('0x23'));for(var _0x3dc733=0x0,_0x53416d={},_0x4e2289={};_0x3dc733<_0x3de53b[_0xb2f5('0x3d')];_0x3dc733+=0x1){_0x53416d=_0x3de53b[_0x3dc733];if(_[_0xb2f5('0x3e')](_0x1c6119['voiceQueues'][_0x53416d['name']])){_0x1c6119[_0xb2f5('0x41')][_0x53416d[_0xb2f5('0x23')]]=new VoiceQueue(_0x53416d);}else{_0x1c6119[_0xb2f5('0x3b')](_0x1c6119['voiceQueues'][_0x53416d[_0xb2f5('0x23')]],_0x53416d);}}}return _0x1c6119[_0xb2f5('0x41')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x42')]=function(){var _0x54bce8=this;return function(_0x560678){if(_0x560678){freeIsNotKey(_0x560678,_0x54bce8['triggers'],'id');for(var _0x3b521a=0x0,_0x3df677={},_0xf28bfa={};_0x3b521a<_0x560678[_0xb2f5('0x3d')];_0x3b521a+=0x1){_0x3df677=_0x560678[_0x3b521a];if(_['isUndefined'](_0x54bce8['triggers'][_0x3df677['id']])){_0x54bce8[_0xb2f5('0x43')][_0x3df677['id']]=new Trigger(_0x3df677);}else{_0x54bce8[_0xb2f5('0x3b')](_0x54bce8[_0xb2f5('0x43')][_0x3df677['id']],_0x3df677);}}}return _0x54bce8[_0xb2f5('0x43')];};};Realtime['prototype'][_0xb2f5('0x44')]=function(){var _0x21c33b=this;return function(_0x12d512){if(_0x12d512){freeIsNotKey(_0x12d512,_0x21c33b[_0xb2f5('0x16')],'id');for(var _0x2a6d28=0x0,_0x207c9f={},_0x3fd30e={};_0x2a6d28<_0x12d512[_0xb2f5('0x3d')];_0x2a6d28+=0x1){_0x207c9f=_0x12d512[_0x2a6d28];if(_['isUndefined'](_0x21c33b[_0xb2f5('0x16')][_0x207c9f['id']])){_0x21c33b['templates'][_0x207c9f['id']]=new Template(_0x207c9f);}else{_0x21c33b[_0xb2f5('0x3b')](_0x21c33b['templates'][_0x207c9f['id']],_0x207c9f);}}}return _0x21c33b[_0xb2f5('0x16')];};};Realtime['prototype'][_0xb2f5('0x45')]=function(){var _0x53497c=this;return function(_0x571379){if(_0x571379){freeIsNotKey(_0x571379,_0x53497c[_0xb2f5('0x46')],'id');for(var _0x9a740a=0x0,_0x1bd6ee={},_0x1872aa={};_0x9a740a<_0x571379[_0xb2f5('0x3d')];_0x9a740a+=0x1){_0x1bd6ee=_0x571379[_0x9a740a];if(_[_0xb2f5('0x3e')](_0x53497c['zendeskAccounts'][_0x1bd6ee['id']])){_0x53497c[_0xb2f5('0x46')][_0x1bd6ee['id']]=new ZendeskAccount(_0x1bd6ee);}else{_0x53497c[_0xb2f5('0x3b')](_0x53497c[_0xb2f5('0x46')][_0x1bd6ee['id']],_0x1bd6ee);}}}return _0x53497c[_0xb2f5('0x46')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x47')]=function(){var _0x239197=this;return function(_0x299398){if(_0x299398){freeIsNotKey(_0x299398,_0x239197[_0xb2f5('0x48')],'id');for(var _0x3deb36=0x0,_0xe82db5={},_0x40c9ec={};_0x3deb36<_0x299398[_0xb2f5('0x3d')];_0x3deb36+=0x1){_0xe82db5=_0x299398[_0x3deb36];if(_[_0xb2f5('0x3e')](_0x239197[_0xb2f5('0x48')][_0xe82db5['id']])){_0x239197[_0xb2f5('0x48')][_0xe82db5['id']]=new SalesforceAccount(_0xe82db5);}else{_0x239197[_0xb2f5('0x3b')](_0x239197[_0xb2f5('0x48')][_0xe82db5['id']],_0xe82db5);}}}return _0x239197[_0xb2f5('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x4c8dc6=this;return function(_0x4b1f52){if(_0x4b1f52){freeIsNotKey(_0x4b1f52,_0x4c8dc6[_0xb2f5('0x49')],'id');for(var _0x5946e1=0x0,_0x4400d0={},_0x5d53c4={};_0x5946e1<_0x4b1f52[_0xb2f5('0x3d')];_0x5946e1+=0x1){_0x4400d0=_0x4b1f52[_0x5946e1];if(_[_0xb2f5('0x3e')](_0x4c8dc6[_0xb2f5('0x49')][_0x4400d0['id']])){_0x4c8dc6[_0xb2f5('0x49')][_0x4400d0['id']]=new FreshdeskAccount(_0x4400d0);}else{_0x4c8dc6[_0xb2f5('0x3b')](_0x4c8dc6[_0xb2f5('0x49')][_0x4400d0['id']],_0x4400d0);}}}return _0x4c8dc6[_0xb2f5('0x49')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x4a')]=function(){var _0x4bfaef=this;return function(_0x352054){if(_0x352054){freeIsNotKey(_0x352054,_0x4bfaef[_0xb2f5('0x4b')],'id');for(var _0x4d0efc=0x0,_0x157a76={},_0x32fe17={};_0x4d0efc<_0x352054[_0xb2f5('0x3d')];_0x4d0efc+=0x1){_0x157a76=_0x352054[_0x4d0efc];if(_[_0xb2f5('0x3e')](_0x4bfaef[_0xb2f5('0x4b')][_0x157a76['id']])){_0x4bfaef[_0xb2f5('0x4b')][_0x157a76['id']]=new ZohoAccount(_0x157a76);}else{_0x4bfaef[_0xb2f5('0x3b')](_0x4bfaef[_0xb2f5('0x4b')][_0x157a76['id']],_0x157a76);}}}return _0x4bfaef[_0xb2f5('0x4b')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x4c')]=function(){var _0x49155d=this;return function(_0x524d76){if(_0x524d76){freeIsNotKey(_0x524d76,_0x49155d[_0xb2f5('0x4d')],'id');for(var _0x48cc5c=0x0,_0x32b045={},_0x322151={};_0x48cc5c<_0x524d76[_0xb2f5('0x3d')];_0x48cc5c+=0x1){_0x32b045=_0x524d76[_0x48cc5c];if(_['isUndefined'](_0x49155d['deskAccounts'][_0x32b045['id']])){_0x49155d[_0xb2f5('0x4d')][_0x32b045['id']]=new DeskAccount(_0x32b045);}else{_0x49155d['mergeFromDatabase'](_0x49155d[_0xb2f5('0x4d')][_0x32b045['id']],_0x32b045);}}}return _0x49155d[_0xb2f5('0x4d')];};};Realtime[_0xb2f5('0x3a')]['initSugarcrmAccounts']=function(){var _0x24ddb9=this;return function(_0x4ba2ae){if(_0x4ba2ae){freeIsNotKey(_0x4ba2ae,_0x24ddb9[_0xb2f5('0x1b')],'id');for(var _0x480957=0x0,_0xde6bb8={},_0x4bdaee={};_0x480957<_0x4ba2ae[_0xb2f5('0x3d')];_0x480957+=0x1){_0xde6bb8=_0x4ba2ae[_0x480957];if(_[_0xb2f5('0x3e')](_0x24ddb9[_0xb2f5('0x1b')][_0xde6bb8['id']])){_0x24ddb9['sugarcrmAccounts'][_0xde6bb8['id']]=new SugarcrmAccount(_0xde6bb8);}else{_0x24ddb9[_0xb2f5('0x3b')](_0x24ddb9[_0xb2f5('0x1b')][_0xde6bb8['id']],_0xde6bb8);}}}return _0x24ddb9[_0xb2f5('0x1b')];};};Realtime['prototype'][_0xb2f5('0x4e')]=function(){var _0xc54b41=this;return function(_0x57ec40){if(_0x57ec40){freeIsNotKey(_0x57ec40,_0xc54b41[_0xb2f5('0x1c')],'id');for(var _0x31984a=0x0,_0x31054e={},_0x1dbb83={};_0x31984a<_0x57ec40[_0xb2f5('0x3d')];_0x31984a+=0x1){_0x31054e=_0x57ec40[_0x31984a];if(_[_0xb2f5('0x3e')](_0xc54b41[_0xb2f5('0x1c')][_0x31054e['id']])){_0xc54b41[_0xb2f5('0x1c')][_0x31054e['id']]=new VtigerAccount(_0x31054e);}else{_0xc54b41[_0xb2f5('0x3b')](_0xc54b41['vtigerAccounts'][_0x31054e['id']],_0x31054e);}}}return _0xc54b41[_0xb2f5('0x1c')];};};Realtime[_0xb2f5('0x3a')]['initServicenowAccounts']=function(){var _0x1cb5e5=this;return function(_0x117760){if(_0x117760){freeIsNotKey(_0x117760,_0x1cb5e5[_0xb2f5('0x1d')],'id');for(var _0x21cb87=0x0,_0x5b9c0f={},_0x4ad35f={};_0x21cb87<_0x117760[_0xb2f5('0x3d')];_0x21cb87+=0x1){_0x5b9c0f=_0x117760[_0x21cb87];if(_[_0xb2f5('0x3e')](_0x1cb5e5[_0xb2f5('0x1d')][_0x5b9c0f['id']])){_0x1cb5e5[_0xb2f5('0x1d')][_0x5b9c0f['id']]=new ServicenowAccount(_0x5b9c0f);}else{_0x1cb5e5[_0xb2f5('0x3b')](_0x1cb5e5[_0xb2f5('0x1d')][_0x5b9c0f['id']],_0x5b9c0f);}}}return _0x1cb5e5[_0xb2f5('0x1d')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x4f')]=function(){var _0x12d483=this;return function(_0x36961a){if(_0x36961a){freeIsNotKey(_0x36961a,_0x12d483[_0xb2f5('0x50')],'id');for(var _0x5caf8d=0x0,_0x5b8ff9={},_0x300ead={};_0x5caf8d<_0x36961a[_0xb2f5('0x3d')];_0x5caf8d+=0x1){_0x5b8ff9=_0x36961a[_0x5caf8d];if(_[_0xb2f5('0x3e')](_0x12d483['dynamics365Accounts'][_0x5b8ff9['id']])){_0x12d483[_0xb2f5('0x50')][_0x5b8ff9['id']]=new Dynamics365Account(_0x5b8ff9);}else{_0x12d483[_0xb2f5('0x3b')](_0x12d483['dynamics365Accounts'][_0x5b8ff9['id']],_0x5b8ff9);}}}return _0x12d483['dynamics365Accounts'];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x51')]=function(){var _0xe570=this;return function(_0x29da18){if(_0x29da18){freeIsNotKey(_0x29da18,_0xe570['freshsalesAccounts'],'id');for(var _0x3ec2df=0x0,_0x71eead={},_0xbcfbb8={};_0x3ec2df<_0x29da18[_0xb2f5('0x3d')];_0x3ec2df+=0x1){_0x71eead=_0x29da18[_0x3ec2df];if(_['isUndefined'](_0xe570[_0xb2f5('0x1e')][_0x71eead['id']])){_0xe570[_0xb2f5('0x1e')][_0x71eead['id']]=new FreshsalesAccount(_0x71eead);}else{_0xe570[_0xb2f5('0x3b')](_0xe570[_0xb2f5('0x1e')][_0x71eead['id']],_0x71eead);}}}return _0xe570[_0xb2f5('0x1e')];};};Realtime['prototype'][_0xb2f5('0x52')]=function(){var _0x3dba11=this;return function(_0x3bd32e){for(var _0x11af28=0x0;_0x11af28<_0x3bd32e[_0xb2f5('0x3d')];_0x11af28+=0x1){_[_0xb2f5('0x53')](_0x3dba11['voiceQueues'][_0x3bd32e[_0x11af28][_0xb2f5('0x23')]],_0x3bd32e[_0x11af28]);}return _0x3dba11['voiceQueues'];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x54')]=function(){var _0x1eea6e=this;return function(_0x446858){clearVoiceQueues(_0x1eea6e[_0xb2f5('0x41')]);if(_0x446858){_0x446858=_[_0xb2f5('0x55')](_0x446858,'uniqueid');for(var _0x226e4d in _0x446858){if(_0x446858[_0xb2f5('0x1f')](_0x226e4d)){var _0x36b22a={};for(var _0x438b08=0x0;_0x438b08<_0x446858[_0x226e4d][_0xb2f5('0x3d')];_0x438b08+=0x1){var _0x541869=_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x56')];if(_0x1eea6e['voiceQueues'][_0x541869]){if(_0x446858[_0x226e4d][_0x438b08]['queuecallerexit']){_0x1eea6e['voiceQueues'][_0x541869][_0xb2f5('0x2c')]+=0x1;}if(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x57')]){_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x2d')]+=0x1;}_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x58')]+=moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x59')])[_0xb2f5('0x5a')](moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5b')]),'seconds')||0x0;if(_0x438b08===_0x446858[_0x226e4d][_0xb2f5('0x3d')]-0x1){_0x1eea6e['voiceQueues'][_0x541869]['sumDuration']+=moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5c')]||_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5d')]||_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5e')])[_0xb2f5('0x5a')](moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5b')]),_0xb2f5('0x5f'))||0x0;_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x26')]+=0x1;if(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x60')]){_0x1eea6e['voiceQueues'][_0x541869][_0xb2f5('0x27')]+=0x1;_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x28')]+=moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5c')])[_0xb2f5('0x5a')](moment(_0x446858[_0x226e4d][_0x438b08]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x1eea6e['voiceQueues'][_0x541869][_0xb2f5('0x61')]+=_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x58')]||0x0;}}}}}}return _0x1eea6e[_0xb2f5('0x41')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x62')]=function(){var _0x5a4e31=this;return function(_0x41a0ac){clearVoiceCallReports(_0x5a4e31[_0xb2f5('0x63')]);if(_0x41a0ac){for(var _0x10fa58=0x0;_0x10fa58<_0x41a0ac[_0xb2f5('0x3d')];_0x10fa58+=0x1){_0x5a4e31['outbound'][_0xb2f5('0x26')]+=0x1;_0x5a4e31[_0xb2f5('0x63')]['sumDuration']+=_0x41a0ac[_0x10fa58][_0xb2f5('0x64')];if(_0x41a0ac[_0x10fa58][_0xb2f5('0x65')]==='ANSWERED'){_0x5a4e31['outbound']['answered']+=0x1;_0x5a4e31[_0xb2f5('0x63')][_0xb2f5('0x58')]+=_0x41a0ac[_0x10fa58][_0xb2f5('0x64')]-_0x41a0ac[_0x10fa58][_0xb2f5('0x66')]||0x0;_0x5a4e31['outbound']['sumBillable']+=_0x41a0ac[_0x10fa58][_0xb2f5('0x66')];}}}return _0x5a4e31[_0xb2f5('0x63')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x67')]=function(){var _0x4aed5c=this;return function(_0x18e367){if(_0x18e367){freeIsNotKey(_0x18e367,_0x4aed5c[_0xb2f5('0x15')],_0xb2f5('0x23'));for(var _0x116728=0x0,_0x396d4b={};_0x116728<_0x18e367[_0xb2f5('0x3d')];_0x116728+=0x1){_0x396d4b=_0x18e367[_0x116728];if(_[_0xb2f5('0x3e')](_0x4aed5c[_0xb2f5('0x15')][_0x396d4b[_0xb2f5('0x23')]])){_0x4aed5c['campaigns'][_0x396d4b[_0xb2f5('0x23')]]=new Campaign(_0x396d4b);}else{_0x4aed5c[_0xb2f5('0x3b')](_0x4aed5c[_0xb2f5('0x15')][_0x396d4b['name']],_0x396d4b);_0x4aed5c[_0xb2f5('0x15')][_0x396d4b[_0xb2f5('0x23')]][_0xb2f5('0x68')]=_0x396d4b[_0xb2f5('0x69')]?_0x396d4b[_0xb2f5('0x69')][_0xb2f5('0x23')]:undefined;}}}return _0x4aed5c[_0xb2f5('0x15')];};};Realtime['prototype'][_0xb2f5('0x6a')]=function(){var _0x5e1f7c=this;return function(_0x547971){if(_0x547971){freeIsNotKey(_0x547971,_0x5e1f7c[_0xb2f5('0x17')],'id');for(var _0x567d71=0x0,_0x4765a0={};_0x567d71<_0x547971[_0xb2f5('0x3d')];_0x567d71+=0x1){_0x4765a0=_0x547971[_0x567d71];if(_[_0xb2f5('0x3e')](_0x5e1f7c['voiceExtensions'][_0x4765a0['id']])){_0x5e1f7c[_0xb2f5('0x17')][_0x4765a0['id']]=new VoiceExtension(_0x4765a0);}else{_0x5e1f7c[_0xb2f5('0x3b')](_0x5e1f7c[_0xb2f5('0x17')][_0x4765a0['id']],_0x4765a0);}}}return _0x5e1f7c[_0xb2f5('0x17')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x6b')]=function(){var _0x32717a=this;return function(_0x539b19){clearCampaigns(_0x32717a[_0xb2f5('0x15')]);for(var _0x6a2137=0x0;_0x6a2137<_0x539b19['length'];_0x6a2137+=0x1){_['merge'](_0x32717a[_0xb2f5('0x15')][_0x539b19[_0x6a2137][_0xb2f5('0x23')]],_0x539b19[_0x6a2137]);}return _0x32717a[_0xb2f5('0x15')];};};Realtime['prototype'][_0xb2f5('0x6c')]=function(){var _0x5d4acd=this;return function(_0x5e43d3){if(_0x5e43d3){freeIsNotKey(_0x5e43d3,_0x5d4acd[_0xb2f5('0x6d')],'id');for(var _0x412746=0x0,_0x3515c3={},_0x2f34cf={};_0x412746<_0x5e43d3[_0xb2f5('0x3d')];_0x412746+=0x1){_0x3515c3=_0x5e43d3[_0x412746];if(_[_0xb2f5('0x3e')](_0x5d4acd['faxAccounts'][_0x3515c3['id']])){_0x5d4acd[_0xb2f5('0x6d')][_0x3515c3['id']]=new FaxAccount(_0x3515c3);}else{_0x5d4acd[_0xb2f5('0x3b')](_0x5d4acd['faxAccounts'][_0x3515c3['id']],_0x3515c3);}}}return _0x5d4acd[_0xb2f5('0x6d')];};};module['exports']=Realtime; \ No newline at end of file +var _0x203e=['dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','triggers','outbound','voiceExtensions','queueChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTrunks','trunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','duration','disposition','billableseconds','campaigns'];(function(_0x8398a9,_0x510eef){var _0x175a1e=function(_0x187466){while(--_0x187466){_0x8398a9['push'](_0x8398a9['shift']());}};_0x175a1e(++_0x510eef);}(_0x203e,0x147));var _0xe203=function(_0x555877,_0x2e6ed){_0x555877=_0x555877-0x0;var _0x5a3b78=_0x203e[_0x555877];return _0x5a3b78;};'use strict';var BPromise=require(_0xe203('0x0'));var util=require(_0xe203('0x1'));var _=require(_0xe203('0x2'));var moment=require(_0xe203('0x3'));var Agent=require(_0xe203('0x4'));var Telephone=require(_0xe203('0x5'));var Trunk=require(_0xe203('0x6'));var VoiceQueue=require(_0xe203('0x7'));var Trigger=require(_0xe203('0x8'));var Template=require(_0xe203('0x9'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xe203('0xa'));var ZendeskAccount=require(_0xe203('0xb'));var SalesforceAccount=require(_0xe203('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xe203('0xd'));var ZohoAccount=require(_0xe203('0xe'));var DeskAccount=require(_0xe203('0xf'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xe203('0x10'));var Dynamics365Account=require(_0xe203('0x11'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xe203('0x12'));var Realtime=function(){this[_0xe203('0x13')]={};this[_0xe203('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0xe203('0x15')]={};this['campaigns']={};this['templates']={};this[_0xe203('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe203('0x17')]={};this['channels']={};this[_0xe203('0x18')]={};this['outboundChannels']={};this['timers']={};this[_0xe203('0x19')]={};this[_0xe203('0x1a')]={};this[_0xe203('0x1b')]={};this['sugarcrmAccounts']={};this[_0xe203('0x1c')]={};this[_0xe203('0x1d')]={};this['deskAccounts']={};this[_0xe203('0x1e')]={};this[_0xe203('0x1f')]={};this[_0xe203('0x20')]={};this[_0xe203('0x21')]={};this['faxAccounts']={};};function freeIsNotKey(_0x336394,_0x166132,_0x50491b){var _0x3096a1=_[_0xe203('0x22')](_0x336394,function(_0x5a4219,_0x3901c9){return _0x5a4219[_0x50491b];});for(var _0x3f08c1 in _0x166132){if(_0x166132['hasOwnProperty'](_0x3f08c1)){if(!_0x3096a1[_0x3f08c1]){delete _0x166132[_0x3f08c1];}}}}function freeIsNotKeySip(_0x5ecbe4,_0x5359a6){var _0x2adb78=_[_0xe203('0x22')](_0x5ecbe4,function(_0x3bb0a3,_0x5698a0){return util[_0xe203('0x23')](_0xe203('0x24'),_0x3bb0a3['name']);});for(var _0x2d87b4 in _0x5359a6){if(_0x5359a6['hasOwnProperty'](_0x2d87b4)){if(!_0x2adb78[_0x2d87b4]){delete _0x5359a6[_0x2d87b4];}}}}function freeIsNotKeyAgent(_0xccb973,_0x7feece){var _0x261be7=_[_0xe203('0x22')](_0xccb973,function(_0x787797,_0x3c3ee5){var _0x4a12f0=_[_0xe203('0x25')](_0x787797[_0xe203('0x26')])?util[_0xe203('0x23')](_0xe203('0x24'),_0x787797[_0xe203('0x27')]):_0x787797[_0xe203('0x26')];return _0x4a12f0;});for(var _0x23d2a6 in _0x7feece){if(_0x7feece[_0xe203('0x28')](_0x23d2a6)){if(!_0x261be7[_0x23d2a6]){delete _0x7feece[_0x23d2a6];}}}}function clearVoiceCallReports(_0x46e336){_0x46e336['total']=0x0;_0x46e336[_0xe203('0x29')]=0x0;_0x46e336[_0xe203('0x2a')]=0x0;_0x46e336[_0xe203('0x2b')]=0x0;_0x46e336[_0xe203('0x2c')]=0x0;}function clearCampaigns(_0x4dc297){if(!_[_0xe203('0x2d')](_0x4dc297)){for(var _0x33b6d9 in _0x4dc297){if(_0x4dc297[_0xe203('0x28')](_0x33b6d9)){_0x4dc297[_0x33b6d9][_0xe203('0x2e')]=0x0;_0x4dc297[_0x33b6d9][_0xe203('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x425796){if(!_[_0xe203('0x2d')](_0x425796)){for(var _0x1c7096 in _0x425796){if(_0x425796[_0xe203('0x28')](_0x1c7096)){_0x425796[_0x1c7096][_0xe203('0x30')]=0x0;_0x425796[_0x1c7096]['answered']=0x0;_0x425796[_0x1c7096][_0xe203('0x31')]=0x0;_0x425796[_0x1c7096][_0xe203('0x32')]=0x0;_0x425796[_0x1c7096][_0xe203('0x2a')]=0x0;_0x425796[_0x1c7096][_0xe203('0x2b')]=0x0;_0x425796[_0x1c7096][_0xe203('0x2c')]=0x0;_0x425796[_0x1c7096][_0xe203('0x33')]=0x0;_0x425796[_0x1c7096][_0xe203('0x34')]=0x0;_0x425796[_0x1c7096][_0xe203('0x35')]=0x0;_0x425796[_0x1c7096][_0xe203('0x36')]=0x0;_0x425796[_0x1c7096]['outboundNoSuchCallsDay']=0x0;_0x425796[_0x1c7096][_0xe203('0x37')]=0x0;_0x425796[_0x1c7096][_0xe203('0x38')]=0x0;_0x425796[_0x1c7096]['outboundDropCallsDayCallersExit']=0x0;_0x425796[_0x1c7096][_0xe203('0x39')]=0x0;_0x425796[_0x1c7096][_0xe203('0x3a')]=0x0;_0x425796[_0x1c7096]['outboundRejectCallsDay']=0x0;_0x425796[_0x1c7096][_0xe203('0x3b')]=0x0;_0x425796[_0x1c7096][_0xe203('0x33')]=0x0;_0x425796[_0x1c7096][_0xe203('0x3c')]=0x0;_0x425796[_0x1c7096][_0xe203('0x3d')]=!![];}}}}Realtime[_0xe203('0x3e')][_0xe203('0x3f')]=function(_0x2427ae,_0x27efd9){for(var _0x10788f in _0x27efd9){if(_0x2427ae[_0xe203('0x28')](_0x10788f)){_0x2427ae[_0x10788f]=_0x27efd9[_0x10788f];}}};Realtime[_0xe203('0x3e')]['initAgents']=function(){var _0x4ecb7f=this;return function(_0x28e686){if(_0x28e686){freeIsNotKeyAgent(_0x28e686,_0x4ecb7f[_0xe203('0x13')]);for(var _0x5117f6=0x0,_0x3dc665={},_0x2261ee={};_0x5117f6<_0x28e686[_0xe203('0x40')];_0x5117f6+=0x1){_0x3dc665=_0x28e686[_0x5117f6];var _0x566e3f=_[_0xe203('0x25')](_0x3dc665[_0xe203('0x26')])?util[_0xe203('0x23')](_0xe203('0x24'),_0x3dc665[_0xe203('0x27')]):_0x3dc665[_0xe203('0x26')];if(_['isUndefined'](_0x4ecb7f['agents'][_0x566e3f])){_0x4ecb7f[_0xe203('0x13')][_0x566e3f]=new Agent(_0x3dc665);}else{_0x4ecb7f[_0xe203('0x3f')](_0x4ecb7f['agents'][_0x566e3f],_0x3dc665);}}}return _0x4ecb7f[_0xe203('0x13')];};};Realtime[_0xe203('0x3e')]['initTelephones']=function(){var _0x33a4d9=this;return function(_0x3e3d2c){if(_0x3e3d2c){freeIsNotKeySip(_0x3e3d2c,_0x33a4d9[_0xe203('0x14')]);for(var _0xa2b6da=0x0,_0x4e7f7e={},_0x3a2157={};_0xa2b6da<_0x3e3d2c['length'];_0xa2b6da+=0x1){_0x4e7f7e=_0x3e3d2c[_0xa2b6da];if(_[_0xe203('0x41')](_0x33a4d9[_0xe203('0x14')][util[_0xe203('0x23')]('SIP/%s',_0x4e7f7e[_0xe203('0x27')])])){_0x33a4d9[_0xe203('0x14')][util[_0xe203('0x23')](_0xe203('0x24'),_0x4e7f7e[_0xe203('0x27')])]=new Telephone(_0x4e7f7e);}else{_0x33a4d9['mergeFromDatabase'](_0x33a4d9[_0xe203('0x14')][util[_0xe203('0x23')](_0xe203('0x24'),_0x4e7f7e[_0xe203('0x27')])],_0x4e7f7e);}}}return _0x33a4d9[_0xe203('0x14')];};};Realtime['prototype'][_0xe203('0x42')]=function(){var _0x1387c2=this;return function(_0x330134){if(_0x330134){freeIsNotKeySip(_0x330134,_0x1387c2[_0xe203('0x43')]);for(var _0x493759=0x0,_0x2f000e={},_0x5a6884={};_0x493759<_0x330134[_0xe203('0x40')];_0x493759+=0x1){_0x2f000e=_0x330134[_0x493759];if(_[_0xe203('0x41')](_0x1387c2['trunks'][util[_0xe203('0x23')]('SIP/%s',_0x2f000e['name'])])){_0x1387c2[_0xe203('0x43')][util[_0xe203('0x23')](_0xe203('0x24'),_0x2f000e[_0xe203('0x27')])]=new Trunk(_0x2f000e);}else{_0x1387c2['mergeFromDatabase'](_0x1387c2[_0xe203('0x43')][util[_0xe203('0x23')](_0xe203('0x24'),_0x2f000e[_0xe203('0x27')])],_0x2f000e);}}}return _0x1387c2[_0xe203('0x43')];};};Realtime[_0xe203('0x3e')][_0xe203('0x44')]=function(){var _0x2a15a5=this;return function(_0xbf2929){if(_0xbf2929){freeIsNotKey(_0xbf2929,_0x2a15a5[_0xe203('0x45')],'name');for(var _0x3038df=0x0,_0x19ffcc={},_0x393d6c={};_0x3038df<_0xbf2929[_0xe203('0x40')];_0x3038df+=0x1){_0x19ffcc=_0xbf2929[_0x3038df];if(_[_0xe203('0x41')](_0x2a15a5['voiceQueues'][_0x19ffcc[_0xe203('0x27')]])){_0x2a15a5[_0xe203('0x45')][_0x19ffcc['name']]=new VoiceQueue(_0x19ffcc);}else{_0x2a15a5[_0xe203('0x3f')](_0x2a15a5[_0xe203('0x45')][_0x19ffcc[_0xe203('0x27')]],_0x19ffcc);}}}return _0x2a15a5[_0xe203('0x45')];};};Realtime['prototype'][_0xe203('0x46')]=function(){var _0x116c53=this;return function(_0x23b37b){if(_0x23b37b){freeIsNotKey(_0x23b37b,_0x116c53[_0xe203('0x15')],'id');for(var _0x364ab9=0x0,_0x31ad85={},_0x2133a2={};_0x364ab9<_0x23b37b[_0xe203('0x40')];_0x364ab9+=0x1){_0x31ad85=_0x23b37b[_0x364ab9];if(_[_0xe203('0x41')](_0x116c53['triggers'][_0x31ad85['id']])){_0x116c53[_0xe203('0x15')][_0x31ad85['id']]=new Trigger(_0x31ad85);}else{_0x116c53[_0xe203('0x3f')](_0x116c53[_0xe203('0x15')][_0x31ad85['id']],_0x31ad85);}}}return _0x116c53['triggers'];};};Realtime[_0xe203('0x3e')][_0xe203('0x47')]=function(){var _0x57985f=this;return function(_0x1ef43e){if(_0x1ef43e){freeIsNotKey(_0x1ef43e,_0x57985f['templates'],'id');for(var _0xc0bbf1=0x0,_0x4be09d={},_0x300efc={};_0xc0bbf1<_0x1ef43e[_0xe203('0x40')];_0xc0bbf1+=0x1){_0x4be09d=_0x1ef43e[_0xc0bbf1];if(_[_0xe203('0x41')](_0x57985f[_0xe203('0x48')][_0x4be09d['id']])){_0x57985f[_0xe203('0x48')][_0x4be09d['id']]=new Template(_0x4be09d);}else{_0x57985f['mergeFromDatabase'](_0x57985f[_0xe203('0x48')][_0x4be09d['id']],_0x4be09d);}}}return _0x57985f[_0xe203('0x48')];};};Realtime[_0xe203('0x3e')][_0xe203('0x49')]=function(){var _0x4a5666=this;return function(_0xbd8954){if(_0xbd8954){freeIsNotKey(_0xbd8954,_0x4a5666[_0xe203('0x1a')],'id');for(var _0x1fc13c=0x0,_0x4c3271={},_0x381ad5={};_0x1fc13c<_0xbd8954['length'];_0x1fc13c+=0x1){_0x4c3271=_0xbd8954[_0x1fc13c];if(_[_0xe203('0x41')](_0x4a5666['zendeskAccounts'][_0x4c3271['id']])){_0x4a5666[_0xe203('0x1a')][_0x4c3271['id']]=new ZendeskAccount(_0x4c3271);}else{_0x4a5666['mergeFromDatabase'](_0x4a5666[_0xe203('0x1a')][_0x4c3271['id']],_0x4c3271);}}}return _0x4a5666[_0xe203('0x1a')];};};Realtime['prototype'][_0xe203('0x4a')]=function(){var _0x375106=this;return function(_0x366983){if(_0x366983){freeIsNotKey(_0x366983,_0x375106[_0xe203('0x1b')],'id');for(var _0x28421e=0x0,_0x4b004f={},_0x34dc1f={};_0x28421e<_0x366983[_0xe203('0x40')];_0x28421e+=0x1){_0x4b004f=_0x366983[_0x28421e];if(_[_0xe203('0x41')](_0x375106['salesforceAccounts'][_0x4b004f['id']])){_0x375106[_0xe203('0x1b')][_0x4b004f['id']]=new SalesforceAccount(_0x4b004f);}else{_0x375106['mergeFromDatabase'](_0x375106[_0xe203('0x1b')][_0x4b004f['id']],_0x4b004f);}}}return _0x375106[_0xe203('0x1b')];};};Realtime[_0xe203('0x3e')]['initFreshdeskAccounts']=function(){var _0x4d2334=this;return function(_0x5e4a30){if(_0x5e4a30){freeIsNotKey(_0x5e4a30,_0x4d2334[_0xe203('0x1c')],'id');for(var _0x12c6e3=0x0,_0x5a7d72={},_0x16b66c={};_0x12c6e3<_0x5e4a30['length'];_0x12c6e3+=0x1){_0x5a7d72=_0x5e4a30[_0x12c6e3];if(_[_0xe203('0x41')](_0x4d2334[_0xe203('0x1c')][_0x5a7d72['id']])){_0x4d2334[_0xe203('0x1c')][_0x5a7d72['id']]=new FreshdeskAccount(_0x5a7d72);}else{_0x4d2334[_0xe203('0x3f')](_0x4d2334[_0xe203('0x1c')][_0x5a7d72['id']],_0x5a7d72);}}}return _0x4d2334['freshdeskAccounts'];};};Realtime[_0xe203('0x3e')]['initZohoAccounts']=function(){var _0x21f0aa=this;return function(_0x3f4d8d){if(_0x3f4d8d){freeIsNotKey(_0x3f4d8d,_0x21f0aa[_0xe203('0x1d')],'id');for(var _0x278bbf=0x0,_0x2efe56={},_0x59e062={};_0x278bbf<_0x3f4d8d[_0xe203('0x40')];_0x278bbf+=0x1){_0x2efe56=_0x3f4d8d[_0x278bbf];if(_[_0xe203('0x41')](_0x21f0aa[_0xe203('0x1d')][_0x2efe56['id']])){_0x21f0aa[_0xe203('0x1d')][_0x2efe56['id']]=new ZohoAccount(_0x2efe56);}else{_0x21f0aa[_0xe203('0x3f')](_0x21f0aa[_0xe203('0x1d')][_0x2efe56['id']],_0x2efe56);}}}return _0x21f0aa[_0xe203('0x1d')];};};Realtime[_0xe203('0x3e')][_0xe203('0x4b')]=function(){var _0x45ac40=this;return function(_0x4673cf){if(_0x4673cf){freeIsNotKey(_0x4673cf,_0x45ac40[_0xe203('0x4c')],'id');for(var _0x149d89=0x0,_0x2703d3={},_0x91556f={};_0x149d89<_0x4673cf[_0xe203('0x40')];_0x149d89+=0x1){_0x2703d3=_0x4673cf[_0x149d89];if(_['isUndefined'](_0x45ac40[_0xe203('0x4c')][_0x2703d3['id']])){_0x45ac40[_0xe203('0x4c')][_0x2703d3['id']]=new DeskAccount(_0x2703d3);}else{_0x45ac40[_0xe203('0x3f')](_0x45ac40[_0xe203('0x4c')][_0x2703d3['id']],_0x2703d3);}}}return _0x45ac40['deskAccounts'];};};Realtime['prototype'][_0xe203('0x4d')]=function(){var _0x4f966=this;return function(_0x4ebd09){if(_0x4ebd09){freeIsNotKey(_0x4ebd09,_0x4f966[_0xe203('0x4e')],'id');for(var _0x750c47=0x0,_0x5bc717={},_0x1f2bf8={};_0x750c47<_0x4ebd09[_0xe203('0x40')];_0x750c47+=0x1){_0x5bc717=_0x4ebd09[_0x750c47];if(_[_0xe203('0x41')](_0x4f966[_0xe203('0x4e')][_0x5bc717['id']])){_0x4f966[_0xe203('0x4e')][_0x5bc717['id']]=new SugarcrmAccount(_0x5bc717);}else{_0x4f966[_0xe203('0x3f')](_0x4f966[_0xe203('0x4e')][_0x5bc717['id']],_0x5bc717);}}}return _0x4f966[_0xe203('0x4e')];};};Realtime[_0xe203('0x3e')][_0xe203('0x4f')]=function(){var _0x2143ed=this;return function(_0x441726){if(_0x441726){freeIsNotKey(_0x441726,_0x2143ed[_0xe203('0x1e')],'id');for(var _0x541e9c=0x0,_0x508129={},_0x480548={};_0x541e9c<_0x441726['length'];_0x541e9c+=0x1){_0x508129=_0x441726[_0x541e9c];if(_['isUndefined'](_0x2143ed[_0xe203('0x1e')][_0x508129['id']])){_0x2143ed[_0xe203('0x1e')][_0x508129['id']]=new VtigerAccount(_0x508129);}else{_0x2143ed[_0xe203('0x3f')](_0x2143ed[_0xe203('0x1e')][_0x508129['id']],_0x508129);}}}return _0x2143ed[_0xe203('0x1e')];};};Realtime[_0xe203('0x3e')][_0xe203('0x50')]=function(){var _0x18be2b=this;return function(_0x5d0fdc){if(_0x5d0fdc){freeIsNotKey(_0x5d0fdc,_0x18be2b[_0xe203('0x1f')],'id');for(var _0x2efa38=0x0,_0x3c663c={},_0x432273={};_0x2efa38<_0x5d0fdc[_0xe203('0x40')];_0x2efa38+=0x1){_0x3c663c=_0x5d0fdc[_0x2efa38];if(_[_0xe203('0x41')](_0x18be2b[_0xe203('0x1f')][_0x3c663c['id']])){_0x18be2b[_0xe203('0x1f')][_0x3c663c['id']]=new ServicenowAccount(_0x3c663c);}else{_0x18be2b['mergeFromDatabase'](_0x18be2b['servicenowAccounts'][_0x3c663c['id']],_0x3c663c);}}}return _0x18be2b[_0xe203('0x1f')];};};Realtime[_0xe203('0x3e')][_0xe203('0x51')]=function(){var _0x590f0e=this;return function(_0x491c24){if(_0x491c24){freeIsNotKey(_0x491c24,_0x590f0e[_0xe203('0x20')],'id');for(var _0x560bda=0x0,_0x3cfdca={},_0x474492={};_0x560bda<_0x491c24[_0xe203('0x40')];_0x560bda+=0x1){_0x3cfdca=_0x491c24[_0x560bda];if(_[_0xe203('0x41')](_0x590f0e['dynamics365Accounts'][_0x3cfdca['id']])){_0x590f0e['dynamics365Accounts'][_0x3cfdca['id']]=new Dynamics365Account(_0x3cfdca);}else{_0x590f0e[_0xe203('0x3f')](_0x590f0e[_0xe203('0x20')][_0x3cfdca['id']],_0x3cfdca);}}}return _0x590f0e['dynamics365Accounts'];};};Realtime[_0xe203('0x3e')][_0xe203('0x52')]=function(){var _0x3f785c=this;return function(_0x2827b3){if(_0x2827b3){freeIsNotKey(_0x2827b3,_0x3f785c[_0xe203('0x21')],'id');for(var _0x5750d4=0x0,_0x3cce54={},_0x430c2b={};_0x5750d4<_0x2827b3[_0xe203('0x40')];_0x5750d4+=0x1){_0x3cce54=_0x2827b3[_0x5750d4];if(_['isUndefined'](_0x3f785c[_0xe203('0x21')][_0x3cce54['id']])){_0x3f785c[_0xe203('0x21')][_0x3cce54['id']]=new FreshsalesAccount(_0x3cce54);}else{_0x3f785c['mergeFromDatabase'](_0x3f785c['freshsalesAccounts'][_0x3cce54['id']],_0x3cce54);}}}return _0x3f785c[_0xe203('0x21')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x2ff4ca=this;return function(_0x47c24c){for(var _0xf2cb0e=0x0;_0xf2cb0e<_0x47c24c[_0xe203('0x40')];_0xf2cb0e+=0x1){_[_0xe203('0x53')](_0x2ff4ca[_0xe203('0x45')][_0x47c24c[_0xf2cb0e]['name']],_0x47c24c[_0xf2cb0e]);}return _0x2ff4ca[_0xe203('0x45')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x16227a=this;return function(_0x2e2edf){clearVoiceQueues(_0x16227a[_0xe203('0x45')]);if(_0x2e2edf){_0x2e2edf=_[_0xe203('0x54')](_0x2e2edf,_0xe203('0x55'));for(var _0x2b55fc in _0x2e2edf){if(_0x2e2edf['hasOwnProperty'](_0x2b55fc)){var _0xe2a221={};for(var _0x193d96=0x0;_0x193d96<_0x2e2edf[_0x2b55fc]['length'];_0x193d96+=0x1){var _0x5ba8b9=_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x56')];if(_0x16227a['voiceQueues'][_0x5ba8b9]){if(_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x57')]){_0x16227a[_0xe203('0x45')][_0x5ba8b9][_0xe203('0x31')]+=0x1;}if(_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x58')]){_0x16227a[_0xe203('0x45')][_0x5ba8b9][_0xe203('0x32')]+=0x1;}_0x16227a[_0xe203('0x45')][_0x5ba8b9][_0xe203('0x2a')]+=moment(_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x59')])[_0xe203('0x5a')](moment(_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x5b')]),_0xe203('0x5c'))||0x0;if(_0x193d96===_0x2e2edf[_0x2b55fc][_0xe203('0x40')]-0x1){_0x16227a[_0xe203('0x45')][_0x5ba8b9]['sumDuration']+=moment(_0x2e2edf[_0x2b55fc][_0x193d96]['queuecallercompleteAt']||_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x5d')]||_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x5e')])['diff'](moment(_0x2e2edf[_0x2b55fc][_0x193d96]['queuecallerjoinAt']),_0xe203('0x5c'))||0x0;_0x16227a[_0xe203('0x45')][_0x5ba8b9][_0xe203('0x30')]+=0x1;if(_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x5f')]){_0x16227a[_0xe203('0x45')][_0x5ba8b9][_0xe203('0x29')]+=0x1;_0x16227a[_0xe203('0x45')][_0x5ba8b9][_0xe203('0x2c')]+=moment(_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x60')])[_0xe203('0x5a')](moment(_0x2e2edf[_0x2b55fc][_0x193d96][_0xe203('0x59')]),_0xe203('0x5c'))||0x0;}}else{_0x16227a[_0xe203('0x45')][_0x5ba8b9][_0xe203('0x2b')]+=_0x16227a['voiceQueues'][_0x5ba8b9]['sumHoldTime']||0x0;}}}}}}return _0x16227a[_0xe203('0x45')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x646b2d=this;return function(_0x20defd){clearVoiceCallReports(_0x646b2d[_0xe203('0x16')]);if(_0x20defd){for(var _0x534be6=0x0;_0x534be6<_0x20defd[_0xe203('0x40')];_0x534be6+=0x1){_0x646b2d['outbound'][_0xe203('0x30')]+=0x1;_0x646b2d[_0xe203('0x16')]['sumDuration']+=_0x20defd[_0x534be6][_0xe203('0x61')];if(_0x20defd[_0x534be6][_0xe203('0x62')]==='ANSWERED'){_0x646b2d['outbound'][_0xe203('0x29')]+=0x1;_0x646b2d[_0xe203('0x16')][_0xe203('0x2a')]+=_0x20defd[_0x534be6][_0xe203('0x61')]-_0x20defd[_0x534be6][_0xe203('0x63')]||0x0;_0x646b2d[_0xe203('0x16')][_0xe203('0x2c')]+=_0x20defd[_0x534be6][_0xe203('0x63')];}}}return _0x646b2d[_0xe203('0x16')];};};Realtime[_0xe203('0x3e')]['initCampaigns']=function(){var _0x2823b6=this;return function(_0x1d5638){if(_0x1d5638){freeIsNotKey(_0x1d5638,_0x2823b6['campaigns'],'name');for(var _0x57ebd5=0x0,_0x4c1f48={};_0x57ebd5<_0x1d5638['length'];_0x57ebd5+=0x1){_0x4c1f48=_0x1d5638[_0x57ebd5];if(_['isUndefined'](_0x2823b6['campaigns'][_0x4c1f48[_0xe203('0x27')]])){_0x2823b6[_0xe203('0x64')][_0x4c1f48[_0xe203('0x27')]]=new Campaign(_0x4c1f48);}else{_0x2823b6[_0xe203('0x3f')](_0x2823b6['campaigns'][_0x4c1f48[_0xe203('0x27')]],_0x4c1f48);_0x2823b6[_0xe203('0x64')][_0x4c1f48[_0xe203('0x27')]][_0xe203('0x65')]=_0x4c1f48[_0xe203('0x66')]?_0x4c1f48[_0xe203('0x66')][_0xe203('0x27')]:undefined;}}}return _0x2823b6[_0xe203('0x64')];};};Realtime[_0xe203('0x3e')][_0xe203('0x67')]=function(){var _0x1d26a0=this;return function(_0x45b075){if(_0x45b075){freeIsNotKey(_0x45b075,_0x1d26a0[_0xe203('0x17')],'id');for(var _0x30bc7f=0x0,_0x226434={};_0x30bc7f<_0x45b075[_0xe203('0x40')];_0x30bc7f+=0x1){_0x226434=_0x45b075[_0x30bc7f];if(_['isUndefined'](_0x1d26a0[_0xe203('0x17')][_0x226434['id']])){_0x1d26a0[_0xe203('0x17')][_0x226434['id']]=new VoiceExtension(_0x226434);}else{_0x1d26a0[_0xe203('0x3f')](_0x1d26a0[_0xe203('0x17')][_0x226434['id']],_0x226434);}}}return _0x1d26a0[_0xe203('0x17')];};};Realtime[_0xe203('0x3e')][_0xe203('0x68')]=function(){var _0x51eb5f=this;return function(_0x40b336){clearCampaigns(_0x51eb5f[_0xe203('0x64')]);for(var _0x4e3b55=0x0;_0x4e3b55<_0x40b336[_0xe203('0x40')];_0x4e3b55+=0x1){_[_0xe203('0x53')](_0x51eb5f[_0xe203('0x64')][_0x40b336[_0x4e3b55][_0xe203('0x27')]],_0x40b336[_0x4e3b55]);}return _0x51eb5f['campaigns'];};};Realtime[_0xe203('0x3e')]['initFaxAccounts']=function(){var _0x571e3e=this;return function(_0x1c4867){if(_0x1c4867){freeIsNotKey(_0x1c4867,_0x571e3e[_0xe203('0x69')],'id');for(var _0x2309a3=0x0,_0xeb11d4={},_0x5cd255={};_0x2309a3<_0x1c4867['length'];_0x2309a3+=0x1){_0xeb11d4=_0x1c4867[_0x2309a3];if(_['isUndefined'](_0x571e3e[_0xe203('0x69')][_0xeb11d4['id']])){_0x571e3e[_0xe203('0x69')][_0xeb11d4['id']]=new FaxAccount(_0xeb11d4);}else{_0x571e3e[_0xe203('0x3f')](_0x571e3e[_0xe203('0x69')][_0xeb11d4['id']],_0xeb11d4);}}}return _0x571e3e[_0xe203('0x69')];};};module[_0xe203('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 2681a79..5728fc5 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 _0xedd9=['voiceDialReport','transfererlinkedid','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','attendedtransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','destination','exten','type','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','blindTransfer','split','UserId','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf'];(function(_0x430892,_0x30c05d){var _0xdd8af7=function(_0x35ccc9){while(--_0x35ccc9){_0x430892['push'](_0x430892['shift']());}};_0xdd8af7(++_0x30c05d);}(_0xedd9,0x1d8));var _0x9edd=function(_0x4b1ff9,_0x22f764){_0x4b1ff9=_0x4b1ff9-0x0;var _0x548df3=_0xedd9[_0x4b1ff9];return _0x548df3;};'use strict';var _=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var config=require(_0x9edd('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9edd('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x9edd('0x5'));var RpcMemberReport=require(_0x9edd('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x9edd('0x7'));var RpcVoiceTransferReport=require(_0x9edd('0x8'));var VoiceQueueReport=require(_0x9edd('0x9'));var VoiceCallReport=require(_0x9edd('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9edd('0xb'));var UserReport=require(_0x9edd('0xc'));function Report(_0x33aace){this['realtime']=_0x33aace;this[_0x9edd('0xd')]=_0x33aace[_0x9edd('0xd')];this[_0x9edd('0xe')]=_0x33aace['telephones'];}Report[_0x9edd('0xf')][_0x9edd('0x10')]=function(_0x241e15){var _0x1445a7=new VoiceQueueReport(this[_0x9edd('0x11')]);var _0x4657d4=new VoiceAgentReport(this['realtime']);var _0x5f5c09=new VoiceDialReport(this['realtime']);var _0xddd307=new VoiceCallReport(this['realtime']);var _0x3e297d=new UserReport(this[_0x9edd('0x11')]);if(config[_0x9edd('0x12')]&&config[_0x9edd('0x12')][_0x9edd('0x13')]){ami['on'](_0x9edd('0x14'),this[_0x9edd('0x15')][_0x9edd('0x16')](this));ami['on'](_0x9edd('0x17'),this[_0x9edd('0x18')][_0x9edd('0x16')](this));ami['on'](_0x9edd('0x19'),this['voiceAgentReport'][_0x9edd('0x16')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0x9edd('0x16')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x9edd('0x16')](this));ami['on'](_0x9edd('0x1a'),this['attendedTransfer'][_0x9edd('0x16')](this));}};Report[_0x9edd('0xf')][_0x9edd('0x1b')]=function(_0x22bc0e){var _0x5ed25c;_0x5ed25c=_['find'](this['agents'],function(_0x2e5ee6){return _0x2e5ee6[_0x9edd('0x1c')]==_0x22bc0e||_0x2e5ee6[_0x9edd('0x1d')]==_0x22bc0e;});if(_[_0x9edd('0x1e')](_0x5ed25c)){var _0x5837ee=_['find'](this[_0x9edd('0xe')],function(_0x226513){return _0x226513[_0x9edd('0x1c')]==_0x22bc0e||_0x226513['name']==_0x22bc0e;});if(_0x5837ee){_0x5ed25c=_[_0x9edd('0x1f')](this[_0x9edd('0xd')],function(_0x175bb0){return _0x175bb0[_0x9edd('0x20')]==util[_0x9edd('0x21')](_0x9edd('0x22'),_0x5837ee['name']);});}}return _0x5ed25c;};Report[_0x9edd('0xf')]['voiceQueueReport']=function(_0x590ac0){for(var _0x31d664=0x0;_0x31d664<_0x590ac0[_0x9edd('0x23')];_0x31d664+=0x1){var _0x4a7e63=this[_0x9edd('0x1b')](_0x590ac0[_0x31d664][_0x9edd('0x24')]);if(_0x4a7e63){_0x590ac0[_0x31d664][_0x9edd('0x1c')]=_0x4a7e63[_0x9edd('0x1c')];_0x590ac0[_0x31d664][_0x9edd('0x25')]=!![];_0x590ac0[_0x31d664][_0x9edd('0x26')]=_0x4a7e63[_0x9edd('0x1d')];_0x590ac0[_0x31d664][_0x9edd('0x20')]=_[_0x9edd('0x1e')](_0x4a7e63[_0x9edd('0x20')])?util[_0x9edd('0x21')](_0x9edd('0x22'),_0x4a7e63[_0x9edd('0x1d')]):_0x4a7e63[_0x9edd('0x20')];if(_0x590ac0[_0x31d664][_0x9edd('0x27')]){_0x590ac0[_0x31d664]['queuecallercompleteAt']=moment()[_0x9edd('0x21')](_0x9edd('0x28'));}if(_0x590ac0[_0x31d664][_0x9edd('0x29')]){_0x590ac0[_0x31d664]['queuecallerexitAt']=moment()[_0x9edd('0x21')](_0x9edd('0x28'));}RpcMemberReport[_0x9edd('0x15')](_0x590ac0[_0x31d664]);}RpcVoiceQueueReport[_0x9edd('0x2a')](_0x590ac0[_0x31d664]);}};function extractCalleridNumber(_0x360a35){var _0x5662ad=_0x360a35[_0x9edd('0x2b')](/<(.*?)>/);return _0x5662ad?_0x5662ad[0x1]:_0x360a35;}Report[_0x9edd('0xf')][_0x9edd('0x2c')]=function(_0x1db543){for(var _0x3bc790=0x0;_0x3bc790/);return _0x1adef3?_0x1adef3[0x1]:_0xda34e8;}Report[_0xbd8f('0xf')]['getAgentByInternal']=function(_0x14e963){for(var _0x59e4ed=0x0;_0x59e4ed',_0x193e1c[_0xbd8f('0x41')],_0x193e1c[_0xbd8f('0x3c')]);}if(RpcVoiceTransferReport[_0xbd8f('0x42')][_0x193e1c['linkedid']]){var _0x2ea836=RpcVoiceTransferReport[_0xbd8f('0x42')][_0x193e1c['linkedid']];_0x2ea836[_0xbd8f('0x43')]=_0x193e1c[_0xbd8f('0x44')];RpcVoiceTransferReport[_0xbd8f('0x45')](_0x2ea836);delete RpcVoiceTransferReport['transfers'][_0x193e1c[_0xbd8f('0x46')]];}if(_[_0xbd8f('0x1e')](_0x193e1c[_0xbd8f('0x47')])){_0x193e1c[_0xbd8f('0x47')]=this[_0xbd8f('0x2b')](_0x193e1c);}if(_['isNil'](_0x193e1c[_0xbd8f('0x48')])){var _0x3a1474=_0x193e1c[_0xbd8f('0x2c')][_0xbd8f('0x2d')]('-')[0x0];var _0x10a5a5=this[_0xbd8f('0xd')][_0x3a1474];if(!_0x10a5a5)_0x10a5a5=this[_0xbd8f('0x49')](_0x193e1c[_0xbd8f('0x24')]);if(_0x10a5a5){_0x193e1c[_0xbd8f('0x48')]=_0x10a5a5['id'];_0x193e1c[_0xbd8f('0x4a')]=_0x10a5a5[_0xbd8f('0x1d')];}}RpcVoiceCallReport[_0xbd8f('0x28')](_0x193e1c);if(_0x193e1c[_0xbd8f('0x4b')]){for(var _0x496148=0x0;_0x496148<_0x193e1c[_0xbd8f('0x4c')]['length'];_0x496148+=0x1){_0x193e1c[_0xbd8f('0x4d')]=_0x193e1c[_0xbd8f('0x4c')][_0x496148][_0xbd8f('0x4e')];_0x193e1c[_0xbd8f('0x4f')]=_0x193e1c[_0xbd8f('0x4c')][_0x496148][_0xbd8f('0x4f')];if(_0x193e1c[_0xbd8f('0x31')]==_0xbd8f('0x3a')){_0x193e1c['calleridnum']=_0x193e1c['connectedlinenum'];_0x193e1c[_0xbd8f('0x41')]=_0x193e1c[_0xbd8f('0x50')];_0x193e1c[_0xbd8f('0x23')]=_0x193e1c['accountcode'];_0x193e1c[_0xbd8f('0x50')]=_0x193e1c[_0xbd8f('0x4a')];_0x193e1c[_0xbd8f('0x31')]=_0x193e1c[_0xbd8f('0x3d')];}else if(_0x193e1c[_0xbd8f('0x31')]=='xcally-motion-dialer'){_0x193e1c['calleridnum']=_0x193e1c[_0xbd8f('0x30')];_0x193e1c['exten']=_0x193e1c[_0xbd8f('0x3d')];}RpcVoiceRecording['create'](_0x193e1c);}}};Report['prototype'][_0xbd8f('0x51')]=function(_0x53bd65){if(_[_0xbd8f('0x52')](_0x53bd65)){_0x53bd65['forEach'](function(_0x2da24f){RpcVoiceAgentReport[_0xbd8f('0x28')](_0x2da24f);});}else{RpcVoiceAgentReport[_0xbd8f('0x28')](_0x53bd65);}};Report[_0xbd8f('0xf')][_0xbd8f('0x18')]=function(_0x4f12e4){RpcVoiceDialReport[_0xbd8f('0x28')](_0x4f12e4);var _0x2a75ef;var _0x402603;var _0x1bc0bd=_0x4f12e4['channel'];if(_[_0xbd8f('0x53')](_0x1bc0bd,_0xbd8f('0x54'))){_0x402603=_0x1bc0bd[_0xbd8f('0x55')](_0x1bc0bd['indexOf']('/')+0x1,_0x1bc0bd[_0xbd8f('0x56')]('@'));_0x2a75ef=_[_0xbd8f('0x1c')](this[_0xbd8f('0xd')],function(_0x242256){return _0x242256[_0xbd8f('0x57')]==_0x402603||_0x242256[_0xbd8f('0x58')]==_0x402603||_0x242256['accountcode']==_0x402603;});}else{_0x402603=_0x1bc0bd[_0xbd8f('0x55')](_0x1bc0bd['indexOf']('/')+0x1,_0x1bc0bd[_0xbd8f('0x59')]('-'));_0x2a75ef=this[_0xbd8f('0x1b')](_0x402603);}if(_0x2a75ef){_0x4f12e4['interface']=_[_0xbd8f('0x1e')](_0x2a75ef[_0xbd8f('0x1f')])?util[_0xbd8f('0x20')]('SIP/%s',_0x2a75ef[_0xbd8f('0x1d')]):_0x2a75ef[_0xbd8f('0x1f')];_0x4f12e4[_0xbd8f('0x4a')]=_0x2a75ef['name'];_0x4f12e4[_0xbd8f('0x24')]=_0x2a75ef[_0xbd8f('0x24')];RpcMemberReport['voiceDialReport'](_0x4f12e4);}};Report['prototype'][_0xbd8f('0x45')]=function(_0x264f43){RpcVoiceTransferReport['transfers'][_0x264f43[_0xbd8f('0x5a')]]=_0x264f43;};Report[_0xbd8f('0xf')][_0xbd8f('0x5b')]=function(_0x3ba022){RpcVoiceTransferReport[_0xbd8f('0x5b')](_0x3ba022);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 266b4e6..bb3b3af 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5848=['syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','isNotNull','[userReport][registry]\x20registry:%s\x20state:%s','username','state','stateRegistry','merge','omit','event','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','emit','format','trunk:%s','name','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','toNumber','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','indexOf','find','mobile','accountcode','info','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','local','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','trunks','agents','telephones','registryentry'];(function(_0x1d306d,_0x57d4f0){var _0x1e41c8=function(_0x29a017){while(--_0x29a017){_0x1d306d['push'](_0x1d306d['shift']());}};_0x1e41c8(++_0x57d4f0);}(_0x5848,0xd1));var _0x8584=function(_0x3e9aa0,_0x1d8616){_0x3e9aa0=_0x3e9aa0-0x0;var _0x213eed=_0x5848[_0x3e9aa0];return _0x213eed;};'use strict';var _=require(_0x8584('0x0'));var moment=require(_0x8584('0x1'));var util=require(_0x8584('0x2'));var Redis=require(_0x8584('0x3'));var BPromise=require(_0x8584('0x4'));var config=require(_0x8584('0x5'));var logger=require('../../../config/logger')(_0x8584('0x6'));var ami=require(_0x8584('0x7'));config[_0x8584('0x8')]=_['defaults'](config[_0x8584('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x2c64e8){this[_0x8584('0x9')]=_0x2c64e8[_0x8584('0x9')];this['agents']=_0x2c64e8[_0x8584('0xa')];this[_0x8584('0xb')]=_0x2c64e8[_0x8584('0xb')];ami['on'](_0x8584('0xc'),this[_0x8584('0xd')]['bind'](this));ami['on']('registry',this[_0x8584('0xd')][_0x8584('0xe')](this));ami['on'](_0x8584('0xf'),this[_0x8584('0x10')][_0x8584('0xe')](this));ami['on'](_0x8584('0x11'),this[_0x8584('0x12')]['bind'](this));return this[_0x8584('0x13')]();}function showSipRegistrations(){Promise[_0x8584('0x14')]()[_0x8584('0x15')](ami['actionSipShowRegistry']())[_0x8584('0x16')](function(_0x19060c){logger[_0x8584('0x17')](_0x8584('0x18'),util[_0x8584('0x19')](_0x19060c,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8584('0x14')]()[_0x8584('0x15')](ami[_0x8584('0x1a')]())['catch'](function(_0xa74f28){logger['error'](_0x8584('0x1b'),util['inspect'](_0xa74f28,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8584('0x14')]()[_0x8584('0x15')](ami[_0x8584('0x1c')]())[_0x8584('0x16')](function(_0x3f1aa8){logger[_0x8584('0x17')](_0x8584('0x1d'),util[_0x8584('0x19')](_0x3f1aa8,{'showHidden':![],'depth':null}));});}UserReport[_0x8584('0x1e')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x8584('0x14')]()['then'](showSipRegistrations())[_0x8584('0x15')](listDeviceStates())[_0x8584('0x15')](showPeersStatus());},0x32c8);};UserReport[_0x8584('0x1e')]['isNotNull']=function(_0x2fa8dc){return _0x2fa8dc!==null&&!_[_0x8584('0x1f')](_0x2fa8dc);};UserReport[_0x8584('0x1e')]['emit']=function(_0x471ca7,_0x583ba6,_0x2bc209){io['to'](_0x471ca7)['emit'](_0x583ba6,_0x2bc209);};UserReport[_0x8584('0x1e')][_0x8584('0xd')]=function(_0x47d353){try{if(this[_0x8584('0x20')](_0x47d353)){logger['info'](_0x8584('0x21'),_0x47d353[_0x8584('0x22')],_0x47d353[_0x8584('0x23')]);logger['debug']('[userReport][registry]',util[_0x8584('0x19')](_0x47d353,{'showHidden':![],'depth':null}));var _0x298beb=_['find'](this[_0x8584('0x9')],{'defaultuser':_0x47d353[_0x8584('0x22')]});if(_0x298beb){_0x47d353[_0x8584('0x24')]=_0x47d353[_0x8584('0x23')];_[_0x8584('0x25')](_0x298beb,_[_0x8584('0x26')](_0x47d353,[_0x8584('0x27'),'actionid',_0x8584('0x22'),'state']));logger[_0x8584('0x28')](_0x8584('0x29'),util[_0x8584('0x19')](_0x298beb,{'showHidden':![],'depth':null}));this[_0x8584('0x2a')](util[_0x8584('0x2b')](_0x8584('0x2c'),_0x298beb[_0x8584('0x2d')]),'trunk:save',_0x298beb);}}}catch(_0xade1b2){logger[_0x8584('0x17')](_0x8584('0x2e'),util['inspect'](_0xade1b2,{'showHidden':![],'depth':null}));}};UserReport[_0x8584('0x1e')][_0x8584('0x10')]=function(_0x9ad8d5){try{if(this[_0x8584('0x20')](_0x9ad8d5)){logger['info'](_0x8584('0x2f'),_0x9ad8d5[_0x8584('0x30')],_0x9ad8d5[_0x8584('0x23')]);logger[_0x8584('0x28')](_0x8584('0x31'),util['inspect'](_0x9ad8d5,{'showHidden':![],'depth':null}));if(this[_0x8584('0xa')][_0x9ad8d5['device']]){if(!this[_0x8584('0xa')][_0x9ad8d5[_0x8584('0x30')]]['local']||_0x9ad8d5['state'][_0x8584('0x32')]()==_0x8584('0x33')){this['agents'][_0x9ad8d5[_0x8584('0x30')]]['local']=![];if(this['agents'][_0x9ad8d5[_0x8584('0x30')]][_0x8584('0x23')]!==_0x9ad8d5['state']['toLowerCase']()){this[_0x8584('0xa')][_0x9ad8d5[_0x8584('0x30')]]['stateTime']=_[_0x8584('0x34')](moment()[_0x8584('0x2b')]('x'));}this[_0x8584('0xa')][_0x9ad8d5[_0x8584('0x30')]]['state']=_0x9ad8d5['state'][_0x8584('0x32')]();this[_0x8584('0xa')][_0x9ad8d5[_0x8584('0x30')]][_0x8584('0x35')](_0x9ad8d5);}}else if(this[_0x8584('0xb')][_0x9ad8d5['device']]){if(this[_0x8584('0xb')][_0x9ad8d5[_0x8584('0x30')]]['state']!==_0x9ad8d5[_0x8584('0x23')][_0x8584('0x32')]()){this['telephones'][_0x9ad8d5[_0x8584('0x30')]][_0x8584('0x36')]=_[_0x8584('0x34')](moment()['format']('x'));}this[_0x8584('0xb')][_0x9ad8d5['device']][_0x8584('0x23')]=_0x9ad8d5[_0x8584('0x23')]['toLowerCase']();logger[_0x8584('0x28')](_0x8584('0x37'),util[_0x8584('0x19')](this[_0x8584('0xb')][_0x9ad8d5['device']],{'showHidden':![],'depth':null}));this[_0x8584('0x2a')](util[_0x8584('0x2b')]('telephone:%s',this[_0x8584('0xb')][_0x9ad8d5[_0x8584('0x30')]]['name']),'telephone:save',this[_0x8584('0xb')][_0x9ad8d5[_0x8584('0x30')]]);}else if(this['trunks'][_0x9ad8d5[_0x8584('0x30')]]){if(this['trunks'][_0x9ad8d5[_0x8584('0x30')]][_0x8584('0x23')]!==_0x9ad8d5['state'][_0x8584('0x32')]()){this['trunks'][_0x9ad8d5[_0x8584('0x30')]]['stateTime']=_[_0x8584('0x34')](moment()['format']('x'));}this[_0x8584('0x9')][_0x9ad8d5[_0x8584('0x30')]][_0x8584('0x23')]=_0x9ad8d5[_0x8584('0x23')][_0x8584('0x32')]();logger[_0x8584('0x28')](_0x8584('0x38'),util[_0x8584('0x19')](this['trunks'][_0x9ad8d5[_0x8584('0x30')]],{'showHidden':![],'depth':null}));this[_0x8584('0x2a')](util[_0x8584('0x2b')](_0x8584('0x2c'),this[_0x8584('0x9')][_0x9ad8d5[_0x8584('0x30')]][_0x8584('0x2d')]),_0x8584('0x39'),this[_0x8584('0x9')][_0x9ad8d5[_0x8584('0x30')]]);}else if(_[_0x8584('0x3a')](_0x9ad8d5[_0x8584('0x30')],_0x8584('0x3b'))){var _0x1db74d=_0x9ad8d5['device'];var _0x5bb862=_0x1db74d['substring'](_0x1db74d[_0x8584('0x3c')]('/')+0x1,_0x1db74d['indexOf']('@'));var _0x3abce0=_[_0x8584('0x3d')](this[_0x8584('0xa')],function(_0x23426f){return _0x23426f[_0x8584('0x3e')]==_0x5bb862||_0x23426f['phone']==_0x5bb862||_0x23426f[_0x8584('0x3f')]==_0x5bb862;});if(_0x3abce0){if(_0x3abce0['state']!==_0x9ad8d5['state']['toLowerCase']()){_0x3abce0[_0x8584('0x36')]=_[_0x8584('0x34')](moment()['format']('x'));}_0x3abce0[_0x8584('0x23')]=_0x9ad8d5[_0x8584('0x23')][_0x8584('0x32')]();_0x3abce0['local']=!![];_0x3abce0['updateStatusRealtime'](_0x9ad8d5);}}}}catch(_0x34a018){logger[_0x8584('0x17')](_0x8584('0x31'),util[_0x8584('0x19')](_0x34a018,{'showHidden':![],'depth':null}));}};UserReport[_0x8584('0x1e')][_0x8584('0x12')]=function(_0x223a6d){try{if(this[_0x8584('0x20')](_0x223a6d)&&this[_0x8584('0x20')](_0x223a6d[_0x8584('0x11')])){logger[_0x8584('0x40')](_0x8584('0x41'),_0x223a6d[_0x8584('0x42')],_0x223a6d['address'],_0x223a6d['peerstatus']);logger[_0x8584('0x28')](_0x8584('0x43'),util[_0x8584('0x19')](_0x223a6d,{'showHidden':![],'depth':null}));if(this['agents'][_0x223a6d[_0x8584('0x42')]]){if(!this[_0x8584('0xa')][_0x223a6d[_0x8584('0x42')]]['local']||_0x223a6d['peerstatus'][_0x8584('0x32')]()==_0x8584('0x44')){this[_0x8584('0xa')][_0x223a6d[_0x8584('0x42')]][_0x8584('0x45')]=![];this[_0x8584('0xa')][_0x223a6d[_0x8584('0x42')]]['status']=_0x223a6d['peerstatus'][_0x8584('0x32')]();this[_0x8584('0xa')][_0x223a6d[_0x8584('0x42')]][_0x8584('0x46')]=_0x223a6d[_0x8584('0x46')];this[_0x8584('0xa')][_0x223a6d[_0x8584('0x42')]][_0x8584('0x35')](_0x223a6d);}}else if(this[_0x8584('0xb')][_0x223a6d[_0x8584('0x42')]]){this[_0x8584('0xb')][_0x223a6d[_0x8584('0x42')]]['status']=_0x223a6d[_0x8584('0x11')]['toLowerCase']();this[_0x8584('0xb')][_0x223a6d[_0x8584('0x42')]][_0x8584('0x46')]=_0x223a6d[_0x8584('0x46')];logger[_0x8584('0x28')](_0x8584('0x47'),util['inspect'](this[_0x8584('0xb')][_0x223a6d['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0x8584('0x2b')]('telephone:%s',this[_0x8584('0xb')][_0x223a6d[_0x8584('0x42')]][_0x8584('0x2d')]),'telephone:save',this[_0x8584('0xb')][_0x223a6d[_0x8584('0x42')]]);}else if(this['trunks'][_0x223a6d[_0x8584('0x42')]]){this[_0x8584('0x9')][_0x223a6d[_0x8584('0x42')]]['status']=_0x223a6d[_0x8584('0x11')][_0x8584('0x32')]();this['trunks'][_0x223a6d[_0x8584('0x42')]]['address']=_0x223a6d[_0x8584('0x46')];logger[_0x8584('0x28')](_0x8584('0x48'),util[_0x8584('0x19')](this[_0x8584('0x9')][_0x223a6d['peer']],{'showHidden':![],'depth':null}));this[_0x8584('0x2a')](util[_0x8584('0x2b')]('trunk:%s',this[_0x8584('0x9')][_0x223a6d[_0x8584('0x42')]][_0x8584('0x2d')]),_0x8584('0x39'),this['trunks'][_0x223a6d[_0x8584('0x42')]]);}}}catch(_0x342c67){logger[_0x8584('0x17')](_0x8584('0x43'),util[_0x8584('0x19')](_0x342c67,{'showHidden':![],'depth':null}));}};module[_0x8584('0x49')]=UserReport; \ No newline at end of file +var _0xc9ad=['syncPeerStatus','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','then','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','[userReport][registry]','username','state','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','device','[userReport][devicestatechange]','inuse','local','toLowerCase','stateTime','toNumber','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','startsWith','Local','substring','indexOf','find','mobile','accountcode','updateStatusRealtime','peer','address','peerstatus','[userReport][peerstatus]','registered','status','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState'];(function(_0x553991,_0x3e2796){var _0x8e5a31=function(_0x5754f7){while(--_0x5754f7){_0x553991['push'](_0x553991['shift']());}};_0x8e5a31(++_0x3e2796);}(_0xc9ad,0xcb));var _0xdc9a=function(_0x4a4fdc,_0x11e5e2){_0x4a4fdc=_0x4a4fdc-0x0;var _0x4ba9e3=_0xc9ad[_0x4a4fdc];return _0x4ba9e3;};'use strict';var _=require(_0xdc9a('0x0'));var moment=require(_0xdc9a('0x1'));var util=require(_0xdc9a('0x2'));var Redis=require(_0xdc9a('0x3'));var BPromise=require(_0xdc9a('0x4'));var config=require(_0xdc9a('0x5'));var logger=require('../../../config/logger')(_0xdc9a('0x6'));var ami=require(_0xdc9a('0x7'));config[_0xdc9a('0x8')]=_[_0xdc9a('0x9')](config[_0xdc9a('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xdc9a('0xa'))(new Redis(config[_0xdc9a('0x8')]));function UserReport(_0x57e788){this['trunks']=_0x57e788[_0xdc9a('0xb')];this[_0xdc9a('0xc')]=_0x57e788[_0xdc9a('0xc')];this[_0xdc9a('0xd')]=_0x57e788[_0xdc9a('0xd')];ami['on'](_0xdc9a('0xe'),this[_0xdc9a('0xf')][_0xdc9a('0x10')](this));ami['on']('registry',this[_0xdc9a('0xf')][_0xdc9a('0x10')](this));ami['on'](_0xdc9a('0x11'),this[_0xdc9a('0x12')][_0xdc9a('0x10')](this));ami['on']('peerstatus',this[_0xdc9a('0x13')][_0xdc9a('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xdc9a('0x14')]()['then'](ami[_0xdc9a('0x15')]())[_0xdc9a('0x16')](function(_0x54365f){logger[_0xdc9a('0x17')](_0xdc9a('0x18'),util[_0xdc9a('0x19')](_0x54365f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xdc9a('0x14')]()['then'](ami[_0xdc9a('0x1a')]())['catch'](function(_0x50bebb){logger['error']('[userReport][devicestatelist]',util[_0xdc9a('0x19')](_0x50bebb,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xdc9a('0x14')]()['then'](ami[_0xdc9a('0x1b')]())[_0xdc9a('0x16')](function(_0x39e184){logger[_0xdc9a('0x17')](_0xdc9a('0x1c'),util[_0xdc9a('0x19')](_0x39e184,{'showHidden':![],'depth':null}));});}UserReport[_0xdc9a('0x1d')][_0xdc9a('0x1e')]=function(){setInterval(function(){BPromise[_0xdc9a('0x14')]()['then'](showSipRegistrations())[_0xdc9a('0x1f')](listDeviceStates())[_0xdc9a('0x1f')](showPeersStatus());},0x32c8);};UserReport[_0xdc9a('0x1d')][_0xdc9a('0x20')]=function(_0x34f989){return _0x34f989!==null&&!_[_0xdc9a('0x21')](_0x34f989);};UserReport[_0xdc9a('0x1d')][_0xdc9a('0x22')]=function(_0x2424cc,_0x434dcf,_0x9341ee){io['to'](_0x2424cc)[_0xdc9a('0x22')](_0x434dcf,_0x9341ee);};UserReport[_0xdc9a('0x1d')][_0xdc9a('0xf')]=function(_0x56ad53){try{if(this[_0xdc9a('0x20')](_0x56ad53)){logger[_0xdc9a('0x23')](_0xdc9a('0x24'),_0x56ad53['username'],_0x56ad53['state']);logger[_0xdc9a('0x25')](_0xdc9a('0x26'),util[_0xdc9a('0x19')](_0x56ad53,{'showHidden':![],'depth':null}));var _0xf0482=_['find'](this[_0xdc9a('0xb')],{'defaultuser':_0x56ad53[_0xdc9a('0x27')]});if(_0xf0482){_0x56ad53['stateRegistry']=_0x56ad53[_0xdc9a('0x28')];_['merge'](_0xf0482,_[_0xdc9a('0x29')](_0x56ad53,['event',_0xdc9a('0x2a'),_0xdc9a('0x27'),_0xdc9a('0x28')]));logger['debug'](_0xdc9a('0x2b'),util[_0xdc9a('0x19')](_0xf0482,{'showHidden':![],'depth':null}));this[_0xdc9a('0x22')](util['format'](_0xdc9a('0x2c'),_0xf0482[_0xdc9a('0x2d')]),_0xdc9a('0x2e'),_0xf0482);}}}catch(_0x35e38e){logger[_0xdc9a('0x17')](_0xdc9a('0x26'),util[_0xdc9a('0x19')](_0x35e38e,{'showHidden':![],'depth':null}));}};UserReport[_0xdc9a('0x1d')][_0xdc9a('0x12')]=function(_0x294a39){try{if(this[_0xdc9a('0x20')](_0x294a39)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x294a39[_0xdc9a('0x2f')],_0x294a39[_0xdc9a('0x28')]);logger[_0xdc9a('0x25')](_0xdc9a('0x30'),util[_0xdc9a('0x19')](_0x294a39,{'showHidden':![],'depth':null}));if(this['agents'][_0x294a39[_0xdc9a('0x2f')]]){if(!this[_0xdc9a('0xc')][_0x294a39[_0xdc9a('0x2f')]]['local']||_0x294a39[_0xdc9a('0x28')]['toLowerCase']()==_0xdc9a('0x31')){this[_0xdc9a('0xc')][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x32')]=![];if(this[_0xdc9a('0xc')][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x28')]!==_0x294a39['state'][_0xdc9a('0x33')]()){this[_0xdc9a('0xc')][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x34')]=_[_0xdc9a('0x35')](moment()[_0xdc9a('0x36')]('x'));}this['agents'][_0x294a39['device']][_0xdc9a('0x28')]=_0x294a39[_0xdc9a('0x28')]['toLowerCase']();this['agents'][_0x294a39[_0xdc9a('0x2f')]]['updateStatusRealtime'](_0x294a39);}}else if(this[_0xdc9a('0xd')][_0x294a39[_0xdc9a('0x2f')]]){if(this[_0xdc9a('0xd')][_0x294a39['device']][_0xdc9a('0x28')]!==_0x294a39['state']['toLowerCase']()){this[_0xdc9a('0xd')][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x34')]=_['toNumber'](moment()['format']('x'));}this[_0xdc9a('0xd')][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x28')]=_0x294a39['state'][_0xdc9a('0x33')]();logger[_0xdc9a('0x25')](_0xdc9a('0x37'),util[_0xdc9a('0x19')](this[_0xdc9a('0xd')][_0x294a39[_0xdc9a('0x2f')]],{'showHidden':![],'depth':null}));this[_0xdc9a('0x22')](util[_0xdc9a('0x36')]('telephone:%s',this[_0xdc9a('0xd')][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x2d')]),_0xdc9a('0x38'),this[_0xdc9a('0xd')][_0x294a39[_0xdc9a('0x2f')]]);}else if(this[_0xdc9a('0xb')][_0x294a39['device']]){if(this['trunks'][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x28')]!==_0x294a39[_0xdc9a('0x28')][_0xdc9a('0x33')]()){this[_0xdc9a('0xb')][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x34')]=_[_0xdc9a('0x35')](moment()[_0xdc9a('0x36')]('x'));}this['trunks'][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x28')]=_0x294a39['state'][_0xdc9a('0x33')]();logger[_0xdc9a('0x25')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xdc9a('0x19')](this['trunks'][_0x294a39[_0xdc9a('0x2f')]],{'showHidden':![],'depth':null}));this[_0xdc9a('0x22')](util[_0xdc9a('0x36')](_0xdc9a('0x2c'),this[_0xdc9a('0xb')][_0x294a39[_0xdc9a('0x2f')]][_0xdc9a('0x2d')]),_0xdc9a('0x2e'),this['trunks'][_0x294a39[_0xdc9a('0x2f')]]);}else if(_[_0xdc9a('0x39')](_0x294a39[_0xdc9a('0x2f')],_0xdc9a('0x3a'))){var _0x6ca54f=_0x294a39[_0xdc9a('0x2f')];var _0xba950=_0x6ca54f[_0xdc9a('0x3b')](_0x6ca54f[_0xdc9a('0x3c')]('/')+0x1,_0x6ca54f[_0xdc9a('0x3c')]('@'));var _0xcbd24a=_[_0xdc9a('0x3d')](this['agents'],function(_0x1d7ed3){return _0x1d7ed3[_0xdc9a('0x3e')]==_0xba950||_0x1d7ed3['phone']==_0xba950||_0x1d7ed3[_0xdc9a('0x3f')]==_0xba950;});if(_0xcbd24a){if(_0xcbd24a[_0xdc9a('0x28')]!==_0x294a39[_0xdc9a('0x28')][_0xdc9a('0x33')]()){_0xcbd24a[_0xdc9a('0x34')]=_[_0xdc9a('0x35')](moment()[_0xdc9a('0x36')]('x'));}_0xcbd24a[_0xdc9a('0x28')]=_0x294a39[_0xdc9a('0x28')][_0xdc9a('0x33')]();_0xcbd24a[_0xdc9a('0x32')]=!![];_0xcbd24a[_0xdc9a('0x40')](_0x294a39);}}}}catch(_0x3d9b30){logger[_0xdc9a('0x17')](_0xdc9a('0x30'),util[_0xdc9a('0x19')](_0x3d9b30,{'showHidden':![],'depth':null}));}};UserReport[_0xdc9a('0x1d')]['syncPeerStatus']=function(_0x4f609c){try{if(this[_0xdc9a('0x20')](_0x4f609c)&&this[_0xdc9a('0x20')](_0x4f609c['peerstatus'])){logger[_0xdc9a('0x23')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x4f609c[_0xdc9a('0x41')],_0x4f609c[_0xdc9a('0x42')],_0x4f609c[_0xdc9a('0x43')]);logger[_0xdc9a('0x25')](_0xdc9a('0x44'),util['inspect'](_0x4f609c,{'showHidden':![],'depth':null}));if(this[_0xdc9a('0xc')][_0x4f609c['peer']]){if(!this['agents'][_0x4f609c['peer']][_0xdc9a('0x32')]||_0x4f609c[_0xdc9a('0x43')][_0xdc9a('0x33')]()==_0xdc9a('0x45')){this[_0xdc9a('0xc')][_0x4f609c[_0xdc9a('0x41')]][_0xdc9a('0x32')]=![];this[_0xdc9a('0xc')][_0x4f609c[_0xdc9a('0x41')]][_0xdc9a('0x46')]=_0x4f609c[_0xdc9a('0x43')][_0xdc9a('0x33')]();this['agents'][_0x4f609c['peer']][_0xdc9a('0x42')]=_0x4f609c['address'];this[_0xdc9a('0xc')][_0x4f609c[_0xdc9a('0x41')]][_0xdc9a('0x40')](_0x4f609c);}}else if(this[_0xdc9a('0xd')][_0x4f609c[_0xdc9a('0x41')]]){this[_0xdc9a('0xd')][_0x4f609c[_0xdc9a('0x41')]][_0xdc9a('0x46')]=_0x4f609c['peerstatus'][_0xdc9a('0x33')]();this[_0xdc9a('0xd')][_0x4f609c[_0xdc9a('0x41')]][_0xdc9a('0x42')]=_0x4f609c[_0xdc9a('0x42')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xdc9a('0x19')](this['telephones'][_0x4f609c['peer']],{'showHidden':![],'depth':null}));this[_0xdc9a('0x22')](util['format'](_0xdc9a('0x47'),this[_0xdc9a('0xd')][_0x4f609c[_0xdc9a('0x41')]]['name']),_0xdc9a('0x38'),this[_0xdc9a('0xd')][_0x4f609c['peer']]);}else if(this[_0xdc9a('0xb')][_0x4f609c[_0xdc9a('0x41')]]){this[_0xdc9a('0xb')][_0x4f609c[_0xdc9a('0x41')]][_0xdc9a('0x46')]=_0x4f609c[_0xdc9a('0x43')][_0xdc9a('0x33')]();this[_0xdc9a('0xb')][_0x4f609c[_0xdc9a('0x41')]][_0xdc9a('0x42')]=_0x4f609c['address'];logger[_0xdc9a('0x25')](_0xdc9a('0x48'),util['inspect'](this[_0xdc9a('0xb')][_0x4f609c[_0xdc9a('0x41')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xdc9a('0x36')](_0xdc9a('0x2c'),this[_0xdc9a('0xb')][_0x4f609c['peer']][_0xdc9a('0x2d')]),_0xdc9a('0x2e'),this[_0xdc9a('0xb')][_0x4f609c['peer']]);}}}catch(_0x233daa){logger[_0xdc9a('0x17')](_0xdc9a('0x44'),util[_0xdc9a('0x19')](_0x233daa,{'showHidden':![],'depth':null}));}};module[_0xdc9a('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 7fa490e..c51ddfe 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d7e=['voice','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','routealias','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','isUndefined','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','emit','prototype','isNotNull','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','format','queue','mandatoryDisposition','type','inbound'];(function(_0xca9367,_0x198db4){var _0x412040=function(_0x1337b4){while(--_0x1337b4){_0xca9367['push'](_0xca9367['shift']());}};_0x412040(++_0x198db4);}(_0x8d7e,0x102));var _0xe8d7=function(_0x35e687,_0x9f762c){_0x35e687=_0x35e687-0x0;var _0x19a13f=_0x8d7e[_0x35e687];return _0x19a13f;};'use strict';var _=require('lodash');var moment=require(_0xe8d7('0x0'));var util=require(_0xe8d7('0x1'));var Redis=require(_0xe8d7('0x2'));var config=require(_0xe8d7('0x3'));var logger=require(_0xe8d7('0x4'))(_0xe8d7('0x5'));var ami=require(_0xe8d7('0x6'));config[_0xe8d7('0x7')]=_[_0xe8d7('0x8')](config[_0xe8d7('0x7')],{'host':_0xe8d7('0x9'),'port':0x18eb});var io=require(_0xe8d7('0xa'))(new Redis(config[_0xe8d7('0x7')]));function VoiceAgentReport(_0x2af30f){this[_0xe8d7('0xb')]={};this[_0xe8d7('0xc')]=_0x2af30f[_0xe8d7('0xb')];this['voiceQueues']=_0x2af30f[_0xe8d7('0xd')];this[_0xe8d7('0xe')]=_0x2af30f[_0xe8d7('0xe')];this[_0xe8d7('0xf')]={};ami['on'](_0xe8d7('0x10'),this['syncAgentCalled'][_0xe8d7('0x11')](this));ami['on']('agentconnect',this[_0xe8d7('0x12')]['bind'](this));ami['on'](_0xe8d7('0x13'),this[_0xe8d7('0x14')]['bind'](this));ami['on']('queuecallerabandon',this[_0xe8d7('0x15')][_0xe8d7('0x11')](this));ami['on'](_0xe8d7('0x16'),this['syncAgentComplete'][_0xe8d7('0x11')](this));ami['on'](_0xe8d7('0x17'),this[_0xe8d7('0x18')]['bind'](this));ami['on'](_0xe8d7('0x19'),this[_0xe8d7('0x1a')][_0xe8d7('0x11')](this));ami['on'](_0xe8d7('0x1b'),this[_0xe8d7('0x1c')][_0xe8d7('0x11')](this));ami['on'](_0xe8d7('0x1d'),this[_0xe8d7('0x1e')][_0xe8d7('0x11')](this));ami['on'](_0xe8d7('0x1f'),this['syncAttendedTransfer'][_0xe8d7('0x11')](this));ami['on'](_0xe8d7('0x20'),this['syncBlindTransfer']['bind'](this));}VoiceAgentReport['prototype'][_0xe8d7('0x21')]=function(_0x43f1be,_0x21bb2b,_0xa3e8bd){io['to'](_0x43f1be)[_0xe8d7('0x21')](_0x21bb2b,_0xa3e8bd);};VoiceAgentReport[_0xe8d7('0x22')][_0xe8d7('0x23')]=function(_0x490c5){return _0x490c5!==null&&!_['isUndefined'](_0x490c5);};VoiceAgentReport[_0xe8d7('0x22')][_0xe8d7('0x24')]=function(_0x3bd79a){try{if(this[_0xe8d7('0x23')](_0x3bd79a)){logger[_0xe8d7('0x25')](_0xe8d7('0x26'),_0x3bd79a[_0xe8d7('0x27')],_0x3bd79a[_0xe8d7('0x28')],_0x3bd79a['destuniqueid']);logger[_0xe8d7('0x29')](_0xe8d7('0x2a'),_0x3bd79a['uniqueid'],util[_0xe8d7('0x2b')](_0x3bd79a,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x3bd79a[_0xe8d7('0x27')]])){this['channels'][_0x3bd79a[_0xe8d7('0x27')]]={};}if(_['isUndefined'](this[_0xe8d7('0xb')][_0x3bd79a[_0xe8d7('0x27')]][_0x3bd79a[_0xe8d7('0x2c')]])){this[_0xe8d7('0xb')][_0x3bd79a['uniqueid']][_0x3bd79a[_0xe8d7('0x2c')]]={'agentcalledAt':moment()[_0xe8d7('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','mandatoryDisposition':this[_0xe8d7('0xd')][_0x3bd79a[_0xe8d7('0x2e')]]?this[_0xe8d7('0xd')][_0x3bd79a[_0xe8d7('0x2e')]][_0xe8d7('0x2f')]||![]:![],'type':this[_0xe8d7('0xd')][_0x3bd79a[_0xe8d7('0x2e')]]?this['voiceQueues'][_0x3bd79a[_0xe8d7('0x2e')]][_0xe8d7('0x30')]||_0xe8d7('0x31'):_0xe8d7('0x31'),'variables':this[_0xe8d7('0xf')][_0x3bd79a[_0xe8d7('0x27')]],'motionChannel':_0xe8d7('0x32')};}_['merge'](this[_0xe8d7('0xb')][_0x3bd79a[_0xe8d7('0x27')]][_0x3bd79a[_0xe8d7('0x2c')]],_[_0xe8d7('0x33')](_0x3bd79a,['event',_0xe8d7('0x34')]));logger['debug'](_0xe8d7('0x35'),_0x3bd79a[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](this[_0xe8d7('0xb')][_0x3bd79a[_0xe8d7('0x27')]][_0x3bd79a[_0xe8d7('0x2c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe8d7('0x36'),this[_0xe8d7('0xb')][_0x3bd79a['uniqueid']][_0x3bd79a[_0xe8d7('0x2c')]]);var _0x525b39={'id':this[_0xe8d7('0xe')][_0x3bd79a[_0xe8d7('0x37')]]['id'],'calleridnum':this[_0xe8d7('0xb')][_0x3bd79a['uniqueid']][_0x3bd79a[_0xe8d7('0x2c')]][_0xe8d7('0x38')],'queue':this[_0xe8d7('0xb')][_0x3bd79a[_0xe8d7('0x27')]][_0x3bd79a[_0xe8d7('0x2c')]][_0xe8d7('0x2e')],'variables':this['channels'][_0x3bd79a[_0xe8d7('0x27')]][_0x3bd79a[_0xe8d7('0x2c')]][_0xe8d7('0xf')]};logger[_0xe8d7('0x29')](_0xe8d7('0x39'),_0x3bd79a[_0xe8d7('0x27')],util['inspect'](_0x525b39,{'showHidden':![],'depth':null}));this[_0xe8d7('0x21')](util['format'](_0xe8d7('0x3a'),_0x3bd79a[_0xe8d7('0x28')]),_0xe8d7('0x3b'),_0x525b39);}}catch(_0x499089){logger[_0xe8d7('0x3c')](_0xe8d7('0x3d'),_0x3bd79a[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x499089,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8d7('0x22')]['syncAgentConnect']=function(_0x470445){try{if(this[_0xe8d7('0x23')](_0x470445)){if(this['channels'][_0x470445[_0xe8d7('0x27')]]){logger[_0xe8d7('0x29')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x470445['uniqueid'],util['inspect'](_0x470445,{'showHidden':![],'depth':null}));for(var _0x1f62a8 in this[_0xe8d7('0xb')][_0x470445['uniqueid']]){if(this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]]['hasOwnProperty'](_0x1f62a8)){if(_0x470445[_0xe8d7('0x2c')]===_0x1f62a8){logger['info'](_0xe8d7('0x3e'),_0x470445[_0xe8d7('0x27')],_0x470445['membername'],_0x470445[_0xe8d7('0x2c')]);this[_0xe8d7('0xb')][_0x470445['uniqueid']][_0x1f62a8][_0xe8d7('0x3f')]=moment()[_0xe8d7('0x2d')](_0xe8d7('0x40'));this['channels'][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x41')]=_0x470445[_0xe8d7('0x41')];this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x42')]=_0x470445[_0xe8d7('0x42')];this['channels'][_0x470445['uniqueid']][_0x1f62a8][_0xe8d7('0x43')]=_0x470445[_0xe8d7('0x43')];this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x44')]=_0x470445['destchannelstatedesc'];this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x45')]=_0x470445['holdtime'];this['channels'][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x46')]='connect';if(this['voiceChannels'][this['channels'][_0x470445['uniqueid']][_0x1f62a8][_0xe8d7('0x27')]]){var _0x2dacea=this['voiceChannels'][this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x27')]]['routealias'];this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8]['routealias']=_0x2dacea;_0x470445[_0xe8d7('0x47')]=_0x2dacea;}_['merge'](this['agents'][_0x470445[_0xe8d7('0x37')]],_[_0xe8d7('0x48')](_0x470445,[_0xe8d7('0x2e'),_0xe8d7('0x49'),'routealias']));logger['debug'](_0xe8d7('0x4a'),_0x470445[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](this['channels'][_0x470445['uniqueid']][_0x470445['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xe8d7('0x21')](_0xe8d7('0x4b'),this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x470445[_0xe8d7('0x2c')]]);logger['debug'](_0xe8d7('0x4c'),_0x470445[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x470445['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xe8d7('0x21')](util[_0xe8d7('0x2d')](_0xe8d7('0x3a'),_0x470445[_0xe8d7('0x28')]),_0xe8d7('0x4d'),this['channels'][_0x470445[_0xe8d7('0x27')]][_0x470445['destuniqueid']]);}else if(!this[_0xe8d7('0xb')][_0x470445['uniqueid']][_0x1f62a8][_0xe8d7('0x13')]&&!this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x16')]){logger[_0xe8d7('0x25')](_0xe8d7('0x4e'),_0x470445[_0xe8d7('0x27')],this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x28')],_0x1f62a8);this['channels'][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x13')]=!![];this['channels'][_0x470445['uniqueid']][_0x1f62a8][_0xe8d7('0x4f')]=moment()[_0xe8d7('0x2d')](_0xe8d7('0x40'));this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x50')]=_0x470445[_0xe8d7('0x2c')];this['channels'][_0x470445[_0xe8d7('0x27')]][_0x1f62a8]['answeredelsewheremembername']=_0x470445[_0xe8d7('0x28')];this['channels'][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x46')]=_0xe8d7('0x51');this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8][_0xe8d7('0x52')]='answered_elsewhere';logger[_0xe8d7('0x29')](_0xe8d7('0x53'),_0x470445['uniqueid'],util[_0xe8d7('0x2b')](this[_0xe8d7('0xb')][_0x470445['uniqueid']][_0x1f62a8],{'showHidden':![],'depth':null}));ami[_0xe8d7('0x21')]('custom:agentansweredelsewhere',this[_0xe8d7('0xb')][_0x470445[_0xe8d7('0x27')]][_0x1f62a8]);}}}}}}catch(_0x1d1706){logger['error'](_0xe8d7('0x54'),_0x470445[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x1d1706,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe8d7('0x14')]=function(_0xc79f32){try{if(this['isNotNull'](_0xc79f32)){logger[_0xe8d7('0x29')](_0xe8d7('0x55'),_0xc79f32[_0xe8d7('0x27')],util['inspect'](_0xc79f32,{'showHidden':![],'depth':null}));if(this[_0xe8d7('0xb')][_0xc79f32['uniqueid']]&&this[_0xe8d7('0xb')][_0xc79f32[_0xe8d7('0x27')]][_0xc79f32['destuniqueid']]){logger['info'](_0xe8d7('0x56'),_0xc79f32[_0xe8d7('0x27')],_0xc79f32[_0xe8d7('0x28')],_0xc79f32[_0xe8d7('0x2c')]);this[_0xe8d7('0xb')][_0xc79f32[_0xe8d7('0x27')]][_0xc79f32[_0xe8d7('0x2c')]][_0xe8d7('0x13')]=!![];this['channels'][_0xc79f32[_0xe8d7('0x27')]][_0xc79f32[_0xe8d7('0x2c')]][_0xe8d7('0x4f')]=moment()[_0xe8d7('0x2d')](_0xe8d7('0x40'));this[_0xe8d7('0xb')][_0xc79f32[_0xe8d7('0x27')]][_0xc79f32[_0xe8d7('0x2c')]]['lastevent']=_0xe8d7('0x57');this[_0xe8d7('0xb')][_0xc79f32[_0xe8d7('0x27')]][_0xc79f32[_0xe8d7('0x2c')]][_0xe8d7('0x52')]=_0xe8d7('0x57');logger[_0xe8d7('0x29')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xc79f32[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](this['channels'][_0xc79f32[_0xe8d7('0x27')]][_0xc79f32[_0xe8d7('0x2c')]],{'showHidden':![],'depth':null}));ami[_0xe8d7('0x21')](_0xe8d7('0x58'),this[_0xe8d7('0xb')][_0xc79f32[_0xe8d7('0x27')]][_0xc79f32['destuniqueid']]);}}}catch(_0x17de97){logger[_0xe8d7('0x3c')]('[%s][voiceAgentReport][agentringnoanswer]',_0xc79f32[_0xe8d7('0x27')],util['inspect'](_0x17de97,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8d7('0x22')][_0xe8d7('0x15')]=function(_0x322fed){try{if(this[_0xe8d7('0x23')](_0x322fed)){logger[_0xe8d7('0x29')](_0xe8d7('0x59'),_0x322fed[_0xe8d7('0x27')],util['inspect'](_0x322fed,{'showHidden':![],'depth':null}));if(this[_0xe8d7('0xb')][_0x322fed[_0xe8d7('0x27')]]){for(var _0x211562 in this[_0xe8d7('0xb')][_0x322fed[_0xe8d7('0x27')]]){if(this[_0xe8d7('0xb')][_0x322fed[_0xe8d7('0x27')]][_0xe8d7('0x5a')](_0x211562)&&!this[_0xe8d7('0xb')][_0x322fed['uniqueid']][_0x211562]['agentringnoanswer']&&!this[_0xe8d7('0xb')][_0x322fed[_0xe8d7('0x27')]][_0x211562][_0xe8d7('0x16')]){logger[_0xe8d7('0x25')](_0xe8d7('0x5b'),_0x322fed['uniqueid'],this['channels'][_0x322fed[_0xe8d7('0x27')]][_0x211562][_0xe8d7('0x28')],_0x211562);this[_0xe8d7('0xb')][_0x322fed[_0xe8d7('0x27')]][_0x211562][_0xe8d7('0x13')]=!![];this[_0xe8d7('0xb')][_0x322fed['uniqueid']][_0x211562][_0xe8d7('0x4f')]=moment()[_0xe8d7('0x2d')](_0xe8d7('0x40'));this[_0xe8d7('0xb')][_0x322fed['uniqueid']][_0x211562]['lastevent']=_0xe8d7('0x5c');this[_0xe8d7('0xb')][_0x322fed[_0xe8d7('0x27')]][_0x211562]['reason']=_0xe8d7('0x5c');logger['debug'](_0xe8d7('0x5d'),_0x322fed['uniqueid'],util[_0xe8d7('0x2b')](this[_0xe8d7('0xb')][_0x322fed[_0xe8d7('0x27')]][_0x211562],{'showHidden':![],'depth':null}));ami[_0xe8d7('0x21')](_0xe8d7('0x5e'),this[_0xe8d7('0xb')][_0x322fed[_0xe8d7('0x27')]][_0x211562]);}}}}}catch(_0x1f2637){logger[_0xe8d7('0x3c')](_0xe8d7('0x5f'),_0x322fed[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x1f2637,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8d7('0x22')]['syncAgentComplete']=function(_0x142c66){try{if(this[_0xe8d7('0x23')](_0x142c66)){logger[_0xe8d7('0x29')](_0xe8d7('0x60'),_0x142c66['uniqueid'],util[_0xe8d7('0x2b')](_0x142c66,{'showHidden':![],'depth':null}));if(this[_0xe8d7('0xb')][_0x142c66[_0xe8d7('0x27')]]){for(var _0x3a67cc in this['channels'][_0x142c66['uniqueid']]){if(this[_0xe8d7('0xb')][_0x142c66[_0xe8d7('0x27')]][_0xe8d7('0x5a')](_0x3a67cc)){if(this['channels'][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc][_0xe8d7('0x3f')]&&!this['channels'][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc][_0xe8d7('0x16')]){logger[_0xe8d7('0x25')](_0xe8d7('0x61'),_0x142c66[_0xe8d7('0x27')],this[_0xe8d7('0xb')][_0x142c66['uniqueid']][_0x3a67cc][_0xe8d7('0x28')],_0x3a67cc);this[_0xe8d7('0xb')][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc][_0xe8d7('0x16')]=!![];this['channels'][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc][_0xe8d7('0x62')]=moment()[_0xe8d7('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe8d7('0xb')][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc][_0xe8d7('0x46')]=_0xe8d7('0x63');this[_0xe8d7('0xb')][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc][_0xe8d7('0x52')]=_0x142c66[_0xe8d7('0x52')]==_0xe8d7('0x64')?'agent':_0x142c66[_0xe8d7('0x52')];this[_0xe8d7('0xb')][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc][_0xe8d7('0x65')]=_0x142c66['talktime'];if(this[_0xe8d7('0xd')][_0x142c66[_0xe8d7('0x2e')]]&&this[_0xe8d7('0xd')][_0x142c66[_0xe8d7('0x2e')]][_0xe8d7('0x66')]){this[_0xe8d7('0xb')][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc][_0xe8d7('0x67')]=this[_0xe8d7('0xd')][_0x142c66['queue']][_0xe8d7('0x68')];this['channels'][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc]['agentacw']=!![];}this[_0xe8d7('0xe')][_0x142c66['interface']]=_[_0xe8d7('0x33')](this[_0xe8d7('0xe')][_0x142c66['interface']],[_0xe8d7('0x2e'),_0xe8d7('0x49')]);logger[_0xe8d7('0x29')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x142c66['uniqueid'],util[_0xe8d7('0x2b')](this[_0xe8d7('0xb')][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc],{'showHidden':![],'depth':null}));ami[_0xe8d7('0x21')]('custom:agentcomplete',this['channels'][_0x142c66[_0xe8d7('0x27')]][_0x3a67cc]);logger[_0xe8d7('0x29')](_0xe8d7('0x69'),_0x142c66[_0xe8d7('0x27')],util['inspect']({'id':this[_0xe8d7('0xe')][_0x142c66[_0xe8d7('0x37')]]['id'],'destaccountcode':_0x142c66[_0xe8d7('0x6a')]},{'showHidden':![],'depth':null}));this[_0xe8d7('0x21')](util[_0xe8d7('0x2d')](_0xe8d7('0x3a'),_0x142c66['membername']),_0xe8d7('0x6b'),{'id':this[_0xe8d7('0xe')][_0x142c66[_0xe8d7('0x37')]]['id'],'destaccountcode':_0x142c66[_0xe8d7('0x6a')]});}}}}}}catch(_0x5967c4){logger[_0xe8d7('0x3c')](_0xe8d7('0x6c'),_0x142c66[_0xe8d7('0x27')],util['inspect'](_0x5967c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8d7('0x22')][_0xe8d7('0x18')]=function(_0x211040){try{if(this[_0xe8d7('0x23')](_0x211040)){logger['debug'](_0xe8d7('0x6d'),_0x211040[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x211040,{'showHidden':![],'depth':null}));this[_0xe8d7('0x6e')](_0x211040[_0xe8d7('0x27')],_[_0xe8d7('0x6f')](_0x211040[_0xe8d7('0x70')])[0x0],_0x211040['value']);if(this[_0xe8d7('0xb')][_0x211040[_0xe8d7('0x27')]]){for(var _0x3fd8ef in this[_0xe8d7('0xb')][_0x211040[_0xe8d7('0x27')]]){if(this[_0xe8d7('0xb')][_0x211040[_0xe8d7('0x27')]][_0xe8d7('0x5a')](_0x3fd8ef)){logger[_0xe8d7('0x25')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x211040[_0xe8d7('0x27')],_0x3fd8ef,_[_0xe8d7('0x6f')](_0x211040['variable'])[0x0],_0x211040[_0xe8d7('0x71')]);if(_[_0xe8d7('0x72')](this[_0xe8d7('0xb')][_0x211040[_0xe8d7('0x27')]][_0x3fd8ef]['variables'])){this[_0xe8d7('0xb')][_0x211040['uniqueid']][_0x3fd8ef][_0xe8d7('0xf')]={};}this[_0xe8d7('0xb')][_0x211040[_0xe8d7('0x27')]][_0x3fd8ef][_0xe8d7('0xf')]=this['variables'][_0x211040[_0xe8d7('0x27')]];}}}}}catch(_0x4b5b74){logger[_0xe8d7('0x3c')](_0xe8d7('0x73'),_0x211040['uniqueid'],util[_0xe8d7('0x2b')](_0x4b5b74,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8d7('0x22')][_0xe8d7('0x6e')]=function(_0x2efac9,_0x4eb95c,_0x42a353){var _0x2d857b=[_0xe8d7('0x74'),_0xe8d7('0x75'),_0xe8d7('0x76'),'rtpaudioqosjitterbridged',_0xe8d7('0x77'),_0xe8d7('0x78'),_0xe8d7('0x79'),_0xe8d7('0x7a'),'sipcallid','sipuri','bridgepeer',_0xe8d7('0x7b'),'membercalls',_0xe8d7('0x7c'),_0xe8d7('0x7d'),_0xe8d7('0x7e'),_0xe8d7('0x28'),_0xe8d7('0x7f'),_0xe8d7('0x80')];if(!_['isNil'](_0x4eb95c)&&!_['includes'](_0x2d857b,_0x4eb95c)){if(_[_0xe8d7('0x72')](this[_0xe8d7('0xf')][_0x2efac9])){this[_0xe8d7('0xf')][_0x2efac9]={};}this['variables'][_0x2efac9][_0x4eb95c]=_0x42a353;}};VoiceAgentReport[_0xe8d7('0x22')]['syncHangup']=function(_0x17775d){try{if(this[_0xe8d7('0x23')](_0x17775d)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x17775d[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x17775d,{'showHidden':![],'depth':null}));if(this['channels'][_0x17775d[_0xe8d7('0x27')]]){for(var _0x2a400e in this[_0xe8d7('0xb')][_0x17775d[_0xe8d7('0x27')]]){if(this[_0xe8d7('0xb')][_0x17775d[_0xe8d7('0x27')]][_0xe8d7('0x5a')](_0x2a400e)){if(this[_0xe8d7('0xb')][_0x17775d[_0xe8d7('0x27')]][_0x2a400e][_0xe8d7('0x52')]==_0xe8d7('0x64')&&this['channels'][_0x17775d[_0xe8d7('0x27')]][_0x2a400e][_0xe8d7('0x16')]){logger[_0xe8d7('0x25')](_0xe8d7('0x81'),_0x17775d[_0xe8d7('0x27')],_0x2a400e);this[_0xe8d7('0xb')][_0x17775d[_0xe8d7('0x27')]][_0x2a400e][_0xe8d7('0x62')]=moment()[_0xe8d7('0x2d')](_0xe8d7('0x40'));}}}logger['debug'](_0xe8d7('0x82'),_0x17775d[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_[_0xe8d7('0x83')](this[_0xe8d7('0xb')][_0x17775d[_0xe8d7('0x27')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xe8d7('0x84'),_[_0xe8d7('0x83')](this[_0xe8d7('0xb')][_0x17775d['uniqueid']]));delete this['channels'][_0x17775d[_0xe8d7('0x27')]];}if(this[_0xe8d7('0xf')][_0x17775d[_0xe8d7('0x27')]]){delete this[_0xe8d7('0xf')][_0x17775d[_0xe8d7('0x27')]];}}}catch(_0x44a182){logger['error']('[%s][voiceAgentReport][hangup]',_0x17775d[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x44a182,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8d7('0x22')][_0xe8d7('0x85')]=function(_0xbadb92){try{if(this[_0xe8d7('0x23')](_0xbadb92)){logger[_0xe8d7('0x29')](_0xe8d7('0x86'),_0xbadb92[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0xbadb92,{'showHidden':![],'depth':null}));if(this['channels'][_0xbadb92['transfereeuniqueid']]){for(var _0x5caa36 in this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x87')]]){if(this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x87')]]['hasOwnProperty'](_0x5caa36)){if(_0xbadb92[_0xe8d7('0x88')]===_0x5caa36){logger[_0xe8d7('0x25')](_0xe8d7('0x89'),_0xbadb92[_0xe8d7('0x27')],this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x87')]][_0x5caa36][_0xe8d7('0x28')],_0x5caa36);var _0x761f9a=moment();this[_0xe8d7('0xb')][_0xbadb92['transfereeuniqueid']][_0x5caa36][_0xe8d7('0x16')]=!![];this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x87')]][_0x5caa36][_0xe8d7('0x62')]=moment()[_0xe8d7('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xbadb92['transfereeuniqueid']][_0x5caa36][_0xe8d7('0x46')]=_0xe8d7('0x63');this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x87')]][_0x5caa36]['reason']=_0xe8d7('0x64');this[_0xe8d7('0xb')][_0xbadb92['transfereeuniqueid']][_0x5caa36]['talktime']=_0x761f9a[_0xe8d7('0x8a')](this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x87')]][_0x5caa36][_0xe8d7('0x3f')],_0xe8d7('0x8b'));}}}}if(this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x8c')]]){var _0x176c19=this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x8c')]];this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x8c')]]=this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x87')]];this[_0xe8d7('0xb')][_0xbadb92[_0xe8d7('0x87')]]=_0x176c19;}}}catch(_0x161b84){logger[_0xe8d7('0x3c')](_0xe8d7('0x8d'),_0xbadb92[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x161b84,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8d7('0x22')]['syncBlindTransfer']=function(_0x20db32){try{if(this[_0xe8d7('0x23')](_0x20db32)){logger[_0xe8d7('0x29')](_0xe8d7('0x8e'),_0x20db32[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x20db32,{'showHidden':![],'depth':null}));if(this[_0xe8d7('0xb')][_0x20db32[_0xe8d7('0x87')]]){for(var _0x27ed40 in this[_0xe8d7('0xb')][_0x20db32[_0xe8d7('0x87')]]){if(this[_0xe8d7('0xb')][_0x20db32['transfereeuniqueid']][_0xe8d7('0x5a')](_0x27ed40)){if(_0x20db32[_0xe8d7('0x8f')]===_0x27ed40){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x20db32[_0xe8d7('0x27')],this[_0xe8d7('0xb')][_0x20db32[_0xe8d7('0x87')]][_0x27ed40]['membername'],_0x27ed40);var _0x380355=moment();this[_0xe8d7('0xb')][_0x20db32['transfereeuniqueid']][_0x27ed40]['agentcomplete']=!![];this[_0xe8d7('0xb')][_0x20db32[_0xe8d7('0x87')]][_0x27ed40]['agentcompleteAt']=_0x380355;this['channels'][_0x20db32[_0xe8d7('0x87')]][_0x27ed40][_0xe8d7('0x46')]=_0xe8d7('0x63');this[_0xe8d7('0xb')][_0x20db32[_0xe8d7('0x87')]][_0x27ed40][_0xe8d7('0x52')]=_0xe8d7('0x64');this[_0xe8d7('0xb')][_0x20db32[_0xe8d7('0x87')]][_0x27ed40][_0xe8d7('0x65')]=_0x380355[_0xe8d7('0x8a')](this[_0xe8d7('0xb')][_0x20db32['transfereeuniqueid']][_0x27ed40][_0xe8d7('0x3f')],'seconds');}}}}}}catch(_0x4e89d5){logger[_0xe8d7('0x3c')](_0xe8d7('0x90'),_0x20db32[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x4e89d5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe8d7('0x1c')]=function(_0x226058){var _0x5ae12b='';try{if(this[_0xe8d7('0x23')](_0x226058)){logger[_0xe8d7('0x29')](_0xe8d7('0x91'),_0x226058[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x226058,{'showHidden':![],'depth':null}));if(_0x226058[_0xe8d7('0x92')]){_0x5ae12b=_0x226058[_0xe8d7('0x92')][_0xe8d7('0x93')](0x0,_0x226058[_0xe8d7('0x92')][_0xe8d7('0x94')]('-'));if(this[_0xe8d7('0xe')][_0x5ae12b]){logger[_0xe8d7('0x25')](_0xe8d7('0x95'),_0x226058[_0xe8d7('0x27')],_0x5ae12b);this[_0xe8d7('0xe')][_0x5ae12b][_0xe8d7('0x96')]=!![];}}}}catch(_0x40d1bd){logger[_0xe8d7('0x3c')](_0xe8d7('0x97'),_0x226058[_0xe8d7('0x27')],util['inspect'](_0x40d1bd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe8d7('0x1e')]=function(_0x4e9dda){var _0x4c0467='';try{if(this['isNotNull'](_0x4e9dda)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x4e9dda[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x4e9dda,{'showHidden':![],'depth':null}));if(_0x4e9dda[_0xe8d7('0x92')]){_0x4c0467=_0x4e9dda[_0xe8d7('0x92')][_0xe8d7('0x93')](0x0,_0x4e9dda[_0xe8d7('0x92')][_0xe8d7('0x94')]('-'));if(this[_0xe8d7('0xe')][_0x4c0467]){logger['info'](_0xe8d7('0x98'),_0x4e9dda[_0xe8d7('0x27')],_0x4c0467);this['agents'][_0x4c0467][_0xe8d7('0x96')]=![];}}}}catch(_0x6b52c){logger[_0xe8d7('0x3c')]('[%s][voiceAgentReport][musiconholdstop]',_0x4e9dda[_0xe8d7('0x27')],util[_0xe8d7('0x2b')](_0x6b52c,{'showHidden':![],'depth':null}));}};module[_0xe8d7('0x99')]=VoiceAgentReport; \ No newline at end of file +var _0x9203=['values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','emit','prototype','isUndefined','syncAgentCalled','isNotNull','info','uniqueid','membername','debug','inspect','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','voice','merge','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentcomplete','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','reason','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','hasOwnProperty','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','lastevent','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:'];(function(_0xfd86f,_0x3bb677){var _0x992397=function(_0x852888){while(--_0x852888){_0xfd86f['push'](_0xfd86f['shift']());}};_0x992397(++_0x3bb677);}(_0x9203,0x15b));var _0x3920=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x9203[_0x1dc24d];return _0x5d7fb2;};'use strict';var _=require(_0x3920('0x0'));var moment=require('moment');var util=require(_0x3920('0x1'));var Redis=require(_0x3920('0x2'));var config=require(_0x3920('0x3'));var logger=require(_0x3920('0x4'))(_0x3920('0x5'));var ami=require('../ami');config['redis']=_['defaults'](config[_0x3920('0x6')],{'host':_0x3920('0x7'),'port':0x18eb});var io=require(_0x3920('0x8'))(new Redis(config[_0x3920('0x6')]));function VoiceAgentReport(_0x3c5869){this[_0x3920('0x9')]={};this['voiceChannels']=_0x3c5869[_0x3920('0x9')];this[_0x3920('0xa')]=_0x3c5869[_0x3920('0xa')];this[_0x3920('0xb')]=_0x3c5869[_0x3920('0xb')];this[_0x3920('0xc')]={};ami['on'](_0x3920('0xd'),this['syncAgentCalled'][_0x3920('0xe')](this));ami['on'](_0x3920('0xf'),this['syncAgentConnect'][_0x3920('0xe')](this));ami['on'](_0x3920('0x10'),this['syncAgentRingNoAnswer'][_0x3920('0xe')](this));ami['on'](_0x3920('0x11'),this[_0x3920('0x12')][_0x3920('0xe')](this));ami['on']('agentcomplete',this[_0x3920('0x13')][_0x3920('0xe')](this));ami['on'](_0x3920('0x14'),this[_0x3920('0x15')][_0x3920('0xe')](this));ami['on']('hangup',this[_0x3920('0x16')][_0x3920('0xe')](this));ami['on'](_0x3920('0x17'),this[_0x3920('0x18')]['bind'](this));ami['on'](_0x3920('0x19'),this[_0x3920('0x1a')][_0x3920('0xe')](this));ami['on'](_0x3920('0x1b'),this[_0x3920('0x1c')][_0x3920('0xe')](this));ami['on'](_0x3920('0x1d'),this['syncBlindTransfer'][_0x3920('0xe')](this));}VoiceAgentReport['prototype'][_0x3920('0x1e')]=function(_0x5689e0,_0x176ce1,_0x26c202){io['to'](_0x5689e0)['emit'](_0x176ce1,_0x26c202);};VoiceAgentReport[_0x3920('0x1f')]['isNotNull']=function(_0x4c2941){return _0x4c2941!==null&&!_[_0x3920('0x20')](_0x4c2941);};VoiceAgentReport['prototype'][_0x3920('0x21')]=function(_0x4bc2d3){try{if(this[_0x3920('0x22')](_0x4bc2d3)){logger[_0x3920('0x23')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4bc2d3[_0x3920('0x24')],_0x4bc2d3[_0x3920('0x25')],_0x4bc2d3['destuniqueid']);logger[_0x3920('0x26')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x4bc2d3[_0x3920('0x24')],util[_0x3920('0x27')](_0x4bc2d3,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x3920('0x9')][_0x4bc2d3[_0x3920('0x24')]])){this['channels'][_0x4bc2d3['uniqueid']]={};}if(_['isUndefined'](this[_0x3920('0x9')][_0x4bc2d3[_0x3920('0x24')]][_0x4bc2d3[_0x3920('0x28')]])){this[_0x3920('0x9')][_0x4bc2d3[_0x3920('0x24')]][_0x4bc2d3[_0x3920('0x28')]]={'agentcalledAt':moment()[_0x3920('0x29')](_0x3920('0x2a')),'lastevent':_0x3920('0x2b'),'mandatoryDisposition':this[_0x3920('0xa')][_0x4bc2d3[_0x3920('0x2c')]]?this[_0x3920('0xa')][_0x4bc2d3['queue']]['mandatoryDisposition']||![]:![],'type':this[_0x3920('0xa')][_0x4bc2d3[_0x3920('0x2c')]]?this[_0x3920('0xa')][_0x4bc2d3[_0x3920('0x2c')]][_0x3920('0x2d')]||_0x3920('0x2e'):'inbound','variables':this[_0x3920('0xc')][_0x4bc2d3[_0x3920('0x24')]],'motionChannel':_0x3920('0x2f')};}_[_0x3920('0x30')](this[_0x3920('0x9')][_0x4bc2d3[_0x3920('0x24')]][_0x4bc2d3['destuniqueid']],_[_0x3920('0x31')](_0x4bc2d3,[_0x3920('0x32'),'privilege']));logger['debug'](_0x3920('0x33'),_0x4bc2d3['uniqueid'],util[_0x3920('0x27')](this['channels'][_0x4bc2d3[_0x3920('0x24')]][_0x4bc2d3[_0x3920('0x28')]],{'showHidden':![],'depth':null}));ami[_0x3920('0x1e')](_0x3920('0x34'),this['channels'][_0x4bc2d3[_0x3920('0x24')]][_0x4bc2d3['destuniqueid']]);var _0x4f3cde={'id':this['agents'][_0x4bc2d3['interface']]['id'],'calleridnum':this[_0x3920('0x9')][_0x4bc2d3[_0x3920('0x24')]][_0x4bc2d3[_0x3920('0x28')]][_0x3920('0x35')],'queue':this[_0x3920('0x9')][_0x4bc2d3[_0x3920('0x24')]][_0x4bc2d3['destuniqueid']][_0x3920('0x2c')],'variables':this[_0x3920('0x9')][_0x4bc2d3['uniqueid']][_0x4bc2d3[_0x3920('0x28')]][_0x3920('0xc')]};logger[_0x3920('0x26')](_0x3920('0x36'),_0x4bc2d3[_0x3920('0x24')],util[_0x3920('0x27')](_0x4f3cde,{'showHidden':![],'depth':null}));this[_0x3920('0x1e')](util['format'](_0x3920('0x37'),_0x4bc2d3[_0x3920('0x25')]),_0x3920('0x38'),_0x4f3cde);}}catch(_0x27d860){logger[_0x3920('0x39')](_0x3920('0x3a'),_0x4bc2d3[_0x3920('0x24')],util[_0x3920('0x27')](_0x27d860,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3920('0x3b')]=function(_0x176267){try{if(this['isNotNull'](_0x176267)){if(this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]]){logger[_0x3920('0x26')](_0x3920('0x3c'),_0x176267[_0x3920('0x24')],util[_0x3920('0x27')](_0x176267,{'showHidden':![],'depth':null}));for(var _0x3477fa in this[_0x3920('0x9')][_0x176267['uniqueid']]){if(this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]]['hasOwnProperty'](_0x3477fa)){if(_0x176267[_0x3920('0x28')]===_0x3477fa){logger[_0x3920('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x176267[_0x3920('0x24')],_0x176267[_0x3920('0x25')],_0x176267[_0x3920('0x28')]);this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa]['agentconnectAt']=moment()[_0x3920('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x3d')]=_0x176267[_0x3920('0x3d')];this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x3e')]=_0x176267[_0x3920('0x3e')];this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x3f')]=_0x176267['destchannelstate'];this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x40')]=_0x176267[_0x3920('0x40')];this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x41')]=_0x176267[_0x3920('0x41')];this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa]['lastevent']=_0x3920('0x42');if(this[_0x3920('0x43')][this[_0x3920('0x9')][_0x176267['uniqueid']][_0x3477fa][_0x3920('0x24')]]){var _0x598868=this[_0x3920('0x43')][this[_0x3920('0x9')][_0x176267['uniqueid']][_0x3477fa]['uniqueid']][_0x3920('0x44')];this['channels'][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x44')]=_0x598868;_0x176267['routealias']=_0x598868;}_[_0x3920('0x30')](this[_0x3920('0xb')][_0x176267[_0x3920('0x45')]],_[_0x3920('0x46')](_0x176267,['queue',_0x3920('0x47'),_0x3920('0x44')]));logger[_0x3920('0x26')](_0x3920('0x48'),_0x176267[_0x3920('0x24')],util[_0x3920('0x27')](this['channels'][_0x176267[_0x3920('0x24')]][_0x176267[_0x3920('0x28')]],{'showHidden':![],'depth':null}));ami[_0x3920('0x1e')](_0x3920('0x49'),this[_0x3920('0x9')][_0x176267['uniqueid']][_0x176267[_0x3920('0x28')]]);logger[_0x3920('0x26')](_0x3920('0x4a'),_0x176267['uniqueid'],util[_0x3920('0x27')](this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x176267['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x3920('0x1e')](util[_0x3920('0x29')](_0x3920('0x37'),_0x176267['membername']),_0x3920('0x4b'),this[_0x3920('0x9')][_0x176267['uniqueid']][_0x176267['destuniqueid']]);}else if(!this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa]['agentringnoanswer']&&!this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x4c')]){logger[_0x3920('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x176267[_0x3920('0x24')],this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x25')],_0x3477fa);this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x10')]=!![];this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x4d')]=moment()[_0x3920('0x29')](_0x3920('0x2a'));this['channels'][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x4e')]=_0x176267[_0x3920('0x28')];this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa][_0x3920('0x4f')]=_0x176267[_0x3920('0x25')];this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa]['lastevent']=_0x3920('0x50');this[_0x3920('0x9')][_0x176267[_0x3920('0x24')]][_0x3477fa]['reason']=_0x3920('0x50');logger[_0x3920('0x26')](_0x3920('0x51'),_0x176267[_0x3920('0x24')],util[_0x3920('0x27')](this[_0x3920('0x9')][_0x176267['uniqueid']][_0x3477fa],{'showHidden':![],'depth':null}));ami[_0x3920('0x1e')](_0x3920('0x52'),this[_0x3920('0x9')][_0x176267['uniqueid']][_0x3477fa]);}}}}}}catch(_0x5d9a9a){logger[_0x3920('0x39')](_0x3920('0x53'),_0x176267['uniqueid'],util[_0x3920('0x27')](_0x5d9a9a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3920('0x1f')][_0x3920('0x54')]=function(_0x413970){try{if(this[_0x3920('0x22')](_0x413970)){logger['debug'](_0x3920('0x55'),_0x413970[_0x3920('0x24')],util[_0x3920('0x27')](_0x413970,{'showHidden':![],'depth':null}));if(this[_0x3920('0x9')][_0x413970[_0x3920('0x24')]]&&this[_0x3920('0x9')][_0x413970['uniqueid']][_0x413970[_0x3920('0x28')]]){logger[_0x3920('0x23')](_0x3920('0x56'),_0x413970[_0x3920('0x24')],_0x413970[_0x3920('0x25')],_0x413970[_0x3920('0x28')]);this[_0x3920('0x9')][_0x413970[_0x3920('0x24')]][_0x413970[_0x3920('0x28')]][_0x3920('0x10')]=!![];this[_0x3920('0x9')][_0x413970[_0x3920('0x24')]][_0x413970[_0x3920('0x28')]][_0x3920('0x4d')]=moment()[_0x3920('0x29')](_0x3920('0x2a'));this[_0x3920('0x9')][_0x413970[_0x3920('0x24')]][_0x413970[_0x3920('0x28')]]['lastevent']='rejected';this['channels'][_0x413970[_0x3920('0x24')]][_0x413970[_0x3920('0x28')]][_0x3920('0x57')]=_0x3920('0x58');logger['debug'](_0x3920('0x59'),_0x413970['uniqueid'],util['inspect'](this[_0x3920('0x9')][_0x413970[_0x3920('0x24')]][_0x413970['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x3920('0x1e')](_0x3920('0x5a'),this[_0x3920('0x9')][_0x413970['uniqueid']][_0x413970[_0x3920('0x28')]]);}}}catch(_0xfa6433){logger['error'](_0x3920('0x5b'),_0x413970['uniqueid'],util['inspect'](_0xfa6433,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3920('0x12')]=function(_0x39af41){try{if(this['isNotNull'](_0x39af41)){logger[_0x3920('0x26')](_0x3920('0x5c'),_0x39af41['uniqueid'],util['inspect'](_0x39af41,{'showHidden':![],'depth':null}));if(this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]]){for(var _0x115a40 in this[_0x3920('0x9')][_0x39af41['uniqueid']]){if(this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]]['hasOwnProperty'](_0x115a40)&&!this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]][_0x115a40]['agentringnoanswer']&&!this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]][_0x115a40]['agentcomplete']){logger[_0x3920('0x23')](_0x3920('0x5d'),_0x39af41[_0x3920('0x24')],this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]][_0x115a40][_0x3920('0x25')],_0x115a40);this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]][_0x115a40][_0x3920('0x10')]=!![];this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]][_0x115a40]['agentringnoanswerAt']=moment()['format'](_0x3920('0x2a'));this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]][_0x115a40]['lastevent']='abandoned';this['channels'][_0x39af41[_0x3920('0x24')]][_0x115a40][_0x3920('0x57')]=_0x3920('0x5e');logger[_0x3920('0x26')](_0x3920('0x5f'),_0x39af41[_0x3920('0x24')],util[_0x3920('0x27')](this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]][_0x115a40],{'showHidden':![],'depth':null}));ami[_0x3920('0x1e')](_0x3920('0x60'),this[_0x3920('0x9')][_0x39af41[_0x3920('0x24')]][_0x115a40]);}}}}}catch(_0x1d8a8d){logger[_0x3920('0x39')](_0x3920('0x61'),_0x39af41[_0x3920('0x24')],util[_0x3920('0x27')](_0x1d8a8d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x20a06c){try{if(this[_0x3920('0x22')](_0x20a06c)){logger[_0x3920('0x26')](_0x3920('0x62'),_0x20a06c[_0x3920('0x24')],util[_0x3920('0x27')](_0x20a06c,{'showHidden':![],'depth':null}));if(this[_0x3920('0x9')][_0x20a06c['uniqueid']]){for(var _0x38922d in this['channels'][_0x20a06c[_0x3920('0x24')]]){if(this[_0x3920('0x9')][_0x20a06c[_0x3920('0x24')]][_0x3920('0x63')](_0x38922d)){if(this[_0x3920('0x9')][_0x20a06c[_0x3920('0x24')]][_0x38922d][_0x3920('0x64')]&&!this[_0x3920('0x9')][_0x20a06c['uniqueid']][_0x38922d]['agentcomplete']){logger[_0x3920('0x23')](_0x3920('0x65'),_0x20a06c[_0x3920('0x24')],this['channels'][_0x20a06c['uniqueid']][_0x38922d][_0x3920('0x25')],_0x38922d);this[_0x3920('0x9')][_0x20a06c[_0x3920('0x24')]][_0x38922d][_0x3920('0x4c')]=!![];this['channels'][_0x20a06c[_0x3920('0x24')]][_0x38922d][_0x3920('0x66')]=moment()[_0x3920('0x29')](_0x3920('0x2a'));this['channels'][_0x20a06c[_0x3920('0x24')]][_0x38922d][_0x3920('0x67')]=_0x3920('0x68');this['channels'][_0x20a06c['uniqueid']][_0x38922d][_0x3920('0x57')]=_0x20a06c[_0x3920('0x57')]==_0x3920('0x69')?_0x3920('0x6a'):_0x20a06c[_0x3920('0x57')];this['channels'][_0x20a06c[_0x3920('0x24')]][_0x38922d][_0x3920('0x6b')]=_0x20a06c[_0x3920('0x6b')];if(this['voiceQueues'][_0x20a06c[_0x3920('0x2c')]]&&this['voiceQueues'][_0x20a06c[_0x3920('0x2c')]][_0x3920('0x6c')]){this[_0x3920('0x9')][_0x20a06c[_0x3920('0x24')]][_0x38922d][_0x3920('0x6d')]=this[_0x3920('0xa')][_0x20a06c[_0x3920('0x2c')]][_0x3920('0x6e')];this[_0x3920('0x9')][_0x20a06c['uniqueid']][_0x38922d][_0x3920('0x6f')]=!![];}this[_0x3920('0xb')][_0x20a06c[_0x3920('0x45')]]=_[_0x3920('0x31')](this['agents'][_0x20a06c[_0x3920('0x45')]],['queue',_0x3920('0x47')]);logger[_0x3920('0x26')](_0x3920('0x70'),_0x20a06c[_0x3920('0x24')],util['inspect'](this['channels'][_0x20a06c[_0x3920('0x24')]][_0x38922d],{'showHidden':![],'depth':null}));ami[_0x3920('0x1e')](_0x3920('0x71'),this[_0x3920('0x9')][_0x20a06c[_0x3920('0x24')]][_0x38922d]);logger['debug'](_0x3920('0x72'),_0x20a06c[_0x3920('0x24')],util[_0x3920('0x27')]({'id':this['agents'][_0x20a06c[_0x3920('0x45')]]['id'],'destaccountcode':_0x20a06c[_0x3920('0x73')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x3920('0x29')](_0x3920('0x37'),_0x20a06c[_0x3920('0x25')]),'user:agentcomplete',{'id':this[_0x3920('0xb')][_0x20a06c[_0x3920('0x45')]]['id'],'destaccountcode':_0x20a06c[_0x3920('0x73')]});}}}}}}catch(_0x127b57){logger[_0x3920('0x39')](_0x3920('0x74'),_0x20a06c['uniqueid'],util['inspect'](_0x127b57,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3920('0x1f')]['syncVarSet']=function(_0x378845){try{if(this['isNotNull'](_0x378845)){logger[_0x3920('0x26')](_0x3920('0x75'),_0x378845[_0x3920('0x24')],util[_0x3920('0x27')](_0x378845,{'showHidden':![],'depth':null}));this[_0x3920('0x76')](_0x378845[_0x3920('0x24')],_[_0x3920('0x77')](_0x378845[_0x3920('0x78')])[0x0],_0x378845['value']);if(this[_0x3920('0x9')][_0x378845[_0x3920('0x24')]]){for(var _0x381cb0 in this[_0x3920('0x9')][_0x378845[_0x3920('0x24')]]){if(this['channels'][_0x378845[_0x3920('0x24')]][_0x3920('0x63')](_0x381cb0)){logger['info'](_0x3920('0x79'),_0x378845['uniqueid'],_0x381cb0,_[_0x3920('0x77')](_0x378845[_0x3920('0x78')])[0x0],_0x378845[_0x3920('0x7a')]);if(_[_0x3920('0x20')](this[_0x3920('0x9')][_0x378845[_0x3920('0x24')]][_0x381cb0][_0x3920('0xc')])){this[_0x3920('0x9')][_0x378845[_0x3920('0x24')]][_0x381cb0][_0x3920('0xc')]={};}this[_0x3920('0x9')][_0x378845[_0x3920('0x24')]][_0x381cb0][_0x3920('0xc')]=this[_0x3920('0xc')][_0x378845[_0x3920('0x24')]];}}}}}catch(_0x1ca8a0){logger[_0x3920('0x39')](_0x3920('0x7b'),_0x378845[_0x3920('0x24')],util[_0x3920('0x27')](_0x1ca8a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3920('0x1f')]['addVariable']=function(_0xefebef,_0x267f60,_0x10a53a){var _0x5cb13b=[_0x3920('0x7c'),_0x3920('0x7d'),_0x3920('0x7e'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x3920('0x7f'),_0x3920('0x80'),'rtpaudioqosrttbridged',_0x3920('0x81'),_0x3920('0x82'),_0x3920('0x83'),_0x3920('0x84'),_0x3920('0x85'),_0x3920('0x86'),'memberinterface','memberlastcall',_0x3920('0x25'),_0x3920('0x87'),_0x3920('0x88')];if(!_['isNil'](_0x267f60)&&!_[_0x3920('0x89')](_0x5cb13b,_0x267f60)){if(_[_0x3920('0x20')](this[_0x3920('0xc')][_0xefebef])){this[_0x3920('0xc')][_0xefebef]={};}this[_0x3920('0xc')][_0xefebef][_0x267f60]=_0x10a53a;}};VoiceAgentReport[_0x3920('0x1f')][_0x3920('0x16')]=function(_0x26bce3){try{if(this[_0x3920('0x22')](_0x26bce3)){logger[_0x3920('0x26')]('[%s][voiceAgentReport][hangup]\x20event:',_0x26bce3[_0x3920('0x24')],util[_0x3920('0x27')](_0x26bce3,{'showHidden':![],'depth':null}));if(this['channels'][_0x26bce3['uniqueid']]){for(var _0x4a0083 in this['channels'][_0x26bce3[_0x3920('0x24')]]){if(this['channels'][_0x26bce3[_0x3920('0x24')]][_0x3920('0x63')](_0x4a0083)){if(this[_0x3920('0x9')][_0x26bce3[_0x3920('0x24')]][_0x4a0083]['reason']==_0x3920('0x69')&&this[_0x3920('0x9')][_0x26bce3['uniqueid']][_0x4a0083][_0x3920('0x4c')]){logger[_0x3920('0x23')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x26bce3[_0x3920('0x24')],_0x4a0083);this['channels'][_0x26bce3[_0x3920('0x24')]][_0x4a0083][_0x3920('0x66')]=moment()[_0x3920('0x29')](_0x3920('0x2a'));}}}logger[_0x3920('0x26')](_0x3920('0x8a'),_0x26bce3['uniqueid'],util[_0x3920('0x27')](_[_0x3920('0x8b')](this['channels'][_0x26bce3[_0x3920('0x24')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x3920('0x8c'),_[_0x3920('0x8b')](this[_0x3920('0x9')][_0x26bce3['uniqueid']]));delete this['channels'][_0x26bce3[_0x3920('0x24')]];}if(this['variables'][_0x26bce3[_0x3920('0x24')]]){delete this[_0x3920('0xc')][_0x26bce3[_0x3920('0x24')]];}}}catch(_0x5b2bdd){logger[_0x3920('0x39')](_0x3920('0x8d'),_0x26bce3['uniqueid'],util[_0x3920('0x27')](_0x5b2bdd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3920('0x1f')][_0x3920('0x1c')]=function(_0x15edff){try{if(this[_0x3920('0x22')](_0x15edff)){logger[_0x3920('0x26')](_0x3920('0x8e'),_0x15edff[_0x3920('0x24')],util['inspect'](_0x15edff,{'showHidden':![],'depth':null}));if(this['channels'][_0x15edff['transfereeuniqueid']]){for(var _0x5dbe23 in this[_0x3920('0x9')][_0x15edff[_0x3920('0x8f')]]){if(this[_0x3920('0x9')][_0x15edff['transfereeuniqueid']][_0x3920('0x63')](_0x5dbe23)){if(_0x15edff[_0x3920('0x90')]===_0x5dbe23){logger[_0x3920('0x23')](_0x3920('0x91'),_0x15edff[_0x3920('0x24')],this[_0x3920('0x9')][_0x15edff['transfereeuniqueid']][_0x5dbe23][_0x3920('0x25')],_0x5dbe23);var _0x338398=moment();this['channels'][_0x15edff[_0x3920('0x8f')]][_0x5dbe23][_0x3920('0x4c')]=!![];this['channels'][_0x15edff[_0x3920('0x8f')]][_0x5dbe23][_0x3920('0x66')]=moment()['format'](_0x3920('0x2a'));this[_0x3920('0x9')][_0x15edff[_0x3920('0x8f')]][_0x5dbe23][_0x3920('0x67')]='complete';this['channels'][_0x15edff[_0x3920('0x8f')]][_0x5dbe23][_0x3920('0x57')]=_0x3920('0x69');this['channels'][_0x15edff['transfereeuniqueid']][_0x5dbe23]['talktime']=_0x338398[_0x3920('0x92')](this['channels'][_0x15edff[_0x3920('0x8f')]][_0x5dbe23][_0x3920('0x64')],_0x3920('0x93'));}}}}if(this['channels'][_0x15edff[_0x3920('0x94')]]){var _0x3bdaf5=this[_0x3920('0x9')][_0x15edff[_0x3920('0x94')]];this['channels'][_0x15edff[_0x3920('0x94')]]=this[_0x3920('0x9')][_0x15edff['transfereeuniqueid']];this[_0x3920('0x9')][_0x15edff[_0x3920('0x8f')]]=_0x3bdaf5;}}}catch(_0x378ace){logger[_0x3920('0x39')](_0x3920('0x95'),_0x15edff[_0x3920('0x24')],util['inspect'](_0x378ace,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3920('0x1f')]['syncBlindTransfer']=function(_0x3798e1){try{if(this[_0x3920('0x22')](_0x3798e1)){logger[_0x3920('0x26')](_0x3920('0x96'),_0x3798e1[_0x3920('0x24')],util[_0x3920('0x27')](_0x3798e1,{'showHidden':![],'depth':null}));if(this[_0x3920('0x9')][_0x3798e1[_0x3920('0x8f')]]){for(var _0x33c38c in this[_0x3920('0x9')][_0x3798e1[_0x3920('0x8f')]]){if(this['channels'][_0x3798e1[_0x3920('0x8f')]]['hasOwnProperty'](_0x33c38c)){if(_0x3798e1[_0x3920('0x97')]===_0x33c38c){logger[_0x3920('0x23')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3798e1[_0x3920('0x24')],this[_0x3920('0x9')][_0x3798e1['transfereeuniqueid']][_0x33c38c][_0x3920('0x25')],_0x33c38c);var _0x4494f8=moment();this[_0x3920('0x9')][_0x3798e1[_0x3920('0x8f')]][_0x33c38c][_0x3920('0x4c')]=!![];this['channels'][_0x3798e1[_0x3920('0x8f')]][_0x33c38c][_0x3920('0x66')]=_0x4494f8;this[_0x3920('0x9')][_0x3798e1['transfereeuniqueid']][_0x33c38c][_0x3920('0x67')]=_0x3920('0x68');this[_0x3920('0x9')][_0x3798e1[_0x3920('0x8f')]][_0x33c38c]['reason']='transfer';this[_0x3920('0x9')][_0x3798e1[_0x3920('0x8f')]][_0x33c38c][_0x3920('0x6b')]=_0x4494f8[_0x3920('0x92')](this['channels'][_0x3798e1[_0x3920('0x8f')]][_0x33c38c]['agentconnectAt'],_0x3920('0x93'));}}}}}}catch(_0x16e1b1){logger[_0x3920('0x39')](_0x3920('0x98'),_0x3798e1[_0x3920('0x24')],util['inspect'](_0x16e1b1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3920('0x1f')][_0x3920('0x18')]=function(_0x5eee5f){var _0xfeb0ac='';try{if(this[_0x3920('0x22')](_0x5eee5f)){logger[_0x3920('0x26')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x5eee5f['uniqueid'],util[_0x3920('0x27')](_0x5eee5f,{'showHidden':![],'depth':null}));if(_0x5eee5f[_0x3920('0x99')]){_0xfeb0ac=_0x5eee5f[_0x3920('0x99')][_0x3920('0x9a')](0x0,_0x5eee5f[_0x3920('0x99')][_0x3920('0x9b')]('-'));if(this[_0x3920('0xb')][_0xfeb0ac]){logger['info'](_0x3920('0x9c'),_0x5eee5f[_0x3920('0x24')],_0xfeb0ac);this[_0x3920('0xb')][_0xfeb0ac][_0x3920('0x9d')]=!![];}}}}catch(_0x326894){logger['error'](_0x3920('0x9e'),_0x5eee5f['uniqueid'],util[_0x3920('0x27')](_0x326894,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3920('0x1f')][_0x3920('0x1a')]=function(_0x471653){var _0x56a321='';try{if(this['isNotNull'](_0x471653)){logger[_0x3920('0x26')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x471653[_0x3920('0x24')],util[_0x3920('0x27')](_0x471653,{'showHidden':![],'depth':null}));if(_0x471653[_0x3920('0x99')]){_0x56a321=_0x471653[_0x3920('0x99')]['substring'](0x0,_0x471653[_0x3920('0x99')][_0x3920('0x9b')]('-'));if(this['agents'][_0x56a321]){logger[_0x3920('0x23')](_0x3920('0x9f'),_0x471653['uniqueid'],_0x56a321);this['agents'][_0x56a321][_0x3920('0x9d')]=![];}}}}catch(_0x52216c){logger['error'](_0x3920('0xa0'),_0x471653[_0x3920('0x24')],util['inspect'](_0x52216c,{'showHidden':![],'depth':null}));}};module[_0x3920('0xa1')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 6751c33..15a709c 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d6=['set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','hangup','syncHangup','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','from-sip','channel','split','xcally-motion-preview','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','inspect','context','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','destconnectedlinenum','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','appdata','applicationdata','CDR(routeAlias)','queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','lastapplication','lastdata','startsWith','cdr(','type','[%s][voiceCallReport][newexten]','calleridname','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','connectedlinename','UserId','membername','diff','destinationchannel','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','user:agentcomplete','length','transferType','then','isEmpty','getSettings','resolve','Action','StopMixMonitor','catch','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','outbound','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x58e827,_0x179e22){_0x58e827=_0x58e827-0x0;var _0x466b27=_0xd6d6[_0x58e827];return _0x466b27;};'use strict';var _=require(_0x6d6d('0x0'));var moment=require(_0x6d6d('0x1'));var util=require(_0x6d6d('0x2'));var path=require(_0x6d6d('0x3'));var Redis=require('ioredis');var config=require(_0x6d6d('0x4'));var logger=require(_0x6d6d('0x5'))(_0x6d6d('0x6'));var ami=require(_0x6d6d('0x7'));var Channel=require(_0x6d6d('0x8'));var RpcSetting=require(_0x6d6d('0x9'));var applications=[_0x6d6d('0xa'),'queue',_0x6d6d('0xb'),_0x6d6d('0xc'),_0x6d6d('0xd'),_0x6d6d('0xe')];var dispositions=[_0x6d6d('0xf'),_0x6d6d('0x10'),_0x6d6d('0x10'),'NO\x20ANSWER','NO\x20ANSWER',_0x6d6d('0xf'),_0x6d6d('0x11'),_0x6d6d('0x12'),_0x6d6d('0x10'),_0x6d6d('0x10'),'FAILED'];config[_0x6d6d('0x13')]=_[_0x6d6d('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6d6d('0x15'))(new Redis(config[_0x6d6d('0x13')]));function VoiceCallReport(_0xe61c36){this[_0x6d6d('0x16')]=_0xe61c36[_0x6d6d('0x16')];this[_0x6d6d('0x17')]=_0xe61c36[_0x6d6d('0x17')];this[_0x6d6d('0x18')]={};ami['on']('coreshowchannel',this[_0x6d6d('0x19')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x1b'),this[_0x6d6d('0x19')][_0x6d6d('0x1a')](this));ami['on']('newchannel',this[_0x6d6d('0x1c')]['bind'](this));ami['on'](_0x6d6d('0x1d'),this[_0x6d6d('0x1e')][_0x6d6d('0x1a')](this));ami['on']('varset',this['syncVarSet'][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x1f'),this[_0x6d6d('0x20')][_0x6d6d('0x1a')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x6d6d('0x1a')](this));ami['on']('attendedtransfer',this[_0x6d6d('0x21')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x22'),this[_0x6d6d('0x23')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x24'),this[_0x6d6d('0x25')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x26'),this[_0x6d6d('0x27')][_0x6d6d('0x1a')](this));try{logger[_0x6d6d('0x28')](_0x6d6d('0x29'));ami[_0x6d6d('0x2a')]();}catch(_0x1f7f88){logger[_0x6d6d('0x2b')](_0x6d6d('0x2c'),util['inspect'](_0x1f7f88,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x6d6d('0x2d')][_0x6d6d('0x2e')]=function(_0x99f7d6){return _0x99f7d6!==null&&!_[_0x6d6d('0x2f')](_0x99f7d6);};VoiceCallReport[_0x6d6d('0x2d')][_0x6d6d('0x30')]=function(_0x554f8e,_0x2851dd,_0x2b5e31){io['to'](_0x554f8e)[_0x6d6d('0x30')](_0x2851dd,_0x2b5e31);};VoiceCallReport[_0x6d6d('0x2d')][_0x6d6d('0x31')]=function(_0x408f98){try{if(this[_0x6d6d('0x2e')](_0x408f98)){logger['info'](_0x6d6d('0x32'),_0x408f98[_0x6d6d('0x33')],_0x408f98['calleridname'],_0x408f98['calleridnum']);logger[_0x6d6d('0x34')](_0x6d6d('0x35'),_0x408f98[_0x6d6d('0x33')],util['inspect'](_0x408f98,{'showHidden':![],'depth':null}));if(_0x408f98[_0x6d6d('0x33')]===_0x408f98[_0x6d6d('0x36')]){if(!_[_0x6d6d('0x2f')](this[_0x6d6d('0x16')][_0x408f98[_0x6d6d('0x33')]])){_[_0x6d6d('0x37')](this[_0x6d6d('0x16')][_0x408f98[_0x6d6d('0x33')]],_[_0x6d6d('0x38')](_0x408f98,_[_0x6d6d('0x39')](this['channels'][_0x408f98[_0x6d6d('0x33')]])));}}if(_0x408f98['context']===_0x6d6d('0x3a')){if(this[_0x6d6d('0x17')][_0x408f98[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]]){if(_0x408f98['exten']==_0x6d6d('0x3d')){this['agents'][_0x408f98[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]]['destconnectedlinenum']=_0x408f98[_0x6d6d('0x3e')];this[_0x6d6d('0x30')](util[_0x6d6d('0x3f')](_0x6d6d('0x40'),this[_0x6d6d('0x17')][_0x408f98[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]][_0x6d6d('0x41')]),_0x6d6d('0x42'),{'destaccountcode':this[_0x6d6d('0x17')][_0x408f98[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]][_0x6d6d('0x43')],'destconnectedlinenum':_0x408f98[_0x6d6d('0x3e')]});}}}}}catch(_0x5a2397){logger[_0x6d6d('0x2b')](_0x6d6d('0x44'),_0x408f98[_0x6d6d('0x33')],util[_0x6d6d('0x45')](_0x5a2397,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x3726ba){try{if(this[_0x6d6d('0x2e')](_0x3726ba)){logger[_0x6d6d('0x34')]('[%s][voiceCallReport][newchannel]\x20event:',_0x3726ba[_0x6d6d('0x33')],util[_0x6d6d('0x45')](_0x3726ba,{'showHidden':![],'depth':null}));if(this[_0x6d6d('0x16')][_0x3726ba[_0x6d6d('0x33')]])return;if(_0x3726ba['channel']==='OutgoingSpoolFailed')return;if(_0x3726ba['uniqueid']!==_0x3726ba[_0x6d6d('0x36')]&&!this[_0x6d6d('0x18')][_0x3726ba[_0x6d6d('0x36')]])return;logger[_0x6d6d('0x28')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3726ba[_0x6d6d('0x33')],_0x3726ba[_0x6d6d('0x46')],_0x3726ba[_0x6d6d('0x47')]);this[_0x6d6d('0x16')][_0x3726ba[_0x6d6d('0x33')]]=new Channel();this[_0x6d6d('0x16')][_0x3726ba['uniqueid']][_0x6d6d('0x48')]=moment()[_0x6d6d('0x3f')](_0x6d6d('0x49'));this[_0x6d6d('0x16')][_0x3726ba[_0x6d6d('0x33')]][_0x6d6d('0x4a')]=dispositions[_[_0x6d6d('0x4b')](_0x3726ba['channelstate'])];_[_0x6d6d('0x37')](this[_0x6d6d('0x16')][_0x3726ba[_0x6d6d('0x33')]],_[_0x6d6d('0x38')](_0x3726ba,_[_0x6d6d('0x39')](this['channels'][_0x3726ba[_0x6d6d('0x33')]])));if(_0x3726ba[_0x6d6d('0x46')]==='from-sip'){if(this[_0x6d6d('0x17')][_0x3726ba['channel'][_0x6d6d('0x3c')]('-')[0x0]]){if(_[_0x6d6d('0x2f')](this['agents'][_0x3726ba[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]][_0x6d6d('0x4c')])){this[_0x6d6d('0x17')][_0x3726ba[_0x6d6d('0x3b')]['split']('-')[0x0]]['destconnectedlinenum']=_0x3726ba[_0x6d6d('0x47')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x3726ba[_0x6d6d('0x33')],util[_0x6d6d('0x45')]({'id':this[_0x6d6d('0x17')][_0x3726ba['channel'][_0x6d6d('0x3c')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x3726ba[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]][_0x6d6d('0x43')],'destconnectedlinenum':_0x3726ba[_0x6d6d('0x47')]},{'showHidden':![],'depth':null}));this[_0x6d6d('0x30')](util[_0x6d6d('0x3f')](_0x6d6d('0x40'),this['agents'][_0x3726ba[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]][_0x6d6d('0x41')]),_0x6d6d('0x42'),{'id':this[_0x6d6d('0x17')][_0x3726ba[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0x6d6d('0x17')][_0x3726ba[_0x6d6d('0x3b')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3726ba[_0x6d6d('0x47')]});}}}}}catch(_0x1ec474){logger[_0x6d6d('0x2b')](_0x6d6d('0x4d'),_0x3726ba[_0x6d6d('0x33')],util['inspect'](_0x1ec474,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6d6d('0x2d')][_0x6d6d('0x19')]=function(_0x4718c3){try{if(this[_0x6d6d('0x2e')](_0x4718c3)){logger[_0x6d6d('0x34')](_0x6d6d('0x4e'),_0x4718c3[_0x6d6d('0x33')],util[_0x6d6d('0x45')](_0x4718c3,{'showHidden':![],'depth':null}));if(_0x4718c3[_0x6d6d('0x3b')]===_0x6d6d('0x4f')||_0x4718c3[_0x6d6d('0x47')]==='h')return;if(_0x4718c3[_0x6d6d('0x33')]===_0x4718c3['linkedid']||this[_0x6d6d('0x18')][_0x4718c3[_0x6d6d('0x36')]]){_0x4718c3[_0x6d6d('0x50')]=_0x4718c3[_0x6d6d('0x50')][_0x6d6d('0x51')]();_0x4718c3['applicationdata']=_0x4718c3[_0x6d6d('0x52')]||_0x4718c3[_0x6d6d('0x53')];if(_0x4718c3[_0x6d6d('0x52')]&&!_0x4718c3['appdata']['startsWith'](_0x6d6d('0x54'))&&_0x4718c3['application']!==_0x6d6d('0x55')){_0x4718c3[_0x6d6d('0x53')]=_0x4718c3[_0x6d6d('0x53')][_0x6d6d('0x51')]();}logger[_0x6d6d('0x28')](_0x6d6d('0x56'),_0x4718c3[_0x6d6d('0x33')],_0x4718c3[_0x6d6d('0x50')],_0x4718c3[_0x6d6d('0x53')]);if(_[_0x6d6d('0x2f')](this['channels'][_0x4718c3[_0x6d6d('0x33')]])){this[_0x6d6d('0x16')][_0x4718c3[_0x6d6d('0x33')]]=new Channel();this[_0x6d6d('0x16')][_0x4718c3[_0x6d6d('0x33')]][_0x6d6d('0x48')]=_0x4718c3[_0x6d6d('0x57')]?moment()['subtract'](moment['duration'](_0x4718c3[_0x6d6d('0x57')])[_0x6d6d('0x58')](),'seconds')[_0x6d6d('0x3f')](_0x6d6d('0x49')):moment()[_0x6d6d('0x3f')](_0x6d6d('0x49'));this[_0x6d6d('0x16')][_0x4718c3[_0x6d6d('0x33')]][_0x6d6d('0x4a')]=_0x6d6d('0xf');}_[_0x6d6d('0x37')](this[_0x6d6d('0x16')][_0x4718c3[_0x6d6d('0x33')]],_[_0x6d6d('0x38')](_0x4718c3,_[_0x6d6d('0x39')](this[_0x6d6d('0x16')][_0x4718c3[_0x6d6d('0x33')]])));if(_['includes'](applications,_0x4718c3[_0x6d6d('0x50')])){this[_0x6d6d('0x16')][_0x4718c3['uniqueid']][_0x6d6d('0x59')]=_0x4718c3[_0x6d6d('0x50')];this[_0x6d6d('0x16')][_0x4718c3[_0x6d6d('0x33')]][_0x6d6d('0x5a')]=_0x4718c3[_0x6d6d('0x53')];if(_0x4718c3[_0x6d6d('0x50')]===_0x6d6d('0xa')&&_[_0x6d6d('0x5b')](_0x4718c3['applicationdata']['toLowerCase'](),_0x6d6d('0x5c'))){var _0x325fe2=_0x4718c3[_0x6d6d('0x53')]['split']('=');var _0x593683=_0x325fe2[0x0][_0x6d6d('0x51')]()['match'](/cdr\((.*)\)/);if(_0x593683){if(_0x593683[0x1]===_0x6d6d('0x5d')&&!_['isNil'](this[_0x6d6d('0x16')][_0x4718c3[_0x6d6d('0x33')]][_0x593683[0x1]]))return;this[_0x6d6d('0x16')][_0x4718c3[_0x6d6d('0x33')]][_0x593683[0x1]]=_0x325fe2[0x1];}}else if(_0x4718c3[_0x6d6d('0x50')]===_0x6d6d('0x55')){this['channels'][_0x4718c3[_0x6d6d('0x33')]]['queue']=_0x4718c3[_0x6d6d('0x53')]['split'](',')[0x0];}}}}}catch(_0x2a21d8){logger[_0x6d6d('0x2b')](_0x6d6d('0x5e'),_0x4718c3[_0x6d6d('0x33')],util[_0x6d6d('0x45')](_0x2a21d8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6d6d('0x2d')][_0x6d6d('0x1e')]=function(_0x4cfefc){try{if(this['isNotNull'](_0x4cfefc)){logger[_0x6d6d('0x28')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x4cfefc[_0x6d6d('0x33')],_0x4cfefc['linkedid'],_0x4cfefc[_0x6d6d('0x5f')],_0x4cfefc[_0x6d6d('0x60')]);logger[_0x6d6d('0x34')](_0x6d6d('0x61'),_0x4cfefc[_0x6d6d('0x33')],util[_0x6d6d('0x45')](_0x4cfefc,{'showHidden':![],'depth':null}));if(_0x4cfefc['channelstate']!=='6')return;if(_0x4cfefc[_0x6d6d('0x33')]!==_0x4cfefc[_0x6d6d('0x36')]){var _0x3a6d79=moment();if(this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]]){if(!this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]]['answered']){this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]][_0x6d6d('0x62')]=!![];this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]][_0x6d6d('0x63')]=_0x3a6d79[_0x6d6d('0x3f')](_0x6d6d('0x49'));if(this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]][_0x6d6d('0x48')]){this['channels'][_0x4cfefc['linkedid']][_0x6d6d('0x64')]=_0x3a6d79['diff'](this['channels'][_0x4cfefc['linkedid']][_0x6d6d('0x48')],_0x6d6d('0x58'));}}this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]][_0x6d6d('0x36')]=_0x4cfefc[_0x6d6d('0x33')];if(_0x4cfefc['calleridnum']!=='xcally-motion-preview'){this[_0x6d6d('0x16')][_0x4cfefc['linkedid']]['connectedlinenum']=_0x4cfefc['calleridnum'];}this[_0x6d6d('0x16')][_0x4cfefc['linkedid']][_0x6d6d('0x65')]=_0x4cfefc['calleridname'];this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]]['destinationchannel']=_0x4cfefc['channel'];this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]][_0x6d6d('0x4a')]=dispositions[_[_0x6d6d('0x4b')](_0x4cfefc['channelstate'])];if(this[_0x6d6d('0x17')][_0x4cfefc[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]]){this[_0x6d6d('0x16')][_0x4cfefc['linkedid']][_0x6d6d('0x66')]=this['agents'][_0x4cfefc['channel']['split']('-')[0x0]]['id'];this[_0x6d6d('0x16')][_0x4cfefc['linkedid']][_0x6d6d('0x67')]=this[_0x6d6d('0x17')][_0x4cfefc[_0x6d6d('0x3b')]['split']('-')[0x0]]['name'];}}if(this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]]){if(!this['channels'][_0x4cfefc['uniqueid']][_0x6d6d('0x62')]){this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]][_0x6d6d('0x62')]=!![];this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]][_0x6d6d('0x63')]=_0x3a6d79['format']('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x4cfefc['uniqueid']]['starttime']){this['channels'][_0x4cfefc[_0x6d6d('0x33')]][_0x6d6d('0x64')]=_0x3a6d79[_0x6d6d('0x68')](this[_0x6d6d('0x16')][_0x4cfefc['uniqueid']]['starttime'],'seconds');}}if(_0x4cfefc[_0x6d6d('0x60')]!==_0x6d6d('0x3d')){this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]]['connectedlinenum']=_0x4cfefc['calleridnum'];}this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]]['connectedlinename']=_0x4cfefc[_0x6d6d('0x5f')];this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]][_0x6d6d('0x69')]=_0x4cfefc[_0x6d6d('0x3b')];this['channels'][_0x4cfefc[_0x6d6d('0x33')]]['disposition']=dispositions[_[_0x6d6d('0x4b')](_0x4cfefc['channelstate'])];}}else{if(this[_0x6d6d('0x16')][_0x4cfefc['uniqueid']]){if(this[_0x6d6d('0x17')][_0x4cfefc[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]]){this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]][_0x6d6d('0x66')]=this[_0x6d6d('0x17')][_0x4cfefc[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]]['id'];this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]][_0x6d6d('0x67')]=this[_0x6d6d('0x17')][_0x4cfefc[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]][_0x6d6d('0x41')];}}}if(_0x4cfefc['context']==='from-sip'){if(this[_0x6d6d('0x17')][_0x4cfefc['channel'][_0x6d6d('0x3c')]('-')[0x0]]){this[_0x6d6d('0x17')][_0x4cfefc['channel']['split']('-')[0x0]][_0x6d6d('0x4c')]=_0x4cfefc['exten'];var _0x2ab52f,_0x285307;if(this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]]){_0x2ab52f=this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x33')]][_0x6d6d('0x6a')];_0x285307=this[_0x6d6d('0x16')][_0x4cfefc['uniqueid']][_0x6d6d('0x55')];}else if(this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]]){_0x2ab52f=this['channels'][_0x4cfefc['linkedid']][_0x6d6d('0x6a')];_0x285307=this[_0x6d6d('0x16')][_0x4cfefc[_0x6d6d('0x36')]]['queue'];}logger[_0x6d6d('0x34')](_0x6d6d('0x6b'),_0x4cfefc['uniqueid'],util[_0x6d6d('0x45')]({'id':this[_0x6d6d('0x17')][_0x4cfefc[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0x6d6d('0x17')][_0x4cfefc['channel'][_0x6d6d('0x3c')]('-')[0x0]][_0x6d6d('0x43')],'destconnectedlinenum':_0x4cfefc['exten'],'routealias':_0x2ab52f,'queue':_0x285307||undefined},{'showHidden':![],'depth':null}));this['emit'](util[_0x6d6d('0x3f')](_0x6d6d('0x40'),this[_0x6d6d('0x17')][_0x4cfefc[_0x6d6d('0x3b')]['split']('-')[0x0]][_0x6d6d('0x41')]),'user:agentconnect',{'id':this[_0x6d6d('0x17')][_0x4cfefc[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x6d6d('0x17')][_0x4cfefc[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]][_0x6d6d('0x43')],'destconnectedlinenum':_0x4cfefc[_0x6d6d('0x47')],'routealias':_0x2ab52f,'queue':_0x285307||undefined});}}}}catch(_0x103c3d){logger[_0x6d6d('0x2b')](_0x6d6d('0x6c'),_0x4cfefc[_0x6d6d('0x33')],util[_0x6d6d('0x45')](_0x103c3d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6d6d('0x2d')][_0x6d6d('0x6d')]=function(_0x5bcb3d,_0x34bec0){try{if(this[_0x6d6d('0x16')][_0x5bcb3d]){logger[_0x6d6d('0x28')](_0x6d6d('0x6e'),_0x5bcb3d,_0x34bec0);this['channels'][_0x5bcb3d]['monitor']=!![];if(_[_0x6d6d('0x6f')](_0x34bec0,_0x6d6d('0x70'))){_0x34bec0=_0x34bec0[_0x6d6d('0x71')](_0x6d6d('0x70'),_0x6d6d('0x72'));}this[_0x6d6d('0x16')][_0x5bcb3d][_0x6d6d('0x73')]=_0x34bec0;var _0xff9afd=_[_0x6d6d('0x74')](this[_0x6d6d('0x16')][_0x5bcb3d][_0x6d6d('0x75')],{'filename':_0x34bec0});if(_[_0x6d6d('0x76')](_0xff9afd)){this[_0x6d6d('0x16')][_0x5bcb3d][_0x6d6d('0x75')][_0x6d6d('0x77')]({'filename':_0x34bec0,'createdAt':moment()['format'](_0x6d6d('0x49')),'mixmonitorid':'','status':_0x6d6d('0x78')});}}}catch(_0x20a793){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x5bcb3d,util['inspect'](_0x20a793,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6d6d('0x2d')]['syncVarSet']=function(_0x5b1e54){try{if(this[_0x6d6d('0x2e')](_0x5b1e54)){logger[_0x6d6d('0x34')](_0x6d6d('0x79'),_0x5b1e54[_0x6d6d('0x33')],util[_0x6d6d('0x45')](_0x5b1e54,{'showHidden':![],'depth':null}));if(this['channels'][_0x5b1e54[_0x6d6d('0x33')]]&&_0x5b1e54[_0x6d6d('0x3b')]!=_0x6d6d('0x4f')){if(this[_0x6d6d('0x2e')](_0x5b1e54[_0x6d6d('0x7a')])){if(this['isNotNull'](_0x5b1e54[_0x6d6d('0x7a')]['mixmonitor_filename'])){logger[_0x6d6d('0x28')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5b1e54[_0x6d6d('0x33')],_0x5b1e54[_0x6d6d('0x7b')]);this[_0x6d6d('0x6d')](_0x5b1e54['uniqueid'],_0x5b1e54[_0x6d6d('0x7b')]);}else if(this[_0x6d6d('0x2e')](_0x5b1e54['variable'][_0x6d6d('0x7c')])){logger[_0x6d6d('0x28')](_0x6d6d('0x7d'),_0x5b1e54[_0x6d6d('0x33')],_0x5b1e54[_0x6d6d('0x7b')]);this[_0x6d6d('0x16')][_0x5b1e54['uniqueid']][_0x6d6d('0x60')]=_0x5b1e54[_0x6d6d('0x7b')];}else if(this['isNotNull'](_0x5b1e54[_0x6d6d('0x7a')][_0x6d6d('0x7e')])){logger[_0x6d6d('0x28')](_0x6d6d('0x7f'),_0x5b1e54[_0x6d6d('0x33')],_0x5b1e54['value']);this['channels'][_0x5b1e54[_0x6d6d('0x33')]][_0x6d6d('0x80')]=_0x5b1e54[_0x6d6d('0x7b')];}else if(this[_0x6d6d('0x2e')](_0x5b1e54[_0x6d6d('0x7a')][_0x6d6d('0x81')])){logger[_0x6d6d('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5b1e54['uniqueid'],_0x5b1e54[_0x6d6d('0x7b')]);this[_0x6d6d('0x16')][_0x5b1e54['uniqueid']][_0x6d6d('0x5d')]=_0x5b1e54[_0x6d6d('0x7b')];}else if(this[_0x6d6d('0x2e')](_0x5b1e54[_0x6d6d('0x7a')][_0x6d6d('0x82')])){logger['info'](_0x6d6d('0x83'),_0x5b1e54[_0x6d6d('0x33')],_0x5b1e54[_0x6d6d('0x7b')][_0x6d6d('0x3c')](',')[0x0]);this[_0x6d6d('0x16')][_0x5b1e54[_0x6d6d('0x33')]]['queue']=_0x5b1e54[_0x6d6d('0x7b')][_0x6d6d('0x3c')](',')[0x0];}else if(this[_0x6d6d('0x2e')](_0x5b1e54[_0x6d6d('0x7a')][_0x6d6d('0x84')])){logger[_0x6d6d('0x28')](_0x6d6d('0x85'),_0x5b1e54[_0x6d6d('0x33')],_0x5b1e54[_0x6d6d('0x7b')]);this[_0x6d6d('0x16')][_0x5b1e54[_0x6d6d('0x33')]][_0x6d6d('0x86')]=_0x5b1e54[_0x6d6d('0x7b')];}else if(this['isNotNull'](_0x5b1e54[_0x6d6d('0x7a')][_0x6d6d('0x87')])){logger[_0x6d6d('0x28')](_0x6d6d('0x88'),_0x5b1e54['uniqueid'],_0x5b1e54[_0x6d6d('0x7b')]);this[_0x6d6d('0x16')][_0x5b1e54[_0x6d6d('0x33')]][_0x6d6d('0x89')]=_0x5b1e54[_0x6d6d('0x7b')];}else if(this['isNotNull'](_0x5b1e54[_0x6d6d('0x7a')][_0x6d6d('0x8a')])){logger[_0x6d6d('0x28')](_0x6d6d('0x8b'),_0x5b1e54['uniqueid'],_0x5b1e54[_0x6d6d('0x7b')]);this[_0x6d6d('0x16')][_0x5b1e54[_0x6d6d('0x33')]][_0x6d6d('0x8c')]=_0x5b1e54[_0x6d6d('0x7b')];}else if(this[_0x6d6d('0x2e')](_0x5b1e54[_0x6d6d('0x7a')][_0x6d6d('0x8d')])){logger[_0x6d6d('0x28')](_0x6d6d('0x8e'),_0x5b1e54[_0x6d6d('0x33')],_0x5b1e54[_0x6d6d('0x7b')]);this[_0x6d6d('0x16')][_0x5b1e54[_0x6d6d('0x33')]][_0x6d6d('0x55')]=_0x5b1e54['value'];}else if(this[_0x6d6d('0x2e')](_0x5b1e54[_0x6d6d('0x7a')]['sipcallid'])){logger[_0x6d6d('0x28')](_0x6d6d('0x8f'),_0x5b1e54[_0x6d6d('0x33')],_0x5b1e54['value']);this[_0x6d6d('0x16')][_0x5b1e54[_0x6d6d('0x33')]][_0x6d6d('0x90')]=_0x5b1e54[_0x6d6d('0x7b')];}}}else if(this[_0x6d6d('0x2e')](_0x5b1e54[_0x6d6d('0x7a')][_0x6d6d('0x91')])){if(_0x5b1e54[_0x6d6d('0x7b')]){var _0x3f30d1=path[_0x6d6d('0x92')](_0x5b1e54['value'])['name'];logger[_0x6d6d('0x28')](_0x6d6d('0x93'),_0x3f30d1,_0x5b1e54[_0x6d6d('0x7b')]);this[_0x6d6d('0x6d')](_0x3f30d1,_0x5b1e54[_0x6d6d('0x7b')]);}}else if(this[_0x6d6d('0x16')][_0x5b1e54[_0x6d6d('0x36')]]){if(this['isNotNull'](_0x5b1e54[_0x6d6d('0x7a')])){if(this[_0x6d6d('0x2e')](_0x5b1e54[_0x6d6d('0x7a')][_0x6d6d('0x94')])){logger['info'](_0x6d6d('0x8f'),_0x5b1e54[_0x6d6d('0x36')],_0x5b1e54[_0x6d6d('0x7b')]);this['channels'][_0x5b1e54[_0x6d6d('0x36')]][_0x6d6d('0x95')]=_0x5b1e54[_0x6d6d('0x7b')];}}}}}catch(_0x217369){logger[_0x6d6d('0x2b')](_0x6d6d('0x96'),_0x5b1e54[_0x6d6d('0x33')],util[_0x6d6d('0x45')](_0x217369,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6d6d('0x2d')][_0x6d6d('0x20')]=function(_0x193312){try{if(this[_0x6d6d('0x2e')](_0x193312)){logger['debug'](_0x6d6d('0x97'),_0x193312['uniqueid'],util['inspect'](_0x193312,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x193312['linkedid']]){if(this['channels'][this[_0x6d6d('0x18')][_0x193312['linkedid']][_0x6d6d('0x36')]]){this['channels'][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]]['linkedid']]['uniqueid']=_0x193312[_0x6d6d('0x33')];this['channels'][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x36')]]['answered']=this[_0x6d6d('0x16')][_0x193312['uniqueid']][_0x6d6d('0x62')];this[_0x6d6d('0x16')][this['blindTransfers'][_0x193312['linkedid']][_0x6d6d('0x36')]]['answertime']=this[_0x6d6d('0x16')][_0x193312['uniqueid']][_0x6d6d('0x63')];this[_0x6d6d('0x16')][this[_0x6d6d('0x18')][_0x193312['linkedid']]['linkedid']][_0x6d6d('0x69')]=this[_0x6d6d('0x16')][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x36')]][_0x6d6d('0x3b')];this[_0x6d6d('0x16')][this['blindTransfers'][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x36')]][_0x6d6d('0x4a')]=this[_0x6d6d('0x16')][_0x193312[_0x6d6d('0x33')]][_0x6d6d('0x4a')];this[_0x6d6d('0x16')][_0x193312[_0x6d6d('0x33')]]=this[_0x6d6d('0x16')][this['blindTransfers'][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x36')]];delete this[_0x6d6d('0x16')][this['blindTransfers'][_0x193312['linkedid']][_0x6d6d('0x36')]];}else if(this[_0x6d6d('0x16')][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x33')]]){this[_0x6d6d('0x16')][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x33')]]['uniqueid']=[this['channels'][this['blindTransfers'][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x33')]][_0x6d6d('0x36')],this[_0x6d6d('0x16')][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x33')]][_0x6d6d('0x36')]=this[_0x6d6d('0x16')][this[_0x6d6d('0x18')][_0x193312['linkedid']]['uniqueid']]['uniqueid']][0x0];this['channels'][this[_0x6d6d('0x18')][_0x193312['linkedid']][_0x6d6d('0x33')]]['answered']=this[_0x6d6d('0x16')][_0x193312[_0x6d6d('0x33')]]['answered'];this['channels'][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x33')]][_0x6d6d('0x63')]=this['channels'][_0x193312['uniqueid']][_0x6d6d('0x63')];this['channels'][this[_0x6d6d('0x18')][_0x193312['linkedid']][_0x6d6d('0x33')]][_0x6d6d('0x69')]=this[_0x6d6d('0x16')][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]]['uniqueid']]['channel'];this[_0x6d6d('0x16')][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x33')]][_0x6d6d('0x4a')]=this[_0x6d6d('0x16')][_0x193312[_0x6d6d('0x33')]][_0x6d6d('0x4a')];this['channels'][_0x193312[_0x6d6d('0x33')]]=this[_0x6d6d('0x16')][this[_0x6d6d('0x18')][_0x193312[_0x6d6d('0x36')]][_0x6d6d('0x33')]];delete this['channels'][this[_0x6d6d('0x18')][_0x193312['linkedid']]['uniqueid']];}}if(this[_0x6d6d('0x16')][_0x193312['uniqueid']]){logger['info'](_0x6d6d('0x98'),_0x193312[_0x6d6d('0x33')],_0x193312[_0x6d6d('0x99')]);var _0x2545ff=moment();this['channels'][_0x193312[_0x6d6d('0x33')]][_0x6d6d('0x9a')]=_0x2545ff[_0x6d6d('0x3f')](_0x6d6d('0x49'));this['channels'][_0x193312[_0x6d6d('0x33')]][_0x6d6d('0x57')]=_0x2545ff['diff'](this['channels'][_0x193312[_0x6d6d('0x33')]][_0x6d6d('0x48')],'seconds');if(this[_0x6d6d('0x16')][_0x193312[_0x6d6d('0x33')]][_0x6d6d('0x62')]){this[_0x6d6d('0x16')][_0x193312[_0x6d6d('0x33')]][_0x6d6d('0x9b')]=_0x2545ff[_0x6d6d('0x68')](this[_0x6d6d('0x16')][_0x193312[_0x6d6d('0x33')]][_0x6d6d('0x63')],_0x6d6d('0x58'));this[_0x6d6d('0x16')][_0x193312['uniqueid']][_0x6d6d('0x64')]=this['channels'][_0x193312[_0x6d6d('0x33')]][_0x6d6d('0x57')]-this[_0x6d6d('0x16')][_0x193312['uniqueid']]['billableseconds'];}if(_0x193312[_0x6d6d('0x46')]===_0x6d6d('0x3a')){if(this[_0x6d6d('0x17')][_0x193312[_0x6d6d('0x3b')]['split']('-')[0x0]]){this[_0x6d6d('0x17')][_0x193312['channel'][_0x6d6d('0x3c')]('-')[0x0]]=_['omit'](this[_0x6d6d('0x17')][_0x193312[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]],['destconnectedlinenum']);logger[_0x6d6d('0x34')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x193312[_0x6d6d('0x33')],util[_0x6d6d('0x45')]({'id':this['agents'][_0x193312[_0x6d6d('0x3b')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x6d6d('0x17')][_0x193312[_0x6d6d('0x3b')]['split']('-')[0x0]][_0x6d6d('0x43')]},{'showHidden':![],'depth':null}));this[_0x6d6d('0x30')](util['format'](_0x6d6d('0x40'),this[_0x6d6d('0x17')][_0x193312[_0x6d6d('0x3b')][_0x6d6d('0x3c')]('-')[0x0]]['name']),_0x6d6d('0x9c'),{'id':this[_0x6d6d('0x17')][_0x193312[_0x6d6d('0x3b')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x6d6d('0x17')][_0x193312[_0x6d6d('0x3b')]['split']('-')[0x0]]['accountcode']});for(var _0x49e97f=0x0;_0x49e97f0x0?_0xc8cb4c:0x0;this[_0xb5c2('0x14')][_0x80ffe7[_0xb5c2('0x6b')]]['talking']=this['voiceQueues'][_0x80ffe7[_0xb5c2('0x6b')]]['talking']>_[_0xb5c2('0x6d')](_0x80ffe7[_0xb5c2('0x6f')])?_['toNumber'](_0x80ffe7[_0xb5c2('0x6f')]):this[_0xb5c2('0x14')][_0x80ffe7[_0xb5c2('0x6b')]][_0xb5c2('0x57')];this[_0xb5c2('0x4f')](this[_0xb5c2('0x14')][_0x80ffe7[_0xb5c2('0x6b')]],_0xb5c2('0x17'));}logger[_0xb5c2('0x5c')](_0xb5c2('0x70'),util[_0xb5c2('0x3a')](this['voiceQueues'][_0x80ffe7[_0xb5c2('0x6b')]],{'showHidden':![],'depth':null}));ami[_0xb5c2('0x41')](_0xb5c2('0x71'),this[_0xb5c2('0x14')][_0x80ffe7['queue']]);}}}catch(_0x2678cb){logger[_0xb5c2('0x3c')](_0xb5c2('0x67'),util[_0xb5c2('0x3a')](_0x2678cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')][_0xb5c2('0x1b')]=function(_0x43b3be){logger[_0xb5c2('0x5c')](_0xb5c2('0x72'),util[_0xb5c2('0x3a')](_0x43b3be,{'showHidden':![],'depth':null}));this[_0xb5c2('0x65')]=!![];};VoiceQueueReport['prototype'][_0xb5c2('0x73')]=function(_0x51ee5d){try{if(this['isNotNull'](_0x51ee5d)){logger[_0xb5c2('0x5c')](_0xb5c2('0x74'),_0x51ee5d['uniqueid'],util['inspect'](_0x51ee5d,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x51ee5d[_0xb5c2('0x45')]]))this[_0xb5c2('0x11')][_0x51ee5d[_0xb5c2('0x45')]]=[];if(_[_0xb5c2('0x75')](this[_0xb5c2('0x13')][_0x51ee5d[_0xb5c2('0x45')]]))this[_0xb5c2('0x13')][_0x51ee5d[_0xb5c2('0x45')]]={};var _0xc61b88=new QueueReport();_0xc61b88[_0xb5c2('0x4d')]=_0x51ee5d[_0xb5c2('0x6b')];_0xc61b88[_0xb5c2('0x76')]=this[_0xb5c2('0x14')][_0xc61b88[_0xb5c2('0x4d')]]&&this['voiceQueues'][_0xc61b88[_0xb5c2('0x4d')]][_0xb5c2('0x76')]?this[_0xb5c2('0x14')][_0xc61b88['name']][_0xb5c2('0x76')]||'inbound':_0xb5c2('0x50');_0xc61b88[_0xb5c2('0x6b')]=_0x51ee5d[_0xb5c2('0x6b')];_0xc61b88[_0xb5c2('0x77')]=moment()['format'](_0xb5c2('0x78'));_0xc61b88[_0xb5c2('0x79')]=_0x51ee5d['position'];_0xc61b88[_0xb5c2('0x7a')]=_0x51ee5d[_0xb5c2('0x7a')];_0xc61b88[_0xb5c2('0x45')]=_0x51ee5d['uniqueid'];_0xc61b88['routealias']=this[_0xb5c2('0x13')][_0x51ee5d[_0xb5c2('0x45')]]['routealias'];logger[_0xb5c2('0x69')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0xc61b88[_0xb5c2('0x4d')],_0xc61b88['type']);_['merge'](_0xc61b88,_[_0xb5c2('0x7b')](_0x51ee5d,_['keys'](_0xc61b88)));this[_0xb5c2('0x11')][_0x51ee5d[_0xb5c2('0x45')]]['push'](_0xc61b88);this['channels'][_0x51ee5d[_0xb5c2('0x45')]]=_0xc61b88;this[_0xb5c2('0x42')](_0xc61b88,_0xb5c2('0x1c'));}}catch(_0x51ee96){logger[_0xb5c2('0x3c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x51ee5d[_0xb5c2('0x45')],util['inspect'](_0x51ee96,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')][_0xb5c2('0x1d')]=function(_0x484637){try{if(this[_0xb5c2('0x5f')](_0x484637)){logger[_0xb5c2('0x5c')](_0xb5c2('0x7c'),_0x484637[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x484637,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x484637[_0xb5c2('0x45')]]){var _0x29121f=_['last'](this[_0xb5c2('0x11')][_0x484637[_0xb5c2('0x45')]]);_0x29121f['queuecallercomplete']=![];_0x29121f[_0xb5c2('0x7d')]=null;_0x29121f[_0xb5c2('0x7e')]=_0x484637['holdtime'];_0x29121f[_0xb5c2('0x7f')]=_0x484637[_0xb5c2('0x7f')];_0x29121f['queuecallerabandon']=!![];_0x29121f[_0xb5c2('0x80')]=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));_0x29121f['queuecallerexitreason']=_0xb5c2('0x81');_0x29121f[_0xb5c2('0x82')]=null;logger[_0xb5c2('0x69')](_0xb5c2('0x83'),_0x29121f[_0xb5c2('0x4d')],_0x29121f[_0xb5c2('0x76')]);this[_0xb5c2('0x13')][_0x484637[_0xb5c2('0x45')]]=_0x29121f;this[_0xb5c2('0x84')](_0x29121f,'queuecallerabandon');}}}catch(_0x6d2af6){logger[_0xb5c2('0x3c')](_0xb5c2('0x7c'),_0x484637[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x6d2af6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')]['syncQueueCallerLeave']=function(_0x2d7274){try{if(this[_0xb5c2('0x5f')](_0x2d7274)){logger['debug'](_0xb5c2('0x85'),_0x2d7274[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x2d7274,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x2d7274[_0xb5c2('0x45')]]){var _0x2ecc74=_[_0xb5c2('0x86')](this['queueReports'][_0x2d7274[_0xb5c2('0x45')]]);_0x2ecc74[_0xb5c2('0x87')]=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));_0x2ecc74[_0xb5c2('0x88')]=_0x2d7274['connectedlinenum'];_0x2ecc74[_0xb5c2('0x89')]=_0x2d7274[_0xb5c2('0x89')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2ecc74[_0xb5c2('0x4d')],_0x2ecc74[_0xb5c2('0x76')],_0x2d7274[_0xb5c2('0x88')],_0x2d7274[_0xb5c2('0x89')]);this[_0xb5c2('0x13')][_0x2d7274[_0xb5c2('0x45')]]=_0x2ecc74;this[_0xb5c2('0x42')](_0x2ecc74,'queuecallerleave');}}}catch(_0x371a2c){logger[_0xb5c2('0x3c')](_0xb5c2('0x85'),_0x2d7274[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x371a2c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')][_0xb5c2('0x22')]=function(_0x18bed8){try{if(this[_0xb5c2('0x5f')](_0x18bed8)){logger[_0xb5c2('0x5c')](_0xb5c2('0x8a'),_0x18bed8['uniqueid'],util['inspect'](_0x18bed8,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x18bed8[_0xb5c2('0x45')]]){var _0x5b067f=_[_0xb5c2('0x86')](this['queueReports'][_0x18bed8[_0xb5c2('0x45')]]);_0x5b067f[_0xb5c2('0x8b')]=!![];_0x5b067f[_0xb5c2('0x4b')]='COMPLETEDBYAGENT';logger[_0xb5c2('0x69')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5b067f[_0xb5c2('0x4d')],_0x5b067f['type']);}}}catch(_0x260776){logger[_0xb5c2('0x3c')](_0xb5c2('0x8a'),_0x18bed8[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x260776,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x1a1d9a){try{if(this[_0xb5c2('0x5f')](_0x1a1d9a)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x1a1d9a['uniqueid'],util[_0xb5c2('0x3a')](_0x1a1d9a,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x45')]]){var _0x11e82d=_[_0xb5c2('0x86')](this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x45')]]);_0x11e82d[_0xb5c2('0x8c')]=![];_0x11e82d[_0xb5c2('0x80')]=null;_0x11e82d[_0xb5c2('0x8d')]=!![];_0x11e82d[_0xb5c2('0x82')]=_0x1a1d9a[_0xb5c2('0x8e')];_0x11e82d[_0xb5c2('0x7e')]=_0x1a1d9a['holdtime'];_0x11e82d[_0xb5c2('0x8b')]=!![];_0x11e82d['queuecallerexit']=![];_0x11e82d['queuecallerexitAt']=null;if(!_0x11e82d[_0xb5c2('0x8f')]){if(_0x1a1d9a[_0xb5c2('0x90')]==_0xb5c2('0x8f')){_0x11e82d[_0xb5c2('0x4b')]=_0xb5c2('0x91');logger[_0xb5c2('0x69')](_0xb5c2('0x92'),_0x11e82d[_0xb5c2('0x4d')],_0x11e82d[_0xb5c2('0x76')]);}else{if(_['startsWith'](_0x1a1d9a[_0xb5c2('0x37')][_0xb5c2('0x93')](),_0xb5c2('0x94'))){if(this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x95')]]){var _0xcfcb8b=_['last'](this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x95')]]);_0xcfcb8b['queuecallercomplete']=![];_0xcfcb8b[_0xb5c2('0x96')]=!![];_0xcfcb8b[_0xb5c2('0x97')]=moment(_0x11e82d[_0xb5c2('0x77')])[_0xb5c2('0x98')](_0x1a1d9a[_0xb5c2('0x7e')],_0xb5c2('0x99'))[_0xb5c2('0x46')](_0xb5c2('0x78'));_0xcfcb8b['queuecallerexitreason']=_0xb5c2('0x9a');_0xcfcb8b[_0xb5c2('0x8f')]=!![];_0xcfcb8b[_0xb5c2('0x9b')]='FORWARD';_0xcfcb8b[_0xb5c2('0x9c')]=_0x1a1d9a[_0xb5c2('0x9d')];_0xcfcb8b[_0xb5c2('0x9e')]=_0x1a1d9a[_0xb5c2('0x45')];logger[_0xb5c2('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0xcfcb8b['name'],_0xcfcb8b[_0xb5c2('0x76')]);var _0x5a38c4=this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x95')]];this[_0xb5c2('0x11')][_0x1a1d9a['linkedid']]=this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x45')]];this[_0xb5c2('0x11')][_0x1a1d9a['uniqueid']]=_0x5a38c4;}}else{_0x11e82d[_0xb5c2('0x4b')]=_0xb5c2('0x9f')+_0x1a1d9a['reason']['toUpperCase']();logger[_0xb5c2('0x69')](_0xb5c2('0xa0'),_0x11e82d[_0xb5c2('0x4d')],_0x11e82d[_0xb5c2('0x76')],_0x11e82d[_0xb5c2('0x4b')]);}}}this[_0xb5c2('0x13')][_0x1a1d9a[_0xb5c2('0x45')]]=_0x11e82d;this[_0xb5c2('0x84')](_0x11e82d,_0xb5c2('0xa1'));}}}catch(_0xd0b72b){logger['error'](_0xb5c2('0xa2'),_0x1a1d9a['uniqueid'],util[_0xb5c2('0x3a')](_0xd0b72b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')][_0xb5c2('0x24')]=function(_0x430f08){try{if(this['isNotNull'](_0x430f08)){logger['debug'](_0xb5c2('0xa3'),_0x430f08[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x430f08,{'showHidden':![],'depth':null}));this[_0xb5c2('0xa4')](_0x430f08['uniqueid'],_['keys'](_0x430f08['variable'])[0x0],_0x430f08['value']);if(this[_0xb5c2('0x11')][_0x430f08['uniqueid']]){var _0x422410=_[_0xb5c2('0x86')](this[_0xb5c2('0x11')][_0x430f08[_0xb5c2('0x45')]]);if(_0x422410){if(this[_0xb5c2('0x5f')](_0x430f08[_0xb5c2('0xa5')])&&this[_0xb5c2('0x5f')](_0x430f08[_0xb5c2('0xa5')]['queuestatus'])){switch(_0x430f08[_0xb5c2('0xa6')]){case'CONTINUE':_0x422410['queuecallerexit']=![];_0x422410[_0xb5c2('0x97')]=null;break;case _0xb5c2('0xa7'):_0x422410['lastevent']=_0xb5c2('0xa8');_0x422410['queuecallerexit']=!![];_0x422410['queuecallerexitAt']=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));_0x422410['queuecallerleaveAt']=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));logger[_0xb5c2('0x5c')](_0xb5c2('0xa9'),_0x430f08[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x422410,{'showHidden':![],'depth':null}));ami[_0xb5c2('0x41')](_0xb5c2('0xaa'),_0x422410);break;default:_0x422410[_0xb5c2('0x96')]=!![];_0x422410[_0xb5c2('0x97')]=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));_0x422410[_0xb5c2('0x87')]=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));}_0x422410[_0xb5c2('0x8c')]=![];_0x422410[_0xb5c2('0x80')]=null;_0x422410['queuecallerexitreason']=_0x430f08['value'];this[_0xb5c2('0x13')][_0x430f08[_0xb5c2('0x45')]]=_0x422410;this[_0xb5c2('0x84')](_0x422410,_0xb5c2('0x23'));}else if(this[_0xb5c2('0x5f')](_0x430f08['variable'])&&this[_0xb5c2('0x5f')](_0x430f08[_0xb5c2('0xa5')][_0xb5c2('0xab')])){if(!_0x422410['queuecallerabandon']){_0x422410[_0xb5c2('0x96')]=!![];_0x422410[_0xb5c2('0x97')]=moment()[_0xb5c2('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x422410[_0xb5c2('0x4b')]=_0xb5c2('0xac');_0x422410[_0xb5c2('0x87')]=moment()['format'](_0xb5c2('0x78'));this[_0xb5c2('0x13')][_0x430f08[_0xb5c2('0x45')]]=_0x422410;}}logger[_0xb5c2('0x69')](_0xb5c2('0xad'),_0x430f08[_0xb5c2('0x45')],_0x422410['name'],_0x422410[_0xb5c2('0x76')],_[_0xb5c2('0xae')](_0x430f08['variable'])[0x0],_0x430f08[_0xb5c2('0xa6')]);_0x422410[_0xb5c2('0x16')]=this['variables'][_0x430f08['uniqueid']];}}}}catch(_0xf3ac7c){logger[_0xb5c2('0x3c')](_0xb5c2('0xa3'),_0x430f08[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0xf3ac7c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb5c2('0xa4')]=function(_0x9338a0,_0x1c3b6e,_0x227fe4){var _0x2c3936=[_0xb5c2('0xaf'),_0xb5c2('0xb0'),_0xb5c2('0xb1'),_0xb5c2('0xb2'),'rtpaudioqosloss',_0xb5c2('0xb3'),_0xb5c2('0xb4'),_0xb5c2('0xb5'),_0xb5c2('0xb6'),'sipuri',_0xb5c2('0xb7'),'bridgepvtcallid','membercalls','memberdynamic',_0xb5c2('0xb8'),_0xb5c2('0xb9'),_0xb5c2('0x8e'),_0xb5c2('0xba'),'memberrealtime'];if(!_['isNil'](_0x1c3b6e)&&!_[_0xb5c2('0xbb')](_0x2c3936,_0x1c3b6e)){if(_[_0xb5c2('0x75')](this[_0xb5c2('0x16')][_0x9338a0])){this[_0xb5c2('0x16')][_0x9338a0]={};}this['variables'][_0x9338a0][_0x1c3b6e]=_0x227fe4;}};VoiceQueueReport['prototype'][_0xb5c2('0x26')]=function(_0x19c402){try{if(this['isNotNull'](_0x19c402)){logger[_0xb5c2('0x5c')]('[%s][voiceQueueReport][hangup]',_0x19c402[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x19c402,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x19c402['uniqueid']]){for(var _0x542087=0x0,_0x555304={};_0x5420870x0?_0x1cb521:0x0;this[_0x9bac('0xf')][_0x1dd9f1[_0x9bac('0x67')]]['talking']=this[_0x9bac('0xf')][_0x1dd9f1[_0x9bac('0x67')]][_0x9bac('0x2e')]>_[_0x9bac('0x6f')](_0x1dd9f1[_0x9bac('0x6d')])?_[_0x9bac('0x6f')](_0x1dd9f1[_0x9bac('0x6d')]):this['voiceQueues'][_0x1dd9f1[_0x9bac('0x67')]][_0x9bac('0x2e')];this[_0x9bac('0x4f')](this[_0x9bac('0xf')][_0x1dd9f1[_0x9bac('0x67')]],_0x9bac('0x12'));}logger[_0x9bac('0x4a')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x9bac('0x3b')](this[_0x9bac('0xf')][_0x1dd9f1[_0x9bac('0x67')]],{'showHidden':![],'depth':null}));ami[_0x9bac('0x41')](_0x9bac('0x71'),this[_0x9bac('0xf')][_0x1dd9f1[_0x9bac('0x67')]]);}}}catch(_0x5aa1e2){logger[_0x9bac('0x39')](_0x9bac('0x72'),util[_0x9bac('0x3b')](_0x5aa1e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9bac('0xa')]['syncQueueSummaryComplete']=function(_0x137be2){logger[_0x9bac('0x4a')](_0x9bac('0x73'),util[_0x9bac('0x3b')](_0x137be2,{'showHidden':![],'depth':null}));this[_0x9bac('0x66')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x24c85b){try{if(this[_0x9bac('0x61')](_0x24c85b)){logger[_0x9bac('0x4a')](_0x9bac('0x74'),_0x24c85b[_0x9bac('0x45')],util[_0x9bac('0x3b')](_0x24c85b,{'showHidden':![],'depth':null}));if(_[_0x9bac('0x62')](this[_0x9bac('0xd')][_0x24c85b[_0x9bac('0x45')]]))this[_0x9bac('0xd')][_0x24c85b[_0x9bac('0x45')]]=[];if(_[_0x9bac('0x62')](this['channels'][_0x24c85b['uniqueid']]))this[_0x9bac('0x32')][_0x24c85b[_0x9bac('0x45')]]={};var _0x184e92=new QueueReport();_0x184e92['name']=_0x24c85b[_0x9bac('0x67')];_0x184e92[_0x9bac('0x50')]=this[_0x9bac('0xf')][_0x184e92[_0x9bac('0x48')]]&&this[_0x9bac('0xf')][_0x184e92['name']][_0x9bac('0x50')]?this[_0x9bac('0xf')][_0x184e92['name']][_0x9bac('0x50')]||_0x9bac('0x51'):_0x9bac('0x51');_0x184e92[_0x9bac('0x67')]=_0x24c85b[_0x9bac('0x67')];_0x184e92[_0x9bac('0x75')]=moment()[_0x9bac('0x46')](_0x9bac('0x76'));_0x184e92[_0x9bac('0x77')]=_0x24c85b['position'];_0x184e92[_0x9bac('0x78')]=_0x24c85b[_0x9bac('0x78')];_0x184e92[_0x9bac('0x45')]=_0x24c85b[_0x9bac('0x45')];_0x184e92[_0x9bac('0x79')]=this[_0x9bac('0x32')][_0x24c85b[_0x9bac('0x45')]][_0x9bac('0x79')];logger[_0x9bac('0x69')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x184e92[_0x9bac('0x48')],_0x184e92[_0x9bac('0x50')]);_[_0x9bac('0x7a')](_0x184e92,_[_0x9bac('0x7b')](_0x24c85b,_[_0x9bac('0x7c')](_0x184e92)));this[_0x9bac('0xd')][_0x24c85b[_0x9bac('0x45')]][_0x9bac('0x7d')](_0x184e92);this[_0x9bac('0x32')][_0x24c85b[_0x9bac('0x45')]]=_0x184e92;this[_0x9bac('0x42')](_0x184e92,'queuecallerjoin');}}catch(_0x895961){logger[_0x9bac('0x39')](_0x9bac('0x74'),_0x24c85b['uniqueid'],util['inspect'](_0x895961,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9bac('0xa')]['syncQueueCallerAbandon']=function(_0x4e83e2){try{if(this[_0x9bac('0x61')](_0x4e83e2)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x4e83e2[_0x9bac('0x45')],util[_0x9bac('0x3b')](_0x4e83e2,{'showHidden':![],'depth':null}));if(this[_0x9bac('0xd')][_0x4e83e2[_0x9bac('0x45')]]){var _0x3c7f22=_['last'](this['queueReports'][_0x4e83e2[_0x9bac('0x45')]]);_0x3c7f22[_0x9bac('0x7e')]=![];_0x3c7f22[_0x9bac('0x7f')]=null;_0x3c7f22['holdtime']=_0x4e83e2['holdtime'];_0x3c7f22[_0x9bac('0x80')]=_0x4e83e2[_0x9bac('0x80')];_0x3c7f22['queuecallerabandon']=!![];_0x3c7f22[_0x9bac('0x81')]=moment()[_0x9bac('0x46')](_0x9bac('0x76'));_0x3c7f22[_0x9bac('0x4b')]=_0x9bac('0x82');_0x3c7f22[_0x9bac('0x83')]=null;logger[_0x9bac('0x69')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x3c7f22['name'],_0x3c7f22[_0x9bac('0x50')]);this[_0x9bac('0x32')][_0x4e83e2[_0x9bac('0x45')]]=_0x3c7f22;this[_0x9bac('0x40')](_0x3c7f22,_0x9bac('0x84'));}}}catch(_0x2af6d2){logger[_0x9bac('0x39')](_0x9bac('0x85'),_0x4e83e2[_0x9bac('0x45')],util[_0x9bac('0x3b')](_0x2af6d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9bac('0xa')][_0x9bac('0x19')]=function(_0x3430ea){try{if(this[_0x9bac('0x61')](_0x3430ea)){logger[_0x9bac('0x4a')](_0x9bac('0x86'),_0x3430ea[_0x9bac('0x45')],util['inspect'](_0x3430ea,{'showHidden':![],'depth':null}));if(this[_0x9bac('0xd')][_0x3430ea[_0x9bac('0x45')]]){var _0x5e26c5=_[_0x9bac('0x87')](this[_0x9bac('0xd')][_0x3430ea[_0x9bac('0x45')]]);_0x5e26c5[_0x9bac('0x88')]=moment()[_0x9bac('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e26c5[_0x9bac('0x89')]=_0x3430ea['connectedlinenum'];_0x5e26c5['connectedlinename']=_0x3430ea[_0x9bac('0x8a')];logger[_0x9bac('0x69')](_0x9bac('0x8b'),_0x5e26c5[_0x9bac('0x48')],_0x5e26c5[_0x9bac('0x50')],_0x3430ea[_0x9bac('0x89')],_0x3430ea[_0x9bac('0x8a')]);this[_0x9bac('0x32')][_0x3430ea[_0x9bac('0x45')]]=_0x5e26c5;this['emitVoiceQueueChannelSave'](_0x5e26c5,'queuecallerleave');}}}catch(_0x14ebf6){logger['error'](_0x9bac('0x86'),_0x3430ea[_0x9bac('0x45')],util[_0x9bac('0x3b')](_0x14ebf6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9bac('0xa')][_0x9bac('0x1c')]=function(_0x1ad690){try{if(this['isNotNull'](_0x1ad690)){logger[_0x9bac('0x4a')](_0x9bac('0x8c'),_0x1ad690['uniqueid'],util[_0x9bac('0x3b')](_0x1ad690,{'showHidden':![],'depth':null}));if(this[_0x9bac('0xd')][_0x1ad690[_0x9bac('0x45')]]){var _0x14b83=_['last'](this[_0x9bac('0xd')][_0x1ad690['uniqueid']]);_0x14b83[_0x9bac('0x7e')]=!![];_0x14b83[_0x9bac('0x4b')]=_0x9bac('0x8d');logger[_0x9bac('0x69')](_0x9bac('0x8e'),_0x14b83['name'],_0x14b83[_0x9bac('0x50')]);}}}catch(_0x525022){logger[_0x9bac('0x39')](_0x9bac('0x8c'),_0x1ad690['uniqueid'],util[_0x9bac('0x3b')](_0x525022,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9bac('0xa')][_0x9bac('0x8f')]=function(_0x10a5a6){try{if(this[_0x9bac('0x61')](_0x10a5a6)){logger['debug'](_0x9bac('0x90'),_0x10a5a6[_0x9bac('0x45')],util[_0x9bac('0x3b')](_0x10a5a6,{'showHidden':![],'depth':null}));if(this[_0x9bac('0xd')][_0x10a5a6[_0x9bac('0x45')]]){var _0x35b323=_[_0x9bac('0x87')](this['queueReports'][_0x10a5a6['uniqueid']]);_0x35b323[_0x9bac('0x84')]=![];_0x35b323[_0x9bac('0x81')]=null;_0x35b323[_0x9bac('0x91')]=!![];_0x35b323[_0x9bac('0x83')]=_0x10a5a6[_0x9bac('0x92')];_0x35b323[_0x9bac('0x93')]=_0x10a5a6[_0x9bac('0x93')];_0x35b323[_0x9bac('0x7e')]=!![];_0x35b323[_0x9bac('0x94')]=![];_0x35b323[_0x9bac('0x95')]=null;if(!_0x35b323[_0x9bac('0x96')]){if(_0x10a5a6[_0x9bac('0x97')]==_0x9bac('0x96')){_0x35b323[_0x9bac('0x4b')]=_0x9bac('0x98');logger[_0x9bac('0x69')](_0x9bac('0x99'),_0x35b323['name'],_0x35b323['type']);}else{if(_['startsWith'](_0x10a5a6[_0x9bac('0x36')]['toLowerCase'](),'local/')){if(this['queueReports'][_0x10a5a6[_0x9bac('0x9a')]]){var _0x11d744=_[_0x9bac('0x87')](this['queueReports'][_0x10a5a6[_0x9bac('0x9a')]]);_0x11d744['queuecallercomplete']=![];_0x11d744[_0x9bac('0x94')]=!![];_0x11d744[_0x9bac('0x95')]=moment(_0x35b323[_0x9bac('0x75')])[_0x9bac('0x9b')](_0x10a5a6[_0x9bac('0x93')],_0x9bac('0x9c'))[_0x9bac('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x11d744[_0x9bac('0x4b')]=_0x9bac('0x9d');_0x11d744[_0x9bac('0x96')]=!![];_0x11d744[_0x9bac('0x9e')]=_0x9bac('0x9f');_0x11d744[_0x9bac('0xa0')]=_0x10a5a6[_0x9bac('0xa1')];_0x11d744[_0x9bac('0xa2')]=_0x10a5a6['uniqueid'];logger['info'](_0x9bac('0xa3'),_0x11d744[_0x9bac('0x48')],_0x11d744['type']);var _0x11f46c=this[_0x9bac('0xd')][_0x10a5a6[_0x9bac('0x9a')]];this['queueReports'][_0x10a5a6['linkedid']]=this[_0x9bac('0xd')][_0x10a5a6[_0x9bac('0x45')]];this[_0x9bac('0xd')][_0x10a5a6['uniqueid']]=_0x11f46c;}}else{_0x35b323[_0x9bac('0x4b')]=_0x9bac('0xa4')+_0x10a5a6[_0x9bac('0x97')][_0x9bac('0xa5')]();logger[_0x9bac('0x69')](_0x9bac('0xa6'),_0x35b323['name'],_0x35b323[_0x9bac('0x50')],_0x35b323[_0x9bac('0x4b')]);}}}this[_0x9bac('0x32')][_0x10a5a6[_0x9bac('0x45')]]=_0x35b323;this['emitVoiceQueueChannelRemove'](_0x35b323,_0x9bac('0x1a'));}}}catch(_0x7a395a){logger['error'](_0x9bac('0x90'),_0x10a5a6['uniqueid'],util[_0x9bac('0x3b')](_0x7a395a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9bac('0xa')][_0x9bac('0x1d')]=function(_0x22fcef){try{if(this[_0x9bac('0x61')](_0x22fcef)){logger['debug']('[%s][voiceQueueReport][varset]',_0x22fcef[_0x9bac('0x45')],util[_0x9bac('0x3b')](_0x22fcef,{'showHidden':![],'depth':null}));this[_0x9bac('0xa7')](_0x22fcef[_0x9bac('0x45')],_[_0x9bac('0x7c')](_0x22fcef[_0x9bac('0xa8')])[0x0],_0x22fcef[_0x9bac('0xa9')]);if(this['queueReports'][_0x22fcef['uniqueid']]){var _0x38a989=_['last'](this[_0x9bac('0xd')][_0x22fcef[_0x9bac('0x45')]]);if(_0x38a989){if(this[_0x9bac('0x61')](_0x22fcef[_0x9bac('0xa8')])&&this[_0x9bac('0x61')](_0x22fcef[_0x9bac('0xa8')][_0x9bac('0xaa')])){switch(_0x22fcef[_0x9bac('0xa9')]){case'CONTINUE':_0x38a989[_0x9bac('0x94')]=![];_0x38a989['queuecallerexitAt']=null;break;case'TIMEOUT':_0x38a989[_0x9bac('0xab')]=_0x9bac('0xac');_0x38a989[_0x9bac('0x94')]=!![];_0x38a989[_0x9bac('0x95')]=moment()[_0x9bac('0x46')](_0x9bac('0x76'));_0x38a989[_0x9bac('0x88')]=moment()[_0x9bac('0x46')](_0x9bac('0x76'));logger[_0x9bac('0x4a')](_0x9bac('0xad'),_0x22fcef[_0x9bac('0x45')],util['inspect'](_0x38a989,{'showHidden':![],'depth':null}));ami[_0x9bac('0x41')](_0x9bac('0xae'),_0x38a989);break;default:_0x38a989[_0x9bac('0x94')]=!![];_0x38a989[_0x9bac('0x95')]=moment()[_0x9bac('0x46')](_0x9bac('0x76'));_0x38a989[_0x9bac('0x88')]=moment()['format'](_0x9bac('0x76'));}_0x38a989[_0x9bac('0x84')]=![];_0x38a989[_0x9bac('0x81')]=null;_0x38a989[_0x9bac('0x4b')]=_0x22fcef[_0x9bac('0xa9')];this['channels'][_0x22fcef[_0x9bac('0x45')]]=_0x38a989;this[_0x9bac('0x40')](_0x38a989,_0x9bac('0xaf'));}else if(this['isNotNull'](_0x22fcef['variable'])&&this[_0x9bac('0x61')](_0x22fcef[_0x9bac('0xa8')][_0x9bac('0xb0')])){if(!_0x38a989[_0x9bac('0x84')]){_0x38a989[_0x9bac('0x94')]=!![];_0x38a989['queuecallerexitAt']=moment()[_0x9bac('0x46')](_0x9bac('0x76'));_0x38a989['queuecallerexitreason']=_0x9bac('0xb1');_0x38a989['queuecallerleaveAt']=moment()[_0x9bac('0x46')](_0x9bac('0x76'));this[_0x9bac('0x32')][_0x22fcef[_0x9bac('0x45')]]=_0x38a989;}}logger[_0x9bac('0x69')](_0x9bac('0xb2'),_0x22fcef[_0x9bac('0x45')],_0x38a989[_0x9bac('0x48')],_0x38a989['type'],_[_0x9bac('0x7c')](_0x22fcef[_0x9bac('0xa8')])[0x0],_0x22fcef['value']);_0x38a989['variables']=this[_0x9bac('0x11')][_0x22fcef[_0x9bac('0x45')]];}}}}catch(_0x1c2ef7){logger[_0x9bac('0x39')](_0x9bac('0xb3'),_0x22fcef[_0x9bac('0x45')],util[_0x9bac('0x3b')](_0x1c2ef7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9bac('0xa')]['addVariable']=function(_0x514fc6,_0x965518,_0x5626cb){var _0x5e3fac=[_0x9bac('0xb4'),'rtpaudioqosbridged',_0x9bac('0xb5'),'rtpaudioqosjitterbridged',_0x9bac('0xb6'),'rtpaudioqoslossbridged',_0x9bac('0xb7'),_0x9bac('0xb8'),_0x9bac('0xb9'),_0x9bac('0xba'),_0x9bac('0xbb'),_0x9bac('0xbc'),_0x9bac('0xbd'),_0x9bac('0xbe'),'memberinterface',_0x9bac('0xbf'),_0x9bac('0x92'),_0x9bac('0xc0'),'memberrealtime'];if(!_['isNil'](_0x965518)&&!_[_0x9bac('0xc1')](_0x5e3fac,_0x965518)){if(_[_0x9bac('0x62')](this[_0x9bac('0x11')][_0x514fc6])){this[_0x9bac('0x11')][_0x514fc6]={};}this[_0x9bac('0x11')][_0x514fc6][_0x965518]=_0x5626cb;}};VoiceQueueReport[_0x9bac('0xa')][_0x9bac('0x1f')]=function(_0x552dc6){try{if(this[_0x9bac('0x61')](_0x552dc6)){logger[_0x9bac('0x4a')](_0x9bac('0xc2'),_0x552dc6[_0x9bac('0x45')],util[_0x9bac('0x3b')](_0x552dc6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x552dc6[_0x9bac('0x45')]]){for(var _0x451aa5=0x0,_0xa860e={};_0x451aa5=0x0?moment(_0x49d976['endtime'])['diff'](_0x49d976[_0x236c('0x1c')],_0x236c('0x11')):null,'data1':'outbound','data2':_0x49d976[_0x236c('0x16')],'data3':_0x49d976[_0x236c('0x13')],'data4':_0x49d976[_0x236c('0x1e')]||null,'role':_0x236c('0x15'),'internal':_0x49d976[_0x236c('0x16')]?_['toNumber'](_0x49d976[_0x236c('0x16')]):undefined,'uniqueid':_0x49d976['uniqueid']},'log':_0x236c('0x8')});}; \ No newline at end of file +var _0x8a11=['seconds','inbound','exten','queue','agent','accountcode','uniqueid','voiceDialReport','CreateMemberReport','interface','starttime','endtime','outbound','dialstring','toNumber','moment','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','format','SIP/%s','TALKING','diff','queuecallerleaveAt'];(function(_0x221817,_0x47628e){var _0x45d32b=function(_0x2c7e46){while(--_0x2c7e46){_0x221817['push'](_0x221817['shift']());}};_0x45d32b(++_0x47628e);}(_0x8a11,0xda));var _0x18a1=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x8a11[_0x18afca];return _0x11603f;};'use strict';var moment=require(_0x18a1('0x0'));var _=require('lodash');var util=require(_0x18a1('0x1'));var client=require(_0x18a1('0x2'));exports['voiceQueueReport']=function(_0x3fcc38){var _0x4d363f=_0x3fcc38[_0x18a1('0x3')]||_0x3fcc38[_0x18a1('0x4')];return client[_0x18a1('0x5')]('CreateMemberReport',{'body':{'channel':_0x18a1('0x6'),'membername':_0x3fcc38[_0x18a1('0x7')],'interface':_[_0x18a1('0x8')](_0x3fcc38['interface'])?util[_0x18a1('0x9')](_0x18a1('0xa'),_0x3fcc38[_0x18a1('0x7')]):_0x3fcc38['interface'],'type':_0x18a1('0xb'),'enterAt':_0x3fcc38['queuecallerleaveAt'],'exitAt':_0x4d363f,'duration':moment(_0x4d363f)[_0x18a1('0xc')](_0x3fcc38[_0x18a1('0xd')],_0x18a1('0xe')),'data1':_0x18a1('0xf'),'data2':_0x3fcc38['calleridnum'],'data3':_0x3fcc38[_0x18a1('0x10')],'data4':null,'data5':_0x3fcc38[_0x18a1('0x11')],'role':_0x18a1('0x12'),'internal':_0x3fcc38[_0x18a1('0x13')]?_['toNumber'](_0x3fcc38[_0x18a1('0x13')]):undefined,'uniqueid':_0x3fcc38[_0x18a1('0x14')]},'log':'CreateMemberReport'});};exports[_0x18a1('0x15')]=function(_0x5a817c){return client[_0x18a1('0x5')](_0x18a1('0x16'),{'body':{'channel':'voice','membername':_0x5a817c['membername'],'interface':_0x5a817c[_0x18a1('0x17')],'type':_0x18a1('0xb'),'enterAt':_0x5a817c[_0x18a1('0x18')],'exitAt':_0x5a817c['endtime'],'duration':moment(_0x5a817c[_0x18a1('0x19')])[_0x18a1('0xc')](_0x5a817c[_0x18a1('0x18')],_0x18a1('0xe'))>=0x0?moment(_0x5a817c['endtime'])[_0x18a1('0xc')](_0x5a817c[_0x18a1('0x18')],'seconds'):null,'data1':_0x18a1('0x1a'),'data2':_0x5a817c[_0x18a1('0x13')],'data3':_0x5a817c[_0x18a1('0x10')],'data4':_0x5a817c[_0x18a1('0x1b')]||null,'role':_0x18a1('0x12'),'internal':_0x5a817c[_0x18a1('0x13')]?_[_0x18a1('0x1c')](_0x5a817c['accountcode']):undefined,'uniqueid':_0x5a817c[_0x18a1('0x14')]},'log':_0x18a1('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 6de5b37..0973a07 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 _0xeb3f=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeb3f[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0xfeb3('0x0'));exports[_0xfeb3('0x1')]=function(){return client[_0xfeb3('0x2')](_0xfeb3('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfeb3('0x4'),_0xfeb3('0x5')]},'log':_0xfeb3('0x6')});}; \ No newline at end of file +var _0xc5dc=['previewRecallmeReminderInterval','GetSettings','Request'];(function(_0x5404e9,_0x132866){var _0x2d7c75=function(_0x3a3db9){while(--_0x3a3db9){_0x5404e9['push'](_0x5404e9['shift']());}};_0x2d7c75(++_0x132866);}(_0xc5dc,0xc2));var _0xcc5d=function(_0x17b911,_0xbd3ad7){_0x17b911=_0x17b911-0x0;var _0x72c3fe=_0xc5dc[_0x17b911];return _0x72c3fe;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xcc5d('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xcc5d('0x1')]},'log':_0xcc5d('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 04d0e9e..828c580 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 _0xbc1d=['Request','GetTemplate','html','../client','getTemplates'];(function(_0x827009,_0x3a840f){var _0x2d55a2=function(_0x25c7f9){while(--_0x25c7f9){_0x827009['push'](_0x827009['shift']());}};_0x2d55a2(++_0x3a840f);}(_0xbc1d,0x12a));var _0xdbc1=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0xbc1d[_0x164760];return _0x8b91b2;};'use strict';var client=require(_0xdbc1('0x0'));exports[_0xdbc1('0x1')]=function(_0x22ccb6){return function(_0x5b6851){return client[_0xdbc1('0x2')](_0xdbc1('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xdbc1('0x4')]},'log':_0xdbc1('0x3')});};}; \ No newline at end of file +var _0x777d=['GetTemplate','name','getTemplates'];(function(_0x5c3a1f,_0x1b1166){var _0x4a6fec=function(_0x4b7663){while(--_0x4b7663){_0x5c3a1f['push'](_0x5c3a1f['shift']());}};_0x4a6fec(++_0x1b1166);}(_0x777d,0xe9));var _0xd777=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0x777d[_0x18b191];return _0x43e146;};'use strict';var client=require('../client');exports[_0xd777('0x0')]=function(_0xe6b7d9){return function(_0x2b6eab){return client['Request'](_0xd777('0x1'),{'options':{'raw':!![],'attributes':['id',_0xd777('0x2'),'html']},'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 a36fb57..0374066 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 _0x0e45=['status','Condition','AllConditions','field','operator','value','Action','Actions','action','data3','data4','data5','data6','getTriggers','Request','name','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e45,0x12e));var _0x50e4=function(_0x23eaf0,_0x4efdb0){_0x23eaf0=_0x23eaf0-0x0;var _0x5a2529=_0x0e45[_0x23eaf0];return _0x5a2529;};'use strict';var client=require('../client');exports[_0x50e4('0x0')]=function(_0x488740){return function(_0x555144){return client[_0x50e4('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x50e4('0x2'),_0x50e4('0x3'),_0x50e4('0x4')],'include':[{'model':_0x50e4('0x5'),'as':_0x50e4('0x6'),'attributes':['id',_0x50e4('0x7'),_0x50e4('0x8'),_0x50e4('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x50e4('0x7'),_0x50e4('0x8'),_0x50e4('0x9')]},{'model':_0x50e4('0xa'),'as':_0x50e4('0xb'),'attributes':['id',_0x50e4('0xc'),'data1','data2',_0x50e4('0xd'),_0x50e4('0xe'),_0x50e4('0xf'),_0x50e4('0x10'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x3edc=['field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data6','data7','getTriggers','Request','name','channel','status','Condition','AllConditions'];(function(_0xffc0a0,_0x398010){var _0x548cbd=function(_0x31d238){while(--_0x31d238){_0xffc0a0['push'](_0xffc0a0['shift']());}};_0x548cbd(++_0x398010);}(_0x3edc,0x139));var _0xc3ed=function(_0x4f5df0,_0xeeb5a4){_0x4f5df0=_0x4f5df0-0x0;var _0x45e3b3=_0x3edc[_0x4f5df0];return _0x45e3b3;};'use strict';var client=require('../client');exports[_0xc3ed('0x0')]=function(_0x2306d1){return function(_0x193257){return client[_0xc3ed('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xc3ed('0x2'),_0xc3ed('0x3'),_0xc3ed('0x4')],'include':[{'model':_0xc3ed('0x5'),'as':_0xc3ed('0x6'),'attributes':['id',_0xc3ed('0x7'),_0xc3ed('0x8'),_0xc3ed('0x9')]},{'model':'Condition','as':_0xc3ed('0xa'),'attributes':['id','field','operator',_0xc3ed('0x9')]},{'model':_0xc3ed('0xb'),'as':_0xc3ed('0xc'),'attributes':['id',_0xc3ed('0xd'),_0xc3ed('0xe'),_0xc3ed('0xf'),_0xc3ed('0x10'),_0xc3ed('0x11'),'data5',_0xc3ed('0x12'),_0xc3ed('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 11f25f3..19b950e 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 _0x6666=['GetTrunk','name','../client'];(function(_0x42ff07,_0x118ced){var _0x21457b=function(_0x5e4a2d){while(--_0x5e4a2d){_0x42ff07['push'](_0x42ff07['shift']());}};_0x21457b(++_0x118ced);}(_0x6666,0x6e));var _0x6666=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x6666[_0x4e7d25];return _0x526fe6;};'use strict';var client=require(_0x6666('0x0'));exports['getTrunks']=function(_0x5b2ac4){return function(_0x59e3ca){return client['Request'](_0x6666('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6666('0x2'),'registry','defaultuser']},'log':_0x6666('0x1')});};}; \ No newline at end of file +var _0x5ad3=['registry','defaultuser','../client','getTrunks','GetTrunk','name'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4b8ecc,_0x4cd01c){_0x4b8ecc=_0x4b8ecc-0x0;var _0x48c1b9=_0x5ad3[_0x4b8ecc];return _0x48c1b9;};'use strict';var client=require(_0x35ad('0x0'));exports[_0x35ad('0x1')]=function(_0x15b630){return function(_0x2a45b7){return client['Request'](_0x35ad('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x35ad('0x3'),_0x35ad('0x4'),_0x35ad('0x5')]},'log':_0x35ad('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 3d21e5e..8c1f65b 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x59ae41,_0xbbee18){var _0x57d8c0=function(_0x13df66){while(--_0x13df66){_0x59ae41['push'](_0x59ae41['shift']());}};_0x57d8c0(++_0xbbee18);}(_0x70e0,0x17b));var _0x070e=function(_0x13789b,_0x47c524){_0x13789b=_0x13789b-0x0;var _0x3f7a8b=_0x70e0[_0x13789b];return _0x3f7a8b;};'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 +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x361220,_0x59702c){var _0x34cf92=function(_0x54692c){while(--_0x54692c){_0x361220['push'](_0x361220['shift']());}};_0x34cf92(++_0x59702c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index cea7a32..65a9012 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 _0x6b26=['../client','create','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x38b4d5,_0x24a77e){var _0x43603e=function(_0x49f8f1){while(--_0x49f8f1){_0x38b4d5['push'](_0x38b4d5['shift']());}};_0x43603e(++_0x24a77e);}(_0x6b26,0x127));var _0x66b2=function(_0x3792a5,_0x1a9252){_0x3792a5=_0x3792a5-0x0;var _0x67f262=_0x6b26[_0x3792a5];return _0x67f262;};'use strict';var client=require(_0x66b2('0x0'));exports[_0x66b2('0x1')]=function(_0x1a8af5){return client['Request'](_0x66b2('0x2'),{'body':_0x1a8af5,'log':_0x66b2('0x2')});};exports[_0x66b2('0x3')]=function(_0x87e521,_0x358598,_0x1d78b6){return client['Request'](_0x66b2('0x4'),{'body':_0x87e521,'options':{'where':{'uniqueid':_0x358598,'interface':_0x1d78b6,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xf22e=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xf22e,0xc3));var _0xef22=function(_0x44ee7c,_0x178e28){_0x44ee7c=_0x44ee7c-0x0;var _0x3abd77=_0xf22e[_0x44ee7c];return _0x3abd77;};'use strict';var client=require(_0xef22('0x0'));exports['create']=function(_0x34a178){return client[_0xef22('0x1')](_0xef22('0x2'),{'body':_0x34a178,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x1255bb,_0x6133e,_0x470d9e){return client[_0xef22('0x1')](_0xef22('0x3'),{'body':_0x1255bb,'options':{'where':{'uniqueid':_0x6133e,'interface':_0x470d9e,'agentcomplete':!![]}},'log':_0xef22('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3475f6d..4a72e0c 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 _0x531c=['Request','CreateVoiceCallReport','calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create'];(function(_0x3939b2,_0x38e2cc){var _0x576cbd=function(_0x68df6a){while(--_0x68df6a){_0x3939b2['push'](_0x3939b2['shift']());}};_0x576cbd(++_0x38e2cc);}(_0x531c,0xa3));var _0xc531=function(_0x4008f0,_0x17f1b2){_0x4008f0=_0x4008f0-0x0;var _0xb42e88=_0x531c[_0x4008f0];return _0xb42e88;};'use strict';var moment=require(_0xc531('0x0'));var util=require(_0xc531('0x1'));var _=require(_0xc531('0x2'));var client=require(_0xc531('0x3'));exports[_0xc531('0x4')]=function(_0x38c441){return client[_0xc531('0x5')](_0xc531('0x6'),{'body':_['merge'](_0x38c441,{'source':_0x38c441[_0xc531('0x7')],'destinationcontext':_0x38c441['context'],'callerid':_0x38c441['callerid'],'amaflags':_0xc531('0x8')}),'log':_0xc531('0x6')});};exports[_0xc531('0x9')]=function(){return function(){return client['Request'](_0xc531('0xa'),{'options':{'where':{'type':[_0xc531('0xb')],'createdAt':{'$between':[moment()[_0xc531('0xc')](_0xc531('0xd'))[_0xc531('0xe')](_0xc531('0xf')),moment()[_0xc531('0x10')]('day')[_0xc531('0xe')](_0xc531('0xf'))]}},'attributes':['type',_0xc531('0x11'),_0xc531('0x12'),_0xc531('0x13')]},'log':_0xc531('0x14')});};}; \ No newline at end of file +var _0x2869=['lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','duration','billableseconds','GetVoiceCallReports'];(function(_0x138814,_0x1b792e){var _0x43dba0=function(_0x5214ac){while(--_0x5214ac){_0x138814['push'](_0x138814['shift']());}};_0x43dba0(++_0x1b792e);}(_0x2869,0x143));var _0x9286=function(_0x228dd4,_0x3fef92){_0x228dd4=_0x228dd4-0x0;var _0x37927d=_0x2869[_0x228dd4];return _0x37927d;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x9286('0x0'));var client=require(_0x9286('0x1'));exports[_0x9286('0x2')]=function(_0x21b194){return client[_0x9286('0x3')](_0x9286('0x4'),{'body':_[_0x9286('0x5')](_0x21b194,{'source':_0x21b194[_0x9286('0x6')],'destinationcontext':_0x21b194[_0x9286('0x7')],'callerid':_0x21b194['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x9286('0x8')]=function(){return function(){return client[_0x9286('0x3')](_0x9286('0x9'),{'options':{'where':{'type':[_0x9286('0xa')],'createdAt':{'$between':[moment()[_0x9286('0xb')](_0x9286('0xc'))[_0x9286('0xd')](_0x9286('0xe')),moment()[_0x9286('0xf')](_0x9286('0xc'))[_0x9286('0xd')](_0x9286('0xe'))]}},'attributes':['type','disposition',_0x9286('0x10'),_0x9286('0x11')]},'log':_0x9286('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index c2b2fc9..eee8729 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 _0x95b8=['create','Request','CreateVoiceDialReport'];(function(_0x1dd6e7,_0x1cda2b){var _0xb53aa4=function(_0xd2ac7b){while(--_0xd2ac7b){_0x1dd6e7['push'](_0x1dd6e7['shift']());}};_0xb53aa4(++_0x1cda2b);}(_0x95b8,0x8a));var _0x895b=function(_0x5e073c,_0x3e3ba0){_0x5e073c=_0x5e073c-0x0;var _0x5bc328=_0x95b8[_0x5e073c];return _0x5bc328;};'use strict';var client=require('../client');exports[_0x895b('0x0')]=function(_0x44e3c8){return client[_0x895b('0x1')](_0x895b('0x2'),{'body':_0x44e3c8,'log':_0x895b('0x2')});}; \ No newline at end of file +var _0xec7c=['CreateVoiceDialReport','../client','create','Request'];(function(_0x479faf,_0x5052fd){var _0x453004=function(_0x376f28){while(--_0x376f28){_0x479faf['push'](_0x479faf['shift']());}};_0x453004(++_0x5052fd);}(_0xec7c,0x11d));var _0xcec7=function(_0x2271b5,_0x545fe6){_0x2271b5=_0x2271b5-0x0;var _0x504f76=_0xec7c[_0x2271b5];return _0x504f76;};'use strict';var client=require(_0xcec7('0x0'));exports[_0xcec7('0x1')]=function(_0x3cb9f5){return client[_0xcec7('0x2')](_0xcec7('0x3'),{'body':_0x3cb9f5,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d26f87c..a2efa36 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 _0xe739=['exten','../client','Request','GetVoiceExtension'];(function(_0x26e394,_0x2302b6){var _0x4f0848=function(_0x3945e){while(--_0x3945e){_0x26e394['push'](_0x26e394['shift']());}};_0x4f0848(++_0x2302b6);}(_0xe739,0x105));var _0x9e73=function(_0x4f4cf3,_0x3a52df){_0x4f4cf3=_0x4f4cf3-0x0;var _0x46ba3b=_0xe739[_0x4f4cf3];return _0x46ba3b;};'use strict';var client=require(_0x9e73('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x9e73('0x1')](_0x9e73('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9e73('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x91a7=['Request','GetVoiceExtension','recordingFormat','getVoiceExtensions'];(function(_0x5c0acd,_0x359843){var _0x98ea82=function(_0x2d41f0){while(--_0x2d41f0){_0x5c0acd['push'](_0x5c0acd['shift']());}};_0x98ea82(++_0x359843);}(_0x91a7,0xe7));var _0x791a=function(_0x174be2,_0x2f9fd5){_0x174be2=_0x174be2-0x0;var _0x2e5323=_0x91a7[_0x174be2];return _0x2e5323;};'use strict';var client=require('../client');exports[_0x791a('0x0')]=function(){return function(){return client[_0x791a('0x1')](_0x791a('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x791a('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 35cb7a0..dd0025b 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 _0x5f55=['dialAgiAfterHangupClient','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','Trunk','name','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','monitor_format','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent'];(function(_0x353d3d,_0xc7ebc){var _0x1c5409=function(_0x54838e){while(--_0x54838e){_0x353d3d['push'](_0x353d3d['shift']());}};_0x1c5409(++_0xc7ebc);}(_0x5f55,0x14c));var _0x55f5=function(_0x28278f,_0x574b0d){_0x28278f=_0x28278f-0x0;var _0x3d9f74=_0x5f55[_0x28278f];return _0x3d9f74;};'use strict';var client=require(_0x55f5('0x0'));exports[_0x55f5('0x1')]=function(){return function(){return client[_0x55f5('0x2')](_0x55f5('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0x55f5('0x4'),'autopause',_0x55f5('0x5'),'type',_0x55f5('0x6'),'dialMethod',_0x55f5('0x7'),'dialLimitQueue',_0x55f5('0x8'),_0x55f5('0x9'),_0x55f5('0xa'),_0x55f5('0xb'),_0x55f5('0xc'),_0x55f5('0xd'),'dialOriginateTimeout','dialQueueOptions',_0x55f5('0xe'),_0x55f5('0xf'),_0x55f5('0x10'),_0x55f5('0x11'),_0x55f5('0x12'),_0x55f5('0x13'),_0x55f5('0x14'),_0x55f5('0x15'),_0x55f5('0x16'),_0x55f5('0x17'),_0x55f5('0x18'),'dialPrefix',_0x55f5('0x19'),_0x55f5('0x1a'),_0x55f5('0x1b'),_0x55f5('0x1c'),_0x55f5('0x1d'),_0x55f5('0x1e'),'dialAMDMinWordLength',_0x55f5('0x1f'),_0x55f5('0x20'),_0x55f5('0x21'),_0x55f5('0x22'),_0x55f5('0x23'),_0x55f5('0x24'),_0x55f5('0x25'),_0x55f5('0x26'),_0x55f5('0x27'),_0x55f5('0x28'),'dialQueueProject2',_0x55f5('0x5'),'strategy',_0x55f5('0x29'),_0x55f5('0x2a'),_0x55f5('0x2b'),_0x55f5('0x2c'),'dialDropMaxRetry',_0x55f5('0x2d'),_0x55f5('0x2e'),_0x55f5('0x2f'),_0x55f5('0x30'),_0x55f5('0x31'),_0x55f5('0x32'),_0x55f5('0x33'),'mandatoryDisposition',_0x55f5('0x34'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x55f5('0x35'),'as':_0x55f5('0x35'),'attributes':['id',_0x55f5('0x36'),_0x55f5('0x37'),'active']},{'model':'Pause','as':_0x55f5('0x38'),'attributes':['id',_0x55f5('0x36')]},{'model':_0x55f5('0x35'),'as':_0x55f5('0x39'),'attributes':['id',_0x55f5('0x36'),_0x55f5('0x37'),_0x55f5('0x3a')]},{'model':_0x55f5('0x3b'),'as':_0x55f5('0x3b'),'attributes':['id',_0x55f5('0x36')],'include':[{'model':'Interval','as':_0x55f5('0x3c'),'attributes':['id',_0x55f5('0x36'),_0x55f5('0x3d')]}]}]},'log':_0x55f5('0x1')});};}; \ No newline at end of file +var _0x3a5b=['dialCongestionRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','mandatoryDispositionPause','callerid','active','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','type','dialActive','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry'];(function(_0x59ff14,_0x4d809a){var _0x5e7928=function(_0x1218f8){while(--_0x1218f8){_0x59ff14['push'](_0x59ff14['shift']());}};_0x5e7928(++_0x4d809a);}(_0x3a5b,0x122));var _0xb3a5=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0x3a5b[_0x149f32];return _0x11f475;};'use strict';var client=require(_0xb3a5('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xb3a5('0x1')](_0xb3a5('0x2'),{'options':{'raw':![],'attributes':['id',_0xb3a5('0x3'),_0xb3a5('0x4'),_0xb3a5('0x5'),'autopause','monitor_format',_0xb3a5('0x6'),_0xb3a5('0x7'),'dialMethod','dialLimitChannel',_0xb3a5('0x8'),_0xb3a5('0x9'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName',_0xb3a5('0xa'),_0xb3a5('0xb'),_0xb3a5('0xc'),'dialQueueTimeout',_0xb3a5('0xd'),_0xb3a5('0xe'),_0xb3a5('0xf'),'dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xb3a5('0x10'),_0xb3a5('0x11'),_0xb3a5('0x12'),_0xb3a5('0x13'),_0xb3a5('0x14'),_0xb3a5('0x15'),_0xb3a5('0x16'),_0xb3a5('0x17'),_0xb3a5('0x18'),_0xb3a5('0x19'),_0xb3a5('0x1a'),_0xb3a5('0x1b'),_0xb3a5('0x1c'),_0xb3a5('0x1d'),_0xb3a5('0x1e'),'dialAMDMaximumWordLength',_0xb3a5('0x1f'),_0xb3a5('0x20'),_0xb3a5('0x21'),_0xb3a5('0x22'),'dialAgiAfterHangupAgent',_0xb3a5('0x23'),_0xb3a5('0x24'),_0xb3a5('0x25'),'strategy',_0xb3a5('0x26'),'dialCutDigit',_0xb3a5('0x27'),_0xb3a5('0x28'),_0xb3a5('0x29'),_0xb3a5('0x2a'),_0xb3a5('0x2b'),_0xb3a5('0x2c'),_0xb3a5('0x2d'),_0xb3a5('0x2e'),_0xb3a5('0x2f'),_0xb3a5('0x30'),'mandatoryDisposition',_0xb3a5('0x31'),_0xb3a5('0x32'),_0xb3a5('0x33'),_0xb3a5('0x34')],'include':[{'model':_0xb3a5('0x35'),'as':_0xb3a5('0x35'),'attributes':['id',_0xb3a5('0x3'),'callerid','active']},{'model':'Pause','as':_0xb3a5('0x36'),'attributes':['id',_0xb3a5('0x3')]},{'model':_0xb3a5('0x35'),'as':'TrunkBackup','attributes':['id',_0xb3a5('0x3'),_0xb3a5('0x37'),_0xb3a5('0x38')]},{'model':_0xb3a5('0x39'),'as':_0xb3a5('0x39'),'attributes':['id',_0xb3a5('0x3')],'include':[{'model':'Interval','as':_0xb3a5('0x3a'),'attributes':['id',_0xb3a5('0x3'),_0xb3a5('0x3b')]}]}]},'log':_0xb3a5('0x3c')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4681577..e42fa16 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(_0x4ec629,_0x32b05b){var _0x1bf5e6=function(_0x1d2bba){while(--_0x1d2bba){_0x4ec629['push'](_0x4ec629['shift']());}};_0x1bf5e6(++_0x32b05b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x472153,_0x37c87a){var _0xda8a25=function(_0x125b93){while(--_0x125b93){_0x472153['push'](_0x472153['shift']());}};_0xda8a25(++_0x37c87a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 f4485dd..e75072f 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 _0xab28=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x48e679,_0x54bda6){var _0x5cd916=function(_0x2895d9){while(--_0x2895d9){_0x48e679['push'](_0x48e679['shift']());}};_0x5cd916(++_0x54bda6);}(_0xab28,0x91));var _0x8ab2=function(_0x481844,_0x259b1f){_0x481844=_0x481844-0x0;var _0x2afc17=_0xab28[_0x481844];return _0x2afc17;};'use strict';var client=require(_0x8ab2('0x0'));exports['getVoiceQueueRtPauses']=function(_0x24ddea){return function(){return client[_0x8ab2('0x1')](_0x8ab2('0x2'),{'options':{'where':{'VoiceQueueId':_0x24ddea,'paused':!![]},'raw':!![]},'log':_0x8ab2('0x3')});};}; \ No newline at end of file +var _0x9e01=['../client','Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x8926ed,_0x2dd49f){var _0x2e12e9=function(_0x18c4e2){while(--_0x18c4e2){_0x8926ed['push'](_0x8926ed['shift']());}};_0x2e12e9(++_0x2dd49f);}(_0x9e01,0x180));var _0x19e0=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x9e01[_0x126558];return _0x1f6d14;};'use strict';var client=require(_0x19e0('0x0'));exports['getVoiceQueueRtPauses']=function(_0x28ff45){return function(){return client[_0x19e0('0x1')](_0x19e0('0x2'),{'options':{'where':{'VoiceQueueId':_0x28ff45,'paused':!![]},'raw':!![]},'log':_0x19e0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index cbb3959..8b02f91 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x32c3f4,_0x13990e){var _0x889a18=function(_0x3fc7fa){while(--_0x3fc7fa){_0x32c3f4['push'](_0x32c3f4['shift']());}};_0x889a18(++_0x13990e);}(_0x7a54,0x106));var _0x47a5=function(_0x56c12d,_0x2bc288){_0x56c12d=_0x56c12d-0x0;var _0x518cce=_0x7a54[_0x56c12d];return _0x518cce;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x379576,_0x5d978e){var _0x576cf0=function(_0xb99ea8){while(--_0xb99ea8){_0x379576['push'](_0x379576['shift']());}};_0x576cf0(++_0x5d978e);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index bf88820..63c0539 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 _0xf4f9=['transfereeexten','transfereelinkedid','context','extension','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext'];(function(_0x360793,_0x41e89f){var _0x35b64a=function(_0x3a3280){while(--_0x3a3280){_0x360793['push'](_0x360793['shift']());}};_0x35b64a(++_0x41e89f);}(_0xf4f9,0x8d));var _0x9f4f=function(_0x2351f6,_0x55c6b6){_0x2351f6=_0x2351f6-0x0;var _0x307814=_0xf4f9[_0x2351f6];return _0x307814;};'use strict';var client=require('../client');exports[_0x9f4f('0x0')]={};exports[_0x9f4f('0x1')]=function(_0x223ced){return client[_0x9f4f('0x2')](_0x9f4f('0x3'),{'body':{'result':_0x223ced[_0x9f4f('0x4')],'transfererchannel':_0x223ced[_0x9f4f('0x5')],'transferercalleridnum':_0x223ced[_0x9f4f('0x6')],'transferercalleridname':_0x223ced[_0x9f4f('0x7')],'transfererconnectedlinenum':_0x223ced[_0x9f4f('0x8')],'transfererconnectedlinename':_0x223ced[_0x9f4f('0x9')],'transfereraccountcode':_0x223ced[_0x9f4f('0xa')],'transferercontext':_0x223ced[_0x9f4f('0xb')],'transfererexten':_0x223ced[_0x9f4f('0xc')],'transfererlinkedid':_0x223ced[_0x9f4f('0xd')],'transfereechannel':_0x223ced[_0x9f4f('0xe')],'transfereecalleridnum':_0x223ced[_0x9f4f('0xf')],'transfereecalleridname':_0x223ced[_0x9f4f('0x10')],'transfereeconnectedlinenum':_0x223ced['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x223ced['transfereeconnectedlinename'],'transfereeaccountcode':_0x223ced[_0x9f4f('0x11')],'transfereecontext':_0x223ced[_0x9f4f('0x12')],'transfereeexten':_0x223ced[_0x9f4f('0x13')],'transfereelinkedid':_0x223ced[_0x9f4f('0x14')],'isexternal':_0x223ced['isexternal'],'context':_0x223ced[_0x9f4f('0x15')],'extension':_0x223ced[_0x9f4f('0x16')],'type':'blind'},'log':_0x9f4f('0x3')});};exports['attendedTransfer']=function(_0x3c5ca9){return client['Request'](_0x9f4f('0x3'),{'body':{'result':_0x3c5ca9[_0x9f4f('0x4')],'transfererchannel':_0x3c5ca9[_0x9f4f('0x17')],'transferercalleridnum':_0x3c5ca9[_0x9f4f('0x18')],'transferercalleridname':_0x3c5ca9['origtransferercalleridname'],'transfererconnectedlinenum':_0x3c5ca9[_0x9f4f('0x19')],'transfererconnectedlinename':_0x3c5ca9[_0x9f4f('0x1a')],'transfereraccountcode':_0x3c5ca9[_0x9f4f('0x1b')],'transferercontext':_0x3c5ca9[_0x9f4f('0x1c')],'transfererexten':_0x3c5ca9['secondtransfererexten'],'transfererlinkedid':_0x3c5ca9[_0x9f4f('0x1d')],'transfereechannel':_0x3c5ca9[_0x9f4f('0x1e')],'transfereecalleridnum':_0x3c5ca9[_0x9f4f('0x1f')],'transfereecalleridname':_0x3c5ca9[_0x9f4f('0x20')],'transfereeconnectedlinenum':_0x3c5ca9[_0x9f4f('0x21')],'transfereeconnectedlinename':_0x3c5ca9[_0x9f4f('0x22')],'transfereeaccountcode':_0x3c5ca9['transfertargetaccountcode'],'transfereecontext':_0x3c5ca9[_0x9f4f('0x23')],'transfereeexten':_0x3c5ca9['transfertargetexten'],'transfereelinkedid':_0x3c5ca9[_0x9f4f('0x24')],'isexternal':_0x3c5ca9[_0x9f4f('0x25')],'context':_0x3c5ca9[_0x9f4f('0x26')],'extension':_0x3c5ca9['origtransfererexten'],'type':_0x9f4f('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x8661=['origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal'];(function(_0x393e9f,_0x1bee4b){var _0x3ae9fe=function(_0x3b9d85){while(--_0x3b9d85){_0x393e9f['push'](_0x393e9f['shift']());}};_0x3ae9fe(++_0x1bee4b);}(_0x8661,0x1c5));var _0x1866=function(_0x431025,_0x5146d1){_0x431025=_0x431025-0x0;var _0x4bad74=_0x8661[_0x431025];return _0x4bad74;};'use strict';var client=require(_0x1866('0x0'));exports[_0x1866('0x1')]={};exports[_0x1866('0x2')]=function(_0x4f70ee){return client[_0x1866('0x3')](_0x1866('0x4'),{'body':{'result':_0x4f70ee[_0x1866('0x5')],'transfererchannel':_0x4f70ee[_0x1866('0x6')],'transferercalleridnum':_0x4f70ee[_0x1866('0x7')],'transferercalleridname':_0x4f70ee['transferercalleridname'],'transfererconnectedlinenum':_0x4f70ee[_0x1866('0x8')],'transfererconnectedlinename':_0x4f70ee[_0x1866('0x9')],'transfereraccountcode':_0x4f70ee[_0x1866('0xa')],'transferercontext':_0x4f70ee[_0x1866('0xb')],'transfererexten':_0x4f70ee['transfererexten'],'transfererlinkedid':_0x4f70ee['transfererlinkedid'],'transfereechannel':_0x4f70ee[_0x1866('0xc')],'transfereecalleridnum':_0x4f70ee[_0x1866('0xd')],'transfereecalleridname':_0x4f70ee[_0x1866('0xe')],'transfereeconnectedlinenum':_0x4f70ee[_0x1866('0xf')],'transfereeconnectedlinename':_0x4f70ee[_0x1866('0x10')],'transfereeaccountcode':_0x4f70ee[_0x1866('0x11')],'transfereecontext':_0x4f70ee[_0x1866('0x12')],'transfereeexten':_0x4f70ee[_0x1866('0x13')],'transfereelinkedid':_0x4f70ee[_0x1866('0x14')],'isexternal':_0x4f70ee['isexternal'],'context':_0x4f70ee[_0x1866('0x15')],'extension':_0x4f70ee[_0x1866('0x16')],'type':_0x1866('0x17')},'log':_0x1866('0x4')});};exports[_0x1866('0x18')]=function(_0x130287){return client['Request'](_0x1866('0x4'),{'body':{'result':_0x130287[_0x1866('0x5')],'transfererchannel':_0x130287[_0x1866('0x19')],'transferercalleridnum':_0x130287[_0x1866('0x1a')],'transferercalleridname':_0x130287['origtransferercalleridname'],'transfererconnectedlinenum':_0x130287[_0x1866('0x1b')],'transfererconnectedlinename':_0x130287[_0x1866('0x1c')],'transfereraccountcode':_0x130287[_0x1866('0x1d')],'transferercontext':_0x130287[_0x1866('0x1e')],'transfererexten':_0x130287[_0x1866('0x1f')],'transfererlinkedid':_0x130287[_0x1866('0x20')],'transfereechannel':_0x130287[_0x1866('0x21')],'transfereecalleridnum':_0x130287[_0x1866('0x22')],'transfereecalleridname':_0x130287['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x130287['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x130287['transfertargetconnectedlinename'],'transfereeaccountcode':_0x130287[_0x1866('0x23')],'transfereecontext':_0x130287['transfertargetcontext'],'transfereeexten':_0x130287[_0x1866('0x24')],'transfereelinkedid':_0x130287[_0x1866('0x25')],'isexternal':_0x130287[_0x1866('0x26')],'context':_0x130287[_0x1866('0x27')],'extension':_0x130287[_0x1866('0x28')],'type':'attended'},'log':_0x1866('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index bb38df2..900de09 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 _0x5e0e=['moment','../../../config/environment','../properties','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','catch','message','error','command','then','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','undefined','values','voicechannel','find','channels','uniqueid','channel','format','%s.%s','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','filename','wav','StopMixMonitor\x20Success','queueChannels','Hangup','Redirect','exten','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird'];(function(_0x3a43ff,_0x21ec1d){var _0x3a39ad=function(_0x391bb3){while(--_0x391bb3){_0x3a43ff['push'](_0x3a43ff['shift']());}};_0x3a39ad(++_0x21ec1d);}(_0x5e0e,0x89));var _0xe5e0=function(_0x2b5947,_0x2383a6){_0x2b5947=_0x2b5947-0x0;var _0x3080a3=_0x5e0e[_0x2b5947];return _0x3080a3;};'use strict';var _=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var jayson=require('jayson/promise');var schema=require(_0xe5e0('0x2'));var BPromise=require(_0xe5e0('0x3'));var moment=require(_0xe5e0('0x4'));var config=require(_0xe5e0('0x5'));var properties=require(_0xe5e0('0x6'));var ami=require('../ami');exports[_0xe5e0('0x7')]=function(_0x52407b,_0x239262,_0x3e564e){return new BPromise(function(_0x2ff9ac,_0x1a4c51){var _0xa91224={'QueuePause':function(_0x156c30){return new Promise(function(_0x59a81f,_0x4059cf){var _0x29199a=util['format'](_0xe5e0('0x8'),_0xe5e0('0x9'),_0x156c30[_0xe5e0('0xa')]);if(_0x52407b[_0xe5e0('0xb')]&&_0x52407b[_0xe5e0('0xb')][_0x29199a]&&_0x52407b[_0xe5e0('0xb')][_0x29199a][_0xe5e0('0xc')]){_0x52407b[_0xe5e0('0xb')][_0x29199a][_0xe5e0('0xd')]();}if(_0x52407b[_0xe5e0('0xe')][_0x29199a]){_0x52407b[_0xe5e0('0xe')][_0x29199a][_0xe5e0('0xf')]({'statePause':_0x156c30[_0xe5e0('0x10')]?!![]:![]});}_0x59a81f({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x5cabeb){var _0x43638e=this;return new Promise(function(_0x1100cc,_0x24f33d){if(ami[_0xe5e0('0x11')]()==![]){return _0x24f33d(_0x43638e['error'](0x1f4,[config[_0xe5e0('0x12')]['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],_0xe5e0('0x14')][_0xe5e0('0x15')]('\x20')));}_0x5cabeb=_[_0xe5e0('0x16')](_0x5cabeb,_[_0xe5e0('0x17')](properties[_0xe5e0('0x18')]));_0x5cabeb[_0xe5e0('0x19')]='Reload';return ami[_0xe5e0('0x1a')](_0x5cabeb)['then'](function(_0x417077){_0x1100cc({'code':0xc8,'message':_0x417077['message']});})[_0xe5e0('0x1b')](function(_0x150c3a){_0x24f33d(_0x43638e['error'](0x1f5,_0x150c3a[_0xe5e0('0x1c')]));});});},'Command':function(_0x4a7ea4){var _0xa81bd4=this;return new Promise(function(_0xce7366,_0x3a2480){if(ami[_0xe5e0('0x11')]()==![]){return _0x3a2480(_0xa81bd4[_0xe5e0('0x1d')](0x1f4,[config[_0xe5e0('0x12')]['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],_0xe5e0('0x14')][_0xe5e0('0x15')]('\x20')));}_0x4a7ea4=_[_0xe5e0('0x16')](_0x4a7ea4,_0xe5e0('0x1e'));_0x4a7ea4[_0xe5e0('0x19')]='Command';return ami['Action'](_0x4a7ea4)[_0xe5e0('0x1f')](function(_0x228368){_0xce7366({'code':0xc8,'message':_0x228368[_0xe5e0('0x20')]});})[_0xe5e0('0x1b')](function(_0x3596ca){_0x3a2480(_0xa81bd4[_0xe5e0('0x1d')](0x1f5,_0x3596ca[_0xe5e0('0x1c')]));});});},'VoiceQueues':function(_0x48071c){return new Promise(function(_0xf45724,_0x5df2be){var _0x332c4e=[];for(var _0x6f21de in _0x52407b[_0xe5e0('0x21')]){if(_0x52407b[_0xe5e0('0x21')][_0xe5e0('0x22')](_0x6f21de)){var _0x4867f2=_0x52407b['voiceQueues'][_0x6f21de];var _0x25fe90={'id':_0x4867f2['id'],'name':_0x4867f2['name'],'strategy':_0x4867f2[_0xe5e0('0x23')],'answered':_0x4867f2[_0xe5e0('0x24')],'available':_0x4867f2[_0xe5e0('0x25')],'loggedIn':_0x4867f2[_0xe5e0('0x26')],'pTalking':_0x4867f2[_0xe5e0('0x27')],'sumBillable':_0x4867f2[_0xe5e0('0x28')],'sumDuration':_0x4867f2['sumDuration'],'sumHoldTime':_0x4867f2[_0xe5e0('0x29')]||0x0,'talking':_0x4867f2['talking'],'total':_0x4867f2[_0xe5e0('0x2a')],'type':_0x4867f2[_0xe5e0('0x2b')],'unmanaged':_0x4867f2[_0xe5e0('0x2c')],'abandoned':_0x4867f2['abandoned'],'waiting':_0x4867f2[_0xe5e0('0x2d')],'loggedInDb':_0x4867f2[_0xe5e0('0x2e')]};if(_0x4867f2[_0xe5e0('0x2b')]===_0xe5e0('0x2f')){_0x25fe90[_0xe5e0('0x30')]=_0x4867f2['dialActive'];_0x25fe90[_0xe5e0('0x31')]=_0x4867f2[_0xe5e0('0x31')];_0x25fe90[_0xe5e0('0x32')]=_0x4867f2[_0xe5e0('0x32')];_0x25fe90['dialOriginateCallerIdNumber']=_0x4867f2[_0xe5e0('0x33')];_0x25fe90[_0xe5e0('0x34')]=_0x4867f2[_0xe5e0('0x34')];_0x25fe90[_0xe5e0('0x35')]=_0x4867f2[_0xe5e0('0x35')];_0x25fe90[_0xe5e0('0x36')]=_0x4867f2[_0xe5e0('0x36')];_0x25fe90[_0xe5e0('0x37')]=_0x4867f2[_0xe5e0('0x37')];_0x25fe90[_0xe5e0('0x38')]=_0x4867f2[_0xe5e0('0x38')];_0x25fe90[_0xe5e0('0x39')]=_0x4867f2[_0xe5e0('0x39')];_0x25fe90[_0xe5e0('0x3a')]=_0x4867f2[_0xe5e0('0x3a')];_0x25fe90[_0xe5e0('0x3b')]=_0x4867f2['outboundCongestionCallsDay'];_0x25fe90['outboundDropCallsDayACS']=_0x4867f2[_0xe5e0('0x3c')];_0x25fe90[_0xe5e0('0x3d')]=_0x4867f2[_0xe5e0('0x3d')];_0x25fe90['outboundDropCallsDayTimeout']=_0x4867f2[_0xe5e0('0x3e')];_0x25fe90[_0xe5e0('0x3f')]=_0x4867f2[_0xe5e0('0x3f')];_0x25fe90['outboundNoSuchCallsDay']=_0x4867f2[_0xe5e0('0x40')];_0x25fe90[_0xe5e0('0x41')]=_0x4867f2[_0xe5e0('0x41')];_0x25fe90[_0xe5e0('0x42')]=_0x4867f2['outboundReCallsDay'];_0x25fe90[_0xe5e0('0x43')]=_0x4867f2['outboundRejectCallsDay'];_0x25fe90[_0xe5e0('0x44')]=_0x4867f2['outboundUnknownCallsDay'];_0x25fe90[_0xe5e0('0x45')]=_0x4867f2['predictiveIntervalAnsweredCalls'];_0x25fe90[_0xe5e0('0x46')]=_0x4867f2[_0xe5e0('0x46')];_0x25fe90['predictiveIntervalAvgTalktime']=_0x4867f2[_0xe5e0('0x47')];_0x25fe90[_0xe5e0('0x48')]=_0x4867f2[_0xe5e0('0x48')];_0x25fe90[_0xe5e0('0x49')]=_0x4867f2[_0xe5e0('0x49')];_0x25fe90[_0xe5e0('0x4a')]=_0x4867f2[_0xe5e0('0x4a')];_0x25fe90[_0xe5e0('0x4b')]=_0x4867f2[_0xe5e0('0x4b')];_0x25fe90[_0xe5e0('0x4c')]=_0x4867f2[_0xe5e0('0x4c')];_0x25fe90['predictiveIntervalMultiplicativeFactor']=_0x4867f2[_0xe5e0('0x4d')];_0x25fe90[_0xe5e0('0x4e')]=_0x4867f2[_0xe5e0('0x4e')];_0x25fe90[_0xe5e0('0x4f')]=_0x4867f2[_0xe5e0('0x4f')];_0x25fe90['predictiveIntervalTotalCalls']=_0x4867f2[_0xe5e0('0x50')];_0x25fe90[_0xe5e0('0x1c')]=_0x4867f2[_0xe5e0('0x1c')];_0x25fe90[_0xe5e0('0x51')]=_0x4867f2['originated'];_0x25fe90[_0xe5e0('0x52')]=_0x4867f2[_0xe5e0('0x52')];_0x25fe90[_0xe5e0('0x53')]=_0x4867f2[_0xe5e0('0x53')];_0x25fe90[_0xe5e0('0x54')]=_0x4867f2['erlangAbandonmentRate'];_0x25fe90[_0xe5e0('0x55')]=_0x4867f2['erlangBusyFactor'];_0x25fe90['startPredictive']=_0x4867f2[_0xe5e0('0x56')];_0x25fe90[_0xe5e0('0x57')]=_0x4867f2[_0xe5e0('0x57')];}if(_0x4867f2[_0xe5e0('0x58')]){_0x25fe90[_0xe5e0('0x58')]={'id':_0x4867f2['Trunk']['id'],'name':_0x4867f2[_0xe5e0('0x58')][_0xe5e0('0xa')],'active':_0x4867f2['Trunk']['active'],'callerid':_0x4867f2[_0xe5e0('0x58')][_0xe5e0('0x59')]};}if(_0x4867f2[_0xe5e0('0x5a')]){_0x25fe90[_0xe5e0('0x5a')]={'id':_0x4867f2[_0xe5e0('0x5a')]['id'],'name':_0x4867f2['Interval'][_0xe5e0('0xa')]};}_0x332c4e[_0xe5e0('0x5b')](_0x25fe90);}}_0xf45724({'count':_0x332c4e[_0xe5e0('0x5c')],'rows':_0x332c4e});});},'UpdateVoiceQueue':function(_0x56994a){return new Promise(function(_0x3b86e1,_0x21b731){var _0x12ba02=_['find'](_0x52407b['voiceQueues'],{'id':parseInt(_0x56994a['id'])});var _0x43df1d=_['omit'](_0x56994a,['id']);if(_0x12ba02){for(var _0x3084ff in _0x43df1d){if(typeof _0x43df1d[_0x3084ff]!==_0xe5e0('0x5d')&&typeof _0x12ba02[_0x3084ff]!==_0xe5e0('0x5d')){_0x12ba02[_0x3084ff]=_0x43df1d[_0x3084ff];}}_0x3b86e1(_0x12ba02);}else{_0x21b731();}});},'VoiceChannels':function(_0x160803){return new Promise(function(_0x183e81,_0x2138ae){var _0x38fd91=_[_0xe5e0('0x5e')](_0x52407b['channels']);_0x183e81({'count':_0x38fd91['length'],'rows':_0x38fd91});});},'VoiceChannelMixMonitor':function(_0x552a9e){var _0x314ee7=this;return new Promise(function(_0x4fd77b,_0x494257){if(ami['isConnected']()==![]){return _0x494257(_0x314ee7['error'](0x1f4,[config['asterisk']['ip'],config[_0xe5e0('0x12')]['username'],_0xe5e0('0x14')]['join']('\x20')));}var _0x47974f=schema(properties[_0xe5e0('0x5f')])[_0xe5e0('0x2')](_0x552a9e);if(_0x47974f['length']>0x0){return _0x494257(_0x314ee7['error'](0x1f4,_['map'](_0x47974f,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x3836cb=_[_0xe5e0('0x60')](_0x52407b[_0xe5e0('0x61')],{'uniqueid':_0x552a9e[_0xe5e0('0x62')]});if(_0x3836cb&&_0x3836cb[_0xe5e0('0x63')]){var _0x530d10=util[_0xe5e0('0x64')](_0xe5e0('0x65'),_0x552a9e['filename']||_0x552a9e[_0xe5e0('0x62')],_0x552a9e[_0xe5e0('0x64')]||'wav');return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x66'),'channel':_0x3836cb[_0xe5e0('0x63')],'file':_0x530d10,'options':_0xe5e0('0x67')})[_0xe5e0('0x1f')](function(_0x38e40){var _0x4cfdd1=_[_0xe5e0('0x60')](_0x3836cb[_0xe5e0('0x68')],{'filename':_0xe5e0('0x69')+_0x530d10[_0xe5e0('0x6a')]()});if(_[_0xe5e0('0x6b')](_0x4cfdd1)){_0x3836cb['monitors'][_0xe5e0('0x5b')]({'filename':_0xe5e0('0x69')+_0x530d10['toLowerCase'](),'createdAt':moment()[_0xe5e0('0x64')](_0xe5e0('0x6c')),'mixmonitorid':_0x38e40[_0xe5e0('0x6d')],'status':_0xe5e0('0x6e')});}else{_0x4cfdd1[_0xe5e0('0x6d')]=_0x38e40[_0xe5e0('0x6d')];_0x4cfdd1[_0xe5e0('0x6f')]=_0xe5e0('0x6e');}_0x4fd77b({'code':0xc8,'message':[_0x552a9e[_0xe5e0('0x62')],_0xe5e0('0x70'),_0x38e40['mixmonitorid']][_0xe5e0('0x15')]('\x20'),'mixmonitorid':_0x38e40[_0xe5e0('0x6d')]});})['catch'](function(_0x44d6bd){_0x494257(_0x314ee7[_0xe5e0('0x1d')](0x1f5,[_0x552a9e[_0xe5e0('0x62')],_0x44d6bd[_0xe5e0('0x1c')][_0xe5e0('0x6a')]()][_0xe5e0('0x15')]('\x20')));});}else{return _0x494257(_0x314ee7[_0xe5e0('0x1d')](0x1f5,_0xe5e0('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x12e5a3){var _0x38c0e8=this;return new Promise(function(_0x21f7ed,_0x37c521){if(ami[_0xe5e0('0x11')]()==![]){return _0x37c521(_0x38c0e8[_0xe5e0('0x1d')](0x1f4,[config[_0xe5e0('0x12')]['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],'ami\x20disconnected'][_0xe5e0('0x15')]('\x20')));}var _0xe7caf6=schema(properties[_0xe5e0('0x5f')])['validate'](_0x12e5a3);if(_0xe7caf6[_0xe5e0('0x5c')]>0x0){return _0x37c521(_0x38c0e8[_0xe5e0('0x1d')](0x1f4,_[_0xe5e0('0x72')](_0xe7caf6,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x13932c=_[_0xe5e0('0x60')](_0x52407b[_0xe5e0('0x61')],{'uniqueid':_0x12e5a3[_0xe5e0('0x62')]});if(_0x13932c){return BPromise[_0xe5e0('0x73')]()[_0xe5e0('0x1f')](function(){if(_0x13932c['channel']){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x74'),'channel':_0x13932c[_0xe5e0('0x63')],'mixmonitorid':_0x12e5a3[_0xe5e0('0x6d')]})[_0xe5e0('0x1b')](function(_0x5b15fc){});}})[_0xe5e0('0x1f')](function(){if(_0x13932c['destinationchannel']){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x74'),'channel':_0x13932c['destinationchannel'],'mixmonitorid':_0x12e5a3[_0xe5e0('0x6d')]})[_0xe5e0('0x1b')](function(_0x596990){});}})[_0xe5e0('0x1f')](function(_0x312293){var _0x24f370=_[_0xe5e0('0x60')](_0x13932c[_0xe5e0('0x68')],{'mixmonitorid':_0x12e5a3['mixmonitorid']});if(_0x24f370){_0x24f370[_0xe5e0('0x6f')]='stop';}})[_0xe5e0('0x1f')](function(){var _0x52106a=util[_0xe5e0('0x64')](_0xe5e0('0x65'),_0x12e5a3[_0xe5e0('0x75')]||_0x12e5a3[_0xe5e0('0x62')],_0x12e5a3[_0xe5e0('0x64')]||_0xe5e0('0x76'));var _0x17fb65=_[_0xe5e0('0x60')](_0x13932c['monitors'],{'filename':_0xe5e0('0x69')+_0x52106a[_0xe5e0('0x6a')]()});if(_0x17fb65){_0x17fb65[_0xe5e0('0x6f')]='stop';}})[_0xe5e0('0x1f')](function(){_0x21f7ed({'code':0xc8,'message':[_0x12e5a3[_0xe5e0('0x62')],_0xe5e0('0x77')]['join']('\x20')});})['catch'](function(_0x3803d8){_0x37c521(_0x38c0e8[_0xe5e0('0x1d')](0x1f5,[_0x12e5a3[_0xe5e0('0x62')],_0x3803d8[_0xe5e0('0x1c')]['toLowerCase']()][_0xe5e0('0x15')]('\x20')));});}else{return _0x37c521(_0x38c0e8['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4d4908){return new Promise(function(_0xd0bb59,_0x41df32){var _0x49a874=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x78')]);_0xd0bb59({'count':_0x49a874[_0xe5e0('0x5c')],'rows':_0x49a874});});},'VoiceQueuesChannel':function(_0x214df7){var _0x16cfe1=this;return new Promise(function(_0x16ac31,_0x1e3281){var _0x105b24=schema(properties['voicequeuechannel'])[_0xe5e0('0x2')](_0x214df7);if(_0x105b24[_0xe5e0('0x5c')]>0x0){return _0x1e3281(_0x16cfe1[_0xe5e0('0x1d')](0x1f4,_['map'](_0x105b24,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x5cdbbf=_['find'](_0x52407b['queueChannels'],{'uniqueid':_0x214df7[_0xe5e0('0x62')]});if(_0x5cdbbf){_0x16ac31(_0x5cdbbf);}else{return _0x1e3281(_0x16cfe1[_0xe5e0('0x1d')](0x1f5,_0xe5e0('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x296d5c){var _0x394a7f=this;return new Promise(function(_0x34caa4,_0xc140c9){if(ami[_0xe5e0('0x11')]()==![]){return _0xc140c9(_0x394a7f['error'](0x1f4,[config['asterisk']['ip'],config[_0xe5e0('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x58dcef=schema(properties['voicequeuechannelhangup'])[_0xe5e0('0x2')](_0x296d5c);if(_0x58dcef['length']>0x0){return _0xc140c9(_0x394a7f[_0xe5e0('0x1d')](0x1f4,_[_0xe5e0('0x72')](_0x58dcef,_0xe5e0('0x1c'))['join'](',\x20')));}var _0x261a5a=_[_0xe5e0('0x60')](_0x52407b[_0xe5e0('0x78')],{'uniqueid':_0x296d5c['uniqueid']});if(_0x261a5a&&_0x261a5a[_0xe5e0('0x63')]){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x79'),'channel':_0x261a5a[_0xe5e0('0x63')]})['then'](function(_0x12d9f5){_0x34caa4({'code':0xc8,'message':[_0x296d5c[_0xe5e0('0x62')],_0x12d9f5[_0xe5e0('0x1c')]['toLowerCase']()][_0xe5e0('0x15')]('\x20')});})[_0xe5e0('0x1b')](function(_0x135bad){_0xc140c9(_0x394a7f[_0xe5e0('0x1d')](0x1f5,[_0x296d5c[_0xe5e0('0x62')],_0x135bad['message'][_0xe5e0('0x6a')]()]['join']('\x20')));});}else{return _0xc140c9(_0x394a7f[_0xe5e0('0x1d')](0x1f5,_0xe5e0('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x44aa4f){var _0x5a9b7a=this;return new Promise(function(_0x5365d7,_0x3ddad0){if(ami['isConnected']()==![]){return _0x3ddad0(_0x5a9b7a[_0xe5e0('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],_0xe5e0('0x14')][_0xe5e0('0x15')]('\x20')));}var _0xa5b53d=schema(properties['voicequeuechannelredirect'])[_0xe5e0('0x2')](_0x44aa4f);if(_0xa5b53d[_0xe5e0('0x5c')]>0x0){return _0x3ddad0(_0x5a9b7a['error'](0x1f4,_[_0xe5e0('0x72')](_0xa5b53d,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x520691=_['find'](_0x52407b[_0xe5e0('0x78')],{'uniqueid':_0x44aa4f[_0xe5e0('0x62')]});if(_0x520691&&_0x520691[_0xe5e0('0x63')]){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x7a'),'channel':_0x520691[_0xe5e0('0x63')],'exten':_0x44aa4f[_0xe5e0('0x7b')],'context':_0x44aa4f[_0xe5e0('0x7c')]||_0x520691['context'],'priority':0x1})[_0xe5e0('0x1f')](function(_0x4b8620){_0x5365d7({'code':0xc8,'message':[_0x44aa4f[_0xe5e0('0x62')],_0x4b8620['message']['toLowerCase']()][_0xe5e0('0x15')]('\x20')});})[_0xe5e0('0x1b')](function(_0x3ab8ca){_0x3ddad0(_0x5a9b7a[_0xe5e0('0x1d')](0x1f5,[_0x44aa4f['uniqueid'],_0x3ab8ca[_0xe5e0('0x1c')][_0xe5e0('0x6a')]()]['join']('\x20')));});}else{return _0x3ddad0(_0x5a9b7a[_0xe5e0('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x39f0fc){return new Promise(function(_0x309012,_0x59c32f){var _0x3fb1c3=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0xe')]);_0x309012({'count':_0x3fb1c3['length'],'rows':_0x3fb1c3});});},'Telephones':function(_0x47b2e7){return new Promise(function(_0x27ae6a,_0x56eac2){var _0x272856=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x7d')]);_0x27ae6a({'count':_0x272856[_0xe5e0('0x5c')],'rows':_0x272856});});},'Trunks':function(_0x2233d6){return new Promise(function(_0x430b70,_0x26e9dc){var _0x3ecced=_['values'](_0x52407b['trunks']);_0x430b70({'count':_0x3ecced[_0xe5e0('0x5c')],'rows':_0x3ecced});});},'OutboundChannels':function(_0x57c295){return new Promise(function(_0x24cbd1,_0x3e719e){var _0x4c47e7=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x7e')]);_0x24cbd1({'count':_0x4c47e7[_0xe5e0('0x5c')],'rows':_0x4c47e7});});},'Outbound':function(_0x42523b){return new Promise(function(_0x282fb6,_0x1c1318){_0x282fb6(_0x52407b[_0xe5e0('0x2f')]);});},'Campaigns':function(_0x25991a){return new Promise(function(_0x5b2c5d,_0x491dd3){var _0x5d5bd4=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x7f')]);_0x5b2c5d({'count':_0x5d5bd4[_0xe5e0('0x5c')],'rows':_0x5d5bd4});});},'VoiceQueuesPreview':function(_0x4fcf7e){var _0x520e3c=this;return new Promise(function(_0x102ea7,_0x1d9a34){_0x239262[_0xe5e0('0x80')](_0x4fcf7e['id'])[_0xe5e0('0x1f')](function(_0x54b7c2){_0x102ea7({'code':0xc8,'message':_0x54b7c2[_0xe5e0('0x1c')]});})[_0xe5e0('0x1b')](function(_0x28da71){_0x1d9a34(_0x520e3c[_0xe5e0('0x1d')](0x1f4,_0x28da71[_0xe5e0('0x1c')]));});});},'EventManager':function(_0x1a558f){var _0x3280ed=this;return new Promise(function(_0x31023a,_0x2bf02c){if(!_0x1a558f[_0xe5e0('0x81')]){return _0x2bf02c(_0x3280ed[_0xe5e0('0x1d')](0x1f4,_0xe5e0('0x82')));}ami[_0xe5e0('0x83')](_0xe5e0('0x84')+_0x1a558f[_0xe5e0('0x81')],_0x1a558f['message']);_0x31023a({'code':0xc8,'message':_0x1a558f});});},'FaxAccounts':function(_0x2f7df8){return new Promise(function(_0x54922c,_0x35fbd6){var _0x568aca=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x85')]);_0x54922c({'count':_0x568aca[_0xe5e0('0x5c')],'rows':_0x568aca});});},'SendFax':function(_0x36231d){var _0x6989a6=this;return new Promise(function(_0x524ab0,_0x411720){_0x3e564e[_0xe5e0('0x86')](_0x36231d)['then'](function(_0x3a20e4){_0x524ab0({'code':0xc8,'message':_0x3a20e4[_0xe5e0('0x1c')]});})['catch'](function(_0xb6b336){_0x411720(_0x6989a6['error'](0x1f4,_0xb6b336['message']));});});},'CheckAfterSend':function(_0x56f40a){var _0x58ca90=this;return new Promise(function(_0x2794b0,_0x371ef5){_0x3e564e[_0xe5e0('0x87')](_0x56f40a)[_0xe5e0('0x1f')](function(_0x597cdd){_0x2794b0({'code':0xc8,'message':_0x597cdd[_0xe5e0('0x1c')]});})['catch'](function(_0xc922ac){_0x371ef5(_0x58ca90['error'](0x1f4,_0xc922ac[_0xe5e0('0x1c')]));});});}};var _0x5bfaf0=jayson[_0xe5e0('0x88')](_0xa91224)[_0xe5e0('0x89')]();_0x5bfaf0['on'](_0xe5e0('0x1d'),function(_0xc804a2){return _0x1a4c51(_0xc804a2);});_0x5bfaf0['listen'](0x232a,_0xe5e0('0x8a'),function(){console[_0xe5e0('0x8b')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2ff9ac(_0xe5e0('0x8c')+0x232a);});});}; \ No newline at end of file +var _0xa23f=['isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Reload','Action','then','command','content','message','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','isNil','push','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','catch','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','custom:','event','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','pause','QueuePause'];(function(_0x792821,_0x331560){var _0x2f7bf3=function(_0x2be8a5){while(--_0x2be8a5){_0x792821['push'](_0x792821['shift']());}};_0x2f7bf3(++_0x331560);}(_0xa23f,0x7c));var _0xfa23=function(_0x6f7335,_0x625597){_0x6f7335=_0x6f7335-0x0;var _0x18500c=_0xa23f[_0x6f7335];return _0x18500c;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0xfa23('0x2'));var moment=require(_0xfa23('0x3'));var config=require(_0xfa23('0x4'));var properties=require(_0xfa23('0x5'));var ami=require('../ami');exports[_0xfa23('0x6')]=function(_0x53d8c8,_0x210057,_0x2df2f5){return new BPromise(function(_0x4c3f4,_0x3696ef){var _0x4fb6e6={'QueuePause':function(_0x5a7882){return new Promise(function(_0x59d53e,_0x19a1ac){var _0x4066a2=util[_0xfa23('0x7')](_0xfa23('0x8'),_0xfa23('0x9'),_0x5a7882['name']);if(_0x53d8c8['timers']&&_0x53d8c8[_0xfa23('0xa')][_0x4066a2]&&_0x53d8c8['timers'][_0x4066a2][_0xfa23('0xb')]){_0x53d8c8['timers'][_0x4066a2][_0xfa23('0xc')]();}if(_0x53d8c8[_0xfa23('0xd')][_0x4066a2]){_0x53d8c8[_0xfa23('0xd')][_0x4066a2]['updateStatusRealtime']({'statePause':_0x5a7882[_0xfa23('0xe')]?!![]:![]});}_0x59d53e({'code':0xc8,'message':_0xfa23('0xf')});});},'Reload':function(_0x46f991){var _0x5ea9ca=this;return new Promise(function(_0x56f927,_0x17e782){if(ami[_0xfa23('0x10')]()==![]){return _0x17e782(_0x5ea9ca[_0xfa23('0x11')](0x1f4,[config[_0xfa23('0x12')]['ip'],config['asterisk'][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}_0x46f991=_[_0xfa23('0x16')](_0x46f991,_['keys'](properties[_0xfa23('0x17')]));_0x46f991[_0xfa23('0x18')]=_0xfa23('0x19');return ami[_0xfa23('0x1a')](_0x46f991)[_0xfa23('0x1b')](function(_0x4e5b77){_0x56f927({'code':0xc8,'message':_0x4e5b77['message']});})['catch'](function(_0x445bd0){_0x17e782(_0x5ea9ca[_0xfa23('0x11')](0x1f5,_0x445bd0['message']));});});},'Command':function(_0x9effe6){var _0x2c456b=this;return new Promise(function(_0x1eb87e,_0x54bb04){if(ami[_0xfa23('0x10')]()==![]){return _0x54bb04(_0x2c456b[_0xfa23('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}_0x9effe6=_[_0xfa23('0x16')](_0x9effe6,_0xfa23('0x1c'));_0x9effe6[_0xfa23('0x18')]='Command';return ami[_0xfa23('0x1a')](_0x9effe6)[_0xfa23('0x1b')](function(_0x34a2ce){_0x1eb87e({'code':0xc8,'message':_0x34a2ce[_0xfa23('0x1d')]});})['catch'](function(_0x4500a2){_0x54bb04(_0x2c456b['error'](0x1f5,_0x4500a2[_0xfa23('0x1e')]));});});},'VoiceQueues':function(_0x1abb42){return new Promise(function(_0x2481e9,_0x26bdce){var _0x3362f3=[];for(var _0x1340d9 in _0x53d8c8[_0xfa23('0x1f')]){if(_0x53d8c8[_0xfa23('0x1f')]['hasOwnProperty'](_0x1340d9)){var _0x2ae826=_0x53d8c8['voiceQueues'][_0x1340d9];var _0x1ae38a={'id':_0x2ae826['id'],'name':_0x2ae826['name'],'strategy':_0x2ae826['strategy'],'answered':_0x2ae826[_0xfa23('0x20')],'available':_0x2ae826[_0xfa23('0x21')],'loggedIn':_0x2ae826[_0xfa23('0x22')],'pTalking':_0x2ae826[_0xfa23('0x23')],'sumBillable':_0x2ae826[_0xfa23('0x24')],'sumDuration':_0x2ae826[_0xfa23('0x25')],'sumHoldTime':_0x2ae826[_0xfa23('0x26')]||0x0,'talking':_0x2ae826['talking'],'total':_0x2ae826[_0xfa23('0x27')],'type':_0x2ae826['type'],'unmanaged':_0x2ae826[_0xfa23('0x28')],'abandoned':_0x2ae826[_0xfa23('0x29')],'waiting':_0x2ae826['waiting'],'loggedInDb':_0x2ae826[_0xfa23('0x2a')]};if(_0x2ae826[_0xfa23('0x2b')]===_0xfa23('0x2c')){_0x1ae38a[_0xfa23('0x2d')]=_0x2ae826[_0xfa23('0x2d')];_0x1ae38a[_0xfa23('0x2e')]=_0x2ae826[_0xfa23('0x2e')];_0x1ae38a[_0xfa23('0x2f')]=_0x2ae826[_0xfa23('0x2f')];_0x1ae38a['dialOriginateCallerIdNumber']=_0x2ae826[_0xfa23('0x30')];_0x1ae38a['dialOriginateTimeout']=_0x2ae826[_0xfa23('0x31')];_0x1ae38a[_0xfa23('0x32')]=_0x2ae826[_0xfa23('0x32')];_0x1ae38a[_0xfa23('0x33')]=_0x2ae826[_0xfa23('0x33')];_0x1ae38a[_0xfa23('0x34')]=_0x2ae826[_0xfa23('0x34')];_0x1ae38a[_0xfa23('0x35')]=_0x2ae826[_0xfa23('0x35')];_0x1ae38a['outboundBlacklistCallsDay']=_0x2ae826[_0xfa23('0x36')];_0x1ae38a['outboundBusyCallsDay']=_0x2ae826[_0xfa23('0x37')];_0x1ae38a[_0xfa23('0x38')]=_0x2ae826[_0xfa23('0x38')];_0x1ae38a[_0xfa23('0x39')]=_0x2ae826[_0xfa23('0x39')];_0x1ae38a[_0xfa23('0x3a')]=_0x2ae826[_0xfa23('0x3a')];_0x1ae38a['outboundDropCallsDayTimeout']=_0x2ae826[_0xfa23('0x3b')];_0x1ae38a[_0xfa23('0x3c')]=_0x2ae826[_0xfa23('0x3c')];_0x1ae38a[_0xfa23('0x3d')]=_0x2ae826['outboundNoSuchCallsDay'];_0x1ae38a['outboundOriginateFailureCallsDay']=_0x2ae826['outboundOriginateFailureCallsDay'];_0x1ae38a[_0xfa23('0x3e')]=_0x2ae826[_0xfa23('0x3e')];_0x1ae38a['outboundRejectCallsDay']=_0x2ae826[_0xfa23('0x3f')];_0x1ae38a[_0xfa23('0x40')]=_0x2ae826[_0xfa23('0x40')];_0x1ae38a['predictiveIntervalAnsweredCalls']=_0x2ae826[_0xfa23('0x41')];_0x1ae38a['predictiveIntervalAvgHoldtime']=_0x2ae826[_0xfa23('0x42')];_0x1ae38a[_0xfa23('0x43')]=_0x2ae826[_0xfa23('0x43')];_0x1ae38a[_0xfa23('0x44')]=_0x2ae826[_0xfa23('0x44')];_0x1ae38a[_0xfa23('0x45')]=_0x2ae826['predictiveIntervalDroppedCallsTimeout'];_0x1ae38a[_0xfa23('0x46')]=_0x2ae826[_0xfa23('0x46')];_0x1ae38a[_0xfa23('0x47')]=_0x2ae826[_0xfa23('0x47')];_0x1ae38a['predictiveIntervalHitRate']=_0x2ae826[_0xfa23('0x48')];_0x1ae38a[_0xfa23('0x49')]=_0x2ae826[_0xfa23('0x49')];_0x1ae38a[_0xfa23('0x4a')]=_0x2ae826[_0xfa23('0x4a')];_0x1ae38a[_0xfa23('0x4b')]=_0x2ae826['predictiveIntervalAvailable'];_0x1ae38a[_0xfa23('0x4c')]=_0x2ae826['predictiveIntervalTotalCalls'];_0x1ae38a['message']=_0x2ae826[_0xfa23('0x1e')];_0x1ae38a[_0xfa23('0x4d')]=_0x2ae826['originated'];_0x1ae38a[_0xfa23('0x4e')]=_0x2ae826[_0xfa23('0x4e')];_0x1ae38a[_0xfa23('0x4f')]=_0x2ae826['erlangCallToSecond'];_0x1ae38a[_0xfa23('0x50')]=_0x2ae826[_0xfa23('0x50')];_0x1ae38a[_0xfa23('0x51')]=_0x2ae826['erlangBusyFactor'];_0x1ae38a['startPredictive']=_0x2ae826[_0xfa23('0x52')];_0x1ae38a['startProgressive']=_0x2ae826[_0xfa23('0x53')];}if(_0x2ae826[_0xfa23('0x54')]){_0x1ae38a[_0xfa23('0x54')]={'id':_0x2ae826['Trunk']['id'],'name':_0x2ae826[_0xfa23('0x54')][_0xfa23('0x55')],'active':_0x2ae826[_0xfa23('0x54')][_0xfa23('0x56')],'callerid':_0x2ae826['Trunk'][_0xfa23('0x57')]};}if(_0x2ae826[_0xfa23('0x58')]){_0x1ae38a[_0xfa23('0x58')]={'id':_0x2ae826['Interval']['id'],'name':_0x2ae826['Interval'][_0xfa23('0x55')]};}_0x3362f3['push'](_0x1ae38a);}}_0x2481e9({'count':_0x3362f3[_0xfa23('0x59')],'rows':_0x3362f3});});},'UpdateVoiceQueue':function(_0x3bddca){return new Promise(function(_0x12b986,_0xf8b228){var _0x2fbf18=_[_0xfa23('0x5a')](_0x53d8c8['voiceQueues'],{'id':parseInt(_0x3bddca['id'])});var _0xd2345d=_[_0xfa23('0x5b')](_0x3bddca,['id']);if(_0x2fbf18){for(var _0x36a795 in _0xd2345d){if(typeof _0xd2345d[_0x36a795]!==_0xfa23('0x5c')&&typeof _0x2fbf18[_0x36a795]!==_0xfa23('0x5c')){_0x2fbf18[_0x36a795]=_0xd2345d[_0x36a795];}}_0x12b986(_0x2fbf18);}else{_0xf8b228();}});},'VoiceChannels':function(_0xf8b8c7){return new Promise(function(_0x4aba2a,_0x9e8cb6){var _0x36a02c=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x5e')]);_0x4aba2a({'count':_0x36a02c[_0xfa23('0x59')],'rows':_0x36a02c});});},'VoiceChannelMixMonitor':function(_0x4bfe28){var _0x1fbdff=this;return new Promise(function(_0x213fcd,_0x18afb9){if(ami['isConnected']()==![]){return _0x18afb9(_0x1fbdff[_0xfa23('0x11')](0x1f4,[config[_0xfa23('0x12')]['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}var _0x709755=schema(properties['voicechannel'])[_0xfa23('0x5f')](_0x4bfe28);if(_0x709755['length']>0x0){return _0x18afb9(_0x1fbdff[_0xfa23('0x11')](0x1f4,_[_0xfa23('0x60')](_0x709755,_0xfa23('0x1e'))[_0xfa23('0x15')](',\x20')));}var _0x12a984=_[_0xfa23('0x5a')](_0x53d8c8['channels'],{'uniqueid':_0x4bfe28[_0xfa23('0x61')]});if(_0x12a984&&_0x12a984[_0xfa23('0x62')]){var _0x2ec20b=util[_0xfa23('0x7')](_0xfa23('0x63'),_0x4bfe28[_0xfa23('0x64')]||_0x4bfe28[_0xfa23('0x61')],_0x4bfe28['format']||_0xfa23('0x65'));return ami[_0xfa23('0x1a')]({'action':_0xfa23('0x66'),'channel':_0x12a984[_0xfa23('0x62')],'file':_0x2ec20b,'options':'ai(mixmonitorid)'})[_0xfa23('0x1b')](function(_0x9bf852){var _0xe6cf80=_[_0xfa23('0x5a')](_0x12a984[_0xfa23('0x67')],{'filename':_0xfa23('0x68')+_0x2ec20b['toLowerCase']()});if(_[_0xfa23('0x69')](_0xe6cf80)){_0x12a984['monitors'][_0xfa23('0x6a')]({'filename':_0xfa23('0x68')+_0x2ec20b['toLowerCase'](),'createdAt':moment()[_0xfa23('0x7')](_0xfa23('0x6b')),'mixmonitorid':_0x9bf852['mixmonitorid'],'status':_0xfa23('0x6c')});}else{_0xe6cf80[_0xfa23('0x6d')]=_0x9bf852['mixmonitorid'];_0xe6cf80[_0xfa23('0x6e')]=_0xfa23('0x6c');}_0x213fcd({'code':0xc8,'message':[_0x4bfe28[_0xfa23('0x61')],_0xfa23('0x6f'),_0x9bf852['mixmonitorid']][_0xfa23('0x15')]('\x20'),'mixmonitorid':_0x9bf852[_0xfa23('0x6d')]});})['catch'](function(_0x2d1c75){_0x18afb9(_0x1fbdff[_0xfa23('0x11')](0x1f5,[_0x4bfe28[_0xfa23('0x61')],_0x2d1c75[_0xfa23('0x1e')][_0xfa23('0x70')]()][_0xfa23('0x15')]('\x20')));});}else{return _0x18afb9(_0x1fbdff['error'](0x1f5,_0xfa23('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x3a7fcb){var _0x10eb86=this;return new Promise(function(_0x5d479e,_0x125c46){if(ami[_0xfa23('0x10')]()==![]){return _0x125c46(_0x10eb86[_0xfa23('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}var _0x378d29=schema(properties['voicechannel'])['validate'](_0x3a7fcb);if(_0x378d29[_0xfa23('0x59')]>0x0){return _0x125c46(_0x10eb86[_0xfa23('0x11')](0x1f4,_[_0xfa23('0x60')](_0x378d29,_0xfa23('0x1e'))['join'](',\x20')));}var _0x5275d6=_[_0xfa23('0x5a')](_0x53d8c8[_0xfa23('0x5e')],{'uniqueid':_0x3a7fcb[_0xfa23('0x61')]});if(_0x5275d6){return BPromise[_0xfa23('0x72')]()['then'](function(){if(_0x5275d6[_0xfa23('0x62')]){return ami[_0xfa23('0x1a')]({'action':'StopMixMonitor','channel':_0x5275d6[_0xfa23('0x62')],'mixmonitorid':_0x3a7fcb[_0xfa23('0x6d')]})['catch'](function(_0x13af06){});}})[_0xfa23('0x1b')](function(){if(_0x5275d6[_0xfa23('0x73')]){return ami[_0xfa23('0x1a')]({'action':_0xfa23('0x74'),'channel':_0x5275d6[_0xfa23('0x73')],'mixmonitorid':_0x3a7fcb['mixmonitorid']})[_0xfa23('0x75')](function(_0x591953){});}})[_0xfa23('0x1b')](function(_0x263f8c){var _0x192d28=_[_0xfa23('0x5a')](_0x5275d6[_0xfa23('0x67')],{'mixmonitorid':_0x3a7fcb[_0xfa23('0x6d')]});if(_0x192d28){_0x192d28[_0xfa23('0x6e')]=_0xfa23('0x76');}})[_0xfa23('0x1b')](function(){var _0x4e05f0=util[_0xfa23('0x7')]('%s.%s',_0x3a7fcb[_0xfa23('0x64')]||_0x3a7fcb[_0xfa23('0x61')],_0x3a7fcb['format']||'wav');var _0x3f6070=_['find'](_0x5275d6[_0xfa23('0x67')],{'filename':_0xfa23('0x68')+_0x4e05f0[_0xfa23('0x70')]()});if(_0x3f6070){_0x3f6070[_0xfa23('0x6e')]=_0xfa23('0x76');}})[_0xfa23('0x1b')](function(){_0x5d479e({'code':0xc8,'message':[_0x3a7fcb[_0xfa23('0x61')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xfa23('0x75')](function(_0x1e540d){_0x125c46(_0x10eb86[_0xfa23('0x11')](0x1f5,[_0x3a7fcb[_0xfa23('0x61')],_0x1e540d['message'][_0xfa23('0x70')]()]['join']('\x20')));});}else{return _0x125c46(_0x10eb86[_0xfa23('0x11')](0x1f5,_0xfa23('0x71')));}});},'VoiceQueuesChannels':function(_0x20c757){return new Promise(function(_0x279d86,_0x74a9aa){var _0x3bf459=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x77')]);_0x279d86({'count':_0x3bf459[_0xfa23('0x59')],'rows':_0x3bf459});});},'VoiceQueuesChannel':function(_0x4130cf){var _0x5c3a1e=this;return new Promise(function(_0x5b1337,_0x146e12){var _0x53fac6=schema(properties[_0xfa23('0x78')])['validate'](_0x4130cf);if(_0x53fac6[_0xfa23('0x59')]>0x0){return _0x146e12(_0x5c3a1e[_0xfa23('0x11')](0x1f4,_['map'](_0x53fac6,_0xfa23('0x1e'))['join'](',\x20')));}var _0x4e0a93=_[_0xfa23('0x5a')](_0x53d8c8[_0xfa23('0x77')],{'uniqueid':_0x4130cf['uniqueid']});if(_0x4e0a93){_0x5b1337(_0x4e0a93);}else{return _0x146e12(_0x5c3a1e[_0xfa23('0x11')](0x1f5,_0xfa23('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x2bd0f9){var _0x41287e=this;return new Promise(function(_0x3da38c,_0x1f359a){if(ami[_0xfa23('0x10')]()==![]){return _0x1f359a(_0x41287e['error'](0x1f4,[config[_0xfa23('0x12')]['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],_0xfa23('0x14')][_0xfa23('0x15')]('\x20')));}var _0x4c525f=schema(properties[_0xfa23('0x79')])['validate'](_0x2bd0f9);if(_0x4c525f['length']>0x0){return _0x1f359a(_0x41287e['error'](0x1f4,_[_0xfa23('0x60')](_0x4c525f,_0xfa23('0x1e'))[_0xfa23('0x15')](',\x20')));}var _0x4bdfee=_[_0xfa23('0x5a')](_0x53d8c8[_0xfa23('0x77')],{'uniqueid':_0x2bd0f9['uniqueid']});if(_0x4bdfee&&_0x4bdfee[_0xfa23('0x62')]){return ami[_0xfa23('0x1a')]({'action':_0xfa23('0x7a'),'channel':_0x4bdfee[_0xfa23('0x62')]})['then'](function(_0x5ef233){_0x3da38c({'code':0xc8,'message':[_0x2bd0f9[_0xfa23('0x61')],_0x5ef233['message'][_0xfa23('0x70')]()][_0xfa23('0x15')]('\x20')});})[_0xfa23('0x75')](function(_0x4a77e5){_0x1f359a(_0x41287e[_0xfa23('0x11')](0x1f5,[_0x2bd0f9[_0xfa23('0x61')],_0x4a77e5[_0xfa23('0x1e')][_0xfa23('0x70')]()][_0xfa23('0x15')]('\x20')));});}else{return _0x1f359a(_0x41287e[_0xfa23('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x1f2103){var _0x1f28a0=this;return new Promise(function(_0x37548a,_0x37d22c){if(ami[_0xfa23('0x10')]()==![]){return _0x37d22c(_0x1f28a0[_0xfa23('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xfa23('0x12')][_0xfa23('0x13')],'ami\x20disconnected'][_0xfa23('0x15')]('\x20')));}var _0x1f3286=schema(properties[_0xfa23('0x7b')])[_0xfa23('0x5f')](_0x1f2103);if(_0x1f3286[_0xfa23('0x59')]>0x0){return _0x37d22c(_0x1f28a0['error'](0x1f4,_[_0xfa23('0x60')](_0x1f3286,'message')['join'](',\x20')));}var _0x5e54bf=_['find'](_0x53d8c8[_0xfa23('0x77')],{'uniqueid':_0x1f2103['uniqueid']});if(_0x5e54bf&&_0x5e54bf[_0xfa23('0x62')]){return ami[_0xfa23('0x1a')]({'action':_0xfa23('0x7c'),'channel':_0x5e54bf[_0xfa23('0x62')],'exten':_0x1f2103[_0xfa23('0x7d')],'context':_0x1f2103[_0xfa23('0x7e')]||_0x5e54bf[_0xfa23('0x7e')],'priority':0x1})[_0xfa23('0x1b')](function(_0x53d266){_0x37548a({'code':0xc8,'message':[_0x1f2103[_0xfa23('0x61')],_0x53d266['message'][_0xfa23('0x70')]()][_0xfa23('0x15')]('\x20')});})['catch'](function(_0x2c4684){_0x37d22c(_0x1f28a0[_0xfa23('0x11')](0x1f5,[_0x1f2103['uniqueid'],_0x2c4684[_0xfa23('0x1e')]['toLowerCase']()][_0xfa23('0x15')]('\x20')));});}else{return _0x37d22c(_0x1f28a0['error'](0x1f5,_0xfa23('0x71')));}});},'Agents':function(_0x500dde){return new Promise(function(_0xea852,_0x249322){var _0x5751f5=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0xd')]);_0xea852({'count':_0x5751f5[_0xfa23('0x59')],'rows':_0x5751f5});});},'Telephones':function(_0x4c19d3){return new Promise(function(_0xf65690,_0x518e4d){var _0xfee428=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x7f')]);_0xf65690({'count':_0xfee428[_0xfa23('0x59')],'rows':_0xfee428});});},'Trunks':function(_0x58f34e){return new Promise(function(_0x3e0a3e,_0x4aa9ba){var _0x30c836=_['values'](_0x53d8c8[_0xfa23('0x80')]);_0x3e0a3e({'count':_0x30c836[_0xfa23('0x59')],'rows':_0x30c836});});},'OutboundChannels':function(_0x70ba0f){return new Promise(function(_0x376b22,_0x3b5c4b){var _0x51e5fc=_[_0xfa23('0x5d')](_0x53d8c8['outboundChannels']);_0x376b22({'count':_0x51e5fc['length'],'rows':_0x51e5fc});});},'Outbound':function(_0x1bf189){return new Promise(function(_0x2c1e16,_0x37710e){_0x2c1e16(_0x53d8c8[_0xfa23('0x2c')]);});},'Campaigns':function(_0x49d168){return new Promise(function(_0x367701,_0x3ee296){var _0x1d300b=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x81')]);_0x367701({'count':_0x1d300b[_0xfa23('0x59')],'rows':_0x1d300b});});},'VoiceQueuesPreview':function(_0x2bdc8e){var _0x331c65=this;return new Promise(function(_0x2afcf4,_0x1d657d){_0x210057[_0xfa23('0x82')](_0x2bdc8e['id'])[_0xfa23('0x1b')](function(_0x561942){_0x2afcf4({'code':0xc8,'message':_0x561942[_0xfa23('0x1e')]});})[_0xfa23('0x75')](function(_0x250869){_0x1d657d(_0x331c65[_0xfa23('0x11')](0x1f4,_0x250869[_0xfa23('0x1e')]));});});},'EventManager':function(_0x1cb225){var _0x43ea=this;return new Promise(function(_0x5a4ec3,_0x16ad12){if(!_0x1cb225['event']){return _0x16ad12(_0x43ea['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0xfa23('0x83')+_0x1cb225[_0xfa23('0x84')],_0x1cb225[_0xfa23('0x1e')]);_0x5a4ec3({'code':0xc8,'message':_0x1cb225});});},'FaxAccounts':function(_0x4da911){return new Promise(function(_0x413eff,_0x1d5f64){var _0x28ed8c=_[_0xfa23('0x5d')](_0x53d8c8[_0xfa23('0x85')]);_0x413eff({'count':_0x28ed8c['length'],'rows':_0x28ed8c});});},'SendFax':function(_0x1633eb){var _0x45c355=this;return new Promise(function(_0x19acfa,_0x154e8c){_0x2df2f5[_0xfa23('0x86')](_0x1633eb)[_0xfa23('0x1b')](function(_0x5618ed){_0x19acfa({'code':0xc8,'message':_0x5618ed['message']});})['catch'](function(_0x590f3f){_0x154e8c(_0x45c355[_0xfa23('0x11')](0x1f4,_0x590f3f[_0xfa23('0x1e')]));});});},'CheckAfterSend':function(_0x27fedb){var _0xa547c4=this;return new Promise(function(_0xed12f2,_0x5d4222){_0x2df2f5[_0xfa23('0x87')](_0x27fedb)[_0xfa23('0x1b')](function(_0x36b9c5){_0xed12f2({'code':0xc8,'message':_0x36b9c5['message']});})[_0xfa23('0x75')](function(_0x4cb34a){_0x5d4222(_0xa547c4['error'](0x1f4,_0x4cb34a[_0xfa23('0x1e')]));});});}};var _0x31b96e=jayson[_0xfa23('0x88')](_0x4fb6e6)[_0xfa23('0x89')]();_0x31b96e['on']('error',function(_0x6bdaf0){return _0x3696ef(_0x6bdaf0);});_0x31b96e[_0xfa23('0x6')](0x232a,'127.0.0.1',function(){console[_0xfa23('0x8a')](_0xfa23('0x8b'),0x232a);return _0x4c3f4('RPC\x20listening\x20on\x20port:'+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 e7be56a..461fd17 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 _0x0e85=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0x0e85,0x7c));var _0x50e8=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x0e85[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x50e8('0x0'));var BPromise=require(_0x50e8('0x1'));var Redis=require('ioredis');var util=require(_0x50e8('0x2'));var config=require(_0x50e8('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x50e8('0x4')]=_['defaults'](config[_0x50e8('0x4')],{'host':_0x50e8('0x5'),'port':0x18eb});var io=require(_0x50e8('0x6'))(new Redis(config[_0x50e8('0x4')]));function emit(_0x5e8b01,_0x3ce904,_0x108edc,_0x42665e,_0x988da0){logger[_0x50e8('0x7')](_0x50e8('0x8'),_0x5e8b01,_0x3ce904['id'],_0x108edc,_0x42665e,JSON['stringify'](_0x988da0));io['to'](_0x108edc)[_0x50e8('0x9')](_0x42665e,_0x988da0);}exports[_0x50e8('0xa')]=function(_0x19d1bc,_0x2d4750,_0x154b9e,_0x194a89){var _0x45dc6f,_0x3d25ea;var _0x55ba0a={};var _0x56707f=Number(_0x154b9e[_0x50e8('0xb')]);var _0x24d381=_0x154b9e['data2']?Boolean(Number(_0x154b9e['data2'])):![];var _0x3cb45c;var _0x2abda1=![];if(!_[_0x50e8('0xc')](_0x154b9e[_0x50e8('0xd')])){if(_0x154b9e['data5']=='1')_0x2abda1=!![];}if(!_0x2abda1){if(_0x194a89[_0x50e8('0xe')]){_0x55ba0a['id']=_0x194a89[_0x50e8('0xe')];}}if(!_0x55ba0a['id']){_0x55ba0a[_0x50e8('0xf')]=_0x56707f;_0x3cb45c=_0x154b9e['data3']&&_0x154b9e['data3']!=='0'?_0x154b9e[_0x50e8('0x10')][_0x50e8('0x11')](','):[_0x50e8('0x12')];_0x55ba0a[_0x50e8('0x13')]=_[_0x50e8('0x14')](_0x3cb45c,function(_0x1f0338){var _0x5642bf={};_0x5642bf[_0x1f0338]=_0x194a89['routeId']?_0x194a89[_0x50e8('0x15')]:_0x194a89[_0x50e8('0x16')];return _0x5642bf;});}var _0x40d060=['id',_0x50e8('0x17'),_0x50e8('0x18'),_0x50e8('0x12'),_0x50e8('0x19'),'fax',_0x50e8('0xf'),'createdAt',_0x50e8('0x1a'),_0x50e8('0x1b')];var _0xd263d=_[_0x50e8('0x1c')](_0x40d060,_0x3cb45c);BPromise[_0x50e8('0x1d')]()['then'](cmContactRpc[_0x50e8('0x1e')]({'attributes':_0xd263d,'where':_0x55ba0a}))[_0x50e8('0x1f')](function(_0x58110d){_0x3d25ea=_0x58110d;if(!_[_0x50e8('0x20')](_0x3d25ea)){if(_0x3d25ea[_0x50e8('0x21')]===0x1){_0x45dc6f=_0x3d25ea[0x0];logger['info'](_0x50e8('0x22'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id'],_0x45dc6f['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x194a89['uniqueid'],_0x2d4750['id'],_[_0x50e8('0x14')](_0x3d25ea,'id')[_0x50e8('0x24')](','));}return;}else{logger[_0x50e8('0x7')](_0x50e8('0x25'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);var _0x13b6e9={'ListId':_0x56707f};var _0x53d848=_0x154b9e[_0x50e8('0x26')]&&_0x154b9e[_0x50e8('0x26')]!=='0'?_0x154b9e['data4']:_0x50e8('0x12');if(_0x24d381){logger[_0x50e8('0x7')](_0x50e8('0x27'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);_0x13b6e9[_0x53d848]=_['isNil'](_0x194a89[_0x50e8('0x28')])?_0x194a89['calleridnum']:_0x194a89[_0x50e8('0x15')];if(_[_0x50e8('0xc')](_0x194a89[_0x50e8('0x28')])){_0x13b6e9['firstName']=_0x194a89[_0x50e8('0x29')]&&_0x194a89[_0x50e8('0x29')]!==_0x50e8('0x2a')?_0x194a89[_0x50e8('0x29')]:_0x50e8('0x2b');}else{_0x13b6e9[_0x50e8('0x17')]=_0x194a89[_0x50e8('0x2c')]&&_0x194a89['destcalleridname']!==_0x50e8('0x2a')?_0x194a89[_0x50e8('0x2c')]:'Unknown';}return BPromise['resolve']()[_0x50e8('0x1f')](cmContactRpc[_0x50e8('0x2d')](_0x13b6e9))[_0x50e8('0x1f')](function(_0x47ace2){_0x45dc6f=_0x47ace2;_0x3d25ea['push'](_0x47ace2);if(_0x45dc6f){logger[_0x50e8('0x7')](_0x50e8('0x2e'),_0x194a89['uniqueid'],_0x2d4750['id'],_0x45dc6f['id']);}return;});}else{logger[_0x50e8('0x7')](_0x50e8('0x2f'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);_0x13b6e9[_0x53d848]=_[_0x50e8('0xc')](_0x194a89['routeId'])?_0x194a89[_0x50e8('0x16')]:_0x194a89['destcalleridnum'];if(_[_0x50e8('0xc')](_0x194a89[_0x50e8('0x28')])){_0x13b6e9[_0x50e8('0x17')]=_0x194a89['calleridname']&&_0x194a89[_0x50e8('0x29')]!==_0x50e8('0x2a')?_0x194a89['calleridname']:_0x50e8('0x2b');}else{_0x13b6e9[_0x50e8('0x17')]=_0x194a89[_0x50e8('0x2c')]&&_0x194a89[_0x50e8('0x2c')]!==''?_0x194a89[_0x50e8('0x2c')]:_0x50e8('0x2b');}_0x45dc6f=_0x13b6e9;_0x3d25ea[_0x50e8('0x30')](_0x13b6e9);return;}}})[_0x50e8('0x1f')](function(){if(_0x19d1bc){emit(_0x194a89['uniqueid'],_0x2d4750,util[_0x50e8('0x31')](_0x50e8('0x32'),_0x19d1bc[_0x50e8('0x33')]),util['format']('trigger:%s',_0x154b9e['action'][_0x50e8('0x34')]()),{'evt':_[_0x50e8('0x35')](_0x194a89,{'autoCreate':_0x24d381}),'contact':_0x45dc6f===undefined?{}:_0x45dc6f,'contacts':_0x3d25ea[_0x50e8('0x21')]===0x0?undefined:_0x3d25ea});}});}; \ No newline at end of file +var _0x98a8=['[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push'];(function(_0x4b1560,_0x11721f){var _0x10dfb1=function(_0x206296){while(--_0x206296){_0x4b1560['push'](_0x4b1560['shift']());}};_0x10dfb1(++_0x11721f);}(_0x98a8,0x12c));var _0x898a=function(_0x25d697,_0xacbe36){_0x25d697=_0x25d697-0x0;var _0x46b4eb=_0x98a8[_0x25d697];return _0x46b4eb;};'use strict';var _=require(_0x898a('0x0'));var BPromise=require(_0x898a('0x1'));var Redis=require(_0x898a('0x2'));var util=require(_0x898a('0x3'));var config=require(_0x898a('0x4'));var logger=require(_0x898a('0x5'))(_0x898a('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x898a('0x7')]=_[_0x898a('0x8')](config[_0x898a('0x7')],{'host':_0x898a('0x9'),'port':0x18eb});var io=require(_0x898a('0xa'))(new Redis(config['redis']));function emit(_0x3aadc2,_0x564583,_0xfa8c50,_0x4fbce5,_0x42021d){logger[_0x898a('0xb')](_0x898a('0xc'),_0x3aadc2,_0x564583['id'],_0xfa8c50,_0x4fbce5,JSON[_0x898a('0xd')](_0x42021d));io['to'](_0xfa8c50)[_0x898a('0xe')](_0x4fbce5,_0x42021d);}exports[_0x898a('0xf')]=function(_0x42faa4,_0x1a92de,_0x3806cb,_0x5d2de4){var _0x3e1867,_0x502e95;var _0x30257f={};var _0x5d5924=Number(_0x3806cb[_0x898a('0x10')]);var _0x2c76b7=_0x3806cb[_0x898a('0x11')]?Boolean(Number(_0x3806cb['data2'])):![];var _0x5bfded;var _0x5b5c9c=![];if(!_[_0x898a('0x12')](_0x3806cb[_0x898a('0x13')])){if(_0x3806cb[_0x898a('0x13')]=='1')_0x5b5c9c=!![];}if(!_0x5b5c9c){if(_0x5d2de4[_0x898a('0x14')]){_0x30257f['id']=_0x5d2de4[_0x898a('0x14')];}}if(!_0x30257f['id']){_0x30257f[_0x898a('0x15')]=_0x5d5924;_0x5bfded=_0x3806cb['data3']&&_0x3806cb[_0x898a('0x16')]!=='0'?_0x3806cb['data3'][_0x898a('0x17')](','):['phone'];_0x30257f[_0x898a('0x18')]=_['map'](_0x5bfded,function(_0x18d167){var _0x56f8f9={};_0x56f8f9[_0x18d167]=_0x5d2de4[_0x898a('0x19')]?_0x5d2de4[_0x898a('0x1a')]:_0x5d2de4[_0x898a('0x1b')];return _0x56f8f9;});}var _0x4ddd4d=['id',_0x898a('0x1c'),'lastName','phone',_0x898a('0x1d'),_0x898a('0x1e'),'ListId','createdAt',_0x898a('0x1f'),_0x898a('0x20')];var _0x38a8f0=_[_0x898a('0x21')](_0x4ddd4d,_0x5bfded);BPromise[_0x898a('0x22')]()[_0x898a('0x23')](cmContactRpc[_0x898a('0x24')]({'attributes':_0x38a8f0,'where':_0x30257f}))['then'](function(_0x247cfc){_0x502e95=_0x247cfc;if(!_[_0x898a('0x25')](_0x502e95)){if(_0x502e95[_0x898a('0x26')]===0x1){_0x3e1867=_0x502e95[0x0];logger[_0x898a('0xb')](_0x898a('0x27'),_0x5d2de4[_0x898a('0x28')],_0x1a92de['id'],_0x3e1867['id']);}else{logger['info'](_0x898a('0x29'),_0x5d2de4[_0x898a('0x28')],_0x1a92de['id'],_[_0x898a('0x2a')](_0x502e95,'id')[_0x898a('0x2b')](','));}return;}else{logger[_0x898a('0xb')](_0x898a('0x2c'),_0x5d2de4['uniqueid'],_0x1a92de['id']);var _0x20bde0={'ListId':_0x5d5924};var _0x51d501=_0x3806cb['data4']&&_0x3806cb['data4']!=='0'?_0x3806cb[_0x898a('0x2d')]:_0x898a('0x2e');if(_0x2c76b7){logger[_0x898a('0xb')](_0x898a('0x2f'),_0x5d2de4[_0x898a('0x28')],_0x1a92de['id']);_0x20bde0[_0x51d501]=_[_0x898a('0x12')](_0x5d2de4[_0x898a('0x19')])?_0x5d2de4[_0x898a('0x1b')]:_0x5d2de4[_0x898a('0x1a')];if(_['isNil'](_0x5d2de4['routeId'])){_0x20bde0['firstName']=_0x5d2de4[_0x898a('0x30')]&&_0x5d2de4[_0x898a('0x30')]!==_0x898a('0x31')?_0x5d2de4[_0x898a('0x30')]:_0x898a('0x32');}else{_0x20bde0[_0x898a('0x1c')]=_0x5d2de4[_0x898a('0x33')]&&_0x5d2de4[_0x898a('0x33')]!==_0x898a('0x31')?_0x5d2de4[_0x898a('0x33')]:_0x898a('0x32');}return BPromise[_0x898a('0x22')]()['then'](cmContactRpc[_0x898a('0x34')](_0x20bde0))[_0x898a('0x23')](function(_0x26eead){_0x3e1867=_0x26eead;_0x502e95[_0x898a('0x35')](_0x26eead);if(_0x3e1867){logger[_0x898a('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x5d2de4['uniqueid'],_0x1a92de['id'],_0x3e1867['id']);}return;});}else{logger[_0x898a('0xb')](_0x898a('0x36'),_0x5d2de4[_0x898a('0x28')],_0x1a92de['id']);_0x20bde0[_0x51d501]=_['isNil'](_0x5d2de4[_0x898a('0x19')])?_0x5d2de4[_0x898a('0x1b')]:_0x5d2de4[_0x898a('0x1a')];if(_[_0x898a('0x12')](_0x5d2de4[_0x898a('0x19')])){_0x20bde0[_0x898a('0x1c')]=_0x5d2de4[_0x898a('0x30')]&&_0x5d2de4[_0x898a('0x30')]!==''?_0x5d2de4[_0x898a('0x30')]:'Unknown';}else{_0x20bde0['firstName']=_0x5d2de4[_0x898a('0x33')]&&_0x5d2de4['destcalleridname']!==_0x898a('0x31')?_0x5d2de4['destcalleridname']:_0x898a('0x32');}_0x3e1867=_0x20bde0;_0x502e95['push'](_0x20bde0);return;}}})[_0x898a('0x23')](function(){if(_0x42faa4){emit(_0x5d2de4[_0x898a('0x28')],_0x1a92de,util[_0x898a('0x37')]('user:%s',_0x42faa4['name']),util['format'](_0x898a('0x38'),_0x3806cb[_0x898a('0x39')]['toLowerCase']()),{'evt':_[_0x898a('0x3a')](_0x5d2de4,{'autoCreate':_0x2c76b7}),'contact':_0x3e1867===undefined?{}:_0x3e1867,'contacts':_0x502e95[_0x898a('0x26')]===0x0?undefined:_0x502e95});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 1927a24..dc74ff9 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 _0x59ac=['trigger','../ami','redis','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','stringify','emit','clone','motionChannel','undefined','voice','checkTriggers','hasOwnProperty','status','checkTrigger','Actions','interface','contactmanager','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','format','name','trigger:%s:%s','action','toLowerCase','merge','user:%s','trigger:%s','exec','integration','queue','routeId','urlforward','parse','search','replace','channel','AllConditions','length','every','AnyConditions','some','checkConditions','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','agent','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','exports','util','lodash','url','mustache','ioredis','./integration','./cmContact','../../../config/environment','../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59ac,0x73));var _0xc59a=function(_0x40c849,_0xbc22a1){_0x40c849=_0x40c849-0x0;var _0x7d3bef=_0x59ac[_0x40c849];return _0x7d3bef;};'use strict';var util=require(_0xc59a('0x0'));var _=require(_0xc59a('0x1'));var url=require(_0xc59a('0x2'));var Mustache=require(_0xc59a('0x3'));var Redis=require(_0xc59a('0x4'));var urlforward=require('./urlforward');var integration=require(_0xc59a('0x5'));var cmContact=require(_0xc59a('0x6'));var script=require('./script');var config=require(_0xc59a('0x7'));var logger=require(_0xc59a('0x8'))(_0xc59a('0x9'));var ami=require(_0xc59a('0xa'));config[_0xc59a('0xb')]=_['defaults'](config[_0xc59a('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xc59a('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x447241,_0x511698){return _0x447241==_0x511698;},'not_equals':function(_0x3ba5c0,_0x4aa035){return _0x3ba5c0!=_0x4aa035;}};var barAndWebActions=[_0xc59a('0xd'),'url',_0xc59a('0xe')];function Trigger(_0x5aeadc){this[_0xc59a('0xf')]=_0x5aeadc[_0xc59a('0xf')];this[_0xc59a('0x10')]=_0x5aeadc['agents'];this[_0xc59a('0x11')]=_0x5aeadc[_0xc59a('0x11')];this[_0xc59a('0x12')]=_0x5aeadc['templates'];this[_0xc59a('0x13')]=_0x5aeadc['voiceExtensions'];this[_0xc59a('0x14')]=_0x5aeadc[_0xc59a('0x14')];this[_0xc59a('0x15')]=_0x5aeadc[_0xc59a('0x15')];this[_0xc59a('0x16')]=_0x5aeadc[_0xc59a('0x16')];this[_0xc59a('0x17')]=_0x5aeadc[_0xc59a('0x17')];this[_0xc59a('0x18')]=_0x5aeadc[_0xc59a('0x18')];this[_0xc59a('0x19')]=_0x5aeadc[_0xc59a('0x19')];this[_0xc59a('0x1a')]=_0x5aeadc[_0xc59a('0x1a')];this[_0xc59a('0x1b')]=_0x5aeadc[_0xc59a('0x1b')];this[_0xc59a('0x1c')]=_0x5aeadc[_0xc59a('0x1c')];this[_0xc59a('0x1d')]=_0x5aeadc[_0xc59a('0x1d')];this[_0xc59a('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xc59a('0x16')],'freshdesk':this[_0xc59a('0x15')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xc59a('0x18')],'desk':this[_0xc59a('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xc59a('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xc59a('0x1b')]};ami['on']('custom:agentcalled',this[_0xc59a('0x1f')]['bind'](this));ami['on'](_0xc59a('0x20'),this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x22'),this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on']('custom:agentcomplete',this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x23'),this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x24'),this['syncCustomEvent'][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x25'),this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x26'),this[_0xc59a('0x1f')]['bind'](this));ami['on'](_0xc59a('0x27'),this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on']('custom:amd',this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x28'),this[_0xc59a('0x1f')]['bind'](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0xc59a('0x21')](this));ami['on']('custom:dialbegin',this[_0xc59a('0x29')][_0xc59a('0x21')](this));ami['on']('custom:dialconnect',this[_0xc59a('0x29')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x2a'),this[_0xc59a('0x29')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x2b'),this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x2c'),this['syncCustomEvent'][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x2d'),this['syncCustomEvent'][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x2e'),this[_0xc59a('0x1f')]['bind'](this));ami['on'](_0xc59a('0x2f'),this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x30'),this[_0xc59a('0x1f')]['bind'](this));ami['on']('custom:rejectmessage',this[_0xc59a('0x1f')][_0xc59a('0x21')](this));ami['on'](_0xc59a('0x31'),this[_0xc59a('0x1f')][_0xc59a('0x21')](this));}Trigger[_0xc59a('0x32')]['emit']=function(_0x54e63c,_0x4d7b1c,_0x521140){logger['info'](_0x54e63c,_0x4d7b1c,JSON[_0xc59a('0x33')](_0x521140));io['to'](_0x54e63c)[_0xc59a('0x34')](_0x4d7b1c,_0x521140);};Trigger[_0xc59a('0x32')][_0xc59a('0x1f')]=function(_0x48c412){var _0x494c69=_[_0xc59a('0x35')](_0x48c412);if(typeof _0x494c69[_0xc59a('0x36')]===_0xc59a('0x37')){_0x494c69[_0xc59a('0x36')]=_0xc59a('0x38');}this[_0xc59a('0x39')](_0x494c69);};Trigger['prototype'][_0xc59a('0x29')]=function(_0x19d0f1){if(this[_0xc59a('0x10')][_0x19d0f1['interface']]){this['syncCustomEvent'](_0x19d0f1);}};Trigger[_0xc59a('0x32')][_0xc59a('0x39')]=function(_0x4dc4c3){var _0x3bfabf;for(var _0x13c79b in this[_0xc59a('0xf')]){if(this[_0xc59a('0xf')][_0xc59a('0x3a')](_0x13c79b)){if(this[_0xc59a('0xf')][_0x13c79b][_0xc59a('0x3b')]){_0x3bfabf=this[_0xc59a('0x3c')](this[_0xc59a('0xf')][_0x13c79b],_0x4dc4c3);if(_0x3bfabf){_['merge'](_0x4dc4c3,_0x4dc4c3['variables']);for(var _0x279f46=0x0,_0x3c3259,_0x1a123e,_0x54affa;_0x279f460x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x4136ef,_0x8bf80c){var _0x26c22f=function(_0x4a54e4){while(--_0x4a54e4){_0x4136ef['push'](_0x4136ef['shift']());}};_0x26c22f(++_0x8bf80c);}(_0x814b,0x1a2));var _0xb814=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x814b[_0x4fb1b8];return _0x146c71;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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 42f8bd2..c9b07f7 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 _0x1d20=['password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','then','value','isNil','validateEmail','email','info',']\x20Agent\x20found\x20','systemuserid','userEmail','length','userId','toLowerCase','outbound','destcalleridnum','calleridnum','POST','/systemusers(','headers','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','contactid',']\x20Enduser\x20created!','includes','string','type','nameField','customField','idField','substring','indexOf','ticketType','incidents','getString','Subjects','/contacts(','Fields','phonecall','callDirection','queue','Descriptions','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','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','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username'];(function(_0x4b18ea,_0x2c070a){var _0x28ec1c=function(_0x251208){while(--_0x251208){_0x4b18ea['push'](_0x4b18ea['shift']());}};_0x28ec1c(++_0x2c070a);}(_0x1d20,0x176));var _0x01d2=function(_0x8bab96,_0x3e9c96){_0x8bab96=_0x8bab96-0x0;var _0x39e14d=_0x1d20[_0x8bab96];return _0x39e14d;};'use strict';var _=require(_0x01d2('0x0'));var rp=require(_0x01d2('0x1'));var util=require(_0x01d2('0x2'));var intUtil=require('./util');var md5=require(_0x01d2('0x3'));var Redis=require(_0x01d2('0x4'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x01d2('0x5'));config['redis']=_['defaults'](config[_0x01d2('0x6')],{'host':_0x01d2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x43d0af,_0x36d669,_0x282a4d){if(_0x43d0af[_0x01d2('0x8')]){_0x43d0af[_0x01d2('0x9')]=_0x43d0af[_0x01d2('0xa')][_0x01d2('0xb')];_0x43d0af[_0x01d2('0xc')]=_0x43d0af[_0x01d2('0xa')][_0x01d2('0xd')];return Promise[_0x01d2('0xe')](_0x43d0af['CloudProvider'][_0x01d2('0xf')]);}var _0x5dbe11={'method':'POST','uri':_0x36d669,'form':{'client_id':_0x43d0af[_0x01d2('0x10')],'resource':_0x43d0af[_0x01d2('0x9')],'username':_0x43d0af[_0x01d2('0x11')],'password':_0x43d0af[_0x01d2('0x12')],'grant_type':_0x01d2('0x12'),'client_secret':_0x43d0af[_0x01d2('0x13')]},'json':!![]};return rp(_0x5dbe11)['then'](function(_0x4f94db){return _0x4f94db['access_token'];})[_0x01d2('0x14')](function(_0x1be123){logger[_0x01d2('0x15')]('['+[_0x282a4d[_0x01d2('0x16')]()]+_0x01d2('0x17'));return _0x1be123[_0x01d2('0x18')];});}function getUser(_0x7c012e,_0x39ec19,_0x55bef6,_0x1eda97,_0x18f573,_0x102078){return new Promise(function(_0x4519ab,_0x359cb1){return getAuthToken(_0x39ec19,_0x1eda97,_0x102078)['then'](function(_0x212dab){var _0x462ec5={'method':_0x01d2('0x19'),'uri':_0x18f573+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x01d2('0x1a')+_0x212dab,'OData-Version':_0x01d2('0x1b')},'json':!![]};return rp(_0x462ec5);})[_0x01d2('0x1c')](function(_0x5a746a){var _0x2755db=_0x5a746a[_0x01d2('0x1d')];var _0x4f5c88=![];var _0x435007=null;if(!_[_0x01d2('0x1e')](_0x55bef6)){if(intUtil[_0x01d2('0x1f')](_0x55bef6[_0x01d2('0x20')])){_0x7c012e['userEmail']=_0x55bef6[_0x01d2('0x20')];for(_0x435007=0x0;_0x435007<_0x2755db['length'];_0x435007++){if(_0x2755db[_0x435007]['internalemailaddress']===_0x55bef6['email']&&!_0x2755db[_0x435007]['isdisabled']){_0x4f5c88=!![];logger[_0x01d2('0x21')]('['+[_0x102078['toUpperCase']()]+_0x01d2('0x22')+_0x2755db[_0x435007]['systemuserid']+'!');_0x7c012e['userId']=_0x2755db[_0x435007][_0x01d2('0x23')];}}}}if(!_0x4f5c88){logger[_0x01d2('0x21')]('['+[_0x102078[_0x01d2('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x7c012e[_0x01d2('0x24')]=_0x39ec19[_0x01d2('0x11')];for(_0x435007=0x0;_0x435007<_0x2755db[_0x01d2('0x25')];_0x435007++){if(_0x2755db[_0x435007]['internalemailaddress']===_0x39ec19['username']){_0x7c012e[_0x01d2('0x26')]=_0x2755db[_0x435007][_0x01d2('0x23')];}}}_0x4519ab(_0x7c012e);})[_0x01d2('0x14')](function(_0x142b24){_0x359cb1(_0x142b24[_0x01d2('0x18')]);});});}function createEndUser(_0x20b4c8,_0x176f04,_0x1bfce3,_0x785675,_0x1a5634,_0xceb4a8){return new Promise(function(_0x3c9aa3,_0x3c93e9){return getAuthToken(_0x176f04,_0x1bfce3,_0xceb4a8)[_0x01d2('0x1c')](function(_0x286679){var _0x2cc186=_0xceb4a8[_0x01d2('0x27')]()===_0x01d2('0x28')?_0x1a5634[_0x01d2('0x29')]:_0x1a5634[_0x01d2('0x2a')];var _0x321463={'method':_0x01d2('0x2b'),'uri':_0x785675+'contacts','body':{'telephone1':_0x2cc186,'fullname':_0x2cc186,'firstname':_0x2cc186,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x01d2('0x2c')+_0x20b4c8['userId']+')'},'headers':{'Authorization':_0x01d2('0x1a')+_0x286679,'OData-Version':_0x01d2('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x321463);})[_0x01d2('0x1c')](function(_0x62436d){var _0xcabb08=_0x62436d[_0x01d2('0x2d')]['odata-entityid'];var _0xcce8cf=_0xcabb08['substring'](_0xcabb08[_0x01d2('0x2e')]('(')+0x1,_0xcabb08[_0x01d2('0x2e')](')'));_0x20b4c8[_0x01d2('0x2f')]=_0xcce8cf;_0x3c9aa3(_0x20b4c8);})[_0x01d2('0x14')](function(_0xf10ae2){_0x3c93e9(_0xf10ae2[_0x01d2('0x18')]);});});}function getEndUser(_0x2bfbc1,_0x21ca73,_0x2c75d,_0x4d40c1,_0x3a968e,_0x4030d9,_0x5e6fce){var _0x3442a2=_0x4030d9[_0x01d2('0x27')]()===_0x01d2('0x28')?_0x3a968e[_0x01d2('0x29')]:_0x3a968e[_0x01d2('0x2a')];return getAuthToken(_0x21ca73,_0x2c75d,_0x4030d9)[_0x01d2('0x1c')](function(_0x4035d8){var _0x367974={'method':_0x01d2('0x19'),'uri':_0x4d40c1+_0x01d2('0x30')+_0x3442a2['replace']('+',_0x01d2('0x31'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4035d8,'If-None-Match':null,'OData-Version':_0x01d2('0x1b')},'json':!![]};return rp(_0x367974);})['then'](function(_0x59462e){var _0x4c6f47=![];if(!_0x59462e)return _0x4c6f47;var _0x91f811=_0x59462e[_0x01d2('0x1d')];for(var _0x5945c6=0x0;_0x5945c6<_0x91f811['length'];_0x5945c6++){if(_0x91f811[_0x5945c6]['telephone1']===_0x3442a2){_0x4c6f47=!![];_0x2bfbc1[_0x01d2('0x2f')]=_0x91f811[_0x5945c6][_0x01d2('0x32')];}}return _0x4c6f47;})[_0x01d2('0x1c')](function(_0x5614a4){if(_0x5614a4)return _0x2bfbc1;if(_0x5e6fce==='nothing'){logger['info']('['+[_0x4030d9['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x2bfbc1;}return createEndUser(_0x2bfbc1,_0x21ca73,_0x2c75d,_0x4d40c1,_0x3a968e,_0x4030d9)['then'](function(_0x4cc898){logger[_0x01d2('0x21')]('['+[_0x4030d9[_0x01d2('0x16')]()]+_0x01d2('0x33'),_0x4cc898[_0x01d2('0x2f')]);return _0x4cc898;});});}function getCustomFields(_0x25eff9,_0x1ccaa4,_0x2ebbcb){var _0x115e7d={};if(_0x25eff9['length']>0x0){_['forEach'](_0x25eff9,function(_0x1bbaa4){if(_[_0x01d2('0x34')]([_0x01d2('0x35'),'picklist'],_0x1bbaa4[_0x01d2('0x36')])&&_0x1bbaa4[_0x01d2('0x37')]&&!_0x1bbaa4[_0x01d2('0x38')]){var _0x5b599f=_0x1bbaa4[_0x01d2('0x39')][_0x01d2('0x27')]();var _0x5ddb01=_0x5b599f[_0x01d2('0x3a')](0x0,_0x5b599f[_0x01d2('0x3b')]('_'));var _0x161983=_0x5b599f[_0x01d2('0x3a')](_0x5b599f['indexOf']('_')+0x1);if(_0x5ddb01===_0x2ebbcb){_0x115e7d[_0x161983]=_0x1bbaa4['content'];}}});}return _0x115e7d;}function getTicket(_0x572816,_0xd8a007,_0x633dfe,_0x48be23,_0x594ba1,_0x585305,_0x7cdf88){return new Promise(function(_0x47a2b6,_0x299116){var _0x5d0a40;return getAuthToken(_0xd8a007,_0x633dfe,_0x7cdf88)[_0x01d2('0x1c')](function(_0x30898a){if(_0x585305[_0x01d2('0x3c')]==='incident'){_0x5d0a40={'method':'POST','uri':_0x48be23+_0x01d2('0x3d'),'body':Object['assign']({},{'title':intUtil[_0x01d2('0x3e')](_0x585305[_0x01d2('0x3f')],_0x594ba1,'\x20'),'description':intUtil[_0x01d2('0x3e')](_0x585305['Descriptions'],_0x594ba1,'\x0a'),'customerid_contact@odata.bind':_0x572816[_0x01d2('0x2f')]?_0x01d2('0x40')+_0x572816[_0x01d2('0x2f')]+')':undefined,'ownerid@odata.bind':_0x01d2('0x2c')+_0x572816[_0x01d2('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x585305[_0x01d2('0x41')],_0x594ba1,_0x585305['ticketType'])),'headers':{'Authorization':_0x01d2('0x1a')+_0x30898a,'OData-Version':_0x01d2('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x585305[_0x01d2('0x3c')]===_0x01d2('0x42')){var _0x4a8a66=_0x572816[_0x01d2('0x2f')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x572816[_0x01d2('0x26')]+')','participationtypemask':_0x572816[_0x01d2('0x43')]===_0x01d2('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x01d2('0x40')+_0x572816[_0x01d2('0x2f')]+')','participationtypemask':_0x572816[_0x01d2('0x43')]===_0x01d2('0x44')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x01d2('0x2c')+_0x572816[_0x01d2('0x26')]+')','participationtypemask':_0x572816[_0x01d2('0x43')]==='queue'?0x2:0x1}];_0x5d0a40={'method':_0x01d2('0x2b'),'uri':_0x48be23+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x01d2('0x3e')](_0x585305['Subjects'],_0x594ba1,'\x20'),'phonenumber':String(_0x594ba1[_0x01d2('0x2a')]),'description':intUtil[_0x01d2('0x3e')](_0x585305[_0x01d2('0x45')],_0x594ba1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x572816[_0x01d2('0x2f')]?'/contacts('+_0x572816[_0x01d2('0x2f')]+')':undefined,'ownerid@odata.bind':_0x01d2('0x2c')+_0x572816[_0x01d2('0x26')]+')','directioncode':_0x572816['callDirection']===_0x01d2('0x44')?![]:!![],'phonecall_activity_parties':_0x4a8a66},getCustomFields(_0x585305[_0x01d2('0x41')],_0x594ba1,_0x585305[_0x01d2('0x3c')])),'headers':{'Authorization':_0x01d2('0x1a')+_0x30898a,'OData-Version':_0x01d2('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5d0a40);})['then'](function(_0x16891b){var _0x376840=_0x16891b[_0x01d2('0x2d')][_0x01d2('0x46')];var _0x23aca8=_0x376840[_0x01d2('0x3a')](_0x376840['lastIndexOf']('(')+0x1,_0x376840['lastIndexOf'](')'));_0x572816[_0x01d2('0x47')]=_0x23aca8;_0x47a2b6(_0x572816);})[_0x01d2('0x14')](function(_0x58bbe2){_0x299116(_0x58bbe2['message']);});});}function emit(_0x37c668,_0x31e81a,_0x30ed90,_0xa36f8f){var _0x5a7e5a={'uri':util[_0x01d2('0x48')](_0x01d2('0x49'),_0x37c668,_0x30ed90,_0xa36f8f)};io['to'](util[_0x01d2('0x48')]('user:%s',_0x31e81a))[_0x01d2('0x4a')](_0x01d2('0x4b'),_0x5a7e5a);}exports['cs']=function(_0x413e32,_0x118b75,_0x1207d0,_0x5edaea,_0x5d103b,_0x541cb2,_0x1fdb35,_0x2a8ea7){var _0x29f06f={};_0x541cb2[_0x01d2('0x9')]=_0x541cb2['modernAuthentication']?intUtil[_0x01d2('0x4c')](_0x541cb2['CloudProvider'][_0x01d2('0xb')]):intUtil[_0x01d2('0x4c')](_0x541cb2[_0x01d2('0x9')]);_0x541cb2[_0x01d2('0x4d')]=intUtil[_0x01d2('0x4c')](_0x541cb2['serverUrl']);_0x29f06f[_0x01d2('0x43')]=_0x2a8ea7===_0x01d2('0x44')||_0x2a8ea7==='unmanaged'?_0x01d2('0x44'):_0x01d2('0x28');var _0x28a1f4=_0x541cb2['modernAuthentication']?util[_0x01d2('0x48')](_0x01d2('0x4e'),_0x541cb2['CloudProvider'][_0x01d2('0xb')]):util['format'](_0x01d2('0x4e'),_0x541cb2['remoteUri']);var _0xbd9491=util['format'](_0x01d2('0x4f'),_0x541cb2['tenantId']);var _0x1544ce=util[_0x01d2('0x48')](_0x01d2('0x50'),_0x541cb2['serverUrl'],_0x118b75[_0x01d2('0x51')],md5(_0x118b75['uniqueid']));if(_0x5d103b&&_0x5d103b[_0x01d2('0x52')]){logger[_0x01d2('0x21')](_0x01d2('0x53'),'Recording\x20is\x20enabled!');_0x118b75[_0x01d2('0x54')]=_0x1544ce;}else if(_0x1fdb35&&_0x1fdb35['recordingFormat']&&_0x1fdb35[_0x01d2('0x55')]!==_0x01d2('0x56')){logger[_0x01d2('0x21')](_0x01d2('0x57'),'Recording\x20is\x20enabled!');_0x118b75[_0x01d2('0x54')]=_0x1544ce;}else{_0x118b75[_0x01d2('0x54')]='';}return getUser(_0x29f06f,_0x541cb2,_0x5edaea,_0xbd9491,_0x28a1f4,_0x2a8ea7)[_0x01d2('0x1c')](function(_0x2dbdc4){logger[_0x01d2('0x21')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x58'),_0x2dbdc4['userId']);logger[_0x01d2('0x21')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x59'),_0x2dbdc4[_0x01d2('0x24')]);return getEndUser(_0x2dbdc4,_0x541cb2,_0xbd9491,_0x28a1f4,_0x118b75,_0x2a8ea7,_0x1207d0[_0x01d2('0x5a')]);})[_0x01d2('0x1c')](function(_0x436ef7){logger[_0x01d2('0x21')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x5b'),_0x436ef7[_0x01d2('0x2f')]);logger[_0x01d2('0x21')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x5c'),_0x118b75[_0x01d2('0x2a')]);return getTicket(_0x436ef7,_0x541cb2,_0xbd9491,_0x28a1f4,_0x118b75,_0x1207d0,_0x2a8ea7);})[_0x01d2('0x1c')](function(_0x2e4098){logger['info'](util[_0x01d2('0x48')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x5d'),_0x1207d0['ticketType'],_0x2e4098[_0x01d2('0x47')]));logger[_0x01d2('0x21')](util[_0x01d2('0x48')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x5e'),_0x2a8ea7));if(_0x2a8ea7!==_0x01d2('0x5f')){logger['info']('['+_0x2a8ea7['toUpperCase']()+']',_0x01d2('0x60'));emit(_0x541cb2[_0x01d2('0x9')],_0x5edaea['name'],_0x1207d0['ticketType'],_0x2e4098[_0x01d2('0x47')]);}})[_0x01d2('0x14')](function(_0x5c982e){logger[_0x01d2('0x15')]('['+_0x2a8ea7['toUpperCase']()+_0x01d2('0x61'),_0x5c982e[_0x01d2('0x18')]);});}; \ No newline at end of file +var _0x4dfa=['email','userEmail','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','internalemailaddress','message','toLowerCase','destcalleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','outbound','calleridnum','replace','%2b','4.0','value','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','isNil','validateEmail'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4dfa,0x194));var _0xa4df=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4dfa[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require(_0xa4df('0x0'));var intUtil=require(_0xa4df('0x1'));var md5=require(_0xa4df('0x2'));var Redis=require(_0xa4df('0x3'));var logger=require(_0xa4df('0x4'))(_0xa4df('0x5'));var config=require('../../../../config/environment');config['redis']=_['defaults'](config[_0xa4df('0x6')],{'host':_0xa4df('0x7'),'port':0x18eb});var io=require(_0xa4df('0x8'))(new Redis(config['redis']));function getAuthToken(_0x10eccb,_0xde396b,_0x4bdbb1){if(_0x10eccb['modernAuthentication']){_0x10eccb['remoteUri']=_0x10eccb[_0xa4df('0x9')][_0xa4df('0xa')];_0x10eccb[_0xa4df('0xb')]=_0x10eccb[_0xa4df('0x9')][_0xa4df('0xc')];return Promise[_0xa4df('0xd')](_0x10eccb[_0xa4df('0x9')][_0xa4df('0xe')]);}var _0x464f96={'method':_0xa4df('0xf'),'uri':_0xde396b,'form':{'client_id':_0x10eccb[_0xa4df('0x10')],'resource':_0x10eccb[_0xa4df('0x11')],'username':_0x10eccb[_0xa4df('0x12')],'password':_0x10eccb[_0xa4df('0x13')],'grant_type':_0xa4df('0x13'),'client_secret':_0x10eccb[_0xa4df('0x14')]},'json':!![]};return rp(_0x464f96)[_0xa4df('0x15')](function(_0x3132c2){return _0x3132c2[_0xa4df('0x16')];})[_0xa4df('0x17')](function(_0x224c79){logger[_0xa4df('0x18')]('['+[_0x4bdbb1[_0xa4df('0x19')]()]+_0xa4df('0x1a'));return _0x224c79['message'];});}function getUser(_0x21b685,_0x4f5707,_0x19679f,_0x362296,_0x10b662,_0x9b35e){return new Promise(function(_0x4682a0,_0x4aead6){return getAuthToken(_0x4f5707,_0x362296,_0x9b35e)['then'](function(_0x4b9bde){var _0x527cec={'method':_0xa4df('0x1b'),'uri':_0x10b662+_0xa4df('0x1c'),'headers':{'Authorization':_0xa4df('0x1d')+_0x4b9bde,'OData-Version':'4.0'},'json':!![]};return rp(_0x527cec);})[_0xa4df('0x15')](function(_0x139976){var _0x2a5b73=_0x139976['value'];var _0xc584ea=![];var _0x57ffa5=null;if(!_[_0xa4df('0x1e')](_0x19679f)){if(intUtil[_0xa4df('0x1f')](_0x19679f[_0xa4df('0x20')])){_0x21b685[_0xa4df('0x21')]=_0x19679f[_0xa4df('0x20')];for(_0x57ffa5=0x0;_0x57ffa5<_0x2a5b73['length'];_0x57ffa5++){if(_0x2a5b73[_0x57ffa5]['internalemailaddress']===_0x19679f[_0xa4df('0x20')]&&!_0x2a5b73[_0x57ffa5][_0xa4df('0x22')]){_0xc584ea=!![];logger['info']('['+[_0x9b35e[_0xa4df('0x19')]()]+_0xa4df('0x23')+_0x2a5b73[_0x57ffa5][_0xa4df('0x24')]+'!');_0x21b685[_0xa4df('0x25')]=_0x2a5b73[_0x57ffa5][_0xa4df('0x24')];}}}}if(!_0xc584ea){logger[_0xa4df('0x26')]('['+[_0x9b35e['toUpperCase']()]+_0xa4df('0x27'));_0x21b685['userEmail']=_0x4f5707['username'];for(_0x57ffa5=0x0;_0x57ffa5<_0x2a5b73[_0xa4df('0x28')];_0x57ffa5++){if(_0x2a5b73[_0x57ffa5][_0xa4df('0x29')]===_0x4f5707[_0xa4df('0x12')]){_0x21b685[_0xa4df('0x25')]=_0x2a5b73[_0x57ffa5][_0xa4df('0x24')];}}}_0x4682a0(_0x21b685);})[_0xa4df('0x17')](function(_0x5c450b){_0x4aead6(_0x5c450b[_0xa4df('0x2a')]);});});}function createEndUser(_0x3a704c,_0x2aa216,_0x2e10d4,_0x11eee6,_0x2872ec,_0x1be9cf){return new Promise(function(_0x476261,_0xb1141e){return getAuthToken(_0x2aa216,_0x2e10d4,_0x1be9cf)['then'](function(_0x17863b){var _0x46d50b=_0x1be9cf[_0xa4df('0x2b')]()==='outbound'?_0x2872ec[_0xa4df('0x2c')]:_0x2872ec['calleridnum'];var _0x59c254={'method':_0xa4df('0xf'),'uri':_0x11eee6+_0xa4df('0x2d'),'body':{'telephone1':_0x46d50b,'fullname':_0x46d50b,'firstname':_0x46d50b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xa4df('0x2e')+_0x3a704c[_0xa4df('0x25')]+')'},'headers':{'Authorization':_0xa4df('0x1d')+_0x17863b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x59c254);})[_0xa4df('0x15')](function(_0x57ea9f){var _0x2a7a45=_0x57ea9f['headers'][_0xa4df('0x2f')];var _0x39dce3=_0x2a7a45[_0xa4df('0x30')](_0x2a7a45[_0xa4df('0x31')]('(')+0x1,_0x2a7a45[_0xa4df('0x31')](')'));_0x3a704c[_0xa4df('0x32')]=_0x39dce3;_0x476261(_0x3a704c);})['catch'](function(_0x130d01){_0xb1141e(_0x130d01[_0xa4df('0x2a')]);});});}function getEndUser(_0x56b318,_0x30a9e5,_0x18cdde,_0xeaf1c4,_0xceeb13,_0x262173,_0x4aeb12){var _0x5746a7=_0x262173[_0xa4df('0x2b')]()===_0xa4df('0x33')?_0xceeb13['destcalleridnum']:_0xceeb13[_0xa4df('0x34')];return getAuthToken(_0x30a9e5,_0x18cdde,_0x262173)['then'](function(_0x4f0dc8){var _0xb6a4ab={'method':'GET','uri':_0xeaf1c4+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x5746a7[_0xa4df('0x35')]('+',_0xa4df('0x36'))+'\x27','headers':{'Authorization':_0xa4df('0x1d')+_0x4f0dc8,'If-None-Match':null,'OData-Version':_0xa4df('0x37')},'json':!![]};return rp(_0xb6a4ab);})[_0xa4df('0x15')](function(_0x10ef35){var _0x33f5b6=![];if(!_0x10ef35)return _0x33f5b6;var _0x5aaef4=_0x10ef35[_0xa4df('0x38')];for(var _0x5cd105=0x0;_0x5cd105<_0x5aaef4[_0xa4df('0x28')];_0x5cd105++){if(_0x5aaef4[_0x5cd105]['telephone1']===_0x5746a7){_0x33f5b6=!![];_0x56b318[_0xa4df('0x32')]=_0x5aaef4[_0x5cd105][_0xa4df('0x39')];}}return _0x33f5b6;})[_0xa4df('0x15')](function(_0x2560ee){if(_0x2560ee)return _0x56b318;if(_0x4aeb12===_0xa4df('0x3a')){logger[_0xa4df('0x26')]('['+[_0x262173['toUpperCase']()]+_0xa4df('0x3b'));return _0x56b318;}return createEndUser(_0x56b318,_0x30a9e5,_0x18cdde,_0xeaf1c4,_0xceeb13,_0x262173)[_0xa4df('0x15')](function(_0x24c11d){logger[_0xa4df('0x26')]('['+[_0x262173[_0xa4df('0x19')]()]+_0xa4df('0x3c'),_0x24c11d[_0xa4df('0x32')]);return _0x24c11d;});});}function getCustomFields(_0x2620ea,_0x2a206b,_0x4b6d85){var _0x32bd0e={};if(_0x2620ea['length']>0x0){_[_0xa4df('0x3d')](_0x2620ea,function(_0x38f886){if(_[_0xa4df('0x3e')]([_0xa4df('0x3f'),_0xa4df('0x40')],_0x38f886['type'])&&_0x38f886[_0xa4df('0x41')]&&!_0x38f886[_0xa4df('0x42')]){var _0x332e65=_0x38f886[_0xa4df('0x43')][_0xa4df('0x2b')]();var _0x33976f=_0x332e65[_0xa4df('0x30')](0x0,_0x332e65[_0xa4df('0x44')]('_'));var _0x291519=_0x332e65[_0xa4df('0x30')](_0x332e65[_0xa4df('0x44')]('_')+0x1);if(_0x33976f===_0x4b6d85){_0x32bd0e[_0x291519]=_0x38f886['content'];}}});}return _0x32bd0e;}function getTicket(_0x58fc0c,_0x12e9b5,_0x41515c,_0x33644c,_0x11e4a2,_0x3a5ace,_0x26f7f8){return new Promise(function(_0x2a02dd,_0x1031dc){var _0x3b104b;return getAuthToken(_0x12e9b5,_0x41515c,_0x26f7f8)['then'](function(_0x32da9e){if(_0x3a5ace['ticketType']===_0xa4df('0x45')){_0x3b104b={'method':_0xa4df('0xf'),'uri':_0x33644c+_0xa4df('0x46'),'body':Object[_0xa4df('0x47')]({},{'title':intUtil[_0xa4df('0x48')](_0x3a5ace[_0xa4df('0x49')],_0x11e4a2,'\x20'),'description':intUtil['getString'](_0x3a5ace[_0xa4df('0x4a')],_0x11e4a2,'\x0a'),'customerid_contact@odata.bind':_0x58fc0c[_0xa4df('0x32')]?_0xa4df('0x4b')+_0x58fc0c[_0xa4df('0x32')]+')':undefined,'ownerid@odata.bind':_0xa4df('0x2e')+_0x58fc0c[_0xa4df('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x3a5ace[_0xa4df('0x4c')],_0x11e4a2,_0x3a5ace[_0xa4df('0x4d')])),'headers':{'Authorization':_0xa4df('0x1d')+_0x32da9e,'OData-Version':_0xa4df('0x37')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3a5ace[_0xa4df('0x4d')]===_0xa4df('0x4e')){var _0x25a6ad=_0x58fc0c[_0xa4df('0x32')]?[{'partyid_systemuser@odata.bind':_0xa4df('0x2e')+_0x58fc0c[_0xa4df('0x25')]+')','participationtypemask':_0x58fc0c[_0xa4df('0x4f')]===_0xa4df('0x50')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x58fc0c[_0xa4df('0x32')]+')','participationtypemask':_0x58fc0c[_0xa4df('0x4f')]===_0xa4df('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xa4df('0x2e')+_0x58fc0c['userId']+')','participationtypemask':_0x58fc0c[_0xa4df('0x4f')]==='queue'?0x2:0x1}];_0x3b104b={'method':_0xa4df('0xf'),'uri':_0x33644c+_0xa4df('0x51'),'body':Object[_0xa4df('0x47')]({},{'subject':intUtil[_0xa4df('0x48')](_0x3a5ace['Subjects'],_0x11e4a2,'\x20'),'phonenumber':String(_0x11e4a2[_0xa4df('0x34')]),'description':intUtil['getString'](_0x3a5ace[_0xa4df('0x4a')],_0x11e4a2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x58fc0c[_0xa4df('0x32')]?'/contacts('+_0x58fc0c[_0xa4df('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x58fc0c[_0xa4df('0x25')]+')','directioncode':_0x58fc0c[_0xa4df('0x4f')]===_0xa4df('0x50')?![]:!![],'phonecall_activity_parties':_0x25a6ad},getCustomFields(_0x3a5ace[_0xa4df('0x4c')],_0x11e4a2,_0x3a5ace[_0xa4df('0x4d')])),'headers':{'Authorization':_0xa4df('0x1d')+_0x32da9e,'OData-Version':_0xa4df('0x37')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3b104b);})[_0xa4df('0x15')](function(_0x40187e){var _0x323655=_0x40187e[_0xa4df('0x52')][_0xa4df('0x2f')];var _0x3d7b35=_0x323655[_0xa4df('0x30')](_0x323655[_0xa4df('0x31')]('(')+0x1,_0x323655[_0xa4df('0x31')](')'));_0x58fc0c[_0xa4df('0x53')]=_0x3d7b35;_0x2a02dd(_0x58fc0c);})[_0xa4df('0x17')](function(_0x350aa5){_0x1031dc(_0x350aa5[_0xa4df('0x2a')]);});});}function emit(_0x36b858,_0x125c37,_0xfb8528,_0x177f6d){var _0x1c296e={'uri':util[_0xa4df('0x54')](_0xa4df('0x55'),_0x36b858,_0xfb8528,_0x177f6d)};io['to'](util[_0xa4df('0x54')]('user:%s',_0x125c37))[_0xa4df('0x56')](_0xa4df('0x57'),_0x1c296e);}exports['cs']=function(_0x48e828,_0x194f9e,_0x2e055e,_0x3aaab5,_0x11d21e,_0x1c498b,_0xe60642,_0x1be4bc){var _0x3433a5={};_0x1c498b[_0xa4df('0x11')]=_0x1c498b[_0xa4df('0x58')]?intUtil['stripTrailingSlash'](_0x1c498b[_0xa4df('0x9')][_0xa4df('0xa')]):intUtil[_0xa4df('0x59')](_0x1c498b[_0xa4df('0x11')]);_0x1c498b[_0xa4df('0x5a')]=intUtil['stripTrailingSlash'](_0x1c498b['serverUrl']);_0x3433a5[_0xa4df('0x4f')]=_0x1be4bc==='queue'||_0x1be4bc===_0xa4df('0x5b')?_0xa4df('0x50'):'outbound';var _0x28ab2b=_0x1c498b['modernAuthentication']?util[_0xa4df('0x54')]('%s/api/data/v9.0/',_0x1c498b[_0xa4df('0x9')][_0xa4df('0xa')]):util[_0xa4df('0x54')](_0xa4df('0x5c'),_0x1c498b['remoteUri']);var _0x346593=util[_0xa4df('0x54')](_0xa4df('0x5d'),_0x1c498b[_0xa4df('0xb')]);var _0x428326=util[_0xa4df('0x54')](_0xa4df('0x5e'),_0x1c498b[_0xa4df('0x5a')],_0x194f9e[_0xa4df('0x5f')],md5(_0x194f9e['uniqueid']));if(_0x11d21e&&_0x11d21e[_0xa4df('0x60')]){logger[_0xa4df('0x26')](_0xa4df('0x61'),_0xa4df('0x62'));_0x194f9e[_0xa4df('0x63')]=_0x428326;}else if(_0xe60642&&_0xe60642[_0xa4df('0x64')]&&_0xe60642['recordingFormat']!==_0xa4df('0x65')){logger['info'](_0xa4df('0x66'),_0xa4df('0x62'));_0x194f9e[_0xa4df('0x63')]=_0x428326;}else{_0x194f9e[_0xa4df('0x63')]='';}return getUser(_0x3433a5,_0x1c498b,_0x3aaab5,_0x346593,_0x28ab2b,_0x1be4bc)[_0xa4df('0x15')](function(_0x294185){logger[_0xa4df('0x26')]('['+_0x1be4bc[_0xa4df('0x19')]()+']\x20The\x20User\x20ID\x20is:',_0x294185[_0xa4df('0x25')]);logger[_0xa4df('0x26')]('['+_0x1be4bc[_0xa4df('0x19')]()+_0xa4df('0x67'),_0x294185['userEmail']);return getEndUser(_0x294185,_0x1c498b,_0x346593,_0x28ab2b,_0x194f9e,_0x1be4bc,_0x2e055e['moduleCreate']);})[_0xa4df('0x15')](function(_0x1f5445){logger['info']('['+_0x1be4bc[_0xa4df('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x1f5445[_0xa4df('0x32')]);logger[_0xa4df('0x26')]('['+_0x1be4bc[_0xa4df('0x19')]()+_0xa4df('0x68'),_0x194f9e['calleridnum']);return getTicket(_0x1f5445,_0x1c498b,_0x346593,_0x28ab2b,_0x194f9e,_0x2e055e,_0x1be4bc);})[_0xa4df('0x15')](function(_0x140f43){logger[_0xa4df('0x26')](util['format']('['+_0x1be4bc[_0xa4df('0x19')]()+_0xa4df('0x69'),_0x2e055e[_0xa4df('0x4d')],_0x140f43['ticketId']));logger[_0xa4df('0x26')](util[_0xa4df('0x54')]('['+_0x1be4bc[_0xa4df('0x19')]()+_0xa4df('0x6a'),_0x1be4bc));if(_0x1be4bc!==_0xa4df('0x5b')){logger[_0xa4df('0x26')]('['+_0x1be4bc[_0xa4df('0x19')]()+']',_0xa4df('0x6b'));emit(_0x1c498b[_0xa4df('0x11')],_0x3aaab5['name'],_0x2e055e[_0xa4df('0x4d')],_0x140f43[_0xa4df('0x53')]);}})['catch'](function(_0x3c736c){logger[_0xa4df('0x18')]('['+_0x1be4bc[_0xa4df('0x19')]()+_0xa4df('0x6c'),_0x3c736c[_0xa4df('0x2a')]);});}; \ 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 844f34c..ed6f17e 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 _0x8cf6=['Tags','name','Fields','custom_fields','keyBy','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','info','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','apiKey','debug','[HTTP]','stringify','GET','forEach','includes','string','type','nameField','toLowerCase','content','toString','picklist','push','variable','variableName','customField','idField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
'];(function(_0x8f3a26,_0xf35df0){var _0x37a687=function(_0x3a04dc){while(--_0x3a04dc){_0x8f3a26['push'](_0x8f3a26['shift']());}};_0x37a687(++_0xf35df0);}(_0x8cf6,0x1c4));var _0x68cf=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x8cf6[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x68cf('0x0'));var rp=require('request-promise');var md5=require(_0x68cf('0x1'));var util=require(_0x68cf('0x2'));var Redis=require(_0x68cf('0x3'));var intUtil=require(_0x68cf('0x4'));var config=require(_0x68cf('0x5'));var logger=require(_0x68cf('0x6'))(_0x68cf('0x7'));config[_0x68cf('0x8')]=_[_0x68cf('0x9')](config[_0x68cf('0x8')],{'host':_0x68cf('0xa'),'port':0x18eb});var io=require(_0x68cf('0xb'))(new Redis(config[_0x68cf('0x8')]));var headers={'Content-Type':_0x68cf('0xc'),'Accept':'application/json'};function emit(_0x48500d,_0x54132a,_0xf3c763){io['to'](_0x48500d)[_0x68cf('0xd')](_0x54132a,_0xf3c763);}function getTicket(_0x4c2b84,_0x545767,_0x2c7be3,_0x5655f2,_0x23514f){logger['info'](_0x68cf('0xe'));var _0x50f3e7=_[_0x68cf('0xf')]({'responder_id':_0x545767['id'],'requester_id':_0x2c7be3['id'],'name':util[_0x68cf('0x10')]('Caller\x20-\x20%s',_0x23514f[_0x68cf('0x11')]),'phone':_0x23514f[_0x68cf('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x68cf('0x13')](_0x5655f2[_0x68cf('0x14')],_0x23514f,'\x20'),'description':intUtil[_0x68cf('0x13')](_0x5655f2[_0x68cf('0x15')],_0x23514f,_0x68cf('0x16')),'tags':getTags(_0x5655f2[_0x68cf('0x17')],_0x68cf('0x18'))},getCustomFields(_0x5655f2[_0x68cf('0x19')],_0x23514f));_0x50f3e7[_0x68cf('0x1a')]=_['mapValues'](_[_0x68cf('0x1b')](_0x50f3e7[_0x68cf('0x1a')],'id'),_0x68cf('0x1c'));return request({'uri':util[_0x68cf('0x10')]('%s/api/v2/tickets',_0x4c2b84[_0x68cf('0x1d')]),'method':_0x68cf('0x1e'),'body':_0x50f3e7})[_0x68cf('0x1f')](function(_0x5958e9){logger['info'](_0x68cf('0x20'));return _0x5958e9;});}function getUser(_0x2ddb33,_0x53a54b){if(intUtil[_0x68cf('0x21')](_0x53a54b)){return request({'uri':util[_0x68cf('0x10')](_0x68cf('0x22'),_0x2ddb33['remoteUri']),'qs':{'email':_0x53a54b}})['then'](function(_0x265b85){if(_0x265b85[_0x68cf('0x23')]){logger[_0x68cf('0x24')]('Agent\x20found!');return _[_0x68cf('0x25')](_0x265b85,function(_0xf9b7ce){return _0xf9b7ce[_0x68cf('0x26')][_0x68cf('0x27')]===_0x53a54b;});}else{logger[_0x68cf('0x24')](_0x68cf('0x28'));return request({'uri':util['format'](_0x68cf('0x29'),_0x2ddb33['remoteUri'])})[_0x68cf('0x1f')](function(_0x385cd0){logger[_0x68cf('0x24')](_0x68cf('0x2a'));return _0x385cd0;});}});}else{logger[_0x68cf('0x24')](_0x68cf('0x2b'));return request({'uri':util[_0x68cf('0x10')](_0x68cf('0x29'),_0x2ddb33[_0x68cf('0x1d')])})[_0x68cf('0x1f')](function(_0x304985){logger['info']('Admin\x20account\x20selected.');return _0x304985;});}}function getEndUser(_0x2d7862,_0x24b2f5,_0x4fa6e0){logger[_0x68cf('0x24')](_0x68cf('0x2c'),_0x4fa6e0);return request({'uri':util['format']('%s/api/v2/contacts',_0x2d7862[_0x68cf('0x1d')]),'qs':{'phone':_0x4fa6e0}})['then'](function(_0x348e5d){if(_0x348e5d[_0x68cf('0x23')]){logger['info'](_0x68cf('0x2d'));return _[_0x68cf('0x25')](_0x348e5d,{'phone':_0x4fa6e0});}else{logger[_0x68cf('0x24')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x68cf('0x2e'),_0x2d7862['remoteUri']),'method':_0x68cf('0x1e'),'body':{'name':_0x24b2f5,'phone':_0x4fa6e0}})['then'](function(_0x111efa){logger[_0x68cf('0x24')]('Enduser\x20created.');return _0x111efa;});}});}function getAuth(_0x2c462d){return util[_0x68cf('0x10')]('Basic\x20%s',new Buffer(_0x2c462d[_0x68cf('0x2f')]+':X')['toString']('base64'));}function request(_0x44e25c){logger[_0x68cf('0x30')](_0x68cf('0x31'),JSON[_0x68cf('0x32')](_0x44e25c));return rp(_[_0x68cf('0x9')](_0x44e25c,{'method':_0x68cf('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x44d715,_0x1d2aaf){var _0x120285=[];if(_0x44d715&&_0x44d715['length']>0x0){_0x120285=_['map'](_0x44d715,_0x1d2aaf);}return _0x120285;}function getCustomFields(_0x1f8ce9,_0x16b4a2){var _0x368315=[];var _0x58309f={'custom_fields':[]};if(_0x1f8ce9[_0x68cf('0x23')]>0x0){_[_0x68cf('0x34')](_0x1f8ce9,function(_0x5def7f){if(_[_0x68cf('0x35')]([_0x68cf('0x36'),'picklist'],_0x5def7f[_0x68cf('0x37')])&&_0x5def7f['nameField']&&!_0x5def7f['customField']){_0x58309f[_0x5def7f[_0x68cf('0x38')][_0x68cf('0x39')]()]=_0x5def7f[_0x68cf('0x3a')][_0x68cf('0x3b')]();}else if(_[_0x68cf('0x35')]([_0x68cf('0x36'),_0x68cf('0x3c')],_0x5def7f[_0x68cf('0x37')])&&_0x5def7f['idField']&&_0x5def7f['customField']){_0x58309f[_0x68cf('0x1a')][_0x68cf('0x3d')]({'id':_0x5def7f['idField'],'value':_0x5def7f['content'][_0x68cf('0x3b')]()});}else if(_0x5def7f[_0x68cf('0x37')]===_0x68cf('0x3e')&&_0x5def7f[_0x68cf('0x3f')]&&_0x5def7f['idField']&&_0x5def7f[_0x68cf('0x40')]){_0x16b4a2[_0x5def7f[_0x68cf('0x3f')]]&&_0x58309f['custom_fields'][_0x68cf('0x3d')]({'id':_0x5def7f[_0x68cf('0x41')],'value':_0x16b4a2[_0x5def7f[_0x68cf('0x3f')]][_0x68cf('0x3b')]()});}else if(_0x5def7f[_0x68cf('0x37')]===_0x68cf('0x42')&&_0x5def7f[_0x68cf('0x43')]&&_0x5def7f[_0x68cf('0x43')][_0x68cf('0x18')]&&_0x5def7f[_0x68cf('0x41')]&&_0x5def7f['customField']){_0x16b4a2[_0x5def7f[_0x68cf('0x43')][_0x68cf('0x18')][_0x68cf('0x39')]()]&&_0x58309f[_0x68cf('0x1a')]['push']({'id':_0x5def7f[_0x68cf('0x41')],'value':_0x16b4a2[_0x5def7f[_0x68cf('0x43')][_0x68cf('0x18')]['toLowerCase']()]['toString']()});}});}return _0x58309f;}exports[_0x68cf('0x44')]=function(_0x4aaacf,_0x645df7,_0x3449c0,_0x1bf09d,_0x5aab54,_0x16f7ba){var _0x104cf2,_0x22dfd8;_0x16f7ba['remoteUri']=intUtil[_0x68cf('0x45')](_0x16f7ba[_0x68cf('0x1d')]);_0x16f7ba[_0x68cf('0x46')]=intUtil[_0x68cf('0x45')](_0x16f7ba['serverUrl']);if(_0x5aab54&&_0x5aab54[_0x68cf('0x47')]){logger[_0x68cf('0x24')](_0x68cf('0x48'),'Recording\x20is\x20enabled!');_0x645df7[_0x68cf('0x49')]=util[_0x68cf('0x10')](_0x68cf('0x4a'),_0x16f7ba[_0x68cf('0x46')],_0x645df7[_0x68cf('0x4b')],md5(_0x645df7[_0x68cf('0x4b')]));}else{_0x645df7['recordingURL']='';}headers[_0x68cf('0x4c')]=getAuth(_0x16f7ba);return getUser(_0x16f7ba,_0x1bf09d[_0x68cf('0x27')])[_0x68cf('0x1f')](function(_0x51f4a6){_0x104cf2=_0x51f4a6;logger[_0x68cf('0x24')]('The\x20User\x20ID\x20is:',_0x104cf2['id']);return getEndUser(_0x16f7ba,_0x645df7[_0x68cf('0x11')],_0x645df7[_0x68cf('0x12')]);})[_0x68cf('0x1f')](function(_0x158f4e){_0x22dfd8=_0x158f4e;logger[_0x68cf('0x24')](_0x68cf('0x4d'),_0x22dfd8['id']);return getTicket(_0x16f7ba,_0x104cf2,_0x22dfd8,_0x3449c0,_0x645df7);})[_0x68cf('0x1f')](function(_0x14fe71){if(_0x14fe71&&_0x14fe71['id']){logger[_0x68cf('0x24')](_0x68cf('0x20'));logger['info'](_0x68cf('0x4e'),_0x14fe71['id']);logger[_0x68cf('0x24')](_0x68cf('0x48'),_0x68cf('0x4f'));emit(util[_0x68cf('0x10')]('user:%s',_0x1bf09d[_0x68cf('0x18')]),'trigger:browser:url',{'uri':util[_0x68cf('0x10')](_0x68cf('0x50'),_0x16f7ba[_0x68cf('0x1d')],_0x14fe71['id'])});}})[_0x68cf('0x51')](function(_0x2b3d1d){logger[_0x68cf('0x52')](_0x68cf('0x48'),JSON[_0x68cf('0x32')](_0x2b3d1d));});};exports[_0x68cf('0x53')]=function(_0x235287,_0x17e67e,_0x15279e,_0x420958,_0xb710a9,_0x4bf3f2,_0x5ed96f){var _0x12d08e,_0x247420;_0x4bf3f2[_0x68cf('0x1d')]=intUtil['stripTrailingSlash'](_0x4bf3f2['remoteUri']);_0x4bf3f2[_0x68cf('0x46')]=intUtil[_0x68cf('0x45')](_0x4bf3f2[_0x68cf('0x46')]);if(_0x5ed96f&&_0x5ed96f[_0x68cf('0x54')]&&_0x5ed96f[_0x68cf('0x54')]!==_0x68cf('0x55')){logger[_0x68cf('0x24')]('[OUTBOUND]',_0x68cf('0x56'));_0x17e67e[_0x68cf('0x49')]=util['format'](_0x68cf('0x4a'),_0x4bf3f2['serverUrl'],_0x17e67e[_0x68cf('0x4b')],md5(_0x17e67e[_0x68cf('0x4b')]));}headers[_0x68cf('0x4c')]=getAuth(_0x4bf3f2);return getUser(_0x4bf3f2,_0x420958[_0x68cf('0x27')])[_0x68cf('0x1f')](function(_0x5367e4){_0x12d08e=_0x5367e4;logger[_0x68cf('0x24')](_0x68cf('0x57'),_0x12d08e['id']);return getEndUser(_0x4bf3f2,_0x17e67e['destcalleridname'],_0x17e67e[_0x68cf('0x58')]);})[_0x68cf('0x1f')](function(_0x297ddb){_0x247420=_0x297ddb;logger[_0x68cf('0x24')](_0x68cf('0x4d'),_0x247420['id']);return getTicket(_0x4bf3f2,_0x12d08e,_0x247420,_0x15279e,_0x17e67e);})[_0x68cf('0x1f')](function(_0x63db44){if(_0x63db44&&_0x63db44['id']){logger['info'](_0x68cf('0x20'));logger[_0x68cf('0x24')]('The\x20Ticket\x20ID\x20is:',_0x63db44['id']);logger[_0x68cf('0x24')](_0x68cf('0x59'),_0x68cf('0x4f'));emit(util['format'](_0x68cf('0x5a'),_0x420958['name']),_0x68cf('0x5b'),{'uri':util[_0x68cf('0x10')](_0x68cf('0x50'),_0x4bf3f2[_0x68cf('0x1d')],_0x63db44['id'])});}})[_0x68cf('0x51')](function(_0x20fdff){logger['error'](_0x68cf('0x59'),JSON[_0x68cf('0x32')](_0x20fdff));});};exports[_0x68cf('0x5c')]=function(_0x4c14ca,_0x25bd60,_0x502746,_0x4feea2,_0x1053f7,_0x3fda8e){var _0x4eef5b,_0x452004;_0x3fda8e[_0x68cf('0x1d')]=intUtil['stripTrailingSlash'](_0x3fda8e[_0x68cf('0x1d')]);_0x3fda8e[_0x68cf('0x46')]=intUtil[_0x68cf('0x45')](_0x3fda8e[_0x68cf('0x46')]);if(_0x1053f7&&_0x1053f7[_0x68cf('0x47')]){logger[_0x68cf('0x24')]('['+_0x25bd60[_0x68cf('0x5d')][_0x68cf('0x5e')]()+']',_0x68cf('0x56'));_0x25bd60[_0x68cf('0x49')]=util[_0x68cf('0x10')](_0x68cf('0x4a'),_0x3fda8e[_0x68cf('0x46')],_0x25bd60[_0x68cf('0x4b')],md5(_0x25bd60[_0x68cf('0x4b')]));}else{_0x25bd60[_0x68cf('0x49')]='';}headers['Authorization']=getAuth(_0x3fda8e);return getUser(_0x3fda8e,'')[_0x68cf('0x1f')](function(_0x2a4b41){_0x4eef5b=_0x2a4b41;logger[_0x68cf('0x24')]('The\x20User\x20ID\x20is:',_0x4eef5b['id']);return getEndUser(_0x3fda8e,_0x25bd60['calleridname'],_0x25bd60[_0x68cf('0x12')]);})[_0x68cf('0x1f')](function(_0x595f01){_0x452004=_0x595f01;logger[_0x68cf('0x24')](_0x68cf('0x4d'),_0x452004['id']);return getTicket(_0x3fda8e,_0x4eef5b,_0x452004,_0x502746,_0x25bd60);})[_0x68cf('0x1f')](function(_0x576477){if(_0x576477){logger[_0x68cf('0x24')](_0x68cf('0x20'));logger[_0x68cf('0x24')](_0x68cf('0x4e'),_0x576477['id']);}})['catch'](function(_0x282350){logger[_0x68cf('0x52')]('['+_0x25bd60['lastevent'][_0x68cf('0x5e')]()+']',JSON['stringify'](_0x282350));});}; \ No newline at end of file +var _0xd4a3=['serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','lastevent','toUpperCase','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','mapValues','keyBy','custom_fields','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','Agent\x20found!','email','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Basic\x20%s','apiKey','toString','debug','defaults','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','Variable','queue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4a3,0x172));var _0x3d4a=function(_0x57be38,_0x11d5ee){_0x57be38=_0x57be38-0x0;var _0x37ac0a=_0xd4a3[_0x57be38];return _0x37ac0a;};'use strict';var _=require(_0x3d4a('0x0'));var rp=require('request-promise');var md5=require(_0x3d4a('0x1'));var util=require(_0x3d4a('0x2'));var Redis=require(_0x3d4a('0x3'));var intUtil=require('./util');var config=require(_0x3d4a('0x4'));var logger=require(_0x3d4a('0x5'))(_0x3d4a('0x6'));config[_0x3d4a('0x7')]=_['defaults'](config[_0x3d4a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3d4a('0x8'))(new Redis(config[_0x3d4a('0x7')]));var headers={'Content-Type':_0x3d4a('0x9'),'Accept':_0x3d4a('0x9')};function emit(_0x5b36f7,_0x312e38,_0x21ded3){io['to'](_0x5b36f7)[_0x3d4a('0xa')](_0x312e38,_0x21ded3);}function getTicket(_0x3b4c6a,_0x5f0610,_0x118092,_0x56de3b,_0x1c584e){logger[_0x3d4a('0xb')](_0x3d4a('0xc'));var _0x3bb655=_['merge']({'responder_id':_0x5f0610['id'],'requester_id':_0x118092['id'],'name':util[_0x3d4a('0xd')](_0x3d4a('0xe'),_0x1c584e[_0x3d4a('0xf')]),'phone':_0x1c584e[_0x3d4a('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3d4a('0x11')](_0x56de3b[_0x3d4a('0x12')],_0x1c584e,'\x20'),'description':intUtil[_0x3d4a('0x11')](_0x56de3b[_0x3d4a('0x13')],_0x1c584e,_0x3d4a('0x14')),'tags':getTags(_0x56de3b['Tags'],_0x3d4a('0x15'))},getCustomFields(_0x56de3b['Fields'],_0x1c584e));_0x3bb655['custom_fields']=_[_0x3d4a('0x16')](_[_0x3d4a('0x17')](_0x3bb655[_0x3d4a('0x18')],'id'),'value');return request({'uri':util[_0x3d4a('0xd')](_0x3d4a('0x19'),_0x3b4c6a[_0x3d4a('0x1a')]),'method':'POST','body':_0x3bb655})['then'](function(_0x4f1f8d){logger[_0x3d4a('0xb')](_0x3d4a('0x1b'));return _0x4f1f8d;});}function getUser(_0x55d40e,_0x216ea8){if(intUtil[_0x3d4a('0x1c')](_0x216ea8)){return request({'uri':util['format'](_0x3d4a('0x1d'),_0x55d40e[_0x3d4a('0x1a')]),'qs':{'email':_0x216ea8}})[_0x3d4a('0x1e')](function(_0x3381bd){if(_0x3381bd['length']){logger[_0x3d4a('0xb')](_0x3d4a('0x1f'));return _['find'](_0x3381bd,function(_0x234957){return _0x234957['contact'][_0x3d4a('0x20')]===_0x216ea8;});}else{logger[_0x3d4a('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3d4a('0xd')]('%s/api/v2/agents/me',_0x55d40e[_0x3d4a('0x1a')])})['then'](function(_0x6024f1){logger['info']('Admin\x20account\x20selected.');return _0x6024f1;});}});}else{logger['info'](_0x3d4a('0x21'));return request({'uri':util[_0x3d4a('0xd')](_0x3d4a('0x22'),_0x55d40e['remoteUri'])})[_0x3d4a('0x1e')](function(_0x514c95){logger[_0x3d4a('0xb')]('Admin\x20account\x20selected.');return _0x514c95;});}}function getEndUser(_0x2ee441,_0x5decae,_0x82d314){logger[_0x3d4a('0xb')](_0x3d4a('0x23'),_0x82d314);return request({'uri':util['format']('%s/api/v2/contacts',_0x2ee441[_0x3d4a('0x1a')]),'qs':{'phone':_0x82d314}})['then'](function(_0x4f59e7){if(_0x4f59e7[_0x3d4a('0x24')]){logger[_0x3d4a('0xb')]('Enduser\x20found!');return _['find'](_0x4f59e7,{'phone':_0x82d314});}else{logger[_0x3d4a('0xb')](_0x3d4a('0x25'));return request({'uri':util[_0x3d4a('0xd')](_0x3d4a('0x26'),_0x2ee441[_0x3d4a('0x1a')]),'method':_0x3d4a('0x27'),'body':{'name':_0x5decae,'phone':_0x82d314}})[_0x3d4a('0x1e')](function(_0xc08f29){logger['info']('Enduser\x20created.');return _0xc08f29;});}});}function getAuth(_0x45e80b){return util['format'](_0x3d4a('0x28'),new Buffer(_0x45e80b[_0x3d4a('0x29')]+':X')[_0x3d4a('0x2a')]('base64'));}function request(_0x2fa6f7){logger[_0x3d4a('0x2b')]('[HTTP]',JSON['stringify'](_0x2fa6f7));return rp(_[_0x3d4a('0x2c')](_0x2fa6f7,{'method':_0x3d4a('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x3d7a8d,_0x432650){var _0x13e3b6=[];if(_0x3d7a8d&&_0x3d7a8d[_0x3d4a('0x24')]>0x0){_0x13e3b6=_[_0x3d4a('0x2e')](_0x3d7a8d,_0x432650);}return _0x13e3b6;}function getCustomFields(_0x3ed61a,_0x2b7f94){var _0x274d78=[];var _0x54ab6c={'custom_fields':[]};if(_0x3ed61a[_0x3d4a('0x24')]>0x0){_[_0x3d4a('0x2f')](_0x3ed61a,function(_0x1329cf){if(_['includes']([_0x3d4a('0x30'),_0x3d4a('0x31')],_0x1329cf[_0x3d4a('0x32')])&&_0x1329cf[_0x3d4a('0x33')]&&!_0x1329cf[_0x3d4a('0x34')]){_0x54ab6c[_0x1329cf[_0x3d4a('0x33')][_0x3d4a('0x35')]()]=_0x1329cf[_0x3d4a('0x36')][_0x3d4a('0x2a')]();}else if(_['includes']([_0x3d4a('0x30'),_0x3d4a('0x31')],_0x1329cf[_0x3d4a('0x32')])&&_0x1329cf[_0x3d4a('0x37')]&&_0x1329cf['customField']){_0x54ab6c[_0x3d4a('0x18')][_0x3d4a('0x38')]({'id':_0x1329cf[_0x3d4a('0x37')],'value':_0x1329cf[_0x3d4a('0x36')][_0x3d4a('0x2a')]()});}else if(_0x1329cf[_0x3d4a('0x32')]==='variable'&&_0x1329cf[_0x3d4a('0x39')]&&_0x1329cf[_0x3d4a('0x37')]&&_0x1329cf[_0x3d4a('0x34')]){_0x2b7f94[_0x1329cf['variableName']]&&_0x54ab6c[_0x3d4a('0x18')][_0x3d4a('0x38')]({'id':_0x1329cf[_0x3d4a('0x37')],'value':_0x2b7f94[_0x1329cf['variableName']][_0x3d4a('0x2a')]()});}else if(_0x1329cf[_0x3d4a('0x32')]==='customVariable'&&_0x1329cf[_0x3d4a('0x3a')]&&_0x1329cf[_0x3d4a('0x3a')][_0x3d4a('0x15')]&&_0x1329cf[_0x3d4a('0x37')]&&_0x1329cf['customField']){_0x2b7f94[_0x1329cf['Variable'][_0x3d4a('0x15')]['toLowerCase']()]&&_0x54ab6c[_0x3d4a('0x18')][_0x3d4a('0x38')]({'id':_0x1329cf[_0x3d4a('0x37')],'value':_0x2b7f94[_0x1329cf['Variable']['name'][_0x3d4a('0x35')]()][_0x3d4a('0x2a')]()});}});}return _0x54ab6c;}exports[_0x3d4a('0x3b')]=function(_0x2132a1,_0x106e04,_0x1d2539,_0x2e43c7,_0x117cbd,_0x411b5d){var _0x1cf598,_0x389fd9;_0x411b5d[_0x3d4a('0x1a')]=intUtil['stripTrailingSlash'](_0x411b5d[_0x3d4a('0x1a')]);_0x411b5d[_0x3d4a('0x3c')]=intUtil[_0x3d4a('0x3d')](_0x411b5d[_0x3d4a('0x3c')]);if(_0x117cbd&&_0x117cbd[_0x3d4a('0x3e')]){logger['info']('[QUEUE]',_0x3d4a('0x3f'));_0x106e04[_0x3d4a('0x40')]=util['format'](_0x3d4a('0x41'),_0x411b5d[_0x3d4a('0x3c')],_0x106e04['uniqueid'],md5(_0x106e04[_0x3d4a('0x42')]));}else{_0x106e04[_0x3d4a('0x40')]='';}headers['Authorization']=getAuth(_0x411b5d);return getUser(_0x411b5d,_0x2e43c7['email'])[_0x3d4a('0x1e')](function(_0x45924d){_0x1cf598=_0x45924d;logger[_0x3d4a('0xb')](_0x3d4a('0x43'),_0x1cf598['id']);return getEndUser(_0x411b5d,_0x106e04[_0x3d4a('0xf')],_0x106e04['calleridnum']);})['then'](function(_0x18cf67){_0x389fd9=_0x18cf67;logger['info']('The\x20Enduser\x20ID\x20is:',_0x389fd9['id']);return getTicket(_0x411b5d,_0x1cf598,_0x389fd9,_0x1d2539,_0x106e04);})[_0x3d4a('0x1e')](function(_0x2f78e3){if(_0x2f78e3&&_0x2f78e3['id']){logger['info'](_0x3d4a('0x1b'));logger[_0x3d4a('0xb')](_0x3d4a('0x44'),_0x2f78e3['id']);logger[_0x3d4a('0xb')](_0x3d4a('0x45'),_0x3d4a('0x46'));emit(util[_0x3d4a('0xd')](_0x3d4a('0x47'),_0x2e43c7['name']),_0x3d4a('0x48'),{'uri':util[_0x3d4a('0xd')]('%s/helpdesk/tickets/%d',_0x411b5d[_0x3d4a('0x1a')],_0x2f78e3['id'])});}})[_0x3d4a('0x49')](function(_0x2f7c94){logger[_0x3d4a('0x4a')]('[QUEUE]',JSON[_0x3d4a('0x4b')](_0x2f7c94));});};exports[_0x3d4a('0x4c')]=function(_0xcca277,_0x55c85a,_0x25061d,_0x10bec1,_0x137c94,_0x5dbf71,_0x3d85b7){var _0x1db425,_0x197820;_0x5dbf71[_0x3d4a('0x1a')]=intUtil['stripTrailingSlash'](_0x5dbf71[_0x3d4a('0x1a')]);_0x5dbf71[_0x3d4a('0x3c')]=intUtil[_0x3d4a('0x3d')](_0x5dbf71[_0x3d4a('0x3c')]);if(_0x3d85b7&&_0x3d85b7[_0x3d4a('0x4d')]&&_0x3d85b7[_0x3d4a('0x4d')]!=='none'){logger[_0x3d4a('0xb')](_0x3d4a('0x4e'),'Recording\x20is\x20enabled!');_0x55c85a[_0x3d4a('0x40')]=util['format'](_0x3d4a('0x41'),_0x5dbf71[_0x3d4a('0x3c')],_0x55c85a['uniqueid'],md5(_0x55c85a[_0x3d4a('0x42')]));}headers[_0x3d4a('0x4f')]=getAuth(_0x5dbf71);return getUser(_0x5dbf71,_0x10bec1[_0x3d4a('0x20')])[_0x3d4a('0x1e')](function(_0xf186ff){_0x1db425=_0xf186ff;logger[_0x3d4a('0xb')]('The\x20User\x20ID\x20is:',_0x1db425['id']);return getEndUser(_0x5dbf71,_0x55c85a[_0x3d4a('0x50')],_0x55c85a[_0x3d4a('0x51')]);})[_0x3d4a('0x1e')](function(_0x567ca2){_0x197820=_0x567ca2;logger[_0x3d4a('0xb')](_0x3d4a('0x52'),_0x197820['id']);return getTicket(_0x5dbf71,_0x1db425,_0x197820,_0x25061d,_0x55c85a);})[_0x3d4a('0x1e')](function(_0x2872e2){if(_0x2872e2&&_0x2872e2['id']){logger[_0x3d4a('0xb')](_0x3d4a('0x1b'));logger[_0x3d4a('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2872e2['id']);logger[_0x3d4a('0xb')](_0x3d4a('0x4e'),_0x3d4a('0x46'));emit(util['format']('user:%s',_0x10bec1[_0x3d4a('0x15')]),'trigger:browser:url',{'uri':util['format'](_0x3d4a('0x53'),_0x5dbf71[_0x3d4a('0x1a')],_0x2872e2['id'])});}})[_0x3d4a('0x49')](function(_0x914b4b){logger[_0x3d4a('0x4a')]('[OUTBOUND]',JSON[_0x3d4a('0x4b')](_0x914b4b));});};exports['unmanaged']=function(_0x562730,_0x1cd78a,_0x1e7a20,_0x46c171,_0x5ecf82,_0x5303fd){var _0x153b1c,_0x157dc3;_0x5303fd['remoteUri']=intUtil['stripTrailingSlash'](_0x5303fd[_0x3d4a('0x1a')]);_0x5303fd['serverUrl']=intUtil[_0x3d4a('0x3d')](_0x5303fd[_0x3d4a('0x3c')]);if(_0x5ecf82&&_0x5ecf82['monitor_format']){logger[_0x3d4a('0xb')]('['+_0x1cd78a[_0x3d4a('0x54')][_0x3d4a('0x55')]()+']','Recording\x20is\x20enabled!');_0x1cd78a[_0x3d4a('0x40')]=util[_0x3d4a('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5303fd[_0x3d4a('0x3c')],_0x1cd78a[_0x3d4a('0x42')],md5(_0x1cd78a[_0x3d4a('0x42')]));}else{_0x1cd78a[_0x3d4a('0x40')]='';}headers[_0x3d4a('0x4f')]=getAuth(_0x5303fd);return getUser(_0x5303fd,'')[_0x3d4a('0x1e')](function(_0x5c26e3){_0x153b1c=_0x5c26e3;logger[_0x3d4a('0xb')]('The\x20User\x20ID\x20is:',_0x153b1c['id']);return getEndUser(_0x5303fd,_0x1cd78a[_0x3d4a('0xf')],_0x1cd78a[_0x3d4a('0x10')]);})[_0x3d4a('0x1e')](function(_0x28157c){_0x157dc3=_0x28157c;logger[_0x3d4a('0xb')](_0x3d4a('0x52'),_0x157dc3['id']);return getTicket(_0x5303fd,_0x153b1c,_0x157dc3,_0x1e7a20,_0x1cd78a);})['then'](function(_0x32b1a7){if(_0x32b1a7){logger[_0x3d4a('0xb')](_0x3d4a('0x1b'));logger[_0x3d4a('0xb')](_0x3d4a('0x44'),_0x32b1a7['id']);}})['catch'](function(_0x43f32f){logger['error']('['+_0x1cd78a[_0x3d4a('0x54')][_0x3d4a('0x55')]()+']',JSON['stringify'](_0x43f32f));});}; \ 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 cae4135..c2acdc0 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 _0xff70=['request-promise','md5','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','socket.io-emitter','redis','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','message','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','toUpperCase','/api/lookup?q=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','contact','POST','getString','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','error','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash'];(function(_0x38b6f0,_0x26fee4){var _0x19d435=function(_0x9d20b2){while(--_0x9d20b2){_0x38b6f0['push'](_0x38b6f0['shift']());}};_0x19d435(++_0x26fee4);}(_0xff70,0x1df));var _0x0ff7=function(_0x4cdcdc,_0x34eac7){_0x4cdcdc=_0x4cdcdc-0x0;var _0x4704ce=_0xff70[_0x4cdcdc];return _0x4704ce;};'use strict';var _=require(_0x0ff7('0x0'));var rp=require(_0x0ff7('0x1'));var md5=require(_0x0ff7('0x2'));var util=require('util');var moment=require(_0x0ff7('0x3'));var Promise=require('bluebird');var Redis=require(_0x0ff7('0x4'));var intUtil=require(_0x0ff7('0x5'));var config=require(_0x0ff7('0x6'));var logger=require(_0x0ff7('0x7'))(_0x0ff7('0x8'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0ff7('0x9'))(new Redis(config[_0x0ff7('0xa')]));function getAdminId(_0x5a4f9f,_0x24d7bf,_0x1d20e0,_0x3f4a03){return new Promise(function(_0x21fc14,_0x9ad26e){var _0x5cd236=![];var _0x57ec42={'method':_0x0ff7('0xb'),'uri':_0x3f4a03+_0x0ff7('0xc'),'json':!![]};_0x57ec42['headers']=_0x1d20e0;logger[_0x0ff7('0xd')](_0x0ff7('0xe'));return rp(_0x57ec42)['then'](function(_0x40709e){if(_0x40709e){var _0x295260=_0x40709e[_0x0ff7('0xf')];var _0x23889b=null;for(_0x23889b=0x0;_0x23889b<_0x295260[_0x0ff7('0x10')];_0x23889b++){if(_0x295260[_0x23889b][_0x0ff7('0x11')]===_0x5a4f9f['adminEmail']){_0x5a4f9f[_0x0ff7('0x12')]=_0x295260[_0x23889b]['id'];_0x5cd236=!![];}}if(_0x5cd236){logger[_0x0ff7('0xd')]('Admin\x20found:',_0x5a4f9f[_0x0ff7('0x12')]);_0x21fc14(_0x5a4f9f);}else{_0x9ad26e({'statusCode':0x194,'message':_0x0ff7('0x13')});}}else{_0x9ad26e({'statusCode':0x194,'message':_0x0ff7('0x13')});}})[_0x0ff7('0x14')](function(_0x6444a0){logger['error']('['+[_0x24d7bf['toUpperCase']()]+']',_0x6444a0[_0x0ff7('0x15')]);_0x9ad26e(_0x6444a0);});});}function getUser(_0x7ed2a1,_0x24463f,_0x335a4d){return function(_0xc5f79a){return new Promise(function(_0x26b463,_0xecb9e4){var _0x556f2d={'method':_0x0ff7('0xb'),'uri':_0x335a4d+'/api/selector/owners','json':!![]};_0x556f2d[_0x0ff7('0x16')]=_0x24463f;logger['info'](_0x0ff7('0x17'));return rp(_0x556f2d)[_0x0ff7('0x18')](function(_0x157116){if(_0x157116){var _0x5a1b4c=_0x157116[_0x0ff7('0xf')];var _0x3fdde4=![];var _0x559c3d=null;if(_0xc5f79a[_0x0ff7('0x19')]!==null){logger['info'](_0x0ff7('0x1a'),_0xc5f79a[_0x0ff7('0x19')]);_0xc5f79a[_0x0ff7('0x1b')]=_0xc5f79a['agentEmail'];for(_0x559c3d=0x0;_0x559c3d<_0x5a1b4c[_0x0ff7('0x10')];_0x559c3d++){if(_0x5a1b4c[_0x559c3d][_0x0ff7('0x11')]===_0xc5f79a[_0x0ff7('0x19')]){_0x3fdde4=!![];_0xc5f79a[_0x0ff7('0x1c')]=_0x5a1b4c[_0x559c3d]['id'];logger['info'](_0x0ff7('0x1d'),_0xc5f79a[_0x0ff7('0x1c')]);}}}if(!_0x3fdde4){logger[_0x0ff7('0xd')](_0x0ff7('0x1e'));_0xc5f79a[_0x0ff7('0x1b')]=_0xc5f79a[_0x0ff7('0x1f')];_0xc5f79a[_0x0ff7('0x1c')]=_0xc5f79a[_0x0ff7('0x12')];_0x3fdde4=!![];}if(_0x3fdde4){_0x26b463(_0xc5f79a);}else{_0xecb9e4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xecb9e4({'statusCode':0x194,'message':_0x0ff7('0x13')});}})[_0x0ff7('0x14')](function(_0x2ea043){logger['error']('['+[_0x7ed2a1[_0x0ff7('0x20')]()]+']',_0x2ea043[_0x0ff7('0x15')]);_0xecb9e4(_0x2ea043);});});};}function searchContact(_0x1619f0,_0x5d25be,_0xb6f483,_0xe71e11){return new Promise(function(_0x5f319c,_0x54af7e){var _0x46329a={'method':'GET','headers':_0x5d25be,'uri':_0x1619f0+_0x0ff7('0x21')+_0xe71e11+'&f='+_0xb6f483+'&entities=contact','json':!![]};rp(_0x46329a)[_0x0ff7('0x18')](function(_0x435b24){var _0x51e9d6=_[_0x0ff7('0x22')](_0x435b24[_0x0ff7('0x23')][_0x0ff7('0x23')],[_0xb6f483,_0xe71e11]);_0x5f319c(_0x51e9d6);})[_0x0ff7('0x14')](function(_0x651bd6){_0x54af7e(_0x651bd6);});});}function getEndUser(_0x128fb9,_0x2c064b,_0x1477cc){return function(_0x56aa20){return new Promise(function(_0x4fb843,_0x54f4ac){logger[_0x0ff7('0xd')](util['format'](_0x0ff7('0x24'),_0x56aa20[_0x0ff7('0x25')]));searchContact(_0x1477cc,_0x2c064b,'mobile_number',_0x56aa20['contactNumber'])['then'](function(_0x5d199d){if(_0x5d199d){_0x56aa20[_0x0ff7('0x26')]=_0x5d199d['id'];logger[_0x0ff7('0xd')](_0x0ff7('0x27'),_0x56aa20[_0x0ff7('0x26')]);return _0x4fb843(_0x56aa20);}searchContact(_0x1477cc,_0x2c064b,'work_number',_0x56aa20[_0x0ff7('0x25')])[_0x0ff7('0x18')](function(_0x200034){if(_0x200034){_0x56aa20[_0x0ff7('0x26')]=_0x200034['id'];logger[_0x0ff7('0xd')](_0x0ff7('0x28'),_0x56aa20['endUserId']);return _0x4fb843(_0x56aa20);}createEndUser(_0x56aa20,_0x128fb9,_0x2c064b,_0x1477cc)[_0x0ff7('0x18')](function(_0x34b722){logger[_0x0ff7('0xd')](_0x0ff7('0x29'),_0x34b722['endUserId']);return _0x4fb843(_0x34b722);});});})['catch'](function(_0x3d4e79){_0x54f4ac(_0x3d4e79);});});};}function createEndUser(_0xadfce1,_0x413608,_0x5e5d38,_0x3b61cb){return new Promise(function(_0x5d2eec,_0x1ce838){var _0x10380b=moment();var _0x583a77={'method':'POST','uri':_0x3b61cb+_0x0ff7('0x2a'),'body':{'contact':{'last_name':_0xadfce1[_0x0ff7('0x25')],'work_number':_0xadfce1[_0x0ff7('0x25')],'mobile_number':_0xadfce1['contactNumber'],'owner_id':_0xadfce1['userId'],'created_at':_0x10380b[_0x0ff7('0x2b')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x583a77[_0x0ff7('0x16')]=_0x5e5d38;logger[_0x0ff7('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x583a77)[_0x0ff7('0x18')](function(_0x561d5f){_0xadfce1['endUserId']=_0x561d5f[_0x0ff7('0x2c')]['id'];_0x5d2eec(_0xadfce1);})[_0x0ff7('0x14')](function(_0x39ab43){logger['error']('['+[_0x413608[_0x0ff7('0x20')]()]+']',_0x39ab43[_0x0ff7('0x15')]);_0x1ce838(_0x39ab43[_0x0ff7('0x15')]);});});}function getTicket(_0x524460,_0x2a8bac,_0x4d742f,_0x58e054,_0x3a00cf){return function(_0xd8781e){logger[_0x0ff7('0xd')]('Creating\x20new\x20task');return new Promise(function(_0xcdab1a,_0x321086){var _0x11c871=moment();var _0x1fab6e={'method':_0x0ff7('0x2d'),'uri':_0x4d742f+'/api/tasks','body':{'title':intUtil[_0x0ff7('0x2e')](_0x58e054['Subjects'],_0x3a00cf,'\x20'),'description':intUtil[_0x0ff7('0x2e')](_0x58e054[_0x0ff7('0x2f')],_0x3a00cf,'\x0a'),'owner_id':_0xd8781e[_0x0ff7('0x1c')],'creater_id':_0xd8781e['adminId'],'targetable_id':_0xd8781e[_0x0ff7('0x26')],'targetable_type':'Contact','created_at':_0x11c871[_0x0ff7('0x2b')](_0x0ff7('0x30')),'due_date':_0x11c871[_0x0ff7('0x31')](0x1e,'m')[_0x0ff7('0x2b')](_0x0ff7('0x30'))},'json':!![]};_0x1fab6e[_0x0ff7('0x16')]=_0x2a8bac;return rp(_0x1fab6e)['then'](function(_0x27702c){_0xd8781e[_0x0ff7('0x32')]=_0x27702c[_0x0ff7('0x33')]['id'];logger['info'](_0x0ff7('0x34'),_0xd8781e[_0x0ff7('0x32')]);_0xcdab1a(_0xd8781e);})[_0x0ff7('0x14')](function(_0x4ef258){logger[_0x0ff7('0x35')]('['+[_0x524460[_0x0ff7('0x20')]()]+']',_0x4ef258[_0x0ff7('0x15')]);_0x321086(_0x4ef258[_0x0ff7('0x15')]);});});};}function emit(_0x235b40,_0x3e7478,_0x4e63ac){var _0x3737b7={'uri':_0x235b40+_0x0ff7('0x36')+_0x4e63ac};io['to'](util[_0x0ff7('0x2b')](_0x0ff7('0x37'),_0x3e7478))[_0x0ff7('0x38')]('trigger:browser:url',_0x3737b7);}exports['cs']=function(_0x3b28dc,_0x5a047d,_0x319646,_0x421c29,_0x7f12ce,_0x159f30,_0xc5f46f,_0x23c09e){var _0x354c11={};var _0x52e993={'Authorization':_0x0ff7('0x39')+_0x159f30[_0x0ff7('0x3a')]};_0x159f30[_0x0ff7('0x3b')]=intUtil[_0x0ff7('0x3c')](_0x159f30[_0x0ff7('0x3b')]);_0x159f30['serverUrl']=intUtil[_0x0ff7('0x3c')](_0x159f30[_0x0ff7('0x3d')]);var _0x182a91=_0x159f30['remoteUri'];_0x354c11[_0x0ff7('0x1f')]=_0x159f30[_0x0ff7('0x3e')];_0x354c11[_0x0ff7('0x25')]=_0x23c09e['toLowerCase']()===_0x0ff7('0x3f')?_0x5a047d[_0x0ff7('0x40')]:_0x5a047d[_0x0ff7('0x41')];_0x354c11[_0x0ff7('0x42')]=_0x23c09e===_0x0ff7('0x43')||_0x23c09e===_0x0ff7('0x44')?_0x0ff7('0x43'):'outbound';if(_0x421c29){_0x354c11[_0x0ff7('0x19')]=_0x421c29[_0x0ff7('0x11')];}var _0x215bb1=util[_0x0ff7('0x2b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x159f30[_0x0ff7('0x3d')],_0x5a047d[_0x0ff7('0x45')],md5(_0x5a047d[_0x0ff7('0x45')]));if(_0x7f12ce&&_0x7f12ce[_0x0ff7('0x46')]){logger['info'](_0x0ff7('0x47'),_0x0ff7('0x48'));_0x5a047d[_0x0ff7('0x49')]=_0x215bb1;}else if(_0xc5f46f&&_0xc5f46f[_0x0ff7('0x4a')]&&_0xc5f46f[_0x0ff7('0x4a')]!==_0x0ff7('0x4b')){logger[_0x0ff7('0xd')](_0x0ff7('0x4c'),_0x0ff7('0x48'));_0x5a047d['recordingURL']=_0x215bb1;}else{_0x5a047d[_0x0ff7('0x49')]='';}return getAdminId(_0x354c11,_0x23c09e,_0x52e993,_0x182a91)['then'](getUser(_0x23c09e,_0x52e993,_0x182a91))[_0x0ff7('0x18')](getEndUser(_0x23c09e,_0x52e993,_0x182a91))[_0x0ff7('0x18')](getTicket(_0x23c09e,_0x52e993,_0x182a91,_0x319646,_0x5a047d))['then'](function(_0x809d69){logger[_0x0ff7('0xd')](util[_0x0ff7('0x2b')](_0x0ff7('0x4d'),_0x809d69[_0x0ff7('0x32')]));if(_0x23c09e!==_0x0ff7('0x44')){logger['info']('['+[_0x23c09e[_0x0ff7('0x20')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x182a91,_0x421c29[_0x0ff7('0x4e')],_0x809d69[_0x0ff7('0x26')]);}})[_0x0ff7('0x14')](function(_0x19685a){logger[_0x0ff7('0x35')]('['+[_0x23c09e[_0x0ff7('0x20')]()]+_0x0ff7('0x4f'),util['inspect'](_0x19685a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x09b4=['find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','then','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','toUpperCase','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','task','ticketId','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','Admin\x20selected','message','/api/lookup?q=','&f=','&entities=contact'];(function(_0x30ca54,_0x42999e){var _0x36605e=function(_0x1f206d){while(--_0x1f206d){_0x30ca54['push'](_0x30ca54['shift']());}};_0x36605e(++_0x42999e);}(_0x09b4,0x1d6));var _0x409b=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x09b4[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0x409b('0x0'));var rp=require('request-promise');var md5=require(_0x409b('0x1'));var util=require(_0x409b('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x409b('0x3'));var intUtil=require(_0x409b('0x4'));var config=require('../../../../config/environment');var logger=require(_0x409b('0x5'))(_0x409b('0x6'));config[_0x409b('0x7')]=_[_0x409b('0x8')](config[_0x409b('0x7')],{'host':_0x409b('0x9'),'port':0x18eb});var io=require(_0x409b('0xa'))(new Redis(config[_0x409b('0x7')]));function getAdminId(_0x3e229d,_0x5980d4,_0x2caf51,_0x2a2567){return new Promise(function(_0x450799,_0x5ce6bc){var _0x212e5e=![];var _0x4fcb9f={'method':_0x409b('0xb'),'uri':_0x2a2567+_0x409b('0xc'),'json':!![]};_0x4fcb9f[_0x409b('0xd')]=_0x2caf51;logger[_0x409b('0xe')](_0x409b('0xf'));return rp(_0x4fcb9f)['then'](function(_0x1189e4){if(_0x1189e4){var _0x2a94e7=_0x1189e4[_0x409b('0x10')];var _0xa0b54a=null;for(_0xa0b54a=0x0;_0xa0b54a<_0x2a94e7[_0x409b('0x11')];_0xa0b54a++){if(_0x2a94e7[_0xa0b54a][_0x409b('0x12')]===_0x3e229d[_0x409b('0x13')]){_0x3e229d[_0x409b('0x14')]=_0x2a94e7[_0xa0b54a]['id'];_0x212e5e=!![];}}if(_0x212e5e){logger[_0x409b('0xe')]('Admin\x20found:',_0x3e229d[_0x409b('0x14')]);_0x450799(_0x3e229d);}else{_0x5ce6bc({'statusCode':0x194,'message':_0x409b('0x15')});}}else{_0x5ce6bc({'statusCode':0x194,'message':_0x409b('0x15')});}})[_0x409b('0x16')](function(_0xbfed6a){logger[_0x409b('0x17')]('['+[_0x5980d4['toUpperCase']()]+']',_0xbfed6a['message']);_0x5ce6bc(_0xbfed6a);});});}function getUser(_0x295f11,_0x5a7c56,_0x5d6d2c){return function(_0x44339e){return new Promise(function(_0x24cfa2,_0xc87f58){var _0x573152={'method':_0x409b('0xb'),'uri':_0x5d6d2c+_0x409b('0xc'),'json':!![]};_0x573152['headers']=_0x5a7c56;logger[_0x409b('0xe')](_0x409b('0x18'));return rp(_0x573152)['then'](function(_0x32546c){if(_0x32546c){var _0x233abc=_0x32546c[_0x409b('0x10')];var _0x49687f=![];var _0xf18119=null;if(_0x44339e[_0x409b('0x19')]!==null){logger[_0x409b('0xe')](_0x409b('0x1a'),_0x44339e['agentEmail']);_0x44339e['userEmail']=_0x44339e[_0x409b('0x19')];for(_0xf18119=0x0;_0xf18119<_0x233abc[_0x409b('0x11')];_0xf18119++){if(_0x233abc[_0xf18119][_0x409b('0x12')]===_0x44339e[_0x409b('0x19')]){_0x49687f=!![];_0x44339e['userId']=_0x233abc[_0xf18119]['id'];logger[_0x409b('0xe')](_0x409b('0x1b'),_0x44339e[_0x409b('0x1c')]);}}}if(!_0x49687f){logger['info'](_0x409b('0x1d'));_0x44339e['userEmail']=_0x44339e[_0x409b('0x13')];_0x44339e[_0x409b('0x1c')]=_0x44339e['adminId'];_0x49687f=!![];}if(_0x49687f){_0x24cfa2(_0x44339e);}else{_0xc87f58({'statusCode':0x194,'message':_0x409b('0x15')});}}else{_0xc87f58({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x409b('0x16')](function(_0x28a7df){logger['error']('['+[_0x295f11['toUpperCase']()]+']',_0x28a7df[_0x409b('0x1e')]);_0xc87f58(_0x28a7df);});});};}function searchContact(_0x3c4bde,_0x5d0b59,_0x2eef3d,_0x36a181){return new Promise(function(_0x18fe0e,_0x23dc80){var _0x7fd584={'method':'GET','headers':_0x5d0b59,'uri':_0x3c4bde+_0x409b('0x1f')+_0x36a181+_0x409b('0x20')+_0x2eef3d+_0x409b('0x21'),'json':!![]};rp(_0x7fd584)['then'](function(_0x40da27){var _0x4f4aa2=_[_0x409b('0x22')](_0x40da27[_0x409b('0x23')][_0x409b('0x23')],[_0x2eef3d,_0x36a181]);_0x18fe0e(_0x4f4aa2);})[_0x409b('0x16')](function(_0x37941f){_0x23dc80(_0x37941f);});});}function getEndUser(_0x35b5ae,_0x525614,_0x4e8e14){return function(_0x183f67){return new Promise(function(_0x53b9de,_0x40b0b1){logger[_0x409b('0xe')](util[_0x409b('0x24')](_0x409b('0x25'),_0x183f67[_0x409b('0x26')]));searchContact(_0x4e8e14,_0x525614,_0x409b('0x27'),_0x183f67['contactNumber'])[_0x409b('0x28')](function(_0x3387f3){if(_0x3387f3){_0x183f67['endUserId']=_0x3387f3['id'];logger[_0x409b('0xe')](_0x409b('0x29'),_0x183f67[_0x409b('0x2a')]);return _0x53b9de(_0x183f67);}searchContact(_0x4e8e14,_0x525614,_0x409b('0x2b'),_0x183f67['contactNumber'])['then'](function(_0x30c677){if(_0x30c677){_0x183f67[_0x409b('0x2a')]=_0x30c677['id'];logger[_0x409b('0xe')]('Contact\x20found\x20work_number:',_0x183f67[_0x409b('0x2a')]);return _0x53b9de(_0x183f67);}createEndUser(_0x183f67,_0x35b5ae,_0x525614,_0x4e8e14)[_0x409b('0x28')](function(_0x2f6207){logger[_0x409b('0xe')](_0x409b('0x2c'),_0x2f6207[_0x409b('0x2a')]);return _0x53b9de(_0x2f6207);});});})[_0x409b('0x16')](function(_0x5575ce){_0x40b0b1(_0x5575ce);});});};}function createEndUser(_0x2ef11e,_0x167416,_0x297508,_0x16cdda){return new Promise(function(_0x164f9a,_0x69a3b1){var _0x150a62=moment();var _0x461ff3={'method':_0x409b('0x2d'),'uri':_0x16cdda+_0x409b('0x2e'),'body':{'contact':{'last_name':_0x2ef11e[_0x409b('0x26')],'work_number':_0x2ef11e['contactNumber'],'mobile_number':_0x2ef11e[_0x409b('0x26')],'owner_id':_0x2ef11e[_0x409b('0x1c')],'created_at':_0x150a62[_0x409b('0x24')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x461ff3[_0x409b('0xd')]=_0x297508;logger[_0x409b('0xe')](_0x409b('0x2f'));return rp(_0x461ff3)[_0x409b('0x28')](function(_0x13dcc1){_0x2ef11e[_0x409b('0x2a')]=_0x13dcc1['contact']['id'];_0x164f9a(_0x2ef11e);})[_0x409b('0x16')](function(_0x1386e0){logger[_0x409b('0x17')]('['+[_0x167416[_0x409b('0x30')]()]+']',_0x1386e0['message']);_0x69a3b1(_0x1386e0[_0x409b('0x1e')]);});});}function getTicket(_0x42c6c5,_0x23a20c,_0x365b45,_0x3d5a54,_0xa91875){return function(_0xa52457){logger['info'](_0x409b('0x31'));return new Promise(function(_0x5cd52c,_0xb4efaf){var _0x4ecbc7=moment();var _0x34ea87={'method':'POST','uri':_0x365b45+'/api/tasks','body':{'title':intUtil[_0x409b('0x32')](_0x3d5a54[_0x409b('0x33')],_0xa91875,'\x20'),'description':intUtil[_0x409b('0x32')](_0x3d5a54[_0x409b('0x34')],_0xa91875,'\x0a'),'owner_id':_0xa52457[_0x409b('0x1c')],'creater_id':_0xa52457[_0x409b('0x14')],'targetable_id':_0xa52457[_0x409b('0x2a')],'targetable_type':_0x409b('0x35'),'created_at':_0x4ecbc7['format'](_0x409b('0x36')),'due_date':_0x4ecbc7[_0x409b('0x37')](0x1e,'m')[_0x409b('0x24')](_0x409b('0x36'))},'json':!![]};_0x34ea87[_0x409b('0xd')]=_0x23a20c;return rp(_0x34ea87)[_0x409b('0x28')](function(_0xe8ab7b){_0xa52457['ticketId']=_0xe8ab7b[_0x409b('0x38')]['id'];logger[_0x409b('0xe')]('Task\x20created:',_0xa52457[_0x409b('0x39')]);_0x5cd52c(_0xa52457);})['catch'](function(_0x51e24f){logger[_0x409b('0x17')]('['+[_0x42c6c5[_0x409b('0x30')]()]+']',_0x51e24f['message']);_0xb4efaf(_0x51e24f[_0x409b('0x1e')]);});});};}function emit(_0x17aa22,_0x2b2cdc,_0x51631d){var _0x6d17de={'uri':_0x17aa22+'/contacts/'+_0x51631d};io['to'](util['format'](_0x409b('0x3a'),_0x2b2cdc))['emit'](_0x409b('0x3b'),_0x6d17de);}exports['cs']=function(_0x2c75a1,_0x301b41,_0x16dbd4,_0x53128c,_0x576636,_0x13b109,_0xcbf31e,_0x5684ce){var _0x17c0fc={};var _0x1dfb62={'Authorization':_0x409b('0x3c')+_0x13b109[_0x409b('0x3d')]};_0x13b109['remoteUri']=intUtil[_0x409b('0x3e')](_0x13b109[_0x409b('0x3f')]);_0x13b109[_0x409b('0x40')]=intUtil[_0x409b('0x3e')](_0x13b109[_0x409b('0x40')]);var _0x26bd36=_0x13b109[_0x409b('0x3f')];_0x17c0fc[_0x409b('0x13')]=_0x13b109['username'];_0x17c0fc['contactNumber']=_0x5684ce[_0x409b('0x41')]()===_0x409b('0x42')?_0x301b41[_0x409b('0x43')]:_0x301b41[_0x409b('0x44')];_0x17c0fc[_0x409b('0x45')]=_0x5684ce===_0x409b('0x46')||_0x5684ce===_0x409b('0x47')?'queue':_0x409b('0x42');if(_0x53128c){_0x17c0fc[_0x409b('0x19')]=_0x53128c[_0x409b('0x12')];}var _0x5e7cca=util[_0x409b('0x24')](_0x409b('0x48'),_0x13b109[_0x409b('0x40')],_0x301b41[_0x409b('0x49')],md5(_0x301b41[_0x409b('0x49')]));if(_0x576636&&_0x576636[_0x409b('0x4a')]){logger[_0x409b('0xe')](_0x409b('0x4b'),'Recording\x20is\x20enabled!');_0x301b41[_0x409b('0x4c')]=_0x5e7cca;}else if(_0xcbf31e&&_0xcbf31e[_0x409b('0x4d')]&&_0xcbf31e[_0x409b('0x4d')]!=='none'){logger[_0x409b('0xe')](_0x409b('0x4e'),_0x409b('0x4f'));_0x301b41[_0x409b('0x4c')]=_0x5e7cca;}else{_0x301b41['recordingURL']='';}return getAdminId(_0x17c0fc,_0x5684ce,_0x1dfb62,_0x26bd36)['then'](getUser(_0x5684ce,_0x1dfb62,_0x26bd36))[_0x409b('0x28')](getEndUser(_0x5684ce,_0x1dfb62,_0x26bd36))['then'](getTicket(_0x5684ce,_0x1dfb62,_0x26bd36,_0x16dbd4,_0x301b41))[_0x409b('0x28')](function(_0x4921a2){logger[_0x409b('0xe')](util[_0x409b('0x24')](_0x409b('0x50'),_0x4921a2['ticketId']));if(_0x5684ce!==_0x409b('0x47')){logger['info']('['+[_0x5684ce['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x26bd36,_0x53128c[_0x409b('0x51')],_0x4921a2[_0x409b('0x2a')]);}})[_0x409b('0x16')](function(_0x2d6b2b){logger['error']('['+[_0x5684ce[_0x409b('0x30')]()]+_0x409b('0x52'),util[_0x409b('0x53')](_0x2d6b2b,{'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 49df99c..f95be5f 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 _0xfecf=['./freshsales','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','find','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','log','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','data2','util','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0x3c357e,_0x4c3edf){var _0x5cec9c=function(_0x428f21){while(--_0x428f21){_0x3c357e['push'](_0x3c357e['shift']());}};_0x5cec9c(++_0x4c3edf);}(_0xfecf,0x1f2));var _0xffec=function(_0x59a71e,_0x5710cb){_0x59a71e=_0x59a71e-0x0;var _0x25e6d4=_0xfecf[_0x59a71e];return _0x25e6d4;};'use strict';var _=require('lodash');var util=require(_0xffec('0x0'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xffec('0x1'));var zoho=require(_0xffec('0x2'));var desk=require(_0xffec('0x3'));var vtiger=require(_0xffec('0x4'));var servicenow=require(_0xffec('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0xffec('0x6'));var integrations=['zendesk',_0xffec('0x7'),_0xffec('0x8'),_0xffec('0x9'),_0xffec('0xa'),'desk',_0xffec('0xb'),_0xffec('0xc'),_0xffec('0xd'),_0xffec('0xe')];exports[_0xffec('0xf')]=function(_0x34788b,_0x21fbcd,_0x4d4652,_0x4e9cec,_0x509dbc,_0x3be1f3){if(_0x4d4652){if(_['includes'](integrations,_0x34788b[_0xffec('0x10')][_0xffec('0x11')]())){try{var _0x37ee7a=null;var _0x401848='';var _0x3b6f20=_0x4d4652[_0x34788b[_0xffec('0x10')][_0xffec('0x11')]()];if(_0x3b6f20){var _0x2433bf=_0x3b6f20[_0x34788b['data2']];if(_0x2433bf){var _0x2d1603=_[_0xffec('0x12')](_0x2433bf[_0xffec('0x13')],{'id':parseInt(_0x34788b[_0xffec('0x14')],0xa)});if(_0x2d1603){if(_0x4e9cec){if(_0x509dbc&&_0x21fbcd[_0xffec('0x15')]){_0x401848=_0xffec('0x15');}else if(_0x21fbcd['routeId']){_0x401848=_0xffec('0x16');}else{console['log'](_0xffec('0x17'),_0x21fbcd);}}else{_0x401848=_0xffec('0x18');}switch(_0x34788b['data1'][_0xffec('0x11')]()){case _0xffec('0x19'):zendesk[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case'salesforce':salesforce[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case _0xffec('0x8'):sugarcrm[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case'freshdesk':freshdesk[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case _0xffec('0xa'):zoho[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case _0xffec('0x1a'):desk[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case'vtiger':vtiger[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case _0xffec('0xd'):freshsales['cs'](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3,_0x401848);break;case _0xffec('0xe'):servicenow['cs'](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3,_0x401848);break;case'dynamics365':dynamics365['cs'](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3,_0x401848);break;default:console[_0xffec('0x1b')](_0xffec('0x1c'));}}else{_0x37ee7a=require('../../../../config/logger')(_0x34788b[_0xffec('0x10')][_0xffec('0x11')]());_0x37ee7a[_0xffec('0x1d')](_0xffec('0x1e'),util[_0xffec('0x1f')](_0xffec('0x20'),_0x34788b[_0xffec('0x10')]['toLowerCase'](),_0x34788b[_0xffec('0x14')]));}}else{_0x37ee7a=require(_0xffec('0x21'))(_0x34788b['data1'][_0xffec('0x11')]());_0x37ee7a[_0xffec('0x1d')](_0xffec('0x1e'),util[_0xffec('0x1f')](_0xffec('0x22'),_0x34788b[_0xffec('0x10')][_0xffec('0x11')](),_0x34788b[_0xffec('0x23')]));}}else{}}catch(_0x38e059){console['error'](_0x38e059);}}}}; \ No newline at end of file +var _0x618f=['%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','exec','data1','toLowerCase','find','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshsales','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format'];(function(_0x632669,_0x960797){var _0xb1adec=function(_0x3c30d0){while(--_0x3c30d0){_0x632669['push'](_0x632669['shift']());}};_0xb1adec(++_0x960797);}(_0x618f,0x18a));var _0xf618=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x618f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf618('0x0'));var util=require(_0xf618('0x1'));var zendesk=require(_0xf618('0x2'));var salesforce=require(_0xf618('0x3'));var sugarcrm=require(_0xf618('0x4'));var freshdesk=require(_0xf618('0x5'));var zoho=require(_0xf618('0x6'));var desk=require(_0xf618('0x7'));var vtiger=require(_0xf618('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0xf618('0x9'));var freshsales=require(_0xf618('0xa'));var integrations=[_0xf618('0xb'),'salesforce',_0xf618('0xc'),_0xf618('0xd'),_0xf618('0xe'),_0xf618('0xf'),_0xf618('0x10'),'dynamics365','freshsales','servicenow'];exports[_0xf618('0x11')]=function(_0x2562bf,_0x742ce8,_0x5378e2,_0x4d0822,_0x3788ba,_0x43eca4){if(_0x5378e2){if(_['includes'](integrations,_0x2562bf[_0xf618('0x12')][_0xf618('0x13')]())){try{var _0x4dcdaf=null;var _0x4a6220='';var _0x656b5f=_0x5378e2[_0x2562bf[_0xf618('0x12')][_0xf618('0x13')]()];if(_0x656b5f){var _0x265f66=_0x656b5f[_0x2562bf['data2']];if(_0x265f66){var _0x11a87c=_[_0xf618('0x14')](_0x265f66['Configurations'],{'id':parseInt(_0x2562bf['data3'],0xa)});if(_0x11a87c){if(_0x4d0822){if(_0x3788ba&&_0x742ce8[_0xf618('0x15')]){_0x4a6220=_0xf618('0x15');}else if(_0x742ce8['routeId']){_0x4a6220=_0xf618('0x16');}else{console[_0xf618('0x17')](_0xf618('0x18'),_0x742ce8);}}else{_0x4a6220=_0xf618('0x19');}switch(_0x2562bf[_0xf618('0x12')][_0xf618('0x13')]()){case _0xf618('0xb'):zendesk[_0x4a6220](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4);break;case _0xf618('0x1a'):salesforce[_0x4a6220](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4);break;case _0xf618('0xc'):sugarcrm[_0x4a6220](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4);break;case _0xf618('0xd'):freshdesk[_0x4a6220](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4);break;case'zoho':zoho[_0x4a6220](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4);break;case _0xf618('0xf'):desk[_0x4a6220](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4);break;case _0xf618('0x10'):vtiger[_0x4a6220](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4);break;case _0xf618('0x1b'):freshsales['cs'](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4,_0x4a6220);break;case _0xf618('0x1c'):servicenow['cs'](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4,_0x4a6220);break;case _0xf618('0x1d'):dynamics365['cs'](_0x2562bf,_0x742ce8,_0x11a87c,_0x4d0822,_0x3788ba,_0x265f66,_0x43eca4,_0x4a6220);break;default:console['log'](_0xf618('0x1e'));}}else{_0x4dcdaf=require(_0xf618('0x1f'))(_0x2562bf[_0xf618('0x12')][_0xf618('0x13')]());_0x4dcdaf[_0xf618('0x20')](_0xf618('0x21'),util[_0xf618('0x22')](_0xf618('0x23'),_0x2562bf['data1'][_0xf618('0x13')](),_0x2562bf[_0xf618('0x24')]));}}else{_0x4dcdaf=require(_0xf618('0x1f'))(_0x2562bf[_0xf618('0x12')][_0xf618('0x13')]());_0x4dcdaf[_0xf618('0x20')]('[EXEC]',util[_0xf618('0x22')](_0xf618('0x25'),_0x2562bf['data1'][_0xf618('0x13')](),_0x2562bf[_0xf618('0x26')]));}}else{}}catch(_0x7c158){console['error'](_0x7c158);}}}}; \ 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 028a0b3..3a6dcee 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 _0x3330=['LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','picklist','idField','content','toString','variableName','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','isNil','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','endUserType','contact','WhoId','WhatId','ContactId','account','AccountId','lead','leadId','info','sobject','create','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate'];(function(_0x40e4c4,_0x225995){var _0x4667f9=function(_0x19e483){while(--_0x19e483){_0x40e4c4['push'](_0x40e4c4['shift']());}};_0x4667f9(++_0x225995);}(_0x3330,0x136));var _0x0333=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3330[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0333('0x0'));var rp=require(_0x0333('0x1'));var moment=require(_0x0333('0x2'));var BPromise=require(_0x0333('0x3'));var md5=require('md5');var jsforce=require(_0x0333('0x4'));var util=require(_0x0333('0x5'));var Redis=require('ioredis');var intUtil=require(_0x0333('0x6'));var config=require('../../../../config/environment');var logger=require(_0x0333('0x7'))(_0x0333('0x8'));config[_0x0333('0x9')]=_[_0x0333('0xa')](config[_0x0333('0x9')],{'host':_0x0333('0xb'),'port':0x18eb});var io=require(_0x0333('0xc'))(new Redis(config[_0x0333('0x9')]));function emit(_0x4d34e2,_0x2eb9ca,_0x236f64){io['to'](_0x4d34e2)['emit'](_0x2eb9ca,_0x236f64);}function getTicket(_0x3d31fb,_0x182816,_0x2b53d4,_0x154a16,_0x13f62c,_0x3a8fe7,_0x822a85,_0x5313d8){var _0x5f465f=Object['assign']({},{'OwnerId':_0x182816['id'],'Subject':intUtil[_0x0333('0xd')](_0x154a16[_0x0333('0xe')],_0x13f62c,'\x20'),'Description':intUtil[_0x0333('0xd')](_0x154a16[_0x0333('0xf')],_0x13f62c,'\x0a')},getCustomFields(_0x3a8fe7,_0x13f62c));if(_0x2b53d4){if(_0x154a16[_0x0333('0x10')]===_0x0333('0x11')){_0x5f465f[_0x0333('0x12')]=moment[_0x0333('0x13')]();_0x5f465f['IsReminderSet']=![];_0x5f465f['IsRecurrence']=![];if(_0x2b53d4[_0x0333('0x14')]===_0x0333('0x15')||_0x2b53d4['endUserType']==='lead'){_0x5f465f[_0x0333('0x16')]=_0x2b53d4['id'];}else if(_0x2b53d4['endUserType']==='account'){_0x5f465f[_0x0333('0x17')]=_0x2b53d4['id'];}}else if(_0x154a16['ticketType']==='Case'){if(_0x2b53d4[_0x0333('0x14')]===_0x0333('0x15')){_0x5f465f[_0x0333('0x18')]=_0x2b53d4['id'];}else if(_0x2b53d4[_0x0333('0x14')]===_0x0333('0x19')){_0x5f465f[_0x0333('0x1a')]=_0x2b53d4['id'];}else if(_0x2b53d4[_0x0333('0x14')]===_0x0333('0x1b')&&_0x154a16[_0x0333('0x1c')]){_0x5f465f[_0x154a16[_0x0333('0x1c')]]=_0x2b53d4['id'];}else{logger[_0x0333('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x822a85[_0x0333('0x1e')](_0x154a16[_0x0333('0x10')])[_0x0333('0x1f')](_0x5f465f);}function getUser(_0x4cba9e,_0xd97ce4,_0x4586e8){if(!_['isNil'](_0xd97ce4)&&intUtil['validateEmail'](_0xd97ce4)){var _0x3623ea={'Email':_0xd97ce4};var _0xbe239f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4586e8[_0x0333('0x1e')](_0x0333('0x20'))[_0x0333('0x21')](_0x3623ea,_0xbe239f)[_0x0333('0x22')]()[_0x0333('0x23')](function(_0x177a93){if(_0x177a93[_0x0333('0x24')]){var _0x526290=_[_0x0333('0x21')](_0x177a93,function(_0x555e46){return _0x555e46[_0x0333('0x25')]===_0xd97ce4;});if(_0x526290){logger[_0x0333('0x1d')](_0x0333('0x26'),_0xd97ce4);return BPromise[_0x0333('0x27')]({'id':_0x526290['Id'],'name':_0x526290[_0x0333('0x28')]});}}else{logger[_0x0333('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xd97ce4);return _0x4586e8[_0x0333('0x29')]()[_0x0333('0x23')](function(_0x4bce7f){return BPromise[_0x0333('0x27')]({'id':_0x4bce7f['user_id'],'name':_0x4bce7f[_0x0333('0x2a')]});});}});}else{logger[_0x0333('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xd97ce4);return _0x4586e8['identity']()['then'](function(_0x3c0dae){return BPromise[_0x0333('0x27')]({'id':_0x3c0dae[_0x0333('0x2b')],'name':_0x3c0dae[_0x0333('0x2a')]});});}}function getEndUser(_0x4524c3,_0xd705c8,_0x159cbb,_0xe4705a,_0x4a6cdd){var _0xd20d62={'$or':{'Phone':_0xe4705a}};var _0x19fd4f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info'](_0x0333('0x2c'),_0xe4705a,_0xd705c8[_0x0333('0x2d')]);switch(_0xd705c8[_0x0333('0x2d')]){case _0x0333('0x2e'):var _0x4201bd=_['cloneDeep'](_0xd20d62);if(_0xd705c8[_0x0333('0x2f')]){var _0x27f69c={};_0x27f69c[_0xd705c8[_0x0333('0x2f')]]=_0xe4705a;_[_0x0333('0x30')](_0x4201bd['$or'],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')]('Contact')[_0x0333('0x21')](_0x4201bd,_0x19fd4f)[_0x0333('0x22')]()[_0x0333('0x23')](function(_0x3a9252){if(_0x3a9252&&_0x3a9252[_0x0333('0x24')]){return _0x3a9252;}else{var _0x4f9561=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8[_0x0333('0x32')]){var _0x3f8e8f={};_0x3f8e8f[_0xd705c8[_0x0333('0x32')]]=_0xe4705a;_['merge'](_0x4f9561[_0x0333('0x33')],_0x3f8e8f);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x34'))['find'](_0x4f9561,_0x19fd4f);}});case _0x0333('0x35'):var _0xbcccce=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8['additionalSearchAccount']){var _0x27f69c={};_0x27f69c[_0xd705c8[_0x0333('0x36')]]=_0xe4705a;_[_0x0333('0x30')](_0xbcccce[_0x0333('0x33')],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x37'))[_0x0333('0x21')](_0xbcccce,_0x19fd4f)['execute']()[_0x0333('0x23')](function(_0x65777f){if(_0x65777f&&_0x65777f[_0x0333('0x24')]){return _0x65777f;}else{var _0x119775=_['cloneDeep'](_0xd20d62);if(_0xd705c8[_0x0333('0x2f')]){var _0x5dbb02={};_0x5dbb02[_0xd705c8['additionalSearchContact']]=_0xe4705a;_[_0x0333('0x30')](_0x119775[_0x0333('0x33')],_0x5dbb02);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x38'))[_0x0333('0x21')](_0x119775,_0x19fd4f)[_0x0333('0x23')](function(_0x227bee){if(_0x227bee&&_0x227bee['length']){return _0x227bee;}else{var _0x2c3f32=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8[_0x0333('0x32')]){var _0x1c33df={};_0x1c33df[_0xd705c8[_0x0333('0x32')]]=_0xe4705a;_[_0x0333('0x30')](_0x2c3f32[_0x0333('0x33')],_0x1c33df);}return _0x4a6cdd['sobject'](_0x0333('0x34'))[_0x0333('0x21')](_0x2c3f32,_0x19fd4f);}});}});case _0x0333('0x15'):var _0x4201bd=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8[_0x0333('0x2f')]){var _0x27f69c={};_0x27f69c[_0xd705c8['additionalSearchContact']]=_0xe4705a;_[_0x0333('0x30')](_0x4201bd[_0x0333('0x33')],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x38'))[_0x0333('0x21')](_0x4201bd,_0x19fd4f)[_0x0333('0x22')]();case _0x0333('0x1b'):var _0x33537e=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8[_0x0333('0x32')]){var _0x27f69c={};_0x27f69c[_0xd705c8[_0x0333('0x32')]]=_0xe4705a;_[_0x0333('0x30')](_0x33537e[_0x0333('0x33')],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')]('Lead')[_0x0333('0x21')](_0x33537e,_0x19fd4f);case _0x0333('0x19'):var _0xbcccce=_['cloneDeep'](_0xd20d62);if(_0xd705c8['additionalSearchAccount']){var _0x27f69c={};_0x27f69c[_0xd705c8[_0x0333('0x36')]]=_0xe4705a;_[_0x0333('0x30')](_0xbcccce[_0x0333('0x33')],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x37'))[_0x0333('0x21')](_0xbcccce,_0x19fd4f);default:return null;}})[_0x0333('0x23')](function(_0x5c1a51){if(_0x5c1a51&&_0x5c1a51['length']){var _0xfc42ca=_[_0x0333('0x39')](_0x5c1a51);if(_0xfc42ca){return BPromise[_0x0333('0x27')]({'id':_0xfc42ca['Id'],'name':_0xfc42ca['Name'],'phone':_0xfc42ca[_0x0333('0x3a')],'endUserType':_0xfc42ca['attributes'][_0x0333('0x3b')][_0x0333('0x3c')]()});}}})['then'](function(_0x5bd511){if(_0x5bd511){logger['info'](_0x0333('0x3d'),_0x5bd511[_0x0333('0x14')],_0xe4705a);return BPromise[_0x0333('0x27')](_0x5bd511);}else{logger[_0x0333('0x1d')](_0x0333('0x3e'),_0xe4705a);var _0x1db440={'Phone':_0xe4705a};if(_0xd705c8['moduleCreate']){if(_0xd705c8['moduleCreate']===_0x0333('0x15')){logger[_0x0333('0x1d')](_0x0333('0x3f'),_0xe4705a,_0xd705c8[_0x0333('0x40')]);_0x1db440[_0x0333('0x41')]=_0x159cbb!==_0x0333('0x42')?_0x159cbb:util[_0x0333('0x43')](_0x0333('0x44'),_0xe4705a);}else if(_0xd705c8['moduleCreate']===_0x0333('0x1b')){logger[_0x0333('0x1d')](_0x0333('0x3f'),_0xe4705a,_0xd705c8[_0x0333('0x40')]);_0x1db440[_0x0333('0x41')]=_0x159cbb!==_0x0333('0x42')?_0x159cbb:util[_0x0333('0x43')](_0x0333('0x44'),_0xe4705a);_0x1db440[_0x0333('0x45')]=_0x0333('0x46');}else if(_0xd705c8[_0x0333('0x40')]===_0x0333('0x19')){logger[_0x0333('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xe4705a,_0xd705c8[_0x0333('0x40')]);_0x1db440['Name']=_0x159cbb!==_0x0333('0x42')?_0x159cbb:util['format'](_0x0333('0x44'),_0xe4705a);}else{return null;}}return _0x4a6cdd[_0x0333('0x1e')](_[_0x0333('0x47')](_0xd705c8[_0x0333('0x40')]))[_0x0333('0x1f')](_0x1db440)[_0x0333('0x23')](function(_0x2f6103){return BPromise['resolve']({'id':_0x2f6103['id'],'endUserType':_0xd705c8[_0x0333('0x40')]});});}});}function getCustomFields(_0x2799f9,_0x58acfa){var _0x28934f={};if(_0x2799f9[_0x0333('0x24')]>0x0){_[_0x0333('0x48')](_0x2799f9,function(_0x2012fa){if(_[_0x0333('0x49')](['string',_0x0333('0x4a')],_0x2012fa['type'])&&_0x2012fa[_0x0333('0x4b')]){_0x28934f[_0x2012fa[_0x0333('0x4b')]]=_0x2012fa[_0x0333('0x4c')][_0x0333('0x4d')]();}else if(_0x2012fa[_0x0333('0x3b')]==='variable'&&_0x2012fa[_0x0333('0x4e')]&&_0x2012fa[_0x0333('0x4b')]){_0x58acfa[_0x2012fa[_0x0333('0x4e')]]&&(_0x28934f[_0x2012fa[_0x0333('0x4b')]]=_0x58acfa[_0x2012fa[_0x0333('0x4e')]][_0x0333('0x4d')]());}else if(_0x2012fa[_0x0333('0x3b')]==='customVariable'&&_0x2012fa['Variable']&&_0x2012fa[_0x0333('0x4f')][_0x0333('0x50')]&&_0x2012fa['idField']){_0x58acfa[_0x2012fa['Variable'][_0x0333('0x50')]['toLowerCase']()]&&(_0x28934f[_0x2012fa[_0x0333('0x4b')]]=_0x58acfa[_0x2012fa['Variable']['name'][_0x0333('0x3c')]()]['toString']());}});}return _0x28934f;}function getConnection(_0x2c84d9){var _0x454e93=_0x2c84d9[_0x0333('0x51')]['concat'](_0x2c84d9[_0x0333('0x52')]);var _0x55822a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2c84d9[_0x0333('0x53')]||_0x0333('0x54'),'clientId':_0x2c84d9[_0x0333('0x55')],'clientSecret':_0x2c84d9[_0x0333('0x56')]}});return _0x55822a['login'](_0x2c84d9[_0x0333('0x57')],_0x454e93)[_0x0333('0x23')](function(){logger[_0x0333('0x1d')](_0x0333('0x58'));return _0x55822a;});}exports[_0x0333('0x59')]=function(_0x53e4cd,_0x2b2931,_0x591040,_0x2eae36,_0x549368,_0x565690){var _0x217a53,_0x3a8884,_0x1e596f,_0x3c1a05;_0x565690['serverUrl']=intUtil['stripTrailingSlash'](_0x565690[_0x0333('0x5a')]);_0x565690[_0x0333('0x53')]=intUtil[_0x0333('0x5b')](_0x565690[_0x0333('0x53')]);if(_0x549368&&_0x549368[_0x0333('0x5c')]){logger['info'](_0x0333('0x5d'),_0x0333('0x5e'));_0x2b2931[_0x0333('0x5f')]=util['format'](_0x0333('0x60'),_0x565690[_0x0333('0x5a')],_0x2b2931[_0x0333('0x61')],md5(_0x2b2931[_0x0333('0x61')]));}else{_0x2b2931[_0x0333('0x5f')]='';}return getConnection(_0x565690)[_0x0333('0x23')](function(_0x18a9f3){_0x3c1a05=_0x18a9f3;return getUser(_0x565690,_0x2eae36[_0x0333('0x62')],_0x3c1a05);})[_0x0333('0x23')](function(_0x4feef0){_0x217a53=_0x4feef0;return getEndUser(_0x565690,_0x591040,_0x2b2931[_0x0333('0x63')],_0x2b2931['calleridnum'],_0x3c1a05);})['then'](function(_0x1322ad){_0x3a8884=_0x1322ad;return getTicket(_0x565690,_0x217a53,_0x3a8884,_0x591040,_0x2b2931,_0x591040[_0x0333('0x64')],_0x3c1a05,_0x0333('0x59'));})['then'](function(_0x2b4e58){_0x1e596f=_0x2b4e58;logger[_0x0333('0x1d')](_0x0333('0x65'),_0x1e596f['id']);logger[_0x0333('0x1d')](_0x0333('0x66'),_0x1e596f['id'],_0x2eae36[_0x0333('0x50')],_0x565690['type']);switch(_0x565690[_0x0333('0x3b')]){case _0x0333('0x67'):emit(util[_0x0333('0x43')](_0x0333('0x68'),_0x2eae36[_0x0333('0x50')]),'trigger:salesforce:display',{'recordId':_0x1e596f['id']});break;case'newTab':emit(util['format'](_0x0333('0x68'),_0x2eae36[_0x0333('0x50')]),'trigger:browser:url',{'uri':util['format'](_0x0333('0x69'),_0x3c1a05['instanceUrl'],_0x1e596f['id'])});break;default:logger[_0x0333('0x6a')](_0x0333('0x6b'));}})['catch'](function(_0x1118db){logger[_0x0333('0x6a')]('[QUEUE]',_0x1118db);});};exports[_0x0333('0x6c')]=function(_0x4938f3,_0x39945a,_0xab1e03,_0x3ebc50,_0x1f9bbf,_0x596e80,_0x3d0942){var _0x5368b6,_0x490bcc,_0x2dfc26,_0x4c458f;_0x596e80['serverUrl']=intUtil[_0x0333('0x5b')](_0x596e80[_0x0333('0x5a')]);_0x596e80[_0x0333('0x53')]=intUtil['stripTrailingSlash'](_0x596e80[_0x0333('0x53')]);if(_0x3d0942&&_0x3d0942['recordingFormat']&&_0x3d0942[_0x0333('0x6d')]!==_0x0333('0x6e')){logger[_0x0333('0x1d')](_0x0333('0x6f'),_0x0333('0x5e'));_0x39945a[_0x0333('0x5f')]=util['format'](_0x0333('0x60'),_0x596e80[_0x0333('0x5a')],_0x39945a['uniqueid'],md5(_0x39945a['uniqueid']));}return getConnection(_0x596e80)[_0x0333('0x23')](function(_0xb02347){_0x4c458f=_0xb02347;return getUser(_0x596e80,_0x3ebc50[_0x0333('0x62')],_0x4c458f);})[_0x0333('0x23')](function(_0x5c589d){_0x5368b6=_0x5c589d;return getEndUser(_0x596e80,_0xab1e03,_0x39945a[_0x0333('0x70')],_0x39945a[_0x0333('0x71')],_0x4c458f);})[_0x0333('0x23')](function(_0x1129e4){_0x490bcc=_0x1129e4;return getTicket(_0x596e80,_0x5368b6,_0x490bcc,_0xab1e03,_0x39945a,_0xab1e03['Fields'],_0x4c458f,_0x0333('0x6c'));})['then'](function(_0x6a1324){_0x2dfc26=_0x6a1324;logger['info'](_0x0333('0x72'),_0x2dfc26['id']);logger[_0x0333('0x1d')](_0x0333('0x73'),_0x2dfc26['id'],_0x3ebc50['name'],_0x596e80[_0x0333('0x3b')]);switch(_0x596e80[_0x0333('0x3b')]){case _0x0333('0x67'):emit(util[_0x0333('0x43')](_0x0333('0x68'),_0x3ebc50['name']),'trigger:salesforce:display',{'recordId':_0x2dfc26['id']});break;case'newTab':emit(util[_0x0333('0x43')]('user:%s',_0x3ebc50[_0x0333('0x50')]),'trigger:browser:url',{'uri':util['format'](_0x0333('0x69'),_0x4c458f[_0x0333('0x74')],_0x2dfc26['id'])});break;default:logger[_0x0333('0x6a')](_0x0333('0x6f'),_0x0333('0x75'));}})[_0x0333('0x76')](function(_0x567460){logger['error']('[OUTBOUND]',_0x567460);});};exports['unmanaged']=function(_0x237c11,_0x4f3c4d,_0x39e1cf,_0x4f17b5,_0x32e814,_0x5d34f2){var _0x19ecdb,_0x90ecfe,_0x111f40,_0x13ba83;_0x5d34f2['serverUrl']=intUtil[_0x0333('0x5b')](_0x5d34f2[_0x0333('0x5a')]);_0x5d34f2[_0x0333('0x53')]=intUtil[_0x0333('0x5b')](_0x5d34f2[_0x0333('0x53')]);if(_0x32e814&&_0x32e814['monitor_format']){logger[_0x0333('0x1d')]('['+_0x4f3c4d[_0x0333('0x77')]['toUpperCase']()+']',_0x0333('0x5e'));_0x4f3c4d[_0x0333('0x5f')]=util[_0x0333('0x43')](_0x0333('0x60'),_0x5d34f2[_0x0333('0x5a')],_0x4f3c4d[_0x0333('0x61')],md5(_0x4f3c4d[_0x0333('0x61')]));}else{_0x4f3c4d[_0x0333('0x5f')]='';}return getConnection(_0x5d34f2)['then'](function(_0x4d313a){_0x13ba83=_0x4d313a;if(!_[_0x0333('0x78')](_0x4f17b5)){return getUser(_0x5d34f2,_0x4f17b5['name'],_0x13ba83);}else{return getUser(_0x5d34f2,null,_0x13ba83);}})[_0x0333('0x23')](function(_0x29dfd0){_0x19ecdb=_0x29dfd0;return getEndUser(_0x5d34f2,_0x39e1cf,_0x4f3c4d[_0x0333('0x63')],_0x4f3c4d[_0x0333('0x79')],_0x13ba83);})[_0x0333('0x23')](function(_0x217f9d){_0x90ecfe=_0x217f9d;return getTicket(_0x5d34f2,_0x19ecdb,_0x90ecfe,_0x39e1cf,_0x4f3c4d,_0x39e1cf[_0x0333('0x64')],_0x13ba83);})[_0x0333('0x23')](function(_0x45cf85){_0x111f40=_0x45cf85;logger[_0x0333('0x1d')]('['+_0x4f3c4d[_0x0333('0x77')][_0x0333('0x7a')]()+_0x0333('0x7b'),_0x111f40['id']);logger['info']('['+_0x4f3c4d[_0x0333('0x77')][_0x0333('0x7a')]()+_0x0333('0x7c'),_0x5d34f2[_0x0333('0x3b')]);})[_0x0333('0x76')](function(_0x3170d1){logger['error']('['+_0x4f3c4d[_0x0333('0x77')][_0x0333('0x7a')]()+']',_0x3170d1);});}; \ No newline at end of file +var _0x20a1=['Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','clientSecret','login','username','Connection\x20established.','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','salesforce','defaults','redis','socket.io-emitter','assign','getString','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','User','find','execute','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x20a1,0x1ca));var _0x120a=function(_0x4ffc7a,_0x44e9c5){_0x4ffc7a=_0x4ffc7a-0x0;var _0x315dea=_0x20a1[_0x4ffc7a];return _0x315dea;};'use strict';var _=require(_0x120a('0x0'));var rp=require(_0x120a('0x1'));var moment=require(_0x120a('0x2'));var BPromise=require(_0x120a('0x3'));var md5=require(_0x120a('0x4'));var jsforce=require('jsforce');var util=require(_0x120a('0x5'));var Redis=require(_0x120a('0x6'));var intUtil=require(_0x120a('0x7'));var config=require(_0x120a('0x8'));var logger=require('../../../../config/logger')(_0x120a('0x9'));config['redis']=_[_0x120a('0xa')](config[_0x120a('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x120a('0xc'))(new Redis(config['redis']));function emit(_0x4ae710,_0x40f6fe,_0x397b40){io['to'](_0x4ae710)['emit'](_0x40f6fe,_0x397b40);}function getTicket(_0x4d9467,_0x51984e,_0x3a206f,_0x148875,_0x4ee74e,_0xa76ff5,_0x40a44a,_0x49a404){var _0x36b3ac=Object[_0x120a('0xd')]({},{'OwnerId':_0x51984e['id'],'Subject':intUtil[_0x120a('0xe')](_0x148875['Subjects'],_0x4ee74e,'\x20'),'Description':intUtil['getString'](_0x148875['Descriptions'],_0x4ee74e,'\x0a')},getCustomFields(_0xa76ff5,_0x4ee74e));if(_0x3a206f){if(_0x148875['ticketType']===_0x120a('0xf')){_0x36b3ac[_0x120a('0x10')]=moment[_0x120a('0x11')]();_0x36b3ac['IsReminderSet']=![];_0x36b3ac[_0x120a('0x12')]=![];if(_0x3a206f[_0x120a('0x13')]===_0x120a('0x14')||_0x3a206f[_0x120a('0x13')]===_0x120a('0x15')){_0x36b3ac['WhoId']=_0x3a206f['id'];}else if(_0x3a206f[_0x120a('0x13')]===_0x120a('0x16')){_0x36b3ac[_0x120a('0x17')]=_0x3a206f['id'];}}else if(_0x148875[_0x120a('0x18')]===_0x120a('0x19')){if(_0x3a206f[_0x120a('0x13')]==='contact'){_0x36b3ac[_0x120a('0x1a')]=_0x3a206f['id'];}else if(_0x3a206f['endUserType']==='account'){_0x36b3ac[_0x120a('0x1b')]=_0x3a206f['id'];}else if(_0x3a206f[_0x120a('0x13')]===_0x120a('0x15')&&_0x148875['leadId']){_0x36b3ac[_0x148875[_0x120a('0x1c')]]=_0x3a206f['id'];}else{logger[_0x120a('0x1d')](_0x120a('0x1e'));}}}return _0x40a44a[_0x120a('0x1f')](_0x148875[_0x120a('0x18')])[_0x120a('0x20')](_0x36b3ac);}function getUser(_0x12e3cf,_0x1322ee,_0x4551ee){if(!_['isNil'](_0x1322ee)&&intUtil['validateEmail'](_0x1322ee)){var _0x17826e={'Email':_0x1322ee};var _0x426e6a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4551ee[_0x120a('0x1f')](_0x120a('0x21'))[_0x120a('0x22')](_0x17826e,_0x426e6a)[_0x120a('0x23')]()['then'](function(_0x95ea8c){if(_0x95ea8c[_0x120a('0x24')]){var _0x5116dc=_[_0x120a('0x22')](_0x95ea8c,function(_0xc5e601){return _0xc5e601[_0x120a('0x25')]===_0x1322ee;});if(_0x5116dc){logger[_0x120a('0x1d')]('Agent\x20%s\x20found.',_0x1322ee);return BPromise['resolve']({'id':_0x5116dc['Id'],'name':_0x5116dc[_0x120a('0x26')]});}}else{logger['info'](_0x120a('0x27'),_0x1322ee);return _0x4551ee[_0x120a('0x28')]()['then'](function(_0x390772){return BPromise[_0x120a('0x29')]({'id':_0x390772[_0x120a('0x2a')],'name':_0x390772['display_name']});});}});}else{logger[_0x120a('0x1d')](_0x120a('0x27'),_0x1322ee);return _0x4551ee['identity']()['then'](function(_0xea78c1){return BPromise[_0x120a('0x29')]({'id':_0xea78c1[_0x120a('0x2a')],'name':_0xea78c1[_0x120a('0x2b')]});});}}function getEndUser(_0x5c8034,_0x2d5340,_0x2744ed,_0x5d4466,_0x407a9c){var _0x16854d={'$or':{'Phone':_0x5d4466}};var _0x36fdb5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x120a('0x29')]()[_0x120a('0x2c')](function(){logger[_0x120a('0x1d')](_0x120a('0x2d'),_0x5d4466,_0x2d5340['moduleSearch']);switch(_0x2d5340[_0x120a('0x2e')]){case _0x120a('0x2f'):var _0x40a6d7=_[_0x120a('0x30')](_0x16854d);if(_0x2d5340[_0x120a('0x31')]){var _0x4ef69d={};_0x4ef69d[_0x2d5340['additionalSearchContact']]=_0x5d4466;_['merge'](_0x40a6d7[_0x120a('0x32')],_0x4ef69d);}return _0x407a9c[_0x120a('0x1f')](_0x120a('0x33'))[_0x120a('0x22')](_0x40a6d7,_0x36fdb5)['execute']()[_0x120a('0x2c')](function(_0x14d542){if(_0x14d542&&_0x14d542[_0x120a('0x24')]){return _0x14d542;}else{var _0x1de216=_[_0x120a('0x30')](_0x16854d);if(_0x2d5340[_0x120a('0x34')]){var _0x2b711d={};_0x2b711d[_0x2d5340['additionalSearchLead']]=_0x5d4466;_[_0x120a('0x35')](_0x1de216[_0x120a('0x32')],_0x2b711d);}return _0x407a9c[_0x120a('0x1f')](_0x120a('0x36'))[_0x120a('0x22')](_0x1de216,_0x36fdb5);}});case _0x120a('0x37'):var _0x4f875a=_[_0x120a('0x30')](_0x16854d);if(_0x2d5340[_0x120a('0x38')]){var _0x4ef69d={};_0x4ef69d[_0x2d5340[_0x120a('0x38')]]=_0x5d4466;_['merge'](_0x4f875a[_0x120a('0x32')],_0x4ef69d);}return _0x407a9c['sobject'](_0x120a('0x39'))[_0x120a('0x22')](_0x4f875a,_0x36fdb5)['execute']()[_0x120a('0x2c')](function(_0xa69d44){if(_0xa69d44&&_0xa69d44['length']){return _0xa69d44;}else{var _0x290305=_[_0x120a('0x30')](_0x16854d);if(_0x2d5340[_0x120a('0x31')]){var _0x17ec03={};_0x17ec03[_0x2d5340[_0x120a('0x31')]]=_0x5d4466;_['merge'](_0x290305[_0x120a('0x32')],_0x17ec03);}return _0x407a9c[_0x120a('0x1f')]('Contact')[_0x120a('0x22')](_0x290305,_0x36fdb5)[_0x120a('0x2c')](function(_0x472ae0){if(_0x472ae0&&_0x472ae0[_0x120a('0x24')]){return _0x472ae0;}else{var _0x50ca5f=_[_0x120a('0x30')](_0x16854d);if(_0x2d5340[_0x120a('0x34')]){var _0x273806={};_0x273806[_0x2d5340[_0x120a('0x34')]]=_0x5d4466;_[_0x120a('0x35')](_0x50ca5f['$or'],_0x273806);}return _0x407a9c[_0x120a('0x1f')]('Lead')[_0x120a('0x22')](_0x50ca5f,_0x36fdb5);}});}});case _0x120a('0x14'):var _0x40a6d7=_[_0x120a('0x30')](_0x16854d);if(_0x2d5340[_0x120a('0x31')]){var _0x4ef69d={};_0x4ef69d[_0x2d5340[_0x120a('0x31')]]=_0x5d4466;_['merge'](_0x40a6d7[_0x120a('0x32')],_0x4ef69d);}return _0x407a9c[_0x120a('0x1f')]('Contact')[_0x120a('0x22')](_0x40a6d7,_0x36fdb5)['execute']();case'lead':var _0x1e3034=_['cloneDeep'](_0x16854d);if(_0x2d5340[_0x120a('0x34')]){var _0x4ef69d={};_0x4ef69d[_0x2d5340['additionalSearchLead']]=_0x5d4466;_['merge'](_0x1e3034[_0x120a('0x32')],_0x4ef69d);}return _0x407a9c[_0x120a('0x1f')]('Lead')[_0x120a('0x22')](_0x1e3034,_0x36fdb5);case _0x120a('0x16'):var _0x4f875a=_[_0x120a('0x30')](_0x16854d);if(_0x2d5340['additionalSearchAccount']){var _0x4ef69d={};_0x4ef69d[_0x2d5340[_0x120a('0x38')]]=_0x5d4466;_[_0x120a('0x35')](_0x4f875a[_0x120a('0x32')],_0x4ef69d);}return _0x407a9c['sobject'](_0x120a('0x39'))[_0x120a('0x22')](_0x4f875a,_0x36fdb5);default:return null;}})[_0x120a('0x2c')](function(_0x179aa6){if(_0x179aa6&&_0x179aa6['length']){var _0x2868a9=_[_0x120a('0x3a')](_0x179aa6);if(_0x2868a9){return BPromise[_0x120a('0x29')]({'id':_0x2868a9['Id'],'name':_0x2868a9[_0x120a('0x26')],'phone':_0x2868a9[_0x120a('0x3b')],'endUserType':_0x2868a9['attributes']['type'][_0x120a('0x3c')]()});}}})[_0x120a('0x2c')](function(_0x5e21bf){if(_0x5e21bf){logger[_0x120a('0x1d')](_0x120a('0x3d'),_0x5e21bf[_0x120a('0x13')],_0x5d4466);return BPromise['resolve'](_0x5e21bf);}else{logger[_0x120a('0x1d')](_0x120a('0x3e'),_0x5d4466);var _0x1a25ab={'Phone':_0x5d4466};if(_0x2d5340[_0x120a('0x3f')]){if(_0x2d5340[_0x120a('0x3f')]===_0x120a('0x14')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5d4466,_0x2d5340['moduleCreate']);_0x1a25ab[_0x120a('0x40')]=_0x2744ed!==_0x120a('0x41')?_0x2744ed:util[_0x120a('0x42')]('Caller\x20-\x20%s',_0x5d4466);}else if(_0x2d5340[_0x120a('0x3f')]==='lead'){logger[_0x120a('0x1d')](_0x120a('0x43'),_0x5d4466,_0x2d5340[_0x120a('0x3f')]);_0x1a25ab[_0x120a('0x40')]=_0x2744ed!==_0x120a('0x41')?_0x2744ed:util['format'](_0x120a('0x44'),_0x5d4466);_0x1a25ab[_0x120a('0x45')]=_0x120a('0x46');}else if(_0x2d5340['moduleCreate']===_0x120a('0x16')){logger[_0x120a('0x1d')](_0x120a('0x43'),_0x5d4466,_0x2d5340[_0x120a('0x3f')]);_0x1a25ab[_0x120a('0x26')]=_0x2744ed!==''?_0x2744ed:util['format'](_0x120a('0x44'),_0x5d4466);}else{return null;}}return _0x407a9c[_0x120a('0x1f')](_[_0x120a('0x47')](_0x2d5340[_0x120a('0x3f')]))[_0x120a('0x20')](_0x1a25ab)[_0x120a('0x2c')](function(_0x540542){return BPromise[_0x120a('0x29')]({'id':_0x540542['id'],'endUserType':_0x2d5340[_0x120a('0x3f')]});});}});}function getCustomFields(_0x56ba99,_0x4bb298){var _0x2a099f={};if(_0x56ba99[_0x120a('0x24')]>0x0){_[_0x120a('0x48')](_0x56ba99,function(_0x3bb9e9){if(_[_0x120a('0x49')]([_0x120a('0x4a'),_0x120a('0x4b')],_0x3bb9e9[_0x120a('0x4c')])&&_0x3bb9e9[_0x120a('0x4d')]){_0x2a099f[_0x3bb9e9[_0x120a('0x4d')]]=_0x3bb9e9[_0x120a('0x4e')]['toString']();}else if(_0x3bb9e9[_0x120a('0x4c')]===_0x120a('0x4f')&&_0x3bb9e9[_0x120a('0x50')]&&_0x3bb9e9['idField']){_0x4bb298[_0x3bb9e9[_0x120a('0x50')]]&&(_0x2a099f[_0x3bb9e9[_0x120a('0x4d')]]=_0x4bb298[_0x3bb9e9[_0x120a('0x50')]][_0x120a('0x51')]());}else if(_0x3bb9e9[_0x120a('0x4c')]===_0x120a('0x52')&&_0x3bb9e9[_0x120a('0x53')]&&_0x3bb9e9[_0x120a('0x53')][_0x120a('0x54')]&&_0x3bb9e9[_0x120a('0x4d')]){_0x4bb298[_0x3bb9e9['Variable'][_0x120a('0x54')]['toLowerCase']()]&&(_0x2a099f[_0x3bb9e9[_0x120a('0x4d')]]=_0x4bb298[_0x3bb9e9[_0x120a('0x53')][_0x120a('0x54')][_0x120a('0x3c')]()]['toString']());}});}return _0x2a099f;}function getConnection(_0x36f152){var _0x51de27=_0x36f152['password'][_0x120a('0x55')](_0x36f152[_0x120a('0x56')]);var _0x508f28=new jsforce[(_0x120a('0x57'))]({'oauth2':{'loginUrl':_0x36f152[_0x120a('0x58')]||'https://login.salesforce.com','clientId':_0x36f152['clientId'],'clientSecret':_0x36f152[_0x120a('0x59')]}});return _0x508f28[_0x120a('0x5a')](_0x36f152[_0x120a('0x5b')],_0x51de27)['then'](function(){logger[_0x120a('0x1d')](_0x120a('0x5c'));return _0x508f28;});}exports['queue']=function(_0x12c580,_0x1b06fa,_0x3b0aab,_0x14654f,_0x30cfdb,_0x222791){var _0x568857,_0x83ae71,_0x4d1a0d,_0x3c9720;_0x222791[_0x120a('0x5d')]=intUtil['stripTrailingSlash'](_0x222791['serverUrl']);_0x222791[_0x120a('0x58')]=intUtil['stripTrailingSlash'](_0x222791[_0x120a('0x58')]);if(_0x30cfdb&&_0x30cfdb[_0x120a('0x5e')]){logger[_0x120a('0x1d')](_0x120a('0x5f'),_0x120a('0x60'));_0x1b06fa['recordingURL']=util['format'](_0x120a('0x61'),_0x222791[_0x120a('0x5d')],_0x1b06fa['uniqueid'],md5(_0x1b06fa[_0x120a('0x62')]));}else{_0x1b06fa['recordingURL']='';}return getConnection(_0x222791)[_0x120a('0x2c')](function(_0x563ab6){_0x3c9720=_0x563ab6;return getUser(_0x222791,_0x14654f[_0x120a('0x63')],_0x3c9720);})[_0x120a('0x2c')](function(_0x1edc75){_0x568857=_0x1edc75;return getEndUser(_0x222791,_0x3b0aab,_0x1b06fa[_0x120a('0x64')],_0x1b06fa[_0x120a('0x65')],_0x3c9720);})['then'](function(_0x28a444){_0x83ae71=_0x28a444;return getTicket(_0x222791,_0x568857,_0x83ae71,_0x3b0aab,_0x1b06fa,_0x3b0aab[_0x120a('0x66')],_0x3c9720,_0x120a('0x67'));})[_0x120a('0x2c')](function(_0x44d7f8){_0x4d1a0d=_0x44d7f8;logger[_0x120a('0x1d')](_0x120a('0x68'),_0x4d1a0d['id']);logger[_0x120a('0x1d')](_0x120a('0x69'),_0x4d1a0d['id'],_0x14654f[_0x120a('0x54')],_0x222791[_0x120a('0x4c')]);switch(_0x222791[_0x120a('0x4c')]){case _0x120a('0x6a'):emit(util[_0x120a('0x42')](_0x120a('0x6b'),_0x14654f['name']),_0x120a('0x6c'),{'recordId':_0x4d1a0d['id']});break;case'newTab':emit(util['format'](_0x120a('0x6b'),_0x14654f['name']),'trigger:browser:url',{'uri':util[_0x120a('0x42')](_0x120a('0x6d'),_0x3c9720[_0x120a('0x6e')],_0x4d1a0d['id'])});break;default:logger[_0x120a('0x6f')](_0x120a('0x70'));}})[_0x120a('0x71')](function(_0x23e085){logger[_0x120a('0x6f')](_0x120a('0x5f'),_0x23e085);});};exports[_0x120a('0x72')]=function(_0x1c44fd,_0x22a60e,_0x46e49d,_0x1e8518,_0x2195be,_0x548c6c,_0x5d730e){var _0x3d8324,_0x348783,_0x3e1c21,_0xce1113;_0x548c6c[_0x120a('0x5d')]=intUtil['stripTrailingSlash'](_0x548c6c[_0x120a('0x5d')]);_0x548c6c['remoteUri']=intUtil[_0x120a('0x73')](_0x548c6c['remoteUri']);if(_0x5d730e&&_0x5d730e[_0x120a('0x74')]&&_0x5d730e[_0x120a('0x74')]!==_0x120a('0x75')){logger[_0x120a('0x1d')](_0x120a('0x76'),'Recording\x20is\x20enabled!');_0x22a60e[_0x120a('0x77')]=util[_0x120a('0x42')](_0x120a('0x61'),_0x548c6c[_0x120a('0x5d')],_0x22a60e['uniqueid'],md5(_0x22a60e[_0x120a('0x62')]));}return getConnection(_0x548c6c)[_0x120a('0x2c')](function(_0x1c8a5a){_0xce1113=_0x1c8a5a;return getUser(_0x548c6c,_0x1e8518[_0x120a('0x63')],_0xce1113);})[_0x120a('0x2c')](function(_0x238ccc){_0x3d8324=_0x238ccc;return getEndUser(_0x548c6c,_0x46e49d,_0x22a60e['destcalleridname'],_0x22a60e[_0x120a('0x78')],_0xce1113);})[_0x120a('0x2c')](function(_0x51eb69){_0x348783=_0x51eb69;return getTicket(_0x548c6c,_0x3d8324,_0x348783,_0x46e49d,_0x22a60e,_0x46e49d[_0x120a('0x66')],_0xce1113,_0x120a('0x72'));})[_0x120a('0x2c')](function(_0x159cc7){_0x3e1c21=_0x159cc7;logger['info'](_0x120a('0x79'),_0x3e1c21['id']);logger[_0x120a('0x1d')](_0x120a('0x7a'),_0x3e1c21['id'],_0x1e8518['name'],_0x548c6c['type']);switch(_0x548c6c[_0x120a('0x4c')]){case'integrationTab':emit(util[_0x120a('0x42')](_0x120a('0x6b'),_0x1e8518[_0x120a('0x54')]),_0x120a('0x6c'),{'recordId':_0x3e1c21['id']});break;case'newTab':emit(util['format'](_0x120a('0x6b'),_0x1e8518['name']),_0x120a('0x7b'),{'uri':util['format']('%s/%s/e',_0xce1113[_0x120a('0x6e')],_0x3e1c21['id'])});break;default:logger['error'](_0x120a('0x76'),_0x120a('0x7c'));}})['catch'](function(_0x792dcd){logger[_0x120a('0x6f')](_0x120a('0x76'),_0x792dcd);});};exports[_0x120a('0x7d')]=function(_0x52f600,_0x329586,_0x5ded6a,_0x4a914f,_0x173125,_0x1b1269){var _0x155021,_0x2aed3e,_0xeb1077,_0xbb0ff0;_0x1b1269[_0x120a('0x5d')]=intUtil['stripTrailingSlash'](_0x1b1269[_0x120a('0x5d')]);_0x1b1269['remoteUri']=intUtil[_0x120a('0x73')](_0x1b1269[_0x120a('0x58')]);if(_0x173125&&_0x173125[_0x120a('0x5e')]){logger[_0x120a('0x1d')]('['+_0x329586[_0x120a('0x7e')][_0x120a('0x7f')]()+']',_0x120a('0x60'));_0x329586[_0x120a('0x77')]=util[_0x120a('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b1269[_0x120a('0x5d')],_0x329586[_0x120a('0x62')],md5(_0x329586[_0x120a('0x62')]));}else{_0x329586[_0x120a('0x77')]='';}return getConnection(_0x1b1269)['then'](function(_0x140b19){_0xbb0ff0=_0x140b19;if(!_[_0x120a('0x80')](_0x4a914f)){return getUser(_0x1b1269,_0x4a914f[_0x120a('0x54')],_0xbb0ff0);}else{return getUser(_0x1b1269,null,_0xbb0ff0);}})[_0x120a('0x2c')](function(_0x4047bd){_0x155021=_0x4047bd;return getEndUser(_0x1b1269,_0x5ded6a,_0x329586[_0x120a('0x64')],_0x329586[_0x120a('0x65')],_0xbb0ff0);})[_0x120a('0x2c')](function(_0x241b6a){_0x2aed3e=_0x241b6a;return getTicket(_0x1b1269,_0x155021,_0x2aed3e,_0x5ded6a,_0x329586,_0x5ded6a[_0x120a('0x66')],_0xbb0ff0);})[_0x120a('0x2c')](function(_0x2f2058){_0xeb1077=_0x2f2058;logger[_0x120a('0x1d')]('['+_0x329586['lastevent'][_0x120a('0x7f')]()+_0x120a('0x81'),_0xeb1077['id']);logger[_0x120a('0x1d')]('['+_0x329586['lastevent'][_0x120a('0x7f')]()+']\x20Integration\x20account\x20type\x20%s.',_0x1b1269['type']);})[_0x120a('0x71')](function(_0x5d1db3){logger[_0x120a('0x6f')]('['+_0x329586['lastevent'][_0x120a('0x7f')]()+']',_0x5d1db3);});}; \ 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 b9688f8..ac34b6b 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 _0x4d65=['format','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','./util','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','then','adminId','result','sys_id','],\x20getAdminUser\x20crm','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','info','],\x20getUser\x20entity','length','active','true','userId','adminEmail','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','toLowerCase','toString','string','customField','content','variable','variableName','idField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','email','calleridnum','queue','unmanaged','outbound'];(function(_0x3235c2,_0x3054ba){var _0x38b1a9=function(_0x37c665){while(--_0x37c665){_0x3235c2['push'](_0x3235c2['shift']());}};_0x38b1a9(++_0x3054ba);}(_0x4d65,0xec));var _0x54d6=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x4d65[_0x18a79d];return _0x4f8848;};'use strict';var _=require('lodash');var Promise=require(_0x54d6('0x0'));var rp=require(_0x54d6('0x1'));var util=require(_0x54d6('0x2'));var md5=require(_0x54d6('0x3'));var Redis=require('ioredis');var intUtil=require(_0x54d6('0x4'));var config=require('../../../../config/environment');var logger=require(_0x54d6('0x5'))(_0x54d6('0x6'));config['redis']=_[_0x54d6('0x7')](config[_0x54d6('0x8')],{'host':_0x54d6('0x9'),'port':0x18eb});var io=require(_0x54d6('0xa'))(new Redis(config[_0x54d6('0x8')]));function getAdminUser(_0x33c570,_0x344d11,_0x5a1cc6,_0x1c752b,_0x33f8fa,_0x8e9891){return new Promise(function(_0x40cca0,_0xa0902b){var _0x269a46={'method':_0x54d6('0xb'),'uri':_0x1c752b+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x33f8fa+'&'+_0x8e9891,'auth':_0x344d11,'json':!![]};return rp(_0x269a46)[_0x54d6('0xc')](function(_0x3bc8c2){if(_0x3bc8c2['result']['length']>0x0){_0x5a1cc6[_0x54d6('0xd')]=_0x3bc8c2[_0x54d6('0xe')][0x0][_0x54d6('0xf')];}logger['info']('['+[_0x33c570['toUpperCase']()]+_0x54d6('0x10'),_0x5a1cc6);_0x40cca0(_0x5a1cc6);})['catch'](function(_0x2b22d6){logger[_0x54d6('0x11')]('['+[_0x33c570[_0x54d6('0x12')]()]+']',_0x2b22d6[_0x54d6('0x13')]);_0xa0902b(_0x2b22d6['message']);});});}function getUser(_0x3ec591,_0x52fe7d,_0x3a8dcb,_0x269ebd,_0x181d6a){return function(_0x1f86c0){logger['info']('['+[_0x3ec591[_0x54d6('0x12')]()]+_0x54d6('0x14'),_0x1f86c0);return new Promise(function(_0x5e240f,_0x31eb23){if(intUtil[_0x54d6('0x15')](_0x1f86c0[_0x54d6('0x16')])){var _0x188bd4={'method':_0x54d6('0xb'),'uri':_0x3a8dcb+_0x54d6('0x17')+_0x1f86c0['userEmail']+'&'+_0x269ebd+'&'+_0x181d6a,'auth':_0x52fe7d,'json':!![]};logger['info']('['+[_0x3ec591[_0x54d6('0x12')]()]+_0x54d6('0x18'),_0x188bd4);return rp(_0x188bd4)[_0x54d6('0xc')](function(_0x349f85){logger[_0x54d6('0x19')]('['+[_0x3ec591[_0x54d6('0x12')]()]+_0x54d6('0x1a'),_0x349f85);if(_0x349f85['result'][_0x54d6('0x1b')]>0x0&&String(_0x349f85[_0x54d6('0xe')][0x0][_0x54d6('0x1c')])===_0x54d6('0x1d')){_0x1f86c0[_0x54d6('0x1e')]=_0x349f85[_0x54d6('0xe')][0x0]['sys_id'];}else{_0x1f86c0[_0x54d6('0x1e')]=_0x1f86c0[_0x54d6('0xd')];_0x1f86c0[_0x54d6('0x16')]=_0x1f86c0[_0x54d6('0x1f')];}logger[_0x54d6('0x19')]('['+[_0x3ec591[_0x54d6('0x12')]()]+'],\x20getUser\x20crm',_0x1f86c0);_0x5e240f(_0x1f86c0);})[_0x54d6('0x20')](function(_0x3a1819){logger[_0x54d6('0x11')]('['+[_0x3ec591[_0x54d6('0x12')]()]+']',_0x3a1819[_0x54d6('0x13')]);_0x31eb23(_0x3a1819[_0x54d6('0x13')]);});}else{logger[_0x54d6('0x19')]('['+[_0x3ec591[_0x54d6('0x12')]()]+_0x54d6('0x21'));_0x1f86c0[_0x54d6('0x1e')]=_0x1f86c0[_0x54d6('0xd')];_0x1f86c0[_0x54d6('0x16')]=_0x1f86c0[_0x54d6('0x1f')];_0x5e240f(_0x1f86c0);}});};}function createEndUser(_0x29671f,_0x6a98f6,_0x4aca0d,_0x4100e5,_0x454ba6){logger[_0x54d6('0x19')]('['+[_0x29671f['toUpperCase']()]+_0x54d6('0x22'),_0x4aca0d);return new Promise(function(_0x5cf889,_0x52f3ea){var _0x212f0e={'method':_0x54d6('0x23'),'uri':_0x4100e5+'sys_user?'+_0x454ba6,'body':{'user_name':_0x4aca0d[_0x54d6('0x24')],'roles':_0x54d6('0x25'),'first_name':_0x4aca0d[_0x54d6('0x24')],'active':'true','date_format':'System','phone':_0x4aca0d[_0x54d6('0x24')]},'auth':_0x6a98f6,'json':!![]};return rp(_0x212f0e)[_0x54d6('0xc')](function(_0x2278d5){logger['info']('['+[_0x29671f[_0x54d6('0x12')]()]+'],\x20EndUser\x20schema',_0x2278d5['result']);_0x4aca0d[_0x54d6('0x26')]=_0x2278d5[_0x54d6('0xe')][_0x54d6('0xf')];_0x5cf889(_0x4aca0d);})[_0x54d6('0x20')](function(_0xfd1f94){logger['error']('['+[_0x29671f[_0x54d6('0x12')]()]+']',_0xfd1f94['message']);_0x52f3ea(_0xfd1f94[_0x54d6('0x13')]);});});}function getEndUser(_0x4ce600,_0x188406,_0x533685,_0x1cae7d,_0x626d34){return function(_0x273673){logger[_0x54d6('0x19')]('['+[_0x4ce600[_0x54d6('0x12')]()]+_0x54d6('0x27'),_0x273673);return new Promise(function(_0x32f01b,_0x32653d){var _0x493b27={'method':_0x54d6('0xb'),'uri':_0x533685+_0x54d6('0x28')+_0x273673[_0x54d6('0x24')]+'&'+_0x1cae7d+'&'+_0x626d34,'auth':_0x188406,'json':!![]};return rp(_0x493b27)['then'](function(_0x2e4f8f){if(_0x2e4f8f['result']['length']>0x0){_0x273673[_0x54d6('0x26')]=_0x2e4f8f[_0x54d6('0xe')][0x0]['sys_id'];logger[_0x54d6('0x19')]('['+[_0x4ce600[_0x54d6('0x12')]()]+_0x54d6('0x29'),_0x273673);_0x32f01b(_0x273673);}else{return createEndUser(_0x4ce600,_0x188406,_0x273673,_0x533685,_0x1cae7d)[_0x54d6('0xc')](function(_0x3aeac2){logger[_0x54d6('0x19')]('['+[_0x4ce600[_0x54d6('0x12')]()]+_0x54d6('0x2a'),_0x3aeac2);_0x32f01b(_0x3aeac2);});}})[_0x54d6('0x20')](function(_0xc7286d){logger[_0x54d6('0x11')]('['+[_0x4ce600[_0x54d6('0x12')]()]+']',_0xc7286d[_0x54d6('0x13')]);_0x32653d(_0xc7286d[_0x54d6('0x13')]);});});};}function getCustomFields(_0x230373,_0x44157f){var _0x19450a={};if(_0x230373[_0x54d6('0x1b')]>0x0){_[_0x54d6('0x2b')](_0x230373,function(_0x3cfcf7){if(_[_0x54d6('0x2c')](['string',_0x54d6('0x2d')],_0x3cfcf7[_0x54d6('0x2e')])&&_0x3cfcf7[_0x54d6('0x2f')]&&!_0x3cfcf7['customField']){_0x19450a[_0x3cfcf7['nameField'][_0x54d6('0x30')]()]=_0x3cfcf7['content'][_0x54d6('0x31')]();}else if(_[_0x54d6('0x2c')]([_0x54d6('0x32'),_0x54d6('0x2d')],_0x3cfcf7[_0x54d6('0x2e')])&&_0x3cfcf7['idField']&&_0x3cfcf7[_0x54d6('0x33')]){_0x19450a[_0x3cfcf7['idField'][_0x54d6('0x30')]()]=_0x3cfcf7[_0x54d6('0x34')][_0x54d6('0x31')]();}else if(_0x3cfcf7[_0x54d6('0x2e')]===_0x54d6('0x35')&&_0x3cfcf7[_0x54d6('0x36')]&&_0x3cfcf7[_0x54d6('0x37')]&&_0x3cfcf7[_0x54d6('0x33')]){_0x19450a[_0x3cfcf7[_0x54d6('0x37')][_0x54d6('0x30')]()]=_0x44157f[_0x3cfcf7[_0x54d6('0x36')]][_0x54d6('0x31')]();}else if(_0x3cfcf7['type']===_0x54d6('0x38')&&_0x3cfcf7[_0x54d6('0x39')]&&_0x3cfcf7['Variable'][_0x54d6('0x3a')]&&_0x3cfcf7[_0x54d6('0x37')]&&_0x3cfcf7[_0x54d6('0x33')]){_0x19450a[_0x3cfcf7[_0x54d6('0x37')][_0x54d6('0x30')]()]=_0x44157f[_0x3cfcf7['Variable'][_0x54d6('0x3a')]['toLowerCase']()]['toString']();}});}return _0x19450a;}function getTicket(_0x391fb7,_0x3937c7,_0x65dd24,_0x1a1395,_0xfa7951,_0x262642){return function(_0x8de3a6){logger[_0x54d6('0x19')]('['+[_0x391fb7[_0x54d6('0x12')]()]+_0x54d6('0x3b'),_0x8de3a6);return new Promise(function(_0x9a06ac,_0xe1b0b2){var _0x27ea54=_0x391fb7[_0x54d6('0x30')]()==='outbound'?_0x8de3a6['userId']:_0x8de3a6['endUserId'];var _0x2be251={'method':_0x54d6('0x23'),'uri':_0x65dd24+_0x54d6('0x3c')+'?'+_0x262642,'body':Object['assign']({},{'active':_0x54d6('0x1d'),'caller_id':_0x27ea54,'assigned_to':_0x8de3a6[_0x54d6('0x1e')],'short_description':intUtil[_0x54d6('0x3d')](_0x1a1395[_0x54d6('0x3e')],_0xfa7951,'\x20'),'description':intUtil[_0x54d6('0x3d')](_0x1a1395[_0x54d6('0x3f')],_0xfa7951,'\x0a')},getCustomFields(_0x1a1395[_0x54d6('0x40')],_0xfa7951)),'auth':_0x3937c7,'json':!![]};return rp(_0x2be251)[_0x54d6('0xc')](function(_0x33f4b5){logger[_0x54d6('0x19')]('['+[_0x391fb7[_0x54d6('0x12')]()]+_0x54d6('0x41'),_0x33f4b5[_0x54d6('0xe')]);_0x8de3a6[_0x54d6('0x42')]=_0x33f4b5[_0x54d6('0xe')][_0x54d6('0xf')];_0x8de3a6['ticketNumber']=_0x33f4b5['result'][_0x54d6('0x43')];logger['info']('['+[_0x391fb7[_0x54d6('0x12')]()]+_0x54d6('0x44'),_0x8de3a6);_0x9a06ac(_0x8de3a6);})[_0x54d6('0x20')](function(_0x4d0be0){logger[_0x54d6('0x11')]('['+[_0x391fb7[_0x54d6('0x12')]()]+']',_0x4d0be0['message']);_0xe1b0b2(_0x4d0be0[_0x54d6('0x13')]);});});};}function createRemoteTag(_0xdbeb5c,_0x5da022,_0x4a3a05,_0xc5e34b){return new Promise(function(_0x5dcbb2,_0x23b6f6){var _0x1c66cb={'method':'POST','uri':_0x4a3a05+_0x54d6('0x45')+'?'+_0xc5e34b,'body':{'short_description':_0xdbeb5c,'global':!![],'active':!![],'name':_0xdbeb5c},'auth':_0x5da022,'json':!![]};return rp(_0x1c66cb)[_0x54d6('0xc')](function(_0x4a14a6){var _0x2e41d5=_0x4a14a6[_0x54d6('0xe')]['sys_id'];_0x5dcbb2(_0x2e41d5);});});}function getRemoteTag(_0xba9cb6,_0x4c7383,_0x47e760,_0x2f88e6,_0x10cff6){return new Promise(function(_0x4d9fe0,_0x5bc6b8){var _0x38479d={'method':'GET','uri':_0x47e760+'label'+_0x54d6('0x46')+_0xba9cb6+'&'+_0x2f88e6,'auth':_0x4c7383,'json':!![]};return rp(_0x38479d)[_0x54d6('0xc')](function(_0x3af50){if(_0x3af50[_0x54d6('0xe')][_0x54d6('0x1b')]>0x0){var _0x375ad4=_0x3af50[_0x54d6('0xe')][0x0][_0x54d6('0xf')];_0x4d9fe0(_0x375ad4);}else{return createRemoteTag(_0xba9cb6,_0x4c7383,_0x47e760,_0x2f88e6)['then'](function(_0x3a4ffe){_0x4d9fe0(_0x3a4ffe);});}});});}function assignTagToIncident(_0x84926e,_0x41092d,_0x48745e,_0x1eb8c4,_0x307ac2){return new Promise(function(_0x376a11,_0x5c2869){var _0x5b35a0={'method':'POST','uri':_0x48745e+_0x54d6('0x47')+'?'+_0x307ac2,'body':{'label':_0x84926e,'table':_0x54d6('0x3c'),'id_type':_0x54d6('0x48'),'table_key':_0x1eb8c4[_0x54d6('0x42')],'title':_0x54d6('0x49')+_0x1eb8c4[_0x54d6('0x4a')],'id_display':_0x1eb8c4[_0x54d6('0x4a')]},'auth':_0x41092d,'json':!![]};return rp(_0x5b35a0)['then'](function(_0xb4e436){_0x376a11();})[_0x54d6('0x20')](function(){_0x376a11();});});}function manageTags(_0x1b96b7,_0x1ba8c6,_0x17ffb1,_0x491bdf,_0x5e7c2a,_0x4f013d,_0x59515f){return new Promise(function(_0x3706b4,_0x4815b9){var _0x420fe4=[];_0x1ba8c6[_0x54d6('0x2b')](function(_0x35bc43){_0x420fe4[_0x54d6('0x4b')](getRemoteTag(_0x35bc43,_0x17ffb1,_0x491bdf,_0x4f013d,_0x59515f));});return Promise[_0x54d6('0x4c')](_0x420fe4)['then'](function(_0x421f64){if(_0x421f64[_0x54d6('0x1b')]){logger[_0x54d6('0x19')]('['+[_0x1b96b7[_0x54d6('0x12')]()]+_0x54d6('0x4d'),_0x421f64);var _0x4019ab=[];_0x421f64[_0x54d6('0x2b')](function(_0x2e8a05){_0x4019ab[_0x54d6('0x4b')](assignTagToIncident(_0x2e8a05,_0x17ffb1,_0x491bdf,_0x5e7c2a,_0x4f013d));});return Promise[_0x54d6('0x4c')](_0x4019ab)[_0x54d6('0xc')](function(){_0x3706b4();})[_0x54d6('0x20')](function(){_0x3706b4();});}else{_0x3706b4();}});});}function getTags(_0x16956d,_0x447109,_0x5b3206,_0x2f22a2,_0x52bc88,_0x292029){return function(_0x5a2b31){return new Promise(function(_0x4a145a,_0x320ccd){var _0x2a9b31=[];var _0x6d645e=_0x2f22a2[_0x54d6('0x4e')];if(_0x6d645e&&_0x6d645e[_0x54d6('0x1b')]>0x0){_0x2a9b31=_[_0x54d6('0x4f')](_0x6d645e,_0x54d6('0x3a'));}if(_0x2a9b31[_0x54d6('0x1b')]>0x0){return manageTags(_0x16956d,_0x2a9b31,_0x447109,_0x5b3206,_0x5a2b31,_0x52bc88,_0x292029)[_0x54d6('0xc')](function(){_0x4a145a(_0x5a2b31);});}else{_0x4a145a(_0x5a2b31);}});};}function emit(_0x1a6262,_0x140dc6,_0x91b714){var _0x4838e4=_0x54d6('0x50')+_0x54d6('0x51')+_0x54d6('0x52')+_0x54d6('0x53');var _0x362e40={'uri':_0x1a6262+_0x54d6('0x54')+_0x91b714+_0x4838e4};io['to'](util['format'](_0x54d6('0x55'),_0x140dc6))[_0x54d6('0x56')](_0x54d6('0x57'),_0x362e40);}exports['cs']=function(_0x548a17,_0x4aed2c,_0x2fb322,_0x1413ce,_0x2fe010,_0x2cee23,_0x5a94eb,_0x3c9459){var _0x42eb3f={};var _0xc2b758={'user':_0x2cee23[_0x54d6('0x58')],'pass':_0x2cee23['password']};var _0x1d6203=_0x54d6('0x59');var _0x5d8eb4=_0x54d6('0x5a');_0x2cee23[_0x54d6('0x5b')]=intUtil['stripTrailingSlash'](_0x2cee23[_0x54d6('0x5b')]);_0x2cee23[_0x54d6('0x5c')]=intUtil[_0x54d6('0x5d')](_0x2cee23['serverUrl']);var _0x1c716e=util['format'](_0x54d6('0x5e'),_0x2cee23[_0x54d6('0x5b')]);_0x42eb3f['userEmail']=!_['isNil'](_0x1413ce)?_0x1413ce[_0x54d6('0x5f')]:null;_0x42eb3f[_0x54d6('0x1f')]=_0x2cee23[_0x54d6('0x5f')];_0x42eb3f[_0x54d6('0x24')]=_0x3c9459[_0x54d6('0x30')]()==='outbound'?_0x4aed2c['destcalleridnum']:_0x4aed2c[_0x54d6('0x60')];_0x42eb3f['callDirection']=_0x3c9459===_0x54d6('0x61')||_0x3c9459===_0x54d6('0x62')?_0x54d6('0x61'):_0x54d6('0x63');var _0x3ff33c=util[_0x54d6('0x64')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cee23['serverUrl'],_0x4aed2c[_0x54d6('0x65')],md5(_0x4aed2c[_0x54d6('0x65')]));if(_0x2fe010&&_0x2fe010[_0x54d6('0x66')]){logger['info']('[QUEUE]',_0x54d6('0x67'));_0x4aed2c['recordingURL']=_0x3ff33c;}else if(_0x5a94eb&&_0x5a94eb[_0x54d6('0x68')]&&_0x5a94eb[_0x54d6('0x68')]!==_0x54d6('0x69')){logger[_0x54d6('0x19')](_0x54d6('0x6a'),'Recording\x20is\x20enabled!');_0x4aed2c[_0x54d6('0x6b')]=_0x3ff33c;}else{_0x4aed2c[_0x54d6('0x6b')]='';}return getAdminUser(_0x3c9459,_0xc2b758,_0x42eb3f,_0x1c716e,_0x5d8eb4,_0x1d6203)[_0x54d6('0xc')](getUser(_0x3c9459,_0xc2b758,_0x1c716e,_0x5d8eb4,_0x1d6203))[_0x54d6('0xc')](getEndUser(_0x3c9459,_0xc2b758,_0x1c716e,_0x5d8eb4,_0x1d6203))[_0x54d6('0xc')](getTicket(_0x3c9459,_0xc2b758,_0x1c716e,_0x2fb322,_0x4aed2c,_0x5d8eb4))['then'](function(_0x1fcd8f){logger[_0x54d6('0x19')](util[_0x54d6('0x64')](_0x54d6('0x6c'),_0x1fcd8f['ticketId']));logger['info'](util[_0x54d6('0x64')](_0x54d6('0x6d'),_0x3c9459));if(_0x3c9459!==_0x54d6('0x62')){logger[_0x54d6('0x19')]('['+[_0x3c9459[_0x54d6('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2cee23[_0x54d6('0x5b')],_0x1413ce[_0x54d6('0x3a')],_0x1fcd8f[_0x54d6('0x42')]);}})[_0x54d6('0x20')](function(_0x452b0e){logger['error']('['+[_0x3c9459[_0x54d6('0x12')]()]+_0x54d6('0x6e'),util[_0x54d6('0x6f')](_0x452b0e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x92df=['result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','GET','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','idField','toLowerCase','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','label_entry','incident','ticketId','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0x92df,0xcb));var _0xf92d=function(_0x1e258c,_0x20f4e9){_0x1e258c=_0x1e258c-0x0;var _0x4694b5=_0x92df[_0x1e258c];return _0x4694b5;};'use strict';var _=require(_0xf92d('0x0'));var Promise=require(_0xf92d('0x1'));var rp=require(_0xf92d('0x2'));var util=require(_0xf92d('0x3'));var md5=require(_0xf92d('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xf92d('0x5'));var logger=require('../../../../config/logger')(_0xf92d('0x6'));config[_0xf92d('0x7')]=_[_0xf92d('0x8')](config[_0xf92d('0x7')],{'host':_0xf92d('0x9'),'port':0x18eb});var io=require(_0xf92d('0xa'))(new Redis(config[_0xf92d('0x7')]));function getAdminUser(_0x53eb3e,_0xc07161,_0x442e28,_0x7263a3,_0x2235e3,_0x5a00de){return new Promise(function(_0x26c27b,_0x24687d){var _0x257110={'method':'GET','uri':_0x7263a3+_0xf92d('0xb')+'&'+_0x2235e3+'&'+_0x5a00de,'auth':_0xc07161,'json':!![]};return rp(_0x257110)[_0xf92d('0xc')](function(_0x673c5a){if(_0x673c5a[_0xf92d('0xd')][_0xf92d('0xe')]>0x0){_0x442e28[_0xf92d('0xf')]=_0x673c5a[_0xf92d('0xd')][0x0][_0xf92d('0x10')];}logger[_0xf92d('0x11')]('['+[_0x53eb3e[_0xf92d('0x12')]()]+_0xf92d('0x13'),_0x442e28);_0x26c27b(_0x442e28);})[_0xf92d('0x14')](function(_0x108918){logger[_0xf92d('0x15')]('['+[_0x53eb3e['toUpperCase']()]+']',_0x108918[_0xf92d('0x16')]);_0x24687d(_0x108918['message']);});});}function getUser(_0x19dea8,_0x3ce1b6,_0xdd90db,_0x1e2838,_0x423592){return function(_0x27f19a){logger['info']('['+[_0x19dea8['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x27f19a);return new Promise(function(_0x45a4b0,_0x1f90f1){if(intUtil[_0xf92d('0x17')](_0x27f19a['userEmail'])){var _0x125902={'method':_0xf92d('0x18'),'uri':_0xdd90db+'sys_user?sysparm_query=email%3D'+_0x27f19a[_0xf92d('0x19')]+'&'+_0x1e2838+'&'+_0x423592,'auth':_0x3ce1b6,'json':!![]};logger[_0xf92d('0x11')]('['+[_0x19dea8[_0xf92d('0x12')]()]+_0xf92d('0x1a'),_0x125902);return rp(_0x125902)[_0xf92d('0xc')](function(_0x1732c5){logger[_0xf92d('0x11')]('['+[_0x19dea8[_0xf92d('0x12')]()]+_0xf92d('0x1b'),_0x1732c5);if(_0x1732c5['result']['length']>0x0&&String(_0x1732c5['result'][0x0][_0xf92d('0x1c')])===_0xf92d('0x1d')){_0x27f19a['userId']=_0x1732c5['result'][0x0][_0xf92d('0x10')];}else{_0x27f19a[_0xf92d('0x1e')]=_0x27f19a['adminId'];_0x27f19a[_0xf92d('0x19')]=_0x27f19a[_0xf92d('0x1f')];}logger[_0xf92d('0x11')]('['+[_0x19dea8[_0xf92d('0x12')]()]+_0xf92d('0x20'),_0x27f19a);_0x45a4b0(_0x27f19a);})[_0xf92d('0x14')](function(_0x304d62){logger['error']('['+[_0x19dea8['toUpperCase']()]+']',_0x304d62[_0xf92d('0x16')]);_0x1f90f1(_0x304d62['message']);});}else{logger[_0xf92d('0x11')]('['+[_0x19dea8[_0xf92d('0x12')]()]+_0xf92d('0x21'));_0x27f19a[_0xf92d('0x1e')]=_0x27f19a[_0xf92d('0xf')];_0x27f19a['userEmail']=_0x27f19a[_0xf92d('0x1f')];_0x45a4b0(_0x27f19a);}});};}function createEndUser(_0x312a96,_0x136c95,_0x526252,_0x3f1831,_0x32d3e4){logger[_0xf92d('0x11')]('['+[_0x312a96['toUpperCase']()]+_0xf92d('0x22'),_0x526252);return new Promise(function(_0x5b1e51,_0x359893){var _0x5460b4={'method':'POST','uri':_0x3f1831+_0xf92d('0x23')+_0x32d3e4,'body':{'user_name':_0x526252[_0xf92d('0x24')],'roles':_0xf92d('0x25'),'first_name':_0x526252[_0xf92d('0x24')],'active':_0xf92d('0x1d'),'date_format':_0xf92d('0x26'),'phone':_0x526252[_0xf92d('0x24')]},'auth':_0x136c95,'json':!![]};return rp(_0x5460b4)[_0xf92d('0xc')](function(_0xbe76a5){logger[_0xf92d('0x11')]('['+[_0x312a96['toUpperCase']()]+_0xf92d('0x27'),_0xbe76a5[_0xf92d('0xd')]);_0x526252[_0xf92d('0x28')]=_0xbe76a5[_0xf92d('0xd')][_0xf92d('0x10')];_0x5b1e51(_0x526252);})[_0xf92d('0x14')](function(_0x25af78){logger[_0xf92d('0x15')]('['+[_0x312a96[_0xf92d('0x12')]()]+']',_0x25af78[_0xf92d('0x16')]);_0x359893(_0x25af78[_0xf92d('0x16')]);});});}function getEndUser(_0x1dc917,_0x44f8bc,_0x500dff,_0xbe7df3,_0x398209){return function(_0x464a25){logger[_0xf92d('0x11')]('['+[_0x1dc917[_0xf92d('0x12')]()]+_0xf92d('0x29'),_0x464a25);return new Promise(function(_0x251200,_0x2445ea){var _0x150528={'method':_0xf92d('0x18'),'uri':_0x500dff+_0xf92d('0x2a')+_0x464a25[_0xf92d('0x24')]+'&'+_0xbe7df3+'&'+_0x398209,'auth':_0x44f8bc,'json':!![]};return rp(_0x150528)['then'](function(_0x3c95c6){if(_0x3c95c6[_0xf92d('0xd')]['length']>0x0){_0x464a25[_0xf92d('0x28')]=_0x3c95c6[_0xf92d('0xd')][0x0][_0xf92d('0x10')];logger[_0xf92d('0x11')]('['+[_0x1dc917[_0xf92d('0x12')]()]+_0xf92d('0x2b'),_0x464a25);_0x251200(_0x464a25);}else{return createEndUser(_0x1dc917,_0x44f8bc,_0x464a25,_0x500dff,_0xbe7df3)['then'](function(_0x10e46f){logger[_0xf92d('0x11')]('['+[_0x1dc917[_0xf92d('0x12')]()]+_0xf92d('0x2c'),_0x10e46f);_0x251200(_0x10e46f);});}})[_0xf92d('0x14')](function(_0x2d2717){logger['error']('['+[_0x1dc917[_0xf92d('0x12')]()]+']',_0x2d2717['message']);_0x2445ea(_0x2d2717['message']);});});};}function getCustomFields(_0x3062f6,_0x2c2f6d){var _0x1f9bd2={};if(_0x3062f6['length']>0x0){_[_0xf92d('0x2d')](_0x3062f6,function(_0xb31ac5){if(_[_0xf92d('0x2e')]([_0xf92d('0x2f'),_0xf92d('0x30')],_0xb31ac5[_0xf92d('0x31')])&&_0xb31ac5[_0xf92d('0x32')]&&!_0xb31ac5[_0xf92d('0x33')]){_0x1f9bd2[_0xb31ac5['nameField']['toLowerCase']()]=_0xb31ac5[_0xf92d('0x34')]['toString']();}else if(_[_0xf92d('0x2e')]([_0xf92d('0x2f'),_0xf92d('0x30')],_0xb31ac5[_0xf92d('0x31')])&&_0xb31ac5[_0xf92d('0x35')]&&_0xb31ac5[_0xf92d('0x33')]){_0x1f9bd2[_0xb31ac5[_0xf92d('0x35')][_0xf92d('0x36')]()]=_0xb31ac5['content'][_0xf92d('0x37')]();}else if(_0xb31ac5[_0xf92d('0x31')]==='variable'&&_0xb31ac5['variableName']&&_0xb31ac5[_0xf92d('0x35')]&&_0xb31ac5[_0xf92d('0x33')]){_0x1f9bd2[_0xb31ac5['idField'][_0xf92d('0x36')]()]=_0x2c2f6d[_0xb31ac5[_0xf92d('0x38')]][_0xf92d('0x37')]();}else if(_0xb31ac5[_0xf92d('0x31')]===_0xf92d('0x39')&&_0xb31ac5[_0xf92d('0x3a')]&&_0xb31ac5['Variable'][_0xf92d('0x3b')]&&_0xb31ac5[_0xf92d('0x35')]&&_0xb31ac5[_0xf92d('0x33')]){_0x1f9bd2[_0xb31ac5[_0xf92d('0x35')][_0xf92d('0x36')]()]=_0x2c2f6d[_0xb31ac5[_0xf92d('0x3a')][_0xf92d('0x3b')]['toLowerCase']()][_0xf92d('0x37')]();}});}return _0x1f9bd2;}function getTicket(_0x8e70ac,_0x3ae412,_0x343972,_0x40c543,_0x6ade65,_0x1bd360){return function(_0x4c8cb9){logger[_0xf92d('0x11')]('['+[_0x8e70ac[_0xf92d('0x12')]()]+_0xf92d('0x3c'),_0x4c8cb9);return new Promise(function(_0x1d800e,_0x719224){var _0x11596e=_0x8e70ac['toLowerCase']()==='outbound'?_0x4c8cb9['userId']:_0x4c8cb9['endUserId'];var _0x30b396={'method':_0xf92d('0x3d'),'uri':_0x343972+'incident'+'?'+_0x1bd360,'body':Object['assign']({},{'active':_0xf92d('0x1d'),'caller_id':_0x11596e,'assigned_to':_0x4c8cb9['userId'],'short_description':intUtil[_0xf92d('0x3e')](_0x40c543['Subjects'],_0x6ade65,'\x20'),'description':intUtil[_0xf92d('0x3e')](_0x40c543[_0xf92d('0x3f')],_0x6ade65,'\x0a')},getCustomFields(_0x40c543['Fields'],_0x6ade65)),'auth':_0x3ae412,'json':!![]};return rp(_0x30b396)['then'](function(_0xb18025){logger[_0xf92d('0x11')]('['+[_0x8e70ac[_0xf92d('0x12')]()]+_0xf92d('0x40'),_0xb18025[_0xf92d('0xd')]);_0x4c8cb9['ticketId']=_0xb18025['result']['sys_id'];_0x4c8cb9['ticketNumber']=_0xb18025['result'][_0xf92d('0x41')];logger[_0xf92d('0x11')]('['+[_0x8e70ac[_0xf92d('0x12')]()]+_0xf92d('0x42'),_0x4c8cb9);_0x1d800e(_0x4c8cb9);})[_0xf92d('0x14')](function(_0x51949b){logger['error']('['+[_0x8e70ac[_0xf92d('0x12')]()]+']',_0x51949b[_0xf92d('0x16')]);_0x719224(_0x51949b['message']);});});};}function createRemoteTag(_0x26b50b,_0xe6f714,_0x506826,_0x2e56af){return new Promise(function(_0x5b3f52,_0x20ecbd){var _0x18d3ec={'method':_0xf92d('0x3d'),'uri':_0x506826+_0xf92d('0x43')+'?'+_0x2e56af,'body':{'short_description':_0x26b50b,'global':!![],'active':!![],'name':_0x26b50b},'auth':_0xe6f714,'json':!![]};return rp(_0x18d3ec)['then'](function(_0x130ae2){var _0x352662=_0x130ae2[_0xf92d('0xd')][_0xf92d('0x10')];_0x5b3f52(_0x352662);});});}function getRemoteTag(_0x6aed1,_0x5113ad,_0x108ecc,_0x103f30,_0x3c42d1){return new Promise(function(_0x323725,_0x5f0b37){var _0x5a421b={'method':'GET','uri':_0x108ecc+_0xf92d('0x43')+'?sysparm_query=name%3D'+_0x6aed1+'&'+_0x103f30,'auth':_0x5113ad,'json':!![]};return rp(_0x5a421b)[_0xf92d('0xc')](function(_0x209997){if(_0x209997[_0xf92d('0xd')][_0xf92d('0xe')]>0x0){var _0x3260d0=_0x209997[_0xf92d('0xd')][0x0][_0xf92d('0x10')];_0x323725(_0x3260d0);}else{return createRemoteTag(_0x6aed1,_0x5113ad,_0x108ecc,_0x103f30)['then'](function(_0x18d8f0){_0x323725(_0x18d8f0);});}});});}function assignTagToIncident(_0x5d55a6,_0x2fb3c5,_0x2a8512,_0x40ccf2,_0xe9a46){return new Promise(function(_0x1b0d61,_0x3a7afd){var _0x2b7f5b={'method':'POST','uri':_0x2a8512+_0xf92d('0x44')+'?'+_0xe9a46,'body':{'label':_0x5d55a6,'table':_0xf92d('0x45'),'id_type':'Incident','table_key':_0x40ccf2[_0xf92d('0x46')],'title':_0xf92d('0x47')+_0x40ccf2[_0xf92d('0x48')],'id_display':_0x40ccf2['ticketNumber']},'auth':_0x2fb3c5,'json':!![]};return rp(_0x2b7f5b)[_0xf92d('0xc')](function(_0x10f491){_0x1b0d61();})['catch'](function(){_0x1b0d61();});});}function manageTags(_0x5b1784,_0x694832,_0x323f5c,_0x44b3f7,_0x10b446,_0x57e0e4,_0x5c0baf){return new Promise(function(_0x5ca7d4,_0x3c7997){var _0xced31e=[];_0x694832['forEach'](function(_0x3bce1a){_0xced31e['push'](getRemoteTag(_0x3bce1a,_0x323f5c,_0x44b3f7,_0x57e0e4,_0x5c0baf));});return Promise[_0xf92d('0x49')](_0xced31e)[_0xf92d('0xc')](function(_0xa622c4){if(_0xa622c4[_0xf92d('0xe')]){logger[_0xf92d('0x11')]('['+[_0x5b1784[_0xf92d('0x12')]()]+_0xf92d('0x4a'),_0xa622c4);var _0x30d322=[];_0xa622c4[_0xf92d('0x2d')](function(_0x334cac){_0x30d322['push'](assignTagToIncident(_0x334cac,_0x323f5c,_0x44b3f7,_0x10b446,_0x57e0e4));});return Promise[_0xf92d('0x49')](_0x30d322)[_0xf92d('0xc')](function(){_0x5ca7d4();})[_0xf92d('0x14')](function(){_0x5ca7d4();});}else{_0x5ca7d4();}});});}function getTags(_0x547d8c,_0x4c3570,_0x446a3e,_0x1a777e,_0x53c6b0,_0x48bf44){return function(_0x138a56){return new Promise(function(_0x5e4408,_0x294477){var _0x253ea3=[];var _0x12bffe=_0x1a777e[_0xf92d('0x4b')];if(_0x12bffe&&_0x12bffe[_0xf92d('0xe')]>0x0){_0x253ea3=_[_0xf92d('0x4c')](_0x12bffe,_0xf92d('0x3b'));}if(_0x253ea3[_0xf92d('0xe')]>0x0){return manageTags(_0x547d8c,_0x253ea3,_0x4c3570,_0x446a3e,_0x138a56,_0x53c6b0,_0x48bf44)['then'](function(){_0x5e4408(_0x138a56);});}else{_0x5e4408(_0x138a56);}});};}function emit(_0x5c97de,_0x2fdb15,_0x19b655){var _0x38d7a=_0xf92d('0x4d')+_0xf92d('0x4e')+_0xf92d('0x4f')+'%255EORDERBYDESCnumber';var _0x53559c={'uri':_0x5c97de+_0xf92d('0x50')+_0x19b655+_0x38d7a};io['to'](util['format'](_0xf92d('0x51'),_0x2fdb15))[_0xf92d('0x52')]('trigger:browser:url',_0x53559c);}exports['cs']=function(_0x521f99,_0x10e5d8,_0x1c4c02,_0x1f7d64,_0x806770,_0x240f4b,_0x5320ef,_0x3cb54d){var _0x2ef89d={};var _0x27781c={'user':_0x240f4b[_0xf92d('0x53')],'pass':_0x240f4b['password']};var _0x4597a6=_0xf92d('0x54');var _0x5451f9=_0xf92d('0x55');_0x240f4b[_0xf92d('0x56')]=intUtil[_0xf92d('0x57')](_0x240f4b[_0xf92d('0x56')]);_0x240f4b[_0xf92d('0x58')]=intUtil[_0xf92d('0x57')](_0x240f4b[_0xf92d('0x58')]);var _0x104f61=util[_0xf92d('0x59')](_0xf92d('0x5a'),_0x240f4b['remoteUri']);_0x2ef89d['userEmail']=!_[_0xf92d('0x5b')](_0x1f7d64)?_0x1f7d64[_0xf92d('0x5c')]:null;_0x2ef89d['adminEmail']=_0x240f4b['email'];_0x2ef89d[_0xf92d('0x24')]=_0x3cb54d[_0xf92d('0x36')]()==='outbound'?_0x10e5d8['destcalleridnum']:_0x10e5d8['calleridnum'];_0x2ef89d[_0xf92d('0x5d')]=_0x3cb54d==='queue'||_0x3cb54d===_0xf92d('0x5e')?_0xf92d('0x5f'):'outbound';var _0x1d4e53=util[_0xf92d('0x59')](_0xf92d('0x60'),_0x240f4b['serverUrl'],_0x10e5d8['uniqueid'],md5(_0x10e5d8['uniqueid']));if(_0x806770&&_0x806770['monitor_format']){logger[_0xf92d('0x11')](_0xf92d('0x61'),_0xf92d('0x62'));_0x10e5d8['recordingURL']=_0x1d4e53;}else if(_0x5320ef&&_0x5320ef[_0xf92d('0x63')]&&_0x5320ef[_0xf92d('0x63')]!==_0xf92d('0x64')){logger[_0xf92d('0x11')](_0xf92d('0x65'),'Recording\x20is\x20enabled!');_0x10e5d8[_0xf92d('0x66')]=_0x1d4e53;}else{_0x10e5d8[_0xf92d('0x66')]='';}return getAdminUser(_0x3cb54d,_0x27781c,_0x2ef89d,_0x104f61,_0x5451f9,_0x4597a6)[_0xf92d('0xc')](getUser(_0x3cb54d,_0x27781c,_0x104f61,_0x5451f9,_0x4597a6))['then'](getEndUser(_0x3cb54d,_0x27781c,_0x104f61,_0x5451f9,_0x4597a6))[_0xf92d('0xc')](getTicket(_0x3cb54d,_0x27781c,_0x104f61,_0x1c4c02,_0x10e5d8,_0x5451f9))[_0xf92d('0xc')](function(_0x2153ac){logger[_0xf92d('0x11')](util[_0xf92d('0x59')](_0xf92d('0x67'),_0x2153ac[_0xf92d('0x46')]));logger[_0xf92d('0x11')](util[_0xf92d('0x59')](_0xf92d('0x68'),_0x3cb54d));if(_0x3cb54d!==_0xf92d('0x5e')){logger[_0xf92d('0x11')]('['+[_0x3cb54d[_0xf92d('0x12')]()]+']',_0xf92d('0x69'));emit(_0x240f4b[_0xf92d('0x56')],_0x1f7d64[_0xf92d('0x3b')],_0x2153ac['ticketId']);}})['catch'](function(_0x18101c){logger[_0xf92d('0x15')]('['+[_0x3cb54d[_0xf92d('0x12')]()]+_0xf92d('0x6a'),util[_0xf92d('0x6b')](_0x18101c,{'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 a5f7ed4..e212731 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 _0x0b65=['get_server_info','Employees','user_name','then','entry_list','length','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','content','toString','variable','push','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','users','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','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Ticket\x20created!','contacts','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','stripTrailingSlash','toUpperCase','isNil','lastevent','lodash','request-promise','bluebird','md5','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64'];(function(_0x1fe22d,_0x135642){var _0x2dcd3e=function(_0x3786da){while(--_0x3786da){_0x1fe22d['push'](_0x1fe22d['shift']());}};_0x2dcd3e(++_0x135642);}(_0x0b65,0x1b6));var _0x50b6=function(_0x44cf59,_0x33e739){_0x44cf59=_0x44cf59-0x0;var _0xae0bda=_0x0b65[_0x44cf59];return _0xae0bda;};'use strict';var _=require(_0x50b6('0x0'));var rp=require(_0x50b6('0x1'));var BPromise=require(_0x50b6('0x2'));var md5=require(_0x50b6('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x50b6('0x4'))(_0x50b6('0x5'));config[_0x50b6('0x6')]=_[_0x50b6('0x7')](config[_0x50b6('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x50b6('0x8'))(new Redis(config[_0x50b6('0x6')]));var def={'method':_0x50b6('0x9'),'json':!![]};function emit(_0x1d2573,_0x5400b7,_0x554885){io['to'](_0x1d2573)[_0x50b6('0xa')](_0x5400b7,_0x554885);}function getTicket(_0x44e011,_0x33da75,_0x2c1ff3,_0x45fa4d,_0x118a46,_0x32a644,_0x14d47f,_0x49e228){logger[_0x50b6('0xb')](_0x50b6('0xc'));var _0x850ba7=new Date();var _0x378d16=[{'name':_0x50b6('0xd'),'value':intUtil[_0x50b6('0xe')](_0x45fa4d[_0x50b6('0xf')],_0x118a46,'\x20')},{'name':'assigned_user_id','value':_0x33da75['id']},{'name':_0x50b6('0x10'),'value':_0x33da75['id']},{'name':'description','value':intUtil[_0x50b6('0xe')](_0x45fa4d[_0x50b6('0x11')],_0x118a46,'\x0a')},{'name':_0x50b6('0x12'),'value':_0x850ba7[_0x50b6('0x13')]()[_0x50b6('0x14')](0x0,0x13)[_0x50b6('0x15')]('T','\x20')},{'name':_0x50b6('0x16'),'value':'0'},{'name':_0x50b6('0x17'),'value':'15'},{'name':_0x50b6('0x18'),'value':_0x2c1ff3['id']},{'name':_0x50b6('0x19'),'value':'Contacts'},{'name':_0x50b6('0x1a'),'value':_0x2c1ff3['name']},{'name':_0x50b6('0x1b'),'value':_0x49e228}];if(_0x32a644['length']){_[_0x50b6('0x1c')](_0x32a644,function(_0x483177){if(_0x118a46[_0x483177[_0x50b6('0x1d')]]){_0x378d16['push']({'name':_0x483177[_0x50b6('0x1e')],'value':_0x118a46[_0x483177[_0x50b6('0x1d')]]});}});}return request({'form':{'method':_0x50b6('0x1f'),'input_type':_0x50b6('0x20'),'response_type':_0x50b6('0x20'),'rest_data':JSON[_0x50b6('0x21')]({'session':_0x14d47f['id'],'module_name':'Calls','name_value_list':_0x378d16})}});}function getAuth(_0x16312a){return util[_0x50b6('0x22')](_0x50b6('0x23'),new Buffer(_0x16312a[_0x50b6('0x24')]+':X')['toString'](_0x50b6('0x25')));}function getServerInfo(_0x5f28dc){return request({'form':{'method':_0x50b6('0x26'),'input_type':_0x50b6('0x20'),'response_type':_0x50b6('0x20'),'rest_data':JSON[_0x50b6('0x21')]({'session':_0x5f28dc['id']})}});}function getUser(_0x17a3a4,_0xac8a19,_0x1e8381){if(!_['isNil'](_0xac8a19)){logger[_0x50b6('0xb')]('Getting\x20agent\x20with\x20name',_0xac8a19);return request({'form':{'method':'get_entry_list','input_type':_0x50b6('0x20'),'response_type':_0x50b6('0x20'),'rest_data':JSON[_0x50b6('0x21')]({'session':_0x1e8381['id'],'module_name':_0x50b6('0x27'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xac8a19),'order_by':'','offset':'0','select_fields':['id',_0x50b6('0xd'),_0x50b6('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x50b6('0x29')](function(_0x58b348){if(_0x58b348[_0x50b6('0x2a')][_0x50b6('0x2b')]){var _0x200668=_['find'](_0x58b348[_0x50b6('0x2a')],function(_0x58febb){return _0x58febb[_0x50b6('0x2c')][_0x50b6('0x28')][_0x50b6('0x2d')]===_0xac8a19;});if(_0x200668){logger[_0x50b6('0xb')](_0x50b6('0x2e'));return BPromise[_0x50b6('0x2f')]({'id':_0x200668[_0x50b6('0x2c')]['id'][_0x50b6('0x2d')],'name':_0x200668['name_value_list']['name']['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x50b6('0x2f')]({'id':_0x1e8381[_0x50b6('0x2c')][_0x50b6('0x30')]['value'],'name':_0x1e8381[_0x50b6('0x2c')][_0x50b6('0x28')][_0x50b6('0x2d')]});});}else{logger[_0x50b6('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x50b6('0x2f')]({'id':_0x1e8381['name_value_list'][_0x50b6('0x30')][_0x50b6('0x2d')],'name':_0x1e8381[_0x50b6('0x2c')][_0x50b6('0x28')]['value']});}}function getEndUser(_0x4e6460,_0x1accb4,_0x5d5aee,_0x71e7d2){logger[_0x50b6('0xb')](_0x50b6('0x31'),_0x5d5aee);return request({'form':{'method':_0x50b6('0x32'),'input_type':_0x50b6('0x20'),'response_type':'JSON','rest_data':JSON[_0x50b6('0x21')]({'session':_0x71e7d2['id'],'module_name':_0x50b6('0x33'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x5d5aee),'order_by':'','offset':'0','select_fields':['id','name',_0x50b6('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x50b6('0x29')](function(_0xea9848){if(_0xea9848['entry_list'][_0x50b6('0x2b')]){var _0x3711cf=_['find'](_0xea9848[_0x50b6('0x2a')],function(_0x4bc5f4){return _0x4bc5f4[_0x50b6('0x2c')][_0x50b6('0x34')]['value']===_0x5d5aee;});if(_0x3711cf){logger['info']('Enduser\x20found!');return BPromise[_0x50b6('0x2f')]({'id':_0x3711cf[_0x50b6('0x2c')]['id'][_0x50b6('0x2d')],'name':_0x3711cf['name_value_list'][_0x50b6('0xd')]['value'],'phone':_0x3711cf[_0x50b6('0x2c')][_0x50b6('0x34')]['value']});}}else{logger['info'](_0x50b6('0x35'));return request({'form':{'method':_0x50b6('0x1f'),'input_type':'JSON','response_type':_0x50b6('0x20'),'rest_data':JSON['stringify']({'session':_0x71e7d2['id'],'module_name':_0x50b6('0x33'),'name_value_list':[{'name':_0x50b6('0x36'),'value':_0x1accb4!==_0x50b6('0x37')?_0x1accb4:util[_0x50b6('0x22')](_0x50b6('0x38'),_0x5d5aee)},{'name':_0x50b6('0x34'),'value':_0x5d5aee}]})}})[_0x50b6('0x29')](function(_0x1b4aae){logger[_0x50b6('0xb')](_0x50b6('0x39'));return BPromise[_0x50b6('0x2f')]({'id':_0x1b4aae['id'],'name':_0x1b4aae['entry_list'][_0x50b6('0x36')][_0x50b6('0x2d')],'phone':_0x1b4aae[_0x50b6('0x2a')][_0x50b6('0x34')][_0x50b6('0x2d')]});});}});}function request(_0x3db720){logger[_0x50b6('0x3a')]('[HTTP]',JSON['stringify'](_0x3db720));return rp(_[_0x50b6('0x3b')](def,_0x3db720));}function getTags(_0x535f59,_0x2001db){var _0x3f946e=[];if(_0x535f59&&_0x535f59[_0x50b6('0x2b')]>0x0){_0x3f946e=_[_0x50b6('0x3c')](_0x535f59,_0x2001db);}return _0x3f946e;}function getCustomFields(_0x21d3e8,_0x10186a){var _0x1c31b1=[];var _0x4f1d48={'custom_fields':[]};if(_0x21d3e8[_0x50b6('0x2b')]>0x0){_[_0x50b6('0x1c')](_0x21d3e8,function(_0xc502ff){if(_0xc502ff[_0x50b6('0x3d')]===_0x50b6('0x3e')&&_0xc502ff[_0x50b6('0x3f')]&&!_0xc502ff[_0x50b6('0x40')]){_0x4f1d48[_0xc502ff[_0x50b6('0x3f')][_0x50b6('0x41')]()]=_0xc502ff['content']['toString']();}else if(_0xc502ff['type']==='string'&&_0xc502ff[_0x50b6('0x1e')]&&_0xc502ff[_0x50b6('0x40')]){_0x4f1d48[_0x50b6('0x42')]['push']({'id':_0xc502ff[_0x50b6('0x1e')],'value':_0xc502ff[_0x50b6('0x43')][_0x50b6('0x44')]()});}else if(_0xc502ff[_0x50b6('0x3d')]===_0x50b6('0x45')&&_0xc502ff[_0x50b6('0x1d')]&&_0xc502ff['idField']&&_0xc502ff[_0x50b6('0x40')]){_0x10186a[_0xc502ff[_0x50b6('0x1d')]]&&_0x4f1d48[_0x50b6('0x42')][_0x50b6('0x46')]({'id':_0xc502ff[_0x50b6('0x1e')],'value':_0x10186a[_0xc502ff[_0x50b6('0x1d')]][_0x50b6('0x44')]()});}else if(_0xc502ff['type']==='customVariable'&&_0xc502ff[_0x50b6('0x47')]&&_0xc502ff[_0x50b6('0x47')]['name']&&_0xc502ff[_0x50b6('0x1e')]&&_0xc502ff[_0x50b6('0x40')]){_0x10186a[_0xc502ff[_0x50b6('0x47')][_0x50b6('0xd')]['toLowerCase']()]&&_0x4f1d48[_0x50b6('0x42')][_0x50b6('0x46')]({'id':_0xc502ff['idField'],'value':_0x10186a[_0xc502ff[_0x50b6('0x47')][_0x50b6('0xd')][_0x50b6('0x41')]()][_0x50b6('0x44')]()});}});}return _0x4f1d48;}function getConnection(_0x590ceb){return request({'method':_0x50b6('0x9'),'form':{'method':_0x50b6('0x48'),'input_type':_0x50b6('0x20'),'response_type':_0x50b6('0x20'),'rest_data':JSON[_0x50b6('0x21')]({'user_auth':{'user_name':_0x590ceb[_0x50b6('0x49')],'password':_0x590ceb[_0x50b6('0x4a')],'encryption':'PLAIN'},'application':_0x50b6('0x4b')})}})[_0x50b6('0x29')](function(_0x1c3dae){var _0x4d51d2=_0x1c3dae;if(_0x4d51d2['id']){def[_0x50b6('0x4c')]=_0x4d51d2['id'];return BPromise[_0x50b6('0x2f')](_0x4d51d2);}else{throw new Error(util[_0x50b6('0x22')](_0x50b6('0x4d'),_0x590ceb['id']));}});}function setRelationship(_0x3ef7e6,_0x3931fc,_0x59cc75,_0x36a184){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x50b6('0x21')]({'session':_0x3ef7e6['id'],'module_name':_0x50b6('0x4e'),'module_id':_0x59cc75['id'],'link_field_name':_0x36a184,'related_ids':[_0x3931fc['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x50b6('0x4f')]=function(_0x25f884,_0x5415ee,_0x32ed74,_0x7483f8,_0x356dce,_0x4fe3b6){var _0x3cfa5e,_0x5c6792,_0x449fac,_0x5bcf28;_0x4fe3b6[_0x50b6('0x50')]=intUtil['stripTrailingSlash'](_0x4fe3b6[_0x50b6('0x50')]);_0x4fe3b6['serverUrl']=intUtil['stripTrailingSlash'](_0x4fe3b6[_0x50b6('0x51')]);def[_0x50b6('0x52')]=util[_0x50b6('0x22')](_0x50b6('0x53'),_0x4fe3b6[_0x50b6('0x50')]);if(_0x356dce&&_0x356dce[_0x50b6('0x54')]){logger[_0x50b6('0xb')](_0x50b6('0x55'),_0x50b6('0x56'));_0x5415ee[_0x50b6('0x57')]=util[_0x50b6('0x22')](_0x50b6('0x58'),_0x4fe3b6[_0x50b6('0x51')],_0x5415ee[_0x50b6('0x59')],md5(_0x5415ee[_0x50b6('0x59')]));}else{_0x5415ee[_0x50b6('0x57')]='';}return getConnection(_0x4fe3b6)[_0x50b6('0x29')](function(_0x27d0f6){_0x5bcf28=_0x27d0f6;return getUser(_0x4fe3b6,_0x7483f8[_0x50b6('0xd')],_0x5bcf28);})[_0x50b6('0x29')](function(_0x2f7995){_0x3cfa5e=_0x2f7995;logger['info'](_0x50b6('0x5a'),_0x3cfa5e['id']);return getEndUser(_0x4fe3b6,_0x5415ee[_0x50b6('0x5b')],_0x5415ee[_0x50b6('0x5c')],_0x5bcf28);})[_0x50b6('0x29')](function(_0x2438bf){_0x5c6792=_0x2438bf;logger['info'](_0x50b6('0x5d'),_0x5c6792['id']);return getTicket(_0x4fe3b6,_0x3cfa5e,_0x5c6792,_0x32ed74,_0x5415ee,_0x32ed74['Fields'],_0x5bcf28,_0x50b6('0x5e'));})[_0x50b6('0x29')](function(_0x295397){_0x449fac=_0x295397;logger[_0x50b6('0xb')]('Ticket\x20created!');logger[_0x50b6('0xb')](_0x50b6('0x5f'),_0x449fac['id']);return setRelationship(_0x5bcf28,_0x3cfa5e,_0x449fac,_0x50b6('0x60'));})[_0x50b6('0x29')](function(){return setRelationship(_0x5bcf28,_0x5c6792,_0x449fac,'contacts');})['then'](function(){return getServerInfo(_0x5bcf28);})[_0x50b6('0x29')](function(_0x2b6b73){var _0x22b980=parseInt(_0x2b6b73['version'][_0x50b6('0x61')](0x0));var _0x2c46c9=util[_0x50b6('0x22')](_0x50b6('0x62'),_0x4fe3b6[_0x50b6('0x50')],_0x449fac['id']);if(_0x22b980>0x6){_0x2c46c9=util[_0x50b6('0x22')](_0x50b6('0x63'),_0x4fe3b6[_0x50b6('0x50')],_0x449fac['id']);}logger[_0x50b6('0xb')](_0x50b6('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x50b6('0x22')](_0x50b6('0x64'),_0x7483f8['name']),'trigger:browser:url',{'uri':_0x2c46c9});})[_0x50b6('0x65')](function(_0x1d8b6b){logger[_0x50b6('0x66')](_0x50b6('0x55'),JSON[_0x50b6('0x21')](_0x1d8b6b));});};exports[_0x50b6('0x67')]=function(_0x340cc1,_0x161291,_0x4385cd,_0x276958,_0x494404,_0x221981,_0x5557ed){var _0x26b99e,_0x1a74ef,_0x12ca91,_0x43737c;_0x221981[_0x50b6('0x50')]=intUtil['stripTrailingSlash'](_0x221981[_0x50b6('0x50')]);_0x221981[_0x50b6('0x51')]=intUtil['stripTrailingSlash'](_0x221981[_0x50b6('0x51')]);def[_0x50b6('0x52')]=util['format'](_0x50b6('0x53'),_0x221981[_0x50b6('0x50')]);if(_0x5557ed&&_0x5557ed['recordingFormat']&&_0x5557ed[_0x50b6('0x68')]!==_0x50b6('0x69')){logger[_0x50b6('0xb')](_0x50b6('0x6a'),_0x50b6('0x56'));_0x161291[_0x50b6('0x57')]=util[_0x50b6('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x221981['serverUrl'],_0x161291[_0x50b6('0x59')],md5(_0x161291[_0x50b6('0x59')]));}return getConnection(_0x221981)[_0x50b6('0x29')](function(_0x327e06){_0x43737c=_0x327e06;return getUser(_0x221981,_0x276958['name'],_0x43737c);})[_0x50b6('0x29')](function(_0x19b18d){_0x26b99e=_0x19b18d;logger[_0x50b6('0xb')]('The\x20User\x20ID\x20is:',_0x26b99e['id']);return getEndUser(_0x221981,_0x161291[_0x50b6('0x6b')],_0x161291[_0x50b6('0x6c')],_0x43737c);})[_0x50b6('0x29')](function(_0x25c572){_0x1a74ef=_0x25c572;logger[_0x50b6('0xb')](_0x50b6('0x5d'),_0x1a74ef['id']);return getTicket(_0x221981,_0x26b99e,_0x1a74ef,_0x4385cd,_0x161291,_0x4385cd[_0x50b6('0x6d')],_0x43737c,'Outbound');})[_0x50b6('0x29')](function(_0x4260da){_0x12ca91=_0x4260da;logger[_0x50b6('0xb')](_0x50b6('0x6e'));logger[_0x50b6('0xb')](_0x50b6('0x5f'),_0x12ca91['id']);return setRelationship(_0x43737c,_0x26b99e,_0x12ca91,'users');})['then'](function(){return setRelationship(_0x43737c,_0x1a74ef,_0x12ca91,_0x50b6('0x6f'));})['then'](function(){return getServerInfo(_0x43737c);})[_0x50b6('0x29')](function(_0x1fe92c){var _0x38790c=parseInt(_0x1fe92c[_0x50b6('0x70')][_0x50b6('0x61')](0x0));var _0x56266b=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x221981[_0x50b6('0x50')],_0x12ca91['id']);if(_0x38790c>0x6){_0x56266b=util[_0x50b6('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x221981[_0x50b6('0x50')],_0x12ca91['id']);}logger[_0x50b6('0xb')](_0x50b6('0x6a'),_0x50b6('0x71'));emit(util[_0x50b6('0x22')](_0x50b6('0x64'),_0x276958['name']),'trigger:browser:url',{'uri':_0x56266b});})[_0x50b6('0x65')](function(_0x4656c6){logger[_0x50b6('0x66')](_0x50b6('0x6a'),JSON[_0x50b6('0x21')](_0x4656c6));});};exports[_0x50b6('0x72')]=function(_0x1d3ba8,_0x3a99f8,_0x479028,_0x3028bc,_0x390d86,_0x13b69b){var _0x543260,_0x188647,_0x3dceef,_0x54bc36;_0x13b69b[_0x50b6('0x50')]=intUtil['stripTrailingSlash'](_0x13b69b[_0x50b6('0x50')]);_0x13b69b[_0x50b6('0x51')]=intUtil[_0x50b6('0x73')](_0x13b69b[_0x50b6('0x51')]);def[_0x50b6('0x52')]=util[_0x50b6('0x22')](_0x50b6('0x53'),_0x13b69b[_0x50b6('0x50')]);if(_0x390d86&&_0x390d86[_0x50b6('0x54')]){logger[_0x50b6('0xb')]('['+_0x3a99f8['lastevent'][_0x50b6('0x74')]()+']',_0x50b6('0x56'));_0x3a99f8[_0x50b6('0x57')]=util[_0x50b6('0x22')](_0x50b6('0x58'),_0x13b69b[_0x50b6('0x51')],_0x3a99f8[_0x50b6('0x59')],md5(_0x3a99f8['uniqueid']));}else{_0x3a99f8[_0x50b6('0x57')]='';}return getConnection(_0x13b69b)[_0x50b6('0x29')](function(_0x37c623){_0x54bc36=_0x37c623;if(!_[_0x50b6('0x75')](_0x3028bc)){return getUser(_0x13b69b,_0x3028bc[_0x50b6('0xd')],_0x54bc36);}else{return getUser(_0x13b69b,null,_0x54bc36);}})[_0x50b6('0x29')](function(_0x19b399){_0x543260=_0x19b399;logger[_0x50b6('0xb')](_0x50b6('0x5a'),_0x543260['id']);return getEndUser(_0x13b69b,_0x3a99f8['calleridname'],_0x3a99f8[_0x50b6('0x5c')],_0x54bc36);})['then'](function(_0x2938a4){_0x188647=_0x2938a4;logger[_0x50b6('0xb')]('The\x20Enduser\x20ID\x20is:',_0x188647['id']);return getTicket(_0x13b69b,_0x543260,_0x188647,_0x479028,_0x3a99f8,_0x479028['Fields'],_0x54bc36,_0x50b6('0x5e'));})[_0x50b6('0x29')](function(_0x161ecb){_0x3dceef=_0x161ecb;logger[_0x50b6('0xb')](_0x50b6('0x6e'));logger[_0x50b6('0xb')](_0x50b6('0x5f'),_0x3dceef['id']);return setRelationship(_0x54bc36,_0x543260,_0x3dceef,_0x50b6('0x60'));})[_0x50b6('0x29')](function(){return setRelationship(_0x54bc36,_0x188647,_0x3dceef,_0x50b6('0x6f'));})[_0x50b6('0x29')](function(){return getServerInfo(_0x54bc36);})[_0x50b6('0x65')](function(_0x5a1e7a){logger[_0x50b6('0x66')]('['+_0x3a99f8[_0x50b6('0x76')]['toUpperCase']()+']',JSON[_0x50b6('0x21')](_0x5a1e7a));});}; \ No newline at end of file +var _0x40b5=['date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','find','entry_list','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','nameField','customField','toLowerCase','content','string','custom_fields','customVariable','Variable','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','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...','trigger:browser:url','error','outbound','uri','recordingFormat','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','version','[OUTBOUND]','user:%s','monitor_format','lastevent','toUpperCase','catch','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions'];(function(_0x117a5d,_0x129258){var _0x3549ee=function(_0x561e24){while(--_0x561e24){_0x117a5d['push'](_0x117a5d['shift']());}};_0x3549ee(++_0x129258);}(_0x40b5,0xed));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x540b('0x0'));var md5=require(_0x540b('0x1'));var util=require(_0x540b('0x2'));var Redis=require(_0x540b('0x3'));var intUtil=require(_0x540b('0x4'));var config=require(_0x540b('0x5'));var logger=require(_0x540b('0x6'))(_0x540b('0x7'));config[_0x540b('0x8')]=_[_0x540b('0x9')](config[_0x540b('0x8')],{'host':_0x540b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x540b('0xb'),'json':!![]};function emit(_0x42f9a0,_0x9be60f,_0x14bc57){io['to'](_0x42f9a0)['emit'](_0x9be60f,_0x14bc57);}function getTicket(_0x2dbd80,_0x28fba0,_0x3247a8,_0x547d35,_0x58ae71,_0x412d4e,_0x3dc261,_0x45a1fa){logger[_0x540b('0xc')](_0x540b('0xd'));var _0x4f3728=new Date();var _0x9f1394=[{'name':_0x540b('0xe'),'value':intUtil['getString'](_0x547d35[_0x540b('0xf')],_0x58ae71,'\x20')},{'name':_0x540b('0x10'),'value':_0x28fba0['id']},{'name':_0x540b('0x11'),'value':_0x28fba0['id']},{'name':_0x540b('0x12'),'value':intUtil[_0x540b('0x13')](_0x547d35[_0x540b('0x14')],_0x58ae71,'\x0a')},{'name':_0x540b('0x15'),'value':_0x4f3728[_0x540b('0x16')]()[_0x540b('0x17')](0x0,0x13)[_0x540b('0x18')]('T','\x20')},{'name':_0x540b('0x19'),'value':'0'},{'name':_0x540b('0x1a'),'value':'15'},{'name':_0x540b('0x1b'),'value':_0x3247a8['id']},{'name':_0x540b('0x1c'),'value':_0x540b('0x1d')},{'name':_0x540b('0x1e'),'value':_0x3247a8['name']},{'name':_0x540b('0x1f'),'value':_0x45a1fa}];if(_0x412d4e[_0x540b('0x20')]){_['forEach'](_0x412d4e,function(_0x11887a){if(_0x58ae71[_0x11887a[_0x540b('0x21')]]){_0x9f1394[_0x540b('0x22')]({'name':_0x11887a[_0x540b('0x23')],'value':_0x58ae71[_0x11887a[_0x540b('0x21')]]});}});}return request({'form':{'method':_0x540b('0x24'),'input_type':'JSON','response_type':_0x540b('0x25'),'rest_data':JSON[_0x540b('0x26')]({'session':_0x3dc261['id'],'module_name':_0x540b('0x27'),'name_value_list':_0x9f1394})}});}function getAuth(_0x5c1ae4){return util[_0x540b('0x28')](_0x540b('0x29'),new Buffer(_0x5c1ae4[_0x540b('0x2a')]+':X')[_0x540b('0x2b')](_0x540b('0x2c')));}function getServerInfo(_0xf3b0){return request({'form':{'method':_0x540b('0x2d'),'input_type':_0x540b('0x25'),'response_type':_0x540b('0x25'),'rest_data':JSON[_0x540b('0x26')]({'session':_0xf3b0['id']})}});}function getUser(_0x558b5e,_0x21d5c2,_0x3c3887){if(!_[_0x540b('0x2e')](_0x21d5c2)){logger[_0x540b('0xc')](_0x540b('0x2f'),_0x21d5c2);return request({'form':{'method':_0x540b('0x30'),'input_type':'JSON','response_type':_0x540b('0x25'),'rest_data':JSON['stringify']({'session':_0x3c3887['id'],'module_name':_0x540b('0x31'),'query':util[_0x540b('0x28')](_0x540b('0x32'),_0x21d5c2),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x540b('0x33')](function(_0x385154){if(_0x385154['entry_list']['length']){var _0x1bb479=_[_0x540b('0x34')](_0x385154[_0x540b('0x35')],function(_0x13fcb5){return _0x13fcb5[_0x540b('0x36')][_0x540b('0x37')][_0x540b('0x38')]===_0x21d5c2;});if(_0x1bb479){logger[_0x540b('0xc')](_0x540b('0x39'));return BPromise['resolve']({'id':_0x1bb479[_0x540b('0x36')]['id']['value'],'name':_0x1bb479[_0x540b('0x36')]['name'][_0x540b('0x38')]});}}logger[_0x540b('0xc')](_0x540b('0x3a'));return BPromise[_0x540b('0x3b')]({'id':_0x3c3887[_0x540b('0x36')][_0x540b('0x3c')][_0x540b('0x38')],'name':_0x3c3887[_0x540b('0x36')][_0x540b('0x37')][_0x540b('0x38')]});});}else{logger[_0x540b('0xc')](_0x540b('0x3d'));return BPromise['resolve']({'id':_0x3c3887[_0x540b('0x36')][_0x540b('0x3c')][_0x540b('0x38')],'name':_0x3c3887[_0x540b('0x36')]['user_name']['value']});}}function getEndUser(_0x17e1ef,_0x2f7409,_0x253e45,_0x4b8cf1){logger[_0x540b('0xc')](_0x540b('0x3e'),_0x253e45);return request({'form':{'method':_0x540b('0x30'),'input_type':_0x540b('0x25'),'response_type':_0x540b('0x25'),'rest_data':JSON['stringify']({'session':_0x4b8cf1['id'],'module_name':_0x540b('0x1d'),'query':util['format'](_0x540b('0x3f'),_0x253e45),'order_by':'','offset':'0','select_fields':['id',_0x540b('0xe'),_0x540b('0x40')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xef54b){if(_0xef54b['entry_list'][_0x540b('0x20')]){var _0x54d8ed=_[_0x540b('0x34')](_0xef54b[_0x540b('0x35')],function(_0x425e62){return _0x425e62[_0x540b('0x36')][_0x540b('0x40')]['value']===_0x253e45;});if(_0x54d8ed){logger[_0x540b('0xc')](_0x540b('0x41'));return BPromise[_0x540b('0x3b')]({'id':_0x54d8ed[_0x540b('0x36')]['id'][_0x540b('0x38')],'name':_0x54d8ed[_0x540b('0x36')][_0x540b('0xe')]['value'],'phone':_0x54d8ed[_0x540b('0x36')]['phone_home'][_0x540b('0x38')]});}}else{logger[_0x540b('0xc')](_0x540b('0x42'));return request({'form':{'method':_0x540b('0x24'),'input_type':_0x540b('0x25'),'response_type':_0x540b('0x25'),'rest_data':JSON[_0x540b('0x26')]({'session':_0x4b8cf1['id'],'module_name':_0x540b('0x1d'),'name_value_list':[{'name':_0x540b('0x43'),'value':_0x2f7409!==_0x540b('0x44')?_0x2f7409:util[_0x540b('0x28')](_0x540b('0x45'),_0x253e45)},{'name':'phone_home','value':_0x253e45}]})}})[_0x540b('0x33')](function(_0x32d18a){logger[_0x540b('0xc')](_0x540b('0x46'));return BPromise[_0x540b('0x3b')]({'id':_0x32d18a['id'],'name':_0x32d18a[_0x540b('0x35')]['first_name']['value'],'phone':_0x32d18a[_0x540b('0x35')][_0x540b('0x40')][_0x540b('0x38')]});});}});}function request(_0x2567b5){logger[_0x540b('0x47')](_0x540b('0x48'),JSON[_0x540b('0x26')](_0x2567b5));return rp(_[_0x540b('0x49')](def,_0x2567b5));}function getTags(_0x87ec50,_0x4a2030){var _0x259d3a=[];if(_0x87ec50&&_0x87ec50[_0x540b('0x20')]>0x0){_0x259d3a=_[_0x540b('0x4a')](_0x87ec50,_0x4a2030);}return _0x259d3a;}function getCustomFields(_0x5a3d69,_0x2f7771){var _0x348d1e=[];var _0x3135a0={'custom_fields':[]};if(_0x5a3d69[_0x540b('0x20')]>0x0){_[_0x540b('0x4b')](_0x5a3d69,function(_0x468a75){if(_0x468a75[_0x540b('0x4c')]==='string'&&_0x468a75[_0x540b('0x4d')]&&!_0x468a75[_0x540b('0x4e')]){_0x3135a0[_0x468a75[_0x540b('0x4d')][_0x540b('0x4f')]()]=_0x468a75[_0x540b('0x50')]['toString']();}else if(_0x468a75[_0x540b('0x4c')]===_0x540b('0x51')&&_0x468a75[_0x540b('0x23')]&&_0x468a75['customField']){_0x3135a0[_0x540b('0x52')][_0x540b('0x22')]({'id':_0x468a75[_0x540b('0x23')],'value':_0x468a75[_0x540b('0x50')][_0x540b('0x2b')]()});}else if(_0x468a75[_0x540b('0x4c')]==='variable'&&_0x468a75['variableName']&&_0x468a75['idField']&&_0x468a75[_0x540b('0x4e')]){_0x2f7771[_0x468a75[_0x540b('0x21')]]&&_0x3135a0[_0x540b('0x52')]['push']({'id':_0x468a75[_0x540b('0x23')],'value':_0x2f7771[_0x468a75[_0x540b('0x21')]][_0x540b('0x2b')]()});}else if(_0x468a75[_0x540b('0x4c')]===_0x540b('0x53')&&_0x468a75['Variable']&&_0x468a75[_0x540b('0x54')][_0x540b('0xe')]&&_0x468a75[_0x540b('0x23')]&&_0x468a75[_0x540b('0x4e')]){_0x2f7771[_0x468a75[_0x540b('0x54')][_0x540b('0xe')][_0x540b('0x4f')]()]&&_0x3135a0[_0x540b('0x52')][_0x540b('0x22')]({'id':_0x468a75[_0x540b('0x23')],'value':_0x2f7771[_0x468a75['Variable'][_0x540b('0xe')]['toLowerCase']()]['toString']()});}});}return _0x3135a0;}function getConnection(_0x2e6989){return request({'method':_0x540b('0xb'),'form':{'method':'login','input_type':_0x540b('0x25'),'response_type':_0x540b('0x25'),'rest_data':JSON[_0x540b('0x26')]({'user_auth':{'user_name':_0x2e6989['username'],'password':_0x2e6989[_0x540b('0x55')],'encryption':_0x540b('0x56')},'application':_0x540b('0x57')})}})['then'](function(_0x53bfd7){var _0x3b9180=_0x53bfd7;if(_0x3b9180['id']){def[_0x540b('0x58')]=_0x3b9180['id'];return BPromise[_0x540b('0x3b')](_0x3b9180);}else{throw new Error(util[_0x540b('0x28')](_0x540b('0x59'),_0x2e6989['id']));}});}function setRelationship(_0x2bc8f0,_0x4e6c46,_0x5b06af,_0x4d9120){return request({'form':{'method':_0x540b('0x5a'),'input_type':_0x540b('0x25'),'response_type':_0x540b('0x25'),'rest_data':JSON['stringify']({'session':_0x2bc8f0['id'],'module_name':_0x540b('0x27'),'module_id':_0x5b06af['id'],'link_field_name':_0x4d9120,'related_ids':[_0x4e6c46['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x540b('0x5b')]=function(_0x5913f1,_0x49c986,_0x331286,_0x5cf66e,_0xf4b1ef,_0x11ef59){var _0x21daa4,_0x439174,_0x1d4211,_0x1d8996;_0x11ef59[_0x540b('0x5c')]=intUtil['stripTrailingSlash'](_0x11ef59[_0x540b('0x5c')]);_0x11ef59[_0x540b('0x5d')]=intUtil[_0x540b('0x5e')](_0x11ef59[_0x540b('0x5d')]);def['uri']=util[_0x540b('0x28')](_0x540b('0x5f'),_0x11ef59['remoteUri']);if(_0xf4b1ef&&_0xf4b1ef['monitor_format']){logger[_0x540b('0xc')](_0x540b('0x60'),_0x540b('0x61'));_0x49c986[_0x540b('0x62')]=util[_0x540b('0x28')](_0x540b('0x63'),_0x11ef59['serverUrl'],_0x49c986[_0x540b('0x64')],md5(_0x49c986['uniqueid']));}else{_0x49c986['recordingURL']='';}return getConnection(_0x11ef59)[_0x540b('0x33')](function(_0x480f62){_0x1d8996=_0x480f62;return getUser(_0x11ef59,_0x5cf66e[_0x540b('0xe')],_0x1d8996);})[_0x540b('0x33')](function(_0x3e7050){_0x21daa4=_0x3e7050;logger['info'](_0x540b('0x65'),_0x21daa4['id']);return getEndUser(_0x11ef59,_0x49c986[_0x540b('0x66')],_0x49c986['calleridnum'],_0x1d8996);})[_0x540b('0x33')](function(_0xc13174){_0x439174=_0xc13174;logger[_0x540b('0xc')](_0x540b('0x67'),_0x439174['id']);return getTicket(_0x11ef59,_0x21daa4,_0x439174,_0x331286,_0x49c986,_0x331286[_0x540b('0x68')],_0x1d8996,_0x540b('0x69'));})[_0x540b('0x33')](function(_0xfa58e0){_0x1d4211=_0xfa58e0;logger[_0x540b('0xc')]('Ticket\x20created!');logger[_0x540b('0xc')](_0x540b('0x6a'),_0x1d4211['id']);return setRelationship(_0x1d8996,_0x21daa4,_0x1d4211,_0x540b('0x6b'));})[_0x540b('0x33')](function(){return setRelationship(_0x1d8996,_0x439174,_0x1d4211,_0x540b('0x6c'));})['then'](function(){return getServerInfo(_0x1d8996);})[_0x540b('0x33')](function(_0x3ead9b){var _0x31f610=parseInt(_0x3ead9b['version'][_0x540b('0x6d')](0x0));var _0x32c7d9=util[_0x540b('0x28')](_0x540b('0x6e'),_0x11ef59[_0x540b('0x5c')],_0x1d4211['id']);if(_0x31f610>0x6){_0x32c7d9=util[_0x540b('0x28')](_0x540b('0x6f'),_0x11ef59['remoteUri'],_0x1d4211['id']);}logger['info']('[QUEUE]',_0x540b('0x70'));emit(util['format']('user:%s',_0x5cf66e[_0x540b('0xe')]),_0x540b('0x71'),{'uri':_0x32c7d9});})['catch'](function(_0x4c603d){logger[_0x540b('0x72')]('[QUEUE]',JSON['stringify'](_0x4c603d));});};exports[_0x540b('0x73')]=function(_0x13171d,_0x580106,_0x5c04c8,_0x2e1a22,_0x44b89a,_0x3c0112,_0x1d3c2d){var _0x2a295f,_0xce527a,_0x6c8886,_0x270739;_0x3c0112[_0x540b('0x5c')]=intUtil['stripTrailingSlash'](_0x3c0112[_0x540b('0x5c')]);_0x3c0112[_0x540b('0x5d')]=intUtil[_0x540b('0x5e')](_0x3c0112[_0x540b('0x5d')]);def[_0x540b('0x74')]=util[_0x540b('0x28')](_0x540b('0x5f'),_0x3c0112[_0x540b('0x5c')]);if(_0x1d3c2d&&_0x1d3c2d[_0x540b('0x75')]&&_0x1d3c2d['recordingFormat']!=='none'){logger['info']('[OUTBOUND]',_0x540b('0x61'));_0x580106['recordingURL']=util[_0x540b('0x28')](_0x540b('0x63'),_0x3c0112['serverUrl'],_0x580106[_0x540b('0x64')],md5(_0x580106[_0x540b('0x64')]));}return getConnection(_0x3c0112)[_0x540b('0x33')](function(_0x5224e3){_0x270739=_0x5224e3;return getUser(_0x3c0112,_0x2e1a22[_0x540b('0xe')],_0x270739);})[_0x540b('0x33')](function(_0xcd5a5f){_0x2a295f=_0xcd5a5f;logger[_0x540b('0xc')](_0x540b('0x65'),_0x2a295f['id']);return getEndUser(_0x3c0112,_0x580106[_0x540b('0x76')],_0x580106[_0x540b('0x77')],_0x270739);})[_0x540b('0x33')](function(_0x1405e9){_0xce527a=_0x1405e9;logger['info']('The\x20Enduser\x20ID\x20is:',_0xce527a['id']);return getTicket(_0x3c0112,_0x2a295f,_0xce527a,_0x5c04c8,_0x580106,_0x5c04c8[_0x540b('0x68')],_0x270739,_0x540b('0x78'));})[_0x540b('0x33')](function(_0xbcdcba){_0x6c8886=_0xbcdcba;logger[_0x540b('0xc')](_0x540b('0x79'));logger[_0x540b('0xc')](_0x540b('0x6a'),_0x6c8886['id']);return setRelationship(_0x270739,_0x2a295f,_0x6c8886,_0x540b('0x6b'));})[_0x540b('0x33')](function(){return setRelationship(_0x270739,_0xce527a,_0x6c8886,_0x540b('0x6c'));})[_0x540b('0x33')](function(){return getServerInfo(_0x270739);})[_0x540b('0x33')](function(_0x1f6c24){var _0x4ca6cb=parseInt(_0x1f6c24[_0x540b('0x7a')][_0x540b('0x6d')](0x0));var _0xe58818=util[_0x540b('0x28')](_0x540b('0x6e'),_0x3c0112[_0x540b('0x5c')],_0x6c8886['id']);if(_0x4ca6cb>0x6){_0xe58818=util['format'](_0x540b('0x6f'),_0x3c0112[_0x540b('0x5c')],_0x6c8886['id']);}logger[_0x540b('0xc')](_0x540b('0x7b'),_0x540b('0x70'));emit(util[_0x540b('0x28')](_0x540b('0x7c'),_0x2e1a22[_0x540b('0xe')]),_0x540b('0x71'),{'uri':_0xe58818});})['catch'](function(_0x4896d9){logger[_0x540b('0x72')](_0x540b('0x7b'),JSON[_0x540b('0x26')](_0x4896d9));});};exports['unmanaged']=function(_0xbfb5e1,_0x54f560,_0x185b7e,_0x5c803e,_0x589d24,_0x287f6c){var _0x4b5684,_0x4d0ecd,_0x172364,_0x4e0b99;_0x287f6c['remoteUri']=intUtil['stripTrailingSlash'](_0x287f6c[_0x540b('0x5c')]);_0x287f6c['serverUrl']=intUtil[_0x540b('0x5e')](_0x287f6c[_0x540b('0x5d')]);def[_0x540b('0x74')]=util[_0x540b('0x28')]('%s/service/v4_1/rest.php',_0x287f6c[_0x540b('0x5c')]);if(_0x589d24&&_0x589d24[_0x540b('0x7d')]){logger[_0x540b('0xc')]('['+_0x54f560[_0x540b('0x7e')][_0x540b('0x7f')]()+']',_0x540b('0x61'));_0x54f560[_0x540b('0x62')]=util[_0x540b('0x28')](_0x540b('0x63'),_0x287f6c[_0x540b('0x5d')],_0x54f560[_0x540b('0x64')],md5(_0x54f560[_0x540b('0x64')]));}else{_0x54f560[_0x540b('0x62')]='';}return getConnection(_0x287f6c)['then'](function(_0x60caa4){_0x4e0b99=_0x60caa4;if(!_[_0x540b('0x2e')](_0x5c803e)){return getUser(_0x287f6c,_0x5c803e['name'],_0x4e0b99);}else{return getUser(_0x287f6c,null,_0x4e0b99);}})[_0x540b('0x33')](function(_0x1bac15){_0x4b5684=_0x1bac15;logger[_0x540b('0xc')](_0x540b('0x65'),_0x4b5684['id']);return getEndUser(_0x287f6c,_0x54f560[_0x540b('0x66')],_0x54f560['calleridnum'],_0x4e0b99);})['then'](function(_0x1111ef){_0x4d0ecd=_0x1111ef;logger[_0x540b('0xc')](_0x540b('0x67'),_0x4d0ecd['id']);return getTicket(_0x287f6c,_0x4b5684,_0x4d0ecd,_0x185b7e,_0x54f560,_0x185b7e[_0x540b('0x68')],_0x4e0b99,_0x540b('0x69'));})[_0x540b('0x33')](function(_0x32a4b5){_0x172364=_0x32a4b5;logger[_0x540b('0xc')]('Ticket\x20created!');logger[_0x540b('0xc')](_0x540b('0x6a'),_0x172364['id']);return setRelationship(_0x4e0b99,_0x4b5684,_0x172364,'users');})[_0x540b('0x33')](function(){return setRelationship(_0x4e0b99,_0x4d0ecd,_0x172364,_0x540b('0x6c'));})[_0x540b('0x33')](function(){return getServerInfo(_0x4e0b99);})[_0x540b('0x80')](function(_0x146f87){logger['error']('['+_0x54f560['lastevent']['toUpperCase']()+']',JSON[_0x540b('0x26')](_0x146f87));});}; \ 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 8130a92..0ec0d5e 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 _0x4000=['string','format','%s:\x20%s','keyContent','keyType','key','stripTrailingSlash','lastIndexOf','validateEmail','isNil','lodash','length','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x160b71,_0x2ed489){var _0x32a6e1=function(_0x57c9b3){while(--_0x57c9b3){_0x160b71['push'](_0x160b71['shift']());}};_0x32a6e1(++_0x2ed489);}(_0x4000,0x8e));var _0x0400=function(_0x49e28d,_0x1d73de){_0x49e28d=_0x49e28d-0x0;var _0x1a498f=_0x4000[_0x49e28d];return _0x1a498f;};'use strict';var _=require(_0x0400('0x0'));var util=require('util');exports['getString']=function(_0x40a25a,_0x4d5380,_0x3e46c1){var _0xd131c8=[];if(_0x40a25a[_0x0400('0x1')]>0x0){var _0x1ae487=_['sortBy'](_0x40a25a,['id']);for(var _0x501a28=0x0;_0x501a28<_0x1ae487[_0x0400('0x1')];_0x501a28++){var _0x28e515=_0x1ae487[_0x501a28];if(_0x28e515['type']==='string'){_0xd131c8[_0x0400('0x2')](_0x28e515['content']);}else if(_0x28e515[_0x0400('0x3')]===_0x0400('0x4')&&_0x28e515[_0x0400('0x5')]){_0x4d5380[_0x28e515[_0x0400('0x5')]]&&_0xd131c8[_0x0400('0x2')](_0x4d5380[_0x28e515[_0x0400('0x5')]][_0x0400('0x6')]());}else if(_0x28e515['type']===_0x0400('0x7')&&_0x28e515[_0x0400('0x8')]&&_0x28e515[_0x0400('0x8')]['name']){_0x4d5380[_0x28e515['Variable'][_0x0400('0x9')][_0x0400('0xa')]()]&&_0xd131c8[_0x0400('0x2')](_0x4d5380[_0x28e515['Variable']['name'][_0x0400('0xa')]()][_0x0400('0x6')]());}else if(_0x28e515[_0x0400('0x3')]===_0x0400('0xb')){if(_0x28e515['keyType']===_0x0400('0xc')&&_0x28e515['key']){_0xd131c8['push'](util[_0x0400('0xd')](_0x0400('0xe'),_0x28e515['key'],_0x28e515[_0x0400('0xf')]));}else if(_0x28e515[_0x0400('0x10')]===_0x0400('0x4')&&_0x28e515[_0x0400('0x5')]&&_0x28e515[_0x0400('0x11')]){_0x4d5380[_0x28e515[_0x0400('0x5')]]&&_0xd131c8[_0x0400('0x2')](util[_0x0400('0xd')](_0x0400('0xe'),_0x28e515['key'],_0x4d5380[_0x28e515[_0x0400('0x5')]]));}else if(_0x28e515[_0x0400('0x10')]===_0x0400('0x7')&&_0x28e515[_0x0400('0x8')]&&_0x28e515[_0x0400('0x8')][_0x0400('0x9')]&&_0x28e515[_0x0400('0x11')]){_0x4d5380[_0x28e515[_0x0400('0x8')][_0x0400('0x9')][_0x0400('0xa')]()]&&_0xd131c8[_0x0400('0x2')](util[_0x0400('0xd')](_0x0400('0xe'),_0x28e515[_0x0400('0x11')],_0x4d5380[_0x28e515[_0x0400('0x8')][_0x0400('0x9')][_0x0400('0xa')]()]));}}}}return _0xd131c8['join'](_0x3e46c1);};exports[_0x0400('0x12')]=function(_0x43a47e){var _0x53542b=_0x43a47e['slice'](-0x1);if(_0x53542b==='/'){_0x43a47e=_0x43a47e['substring'](0x0,_0x43a47e[_0x0400('0x13')](_0x53542b));}return _0x43a47e;};exports[_0x0400('0x14')]=function(_0x3295d2){if(!_[_0x0400('0x15')](_0x3295d2)&&_0x3295d2!==''){var _0x3106bd=/^(([^<>()\[\]\\.,;:\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 _0x3106bd['test'](String(_0x3295d2)[_0x0400('0xa')]());}else{return![];}}; \ No newline at end of file +var _0xe90a=['lodash','util','getString','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test'];(function(_0x39c437,_0x5b86c6){var _0x45c08a=function(_0x34c22a){while(--_0x34c22a){_0x39c437['push'](_0x39c437['shift']());}};_0x45c08a(++_0x5b86c6);}(_0xe90a,0x180));var _0xae90=function(_0x556b13,_0x364dda){_0x556b13=_0x556b13-0x0;var _0x38d60a=_0xe90a[_0x556b13];return _0x38d60a;};'use strict';var _=require(_0xae90('0x0'));var util=require(_0xae90('0x1'));exports[_0xae90('0x2')]=function(_0x5b39b2,_0x319244,_0xc7eabb){var _0x20dee8=[];if(_0x5b39b2['length']>0x0){var _0x39532a=_['sortBy'](_0x5b39b2,['id']);for(var _0x2e0fb9=0x0;_0x2e0fb9<_0x39532a['length'];_0x2e0fb9++){var _0x508db2=_0x39532a[_0x2e0fb9];if(_0x508db2[_0xae90('0x3')]==='string'){_0x20dee8[_0xae90('0x4')](_0x508db2[_0xae90('0x5')]);}else if(_0x508db2[_0xae90('0x3')]===_0xae90('0x6')&&_0x508db2['variableName']){_0x319244[_0x508db2[_0xae90('0x7')]]&&_0x20dee8[_0xae90('0x4')](_0x319244[_0x508db2[_0xae90('0x7')]][_0xae90('0x8')]());}else if(_0x508db2[_0xae90('0x3')]===_0xae90('0x9')&&_0x508db2['Variable']&&_0x508db2[_0xae90('0xa')][_0xae90('0xb')]){_0x319244[_0x508db2[_0xae90('0xa')][_0xae90('0xb')]['toLowerCase']()]&&_0x20dee8[_0xae90('0x4')](_0x319244[_0x508db2[_0xae90('0xa')][_0xae90('0xb')][_0xae90('0xc')]()][_0xae90('0x8')]());}else if(_0x508db2['type']==='keyValue'){if(_0x508db2[_0xae90('0xd')]==='string'&&_0x508db2[_0xae90('0xe')]){_0x20dee8[_0xae90('0x4')](util[_0xae90('0xf')](_0xae90('0x10'),_0x508db2[_0xae90('0xe')],_0x508db2['keyContent']));}else if(_0x508db2['keyType']===_0xae90('0x6')&&_0x508db2[_0xae90('0x7')]&&_0x508db2['key']){_0x319244[_0x508db2[_0xae90('0x7')]]&&_0x20dee8[_0xae90('0x4')](util[_0xae90('0xf')]('%s:\x20%s',_0x508db2[_0xae90('0xe')],_0x319244[_0x508db2[_0xae90('0x7')]]));}else if(_0x508db2['keyType']===_0xae90('0x9')&&_0x508db2[_0xae90('0xa')]&&_0x508db2[_0xae90('0xa')][_0xae90('0xb')]&&_0x508db2['key']){_0x319244[_0x508db2[_0xae90('0xa')]['name']['toLowerCase']()]&&_0x20dee8['push'](util[_0xae90('0xf')](_0xae90('0x10'),_0x508db2[_0xae90('0xe')],_0x319244[_0x508db2[_0xae90('0xa')][_0xae90('0xb')]['toLowerCase']()]));}}}}return _0x20dee8[_0xae90('0x11')](_0xc7eabb);};exports[_0xae90('0x12')]=function(_0x228f92){var _0x151fbd=_0x228f92[_0xae90('0x13')](-0x1);if(_0x151fbd==='/'){_0x228f92=_0x228f92[_0xae90('0x14')](0x0,_0x228f92['lastIndexOf'](_0x151fbd));}return _0x228f92;};exports[_0xae90('0x15')]=function(_0x33c99f){if(!_[_0xae90('0x16')](_0x33c99f)&&_0x33c99f!==''){var _0x3c1b21=/^(([^<>()\[\]\\.,;:\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 _0x3c1b21[_0xae90('0x17')](String(_0x33c99f)[_0xae90('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 e4e89e2..13b15b2 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2e839b,_0x1c3fe5){var _0x6b275d=function(_0x5e051){while(--_0x5e051){_0x2e839b['push'](_0x2e839b['shift']());}};_0x6b275d(++_0x1c3fe5);}(_0xe706,0xa3));var _0x6e70=function(_0x2020ea,_0x26fc4f){_0x2020ea=_0x2020ea-0x0;var _0x3657fe=_0xe706[_0x2020ea];return _0x3657fe;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index aa079c3..ebbaff5 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 _0x78d5=['The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','Recording\x20is\x20enabled!','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','type:user\x20role:agent\x20email:%s','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','user','authType','%s:%s','username','password','token','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','idField','variable','variableName','push','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x78d5,0x8b));var _0x578d=function(_0x3b283f,_0x42f000){_0x3b283f=_0x3b283f-0x0;var _0x3cb345=_0x78d5[_0x3b283f];return _0x3cb345;};'use strict';var _=require(_0x578d('0x0'));var rp=require(_0x578d('0x1'));var md5=require(_0x578d('0x2'));var util=require(_0x578d('0x3'));var Redis=require('ioredis');var intUtil=require(_0x578d('0x4'));var config=require(_0x578d('0x5'));var logger=require(_0x578d('0x6'))('zendesk');config[_0x578d('0x7')]=_[_0x578d('0x8')](config[_0x578d('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x578d('0x7')]));function emit(_0x3b5a65,_0x47799e,_0x3762c8){io['to'](_0x3b5a65)[_0x578d('0x9')](_0x47799e,_0x3762c8);}var headers={'Content-Type':_0x578d('0xa'),'Accept':_0x578d('0xa')};function getTicket(_0x287576,_0x350ae3,_0x11d7b8,_0x74e160,_0x591cf0){logger[_0x578d('0xb')](_0x578d('0xc'));return request({'uri':util[_0x578d('0xd')](_0x578d('0xe'),_0x287576[_0x578d('0xf')]),'method':_0x578d('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x11d7b8['id'],'submitter_id':_0x350ae3?_0x350ae3['id']:undefined,'assignee_id':_0x350ae3?_0x350ae3['id']:undefined,'tags':getTags(_0x74e160[_0x578d('0x11')],_0x578d('0x12')),'subject':intUtil[_0x578d('0x13')](_0x74e160[_0x578d('0x14')],_0x591cf0,'\x20'),'description':intUtil[_0x578d('0x13')](_0x74e160[_0x578d('0x15')],_0x591cf0,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x74e160[_0x578d('0x15')],_0x591cf0,'\x0a')}},getCustomFields(_0x74e160[_0x578d('0x16')],_0x591cf0))}})[_0x578d('0x17')](function(_0xb34f17){logger['info']('Ticket\x20created!');return _0xb34f17[_0x578d('0x18')];});}function getUser(_0x513351,_0x31cbfc){if(intUtil[_0x578d('0x19')](_0x31cbfc)){logger['info']('Getting\x20agent\x20with\x20email',_0x31cbfc);return request({'uri':util['format']('%s/search.json',_0x513351[_0x578d('0xf')]),'qs':{'query':util['format'](_0x578d('0x1a'),_0x31cbfc)}})['then'](function(_0x51f3dc){if(_0x51f3dc['count']){logger['info']('Agent\x20found!');return _[_0x578d('0x1b')](_0x51f3dc[_0x578d('0x1c')],{'email':_0x31cbfc,'role':_0x578d('0x1d')});}else{logger[_0x578d('0xb')](_0x578d('0x1e'));return request({'uri':util[_0x578d('0xd')](_0x578d('0x1f'),_0x513351['remoteUri'])})[_0x578d('0x17')](function(_0x7eaf6){logger[_0x578d('0xb')](_0x578d('0x20'));return _0x7eaf6['user'];});}});}else{logger['info'](_0x578d('0x1e'));return request({'uri':util[_0x578d('0xd')]('%s/users/me.json',_0x513351[_0x578d('0xf')])})[_0x578d('0x17')](function(_0x506cb4){logger['info'](_0x578d('0x20'));return _0x506cb4['user'];});}}function getEndUser(_0x4fbbdf,_0x100577,_0x4455bb){logger[_0x578d('0xb')](_0x578d('0x21'),_0x4455bb);return request({'uri':util['format'](_0x578d('0x22'),_0x4fbbdf[_0x578d('0xf')]),'qs':{'query':util[_0x578d('0xd')](_0x578d('0x23'),_0x4455bb)}})[_0x578d('0x17')](function(_0x19e4de){var _0x23de8f;if(_0x19e4de[_0x578d('0x1c')][_0x578d('0x24')]){_0x19e4de['results']=_[_0x578d('0x25')](_0x19e4de[_0x578d('0x1c')],{'suspended':![],'role':_0x578d('0x26')});if(_0x19e4de[_0x578d('0x1c')][_0x578d('0x24')]){_0x23de8f=_[_0x578d('0x27')](_0x19e4de[_0x578d('0x1c')]);}}if(_0x23de8f){logger['info'](_0x578d('0x28'));return _0x23de8f;}else{logger[_0x578d('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x578d('0x29'),_0x4fbbdf['remoteUri']),'method':_0x578d('0x10'),'body':{'user':{'role':_0x578d('0x26'),'name':util[_0x578d('0xd')](_0x578d('0x2a'),_0x100577||_0x4455bb),'phone':_0x4455bb}}})[_0x578d('0x17')](function(_0x3e8435){logger[_0x578d('0xb')](_0x578d('0x2b'));return _0x3e8435[_0x578d('0x2c')];});}});}function getAuth(_0xef9dd2){var _0x4e8133;if(_0xef9dd2[_0x578d('0x2d')]==='password'){_0x4e8133=util[_0x578d('0xd')](_0x578d('0x2e'),_0xef9dd2[_0x578d('0x2f')],_0xef9dd2[_0x578d('0x30')]);}else if(_0xef9dd2[_0x578d('0x2d')]===_0x578d('0x31')){_0x4e8133=util[_0x578d('0xd')]('%s/token:%s',_0xef9dd2[_0x578d('0x2f')],_0xef9dd2[_0x578d('0x31')]);}return util[_0x578d('0xd')](_0x578d('0x32'),new Buffer(_0x4e8133)[_0x578d('0x33')](_0x578d('0x34')));}function request(_0x110295){logger[_0x578d('0x35')](_0x578d('0x36'),JSON['stringify'](_0x110295));return rp(_[_0x578d('0x8')](_0x110295,{'method':_0x578d('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x2f1fc0,_0x4c3839){var _0x4f89ca=[];if(_0x2f1fc0&&_0x2f1fc0['length']>0x0){_0x4f89ca=_[_0x578d('0x38')](_0x2f1fc0,_0x4c3839);}return _0x4f89ca;}function getCustomFields(_0x2b06ea,_0x70787a){var _0x5e9720=[];var _0x19d4f5={'custom_fields':[]};if(_0x2b06ea[_0x578d('0x24')]>0x0){_['forEach'](_0x2b06ea,function(_0x317741){if(_[_0x578d('0x39')]([_0x578d('0x3a'),_0x578d('0x3b')],_0x317741[_0x578d('0x3c')])&&_0x317741[_0x578d('0x3d')]&&!_0x317741[_0x578d('0x3e')]){_0x19d4f5[_0x317741[_0x578d('0x3d')][_0x578d('0x3f')]()]=_0x317741[_0x578d('0x40')][_0x578d('0x33')]();}else if(_[_0x578d('0x39')](['string',_0x578d('0x3b')],_0x317741[_0x578d('0x3c')])&&_0x317741['idField']&&_0x317741['customField']){_0x19d4f5[_0x578d('0x41')]['push']({'id':_0x317741[_0x578d('0x42')],'value':_0x317741[_0x578d('0x40')]['toString']()});}else if(_0x317741[_0x578d('0x3c')]===_0x578d('0x43')&&_0x317741[_0x578d('0x44')]&&_0x317741['idField']&&_0x317741[_0x578d('0x3e')]){_0x70787a[_0x317741[_0x578d('0x44')]]&&_0x19d4f5['custom_fields'][_0x578d('0x45')]({'id':_0x317741['idField'],'value':_0x70787a[_0x317741[_0x578d('0x44')]][_0x578d('0x33')]()});}else if(_0x317741[_0x578d('0x3c')]===_0x578d('0x46')&&_0x317741['Variable']&&_0x317741[_0x578d('0x47')][_0x578d('0x12')]&&_0x317741[_0x578d('0x42')]&&_0x317741['customField']){_0x70787a[_0x317741['Variable'][_0x578d('0x12')][_0x578d('0x3f')]()]&&_0x19d4f5['custom_fields'][_0x578d('0x45')]({'id':_0x317741[_0x578d('0x42')],'value':_0x70787a[_0x317741['Variable']['name']['toLowerCase']()][_0x578d('0x33')]()});}});}return _0x19d4f5;}exports['queue']=function(_0x4b3bb5,_0x3f3248,_0x377f34,_0x57e6cf,_0x297b68,_0x4f2305){var _0x53762a,_0xdc9ab8;_0x4f2305['remoteUri']=intUtil[_0x578d('0x48')](_0x4f2305[_0x578d('0xf')]);_0x4f2305[_0x578d('0x49')]=intUtil['stripTrailingSlash'](_0x4f2305[_0x578d('0x49')]);if(_0x297b68&&_0x297b68[_0x578d('0x4a')]){logger[_0x578d('0xb')](_0x578d('0x4b'),'Recording\x20is\x20enabled!');_0x3f3248[_0x578d('0x4c')]=util[_0x578d('0xd')](_0x578d('0x4d'),_0x4f2305['serverUrl'],_0x3f3248[_0x578d('0x4e')],md5(_0x3f3248['uniqueid']));}else{_0x3f3248[_0x578d('0x4c')]='';}headers[_0x578d('0x4f')]=getAuth(_0x4f2305);return getUser(_0x4f2305,_0x57e6cf[_0x578d('0x50')])['then'](function(_0x46dab7){_0x53762a=_0x46dab7;logger['info'](_0x578d('0x51'),_0x53762a['id']);return getEndUser(_0x4f2305,_0x3f3248['calleridname'],_0x3f3248[_0x578d('0x52')]);})[_0x578d('0x17')](function(_0x249e2d){_0xdc9ab8=_0x249e2d;logger[_0x578d('0xb')](_0x578d('0x53'),_0xdc9ab8['id']);return getTicket(_0x4f2305,_0x53762a,_0xdc9ab8,_0x377f34,_0x3f3248);})['then'](function(_0x40e150){if(_0x40e150){logger['info'](_0x578d('0x54'),_0x40e150['id']);switch(_0x4f2305[_0x578d('0x3c')]){case _0x578d('0x55'):logger['info'](_0x578d('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4f2305[_0x578d('0xf')],_0x53762a['id'],_0x40e150['id']),'method':_0x578d('0x10')});case _0x578d('0x56'):logger['info'](_0x578d('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x578d('0xd')](_0x578d('0x57'),_0x57e6cf[_0x578d('0x12')]),_0x578d('0x58'),{'uri':util['format'](_0x578d('0x59'),_0x4f2305['remoteUri'][_0x578d('0x5a')](_0x578d('0x5b'),''),_0x40e150['id'])});break;default:logger[_0x578d('0x5c')](_0x578d('0x4b'),_0x578d('0x5d'));}}})[_0x578d('0x5e')](function(_0x452c0d){logger[_0x578d('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x578d('0x5f')](_0x452c0d,{'showHidden':!![],'depth':null}));});};exports[_0x578d('0x60')]=function(_0x124b92,_0x278a37,_0x6f394,_0x46cd4f,_0x2f86d4,_0x3ab88b,_0x3e976e){var _0x4fad99,_0x5c267c;_0x3ab88b['remoteUri']=intUtil[_0x578d('0x48')](_0x3ab88b['remoteUri']);_0x3ab88b[_0x578d('0x49')]=intUtil[_0x578d('0x48')](_0x3ab88b['serverUrl']);if(_0x3e976e&&_0x3e976e[_0x578d('0x61')]&&_0x3e976e[_0x578d('0x61')]!==_0x578d('0x62')){logger[_0x578d('0xb')](_0x578d('0x63'),'Recording\x20is\x20enabled!');_0x278a37['recordingURL']=util[_0x578d('0xd')](_0x578d('0x4d'),_0x3ab88b[_0x578d('0x49')],_0x278a37['uniqueid'],md5(_0x278a37['uniqueid']));}headers[_0x578d('0x4f')]=getAuth(_0x3ab88b);return getUser(_0x3ab88b,_0x46cd4f[_0x578d('0x50')])[_0x578d('0x17')](function(_0x2fd136){_0x4fad99=_0x2fd136;logger[_0x578d('0xb')](_0x578d('0x51'),_0x4fad99['id']);return getEndUser(_0x3ab88b,_0x278a37[_0x578d('0x64')],_0x278a37[_0x578d('0x65')]);})['then'](function(_0x3e71e3){_0x5c267c=_0x3e71e3;logger[_0x578d('0xb')](_0x578d('0x53'),_0x5c267c['id']);return getTicket(_0x3ab88b,_0x4fad99,_0x5c267c,_0x6f394,_0x278a37);})[_0x578d('0x17')](function(_0x337a37){if(_0x337a37){logger[_0x578d('0xb')]('The\x20Ticket\x20ID\x20is:',_0x337a37['id']);switch(_0x3ab88b[_0x578d('0x3c')]){case _0x578d('0x55'):logger[_0x578d('0xb')](_0x578d('0x63'),_0x578d('0x66'));return request({'uri':util[_0x578d('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3ab88b[_0x578d('0xf')],_0x4fad99['id'],_0x337a37['id']),'method':_0x578d('0x10')});case'newTab':logger[_0x578d('0xb')](_0x578d('0x63'),_0x578d('0x67'));emit(util[_0x578d('0xd')]('user:%s',_0x46cd4f[_0x578d('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x578d('0x59'),_0x3ab88b[_0x578d('0xf')][_0x578d('0x5a')](_0x578d('0x5b'),''),_0x337a37['id'])});break;default:logger[_0x578d('0x5c')](_0x578d('0x63'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x578d('0x5e')](function(_0x54fc88){logger[_0x578d('0x5c')](_0x578d('0x68'),util[_0x578d('0x5f')](_0x54fc88,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x567e57,_0x376c27,_0x68513a,_0x2c68b5,_0x419cb6,_0x2378df){var _0xcb7718,_0x41b6b1;_0x2378df[_0x578d('0xf')]=intUtil[_0x578d('0x48')](_0x2378df[_0x578d('0xf')]);_0x2378df['serverUrl']=intUtil[_0x578d('0x48')](_0x2378df['serverUrl']);if(_0x419cb6&&_0x419cb6[_0x578d('0x4a')]){logger[_0x578d('0xb')]('['+_0x376c27['lastevent'][_0x578d('0x69')]()+']',_0x578d('0x6a'));_0x376c27[_0x578d('0x4c')]=util[_0x578d('0xd')](_0x578d('0x4d'),_0x2378df[_0x578d('0x49')],_0x376c27['uniqueid'],md5(_0x376c27[_0x578d('0x4e')]));}else{_0x376c27[_0x578d('0x4c')]='';}headers[_0x578d('0x4f')]=getAuth(_0x2378df);return getUser(_0x2378df)[_0x578d('0x17')](function(_0x1f88e0){_0xcb7718=_0x1f88e0;logger[_0x578d('0xb')](_0x578d('0x51'),_0xcb7718['id']);return getEndUser(_0x2378df,_0x376c27[_0x578d('0x6b')],_0x376c27[_0x578d('0x52')]);})[_0x578d('0x17')](function(_0x3d443f){_0x41b6b1=_0x3d443f;logger['info'](_0x578d('0x53'),_0x41b6b1['id']);return getTicket(_0x2378df,_0xcb7718,_0x41b6b1,_0x68513a,_0x376c27);})[_0x578d('0x17')](function(_0x4ee8a5){if(_0x4ee8a5){logger[_0x578d('0xb')](_0x578d('0x54'),_0x4ee8a5['id']);}})[_0x578d('0x5e')](function(_0xad1821){logger['error']('['+_0x376c27[_0x578d('0x6c')][_0x578d('0x69')]()+']'+_0x578d('0x6d'),util[_0x578d('0x5f')](_0xad1821,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf118=['integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','Tags','name','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','length','map','forEach','string','type','nameField','customField','toLowerCase','picklist','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:'];(function(_0x4145ce,_0x3956f0){var _0x2d7580=function(_0x4fc0dc){while(--_0x4fc0dc){_0x4145ce['push'](_0x4145ce['shift']());}};_0x2d7580(++_0x3956f0);}(_0xf118,0x155));var _0x8f11=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0xf118[_0x5538d5];return _0x323b1a;};'use strict';var _=require(_0x8f11('0x0'));var rp=require('request-promise');var md5=require(_0x8f11('0x1'));var util=require(_0x8f11('0x2'));var Redis=require(_0x8f11('0x3'));var intUtil=require(_0x8f11('0x4'));var config=require(_0x8f11('0x5'));var logger=require('../../../../config/logger')(_0x8f11('0x6'));config[_0x8f11('0x7')]=_['defaults'](config[_0x8f11('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8f11('0x8'))(new Redis(config[_0x8f11('0x7')]));function emit(_0x3a7262,_0x29922c,_0x325342){io['to'](_0x3a7262)['emit'](_0x29922c,_0x325342);}var headers={'Content-Type':_0x8f11('0x9'),'Accept':_0x8f11('0x9')};function getTicket(_0x5d7ca3,_0x39bc58,_0x4f1187,_0x2085b4,_0x28c6d6){logger[_0x8f11('0xa')](_0x8f11('0xb'));return request({'uri':util['format'](_0x8f11('0xc'),_0x5d7ca3[_0x8f11('0xd')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x4f1187['id'],'submitter_id':_0x39bc58?_0x39bc58['id']:undefined,'assignee_id':_0x39bc58?_0x39bc58['id']:undefined,'tags':getTags(_0x2085b4[_0x8f11('0xe')],_0x8f11('0xf')),'subject':intUtil[_0x8f11('0x10')](_0x2085b4['Subjects'],_0x28c6d6,'\x20'),'description':intUtil[_0x8f11('0x10')](_0x2085b4[_0x8f11('0x11')],_0x28c6d6,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8f11('0x10')](_0x2085b4[_0x8f11('0x11')],_0x28c6d6,'\x0a')}},getCustomFields(_0x2085b4[_0x8f11('0x12')],_0x28c6d6))}})[_0x8f11('0x13')](function(_0x2666cb){logger[_0x8f11('0xa')]('Ticket\x20created!');return _0x2666cb[_0x8f11('0x14')];});}function getUser(_0x10ffd5,_0x56c1b0){if(intUtil[_0x8f11('0x15')](_0x56c1b0)){logger[_0x8f11('0xa')](_0x8f11('0x16'),_0x56c1b0);return request({'uri':util[_0x8f11('0x17')](_0x8f11('0x18'),_0x10ffd5[_0x8f11('0xd')]),'qs':{'query':util[_0x8f11('0x17')]('type:user\x20role:agent\x20email:%s',_0x56c1b0)}})[_0x8f11('0x13')](function(_0x121b96){if(_0x121b96[_0x8f11('0x19')]){logger[_0x8f11('0xa')](_0x8f11('0x1a'));return _[_0x8f11('0x1b')](_0x121b96[_0x8f11('0x1c')],{'email':_0x56c1b0,'role':'agent'});}else{logger[_0x8f11('0xa')](_0x8f11('0x1d'));return request({'uri':util['format'](_0x8f11('0x1e'),_0x10ffd5[_0x8f11('0xd')])})[_0x8f11('0x13')](function(_0x41e1a0){logger[_0x8f11('0xa')](_0x8f11('0x1f'));return _0x41e1a0[_0x8f11('0x20')];});}});}else{logger[_0x8f11('0xa')](_0x8f11('0x1d'));return request({'uri':util[_0x8f11('0x17')](_0x8f11('0x1e'),_0x10ffd5[_0x8f11('0xd')])})['then'](function(_0x395ab3){logger[_0x8f11('0xa')](_0x8f11('0x1f'));return _0x395ab3['user'];});}}function getEndUser(_0x297bb0,_0x9f5cad,_0x5cc422){logger[_0x8f11('0xa')](_0x8f11('0x21'),_0x5cc422);return request({'uri':util['format'](_0x8f11('0x18'),_0x297bb0[_0x8f11('0xd')]),'qs':{'query':util[_0x8f11('0x17')](_0x8f11('0x22'),_0x5cc422)}})[_0x8f11('0x13')](function(_0x25fe3d){var _0x13fb5c;if(_0x25fe3d[_0x8f11('0x1c')]['length']){_0x25fe3d[_0x8f11('0x1c')]=_['filter'](_0x25fe3d[_0x8f11('0x1c')],{'suspended':![],'role':_0x8f11('0x23')});if(_0x25fe3d['results']['length']){_0x13fb5c=_['first'](_0x25fe3d[_0x8f11('0x1c')]);}}if(_0x13fb5c){logger[_0x8f11('0xa')](_0x8f11('0x24'));return _0x13fb5c;}else{logger[_0x8f11('0xa')](_0x8f11('0x25'));return request({'uri':util[_0x8f11('0x17')](_0x8f11('0x26'),_0x297bb0[_0x8f11('0xd')]),'method':_0x8f11('0x27'),'body':{'user':{'role':'end-user','name':util[_0x8f11('0x17')]('Caller\x20-\x20%s',_0x9f5cad||_0x5cc422),'phone':_0x5cc422}}})[_0x8f11('0x13')](function(_0x53e34c){logger[_0x8f11('0xa')]('Enduser\x20created.');return _0x53e34c['user'];});}});}function getAuth(_0xba04b3){var _0x2cb1c9;if(_0xba04b3[_0x8f11('0x28')]===_0x8f11('0x29')){_0x2cb1c9=util[_0x8f11('0x17')](_0x8f11('0x2a'),_0xba04b3['username'],_0xba04b3[_0x8f11('0x29')]);}else if(_0xba04b3[_0x8f11('0x28')]===_0x8f11('0x2b')){_0x2cb1c9=util[_0x8f11('0x17')](_0x8f11('0x2c'),_0xba04b3[_0x8f11('0x2d')],_0xba04b3['token']);}return util[_0x8f11('0x17')](_0x8f11('0x2e'),new Buffer(_0x2cb1c9)[_0x8f11('0x2f')](_0x8f11('0x30')));}function request(_0x4ecdce){logger['debug'](_0x8f11('0x31'),JSON[_0x8f11('0x32')](_0x4ecdce));return rp(_['defaults'](_0x4ecdce,{'method':_0x8f11('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x1ace5e,_0x3b91d5){var _0x53893e=[];if(_0x1ace5e&&_0x1ace5e[_0x8f11('0x34')]>0x0){_0x53893e=_[_0x8f11('0x35')](_0x1ace5e,_0x3b91d5);}return _0x53893e;}function getCustomFields(_0x5874bf,_0x28e5f4){var _0xe1b2c0=[];var _0x5381f4={'custom_fields':[]};if(_0x5874bf[_0x8f11('0x34')]>0x0){_[_0x8f11('0x36')](_0x5874bf,function(_0x7d80f3){if(_['includes']([_0x8f11('0x37'),'picklist'],_0x7d80f3[_0x8f11('0x38')])&&_0x7d80f3[_0x8f11('0x39')]&&!_0x7d80f3[_0x8f11('0x3a')]){_0x5381f4[_0x7d80f3[_0x8f11('0x39')][_0x8f11('0x3b')]()]=_0x7d80f3['content'][_0x8f11('0x2f')]();}else if(_['includes']([_0x8f11('0x37'),_0x8f11('0x3c')],_0x7d80f3[_0x8f11('0x38')])&&_0x7d80f3['idField']&&_0x7d80f3[_0x8f11('0x3a')]){_0x5381f4['custom_fields'][_0x8f11('0x3d')]({'id':_0x7d80f3[_0x8f11('0x3e')],'value':_0x7d80f3['content'][_0x8f11('0x2f')]()});}else if(_0x7d80f3[_0x8f11('0x38')]===_0x8f11('0x3f')&&_0x7d80f3[_0x8f11('0x40')]&&_0x7d80f3[_0x8f11('0x3e')]&&_0x7d80f3[_0x8f11('0x3a')]){_0x28e5f4[_0x7d80f3[_0x8f11('0x40')]]&&_0x5381f4['custom_fields'][_0x8f11('0x3d')]({'id':_0x7d80f3[_0x8f11('0x3e')],'value':_0x28e5f4[_0x7d80f3[_0x8f11('0x40')]][_0x8f11('0x2f')]()});}else if(_0x7d80f3[_0x8f11('0x38')]===_0x8f11('0x41')&&_0x7d80f3[_0x8f11('0x42')]&&_0x7d80f3[_0x8f11('0x42')]['name']&&_0x7d80f3[_0x8f11('0x3e')]&&_0x7d80f3['customField']){_0x28e5f4[_0x7d80f3[_0x8f11('0x42')][_0x8f11('0xf')][_0x8f11('0x3b')]()]&&_0x5381f4['custom_fields'][_0x8f11('0x3d')]({'id':_0x7d80f3[_0x8f11('0x3e')],'value':_0x28e5f4[_0x7d80f3[_0x8f11('0x42')]['name'][_0x8f11('0x3b')]()][_0x8f11('0x2f')]()});}});}return _0x5381f4;}exports[_0x8f11('0x43')]=function(_0x528b15,_0x466ec6,_0x3be31e,_0x393095,_0x29183f,_0x538ca9){var _0x4df791,_0x22f3e3;_0x538ca9[_0x8f11('0xd')]=intUtil[_0x8f11('0x44')](_0x538ca9[_0x8f11('0xd')]);_0x538ca9[_0x8f11('0x45')]=intUtil['stripTrailingSlash'](_0x538ca9[_0x8f11('0x45')]);if(_0x29183f&&_0x29183f[_0x8f11('0x46')]){logger[_0x8f11('0xa')]('[QUEUE]','Recording\x20is\x20enabled!');_0x466ec6[_0x8f11('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x538ca9[_0x8f11('0x45')],_0x466ec6[_0x8f11('0x48')],md5(_0x466ec6[_0x8f11('0x48')]));}else{_0x466ec6[_0x8f11('0x47')]='';}headers['Authorization']=getAuth(_0x538ca9);return getUser(_0x538ca9,_0x393095[_0x8f11('0x49')])[_0x8f11('0x13')](function(_0x4a67e8){_0x4df791=_0x4a67e8;logger[_0x8f11('0xa')](_0x8f11('0x4a'),_0x4df791['id']);return getEndUser(_0x538ca9,_0x466ec6[_0x8f11('0x4b')],_0x466ec6[_0x8f11('0x4c')]);})['then'](function(_0x5a6f54){_0x22f3e3=_0x5a6f54;logger[_0x8f11('0xa')](_0x8f11('0x4d'),_0x22f3e3['id']);return getTicket(_0x538ca9,_0x4df791,_0x22f3e3,_0x3be31e,_0x466ec6);})[_0x8f11('0x13')](function(_0x49b9d9){if(_0x49b9d9){logger[_0x8f11('0xa')](_0x8f11('0x4e'),_0x49b9d9['id']);switch(_0x538ca9[_0x8f11('0x38')]){case _0x8f11('0x4f'):logger[_0x8f11('0xa')](_0x8f11('0x50'),_0x8f11('0x51'));return request({'uri':util[_0x8f11('0x17')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x538ca9[_0x8f11('0xd')],_0x4df791['id'],_0x49b9d9['id']),'method':_0x8f11('0x27')});case _0x8f11('0x52'):logger['info'](_0x8f11('0x50'),_0x8f11('0x53'));emit(util[_0x8f11('0x17')](_0x8f11('0x54'),_0x393095[_0x8f11('0xf')]),_0x8f11('0x55'),{'uri':util[_0x8f11('0x17')](_0x8f11('0x56'),_0x538ca9[_0x8f11('0xd')][_0x8f11('0x57')](_0x8f11('0x58'),''),_0x49b9d9['id'])});break;default:logger[_0x8f11('0x59')](_0x8f11('0x50'),_0x8f11('0x5a'));}}})[_0x8f11('0x5b')](function(_0x13c932){logger[_0x8f11('0x59')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x8f11('0x5c')](_0x13c932,{'showHidden':!![],'depth':null}));});};exports[_0x8f11('0x5d')]=function(_0x544765,_0x4dca46,_0xfb5cbd,_0x4472c5,_0x15d629,_0x195f9b,_0x348833){var _0x47c3a0,_0x573aac;_0x195f9b[_0x8f11('0xd')]=intUtil[_0x8f11('0x44')](_0x195f9b[_0x8f11('0xd')]);_0x195f9b[_0x8f11('0x45')]=intUtil['stripTrailingSlash'](_0x195f9b[_0x8f11('0x45')]);if(_0x348833&&_0x348833[_0x8f11('0x5e')]&&_0x348833[_0x8f11('0x5e')]!==_0x8f11('0x5f')){logger['info'](_0x8f11('0x60'),_0x8f11('0x61'));_0x4dca46['recordingURL']=util[_0x8f11('0x17')](_0x8f11('0x62'),_0x195f9b[_0x8f11('0x45')],_0x4dca46[_0x8f11('0x48')],md5(_0x4dca46[_0x8f11('0x48')]));}headers[_0x8f11('0x63')]=getAuth(_0x195f9b);return getUser(_0x195f9b,_0x4472c5[_0x8f11('0x49')])[_0x8f11('0x13')](function(_0x3d911f){_0x47c3a0=_0x3d911f;logger[_0x8f11('0xa')](_0x8f11('0x4a'),_0x47c3a0['id']);return getEndUser(_0x195f9b,_0x4dca46['destcalleridname'],_0x4dca46['destcalleridnum']);})[_0x8f11('0x13')](function(_0x1485c0){_0x573aac=_0x1485c0;logger[_0x8f11('0xa')](_0x8f11('0x4d'),_0x573aac['id']);return getTicket(_0x195f9b,_0x47c3a0,_0x573aac,_0xfb5cbd,_0x4dca46);})[_0x8f11('0x13')](function(_0xd7e379){if(_0xd7e379){logger[_0x8f11('0xa')](_0x8f11('0x4e'),_0xd7e379['id']);switch(_0x195f9b['type']){case'integrationTab':logger[_0x8f11('0xa')](_0x8f11('0x60'),_0x8f11('0x51'));return request({'uri':util['format'](_0x8f11('0x64'),_0x195f9b[_0x8f11('0xd')],_0x47c3a0['id'],_0xd7e379['id']),'method':_0x8f11('0x27')});case'newTab':logger[_0x8f11('0xa')]('[OUTBOUND]',_0x8f11('0x53'));emit(util['format'](_0x8f11('0x54'),_0x4472c5[_0x8f11('0xf')]),_0x8f11('0x55'),{'uri':util[_0x8f11('0x17')]('%s/agent/tickets/%s',_0x195f9b[_0x8f11('0xd')][_0x8f11('0x57')]('/api/v2',''),_0xd7e379['id'])});break;default:logger[_0x8f11('0x59')](_0x8f11('0x60'),_0x8f11('0x5a'));}}})['catch'](function(_0x19449e){logger[_0x8f11('0x59')](_0x8f11('0x65'),util[_0x8f11('0x5c')](_0x19449e,{'showHidden':!![],'depth':null}));});};exports[_0x8f11('0x66')]=function(_0x1b5235,_0x3ec4a9,_0x190ad2,_0x4e23de,_0x1729aa,_0x12953a){var _0x2d8b97,_0x263b40;_0x12953a[_0x8f11('0xd')]=intUtil[_0x8f11('0x44')](_0x12953a[_0x8f11('0xd')]);_0x12953a[_0x8f11('0x45')]=intUtil[_0x8f11('0x44')](_0x12953a['serverUrl']);if(_0x1729aa&&_0x1729aa[_0x8f11('0x46')]){logger[_0x8f11('0xa')]('['+_0x3ec4a9[_0x8f11('0x67')][_0x8f11('0x68')]()+']','Recording\x20is\x20enabled!');_0x3ec4a9[_0x8f11('0x47')]=util[_0x8f11('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12953a[_0x8f11('0x45')],_0x3ec4a9[_0x8f11('0x48')],md5(_0x3ec4a9['uniqueid']));}else{_0x3ec4a9[_0x8f11('0x47')]='';}headers[_0x8f11('0x63')]=getAuth(_0x12953a);return getUser(_0x12953a)['then'](function(_0xd89819){_0x2d8b97=_0xd89819;logger['info'](_0x8f11('0x4a'),_0x2d8b97['id']);return getEndUser(_0x12953a,_0x3ec4a9['calleridname'],_0x3ec4a9['calleridnum']);})[_0x8f11('0x13')](function(_0x3c0833){_0x263b40=_0x3c0833;logger[_0x8f11('0xa')](_0x8f11('0x4d'),_0x263b40['id']);return getTicket(_0x12953a,_0x2d8b97,_0x263b40,_0x190ad2,_0x3ec4a9);})[_0x8f11('0x13')](function(_0x327556){if(_0x327556){logger[_0x8f11('0xa')](_0x8f11('0x4e'),_0x327556['id']);}})[_0x8f11('0x5b')](function(_0x1baf3a){logger[_0x8f11('0x59')]('['+_0x3ec4a9['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x8f11('0x5c')](_0x1baf3a,{'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 44c4eec..f88aa18 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 _0xa4ff=['Timeout','Call_Start_Time','Inbound','merge','Call\x20created!','err','host','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','zoho.eu','destcalleridname','destcalleridnum','Outbound','unmanaged','monitor_format','toUpperCase','lodash','request-promise','util','moment','ioredis','bluebird','zoho','redis','localhost','socket.io-emitter','emit','stringify','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','Failing\x20creating\x20the\x20access_token','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','isArrayLikeObject','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','users','user','The\x20failing\x20result\x20is','error','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','Abandoned'];(function(_0x2776c0,_0x3bdc05){var _0x42b7b7=function(_0x94d837){while(--_0x94d837){_0x2776c0['push'](_0x2776c0['shift']());}};_0x42b7b7(++_0x3bdc05);}(_0xa4ff,0xb5));var _0xfa4f=function(_0x175ca4,_0x3a74c4){_0x175ca4=_0x175ca4-0x0;var _0x8c846d=_0xa4ff[_0x175ca4];return _0x8c846d;};'use strict';var _=require(_0xfa4f('0x0'));var rp=require(_0xfa4f('0x1'));var md5=require('md5');var util=require(_0xfa4f('0x2'));var intUtil=require('./util');var moment=require(_0xfa4f('0x3'));var Redis=require(_0xfa4f('0x4'));var BPromise=require(_0xfa4f('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xfa4f('0x6'));config[_0xfa4f('0x7')]=_['defaults'](config[_0xfa4f('0x7')],{'host':_0xfa4f('0x8'),'port':0x18eb});var io=require(_0xfa4f('0x9'))(new Redis(config[_0xfa4f('0x7')]));function emit(_0x594a75,_0x7e9b4b,_0x54b318){io['to'](_0x594a75)[_0xfa4f('0xa')](_0x7e9b4b,_0x54b318);}function request(_0x36ea8a){logger['debug']('[HTTP]',JSON[_0xfa4f('0xb')](_0x36ea8a));return rp(_0x36ea8a);}function getCustomFields(_0x3512ed,_0x466aaf){var _0x56a5b5={};if(_0x3512ed['length']>0x0){_[_0xfa4f('0xc')](_0x3512ed,function(_0x327b02){if(_[_0xfa4f('0xd')](['string',_0xfa4f('0xe')],_0x327b02[_0xfa4f('0xf')])&&_0x327b02['idField']){_0x56a5b5[_0x327b02[_0xfa4f('0x10')]]=_0x327b02[_0xfa4f('0x11')][_0xfa4f('0x12')]();}else if(_0x327b02[_0xfa4f('0xf')]===_0xfa4f('0x13')&&_0x327b02[_0xfa4f('0x14')]&&_0x327b02[_0xfa4f('0x10')]&&_0x466aaf[_0x327b02['variableName']]){_0x56a5b5[_0x327b02[_0xfa4f('0x10')]]=_0x466aaf[_0x327b02[_0xfa4f('0x14')]][_0xfa4f('0x12')]();}else if(_0x327b02[_0xfa4f('0xf')]===_0xfa4f('0x15')&&_0x327b02[_0xfa4f('0x16')]&&_0x327b02['Variable'][_0xfa4f('0x17')]&&_0x327b02[_0xfa4f('0x10')]&&_0x466aaf[_0x327b02[_0xfa4f('0x16')][_0xfa4f('0x17')][_0xfa4f('0x18')]()]){_0x56a5b5[_0x327b02['idField']]=_0x466aaf[_0x327b02[_0xfa4f('0x16')][_0xfa4f('0x17')][_0xfa4f('0x18')]()]['toString']();}});}return _0x56a5b5;}function getName(_0x2d36e6){if(_0x2d36e6['indexOf']('\x20')>0x0){var _0x24f031=_0x2d36e6['split'](/ (.+)/);if(_0x24f031[0x1]){return _0x24f031;}}return[_0x2d36e6,_0x2d36e6];}var accountsTokens={};function getAccessToken(_0x516f5c){return new Promise(function(_0x430da9,_0x5d22f3){if(!_['isNil'](accountsTokens[_0x516f5c['id']])&&!_[_0xfa4f('0x19')](accountsTokens[_0x516f5c['id']][_0xfa4f('0x1a')])){if(moment()['isBefore'](accountsTokens[_0x516f5c['id']]['expires_in'])){_0x430da9(accountsTokens[_0x516f5c['id']][_0xfa4f('0x1a')]);}}var _0x4883e2;switch(_0x516f5c[_0xfa4f('0x1b')]){case'US':_0x4883e2=_0xfa4f('0x1c');break;case'AU':_0x4883e2='https://accounts.zoho.com.au';break;case'EU':_0x4883e2=_0xfa4f('0x1d');break;case'IN':_0x4883e2=_0xfa4f('0x1e');break;case'CN':_0x4883e2=_0xfa4f('0x1f');break;default:_0x4883e2=_0xfa4f('0x1d');break;}var _0x3e14a2={'method':_0xfa4f('0x20'),'uri':_0x4883e2+_0xfa4f('0x21'),'qs':{'refresh_token':_0x516f5c[_0xfa4f('0x22')],'client_id':_0x516f5c[_0xfa4f('0x23')],'client_secret':_0x516f5c[_0xfa4f('0x24')],'grant_type':_0xfa4f('0x25')},'json':!![]};return rp(_0x3e14a2)['then'](function(_0x27b191){accountsTokens[_0x516f5c['id']]={'access_token':_0x27b191[_0xfa4f('0x1a')],'expires_in':moment()[_0xfa4f('0x26')](_0x27b191['expires_in'],_0xfa4f('0x27'))};_0x430da9(_0x27b191['access_token']);})['catch'](function(_0x4103eb){logger['error'](_0xfa4f('0x28'),_0x4103eb[_0xfa4f('0x29')]);_0x5d22f3(_0x4103eb);});});}function getUser(_0x5d01fb,_0x1b27c5,_0x84db02,_0x17ce68){logger['info']('Search\x20user');return request({'method':_0xfa4f('0x2a'),'uri':util[_0xfa4f('0x2b')](_0xfa4f('0x2c'),_0x1b27c5),'qs':{'type':_0xfa4f('0x2d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5d01fb},'json':!![]})[_0xfa4f('0x2e')](function(_0x9e60ee){if(_0x9e60ee['users']){var _0x52a7e1=-0x1;if(_[_0xfa4f('0x2f')](_0x9e60ee['users'])){if(!_[_0xfa4f('0x19')](_0x17ce68)){_0x52a7e1=_[_0xfa4f('0x30')](_0x9e60ee['users'],function(_0xadc033){return _0xadc033['email']===_0x17ce68;});}if(_0x52a7e1>=0x0){logger[_0xfa4f('0x31')](_0xfa4f('0x32'));}else{logger[_0xfa4f('0x31')](_0xfa4f('0x33'));_0x52a7e1=_[_0xfa4f('0x30')](_0x9e60ee['users'],function(_0xeeb6f3){return _0xeeb6f3[_0xfa4f('0x34')][_0xfa4f('0x17')]===_0xfa4f('0x35');});}return _0x9e60ee[_0xfa4f('0x36')][_0x52a7e1];}else{if(_0x9e60ee[_0xfa4f('0x37')]['profile'][_0xfa4f('0x17')]==='Administrator'){logger[_0xfa4f('0x31')](_0xfa4f('0x33'));user=_0x9e60ee[_0xfa4f('0x37')];return user;}else{logger['error'](_0xfa4f('0x38'),JSON[_0xfa4f('0xb')](_0x9e60ee));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x9e60ee));}}}else{logger[_0xfa4f('0x39')](_0xfa4f('0x38'),JSON['stringify'](_0x9e60ee));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfa4f('0xb')](_0x9e60ee));}})[_0xfa4f('0x3a')](function(_0x4ad1cb){console['error'](_0x4ad1cb);});}function getZohoUser(_0x18e1ce,_0x5a5a52){return new BPromise(function(_0x2e7e92,_0x3d67fa){request(_0x18e1ce)[_0xfa4f('0x2e')](function(_0x2f0695){var _0x12b767=null;if(_0x2f0695){_0x12b767=_0x2f0695[_0xfa4f('0x3b')][0x0];_0x12b767[_0xfa4f('0x3c')]=_0x5a5a52;}_0x2e7e92(_0x12b767);})['catch'](function(_0x1b8bd4){_0x3d67fa(_0x1b8bd4);});});}function createEndUser(_0x40ea0c,_0x57f46e,_0x202d8f,_0x4c47a3,_0x5eeb7d,_0xfbed9d){var _0x202d8f=getName(_0x202d8f);return request({'method':_0xfa4f('0x20'),'uri':_0xfa4f('0x3d')+_0x57f46e+_0xfa4f('0x3e')+_[_0xfa4f('0x3f')](_0xfbed9d['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x202d8f[0x1],'First_Name':_0x202d8f[0x0],'Phone':_0x4c47a3,'Owner':{'name':!_['isNil'](_0x5eeb7d[_0xfa4f('0x40')]['name'])?_0x5eeb7d[_0xfa4f('0x40')][_0xfa4f('0x17')]:!_[_0xfa4f('0x19')](_0x5eeb7d[_0xfa4f('0x41')])?_0x5eeb7d['first_name']+'\x20'+_0x5eeb7d[_0xfa4f('0x42')]:_0x5eeb7d['last_name'],'id':_0x5eeb7d['id']}}]},'headers':{'Authorization':_0xfa4f('0x43')+_0x40ea0c},'json':!![]})['then'](function(_0xfaa94f){if(_0xfaa94f&&_0xfaa94f['data'][0x0][_0xfa4f('0x44')]===_0xfa4f('0x45')){var _0x78b814=_0xfaa94f[_0xfa4f('0x3b')][0x0][_0xfa4f('0x46')];_0x78b814[_0xfa4f('0x3c')]=_['startCase'](_0xfbed9d[_0xfa4f('0x47')])+'s';return _0x78b814;}logger[_0xfa4f('0x39')](_0xfa4f('0x38'),JSON[_0xfa4f('0xb')](data));throw new Error(_0xfa4f('0x48')+JSON[_0xfa4f('0xb')](data));})[_0xfa4f('0x3a')](function(_0x208b04){console[_0xfa4f('0x49')](_0xfa4f('0x4a'),_0x208b04);});}function getEndUser(_0x46aba1,_0x4bae17,_0x4f54fc,_0x1dbc55,_0x48a9c9,_0x54961e,_0x4f0b63){var _0x4e6d7e={'method':_0xfa4f('0x2a'),'uri':'','headers':{'Authorization':_0xfa4f('0x43')+_0x46aba1},'json':!![]};switch(_0x4f0b63[_0xfa4f('0x4b')]){case _0xfa4f('0x4c'):_0x4e6d7e[_0xfa4f('0x4d')]=_0xfa4f('0x3d')+_0x4bae17+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x48a9c9+'))';return getZohoUser(_0x4e6d7e,_0xfa4f('0x4e'))[_0xfa4f('0x2e')](function(_0x518801){if(_0x518801)return _0x518801;_0x4e6d7e['uri']=_0xfa4f('0x3d')+_0x4bae17+_0xfa4f('0x4f')+_0x48a9c9+'))';return getZohoUser(_0x4e6d7e,'Leads')[_0xfa4f('0x2e')](function(_0x4579e3){if(_0x4579e3)return _0x4579e3;if(_0x4f0b63['moduleCreate']!=_0xfa4f('0x50')){return createEndUser(_0x46aba1,_0x4bae17,_0x1dbc55,_0x48a9c9,_0x54961e,_0x4f0b63);}else{return{};}});});break;case _0xfa4f('0x51'):_0x4e6d7e[_0xfa4f('0x4d')]=_0xfa4f('0x3d')+_0x4bae17+_0xfa4f('0x52')+_0x48a9c9+'))';return getZohoUser(_0x4e6d7e,_0xfa4f('0x4e'))[_0xfa4f('0x2e')](function(_0x1828dd){if(_0x1828dd)return _0x1828dd;if(_0x4f0b63['moduleCreate']!=_0xfa4f('0x50')){return createEndUser(_0x46aba1,_0x4bae17,_0x1dbc55,_0x48a9c9,_0x54961e,_0x4f0b63);}else{return{};}});break;case'lead':_0x4e6d7e['uri']=_0xfa4f('0x3d')+_0x4bae17+_0xfa4f('0x4f')+_0x48a9c9+'))';return getZohoUser(_0x4e6d7e,_0xfa4f('0x53'))[_0xfa4f('0x2e')](function(_0x1640af){if(_0x1640af)return _0x1640af;if(_0x4f0b63['moduleCreate']!=_0xfa4f('0x50')){return createEndUser(_0x46aba1,_0x4bae17,_0x1dbc55,_0x48a9c9,_0x54961e,_0x4f0b63);}else{return{};}});break;}}function getCall(_0x38ea71,_0x1af838,_0x5df6d9,_0x4d509f,_0x10b11b,_0x20c23c,_0x28aa37,_0x524280){logger[_0xfa4f('0x31')](_0xfa4f('0x54'));var _0x20523a={};_0x20523a[_0xfa4f('0x55')]={'name':!_[_0xfa4f('0x19')](_0x4d509f[_0xfa4f('0x40')][_0xfa4f('0x17')])&&!_['isNil'](_0x4d509f['profile'][_0xfa4f('0x17')])&&_0x4d509f[_0xfa4f('0x34')][_0xfa4f('0x17')]==='administrator'?_0x4d509f[_0xfa4f('0x40')][_0xfa4f('0x17')]:!_[_0xfa4f('0x19')](_0x4d509f['first_name'])?_0x4d509f[_0xfa4f('0x41')]+'\x20'+_0x4d509f[_0xfa4f('0x42')]:_0x4d509f[_0xfa4f('0x42')],'id':_0x4d509f['id']};_0x20523a['Subject']=intUtil['getString'](_0x20c23c['Subjects'],_0x28aa37,'\x20');_0x20523a['Description']=intUtil[_0xfa4f('0x56')](_0x20c23c[_0xfa4f('0x57')],_0x28aa37,'\x0a');if(_0x10b11b['enduserType']==='Contacts'){_0x20523a[_0xfa4f('0x58')]={'name':!_[_0xfa4f('0x19')](_0x10b11b[_0xfa4f('0x59')])?_0x10b11b[_0xfa4f('0x59')]:!_[_0xfa4f('0x19')](_0x10b11b[_0xfa4f('0x5a')])?_0x10b11b[_0xfa4f('0x5a')]+'\x20'+_0x10b11b[_0xfa4f('0x5b')]:_0x10b11b['Last_Name'],'id':_0x10b11b['id']};}if(_0x10b11b[_0xfa4f('0x3c')]===_0xfa4f('0x53')){_0x20523a[_0xfa4f('0x5c')]={'name':!_['isNil'](_0x10b11b['Full_Name'])?_0x10b11b['Full_Name']:!_['isNil'](_0x10b11b[_0xfa4f('0x5a')])?_0x10b11b['First_Name']+'\x20'+_0x10b11b[_0xfa4f('0x5b')]:_0x10b11b[_0xfa4f('0x5b')],'id':_0x10b11b['id']};_0x20523a[_0xfa4f('0x5d')]=_[_0xfa4f('0x3f')](_0x10b11b[_0xfa4f('0x3c')]);}if(_0x28aa37[_0xfa4f('0x5e')]){_0x20523a['Call_Duration']=moment[_0xfa4f('0x5f')](parseInt(_0x28aa37[_0xfa4f('0x5e')])*0x3e8)[_0xfa4f('0x2b')](_0xfa4f('0x60'));}else if(_0x28aa37['answertime']&&_0x28aa37['endtime']){_0x20523a['Call_Duration']=moment['utc'](moment(_0x28aa37[_0xfa4f('0x61')],_0xfa4f('0x62'))['diff'](moment(_0x28aa37[_0xfa4f('0x63')],_0xfa4f('0x62'))))['format']('mm:ss');}switch(_0x28aa37[_0xfa4f('0x64')]){case _0xfa4f('0x65'):_0x20523a[_0xfa4f('0x66')]=_0xfa4f('0x67');break;case'complete':case _0xfa4f('0x68'):_0x20523a[_0xfa4f('0x66')]=_0xfa4f('0x69');break;case _0xfa4f('0x6a'):_0x20523a[_0xfa4f('0x66')]=_0xfa4f('0x6b');break;case'abandoned':_0x20523a['Call_Result']=_0xfa4f('0x6c');break;case'timeout':_0x20523a[_0xfa4f('0x66')]=_0xfa4f('0x6d');default:}_0x20523a[_0xfa4f('0x6e')]=(_0x524280==='outbound'?moment(_0x28aa37[_0xfa4f('0x63')])[_0xfa4f('0x2b')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x28aa37['agentcalledAt'])[_0xfa4f('0x2b')](_0xfa4f('0x62')))||moment()[_0xfa4f('0x2b')](_0xfa4f('0x62'));_0x20523a['Call_Type']=_0x524280||_0xfa4f('0x6f');_0x20523a=_[_0xfa4f('0x70')](_0x20523a,getCustomFields(_0x20c23c['Fields'],_0x28aa37));return request({'method':_0xfa4f('0x20'),'uri':_0xfa4f('0x3d')+_0x1af838+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x38ea71},'body':{'data':[_0x20523a]},'json':!![]})['then'](function(_0x4bb7bd){if(_0x4bb7bd&&_0x4bb7bd[_0xfa4f('0x3b')][0x0][_0xfa4f('0x44')]===_0xfa4f('0x45')){logger[_0xfa4f('0x31')](_0xfa4f('0x71'));return{'id':_0x4bb7bd[_0xfa4f('0x3b')][0x0][_0xfa4f('0x46')]['id']};}})[_0xfa4f('0x3a')](function(_0xab4b4f){logger[_0xfa4f('0x31')](_0xfa4f('0x72'),_0xab4b4f[_0xfa4f('0x29')]);console[_0xfa4f('0x49')](_0xfa4f('0x72'),_0xab4b4f);});}exports['queue']=function(_0x5cd4b0,_0xebf2b5,_0x539203,_0x7c5f82,_0x5e1a1e,_0x3694fc){var _0x380df2,_0x1499dc,_0x423e29;_0x3694fc[_0xfa4f('0x73')]=intUtil['stripTrailingSlash'](_0x3694fc[_0xfa4f('0x73')]);_0x3694fc[_0xfa4f('0x74')]=intUtil[_0xfa4f('0x75')](_0x3694fc[_0xfa4f('0x74')]);if(_0x5e1a1e&&_0x5e1a1e['monitor_format']){logger[_0xfa4f('0x31')](_0xfa4f('0x76'),_0xfa4f('0x77'));_0xebf2b5[_0xfa4f('0x78')]=_0x3694fc[_0xfa4f('0x74')]+_0xfa4f('0x79')+_0xebf2b5[_0xfa4f('0x7a')]+_0xfa4f('0x7b')+md5(_0xebf2b5[_0xfa4f('0x7a')]);}else{_0xebf2b5[_0xfa4f('0x78')]='';}var _0x2fd14c=_0x3694fc[_0xfa4f('0x73')]==='zoho.eu'?'eu':_0xfa4f('0x7c');return getAccessToken(_0x3694fc)[_0xfa4f('0x2e')](function(_0x344c54){_0x423e29=_0x344c54;return getUser(_0x423e29,_0x2fd14c,_0x3694fc,_0x7c5f82[_0xfa4f('0x7d')]);})['then'](function(_0x593691){_0x380df2=_0x593691;logger[_0xfa4f('0x31')](_0xfa4f('0x7e'),_0x380df2['id']);return getEndUser(_0x423e29,_0x2fd14c,_0x3694fc,_0xebf2b5[_0xfa4f('0x7f')],_0xebf2b5[_0xfa4f('0x80')],_0x380df2,_0x539203);})[_0xfa4f('0x2e')](function(_0x53064a){_0x1499dc=_0x53064a;return getCall(_0x423e29,_0x2fd14c,_0x3694fc,_0x380df2,_0x1499dc,_0x539203,_0xebf2b5,'Inbound');})[_0xfa4f('0x2e')](function(_0x57f9b0){if(_0x57f9b0){logger[_0xfa4f('0x31')](_0xfa4f('0x81'),_0x57f9b0['id']);logger[_0xfa4f('0x31')](_0xfa4f('0x76'),_0xfa4f('0x82'));emit(util[_0xfa4f('0x2b')](_0xfa4f('0x83'),_0x7c5f82['name']),_0xfa4f('0x84'),{'uri':_0xfa4f('0x85')+_0x3694fc[_0xfa4f('0x73')]+_0xfa4f('0x86')+_0x57f9b0['id']});}})[_0xfa4f('0x3a')](function(_0x4280a4){logger[_0xfa4f('0x39')](_0xfa4f('0x76'),JSON[_0xfa4f('0xb')](_0x4280a4));});};exports[_0xfa4f('0x87')]=function(_0x2dc40d,_0x3601cf,_0x581114,_0x5c00bb,_0x36c9f9,_0x5d19ec,_0x3092d5){var _0x170690,_0x3eefe4,_0x30e685;_0x5d19ec[_0xfa4f('0x73')]=intUtil[_0xfa4f('0x75')](_0x5d19ec[_0xfa4f('0x73')]);_0x5d19ec['serverUrl']=intUtil[_0xfa4f('0x75')](_0x5d19ec[_0xfa4f('0x74')]);if(_0x3092d5&&_0x3092d5['recordingFormat']&&_0x3092d5[_0xfa4f('0x88')]!=='none'){logger['info'](_0xfa4f('0x89'),'Recording\x20is\x20enabled!');_0x3601cf[_0xfa4f('0x78')]=_0x5d19ec[_0xfa4f('0x74')]+_0xfa4f('0x79')+_0x3601cf['uniqueid']+_0xfa4f('0x7b')+md5(_0x3601cf['uniqueid']);}var _0x5717c3=_0x5d19ec[_0xfa4f('0x73')]===_0xfa4f('0x8a')?'eu':_0xfa4f('0x7c');return getAccessToken(_0x5d19ec)['then'](function(_0x465294){_0x30e685=_0x465294;return getUser(_0x30e685,_0x5717c3,_0x5d19ec,_0x5c00bb[_0xfa4f('0x7d')]);})[_0xfa4f('0x2e')](function(_0x2dabd7){_0x170690=_0x2dabd7;logger[_0xfa4f('0x31')](_0xfa4f('0x7e'),_0x170690['id']);return getEndUser(_0x30e685,_0x5717c3,_0x5d19ec,_0x3601cf[_0xfa4f('0x8b')],_0x3601cf[_0xfa4f('0x8c')],_0x170690,_0x581114);})['then'](function(_0x1d1367){_0x3eefe4=_0x1d1367;return getCall(_0x30e685,_0x5717c3,_0x5d19ec,_0x170690,_0x3eefe4,_0x581114,_0x3601cf,_0xfa4f('0x8d'));})['then'](function(_0xa619bc){if(_0xa619bc){logger[_0xfa4f('0x31')](_0xfa4f('0x81'),_0xa619bc['id']);logger['info'](_0xfa4f('0x89'),_0xfa4f('0x82'));emit(util[_0xfa4f('0x2b')]('user:%s',_0x5c00bb[_0xfa4f('0x17')]),_0xfa4f('0x84'),{'uri':'https://crm.'+_0x5d19ec[_0xfa4f('0x73')]+_0xfa4f('0x86')+_0xa619bc['id']});}})['catch'](function(_0x1abf71){logger['error'](_0xfa4f('0x89'),JSON[_0xfa4f('0xb')](_0x1abf71));});};exports[_0xfa4f('0x8e')]=function(_0x3fca32,_0x14bb35,_0x9e2fa4,_0x40b02e,_0x5586bf,_0x128149){var _0x3bfcf7,_0x398d96,_0x2a2b74;_0x128149['host']=intUtil[_0xfa4f('0x75')](_0x128149['host']);_0x128149['serverUrl']=intUtil['stripTrailingSlash'](_0x128149['serverUrl']);if(_0x5586bf&&_0x5586bf[_0xfa4f('0x8f')]){logger[_0xfa4f('0x31')]('['+_0x14bb35[_0xfa4f('0x64')][_0xfa4f('0x90')]()+']',_0xfa4f('0x77'));_0x14bb35[_0xfa4f('0x78')]=_0x128149[_0xfa4f('0x74')]+'/api/voice/recordings/'+_0x14bb35[_0xfa4f('0x7a')]+_0xfa4f('0x7b')+md5(_0x14bb35[_0xfa4f('0x7a')]);}else{_0x14bb35[_0xfa4f('0x78')]='';}var _0x26a638=_0x128149[_0xfa4f('0x73')]===_0xfa4f('0x8a')?'eu':_0xfa4f('0x7c');return getAccessToken(_0x128149)[_0xfa4f('0x2e')](function(_0x1d7e54){_0x2a2b74=_0x1d7e54;return getUser(_0x2a2b74,_0x26a638,_0x128149);})[_0xfa4f('0x2e')](function(_0x401d3c){_0x3bfcf7=_0x401d3c;logger[_0xfa4f('0x31')](_0xfa4f('0x7e'),_0x3bfcf7['id']);return getEndUser(_0x2a2b74,_0x26a638,_0x128149,_0x14bb35['calleridname'],_0x14bb35[_0xfa4f('0x80')],_0x3bfcf7,_0x9e2fa4);})[_0xfa4f('0x2e')](function(_0x5013f9){_0x398d96=_0x5013f9;return getCall(_0x2a2b74,_0x26a638,_0x128149,_0x3bfcf7,_0x398d96,_0x9e2fa4,_0x14bb35,_0xfa4f('0x6f'));})[_0xfa4f('0x2e')](function(_0xe22ae3){if(_0xe22ae3){logger[_0xfa4f('0x31')](_0xfa4f('0x81'),_0xe22ae3['id']);}})[_0xfa4f('0x3a')](function(_0x2dd70a){logger[_0xfa4f('0x39')]('['+_0x14bb35[_0xfa4f('0x64')][_0xfa4f('0x90')]()+']',JSON[_0xfa4f('0xb')](_0x2dd70a));});}; \ No newline at end of file +var _0x572a=['bluebird','../../../../config/environment','../../../../config/logger','redis','localhost','emit','debug','[HTTP]','forEach','includes','picklist','type','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','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','POST','/oauth/v2/token','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','findIndex','users','profile','Administrator','user','Using\x20the\x20admin\x20account!','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','Zoho-oauthtoken\x20','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','Subject','getString','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','connect','Answered','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','stack','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','user:%s','trigger:browser:url','https://crm.','recordingFormat','[OUTBOUND]','/downloads?type=uniqueid&token=','email','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','md5','util','./util','ioredis'];(function(_0x9a16e8,_0x123ac5){var _0x837cb8=function(_0x4800f5){while(--_0x4800f5){_0x9a16e8['push'](_0x9a16e8['shift']());}};_0x837cb8(++_0x123ac5);}(_0x572a,0x12f));var _0xa572=function(_0xe08e90,_0x4df1f6){_0xe08e90=_0xe08e90-0x0;var _0x22871f=_0x572a[_0xe08e90];return _0x22871f;};'use strict';var _=require(_0xa572('0x0'));var rp=require('request-promise');var md5=require(_0xa572('0x1'));var util=require(_0xa572('0x2'));var intUtil=require(_0xa572('0x3'));var moment=require('moment');var Redis=require(_0xa572('0x4'));var BPromise=require(_0xa572('0x5'));var config=require(_0xa572('0x6'));var logger=require(_0xa572('0x7'))('zoho');config[_0xa572('0x8')]=_['defaults'](config[_0xa572('0x8')],{'host':_0xa572('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa572('0x8')]));function emit(_0x30702b,_0x20699b,_0x1449e9){io['to'](_0x30702b)[_0xa572('0xa')](_0x20699b,_0x1449e9);}function request(_0x22b5aa){logger[_0xa572('0xb')](_0xa572('0xc'),JSON['stringify'](_0x22b5aa));return rp(_0x22b5aa);}function getCustomFields(_0x57cf7a,_0x4ec2df){var _0x4b9d4d={};if(_0x57cf7a['length']>0x0){_[_0xa572('0xd')](_0x57cf7a,function(_0x51877b){if(_[_0xa572('0xe')](['string',_0xa572('0xf')],_0x51877b[_0xa572('0x10')])&&_0x51877b[_0xa572('0x11')]){_0x4b9d4d[_0x51877b[_0xa572('0x11')]]=_0x51877b['content']['toString']();}else if(_0x51877b[_0xa572('0x10')]===_0xa572('0x12')&&_0x51877b[_0xa572('0x13')]&&_0x51877b[_0xa572('0x11')]&&_0x4ec2df[_0x51877b['variableName']]){_0x4b9d4d[_0x51877b[_0xa572('0x11')]]=_0x4ec2df[_0x51877b[_0xa572('0x13')]][_0xa572('0x14')]();}else if(_0x51877b['type']===_0xa572('0x15')&&_0x51877b[_0xa572('0x16')]&&_0x51877b[_0xa572('0x16')][_0xa572('0x17')]&&_0x51877b[_0xa572('0x11')]&&_0x4ec2df[_0x51877b['Variable'][_0xa572('0x17')][_0xa572('0x18')]()]){_0x4b9d4d[_0x51877b[_0xa572('0x11')]]=_0x4ec2df[_0x51877b[_0xa572('0x16')][_0xa572('0x17')][_0xa572('0x18')]()][_0xa572('0x14')]();}});}return _0x4b9d4d;}function getName(_0x1aea67){if(_0x1aea67['indexOf']('\x20')>0x0){var _0x23b65e=_0x1aea67[_0xa572('0x19')](/ (.+)/);if(_0x23b65e[0x1]){return _0x23b65e;}}return[_0x1aea67,_0x1aea67];}var accountsTokens={};function getAccessToken(_0x4ec2e4){return new Promise(function(_0x10be68,_0x21502e){if(!_['isNil'](accountsTokens[_0x4ec2e4['id']])&&!_[_0xa572('0x1a')](accountsTokens[_0x4ec2e4['id']][_0xa572('0x1b')])){if(moment()[_0xa572('0x1c')](accountsTokens[_0x4ec2e4['id']][_0xa572('0x1d')])){_0x10be68(accountsTokens[_0x4ec2e4['id']]['access_token']);}}var _0x3aaa48;switch(_0x4ec2e4[_0xa572('0x1e')]){case'US':_0x3aaa48=_0xa572('0x1f');break;case'AU':_0x3aaa48=_0xa572('0x20');break;case'EU':_0x3aaa48='https://accounts.zoho.eu';break;case'IN':_0x3aaa48='https://accounts.zoho.in';break;case'CN':_0x3aaa48=_0xa572('0x21');break;default:_0x3aaa48=_0xa572('0x22');break;}var _0x53c458={'method':_0xa572('0x23'),'uri':_0x3aaa48+_0xa572('0x24'),'qs':{'refresh_token':_0x4ec2e4['refreshToken'],'client_id':_0x4ec2e4[_0xa572('0x25')],'client_secret':_0x4ec2e4[_0xa572('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x53c458)[_0xa572('0x27')](function(_0x3926ab){accountsTokens[_0x4ec2e4['id']]={'access_token':_0x3926ab[_0xa572('0x1b')],'expires_in':moment()[_0xa572('0x28')](_0x3926ab[_0xa572('0x1d')],_0xa572('0x29'))};_0x10be68(_0x3926ab[_0xa572('0x1b')]);})[_0xa572('0x2a')](function(_0x44cec3){logger[_0xa572('0x2b')](_0xa572('0x2c'),_0x44cec3['stack']);_0x21502e(_0x44cec3);});});}function getUser(_0x508687,_0x277d5f,_0x5a6703,_0x47f20f){logger[_0xa572('0x2d')](_0xa572('0x2e'));return request({'method':_0xa572('0x2f'),'uri':util[_0xa572('0x30')](_0xa572('0x31'),_0x277d5f),'qs':{'type':_0xa572('0x32')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x508687},'json':!![]})[_0xa572('0x27')](function(_0x3b9c21){if(_0x3b9c21['users']){var _0x589824=-0x1;if(_[_0xa572('0x33')](_0x3b9c21['users'])){if(!_[_0xa572('0x1a')](_0x47f20f)){_0x589824=_[_0xa572('0x34')](_0x3b9c21[_0xa572('0x35')],function(_0x686c48){return _0x686c48['email']===_0x47f20f;});}if(_0x589824>=0x0){logger[_0xa572('0x2d')]('Agent\x20found!');}else{logger['info']('Using\x20the\x20admin\x20account!');_0x589824=_[_0xa572('0x34')](_0x3b9c21[_0xa572('0x35')],function(_0x1ed577){return _0x1ed577[_0xa572('0x36')][_0xa572('0x17')]===_0xa572('0x37');});}return _0x3b9c21[_0xa572('0x35')][_0x589824];}else{if(_0x3b9c21[_0xa572('0x38')][_0xa572('0x36')][_0xa572('0x17')]===_0xa572('0x37')){logger[_0xa572('0x2d')](_0xa572('0x39'));user=_0x3b9c21['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xa572('0x3a')](_0x3b9c21));throw new Error(_0xa572('0x3b')+JSON['stringify'](_0x3b9c21));}}}else{logger[_0xa572('0x2b')](_0xa572('0x3c'),JSON[_0xa572('0x3a')](_0x3b9c21));throw new Error(_0xa572('0x3b')+JSON[_0xa572('0x3a')](_0x3b9c21));}})[_0xa572('0x2a')](function(_0x3282ce){console[_0xa572('0x2b')](_0x3282ce);});}function getZohoUser(_0x3e47df,_0x2aeef5){return new BPromise(function(_0x5d8e48,_0x5ba0a4){request(_0x3e47df)['then'](function(_0x5419e5){var _0x4b101d=null;if(_0x5419e5){_0x4b101d=_0x5419e5[_0xa572('0x3d')][0x0];_0x4b101d[_0xa572('0x3e')]=_0x2aeef5;}_0x5d8e48(_0x4b101d);})[_0xa572('0x2a')](function(_0x10cca6){_0x5ba0a4(_0x10cca6);});});}function createEndUser(_0xc59613,_0x4e68ab,_0x40ef61,_0x98f395,_0x33089f,_0x30a440){var _0x40ef61=getName(_0x40ef61);return request({'method':'POST','uri':_0xa572('0x3f')+_0x4e68ab+_0xa572('0x40')+_[_0xa572('0x41')](_0x30a440[_0xa572('0x42')])+'s','body':{'data':[{'Last_Name':_0x40ef61[0x1],'First_Name':_0x40ef61[0x0],'Phone':_0x98f395,'Owner':{'name':!_[_0xa572('0x1a')](_0x33089f[_0xa572('0x43')][_0xa572('0x17')])?_0x33089f['role'][_0xa572('0x17')]:!_[_0xa572('0x1a')](_0x33089f[_0xa572('0x44')])?_0x33089f['first_name']+'\x20'+_0x33089f[_0xa572('0x45')]:_0x33089f[_0xa572('0x45')],'id':_0x33089f['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xc59613},'json':!![]})[_0xa572('0x27')](function(_0x2f0a0d){if(_0x2f0a0d&&_0x2f0a0d[_0xa572('0x3d')][0x0][_0xa572('0x46')]==='SUCCESS'){var _0x23da7d=_0x2f0a0d[_0xa572('0x3d')][0x0][_0xa572('0x47')];_0x23da7d[_0xa572('0x3e')]=_[_0xa572('0x41')](_0x30a440[_0xa572('0x42')])+'s';return _0x23da7d;}logger['error'](_0xa572('0x3c'),JSON[_0xa572('0x3a')](data));throw new Error(_0xa572('0x48')+JSON['stringify'](data));})['catch'](function(_0x4b5486){console['log']('CREATE\x20ERROR',_0x4b5486);});}function getEndUser(_0x3910e7,_0x11cb37,_0x203f4b,_0x44fd60,_0x262f53,_0x582381,_0x1d37d8){var _0xd405c9={'method':'GET','uri':'','headers':{'Authorization':_0xa572('0x49')+_0x3910e7},'json':!![]};switch(_0x1d37d8[_0xa572('0x4a')]){case _0xa572('0x4b'):_0xd405c9[_0xa572('0x4c')]=_0xa572('0x3f')+_0x11cb37+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x262f53+'))';return getZohoUser(_0xd405c9,_0xa572('0x4d'))[_0xa572('0x27')](function(_0x535a94){if(_0x535a94)return _0x535a94;_0xd405c9[_0xa572('0x4c')]='https://www.zohoapis.'+_0x11cb37+_0xa572('0x4e')+_0x262f53+'))';return getZohoUser(_0xd405c9,_0xa572('0x4f'))[_0xa572('0x27')](function(_0x2f1c82){if(_0x2f1c82)return _0x2f1c82;if(_0x1d37d8[_0xa572('0x42')]!=_0xa572('0x50')){return createEndUser(_0x3910e7,_0x11cb37,_0x44fd60,_0x262f53,_0x582381,_0x1d37d8);}else{return{};}});});break;case _0xa572('0x51'):_0xd405c9[_0xa572('0x4c')]='https://www.zohoapis.'+_0x11cb37+_0xa572('0x52')+_0x262f53+'))';return getZohoUser(_0xd405c9,_0xa572('0x4d'))[_0xa572('0x27')](function(_0x31647b){if(_0x31647b)return _0x31647b;if(_0x1d37d8[_0xa572('0x42')]!=_0xa572('0x50')){return createEndUser(_0x3910e7,_0x11cb37,_0x44fd60,_0x262f53,_0x582381,_0x1d37d8);}else{return{};}});break;case _0xa572('0x53'):_0xd405c9['uri']='https://www.zohoapis.'+_0x11cb37+_0xa572('0x4e')+_0x262f53+'))';return getZohoUser(_0xd405c9,_0xa572('0x4f'))[_0xa572('0x27')](function(_0x23c0e1){if(_0x23c0e1)return _0x23c0e1;if(_0x1d37d8[_0xa572('0x42')]!=_0xa572('0x50')){return createEndUser(_0x3910e7,_0x11cb37,_0x44fd60,_0x262f53,_0x582381,_0x1d37d8);}else{return{};}});break;}}function getCall(_0x196463,_0x3339ee,_0xa8d240,_0x1d4f67,_0x56a87f,_0x4d5b59,_0x30e2ad,_0xcbf724){logger[_0xa572('0x2d')](_0xa572('0x54'));var _0x208c84={};_0x208c84[_0xa572('0x55')]={'name':!_[_0xa572('0x1a')](_0x1d4f67[_0xa572('0x43')]['name'])&&!_[_0xa572('0x1a')](_0x1d4f67[_0xa572('0x36')][_0xa572('0x17')])&&_0x1d4f67[_0xa572('0x36')]['name']==='administrator'?_0x1d4f67[_0xa572('0x43')][_0xa572('0x17')]:!_[_0xa572('0x1a')](_0x1d4f67['first_name'])?_0x1d4f67[_0xa572('0x44')]+'\x20'+_0x1d4f67[_0xa572('0x45')]:_0x1d4f67[_0xa572('0x45')],'id':_0x1d4f67['id']};_0x208c84[_0xa572('0x56')]=intUtil[_0xa572('0x57')](_0x4d5b59['Subjects'],_0x30e2ad,'\x20');_0x208c84[_0xa572('0x58')]=intUtil[_0xa572('0x57')](_0x4d5b59[_0xa572('0x59')],_0x30e2ad,'\x0a');if(_0x56a87f[_0xa572('0x3e')]==='Contacts'){_0x208c84[_0xa572('0x5a')]={'name':!_['isNil'](_0x56a87f['Full_Name'])?_0x56a87f['Full_Name']:!_[_0xa572('0x1a')](_0x56a87f[_0xa572('0x5b')])?_0x56a87f[_0xa572('0x5b')]+'\x20'+_0x56a87f[_0xa572('0x5c')]:_0x56a87f[_0xa572('0x5c')],'id':_0x56a87f['id']};}if(_0x56a87f['enduserType']===_0xa572('0x4f')){_0x208c84[_0xa572('0x5d')]={'name':!_[_0xa572('0x1a')](_0x56a87f['Full_Name'])?_0x56a87f[_0xa572('0x5e')]:!_[_0xa572('0x1a')](_0x56a87f[_0xa572('0x5b')])?_0x56a87f[_0xa572('0x5b')]+'\x20'+_0x56a87f['Last_Name']:_0x56a87f[_0xa572('0x5c')],'id':_0x56a87f['id']};_0x208c84[_0xa572('0x5f')]=_[_0xa572('0x41')](_0x56a87f['enduserType']);}if(_0x30e2ad[_0xa572('0x60')]){_0x208c84['Call_Duration']=moment[_0xa572('0x61')](parseInt(_0x30e2ad[_0xa572('0x60')])*0x3e8)[_0xa572('0x30')](_0xa572('0x62'));}else if(_0x30e2ad[_0xa572('0x63')]&&_0x30e2ad[_0xa572('0x64')]){_0x208c84[_0xa572('0x65')]=moment[_0xa572('0x61')](moment(_0x30e2ad[_0xa572('0x64')],_0xa572('0x66'))[_0xa572('0x67')](moment(_0x30e2ad[_0xa572('0x68')],'YYYY-MM-DDTHH:mm:ss')))[_0xa572('0x30')](_0xa572('0x62'));}switch(_0x30e2ad[_0xa572('0x69')]){case _0xa572('0x6a'):_0x208c84[_0xa572('0x6b')]='Called';break;case'complete':case _0xa572('0x6c'):_0x208c84[_0xa572('0x6b')]=_0xa572('0x6d');break;case'rejected':_0x208c84[_0xa572('0x6b')]='Rejected';break;case'abandoned':_0x208c84[_0xa572('0x6b')]=_0xa572('0x6e');break;case _0xa572('0x6f'):_0x208c84[_0xa572('0x6b')]=_0xa572('0x70');default:}_0x208c84[_0xa572('0x71')]=(_0xcbf724===_0xa572('0x72')?moment(_0x30e2ad[_0xa572('0x68')])[_0xa572('0x30')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x30e2ad['agentcalledAt'])['format'](_0xa572('0x66')))||moment()['format'](_0xa572('0x66'));_0x208c84[_0xa572('0x73')]=_0xcbf724||_0xa572('0x74');_0x208c84=_[_0xa572('0x75')](_0x208c84,getCustomFields(_0x4d5b59[_0xa572('0x76')],_0x30e2ad));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x3339ee+_0xa572('0x77'),'headers':{'Authorization':_0xa572('0x49')+_0x196463},'body':{'data':[_0x208c84]},'json':!![]})[_0xa572('0x27')](function(_0x31f37f){if(_0x31f37f&&_0x31f37f[_0xa572('0x3d')][0x0][_0xa572('0x46')]===_0xa572('0x78')){logger[_0xa572('0x2d')](_0xa572('0x79'));return{'id':_0x31f37f[_0xa572('0x3d')][0x0][_0xa572('0x47')]['id']};}})['catch'](function(_0x1a7807){logger[_0xa572('0x2d')](_0xa572('0x7a'),_0x1a7807[_0xa572('0x7b')]);console[_0xa572('0x7c')](_0xa572('0x7a'),_0x1a7807);});}exports[_0xa572('0x7d')]=function(_0x185ef6,_0x19f721,_0x1a4d47,_0x27c691,_0x44e417,_0x4ef9a8){var _0x5f309f,_0x4c6ddd,_0x4d04fa;_0x4ef9a8[_0xa572('0x7e')]=intUtil[_0xa572('0x7f')](_0x4ef9a8['host']);_0x4ef9a8[_0xa572('0x80')]=intUtil[_0xa572('0x7f')](_0x4ef9a8['serverUrl']);if(_0x44e417&&_0x44e417[_0xa572('0x81')]){logger[_0xa572('0x2d')](_0xa572('0x82'),_0xa572('0x83'));_0x19f721[_0xa572('0x84')]=_0x4ef9a8[_0xa572('0x80')]+_0xa572('0x85')+_0x19f721[_0xa572('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x19f721[_0xa572('0x86')]);}else{_0x19f721[_0xa572('0x84')]='';}var _0x3bcda2=_0x4ef9a8[_0xa572('0x7e')]===_0xa572('0x87')?'eu':_0xa572('0x88');return getAccessToken(_0x4ef9a8)[_0xa572('0x27')](function(_0xfb4d07){_0x4d04fa=_0xfb4d07;return getUser(_0x4d04fa,_0x3bcda2,_0x4ef9a8,_0x27c691['email']);})['then'](function(_0x127842){_0x5f309f=_0x127842;logger['info'](_0xa572('0x89'),_0x5f309f['id']);return getEndUser(_0x4d04fa,_0x3bcda2,_0x4ef9a8,_0x19f721['calleridname'],_0x19f721[_0xa572('0x8a')],_0x5f309f,_0x1a4d47);})[_0xa572('0x27')](function(_0x1f00c6){_0x4c6ddd=_0x1f00c6;return getCall(_0x4d04fa,_0x3bcda2,_0x4ef9a8,_0x5f309f,_0x4c6ddd,_0x1a4d47,_0x19f721,_0xa572('0x74'));})['then'](function(_0x209ddf){if(_0x209ddf){logger[_0xa572('0x2d')]('The\x20Call\x20ID\x20is:',_0x209ddf['id']);logger[_0xa572('0x2d')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa572('0x8b'),_0x27c691[_0xa572('0x17')]),_0xa572('0x8c'),{'uri':_0xa572('0x8d')+_0x4ef9a8['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x209ddf['id']});}})[_0xa572('0x2a')](function(_0x20d72b){logger[_0xa572('0x2b')](_0xa572('0x82'),JSON[_0xa572('0x3a')](_0x20d72b));});};exports['outbound']=function(_0x10c00b,_0x872120,_0x387b03,_0x1a167b,_0x2a6d04,_0x58114b,_0x2d77cb){var _0x488360,_0x22568a,_0x2d1f05;_0x58114b[_0xa572('0x7e')]=intUtil[_0xa572('0x7f')](_0x58114b['host']);_0x58114b[_0xa572('0x80')]=intUtil[_0xa572('0x7f')](_0x58114b[_0xa572('0x80')]);if(_0x2d77cb&&_0x2d77cb[_0xa572('0x8e')]&&_0x2d77cb[_0xa572('0x8e')]!=='none'){logger[_0xa572('0x2d')](_0xa572('0x8f'),_0xa572('0x83'));_0x872120['recordingURL']=_0x58114b[_0xa572('0x80')]+_0xa572('0x85')+_0x872120['uniqueid']+_0xa572('0x90')+md5(_0x872120[_0xa572('0x86')]);}var _0xbc33bf=_0x58114b[_0xa572('0x7e')]==='zoho.eu'?'eu':_0xa572('0x88');return getAccessToken(_0x58114b)[_0xa572('0x27')](function(_0x5f18b7){_0x2d1f05=_0x5f18b7;return getUser(_0x2d1f05,_0xbc33bf,_0x58114b,_0x1a167b[_0xa572('0x91')]);})[_0xa572('0x27')](function(_0x5c0a70){_0x488360=_0x5c0a70;logger[_0xa572('0x2d')]('The\x20User\x20ID\x20is:',_0x488360['id']);return getEndUser(_0x2d1f05,_0xbc33bf,_0x58114b,_0x872120[_0xa572('0x92')],_0x872120[_0xa572('0x93')],_0x488360,_0x387b03);})[_0xa572('0x27')](function(_0x4a47b1){_0x22568a=_0x4a47b1;return getCall(_0x2d1f05,_0xbc33bf,_0x58114b,_0x488360,_0x22568a,_0x387b03,_0x872120,_0xa572('0x94'));})[_0xa572('0x27')](function(_0x121a4e){if(_0x121a4e){logger['info'](_0xa572('0x95'),_0x121a4e['id']);logger[_0xa572('0x2d')]('[OUTBOUND]',_0xa572('0x96'));emit(util[_0xa572('0x30')](_0xa572('0x8b'),_0x1a167b['name']),_0xa572('0x8c'),{'uri':_0xa572('0x8d')+_0x58114b[_0xa572('0x7e')]+_0xa572('0x97')+_0x121a4e['id']});}})[_0xa572('0x2a')](function(_0x4576b9){logger[_0xa572('0x2b')](_0xa572('0x8f'),JSON[_0xa572('0x3a')](_0x4576b9));});};exports[_0xa572('0x98')]=function(_0x48566a,_0x556db6,_0x3f5caa,_0x468f8b,_0x388e30,_0x514fe5){var _0x5776d7,_0x44edeb,_0x2d4ad6;_0x514fe5[_0xa572('0x7e')]=intUtil[_0xa572('0x7f')](_0x514fe5['host']);_0x514fe5['serverUrl']=intUtil[_0xa572('0x7f')](_0x514fe5[_0xa572('0x80')]);if(_0x388e30&&_0x388e30[_0xa572('0x81')]){logger[_0xa572('0x2d')]('['+_0x556db6[_0xa572('0x69')][_0xa572('0x99')]()+']',_0xa572('0x83'));_0x556db6[_0xa572('0x84')]=_0x514fe5[_0xa572('0x80')]+_0xa572('0x85')+_0x556db6[_0xa572('0x86')]+_0xa572('0x90')+md5(_0x556db6[_0xa572('0x86')]);}else{_0x556db6['recordingURL']='';}var _0x362106=_0x514fe5[_0xa572('0x7e')]===_0xa572('0x87')?'eu':_0xa572('0x88');return getAccessToken(_0x514fe5)[_0xa572('0x27')](function(_0x23095f){_0x2d4ad6=_0x23095f;return getUser(_0x2d4ad6,_0x362106,_0x514fe5);})[_0xa572('0x27')](function(_0x1f0e80){_0x5776d7=_0x1f0e80;logger['info'](_0xa572('0x89'),_0x5776d7['id']);return getEndUser(_0x2d4ad6,_0x362106,_0x514fe5,_0x556db6['calleridname'],_0x556db6[_0xa572('0x8a')],_0x5776d7,_0x3f5caa);})['then'](function(_0x30c1fa){_0x44edeb=_0x30c1fa;return getCall(_0x2d4ad6,_0x362106,_0x514fe5,_0x5776d7,_0x44edeb,_0x3f5caa,_0x556db6,_0xa572('0x74'));})[_0xa572('0x27')](function(_0x5b9676){if(_0x5b9676){logger[_0xa572('0x2d')]('The\x20Call\x20ID\x20is:',_0x5b9676['id']);}})[_0xa572('0x2a')](function(_0x44e160){logger[_0xa572('0x2b')]('['+_0x556db6['lastevent'][_0xa572('0x99')]()+']',JSON['stringify'](_0x44e160));});}; \ 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 3e521cf..ad2c3b8 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 _0x48da=['trigger','exec','data2','Script','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger'];(function(_0x22e279,_0x1996fb){var _0x3c0af6=function(_0x461a2e){while(--_0x461a2e){_0x22e279['push'](_0x22e279['shift']());}};_0x3c0af6(++_0x1996fb);}(_0x48da,0xee));var _0xa48d=function(_0xcd5f58,_0x2271d7){_0xcd5f58=_0xcd5f58-0x0;var _0x394039=_0x48da[_0xcd5f58];return _0x394039;};'use strict';var util=require(_0xa48d('0x0'));var sh=require(_0xa48d('0x1'));var Mustache=require(_0xa48d('0x2'));var logger=require(_0xa48d('0x3'))(_0xa48d('0x4'));exports[_0xa48d('0x5')]=function(_0x142d9e,_0x2f6825){var _0x126bb0=_0x142d9e[_0xa48d('0x6')]?_0x142d9e[_0xa48d('0x6')]:_0xa48d('0x7');var _0x4cff78=_0x142d9e['data3']?Mustache['render'](_0x142d9e['data3'],_0x2f6825):_0x2f6825;sh[_0xa48d('0x5')](_0x4cff78,function(_0x58c84c,_0x357f0a,_0xb8c531){if(_0x58c84c!==0x0){logger['error'](util[_0xa48d('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x126bb0,_0x4cff78,_0x58c84c,_0xb8c531));}else{logger[_0xa48d('0x9')](util['format'](_0xa48d('0xa'),_0x126bb0,_0x4cff78,_0x357f0a));}});}; \ No newline at end of file +var _0xd176=['data2','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','shelljs','mustache','../../../../config/logger','trigger','exec'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd176,0xec));var _0x6d17=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xd176[_0x4bacb6];return _0x58c029;};'use strict';var util=require(_0x6d17('0x0'));var sh=require(_0x6d17('0x1'));var Mustache=require(_0x6d17('0x2'));var logger=require(_0x6d17('0x3'))(_0x6d17('0x4'));exports[_0x6d17('0x5')]=function(_0x9848be,_0x20fb37){var _0x2d68d2=_0x9848be[_0x6d17('0x6')]?_0x9848be[_0x6d17('0x6')]:'Script';var _0x32bc8e=_0x9848be['data3']?Mustache['render'](_0x9848be['data3'],_0x20fb37):_0x20fb37;sh['exec'](_0x32bc8e,function(_0x592f49,_0x175b14,_0x1dbd87){if(_0x592f49!==0x0){logger['error'](util[_0x6d17('0x7')](_0x6d17('0x8'),_0x2d68d2,_0x32bc8e,_0x592f49,_0x1dbd87));}else{logger[_0x6d17('0x9')](util['format'](_0x6d17('0xa'),_0x2d68d2,_0x32bc8e,_0x175b14));}});}; \ 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 f1cb516..a7f19cd 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 _0x5752=['headers','parse','data6','data1','GET','POST','PUT','data7','body','stack','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','error','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','exec','toUpperCase','render','data2','data5','number'];(function(_0xf67fa7,_0x3dbf9e){var _0xd2e6d7=function(_0x3ade7e){while(--_0x3ade7e){_0xf67fa7['push'](_0xf67fa7['shift']());}};_0xd2e6d7(++_0x3dbf9e);}(_0x5752,0xbb));var _0x2575=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x5752[_0x2d2c16];return _0x53f2fb;};'use strict';var rp=require(_0x2575('0x0'));var util=require(_0x2575('0x1'));var _=require(_0x2575('0x2'));var Mustache=require(_0x2575('0x3'));var logger=require('../../../../config/logger')(_0x2575('0x4'));exports[_0x2575('0x5')]=function(_0x3dc944,_0x27c93b){var _0x528763,_0x4e41bc;var _0xf7bbfa={'method':_0x3dc944['data1'][_0x2575('0x6')](),'uri':Mustache[_0x2575('0x7')](_0x3dc944[_0x2575('0x8')],_0x27c93b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3dc944[_0x2575('0x9')])===_0x2575('0xa')&&parseInt(_0x3dc944['data5'])>=0x1&&parseInt(_0x3dc944[_0x2575('0x9')])<=0xa?parseInt(_0x3dc944['data5'])*0x3e8:0x5*0x3e8};try{_0xf7bbfa[_0x2575('0xb')]=_0x3dc944['data6']?JSON[_0x2575('0xc')](Mustache['render'](_0x3dc944[_0x2575('0xd')],_0x27c93b)):{};}catch(_0x1c9e6f){logger['error'](_0x1c9e6f['stack']);}switch(_0x3dc944[_0x2575('0xe')][_0x2575('0x6')]()){case _0x2575('0xf'):case'DELETE':_0x528763=null;_0xf7bbfa['qs']=_0x27c93b;break;case _0x2575('0x10'):case _0x2575('0x11'):if(_0x3dc944[_0x2575('0x12')]){try{_0x528763=JSON['parse'](Mustache[_0x2575('0x7')](_0x3dc944[_0x2575('0x12')],_0x27c93b));_0xf7bbfa[_0x2575('0x13')]=_0x528763;}catch(_0x59e43e){logger['error'](_0x59e43e[_0x2575('0x14')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x528763=_0x27c93b;_0xf7bbfa[_0x2575('0x13')]=_0x528763;}break;}logger[_0x2575('0x15')](util[_0x2575('0x16')](_0x2575('0x17'),_0x3dc944['data1'],_0x3dc944[_0x2575('0x8')],JSON['stringify'](_0xf7bbfa)));rp(_0xf7bbfa)['then'](function(_0x5c682b){_0x528763=!_[_0x2575('0x18')](_0x528763)?',\x20request\x20body:\x20'+_0x528763:'';_0x4e41bc=typeof _0x5c682b[_0x2575('0x13')]===_0x2575('0x19')?JSON[_0x2575('0x1a')](_0x5c682b[_0x2575('0x13')]):_0x5c682b[_0x2575('0x13')];logger[_0x2575('0x15')](util[_0x2575('0x16')](_0x2575('0x1b'),_0x3dc944[_0x2575('0xe')],_0x3dc944['data2'],_0x5c682b[_0x2575('0x1c')],_0x4e41bc));})['catch'](function(_0x4e3876){logger[_0x2575('0x1d')](util['format'](_0x2575('0x1e'),_0x3dc944['data1'],_0x3dc944[_0x2575('0x8')],_0x4e3876[_0x2575('0x1c')],_0x4e3876[_0x2575('0x1f')],_0x4e3876[_0x2575('0x20')]));});}; \ No newline at end of file +var _0x8fe1=['isNil',',\x20request\x20body:\x20','format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','trigger','exec','data1','toUpperCase','render','number','data5','headers','data6','parse','error','stack','GET','POST','PUT','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then'];(function(_0x5a4e94,_0x33778e){var _0x5ec4ad=function(_0x487838){while(--_0x487838){_0x5a4e94['push'](_0x5a4e94['shift']());}};_0x5ec4ad(++_0x33778e);}(_0x8fe1,0x116));var _0x18fe=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x8fe1[_0xf16b1];return _0x26f94d;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x18fe('0x0'));exports[_0x18fe('0x1')]=function(_0x2f3297,_0x36e495){var _0xa5f429,_0x24339e;var _0x1634e1={'method':_0x2f3297[_0x18fe('0x2')][_0x18fe('0x3')](),'uri':Mustache[_0x18fe('0x4')](_0x2f3297['data2'],_0x36e495),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2f3297['data5'])===_0x18fe('0x5')&&parseInt(_0x2f3297[_0x18fe('0x6')])>=0x1&&parseInt(_0x2f3297['data5'])<=0xa?parseInt(_0x2f3297['data5'])*0x3e8:0x5*0x3e8};try{_0x1634e1[_0x18fe('0x7')]=_0x2f3297[_0x18fe('0x8')]?JSON[_0x18fe('0x9')](Mustache[_0x18fe('0x4')](_0x2f3297[_0x18fe('0x8')],_0x36e495)):{};}catch(_0x1a01ff){logger[_0x18fe('0xa')](_0x1a01ff[_0x18fe('0xb')]);}switch(_0x2f3297[_0x18fe('0x2')][_0x18fe('0x3')]()){case _0x18fe('0xc'):case'DELETE':_0xa5f429=null;_0x1634e1['qs']=_0x36e495;break;case _0x18fe('0xd'):case _0x18fe('0xe'):if(_0x2f3297[_0x18fe('0xf')]){try{_0xa5f429=JSON[_0x18fe('0x9')](Mustache[_0x18fe('0x4')](_0x2f3297[_0x18fe('0xf')],_0x36e495));_0x1634e1[_0x18fe('0x10')]=_0xa5f429;}catch(_0x4bb75a){logger[_0x18fe('0xa')](_0x4bb75a['stack']);logger[_0x18fe('0xa')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0xa5f429=_0x36e495;_0x1634e1[_0x18fe('0x10')]=_0xa5f429;}break;}logger[_0x18fe('0x11')](util['format'](_0x18fe('0x12'),_0x2f3297['data1'],_0x2f3297[_0x18fe('0x13')],JSON[_0x18fe('0x14')](_0x1634e1)));rp(_0x1634e1)[_0x18fe('0x15')](function(_0x201efb){_0xa5f429=!_[_0x18fe('0x16')](_0xa5f429)?_0x18fe('0x17')+_0xa5f429:'';_0x24339e=typeof _0x201efb[_0x18fe('0x10')]==='object'?JSON['stringify'](_0x201efb[_0x18fe('0x10')]):_0x201efb['body'];logger[_0x18fe('0x11')](util[_0x18fe('0x18')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2f3297[_0x18fe('0x2')],_0x2f3297['data2'],_0x201efb[_0x18fe('0x19')],_0x24339e));})[_0x18fe('0x1a')](function(_0x1b01d0){logger['error'](util[_0x18fe('0x18')](_0x18fe('0x1b'),_0x2f3297[_0x18fe('0x2')],_0x2f3297[_0x18fe('0x13')],_0x1b01d0['statusCode'],_0x1b01d0[_0x18fe('0x1c')],_0x1b01d0[_0x18fe('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 25ab57f..eb6cb75 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 _0x76f1=['client','http','request','rpc','error','message','result','catch','exports','jayson/promise','../../config/logger','routing'];(function(_0x39f331,_0xe550f){var _0x348d48=function(_0x2f87b5){while(--_0x2f87b5){_0x39f331['push'](_0x39f331['shift']());}};_0x348d48(++_0xe550f);}(_0x76f1,0xe1));var _0x176f=function(_0x2ff0b7,_0x4caee3){_0x2ff0b7=_0x2ff0b7-0x0;var _0x71165f=_0x76f1[_0x2ff0b7];return _0x71165f;};'use strict';var jayson=require(_0x176f('0x0'));var BPromise=require('bluebird');var logger=require(_0x176f('0x1'))(_0x176f('0x2'));var client=jayson[_0x176f('0x3')][_0x176f('0x4')]({'port':0x2329});client['Request']=function(_0x3413ac,_0x39e116){return new BPromise(function(_0x41ed21,_0x4a7dfa){return client[_0x176f('0x5')](_0x3413ac,_0x39e116)['then'](function(_0x49cca6){logger['debug'](_0x176f('0x6'),'routing',_0x3413ac,_0x39e116,_0x49cca6);if(_0x49cca6[_0x176f('0x7')]){logger[_0x176f('0x7')](_0x176f('0x6'),'routing',_0x3413ac,_0x49cca6[_0x176f('0x7')][_0x176f('0x8')],_0x39e116);return _0x4a7dfa(_0x49cca6['error'][_0x176f('0x8')]);}else{return _0x41ed21(_0x49cca6[_0x176f('0x9')]);}})[_0x176f('0xa')](function(_0xe4dad8){logger[_0x176f('0x7')]('rpc','routing',_0x3413ac,_0xe4dad8,_0x39e116);return _0x4a7dfa(_0xe4dad8);});});};module[_0x176f('0xb')]=client; \ No newline at end of file +var _0xaa9e=['../../config/logger','client','Request','request','debug','routing','rpc','message','error','result','catch','exports','jayson/promise','bluebird'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0xaa9e,0x132));var _0xeaa9=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0xaa9e[_0x296809];return _0x18c0d3;};'use strict';var jayson=require(_0xeaa9('0x0'));var BPromise=require(_0xeaa9('0x1'));var logger=require(_0xeaa9('0x2'))('routing');var client=jayson[_0xeaa9('0x3')]['http']({'port':0x2329});client[_0xeaa9('0x4')]=function(_0x10bc92,_0x2b6948){return new BPromise(function(_0x46fa84,_0x8e3acc){return client[_0xeaa9('0x5')](_0x10bc92,_0x2b6948)['then'](function(_0x485c61){logger[_0xeaa9('0x6')]('rpc',_0xeaa9('0x7'),_0x10bc92,_0x2b6948,_0x485c61);if(_0x485c61['error']){logger['error'](_0xeaa9('0x8'),_0xeaa9('0x7'),_0x10bc92,_0x485c61['error'][_0xeaa9('0x9')],_0x2b6948);return _0x8e3acc(_0x485c61[_0xeaa9('0xa')]['message']);}else{return _0x46fa84(_0x485c61[_0xeaa9('0xb')]);}})[_0xeaa9('0xc')](function(_0x364f06){logger['error'](_0xeaa9('0x8'),_0xeaa9('0x7'),_0x10bc92,_0x364f06,_0x2b6948);return _0x8e3acc(_0x364f06);});});};module[_0xeaa9('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e9d5db2..ef6e77d 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 _0x1142=['catch','error','Email\x20service\x20initialization','./server','./rpc/setting','email','resolve','getMailAccounts','initMailAccounts','then','refresh','mailAccounts','listen','loginMailFrequency'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x1142,0x153));var _0x2114=function(_0xe5ba98,_0x1065e5){_0xe5ba98=_0xe5ba98-0x0;var _0x4a4704=_0x1142[_0xe5ba98];return _0x4a4704;};'use strict';var server=require(_0x2114('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0x2114('0x1'));var logger=require('../../config/logger')(_0x2114('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2114('0x3')]()['then'](mailAccount[_0x2114('0x4')]())['then'](realtime[_0x2114('0x5')]())[_0x2114('0x6')](function(){email[_0x2114('0x7')](realtime[_0x2114('0x8')]);return realtime;});}function main(){return server[_0x2114('0x9')](realtime,email)[_0x2114('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x2114('0x6')](function(_0x5a1f8c){return setInterval(initRealtime,_0x5a1f8c[_0x2114('0xa')]*0x3e8);})[_0x2114('0xb')](function(_0xe63f4c){logger[_0x2114('0xc')](_0x2114('0xd'),_0xe63f4c);});}main(); \ No newline at end of file +var _0x7a89=['../../config/logger','email','then','initMailAccounts','mailAccounts','listen','error','Email\x20service\x20initialization','./realtime','./rpc/mailAccount'];(function(_0x31213c,_0x2d3d13){var _0x144282=function(_0x4edb00){while(--_0x4edb00){_0x31213c['push'](_0x31213c['shift']());}};_0x144282(++_0x2d3d13);}(_0x7a89,0x184));var _0x97a8=function(_0x4496d4,_0x35a23c){_0x4496d4=_0x4496d4-0x0;var _0x549149=_0x7a89[_0x4496d4];return _0x549149;};'use strict';var server=require('./server');var Realtime=require(_0x97a8('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x97a8('0x1'));var setting=require('./rpc/setting');var logger=require(_0x97a8('0x2'))(_0x97a8('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x97a8('0x4')](mailAccount['getMailAccounts']())['then'](realtime[_0x97a8('0x5')]())['then'](function(){email['refresh'](realtime[_0x97a8('0x6')]);return realtime;});}function main(){return server[_0x97a8('0x7')](realtime,email)[_0x97a8('0x4')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x97a8('0x4')](function(_0xc22f17){return setInterval(initRealtime,_0xc22f17['loginMailFrequency']*0x3e8);})['catch'](function(_0x2a3272){logger[_0x97a8('0x8')](_0x97a8('0x9'),_0x2a3272);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 2c98f8e..104ba97 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 _0xed0f=['md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','hasOwnProperty','service','provider','custom','email','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','Smtp','lastSync','verify','verified','lodash','bluebird'];(function(_0x56007e,_0x14b813){var _0x192962=function(_0x4949d1){while(--_0x4949d1){_0x56007e['push'](_0x56007e['shift']());}};_0x192962(++_0x14b813);}(_0xed0f,0x107));var _0xfed0=function(_0x2231fe,_0x43f533){_0x2231fe=_0x2231fe-0x0;var _0x386277=_0xed0f[_0x2231fe];return _0x386277;};'use strict';var _=require(_0xfed0('0x0'));var moment=require('moment');var BPromise=require(_0xfed0('0x1'));var md5=require(_0xfed0('0x2'));var Redis=require(_0xfed0('0x3'));var config=require(_0xfed0('0x4'));var logger=require(_0xfed0('0x5'))('email');config[_0xfed0('0x6')]=_[_0xfed0('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfed0('0x8'))(new Redis(config[_0xfed0('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xfed0('0x9'));var md5Accounts={};function EmailChannel(_0x556c12){logger[_0xfed0('0xa')](_0xfed0('0xb'));this[_0xfed0('0xc')]=_0x556c12[_0xfed0('0xc')];this[_0xfed0('0xd')]={};this[_0xfed0('0xe')]=new EmailSmtp();}EmailChannel[_0xfed0('0xf')][_0xfed0('0x10')]=function(_0x4baaf0){var _0x2552d=this['mailAccounts'][_0x4baaf0];var _0x246a8c={'id':_0x2552d['id'],'name':_0x2552d[_0xfed0('0x11')],'key':_0x2552d[_0xfed0('0x12')],'active':_0x2552d[_0xfed0('0x13')],'Imap':{'status':_0x2552d[_0xfed0('0x14')][_0xfed0('0x15')],'messageStatus':_0x2552d[_0xfed0('0x14')][_0xfed0('0x16')],'total':_0x2552d[_0xfed0('0x14')]['total']}};if(_[_0xfed0('0x17')](md5Accounts[_0x4baaf0])){md5Accounts[_0x4baaf0]={};}var _0x25840a=md5(JSON[_0xfed0('0x18')](_0x246a8c));if(md5Accounts[_0x4baaf0]['md5']!==_0x25840a){md5Accounts[_0x4baaf0]['md5']=_0x25840a;io[_0xfed0('0x10')](_0xfed0('0x19'),_0x246a8c);}};EmailChannel[_0xfed0('0xf')]['refresh']=function(_0x17cb67){for(var _0x51a50a in _0x17cb67){if(_0x17cb67[_0xfed0('0x1a')](_0x51a50a)){if(_0x17cb67[_0x51a50a]['Imap']&&_0x17cb67[_0x51a50a]['active']){var _0x301a21=_0x17cb67[_0x51a50a]['Imap'];if(!_0x301a21[_0xfed0('0x1b')]&&_0x17cb67[_0x51a50a][_0xfed0('0x1c')]!==_0xfed0('0x1d'))_0x301a21['service']=_0x17cb67[_0x51a50a][_0xfed0('0x1c')];if(!this[_0xfed0('0xd')]['hasOwnProperty'](_0x301a21['id'])){this[_0xfed0('0xd')][_0x301a21['id']]=new EmailImap(_0x301a21,_0x17cb67[_0x51a50a][_0xfed0('0x1e')]);this[_0xfed0('0xd')][_0x301a21['id']]['on'](_0xfed0('0x1f'),this[_0xfed0('0x20')][_0xfed0('0x21')](this,_0x51a50a));this[_0xfed0('0xd')][_0x301a21['id']]['on'](_0xfed0('0x1e'),this['handleImapEmail']['bind'](this,_0x51a50a));this['imapAccounts'][_0x301a21['id']]['on'](_0xfed0('0x22'),this[_0xfed0('0x23')][_0xfed0('0x21')](this,_0x51a50a));this[_0xfed0('0xd')][_0x301a21['id']]['on'](_0xfed0('0x24'),this[_0xfed0('0x25')][_0xfed0('0x21')](this,_0x51a50a));}}else{if(_['isNil'](this[_0xfed0('0xc')][_0x51a50a][_0xfed0('0x14')])){this['mailAccounts'][_0x51a50a][_0xfed0('0x14')]={};}this[_0xfed0('0xc')][_0x51a50a][_0xfed0('0x14')][_0xfed0('0x15')]='disabled';this['mailAccounts'][_0x51a50a][_0xfed0('0x14')][_0xfed0('0x16')]='';this[_0xfed0('0x10')](_0x51a50a);}}}};EmailChannel[_0xfed0('0xf')][_0xfed0('0x20')]=function(_0x1abd39,_0x222cbb){if(this[_0xfed0('0xc')][_0x1abd39]){this[_0xfed0('0xc')][_0x1abd39][_0xfed0('0x14')][_0xfed0('0x15')]='connected';this[_0xfed0('0xc')][_0x1abd39][_0xfed0('0x14')]['messageStatus']=_0x222cbb['name'];if(_0x222cbb[_0xfed0('0x26')]){this[_0xfed0('0xc')][_0x1abd39][_0xfed0('0x14')][_0xfed0('0x27')]=_0x222cbb[_0xfed0('0x26')][_0xfed0('0x27')];}return this[_0xfed0('0x10')](_0x1abd39);}};EmailChannel['prototype']['handleImapEmail']=function(_0x16e68b,_0x30d4a7){logger[_0xfed0('0xa')](_0xfed0('0x28'),_0x30d4a7[_0xfed0('0x29')],_0x30d4a7['lastName'],_0x30d4a7[_0xfed0('0x2a')],_0x16e68b);if(this[_0xfed0('0xc')][_0x16e68b]){return mailAccount[_0xfed0('0x2b')](_0x16e68b,_0x30d4a7)[_0xfed0('0x2c')](function(_0x584ec0){if(_0x584ec0){logger[_0xfed0('0xa')](_0xfed0('0x2d'));}})[_0xfed0('0x2e')](function(_0x3163c8){logger[_0xfed0('0x24')](_0xfed0('0x2f'),JSON[_0xfed0('0x18')](_0x3163c8));});}};EmailChannel['prototype'][_0xfed0('0x23')]=function(_0x523fd6){if(this['mailAccounts'][_0x523fd6]&&this[_0xfed0('0xc')][_0x523fd6][_0xfed0('0x14')]){if(this['imapAccounts'][this['mailAccounts'][_0x523fd6][_0xfed0('0x14')]['id']]){delete this[_0xfed0('0xd')][this['mailAccounts'][_0x523fd6][_0xfed0('0x14')]['id']];}this[_0xfed0('0xc')][_0x523fd6][_0xfed0('0x14')]['lastSync']=moment();this[_0xfed0('0x10')](_0x523fd6);}};EmailChannel[_0xfed0('0xf')][_0xfed0('0x25')]=function(_0x36db6b,_0x560cf0){if(this[_0xfed0('0xc')][_0x36db6b]){this[_0xfed0('0xc')][_0x36db6b][_0xfed0('0x14')][_0xfed0('0x15')]='error';this[_0xfed0('0xc')][_0x36db6b][_0xfed0('0x14')]['messageStatus']=_0x560cf0;return this['emit'](_0x36db6b);}};EmailChannel[_0xfed0('0xf')][_0xfed0('0x30')]=function(_0x5c4fbd,_0x5e182f){return this[_0xfed0('0xe')]['send'](_0x5c4fbd,_0x5e182f);};EmailChannel[_0xfed0('0xf')]['verifySmtp']=function(_0x2f6ec8){var _0x28d8f8=this;if(this['mailAccounts'][_0x2f6ec8['id']]){if(_[_0xfed0('0x17')](this[_0xfed0('0xc')][_0x2f6ec8['id']]['Smtp'])){this[_0xfed0('0xc')][_0x2f6ec8['id']][_0xfed0('0x31')]={};}this['mailAccounts'][_0x2f6ec8['id']]['Smtp'][_0xfed0('0x32')]=moment();return new BPromise(function(_0x129f7c,_0x176622){return _0x28d8f8[_0xfed0('0xe')][_0xfed0('0x33')](_0x2f6ec8)[_0xfed0('0x2c')](function(_0x4eb4fe){_0x28d8f8['mailAccounts'][_0x2f6ec8['id']][_0xfed0('0x31')][_0xfed0('0x15')]=_0xfed0('0x34');_0x28d8f8[_0xfed0('0xc')][_0x2f6ec8['id']][_0xfed0('0x31')][_0xfed0('0x16')]='';_0x28d8f8[_0xfed0('0x10')](_0x2f6ec8['id']);_0x129f7c(_0x4eb4fe);})[_0xfed0('0x2e')](function(_0x45f43a){_0x28d8f8[_0xfed0('0xc')][_0x2f6ec8['id']]['Smtp'][_0xfed0('0x15')]='error';_0x28d8f8[_0xfed0('0xc')][_0x2f6ec8['id']][_0xfed0('0x31')][_0xfed0('0x16')]=_0x45f43a;_0x28d8f8[_0xfed0('0x10')](_0x2f6ec8['id']);_0x176622(_0x45f43a);});});}return this['smtp'][_0xfed0('0x33')](_0x2f6ec8);};module['exports']=EmailChannel; \ No newline at end of file +var _0x5253=['handleImapError','disabled','connected','messages','handleImapEmail','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','verified','smtp','lodash','bluebird','ioredis','defaults','localhost','socket.io-emitter','redis','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','email','box','handleImapBox','bind','end','handleImapEnd','error'];(function(_0x3b1502,_0xa23e9d){var _0x1c8537=function(_0x3c05f1){while(--_0x3c05f1){_0x3b1502['push'](_0x3b1502['shift']());}};_0x1c8537(++_0xa23e9d);}(_0x5253,0xbb));var _0x3525=function(_0x2a5443,_0x1b57d6){_0x2a5443=_0x2a5443-0x0;var _0x545a0b=_0x5253[_0x2a5443];return _0x545a0b;};'use strict';var _=require(_0x3525('0x0'));var moment=require('moment');var BPromise=require(_0x3525('0x1'));var md5=require('md5');var Redis=require(_0x3525('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('email');config['redis']=_[_0x3525('0x3')](config['redis'],{'host':_0x3525('0x4'),'port':0x18eb});var io=require(_0x3525('0x5'))(new Redis(config[_0x3525('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x3525('0x7'));var md5Accounts={};function EmailChannel(_0x58072d){logger[_0x3525('0x8')](_0x3525('0x9'));this['mailAccounts']=_0x58072d[_0x3525('0xa')];this[_0x3525('0xb')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x3525('0xc')][_0x3525('0xd')]=function(_0x40bc67){var _0x36bec7=this['mailAccounts'][_0x40bc67];var _0x55628c={'id':_0x36bec7['id'],'name':_0x36bec7[_0x3525('0xe')],'key':_0x36bec7[_0x3525('0xf')],'active':_0x36bec7[_0x3525('0x10')],'Imap':{'status':_0x36bec7['Imap'][_0x3525('0x11')],'messageStatus':_0x36bec7[_0x3525('0x12')][_0x3525('0x13')],'total':_0x36bec7[_0x3525('0x12')][_0x3525('0x14')]}};if(_[_0x3525('0x15')](md5Accounts[_0x40bc67])){md5Accounts[_0x40bc67]={};}var _0x4b1af1=md5(JSON[_0x3525('0x16')](_0x55628c));if(md5Accounts[_0x40bc67][_0x3525('0x17')]!==_0x4b1af1){md5Accounts[_0x40bc67]['md5']=_0x4b1af1;io[_0x3525('0xd')](_0x3525('0x18'),_0x55628c);}};EmailChannel[_0x3525('0xc')][_0x3525('0x19')]=function(_0x31d89a){for(var _0x18f470 in _0x31d89a){if(_0x31d89a[_0x3525('0x1a')](_0x18f470)){if(_0x31d89a[_0x18f470][_0x3525('0x12')]&&_0x31d89a[_0x18f470][_0x3525('0x10')]){var _0x57f2be=_0x31d89a[_0x18f470][_0x3525('0x12')];if(!_0x57f2be[_0x3525('0x1b')]&&_0x31d89a[_0x18f470][_0x3525('0x1c')]!==_0x3525('0x1d'))_0x57f2be[_0x3525('0x1b')]=_0x31d89a[_0x18f470]['provider'];if(!this[_0x3525('0xb')][_0x3525('0x1a')](_0x57f2be['id'])){this[_0x3525('0xb')][_0x57f2be['id']]=new EmailImap(_0x57f2be,_0x31d89a[_0x18f470][_0x3525('0x1e')]);this[_0x3525('0xb')][_0x57f2be['id']]['on'](_0x3525('0x1f'),this[_0x3525('0x20')][_0x3525('0x21')](this,_0x18f470));this['imapAccounts'][_0x57f2be['id']]['on']('email',this['handleImapEmail']['bind'](this,_0x18f470));this[_0x3525('0xb')][_0x57f2be['id']]['on'](_0x3525('0x22'),this[_0x3525('0x23')][_0x3525('0x21')](this,_0x18f470));this[_0x3525('0xb')][_0x57f2be['id']]['on'](_0x3525('0x24'),this[_0x3525('0x25')][_0x3525('0x21')](this,_0x18f470));}}else{if(_[_0x3525('0x15')](this['mailAccounts'][_0x18f470][_0x3525('0x12')])){this[_0x3525('0xa')][_0x18f470][_0x3525('0x12')]={};}this[_0x3525('0xa')][_0x18f470][_0x3525('0x12')][_0x3525('0x11')]=_0x3525('0x26');this[_0x3525('0xa')][_0x18f470][_0x3525('0x12')][_0x3525('0x13')]='';this[_0x3525('0xd')](_0x18f470);}}}};EmailChannel[_0x3525('0xc')][_0x3525('0x20')]=function(_0x37c968,_0x1896c4){if(this['mailAccounts'][_0x37c968]){this[_0x3525('0xa')][_0x37c968][_0x3525('0x12')]['status']=_0x3525('0x27');this[_0x3525('0xa')][_0x37c968]['Imap'][_0x3525('0x13')]=_0x1896c4[_0x3525('0xe')];if(_0x1896c4[_0x3525('0x28')]){this[_0x3525('0xa')][_0x37c968][_0x3525('0x12')]['total']=_0x1896c4[_0x3525('0x28')][_0x3525('0x14')];}return this[_0x3525('0xd')](_0x37c968);}};EmailChannel[_0x3525('0xc')][_0x3525('0x29')]=function(_0x29de7a,_0x8884af){logger[_0x3525('0x8')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x8884af[_0x3525('0x2a')],_0x8884af['lastName'],_0x8884af[_0x3525('0x2b')],_0x29de7a);if(this[_0x3525('0xa')][_0x29de7a]){return mailAccount[_0x3525('0x2c')](_0x29de7a,_0x8884af)[_0x3525('0x2d')](function(_0x4819e6){if(_0x4819e6){logger[_0x3525('0x8')](_0x3525('0x2e'));}})[_0x3525('0x2f')](function(_0x5b3d18){logger[_0x3525('0x24')](_0x3525('0x30'),JSON[_0x3525('0x16')](_0x5b3d18));});}};EmailChannel[_0x3525('0xc')][_0x3525('0x23')]=function(_0x55ae9b){if(this['mailAccounts'][_0x55ae9b]&&this[_0x3525('0xa')][_0x55ae9b][_0x3525('0x12')]){if(this['imapAccounts'][this[_0x3525('0xa')][_0x55ae9b][_0x3525('0x12')]['id']]){delete this['imapAccounts'][this[_0x3525('0xa')][_0x55ae9b][_0x3525('0x12')]['id']];}this[_0x3525('0xa')][_0x55ae9b][_0x3525('0x12')][_0x3525('0x31')]=moment();this[_0x3525('0xd')](_0x55ae9b);}};EmailChannel[_0x3525('0xc')][_0x3525('0x25')]=function(_0x1569e2,_0x4f00f7){if(this['mailAccounts'][_0x1569e2]){this[_0x3525('0xa')][_0x1569e2][_0x3525('0x12')][_0x3525('0x11')]='error';this[_0x3525('0xa')][_0x1569e2][_0x3525('0x12')][_0x3525('0x13')]=_0x4f00f7;return this[_0x3525('0xd')](_0x1569e2);}};EmailChannel[_0x3525('0xc')][_0x3525('0x32')]=function(_0x58dbb5,_0x1d76e5){return this['smtp'][_0x3525('0x33')](_0x58dbb5,_0x1d76e5);};EmailChannel[_0x3525('0xc')]['verifySmtp']=function(_0x38fe31){var _0x2bf16e=this;if(this[_0x3525('0xa')][_0x38fe31['id']]){if(_[_0x3525('0x15')](this[_0x3525('0xa')][_0x38fe31['id']][_0x3525('0x34')])){this[_0x3525('0xa')][_0x38fe31['id']][_0x3525('0x34')]={};}this[_0x3525('0xa')][_0x38fe31['id']]['Smtp'][_0x3525('0x31')]=moment();return new BPromise(function(_0x52b1a4,_0x8b6c){return _0x2bf16e['smtp'][_0x3525('0x35')](_0x38fe31)[_0x3525('0x2d')](function(_0x30715c){_0x2bf16e[_0x3525('0xa')][_0x38fe31['id']][_0x3525('0x34')][_0x3525('0x11')]=_0x3525('0x36');_0x2bf16e[_0x3525('0xa')][_0x38fe31['id']][_0x3525('0x34')][_0x3525('0x13')]='';_0x2bf16e[_0x3525('0xd')](_0x38fe31['id']);_0x52b1a4(_0x30715c);})[_0x3525('0x2f')](function(_0x490c27){_0x2bf16e[_0x3525('0xa')][_0x38fe31['id']][_0x3525('0x34')]['status']='error';_0x2bf16e[_0x3525('0xa')][_0x38fe31['id']][_0x3525('0x34')][_0x3525('0x13')]=_0x490c27;_0x2bf16e[_0x3525('0xd')](_0x38fe31['id']);_0x8b6c(_0x490c27);});});}return this[_0x3525('0x37')][_0x3525('0x35')](_0x38fe31);};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 c659c83..89c00bc 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 _0xc1c6=['mailbox','handleOpenBox','emit','box','readUnseen','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','handleSimpleParser','handleMessageEnd','error','parser','textCode','hasOwnProperty','upperFirst','lodash','util','imap','simpleParser','Iconv','events','EventEmitter','email','INBOX','account','getAccount','once','handleReady','bind','handleEnd','handleError','inherits','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','generateXOAuth2Token','data5','password','host','port','tls','autotls','required','prototype','openBox'];(function(_0x30746a,_0x3b3626){var _0x5af371=function(_0x445e6a){while(--_0x445e6a){_0x30746a['push'](_0x30746a['shift']());}};_0x5af371(++_0x3b3626);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x59e3e6,_0x429711){_0x59e3e6=_0x59e3e6-0x0;var _0x38dce5=_0xc1c6[_0x59e3e6];return _0x38dce5;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var Imap=require(_0x6c1c('0x2'));var simpleParser=require('mailparser')[_0x6c1c('0x3')];var Iconv=require('iconv')[_0x6c1c('0x4')];var EventEmitter=require(_0x6c1c('0x5'))[_0x6c1c('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x6c1c('0x7'));function EmailImap(_0x524a6b,_0x50c1bb){this['mailbox']=_0x6c1c('0x8');this[_0x6c1c('0x9')]=this[_0x6c1c('0xa')](_0x524a6b,_0x50c1bb);this[_0x6c1c('0x2')]=new Imap(this['account']);this[_0x6c1c('0x2')][_0x6c1c('0xb')]('ready',this[_0x6c1c('0xc')][_0x6c1c('0xd')](this));this[_0x6c1c('0x2')][_0x6c1c('0xb')]('end',this[_0x6c1c('0xe')][_0x6c1c('0xd')](this));this[_0x6c1c('0x2')]['on']('error',this[_0x6c1c('0xf')][_0x6c1c('0xd')](this));this[_0x6c1c('0x2')]['connect']();}util[_0x6c1c('0x10')](EmailImap,EventEmitter);EmailImap['prototype'][_0x6c1c('0xa')]=function(_0x15a1fc,_0x2d279e){var _0x154107={'connTimeout':_0x15a1fc[_0x6c1c('0x11')]?_0x15a1fc[_0x6c1c('0x11')]*0x3e8:0x2710,'authTimeout':_0x15a1fc[_0x6c1c('0x12')]?_0x15a1fc[_0x6c1c('0x12')]*0x3e8:0x1388};if(_0x15a1fc[_0x6c1c('0x13')]){_0x154107['user']=_0x15a1fc[_0x6c1c('0x14')];_0x154107[_0x6c1c('0x7')]=_0x2d279e||_0x15a1fc['user']||_0x6c1c('0x15');if(_0x15a1fc[_0x6c1c('0x16')]){_0x154107['xoauth2']=utils[_0x6c1c('0x17')](_0x15a1fc['CloudProvider'][_0x6c1c('0x18')],_0x15a1fc[_0x6c1c('0x14')]);}else{_0x154107['password']=_0x15a1fc[_0x6c1c('0x19')];}}else{if(_0x15a1fc['authentication']){_0x154107[_0x6c1c('0x14')]=_0x15a1fc[_0x6c1c('0x14')];_0x154107[_0x6c1c('0x19')]=_0x15a1fc[_0x6c1c('0x19')];}}_0x154107[_0x6c1c('0x1a')]=_0x15a1fc[_0x6c1c('0x1a')];_0x154107[_0x6c1c('0x1b')]=_0x15a1fc[_0x6c1c('0x1b')]||0x3e1;if(_0x15a1fc[_0x6c1c('0x1c')]){_0x154107[_0x6c1c('0x1c')]=!![];}else{_0x154107[_0x6c1c('0x1c')]=![];_0x154107[_0x6c1c('0x1d')]=_0x6c1c('0x1e');}return _0x154107;};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0xc')]=function(){this[_0x6c1c('0x2')][_0x6c1c('0x20')](this[_0x6c1c('0x21')],![],this[_0x6c1c('0x22')][_0x6c1c('0xd')](this));};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0x22')]=function(_0x2ef382,_0x7ff10d){if(_0x2ef382){this[_0x6c1c('0xf')](_0x2ef382,!![]);}else{this[_0x6c1c('0x23')](_0x6c1c('0x24'),_0x7ff10d);this[_0x6c1c('0x25')]();}};EmailImap[_0x6c1c('0x1f')]['handleCloseBox']=function(_0x2595c3){if(_0x2595c3){this['handleError'](_0x2595c3,!![]);}else{this[_0x6c1c('0x2')]['end']();}};EmailImap[_0x6c1c('0x1f')]['readUnseen']=function(){this[_0x6c1c('0x2')][_0x6c1c('0x26')](['UNSEEN'],this[_0x6c1c('0x27')][_0x6c1c('0xd')](this));};EmailImap['prototype'][_0x6c1c('0x27')]=function(_0x19a8f1,_0xdcef7){if(_0x19a8f1){this[_0x6c1c('0xf')](_0x19a8f1,!![]);}else{if(_0xdcef7['length']){try{var _0x52c036=this[_0x6c1c('0x2')][_0x6c1c('0x28')](_0xdcef7,{'bodies':'','markSeen':!![]});_0x52c036['on'](_0x6c1c('0x29'),this[_0x6c1c('0x2a')][_0x6c1c('0xd')](this));_0x52c036[_0x6c1c('0xb')]('error',this[_0x6c1c('0x2b')][_0x6c1c('0xd')](this));_0x52c036['once'](_0x6c1c('0x2c'),this[_0x6c1c('0x2d')][_0x6c1c('0xd')](this));}catch(_0x15b6d2){logger['error'](_0x15b6d2);}}else{this[_0x6c1c('0x2')][_0x6c1c('0x2e')](!![],this[_0x6c1c('0x2f')]['bind'](this));}}};EmailImap[_0x6c1c('0x1f')]['handleFetchMessage']=function(_0x6870a4){_0x6870a4['on']('body',this[_0x6c1c('0x30')][_0x6c1c('0xd')](this));_0x6870a4[_0x6c1c('0xb')]('attributes',this['handleMessageAttributes'][_0x6c1c('0xd')](this));_0x6870a4[_0x6c1c('0xb')](_0x6c1c('0x2c'),this['handleMessageEnd'][_0x6c1c('0xd')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x794e73){simpleParser(_0x794e73,{'Iconv':Iconv},this[_0x6c1c('0x31')][_0x6c1c('0xd')](this));};EmailImap[_0x6c1c('0x1f')]['handleMessageAttributes']=function(){};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0x32')]=function(){};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0x31')]=function(_0x173a54,_0x398e95){if(_0x173a54){logger[_0x6c1c('0x33')](_0x173a54);}else{var _0x988821=this;utils[_0x6c1c('0x34')](this[_0x6c1c('0x9')],_0x398e95,function(_0x47d75e){_0x988821[_0x6c1c('0x23')](_0x6c1c('0x7'),_0x47d75e);});}};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0x2d')]=function(){this[_0x6c1c('0x2')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x6c1c('0x1f')]['handleFetchError']=function(_0x4d7dc6){this[_0x6c1c('0xf')](_0x4d7dc6);this[_0x6c1c('0x2')]['closeBox'](!![],this[_0x6c1c('0x2f')][_0x6c1c('0xd')](this));};EmailImap[_0x6c1c('0x1f')]['handleEnd']=function(){this[_0x6c1c('0x23')](_0x6c1c('0x2c'));};EmailImap['prototype'][_0x6c1c('0xf')]=function(_0x4cc30f,_0x111eb8){logger[_0x6c1c('0x33')](_0x6c1c('0xf'),this[_0x6c1c('0x9')][_0x6c1c('0x7')],JSON['stringify'](_0x4cc30f));var _0x23a8c3='';if(_0x4cc30f){if(_0x4cc30f[_0x6c1c('0x35')]){_0x23a8c3=_0x4cc30f[_0x6c1c('0x35')];}else{for(var _0x5d4058 in _0x4cc30f){if(_0x4cc30f[_0x6c1c('0x36')](_0x5d4058)){_0x23a8c3+=_[_0x6c1c('0x37')](_0x5d4058)+':\x20'+_0x4cc30f[_0x5d4058]+'\x0a';}}}}if(_0x111eb8){this[_0x6c1c('0x2')][_0x6c1c('0x2c')]();}else{this[_0x6c1c('0x23')]('error',_0x23a8c3);this[_0x6c1c('0x23')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x77d4=['textCode','hasOwnProperty','upperFirst','exports','util','mailparser','iconv','Iconv','./utils','../../../config/logger','email','mailbox','getAccount','imap','once','ready','handleReady','bind','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','service','user','anonymous@xcally.com','xoauth2','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','prototype','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','stringify'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x77d4,0x108));var _0x477d=function(_0x251ab0,_0x46e532){_0x251ab0=_0x251ab0-0x0;var _0x11848c=_0x77d4[_0x251ab0];return _0x11848c;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var Imap=require('imap');var simpleParser=require(_0x477d('0x1'))['simpleParser'];var Iconv=require(_0x477d('0x2'))[_0x477d('0x3')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x477d('0x4'));var logger=require(_0x477d('0x5'))(_0x477d('0x6'));function EmailImap(_0x471fca,_0x2545e5){this[_0x477d('0x7')]='INBOX';this['account']=this[_0x477d('0x8')](_0x471fca,_0x2545e5);this['imap']=new Imap(this['account']);this[_0x477d('0x9')][_0x477d('0xa')](_0x477d('0xb'),this[_0x477d('0xc')][_0x477d('0xd')](this));this['imap'][_0x477d('0xa')]('end',this[_0x477d('0xe')][_0x477d('0xd')](this));this['imap']['on'](_0x477d('0xf'),this[_0x477d('0x10')]['bind'](this));this['imap'][_0x477d('0x11')]();}util[_0x477d('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0x477d('0x8')]=function(_0x1d5699,_0x48c73a){var _0x4b2021={'connTimeout':_0x1d5699[_0x477d('0x13')]?_0x1d5699['connTimeout']*0x3e8:0x2710,'authTimeout':_0x1d5699[_0x477d('0x14')]?_0x1d5699[_0x477d('0x14')]*0x3e8:0x1388};if(_0x1d5699[_0x477d('0x15')]){_0x4b2021['user']=_0x1d5699[_0x477d('0x16')];_0x4b2021[_0x477d('0x6')]=_0x48c73a||_0x1d5699[_0x477d('0x16')]||_0x477d('0x17');if(_0x1d5699['modernAuthentication']){_0x4b2021[_0x477d('0x18')]=utils['generateXOAuth2Token'](_0x1d5699[_0x477d('0x19')][_0x477d('0x1a')],_0x1d5699[_0x477d('0x16')]);}else{_0x4b2021[_0x477d('0x1b')]=_0x1d5699[_0x477d('0x1b')];}}else{if(_0x1d5699[_0x477d('0x1c')]){_0x4b2021['user']=_0x1d5699[_0x477d('0x16')];_0x4b2021['password']=_0x1d5699[_0x477d('0x1b')];}}_0x4b2021[_0x477d('0x1d')]=_0x1d5699[_0x477d('0x1d')];_0x4b2021[_0x477d('0x1e')]=_0x1d5699[_0x477d('0x1e')]||0x3e1;if(_0x1d5699[_0x477d('0x1f')]){_0x4b2021[_0x477d('0x1f')]=!![];}else{_0x4b2021[_0x477d('0x1f')]=![];_0x4b2021[_0x477d('0x20')]=_0x477d('0x21');}return _0x4b2021;};EmailImap[_0x477d('0x22')][_0x477d('0xc')]=function(){this[_0x477d('0x9')][_0x477d('0x23')](this['mailbox'],![],this[_0x477d('0x24')]['bind'](this));};EmailImap[_0x477d('0x22')][_0x477d('0x24')]=function(_0x26a4b2,_0x2287b4){if(_0x26a4b2){this['handleError'](_0x26a4b2,!![]);}else{this[_0x477d('0x25')](_0x477d('0x26'),_0x2287b4);this[_0x477d('0x27')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x198697){if(_0x198697){this[_0x477d('0x10')](_0x198697,!![]);}else{this[_0x477d('0x9')]['end']();}};EmailImap[_0x477d('0x22')][_0x477d('0x27')]=function(){this[_0x477d('0x9')][_0x477d('0x28')]([_0x477d('0x29')],this['handleReadUnseen'][_0x477d('0xd')](this));};EmailImap[_0x477d('0x22')][_0x477d('0x2a')]=function(_0x25a329,_0x32c5d7){if(_0x25a329){this[_0x477d('0x10')](_0x25a329,!![]);}else{if(_0x32c5d7[_0x477d('0x2b')]){try{var _0x98b5d9=this[_0x477d('0x9')][_0x477d('0x2c')](_0x32c5d7,{'bodies':'','markSeen':!![]});_0x98b5d9['on'](_0x477d('0x2d'),this[_0x477d('0x2e')][_0x477d('0xd')](this));_0x98b5d9[_0x477d('0xa')](_0x477d('0xf'),this[_0x477d('0x2f')][_0x477d('0xd')](this));_0x98b5d9[_0x477d('0xa')](_0x477d('0x30'),this[_0x477d('0x31')]['bind'](this));}catch(_0x304d25){logger['error'](_0x304d25);}}else{this[_0x477d('0x9')][_0x477d('0x32')](!![],this[_0x477d('0x33')]['bind'](this));}}};EmailImap[_0x477d('0x22')][_0x477d('0x2e')]=function(_0x2b2091){_0x2b2091['on'](_0x477d('0x34'),this[_0x477d('0x35')][_0x477d('0xd')](this));_0x2b2091[_0x477d('0xa')](_0x477d('0x36'),this[_0x477d('0x37')][_0x477d('0xd')](this));_0x2b2091['once'](_0x477d('0x30'),this[_0x477d('0x38')][_0x477d('0xd')](this));};EmailImap['prototype'][_0x477d('0x35')]=function(_0x2daf87){simpleParser(_0x2daf87,{'Iconv':Iconv},this[_0x477d('0x39')]['bind'](this));};EmailImap['prototype'][_0x477d('0x37')]=function(){};EmailImap[_0x477d('0x22')][_0x477d('0x38')]=function(){};EmailImap[_0x477d('0x22')][_0x477d('0x39')]=function(_0x5aa352,_0x304055){if(_0x5aa352){logger['error'](_0x5aa352);}else{var _0x7b73b9=this;utils[_0x477d('0x3a')](this[_0x477d('0x3b')],_0x304055,function(_0x54355a){_0x7b73b9['emit'](_0x477d('0x6'),_0x54355a);});}};EmailImap[_0x477d('0x22')][_0x477d('0x31')]=function(){this[_0x477d('0x9')]['closeBox'](!![],this[_0x477d('0x33')][_0x477d('0xd')](this));};EmailImap[_0x477d('0x22')][_0x477d('0x2f')]=function(_0x90924){this['handleError'](_0x90924);this[_0x477d('0x9')][_0x477d('0x32')](!![],this['handleCloseBox'][_0x477d('0xd')](this));};EmailImap['prototype'][_0x477d('0xe')]=function(){this[_0x477d('0x25')](_0x477d('0x30'));};EmailImap[_0x477d('0x22')][_0x477d('0x10')]=function(_0x10bbed,_0x20a45a){logger[_0x477d('0xf')](_0x477d('0x10'),this['account'][_0x477d('0x6')],JSON[_0x477d('0x3c')](_0x10bbed));var _0x20de31='';if(_0x10bbed){if(_0x10bbed[_0x477d('0x3d')]){_0x20de31=_0x10bbed['textCode'];}else{for(var _0x4e0db1 in _0x10bbed){if(_0x10bbed[_0x477d('0x3e')](_0x4e0db1)){_0x20de31+=_[_0x477d('0x3f')](_0x4e0db1)+':\x20'+_0x10bbed[_0x4e0db1]+'\x0a';}}}}if(_0x20a45a){this['imap'][_0x477d('0x30')]();}else{this['emit']('error',_0x20de31);this[_0x477d('0x25')](_0x477d('0x30'));}};module[_0x477d('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 01c0d21..12611c0 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 _0x2ef3=['toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail'];(function(_0x110a90,_0x187d0a){var _0x54f73f=function(_0x13d65a){while(--_0x13d65a){_0x110a90['push'](_0x110a90['shift']());}};_0x54f73f(++_0x187d0a);}(_0x2ef3,0x7d));var _0x32ef=function(_0x450830,_0x32ca8e){_0x450830=_0x450830-0x0;var _0x42d885=_0x2ef3[_0x450830];return _0x42d885;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x32ef('0x0'));function EmailSmtp(){}EmailSmtp[_0x32ef('0x1')][_0x32ef('0x2')]=function(_0x4d1bfb,_0x37422a){return new Promise(function(_0x48d66e,_0x5c5aa0){var _0x2d4288=nodemailer[_0x32ef('0x3')](_0x4d1bfb);_0x2d4288[_0x32ef('0x4')](_0x32ef('0x5'),inlineBase64());_0x2d4288[_0x32ef('0x6')](_0x37422a,function(_0x45316,_0x2f8df){if(_0x45316){_0x5c5aa0(_0x45316[_0x32ef('0x7')]());}else{_0x48d66e(_0x2f8df);}});});};EmailSmtp[_0x32ef('0x1')][_0x32ef('0x8')]=function(_0x451f9b){return new Promise(function(_0x14506c,_0x12e8cc){var _0x1bc13c=nodemailer['createTransport'](_0x451f9b);_0x1bc13c[_0x32ef('0x8')](function(_0x53b1d8,_0x3df845){if(_0x53b1d8){_0x12e8cc(_0x53b1d8[_0x32ef('0x7')]());}else{if(_0x3df845){_0x14506c(_0x3df845);}else{_0x12e8cc(_0x32ef('0x9'));}}});});};module[_0x32ef('0xa')]=EmailSmtp; \ No newline at end of file +var _0x17b3=['Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','toString','verify'];(function(_0x316170,_0x5e062d){var _0x4040a8=function(_0x445c5f){while(--_0x445c5f){_0x316170['push'](_0x316170['shift']());}};_0x4040a8(++_0x5e062d);}(_0x17b3,0xb6));var _0x317b=function(_0x21e2f5,_0x3840be){_0x21e2f5=_0x21e2f5-0x0;var _0x13a80e=_0x17b3[_0x21e2f5];return _0x13a80e;};'use strict';var nodemailer=require(_0x317b('0x0'));var inlineBase64=require(_0x317b('0x1'));function EmailSmtp(){}EmailSmtp[_0x317b('0x2')][_0x317b('0x3')]=function(_0x8761c5,_0x30842f){return new Promise(function(_0x56bb4e,_0x355a13){var _0x58e568=nodemailer[_0x317b('0x4')](_0x8761c5);_0x58e568[_0x317b('0x5')](_0x317b('0x6'),inlineBase64());_0x58e568[_0x317b('0x7')](_0x30842f,function(_0x4ca201,_0x5557ce){if(_0x4ca201){_0x355a13(_0x4ca201[_0x317b('0x8')]());}else{_0x56bb4e(_0x5557ce);}});});};EmailSmtp['prototype'][_0x317b('0x9')]=function(_0x5bda02){return new Promise(function(_0x3cc4e9,_0x182056){var _0x17aab2=nodemailer['createTransport'](_0x5bda02);_0x17aab2[_0x317b('0x9')](function(_0x31d18a,_0x297df5){if(_0x31d18a){_0x182056(_0x31d18a[_0x317b('0x8')]());}else{if(_0x297df5){_0x3cc4e9(_0x297df5);}else{_0x182056(_0x317b('0xa'));}}});});};module[_0x317b('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 305cfe9..2b54f96 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 _0x1ea3=['../../../config/environment','generate','@xcally.com','value','name','substring','indexOf','slice','join','Anonymous','head','length','pop','address','isEmpty','anonymous','html','test','replace','includes','','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','moment','randomstring','path','util','node-tnef','../../../config/logger'];(function(_0x962fa2,_0x59d469){var _0x3411e3=function(_0x11398b){while(--_0x11398b){_0x962fa2['push'](_0x962fa2['shift']());}};_0x3411e3(++_0x59d469);}(_0x1ea3,0x1c2));var _0x31ea=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1ea3[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var moment=require(_0x31ea('0x0'));var random=require(_0x31ea('0x1'));var fs=require('fs');var path=require(_0x31ea('0x2'));var util=require(_0x31ea('0x3'));var tnef=require(_0x31ea('0x4'));var logger=require(_0x31ea('0x5'))('email');var config=require(_0x31ea('0x6'));function getAddress(_0xf1d998){var _0xe53963=_['head'](_0xf1d998['value']);return _0xe53963&&_0xe53963['address']?_0xe53963['address']:'anonymous'+random[_0x31ea('0x7')](0x6)+_0x31ea('0x8');}function getFirstName(_0x3dec7b){var _0x3b10ce=_['head'](_0x3dec7b[_0x31ea('0x9')]);if(_0x3b10ce&&_0x3b10ce[_0x31ea('0xa')]){if(_0x3b10ce[_0x31ea('0xa')]==_0x3b10ce['address']){return _0x3b10ce[_0x31ea('0xa')][_0x31ea('0xb')](0x0,_0x3b10ce['name'][_0x31ea('0xc')]('@'));}var _0xc580ec=_0x3b10ce['name']['split'](/\s+/);return _0xc580ec['length']>0x1?_0xc580ec[_0x31ea('0xd')](0x0,-0x1)[_0x31ea('0xe')]('\x20'):_0x3b10ce[_0x31ea('0xa')];}return _0x31ea('0xf');}function getLastName(_0x20e87b){var _0x3623a1=_[_0x31ea('0x10')](_0x20e87b[_0x31ea('0x9')]);if(_0x3623a1&&_0x3623a1[_0x31ea('0xa')]){var _0x5bc1de=_0x3623a1[_0x31ea('0xa')]['split'](/\s+/);return _0x5bc1de[_0x31ea('0x11')]>0x1?_0x5bc1de[_0x31ea('0x12')]():'';}return'';}function getMails(_0x36f2c8,_0x29dd62){var _0xa21e62='';for(var _0x5140d7=0x0;_0x5140d7<_0x29dd62[_0x31ea('0x9')][_0x31ea('0x11')];_0x5140d7+=0x1){if(_0x29dd62['value'][_0x5140d7][_0x31ea('0x13')]!==_0x36f2c8){if(!_[_0x31ea('0x14')](_0xa21e62)){_0xa21e62+=',';}_0xa21e62+=_0x29dd62['value'][_0x5140d7][_0x31ea('0xa')]||_0x29dd62[_0x31ea('0x9')][_0x5140d7]['address']||'';_0xa21e62+='\x20<';_0xa21e62+=_0x29dd62[_0x31ea('0x9')][_0x5140d7][_0x31ea('0x13')]?_0x29dd62[_0x31ea('0x9')][_0x5140d7][_0x31ea('0x13')]:_0x31ea('0x15')+random[_0x31ea('0x7')](0x6)+_0x31ea('0x8');_0xa21e62+='>';}}return _0xa21e62;}function parseEmail(_0xb713e9,_0x50f9b0,_0x4d438e){if(_0x50f9b0[_0x31ea('0x16')]){var _0x10e859=/)<[^<]*)*<\/script>/gi;while(_0x10e859[_0x31ea('0x17')](_0x50f9b0['html'])){_0x50f9b0[_0x31ea('0x16')]=_0x50f9b0[_0x31ea('0x16')][_0x31ea('0x18')](_0x10e859,'');}if(_0x50f9b0[_0x31ea('0x16')][_0x31ea('0x19')](_0x31ea('0x1a'))){var _0x288d59=[];_0x50f9b0[_0x31ea('0x1b')][_0x31ea('0x1c')](_0xc61874=>{_0x288d59[_0x31ea('0x1d')](_0xc61874['filename']);});var _0x527eb5=/]+>/g;var _0x43b1c8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4cb12b=_0x50f9b0[_0x31ea('0x16')]['replace'](_0x43b1c8,_0x31ea('0x1e'));var _0x3b871b=_0x4cb12b[_0x31ea('0x18')](_0x527eb5,_0x31ea('0x1f'));for(let _0x5ec003=0x0;_0x5ec003<_0x288d59['length'];_0x5ec003++){var _0xd61778=_0x3b871b[_0x31ea('0x18')]('_IMG','\x20[Attachment:\x20'+_0x288d59[_0x5ec003]+_0x31ea('0x20'));_0x3b871b=_0xd61778;}_0x50f9b0[_0x31ea('0x16')]=_0x3b871b;}_0x4d438e['body']=_0x50f9b0[_0x31ea('0x16')];}else{_0x4d438e[_0x31ea('0x21')]=_0x50f9b0[_0x31ea('0x22')];}if(_0x4d438e[_0x31ea('0x21')]){_0x4d438e[_0x31ea('0x21')]=_0x4d438e[_0x31ea('0x21')][_0x31ea('0x18')](/0x0){var _0x36954f=[_0x31ea('0x33'),'X-Auto-Response-Suppress:\x20All',_0x31ea('0x34')];for(var _0x526115=0x0;_0x526115<_0x50f9b0[_0x31ea('0x32')][_0x31ea('0x11')];_0x526115++){var _0x4e0638=_['indexOf'](_0x36954f,_0x50f9b0['headerLines'][_0x526115][_0x31ea('0x35')]);if(_0x4e0638>=0x0){_0x4d438e[_0x31ea('0x36')]=!![];}}}return _0x4d438e;}exports['parser']=function(_0x4aeb41,_0x409699,_0x498140){var _0xb05edc={'from':getAddress(_0x409699[_0x31ea('0x37')]),'firstName':getFirstName(_0x409699['from']),'lastName':getLastName(_0x409699['from']),'mapKey':'email','message':{'from':getMails(_0x4aeb41[_0x31ea('0x26')],_0x409699['from']),'to':_0x4aeb41[_0x31ea('0x26')],'cc':'','subject':_0x409699[_0x31ea('0x38')]||'','messageId':_0x409699[_0x31ea('0x39')],'inReplyTo':_0x409699[_0x31ea('0x3a')],'sentAt':moment(_0x409699[_0x31ea('0x3b')])['format'](_0x31ea('0x3c')),'attach':![],'attachments':[]}};if(!_0x409699[_0x31ea('0x16')]&&!_0x409699[_0x31ea('0x22')]){var _0x3a88f6=_[_0x31ea('0x3d')](_0x409699[_0x31ea('0x1b')],{'contentType':'application/ms-tnef'});if(_0x3a88f6[_0x31ea('0x11')]){logger[_0x31ea('0x3e')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x409699[_0x31ea('0x39')]));tnef[_0x31ea('0x3f')](_[_0x31ea('0x40')](_0x3a88f6)[_0x31ea('0x41')],function(_0x124418,_0x201985){if(_0x201985){_0x409699['html']=_0x201985[_0x31ea('0x42')]||'

Empty\x20message

';if(_0x201985[_0x31ea('0x43')]){for(var _0x486b96=0x0;_0x486b96<_0x201985[_0x31ea('0x43')][_0x31ea('0x11')];_0x486b96++){var _0x482a97=_0x201985[_0x31ea('0x43')][_0x486b96];_0xb05edc[_0x31ea('0x24')]['attachments']['push']({'filename':_0x482a97[_0x31ea('0x44')],'content':Buffer['from'](_0x482a97[_0x31ea('0x45')])});}}}_0x498140(parseEmail(_0x4aeb41,_0x409699,_0xb05edc));});}else{_0x409699[_0x31ea('0x16')]=_0x31ea('0x46');_0x498140(parseEmail(_0x4aeb41,_0x409699,_0xb05edc));}}else{_0x498140(parseEmail(_0x4aeb41,_0x409699,_0xb05edc));}};exports[_0x31ea('0x47')]=function(_0x27e1b6,_0x55b108){var _0x24a45c=['user='+(_0x55b108||''),_0x31ea('0x48')+_0x27e1b6,'',''];return Buffer[_0x31ea('0x37')](_0x24a45c[_0x31ea('0xe')](''),_0x31ea('0x49'))[_0x31ea('0x4a')](_0x31ea('0x4b'));}; \ No newline at end of file +var _0x6b79=['textAsHtml','\x20[Attachment:\x20','body'];(function(_0x341489,_0x233937){var _0x1fc9bb=function(_0x84c18d){while(--_0x84c18d){_0x341489['push'](_0x341489['shift']());}};_0x1fc9bb(++_0x233937);}(_0x6b79,0x156));var _0x96b7=function(_0x40b413,_0x2676b1){_0x40b413=_0x40b413-0x0;var _0x5a5d78=_0x6b79[_0x40b413];return _0x5a5d78;};'use strict';var _=require('lodash');var moment=require(_0x96b7('0x0'));var random=require(_0x96b7('0x1'));var fs=require('fs');var path=require('path');var util=require(_0x96b7('0x2'));var tnef=require(_0x96b7('0x3'));var logger=require('../../../config/logger')(_0x96b7('0x4'));var config=require(_0x96b7('0x5'));function getAddress(_0x2afe3c){var _0x8c263d=_['head'](_0x2afe3c[_0x96b7('0x6')]);return _0x8c263d&&_0x8c263d[_0x96b7('0x7')]?_0x8c263d[_0x96b7('0x7')]:_0x96b7('0x8')+random[_0x96b7('0x9')](0x6)+'@xcally.com';}function getFirstName(_0x3209ec){var _0x453393=_[_0x96b7('0xa')](_0x3209ec['value']);if(_0x453393&&_0x453393['name']){if(_0x453393[_0x96b7('0xb')]==_0x453393[_0x96b7('0x7')]){return _0x453393['name'][_0x96b7('0xc')](0x0,_0x453393['name']['indexOf']('@'));}var _0x19d5c1=_0x453393[_0x96b7('0xb')][_0x96b7('0xd')](/\s+/);return _0x19d5c1[_0x96b7('0xe')]>0x1?_0x19d5c1[_0x96b7('0xf')](0x0,-0x1)[_0x96b7('0x10')]('\x20'):_0x453393[_0x96b7('0xb')];}return _0x96b7('0x11');}function getLastName(_0x5bbdc5){var _0xca5ec8=_['head'](_0x5bbdc5[_0x96b7('0x6')]);if(_0xca5ec8&&_0xca5ec8[_0x96b7('0xb')]){var _0x70bd3a=_0xca5ec8[_0x96b7('0xb')]['split'](/\s+/);return _0x70bd3a[_0x96b7('0xe')]>0x1?_0x70bd3a[_0x96b7('0x12')]():'';}return'';}function getMails(_0x1196bf,_0x441c4b){var _0x130395='';for(var _0x34a43f=0x0;_0x34a43f<_0x441c4b[_0x96b7('0x6')][_0x96b7('0xe')];_0x34a43f+=0x1){if(_0x441c4b[_0x96b7('0x6')][_0x34a43f][_0x96b7('0x7')]!==_0x1196bf){if(!_[_0x96b7('0x13')](_0x130395)){_0x130395+=',';}_0x130395+=_0x441c4b[_0x96b7('0x6')][_0x34a43f][_0x96b7('0xb')]||_0x441c4b[_0x96b7('0x6')][_0x34a43f]['address']||'';_0x130395+='\x20<';_0x130395+=_0x441c4b[_0x96b7('0x6')][_0x34a43f][_0x96b7('0x7')]?_0x441c4b['value'][_0x34a43f][_0x96b7('0x7')]:'anonymous'+random['generate'](0x6)+'@xcally.com';_0x130395+='>';}}return _0x130395;}function parseEmail(_0x1afa59,_0x1a8c74,_0x1ae68b){if(_0x1a8c74[_0x96b7('0x14')]){var _0x80017=/)<[^<]*)*<\/script>/gi;while(_0x80017[_0x96b7('0x15')](_0x1a8c74['html'])){_0x1a8c74[_0x96b7('0x14')]=_0x1a8c74[_0x96b7('0x14')][_0x96b7('0x16')](_0x80017,'');}if(_0x1a8c74[_0x96b7('0x14')][_0x96b7('0x17')](_0x96b7('0x18'))){var _0x34250d=[];_0x1a8c74[_0x96b7('0x19')][_0x96b7('0x1a')](_0x45cdb2=>{_0x34250d[_0x96b7('0x1b')](_0x45cdb2[_0x96b7('0x1c')]);});var _0xf23f4d=/]+>/g;var _0x1b9e08=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x202230=_0x1a8c74['html']['replace'](_0x1b9e08,_0x96b7('0x1d'));var _0x39d99d=_0x202230['replace'](_0xf23f4d,_0x96b7('0x1e'));for(let _0x318f74=0x0;_0x318f74<_0x34250d[_0x96b7('0xe')];_0x318f74++){var _0x315de8=_0x39d99d['replace']('_IMG',_0x96b7('0x1f')+_0x34250d[_0x318f74]+'\x20]');_0x39d99d=_0x315de8;}_0x1a8c74[_0x96b7('0x14')]=_0x39d99d;}_0x1ae68b[_0x96b7('0x20')]=_0x1a8c74[_0x96b7('0x14')];}else{_0x1ae68b['body']=_0x1a8c74[_0x96b7('0x21')];}if(_0x1ae68b['body']){_0x1ae68b[_0x96b7('0x20')]=_0x1ae68b['body'][_0x96b7('0x16')](/0x0){var _0x365329=[_0x96b7('0x33'),_0x96b7('0x34'),'Precedence:\x20auto_reply'];for(var _0xf0d472=0x0;_0xf0d472<_0x1a8c74[_0x96b7('0x32')][_0x96b7('0xe')];_0xf0d472++){var _0x3558e6=_[_0x96b7('0x35')](_0x365329,_0x1a8c74[_0x96b7('0x32')][_0xf0d472]['line']);if(_0x3558e6>=0x0){_0x1ae68b[_0x96b7('0x36')]=!![];}}}return _0x1ae68b;}exports[_0x96b7('0x37')]=function(_0x46a2af,_0x34cb3d,_0x18b7da){var _0xd2d6a5={'from':getAddress(_0x34cb3d['from']),'firstName':getFirstName(_0x34cb3d[_0x96b7('0x38')]),'lastName':getLastName(_0x34cb3d['from']),'mapKey':'email','message':{'from':getMails(_0x46a2af[_0x96b7('0x4')],_0x34cb3d[_0x96b7('0x38')]),'to':_0x46a2af['email'],'cc':'','subject':_0x34cb3d[_0x96b7('0x39')]||'','messageId':_0x34cb3d[_0x96b7('0x3a')],'inReplyTo':_0x34cb3d[_0x96b7('0x3b')],'sentAt':moment(_0x34cb3d['date'])[_0x96b7('0x2b')](_0x96b7('0x3c')),'attach':![],'attachments':[]}};if(!_0x34cb3d[_0x96b7('0x14')]&&!_0x34cb3d[_0x96b7('0x21')]){var _0x23dce8=_['filter'](_0x34cb3d[_0x96b7('0x19')],{'contentType':_0x96b7('0x3d')});if(_0x23dce8[_0x96b7('0xe')]){logger[_0x96b7('0x3e')](util['format'](_0x96b7('0x3f'),_0x34cb3d[_0x96b7('0x3a')]));tnef[_0x96b7('0x40')](_[_0x96b7('0x41')](_0x23dce8)[_0x96b7('0x31')],function(_0x20d319,_0x245c7f){if(_0x245c7f){_0x34cb3d[_0x96b7('0x14')]=_0x245c7f[_0x96b7('0x42')]||'

Empty\x20message

';if(_0x245c7f[_0x96b7('0x43')]){for(var _0x1a9742=0x0;_0x1a9742<_0x245c7f['Attachments'][_0x96b7('0xe')];_0x1a9742++){var _0x2a29d8=_0x245c7f[_0x96b7('0x43')][_0x1a9742];_0xd2d6a5[_0x96b7('0x23')]['attachments'][_0x96b7('0x1b')]({'filename':_0x2a29d8[_0x96b7('0x44')],'content':Buffer['from'](_0x2a29d8[_0x96b7('0x45')])});}}}_0x18b7da(parseEmail(_0x46a2af,_0x34cb3d,_0xd2d6a5));});}else{_0x34cb3d['html']='

Empty\x20message

';_0x18b7da(parseEmail(_0x46a2af,_0x34cb3d,_0xd2d6a5));}}else{_0x18b7da(parseEmail(_0x46a2af,_0x34cb3d,_0xd2d6a5));}};exports[_0x96b7('0x46')]=function(_0x4de640,_0x4d5a1c){var _0xe2e2e5=[_0x96b7('0x47')+(_0x4d5a1c||''),_0x96b7('0x48')+_0x4de640,'',''];return Buffer[_0x96b7('0x38')](_0xe2e2e5['join'](''),'utf-8')[_0x96b7('0x49')](_0x96b7('0x4a'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 71a5c74..ff5c382 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 _0x724b=['active','Imap','Smtp','lodash','name','Service','key','SERV'];(function(_0x28b89d,_0x347152){var _0x3c1127=function(_0x4c7759){while(--_0x4c7759){_0x28b89d['push'](_0x28b89d['shift']());}};_0x3c1127(++_0x347152);}(_0x724b,0x17b));var _0xb724=function(_0x5953c,_0x252939){_0x5953c=_0x5953c-0x0;var _0x8766ae=_0x724b[_0x5953c];return _0x8766ae;};'use strict';var _=require(_0xb724('0x0'));function MailAccount(_0x1e3469){this['id']=_0x1e3469['id']||0x0;this['name']=_0x1e3469[_0xb724('0x1')]||_0xb724('0x2');this['key']=_0x1e3469[_0xb724('0x3')]||_0xb724('0x4');this[_0xb724('0x5')]=_0x1e3469[_0xb724('0x5')]||![];this[_0xb724('0x6')]=_0x1e3469[_0xb724('0x6')]||[];this[_0xb724('0x7')]=_0x1e3469[_0xb724('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xba11=['key','SERV','active','Imap','Smtp','lodash','name'];(function(_0x34ceea,_0x2f8e44){var _0x559f9c=function(_0x42714d){while(--_0x42714d){_0x34ceea['push'](_0x34ceea['shift']());}};_0x559f9c(++_0x2f8e44);}(_0xba11,0xd0));var _0x1ba1=function(_0xa4994d,_0xe05eec){_0xa4994d=_0xa4994d-0x0;var _0x881702=_0xba11[_0xa4994d];return _0x881702;};'use strict';var _=require(_0x1ba1('0x0'));function MailAccount(_0xffac78){this['id']=_0xffac78['id']||0x0;this[_0x1ba1('0x1')]=_0xffac78['name']||'Service';this[_0x1ba1('0x2')]=_0xffac78[_0x1ba1('0x2')]||_0x1ba1('0x3');this[_0x1ba1('0x4')]=_0xffac78[_0x1ba1('0x4')]||![];this['Imap']=_0xffac78[_0x1ba1('0x5')]||[];this[_0x1ba1('0x6')]=_0xffac78[_0x1ba1('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 70a952a..a584df8 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 _0xa5ea=['prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','lodash','mailAccounts','mapKeys'];(function(_0x478a19,_0x2ff359){var _0x7fd2fa=function(_0x2aeb50){while(--_0x2aeb50){_0x478a19['push'](_0x478a19['shift']());}};_0x7fd2fa(++_0x2ff359);}(_0xa5ea,0xa8));var _0xaa5e=function(_0x367fcb,_0x26a793){_0x367fcb=_0x367fcb-0x0;var _0xbd6cfe=_0xa5ea[_0x367fcb];return _0xbd6cfe;};'use strict';var _=require(_0xaa5e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xaa5e('0x1')]={};};function freeIsNotKey(_0x24b60c,_0x480bcc,_0x81612f){var _0x2b8df8=_[_0xaa5e('0x2')](_0x24b60c,function(_0x3f172e,_0x536049){return _0x3f172e[_0x81612f];});for(var _0x5427a8 in _0x480bcc){if(_0x480bcc['hasOwnProperty'](_0x5427a8)){if(!_0x2b8df8[_0x5427a8]){delete _0x480bcc[_0x5427a8];}}}}Realtime[_0xaa5e('0x3')][_0xaa5e('0x4')]=function(_0x47510c,_0x5cdec7){for(var _0x27348e in _0x5cdec7){if(_0x47510c[_0xaa5e('0x5')](_0x27348e)){_0x47510c[_0x27348e]=_0x5cdec7[_0x27348e];}}};Realtime[_0xaa5e('0x3')][_0xaa5e('0x6')]=function(){var _0x1775f9=this;return function(_0x15c801){if(_0x15c801){freeIsNotKey(_0x15c801,_0x1775f9[_0xaa5e('0x1')],'id');for(var _0x3349b0=0x0,_0x36e16a={},_0x4b4066={};_0x3349b0<_0x15c801[_0xaa5e('0x7')];_0x3349b0+=0x1){_0x36e16a=_0x15c801[_0x3349b0];if(_[_0xaa5e('0x8')](_0x1775f9[_0xaa5e('0x1')][_0x36e16a['id']])){_0x1775f9[_0xaa5e('0x1')][_0x36e16a['id']]=new MailAccount(_0x36e16a);}else{_['merge'](_0x1775f9[_0xaa5e('0x1')][_0x36e16a['id']],_0x36e16a);}}}return _0x1775f9[_0xaa5e('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0xa84a=['length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty'];(function(_0x32e7d6,_0x682bc5){var _0x5427cf=function(_0x365c2d){while(--_0x365c2d){_0x32e7d6['push'](_0x32e7d6['shift']());}};_0x5427cf(++_0x682bc5);}(_0xa84a,0x180));var _0xaa84=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa84a[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var MailAccount=require(_0xaa84('0x0'));var Realtime=function(){this[_0xaa84('0x1')]={};};function freeIsNotKey(_0x355f47,_0x13e114,_0x108787){var _0x490d9a=_[_0xaa84('0x2')](_0x355f47,function(_0x237afd,_0x27fc31){return _0x237afd[_0x108787];});for(var _0x1ff427 in _0x13e114){if(_0x13e114['hasOwnProperty'](_0x1ff427)){if(!_0x490d9a[_0x1ff427]){delete _0x13e114[_0x1ff427];}}}}Realtime[_0xaa84('0x3')][_0xaa84('0x4')]=function(_0xeace55,_0x398bff){for(var _0x2be047 in _0x398bff){if(_0xeace55[_0xaa84('0x5')](_0x2be047)){_0xeace55[_0x2be047]=_0x398bff[_0x2be047];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x10c6fe=this;return function(_0x483c86){if(_0x483c86){freeIsNotKey(_0x483c86,_0x10c6fe[_0xaa84('0x1')],'id');for(var _0x10204d=0x0,_0x192497={},_0x42bd7c={};_0x10204d<_0x483c86[_0xaa84('0x6')];_0x10204d+=0x1){_0x192497=_0x483c86[_0x10204d];if(_[_0xaa84('0x7')](_0x10c6fe[_0xaa84('0x1')][_0x192497['id']])){_0x10c6fe[_0xaa84('0x1')][_0x192497['id']]=new MailAccount(_0x192497);}else{_[_0xaa84('0x8')](_0x10c6fe[_0xaa84('0x1')][_0x192497['id']],_0x192497);}}}return _0x10c6fe[_0xaa84('0x1')];};};module[_0xaa84('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 513a81e..b88234d 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 _0xb1fc=['getMailAccounts','GetMailAccount','name','provider','service','email','active','key','ListId','MailServerIn','Imap','CloudProvider','type','data5','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client'];(function(_0x29ac6b,_0x184514){var _0x44a29b=function(_0x2dad03){while(--_0x2dad03){_0x29ac6b['push'](_0x29ac6b['shift']());}};_0x44a29b(++_0x184514);}(_0xb1fc,0xb3));var _0xcb1f=function(_0x2c27cd,_0x236f70){_0x2c27cd=_0x2c27cd-0x0;var _0x17e297=_0xb1fc[_0x2c27cd];return _0x17e297;};'use strict';var client=require(_0xcb1f('0x0'));exports[_0xcb1f('0x1')]=function(){return function(){return client['Request'](_0xcb1f('0x2'),{'options':{'attributes':['id',_0xcb1f('0x3'),_0xcb1f('0x4'),_0xcb1f('0x5'),_0xcb1f('0x6'),_0xcb1f('0x7'),_0xcb1f('0x8'),_0xcb1f('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0xcb1f('0xa'),'as':_0xcb1f('0xb'),'include':[{'model':_0xcb1f('0xc'),'attributes':['id',_0xcb1f('0x3'),_0xcb1f('0x5'),_0xcb1f('0xd'),_0xcb1f('0xe')],'as':_0xcb1f('0xc')}]},{'model':'MailServerOut','as':_0xcb1f('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0xcb1f('0x3'),'service',_0xcb1f('0xd'),_0xcb1f('0xe')],'as':_0xcb1f('0xc')}]}]},'log':_0xcb1f('0x10')});};};exports[_0xcb1f('0x11')]=function(_0x404975,_0x1666f2){return client[_0xcb1f('0x12')](_0xcb1f('0x13'),{'account':{'id':_0x404975},'body':_0x1666f2,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x5302=['TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','name','getMailAccount','notify','NotifyMailAccount','Request','GetMailAccount','service','active','ListId'];(function(_0x2e20c9,_0x2e6ce7){var _0x37e9db=function(_0x394995){while(--_0x394995){_0x2e20c9['push'](_0x2e20c9['shift']());}};_0x37e9db(++_0x2e6ce7);}(_0x5302,0x1b5));var _0x2530=function(_0x27d771,_0x1a50b2){_0x27d771=_0x27d771-0x0;var _0x2ba087=_0x5302[_0x27d771];return _0x2ba087;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x2530('0x0')](_0x2530('0x1'),{'options':{'attributes':['id','name','provider',_0x2530('0x2'),'email',_0x2530('0x3'),'key',_0x2530('0x4'),_0x2530('0x5')],'raw':![],'include':[{'model':_0x2530('0x6'),'as':_0x2530('0x7'),'include':[{'model':_0x2530('0x8'),'attributes':['id','name',_0x2530('0x2'),_0x2530('0x9'),_0x2530('0xa')],'as':_0x2530('0x8')}]},{'model':_0x2530('0xb'),'as':_0x2530('0xc'),'include':[{'model':_0x2530('0x8'),'attributes':['id',_0x2530('0xd'),_0x2530('0x2'),_0x2530('0x9'),_0x2530('0xa')],'as':_0x2530('0x8')}]}]},'log':_0x2530('0xe')});};};exports[_0x2530('0xf')]=function(_0x330c15,_0x1380bb){return client[_0x2530('0x0')]('NotifyMailAccount',{'account':{'id':_0x330c15},'body':_0x1380bb,'log':_0x2530('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index fa10f4e..a2164b3 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 _0x3471=['GetSettings','../client','Request','ShowSetting','loginMailFrequency'];(function(_0x497c47,_0x29ff53){var _0x23baf0=function(_0x26ad71){while(--_0x26ad71){_0x497c47['push'](_0x497c47['shift']());}};_0x23baf0(++_0x29ff53);}(_0x3471,0x7e));var _0x1347=function(_0x1a0ea7,_0x42d30a){_0x1a0ea7=_0x1a0ea7-0x0;var _0xd10e97=_0x3471[_0x1a0ea7];return _0xd10e97;};'use strict';var client=require(_0x1347('0x0'));exports['getSettings']=function(){return client[_0x1347('0x1')](_0x1347('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1347('0x3')]},'log':_0x1347('0x4')});}; \ No newline at end of file +var _0xca8c=['GetSettings','../client','Request','loginMailFrequency'];(function(_0x28725b,_0x5f270a){var _0xc6c07c=function(_0x5c456b){while(--_0x5c456b){_0x28725b['push'](_0x28725b['shift']());}};_0xc6c07c(++_0x5f270a);}(_0xca8c,0x1d9));var _0xcca8=function(_0x1df793,_0x2e6546){_0x1df793=_0x1df793-0x0;var _0x778128=_0xca8c[_0x1df793];return _0x778128;};'use strict';var client=require(_0xcca8('0x0'));exports['getSettings']=function(){return client[_0xcca8('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcca8('0x2')]},'log':_0xcca8('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 60e12dd..e8383bc 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 b4612f3..cc294dc 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 _0x7bbe=['default','../../config/socketio','../../config/express','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','createServer','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers'];(function(_0x5831a3,_0x4463b7){var _0x198912=function(_0xa0d267){while(--_0xa0d267){_0x5831a3['push'](_0x5831a3['shift']());}};_0x198912(++_0x4463b7);}(_0x7bbe,0x75));var _0xe7bb=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x7bbe[_0x22cb5f];return _0x274d36;};'use strict';var _=require(_0xe7bb('0x0'));var http=require(_0xe7bb('0x1'));var express=require('express');var sticky=require(_0xe7bb('0x2'));var Redis=require(_0xe7bb('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0xe7bb('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0xe7bb('0x5')](server,config[_0xe7bb('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0xe7bb('0x7'),_0xe7bb('0x8')]});config[_0xe7bb('0x9')]=_[_0xe7bb('0xa')](config[_0xe7bb('0x9')],{'host':_0xe7bb('0xb'),'port':0x18eb});socketio[_0xe7bb('0xc')](require(_0xe7bb('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xe7bb('0x9')])}));require(_0xe7bb('0xe'))[_0xe7bb('0xf')]();require(_0xe7bb('0x10'))[_0xe7bb('0xf')](socketio);require(_0xe7bb('0x11'))[_0xe7bb('0xf')](app);require(_0xe7bb('0x12'))[_0xe7bb('0xf')](app);}else{server[_0xe7bb('0x13')]('listening',function(){console['log'](_0xe7bb('0x14'),config[_0xe7bb('0x6')]);});}exports=module[_0xe7bb('0x15')]=app; \ No newline at end of file +var _0x8afa=['../../config/socketio','default','../../config/express','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x8afa,0x11a));var _0xa8af=function(_0x595eb6,_0x4f5e30){_0x595eb6=_0x595eb6-0x0;var _0xbcde6c=_0x8afa[_0x595eb6];return _0xbcde6c;};'use strict';var _=require(_0xa8af('0x0'));var http=require(_0xa8af('0x1'));var express=require(_0xa8af('0x2'));var sticky=require(_0xa8af('0x3'));var Redis=require(_0xa8af('0x4'));var config=require(_0xa8af('0x5'));var app=express();var server=http[_0xa8af('0x6')](app);server[_0xa8af('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0xa8af('0x8')])){var socketio=require(_0xa8af('0x9'))(server,{'transports':[_0xa8af('0xa'),_0xa8af('0xb')]});config[_0xa8af('0xc')]=_[_0xa8af('0xd')](config[_0xa8af('0xc')],{'host':_0xa8af('0xe'),'port':0x18eb});socketio[_0xa8af('0xf')](require(_0xa8af('0x10'))({'pubClient':new Redis(config[_0xa8af('0xc')]),'subClient':new Redis(config[_0xa8af('0xc')])}));require(_0xa8af('0x11'))['default']();require(_0xa8af('0x12'))[_0xa8af('0x13')](socketio);require(_0xa8af('0x14'))['default'](app);require(_0xa8af('0x15'))[_0xa8af('0x13')](app);}else{server[_0xa8af('0x16')]('listening',function(){console['log'](_0xa8af('0x17'),config['port']);});}exports=module[_0xa8af('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 6740f09..11af3bd 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 _0xc43f=['client','http','Request','request','debug','rpc','error','message','result','exports','bluebird','../../config/logger','routing'];(function(_0x2cfe28,_0x3046b0){var _0x298e58=function(_0x56883a){while(--_0x56883a){_0x2cfe28['push'](_0x2cfe28['shift']());}};_0x298e58(++_0x3046b0);}(_0xc43f,0x1aa));var _0xfc43=function(_0x4bc8a0,_0x5333aa){_0x4bc8a0=_0x4bc8a0-0x0;var _0x44db33=_0xc43f[_0x4bc8a0];return _0x44db33;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfc43('0x0'));var logger=require(_0xfc43('0x1'))(_0xfc43('0x2'));var client=jayson[_0xfc43('0x3')][_0xfc43('0x4')]({'port':0x2329});client[_0xfc43('0x5')]=function(_0x21d527,_0x2dc831){return new BPromise(function(_0x517691,_0xf7fe6e){return client[_0xfc43('0x6')](_0x21d527,_0x2dc831)['then'](function(_0x51488d){logger[_0xfc43('0x7')](_0xfc43('0x8'),_0xfc43('0x2'),_0x21d527,_0x2dc831,_0x51488d);if(_0x51488d[_0xfc43('0x9')]){logger[_0xfc43('0x9')](_0xfc43('0x8'),_0xfc43('0x2'),_0x21d527,_0x51488d[_0xfc43('0x9')][_0xfc43('0xa')],_0x2dc831);return _0xf7fe6e(_0x51488d[_0xfc43('0x9')]['message']);}else{return _0x517691(_0x51488d[_0xfc43('0xb')]);}})['catch'](function(_0x229678){logger[_0xfc43('0x9')](_0xfc43('0x8'),'routing',_0x21d527,_0x229678,_0x2dc831);return _0xf7fe6e(_0x229678);});});};module[_0xfc43('0xc')]=client; \ No newline at end of file +var _0xe5c1=['result','exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc','error','message'];(function(_0x53ee43,_0x2a63ec){var _0x58b2ca=function(_0x35e8a0){while(--_0x35e8a0){_0x53ee43['push'](_0x53ee43['shift']());}};_0x58b2ca(++_0x2a63ec);}(_0xe5c1,0x128));var _0x1e5c=function(_0x2af68a,_0x42a579){_0x2af68a=_0x2af68a-0x0;var _0xbc7741=_0xe5c1[_0x2af68a];return _0xbc7741;};'use strict';var jayson=require(_0x1e5c('0x0'));var BPromise=require(_0x1e5c('0x1'));var logger=require('../../config/logger')(_0x1e5c('0x2'));var client=jayson[_0x1e5c('0x3')][_0x1e5c('0x4')]({'port':0x2329});client[_0x1e5c('0x5')]=function(_0x391a52,_0x2f3240){return new BPromise(function(_0x557b87,_0x48193c){return client[_0x1e5c('0x6')](_0x391a52,_0x2f3240)[_0x1e5c('0x7')](function(_0xad52b9){logger[_0x1e5c('0x8')](_0x1e5c('0x9'),'routing',_0x391a52,_0x2f3240,_0xad52b9);if(_0xad52b9[_0x1e5c('0xa')]){logger[_0x1e5c('0xa')](_0x1e5c('0x9'),'routing',_0x391a52,_0xad52b9['error'][_0x1e5c('0xb')],_0x2f3240);return _0x48193c(_0xad52b9[_0x1e5c('0xa')][_0x1e5c('0xb')]);}else{return _0x557b87(_0xad52b9[_0x1e5c('0xc')]);}})['catch'](function(_0x6c74e0){logger[_0x1e5c('0xa')](_0x1e5c('0x9'),_0x1e5c('0x2'),_0x391a52,_0x6c74e0,_0x2f3240);return _0x48193c(_0x6c74e0);});});};module[_0x1e5c('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index e68818b..122a131 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 _0x633e=['./rpc/mailQueue','./rpc/faxQueue','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x2e368b,_0x146562){var _0x4aed27=function(_0xbba92f){while(--_0xbba92f){_0x2e368b['push'](_0x2e368b['shift']());}};_0x4aed27(++_0x146562);}(_0x633e,0x1f4));var _0xe633=function(_0x5cc179,_0x317135){_0x5cc179=_0x5cc179-0x0;var _0x5d74ed=_0x633e[_0x5cc179];return _0x5d74ed;};'use strict';var BPromise=require('bluebird');var server=require(_0xe633('0x0'));var Realtime=require(_0xe633('0x1'));var user=require(_0xe633('0x2'));var interval=require(_0xe633('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xe633('0x4'));var smsQueue=require(_0xe633('0x5'));var mailQueue=require(_0xe633('0x6'));var faxQueue=require(_0xe633('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xe633('0x8')](user[_0xe633('0x9')]())['then'](realtime['initAgents']())['then'](interval[_0xe633('0xa')]())[_0xe633('0x8')](realtime[_0xe633('0xb')]())['then'](openchannelQueue[_0xe633('0xc')]())[_0xe633('0x8')](realtime[_0xe633('0xd')]())[_0xe633('0x8')](chatQueue[_0xe633('0xe')]())[_0xe633('0x8')](realtime[_0xe633('0xf')]())[_0xe633('0x8')](smsQueue['getSmsQueues']())[_0xe633('0x8')](realtime['initSmsQueues']())['then'](mailQueue[_0xe633('0x10')]())[_0xe633('0x8')](realtime[_0xe633('0x11')]())[_0xe633('0x8')](faxQueue[_0xe633('0x12')]())[_0xe633('0x8')](realtime[_0xe633('0x13')]())[_0xe633('0x8')](whatsappQueue[_0xe633('0x14')]())[_0xe633('0x8')](realtime[_0xe633('0x15')]())[_0xe633('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xe633('0x8')](function(_0x204fea){return initRealtime();})['then'](function(_0x355e14){return setInterval(initRealtime,0x1388);})['catch'](function(_0x20856c){console[_0xe633('0x16')](_0x20856c);});}main(); \ No newline at end of file +var _0x6073=['initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6073,0x73));var _0x3607=function(_0x3acc6f,_0x549ea3){_0x3acc6f=_0x3acc6f-0x0;var _0x4bab17=_0x6073[_0x3acc6f];return _0x4bab17;};'use strict';var BPromise=require(_0x3607('0x0'));var server=require(_0x3607('0x1'));var Realtime=require('./realtime');var user=require(_0x3607('0x2'));var interval=require(_0x3607('0x3'));var openchannelQueue=require(_0x3607('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x3607('0x5'));var faxQueue=require(_0x3607('0x6'));var whatsappQueue=require(_0x3607('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3607('0x8')]()['then'](user['getAgents']())[_0x3607('0x9')](realtime[_0x3607('0xa')]())[_0x3607('0x9')](interval[_0x3607('0xb')]())[_0x3607('0x9')](realtime[_0x3607('0xc')]())['then'](openchannelQueue[_0x3607('0xd')]())[_0x3607('0x9')](realtime[_0x3607('0xe')]())[_0x3607('0x9')](chatQueue[_0x3607('0xf')]())[_0x3607('0x9')](realtime[_0x3607('0x10')]())['then'](smsQueue[_0x3607('0x11')]())[_0x3607('0x9')](realtime[_0x3607('0x12')]())[_0x3607('0x9')](mailQueue['getMailQueues']())[_0x3607('0x9')](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0x3607('0x9')](realtime[_0x3607('0x13')]())['then'](whatsappQueue[_0x3607('0x14')]())[_0x3607('0x9')](realtime[_0x3607('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0x3607('0x16')](realtime)[_0x3607('0x9')](function(_0x12fcba){return initRealtime();})[_0x3607('0x9')](function(_0x2ff61d){return setInterval(initRealtime,0x1388);})[_0x3607('0x17')](function(_0x9e52d){console[_0x3607('0x18')](_0x9e52d);});}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 1918474..c97caf7 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 _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(_0x465e8a,_0x32643b){var _0x15fc9f=function(_0x2f3f24){while(--_0x2f3f24){_0x465e8a['push'](_0x465e8a['shift']());}};_0x15fc9f(++_0x32643b);}(_0xe14b,0x93));var _0xbe14=function(_0x8330e6,_0x975b7){_0x8330e6=_0x8330e6-0x0;var _0x511354=_0xe14b[_0x8330e6];return _0x511354;};'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 +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(_0x2712a4,_0x28e835){var _0x2dce33=function(_0x1dee1b){while(--_0x1dee1b){_0x2712a4['push'](_0x2712a4['shift']());}};_0x2dce33(++_0x28e835);}(_0xe14b,0x93));var _0xbe14=function(_0x1b61f2,_0x1e40d6){_0x1b61f2=_0x1b61f2-0x0;var _0x1e3fbe=_0xe14b[_0x1b61f2];return _0x1e3fbe;};'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 6228c26..abb31c1 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 _0xe40c=['request','error','result','catch','SendMail','jayson/promise','client'];(function(_0x1043ea,_0x25ef75){var _0x55bf65=function(_0x22e00c){while(--_0x22e00c){_0x1043ea['push'](_0x1043ea['shift']());}};_0x55bf65(++_0x25ef75);}(_0xe40c,0x1be));var _0xce40=function(_0x4330ab,_0x141abd){_0x4330ab=_0x4330ab-0x0;var _0x1d764d=_0xe40c[_0x4330ab];return _0x1d764d;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xce40('0x0'));var client=jayson[_0xce40('0x1')]['http']({'port':0x232b});function request(_0x4e9f2b,_0x28ea84){return new BPromise(function(_0x3fd06b,_0x51ed61){return client[_0xce40('0x2')](_0x4e9f2b,_0x28ea84)['then'](function(_0x1be735){if(_0x1be735[_0xce40('0x3')]){return _0x51ed61(_0x1be735[_0xce40('0x3')]['message']);}else{return _0x3fd06b(_0x1be735[_0xce40('0x4')]);}})[_0xce40('0x5')](function(_0xade196){return _0x51ed61(_0xade196);});});}exports['sendMailMessage']=function(_0x302e54,_0x4c12f5){return request(_0xce40('0x6'),{'account':_0x302e54,'message':_0x4c12f5});}; \ No newline at end of file +var _0xb614=['client','http','request','error','message','catch','SendMail','bluebird','jayson/promise'];(function(_0x460f9e,_0x17a3d8){var _0x3a8041=function(_0x484c51){while(--_0x484c51){_0x460f9e['push'](_0x460f9e['shift']());}};_0x3a8041(++_0x17a3d8);}(_0xb614,0x127));var _0x4b61=function(_0x3c19d0,_0x3363ba){_0x3c19d0=_0x3c19d0-0x0;var _0x394b5f=_0xb614[_0x3c19d0];return _0x394b5f;};'use strict';var BPromise=require(_0x4b61('0x0'));var jayson=require(_0x4b61('0x1'));var client=jayson[_0x4b61('0x2')][_0x4b61('0x3')]({'port':0x232b});function request(_0x1b618a,_0x4d18e3){return new BPromise(function(_0x5824ba,_0x332cf6){return client[_0x4b61('0x4')](_0x1b618a,_0x4d18e3)['then'](function(_0x25b416){if(_0x25b416[_0x4b61('0x5')]){return _0x332cf6(_0x25b416[_0x4b61('0x5')][_0x4b61('0x6')]);}else{return _0x5824ba(_0x25b416['result']);}})[_0x4b61('0x7')](function(_0x1d5c52){return _0x332cf6(_0x1d5c52);});});}exports['sendMailMessage']=function(_0x2675f3,_0x4f8c7){return request(_0x4b61('0x8'),{'account':_0x2675f3,'message':_0x4f8c7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 5962213..4355581 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 _0xd21d=['whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','openchannelCurrentCapacity','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime'];(function(_0x490da9,_0x31214f){var _0x5b9821=function(_0x1423e0){while(--_0x1423e0){_0x490da9['push'](_0x490da9['shift']());}};_0x5b9821(++_0x31214f);}(_0xd21d,0x14e));var _0xdd21=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xd21d[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require('lodash');var moment=require(_0xdd21('0x0'));var md5=require(_0xdd21('0x1'));var Redis=require(_0xdd21('0x2'));var config=require(_0xdd21('0x3'));config[_0xdd21('0x4')]=_[_0xdd21('0x5')](config[_0xdd21('0x4')],{'host':_0xdd21('0x6'),'port':0x18eb});var io=require(_0xdd21('0x7'))(new Redis(config[_0xdd21('0x4')]));function Agent(_0x429912){this['id']=_0x429912['id']||0x0;this[_0xdd21('0x8')]=_0x429912['name']||'';this[_0xdd21('0x9')]=_0x429912[_0xdd21('0x9')]||!![];this[_0xdd21('0xa')]=_0x429912['voicePause']||![];this[_0xdd21('0xb')]=_0x429912[_0xdd21('0xb')]||![];this[_0xdd21('0xc')]=_0x429912[_0xdd21('0xc')]||![];this[_0xdd21('0xd')]=_0x429912[_0xdd21('0xd')]||![];this[_0xdd21('0xe')]=_0x429912[_0xdd21('0xe')]||![];this[_0xdd21('0xf')]=_0x429912[_0xdd21('0xf')]||![];this[_0xdd21('0x10')]=_0xdd21('0x11');this['chatStatusTime']=0x0;this[_0xdd21('0x12')]=_0x429912['chatCapacity']||0x0;this[_0xdd21('0x13')]=0x0;this[_0xdd21('0x14')]=_0xdd21('0x11');this[_0xdd21('0x15')]=0x0;this[_0xdd21('0x16')]=_0x429912[_0xdd21('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xdd21('0x17')]=_0xdd21('0x11');this[_0xdd21('0x18')]=0x0;this['faxCapacity']=_0x429912['faxCapacity']||0x0;this[_0xdd21('0x19')]=0x0;this[_0xdd21('0x1a')]=_0xdd21('0x11');this[_0xdd21('0x1b')]=0x0;this[_0xdd21('0x1c')]=_0x429912[_0xdd21('0x1c')]||0x0;this[_0xdd21('0x1d')]=0x0;this[_0xdd21('0x1e')]=_0xdd21('0x11');this[_0xdd21('0x1f')]=0x0;this[_0xdd21('0x20')]=_0x429912[_0xdd21('0x20')]||0x0;this[_0xdd21('0x21')]=0x0;this[_0xdd21('0x22')]=_0xdd21('0x11');this[_0xdd21('0x23')]=0x0;this[_0xdd21('0x24')]=_0x429912[_0xdd21('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xdd21('0x25')]=![];this[_0xdd21('0x26')]=undefined;this['md5']='';this[_0xdd21('0x27')]();}Agent[_0xdd21('0x28')][_0xdd21('0x29')]=function(_0x42eb44){if(this[_0x42eb44+_0xdd21('0x2a')]>0x0){if(this[_0x42eb44+_0xdd21('0x2b')]>0x0&&this[_0x42eb44+_0xdd21('0x2a')]>=this[_0x42eb44+_0xdd21('0x2b')]){return'maxcapacity';}else{return _0xdd21('0x2c');}}else{return'idle';}};Agent[_0xdd21('0x28')][_0xdd21('0x27')]=function(){var _0xee272=['mail',_0xdd21('0x2d'),_0xdd21('0x2e'),_0xdd21('0x2f'),_0xdd21('0x30'),_0xdd21('0x31')];for(var _0x234cba=0x0;_0x234cba<_0xee272[_0xdd21('0x32')];_0x234cba+=0x1){var _0x591075=this['getChannelStatus'](_0xee272[_0x234cba]);if(this[_0xee272[_0x234cba]+_0xdd21('0x33')]!==_0x591075){this[_0xee272[_0x234cba]+_0xdd21('0x34')]=_[_0xdd21('0x35')](moment()[_0xdd21('0x36')]('x'));}this[_0xee272[_0x234cba]+_0xdd21('0x33')]=_0x591075;}var _0x44e3ed={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xdd21('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0xdd21('0xc')],'smsPause':this[_0xdd21('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0xdd21('0xf')],'chatStatus':this[_0xdd21('0x10')],'chatStatusTime':this[_0xdd21('0x37')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xdd21('0x13')],'mailStatus':this[_0xdd21('0x14')],'mailStatusTime':this[_0xdd21('0x15')],'mailCapacity':this[_0xdd21('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xdd21('0x17')],'faxStatusTime':this[_0xdd21('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xdd21('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xdd21('0x1b')],'smsCapacity':this[_0xdd21('0x1c')],'smsCurrentCapacity':this[_0xdd21('0x1d')],'whatsappStatus':this[_0xdd21('0x1e')],'whatsappStatusTime':this[_0xdd21('0x1f')],'whatsappCapacity':this[_0xdd21('0x20')],'whatsappCurrentCapacity':this[_0xdd21('0x21')],'openchannelStatus':this[_0xdd21('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xdd21('0x38')],'busy':this[_0xdd21('0x25')],'busyQueue':this[_0xdd21('0x26')]};var _0x2f3d12=md5(JSON[_0xdd21('0x39')](_0x44e3ed));if(this['md5']!==_0x2f3d12){this[_0xdd21('0x1')]=_0x2f3d12;io[_0xdd21('0x3a')](_0xdd21('0x3b'),_0x44e3ed);}};module[_0xdd21('0x3c')]=Agent; \ No newline at end of file +var _0x1856=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busyQueue','md5','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','StatusTime','toNumber','format','Status','chatStatus','chatCurrentCapacity','mailCurrentCapacity','whatsappStatus','openchannelStatus','openchannelCurrentCapacity','busy','stringify','emit','user:save','exports','lodash'];(function(_0x1ca9a9,_0x3b4de5){var _0x5a420c=function(_0xe9e96f){while(--_0xe9e96f){_0x1ca9a9['push'](_0x1ca9a9['shift']());}};_0x5a420c(++_0x3b4de5);}(_0x1856,0x185));var _0x6185=function(_0x42b525,_0x50fe4d){_0x42b525=_0x42b525-0x0;var _0x25bad3=_0x1856[_0x42b525];return _0x25bad3;};'use strict';var _=require(_0x6185('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x6185('0x1'));var config=require(_0x6185('0x2'));config[_0x6185('0x3')]=_[_0x6185('0x4')](config[_0x6185('0x3')],{'host':_0x6185('0x5'),'port':0x18eb});var io=require(_0x6185('0x6'))(new Redis(config[_0x6185('0x3')]));function Agent(_0x4bfce3){this['id']=_0x4bfce3['id']||0x0;this['name']=_0x4bfce3[_0x6185('0x7')]||'';this[_0x6185('0x8')]=_0x4bfce3[_0x6185('0x8')]||!![];this[_0x6185('0x9')]=_0x4bfce3['voicePause']||![];this[_0x6185('0xa')]=_0x4bfce3['chatPause']||![];this[_0x6185('0xb')]=_0x4bfce3[_0x6185('0xb')]||![];this[_0x6185('0xc')]=_0x4bfce3[_0x6185('0xc')]||![];this['smsPause']=_0x4bfce3[_0x6185('0xd')]||![];this[_0x6185('0xe')]=_0x4bfce3[_0x6185('0xe')]||![];this['chatStatus']='unknown';this[_0x6185('0xf')]=0x0;this[_0x6185('0x10')]=_0x4bfce3[_0x6185('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x6185('0x11')]='unknown';this[_0x6185('0x12')]=0x0;this['mailCapacity']=_0x4bfce3[_0x6185('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x6185('0x14')]=_0x6185('0x15');this[_0x6185('0x16')]=0x0;this[_0x6185('0x17')]=_0x4bfce3[_0x6185('0x17')]||0x0;this[_0x6185('0x18')]=0x0;this[_0x6185('0x19')]=_0x6185('0x15');this[_0x6185('0x1a')]=0x0;this[_0x6185('0x1b')]=_0x4bfce3[_0x6185('0x1b')]||0x0;this[_0x6185('0x1c')]=0x0;this['whatsappStatus']=_0x6185('0x15');this[_0x6185('0x1d')]=0x0;this['whatsappCapacity']=_0x4bfce3[_0x6185('0x1e')]||0x0;this[_0x6185('0x1f')]=0x0;this['openchannelStatus']='unknown';this[_0x6185('0x20')]=0x0;this[_0x6185('0x21')]=_0x4bfce3['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x6185('0x22')]=undefined;this[_0x6185('0x23')]='';this[_0x6185('0x24')]();}Agent[_0x6185('0x25')][_0x6185('0x26')]=function(_0x351834){if(this[_0x351834+'CurrentCapacity']>0x0){if(this[_0x351834+_0x6185('0x27')]>0x0&&this[_0x351834+_0x6185('0x28')]>=this[_0x351834+_0x6185('0x27')]){return _0x6185('0x29');}else{return _0x6185('0x2a');}}else{return _0x6185('0x2b');}};Agent[_0x6185('0x25')][_0x6185('0x24')]=function(){var _0x2cba0d=[_0x6185('0x2c'),_0x6185('0x2d'),_0x6185('0x2e'),_0x6185('0x2f'),_0x6185('0x30'),_0x6185('0x31')];for(var _0x11504e=0x0;_0x11504e<_0x2cba0d['length'];_0x11504e+=0x1){var _0x4f4f6c=this[_0x6185('0x26')](_0x2cba0d[_0x11504e]);if(this[_0x2cba0d[_0x11504e]+'Status']!==_0x4f4f6c){this[_0x2cba0d[_0x11504e]+_0x6185('0x32')]=_[_0x6185('0x33')](moment()[_0x6185('0x34')]('x'));}this[_0x2cba0d[_0x11504e]+_0x6185('0x35')]=_0x4f4f6c;}var _0x4cd0cb={'id':this['id'],'name':this[_0x6185('0x7')],'online':this['online'],'voicePause':this[_0x6185('0x9')],'chatPause':this[_0x6185('0xa')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x6185('0xc')],'openchannelPause':this[_0x6185('0xe')],'chatStatus':this[_0x6185('0x36')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x6185('0x37')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x6185('0x12')],'mailCapacity':this[_0x6185('0x13')],'mailCurrentCapacity':this[_0x6185('0x38')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x6185('0x16')],'faxCapacity':this[_0x6185('0x17')],'faxCurrentCapacity':this[_0x6185('0x18')],'smsStatus':this[_0x6185('0x19')],'smsStatusTime':this[_0x6185('0x1a')],'smsCapacity':this[_0x6185('0x1b')],'smsCurrentCapacity':this[_0x6185('0x1c')],'whatsappStatus':this[_0x6185('0x39')],'whatsappStatusTime':this[_0x6185('0x1d')],'whatsappCapacity':this[_0x6185('0x1e')],'whatsappCurrentCapacity':this[_0x6185('0x1f')],'openchannelStatus':this[_0x6185('0x3a')],'openchannelStatusTime':this[_0x6185('0x20')],'openchannelCapacity':this[_0x6185('0x21')],'openchannelCurrentCapacity':this[_0x6185('0x3b')],'busy':this[_0x6185('0x3c')],'busyQueue':this[_0x6185('0x22')]};var _0x570c43=md5(JSON[_0x6185('0x3d')](_0x4cd0cb));if(this[_0x6185('0x23')]!==_0x570c43){this['md5']=_0x570c43;io[_0x6185('0x3e')](_0x6185('0x3f'),_0x4cd0cb);}};module[_0x6185('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b5282cf..77821dc 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 _0xbabe=['util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','exports','lodash'];(function(_0x38f967,_0xe1e2dd){var _0x3831be=function(_0x10c530){while(--_0x10c530){_0x38f967['push'](_0x38f967['shift']());}};_0x3831be(++_0xe1e2dd);}(_0xbabe,0x17f));var _0xebab=function(_0xdaf61,_0x3e5392){_0xdaf61=_0xdaf61-0x0;var _0x5c7da9=_0xbabe[_0xdaf61];return _0x5c7da9;};'use strict';var _=require(_0xebab('0x0'));var md5=require('md5');var util=require(_0xebab('0x1'));var Redis=require(_0xebab('0x2'));var config=require(_0xebab('0x3'));config[_0xebab('0x4')]=_[_0xebab('0x5')](config[_0xebab('0x4')],{'host':_0xebab('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xebab('0x4')]));function ChatQueue(_0x20cb0b){this['id']=_0x20cb0b['id']||0x0;this[_0xebab('0x7')]=_0x20cb0b[_0xebab('0x7')]||'';this[_0xebab('0x8')]=_0x20cb0b[_0xebab('0x8')]||0xa;this['strategy']=_0x20cb0b[_0xebab('0x9')]||_0xebab('0xa');this['Agents']=_0x20cb0b[_0xebab('0xb')];this['mapAgentsId']={};this[_0xebab('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xebab('0xd')]();}ChatQueue[_0xebab('0xe')][_0xebab('0xf')]=function(){var _0xc12f92=this[_0xebab('0x10')]['_rr'];this['mapAgentsId']=_[_0xebab('0x11')](this[_0xebab('0xb')],'id');this[_0xebab('0x10')][_0xebab('0x12')]=_0xc12f92;};ChatQueue[_0xebab('0xe')][_0xebab('0xd')]=function(){this[_0xebab('0x13')]=0x0;this[_0xebab('0x14')]=0x0;for(var _0x1dfeab=0x0;_0x1dfeab=0x0?this[_0xebab('0x18')]:0x0;var _0x1e1a6f={'id':this['id'],'available':this[_0xebab('0x18')],'loggedIn':this[_0xebab('0x13')],'name':this[_0xebab('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x4bbe6f=md5(JSON[_0xebab('0x19')](_0x1e1a6f));if(this[_0xebab('0x1a')]!==_0x4bbe6f){this[_0xebab('0x1a')]=_0x4bbe6f;io['to'](util[_0xebab('0x1b')](_0xebab('0x1c'),_0x1e1a6f[_0xebab('0x7')]))[_0xebab('0x1d')](_0xebab('0x1e'),_0x1e1a6f);}};module[_0xebab('0x1f')]=ChatQueue; \ No newline at end of file +var _0x735e=['updateRouting','updateRealtime','mapAgentsId','_rr','prototype','loggedIn','online','chatPause','paused','available','format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting'];(function(_0x4f83ea,_0x4b484e){var _0x3e41f6=function(_0x5cfcdc){while(--_0x5cfcdc){_0x4f83ea['push'](_0x4f83ea['shift']());}};_0x3e41f6(++_0x4b484e);}(_0x735e,0x16e));var _0xe735=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0x735e[_0x5f5cce];return _0x705ecf;};'use strict';var _=require('lodash');var md5=require(_0xe735('0x0'));var util=require(_0xe735('0x1'));var Redis=require(_0xe735('0x2'));var config=require(_0xe735('0x3'));config[_0xe735('0x4')]=_['defaults'](config[_0xe735('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe735('0x5'))(new Redis(config[_0xe735('0x4')]));function ChatQueue(_0x523edc){this['id']=_0x523edc['id']||0x0;this[_0xe735('0x6')]=_0x523edc[_0xe735('0x6')]||'';this[_0xe735('0x7')]=_0x523edc[_0xe735('0x7')]||0xa;this[_0xe735('0x8')]=_0x523edc['strategy']||_0xe735('0x9');this[_0xe735('0xa')]=_0x523edc['Agents'];this['mapAgentsId']={};this[_0xe735('0xb')]=0x0;this['md5']='';this[_0xe735('0xc')]();this[_0xe735('0xd')]();}ChatQueue['prototype'][_0xe735('0xc')]=function(){var _0x1061e8=this[_0xe735('0xe')]['_rr'];this[_0xe735('0xe')]=_['map'](this[_0xe735('0xa')],'id');this[_0xe735('0xe')][_0xe735('0xf')]=_0x1061e8;};ChatQueue[_0xe735('0x10')][_0xe735('0xd')]=function(){this[_0xe735('0x11')]=0x0;this['paused']=0x0;for(var _0x4fa53c=0x0;_0x4fa53c=0x0?this[_0xe735('0x15')]:0x0;var _0x2ea32d={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xe735('0x6')],'paused':this[_0xe735('0x14')],'waiting':this[_0xe735('0xb')]};var _0x2a6bf5=md5(JSON['stringify'](_0x2ea32d));if(this[_0xe735('0x0')]!==_0x2a6bf5){this[_0xe735('0x0')]=_0x2a6bf5;io['to'](util[_0xe735('0x16')](_0xe735('0x17'),_0x2ea32d[_0xe735('0x6')]))[_0xe735('0x18')](_0xe735('0x19'),_0x2ea32d);}};module[_0xe735('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index ce27984..ed56946 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 _0xfa89=['md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xfa89,0x1cb));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0x9fa8('0x0'));var util=require('util');var Redis=require(_0x9fa8('0x1'));var config=require(_0x9fa8('0x2'));config[_0x9fa8('0x3')]=_['defaults'](config[_0x9fa8('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x9fa8('0x4'))(new Redis(config['redis']));function FaxQueue(_0x3b8d86){this['id']=_0x3b8d86['id']||0x0;this[_0x9fa8('0x5')]=_0x3b8d86[_0x9fa8('0x5')]||'';this[_0x9fa8('0x6')]=_0x3b8d86[_0x9fa8('0x6')]||0xa;this[_0x9fa8('0x7')]=_0x3b8d86[_0x9fa8('0x7')]||'beepall';this[_0x9fa8('0x8')]=_0x3b8d86[_0x9fa8('0x8')];this[_0x9fa8('0x9')]={};this[_0x9fa8('0xa')]=0x0;this[_0x9fa8('0x0')]='';this[_0x9fa8('0xb')]();this[_0x9fa8('0xc')]();}FaxQueue['prototype'][_0x9fa8('0xb')]=function(){var _0x5360c4=this['mapAgentsId'][_0x9fa8('0xd')];this[_0x9fa8('0x9')]=_[_0x9fa8('0xe')](this[_0x9fa8('0x8')],'id');this[_0x9fa8('0x9')]['_rr']=_0x5360c4;};FaxQueue[_0x9fa8('0xf')][_0x9fa8('0xc')]=function(){this[_0x9fa8('0x10')]=0x0;this[_0x9fa8('0x11')]=0x0;for(var _0x5e95a7=0x0;_0x5e95a7=0x0?this['available']:0x0;var _0x2f6457={'id':this['id'],'available':this[_0x9fa8('0x15')],'loggedIn':this[_0x9fa8('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x9fa8('0xa')]};var _0x53844f=md5(JSON[_0x9fa8('0x16')](_0x2f6457));if(this[_0x9fa8('0x0')]!==_0x53844f){this['md5']=_0x53844f;io['to'](util[_0x9fa8('0x17')](_0x9fa8('0x18'),_0x2f6457[_0x9fa8('0x5')]))['emit'](_0x9fa8('0x19'),_0x2f6457);}};module[_0x9fa8('0x1a')]=FaxQueue; \ No newline at end of file +var _0x71a2=['updateRouting','prototype','map','Agents','updateRealtime','loggedIn','length','online','faxPause','paused','available','stringify','format','fax:queue:%s','fax_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','mapAgentsId','waiting'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x71a2,0x127));var _0x271a=function(_0x3a22ef,_0x25707b){_0x3a22ef=_0x3a22ef-0x0;var _0x32210e=_0x71a2[_0x3a22ef];return _0x32210e;};'use strict';var _=require(_0x271a('0x0'));var md5=require(_0x271a('0x1'));var util=require('util');var Redis=require(_0x271a('0x2'));var config=require(_0x271a('0x3'));config[_0x271a('0x4')]=_[_0x271a('0x5')](config[_0x271a('0x4')],{'host':_0x271a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x271a('0x4')]));function FaxQueue(_0x521881){this['id']=_0x521881['id']||0x0;this[_0x271a('0x7')]=_0x521881[_0x271a('0x7')]||'';this['timeout']=_0x521881[_0x271a('0x8')]||0xa;this[_0x271a('0x9')]=_0x521881[_0x271a('0x9')]||_0x271a('0xa');this['Agents']=_0x521881['Agents'];this[_0x271a('0xb')]={};this[_0x271a('0xc')]=0x0;this[_0x271a('0x1')]='';this[_0x271a('0xd')]();this['updateRealtime']();}FaxQueue[_0x271a('0xe')]['updateRouting']=function(){var _0x7f0c0e=this[_0x271a('0xb')]['_rr'];this['mapAgentsId']=_[_0x271a('0xf')](this[_0x271a('0x10')],'id');this[_0x271a('0xb')]['_rr']=_0x7f0c0e;};FaxQueue[_0x271a('0xe')][_0x271a('0x11')]=function(){this[_0x271a('0x12')]=0x0;this['paused']=0x0;for(var _0x2761f4=0x0;_0x2761f4=0x0?this[_0x271a('0x17')]:0x0;var _0x4dc19d={'id':this['id'],'available':this[_0x271a('0x17')],'loggedIn':this[_0x271a('0x12')],'name':this[_0x271a('0x7')],'paused':this['paused'],'waiting':this[_0x271a('0xc')]};var _0x29dc35=md5(JSON[_0x271a('0x18')](_0x4dc19d));if(this[_0x271a('0x1')]!==_0x29dc35){this[_0x271a('0x1')]=_0x29dc35;io['to'](util[_0x271a('0x19')](_0x271a('0x1a'),_0x4dc19d[_0x271a('0x7')]))['emit'](_0x271a('0x1b'),_0x4dc19d);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 022df9c..3708dca 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 _0x6cbe=['name','Intervals'];(function(_0x2809c6,_0x753ba8){var _0x162017=function(_0x5d2a4c){while(--_0x5d2a4c){_0x2809c6['push'](_0x2809c6['shift']());}};_0x162017(++_0x753ba8);}(_0x6cbe,0x1b6));var _0xe6cb=function(_0x27c436,_0x283d5f){_0x27c436=_0x27c436-0x0;var _0x453a21=_0x6cbe[_0x27c436];return _0x453a21;};'use strict';function Interval(_0x31fcd2){this['id']=_0x31fcd2['id']||0x0;this[_0xe6cb('0x0')]=_0x31fcd2[_0xe6cb('0x0')]||'';this[_0xe6cb('0x1')]=_0x31fcd2['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xe7f9=['Intervals','exports','name'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xe7f9,0x12b));var _0x9e7f=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0xe7f9[_0x386b03];return _0xd3d524;};'use strict';function Interval(_0x3e7d49){this['id']=_0x3e7d49['id']||0x0;this[_0x9e7f('0x0')]=_0x3e7d49['name']||'';this[_0x9e7f('0x1')]=_0x3e7d49[_0x9e7f('0x1')]||{};}module[_0x9e7f('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 5a6e616..156cce5 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 _0xdc81=['lodash','md5','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','emit','mail_queue:save'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0xdc81,0x82));var _0x1dc8=function(_0x1aa033,_0x3c824e){_0x1aa033=_0x1aa033-0x0;var _0x287f76=_0xdc81[_0x1aa033];return _0x287f76;};'use strict';var _=require(_0x1dc8('0x0'));var md5=require(_0x1dc8('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1dc8('0x2')]=_[_0x1dc8('0x3')](config[_0x1dc8('0x2')],{'host':_0x1dc8('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1dc8('0x2')]));function MailQueue(_0x287b90){this['id']=_0x287b90['id']||0x0;this['name']=_0x287b90[_0x1dc8('0x5')]||'';this[_0x1dc8('0x6')]=_0x287b90['timeout']||0xa;this['strategy']=_0x287b90[_0x1dc8('0x7')]||_0x1dc8('0x8');this[_0x1dc8('0x9')]=_0x287b90[_0x1dc8('0x9')];this['mapAgentsId']={};this[_0x1dc8('0xa')]=0x0;this[_0x1dc8('0x1')]='';this[_0x1dc8('0xb')]();this[_0x1dc8('0xc')]();}MailQueue[_0x1dc8('0xd')][_0x1dc8('0xb')]=function(){var _0x3e164f=this[_0x1dc8('0xe')][_0x1dc8('0xf')];this['mapAgentsId']=_[_0x1dc8('0x10')](this['Agents'],'id');this[_0x1dc8('0xe')][_0x1dc8('0xf')]=_0x3e164f;};MailQueue[_0x1dc8('0xd')]['updateRealtime']=function(){this[_0x1dc8('0x11')]=0x0;this[_0x1dc8('0x12')]=0x0;for(var _0x529d44=0x0;_0x529d44=0x0?this[_0x1dc8('0x16')]:0x0;var _0x11883c={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1dc8('0x11')],'name':this[_0x1dc8('0x5')],'paused':this['paused'],'waiting':this[_0x1dc8('0xa')]};var _0x21ea2d=md5(JSON[_0x1dc8('0x17')](_0x11883c));if(this[_0x1dc8('0x1')]!==_0x21ea2d){this[_0x1dc8('0x1')]=_0x21ea2d;io['to'](util['format']('mail:queue:%s',_0x11883c[_0x1dc8('0x5')]))[_0x1dc8('0x18')](_0x1dc8('0x19'),_0x11883c);}};module['exports']=MailQueue; \ No newline at end of file +var _0x175a=['online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','prototype','mapAgentsId','_rr','updateRealtime','loggedIn','paused','length'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x175a,0x19d));var _0xa175=function(_0x180b51,_0x4cf36d){_0x180b51=_0x180b51-0x0;var _0x92599f=_0x175a[_0x180b51];return _0x92599f;};'use strict';var _=require(_0xa175('0x0'));var md5=require(_0xa175('0x1'));var util=require(_0xa175('0x2'));var Redis=require(_0xa175('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xa175('0x4')](config['redis'],{'host':_0xa175('0x5'),'port':0x18eb});var io=require(_0xa175('0x6'))(new Redis(config['redis']));function MailQueue(_0x3ebacb){this['id']=_0x3ebacb['id']||0x0;this[_0xa175('0x7')]=_0x3ebacb['name']||'';this[_0xa175('0x8')]=_0x3ebacb['timeout']||0xa;this[_0xa175('0x9')]=_0x3ebacb[_0xa175('0x9')]||_0xa175('0xa');this[_0xa175('0xb')]=_0x3ebacb[_0xa175('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xa175('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xa175('0xc')]['updateRouting']=function(){var _0x31f7bd=this[_0xa175('0xd')]['_rr'];this[_0xa175('0xd')]=_['map'](this[_0xa175('0xb')],'id');this[_0xa175('0xd')][_0xa175('0xe')]=_0x31f7bd;};MailQueue['prototype'][_0xa175('0xf')]=function(){this[_0xa175('0x10')]=0x0;this[_0xa175('0x11')]=0x0;for(var _0x191646=0x0;_0x191646=0x0?this[_0xa175('0x15')]:0x0;var _0x27eef0={'id':this['id'],'available':this[_0xa175('0x15')],'loggedIn':this[_0xa175('0x10')],'name':this['name'],'paused':this[_0xa175('0x11')],'waiting':this['waiting']};var _0x24a658=md5(JSON[_0xa175('0x16')](_0x27eef0));if(this[_0xa175('0x1')]!==_0x24a658){this[_0xa175('0x1')]=_0x24a658;io['to'](util['format'](_0xa175('0x17'),_0x27eef0['name']))[_0xa175('0x18')](_0xa175('0x19'),_0x27eef0);}};module[_0xa175('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index c5a1b2d..5fcef9f 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x1261,0x144));var _0x1126=function(_0x54fbed,_0x3c77a7){_0x54fbed=_0x54fbed-0x0;var _0x333bbc=_0x1261[_0x54fbed];return _0x333bbc;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('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(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0x2ef3,0xba));var _0x32ef=function(_0x4a5546,_0xbed62f){_0x4a5546=_0x4a5546-0x0;var _0x2e4b7a=_0x2ef3[_0x4a5546];return _0x2e4b7a;};'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 32cb9e8..675f44b 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 _0xe205=['_rr','map','prototype','loggedIn','length','online','paused','available','stringify','format','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','Agents','waiting','updateRouting','updateRealtime','mapAgentsId'];(function(_0x365b81,_0x240945){var _0x4b3f21=function(_0x43fa3a){while(--_0x43fa3a){_0x365b81['push'](_0x365b81['shift']());}};_0x4b3f21(++_0x240945);}(_0xe205,0xa7));var _0x5e20=function(_0x4d0bc1,_0x3ad0dd){_0x4d0bc1=_0x4d0bc1-0x0;var _0x3f824a=_0xe205[_0x4d0bc1];return _0x3f824a;};'use strict';var _=require(_0x5e20('0x0'));var md5=require(_0x5e20('0x1'));var util=require(_0x5e20('0x2'));var Redis=require(_0x5e20('0x3'));var config=require(_0x5e20('0x4'));config[_0x5e20('0x5')]=_[_0x5e20('0x6')](config[_0x5e20('0x5')],{'host':_0x5e20('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5e20('0x5')]));function SmsQueue(_0x1b26a2){this['id']=_0x1b26a2['id']||0x0;this[_0x5e20('0x8')]=_0x1b26a2[_0x5e20('0x8')]||'';this['timeout']=_0x1b26a2['timeout']||0xa;this[_0x5e20('0x9')]=_0x1b26a2['strategy']||'beepall';this[_0x5e20('0xa')]=_0x1b26a2[_0x5e20('0xa')];this['mapAgentsId']={};this[_0x5e20('0xb')]=0x0;this[_0x5e20('0x1')]='';this[_0x5e20('0xc')]();this[_0x5e20('0xd')]();}SmsQueue['prototype'][_0x5e20('0xc')]=function(){var _0xda6476=this[_0x5e20('0xe')][_0x5e20('0xf')];this[_0x5e20('0xe')]=_[_0x5e20('0x10')](this['Agents'],'id');this[_0x5e20('0xe')][_0x5e20('0xf')]=_0xda6476;};SmsQueue[_0x5e20('0x11')]['updateRealtime']=function(){this[_0x5e20('0x12')]=0x0;this['paused']=0x0;for(var _0x1f47f3=0x0;_0x1f47f3=0x0?this[_0x5e20('0x16')]:0x0;var _0xf3488f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5e20('0x12')],'name':this[_0x5e20('0x8')],'paused':this['paused'],'waiting':this[_0x5e20('0xb')]};var _0x1b1457=md5(JSON[_0x5e20('0x17')](_0xf3488f));if(this[_0x5e20('0x1')]!==_0x1b1457){this['md5']=_0x1b1457;io['to'](util[_0x5e20('0x18')]('sms:queue:%s',_0xf3488f['name']))['emit']('sms_queue:save',_0xf3488f);}};module[_0x5e20('0x19')]=SmsQueue; \ No newline at end of file +var _0xfc1e=['redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','smsPause','available','sms:queue:%s','emit','sms_queue:save','ioredis','../../../config/environment'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0xfc1e[_0x1cd47d];return _0x29d52f;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0xefc1('0x0'));var config=require(_0xefc1('0x1'));config[_0xefc1('0x2')]=_[_0xefc1('0x3')](config[_0xefc1('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xefc1('0x4'))(new Redis(config[_0xefc1('0x2')]));function SmsQueue(_0x489ead){this['id']=_0x489ead['id']||0x0;this['name']=_0x489ead[_0xefc1('0x5')]||'';this[_0xefc1('0x6')]=_0x489ead[_0xefc1('0x6')]||0xa;this[_0xefc1('0x7')]=_0x489ead[_0xefc1('0x7')]||_0xefc1('0x8');this[_0xefc1('0x9')]=_0x489ead[_0xefc1('0x9')];this[_0xefc1('0xa')]={};this[_0xefc1('0xb')]=0x0;this[_0xefc1('0xc')]='';this['updateRouting']();this[_0xefc1('0xd')]();}SmsQueue[_0xefc1('0xe')][_0xefc1('0xf')]=function(){var _0x1f4846=this[_0xefc1('0xa')][_0xefc1('0x10')];this[_0xefc1('0xa')]=_[_0xefc1('0x11')](this[_0xefc1('0x9')],'id');this[_0xefc1('0xa')][_0xefc1('0x10')]=_0x1f4846;};SmsQueue['prototype'][_0xefc1('0xd')]=function(){this[_0xefc1('0x12')]=0x0;this[_0xefc1('0x13')]=0x0;for(var _0x36633f=0x0;_0x36633f=0x0?this[_0xefc1('0x17')]:0x0;var _0x38923c={'id':this['id'],'available':this[_0xefc1('0x17')],'loggedIn':this[_0xefc1('0x12')],'name':this['name'],'paused':this[_0xefc1('0x13')],'waiting':this[_0xefc1('0xb')]};var _0x2670a9=md5(JSON['stringify'](_0x38923c));if(this['md5']!==_0x2670a9){this[_0xefc1('0xc')]=_0x2670a9;io['to'](util['format'](_0xefc1('0x18'),_0x38923c['name']))[_0xefc1('0x19')](_0xefc1('0x1a'),_0x38923c);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b89b6a0..5a7f674 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 _0x9ad4=['defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','available','loggedIn','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','../../../config/environment','redis'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x9ad4,0xa4));var _0x49ad=function(_0x5837a4,_0x15c0f7){_0x5837a4=_0x5837a4-0x0;var _0x1feb62=_0x9ad4[_0x5837a4];return _0x1feb62;};'use strict';var _=require('lodash');var md5=require(_0x49ad('0x0'));var util=require(_0x49ad('0x1'));var Redis=require('ioredis');var config=require(_0x49ad('0x2'));config[_0x49ad('0x3')]=_[_0x49ad('0x4')](config[_0x49ad('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x49ad('0x5'))(new Redis(config[_0x49ad('0x3')]));function WhatsappQueue(_0x52d61f){this['id']=_0x52d61f['id']||0x0;this[_0x49ad('0x6')]=_0x52d61f[_0x49ad('0x6')]||'';this[_0x49ad('0x7')]=_0x52d61f[_0x49ad('0x7')]||0xa;this[_0x49ad('0x8')]=_0x52d61f['strategy']||'beepall';this[_0x49ad('0x9')]=_0x52d61f[_0x49ad('0x9')];this[_0x49ad('0xa')]={};this[_0x49ad('0xb')]=0x0;this[_0x49ad('0x0')]='';this[_0x49ad('0xc')]();this[_0x49ad('0xd')]();}WhatsappQueue[_0x49ad('0xe')][_0x49ad('0xc')]=function(){var _0x52bd91=this[_0x49ad('0xa')][_0x49ad('0xf')];this[_0x49ad('0xa')]=_[_0x49ad('0x10')](this['Agents'],'id');this[_0x49ad('0xa')][_0x49ad('0xf')]=_0x52bd91;};WhatsappQueue[_0x49ad('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x49ad('0x11')]=0x0;for(var _0x5f4d1f=0x0;_0x5f4d1f=0x0?this[_0x49ad('0x14')]:0x0;var _0x118bb0={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x49ad('0x6')],'paused':this[_0x49ad('0x11')],'waiting':this[_0x49ad('0xb')]};var _0x19dd4a=md5(JSON[_0x49ad('0x16')](_0x118bb0));if(this[_0x49ad('0x0')]!==_0x19dd4a){this['md5']=_0x19dd4a;io['to'](util[_0x49ad('0x17')](_0x49ad('0x18'),_0x118bb0[_0x49ad('0x6')]))[_0x49ad('0x19')](_0x49ad('0x1a'),_0x118bb0);}};module[_0x49ad('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x9645=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','waiting','stringify','emit','whatsapp_queue:save','lodash','md5','../../../config/environment','redis','defaults','localhost'];(function(_0x46aabc,_0x1b0b24){var _0x10c273=function(_0x341129){while(--_0x341129){_0x46aabc['push'](_0x46aabc['shift']());}};_0x10c273(++_0x1b0b24);}(_0x9645,0x108));var _0x5964=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0x9645[_0x5e3a45];return _0x13419f;};'use strict';var _=require(_0x5964('0x0'));var md5=require(_0x5964('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x5964('0x2'));config[_0x5964('0x3')]=_[_0x5964('0x4')](config[_0x5964('0x3')],{'host':_0x5964('0x5'),'port':0x18eb});var io=require(_0x5964('0x6'))(new Redis(config[_0x5964('0x3')]));function WhatsappQueue(_0x5cb523){this['id']=_0x5cb523['id']||0x0;this[_0x5964('0x7')]=_0x5cb523['name']||'';this[_0x5964('0x8')]=_0x5cb523['timeout']||0xa;this[_0x5964('0x9')]=_0x5cb523[_0x5964('0x9')]||_0x5964('0xa');this[_0x5964('0xb')]=_0x5cb523[_0x5964('0xb')];this[_0x5964('0xc')]={};this['waiting']=0x0;this[_0x5964('0x1')]='';this[_0x5964('0xd')]();this[_0x5964('0xe')]();}WhatsappQueue[_0x5964('0xf')][_0x5964('0xd')]=function(){var _0x3805c9=this[_0x5964('0xc')][_0x5964('0x10')];this[_0x5964('0xc')]=_[_0x5964('0x11')](this[_0x5964('0xb')],'id');this['mapAgentsId']['_rr']=_0x3805c9;};WhatsappQueue[_0x5964('0xf')][_0x5964('0xe')]=function(){this['loggedIn']=0x0;this[_0x5964('0x12')]=0x0;for(var _0x3b691d=0x0;_0x3b691d=0x0?this[_0x5964('0x16')]:0x0;var _0x32180a={'id':this['id'],'available':this[_0x5964('0x16')],'loggedIn':this[_0x5964('0x15')],'name':this[_0x5964('0x7')],'paused':this[_0x5964('0x12')],'waiting':this[_0x5964('0x17')]};var _0x7c35b9=md5(JSON[_0x5964('0x18')](_0x32180a));if(this[_0x5964('0x1')]!==_0x7c35b9){this[_0x5964('0x1')]=_0x7c35b9;io['to'](util['format']('whatsapp:queue:%s',_0x32180a[_0x5964('0x7')]))[_0x5964('0x19')](_0x5964('0x1a'),_0x32180a);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 3170f82..1be50ac 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 2fd4138..a230983 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 _0xc575=['updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x3042d5,_0x349534){var _0x1acfef=function(_0x5a920f){while(--_0x5a920f){_0x3042d5['push'](_0x3042d5['shift']());}};_0x1acfef(++_0x349534);}(_0xc575,0xe7));var _0x5c57=function(_0x4a4a43,_0x115ccf){_0x4a4a43=_0x4a4a43-0x0;var _0x5893a6=_0xc575[_0x4a4a43];return _0x5893a6;};'use strict';var client=require('../client');exports[_0x5c57('0x0')]=function(_0x23e18b,_0x54294e){return client['Request']('UpdateChatInteraction',{'body':_0x54294e,'options':{'where':{'id':_0x23e18b}},'log':_0x5c57('0x1')});};exports['addTags']=function(_0x47bc66,_0xdd904d){return client['Request'](_0x5c57('0x2'),{'body':_0xdd904d,'options':{'where':{'id':_0x47bc66}},'log':_0x5c57('0x3')});}; \ No newline at end of file +var _0xcd44=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','update'];(function(_0x5274f4,_0x276139){var _0x3fe4e6=function(_0x3d2de8){while(--_0x3d2de8){_0x5274f4['push'](_0x5274f4['shift']());}};_0x3fe4e6(++_0x276139);}(_0xcd44,0x144));var _0x4cd4=function(_0x1fbf82,_0x5dc503){_0x1fbf82=_0x1fbf82-0x0;var _0x5c6908=_0xcd44[_0x1fbf82];return _0x5c6908;};'use strict';var client=require('../client');exports[_0x4cd4('0x0')]=function(_0x6b5053,_0x3b3011){return client[_0x4cd4('0x1')]('UpdateChatInteraction',{'body':_0x3b3011,'options':{'where':{'id':_0x6b5053}},'log':_0x4cd4('0x2')});};exports[_0x4cd4('0x3')]=function(_0x2576cb,_0x1f88bc){return client['Request'](_0x4cd4('0x4'),{'body':_0x1f88bc,'options':{'where':{'id':_0x2576cb}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index f8ead29..aa3884e 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 _0xa94d=['Request','CreateChatMessage','createChatMessage'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xa94d,0xed));var _0xda94=function(_0x1d2bb7,_0x12c9b6){_0x1d2bb7=_0x1d2bb7-0x0;var _0x52e953=_0xa94d[_0x1d2bb7];return _0x52e953;};'use strict';var client=require('../client');exports['create']=function(_0x1d157a){return client[_0xda94('0x0')](_0xda94('0x1'),{'body':_0x1d157a,'log':_0xda94('0x2')});}; \ No newline at end of file +var _0x3573=['CreateChatMessage','createChatMessage','create'];(function(_0x25caa8,_0x14a97d){var _0x43180d=function(_0x32cb40){while(--_0x32cb40){_0x25caa8['push'](_0x25caa8['shift']());}};_0x43180d(++_0x14a97d);}(_0x3573,0x185));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x3357('0x0')]=function(_0x2e4dfb){return client['Request'](_0x3357('0x1'),{'body':_0x2e4dfb,'log':_0x3357('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 44f1787..8f7fe2d 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 _0xb458=['User','Agents','online','../client','getChatQueues','Request','timeout','strategy'];(function(_0x29fbf6,_0x48ff24){var _0x18a882=function(_0x4b10ce){while(--_0x4b10ce){_0x29fbf6['push'](_0x29fbf6['shift']());}};_0x18a882(++_0x48ff24);}(_0xb458,0x103));var _0x8b45=function(_0x39df6e,_0x548a5a){_0x39df6e=_0x39df6e-0x0;var _0xcbceb6=_0xb458[_0x39df6e];return _0xcbceb6;};'use strict';var client=require(_0x8b45('0x0'));exports[_0x8b45('0x1')]=function(){return function(){return client[_0x8b45('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x8b45('0x3'),_0x8b45('0x4')],'include':[{'model':_0x8b45('0x5'),'as':_0x8b45('0x6'),'attributes':['id','name',_0x8b45('0x7'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x1e19=['online','chatPause','../client','getChatQueues','Request','GetChatQueue','name'];(function(_0xcef047,_0x41c686){var _0x3f0a62=function(_0x50c439){while(--_0x50c439){_0xcef047['push'](_0xcef047['shift']());}};_0x3f0a62(++_0x41c686);}(_0x1e19,0x1c9));var _0x91e1=function(_0x22f46f,_0x4655d4){_0x22f46f=_0x22f46f-0x0;var _0x554945=_0x1e19[_0x22f46f];return _0x554945;};'use strict';var client=require(_0x91e1('0x0'));exports[_0x91e1('0x1')]=function(){return function(){return client[_0x91e1('0x2')](_0x91e1('0x3'),{'options':{'raw':![],'attributes':['id',_0x91e1('0x4'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x91e1('0x4'),_0x91e1('0x5'),_0x91e1('0x6')]}]},'log':_0x91e1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index cd61750..baa5c75 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 _0x27c5=['DESC','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x327fb0,_0x387a15){var _0x13b762=function(_0x24d37a){while(--_0x24d37a){_0x327fb0['push'](_0x327fb0['shift']());}};_0x13b762(++_0x387a15);}(_0x27c5,0x173));var _0x527c=function(_0x33a6bd,_0x564362){_0x33a6bd=_0x33a6bd-0x0;var _0x339aff=_0x27c5[_0x33a6bd];return _0x339aff;};'use strict';var client=require('../client');exports['create']=function(_0x157017){return client[_0x527c('0x0')](_0x527c('0x1'),{'body':_0x157017,'log':'CreateChatQueueReport'});};exports[_0x527c('0x2')]=function(_0x458db1,_0x371ae5){return client[_0x527c('0x0')](_0x527c('0x3'),{'body':_0x371ae5,'options':{'where':{'uniqueid':_0x458db1},'order':[['id',_0x527c('0x4')]],'limit':0x1},'log':_0x527c('0x3')});}; \ No newline at end of file +var _0xc18a=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0xc18a,0x1cf));var _0xac18=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0xc18a[_0xf973b7];return _0x499087;};'use strict';var client=require(_0xac18('0x0'));exports[_0xac18('0x1')]=function(_0x1bb84d){return client[_0xac18('0x2')]('CreateChatQueueReport',{'body':_0x1bb84d,'log':_0xac18('0x3')});};exports[_0xac18('0x4')]=function(_0x3bf117,_0x3da5f5){return client[_0xac18('0x2')](_0xac18('0x5'),{'body':_0x3da5f5,'options':{'where':{'uniqueid':_0x3bf117},'order':[['id',_0xac18('0x6')]],'limit':0x1},'log':_0xac18('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e2bc011..398764a 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(_0x425c62,_0x41eb91){var _0x20b356=function(_0x280015){while(--_0x280015){_0x425c62['push'](_0x425c62['shift']());}};_0x20b356(++_0x41eb91);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_0x7a54,0x106));var _0x47a5=function(_0x2002f2,_0x290f40){_0x2002f2=_0x2002f2-0x0;var _0x4acd0d=_0x7a54[_0x2002f2];return _0x4acd0d;};'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 bd78919..4a4c60d 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 _0x1209=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x3b2ef1,_0x58e546){var _0x123c52=function(_0x2c0967){while(--_0x2c0967){_0x3b2ef1['push'](_0x3b2ef1['shift']());}};_0x123c52(++_0x58e546);}(_0x1209,0xde));var _0x9120=function(_0x32b4aa,_0x12eba6){_0x32b4aa=_0x32b4aa-0x0;var _0x473160=_0x1209[_0x32b4aa];return _0x473160;};'use strict';var client=require(_0x9120('0x0'));exports[_0x9120('0x1')]=function(_0x307930){return client[_0x9120('0x2')](_0x9120('0x3'),{'body':_0x307930,'log':_0x9120('0x4')});}; \ No newline at end of file +var _0xaae3=['../client','create','Request','createFaxMessage'];(function(_0x4ae42d,_0x109488){var _0x3289a9=function(_0xd2c2ca){while(--_0xd2c2ca){_0x4ae42d['push'](_0x4ae42d['shift']());}};_0x3289a9(++_0x109488);}(_0xaae3,0x1b8));var _0x3aae=function(_0x8cb470,_0x2b9757){_0x8cb470=_0x8cb470-0x0;var _0x2ca139=_0xaae3[_0x8cb470];return _0x2ca139;};'use strict';var client=require(_0x3aae('0x0'));exports[_0x3aae('0x1')]=function(_0x339cde){return client[_0x3aae('0x2')]('CreateFaxMessage',{'body':_0x339cde,'log':_0x3aae('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 1fa1e9d..11a3d1a 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 _0x8ded=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','Agents','name'];(function(_0x4c9198,_0x27d807){var _0x3c0463=function(_0x2faaed){while(--_0x2faaed){_0x4c9198['push'](_0x4c9198['shift']());}};_0x3c0463(++_0x27d807);}(_0x8ded,0x110));var _0xd8de=function(_0x743f68,_0x56e670){_0x743f68=_0x743f68-0x0;var _0x46383f=_0x8ded[_0x743f68];return _0x46383f;};'use strict';var client=require(_0xd8de('0x0'));exports[_0xd8de('0x1')]=function(){return function(){return client[_0xd8de('0x2')](_0xd8de('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xd8de('0x4'),_0xd8de('0x5')],'include':[{'model':'User','as':_0xd8de('0x6'),'attributes':['id',_0xd8de('0x7'),_0xd8de('0x8'),_0xd8de('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x3ab1=['GetFaxQueue','name','timeout','strategy','User','Agents','faxPause','Request'];(function(_0x4cacca,_0x4f42a6){var _0x3211e3=function(_0x2cc881){while(--_0x2cc881){_0x4cacca['push'](_0x4cacca['shift']());}};_0x3211e3(++_0x4f42a6);}(_0x3ab1,0x97));var _0x13ab=function(_0x43b4b1,_0x5a5217){_0x43b4b1=_0x43b4b1-0x0;var _0x5bea8d=_0x3ab1[_0x43b4b1];return _0x5bea8d;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x13ab('0x0')](_0x13ab('0x1'),{'options':{'raw':![],'attributes':['id',_0x13ab('0x2'),_0x13ab('0x3'),_0x13ab('0x4')],'include':[{'model':_0x13ab('0x5'),'as':_0x13ab('0x6'),'attributes':['id',_0x13ab('0x2'),'online',_0x13ab('0x7')]}]},'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 3dbf702..29ea657 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 _0xa2e9=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x218bda,_0xfbee7){var _0x4ea5d2=function(_0x4457c0){while(--_0x4457c0){_0x218bda['push'](_0x218bda['shift']());}};_0x4ea5d2(++_0xfbee7);}(_0xa2e9,0x167));var _0x9a2e=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0xa2e9[_0xb83ec2];return _0x4d2fbf;};'use strict';var client=require(_0x9a2e('0x0'));exports['create']=function(_0x17468d){return client[_0x9a2e('0x1')](_0x9a2e('0x2'),{'body':_0x17468d,'log':'CreateFaxQueueReport'});};exports[_0x9a2e('0x3')]=function(_0x37e1f2,_0x4c8253){return client[_0x9a2e('0x1')](_0x9a2e('0x4'),{'body':_0x4c8253,'options':{'where':{'uniqueid':_0x37e1f2},'order':[['id',_0x9a2e('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x8f3b=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x5b3969,_0x5c1ab6){var _0x239332=function(_0x4e4b67){while(--_0x4e4b67){_0x5b3969['push'](_0x5b3969['shift']());}};_0x239332(++_0x5c1ab6);}(_0x8f3b,0x183));var _0xb8f3=function(_0x4528ac,_0x581b2e){_0x4528ac=_0x4528ac-0x0;var _0x42180b=_0x8f3b[_0x4528ac];return _0x42180b;};'use strict';var client=require(_0xb8f3('0x0'));exports[_0xb8f3('0x1')]=function(_0x4e25c4){return client[_0xb8f3('0x2')](_0xb8f3('0x3'),{'body':_0x4e25c4,'log':_0xb8f3('0x3')});};exports['update']=function(_0x343d11,_0x383f7d){return client[_0xb8f3('0x2')](_0xb8f3('0x4'),{'body':_0x383f7d,'options':{'where':{'uniqueid':_0x343d11},'order':[['id',_0xb8f3('0x5')]],'limit':0x1},'log':_0xb8f3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index aba3368..1776b9a 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 _0x9379=['../client','getIntervals','name','Interval','Intervals','interval'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9379,0xea));var _0x9937=function(_0x55bda2,_0x4315d0){_0x55bda2=_0x55bda2-0x0;var _0x2e0c4c=_0x9379[_0x55bda2];return _0x2e0c4c;};'use strict';var client=require(_0x9937('0x0'));exports[_0x9937('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9937('0x2')],'include':[{'model':_0x9937('0x3'),'as':_0x9937('0x4'),'attributes':['id','name',_0x9937('0x5')]}]},'log':_0x9937('0x1')});};}; \ No newline at end of file +var _0x3767=['name','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x5765bb,_0x45998c){var _0x452a60=function(_0x23d107){while(--_0x23d107){_0x5765bb['push'](_0x5765bb['shift']());}};_0x452a60(++_0x45998c);}(_0x3767,0x1c3));var _0x7376=function(_0x441683,_0x300421){_0x441683=_0x441683-0x0;var _0x3fdff3=_0x3767[_0x441683];return _0x3fdff3;};'use strict';var client=require('../client');exports[_0x7376('0x0')]=function(){return function(){return client[_0x7376('0x1')](_0x7376('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x7376('0x3'),'as':_0x7376('0x4'),'attributes':['id',_0x7376('0x5'),'interval']}]},'log':_0x7376('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 197c262..a5337cb 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 _0x5f66=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x283fc5,_0x1f70f6){var _0x5377c8=function(_0x40076a){while(--_0x40076a){_0x283fc5['push'](_0x283fc5['shift']());}};_0x5377c8(++_0x1f70f6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var client=require('../client');exports[_0x65f6('0x0')]=function(_0x4a3887,_0x2d5fd9){return client[_0x65f6('0x1')](_0x65f6('0x2'),{'body':_0x2d5fd9,'options':{'where':{'id':_0x4a3887}},'log':_0x65f6('0x3')});};exports[_0x65f6('0x4')]=function(_0x5eb9ad,_0x3c5029){return client['Request'](_0x65f6('0x5'),{'body':_0x3c5029,'options':{'where':{'id':_0x5eb9ad}},'log':_0x65f6('0x6')});}; \ No newline at end of file +var _0xd117=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x547f8d,_0x3462bb){var _0x1c21ee=function(_0x56026a){while(--_0x56026a){_0x547f8d['push'](_0x547f8d['shift']());}};_0x1c21ee(++_0x3462bb);}(_0xd117,0x182));var _0x7d11=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0xd117[_0x542da8];return _0x533d7e;};'use strict';var client=require(_0x7d11('0x0'));exports[_0x7d11('0x1')]=function(_0x2737ce,_0x45ee65){return client[_0x7d11('0x2')](_0x7d11('0x3'),{'body':_0x45ee65,'options':{'where':{'id':_0x2737ce}},'log':_0x7d11('0x4')});};exports[_0x7d11('0x5')]=function(_0x3c07be,_0x31fcb0){return client[_0x7d11('0x2')](_0x7d11('0x6'),{'body':_0x31fcb0,'options':{'where':{'id':_0x3c07be}},'log':_0x7d11('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2e4dfc4..a1ac30a 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 _0x218f=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x40be3c,_0x5618ef){var _0x5c2b9c=function(_0x56ccd0){while(--_0x56ccd0){_0x40be3c['push'](_0x40be3c['shift']());}};_0x5c2b9c(++_0x5618ef);}(_0x218f,0x12b));var _0xf218=function(_0x1d9509,_0x558168){_0x1d9509=_0x1d9509-0x0;var _0x2be027=_0x218f[_0x1d9509];return _0x2be027;};'use strict';var client=require(_0xf218('0x0'));exports[_0xf218('0x1')]=function(_0x31741d){return client['Request'](_0xf218('0x2'),{'body':_0x31741d,'log':_0xf218('0x3')});}; \ No newline at end of file +var _0x4c3e=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x4c3e,0x70));var _0xe4c3=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x4c3e[_0x46aff0];return _0x9d78cf;};'use strict';var client=require(_0xe4c3('0x0'));exports[_0xe4c3('0x1')]=function(_0x3d5863){return client[_0xe4c3('0x2')](_0xe4c3('0x3'),{'body':_0x3d5863,'log':_0xe4c3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bd935d3..30462bb 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 _0xb495=['GetMailQueue','name','timeout','strategy','User','Agents','mailPause','../client','getMailQueues','Request'];(function(_0xd7ee0e,_0x2a69b0){var _0x5f2b3e=function(_0x568bf9){while(--_0x568bf9){_0xd7ee0e['push'](_0xd7ee0e['shift']());}};_0x5f2b3e(++_0x2a69b0);}(_0xb495,0x93));var _0x5b49=function(_0x155b25,_0x80a08d){_0x155b25=_0x155b25-0x0;var _0x503a8c=_0xb495[_0x155b25];return _0x503a8c;};'use strict';var client=require(_0x5b49('0x0'));exports[_0x5b49('0x1')]=function(){return function(){return client[_0x5b49('0x2')](_0x5b49('0x3'),{'options':{'raw':![],'attributes':['id',_0x5b49('0x4'),_0x5b49('0x5'),_0x5b49('0x6')],'include':[{'model':_0x5b49('0x7'),'as':_0x5b49('0x8'),'attributes':['id',_0x5b49('0x4'),'online',_0x5b49('0x9')]}]},'log':_0x5b49('0x1')});};}; \ No newline at end of file +var _0x4ef8=['GetMailQueue','name','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x4ef8,0x9d));var _0x84ef=function(_0x4c1080,_0x4aeae4){_0x4c1080=_0x4c1080-0x0;var _0x537178=_0x4ef8[_0x4c1080];return _0x537178;};'use strict';var client=require(_0x84ef('0x0'));exports[_0x84ef('0x1')]=function(){return function(){return client[_0x84ef('0x2')](_0x84ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x84ef('0x4'),'timeout',_0x84ef('0x5')],'include':[{'model':_0x84ef('0x6'),'as':_0x84ef('0x7'),'attributes':['id',_0x84ef('0x4'),_0x84ef('0x8'),_0x84ef('0x9')]}]},'log':_0x84ef('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 44d800a..7639d45 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 _0xdd7a=['UpdateMailQueueReport','DESC','Request','CreateMailQueueReport','update'];(function(_0x49a449,_0x1a86f6){var _0xf699cb=function(_0x1425cb){while(--_0x1425cb){_0x49a449['push'](_0x49a449['shift']());}};_0xf699cb(++_0x1a86f6);}(_0xdd7a,0x8e));var _0xadd7=function(_0x5ea19d,_0x3b8a9f){_0x5ea19d=_0x5ea19d-0x0;var _0x2d371e=_0xdd7a[_0x5ea19d];return _0x2d371e;};'use strict';var client=require('../client');exports['create']=function(_0xeccdd9){return client[_0xadd7('0x0')](_0xadd7('0x1'),{'body':_0xeccdd9,'log':_0xadd7('0x1')});};exports[_0xadd7('0x2')]=function(_0x1bd8b9,_0x577db1){return client['Request'](_0xadd7('0x3'),{'body':_0x577db1,'options':{'where':{'uniqueid':_0x1bd8b9},'order':[['id',_0xadd7('0x4')]],'limit':0x1},'log':_0xadd7('0x3')});}; \ No newline at end of file +var _0x6eb0=['DESC','../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x2a14e6,_0x1fec89){var _0x4687ef=function(_0x33244b){while(--_0x33244b){_0x2a14e6['push'](_0x2a14e6['shift']());}};_0x4687ef(++_0x1fec89);}(_0x6eb0,0x67));var _0x06eb=function(_0x2226d4,_0x205961){_0x2226d4=_0x2226d4-0x0;var _0x41cb6c=_0x6eb0[_0x2226d4];return _0x41cb6c;};'use strict';var client=require(_0x06eb('0x0'));exports['create']=function(_0x4500a5){return client[_0x06eb('0x1')](_0x06eb('0x2'),{'body':_0x4500a5,'log':_0x06eb('0x2')});};exports[_0x06eb('0x3')]=function(_0x1e1648,_0x471977){return client['Request'](_0x06eb('0x4'),{'body':_0x471977,'options':{'where':{'uniqueid':_0x1e1648},'order':[['id',_0x06eb('0x5')]],'limit':0x1},'log':_0x06eb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7656b87..d9d78bf 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 _0xa365=['addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x2011ae,_0x4bec4b){var _0x1bfa52=function(_0x3492da){while(--_0x3492da){_0x2011ae['push'](_0x2011ae['shift']());}};_0x1bfa52(++_0x4bec4b);}(_0xa365,0x1ed));var _0x5a36=function(_0x3f0a10,_0x244777){_0x3f0a10=_0x3f0a10-0x0;var _0x22475f=_0xa365[_0x3f0a10];return _0x22475f;};'use strict';var client=require(_0x5a36('0x0'));exports['update']=function(_0x4090fa,_0x26fb6b){return client[_0x5a36('0x1')](_0x5a36('0x2'),{'body':_0x26fb6b,'options':{'where':{'id':_0x4090fa}},'log':'updateOpenchannelInteraction'});};exports[_0x5a36('0x3')]=function(_0x113ca1,_0x86c9ce){return client[_0x5a36('0x1')](_0x5a36('0x4'),{'body':_0x86c9ce,'options':{'where':{'id':_0x113ca1}},'log':_0x5a36('0x5')});}; \ No newline at end of file +var _0x84bd=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update'];(function(_0x246cbe,_0x19305c){var _0x855b0=function(_0x2c8d0d){while(--_0x2c8d0d){_0x246cbe['push'](_0x246cbe['shift']());}};_0x855b0(++_0x19305c);}(_0x84bd,0xe8));var _0xd84b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x84bd[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0xd84b('0x0'));exports[_0xd84b('0x1')]=function(_0x18f78e,_0x152abd){return client['Request'](_0xd84b('0x2'),{'body':_0x152abd,'options':{'where':{'id':_0x18f78e}},'log':_0xd84b('0x3')});};exports[_0xd84b('0x4')]=function(_0x1430bc,_0x21e1b8){return client['Request'](_0xd84b('0x5'),{'body':_0x21e1b8,'options':{'where':{'id':_0x1430bc}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index aa40a84..81c9d1b 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 _0x6551=['../client','Request'];(function(_0x28d90a,_0x518da0){var _0x27c430=function(_0x55f8ad){while(--_0x55f8ad){_0x28d90a['push'](_0x28d90a['shift']());}};_0x27c430(++_0x518da0);}(_0x6551,0x1c0));var _0x1655=function(_0x144567,_0x356b5d){_0x144567=_0x144567-0x0;var _0x1b5901=_0x6551[_0x144567];return _0x1b5901;};'use strict';var client=require(_0x1655('0x0'));exports['create']=function(_0xed6f58){return client[_0x1655('0x1')]('CreateOpenchannelMessage',{'body':_0xed6f58,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xfabf=['../client','create','CreateOpenchannelMessage'];(function(_0x2b94e7,_0xb8750a){var _0x21ca65=function(_0x4e4ed8){while(--_0x4e4ed8){_0x2b94e7['push'](_0x2b94e7['shift']());}};_0x21ca65(++_0xb8750a);}(_0xfabf,0x1e3));var _0xffab=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfabf[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xffab('0x0'));exports[_0xffab('0x1')]=function(_0x2e15d6){return client['Request'](_0xffab('0x2'),{'body':_0x2e15d6,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 1889c6a..a032183 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 _0x5dda=['timeout','strategy','Agents','online','openchannelPause','../client','GetOpenchannelQueue','name'];(function(_0x4dfbed,_0xf04fc1){var _0x5232f6=function(_0x534493){while(--_0x534493){_0x4dfbed['push'](_0x4dfbed['shift']());}};_0x5232f6(++_0xf04fc1);}(_0x5dda,0xed));var _0xa5dd=function(_0x2c82c3,_0x12e4ba){_0x2c82c3=_0x2c82c3-0x0;var _0x3af250=_0x5dda[_0x2c82c3];return _0x3af250;};'use strict';var client=require(_0xa5dd('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0xa5dd('0x1'),{'options':{'raw':![],'attributes':['id',_0xa5dd('0x2'),_0xa5dd('0x3'),_0xa5dd('0x4')],'include':[{'model':'User','as':_0xa5dd('0x5'),'attributes':['id',_0xa5dd('0x2'),_0xa5dd('0x6'),_0xa5dd('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x3de8=['strategy','Agents','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3de8,0x1bd));var _0x83de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x83de('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x83de('0x1')](_0x83de('0x2'),{'options':{'raw':![],'attributes':['id',_0x83de('0x3'),_0x83de('0x4'),_0x83de('0x5')],'include':[{'model':'User','as':_0x83de('0x6'),'attributes':['id',_0x83de('0x3'),_0x83de('0x7'),_0x83de('0x8')]}]},'log':_0x83de('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 92b08bf..4fe33e7 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 _0xdace=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x37a0ab,_0x34b900){var _0x13ca1d=function(_0x3c6a41){while(--_0x3c6a41){_0x37a0ab['push'](_0x37a0ab['shift']());}};_0x13ca1d(++_0x34b900);}(_0xdace,0xad));var _0xedac=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xdace[_0x3afe18];return _0x19ed1f;};'use strict';var client=require(_0xedac('0x0'));exports[_0xedac('0x1')]=function(_0x422a31){return client[_0xedac('0x2')](_0xedac('0x3'),{'body':_0x422a31,'log':_0xedac('0x3')});};exports[_0xedac('0x4')]=function(_0x1bc6dd,_0x2bcfa3){return client[_0xedac('0x2')](_0xedac('0x5'),{'body':_0x2bcfa3,'options':{'where':{'uniqueid':_0x1bc6dd},'order':[['id',_0xedac('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x3cde=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x37df6c,_0x2a9666){var _0x41f7aa=function(_0x2c9605){while(--_0x2c9605){_0x37df6c['push'](_0x37df6c['shift']());}};_0x41f7aa(++_0x2a9666);}(_0x3cde,0x1d5));var _0xe3cd=function(_0x93cca6,_0x2a950c){_0x93cca6=_0x93cca6-0x0;var _0x632a5f=_0x3cde[_0x93cca6];return _0x632a5f;};'use strict';var client=require(_0xe3cd('0x0'));exports[_0xe3cd('0x1')]=function(_0xe1e38e){return client[_0xe3cd('0x2')]('CreateOpenchannelQueueReport',{'body':_0xe1e38e,'log':_0xe3cd('0x3')});};exports[_0xe3cd('0x4')]=function(_0x2dcd29,_0x11f19d){return client[_0xe3cd('0x2')](_0xe3cd('0x5'),{'body':_0x11f19d,'options':{'where':{'uniqueid':_0x2dcd29},'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 486c3d0..4c4c411 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 _0x95f4=['AddTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','Request'];(function(_0x1a03fe,_0x30a3cd){var _0x4d9d1a=function(_0xd7a059){while(--_0xd7a059){_0x1a03fe['push'](_0x1a03fe['shift']());}};_0x4d9d1a(++_0x30a3cd);}(_0x95f4,0xf1));var _0x495f=function(_0x3ceecb,_0x12f19f){_0x3ceecb=_0x3ceecb-0x0;var _0x53028b=_0x95f4[_0x3ceecb];return _0x53028b;};'use strict';var client=require(_0x495f('0x0'));exports[_0x495f('0x1')]=function(_0x1cc98d,_0x495214){return client['Request'](_0x495f('0x2'),{'body':_0x495214,'options':{'where':{'id':_0x1cc98d}},'log':_0x495f('0x3')});};exports['addTags']=function(_0x501377,_0x87cc22){return client[_0x495f('0x4')](_0x495f('0x5'),{'body':_0x87cc22,'options':{'where':{'id':_0x501377}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x2123=['AddTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x24a8f1,_0x2d4fab){var _0x487552=function(_0x33db8e){while(--_0x33db8e){_0x24a8f1['push'](_0x24a8f1['shift']());}};_0x487552(++_0x2d4fab);}(_0x2123,0x190));var _0x3212=function(_0x3d586d,_0x2fc7ae){_0x3d586d=_0x3d586d-0x0;var _0x59964a=_0x2123[_0x3d586d];return _0x59964a;};'use strict';var client=require(_0x3212('0x0'));exports[_0x3212('0x1')]=function(_0x420d05,_0x3424c2){return client[_0x3212('0x2')](_0x3212('0x3'),{'body':_0x3424c2,'options':{'where':{'id':_0x420d05}},'log':_0x3212('0x4')});};exports[_0x3212('0x5')]=function(_0x304f80,_0x6ca653){return client[_0x3212('0x2')](_0x3212('0x6'),{'body':_0x6ca653,'options':{'where':{'id':_0x304f80}},'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 5442357..ff11fea 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 _0x5bde=['Request','CreateSmsMessage','../client','create'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x5bde,0x1ce));var _0xe5bd=function(_0x165e34,_0x36f348){_0x165e34=_0x165e34-0x0;var _0x2d990d=_0x5bde[_0x165e34];return _0x2d990d;};'use strict';var client=require(_0xe5bd('0x0'));exports[_0xe5bd('0x1')]=function(_0x20373a){return client[_0xe5bd('0x2')](_0xe5bd('0x3'),{'body':_0x20373a,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x5b0f=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5b0f,0xb2));var _0xf5b0=function(_0xc6875e,_0x56687b){_0xc6875e=_0xc6875e-0x0;var _0x21e733=_0x5b0f[_0xc6875e];return _0x21e733;};'use strict';var client=require(_0xf5b0('0x0'));exports[_0xf5b0('0x1')]=function(_0x223862){return client[_0xf5b0('0x2')](_0xf5b0('0x3'),{'body':_0x223862,'log':_0xf5b0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d379525..caf1f43 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x3fe8b2,_0x50542c){var _0x431b0c=function(_0xcbd46c){while(--_0xcbd46c){_0x3fe8b2['push'](_0x3fe8b2['shift']());}};_0x431b0c(++_0x50542c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0xcb91[_0x1df7b8];return _0x29d911;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x3df036,_0x57465f){var _0x229981=function(_0x526d06){while(--_0x526d06){_0x3df036['push'](_0x3df036['shift']());}};_0x229981(++_0x57465f);}(_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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 50fa395..9c65a0f 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0xedd9,0xfc));var _0x9edd=function(_0x1047b4,_0x57bb01){_0x1047b4=_0x1047b4-0x0;var _0x3e6e60=_0xedd9[_0x1047b4];return _0x3e6e60;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x3bd3b0,_0x32bcb7){var _0x23d367=function(_0xdfb1ac){while(--_0xdfb1ac){_0x3bd3b0['push'](_0x3bd3b0['shift']());}};_0x23d367(++_0x32bcb7);}(_0x70e0,0x17b));var _0x070e=function(_0x5cf1ae,_0x4e2897){_0x5cf1ae=_0x5cf1ae-0x0;var _0x36a2a2=_0x70e0[_0x5cf1ae];return _0x36a2a2;};'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 b5751da..a0de09a 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(_0x1ea2a2,_0x2c2803){var _0x1eba24=function(_0x5377a7){while(--_0x5377a7){_0x1ea2a2['push'](_0x1ea2a2['shift']());}};_0x1eba24(++_0x2c2803);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x3e8ca2,_0x255d01){var _0x4f21e5=function(_0x2d7e52){while(--_0x2d7e52){_0x3e8ca2['push'](_0x3e8ca2['shift']());}};_0x4f21e5(++_0x255d01);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 d013151..ea4e16b 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 _0x0295=['addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction'];(function(_0x418bb9,_0x14cb6a){var _0x237bc2=function(_0x32bc41){while(--_0x32bc41){_0x418bb9['push'](_0x418bb9['shift']());}};_0x237bc2(++_0x14cb6a);}(_0x0295,0x1f0));var _0x5029=function(_0x135573,_0x479526){_0x135573=_0x135573-0x0;var _0x13ea56=_0x0295[_0x135573];return _0x13ea56;};'use strict';var client=require(_0x5029('0x0'));exports['update']=function(_0x5e71d0,_0x2dfab1){return client['Request']('UpdateWhatsappInteraction',{'body':_0x2dfab1,'options':{'where':{'id':_0x5e71d0}},'log':_0x5029('0x1')});};exports[_0x5029('0x2')]=function(_0x157a4f,_0x3d0af1){return client[_0x5029('0x3')](_0x5029('0x4'),{'body':_0x3d0af1,'options':{'where':{'id':_0x157a4f}},'log':_0x5029('0x5')});}; \ No newline at end of file +var _0x7412=['UpdateWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0x7412,0x161));var _0x2741=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x7412[_0x39c734];return _0xb2a2f9;};'use strict';var client=require(_0x2741('0x0'));exports['update']=function(_0x5eff0c,_0x77f7f7){return client['Request'](_0x2741('0x1'),{'body':_0x77f7f7,'options':{'where':{'id':_0x5eff0c}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x509ce6,_0x552836){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x552836,'options':{'where':{'id':_0x509ce6}},'log':_0x2741('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d834e93..45c11a0 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 _0x2ad6=['Request','createWhatsappMessage','../client','create'];(function(_0x3bf265,_0x24ebd6){var _0x40ef92=function(_0x5234eb){while(--_0x5234eb){_0x3bf265['push'](_0x3bf265['shift']());}};_0x40ef92(++_0x24ebd6);}(_0x2ad6,0x1be));var _0x62ad=function(_0x44d977,_0x5d35ed){_0x44d977=_0x44d977-0x0;var _0x526d43=_0x2ad6[_0x44d977];return _0x526d43;};'use strict';var client=require(_0x62ad('0x0'));exports[_0x62ad('0x1')]=function(_0x5211f9){return client[_0x62ad('0x2')]('CreateWhatsappMessage',{'body':_0x5211f9,'log':_0x62ad('0x3')});}; \ No newline at end of file +var _0x1425=['../client','create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x1425,0x1a8));var _0x5142=function(_0x266b2f,_0x166dde){_0x266b2f=_0x266b2f-0x0;var _0x2d8559=_0x1425[_0x266b2f];return _0x2d8559;};'use strict';var client=require(_0x5142('0x0'));exports[_0x5142('0x1')]=function(_0x3a0280){return client['Request'](_0x5142('0x2'),{'body':_0x3a0280,'log':_0x5142('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 2b6b476..35c22ec 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 _0x24b9=['timeout','strategy','User','online','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x1f1305,_0x2435f5){var _0x571a9d=function(_0x411dfc){while(--_0x411dfc){_0x1f1305['push'](_0x1f1305['shift']());}};_0x571a9d(++_0x2435f5);}(_0x24b9,0x74));var _0x924b=function(_0x466e89,_0xede644){_0x466e89=_0x466e89-0x0;var _0x40b366=_0x24b9[_0x466e89];return _0x40b366;};'use strict';var client=require('../client');exports[_0x924b('0x0')]=function(){return function(){return client[_0x924b('0x1')](_0x924b('0x2'),{'options':{'raw':![],'attributes':['id',_0x924b('0x3'),_0x924b('0x4'),_0x924b('0x5')],'include':[{'model':_0x924b('0x6'),'as':'Agents','attributes':['id',_0x924b('0x3'),_0x924b('0x7'),'whatsappPause']}]},'log':_0x924b('0x0')});};}; \ No newline at end of file +var _0x9c7c=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x576f0d,_0x8b8ca2){var _0x3ff2ca=function(_0x33303f){while(--_0x33303f){_0x576f0d['push'](_0x576f0d['shift']());}};_0x3ff2ca(++_0x8b8ca2);}(_0x9c7c,0x117));var _0xc9c7=function(_0x41f1c1,_0x447d24){_0x41f1c1=_0x41f1c1-0x0;var _0x1433d2=_0x9c7c[_0x41f1c1];return _0x1433d2;};'use strict';var client=require('../client');exports[_0xc9c7('0x0')]=function(){return function(){return client[_0xc9c7('0x1')](_0xc9c7('0x2'),{'options':{'raw':![],'attributes':['id',_0xc9c7('0x3'),_0xc9c7('0x4'),_0xc9c7('0x5')],'include':[{'model':_0xc9c7('0x6'),'as':_0xc9c7('0x7'),'attributes':['id',_0xc9c7('0x3'),_0xc9c7('0x8'),_0xc9c7('0x9')]}]},'log':_0xc9c7('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index c9870bd..15e70e6 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 _0x3e68=['Request','CreateWhatsappQueueReport','update','DESC','../client','create'];(function(_0x280c35,_0x4b9a51){var _0x13fabb=function(_0x480507){while(--_0x480507){_0x280c35['push'](_0x280c35['shift']());}};_0x13fabb(++_0x4b9a51);}(_0x3e68,0x8e));var _0x83e6=function(_0x1b092a,_0x1f2475){_0x1b092a=_0x1b092a-0x0;var _0x22c7b6=_0x3e68[_0x1b092a];return _0x22c7b6;};'use strict';var client=require(_0x83e6('0x0'));exports[_0x83e6('0x1')]=function(_0x52ed85){return client[_0x83e6('0x2')]('CreateWhatsappQueueReport',{'body':_0x52ed85,'log':_0x83e6('0x3')});};exports[_0x83e6('0x4')]=function(_0x519bce,_0xdbfc8e){return client['Request']('UpdateWhatsappQueueReport',{'body':_0xdbfc8e,'options':{'where':{'uniqueid':_0x519bce},'order':[['id',_0x83e6('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xcb36=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','create'];(function(_0x364e84,_0x1bd4d5){var _0x1468af=function(_0x191b95){while(--_0x191b95){_0x364e84['push'](_0x364e84['shift']());}};_0x1468af(++_0x1bd4d5);}(_0xcb36,0x176));var _0x6cb3=function(_0x51a975,_0x2b66ff){_0x51a975=_0x51a975-0x0;var _0x486bde=_0xcb36[_0x51a975];return _0x486bde;};'use strict';var client=require('../client');exports[_0x6cb3('0x0')]=function(_0x2d8fa8){return client[_0x6cb3('0x1')](_0x6cb3('0x2'),{'body':_0x2d8fa8,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x267667,_0x403b86){return client[_0x6cb3('0x1')](_0x6cb3('0x3'),{'body':_0x403b86,'options':{'where':{'uniqueid':_0x267667},'order':[['id',_0x6cb3('0x4')]],'limit':0x1},'log':_0x6cb3('0x3')});}; \ 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 fb6d648..2ebe51b 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 _0x6fe2=['name','consequence','length','error','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x6fe2,0x141));var _0x26fe=function(_0x34d28a,_0x338792){_0x34d28a=_0x34d28a-0x0;var _0x62a1a8=_0x6fe2[_0x34d28a];return _0x62a1a8;};'use strict';var schema=require(_0x26fe('0x0'));var _=require(_0x26fe('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x26fe('0x2'))(_0x26fe('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x26fe('0x4')},'timeout':{'type':'number','message':_0x26fe('0x5')}});function writeLog(_0x550629,_0x3e814c,_0x2683d0){return logger[_0x26fe('0x6')](util[_0x26fe('0x7')](_0x26fe('0x8'),_0x550629,_0x3e814c['name'],_0x2683d0));}function handleFindAgent(_0x4aab9e){return function(_0x48651d){return _0x48651d[_0x26fe('0x9')]['toLowerCase']()===_0x4aab9e['toLowerCase']();};}exports[_0x26fe('0xa')]=function(_0x48204d,_0x4424a1,_0xa088ed,_0x1db6f6){return function(_0x581f81){try{var _0x50eb51={'name':_0x4424a1[0x0],'timeout':_0x4424a1[0x1]};var _0x34c94b=queue['validate'](_0x50eb51,{'typecast':!![]});if(_0x34c94b[_0x26fe('0xb')]){logger[_0x26fe('0xc')]('[%s][AGENT]\x20%s',_0x48204d,_['map'](_0x34c94b,_0x26fe('0xd'))['join'](',\x20'));_0x581f81[_0x26fe('0xe')]();}else{var _0x399324=_[_0x26fe('0xf')](_0xa088ed[_0x26fe('0x10')],handleFindAgent(_0x50eb51['name']));if(_0x399324){var _0x1da8a5=(_0x50eb51[_0x26fe('0x11')]||0xa)*0x3e8;var _0x37f70f,_0x34c5f5;var _0x9ce65b=seqqueue[_0x26fe('0x12')](_0x1da8a5);_0x9ce65b['id']=_0x48204d;_0x9ce65b[_0x26fe('0x13')]=_0x1da8a5;_0x9ce65b[_0x26fe('0x14')]=_0x1db6f6[_0x26fe('0x14')];writeLog(_0x48204d,_0x399324,util[_0x26fe('0x7')](_0x26fe('0x15'),_0x1da8a5));_0xa088ed[_0x26fe('0x16')][_0x48204d]['on'](_0x26fe('0x17'),function(){logger[_0x26fe('0x6')](_0x26fe('0x18'),_0x48204d);clearTimeout(_0x34c5f5);_0x34c5f5=undefined;_0x9ce65b[_0x26fe('0x19')]();if(_0xa088ed[_0x26fe('0x16')][_0x48204d]){delete _0xa088ed[_0x26fe('0x16')][_0x48204d];}_0x581f81[_0x26fe('0xe')]();});_0xa088ed[_0x26fe('0x16')][_0x48204d]['on'](_0x26fe('0x1a'),function(){if(_0xa088ed[_0x26fe('0x16')][_0x48204d]){delete _0xa088ed['rules'][_0x48204d];}});_0x34c5f5=setTimeout(function(){logger[_0x26fe('0x6')]('[%s][AGENT]\x20ROUTING\x20END',_0x48204d);clearTimeout(_0x34c5f5);_0x9ce65b[_0x26fe('0x19')]();_0x581f81['next']();},_0x1da8a5);strategy['agent'](_0x9ce65b,_0x399324,_0xa088ed,_0x1db6f6);}else{logger[_0x26fe('0xc')](_0x26fe('0x1b'),_0x48204d,_0x50eb51[_0x26fe('0x9')]);_0x581f81[_0x26fe('0xe')]();}}}catch(_0x475e1a){console[_0x26fe('0x1c')](_0x475e1a);logger[_0x26fe('0xc')](_0x26fe('0x1d'),_0x48204d,_0x475e1a['stack']);_0x581f81[_0x26fe('0xe')]();}};}; \ No newline at end of file +var _0x14d2=['format','name','toLowerCase','length','error','map','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string'];(function(_0x21c74d,_0x36a28d){var _0x293cd1=function(_0x532501){while(--_0x532501){_0x21c74d['push'](_0x21c74d['shift']());}};_0x293cd1(++_0x36a28d);}(_0x14d2,0x107));var _0x214d=function(_0x1532a7,_0x46f0b3){_0x1532a7=_0x1532a7-0x0;var _0x53e269=_0x14d2[_0x1532a7];return _0x53e269;};'use strict';var schema=require(_0x214d('0x0'));var _=require('lodash');var util=require(_0x214d('0x1'));var seqqueue=require(_0x214d('0x2'));var logger=require(_0x214d('0x3'))(_0x214d('0x4'));var strategy=require(_0x214d('0x5'));var queue=schema({'name':{'type':_0x214d('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x481b07,_0x3cc930,_0x413c0e){return logger['info'](util[_0x214d('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x481b07,_0x3cc930['name'],_0x413c0e));}function handleFindAgent(_0x1a36b3){return function(_0x138203){return _0x138203[_0x214d('0x8')][_0x214d('0x9')]()===_0x1a36b3[_0x214d('0x9')]();};}exports['consequence']=function(_0x4fb795,_0x12ab58,_0x2dba32,_0x4c008b){return function(_0x196633){try{var _0x468c98={'name':_0x12ab58[0x0],'timeout':_0x12ab58[0x1]};var _0x483607=queue[_0x214d('0x0')](_0x468c98,{'typecast':!![]});if(_0x483607[_0x214d('0xa')]){logger[_0x214d('0xb')]('[%s][AGENT]\x20%s',_0x4fb795,_[_0x214d('0xc')](_0x483607,'message')[_0x214d('0xd')](',\x20'));_0x196633[_0x214d('0xe')]();}else{var _0x29fedf=_['find'](_0x2dba32[_0x214d('0xf')],handleFindAgent(_0x468c98[_0x214d('0x8')]));if(_0x29fedf){var _0x555519=(_0x468c98[_0x214d('0x10')]||0xa)*0x3e8;var _0x26164a,_0x41ee9e;var _0x446e99=seqqueue[_0x214d('0x11')](_0x555519);_0x446e99['id']=_0x4fb795;_0x446e99[_0x214d('0x12')]=_0x555519;_0x446e99['channel']=_0x4c008b[_0x214d('0x13')];writeLog(_0x4fb795,_0x29fedf,util[_0x214d('0x7')](_0x214d('0x14'),_0x555519));_0x2dba32[_0x214d('0x15')][_0x4fb795]['on']('end',function(){logger[_0x214d('0x16')](_0x214d('0x17'),_0x4fb795);clearTimeout(_0x41ee9e);_0x41ee9e=undefined;_0x446e99['close']();if(_0x2dba32[_0x214d('0x15')][_0x4fb795]){delete _0x2dba32['rules'][_0x4fb795];}_0x196633['stop']();});_0x2dba32['rules'][_0x4fb795]['on'](_0x214d('0x18'),function(){if(_0x2dba32[_0x214d('0x15')][_0x4fb795]){delete _0x2dba32[_0x214d('0x15')][_0x4fb795];}});_0x41ee9e=setTimeout(function(){logger[_0x214d('0x16')]('[%s][AGENT]\x20ROUTING\x20END',_0x4fb795);clearTimeout(_0x41ee9e);_0x446e99[_0x214d('0x19')]();_0x196633['next']();},_0x555519);strategy['agent'](_0x446e99,_0x29fedf,_0x2dba32,_0x4c008b);}else{logger[_0x214d('0xb')](_0x214d('0x1a'),_0x4fb795,_0x468c98['name']);_0x196633[_0x214d('0xe')]();}}}catch(_0x5a300a){console[_0x214d('0x1b')](_0x5a300a);logger[_0x214d('0xb')](_0x214d('0x1c'),_0x4fb795,_0x5a300a[_0x214d('0x1d')]);_0x196633[_0x214d('0xe')]();}};}; \ 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 9913441..865b71e 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 _0x06fb=['phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','body','toString','postText','providerName','amazonlex','then','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp'];(function(_0x3568bf,_0x33c3ba){var _0xc93b4d=function(_0x14d1b5){while(--_0x14d1b5){_0x3568bf['push'](_0x3568bf['shift']());}};_0xc93b4d(++_0x33c3ba);}(_0x06fb,0x1b4));var _0xb06f=function(_0x2c55d1,_0x558f3d){_0x2c55d1=_0x2c55d1-0x0;var _0x5de2dd=_0x06fb[_0x2c55d1];return _0x5de2dd;};'use strict';var _=require(_0xb06f('0x0'));var moment=require(_0xb06f('0x1'));var AWS=require(_0xb06f('0x2'));var utils=require(_0xb06f('0x3'));var logger=require('../../../../config/logger')(_0xb06f('0x4'));var rpc={'chatMessage':require(_0xb06f('0x5')),'openchannelMessage':require(_0xb06f('0x6')),'mailMessage':require(_0xb06f('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb06f('0x8')),'whatsappMessage':require(_0xb06f('0x9'))};exports[_0xb06f('0xa')]=function(_0x124154,_0xd27a8){return function(_0x7059e){try{if(!_[_0xb06f('0xb')](this[_0xb06f('0xc')][_0xb06f('0xd')])){logger[_0xb06f('0xe')](_0xb06f('0xf'),_0x124154,_0xb06f('0x10'));return _0x7059e['next']();}var _0x255eaf={'ContactId':this[_0xb06f('0x11')]['id'],'sentAt':moment()[_0xb06f('0x12')](_0xb06f('0x13')),'direction':_0xb06f('0x14')};if(this[_0xb06f('0x15')]==='sms'||this[_0xb06f('0x15')]===_0xb06f('0x16')){_0x255eaf['phone']=this[_0xb06f('0xc')][_0xb06f('0x17')];}var _0x57de11=this['channel'];if(_0x57de11==='chat'){_0x255eaf[_0xb06f('0x18')]=this[_0xb06f('0x19')]['id'];}else{_0x255eaf[_[_0xb06f('0x1a')](_0x57de11)+_0xb06f('0x1b')]=this[_0xb06f('0x19')]['id'];}_0x255eaf[_[_0xb06f('0x1a')](_0x57de11)+_0xb06f('0x1c')]=this['interaction']['id'];if(this['interaction']['created']){var _0x471af5=_0xd27a8[0x4];if(!_[_0xb06f('0x1d')](_0x471af5)){_0x255eaf['body']=utils['getMustacheRender'](_0x471af5,this);return rpc[_0x57de11+_0xb06f('0x1e')][_0xb06f('0x1f')](_0x255eaf)['then'](function(_0x4d04ac){logger['info']('[%s][AMAZONLEX]\x20%s',_0x124154,_0x255eaf['body']);})[_0xb06f('0x20')](function(_0x208947){logger[_0xb06f('0x21')](_0xb06f('0xf'),_0x124154,JSON[_0xb06f('0x22')](_0x208947));})[_0xb06f('0x23')](function(){logger[_0xb06f('0xe')](_0xb06f('0x24'),_0x124154);_0x7059e[_0xb06f('0x25')]();});}else{logger[_0xb06f('0xe')](_0xb06f('0x26'),_0x124154);_0x7059e[_0xb06f('0x25')]();}}else{var _0x262808=this;var _0x1a37ca=new AWS[(_0xb06f('0x27'))]({'accessKeyId':_0xd27a8[0x0],'secretAccessKey':_0xd27a8[0x1],'region':_0xd27a8[0x2]});var _0x2001d4={'botAlias':_0xb06f('0x28'),'botName':_0xd27a8[0x3],'inputText':this[_0xb06f('0x29')][_0xb06f('0x2a')],'userId':this[_0xb06f('0x15')]+':'+this['interaction']['id'][_0xb06f('0x2b')]()};_0x1a37ca[_0xb06f('0x2c')](_0x2001d4,function(_0x20f4f0,_0x3f37eb){if(_0x20f4f0){logger['error'](_0xb06f('0xf'),_0x124154,_0x20f4f0[_0xb06f('0x29')]);_0x7059e['next']();}else if(_0x3f37eb&&_0x3f37eb[_0xb06f('0x29')]){_0x262808[_0xb06f('0x2a')]['amazonlex']=_0x3f37eb;_0x255eaf[_0xb06f('0x2a')]=_0x3f37eb['message'];_0x255eaf[_0xb06f('0x2d')]=_0xb06f('0x2e');_0x255eaf['providerResponse']=JSON['stringify'](_0x3f37eb);return rpc[_0x57de11+_0xb06f('0x1e')][_0xb06f('0x1f')](_0x255eaf)[_0xb06f('0x2f')](function(_0x32e923){logger[_0xb06f('0xe')](_0xb06f('0xf'),_0x124154,_0x255eaf[_0xb06f('0x2a')]);if(_0x3f37eb[_0xb06f('0x30')]==_0xb06f('0x31')){_0x7059e[_0xb06f('0x32')]();}else{_0x7059e['stop']();}})[_0xb06f('0x20')](function(_0x349c48){logger[_0xb06f('0x21')]('[%s][AMAZONLEX]\x20%s',_0x124154,JSON[_0xb06f('0x22')](_0x349c48));_0x7059e['next']();});}else{_0x7059e[_0xb06f('0x32')]();}});}}catch(_0x572308){logger['error']('[%s][AMAZONLEX]\x20%s',_0x124154,JSON[_0xb06f('0x22')](_0x572308));_0x7059e[_0xb06f('0x25')]();}};}; \ No newline at end of file +var _0xc8d6=['providerResponse','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','InteractionId','created','isEmpty','body','Message','create','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','toString','postText','message','providerName','amazonlex'];(function(_0x35f68b,_0x4bbf9b){var _0x3555c9=function(_0x4df0ba){while(--_0x4df0ba){_0x35f68b['push'](_0x35f68b['shift']());}};_0x3555c9(++_0x4bbf9b);}(_0xc8d6,0x67));var _0x6c8d=function(_0x5e14f0,_0x5f0b37){_0x5e14f0=_0x5e14f0-0x0;var _0x5b406b=_0xc8d6[_0x5e14f0];return _0x5b406b;};'use strict';var _=require('lodash');var moment=require(_0x6c8d('0x0'));var AWS=require(_0x6c8d('0x1'));var utils=require(_0x6c8d('0x2'));var logger=require(_0x6c8d('0x3'))(_0x6c8d('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6c8d('0x5')),'mailMessage':require(_0x6c8d('0x6')),'smsMessage':require(_0x6c8d('0x7')),'faxMessage':require(_0x6c8d('0x8')),'whatsappMessage':require(_0x6c8d('0x9'))};exports[_0x6c8d('0xa')]=function(_0x3d0f6a,_0x337d46){return function(_0x26264a){try{if(!_['isNil'](this[_0x6c8d('0xb')][_0x6c8d('0xc')])){logger[_0x6c8d('0xd')](_0x6c8d('0xe'),_0x3d0f6a,_0x6c8d('0xf'));return _0x26264a[_0x6c8d('0x10')]();}var _0xa4dd7e={'ContactId':this[_0x6c8d('0x11')]['id'],'sentAt':moment()['format'](_0x6c8d('0x12')),'direction':_0x6c8d('0x13')};if(this[_0x6c8d('0x14')]===_0x6c8d('0x15')||this[_0x6c8d('0x14')]===_0x6c8d('0x16')){_0xa4dd7e[_0x6c8d('0x17')]=this[_0x6c8d('0xb')][_0x6c8d('0x17')];}var _0x21c280=this[_0x6c8d('0x14')];if(_0x21c280===_0x6c8d('0x18')){_0xa4dd7e[_0x6c8d('0x19')]=this['account']['id'];}else{_0xa4dd7e[_[_0x6c8d('0x1a')](_0x21c280)+'AccountId']=this['account']['id'];}_0xa4dd7e[_[_0x6c8d('0x1a')](_0x21c280)+_0x6c8d('0x1b')]=this[_0x6c8d('0xb')]['id'];if(this['interaction'][_0x6c8d('0x1c')]){var _0x3e9dad=_0x337d46[0x4];if(!_[_0x6c8d('0x1d')](_0x3e9dad)){_0xa4dd7e[_0x6c8d('0x1e')]=utils['getMustacheRender'](_0x3e9dad,this);return rpc[_0x21c280+_0x6c8d('0x1f')][_0x6c8d('0x20')](_0xa4dd7e)[_0x6c8d('0x21')](function(_0x3b5e47){logger[_0x6c8d('0xd')]('[%s][AMAZONLEX]\x20%s',_0x3d0f6a,_0xa4dd7e[_0x6c8d('0x1e')]);})[_0x6c8d('0x22')](function(_0x1b6586){logger[_0x6c8d('0x23')]('[%s][AMAZONLEX]\x20%s',_0x3d0f6a,JSON[_0x6c8d('0x24')](_0x1b6586));})['finally'](function(){logger[_0x6c8d('0xd')](_0x6c8d('0x25'),_0x3d0f6a);_0x26264a['stop']();});}else{logger[_0x6c8d('0xd')](_0x6c8d('0x26'),_0x3d0f6a);_0x26264a[_0x6c8d('0x27')]();}}else{var _0x5ec707=this;var _0x59b3b6=new AWS[(_0x6c8d('0x28'))]({'accessKeyId':_0x337d46[0x0],'secretAccessKey':_0x337d46[0x1],'region':_0x337d46[0x2]});var _0x243fb8={'botAlias':_0x6c8d('0x29'),'botName':_0x337d46[0x3],'inputText':this['message'][_0x6c8d('0x1e')],'userId':this[_0x6c8d('0x14')]+':'+this[_0x6c8d('0xb')]['id'][_0x6c8d('0x2a')]()};_0x59b3b6[_0x6c8d('0x2b')](_0x243fb8,function(_0x356722,_0x46c30b){if(_0x356722){logger[_0x6c8d('0x23')](_0x6c8d('0xe'),_0x3d0f6a,_0x356722[_0x6c8d('0x2c')]);_0x26264a['next']();}else if(_0x46c30b&&_0x46c30b[_0x6c8d('0x2c')]){_0x5ec707['body']['amazonlex']=_0x46c30b;_0xa4dd7e['body']=_0x46c30b[_0x6c8d('0x2c')];_0xa4dd7e[_0x6c8d('0x2d')]=_0x6c8d('0x2e');_0xa4dd7e[_0x6c8d('0x2f')]=JSON[_0x6c8d('0x24')](_0x46c30b);return rpc[_0x21c280+_0x6c8d('0x1f')][_0x6c8d('0x20')](_0xa4dd7e)['then'](function(_0x2c1496){logger[_0x6c8d('0xd')](_0x6c8d('0xe'),_0x3d0f6a,_0xa4dd7e[_0x6c8d('0x1e')]);if(_0x46c30b[_0x6c8d('0x30')]==_0x6c8d('0x31')){_0x26264a[_0x6c8d('0x10')]();}else{_0x26264a[_0x6c8d('0x27')]();}})['catch'](function(_0x58b6db){logger[_0x6c8d('0x23')]('[%s][AMAZONLEX]\x20%s',_0x3d0f6a,JSON[_0x6c8d('0x24')](_0x58b6db));_0x26264a[_0x6c8d('0x10')]();});}else{_0x26264a['next']();}});}}catch(_0x59ff97){logger[_0x6c8d('0x23')](_0x6c8d('0xe'),_0x3d0f6a,JSON[_0x6c8d('0x24')](_0x59ff97));_0x26264a[_0x6c8d('0x27')]();}};}; \ 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 ba7f0f5..43c6f8d 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 _0xfcd2=['subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','InteractionId','inReplyTo','','replace','';_0x2e7002['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0x2fcd('0x32')};return mailRpc[_0x2fcd('0x33')](this['account'][_0x2fcd('0x34')],_0x2e7002)[_0x2fcd('0x35')](function(_0x24eafb){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x37ad55);_0x2e7002[_0x2fcd('0x36')]=_0x24eafb[_0x2fcd('0x22')][_0x2fcd('0x36')];return rpc[_0x25f964+_0x2fcd('0x37')][_0x2fcd('0x38')](_0x2e7002);})[_0x2fcd('0x35')](function(_0x134b2b){logger[_0x2fcd('0x14')](_0x2fcd('0x15'),_0x37ad55,JSON['stringify'](_0x134b2b));})[_0x2fcd('0x39')](function(_0x52a799){logger['error'](_0x2fcd('0x3a'),_0x37ad55,JSON[_0x2fcd('0x3b')](_0x52a799));})[_0x2fcd('0x3c')](function(){Promise['resolve']()['then'](function(){if(_0x4cfae7[0x0]!=='2'||_0x4a35cc[_0x2fcd('0x1b')])return;return rpc[_0x25f964+'Interaction'][_0x2fcd('0x3d')](_0x4a35cc['id'],{'autoreplyExecuted':!![]})[_0x2fcd('0x35')](function(_0x54e483){logger[_0x2fcd('0x14')](_0x2fcd('0x1c'),_0x37ad55,JSON[_0x2fcd('0x3b')](_0x54e483));})['catch'](function(_0x43be2f){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x37ad55,JSON[_0x2fcd('0x3b')](_0x43be2f));});})[_0x2fcd('0x35')](function(){_0x20d6f1[_0x2fcd('0x16')]();});});}else{return rpc[this[_0x2fcd('0x10')]+_0x2fcd('0x37')][_0x2fcd('0x38')](_0x2e7002)[_0x2fcd('0x35')](function(){logger[_0x2fcd('0x14')]('[%s][AUTOREPLY]\x20%s',_0x37ad55,_0x2e7002[_0x2fcd('0x12')]);})['catch'](function(_0x1d74de){logger[_0x2fcd('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x37ad55,JSON[_0x2fcd('0x3b')](_0x1d74de));})['finally'](function(){Promise['resolve']()[_0x2fcd('0x35')](function(){if(_0x4cfae7[0x0]!=='2'||_0x4a35cc[_0x2fcd('0x1b')])return;return rpc[_0x25f964+_0x2fcd('0x3f')][_0x2fcd('0x3d')](_0x4a35cc['id'],{'autoreplyExecuted':!![]})[_0x2fcd('0x35')](function(_0x2aa699){logger['info'](_0x2fcd('0x1c'),_0x37ad55,JSON[_0x2fcd('0x3b')](_0x2aa699));})[_0x2fcd('0x39')](function(_0x3dc0b8){logger['error'](_0x2fcd('0x40'),_0x37ad55,JSON[_0x2fcd('0x3b')](_0x3dc0b8));});})[_0x2fcd('0x35')](function(){_0x20d6f1[_0x2fcd('0x16')]();});});}}}catch(_0x3c38f5){logger['error']('[%s][AUTOREPLY]\x20%s',_0x37ad55,JSON[_0x2fcd('0x3b')](_0x3c38f5));_0x20d6f1[_0x2fcd('0x41')]();}};}; \ No newline at end of file +var _0x6d38=['auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','then','stringify','catch','resolve','autoreplyExecuted','Interaction','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','info','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','html','','replace','','auto-replied','All'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x6d38,0x9a));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var utils=require(_0x86d3('0x2'));var logger=require(_0x86d3('0x3'))('routing');var rpc={'chatMessage':require(_0x86d3('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x86d3('0x5')),'smsMessage':require(_0x86d3('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x86d3('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x86d3('0x8')),'smsInteraction':require(_0x86d3('0x9')),'faxInteraction':require(_0x86d3('0xa')),'whatsappInteraction':require(_0x86d3('0xb'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x15fe25,_0x5ee37d,_0x1943fb,_0x183661){return function(_0x1e15ba){try{var _0x157113=this[_0x86d3('0xc')];if(_0x157113===_0x86d3('0xd')&&_0x183661[_0x86d3('0xe')][_0x86d3('0xf')]){logger['info'](_0x86d3('0x10'),_0x15fe25,_0x86d3('0x11'));return _0x1e15ba['next']();}if(_0x5ee37d[0x0]==='1'&&(_[_0x86d3('0x12')](this['interaction']['created'])||!this[_0x86d3('0x13')][_0x86d3('0x14')])){logger[_0x86d3('0x15')](_0x86d3('0x10'),_0x15fe25,'Autoreply\x20already\x20sent');return _0x1e15ba[_0x86d3('0x16')]();}if(_0x5ee37d[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x86d3('0x15')](_0x86d3('0x17'),_0x15fe25,_0x86d3('0x18'));return _0x1e15ba[_0x86d3('0x16')]();}var _0x1c1bad={'ContactId':this[_0x86d3('0x19')]['id'],'sentAt':moment()[_0x86d3('0x1a')](_0x86d3('0x1b')),'direction':_0x86d3('0x1c')};if(this['channel']===_0x86d3('0xd')){_0x1c1bad[_0x86d3('0xe')]=utils['getMustacheRender'](_0x5ee37d[0x2],this);}else{_0x1c1bad[_0x86d3('0xe')]=utils[_0x86d3('0x1d')](_0x5ee37d[0x1],this);}if(this['message']){_0x1c1bad['to']=this[_0x86d3('0x1e')][_0x86d3('0x1f')]||'';if(this['channel']===_0x86d3('0xd')&&_0x5ee37d[0x1]==='1'){_0x1c1bad['cc']=this['message']['cc']||'';}_0x1c1bad[_0x86d3('0x1f')]=this[_0x86d3('0x1e')]['to']||'';_0x1c1bad[_0x86d3('0x20')]=this[_0x86d3('0x1e')]['phone']||'';_0x1c1bad[_0x86d3('0x21')]=!![];if(this[_0x86d3('0x1e')]['subject']){_0x1c1bad[_0x86d3('0x22')]='';_0x1c1bad[_0x86d3('0x22')]+=_[_0x86d3('0x23')](this[_0x86d3('0x1e')][_0x86d3('0x22')],_0x86d3('0x24'))?'':_0x86d3('0x25');_0x1c1bad[_0x86d3('0x22')]+=this[_0x86d3('0x1e')][_0x86d3('0x22')];}}if(this[_0x86d3('0xc')]===_0x86d3('0x26')){_0x1c1bad[_0x86d3('0x27')]=this[_0x86d3('0x28')]['id'];}else{_0x1c1bad[_[_0x86d3('0x29')](this['channel'])+_0x86d3('0x2a')]=this[_0x86d3('0x28')]['id'];}_0x1c1bad[_[_0x86d3('0x29')](this['channel'])+_0x86d3('0x2b')]=this[_0x86d3('0x13')]['id'];var _0x451847=this['interaction'];if(rpc[this['channel']+_0x86d3('0x2c')]){if(this[_0x86d3('0xc')]===_0x86d3('0xd')){_0x1c1bad[_0x86d3('0x2d')]=this[_0x86d3('0x1e')]['messageId'];_0x1c1bad[_0x86d3('0x2e')]=_0x86d3('0x2f')+_[_0x86d3('0x30')](_0x1c1bad[_0x86d3('0xe')],_0x86d3('0x31'),']+(>|$)/g,''),'priorityTrue':_0x199f84[0x1],'priorityFalse':_0x199f84[0x2]};var _0x1d4242=gotoif['validate'](_0x32d06a,{'typecast':!![]});if(_0x1d4242[_0x4b08('0xd')]){logger[_0x4b08('0xe')](_0x4b08('0xf'),_0x3f33a3,_['map'](_0x1d4242,_0x4b08('0x10'))[_0x4b08('0x11')](',\x20'));_0x196e8c[_0x4b08('0x12')]();}else{try{var _0x59e76b=eval('('+_0x32d06a[_0x4b08('0x13')]+')');var _0x6e756d=_0x59e76b?_0x32d06a['priorityTrue']:_0x32d06a[_0x4b08('0x14')];logger[_0x4b08('0x15')](_0x4b08('0x16'),_0x3f33a3,_0x32d06a[_0x4b08('0x13')],_0x59e76b,_0x6e756d||_0x4b08('0x17'));if(_0x6e756d){var _0x83c6c3=_[_0x4b08('0x18')](_0x196e8c[_0x4b08('0x19')](),{'p':_0x6e756d});if(_0x83c6c3>=0x0){logger[_0x4b08('0x15')](_0x4b08('0x1a'),_0x3f33a3,_0x6e756d||_0x4b08('0x17'),_0x83c6c3);_0x196e8c['next'](_0x83c6c3);}else{logger[_0x4b08('0x15')](_0x4b08('0x1b'),_0x3f33a3,_0x6e756d||_0x4b08('0x17'));_0x196e8c[_0x4b08('0x12')]();}}else{_0x196e8c[_0x4b08('0x17')]();}}catch(_0x284c68){logger[_0x4b08('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3f33a3,_0x284c68[_0x4b08('0x10')]);_0x196e8c[_0x4b08('0x12')]();}}}catch(_0x3778fa){logger[_0x4b08('0xe')](_0x4b08('0xf'),_0x3f33a3,JSON['stringify'](_0x3778fa));_0x196e8c[_0x4b08('0x12')]();}};}; \ No newline at end of file +var _0xa224=['info','rules','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','routing','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue'];(function(_0x22ae1f,_0x51f076){var _0x512c30=function(_0x112307){while(--_0x112307){_0x22ae1f['push'](_0x22ae1f['shift']());}};_0x512c30(++_0x51f076);}(_0xa224,0x131));var _0x4a22=function(_0x5240a1,_0x4d2a47){_0x5240a1=_0x5240a1-0x0;var _0x22bd79=_0xa224[_0x5240a1];return _0x22bd79;};'use strict';var schema=require(_0x4a22('0x0'));var _=require(_0x4a22('0x1'));var htmlToText=require(_0x4a22('0x2'));var utils=require(_0x4a22('0x3'));var logger=require('../../../../config/logger')(_0x4a22('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x4a22('0x5')},'priorityFalse':{'type':_0x4a22('0x6'),'message':_0x4a22('0x7')}});exports[_0x4a22('0x8')]=function(_0x4082d2,_0xa81060){return function(_0x2322e5){try{var _0x41b3b1={'condition':htmlToText[_0x4a22('0x9')](utils[_0x4a22('0xa')](_0xa81060[0x0],this),{'wordwrap':![]})[_0x4a22('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xa81060[0x1],'priorityFalse':_0xa81060[0x2]};var _0x9fd696=gotoif['validate'](_0x41b3b1,{'typecast':!![]});if(_0x9fd696['length']){logger[_0x4a22('0xc')](_0x4a22('0xd'),_0x4082d2,_[_0x4a22('0xe')](_0x9fd696,_0x4a22('0xf'))[_0x4a22('0x10')](',\x20'));_0x2322e5[_0x4a22('0x11')]();}else{try{var _0x5c7838=eval('('+_0x41b3b1[_0x4a22('0x12')]+')');var _0x3ced7a=_0x5c7838?_0x41b3b1[_0x4a22('0x13')]:_0x41b3b1['priorityFalse'];logger[_0x4a22('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4082d2,_0x41b3b1[_0x4a22('0x12')],_0x5c7838,_0x3ced7a||'next');if(_0x3ced7a){var _0x5cbeb9=_['findIndex'](_0x2322e5[_0x4a22('0x15')](),{'p':_0x3ced7a});if(_0x5cbeb9>=0x0){logger[_0x4a22('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4082d2,_0x3ced7a||_0x4a22('0x16'),_0x5cbeb9);_0x2322e5[_0x4a22('0x16')](_0x5cbeb9);}else{logger[_0x4a22('0x14')](_0x4a22('0x17'),_0x4082d2,_0x3ced7a||_0x4a22('0x16'));_0x2322e5[_0x4a22('0x11')]();}}else{_0x2322e5[_0x4a22('0x16')]();}}catch(_0x3a404f){logger[_0x4a22('0xc')](_0x4a22('0x18'),_0x4082d2,_0x3a404f[_0x4a22('0xf')]);_0x2322e5[_0x4a22('0x11')]();}}}catch(_0x356478){logger[_0x4a22('0xc')]('[%s][GOTOIF]\x20%s',_0x4082d2,JSON['stringify'](_0x356478));_0x2322e5[_0x4a22('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 02b6f75..cee0928 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 _0x086f=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x592286,_0x114c0f){var _0x5255cd=function(_0x26e984){while(--_0x26e984){_0x592286['push'](_0x592286['shift']());}};_0x5255cd(++_0x114c0f);}(_0x086f,0x7b));var _0xf086=function(_0x464592,_0x945b3b){_0x464592=_0x464592-0x0;var _0x420da2=_0x086f[_0x464592];return _0x420da2;};'use strict';var schema=require('validate');var _=require(_0xf086('0x0'));var logger=require('../../../../config/logger')(_0xf086('0x1'));var gotop=schema({'priority':{'type':_0xf086('0x2'),'required':!![],'message':_0xf086('0x3')}});exports[_0xf086('0x4')]=function(_0x204531,_0x30e69c){return function(_0x27a9b6){try{var _0x13bd37={'priority':_0x30e69c[0x0]};var _0xa40172=gotop['validate'](_0x13bd37,{'typecast':!![]});if(_0xa40172['length']){logger['error'](_0xf086('0x5'),_0x204531,_['map'](_0xa40172,'message')[_0xf086('0x6')](',\x20'));_0x27a9b6[_0xf086('0x7')]();}else{logger[_0xf086('0x8')](_0xf086('0x9'),_0x204531,_0x13bd37[_0xf086('0xa')]);if(_0x13bd37[_0xf086('0xa')]){var _0x185fba=_[_0xf086('0xb')](_0x27a9b6['rules'](),{'p':_0x13bd37[_0xf086('0xa')]});if(_0x185fba>=0x0){logger[_0xf086('0x8')](_0xf086('0xc'),_0x204531,_0x13bd37[_0xf086('0xa')]||_0xf086('0xd'),_0x185fba);_0x27a9b6[_0xf086('0xd')](_0x185fba);}else{logger[_0xf086('0x8')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x204531,_0x13bd37[_0xf086('0xa')]||_0xf086('0xd'));_0x27a9b6[_0xf086('0x7')]();}}else{_0x27a9b6[_0xf086('0xd')]();}}}catch(_0x4f4665){logger['error'](_0xf086('0x5'),_0x204531,JSON[_0xf086('0xe')](_0x4f4665));_0x27a9b6[_0xf086('0x7')]();}};}; \ No newline at end of file +var _0xaa63=['error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaa63,0x117));var _0x3aa6=function(_0x3c05b6,_0x82248){_0x3c05b6=_0x3c05b6-0x0;var _0x2d8b4e=_0xaa63[_0x3c05b6];return _0x2d8b4e;};'use strict';var schema=require(_0x3aa6('0x0'));var _=require(_0x3aa6('0x1'));var logger=require(_0x3aa6('0x2'))(_0x3aa6('0x3'));var gotop=schema({'priority':{'type':_0x3aa6('0x4'),'required':!![],'message':_0x3aa6('0x5')}});exports['consequence']=function(_0xa80aaa,_0x7f3787){return function(_0x373201){try{var _0x203451={'priority':_0x7f3787[0x0]};var _0x4afd28=gotop[_0x3aa6('0x0')](_0x203451,{'typecast':!![]});if(_0x4afd28[_0x3aa6('0x6')]){logger[_0x3aa6('0x7')](_0x3aa6('0x8'),_0xa80aaa,_[_0x3aa6('0x9')](_0x4afd28,_0x3aa6('0xa'))[_0x3aa6('0xb')](',\x20'));_0x373201['stop']();}else{logger[_0x3aa6('0xc')](_0x3aa6('0xd'),_0xa80aaa,_0x203451[_0x3aa6('0xe')]);if(_0x203451['priority']){var _0x3c0596=_[_0x3aa6('0xf')](_0x373201[_0x3aa6('0x10')](),{'p':_0x203451[_0x3aa6('0xe')]});if(_0x3c0596>=0x0){logger['info'](_0x3aa6('0x11'),_0xa80aaa,_0x203451['priority']||'next',_0x3c0596);_0x373201[_0x3aa6('0x12')](_0x3c0596);}else{logger[_0x3aa6('0xc')](_0x3aa6('0x13'),_0xa80aaa,_0x203451[_0x3aa6('0xe')]||_0x3aa6('0x12'));_0x373201[_0x3aa6('0x14')]();}}else{_0x373201[_0x3aa6('0x12')]();}}}catch(_0x46f953){logger[_0x3aa6('0x7')](_0x3aa6('0x8'),_0xa80aaa,JSON[_0x3aa6('0x15')](_0x46f953));_0x373201[_0x3aa6('0x14')]();}};}; \ 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 58ebf51..5990f7c 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 _0xbefc=['[%s][MESSAGE]\x20%s','body','next','catch','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','Message','create','then'];(function(_0x147892,_0x2bf1b5){var _0x4654e1=function(_0x438fc9){while(--_0x438fc9){_0x147892['push'](_0x147892['shift']());}};_0x4654e1(++_0x2bf1b5);}(_0xbefc,0x195));var _0xcbef=function(_0x3ffe17,_0x38b78b){_0x3ffe17=_0x3ffe17-0x0;var _0x574346=_0xbefc[_0x3ffe17];return _0x574346;};'use strict';var _=require('lodash');var utils=require(_0xcbef('0x0'));var logger=require(_0xcbef('0x1'))(_0xcbef('0x2'));var rpc={'chatMessage':require(_0xcbef('0x3')),'openchannelMessage':require(_0xcbef('0x4')),'mailMessage':require(_0xcbef('0x5')),'smsMessage':require(_0xcbef('0x6')),'faxMessage':require(_0xcbef('0x7')),'whatsappMessage':require(_0xcbef('0x8'))};exports[_0xcbef('0x9')]=function(_0x1645e3,_0x3fe826){return function(_0x4753d1){try{var _0x17bf41={'body':utils[_0xcbef('0xa')](_0x3fe826[0x0],this),'ContactId':this[_0xcbef('0xb')]['id']};if(this[_0xcbef('0xc')]===_0xcbef('0xd')){_0x17bf41[_0xcbef('0xe')]=this[_0xcbef('0xf')]['id'];}else{_0x17bf41[_[_0xcbef('0x10')](this[_0xcbef('0xc')])+'AccountId']=this[_0xcbef('0xf')]['id'];}_0x17bf41[_[_0xcbef('0x10')](this[_0xcbef('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0xcbef('0xc')]+_0xcbef('0x11')]){return rpc[this[_0xcbef('0xc')]+_0xcbef('0x11')][_0xcbef('0x12')](_0x17bf41)[_0xcbef('0x13')](function(_0x2ae1a2){logger['info'](_0xcbef('0x14'),_0x1645e3,_0x17bf41[_0xcbef('0x15')]);_0x4753d1[_0xcbef('0x16')]();})[_0xcbef('0x17')](function(_0x3c6e80){logger[_0xcbef('0x18')](_0xcbef('0x14'),_0x1645e3,JSON['stringify'](_0x3c6e80));_0x4753d1['stop']();});}}catch(_0x13e6e6){logger[_0xcbef('0x18')](_0xcbef('0x14'),_0x1645e3,JSON['stringify'](_0x13e6e6));_0x4753d1['stop']();}};}; \ No newline at end of file +var _0x0427=['upperFirst','AccountId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account'];(function(_0x100533,_0x118bb8){var _0x4b41f7=function(_0x5e4609){while(--_0x5e4609){_0x100533['push'](_0x100533['shift']());}};_0x4b41f7(++_0x118bb8);}(_0x0427,0x137));var _0x7042=function(_0x326afa,_0x484fa4){_0x326afa=_0x326afa-0x0;var _0x44401d=_0x0427[_0x326afa];return _0x44401d;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7042('0x2')),'mailMessage':require(_0x7042('0x3')),'smsMessage':require(_0x7042('0x4')),'faxMessage':require(_0x7042('0x5')),'whatsappMessage':require(_0x7042('0x6'))};exports[_0x7042('0x7')]=function(_0x2c7c32,_0x53ab81){return function(_0x37a35b){try{var _0x2f24b5={'body':utils[_0x7042('0x8')](_0x53ab81[0x0],this),'ContactId':this[_0x7042('0x9')]['id']};if(this[_0x7042('0xa')]===_0x7042('0xb')){_0x2f24b5[_0x7042('0xc')]=this[_0x7042('0xd')]['id'];}else{_0x2f24b5[_[_0x7042('0xe')](this['channel'])+_0x7042('0xf')]=this['account']['id'];}_0x2f24b5[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x7042('0x10')]['id'];if(rpc[this['channel']+_0x7042('0x11')]){return rpc[this[_0x7042('0xa')]+_0x7042('0x11')]['create'](_0x2f24b5)['then'](function(_0x292c4a){logger[_0x7042('0x12')](_0x7042('0x13'),_0x2c7c32,_0x2f24b5[_0x7042('0x14')]);_0x37a35b[_0x7042('0x15')]();})[_0x7042('0x16')](function(_0x5def25){logger[_0x7042('0x17')](_0x7042('0x13'),_0x2c7c32,JSON[_0x7042('0x18')](_0x5def25));_0x37a35b['stop']();});}}catch(_0x4c68c4){logger[_0x7042('0x17')]('[%s][MESSAGE]\x20%s',_0x2c7c32,JSON[_0x7042('0x18')](_0x4c68c4));_0x37a35b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index bb01fc2..22cb523 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 _0xba03=['routing','consequence','[%s][NOOP]\x20%s','next','stop','./utils'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0xba03,0x161));var _0x3ba0=function(_0x1dcdb5,_0x13b7c6){_0x1dcdb5=_0x1dcdb5-0x0;var _0x30d81e=_0xba03[_0x1dcdb5];return _0x30d81e;};'use strict';var utils=require(_0x3ba0('0x0'));var logger=require('../../../../config/logger')(_0x3ba0('0x1'));exports[_0x3ba0('0x2')]=function(_0x181de7,_0x21aef2){return function(_0x13b217){try{logger['info'](_0x3ba0('0x3'),_0x181de7,utils['getMustacheRender'](_0x21aef2[0x0],this));_0x13b217[_0x3ba0('0x4')]();}catch(_0x1a768b){logger['error']('[%s][NOOP]\x20%s',_0x181de7,JSON['stringify'](_0x1a768b));_0x13b217[_0x3ba0('0x5')]();}};}; \ No newline at end of file +var _0x62d3=['./utils','../../../../config/logger','info','getMustacheRender','next','[%s][NOOP]\x20%s','stop'];(function(_0xd650ca,_0x5e2bca){var _0x1c747f=function(_0x5cbe9d){while(--_0x5cbe9d){_0xd650ca['push'](_0xd650ca['shift']());}};_0x1c747f(++_0x5e2bca);}(_0x62d3,0x19d));var _0x362d=function(_0x3edc40,_0x11617c){_0x3edc40=_0x3edc40-0x0;var _0x408b12=_0x62d3[_0x3edc40];return _0x408b12;};'use strict';var utils=require(_0x362d('0x0'));var logger=require(_0x362d('0x1'))('routing');exports['consequence']=function(_0x41a1f4,_0x139fc6){return function(_0x4c9b43){try{logger[_0x362d('0x2')]('[%s][NOOP]\x20%s',_0x41a1f4,utils[_0x362d('0x3')](_0x139fc6[0x0],this));_0x4c9b43[_0x362d('0x4')]();}catch(_0x15a267){logger['error'](_0x362d('0x5'),_0x41a1f4,JSON['stringify'](_0x15a267));_0x4c9b43[_0x362d('0x6')]();}};}; \ 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 785f80f..7516f25 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 _0x6e91=['upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','accepted','info','update','update\x20queue\x20report','timeout','catch','toLowerCase','length','[%s][QUEUE]\x20%s','map','stop','find','createQueue','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','localhost','socket.io-emitter','redis','queue_id','account','queue','joinAt','clone','format','pick','%sQueuesWaitingInteractions','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x6e91,0x15e));var _0x16e9=function(_0x4416a4,_0x562fd6){_0x4416a4=_0x4416a4-0x0;var _0xadbdae=_0x6e91[_0x4416a4];return _0xadbdae;};'use strict';var schema=require(_0x16e9('0x0'));var _=require(_0x16e9('0x1'));var util=require(_0x16e9('0x2'));var seqqueue=require(_0x16e9('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x16e9('0x4'));var logger=require(_0x16e9('0x5'))(_0x16e9('0x6'));var strategy=require(_0x16e9('0x7'));config['redis']=_[_0x16e9('0x8')](config['redis'],{'host':_0x16e9('0x9'),'port':0x18eb});var io=require(_0x16e9('0xa'))(new Redis(config[_0x16e9('0xb')]));var attributes=['id',_0x16e9('0xc'),_0x16e9('0xd'),_0x16e9('0xe'),'from',_0x16e9('0xf')];function emit(_0x3c476f,_0x3ea8ec,_0x4ae13b){io['to'](_0x3c476f)['emit'](_0x3ea8ec,_0x4ae13b);}function emitChannelQueueInteraction(_0xfb4608,_0x23bcc1,_0x3cc2cd,_0x1c90db,_0x45a4fd,_0x20f3f7,_0x55296f,_0x5eb751){var _0x1defcf=_[_0x16e9('0x10')](_0x3cc2cd);_0x1defcf[_0x16e9('0xc')]=_0x5eb751;_0x1defcf[_0x16e9('0xe')]=_0x23bcc1;_0x1defcf[_0x16e9('0xd')]=_0x1c90db;_0x1defcf['id']=_0x45a4fd;if(_0x20f3f7){_0x55296f[util[_0x16e9('0x11')]('%sQueuesWaitingInteractions',_0xfb4608)][_0x45a4fd]=_[_0x16e9('0x12')](_0x1defcf,attributes);}else{delete _0x55296f[util[_0x16e9('0x11')](_0x16e9('0x13'),_0xfb4608)][_0x45a4fd];}emit(util[_0x16e9('0x11')]('%s:queue:%s',_0xfb4608,_0x23bcc1),util[_0x16e9('0x11')]('%s_queue_waiting_interaction:%s',_0xfb4608,_0x20f3f7?_0x16e9('0x14'):_0x16e9('0x15')),_[_0x16e9('0x12')](_0x1defcf,attributes));}var rpc={'openchannelQueueReport':require(_0x16e9('0x16')),'mailQueueReport':require(_0x16e9('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x16e9('0x18')),'faxQueueReport':require(_0x16e9('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x16e9('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x16e9('0x1b'),'message':_0x16e9('0x1c')}});function startRouting(_0x16a27a,_0x31139e,_0x475b6e,_0x32e014){if(_0x16a27a&&_0x31139e&&_0x475b6e){_0x31139e[_0x16e9('0x1d')]+=0x1;var _0xa546a={'uniqueid':_0x16a27a,'from':_0x475b6e[_0x16e9('0x1e')]?_0x475b6e[_0x16e9('0x1e')][_0x16e9('0x1f')]:'','joinAt':moment()[_0x16e9('0x11')](_0x16e9('0x20')),'ContactId':_0x475b6e[_0x16e9('0x21')]?_0x475b6e[_0x16e9('0x21')]['id']:null,'ListId':_0x475b6e[_0x16e9('0x22')]?_0x475b6e[_0x16e9('0x22')]['id']:null};_0xa546a[_[_0x16e9('0x23')](_0x475b6e['channel'])+_0x16e9('0x24')]=_0x31139e['id']||null;_0xa546a[_[_0x16e9('0x23')](_0x475b6e[_0x16e9('0x25')])+_0x16e9('0x26')]=_0x475b6e[_0x16e9('0x27')]?_0x475b6e[_0x16e9('0x27')]['id']:null;_0xa546a[_[_0x16e9('0x23')](_0x475b6e[_0x16e9('0x25')])+_0x16e9('0x28')]=_0x475b6e[_0x16e9('0x29')]?_0x475b6e[_0x16e9('0x29')]['id']:null;_0xa546a[_[_0x16e9('0x23')](_0x475b6e[_0x16e9('0x25')])+(_0x475b6e[_0x16e9('0x25')]!==_0x16e9('0x2a')?_0x16e9('0x2b'):_0x16e9('0x2c'))]=_0x475b6e[_0x16e9('0xd')]?_0x475b6e[_0x16e9('0xd')]['id']:null;logger['info'](util[_0x16e9('0x11')](_0x16e9('0x2d'),_0x16a27a,_0x31139e['name']));emitChannelQueueInteraction(_0x475b6e[_0x16e9('0x25')],_0x31139e['name'],_0xa546a,_0x475b6e[_0x16e9('0xd')][_0x16e9('0x2e')],_0x475b6e[_0x16e9('0x29')]['id'],!![],_0x32e014,_0x31139e['id']);if(rpc[_0x475b6e[_0x16e9('0x25')]+_0x16e9('0x2f')]){return rpc[_0x475b6e[_0x16e9('0x25')]+_0x16e9('0x2f')]['create'](_0xa546a)['catch'](function(_0xfd19f5){logger[_0x16e9('0x30')](_0x16e9('0x31'));});}}}function stopRouting(_0xb1faa5,_0x583f8b,_0x17b6bd,_0x28b8c2){if(_0xb1faa5&&_0x583f8b){_0x583f8b[_0x16e9('0x1d')]-=0x1;var _0x3b05ff={'leaveAt':moment()[_0x16e9('0x11')](_0x16e9('0x20')),'acceptAt':moment()[_0x16e9('0x11')](_0x16e9('0x20')),'reason':_0x16e9('0x32')};logger[_0x16e9('0x33')](util[_0x16e9('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0xb1faa5,_0x583f8b[_0x16e9('0x2e')]));emitChannelQueueInteraction(_0x17b6bd['channel'],_0x583f8b['name'],_0x17b6bd['body'],_0x17b6bd[_0x16e9('0xd')][_0x16e9('0x2e')],_0x17b6bd[_0x16e9('0x29')]['id'],![],_0x28b8c2,_0x583f8b['id']);if(rpc[_0x17b6bd[_0x16e9('0x25')]+_0x16e9('0x2f')]){return rpc[_0x17b6bd[_0x16e9('0x25')]+'QueueReport'][_0x16e9('0x34')](_0xb1faa5,_0x3b05ff)['catch'](function(_0x353599){logger['error'](_0x16e9('0x35'));});}}}function endRouting(_0x30b786,_0x3389ff,_0x25359d,_0x375300){if(_0x30b786&&_0x3389ff){_0x3389ff[_0x16e9('0x1d')]-=0x1;var _0x592684={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x16e9('0x11')](_0x16e9('0x20')),'reason':_0x16e9('0x36')};logger[_0x16e9('0x33')](util[_0x16e9('0x11')]('[%s][END:QUEUE][NAME:%s]',_0x30b786,_0x3389ff[_0x16e9('0x2e')]));emitChannelQueueInteraction(_0x25359d[_0x16e9('0x25')],_0x3389ff[_0x16e9('0x2e')],_0x25359d[_0x16e9('0x1e')],_0x25359d[_0x16e9('0xd')][_0x16e9('0x2e')],_0x25359d[_0x16e9('0x29')]['id'],![],_0x375300);if(rpc[_0x25359d[_0x16e9('0x25')]+'QueueReport']){return rpc[_0x25359d['channel']+_0x16e9('0x2f')][_0x16e9('0x34')](_0x30b786,_0x592684)[_0x16e9('0x37')](function(_0x55ae69){logger[_0x16e9('0x30')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x2cc24a){return function(_0xd79421){return _0xd79421[_0x16e9('0x2e')][_0x16e9('0x38')]()===_0x2cc24a[_0x16e9('0x38')]();};}exports['consequence']=function(_0x19265d,_0x42ded8,_0x8c2496,_0xf6f6b){return function(_0x58255b){try{var _0xd4cac8={'name':_0x42ded8[0x0],'timeout':_0x42ded8[0x1]};var _0x50d26e=queue['validate'](_0xd4cac8,{'typecast':!![]});if(_0x50d26e[_0x16e9('0x39')]){logger[_0x16e9('0x30')](_0x16e9('0x3a'),_0x19265d,_[_0x16e9('0x3b')](_0x50d26e,_0x16e9('0x29'))['join'](',\x20'));_0x58255b[_0x16e9('0x3c')]();}else{var _0x582007=_[_0x16e9('0x3d')](_0x8c2496[_0xf6f6b['channel']+'Queues'],handleFindQueue(_0xd4cac8['name']));if(_0x582007){startRouting(_0x19265d,_0x582007,_0xf6f6b,_0x8c2496);var _0x593213=(_0x582007['timeout']||0xa)*0x3e8;var _0x1508da=(_0xd4cac8[_0x16e9('0x36')]||0x14)*0x3e8;var _0x38fccc,_0x41db1f;if(_0x593213>_0x1508da){_0x1508da=_0x593213;}var _0x121711=seqqueue[_0x16e9('0x3e')](_0x593213);_0x121711['id']=_0x19265d;_0x121711['atimeout']=_0x593213;_0x121711[_0x16e9('0x3f')]=_0x1508da;_0x121711[_0x16e9('0x25')]=_0xf6f6b[_0x16e9('0x25')];_0x8c2496['rules'][_0x19265d]['on'](_0x16e9('0x40'),function(){logger[_0x16e9('0x33')](_0x16e9('0x41'),_0x19265d);stopRouting(_0x19265d,_0x582007,_0xf6f6b,_0x8c2496);clearTimeout(_0x38fccc);_0x38fccc=undefined;_0x121711[_0x16e9('0x42')](!![]);if(_0x8c2496[_0x16e9('0x43')][_0x19265d]){delete _0x8c2496[_0x16e9('0x43')][_0x19265d];}_0x58255b[_0x16e9('0x3c')]();});_0x8c2496[_0x16e9('0x43')][_0x19265d]['on'](_0x16e9('0x44'),function(){if(_0x8c2496[_0x16e9('0x43')][_0x19265d]){delete _0x8c2496[_0x16e9('0x43')][_0x19265d];}});_0x38fccc=setTimeout(function(){logger[_0x16e9('0x33')](_0x16e9('0x45'),_0x19265d);endRouting(_0x19265d,_0x582007,_0xf6f6b,_0x8c2496);clearTimeout(_0x38fccc);_0x121711[_0x16e9('0x42')](!![]);_0x58255b[_0x16e9('0x46')]();},_0x1508da);switch(_0x582007[_0x16e9('0x47')]){case'rrmemory':strategy[_0x16e9('0x48')](_0x121711,_0x582007,_0x8c2496,_0xf6f6b);break;default:strategy[_0x16e9('0x49')](_0x121711,_0x582007,_0x8c2496,_0xf6f6b);}}else{logger[_0x16e9('0x30')](_0x16e9('0x4a'),_0x19265d,_0xd4cac8['name']);_0x58255b['stop']();}}}catch(_0xdbf47e){console[_0x16e9('0x4b')](_0xdbf47e);logger[_0x16e9('0x30')]('[%s][QUEUE]\x20%s',_0x19265d,_0xdbf47e[_0x16e9('0x4c')]);_0x58255b[_0x16e9('0x3c')]();}};}; \ No newline at end of file +var _0x9779=['moment','ioredis','../../../../config/environment','routing','./strategy','defaults','socket.io-emitter','redis','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue'];(function(_0x1b88b4,_0x29bf88){var _0x2f03fc=function(_0x49033b){while(--_0x49033b){_0x1b88b4['push'](_0x1b88b4['shift']());}};_0x2f03fc(++_0x29bf88);}(_0x9779,0xe1));var _0x9977=function(_0x5ecc0f,_0x333552){_0x5ecc0f=_0x5ecc0f-0x0;var _0x20c7e2=_0x9779[_0x5ecc0f];return _0x20c7e2;};'use strict';var schema=require('validate');var _=require(_0x9977('0x0'));var util=require(_0x9977('0x1'));var seqqueue=require(_0x9977('0x2'));var moment=require(_0x9977('0x3'));var Redis=require(_0x9977('0x4'));var config=require(_0x9977('0x5'));var logger=require('../../../../config/logger')(_0x9977('0x6'));var strategy=require(_0x9977('0x7'));config['redis']=_[_0x9977('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9977('0x9'))(new Redis(config[_0x9977('0xa')]));var attributes=['id',_0x9977('0xb'),'account',_0x9977('0xc'),_0x9977('0xd'),_0x9977('0xe')];function emit(_0x4fdd17,_0x3fc988,_0x25599e){io['to'](_0x4fdd17)[_0x9977('0xf')](_0x3fc988,_0x25599e);}function emitChannelQueueInteraction(_0x4c1ce2,_0x7388e9,_0x54df22,_0x4dae64,_0x5d6633,_0x46571a,_0x1e745c,_0x4676b5){var _0x4676cb=_[_0x9977('0x10')](_0x54df22);_0x4676cb[_0x9977('0xb')]=_0x4676b5;_0x4676cb['queue']=_0x7388e9;_0x4676cb[_0x9977('0x11')]=_0x4dae64;_0x4676cb['id']=_0x5d6633;if(_0x46571a){_0x1e745c[util[_0x9977('0x12')](_0x9977('0x13'),_0x4c1ce2)][_0x5d6633]=_['pick'](_0x4676cb,attributes);}else{delete _0x1e745c[util[_0x9977('0x12')](_0x9977('0x13'),_0x4c1ce2)][_0x5d6633];}emit(util[_0x9977('0x12')](_0x9977('0x14'),_0x4c1ce2,_0x7388e9),util[_0x9977('0x12')](_0x9977('0x15'),_0x4c1ce2,_0x46571a?'save':'remove'),_[_0x9977('0x16')](_0x4676cb,attributes));}var rpc={'openchannelQueueReport':require(_0x9977('0x17')),'mailQueueReport':require(_0x9977('0x18')),'chatQueueReport':require(_0x9977('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x9977('0x1a')),'whatsappQueueReport':require(_0x9977('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x9977('0x1c')}});function startRouting(_0x4d4ce9,_0x2d45a6,_0x1bbc92,_0xc7e696){if(_0x4d4ce9&&_0x2d45a6&&_0x1bbc92){_0x2d45a6['waiting']+=0x1;var _0x5a1527={'uniqueid':_0x4d4ce9,'from':_0x1bbc92['body']?_0x1bbc92[_0x9977('0x1d')][_0x9977('0xd')]:'','joinAt':moment()['format'](_0x9977('0x1e')),'ContactId':_0x1bbc92[_0x9977('0x1f')]?_0x1bbc92[_0x9977('0x1f')]['id']:null,'ListId':_0x1bbc92[_0x9977('0x20')]?_0x1bbc92[_0x9977('0x20')]['id']:null};_0x5a1527[_[_0x9977('0x21')](_0x1bbc92[_0x9977('0x22')])+_0x9977('0x23')]=_0x2d45a6['id']||null;_0x5a1527[_[_0x9977('0x21')](_0x1bbc92[_0x9977('0x22')])+_0x9977('0x24')]=_0x1bbc92[_0x9977('0x25')]?_0x1bbc92[_0x9977('0x25')]['id']:null;_0x5a1527[_['upperFirst'](_0x1bbc92[_0x9977('0x22')])+'MessageId']=_0x1bbc92[_0x9977('0x26')]?_0x1bbc92[_0x9977('0x26')]['id']:null;_0x5a1527[_[_0x9977('0x21')](_0x1bbc92[_0x9977('0x22')])+(_0x1bbc92['channel']!=='chat'?_0x9977('0x27'):_0x9977('0x28'))]=_0x1bbc92[_0x9977('0x11')]?_0x1bbc92[_0x9977('0x11')]['id']:null;logger[_0x9977('0x29')](util[_0x9977('0x12')](_0x9977('0x2a'),_0x4d4ce9,_0x2d45a6['name']));emitChannelQueueInteraction(_0x1bbc92[_0x9977('0x22')],_0x2d45a6[_0x9977('0x2b')],_0x5a1527,_0x1bbc92[_0x9977('0x11')][_0x9977('0x2b')],_0x1bbc92[_0x9977('0x26')]['id'],!![],_0xc7e696,_0x2d45a6['id']);if(rpc[_0x1bbc92[_0x9977('0x22')]+_0x9977('0x2c')]){return rpc[_0x1bbc92[_0x9977('0x22')]+_0x9977('0x2c')][_0x9977('0x2d')](_0x5a1527)['catch'](function(_0x3db6b8){logger[_0x9977('0x2e')]('create\x20queue\x20report');});}}}function stopRouting(_0x15bc2b,_0x31163c,_0x176fbe,_0x27a93d){if(_0x15bc2b&&_0x31163c){_0x31163c['waiting']-=0x1;var _0x62cf10={'leaveAt':moment()[_0x9977('0x12')](_0x9977('0x1e')),'acceptAt':moment()[_0x9977('0x12')](_0x9977('0x1e')),'reason':'accepted'};logger[_0x9977('0x29')](util[_0x9977('0x12')](_0x9977('0x2f'),_0x15bc2b,_0x31163c[_0x9977('0x2b')]));emitChannelQueueInteraction(_0x176fbe[_0x9977('0x22')],_0x31163c[_0x9977('0x2b')],_0x176fbe[_0x9977('0x1d')],_0x176fbe[_0x9977('0x11')][_0x9977('0x2b')],_0x176fbe['message']['id'],![],_0x27a93d,_0x31163c['id']);if(rpc[_0x176fbe['channel']+'QueueReport']){return rpc[_0x176fbe[_0x9977('0x22')]+_0x9977('0x2c')][_0x9977('0x30')](_0x15bc2b,_0x62cf10)[_0x9977('0x31')](function(_0x1a3227){logger[_0x9977('0x2e')](_0x9977('0x32'));});}}}function endRouting(_0x21b621,_0x6bd08f,_0x33e2f3,_0x2d5da5){if(_0x21b621&&_0x6bd08f){_0x6bd08f[_0x9977('0x33')]-=0x1;var _0xd1f74a={'leaveAt':moment()[_0x9977('0x12')](_0x9977('0x1e')),'exitAt':moment()[_0x9977('0x12')](_0x9977('0x1e')),'reason':_0x9977('0x34')};logger[_0x9977('0x29')](util[_0x9977('0x12')](_0x9977('0x35'),_0x21b621,_0x6bd08f['name']));emitChannelQueueInteraction(_0x33e2f3[_0x9977('0x22')],_0x6bd08f[_0x9977('0x2b')],_0x33e2f3[_0x9977('0x1d')],_0x33e2f3[_0x9977('0x11')][_0x9977('0x2b')],_0x33e2f3[_0x9977('0x26')]['id'],![],_0x2d5da5);if(rpc[_0x33e2f3[_0x9977('0x22')]+_0x9977('0x2c')]){return rpc[_0x33e2f3[_0x9977('0x22')]+'QueueReport'][_0x9977('0x30')](_0x21b621,_0xd1f74a)['catch'](function(_0x118feb){logger['error'](_0x9977('0x32'));});}}}function handleFindQueue(_0x53cb84){return function(_0x2be083){return _0x2be083[_0x9977('0x2b')]['toLowerCase']()===_0x53cb84[_0x9977('0x36')]();};}exports[_0x9977('0x37')]=function(_0x13355d,_0x400e04,_0x17ddff,_0x2edc2f){return function(_0x21b8bd){try{var _0xd19703={'name':_0x400e04[0x0],'timeout':_0x400e04[0x1]};var _0x3ecace=queue[_0x9977('0x38')](_0xd19703,{'typecast':!![]});if(_0x3ecace[_0x9977('0x39')]){logger[_0x9977('0x2e')](_0x9977('0x3a'),_0x13355d,_['map'](_0x3ecace,'message')[_0x9977('0x3b')](',\x20'));_0x21b8bd[_0x9977('0x3c')]();}else{var _0x7be955=_[_0x9977('0x3d')](_0x17ddff[_0x2edc2f[_0x9977('0x22')]+'Queues'],handleFindQueue(_0xd19703[_0x9977('0x2b')]));if(_0x7be955){startRouting(_0x13355d,_0x7be955,_0x2edc2f,_0x17ddff);var _0x57bdb7=(_0x7be955[_0x9977('0x34')]||0xa)*0x3e8;var _0x25d7ba=(_0xd19703[_0x9977('0x34')]||0x14)*0x3e8;var _0x347af5,_0x42c397;if(_0x57bdb7>_0x25d7ba){_0x25d7ba=_0x57bdb7;}var _0x18655a=seqqueue['createQueue'](_0x57bdb7);_0x18655a['id']=_0x13355d;_0x18655a[_0x9977('0x3e')]=_0x57bdb7;_0x18655a[_0x9977('0x3f')]=_0x25d7ba;_0x18655a[_0x9977('0x22')]=_0x2edc2f['channel'];_0x17ddff[_0x9977('0x40')][_0x13355d]['on'](_0x9977('0x41'),function(){logger[_0x9977('0x29')](_0x9977('0x42'),_0x13355d);stopRouting(_0x13355d,_0x7be955,_0x2edc2f,_0x17ddff);clearTimeout(_0x347af5);_0x347af5=undefined;_0x18655a[_0x9977('0x43')](!![]);if(_0x17ddff[_0x9977('0x40')][_0x13355d]){delete _0x17ddff['rules'][_0x13355d];}_0x21b8bd[_0x9977('0x3c')]();});_0x17ddff['rules'][_0x13355d]['on'](_0x9977('0x44'),function(){if(_0x17ddff[_0x9977('0x40')][_0x13355d]){delete _0x17ddff[_0x9977('0x40')][_0x13355d];}});_0x347af5=setTimeout(function(){logger['info'](_0x9977('0x45'),_0x13355d);endRouting(_0x13355d,_0x7be955,_0x2edc2f,_0x17ddff);clearTimeout(_0x347af5);_0x18655a['close'](!![]);_0x21b8bd[_0x9977('0x46')]();},_0x25d7ba);switch(_0x7be955[_0x9977('0x47')]){case _0x9977('0x48'):strategy[_0x9977('0x48')](_0x18655a,_0x7be955,_0x17ddff,_0x2edc2f);break;default:strategy['beepall'](_0x18655a,_0x7be955,_0x17ddff,_0x2edc2f);}}else{logger[_0x9977('0x2e')](_0x9977('0x49'),_0x13355d,_0xd19703[_0x9977('0x2b')]);_0x21b8bd[_0x9977('0x3c')]();}}}catch(_0x4c5368){console[_0x9977('0x4a')](_0x4c5368);logger[_0x9977('0x2e')](_0x9977('0x3a'),_0x13355d,_0x4c5368[_0x9977('0x4b')]);_0x21b8bd[_0x9977('0x3c')]();}};}; \ 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 b939da8..2b8ffbb 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 _0x5ea2=['uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','exports'];(function(_0x57f6e4,_0x2f0c3e){var _0x1847a6=function(_0x322979){while(--_0x322979){_0x57f6e4['push'](_0x57f6e4['shift']());}};_0x1847a6(++_0x2f0c3e);}(_0x5ea2,0x1ce));var _0x25ea=function(_0x1903c8,_0x228b68){_0x1903c8=_0x1903c8-0x0;var _0x4ba31c=_0x5ea2[_0x1903c8];return _0x4ba31c;};'use strict';var _=require('lodash');var uuid=require(_0x25ea('0x0'));var util=require(_0x25ea('0x1'));var logger=require(_0x25ea('0x2'))(_0x25ea('0x3'));var Agent=function(_0x3c461d,_0x4593fc,_0x1543ab,_0x190db7){this[_0x25ea('0x4')]=uuid['v4']();this[_0x25ea('0x5')]=_0x3c461d;this[_0x25ea('0x6')]=_0x4593fc;this[_0x25ea('0x7')]=_0x1543ab;this['routing']=_0x190db7;this['squeue'][_0x25ea('0x8')](this['handleRun'][_0x25ea('0x9')](this),this[_0x25ea('0xa')][_0x25ea('0x9')](this));this[_0x25ea('0x5')]['on'](_0x25ea('0xb'),this[_0x25ea('0xa')][_0x25ea('0x9')](this));this[_0x25ea('0x5')]['on'](_0x25ea('0xc'),this[_0x25ea('0xd')][_0x25ea('0x9')](this));};Agent[_0x25ea('0xe')]['push']=function(){this['squeue'][_0x25ea('0x8')](this['handleRun'][_0x25ea('0x9')](this),this[_0x25ea('0xa')][_0x25ea('0x9')](this));};Agent[_0x25ea('0xe')][_0x25ea('0xd')]=function(){this[_0x25ea('0xa')](!![]);};Agent['prototype'][_0x25ea('0xf')]=function(_0xbe86b7){logger[_0x25ea('0x10')](_0x25ea('0x11'),this['squeue']['id'],this['agent']['id']);if(_['isNil'](this['realtime'][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']])){logger[_0x25ea('0x10')](_0x25ea('0x13'),this[_0x25ea('0x5')]['id'],this[_0x25ea('0x6')]['id']);setTimeout(this['push'][_0x25ea('0x9')](this),0x3e8);}else{if(this[_0x25ea('0x3')][_0x25ea('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']],this[_0x25ea('0x5')][_0x25ea('0x15')],![])){this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']][_0x25ea('0x16')]=!![];this['realtime']['agents'][this[_0x25ea('0x6')]['id']][_0x25ea('0x17')]=undefined;util['showNotification'](this[_0x25ea('0x4')],this[_0x25ea('0x5')]['id'],this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']],null,this['routing']);util['writeLog'](this[_0x25ea('0x5')]['id'],this[_0x25ea('0x7')]['agents'][this[_0x25ea('0x6')]['id']],_0x25ea('0x18')+(this[_0x25ea('0x3')]['forcedOwnership']?_0x25ea('0x19'):''));}else{logger[_0x25ea('0x10')](_0x25ea('0x1a'),this[_0x25ea('0x5')]['id'],this[_0x25ea('0x6')]['id']);setTimeout(this['push'][_0x25ea('0x9')](this),0x3e8);}}};Agent['prototype'][_0x25ea('0xa')]=function(_0x36bcfe){if(_[_0x25ea('0x1b')](this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']])){return logger[_0x25ea('0x10')](_0x25ea('0x13'),this[_0x25ea('0x5')]['id'],this[_0x25ea('0x6')]['id']);}else{logger['info'](_0x25ea('0x1c'),this[_0x25ea('0x5')]['id'],this['agent']['id']);util['hideNotification'](this[_0x25ea('0x4')],this[_0x25ea('0x5')]['id'],this['realtime']['agents'][this[_0x25ea('0x6')]['id']],null,this[_0x25ea('0x3')]);this['realtime'][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']][_0x25ea('0x16')]=![];this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']][_0x25ea('0x17')]=undefined;util[_0x25ea('0x1d')](this[_0x25ea('0x5')]['id'],this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']],_0x36bcfe?_0x25ea('0x1e'):_0x25ea('0x1f'));}if(!_0x36bcfe){setTimeout(this[_0x25ea('0x8')][_0x25ea('0x9')](this),0x3e8);}};function agent(_0x1f6bd9,_0x20ea56,_0x4a4c03,_0x4d4693){return new Agent(_0x1f6bd9,_0x20ea56,_0x4a4c03,_0x4d4693);}module[_0x25ea('0x20')]=agent; \ No newline at end of file +var _0x4b92=['push','bind','handleTimeout','handleDrained','handleRun','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','realtime','busyQueue','writeLog',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busy','STOP','exports','lodash','uuid','./util','routing','notificationId','squeue','agent'];(function(_0x84ab1d,_0x31d940){var _0x2ff59f=function(_0x22a739){while(--_0x22a739){_0x84ab1d['push'](_0x84ab1d['shift']());}};_0x2ff59f(++_0x31d940);}(_0x4b92,0x1f1));var _0x24b9=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4b92[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x24b9('0x0'));var uuid=require(_0x24b9('0x1'));var util=require(_0x24b9('0x2'));var logger=require('../../../../../config/logger')(_0x24b9('0x3'));var Agent=function(_0x4ab72d,_0x5796b2,_0x6baba2,_0x263b1d){this[_0x24b9('0x4')]=uuid['v4']();this[_0x24b9('0x5')]=_0x4ab72d;this[_0x24b9('0x6')]=_0x5796b2;this['realtime']=_0x6baba2;this[_0x24b9('0x3')]=_0x263b1d;this[_0x24b9('0x5')][_0x24b9('0x7')](this['handleRun'][_0x24b9('0x8')](this),this[_0x24b9('0x9')][_0x24b9('0x8')](this));this['squeue']['on']('timeout',this[_0x24b9('0x9')][_0x24b9('0x8')](this));this[_0x24b9('0x5')]['on']('drained',this[_0x24b9('0xa')][_0x24b9('0x8')](this));};Agent['prototype'][_0x24b9('0x7')]=function(){this['squeue'][_0x24b9('0x7')](this[_0x24b9('0xb')][_0x24b9('0x8')](this),this[_0x24b9('0x9')][_0x24b9('0x8')](this));};Agent[_0x24b9('0xc')][_0x24b9('0xa')]=function(){this[_0x24b9('0x9')](!![]);};Agent[_0x24b9('0xc')]['handleRun']=function(_0x1b6ba1){logger[_0x24b9('0xd')](_0x24b9('0xe'),this[_0x24b9('0x5')]['id'],this[_0x24b9('0x6')]['id']);if(_[_0x24b9('0xf')](this['realtime'][_0x24b9('0x10')][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x24b9('0x5')]['id'],this[_0x24b9('0x6')]['id']);setTimeout(this[_0x24b9('0x7')][_0x24b9('0x8')](this),0x3e8);}else{if(this['routing'][_0x24b9('0x11')]||util[_0x24b9('0x12')](this[_0x24b9('0x5')]['id'],this['realtime'][_0x24b9('0x10')][this[_0x24b9('0x6')]['id']],this[_0x24b9('0x5')][_0x24b9('0x13')],![])){this[_0x24b9('0x14')][_0x24b9('0x10')][this[_0x24b9('0x6')]['id']]['busy']=!![];this[_0x24b9('0x14')][_0x24b9('0x10')][this[_0x24b9('0x6')]['id']][_0x24b9('0x15')]=undefined;util['showNotification'](this['notificationId'],this[_0x24b9('0x5')]['id'],this[_0x24b9('0x14')]['agents'][this[_0x24b9('0x6')]['id']],null,this[_0x24b9('0x3')]);util[_0x24b9('0x16')](this['squeue']['id'],this[_0x24b9('0x14')][_0x24b9('0x10')][this[_0x24b9('0x6')]['id']],'RINGING'+(this['routing'][_0x24b9('0x11')]?_0x24b9('0x17'):''));}else{logger[_0x24b9('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x24b9('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x24b9('0x7')][_0x24b9('0x8')](this),0x3e8);}}};Agent[_0x24b9('0xc')][_0x24b9('0x9')]=function(_0x32560d){if(_[_0x24b9('0xf')](this[_0x24b9('0x14')]['agents'][this[_0x24b9('0x6')]['id']])){return logger[_0x24b9('0xd')](_0x24b9('0x18'),this[_0x24b9('0x5')]['id'],this[_0x24b9('0x6')]['id']);}else{logger[_0x24b9('0xd')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x24b9('0x5')]['id'],this[_0x24b9('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0x24b9('0x5')]['id'],this['realtime'][_0x24b9('0x10')][this[_0x24b9('0x6')]['id']],null,this['routing']);this[_0x24b9('0x14')][_0x24b9('0x10')][this[_0x24b9('0x6')]['id']][_0x24b9('0x19')]=![];this[_0x24b9('0x14')][_0x24b9('0x10')][this[_0x24b9('0x6')]['id']][_0x24b9('0x15')]=undefined;util[_0x24b9('0x16')](this[_0x24b9('0x5')]['id'],this[_0x24b9('0x14')][_0x24b9('0x10')][this[_0x24b9('0x6')]['id']],_0x32560d?_0x24b9('0x1a'):'TIMEOUT');}if(!_0x32560d){setTimeout(this[_0x24b9('0x7')][_0x24b9('0x8')](this),0x3e8);}};function agent(_0x2dad45,_0x2373e4,_0x1043fe,_0x18adef){return new Agent(_0x2dad45,_0x2373e4,_0x1043fe,_0x18adef);}module[_0x24b9('0x1b')]=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 3b5302e..8410869 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 _0x294b=['busy','busyQueue','name','showNotification','notificationId','info','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','exports','lodash','./util','../../../../../config/logger','routing','squeue','queue','realtime','handleRun','timeout','handleTimeout','handleDrained','bind','prototype','push','isNil','Agents','length','agents','isAgentAvailable','channel','writeLog','RINGING'];(function(_0xe0fc7c,_0x3fa8e8){var _0x589d78=function(_0x285f75){while(--_0x285f75){_0xe0fc7c['push'](_0xe0fc7c['shift']());}};_0x589d78(++_0x3fa8e8);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var uuid=require('uuid');var util=require(_0xb294('0x1'));var logger=require(_0xb294('0x2'))(_0xb294('0x3'));var Beepall=function(_0x411640,_0x1cd458,_0x417648,_0x58fe24){this['notificationId']=uuid['v4']();this[_0xb294('0x4')]=_0x411640;this[_0xb294('0x5')]=_0x1cd458;this[_0xb294('0x6')]=_0x417648;this[_0xb294('0x3')]=_0x58fe24;this[_0xb294('0x4')]['push'](this[_0xb294('0x7')]['bind'](this),this['handleTimeout']['bind'](this));this[_0xb294('0x4')]['on'](_0xb294('0x8'),this[_0xb294('0x9')]['bind'](this));this['squeue']['on']('drained',this[_0xb294('0xa')][_0xb294('0xb')](this));};Beepall[_0xb294('0xc')][_0xb294('0xd')]=function(){this[_0xb294('0x4')][_0xb294('0xd')](this[_0xb294('0x7')][_0xb294('0xb')](this),this[_0xb294('0x9')][_0xb294('0xb')](this));};Beepall['prototype']['handleDrained']=function(_0xe8178e){this['handleTimeout'](!![]);};Beepall['prototype'][_0xb294('0x7')]=function(_0x870d74){var _0x46a7b9=!![];if(!_[_0xb294('0xe')](this[_0xb294('0x5')])&&!_[_0xb294('0xe')](this[_0xb294('0x5')][_0xb294('0xf')])&&this[_0xb294('0x5')][_0xb294('0xf')][_0xb294('0x10')]>0x0){for(var _0x51110b=0x0,_0x191b7f;_0x51110b0x0){for(var _0x1c3784=0x0,_0x221151;_0x1c37840x0&&_0x3c3a78[_0x252440+_0xe8ac('0x27')]>=_0x3c3a78[_0x252440+'Capacity']){writeLog(_0x3933d2,_0x3c3a78,_0x252440['toUpperCase']()+_0xe8ac('0x28'));return![];}}return!![];};exports[_0xe8ac('0x29')]=function(_0x59512c,_0x2a78c6,_0x5948aa,_0x54f94c,_0x4c1d08){return sendNotification(!![],_0x59512c,_0x2a78c6,_0x5948aa,_0x54f94c,_0x4c1d08);};exports[_0xe8ac('0x2a')]=function(_0x41294e,_0x3798c5,_0x5d7562,_0x156550,_0x41ffe8){return sendNotification(![],_0x41294e,_0x3798c5,_0x5d7562,_0x156550,_0x41ffe8);};exports[_0xe8ac('0x2b')]=writeLog; \ No newline at end of file +var _0x7278=['redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/logger','routing'];(function(_0x1ef0b3,_0x468ed2){var _0x4dd52d=function(_0x2f2052){while(--_0x2f2052){_0x1ef0b3['push'](_0x1ef0b3['shift']());}};_0x4dd52d(++_0x468ed2);}(_0x7278,0x161));var _0x8727=function(_0x32d574,_0x3406df){_0x32d574=_0x32d574-0x0;var _0x3ecaa3=_0x7278[_0x32d574];return _0x3ecaa3;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var utils=require(_0x8727('0x2'));var Mustache=require(_0x8727('0x3'));var Redis=require(_0x8727('0x4'));var config=require('../../../../../config/environment');var logger=require(_0x8727('0x5'))(_0x8727('0x6'));config[_0x8727('0x7')]=_[_0x8727('0x8')](config[_0x8727('0x7')],{'host':_0x8727('0x9'),'port':0x18eb});var io=require(_0x8727('0xa'))(new Redis(config['redis']));function emit(_0xfd1902,_0x2f491c,_0xffd783){io['to'](_0xfd1902)[_0x8727('0xb')](_0x2f491c,_0xffd783);}function sendNotification(_0x4160c3,_0x4c5b50,_0x4b1985,_0x4df6f8,_0xb575a3,_0x336193){io['to'](util[_0x8727('0xc')](_0x8727('0xd'),_0x4df6f8[_0x8727('0xe')]))[_0x8727('0xb')](_0x8727('0xf'),_0x4df6f8);var _0xefa0bf=_0x336193||{};var _0x4af9d2=_0x4b1985[_0x8727('0x10')]('.');var _0x2d9d47={'uniqueid':_0x4c5b50,'channel':_0x4af9d2[0x0],'id':_0x4af9d2[0x1],'title':_0x4af9d2[0x0]+_0x8727('0x11'),'interactionId':_0x4af9d2[0x2],'queue':_0xb575a3?_0xb575a3['name']:null,'sound':_0xefa0bf[_0x8727('0x12')][_0x8727('0x13')],'shake':_0xefa0bf['account'][_0x8727('0x14')]};try{if(!_0xefa0bf[_0x8727('0x15')]){_0xefa0bf[_0x8727('0x15')]={};}if(_0xb575a3){_0xefa0bf[_0x8727('0x15')][_0x8727('0x16')]=_0xb575a3;}else if(_0xefa0bf[_0x8727('0x15')][_0x8727('0x16')]){delete _0xefa0bf[_0x8727('0x15')][_0x8727('0x16')];}_0x2d9d47[_0x8727('0x17')]=utils['getMustacheRender'](_0xefa0bf[_0x8727('0x12')][_0x8727('0x18')],_0xefa0bf);}catch(_0x16d1b7){_0x2d9d47[_0x8727('0x17')]=_0x8727('0x19');logger[_0x8727('0x1a')](util['format']('[%s][QUEUE]\x20%s',_0x4c5b50,_0x16d1b7[_0x8727('0x1b')]));}io['to'](util['format'](_0x8727('0xd'),_0x4df6f8[_0x8727('0xe')]))[_0x8727('0xb')](util[_0x8727('0xc')](_0x8727('0x1c'),_0x4160c3?'save':_0x8727('0x1d')),_0x2d9d47);}function writeLog(_0x286856,_0x8cde82,_0x1d78df){return logger[_0x8727('0x1e')](util[_0x8727('0xc')](_0x8727('0x1f'),_0x286856,_0x8cde82[_0x8727('0xe')],_0x1d78df));}exports[_0x8727('0x20')]=function(_0x56ffd5,_0x268a13,_0x1a69d5,_0x4c699b){if(_0x268a13[_0x8727('0x21')]){writeLog(_0x56ffd5,_0x268a13,_0x8727('0x22'));return![];}if(!_0x268a13['online']){writeLog(_0x56ffd5,_0x268a13,'OFFLINE');return![];}if(_0x268a13[_0x1a69d5+_0x8727('0x23')]){writeLog(_0x56ffd5,_0x268a13,_0x8727('0x24'));return![];}if(_0x4c699b&&_0x268a13[_0x8727('0x25')](_0x1a69d5+'Capacity')&&_0x268a13[_0x8727('0x25')](_0x1a69d5+_0x8727('0x26'))){if(_0x268a13[_0x1a69d5+_0x8727('0x27')]>0x0&&_0x268a13[_0x1a69d5+_0x8727('0x26')]>=_0x268a13[_0x1a69d5+_0x8727('0x27')]){writeLog(_0x56ffd5,_0x268a13,_0x1a69d5[_0x8727('0x28')]()+_0x8727('0x29'));return![];}}return!![];};exports[_0x8727('0x2a')]=function(_0x5d03f2,_0x243f15,_0x307055,_0x54034d,_0x23325f){return sendNotification(!![],_0x5d03f2,_0x243f15,_0x307055,_0x54034d,_0x23325f);};exports[_0x8727('0x2b')]=function(_0x3ecd6a,_0x228ca9,_0x416da8,_0x1e21b9,_0x57733d){return sendNotification(![],_0x3ecd6a,_0x228ca9,_0x416da8,_0x1e21b9,_0x57733d);};exports[_0x8727('0x2c')]=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 5c94cab..a11b133 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 _0x3f18=['replace','isNil','isEmpty','info','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','validate','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0x3f18,0x1aa));var _0x83f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f18[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x83f1('0x0'));var sh=require('shelljs');var _=require(_0x83f1('0x1'));var utils=require('./utils');var logger=require(_0x83f1('0x2'))(_0x83f1('0x3'));var system=schema({'command':{'type':_0x83f1('0x4'),'required':!![],'message':_0x83f1('0x5')}});exports['consequence']=function(_0x282d9d,_0x5e8af8){return function(_0x5bfd2d){try{var _0x4bf5e9={'command':_0x5e8af8[0x0]};var _0x37f390=system['validate'](_0x4bf5e9,{'typecast':!![]});if(_0x37f390[_0x83f1('0x6')]){logger[_0x83f1('0x7')](_0x83f1('0x8'),_0x282d9d,_['map'](_0x37f390,_0x83f1('0x9'))[_0x83f1('0xa')](',\x20'));logger['info'](_0x83f1('0xb'),_0x282d9d);_0x5bfd2d[_0x83f1('0xc')]();}else{var _0x194b53=this;var _0x2792a0=utils[_0x83f1('0xd')](_0x5e8af8[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x282d9d,_0x2792a0);sh['exec'](_['trim'](_0x2792a0),function(_0x301f1b,_0x488614){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x282d9d,_0x301f1b);if(_0x301f1b==0x0){var _0x365c56=_0x488614[_0x83f1('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x83f1('0xf')](_0x5e8af8[0x1])||_[_0x83f1('0x10')](_0x5e8af8[0x1])){logger[_0x83f1('0x11')](_0x83f1('0x12'),_0x282d9d);_0x194b53['body'][_0x5e8af8[0x1]]=_0x365c56;}else{logger['info'](_0x83f1('0x13'),_0x282d9d,_0x5e8af8[0x1],_0x365c56);_0x194b53[_0x83f1('0x14')][_0x5e8af8[0x1]]=_0x365c56;}}_0x5bfd2d[_0x83f1('0xc')]();});}}catch(_0x1004bc){logger['error'](_0x83f1('0x8'),_0x282d9d,_[_0x83f1('0x15')](_0x1004bc)?JSON['stringify'](_0x1004bc):_0x1004bc);logger[_0x83f1('0x11')](_0x83f1('0xb'),_0x282d9d);_0x5bfd2d[_0x83f1('0xc')]();}};}; \ No newline at end of file +var _0x3316=['join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x3316,0x161));var _0x6331=function(_0x2975f1,_0x453f49){_0x2975f1=_0x2975f1-0x0;var _0x2c08d5=_0x3316[_0x2975f1];return _0x2c08d5;};'use strict';var schema=require(_0x6331('0x0'));var sh=require('shelljs');var _=require(_0x6331('0x1'));var utils=require('./utils');var logger=require(_0x6331('0x2'))(_0x6331('0x3'));var system=schema({'command':{'type':_0x6331('0x4'),'required':!![],'message':_0x6331('0x5')}});exports[_0x6331('0x6')]=function(_0x4b08a5,_0x1258c9){return function(_0x46f33f){try{var _0x213358={'command':_0x1258c9[0x0]};var _0x2d237e=system[_0x6331('0x0')](_0x213358,{'typecast':!![]});if(_0x2d237e[_0x6331('0x7')]){logger[_0x6331('0x8')](_0x6331('0x9'),_0x4b08a5,_['map'](_0x2d237e,_0x6331('0xa'))[_0x6331('0xb')](',\x20'));logger[_0x6331('0xc')](_0x6331('0xd'),_0x4b08a5);_0x46f33f[_0x6331('0xe')]();}else{var _0x34065d=this;var _0x15aa07=utils[_0x6331('0xf')](_0x1258c9[0x0],this);logger[_0x6331('0xc')](_0x6331('0x10'),_0x4b08a5,_0x15aa07);sh['exec'](_[_0x6331('0x11')](_0x15aa07),function(_0x3655d1,_0x569b81){logger['info'](_0x6331('0x12'),_0x4b08a5,_0x3655d1);if(_0x3655d1==0x0){var _0x25952e=_0x569b81[_0x6331('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1258c9[0x1])||_[_0x6331('0x14')](_0x1258c9[0x1])){logger[_0x6331('0xc')](_0x6331('0x15'),_0x4b08a5);_0x34065d[_0x6331('0x16')][_0x1258c9[0x1]]=_0x25952e;}else{logger['info'](_0x6331('0x17'),_0x4b08a5,_0x1258c9[0x1],_0x25952e);_0x34065d[_0x6331('0x16')][_0x1258c9[0x1]]=_0x25952e;}}_0x46f33f[_0x6331('0xe')]();});}}catch(_0x230e09){logger[_0x6331('0x8')](_0x6331('0x9'),_0x4b08a5,_[_0x6331('0x18')](_0x230e09)?JSON[_0x6331('0x19')](_0x230e09):_0x230e09);logger[_0x6331('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4b08a5);_0x46f33f[_0x6331('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 e02f932..6fa6f2d 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 _0xbc91=['channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','info','next'];(function(_0x42cbf3,_0x27a08c){var _0x51bcd7=function(_0x1b506e){while(--_0x1b506e){_0x42cbf3['push'](_0x42cbf3['shift']());}};_0x51bcd7(++_0x27a08c);}(_0xbc91,0x10f));var _0x1bc9=function(_0x5046c5,_0xd3806b){_0x5046c5=_0x5046c5-0x0;var _0x3898e8=_0xbc91[_0x5046c5];return _0x3898e8;};'use strict';var schema=require(_0x1bc9('0x0'));var _=require(_0x1bc9('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1bc9('0x2')),'whatsappInteraction':require(_0x1bc9('0x3'))};var logger=require(_0x1bc9('0x4'))(_0x1bc9('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1bc9('0x6')}});exports[_0x1bc9('0x7')]=function(_0x699b98,_0x2cc8e5,_0x3491d6,_0x5a69c3){return function(_0x4dc973){try{var _0x1f2c7b={'tag':_0x2cc8e5[0x0]};var _0x26f74a=tag[_0x1bc9('0x0')](_0x1f2c7b,{'typecast':!![]});if(_0x26f74a[_0x1bc9('0x8')]){logger[_0x1bc9('0x9')](_0x1bc9('0xa'),_0x699b98,_[_0x1bc9('0xb')](_0x26f74a,_0x1bc9('0xc'))['join'](',\x20'));logger[_0x1bc9('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x699b98);_0x4dc973[_0x1bc9('0xe')]();}else{var _0xf9a14e={'ids':[_0x2cc8e5[0x0]]};if(rpc[_0x5a69c3[_0x1bc9('0xf')]+_0x1bc9('0x10')]){rpc[_0x5a69c3[_0x1bc9('0xf')]+_0x1bc9('0x10')][_0x1bc9('0x11')](_0x5a69c3['interaction']['id'],_0xf9a14e)[_0x1bc9('0x12')](function(_0x336e29){logger[_0x1bc9('0xd')](_0x1bc9('0x13'),_0x699b98,_0x2cc8e5[0x1],_0x5a69c3[_0x1bc9('0xf')],_0x5a69c3[_0x1bc9('0x14')]['id']);})[_0x1bc9('0x15')](function(_0x5b6b27){logger[_0x1bc9('0x9')](_0x1bc9('0xa'),_0x699b98,JSON[_0x1bc9('0x16')](_0x5b6b27));logger[_0x1bc9('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x699b98);})[_0x1bc9('0x17')](function(){_0x4dc973[_0x1bc9('0xe')]();});}}}catch(_0x4c920d){logger[_0x1bc9('0x9')]('[%s][TAG]\x20%s',_0x699b98,_[_0x1bc9('0x18')](_0x4c920d)?JSON['stringify'](_0x4c920d):_0x4c920d);logger[_0x1bc9('0xd')](_0x1bc9('0x19'),_0x699b98);_0x4dc973[_0x1bc9('0xe')]();}};}; \ No newline at end of file +var _0x3776=['lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','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','isObject','validate'];(function(_0xac932d,_0x15cfa9){var _0x37d365=function(_0x3eb73e){while(--_0x3eb73e){_0xac932d['push'](_0xac932d['shift']());}};_0x37d365(++_0x15cfa9);}(_0x3776,0xef));var _0x6377=function(_0xd9ce1,_0x517167){_0xd9ce1=_0xd9ce1-0x0;var _0x54be53=_0x3776[_0xd9ce1];return _0x54be53;};'use strict';var schema=require(_0x6377('0x0'));var _=require(_0x6377('0x1'));var rpc={'chatInteraction':require(_0x6377('0x2')),'openchannelInteraction':require(_0x6377('0x3')),'smsInteraction':require(_0x6377('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x6377('0x5')),'whatsappInteraction':require(_0x6377('0x6'))};var logger=require(_0x6377('0x7'))(_0x6377('0x8'));var tag=schema({'tag':{'type':_0x6377('0x9'),'required':!![],'message':_0x6377('0xa')}});exports[_0x6377('0xb')]=function(_0x441561,_0x362aaf,_0x22aff4,_0x3b1288){return function(_0x1ecb34){try{var _0x4709d7={'tag':_0x362aaf[0x0]};var _0x129ea2=tag[_0x6377('0x0')](_0x4709d7,{'typecast':!![]});if(_0x129ea2[_0x6377('0xc')]){logger[_0x6377('0xd')](_0x6377('0xe'),_0x441561,_[_0x6377('0xf')](_0x129ea2,'message')[_0x6377('0x10')](',\x20'));logger[_0x6377('0x11')](_0x6377('0x12'),_0x441561);_0x1ecb34[_0x6377('0x13')]();}else{var _0x182aa1={'ids':[_0x362aaf[0x0]]};if(rpc[_0x3b1288['channel']+_0x6377('0x14')]){rpc[_0x3b1288[_0x6377('0x15')]+'Interaction'][_0x6377('0x16')](_0x3b1288[_0x6377('0x17')]['id'],_0x182aa1)[_0x6377('0x18')](function(_0x5b9340){logger[_0x6377('0x11')](_0x6377('0x19'),_0x441561,_0x362aaf[0x1],_0x3b1288[_0x6377('0x15')],_0x3b1288['interaction']['id']);})[_0x6377('0x1a')](function(_0x5b3bf9){logger[_0x6377('0xd')](_0x6377('0xe'),_0x441561,JSON[_0x6377('0x1b')](_0x5b3bf9));logger[_0x6377('0x11')](_0x6377('0x12'),_0x441561);})[_0x6377('0x1c')](function(){_0x1ecb34[_0x6377('0x13')]();});}}}catch(_0x2edf3b){logger['error'](_0x6377('0xe'),_0x441561,_[_0x6377('0x1d')](_0x2edf3b)?JSON[_0x6377('0x1b')](_0x2edf3b):_0x2edf3b);logger[_0x6377('0x11')](_0x6377('0x12'),_0x441561);_0x1ecb34['next']();}};}; \ 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 be65eae..ccc7326 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 _0x2d14=['params','stringify','utf8','application/json-rpc','then','result','logged','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','method','login'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x2d14,0x75));var _0x42d1=function(_0x1a5a6d,_0x42518c){_0x1a5a6d=_0x1a5a6d-0x0;var _0x2b2b3e=_0x2d14[_0x1a5a6d];return _0x2b2b3e;};'use strict';var rp=require(_0x42d1('0x0'));var logger=require('../../../../config/logger')(_0x42d1('0x1'));var _=require(_0x42d1('0x2'));var arr=[];exports[_0x42d1('0x3')]=function(_0x393f9e,_0x501155){return function(_0x236c8c){var _0x5084d5=_0x501155[0xa];var _0x3e7c21=_0x501155[0xb];var _0x3c850c=_0x501155[0xc];var _0x239e72=_0x501155[0xd];var _0x46ba9c=_0x501155[0xe];var _0x3e8b3c=_0x501155[0xf][_0x42d1('0x4')](/\n/g,_0x42d1('0x5'));var _0x1103cf=_0x501155[0x10][_0x42d1('0x4')](/\n/g,'\x20');if(!arr[_0x42d1('0x6')](_0x3e7c21)){arr[_0x42d1('0x7')](_0x3e7c21);var _0x9d0472=_0x501155[0x3];var _0x44bd49=_0x501155[0x4];var _0x4b2efd=_0x501155[0x1];var _0x1a45b5=_0x501155[0x0];var _0x4da19f={};_0x4da19f['urlOnAnswer']=_0x501155[0x8]+_0x42d1('0x8')+_0x3c850c+'|'+_0x5084d5+'|'+_0x239e72+'|'+_0x3e7c21+'|'+_0x46ba9c;_0x4da19f[_0x42d1('0x9')]=_0x501155[0x7]+_0x42d1('0x8')+_0x3c850c+'|'+_0x5084d5+'|'+_0x239e72+'|'+_0x3e7c21+'|'+_0x46ba9c+'|'+_0x3e8b3c+'|'+_0x1103cf;_0x4da19f[_0x42d1('0xa')]=_0x501155[0x9];var _0x12f4f4={};_0x12f4f4[_0x42d1('0xb')]=_0x42d1('0xc');_0x12f4f4[_0x42d1('0xd')]=_0x42d1('0xe');var _0xa92848=[];_0xa92848[_0x42d1('0x7')](_0x501155[0x2]);_0xa92848['push'](_0x501155[0x5]);_0xa92848[_0x42d1('0x7')](_0x501155[0x6]);_0x12f4f4[_0x42d1('0xf')]=_0xa92848;_0x12f4f4['id']=0x1;var _0x451386=JSON[_0x42d1('0x10')](_0x12f4f4);var _0x22e208={'encoding':_0x42d1('0x11'),'method':'POST','timeout':0x2710,'url':_0x9d0472,'headers':{'Content-Type':_0x42d1('0x12')},'body':_0x451386};return rp(_0x22e208)[_0x42d1('0x13')](function(_0xcb684d){const _0x17eeae=JSON['parse'](_0xcb684d);if(!_0x17eeae[_0x42d1('0x14')][_0x42d1('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x129202=_0x3e7c21;var _0x364436=_0x42d1('0x16')+_0x4b2efd+_0x42d1('0x17')+_0x1a45b5+_0x42d1('0x18')+_0x129202+'&data='+JSON['stringify'](_0x4da19f);var _0x415891=_0x44bd49+'?'+_0x364436;return rp(_0x415891);})[_0x42d1('0x13')](function(_0x38d5f9){logger[_0x42d1('0x19')](_0x42d1('0x1a'),_0x393f9e,_0x38d5f9);_0x236c8c[_0x42d1('0x1b')]();})[_0x42d1('0x1c')](function(_0x3060df){logger[_0x42d1('0x1d')](_0x42d1('0x1e'),_0x393f9e,_['isObject'](_0x3060df)?JSON['stringify'](_0x3060df):_0x3060df);_0x236c8c[_0x42d1('0x1b')]();});}else{logger['info'](_0x42d1('0x1f'),_0x393f9e);_0x236c8c[_0x42d1('0x20')]();}};}; \ No newline at end of file +var _0xfc59=['title','jsonrpc','2.0','login','push','stringify','utf8','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','urlOnAnswer','?params=','urlOnRing'];(function(_0xcb07de,_0x55d76d){var _0xcb88f4=function(_0x358468){while(--_0x358468){_0xcb07de['push'](_0xcb07de['shift']());}};_0xcb88f4(++_0x55d76d);}(_0xfc59,0x10e));var _0x9fc5=function(_0x5bbc20,_0x363254){_0x5bbc20=_0x5bbc20-0x0;var _0x959f42=_0xfc59[_0x5bbc20];return _0x959f42;};'use strict';var rp=require(_0x9fc5('0x0'));var logger=require(_0x9fc5('0x1'))(_0x9fc5('0x2'));var _=require(_0x9fc5('0x3'));var arr=[];exports[_0x9fc5('0x4')]=function(_0x26c223,_0xa46412){return function(_0x2745c7){var _0x20cbe0=_0xa46412[0xa];var _0x27a174=_0xa46412[0xb];var _0x51d653=_0xa46412[0xc];var _0x43bb52=_0xa46412[0xd];var _0x5e3424=_0xa46412[0xe];var _0x2f6366=_0xa46412[0xf]['replace'](/\n/g,_0x9fc5('0x5'));var _0x3c9763=_0xa46412[0x10][_0x9fc5('0x6')](/\n/g,'\x20');if(!arr['includes'](_0x27a174)){arr['push'](_0x27a174);var _0x2db1c7=_0xa46412[0x3];var _0x52daa5=_0xa46412[0x4];var _0x3f49ad=_0xa46412[0x1];var _0x262a4c=_0xa46412[0x0];var _0x4ef21a={};_0x4ef21a[_0x9fc5('0x7')]=_0xa46412[0x8]+_0x9fc5('0x8')+_0x51d653+'|'+_0x20cbe0+'|'+_0x43bb52+'|'+_0x27a174+'|'+_0x5e3424;_0x4ef21a[_0x9fc5('0x9')]=_0xa46412[0x7]+_0x9fc5('0x8')+_0x51d653+'|'+_0x20cbe0+'|'+_0x43bb52+'|'+_0x27a174+'|'+_0x5e3424+'|'+_0x2f6366+'|'+_0x3c9763;_0x4ef21a[_0x9fc5('0xa')]=_0xa46412[0x9];var _0x339a18={};_0x339a18[_0x9fc5('0xb')]=_0x9fc5('0xc');_0x339a18['method']=_0x9fc5('0xd');var _0x473ccf=[];_0x473ccf[_0x9fc5('0xe')](_0xa46412[0x2]);_0x473ccf['push'](_0xa46412[0x5]);_0x473ccf[_0x9fc5('0xe')](_0xa46412[0x6]);_0x339a18['params']=_0x473ccf;_0x339a18['id']=0x1;var _0x249c80=JSON[_0x9fc5('0xf')](_0x339a18);var _0x43a5f5={'encoding':_0x9fc5('0x10'),'method':_0x9fc5('0x11'),'timeout':0x2710,'url':_0x2db1c7,'headers':{'Content-Type':_0x9fc5('0x12')},'body':_0x249c80};return rp(_0x43a5f5)['then'](function(_0x17ce01){const _0xd12f45=JSON[_0x9fc5('0x13')](_0x17ce01);if(!_0xd12f45[_0x9fc5('0x14')][_0x9fc5('0x15')]){throw new Error(_0x9fc5('0x16'));}var _0x2eef82=_0x27a174;var _0x181a7b=_0x9fc5('0x17')+_0x3f49ad+_0x9fc5('0x18')+_0x262a4c+_0x9fc5('0x19')+_0x2eef82+_0x9fc5('0x1a')+JSON[_0x9fc5('0xf')](_0x4ef21a);var _0xd2c9db=_0x52daa5+'?'+_0x181a7b;return rp(_0xd2c9db);})['then'](function(_0x5859c6){logger[_0x9fc5('0x1b')](_0x9fc5('0x1c'),_0x26c223,_0x5859c6);_0x2745c7['stop']();})[_0x9fc5('0x1d')](function(_0x2e8bad){logger['error'](_0x9fc5('0x1e'),_0x26c223,_[_0x9fc5('0x1f')](_0x2e8bad)?JSON[_0x9fc5('0xf')](_0x2e8bad):_0x2e8bad);_0x2745c7[_0x9fc5('0x20')]();});}else{logger['info'](_0x9fc5('0x21'),_0x26c223);_0x2745c7[_0x9fc5('0x22')]();}};}; \ 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 e3a1514..98da4e9 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x41577a,_0x2f2a68){var _0x85eb08=function(_0x2ef7e3){while(--_0x2ef7e3){_0x41577a['push'](_0x41577a['shift']());}};_0x85eb08(++_0x2f2a68);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4b8538,_0x389b8e){var _0x4015f1=function(_0xac81a3){while(--_0xac81a3){_0x4b8538['push'](_0x4b8538['shift']());}};_0x4015f1(++_0x389b8e);}(_0xe706,0xa3));var _0x6e70=function(_0x151132,_0x32026a){_0x151132=_0x151132-0x0;var _0x13c2ad=_0xe706[_0x151132];return _0x13c2ad;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index eaf9b09..4389b80 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 _0x05b0=['existsSync','join','.js','app','toLowerCase','autoreply','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','update','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','path','jayson/promise','uuid','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','isArray','applications','length'];(function(_0x10890a,_0x282ef5){var _0x4a91bb=function(_0x43d9d5){while(--_0x43d9d5){_0x10890a['push'](_0x10890a['shift']());}};_0x4a91bb(++_0x282ef5);}(_0x05b0,0x188));var _0x005b=function(_0x190f0f,_0x55ef9c){_0x190f0f=_0x190f0f-0x0;var _0x4d6736=_0x05b0[_0x190f0f];return _0x4d6736;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x005b('0x0'));var fs=require('fs');var jayson=require(_0x005b('0x1'));var BPromise=require('bluebird');var uuid=require(_0x005b('0x2'));var utils=require(_0x005b('0x3'));var config=require('../../../config/environment');var logger=require(_0x005b('0x4'))(_0x005b('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x005b('0x6')),'chatQueueReport':require(_0x005b('0x7')),'smsQueueReport':require(_0x005b('0x8')),'faxQueueReport':require(_0x005b('0x9')),'whatsappQueueReport':require(_0x005b('0xa'))};var RuleEngine=require(_0x005b('0xb'));function getId(_0x263bc9,_0x5cff7f,_0x224892){return util[_0x005b('0xc')]('%s.%s.%s',_0x263bc9,_0x5cff7f||0x0,_0x224892||0x0);}function getIntervals(_0x53fff4,_0x451641){var _0x4d41b8=[];if(!_['isNil'](_0x451641['IntervalId'])&&!_[_0x005b('0xd')](_0x53fff4[_0x451641[_0x005b('0xe')]])&&!_['isNil'](_0x53fff4[_0x451641[_0x005b('0xe')]][_0x005b('0xf')])){_0x4d41b8=_[_0x005b('0x10')](_0x53fff4[_0x451641[_0x005b('0xe')]][_0x005b('0xf')],_0x005b('0x11'));}else if(!_[_0x005b('0xd')](_0x451641['interval'])){_0x4d41b8=[_0x451641['interval']];}return _0x4d41b8;}exports['listen']=function(_0x309c8f){_0x309c8f['rules']={};return new BPromise(function(_0x3e2c82,_0x52f822){var _0x1c8eed={'Start':function(_0x1f7743){var _0x2ce01e=this;return new Promise(function(_0x1991e8,_0x337ca1){if(_0x1f7743){try{var _0x500c1a=[];var _0xa3c3fb=getId(_0x1f7743[_0x005b('0x12')],_0x1f7743[_0x005b('0x13')]?_0x1f7743['message']['id']:0x0,_0x1f7743[_0x005b('0x14')]?_0x1f7743[_0x005b('0x14')]['id']:0x0);if(_0x1f7743['applications']&&_[_0x005b('0x15')](_0x1f7743[_0x005b('0x16')])&&_0x1f7743[_0x005b('0x16')][_0x005b('0x17')]){for(var _0xf51601=0x0;_0xf51601<_0x1f7743['applications'][_0x005b('0x17')];_0xf51601+=0x1){var _0x38cc3b=_0x1f7743['applications'][_0xf51601];if(fs[_0x005b('0x18')](path[_0x005b('0x19')](__dirname,_0x005b('0x16'),_0x38cc3b['app']+_0x005b('0x1a')))){var _0x145c36=[];switch(_0x38cc3b[_0x005b('0x1b')][_0x005b('0x1c')]()){case _0x005b('0x1d'):var _0x2e3ccd=_0x38cc3b['appdata'][_0x005b('0x1e')](',');if(_0x1f7743[_0x005b('0x12')]===_0x005b('0x1f')){_0x145c36['push'](_0x2e3ccd[0x0]);_0x145c36[_0x005b('0x20')](_0x2e3ccd[0x1]);_0x145c36['push'](_0x2e3ccd[_0x005b('0x21')](0x2,_0x2e3ccd['length'])['join'](','));}else{_0x145c36[_0x005b('0x20')](_0x2e3ccd[0x0]);_0x145c36[_0x005b('0x20')](_0x2e3ccd[_0x005b('0x21')](0x1,_0x2e3ccd[_0x005b('0x17')])[_0x005b('0x19')](','));}break;case _0x005b('0x22'):var _0x3d4a1c=_0x38cc3b[_0x005b('0x23')]['split'](',');_0x145c36[_0x005b('0x20')](_0x3d4a1c[0x0]);_0x145c36[_0x005b('0x20')](_0x3d4a1c[0x1]);_0x145c36[_0x005b('0x20')](_0x3d4a1c[_0x005b('0x21')](0x2,_0x3d4a1c[_0x005b('0x17')])[_0x005b('0x19')](','));break;case _0x005b('0x24'):var _0x49561a=_0x38cc3b[_0x005b('0x23')][_0x005b('0x1e')](',');_0x145c36[_0x005b('0x20')](_0x49561a[0x0]);_0x145c36[_0x005b('0x20')](_0x49561a[0x1]);_0x145c36['push'](_0x49561a[0x2]);_0x145c36['push'](_0x49561a[0x3]);_0x145c36[_0x005b('0x20')](_0x49561a[_0x005b('0x21')](0x4,_0x49561a['length'])['join'](','));break;case _0x005b('0x25'):var _0x5b555f=_0x38cc3b[_0x005b('0x23')][_0x005b('0x1e')](',');_0x145c36[_0x005b('0x20')](_0x5b555f[0x0]);_0x145c36['push'](_0x5b555f[0x1]);_0x145c36['push'](_0x5b555f[0x2]);_0x145c36[_0x005b('0x20')](_0x5b555f[0x3]);_0x145c36[_0x005b('0x20')](_0x5b555f[_0x005b('0x21')](0x4,_0x5b555f['length'])['join'](','));break;case _0x005b('0x13'):_0x145c36[_0x005b('0x20')](_0x38cc3b['appdata']);break;case _0x005b('0x26'):_0x145c36['push'](_0x38cc3b[_0x005b('0x27')]);_0x145c36['push'](_0x38cc3b['appdata']);break;case _0x005b('0x28'):var _0x413d90=utils[_0x005b('0x29')](_0x1f7743[_0x005b('0x2a')][_0x005b('0x2b')],_0x1f7743);var _0x52bffe=_0x38cc3b['appdata'][_0x005b('0x1e')](',');_0x145c36[_0x005b('0x20')](_0x52bffe[0x0]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x1]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x2]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x3]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x4]);_0x145c36['push'](_0x52bffe[0x5]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x6]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x7]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x8]);_0x145c36['push'](_0x52bffe[0x9]);_0x145c36[_0x005b('0x20')](_0x52bffe[0xa]);_0x145c36[_0x005b('0x20')](_0x1f7743[_0x005b('0x14')]['id']);_0x145c36[_0x005b('0x20')](_0x1f7743[_0x005b('0x13')]['id']);_0x145c36[_0x005b('0x20')](_0x38cc3b[_0x005b('0x2c')]);_0x145c36[_0x005b('0x20')](_0x1f7743[_0x005b('0x14')][_0x005b('0x2d')]);_0x145c36['push'](_0x1f7743[_0x005b('0x2e')][_0x005b('0x2e')]);_0x145c36['push'](_0x413d90);break;default:_0x145c36=_[_0x005b('0xd')](_0x38cc3b[_0x005b('0x23')])?[]:_0x38cc3b[_0x005b('0x23')][_0x005b('0x1e')](',');}var _0x4ec11c={'id':util[_0x005b('0xc')](_0x005b('0x2f'),_0xa3c3fb,_0x38cc3b['id'],_0x38cc3b['app']),'condition':require(_0x005b('0x30'))[_0x005b('0x31')](_0xa3c3fb,getIntervals(_0x309c8f[_0x005b('0x32')],_0x38cc3b),_0x309c8f),'consequence':require(_0x005b('0x33')+_0x38cc3b[_0x005b('0x1b')])['consequence'](_0xa3c3fb,_0x145c36,_0x309c8f,_0x1f7743),'p':_0x38cc3b['priority']||0x0};logger[_0x005b('0x34')](_0x005b('0x35'),_0x4ec11c['id'],_0x005b('0x36'),getIntervals(_0x309c8f[_0x005b('0x32')],_0x38cc3b)[_0x005b('0x19')]('\x20|\x20'));_0x500c1a[_0x005b('0x20')](_0x4ec11c);}else{logger[_0x005b('0x37')](_0x005b('0x38'),path[_0x005b('0x19')](__dirname,_0x005b('0x16'),_0x38cc3b[_0x005b('0x1b')]+'.js'));}}_0x309c8f[_0x005b('0x39')][_0xa3c3fb]=new RuleEngine(_0x500c1a);_0x309c8f['rules'][_0xa3c3fb][_0x005b('0x3a')](_0x1f7743,function(_0x26375b){logger['info'](_0x005b('0x3b'),JSON[_0x005b('0x3c')](_0x26375b[_0x005b('0x3d')]));if(_0x309c8f[_0x005b('0x39')][_0xa3c3fb]){_0x309c8f['rules'][_0xa3c3fb][_0x005b('0x3e')](_0x005b('0x3f'));}});return _0x1991e8({'code':0xc8,'message':_0x1f7743});}else{logger[_0x005b('0x34')](_0x005b('0x40'));return _0x1991e8({'code':0xc8,'message':_0x1f7743});}}catch(_0x3a5d41){logger[_0x005b('0x37')](_0x3a5d41[_0x005b('0x41')]);return _0x337ca1(_0x2ce01e[_0x005b('0x37')](0x1f4,_0x3a5d41));}}return _0x337ca1(_0x005b('0x42'));});},'AcceptMessage':function(_0x5699d8){var _0x1fed84=this;return new Promise(function(_0x30947e,_0x34fabc){if(_0x5699d8[_0x005b('0x43')]&&_0x5699d8[_0x005b('0x43')]['id']){if(_0x309c8f['agents'][_0x5699d8[_0x005b('0x43')]['id']]){_0x309c8f[_0x005b('0x44')][_0x5699d8[_0x005b('0x43')]['id']]['busy']=![];_0x309c8f[_0x005b('0x44')][_0x5699d8['agent']['id']]['busyQueue']=undefined;}}if(_0x5699d8['message']&&_0x5699d8['message']['id']){try{var _0x134a46=getId(_0x5699d8[_0x005b('0x12')],_0x5699d8[_0x005b('0x13')]?_0x5699d8[_0x005b('0x13')]['id']:0x0,_0x5699d8['interaction']?_0x5699d8[_0x005b('0x14')]['id']:0x0);if(_0x309c8f[_0x005b('0x39')][_0x134a46]){_0x309c8f['rules'][_0x134a46][_0x005b('0x3e')](_0x005b('0x45'));if(rpc[_0x5699d8[_0x005b('0x12')]+_0x005b('0x46')]){rpc[_0x5699d8[_0x005b('0x12')]+'QueueReport'][_0x005b('0x47')](_0x134a46,{'UserId':_0x5699d8[_0x005b('0x13')][_0x005b('0x48')]})[_0x005b('0x49')](function(_0x19ca85){logger[_0x005b('0x37')]('error\x20update\x20queue\x20report');});}}return _0x30947e({'code':0xc8,'message':_0x5699d8});}catch(_0x44fee3){logger[_0x005b('0x37')](_0x44fee3[_0x005b('0x41')]);return _0x34fabc(_0x1fed84[_0x005b('0x37')](0x1f4,_0x44fee3));}}logger[_0x005b('0x37')](_0x005b('0x4a'));return _0x34fabc(_0x1fed84['error'](0x1f4,_0x005b('0x4a')));});},'RejectMessage':function(_0x13a680){var _0x5cea23=this;return new Promise(function(_0x5bbc78,_0x22bf46){if(_0x13a680[_0x005b('0x43')]&&_0x13a680[_0x005b('0x43')]['id']){try{if(_0x309c8f[_0x005b('0x44')][_0x13a680[_0x005b('0x43')]['id']]){_0x309c8f[_0x005b('0x44')][_0x13a680[_0x005b('0x43')]['id']]['busy']=![];_0x309c8f[_0x005b('0x44')][_0x13a680['agent']['id']]['busyQueue']=undefined;}return _0x5bbc78({'code':0xc8,'message':_0x13a680});}catch(_0x35d9df){logger[_0x005b('0x37')](_0x35d9df[_0x005b('0x41')]);return _0x22bf46(_0x5cea23['error'](0x1f4,_0x35d9df));}}logger[_0x005b('0x37')](_0x005b('0x4a'));return _0x22bf46(_0x5cea23[_0x005b('0x37')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x17018b){var _0x4f4130=this;return new Promise(function(_0x41f077,_0x20540a){if(_0x17018b['channel']&&_0x17018b[_0x005b('0x14')]&&_0x17018b[_0x005b('0x14')]['id']){try{var _0x2a4559=getId(_0x17018b[_0x005b('0x12')],_0x17018b[_0x005b('0x13')]?_0x17018b[_0x005b('0x13')]['id']:0x0,_0x17018b['interaction']?_0x17018b[_0x005b('0x14')]['id']:0x0);if(_0x309c8f[_0x005b('0x39')][_0x2a4559]){_0x309c8f[_0x005b('0x39')][_0x2a4559][_0x005b('0x3e')](_0x005b('0x45'));}return _0x41f077({'code':0xc8,'message':_0x17018b});}catch(_0x630c8){logger['error'](_0x630c8[_0x005b('0x41')]);return _0x20540a(_0x4f4130['error'](0x1f4,_0x630c8));}}logger[_0x005b('0x37')](_0x005b('0x4a'));return _0x20540a(_0x4f4130[_0x005b('0x37')](0x1f4,_0x005b('0x4a')));});},'AgentCapacity':function(_0x31e6f5){var _0x2ee675=this;return new Promise(function(_0x31355d,_0x45f561){if(_0x309c8f[_0x005b('0x44')][_0x005b('0x4b')](_0x31e6f5['id'])){for(var _0x20a986 in _0x31e6f5[_0x005b('0x4c')]){if(_0x31e6f5[_0x005b('0x4c')][_0x005b('0x4b')](_0x20a986)){if(_0x309c8f[_0x005b('0x44')][_0x31e6f5['id']]['hasOwnProperty'](_0x20a986+_0x005b('0x4d'))){_0x309c8f[_0x005b('0x44')][_0x31e6f5['id']][_0x20a986+_0x005b('0x4d')]=parseInt(_0x31e6f5[_0x005b('0x4c')][_0x20a986],0xa);}}}_0x309c8f[_0x005b('0x44')][_0x31e6f5['id']][_0x005b('0x4e')]();return _0x31355d({'code':0xc8,'message':_0x309c8f[_0x005b('0x44')][_0x31e6f5['id']]});}else{return _0x45f561(_0x2ee675['error'](0x1f4,_0x005b('0x4f')));}});},'Agents':function(_0x4a5ae5){return new Promise(function(_0x379b37,_0x4bd368){var _0x21d474=_[_0x005b('0x50')](_0x309c8f['agents']);_0x379b37({'count':_0x21d474[_0x005b('0x17')],'rows':_0x21d474});});},'ChatQueues':function(_0x275094){return new Promise(function(_0x10d9d2,_0x2b7f3e){var _0x2d3aeb=[];for(var _0x6fc481 in _0x309c8f[_0x005b('0x51')]){if(_0x309c8f[_0x005b('0x51')][_0x005b('0x4b')](_0x6fc481)){var _0x4262d9=_0x309c8f['chatQueues'][_0x6fc481];var _0x56209a={'id':_0x4262d9['id'],'available':_0x4262d9[_0x005b('0x52')],'loggedIn':_0x4262d9[_0x005b('0x53')],'name':_0x4262d9[_0x005b('0x54')],'paused':_0x4262d9[_0x005b('0x55')],'waiting':_0x4262d9[_0x005b('0x56')]};_0x2d3aeb[_0x005b('0x20')](_0x56209a);}}_0x10d9d2({'count':_0x2d3aeb[_0x005b('0x17')],'rows':_0x2d3aeb});});},'MailQueues':function(_0x28f177){return new Promise(function(_0x396db4,_0x34069e){var _0x3f0853=[];for(var _0x42ce59 in _0x309c8f[_0x005b('0x57')]){if(_0x309c8f['mailQueues'][_0x005b('0x4b')](_0x42ce59)){var _0x453e64=_0x309c8f['mailQueues'][_0x42ce59];var _0xaca777={'id':_0x453e64['id'],'available':_0x453e64[_0x005b('0x52')],'loggedIn':_0x453e64[_0x005b('0x53')],'name':_0x453e64[_0x005b('0x54')],'paused':_0x453e64[_0x005b('0x55')],'waiting':_0x453e64[_0x005b('0x56')]};_0x3f0853[_0x005b('0x20')](_0xaca777);}}_0x396db4({'count':_0x3f0853[_0x005b('0x17')],'rows':_0x3f0853});});},'OpenchannelQueues':function(_0x2c4280){return new Promise(function(_0x5a6146,_0x46cd37){var _0x30e985=[];for(var _0x7a2336 in _0x309c8f[_0x005b('0x58')]){if(_0x309c8f[_0x005b('0x58')][_0x005b('0x4b')](_0x7a2336)){var _0x11c502=_0x309c8f[_0x005b('0x58')][_0x7a2336];var _0x21c970={'id':_0x11c502['id'],'available':_0x11c502[_0x005b('0x52')],'loggedIn':_0x11c502[_0x005b('0x53')],'name':_0x11c502[_0x005b('0x54')],'paused':_0x11c502[_0x005b('0x55')],'waiting':_0x11c502['waiting']};_0x30e985[_0x005b('0x20')](_0x21c970);}}_0x5a6146({'count':_0x30e985['length'],'rows':_0x30e985});});},'SmsQueues':function(_0xcf64fb){return new Promise(function(_0x511691,_0x38dba1){var _0x369819=[];for(var _0x38ff2b in _0x309c8f[_0x005b('0x59')]){if(_0x309c8f[_0x005b('0x59')][_0x005b('0x4b')](_0x38ff2b)){var _0x426340=_0x309c8f['smsQueues'][_0x38ff2b];var _0x4d1908={'id':_0x426340['id'],'available':_0x426340[_0x005b('0x52')],'loggedIn':_0x426340[_0x005b('0x53')],'name':_0x426340['name'],'paused':_0x426340[_0x005b('0x55')],'waiting':_0x426340[_0x005b('0x56')]};_0x369819['push'](_0x4d1908);}}_0x511691({'count':_0x369819[_0x005b('0x17')],'rows':_0x369819});});},'FaxQueues':function(_0x570c86){return new Promise(function(_0x46e257,_0x5496bf){var _0x16a3d8=[];for(var _0x1c38a4 in _0x309c8f['faxQueues']){if(_0x309c8f[_0x005b('0x5a')][_0x005b('0x4b')](_0x1c38a4)){var _0x1cd0b6=_0x309c8f[_0x005b('0x5a')][_0x1c38a4];var _0x1b3d90={'id':_0x1cd0b6['id'],'available':_0x1cd0b6[_0x005b('0x52')],'loggedIn':_0x1cd0b6[_0x005b('0x53')],'name':_0x1cd0b6['name'],'paused':_0x1cd0b6[_0x005b('0x55')],'waiting':_0x1cd0b6[_0x005b('0x56')]};_0x16a3d8[_0x005b('0x20')](_0x1b3d90);}}_0x46e257({'count':_0x16a3d8[_0x005b('0x17')],'rows':_0x16a3d8});});},'WhatsappQueues':function(_0x264d3a){return new Promise(function(_0x314ac6,_0x34ac7b){var _0x3fe0e3=[];for(var _0x4294b3 in _0x309c8f[_0x005b('0x5b')]){if(_0x309c8f[_0x005b('0x5b')][_0x005b('0x4b')](_0x4294b3)){var _0x372369=_0x309c8f[_0x005b('0x5b')][_0x4294b3];var _0x4e43f2={'id':_0x372369['id'],'available':_0x372369['available'],'loggedIn':_0x372369[_0x005b('0x53')],'name':_0x372369[_0x005b('0x54')],'paused':_0x372369['paused'],'waiting':_0x372369['waiting']};_0x3fe0e3[_0x005b('0x20')](_0x4e43f2);}}_0x314ac6({'count':_0x3fe0e3[_0x005b('0x17')],'rows':_0x3fe0e3});});},'ChatQueuesWaitingInteractions':function(_0x4291be){return new Promise(function(_0x65807b,_0x32b9bd){var _0x19addd=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x5c')]);_0x65807b({'count':_0x19addd[_0x005b('0x17')],'rows':_0x19addd});});},'MailQueuesWaitingInteractions':function(_0x456e44){return new Promise(function(_0x59d464,_0x11a6ab){var _0x4a2e7a=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x5d')]);_0x59d464({'count':_0x4a2e7a[_0x005b('0x17')],'rows':_0x4a2e7a});});},'OpenchannelQueuesWaitingInteractions':function(_0x581b79){return new Promise(function(_0x3aa379,_0x1921a5){var _0x2696fb=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x5e')]);_0x3aa379({'count':_0x2696fb[_0x005b('0x17')],'rows':_0x2696fb});});},'SmsQueuesWaitingInteractions':function(_0x44dd54){return new Promise(function(_0x54a58b,_0x118e8f){var _0x4b5bf6=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x5f')]);_0x54a58b({'count':_0x4b5bf6['length'],'rows':_0x4b5bf6});});},'FaxQueuesWaitingInteractions':function(_0x2de5b6){return new Promise(function(_0x103ef4,_0x1e9683){var _0x1a2efb=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x60')]);_0x103ef4({'count':_0x1a2efb[_0x005b('0x17')],'rows':_0x1a2efb});});},'WhatsappQueuesWaitingInteractions':function(_0x2107cb){return new Promise(function(_0x14d189,_0xa30ed2){var _0x360b08=_[_0x005b('0x50')](_0x309c8f['whatsappQueuesWaitingInteractions']);_0x14d189({'count':_0x360b08[_0x005b('0x17')],'rows':_0x360b08});});}};var _0x3ab540=jayson[_0x005b('0x61')](_0x1c8eed)[_0x005b('0x62')]();_0x3ab540['on'](_0x005b('0x37'),function(_0x44bc20){logger[_0x005b('0x37')](JSON[_0x005b('0x3c')](_0x44bc20));return _0x52f822(_0x44bc20);});_0x3ab540[_0x005b('0x63')](0x232c,_0x005b('0x64'),function(){console[_0x005b('0x65')](_0x005b('0x66'),0x232c);return _0x3e2c82(_0x005b('0x67')+0x232c);});});}; \ No newline at end of file +var _0x0eaa=['notificationTemplate','ChatWebsiteId','ContactId','body','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','update','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','name','paused','mailQueues','waiting','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','dialogflowv2','amazonlex','tag','getMustacheRender','account'];(function(_0x275d26,_0x3b09ee){var _0xba4b8f=function(_0x902505){while(--_0x902505){_0x275d26['push'](_0x275d26['shift']());}};_0xba4b8f(++_0x3b09ee);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x9306fc,_0x26d321){_0x9306fc=_0x9306fc-0x0;var _0xba6654=_0x0eaa[_0x9306fc];return _0xba6654;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xa0ea('0x2'));var uuid=require(_0xa0ea('0x3'));var utils=require('./applications/utils');var config=require(_0xa0ea('0x4'));var logger=require(_0xa0ea('0x5'))(_0xa0ea('0x6'));var rpc={'openchannelQueueReport':require(_0xa0ea('0x7')),'mailQueueReport':require(_0xa0ea('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xa0ea('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xa0ea('0xa'));function getId(_0x8632a1,_0x5b2adc,_0x4dbe00){return util[_0xa0ea('0xb')](_0xa0ea('0xc'),_0x8632a1,_0x5b2adc||0x0,_0x4dbe00||0x0);}function getIntervals(_0x28cd6d,_0x309f0b){var _0x7c195d=[];if(!_['isNil'](_0x309f0b[_0xa0ea('0xd')])&&!_[_0xa0ea('0xe')](_0x28cd6d[_0x309f0b[_0xa0ea('0xd')]])&&!_[_0xa0ea('0xe')](_0x28cd6d[_0x309f0b['IntervalId']][_0xa0ea('0xf')])){_0x7c195d=_[_0xa0ea('0x10')](_0x28cd6d[_0x309f0b[_0xa0ea('0xd')]][_0xa0ea('0xf')],_0xa0ea('0x11'));}else if(!_['isNil'](_0x309f0b[_0xa0ea('0x11')])){_0x7c195d=[_0x309f0b[_0xa0ea('0x11')]];}return _0x7c195d;}exports['listen']=function(_0x3970e5){_0x3970e5[_0xa0ea('0x12')]={};return new BPromise(function(_0xff3cf,_0x264561){var _0x4d7f34={'Start':function(_0x128680){var _0x67dc10=this;return new Promise(function(_0x4274c2,_0x130156){if(_0x128680){try{var _0x10d8f9=[];var _0x34b94c=getId(_0x128680[_0xa0ea('0x13')],_0x128680[_0xa0ea('0x14')]?_0x128680[_0xa0ea('0x14')]['id']:0x0,_0x128680[_0xa0ea('0x15')]?_0x128680['interaction']['id']:0x0);if(_0x128680['applications']&&_[_0xa0ea('0x16')](_0x128680[_0xa0ea('0x17')])&&_0x128680[_0xa0ea('0x17')][_0xa0ea('0x18')]){for(var _0x1f194d=0x0;_0x1f194d<_0x128680[_0xa0ea('0x17')][_0xa0ea('0x18')];_0x1f194d+=0x1){var _0x47f654=_0x128680[_0xa0ea('0x17')][_0x1f194d];if(fs[_0xa0ea('0x19')](path[_0xa0ea('0x1a')](__dirname,'applications',_0x47f654[_0xa0ea('0x1b')]+_0xa0ea('0x1c')))){var _0x45fda4=[];switch(_0x47f654[_0xa0ea('0x1b')][_0xa0ea('0x1d')]()){case _0xa0ea('0x1e'):var _0x5105b8=_0x47f654[_0xa0ea('0x1f')]['split'](',');if(_0x128680['channel']===_0xa0ea('0x20')){_0x45fda4[_0xa0ea('0x21')](_0x5105b8[0x0]);_0x45fda4[_0xa0ea('0x21')](_0x5105b8[0x1]);_0x45fda4['push'](_0x5105b8[_0xa0ea('0x22')](0x2,_0x5105b8['length'])[_0xa0ea('0x1a')](','));}else{_0x45fda4[_0xa0ea('0x21')](_0x5105b8[0x0]);_0x45fda4[_0xa0ea('0x21')](_0x5105b8[_0xa0ea('0x22')](0x1,_0x5105b8[_0xa0ea('0x18')])[_0xa0ea('0x1a')](','));}break;case _0xa0ea('0x23'):var _0x287728=_0x47f654[_0xa0ea('0x1f')][_0xa0ea('0x24')](',');_0x45fda4['push'](_0x287728[0x0]);_0x45fda4[_0xa0ea('0x21')](_0x287728[0x1]);_0x45fda4['push'](_0x287728[_0xa0ea('0x22')](0x2,_0x287728[_0xa0ea('0x18')])[_0xa0ea('0x1a')](','));break;case _0xa0ea('0x25'):var _0x389050=_0x47f654[_0xa0ea('0x1f')]['split'](',');_0x45fda4[_0xa0ea('0x21')](_0x389050[0x0]);_0x45fda4['push'](_0x389050[0x1]);_0x45fda4[_0xa0ea('0x21')](_0x389050[0x2]);_0x45fda4['push'](_0x389050[0x3]);_0x45fda4[_0xa0ea('0x21')](_0x389050[_0xa0ea('0x22')](0x4,_0x389050[_0xa0ea('0x18')])['join'](','));break;case _0xa0ea('0x26'):var _0x37a5b3=_0x47f654['appdata'][_0xa0ea('0x24')](',');_0x45fda4[_0xa0ea('0x21')](_0x37a5b3[0x0]);_0x45fda4[_0xa0ea('0x21')](_0x37a5b3[0x1]);_0x45fda4['push'](_0x37a5b3[0x2]);_0x45fda4['push'](_0x37a5b3[0x3]);_0x45fda4[_0xa0ea('0x21')](_0x37a5b3[_0xa0ea('0x22')](0x4,_0x37a5b3[_0xa0ea('0x18')])['join'](','));break;case _0xa0ea('0x14'):_0x45fda4[_0xa0ea('0x21')](_0x47f654[_0xa0ea('0x1f')]);break;case _0xa0ea('0x27'):_0x45fda4[_0xa0ea('0x21')](_0x47f654['TagId']);_0x45fda4['push'](_0x47f654[_0xa0ea('0x1f')]);break;case'tvox':var _0x272dca=utils[_0xa0ea('0x28')](_0x128680[_0xa0ea('0x29')][_0xa0ea('0x2a')],_0x128680);var _0x628464=_0x47f654['appdata'][_0xa0ea('0x24')](',');_0x45fda4[_0xa0ea('0x21')](_0x628464[0x0]);_0x45fda4[_0xa0ea('0x21')](_0x628464[0x1]);_0x45fda4[_0xa0ea('0x21')](_0x628464[0x2]);_0x45fda4[_0xa0ea('0x21')](_0x628464[0x3]);_0x45fda4[_0xa0ea('0x21')](_0x628464[0x4]);_0x45fda4[_0xa0ea('0x21')](_0x628464[0x5]);_0x45fda4[_0xa0ea('0x21')](_0x628464[0x6]);_0x45fda4[_0xa0ea('0x21')](_0x628464[0x7]);_0x45fda4[_0xa0ea('0x21')](_0x628464[0x8]);_0x45fda4['push'](_0x628464[0x9]);_0x45fda4[_0xa0ea('0x21')](_0x628464[0xa]);_0x45fda4['push'](_0x128680[_0xa0ea('0x15')]['id']);_0x45fda4['push'](_0x128680[_0xa0ea('0x14')]['id']);_0x45fda4['push'](_0x47f654[_0xa0ea('0x2b')]);_0x45fda4[_0xa0ea('0x21')](_0x128680[_0xa0ea('0x15')][_0xa0ea('0x2c')]);_0x45fda4['push'](_0x128680[_0xa0ea('0x2d')][_0xa0ea('0x2d')]);_0x45fda4[_0xa0ea('0x21')](_0x272dca);break;default:_0x45fda4=_[_0xa0ea('0xe')](_0x47f654[_0xa0ea('0x1f')])?[]:_0x47f654[_0xa0ea('0x1f')][_0xa0ea('0x24')](',');}var _0x24ac13={'id':util[_0xa0ea('0xb')]('%s:%s:%s',_0x34b94c,_0x47f654['id'],_0x47f654[_0xa0ea('0x1b')]),'condition':require('./interval')[_0xa0ea('0x2e')](_0x34b94c,getIntervals(_0x3970e5[_0xa0ea('0x2f')],_0x47f654),_0x3970e5),'consequence':require(_0xa0ea('0x30')+_0x47f654[_0xa0ea('0x1b')])[_0xa0ea('0x31')](_0x34b94c,_0x45fda4,_0x3970e5,_0x128680),'p':_0x47f654[_0xa0ea('0x32')]||0x0};logger[_0xa0ea('0x33')](_0xa0ea('0x34'),_0x24ac13['id'],_0xa0ea('0x35'),getIntervals(_0x3970e5[_0xa0ea('0x2f')],_0x47f654)[_0xa0ea('0x1a')](_0xa0ea('0x36')));_0x10d8f9[_0xa0ea('0x21')](_0x24ac13);}else{logger[_0xa0ea('0x37')](_0xa0ea('0x38'),path['join'](__dirname,_0xa0ea('0x17'),_0x47f654['app']+_0xa0ea('0x1c')));}}_0x3970e5['rules'][_0x34b94c]=new RuleEngine(_0x10d8f9);_0x3970e5['rules'][_0x34b94c]['execute'](_0x128680,function(_0x53606e){logger[_0xa0ea('0x33')](_0xa0ea('0x39'),JSON['stringify'](_0x53606e[_0xa0ea('0x3a')]));if(_0x3970e5[_0xa0ea('0x12')][_0x34b94c]){_0x3970e5[_0xa0ea('0x12')][_0x34b94c]['emit']('complete');}});return _0x4274c2({'code':0xc8,'message':_0x128680});}else{logger['info'](_0xa0ea('0x3b'));return _0x4274c2({'code':0xc8,'message':_0x128680});}}catch(_0x2d561f){logger[_0xa0ea('0x37')](_0x2d561f[_0xa0ea('0x3c')]);return _0x130156(_0x67dc10[_0xa0ea('0x37')](0x1f4,_0x2d561f));}}return _0x130156(_0xa0ea('0x3d'));});},'AcceptMessage':function(_0x1f0a39){var _0xf7d20f=this;return new Promise(function(_0x541463,_0x10265f){if(_0x1f0a39[_0xa0ea('0x3e')]&&_0x1f0a39[_0xa0ea('0x3e')]['id']){if(_0x3970e5['agents'][_0x1f0a39[_0xa0ea('0x3e')]['id']]){_0x3970e5[_0xa0ea('0x3f')][_0x1f0a39[_0xa0ea('0x3e')]['id']][_0xa0ea('0x40')]=![];_0x3970e5['agents'][_0x1f0a39['agent']['id']][_0xa0ea('0x41')]=undefined;}}if(_0x1f0a39[_0xa0ea('0x14')]&&_0x1f0a39[_0xa0ea('0x14')]['id']){try{var _0x26a018=getId(_0x1f0a39[_0xa0ea('0x13')],_0x1f0a39[_0xa0ea('0x14')]?_0x1f0a39[_0xa0ea('0x14')]['id']:0x0,_0x1f0a39[_0xa0ea('0x15')]?_0x1f0a39[_0xa0ea('0x15')]['id']:0x0);if(_0x3970e5[_0xa0ea('0x12')][_0x26a018]){_0x3970e5['rules'][_0x26a018][_0xa0ea('0x42')](_0xa0ea('0x43'));if(rpc[_0x1f0a39[_0xa0ea('0x13')]+_0xa0ea('0x44')]){rpc[_0x1f0a39[_0xa0ea('0x13')]+_0xa0ea('0x44')][_0xa0ea('0x45')](_0x26a018,{'UserId':_0x1f0a39['message'][_0xa0ea('0x46')]})[_0xa0ea('0x47')](function(_0x4e8e57){logger[_0xa0ea('0x37')]('error\x20update\x20queue\x20report');});}}return _0x541463({'code':0xc8,'message':_0x1f0a39});}catch(_0x3feeb0){logger[_0xa0ea('0x37')](_0x3feeb0[_0xa0ea('0x3c')]);return _0x10265f(_0xf7d20f[_0xa0ea('0x37')](0x1f4,_0x3feeb0));}}logger[_0xa0ea('0x37')]('message\x20is\x20empty');return _0x10265f(_0xf7d20f[_0xa0ea('0x37')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x264853){var _0x4afa03=this;return new Promise(function(_0x2703ad,_0x18c602){if(_0x264853['agent']&&_0x264853[_0xa0ea('0x3e')]['id']){try{if(_0x3970e5[_0xa0ea('0x3f')][_0x264853[_0xa0ea('0x3e')]['id']]){_0x3970e5['agents'][_0x264853[_0xa0ea('0x3e')]['id']]['busy']=![];_0x3970e5[_0xa0ea('0x3f')][_0x264853[_0xa0ea('0x3e')]['id']][_0xa0ea('0x41')]=undefined;}return _0x2703ad({'code':0xc8,'message':_0x264853});}catch(_0x46900b){logger[_0xa0ea('0x37')](_0x46900b['stack']);return _0x18c602(_0x4afa03[_0xa0ea('0x37')](0x1f4,_0x46900b));}}logger['error']('message\x20is\x20empty');return _0x18c602(_0x4afa03[_0xa0ea('0x37')](0x1f4,_0xa0ea('0x48')));});},'AbandonInteraction':function(_0x6059b4){var _0x4c8aa7=this;return new Promise(function(_0x384a41,_0x1940ee){if(_0x6059b4[_0xa0ea('0x13')]&&_0x6059b4[_0xa0ea('0x15')]&&_0x6059b4[_0xa0ea('0x15')]['id']){try{var _0xf4bf41=getId(_0x6059b4[_0xa0ea('0x13')],_0x6059b4[_0xa0ea('0x14')]?_0x6059b4['message']['id']:0x0,_0x6059b4[_0xa0ea('0x15')]?_0x6059b4[_0xa0ea('0x15')]['id']:0x0);if(_0x3970e5[_0xa0ea('0x12')][_0xf4bf41]){_0x3970e5['rules'][_0xf4bf41][_0xa0ea('0x42')]('end');}return _0x384a41({'code':0xc8,'message':_0x6059b4});}catch(_0x16026b){logger[_0xa0ea('0x37')](_0x16026b[_0xa0ea('0x3c')]);return _0x1940ee(_0x4c8aa7[_0xa0ea('0x37')](0x1f4,_0x16026b));}}logger[_0xa0ea('0x37')]('message\x20is\x20empty');return _0x1940ee(_0x4c8aa7[_0xa0ea('0x37')](0x1f4,_0xa0ea('0x48')));});},'AgentCapacity':function(_0x41465){var _0xc9d110=this;return new Promise(function(_0x654f28,_0x422b93){if(_0x3970e5['agents'][_0xa0ea('0x49')](_0x41465['id'])){for(var _0x1ea4c7 in _0x41465[_0xa0ea('0x4a')]){if(_0x41465['capacity'][_0xa0ea('0x49')](_0x1ea4c7)){if(_0x3970e5[_0xa0ea('0x3f')][_0x41465['id']][_0xa0ea('0x49')](_0x1ea4c7+_0xa0ea('0x4b'))){_0x3970e5[_0xa0ea('0x3f')][_0x41465['id']][_0x1ea4c7+_0xa0ea('0x4b')]=parseInt(_0x41465[_0xa0ea('0x4a')][_0x1ea4c7],0xa);}}}_0x3970e5[_0xa0ea('0x3f')][_0x41465['id']]['updateRealtime']();return _0x654f28({'code':0xc8,'message':_0x3970e5['agents'][_0x41465['id']]});}else{return _0x422b93(_0xc9d110['error'](0x1f4,_0xa0ea('0x4c')));}});},'Agents':function(_0x5959ba){return new Promise(function(_0xc80b26,_0x126a50){var _0x34c585=_[_0xa0ea('0x4d')](_0x3970e5[_0xa0ea('0x3f')]);_0xc80b26({'count':_0x34c585['length'],'rows':_0x34c585});});},'ChatQueues':function(_0x2fd506){return new Promise(function(_0x2220a0,_0x377641){var _0x1f792a=[];for(var _0x532a29 in _0x3970e5[_0xa0ea('0x4e')]){if(_0x3970e5[_0xa0ea('0x4e')]['hasOwnProperty'](_0x532a29)){var _0x145630=_0x3970e5['chatQueues'][_0x532a29];var _0x5f2444={'id':_0x145630['id'],'available':_0x145630[_0xa0ea('0x4f')],'loggedIn':_0x145630['loggedIn'],'name':_0x145630[_0xa0ea('0x50')],'paused':_0x145630[_0xa0ea('0x51')],'waiting':_0x145630['waiting']};_0x1f792a[_0xa0ea('0x21')](_0x5f2444);}}_0x2220a0({'count':_0x1f792a[_0xa0ea('0x18')],'rows':_0x1f792a});});},'MailQueues':function(_0x27ceab){return new Promise(function(_0x25a176,_0x4ca3fd){var _0x750026=[];for(var _0x5819e6 in _0x3970e5[_0xa0ea('0x52')]){if(_0x3970e5[_0xa0ea('0x52')][_0xa0ea('0x49')](_0x5819e6)){var _0x1c880f=_0x3970e5[_0xa0ea('0x52')][_0x5819e6];var _0x27476d={'id':_0x1c880f['id'],'available':_0x1c880f['available'],'loggedIn':_0x1c880f['loggedIn'],'name':_0x1c880f[_0xa0ea('0x50')],'paused':_0x1c880f['paused'],'waiting':_0x1c880f[_0xa0ea('0x53')]};_0x750026[_0xa0ea('0x21')](_0x27476d);}}_0x25a176({'count':_0x750026[_0xa0ea('0x18')],'rows':_0x750026});});},'OpenchannelQueues':function(_0x4660a9){return new Promise(function(_0x4fd7ab,_0x408f7e){var _0x3ac7d7=[];for(var _0x1c1ec5 in _0x3970e5[_0xa0ea('0x54')]){if(_0x3970e5['openchannelQueues'][_0xa0ea('0x49')](_0x1c1ec5)){var _0x181c3e=_0x3970e5[_0xa0ea('0x54')][_0x1c1ec5];var _0x43df39={'id':_0x181c3e['id'],'available':_0x181c3e[_0xa0ea('0x4f')],'loggedIn':_0x181c3e[_0xa0ea('0x55')],'name':_0x181c3e[_0xa0ea('0x50')],'paused':_0x181c3e[_0xa0ea('0x51')],'waiting':_0x181c3e['waiting']};_0x3ac7d7[_0xa0ea('0x21')](_0x43df39);}}_0x4fd7ab({'count':_0x3ac7d7[_0xa0ea('0x18')],'rows':_0x3ac7d7});});},'SmsQueues':function(_0x3cf1c3){return new Promise(function(_0x1093e0,_0x1a4881){var _0x1c7253=[];for(var _0x3052cd in _0x3970e5[_0xa0ea('0x56')]){if(_0x3970e5[_0xa0ea('0x56')][_0xa0ea('0x49')](_0x3052cd)){var _0x3d7ae3=_0x3970e5[_0xa0ea('0x56')][_0x3052cd];var _0x43cd1a={'id':_0x3d7ae3['id'],'available':_0x3d7ae3[_0xa0ea('0x4f')],'loggedIn':_0x3d7ae3[_0xa0ea('0x55')],'name':_0x3d7ae3['name'],'paused':_0x3d7ae3[_0xa0ea('0x51')],'waiting':_0x3d7ae3[_0xa0ea('0x53')]};_0x1c7253[_0xa0ea('0x21')](_0x43cd1a);}}_0x1093e0({'count':_0x1c7253['length'],'rows':_0x1c7253});});},'FaxQueues':function(_0x24ed85){return new Promise(function(_0x2156f1,_0x489bbd){var _0x5b062a=[];for(var _0x3b9c51 in _0x3970e5[_0xa0ea('0x57')]){if(_0x3970e5[_0xa0ea('0x57')][_0xa0ea('0x49')](_0x3b9c51)){var _0x490ea9=_0x3970e5[_0xa0ea('0x57')][_0x3b9c51];var _0x35ea26={'id':_0x490ea9['id'],'available':_0x490ea9[_0xa0ea('0x4f')],'loggedIn':_0x490ea9['loggedIn'],'name':_0x490ea9['name'],'paused':_0x490ea9['paused'],'waiting':_0x490ea9['waiting']};_0x5b062a[_0xa0ea('0x21')](_0x35ea26);}}_0x2156f1({'count':_0x5b062a[_0xa0ea('0x18')],'rows':_0x5b062a});});},'WhatsappQueues':function(_0x20dc5c){return new Promise(function(_0xb2ff77,_0x366e61){var _0x7c301=[];for(var _0x2e5f9a in _0x3970e5['whatsappQueues']){if(_0x3970e5[_0xa0ea('0x58')][_0xa0ea('0x49')](_0x2e5f9a)){var _0x5df3dc=_0x3970e5[_0xa0ea('0x58')][_0x2e5f9a];var _0x359170={'id':_0x5df3dc['id'],'available':_0x5df3dc[_0xa0ea('0x4f')],'loggedIn':_0x5df3dc['loggedIn'],'name':_0x5df3dc[_0xa0ea('0x50')],'paused':_0x5df3dc['paused'],'waiting':_0x5df3dc[_0xa0ea('0x53')]};_0x7c301[_0xa0ea('0x21')](_0x359170);}}_0xb2ff77({'count':_0x7c301[_0xa0ea('0x18')],'rows':_0x7c301});});},'ChatQueuesWaitingInteractions':function(_0x480a62){return new Promise(function(_0x48c8e8,_0x3f986f){var _0x49eac2=_[_0xa0ea('0x4d')](_0x3970e5[_0xa0ea('0x59')]);_0x48c8e8({'count':_0x49eac2['length'],'rows':_0x49eac2});});},'MailQueuesWaitingInteractions':function(_0x2fed4d){return new Promise(function(_0x4f7f7c,_0x9076ac){var _0x5bfd3d=_[_0xa0ea('0x4d')](_0x3970e5[_0xa0ea('0x5a')]);_0x4f7f7c({'count':_0x5bfd3d[_0xa0ea('0x18')],'rows':_0x5bfd3d});});},'OpenchannelQueuesWaitingInteractions':function(_0x4f4418){return new Promise(function(_0x4b91f9,_0x28b7b8){var _0x194ab9=_[_0xa0ea('0x4d')](_0x3970e5[_0xa0ea('0x5b')]);_0x4b91f9({'count':_0x194ab9[_0xa0ea('0x18')],'rows':_0x194ab9});});},'SmsQueuesWaitingInteractions':function(_0x22756c){return new Promise(function(_0x9bd54f,_0xefff94){var _0x30f0b2=_[_0xa0ea('0x4d')](_0x3970e5['smsQueuesWaitingInteractions']);_0x9bd54f({'count':_0x30f0b2[_0xa0ea('0x18')],'rows':_0x30f0b2});});},'FaxQueuesWaitingInteractions':function(_0x40e715){return new Promise(function(_0xd169f9,_0x57336a){var _0x883b31=_['values'](_0x3970e5['faxQueuesWaitingInteractions']);_0xd169f9({'count':_0x883b31[_0xa0ea('0x18')],'rows':_0x883b31});});},'WhatsappQueuesWaitingInteractions':function(_0x3e7944){return new Promise(function(_0x420f45,_0xeefe29){var _0x4a6d66=_[_0xa0ea('0x4d')](_0x3970e5[_0xa0ea('0x5c')]);_0x420f45({'count':_0x4a6d66[_0xa0ea('0x18')],'rows':_0x4a6d66});});}};var _0x27f033=jayson[_0xa0ea('0x5d')](_0x4d7f34)[_0xa0ea('0x5e')]();_0x27f033['on'](_0xa0ea('0x37'),function(_0x4c0203){logger['error'](JSON['stringify'](_0x4c0203));return _0x264561(_0x4c0203);});_0x27f033[_0xa0ea('0x5f')](0x232c,'127.0.0.1',function(){console[_0xa0ea('0x60')](_0xa0ea('0x61'),0x232c);return _0xff3cf(_0xa0ea('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index e164d8e..a8435f8 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 _0x77b0=['result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message'];(function(_0x4808d3,_0x3353c6){var _0x3057fa=function(_0x535a58){while(--_0x535a58){_0x4808d3['push'](_0x4808d3['shift']());}};_0x3057fa(++_0x3353c6);}(_0x77b0,0x195));var _0x077b=function(_0x5dc5b0,_0x2654fa){_0x5dc5b0=_0x5dc5b0-0x0;var _0x3cb5e7=_0x77b0[_0x5dc5b0];return _0x3cb5e7;};'use strict';var util=require(_0x077b('0x0'));var BPromise=require('bluebird');var jayson=require(_0x077b('0x1'));var _=require(_0x077b('0x2'));var logger=require(_0x077b('0x3'))(_0x077b('0x4'));var client=jayson[_0x077b('0x5')][_0x077b('0x6')]({'port':0x232a});function request(_0x28a1be,_0x1a26d3){return new BPromise(function(_0x2b5202,_0x53ba90){return client[_0x077b('0x7')](_0x28a1be,_0x1a26d3)[_0x077b('0x8')](function(_0x34c91c){if(_0x34c91c[_0x077b('0x9')]){return _0x53ba90(_0x34c91c[_0x077b('0x9')][_0x077b('0xa')]);}else{return _0x2b5202(_0x34c91c[_0x077b('0xb')]);}})[_0x077b('0xc')](function(_0x7458e8){return _0x53ba90(_0x7458e8);});});}exports['condition']=function(_0x30b58e,_0x53dd2b,_0x42c5d4){return function(_0x3b32c8){if(_0x42c5d4[_0x077b('0xd')]&&!_0x42c5d4[_0x077b('0xd')][_0x30b58e]){logger[_0x077b('0xe')](_0x077b('0xf'),_0x30b58e);return _0x3b32c8[_0x077b('0x10')]();}var _0x423f3b=[];for(var _0x3402de=0x0;_0x3402de<_0x53dd2b[_0x077b('0x11')];_0x3402de+=0x1){_0x423f3b[_0x077b('0x12')](request(_0x077b('0x13'),{'command':util[_0x077b('0x14')](_0x077b('0x15'),_0x53dd2b[_0x3402de])})['then'](function(_0x300f56){return _0x300f56&&_0x300f56[_0x077b('0xa')]&&_0x300f56['message'][_0x077b('0x16')](_0x077b('0x17'))>=0x0?!![]:![];})['catch'](function(_0x4541c9){logger[_0x077b('0x9')](_0x077b('0x18'),_0x30b58e,_0x53dd2b[_0x3402de]);}));}BPromise['all'](_0x423f3b)[_0x077b('0x8')](function(_0x55d989){var _0x5e967e=_[_0x077b('0x19')](_0x55d989);logger[_0x077b('0xe')](_0x077b('0x1a'),_0x30b58e,_0x53dd2b[_0x077b('0x1b')](_0x077b('0x1c')),_0x5e967e);_0x3b32c8[_0x077b('0x1d')](_0x5e967e);})[_0x077b('0xc')](function(_0x48c0d7){console[_0x077b('0x1e')](_0x48c0d7);logger[_0x077b('0x9')](_0x077b('0x1a'),_0x30b58e,_0x53dd2b['join'](_0x077b('0x1c')),_0x48c0d7[_0x077b('0x1f')]);_0x3b32c8[_0x077b('0x10')]();});};}; \ No newline at end of file +var _0x37b6=['iftime\x20%s','message','indexOf','true','catch','error','[%s][INTERVAL]\x20%s','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','../../../config/logger','client','http','then','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format'];(function(_0xf5688d,_0xff6410){var _0x535b2a=function(_0x1c8983){while(--_0x1c8983){_0xf5688d['push'](_0xf5688d['shift']());}};_0x535b2a(++_0xff6410);}(_0x37b6,0x186));var _0x637b=function(_0x2d3e8b,_0x85d0d9){_0x2d3e8b=_0x2d3e8b-0x0;var _0x32cbd6=_0x37b6[_0x2d3e8b];return _0x32cbd6;};'use strict';var util=require(_0x637b('0x0'));var BPromise=require(_0x637b('0x1'));var jayson=require(_0x637b('0x2'));var _=require('lodash');var logger=require(_0x637b('0x3'))('routing');var client=jayson[_0x637b('0x4')][_0x637b('0x5')]({'port':0x232a});function request(_0x33ebd5,_0x4ab7c2){return new BPromise(function(_0x550029,_0x321c2a){return client['request'](_0x33ebd5,_0x4ab7c2)[_0x637b('0x6')](function(_0x42d932){if(_0x42d932['error']){return _0x321c2a(_0x42d932['error']['message']);}else{return _0x550029(_0x42d932['result']);}})['catch'](function(_0x30fd5d){return _0x321c2a(_0x30fd5d);});});}exports[_0x637b('0x7')]=function(_0x40ce79,_0x17ac38,_0xc076e9){return function(_0x20728f){if(_0xc076e9[_0x637b('0x8')]&&!_0xc076e9[_0x637b('0x8')][_0x40ce79]){logger[_0x637b('0x9')](_0x637b('0xa'),_0x40ce79);return _0x20728f[_0x637b('0xb')]();}var _0x35067c=[];for(var _0x1259cb=0x0;_0x1259cb<_0x17ac38[_0x637b('0xc')];_0x1259cb+=0x1){_0x35067c[_0x637b('0xd')](request(_0x637b('0xe'),{'command':util[_0x637b('0xf')](_0x637b('0x10'),_0x17ac38[_0x1259cb])})[_0x637b('0x6')](function(_0x1de3e8){return _0x1de3e8&&_0x1de3e8[_0x637b('0x11')]&&_0x1de3e8[_0x637b('0x11')][_0x637b('0x12')](_0x637b('0x13'))>=0x0?!![]:![];})[_0x637b('0x14')](function(_0x300615){logger[_0x637b('0x15')](_0x637b('0x16'),_0x40ce79,_0x17ac38[_0x1259cb]);}));}BPromise['all'](_0x35067c)[_0x637b('0x6')](function(_0x1cf6ea){var _0x1c2bf3=_[_0x637b('0x17')](_0x1cf6ea);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x40ce79,_0x17ac38[_0x637b('0x18')](_0x637b('0x19')),_0x1c2bf3);_0x20728f[_0x637b('0x1a')](_0x1c2bf3);})[_0x637b('0x14')](function(_0x488b7c){console['log'](_0x488b7c);logger[_0x637b('0x15')](_0x637b('0x1b'),_0x40ce79,_0x17ac38['join'](_0x637b('0x19')),_0x488b7c[_0x637b('0x1c')]);_0x20728f[_0x637b('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 041651a..f6c1cfb 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 _0xb7e7=['answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','./utils','format','uniqueid','channel','queue','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','holdtime','ringtime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere'];(function(_0x473dfb,_0x39cc88){var _0x1ddce0=function(_0x500011){while(--_0x500011){_0x473dfb['push'](_0x473dfb['shift']());}};_0x1ddce0(++_0x39cc88);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb7e7[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var utils=require(_0x7b7e('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x518dc6,_0x1b7cc7){utils['info'](util[_0x7b7e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x518dc6[_0x7b7e('0x3')],_0x518dc6[_0x7b7e('0x4')],_0x518dc6[_0x7b7e('0x5')],_0x518dc6['membername'],_0x518dc6['interface'],_0x518dc6[_0x7b7e('0x6')],_0x518dc6[_0x7b7e('0x7')],_0x518dc6[_0x7b7e('0x8')]));if(_0x518dc6['queue']){utils[_0x7b7e('0x9')](_0x518dc6[_0x7b7e('0x5')])[_0x7b7e('0xa')](function(_0x1647e5){if(_0x1647e5){_0x518dc6[_0x7b7e('0xb')]=_0x1647e5[_0x7b7e('0xb')];_0x518dc6[_0x7b7e('0xc')]=_0x518dc6['agentcomplete']?_0x1647e5[_0x7b7e('0xd')]:![];_0x518dc6[_0x7b7e('0xe')]=_0x518dc6[_0x7b7e('0xc')]?_0x1647e5[_0x7b7e('0xf')]:0x0;}utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);});}else{utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);}if(_0x1b7cc7){delete transfers[_0x518dc6[_0x7b7e('0x3')]];}else{delete agents[_0x518dc6['destuniqueid']];}}exports[_0x7b7e('0x12')]=function(_0x430eab){try{utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][agentcalled]',_0x430eab['uniqueid']),_0x430eab);agents[_0x430eab[_0x7b7e('0x13')]]=_0x430eab;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();agents[_0x430eab[_0x7b7e('0x13')]]['lastevent']='called';agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x7')]=null;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x16')]=null;utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x18'),_0x430eab[_0x7b7e('0x3')],agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x430eab[_0x7b7e('0x13')]));}catch(_0x14f4fe){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x1b'),_0x430eab[_0x7b7e('0x3')]),_0x14f4fe);}};exports[_0x7b7e('0x1c')]=function(_0x49eddb){try{if(!_[_0x7b7e('0x1d')](agents[_0x49eddb[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util['format'](_0x7b7e('0x1f'),_0x49eddb[_0x7b7e('0x3')]),_0x49eddb);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x20'),_0x49eddb[_0x7b7e('0x3')],agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x49eddb['destuniqueid']));agents[_0x49eddb['destuniqueid']]['agentringnoanswer']=!![];agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();agents[_0x49eddb['destuniqueid']]['lastevent']='timeout';agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x7b7e('0x23');agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x49eddb['ringtime']?parseInt(_0x49eddb[_0x7b7e('0x25')])/0x3e8:0x0;agents[_0x49eddb[_0x7b7e('0x13')]]['talktime']=0x0;unanswered['push'](_0x49eddb['destuniqueid']);}}catch(_0x12ef0b){utils[_0x7b7e('0x1a')](util['format'](_0x7b7e('0x1f'),_0x49eddb['uniqueid']),_0x12ef0b);}};exports[_0x7b7e('0x26')]=function(_0xb9b6bf){try{_[_0x7b7e('0x27')](agents,function(_0x5515ca,_0x3960b8){if(_0x5515ca[_0x7b7e('0x3')]==_0xb9b6bf[_0x7b7e('0x3')]&&!_[_0x7b7e('0x28')](unanswered,_0x5515ca[_0x7b7e('0x13')])){utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][queuecallerabandon]',_0xb9b6bf[_0x7b7e('0x3')]),_0xb9b6bf);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x29'),_0xb9b6bf[_0x7b7e('0x3')],_0x5515ca[_0x7b7e('0x19')],_0x5515ca[_0x7b7e('0x13')]));_0x5515ca['agentringnoanswer']=!![];_0x5515ca['agentringnoanswerAt']=utils[_0x7b7e('0x15')]();_0x5515ca[_0x7b7e('0x8')]='abandoned';_0x5515ca[_0x7b7e('0x22')]=_0x7b7e('0x2a');_0x5515ca[_0x7b7e('0x24')]=_0xb9b6bf['holdtime'];_0x5515ca[_0x7b7e('0x2b')]=0x0;writeDB(_0x5515ca);}});}catch(_0x256908){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x2c'),_0xb9b6bf[_0x7b7e('0x3')]),_0x256908);}};exports[_0x7b7e('0x2d')]=function(_0x202f04){try{if(agents[_0x202f04[_0x7b7e('0x13')]]){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x2e'),_0x202f04[_0x7b7e('0x3')]),_0x202f04);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x2f'),_0x202f04['uniqueid'],agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x202f04[_0x7b7e('0x13')]));agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x7')]=_0x202f04[_0x7b7e('0x7')];agents[_0x202f04[_0x7b7e('0x13')]]['connectedlinename']=_0x202f04[_0x7b7e('0x16')];agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];agents[_0x202f04['destuniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x31');_[_0x7b7e('0x27')](agents,function(_0x5c58c0,_0x4a2888){if(_0x5c58c0[_0x7b7e('0x13')]!=_0x202f04['destuniqueid']&&_0x5c58c0[_0x7b7e('0x3')]==_0x202f04[_0x7b7e('0x3')]){_0x5c58c0['talktime']=0x0;_0x5c58c0[_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];_0x5c58c0[_0x7b7e('0x1c')]=!![];_0x5c58c0[_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();_0x5c58c0[_0x7b7e('0x8')]=_0x7b7e('0x32');_0x5c58c0[_0x7b7e('0x22')]=_0x7b7e('0x32');_0x5c58c0['answeredelsewheredestinationuniqueid']=_0x202f04['destuniqueid'];_0x5c58c0[_0x7b7e('0x33')]=_0x202f04['membername'];writeDB(_0x5c58c0);}});}}catch(_0x41c8a6){utils['error'](util['format'](_0x7b7e('0x2e'),_0x202f04['uniqueid']),_0x41c8a6);}};exports[_0x7b7e('0x34')]=function(_0x52051c){try{if(!_[_0x7b7e('0x1d')](agents[_0x52051c[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')]('[%s][agents][agentcomplete]',_0x52051c[_0x7b7e('0x3')]),_0x52051c);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x35'),_0x52051c[_0x7b7e('0x3')],agents[_0x52051c[_0x7b7e('0x13')]]['membername'],_0x52051c['destuniqueid']));agents[_0x52051c['destuniqueid']][_0x7b7e('0x34')]=!![];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x2b')]=utils['diffTime'](agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')],agents[_0x52051c['destuniqueid']]['agentconnectAt']);agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x52051c[_0x7b7e('0x22')];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x8')]=_0x7b7e('0x37');writeDB(agents[_0x52051c['destuniqueid']]);}}catch(_0x2673eb){utils['error'](util[_0x7b7e('0x2')](_0x7b7e('0x38'),_0x52051c[_0x7b7e('0x3')]),_0x2673eb);}};exports[_0x7b7e('0x39')]=function(_0x58e4e6){try{if(!_[_0x7b7e('0x1d')](agents[_0x58e4e6[_0x7b7e('0x3a')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6['uniqueid']),_0x58e4e6);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x3c'),_0x58e4e6[_0x7b7e('0x3')],agents[_0x58e4e6[_0x7b7e('0x3a')]]['membername'],agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3')]));agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3d')]=!![];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3e')]=_0x7b7e('0x3f');agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x40')]=_0x58e4e6['extension'];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x41')]=agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x3')];}}catch(_0x44e3a0){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6[_0x7b7e('0x3')]),_0x44e3a0);}};exports[_0x7b7e('0x42')]=function(_0x5f15ce){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x5f15ce);if(_0x5f15ce['origtransfereruniqueid']==_0x5f15ce['origtransfererlinkedid']){if(!_['isNil'](agents[_0x5f15ce[_0x7b7e('0x45')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5f15ce['origtransfereruniqueid'],agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x19')]));agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x40')]=_0x5f15ce['origtransfererexten'];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x41')]=_0x5f15ce[_0x7b7e('0x44')];}if(_0x5f15ce[_0x7b7e('0x46')]&&agents[_0x5f15ce[_0x7b7e('0x46')]]){agents[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x46')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfereeuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x6')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x49')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x2;}}else if(_0x5f15ce[_0x7b7e('0x45')]==_0x5f15ce['secondtransfererlinkedid']){if(!_[_0x7b7e('0x1d')](agents[_0x5f15ce[_0x7b7e('0x44')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x4a'),_0x5f15ce[_0x7b7e('0x44')],agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x19')]));agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x40')]=_0x5f15ce[_0x7b7e('0x4b')];agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x41')]=_0x5f15ce['secondtransfereruniqueid'];}if(_0x5f15ce[_0x7b7e('0x4c')]&&agents[_0x5f15ce[_0x7b7e('0x4c')]]){agents[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x4c')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfertargetuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x4c')]]['calleridnum']=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce['transfertargetuniqueid']][_0x7b7e('0x49')]=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentcalledAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentconnectAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x2;}}}catch(_0x2147d9){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x2147d9);}};exports['hangup']=function(_0x59ecf9){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9[_0x7b7e('0x3')]),_0x59ecf9);if(agents[_0x59ecf9[_0x7b7e('0x3')]]&&agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]==='timeout'){if(_0x59ecf9[_0x7b7e('0x4e')]==='21'){agents[_0x59ecf9[_0x7b7e('0x3')]]['reason']=_0x7b7e('0x4f');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x4f');}utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]]['reason'],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);var _0x122053=unanswered[_0x7b7e('0x51')](_0x59ecf9[_0x7b7e('0x3')]);if(_0x122053>-0x1){unanswered[_0x7b7e('0x52')](_0x122053,0x1);}}if(transfers[_0x59ecf9['uniqueid']]){transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x34')]=!![];transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt']=utils[_0x7b7e('0x15')]();transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt'],transfers[_0x59ecf9['uniqueid']]['agentconnectAt']);transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=_0x7b7e('0x54');transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x22')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(transfers[_0x59ecf9[_0x7b7e('0x3')]],!![]);}if(agents[_0x59ecf9['uniqueid']]&&agents[_0x59ecf9['uniqueid']][_0x7b7e('0x30')]){agents[_0x59ecf9['uniqueid']][_0x7b7e('0x34')]=!![];agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x59ecf9['uniqueid']][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x30')]);agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x3d')]?_0x7b7e('0x3d'):_0x7b7e('0x54');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')],agents[_0x59ecf9[_0x7b7e('0x3')]]['lastevent']));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);}}catch(_0x3880be){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9['uniqueid']),_0x3880be);}}; \ No newline at end of file +var _0x34b7=['acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererexten','transfertargetuniqueid','clone','calleridname','[%s][agents][hangup]','cause','rejected','indexOf','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw'];(function(_0x3a3241,_0x1304fa){var _0x344ade=function(_0x31782a){while(--_0x31782a){_0x3a3241['push'](_0x3a3241['shift']());}};_0x344ade(++_0x1304fa);}(_0x34b7,0x196));var _0x734b=function(_0x396dc6,_0x529342){_0x396dc6=_0x396dc6-0x0;var _0x285078=_0x34b7[_0x396dc6];return _0x285078;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x734b('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1aedd0,_0x6e4318){utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x3'),_0x1aedd0['uniqueid'],_0x1aedd0['channel'],_0x1aedd0[_0x734b('0x4')],_0x1aedd0[_0x734b('0x5')],_0x1aedd0[_0x734b('0x6')],_0x1aedd0[_0x734b('0x7')],_0x1aedd0[_0x734b('0x8')],_0x1aedd0[_0x734b('0x9')]));if(_0x1aedd0['queue']){utils[_0x734b('0xa')](_0x1aedd0[_0x734b('0x4')])['then'](function(_0x53f163){if(_0x53f163){_0x1aedd0['type']=_0x53f163[_0x734b('0xb')];_0x1aedd0['agentacw']=_0x1aedd0[_0x734b('0xc')]?_0x53f163[_0x734b('0xd')]:![];_0x1aedd0[_0x734b('0xe')]=_0x1aedd0[_0x734b('0xf')]?_0x53f163[_0x734b('0x10')]:0x0;}utils[_0x734b('0x11')](_0x734b('0x12'),_0x1aedd0);});}else{utils[_0x734b('0x11')](_0x734b('0x12'),_0x1aedd0);}if(_0x6e4318){delete transfers[_0x1aedd0[_0x734b('0x13')]];}else{delete agents[_0x1aedd0[_0x734b('0x14')]];}}exports[_0x734b('0x15')]=function(_0x145ec3){try{utils[_0x734b('0x16')](util['format'](_0x734b('0x17'),_0x145ec3[_0x734b('0x13')]),_0x145ec3);agents[_0x145ec3[_0x734b('0x14')]]=_0x145ec3;agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x9')]=_0x734b('0x1a');agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x8')]=null;agents[_0x145ec3['destuniqueid']][_0x734b('0x1b')]=null;utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x1c'),_0x145ec3['uniqueid'],agents[_0x145ec3['destuniqueid']][_0x734b('0x5')],_0x145ec3[_0x734b('0x14')]));}catch(_0x1e6ed9){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x17'),_0x145ec3[_0x734b('0x13')]),_0x1e6ed9);}};exports[_0x734b('0x1e')]=function(_0x67eed){try{if(!_[_0x734b('0x1f')](agents[_0x67eed[_0x734b('0x14')]])){utils[_0x734b('0x16')](util[_0x734b('0x2')](_0x734b('0x20'),_0x67eed['uniqueid']),_0x67eed);utils[_0x734b('0x1')](util[_0x734b('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x67eed[_0x734b('0x13')],agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x5')],_0x67eed[_0x734b('0x14')]));agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x1e')]=!![];agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x21')]=utils[_0x734b('0x19')]();agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x9')]=_0x734b('0x22');agents[_0x67eed[_0x734b('0x14')]]['reason']='timeout';agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x23')]=_0x67eed['ringtime']?parseInt(_0x67eed[_0x734b('0x24')])/0x3e8:0x0;agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x25')]=0x0;unanswered[_0x734b('0x26')](_0x67eed[_0x734b('0x14')]);}}catch(_0x1b8295){utils[_0x734b('0x1d')](util['format'](_0x734b('0x20'),_0x67eed[_0x734b('0x13')]),_0x1b8295);}};exports[_0x734b('0x27')]=function(_0x241c89){try{_[_0x734b('0x28')](agents,function(_0x427c36,_0x1fed72){if(_0x427c36[_0x734b('0x13')]==_0x241c89[_0x734b('0x13')]&&!_[_0x734b('0x29')](unanswered,_0x427c36['destuniqueid'])){utils[_0x734b('0x16')](util[_0x734b('0x2')]('[%s][agents][queuecallerabandon]',_0x241c89[_0x734b('0x13')]),_0x241c89);utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x2a'),_0x241c89[_0x734b('0x13')],_0x427c36[_0x734b('0x5')],_0x427c36[_0x734b('0x14')]));_0x427c36[_0x734b('0x1e')]=!![];_0x427c36[_0x734b('0x21')]=utils[_0x734b('0x19')]();_0x427c36[_0x734b('0x9')]=_0x734b('0x2b');_0x427c36[_0x734b('0x2c')]=_0x734b('0x2b');_0x427c36[_0x734b('0x23')]=_0x241c89['holdtime'];_0x427c36[_0x734b('0x25')]=0x0;writeDB(_0x427c36);}});}catch(_0x5e2444){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x2d'),_0x241c89[_0x734b('0x13')]),_0x5e2444);}};exports[_0x734b('0x2e')]=function(_0x16ab66){try{if(agents[_0x16ab66['destuniqueid']]){utils['debug'](util[_0x734b('0x2')]('[%s][agents][agentconnect]',_0x16ab66[_0x734b('0x13')]),_0x16ab66);utils['info'](util[_0x734b('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x16ab66[_0x734b('0x13')],agents[_0x16ab66['destuniqueid']][_0x734b('0x5')],_0x16ab66[_0x734b('0x14')]));agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x2f')]=utils[_0x734b('0x19')]();agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x8')]=_0x16ab66['connectedlinenum'];agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x1b')]=_0x16ab66['connectedlinename'];agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x23')]=_0x16ab66[_0x734b('0x24')];agents[_0x16ab66[_0x734b('0x14')]]['lastevent']=_0x734b('0x30');_[_0x734b('0x28')](agents,function(_0x4efb1f,_0x40674c){if(_0x4efb1f[_0x734b('0x14')]!=_0x16ab66['destuniqueid']&&_0x4efb1f[_0x734b('0x13')]==_0x16ab66[_0x734b('0x13')]){_0x4efb1f[_0x734b('0x25')]=0x0;_0x4efb1f[_0x734b('0x23')]=_0x16ab66['ringtime'];_0x4efb1f['agentringnoanswer']=!![];_0x4efb1f[_0x734b('0x21')]=utils['now']();_0x4efb1f['lastevent']=_0x734b('0x31');_0x4efb1f['reason']=_0x734b('0x31');_0x4efb1f['answeredelsewheredestinationuniqueid']=_0x16ab66[_0x734b('0x14')];_0x4efb1f[_0x734b('0x32')]=_0x16ab66[_0x734b('0x5')];writeDB(_0x4efb1f);}});}}catch(_0x4c3fdc){utils['error'](util[_0x734b('0x2')]('[%s][agents][agentconnect]',_0x16ab66['uniqueid']),_0x4c3fdc);}};exports[_0x734b('0xc')]=function(_0x159db9){try{if(!_['isNil'](agents[_0x159db9[_0x734b('0x14')]])){utils['debug'](util[_0x734b('0x2')](_0x734b('0x33'),_0x159db9[_0x734b('0x13')]),_0x159db9);utils['info'](util[_0x734b('0x2')](_0x734b('0x34'),_0x159db9[_0x734b('0x13')],agents[_0x159db9[_0x734b('0x14')]]['membername'],_0x159db9['destuniqueid']));agents[_0x159db9['destuniqueid']][_0x734b('0xc')]=!![];agents[_0x159db9['destuniqueid']]['agentcompleteAt']=utils[_0x734b('0x19')]();agents[_0x159db9['destuniqueid']][_0x734b('0x25')]=utils[_0x734b('0x35')](agents[_0x159db9[_0x734b('0x14')]][_0x734b('0x36')],agents[_0x159db9['destuniqueid']][_0x734b('0x2f')]);agents[_0x159db9['destuniqueid']][_0x734b('0x2c')]=_0x159db9[_0x734b('0x2c')];agents[_0x159db9[_0x734b('0x14')]]['lastevent']=_0x734b('0x37');writeDB(agents[_0x159db9['destuniqueid']]);}}catch(_0x357ae4){utils[_0x734b('0x1d')](util['format'](_0x734b('0x33'),_0x159db9[_0x734b('0x13')]),_0x357ae4);}};exports[_0x734b('0x38')]=function(_0x38125a){try{if(!_[_0x734b('0x1f')](agents[_0x38125a['transfereruniqueid']])){utils[_0x734b('0x16')](util['format'](_0x734b('0x39'),_0x38125a['uniqueid']),_0x38125a);utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x3a'),_0x38125a[_0x734b('0x13')],agents[_0x38125a[_0x734b('0x3b')]]['membername'],agents[_0x38125a['transfereruniqueid']]['uniqueid']));agents[_0x38125a[_0x734b('0x3b')]][_0x734b('0x3c')]=!![];agents[_0x38125a['transfereruniqueid']][_0x734b('0x3d')]=_0x734b('0x3e');agents[_0x38125a['transfereruniqueid']][_0x734b('0x3f')]=_0x38125a[_0x734b('0x40')];agents[_0x38125a[_0x734b('0x3b')]]['transferuniqueid']=agents[_0x38125a[_0x734b('0x3b')]][_0x734b('0x13')];}}catch(_0x423b22){utils[_0x734b('0x1d')](util['format'](_0x734b('0x39'),_0x38125a[_0x734b('0x13')]),_0x423b22);}};exports[_0x734b('0x41')]=function(_0x432a96){try{utils['debug'](util[_0x734b('0x2')]('[%s][agents][attendedtransfer]',_0x432a96[_0x734b('0x42')]),_0x432a96);if(_0x432a96[_0x734b('0x42')]==_0x432a96[_0x734b('0x43')]){if(!_[_0x734b('0x1f')](agents[_0x432a96['secondtransfereruniqueid']])){utils[_0x734b('0x1')](util[_0x734b('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x432a96['origtransfereruniqueid'],agents[_0x432a96[_0x734b('0x44')]]['membername']));agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x3c')]=!![];agents[_0x432a96[_0x734b('0x44')]]['transfertype']=_0x734b('0x45');agents[_0x432a96['secondtransfereruniqueid']][_0x734b('0x3f')]=_0x432a96[_0x734b('0x46')];agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x47')]=_0x432a96['origtransfereruniqueid'];}if(_0x432a96[_0x734b('0x48')]&&agents[_0x432a96['transfereeuniqueid']]){agents[_0x432a96[_0x734b('0x48')]][_0x734b('0x49')]=0x1;transfers[_0x432a96[_0x734b('0x48')]]=_['clone'](agents[_0x432a96[_0x734b('0x48')]]);transfers[_0x432a96['transfereeuniqueid']][_0x734b('0x7')]=agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x7')];transfers[_0x432a96[_0x734b('0x48')]]['calleridname']=agents[_0x432a96[_0x734b('0x44')]]['calleridname'];transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();transfers[_0x432a96['transfereeuniqueid']][_0x734b('0x2f')]=utils[_0x734b('0x19')]();transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x23')]=0x0;transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x49')]=0x2;}}else if(_0x432a96[_0x734b('0x44')]==_0x432a96['secondtransfererlinkedid']){if(!_[_0x734b('0x1f')](agents[_0x432a96[_0x734b('0x42')]])){utils[_0x734b('0x1')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x432a96[_0x734b('0x42')],agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x5')]));agents[_0x432a96[_0x734b('0x42')]]['transfer']=!![];agents[_0x432a96['origtransfereruniqueid']]['transfertype']=_0x734b('0x45');agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x3f')]=_0x432a96[_0x734b('0x4a')];agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x47')]=_0x432a96[_0x734b('0x44')];}if(_0x432a96[_0x734b('0x4b')]&&agents[_0x432a96[_0x734b('0x4b')]]){agents[_0x432a96[_0x734b('0x4b')]][_0x734b('0x49')]=0x1;transfers[_0x432a96[_0x734b('0x4b')]]=_[_0x734b('0x4c')](agents[_0x432a96[_0x734b('0x4b')]]);transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x7')]=agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x7')];transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x4d')]=agents[_0x432a96[_0x734b('0x42')]]['calleridname'];transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x2f')]=utils['now']();transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x23')]=0x0;transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x49')]=0x2;}}}catch(_0x3c7d93){utils[_0x734b('0x1d')](util['format']('[%s][agents][attendedtransfer]',_0x432a96['origtransfereruniqueid']),_0x3c7d93);}};exports['hangup']=function(_0x4d95c7){try{utils[_0x734b('0x16')](util[_0x734b('0x2')](_0x734b('0x4e'),_0x4d95c7[_0x734b('0x13')]),_0x4d95c7);if(agents[_0x4d95c7['uniqueid']]&&agents[_0x4d95c7['uniqueid']][_0x734b('0x2c')]===_0x734b('0x22')){if(_0x4d95c7[_0x734b('0x4f')]==='21'){agents[_0x4d95c7[_0x734b('0x13')]]['reason']=_0x734b('0x50');agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x50');}utils['info'](util[_0x734b('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d95c7[_0x734b('0x13')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x5')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')],agents[_0x4d95c7['uniqueid']][_0x734b('0x9')]));writeDB(agents[_0x4d95c7[_0x734b('0x13')]]);var _0x3c40b5=unanswered[_0x734b('0x51')](_0x4d95c7[_0x734b('0x13')]);if(_0x3c40b5>-0x1){unanswered['splice'](_0x3c40b5,0x1);}}if(transfers[_0x4d95c7[_0x734b('0x13')]]){transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0xc')]=!![];transfers[_0x4d95c7[_0x734b('0x13')]]['agentcompleteAt']=utils[_0x734b('0x19')]();transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x25')]=utils[_0x734b('0x35')](transfers[_0x4d95c7[_0x734b('0x13')]]['agentcompleteAt'],transfers[_0x4d95c7[_0x734b('0x13')]]['agentconnectAt']);transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')]=_0x734b('0x52');transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x37');utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d95c7[_0x734b('0x13')],transfers[_0x4d95c7['uniqueid']][_0x734b('0x5')],transfers[_0x4d95c7[_0x734b('0x13')]]['reason'],transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]));writeDB(transfers[_0x4d95c7[_0x734b('0x13')]],!![]);}if(agents[_0x4d95c7[_0x734b('0x13')]]&&agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2f')]){agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0xc')]=!![];agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x36')]=utils['now']();agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x25')]=utils[_0x734b('0x35')](agents[_0x4d95c7['uniqueid']][_0x734b('0x36')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2f')]);agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')]=agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x3c')]?_0x734b('0x3c'):'agent';agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x37');utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x53'),_0x4d95c7[_0x734b('0x13')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x5')],agents[_0x4d95c7['uniqueid']][_0x734b('0x2c')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]));writeDB(agents[_0x4d95c7['uniqueid']]);}}catch(_0x31e1ec){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x4e'),_0x4d95c7[_0x734b('0x13')]),_0x31e1ec);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 5cd260c..a5a2562 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 _0x98a7=['split','substring','lastIndexOf','includes','noop','gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','UserId','CreateVoiceCallReport','recording','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','error','newstate','debug','[%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','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr'];(function(_0x49478e,_0x777dce){var _0x4ff8a3=function(_0xeb97c3){while(--_0xeb97c3){_0x49478e['push'](_0x49478e['shift']());}};_0x4ff8a3(++_0x777dce);}(_0x98a7,0xdf));var _0x798a=function(_0xa6bdce,_0x491429){_0xa6bdce=_0xa6bdce-0x0;var _0x594480=_0x98a7[_0xa6bdce];return _0x594480;};'use strict';var _=require(_0x798a('0x0'));var util=require(_0x798a('0x1'));var utils=require(_0x798a('0x2'));var transfers=require(_0x798a('0x3'));var dispositions=[_0x798a('0x4'),_0x798a('0x5'),_0x798a('0x5'),'NO\x20ANSWER',_0x798a('0x4'),_0x798a('0x4'),_0x798a('0x6'),_0x798a('0x7'),_0x798a('0x5'),_0x798a('0x5'),_0x798a('0x5')];var channels={};function writeDB(_0x231211){var _0x23e98a;if(transfers[_0x798a('0x8')][_0x231211['uniqueid']]){_0x23e98a=_0x231211[_0x798a('0x9')];_0x231211['uniqueid']=transfers['blinds'][_0x231211[_0x798a('0x9')]][_0x798a('0xa')];}utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0xd'),_0x231211['uniqueid'],_0x231211[_0x798a('0xe')],_0x231211[_0x798a('0xf')],_0x231211['membername'],_0x231211[_0x798a('0x10')],_0x231211[_0x798a('0x11')],_0x231211[_0x798a('0x12')],_0x231211['lastevent']));if(_0x231211['accountcode']){utils[_0x798a('0x13')](_0x231211[_0x798a('0x14')])[_0x798a('0x15')](function(_0x36a05a){if(_0x36a05a){_0x231211[_0x798a('0x16')]=_0x36a05a['id'];}utils['request'](_0x798a('0x17'),_0x231211);});}else{utils['request'](_0x798a('0x17'),_0x231211);}if(channels[_0x231211[_0x798a('0x9')]]){delete channels[_0x231211[_0x798a('0x9')]];}else if(_0x23e98a&&channels[_0x23e98a]){if(!transfers[_0x798a('0x8')][_0x23e98a][_0x798a('0x18')])delete transfers['blinds'][_0x23e98a];delete channels[_0x23e98a];}}exports['newchannel']=function(_0x3427d5){try{utils['debug'](util[_0x798a('0xc')](_0x798a('0x19'),_0x3427d5['uniqueid']),_0x3427d5);if(_0x3427d5[_0x798a('0x9')]==_0x3427d5[_0x798a('0x1a')]&&_0x3427d5[_0x798a('0xe')]!=_0x798a('0x1b')){utils[_0x798a('0xb')](util[_0x798a('0xc')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3427d5['uniqueid'],_0x3427d5[_0x798a('0x1c')],_0x3427d5[_0x798a('0x1d')]));channels[_0x3427d5[_0x798a('0x9')]]={'uniqueid':_0x3427d5[_0x798a('0x9')],'accountcode':_0x3427d5[_0x798a('0x14')],'source':_0x3427d5['calleridnum'],'destination':_0x3427d5[_0x798a('0x1d')],'destinationcontext':_0x3427d5[_0x798a('0x1c')],'channel':_0x3427d5[_0x798a('0xe')],'starttime':utils[_0x798a('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x798a('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x3a9e9f){utils[_0x798a('0x1f')](util[_0x798a('0xc')]('[%s][calls][newchannel]',_0x3427d5['uniqueid']),_0x3a9e9f);}};exports[_0x798a('0x20')]=function(_0x546b4c){try{utils[_0x798a('0x21')](util[_0x798a('0xc')](_0x798a('0x22'),_0x546b4c[_0x798a('0x9')]),_0x546b4c);if(!_[_0x798a('0x23')](channels[_0x546b4c[_0x798a('0x9')]])&&_0x546b4c[_0x798a('0x24')]==0x6){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x25'),_0x546b4c['uniqueid'],_0x546b4c[_0x798a('0x1c')],_0x546b4c[_0x798a('0xe')]));if(_[_0x798a('0x23')](channels[_0x546b4c[_0x798a('0x9')]][_0x798a('0x26')])){channels[_0x546b4c[_0x798a('0x9')]][_0x798a('0x26')]=utils[_0x798a('0x1e')]();}}else if(!_[_0x798a('0x23')](channels[_0x546b4c['linkedid']])&&_0x546b4c[_0x798a('0x24')]==0x6&&_0x546b4c['context']!=_0x798a('0x27')){utils[_0x798a('0xb')](util['format'](_0x798a('0x28'),_0x546b4c[_0x798a('0x9')],_0x546b4c[_0x798a('0x1a')],_0x546b4c[_0x798a('0x1c')],_0x546b4c[_0x798a('0xe')]));channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x14')]=_0x546b4c['accountcode'];channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x29')]=_0x546b4c[_0x798a('0xe')];if(_[_0x798a('0x23')](channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x2a')])){channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x2a')]=utils[_0x798a('0x1e')]();}channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x2b')]=dispositions[_[_0x798a('0x2c')](_0x546b4c[_0x798a('0x24')])]||_0x798a('0x6');}}catch(_0x543374){utils[_0x798a('0x1f')](util[_0x798a('0xc')]('[%s][calls][newstate]',_0x546b4c[_0x798a('0x9')]),_0x543374);}};exports[_0x798a('0x2d')]=function(_0x47fdb0){try{if(!_[_0x798a('0x23')](channels[_0x47fdb0[_0x798a('0x9')]])){utils[_0x798a('0x21')](util[_0x798a('0xc')]('[%s][calls][hangup]',_0x47fdb0[_0x798a('0x9')]),_0x47fdb0);if(_[_0x798a('0x23')](channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x2e')])){channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x2e')]=_0x47fdb0[_0x798a('0x2f')]+'\x20<'+_0x47fdb0['calleridnum']+'>';}utils[_0x798a('0xb')](util['format'](_0x798a('0x30'),_0x47fdb0[_0x798a('0x9')],channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x2e')],_0x47fdb0['cause-txt']));channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x31')]=utils[_0x798a('0x1e')]();channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x32')]=utils[_0x798a('0x33')](channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x31')],channels[_0x47fdb0[_0x798a('0x9')]]['starttime']);channels[_0x47fdb0['uniqueid']]['billableseconds']=channels[_0x47fdb0[_0x798a('0x9')]]['answertime']?utils[_0x798a('0x33')](channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x31')],channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x2a')]):0x0;writeDB(channels[_0x47fdb0['uniqueid']]);}}catch(_0x325602){utils['error'](util[_0x798a('0xc')](_0x798a('0x34'),_0x47fdb0['uniqueid']),_0x325602);}};exports[_0x798a('0x35')]=function(_0xbb494b){try{if(!_[_0x798a('0x23')](channels[_0xbb494b[_0x798a('0x36')]])){utils[_0x798a('0x21')](util[_0x798a('0xc')]('[%s][calls][attendedtransfer]',_0xbb494b[_0x798a('0x37')]),_0xbb494b);if(channels[_0xbb494b['localtwolinkedid']][_0x798a('0xe')]==_0xbb494b[_0x798a('0x38')]){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x39'),_0xbb494b[_0x798a('0x37')],_0xbb494b[_0x798a('0x36')],_0xbb494b['secondtransfererchannel']));channels[_0xbb494b[_0x798a('0x36')]][_0x798a('0x29')]=_0xbb494b['secondtransfererchannel'];channels[_0xbb494b[_0x798a('0x36')]][_0x798a('0x3a')]=_0x798a('0x3b');}else if(channels[_0xbb494b['localtwolinkedid']]['channel']=_0xbb494b['transfertargetchannel']){utils[_0x798a('0xb')](util['format'](_0x798a('0x39'),_0xbb494b[_0x798a('0x37')],_0xbb494b[_0x798a('0x36')],_0xbb494b[_0x798a('0x3c')]));channels[_0xbb494b['localtwolinkedid']][_0x798a('0x29')]=_0xbb494b[_0x798a('0x3c')];channels[_0xbb494b['localtwolinkedid']][_0x798a('0x3a')]=_0x798a('0x3b');}}}catch(_0x2e215a){utils[_0x798a('0x1f')](util['format'](_0x798a('0x3d'),_0xbb494b[_0x798a('0x37')]),_0x2e215a);}};exports['musiconholdstart']=function(_0x29ffb9){try{if(!_['isNil'](channels[_0x29ffb9[_0x798a('0x9')]])){utils[_0x798a('0x21')](util['format'](_0x798a('0x3e'),_0x29ffb9[_0x798a('0x9')]),_0x29ffb9);channels[_0x29ffb9[_0x798a('0x9')]][_0x798a('0x3f')]=utils[_0x798a('0x1e')]();utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x40'),_0x29ffb9[_0x798a('0x9')],channels[_0x29ffb9[_0x798a('0x9')]][_0x798a('0x3f')]));}}catch(_0x2a3d87){utils[_0x798a('0x1f')](util[_0x798a('0xc')](_0x798a('0x3e'),_0x29ffb9[_0x798a('0x9')]),_0x2a3d87);}};exports[_0x798a('0x41')]=function(_0x4cba9c){try{if(!_[_0x798a('0x23')](channels[_0x4cba9c[_0x798a('0x9')]])){utils['debug'](util[_0x798a('0xc')](_0x798a('0x42'),_0x4cba9c[_0x798a('0x9')]),_0x4cba9c);if(!_[_0x798a('0x23')](channels[_0x4cba9c[_0x798a('0x9')]][_0x798a('0x3f')])){channels[_0x4cba9c[_0x798a('0x9')]][_0x798a('0x43')]+=utils['diffTime'](utils[_0x798a('0x1e')](),channels[_0x4cba9c['uniqueid']][_0x798a('0x3f')]);utils[_0x798a('0xb')](util[_0x798a('0xc')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4cba9c[_0x798a('0x9')],channels[_0x4cba9c['uniqueid']][_0x798a('0x43')]));delete channels[_0x4cba9c[_0x798a('0x9')]][_0x798a('0x3f')];}}}catch(_0x244d29){utils['error'](util[_0x798a('0xc')](_0x798a('0x42'),_0x4cba9c[_0x798a('0x9')]),_0x244d29);}};exports[_0x798a('0x44')]=function(_0x171a55){try{if(!_[_0x798a('0x23')](channels[_0x171a55['uniqueid']])){utils[_0x798a('0x21')](util[_0x798a('0xc')](_0x798a('0x45'),_0x171a55['uniqueid']),_0x171a55);if(!_['isNil'](_0x171a55[_0x798a('0x46')]['xmd-originatecalleridnum'])){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x47'),_0x171a55[_0x798a('0x9')],_0x171a55[_0x798a('0x48')]));channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x49')]=_0x171a55[_0x798a('0x48')];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x4a')])){utils[_0x798a('0xb')](util[_0x798a('0xc')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x171a55[_0x798a('0x9')],_0x171a55[_0x798a('0x48')]));channels[_0x171a55['uniqueid']][_0x798a('0x4b')]=_0x171a55[_0x798a('0x48')];channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x2e')]='\x22'+_0x171a55['value']+_0x798a('0x4c')+_0x171a55['value']+'>';}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x4d')])||!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')]['xmd-callerid'])){utils['info'](util[_0x798a('0xc')](_0x798a('0x4e'),_0x171a55['uniqueid'],!_['isNil'](_0x171a55[_0x798a('0x46')][_0x798a('0x4d')])?_0x798a('0x4d'):_0x798a('0x4f'),_0x171a55['value']));channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x2e')]=_0x171a55['value'];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x50')])||!_['isNil'](_0x171a55[_0x798a('0x46')]['xmcs-queue'])){utils[_0x798a('0xb')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x171a55[_0x798a('0x9')],!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x50')])?_0x798a('0x50'):_0x798a('0x51'),_0x171a55[_0x798a('0x48')]));channels[_0x171a55['uniqueid']][_0x798a('0x52')]=_0x798a('0x53');channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x54')]=_0x171a55[_0x798a('0x48')];channels[_0x171a55['uniqueid']][_0x798a('0xf')]=!![];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x55')])){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x56'),_0x171a55[_0x798a('0x9')],_0x171a55[_0x798a('0x48')]));channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x57')]=_0x171a55[_0x798a('0x48')];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x58')])){utils[_0x798a('0xb')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x171a55['uniqueid'],_0x171a55[_0x798a('0x48')]));channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x59')]=_0x171a55['value'];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x5a')])){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x5b'),_0x171a55[_0x798a('0x9')],_0x171a55[_0x798a('0x48')]));channels[_0x171a55['uniqueid']]['routeid']=_0x171a55[_0x798a('0x48')];}if(!_['isNil'](_0x171a55['variable'][_0x798a('0x5c')])){utils[_0x798a('0xb')](util['format'](_0x798a('0x5d'),_0x171a55[_0x798a('0x9')],_0x171a55['value']));channels[_0x171a55[_0x798a('0x9')]]['sipcallid']=_0x171a55[_0x798a('0x48')];}}}catch(_0x5bfc12){utils[_0x798a('0x1f')](util[_0x798a('0xc')]('[%s][calls][varset]',_0x171a55[_0x798a('0x9')]),_0x5bfc12);}};exports[_0x798a('0x5e')]=function(_0x4b6202){try{if(!_[_0x798a('0x23')](channels[_0x4b6202[_0x798a('0x9')]])){utils['debug'](util[_0x798a('0xc')]('[%s][calls][newexten]',_0x4b6202['uniqueid']),_0x4b6202);utils[_0x798a('0xb')](util['format'](_0x798a('0x5f'),_0x4b6202[_0x798a('0x9')],_0x4b6202[_0x798a('0x60')],_0x4b6202[_0x798a('0x61')]));if(_0x4b6202[_0x798a('0x60')][_0x798a('0x62')]()=='set'&&_[_0x798a('0x63')](_0x4b6202['appdata']['toLowerCase'](),_0x798a('0x64'))){var _0x31f90f=_0x4b6202[_0x798a('0x61')][_0x798a('0x65')]('=');var _0x4f9440=_0x31f90f[0x0][_0x798a('0x66')](_0x31f90f[0x0][_0x798a('0x67')]('(')+0x1,_0x31f90f[0x0][_0x798a('0x67')](')'));var _0x40cc19=_0x31f90f[0x1];channels[_0x4b6202[_0x798a('0x9')]][_0x4f9440]=_0x40cc19;}if(!_[_0x798a('0x68')]([_0x798a('0x2d'),_0x798a('0x69'),'execif','set',_0x798a('0x6a')],_0x4b6202[_0x798a('0x60')]['toLowerCase']())){channels[_0x4b6202[_0x798a('0x9')]]['lastapplication']=_0x4b6202[_0x798a('0x60')];channels[_0x4b6202[_0x798a('0x9')]][_0x798a('0x54')]=_0x4b6202['appdata'];}}}catch(_0x168fbb){utils[_0x798a('0x1f')](util['format'](_0x798a('0x6b'),_0x4b6202[_0x798a('0x9')]),_0x168fbb);}}; \ No newline at end of file +var _0x15c6=['startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','membername','interface','lastevent','accountcode','UserId','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','ANSWERED','error','hangup','[%s][calls][hangup]','callerid','calleridname','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase'];(function(_0x4d2240,_0xb25126){var _0xcf51cd=function(_0x33f455){while(--_0x33f455){_0x4d2240['push'](_0x4d2240['shift']());}};_0xcf51cd(++_0xb25126);}(_0x15c6,0x1cd));var _0x615c=function(_0x718f1f,_0x2e2338){_0x718f1f=_0x718f1f-0x0;var _0x48b289=_0x15c6[_0x718f1f];return _0x48b289;};'use strict';var _=require(_0x615c('0x0'));var util=require(_0x615c('0x1'));var utils=require(_0x615c('0x2'));var transfers=require(_0x615c('0x3'));var dispositions=[_0x615c('0x4'),_0x615c('0x5'),_0x615c('0x5'),_0x615c('0x4'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED',_0x615c('0x6'),_0x615c('0x5'),_0x615c('0x5'),'FAILED'];var channels={};function writeDB(_0x69f69d){var _0x623eb8;if(transfers[_0x615c('0x7')][_0x69f69d[_0x615c('0x8')]]){_0x623eb8=_0x69f69d['uniqueid'];_0x69f69d[_0x615c('0x8')]=transfers['blinds'][_0x69f69d[_0x615c('0x8')]][_0x615c('0x9')];}utils[_0x615c('0xa')](util[_0x615c('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x69f69d['uniqueid'],_0x69f69d[_0x615c('0xc')],_0x69f69d[_0x615c('0xd')],_0x69f69d[_0x615c('0xe')],_0x69f69d[_0x615c('0xf')],_0x69f69d['calleridnum'],_0x69f69d['connectedlinenum'],_0x69f69d[_0x615c('0x10')]));if(_0x69f69d[_0x615c('0x11')]){utils['getUserByInternal'](_0x69f69d[_0x615c('0x11')])['then'](function(_0x525708){if(_0x525708){_0x69f69d[_0x615c('0x12')]=_0x525708['id'];}utils[_0x615c('0x13')](_0x615c('0x14'),_0x69f69d);});}else{utils[_0x615c('0x13')](_0x615c('0x14'),_0x69f69d);}if(channels[_0x69f69d[_0x615c('0x8')]]){delete channels[_0x69f69d['uniqueid']];}else if(_0x623eb8&&channels[_0x623eb8]){if(!transfers[_0x615c('0x7')][_0x623eb8][_0x615c('0x15')])delete transfers[_0x615c('0x7')][_0x623eb8];delete channels[_0x623eb8];}}exports['newchannel']=function(_0x3022bd){try{utils[_0x615c('0x16')](util[_0x615c('0xb')](_0x615c('0x17'),_0x3022bd[_0x615c('0x8')]),_0x3022bd);if(_0x3022bd[_0x615c('0x8')]==_0x3022bd[_0x615c('0x18')]&&_0x3022bd[_0x615c('0xc')]!='OutgoingSpoolFailed'){utils['info'](util['format'](_0x615c('0x19'),_0x3022bd[_0x615c('0x8')],_0x3022bd[_0x615c('0x1a')],_0x3022bd[_0x615c('0x1b')]));channels[_0x3022bd['uniqueid']]={'uniqueid':_0x3022bd['uniqueid'],'accountcode':_0x3022bd[_0x615c('0x11')],'source':_0x3022bd['calleridnum'],'destination':_0x3022bd[_0x615c('0x1b')],'destinationcontext':_0x3022bd['context'],'channel':_0x3022bd[_0x615c('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x615c('0x4'),'amaflags':_0x615c('0x1c')};}}catch(_0x5d148b){utils['error'](util[_0x615c('0xb')](_0x615c('0x17'),_0x3022bd[_0x615c('0x8')]),_0x5d148b);}};exports[_0x615c('0x1d')]=function(_0x3ce866){try{utils['debug'](util[_0x615c('0xb')](_0x615c('0x1e'),_0x3ce866['uniqueid']),_0x3ce866);if(!_['isNil'](channels[_0x3ce866[_0x615c('0x8')]])&&_0x3ce866[_0x615c('0x1f')]==0x6){utils[_0x615c('0xa')](util['format'](_0x615c('0x20'),_0x3ce866[_0x615c('0x8')],_0x3ce866[_0x615c('0x1a')],_0x3ce866[_0x615c('0xc')]));if(_['isNil'](channels[_0x3ce866[_0x615c('0x8')]][_0x615c('0x21')])){channels[_0x3ce866[_0x615c('0x8')]][_0x615c('0x21')]=utils[_0x615c('0x22')]();}}else if(!_[_0x615c('0x23')](channels[_0x3ce866[_0x615c('0x18')]])&&_0x3ce866[_0x615c('0x1f')]==0x6&&_0x3ce866[_0x615c('0x1a')]!=_0x615c('0x24')){utils[_0x615c('0xa')](util[_0x615c('0xb')](_0x615c('0x25'),_0x3ce866[_0x615c('0x8')],_0x3ce866['linkedid'],_0x3ce866[_0x615c('0x1a')],_0x3ce866[_0x615c('0xc')]));channels[_0x3ce866[_0x615c('0x18')]][_0x615c('0x11')]=_0x3ce866[_0x615c('0x11')];channels[_0x3ce866[_0x615c('0x18')]]['destinationchannel']=_0x3ce866[_0x615c('0xc')];if(_[_0x615c('0x23')](channels[_0x3ce866[_0x615c('0x18')]][_0x615c('0x26')])){channels[_0x3ce866[_0x615c('0x18')]]['answertime']=utils[_0x615c('0x22')]();}channels[_0x3ce866['linkedid']][_0x615c('0x27')]=dispositions[_[_0x615c('0x28')](_0x3ce866[_0x615c('0x1f')])]||_0x615c('0x29');}}catch(_0x14926e){utils[_0x615c('0x2a')](util['format'](_0x615c('0x1e'),_0x3ce866[_0x615c('0x8')]),_0x14926e);}};exports[_0x615c('0x2b')]=function(_0x1adb0f){try{if(!_[_0x615c('0x23')](channels[_0x1adb0f[_0x615c('0x8')]])){utils[_0x615c('0x16')](util['format'](_0x615c('0x2c'),_0x1adb0f[_0x615c('0x8')]),_0x1adb0f);if(_[_0x615c('0x23')](channels[_0x1adb0f[_0x615c('0x8')]]['callerid'])){channels[_0x1adb0f[_0x615c('0x8')]][_0x615c('0x2d')]=_0x1adb0f[_0x615c('0x2e')]+'\x20<'+_0x1adb0f[_0x615c('0x2f')]+'>';}utils['info'](util['format'](_0x615c('0x30'),_0x1adb0f[_0x615c('0x8')],channels[_0x1adb0f[_0x615c('0x8')]]['callerid'],_0x1adb0f[_0x615c('0x31')]));channels[_0x1adb0f[_0x615c('0x8')]][_0x615c('0x32')]=utils[_0x615c('0x22')]();channels[_0x1adb0f['uniqueid']]['duration']=utils[_0x615c('0x33')](channels[_0x1adb0f['uniqueid']][_0x615c('0x32')],channels[_0x1adb0f[_0x615c('0x8')]][_0x615c('0x34')]);channels[_0x1adb0f['uniqueid']][_0x615c('0x35')]=channels[_0x1adb0f[_0x615c('0x8')]][_0x615c('0x26')]?utils[_0x615c('0x33')](channels[_0x1adb0f[_0x615c('0x8')]]['endtime'],channels[_0x1adb0f[_0x615c('0x8')]][_0x615c('0x26')]):0x0;writeDB(channels[_0x1adb0f['uniqueid']]);}}catch(_0x4d7ad5){utils['error'](util[_0x615c('0xb')](_0x615c('0x2c'),_0x1adb0f['uniqueid']),_0x4d7ad5);}};exports['attendedtransfer']=function(_0x2470d8){try{if(!_[_0x615c('0x23')](channels[_0x2470d8[_0x615c('0x36')]])){utils[_0x615c('0x16')](util[_0x615c('0xb')](_0x615c('0x37'),_0x2470d8[_0x615c('0x38')]),_0x2470d8);if(channels[_0x2470d8[_0x615c('0x36')]][_0x615c('0xc')]==_0x2470d8[_0x615c('0x39')]){utils['info'](util[_0x615c('0xb')](_0x615c('0x3a'),_0x2470d8[_0x615c('0x38')],_0x2470d8[_0x615c('0x36')],_0x2470d8['secondtransfererchannel']));channels[_0x2470d8[_0x615c('0x36')]][_0x615c('0x3b')]=_0x2470d8[_0x615c('0x3c')];channels[_0x2470d8[_0x615c('0x36')]][_0x615c('0x3d')]=_0x615c('0x3e');}else if(channels[_0x2470d8['localtwolinkedid']][_0x615c('0xc')]=_0x2470d8['transfertargetchannel']){utils['info'](util[_0x615c('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2470d8[_0x615c('0x38')],_0x2470d8[_0x615c('0x36')],_0x2470d8[_0x615c('0x3f')]));channels[_0x2470d8[_0x615c('0x36')]][_0x615c('0x3b')]=_0x2470d8[_0x615c('0x3f')];channels[_0x2470d8[_0x615c('0x36')]]['userfield']=_0x615c('0x3e');}}}catch(_0x364264){utils['error'](util[_0x615c('0xb')](_0x615c('0x37'),_0x2470d8[_0x615c('0x38')]),_0x364264);}};exports['musiconholdstart']=function(_0x2b6c00){try{if(!_[_0x615c('0x23')](channels[_0x2b6c00[_0x615c('0x8')]])){utils['debug'](util[_0x615c('0xb')]('[%s][calls][musiconholdstart]',_0x2b6c00[_0x615c('0x8')]),_0x2b6c00);channels[_0x2b6c00[_0x615c('0x8')]][_0x615c('0x40')]=utils[_0x615c('0x22')]();utils[_0x615c('0xa')](util['format'](_0x615c('0x41'),_0x2b6c00[_0x615c('0x8')],channels[_0x2b6c00['uniqueid']][_0x615c('0x40')]));}}catch(_0x4b3c42){utils[_0x615c('0x2a')](util[_0x615c('0xb')](_0x615c('0x42'),_0x2b6c00[_0x615c('0x8')]),_0x4b3c42);}};exports[_0x615c('0x43')]=function(_0x1bee36){try{if(!_[_0x615c('0x23')](channels[_0x1bee36[_0x615c('0x8')]])){utils[_0x615c('0x16')](util['format'](_0x615c('0x44'),_0x1bee36[_0x615c('0x8')]),_0x1bee36);if(!_['isNil'](channels[_0x1bee36[_0x615c('0x8')]][_0x615c('0x40')])){channels[_0x1bee36[_0x615c('0x8')]][_0x615c('0x45')]+=utils[_0x615c('0x33')](utils['now'](),channels[_0x1bee36['uniqueid']][_0x615c('0x40')]);utils[_0x615c('0xa')](util[_0x615c('0xb')](_0x615c('0x46'),_0x1bee36[_0x615c('0x8')],channels[_0x1bee36[_0x615c('0x8')]][_0x615c('0x45')]));delete channels[_0x1bee36[_0x615c('0x8')]][_0x615c('0x40')];}}}catch(_0x4a92e1){utils['error'](util['format']('[%s][calls][musiconholdstop]',_0x1bee36[_0x615c('0x8')]),_0x4a92e1);}};exports[_0x615c('0x47')]=function(_0x42583c){try{if(!_[_0x615c('0x23')](channels[_0x42583c[_0x615c('0x8')]])){utils[_0x615c('0x16')](util[_0x615c('0xb')](_0x615c('0x48'),_0x42583c[_0x615c('0x8')]),_0x42583c);if(!_[_0x615c('0x23')](_0x42583c[_0x615c('0x49')][_0x615c('0x4a')])){utils['info'](util[_0x615c('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x42583c['uniqueid'],_0x42583c['value']));channels[_0x42583c[_0x615c('0x8')]][_0x615c('0x4b')]=_0x42583c['value'];}if(!_[_0x615c('0x23')](_0x42583c[_0x615c('0x49')][_0x615c('0x4c')])){utils['info'](util[_0x615c('0xb')](_0x615c('0x4d'),_0x42583c[_0x615c('0x8')],_0x42583c[_0x615c('0x4e')]));channels[_0x42583c[_0x615c('0x8')]][_0x615c('0x4f')]=_0x42583c[_0x615c('0x4e')];channels[_0x42583c[_0x615c('0x8')]][_0x615c('0x2d')]='\x22'+_0x42583c[_0x615c('0x4e')]+_0x615c('0x50')+_0x42583c[_0x615c('0x4e')]+'>';}if(!_[_0x615c('0x23')](_0x42583c[_0x615c('0x49')]['xmd-callerid-preview'])||!_['isNil'](_0x42583c['variable']['xmd-callerid'])){utils['info'](util['format'](_0x615c('0x51'),_0x42583c['uniqueid'],!_[_0x615c('0x23')](_0x42583c[_0x615c('0x49')]['xmd-callerid-preview'])?_0x615c('0x52'):'xmd-callerid',_0x42583c[_0x615c('0x4e')]));channels[_0x42583c[_0x615c('0x8')]][_0x615c('0x2d')]=_0x42583c[_0x615c('0x4e')];}if(!_[_0x615c('0x23')](_0x42583c['variable'][_0x615c('0x53')])||!_[_0x615c('0x23')](_0x42583c['variable']['xmcs-queue'])){utils[_0x615c('0xa')](util[_0x615c('0xb')](_0x615c('0x51'),_0x42583c[_0x615c('0x8')],!_['isNil'](_0x42583c[_0x615c('0x49')][_0x615c('0x53')])?_0x615c('0x53'):_0x615c('0x54'),_0x42583c['value']));channels[_0x42583c[_0x615c('0x8')]][_0x615c('0x55')]=_0x615c('0x56');channels[_0x42583c[_0x615c('0x8')]][_0x615c('0x57')]=_0x42583c[_0x615c('0x4e')];channels[_0x42583c['uniqueid']]['queue']=!![];}if(!_[_0x615c('0x23')](_0x42583c[_0x615c('0x49')][_0x615c('0x58')])){utils[_0x615c('0xa')](util[_0x615c('0xb')](_0x615c('0x59'),_0x42583c[_0x615c('0x8')],_0x42583c[_0x615c('0x4e')]));channels[_0x42583c['uniqueid']][_0x615c('0x5a')]=_0x42583c['value'];}if(!_[_0x615c('0x23')](_0x42583c[_0x615c('0x49')]['xmd-cdrtype'])){utils[_0x615c('0xa')](util['format'](_0x615c('0x5b'),_0x42583c['uniqueid'],_0x42583c[_0x615c('0x4e')]));channels[_0x42583c['uniqueid']][_0x615c('0x5c')]=_0x42583c[_0x615c('0x4e')];}if(!_[_0x615c('0x23')](_0x42583c[_0x615c('0x49')][_0x615c('0x5d')])){utils['info'](util['format'](_0x615c('0x5e'),_0x42583c[_0x615c('0x8')],_0x42583c[_0x615c('0x4e')]));channels[_0x42583c[_0x615c('0x8')]][_0x615c('0x5f')]=_0x42583c[_0x615c('0x4e')];}if(!_['isNil'](_0x42583c[_0x615c('0x49')][_0x615c('0x60')])){utils['info'](util['format'](_0x615c('0x61'),_0x42583c['uniqueid'],_0x42583c[_0x615c('0x4e')]));channels[_0x42583c[_0x615c('0x8')]]['sipcallid']=_0x42583c[_0x615c('0x4e')];}}}catch(_0x1393d6){utils[_0x615c('0x2a')](util[_0x615c('0xb')](_0x615c('0x48'),_0x42583c['uniqueid']),_0x1393d6);}};exports[_0x615c('0x62')]=function(_0x4d1d5f){try{if(!_['isNil'](channels[_0x4d1d5f['uniqueid']])){utils[_0x615c('0x16')](util['format'](_0x615c('0x63'),_0x4d1d5f[_0x615c('0x8')]),_0x4d1d5f);utils[_0x615c('0xa')](util['format'](_0x615c('0x64'),_0x4d1d5f[_0x615c('0x8')],_0x4d1d5f[_0x615c('0x65')],_0x4d1d5f[_0x615c('0x66')]));if(_0x4d1d5f['application'][_0x615c('0x67')]()=='set'&&_[_0x615c('0x68')](_0x4d1d5f[_0x615c('0x66')][_0x615c('0x67')](),_0x615c('0x69'))){var _0x39b369=_0x4d1d5f[_0x615c('0x66')][_0x615c('0x6a')]('=');var _0x3fb672=_0x39b369[0x0][_0x615c('0x6b')](_0x39b369[0x0][_0x615c('0x6c')]('(')+0x1,_0x39b369[0x0][_0x615c('0x6c')](')'));var _0x19b088=_0x39b369[0x1];channels[_0x4d1d5f[_0x615c('0x8')]][_0x3fb672]=_0x19b088;}if(!_[_0x615c('0x6d')](['hangup',_0x615c('0x6e'),_0x615c('0x6f'),'set',_0x615c('0x70')],_0x4d1d5f[_0x615c('0x65')][_0x615c('0x67')]())){channels[_0x4d1d5f[_0x615c('0x8')]][_0x615c('0x55')]=_0x4d1d5f[_0x615c('0x65')];channels[_0x4d1d5f[_0x615c('0x8')]]['lastdata']=_0x4d1d5f['appdata'];}}}catch(_0x272247){utils[_0x615c('0x2a')](util[_0x615c('0xb')](_0x615c('0x63'),_0x4d1d5f[_0x615c('0x8')]),_0x272247);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 1c6dc5c..5244f03 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 _0xc2f9=['[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x18b112,_0x4b3e8c){var _0x3b8831=function(_0x3765bb){while(--_0x3765bb){_0x18b112['push'](_0x18b112['shift']());}};_0x3b8831(++_0x4b3e8c);}(_0xc2f9,0x167));var _0x9c2f=function(_0x8bc89,_0x3c83bc){_0x8bc89=_0x8bc89-0x0;var _0x2c42b6=_0xc2f9[_0x8bc89];return _0x2c42b6;};'use strict';var utils=require(_0x9c2f('0x0'));exports['connect']=function(){utils['info'](_0x9c2f('0x1'));};exports[_0x9c2f('0x2')]=function(){utils[_0x9c2f('0x3')](_0x9c2f('0x4'));};exports[_0x9c2f('0x5')]=function(){utils['info'](_0x9c2f('0x6'));};exports[_0x9c2f('0x7')]=function(_0xc8c200){utils[_0x9c2f('0x7')](_0x9c2f('0x8'),_0xc8c200);};exports[_0x9c2f('0x9')]=function(){utils[_0x9c2f('0x3')](_0x9c2f('0xa'));};exports[_0x9c2f('0xb')]=function(_0x447361){}; \ No newline at end of file +var _0x310b=['./utils','info','[core]\x20connected','shutdown','[core]\x20fullybooted','error','[core]\x20error','close','managerevent'];(function(_0x1e440b,_0x127443){var _0x1d2ae7=function(_0x71b850){while(--_0x71b850){_0x1e440b['push'](_0x1e440b['shift']());}};_0x1d2ae7(++_0x127443);}(_0x310b,0x19e));var _0xb310=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x310b[_0x550d12];return _0x12103d;};'use strict';var utils=require(_0xb310('0x0'));exports['connect']=function(){utils[_0xb310('0x1')](_0xb310('0x2'));};exports[_0xb310('0x3')]=function(){utils['info']('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0xb310('0x1')](_0xb310('0x4'));};exports['error']=function(_0x4b17e8){utils[_0xb310('0x5')](_0xb310('0x6'),_0x4b17e8);};exports[_0xb310('0x7')]=function(){utils['info']('[core]\x20close');};exports[_0xb310('0x8')]=function(_0xd326c5){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 099dc0e..e28d3a6 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 _0x5f79=['dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','debug','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialend]','dialstatus','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','cause-txt','complete','duration','endtime','diffTime','billableseconds','[%s][dials][hangup]','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid'];(function(_0x1a3e2b,_0xa75584){var _0x23969f=function(_0x4c69d3){while(--_0x4c69d3){_0x1a3e2b['push'](_0x1a3e2b['shift']());}};_0x23969f(++_0xa75584);}(_0x5f79,0x14a));var _0x95f7=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x5f79[_0x154192];return _0x3c2792;};'use strict';var _=require(_0x95f7('0x0'));var util=require(_0x95f7('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x383479){utils[_0x95f7('0x2')](util[_0x95f7('0x3')](_0x95f7('0x4'),_0x383479[_0x95f7('0x5')],_0x383479['channel'],_0x383479[_0x95f7('0x6')],_0x383479[_0x95f7('0x7')],_0x383479[_0x95f7('0x8')],_0x383479['dialstatus']));utils[_0x95f7('0x9')](_0x95f7('0xa'),_0x383479);delete dials[_0x383479[_0x95f7('0x5')]];}exports[_0x95f7('0xb')]=function(_0x34b09f){try{utils['debug'](util[_0x95f7('0x3')](_0x95f7('0xc'),_0x34b09f[_0x95f7('0x5')]),_0x34b09f);utils[_0x95f7('0x2')](util['format'](_0x95f7('0xd'),_0x34b09f[_0x95f7('0x5')],_0x34b09f[_0x95f7('0xe')],_0x34b09f[_0x95f7('0xf')]));if(_0x34b09f['application'][_0x95f7('0x10')]()==_0x95f7('0x11')&&_[_0x95f7('0x12')](_0x34b09f[_0x95f7('0xf')]['toLowerCase'](),_0x95f7('0x13'))){var _0x9ea4b1=_0x34b09f[_0x95f7('0xf')][_0x95f7('0x14')]('=');dials[_0x34b09f[_0x95f7('0x5')]]={'routeId':_0x9ea4b1[0x1]};}}catch(_0x1678c9){utils[_0x95f7('0x15')](util[_0x95f7('0x3')]('[%s][dials][newexten]',_0x34b09f[_0x95f7('0x5')]),_0x1678c9);}};exports[_0x95f7('0x16')]=function(_0xae79d4){try{utils[_0x95f7('0x17')](util[_0x95f7('0x3')](_0x95f7('0x18'),_0xae79d4[_0x95f7('0x5')]),_0xae79d4);if(!_[_0x95f7('0x19')](_0xae79d4['variable'][_0x95f7('0x1a')])){utils[_0x95f7('0x2')](util[_0x95f7('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0xae79d4[_0x95f7('0x5')],_0xae79d4[_0x95f7('0x1b')]));dials[_0xae79d4[_0x95f7('0x5')]]={'routeId':_0xae79d4['value']};}}catch(_0x4aa5cf){utils[_0x95f7('0x15')](util[_0x95f7('0x3')]('[%s][dials][varset]',_0xae79d4[_0x95f7('0x5')]),_0x4aa5cf);}};exports[_0x95f7('0x1c')]=function(_0x5e24ae){try{if(!_[_0x95f7('0x19')](dials[_0x5e24ae[_0x95f7('0x5')]])){utils['debug'](util[_0x95f7('0x3')](_0x95f7('0x1d'),_0x5e24ae[_0x95f7('0x5')]),_0x5e24ae);dials[_0x5e24ae['uniqueid']]=_[_0x95f7('0x1e')](dials[_0x5e24ae[_0x95f7('0x5')]],_0x5e24ae);dials[_0x5e24ae['uniqueid']]['starttime']=utils[_0x95f7('0x1f')]();dials[_0x5e24ae[_0x95f7('0x5')]][_0x95f7('0x20')]=_0x95f7('0x21');utils['info'](util[_0x95f7('0x3')](_0x95f7('0x22'),_0x5e24ae[_0x95f7('0x5')],dials[_0x5e24ae[_0x95f7('0x5')]][_0x95f7('0x23')]));}}catch(_0x287c68){utils[_0x95f7('0x15')](util['format']('[%s][dials][dialbegin]',_0x5e24ae[_0x95f7('0x5')]),_0x287c68);}};exports['dialend']=function(_0x4785de){try{if(!_[_0x95f7('0x19')](dials[_0x4785de[_0x95f7('0x5')]])){utils[_0x95f7('0x17')](util['format'](_0x95f7('0x24'),_0x4785de['uniqueid']),_0x4785de);dials[_0x4785de['uniqueid']][_0x95f7('0x25')]=_0x4785de[_0x95f7('0x25')];if(_0x4785de[_0x95f7('0x25')]=='ANSWER'){dials[_0x4785de[_0x95f7('0x5')]]=_['assign'](dials[_0x4785de[_0x95f7('0x5')]],_0x4785de);dials[_0x4785de[_0x95f7('0x5')]]['answertime']=utils[_0x95f7('0x1f')]();dials[_0x4785de['uniqueid']][_0x95f7('0x20')]=_0x95f7('0x26');utils['info'](util[_0x95f7('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4785de['uniqueid'],_0x4785de['dialstatus'],dials[_0x4785de['uniqueid']][_0x95f7('0x27')]));}else{utils[_0x95f7('0x2')](util[_0x95f7('0x3')](_0x95f7('0x28'),_0x4785de[_0x95f7('0x5')],_0x4785de[_0x95f7('0x25')]));}}}catch(_0x53b7be){utils[_0x95f7('0x15')](util[_0x95f7('0x3')](_0x95f7('0x24'),_0x4785de[_0x95f7('0x5')]),_0x53b7be);}};exports['hangup']=function(_0x4f29b4){try{if(!_[_0x95f7('0x19')](dials[_0x4f29b4[_0x95f7('0x5')]])){utils[_0x95f7('0x17')](util['format']('[%s][dials][hangup]',_0x4f29b4[_0x95f7('0x5')]),_0x4f29b4);utils[_0x95f7('0x2')](util[_0x95f7('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4f29b4[_0x95f7('0x5')],_0x4f29b4[_0x95f7('0x7')],_0x4f29b4['calleridname'],_0x4f29b4[_0x95f7('0x29')]));dials[_0x4f29b4[_0x95f7('0x5')]]=_[_0x95f7('0x1e')](dials[_0x4f29b4[_0x95f7('0x5')]],{'endtime':utils[_0x95f7('0x1f')](),'lastevent':_0x95f7('0x2a')});dials[_0x4f29b4['uniqueid']][_0x95f7('0x2b')]=utils['diffTime'](dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x2c')],dials[_0x4f29b4['uniqueid']][_0x95f7('0x23')]);dials[_0x4f29b4['uniqueid']]['holdtime']=utils[_0x95f7('0x2d')](dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x27')]||dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x2c')],dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x23')]);dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x2e')]=dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x27')]?utils[_0x95f7('0x2d')](dials[_0x4f29b4['uniqueid']][_0x95f7('0x2c')],dials[_0x4f29b4[_0x95f7('0x5')]]['answertime']):0x0;writeDB(dials[_0x4f29b4[_0x95f7('0x5')]]);}}catch(_0x5ac860){utils[_0x95f7('0x15')](util['format'](_0x95f7('0x2f'),_0x4f29b4[_0x95f7('0x5')]),_0x5ac860);}}; \ No newline at end of file +var _0x5df0=['duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][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','calleridname','cause-txt'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x5df0,0x6b));var _0x05df=function(_0x782686,_0x71c2ba){_0x782686=_0x782686-0x0;var _0x1e409f=_0x5df0[_0x782686];return _0x1e409f;};'use strict';var _=require(_0x05df('0x0'));var util=require(_0x05df('0x1'));var utils=require(_0x05df('0x2'));var dials={};function writeDB(_0x372166){utils[_0x05df('0x3')](util['format'](_0x05df('0x4'),_0x372166['uniqueid'],_0x372166[_0x05df('0x5')],_0x372166[_0x05df('0x6')],_0x372166[_0x05df('0x7')],_0x372166[_0x05df('0x8')],_0x372166[_0x05df('0x9')]));utils[_0x05df('0xa')](_0x05df('0xb'),_0x372166);delete dials[_0x372166['uniqueid']];}exports[_0x05df('0xc')]=function(_0x58bb26){try{utils[_0x05df('0xd')](util[_0x05df('0xe')](_0x05df('0xf'),_0x58bb26[_0x05df('0x10')]),_0x58bb26);utils[_0x05df('0x3')](util[_0x05df('0xe')](_0x05df('0x11'),_0x58bb26[_0x05df('0x10')],_0x58bb26[_0x05df('0x12')],_0x58bb26['appdata']));if(_0x58bb26[_0x05df('0x12')][_0x05df('0x13')]()==_0x05df('0x14')&&_[_0x05df('0x15')](_0x58bb26['appdata'][_0x05df('0x13')](),'cdr(routeid)')){var _0x23be1a=_0x58bb26[_0x05df('0x16')][_0x05df('0x17')]('=');dials[_0x58bb26[_0x05df('0x10')]]={'routeId':_0x23be1a[0x1]};}}catch(_0x40f7cf){utils[_0x05df('0x18')](util[_0x05df('0xe')](_0x05df('0xf'),_0x58bb26['uniqueid']),_0x40f7cf);}};exports['varset']=function(_0xf32af2){try{utils[_0x05df('0xd')](util[_0x05df('0xe')](_0x05df('0x19'),_0xf32af2[_0x05df('0x10')]),_0xf32af2);if(!_[_0x05df('0x1a')](_0xf32af2[_0x05df('0x1b')][_0x05df('0x1c')])){utils[_0x05df('0x3')](util[_0x05df('0xe')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0xf32af2[_0x05df('0x10')],_0xf32af2[_0x05df('0x1d')]));dials[_0xf32af2[_0x05df('0x10')]]={'routeId':_0xf32af2['value']};}}catch(_0x486b58){utils['error'](util[_0x05df('0xe')]('[%s][dials][varset]',_0xf32af2[_0x05df('0x10')]),_0x486b58);}};exports[_0x05df('0x1e')]=function(_0x142bc8){try{if(!_[_0x05df('0x1a')](dials[_0x142bc8[_0x05df('0x10')]])){utils[_0x05df('0xd')](util[_0x05df('0xe')](_0x05df('0x1f'),_0x142bc8[_0x05df('0x10')]),_0x142bc8);dials[_0x142bc8[_0x05df('0x10')]]=_[_0x05df('0x20')](dials[_0x142bc8[_0x05df('0x10')]],_0x142bc8);dials[_0x142bc8[_0x05df('0x10')]][_0x05df('0x21')]=utils[_0x05df('0x22')]();dials[_0x142bc8[_0x05df('0x10')]]['lastevent']=_0x05df('0x23');utils[_0x05df('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x142bc8[_0x05df('0x10')],dials[_0x142bc8[_0x05df('0x10')]][_0x05df('0x21')]));}}catch(_0x5a2afb){utils[_0x05df('0x18')](util[_0x05df('0xe')](_0x05df('0x1f'),_0x142bc8[_0x05df('0x10')]),_0x5a2afb);}};exports['dialend']=function(_0x224fd0){try{if(!_[_0x05df('0x1a')](dials[_0x224fd0[_0x05df('0x10')]])){utils[_0x05df('0xd')](util['format'](_0x05df('0x24'),_0x224fd0['uniqueid']),_0x224fd0);dials[_0x224fd0['uniqueid']]['dialstatus']=_0x224fd0[_0x05df('0x9')];if(_0x224fd0[_0x05df('0x9')]==_0x05df('0x25')){dials[_0x224fd0['uniqueid']]=_[_0x05df('0x20')](dials[_0x224fd0[_0x05df('0x10')]],_0x224fd0);dials[_0x224fd0[_0x05df('0x10')]][_0x05df('0x26')]=utils[_0x05df('0x22')]();dials[_0x224fd0[_0x05df('0x10')]]['lastevent']=_0x05df('0x27');utils['info'](util[_0x05df('0xe')](_0x05df('0x28'),_0x224fd0[_0x05df('0x10')],_0x224fd0[_0x05df('0x9')],dials[_0x224fd0['uniqueid']]['answertime']));}else{utils[_0x05df('0x3')](util['format'](_0x05df('0x29'),_0x224fd0[_0x05df('0x10')],_0x224fd0[_0x05df('0x9')]));}}}catch(_0x5a3dbc){utils[_0x05df('0x18')](util[_0x05df('0xe')]('[%s][dials][dialend]',_0x224fd0[_0x05df('0x10')]),_0x5a3dbc);}};exports['hangup']=function(_0x499379){try{if(!_[_0x05df('0x1a')](dials[_0x499379[_0x05df('0x10')]])){utils[_0x05df('0xd')](util[_0x05df('0xe')](_0x05df('0x2a'),_0x499379[_0x05df('0x10')]),_0x499379);utils[_0x05df('0x3')](util[_0x05df('0xe')](_0x05df('0x2b'),_0x499379['uniqueid'],_0x499379[_0x05df('0x7')],_0x499379[_0x05df('0x2c')],_0x499379[_0x05df('0x2d')]));dials[_0x499379[_0x05df('0x10')]]=_['assign'](dials[_0x499379[_0x05df('0x10')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x499379[_0x05df('0x10')]][_0x05df('0x2e')]=utils[_0x05df('0x2f')](dials[_0x499379['uniqueid']][_0x05df('0x30')],dials[_0x499379['uniqueid']][_0x05df('0x21')]);dials[_0x499379[_0x05df('0x10')]][_0x05df('0x31')]=utils['diffTime'](dials[_0x499379[_0x05df('0x10')]][_0x05df('0x26')]||dials[_0x499379['uniqueid']]['endtime'],dials[_0x499379[_0x05df('0x10')]]['starttime']);dials[_0x499379[_0x05df('0x10')]][_0x05df('0x32')]=dials[_0x499379['uniqueid']][_0x05df('0x26')]?utils['diffTime'](dials[_0x499379[_0x05df('0x10')]][_0x05df('0x30')],dials[_0x499379['uniqueid']][_0x05df('0x26')]):0x0;writeDB(dials[_0x499379['uniqueid']]);}}catch(_0x2f65e2){utils[_0x05df('0x18')](util[_0x05df('0xe')]('[%s][dials][hangup]',_0x499379['uniqueid']),_0x2f65e2);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8525554..e45196e 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 _0x1ee5=['cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x1ee5,0x174));var _0x51ee=function(_0xb247a7,_0x22c245){_0xb247a7=_0xb247a7-0x0;var _0xedb31e=_0x1ee5[_0xb247a7];return _0xedb31e;};var AsteriskManager=require('asterisk-manager');var config=require(_0x51ee('0x0'));var utils=require(_0x51ee('0x1'));var util=require(_0x51ee('0x2'));var isXDREnabled=config[_0x51ee('0x3')]&&config[_0x51ee('0x3')]['disabled']?!config['xdr'][_0x51ee('0x4')]:!![];var isProduction=config[_0x51ee('0x5')]===_0x51ee('0x6')||![];var isLocalAsterisk=config[_0x51ee('0x3')]&&config[_0x51ee('0x3')][_0x51ee('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x51ee('0x8')][_0x51ee('0x9')],config[_0x51ee('0x8')]['ip'],config[_0x51ee('0x8')][_0x51ee('0xa')],config[_0x51ee('0x8')][_0x51ee('0xb')],!![]);ami[_0x51ee('0xc')]();if(!isXDREnabled){utils[_0x51ee('0xd')](_0x51ee('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x51ee('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x51ee('0xf'));var calls=require(_0x51ee('0x10'));var queues=require(_0x51ee('0x11'));var recordings=require(_0x51ee('0x12'));var members=require(_0x51ee('0x13'));var dials=require(_0x51ee('0x14'));var transfers=require('./transfers.controller');var core=require(_0x51ee('0x15'));ami['on']('connect',core[_0x51ee('0x16')]);ami['on'](_0x51ee('0x17'),core[_0x51ee('0x17')]);ami['on']('fullybooted',core[_0x51ee('0x18')]);ami['on'](_0x51ee('0x19'),core[_0x51ee('0x19')]);ami['on']('close',core[_0x51ee('0x1a')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x51ee('0x1b'),function(_0x181dcc){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x1e'),_0x181dcc[_0x51ee('0x1f')]),_0x181dcc);members['devicestatechange'](_0x181dcc);}catch(_0x550a90){utils[_0x51ee('0x19')](util['format'](_0x51ee('0x1e'),_0x181dcc[_0x51ee('0x1f')]),_0x550a90);}});ami['on'](_0x51ee('0x20'),function(_0x760e18){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x21'),_0x760e18['uniqueid']),_0x760e18);agents['agentcalled'](_0x760e18);}catch(_0x3acc3e){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x21'),_0x760e18[_0x51ee('0x22')]),_0x3acc3e);}});ami['on'](_0x51ee('0x23'),function(_0x32123a){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')]('[%s][index][agentringnoanswer]',_0x32123a[_0x51ee('0x22')]),_0x32123a);agents['agentringnoanswer'](_0x32123a);}catch(_0x3ad295){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')]('[%s][index][agentringnoanswer]',_0x32123a[_0x51ee('0x22')]),_0x3ad295);}});ami['on']('agentconnect',function(_0x2e6670){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x24'),_0x2e6670[_0x51ee('0x22')]),_0x2e6670);agents['agentconnect'](_0x2e6670);queues[_0x51ee('0x25')](_0x2e6670);}catch(_0x5aa462){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x24'),_0x2e6670['uniqueid']),_0x5aa462);}});ami['on']('agentcomplete',function(_0x587555){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')]('[%s][index][agentcomplete]',_0x587555[_0x51ee('0x22')]),_0x587555);agents[_0x51ee('0x26')](_0x587555);queues['agentcomplete'](_0x587555);members['agentcomplete'](_0x587555);}catch(_0x5b584b){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x27'),_0x587555[_0x51ee('0x22')]),_0x5b584b);}});ami['on']('queuecallerabandon',function(_0x4dadfa){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x28'),_0x4dadfa[_0x51ee('0x22')]),_0x4dadfa);agents[_0x51ee('0x29')](_0x4dadfa);queues[_0x51ee('0x29')](_0x4dadfa);}catch(_0x26cd7d){utils['error'](util[_0x51ee('0x1d')](_0x51ee('0x28'),_0x4dadfa[_0x51ee('0x22')]),_0x26cd7d);}});ami['on'](_0x51ee('0x2a'),function(_0x4c0aea){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x2b'),_0x4c0aea['uniqueid']),_0x4c0aea);queues[_0x51ee('0x2a')](_0x4c0aea);recordings[_0x51ee('0x2a')](_0x4c0aea);}catch(_0x5b2840){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x2b'),_0x4c0aea[_0x51ee('0x22')]),_0x5b2840);}});ami['on']('queuecallerleave',function(_0x56eb84){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')]('[%s][index][queuecallerleave]',_0x56eb84['uniqueid']),_0x56eb84);queues[_0x51ee('0x2c')](_0x56eb84);}catch(_0x1fdb2c){utils[_0x51ee('0x19')](util['format'](_0x51ee('0x2d'),_0x56eb84[_0x51ee('0x22')]),_0x1fdb2c);}});ami['on'](_0x51ee('0x2e'),function(_0x1b3550){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x2f'),_0x1b3550[_0x51ee('0x22')]),_0x1b3550);queues[_0x51ee('0x2e')](_0x1b3550);calls[_0x51ee('0x2e')](_0x1b3550);}catch(_0x4e141e){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x2f'),_0x1b3550[_0x51ee('0x22')]),_0x4e141e);}});ami['on'](_0x51ee('0x30'),function(_0x172119){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x31'),_0x172119[_0x51ee('0x22')]),_0x172119);queues['musiconholdstop'](_0x172119);calls[_0x51ee('0x30')](_0x172119);}catch(_0x7bffea){utils['error'](util['format']('[%s][index][musiconholdstop]',_0x172119['uniqueid']),_0x7bffea);}});ami['on']('newstate',function(_0x3343e3){try{utils['debug'](util['format'](_0x51ee('0x32'),_0x3343e3[_0x51ee('0x22')]),_0x3343e3);calls[_0x51ee('0x33')](_0x3343e3);recordings['newstate'](_0x3343e3);}catch(_0x194a28){utils[_0x51ee('0x19')](util['format'](_0x51ee('0x32'),_0x3343e3[_0x51ee('0x22')]),_0x194a28);}});ami['on']('hangup',function(_0x278fd0){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x34'),_0x278fd0[_0x51ee('0x22')]),_0x278fd0);calls[_0x51ee('0x35')](_0x278fd0);recordings['hangup'](_0x278fd0);dials[_0x51ee('0x35')](_0x278fd0);agents[_0x51ee('0x35')](_0x278fd0);queues['hangup'](_0x278fd0);}catch(_0x2870e4){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')]('[%s][index][hangup]',_0x278fd0[_0x51ee('0x22')]),_0x2870e4);}});ami['on'](_0x51ee('0x36'),function(_0x52f1e0){try{utils['debug'](util['format'](_0x51ee('0x37'),_0x52f1e0['uniqueid']),_0x52f1e0);members[_0x51ee('0x36')](_0x52f1e0);}catch(_0x21b4d4){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')]('[%s][index][cdr]',_0x52f1e0[_0x51ee('0x22')]),_0x21b4d4);}});ami['on'](_0x51ee('0x38'),function(_0x54fb98){try{utils['debug'](util['format'](_0x51ee('0x39'),_0x54fb98['uniqueid']),_0x54fb98);queues['blindtransfer'](_0x54fb98);agents[_0x51ee('0x38')](_0x54fb98);transfers[_0x51ee('0x38')](_0x54fb98);recordings['blindtransfer'](_0x54fb98);}catch(_0x300d76){utils[_0x51ee('0x19')](util['format'](_0x51ee('0x39'),_0x54fb98['uniqueid']),_0x300d76);}});ami['on'](_0x51ee('0x3a'),function(_0x4f02d9){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x3b'),_0x4f02d9[_0x51ee('0x3c')]),_0x4f02d9);queues[_0x51ee('0x3a')](_0x4f02d9);transfers[_0x51ee('0x3a')](_0x4f02d9);agents['attendedtransfer'](_0x4f02d9);calls[_0x51ee('0x3a')](_0x4f02d9);}catch(_0x403f8c){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x3b'),_0x4f02d9[_0x51ee('0x3c')]),_0x403f8c);}});ami['on'](_0x51ee('0x3d'),function(_0x4b10c6){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')]('[%s][index][varset]',_0x4b10c6[_0x51ee('0x22')]),_0x4b10c6);queues[_0x51ee('0x3d')](_0x4b10c6);recordings[_0x51ee('0x3d')](_0x4b10c6);calls[_0x51ee('0x3d')](_0x4b10c6);dials[_0x51ee('0x3d')](_0x4b10c6);}catch(_0x5e6603){utils['error'](util['format']('[%s][index][varset]',_0x4b10c6[_0x51ee('0x22')]),_0x5e6603);}});ami['on'](_0x51ee('0x3e'),function(_0x54f836){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x3f'),_0x54f836[_0x51ee('0x22')]),_0x54f836);calls['newexten'](_0x54f836);recordings[_0x51ee('0x3e')](_0x54f836);dials[_0x51ee('0x3e')](_0x54f836);}catch(_0x5f3206){utils['error'](util[_0x51ee('0x1d')]('[%s][index][newexten]',_0x54f836[_0x51ee('0x22')]),_0x5f3206);}});ami['on']('newchannel',function(_0xf8c326){try{utils['debug'](util['format'](_0x51ee('0x40'),_0xf8c326['uniqueid']),_0xf8c326);calls['newchannel'](_0xf8c326);recordings[_0x51ee('0x41')](_0xf8c326);}catch(_0x56c2b5){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x40'),_0xf8c326[_0x51ee('0x22')]),_0x56c2b5);}});ami['on'](_0x51ee('0x42'),function(_0x2b6235){try{utils['debug'](util['format'](_0x51ee('0x43'),_0x2b6235['uniqueid']),_0x2b6235);dials[_0x51ee('0x42')](_0x2b6235);}catch(_0x533929){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x44'),_0x2b6235[_0x51ee('0x22')]),_0x533929);}});ami['on'](_0x51ee('0x45'),function(_0x17ed65){try{utils[_0x51ee('0x1c')](util['format'](_0x51ee('0x46'),_0x17ed65[_0x51ee('0x22')]),_0x17ed65);dials[_0x51ee('0x45')](_0x17ed65);}catch(_0x2f51fe){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x46'),_0x17ed65['uniqueid']),_0x2f51fe);}});} \ No newline at end of file +var _0x67e5=['close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error'];(function(_0x4fcd7e,_0x29bd3f){var _0x537e97=function(_0x26aaa5){while(--_0x26aaa5){_0x4fcd7e['push'](_0x4fcd7e['shift']());}};_0x537e97(++_0x29bd3f);}(_0x67e5,0x1a1));var _0x567e=function(_0x115b6a,_0x1b2032){_0x115b6a=_0x115b6a-0x0;var _0x118580=_0x67e5[_0x115b6a];return _0x118580;};var AsteriskManager=require('asterisk-manager');var config=require(_0x567e('0x0'));var utils=require(_0x567e('0x1'));var util=require(_0x567e('0x2'));var isXDREnabled=config[_0x567e('0x3')]&&config[_0x567e('0x3')][_0x567e('0x4')]?!config[_0x567e('0x3')]['disabled']:!![];var isProduction=config[_0x567e('0x5')]===_0x567e('0x6')||![];var isLocalAsterisk=config[_0x567e('0x3')]&&config[_0x567e('0x3')][_0x567e('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x567e('0x8')][_0x567e('0x9')],config['asterisk']['ip'],config[_0x567e('0x8')][_0x567e('0xa')],config[_0x567e('0x8')][_0x567e('0xb')],!![]);ami[_0x567e('0xc')]();if(!isXDREnabled){utils[_0x567e('0xd')](_0x567e('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x567e('0xd')](_0x567e('0xf'));}else{var agents=require(_0x567e('0x10'));var calls=require(_0x567e('0x11'));var queues=require(_0x567e('0x12'));var recordings=require(_0x567e('0x13'));var members=require(_0x567e('0x14'));var dials=require(_0x567e('0x15'));var transfers=require('./transfers.controller');var core=require(_0x567e('0x16'));ami['on'](_0x567e('0x17'),core[_0x567e('0x17')]);ami['on']('shutdown',core[_0x567e('0x18')]);ami['on']('fullybooted',core[_0x567e('0x19')]);ami['on'](_0x567e('0x1a'),core[_0x567e('0x1a')]);ami['on'](_0x567e('0x1b'),core[_0x567e('0x1b')]);ami['on'](_0x567e('0x1c'),core[_0x567e('0x1c')]);ami['on'](_0x567e('0x1d'),function(_0x56669e){try{utils['debug'](util[_0x567e('0x1e')](_0x567e('0x1f'),_0x56669e[_0x567e('0x20')]),_0x56669e);members[_0x567e('0x1d')](_0x56669e);}catch(_0x229fde){utils['error'](util[_0x567e('0x1e')]('[%s][index][devicestatechange]',_0x56669e[_0x567e('0x20')]),_0x229fde);}});ami['on'](_0x567e('0x21'),function(_0x35e479){try{utils[_0x567e('0x22')](util['format'](_0x567e('0x23'),_0x35e479['uniqueid']),_0x35e479);agents['agentcalled'](_0x35e479);}catch(_0x3ad4e9){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x23'),_0x35e479[_0x567e('0x24')]),_0x3ad4e9);}});ami['on']('agentringnoanswer',function(_0x5224b2){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')](_0x567e('0x25'),_0x5224b2[_0x567e('0x24')]),_0x5224b2);agents[_0x567e('0x26')](_0x5224b2);}catch(_0x48b4ee){utils['error'](util[_0x567e('0x1e')](_0x567e('0x25'),_0x5224b2[_0x567e('0x24')]),_0x48b4ee);}});ami['on'](_0x567e('0x27'),function(_0x5a73db){try{utils['debug'](util[_0x567e('0x1e')]('[%s][index][agentconnect]',_0x5a73db[_0x567e('0x24')]),_0x5a73db);agents[_0x567e('0x27')](_0x5a73db);queues[_0x567e('0x27')](_0x5a73db);}catch(_0x183a1b){utils['error'](util[_0x567e('0x1e')](_0x567e('0x28'),_0x5a73db[_0x567e('0x24')]),_0x183a1b);}});ami['on'](_0x567e('0x29'),function(_0xab1f50){try{utils['debug'](util[_0x567e('0x1e')](_0x567e('0x2a'),_0xab1f50['uniqueid']),_0xab1f50);agents[_0x567e('0x29')](_0xab1f50);queues['agentcomplete'](_0xab1f50);members[_0x567e('0x29')](_0xab1f50);}catch(_0x1d530f){utils[_0x567e('0x1a')](util[_0x567e('0x1e')]('[%s][index][agentcomplete]',_0xab1f50[_0x567e('0x24')]),_0x1d530f);}});ami['on'](_0x567e('0x2b'),function(_0x2f1a11){try{utils[_0x567e('0x22')](util['format']('[%s][index][queuecallerabandon]',_0x2f1a11[_0x567e('0x24')]),_0x2f1a11);agents[_0x567e('0x2b')](_0x2f1a11);queues[_0x567e('0x2b')](_0x2f1a11);}catch(_0x1b8bf5){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x2c'),_0x2f1a11[_0x567e('0x24')]),_0x1b8bf5);}});ami['on'](_0x567e('0x2d'),function(_0x16c8dd){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')](_0x567e('0x2e'),_0x16c8dd[_0x567e('0x24')]),_0x16c8dd);queues[_0x567e('0x2d')](_0x16c8dd);recordings[_0x567e('0x2d')](_0x16c8dd);}catch(_0x49fdef){utils[_0x567e('0x1a')](util[_0x567e('0x1e')]('[%s][index][queuecallerjoin]',_0x16c8dd[_0x567e('0x24')]),_0x49fdef);}});ami['on']('queuecallerleave',function(_0x49dd4d){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')](_0x567e('0x2f'),_0x49dd4d['uniqueid']),_0x49dd4d);queues[_0x567e('0x30')](_0x49dd4d);}catch(_0x5930fb){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x2f'),_0x49dd4d['uniqueid']),_0x5930fb);}});ami['on']('musiconholdstart',function(_0x3ac08f){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')](_0x567e('0x31'),_0x3ac08f[_0x567e('0x24')]),_0x3ac08f);queues[_0x567e('0x32')](_0x3ac08f);calls['musiconholdstart'](_0x3ac08f);}catch(_0x119863){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x31'),_0x3ac08f['uniqueid']),_0x119863);}});ami['on'](_0x567e('0x33'),function(_0x4f18e6){try{utils['debug'](util[_0x567e('0x1e')](_0x567e('0x34'),_0x4f18e6[_0x567e('0x24')]),_0x4f18e6);queues[_0x567e('0x33')](_0x4f18e6);calls[_0x567e('0x33')](_0x4f18e6);}catch(_0x4fe782){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x34'),_0x4f18e6[_0x567e('0x24')]),_0x4fe782);}});ami['on']('newstate',function(_0x273bca){try{utils[_0x567e('0x22')](util['format'](_0x567e('0x35'),_0x273bca[_0x567e('0x24')]),_0x273bca);calls[_0x567e('0x36')](_0x273bca);recordings[_0x567e('0x36')](_0x273bca);}catch(_0x2a544c){utils['error'](util[_0x567e('0x1e')](_0x567e('0x35'),_0x273bca[_0x567e('0x24')]),_0x2a544c);}});ami['on'](_0x567e('0x37'),function(_0x34d98a){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')]('[%s][index][hangup]',_0x34d98a[_0x567e('0x24')]),_0x34d98a);calls['hangup'](_0x34d98a);recordings[_0x567e('0x37')](_0x34d98a);dials[_0x567e('0x37')](_0x34d98a);agents[_0x567e('0x37')](_0x34d98a);queues[_0x567e('0x37')](_0x34d98a);}catch(_0x211e17){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x38'),_0x34d98a[_0x567e('0x24')]),_0x211e17);}});ami['on'](_0x567e('0x39'),function(_0x57405f){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')]('[%s][index][cdr]',_0x57405f[_0x567e('0x24')]),_0x57405f);members[_0x567e('0x39')](_0x57405f);}catch(_0x4b3c6b){utils[_0x567e('0x1a')](util[_0x567e('0x1e')]('[%s][index][cdr]',_0x57405f[_0x567e('0x24')]),_0x4b3c6b);}});ami['on']('blindtransfer',function(_0x26fe4c){try{utils['debug'](util[_0x567e('0x1e')](_0x567e('0x3a'),_0x26fe4c[_0x567e('0x24')]),_0x26fe4c);queues[_0x567e('0x3b')](_0x26fe4c);agents[_0x567e('0x3b')](_0x26fe4c);transfers[_0x567e('0x3b')](_0x26fe4c);recordings[_0x567e('0x3b')](_0x26fe4c);}catch(_0x198caa){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x3a'),_0x26fe4c[_0x567e('0x24')]),_0x198caa);}});ami['on'](_0x567e('0x3c'),function(_0x26a1c9){try{utils[_0x567e('0x22')](util['format'](_0x567e('0x3d'),_0x26a1c9[_0x567e('0x3e')]),_0x26a1c9);queues[_0x567e('0x3c')](_0x26a1c9);transfers[_0x567e('0x3c')](_0x26a1c9);agents[_0x567e('0x3c')](_0x26a1c9);calls['attendedtransfer'](_0x26a1c9);}catch(_0x16d459){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x3d'),_0x26a1c9[_0x567e('0x3e')]),_0x16d459);}});ami['on'](_0x567e('0x3f'),function(_0x2e022d){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')](_0x567e('0x40'),_0x2e022d[_0x567e('0x24')]),_0x2e022d);queues[_0x567e('0x3f')](_0x2e022d);recordings['varset'](_0x2e022d);calls[_0x567e('0x3f')](_0x2e022d);dials[_0x567e('0x3f')](_0x2e022d);}catch(_0x4fc16c){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x40'),_0x2e022d[_0x567e('0x24')]),_0x4fc16c);}});ami['on'](_0x567e('0x41'),function(_0x446719){try{utils['debug'](util[_0x567e('0x1e')](_0x567e('0x42'),_0x446719['uniqueid']),_0x446719);calls[_0x567e('0x41')](_0x446719);recordings[_0x567e('0x41')](_0x446719);dials['newexten'](_0x446719);}catch(_0xb54fe6){utils[_0x567e('0x1a')](util[_0x567e('0x1e')]('[%s][index][newexten]',_0x446719[_0x567e('0x24')]),_0xb54fe6);}});ami['on'](_0x567e('0x43'),function(_0x163351){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')](_0x567e('0x44'),_0x163351[_0x567e('0x24')]),_0x163351);calls[_0x567e('0x43')](_0x163351);recordings[_0x567e('0x43')](_0x163351);}catch(_0x15a120){utils[_0x567e('0x1a')](util[_0x567e('0x1e')](_0x567e('0x44'),_0x163351['uniqueid']),_0x15a120);}});ami['on'](_0x567e('0x45'),function(_0x22f705){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')](_0x567e('0x46'),_0x22f705['uniqueid']),_0x22f705);dials[_0x567e('0x45')](_0x22f705);}catch(_0x55bdea){utils['error'](util[_0x567e('0x1e')](_0x567e('0x47'),_0x22f705['uniqueid']),_0x55bdea);}});ami['on'](_0x567e('0x48'),function(_0x4d965a){try{utils[_0x567e('0x22')](util[_0x567e('0x1e')](_0x567e('0x49'),_0x4d965a['uniqueid']),_0x4d965a);dials[_0x567e('0x48')](_0x4d965a);}catch(_0x3ea6b8){utils[_0x567e('0x1a')](util['format']('[%s][index][dialend]',_0x4d965a['uniqueid']),_0x3ea6b8);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index e8faa5d..fbf7616 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 _0xce92=['source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','data3','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','channel','membername','type','interface','getUserByInterface','then','internal','getUserByName','split','name','request','CreateMemberReport','catch','error','[%s][members][writeDB]','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','TALKING','now','agent','NOT_INUSE','exitAt','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','queue','assign','data1'];(function(_0x538e11,_0x3c01f2){var _0xebfb03=function(_0x34f22f){while(--_0x34f22f){_0x538e11['push'](_0x538e11['shift']());}};_0xebfb03(++_0x3c01f2);}(_0xce92,0x186));var _0x2ce9=function(_0x5e1f24,_0x442000){_0x5e1f24=_0x5e1f24-0x0;var _0x53823d=_0xce92[_0x5e1f24];return _0x53823d;};'use strict';var _=require(_0x2ce9('0x0'));var util=require('util');var utils=require(_0x2ce9('0x1'));var members={};var exclude=[_0x2ce9('0x2'),_0x2ce9('0x3')];function writeDB(_0x203ff1){utils[_0x2ce9('0x4')](util[_0x2ce9('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x203ff1['uniqueid'],_0x203ff1['interface'],_0x203ff1[_0x2ce9('0x6')],_0x203ff1['data2'],_0x203ff1[_0x2ce9('0x7')],_0x203ff1[_0x2ce9('0x8')]));if(_0x203ff1[_0x2ce9('0x9')]){utils[_0x2ce9('0xa')](_0x203ff1[_0x2ce9('0x9')])[_0x2ce9('0xb')](function(_0xd1c721){if(_0xd1c721){_0x203ff1[_0x2ce9('0x7')]=_0xd1c721['name'];_0x203ff1[_0x2ce9('0xc')]=_0xd1c721[_0x2ce9('0xc')];utils['request']('CreateMemberReport',_0x203ff1);}else{utils[_0x2ce9('0xd')](_0x203ff1[_0x2ce9('0x9')][_0x2ce9('0xe')]('/')[0x1])[_0x2ce9('0xb')](function(_0x5b29f2){if(_0x5b29f2){_0x203ff1[_0x2ce9('0x7')]=_0x5b29f2[_0x2ce9('0xf')];_0x203ff1[_0x2ce9('0xc')]=_0x5b29f2[_0x2ce9('0xc')];utils[_0x2ce9('0x10')](_0x2ce9('0x11'),_0x203ff1);}});}})[_0x2ce9('0x12')](function(_0x589f20){utils[_0x2ce9('0x13')](util[_0x2ce9('0x5')](_0x2ce9('0x14'),_0x203ff1[_0x2ce9('0x15')]),_0x589f20);});}delete members[_0x203ff1[_0x2ce9('0x9')]];}function startsWith(_0x27841d,_0x5c9432){return _[_0x2ce9('0x16')](_0x27841d,function(_0x270828){return _['startsWith'](_0x5c9432,_0x270828);});}exports[_0x2ce9('0x17')]=function(_0x528818){try{utils[_0x2ce9('0x18')](util[_0x2ce9('0x5')](_0x2ce9('0x19'),members[_0x528818['device']]?members[_0x528818['device']]['uniqueid']:_0x528818[_0x2ce9('0x1a')]),_0x528818);utils['info'](util['format'](_0x2ce9('0x1b'),members[_0x528818['device']]?members[_0x528818[_0x2ce9('0x1a')]][_0x2ce9('0x15')]:_0x528818[_0x2ce9('0x1a')],_0x528818[_0x2ce9('0x1c')],_0x528818[_0x2ce9('0x1a')]));switch(_0x528818[_0x2ce9('0x1c')]){case'INUSE':case _0x2ce9('0x1d'):if(!startsWith(exclude,_0x528818[_0x2ce9('0x1a')])){members[_0x528818['device']]={'channel':'voice','interface':_0x528818[_0x2ce9('0x1a')],'type':_0x2ce9('0x1e'),'enterAt':utils[_0x2ce9('0x1f')](),'role':_0x2ce9('0x20')};}break;case _0x2ce9('0x21'):if(!_['isNil'](members[_0x528818[_0x2ce9('0x1a')]])){members[_0x528818['device']][_0x2ce9('0x22')]=utils['now']();members[_0x528818[_0x2ce9('0x1a')]]['duration']=utils['diffTime'](members[_0x528818[_0x2ce9('0x1a')]][_0x2ce9('0x22')],members[_0x528818[_0x2ce9('0x1a')]][_0x2ce9('0x23')]);if(members[_0x528818[_0x2ce9('0x1a')]][_0x2ce9('0x15')]){writeDB(members[_0x528818[_0x2ce9('0x1a')]]);}}break;default:break;}}catch(_0x4bc703){utils[_0x2ce9('0x13')](util[_0x2ce9('0x5')](_0x2ce9('0x19'),members[_0x528818[_0x2ce9('0x1a')]]?members[_0x528818['device']][_0x2ce9('0x15')]:_0x528818['device']),_0x4bc703);}};exports[_0x2ce9('0x24')]=function(_0x335a49){try{if(!_[_0x2ce9('0x25')](members[_0x335a49['interface']])){utils[_0x2ce9('0x18')](util['format'](_0x2ce9('0x26'),_0x335a49[_0x2ce9('0x15')]),_0x335a49);utils['info'](util[_0x2ce9('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x335a49['uniqueid'],_0x335a49[_0x2ce9('0x9')],_0x335a49[_0x2ce9('0x27')]));members[_0x335a49[_0x2ce9('0x9')]]=_['assign'](members[_0x335a49['interface']],{'data4':_0x335a49[_0x2ce9('0x27')],'uniqueid':_0x335a49[_0x2ce9('0x15')]});}}catch(_0x1b7424){utils[_0x2ce9('0x13')](util['format'](_0x2ce9('0x26'),_0x335a49[_0x2ce9('0x15')]),_0x1b7424);}};exports['cdr']=function(_0x4c8a7d){try{utils[_0x2ce9('0x18')](util[_0x2ce9('0x5')]('[%s][members][cdr]',_0x4c8a7d[_0x2ce9('0x15')]),_0x4c8a7d);if(_0x4c8a7d[_0x2ce9('0x6')]){var _0x265955=_0x4c8a7d[_0x2ce9('0x6')]['split']('-')[0x0];if(!_['isNil'](members[_0x265955])){members[_0x265955]=_[_0x2ce9('0x28')](members[_0x265955],{'data1':members[_0x265955][_0x2ce9('0x29')]||_0x4c8a7d[_0x2ce9('0x8')],'data2':members[_0x265955]['data2']||_0x4c8a7d[_0x2ce9('0x2a')],'data3':members[_0x265955]['data3']||_0x4c8a7d[_0x2ce9('0x2b')],'uniqueid':members[_0x265955]['uniqueid']||_0x4c8a7d[_0x2ce9('0x15')]});utils[_0x2ce9('0x4')](util[_0x2ce9('0x5')](_0x2ce9('0x2c'),_0x4c8a7d[_0x2ce9('0x15')],members[_0x265955][_0x2ce9('0x29')],members[_0x265955][_0x2ce9('0x2d')],members[_0x265955][_0x2ce9('0x2e')]));if(members[_0x265955][_0x2ce9('0x22')]){writeDB(members[_0x265955]);}}}if(_0x4c8a7d['destinationchannel']){var _0x20e61a=_0x4c8a7d[_0x2ce9('0x2f')]['split']('-')[0x0];if(!_[_0x2ce9('0x25')](members[_0x20e61a])){members[_0x20e61a]=_[_0x2ce9('0x28')](members[_0x20e61a],{'data1':members[_0x20e61a][_0x2ce9('0x29')]||_0x4c8a7d[_0x2ce9('0x8')],'data2':members[_0x20e61a]['data2']||_0x4c8a7d[_0x2ce9('0x2a')],'data3':members[_0x20e61a]['data3']||_0x4c8a7d['destination'],'uniqueid':members[_0x20e61a]['uniqueid']||_0x4c8a7d[_0x2ce9('0x15')]});utils[_0x2ce9('0x4')](util['format'](_0x2ce9('0x2c'),_0x4c8a7d[_0x2ce9('0x15')],members[_0x20e61a][_0x2ce9('0x29')],members[_0x20e61a][_0x2ce9('0x2d')],members[_0x20e61a][_0x2ce9('0x2e')]));if(members[_0x20e61a]['exitAt']){writeDB(members[_0x20e61a]);}}}}catch(_0x43bbe5){utils['error'](util[_0x2ce9('0x5')]('[%s][members][cdr]',_0x4c8a7d[_0x2ce9('0x15')]),_0x43bbe5);}}; \ No newline at end of file +var _0x65e9=['interface','channel','data2','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','enterAt','debug','[%s][members][agentcomplete]','assign','queue','cdr','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid'];(function(_0xd9ce1,_0x517167){var _0x54be53=function(_0x27a6bd){while(--_0x27a6bd){_0xd9ce1['push'](_0xd9ce1['shift']());}};_0x54be53(++_0x517167);}(_0x65e9,0x15e));var _0x965e=function(_0x2463f8,_0x278755){_0x2463f8=_0x2463f8-0x0;var _0x428d86=_0x65e9[_0x2463f8];return _0x428d86;};'use strict';var _=require(_0x965e('0x0'));var util=require(_0x965e('0x1'));var utils=require('./utils');var members={};var exclude=[_0x965e('0x2'),_0x965e('0x3')];function writeDB(_0x18623f){utils[_0x965e('0x4')](util['format'](_0x965e('0x5'),_0x18623f[_0x965e('0x6')],_0x18623f[_0x965e('0x7')],_0x18623f[_0x965e('0x8')],_0x18623f[_0x965e('0x9')],_0x18623f[_0x965e('0xa')],_0x18623f[_0x965e('0xb')]));if(_0x18623f[_0x965e('0x7')]){utils[_0x965e('0xc')](_0x18623f['interface'])[_0x965e('0xd')](function(_0x9c897a){if(_0x9c897a){_0x18623f[_0x965e('0xa')]=_0x9c897a[_0x965e('0xe')];_0x18623f[_0x965e('0xf')]=_0x9c897a[_0x965e('0xf')];utils['request'](_0x965e('0x10'),_0x18623f);}else{utils[_0x965e('0x11')](_0x18623f[_0x965e('0x7')][_0x965e('0x12')]('/')[0x1])['then'](function(_0x4a00e9){if(_0x4a00e9){_0x18623f[_0x965e('0xa')]=_0x4a00e9[_0x965e('0xe')];_0x18623f[_0x965e('0xf')]=_0x4a00e9['internal'];utils[_0x965e('0x13')](_0x965e('0x10'),_0x18623f);}});}})[_0x965e('0x14')](function(_0x3d888e){utils[_0x965e('0x15')](util[_0x965e('0x16')](_0x965e('0x17'),_0x18623f[_0x965e('0x6')]),_0x3d888e);});}delete members[_0x18623f['interface']];}function startsWith(_0x57fdf0,_0x211e10){return _[_0x965e('0x18')](_0x57fdf0,function(_0x578450){return _[_0x965e('0x19')](_0x211e10,_0x578450);});}exports[_0x965e('0x1a')]=function(_0x4d2ddb){try{utils['debug'](util[_0x965e('0x16')](_0x965e('0x1b'),members[_0x4d2ddb[_0x965e('0x1c')]]?members[_0x4d2ddb[_0x965e('0x1c')]]['uniqueid']:_0x4d2ddb[_0x965e('0x1c')]),_0x4d2ddb);utils[_0x965e('0x4')](util[_0x965e('0x16')](_0x965e('0x1d'),members[_0x4d2ddb['device']]?members[_0x4d2ddb[_0x965e('0x1c')]][_0x965e('0x6')]:_0x4d2ddb['device'],_0x4d2ddb[_0x965e('0x1e')],_0x4d2ddb[_0x965e('0x1c')]));switch(_0x4d2ddb[_0x965e('0x1e')]){case _0x965e('0x1f'):case _0x965e('0x20'):if(!startsWith(exclude,_0x4d2ddb[_0x965e('0x1c')])){members[_0x4d2ddb[_0x965e('0x1c')]]={'channel':_0x965e('0x21'),'interface':_0x4d2ddb['device'],'type':_0x965e('0x22'),'enterAt':utils[_0x965e('0x23')](),'role':_0x965e('0x24')};}break;case _0x965e('0x25'):if(!_[_0x965e('0x26')](members[_0x4d2ddb[_0x965e('0x1c')]])){members[_0x4d2ddb['device']]['exitAt']=utils[_0x965e('0x23')]();members[_0x4d2ddb[_0x965e('0x1c')]]['duration']=utils['diffTime'](members[_0x4d2ddb[_0x965e('0x1c')]][_0x965e('0x27')],members[_0x4d2ddb['device']][_0x965e('0x28')]);if(members[_0x4d2ddb['device']]['uniqueid']){writeDB(members[_0x4d2ddb['device']]);}}break;default:break;}}catch(_0x2f5415){utils[_0x965e('0x15')](util[_0x965e('0x16')](_0x965e('0x1b'),members[_0x4d2ddb[_0x965e('0x1c')]]?members[_0x4d2ddb['device']][_0x965e('0x6')]:_0x4d2ddb[_0x965e('0x1c')]),_0x2f5415);}};exports['agentcomplete']=function(_0x4683f9){try{if(!_['isNil'](members[_0x4683f9['interface']])){utils[_0x965e('0x29')](util[_0x965e('0x16')](_0x965e('0x2a'),_0x4683f9[_0x965e('0x6')]),_0x4683f9);utils[_0x965e('0x4')](util[_0x965e('0x16')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x4683f9[_0x965e('0x6')],_0x4683f9[_0x965e('0x7')],_0x4683f9['queue']));members[_0x4683f9[_0x965e('0x7')]]=_[_0x965e('0x2b')](members[_0x4683f9[_0x965e('0x7')]],{'data4':_0x4683f9[_0x965e('0x2c')],'uniqueid':_0x4683f9[_0x965e('0x6')]});}}catch(_0x5aae57){utils[_0x965e('0x15')](util[_0x965e('0x16')]('[%s][members][agentcomplete]',_0x4683f9[_0x965e('0x6')]),_0x5aae57);}};exports[_0x965e('0x2d')]=function(_0x3ab21c){try{utils[_0x965e('0x29')](util['format']('[%s][members][cdr]',_0x3ab21c[_0x965e('0x6')]),_0x3ab21c);if(_0x3ab21c[_0x965e('0x8')]){var _0x24c13c=_0x3ab21c['channel'][_0x965e('0x12')]('-')[0x0];if(!_[_0x965e('0x26')](members[_0x24c13c])){members[_0x24c13c]=_[_0x965e('0x2b')](members[_0x24c13c],{'data1':members[_0x24c13c][_0x965e('0x2e')]||_0x3ab21c['type'],'data2':members[_0x24c13c][_0x965e('0x9')]||_0x3ab21c[_0x965e('0x2f')],'data3':members[_0x24c13c][_0x965e('0x30')]||_0x3ab21c[_0x965e('0x31')],'uniqueid':members[_0x24c13c][_0x965e('0x6')]||_0x3ab21c[_0x965e('0x6')]});utils[_0x965e('0x4')](util[_0x965e('0x16')](_0x965e('0x32'),_0x3ab21c['uniqueid'],members[_0x24c13c][_0x965e('0x2e')],members[_0x24c13c][_0x965e('0x9')],members[_0x24c13c][_0x965e('0x30')]));if(members[_0x24c13c]['exitAt']){writeDB(members[_0x24c13c]);}}}if(_0x3ab21c['destinationchannel']){var _0xd14325=_0x3ab21c['destinationchannel']['split']('-')[0x0];if(!_['isNil'](members[_0xd14325])){members[_0xd14325]=_[_0x965e('0x2b')](members[_0xd14325],{'data1':members[_0xd14325][_0x965e('0x2e')]||_0x3ab21c[_0x965e('0xb')],'data2':members[_0xd14325][_0x965e('0x9')]||_0x3ab21c[_0x965e('0x2f')],'data3':members[_0xd14325][_0x965e('0x30')]||_0x3ab21c[_0x965e('0x31')],'uniqueid':members[_0xd14325][_0x965e('0x6')]||_0x3ab21c[_0x965e('0x6')]});utils[_0x965e('0x4')](util[_0x965e('0x16')](_0x965e('0x32'),_0x3ab21c[_0x965e('0x6')],members[_0xd14325][_0x965e('0x2e')],members[_0xd14325][_0x965e('0x9')],members[_0xd14325][_0x965e('0x30')]));if(members[_0xd14325][_0x965e('0x27')]){writeDB(members[_0xd14325]);}}}}catch(_0x1ab81b){utils[_0x965e('0x15')](util['format']('[%s][members][cdr]',_0x3ab21c[_0x965e('0x6')]),_0x1ab81b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 798a454..616da4f 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 _0xffa7=['[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','isNil','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfer','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT'];(function(_0x1a2eab,_0x291b0f){var _0x526e2e=function(_0xc2934a){while(--_0xc2934a){_0x1a2eab['push'](_0x1a2eab['shift']());}};_0x526e2e(++_0x291b0f);}(_0xffa7,0x12a));var _0x7ffa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xffa7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7ffa('0x0'));var util=require('util');var utils=require(_0x7ffa('0x1'));var queues={};function writeDB(_0x3486ae){utils['info'](util[_0x7ffa('0x2')](_0x7ffa('0x3'),_0x3486ae[_0x7ffa('0x4')],_0x3486ae[_0x7ffa('0x5')],_0x3486ae['queue'],_0x3486ae[_0x7ffa('0x6')],_0x3486ae['calleridnum'],_0x3486ae['accountcode'],_0x3486ae[_0x7ffa('0x7')]));if(_0x3486ae['queue']){utils[_0x7ffa('0x8')](_0x3486ae[_0x7ffa('0x9')])[_0x7ffa('0xa')](function(_0x4c72f1){if(_0x4c72f1){_0x3486ae[_0x7ffa('0xb')]=_0x4c72f1[_0x7ffa('0xb')];}utils[_0x7ffa('0xc')](_0x7ffa('0xd'),_0x3486ae);});}else{utils['request'](_0x7ffa('0xd'),_0x3486ae);}if(_0x3486ae[_0x7ffa('0xe')]){delete queues[_0x3486ae[_0x7ffa('0xe')]];}else{delete queues[_0x3486ae[_0x7ffa('0x4')]];}}exports[_0x7ffa('0xf')]=function(_0x5d7f11){try{utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x11'),_0x5d7f11[_0x7ffa('0x4')]),_0x5d7f11);utils[_0x7ffa('0x12')](util['format'](_0x7ffa('0x13'),_0x5d7f11['uniqueid'],_0x5d7f11[_0x7ffa('0x9')],_0x5d7f11[_0x7ffa('0x14')]));queues[_0x5d7f11['uniqueid']]=_['assign'](_0x5d7f11,{'originalposition':_0x5d7f11[_0x7ffa('0x14')],'queuecallerjoinAt':utils[_0x7ffa('0x15')](),'mohtime':0x0});}catch(_0x179da6){utils['error'](util['format'](_0x7ffa('0x11'),_0x5d7f11[_0x7ffa('0x4')]),_0x179da6);}};exports[_0x7ffa('0x16')]=function(_0x50572d){try{if(!_['isNil'](queues[_0x50572d[_0x7ffa('0x4')]])){utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x17'),_0x50572d['uniqueid']),_0x50572d);if(queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0x18')]){if(!queues[_0x50572d['uniqueid']][_0x7ffa('0x19')]&&!queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0x1a')]){queues[_0x50572d['uniqueid']][_0x7ffa('0x1b')]=!![];queues[_0x50572d[_0x7ffa('0x4')]]['queuecallercompleteAt']=utils[_0x7ffa('0x15')]();queues[_0x50572d['uniqueid']][_0x7ffa('0x7')]=_0x7ffa('0x1c');}utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x1d'),_0x50572d[_0x7ffa('0x4')],queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0x1e')],queues[_0x50572d['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x50572d['uniqueid']]);}else if(queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0xe')]){utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x1f'),_0x50572d['uniqueid'],queues[_0x50572d['uniqueid']][_0x7ffa('0x1e')],queues[_0x50572d[_0x7ffa('0x4')]]['transfereduniqueid']));queues[queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0xe')]]=queues[_0x50572d[_0x7ffa('0x4')]];queues[queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x50572d[_0x7ffa('0x4')]];}}}catch(_0xad34c9){utils['error'](util[_0x7ffa('0x2')]('[%s][queues][hangup]',_0x50572d[_0x7ffa('0x4')]),_0xad34c9);}};exports[_0x7ffa('0x20')]=function(_0x364510){try{utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x21'),_0x364510[_0x7ffa('0x4')]),_0x364510);if(!_[_0x7ffa('0x22')](_0x364510['variable'][_0x7ffa('0x23')])&&_0x364510[_0x7ffa('0x24')][_0x7ffa('0x25')]()!==_0x7ffa('0x26')){if(!_['isNil'](queues[_0x364510[_0x7ffa('0x4')]])){queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x19')]=![];queues[_0x364510['uniqueid']][_0x7ffa('0x27')]=null;queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x1a')]=!![];queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x28')]=utils['now']();queues[_0x364510['uniqueid']][_0x7ffa('0x7')]=_0x364510[_0x7ffa('0x24')][_0x7ffa('0x25')]();utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x364510[_0x7ffa('0x4')],queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x1e')],_0x364510[_0x7ffa('0x24')],queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x7')]));writeDB(queues[_0x364510[_0x7ffa('0x4')]]);}}else if(!_[_0x7ffa('0x22')](_0x364510[_0x7ffa('0x29')][_0x7ffa('0x2a')])){if(!_[_0x7ffa('0x22')](queues[_0x364510[_0x7ffa('0x4')]])&&!queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x19')]){queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x19')]=![];queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x27')]=null;queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x1a')]=!![];queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x28')]=utils['now']();queues[_0x364510['uniqueid']][_0x7ffa('0x7')]=_0x7ffa('0x2b');utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x2c'),_0x364510[_0x7ffa('0x4')],queues[_0x364510['uniqueid']][_0x7ffa('0x1e')],_0x364510[_0x7ffa('0x24')],queues[_0x364510['uniqueid']][_0x7ffa('0x7')]));}}}catch(_0xcb72a7){utils[_0x7ffa('0x2d')](util[_0x7ffa('0x2')]('[%s][queues][varset]',_0x364510['uniqueid']),_0xcb72a7);}};exports[_0x7ffa('0x19')]=function(_0x133816){try{if(!_[_0x7ffa('0x22')](queues[_0x133816[_0x7ffa('0x4')]])){utils['debug'](util[_0x7ffa('0x2')](_0x7ffa('0x2e'),_0x133816[_0x7ffa('0x4')]),_0x133816);queues[_0x133816[_0x7ffa('0x4')]]['queuecallerexit']=![];queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x28')]=null;queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x19')]=!![];queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x27')]=utils['now']();queues[_0x133816['uniqueid']]['queuecallerexitreason']=_0x7ffa('0x2f');utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x133816['uniqueid'],queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x1e')],queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x7')]));}}catch(_0x559568){utils[_0x7ffa('0x2d')](util[_0x7ffa('0x2')]('[%s][queues][queuecallerabandon]',_0x133816['uniqueid']),_0x559568);}};exports[_0x7ffa('0x30')]=function(_0x1bfb8e){try{if(!_[_0x7ffa('0x22')](queues[_0x1bfb8e[_0x7ffa('0x4')]])){utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x31'),_0x1bfb8e['uniqueid']),_0x1bfb8e);utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x32'),_0x1bfb8e['uniqueid'],queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x1e')],_0x1bfb8e[_0x7ffa('0x33')],_0x1bfb8e[_0x7ffa('0x34')]));queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x30')]=!![];queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x18')]=utils['now']();queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x35')]=utils[_0x7ffa('0x36')](queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x18')],queues[_0x1bfb8e[_0x7ffa('0x4')]]['queuecallerjoinAt']);queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x14')]=_0x1bfb8e[_0x7ffa('0x14')];queues[_0x1bfb8e['uniqueid']][_0x7ffa('0x37')]=_0x1bfb8e[_0x7ffa('0x37')];queues[_0x1bfb8e[_0x7ffa('0x4')]]['connectedlinenum']=_0x1bfb8e[_0x7ffa('0x33')];queues[_0x1bfb8e[_0x7ffa('0x4')]]['connectedlinename']=_0x1bfb8e[_0x7ffa('0x34')];}}catch(_0x593a24){utils[_0x7ffa('0x2d')](util[_0x7ffa('0x2')]('[%s][queues][queuecallerleave]',_0x1bfb8e[_0x7ffa('0x4')]),_0x593a24);}};exports['agentconnect']=function(_0x449f0d){try{if(!_[_0x7ffa('0x22')](queues[_0x449f0d['uniqueid']])){utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x38'),_0x449f0d[_0x7ffa('0x4')]),_0x449f0d);utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x39'),_0x449f0d[_0x7ffa('0x4')],queues[_0x449f0d[_0x7ffa('0x4')]]['name'],_0x449f0d[_0x7ffa('0x3a')],_0x449f0d[_0x7ffa('0x3b')]));queues[_0x449f0d[_0x7ffa('0x4')]][_0x7ffa('0x19')]=![];queues[_0x449f0d['uniqueid']]['queuecallerabandon']=![];queues[_0x449f0d[_0x7ffa('0x4')]][_0x7ffa('0x27')]=null;queues[_0x449f0d[_0x7ffa('0x4')]]['queuecallerexit']=![];queues[_0x449f0d['uniqueid']]['queuecallerexitreason']=null;queues[_0x449f0d[_0x7ffa('0x4')]][_0x7ffa('0x28')]=null;queues[_0x449f0d[_0x7ffa('0x4')]][_0x7ffa('0x3c')]=!![];queues[_0x449f0d['uniqueid']][_0x7ffa('0x3d')]=_0x449f0d[_0x7ffa('0x3b')];queues[_0x449f0d['uniqueid']]['lastAssignedTo']=_0x449f0d[_0x7ffa('0x3a')];}}catch(_0x1a3098){utils[_0x7ffa('0x2d')](util[_0x7ffa('0x2')](_0x7ffa('0x38'),_0x449f0d[_0x7ffa('0x4')]),_0x1a3098);}};exports[_0x7ffa('0x3e')]=function(_0x9d0a3d){try{if(!_[_0x7ffa('0x22')](queues[_0x9d0a3d['uniqueid']])){if(queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x18')]){utils['debug'](util[_0x7ffa('0x2')](_0x7ffa('0x3f'),_0x9d0a3d['uniqueid']),_0x9d0a3d);queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x19')]=![];queues[_0x9d0a3d[_0x7ffa('0x4')]]['queuecallerabandon']=![];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x27')]=null;queues[_0x9d0a3d[_0x7ffa('0x4')]]['queuecallerexit']=![];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x28')]=null;queues[_0x9d0a3d['uniqueid']][_0x7ffa('0x3c')]=!![];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x6')]=_0x9d0a3d[_0x7ffa('0x3a')];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x1b')]=!![];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x40')]=utils[_0x7ffa('0x15')]();if(_0x9d0a3d[_0x7ffa('0x41')]=='transfer'){if(!queues[_0x9d0a3d[_0x7ffa('0x4')]]['transfer']){queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x7')]=_0x7ffa('0x42');}}else{queues[_0x9d0a3d['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x9d0a3d[_0x7ffa('0x41')][_0x7ffa('0x25')]();}utils[_0x7ffa('0x12')](util['format'](_0x7ffa('0x43'),_0x9d0a3d[_0x7ffa('0x4')],queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x1e')],_0x9d0a3d['membername'],queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x7')]));writeDB(queues[_0x9d0a3d[_0x7ffa('0x4')]]);}}}catch(_0x1b0ea6){utils['error'](util[_0x7ffa('0x2')](_0x7ffa('0x3f'),_0x9d0a3d[_0x7ffa('0x4')]),_0x1b0ea6);}};exports[_0x7ffa('0x44')]=function(_0x3eb0f5){try{if(!_['isNil'](queues[_0x3eb0f5[_0x7ffa('0x45')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x3eb0f5[_0x7ffa('0x4')]),_0x3eb0f5);queues[_0x3eb0f5[_0x7ffa('0x45')]][_0x7ffa('0x46')]=!![];queues[_0x3eb0f5[_0x7ffa('0x45')]][_0x7ffa('0x47')]=_0x7ffa('0x48');queues[_0x3eb0f5[_0x7ffa('0x45')]][_0x7ffa('0x49')]=_0x3eb0f5[_0x7ffa('0x4a')];queues[_0x3eb0f5[_0x7ffa('0x45')]]['transferuniqueid']=_0x3eb0f5[_0x7ffa('0x45')];queues[_0x3eb0f5['transfereeuniqueid']][_0x7ffa('0x7')]=_0x7ffa('0x4b');utils[_0x7ffa('0x12')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3eb0f5[_0x7ffa('0x4')],queues[_0x3eb0f5[_0x7ffa('0x45')]][_0x7ffa('0x1e')],_0x3eb0f5[_0x7ffa('0x45')],_0x3eb0f5['extension']));}}catch(_0x502361){utils['error'](util[_0x7ffa('0x2')](_0x7ffa('0x4c'),_0x3eb0f5[_0x7ffa('0x4')]),_0x502361);}};exports[_0x7ffa('0x4d')]=function(_0x50854c){try{utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x4e'),_0x50854c['origtransfereruniqueid']),_0x50854c);if(_0x50854c[_0x7ffa('0x4f')]==_0x50854c[_0x7ffa('0x50')]){if(!_[_0x7ffa('0x22')](queues[_0x50854c['secondtransfererlinkedid']])){utils['info'](util[_0x7ffa('0x2')](_0x7ffa('0x51'),_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c['secondtransfererlinkedid']][_0x7ffa('0x1e')],_0x50854c[_0x7ffa('0x52')]));queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x46')]=!![];queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x47')]=_0x7ffa('0x54');queues[_0x50854c[_0x7ffa('0x53')]]['transferexten']=_0x50854c['origtransfererexten'];queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x55')]=_0x50854c[_0x7ffa('0x4f')];queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x7')]=_0x7ffa('0x56');}if(!_['isNil'](queues[_0x50854c[_0x7ffa('0x50')]])){if(_0x50854c[_0x7ffa('0x57')]&&queues[_0x50854c[_0x7ffa('0x57')]]){queues[_0x50854c[_0x7ffa('0x57')]][_0x7ffa('0x58')]=0x1;queues[_0x50854c[_0x7ffa('0x45')]]=_['clone'](queues[_0x50854c[_0x7ffa('0x57')]]);queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0xe')]=_0x50854c[_0x7ffa('0x59')];queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x58')]=0x2;queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x5a')]=queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x5a')];queues[_0x50854c['transfereeuniqueid']][_0x7ffa('0x5b')]=queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x5b')];queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x5c')]=utils[_0x7ffa('0x15')]();queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x18')]=utils[_0x7ffa('0x15')]();queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x35')]=0x0;queues[_0x50854c['transfereeuniqueid']][_0x7ffa('0x5d')]=0x0;utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x5e'),_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c[_0x7ffa('0x45')]]['name'],queues[_0x50854c['transfereeuniqueid']]['calleridnum'],queues[_0x50854c[_0x7ffa('0x45')]]['calleridname']));}else{utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x5f'),_0x50854c['origtransfereruniqueid'],queues[_0x50854c[_0x7ffa('0x50')]]['name'],_0x50854c[_0x7ffa('0x53')]));queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0xe')]=_0x50854c[_0x7ffa('0x53')];}}}else if(_0x50854c[_0x7ffa('0x60')]==_0x50854c[_0x7ffa('0x53')]){if(!_[_0x7ffa('0x22')](queues[_0x50854c['origtransfererlinkedid']])){utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x61'),_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0x1e')],_0x50854c['secondtransfereruniqueid'],_0x50854c[_0x7ffa('0x62')]));queues[_0x50854c['origtransfererlinkedid']]['transfer']=!![];queues[_0x50854c[_0x7ffa('0x50')]][_0x7ffa('0x47')]=_0x7ffa('0x54');queues[_0x50854c[_0x7ffa('0x50')]][_0x7ffa('0x49')]=_0x50854c[_0x7ffa('0x62')];queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0x55')]=_0x50854c['secondtransfereruniqueid'];queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0x7')]=_0x7ffa('0x56');}if(!_[_0x7ffa('0x22')](queues[_0x50854c['secondtransfererlinkedid']])){if(_0x50854c[_0x7ffa('0x63')]&&queues[_0x50854c['transfertargetlinkedid']]){queues[_0x50854c[_0x7ffa('0x63')]]['queuecallerenterreason']=0x1;queues[_0x50854c[_0x7ffa('0x59')]]=_[_0x7ffa('0x64')](queues[_0x50854c[_0x7ffa('0x63')]]);queues[_0x50854c[_0x7ffa('0x59')]]['transfereduniqueid']=_0x50854c[_0x7ffa('0x59')];queues[_0x50854c['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x50854c['transfertargetuniqueid']]['calleridnum']=queues[_0x50854c[_0x7ffa('0x50')]][_0x7ffa('0x5a')];queues[_0x50854c[_0x7ffa('0x59')]]['calleridname']=queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0x5b')];queues[_0x50854c['transfertargetuniqueid']][_0x7ffa('0x5c')]=utils[_0x7ffa('0x15')]();queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x18')]=utils[_0x7ffa('0x15')]();queues[_0x50854c[_0x7ffa('0x59')]]['holdtime']=0x0;queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x5d')]=0x0;utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x65'),_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x1e')],queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0xe')],queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x5a')],queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x5b')]));}else{utils['info'](util[_0x7ffa('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c['secondtransfererlinkedid']]['name'],_0x50854c[_0x7ffa('0x50')]));queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0xe')]=_0x50854c[_0x7ffa('0x50')];}}}}catch(_0x3698ff){utils['error'](util['format'](_0x7ffa('0x4e'),_0x50854c[_0x7ffa('0x4f')]),_0x3698ff);}};exports[_0x7ffa('0x66')]=function(_0x388d1c){try{if(!_[_0x7ffa('0x22')](queues[_0x388d1c[_0x7ffa('0x4')]])){utils[_0x7ffa('0x10')](util['format']('[%s][queues][musiconholdstart]',_0x388d1c[_0x7ffa('0x4')]),_0x388d1c);queues[_0x388d1c[_0x7ffa('0x4')]][_0x7ffa('0x67')]=utils[_0x7ffa('0x15')]();utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x68'),_0x388d1c['uniqueid'],queues[_0x388d1c[_0x7ffa('0x4')]][_0x7ffa('0x1e')],queues[_0x388d1c[_0x7ffa('0x4')]][_0x7ffa('0x67')]));}}catch(_0x29d4f9){utils[_0x7ffa('0x2d')](util['format'](_0x7ffa('0x69'),_0x388d1c[_0x7ffa('0x4')]),_0x29d4f9);}};exports[_0x7ffa('0x6a')]=function(_0x1d958d){try{if(!_[_0x7ffa('0x22')](queues[_0x1d958d[_0x7ffa('0x4')]])){if(!_[_0x7ffa('0x22')](queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x67')])){utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')]('[%s][queues][musiconholdstop]',_0x1d958d[_0x7ffa('0x4')]),_0x1d958d);queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x5d')]+=utils['diffTime'](utils['now'](),queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x67')]);utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x6b'),_0x1d958d[_0x7ffa('0x4')],queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x1e')],queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x5d')]));delete queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x67')];}}}catch(_0xfe9f5){utils['error'](util[_0x7ffa('0x2')](_0x7ffa('0x6c'),_0x1d958d[_0x7ffa('0x4')]),_0xfe9f5);}}; \ No newline at end of file +var _0xada5=['value','CONTINUE','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','holdtime','queuecallerjoinAt','position','count','connectedlinenum','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus'];(function(_0x260c7b,_0x42302b){var _0x28370c=function(_0x52d407){while(--_0x52d407){_0x260c7b['push'](_0x260c7b['shift']());}};_0x28370c(++_0x42302b);}(_0xada5,0x110));var _0x5ada=function(_0x2e4ee7,_0x4bdc11){_0x2e4ee7=_0x2e4ee7-0x0;var _0x49e2e8=_0xada5[_0x2e4ee7];return _0x49e2e8;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x5ada('0x0'));var queues={};function writeDB(_0x3e9153){utils[_0x5ada('0x1')](util['format'](_0x5ada('0x2'),_0x3e9153[_0x5ada('0x3')],_0x3e9153[_0x5ada('0x4')],_0x3e9153[_0x5ada('0x5')],_0x3e9153[_0x5ada('0x6')],_0x3e9153[_0x5ada('0x7')],_0x3e9153[_0x5ada('0x8')],_0x3e9153[_0x5ada('0x9')]));if(_0x3e9153['queue']){utils[_0x5ada('0xa')](_0x3e9153[_0x5ada('0x5')])[_0x5ada('0xb')](function(_0xa557c7){if(_0xa557c7){_0x3e9153[_0x5ada('0xc')]=_0xa557c7[_0x5ada('0xc')];}utils[_0x5ada('0xd')](_0x5ada('0xe'),_0x3e9153);});}else{utils[_0x5ada('0xd')](_0x5ada('0xe'),_0x3e9153);}if(_0x3e9153[_0x5ada('0xf')]){delete queues[_0x3e9153[_0x5ada('0xf')]];}else{delete queues[_0x3e9153[_0x5ada('0x3')]];}}exports[_0x5ada('0x10')]=function(_0x455369){try{utils[_0x5ada('0x11')](util[_0x5ada('0x12')](_0x5ada('0x13'),_0x455369[_0x5ada('0x3')]),_0x455369);utils[_0x5ada('0x1')](util[_0x5ada('0x12')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x455369['uniqueid'],_0x455369[_0x5ada('0x5')],_0x455369['position']));queues[_0x455369['uniqueid']]=_[_0x5ada('0x14')](_0x455369,{'originalposition':_0x455369['position'],'queuecallerjoinAt':utils[_0x5ada('0x15')](),'mohtime':0x0});}catch(_0x30d79d){utils[_0x5ada('0x16')](util['format'](_0x5ada('0x13'),_0x455369[_0x5ada('0x3')]),_0x30d79d);}};exports[_0x5ada('0x17')]=function(_0x1e9703){try{if(!_[_0x5ada('0x18')](queues[_0x1e9703[_0x5ada('0x3')]])){utils[_0x5ada('0x11')](util[_0x5ada('0x12')](_0x5ada('0x19'),_0x1e9703['uniqueid']),_0x1e9703);if(queues[_0x1e9703[_0x5ada('0x3')]]['queuecallerleaveAt']){if(!queues[_0x1e9703[_0x5ada('0x3')]][_0x5ada('0x1a')]&&!queues[_0x1e9703[_0x5ada('0x3')]]['queuecallerexit']){queues[_0x1e9703[_0x5ada('0x3')]][_0x5ada('0x1b')]=!![];queues[_0x1e9703[_0x5ada('0x3')]][_0x5ada('0x1c')]=utils['now']();queues[_0x1e9703[_0x5ada('0x3')]][_0x5ada('0x9')]=_0x5ada('0x1d');}utils['info'](util['format'](_0x5ada('0x1e'),_0x1e9703[_0x5ada('0x3')],queues[_0x1e9703[_0x5ada('0x3')]][_0x5ada('0x1f')],queues[_0x1e9703[_0x5ada('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x1e9703[_0x5ada('0x3')]]);}else if(queues[_0x1e9703['uniqueid']][_0x5ada('0xf')]){utils[_0x5ada('0x1')](util[_0x5ada('0x12')](_0x5ada('0x20'),_0x1e9703[_0x5ada('0x3')],queues[_0x1e9703[_0x5ada('0x3')]][_0x5ada('0x1f')],queues[_0x1e9703['uniqueid']][_0x5ada('0xf')]));queues[queues[_0x1e9703[_0x5ada('0x3')]][_0x5ada('0xf')]]=queues[_0x1e9703[_0x5ada('0x3')]];queues[queues[_0x1e9703[_0x5ada('0x3')]]['transfereduniqueid']][_0x5ada('0x21')]=0x2;delete queues[_0x1e9703[_0x5ada('0x3')]];}}}catch(_0x43884f){utils['error'](util[_0x5ada('0x12')](_0x5ada('0x19'),_0x1e9703['uniqueid']),_0x43884f);}};exports['varset']=function(_0x1d45c7){try{utils['debug'](util[_0x5ada('0x12')](_0x5ada('0x22'),_0x1d45c7[_0x5ada('0x3')]),_0x1d45c7);if(!_[_0x5ada('0x18')](_0x1d45c7[_0x5ada('0x23')][_0x5ada('0x24')])&&_0x1d45c7[_0x5ada('0x25')]['toUpperCase']()!==_0x5ada('0x26')){if(!_[_0x5ada('0x18')](queues[_0x1d45c7[_0x5ada('0x3')]])){queues[_0x1d45c7['uniqueid']][_0x5ada('0x1a')]=![];queues[_0x1d45c7['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1d45c7[_0x5ada('0x3')]][_0x5ada('0x27')]=!![];queues[_0x1d45c7[_0x5ada('0x3')]][_0x5ada('0x28')]=utils[_0x5ada('0x15')]();queues[_0x1d45c7[_0x5ada('0x3')]][_0x5ada('0x9')]=_0x1d45c7['value']['toUpperCase']();utils[_0x5ada('0x1')](util[_0x5ada('0x12')](_0x5ada('0x29'),_0x1d45c7['uniqueid'],queues[_0x1d45c7[_0x5ada('0x3')]][_0x5ada('0x1f')],_0x1d45c7[_0x5ada('0x25')],queues[_0x1d45c7[_0x5ada('0x3')]][_0x5ada('0x9')]));writeDB(queues[_0x1d45c7['uniqueid']]);}}else if(!_[_0x5ada('0x18')](_0x1d45c7[_0x5ada('0x23')][_0x5ada('0x2a')])){if(!_[_0x5ada('0x18')](queues[_0x1d45c7[_0x5ada('0x3')]])&&!queues[_0x1d45c7[_0x5ada('0x3')]]['queuecallerabandon']){queues[_0x1d45c7[_0x5ada('0x3')]][_0x5ada('0x1a')]=![];queues[_0x1d45c7[_0x5ada('0x3')]][_0x5ada('0x2b')]=null;queues[_0x1d45c7['uniqueid']]['queuecallerexit']=!![];queues[_0x1d45c7['uniqueid']]['queuecallerexitAt']=utils[_0x5ada('0x15')]();queues[_0x1d45c7[_0x5ada('0x3')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x5ada('0x1')](util['format'](_0x5ada('0x2c'),_0x1d45c7[_0x5ada('0x3')],queues[_0x1d45c7['uniqueid']][_0x5ada('0x1f')],_0x1d45c7[_0x5ada('0x25')],queues[_0x1d45c7[_0x5ada('0x3')]][_0x5ada('0x9')]));}}}catch(_0x340235){utils[_0x5ada('0x16')](util[_0x5ada('0x12')](_0x5ada('0x22'),_0x1d45c7['uniqueid']),_0x340235);}};exports[_0x5ada('0x1a')]=function(_0xf85f32){try{if(!_[_0x5ada('0x18')](queues[_0xf85f32['uniqueid']])){utils['debug'](util[_0x5ada('0x12')](_0x5ada('0x2d'),_0xf85f32['uniqueid']),_0xf85f32);queues[_0xf85f32['uniqueid']]['queuecallerexit']=![];queues[_0xf85f32[_0x5ada('0x3')]][_0x5ada('0x28')]=null;queues[_0xf85f32[_0x5ada('0x3')]]['queuecallerabandon']=!![];queues[_0xf85f32[_0x5ada('0x3')]][_0x5ada('0x2b')]=utils[_0x5ada('0x15')]();queues[_0xf85f32[_0x5ada('0x3')]][_0x5ada('0x9')]='ABANDONED';utils['info'](util['format'](_0x5ada('0x2e'),_0xf85f32[_0x5ada('0x3')],queues[_0xf85f32['uniqueid']]['name'],queues[_0xf85f32['uniqueid']][_0x5ada('0x9')]));}}catch(_0x246fd8){utils[_0x5ada('0x16')](util['format'](_0x5ada('0x2d'),_0xf85f32[_0x5ada('0x3')]),_0x246fd8);}};exports[_0x5ada('0x2f')]=function(_0x170555){try{if(!_[_0x5ada('0x18')](queues[_0x170555[_0x5ada('0x3')]])){utils[_0x5ada('0x11')](util[_0x5ada('0x12')]('[%s][queues][queuecallerleave]',_0x170555[_0x5ada('0x3')]),_0x170555);utils['info'](util[_0x5ada('0x12')](_0x5ada('0x30'),_0x170555[_0x5ada('0x3')],queues[_0x170555['uniqueid']][_0x5ada('0x1f')],_0x170555['connectedlinenum'],_0x170555[_0x5ada('0x31')]));queues[_0x170555[_0x5ada('0x3')]]['queuecallerleave']=!![];queues[_0x170555[_0x5ada('0x3')]][_0x5ada('0x32')]=utils[_0x5ada('0x15')]();queues[_0x170555[_0x5ada('0x3')]][_0x5ada('0x33')]=utils['diffTime'](queues[_0x170555['uniqueid']]['queuecallerleaveAt'],queues[_0x170555[_0x5ada('0x3')]][_0x5ada('0x34')]);queues[_0x170555[_0x5ada('0x3')]][_0x5ada('0x35')]=_0x170555[_0x5ada('0x35')];queues[_0x170555[_0x5ada('0x3')]][_0x5ada('0x36')]=_0x170555['count'];queues[_0x170555[_0x5ada('0x3')]][_0x5ada('0x37')]=_0x170555[_0x5ada('0x37')];queues[_0x170555[_0x5ada('0x3')]][_0x5ada('0x31')]=_0x170555[_0x5ada('0x31')];}}catch(_0x58f450){utils[_0x5ada('0x16')](util[_0x5ada('0x12')](_0x5ada('0x38'),_0x170555[_0x5ada('0x3')]),_0x58f450);}};exports[_0x5ada('0x39')]=function(_0x46b840){try{if(!_[_0x5ada('0x18')](queues[_0x46b840['uniqueid']])){utils[_0x5ada('0x11')](util[_0x5ada('0x12')]('[%s][queues][agentconnect]',_0x46b840[_0x5ada('0x3')]),_0x46b840);utils[_0x5ada('0x1')](util[_0x5ada('0x12')](_0x5ada('0x3a'),_0x46b840[_0x5ada('0x3')],queues[_0x46b840[_0x5ada('0x3')]][_0x5ada('0x1f')],_0x46b840[_0x5ada('0x3b')],_0x46b840[_0x5ada('0x3c')]));queues[_0x46b840[_0x5ada('0x3')]]['queuecallerabandon']=![];queues[_0x46b840[_0x5ada('0x3')]]['queuecallerabandon']=![];queues[_0x46b840['uniqueid']][_0x5ada('0x2b')]=null;queues[_0x46b840[_0x5ada('0x3')]][_0x5ada('0x27')]=![];queues[_0x46b840['uniqueid']][_0x5ada('0x9')]=null;queues[_0x46b840[_0x5ada('0x3')]][_0x5ada('0x28')]=null;queues[_0x46b840['uniqueid']]['assigned']=!![];queues[_0x46b840[_0x5ada('0x3')]][_0x5ada('0x8')]=_0x46b840[_0x5ada('0x3c')];queues[_0x46b840[_0x5ada('0x3')]][_0x5ada('0x6')]=_0x46b840[_0x5ada('0x3b')];}}catch(_0x37ad5a){utils[_0x5ada('0x16')](util[_0x5ada('0x12')](_0x5ada('0x3d'),_0x46b840[_0x5ada('0x3')]),_0x37ad5a);}};exports['agentcomplete']=function(_0xf9df9d){try{if(!_['isNil'](queues[_0xf9df9d[_0x5ada('0x3')]])){if(queues[_0xf9df9d[_0x5ada('0x3')]][_0x5ada('0x32')]){utils[_0x5ada('0x11')](util[_0x5ada('0x12')](_0x5ada('0x3e'),_0xf9df9d['uniqueid']),_0xf9df9d);queues[_0xf9df9d['uniqueid']][_0x5ada('0x1a')]=![];queues[_0xf9df9d[_0x5ada('0x3')]][_0x5ada('0x1a')]=![];queues[_0xf9df9d['uniqueid']][_0x5ada('0x2b')]=null;queues[_0xf9df9d['uniqueid']][_0x5ada('0x27')]=![];queues[_0xf9df9d['uniqueid']][_0x5ada('0x28')]=null;queues[_0xf9df9d[_0x5ada('0x3')]][_0x5ada('0x3f')]=!![];queues[_0xf9df9d[_0x5ada('0x3')]]['lastAssignedTo']=_0xf9df9d[_0x5ada('0x3b')];queues[_0xf9df9d[_0x5ada('0x3')]][_0x5ada('0x1b')]=!![];queues[_0xf9df9d[_0x5ada('0x3')]][_0x5ada('0x1c')]=utils[_0x5ada('0x15')]();if(_0xf9df9d[_0x5ada('0x40')]==_0x5ada('0x41')){if(!queues[_0xf9df9d['uniqueid']][_0x5ada('0x41')]){queues[_0xf9df9d['uniqueid']][_0x5ada('0x9')]=_0x5ada('0x42');}}else{queues[_0xf9df9d[_0x5ada('0x3')]][_0x5ada('0x9')]=_0x5ada('0x43')+_0xf9df9d[_0x5ada('0x40')]['toUpperCase']();}utils[_0x5ada('0x1')](util[_0x5ada('0x12')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xf9df9d[_0x5ada('0x3')],queues[_0xf9df9d['uniqueid']][_0x5ada('0x1f')],_0xf9df9d['membername'],queues[_0xf9df9d[_0x5ada('0x3')]]['queuecallerexitreason']));writeDB(queues[_0xf9df9d['uniqueid']]);}}}catch(_0x5ce2d1){utils[_0x5ada('0x16')](util[_0x5ada('0x12')](_0x5ada('0x3e'),_0xf9df9d[_0x5ada('0x3')]),_0x5ce2d1);}};exports[_0x5ada('0x44')]=function(_0x3f8694){try{if(!_[_0x5ada('0x18')](queues[_0x3f8694[_0x5ada('0x45')]])){utils[_0x5ada('0x11')](util['format'](_0x5ada('0x46'),_0x3f8694[_0x5ada('0x3')]),_0x3f8694);queues[_0x3f8694[_0x5ada('0x45')]][_0x5ada('0x41')]=!![];queues[_0x3f8694[_0x5ada('0x45')]][_0x5ada('0x47')]='BLIND';queues[_0x3f8694[_0x5ada('0x45')]]['transferexten']=_0x3f8694['extension'];queues[_0x3f8694[_0x5ada('0x45')]][_0x5ada('0x48')]=_0x3f8694[_0x5ada('0x45')];queues[_0x3f8694[_0x5ada('0x45')]]['queuecallerexitreason']=_0x5ada('0x49');utils[_0x5ada('0x1')](util[_0x5ada('0x12')](_0x5ada('0x4a'),_0x3f8694[_0x5ada('0x3')],queues[_0x3f8694['transfereeuniqueid']]['name'],_0x3f8694[_0x5ada('0x45')],_0x3f8694['extension']));}}catch(_0x1adba7){utils[_0x5ada('0x16')](util[_0x5ada('0x12')](_0x5ada('0x46'),_0x3f8694[_0x5ada('0x3')]),_0x1adba7);}};exports[_0x5ada('0x4b')]=function(_0x216177){try{utils[_0x5ada('0x11')](util['format'](_0x5ada('0x4c'),_0x216177[_0x5ada('0x4d')]),_0x216177);if(_0x216177['origtransfereruniqueid']==_0x216177[_0x5ada('0x4e')]){if(!_[_0x5ada('0x18')](queues[_0x216177[_0x5ada('0x4f')]])){utils['info'](util[_0x5ada('0x12')](_0x5ada('0x50'),_0x216177['origtransfereruniqueid'],queues[_0x216177['secondtransfererlinkedid']][_0x5ada('0x1f')],_0x216177['origtransfererexten']));queues[_0x216177[_0x5ada('0x4f')]][_0x5ada('0x41')]=!![];queues[_0x216177[_0x5ada('0x4f')]]['transfertype']=_0x5ada('0x51');queues[_0x216177['secondtransfererlinkedid']][_0x5ada('0x52')]=_0x216177['origtransfererexten'];queues[_0x216177[_0x5ada('0x4f')]]['transferuniqueid']=_0x216177[_0x5ada('0x4d')];queues[_0x216177[_0x5ada('0x4f')]][_0x5ada('0x9')]=_0x5ada('0x53');}if(!_['isNil'](queues[_0x216177[_0x5ada('0x4e')]])){if(_0x216177[_0x5ada('0x54')]&&queues[_0x216177[_0x5ada('0x54')]]){queues[_0x216177[_0x5ada('0x54')]][_0x5ada('0x21')]=0x1;queues[_0x216177[_0x5ada('0x45')]]=_['clone'](queues[_0x216177['transfereelinkedid']]);queues[_0x216177['transfereeuniqueid']]['transfereduniqueid']=_0x216177[_0x5ada('0x55')];queues[_0x216177[_0x5ada('0x45')]][_0x5ada('0x21')]=0x2;queues[_0x216177['transfereeuniqueid']][_0x5ada('0x7')]=queues[_0x216177[_0x5ada('0x4f')]]['calleridnum'];queues[_0x216177['transfereeuniqueid']][_0x5ada('0x56')]=queues[_0x216177[_0x5ada('0x4f')]]['calleridname'];queues[_0x216177['transfereeuniqueid']][_0x5ada('0x34')]=utils[_0x5ada('0x15')]();queues[_0x216177[_0x5ada('0x45')]]['queuecallerleaveAt']=utils[_0x5ada('0x15')]();queues[_0x216177['transfereeuniqueid']][_0x5ada('0x33')]=0x0;queues[_0x216177[_0x5ada('0x45')]][_0x5ada('0x57')]=0x0;utils[_0x5ada('0x1')](util[_0x5ada('0x12')](_0x5ada('0x58'),_0x216177[_0x5ada('0x4d')],queues[_0x216177[_0x5ada('0x45')]][_0x5ada('0x1f')],queues[_0x216177[_0x5ada('0x45')]]['calleridnum'],queues[_0x216177[_0x5ada('0x45')]][_0x5ada('0x56')]));}else{utils[_0x5ada('0x1')](util['format'](_0x5ada('0x59'),_0x216177['origtransfereruniqueid'],queues[_0x216177[_0x5ada('0x4e')]]['name'],_0x216177[_0x5ada('0x4f')]));queues[_0x216177['origtransfererlinkedid']]['transfereduniqueid']=_0x216177[_0x5ada('0x4f')];}}}else if(_0x216177['secondtransfereruniqueid']==_0x216177['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x216177[_0x5ada('0x4e')]])){utils[_0x5ada('0x1')](util[_0x5ada('0x12')](_0x5ada('0x5a'),_0x216177['origtransfereruniqueid'],queues[_0x216177[_0x5ada('0x4e')]]['name'],_0x216177[_0x5ada('0x5b')],_0x216177[_0x5ada('0x5c')]));queues[_0x216177[_0x5ada('0x4e')]]['transfer']=!![];queues[_0x216177['origtransfererlinkedid']][_0x5ada('0x47')]='ATTENDED';queues[_0x216177['origtransfererlinkedid']][_0x5ada('0x52')]=_0x216177['secondtransfererexten'];queues[_0x216177[_0x5ada('0x4e')]][_0x5ada('0x48')]=_0x216177[_0x5ada('0x5b')];queues[_0x216177[_0x5ada('0x4e')]][_0x5ada('0x9')]=_0x5ada('0x53');}if(!_['isNil'](queues[_0x216177[_0x5ada('0x4f')]])){if(_0x216177['transfertargetlinkedid']&&queues[_0x216177[_0x5ada('0x5d')]]){queues[_0x216177[_0x5ada('0x5d')]][_0x5ada('0x21')]=0x1;queues[_0x216177[_0x5ada('0x55')]]=_['clone'](queues[_0x216177['transfertargetlinkedid']]);queues[_0x216177[_0x5ada('0x55')]]['transfereduniqueid']=_0x216177[_0x5ada('0x55')];queues[_0x216177[_0x5ada('0x55')]][_0x5ada('0x21')]=0x2;queues[_0x216177['transfertargetuniqueid']]['calleridnum']=queues[_0x216177['origtransfererlinkedid']][_0x5ada('0x7')];queues[_0x216177[_0x5ada('0x55')]]['calleridname']=queues[_0x216177[_0x5ada('0x4e')]][_0x5ada('0x56')];queues[_0x216177[_0x5ada('0x55')]][_0x5ada('0x34')]=utils['now']();queues[_0x216177[_0x5ada('0x55')]][_0x5ada('0x32')]=utils['now']();queues[_0x216177['transfertargetuniqueid']][_0x5ada('0x33')]=0x0;queues[_0x216177[_0x5ada('0x55')]]['mohtime']=0x0;utils[_0x5ada('0x1')](util[_0x5ada('0x12')](_0x5ada('0x5e'),_0x216177['origtransfereruniqueid'],queues[_0x216177['transfertargetuniqueid']][_0x5ada('0x1f')],queues[_0x216177[_0x5ada('0x55')]][_0x5ada('0xf')],queues[_0x216177[_0x5ada('0x55')]][_0x5ada('0x7')],queues[_0x216177[_0x5ada('0x55')]][_0x5ada('0x56')]));}else{utils[_0x5ada('0x1')](util['format'](_0x5ada('0x59'),_0x216177[_0x5ada('0x4d')],queues[_0x216177[_0x5ada('0x4f')]]['name'],_0x216177[_0x5ada('0x4e')]));queues[_0x216177['secondtransfererlinkedid']]['transfereduniqueid']=_0x216177[_0x5ada('0x4e')];}}}}catch(_0x329343){utils['error'](util[_0x5ada('0x12')](_0x5ada('0x4c'),_0x216177[_0x5ada('0x4d')]),_0x329343);}};exports[_0x5ada('0x5f')]=function(_0x348763){try{if(!_[_0x5ada('0x18')](queues[_0x348763[_0x5ada('0x3')]])){utils[_0x5ada('0x11')](util[_0x5ada('0x12')](_0x5ada('0x60'),_0x348763['uniqueid']),_0x348763);queues[_0x348763['uniqueid']][_0x5ada('0x61')]=utils[_0x5ada('0x15')]();utils['info'](util[_0x5ada('0x12')](_0x5ada('0x62'),_0x348763[_0x5ada('0x3')],queues[_0x348763[_0x5ada('0x3')]][_0x5ada('0x1f')],queues[_0x348763[_0x5ada('0x3')]][_0x5ada('0x61')]));}}catch(_0x67ff59){utils[_0x5ada('0x16')](util[_0x5ada('0x12')](_0x5ada('0x60'),_0x348763['uniqueid']),_0x67ff59);}};exports[_0x5ada('0x63')]=function(_0x148275){try{if(!_['isNil'](queues[_0x148275[_0x5ada('0x3')]])){if(!_[_0x5ada('0x18')](queues[_0x148275['uniqueid']]['musiconholdstartAt'])){utils[_0x5ada('0x11')](util['format']('[%s][queues][musiconholdstop]',_0x148275[_0x5ada('0x3')]),_0x148275);queues[_0x148275[_0x5ada('0x3')]][_0x5ada('0x57')]+=utils[_0x5ada('0x64')](utils[_0x5ada('0x15')](),queues[_0x148275[_0x5ada('0x3')]][_0x5ada('0x61')]);utils['info'](util[_0x5ada('0x12')](_0x5ada('0x65'),_0x148275['uniqueid'],queues[_0x148275[_0x5ada('0x3')]]['name'],queues[_0x148275['uniqueid']]['mohtime']));delete queues[_0x148275[_0x5ada('0x3')]][_0x5ada('0x61')];}}}catch(_0x740135){utils[_0x5ada('0x16')](util[_0x5ada('0x12')](_0x5ada('0x66'),_0x148275['uniqueid']),_0x740135);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index fddbf2d..699ec3b 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 _0xa52f=['transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','isNil','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','monitors','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','[%s][recordings][writeDB]','uniqueid','blinds'];(function(_0x537893,_0x23e5bd){var _0x265c06=function(_0x59ab4f){while(--_0x59ab4f){_0x537893['push'](_0x537893['shift']());}};_0x265c06(++_0x23e5bd);}(_0xa52f,0xd1));var _0xfa52=function(_0x3da955,_0x26dd20){_0x3da955=_0x3da955-0x0;var _0x2c57ba=_0xa52f[_0x3da955];return _0x2c57ba;};'use strict';var _=require(_0xfa52('0x0'));var util=require(_0xfa52('0x1'));var utils=require(_0xfa52('0x2'));var transfers=require(_0xfa52('0x3'));var recordings={};function writeDB(_0x55dacf){var _0x2c3209;utils['info'](util['format'](_0xfa52('0x4'),_0x55dacf[_0xfa52('0x5')]));if(transfers['blinds'][_0x55dacf['uniqueid']]){_0x2c3209=_0x55dacf[_0xfa52('0x5')];_0x55dacf[_0xfa52('0x5')]=transfers[_0xfa52('0x6')][_0x55dacf['uniqueid']][_0xfa52('0x7')];}if(_0x55dacf[_0xfa52('0x8')]){utils[_0xfa52('0x9')](_0x55dacf[_0xfa52('0x8')])[_0xfa52('0xa')](function(_0x5188ef){if(_0x5188ef){_0x55dacf[_0xfa52('0xb')]=_0x5188ef[_0xfa52('0xc')];_0x55dacf[_0xfa52('0xd')]=_0x5188ef['id'];}utils[_0xfa52('0xe')](_0xfa52('0xf'),_0x55dacf);});}else{utils[_0xfa52('0xe')]('CreateVoiceRecording',_0x55dacf);}if(_0x2c3209)delete transfers['blinds'][_0x2c3209];}exports[_0xfa52('0x10')]=function(_0x5e7dae){try{utils[_0xfa52('0x11')](util['format'](_0xfa52('0x12'),_0x5e7dae[_0xfa52('0x5')]),_0x5e7dae);if(_0x5e7dae[_0xfa52('0x5')]==_0x5e7dae[_0xfa52('0x13')]){utils[_0xfa52('0x14')](util[_0xfa52('0x15')](_0xfa52('0x16'),_0x5e7dae[_0xfa52('0x5')],_0x5e7dae[_0xfa52('0x17')],_0x5e7dae[_0xfa52('0x18')]));recordings[_0x5e7dae[_0xfa52('0x5')]]={'uniqueid':_0x5e7dae[_0xfa52('0x5')],'accountcode':_0x5e7dae[_0xfa52('0x8')],'exten':_0x5e7dae[_0xfa52('0x18')],'context':_0x5e7dae['context'],'channel':_0x5e7dae['channel'],'monitors':[]};}}catch(_0x249fb7){utils[_0xfa52('0x19')](util[_0xfa52('0x15')](_0xfa52('0x12'),_0x5e7dae[_0xfa52('0x5')]),_0x249fb7);}};exports[_0xfa52('0x1a')]=function(_0xa03a9c){try{utils[_0xfa52('0x11')](util[_0xfa52('0x15')](_0xfa52('0x1b'),_0xa03a9c[_0xfa52('0x5')]),_0xa03a9c);if(!_['isNil'](recordings[_0xa03a9c[_0xfa52('0x5')]])&&_0xa03a9c[_0xfa52('0x1c')]==0x6){utils[_0xfa52('0x14')](util[_0xfa52('0x15')](_0xfa52('0x1d'),_0xa03a9c[_0xfa52('0x5')],_0xa03a9c[_0xfa52('0x17')],_0xa03a9c[_0xfa52('0x1e')]));}else if(!_[_0xfa52('0x1f')](recordings[_0xa03a9c[_0xfa52('0x13')]])&&_0xa03a9c[_0xfa52('0x1c')]==0x6&&_0xa03a9c[_0xfa52('0x17')]!='transfer'){utils[_0xfa52('0x14')](util['format'](_0xfa52('0x20'),_0xa03a9c['uniqueid'],_0xa03a9c[_0xfa52('0x13')],_0xa03a9c[_0xfa52('0x17')],_0xa03a9c[_0xfa52('0x1e')]));recordings[_0xa03a9c[_0xfa52('0x13')]][_0xfa52('0x8')]=_0xa03a9c['accountcode'];}}catch(_0x5b128e){utils[_0xfa52('0x19')](util[_0xfa52('0x15')](_0xfa52('0x1b'),_0xa03a9c[_0xfa52('0x5')]),_0x5b128e);}};exports[_0xfa52('0x21')]=function(_0x5b9eef){try{if(!_[_0xfa52('0x1f')](_0x5b9eef[_0xfa52('0x22')])&&!_[_0xfa52('0x1f')](_0x5b9eef[_0xfa52('0x22')][_0xfa52('0x23')])){utils[_0xfa52('0x11')](util[_0xfa52('0x15')](_0xfa52('0x24'),_0x5b9eef[_0xfa52('0x5')]),_0x5b9eef);utils['info'](util[_0xfa52('0x15')](_0xfa52('0x25'),_0x5b9eef[_0xfa52('0x5')],_0x5b9eef[_0xfa52('0x22')],_0x5b9eef[_0xfa52('0x26')]));if(_[_0xfa52('0x27')](_0x5b9eef[_0xfa52('0x26')],'.wav49')){_0x5b9eef['value']=_0x5b9eef[_0xfa52('0x26')][_0xfa52('0x28')](_0xfa52('0x29'),_0xfa52('0x2a'));}if(recordings[_0x5b9eef[_0xfa52('0x13')]]){var _0x2b86f6=_['find'](recordings[_0x5b9eef[_0xfa52('0x13')]][_0xfa52('0x2b')],{'value':_0x5b9eef[_0xfa52('0x26')]});if(_[_0xfa52('0x1f')](_0x2b86f6)){recordings[_0x5b9eef[_0xfa52('0x13')]][_0xfa52('0x2b')]['push']({'value':_0x5b9eef[_0xfa52('0x26')]});}}}}catch(_0x5a2b95){utils[_0xfa52('0x19')](util[_0xfa52('0x15')](_0xfa52('0x24'),_0x5b9eef[_0xfa52('0x5')]),_0x5a2b95);}};exports['hangup']=function(_0x1fcd9e){try{if(!_[_0xfa52('0x1f')](recordings[_0x1fcd9e['uniqueid']])){utils[_0xfa52('0x11')](util[_0xfa52('0x15')]('[%s][recordings][hangup]',_0x1fcd9e[_0xfa52('0x5')]),_0x1fcd9e);utils[_0xfa52('0x14')](util['format'](_0xfa52('0x2c'),_0x1fcd9e[_0xfa52('0x5')],_0x1fcd9e[_0xfa52('0x2d')],_0x1fcd9e['calleridname'],_0x1fcd9e[_0xfa52('0x2e')]));recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x2d')]=_0x1fcd9e[_0xfa52('0x2d')];recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x2f')]=_0x1fcd9e['calleridname'];recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x30')]=_0x1fcd9e[_0xfa52('0x30')];recordings[_0x1fcd9e[_0xfa52('0x5')]]['connectedlinename']=_0x1fcd9e['connectedlinename'];if(recordings[_0x1fcd9e[_0xfa52('0x5')]]['type']==_0xfa52('0x31')&&recordings[_0x1fcd9e['uniqueid']][_0xfa52('0x8')]){recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x30')]=recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x8')];recordings[_0x1fcd9e[_0xfa52('0x5')]]['connectedlinename']='';}recordings[_0x1fcd9e['uniqueid']][_0xfa52('0x2b')][_0xfa52('0x32')](function(_0x2fa6eb){var _0x3b9e31=_[_0xfa52('0x33')](recordings[_0x1fcd9e[_0xfa52('0x5')]]);_0x3b9e31[_0xfa52('0x26')]=_0x2fa6eb['value'];writeDB(_0x3b9e31);});delete recordings[_0x1fcd9e[_0xfa52('0x5')]];}}catch(_0x394e29){utils[_0xfa52('0x19')](util[_0xfa52('0x15')]('[%s][recordings][hangup]',_0x1fcd9e[_0xfa52('0x5')]),_0x394e29);}};exports[_0xfa52('0x34')]=function(_0x16973a){try{if(!_['isNil'](recordings[_0x16973a[_0xfa52('0x5')]])){utils[_0xfa52('0x11')](util[_0xfa52('0x15')](_0xfa52('0x35'),_0x16973a[_0xfa52('0x5')]),_0x16973a);utils[_0xfa52('0x14')](util[_0xfa52('0x15')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x16973a[_0xfa52('0x5')],_0x16973a[_0xfa52('0x36')],_0x16973a['appdata']));if(_0x16973a[_0xfa52('0x36')][_0xfa52('0x37')]()==_0xfa52('0x38')&&_[_0xfa52('0x39')](_0x16973a[_0xfa52('0x3a')][_0xfa52('0x37')](),_0xfa52('0x3b'))){var _0x267d1b=_0x16973a[_0xfa52('0x3a')]['split']('=');var _0x1ef383=_0x267d1b[0x0][_0xfa52('0x3c')](_0x267d1b[0x0]['lastIndexOf']('(')+0x1,_0x267d1b[0x0][_0xfa52('0x3d')](')'));var _0x50f6e=_0x267d1b[0x1];recordings[_0x16973a[_0xfa52('0x5')]][_0x1ef383]=_0x50f6e;}}}catch(_0x438093){utils['error'](util[_0xfa52('0x15')](_0xfa52('0x35'),_0x16973a[_0xfa52('0x5')]),_0x438093);}};exports[_0xfa52('0x3e')]=function(_0x59a2ab){try{if(!_[_0xfa52('0x1f')](recordings[_0x59a2ab[_0xfa52('0x5')]])){utils[_0xfa52('0x11')](util[_0xfa52('0x15')](_0xfa52('0x3f'),_0x59a2ab['uniqueid']),_0x59a2ab);utils[_0xfa52('0x14')](util[_0xfa52('0x15')](_0xfa52('0x40'),_0x59a2ab[_0xfa52('0x5')],_0x59a2ab['queue']));recordings[_0x59a2ab[_0xfa52('0x5')]][_0xfa52('0x41')]=_0x59a2ab[_0xfa52('0x41')];}}catch(_0x2ea8d5){utils['error'](util['format'](_0xfa52('0x3f'),_0x59a2ab['uniqueid']),_0x2ea8d5);}};exports['blindtransfer']=function(_0x257aef){try{utils[_0xfa52('0x11')](util[_0xfa52('0x15')]('[%s][recordings][blindtransfer]',_0x257aef[_0xfa52('0x5')]),_0x257aef);utils[_0xfa52('0x14')](util[_0xfa52('0x15')](_0xfa52('0x42'),_0x257aef['uniqueid'],_0x257aef[_0xfa52('0x43')],_0x257aef[_0xfa52('0x44')],_0x257aef[_0xfa52('0x45')],_0x257aef['transfereecalleridname']));if(recordings[_0x257aef[_0xfa52('0x46')]]&&transfers[_0xfa52('0x6')][_0x257aef[_0xfa52('0x46')]]){transfers[_0xfa52('0x6')][_0x257aef[_0xfa52('0x46')]][_0xfa52('0x47')]=!![];}}catch(_0x5054a6){utils[_0xfa52('0x19')](util[_0xfa52('0x15')]('[%s][recordings][blindtransfer]',_0x257aef[_0xfa52('0x5')]),_0x5054a6);}}; \ No newline at end of file +var _0x71ad=['monitors','push','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','application','toLowerCase','startsWith','cdr','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','membername','name','CreateVoiceRecording','request','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','find'];(function(_0x258531,_0x284013){var _0x36f6d2=function(_0x520698){while(--_0x520698){_0x258531['push'](_0x258531['shift']());}};_0x36f6d2(++_0x284013);}(_0x71ad,0x66));var _0xd71a=function(_0x3af09a,_0x15e419){_0x3af09a=_0x3af09a-0x0;var _0x13587f=_0x71ad[_0x3af09a];return _0x13587f;};'use strict';var _=require(_0xd71a('0x0'));var util=require(_0xd71a('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x1bedcb){var _0x23840d;utils[_0xd71a('0x2')](util[_0xd71a('0x3')](_0xd71a('0x4'),_0x1bedcb[_0xd71a('0x5')]));if(transfers[_0xd71a('0x6')][_0x1bedcb[_0xd71a('0x5')]]){_0x23840d=_0x1bedcb[_0xd71a('0x5')];_0x1bedcb[_0xd71a('0x5')]=transfers[_0xd71a('0x6')][_0x1bedcb[_0xd71a('0x5')]][_0xd71a('0x7')];}if(_0x1bedcb['accountcode']){utils[_0xd71a('0x8')](_0x1bedcb[_0xd71a('0x9')])['then'](function(_0x2c1fd1){if(_0x2c1fd1){_0x1bedcb[_0xd71a('0xa')]=_0x2c1fd1[_0xd71a('0xb')];_0x1bedcb['UserId']=_0x2c1fd1['id'];}utils['request'](_0xd71a('0xc'),_0x1bedcb);});}else{utils[_0xd71a('0xd')](_0xd71a('0xc'),_0x1bedcb);}if(_0x23840d)delete transfers[_0xd71a('0x6')][_0x23840d];}exports[_0xd71a('0xe')]=function(_0x374e6b){try{utils[_0xd71a('0xf')](util[_0xd71a('0x3')]('[%s][recordings][newchannel]',_0x374e6b['uniqueid']),_0x374e6b);if(_0x374e6b[_0xd71a('0x5')]==_0x374e6b[_0xd71a('0x10')]){utils['info'](util['format'](_0xd71a('0x11'),_0x374e6b[_0xd71a('0x5')],_0x374e6b[_0xd71a('0x12')],_0x374e6b[_0xd71a('0x13')]));recordings[_0x374e6b[_0xd71a('0x5')]]={'uniqueid':_0x374e6b[_0xd71a('0x5')],'accountcode':_0x374e6b[_0xd71a('0x9')],'exten':_0x374e6b[_0xd71a('0x13')],'context':_0x374e6b[_0xd71a('0x12')],'channel':_0x374e6b['channel'],'monitors':[]};}}catch(_0x2cc507){utils[_0xd71a('0x14')](util[_0xd71a('0x3')](_0xd71a('0x15'),_0x374e6b['uniqueid']),_0x2cc507);}};exports[_0xd71a('0x16')]=function(_0x93b45d){try{utils[_0xd71a('0xf')](util[_0xd71a('0x3')](_0xd71a('0x17'),_0x93b45d[_0xd71a('0x5')]),_0x93b45d);if(!_[_0xd71a('0x18')](recordings[_0x93b45d['uniqueid']])&&_0x93b45d[_0xd71a('0x19')]==0x6){utils['info'](util[_0xd71a('0x3')](_0xd71a('0x1a'),_0x93b45d['uniqueid'],_0x93b45d[_0xd71a('0x12')],_0x93b45d[_0xd71a('0x1b')]));}else if(!_[_0xd71a('0x18')](recordings[_0x93b45d[_0xd71a('0x10')]])&&_0x93b45d[_0xd71a('0x19')]==0x6&&_0x93b45d[_0xd71a('0x12')]!=_0xd71a('0x1c')){utils[_0xd71a('0x2')](util['format'](_0xd71a('0x1d'),_0x93b45d[_0xd71a('0x5')],_0x93b45d[_0xd71a('0x10')],_0x93b45d[_0xd71a('0x12')],_0x93b45d[_0xd71a('0x1b')]));recordings[_0x93b45d[_0xd71a('0x10')]][_0xd71a('0x9')]=_0x93b45d['accountcode'];}}catch(_0x318f8e){utils[_0xd71a('0x14')](util[_0xd71a('0x3')](_0xd71a('0x17'),_0x93b45d[_0xd71a('0x5')]),_0x318f8e);}};exports[_0xd71a('0x1e')]=function(_0x246f83){try{if(!_['isNil'](_0x246f83[_0xd71a('0x1f')])&&!_[_0xd71a('0x18')](_0x246f83[_0xd71a('0x1f')]['mixmonitor_filename'])){utils[_0xd71a('0xf')](util[_0xd71a('0x3')](_0xd71a('0x20'),_0x246f83[_0xd71a('0x5')]),_0x246f83);utils[_0xd71a('0x2')](util[_0xd71a('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x246f83['uniqueid'],_0x246f83['variable'],_0x246f83[_0xd71a('0x21')]));if(_[_0xd71a('0x22')](_0x246f83[_0xd71a('0x21')],_0xd71a('0x23'))){_0x246f83[_0xd71a('0x21')]=_0x246f83[_0xd71a('0x21')]['replace']('.wav49',_0xd71a('0x24'));}if(recordings[_0x246f83[_0xd71a('0x10')]]){var _0x118cbf=_[_0xd71a('0x25')](recordings[_0x246f83['linkedid']]['monitors'],{'value':_0x246f83[_0xd71a('0x21')]});if(_['isNil'](_0x118cbf)){recordings[_0x246f83[_0xd71a('0x10')]][_0xd71a('0x26')][_0xd71a('0x27')]({'value':_0x246f83['value']});}}}}catch(_0x5c44c1){utils[_0xd71a('0x14')](util['format'](_0xd71a('0x20'),_0x246f83['uniqueid']),_0x5c44c1);}};exports['hangup']=function(_0x1415a1){try{if(!_[_0xd71a('0x18')](recordings[_0x1415a1['uniqueid']])){utils[_0xd71a('0xf')](util[_0xd71a('0x3')]('[%s][recordings][hangup]',_0x1415a1[_0xd71a('0x5')]),_0x1415a1);utils['info'](util[_0xd71a('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1415a1[_0xd71a('0x5')],_0x1415a1[_0xd71a('0x28')],_0x1415a1['calleridname'],_0x1415a1[_0xd71a('0x29')]));recordings[_0x1415a1['uniqueid']][_0xd71a('0x28')]=_0x1415a1[_0xd71a('0x28')];recordings[_0x1415a1[_0xd71a('0x5')]][_0xd71a('0x2a')]=_0x1415a1[_0xd71a('0x2a')];recordings[_0x1415a1[_0xd71a('0x5')]][_0xd71a('0x2b')]=_0x1415a1[_0xd71a('0x2b')];recordings[_0x1415a1['uniqueid']][_0xd71a('0x2c')]=_0x1415a1['connectedlinename'];if(recordings[_0x1415a1[_0xd71a('0x5')]][_0xd71a('0x2d')]==_0xd71a('0x2e')&&recordings[_0x1415a1['uniqueid']][_0xd71a('0x9')]){recordings[_0x1415a1[_0xd71a('0x5')]]['connectedlinenum']=recordings[_0x1415a1[_0xd71a('0x5')]]['accountcode'];recordings[_0x1415a1[_0xd71a('0x5')]][_0xd71a('0x2c')]='';}recordings[_0x1415a1[_0xd71a('0x5')]][_0xd71a('0x26')][_0xd71a('0x2f')](function(_0x4417b1){var _0x298670=_['clone'](recordings[_0x1415a1[_0xd71a('0x5')]]);_0x298670['value']=_0x4417b1[_0xd71a('0x21')];writeDB(_0x298670);});delete recordings[_0x1415a1[_0xd71a('0x5')]];}}catch(_0x12d84c){utils[_0xd71a('0x14')](util[_0xd71a('0x3')](_0xd71a('0x30'),_0x1415a1['uniqueid']),_0x12d84c);}};exports[_0xd71a('0x31')]=function(_0x3b4f9b){try{if(!_[_0xd71a('0x18')](recordings[_0x3b4f9b[_0xd71a('0x5')]])){utils['debug'](util['format'](_0xd71a('0x32'),_0x3b4f9b['uniqueid']),_0x3b4f9b);utils[_0xd71a('0x2')](util[_0xd71a('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3b4f9b['uniqueid'],_0x3b4f9b[_0xd71a('0x33')],_0x3b4f9b['appdata']));if(_0x3b4f9b['application'][_0xd71a('0x34')]()=='set'&&_[_0xd71a('0x35')](_0x3b4f9b['appdata']['toLowerCase'](),_0xd71a('0x36'))){var _0x268d53=_0x3b4f9b[_0xd71a('0x37')][_0xd71a('0x38')]('=');var _0x9dcf30=_0x268d53[0x0][_0xd71a('0x39')](_0x268d53[0x0][_0xd71a('0x3a')]('(')+0x1,_0x268d53[0x0][_0xd71a('0x3a')](')'));var _0x4b41d3=_0x268d53[0x1];recordings[_0x3b4f9b[_0xd71a('0x5')]][_0x9dcf30]=_0x4b41d3;}}}catch(_0xd26b25){utils[_0xd71a('0x14')](util[_0xd71a('0x3')]('[%s][recordings][newexten]',_0x3b4f9b[_0xd71a('0x5')]),_0xd26b25);}};exports[_0xd71a('0x3b')]=function(_0x524d86){try{if(!_[_0xd71a('0x18')](recordings[_0x524d86[_0xd71a('0x5')]])){utils[_0xd71a('0xf')](util[_0xd71a('0x3')](_0xd71a('0x3c'),_0x524d86[_0xd71a('0x5')]),_0x524d86);utils[_0xd71a('0x2')](util['format'](_0xd71a('0x3d'),_0x524d86['uniqueid'],_0x524d86[_0xd71a('0x3e')]));recordings[_0x524d86[_0xd71a('0x5')]][_0xd71a('0x3e')]=_0x524d86[_0xd71a('0x3e')];}}catch(_0x5ed0e1){utils[_0xd71a('0x14')](util[_0xd71a('0x3')](_0xd71a('0x3c'),_0x524d86['uniqueid']),_0x5ed0e1);}};exports[_0xd71a('0x3f')]=function(_0x2460d2){try{utils[_0xd71a('0xf')](util[_0xd71a('0x3')](_0xd71a('0x40'),_0x2460d2[_0xd71a('0x5')]),_0x2460d2);utils['info'](util[_0xd71a('0x3')](_0xd71a('0x41'),_0x2460d2[_0xd71a('0x5')],_0x2460d2['transferercalleridnum'],_0x2460d2[_0xd71a('0x42')],_0x2460d2['transfereecalleridnum'],_0x2460d2[_0xd71a('0x43')]));if(recordings[_0x2460d2[_0xd71a('0x44')]]&&transfers['blinds'][_0x2460d2['transfereruniqueid']]){transfers['blinds'][_0x2460d2[_0xd71a('0x44')]][_0xd71a('0x45')]=!![];}}catch(_0x1760b8){utils[_0xd71a('0x14')](util['format'](_0xd71a('0x40'),_0x2460d2[_0xd71a('0x5')]),_0x1760b8);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index db8538a..2a459cf 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 _0x3d99=['origtransferercontext','origtransfererexten','transfereechannel','assign','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','blind','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0x57b4f2,_0x582a17){var _0x421370=function(_0x4c7c7c){while(--_0x4c7c7c){_0x57b4f2['push'](_0x57b4f2['shift']());}};_0x421370(++_0x582a17);}(_0x3d99,0x7f));var _0x93d9=function(_0xb69275,_0x59541e){_0xb69275=_0xb69275-0x0;var _0x310754=_0x3d99[_0xb69275];return _0x310754;};'use strict';var _=require(_0x93d9('0x0'));var util=require(_0x93d9('0x1'));var utils=require(_0x93d9('0x2'));function writeDB(_0x2723f0){utils[_0x93d9('0x3')](util[_0x93d9('0x4')](_0x93d9('0x5'),_0x2723f0['type']===_0x93d9('0x6')?_0x2723f0[_0x93d9('0x7')]:_0x2723f0[_0x93d9('0x8')],_0x2723f0[_0x93d9('0x9')]));utils[_0x93d9('0xa')](_0x93d9('0xb'),_0x2723f0);}exports['blinds']={};exports['blindtransfer']=function(_0x53e939){try{utils['debug'](util[_0x93d9('0x4')]('[%s][transfers][blindtransfer]',_0x53e939[_0x93d9('0x8')]),_0x53e939);utils['info'](util[_0x93d9('0x4')](_0x93d9('0xc'),_0x53e939['uniqueid'],_0x53e939['transferercalleridnum'],_0x53e939[_0x93d9('0xd')],_0x53e939[_0x93d9('0xe')],_0x53e939['transfereecalleridname']));_0x53e939[_0x93d9('0x9')]=_0x93d9('0xf');exports['blinds'][_0x53e939['transfereruniqueid']]=_0x53e939;writeDB(_0x53e939);}catch(_0x4e7481){utils['error'](util[_0x93d9('0x4')]('[%s][transfers][blindtransfer]',_0x53e939[_0x93d9('0x8')]),_0x4e7481);}};exports[_0x93d9('0x10')]=function(_0xfd727f){try{utils[_0x93d9('0x11')](util[_0x93d9('0x4')](_0x93d9('0x12'),_0xfd727f['origtransfereruniqueid']),_0xfd727f);utils['info'](util[_0x93d9('0x4')](_0x93d9('0x13'),_0xfd727f['origtransfereruniqueid'],_0xfd727f[_0x93d9('0x14')],_0xfd727f[_0x93d9('0x15')],_0xfd727f[_0x93d9('0x16')],_0xfd727f['transfertargetcalleridname']));_0xfd727f=_['assign'](_0xfd727f,{'transfererchannel':_0xfd727f[_0x93d9('0x17')],'transferercalleridnum':_0xfd727f[_0x93d9('0x14')],'transferercalleridname':_0xfd727f[_0x93d9('0x15')],'transfererconnectedlinenum':_0xfd727f[_0x93d9('0x18')],'transfererconnectedlinename':_0xfd727f[_0x93d9('0x19')],'transfereraccountcode':_0xfd727f['origtransfereraccountcode'],'transferercontext':_0xfd727f[_0x93d9('0x1a')],'transfererexten':_0xfd727f[_0x93d9('0x1b')],'transfererlinkedid':_0xfd727f[_0x93d9('0x1c')],'context':_0xfd727f[_0x93d9('0x1d')],'extension':_0xfd727f[_0x93d9('0x1e')],'type':_0x93d9('0x6')});if(_['isNil'](_0xfd727f[_0x93d9('0x1f')])){_0xfd727f=_[_0x93d9('0x20')](_0xfd727f,{'transfereechannel':_0xfd727f['transfertargetchannel'],'transfereecalleridnum':_0xfd727f[_0x93d9('0x16')],'transfereecalleridname':_0xfd727f[_0x93d9('0x21')],'transfereeconnectedlinenum':_0xfd727f[_0x93d9('0x22')],'transfereeconnectedlinename':_0xfd727f[_0x93d9('0x23')],'transfereeaccountcode':_0xfd727f['transfertargetaccountcode'],'transfereecontext':_0xfd727f[_0x93d9('0x24')],'transfereeexten':_0xfd727f[_0x93d9('0x25')],'transfereelinkedid':_0xfd727f[_0x93d9('0x26')]});}writeDB(_0xfd727f);}catch(_0x49f37f){utils['error'](util[_0x93d9('0x4')](_0x93d9('0x12'),_0xfd727f[_0x93d9('0x7')]),_0x49f37f);}}; \ No newline at end of file +var _0xc1c4=['format','origtransfereruniqueid','type','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info'];(function(_0x15beba,_0x58544e){var _0x1efd80=function(_0x24d036){while(--_0x24d036){_0x15beba['push'](_0x15beba['shift']());}};_0x1efd80(++_0x58544e);}(_0xc1c4,0x13c));var _0x4c1c=function(_0x20d715,_0x164618){_0x20d715=_0x20d715-0x0;var _0x1d0e77=_0xc1c4[_0x20d715];return _0x1d0e77;};'use strict';var _=require(_0x4c1c('0x0'));var util=require(_0x4c1c('0x1'));var utils=require(_0x4c1c('0x2'));function writeDB(_0x29ac33){utils[_0x4c1c('0x3')](util[_0x4c1c('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x29ac33['type']==='attended'?_0x29ac33[_0x4c1c('0x5')]:_0x29ac33['uniqueid'],_0x29ac33[_0x4c1c('0x6')]));utils['request']('CreateVoiceTransferReport',_0x29ac33);}exports[_0x4c1c('0x7')]={};exports[_0x4c1c('0x8')]=function(_0x478842){try{utils[_0x4c1c('0x9')](util[_0x4c1c('0x4')](_0x4c1c('0xa'),_0x478842[_0x4c1c('0xb')]),_0x478842);utils[_0x4c1c('0x3')](util[_0x4c1c('0x4')](_0x4c1c('0xc'),_0x478842[_0x4c1c('0xb')],_0x478842[_0x4c1c('0xd')],_0x478842[_0x4c1c('0xe')],_0x478842[_0x4c1c('0xf')],_0x478842[_0x4c1c('0x10')]));_0x478842[_0x4c1c('0x6')]=_0x4c1c('0x11');exports[_0x4c1c('0x7')][_0x478842[_0x4c1c('0x12')]]=_0x478842;writeDB(_0x478842);}catch(_0x5bb651){utils[_0x4c1c('0x13')](util[_0x4c1c('0x4')](_0x4c1c('0xa'),_0x478842[_0x4c1c('0xb')]),_0x5bb651);}};exports[_0x4c1c('0x14')]=function(_0x9a9534){try{utils[_0x4c1c('0x9')](util['format']('[%s][transfers][attendedtransfer]',_0x9a9534[_0x4c1c('0x5')]),_0x9a9534);utils['info'](util[_0x4c1c('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x9a9534['origtransfereruniqueid'],_0x9a9534[_0x4c1c('0x15')],_0x9a9534[_0x4c1c('0x16')],_0x9a9534[_0x4c1c('0x17')],_0x9a9534['transfertargetcalleridname']));_0x9a9534=_[_0x4c1c('0x18')](_0x9a9534,{'transfererchannel':_0x9a9534['origtransfererchannel'],'transferercalleridnum':_0x9a9534['origtransferercalleridnum'],'transferercalleridname':_0x9a9534[_0x4c1c('0x16')],'transfererconnectedlinenum':_0x9a9534[_0x4c1c('0x19')],'transfererconnectedlinename':_0x9a9534['secondtransfererconnectedlinename'],'transfereraccountcode':_0x9a9534[_0x4c1c('0x1a')],'transferercontext':_0x9a9534['secondtransferercontext'],'transfererexten':_0x9a9534[_0x4c1c('0x1b')],'transfererlinkedid':_0x9a9534[_0x4c1c('0x1c')],'context':_0x9a9534[_0x4c1c('0x1d')],'extension':_0x9a9534[_0x4c1c('0x1e')],'type':_0x4c1c('0x1f')});if(_['isNil'](_0x9a9534['transfereechannel'])){_0x9a9534=_[_0x4c1c('0x18')](_0x9a9534,{'transfereechannel':_0x9a9534[_0x4c1c('0x20')],'transfereecalleridnum':_0x9a9534['transfertargetcalleridnum'],'transfereecalleridname':_0x9a9534[_0x4c1c('0x21')],'transfereeconnectedlinenum':_0x9a9534[_0x4c1c('0x22')],'transfereeconnectedlinename':_0x9a9534[_0x4c1c('0x23')],'transfereeaccountcode':_0x9a9534[_0x4c1c('0x24')],'transfereecontext':_0x9a9534[_0x4c1c('0x25')],'transfereeexten':_0x9a9534[_0x4c1c('0x26')],'transfereelinkedid':_0x9a9534[_0x4c1c('0x27')]});}writeDB(_0x9a9534);}catch(_0x59e200){utils[_0x4c1c('0x13')](util[_0x4c1c('0x4')]('[%s][transfers][attendedtransfer]',_0x9a9534[_0x4c1c('0x5')]),_0x59e200);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2778578..80cd56e 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 _0x40bd=['internal','name','interface','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','seconds','now','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','GetUser'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x40bd,0x1d2));var _0xd40b=function(_0x5af4f0,_0x163be2){_0x5af4f0=_0x5af4f0-0x0;var _0x4eefac=_0x40bd[_0x5af4f0];return _0x4eefac;};'use strict';var BPromise=require(_0xd40b('0x0'));var jayson=require(_0xd40b('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xd40b('0x2')][_0xd40b('0x3')]({'port':0x2329});var logger=require(_0xd40b('0x4'))(_0xd40b('0x5'));exports[_0xd40b('0x6')]=function(_0x386c53,_0x299d82){logger[_0xd40b('0x6')](_0x386c53,_0x299d82?util['inspect'](_0x299d82,{'showHidden':![],'depth':null}):'');};exports[_0xd40b('0x7')]=function(_0x118b34,_0x19c798){logger['debug'](_0x118b34,_0x19c798?util[_0xd40b('0x8')](_0x19c798,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x74d181,_0x5bcb1b){logger[_0xd40b('0x9')](_0x74d181,_0x5bcb1b?util['inspect'](_0x5bcb1b,{'showHidden':![],'depth':null}):'');};exports[_0xd40b('0xa')]=function(_0x10c84b,_0x2ea678){return client['request'](_0x10c84b,{'body':_0x2ea678})[_0xd40b('0xb')](function(_0x4ecc11){logger[_0xd40b('0x7')](_0xd40b('0xc'),_0x10c84b,_0x4ecc11?util[_0xd40b('0x8')](_0x4ecc11,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x37bf2e){logger[_0xd40b('0x9')](_0xd40b('0xc'),_0x10c84b,_0x37bf2e?util[_0xd40b('0x8')](_0x37bf2e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2bfa79){return client[_0xd40b('0xa')](_0xd40b('0xd'),{'options':{'raw':!![],'attributes':['id',_0xd40b('0xe'),_0xd40b('0xf'),_0xd40b('0x10')],'where':_0x2bfa79,'limit':0x1}})[_0xd40b('0xb')](function(_0x4b70bb){logger[_0xd40b('0x7')]('[utils][getUser]\x20where:%s',JSON[_0xd40b('0x11')](_0x2bfa79),_0x4b70bb?util[_0xd40b('0x8')](_0x4b70bb,{'showHidden':![],'depth':null}):'');return _0x4b70bb[_0xd40b('0x12')]['length']?_0x4b70bb['result'][0x0]:null;});}exports[_0xd40b('0x13')]=function(_0x4e20e9){return new BPromise(function(_0x2d008d,_0x4c7689){if(_0x4e20e9){return getUser({'internal':_0x4e20e9})[_0xd40b('0xb')](function(_0x48c750){logger[_0xd40b('0x6')](_0xd40b('0x14'),_0x4e20e9,_0x48c750?'found':_0xd40b('0x15'));return _0x2d008d(_0x48c750);})[_0xd40b('0x16')](function(_0x26bab7){logger[_0xd40b('0x9')](_0xd40b('0x17'),_0x26bab7?util['inspect'](_0x26bab7,{'showHidden':![],'depth':null}):'');return _0x2d008d(null);});}return _0x2d008d(null);});};exports['getUserByInterface']=function(_0x346a90){return new BPromise(function(_0x20d9b5,_0x4f7dc8){if(_0x346a90){return getUser({'interface':_0x346a90})['then'](function(_0xa08de7){logger['info'](_0xd40b('0x18'),_0x346a90,_0xa08de7?_0xd40b('0x19'):'notfound');return _0x20d9b5(_0xa08de7);})[_0xd40b('0x16')](function(_0x1b02b7){logger[_0xd40b('0x9')]('[utils][getUserByInterface]',_0x1b02b7?util[_0xd40b('0x8')](_0x1b02b7,{'showHidden':![],'depth':null}):'');return _0x20d9b5(null);});}return _0x20d9b5(null);});};exports[_0xd40b('0x1a')]=function(_0x5cba5e){return new BPromise(function(_0x28e8fb,_0x217ee1){if(_0x5cba5e){return getUser({'name':_0x5cba5e})[_0xd40b('0xb')](function(_0x2980ac){logger[_0xd40b('0x6')](_0xd40b('0x1b'),_0x5cba5e,_0x2980ac?_0xd40b('0x19'):_0xd40b('0x15'));return _0x28e8fb(_0x2980ac);})[_0xd40b('0x16')](function(_0x3f2da6){logger['error'](_0xd40b('0x1c'),_0x3f2da6?util[_0xd40b('0x8')](_0x3f2da6,{'showHidden':![],'depth':null}):'');return _0x28e8fb(null);});}return _0x28e8fb(null);});};exports[_0xd40b('0x1d')]=function(_0x25f64b){return new BPromise(function(_0x1ca3f3,_0x3dc4e3){if(_0x25f64b){return client[_0xd40b('0xa')](_0xd40b('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xd40b('0xf'),_0xd40b('0x1f'),_0xd40b('0x20'),_0xd40b('0x21')],'where':{'name':_0x25f64b},'limit':0x1}})['then'](function(_0x2bbd1c){logger['debug'](_0xd40b('0x22'),_0x25f64b,_0x2bbd1c?util[_0xd40b('0x8')](_0x2bbd1c,{'showHidden':![],'depth':null}):'');logger[_0xd40b('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x25f64b,_0x2bbd1c?'found':_0xd40b('0x15'));return _0x1ca3f3(_0x2bbd1c[_0xd40b('0x12')][_0xd40b('0x23')]?_0x2bbd1c[_0xd40b('0x12')][0x0]:null);})[_0xd40b('0x16')](function(_0x13f738){logger[_0xd40b('0x9')](_0xd40b('0x24'),_0x13f738?util[_0xd40b('0x8')](_0x13f738,{'showHidden':![],'depth':null}):'');return _0x1ca3f3(null);});}return _0x1ca3f3(null);});};exports[_0xd40b('0x25')]=function(_0xf5f6a9,_0x3e3f76){return moment(_0xf5f6a9)['add'](_0x3e3f76,'seconds')[_0xd40b('0x26')](_0xd40b('0x27'));};exports[_0xd40b('0x28')]=function(_0x3b27a9,_0x4aa501){return moment(_0x3b27a9)[_0xd40b('0x29')](_0x4aa501,'seconds')[_0xd40b('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xd40b('0x2a')]=function(_0x1c2b40,_0x67c2d3){return moment(_0x1c2b40)[_0xd40b('0x2b')](moment(_0x67c2d3),_0xd40b('0x2c'));};exports['sumTime']=function(_0x2cecdd,_0x34422e){return parseInt(_0x2cecdd,0xa)+parseInt(_0x34422e,0xa);};exports[_0xd40b('0x2d')]=function(){return moment()['format'](_0xd40b('0x27'));};exports['isAfter']=function(_0x74f4ba,_0x2ef4a7){if(_0x2ef4a7){return moment(_0x74f4ba)[_0xd40b('0x2e')](_0x2ef4a7);}return!![];};exports[_0xd40b('0x2f')]=function(_0x58dc51,_0x53e10b){if(_0x53e10b){return moment(_0x58dc51)['isBefore'](_0x53e10b);}else if(_0x58dc51){return!![];}return![];}; \ No newline at end of file +var _0x0650=['[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','info','debug','error','request','then','[utils][request]\x20name:%s','inspect','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','catch','[utils][getUserByInternal]','getUserByInterface','found','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0650,0x1aa));var _0x0065=function(_0x40e906,_0x31cddc){_0x40e906=_0x40e906-0x0;var _0x5776d2=_0x0650[_0x40e906];return _0x5776d2;};'use strict';var BPromise=require(_0x0065('0x0'));var jayson=require(_0x0065('0x1'));var moment=require(_0x0065('0x2'));var util=require(_0x0065('0x3'));var client=jayson['client'][_0x0065('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x0065('0x5')]=function(_0xe2785,_0x185c29){logger['info'](_0xe2785,_0x185c29?util['inspect'](_0x185c29,{'showHidden':![],'depth':null}):'');};exports[_0x0065('0x6')]=function(_0x5792dc,_0x517b9f){logger['debug'](_0x5792dc,_0x517b9f?util['inspect'](_0x517b9f,{'showHidden':![],'depth':null}):'');};exports[_0x0065('0x7')]=function(_0x47d296,_0x14ce8a){logger[_0x0065('0x7')](_0x47d296,_0x14ce8a?util['inspect'](_0x14ce8a,{'showHidden':![],'depth':null}):'');};exports[_0x0065('0x8')]=function(_0x41e9de,_0x49ef12){return client['request'](_0x41e9de,{'body':_0x49ef12})[_0x0065('0x9')](function(_0x215ed5){logger[_0x0065('0x6')](_0x0065('0xa'),_0x41e9de,_0x215ed5?util['inspect'](_0x215ed5,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x243902){logger['error']('[utils][request]\x20name:%s',_0x41e9de,_0x243902?util[_0x0065('0xb')](_0x243902,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4a7b7e){return client[_0x0065('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0x0065('0xc'),_0x0065('0xd')],'where':_0x4a7b7e,'limit':0x1}})[_0x0065('0x9')](function(_0x4722bf){logger[_0x0065('0x6')](_0x0065('0xe'),JSON[_0x0065('0xf')](_0x4a7b7e),_0x4722bf?util[_0x0065('0xb')](_0x4722bf,{'showHidden':![],'depth':null}):'');return _0x4722bf['result'][_0x0065('0x10')]?_0x4722bf[_0x0065('0x11')][0x0]:null;});}exports[_0x0065('0x12')]=function(_0x16ecf8){return new BPromise(function(_0x20adaa,_0x9c1723){if(_0x16ecf8){return getUser({'internal':_0x16ecf8})[_0x0065('0x9')](function(_0xcf4ea1){logger[_0x0065('0x5')](_0x0065('0x13'),_0x16ecf8,_0xcf4ea1?'found':'notfound');return _0x20adaa(_0xcf4ea1);})[_0x0065('0x14')](function(_0x410ddc){logger[_0x0065('0x7')](_0x0065('0x15'),_0x410ddc?util[_0x0065('0xb')](_0x410ddc,{'showHidden':![],'depth':null}):'');return _0x20adaa(null);});}return _0x20adaa(null);});};exports[_0x0065('0x16')]=function(_0x59e771){return new BPromise(function(_0x385f49,_0x1ddd00){if(_0x59e771){return getUser({'interface':_0x59e771})[_0x0065('0x9')](function(_0x502c7a){logger[_0x0065('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x59e771,_0x502c7a?_0x0065('0x17'):_0x0065('0x18'));return _0x385f49(_0x502c7a);})[_0x0065('0x14')](function(_0x5578da){logger[_0x0065('0x7')](_0x0065('0x19'),_0x5578da?util[_0x0065('0xb')](_0x5578da,{'showHidden':![],'depth':null}):'');return _0x385f49(null);});}return _0x385f49(null);});};exports[_0x0065('0x1a')]=function(_0x181104){return new BPromise(function(_0x4cbd31,_0xc562ce){if(_0x181104){return getUser({'name':_0x181104})['then'](function(_0x46bb1c){logger[_0x0065('0x5')](_0x0065('0x1b'),_0x181104,_0x46bb1c?_0x0065('0x17'):_0x0065('0x18'));return _0x4cbd31(_0x46bb1c);})[_0x0065('0x14')](function(_0x5d04ca){logger[_0x0065('0x7')](_0x0065('0x1c'),_0x5d04ca?util[_0x0065('0xb')](_0x5d04ca,{'showHidden':![],'depth':null}):'');return _0x4cbd31(null);});}return _0x4cbd31(null);});};exports[_0x0065('0x1d')]=function(_0x2f177e){return new BPromise(function(_0x54c4c3,_0x4ad7e2){if(_0x2f177e){return client[_0x0065('0x8')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x0065('0x1e'),_0x0065('0x1f'),_0x0065('0x20')],'where':{'name':_0x2f177e},'limit':0x1}})['then'](function(_0x1086a6){logger[_0x0065('0x6')](_0x0065('0x21'),_0x2f177e,_0x1086a6?util[_0x0065('0xb')](_0x1086a6,{'showHidden':![],'depth':null}):'');logger[_0x0065('0x5')](_0x0065('0x22'),_0x2f177e,_0x1086a6?_0x0065('0x17'):_0x0065('0x18'));return _0x54c4c3(_0x1086a6[_0x0065('0x11')][_0x0065('0x10')]?_0x1086a6['result'][0x0]:null);})['catch'](function(_0x3e3beb){logger['error'](_0x0065('0x23'),_0x3e3beb?util['inspect'](_0x3e3beb,{'showHidden':![],'depth':null}):'');return _0x54c4c3(null);});}return _0x54c4c3(null);});};exports[_0x0065('0x24')]=function(_0x1ffb0b,_0x53aa4c){return moment(_0x1ffb0b)['add'](_0x53aa4c,_0x0065('0x25'))[_0x0065('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x8f9a1a,_0x573f38){return moment(_0x8f9a1a)[_0x0065('0x27')](_0x573f38,_0x0065('0x25'))[_0x0065('0x26')](_0x0065('0x28'));};exports['diffTime']=function(_0x5651bf,_0x20c91a){return moment(_0x5651bf)[_0x0065('0x29')](moment(_0x20c91a),_0x0065('0x25'));};exports[_0x0065('0x2a')]=function(_0x3e4949,_0x51f79b){return parseInt(_0x3e4949,0xa)+parseInt(_0x51f79b,0xa);};exports[_0x0065('0x2b')]=function(){return moment()[_0x0065('0x26')](_0x0065('0x28'));};exports[_0x0065('0x2c')]=function(_0x1cbe3f,_0x554163){if(_0x554163){return moment(_0x1cbe3f)[_0x0065('0x2c')](_0x554163);}return!![];};exports[_0x0065('0x2d')]=function(_0xf0ae10,_0x40c00f){if(_0x40c00f){return moment(_0xf0ae10)[_0x0065('0x2d')](_0x40c00f);}else if(_0xf0ae10){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 157f050..f41c204 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 _0x8521=['express-winston','path','./loggers','fileLogger','./safe-template','maskSensitiveData','join','/var','log','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','connection','device','agent_name','test','setupLoggers','fs-extra','lodash'];(function(_0x2f54ed,_0x372e19){var _0x1daa43=function(_0x37fa26){while(--_0x37fa26){_0x2f54ed['push'](_0x2f54ed['shift']());}};_0x1daa43(++_0x372e19);}(_0x8521,0x19c));var _0x1852=function(_0x15a40b,_0x491b44){_0x15a40b=_0x15a40b-0x0;var _0x238ff3=_0x8521[_0x15a40b];return _0x238ff3;};var fs=require(_0x1852('0x0'));var _=require(_0x1852('0x1'));var ewinston=require(_0x1852('0x2'));var path=require(_0x1852('0x3'));var util=require('util');var fileLogger=require(_0x1852('0x4'))[_0x1852('0x5')];var safeTemplate=require(_0x1852('0x6'))['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x1852('0x7')];function ClientSideLogger(){function _0x5f4a9e(_0x4d535b){var _0x34ffa7=path[_0x1852('0x8')](_0x1852('0x9'),_0x1852('0xa'),'xcally');var _0x37cd59=path[_0x1852('0x8')](_0x1852('0xb'),_0x4d535b[_0x1852('0xc')]+'-'+_0x4d535b[_0x1852('0xd')]);return fs[_0x1852('0xe')](path[_0x1852('0x8')](_0x34ffa7,_0x37cd59))[_0x1852('0xf')](function(){var _0x133ffe=fileLogger(_0x1852('0xb'),path['join'](_0x34ffa7,_0x37cd59));return _0x133ffe;})[_0x1852('0x10')](function(_0x404653){throw _0x404653;});}this[_0x1852('0xa')]=function(_0x2dadb0,_0x4a8ce4,_0x28d1cf,_0x58b55f){return _0x5f4a9e(_0x2dadb0['user'])[_0x1852('0xf')](function(_0xa9b016){var _0x2c9617=_0xa9b016[_0x4a8ce4];return _0x2c9617;})[_0x1852('0xf')](function(_0x1c559f){var _0x389a1d=_0x2dadb0[_0x1852('0x11')]?_0x2dadb0[_0x1852('0x11')]['id']:_0x1852('0x12');var _0x5e9524=_0x58b55f[_0x1852('0x13')];var _0x53788b=_0x58b55f[_0x1852('0x14')];var _0x56fc53=new Date(Number(_0x53788b));return _0x1c559f(_0x389a1d,_0x56fc53,_0x28d1cf,_0x5e9524);})['catch'](function(_0x4deb11){fileLogger(_0x1852('0xb'))['error'](_0x4deb11);});};}function setupLoggers(_0x26e56b){return new Promise(function(_0x1e63d3){var _0x5cad53=new ClientSideLogger();var _0x3f25fa=fileLogger('api');var _0x3b7b6e=fileLogger(_0x1852('0x15'));_0x26e56b[_0x1852('0x16')](_0x1852('0x17'),_0x5cad53);_0x26e56b[_0x1852('0x18')](ewinston[_0x1852('0x19')]({'winstonInstance':_0x3f25fa,'meta':![],'statusLevels':!![],'msg':function(_0xc59433,_0x1e7a30){var _0x5e3f8a=_0x1852('0x1a');if(!_[_0x1852('0x1b')](_0xc59433[_0x1852('0x1c')])){_0x5e3f8a+=_0x1852('0x1d');var _0x42bd60=_0xc59433[_0x1852('0x1c')];maskSensitiveData(_0x42bd60);}return safeTemplate(util['format'](_0x5e3f8a,_0xc59433['method'],_0xc59433[_0x1852('0x1e')]['x-forwarded-for']?_0xc59433['headers'][_0x1852('0x1f')]:_0xc59433['connection'][_0x1852('0x20')]||_0xc59433['ip'],_0xc59433[_0x1852('0x21')],_0x1e7a30[_0x1852('0x22')],_0x1e7a30[_0x1852('0x23')],_0xc59433[_0x1852('0x11')]?_0xc59433['user']['id']:null,_0xc59433[_0x1852('0x11')]?_0xc59433[_0x1852('0x11')][_0x1852('0xd')]:null,_0xc59433[_0x1852('0x11')]?_0xc59433[_0x1852('0x11')][_0x1852('0xc')]:null,_0x42bd60?util['inspect'](_0x42bd60,![],null):''));}}));_0x26e56b[_0x1852('0x18')](ewinston['logger']({'winstonInstance':_0x3b7b6e,'meta':![],'statusLevels':!![],'msg':function(_0x2a4502,_0x4a019a){var _0x3084e9=_0x1852('0x24');if(_0x2a4502[_0x1852('0x1c')]&&_0x2a4502[_0x1852('0x1c')]['device']&&_0x2a4502[_0x1852('0x1c')][_0x1852('0x25')]){_0x3084e9=_0x1852('0x26');}return util[_0x1852('0x27')](_0x3084e9,_0x2a4502[_0x1852('0x28')],_0x2a4502['headers'][_0x1852('0x1f')]?_0x2a4502[_0x1852('0x1e')]['x-forwarded-for']:_0x2a4502[_0x1852('0x29')][_0x1852('0x20')]||_0x2a4502['ip'],_0x2a4502[_0x1852('0x21')],_0x4a019a[_0x1852('0x22')],_0x4a019a[_0x1852('0x23')],_0x2a4502[_0x1852('0x11')]?_0x2a4502['user']['id']:null,_0x2a4502[_0x1852('0x11')]?_0x2a4502['user'][_0x1852('0xd')]:null,_0x2a4502['user']?_0x2a4502[_0x1852('0x11')][_0x1852('0xc')]:null,_0x2a4502['body']&&_0x2a4502[_0x1852('0x1c')]['device']?_0x2a4502[_0x1852('0x1c')][_0x1852('0x2a')]:'other',_0x2a4502['body']&&_0x2a4502['body'][_0x1852('0x25')]?_0x2a4502[_0x1852('0x1c')][_0x1852('0x25')]:'',_0x2a4502[_0x1852('0x1c')]&&_0x2a4502[_0x1852('0x1c')][_0x1852('0x2b')]?_0x2a4502[_0x1852('0x1c')][_0x1852('0x2b')]:'');},'ignoreRoute':function(_0x23d27f){var _0x152319=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x152319[_0x1852('0x2c')](_0x23d27f[_0x1852('0x21')]);}}));return _0x1e63d3();});}exports[_0x1852('0x2d')]=setupLoggers; \ No newline at end of file +var _0x0aa3=['agent_id','agent_name','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','ensureDir','catch','then','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','name','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','device'];(function(_0x307ed1,_0x436047){var _0x5e1470=function(_0x15c131){while(--_0x15c131){_0x307ed1['push'](_0x307ed1['shift']());}};_0x5e1470(++_0x436047);}(_0x0aa3,0x1f1));var _0x30aa=function(_0x4c63dc,_0x836ede){_0x4c63dc=_0x4c63dc-0x0;var _0x5f1d98=_0x0aa3[_0x4c63dc];return _0x5f1d98;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0x30aa('0x0'));var path=require(_0x30aa('0x1'));var util=require(_0x30aa('0x2'));var fileLogger=require('./loggers')[_0x30aa('0x3')];var safeTemplate=require(_0x30aa('0x4'))[_0x30aa('0x5')];var maskSensitiveData=require(_0x30aa('0x6'))[_0x30aa('0x7')];function ClientSideLogger(){function _0x4a4e0c(_0x56cbdf){var _0x333e3c=path[_0x30aa('0x8')](_0x30aa('0x9'),_0x30aa('0xa'),'xcally');var _0x16c4b0=path[_0x30aa('0x8')](_0x30aa('0xb'),_0x56cbdf[_0x30aa('0xc')]+'-'+_0x56cbdf['name']);return fs[_0x30aa('0xd')](path['join'](_0x333e3c,_0x16c4b0))['then'](function(){var _0x508f10=fileLogger(_0x30aa('0xb'),path[_0x30aa('0x8')](_0x333e3c,_0x16c4b0));return _0x508f10;})[_0x30aa('0xe')](function(_0x442071){throw _0x442071;});}this['log']=function(_0x4eaf50,_0x5d858a,_0x45052e,_0x2a6aab){return _0x4a4e0c(_0x4eaf50['user'])[_0x30aa('0xf')](function(_0x2ec100){var _0x451272=_0x2ec100[_0x5d858a];return _0x451272;})[_0x30aa('0xf')](function(_0x26c292){var _0x3b8e1e=_0x4eaf50[_0x30aa('0x10')]?_0x4eaf50[_0x30aa('0x10')]['id']:_0x30aa('0x11');var _0x26db9f=_0x2a6aab[_0x30aa('0x12')];var _0x488e31=_0x2a6aab[_0x30aa('0x13')];var _0x28d708=new Date(Number(_0x488e31));return _0x26c292(_0x3b8e1e,_0x28d708,_0x45052e,_0x26db9f);})[_0x30aa('0xe')](function(_0x27181c){fileLogger(_0x30aa('0xb'))[_0x30aa('0x14')](_0x27181c);});};}function setupLoggers(_0x5f1320){return new Promise(function(_0x2e50f2){var _0x3822e4=new ClientSideLogger();var _0x557f90=fileLogger(_0x30aa('0x15'));var _0x23adbc=fileLogger(_0x30aa('0x16'));_0x5f1320[_0x30aa('0x17')](_0x30aa('0x18'),_0x3822e4);_0x5f1320[_0x30aa('0x19')](ewinston['logger']({'winstonInstance':_0x557f90,'meta':![],'statusLevels':!![],'msg':function(_0x5dc61c,_0x438305){var _0x2adc94=_0x30aa('0x1a');if(!_[_0x30aa('0x1b')](_0x5dc61c[_0x30aa('0x1c')])){_0x2adc94+=_0x30aa('0x1d');var _0x4f738a=_0x5dc61c[_0x30aa('0x1c')];maskSensitiveData(_0x4f738a);}return safeTemplate(util[_0x30aa('0x1e')](_0x2adc94,_0x5dc61c[_0x30aa('0x1f')],_0x5dc61c[_0x30aa('0x20')][_0x30aa('0x21')]?_0x5dc61c[_0x30aa('0x20')][_0x30aa('0x21')]:_0x5dc61c[_0x30aa('0x22')]['remoteAddress']||_0x5dc61c['ip'],_0x5dc61c[_0x30aa('0x23')],_0x438305[_0x30aa('0x24')],_0x438305[_0x30aa('0x25')],_0x5dc61c['user']?_0x5dc61c[_0x30aa('0x10')]['id']:null,_0x5dc61c[_0x30aa('0x10')]?_0x5dc61c['user'][_0x30aa('0x26')]:null,_0x5dc61c[_0x30aa('0x10')]?_0x5dc61c[_0x30aa('0x10')][_0x30aa('0xc')]:null,_0x4f738a?util['inspect'](_0x4f738a,![],null):''));}}));_0x5f1320[_0x30aa('0x19')](ewinston[_0x30aa('0x27')]({'winstonInstance':_0x23adbc,'meta':![],'statusLevels':!![],'msg':function(_0x6f5966,_0x41165d){var _0x2a7f65='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x6f5966[_0x30aa('0x1c')]&&_0x6f5966['body']['device']&&_0x6f5966[_0x30aa('0x1c')]['agent_id']){_0x2a7f65=_0x30aa('0x28');}return util['format'](_0x2a7f65,_0x6f5966['method'],_0x6f5966[_0x30aa('0x20')]['x-forwarded-for']?_0x6f5966['headers'][_0x30aa('0x21')]:_0x6f5966['connection'][_0x30aa('0x29')]||_0x6f5966['ip'],_0x6f5966[_0x30aa('0x23')],_0x41165d['statusCode'],_0x41165d[_0x30aa('0x25')],_0x6f5966['user']?_0x6f5966[_0x30aa('0x10')]['id']:null,_0x6f5966['user']?_0x6f5966['user']['name']:null,_0x6f5966[_0x30aa('0x10')]?_0x6f5966[_0x30aa('0x10')]['role']:null,_0x6f5966['body']&&_0x6f5966[_0x30aa('0x1c')][_0x30aa('0x2a')]?_0x6f5966[_0x30aa('0x1c')][_0x30aa('0x2a')]:'other',_0x6f5966[_0x30aa('0x1c')]&&_0x6f5966[_0x30aa('0x1c')][_0x30aa('0x2b')]?_0x6f5966['body']['agent_id']:'',_0x6f5966[_0x30aa('0x1c')]&&_0x6f5966['body']['agent_name']?_0x6f5966['body'][_0x30aa('0x2c')]:'');},'ignoreRoute':function(_0x46f68a){var _0x473194=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x473194['test'](_0x46f68a[_0x30aa('0x23')]);}}));return _0x2e50f2();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f7edfc6..8edcaae 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c96=['info','redBG\x20white','red','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','/var/log/xcally','join','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','keys','length','stringify','level','Logger','transports','Console','warn','File','%s-%s','error','path','util','moment','winston','../config/environment','debugLevel','toLowerCase'];(function(_0x4528cf,_0x3b1892){var _0x4bca53=function(_0x47d77b){while(--_0x47d77b){_0x4528cf['push'](_0x4528cf['shift']());}};_0x4bca53(++_0x3b1892);}(_0x1c96,0x16b));var _0x61c9=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x1c96[_0xdd2bfa];return _0x55397e;};'use strict';var path=require(_0x61c9('0x0'));var util=require(_0x61c9('0x1'));var moment=require(_0x61c9('0x2'));var winston=require(_0x61c9('0x3'));var config=require(_0x61c9('0x4'));var debugLevel=config[_0x61c9('0x5')]?config[_0x61c9('0x5')][_0x61c9('0x6')]():_0x61c9('0x7');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':_0x61c9('0x8'),'error':_0x61c9('0x9'),'warn':'bold\x20yellow','info':_0x61c9('0xa'),'print':_0x61c9('0xb'),'success':'bold\x20green','http':_0x61c9('0xc'),'verbose':_0x61c9('0xd'),'debug':_0x61c9('0xe'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x557610,_0x457474,_0x4cd275){var _0x35c67b=_0x557610||_0x61c9('0xf');return path[_0x61c9('0x10')](_0x35c67b,util[_0x61c9('0x11')]('%s-%s.log',_0x457474,_0x4cd275));}function formatter(_0x293d04,_0x515cad){_0x515cad['message']=_0x515cad[_0x61c9('0x12')][_0x61c9('0x13')](/@@{/g,'{{{')['replace'](/}@@/g,_0x61c9('0x14'))[_0x61c9('0x13')](/@{/g,'{{')[_0x61c9('0x13')](/}@/g,'}}');return util[_0x61c9('0x11')](_0x61c9('0x15'),moment()['format'](_0x61c9('0x16')),_0x515cad['level'][_0x61c9('0x17')](),_0x293d04,_0x515cad[_0x61c9('0x12')]);}function fileFormat(_0x44ac1d,_0x19adfc){_0x19adfc['message']=_0x19adfc['message'][_0x61c9('0x13')](/@@{/g,_0x61c9('0x18'))[_0x61c9('0x13')](/}@@/g,_0x61c9('0x14'))[_0x61c9('0x13')](/@{/g,'{{')[_0x61c9('0x13')](/}@/g,'}}');var _0x32b011=_0x19adfc[_0x61c9('0x19')]&&Object[_0x61c9('0x1a')](_0x19adfc['meta'])[_0x61c9('0x1b')]?'\x0a\x09'+JSON[_0x61c9('0x1c')](_0x19adfc[_0x61c9('0x19')]):'';return util[_0x61c9('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x61c9('0x11')](_0x61c9('0x16')),_0x19adfc[_0x61c9('0x1d')]['toUpperCase'](),_0x44ac1d,_0x19adfc[_0x61c9('0x12')],_0x32b011);}function consoleLogger(){var _0x3a38ad=new winston[(_0x61c9('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x61c9('0x1f'))][(_0x61c9('0x20'))]({'level':_0x61c9('0x21'),'json':![],'formatter':function(_0x3afeeb){return formatter('',_0x3afeeb);}})]});return _0x3a38ad;}function fileLogger(_0x5db441,_0x41e786){var _0x51a609=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x61c9('0x1f'))][(_0x61c9('0x22'))]({'name':util[_0x61c9('0x11')](_0x61c9('0x23'),_0x5db441,'error'),'filename':getLogFileName(_0x41e786,_0x5db441,_0x61c9('0x24')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x53eabe){return fileFormat(_0x5db441,_0x53eabe);}}),new winston[(_0x61c9('0x1f'))][(_0x61c9('0x22'))]({'name':util[_0x61c9('0x11')](_0x61c9('0x23'),_0x5db441,debugLevel),'filename':getLogFileName(_0x41e786,_0x5db441,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d96d6){return fileFormat(_0x5db441,_0x4d96d6);}}),new winston[(_0x61c9('0x1f'))][(_0x61c9('0x20'))]({'level':_0x61c9('0x21'),'json':![],'formatter':function(_0x7378a6){return fileFormat(_0x5db441,_0x7378a6);}})]});return _0x51a609;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x61fb=['replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','util','moment','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','format','%s-%s.log','message'];(function(_0x4bb30f,_0x2f9149){var _0x2685c1=function(_0x25550a){while(--_0x25550a){_0x4bb30f['push'](_0x4bb30f['shift']());}};_0x2685c1(++_0x2f9149);}(_0x61fb,0x1ef));var _0xb61f=function(_0x36643f,_0x5e3acb){_0x36643f=_0x36643f-0x0;var _0x1ab487=_0x61fb[_0x36643f];return _0x1ab487;};'use strict';var path=require('path');var util=require(_0xb61f('0x0'));var moment=require(_0xb61f('0x1'));var winston=require('winston');var config=require(_0xb61f('0x2'));var debugLevel=config[_0xb61f('0x3')]?config['debugLevel'][_0xb61f('0x4')]():'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':_0xb61f('0x5'),'error':_0xb61f('0x6'),'warn':'bold\x20yellow','info':'white','print':'bold\x20white','success':_0xb61f('0x7'),'http':_0xb61f('0x8'),'verbose':_0xb61f('0x9'),'debug':'bold\x20blue','silly':_0xb61f('0xa')};winston[_0xb61f('0xb')](XC_LOG_COLORS);function getLogFileName(_0x5930e3,_0x22c670,_0x2fd383){var _0x5e23dd=_0x5930e3||'/var/log/xcally';return path['join'](_0x5e23dd,util[_0xb61f('0xc')](_0xb61f('0xd'),_0x22c670,_0x2fd383));}function formatter(_0x33d381,_0x386765){_0x386765[_0xb61f('0xe')]=_0x386765['message'][_0xb61f('0xf')](/@@{/g,_0xb61f('0x10'))['replace'](/}@@/g,_0xb61f('0x11'))['replace'](/@{/g,'{{')[_0xb61f('0xf')](/}@/g,'}}');return util[_0xb61f('0xc')](_0xb61f('0x12'),moment()['format'](_0xb61f('0x13')),_0x386765[_0xb61f('0x14')][_0xb61f('0x15')](),_0x33d381,_0x386765[_0xb61f('0xe')]);}function fileFormat(_0x17fd0d,_0x77bc58){_0x77bc58[_0xb61f('0xe')]=_0x77bc58[_0xb61f('0xe')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0xb61f('0xf')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x5d1eee=_0x77bc58[_0xb61f('0x16')]&&Object['keys'](_0x77bc58[_0xb61f('0x16')])[_0xb61f('0x17')]?'\x0a\x09'+JSON[_0xb61f('0x18')](_0x77bc58['meta']):'';return util[_0xb61f('0xc')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xb61f('0xc')](_0xb61f('0x13')),_0x77bc58[_0xb61f('0x14')][_0xb61f('0x15')](),_0x17fd0d,_0x77bc58[_0xb61f('0xe')],_0x5d1eee);}function consoleLogger(){var _0x464bc9=new winston[(_0xb61f('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb61f('0x1a'))][(_0xb61f('0x1b'))]({'level':_0xb61f('0x1c'),'json':![],'formatter':function(_0x3c6af9){return formatter('',_0x3c6af9);}})]});return _0x464bc9;}function fileLogger(_0x2447c1,_0x4b1ccb){var _0x4a84a7=new winston[(_0xb61f('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb61f('0x1d'))]({'name':util[_0xb61f('0xc')](_0xb61f('0x1e'),_0x2447c1,_0xb61f('0x1f')),'filename':getLogFileName(_0x4b1ccb,_0x2447c1,_0xb61f('0x1f')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2910ae){return fileFormat(_0x2447c1,_0x2910ae);}}),new winston['transports'][(_0xb61f('0x1d'))]({'name':util['format'](_0xb61f('0x1e'),_0x2447c1,debugLevel),'filename':getLogFileName(_0x4b1ccb,_0x2447c1,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x738903){return fileFormat(_0x2447c1,_0x738903);}}),new winston[(_0xb61f('0x1a'))][(_0xb61f('0x1b'))]({'level':_0xb61f('0x1c'),'json':![],'formatter':function(_0x14feee){return fileFormat(_0x2447c1,_0x14feee);}})]});return _0x4a84a7;}exports[_0xb61f('0x20')]=consoleLogger;exports[_0xb61f('0x21')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 94a6119..c117eae 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x1a85,0x178));var _0x51a8=function(_0x4f526c,_0x6c4dbe){_0x4f526c=_0x4f526c-0x0;var _0x38a51e=_0x1a85[_0x4f526c];return _0x38a51e;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x2bd9ae,_0x1bf150){var _0x201b4c=function(_0x20dc02){while(--_0x20dc02){_0x2bd9ae['push'](_0x2bd9ae['shift']());}};_0x201b4c(++_0x1bf150);}(_0xda2d,0x102));var _0xdda2=function(_0x235934,_0x1ca077){_0x235934=_0x235934-0x0;var _0x13e6e0=_0xda2d[_0x235934];return _0x13e6e0;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 4e2ef17..68e02e6 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x8952,0x17e));var _0x2895=function(_0x2869fe,_0x5b6a7b){_0x2869fe=_0x2869fe-0x0;var _0x41a960=_0x8952[_0x2869fe];return _0x41a960;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file +var _0x7916=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','safeTemplate','lodash'];(function(_0x63ef61,_0x337aae){var _0x4d9caf=function(_0xdc17e3){while(--_0xdc17e3){_0x63ef61['push'](_0x63ef61['shift']());}};_0x4d9caf(++_0x337aae);}(_0x7916,0x128));var _0x6791=function(_0x416178,_0x2c66aa){_0x416178=_0x416178-0x0;var _0x511397=_0x7916[_0x416178];return _0x511397;};var _=require(_0x6791('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5eaf3a){return _0x5eaf3a==='{{'?_0x6791('0x1'):_0x6791('0x2');}function safeTemplate(_0x4ca50a){var _0x325c54=_0x4ca50a;if(typeof _0x4ca50a===_0x6791('0x3')){_0x325c54=_0x4ca50a[_0x6791('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x6791('0x5')](_0x4ca50a)){_0x325c54=_0x4ca50a['map'](function(_0xe98396){return safeTemplate(_0xe98396);});}else if(_['isPlainObject'](_0x4ca50a)){_0x325c54=Object[_0x6791('0x6')](_0x4ca50a)[_0x6791('0x7')](function(_0x5ad8c0,_0x8b85ff){_0x5ad8c0[_0x8b85ff]=safeTemplate(_0x4ca50a[_0x8b85ff]);return _0x5ad8c0;},{});}return _0x325c54;}module['exports'][_0x6791('0x8')]=safeTemplate; \ No newline at end of file